From 1b56dbbef368a859f4490aaa104758d7da4b5aeb Mon Sep 17 00:00:00 2001 From: Victor Gonzalez Date: Sun, 10 Aug 2025 20:36:39 +0200 Subject: [PATCH 001/986] [PWGCF] DptDpt - Applying clang for ordering header includes (#12517) Co-authored-by: Victor --- PWGCF/TableProducer/dptDptFilter.cxx | 41 +++++++------ PWGCF/TableProducer/dptDptFilter.h | 43 +++++++------ PWGCF/Tasks/dptDptCorrelations.cxx | 51 +++++++++------- PWGCF/Tasks/dptDptFilterQa.cxx | 9 +-- PWGCF/Tasks/matchRecoGen.cxx | 17 +++--- .../Tasks/dptDptEfficiencyAndQc.cxx | 61 ++++++++++--------- .../Tasks/dptDptPerRunExtraQc.cxx | 12 ++-- .../Tasks/dptDptPerRunQc.cxx | 25 ++++---- 8 files changed, 138 insertions(+), 121 deletions(-) diff --git a/PWGCF/TableProducer/dptDptFilter.cxx b/PWGCF/TableProducer/dptDptFilter.cxx index 30f55cf3c3f..c55cec45f1e 100644 --- a/PWGCF/TableProducer/dptDptFilter.cxx +++ b/PWGCF/TableProducer/dptDptFilter.cxx @@ -13,40 +13,43 @@ /// \brief Filters collisions and tracks according to selection criteria /// \author victor.gonzalez.sebastian@gmail.com -#include -#include -#include -#include +#include "PWGCF/TableProducer/dptDptFilter.h" + +#include "PWGCF/Core/AnalysisConfigurableCuts.h" +#include "PWGCF/DataModel/DptDptFiltered.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "CommonConstants/PhysicsConstants.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Centrality.h" #include "Common/Core/TableHelper.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectionDefaults.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/EventSelection.h" #include "Common/DataModel/PIDResponse.h" -#include "PWGCF/Core/AnalysisConfigurableCuts.h" -#include "PWGCF/DataModel/DptDptFiltered.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/CollisionAssociationTables.h" + +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" #include "Framework/O2DatabasePDGPlugin.h" -#include "Framework/runDataProcessing.h" #include "Framework/RunningWorkflowInfo.h" -#include -#include -#include -#include +#include "Framework/runDataProcessing.h" + #include #include #include #include #include +#include +#include +#include #include +#include -#include "PWGCF/TableProducer/dptDptFilter.h" +#include +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/PWGCF/TableProducer/dptDptFilter.h b/PWGCF/TableProducer/dptDptFilter.h index 18076266f1a..b107156d5f3 100644 --- a/PWGCF/TableProducer/dptDptFilter.h +++ b/PWGCF/TableProducer/dptDptFilter.h @@ -16,33 +16,36 @@ #ifndef PWGCF_TABLEPRODUCER_DPTDPTFILTER_H_ #define PWGCF_TABLEPRODUCER_DPTDPTFILTER_H_ +#include "PWGCF/Core/AnalysisConfigurableCuts.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/TrackSelectionDefaults.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "ReconstructionDataFormats/PID.h" #include -#include -#include + #include #include -#include +#include +#include + #include -#include -#include #include -#include -#include -#include #include +#include +#include #include - -#include "ReconstructionDataFormats/PID.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/Core/RecoDecay.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/TrackSelectionDefaults.h" -#include "PWGCF/Core/AnalysisConfigurableCuts.h" +#include +#include +#include +#include namespace o2 { diff --git a/PWGCF/Tasks/dptDptCorrelations.cxx b/PWGCF/Tasks/dptDptCorrelations.cxx index 065e4be286f..07754ef5316 100644 --- a/PWGCF/Tasks/dptDptCorrelations.cxx +++ b/PWGCF/Tasks/dptDptCorrelations.cxx @@ -13,7 +13,26 @@ /// \brief implements two-particle correlations base data collection /// \author victor.gonzalez.sebastian@gmail.com +#include "PWGCF/Core/AnalysisConfigurableCuts.h" +#include "PWGCF/Core/PairCuts.h" +#include "PWGCF/DataModel/DptDptFiltered.h" +#include "PWGCF/TableProducer/dptDptFilter.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TableHelper.h" +#include "Common/Core/TrackSelection.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "DataFormatsParameters/GRPObject.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" #include + #include #include #include @@ -24,28 +43,12 @@ #include #include #include + +#include #include +#include #include #include -#include -#include - -#include "Common/Core/TrackSelection.h" -#include "Common/Core/TableHelper.h" -#include "Common/Core/RecoDecay.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "DataFormatsParameters/GRPObject.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "Framework/RunningWorkflowInfo.h" -#include "PWGCF/Core/AnalysisConfigurableCuts.h" -#include "PWGCF/Core/PairCuts.h" -#include "PWGCF/DataModel/DptDptFiltered.h" -#include "PWGCF/TableProducer/dptDptFilter.h" using namespace o2; using namespace o2::framework; @@ -279,15 +282,17 @@ struct DptDptCorrelations { photon = p1+p2; photon.M()*/ - float tantheta1 = 1e10; + constexpr float kLARGETANTHETA = 1e10; + constexpr float kVERYSMALLETA = 1e-10; + float tantheta1 = kLARGETANTHETA; - if (track1.eta() < -1e-10 || track1.eta() > 1e-10) { + if (track1.eta() < -kVERYSMALLETA || track1.eta() > kVERYSMALLETA) { float expTmp = std::exp(-track1.eta()); tantheta1 = 2.0 * expTmp / (1.0 - expTmp * expTmp); } - float tantheta2 = 1e10; - if (track2.eta() < -1e-10 || track2.eta() > 1e-10) { + float tantheta2 = kLARGETANTHETA; + if (track2.eta() < -kVERYSMALLETA || track2.eta() > kVERYSMALLETA) { float expTmp = std::exp(-track2.eta()); tantheta2 = 2.0 * expTmp / (1.0 - expTmp * expTmp); } diff --git a/PWGCF/Tasks/dptDptFilterQa.cxx b/PWGCF/Tasks/dptDptFilterQa.cxx index 85dee751438..876fd8ccb5e 100644 --- a/PWGCF/Tasks/dptDptFilterQa.cxx +++ b/PWGCF/Tasks/dptDptFilterQa.cxx @@ -13,15 +13,16 @@ /// \brief basic checks for the behavior of the filter task /// \author victor.gonzalez.sebastian@gmail.com -#include -#include +#include "PWGCF/DataModel/DptDptFiltered.h" +#include "PWGCF/TableProducer/dptDptFilter.h" #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" -#include "PWGCF/DataModel/DptDptFiltered.h" -#include "PWGCF/TableProducer/dptDptFilter.h" + +#include +#include using namespace o2; using namespace o2::framework; diff --git a/PWGCF/Tasks/matchRecoGen.cxx b/PWGCF/Tasks/matchRecoGen.cxx index 57ab00301b7..1881b17b268 100644 --- a/PWGCF/Tasks/matchRecoGen.cxx +++ b/PWGCF/Tasks/matchRecoGen.cxx @@ -13,25 +13,24 @@ /// \brief basic check for the matching between generator level and detector level /// \author victor.gonzalez.sebastian@gmail.com -#include -#include -#include +#include "PWGCF/Core/AnalysisConfigurableCuts.h" +#include "PWGCF/DataModel/DptDptFiltered.h" +#include "PWGCF/TableProducer/dptDptFilter.h" +#include "Common/Core/RecoDecay.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectionDefaults.h" -#include "Common/Core/RecoDecay.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" + #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" #include "Framework/O2DatabasePDGPlugin.h" #include "Framework/runDataProcessing.h" -#include "PWGCF/Core/AnalysisConfigurableCuts.h" -#include "PWGCF/DataModel/DptDptFiltered.h" -#include "PWGCF/TableProducer/dptDptFilter.h" + #include #include #include @@ -42,6 +41,10 @@ #include #include +#include +#include +#include + using namespace o2; using namespace o2::framework; using namespace o2::soa; diff --git a/PWGCF/TwoParticleCorrelations/Tasks/dptDptEfficiencyAndQc.cxx b/PWGCF/TwoParticleCorrelations/Tasks/dptDptEfficiencyAndQc.cxx index 0fdbca208bf..b561f50af0e 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/dptDptEfficiencyAndQc.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/dptDptEfficiencyAndQc.cxx @@ -13,35 +13,38 @@ /// \brief Provides efficiency extraction and QC for track cuts and PID /// \author victor.gonzalez.sebastian@gmail.com -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "ReconstructionDataFormats/PID.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/TableHelper.h" +#include "PWGCF/Core/AnalysisConfigurableCuts.h" +#include "PWGCF/DataModel/DptDptFiltered.h" +#include "PWGCF/TableProducer/dptDptFilter.h" + #include "Common/Core/RecoDecay.h" -#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/Core/TableHelper.h" +#include "Common/Core/TrackSelection.h" #include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + #include "Framework/ASoAHelpers.h" -#include "Framework/Expressions.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" +#include "Framework/Expressions.h" #include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/PID.h" +#include + #include "Math/MatrixFunctions.h" #include "Math/SMatrix.h" +#include +#include +#include +#include +#include -#include "PWGCF/Core/AnalysisConfigurableCuts.h" -#include "PWGCF/DataModel/DptDptFiltered.h" -#include "PWGCF/TableProducer/dptDptFilter.h" +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -741,41 +744,41 @@ struct PidDataCollectingEngine { if constexpr (kindOfData == kReco) { /* PID histograms */ std::vector whenname{"Before", "After"}; - constexpr char whenprefix[kNoOfSteps]{'B', 'A'}; + constexpr char kWhenPrefix[kNoOfSteps]{'B', 'A'}; std::vector whentitle{"before", ""}; for (uint ix = 0; ix < kNoOfSteps; ++ix) { fhTPCdEdxSignalVsP[ix] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "PID", whenname[ix].c_str()), - HNAMESTRING("tpcSignalVsP%c", whenprefix[ix]), + HNAMESTRING("tpcSignalVsP%c", kWhenPrefix[ix]), HTITLESTRING("TPC dE/dx signal %s", whentitle[ix].c_str()), kTH2F, {pidPAxis, dEdxAxis}); fhTOFSignalVsP[ix] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "PID", whenname[ix].c_str()), - HNAMESTRING("tofSignalVsP%c", whenprefix[ix]), + HNAMESTRING("tofSignalVsP%c", kWhenPrefix[ix]), HTITLESTRING("TOF signal %s", whentitle[ix].c_str()), kTH2F, {pidPAxis, {200, 0.0, 1.1, "#beta"}}); fhPvsTOFSqMass[ix] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "PID", whenname[ix].c_str()), - HNAMESTRING("tofPvsMassSq%c", whenprefix[ix]), + HNAMESTRING("tofPvsMassSq%c", kWhenPrefix[ix]), HTITLESTRING("Momentum versus #it{m}^{2} %s", whentitle[ix].c_str()), kTH2F, {{140, 0.0, 1.4, "#it{m}^{2} ((GeV/c^{2})^{2})"}, pidPAxis}); for (uint isp = 0; isp < nmainsp; ++isp) { fhTPCdEdxSignalDiffVsP[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "PID", whenname[ix].c_str()), - HNAMESTRING("tpcSignalDiffVsP%c_%s", whenprefix[ix], mainspnames[isp].c_str()), + HNAMESTRING("tpcSignalDiffVsP%c_%s", kWhenPrefix[ix], mainspnames[isp].c_str()), HTITLESTRING("TPC dE/dx to the %s line %s", mainsptitles[isp].c_str(), whentitle[ix].c_str()), kTH2F, {pidPAxis, {400, -200.0, 200.0, FORMATSTRING("dE/dx - _{%s}", mainsptitles[isp].c_str())}}); fhTOFSignalDiffVsP[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "PID", whenname[ix].c_str()), - HNAMESTRING("tofSignalDiffVsP%c_%s", whenprefix[ix], mainspnames[isp].c_str()), + HNAMESTRING("tofSignalDiffVsP%c_%s", kWhenPrefix[ix], mainspnames[isp].c_str()), HTITLESTRING("#Delta^{TOF_{%s}} %s", mainsptitles[isp].c_str(), whentitle[ix].c_str()), kTH2F, {pidPAxis, {200, -1000.0, 1000.0, FORMATSTRING("t-t_{ev}-t_{exp_{%s}} (ps)", mainsptitles[isp].c_str())}}); fhTPCTOFSigmaVsP[ix][isp] = ADDHISTOGRAM(TH3, DIRECTORYSTRING("%s/%s/%s", dirname, "PID", whenname[ix].c_str()), - HNAMESTRING("toftpcNSigmasVsP%c_%s", whenprefix[ix], mainspnames[isp].c_str()), + HNAMESTRING("toftpcNSigmasVsP%c_%s", kWhenPrefix[ix], mainspnames[isp].c_str()), HTITLESTRING("n#sigma to the %s line %s", mainsptitles[isp].c_str(), whentitle[ix].c_str()), kTH3F, {pidPAxis, {noOfNSigmaBins, minNSigma, maxNSigma, FORMATSTRING("n#sigma_{TPC}^{%s}", mainsptitles[isp].c_str())}, {120, -6.0, 6.0, FORMATSTRING("n#sigma_{TOF}^{%s}", mainsptitles[isp].c_str())}}); } for (uint isp = 0; isp < nallmainsp; ++isp) { fhTPCnSigmasVsP[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "PID", whenname[ix].c_str()), - HNAMESTRING("tpcNSigmasVsP%c_%s", whenprefix[ix], allmainspnames[isp].c_str()), + HNAMESTRING("tpcNSigmasVsP%c_%s", kWhenPrefix[ix], allmainspnames[isp].c_str()), HTITLESTRING("TPC n#sigma to the %s line %s", allmainsptitles[isp].c_str(), whentitle[ix].c_str()), kTH2F, {pidPAxis, {noOfNSigmaBins, minNSigma, maxNSigma, FORMATSTRING("n#sigma_{TPC}^{%s}", allmainsptitles[isp].c_str())}}); fhTOFnSigmasVsP[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "PID", whenname[ix].c_str()), - HNAMESTRING("tofNSigmasVsP%c_%s", whenprefix[ix], allmainspnames[isp].c_str()), + HNAMESTRING("tofNSigmasVsP%c_%s", kWhenPrefix[ix], allmainspnames[isp].c_str()), HTITLESTRING("TOF n#sigma to the %s line %s", allmainsptitles[isp].c_str(), whentitle[ix].c_str()), kTH2F, {pidPAxis, {noOfNSigmaBins, minNSigma, maxNSigma, FORMATSTRING("n#sigma_{TOF}^{%s}", allmainsptitles[isp].c_str())}}); } diff --git a/PWGCF/TwoParticleCorrelations/Tasks/dptDptPerRunExtraQc.cxx b/PWGCF/TwoParticleCorrelations/Tasks/dptDptPerRunExtraQc.cxx index 8617a65de2f..c9304ec1ef9 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/dptDptPerRunExtraQc.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/dptDptPerRunExtraQc.cxx @@ -13,18 +13,18 @@ /// \brief basic per run check of the per analyzed species p vs TPC IW momentum /// \author victor.gonzalez.sebastian@gmail.com -#include -#include -#include +#include "PWGCF/DataModel/DptDptFiltered.h" +#include "PWGCF/TableProducer/dptDptFilter.h" +#include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" -#include "PWGCF/DataModel/DptDptFiltered.h" -#include "PWGCF/TableProducer/dptDptFilter.h" +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/PWGCF/TwoParticleCorrelations/Tasks/dptDptPerRunQc.cxx b/PWGCF/TwoParticleCorrelations/Tasks/dptDptPerRunQc.cxx index 598d3305539..286641391ea 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/dptDptPerRunQc.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/dptDptPerRunQc.cxx @@ -13,29 +13,28 @@ /// \brief basic per run check of the ITS dead chips and of the hadronic interaction rate /// \author victor.gonzalez.sebastian@gmail.com -#include -#include -#include -#include -#include -#include +#include "PWGCF/DataModel/DptDptFiltered.h" +#include "PWGCF/TableProducer/dptDptFilter.h" -#include "CCDB/BasicCCDBManager.h" #include "Common/CCDB/ctpRateFetcher.h" -#include "DataFormatsParameters/AggregatedRunInfo.h" +#include "CCDB/BasicCCDBManager.h" #include "DataFormatsITSMFT/NoiseMap.h" // missing include in TimeDeadMap.h #include "DataFormatsITSMFT/TimeDeadMap.h" -#include "ITSMFTReconstruction/ChipMappingITS.h" - +#include "DataFormatsParameters/AggregatedRunInfo.h" +#include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" +#include "ITSMFTReconstruction/ChipMappingITS.h" -#include "PWGCF/DataModel/DptDptFiltered.h" -#include "PWGCF/TableProducer/dptDptFilter.h" +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; From 0f3b1ea0d32b09810fe09a2e7a84648530b32ec2 Mon Sep 17 00:00:00 2001 From: Victor Gonzalez Date: Mon, 11 Aug 2025 00:39:02 +0200 Subject: [PATCH 002/986] [PWGCF] DptDpt - Using metadata for auto autoconfiguration (#12521) Co-authored-by: Victor --- PWGCF/TableProducer/dptDptFilter.h | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/PWGCF/TableProducer/dptDptFilter.h b/PWGCF/TableProducer/dptDptFilter.h index b107156d5f3..3e44818103c 100644 --- a/PWGCF/TableProducer/dptDptFilter.h +++ b/PWGCF/TableProducer/dptDptFilter.h @@ -18,6 +18,7 @@ #include "PWGCF/Core/AnalysisConfigurableCuts.h" +#include "Common/Core/MetadataHelper.h" #include "Common/Core/RecoDecay.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectionDefaults.h" @@ -74,6 +75,9 @@ enum SystemType { kXeXe, ///< **Xe-Xe** system kppRun3, ///< **p-p Run 3** system kPbPbRun3, ///< **Pb-Pb Run 3** system + kNeNeRun3, ///< **Ne-Ne Run 3** system + kOORun3, ///< **O-O Run 3** system + kpORun3, ///< **p-O Run 3** system knSystems ///< number of handled systems }; @@ -194,6 +198,11 @@ float overallminp = 0.0f; //============================================================================================ std::bitset<32> collisionFlags; +//============================================================================================ +// The input data metadata access helper +//============================================================================================ +o2::common::core::MetadataHelper metadataInfo; + //============================================================================================ // The DptDptFilter configuration objects //============================================================================================ @@ -561,6 +570,22 @@ inline TriggerSelectionType getTriggerSelection(std::string const& triggstr) } } +inline SystemType getSytemTypeFromMetaData() +{ + auto period = metadataInfo.get("LPMProductionTag"); + + if (period == "LHC25ad" || period == "LHC25g5") { + return kpORun3; + } else if (period == "LHC25ae" || period == "LHC25g6") { + return kOORun3; + } else if (period == "LHC25af" || period == "LHC25g7") { + return kNeNeRun3; + } else { + LOGF(fatal, "DptDptCorrelations::getSystemTypeFromMetadata(). No automatic system type configuration for %s period", period.c_str()); + } + return kPbp; +} + inline SystemType getSystemType(std::string const& sysstr) { /* we have to figure out how extract the system type */ @@ -572,14 +597,14 @@ inline SystemType getSystemType(std::string const& sysstr) return kpPb; } else if (sysstr == "Pbp") { return kPbp; - } else if (sysstr == "pPb") { - return kpPb; } else if (sysstr == "XeXe") { return kXeXe; } else if (sysstr == "ppRun3") { return kppRun3; } else if (sysstr == "PbPbRun3") { return kPbPbRun3; + } else if (sysstr == "Auto") { + return getSytemTypeFromMetaData(); } else { LOGF(fatal, "DptDptCorrelations::getSystemType(). Wrong system type: %s", sysstr.c_str()); } From 8da160d6e00f64d1f8386fc9f54bf26659ae0d06 Mon Sep 17 00:00:00 2001 From: yuanzhe <90246048+wang-yuanzhe@users.noreply.github.com> Date: Mon, 11 Aug 2025 08:05:05 +0200 Subject: [PATCH 003/986] [PWGLF] Fix TOF PID selection and decay mode check for hypertriton kink analysis (#12500) --- PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx b/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx index 9614d561dc0..4c7ac865c18 100644 --- a/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx @@ -142,9 +142,9 @@ struct H3LDecay { if ((haveTriton && havePion0) || (haveAntiTriton && havePion0)) { return H3LDecay::k2bodyNeutral; - } else if ((haveHelium3 && havePion0) || (haveAntiHelium3 && havePion0)) { + } else if ((haveHelium3 && havePionMinus) || (haveAntiHelium3 && havePionPlus)) { return H3LDecay::k2bodyCharged; - } else if ((haveDeuteron && haveProton && havePionPlus) || (haveAntiDeuteron && haveAntiProton && havePionMinus)) { + } else if ((haveDeuteron && haveProton && havePionMinus) || (haveAntiDeuteron && haveAntiProton && havePionPlus)) { return H3LDecay::k3bodyCharged; } else { return kNChannel; @@ -408,6 +408,7 @@ struct HyperkinkRecoTask { Configurable maxZVertex{"maxZVertex", 10.0f, "Accepted z-vertex range (cm)"}; Configurable cutTPCNSigmaDaug{"cutTPCNSigmaDaug", 5, "TPC NSigma cut for daughter tracks"}; Configurable cutTOFNSigmaDaug{"cutTOFNSigmaDaug", 1000, "TOF NSigma cut for daughter tracks"}; + Configurable askTOFForDaug{"askTOFForDaug", false, "If true, ask for TOF signal"}; // CCDB options Configurable inputBz{"inputBz", -999, "bz field, -999 is automatic"}; @@ -671,7 +672,7 @@ struct HyperkinkRecoTask { auto originalDaugCol = daugTrack.collision_as(); nSigmaTOF = getTOFNSigma(mRespParamsV3, daugTrack, collision, originalDaugCol); } - if (std::abs(nSigmaTOF) > cutTOFNSigmaDaug) { + if ((daugTrack.hasTOF() || askTOFForDaug) && std::abs(nSigmaTOF) > cutTOFNSigmaDaug) { continue; } @@ -793,7 +794,7 @@ struct HyperkinkRecoTask { registry.fill(HIST("hDaugNewTOFNSigma_WrongCol"), nSigmaTOF); } } - if (std::abs(nSigmaTOF) > cutTOFNSigmaDaug) { + if ((daugTrack.hasTOF() || askTOFForDaug) && std::abs(nSigmaTOF) > cutTOFNSigmaDaug) { continue; } registry.fill(HIST("hCandidateCounter"), 3); From 6cc9fccd4caf02a203816901463a360a22ea44a6 Mon Sep 17 00:00:00 2001 From: Chiara De Martin <39315597+ChiaraDeMartin95@users.noreply.github.com> Date: Mon, 11 Aug 2025 08:05:47 +0200 Subject: [PATCH 004/986] [PWGLF] Add new table to store lambda variables for longitudinal polarization (#12486) Co-authored-by: Chiara De Martin Co-authored-by: ALICE Action Bot --- PWGLF/DataModel/cascqaanalysis.h | 12 +++++++- .../TableProducer/Strangeness/cascadeflow.cxx | 30 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/PWGLF/DataModel/cascqaanalysis.h b/PWGLF/DataModel/cascqaanalysis.h index efe98908517..be74e5241bd 100644 --- a/PWGLF/DataModel/cascqaanalysis.h +++ b/PWGLF/DataModel/cascqaanalysis.h @@ -138,7 +138,14 @@ DECLARE_SOA_COLUMN(BDTResponseOmega, bdtResponseOmega, float); DECLARE_SOA_COLUMN(CosThetaStarLambdaFromOmega, cosThetaStarLambdaFromOmega, float); DECLARE_SOA_COLUMN(CosThetaStarLambdaFromXi, cosThetaStarLambdaFromXi, float); DECLARE_SOA_COLUMN(CosThetaStarProton, cosThetaStarProton, float); - +DECLARE_SOA_COLUMN(V0Radius, v0Radius, float); +DECLARE_SOA_COLUMN(DcaPosToPV, dcaPosToPV, float); +DECLARE_SOA_COLUMN(DcaNegToPV, dcaNegToPV, float); +DECLARE_SOA_COLUMN(V0CosPA, v0CosPA, double); +DECLARE_SOA_COLUMN(DcaV0Daughters, dcaV0Daughters, float); +DECLARE_SOA_COLUMN(Pzs2Lambda, pzs2Lambda, double); +DECLARE_SOA_COLUMN(Cos2ThetaLambda, cos2ThetaLambda, double); +DECLARE_SOA_COLUMN(CosThetaLambda, cosThetaLambda, double); } // namespace cascadesflow DECLARE_SOA_TABLE(MyCascades, "AOD", "MYCASCADES", o2::soa::Index<>, @@ -173,6 +180,9 @@ DECLARE_SOA_TABLE(CascTraining, "AOD", "CascTraining", o2::soa::Index<>, DECLARE_SOA_TABLE(CascAnalysis, "AOD", "CascAnalysis", o2::soa::Index<>, cascadesflow::CentFT0C, cascadesflow::IsNoCollInTimeRange, cascadesflow::IsNoCollInRof, cascadesflow::HasEventPlane, cascadesflow::HasSpectatorPlane, cascadesflow::Sign, cascadesflow::Pt, cascadesflow::Eta, cascadesflow::Phi, cascadesflow::MassLambda, cascadesflow::MassXi, cascadesflow::MassOmega, cascadesflow::V2CSP, cascadesflow::V2CEP, cascadesflow::V1SPzdcA, cascadesflow::V1SPzdcC, cascadesflow::PsiT0C, cascadesflow::BDTResponseXi, cascadesflow::BDTResponseOmega, cascadesflow::CosThetaStarLambdaFromOmega, cascadesflow::CosThetaStarLambdaFromXi, cascadesflow::CosThetaStarProton, mycascades::McPdgCode); +DECLARE_SOA_TABLE(LambdaAnalysis, "AOD", "LambdaAnalysis", o2::soa::Index<>, + cascadesflow::CentFT0C, cascadesflow::HasEventPlane, cascadesflow::HasSpectatorPlane, cascadesflow::Sign, cascadesflow::Pt, cascadesflow::Phi, cascadesflow::MassLambda, cascadesflow::V0Radius, cascadesflow::DcaPosToPV, cascadesflow::DcaNegToPV, cascadesflow::V0CosPA, cascadesflow::DcaV0Daughters, cascadesflow::V2CEP, cascadesflow::PsiT0C, cascadesflow::Pzs2Lambda, cascadesflow::Cos2ThetaLambda, cascadesflow::CosThetaLambda); + namespace myMCcascades { diff --git a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx index 0b930932754..c83984f3a7c 100644 --- a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx @@ -475,6 +475,7 @@ struct cascadeFlow { // Tables to produce Produces trainingSample; Produces analysisSample; + Produces analysisLambdaSample; Configurable> parSigmaMass{ "parSigmaMass", {cascadev2::massSigmaParameters[0], nParameters, nParticles, @@ -572,6 +573,29 @@ struct cascadeFlow { cosThetaStarProton, pdgCode); } + + template + void fillAnalysedLambdaTable(collision_t coll, bool hasEventPlane, bool hasSpectatorPlane, int chargeIndex, v0_t v0, float v2CEP, float psiT0C, double pzs2Lambda, double cos2ThetaLambda, double cosThetaLambda) + { + analysisLambdaSample(coll.centFT0C(), + hasEventPlane, + hasSpectatorPlane, + chargeIndex, + v0.pt(), + v0.phi(), + v0.mLambda(), + v0.v0radius(), + v0.dcapostopv(), + v0.dcanegtopv(), + v0.v0cosPA(), + v0.dcaV0daughters(), + v2CEP, + psiT0C, + pzs2Lambda, + cos2ThetaLambda, + cosThetaLambda); + } + void initAcceptanceFromCCDB() { LOG(info) << "Loading acceptance from CCDB "; @@ -1483,6 +1507,9 @@ struct cascadeFlow { } } + bool hasSpectatorPlane = 0; + bool hasEventPlane = 1; + histos.fill(HIST("hNEvents"), 9.5); histos.fill(HIST("hEventNchCorrelationAfterEP"), coll.multNTracksPVeta1(), coll.multNTracksGlobal()); histos.fill(HIST("hEventPVcontributorsVsCentralityAfterEP"), coll.centFT0C(), coll.multNTracksPVeta1()); @@ -1631,6 +1658,9 @@ struct cascadeFlow { if (fillingConfigs.isFillTHN_Acc) histos.get(HIST("hLambdaCos2ThetaVsPsi"))->Fill(coll.centFT0C(), chargeIndex, v0.eta(), v0.pt(), v0.mLambda(), cos2ThetaLambda, 2 * lambdaminuspsiT0C); } + + if (fillingConfigs.isFillTree) + fillAnalysedLambdaTable(coll, hasEventPlane, hasSpectatorPlane, chargeIndex, v0, v2CEP, psiT0C, pzs2Lambda, cos2ThetaLambda, cosThetaLambda); } } From e85ffea397d3708fa7bb9578990888d818defd7a Mon Sep 17 00:00:00 2001 From: abmodak <67369858+abmodak@users.noreply.github.com> Date: Mon, 11 Aug 2025 10:30:11 +0200 Subject: [PATCH 005/986] [PWGLF] Add configurable for split MC reco collisions (#12523) --- PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx b/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx index b91db8d09e0..3d0e34adb1c 100644 --- a/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx @@ -164,6 +164,7 @@ struct HeavyionMultiplicity { Configurable isApplyCentFT0M{"isApplyCentFT0M", false, "Centrality based on FT0A + FT0C"}; Configurable isApplyCentNGlobal{"isApplyCentNGlobal", false, "Centrality based on global tracks"}; Configurable isApplyCentMFT{"isApplyCentMFT", false, "Centrality based on MFT tracks"}; + Configurable isApplySplitRecCol{"isApplySplitRecCol", false, "Split MC reco collisions"}; void init(InitContext const&) { @@ -434,6 +435,11 @@ struct HeavyionMultiplicity { void processMonteCarlo(CollisionMCTrueTable::iterator const&, CollisionMCRecTable const& RecCols, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks) { + + if (isApplySplitRecCol && (RecCols.size() == 0 || RecCols.size() > 1)) { + return; + } + for (const auto& RecCol : RecCols) { if (!isEventSelected(RecCol)) { continue; From 2862a493dca2619436d888180a3aa355a394d4e4 Mon Sep 17 00:00:00 2001 From: Joachim Carlo Kristian Bjerg Hansen <50103987+joachimckh@users.noreply.github.com> Date: Mon, 11 Aug 2025 11:44:42 +0200 Subject: [PATCH 006/986] [PWGCF] ESE flow task for GFW (#12440) --- PWGCF/Flow/Tasks/CMakeLists.txt | 5 + PWGCF/Flow/Tasks/flowGfwEse.cxx | 1200 +++++++++++++++++++++++++++++++ 2 files changed, 1205 insertions(+) create mode 100644 PWGCF/Flow/Tasks/flowGfwEse.cxx diff --git a/PWGCF/Flow/Tasks/CMakeLists.txt b/PWGCF/Flow/Tasks/CMakeLists.txt index e368eef4c73..532351a316b 100644 --- a/PWGCF/Flow/Tasks/CMakeLists.txt +++ b/PWGCF/Flow/Tasks/CMakeLists.txt @@ -88,3 +88,8 @@ o2physics_add_dpl_workflow(flow-ese-task SOURCES flowEseTask.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::GFWCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(flow-gfw-ese + SOURCES flowGfwEse.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::GFWCore + COMPONENT_NAME Analysis) diff --git a/PWGCF/Flow/Tasks/flowGfwEse.cxx b/PWGCF/Flow/Tasks/flowGfwEse.cxx new file mode 100644 index 00000000000..fc4e06240f1 --- /dev/null +++ b/PWGCF/Flow/Tasks/flowGfwEse.cxx @@ -0,0 +1,1200 @@ +// 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 flowGfwEse.cxx +/// \brief Dedicated GFW task to analyse angular correlations using ESE primarily in light ions +/// \author Emil Gorm Nielsen, NBI, emil.gorm.nielsen@cern.ch, Joachim C. K. B. Hansen, Lund University, joachim.hansen@cern.ch + +#include "FlowContainer.h" +#include "FlowPtContainer.h" +#include "GFW.h" +#include "GFWConfig.h" +#include "GFWCumulant.h" +#include "GFWPowerArray.h" +#include "GFWWeights.h" +#include "GFWWeightsList.h" + +#include "Common/Core/TrackSelection.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EseTable.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/Qvectors.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; + +#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; + +namespace o2::analysis::gfwflowese +{ +std::vector ptbinning = {0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.2, 2.4, 2.6, 2.8, 3, 3.5, 4, 5, 6, 8, 10}; +float ptpoilow = 0.2, ptpoiup = 10.0; +float ptreflow = 0.2, ptrefup = 3.0; +float ptlow = 0.2, ptup = 10.0; +int etabins = 16; +float etalow = -0.8, etaup = 0.8; +int vtxZbins = 40; +float vtxZlow = -10.0, vtxZup = 10.0; +int phibins = 72; +float philow = 0.0; +float phiup = o2::constants::math::TwoPI; +int nchbins = 300; +float nchlow = 0; +float nchup = 3000; +std::vector centbinning(90); +int nBootstrap = 10; +GFWRegions regions; +GFWCorrConfigs configs; +std::vector multGlobalCorrCutPars; +std::vector multPVCorrCutPars; +std::vector multGlobalPVCorrCutPars; +std::vector multGlobalV0ACutPars; +std::vector multGlobalT0ACutPars; +std::vector firstRunsOfFill; +} // namespace o2::analysis::gfwflowese + +struct FlowGfwEse { + + O2_DEFINE_CONFIGURABLE(cfgNbootstrap, int, 10, "Number of subsamples") + O2_DEFINE_CONFIGURABLE(cfgMpar, int, 4, "Highest order of pt-pt correlations") + O2_DEFINE_CONFIGURABLE(cfgCentEstimator, int, 0, "0:FT0C; 1:FT0CVariant1; 2:FT0M; 3:FV0A, 4:NTPV, 5:NGlobals, 6:MFT") + O2_DEFINE_CONFIGURABLE(cfgUseNch, bool, false, "Do correlations as function of Nch") + O2_DEFINE_CONFIGURABLE(cfgFillWeights, bool, false, "Fill NUA weights") + O2_DEFINE_CONFIGURABLE(cfgRunByRun, bool, false, "Fill histograms on a run-by-run basis") + O2_DEFINE_CONFIGURABLE(cfgFillFlowRunByRun, bool, false, "Fill flow profile run-by-run (only for v22)") + O2_DEFINE_CONFIGURABLE(cfgTimeDependent, bool, false, "Fill output as function of time (for contamination studies)") + O2_DEFINE_CONFIGURABLE(cfgFirstRunsOfFill, std::vector, {}, "First runs of a fill for time dependent analysis") + O2_DEFINE_CONFIGURABLE(cfgFillQA, bool, false, "Fill QA histograms") + O2_DEFINE_CONFIGURABLE(cfgUseAdditionalEventCut, bool, false, "Use additional event cut on mult correlations") + O2_DEFINE_CONFIGURABLE(cfgUseCentralMoments, bool, true, "Use central moments in vn-pt calculations") + O2_DEFINE_CONFIGURABLE(cfgEfficiency, std::string, "", "CCDB path to efficiency object") + O2_DEFINE_CONFIGURABLE(cfgAcceptance, std::string, "", "CCDB path to acceptance object") + O2_DEFINE_CONFIGURABLE(cfgDCAxyNSigma, float, 7, "Cut on number of sigma deviations from expected DCA in the transverse direction"); + O2_DEFINE_CONFIGURABLE(cfgDCAxy, std::string, "(0.0026+0.005/(x^1.01))", "Functional form of pt-dependent DCAxy cut"); + O2_DEFINE_CONFIGURABLE(cfgDCAz, float, 2, "Cut on DCA in the longitudinal direction (cm)"); + O2_DEFINE_CONFIGURABLE(cfgNTPCCls, float, 50, "Cut on number of TPC clusters found"); + O2_DEFINE_CONFIGURABLE(cfgNTPCXrows, float, 70, "Cut on number of TPC crossed rows"); + O2_DEFINE_CONFIGURABLE(cfgMinNITSCls, float, 5, "Cut on minimum number of ITS clusters found"); + O2_DEFINE_CONFIGURABLE(cfgChi2PrITSCls, float, 36, "Cut on chi^2 per ITS clusters found"); + O2_DEFINE_CONFIGURABLE(cfgChi2PrTPCCls, float, 2.5, "Cut on chi^2 per TPC clusters found"); + O2_DEFINE_CONFIGURABLE(cfgPtmin, float, 0.2, "minimum pt (GeV/c)"); + O2_DEFINE_CONFIGURABLE(cfgPtmax, float, 10, "maximum pt (GeV/c)"); + O2_DEFINE_CONFIGURABLE(cfgEta, float, 0.8, "eta cut"); + O2_DEFINE_CONFIGURABLE(cfgEtaPtPt, float, 0.4, "eta cut for pt-pt correlations"); + O2_DEFINE_CONFIGURABLE(cfgVtxZ, float, 10, "vertex cut (cm)"); + O2_DEFINE_CONFIGURABLE(cfgOccupancySelection, int, 2000, "Max occupancy selection, -999 to disable"); + O2_DEFINE_CONFIGURABLE(cfgNoSameBunchPileupCut, bool, true, "kNoSameBunchPileupCut"); + O2_DEFINE_CONFIGURABLE(cfgIsGoodZvtxFT0vsPV, bool, true, "kIsGoodZvtxFT0vsPV"); + O2_DEFINE_CONFIGURABLE(cfgIsGoodITSLayersAll, bool, true, "kIsGoodITSLayersAll"); + O2_DEFINE_CONFIGURABLE(cfgNoCollInTimeRangeStandard, bool, true, "kNoCollInTimeRangeStandard"); + O2_DEFINE_CONFIGURABLE(cfgDoOccupancySel, bool, true, "Bool for event selection on detector occupancy"); + O2_DEFINE_CONFIGURABLE(cfgMultCut, bool, true, "Use additional event cut on mult correlations"); + O2_DEFINE_CONFIGURABLE(cfgTVXinTRD, bool, true, "Use kTVXinTRD (reject TRD triggered events)"); + O2_DEFINE_CONFIGURABLE(cfgIsVertexITSTPC, bool, true, "Selects collisions with at least one ITS-TPC track"); + O2_DEFINE_CONFIGURABLE(cfgMagField, float, 99999, "Configurable magnetic field; default CCDB will be queried"); + O2_DEFINE_CONFIGURABLE(cfgFixedMultMin, int, 1, "Minimum for fixed nch range"); + O2_DEFINE_CONFIGURABLE(cfgFixedMultMax, int, 3000, "Maximum for fixed nch range"); + O2_DEFINE_CONFIGURABLE(cfgUseMultiplicityFlowWeights, bool, true, "Enable or disable the use of multiplicity-based event weighting"); + O2_DEFINE_CONFIGURABLE(cfgConsistentEventFlag, int, 0, "Flag to select consistent events - 0: off, 1: v2{2} gap calculable, 2: v2{4} full calculable, 4: v2{4} gap calculable, 8: v2{4} 3sub calculable"); + O2_DEFINE_CONFIGURABLE(cfgUseDensityDependentCorrection, bool, false, "Use density dependent efficiency correction based on Run 2 measurements"); + Configurable> cfgTrackDensityP0{"cfgTrackDensityP0", std::vector{0.7217476707, 0.7384792571, 0.7542625668, 0.7640680200, 0.7701951667, 0.7755299053, 0.7805901710, 0.7849446786, 0.7957356586, 0.8113039262, 0.8211968966, 0.8280558878, 0.8329342135}, "parameter 0 for track density efficiency correction"}; + Configurable> cfgTrackDensityP1{"cfgTrackDensityP1", std::vector{-2.169488e-05, -2.191913e-05, -2.295484e-05, -2.556538e-05, -2.754463e-05, -2.816832e-05, -2.846502e-05, -2.843857e-05, -2.705974e-05, -2.477018e-05, -2.321730e-05, -2.203315e-05, -2.109474e-05}, "parameter 1 for track density efficiency correction"}; + Configurable> cfgMultGlobalCutPars{"cfgMultGlobalCutPars", std::vector{2272.16, -76.6932, 1.01204, -0.00631545, 1.59868e-05, 136.336, -4.97006, 0.121199, -0.0015921, 7.66197e-06}, "Global vs FT0C multiplicity cut parameter values"}; + Configurable> cfgMultPVCutPars{"cfgMultPVCutPars", std::vector{3074.43, -106.192, 1.46176, -0.00968364, 2.61923e-05, 182.128, -7.43492, 0.193901, -0.00256715, 1.22594e-05}, "PV vs FT0C multiplicity cut parameter values"}; + Configurable> cfgMultGlobalPVCutPars{"cfgMultGlobalPVCutPars", std::vector{-0.223013, 0.715849, 0.664242, 0.0829653, -0.000503733, 1.21185e-06}, "Global vs PV multiplicity cut parameter values"}; + O2_DEFINE_CONFIGURABLE(cfgMultCorrHighCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x + 3.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultCorrLowCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x - 3.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultGlobalPVCorrCutFunction, std::string, "[0] + [1]*x + 3*([2] + [3]*x + [4]*x*x + [5]*x*x*x)", "Functional for global vs pv multiplicity correlation cut"); + struct : ConfigurableGroup { + O2_DEFINE_CONFIGURABLE(cfgMultGlobalASideCorrCutFunction, std::string, "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + [10]*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", "Functional for global vs V0A multiplicity low correlation cut"); + Configurable> cfgMultGlobalV0ACutPars{"cfgMultGlobalV0ACutPars", std::vector{567.785, 172.715, 0.77888, -0.00693466, 1.40564e-05, 679.853, 66.8068, -0.444332, 0.00115002, -4.92064e-07}, "Global vs FV0A multiplicity cut parameter values"}; + Configurable> cfgMultGlobalT0ACutPars{"cfgMultGlobalT0ACutPars", std::vector{241.618, 61.8402, 0.348049, -0.00306078, 6.20357e-06, 315.235, 29.1491, -0.188639, 0.00044528, -9.08912e-08}, "Global vs FT0A multiplicity cut parameter values"}; + O2_DEFINE_CONFIGURABLE(cfgGlobalV0ALowSigma, float, -3, "Number of sigma deviations below expected value in global vs V0A correlation"); + O2_DEFINE_CONFIGURABLE(cfgGlobalV0AHighSigma, float, 4, "Number of sigma deviations above expected value in global vs V0A correlation"); + O2_DEFINE_CONFIGURABLE(cfgGlobalT0ALowSigma, float, -3., "Number of sigma deviations below expected value in global vs T0A correlation"); + O2_DEFINE_CONFIGURABLE(cfgGlobalT0AHighSigma, float, 4, "Number of sigma deviations above expected value in global vs T0A correlation"); + } cfgGlobalAsideCorrCuts; + Configurable cfgGFWBinning{"cfgGFWBinning", {40, 16, 72, 300, 0, 3000, 0.2, 10.0, 0.2, 3.0, {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3, 3.25, 3.5, 3.75, 4, 4.5, 5, 5.5, 6, 7, 8, 9, 10}, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90}}, "Configuration for binning"}; + Configurable cfgRegions{"cfgRegions", {{"refN", "refP", "refFull"}, {-0.8, 0.4, -0.8}, {-0.4, 0.8, 0.8}, {0, 0, 0}, {1, 1, 1}}, "Configurations for GFW regions"}; + Configurable cfgCorrConfig{"cfgCorrConfig", {{"refP {2} refN {-2}", "refP {3} refN {-3}", "refP {4} refN {-4}", "refFull {2 -2}", "refFull {2 2 -2 -2}"}, {"ChGap22", "ChGap32", "ChGap42", "ChFull22", "ChFull24"}, {1, 0, 0, 0, 0}, {15, 1, 1, 0, 0}}, "Configurations for each correlation to calculate"}; + // Configurable cfgESEbinning{"cfgESEbinning", 100, "Number of ESE bins"}; + + // Connect to ccdb + Service ccdb; + + struct Config { + TH1D* mEfficiency = nullptr; + GFWWeights* mAcceptance; + bool correctionsLoaded = false; + } cfg; + + // Define output + OutputObj fFC{FlowContainer("FlowContainer")}; + OutputObj fFCpt{FlowPtContainer("FlowPtContainer")}; + OutputObj fFCgen{FlowContainer("FlowContainer_gen")}; + OutputObj fFCptgen{FlowPtContainer("FlowPtContainer_gen")}; + HistogramRegistry registry{"registry"}; + + // QA outputs + std::map>> th1sList; + std::map>> tpfsList; + std::map>> th3sList; + enum OutputTH1Names { + hPhi = 0, + hEta, + hVtxZ, + hMult, + hCent, + hEventSel, + kCount_TH1Names + }; + enum OutputTProfileNames { + pfCorr22 = 0, + kCount_TProfileNames + }; + // NUA outputs + enum OutputTH3Names { + hNUAref = 0, + kCount_TH3Names + }; + enum CentEstimators { + kCentFT0C = 0, + kCentFT0CVariant1, + kCentFT0M, + kCentFV0A, + kCentNTPV, + kCentNGlobal, + kCentMFT + }; + enum EventSelFlags { + kFilteredEvent = 1, + kSel8, + kOccupancy, + kTVXTRD, + kNoSamebunchPU, + kZVtxFT0PV, + kNoCollTRStd, + kVtxITSTPC, + kGoodITSLayers, + kMultCuts, + kTrackCent + }; + + // Define global variables + // Generic Framework + GFW* fGFW = new GFW(); + std::vector corrconfigs; + + TRandom3* fRndm = new TRandom3(0); + TAxis* fSecondAxis; + int lastRun = -1; + std::vector::iterator firstRunOfCurrentFill; + std::vector runNumbers; + + // Density dependent eff correction + std::vector funcEff; + TH1D* hFindPtBin; + TF1* funcV2; + TF1* funcV3; + TF1* funcV4; + struct DensityCorr { + double psi2Est; + double psi3Est; + double psi4Est; + double v2; + double v3; + double v4; + int density; + DensityCorr() : psi2Est(0.), psi3Est(0.), psi4Est(0.), v2(0.), v3(0.), v4(0.), density(0) {} + }; + static constexpr int EseBins = 100; + + // region indices for consistency flag + int posRegionIndex = -1; + int negRegionIndex = -1; + int fullRegionIndex = -1; + int midRegionIndex = -1; + + // Event selection cuts - Alex + TF1* fMultPVCutLow = nullptr; + TF1* fMultPVCutHigh = nullptr; + TF1* fMultCutLow = nullptr; + TF1* fMultCutHigh = nullptr; + TF1* fMultPVGlobalCutHigh = nullptr; + TF1* fMultGlobalV0ACutLow = nullptr; + TF1* fMultGlobalV0ACutHigh = nullptr; + TF1* fMultGlobalT0ACutLow = nullptr; + TF1* fMultGlobalT0ACutHigh = nullptr; + + TF1* fPtDepDCAxy = nullptr; + + o2::framework::expressions::Filter collisionFilter = nabs(aod::collision::posZ) < cfgVtxZ; + o2::framework::expressions::Filter trackFilter = nabs(aod::track::eta) < cfgEta && aod::track::pt > cfgPtmin&& aod::track::pt < cfgPtmax && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == static_cast(true))) && (aod::track::itsChi2NCl < cfgChi2PrITSCls) && (aod::track::tpcChi2NCl < cfgChi2PrTPCCls) && nabs(aod::track::dcaZ) < cfgDCAz; + + Preslice perCollision = aod::track::collisionId; + o2::framework::expressions::Filter mcCollFilter = nabs(aod::mccollision::posZ) < cfgVtxZ; + o2::framework::expressions::Filter mcParticlesFilter = (aod::mcparticle::eta > o2::analysis::gfwflowese::etalow && aod::mcparticle::eta < o2::analysis::gfwflowese::etaup && aod::mcparticle::pt > o2::analysis::gfwflowese::ptlow && aod::mcparticle::pt < o2::analysis::gfwflowese::ptup); + + using GFWTracks = soa::Filtered>; + + void init(InitContext const&) + { + LOGF(info, "FlowGfwEse::init()"); + o2::analysis::gfwflowese::regions.SetNames(cfgRegions->GetNames()); + o2::analysis::gfwflowese::regions.SetEtaMin(cfgRegions->GetEtaMin()); + o2::analysis::gfwflowese::regions.SetEtaMax(cfgRegions->GetEtaMax()); + o2::analysis::gfwflowese::regions.SetpTDifs(cfgRegions->GetpTDifs()); + o2::analysis::gfwflowese::regions.SetBitmasks(cfgRegions->GetBitmasks()); + o2::analysis::gfwflowese::configs.SetCorrs(cfgCorrConfig->GetCorrs()); + o2::analysis::gfwflowese::configs.SetHeads(cfgCorrConfig->GetHeads()); + o2::analysis::gfwflowese::configs.SetpTDifs(cfgCorrConfig->GetpTDifs()); + o2::analysis::gfwflowese::configs.SetpTCorrMasks(cfgCorrConfig->GetpTCorrMasks()); + o2::analysis::gfwflowese::regions.Print(); + o2::analysis::gfwflowese::configs.Print(); + o2::analysis::gfwflowese::ptbinning = cfgGFWBinning->GetPtBinning(); + o2::analysis::gfwflowese::ptpoilow = cfgGFWBinning->GetPtPOImin(); + o2::analysis::gfwflowese::ptpoiup = cfgGFWBinning->GetPtPOImax(); + o2::analysis::gfwflowese::ptreflow = cfgGFWBinning->GetPtRefMin(); + o2::analysis::gfwflowese::ptrefup = cfgGFWBinning->GetPtRefMax(); + o2::analysis::gfwflowese::ptlow = cfgPtmin; + o2::analysis::gfwflowese::ptup = cfgPtmax; + o2::analysis::gfwflowese::etabins = cfgGFWBinning->GetEtaBins(); + o2::analysis::gfwflowese::vtxZbins = cfgGFWBinning->GetVtxZbins(); + o2::analysis::gfwflowese::phibins = cfgGFWBinning->GetPhiBins(); + o2::analysis::gfwflowese::philow = 0.0f; + o2::analysis::gfwflowese::phiup = o2::constants::math::TwoPI; + o2::analysis::gfwflowese::nchbins = cfgGFWBinning->GetNchBins(); + o2::analysis::gfwflowese::nchlow = cfgGFWBinning->GetNchMin(); + o2::analysis::gfwflowese::nchup = cfgGFWBinning->GetNchMax(); + o2::analysis::gfwflowese::centbinning = cfgGFWBinning->GetCentBinning(); + cfgGFWBinning->Print(); + o2::analysis::gfwflowese::multGlobalCorrCutPars = cfgMultGlobalCutPars; + o2::analysis::gfwflowese::multPVCorrCutPars = cfgMultPVCutPars; + o2::analysis::gfwflowese::multGlobalPVCorrCutPars = cfgMultGlobalPVCutPars; + o2::analysis::gfwflowese::multGlobalV0ACutPars = cfgGlobalAsideCorrCuts.cfgMultGlobalV0ACutPars; + o2::analysis::gfwflowese::multGlobalT0ACutPars = cfgGlobalAsideCorrCuts.cfgMultGlobalT0ACutPars; + o2::analysis::gfwflowese::firstRunsOfFill = cfgFirstRunsOfFill; + if (cfgTimeDependent && !std::is_sorted(o2::analysis::gfwflowese::firstRunsOfFill.begin(), o2::analysis::gfwflowese::firstRunsOfFill.end())) { + std::sort(o2::analysis::gfwflowese::firstRunsOfFill.begin(), o2::analysis::gfwflowese::firstRunsOfFill.end()); + } + firstRunOfCurrentFill = o2::analysis::gfwflowese::firstRunsOfFill.begin(); + + AxisSpec phiAxis = {o2::analysis::gfwflowese::phibins, o2::analysis::gfwflowese::philow, o2::analysis::gfwflowese::phiup, "#phi"}; + AxisSpec etaAxis = {o2::analysis::gfwflowese::etabins, -cfgEta, cfgEta, "#eta"}; + AxisSpec vtxAxis = {o2::analysis::gfwflowese::vtxZbins, -cfgVtxZ, cfgVtxZ, "Vtx_{z} (cm)"}; + AxisSpec ptAxis = {o2::analysis::gfwflowese::ptbinning, "#it{p}_{T} GeV/#it{c}"}; + std::string sCentralityEstimator; + std::map centEstimatorMap = { + {kCentFT0C, "FT0C"}, + {kCentFT0CVariant1, "FT0C variant 1"}, + {kCentFT0M, "FT0M"}, + {kCentFV0A, "FV0A"}, + {kCentNTPV, "NTPV"}, + {kCentNGlobal, "NGlobals"}, + {kCentMFT, "MFT"}}; + + sCentralityEstimator = centEstimatorMap.at(cfgCentEstimator); + sCentralityEstimator += " centrality (%)"; + AxisSpec centAxis = {o2::analysis::gfwflowese::centbinning, sCentralityEstimator.c_str()}; + std::vector nchbinning; + int nchskip = (o2::analysis::gfwflowese::nchup - o2::analysis::gfwflowese::nchlow) / o2::analysis::gfwflowese::nchbins; + for (int i = 0; i <= o2::analysis::gfwflowese::nchbins; ++i) { + nchbinning.push_back(nchskip * i + o2::analysis::gfwflowese::nchlow + 0.5); + } + AxisSpec nchAxis = {nchbinning, "N_{ch}"}; + std::vector bbinning(201); + std::generate(bbinning.begin(), bbinning.end(), [n = -0.1, step = 0.1]() mutable { + n += step; + return n; + }); + AxisSpec bAxis = {bbinning, "#it{b}"}; + AxisSpec t0cAxis = {1000, 0, 10000, "N_{ch} (T0C)"}; + AxisSpec t0aAxis = {300, 0, 30000, "N_{ch} (T0A)"}; + AxisSpec v0aAxis = {800, 0, 80000, "N_{ch} (V0A)"}; + AxisSpec multpvAxis = {600, 0, 600, "N_{ch} (PV)"}; + AxisSpec dcaZAXis = {200, -2, 2, "DCA_{z} (cm)"}; + AxisSpec dcaXYAXis = {200, -0.5, 0.5, "DCA_{xy} (cm)"}; + std::vector timebinning(289); + std::generate(timebinning.begin(), timebinning.end(), [n = -24 / 288., step = 24 / 288.]() mutable { + n += step; + return n; + }); + AxisSpec timeAxis = {timebinning, "time (hrs)"}; + + AxisSpec multAxis = (cfgTimeDependent) ? timeAxis : (cfgUseNch) ? nchAxis + : centAxis; + + ccdb->setURL("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + + int64_t now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); + ccdb->setCreatedNotAfter(now); + + int ptbins = o2::analysis::gfwflowese::ptbinning.size() - 1; + fSecondAxis = (cfgTimeDependent) ? new TAxis(timeAxis.binEdges.size() - 1, &(timeAxis.binEdges[0])) : new TAxis(ptbins, &o2::analysis::gfwflowese::ptbinning[0]); + + if (doprocessData) { + registry.add("trackQA/before/phi_eta_vtxZ", "", {HistType::kTH3D, {phiAxis, etaAxis, vtxAxis}}); + registry.add("trackQA/before/pt_dcaXY_dcaZ", "", {HistType::kTH3D, {ptAxis, dcaXYAXis, dcaZAXis}}); + registry.add("trackQA/before/nch_pt", "#it{p}_{T} vs multiplicity; N_{ch}; #it{p}_{T}", {HistType::kTH2D, {nchAxis, ptAxis}}); + registry.add("trackQA/before/chi2prTPCcls", "#chi^{2}/cluster for the TPC track segment; #chi^{2}/TPC cluster", {HistType::kTH1D, {{100, 0., 5.}}}); + registry.add("trackQA/before/chi2prITScls", "#chi^{2}/cluster for the ITS track; #chi^{2}/ITS cluster", {HistType::kTH1D, {{100, 0., 50.}}}); + registry.add("trackQA/before/nTPCClusters", "Number of found TPC clusters; TPC N_{cls}; Counts", {HistType::kTH1D, {{100, 40, 180}}}); + registry.add("trackQA/before/nITSClusters", "Number of found ITS clusters; ITS N_{cls}; Counts", {HistType::kTH1D, {{100, 0, 20}}}); + registry.add("trackQA/before/nTPCCrossedRows", "Number of crossed TPC Rows; TPC X-rows; Counts", {HistType::kTH1D, {{100, 40, 180}}}); + + registry.addClone("trackQA/before/", "trackQA/after/"); + registry.add("trackQA/after/pt_ref", "", {HistType::kTH1D, {{100, o2::analysis::gfwflowese::ptreflow, o2::analysis::gfwflowese::ptrefup}}}); + registry.add("trackQA/after/pt_poi", "", {HistType::kTH1D, {{100, o2::analysis::gfwflowese::ptpoilow, o2::analysis::gfwflowese::ptpoiup}}}); + + registry.add("eventQA/before/multiplicity", "", {HistType::kTH1D, {nchAxis}}); + if (cfgTimeDependent) { + registry.add("eventQA/before/multiplicity_time", "Multiplicity vs time; time (hrs); N_{ch}", {HistType::kTH2D, {timeAxis, nchAxis}}); + registry.add("eventQA/before/multT0C_time", "T0C Multiplicity vs time; time (hrs); N_{ch} (T0C)", {HistType::kTH2D, {timeAxis, t0cAxis}}); + registry.add("eventQA/before/multT0A_time", "T0A Multiplicity vs time; time (hrs); N_{ch} (T0A)", {HistType::kTH2D, {timeAxis, t0aAxis}}); + registry.add("eventQA/before/multV0A_time", "V0A Multiplicity vs time; time (hrs); N_{ch} (V0A)", {HistType::kTH2D, {timeAxis, v0aAxis}}); + registry.add("eventQA/before/multPV_time", "PV Multiplicity vs time; time (hrs); N_{ch} (PV)", {HistType::kTH2D, {timeAxis, multpvAxis}}); + } + registry.add("eventQA/before/globalTracks_PVTracks", "", {HistType::kTH2D, {multpvAxis, nchAxis}}); + registry.add("eventQA/before/globalTracks_multT0A", "", {HistType::kTH2D, {t0aAxis, nchAxis}}); + registry.add("eventQA/before/globalTracks_multV0A", "", {HistType::kTH2D, {v0aAxis, nchAxis}}); + registry.add("eventQA/before/multV0A_multT0A", "", {HistType::kTH2D, {t0aAxis, v0aAxis}}); + + if (doprocessData) { + registry.add("eventQA/before/centrality", "", {HistType::kTH1D, {centAxis}}); + registry.add("eventQA/before/globalTracks_centT0C", "", {HistType::kTH2D, {centAxis, nchAxis}}); + registry.add("eventQA/before/PVTracks_centT0C", "", {HistType::kTH2D, {centAxis, multpvAxis}}); + registry.add("eventQA/before/multT0C_centT0C", "", {HistType::kTH2D, {centAxis, t0cAxis}}); + + registry.add("eventQA/before/centT0M_centT0C", "", {HistType::kTH2D, {centAxis, centAxis}}); + registry.add("eventQA/before/centV0A_centT0C", "", {HistType::kTH2D, {centAxis, centAxis}}); + registry.add("eventQA/before/centGlobal_centT0C", "", {HistType::kTH2D, {centAxis, centAxis}}); + registry.add("eventQA/before/centNTPV_centT0C", "", {HistType::kTH2D, {centAxis, centAxis}}); + registry.add("eventQA/before/centMFT_centT0C", "", {HistType::kTH2D, {centAxis, centAxis}}); + } + + registry.addClone("eventQA/before/", "eventQA/after/"); + registry.add("eventQA/eventSel", "Number of Events;; Counts", {HistType::kTH1D, {{11, 0.5, 11.5}}}); + registry.get(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(kFilteredEvent, "Filtered event"); + registry.get(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(kSel8, "sel8"); + registry.get(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(kOccupancy, "occupancy"); + registry.get(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(kTVXTRD, "kTVXinTRD"); + registry.get(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(kNoSamebunchPU, "kNoSameBunchPileup"); + registry.get(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(kZVtxFT0PV, "kIsGoodZvtxFT0vsPV"); + registry.get(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(kNoCollTRStd, "kNoCollInTimeRangeStandard"); + registry.get(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(kVtxITSTPC, "kIsVertexITSTPC"); + registry.get(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(kGoodITSLayers, "kIsGoodITSLayersAll"); + registry.get(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(kMultCuts, "after Mult cuts"); + registry.get(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(kTrackCent, "has track + within cent"); + if (!cfgRunByRun && cfgFillWeights) { + registry.add("phi_eta_vtxz_ref", "", {HistType::kTH3D, {phiAxis, etaAxis, vtxAxis}}); + } + } + + if (o2::analysis::gfwflowese::regions.GetSize() < 0) + LOGF(error, "Configuration contains vectors of different size - check the GFWRegions configurable"); + for (auto i(0); i < o2::analysis::gfwflowese::regions.GetSize(); ++i) { + fGFW->AddRegion(o2::analysis::gfwflowese::regions.GetNames()[i], o2::analysis::gfwflowese::regions.GetEtaMin()[i], o2::analysis::gfwflowese::regions.GetEtaMax()[i], (o2::analysis::gfwflowese::regions.GetpTDifs()[i]) ? ptbins + 1 : 1, o2::analysis::gfwflowese::regions.GetBitmasks()[i]); + } + for (auto i = 0; i < o2::analysis::gfwflowese::configs.GetSize(); ++i) { + corrconfigs.push_back(fGFW->GetCorrelatorConfig(o2::analysis::gfwflowese::configs.GetCorrs()[i], o2::analysis::gfwflowese::configs.GetHeads()[i], o2::analysis::gfwflowese::configs.GetpTDifs()[i])); + } + if (corrconfigs.empty()) + LOGF(error, "Configuration contains vectors of different size - check the GFWCorrConfig configurable"); + fGFW->CreateRegions(); + TObjArray* oba = new TObjArray(); + addConfigObjectsToObjArray(oba, corrconfigs); + if (doprocessData) { + fFC->SetName("FlowContainer"); + fFC->SetXAxis(fSecondAxis); + fFC->Initialize(oba, multAxis, cfgNbootstrap); + } + delete oba; + fFCpt->setUseCentralMoments(cfgUseCentralMoments); + fFCpt->setUseGapMethod(true); + fFCpt->initialise(multAxis, cfgMpar, o2::analysis::gfwflowese::configs, cfgNbootstrap); + fFCptgen->setUseCentralMoments(cfgUseCentralMoments); + fFCptgen->setUseGapMethod(true); + fFCptgen->initialise(multAxis, cfgMpar, o2::analysis::gfwflowese::configs, cfgNbootstrap); + + fPtDepDCAxy = new TF1("ptDepDCAxy", Form("[0]*%s", cfgDCAxy->c_str()), 0.001, 100); + fPtDepDCAxy->SetParameter(0, cfgDCAxyNSigma); + LOGF(info, "DCAxy pt-dependence function: %s", Form("[0]*%s", cfgDCAxy->c_str())); + if (cfgUseAdditionalEventCut) { + fMultPVCutLow = new TF1("fMultPVCutLow", cfgMultCorrLowCutFunction->c_str(), 0, 100); + fMultPVCutLow->SetParameters(&(o2::analysis::gfwflowese::multPVCorrCutPars[0])); + fMultPVCutHigh = new TF1("fMultPVCutHigh", cfgMultCorrHighCutFunction->c_str(), 0, 100); + fMultPVCutHigh->SetParameters(&(o2::analysis::gfwflowese::multPVCorrCutPars[0])); + fMultCutLow = new TF1("fMultCutLow", cfgMultCorrLowCutFunction->c_str(), 0, 100); + fMultCutLow->SetParameters(&(o2::analysis::gfwflowese::multGlobalCorrCutPars[0])); + fMultCutHigh = new TF1("fMultCutHigh", cfgMultCorrHighCutFunction->c_str(), 0, 100); + fMultCutHigh->SetParameters(&(o2::analysis::gfwflowese::multGlobalCorrCutPars[0])); + fMultPVGlobalCutHigh = new TF1("fMultPVGlobalCutHigh", cfgMultGlobalPVCorrCutFunction->c_str(), 0, nchbinning.back()); + fMultPVGlobalCutHigh->SetParameters(&(o2::analysis::gfwflowese::multGlobalPVCorrCutPars[0])); + + LOGF(info, "Global V0A function: %s in range 0-%g", cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->c_str(), v0aAxis.binEdges.back()); + fMultGlobalV0ACutLow = new TF1("fMultGlobalV0ACutLow", cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->c_str(), 0, v0aAxis.binEdges.back()); + for (std::size_t i = 0; i < o2::analysis::gfwflowese::multGlobalV0ACutPars.size(); ++i) + fMultGlobalV0ACutLow->SetParameter(i, o2::analysis::gfwflowese::multGlobalV0ACutPars[i]); + fMultGlobalV0ACutLow->SetParameter(o2::analysis::gfwflowese::multGlobalV0ACutPars.size(), cfgGlobalAsideCorrCuts.cfgGlobalV0ALowSigma); + for (int i = 0; i < fMultGlobalV0ACutLow->GetNpar(); ++i) + LOGF(info, "fMultGlobalV0ACutLow par %d = %g", i, fMultGlobalV0ACutLow->GetParameter(i)); + + fMultGlobalV0ACutHigh = new TF1("fMultGlobalV0ACutHigh", cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->c_str(), 0, v0aAxis.binEdges.back()); + for (std::size_t i = 0; i < o2::analysis::gfwflowese::multGlobalV0ACutPars.size(); ++i) + fMultGlobalV0ACutHigh->SetParameter(i, o2::analysis::gfwflowese::multGlobalV0ACutPars[i]); + fMultGlobalV0ACutHigh->SetParameter(o2::analysis::gfwflowese::multGlobalV0ACutPars.size(), cfgGlobalAsideCorrCuts.cfgGlobalV0AHighSigma); + for (int i = 0; i < fMultGlobalV0ACutHigh->GetNpar(); ++i) + LOGF(info, "fMultGlobalV0ACutHigh par %d = %g", i, fMultGlobalV0ACutHigh->GetParameter(i)); + + LOGF(info, "Global T0A function: %s", cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->c_str()); + fMultGlobalT0ACutLow = new TF1("fMultGlobalT0ACutLow", cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->c_str(), 0, t0aAxis.binEdges.back()); + for (std::size_t i = 0; i < o2::analysis::gfwflowese::multGlobalT0ACutPars.size(); ++i) + fMultGlobalT0ACutLow->SetParameter(i, o2::analysis::gfwflowese::multGlobalT0ACutPars[i]); + fMultGlobalT0ACutLow->SetParameter(o2::analysis::gfwflowese::multGlobalT0ACutPars.size(), cfgGlobalAsideCorrCuts.cfgGlobalT0ALowSigma); + for (int i = 0; i < fMultGlobalT0ACutLow->GetNpar(); ++i) + LOGF(info, "fMultGlobalT0ACutLow par %d = %g", i, fMultGlobalT0ACutLow->GetParameter(i)); + + fMultGlobalT0ACutHigh = new TF1("fMultGlobalT0ACutHigh", cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->c_str(), 0, t0aAxis.binEdges.back()); + for (std::size_t i = 0; i < o2::analysis::gfwflowese::multGlobalT0ACutPars.size(); ++i) + fMultGlobalT0ACutHigh->SetParameter(i, o2::analysis::gfwflowese::multGlobalT0ACutPars[i]); + fMultGlobalT0ACutHigh->SetParameter(o2::analysis::gfwflowese::multGlobalT0ACutPars.size(), cfgGlobalAsideCorrCuts.cfgGlobalT0AHighSigma); + for (int i = 0; i < fMultGlobalT0ACutHigh->GetNpar(); ++i) + LOGF(info, "fMultGlobalT0ACutHigh par %d = %g", i, fMultGlobalT0ACutHigh->GetParameter(i)); + } + if (cfgUseDensityDependentCorrection) { + std::vector pTEffBins = {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.4, 1.8, 2.2, 2.6, 3.0}; + hFindPtBin = new TH1D("hFindPtBin", "hFindPtBin", pTEffBins.size() - 1, &pTEffBins[0]); + funcEff.resize(pTEffBins.size() - 1); + // LHC24g3 Eff + std::vector f1p0 = cfgTrackDensityP0; + std::vector f1p1 = cfgTrackDensityP1; + for (uint ifunc = 0; ifunc < pTEffBins.size() - 1; ifunc++) { + funcEff[ifunc] = new TF1(Form("funcEff%i", ifunc), "[0]+[1]*x", 0, 3000); + funcEff[ifunc]->SetParameters(f1p0[ifunc], f1p1[ifunc]); + } + funcV2 = new TF1("funcV2", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 100); + funcV2->SetParameters(0.0186111, 0.00351907, -4.38264e-05, 1.35383e-07, -3.96266e-10); + funcV3 = new TF1("funcV3", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 100); + funcV3->SetParameters(0.0174056, 0.000703329, -1.45044e-05, 1.91991e-07, -1.62137e-09); + funcV4 = new TF1("funcV4", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 100); + funcV4->SetParameters(0.008845, 0.000259668, -3.24435e-06, 4.54837e-08, -6.01825e-10); + } + if (cfgConsistentEventFlag) { + auto findRegionIndex = [&](const std::string& name) { + auto begin = cfgRegions->GetNames().begin(); + auto end = cfgRegions->GetNames().end(); + auto it = std::find(begin, end, name); + return (it != end) ? std::distance(begin, it) : -1; + }; + posRegionIndex = findRegionIndex("refP"); + negRegionIndex = findRegionIndex("refN"); + fullRegionIndex = findRegionIndex("refFull"); + midRegionIndex = findRegionIndex("refMid"); + } + } + + static constexpr std::string_view FillTimeName[] = {"before/", "after/"}; + + enum QAFillTime { + kBefore, + kAfter + }; + + void addConfigObjectsToObjArray(TObjArray* oba, const std::vector& configs) + { + for (auto it = configs.begin(); it != configs.end(); ++it) { + for (int jese = 0; jese < EseBins; ++jese) { + if (it->pTDif) { + for (int i = 0; i < fSecondAxis->GetNbins(); ++i) { + std::string name = Form("ese_%d_%s_pt_%d", jese, it->Head.c_str(), i + 1); + std::string title = it->Head + std::string("_ptDiff"); + oba->Add(new TNamed(name.c_str(), title.c_str())); + } + } else { + std::string name = Form("ese_%d_%s", jese, it->Head.c_str()); + std::string title = it->Head + std::string("_ese"); + oba->Add(new TNamed(name.c_str(), title.c_str())); + } + } + } + } + + int getMagneticField(uint64_t timestamp) + { + static o2::parameters::GRPMagField* grpo = nullptr; + if (grpo == nullptr) { + // grpo = ccdb->getForTimeStamp("GLO/GRP/GRP", timestamp); + grpo = ccdb->getForTimeStamp("GLO/Config/GRPMagField", timestamp); + if (grpo == nullptr) { + LOGF(fatal, "GRP object not found for timestamp %llu", timestamp); + return 0; + } + LOGF(info, "Retrieved GRP for timestamp %llu with magnetic field of %d kG", timestamp, grpo->getNominalL3Field()); + } + return grpo->getNominalL3Field(); + } + + void loadCorrections(aod::BCsWithTimestamps::iterator const& bc) + { + uint64_t timestamp = bc.timestamp(); + if (!cfgRunByRun && cfg.correctionsLoaded) + return; + if (!cfgAcceptance.value.empty()) { + std::string runstr = (cfgRunByRun) ? "RunByRun/" : ""; + cfg.mAcceptance = ccdb->getForTimeStamp(cfgAcceptance.value + runstr, timestamp); + } + if (!cfgEfficiency.value.empty()) { + cfg.mEfficiency = ccdb->getForTimeStamp(cfgEfficiency, timestamp); + if (cfg.mEfficiency == nullptr) { + LOGF(fatal, "Could not load efficiency histogram from %s", cfgEfficiency.value.c_str()); + } + LOGF(info, "Loaded efficiency histogram from %s (%p)", cfgEfficiency.value.c_str(), (void*)cfg.mEfficiency); + } + cfg.correctionsLoaded = true; + } + + template + double getAcceptance(TTrack track, const double& vtxz) + { + double wacc = 1; + if (cfg.mAcceptance) + wacc = cfg.mAcceptance->getNUA(track.phi(), track.eta(), vtxz); + return wacc; + } + + template + double getEfficiency(TTrack track) + { + double eff = 1.; + if (cfg.mEfficiency) + eff = cfg.mEfficiency->GetBinContent(cfg.mEfficiency->FindBin(track.pt())); + if (eff == 0) + return -1.; + else + return 1. / eff; + } + + template + bool eventSelected(TCollision collision, const int& multTrk, const float& centrality, const int& run) + { + if (cfgTVXinTRD) { + if (collision.alias_bit(kTVXinTRD)) { + // TRD triggered + // "CMTVX-B-NOPF-TRD,minbias_TVX" + return 0; + } + registry.fill(HIST("eventQA/eventSel"), kTVXTRD); + if (cfgRunByRun) + th1sList[run][hEventSel]->Fill(kTVXTRD); + } + if (cfgNoSameBunchPileupCut) { + if (!collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + // rejects collisions which are associated with the same "found-by-T0" bunch crossing + // https://indico.cern.ch/event/1396220/#1-event-selection-with-its-rof + return 0; + } + registry.fill(HIST("eventQA/eventSel"), kNoSamebunchPU); + if (cfgRunByRun) + th1sList[run][hEventSel]->Fill(kNoSamebunchPU); + } + if (cfgIsGoodZvtxFT0vsPV) { + if (!collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + // removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference + // use this cut at low multiplicities with caution + return 0; + } + registry.fill(HIST("eventQA/eventSel"), kZVtxFT0PV); + if (cfgRunByRun) + th1sList[run][hEventSel]->Fill(kZVtxFT0PV); + } + if (cfgNoCollInTimeRangeStandard) { + if (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + // Rejection of the collisions which have other events nearby + return 0; + } + registry.fill(HIST("eventQA/eventSel"), kNoCollTRStd); + if (cfgRunByRun) + th1sList[run][hEventSel]->Fill(kNoCollTRStd); + } + + if (cfgIsVertexITSTPC) { + if (!collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + // selects collisions with at least one ITS-TPC track, and thus rejects vertices built from ITS-only tracks + return 0; + } + registry.fill(HIST("eventQA/eventSel"), kVtxITSTPC); + if (cfgRunByRun) + th1sList[run][hEventSel]->Fill(kVtxITSTPC); + } + + if (cfgIsGoodITSLayersAll) { + if (!collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + return 0; + } + registry.fill(HIST("eventQA/eventSel"), kGoodITSLayers); + if (cfgRunByRun) + th1sList[run][hEventSel]->Fill(kGoodITSLayers); + } + + float vtxz = -999; + if (collision.numContrib() > 1) { + vtxz = collision.posZ(); + float zRes = std::sqrt(collision.covZZ()); + float minZRes = 0.25; + int minNContrib = 20; + if (zRes > minZRes && collision.numContrib() < minNContrib) + vtxz = -999; + } + auto multNTracksPV = collision.multNTracksPV(); + + if (vtxz > o2::analysis::gfwflowese::vtxZup || vtxz < o2::analysis::gfwflowese::vtxZlow) + return 0; + + if (cfgMultCut) { + if (multNTracksPV < fMultPVCutLow->Eval(centrality)) + return 0; + if (multNTracksPV > fMultPVCutHigh->Eval(centrality)) + return 0; + if (multTrk < fMultCutLow->Eval(centrality)) + return 0; + if (multTrk > fMultCutHigh->Eval(centrality)) + return 0; + if (multTrk > fMultPVGlobalCutHigh->Eval(collision.multNTracksPV())) + return 0; + + if (!(cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->empty()) && static_cast(collision.multFV0A()) < fMultGlobalV0ACutLow->Eval(multTrk)) + return 0; + if (!(cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->empty()) && static_cast(collision.multFV0A()) > fMultGlobalV0ACutHigh->Eval(multTrk)) + return 0; + if (!(cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->empty()) && static_cast(collision.multFT0A()) < fMultGlobalT0ACutLow->Eval(multTrk)) + return 0; + if (!(cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->empty()) && static_cast(collision.multFT0A()) > fMultGlobalT0ACutHigh->Eval(multTrk)) + return 0; + registry.fill(HIST("eventQA/eventSel"), kMultCuts); + if (cfgRunByRun) + th1sList[run][hEventSel]->Fill(kMultCuts); + } + return 1; + } + + template + bool trackSelected(TTrack track) + { + if (cfgDCAxyNSigma && (std::fabs(track.dcaXY()) > fPtDepDCAxy->Eval(track.pt()))) + return false; + return ((track.tpcNClsCrossedRows() >= cfgNTPCXrows) && (track.tpcNClsFound() >= cfgNTPCCls) && (track.itsNCls() >= cfgMinNITSCls)); + } + + enum DataType { + kReco, + kGen + }; + + template + void fillWeights(const TTrack track, const double vtxz, const int& run) + { + if (cfgRunByRun) + th3sList[run][hNUAref]->Fill(track.phi(), track.eta(), vtxz); + else + registry.fill(HIST("phi_eta_vtxz_ref"), track.phi(), track.eta(), vtxz); + return; + } + + void createRunByRunHistograms(const int& run) + { + AxisSpec phiAxis = {o2::analysis::gfwflowese::phibins, o2::analysis::gfwflowese::philow, o2::analysis::gfwflowese::phiup, "#phi"}; + AxisSpec etaAxis = {o2::analysis::gfwflowese::etabins, -cfgEta, cfgEta, "#eta"}; + AxisSpec vtxAxis = {o2::analysis::gfwflowese::vtxZbins, -cfgVtxZ, cfgVtxZ, "Vtx_{z} (cm)"}; + AxisSpec nchAxis = {o2::analysis::gfwflowese::nchbins, o2::analysis::gfwflowese::nchlow, o2::analysis::gfwflowese::nchup, "N_{ch}"}; + AxisSpec centAxis = {o2::analysis::gfwflowese::centbinning, "Centrality (%)"}; + std::vector> histos(kCount_TH1Names); + histos[hPhi] = registry.add(Form("%d/phi", run), "", {HistType::kTH1D, {phiAxis}}); + histos[hEta] = registry.add(Form("%d/eta", run), "", {HistType::kTH1D, {etaAxis}}); + histos[hVtxZ] = registry.add(Form("%d/vtxz", run), "", {HistType::kTH1D, {vtxAxis}}); + histos[hMult] = registry.add(Form("%d/mult", run), "", {HistType::kTH1D, {nchAxis}}); + histos[hCent] = registry.add(Form("%d/cent", run), "", {HistType::kTH1D, {centAxis}}); + if (cfgFillFlowRunByRun) { + std::vector> profiles(kCount_TProfileNames); + profiles[pfCorr22] = registry.add(Form("%d/corr22", run), "", {HistType::kTProfile, {(cfgUseNch) ? nchAxis : centAxis}}); + tpfsList.insert(std::make_pair(run, profiles)); + } + histos[hEventSel] = registry.add(Form("%d/eventSel", run), "Number of Events;; Counts", {HistType::kTH1D, {{11, 0.5, 11.5}}}); + histos[hEventSel]->GetXaxis()->SetBinLabel(kFilteredEvent, "Filtered event"); + histos[hEventSel]->GetXaxis()->SetBinLabel(kSel8, "sel8"); + histos[hEventSel]->GetXaxis()->SetBinLabel(kOccupancy, "occupancy"); + histos[hEventSel]->GetXaxis()->SetBinLabel(kTVXTRD, "kTVXinTRD"); + histos[hEventSel]->GetXaxis()->SetBinLabel(kNoSamebunchPU, "kNoSameBunchPileup"); + histos[hEventSel]->GetXaxis()->SetBinLabel(kZVtxFT0PV, "kIsGoodZvtxFT0vsPV"); + histos[hEventSel]->GetXaxis()->SetBinLabel(kNoCollTRStd, "kNoCollInTimeRangeStandard"); + histos[hEventSel]->GetXaxis()->SetBinLabel(kVtxITSTPC, "kIsVertexITSTPC"); + histos[hEventSel]->GetXaxis()->SetBinLabel(kGoodITSLayers, "kIsGoodITSLayersAll"); + histos[hEventSel]->GetXaxis()->SetBinLabel(kMultCuts, "after Mult cuts"); + histos[hEventSel]->GetXaxis()->SetBinLabel(kTrackCent, "has track + within cent"); + th1sList.insert(std::make_pair(run, histos)); + std::vector> histos3d(kCount_TH3Names); + histos3d[hNUAref] = registry.add(Form("%d/phi_eta_vtxz_ref", run), "", {HistType::kTH3D, {phiAxis, etaAxis, vtxAxis}}); + th3sList.insert(std::make_pair(run, histos3d)); + return; + } + + template + void fillOutputContainers(const float& centmult, const double& rndm, const int& run = 0, const float& qPerc = -1.0f) + { + (dt == kGen) ? fFCptgen->calculateCorrelations() : fFCpt->calculateCorrelations(); + (dt == kGen) ? fFCptgen->fillPtProfiles(centmult, rndm) : fFCpt->fillPtProfiles(centmult, rndm); + (dt == kGen) ? fFCptgen->fillCMProfiles(centmult, rndm) : fFCpt->fillCMProfiles(centmult, rndm); + int qPtmp = static_cast(qPerc); + for (uint l_ind = 0; l_ind < corrconfigs.size(); ++l_ind) { + if (!corrconfigs.at(l_ind).pTDif) { + auto dnx = fGFW->Calculate(corrconfigs.at(l_ind), 0, kTRUE).real(); + if (dnx == 0) + continue; + auto val = fGFW->Calculate(corrconfigs.at(l_ind), 0, kFALSE).real() / dnx; + if (std::abs(val) < 1) { + (dt == kGen) ? fFCgen->FillProfile(corrconfigs.at(l_ind).Head.c_str(), centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm) : fFC->FillProfile(Form("ese_%i_%s", qPtmp, corrconfigs.at(l_ind).Head.c_str()), centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm); + (dt == kGen) ? fFCptgen->fillVnPtProfiles(centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm, o2::analysis::gfwflowese::configs.GetpTCorrMasks()[l_ind]) : fFCpt->fillVnPtProfiles(centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm, o2::analysis::gfwflowese::configs.GetpTCorrMasks()[l_ind]); + if (cfgRunByRun && cfgFillFlowRunByRun && dt != kGen && l_ind == 0) { + tpfsList[run][pfCorr22]->Fill(centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0); + } + } + continue; + } + for (int i = 1; i <= fSecondAxis->GetNbins(); i++) { + auto dnx = fGFW->Calculate(corrconfigs.at(l_ind), i - 1, kTRUE).real(); + if (dnx == 0) + continue; + auto val = fGFW->Calculate(corrconfigs.at(l_ind), i - 1, kFALSE).real() / dnx; + if (std::abs(val) < 1) + (dt == kGen) ? fFCgen->FillProfile(Form("%s_pt_%i", corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm) : fFC->FillProfile(Form("ese_%i_%s_pt_%i", qPtmp, corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm); + // (dt == kGen) ? fFCgen->FillProfile(Form("%s_pt_%i", corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm) : fFC->FillProfile(Form("%s_pt_%i", corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm); + } + } + return; + } + + struct XAxis { + float centrality; + int64_t multiplicity; + double time; + }; + + struct AcceptedTracks { + int nPos; + int nNeg; + int nFull; + int nMid; + }; + + template + void processCollision(TCollision collision, TTracks tracks, const XAxis& xaxis, const int& run) + { + if (tracks.size() < 1) + return; + if (dt != kGen && xaxis.centrality >= 0 && (xaxis.centrality < o2::analysis::gfwflowese::centbinning.front() || xaxis.centrality > o2::analysis::gfwflowese::centbinning.back())) + return; + if (xaxis.multiplicity < cfgFixedMultMin || xaxis.multiplicity > cfgFixedMultMax) + return; + if (dt != kGen) { + registry.fill(HIST("eventQA/eventSel"), kTrackCent); + if (cfgRunByRun) + th1sList[run][hEventSel]->Fill(kTrackCent); + } + if (xaxis.centrality >= 0) + registry.fill(HIST("eventQA/after/centrality"), xaxis.centrality); + registry.fill(HIST("eventQA/after/multiplicity"), xaxis.multiplicity); + float vtxz = collision.posZ(); + if (dt != kGen && cfgRunByRun) { + th1sList[run][hVtxZ]->Fill(vtxz); + th1sList[run][hMult]->Fill(xaxis.multiplicity); + th1sList[run][hCent]->Fill(xaxis.centrality); + } + fGFW->Clear(); + (dt == kGen) ? fFCptgen->clearVector() : fFCpt->clearVector(); + + float lRandom = fRndm->Rndm(); + + // be cautious, this only works for Pb-Pb + // esimate the Event plane and vn for this event + DensityCorr densitycorrections; + if (cfgUseDensityDependentCorrection) { + double psi2Est = 0, psi3Est = 0, psi4Est = 0; + double v2 = 0, v3 = 0, v4 = 0; + double q2x = 0, q2y = 0; + double q3x = 0, q3y = 0; + double q4x = 0, q4y = 0; + for (const auto& track : tracks) { + bool withinPtRef = (o2::analysis::gfwflowese::ptreflow < track.pt()) && (track.pt() < o2::analysis::gfwflowese::ptrefup); // within RF pT rang + if (withinPtRef) { + q2x += std::cos(2 * track.phi()); + q2y += std::sin(2 * track.phi()); + q3x += std::cos(3 * track.phi()); + q3y += std::sin(3 * track.phi()); + q4x += std::cos(4 * track.phi()); + q4y += std::sin(4 * track.phi()); + } + } + psi2Est = std::atan2(q2y, q2x) / 2.; + psi3Est = std::atan2(q3y, q3x) / 3.; + psi4Est = std::atan2(q4y, q4x) / 4.; + v2 = funcV2->Eval(xaxis.centrality); + v3 = funcV3->Eval(xaxis.centrality); + v4 = funcV4->Eval(xaxis.centrality); + densitycorrections.psi2Est = psi2Est; + densitycorrections.psi3Est = psi3Est; + densitycorrections.psi4Est = psi4Est; + densitycorrections.v2 = v2; + densitycorrections.v3 = v3; + densitycorrections.v4 = v4; + densitycorrections.density = tracks.size(); + } + AcceptedTracks acceptedTracks{0, 0, 0, 0}; + for (const auto& track : tracks) { + processTrack(track, vtxz, xaxis.multiplicity, run, densitycorrections, acceptedTracks); + if (cfgConsistentEventFlag & 1) + if (!acceptedTracks.nPos || !acceptedTracks.nNeg) + return; + if (cfgConsistentEventFlag & 2) + if (acceptedTracks.nFull < 4) // o2-linter: disable=magic-number (at least four tracks in full acceptance) + return; + if (cfgConsistentEventFlag & 4) + if (acceptedTracks.nPos < 2 || acceptedTracks.nNeg < 2) // o2-linter: disable=magic-number (at least two tracks in each subevent) + return; + if (cfgConsistentEventFlag & 8) + if (acceptedTracks.nPos < 2 || acceptedTracks.nMid < 2 || acceptedTracks.nNeg < 2) // o2-linter: disable=magic-number (at least two tracks in all three subevents) + return; + } + const auto qPerc{collision.qPERCFT0C()}; + if (!cfgFillWeights) + fillOutputContainers
((cfgTimeDependent) ? xaxis.time : (cfgUseNch) ? xaxis.multiplicity + : xaxis.centrality, + lRandom, run, qPerc[0]); + } + + bool isStable(int pdg) + { + if (std::abs(pdg) == PDG_t::kPiPlus) + return true; + if (std::abs(pdg) == PDG_t::kKPlus) + return true; + if (std::abs(pdg) == PDG_t::kProton) + return true; + if (std::abs(pdg) == PDG_t::kElectron) + return true; + if (std::abs(pdg) == PDG_t::kMuonMinus) + return true; + return false; + } + + template + void fillAcceptedTracks(TTrack track, AcceptedTracks& acceptedTracks) + { + if (posRegionIndex >= 0 && track.eta() > o2::analysis::gfwflowese::regions.GetEtaMin()[posRegionIndex] && track.eta() < o2::analysis::gfwflowese::regions.GetEtaMax()[posRegionIndex]) + ++acceptedTracks.nPos; + if (negRegionIndex >= 0 && track.eta() > o2::analysis::gfwflowese::regions.GetEtaMin()[negRegionIndex] && track.eta() < o2::analysis::gfwflowese::regions.GetEtaMax()[negRegionIndex]) + ++acceptedTracks.nNeg; + if (fullRegionIndex >= 0 && track.eta() > o2::analysis::gfwflowese::regions.GetEtaMin()[fullRegionIndex] && track.eta() < o2::analysis::gfwflowese::regions.GetEtaMax()[fullRegionIndex]) + ++acceptedTracks.nFull; + if (midRegionIndex >= 0 && track.eta() > o2::analysis::gfwflowese::regions.GetEtaMin()[midRegionIndex] && track.eta() < o2::analysis::gfwflowese::regions.GetEtaMax()[midRegionIndex]) + ++acceptedTracks.nMid; + } + + template + inline void processTrack(TTrack const& track, const float& vtxz, const int& multiplicity, const int& run, DensityCorr densitycorrections, AcceptedTracks& acceptedTracks) + { + if constexpr (framework::has_type_v) { + if (track.mcParticleId() < 0 || !(track.has_mcParticle())) + return; + + auto mcParticle = track.mcParticle(); + if (!mcParticle.isPhysicalPrimary()) + return; + if (!isStable(mcParticle.pdgCode())) + return; + if (cfgFillQA) { + fillTrackQA(track, vtxz); + registry.fill(HIST("trackQA/before/nch_pt"), multiplicity, track.pt()); + } + if (!trackSelected(track)) + return; + + if (cfgFillWeights) { + fillWeights(track, vtxz, run); + } else { + fillPtSums(track); + fillGFW(track, vtxz, densitycorrections); + fillAcceptedTracks(track, acceptedTracks); + } + + if (cfgFillQA) { + fillTrackQA(track, vtxz); + registry.fill(HIST("trackQA/after/nch_pt"), multiplicity, track.pt()); + if (cfgRunByRun) { + th1sList[run][hPhi]->Fill(track.phi()); + th1sList[run][hEta]->Fill(track.eta()); + } + } + + } else if constexpr (framework::has_type_v) { + if (!track.isPhysicalPrimary() || !isStable(track.pdgCode())) + return; + + fillPtSums(track); + fillGFW(track, vtxz, densitycorrections); + fillAcceptedTracks(track, acceptedTracks); + if (cfgFillQA) { + fillTrackQA(track, vtxz); + registry.fill(HIST("MCGen/trackQA/nch_pt"), multiplicity, track.pt()); + } + } else { + if (cfgFillQA) { + fillTrackQA(track, vtxz); + registry.fill(HIST("trackQA/before/nch_pt"), multiplicity, track.pt()); + } + if (!trackSelected(track)) + return; + + if (cfgFillWeights) { + fillWeights(track, vtxz, run); + } else { + fillPtSums(track); + fillGFW(track, vtxz, densitycorrections); + fillAcceptedTracks(track, acceptedTracks); + } + if (cfgFillQA) { + fillTrackQA(track, vtxz); + registry.fill(HIST("trackQA/after/nch_pt"), multiplicity, track.pt()); + if (cfgRunByRun) { + th1sList[run][hPhi]->Fill(track.phi()); + th1sList[run][hEta]->Fill(track.eta()); + th3sList[run][hNUAref]->Fill(track.phi(), track.eta(), vtxz, getAcceptance(track, vtxz)); + } + } + } + return; + } + + template + inline void fillGFW(TTrack track, const double& vtxz, DensityCorr densitycorrections) + { + bool withinPtRef = (track.pt() > o2::analysis::gfwflowese::ptreflow && track.pt() < o2::analysis::gfwflowese::ptrefup); + bool withinPtPOI = (track.pt() > o2::analysis::gfwflowese::ptpoilow && track.pt() < o2::analysis::gfwflowese::ptpoiup); + if (!withinPtPOI && !withinPtRef) + return; + double weff = (dt == kGen) ? 1. : getEfficiency(track); + if (weff < 0) + return; + if (cfgUseDensityDependentCorrection && withinPtRef && dt != kGen) { + double fphi = densitycorrections.v2 * std::cos(2 * (track.phi() - densitycorrections.psi2Est)) + densitycorrections.v3 * std::cos(3 * (track.phi() - densitycorrections.psi3Est)) + densitycorrections.v4 * std::cos(4 * (track.phi() - densitycorrections.psi4Est)); + fphi = (1 + 2 * fphi); + int pTBinForEff = hFindPtBin->FindBin(track.pt()); + if (pTBinForEff >= 1 && pTBinForEff <= hFindPtBin->GetNbinsX()) { + float wEPeff = funcEff[pTBinForEff - 1]->Eval(fphi * densitycorrections.density); + if (wEPeff > 0.) { + wEPeff = 1. / wEPeff; + weff *= wEPeff; + } + } + } + double wacc = (dt == kGen) ? 1. : getAcceptance(track, vtxz); + if (withinPtRef) + fGFW->Fill(track.eta(), fSecondAxis->FindBin(track.pt()) - 1, track.phi(), weff * wacc, 1); + if (withinPtPOI) + fGFW->Fill(track.eta(), fSecondAxis->FindBin(track.pt()) - 1, track.phi(), weff * wacc, 2); + if (withinPtRef && withinPtPOI) + fGFW->Fill(track.eta(), fSecondAxis->FindBin(track.pt()) - 1, track.phi(), weff * wacc, 4); + return; + } + + template + inline void fillPtSums(TTrack track) + { + double weff = (dt == kGen) ? 1. : getEfficiency(track); + if (weff < 0) + return; + if (std::abs(track.eta()) < cfgEtaPtPt && track.pt() > o2::analysis::gfwflowese::ptreflow && track.pt() < o2::analysis::gfwflowese::ptrefup) { + (dt == kGen) ? fFCptgen->fill(1., track.pt()) : fFCpt->fill(weff, track.pt()); + } + } + + template + inline void fillTrackQA(TTrack track, const float vtxz) + { + if constexpr (dt == kGen) { + registry.fill(HIST("MCGen/trackQA/phi_eta_vtxZ"), track.phi(), track.eta(), vtxz); + registry.fill(HIST("MCGen/trackQA/pt_ref"), track.pt()); + registry.fill(HIST("MCGen/trackQA/pt_poi"), track.pt()); + } else { + double wacc = getAcceptance(track, vtxz); + registry.fill(HIST("trackQA/") + HIST(FillTimeName[ft]) + HIST("phi_eta_vtxZ"), track.phi(), track.eta(), vtxz, (ft == kAfter) ? wacc : 1.0); + registry.fill(HIST("trackQA/") + HIST(FillTimeName[ft]) + HIST("pt_dcaXY_dcaZ"), track.pt(), track.dcaXY(), track.dcaZ()); + + registry.fill(HIST("trackQA/") + HIST(FillTimeName[ft]) + HIST("chi2prTPCcls"), track.tpcChi2NCl()); + registry.fill(HIST("trackQA/") + HIST(FillTimeName[ft]) + HIST("chi2prITScls"), track.itsChi2NCl()); + registry.fill(HIST("trackQA/") + HIST(FillTimeName[ft]) + HIST("nTPCClusters"), track.tpcNClsFound()); + registry.fill(HIST("trackQA/") + HIST(FillTimeName[ft]) + HIST("nITSClusters"), track.itsNCls()); + registry.fill(HIST("trackQA/") + HIST(FillTimeName[ft]) + HIST("nTPCCrossedRows"), track.tpcNClsCrossedRows()); + + if (ft == kAfter) { + registry.fill(HIST("trackQA/") + HIST(FillTimeName[ft]) + HIST("pt_ref"), track.pt()); + registry.fill(HIST("trackQA/") + HIST(FillTimeName[ft]) + HIST("pt_poi"), track.pt()); + } + } + } + + template + float getCentrality(TCollision collision) + { + switch (cfgCentEstimator) { + case kCentFT0C: + return collision.centFT0C(); + case kCentFT0CVariant1: + return collision.centFT0CVariant1(); + case kCentFT0M: + return collision.centFT0M(); + case kCentFV0A: + return collision.centFV0A(); + case kCentNTPV: + return collision.centNTPV(); + case kCentNGlobal: + return collision.centNGlobal(); + case kCentMFT: + return collision.centMFT(); + default: + return collision.centFT0C(); + } + } + + template + inline void fillEventQA(TCollision collision, XAxis xaxis) + { + if constexpr (framework::has_type_v) { + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("globalTracks_centT0C"), collision.centFT0C(), xaxis.multiplicity); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("PVTracks_centT0C"), collision.centFT0C(), collision.multNTracksPV()); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("multT0C_centT0C"), collision.centFT0C(), collision.multFT0C()); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("centT0M_centT0C"), collision.centFT0C(), collision.centFT0M()); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("centV0A_centT0C"), collision.centFT0C(), collision.centFV0A()); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("centGlobal_centT0C"), collision.centFT0C(), collision.centNGlobal()); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("centNTPV_centT0C"), collision.centFT0C(), collision.centNTPV()); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("centMFT_centT0C"), collision.centFT0C(), collision.centMFT()); + } + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("globalTracks_PVTracks"), collision.multNTracksPV(), xaxis.multiplicity); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("globalTracks_multT0A"), collision.multFT0A(), xaxis.multiplicity); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("globalTracks_multV0A"), collision.multFV0A(), xaxis.multiplicity); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("multV0A_multT0A"), collision.multFT0A(), collision.multFV0A()); + if (cfgTimeDependent) { + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("multiplicity_time"), xaxis.time, xaxis.multiplicity); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("multT0C_time"), xaxis.time, collision.multFT0C()); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("multT0A_time"), xaxis.time, collision.multFT0A()); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("multV0A_time"), xaxis.time, collision.multFV0A()); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("multPV_time"), xaxis.time, collision.multNTracksPV()); + } + return; + } + + double getTimeSinceStartOfFill(uint64_t timestamp, int firstRun) + { + auto runDuration = ccdb->getRunDuration(firstRun); + uint64_t tsSOF = runDuration.first; + uint64_t diff = timestamp - tsSOF; + return static_cast(diff) / 3600000.0; + } + + void processData(soa::Filtered>::iterator const& collision, aod::BCsWithTimestamps const&, GFWTracks const& tracks) + { + auto bc = collision.bc_as(); + int run = bc.runNumber(); + if (run != lastRun) { + lastRun = run; + LOGF(info, "run = %d", run); + if (cfgRunByRun) { + if (std::find(runNumbers.begin(), runNumbers.end(), run) == runNumbers.end()) { + LOGF(info, "Creating histograms for run %d", run); + createRunByRunHistograms(run); + runNumbers.push_back(run); + } else { + LOGF(info, "run %d already in runNumbers", run); + } + if (!cfgFillWeights) + loadCorrections(bc); + } + } + if (!cfgFillWeights && !cfgRunByRun) + loadCorrections(bc); + registry.fill(HIST("eventQA/eventSel"), kFilteredEvent); + if (cfgRunByRun) + th1sList[run][hEventSel]->Fill(kFilteredEvent); + if (!collision.sel8()) + return; + registry.fill(HIST("eventQA/eventSel"), kSel8); + if (cfgRunByRun) + th1sList[run][hEventSel]->Fill(kSel8); + if (cfgDoOccupancySel) { + int occupancy = collision.trackOccupancyInTimeRange(); + if (occupancy < 0 || occupancy > cfgOccupancySelection) + return; + } + const auto qPerc{collision.qPERCFT0C()}; + if (qPerc[0] < 0) + return; + registry.fill(HIST("eventQA/eventSel"), kOccupancy); + if (cfgRunByRun) + th1sList[run][hEventSel]->Fill(kOccupancy); + + const XAxis xaxis{getCentrality(collision), tracks.size(), (cfgTimeDependent) ? getTimeSinceStartOfFill(bc.timestamp(), *firstRunOfCurrentFill) : -1.0}; + if (cfgTimeDependent && run == *firstRunOfCurrentFill && firstRunOfCurrentFill != o2::analysis::gfwflowese::firstRunsOfFill.end() - 1) + ++firstRunOfCurrentFill; + + if (cfgFillQA) + fillEventQA(collision, xaxis); + registry.fill(HIST("eventQA/before/centrality"), xaxis.centrality); + registry.fill(HIST("eventQA/before/multiplicity"), xaxis.multiplicity); + if (cfgUseAdditionalEventCut && !eventSelected(collision, xaxis.multiplicity, xaxis.centrality, run)) + return; + if (cfgFillQA) + fillEventQA(collision, xaxis); + processCollision(collision, tracks, xaxis, run); + } + PROCESS_SWITCH(FlowGfwEse, processData, "Process analysis for non-derived data", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc), + }; +} From 90279c65f6f33df0ddcfcd56f0079dccac18f339 Mon Sep 17 00:00:00 2001 From: Katarzyna <116073883+kgwizdzi@users.noreply.github.com> Date: Mon, 11 Aug 2025 11:50:42 +0200 Subject: [PATCH 007/986] [PWGCF] FemtoUniverse: updating MCReco and MCGen functions for track-D0 (#12510) --- .../femtoUniverseProducerTask.cxx | 419 +++++++----- .../Tasks/femtoUniverseEfficiencyBase.cxx | 30 +- .../Tasks/femtoUniversePairTaskTrackD0.cxx | 641 ++++++++++-------- 3 files changed, 670 insertions(+), 420 deletions(-) diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx index 1415e905f39..bf16f78ba14 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx @@ -297,6 +297,7 @@ struct FemtoUniverseProducerTask { /// Phi meson Configurable confPhiPtLowLimit{"confPhiPtLowLimit", 0.8, "Lower limit of the Phi pT."}; Configurable confPhiPtHighLimit{"confPhiPtHighLimit", 4.0, "Higher limit of the Phi pT."}; + Configurable confPhiEtaHighLimit{"confPhiEtaHighLimit", 0.8, "Maximum eta value of the Phi"}; Configurable confPhiInvMassLowLimit{"confPhiInvMassLowLimit", 1.011, "Lower limit of the Phi invariant mass"}; Configurable confPhiInvMassUpLimit{"confPhiInvMassUpLimit", 1.027, "Upper limit of the Phi invariant mass"}; // Phi meson daughters @@ -304,13 +305,21 @@ struct FemtoUniverseProducerTask { Configurable confPhiKaonRejectProtonNsigma{"confPhiKaonRejectProtonNsigma", 3.0, "Reject if particle could be a Proton combined nsigma value."}; // Kaons Configurable confPhiDoLFPID4Kaons{"confPhiDoLFPID4Kaons", true, "Switch on do PID for Kaons as in LF"}; - Configurable confPhiKaonNsigmaTPCfrom0_0to0_3{"confPhiKaonNsigmaTPCfrom0_0to0_3", 3.0, "Reject if Kaons in 0.0-0.3 are have TPC n sigma above this value."}; - Configurable confPhiKaonNsigmaTPCfrom0_3to0_45{"confPhiKaonNsigmaTPCfrom0_3to0_45", 2.0, "Reject if Kaons in 0.3-0.45 are have TPC n sigma above this value."}; - Configurable confPhiKaonNsigmaTPCfrom0_45to0_55{"confPhiKaonNsigmaTPCfrom0_45to0_55", 1.0, "Reject if Kaons in 0.45-0.55 are have TPC n sigma above this value."}; - Configurable confPhiKaonNsigmaTPCfrom0_55to1_5{"confPhiKaonNsigmaTPCfrom0_55to1_5", 3.0, "Reject if Kaons in 0.55-1.5 are have TPC n sigma above this value."}; - Configurable confPhiKaonNsigmaTOFfrom0_55to1_5{"confPhiKaonNsigmaTOFfrom0_55to1_5", 3.0, "Reject if Kaons in 0.55-1.5 are have TOF n sigma above this value."}; - Configurable confPhiKaonNsigmaTPCfrom1_5{"confPhiKaonNsigmaTPCfrom1_5", 3.0, "Reject if Kaons above 1.5 are have TPC n sigma above this value."}; - Configurable confPhiKaonNsigmaTOFfrom1_5{"confPhiKaonNsigmaTOFfrom1_5", 3.0, "Reject if Kaons above 1.5 are have TOF n sigma above this value."}; + Configurable confNSigmaTPCKaonLF{"confNSigmaTPCKaonLF", 3.0, "TPC Kaon Sigma as in LF"}; + Configurable confNSigmaCombKaonLF{"confNSigmaCombKaonLF", 3.0, "TPC and TOF Kaon Sigma (combined) as in LF"}; + Configurable confMomKaonLF{"confMomKaonLF", 0.5, "Momentum threshold for kaon identification as in LF"}; + Configurable confMomKaonRejected{"confMomKaonRejected", 0.5, "Momentum threshold for rejected kaon"}; + Configurable confMomKaon03{"confMomKaon03", 0.3, "Momentum threshold for kaon identification pT = 0.3 GeV/c"}; + Configurable confMomKaon045{"confMomKaon045", 0.45, "Momentum threshold for kaon identification pT = 0.45 GeV/c"}; + Configurable confMomKaon055{"confMomKaon055", 0.55, "Momentum threshold for kaon identification pT = 0.55 GeV/c"}; + Configurable confMomKaon15{"confMomKaon15", 1.5, "Momentum threshold for kaon identification pT = 1.5 GeV/c"}; + Configurable confPhiKaonNsigmaTPCfrom00to03{"confPhiKaonNsigmaTPCfrom00to03", 3.0, "Reject if Kaons in 0.0-0.3 are have TPC n sigma above this value."}; + Configurable confPhiKaonNsigmaTPCfrom03to045{"confPhiKaonNsigmaTPCfrom03to045", 2.0, "Reject if Kaons in 0.3-0.45 are have TPC n sigma above this value."}; + Configurable confPhiKaonNsigmaTPCfrom045to055{"confPhiKaonNsigmaTPCfrom045to055", 1.0, "Reject if Kaons in 0.45-0.55 are have TPC n sigma above this value."}; + Configurable confPhiKaonNsigmaTPCfrom055to15{"confPhiKaonNsigmaTPCfrom055to15", 3.0, "Reject if Kaons in 0.55-1.5 are have TPC n sigma above this value."}; + Configurable confPhiKaonNsigmaTOFfrom055to15{"confPhiKaonNsigmaTOFfrom055to15", 3.0, "Reject if Kaons in 0.55-1.5 are have TOF n sigma above this value."}; + Configurable confPhiKaonNsigmaTPCfrom15{"confPhiKaonNsigmaTPCfrom15", 3.0, "Reject if Kaons above 1.5 are have TPC n sigma above this value."}; + Configurable confPhiKaonNsigmaTOFfrom15{"confPhiKaonNsigmaTOFfrom15", 3.0, "Reject if Kaons above 1.5 are have TOF n sigma above this value."}; } ConfPhiSelection; // PDG codes for fillMCParticle function @@ -323,6 +332,8 @@ struct FemtoUniverseProducerTask { Configurable confD0D0barCandEtaCut{"confD0D0barCandEtaCut", 0.8, "max. cand. pseudorapidity"}; Configurable yD0D0barCandRecoMax{"yD0D0barCandRecoMax", 0.8, "MC Reco, max. rapidity of D0/D0bar cand."}; Configurable yD0D0barCandGenMax{"yD0D0barCandGenMax", 0.8, "MC Truth, max. rapidity of D0/D0bar cand."}; + Configurable trackD0pTGenMin{"trackD0pTGenMin", 0.0, "MC Truth, min. pT for tracks and D0/D0bar cand."}; + Configurable trackD0pTGenMax{"trackD0pTGenMax", 24.0, "MC Truth, max. pT for tracks and D0/D0bar cand."}; Configurable storeD0D0barDoubleMassHypo{"storeD0D0barDoubleMassHypo", false, "Store D0/D0bar cand. which pass selection criteria for both, D0 and D0bar"}; Configurable> classMlD0D0bar{"classMlD0D0bar", {0, 1, 2}, "Indexes of ML scores to be stored. Three indexes max."}; } ConfD0Selection; @@ -340,34 +351,34 @@ struct FemtoUniverseProducerTask { bool isKaonNSigma(float mom, float nsigmaTPCK, float nsigmaTOFK) { - if (mom < 0.3) { // 0.0-0.3 - if (std::abs(nsigmaTPCK) < ConfPhiSelection.confPhiKaonNsigmaTPCfrom0_0to0_3) { + if (mom < ConfPhiSelection.confMomKaon03) { // 0.0-0.3 + if (std::abs(nsigmaTPCK) < ConfPhiSelection.confPhiKaonNsigmaTPCfrom00to03) { return true; } else { return false; } - } else if (mom < 0.45) { // 0.30 - 0.45 - if (std::abs(nsigmaTPCK) < ConfPhiSelection.confPhiKaonNsigmaTPCfrom0_3to0_45) { + } else if (mom < ConfPhiSelection.confMomKaon045) { // 0.30 - 0.45 + if (std::abs(nsigmaTPCK) < ConfPhiSelection.confPhiKaonNsigmaTPCfrom03to045) { return true; } else { return false; } - } else if (mom < 0.55) { // 0.45-0.55 - if (std::abs(nsigmaTPCK) < ConfPhiSelection.confPhiKaonNsigmaTPCfrom0_45to0_55) { + } else if (mom < ConfPhiSelection.confMomKaon055) { // 0.45-0.55 + if (std::abs(nsigmaTPCK) < ConfPhiSelection.confPhiKaonNsigmaTPCfrom045to055) { return true; } else { return false; } - } else if (mom < 1.5) { // 0.55-1.5 (now we use TPC and TOF) - if ((std::abs(nsigmaTOFK) < ConfPhiSelection.confPhiKaonNsigmaTOFfrom0_55to1_5) && (std::abs(nsigmaTPCK) < ConfPhiSelection.confPhiKaonNsigmaTPCfrom0_55to1_5)) { + } else if (mom < ConfPhiSelection.confMomKaon15) { // 0.55-1.5 (now we use TPC and TOF) + if ((std::abs(nsigmaTOFK) < ConfPhiSelection.confPhiKaonNsigmaTOFfrom055to15) && (std::abs(nsigmaTPCK) < ConfPhiSelection.confPhiKaonNsigmaTPCfrom055to15)) { { return true; } } else { return false; } - } else if (mom > 1.5) { // 1.5 - - if ((std::abs(nsigmaTOFK) < ConfPhiSelection.confPhiKaonNsigmaTOFfrom1_5) && (std::abs(nsigmaTPCK) < ConfPhiSelection.confPhiKaonNsigmaTPCfrom1_5)) { + } else if (mom > ConfPhiSelection.confMomKaon15) { // 1.5 - + if ((std::abs(nsigmaTOFK) < ConfPhiSelection.confPhiKaonNsigmaTOFfrom15) && (std::abs(nsigmaTPCK) < ConfPhiSelection.confPhiKaonNsigmaTPCfrom15)) { return true; } else { return false; @@ -379,17 +390,17 @@ struct FemtoUniverseProducerTask { bool isKaonNSigmaLF(float mom, float nsigmaTPCK, float nsigmaTOFK, bool hasTOF) { - if (mom < 0.5) { - if (std::abs(nsigmaTPCK) < 3.0) { + if (mom < ConfPhiSelection.confMomKaonLF) { + if (std::abs(nsigmaTPCK) < ConfPhiSelection.confNSigmaTPCKaonLF) { return true; } else { return false; } - } else if (mom >= 0.5) { // 0.55-1.5 (now we use TPC and TOF) + } else if (mom >= ConfPhiSelection.confMomKaonLF) { // 0.5-1.5 (now we use TPC and TOF) if (!hasTOF) { return false; } else { - if (std::sqrt(nsigmaTPCK * nsigmaTPCK + nsigmaTOFK * nsigmaTOFK) < 3.0) { + if (std::sqrt(nsigmaTPCK * nsigmaTPCK + nsigmaTOFK * nsigmaTOFK) < ConfPhiSelection.confNSigmaCombKaonLF) { return true; } else { return false; @@ -402,14 +413,14 @@ struct FemtoUniverseProducerTask { bool isKaonRejected(float mom, float nsigmaTPCPr, float nsigmaTOFPr, float nsigmaTPCPi, float nsigmaTOFPi) { - if (mom < 0.5) { + if (mom < ConfPhiSelection.confMomKaonRejected) { if (std::abs(nsigmaTPCPi) < ConfPhiSelection.confPhiKaonRejectPionNsigma.value) { return true; } else if (std::abs(nsigmaTPCPr) < ConfPhiSelection.confPhiKaonRejectProtonNsigma.value) { return true; } } - if (mom > 0.5) { + if (mom > ConfPhiSelection.confMomKaonRejected) { if (std::hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfPhiSelection.confPhiKaonRejectPionNsigma.value) { return true; } else if (std::hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfPhiSelection.confPhiKaonRejectProtonNsigma.value) { @@ -442,7 +453,7 @@ struct FemtoUniverseProducerTask { if (mom <= ConfPIDBitmask.confMinMomTOF) { return (std::abs(nsigmaTPCParticle) < ConfPIDBitmask.confNsigmaTPCParticle); } else { - return (TMath::Hypot(nsigmaTOFParticle, nsigmaTPCParticle) < ConfPIDBitmask.confNsigmaCombinedParticle); + return (std::hypot(nsigmaTOFParticle, nsigmaTPCParticle) < ConfPIDBitmask.confNsigmaCombinedParticle); } } @@ -723,7 +734,8 @@ struct FemtoUniverseProducerTask { outputDebugParts(-999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., - -999., -999., + -999., + hfHelper.yD0(particle), // getter transRadius particle.mlProbD0()[0], // getter decayVtxX particle.mlProbD0()[1], // getter decayVtxY particle.mlProbD0()[2], // getter decayVtxZ @@ -732,7 +744,48 @@ struct FemtoUniverseProducerTask { outputDebugParts(-999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., - -999., -999., + -999., + hfHelper.yD0(particle), // getter transRadius + particle.mlProbD0bar()[0], // getter decayVtxX + particle.mlProbD0bar()[1], // getter decayVtxY + particle.mlProbD0bar()[2], // getter decayVtxZ + -999.); // Additional info for D0/D0bar + } else { + outputDebugParts(-999., -999., -999., -999., -999., -999., -999., -999., -999., + -999., -999., -999., -999., -999., -999., -999., -999., + -999., -999., -999., -999., -999., + -999., -999., -999., -999., -999., -999.); + } + } + + template + void fillDebugD0D0barMcMl(ParticleType const& particle) + { + int8_t originMcReco = 2; // 0 - prompt, 1 - non-prompt, 2 - default/else + if (particle.originMcRec() == RecoDecay::OriginType::Prompt) { + originMcReco = 0; + } else if (particle.originMcRec() == RecoDecay::OriginType::NonPrompt) { + originMcReco = 1; + } else { + originMcReco = 2; + } + if constexpr (isD0ML) { + outputDebugParts(particle.flagMcMatchRec(), // getter sign + originMcReco, -999., -999., -999., -999., -999., -999., -999., + -999., -999., -999., -999., -999., -999., -999., -999., + -999., -999., -999., -999., -999., + -999., + hfHelper.yD0(particle), // getter transRadius + particle.mlProbD0()[0], // getter decayVtxX + particle.mlProbD0()[1], // getter decayVtxY + particle.mlProbD0()[2], // getter decayVtxZ + -999.); // Additional info for D0/D0bar + } else if constexpr (isD0barML) { + outputDebugParts(particle.flagMcMatchRec(), -999., -999., -999., -999., -999., -999., -999., -999., + originMcReco, -999., -999., -999., -999., -999., -999., -999., + -999., -999., -999., -999., -999., + -999., + hfHelper.yD0(particle), // getter transRadius particle.mlProbD0bar()[0], // getter decayVtxX particle.mlProbD0bar()[1], // getter decayVtxY particle.mlProbD0bar()[2], // getter decayVtxZ @@ -815,7 +868,7 @@ struct FemtoUniverseProducerTask { if ((kaon1MC.isPhysicalPrimary() && kaon2MC.isPhysicalPrimary()) && (!motherskaon1MC.empty() && !motherskaon2MC.empty())) { for (const auto& particleMotherOfNeg : motherskaon1MC) { for (const auto& particleMotherOfPos : motherskaon2MC) { - if (particleMotherOfNeg == particleMotherOfPos && particleMotherOfNeg.pdgCode() == 333) { + if (particleMotherOfNeg == particleMotherOfPos && particleMotherOfNeg.pdgCode() == Pdg::kPhi) { phiOrigin = aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kPrimary; } else { phiOrigin = aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kFake; @@ -852,44 +905,6 @@ struct FemtoUniverseProducerTask { } } - template - void fillMCParticleD0(ParticleType const& hfCand) - { - if (std::abs(hfCand.flagMcMatchRec()) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { - // get corresponding MC particle and its info - int pdgCode = 0; - int hfCandOrigin = 99; - - if (hfCand.originMcRec() == RecoDecay::OriginType::Prompt) { - if (hfCand.isSelD0() == 1 && hfCand.isSelD0bar() == 0) { - hfCandOrigin = aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kPrompt; - pdgCode = static_cast(Pdg::kD0); - } else if (hfCand.isSelD0() == 0 && hfCand.isSelD0bar() == 1) { - hfCandOrigin = aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kPrompt; - pdgCode = static_cast(Pdg::kD0Bar); - } else { - hfCandOrigin = aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kFake; - pdgCode = 0; - } - } else { - if (hfCand.isSelD0() == 1 && hfCand.isSelD0bar() == 0) { - hfCandOrigin = aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kNonPrompt; - pdgCode = static_cast(Pdg::kD0); - } else if (hfCand.isSelD0() == 0 && hfCand.isSelD0bar() == 1) { - hfCandOrigin = aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kNonPrompt; - pdgCode = static_cast(Pdg::kD0Bar); - } else { - hfCandOrigin = aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kFake; - pdgCode = 0; - } - } - outputPartsMC(hfCandOrigin, pdgCode, hfCand.pt(), hfHelper.yD0(hfCand), hfCand.phi()); - outputPartsMCLabels(outputPartsMC.lastIndex()); - } else { - outputPartsMCLabels(-1); - } - } - template bool fillCollisions(CollisionType const& col, TrackType const& tracks) { @@ -1327,7 +1342,7 @@ struct FemtoUniverseProducerTask { } template - void fillD0mesons(CollisionType const&, TrackType const&, HfCandidate const& hfCands) + void fillD0D0barData(CollisionType const&, TrackType const&, HfCandidate const& hfCands) { std::vector childIDs = {0, 0}; // these IDs are necessary to keep track of the children std::vector tmpIDtrack; // this vector keeps track of the matching of the primary track table row <-> aod::track table global index @@ -1450,15 +1465,14 @@ struct FemtoUniverseProducerTask { } template - void fillD0D0barUsingML(CollisionType const&, TrackType const&, HfCandidate const& hfCands) + void fillD0D0barDataMl(CollisionType const&, TrackType const&, HfCandidate const& hfCands) { std::vector childIDs = {0, 0}; // these IDs are necessary to keep track of the children std::vector tmpIDtrack; // this vector keeps track of the matching of the primary track table row <-> aod::track table global index double invMassD0 = 0.0; double invMassD0bar = 0.0; bool isD0D0bar = false; - double mlProbD0D0barBg = 0.0; - uint8_t daughFlag = 0; // flag = 0 (daugh of D0 or D0bar), 1 (daug of D0), -1 (daugh of D0bar) + int8_t daughFlag = 0; // flag = 0 (daugh of D0 or D0bar), 1 (daug of D0), -1 (daugh of D0bar) for (const auto& hfCand : hfCands) { @@ -1474,7 +1488,6 @@ struct FemtoUniverseProducerTask { continue; } - // int postrackID = hfCand.prong0().globalIndex(); int postrackID = hfCand.prong0Id(); // Index to first prong int rowInPrimaryTrackTablePos = -1; rowInPrimaryTrackTablePos = getRowDaughters(postrackID, tmpIDtrack); @@ -1486,13 +1499,11 @@ struct FemtoUniverseProducerTask { if (hfCand.isSelD0() == 1 && hfCand.isSelD0bar() == 0) { invMassD0 = hfHelper.invMassD0ToPiK(hfCand); invMassD0bar = -hfHelper.invMassD0barToKPi(hfCand); - mlProbD0D0barBg = hfCand.mlProbD0()[0]; isD0D0bar = true; daughFlag = 1; } else if (hfCand.isSelD0() == 0 && hfCand.isSelD0bar() == 1) { invMassD0 = -hfHelper.invMassD0ToPiK(hfCand); invMassD0bar = hfHelper.invMassD0barToKPi(hfCand); - mlProbD0D0barBg = hfCand.mlProbD0bar()[0]; isD0D0bar = true; daughFlag = -1; } else if (hfCand.isSelD0() == 1 && hfCand.isSelD0bar() == 1) { @@ -1556,9 +1567,9 @@ struct FemtoUniverseProducerTask { hfCand.eta(), hfCand.phi(), aod::femtouniverseparticle::ParticleType::kD0, - -999, // cut, CutContainerType - -999, // PID, CutContainerType - mlProbD0D0barBg, // saving the probability for ML score class 1 + -999, // cut, CutContainerType + -999, // PID, CutContainerType + -999., // tempFitVar indexChildID, invMassD0, // D0 mass (mLambda) invMassD0bar); // D0bar mass (mAntiLambda) @@ -1566,9 +1577,9 @@ struct FemtoUniverseProducerTask { if (confIsDebug) { fillDebugParticle(postrack); // QA for positive daughter fillDebugParticle(negtrack); // QA for negative daughter - if (hfCand.isSelD0() == 1 && hfCand.isSelD0bar() == 0) { + if (hfCand.isSelD0() == 1) { fillDebugD0D0barML(hfCand); // QA for D0/D0bar - } else if (hfCand.isSelD0() == 0 && hfCand.isSelD0bar() == 1) { + } else if (hfCand.isSelD0bar() == 1) { fillDebugD0D0barML(hfCand); } else { fillDebugD0D0barML(hfCand); @@ -1581,6 +1592,149 @@ struct FemtoUniverseProducerTask { } } + template + void fillD0D0barMcMl(CollisionType const&, TrackType const&, HfCandidate const& hfCands, McPart const& mcParticles) + { + std::vector childIDs = {0, 0}; // these IDs are necessary to keep track of the children + std::vector tmpIDtrack; // this vector keeps track of the matching of the primary track table row <-> aod::track table global index + double invMassD0 = 0.0; + double invMassD0bar = 0.0; + bool isD0D0bar = false; + int indexMcRec = -1; + int8_t sign = 0; + int8_t daughFlag = 0; // flag = 0 (daugh of D0 or D0bar), 1 (daug of D0), -1 (daugh of D0bar) + + for (const auto& hfCand : hfCands) { + + if (!(hfCand.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { + continue; + } + + if (ConfD0Selection.confD0D0barCandMaxY >= 0. && std::abs(hfHelper.yD0(hfCand)) > ConfD0Selection.confD0D0barCandMaxY) { + continue; + } + + if (std::abs(hfCand.eta()) > ConfD0Selection.confD0D0barCandEtaCut) { + continue; + } + + // Check whether the D0 candidate has the corresponding MC particle + auto postrack = hfCand.template prong0_as(); + auto negtrack = hfCand.template prong1_as(); + auto arrayDaughters = std::array{postrack, negtrack}; + indexMcRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &sign); + + if (!(indexMcRec > -1)) { + continue; + } + + if (std::abs(hfCand.flagMcMatchRec()) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { + int postrackID = hfCand.prong0Id(); // Index to first prong + int rowInPrimaryTrackTablePos = -1; + rowInPrimaryTrackTablePos = getRowDaughters(postrackID, tmpIDtrack); + childIDs[0] = rowInPrimaryTrackTablePos; + childIDs[1] = 0; + + if (hfCand.isSelD0() == 1 && hfCand.isSelD0bar() == 0) { + invMassD0 = hfHelper.invMassD0ToPiK(hfCand); + invMassD0bar = -hfHelper.invMassD0barToKPi(hfCand); + isD0D0bar = true; + daughFlag = 1; + } else if (hfCand.isSelD0() == 0 && hfCand.isSelD0bar() == 1) { + invMassD0 = -hfHelper.invMassD0ToPiK(hfCand); + invMassD0bar = hfHelper.invMassD0barToKPi(hfCand); + isD0D0bar = true; + daughFlag = -1; + } else if (hfCand.isSelD0() == 1 && hfCand.isSelD0bar() == 1) { + invMassD0 = hfHelper.invMassD0ToPiK(hfCand); + invMassD0bar = hfHelper.invMassD0barToKPi(hfCand); + if (ConfD0Selection.storeD0D0barDoubleMassHypo) { + isD0D0bar = true; + daughFlag = 0; + } else { + isD0D0bar = false; + daughFlag = 0; + } + } else { + invMassD0 = 0.0; + invMassD0bar = 0.0; + isD0D0bar = false; + } + + if (isD0D0bar) { + outputParts(outputCollision.lastIndex(), + hfCand.ptProng0(), + RecoDecay::eta(std::array{hfCand.pxProng0(), hfCand.pyProng0(), hfCand.pzProng0()}), // eta + RecoDecay::phi(hfCand.pxProng0(), hfCand.pyProng0()), // phi + aod::femtouniverseparticle::ParticleType::kD0Child, + -999, // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kPosCuts), + -999, // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kPosPID), + -999, + childIDs, + postrack.sign(), // D0 mass -> positive daughter of D0/D0bar + daughFlag); // D0bar mass -> sign that the daugh is from D0 or D0 decay + const int rowOfPosTrack = outputParts.lastIndex(); + if constexpr (isMC) { + fillMCParticle(postrack, o2::aod::femtouniverseparticle::ParticleType::kD0Child); + } + // int negtrackID = hfCand.prong1().globalIndex(); + int negtrackID = hfCand.prong1Id(); + int rowInPrimaryTrackTableNeg = -1; + rowInPrimaryTrackTableNeg = getRowDaughters(negtrackID, tmpIDtrack); + childIDs[0] = 0; + childIDs[1] = rowInPrimaryTrackTableNeg; + + outputParts(outputCollision.lastIndex(), + hfCand.ptProng1(), + RecoDecay::eta(std::array{hfCand.pxProng1(), hfCand.pyProng1(), hfCand.pzProng1()}), // eta + RecoDecay::phi(hfCand.pxProng1(), hfCand.pyProng1()), // phi + aod::femtouniverseparticle::ParticleType::kD0Child, + -999, // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kNegCuts), + -999, // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kNegPID), + -999, + childIDs, + negtrack.sign(), // negative daughter of D0/D0bar + daughFlag); // sign that the daugh is from D0 or D0 decay + const int rowOfNegTrack = outputParts.lastIndex(); + if constexpr (isMC) { + fillMCParticle(negtrack, o2::aod::femtouniverseparticle::ParticleType::kD0Child); + } + std::vector indexChildID = {rowOfPosTrack, rowOfNegTrack}; + + outputParts(outputCollision.lastIndex(), + hfCand.pt(), + hfCand.eta(), + hfCand.phi(), + aod::femtouniverseparticle::ParticleType::kD0, + -999, // cut, CutContainerType + -999, // PID, CutContainerType + -999., // tempFitVar + indexChildID, + invMassD0, // D0 mass (mLambda) + invMassD0bar); // D0bar mass (mAntiLambda) + + if (confIsDebug) { + fillDebugParticle(postrack); // QA for positive daughter + fillDebugParticle(negtrack); // QA for negative daughter + if (hfCand.isSelD0() == 1) { + fillDebugD0D0barMcMl(hfCand); // QA for D0/D0bar + } else if (hfCand.isSelD0bar() == 1) { + fillDebugD0D0barMcMl(hfCand); + } else { + fillDebugD0D0barMcMl(hfCand); + } + } + if constexpr (isMC) { + auto particleMother = mcParticles.rawIteratorAt(indexMcRec); // gen. level pT + auto yGen = RecoDecay::y(particleMother.pVector(), o2::constants::physics::MassD0); // gen. level y + outputPartsMC(0, particleMother.pdgCode(), particleMother.pt(), yGen, particleMother.phi()); + outputPartsMCLabels(outputPartsMC.lastIndex()); + } + } + } + } + } + template void fillPhi(CollisionType const& col, TrackType const& tracks) { @@ -1633,7 +1787,7 @@ struct FemtoUniverseProducerTask { sumVec += part2Vec; float phiEta = sumVec.Eta(); - if (std::abs(phiEta) > 0.8) { + if (std::abs(phiEta) > ConfPhiSelection.confPhiEtaHighLimit.value) { continue; } @@ -1736,7 +1890,9 @@ struct FemtoUniverseProducerTask { std::vector tmpPDGCodes = ConfGeneral.confMCTruthPDGCodes; // necessary due to some features of the Configurable for (auto const& pdg : tmpPDGCodes) { if (static_cast(pdg) == static_cast(pdgCode)) { - if (pdgCode == 333) { // && (recoMcIds && recoMcIds->get().contains(particle.globalIndex()))) { // ATTENTION: all Phi mesons are NOT primary particles + if (pdgCode == Pdg::kPhi) { // && (recoMcIds && recoMcIds->get().contains(particle.globalIndex()))) { // ATTENTION: all Phi mesons are NOT primary particles + pass = true; + } else if (pdgCode == Pdg::kD0) { pass = true; } else { if (confStoreMCmothers || particle.isPhysicalPrimary() || (ConfGeneral.confActivateSecondaries && recoMcIds && recoMcIds->get().contains(particle.globalIndex()))) @@ -1840,19 +1996,18 @@ struct FemtoUniverseProducerTask { } } - template - void fillMCTruthParticlesD0(TrackType const& tracks, std::optional>> recoMcIds = std::nullopt) + template + void fillMCTruthParticlesD0(TrackType const& mcParts, std::optional>> recoMcIds = std::nullopt) { std::vector childIDs = {0, 0}; // these IDs are necessary to keep track of the children std::vector tmpIDtrack; + float ptGenB = -1; - for (const auto& particle : tracks) { - /// if the most open selection criteria are not fulfilled there is no - /// point looking further at the track + for (const auto& particle : mcParts) { if (particle.eta() < -ConfFilterCuts.confEtaFilterCut || particle.eta() > ConfFilterCuts.confEtaFilterCut) continue; - if (particle.pt() < ConfFilterCuts.confPtLowFilterCut || particle.pt() > ConfFilterCuts.confPtHighFilterCut) + if (particle.pt() < ConfD0Selection.trackD0pTGenMin || particle.pt() > ConfD0Selection.trackD0pTGenMax) continue; uint32_t pdgCode = static_cast(particle.pdgCode()); @@ -1862,9 +2017,9 @@ struct FemtoUniverseProducerTask { std::vector tmpPDGCodes = ConfGeneral.confMCTruthPDGCodes; // necessary due to some features of the Configurable for (auto const& pdg : tmpPDGCodes) { if (static_cast(pdg) == static_cast(pdgCode)) { - if (pdgCode == 333) { // && (recoMcIds && recoMcIds->get().contains(particle.globalIndex()))) { // ATTENTION: all Phi mesons are NOT primary particles + if (pdgCode == Pdg::kPhi) { pass = true; - } else if (pdgCode == 421) { + } else if (pdgCode == Pdg::kD0) { pass = true; } else { if (particle.isPhysicalPrimary() || (ConfGeneral.confActivateSecondaries && recoMcIds && recoMcIds->get().contains(particle.globalIndex()))) @@ -1876,38 +2031,26 @@ struct FemtoUniverseProducerTask { continue; } - // now the table is filled - if constexpr (resolveDaughs) { - tmpIDtrack.push_back(particle.globalIndex()); - continue; - } - if (ConfGeneral.confIsActiveD0) { - - auto mcD0origin = aod::femtouniverseparticle::ParticleType::kMCTruthTrack; - float ptGenB = -1; + if (pdgCode == Pdg::kD0) { if (std::abs(particle.flagMcMatchGen()) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { if (ConfD0Selection.yD0D0barCandGenMax >= 0. && std::abs(RecoDecay::y(particle.pVector(), o2::constants::physics::MassD0)) > ConfD0Selection.yD0D0barCandGenMax) { continue; } - mcD0origin = aod::femtouniverseparticle::ParticleType::kMCTruthTrack; - // WORK IN PROGRESS: If needed changed it to prompt and non-prompt - /*if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { - mcD0origin = aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kPrompt; + if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { ptGenB = -1; } else { - mcD0origin = aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kNonPrompt; - ptGenB = particle.idxBhadMotherPart().pt(); - }*/ + ptGenB = mcParts.rawIteratorAt(particle.idxBhadMotherPart()).pt(); + } outputParts(outputCollision.lastIndex(), particle.pt(), particle.eta(), particle.phi(), - mcD0origin, - 0, - pdgCode, + aod::femtouniverseparticle::ParticleType::kMCTruthTrack, + -999., pdgCode, + pdgCode, // getter tempFitVar childIDs, - RecoDecay::y(particle.pVector(), o2::constants::physics::MassD0), + particle.flagMcMatchGen(), ptGenB); // pT of the B hadron (mother particle, only when non-prompt D0) } } else { @@ -1916,10 +2059,12 @@ struct FemtoUniverseProducerTask { particle.eta(), particle.phi(), aod::femtouniverseparticle::ParticleType::kMCTruthTrack, - 0, + -999., pdgCode, pdgCode, - childIDs, 0, 0); + childIDs, + -999., + -999.); } if (confIsDebug) { fillDebugParticle(particle); @@ -1932,43 +2077,6 @@ struct FemtoUniverseProducerTask { outputDebugPartsMC(9999); } } - if constexpr (resolveDaughs) { - childIDs[0] = 0; - childIDs[1] = 0; - for (std::size_t i = 0; i < tmpIDtrack.size(); i++) { - const auto& particle = tracks.iteratorAt(tmpIDtrack[i] - tracks.begin().globalIndex()); - for (int daughIndex = 0, n = std::min(2ul, particle.daughtersIds().size()); daughIndex < n; daughIndex++) { - // loop to find the corresponding index of the daughters - for (std::size_t j = 0; j < tmpIDtrack.size(); j++) { - if (tmpIDtrack[j] == particle.daughtersIds()[daughIndex]) { - childIDs[daughIndex] = i - j; - break; - } - } - } - outputParts(outputCollision.lastIndex(), - particle.pt(), - particle.eta(), - particle.phi(), - aod::femtouniverseparticle::ParticleType::kMCTruthTrack, - 0, - static_cast(particle.pdgCode()), - particle.pdgCode(), - childIDs, - 0, - 0); - if (confIsDebug) { - fillDebugParticle(particle); - } - - // Workaround to keep the FDParticles and MC label tables - // aligned, so that they can be joined in the task. - if constexpr (transientLabels) { - outputPartsMCLabels(-1); - outputDebugPartsMC(9999); - } - } - } } template (col, tracks); if (colcheck) { fillTracks(tracks); - fillD0mesons(col, tracks, candidates); + fillD0D0barData(col, tracks, candidates); } } PROCESS_SWITCH(FemtoUniverseProducerTask, processTrackD0mesonData, @@ -2191,7 +2299,7 @@ struct FemtoUniverseProducerTask { const auto colcheck = fillCollisions(col, tracks); if (colcheck) { fillTracks(tracks); - fillD0D0barUsingML(col, tracks, candidates); + fillD0D0barDataMl(col, tracks, candidates); } } PROCESS_SWITCH(FemtoUniverseProducerTask, processTrackD0DataML, @@ -2415,14 +2523,15 @@ struct FemtoUniverseProducerTask { } PROCESS_SWITCH(FemtoUniverseProducerTask, processTruthAndFullMCCentRun3Casc, "Provide both MC truth and reco for tracks and cascades with centrality", false); + Preslice> mcPartPerMcColl = aod::mcparticle::mcCollisionId; Preslice> perCollisionD0s = aod::track::collisionId; void processTrackD0MC(aod::McCollisions const& mccols, - aod::TracksWMc const&, soa::Join const& collisions, soa::Filtered> const& tracks, soa::Join const& hfMcGenCands, soa::Join const& hfMcRecoCands, - aod::BCsWithTimestamps const&) + aod::BCsWithTimestamps const&, + aod::McParticles const& mcParts) { // MC Reco std::set recoMcIds; @@ -2434,8 +2543,8 @@ struct FemtoUniverseProducerTask { // fill the tables const auto colcheck = fillCollisions(col, tracks); if (colcheck) { - fillTracks(tracks); - fillD0D0barUsingML(col, groupedTracks, groupedD0s); + fillTracks(groupedTracks); + fillD0D0barMcMl(col, groupedTracks, groupedD0s, mcParts); for (const auto& track : groupedTracks) { if (trackCuts.isSelectedMinimal(track)) recoMcIds.insert(track.mcParticleId()); @@ -2444,10 +2553,10 @@ struct FemtoUniverseProducerTask { } // MC Truth for (const auto& mccol : mccols) { - auto groupedMCParticles = hfMcGenCands.sliceBy(perMCCollision, mccol.globalIndex()); + auto groupedMCParticles = hfMcGenCands.sliceBy(mcPartPerMcColl, mccol.globalIndex()); auto groupedCollisions = collisions.sliceBy(recoCollsPerMCColl, mccol.globalIndex()); - fillMCTruthCollisions(groupedCollisions, groupedMCParticles); // fills the reco collisions for mc collision - fillMCTruthParticlesD0(groupedMCParticles, recoMcIds); // fills mc particles + fillMCTruthCollisions(groupedCollisions, groupedMCParticles); // fills the reco collisions for mc collision + fillMCTruthParticlesD0(groupedMCParticles, recoMcIds); // fills mc particles } } PROCESS_SWITCH(FemtoUniverseProducerTask, processTrackD0MC, "Provide MC data for track D0 analysis", false); diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniverseEfficiencyBase.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniverseEfficiencyBase.cxx index cc0ab0077c8..d974dd0f408 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniverseEfficiencyBase.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniverseEfficiencyBase.cxx @@ -70,6 +70,7 @@ struct FemtoUniverseEfficiencyBase { /// Kaon configurable Configurable isKaonRun2{"isKaonRun2", false, "Enable kaon selection used in Run2"}; // to check consistency with Run2 results + Configurable isKaonLF{"isKaonLF", false, "Enable kaon selection used in LF group"}; // select kaons according to the selection in LF group struct : o2::framework::ConfigurableGroup { // Momentum thresholds for Run2 and Run3 Configurable confMomKaonRun2{"confMomKaonRun2", 0.4, "Momentum threshold for kaon identification using ToF (Run2)"}; @@ -93,6 +94,10 @@ struct FemtoUniverseEfficiencyBase { Configurable confKaonNsigmaTOFfrom055to15{"confKaonNsigmaTOFfrom055to15", 3.0, "Reject kaons within pT from 0.55 to 1.5 if ToF n sigma is above this value."}; Configurable confKaonNsigmaTPCfrom15{"confKaonNsigmaTPCfrom15", 3.0, "Reject kaons with pT above 1.5 if TPC n sigma is above this value."}; Configurable confKaonNsigmaTOFfrom15{"confKaonNsigmaTOFfrom15", 2.0, "Reject kaons with pT above 1.5 if ToF n sigma is above this value.."}; + // n sigma cuts as in LF + Configurable confMomKaonLF{"confMomKaonLF", 0.5, "Momentum threshold for kaon identification using TOF (LF selection)"}; + Configurable confNSigmaTPCKaonLF{"confNSigmaTPCKaonLF", 3.0, "TPC Kaon Sigma as in LF"}; + Configurable confNSigmaCombKaonLF{"confNSigmaCombKaonLF", 3.0, "TPC and TOF Kaon Sigma (combined) as in LF"}; } ConfKaonSelection; /// Deuteron configurables @@ -259,6 +264,25 @@ struct FemtoUniverseEfficiencyBase { } } + bool isKaonNSigmaLF(float mom, float nsigmaTPCK, float nsigmaTOFK) + { + if (mom < ConfKaonSelection.confMomKaonLF) { + if (std::abs(nsigmaTPCK) < ConfKaonSelection.confNSigmaTPCKaonLF) { + return true; + } else { + return false; + } + } else if (mom >= ConfKaonSelection.confMomKaonLF) { + if (std::sqrt(nsigmaTPCK * nsigmaTPCK + nsigmaTOFK * nsigmaTOFK) < ConfKaonSelection.confNSigmaCombKaonLF) { + return true; + } else { + return false; + } + } else { + return false; + } + } + bool isPionNSigma(float mom, float nsigmaTPCPi, float nsigmaTOFPi) { if (mom < ConfBothTracks.confMomPion) { @@ -303,7 +327,11 @@ struct FemtoUniverseEfficiencyBase { break; case 321: // Kaon+ case -321: // Kaon- - return isKaonNSigma(mom, nsigmaTPCK, nsigmaTOFK); + if (isKaonLF) { + return isKaonNSigmaLF(mom, nsigmaTPCK, nsigmaTOFK); + } else { + return isKaonNSigma(mom, nsigmaTPCK, nsigmaTOFK); + } break; case 1000010020: // Deuteron case -1000010020: // Antideuteron diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx index 3e68a275452..9075414cab1 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx @@ -17,38 +17,37 @@ /// \author Zuzanna Chochulska, WUT Warsaw & CTU Prague, zchochul@cern.ch /// \author Katarzyna Gwiździel, WUT Warsaw, katarzyna.gwizdziel@cern.ch -#include -#include - -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/StepTHn.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "ReconstructionDataFormats/PID.h" - -#include "Common/DataModel/PIDResponse.h" -#include "Common/Core/RecoDecay.h" - -#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseContainer.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseEfficiencyCalculator.h" #include "PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h" #include "PWGCF/FemtoUniverse/Core/FemtoUniversePairCleaner.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseFemtoContainer.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseAngularContainer.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h" -#include "PWGCF/FemtoUniverse/Core/femtoUtils.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h" #include "PWGCF/FemtoUniverse/Core/FemtoUniverseSoftPionRemoval.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseEfficiencyCalculator.h" - +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h" +#include "PWGCF/FemtoUniverse/Core/femtoUtils.h" +#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" +#include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/PIDResponse.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/PID.h" + +#include +#include + using namespace o2; using namespace o2::analysis; using namespace o2::analysis::femto_universe; @@ -84,15 +83,17 @@ struct FemtoUniversePairTaskTrackD0 { SliceCache cache; Preslice perCol = aod::femtouniverseparticle::fdCollisionId; - using FemtoMCParticles = soa::Join; - Preslice perColMC = aod::femtouniverseparticle::fdCollisionId; + using FemtoMcRecoParticles = soa::Join; + Preslice perColMc = aod::femtouniverseparticle::fdCollisionId; /// Table for both particles struct : o2::framework::ConfigurableGroup { - Configurable confNsigmaCombinedProton{"confNsigmaCombinedProton", 3.0, "TPC and TOF Proton Sigma (combined) for momentum > 0.5"}; - Configurable confNsigmaTPCProton{"confNsigmaTPCProton", 3.0, "TPC Proton Sigma for momentum < 0.5"}; - Configurable confNsigmaCombinedPion{"confNsigmaCombinedPion", 3.0, "TPC and TOF Pion Sigma (combined) for momentum > 0.5"}; - Configurable confNsigmaTPCPion{"confNsigmaTPCPion", 3.0, "TPC Pion Sigma for momentum < 0.5"}; + Configurable confNsigmaCombinedProton{"confNsigmaCombinedProton", 3.0, "TPC and TOF Proton Sigma (combined)"}; + Configurable confNsigmaTPCProton{"confNsigmaTPCProton", 3.0, "TPC Proton Sigma"}; + Configurable confNsigmaCombinedPion{"confNsigmaCombinedPion", 3.0, "TPC and TOF Pion Sigma (combined)"}; + Configurable confNsigmaTPCPion{"confNsigmaTPCPion", 3.0, "TPC Pion Sigma"}; + Configurable confNsigmaCombinedKaon{"confNsigmaCombinedKaon", 3.0, "TPC and TOF Kaon Sigma (combined)"}; + Configurable confNsigmaTPCKaon{"confNsigmaTPCKaon", 3.0, "TPC Kaon Sigma"}; Configurable confIsMC{"confIsMC", false, "Enable additional Histogramms in the case of a MonteCarlo Run"}; Configurable> confTrkPIDnSigmaMax{"confTrkPIDnSigmaMax", std::vector{4.f, 3.f, 2.f}, "This configurable needs to be the same as the one used in the producer task"}; @@ -110,8 +111,9 @@ struct FemtoUniversePairTaskTrackD0 { Configurable confIsTrackIdentified{"confIsTrackIdentified", true, "Enable PID for the track"}; Configurable confTrackLowPtCut{"confTrackLowPtCut", 0.5, "Low pT cut of the track"}; Configurable confTrackHighPtCut{"confTrackHighPtCut", 2.5, "High pT cut of the track"}; - Configurable protonMinPtPidTpcTof{"protonMinPtPidTpcTof", 0.5, "Momentum threshold for change of the PID method (from using TPC to TPC and TOF)."}; - Configurable pionMinPtPidTpcTof{"pionMinPtPidTpcTof", 0.5, "Momentum threshold for change of the PID method (from using TPC to TPC and TOF)."}; + Configurable minPtPidTpcTofProton{"minPtPidTpcTofProton", 0.5, "Momentum threshold for change of the PID method (from using TPC to TPC and TOF)."}; + Configurable minPtPidTpcTofPion{"minPtPidTpcTofPion", 0.5, "Momentum threshold for change of the PID method (from using TPC to TPC and TOF)."}; + Configurable minPtPidTpcTofKaonLF{"minPtPidTpcTofKaonLF", 0.5, "Momentum threshold for change of the PID method (from using TPC to TPC and TOF)."}; } ConfTrack; /// Particle 2 --- D0/D0bar meson @@ -120,6 +122,8 @@ struct FemtoUniversePairTaskTrackD0 { Configurable confPDGCodeD0bar{"confPDGCodeD0bar", -421, "D0bar meson - PDG code"}; Configurable confMinPtD0D0bar{"confMinPtD0D0bar", 1.0, "D0/D0bar sel. - min. pT"}; Configurable confMaxPtD0D0bar{"confMaxPtD0D0bar", 3.0, "D0/D0bar sel. - max. pT"}; + Configurable confMinPtD0D0barReco{"confMinPtD0D0barReco", 0.5, "MC Reco - D0/D0bar sel. - min. pT"}; + Configurable confMaxPtD0D0barReco{"confMaxPtD0D0barReco", 24.0, "MC Reco - D0/D0bar sel. - max. pT"}; Configurable minInvMassD0D0barSignal{"minInvMassD0D0barSignal", 1.81, "Min. inv. mass of D0/D0bar for signal region"}; Configurable maxInvMassD0D0barSignal{"maxInvMassD0D0barSignal", 1.922, "Max. inv. mass of D0/D0bar for signal region"}; Configurable minInvMassD0D0barLeftSB{"minInvMassD0D0barLeftSB", 1.65, "Min. inv. mass of D0/D0bar for left SB region"}; @@ -148,34 +152,35 @@ struct FemtoUniversePairTaskTrackD0 { /// Partitions for particle 1 Partition partsTrack = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == int8_t(ConfTrack.confTrackSign)) && (aod::femtouniverseparticle::pt > ConfTrack.confTrackLowPtCut) && (aod::femtouniverseparticle::pt < ConfTrack.confTrackHighPtCut); - Partition partsTrackMCReco = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == int8_t(ConfTrack.confTrackSign)) && (aod::femtouniverseparticle::pt > ConfTrack.confTrackLowPtCut) && (aod::femtouniverseparticle::pt < ConfTrack.confTrackHighPtCut); - Partition partsTrackMCTruth = (aod::femtouniverseparticle::partType == static_cast(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && (aod::femtouniverseparticle::pidCut == static_cast(ConfTrack.confPDGCodeTrack)) && (aod::femtouniverseparticle::pt > ConfTrack.confTrackLowPtCut) && (aod::femtouniverseparticle::pt < ConfTrack.confTrackHighPtCut); + Partition partsTrackMCReco = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == int8_t(ConfTrack.confTrackSign)) && (aod::femtouniverseparticle::pt > ConfTrack.confTrackLowPtCut) && (aod::femtouniverseparticle::pt < ConfTrack.confTrackHighPtCut); + Partition partsTrackMCTruth = (aod::femtouniverseparticle::partType == static_cast(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && (aod::femtouniverseparticle::pidCut == static_cast(ConfTrack.confPDGCodeTrack)) && (aod::femtouniverseparticle::pt > ConfTrack.confTrackLowPtCut) && (aod::femtouniverseparticle::pt < ConfTrack.confTrackHighPtCut); /// Partitions for particle 2 - /// Partition with all D0/D0bar mesons (which pass double mass hypothesis) - Partition partsAllDmesons = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && ((aod::femtouniverseparticle::mLambda > 0.0f) || (aod::femtouniverseparticle::mAntiLambda > 0.0f)); + /// Partition with all D0/D0bar mesons (which pass one and double mass hypothesis) + Partition partsAllDmesons = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && ((aod::femtouniverseparticle::mLambda > 0.0f) || (aod::femtouniverseparticle::mAntiLambda > 0.0f)) && (aod::femtouniverseparticle::decayVtxX < ConfMlOpt.confMaxProbMlClass1Bg) && (aod::femtouniverseparticle::decayVtxY > ConfMlOpt.confMinProbMlClass2Prompt); /// Partition with D0/D0bar candidates, which pass only one mass hypothesis - Partition partsOnlyD0D0bar = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda < 0.0f || aod::femtouniverseparticle::mAntiLambda < 0.0f) && (aod::femtouniverseparticle::tempFitVar < ConfMlOpt.confMaxProbMlClass1Bg) && (aod::femtouniverseparticle::decayVtxY > ConfMlOpt.confMinProbMlClass2Prompt); + Partition partsOnlyD0D0bar = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda < 0.0f || aod::femtouniverseparticle::mAntiLambda < 0.0f) && (aod::femtouniverseparticle::decayVtxX < ConfMlOpt.confMaxProbMlClass1Bg) && (aod::femtouniverseparticle::decayVtxY > ConfMlOpt.confMinProbMlClass2Prompt); /// Partition with D0 mesons only (one and double mass hypothesis) Partition partsAllD0s = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda > ConfDmesons.minInvMassD0D0barSignal) && (aod::femtouniverseparticle::mLambda < ConfDmesons.maxInvMassD0D0barSignal) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar); /// Partition with D0 mesons only (one mass hypothesis) - Partition partsD0s = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda > ConfDmesons.minInvMassD0D0barSignal) && (aod::femtouniverseparticle::mLambda < ConfDmesons.maxInvMassD0D0barSignal) && (aod::femtouniverseparticle::mAntiLambda < 0.0f) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar) && (aod::femtouniverseparticle::tempFitVar < ConfMlOpt.confMaxProbMlClass1Bg) && (aod::femtouniverseparticle::decayVtxY > ConfMlOpt.confMinProbMlClass2Prompt); + Partition partsD0s = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda > ConfDmesons.minInvMassD0D0barSignal) && (aod::femtouniverseparticle::mLambda < ConfDmesons.maxInvMassD0D0barSignal) && (aod::femtouniverseparticle::mAntiLambda < 0.0f) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar) && (aod::femtouniverseparticle::decayVtxX < ConfMlOpt.confMaxProbMlClass1Bg) && (aod::femtouniverseparticle::decayVtxY > ConfMlOpt.confMinProbMlClass2Prompt); /// Partition with D0s selected from the side-band (SB) regions (candidates with double mass hypothesis included) Partition partsD0sFromSB = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && ((aod::femtouniverseparticle::mLambda > ConfDmesons.minInvMassD0D0barLeftSB && aod::femtouniverseparticle::mLambda < ConfDmesons.maxInvMassD0D0barLeftSB) || (aod::femtouniverseparticle::mLambda > ConfDmesons.minInvMassD0D0barRightSB && aod::femtouniverseparticle::mLambda < ConfDmesons.maxInvMassD0D0barRightSB)) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar); /// Partition with D0bar mesons only (one and double mass hypothesis) Partition partsAllD0bars = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mAntiLambda > ConfDmesons.minInvMassD0D0barSignal) && (aod::femtouniverseparticle::mAntiLambda < ConfDmesons.maxInvMassD0D0barSignal) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar); /// Partition with D0bar mesons only (one mass hypothesis) - Partition partsD0bars = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda < 0.0f) && (aod::femtouniverseparticle::mAntiLambda > ConfDmesons.minInvMassD0D0barSignal) && (aod::femtouniverseparticle::mAntiLambda < ConfDmesons.maxInvMassD0D0barSignal) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar) && (aod::femtouniverseparticle::tempFitVar < ConfMlOpt.confMaxProbMlClass1Bg) && (aod::femtouniverseparticle::decayVtxY > ConfMlOpt.confMinProbMlClass2Prompt); + Partition partsD0bars = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda < 0.0f) && (aod::femtouniverseparticle::mAntiLambda > ConfDmesons.minInvMassD0D0barSignal) && (aod::femtouniverseparticle::mAntiLambda < ConfDmesons.maxInvMassD0D0barSignal) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar) && (aod::femtouniverseparticle::decayVtxX < ConfMlOpt.confMaxProbMlClass1Bg) && (aod::femtouniverseparticle::decayVtxY > ConfMlOpt.confMinProbMlClass2Prompt); /// Partition with D0bars selected from the side-band (SB) regions (candidates with double mass hypothesis included) Partition partsD0barsFromSB = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && ((aod::femtouniverseparticle::mAntiLambda > ConfDmesons.minInvMassD0D0barLeftSB && aod::femtouniverseparticle::mAntiLambda < ConfDmesons.maxInvMassD0D0barLeftSB) || (aod::femtouniverseparticle::mAntiLambda > ConfDmesons.minInvMassD0D0barRightSB && aod::femtouniverseparticle::mAntiLambda < ConfDmesons.maxInvMassD0D0barRightSB)) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar); /// Partition for D0/D0bar mesons from MC - Partition partsD0D0barMCReco = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda < 0.0f || aod::femtouniverseparticle::mAntiLambda < 0.0f) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar) && (aod::femtouniverseparticle::tempFitVar < ConfMlOpt.confMaxProbMlClass1Bg) && (aod::femtouniverseparticle::decayVtxY > ConfMlOpt.confMinProbMlClass2Prompt); - Partition partsD0D0barMCTruth = (aod::femtouniverseparticle::partType == static_cast(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && (aod::femtouniverseparticle::pidCut == static_cast(ConfDmesons.confPDGCodeD0) || aod::femtouniverseparticle::pidCut == static_cast(ConfDmesons.confPDGCodeD0bar)) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar); + Partition partsD0D0barMCReco = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda < 0.0f || aod::femtouniverseparticle::mAntiLambda < 0.0f) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar) && (aod::femtouniverseparticle::decayVtxX < ConfMlOpt.confMaxProbMlClass1Bg) && (aod::femtouniverseparticle::decayVtxY > ConfMlOpt.confMinProbMlClass2Prompt); + Partition partsD0D0barMCTruth = (aod::femtouniverseparticle::partType == static_cast(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && (aod::femtouniverseparticle::pidCut == static_cast(ConfDmesons.confPDGCodeD0) || aod::femtouniverseparticle::pidCut == static_cast(ConfDmesons.confPDGCodeD0bar)) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar); /// Partition for D0/D0bar daughters Partition partsDmesonsChildren = aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0Child); /// Histogramming for particle 1 - FemtoUniverseParticleHisto trackHistoPartTrack; + FemtoUniverseParticleHisto trackHistoPartTrack; + FemtoUniverseParticleHisto hTrackDCA; /// Histogramming for particle 2 FemtoUniverseParticleHisto trackHistoPartD0D0bar; @@ -191,6 +196,7 @@ struct FemtoUniversePairTaskTrackD0 { ConfigurableAxis confTempFitVarBins{"confTempFitVarBins", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot"}; ConfigurableAxis confTempFitVarInvMassBins{"confTempFitVarInvMassBins", {6000, 0.9, 4.0}, "binning of the TempFitVar in the pT vs. TempFitVar plot"}; ConfigurableAxis confTempFitVarpTBins{"confTempFitVarpTBins", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot"}; + ConfigurableAxis confTempFitVarDCABins{"confTempFitVarDCABins", {500, -1.0, 1.0}, "binning of the DCA histograms"}; /// Correlation part ConfigurableAxis confMultBins{"confMultBins", {VARIABLE_WIDTH, 0.0f, 4.0f, 8.0f, 12.0f, 16.0f, 20.0f, 24.0f, 28.0f, 32.0f, 36.0f, 40.0f, 44.0f, 48.0f, 52.0f, 56.0f, 60.0f, 64.0f, 68.0f, 72.0f, 76.0f, 80.0f, 84.0f, 88.0f, 92.0f, 96.0f, 100.0f, 200.0f, 99999.f}, "Mixing bins - multiplicity"}; // \todo to be obtained from the hash task @@ -223,8 +229,8 @@ struct FemtoUniversePairTaskTrackD0 { // Event mixing configurables Configurable confNEventsMix{"confNEventsMix", 5, "Number of events for mixing"}; - FemtoUniverseAngularContainer sameEventAngularCont; - FemtoUniverseAngularContainer mixedEventAngularCont; + FemtoUniverseContainer sameEventAngularCont; + FemtoUniverseContainer mixedEventAngularCont; FemtoUniversePairCleaner pairCleaner; FemtoUniverseDetaDphiStar pairCloseRejection; FemtoUniverseSoftPionRemoval softPionRemoval; @@ -237,8 +243,9 @@ struct FemtoUniversePairTaskTrackD0 { HistogramRegistry qaRegistry{"TrackQA", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry resultRegistry{"Correlations", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry mixQaRegistry{"mixQaRegistry", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry mcRecoRegistry{"mcRecoRegistry", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; - HistogramRegistry mcTruthRegistry{"mcTruthRegistry", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; + HistogramRegistry mcRecoRegistry{"McRecoHistos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; + HistogramRegistry mcTruthRegistry{"McGenHistos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; + HistogramRegistry registryDCA{"registryDCA", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; // Efficiency EfficiencyConfigurableGroup effConfGroup; @@ -246,16 +253,13 @@ struct FemtoUniversePairTaskTrackD0 { float weight = 1.0; HistogramRegistry registry{"registry", - {{"hInvMassD0", ";#it{M}(K^{-}#pi^{+}) (GeV/#it{c}^{2});counts", {HistType::kTH1F, {confInvMassBins}}}, - {"hInvMassD0bar", ";#it{M}(#pi^{-}K^{+}) (GeV/#it{c}^{2});counts", {HistType::kTH1F, {confInvMassBins}}}, - {"hPtDmesonCand", "2-prong candidates;#it{p}_{T} (GeV/#it{c});counts", {HistType::kTH1F, {confPtBins}}}, - {"hPtD0", "D^{0} cand.;#it{p}_{T} (GeV/#it{c});counts", {HistType::kTH1F, {confPtBins}}}, + {{"hPtD0", "D^{0} cand.;#it{p}_{T} (GeV/#it{c});counts", {HistType::kTH1F, {confPtBins}}}, {"hPtD0bar", "#bar{D^{0}};#it{p}_{T} (GeV/#it{c});counts", {HistType::kTH1F, {confPtBins}}}, {"hPtD0D0bar", "#bar{D^{0}};#it{p}_{T} (GeV/#it{c});counts", {HistType::kTH1F, {confPtBins}}}, - {"hPhiDmesonCand", ";#varphi (rad);counts", {HistType::kTH1F, {{80, 0., o2::constants::math::TwoPI}}}}, + {"hPhiD0D0bar", ";#varphi (rad);counts", {HistType::kTH1F, {{80, 0., o2::constants::math::TwoPI}}}}, {"hPhiD0", ";#varphi (rad);counts", {HistType::kTH1F, {{80, 0., o2::constants::math::TwoPI}}}}, {"hPhiD0bar", ";#varphi (rad);counts", {HistType::kTH1F, {{80, 0., o2::constants::math::TwoPI}}}}, - {"hEtaDmesonCand", ";#eta ;counts", {HistType::kTH1F, {{200, -1., 1.}}}}, + {"hEtaD0D0bar", ";#eta ;counts", {HistType::kTH1F, {{200, -1., 1.}}}}, {"hEtaD0", ";#eta ;counts", {HistType::kTH1F, {{200, -1., 1.}}}}, {"hEtaD0bar", ";#eta ;counts", {HistType::kTH1F, {{200, -1., 1.}}}}, {"hDecayLengthD0", ";decay length (cm);counts", {HistType::kTH1F, {{800, 0., 4.}}}}, @@ -268,13 +272,13 @@ struct FemtoUniversePairTaskTrackD0 { // PID for protons bool isProtonNSigma(float mom, float nsigmaTPCPr, float nsigmaTOFPr) // previous version from: https://github.com/alisw/AliPhysics/blob/master/PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoMJTrackCut.cxx { - if (mom < ConfTrack.protonMinPtPidTpcTof) { + if (mom < ConfTrack.minPtPidTpcTofProton) { if (std::abs(nsigmaTPCPr) < ConfBothTracks.confNsigmaTPCProton) { return true; } else { return false; } - } else if (mom > ConfTrack.protonMinPtPidTpcTof) { + } else if (mom > ConfTrack.minPtPidTpcTofProton) { if (std::hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfBothTracks.confNsigmaCombinedProton) { return true; } else { @@ -284,36 +288,16 @@ struct FemtoUniversePairTaskTrackD0 { return false; } - bool isKaonNSigma(float mom, float nsigmaTPCK, float nsigmaTOFK) + bool isKaonNSigmaLF(float mom, float nsigmaTPCK, float nsigmaTOFK) { - if (mom < 0.3) { // 0.0-0.3 - if (std::abs(nsigmaTPCK) < 3.0) { - return true; - } else { - return false; - } - } else if (mom < 0.45) { // 0.30 - 0.45 - if (std::abs(nsigmaTPCK) < 2.0) { + if (mom < ConfTrack.minPtPidTpcTofKaonLF) { + if (std::abs(nsigmaTPCK) < ConfBothTracks.confNsigmaTPCKaon) { return true; } else { return false; } - } else if (mom < 0.55) { // 0.45-0.55 - if (std::abs(nsigmaTPCK) < 1.0) { - return true; - } else { - return false; - } - } else if (mom < 1.5) { // 0.55-1.5 (now we use TPC and TOF) - if ((std::abs(nsigmaTOFK) < 3.0) && (std::abs(nsigmaTPCK) < 3.0)) { - { - return true; - } - } else { - return false; - } - } else if (mom > 1.5) { - if ((std::abs(nsigmaTOFK) < 2.0) && (std::abs(nsigmaTPCK) < 3.0)) { + } else if (mom >= ConfTrack.minPtPidTpcTofKaonLF) { + if (std::sqrt(nsigmaTPCK * nsigmaTPCK + nsigmaTOFK * nsigmaTOFK) < ConfBothTracks.confNsigmaCombinedKaon) { return true; } else { return false; @@ -326,16 +310,16 @@ struct FemtoUniversePairTaskTrackD0 { bool isPionNSigma(float mom, float nsigmaTPCPi, float nsigmaTOFPi) { // using configurables: - // confNsigmaTPCPion -> TPC Pion Sigma for momentum < 0.5 GeV/c - // confNsigmaCombinedPion -> TPC and TOF Pion Sigma (combined) for momentum > 0.5 GeV/c + // confNsigmaTPCPion -> TPC Pion Sigma for a given momentum + // confNsigmaCombinedPion -> TPC and TOF Pion Sigma (combined) for a given momentum if (true) { - if (mom < ConfTrack.pionMinPtPidTpcTof) { + if (mom < ConfTrack.minPtPidTpcTofPion) { if (std::abs(nsigmaTPCPi) < ConfBothTracks.confNsigmaTPCPion) { return true; } else { return false; } - } else if (mom > ConfTrack.pionMinPtPidTpcTof) { + } else if (mom > ConfTrack.minPtPidTpcTofPion) { if (std::hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfBothTracks.confNsigmaCombinedPion) { return true; } else { @@ -359,7 +343,7 @@ struct FemtoUniversePairTaskTrackD0 { break; case 321: // Kaon+ case -321: // Kaon- - return isKaonNSigma(mom, nsigmaTPCK, nsigmaTOFK); + return isKaonNSigmaLF(mom, nsigmaTPCK, nsigmaTOFK); break; default: return false; @@ -368,12 +352,8 @@ struct FemtoUniversePairTaskTrackD0 { void init(InitContext&) { - // if (effConfGroup.confEfficiencyDoMCTruth) { - // WORK IN PROGRESS - // hMCTruth1.init(&qaRegistry, confBinsTempFitVarpT, confBinsTempFitVarPDG, false, ConfTrack.confTrackPDGCode, false); - // hMCTruth2.init(&qaRegistry, confBinsTempFitVarpT, confBinsTempFitVarPDG, false, 333, false); - // } efficiencyCalculator.init(); + hTrackDCA.init(®istryDCA, confTempFitVarpTBins, confTempFitVarDCABins, true, ConfTrack.confPDGCodeTrack, true); eventHisto.init(&qaRegistry); qaRegistry.add("QA_D0D0barSelection/hInvMassD0", ";#it{M}(K^{-}#pi^{+}) (GeV/#it{c}^{2});counts", kTH1F, {confInvMassBins}); @@ -418,22 +398,94 @@ struct FemtoUniversePairTaskTrackD0 { qaRegistry.add("Hadron/nSigmaTPCKa", "; #it{p} (GeV/#it{c}); n#sigma_{TPCKa}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); qaRegistry.add("Hadron/nSigmaTOFKa", "; #it{p} (GeV/#it{c}); n#sigma_{TOFKa}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); + // D0/D0bar histograms + auto vbins = (std::vector)binsPt; + if (doEfficiencyCorr) { + registry.add("D0D0bar_oneMassHypo/hMassVsPtEffCorr", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_oneMassHypo/hMassVsPtD0EffCorr", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_oneMassHypo/hMassVsPtD0barEffCorr", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_doubleMassHypo/hMassVsPtEffCorr", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_doubleMassHypo/hMassVsPtD0EffCorr", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_doubleMassHypo/hMassVsPtD0barEffCorr", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + } else { + registry.add("D0D0bar_oneMassHypo/hMassVsPt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_oneMassHypo/hMassVsPtD0", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_oneMassHypo/hMassVsPtD0bar", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_doubleMassHypo/hMassVsPt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_doubleMassHypo/hMassVsPtD0", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_doubleMassHypo/hMassVsPtD0bar", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + } + // Histograms for BDT score classes' check + registry.add("DebugBdt/hBdtScore1VsStatus", ";BDT score;status", {HistType::kTH2F, {axisBdtScore, axisSelStatus}}); + registry.add("DebugBdt/hBdtScore2VsStatus", ";BDT score;status", {HistType::kTH2F, {axisBdtScore, axisSelStatus}}); + registry.add("DebugBdt/hBdtScore3VsStatus", ";BDT score;status", {HistType::kTH2F, {axisBdtScore, axisSelStatus}}); + if (applyMLOpt) { + registry.add("D0D0bar_MLSel/hMassVsPt1", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_MLSel/hMassVsPt2", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_MLSel/hMassVsPt3", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_MLSel/hMassVsPt4", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_MLSel/hMassVsPt5", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_MLSel/hMassVsPt6", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_MLSel/hMassVsPt7", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_MLSel/hMassVsPt8", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_MLSel/hMassVsPt9", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_MLSel/hMassVsPt10", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + } + // MC Reco + mcRecoRegistry.add("hMcRecD0", "MC Reco all D0s;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecD0Prompt", "MC Reco prompt D0s;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecD0NonPrompt", "MC Reco non-prompt D0s;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecD0Phi", "MC Reco all D0s;#varphi (rad); counts", {HistType::kTH1F, {{80, 0., o2::constants::math::TwoPI}}}); + mcRecoRegistry.add("hMcRecD0bar", "MC Reco all D0bars;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecD0barPrompt", "MC Reco prompt D0bars;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecD0barNonPrompt", "MC Reco non-prompt D0bars;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecD0barPhi", "MC Reco all D0bars;#varphi (rad); counts", {HistType::kTH1F, {{80, 0., o2::constants::math::TwoPI}}}); + // Inv. mass histograms + mcRecoRegistry.add("hMassVsPtD0Sig", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + mcRecoRegistry.add("hMassVsPtD0Refl", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + mcRecoRegistry.add("hMassVsPtD0Bkg", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + mcRecoRegistry.add("hMassVsPtD0Prompt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + mcRecoRegistry.add("hMassVsPtD0NonPrompt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + mcRecoRegistry.add("hMassVsPtD0barSig", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + mcRecoRegistry.add("hMassVsPtD0barRefl", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + mcRecoRegistry.add("hMassVsPtD0barBkg", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + mcRecoRegistry.add("hMassVsPtD0barPrompt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + mcRecoRegistry.add("hMassVsPtD0barNonPrompt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + // Histograms for identified hadrons + mcRecoRegistry.add("hMcRecKpPt", "MC Reco K+;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); + mcRecoRegistry.add("hMcRecKpPtGenEtaGen", "MC Reco K+;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecKmPt", "MC Reco K-;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); + mcRecoRegistry.add("hMcRecKmPtGenEtaGen", "MC Reco K-;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecPipPt", "MC Reco #pi+;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); + mcRecoRegistry.add("hMcRecPipPtGenEtaGen", "MC Reco #pi+;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecPimPt", "MC Reco #pi-;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); + mcRecoRegistry.add("hMcRecPimPtGenEtaGen", "MC Reco #pi-;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecPrPt", "MC Reco proton;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); + mcRecoRegistry.add("hMcRecPrPtGenEtaGen", "MC Reco proton;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecAntiPrPt", "MC Reco antiproton;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); + mcRecoRegistry.add("hMcRecAntiPrPtGenEtaGen", "MC Reco antiproton;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + // MC truth - mcTruthRegistry.add("MCTruthD0D0bar", "MC Truth D0/D0bar;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{360, 0, 36}, {400, -1.0, 1.0}}}); - mcTruthRegistry.add("MCTruthAllPositivePt", "MC Truth all positive;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{360, 0, 36}}}); - mcTruthRegistry.add("MCTruthAllNegativePt", "MC Truth all negative;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{360, 0, 36}}}); - mcTruthRegistry.add("MCTruthKpPtVsEta", "MC Truth K+;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); - mcTruthRegistry.add("MCTruthKmPtVsEta", "MC Truth K-;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); - mcTruthRegistry.add("MCTruthPipPtVsEta", "MC Truth #pi+;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); - mcTruthRegistry.add("MCTruthPimPtVsEta", "MC Truth #pi-;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); - mcTruthRegistry.add("MCTruthProtonPtVsEta", "MC Truth proton;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); - mcTruthRegistry.add("MCTruthAntiProtonPtVsEta", "MC Truth antiproton;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); - mcTruthRegistry.add("MCTruthKpPt", "MC Truth K+;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); - mcTruthRegistry.add("MCTruthKmPt", "MC Truth K-;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); - mcTruthRegistry.add("MCTruthPipPt", "MC Truth #pi+;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); - mcTruthRegistry.add("MCTruthPimPt", "MC Truth #pi-;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); - mcTruthRegistry.add("MCTruthProtonPt", "MC Truth proton;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); - mcTruthRegistry.add("MCTruthAntiProtonPt", "MC Truth antiproton;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); + mcTruthRegistry.add("hMcGenD0", "MC Truth all D0s;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenD0Prompt", "MC Truth prompt D0s;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenD0NonPrompt", "MC Truth non-prompt D0s;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenD0bar", "MC Truth all D0bars;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenD0barPrompt", "MC Truth prompt D0bars;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenD0barNonPrompt", "MC Truth non-prompt D0bars;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenAllPositivePt", "MC Truth all positive;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{360, 0, 36}}}); + mcTruthRegistry.add("hMcGenAllNegativePt", "MC Truth all negative;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{360, 0, 36}}}); + mcTruthRegistry.add("hMcGenKpPtVsEta", "MC Truth K+;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenKmPtVsEta", "MC Truth K-;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenPipPtVsEta", "MC Truth #pi+;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenPimPtVsEta", "MC Truth #pi-;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenPrPtVsEta", "MC Truth proton;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenAntiPrPtVsEta", "MC Truth antiproton;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenKpPt", "MC Truth K+;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); + mcTruthRegistry.add("hMcGenKmPt", "MC Truth K-;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); + mcTruthRegistry.add("hMcGenPipPt", "MC Truth #pi+;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); + mcTruthRegistry.add("hMcGenPimPt", "MC Truth #pi-;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); + mcTruthRegistry.add("hMcGenPrPt", "MC Truth proton;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); + mcTruthRegistry.add("hMcGenAntiPrPt", "MC Truth antiproton;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); trackHistoPartD0D0bar.init(&qaRegistry, confTempFitVarpTBins, confTempFitVarInvMassBins, ConfBothTracks.confIsMC, ConfDmesons.confPDGCodeD0); if (!ConfTrack.confIsSame) { @@ -457,34 +509,6 @@ struct FemtoUniversePairTaskTrackD0 { vPIDTrack = ConfTrack.confPIDTrack.value; kNsigma = ConfBothTracks.confTrkPIDnSigmaMax.value; - - // D0/D0bar histograms - auto vbins = (std::vector)binsPt; - registry.add("D0D0bar_oneMassHypo/hMassVsPt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_oneMassHypo/hMassVsPtReflected", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_oneMassHypo/hMassVsPtD0", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_oneMassHypo/hMassVsPtD0bar", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_oneMassHypo/hMassVsPtD0Reflected", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_oneMassHypo/hMassVsPtD0barReflected", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_doubleMassHypo/hMassVsPt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_doubleMassHypo/hMassVsPtD0", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_doubleMassHypo/hMassVsPtD0bar", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - // Histograms for BDT score classes' check - registry.add("DebugBdt/hBdtScore1VsStatus", ";BDT score;status", {HistType::kTH2F, {axisBdtScore, axisSelStatus}}); - registry.add("DebugBdt/hBdtScore2VsStatus", ";BDT score;status", {HistType::kTH2F, {axisBdtScore, axisSelStatus}}); - registry.add("DebugBdt/hBdtScore3VsStatus", ";BDT score;status", {HistType::kTH2F, {axisBdtScore, axisSelStatus}}); - if (applyMLOpt) { - registry.add("D0D0bar_MLSel/hMassVsPt1", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_MLSel/hMassVsPt2", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_MLSel/hMassVsPt3", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_MLSel/hMassVsPt4", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_MLSel/hMassVsPt5", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_MLSel/hMassVsPt6", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_MLSel/hMassVsPt7", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_MLSel/hMassVsPt8", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_MLSel/hMassVsPt9", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_MLSel/hMassVsPt10", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - } } template @@ -496,7 +520,7 @@ struct FemtoUniversePairTaskTrackD0 { void processD0MLOptBg(o2::aod::FdCollision const& col, FemtoFullParticles const&) { - auto groupD0D0barCands = partsOnlyD0D0bar->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + auto groupD0D0barCands = partsAllDmesons->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); // loop over selected D0/D0bar candidates for (auto const& charmCand : groupD0D0barCands) { @@ -552,7 +576,7 @@ struct FemtoUniversePairTaskTrackD0 { void processD0MLOptBgAndPrompt(o2::aod::FdCollision const& col, FemtoFullParticles const&) { - auto groupD0D0barCands = partsOnlyD0D0bar->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + auto groupD0D0barCands = partsAllDmesons->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); // loop over selected D0/D0bar candidates for (auto const& charmCand : groupD0D0barCands) { @@ -639,143 +663,106 @@ struct FemtoUniversePairTaskTrackD0 { void processAllDmesons(o2::aod::FdCollision const& col, FemtoFullParticles const&) { auto groupPartsAllD0D0barCands = partsAllDmesons->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); - auto groupPartsD0D0barChildren = partsDmesonsChildren->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); - // loop over D0/D0bar mesons (ONLY) + // loop over D0/D0bar mesons for (auto const& d0d0bar : groupPartsAllD0D0barCands) { registry.fill(HIST("hPtD0D0bar"), d0d0bar.pt()); - registry.fill(HIST("hPhiDmesonCand"), d0d0bar.phi()); - registry.fill(HIST("hEtaDmesonCand"), d0d0bar.eta()); + registry.fill(HIST("hPhiD0D0bar"), d0d0bar.phi()); + registry.fill(HIST("hEtaD0D0bar"), d0d0bar.eta()); // BDT score classes registry.fill(HIST("DebugBdt/hBdtScore1VsStatus"), d0d0bar.decayVtxX(), 1); registry.fill(HIST("DebugBdt/hBdtScore2VsStatus"), d0d0bar.decayVtxY(), 1); registry.fill(HIST("DebugBdt/hBdtScore3VsStatus"), d0d0bar.decayVtxZ(), 1); - if (d0d0bar.mLambda() > 0.0f) { - registry.fill(HIST("D0D0bar_doubleMassHypo/hMassVsPt"), d0d0bar.mLambda(), d0d0bar.pt()); - registry.fill(HIST("D0D0bar_doubleMassHypo/hMassVsPtD0"), d0d0bar.mLambda(), d0d0bar.pt()); - if (d0d0bar.mAntiLambda() < 0.0f) { - registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPt"), d0d0bar.mLambda(), d0d0bar.pt()); - registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtD0"), d0d0bar.mLambda(), d0d0bar.pt()); - registry.fill(HIST("hPtD0"), d0d0bar.pt()); - registry.fill(HIST("hPhiD0"), d0d0bar.phi()); - registry.fill(HIST("hEtaD0"), d0d0bar.eta()); + weight = 1.0f; + if (doEfficiencyCorr) { + weight = efficiencyCalculator.getWeight(ParticleNo::TWO, d0d0bar.pt()); + if (d0d0bar.mLambda() > 0.0f) { + registry.fill(HIST("D0D0bar_doubleMassHypo/hMassVsPtEffCorr"), d0d0bar.mLambda(), d0d0bar.pt(), weight); + registry.fill(HIST("D0D0bar_doubleMassHypo/hMassVsPtD0EffCorr"), d0d0bar.mLambda(), d0d0bar.pt(), weight); + if (d0d0bar.mAntiLambda() < 0.0f) { + registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtEffCorr"), d0d0bar.mLambda(), d0d0bar.pt(), weight); + registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtD0EffCorr"), d0d0bar.mLambda(), d0d0bar.pt(), weight); + registry.fill(HIST("hPtD0"), d0d0bar.pt()); + registry.fill(HIST("hPhiD0"), d0d0bar.phi()); + registry.fill(HIST("hEtaD0"), d0d0bar.eta()); + } } - } - if (d0d0bar.mAntiLambda() > 0.0f) { - registry.fill(HIST("D0D0bar_doubleMassHypo/hMassVsPt"), d0d0bar.mLambda(), d0d0bar.pt()); - registry.fill(HIST("D0D0bar_doubleMassHypo/hMassVsPtD0bar"), d0d0bar.mLambda(), d0d0bar.pt()); - if (d0d0bar.mLambda() < 0.0f) { - registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPt"), d0d0bar.mAntiLambda(), d0d0bar.pt()); - registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtD0bar"), d0d0bar.mAntiLambda(), d0d0bar.pt()); - registry.fill(HIST("hPtD0bar"), d0d0bar.pt()); - registry.fill(HIST("hPhiD0bar"), d0d0bar.phi()); - registry.fill(HIST("hEtaD0bar"), d0d0bar.eta()); + if (d0d0bar.mAntiLambda() > 0.0f) { + registry.fill(HIST("D0D0bar_doubleMassHypo/hMassVsPtEffCorr"), d0d0bar.mLambda(), d0d0bar.pt(), weight); + registry.fill(HIST("D0D0bar_doubleMassHypo/hMassVsPtD0barEffCorr"), d0d0bar.mLambda(), d0d0bar.pt(), weight); + if (d0d0bar.mLambda() < 0.0f) { + registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtEffCorr"), d0d0bar.mAntiLambda(), d0d0bar.pt(), weight); + registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtD0barEffCorr"), d0d0bar.mAntiLambda(), d0d0bar.pt(), weight); + registry.fill(HIST("hPtD0bar"), d0d0bar.pt()); + registry.fill(HIST("hPhiD0bar"), d0d0bar.phi()); + registry.fill(HIST("hEtaD0bar"), d0d0bar.eta()); + } + } + } else { + if (d0d0bar.mLambda() > 0.0f) { + registry.fill(HIST("D0D0bar_doubleMassHypo/hMassVsPt"), d0d0bar.mLambda(), d0d0bar.pt()); + registry.fill(HIST("D0D0bar_doubleMassHypo/hMassVsPtD0"), d0d0bar.mLambda(), d0d0bar.pt()); + if (d0d0bar.mAntiLambda() < 0.0f) { + registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPt"), d0d0bar.mLambda(), d0d0bar.pt()); + registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtD0"), d0d0bar.mLambda(), d0d0bar.pt()); + registry.fill(HIST("hPtD0"), d0d0bar.pt()); + registry.fill(HIST("hPhiD0"), d0d0bar.phi()); + registry.fill(HIST("hEtaD0"), d0d0bar.eta()); + } + } + if (d0d0bar.mAntiLambda() > 0.0f) { + registry.fill(HIST("D0D0bar_doubleMassHypo/hMassVsPt"), d0d0bar.mLambda(), d0d0bar.pt()); + registry.fill(HIST("D0D0bar_doubleMassHypo/hMassVsPtD0bar"), d0d0bar.mLambda(), d0d0bar.pt()); + if (d0d0bar.mLambda() < 0.0f) { + registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPt"), d0d0bar.mAntiLambda(), d0d0bar.pt()); + registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtD0bar"), d0d0bar.mAntiLambda(), d0d0bar.pt()); + registry.fill(HIST("hPtD0bar"), d0d0bar.pt()); + registry.fill(HIST("hPhiD0bar"), d0d0bar.phi()); + registry.fill(HIST("hEtaD0bar"), d0d0bar.eta()); + } } - } - } - - // loop over D mesons childen - for (auto const& daughD0D0bar : groupPartsD0D0barChildren) { - registry.fill(HIST("hPtDaughters"), daughD0D0bar.pt()); - registry.fill(HIST("hSignDaughters"), daughD0D0bar.mLambda()); - // filling QA plots for D0 mesons' positive daughters (K+) - if (daughD0D0bar.mLambda() == 1 && (daughD0D0bar.mAntiLambda() == 1 || daughD0D0bar.mAntiLambda() == 0)) { - qaRegistry.fill(HIST("D0_pos_daugh/pt"), daughD0D0bar.pt()); - qaRegistry.fill(HIST("D0_pos_daugh/eta"), daughD0D0bar.eta()); - qaRegistry.fill(HIST("D0_pos_daugh/phi"), daughD0D0bar.phi()); - } - // filling QA plots for D0 mesons' negative daughters (pi-) - if (daughD0D0bar.mLambda() == -1 && (daughD0D0bar.mAntiLambda() == 1 || daughD0D0bar.mAntiLambda() == 0)) { - qaRegistry.fill(HIST("D0_neg_daugh/pt"), daughD0D0bar.pt()); - qaRegistry.fill(HIST("D0_neg_daugh/eta"), daughD0D0bar.eta()); - qaRegistry.fill(HIST("D0_neg_daugh/phi"), daughD0D0bar.phi()); - } - // filling QA plots for D0bar mesons' positive daughters (pi+) - if (daughD0D0bar.mLambda() == 1 && (daughD0D0bar.mAntiLambda() == -1 || daughD0D0bar.mAntiLambda() == 0)) { - qaRegistry.fill(HIST("D0bar_pos_daugh/pt"), daughD0D0bar.pt()); - qaRegistry.fill(HIST("D0bar_pos_daugh/eta"), daughD0D0bar.eta()); - qaRegistry.fill(HIST("D0bar_pos_daugh/phi"), daughD0D0bar.phi()); - } - // filling QA plots for D0bar mesons' negative daughters (K-) - if (daughD0D0bar.mLambda() == -1 && (daughD0D0bar.mAntiLambda() == -1 || daughD0D0bar.mAntiLambda() == 0)) { - qaRegistry.fill(HIST("D0bar_neg_daugh/pt"), daughD0D0bar.pt()); - qaRegistry.fill(HIST("D0bar_neg_daugh/eta"), daughD0D0bar.eta()); - qaRegistry.fill(HIST("D0bar_neg_daugh/phi"), daughD0D0bar.phi()); } } } PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processAllDmesons, "Enable processing over all D meson candidates", false); - void processD0mesons(o2::aod::FdCollision const& col, FemtoFullParticles const&) + void processD0Children(o2::aod::FdCollision const& col, FemtoFullParticles const&) { - auto groupPartsAllD0D0barCands = partsAllDmesons->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); - auto groupPartsOnlyD0D0bar = partsOnlyD0D0bar->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); auto groupPartsD0D0barChildren = partsDmesonsChildren->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); - // loop over D0/D0bar mesons (ONLY) - for (auto const& d0d0bar : groupPartsOnlyD0D0bar) { - - registry.fill(HIST("hPtD0D0bar"), d0d0bar.pt()); - // BDT score classes - registry.fill(HIST("DebugBdt/hBdtScore1VsStatus"), d0d0bar.decayVtxX(), 1); - registry.fill(HIST("DebugBdt/hBdtScore2VsStatus"), d0d0bar.decayVtxY(), 1); - registry.fill(HIST("DebugBdt/hBdtScore3VsStatus"), d0d0bar.decayVtxZ(), 1); - - if (d0d0bar.mLambda() > 0.0f && d0d0bar.mAntiLambda() < 0.0f) { - registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPt"), d0d0bar.mLambda(), d0d0bar.pt()); - registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtD0"), d0d0bar.mLambda(), d0d0bar.pt()); - registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtReflected"), std::abs(d0d0bar.mAntiLambda()), d0d0bar.pt()); - registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtD0Reflected"), std::abs(d0d0bar.mAntiLambda()), d0d0bar.pt()); - registry.fill(HIST("hInvMassD0"), d0d0bar.mLambda()); - registry.fill(HIST("hPtD0"), d0d0bar.pt()); - registry.fill(HIST("hPhiD0"), d0d0bar.phi()); - registry.fill(HIST("hEtaD0"), d0d0bar.eta()); - } - if (d0d0bar.mLambda() < 0.0f && d0d0bar.mAntiLambda() > 0.0f) { - registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPt"), d0d0bar.mAntiLambda(), d0d0bar.pt()); - registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtD0bar"), d0d0bar.mAntiLambda(), d0d0bar.pt()); - registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtReflected"), std::abs(d0d0bar.mLambda()), d0d0bar.pt()); - registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtD0barReflected"), std::abs(d0d0bar.mLambda()), d0d0bar.pt()); - registry.fill(HIST("hInvMassD0bar"), d0d0bar.mAntiLambda()); - registry.fill(HIST("hPtD0bar"), d0d0bar.pt()); - registry.fill(HIST("hPhiD0bar"), d0d0bar.phi()); - registry.fill(HIST("hEtaD0bar"), d0d0bar.eta()); - } - } - // loop over D mesons childen for (auto const& daughD0D0bar : groupPartsD0D0barChildren) { registry.fill(HIST("hPtDaughters"), daughD0D0bar.pt()); registry.fill(HIST("hSignDaughters"), daughD0D0bar.mLambda()); // filling QA plots for D0 mesons' positive daughters (K+) - if (daughD0D0bar.mLambda() == 1 && daughD0D0bar.mAntiLambda() == 1) { + if (daughD0D0bar.mLambda() == 1 && (daughD0D0bar.mAntiLambda() == 1 || daughD0D0bar.mAntiLambda() == 0)) { qaRegistry.fill(HIST("D0_pos_daugh/pt"), daughD0D0bar.pt()); qaRegistry.fill(HIST("D0_pos_daugh/eta"), daughD0D0bar.eta()); qaRegistry.fill(HIST("D0_pos_daugh/phi"), daughD0D0bar.phi()); } // filling QA plots for D0 mesons' negative daughters (pi-) - if (daughD0D0bar.mLambda() == -1 && daughD0D0bar.mAntiLambda() == 1) { + if (daughD0D0bar.mLambda() == -1 && (daughD0D0bar.mAntiLambda() == 1 || daughD0D0bar.mAntiLambda() == 0)) { qaRegistry.fill(HIST("D0_neg_daugh/pt"), daughD0D0bar.pt()); qaRegistry.fill(HIST("D0_neg_daugh/eta"), daughD0D0bar.eta()); qaRegistry.fill(HIST("D0_neg_daugh/phi"), daughD0D0bar.phi()); } // filling QA plots for D0bar mesons' positive daughters (pi+) - if (daughD0D0bar.mLambda() == 1 && daughD0D0bar.mAntiLambda() == -1) { + if (daughD0D0bar.mLambda() == 1 && (daughD0D0bar.mAntiLambda() == -1 || daughD0D0bar.mAntiLambda() == 0)) { qaRegistry.fill(HIST("D0bar_pos_daugh/pt"), daughD0D0bar.pt()); qaRegistry.fill(HIST("D0bar_pos_daugh/eta"), daughD0D0bar.eta()); qaRegistry.fill(HIST("D0bar_pos_daugh/phi"), daughD0D0bar.phi()); } // filling QA plots for D0bar mesons' negative daughters (K-) - if (daughD0D0bar.mLambda() == -1 && daughD0D0bar.mAntiLambda() == -1) { + if (daughD0D0bar.mLambda() == -1 && (daughD0D0bar.mAntiLambda() == -1 || daughD0D0bar.mAntiLambda() == 0)) { qaRegistry.fill(HIST("D0bar_neg_daugh/pt"), daughD0D0bar.pt()); qaRegistry.fill(HIST("D0bar_neg_daugh/eta"), daughD0D0bar.eta()); qaRegistry.fill(HIST("D0bar_neg_daugh/phi"), daughD0D0bar.phi()); } } } - PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processD0mesons, "Enable processing D0 mesons", true); + PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processD0Children, "Enable processing over daughters of D0 meson candidates", false); /// This function processes the same event and takes care of all the histogramming /// \todo the trivial loops over the tracks should be factored out since they will be common to all combinations of T-T, T-V0, V0-V0, ... @@ -925,9 +912,7 @@ struct FemtoUniversePairTaskTrackD0 { /// \param col subscribe to the collision table (Monte Carlo Reconstructed reconstructed) /// \param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth /// \param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table - void processSameEventMC(o2::aod::FdCollision const& col, - soa::Join const& parts, - o2::aod::FdMCParticles const&) + void processSameEventMC(aod::FdCollision const& col, FemtoMcRecoParticles const& parts, aod::FdMCParticles const&) { fillCollision(col); @@ -1094,9 +1079,7 @@ struct FemtoUniversePairTaskTrackD0 { /// @param cols subscribe to the collisions table (Monte Carlo Reconstructed reconstructed) /// @param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth /// @param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table - void processMixedEventMC(o2::aod::FdCollisions const& cols, - soa::Join const& parts, - o2::aod::FdMCParticles const&) + void processMixedEventMC(aod::FdCollisions const& cols, FemtoMcRecoParticles const& parts, aod::FdMCParticles const&) { for (auto const& [collision1, collision2] : soa::selfCombinations(colBinning, confNEventsMix, -1, cols, cols)) { @@ -1120,65 +1103,195 @@ struct FemtoUniversePairTaskTrackD0 { } PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processMixedEventMC, "Enable processing mixed events MC", false); - void processMCReco(FemtoMCParticles const&, aod::FdMCParticles const&) + void processMcReco(FemtoMcRecoParticles const& recoParts, aod::FdMCParticles const& mcParts) + { + for (auto const& part : recoParts) { + auto mcPartId = part.fdMCParticleId(); + if (mcPartId == -1) { + continue; // no MC particle + } + const auto& mcpart = mcParts.iteratorAt(mcPartId); + weight = 1.0f; + + // filling the histograms for identified hadrons + if (part.partType() == aod::femtouniverseparticle::ParticleType::kTrack) { + if (part.sign() > 0) { + if ((mcpart.pdgMCTruth() == PDG_t::kProton) && (part.pt() > ConfTrack.confTrackLowPtCut) && (part.pt() < ConfTrack.confTrackHighPtCut) && isParticleNSigma(part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon))) { + mcRecoRegistry.fill(HIST("hMcRecPrPt"), part.pt()); + if (mcpart.partOriginMCTruth() == aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kPrimary) { + mcRecoRegistry.fill(HIST("hMcRecPrPtGenEtaGen"), mcpart.pt(), mcpart.eta()); + } + } + if ((mcpart.pdgMCTruth() == PDG_t::kPiPlus) && (part.pt() > ConfTrack.confTrackLowPtCut) && (part.pt() < ConfTrack.confTrackHighPtCut) && isParticleNSigma(part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon))) { + mcRecoRegistry.fill(HIST("hMcRecPipPt"), part.pt()); + if (mcpart.partOriginMCTruth() == aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kPrimary) { + mcRecoRegistry.fill(HIST("hMcRecPipPtGenEtaGen"), mcpart.pt(), mcpart.eta()); + } + } + if ((mcpart.pdgMCTruth() == PDG_t::kKPlus) && (part.pt() > ConfTrack.confTrackLowPtCut) && (part.pt() < ConfTrack.confTrackHighPtCut) && isParticleNSigma(part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon))) { + mcRecoRegistry.fill(HIST("hMcRecKpPt"), part.pt()); + if (mcpart.partOriginMCTruth() == aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kPrimary) { + mcRecoRegistry.fill(HIST("hMcRecKpPtGenEtaGen"), mcpart.pt(), mcpart.eta()); + } + } + } else if (part.sign() < 0) { + if ((mcpart.pdgMCTruth() == -PDG_t::kProton) && (part.pt() > ConfTrack.confTrackLowPtCut) && (part.pt() < ConfTrack.confTrackHighPtCut) && isParticleNSigma(part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon))) { + mcRecoRegistry.fill(HIST("hMcRecAntiPrPt"), part.pt()); + if (mcpart.partOriginMCTruth() == aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kPrimary) { + mcRecoRegistry.fill(HIST("hMcRecAntiPrPtGenEtaGen"), mcpart.pt(), mcpart.eta()); + } + } + if ((mcpart.pdgMCTruth() == -PDG_t::kPiPlus) && (part.pt() > ConfTrack.confTrackLowPtCut) && (part.pt() < ConfTrack.confTrackHighPtCut) && isParticleNSigma(part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon))) { + mcRecoRegistry.fill(HIST("hMcRecPimPt"), part.pt()); + if (mcpart.partOriginMCTruth() == aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kPrimary) { + mcRecoRegistry.fill(HIST("hMcRecPimPtGenEtaGen"), mcpart.pt(), mcpart.eta()); + } + } + if ((mcpart.pdgMCTruth() == -PDG_t::kKPlus) && (part.pt() > ConfTrack.confTrackLowPtCut) && (part.pt() < ConfTrack.confTrackHighPtCut) && isParticleNSigma(part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon))) { + mcRecoRegistry.fill(HIST("hMcRecKmPt"), part.pt()); + if (mcpart.partOriginMCTruth() == aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kPrimary) { + mcRecoRegistry.fill(HIST("hMcRecKmPtGenEtaGen"), mcpart.pt(), mcpart.eta()); + } + } + } + } else if ((part.partType() == aod::femtouniverseparticle::ParticleType::kD0) && (part.pt() > ConfDmesons.confMinPtD0D0barReco) && (part.pt() < ConfDmesons.confMaxPtD0D0barReco)) { + if (mcpart.pdgMCTruth() == ConfDmesons.confPDGCodeD0) { + mcRecoRegistry.fill(HIST("hMcRecD0"), part.pt(), part.eta()); + mcRecoRegistry.fill(HIST("hMcRecD0Phi"), part.phi()); + if (part.tpcNClsFound() == 0) { // prompt candidates + mcRecoRegistry.fill(HIST("hMcRecD0Prompt"), part.pt(), part.eta()); + } else if (part.tpcNClsFound() == 1) { // non-prompt candidates + mcRecoRegistry.fill(HIST("hMcRecD0NonPrompt"), part.pt(), part.eta()); + } + } else if (mcpart.pdgMCTruth() == ConfDmesons.confPDGCodeD0bar) { + mcRecoRegistry.fill(HIST("hMcRecD0bar"), part.pt(), part.eta()); + mcRecoRegistry.fill(HIST("hMcRecD0barPhi"), part.phi()); + if (part.tpcNClsFound() == 0) { // prompt candidates + mcRecoRegistry.fill(HIST("hMcRecD0barPrompt"), part.pt(), part.eta()); + } else if (part.tpcNClsFound() == 1) { // non-prompt candidates + mcRecoRegistry.fill(HIST("hMcRecD0barNonPrompt"), part.pt(), part.eta()); + } + } + } + if (isParticleNSigma(part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon))) { + hTrackDCA.fillQA(part); + } + } + } + PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processMcReco, "Process MC reco data", false); + + void processMcRecoD0InvMass(FemtoMcRecoParticles const& recoParts) { - // WORK IN PROGRESS - // for (auto const& part : parts) {} + for (auto const& part : recoParts) { + // filling the histograms for identified hadrons + if ((part.partType() == aod::femtouniverseparticle::ParticleType::kD0) && (part.pt() > ConfDmesons.confMinPtD0D0barReco) && (part.pt() < ConfDmesons.confMaxPtD0D0barReco)) { + // getting the efficiency value + if (doEfficiencyCorr) { + weight = efficiencyCalculator.getWeight(ParticleNo::TWO, part.pt()); + } else { + weight = 1.0f; + } + // filling the inv. mass histograms + if (part.mLambda() > 0) { + if (part.sign() == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { + mcRecoRegistry.fill(HIST("hMassVsPtD0Sig"), part.mLambda(), part.pt(), weight); + } else if (part.sign() == -o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { + mcRecoRegistry.fill(HIST("hMassVsPtD0Refl"), part.mLambda(), part.pt(), weight); + } else { + mcRecoRegistry.fill(HIST("hMassVsPtD0Bkg"), part.mLambda(), part.pt(), weight); + } + if (part.tpcNClsFound() == 0) { // prompt candidates + mcRecoRegistry.fill(HIST("hMassVsPtD0Prompt"), part.mLambda(), part.pt(), weight); + } else if (part.tpcNClsFound() == 1) { // non-prompt candidates + mcRecoRegistry.fill(HIST("hMassVsPtD0NonPrompt"), part.mLambda(), part.pt(), weight); + } + } else if (part.mAntiLambda() > 0) { + if (part.sign() == -o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { + mcRecoRegistry.fill(HIST("hMassVsPtD0barSig"), part.mAntiLambda(), part.pt(), weight); + } else if (part.sign() == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { + mcRecoRegistry.fill(HIST("hMassVsPtD0barRefl"), part.mAntiLambda(), part.pt(), weight); + } else { + mcRecoRegistry.fill(HIST("hMassVsPtD0barBkg"), part.mAntiLambda(), part.pt(), weight); + } + if (part.tpcNClsFound() == 0) { // prompt candidates + mcRecoRegistry.fill(HIST("hMassVsPtD0barPrompt"), part.mAntiLambda(), part.pt(), weight); + } else if (part.tpcNClsFound() == 1) { // non-prompt candidates + mcRecoRegistry.fill(HIST("hMassVsPtD0barNonPrompt"), part.mAntiLambda(), part.pt(), weight); + } + } + } + } } - PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processMCReco, "Process MC reco data", false); + PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processMcRecoD0InvMass, "Process MC reco inv. mass histograms for D0", false); - void processMCTruth(aod::FDParticles const& parts) // WORK IN PROGRESS + void processMcTruth(aod::FDParticles const& parts) { for (auto const& part : parts) { - if (part.partType() != uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) + if (part.partType() != uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) { continue; + } - int pdgCode = static_cast(part.pidCut()); + int pdgCode = static_cast(part.tempFitVar()); + int8_t hfFlagMcGen = static_cast(part.mLambda()); const auto& pdgParticle = pdgMC->GetParticle(pdgCode); if (!pdgParticle) { continue; } if (pdgParticle->Charge() > 0.0) { - mcTruthRegistry.fill(HIST("MCTruthAllPositivePt"), part.pt()); + mcTruthRegistry.fill(HIST("hMcGenAllPositivePt"), part.pt()); } - if (pdgCode == 211) { - mcTruthRegistry.fill(HIST("MCTruthPipPtVsEta"), part.pt(), part.eta()); - mcTruthRegistry.fill(HIST("MCTruthPipPt"), part.pt()); + if (pdgCode == PDG_t::kPiPlus) { + mcTruthRegistry.fill(HIST("hMcGenPipPtVsEta"), part.pt(), part.eta()); + mcTruthRegistry.fill(HIST("hMcGenPipPt"), part.pt()); } - if (pdgCode == 321) { - mcTruthRegistry.fill(HIST("MCTruthKpPtVsEta"), part.pt(), part.eta()); - mcTruthRegistry.fill(HIST("MCTruthKpPt"), part.pt()); + if (pdgCode == PDG_t::kKPlus) { + mcTruthRegistry.fill(HIST("hMcGenKpPtVsEta"), part.pt(), part.eta()); + mcTruthRegistry.fill(HIST("hMcGenKpPt"), part.pt()); } - if (pdgCode == 421) { - mcTruthRegistry.fill(HIST("MCTruthD0D0bar"), part.pt(), part.eta()); + if (pdgCode == o2::constants::physics::Pdg::kD0) { + if (std::abs(hfFlagMcGen) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { + mcTruthRegistry.fill(HIST("hMcGenD0"), part.pt(), part.eta()); + if (part.mAntiLambda() > 0) { + mcTruthRegistry.fill(HIST("hMcGenD0Prompt"), part.pt(), part.eta()); + } else { + mcTruthRegistry.fill(HIST("hMcGenD0NonPrompt"), part.pt(), part.eta()); + } + } } - if (pdgCode == 2212) { - mcTruthRegistry.fill(HIST("MCTruthProtonPtVsEta"), part.pt(), part.eta()); - mcTruthRegistry.fill(HIST("MCTruthProtonPt"), part.pt()); + if (pdgCode == PDG_t::kProton) { + mcTruthRegistry.fill(HIST("hMcGenPrPtVsEta"), part.pt(), part.eta()); + mcTruthRegistry.fill(HIST("hMcGenPrPt"), part.pt()); } if (pdgParticle->Charge() < 0.0) { - mcTruthRegistry.fill(HIST("MCTruthAllNegativePt"), part.pt()); + mcTruthRegistry.fill(HIST("hMcGenAllNegativePt"), part.pt()); } - if (pdgCode == -211) { - mcTruthRegistry.fill(HIST("MCTruthPimPtVsEta"), part.pt(), part.eta()); - mcTruthRegistry.fill(HIST("MCTruthPimPt"), part.pt()); + if (pdgCode == PDG_t::kPiMinus) { + mcTruthRegistry.fill(HIST("hMcGenPimPtVsEta"), part.pt(), part.eta()); + mcTruthRegistry.fill(HIST("hMcGenPimPt"), part.pt()); } - if (pdgCode == -321) { - mcTruthRegistry.fill(HIST("MCTruthKmPtVsEta"), part.pt(), part.eta()); - mcTruthRegistry.fill(HIST("MCTruthKmPt"), part.pt()); + if (pdgCode == PDG_t::kKMinus) { + mcTruthRegistry.fill(HIST("hMcGenKmPtVsEta"), part.pt(), part.eta()); + mcTruthRegistry.fill(HIST("hMcGenKmPt"), part.pt()); } - if (pdgCode == -421) { - mcTruthRegistry.fill(HIST("MCTruthD0D0bar"), part.pt(), part.eta()); + if (pdgCode == o2::constants::physics::Pdg::kD0Bar) { + if (std::abs(hfFlagMcGen) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { + mcTruthRegistry.fill(HIST("hMcGenD0bar"), part.pt(), part.eta()); + if (part.mAntiLambda() > 0) { + mcTruthRegistry.fill(HIST("hMcGenD0barPrompt"), part.pt(), part.eta()); + } else { + mcTruthRegistry.fill(HIST("hMcGenD0barNonPrompt"), part.pt(), part.eta()); + } + } } - if (pdgCode == -2212) { - mcTruthRegistry.fill(HIST("MCTruthAntiProtonPtVsEta"), part.pt(), part.eta()); - mcTruthRegistry.fill(HIST("MCTruthAntiProtonPt"), part.pt()); + if (pdgCode == -PDG_t::kProton) { + mcTruthRegistry.fill(HIST("hMcGenAntiPrPtVsEta"), part.pt(), part.eta()); + mcTruthRegistry.fill(HIST("hMcGenAntiPrPt"), part.pt()); } } } - PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processMCTruth, "Process MC truth data", false); + PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processMcTruth, "Process MC truth data", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 76eea7069cb0fb98ab964c7637939ac7cb0312c9 Mon Sep 17 00:00:00 2001 From: jaimenorman Date: Mon, 11 Aug 2025 12:31:19 +0200 Subject: [PATCH 008/986] [PWGJE] fix filling of histogram (#12524) --- PWGJE/Tasks/jetHadronRecoil.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGJE/Tasks/jetHadronRecoil.cxx b/PWGJE/Tasks/jetHadronRecoil.cxx index 731e8a7c78b..1bc88828066 100644 --- a/PWGJE/Tasks/jetHadronRecoil.cxx +++ b/PWGJE/Tasks/jetHadronRecoil.cxx @@ -257,7 +257,7 @@ struct JetHadronRecoil { registry.fill(HIST("hEtaTrack"), track.eta(), weight); registry.fill(HIST("hPhiTrack"), track.phi(), weight); registry.fill(HIST("hTrack3D"), track.pt(), track.eta(), track.phi(), weight); - registry.fill(HIST("hPtTrackPtHard"), track.pt(), track.pt() / pTHat, weight); + registry.fill(HIST("hPtTrackPtHard"), track.pt() / pTHat, track.pt(), weight); } if (nTT > 0) { From fcd05d561139016965f5a994e1ceb4d8200a489f Mon Sep 17 00:00:00 2001 From: Jesper Karlsson Gumprecht <113693781+jesgum@users.noreply.github.com> Date: Mon, 11 Aug 2025 13:31:07 +0200 Subject: [PATCH 009/986] [ALICE3] Fix typo in otf multi-charm table producer (#12468) --- ALICE3/TableProducer/alice3-multicharmTable.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ALICE3/TableProducer/alice3-multicharmTable.cxx b/ALICE3/TableProducer/alice3-multicharmTable.cxx index 164e5f83f9b..3c81557082a 100644 --- a/ALICE3/TableProducer/alice3-multicharmTable.cxx +++ b/ALICE3/TableProducer/alice3-multicharmTable.cxx @@ -723,7 +723,7 @@ struct alice3multicharmTable { histos.fill(HIST("hDCAxyXiCC"), std::fabs(xiccdcaXY * 1e+4)); histos.fill(HIST("hDCAzXiCC"), std::fabs(xiccdcaZ * 1e+4)); - if (std::fabs(thisXiCcandidate.eta) > xiccMaxEta) + if (std::fabs(thisXiCCcandidate.eta) > xiccMaxEta) continue; // not in central barrel histos.fill(HIST("hCharmBuilding"), 3.0f); From 01dd070d436b35263a6876869822bd1c4f96b068 Mon Sep 17 00:00:00 2001 From: Sahil Upadhyaya <36447687+sahilupadhyaya92@users.noreply.github.com> Date: Mon, 11 Aug 2025 15:00:22 +0200 Subject: [PATCH 010/986] [PWGDQ] Repositioning of Drell-Yan 1D Histograms (#12503) Co-authored-by: Sahil Upadhyaya --- PWGDQ/Core/HistogramsLibrary.cxx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/PWGDQ/Core/HistogramsLibrary.cxx b/PWGDQ/Core/HistogramsLibrary.cxx index b9618a4c64e..65d07c909e1 100644 --- a/PWGDQ/Core/HistogramsLibrary.cxx +++ b/PWGDQ/Core/HistogramsLibrary.cxx @@ -1621,6 +1621,12 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "MassMult", "", false, 750, 0.0, 15.0, VarManager::kMass, 301, -0.5, 300.5, VarManager::kVtxNcontrib); hm->AddHistogram(histClass, "MassVtxZMult", "", false, 300, 0.0, 6.0, VarManager::kMass, 60, -15.0, 15.0, VarManager::kVtxZ, 100, 0.0, 100.0, VarManager::kVtxNcontrib); } + if (subGroupStr.Contains("dimuon-drellyan")) { + hm->AddHistogram(histClass, "DY_mass", "", false, 5000, 0.0, 50.0, VarManager::kMass); // 10 MeV mass res + hm->AddHistogram(histClass, "DY_pT", "", false, 2000, 0.0, 100.0, VarManager::kPt); // 50 MeV pT res + hm->AddHistogram(histClass, "DY_y", "", false, 20, 2.0, 4.0, VarManager::kRap); + hm->AddHistogram(histClass, "DY_phi", "", false, 180, constants::math::PI, 2 * constants::math::PI, VarManager::kPhi); + } } else if (subGroupStr.Contains("electronmuon")) { hm->AddHistogram(histClass, "Mass", "", false, 750, 0.0, 30.0, VarManager::kMass); hm->AddHistogram(histClass, "Pt", "", false, 120, 0.0, 30.0, VarManager::kPt); @@ -1986,13 +1992,6 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "Mass_Pt", "", false, 500, 0.0, 5.0, VarManager::kMassDau, 200, 0.0, 20.0, VarManager::kPt); hm->AddHistogram(histClass, "Rapidity", "", false, 400, -4.0, 4.0, VarManager::kRap); } - - if (subGroupStr.Contains("DY-dimuon")) { - hm->AddHistogram(histClass, "DY_mass", "", false, 5000, 0.0, 50.0, VarManager::kMass); // 10 MeV mass res - hm->AddHistogram(histClass, "DY_pT", "", false, 2000, 0.0, 100.0, VarManager::kPt); // 50 MeV pT res - hm->AddHistogram(histClass, "DY_y", "", false, 20, 2.0, 4.0, VarManager::kRap); - hm->AddHistogram(histClass, "DY_phi", "", false, 180, constants::math::PI, 2 * constants::math::PI, VarManager::kPhi); - } } //__________________________________________________________________ From b94e5003817ad09c444e697300276100a8469f6f Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Mon, 11 Aug 2025 17:01:19 +0200 Subject: [PATCH 011/986] [PWGEM/Dilepton] add eoi in MC for consistency (#12528) --- PWGEM/Dilepton/TableProducer/associateMCinfoDilepton.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PWGEM/Dilepton/TableProducer/associateMCinfoDilepton.cxx b/PWGEM/Dilepton/TableProducer/associateMCinfoDilepton.cxx index 52867a7609d..6bd004a0e40 100644 --- a/PWGEM/Dilepton/TableProducer/associateMCinfoDilepton.cxx +++ b/PWGEM/Dilepton/TableProducer/associateMCinfoDilepton.cxx @@ -42,7 +42,7 @@ struct AssociateMCInfoDilepton { kPCM = 0x4, }; - using MyCollisionsMC = soa::Join; + using MyCollisionsMC = soa::Join; using TracksMC = soa::Join; using FwdTracksMC = soa::Join; using MFTTracksMC = soa::Join; @@ -172,6 +172,10 @@ struct AssociateMCInfoDilepton { continue; } + if (!collision.isEoI()) { // events with at least 1 lepton for data reduction. + continue; + } + registry.fill(HIST("hEventCounter"), 2); auto mcCollision = collision.mcCollision(); mceventlabels(fEventLabels.find(mcCollision.globalIndex())->second, collision.mcMask()); From 3a6d7c885ae9b6895086397d4ae8d0654d1c0798 Mon Sep 17 00:00:00 2001 From: Sweta Singh <122526337+sweta29singh@users.noreply.github.com> Date: Mon, 11 Aug 2025 17:11:44 +0200 Subject: [PATCH 012/986] [PWGCF] Added Efficiency correction (#12526) --- .../EbyEFluctuations/Tasks/eventMeanPtId.cxx | 436 ++++++++---------- 1 file changed, 188 insertions(+), 248 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/eventMeanPtId.cxx b/PWGCF/EbyEFluctuations/Tasks/eventMeanPtId.cxx index 182876d39d1..7ef12c2b69f 100644 --- a/PWGCF/EbyEFluctuations/Tasks/eventMeanPtId.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/eventMeanPtId.cxx @@ -86,20 +86,11 @@ struct EventMeanPtId { Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable cfgUrlCCDB{"cfgUrlCCDB", "http://alice-ccdb.cern.ch", "url of ccdb"}; - Configurable cfgPathCCDB{"cfgPathCCDB", "Users/s/swsingh/My/Object/eff_Pb", "Path for ccdb-object"}; + Configurable cfgPathCCDB{"cfgPathCCDB", "Users/s/swsingh/My/Object/test", "Path for ccdb-object"}; Configurable cfgLoadEff{"cfgLoadEff", true, "Load efficiency"}; HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - TH1D* ptHistogramAllchargeRec = nullptr; - TH1D* ptHistogramPionrec = nullptr; - TH1D* ptHistogramKaonrec = nullptr; - TH1D* ptHistogramProtonrec = nullptr; - TH1D* hRecoPi = nullptr; - TH1D* hRecoKa = nullptr; - TH1D* hRecoPr = nullptr; - TH2D* hPtyPion = nullptr; - TH2D* hPtyKaon = nullptr; - TH2D* hPtyProton = nullptr; + TH2D* ptHistogramAllchargeRec = nullptr; Configurable ptMax{"ptMax", 2.0, "maximum pT"}; Configurable ptMin{"ptMin", 0.15, "minimum pT"}; @@ -117,20 +108,7 @@ struct EventMeanPtId { // LOGF(info, "Getting object %s", ccdbPath.value.data()); TList* lst = ccdb->getForTimeStamp(cfgPathCCDB.value, -1); - ptHistogramAllchargeRec = reinterpret_cast(lst->FindObject("ptHistogramAllchargeRec")); - ptHistogramPionrec = reinterpret_cast(lst->FindObject("ptHistogramPionrec")); - ptHistogramKaonrec = reinterpret_cast(lst->FindObject("ptHistogramKaonrec")); - ptHistogramProtonrec = reinterpret_cast(lst->FindObject("ptHistogramProtonrec")); - hRecoPi = reinterpret_cast(lst->FindObject("hRecoPi")); - hRecoKa = reinterpret_cast(lst->FindObject("hRecoKa")); - hRecoPr = reinterpret_cast(lst->FindObject("hRecoPr")); - hPtyPion = reinterpret_cast(lst->FindObject("hPtyPion")); - hPtyKaon = reinterpret_cast(lst->FindObject("hPtyKaon")); - hPtyProton = reinterpret_cast(lst->FindObject("hPtyProton")); - - if (!ptHistogramAllchargeRec || !ptHistogramPionrec || !ptHistogramKaonrec || !ptHistogramProtonrec || !hRecoPi || !hRecoKa || !hRecoPr || !hPtyPion || !hPtyKaon || !hPtyProton) { - LOGF(info, "FATAL!! Could not find required histograms in CCDB"); - } + ptHistogramAllchargeRec = reinterpret_cast(lst->FindObject("hPtEta_rec")); } std::vector ptBinning = {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0}; @@ -148,7 +126,8 @@ struct EventMeanPtId { AxisSpec nSigmaTOFAxispid = {170, -8.5, 8.5, "n#sigma_{TOF}"}; AxisSpec centAxis = {100, 0., 100., "centrality"}; AxisSpec subAxis = {30, 0., 30., "sample"}; - AxisSpec nchAxis = {4000, 0., 4000., "nch"}; + // AxisSpec nchAxis = {4000, 0., 4000., "nch"}; + AxisSpec nchAxis = {nchBins, nchMin, nchMax, "nch"}; AxisSpec varAxis1 = {400, 0., 4., "var1"}; AxisSpec varAxis2 = {400, 0., 4., "var2"}; AxisSpec chi2Axis = {100, 0., 100., "Chi2"}; @@ -157,7 +136,7 @@ struct EventMeanPtId { // QA Plots histos.add("hEventcounter", "event counts", kTH1D, {counter}); - auto h = histos.add("tracksel", "tracksel", HistType::kTH1D, {{10, 0.5, 10.5}}); + auto h = histos.add("tracksel", "tracksel", HistType::kTH1D, {{15, 0.5, 15.5}}); h->GetXaxis()->SetBinLabel(1, "Tracks read"); h->GetXaxis()->SetBinLabel(2, "Global track passed"); h->GetXaxis()->SetBinLabel(3, "DCAxy passed"); @@ -167,8 +146,9 @@ struct EventMeanPtId { h->GetXaxis()->SetBinLabel(7, "TPC crossed rows passed"); h->GetXaxis()->SetBinLabel(8, "TPC Chai2cluster passed"); h->GetXaxis()->SetBinLabel(9, "ITS Chai2cluster passed"); + h->GetXaxis()->SetBinLabel(10, "No. of ITS cluster 5 passed"); + h->GetXaxis()->SetBinLabel(11, "No. of TPC cluster 80 passed"); - histos.add("hEventcounter_recMC", "event counts rec MC", kTH1D, {counter}); auto hRec = histos.add("trackSelRec", "trackSelRec", HistType::kTH1D, {{10, 0.5, 10.5}}); hRec->GetXaxis()->SetBinLabel(1, "has_mcCollision() read"); hRec->GetXaxis()->SetBinLabel(2, "Vertex Z > 10cm passed"); @@ -179,7 +159,6 @@ struct EventMeanPtId { hRec->GetXaxis()->SetBinLabel(7, "klsVertexITSTPC passed"); histos.add("Data/hZvtx_before_sel", "hZvtx_before_sel", kTH1D, {vtxZAxis}); - histos.add("Data/hZvtx_after_sel", "hZvtx_after_sel", kTH1D, {vtxZAxis}); histos.add("Data/hZvtx_after_sel8", "hZvtx_after_sel8", kTH1D, {vtxZAxis}); histos.add("Data/hP", "hP", kTH1D, {pAxis}); histos.add("Data/hEta", ";hEta", kTH1D, {etaAxis}); @@ -207,29 +186,16 @@ struct EventMeanPtId { histos.add("Data/hyPion", ";hyPion", kTH1D, {etaAxis}); histos.add("Data/hyKaon", ";hyKaon", kTH1D, {etaAxis}); histos.add("Data/hyProton", ";hyProton", kTH1D, {etaAxis}); - histos.add("Data/hPtCh", "hPtCh", kTH2D, {nchAxis, ptAxis}); - histos.add("Data/hPtChPion", "hPtChPion", kTH2D, {nchAxis, ptAxis}); - histos.add("Data/hPtChKaon", "hPtChKaon", kTH2D, {nchAxis, ptAxis}); - histos.add("Data/hPtChProton", "hPtChProton", kTH2D, {nchAxis, ptAxis}); - histos.add("Data/hPtCent", "hPtCent", kTH2D, {centAxis, ptAxis}); - histos.add("Data/hPtCentPion", "hPtCentPion", kTH2D, {centAxis, ptAxis}); - histos.add("Data/hPtCentKaon", "hPtCentKaon", kTH2D, {centAxis, ptAxis}); - histos.add("Data/hPtCentProton", "hPtCentProton", kTH2D, {centAxis, ptAxis}); - histos.add("Data/hMeanPtCh", "hMeanPtCh", kTH2D, {nchAxis, ptAxis}); - histos.add("Data/hCent", "hCent", kTH2D, {nchAxis, centAxis}); histos.add("Data/hVar1", "hVar1", kTH2D, {subAxis, centAxis}); histos.add("Data/hVar2", "hVar2", kTH2D, {subAxis, centAxis}); histos.add("Data/hVar2meanpt", "hVar2meanpt", kTH2D, {centAxis, varAxis2}); - histos.add("Data/hVar", "hVar", kTH2D, {subAxis, centAxis}); histos.add("Data/hVarc", "hVarc", kTH2D, {subAxis, centAxis}); histos.add("Data/hVar1pi", "hVar1pi", kTH2D, {subAxis, centAxis}); histos.add("Data/hVar2pi", "hVar2pi", kTH2D, {subAxis, centAxis}); - histos.add("Data/hVarpi", "hVarpi", kTH2D, {subAxis, centAxis}); histos.add("Data/hVar2meanptpi", "hVar2meanptpi", kTH2D, {centAxis, varAxis2}); histos.add("Data/hVar1k", "hVar1k", kTH2D, {subAxis, centAxis}); histos.add("Data/hVar2k", "hVar2k", kTH2D, {subAxis, centAxis}); - histos.add("Data/hVark", "hVark", kTH2D, {subAxis, centAxis}); histos.add("Data/hVar2meanptk", "hVar2meanptk", kTH2D, {centAxis, varAxis2}); histos.add("Data/hVar1p", "hVar1p", kTH2D, {subAxis, centAxis}); histos.add("Data/hVar2p", "hVar2p", kTH2D, {subAxis, centAxis}); @@ -258,12 +224,9 @@ struct EventMeanPtId { histos.add("Data/hVar2px", "hVar2px", kTH2D, {subAxis, nchAxis}); histos.add("Data/hVarpx", "hVarpx", kTH2D, {subAxis, nchAxis}); histos.add("Data/hVar2meanptpx", "hVar2meanptpx", kTH2D, {nchAxis, varAxis2}); - histos.add("Data/ht", "ht", kTH1D, {centAxis}); histos.add("Data/hCentrality", "hCentrality", kTH1D, {centAxis}); histos.add("Data/hPEta", "hPEta", kTH2D, {pAxis, etaAxis}); histos.add("Data/hPtEta", "hPtEta", kTH2D, {ptAxis, etaAxis}); - histos.add("Data/hPy", "hPy", kTH2D, {pAxis, etaAxis}); - histos.add("Data/hPty", "hPty", kTH2D, {ptAxis, etaAxis}); histos.add("Data/hPtyPion", "hPtyPion", kTH2D, {ptAxis, etaAxis}); histos.add("Data/hPtyKaon", "hPtyKaon", kTH2D, {ptAxis, etaAxis}); histos.add("Data/hPtyProton", "hPtyProton", kTH2D, {ptAxis, etaAxis}); @@ -279,11 +242,11 @@ struct EventMeanPtId { histos.add("Data/hTPCchi2perCluster_after", "TPC #Chi^{2}/Cluster", kTH1D, {chi2Axis}); histos.add("Data/hITSchi2perCluster_after", "ITS #Chi^{2}/Cluster", kTH1D, {chi2Axis}); histos.add("Data/hTPCCrossedrows_after", "Crossed TPC rows", kTH1D, {crossedRowTpcAxis}); - histos.add("Data/hdEdx_rec_bf_anycut", "hdEdx_rec_bf_anycut", kTH2D, {pAxis, dEdxAxis}); histos.add("Data/hcent_nacc", "hcent_nacc", kTH2D, {centAxis, nchAxis}); histos.addClone("Data/", "Rec/"); // rec histograms + histos.add("hcent_nacc_corr", "hcent_nacc_corr", kTH2D, {centAxis, nchAxis}); histos.add("NSigamaTPCpion_rec", "NSigamaTPCpion_rec", kTH2D, {pAxis, nSigmaTPCAxispid}); histos.add("NSigamaTPCkaon_rec", "NSigamaTPCkaon_rec", kTH2D, {pAxis, nSigmaTPCAxispid}); histos.add("NSigamaTPCproton_rec", "NSigamaTPCproton_rec", kTH2D, {pAxis, nSigmaTPCAxispid}); @@ -293,56 +256,15 @@ struct EventMeanPtId { histos.add("NSigamaTPCTOFpion_rec", "NSigamaTPCTOFpion_rec", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); histos.add("NSigamaTPCTOFkaon_rec", "NSigamaTPCTOFkaon_rec", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); histos.add("NSigamaTPCTOFproton_rec", "NSigamaTPCTOFproton_rec", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); - histos.add("NSigamaTPCpion_rec_bf_sel", "NSigamaTPCpion_rec_bf_sel", kTH2D, {pAxis, nSigmaTPCAxispid}); - histos.add("NSigamaTPCkaon_rec_bf_sel", "NSigamaTPCkaon_rec_bf_sel", kTH2D, {pAxis, nSigmaTPCAxispid}); - histos.add("NSigamaTPCproton_rec_bf_sel", "NSigamaTPCproton_rec_bf_sel", kTH2D, {pAxis, nSigmaTPCAxispid}); - histos.add("NSigamaTOFpion_rec_bf_sel", "NSigamaTOFpion_rec_bf_sel", kTH2D, {pAxis, nSigmaTOFAxispid}); - histos.add("NSigamaTOFkaon_rec_bf_sel", "NSigamaTOFkaon_rec_bf_sel", kTH2D, {pAxis, nSigmaTOFAxispid}); - histos.add("NSigamaTOFproton_rec_bf_sel", "NSigamaTOFproton_rec_bf_sel", kTH2D, {pAxis, nSigmaTOFAxispid}); - histos.add("NSigamaTPCTOFpion_rec_bf_sel", "NSigamaTPCTOFpion_rec_bf_sel", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); - histos.add("NSigamaTPCTOFkaon_rec_bf_sel", "NSigamaTPCTOFkaon_rec_bf_sel", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); - histos.add("NSigamaTPCTOFproton_rec_bf_sel", "NSigamaTPCTOFproton_rec_bf_sel", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); histos.add("hPtyPion_rec", "hPtyPion_rec", kTH2D, {ptAxis, etaAxis}); histos.add("hPtyKaon_rec", "hPtyKaon_rec", kTH2D, {ptAxis, etaAxis}); histos.add("hPtyProton_rec", "hPtyProton_rec", kTH2D, {ptAxis, etaAxis}); histos.add("hPyPion_rec", "hPyPion_rec", kTH2D, {pAxis, etaAxis}); histos.add("hPyKaon_rec", "hPyKaon_rec", kTH2D, {pAxis, etaAxis}); histos.add("hPyProton_rec", "hPyProton_rec", kTH2D, {pAxis, etaAxis}); - histos.add("hTOFbeta_afterselection_rec_afterpidcut", "hTOFbeta_afterselection_rec_afterpidcut", kTH2D, {pAxis, betaAxis}); - histos.add("hdEdx_afterselection_rec_afterpidcut", "hdEdx_afterselection_rec_afterpidcut", kTH2D, {pAxis, dEdxAxis}); histos.add("hTOFbeta_afterselection_rec_beforepidcut", "hTOFbeta_afterselection_rec_beforepidcut", kTH2D, {pAxis, betaAxis}); histos.add("hdEdx_afterselection_rec_beforepidcut", "hdEdx_afterselection_rec_beforepidcut", kTH2D, {pAxis, dEdxAxis}); - histos.add("heffVar1x", "heffVar1x", kTH2D, {subAxis, nchAxis}); - histos.add("heffVar2x", "heffVar2x", kTH2D, {subAxis, nchAxis}); - histos.add("heffVarx", "heffVarx", kTH2D, {subAxis, nchAxis}); - histos.add("heffVar2meanptx", "heffVar2meanptx", kTH2D, {nchAxis, varAxis2}); - histos.add("hnchRec_all", ";hnchRec_all", kTH1D, {nchAxis}); - histos.add("hnchRec", ";hnchRec", kTH1D, {nchAxis}); - histos.add("hnchRec_true", ";hnchRec_true", kTH1D, {nchAxis}); - histos.add("hVar1x_rec_old", "hVar1x_rec_old", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2x_rec_old", "hVar2x_rec_old", kTH2D, {subAxis, nchAxis}); - histos.add("hVarx_rec_old", "hVarx_rec_old", kTH2D, {subAxis, nchAxis}); - histos.add("hVar1x_rec", "hVar1x_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2x_rec", "hVar2x_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVarx_rec", "hVarx_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2meanptx_rec", "hVar2meanptx_rec", kTH2D, {nchAxis, varAxis2}); - histos.add("hVar1pix_rec", "hVar1pix_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2pix_rec", "hVar2pix_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVarpix_rec", "hVarpix_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2meanptpix_rec", "hVar2meanptpix_rec", kTH2D, {nchAxis, varAxis2}); - histos.add("hVar1kx_rec", "hVar1kx_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2kx_rec", "hVar2kx_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVarkx_rec", "hVarkx_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2meanptkx_rec", "hVar2meanptkx_rec", kTH2D, {nchAxis, varAxis2}); - histos.add("hVar1px_rec", "hVar1px_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2px_rec", "hVar2px_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVarpx_rec", "hVarpx_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2meanptpx_rec", "hVar2meanptpx_rec", kTH2D, {nchAxis, varAxis2}); - histos.add("hZvtx_after_sel_rec", "hZvtx_after_sel_rec", kTH1D, {vtxZAxis}); - histos.add("hZvtx_after_sel8_rec", "hZvtx_after_sel8_rec", kTH1D, {vtxZAxis}); - histos.add("etaHistogram_allcharge_rec", "etaHistogram_allcharge_rec", kTH1D, {etaAxis}); - histos.add("ptHistogram_allcharge_bfptcut_rec", "ptHistogram_allcharge_bfptcut_rec", kTH1D, {ptAxis}); histos.add("ptHistogramAllchargeRec", "ptHistogramAllchargeRec", kTH1D, {ptAxis}); histos.add("ptHistogramPionrec", "ptHistogramPionrec", kTH1D, {ptAxis}); histos.add("ptHistogramKaonrec", "ptHistogramKaonrec", kTH1D, {ptAxis}); @@ -353,11 +275,9 @@ struct EventMeanPtId { histos.add("ptHistogramPionrec_pdg", "ptHistogramPionrec_pdg", kTH1D, {ptAxis}); histos.add("ptHistogramKaonrec_pdg", "ptHistogramKaonrec_pdg", kTH1D, {ptAxis}); histos.add("ptHistogramProtonrec_pdg", "ptHistogramProtonrec_pdg", kTH1D, {ptAxis}); - histos.add("Histogram_mass2_p_rec_beforesel", "Histogram_mass2_p_rec_beforesel", kTH1D, {ptAxis}); - histos.add("Histogram_mass2_p_rec_aftersel", "Histogram_mass2_p_rec_aftersel", kTH1D, {ptAxis}); - histos.add("hEffVar1x", "hEffVar1x", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVar2x", "hEffVar2x", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVarx", "hEffVarx", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar1x_rec", "hEffVar1x_rec", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar2x_rec", "hEffVar2x_rec", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVarx_rec", "hEffVarx_rec", kTH2D, {subAxis, nchAxis}); histos.add("hEffVar1pix", "hEffVar1pix", kTH2D, {subAxis, nchAxis}); histos.add("hEffVar2pix", "hEffVar2pix", kTH2D, {subAxis, nchAxis}); histos.add("hEffVarpix", "hEffVarpix", kTH2D, {subAxis, nchAxis}); @@ -367,7 +287,7 @@ struct EventMeanPtId { histos.add("hEffVar1px", "hEffVar1px", kTH2D, {subAxis, nchAxis}); histos.add("hEffVar2px", "hEffVar2px", kTH2D, {subAxis, nchAxis}); histos.add("hEffVarpx", "hEffVarpx", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVar2Meanptx", "hEffVar2Meanptx", kTH2D, {nchAxis, varAxis2}); + histos.add("hEffVar2Meanptx_rec", "hEffVar2Meanptx_rec", kTH2D, {nchAxis, varAxis2}); histos.add("hEffVar2Meanptpix", "hEffVar2Meanptpix", kTH2D, {nchAxis, varAxis2}); histos.add("hEffVar2Meanptkx", "hEffVar2Meanptkx", kTH2D, {nchAxis, varAxis2}); histos.add("hEffVar2Meanptpx", "hEffVar2Meanptpx", kTH2D, {nchAxis, varAxis2}); @@ -376,14 +296,8 @@ struct EventMeanPtId { histos.add("ptHistogramPion", "ptHistogramPion", kTH1D, {ptAxis}); histos.add("ptHistogramKaon", "ptHistogramKaon", kTH1D, {ptAxis}); histos.add("ptHistogramProton", "ptHistogramProton", kTH1D, {ptAxis}); - histos.add("hMC_Pt", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); - histos.add("MC_hZvtx_after_sel", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {vtxZAxis}); - histos.add("hTOFbeta_gen_pion", "hTOFbeta_gen_pion", kTH2D, {pAxis, betaAxis}); - histos.add("hdEdx_gen_pion", "hdEdx_gen_pion", kTH2D, {pAxis, dEdxAxis}); histos.add("hnch_gen_all", ";hnch_gen_all", kTH1D, {nchAxis}); - histos.add("hnch_gen", ";hnch_gen", kTH1D, {nchAxis}); histos.add("hnch_gen_true", ";hnch_gen_true", kTH1D, {nchAxis}); - histos.add("hnch_gen_eta", ";hnch_gen_eta", kTH1D, {etaAxis}); histos.add("hnch1", ";hnch1", kTH1D, {nchAxis}); histos.add("hnch2", ";hnch2", kTH1D, {nchAxis}); histos.add("hnch3", ";hnch3", kTH1D, {nchAxis}); @@ -391,9 +305,6 @@ struct EventMeanPtId { histos.add("hnch_ka", ";hnch_ka", kTH1D, {nchAxis}); histos.add("hnch_pr", ";hnch_pr", kTH1D, {nchAxis}); - histos.add("hVar1x_gen_old", "hVar1x_gen_old", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2x_gen_old", "hVar2x_gen_old", kTH2D, {subAxis, nchAxis}); - histos.add("hVarx_gen_old", "hVarx_gen_old", kTH2D, {subAxis, nchAxis}); histos.add("hVar1x_gen", "hVar1x_gen", kTH2D, {subAxis, nchAxis}); histos.add("hVar2x_gen", "hVar2x_gen", kTH2D, {subAxis, nchAxis}); histos.add("hVarx_gen", "hVarx_gen", kTH2D, {subAxis, nchAxis}); @@ -410,28 +321,63 @@ struct EventMeanPtId { histos.add("hVar2px_gen", "hVar2px_gen", kTH2D, {subAxis, nchAxis}); histos.add("hVarpx_gen", "hVarpx_gen", kTH2D, {subAxis, nchAxis}); histos.add("hVar2meanptpx_gen", "hVar2meanptpx_gen", kTH2D, {nchAxis, varAxis2}); - histos.add("hcent_nacc_rec", "hcent_nacc_rec", kTH2D, {centAxis, nchAxis}); histos.add("hcent_nacc_gen", "hcent_nacc_gen", kTH2D, {centAxis, nchAxis}); - histos.add("hGenCentrality", "hGenCentrality", kTH1D, {centAxis}); histos.add("hVtxZ_before_gen", "", kTH1F, {vtxZAxis}); - histos.add("hVtxZ_after_gen", "", kTH1F, {vtxZAxis}); + histos.add("hVtxZ_after_gensim", "", kTH1F, {vtxZAxis}); histos.add("hEta_gen", "", kTH1F, {etaAxis}); histos.add("hEta_rec", "", kTH1F, {etaAxis}); histos.add("hPt_gen", "", kTH1F, {ptAxis}); histos.add("hPt_rec", "", kTH1F, {ptAxis}); + histos.add("hEta_rec_corr", "", kTH1F, {etaAxis}); + histos.add("hPt_rec_corr", "", kTH1F, {ptAxis}); + histos.add("hPtEta_rec", "hPtEta_rec", kTH2D, {ptAxis, etaAxis}); + histos.add("hPtEta_pi_rec", "hPtEta_pi_rec", kTH2D, {ptAxis, etaAxis}); + histos.add("hPtEta_ka_rec", "hPtEta_ka_rec", kTH2D, {ptAxis, etaAxis}); + histos.add("hPtEta_pr_rec", "hPtEta_pr_rec", kTH2D, {ptAxis, etaAxis}); + histos.add("hPtEta_gen", "hPtEta_gen", kTH2D, {ptAxis, etaAxis}); + histos.add("hPtEta_pi_gen", "hPtEta_pi_gen", kTH2D, {ptAxis, etaAxis}); + histos.add("hPtEta_ka_gen", "hPtEta_ka_gen", kTH2D, {ptAxis, etaAxis}); + histos.add("hPtEta_pr_gen", "hPtEta_pr_gen", kTH2D, {ptAxis, etaAxis}); + histos.add("hPty_pi_gen", "hPty_pi_gen", kTH2D, {ptAxis, etaAxis}); + histos.add("hPty_ka_gen", "hPty_ka_gen", kTH2D, {ptAxis, etaAxis}); + histos.add("hPty_pr_gen", "hPty_pr_gen", kTH2D, {ptAxis, etaAxis}); + histos.add("hNch_vs_corr", "hNch_vs_corr", kTH1D, {nchAxis}); + histos.add("hVar1_gen", "hVar1_gen", kTH2D, {subAxis, centAxis}); + histos.add("hVar2_gen", "hVar2_gen", kTH2D, {subAxis, centAxis}); + histos.add("hVarc_gen", "hVarc_gen", kTH2D, {subAxis, centAxis}); + histos.add("hEffVar1x_Naccorr_rec", "hEffVar1x_Naccorr_rec", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar2x_Naccorr_rec", "hEffVar2x_Naccorr_rec", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVarx_Naccorr_rec", "hEffVarx_Naccorr_rec", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar1x_Naccorr_xaxis_rec", "hEffVar1x_Naccorr_xaxis_rec", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar2x_Naccorr_xaxis_rec", "hEffVar2x_Naccorr_xaxis_rec", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVarx_Naccorr_xaxis_rec", "hEffVarx_Naccorr_xaxis_rec", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar1x_Naccorr_data", "hEffVar1x_Naccorr_data", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar2x_Naccorr_data", "hEffVar2x_Naccorr_data", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVarx_Naccorr_data", "hEffVarx_Naccorr_data", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar1x_Naccorr_xaxis_data", "hEffVar1x_Naccorr_xaxis_data", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar2x_Naccorr_xaxis_data", "hEffVar2x_Naccorr_xaxis_data", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVarx_Naccorr_xaxis_data", "hEffVarx_Naccorr_xaxis_data", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar1x_data", "hEffVar1x_data", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar2x_data", "hEffVar2x_data", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVarx_data", "hEffVarx_data", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar2Meanptx_data", "hEffVar2Meanptx_data", kTH2D, {nchAxis, varAxis2}); } + // Configurables Configurable cVtxZcut{"cVtxZcut", 10.f, "Vertex Z"}; Configurable cEtacut{"cEtacut", 0.8, "Eta cut"}; Configurable cPtmincut{"cPtmincut", 0.2, "Pt min cut"}; Configurable cPtmaxcut{"cPtmaxcut", 2.0, "Pt max cut"}; Configurable cDcaXYcut{"cDcaXYcut", 0.12, "DCA XY cut"}; - Configurable cDcaZcut{"cDcaZcut", 0.3, "DCA Z cut"}; + Configurable cDcaZcut{"cDcaZcut", 2.0, "DCA Z cut"}; Configurable cCentmincut{"cCentmincut", 0.0, "Min cent cut"}; Configurable cCentmaxcut{"cCentmaxcut", 90.0, "Max cent cut"}; Configurable cTPCcrosscut{"cTPCcrosscut", 70, "TPC crossrows cut"}; - Configurable cItsChiCut{"cItsChiCut", 70, "ITS chi2 cluster cut"}; - Configurable cTpcChiCut{"cTpcChiCut", 70, "TPC chi2 cluster cut"}; + Configurable cItsChiCut{"cItsChiCut", 36, "ITS chi2 cluster cut"}; + Configurable cTpcChiCut{"cTpcChiCut", 4, "TPC chi2 cluster cut"}; + Configurable cnITSClustersCut{"cnITSClustersCut", 5, "Number of ITS clusters cut"}; + Configurable ctpcNClsCut{"ctpcNClsCut", 80, "No. of TPC clusters cut"}; + Configurable threshold{"threshold", 1e-6, "Delta eta bin count"}; // Event selections Configurable cSel8Trig{"cSel8Trig", true, "Sel8 (T0A + T0C) Selection Run3"}; @@ -443,7 +389,10 @@ struct EventMeanPtId { Configurable cIsGoodITSLayers{"cIsGoodITSLayers", true, "Good ITS Layers All"}; Configurable cItslayerall{"cItslayerall", true, "dead staves of ITS removed"}; Configurable cvtxtofmatched{"cvtxtofmatched", true, "TOF vertex matched"}; - Configurable cfgRejEl{"cfgRejEl", true, "Rejected electrons"}; + Configurable cfgRejEl{"cfgRejEl", false, "Rejected electrons"}; + Configurable cdata{"cdata", false, "Enable histogram filling for processData"}; + Configurable citsNCluster{"citsNCluster", false, "Enable Number of ITS clusters"}; + Configurable ctpcNClusterFound{"ctpcNClusterFound", false, "Enable Number of TPC clusters"}; // PID selection configurables Configurable cPionPmincut{"cPionPmincut", 0.2, "pion min cut of pion"}; @@ -461,6 +410,9 @@ struct EventMeanPtId { Configurable cElMaxCut{"cElMaxCut", 5.0, "electron max cut"}; Configurable cTwoPtlCut2{"cTwoPtlCut2", 2.0, "n2ptl cut"}; Configurable cRapidityCut05{"cRapidityCut05", 0.5, "rapidity cut"}; + Configurable nchBins{"nchBins", 4000, "Number of bins for nch axis"}; + Configurable nchMin{"nchMin", 0.0, "Minimum value for nch axis"}; + Configurable nchMax{"nchMax", 4000.0, "Maximum value for nch axis"}; template bool selCollision(C const& coll) @@ -522,7 +474,9 @@ struct EventMeanPtId { // if (std::fabs(track.dcaXY()) > cDcaXYcut) {return false;} histos.fill(HIST("tracksel"), 3); - // if (std::fabs(track.dcaZ()) > cDcaZcut) {return false;} + if (std::fabs(track.dcaZ()) > cDcaZcut) { + return false; + } histos.fill(HIST("tracksel"), 4); if (std::fabs(track.eta()) >= cEtacut) { @@ -538,18 +492,38 @@ struct EventMeanPtId { } histos.fill(HIST("tracksel"), 6); - // if (track.tpcNClsCrossedRows() < cTPCcrosscut) {return false;} + if (track.tpcNClsCrossedRows() < cTPCcrosscut) { + return false; + } histos.fill(HIST("tracksel"), 7); - // if (track.itsChi2NCl() > cItsChiCut) {return false;} + if (track.itsChi2NCl() > cItsChiCut) { + return false; + } histos.fill(HIST("tracksel"), 8); - // if (track.tpcChi2NCl() > cTpcChiCut) {return false;} + if (track.tpcChi2NCl() > cTpcChiCut) { + return false; + } histos.fill(HIST("tracksel"), 9); if (track.sign() == 0) return false; + if (citsNCluster) { + if (track.itsNCls() < cnITSClustersCut) { + return false; + } + histos.fill(HIST("tracksel"), 10); + } + + if (ctpcNClusterFound) { + if (track.tpcNClsFound() < ctpcNClsCut) { + return false; + } + histos.fill(HIST("tracksel"), 11); + } + return true; // if all checks pass, accept the collision } @@ -643,16 +617,21 @@ struct EventMeanPtId { return false; } - double getEfficiency(double pt, TH1D* ptHistogramAllchargeRec) + double getEfficiency(double pt, double eta, TH2D* ptHistogramAllchargeRec) { - int bin = ptHistogramAllchargeRec->FindBin(pt); - double eff = ptHistogramAllchargeRec->GetBinContent(bin); + int xbin = ptHistogramAllchargeRec->GetXaxis()->FindBin(pt); + int ybin = ptHistogramAllchargeRec->GetYaxis()->FindBin(eta); + + if (xbin < 1 || xbin > ptHistogramAllchargeRec->GetNbinsX() || ybin < 1 || ybin > ptHistogramAllchargeRec->GetNbinsY()) { + LOGF(warn, "pt or eta out of histograms bounds : %f, eta = %f", pt, eta); + return 1e-6; + } + double eff = ptHistogramAllchargeRec->GetBinContent(xbin, ybin); return (eff > 0) ? eff : 1e-6; // Avoid division by zero } //++++++++++++++++++++++++++++++++++++DATA CALCULATION +++++++++++++++++++++++++++++++++++++++++++++++++++++// - - void process(aod::MyCollision const& coll, aod::MyTracks const& inputTracks) + void processData(aod::MyCollision const& coll, aod::MyTracks const& inputTracks) { histos.fill(HIST("hEventcounter"), 1.); histos.fill(HIST("Data/hZvtx_before_sel"), coll.posZ()); @@ -666,13 +645,12 @@ struct EventMeanPtId { const auto cent = coll.centFT0C(); histos.fill(HIST("Data/hCentrality"), cent); - double nch = 0., nchPi = 0., nchKa = 0., nchPr = 0., nchAll = 0., nchAllBfCut = 0., nchEta = 0., nchPt = 0.; - double q1 = 0., q2 = 0.; - double q1Pi = 0., q2Pi = 0., q1Ka = 0., q2Ka = 0., q1Pr = 0., q2Pr = 0.; - double var1 = 0., var2 = 0., twoParAllCharge = 0.; - double var1Pi = 0., var2Pi = 0.; - double var1Ka = 0., var2Ka = 0.; - double var1Pr = 0., var2Pr = 0.; + double nchAll = 0., nchAllBfCut = 0., nchEta = 0., nchPt = 0., nch = 0., nchPi = 0., nchKa = 0., nchPr = 0.; + double q1 = 0., q2 = 0., var1 = 0., var2 = 0.; + double sumPtWeight = 0., sumWeight = 0., sumPtPtWeight = 0., var1Eff = 0., var2Eff = 0.; + double q1Pi = 0., q2Pi = 0., var1Pi = 0., var2Pi = 0.; + double q1Ka = 0., q2Ka = 0., var1Ka = 0., var2Ka = 0.; + double q1Pr = 0., q2Pr = 0., var1Pr = 0., var2Pr = 0.; int sample = histos.get(HIST("Data/hZvtx_after_sel8"))->GetEntries(); sample = sample % 30; // subsample error estimation @@ -693,37 +671,44 @@ struct EventMeanPtId { nchPt += 1.; histos.fill(HIST("Data/hnchTrue_pt"), nchPt); } - if (track.sign() == 0) continue; if (!selTrack(track)) continue; nchAll += 1.; + q1 += track.pt(); + q2 += (track.pt() * track.pt()); + histos.fill(HIST("Data/hnchAll"), nchAll); + histos.fill(HIST("Data/hPt"), track.pt()); + histos.fill(HIST("Data/hEta"), track.eta()); histos.fill(HIST("Data/hDCAxy"), track.dcaXY()); histos.fill(HIST("Data/hDCAz"), track.dcaZ()); histos.fill(HIST("Data/hTPCCrossedrows_after"), track.tpcNClsCrossedRows()); histos.fill(HIST("Data/hTPCchi2perCluster_after"), track.tpcChi2NCl()); histos.fill(HIST("Data/hITSchi2perCluster_after"), track.itsChi2NCl()); histos.fill(HIST("Data/hP"), track.p()); - histos.fill(HIST("Data/hPt"), track.pt()); - histos.fill(HIST("Data/hEta"), track.eta()); histos.fill(HIST("Data/hPtDCAxy"), track.pt(), track.dcaXY()); histos.fill(HIST("Data/hPtDCAz"), track.pt(), track.dcaZ()); histos.fill(HIST("Data/hPtEta"), track.pt(), track.eta()); histos.fill(HIST("Data/hPEta"), track.p(), track.eta()); histos.fill(HIST("Data/hNsigmaTPC"), track.p(), track.tpcNSigmaPr()); + double eff = getEfficiency(track.pt(), track.eta(), ptHistogramAllchargeRec); + if (eff < threshold) + continue; + double weight = 1. / eff; + sumPtWeight += track.pt() / eff; + sumPtPtWeight += (track.pt() * track.pt()) / (eff * eff); + sumWeight += weight; + if (track.pt() >= cPtmincut || track.pt() <= cPtmaxcut) // do not change this (it is for different pt work) { nch += 1.; histos.fill(HIST("Data/hnch"), nch); } - q1 += track.pt(); - q2 += (track.pt() * track.pt()); - // only TPC tracks: Pion, Kaon, Proton if (track.hasTPC() && std::abs(track.tpcNSigmaPi()) < cNSigCut3) histos.fill(HIST("Data/NSigamaTPCpion"), track.pt(), track.tpcNSigmaPi()); @@ -753,7 +738,6 @@ struct EventMeanPtId { histos.fill(HIST("Data/hdEdx_afterselection"), track.p(), track.tpcSignal()); histos.fill(HIST("Data/hTOFbeta_afterselection"), track.p(), track.beta()); } - if (selPion(track)) { histos.fill(HIST("Data/hPtPion"), track.pt()); histos.fill(HIST("Data/hEtaPion"), track.eta()); @@ -762,7 +746,6 @@ struct EventMeanPtId { nchPi += 1.; q1Pi += track.pt(); q2Pi += (track.pt() * track.pt()); - if (track.beta() > 1) continue; histos.fill(HIST("Data/hdEdx_afterselection1"), track.p(), track.tpcSignal()); @@ -775,7 +758,6 @@ struct EventMeanPtId { histos.fill(HIST("Data/hdEdx_afterselection"), track.p(), track.tpcSignal()); histos.fill(HIST("Data/hTOFbeta_afterselection"), track.p(), track.beta()); } - if (selKaon(track)) { histos.fill(HIST("Data/hPtKaon"), track.pt()); histos.fill(HIST("Data/hEtaKaon"), track.eta()); @@ -784,7 +766,6 @@ struct EventMeanPtId { nchKa += 1.; q1Ka += track.pt(); q2Ka += (track.pt() * track.pt()); - if (track.beta() > 1) continue; histos.fill(HIST("Data/hdEdx_afterselection1"), track.p(), track.tpcSignal()); @@ -797,7 +778,6 @@ struct EventMeanPtId { histos.fill(HIST("Data/hdEdx_afterselection"), track.p(), track.tpcSignal()); histos.fill(HIST("Data/hTOFbeta_afterselection"), track.p(), track.beta()); } - if (selProton(track)) { histos.fill(HIST("Data/hPtProton"), track.pt()); histos.fill(HIST("Data/hEtaProton"), track.eta()); @@ -806,12 +786,12 @@ struct EventMeanPtId { nchPr += 1.; q1Pr += track.pt(); q2Pr += (track.pt() * track.pt()); - if (track.beta() > 1) continue; histos.fill(HIST("Data/hdEdx_afterselection1"), track.p(), track.tpcSignal()); histos.fill(HIST("Data/hTOFbeta_afterselection1"), track.p(), track.beta()); } + } // Track loop ends! histos.fill(HIST("Data/hcent_nacc"), cent, nchAll); @@ -820,41 +800,37 @@ struct EventMeanPtId { var1 = (q1 * q1 - q2) / (nchAll * (nchAll - 1)); var2 = (q1 / nchAll); - //------------------ all charges------------------------------------- - histos.fill(HIST("Data/hVar1"), sample, cent, var1); - histos.fill(HIST("Data/hVar2"), sample, cent, var2); - histos.fill(HIST("Data/hVarc"), sample, cent); - histos.fill(HIST("Data/hVar2meanpt"), cent, var2); - twoParAllCharge = (var1 - var2); - histos.fill(HIST("Data/hVar"), nchAll, twoParAllCharge); + //------------------ Efficiency corrected histograms --------------- + var1Eff = (sumPtWeight * sumPtWeight - sumPtPtWeight) / (sumWeight * (sumWeight - 1)); + var2Eff = (sumPtWeight / sumWeight); //---------------------- pions ---------------------------------------- if (nchPi >= cTwoPtlCut2) { var1Pi = (q1Pi * q1Pi - q2Pi) / (nchPi * (nchPi - 1)); var2Pi = (q1Pi / nchPi); } - //----------------------- kaons --------------------------------------- if (nchKa >= cTwoPtlCut2) { var1Ka = (q1Ka * q1Ka - q2Ka) / (nchKa * (nchKa - 1)); var2Ka = (q1Ka / nchKa); } - //---------------------------- protons ---------------------------------- if (nchPr >= cTwoPtlCut2) { var1Pr = (q1Pr * q1Pr - q2Pr) / (nchPr * (nchPr - 1)); var2Pr = (q1Pr / nchPr); } - //========================centrality========================================== + //------------------ all charges------------------------------------- + histos.fill(HIST("Data/hVar1"), sample, cent, var1); + histos.fill(HIST("Data/hVar2"), sample, cent, var2); + histos.fill(HIST("Data/hVarc"), sample, cent); + histos.fill(HIST("Data/hVar2meanpt"), cent, var2); histos.fill(HIST("Data/hVar1pi"), sample, cent, var1Pi); histos.fill(HIST("Data/hVar2pi"), sample, cent, var2Pi); histos.fill(HIST("Data/hVar2meanptpi"), cent, var2Pi); - histos.fill(HIST("Data/hVar1k"), sample, cent, var1Ka); histos.fill(HIST("Data/hVar2k"), sample, cent, var2Ka); histos.fill(HIST("Data/hVar2meanptk"), cent, var2Ka); - histos.fill(HIST("Data/hVar1p"), sample, cent, var1Pr); histos.fill(HIST("Data/hVar2p"), sample, cent, var2Pr); histos.fill(HIST("Data/hVar2meanptp"), cent, var2Pr); @@ -865,6 +841,20 @@ struct EventMeanPtId { histos.fill(HIST("Data/hVarx"), sample, nchAll); histos.fill(HIST("Data/hVar2meanptx"), nchAll, var2); + histos.fill(HIST("hEffVar1x_data"), sample, nchAll, var1Eff); + histos.fill(HIST("hEffVar2x_data"), sample, nchAll, var2Eff); + histos.fill(HIST("hEffVarx_data"), sample, nchAll); + histos.fill(HIST("hEffVar2Meanptx_data"), nchAll, var2Eff); + histos.fill(HIST("hEffVar1x_Naccorr_data"), sample, sumWeight, var1Eff); + histos.fill(HIST("hEffVar2x_Naccorr_data"), sample, sumWeight, var2Eff); + histos.fill(HIST("hEffVarx_Naccorr_data"), sample, sumWeight); + histos.fill(HIST("hEffVar1x_Naccorr_data"), sample, nchAll, var1Eff); + histos.fill(HIST("hEffVar2x_Naccorr_data"), sample, nchAll, var2Eff); + histos.fill(HIST("hEffVarx_Naccorr_data"), sample, nchAll, sumWeight); + histos.fill(HIST("hEffVar1x_Naccorr_xaxis_data"), sample, sumWeight, var1); + histos.fill(HIST("hEffVar2x_Naccorr_xaxis_data"), sample, sumWeight, var2); + histos.fill(HIST("hEffVarx_Naccorr_xaxis_data"), sample, sumWeight); + histos.fill(HIST("Data/hVar1pix"), sample, nchAll, var1Pi); histos.fill(HIST("Data/hVar2pix"), sample, nchAll, var2Pi); histos.fill(HIST("Data/hVarpix"), sample, nchPi); @@ -879,10 +869,9 @@ struct EventMeanPtId { histos.fill(HIST("Data/hVar2px"), sample, nchAll, var2Pr); histos.fill(HIST("Data/hVarpx"), sample, nchPr); histos.fill(HIST("Data/hVar2meanptpx"), nchAll, var2Pr); - } // event loop ends! - PROCESS_SWITCH(EventMeanPtId, process, "process real data information", false); + PROCESS_SWITCH(EventMeanPtId, processData, "process real data information", false); //++++++++++++++++++++++++++++++++++++MC Reconstructed +++++++++++++++++++++++++++++++++++++++++++++++++++++// @@ -897,43 +886,19 @@ struct EventMeanPtId { histos.fill(HIST("Rec/hZvtx_before_sel"), coll.posZ()); histos.fill(HIST("hVtxZ_before_gen"), coll.mcCollision().posZ()); - if (cTFBorder && !coll.selection_bit(aod::evsel::kNoTimeFrameBorder)) { - return; - } - if (cNoItsROBorder && !coll.selection_bit(aod::evsel::kNoITSROFrameBorder)) { - return; - } - if (cPileupReject && !coll.selection_bit(aod::evsel::kNoSameBunchPileup)) { - return; - } - if (cZVtxTimeDiff && !coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { - return; - } - if (cItsTpcVtx && !coll.selection_bit(aod::evsel::kIsVertexITSTPC)) { - return; - } - if (cvtxtofmatched && !coll.selection_bit(aod::evsel::kIsVertexTOFmatched)) { - return; - } - if (std::abs(coll.posZ()) > cVtxZcut) { + if (!selCollision(coll)) // add return; - } - if (!coll.sel8()) { - return; - } float cent = coll.centFT0C(); histos.fill(HIST("Rec/hZvtx_after_sel8"), coll.posZ()); + histos.fill(HIST("Rec/hCentrality"), cent); double nch = 0., nchPi = 0., nchKa = 0., nchPr = 0., nchAll = 0., nchAllBfCut = 0., nchEta = 0., nchPt = 0.; double q1 = 0., q2 = 0.; double q1Pi = 0., q2Pi = 0., q1Ka = 0., q2Ka = 0., q1Pr = 0., q2Pr = 0.; - double var1 = 0., var2 = 0., twoParAllCharge = 0.; + double var1 = 0., var2 = 0.; double var1Pi = 0., var2Pi = 0., var1Ka = 0., var2Ka = 0., var1Pr = 0., var2Pr = 0.; double sumPtWeight = 0., sumWeight = 0., sumPtPtWeight = 0., var1Eff = 0., var2Eff = 0.; - double sumPtWeightPi = 0., sumWeightPi = 0., sumPtPtWeightPi = 0., var1EffPi = 0., var2EffPi = 0.; - double sumPtWeightKa = 0., sumWeightKa = 0., sumPtPtWeightKa = 0., var1EffKa = 0., var2EffKa = 0.; - double sumPtWeightPr = 0., sumWeightPr = 0., sumPtPtWeightPr = 0., var1EffPr = 0., var2EffPr = 0.; int sample = histos.get(HIST("Rec/hZvtx_after_sel8"))->GetEntries(); sample = sample % 30; @@ -953,18 +918,23 @@ struct EventMeanPtId { nchPt += 1.; histos.fill(HIST("Rec/hnchTrue_pt"), nchPt); } - if (!track.isGlobalTrack()) - continue; - if (std::fabs(track.eta()) > cEtacut) - continue; - if ((track.pt() <= cPtmincut) || (track.pt() >= cPtmaxcut)) - continue; - if (track.sign() == 0) + if (!selTrack(track)) continue; // if (std::fabs(track.y()) > 0.5) continue; histos.fill(HIST("hPt_rec"), track.pt()); histos.fill(HIST("hEta_rec"), track.eta()); + double eff = getEfficiency(track.pt(), track.eta(), ptHistogramAllchargeRec); + if (eff < threshold) + continue; + double weight = 1.0 / eff; + sumPtWeight += track.pt() * weight; + sumPtPtWeight += (track.pt() * track.pt() * weight * weight); + sumWeight += weight; + + histos.fill(HIST("hPt_rec_corr"), track.pt(), weight); + histos.fill(HIST("hEta_rec_corr"), track.eta(), weight); + auto mcParticle = track.mcParticle(); nchAll += 1.; histos.fill(HIST("Rec/hnchAll"), nchAll); @@ -982,6 +952,7 @@ struct EventMeanPtId { histos.fill(HIST("Rec/hPtEta"), track.pt(), track.eta()); histos.fill(HIST("Rec/hPEta"), track.p(), track.eta()); histos.fill(HIST("Rec/hNsigmaTPC"), track.p(), track.tpcNSigmaPr()); + histos.fill(HIST("hPtEta_rec"), track.pt(), track.eta()); if (track.pt() >= cPtmincut || track.pt() <= cPtmaxcut) // do not change this (it is for different pt work) { @@ -991,12 +962,6 @@ struct EventMeanPtId { q1 += track.pt(); q2 += (track.pt() * track.pt()); - double eff = getEfficiency(track.pt(), ptHistogramAllchargeRec); - // LOGF(info, " with value %.2f", eff); - sumPtWeight += track.pt() / eff; - sumPtPtWeight += (track.pt() * track.pt()) / (eff * eff); - sumWeight += 1. / eff; - if (std::abs(mcParticle.pdgCode()) == PDG_t::kPiPlus) histos.fill(HIST("ptHistogramPionrec_pdg"), track.pt()); if (std::abs(mcParticle.pdgCode()) == PDG_t::kKPlus) @@ -1004,10 +969,6 @@ struct EventMeanPtId { if (std::abs(mcParticle.pdgCode()) == PDG_t::kProton) histos.fill(HIST("ptHistogramProtonrec_pdg"), track.pt()); - if (cfgRejEl == false && rejEl(track)) { - return; - } - // only TPC tracks: Pion, Kaon, Proton if (track.hasTPC() && std::abs(track.tpcNSigmaPi()) < cNSigCut3) histos.fill(HIST("Rec/NSigamaTPCpion"), track.pt(), track.tpcNSigmaPi()); @@ -1047,6 +1008,7 @@ struct EventMeanPtId { if (track.beta() > 1) continue; histos.fill(HIST("ptHistogramPionrec"), track.pt()); + histos.fill(HIST("hPtEta_pi_rec"), track.pt(), track.eta()); histos.fill(HIST("Rec/hPtPion"), track.pt()); histos.fill(HIST("Rec/hEtaPion"), track.eta()); histos.fill(HIST("Rec/hyPion"), track.rapidity(massPi)); @@ -1063,12 +1025,6 @@ struct EventMeanPtId { q1Pi += track.pt(); q2Pi += (track.pt() * track.pt()); - double effPi = getEfficiency(track.pt(), ptHistogramPionrec); - // LOGF(info, " with value %.2f", eff); - sumPtWeightPi += track.pt() / effPi; - sumPtPtWeightPi += (track.pt() * track.pt()) / (effPi * effPi); - sumWeightPi += 1. / effPi; - histos.fill(HIST("hPyPion_rec"), track.p(), track.rapidity(massPi)); histos.fill(HIST("hPtyPion_rec"), track.pt(), track.rapidity(massPi)); } @@ -1087,6 +1043,7 @@ struct EventMeanPtId { if (track.beta() > 1) continue; histos.fill(HIST("ptHistogramKaonrec"), track.pt()); + histos.fill(HIST("hPtEta_ka_rec"), track.pt(), track.eta()); histos.fill(HIST("Rec/hPtKaon"), track.pt()); histos.fill(HIST("Rec/hEtaKaon"), track.eta()); histos.fill(HIST("Rec/hyKaon"), track.rapidity(massKa)); @@ -1103,12 +1060,6 @@ struct EventMeanPtId { q1Ka += track.pt(); q2Ka += (track.pt() * track.pt()); - double effKa = getEfficiency(track.pt(), ptHistogramKaonrec); - // LOGF(info, " with value %.2f", eff); - sumPtWeightKa += track.pt() / effKa; - sumPtPtWeightKa += (track.pt() * track.pt()) / (effKa * effKa); - sumWeightKa += 1. / effKa; - histos.fill(HIST("hPyKaon_rec"), track.p(), track.rapidity(massKa)); histos.fill(HIST("hPtyKaon_rec"), track.pt(), track.rapidity(massKa)); } @@ -1127,6 +1078,7 @@ struct EventMeanPtId { if (track.beta() > 1) continue; histos.fill(HIST("ptHistogramProtonrec"), track.pt()); + histos.fill(HIST("hPtEta_pr_rec"), track.pt(), track.eta()); histos.fill(HIST("Rec/hPtProton"), track.pt()); histos.fill(HIST("Rec/hEtaProton"), track.eta()); histos.fill(HIST("Rec/hyProton"), track.rapidity(massPr)); @@ -1143,18 +1095,14 @@ struct EventMeanPtId { q1Pr += track.pt(); q2Pr += (track.pt() * track.pt()); - double effPr = getEfficiency(track.pt(), ptHistogramProtonrec); - // LOGF(info, " with value %.2f", eff); - sumPtWeightPr += track.pt() / effPr; - sumPtPtWeightPr += (track.pt() * track.pt()) / (effPr * effPr); - sumWeightPr += 1. / effPr; - histos.fill(HIST("hPyProton_rec"), track.p(), track.rapidity(massPr)); histos.fill(HIST("hPtyProton_rec"), track.pt(), track.rapidity(massPr)); } } // loop over tracks histos.fill(HIST("Rec/hcent_nacc"), cent, nchAll); + histos.fill(HIST("hcent_nacc_corr"), cent, sumWeight); + histos.fill(HIST("hNch_vs_corr"), nchAll, sumWeight); if (nchAll < cTwoPtlCut2) return; @@ -1170,32 +1118,21 @@ struct EventMeanPtId { histos.fill(HIST("Rec/hVar2"), sample, cent, var2); histos.fill(HIST("Rec/hVarc"), sample, cent); histos.fill(HIST("Rec/hVar2meanpt"), cent, var2); - twoParAllCharge = (var1 - var2); - histos.fill(HIST("Rec/hVar"), nchAll, twoParAllCharge); //---------------------- pions ---------------------------------------- if (nchPi >= cTwoPtlCut2) { var1Pi = (q1Pi * q1Pi - q2Pi) / (nchPi * (nchPi - 1)); var2Pi = (q1Pi / nchPi); - - var1EffPi = (sumPtWeightPi * sumPtWeightPi - sumPtPtWeightPi) / (sumWeightPi * (sumWeightPi - 1)); - var2EffPi = (sumPtWeightPi / sumWeightPi); } //----------------------- kaons --------------------------------------- if (nchKa >= cTwoPtlCut2) { var1Ka = (q1Ka * q1Ka - q2Ka) / (nchKa * (nchKa - 1)); var2Ka = (q1Ka / nchKa); - - var1EffKa = (sumPtWeightKa * sumPtWeightKa - sumPtPtWeightKa) / (sumWeightKa * (sumWeightKa - 1)); - var2EffKa = (sumPtWeightKa / sumWeightKa); } //---------------------------- protons ---------------------------------- if (nchPr >= cTwoPtlCut2) { var1Pr = (q1Pr * q1Pr - q2Pr) / (nchPr * (nchPr - 1)); var2Pr = (q1Pr / nchPr); - - var1EffPr = (sumPtWeightPr * sumPtWeightPr - sumPtPtWeightPr) / (sumWeightPr * (sumWeightPr - 1)); - var2EffPr = (sumPtWeightPr / sumWeightPr); } //========================centrality========================================== @@ -1227,25 +1164,16 @@ struct EventMeanPtId { histos.fill(HIST("Rec/hVarpx"), sample, nchPr); histos.fill(HIST("Rec/hVar2meanptpx"), nchAll, var2Pr); - histos.fill(HIST("hEffVar1x"), sample, nchAll, var1Eff); - histos.fill(HIST("hEffVar2x"), sample, nchAll, var2Eff); - histos.fill(HIST("hEffVarx"), sample, nchAll); - histos.fill(HIST("hEffVar2Meanptx"), nchAll, var2Eff); - - histos.fill(HIST("hEffVar1pix"), sample, nchAll, var1EffPi); - histos.fill(HIST("hEffVar2pix"), sample, nchAll, var2EffPi); - histos.fill(HIST("hEffVarpix"), sample, nchAll); - histos.fill(HIST("hEffVar2Meanptpix"), nchAll, var2EffPi); - - histos.fill(HIST("hEffVar1kx"), sample, nchAll, var1EffKa); - histos.fill(HIST("hEffVar2kx"), sample, nchAll, var2EffKa); - histos.fill(HIST("hEffVarkx"), sample, nchAll); - histos.fill(HIST("hEffVar2Meanptkx"), nchAll, var2EffKa); - - histos.fill(HIST("hEffVar1px"), sample, nchAll, var1EffPr); - histos.fill(HIST("hEffVar2px"), sample, nchAll, var2EffPr); - histos.fill(HIST("hEffVarpx"), sample, nchAll); - histos.fill(HIST("hEffVar2Meanptpx"), nchAll, var2EffPr); + histos.fill(HIST("hEffVar1x_rec"), sample, nchAll, var1Eff); + histos.fill(HIST("hEffVar2x_rec"), sample, nchAll, var2Eff); + histos.fill(HIST("hEffVarx_rec"), sample, nchAll); + histos.fill(HIST("hEffVar2Meanptx_rec"), nchAll, var2Eff); + histos.fill(HIST("hEffVar1x_Naccorr_rec"), sample, sumWeight, var1Eff); + histos.fill(HIST("hEffVar2x_Naccorr_rec"), sample, sumWeight, var2Eff); + histos.fill(HIST("hEffVarx_Naccorr_rec"), sample, sumWeight); + histos.fill(HIST("hEffVar1x_Naccorr_xaxis_rec"), sample, sumWeight, var1); + histos.fill(HIST("hEffVar2x_Naccorr_xaxis_rec"), sample, sumWeight, var2); + histos.fill(HIST("hEffVarx_Naccorr_xaxis_rec"), sample, sumWeight); //================= generated level============================== @@ -1254,9 +1182,9 @@ struct EventMeanPtId { return; } const auto& mcpartgen = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mccolgen.globalIndex(), cache); - histos.fill(HIST("hVtxZ_after_gen"), mccolgen.posZ()); + histos.fill(HIST("hVtxZ_after_gensim"), mccolgen.posZ()); - double nchGen = 0., nchGenAll = 0., nchGenTrue = 0.; + double nchGenAll = 0., nchGenTrue = 0.; double nchPiGen = 0., nchKaGen = 0., nchPrGen = 0.; double nch1 = 0., nch2 = 0., nch3 = 0.; double q1AllGen = 0, q2AllGen = 0.; @@ -1264,7 +1192,7 @@ struct EventMeanPtId { double var1AllGen = 0, var2AllGen = 0.; double var1PiGen = 0, var2PiGen = 0, var1KaGen = 0, var2KaGen = 0, var1PrGen = 0, var2PrGen = 0; - int sampleGen = histos.get(HIST("hVtxZ_after_gen"))->GetEntries(); + int sampleGen = histos.get(HIST("hVtxZ_after_gensim"))->GetEntries(); sampleGen = sampleGen % 30; for (const auto& mcpart : mcpartgen) { @@ -1302,10 +1230,14 @@ struct EventMeanPtId { q1AllGen += mcpart.pt(); q2AllGen += (mcpart.pt() * mcpart.pt()); histos.fill(HIST("hnch_gen_all"), nchGenAll); + histos.fill(HIST("hPtEta_gen"), mcpart.pt(), mcpart.eta()); + if (std::fabs(mcpart.y()) < cRapidityCut05) { if (mcpart.pdgCode() == PDG_t::kPiPlus || mcpart.pdgCode() == PDG_t::kPiMinus) { histos.fill(HIST("ptHistogramPion"), mcpart.pt()); + histos.fill(HIST("hPtEta_pi_gen"), mcpart.pt(), mcpart.eta()); + histos.fill(HIST("hPty_pi_gen"), mcpart.pt(), mcpart.y()); nchPiGen += 1.; q1PiGen += mcpart.pt(); q2PiGen += (mcpart.pt() * mcpart.pt()); @@ -1314,6 +1246,8 @@ struct EventMeanPtId { if (mcpart.pdgCode() == PDG_t::kKPlus || mcpart.pdgCode() == PDG_t::kKMinus) { histos.fill(HIST("ptHistogramKaon"), mcpart.pt()); + histos.fill(HIST("hPtEta_ka_gen"), mcpart.pt(), mcpart.eta()); + histos.fill(HIST("hPty_ka_gen"), mcpart.pt(), mcpart.y()); nchKaGen += 1.; q1KaGen += mcpart.pt(); q2KaGen += (mcpart.pt() * mcpart.pt()); @@ -1322,6 +1256,8 @@ struct EventMeanPtId { if (mcpart.pdgCode() == PDG_t::kProton || mcpart.pdgCode() == PDG_t::kProtonBar) { histos.fill(HIST("ptHistogramProton"), mcpart.pt()); + histos.fill(HIST("hPtEta_pr_gen"), mcpart.pt(), mcpart.eta()); + histos.fill(HIST("hPty_pr_gen"), mcpart.pt(), mcpart.y()); nchPrGen += 1.; q1PrGen += mcpart.pt(); q2PrGen += (mcpart.pt() * mcpart.pt()); @@ -1331,18 +1267,22 @@ struct EventMeanPtId { } //|y| < 0.5 cut ends! } // particle - histos.fill(HIST("hcent_nacc_gen"), cent, nchGen); + histos.fill(HIST("hcent_nacc_gen"), cent, nchGenAll); if (nchGenAll < cTwoPtlCut2) return; var1AllGen = (q1AllGen * q1AllGen - q2AllGen) / (nchGenAll * (nchGenAll - 1)); var2AllGen = (q1AllGen / nchGenAll); + histos.fill(HIST("hVar1_gen"), sampleGen, cent, var1AllGen); + histos.fill(HIST("hVar2_gen"), sampleGen, cent, var2AllGen); + histos.fill(HIST("hVarc_gen"), sampleGen, cent); + + //--------------------------Pions------------------------------------------- if (nchPiGen >= cTwoPtlCut2) { var1PiGen = (q1PiGen * q1PiGen - q2PiGen) / (nchPiGen * (nchPiGen - 1)); var2PiGen = (q1PiGen / nchPiGen); } - //----------------------- kaons --------------------------------------- if (nchKaGen >= cTwoPtlCut2) { var1KaGen = (q1KaGen * q1KaGen - q2KaGen) / (nchKaGen * (nchKaGen - 1)); From 2bea623fd1518853cda8ff8e649e66a434aabe39 Mon Sep 17 00:00:00 2001 From: CesarOmarRA <35703156+CesarOmarRA@users.noreply.github.com> Date: Mon, 11 Aug 2025 18:22:20 +0200 Subject: [PATCH 013/986] [PWGUD] Rho prime to 4 pi (#12527) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: ddobrigk Co-authored-by: Fabrizio Co-authored-by: Daiki Sekihata Co-authored-by: MaolinZH <109225729+MaolinZH@users.noreply.github.com> Co-authored-by: Vít Kučera Co-authored-by: Paola Vargas Torres <88360333+PaolaVT@users.noreply.github.com> Co-authored-by: mherzer <96999709+mherzer28@users.noreply.github.com> Co-authored-by: ALICE Action Bot Co-authored-by: BiaoZhang (张彪) <52267892+zhangbiao-phy@users.noreply.github.com> Co-authored-by: JStaa <39123272+JStaa@users.noreply.github.com> Co-authored-by: Noor Koster <82090643+cnkoster@users.noreply.github.com> Co-authored-by: Yash Patley <52608802+yashpatley@users.noreply.github.com> Co-authored-by: glromane <95305986+glromane@users.noreply.github.com> Co-authored-by: Rahul Verma <110929992+rahulverma012@users.noreply.github.com> Co-authored-by: Anton Alkin Co-authored-by: skundu692 <86804743+skundu692@users.noreply.github.com> Co-authored-by: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Co-authored-by: Dawid Karpiński <40724893+davkk@users.noreply.github.com> Co-authored-by: Evgeny Kryshen Co-authored-by: Nicolò Jacazio Co-authored-by: Jesper Gumprecht <113693781+jesgum@users.noreply.github.com> Co-authored-by: Zhenjun Xiong <108917659+zjxiongOvO@users.noreply.github.com> Co-authored-by: Marvin Hemmer <53471402+mhemmer-cern@users.noreply.github.com> Co-authored-by: Florian Jonas Co-authored-by: altsybee Co-authored-by: Md Samsul Islam <56156956+mislam17@users.noreply.github.com> Co-authored-by: ariedel-cern <85537041+ariedel-cern@users.noreply.github.com> Co-authored-by: Kangkan Goswami Co-authored-by: Stefano Cannito <143754257+scannito@users.noreply.github.com> Co-authored-by: suyoupeng <109774812+15071832337@users.noreply.github.com> Co-authored-by: Francesco Mazzaschi <43742195+fmazzasc@users.noreply.github.com> Co-authored-by: Francesco Mazzaschi Co-authored-by: Fabio Colamaria Co-authored-by: fcolamar Co-authored-by: sashingo Co-authored-by: yhambard <127940767+yhambard@users.noreply.github.com> Co-authored-by: FDUEnrich <23210190047@m.fudan.edu.cn> Co-authored-by: EmilGorm <50658075+EmilGorm@users.noreply.github.com> Co-authored-by: aimeric-landou <46970521+aimeric-landou@users.noreply.github.com> Co-authored-by: Dongguk Kim <157434406+DonggukKim0@users.noreply.github.com> Co-authored-by: hernasab Co-authored-by: Sabrina Hernandez Co-authored-by: Ionut Cristian Arsene Co-authored-by: Ionut Cristian Arsene Co-authored-by: Peter Stratmann <80676312+pestratm@users.noreply.github.com> Co-authored-by: Debadatta3337 Co-authored-by: Debadatta3337 Co-authored-by: Josué Martínez García Co-authored-by: Gyula Bencedi Co-authored-by: Anisa Khatun Co-authored-by: akhatun Co-authored-by: yuanzhe <90246048+wang-yuanzhe@users.noreply.github.com> Co-authored-by: dajones2 <140733426+dajones2@users.noreply.github.com> Co-authored-by: chengtt0406 <39661669+chengtt0406@users.noreply.github.com> Co-authored-by: Lars <146946151+ljoergen@users.noreply.github.com> Co-authored-by: Mario Ciacco Co-authored-by: omvazque Co-authored-by: Rik Spijkers <78484875+rspijkers@users.noreply.github.com> Co-authored-by: mhartung71 <50153519+mhartung71@users.noreply.github.com> Co-authored-by: Maximiliano Puccio Co-authored-by: Anantha Padmanabhan M Nair <82643666+ananthapadmanabhan18@users.noreply.github.com> Co-authored-by: Luca Aglietta <75362880+Luca610@users.noreply.github.com> Co-authored-by: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Co-authored-by: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Co-authored-by: Paul Veen (paveen) <80593165+ppoava@users.noreply.github.com> Co-authored-by: GijsvWeelden <55794847+GijsvWeelden@users.noreply.github.com> Co-authored-by: Archita-Dash <91664849+Archita-Dash@users.noreply.github.com> Co-authored-by: Jerome Jung Co-authored-by: Roman Lietava Co-authored-by: Lucia Anna Tarasovicova Co-authored-by: Lucia Anna Tarasovicova Co-authored-by: ALICE Builder Co-authored-by: lmattei01 <122298453+lmattei01@users.noreply.github.com> Co-authored-by: MATTEI Co-authored-by: Kaare Endrup Iversen <69893472+kaareendrup@users.noreply.github.com> Co-authored-by: Thorkj <154221526+Thorkj@users.noreply.github.com> Co-authored-by: Mingyu Zhang <83645570+Mingyu3360715@users.noreply.github.com> Co-authored-by: Sigurd Nese <32108009+sigurdnese@users.noreply.github.com> Co-authored-by: Samuele Cattaruzzi <124249902+scattaru@users.noreply.github.com> Co-authored-by: cterrevo Co-authored-by: Fabrizio Chinu <91954233+fchinu@users.noreply.github.com> Co-authored-by: Sergio Garcia <47090312+singiamtel@users.noreply.github.com> Co-authored-by: Ravindra Singh <56298081+singhra1994@users.noreply.github.com> Co-authored-by: blacwovie Co-authored-by: a-m-andrushko <96832230+a-m-andrushko@users.noreply.github.com> Co-authored-by: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Co-authored-by: Nida Malik Co-authored-by: Hirak Koley Co-authored-by: sarjeetagami <162087855+sarjeetagami@users.noreply.github.com> Co-authored-by: sarjeeta gami Co-authored-by: basiach <74355517+basiach@users.noreply.github.com> Co-authored-by: Barbara Chytla Co-authored-by: Shyam Kumar Co-authored-by: Oleksii Lubynets Co-authored-by: Zhengqing Wang Co-authored-by: Rrantu <156880782+Rrantu@users.noreply.github.com> Co-authored-by: Felix Schlepper Co-authored-by: Sandeep Dudi <69388148+sdudi123@users.noreply.github.com> Co-authored-by: sandeep dudi Co-authored-by: prottayCMT <61418725+prottayCMT@users.noreply.github.com> Co-authored-by: Prottay Das Co-authored-by: Simone Ragoni <47641042+siragoni@users.noreply.github.com> Co-authored-by: creetz16 <79141119+creetz16@users.noreply.github.com> Co-authored-by: ynishida-style Co-authored-by: spucillo <93769017+spucillo@users.noreply.github.com> Co-authored-by: Javier Castillo Castellanos Co-authored-by: marcobianchi463 <121625445+marcobianchi463@users.noreply.github.com> Co-authored-by: Artem Kotliarov <71133985+KotliarovAr@users.noreply.github.com> Co-authored-by: Preet-Bhanjan Co-authored-by: Preet Pati Co-authored-by: romainschotter Co-authored-by: jaelpark Co-authored-by: Francesca Ercolessi Co-authored-by: YubiaoWang Co-authored-by: Rashi gupta <167059733+rashigupt@users.noreply.github.com> Co-authored-by: Rashi Gupta Co-authored-by: dyx-11 <1260971129@qq.com> Co-authored-by: Banajit Barman <113376372+BanajitBarman@users.noreply.github.com> Co-authored-by: fuchuncui <162277233+fuchuncui@users.noreply.github.com> Co-authored-by: sawan <124118453+sawankumawat@users.noreply.github.com> Co-authored-by: Sawan Sawan --- PWGUD/Tasks/upcRhoPrimeAnalysis.cxx | 613 ++++++++++++++++------------ 1 file changed, 351 insertions(+), 262 deletions(-) diff --git a/PWGUD/Tasks/upcRhoPrimeAnalysis.cxx b/PWGUD/Tasks/upcRhoPrimeAnalysis.cxx index 49b6e478674..c1ebc114efa 100644 --- a/PWGUD/Tasks/upcRhoPrimeAnalysis.cxx +++ b/PWGUD/Tasks/upcRhoPrimeAnalysis.cxx @@ -21,318 +21,407 @@ #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" -#include "Math/Vector4D.h" // similiar to TLorentzVector (which is now legacy apparently) +#include "Math/Vector4D.h" +#include "TH1F.h" +#include "TH2F.h" #include "random" -#include // Para std::string -#include // Para std::vector +#include +#include +#include using namespace o2; using namespace o2::framework; -using namespace o2::framework::expressions; -using FullUDSgCollision = soa::Join::iterator; -using FullUDTracks = soa::Join; +// Define UD tables +using UDtracks = soa::Join; +using UDCollisions = soa::Join; namespace o2::aod { namespace fourpi { - -// for event -DECLARE_SOA_COLUMN(RunNumber, runNumber, int32_t); - -// for rho prime -DECLARE_SOA_COLUMN(M, m, double); -DECLARE_SOA_COLUMN(Pt, pt, double); -DECLARE_SOA_COLUMN(Eta, eta, double); -DECLARE_SOA_COLUMN(Phi, phi, double); - -// for vertex -DECLARE_SOA_COLUMN(PosX, posX, double); -DECLARE_SOA_COLUMN(PosY, posY, double); -DECLARE_SOA_COLUMN(PosZ, posZ, double); - -// for other -DECLARE_SOA_COLUMN(TotalCharge, totalCharge, int); - -// info detec -DECLARE_SOA_COLUMN(TotalFT0AmplitudeA, totalFT0AmplitudeA, float); -DECLARE_SOA_COLUMN(TotalFT0AmplitudeC, totalFT0AmplitudeC, float); -DECLARE_SOA_COLUMN(TotalFV0AmplitudeA, totalFV0AmplitudeA, float); -DECLARE_SOA_COLUMN(TotalFDDAmplitudeA, totalFDDAmplitudeA, float); -DECLARE_SOA_COLUMN(TotalFDDAmplitudeC, totalFDDAmplitudeC, float); -DECLARE_SOA_COLUMN(TimeFT0A, timeFT0A, float); -DECLARE_SOA_COLUMN(TimeFT0C, timeFT0C, float); -DECLARE_SOA_COLUMN(TimeFV0A, timeFV0A, float); -DECLARE_SOA_COLUMN(TimeFDDA, timeFDDA, float); -DECLARE_SOA_COLUMN(TimeFDDC, timeFDDC, float); - -// for pion tracks -DECLARE_SOA_COLUMN(NumContrib, numContrib, int32_t); -DECLARE_SOA_COLUMN(Sign, sign, std::vector); -DECLARE_SOA_COLUMN(TrackPt, trackPt, std::vector); -DECLARE_SOA_COLUMN(TrackEta, trackEta, std::vector); -DECLARE_SOA_COLUMN(TrackPhi, trackPhi, std::vector); -DECLARE_SOA_COLUMN(TPCNSigmaEl, tpcNSigmaEl, std::vector); -DECLARE_SOA_COLUMN(TPCNSigmaPi, tpcNSigmaPi, std::vector); -DECLARE_SOA_COLUMN(TPCNSigmaKa, tpcNSigmaKa, std::vector); -DECLARE_SOA_COLUMN(TPCNSigmaPr, tpcNSigmaPr, std::vector); -DECLARE_SOA_COLUMN(TrackID, trackID, std::vector); - -// for others -DECLARE_SOA_COLUMN(IsReconstructedWithUPC, isReconstructedWithUPC, bool); -DECLARE_SOA_COLUMN(TimeZNA, timeZNA, float); -DECLARE_SOA_COLUMN(TimeZNC, timeZNC, float); -DECLARE_SOA_COLUMN(EnergyCommonZNA, energyCommonZNA, float); -DECLARE_SOA_COLUMN(EnergyCommonZNC, energyCommonZNC, float); -DECLARE_SOA_COLUMN(IsChargeZero, isChargeZero, bool); - -DECLARE_SOA_COLUMN(OccupancyInTime, occupancyInTime, int); -DECLARE_SOA_COLUMN(HadronicRate, hadronicRate, double); - +// Declare columns +DECLARE_SOA_COLUMN(RunNumber, runNumber, int32_t); // Run number for event identification +DECLARE_SOA_COLUMN(M, m, double); // Invariant mass of the system +DECLARE_SOA_COLUMN(Pt, pt, double); // Transverse momentum of the system +DECLARE_SOA_COLUMN(Eta, eta, double); // Pseudorapidity of the system +DECLARE_SOA_COLUMN(Phi, phi, double); // Azimuthal angle of the system +DECLARE_SOA_COLUMN(PosX, posX, double); // Vertex X position +DECLARE_SOA_COLUMN(PosY, posY, double); // Vertex Y position +DECLARE_SOA_COLUMN(PosZ, posZ, double); // Vertex Z position +DECLARE_SOA_COLUMN(TotalCharge, totalCharge, int); // Total charge of selected tracks +DECLARE_SOA_COLUMN(TotalFT0AmplitudeA, totalFT0AmplitudeA, float); // FT0A amplitude +DECLARE_SOA_COLUMN(TotalFT0AmplitudeC, totalFT0AmplitudeC, float); // FT0C amplitude +DECLARE_SOA_COLUMN(TotalFV0AmplitudeA, totalFV0AmplitudeA, float); // FV0A amplitude +DECLARE_SOA_COLUMN(NumContrib, numContrib, int32_t); // Number of primary vertex contributors +DECLARE_SOA_COLUMN(Sign, sign, std::vector); // Track charges +DECLARE_SOA_COLUMN(TrackPt, trackPt, std::vector); // Track pT values +DECLARE_SOA_COLUMN(TrackEta, trackEta, std::vector); // Track eta values +DECLARE_SOA_COLUMN(TrackPhi, trackPhi, std::vector); // Track phi values +DECLARE_SOA_COLUMN(TPCNSigmaEl, tpcNSigmaEl, std::vector); // TPC nσ for electrons +DECLARE_SOA_COLUMN(TPCNSigmaPi, tpcNSigmaPi, std::vector); // TPC nσ for pions +DECLARE_SOA_COLUMN(TPCNSigmaKa, tpcNSigmaKa, std::vector); // TPC nσ for kaons +DECLARE_SOA_COLUMN(TPCNSigmaPr, tpcNSigmaPr, std::vector); // TPC nσ for protons +DECLARE_SOA_COLUMN(TrackID, trackID, std::vector); // Track identifiers +DECLARE_SOA_COLUMN(IsReconstructedWithUPC, isReconstructedWithUPC, bool); // UPC mode reconstruction flag +DECLARE_SOA_COLUMN(TimeZNA, timeZNA, float); // ZNA timing +DECLARE_SOA_COLUMN(TimeZNC, timeZNC, float); // ZNC timing +DECLARE_SOA_COLUMN(EnergyCommonZNA, energyCommonZNA, float); // ZNA energy +DECLARE_SOA_COLUMN(EnergyCommonZNC, energyCommonZNC, float); // ZNC energy +DECLARE_SOA_COLUMN(IsChargeZero, isChargeZero, bool); // Neutral system flag +DECLARE_SOA_COLUMN(OccupancyInTime, occupancyInTime, int); // Occupancy in time +DECLARE_SOA_COLUMN(HadronicRate, hadronicRate, double); // Hadronic interaction rate } // namespace fourpi -DECLARE_SOA_TABLE(SYSTEMTREE, "AOD", "SystemTree", fourpi::RunNumber, fourpi::M, fourpi::Pt, fourpi::Eta, fourpi::Phi, - fourpi::PosX, fourpi::PosY, fourpi::PosZ, fourpi::TotalCharge, fourpi::TotalFT0AmplitudeA, fourpi::TotalFT0AmplitudeC, fourpi::TotalFV0AmplitudeA, - fourpi::TotalFDDAmplitudeA, fourpi::TotalFDDAmplitudeC, fourpi::TimeFT0A, fourpi::TimeFT0C, fourpi::TimeFV0A, fourpi::TimeFDDA, fourpi::TimeFDDC, - fourpi::NumContrib, fourpi::Sign, fourpi::TrackPt, fourpi::TrackEta, fourpi::TrackPhi, - fourpi::TPCNSigmaEl, fourpi::TPCNSigmaPi, fourpi::TPCNSigmaKa, fourpi::TPCNSigmaPr, fourpi::TrackID, fourpi::IsReconstructedWithUPC, - fourpi::TimeZNA, fourpi::TimeZNC, fourpi::EnergyCommonZNA, fourpi::EnergyCommonZNC, fourpi::IsChargeZero, fourpi::OccupancyInTime, fourpi::HadronicRate); +// Define the output +DECLARE_SOA_TABLE(SYSTEMTREE, "AOD", "SystemTree", + fourpi::RunNumber, fourpi::M, fourpi::Pt, fourpi::Eta, fourpi::Phi, + fourpi::PosX, fourpi::PosY, fourpi::PosZ, fourpi::TotalCharge, + fourpi::TotalFT0AmplitudeA, fourpi::TotalFT0AmplitudeC, fourpi::TotalFV0AmplitudeA, + fourpi::NumContrib, + fourpi::Sign, fourpi::TrackPt, fourpi::TrackEta, fourpi::TrackPhi, + fourpi::TPCNSigmaEl, fourpi::TPCNSigmaPi, fourpi::TPCNSigmaKa, fourpi::TPCNSigmaPr, + fourpi::TrackID, fourpi::IsReconstructedWithUPC, + fourpi::TimeZNA, fourpi::TimeZNC, fourpi::EnergyCommonZNA, fourpi::EnergyCommonZNC, + fourpi::IsChargeZero, fourpi::OccupancyInTime, fourpi::HadronicRate); } // namespace o2::aod struct upcRhoPrimeAnalysis { Produces systemTree; - double PcEtaCut = 0.9; // physics coordination recommendation - + // System selection configuration + Configurable systemYCut{"systemYCut", 0.5, "Max Rapidity of rho prime"}; + Configurable systemPtCut{"systemPtCut", 0.1, "Min Pt of rho prime"}; + Configurable systemMassMinCut{"systemMassMinCut", 0.8, "Min Mass of rho prime"}; + Configurable systemMassMaxCut{"systemMassMaxCut", 2.2, "Max Mass of rho prime"}; + Configurable etaCut{"etaCut", 0.9, "Track Pseudorapidity"}; + + // Event selection configuration + Configurable vZCut{"vZCut", 10.0, "Cut on vertex Z position"}; + Configurable numPVContrib{"numPVContrib", 4, "Number of PV contributors"}; + Configurable fv0Cut{"fv0Cut", 50.0, "FV0 amplitude cut"}; + Configurable ft0aCut{"ft0aCut", 50.0, "FT0A amplitude cut"}; + Configurable ft0cCut{"ft0cCut", 50.0, "FT0C amplitude cut"}; + Configurable zdcCut{"zdcCut", 0.0, "ZDC energy cut"}; + Configurable sbpCut{"sbpCut", true, "SBP cut"}; + Configurable itsROFbCut{"itsROFbCut", true, "ITS ROFb cut"}; + Configurable vtxITSTPCcut{"vtxITSTPCcut", true, "Vertex ITS-TPC cut"}; + Configurable tfbCut{"tfbCut", true, "TFB cut"}; Configurable specifyGapSide{"specifyGapSide", true, "specify gap side for SG/DG produced data"}; Configurable gapSide{"gapSide", 2, "gap side for SG produced data"}; - Configurable requireTof{"requireTof", false, "require TOF signal"}; - - Configurable collisionsPosZMaxCut{"collisionsPosZMaxCut", 10.0, "max Z position cut on collisions"}; - Configurable ZNcommonEnergyCut{"ZNcommonEnergyCut", 0.0, "ZN common energy cut"}; - Configurable ZNtimeCut{"ZNtimeCut", 2.0, "ZN time cut"}; - - Configurable tracksTpcNSigmaPiCut{"tracksTpcNSigmaPiCut", 3.0, "TPC nSigma pion cut"}; - Configurable tracksDcaMaxCut{"tracksDcaMaxCut", 1.0, "max DCA cut on tracks"}; - - Configurable systemMassMinCut{"systemMassMinCut", 0.8, "min M cut for reco system"}; - Configurable systemMassMaxCut{"systemMassMaxCut", 2.2, "max M cut for reco system"}; - Configurable systemPtCut{"systemPtMaxCut", 0.1, "max pT cut for reco system"}; - Configurable systemYCut{"systemYCut", 0.9, "rapiditiy cut for reco system"}; - - ConfigurableAxis mAxis{"mAxis", {1000, 0.0, 10.0}, "m (GeV/#it{c}^{2})"}; - ConfigurableAxis mCutAxis{"mCutAxis", {70, 0.5, 1.2}, "m (GeV/#it{c}^{2})"}; - ConfigurableAxis ptAxis{"ptAxis", {1000, 0.0, 10.0}, "p_{T} (GeV/#it{c})"}; - ConfigurableAxis ptCutAxis{"ptCutAxis", {300, 0.0, 0.3}, "p_{T} (GeV/#it{c})"}; - ConfigurableAxis pt2Axis{"pt2Axis", {300, 0.0, 0.09}, "p_{T}^{2} (GeV^{2}/#it{c}^{2})"}; - ConfigurableAxis etaAxis{"etaAxis", {180, -0.9, 0.9}, "#eta"}; - ConfigurableAxis yAxis{"yAxis", {180, -0.9, 0.9}, "y"}; - ConfigurableAxis phiAxis{"phiAxis", {180, 0.0, o2::constants::math::TwoPI}, "#phi"}; - ConfigurableAxis phiAsymmAxis{"phiAsymmAxis", {182, -o2::constants::math::PI, o2::constants::math::PI}, "#phi"}; - ConfigurableAxis momentumFromPhiAxis{"momentumFromPhiAxis", {400, -0.1, 0.1}, "p (GeV/#it{c})"}; - ConfigurableAxis ptQuantileAxis{"ptQuantileAxis", {0, 0.0181689, 0.0263408, 0.0330488, 0.0390369, 0.045058, 0.0512604, 0.0582598, 0.066986, 0.0788085, 0.1}, "p_{T} (GeV/#it{c})"}; - - HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; - - void init(o2::framework::InitContext&) + + // Track selection configuration + Configurable useOnlyPVtracks{"useOnlyPVtracks", true, "Use only PV tracks"}; + Configurable tpcChi2NClsCut{"tpcChi2NClsCut", 5.0, "TPC chi2/N clusters cut"}; + Configurable itsChi2NClsCut{"itsChi2NClsCut", 36.0, "ITS chi2/N clusters cut"}; + Configurable nSigmaTPCcut{"nSigmaTPCcut", 5.0, "TPC nSigma cut"}; + Configurable dcaXYcut{"dcaXYcut", 0, "dcaXY cut"}; + Configurable dcaZcut{"dcaZcut", 2, "dcaZ cut"}; + Configurable minTPCFindableClusters{"minTPCFindableClusters", 70, "Minimum number of findable TPC clusters"}; + + // Define histogram registry + HistogramRegistry registry{ + "registry", + {// Event flow histograms + {"Events/Flow", "Event flow;Cut;Counts", {HistType::kTH1F, {{9, 0, 9}}}}, + {"Events/VertexZ", "Vertex Z;z (cm);Counts", {HistType::kTH1F, {{200, -20, 20}}}}, + {"Events/NumContrib", "Number of contributors;N_{contrib};Counts", {HistType::kTH1F, {{100, 0, 100}}}}, + {"Events/FV0Amplitude", "FV0 amplitude;Amplitude;Counts", {HistType::kTH1F, {{200, 0, 200}}}}, + {"Events/FT0AmplitudeA", "FT0A amplitude;Amplitude;Counts", {HistType::kTH1F, {{200, 0, 200}}}}, + {"Events/FT0AmplitudeC", "FT0C amplitude;Amplitude;Counts", {HistType::kTH1F, {{200, 0, 200}}}}, + {"Events/ZDCEnergy", "ZDC energy;Energy (TeV);Counts", {HistType::kTH1F, {{200, 0, 2}}}}, + + // Track quality histograms + {"Tracks/Pt", "Track p_{T};p_{T} (GeV/c);Counts", {HistType::kTH1F, {{200, 0, 2}}}}, + {"Tracks/Eta", "Track #eta;#eta;Counts", {HistType::kTH1F, {{200, -2, 2}}}}, + {"Tracks/TPCNSigmaPi", "TPC n#sigma for #pi;n#sigma;Counts", {HistType::kTH1F, {{200, -10, 10}}}}, + {"Tracks/TPCChi2NCl", "TPC #chi^{2}/N_{cls};#chi^{2}/N_{cls};Counts", {HistType::kTH1F, {{200, 0, 20}}}}, + {"Tracks/ITSChi2NCl", "ITS #chi^{2}/N_{cls};#chi^{2}/N_{cls};Counts", {HistType::kTH1F, {{200, 0, 50}}}}, + {"Tracks/RejectionReasons", "Track rejection reasons;Reason;Counts", {HistType::kTH1F, {{12, 0, 12}}}}, + {"Tracks/DCASpectrum", "Track DCA spectrum;DCA (cm);Counts", {HistType::kTH1F, {{100, 0, 5}}}}, + {"Tracks/ChargeDistribution", "Track charge distribution;Charge;Counts", {HistType::kTH1F, {{3, -1.5, 1.5}}}}, + {"Tracks/TPCClusters", "TPC clusters findable;N_{clusters};Counts", {HistType::kTH1F, {{100, 0, 200}}}}, + + // System kinematics histograms + {"System/hM", ";m (GeV/#it{c}^{2});counts", {HistType::kTH1F, {{1000, 0.0, 10.0}}}}, + {"System/hPt", ";p_{T} (GeV/#it{c});counts", {HistType::kTH1F, {{1000, 0.0, 10.0}}}}, + {"System/hEta", ";#eta;counts", {HistType::kTH1F, {{180, -0.9, 0.9}}}}, + {"System/hPhi", ";#phi;counts", {HistType::kTH1F, {{180, 0.0, 6.28}}}}, + {"System/hY", ";y;counts", {HistType::kTH1F, {{180, -0.9, 0.9}}}}, + + // Comparison histograms + {"Cuts/MBefore", "Mass before cuts;m (GeV/c^{2});Counts", {HistType::kTH1F, {{1000, 0, 10}}}}, + {"Cuts/MAfter", "Mass after cuts;m (GeV/c^{2});Counts", {HistType::kTH1F, {{1000, 0, 10}}}}, + {"Cuts/PtBefore", "p_{T} before cuts;p_{T} (GeV/c);Counts", {HistType::kTH1F, {{1000, 0, 1}}}}, + {"Cuts/PtAfter", "p_{T} after cuts;p_{T} (GeV/c);Counts", {HistType::kTH1F, {{1000, 0, 10}}}}}}; + + void init(InitContext&) { - // selection counter - std::vector selectionCounterLabels = {"all tracks", "PV contributor", "ITS + TPC hit", "TOF requirement", "DCA cut", "#eta cut", "2D TPC n#sigma_{#pi} cut"}; - - // 4PI SYSTEM - // registry.add("4pi/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mAxis}); - // registry.add("4pi/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); - // registry.add("4pi/hEta", ";Eta (1);counts", kTH1D, {etaAxis}); - // registry.add("4pi/hPhi", ";Phi ();counts", kTH1D, {phiAxis}); + // Configure event flow histogram labels + auto hFlow = registry.get(HIST("Events/Flow")); + hFlow->GetXaxis()->SetBinLabel(1, "All events"); + hFlow->GetXaxis()->SetBinLabel(2, "ITS-TPC cut"); + hFlow->GetXaxis()->SetBinLabel(3, "SBP cut"); + hFlow->GetXaxis()->SetBinLabel(4, "ITS ROFb cut"); + hFlow->GetXaxis()->SetBinLabel(5, "TFB cut"); + hFlow->GetXaxis()->SetBinLabel(6, "Gap Side cut"); + hFlow->GetXaxis()->SetBinLabel(7, "PV contrib cut"); + hFlow->GetXaxis()->SetBinLabel(8, "Z vtx cut"); + hFlow->GetXaxis()->SetBinLabel(9, "4 tracks cut"); + + // Configure track rejection reasons histogram labels + auto hReject = registry.get(HIST("Tracks/RejectionReasons")); + hReject->GetXaxis()->SetBinLabel(1, "All Tracks"); + hReject->GetXaxis()->SetBinLabel(2, "PV Contributor"); + hReject->GetXaxis()->SetBinLabel(3, "Has ITS+TPC"); + hReject->GetXaxis()->SetBinLabel(4, "pT > 0.1 GeV/c"); + hReject->GetXaxis()->SetBinLabel(5, "TPC chi2/cluster"); + hReject->GetXaxis()->SetBinLabel(6, "ITS chi2/cluster"); + hReject->GetXaxis()->SetBinLabel(7, "TPC clusters findable"); + hReject->GetXaxis()->SetBinLabel(8, "TPC nSigmaPi"); + hReject->GetXaxis()->SetBinLabel(9, "Eta acceptance"); + hReject->GetXaxis()->SetBinLabel(10, "DCAz cut"); + hReject->GetXaxis()->SetBinLabel(11, "DCAxy cut"); + hReject->GetXaxis()->SetBinLabel(12, "Accepted Tracks"); } - template - bool collisionPassesCuts(const C& collision) // collision cuts + void process(UDCollisions::iterator const& collision, UDtracks const& tracks) { - if (std::abs(collision.posZ()) > collisionsPosZMaxCut) - return false; + // Count all processed events + registry.fill(HIST("Events/Flow"), 0); + + // Fill basic event diagnostics + registry.fill(HIST("Events/VertexZ"), collision.posZ()); + registry.fill(HIST("Events/NumContrib"), collision.numContrib()); + registry.fill(HIST("Events/FV0Amplitude"), collision.totalFV0AmplitudeA()); + registry.fill(HIST("Events/FT0AmplitudeA"), collision.totalFT0AmplitudeA()); + registry.fill(HIST("Events/FT0AmplitudeC"), collision.totalFT0AmplitudeC()); + registry.fill(HIST("Events/ZDCEnergy"), collision.energyCommonZNA()); + registry.fill(HIST("Events/ZDCEnergy"), collision.energyCommonZNC()); + + // Apply event selection cuts in sequence + if (collision.vtxITSTPC() != vtxITSTPCcut) + return; + registry.fill(HIST("Events/Flow"), 1); + + if (collision.sbp() != sbpCut) + return; + registry.fill(HIST("Events/Flow"), 2); + + if (collision.itsROFb() != itsROFbCut) + return; + registry.fill(HIST("Events/Flow"), 3); + + if (collision.tfb() != tfbCut) + return; + registry.fill(HIST("Events/Flow"), 4); + if (specifyGapSide && collision.gapSide() != gapSide) - return false; - return true; - } + return; + if (collision.totalFV0AmplitudeA() > fv0Cut) + return; + if (collision.totalFT0AmplitudeA() > ft0aCut) + return; + if (collision.totalFT0AmplitudeC() > ft0cCut) + return; + if (collision.energyCommonZNA() > zdcCut || collision.energyCommonZNC() > zdcCut) + return; + registry.fill(HIST("Events/Flow"), 5); - template - bool trackPassesCuts(const T& track) // track cuts (PID done separately) - { - if (!track.isPVContributor()) - return false; - if (!track.hasITS() || !track.hasTPC()) - return false; - if (requireTof && !track.hasTOF()) - return false; - if (std::abs(track.dcaZ()) > tracksDcaMaxCut || std::abs(track.dcaXY()) > (0.0182 + 0.0350 / std::pow(track.pt(), 1.01))) // Run 2 dynamic DCA cut - return false; - if (std::abs(eta(track.px(), track.py(), track.pz())) > PcEtaCut) - return false; - return true; - } + if (collision.numContrib() != numPVContrib) + return; + registry.fill(HIST("Events/Flow"), 6); - template - bool tracksPassPiPID(const T& cutTracks) // n-dimensional PID cut - { - double radius = 0.0; - for (const auto& track : cutTracks) - radius += std::pow(track.tpcNSigmaPi(), 2); - return radius < std::pow(tracksTpcNSigmaPiCut, 2); - } + if (std::abs(collision.posZ()) > vZCut) + return; + registry.fill(HIST("Events/Flow"), 7); - template - double tracksTotalCharge(const T& cutTracks) // total charge of selected tracks - { - double charge = 0.0; - for (const auto& track : cutTracks) - charge += track.sign(); - return charge; - } + std::vector posPions; + std::vector negPions; + posPions.reserve(2); + negPions.reserve(2); - bool systemPassCuts(const ROOT::Math::PxPyPzMVector& system) // system cuts - { - if (system.M() < systemMassMinCut || system.M() > systemMassMaxCut) - return false; - if (system.Pt() > systemPtCut) - return false; - if (std::abs(system.Rapidity()) > systemYCut) - return false; - return true; - } + // Loop over all tracks in the event + for (const auto& track : tracks) { + registry.fill(HIST("Tracks/RejectionReasons"), 0); // Count all tracks - ROOT::Math::PxPyPzMVector reconstructSystem(const std::vector& cutTracks4Vecs) // reconstruct system from 4-vectors - { - ROOT::Math::PxPyPzMVector system; - for (const auto& track4Vec : cutTracks4Vecs) - system += track4Vec; - return system; - } + // Track selection criteria applied in sequence: + if (useOnlyPVtracks && !track.isPVContributor()) { + registry.fill(HIST("Tracks/RejectionReasons"), 1); + continue; + } - double deltaPhi(const ROOT::Math::PxPyPzMVector& p1, const ROOT::Math::PxPyPzMVector& p2) - { - double dPhi = p1.Phi() - p2.Phi(); - if (dPhi > o2::constants::math::PI) - dPhi -= o2::constants::math::TwoPI; - else if (dPhi < -o2::constants::math::PI) - dPhi += o2::constants::math::TwoPI; - return dPhi; // calculate delta phi in (-pi, pi) - } + if (!track.hasITS() || !track.hasTPC()) { + registry.fill(HIST("Tracks/RejectionReasons"), 2); + continue; + } - double getPhiRandom(const std::vector& cutTracks4Vecs) // decay phi anisotropy - { // two possible definitions of phi: randomize the tracks - std::vector indices = {0, 1}; - unsigned seed = std::chrono::system_clock::now().time_since_epoch().count(); // get time-based seed - std::shuffle(indices.begin(), indices.end(), std::default_random_engine(seed)); // shuffle indices - // calculate phi - ROOT::Math::PxPyPzMVector pOne = cutTracks4Vecs[indices[0]]; - ROOT::Math::PxPyPzMVector pTwo = cutTracks4Vecs[indices[1]]; - ROOT::Math::PxPyPzMVector pPlus = pOne + pTwo; - ROOT::Math::PxPyPzMVector pMinus = pOne - pTwo; - return deltaPhi(pPlus, pMinus); - } + // Fill track spectra + registry.fill(HIST("Tracks/Pt"), track.pt()); + registry.fill(HIST("Tracks/Eta"), eta(track.px(), track.py(), track.pz())); + registry.fill(HIST("Tracks/TPCNSigmaPi"), track.tpcNSigmaPi()); + registry.fill(HIST("Tracks/TPCChi2NCl"), track.tpcChi2NCl()); + registry.fill(HIST("Tracks/ITSChi2NCl"), track.itsChi2NCl()); + registry.fill(HIST("Tracks/DCASpectrum"), std::hypot(track.dcaXY(), track.dcaZ())); + registry.fill(HIST("Tracks/ChargeDistribution"), track.sign()); + registry.fill(HIST("Tracks/TPCClusters"), track.tpcNClsFindable()); + + if (track.pt() <= 0.1f) { + registry.fill(HIST("Tracks/RejectionReasons"), 3); + continue; + } - template - double getPhiCharge(const T& cutTracks, const std::vector& cutTracks4Vecs) - { // two possible definitions of phi: charge-based assignment - ROOT::Math::PxPyPzMVector pOne, pTwo; - if (cutTracks[0].sign() > 0) { - pOne = cutTracks4Vecs[0]; - pTwo = cutTracks4Vecs[1]; - } else { - pOne = cutTracks4Vecs[1]; - pTwo = cutTracks4Vecs[0]; - } - ROOT::Math::PxPyPzMVector pPlus = pOne + pTwo; - ROOT::Math::PxPyPzMVector pMinus = pOne - pTwo; - return deltaPhi(pPlus, pMinus); - } + if (track.tpcChi2NCl() > tpcChi2NClsCut) { + registry.fill(HIST("Tracks/RejectionReasons"), 4); + continue; + } + if (track.itsChi2NCl() > itsChi2NClsCut) { + registry.fill(HIST("Tracks/RejectionReasons"), 5); + continue; + } - void processReco(FullUDSgCollision const& collision, FullUDTracks const& tracks) - { + if (track.tpcNClsFindable() < minTPCFindableClusters) { + registry.fill(HIST("Tracks/RejectionReasons"), 6); + continue; + } - if (!collisionPassesCuts(collision)) - return; + if (std::abs(track.tpcNSigmaPi()) > nSigmaTPCcut) { + registry.fill(HIST("Tracks/RejectionReasons"), 7); + continue; + } - // vectors for storing selected tracks and their 4-vectors - std::vector cutTracks; - std::vector cutTracks4Vecs; + float trackEta = eta(track.px(), track.py(), track.pz()); + if (std::abs(trackEta) > etaCut) { + registry.fill(HIST("Tracks/RejectionReasons"), 8); + continue; + } - // int trackCounter = 0; - for (const auto& track : tracks) { + if (std::abs(track.dcaZ()) > dcaZcut) { + registry.fill(HIST("Tracks/RejectionReasons"), 9); + continue; + } - if (!trackPassesCuts(track)) + float maxDCAxy = 0.0105 + 0.035 / std::pow(track.pt(), 1.1); + if (dcaXYcut == 0 && (std::fabs(track.dcaXY()) > maxDCAxy)) { + registry.fill(HIST("Tracks/RejectionReasons"), 10); continue; - // trackCounter++; - cutTracks.push_back(track); - cutTracks4Vecs.push_back(ROOT::Math::PxPyPzMVector(track.px(), track.py(), track.pz(), o2::constants::physics::MassPionCharged)); // apriori assume pion mass + } else if (dcaXYcut != 0 && (std::fabs(track.dcaXY()) > dcaXYcut)) { + registry.fill(HIST("Tracks/RejectionReasons"), 10); + continue; + } + + // Track passed all selection criteria + registry.fill(HIST("Tracks/RejectionReasons"), 11); + + if (track.sign() > 0 && posPions.size() < 2) { + posPions.push_back(track); + } else if (track.sign() < 0 && negPions.size() < 2) { + negPions.push_back(track); + } + + if (posPions.size() == 2 && negPions.size() == 2) + break; } - if (!tracksPassPiPID(cutTracks)) + if (posPions.size() != 2 || negPions.size() != 2) { return; - // reonstruct system and calculate total charge, save commonly used values into variables - ROOT::Math::PxPyPzMVector system = reconstructSystem(cutTracks4Vecs); - int totalCharge = tracksTotalCharge(cutTracks); - int nTracks = cutTracks.size(); - double mass = system.M(); - double pT = system.Pt(); - // double pTsquare = pT * pT; - double rapidity = system.Rapidity(); - double systemPhi = system.Phi() + o2::constants::math::PI; - - if (nTracks == 4) { - bool isChargeZero = (tracksTotalCharge(cutTracks) == 0); - - std::vector vTrackPt, vTrackEta, vTrackPhi; - std::vector vSign, vTrackID; - std::vector vTpcNSigmaEl, vTpcNSigmaPi, vTpcNSigmaKa, vTpcNSigmaPr; - - for (size_t i = 0; i < cutTracks.size(); i++) { - double tPt = cutTracks[i].pt(); - double tEta = eta(cutTracks[i].px(), cutTracks[i].py(), cutTracks[i].pz()); - double tPhi = phi(cutTracks[i].px(), cutTracks[i].py()); - - vTrackPt.push_back(tPt); - vTrackEta.push_back(tEta); - vTrackPhi.push_back(tPhi); - vSign.push_back(cutTracks[i].sign()); - vTpcNSigmaEl.push_back(cutTracks[i].tpcNSigmaEl()); - vTpcNSigmaPi.push_back(cutTracks[i].tpcNSigmaPi()); - vTpcNSigmaKa.push_back(cutTracks[i].tpcNSigmaKa()); - vTpcNSigmaPr.push_back(cutTracks[i].tpcNSigmaPr()); - - vTrackID.push_back(i); - } + } + registry.fill(HIST("Events/Flow"), 8); + + std::vector selectedTracks; + selectedTracks.insert(selectedTracks.end(), posPions.begin(), posPions.end()); + selectedTracks.insert(selectedTracks.end(), negPions.begin(), negPions.end()); + + // Reconstruct the 4-pion system + ROOT::Math::PxPyPzMVector fourPionSystem; + std::vector pionFourVectors; + + for (const auto& track : selectedTracks) { + ROOT::Math::PxPyPzMVector pionVec( + track.px(), track.py(), track.pz(), + o2::constants::physics::MassPionCharged); + fourPionSystem += pionVec; + pionFourVectors.push_back(pionVec); + } - bool isReconstructedWithUPC = false; + // Fill pre-cut system histograms + registry.fill(HIST("Cuts/MBefore"), fourPionSystem.M()); + registry.fill(HIST("Cuts/PtBefore"), fourPionSystem.Pt()); - if (collision.flags() == 1) { - isReconstructedWithUPC = true; - } else { - isReconstructedWithUPC = false; - } + // Apply system-level kinematic cuts + if (fourPionSystem.M() < systemMassMinCut || fourPionSystem.M() > systemMassMaxCut) + return; + if (fourPionSystem.Pt() > systemPtCut) + return; + if (std::abs(fourPionSystem.Rapidity()) > systemYCut) + return; - systemTree(collision.runNumber(), mass, pT, rapidity, systemPhi, - collision.posX(), collision.posY(), collision.posZ(), totalCharge, - collision.totalFT0AmplitudeA(), collision.totalFT0AmplitudeC(), collision.timeFV0A(), - collision.totalFDDAmplitudeA(), collision.totalFDDAmplitudeC(), - collision.timeFT0A(), collision.timeFT0C(), collision.timeFV0A(), - collision.timeFDDA(), collision.timeFDDC(), collision.numContrib(), - vSign, vTrackPt, vTrackEta, vTrackPhi, - vTpcNSigmaEl, vTpcNSigmaPi, vTpcNSigmaKa, vTpcNSigmaPr, - vTrackID, isReconstructedWithUPC, collision.timeZNA(), collision.timeZNC(), - collision.energyCommonZNA(), collision.energyCommonZNC(), - isChargeZero, collision.occupancyInTime(), collision.hadronicRate()); + // Fill post-cut system histograms + registry.fill(HIST("Cuts/MAfter"), fourPionSystem.M()); + registry.fill(HIST("Cuts/PtAfter"), fourPionSystem.Pt()); + registry.fill(HIST("System/hM"), fourPionSystem.M()); + registry.fill(HIST("System/hPt"), fourPionSystem.Pt()); + registry.fill(HIST("System/hEta"), fourPionSystem.Eta()); + registry.fill(HIST("System/hPhi"), fourPionSystem.Phi() + o2::constants::math::PI); + registry.fill(HIST("System/hY"), fourPionSystem.Rapidity()); + + std::vector trackPts, trackEtas, trackPhis; + std::vector trackSigns, trackIDs; + std::vector tpcNSigmasEl, tpcNSigmasPi, tpcNSigmasKa, tpcNSigmasPr; + + for (size_t i = 0; i < selectedTracks.size(); i++) { + const auto& track = selectedTracks[i]; + trackPts.push_back(track.pt()); + trackEtas.push_back(eta(track.px(), track.py(), track.pz())); + trackPhis.push_back(phi(track.px(), track.py())); + trackSigns.push_back(track.sign()); + tpcNSigmasEl.push_back(track.tpcNSigmaEl()); + tpcNSigmasPi.push_back(track.tpcNSigmaPi()); + tpcNSigmasKa.push_back(track.tpcNSigmaKa()); + tpcNSigmasPr.push_back(track.tpcNSigmaPr()); + trackIDs.push_back(i); } - // std::cout<<"Hello World"<(cfgc)}; + adaptAnalysisTask(cfgc)}; } From 4417c4e9ac6666469b40f208c903960870834cb5 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Mon, 11 Aug 2025 19:02:16 +0200 Subject: [PATCH 014/986] [PWGEM/Dilepton] remove collinear from treeCreatorElectronMLDDA.cxx (#12522) --- .../treeCreatorElectronMLDDA.cxx | 41 +++++++++---------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx index 81e914de7bb..ef773ae86a9 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx @@ -207,7 +207,6 @@ struct TreeCreatorElectronMLDDA { Configurable cfg_includeITSsa{"cfg_includeITSsa", false, "Flag to include ITSsa tracks"}; Configurable cfg_max_pt_itssa{"cfg_max_pt_itssa", 0.15, "mix pt for ITSsa track"}; Configurable cfg_min_qt_strangeness{"cfg_min_qt_strangeness", 0.015, "min qt for Lambda and K0S"}; - Configurable cfg_require_collinearV0{"cfg_require_collinearV0", false, "require collinear V0 for photon conversions"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -5, "min n sigma e in TPC"}; Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +5, "max n sigma e in TPC"}; @@ -749,7 +748,7 @@ struct TreeCreatorElectronMLDDA { Partition negTracks = o2::aod::track::signed1Pt < 0.f && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true; std::vector stored_trackIds; - void processPID(filteredMyCollisions const& collisions, aod::BCsWithTimestamps const&, filteredV0s const& v0s, filteredCascades const& cascades, MyTracks const& tracks, aod::V0s const&) + void processPID(filteredMyCollisions const& collisions, aod::BCsWithTimestamps const&, filteredV0s const& v0s, filteredCascades const& cascades, MyTracks const& tracks) { stored_trackIds.reserve(tracks.size()); for (const auto& collision : collisions) { @@ -769,7 +768,7 @@ struct TreeCreatorElectronMLDDA { auto v0s_coll = v0s.sliceBy(perCollision_v0, collision.globalIndex()); for (const auto& v0 : v0s_coll) { - auto o2v0 = v0.template v0_as(); + // auto o2v0 = v0.template v0_as(); auto pos = v0.template posTrack_as(); auto neg = v0.template negTrack_as(); // LOGF(info, "v0.globalIndex() = %d, v0.collisionId() = %d, v0.posTrackId() = %d, v0.negTrackId() = %d", v0.globalIndex(), v0.collisionId(), v0.posTrackId(), v0.negTrackId()); @@ -833,27 +832,25 @@ struct TreeCreatorElectronMLDDA { } } // end of stangeness - if (!v0cuts.cfg_require_collinearV0 || o2v0.isCollinearV0()) { - if (isElectronTight(pos) && isElectron(neg)) { - registry.fill(HIST("V0/hMassGamma"), v0.mGamma()); - registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma()); - if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) { - registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y()); - fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)); - registry.fill(HIST("V0/hTPCdEdx_P_El"), neg.tpcInnerParam(), neg.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_El"), neg.tpcInnerParam(), neg.beta()); - } + if (isElectronTight(pos) && isElectron(neg)) { + registry.fill(HIST("V0/hMassGamma"), v0.mGamma()); + registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma()); + if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) { + registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y()); + fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)); + registry.fill(HIST("V0/hTPCdEdx_P_El"), neg.tpcInnerParam(), neg.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_El"), neg.tpcInnerParam(), neg.beta()); } + } - if (isElectron(pos) && isElectronTight(neg)) { - registry.fill(HIST("V0/hMassGamma"), v0.mGamma()); - registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma()); - if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) { - registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y()); - fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)); - registry.fill(HIST("V0/hTPCdEdx_P_El"), pos.tpcInnerParam(), pos.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_El"), pos.tpcInnerParam(), pos.beta()); - } + if (isElectron(pos) && isElectronTight(neg)) { + registry.fill(HIST("V0/hMassGamma"), v0.mGamma()); + registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma()); + if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) { + registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y()); + fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)); + registry.fill(HIST("V0/hTPCdEdx_P_El"), pos.tpcInnerParam(), pos.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_El"), pos.tpcInnerParam(), pos.beta()); } } From 4bc93157088fdce7245b5449c16758101f85446b Mon Sep 17 00:00:00 2001 From: JStaa <39123272+JStaa@users.noreply.github.com> Date: Mon, 11 Aug 2025 19:08:28 +0200 Subject: [PATCH 015/986] [PWGCF] Changed the configuration of the trackFilters function (#12530) --- .../Tasks/threeParticleCorrelations.cxx | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx b/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx index 1a50269aa9b..4bd814039cc 100644 --- a/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx +++ b/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx @@ -45,7 +45,7 @@ struct ThreeParticleCorrelations { // Track PID parameters double pionID = 0.0, kaonID = 1.0, protonID = 2.0; - float nSigma0 = 0.0, nSigma2 = 2.0, nSigma4 = 4.0, nSigma5 = 5.0; + float nSigma0 = 0.0, nSigma1 = 1.0, nSigma2 = 2.0, nSigma4 = 4.0, nSigma5 = 5.0; // V0 filter parameters float tpcNCrossedRowsMin = 70.0; @@ -55,8 +55,8 @@ struct ThreeParticleCorrelations { int dcaV0DauMax = 1; // Track filter parameters - float pionPtMin = 0.3, pionPtMax = 2.3, kaonPtMin = 0.5, kaonPtMax = 2.5, protonPtMin = 0.5, protonPtMax = 2.5; - float pionPtMid = 1.5, kaonPtMid1 = 1.5, kaonPtMid2 = 2.0, protonPtMid = 0.7; + float pionPtMin = 0.3, pionPtMax = 2.3, kaonPtMin = 0.5, kaonPtMax = 2.3, protonPtMin = 0.6; + float pionPtMid1 = 1.6, pionPtMid2 = 2.0, kaonPtMid1 = 1.5, kaonPtMid2 = 2.0, protonPtMid = 2.3; // RD filter parameters float dEtaMax = 0.05, dEtaMin = 0.023; @@ -1002,11 +1002,15 @@ struct ThreeParticleCorrelations { } if (track.pt() < pionPtMin) { return false; - } else if (track.pt() > pionPtMin && track.pt() < pionPtMid) { + } else if (track.pt() > pionPtMin && track.pt() < pionPtMid1) { if (std::abs(track.tofNSigmaPi()) >= nSigma4) { return false; } - } else if (track.pt() > pionPtMid && track.pt() < pionPtMax) { + } else if (track.pt() > pionPtMid1 && track.pt() < pionPtMid2) { + if (track.tofNSigmaPi() <= -nSigma4 || track.tofNSigmaPi() >= -nSigma2) { + return false; + } + } else if (track.pt() > pionPtMid2 && track.pt() < pionPtMax) { if (track.tofNSigmaPi() <= -nSigma4 || track.tofNSigmaPi() >= nSigma0) { return false; } @@ -1025,7 +1029,7 @@ struct ThreeParticleCorrelations { return false; } } else if (track.pt() > kaonPtMid1 && track.pt() < kaonPtMid2) { - if (track.tofNSigmaKa() <= -nSigma2 || track.tofNSigmaKa() >= nSigma4) { + if (track.tofNSigmaKa() <= -nSigma1 || track.tofNSigmaKa() >= nSigma4) { return false; } } else if (track.pt() > kaonPtMid2 && track.pt() < kaonPtMax) { @@ -1043,14 +1047,10 @@ struct ThreeParticleCorrelations { if (track.pt() < protonPtMin) { return false; } else if (track.pt() > protonPtMin && track.pt() < protonPtMid) { - if (track.tofNSigmaPr() <= -nSigma2 || track.tofNSigmaPr() >= nSigma4) { - return false; - } - } else if (track.pt() > protonPtMid && track.pt() < protonPtMax) { if (std::abs(track.tofNSigmaPr()) >= nSigma4) { return false; } - } else if (track.pt() > protonPtMax) { + } else if (track.pt() > protonPtMid) { if (track.tofNSigmaPr() <= -nSigma2 || track.tofNSigmaPr() >= nSigma4) { return false; } From aa41a45f0bb70b1a93801150a6722bd599d02393 Mon Sep 17 00:00:00 2001 From: Matteo Morgante Date: Mon, 11 Aug 2025 20:50:09 +0200 Subject: [PATCH 016/986] [PWGLF] Added pt cut configurable for generated mc particles (#12532) Co-authored-by: ALICE Action Bot --- .../Strangeness/sigmaminustask.cxx | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx b/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx index c9b2d58f08c..e6441c413e0 100644 --- a/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx +++ b/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx @@ -56,6 +56,7 @@ struct sigmaminustask { Configurable cutRapMotherMC{"cutRapMotherMC", 1.0f, "Rapidity cut for mother Sigma in MC"}; Configurable cutMinQtAP{"cutMinQtAP", 0.15f, "Minimum Qt for Armenteros-Podolanski cut"}; Configurable cutMaxQtAP{"cutMaxQtAP", 0.20f, "Maximum Qt for Armenteros-Podolanski cut"}; + Configurable cutPtGen{"cutPtGen", 0.5f, "Minimum pT for generated sigma particles"}; Configurable fillOutputTree{"fillOutputTree", true, "If true, fill the output tree with Kink candidates"}; @@ -129,6 +130,7 @@ struct sigmaminustask { rSigmaMinus.add("h2DCAMothPt", "h2DCAMothPt", {HistType::kTH2F, {ptAxis, dcaMothAxis}}); rSigmaMinus.add("h2DCADaugPt", "h2DCADaugPt", {HistType::kTH2F, {ptAxis, dcaDaugAxis}}); rSigmaMinus.add("h2ArmenterosPreCuts", "h2ArmenterosPreCuts", {HistType::kTH2F, {alphaAPAxis, qtAPAxis}}); + rSigmaMinus.add("h2ArmenterosPostCuts", "h2ArmenterosPostCuts", {HistType::kTH2F, {alphaAPAxis, qtAPAxis}}); rSigmaMinus.add("h2CosPointingAnglePt", "h2CosPointingAnglePt", {HistType::kTH2F, {ptAxis, cosPointingAngleAxis}}); if (doprocessMC) { @@ -179,10 +181,10 @@ struct sigmaminustask { rFindable.add("h2PtDaugFilter_plus_pikink", "h2PtDaugFilter_plus_pikink", {HistType::kTH2F, {filtersAxis, ptUnsignedAxis}}); rFindable.add("h2PtDaugFilter_minus_pikink", "h2PtDaugFilter_minus_pikink", {HistType::kTH2F, {filtersAxis, ptUnsignedAxis}}); - rFindable.add("h2DCAMothPt_protonkink", "h2DCAMothPt_protonkink", {HistType::kTH2F, {ptAxis, dcaMothAxis}}); - rFindable.add("h2DCADaugPt_protonkink", "h2DCADaugPt_protonkink", {HistType::kTH2F, {ptAxis, dcaDaugAxis}}); - rFindable.add("h2DCAMothPt_pikink", "h2DCAMothPt_pikink", {HistType::kTH2F, {ptAxis, dcaMothAxis}}); - rFindable.add("h2DCADaugPt_pikink", "h2DCADaugPt_pikink", {HistType::kTH2F, {ptAxis, dcaDaugAxis}}); + rFindable.add("h2DCAMothPt_protonkink", "h2DCAMothPt_protonkink", {HistType::kTH2F, {ptUnsignedAxis, dcaMothAxis}}); + rFindable.add("h2DCADaugPt_protonkink", "h2DCADaugPt_protonkink", {HistType::kTH2F, {ptUnsignedAxis, dcaDaugAxis}}); + rFindable.add("h2DCAMothPt_pikink", "h2DCAMothPt_pikink", {HistType::kTH2F, {ptUnsignedAxis, dcaMothAxis}}); + rFindable.add("h2DCADaugPt_pikink", "h2DCADaugPt_pikink", {HistType::kTH2F, {ptUnsignedAxis, dcaDaugAxis}}); } } @@ -252,7 +254,7 @@ struct sigmaminustask { std::array{0.0f, 0.0f, 0.0f}, std::array{kinkCand.xDecVtx(), kinkCand.yDecVtx(), kinkCand.zDecVtx()}); rSigmaMinus.fill(HIST("h2CosPointingAnglePt"), kinkCand.mothSign() * kinkCand.ptMoth(), cosPointingAngleRec); - + rSigmaMinus.fill(HIST("h2ArmenterosPostCuts"), alphaAPValue, qtValue); rSigmaMinus.fill(HIST("h2MassSigmaMinusPt"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus()); rSigmaMinus.fill(HIST("h2SigmaMassVsXiMass"), kinkCand.mXiMinus(), kinkCand.mSigmaMinus()); rSigmaMinus.fill(HIST("h2NSigmaTPCPiPt"), kinkCand.mothSign() * kinkCand.ptMoth(), dauTrack.tpcNSigmaPi()); @@ -354,7 +356,7 @@ struct sigmaminustask { rSigmaMinus.fill(HIST("h2DCAMothPt"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.dcaMothPv()); rSigmaMinus.fill(HIST("h2DCADaugPt"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.dcaDaugPv()); rSigmaMinus.fill(HIST("h2CosPointingAnglePt"), kinkCand.mothSign() * kinkCand.ptMoth(), cosPointingAngleRec); - + rSigmaMinus.fill(HIST("h2ArmenterosPostCuts"), alphaAPValue, qtValue); if (std::abs(mcTrackPiDau.pdgCode()) == 211) { rSigmaMinus.fill(HIST("h2NSigmaTOFPiPt"), kinkCand.mothSign() * kinkCand.ptMoth(), dauTrack.tofNSigmaPi()); } else if (std::abs(mcTrackPiDau.pdgCode()) == 2212) { @@ -383,6 +385,11 @@ struct sigmaminustask { if ((std::abs(mcPart.pdgCode()) != 3112 && std::abs(mcPart.pdgCode()) != 3222) || std::abs(mcPart.y()) > cutRapMotherMC) { // only sigma mothers and rapidity cut continue; } + + if (mcPart.pt() < cutPtGen) { + continue; // Skip if pT is below threshold + } + if (!mcPart.has_daughters()) { continue; // Skip if no daughters } @@ -531,7 +538,7 @@ struct sigmaminustask { // Compute useful quantities for histograms bool isSigmaMinus = (std::abs(mcMother.pdgCode()) == 3112); bool isPiDaughter = (std::abs(mcDaughter.pdgCode()) == 211); - int sigmaSign = mcMother.pdgCode() > 0 ? 1 : -1; + float recPtDaughter = daughterTrack.pt(); float recPtMother = motherTrack.pt(); float mcRadius = std::sqrt((mcMother.vx() - mcDaughter.vx()) * (mcMother.vx() - mcDaughter.vx()) + (mcMother.vy() - mcDaughter.vy()) * (mcMother.vy() - mcDaughter.vy())); @@ -617,11 +624,11 @@ struct sigmaminustask { float dcaXYMother = std::abs(dcaInfoMoth[0]); float dcaXYDaughter = std::abs(dcaInfoDaug[0]); if (isPiDaughter) { - rFindable.fill(HIST("h2DCAMothPt_pikink"), sigmaSign * recPtMother, dcaXYMother); - rFindable.fill(HIST("h2DCADaugPt_pikink"), sigmaSign * recPtDaughter, dcaXYDaughter); + rFindable.fill(HIST("h2DCAMothPt_pikink"), recPtMother, dcaXYMother); + rFindable.fill(HIST("h2DCADaugPt_pikink"), recPtDaughter, dcaXYDaughter); } else { - rFindable.fill(HIST("h2DCAMothPt_protonkink"), sigmaSign * recPtMother, dcaXYMother); - rFindable.fill(HIST("h2DCADaugPt_protonkink"), sigmaSign * recPtDaughter, dcaXYDaughter); + rFindable.fill(HIST("h2DCAMothPt_protonkink"), recPtMother, dcaXYMother); + rFindable.fill(HIST("h2DCADaugPt_protonkink"), recPtDaughter, dcaXYDaughter); } // 6 - max Z difference From 0dfdc4321c0a4808b6c2365f04aa97ff323f0057 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Mon, 11 Aug 2025 21:25:30 +0200 Subject: [PATCH 017/986] [PWGEM/Dilepton] use pin instead of ppv (#12533) --- PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx index ef773ae86a9..704a7d79112 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx @@ -593,7 +593,7 @@ struct TreeCreatorElectronMLDDA { // float dcaZ = mDcaInfoCov.getZ(); if (pidlabel == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)) { - if (trackParCov.getP() < max_p_for_downscaling_electron) { + if (track.tpcInnerParam() < max_p_for_downscaling_electron) { if (dist01(engine) > downscaling_electron_lowP) { return; } @@ -603,7 +603,7 @@ struct TreeCreatorElectronMLDDA { } } } else if (pidlabel == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)) { - if (trackParCov.getP() < max_p_for_downscaling_pion) { + if (track.tpcInnerParam() < max_p_for_downscaling_pion) { if (dist01(engine) > downscaling_pion_lowP) { return; } @@ -613,7 +613,7 @@ struct TreeCreatorElectronMLDDA { } } } else if (pidlabel == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kKaon)) { - if (trackParCov.getP() < max_p_for_downscaling_kaon) { + if (track.tpcInnerParam() < max_p_for_downscaling_kaon) { if (dist01(engine) > downscaling_kaon_lowP) { return; } @@ -623,7 +623,7 @@ struct TreeCreatorElectronMLDDA { } } } else if (pidlabel == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton)) { - if (trackParCov.getP() < max_p_for_downscaling_proton) { + if (track.tpcInnerParam() < max_p_for_downscaling_proton) { if (dist01(engine) > downscaling_proton_lowP) { return; } From 33ef9725bc6a991dc0537854007c8f6b007ea6f2 Mon Sep 17 00:00:00 2001 From: omvazque Date: Mon, 11 Aug 2025 16:48:51 -0500 Subject: [PATCH 018/986] [PWGLF] NPV-based rejection for light-ion data (#12537) --- PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx index f0e6012d4a4..69db7b49952 100644 --- a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx @@ -227,6 +227,7 @@ struct UccZdc { const char* tiT0C{"T0C (#times 1/100, -3.3 < #eta < -2.1)"}; const char* tiT0M{"T0A+T0C (#times 1/100, -3.3 < #eta < -2.1 and 3.5 < #eta < 4.9)"}; const char* tiNch{"#it{N}_{ch} (|#eta| < 0.8)"}; + const char* tiNPV{"#it{N}_{PV} (|#eta|<1)"}; const char* tiV0A{"V0A (#times 1/100, 2.2 < #eta < 5)"}; const char* tiZNs{"ZNA + ZNC"}; const char* tiZPs{"ZPA + ZPC"}; @@ -250,6 +251,7 @@ struct UccZdc { registry.add("ExcludedEvtVsFT0M", Form(";%s;Entries;", tiT0M), kTH1F, {{nBinsAmpFT0, 0., maxAmpFT0}}); registry.add("ExcludedEvtVsFV0A", Form(";%s;Entries;", tiT0M), kTH1F, {{nBinsAmpV0A, 0., maxAmpV0A}}); registry.add("ExcludedEvtVsNch", Form(";%s;Entries;", tiNch), kTH1F, {{nBinsNch, minNch, maxNch}}); + registry.add("ExcludedEvtVsNPV", Form(";%s;Entries;", tiNPV), kTH1F, {{nBinsITSTrack, 0, maxITSTrack}}); registry.add("Nch", Form(";%s;Entries;", tiNch), kTH1F, {{nBinsNch, minNch, maxNch}}); registry.add("NchVsOneParCorr", Form(";%s;%s;", tiNch, tiOneParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); @@ -549,6 +551,7 @@ struct UccZdc { } } + const double nPV{collision.multNTracksPVeta1() / 1.}; const double normT0M{(aT0A + aT0C) / 100.}; const double normV0A{aV0A / 100.}; const double normT0A{aT0A / 100.}; @@ -619,6 +622,9 @@ struct UccZdc { if (s1 == "V0A") { xEval = normV0A; } + if (s1 == "NPV") { + xEval = nPV; + } const int bin4Calibration{cfgNch.hMeanNch->FindBin(xEval)}; const double meanNch{cfgNch.hMeanNch->GetBinContent(bin4Calibration)}; @@ -630,6 +636,7 @@ struct UccZdc { registry.fill(HIST("ExcludedEvtVsFT0M"), normT0M); registry.fill(HIST("ExcludedEvtVsFV0A"), normV0A); registry.fill(HIST("ExcludedEvtVsNch"), glbTracks); + registry.fill(HIST("ExcludedEvtVsNPV"), nPV); skipEvent = true; } } @@ -725,6 +732,7 @@ struct UccZdc { } } + const double nPV{collision.multNTracksPVeta1() / 1.}; const double normT0M{(aT0A + aT0C) / 100.}; const double normV0A{aV0A / 100.}; float znA{foundBC.zdc().amplitudeZNA()}; @@ -802,6 +810,9 @@ struct UccZdc { if (s1 == "V0A") { xEval = normV0A; } + if (s1 == "NPV") { + xEval = nPV; + } const int bin4Calibration{cfgNch.hMeanNch->FindBin(xEval)}; const double meanNch{cfgNch.hMeanNch->GetBinContent(bin4Calibration)}; @@ -813,6 +824,7 @@ struct UccZdc { registry.fill(HIST("ExcludedEvtVsFT0M"), normT0M); registry.fill(HIST("ExcludedEvtVsFV0A"), normV0A); registry.fill(HIST("ExcludedEvtVsNch"), glbTracks); + registry.fill(HIST("ExcludedEvtVsNPV"), nPV); skipEvent = true; } } From c3a6f250baaea4454deeefe22efeeaffed211a6f Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Tue, 12 Aug 2025 01:47:32 +0200 Subject: [PATCH 019/986] [PWGLF] Add V0 Vs Phi vs Eta histograms (#12538) --- .../derivedlambdakzeroanalysis.cxx | 44 +++++++++++++------ 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx index 2c872c3500f..fb3255fb412 100644 --- a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx @@ -203,6 +203,7 @@ struct derivedlambdakzeroanalysis { Configurable doTPCQA{"doTPCQA", false, "do TPC QA histograms"}; Configurable doTOFQA{"doTOFQA", false, "do TOF QA histograms"}; Configurable doDetectPropQA{"doDetectPropQA", 0, "do Detector/ITS map QA: 0: no, 1: 4D, 2: 5D with mass; 3: plain in 3D"}; + Configurable doEtaPhiQA{"doEtaPhiQA", false, "do Eta/Phi QA histograms"}; Configurable doPlainTopoQA{"doPlainTopoQA", true, "do simple 1D QA of candidates"}; Configurable qaMinPt{"qaMinPt", 0.0f, "minimum pT for QA plots"}; @@ -715,6 +716,11 @@ struct derivedlambdakzeroanalysis { histos.add("K0Short/h3dPositiveTPCcrossedRows", "h3dPositiveTPCcrossedRows", kTH3D, {axisCentrality, axisPtCoarse, axisTPCrows}); histos.add("K0Short/h3dNegativeTPCcrossedRows", "h3dNegativeTPCcrossedRows", kTH3D, {axisCentrality, axisPtCoarse, axisTPCrows}); } + if (doEtaPhiQA) { + histos.add("K0Short/h5dV0PhiVsEta", "h5dV0PhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisK0Mass, axisPhi, axisEta}); + histos.add("K0Short/h5dPosPhiVsNegPhi", "h5dPosPhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisK0Mass, axisPhi, axisPhi}); + histos.add("K0Short/h5dPosEtaVsNegEta", "h5dNegPhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisK0Mass, axisEta, axisEta}); + } } if (analyseLambda) { histos.add("h2dNbrOfLambdaVsCentrality", "h2dNbrOfLambdaVsCentrality", kTH2D, {axisCentrality, {10, -0.5f, 9.5f}}); @@ -782,6 +788,11 @@ struct derivedlambdakzeroanalysis { histos.add("Lambda/h3dPositiveTPCcrossedRows", "h3dPositiveTPCcrossedRows", kTH3D, {axisCentrality, axisPtCoarse, axisTPCrows}); histos.add("Lambda/h3dNegativeTPCcrossedRows", "h3dNegativeTPCcrossedRows", kTH3D, {axisCentrality, axisPtCoarse, axisTPCrows}); } + if (doEtaPhiQA) { + histos.add("Lambda/h5dV0PhiVsEta", "h5dV0PhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisPhi, axisEta}); + histos.add("Lambda/h5dPosPhiVsNegPhi", "h5dPosPhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisPhi, axisPhi}); + histos.add("Lambda/h5dPosEtaVsNegEta", "h5dNegPhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisEta, axisEta}); + } } if (analyseAntiLambda) { histos.add("h2dNbrOfAntiLambdaVsCentrality", "h2dNbrOfAntiLambdaVsCentrality", kTH2D, {axisCentrality, {10, -0.5f, 9.5f}}); @@ -849,6 +860,11 @@ struct derivedlambdakzeroanalysis { histos.add("AntiLambda/h3dPositiveTPCcrossedRows", "h3dPositiveTPCcrossedRows", kTH3D, {axisCentrality, axisPtCoarse, axisTPCrows}); histos.add("AntiLambda/h3dNegativeTPCcrossedRows", "h3dNegativeTPCcrossedRows", kTH3D, {axisCentrality, axisPtCoarse, axisTPCrows}); } + if (doEtaPhiQA) { + histos.add("AntiLambda/h5dV0PhiVsEta", "h5dV0PhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisPhi, axisEta}); + histos.add("AntiLambda/h5dPosPhiVsNegPhi", "h5dPosPhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisPhi, axisPhi}); + histos.add("AntiLambda/h5dPosEtaVsNegEta", "h5dNegPhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisEta, axisEta}); + } } if (analyseLambda && calculateFeeddownMatrix && (doprocessMonteCarloRun3 || doprocessMonteCarloRun2)) @@ -868,7 +884,6 @@ struct derivedlambdakzeroanalysis { histos.add("K0Short/h4dDCADaughters", "h4dDCADaughters", kTHnD, {axisCentrality, axisPtCoarse, axisK0Mass, axisDCAdau}); histos.add("K0Short/h4dPointingAngle", "h4dPointingAngle", kTHnD, {axisCentrality, axisPtCoarse, axisK0Mass, axisPointingAngle}); histos.add("K0Short/h4dV0Radius", "h4dV0Radius", kTHnD, {axisCentrality, axisPtCoarse, axisK0Mass, axisV0Radius}); - histos.add("K0Short/h4dV0PhiVsEta", "h4dV0PhiVsEta", kTHnD, {axisPtCoarse, axisK0Mass, axisPhi, axisEta}); } if (analyseLambda) { histos.add("Lambda/h4dPosDCAToPV", "h4dPosDCAToPV", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisDCAtoPV}); @@ -876,7 +891,6 @@ struct derivedlambdakzeroanalysis { histos.add("Lambda/h4dDCADaughters", "h4dDCADaughters", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisDCAdau}); histos.add("Lambda/h4dPointingAngle", "h4dPointingAngle", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisPointingAngle}); histos.add("Lambda/h4dV0Radius", "h4dV0Radius", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisV0Radius}); - histos.add("Lambda/h4dV0PhiVsEta", "h4dV0PhiVsEta", kTHnD, {axisPtCoarse, axisK0Mass, axisPhi, axisEta}); } if (analyseAntiLambda) { histos.add("AntiLambda/h4dPosDCAToPV", "h4dPosDCAToPV", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisDCAtoPV}); @@ -884,7 +898,6 @@ struct derivedlambdakzeroanalysis { histos.add("AntiLambda/h4dDCADaughters", "h4dDCADaughters", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisDCAdau}); histos.add("AntiLambda/h4dPointingAngle", "h4dPointingAngle", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisPointingAngle}); histos.add("AntiLambda/h4dV0Radius", "h4dV0Radius", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisV0Radius}); - histos.add("AntiLambda/h4dV0PhiVsEta", "h4dV0PhiVsEta", kTHnD, {axisPtCoarse, axisK0Mass, axisPhi, axisEta}); } } @@ -1496,6 +1509,11 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("K0Short/h3dPosTOFdeltaTvsTrackPt"), centrality, v0.positivept(), v0.posTOFDeltaTK0Pi()); histos.fill(HIST("K0Short/h3dNegTOFdeltaTvsTrackPt"), centrality, v0.negativept(), v0.negTOFDeltaTK0Pi()); } + if (doEtaPhiQA) { + histos.fill(HIST("K0Short/h5dV0PhiVsEta"), centrality, pt, v0.mK0Short(), v0.phi(), v0.eta()); + histos.fill(HIST("K0Short/h5dPosPhiVsNegPhi"), centrality, pt, v0.mK0Short(), v0.positivephi(), v0.negativephi()); + histos.fill(HIST("K0Short/h5dPosEtaVsNegEta"), centrality, pt, v0.mK0Short(), v0.positiveeta(), v0.negativeeta()); + } nK0Shorts++; } if (passLambdaSelections && analyseLambda) { @@ -1570,6 +1588,11 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("Lambda/h3dPosTOFdeltaTvsTrackPt"), centrality, v0.positivept(), v0.posTOFDeltaTLaPr()); histos.fill(HIST("Lambda/h3dNegTOFdeltaTvsTrackPt"), centrality, v0.negativept(), v0.negTOFDeltaTLaPi()); } + if (doEtaPhiQA) { + histos.fill(HIST("Lambda/h5dV0PhiVsEta"), centrality, pt, v0.mLambda(), v0.phi(), v0.eta()); + histos.fill(HIST("Lambda/h5dPosPhiVsNegPhi"), centrality, pt, v0.mLambda(), v0.positivephi(), v0.negativephi()); + histos.fill(HIST("Lambda/h5dPosEtaVsNegEta"), centrality, pt, v0.mLambda(), v0.positiveeta(), v0.negativeeta()); + } nLambdas++; } if (passAntiLambdaSelections && analyseAntiLambda) { @@ -1644,6 +1667,11 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("AntiLambda/h3dPosTOFdeltaTvsTrackPt"), centrality, v0.positivept(), v0.posTOFDeltaTLaPi()); histos.fill(HIST("AntiLambda/h3dNegTOFdeltaTvsTrackPt"), centrality, v0.negativept(), v0.negTOFDeltaTLaPr()); } + if (doEtaPhiQA) { + histos.fill(HIST("AntiLambda/h5dV0PhiVsEta"), centrality, pt, v0.mAntiLambda(), v0.phi(), v0.eta()); + histos.fill(HIST("AntiLambda/h5dPosPhiVsNegPhi"), centrality, pt, v0.mAntiLambda(), v0.positivephi(), v0.negativephi()); + histos.fill(HIST("AntiLambda/h5dPosEtaVsNegEta"), centrality, pt, v0.mAntiLambda(), v0.positiveeta(), v0.negativeeta()); + } nAntiLambdas++; } @@ -1661,11 +1689,7 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("K0Short/h4dPointingAngle"), centrality, pt, v0.mK0Short(), std::acos(v0.v0cosPA())); if (verifyMask(selMap, maskTopoNoDCAV0Dau | maskK0ShortSpecific)) histos.fill(HIST("K0Short/h4dDCADaughters"), centrality, pt, v0.mK0Short(), v0.dcaV0daughters()); - - if (passK0ShortSelections) - histos.fill(HIST("K0Short/h4dV0PhiVsEta"), pt, v0.mK0Short(), v0.phi(), v0.eta()); } - if (analyseLambda) { if (verifyMask(selMap, maskTopoNoV0Radius | maskLambdaSpecific)) histos.fill(HIST("Lambda/h4dV0Radius"), centrality, pt, v0.mLambda(), v0.v0radius()); @@ -1677,9 +1701,6 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("Lambda/h4dPointingAngle"), centrality, pt, v0.mLambda(), std::acos(v0.v0cosPA())); if (verifyMask(selMap, maskTopoNoDCAV0Dau | maskLambdaSpecific)) histos.fill(HIST("Lambda/h4dDCADaughters"), centrality, pt, v0.mLambda(), v0.dcaV0daughters()); - - if (passLambdaSelections) - histos.fill(HIST("Lambda/h4dV0PhiVsEta"), pt, v0.mLambda(), v0.phi(), v0.eta()); } if (analyseAntiLambda) { if (verifyMask(selMap, maskTopoNoV0Radius | maskAntiLambdaSpecific)) @@ -1692,9 +1713,6 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("AntiLambda/h4dPointingAngle"), centrality, pt, v0.mAntiLambda(), std::acos(v0.v0cosPA())); if (verifyMask(selMap, maskTopoNoDCAV0Dau | maskAntiLambdaSpecific)) histos.fill(HIST("AntiLambda/h4dDCADaughters"), centrality, pt, v0.mAntiLambda(), v0.dcaV0daughters()); - - if (passAntiLambdaSelections) - histos.fill(HIST("AntiLambda/h4dV0PhiVsEta"), pt, v0.mAntiLambda(), v0.phi(), v0.eta()); } } // end systematics / qa } From c19f94d12d1386e398598977b1814229ce132ba4 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Tue, 12 Aug 2025 02:56:57 +0200 Subject: [PATCH 020/986] [PWGEM/Dilepton] update treeCreatorElectronMLDDA.cxx (#12539) --- PWGEM/Dilepton/Core/Dilepton.h | 2 +- PWGEM/Dilepton/Core/DileptonHadronMPC.h | 38 ++++++-- PWGEM/Dilepton/Core/DileptonMC.h | 2 +- PWGEM/Dilepton/Core/DimuonCut.h | 8 +- .../treeCreatorElectronMLDDA.cxx | 94 +++++++++---------- 5 files changed, 82 insertions(+), 62 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 2ded13ca237..929932d4269 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -757,7 +757,7 @@ struct Dilepton { fDimuonCut.SetTrackEtaRange(dimuoncuts.cfg_min_eta_track, dimuoncuts.cfg_max_eta_track); fDimuonCut.SetTrackPhiRange(dimuoncuts.cfg_min_phi_track, dimuoncuts.cfg_max_phi_track); fDimuonCut.SetNClustersMFT(dimuoncuts.cfg_min_ncluster_mft, 10); - fDimuonCut.SetNClustersMCHMID(dimuoncuts.cfg_min_ncluster_mch, 16); + fDimuonCut.SetNClustersMCHMID(dimuoncuts.cfg_min_ncluster_mch, 20); fDimuonCut.SetChi2(0.f, dimuoncuts.cfg_max_chi2); fDimuonCut.SetMatchingChi2MCHMFT(0.f, dimuoncuts.cfg_max_matching_chi2_mftmch); fDimuonCut.SetMatchingChi2MCHMID(0.f, dimuoncuts.cfg_max_matching_chi2_mchmid); diff --git a/PWGEM/Dilepton/Core/DileptonHadronMPC.h b/PWGEM/Dilepton/Core/DileptonHadronMPC.h index 9efb785a21a..e59fc87ad3c 100644 --- a/PWGEM/Dilepton/Core/DileptonHadronMPC.h +++ b/PWGEM/Dilepton/Core/DileptonHadronMPC.h @@ -658,7 +658,7 @@ struct DileptonHadronMPC { fDimuonCut.SetTrackEtaRange(dimuoncuts.cfg_min_eta_track, dimuoncuts.cfg_max_eta_track); fDimuonCut.SetTrackPhiRange(dimuoncuts.cfg_min_phi_track, dimuoncuts.cfg_max_phi_track); fDimuonCut.SetNClustersMFT(dimuoncuts.cfg_min_ncluster_mft, 10); - fDimuonCut.SetNClustersMCHMID(dimuoncuts.cfg_min_ncluster_mch, 16); + fDimuonCut.SetNClustersMCHMID(dimuoncuts.cfg_min_ncluster_mch, 20); fDimuonCut.SetChi2(0.f, dimuoncuts.cfg_max_chi2); fDimuonCut.SetMatchingChi2MCHMFT(0.f, dimuoncuts.cfg_max_matching_chi2_mftmch); fDimuonCut.SetMatchingChi2MCHMID(0.f, dimuoncuts.cfg_max_matching_chi2_mchmid); @@ -954,8 +954,8 @@ struct DileptonHadronMPC { return true; } - template - bool fillHadronHadron(TCollision const& collision, TRefTrack const& t1, TRefTrack const& t2, TLeptons const& posLeptons, TLeptons const& negLeptons) + template + bool fillHadronHadron(TCollision const& collision, TRefTrack const& t1, TRefTrack const& t2, TLeptons const& posLeptons, TLeptons const& negLeptons, TLeptonCut const& cut) { if constexpr (ev_id == 0) { if (!fEMTrackCut.IsSelected(t1) || !fEMTrackCut.IsSelected(t2)) { // for charged track @@ -965,17 +965,37 @@ struct DileptonHadronMPC { // Leptons should not be in reference track sample. if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { for (const auto& pos : posLeptons) { // leptons per collision + if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { + if (!cut.template IsSelectedTrack(pos, collision)) { + continue; + } + } else { // cut based + if (!cut.template IsSelectedTrack(pos)) { + continue; + } + } if (t1.trackId() == pos.trackId() || t2.trackId() == pos.trackId()) { return false; } - } + } // end of pos lepton loop + for (const auto& neg : negLeptons) { // leptons per collision + if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { + if (!cut.template IsSelectedTrack(neg, collision)) { + continue; + } + } else { // cut based + if (!cut.template IsSelectedTrack(neg)) { + continue; + } + } if (t1.trackId() == neg.trackId() || t2.trackId() == neg.trackId()) { return false; } - } - } - } + } // end of neg lepton lopp + + } // end of if kDielectron + } // end of if same event if constexpr (ev_id == 1) { if (t1.dfId() == t2.dfId() && t1.globalIndex() == t2.globalIndex()) { @@ -1132,7 +1152,7 @@ struct DileptonHadronMPC { } } for (const auto& [trg, ref] : combinations(CombinationsStrictlyUpperIndexPolicy(refTracks_per_coll, refTracks_per_coll))) { - fillHadronHadron<0>(collision, trg, ref, posTracks_per_coll, negTracks_per_coll); + fillHadronHadron<0>(collision, trg, ref, posTracks_per_coll, negTracks_per_coll, cut); } } @@ -1251,7 +1271,7 @@ struct DileptonHadronMPC { // LOGF(info, "refTracks_from_event_pool.size() = %d", refTracks_from_event_pool.size()); for (const auto& ref1 : selected_refTracks_in_this_event) { // ref-ref mix for (const auto& ref2 : refTracks_from_event_pool) { - fillHadronHadron<1>(collision, ref1, ref2, nullptr, nullptr); + fillHadronHadron<1>(collision, ref1, ref2, nullptr, nullptr, nullptr); } } } // end of loop over mixed event pool for lepton-lepton diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index 46e7ecbe9be..6e308ead765 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -736,7 +736,7 @@ struct DileptonMC { fDimuonCut.SetTrackEtaRange(dimuoncuts.cfg_min_eta_track, dimuoncuts.cfg_max_eta_track); fDimuonCut.SetTrackPhiRange(dimuoncuts.cfg_min_phi_track, dimuoncuts.cfg_max_phi_track); fDimuonCut.SetNClustersMFT(dimuoncuts.cfg_min_ncluster_mft, 10); - fDimuonCut.SetNClustersMCHMID(dimuoncuts.cfg_min_ncluster_mch, 16); + fDimuonCut.SetNClustersMCHMID(dimuoncuts.cfg_min_ncluster_mch, 20); fDimuonCut.SetChi2(0.f, dimuoncuts.cfg_max_chi2); fDimuonCut.SetMatchingChi2MCHMFT(0.f, dimuoncuts.cfg_max_matching_chi2_mftmch); fDimuonCut.SetMatchingChi2MCHMID(0.f, dimuoncuts.cfg_max_matching_chi2_mchmid); diff --git a/PWGEM/Dilepton/Core/DimuonCut.h b/PWGEM/Dilepton/Core/DimuonCut.h index 2895c95f311..1c2ce81010b 100644 --- a/PWGEM/Dilepton/Core/DimuonCut.h +++ b/PWGEM/Dilepton/Core/DimuonCut.h @@ -265,11 +265,11 @@ class DimuonCut : public TNamed // track quality cuts int mTrackType{3}; - int mMinNClustersMFT{0}, mMaxNClustersMFT{10}; // min number of TPC clusters - int mMinNClustersMCHMID{0}, mMaxNClustersMCHMID{16}; // min number of TPC clusters + int mMinNClustersMFT{0}, mMaxNClustersMFT{10}; // min number of MFT clusters + int mMinNClustersMCHMID{0}, mMaxNClustersMCHMID{20}; // min number of MCH-MID clusters float mMinChi2{0.f}, mMaxChi2{1e10f}; // max tpc fit chi2 per TPC cluster - float mMinMatchingChi2MCHMFT{0.f}, mMaxMatchingChi2MCHMFT{1e10f}; // max tpc fit chi2 per TPC cluster - float mMinMatchingChi2MCHMID{0.f}, mMaxMatchingChi2MCHMID{1e10f}; // max tpc fit chi2 per TPC cluster + float mMinMatchingChi2MCHMFT{0.f}, mMaxMatchingChi2MCHMFT{1e10f}; // max matching chi2 between MCH-MFT + float mMinMatchingChi2MCHMID{0.f}, mMaxMatchingChi2MCHMID{1e10f}; // max matching chi2 between MCH-MID std::function mMaxPDCARabsDep{}; // max pdca in xy plane as function of Rabs float mMinRabs{17.6}, mMaxRabs{89.5}; diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx index 704a7d79112..b87ce1be2bd 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx @@ -955,63 +955,63 @@ struct MLTrackQC { HistogramRegistry registry{ "registry", { - {"hTPCdEdx_P_All", "TPC dE/dx vs. p;p_{pv} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{500, 0.f, 5.f}, {200, 0, 200}}}}, - {"hTOFbeta_P_All", "TOF beta vs. p;p_{pv} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0.f, 5.f}, {220, 0.0, 1.1}}}}, - {"hITSobClusterSize_P_All", "mean ITSob cluster size vs. p;p_{pv} (GeV/c); #times cos(#lambda)", {HistType::kTH2F, {{500, 0.f, 5.f}, {150, 0.0, 15}}}}, - {"hTPCdEdx_P_Electron", "TPC dE/dx vs. p;p_{pv} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{500, 0.f, 5.f}, {200, 0, 200}}}}, - {"hTOFbeta_P_Electron", "TOF beta vs. p;p_{pv} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0.f, 5.f}, {220, 0.0, 1.1}}}}, - {"hITSobClusterSize_P_Electron", "mean ITSob cluster size vs. p;p_{pv} (GeV/c); #times cos(#lambda)", {HistType::kTH2F, {{500, 0.f, 5.f}, {150, 0.0, 15}}}}, - {"hTPCdEdx_P_Pion", "TPC dE/dx vs. p;p_{pv} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{500, 0.f, 5.f}, {200, 0, 200}}}}, - {"hTOFbeta_P_Pion", "TOF beta vs. p;p_{pv} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0.f, 5.f}, {220, 0.0, 1.1}}}}, - {"hITSobClusterSize_P_Pion", "mean ITSob cluster size vs. p;p_{pv} (GeV/c); #times cos(#lambda)", {HistType::kTH2F, {{500, 0.f, 5.f}, {150, 0.0, 15}}}}, - {"hTPCdEdx_P_Kaon", "TPC dE/dx vs. p;p_{pv} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{500, 0.f, 5.f}, {200, 0, 200}}}}, - {"hTOFbeta_P_Kaon", "TOF beta vs. p;p_{pv} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0.f, 5.f}, {220, 0.0, 1.1}}}}, - {"hITSobClusterSize_P_Kaon", "mean ITSob cluster size vs. p;p_{pv} (GeV/c); #times cos(#lambda)", {HistType::kTH2F, {{500, 0.f, 5.f}, {150, 0.0, 15}}}}, - {"hTPCdEdx_P_Proton", "TPC dE/dx vs. p;p_{pv} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{500, 0.f, 5.f}, {200, 0, 200}}}}, - {"hTOFbeta_P_Proton", "TOF beta vs. p;p_{pv} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0.f, 5.f}, {220, 0.0, 1.1}}}}, - {"hITSobClusterSize_P_Proton", "mean ITSob cluster size vs. p;p_{pv} (GeV/c); #times cos(#lambda)", {HistType::kTH2F, {{500, 0.f, 5.f}, {150, 0.0, 15}}}}, - - {"hTPCNsigmaEl_P", "TPC n#sigma_{e} vs. p;p_{pv} (GeV/c);n #sigma_{e}^{TPC}", {HistType::kTH2F, {{500, 0.f, 5.f}, {100, -5, +5}}}}, - {"hTPCNsigmaPi_P", "TPC n#sigma_{#pi} vs. p;p_{pv} (GeV/c);n #sigma_{#pi}^{TPC}", {HistType::kTH2F, {{500, 0.f, 5.f}, {100, -5, +5}}}}, - {"hTPCNsigmaKa_P", "TPC n#sigma_{K} vs. p;p_{pv} (GeV/c);n #sigma_{K}^{TPC}", {HistType::kTH2F, {{500, 0.f, 5.f}, {100, -5, +5}}}}, - {"hTPCNsigmaPr_P", "TPC n#sigma_{p} vs. p;p_{pv} (GeV/c);n #sigma_{p}^{TPC}", {HistType::kTH2F, {{500, 0.f, 5.f}, {100, -5, +5}}}}, - {"hTOFNsigmaEl_P", "TOF n#sigma_{e} vs. p;p_{pv} (GeV/c);n #sigma_{e}^{TOF}", {HistType::kTH2F, {{500, 0.f, 5.f}, {100, -5, +5}}}}, - {"hTOFNsigmaPi_P", "TOF n#sigma_{#pi} vs. p;p_{pv} (GeV/c);n #sigma_{#pi}^{TOF}", {HistType::kTH2F, {{500, 0.f, 5.f}, {100, -5, +5}}}}, - {"hTOFNsigmaKa_P", "TOF n#sigma_{K} vs. p;p_{pv} (GeV/c);n #sigma_{K}^{TOF}", {HistType::kTH2F, {{500, 0.f, 5.f}, {100, -5, +5}}}}, - {"hTOFNsigmaPr_P", "TOF n#sigma_{p} vs. p;p_{pv} (GeV/c);n #sigma_{p}^{TOF}", {HistType::kTH2F, {{500, 0.f, 5.f}, {100, -5, +5}}}}, + {"hTPCdEdx_P_All", "TPC dE/dx vs. p;p_{in} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{1000, 0.f, 10.f}, {200, 0, 200}}}}, + {"hTOFbeta_P_All", "TOF beta vs. p;p_{in} (GeV/c);TOF #beta", {HistType::kTH2F, {{1000, 0.f, 10.f}, {220, 0.0, 1.1}}}}, + {"hITSobClusterSize_P_All", "mean ITSob cluster size vs. p;p_{in} (GeV/c); #times cos(#lambda)", {HistType::kTH2F, {{1000, 0.f, 10.f}, {150, 0.0, 15}}}}, + {"hTPCdEdx_P_Electron", "TPC dE/dx vs. p;p_{in} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{1000, 0.f, 10.f}, {200, 0, 200}}}}, + {"hTOFbeta_P_Electron", "TOF beta vs. p;p_{in} (GeV/c);TOF #beta", {HistType::kTH2F, {{1000, 0.f, 10.f}, {220, 0.0, 1.1}}}}, + {"hITSobClusterSize_P_Electron", "mean ITSob cluster size vs. p;p_{in} (GeV/c); #times cos(#lambda)", {HistType::kTH2F, {{1000, 0.f, 10.f}, {150, 0.0, 15}}}}, + {"hTPCdEdx_P_Pion", "TPC dE/dx vs. p;p_{in} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{1000, 0.f, 10.f}, {200, 0, 200}}}}, + {"hTOFbeta_P_Pion", "TOF beta vs. p;p_{in} (GeV/c);TOF #beta", {HistType::kTH2F, {{1000, 0.f, 10.f}, {220, 0.0, 1.1}}}}, + {"hITSobClusterSize_P_Pion", "mean ITSob cluster size vs. p;p_{in} (GeV/c); #times cos(#lambda)", {HistType::kTH2F, {{1000, 0.f, 10.f}, {150, 0.0, 15}}}}, + {"hTPCdEdx_P_Kaon", "TPC dE/dx vs. p;p_{in} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{1000, 0.f, 10.f}, {200, 0, 200}}}}, + {"hTOFbeta_P_Kaon", "TOF beta vs. p;p_{in} (GeV/c);TOF #beta", {HistType::kTH2F, {{1000, 0.f, 10.f}, {220, 0.0, 1.1}}}}, + {"hITSobClusterSize_P_Kaon", "mean ITSob cluster size vs. p;p_{in} (GeV/c); #times cos(#lambda)", {HistType::kTH2F, {{1000, 0.f, 10.f}, {150, 0.0, 15}}}}, + {"hTPCdEdx_P_Proton", "TPC dE/dx vs. p;p_{in} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{1000, 0.f, 10.f}, {200, 0, 200}}}}, + {"hTOFbeta_P_Proton", "TOF beta vs. p;p_{in} (GeV/c);TOF #beta", {HistType::kTH2F, {{1000, 0.f, 10.f}, {220, 0.0, 1.1}}}}, + {"hITSobClusterSize_P_Proton", "mean ITSob cluster size vs. p;p_{in} (GeV/c); #times cos(#lambda)", {HistType::kTH2F, {{1000, 0.f, 10.f}, {150, 0.0, 15}}}}, + + {"hTPCNsigmaEl_P", "TPC n#sigma_{e} vs. p;p_{in} (GeV/c);n #sigma_{e}^{TPC}", {HistType::kTH2F, {{1000, 0.f, 10.f}, {100, -5, +5}}}}, + {"hTPCNsigmaPi_P", "TPC n#sigma_{#pi} vs. p;p_{in} (GeV/c);n #sigma_{#pi}^{TPC}", {HistType::kTH2F, {{1000, 0.f, 10.f}, {100, -5, +5}}}}, + {"hTPCNsigmaKa_P", "TPC n#sigma_{K} vs. p;p_{in} (GeV/c);n #sigma_{K}^{TPC}", {HistType::kTH2F, {{1000, 0.f, 10.f}, {100, -5, +5}}}}, + {"hTPCNsigmaPr_P", "TPC n#sigma_{p} vs. p;p_{in} (GeV/c);n #sigma_{p}^{TPC}", {HistType::kTH2F, {{1000, 0.f, 10.f}, {100, -5, +5}}}}, + {"hTOFNsigmaEl_P", "TOF n#sigma_{e} vs. p;p_{in} (GeV/c);n #sigma_{e}^{TOF}", {HistType::kTH2F, {{1000, 0.f, 10.f}, {100, -5, +5}}}}, + {"hTOFNsigmaPi_P", "TOF n#sigma_{#pi} vs. p;p_{in} (GeV/c);n #sigma_{#pi}^{TOF}", {HistType::kTH2F, {{1000, 0.f, 10.f}, {100, -5, +5}}}}, + {"hTOFNsigmaKa_P", "TOF n#sigma_{K} vs. p;p_{in} (GeV/c);n #sigma_{K}^{TOF}", {HistType::kTH2F, {{1000, 0.f, 10.f}, {100, -5, +5}}}}, + {"hTOFNsigmaPr_P", "TOF n#sigma_{p} vs. p;p_{in} (GeV/c);n #sigma_{p}^{TOF}", {HistType::kTH2F, {{1000, 0.f, 10.f}, {100, -5, +5}}}}, }, }; void processQC(aod::EMTracksForMLPID const& tracks) { for (const auto& track : tracks) { - registry.fill(HIST("hTPCdEdx_P_All"), track.p(), track.tpcSignal()); - registry.fill(HIST("hTOFbeta_P_All"), track.p(), track.beta()); - registry.fill(HIST("hITSobClusterSize_P_All"), track.p(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); + registry.fill(HIST("hTPCdEdx_P_All"), track.tpcInnerParam(), track.tpcSignal()); + registry.fill(HIST("hTOFbeta_P_All"), track.tpcInnerParam(), track.beta()); + registry.fill(HIST("hITSobClusterSize_P_All"), track.tpcInnerParam(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); if (track.pidlabel() == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)) { - registry.fill(HIST("hTPCdEdx_P_Electron"), track.p(), track.tpcSignal()); - registry.fill(HIST("hTOFbeta_P_Electron"), track.p(), track.beta()); - registry.fill(HIST("hITSobClusterSize_P_Electron"), track.p(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); - registry.fill(HIST("hTPCNsigmaEl_P"), track.p(), track.tpcNSigmaEl()); - registry.fill(HIST("hTOFNsigmaEl_P"), track.p(), track.tofNSigmaEl()); + registry.fill(HIST("hTPCdEdx_P_Electron"), track.tpcInnerParam(), track.tpcSignal()); + registry.fill(HIST("hTOFbeta_P_Electron"), track.tpcInnerParam(), track.beta()); + registry.fill(HIST("hITSobClusterSize_P_Electron"), track.tpcInnerParam(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); + registry.fill(HIST("hTPCNsigmaEl_P"), track.tpcInnerParam(), track.tpcNSigmaEl()); + registry.fill(HIST("hTOFNsigmaEl_P"), track.tpcInnerParam(), track.tofNSigmaEl()); } else if (track.pidlabel() == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)) { - registry.fill(HIST("hTPCdEdx_P_Pion"), track.p(), track.tpcSignal()); - registry.fill(HIST("hTOFbeta_P_Pion"), track.p(), track.beta()); - registry.fill(HIST("hITSobClusterSize_P_Pion"), track.p(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); - registry.fill(HIST("hTPCNsigmaPi_P"), track.p(), track.tpcNSigmaPi()); - registry.fill(HIST("hTOFNsigmaPi_P"), track.p(), track.tofNSigmaPi()); + registry.fill(HIST("hTPCdEdx_P_Pion"), track.tpcInnerParam(), track.tpcSignal()); + registry.fill(HIST("hTOFbeta_P_Pion"), track.tpcInnerParam(), track.beta()); + registry.fill(HIST("hITSobClusterSize_P_Pion"), track.tpcInnerParam(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); + registry.fill(HIST("hTPCNsigmaPi_P"), track.tpcInnerParam(), track.tpcNSigmaPi()); + registry.fill(HIST("hTOFNsigmaPi_P"), track.tpcInnerParam(), track.tofNSigmaPi()); } else if (track.pidlabel() == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kKaon)) { - registry.fill(HIST("hTPCdEdx_P_Kaon"), track.p(), track.tpcSignal()); - registry.fill(HIST("hTOFbeta_P_Kaon"), track.p(), track.beta()); - registry.fill(HIST("hITSobClusterSize_P_Kaon"), track.p(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); - registry.fill(HIST("hTPCNsigmaKa_P"), track.p(), track.tpcNSigmaKa()); - registry.fill(HIST("hTOFNsigmaKa_P"), track.p(), track.tofNSigmaKa()); + registry.fill(HIST("hTPCdEdx_P_Kaon"), track.tpcInnerParam(), track.tpcSignal()); + registry.fill(HIST("hTOFbeta_P_Kaon"), track.tpcInnerParam(), track.beta()); + registry.fill(HIST("hITSobClusterSize_P_Kaon"), track.tpcInnerParam(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); + registry.fill(HIST("hTPCNsigmaKa_P"), track.tpcInnerParam(), track.tpcNSigmaKa()); + registry.fill(HIST("hTOFNsigmaKa_P"), track.tpcInnerParam(), track.tofNSigmaKa()); } else if (track.pidlabel() == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton)) { - registry.fill(HIST("hTPCdEdx_P_Proton"), track.p(), track.tpcSignal()); - registry.fill(HIST("hTOFbeta_P_Proton"), track.p(), track.beta()); - registry.fill(HIST("hITSobClusterSize_P_Proton"), track.p(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); - registry.fill(HIST("hTPCNsigmaPr_P"), track.p(), track.tpcNSigmaPr()); - registry.fill(HIST("hTOFNsigmaPr_P"), track.p(), track.tofNSigmaPr()); + registry.fill(HIST("hTPCdEdx_P_Proton"), track.tpcInnerParam(), track.tpcSignal()); + registry.fill(HIST("hTOFbeta_P_Proton"), track.tpcInnerParam(), track.beta()); + registry.fill(HIST("hITSobClusterSize_P_Proton"), track.tpcInnerParam(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); + registry.fill(HIST("hTPCNsigmaPr_P"), track.tpcInnerParam(), track.tpcNSigmaPr()); + registry.fill(HIST("hTOFNsigmaPr_P"), track.tpcInnerParam(), track.tofNSigmaPr()); } } // end of track loop } From b725382ea3fb95a0eed1062375bd7a7cb3650349 Mon Sep 17 00:00:00 2001 From: abmodak <67369858+abmodak@users.noreply.github.com> Date: Tue, 12 Aug 2025 03:03:23 +0200 Subject: [PATCH 021/986] [PWGLF] Add FV0A-based centrality estimator (#12534) --- .../Tasks/GlobalEventProperties/heavyionMultiplicity.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx b/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx index 3d0e34adb1c..4d730fab40d 100644 --- a/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx @@ -48,13 +48,13 @@ using namespace o2::framework::expressions; using namespace o2::aod::track; using namespace o2::aod::evsel; -using CollisionDataTable = soa::Join; +using CollisionDataTable = soa::Join; using ColDataTablepp = soa::Join; using TrackDataTable = soa::Join; using FilTrackDataTable = soa::Filtered; using CollisionMCTrueTable = aod::McCollisions; using TrackMCTrueTable = aod::McParticles; -using CollisionMCRecTable = soa::SmallGroups>; +using CollisionMCRecTable = soa::SmallGroups>; using ColMCRecTablepp = soa::SmallGroups>; using TrackMCRecTable = soa::Join; using FilTrackMCRecTable = soa::Filtered; @@ -160,6 +160,7 @@ struct HeavyionMultiplicity { Configurable isApplyNoHighMultCollInPrevRof{"isApplyNoHighMultCollInPrevRof", false, "Enable NoHighMultCollInPrevRof cut"}; Configurable isApplyFT0CbasedOccupancy{"isApplyFT0CbasedOccupancy", false, "Enable FT0CbasedOccupancy cut"}; Configurable isApplyCentFT0C{"isApplyCentFT0C", true, "Centrality based on FT0C"}; + Configurable isApplyCentFV0A{"isApplyCentFV0A", false, "Centrality based on FV0A"}; Configurable isApplyCentFT0CVariant1{"isApplyCentFT0CVariant1", false, "Centrality based on FT0C variant1"}; Configurable isApplyCentFT0M{"isApplyCentFT0M", false, "Centrality based on FT0A + FT0C"}; Configurable isApplyCentNGlobal{"isApplyCentNGlobal", false, "Centrality based on global tracks"}; @@ -318,6 +319,9 @@ struct HeavyionMultiplicity { if (isApplyCentFT0C) { cent = col.centFT0C(); } + if (isApplyCentFV0A) { + cent = col.centFV0A(); + } if (isApplyCentFT0CVariant1) { cent = col.centFT0CVariant1(); } From 26354ff73b308e1b1d2501c4c790b81b08e979b2 Mon Sep 17 00:00:00 2001 From: Maximiliano Puccio Date: Tue, 12 Aug 2025 05:04:08 +0200 Subject: [PATCH 022/986] [Trigger] Change base CCDB path to common directory (#12535) --- EventFiltering/Zorro.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EventFiltering/Zorro.h b/EventFiltering/Zorro.h index f03badab2ce..8cab70192c5 100644 --- a/EventFiltering/Zorro.h +++ b/EventFiltering/Zorro.h @@ -74,7 +74,7 @@ class Zorro ZorroSummary mZorroSummary{"ZorroSummary", "ZorroSummary"}; - std::string mBaseCCDBPath = "Users/m/mpuccio/EventFiltering/OTS/Chunked/"; + std::string mBaseCCDBPath = "EventFiltering/Zorro/"; int mRunNumber = 0; std::pair mRunDuration; int64_t mOrbitResetTimestamp = 0; From b43e45ce4b430089cc2cdb52cd3344cb3ddfbc84 Mon Sep 17 00:00:00 2001 From: Jonghan Park <40240384+jpxrk@users.noreply.github.com> Date: Tue, 12 Aug 2025 13:37:26 +0900 Subject: [PATCH 023/986] [PWGHF] Add a method for electron source selection (#12541) --- PWGHF/HFL/Tasks/taskSingleElectron.cxx | 334 ++++++++++++++++++++++++- 1 file changed, 325 insertions(+), 9 deletions(-) diff --git a/PWGHF/HFL/Tasks/taskSingleElectron.cxx b/PWGHF/HFL/Tasks/taskSingleElectron.cxx index d8a8b6e5b87..55b7c90c39e 100644 --- a/PWGHF/HFL/Tasks/taskSingleElectron.cxx +++ b/PWGHF/HFL/Tasks/taskSingleElectron.cxx @@ -27,6 +27,44 @@ using namespace o2::constants::math; using namespace o2::framework; using namespace o2::framework::expressions; +enum PdgCode { + kEta = 221, + kOmega = 223, + kPhi = 333, + kEtaPrime = 331 +}; + +enum SourceType { + NotElec = 0, // not electron + DirectCharm = 1, // electrons from prompt charm hadrons + DirectBeauty = 2, // electrons from primary beauty hadrons + BeautyCharm = 3, // electrons from non-prompt charm hadrons + DirectGamma = 4, // electrons from direct photon + GammaPi0 = 5, + GammaEta = 6, + GammaOmega = 7, + GammaPhi = 8, + GammaEtaPrime = 9, + GammaRho0 = 10, + GammaK0s = 11, + GammaK0l = 12, + GammaKe3 = 13, + GammaLambda0 = 14, + GammaSigma = 15, + Pi0 = 16, + Eta = 17, + Omega = 18, + Phi = 19, + EtaPrime = 20, + Rho0 = 21, + K0s = 22, + K0l = 23, + Ke3 = 24, + Lambda0 = 25, + Sigma = 26, + Else = 27 +}; + struct HfTaskSingleElectron { // Produces @@ -55,6 +93,7 @@ struct HfTaskSingleElectron { // using declarations using MyCollisions = soa::Join; using TracksEl = soa::Join; + using McTracksEl = soa::Join; // Filter Filter collZFilter = nabs(aod::collision::posZ) < posZMax; @@ -79,7 +118,6 @@ struct HfTaskSingleElectron { void init(InitContext const&) { // create histograms - histos.add("hEventCounter", "hEventCounter", kTH1F, {axisEvt}); histos.add("nEvents", "Number of events", kTH1F, {{1, 0., 1.}}); histos.add("VtxZ", "VtxZ; cm; entries", kTH1F, {axisPosZ}); histos.add("etaTrack", "etaTrack; #eta; entries", kTH1F, {axisEta}); @@ -102,6 +140,16 @@ struct HfTaskSingleElectron { // track impact parameter histos.add("dcaTrack", "", kTH2F, {{axisPtEl}, {axisTrackIp}}); + histos.add("dcaBeauty", "", kTH2F, {{axisPtEl}, {axisTrackIp}}); + histos.add("dcaCharm", "", kTH2F, {{axisPtEl}, {axisTrackIp}}); + histos.add("dcaDalitz", "", kTH2F, {{axisPtEl}, {axisTrackIp}}); + histos.add("dcaConv", "", kTH2F, {{axisPtEl}, {axisTrackIp}}); + + // QA plots for MC + histos.add("hPdgC", "", kTH1F, {{10001, -0.5, 10000.5}}); + histos.add("hPdgB", "", kTH1F, {{10001, -0.5, 10000.5}}); + histos.add("hPdgDa", "", kTH1F, {{10001, -0.5, 10000.5}}); + histos.add("hPdgCo", "", kTH1F, {{10001, -0.5, 10000.5}}); } template @@ -138,24 +186,267 @@ struct HfTaskSingleElectron { return true; } - void process(soa::Filtered::iterator const& collision, - TracksEl const& tracks) + template + int getElecSource(const TrackType& track, double& mpt, int& mpdg) + { + auto mcpart = track.mcParticle(); + if (std::abs(mcpart.pdgCode()) != kElectron) { + return NotElec; + } + + int motherPdg = -999; + int grmotherPdg = -999; + int ggrmotherPdg = -999; // mother, grand mother, grand grand mother pdg + int motherPt = -999.; + int grmotherPt = -999; + int ggrmotherPt = -999.; // mother, grand mother, grand grand mother pt + + auto partMother = mcpart.template mothers_as(); // first mother particle of electron + auto partMotherCopy = partMother; // copy of the first mother + auto mctrack = partMother; // will change all the time + + motherPt = partMother.front().pt(); // first mother pt + motherPdg = std::abs(partMother.front().pdgCode()); // first mother pdg + mpt = motherPt; // copy of first mother pt + mpdg = motherPdg; // copy of first mother pdg + + // check if electron from charm hadrons + if ((static_cast(motherPdg / 100.) % 10) == kCharm || (static_cast(motherPdg / 1000.) % 10) == kCharm) { + + // iterate until B hadron is found as an ancestor + while (partMother.size()) { + mctrack = partMother.front().template mothers_as(); + if (mctrack.size()) { + auto const& grmothersIdsVec = mctrack.front().mothersIds(); + + if (grmothersIdsVec.empty()) { + return DirectCharm; + } else { + grmotherPt = mctrack.front().pt(); + grmotherPdg = std::abs(mctrack.front().pdgCode()); + if ((static_cast(grmotherPdg / 100.) % 10) == kBottom || (static_cast(grmotherPdg / 1000.) % 10) == kBottom) { + mpt = grmotherPt; + mpdg = grmotherPdg; + return BeautyCharm; + } + } + } + partMother = mctrack; + } + } else if ((static_cast(motherPdg / 100.) % 10) == kBottom || (static_cast(motherPdg / 1000.) % 10) == kBottom) { // check if electron from beauty hadrons + return DirectBeauty; + } else if (motherPdg == kGamma) { // check if electron from photon conversion + mctrack = partMother.front().template mothers_as(); + if (mctrack.size()) { + auto const& grmothersIdsVec = mctrack.front().mothersIds(); + if (grmothersIdsVec.empty()) { + return DirectGamma; + } else { + grmotherPdg = std::abs(mctrack.front().pdgCode()); + mpdg = grmotherPdg; + mpt = mctrack.front().pt(); + + partMother = mctrack; + mctrack = partMother.front().template mothers_as(); + if (mctrack.size()) { + auto const& ggrmothersIdsVec = mctrack.front().mothersIds(); + if (ggrmothersIdsVec.empty()) { + if (grmotherPdg == kPi0) { + return GammaPi0; + } else if (grmotherPdg == kEta) { + return GammaEta; + } else if (grmotherPdg == kOmega) { + return GammaOmega; + } else if (grmotherPdg == kPhi) { + return GammaPhi; + } else if (grmotherPdg == kEtaPrime) { + return GammaEtaPrime; + } else if (grmotherPdg == kRho770_0) { + return GammaRho0; + } else { + return Else; + } + } else { + ggrmotherPdg = mctrack.front().pdgCode(); + ggrmotherPt = mctrack.front().pt(); + mpdg = ggrmotherPdg; + mpt = ggrmotherPt; + if (grmotherPdg == kPi0) { + if (ggrmotherPdg == kK0Short) { + return GammaK0s; + } else if (ggrmotherPdg == kK0Long) { + return GammaK0l; + } else if (ggrmotherPdg == kKPlus) { + return GammaKe3; + } else if (ggrmotherPdg == kLambda0) { + return GammaLambda0; + } else if (ggrmotherPdg == kSigmaPlus) { + return GammaSigma; + } else { + mpdg = grmotherPdg; + mpt = grmotherPt; + return GammaPi0; + } + } else if (grmotherPdg == kEta) { + mpdg = grmotherPdg; + mpt = grmotherPt; + return GammaEta; + } else if (grmotherPdg == kOmega) { + mpdg = grmotherPdg; + mpt = grmotherPt; + return GammaOmega; + } else if (grmotherPdg == kPhi) { + mpdg = grmotherPdg; + mpt = grmotherPt; + return GammaPhi; + } else if (grmotherPdg == kEtaPrime) { + mpdg = grmotherPdg; + mpt = grmotherPt; + return GammaEtaPrime; + } else if (grmotherPdg == kRho770_0) { + mpdg = grmotherPdg; + mpt = grmotherPt; + return GammaRho0; + } else { + return Else; + } + } + } + } + } + } else { // check if electron from Dalitz decays + mctrack = partMother.front().template mothers_as(); + if (mctrack.size()) { + auto const& grmothersIdsVec = mctrack.front().mothersIds(); + if (grmothersIdsVec.empty()) { + if (motherPdg == kPi0) { + return Pi0; + } else if (motherPdg == kEta) { + return Eta; + } else if (motherPdg == kOmega) { + return Omega; + } else if (motherPdg == kPhi) { + return Phi; + } else if (motherPdg == kEtaPrime) { + return EtaPrime; + } else if (motherPdg == kRho770_0) { + return Rho0; + } else if (motherPdg == kKPlus) { + return Ke3; + } else if (motherPdg == kK0Long) { + return K0l; + } else { + return Else; + } + } else { + if (motherPdg == kPi0) { + grmotherPt = mctrack.front().pt(); + grmotherPdg = mctrack.front().pdgCode(); + mpt = grmotherPt; + mpdg = grmotherPdg; + if (grmotherPdg == kK0Short) { + return K0s; + } else if (grmotherPdg == kK0Long) { + return K0l; + } else if (grmotherPdg == kKPlus) { + return Ke3; + } else if (grmotherPdg == kLambda0) { + return Lambda0; + } else if (grmotherPdg == kSigmaPlus) { + return Sigma; + } else { + mpt = motherPt; + mpdg = motherPdg; + return Pi0; + } + } else if (motherPdg == kEta) { + return Eta; + } else if (motherPdg == kOmega) { + return Omega; + } else if (motherPdg == kPhi) { + return Phi; + } else if (motherPdg == kEtaPrime) { + return EtaPrime; + } else if (motherPdg == kRho770_0) { + return Rho0; + } else if (motherPdg == kKPlus) { + return Ke3; + } else if (motherPdg == kK0Long) { + return K0l; + } else { + return Else; + } + } + } + } + + return Else; + } + + void processData(soa::Filtered::iterator const& collision, + TracksEl const& tracks) + { + float flagAnalysedEvt = 0.5; + + if (!collision.sel8()) { + return; + } + + if (collision.numContrib() < nContribMin) { + return; + } + + histos.fill(HIST("VtxZ"), collision.posZ()); + histos.fill(HIST("nEvents"), flagAnalysedEvt); + + for (const auto& track : tracks) { + + if (!trackSel(track)) { + continue; + } + + histos.fill(HIST("etaTrack"), track.eta()); + histos.fill(HIST("ptTrack"), track.pt()); + + histos.fill(HIST("tpcNClsTrack"), track.tpcNClsCrossedRows()); + histos.fill(HIST("tpcFoundFindableTrack"), track.tpcCrossedRowsOverFindableCls()); + histos.fill(HIST("tpcChi2Track"), track.tpcChi2NCl()); + histos.fill(HIST("itsIBClsTrack"), track.itsNClsInnerBarrel()); + histos.fill(HIST("dcaXYTrack"), track.dcaXY()); + histos.fill(HIST("dcaZTrack"), track.dcaZ()); + + histos.fill(HIST("tofNSigPt"), track.pt(), track.tofNSigmaEl()); + histos.fill(HIST("tpcNSigPt"), track.pt(), track.tpcNSigmaEl()); + + if (std::abs(track.tofNSigmaEl()) > tofNSigmaMax) { + continue; + } + histos.fill(HIST("tofNSigPtQA"), track.pt(), track.tofNSigmaEl()); + histos.fill(HIST("tpcNSigPtAfterTofCut"), track.pt(), track.tpcNSigmaEl()); + + if (track.tpcNSigmaEl() < tpcNSigmaMin || track.tpcNSigmaEl() > tpcNSigmaMax) { + continue; + } + histos.fill(HIST("tpcNSigPtQA"), track.pt(), track.tpcNSigmaEl()); + + histos.fill(HIST("dcaTrack"), track.pt(), track.dcaXY()); + } + } + PROCESS_SWITCH(HfTaskSingleElectron, processData, "For real data", true); + + void processMc(soa::Filtered::iterator const& collision, + McTracksEl const& tracks, + aod::McParticles const&) { - float flagEventFill = 0.5; float flagAnalysedEvt = 0.5; - histos.fill(HIST("hEventCounter"), flagEventFill); if (!collision.sel8()) { return; } - flagEventFill += 1.; - histos.fill(HIST("hEventCounter"), flagEventFill); if (collision.numContrib() < nContribMin) { return; } - flagEventFill += 1.; - histos.fill(HIST("hEventCounter"), flagEventFill); histos.fill(HIST("VtxZ"), collision.posZ()); histos.fill(HIST("nEvents"), flagAnalysedEvt); @@ -179,6 +470,30 @@ struct HfTaskSingleElectron { histos.fill(HIST("tofNSigPt"), track.pt(), track.tofNSigmaEl()); histos.fill(HIST("tpcNSigPt"), track.pt(), track.tpcNSigmaEl()); + int mpdg; // electron source pdg code + double mpt; // electron source pt + int source = getElecSource(track, mpt, mpdg); + + if (source == DirectBeauty || source == BeautyCharm) { + histos.fill(HIST("hPdgB"), mpdg); + histos.fill(HIST("dcaBeauty"), track.pt(), track.dcaXY()); + } + + if (source == DirectCharm) { + histos.fill(HIST("hPdgC"), mpdg); + histos.fill(HIST("dcaCharm"), track.pt(), track.dcaXY()); + } + + if (source >= GammaPi0 && source <= GammaSigma) { + histos.fill(HIST("hPdgCo"), mpdg); + histos.fill(HIST("dcaConv"), track.pt(), track.dcaXY()); + } + + if (source >= Pi0 && source <= Sigma) { + histos.fill(HIST("hPdgDa"), mpdg); + histos.fill(HIST("dcaDalitz"), track.pt(), track.dcaXY()); + } + if (std::abs(track.tofNSigmaEl()) > tofNSigmaMax) { continue; } @@ -193,6 +508,7 @@ struct HfTaskSingleElectron { histos.fill(HIST("dcaTrack"), track.pt(), track.dcaXY()); } } + PROCESS_SWITCH(HfTaskSingleElectron, processMc, "For real data", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From bdc2bfd2825bb21df86cbf26dd4b3b01374c578c Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Tue, 12 Aug 2025 07:42:47 +0200 Subject: [PATCH 024/986] [Common] Add hepMC info to extras table task (#12536) --- Common/TableProducer/multiplicityExtraTable.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Common/TableProducer/multiplicityExtraTable.cxx b/Common/TableProducer/multiplicityExtraTable.cxx index 001e75e6adb..5b0840e5f2d 100644 --- a/Common/TableProducer/multiplicityExtraTable.cxx +++ b/Common/TableProducer/multiplicityExtraTable.cxx @@ -36,6 +36,9 @@ struct MultiplicityExtraTable { Produces mult2bc; Produces bc2mult; + // auxiliary for MC + Produces multHepMCHIs; + // Allow for downscaling of BC table for less space use in derived data Configurable bcDownscaleFactor{"bcDownscaleFactor", 2, "Downscale factor for BC table (0: save nothing, 1: save all)"}; Configurable minFT0CforBCTable{"minFT0CforBCTable", 25.0f, "Minimum FT0C amplitude to fill BC table to reduce data"}; @@ -277,9 +280,22 @@ struct MultiplicityExtraTable { } } + void processHepMCHeavyIons(aod::HepMCHeavyIons const& hepmchis) + { + for (auto const& hepmchi : hepmchis) { + multHepMCHIs(hepmchi.mcCollisionId(), + hepmchi.ncollHard(), + hepmchi.npartProj(), + hepmchi.npartTarg(), + hepmchi.ncoll(), + hepmchi.impactParameter()); + } + } + // Process switches PROCESS_SWITCH(MultiplicityExtraTable, processBCs, "Produce BC tables", true); PROCESS_SWITCH(MultiplicityExtraTable, processCollisionNeighbors, "Produce neighbor timing tables", true); + PROCESS_SWITCH(MultiplicityExtraTable, processHepMCHeavyIons, "Produce MultHepMCHIs tables", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From cf777335592670409e005f246aa6dea6a815bf98 Mon Sep 17 00:00:00 2001 From: abmodak <67369858+abmodak@users.noreply.github.com> Date: Tue, 12 Aug 2025 08:09:53 +0200 Subject: [PATCH 025/986] [PWGLF] Add INEl>0 event selection condition (#12542) --- .../heavyionMultiplicity.cxx | 210 ++++++++---------- 1 file changed, 96 insertions(+), 114 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx b/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx index 4d730fab40d..6637d6f2dcd 100644 --- a/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx @@ -48,14 +48,14 @@ using namespace o2::framework::expressions; using namespace o2::aod::track; using namespace o2::aod::evsel; -using CollisionDataTable = soa::Join; -using ColDataTablepp = soa::Join; +using CollisionDataTable = soa::Join; +using ColDataTablepp = soa::Join; using TrackDataTable = soa::Join; using FilTrackDataTable = soa::Filtered; using CollisionMCTrueTable = aod::McCollisions; using TrackMCTrueTable = aod::McParticles; -using CollisionMCRecTable = soa::SmallGroups>; -using ColMCRecTablepp = soa::SmallGroups>; +using CollisionMCRecTable = soa::SmallGroups>; +using ColMCRecTablepp = soa::SmallGroups>; using TrackMCRecTable = soa::Join; using FilTrackMCRecTable = soa::Filtered; using V0TrackCandidates = soa::Join; @@ -115,7 +115,6 @@ AxisSpec axisMassLambda = {200, 1.07, 1.17, "Lambda/AntiLamda Mass", "Lambda/Ant AxisSpec axisTracks{9, 0.5, 9.5, "#tracks", "TrackAxis"}; auto static constexpr kMinCharge = 3.f; auto static constexpr kMinpTcut = 0.1f; -auto static constexpr kEtaInelgt0 = 1.0f; auto static constexpr kNItslayers = 7; struct HeavyionMultiplicity { @@ -166,6 +165,7 @@ struct HeavyionMultiplicity { Configurable isApplyCentNGlobal{"isApplyCentNGlobal", false, "Centrality based on global tracks"}; Configurable isApplyCentMFT{"isApplyCentMFT", false, "Centrality based on MFT tracks"}; Configurable isApplySplitRecCol{"isApplySplitRecCol", false, "Split MC reco collisions"}; + Configurable isApplyInelgt0{"isApplyInelgt0", false, "Enable INEL > 0 condition"}; void init(InitContext const&) { @@ -192,6 +192,7 @@ struct HeavyionMultiplicity { x->SetBinLabel(6, "ApplyNoCollInTimeRangeStandard"); x->SetBinLabel(7, "ApplyNoCollInRofStandard"); x->SetBinLabel(8, "ApplyNoHighMultCollInPrevRof"); + x->SetBinLabel(9, "INEL > 0"); if (doprocessData) { histos.add("CentPercentileHist", "CentPercentileHist", kTH1D, {axisCent}, false); @@ -309,6 +310,11 @@ struct HeavyionMultiplicity { return false; } histos.fill(HIST("EventHist"), 8); + + if (isApplyInelgt0 && !col.isInelGt0()) { + return false; + } + histos.fill(HIST("EventHist"), 9); return true; } @@ -673,41 +679,31 @@ struct HeavyionMultiplicity { return; } - // INEL>0 sample - auto nTrks = 0; + histos.fill(HIST("VtxZHist"), cols.posZ()); + histos.fill(HIST("MultPercentileHist"), cols.centFT0M()); + histos.fill(HIST("hdatazvtxmultpp"), cols.posZ(), cols.centFT0M()); + for (const auto& track : tracks) { if (!isTrackSelected(track)) { continue; } - if (track.eta() < kEtaInelgt0) { - nTrks++; + histos.fill(HIST("PhiVsEtaHistpp"), track.phi(), track.eta()); + histos.fill(HIST("hdatadndetapp"), cols.posZ(), cols.centFT0M(), track.eta(), track.phi(), kGlobalplusITS); + if (track.hasTPC()) { + histos.fill(HIST("hdatadndetapp"), cols.posZ(), cols.centFT0M(), track.eta(), track.phi(), kGlobalonly); + } else { + histos.fill(HIST("hdatadndetapp"), cols.posZ(), cols.centFT0M(), track.eta(), track.phi(), kITSonly); } } // track loop - - if (nTrks > 0) { - histos.fill(HIST("EventHist"), 9); - histos.fill(HIST("VtxZHist"), cols.posZ()); - histos.fill(HIST("MultPercentileHist"), cols.centFT0M()); - histos.fill(HIST("hdatazvtxmultpp"), cols.posZ(), cols.centFT0M()); - - for (const auto& track : tracks) { - if (!isTrackSelected(track)) { - continue; - } - histos.fill(HIST("PhiVsEtaHistpp"), track.phi(), track.eta()); - histos.fill(HIST("hdatadndetapp"), cols.posZ(), cols.centFT0M(), track.eta(), track.phi(), kGlobalplusITS); - if (track.hasTPC()) { - histos.fill(HIST("hdatadndetapp"), cols.posZ(), cols.centFT0M(), track.eta(), track.phi(), kGlobalonly); - } else { - histos.fill(HIST("hdatadndetapp"), cols.posZ(), cols.centFT0M(), track.eta(), track.phi(), kITSonly); - } - } // track loop - } // nTrks>0 } PROCESS_SWITCH(HeavyionMultiplicity, processppData, "process pp data", false); void processppMonteCarlo(CollisionMCTrueTable::iterator const&, ColMCRecTablepp const& RecCols, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks) { + if (isApplySplitRecCol && (RecCols.size() == 0 || RecCols.size() > 1)) { + return; + } + for (const auto& RecCol : RecCols) { if (!isEventSelected(RecCol)) { continue; @@ -715,103 +711,89 @@ struct HeavyionMultiplicity { auto recTracksPart = RecTracks.sliceBy(perCollision, RecCol.globalIndex()); std::vector mclabels; - // INEL>0 sample - auto nTrks = 0; + histos.fill(HIST("VtxZHist"), RecCol.posZ()); + histos.fill(HIST("MultPercentileMCRecHist"), RecCol.centFT0M()); + histos.fill(HIST("hmczvtxmultpp"), RecCol.posZ(), RecCol.centFT0M()); + for (const auto& Rectrack : recTracksPart) { if (!isTrackSelected(Rectrack)) { continue; } - if (Rectrack.eta() < kEtaInelgt0) { - nTrks++; + histos.fill(HIST("MCrecPhiVsEtaHistpp"), Rectrack.phi(), Rectrack.eta()); + histos.fill(HIST("hmcrecdndetapp"), RecCol.posZ(), RecCol.centFT0M(), Rectrack.eta(), Rectrack.phi(), static_cast(kSpAll), kGlobalplusITS); + if (Rectrack.hasTPC()) { + histos.fill(HIST("hmcrecdndetapp"), RecCol.posZ(), RecCol.centFT0M(), Rectrack.eta(), Rectrack.phi(), static_cast(kSpAll), kGlobalonly); + } else { + histos.fill(HIST("hmcrecdndetapp"), RecCol.posZ(), RecCol.centFT0M(), Rectrack.eta(), Rectrack.phi(), static_cast(kSpAll), kITSonly); } - } - if (nTrks > 0) { - histos.fill(HIST("EventHist"), 9); - histos.fill(HIST("VtxZHist"), RecCol.posZ()); - histos.fill(HIST("MultPercentileMCRecHist"), RecCol.centFT0M()); - histos.fill(HIST("hmczvtxmultpp"), RecCol.posZ(), RecCol.centFT0M()); - - for (const auto& Rectrack : recTracksPart) { - if (!isTrackSelected(Rectrack)) { - continue; - } - histos.fill(HIST("MCrecPhiVsEtaHistpp"), Rectrack.phi(), Rectrack.eta()); - histos.fill(HIST("hmcrecdndetapp"), RecCol.posZ(), RecCol.centFT0M(), Rectrack.eta(), Rectrack.phi(), static_cast(kSpAll), kGlobalplusITS); - if (Rectrack.hasTPC()) { - histos.fill(HIST("hmcrecdndetapp"), RecCol.posZ(), RecCol.centFT0M(), Rectrack.eta(), Rectrack.phi(), static_cast(kSpAll), kGlobalonly); - } else { - histos.fill(HIST("hmcrecdndetapp"), RecCol.posZ(), RecCol.centFT0M(), Rectrack.eta(), Rectrack.phi(), static_cast(kSpAll), kITSonly); - } - - if (Rectrack.has_mcParticle()) { - int pid = kBkg; - auto mcpart = Rectrack.template mcParticle_as(); - if (mcpart.isPhysicalPrimary()) { - switch (std::abs(mcpart.pdgCode())) { - case PDG_t::kPiPlus: - pid = kSpPion; - break; - case PDG_t::kKPlus: - pid = kSpKaon; - break; - case PDG_t::kProton: - pid = kSpProton; - break; - default: - pid = kSpOther; - break; - } - } else { - pid = kSpNotPrimary; - } - if (mcpart.has_mothers()) { - auto mcpartMother = mcpart.template mothers_as().front(); - if (mcpartMother.pdgCode() == PDG_t::kK0Short || std::abs(mcpartMother.pdgCode()) == PDG_t::kLambda0) { - pid = kSpStrangeDecay; - } - } - if (find(mclabels.begin(), mclabels.end(), Rectrack.mcParticleId()) != mclabels.end()) { - pid = kBkg; + if (Rectrack.has_mcParticle()) { + int pid = kBkg; + auto mcpart = Rectrack.template mcParticle_as(); + if (mcpart.isPhysicalPrimary()) { + switch (std::abs(mcpart.pdgCode())) { + case PDG_t::kPiPlus: + pid = kSpPion; + break; + case PDG_t::kKPlus: + pid = kSpKaon; + break; + case PDG_t::kProton: + pid = kSpProton; + break; + default: + pid = kSpOther; + break; } - mclabels.push_back(Rectrack.mcParticleId()); - histos.fill(HIST("hmcrecdndetapp"), RecCol.posZ(), RecCol.centFT0M(), Rectrack.eta(), Rectrack.phi(), static_cast(pid), kGlobalplusITS); } else { - histos.fill(HIST("hmcrecdndetapp"), RecCol.posZ(), RecCol.centFT0M(), Rectrack.eta(), Rectrack.phi(), static_cast(kBkg), kGlobalplusITS); + pid = kSpNotPrimary; } - } // track (mcrec) loop - - for (const auto& particle : GenParticles) { - if (!isGenTrackSelected(particle)) { - continue; + if (mcpart.has_mothers()) { + auto mcpartMother = mcpart.template mothers_as().front(); + if (mcpartMother.pdgCode() == PDG_t::kK0Short || std::abs(mcpartMother.pdgCode()) == PDG_t::kLambda0) { + pid = kSpStrangeDecay; + } } - histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast(kSpAll), kNoGenpTVar); - if (particle.pt() < kMinpTcut) { - histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast(kSpAll), kGenpTup, -10.0 * particle.pt() + 2); - histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast(kSpAll), kGenpTdown, 5.0 * particle.pt() + 0.5); - } else { - histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast(kSpAll), kGenpTup); - histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast(kSpAll), kGenpTdown); + if (find(mclabels.begin(), mclabels.end(), Rectrack.mcParticleId()) != mclabels.end()) { + pid = kBkg; } + mclabels.push_back(Rectrack.mcParticleId()); + histos.fill(HIST("hmcrecdndetapp"), RecCol.posZ(), RecCol.centFT0M(), Rectrack.eta(), Rectrack.phi(), static_cast(pid), kGlobalplusITS); + } else { + histos.fill(HIST("hmcrecdndetapp"), RecCol.posZ(), RecCol.centFT0M(), Rectrack.eta(), Rectrack.phi(), static_cast(kBkg), kGlobalplusITS); + } + } // track (mcrec) loop - int pid = 0; - switch (std::abs(particle.pdgCode())) { - case PDG_t::kPiPlus: - pid = kSpPion; - break; - case PDG_t::kKPlus: - pid = kSpKaon; - break; - case PDG_t::kProton: - pid = kSpProton; - break; - default: - pid = kSpOther; - break; - } - histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast(pid), kNoGenpTVar); - } // track (mcgen) loop - } // nTrks>0 + for (const auto& particle : GenParticles) { + if (!isGenTrackSelected(particle)) { + continue; + } + histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast(kSpAll), kNoGenpTVar); + if (particle.pt() < kMinpTcut) { + histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast(kSpAll), kGenpTup, -10.0 * particle.pt() + 2); + histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast(kSpAll), kGenpTdown, 5.0 * particle.pt() + 0.5); + } else { + histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast(kSpAll), kGenpTup); + histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast(kSpAll), kGenpTdown); + } + + int pid = 0; + switch (std::abs(particle.pdgCode())) { + case PDG_t::kPiPlus: + pid = kSpPion; + break; + case PDG_t::kKPlus: + pid = kSpKaon; + break; + case PDG_t::kProton: + pid = kSpProton; + break; + default: + pid = kSpOther; + break; + } + histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast(pid), kNoGenpTVar); + } // track (mcgen) loop } // collision loop } PROCESS_SWITCH(HeavyionMultiplicity, processppMonteCarlo, "process pp MC", false); From 278e6f3edf7d74aed7ae12c6656964f4af86052d Mon Sep 17 00:00:00 2001 From: SuJeong Ji <120470463+SuJeong-Ji@users.noreply.github.com> Date: Tue, 12 Aug 2025 17:03:48 +0900 Subject: [PATCH 026/986] [PWGLF] Added invariant mass histogram of K0s (#12515) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Resonances/chk892pp.cxx | 116 +++++++++++++++------------- 1 file changed, 61 insertions(+), 55 deletions(-) diff --git a/PWGLF/Tasks/Resonances/chk892pp.cxx b/PWGLF/Tasks/Resonances/chk892pp.cxx index 72ecdce733e..419a8ea69b6 100644 --- a/PWGLF/Tasks/Resonances/chk892pp.cxx +++ b/PWGLF/Tasks/Resonances/chk892pp.cxx @@ -15,66 +15,60 @@ /// /// \author Su-Jeong Ji -#include -#include #include +#include +#include +#include +#include #include -#include #include #include -#include -#include // #include // FIXME -#include // FIXME - -#include -#include -#include -#include -#include -#include +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/Utils/collisionCuts.h" -#include "TRandom3.h" -#include "TF1.h" -#include "TVector2.h" -#include "Math/Vector3D.h" -#include "Math/Vector4D.h" -#include "Math/GenVector/Boost.h" -#include +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CcdbApi.h" +#include "CommonConstants/MathConstants.h" +#include "CommonConstants/PhysicsConstants.h" +#include "DCAFitter/DCAFitterN.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" -#include "Framework/StepTHn.h" #include "Framework/O2DatabasePDGPlugin.h" -#include "Framework/ASoAHelpers.h" #include "Framework/StaticFor.h" -#include "DCAFitter/DCAFitterN.h" - -#include "Common/DataModel/PIDResponse.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/EventSelection.h" - -#include "Common/Core/trackUtilities.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/RecoDecay.h" - -#include "CommonConstants/PhysicsConstants.h" -#include "CommonConstants/MathConstants.h" - +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/Track.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" - -#include "CCDB/CcdbApi.h" -#include "CCDB/BasicCCDBManager.h" +#include "Math/GenVector/Boost.h" +#include "Math/RotationZ.h" +#include "Math/Vector3D.h" +#include "Math/Vector4D.h" +#include "TF1.h" +#include "TRandom3.h" +#include "TVector2.h" +#include +#include // FIXME -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/Utils/collisionCuts.h" +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -105,6 +99,7 @@ struct Chk892pp { using MCEventCandidates = soa::Join; using MCTrackCandidates = soa::Join; using MCV0Candidates = soa::Join; + using LorentzVectorSetXYZM = ROOT::Math::LorentzVector>; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -159,7 +154,7 @@ struct Chk892pp { Configurable cfgMinOccupancy{"cfgMinOccupancy", -100, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; Configurable cfgNCollinTR{"cfgNCollinTR", false, "Additional selection for the number of coll in time range"}; */ - Configurable cfgCentEst{"cfgCentEst", 1, "Centrality estimator, 1: FT0C, 2: FT0M"}; + Configurable cfgCentEst{"cfgCentEst", 2, "Centrality estimator, 1: FT0C, 2: FT0M"}; /// PID Selections, pion struct : ConfigurableGroup { @@ -368,6 +363,7 @@ struct Chk892pp { histos.add("QA/before/KstarRapidity", "Rapidity distribution of chK(892)", HistType::kTH1D, {yAxis}); histos.add("hInvmass_Kstar", "Invariant mass of unlike-sign chK(892)", HistType::kTHnSparseD, {axisType, centAxis, ptAxis, invMassAxisReso}); histos.add("hInvmass_Kstar_Mix", "Invariant mass of unlike-sign chK(892) from mixed event", HistType::kTHnSparseD, {axisType, centAxis, ptAxis, invMassAxisReso}); + histos.add("hInvmass_K0s", "Invariant mass of unlike-sign K0s", HistType::kTHnSparseD, {centAxis, ptAxis, invMassAxisK0s}); // Mass QA (quick check) histos.add("QA/before/kstarinvmass", "Invariant mass of unlike-sign chK(892)", HistType::kTH1D, {invMassAxisReso}); @@ -441,15 +437,19 @@ struct Chk892pp { histos.print(); } + const int kCentFT0C = 1; + const int kCentFT0M = 2; + const float kInvalidCentrality = -999.f; + template float getCentrality(CollisionType const& collision) { - if (cfgCentEst == 1) { + if (cfgCentEst == kCentFT0C) { return collision.multFT0C(); - } else if (cfgCentEst == 2) { + } else if (cfgCentEst == kCentFT0M) { return collision.multFT0M(); } else { - return -999; + return kInvalidCentrality; } } @@ -696,7 +696,7 @@ struct Chk892pp { { histos.fill(HIST("QA/before/CentDist"), lCentrality); - TLorentzVector lDecayDaughter1, lDecayDaughter2, lResoSecondary, lDecayDaughter_bach, lResoKstar, lDaughterRot, lResonanceRot; + LorentzVectorSetXYZM lDecayDaughter1, lDecayDaughter2, lResoSecondary, lDecayDaughter_bach, lResoKstar, lDaughterRot, lResonanceRot; std::vector trackIndicies = {}; std::vector k0sIndicies = {}; @@ -848,8 +848,8 @@ struct Chk892pp { auto k0sCand = dTracks2.rawIteratorAt(k0sIndex); auto trkkMass = k0sCand.mK0Short(); - lDecayDaughter_bach.SetXYZM(bTrack.px(), bTrack.py(), bTrack.pz(), MassPionCharged); - lResoSecondary.SetXYZM(k0sCand.px(), k0sCand.py(), k0sCand.pz(), trkkMass); + lDecayDaughter_bach = LorentzVectorSetXYZM(bTrack.px(), bTrack.py(), bTrack.pz(), MassPionCharged); + lResoSecondary = LorentzVectorSetXYZM(k0sCand.px(), k0sCand.py(), k0sCand.pz(), trkkMass); lResoKstar = lResoSecondary + lDecayDaughter_bach; // QA plots @@ -874,11 +874,17 @@ struct Chk892pp { histos.fill(HIST("QA/RotBkg/hRotBkg"), lRotAngle); if (BkgEstimationConfig.cfgRotPion) { lDaughterRot = lDecayDaughter_bach; - lDaughterRot.RotateZ(lRotAngle); + // lDaughterRot.RotateZ(lRotAngle); + ROOT::Math::RotationZ rot(lRotAngle); + auto p3 = rot * lDaughterRot.Vect(); + lDaughterRot = LorentzVectorSetXYZM(p3.X(), p3.Y(), p3.Z(), lDaughterRot.M()); lResonanceRot = lDaughterRot + lResoSecondary; } else { lDaughterRot = lResoSecondary; - lDaughterRot.RotateZ(lRotAngle); + // lDaughterRot.RotateZ(lRotAngle); + ROOT::Math::RotationZ rot(lRotAngle); + auto p3 = rot * lDaughterRot.Vect(); + lDaughterRot = LorentzVectorSetXYZM(p3.X(), p3.Y(), p3.Z(), lDaughterRot.M()); lResonanceRot = lDecayDaughter_bach + lDaughterRot; } typeKstar = bTrack.sign() > 0 ? BinType::kKstarP_Rot : BinType::kKstarN_Rot; From 6797aa8f792c32014b8a2f3d87a3e6d37e1fa753 Mon Sep 17 00:00:00 2001 From: kegang02 Date: Tue, 12 Aug 2025 18:04:24 +0800 Subject: [PATCH 027/986] [PWGCF] Add configurable for use strict pid (#12529) --- PWGCF/Flow/Tasks/flowPidCme.cxx | 91 ++++++++++++++++++++------------- 1 file changed, 55 insertions(+), 36 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowPidCme.cxx b/PWGCF/Flow/Tasks/flowPidCme.cxx index bd91bdc4450..2e55268a334 100644 --- a/PWGCF/Flow/Tasks/flowPidCme.cxx +++ b/PWGCF/Flow/Tasks/flowPidCme.cxx @@ -9,44 +9,45 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \author ZhengqingWang(zhengqing.wang@cern.ch) +/// \author ZhengqingWang(zhengqing.wang@cern.ch), KegangXiong(kxiong@cern.ch) /// \file flowPidCme.cxx /// \brief task to calculate the pikp cme signal and bacground. // C++/ROOT includes. #include -#include -#include -#include -#include -#include -#include + #include +#include #include #include #include #include -// o2Physics includes. -#include "Framework/ASoA.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/StaticFor.h" +#include +#include +#include +#include +#include -#include "Common/DataModel/Qvectors.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/Multiplicity.h" +// o2Physics includes. #include "Common/Core/EventPlaneHelper.h" #include "Common/Core/TrackSelection.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/PIDResponseITS.h" +#include "Common/DataModel/Qvectors.h" +#include "Common/DataModel/TrackSelectionTables.h" #include "CommonConstants/PhysicsConstants.h" +#include "Framework/ASoA.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/StaticFor.h" +#include "Framework/runDataProcessing.h" // o2 includes. @@ -158,6 +159,7 @@ struct FillPIDcolums { Configurable cfgOpenITSCut{"cfgOpenITSCut", true, "open ITSnsigma cut"}; Configurable cfgOpenITSCutQAPlots{"cfgOpenITSCutQAPlots", true, "open QA plots after ITS nsigma cut"}; Configurable cfgOpenDetailPlotsTPCITSContaimination{"cfgOpenDetailPlotsTPCITSContaimination", false, "open detail TH3D plots for nSigmaTPC-ITS Pt-eta-Phi nSigmaITS-clustersize"}; + Configurable cfgUseStrictPID{"cfgUseStrictPID", true, "More strict pid strategy"}; Configurable cfgOpenAllowCrossTrack{"cfgOpenAllowCrossTrack", false, "Allow one track to be identified as different kind of PID particles"}; Configurable cfgOpenCrossTrackQAPlots{"cfgOpenCrossTrackQAPlots", true, "open cross pid track QA plots"}; Configurable cfgOpenTOFOnlyPID{"cfgOpenTOFOnlyPID", true, "only accept tracks who has TOF infomation and use TOFnsigma for PID(priority greater than TPConly and combined"}; @@ -311,9 +313,17 @@ struct FillPIDcolums { pidVectorUpper = pidVectorTPCPtUpper; pidVectorLower = pidVectorTPCPtLower; } else { - nSigmaToUse = (candidate.pt() > cfgPtMaxforTPCOnlyPID && candidate.hasTOF()) ? nSigmaCombined : nSigmaTPC; - pidVectorUpper = (candidate.pt() > cfgPtMaxforTPCOnlyPID && candidate.hasTOF()) ? cfgnSigmaCutRMSUpper.value : cfgnSigmaCutTPCUpper.value; - pidVectorLower = (candidate.pt() > cfgPtMaxforTPCOnlyPID && candidate.hasTOF()) ? cfgnSigmaCutRMSLower.value : cfgnSigmaCutTPCLower.value; + if (candidate.pt() > cfgPtMaxforTPCOnlyPID && candidate.hasTOF()) { + nSigmaToUse = nSigmaCombined; + pidVectorUpper = cfgnSigmaCutRMSUpper.value; + pidVectorLower = cfgnSigmaCutRMSLower.value; + } else if (candidate.pt() > cfgPtMaxforTPCOnlyPID && !candidate.hasTOF() && cfgUseStrictPID) { + return 0; + } else { + nSigmaToUse = nSigmaTPC; + pidVectorUpper = cfgnSigmaCutTPCUpper.value; + pidVectorLower = cfgnSigmaCutTPCLower.value; + } } float nsigma = 9999.99; const int nPOI = 3; @@ -448,20 +458,27 @@ struct FillPIDcolums { } } } - if (cfgOpenAllowCrossTrack) { - // one track can be recognized as different PID particles + if (cfgUseStrictPID) { + // Only use the track which was recognized as an unique PID particle int index = (kIsPr << 2) | (kIsKa << 1) | kIsPi; - const int map[] = {0, 1, 2, 7, 3, 8, 9, 10}; + const int map[] = {0, 1, 2, 0, 3, 0, 0, 0}; return map[index]; } else { - // Select particle with the lowest nsigma (If not allow cross track) - for (int i = 0; i < nPOI; ++i) { - if (std::abs(nSigmaToUse[i]) < nsigma && (nSigmaToUse[i] > pidVectorLower[i] && nSigmaToUse[i] < pidVectorUpper[i])) { - pid = i; - nsigma = std::abs(nSigmaToUse[i]); + if (cfgOpenAllowCrossTrack) { + // one track can be recognized as different PID particles + int index = (kIsPr << 2) | (kIsKa << 1) | kIsPi; + const int map[] = {0, 1, 2, 7, 3, 8, 9, 10}; + return map[index]; + } else { + // Select particle with the lowest nsigma (If not allow cross track) + for (int i = 0; i < nPOI; ++i) { + if (std::abs(nSigmaToUse[i]) < nsigma && (nSigmaToUse[i] > pidVectorLower[i] && nSigmaToUse[i] < pidVectorUpper[i])) { + pid = i; + nsigma = std::abs(nSigmaToUse[i]); + } } + return pid + 1; // shift the pid by 1, 1 = pion, 2 = kaon, 3 = proton } - return pid + 1; // shift the pid by 1, 1 = pion, 2 = kaon, 3 = proton } // Clear the vectors std::vector().swap(pidVectorLower); @@ -2682,8 +2699,9 @@ struct FlowPidCme { int detInd = detId * 4 + cfgnTotalSystem * 4 * (nmode - 2); int refAInd = refAId * 4 + cfgnTotalSystem * 4 * (nmode - 2); int refBInd = refBId * 4 + cfgnTotalSystem * 4 * (nmode - 2); + double nonzero = 1e-8; if (nmode == fourier_mode::kMode2) { - if (collision.qvecAmp()[detId] > 1e-8) { + if (collision.qvecAmp()[detId] > nonzero) { histosQA.fill(HIST("QA/histQvec_CorrL0_V2"), collision.qvecRe()[detInd], collision.qvecIm()[detInd], collision.centFT0C()); histosQA.fill(HIST("QA/histQvec_CorrL1_V2"), collision.qvecRe()[detInd + 1], collision.qvecIm()[detInd + 1], collision.centFT0C()); histosQA.fill(HIST("QA/histQvec_CorrL2_V2"), collision.qvecRe()[detInd + 2], collision.qvecIm()[detInd + 2], collision.centFT0C()); @@ -2693,7 +2711,7 @@ struct FlowPidCme { histosQA.fill(HIST("QA/histEvtPl_CorrL2_V2"), helperEP.GetEventPlane(collision.qvecRe()[detInd + 2], collision.qvecIm()[detInd + 2], nmode), collision.centFT0C()); histosQA.fill(HIST("QA/histEvtPl_CorrL3_V2"), helperEP.GetEventPlane(collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], nmode), collision.centFT0C()); } - if (collision.qvecAmp()[detId] > 1e-8 && collision.qvecAmp()[refAId] > 1e-8 && collision.qvecAmp()[refBId] > 1e-8) { + if (collision.qvecAmp()[detId] > nonzero && collision.qvecAmp()[refAId] > nonzero && collision.qvecAmp()[refBId] > nonzero) { histosQA.fill(HIST("QA/histQvecRes_SigRefAV2"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], nmode), helperEP.GetEventPlane(collision.qvecRe()[refAInd + 3], collision.qvecIm()[refAInd + 3], nmode), nmode), collision.centFT0C()); histosQA.fill(HIST("QA/histQvecRes_SigRefBV2"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], nmode), helperEP.GetEventPlane(collision.qvecRe()[refBInd + 3], collision.qvecIm()[refBInd + 3], nmode), nmode), collision.centFT0C()); histosQA.fill(HIST("QA/histQvecRes_RefARefBV2"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecRe()[refAInd + 3], collision.qvecIm()[refAInd + 3], nmode), helperEP.GetEventPlane(collision.qvecRe()[refBInd + 3], collision.qvecIm()[refBInd + 3], nmode), nmode), collision.centFT0C()); @@ -2704,7 +2722,8 @@ struct FlowPidCme { template void fillHistosFlowGammaDelta(const CollType& collision, const TrackType& track1, const TrackType& track2, const TrackType& track3, int nmode) { - if (collision.qvecAmp()[detId] < 1e-8) { + double nonzero2 = 1e-8; + if (collision.qvecAmp()[detId] < nonzero2) { return; } auto cent = collision.centFT0C(); From 63283648cea8821e6148f58c037b8de5d5ba5d8b Mon Sep 17 00:00:00 2001 From: Giovanni Malfattore <89481844+giovannimalfattore@users.noreply.github.com> Date: Tue, 12 Aug 2025 12:45:59 +0200 Subject: [PATCH 028/986] [DPG] Add nuclei to DCA QA (#12375) --- DPG/Tasks/AOTTrack/qaImpPar.cxx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/DPG/Tasks/AOTTrack/qaImpPar.cxx b/DPG/Tasks/AOTTrack/qaImpPar.cxx index 45f66123aee..7d9304e982d 100644 --- a/DPG/Tasks/AOTTrack/qaImpPar.cxx +++ b/DPG/Tasks/AOTTrack/qaImpPar.cxx @@ -54,12 +54,12 @@ struct QaImpactPar { /// Input parameters Configurable fDebug{"fDebug", false, "Debug flag enabling outputs"}; Configurable fEnablePulls{"fEnablePulls", false, "Enable storage of pulls"}; + Configurable fEnableNuclei{"fEnableNuclei", false, "Enable storage of nuclei"}; ConfigurableAxis binningImpPar{"binningImpPar", {200, -500.f, 500.f}, "Impact parameter binning"}; ConfigurableAxis binningPulls{"binningPulls", {200, -10.f, 10.f}, "Pulls binning"}; ConfigurableAxis binningPt{"binningPt", {100, 0.f, 10.f}, "Pt binning"}; ConfigurableAxis binningEta{"binningEta", {40, -2.f, 2.f}, "Eta binning"}; ConfigurableAxis binningPhi{"binningPhi", {24, 0.f, o2::constants::math::TwoPI}, "Phi binning"}; - ConfigurableAxis binningPDG{"binningPDG", {5, -1.5f, 3.5f}, "PDG species binning (-1: not matched, 0: unknown, 1: pi, 2: K, 3: p)"}; ConfigurableAxis binningCharge{"binningCharge", {2, -2.f, 2.f}, "charge binning (-1: negative; +1: positive)"}; ConfigurableAxis binningIuPosX{"binningIuPosX", {100, -10.f, 10.f}, "Track IU x position"}; ConfigurableAxis binningIuPosY{"binningIuPosY", {100, -10.f, 10.f}, "Track IU y position"}; @@ -336,7 +336,13 @@ struct QaImpactPar { const AxisSpec trackNSigmaTOFPionAxis{20, -10.f, 10.f, "Number of #sigma TOF #pi^{#pm}"}; const AxisSpec trackNSigmaTOFKaonAxis{20, -10.f, 10.f, "Number of #sigma TOF K^{#pm}"}; const AxisSpec trackNSigmaTOFProtonAxis{20, -10.f, 10.f, "Number of #sigma TOF proton"}; - const AxisSpec trackPDGAxis{binningPDG, "species (-1: not matched, 0: unknown, 1: pi, 2: K, 3: p)"}; + AxisSpec trackPDGAxis{5, -1.5f, 3.5f, "species (-1: not matched, 0: unknown, 1: pi, 2: K, 3: p)"}; + if (fEnableNuclei) { + trackPDGAxis.nBins = 9; + trackPDGAxis.binEdges[1] = 7.5; + trackPDGAxis.title = "species (-1: not matched, 0: unknown, 1: pi, 2: K, 3: p, 4: d, 5: t, 6: he3, 7: alpha)"; + } + const AxisSpec trackChargeAxis{binningCharge, "charge binning (-1: negative; +1: positive)"}; const AxisSpec axisVertexNumContrib{binsNumPvContrib, "Number of original PV contributors"}; const AxisSpec trackIsPvContrib{2, -0.5f, 1.5f, "is PV contributor: 1=yes, 0=no"}; @@ -420,6 +426,14 @@ struct QaImpactPar { return 2; case 2212: // proton return 3; + case o2::constants::physics::Pdg::kDeuteron: // deuteron + return 4; + case o2::constants::physics::Pdg::kTriton: // triton + return 5; + case o2::constants::physics::Pdg::kHelium3: // helium-3 + return 6; + case o2::constants::physics::Pdg::kAlpha: // alpha + return 7; default: // not identified return 0; } From 0b6f3aa059cc544ecc1f933ccb3b7b220625a911 Mon Sep 17 00:00:00 2001 From: amatyja Date: Tue, 12 Aug 2025 14:05:17 +0200 Subject: [PATCH 029/986] [PWGUD] Avoid magic numbers and minor corrections (#12465) --- PWGUD/Core/SGSelector.h | 46 ++++--- PWGUD/TableProducer/SGCandProducer.cxx | 34 ++--- PWGUD/Tasks/upcTauTau13topo.cxx | 169 ++++++++++++++++++------- 3 files changed, 168 insertions(+), 81 deletions(-) diff --git a/PWGUD/Core/SGSelector.h b/PWGUD/Core/SGSelector.h index b9fc3ecf2e7..a80224ef82b 100644 --- a/PWGUD/Core/SGSelector.h +++ b/PWGUD/Core/SGSelector.h @@ -38,12 +38,15 @@ struct SelectionResult { namespace o2::aod::sgselector { enum TrueGap : int { - NoGap = -1, - SingleGapA = 0, - SingleGapC = 1, - DoubleGap = 2 + NoGap = -1, // no gap due to change of threshold(s) in any of FV0, FT0A, ZNA, FT0C, ZNC + SingleGapA = 0, // initially single gap at A side event + SingleGapC = 1, // initially single gap at C side event + DoubleGap = 2, // initially double gap event + NoUpc = 3, // initially no UPC event with default thresholds (FT0A=150, FT0C=50) + TrkOutOfRange = 4, // to many tracks (>100 default) + BadDoubleGap = 5 // unknows status of double gap check with changed thresholds }; -} +} // namespace o2::aod::sgselector class SGSelector { @@ -65,7 +68,7 @@ class SGSelector SelectionResult result; result.bc = &oldbc; if (collision.numContrib() < diffCuts.minNTracks() || collision.numContrib() > diffCuts.maxNTracks()) { - result.value = 4; + result.value = o2::aod::sgselector::TrkOutOfRange; // 4 return result; } auto newbc = oldbc; @@ -91,9 +94,9 @@ class SGSelector newbc = bc; gC = false; } - } + } // end of loop over bc range if (!gA && !gC) { - result.value = 3; + result.value = o2::aod::sgselector::NoUpc; // gap = 3 return result; } if (gA && gC) { // loop once again for so-called DG events to get the most active FT0 BC @@ -120,7 +123,8 @@ class SGSelector result.bc = &newbc; // LOGF(info, "Old BC: %i, New BC: %i",oldbc.globalBC(), newbc.globalBC()); result.bc = &newbc; - result.value = gA && gC ? 2 : (gA ? 0 : 1); + // result.value = gA && gC ? 2 : (gA ? 0 : 1); + result.value = gA && gC ? o2::aod::sgselector::DoubleGap : (gA ? o2::aod::sgselector::SingleGapA : o2::aod::sgselector::SingleGapC); return result; } template @@ -139,12 +143,12 @@ class SGSelector float fit_cut[3] = {fv0, ft0a, ft0c}; int gap = collision.gapSide(); int true_gap = gap; - float FV0A, FT0A, FT0C, ZNA, ZNC; - FV0A = collision.totalFV0AmplitudeA(); - FT0A = collision.totalFT0AmplitudeA(); - FT0C = collision.totalFT0AmplitudeC(); - ZNA = collision.energyCommonZNA(); - ZNC = collision.energyCommonZNC(); + // float FV0A, FT0A, FT0C, ZNA, ZNC; + const float FV0A = collision.totalFV0AmplitudeA(); + const float FT0A = collision.totalFT0AmplitudeA(); + const float FT0C = collision.totalFT0AmplitudeC(); + const float ZNA = collision.energyCommonZNA(); + const float ZNC = collision.energyCommonZNC(); if (gap == o2::aod::sgselector::SingleGapA) { // gap == 0 if (FV0A > fit_cut[0] || FT0A > fit_cut[1] || ZNA > zdc_cut) true_gap = o2::aod::sgselector::NoGap; // -1 @@ -152,16 +156,18 @@ class SGSelector if (FT0C > fit_cut[2] || ZNC > zdc_cut) true_gap = o2::aod::sgselector::NoGap; // -1 } else if (gap == o2::aod::sgselector::DoubleGap) { // gap == 2 - if ((FV0A > fit_cut[0] || FT0A > fit_cut[1] || ZNA > zdc_cut) && (FT0C > fit_cut[2] || ZNC > zdc_cut)) + if ((FV0A > fit_cut[0] || FT0A > fit_cut[1] || ZNA > zdc_cut) && (FT0C > fit_cut[2] || ZNC > zdc_cut)) { true_gap = o2::aod::sgselector::NoGap; // -1 - else if ((FV0A > fit_cut[0] || FT0A > fit_cut[1] || ZNA > zdc_cut) && (FT0C <= fit_cut[2] && ZNC <= zdc_cut)) + } else if ((FV0A > fit_cut[0] || FT0A > fit_cut[1] || ZNA > zdc_cut) && (FT0C <= fit_cut[2] && ZNC <= zdc_cut)) { true_gap = o2::aod::sgselector::SingleGapC; // 1 - else if ((FV0A <= fit_cut[0] && FT0A <= fit_cut[1] && ZNA <= zdc_cut) && (FT0C > fit_cut[2] || ZNC > zdc_cut)) + } else if ((FV0A <= fit_cut[0] && FT0A <= fit_cut[1] && ZNA <= zdc_cut) && (FT0C > fit_cut[2] || ZNC > zdc_cut)) { true_gap = o2::aod::sgselector::SingleGapA; // 0 - else if (FV0A <= fit_cut[0] && FT0A <= fit_cut[1] && ZNA <= zdc_cut && FT0C <= fit_cut[2] && ZNC <= zdc_cut) + } else if (FV0A <= fit_cut[0] && FT0A <= fit_cut[1] && ZNA <= zdc_cut && FT0C <= fit_cut[2] && ZNC <= zdc_cut) { true_gap = o2::aod::sgselector::DoubleGap; // 2 - else + } else { LOGF(info, "Something wrong with DG"); + true_gap = o2::aod::sgselector::BadDoubleGap; // 5 + } } return true_gap; } diff --git a/PWGUD/TableProducer/SGCandProducer.cxx b/PWGUD/TableProducer/SGCandProducer.cxx index 37fba3120db..df466cb95b3 100644 --- a/PWGUD/TableProducer/SGCandProducer.cxx +++ b/PWGUD/TableProducer/SGCandProducer.cxx @@ -217,8 +217,8 @@ struct SGCandProducer { // Cross sections in ub. Using dummy -1 if lumi estimator is not reliable float csTCE = 10.36e6; - float csZEM = 415.2e6; // see AN: https://alice-notes.web.cern.ch/node/1515 - float csZNC = 214.5e6; // see AN: https://alice-notes.web.cern.ch/node/1515 + const float csZEM = 415.2e6; // see AN: https://alice-notes.web.cern.ch/node/1515 + const float csZNC = 214.5e6; // see AN: https://alice-notes.web.cern.ch/node/1515 if (runNumber > 543437 && runNumber < 543514) { csTCE = 8.3e6; } @@ -326,14 +326,14 @@ struct SGCandProducer { getHist(TH1, histdir + "/Stat")->Fill(8., 1.); // - int trs = collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) ? 1 : 0; - int trofs = collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard) ? 1 : 0; - int hmpr = collision.selection_bit(o2::aod::evsel::kNoHighMultCollInPrevRof) ? 1 : 0; - int tfb = collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder) ? 1 : 0; - int itsROFb = collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder) ? 1 : 0; - int sbp = collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup) ? 1 : 0; - int zVtxFT0vPv = collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV) ? 1 : 0; - int vtxITSTPC = collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC) ? 1 : 0; + const int trs = collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) ? 1 : 0; + const int trofs = collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard) ? 1 : 0; + const int hmpr = collision.selection_bit(o2::aod::evsel::kNoHighMultCollInPrevRof) ? 1 : 0; + const int tfb = collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder) ? 1 : 0; + const int itsROFb = collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder) ? 1 : 0; + const int sbp = collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup) ? 1 : 0; + const int zVtxFT0vPv = collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV) ? 1 : 0; + const int vtxITSTPC = collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC) ? 1 : 0; auto bc = collision.template foundBC_as(); double ir = 0.; const uint64_t ts = bc.timestamp(); @@ -363,14 +363,14 @@ struct SGCandProducer { return; } upchelpers::FITInfo fitInfo{}; - uint8_t chFT0A = 0; - uint8_t chFT0C = 0; - uint8_t chFDDA = 0; - uint8_t chFDDC = 0; - uint8_t chFV0A = 0; - int occ = collision.trackOccupancyInTimeRange(); + const uint8_t chFT0A = 0; + const uint8_t chFT0C = 0; + const uint8_t chFDDA = 0; + const uint8_t chFDDC = 0; + const uint8_t chFV0A = 0; + const int occ = collision.trackOccupancyInTimeRange(); udhelpers::getFITinfo(fitInfo, newbc, bcs, ft0s, fv0as, fdds); - int upc_flag = (collision.flags() & dataformats::Vertex>::Flags::UPCMode) ? 1 : 0; + const int upc_flag = (collision.flags() & dataformats::Vertex>::Flags::UPCMode) ? 1 : 0; // update SG candidates tables outputCollisions(bc.globalBC(), bc.runNumber(), collision.posX(), collision.posY(), collision.posZ(), upc_flag, diff --git a/PWGUD/Tasks/upcTauTau13topo.cxx b/PWGUD/Tasks/upcTauTau13topo.cxx index b3ff71675cc..676181f8de0 100644 --- a/PWGUD/Tasks/upcTauTau13topo.cxx +++ b/PWGUD/Tasks/upcTauTau13topo.cxx @@ -84,7 +84,7 @@ DECLARE_SOA_COLUMN(TotalFV0AmplitudeA, totalFV0AmplitudeA, float); DECLARE_SOA_COLUMN(TrkPx, trkPx, float[4]); DECLARE_SOA_COLUMN(TrkPy, trkPy, float[4]); DECLARE_SOA_COLUMN(TrkPz, trkPz, float[4]); -// DECLARE_SOA_COLUMN(TrkSign, trkSign, int[4]); +DECLARE_SOA_COLUMN(TrkSign, trkSign, int8_t[4]); DECLARE_SOA_COLUMN(TrkDCAxy, trkDCAxy, float[4]); DECLARE_SOA_COLUMN(TrkDCAz, trkDCAz, float[4]); DECLARE_SOA_COLUMN(TrkTPCcr, trkTPCcr, int[4]); @@ -95,14 +95,12 @@ DECLARE_SOA_COLUMN(TrkITScl, trkITScl, int[4]); DECLARE_SOA_COLUMN(TrkTPCsignal, trkTPCsignal, float[4]); DECLARE_SOA_COLUMN(TrkTPCnSigmaEl, trkTPCnSigmaEl, float[4]); -// DECLARE_SOA_COLUMN(TrkTPCnSigmaMu, trkTPCnSigmaMu, float[4]); DECLARE_SOA_COLUMN(TrkTPCnSigmaPi, trkTPCnSigmaPi, float[4]); DECLARE_SOA_COLUMN(TrkTPCnSigmaKa, trkTPCnSigmaKa, float[4]); DECLARE_SOA_COLUMN(TrkTPCnSigmaPr, trkTPCnSigmaPr, float[4]); DECLARE_SOA_COLUMN(TrkTPCnSigmaMu, trkTPCnSigmaMu, float[4]); DECLARE_SOA_COLUMN(TrkTOFbeta, trkTOFbeta, float[4]); DECLARE_SOA_COLUMN(TrkTOFnSigmaEl, trkTOFnSigmaEl, float[4]); -// DECLARE_SOA_COLUMN(TrkTOFnSigmaMu, trkTOFnSigmaMu, float[4]); DECLARE_SOA_COLUMN(TrkTOFnSigmaPi, trkTOFnSigmaPi, float[4]); DECLARE_SOA_COLUMN(TrkTOFnSigmaKa, trkTOFnSigmaKa, float[4]); DECLARE_SOA_COLUMN(TrkTOFnSigmaPr, trkTOFnSigmaPr, float[4]); @@ -123,7 +121,7 @@ DECLARE_SOA_TABLE(TauFourTracks, "AOD", "TAUFOURTRACK", tau_tree::TotalFT0AmplitudeA, tau_tree::TotalFT0AmplitudeC, tau_tree::TotalFV0AmplitudeA, // tau_tree::TimeFT0A, tau_tree::TimeFT0C, tau_tree::TimeFV0A, tau_tree::TrkPx, tau_tree::TrkPy, tau_tree::TrkPz, - // tau_tree::TrkSign, + tau_tree::TrkSign, tau_tree::TrkDCAxy, tau_tree::TrkDCAz, tau_tree::TrkTPCcr, tau_tree::TrkTPCfind, tau_tree::TrkTPCchi2, tau_tree::TrkITSchi2, tau_tree::TrkITScl, @@ -840,7 +838,7 @@ struct TauTau13topo { // CollisionMC histograms if (doprocessEfficiencyMCSG || doprocessSimpleMCSG) { registryMC.add("globalMC/hMCZvertex", ";V_{Z}^{MC} (cm);events", {HistType::kTH1F, {{100, -25., 25.}}}); - registryMC.add("globalMC/hMCefficiency", ";Cut Number;events", {HistType::kTH1F, {{20, 0., 20.}}}); + registryMC.add("globalMC/hMCefficiency", ";Cut Number;events", {HistType::kTH1F, {{28, -8., 20.}}}); // efficiency el registryMC.add("efficiencyMCEl/effiEl", ";Efficiency e3#pi;events", {HistType::kTH1F, {{70, 0., 70.}}}); @@ -859,6 +857,8 @@ struct TauTau13topo { registryMC.add("globalMC/hMCptGen", ";p_{T}^{gen};N^{MC particles}", {HistType::kTH1F, {{100, 0., 4.}}}); // tau + registryMC.add("tauMC/hNtaus", ";N^{#tau};N_events ", {HistType::kTH1F, {{6, -1., 5.}}}); + registryMC.add("tauMC/hMCeta", ";#eta^{#tau};N^{#tau} ", {HistType::kTH1F, {{100, -5., 5.}}}); registryMC.add("tauMC/hMCy", ";y^{#tau};N^{#tau}", {HistType::kTH1F, {{100, -5., 5.}}}); registryMC.add("tauMC/hMCphi", ";#phi^{#tau};N^{#tau}", {HistType::kTH1F, {{100, 0., 6.4}}}); @@ -873,6 +873,18 @@ struct TauTau13topo { registryMC.add("electronMC/hMCphi", ";#phi^{e};N^{e}", {HistType::kTH1F, {{100, 0., 6.4}}}); registryMC.add("electronMC/hMCpt", ";#it{p}_{T}^{e};N^{e}", {HistType::kTH1F, {{400, 0., 10.}}}); + // muon + registryMC.add("muonMC/hMCeta", ";#eta^{#mu};N^{#mu}", {HistType::kTH1F, {{100, -5., 5.}}}); + registryMC.add("muonMC/hMCy", ";y^{#mu};N^{#mu}", {HistType::kTH1F, {{100, -5., 5.}}}); + registryMC.add("muonMC/hMCphi", ";#phi^{#mu};N^{#mu}", {HistType::kTH1F, {{100, 0., 6.4}}}); + registryMC.add("muonMC/hMCpt", ";#it{p}_{T}^{#mu};N^{#mu}", {HistType::kTH1F, {{400, 0., 10.}}}); + + // pion + registryMC.add("pionMC/hMCeta", ";#eta^{#pi};N^{#pi}", {HistType::kTH1F, {{100, -5., 5.}}}); + registryMC.add("pionMC/hMCy", ";y^{#pi};N^{#pi}", {HistType::kTH1F, {{100, -5., 5.}}}); + registryMC.add("pionMC/hMCphi", ";#phi^{#pi};N^{#pi}", {HistType::kTH1F, {{100, 0., 6.4}}}); + registryMC.add("pionMC/hMCpt", ";#it{p}_{T}^{#pi};N^{#pi}", {HistType::kTH1F, {{400, 0., 10.}}}); + // efficiency mu registryMC.add("efficiencyMCMu/hpTmuon", ";p_{T}^{#mu, gen} (GeV/c);events", {HistType::kTH1F, {{200, 0., 5.}}}); @@ -3305,19 +3317,22 @@ struct TauTau13topo { void processSimpleMCSG(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles) { registryMC.get(HIST("globalMC/hMCZvertex"))->Fill(mcCollision.posZ()); - registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(0., 1.); + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(-8., 1.); registryMC.get(HIST("efficiencyMCEl/effiEl"))->Fill(0., 1.); registryMC.get(HIST("efficiencyMCMu/effiMu"))->Fill(0., 1.); registryMC.get(HIST("efficiencyMCPi/effiPi"))->Fill(0., 1.); // check how many physical primaries - // int countPrim = 0; - int countGen = 0; - int countBoth = 0; - int countCharged = 0; - int countChargedFromTau = 0; + int countPrim = 0; + int countGen = 0; // generator + int countBoth = 0; // generator + primary + int countCharged = 0; // generator + primary + charged + int countChargedFromTau = 0; // generator + primary + charged + from tau int countTau = 0; + int countChargedOnly = 0; // charged only + int countChargedOnlyFromTau = 0; // charged only and from tau + float etaTau[2]; float phiTau[2]; @@ -3347,11 +3362,13 @@ struct TauTau13topo { // loop over MC particles for (const auto& mcParticle : mcParticles) { - // LOGF(info, " mcParticle pdg %d", mcParticle.pdgCode()); + if (verbose) { + LOGF(info, " mcParticle pdg %d, gen %d, prim %d, bkg %d, process %d", mcParticle.pdgCode(), mcParticle.producedByGenerator(), mcParticle.isPhysicalPrimary(), mcParticle.fromBackgroundEvent(), mcParticle.getProcess()); + } // primaries - // if (mcParticle.isPhysicalPrimary()) { - // countPrim++; - // } + if (mcParticle.isPhysicalPrimary()) { + countPrim++; + } // // MC particles produced by generator only // @@ -3376,9 +3393,30 @@ struct TauTau13topo { } // mother is tau } // mc particle has mother } // veto neutral particles - } // physicsl primary + } // physics primary } // generator produced by + // special case only for UPCgen, charged but not taus + if (std::abs(mcParticle.pdgCode()) != kTauMinus && mcParticle.pdgCode() != kGamma && std::abs(mcParticle.pdgCode()) != kNuE && std::abs(mcParticle.pdgCode()) != kNuMu && std::abs(mcParticle.pdgCode()) != kNuTau && mcParticle.pdgCode() != kK0Long && mcParticle.pdgCode() != kPi0) { + countChargedOnly++; + // case for UPCgen when all particles are not pimaries + if (!mcParticle.isPhysicalPrimary()) { + // all charged particles, not only from 1+3 topo + registryMC.get(HIST("globalMC/hMCetaGen"))->Fill(mcParticle.eta()); + registryMC.get(HIST("globalMC/hMCphiGen"))->Fill(mcParticle.phi()); + registryMC.get(HIST("globalMC/hMCyGen"))->Fill(mcParticle.y()); + registryMC.get(HIST("globalMC/hMCptGen"))->Fill(mcParticle.pt()); + } // end of UPCgen case + + if (mcParticle.has_mothers()) { + auto const& mother = mcParticle.mothers_first_as(); + if (std::abs(mother.pdgCode()) == kTauMinus) { // 15 + countChargedOnlyFromTau++; + } // mother is tau + } // mc particle has mother + } // veto neutral particles + // end of special case only for UPCgen + // // tau+/- // @@ -3406,10 +3444,12 @@ struct TauTau13topo { if (std::abs(daughter.eta()) > 0.9) partFromTauInEta = false; } // end of pion check + // electron from tau if (std::abs(daughter.pdgCode()) == kElectron) { // 11 = electron if (daughter.pdgCode() == kElectron) flagElPlusElMinus = true; + registryMC.get(HIST("electronMC/hMCeta"))->Fill(daughter.eta()); registryMC.get(HIST("electronMC/hMCphi"))->Fill(daughter.phi()); registryMC.get(HIST("electronMC/hMCy"))->Fill(daughter.y()); @@ -3422,10 +3462,17 @@ struct TauTau13topo { if (std::abs(daughter.eta()) > 0.9) partFromTauInEta = false; } // end of electron check + // muon from tau if (std::abs(daughter.pdgCode()) == kMuonMinus) { // 13 if (daughter.pdgCode() == kMuonMinus) // 13 flagMuPlusMuMinus = true; + + registryMC.get(HIST("muonMC/hMCeta"))->Fill(daughter.eta()); + registryMC.get(HIST("muonMC/hMCphi"))->Fill(daughter.phi()); + registryMC.get(HIST("muonMC/hMCy"))->Fill(daughter.y()); + registryMC.get(HIST("muonMC/hMCpt"))->Fill(daughter.pt()); + muonFound = !muonFound; partPt = static_cast(daughter.pt()); // LOGF(info,"mu pt %f",daughter.pt()); @@ -3433,6 +3480,7 @@ struct TauTau13topo { partFromTauInEta = false; } // end of muon check } // end of loop over daughters + if (pionCounter == 3) { threePionsFound = true; } // end of 3pi check @@ -3442,6 +3490,12 @@ struct TauTau13topo { auto mcPartTmp = mcParticle.daughters_as().begin() + singlePionIndex; if (mcPartTmp.pdgCode() == kPiMinus) // -211 flagPiPlusPiMinus = true; + + registryMC.get(HIST("pionMC/hMCeta"))->Fill(mcPartTmp.eta()); + registryMC.get(HIST("pionMC/hMCphi"))->Fill(mcPartTmp.phi()); + registryMC.get(HIST("pionMC/hMCy"))->Fill(mcPartTmp.y()); + registryMC.get(HIST("pionMC/hMCpt"))->Fill(mcPartTmp.pt()); + partPt = static_cast(mcPartTmp.pt()); // motherOfSinglePionIndex = mcParticle.index(); if (std::abs(mcPartTmp.eta()) > 0.9) @@ -3454,6 +3508,7 @@ struct TauTau13topo { // LOGF(info,"pt after %f",partPt); // tau related things + registryMC.get(HIST("tauMC/hNtaus"))->Fill(countTau); if (countTau == 2) { registryMC.get(HIST("tauMC/hMCdeltaeta"))->Fill(etaTau[0] - etaTau[1]); registryMC.get(HIST("tauMC/hMCdeltaphi"))->Fill(calculateDeltaPhi(phiTau[0], phiTau[1]) * 180. / o2::constants::math::PI); @@ -3503,29 +3558,58 @@ struct TauTau13topo { registryMC.get(HIST("globalMC/hMCnPart"))->Fill(countBoth, 2); registryMC.get(HIST("globalMC/hMCnPart"))->Fill(countCharged, 3); registryMC.get(HIST("globalMC/hMCnPart"))->Fill(countChargedFromTau, 4); - if (countChargedFromTau != 4) - return; - registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(1., 1.); - if (electronFound && flagElPlusElMinus) - registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(2., 1.); // e- - else if (electronFound && !flagElPlusElMinus) - registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(3., 1.); // e+ - if (muonFound && flagMuPlusMuMinus) - registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(4., 1.); // mu- - else if (muonFound && !flagMuPlusMuMinus) - registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(5., 1.); // mu+ - if (singlePionFound && flagPiPlusPiMinus) - registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(6., 1.); // pi- - else if (singlePionFound && !flagPiPlusPiMinus) - registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(7., 1.); // pi+ + registryMC.get(HIST("globalMC/hMCnPart"))->Fill(countPrim, 5); + registryMC.get(HIST("globalMC/hMCnPart"))->Fill(countChargedOnly, 6); + registryMC.get(HIST("globalMC/hMCnPart"))->Fill(countChargedOnlyFromTau, 7); - if (!tauInRapidity) - return; - registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(8., 1.); - if (!partFromTauInEta) - return; - registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(9., 1.); + if (countChargedFromTau == 2 || countChargedOnlyFromTau == 2) { + // 2 tracks candidates + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(-7., 1.); + } + if (countChargedFromTau == 6 || countChargedOnlyFromTau == 6) { + // 6 tracks candidates + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(-6., 1.); + } + // if (countChargedFromTau != 4) + // return; + if (countChargedFromTau == 4 || countChargedOnlyFromTau == 4) { + // 4 tracks candidates + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(-5., 1.); // 4 tracks + if (electronFound && flagElPlusElMinus) + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(-4., 1.); // e- + else if (electronFound && !flagElPlusElMinus) + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(-3., 1.); // e+ + if (muonFound && flagMuPlusMuMinus) + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(-2., 1.); // mu- + else if (muonFound && !flagMuPlusMuMinus) + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(-1., 1.); // mu+ + if (singlePionFound && flagPiPlusPiMinus) + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(0., 1.); // pi- + else if (singlePionFound && !flagPiPlusPiMinus) + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(1., 1.); // pi+ + + if (!tauInRapidity) + return; + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(2., 1.); + if (!partFromTauInEta) + return; + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(3., 1.); + + if (electronFound && flagElPlusElMinus) + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(4., 1.); // e- + else if (electronFound && !flagElPlusElMinus) + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(5., 1.); // e+ + if (muonFound && flagMuPlusMuMinus) + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(6., 1.); // mu- + else if (muonFound && !flagMuPlusMuMinus) + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(7., 1.); // mu+ + if (singlePionFound && flagPiPlusPiMinus) + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(8., 1.); // pi- + else if (singlePionFound && !flagPiPlusPiMinus) + registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(9., 1.); // pi+ + + } // end of 4 tracks candidate events } // end of processSimpleMCSG // using LabeledTracks = soa::Join; @@ -3549,6 +3633,7 @@ struct TauTau13topo { { // LOGF(info, " Per DF: UDMcParticles size %d, UDMcCollisions size %d, FullMcUdCollisions size %d", mcParts.size(), mcCollisions.size(), collisionsFull.size()); // LOGF(info, " Per DF: UDMcParticles size %d, UDMcCollisions size %d, FullMcUdCollisions size %d", mcParts.size(), mcCollisions.size(), collisions.size()); + LOGF(info, " UDMcCollision size %d, SmallGroups FullMcUdCollisions size %d, UDtracks %d, UDMcParticles %d", mcCollision.size(), collisions.size(), tracks.size(), mcParticles.size()); // loop over generated collisions // for (const auto &mcCollision : mcCollisions) { @@ -5089,7 +5174,7 @@ struct TauTau13topo { // int counterTmp = 0; float px[4], py[4], pz[4]; - // int sign[4]; + int8_t sign[4]; float dcaZ[4]; float dcaXY[4]; @@ -5105,8 +5190,6 @@ struct TauTau13topo { float nSigmaPr[4]; float nSigmaKa[4]; float nSigmaMu[4]; - // float chi2TPC[4]; - // float chi2ITS[4]; float chi2TOF[4] = {-1., -1., -1., -1.}; int nclTPCcrossedRows[4]; int nclTPCfind[4]; @@ -5123,7 +5206,7 @@ struct TauTau13topo { px[counterTmp] = trk.px(); py[counterTmp] = trk.py(); pz[counterTmp] = trk.pz(); - // sign[counterTmp] = trk.sign(); + sign[counterTmp] = trk.sign(); dcaZ[counterTmp] = trk.dcaZ(); dcaXY[counterTmp] = trk.dcaXY(); @@ -5141,8 +5224,6 @@ struct TauTau13topo { tmpTofNsigmaPr[counterTmp] = trk.tofNSigmaPr(); tmpTofNsigmaMu[counterTmp] = trk.tofNSigmaMu(); - // chi2TPC[counterTmp] = trk.tpcChi2NCl(); - // chi2ITS[counterTmp] = trk.itsChi2NCl(); if (trk.hasTOF()) chi2TOF[counterTmp] = trk.tofChi2(); // nclTPCfind[counterTmp] = trk.tpcNClsFindable(); @@ -5174,7 +5255,7 @@ struct TauTau13topo { dgcand.tfb(), dgcand.itsROFb(), dgcand.sbp(), dgcand.zVtxFT0vPV(), dgcand.vtxITSTPC(), dgcand.totalFT0AmplitudeA(), dgcand.totalFT0AmplitudeC(), dgcand.totalFV0AmplitudeA(), // dgcand.timeFT0A(), dgcand.timeFT0C(), dgcand.timeFV0A(), - px, py, pz, // sign, + px, py, pz, sign, dcaXY, dcaZ, nclTPCcrossedRows, nclTPCfind, nclTPCchi2, trkITSchi2, trkITScl, tmpDedx, nSigmaEl, nSigmaPi, nSigmaKa, nSigmaPr, nSigmaMu, From 9bf6b757d3a524df2b9361f1ed85bb8f849d6bd4 Mon Sep 17 00:00:00 2001 From: sashingo Date: Wed, 13 Aug 2025 01:18:49 +0900 Subject: [PATCH 030/986] [PWGHF] add centrality selection and calculate pT ratio in Z-h analysis (#12525) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Vít Kučera --- PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx | 61 ++++++++++++++++------- 1 file changed, 43 insertions(+), 18 deletions(-) diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx index a9b15ce7a0f..3f10c0462fa 100644 --- a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -17,10 +17,13 @@ #define HomogeneousField // o2-linter: disable=name/macro (required by KFParticle) #endif +#include "PWGHF/Core/CentralityEstimation.h" #include "PWGJE/DataModel/EMCALClusters.h" #include "Common/Core/RecoDecay.h" +#include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/TrackSelectionTables.h" #include "EventFiltering/Zorro.h" @@ -58,6 +61,7 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace o2::hf_centrality; struct HfTaskElectronWeakBoson { @@ -121,6 +125,12 @@ struct HfTaskElectronWeakBoson { Configurable kfConstructMethod{"kfConstructMethod", 2, "KF Construct Method"}; Configurable chiSqNdfMax{"chiSqNdfMax", 10, "Chi2 Max for mass reco by KF particle"}; + // Centrality estimator configuration + Configurable centralityEstimator{"centralityEstimator", CentralityEstimator::FT0M, "Centrality estimator. See CentralityEstimator for valid values."}; + Configurable enableCentralityAnalysis{"enableCentralityAnalysis", true, "Enable centrality-dependent analysis"}; + Configurable centralityMin{"centralityMin", -1, "minimum cut on centrality selection"}; + Configurable centralityMax{"centralityMax", 101, "maximum cut on centrality selection"}; + // CCDB service object Service ccdb; @@ -142,7 +152,7 @@ struct HfTaskElectronWeakBoson { : pt(ptr), eta(e), phi(ph), mass(m), ptchild0(ptzee0), ptchild1(ptzee1), charge(ch) {} }; std::vector reconstructedZ; - + using CollisionsWithCent = soa::Join; using SelectedClusters = o2::aod::EMCALClusters; // PbPb // using TrackEle = o2::soa::Join; @@ -186,6 +196,10 @@ struct HfTaskElectronWeakBoson { if (cfgSkimmedProcessing) { zorroSummary.setObject(zorro.getZorroSummary()); } + // check centrality + if (centralityEstimator < CentralityEstimator::FT0A || centralityEstimator > CentralityEstimator::FV0A) { + LOGF(fatal, "Invalid centrality estimator: %d", static_cast(centralityEstimator.value)); + } // add configurable for CCDB path zorro.setBaseCCDBPath(cfgCCDBPath.value); @@ -217,11 +231,14 @@ struct HfTaskElectronWeakBoson { const AxisSpec axisPtHadron{50, 0, 50, "p_{T,hadron} (GeV/c)"}; const AxisSpec axisPtZ{150, 0, 150, "p_{T,Z} (GeV/c)"}; const AxisSpec axisSign{2, -2, 2, "charge sign"}; + const AxisSpec axisCentrality{10, 0, 100, "Centrality (%)"}; + const AxisSpec axisPtRatio{200, 0, 2.0, "pt ratio for h and Z"}; // create registrygrams registry.add("hZvtx", "Z vertex", kTH1D, {axisZvtx}); registry.add("hEventCounterInit", "hEventCounterInit", kTH1D, {axisCounter}); registry.add("hEventCounter", "hEventCounter", kTH1D, {axisCounter}); + registry.add("hCentrality", "Centrality distribution", kTH1D, {axisCentrality}); registry.add("hITSchi2", "ITS #chi^{2}", kTH1F, {axisChi2}); registry.add("hTPCchi2", "TPC #chi^{2}", kTH1F, {axisChi2}); registry.add("hTPCnCls", "TPC NCls", kTH1F, {axisCluster}); @@ -243,15 +260,13 @@ struct HfTaskElectronWeakBoson { registry.add("hEMCtime", "EMC timing", kTH1F, {axisEMCtime}); registry.add("hIsolationEnergy", "Isolation Energy", kTH2F, {{axisE}, {axisIsoEnergy}}); registry.add("hIsolationTrack", "Isolation Track", kTH2F, {{axisE}, {axisIsoTrack}}); - registry.add("hInvMassZeeLs", "invariant mass for Z LS pair", kTH2F, {{axisPt}, {axisInvMassZ}}); - registry.add("hInvMassZeeUls", "invariant mass for Z ULS pair", kTH2F, {{axisPt}, {axisInvMassZ}}); - registry.add("hKfInvMassZeeLs", "invariant mass for Z LS pair KFp", kTH2F, {{axisPt}, {axisInvMassZ}}); - registry.add("hKfInvMassZeeUls", "invariant mass for Z ULS pair KFp", kTH2F, {{axisPt}, {axisInvMassZ}}); + registry.add("hInvMassZee", "invariant mass for Z ULS pair", HistType::kTHnSparseF, {axisSign, axisPt, axisInvMassZ}); + registry.add("hKfInvMassZee", "invariant mass for Z ULS pair KFp", HistType::kTHnSparseF, {axisSign, axisPt, axisInvMassZ}); registry.add("hTHnElectrons", "electron info", HistType::kTHnSparseF, {axisPt, axisNsigma, axisM02, axisEop, axisIsoEnergy, axisIsoTrack, axisEta, axisDedx}); registry.add("hTHnTrMatch", "Track EMC Match", HistType::kTHnSparseF, {axisPt, axisdPhi, axisdEta}); // Z-hadron correlation histograms - registry.add("hZHadronDphi", "Z-hadron #Delta#phi correlation", HistType::kTHnSparseF, {axisSign, axisPtZ, axisDPhiZh}); + registry.add("hZHadronDphi", "Z-hadron #Delta#phi correlation", HistType::kTHnSparseF, {axisSign, axisPtZ, axisDPhiZh, axisPtRatio, axisPtHadron}); registry.add("hZptSpectrum", "Z boson p_{T} spectrum", kTH2F, {{axisSign}, {axisPtZ}}); // hisotgram for EMCal trigger @@ -323,6 +338,9 @@ struct HfTaskElectronWeakBoson { // LOG(info) << "Invarimass cal by KF particle "; for (const auto& track : tracks) { + if (std::abs(track.pt() - kfpIsoEle.GetPt()) < ptMatch) { + continue; + } if (track.pt() < ptZeeMin) { continue; } @@ -344,6 +362,8 @@ struct HfTaskElectronWeakBoson { auto child2 = RecoDecayPtEtaPhi::pVector(kfpAssEle.GetPt() * correctionPtElectron, kfpAssEle.GetEta(), kfpAssEle.GetPhi()); double invMassEE = RecoDecay::m(std::array{child1, child2}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}); + registry.fill(HIST("hInvMassZee"), track.sign() * charge, kfpIsoEle.GetPt(), invMassEE); + // reco by KFparticle const KFParticle* electronPairs[2] = {&kfpIsoEle, &kfpAssEle}; KFParticle zeeKF; @@ -362,17 +382,9 @@ struct HfTaskElectronWeakBoson { } float massZee, massZeeErr; zeeKF.GetMass(massZee, massZeeErr); + registry.fill(HIST("hKfInvMassZee"), track.sign() * charge, kfpIsoEle.GetPt(), massZee); // LOG(info) << "Invarimass cal by KF particle mass = " << massZee; // LOG(info) << "Invarimass cal by RecoDecay = " << invMassEE; - - if (track.sign() * charge > 0) { - registry.fill(HIST("hKfInvMassZeeLs"), kfpIsoEle.GetPt(), massZee); - registry.fill(HIST("hInvMassZeeLs"), kfpIsoEle.GetPt(), invMassEE); - } else { - registry.fill(HIST("hKfInvMassZeeUls"), kfpIsoEle.GetPt(), massZee); - registry.fill(HIST("hInvMassZeeUls"), kfpIsoEle.GetPt(), invMassEE); - } - reconstructedZ.emplace_back( zeeKF.GetPt(), zeeKF.GetEta(), @@ -384,7 +396,8 @@ struct HfTaskElectronWeakBoson { } } - void process(soa::Filtered::iterator const& collision, + // void process(soa::Filtered::iterator const& collision, + void process(soa::Filtered::iterator const& collision, aod::BCsWithTimestamps const&, SelectedClusters const& emcClusters, TrackEle const& tracks, @@ -446,6 +459,16 @@ struct HfTaskElectronWeakBoson { registry.fill(HIST("hZvtx"), collision.posZ()); + // Calculate centrality + if (enableCentralityAnalysis) { + float centrality = o2::hf_centrality::getCentralityColl(collision, centralityEstimator); + // LOG(info) << centrality; + if (centrality < centralityMin || centrality > centralityMax) { + return; + } + registry.fill(HIST("hCentrality"), centrality); + } + for (const auto& track : tracks) { if (std::abs(track.eta()) > etaTrMax) { @@ -562,8 +585,9 @@ struct HfTaskElectronWeakBoson { } // LOG(info) << "E/p" << eop; registry.fill(HIST("hEopNsigTPC"), match.track_as().tpcNSigmaEl(), eop); - if (match.emcalcluster_as().m02() < m02Min || match.emcalcluster_as().m02() > m02Max) + if (match.emcalcluster_as().m02() < m02Min || match.emcalcluster_as().m02() > m02Max) { continue; + } if (match.track_as().tpcNSigmaEl() > nsigTpcMin && match.track_as().tpcNSigmaEl() < nsigTpcMax) { registry.fill(HIST("hEop"), match.track_as().pt(), eop); @@ -624,7 +648,8 @@ struct HfTaskElectronWeakBoson { } // calculate Z-h correlation double deltaPhi = RecoDecay::constrainAngle(trackAss.phi - zBoson.phi, -o2::constants::math::PIHalf); - registry.fill(HIST("hZHadronDphi"), zBoson.charge, zBoson.pt, deltaPhi); + double ptRatio = trackAss.pt / zBoson.pt; + registry.fill(HIST("hZHadronDphi"), zBoson.charge, zBoson.pt, deltaPhi, ptRatio, trackAss.pt); } } } // end of Z-hadron correlation From c17348922eb76b7c90cf96b2324efaeca40345ac Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Tue, 12 Aug 2025 18:40:04 +0200 Subject: [PATCH 031/986] [PWGHF] Change default path in ccdb for zorro objects (#12545) --- PWGHF/Utils/utilsEvSelHf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index 5103d5c4d77..d54c17b2eb2 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -170,7 +170,7 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { o2::framework::Configurable useNoCollInRofStandard{"useNoCollInRofStandard", false, "Reject collisions in ROF standard"}; o2::framework::Configurable softwareTrigger{"softwareTrigger", "", "Label of software trigger. Multiple triggers can be selected dividing them by a comma. Set None if you want bcs that are not selected by any trigger"}; o2::framework::Configurable bcMarginForSoftwareTrigger{"bcMarginForSoftwareTrigger", 100, "Number of BCs of margin for software triggers"}; - o2::framework::Configurable ccdbPathSoftwareTrigger{"ccdbPathSoftwareTrigger", "Users/m/mpuccio/EventFiltering/OTS/Chunked/", "ccdb path for ZORRO objects"}; + o2::framework::Configurable ccdbPathSoftwareTrigger{"ccdbPathSoftwareTrigger", "EventFiltering/Zorro/", "ccdb path for ZORRO objects"}; o2::framework::ConfigurableAxis th2ConfigAxisCent{"th2ConfigAxisCent", {100, 0., 100.}, ""}; o2::framework::ConfigurableAxis th2ConfigAxisOccupancy{"th2ConfigAxisOccupancy", {100, 0, 100000}, ""}; o2::framework::Configurable requireGoodRct{"requireGoodRct", false, "Flag to require good RCT"}; From e226a4c00fe6d46e55a53163e830b6843d5132a3 Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Wed, 13 Aug 2025 00:11:11 +0530 Subject: [PATCH 032/986] [PWGLF] Code optimisation (#12546) Co-authored-by: Sawan Sawan --- PWGLF/Tasks/Resonances/kstarqa.cxx | 88 ++++++++++++++++++++++++------ 1 file changed, 72 insertions(+), 16 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarqa.cxx b/PWGLF/Tasks/Resonances/kstarqa.cxx index 5071fa7c203..c7dc0c9c3ed 100644 --- a/PWGLF/Tasks/Resonances/kstarqa.cxx +++ b/PWGLF/Tasks/Resonances/kstarqa.cxx @@ -120,6 +120,7 @@ struct Kstarqa { Configurable isApplyCutsOnMother{"isApplyCutsOnMother", false, "Enable additional cuts on Kstar mother"}; Configurable cMaxPtMotherCut{"cMaxPtMotherCut", 15.0, "Maximum pt of mother cut"}; Configurable cMaxMinvMotherCut{"cMaxMinvMotherCut", 1.5, "Maximum mass of mother cut"}; + Configurable rapidityMotherData{"rapidityMotherData", 0.5, "Maximum rapidity of mother"}; Configurable isPDGCheckMC{"isPDGCheckMC", true, "Check PDG code in MC (false for MC closure test)"}; // PID selections @@ -135,7 +136,7 @@ struct Kstarqa { // Other fixed variables float lowPtCutPID = 0.5; int noOfDaughters = 2; - float rapidityMotherData = 0.5; + // float rapidityMotherData = 0.5; } selectionConfig; @@ -170,7 +171,7 @@ struct Kstarqa { Configurable onlyTOFHIT{"onlyTOFHIT", false, "accept only TOF hit tracks at high pt"}; Configurable onlyTPC{"onlyTPC", true, "only TPC tracks"}; Configurable cRotations{"cRotations", 3, "Number of random rotations in the rotational background"}; - Configurable cSelectMultEstimator{"cSelectMultEstimator", 0, "Select multiplicity estimator: 0 - FT0M, 1 - FT0A, 2 - FT0C"}; + Configurable cSelectMultEstimator{"cSelectMultEstimator", 0, "Select multiplicity estimator: 0 - FT0M, 1 - FT0A, 2 - FT0C, 3 - FV0A"}; Configurable applyRecMotherRapidity{"applyRecMotherRapidity", true, "Apply rapidity cut on reconstructed mother track"}; Configurable applypTdepPID{"applypTdepPID", false, "Apply pT dependent PID"}; @@ -696,7 +697,7 @@ struct Kstarqa { auto cosThetaStarHelicityRot = motherRot.Vect().Dot(daughterRotCM.Vect()) / (std::sqrt(daughterRotCM.Vect().Mag2()) * std::sqrt(motherRot.Vect().Mag2())); - if (calcRotational && motherRot.Rapidity() < selectionConfig.rapidityMotherData) + if (calcRotational && std::abs(motherRot.Rapidity()) < selectionConfig.rapidityMotherData) hInvMass.fill(HIST("h3KstarInvMassRotated"), multiplicity, motherRot.Pt(), motherRot.M(), cosThetaStarHelicityRot); } } else if (isMix && std::abs(mother.Rapidity()) < selectionConfig.rapidityMotherData) { @@ -1004,9 +1005,9 @@ struct Kstarqa { ConfigurableAxis axisMultiplicity{"axisMultiplicity", {2000, 0, 10000}, "TPC multiplicity axis for ME mixing"}; // using BinningTypeTPCMultiplicity = ColumnBinningPolicy; - using BinningTypeCentralityM = ColumnBinningPolicy; - using BinningTypeVertexContributor = ColumnBinningPolicy; + using BinningTypeFT0M = ColumnBinningPolicy; using BinningTypeFT0A = ColumnBinningPolicy; + using BinningTypeFT0C = ColumnBinningPolicy; using BinningTypeFV0A = ColumnBinningPolicy; using BinningTypeMCFT0M = ColumnBinningPolicy; @@ -1014,9 +1015,9 @@ struct Kstarqa { using BinningTypeMCFT0C = ColumnBinningPolicy; using BinningTypeMCFV0A = ColumnBinningPolicy; - BinningTypeVertexContributor binningOnPositions{{axisVertex, axisMultiplicity}, true}; - BinningTypeCentralityM binningOnCentrality{{axisVertex, axisMultiplicity}, true}; + BinningTypeFT0M binningOnFT0M{{axisVertex, axisMultiplicity}, true}; BinningTypeFT0A binningOnFT0A{{axisVertex, axisMultiplicity}, true}; + BinningTypeFT0C binningOnFT0C{{axisVertex, axisMultiplicity}, true}; BinningTypeFV0A binningOnFV0A{{axisVertex, axisMultiplicity}, true}; BinningTypeMCFT0M binningOnMCFT0M{{axisVertex, axisMultiplicity}, true}; @@ -1024,14 +1025,14 @@ struct Kstarqa { BinningTypeMCFT0C binningOnMCFT0C{{axisVertex, axisMultiplicity}, true}; BinningTypeMCFV0A binningOnMCFV0A{{axisVertex, axisMultiplicity}, true}; - SameKindPair pair1{binningOnPositions, selectionConfig.cfgNoMixedEvents, -1, &cache}; - SameKindPair pair2{binningOnCentrality, selectionConfig.cfgNoMixedEvents, -1, &cache}; - SameKindPair pair3{binningOnFT0A, selectionConfig.cfgNoMixedEvents, -1, &cache}; + SameKindPair pair1{binningOnFT0M, selectionConfig.cfgNoMixedEvents, -1, &cache}; + SameKindPair pair2{binningOnFT0A, selectionConfig.cfgNoMixedEvents, -1, &cache}; + SameKindPair pair3{binningOnFT0C, selectionConfig.cfgNoMixedEvents, -1, &cache}; SameKindPair pair4{binningOnFV0A, selectionConfig.cfgNoMixedEvents, -1, &cache}; SameKindPair pairmc1{binningOnMCFT0M, selectionConfig.cfgNoMixedEvents, -1, &cache}; - SameKindPair pairmc2{binningOnMCFT0C, selectionConfig.cfgNoMixedEvents, -1, &cache}; - SameKindPair pairmc3{binningOnMCFT0A, selectionConfig.cfgNoMixedEvents, -1, &cache}; + SameKindPair pairmc2{binningOnMCFT0A, selectionConfig.cfgNoMixedEvents, -1, &cache}; + SameKindPair pairmc3{binningOnMCFT0C, selectionConfig.cfgNoMixedEvents, -1, &cache}; SameKindPair pairmc4{binningOnMCFV0A, selectionConfig.cfgNoMixedEvents, -1, &cache}; void processME(EventCandidatesMix const&, TrackCandidates const&) @@ -1430,7 +1431,19 @@ struct Kstarqa { if (!selectionEvent(collision, true)) { continue; } - multiplicity = collision.centFT0M(); + // multiplicity = collision.centFT0M(); + + if (cSelectMultEstimator == kFT0M) { + multiplicity = collision.centFT0M(); + } else if (cSelectMultEstimator == kFT0A) { + multiplicity = collision.centFT0A(); + } else if (cSelectMultEstimator == kFT0C) { + multiplicity = collision.centFT0C(); + } else if (cSelectMultEstimator == kFV0A) { + multiplicity = collision.centFV0A(); + } else { + multiplicity = collision.centFT0M(); // default + } hInvMass.fill(HIST("h1GenMult"), multiplicity); int occupancy = collision.trackOccupancyInTimeRange(); @@ -1527,7 +1540,20 @@ struct Kstarqa { for (const auto& RecCollision : recCollisions) { if (!selectionEvent(RecCollision, false)) continue; - multiplicity1 = RecCollision.centFT0M(); + // multiplicity1 = RecCollision.centFT0M(); + + if (cSelectMultEstimator == kFT0M) { + multiplicity1 = RecCollision.centFT0M(); + } else if (cSelectMultEstimator == kFT0A) { + multiplicity1 = RecCollision.centFT0A(); + } else if (cSelectMultEstimator == kFT0C) { + multiplicity1 = RecCollision.centFT0C(); + } else if (cSelectMultEstimator == kFV0A) { + multiplicity1 = RecCollision.centFV0A(); + } else { + multiplicity1 = RecCollision.centFT0M(); // default + } + isSelectedEvent = true; } @@ -1561,7 +1587,22 @@ struct Kstarqa { if (selectionConfig.isINELgt0 && !collision.isInelGt0()) { return; } - multiplicity = collision.centFT0M(); + // multiplicity = collision.centFT0M(); + + multiplicity = -1.0; + + if (cSelectMultEstimator == kFT0M) { + multiplicity = collision.centFT0M(); + } else if (cSelectMultEstimator == kFT0A) { + multiplicity = collision.centFT0A(); + } else if (cSelectMultEstimator == kFT0C) { + multiplicity = collision.centFT0C(); + } else if (cSelectMultEstimator == kFV0A) { + multiplicity = collision.centFV0A(); + } else { + multiplicity = collision.centFT0M(); // default + } + hInvMass.fill(HIST("hAllRecCollisions"), multiplicity); if (!selectionEvent(collision, false)) { @@ -1592,7 +1633,22 @@ struct Kstarqa { // return; // } - multiplicity = collision.centFT0M(); + // multiplicity = collision.centFT0M(); + + multiplicity = -1.0; + + if (cSelectMultEstimator == kFT0M) { + multiplicity = collision.centFT0M(); + } else if (cSelectMultEstimator == kFT0A) { + multiplicity = collision.centFT0A(); + } else if (cSelectMultEstimator == kFT0C) { + multiplicity = collision.centFT0C(); + } else if (cSelectMultEstimator == kFV0A) { + multiplicity = collision.centFV0A(); + } else { + multiplicity = collision.centFT0M(); // default + } + hInvMass.fill(HIST("h1RecMult"), multiplicity); auto oldindex = -999; From 805f8c894e27c963f2913a0e6a344caec5534a9d Mon Sep 17 00:00:00 2001 From: a-m-andrushko <96832230+a-m-andrushko@users.noreply.github.com> Date: Tue, 12 Aug 2025 20:43:40 +0200 Subject: [PATCH 033/986] [PWGCF] FemtoUniverse -- Add extra histograms to helicity analysis. (#12549) --- .../femtoUniversePairTaskTrackV0Helicity.cxx | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Helicity.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Helicity.cxx index b5fe5fbdc5a..bd66de7dc37 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Helicity.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Helicity.cxx @@ -237,6 +237,8 @@ struct FemtoUniversePairTaskTrackV0Helicity { // Helicity angle thetaRegistry.add("Theta/hTheta", " ; p (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}}); + thetaRegistry.add("Theta/hTheta3D_PosChild", " ; p_{V0} (GeV/#it{c}); cos(#theta); p_{Positive Child} (GeV/#it{c})", kTH3F, {{100, 0, 10}, {110, -1.1, 1.1}, {100, 0, 10}}); + thetaRegistry.add("Theta/hTheta3D_NegChild", " ; p_{V0} (GeV/#it{c}); cos(#theta); p_{Negative Child} (GeV/#it{c})", kTH3F, {{100, 0, 10}, {110, -1.1, 1.1}, {100, 0, 10}}); thetaRegistry.add("Theta/PositiveChild/hThetaPt", " ; p_{T} (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}}); thetaRegistry.add("Theta/PositiveChild/hThetaEta", " ; #eta; cos(#theta)", kTH2F, {{100, -1, 1}, {110, -1.1, 1.1}}); thetaRegistry.add("Theta/PositiveChild/hThetaPhi", " ; #phi; cos(#theta)", kTH2F, {{100, -1, 7}, {110, -1.1, 1.1}}); @@ -264,7 +266,12 @@ struct FemtoUniversePairTaskTrackV0Helicity { registryMCtruth.add("minus/MCtruthPiPt", "MC truth pions;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); registryMCtruth.add("minus/MCtruthPrPt", "MC truth protons;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryMCtruth.add("PosChildMCTruth/hPt", " ; p_{T} (GeV/#it{c}); ", {HistType::kTH1F, {{100, 0, 5}}}); + registryMCtruth.add("NegChildMCTruth/hPt", " ; p_{T} (GeV/#it{c}); ", {HistType::kTH1F, {{100, 0, 5}}}); + registryMCtruth.add("ThetaMCTruth/hTheta", " ; p (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}}); + registryMCtruth.add("ThetaMCTruth/hTheta3D_PosChild", " ; p_{V0} (GeV/#it{c}); cos(#theta); p_{Positive Child} (GeV/#it{c})", kTH3F, {{100, 0, 10}, {110, -1.1, 1.1}, {100, 0, 10}}); + registryMCtruth.add("ThetaMCTruth/hTheta3D_NegChild", " ; p_{V0} (GeV/#it{c}); cos(#theta); p_{Negative Child} (GeV/#it{c})", kTH3F, {{100, 0, 10}, {110, -1.1, 1.1}, {100, 0, 10}}); registryMCtruth.add("ThetaMCTruth/PositiveChild/hThetaPt", " ; p_{T} (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}}); registryMCtruth.add("ThetaMCTruth/PositiveChild/hThetaEta", " ; #eta; cos(#theta)", kTH2F, {{100, -1, 1}, {110, -1.1, 1.1}}); registryMCtruth.add("ThetaMCTruth/PositiveChild/hThetaPhi", " ; #phi; cos(#theta)", kTH2F, {{100, -1, 7}, {110, -1.1, 1.1}}); @@ -294,6 +301,14 @@ struct FemtoUniversePairTaskTrackV0Helicity { registryMCreco.add("minus/MCrecoPiPt", "MC reco pions;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); registryMCreco.add("minus/MCrecoPrPt", "MC reco protons;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryMCreco.add("ThetaMCReco/hTheta", " ; p (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}}); + registryMCreco.add("ThetaMCReco/PositiveChild/hThetaPt", " ; p_{T} (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}}); + registryMCreco.add("ThetaMCReco/PositiveChild/hThetaEta", " ; #eta; cos(#theta)", kTH2F, {{100, -1, 1}, {110, -1.1, 1.1}}); + registryMCreco.add("ThetaMCReco/PositiveChild/hThetaPhi", " ; #phi; cos(#theta)", kTH2F, {{100, -1, 7}, {110, -1.1, 1.1}}); + registryMCreco.add("ThetaMCReco/NegativeChild/hThetaPt", " ; p_{T} (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}}); + registryMCreco.add("ThetaMCReco/NegativeChild/hThetaEta", " ; #eta; cos(#theta)", kTH2F, {{100, -1, 1}, {110, -1.1, 1.1}}); + registryMCreco.add("ThetaMCReco/NegativeChild/hThetaPhi", " ; #phi; cos(#theta)", kTH2F, {{100, -1, 7}, {110, -1.1, 1.1}}); + sameEventCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, confIsMC, confUse3D); sameEventCont.setPDGCodes(confTrkPDGCodePartOne, confV0PDGCodePartTwo); mixedEventCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, confIsMC, confUse3D); @@ -351,6 +366,8 @@ struct FemtoUniversePairTaskTrackV0Helicity { negChildHistos.fillQA(negChild); thetaRegistry.fill(HIST("Theta/hTheta"), part.p(), cosineTheta); + thetaRegistry.fill(HIST("Theta/hTheta3D_PosChild"), part.p(), cosineTheta, posChild.p()); + thetaRegistry.fill(HIST("Theta/hTheta3D_NegChild"), part.p(), cosineTheta, negChild.p()); thetaRegistry.fill(HIST("Theta/PositiveChild/hThetaPt"), posChild.pt(), cosineTheta); thetaRegistry.fill(HIST("Theta/PositiveChild/hThetaEta"), posChild.eta(), cosineTheta); thetaRegistry.fill(HIST("Theta/PositiveChild/hThetaPhi"), posChild.phi(), cosineTheta); @@ -881,12 +898,17 @@ struct FemtoUniversePairTaskTrackV0Helicity { const auto& posChild = parts.iteratorAt(part.index() - 2); const auto& negChild = parts.iteratorAt(part.index() - 1); + registryMCtruth.fill(HIST("PosChildMCTruth/hPt"), posChild.pt()); + registryMCtruth.fill(HIST("NegChildMCTruth/hPt"), negChild.pt()); + auto posChildMass = pdg->Mass(confPDGCodePosChild); auto negChildMass = pdg->Mass(confPDGCodeNegChild); auto posChildBoosted = FemtoUniverseMath::boostPRF(posChild, posChildMass, negChild, negChildMass); auto cosineTheta = (posChildBoosted.Px() * part.px() + posChildBoosted.Py() * part.py() + posChildBoosted.Pz() * part.pz()) / (posChildBoosted.P() * part.p()); registryMCtruth.fill(HIST("ThetaMCTruth/hTheta"), part.p(), cosineTheta); + registryMCtruth.fill(HIST("ThetaMCTruth/hTheta3D_PosChild"), part.p(), cosineTheta, posChild.p()); + registryMCtruth.fill(HIST("ThetaMCTruth/hTheta3D_NegChild"), part.p(), cosineTheta, negChild.p()); registryMCtruth.fill(HIST("ThetaMCTruth/PositiveChild/hThetaPt"), posChild.pt(), cosineTheta); registryMCtruth.fill(HIST("ThetaMCTruth/PositiveChild/hThetaEta"), posChild.eta(), cosineTheta); registryMCtruth.fill(HIST("ThetaMCTruth/PositiveChild/hThetaPhi"), posChild.phi(), cosineTheta); From 83ebcaa9139c1fd233e06a3036594da534f1cc95 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Tue, 12 Aug 2025 21:39:29 +0200 Subject: [PATCH 034/986] [PWGEM/Dilepton] update 2PC (#12551) Co-authored-by: ALICE Action Bot --- PWGEM/Dilepton/Core/Dilepton.h | 2 +- PWGEM/Dilepton/Core/DileptonHadronMPC.h | 27 +++++++++++++--------- PWGEM/Dilepton/Core/DileptonMC.h | 2 +- PWGEM/Dilepton/Core/PhotonHBT.h | 2 +- PWGEM/Dilepton/Core/SingleTrackQC.h | 2 +- PWGEM/Dilepton/Core/SingleTrackQCMC.h | 2 +- PWGEM/Dilepton/DataModel/dileptonTables.h | 16 +++++++++---- PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h | 19 +++++++++------ 8 files changed, 45 insertions(+), 27 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 929932d4269..c928d1cc71f 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -106,7 +106,7 @@ struct Dilepton { Configurable cfgQvecEstimator{"cfgQvecEstimator", 0, "FT0M:0, FT0A:1, FT0C:2, BTot:3, BPos:4, BNeg:5"}; Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; Configurable cfgOccupancyEstimator{"cfgOccupancyEstimator", 0, "FT0C:0, Track:1"}; - Configurable cfgCentMin{"cfgCentMin", 0, "min. centrality"}; + Configurable cfgCentMin{"cfgCentMin", -1, "min. centrality"}; Configurable cfgCentMax{"cfgCentMax", 999.f, "max. centrality"}; Configurable cfgDoMix{"cfgDoMix", true, "flag for event mixing"}; Configurable ndepth{"ndepth", 100, "depth for event mixing"}; diff --git a/PWGEM/Dilepton/Core/DileptonHadronMPC.h b/PWGEM/Dilepton/Core/DileptonHadronMPC.h index e59fc87ad3c..058d69f9190 100644 --- a/PWGEM/Dilepton/Core/DileptonHadronMPC.h +++ b/PWGEM/Dilepton/Core/DileptonHadronMPC.h @@ -87,9 +87,6 @@ using MyMuon = MyMuons::iterator; using FilteredMyMuons = soa::Filtered; using FilteredMyMuon = FilteredMyMuons::iterator; -using MyTracks = soa::Join; -using MyTrack = MyTracks::iterator; - using MyEMH_electron = o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, EMTrack>; using MyEMH_muon = o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, EMFwdTrack>; using MyEMH_track = o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, EMTrack>; // for charged track @@ -114,7 +111,7 @@ struct DileptonHadronMPC { Configurable ndepth_hadron{"ndepth_hadron", 1, "depth for event mixing between hadron-hadron"}; Configurable ndiff_bc_mix{"ndiff_bc_mix", 594, "difference in global BC required in mixed events"}; ConfigurableAxis ConfVtxBins{"ConfVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; - ConfigurableAxis ConfCentBins{"ConfCentBins", {VARIABLE_WIDTH, 0.0f, 0.1, 1, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.f, 999.f}, "Mixing bins - centrality"}; + ConfigurableAxis ConfCentBins{"ConfCentBins", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.f, 999.f}, "Mixing bins - centrality"}; ConfigurableAxis ConfOccupancyBins{"ConfOccupancyBins", {VARIABLE_WIDTH, -1, 1e+10}, "Mixing bins - occupancy"}; Configurable cfg_swt_name{"cfg_swt_name", "fHighTrackMult", "desired software trigger name"}; // 1 trigger name per 1 task. fHighTrackMult, fHighFt0Mult // Configurable cfgNtracksPV08Min{"cfgNtracksPV08Min", -1, "min. multNTracksPV"}; @@ -122,7 +119,7 @@ struct DileptonHadronMPC { Configurable cfgApplyWeightTTCA{"cfgApplyWeightTTCA", false, "flag to apply weighting by 1/N"}; Configurable cfgDCAType{"cfgDCAType", 0, "type of DCA for output. 0:3D, 1:XY, 2:Z, else:3D"}; - ConfigurableAxis ConfMllBins{"ConfMllBins", {VARIABLE_WIDTH, 0.00, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.10, 0.11, 0.12, 0.13, 0.14, 0.20, 0.30, 0.40, 0.50, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.70, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.80, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.00, 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.10, 2.20, 2.30, 2.40, 2.50, 2.60, 2.70, 2.75, 2.80, 2.85, 2.90, 2.95, 3.00, 3.05, 3.10, 3.15, 3.20, 3.25, 3.30, 3.35, 3.40, 3.45, 3.50, 3.55, 3.60, 3.65, 3.70, 3.75, 3.80, 3.85, 3.90, 3.95, 4.00}, "mll bins for output histograms"}; + ConfigurableAxis ConfMllBins{"ConfMllBins", {VARIABLE_WIDTH, 0.00, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.50, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.70, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.80, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.00, 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.10, 2.20, 2.30, 2.40, 2.50, 2.60, 2.70, 2.75, 2.80, 2.85, 2.90, 2.95, 3.00, 3.05, 3.10, 3.15, 3.20, 3.25, 3.30, 3.35, 3.40, 3.45, 3.50, 3.55, 3.60, 3.65, 3.70, 3.75, 3.80, 3.85, 3.90, 3.95, 4.00}, "mll bins for output histograms"}; ConfigurableAxis ConfPtllBins{"ConfPtllBins", {VARIABLE_WIDTH, 0.00, 0.15, 0.50, 1.00, 1.50, 2.00, 2.50, 3.00, 3.50, 4.00, 4.50, 5.00, 6.00, 7.00, 8.00, 9.00, 10.00}, "pTll bins for output histograms"}; ConfigurableAxis ConfDCAllBins{"ConfDCAllBins", {VARIABLE_WIDTH, 0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, "DCAll bins for output histograms"}; @@ -289,7 +286,7 @@ struct DileptonHadronMPC { // Configurable cfg_max_phi_track{"cfg_max_phi_track", 6.3, "max phi for ref. track"}; // Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 0.5, "max dca XY for single track in cm"}; // Configurable cfg_max_dcaz{"cfg_max_dcaz", 0.5, "max dca Z for single track in cm"}; - Configurable cfg_track_bits{"cfg_track_bits", 645, "required track bits"}; // default:645, loose:0, tight:778 + Configurable cfg_track_bits{"cfg_track_bits", 5765, "required track bits"}; // default:645, loose:0, tight:778 } trackcuts; o2::aod::rctsel::RCTFlagsChecker rctChecker; @@ -511,7 +508,9 @@ struct DileptonHadronMPC { const AxisSpec axis_pt_trg{ConfPtHadronBins, "p_{T,h} (GeV/c)"}; const AxisSpec axis_eta_trg{40, -2, +2, "#eta_{h}"}; const AxisSpec axis_phi_trg{36, 0, 2 * M_PI, "#varphi_{h} (rad.)"}; - fRegistry.add("Hadron/hs", "hadron", kTHnSparseD, {axis_pt_trg, axis_eta_trg, axis_phi_trg}, true); + fRegistry.add("Hadron/hs", "hadron", kTHnSparseD, {axis_pt_trg, axis_eta_trg, axis_phi_trg}, false); + fRegistry.add("Hadron/hTrackBit", "track bit", kTH1D, {{65536, -0.5, 65535.5}}, false); + fRegistry.add("Dilepton/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y}, true); fRegistry.addClone("Dilepton/same/uls/", "Dilepton/same/lspp/"); fRegistry.addClone("Dilepton/same/uls/", "Dilepton/same/lsmm/"); @@ -1063,14 +1062,19 @@ struct DileptonHadronMPC { Partition positive_electrons = o2::aod::emprimaryelectron::sign > int8_t(0); Partition negative_electrons = o2::aod::emprimaryelectron::sign < int8_t(0); - Preslice perCollision_track = aod::emprimarytrack::emeventId; - Preslice perCollision_muon = aod::emprimarymuon::emeventId; Filter trackFilter_muon = o2::aod::fwdtrack::trackType == dimuoncuts.cfg_track_type && dimuoncuts.cfg_min_pt_track < o2::aod::fwdtrack::pt && o2::aod::fwdtrack::pt < dimuoncuts.cfg_max_pt_track && dimuoncuts.cfg_min_eta_track < o2::aod::fwdtrack::eta && o2::aod::fwdtrack::eta < dimuoncuts.cfg_max_eta_track && dimuoncuts.cfg_min_phi_track < o2::aod::fwdtrack::phi && o2::aod::fwdtrack::phi < dimuoncuts.cfg_max_phi_track; Filter ttcaFilter_muon = ifnode(dimuoncuts.enableTTCA.node(), o2::aod::emprimarymuon::isAssociatedToMPC == true || o2::aod::emprimarymuon::isAssociatedToMPC == false, o2::aod::emprimarymuon::isAssociatedToMPC == true); Partition positive_muons = o2::aod::emprimarymuon::sign > int8_t(0); Partition negative_muons = o2::aod::emprimarymuon::sign < int8_t(0); + using RefTracks = soa::Join; + using RefTrack = RefTracks::iterator; + Preslice perCollision_track = aod::emprimarytrack::emeventId; + Filter refTrackFilter = trackcuts.cfg_min_pt_track < 1 / nabs(o2::aod::emprimarytrack::signed1Pt) && 1 / nabs(o2::aod::emprimarytrack::signed1Pt) < trackcuts.cfg_max_pt_track && trackcuts.cfg_min_eta_track < o2::aod::emprimarytrack::eta && o2::aod::emprimarytrack::eta < trackcuts.cfg_max_eta_track; + using FilteredRefTracks = soa::Filtered; + using FilteredRefTrack = FilteredRefTracks::iterator; + TEMH* emh_pos = nullptr; TEMH* emh_neg = nullptr; MyEMH_track* emh_ref = nullptr; // for reference flow @@ -1149,6 +1153,7 @@ struct DileptonHadronMPC { for (const auto& track : refTracks_per_coll) { if (fEMTrackCut.IsSelected(track)) { fRegistry.fill(HIST("Hadron/hs"), track.pt(), track.eta(), track.phi()); + fRegistry.fill(HIST("Hadron/hTrackBit"), track.trackBit()); } } for (const auto& [trg, ref] : combinations(CombinationsStrictlyUpperIndexPolicy(refTracks_per_coll, refTracks_per_coll))) { @@ -1408,7 +1413,7 @@ struct DileptonHadronMPC { passed_pairIds.shrink_to_fit(); } - void processAnalysis(FilteredMyCollisions const& collisions, MyTracks const& refTracks, Types const&... args) + void processAnalysis(FilteredMyCollisions const& collisions, FilteredRefTracks const& refTracks, Types const&... args) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { auto electrons = std::get<0>(std::tie(args...)); @@ -1429,7 +1434,7 @@ struct DileptonHadronMPC { PROCESS_SWITCH(DileptonHadronMPC, processAnalysis, "run dilepton analysis", true); using FilteredMyCollisionsWithSWT = soa::Filtered; - void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, MyTracks const& refTracks, Types const&... args) + void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, FilteredRefTracks const& refTracks, Types const&... args) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { auto electrons = std::get<0>(std::tie(args...)); diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index 6e308ead765..57beff3f8f1 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -96,7 +96,7 @@ struct DileptonMC { Configurable cfgEventGeneratorType{"cfgEventGeneratorType", -1, "if positive, select event generator type. i.e. gap or signal"}; Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; - Configurable cfgCentMin{"cfgCentMin", 0, "min. centrality"}; + Configurable cfgCentMin{"cfgCentMin", -1, "min. centrality"}; Configurable cfgCentMax{"cfgCentMax", 999.f, "max. centrality"}; // Configurable cfgNtracksPV08Min{"cfgNtracksPV08Min", -1, "min. multNTracksPV"}; // Configurable cfgNtracksPV08Max{"cfgNtracksPV08Max", static_cast(1e+9), "max. multNTracksPV"}; diff --git a/PWGEM/Dilepton/Core/PhotonHBT.h b/PWGEM/Dilepton/Core/PhotonHBT.h index 678c3e800f3..180360e44f3 100644 --- a/PWGEM/Dilepton/Core/PhotonHBT.h +++ b/PWGEM/Dilepton/Core/PhotonHBT.h @@ -99,7 +99,7 @@ struct PhotonHBT { Configurable cfgEP2Estimator_for_Mix{"cfgEP2Estimator_for_Mix", 3, "FT0M:0, FT0A:1, FT0C:2, BTot:3, BPos:4, BNeg:5"}; Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; Configurable cfgOccupancyEstimator{"cfgOccupancyEstimator", 0, "FT0C:0, Track:1"}; - Configurable cfgCentMin{"cfgCentMin", 0, "min. centrality"}; + Configurable cfgCentMin{"cfgCentMin", -1, "min. centrality"}; Configurable cfgCentMax{"cfgCentMax", 999, "max. centrality"}; Configurable maxY{"maxY", 0.8, "maximum rapidity for reconstructed particles"}; Configurable cfgDoMix{"cfgDoMix", true, "flag for event mixing"}; diff --git a/PWGEM/Dilepton/Core/SingleTrackQC.h b/PWGEM/Dilepton/Core/SingleTrackQC.h index ae41d2dd210..4f9744ea769 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQC.h @@ -75,7 +75,7 @@ struct SingleTrackQC { Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; - Configurable cfgCentMin{"cfgCentMin", 0, "min. centrality"}; + Configurable cfgCentMin{"cfgCentMin", -1, "min. centrality"}; Configurable cfgCentMax{"cfgCentMax", 999.f, "max. centrality"}; Configurable cfg_swt_name{"cfg_swt_name", "fHighTrackMult", "desired software trigger name"}; // 1 trigger name per 1 task. fHighTrackMult, fHighFt0Mult // Configurable cfgNtracksPV08Min{"cfgNtracksPV08Min", -1, "min. multNTracksPV"}; diff --git a/PWGEM/Dilepton/Core/SingleTrackQCMC.h b/PWGEM/Dilepton/Core/SingleTrackQCMC.h index 6410f8e4134..95e4bc97507 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQCMC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQCMC.h @@ -82,7 +82,7 @@ struct SingleTrackQCMC { Configurable cfgEventGeneratorType{"cfgEventGeneratorType", -1, "if positive, select event generator type. i.e. gap or signal"}; Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; - Configurable cfgCentMin{"cfgCentMin", 0, "min. centrality"}; + Configurable cfgCentMin{"cfgCentMin", -1, "min. centrality"}; Configurable cfgCentMax{"cfgCentMax", 999.f, "max. centrality"}; // Configurable cfgNtracksPV08Min{"cfgNtracksPV08Min", -1, "min. multNTracksPV"}; // Configurable cfgNtracksPV08Max{"cfgNtracksPV08Max", static_cast(1e+9), "max. multNTracksPV"}; diff --git a/PWGEM/Dilepton/DataModel/dileptonTables.h b/PWGEM/Dilepton/DataModel/dileptonTables.h index f290ac8548b..f507a5220ba 100644 --- a/PWGEM/Dilepton/DataModel/dileptonTables.h +++ b/PWGEM/Dilepton/DataModel/dileptonTables.h @@ -762,24 +762,32 @@ DECLARE_SOA_TABLE(EMGlobalMuonSelfIds, "AOD", "EMGLMUSELFID", emprimarymuon::Glo // iterators using EMGlobalMuonSelfId = EMGlobalMuonSelfIds::iterator; +namespace oldemprimarytrack +{ +DECLARE_SOA_COLUMN(Sign, sign, int8_t); +} // namespace oldemprimarytrack + namespace emprimarytrack { DECLARE_SOA_INDEX_COLUMN(EMEvent, emevent); //! DECLARE_SOA_COLUMN(CollisionId, collisionId, int); //! DECLARE_SOA_COLUMN(TrackId, trackId, int); //! -DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! DECLARE_SOA_COLUMN(TrackBit, trackBit, uint16_t); //! +DECLARE_SOA_COLUMN(Signed1Pt, signed1Pt, float); //! (sign of charge)/Pt in c/GeV. Use pt() and sign() instead +DECLARE_SOA_COLUMN(Eta, eta, float); //! +DECLARE_SOA_COLUMN(Phi, phi, float); //! DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, [](float signed1Pt) -> float { return 1.f / std::fabs(signed1Pt); }); +DECLARE_SOA_DYNAMIC_COLUMN(Sign, sign, [](float signed1Pt) -> short { return (signed1Pt > 0) ? 1 : -1; }); //! Charge: positive: 1, negative: -1 } // namespace emprimarytrack DECLARE_SOA_TABLE_VERSIONED(EMPrimaryTracks_000, "AOD", "EMPRIMARYTRACK", 0, //! primary charged track table for 2PC - o2::soa::Index<>, emprimarytrack::CollisionId, emprimarytrack::TrackId, emprimarytrack::Sign, track::Pt, track::Eta, track::Phi, emprimarytrack::TrackBit); + o2::soa::Index<>, emprimarytrack::CollisionId, emprimarytrack::TrackId, oldemprimarytrack::Sign, track::Pt, track::Eta, track::Phi, emprimarytrack::TrackBit); DECLARE_SOA_TABLE_VERSIONED(EMPrimaryTracks_001, "AOD", "EMPRIMARYTRACK", 1, //! primary charged track table for 2PC o2::soa::Index<>, emprimarytrack::CollisionId, emprimarytrack::TrackId, - track::Signed1Pt, track::Eta, track::Phi, emprimarytrack::TrackBit, + emprimarytrack::Signed1Pt, emprimarytrack::Eta, emprimarytrack::Phi, emprimarytrack::TrackBit, // dynamic column - track::Sign, emprimarytrack::Pt); + emprimarytrack::Sign, emprimarytrack::Pt); using EMPrimaryTracks = EMPrimaryTracks_001; // iterators diff --git a/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h index 53e26450c64..38379707151 100644 --- a/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h +++ b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h @@ -78,9 +78,6 @@ using MyV0Photon = MyV0Photons::iterator; using MyPrimaryElectrons = soa::Filtered>; using MyPrimaryElectron = MyPrimaryElectrons::iterator; -using MyTracks = soa::Join; -using MyTrack = MyTracks::iterator; - template struct DiphotonHadronMPC { @@ -362,7 +359,8 @@ struct DiphotonHadronMPC { const AxisSpec axis_eta_hadron{40, -2, +2, "#eta_{h}"}; const AxisSpec axis_phi_hadron{36, 0, 2 * M_PI, "#varphi_{h} (rad.)"}; - fRegistry.add("Hadron/hs", "hadron", kTHnSparseD, {axis_pt_hadron, axis_eta_hadron, axis_phi_hadron}, true); + fRegistry.add("Hadron/hs", "hadron", kTHnSparseD, {axis_pt_hadron, axis_eta_hadron, axis_phi_hadron}, false); + fRegistry.add("Hadron/hTrackBit", "track bit", kTH1D, {{65536, -0.5, 65535.5}}, false); fRegistry.add("Diphoton/same/hs", "diphoton", kTHnSparseD, {axis_mass, axis_pt}, true); fRegistry.addClone("Diphoton/same/", "Diphoton/mix/"); @@ -467,12 +465,18 @@ struct DiphotonHadronMPC { SliceCache cache; Preslice perCollision_pcm = aod::v0photonkf::emeventId; - Preslice perCollision_track = aod::emprimarytrack::emeventId; Preslice perCollision_electron = aod::emprimaryelectron::emeventId; Partition positrons = o2::aod::emprimaryelectron::sign > int8_t(0) && static_cast(dileptoncuts.cfg_min_pt_track) < o2::aod::track::pt&& nabs(o2::aod::track::eta) < static_cast(dileptoncuts.cfg_max_eta_track) && static_cast(dileptoncuts.cfg_min_TPCNsigmaEl) < o2::aod::pidtpc::tpcNSigmaEl&& o2::aod::pidtpc::tpcNSigmaEl < static_cast(dileptoncuts.cfg_max_TPCNsigmaEl); Partition electrons = o2::aod::emprimaryelectron::sign < int8_t(0) && static_cast(dileptoncuts.cfg_min_pt_track) < o2::aod::track::pt && nabs(o2::aod::track::eta) < static_cast(dileptoncuts.cfg_max_eta_track) && static_cast(dileptoncuts.cfg_min_TPCNsigmaEl) < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < static_cast(dileptoncuts.cfg_max_TPCNsigmaEl); + using RefTracks = soa::Join; + using RefTrack = RefTracks::iterator; + Preslice perCollision_track = aod::emprimarytrack::emeventId; + Filter refTrackFilter = trackcuts.cfg_min_pt_track < 1 / nabs(o2::aod::emprimarytrack::signed1Pt) && 1 / nabs(o2::aod::emprimarytrack::signed1Pt) < trackcuts.cfg_max_pt_track && trackcuts.cfg_min_eta_track < o2::aod::emprimarytrack::eta && o2::aod::emprimarytrack::eta < trackcuts.cfg_max_eta_track; + using FilteredRefTracks = soa::Filtered; + using FilteredRefTrack = FilteredRefTracks::iterator; + using MyEMH = o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, EMTrack>; MyEMH* emh1 = nullptr; MyEMH* emh2 = nullptr; @@ -555,6 +559,7 @@ struct DiphotonHadronMPC { for (const auto& track : refTracks_per_collision) { if (fEMTrackCut.IsSelected(track)) { fRegistry.fill(HIST("Hadron/hs"), track.pt(), track.eta(), track.phi()); + fRegistry.fill(HIST("Hadron/hTrackBit"), track.trackBit()); } } @@ -942,7 +947,7 @@ struct DiphotonHadronMPC { Filter prefilter_primaryelectron = ifnode(dileptoncuts.cfg_apply_cuts_from_prefilter_derived.node(), o2::aod::emprimaryelectron::pfbderived == static_cast(0), true); int ndf = 0; - void processAnalysis(FilteredMyCollisions const& collisions, MyTracks const& refTracks, Types const&... args) + void processAnalysis(FilteredMyCollisions const& collisions, FilteredRefTracks const& refTracks, Types const&... args) { // LOGF(info, "ndf = %d", ndf); if constexpr (pairtype == PairType::kPCMPCM) { @@ -961,7 +966,7 @@ struct DiphotonHadronMPC { PROCESS_SWITCH(DiphotonHadronMPC, processAnalysis, "process pair analysis", true); using FilteredMyCollisionsWithSWT = soa::Filtered; - void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, MyTracks const& refTracks, Types const&... args) + void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, FilteredRefTracks const& refTracks, Types const&... args) { // LOGF(info, "ndf = %d", ndf); if constexpr (pairtype == PairType::kPCMPCM) { From 70831862db093401ea629a6883628ca8ccc214c7 Mon Sep 17 00:00:00 2001 From: JStaa <39123272+JStaa@users.noreply.github.com> Date: Wed, 13 Aug 2025 00:42:42 +0200 Subject: [PATCH 035/986] [PWGCF] Fixed a sign error in the trackFilters function (#12548) --- .../Tasks/threeParticleCorrelations.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx b/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx index 4bd814039cc..a64d25c6d67 100644 --- a/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx +++ b/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx @@ -1007,7 +1007,7 @@ struct ThreeParticleCorrelations { return false; } } else if (track.pt() > pionPtMid1 && track.pt() < pionPtMid2) { - if (track.tofNSigmaPi() <= -nSigma4 || track.tofNSigmaPi() >= -nSigma2) { + if (track.tofNSigmaPi() <= -nSigma4 || track.tofNSigmaPi() >= nSigma2) { return false; } } else if (track.pt() > pionPtMid2 && track.pt() < pionPtMax) { From 1c978b983e4a5ddc057970113189e4cda081fa90 Mon Sep 17 00:00:00 2001 From: prottayCMT <61418725+prottayCMT@users.noreply.github.com> Date: Wed, 13 Aug 2025 04:44:48 +0200 Subject: [PATCH 036/986] [PWGLF] filled few topological variable distributions (#12552) Co-authored-by: Prottay Das --- PWGLF/Tasks/Strangeness/lambdapolsp.cxx | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/PWGLF/Tasks/Strangeness/lambdapolsp.cxx b/PWGLF/Tasks/Strangeness/lambdapolsp.cxx index 105fc94bbc7..492f71e8d7d 100644 --- a/PWGLF/Tasks/Strangeness/lambdapolsp.cxx +++ b/PWGLF/Tasks/Strangeness/lambdapolsp.cxx @@ -199,6 +199,14 @@ struct lambdapolsp { Configurable nMix{"nMix", 5, "number of event mixing"}; } meGrp; + struct : ConfigurableGroup { + ConfigurableAxis axisCosine{"axisCosine", {100, 0, 1}, "cosine axis"}; + ConfigurableAxis axisRadius{"axisRadius", {200, 0, 100}, "radius axis"}; + ConfigurableAxis axisDca{"axisDca", {100, -5, 5}, "dca axis"}; + ConfigurableAxis axisLT{"axisLT", {50, 0, 50}, "lifetime axis"}; + Configurable filldist{"filldist", true, "fill topo distr"}; + } distGrp; + RCTFlagsChecker rctChecker; SliceCache cache; @@ -388,6 +396,17 @@ struct lambdapolsp { // histos.add("hSparseAntiLambda_corr2b", "hSparseAntiLambda_corr2b", HistType::kTHnSparseF, runaxes, true); } + if (distGrp.filldist) { + histos.add("hcosine", "hcosine", HistType::kTH1D, {distGrp.axisCosine}, true); + histos.add("hdcabwv0daugh", "hdcabwv0daugh", HistType::kTH1D, {distGrp.axisDca}, true); + histos.add("hlifetime", "hlifetime", HistType::kTH1D, {distGrp.axisLT}, true); + histos.add("hradius", "hradius", HistType::kTH1D, {distGrp.axisRadius}, true); + histos.add("hdcaposlambda", "hdcaposlambda", HistType::kTH1D, {distGrp.axisDca}, true); + histos.add("hdcaneglambda", "hdcaneglambda", HistType::kTH1D, {distGrp.axisDca}, true); + histos.add("hdcaposantilambda", "hdcaposantilambda", HistType::kTH1D, {distGrp.axisDca}, true); + histos.add("hdcanegantilambda", "hdcanegantilambda", HistType::kTH1D, {distGrp.axisDca}, true); + } + ccdb->setURL(cfgCcdbParam.cfgURL); ccdbApi.init("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); @@ -1132,12 +1151,23 @@ struct lambdapolsp { } } } else { + if (distGrp.filldist) { + histos.fill(HIST("hcosine"), v0.v0cosPA()); + histos.fill(HIST("hdcabwv0daugh"), v0.dcaV0daughters()); + histos.fill(HIST("hlifetime"), TMath::Abs(v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * massLambda)); + histos.fill(HIST("hradius"), v0.v0radius()); + } + if (LambdaTag) { Lambda = Proton + AntiPion; tagb = 0; int binx = accprofileL->GetXaxis()->FindBin(v0.eta()); int biny = accprofileL->GetYaxis()->FindBin(v0.pt()); double acvalue = accprofileL->GetBinContent(binx, biny); + if (distGrp.filldist) { + histos.fill(HIST("hdcaposlambda"), v0.dcapostopv()); + histos.fill(HIST("hdcaneglambda"), v0.dcanegtopv()); + } fillHistograms(taga, tagb, Lambda, Proton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mLambda(), v0.pt(), v0.eta(), acvalue, 1.0); } @@ -1148,6 +1178,10 @@ struct lambdapolsp { int binx = accprofileAL->GetXaxis()->FindBin(v0.eta()); int biny = accprofileAL->GetYaxis()->FindBin(v0.pt()); double acvalue = accprofileAL->GetBinContent(binx, biny); + if (distGrp.filldist) { + histos.fill(HIST("hdcaposantilambda"), v0.dcapostopv()); + histos.fill(HIST("hdcanegantilambda"), v0.dcanegtopv()); + } fillHistograms(taga, tagb, AntiLambda, AntiProton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mAntiLambda(), v0.pt(), v0.eta(), acvalue, wgtvalue); } } From abf6bd363227856bcceec848eeee21b29e0082c0 Mon Sep 17 00:00:00 2001 From: altsybee Date: Wed, 13 Aug 2025 07:22:42 +0200 Subject: [PATCH 037/986] [DPG] more QA histograms (#12553) --- DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx | 66 ++++++++++++++++------ DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx | 16 ++++++ 2 files changed, 66 insertions(+), 16 deletions(-) diff --git a/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx b/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx index 037fb6db839..dbe678d987b 100644 --- a/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx +++ b/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx @@ -14,30 +14,31 @@ /// /// \author Igor Altsybeev -#include -#include - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Common/DataModel/EventSelection.h" #include "Common/CCDB/EventSelectionParams.h" -#include "CCDB/BasicCCDBManager.h" -#include "Framework/HistogramRegistry.h" -#include "CommonDataFormat/BunchFilling.h" -#include "DataFormatsParameters/GRPLHCIFData.h" -#include "DataFormatsParameters/GRPECSObject.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectionDefaults.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CommonDataFormat/BunchFilling.h" #include "DataFormatsParameters/AggregatedRunInfo.h" +#include "DataFormatsParameters/GRPECSObject.h" +#include "DataFormatsParameters/GRPLHCIFData.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" #include "TH1F.h" #include "TH2F.h" #include "TH3.h" +#include +#include + using namespace o2; using namespace o2::framework; using namespace o2::aod::evsel; @@ -90,11 +91,14 @@ struct DetectorOccupancyQaTask { Configurable nMaxBcInTFforAnalysis{"nMaxBcInTFforAnalysis", -1, "When to stop taking collisions in TF, if -1: take all collisions"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable confNPhiBins{"nPhiBins", 810, "N phi bits for histograms"}; // o2-linter: disable=name/configurable (temporary fix) + ConfigurableAxis confAxisPtBinsForPhiStudy{"PtBinsForPhiStudy", {VARIABLE_WIDTH, 0.2, 0.6, 1.0, 2.0, 10}, "pt axis"}; ConfigurableAxis confAxisOccupForKine{"AxisOccupForKine", {VARIABLE_WIDTH, 0, 500, 1000, 2000, 4000, 6000, 8000, 10000, 20000}, "weighted occupancy"}; Configurable confUsePhiAtTPCinnerR{"UsePhiAtTPCinnerR", false, "0 - not use, 1 - use"}; // o2-linter: disable=name/configurable (temporary fix) Configurable confUseAorCsideForPhiStudy{"UseAorCsideForPhiStudy", -1, "-1 - use full eta range, 0 - A, 1 - C sides"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable confRadiusForPhiCorrection{"RadiusForPhiCorrection", 0.8, "default: inner TPC radius, cm"}; // o2-linter: disable=name/configurable (temporary fix) uint64_t minGlobalBC = 0; Service ccdb; @@ -263,7 +267,7 @@ struct DetectorOccupancyQaTask { histos.add("track_distr_nITStrThisEv_above_2000/hEta_highOccupInDistantFuture", ";#eta;n tracks", kTH1D, {axisEta}); histos.add("track_distr_nITStrThisEv_above_2000/hEta_highOccupInNeighbourEvents", ";#eta;n tracks", kTH1D, {axisEta}); - const int nPhiBins = 810; // 18*45 + const int nPhiBins = confNPhiBins; // 810=18*45 AxisSpec axisPhi{nPhiBins, 0, TMath::TwoPi(), "#varphi"}; // o2-linter: disable=external-pi (temporary fix) histos.add("track_distr_nITStrThisEv_10_200/hPhi_lowOccupInTPC", ";#varphi;n tracks", kTH1D, {axisPhi}); histos.add("track_distr_nITStrThisEv_10_200/hPhi_highOccupInRecentPast", ";#varphi;n tracks", kTH1D, {axisPhi}); @@ -303,6 +307,13 @@ struct DetectorOccupancyQaTask { histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPhi_pos", ";#varphi;n tracks", kTH3D, {axisPhi, confAxisOccupForKine, confAxisPtBinsForPhiStudy}); histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPhi_neg", ";#varphi;n tracks", kTH3D, {axisPhi, confAxisOccupForKine, confAxisPtBinsForPhiStudy}); + histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPhi_tpcNClsFindable_pos", ";#varphi;n tracks", kTH3D, {axisPhi, confAxisOccupForKine, confAxisPtBinsForPhiStudy}); + histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPhi_tpcNClsFound_pos", ";#varphi;n tracks", kTH3D, {axisPhi, confAxisOccupForKine, confAxisPtBinsForPhiStudy}); + histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPhi_tpcNClsCrossedRows_pos", ";#varphi;n tracks", kTH3D, {axisPhi, confAxisOccupForKine, confAxisPtBinsForPhiStudy}); + histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPhi_tpcNClsFindable_neg", ";#varphi;n tracks", kTH3D, {axisPhi, confAxisOccupForKine, confAxisPtBinsForPhiStudy}); + histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPhi_tpcNClsFound_neg", ";#varphi;n tracks", kTH3D, {axisPhi, confAxisOccupForKine, confAxisPtBinsForPhiStudy}); + histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPhi_tpcNClsCrossedRows_neg", ";#varphi;n tracks", kTH3D, {axisPhi, confAxisOccupForKine, confAxisPtBinsForPhiStudy}); + histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/PV_hPt_pos", ";p_{T};weighted occupancy", kTH2D, {axisLogPt, confAxisOccupForKine}); histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/PV_hPt_neg", ";p_{T};weighted occupancy", kTH2D, {axisLogPt, confAxisOccupForKine}); histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/PV_hEta_pos", ";#eta;weighted occupancy", kTH2D, {axisEta, confAxisOccupForKine}); @@ -328,6 +339,12 @@ struct DetectorOccupancyQaTask { histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/PV_hPhi_pos", ";#varphi;n tracks", kTH3D, {axisPhi, confAxisOccupForKine, confAxisPtBinsForPhiStudy}); histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/PV_hPhi_neg", ";#varphi;n tracks", kTH3D, {axisPhi, confAxisOccupForKine, confAxisPtBinsForPhiStudy}); + // QA nTPCcls + AxisSpec axisNTPCclsPlusMinusQA{521, -260, 260, "n TPC clusters"}; + histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/QA_tpcNClsFindable_pos", "", kTH1D, {axisNTPCclsPlusMinusQA}); + histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/QA_tpcNClsFound_pos", "", kTH1D, {axisNTPCclsPlusMinusQA}); + histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/QA_tpcNClsCrossedRows_pos", "", kTH1D, {axisNTPCclsPlusMinusQA}); + AxisSpec axisLogPtFor2D{50, 0.05, 10, "p_{T}"}; AxisSpec axisLogPtTpcFor2D{50, 0.05, 10, "p_{T} TPC inner"}; histos.add("track_distr_nITStrThisEv_10_200/hPt_vs_tpcInnerPt_vs_occup", ";p_{T};p_{T} TPC inner;weighted occupancy", kTH3D, {axisLogPtFor2D, axisLogPtTpcFor2D, confAxisOccupForKine}); @@ -1235,7 +1252,7 @@ struct DetectorOccupancyQaTask { float phiInitial = phi; if (confUsePhiAtTPCinnerR) { - phi -= asin(0.8 /*inner TPC radius*/ / 2 * 0.3 * sign * 0.5 / pt); + phi -= asin(confRadiusForPhiCorrection /*inner TPC radius*/ / 2 * 0.3 * sign * 0.5 / pt); if (phi < 0) phi += TMath::TwoPi(); else if (phi > TMath::TwoPi()) @@ -1280,6 +1297,11 @@ struct DetectorOccupancyQaTask { } // end of TPC good global // July 2025: for data vs MC kine distr comparison + + int tpcNClsFindable = track.tpcNClsFindable(); + int tpcNClsFound = track.tpcNClsFound(); + int tpcNClsCrossedRows = track.tpcNClsCrossedRows(); + if (sign > 0) // positive tracks { histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/PV_hPt_pos"), pt, occupancy); @@ -1289,6 +1311,14 @@ struct DetectorOccupancyQaTask { histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPt_pos"), pt, occupancy); histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hEta_pos"), eta, occupancy); histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPhi_pos"), phi, occupancy, pt); + + histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPhi_tpcNClsFindable_pos"), phi, occupancy, pt, tpcNClsFindable); + histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPhi_tpcNClsFound_pos"), phi, occupancy, pt, tpcNClsFound); + histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPhi_tpcNClsCrossedRows_pos"), phi, occupancy, pt, tpcNClsCrossedRows); + + histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/QA_tpcNClsFindable_pos"), tpcNClsFindable); + histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/QA_tpcNClsFound_pos"), tpcNClsFound); + histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/QA_tpcNClsCrossedRows_pos"), tpcNClsCrossedRows); } } else // negative tracks { @@ -1299,6 +1329,10 @@ struct DetectorOccupancyQaTask { histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPt_neg"), pt, occupancy); histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hEta_neg"), eta, occupancy); histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPhi_neg"), phi, occupancy, pt); + + histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPhi_tpcNClsFindable_neg"), phi, occupancy, pt, tpcNClsFindable); + histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPhi_tpcNClsFound_neg"), phi, occupancy, pt, tpcNClsFound); + histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPhi_tpcNClsCrossedRows_neg"), phi, occupancy, pt, tpcNClsCrossedRows); } } // end of July 2025: for data vs MC kine distr comparison diff --git a/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx b/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx index 2d62bba9221..a98bf5b1300 100644 --- a/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx +++ b/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx @@ -641,9 +641,18 @@ struct LightIonsEvSelQa { histos.add("hSecondsCollisions/noPU_good", "", kTH1F, {axisSeconds}); const AxisSpec axisDiffMeanVz{80, -4, 4, ""}; + const AxisSpec axisVzNarrow{40, -10, 10, ""}; histos.add("hSecondsCollisions/noPU_meanDiffVz", "", kTH2F, {axisSeconds, axisDiffMeanVz}); histos.add("hSecondsCollisions/noPU_meanDiffVz_lowMult", "", kTH2F, {axisSeconds, axisDiffMeanVz}); histos.add("hSecondsCollisions/noPU_meanDiffVz_highMult", "", kTH2F, {axisSeconds, axisDiffMeanVz}); + histos.add("hSecondsCollisions/noPU_Vz", "", kTH2F, {axisSeconds, axisVzNarrow}); + histos.add("hSecondsCollisions/noPU_VzByFT0", "", kTH2F, {axisSeconds, axisVzNarrow}); + + const AxisSpec axisVz{200, -20, 20, ""}; + histos.add("noSpecSelections/Vz", "", kTH1F, {axisVz}); + histos.add("noPU/Vz", "", kTH1F, {axisVz}); + histos.add("noPU_badVzDiff/Vz", "", kTH1F, {axisVz}); + histos.add("noPU_goodVzDiff/Vz", "", kTH1F, {axisVz}); } // end of runNumber check @@ -958,10 +967,12 @@ struct LightIonsEvSelQa { histos.fill(HIST("noSpecSelections/hBcColNoSel8"), localBC); histos.fill(HIST("noSpecSelections/hBcOrigNoSel8"), bcOriginal); + histos.fill(HIST("noSpecSelections/Vz"), vZ); if (noPU) { histos.fill(HIST("noPU/hBcColNoSel8"), localBC); histos.fill(HIST("noPU/hBcOrigNoSel8"), bcOriginal); + histos.fill(HIST("noPU/Vz"), vZ); } if (noPU && pvTOFmatched) { histos.fill(HIST("noPU_pvTOFmatched/hBcColNoSel8"), localBC); @@ -986,9 +997,11 @@ struct LightIonsEvSelQa { } if (noPU && badVzDiff) { histos.fill(HIST("noPU_badVzDiff/hBcColNoSel8"), localBC); + histos.fill(HIST("noPU_badVzDiff/Vz"), vZ); } if (noPU && !badVzDiff) { histos.fill(HIST("noPU_goodVzDiff/hBcColNoSel8"), localBC); + histos.fill(HIST("noPU_goodVzDiff/Vz"), vZ); } if (noPU && !badVzDiff && narrowTimeVeto) { histos.fill(HIST("noPU_goodVzDiff_narrowTimeVeto/hBcColNoSel8"), localBC); @@ -1043,6 +1056,9 @@ struct LightIonsEvSelQa { if (!underLine && !grassOnTheRight) histos.fill(HIST("hSecondsCollisions/noPU_good"), secFromSOR); + histos.fill(HIST("hSecondsCollisions/noPU_Vz"), secFromSOR, vZ); + histos.fill(HIST("hSecondsCollisions/noPU_VzByFT0"), secFromSOR, vZft0); + if (std::abs(diffVz) < 4) { histos.fill(HIST("hSecondsCollisions/noPU_meanDiffVz"), secFromSOR, diffVz); if (multT0M < 1000) From c77a8896f0a778f59a6805324376e3f6b5b67220 Mon Sep 17 00:00:00 2001 From: Jonghan Park <40240384+jpxrk@users.noreply.github.com> Date: Wed, 13 Aug 2025 16:23:26 +0900 Subject: [PATCH 038/986] [PWGHF] Implement expert comments (#12555) --- PWGHF/HFL/Tasks/taskSingleElectron.cxx | 228 ++++++++++++------------- 1 file changed, 114 insertions(+), 114 deletions(-) diff --git a/PWGHF/HFL/Tasks/taskSingleElectron.cxx b/PWGHF/HFL/Tasks/taskSingleElectron.cxx index 55b7c90c39e..76998fdf90f 100644 --- a/PWGHF/HFL/Tasks/taskSingleElectron.cxx +++ b/PWGHF/HFL/Tasks/taskSingleElectron.cxx @@ -18,51 +18,54 @@ #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" +#include #include #include #include +#include + using namespace o2; using namespace o2::constants::math; +using namespace o2::constants::physics; using namespace o2::framework; using namespace o2::framework::expressions; enum PdgCode { kEta = 221, kOmega = 223, - kPhi = 333, kEtaPrime = 331 }; enum SourceType { - NotElec = 0, // not electron - DirectCharm = 1, // electrons from prompt charm hadrons - DirectBeauty = 2, // electrons from primary beauty hadrons - BeautyCharm = 3, // electrons from non-prompt charm hadrons - DirectGamma = 4, // electrons from direct photon - GammaPi0 = 5, - GammaEta = 6, - GammaOmega = 7, - GammaPhi = 8, - GammaEtaPrime = 9, - GammaRho0 = 10, - GammaK0s = 11, - GammaK0l = 12, - GammaKe3 = 13, - GammaLambda0 = 14, - GammaSigma = 15, - Pi0 = 16, - Eta = 17, - Omega = 18, - Phi = 19, - EtaPrime = 20, - Rho0 = 21, - K0s = 22, - K0l = 23, - Ke3 = 24, - Lambda0 = 25, - Sigma = 26, - Else = 27 + fNotElec = 0, // not electron + fDirectCharm = 1, // electrons from prompt charm hadrons + fDirectBeauty = 2, // electrons from primary beauty hadrons + fBeautyCharm = 3, // electrons from non-prompt charm hadrons + fDirectGamma = 4, // electrons from direct photon + fGammaPi0 = 5, + fGammaEta = 6, + fGammaOmega = 7, + fGammaPhi = 8, + fGammaEtaPrime = 9, + fGammaRho0 = 10, + fGammaK0s = 11, + fGammaK0l = 12, + fGammaKe3 = 13, + fGammaLambda0 = 14, + fGammaSigma = 15, + fPi0 = 16, + fEta = 17, + fOmega = 18, + fPhi = 19, + fEtaPrime = 20, + fRho0 = 21, + fK0s = 22, + fK0l = 23, + fKe3 = 24, + fLambda0 = 25, + fSigma = 26, + fElse = 27 }; struct HfTaskSingleElectron { @@ -118,38 +121,38 @@ struct HfTaskSingleElectron { void init(InitContext const&) { // create histograms - histos.add("nEvents", "Number of events", kTH1F, {{1, 0., 1.}}); - histos.add("VtxZ", "VtxZ; cm; entries", kTH1F, {axisPosZ}); - histos.add("etaTrack", "etaTrack; #eta; entries", kTH1F, {axisEta}); - histos.add("ptTrack", "#it{p}_{T} distribution of selected tracks; #it{p}_{T} (GeV/#it{c}); entries", kTH1F, {axisPt}); + histos.add("nEvents", "Number of events", kTH1D, {{1, 0., 1.}}); + histos.add("VtxZ", "VtxZ; cm; entries", kTH1D, {axisPosZ}); + histos.add("etaTrack", "etaTrack; #eta; entries", kTH1D, {axisEta}); + histos.add("ptTrack", "#it{p}_{T} distribution of selected tracks; #it{p}_{T} (GeV/#it{c}); entries", kTH1D, {axisPt}); // QA plots for trigger track selection - histos.add("tpcNClsTrack", "tpcNClsTrack", kTH1F, {{200, 0, 200}}); - histos.add("tpcFoundFindableTrack", "", kTH1F, {{10, 0, 1}}); - histos.add("tpcChi2Track", "", kTH1F, {{100, 0, 10}}); - histos.add("itsIBClsTrack", "", kTH1F, {{10, 0, 10}}); - histos.add("dcaXYTrack", "", kTH1F, {{600, -3, 3}}); - histos.add("dcaZTrack", "", kTH1F, {{600, -3, 3}}); + histos.add("tpcNClsTrack", "tpcNClsTrack", kTH1D, {{200, 0, 200}}); + histos.add("tpcFoundFindableTrack", "", kTH1D, {{10, 0, 1}}); + histos.add("tpcChi2Track", "", kTH1D, {{100, 0, 10}}); + histos.add("itsIBClsTrack", "", kTH1D, {{10, 0, 10}}); + histos.add("dcaXYTrack", "", kTH1D, {{600, -3, 3}}); + histos.add("dcaZTrack", "", kTH1D, {{600, -3, 3}}); // pid - histos.add("tofNSigPt", "", kTH2F, {{axisPtEl}, {axisNsig}}); - histos.add("tofNSigPtQA", "", kTH2F, {{axisPtEl}, {axisNsig}}); - histos.add("tpcNSigPt", "", kTH2F, {{axisPtEl}, {axisNsig}}); - histos.add("tpcNSigPtAfterTofCut", "", kTH2F, {{axisPtEl}, {axisNsig}}); - histos.add("tpcNSigPtQA", "", kTH2F, {{axisPtEl}, {axisNsig}}); + histos.add("tofNSigPt", "", kTH2D, {{axisPtEl}, {axisNsig}}); + histos.add("tofNSigPtQA", "", kTH2D, {{axisPtEl}, {axisNsig}}); + histos.add("tpcNSigPt", "", kTH2D, {{axisPtEl}, {axisNsig}}); + histos.add("tpcNSigPtAfterTofCut", "", kTH2D, {{axisPtEl}, {axisNsig}}); + histos.add("tpcNSigPtQA", "", kTH2D, {{axisPtEl}, {axisNsig}}); // track impact parameter - histos.add("dcaTrack", "", kTH2F, {{axisPtEl}, {axisTrackIp}}); - histos.add("dcaBeauty", "", kTH2F, {{axisPtEl}, {axisTrackIp}}); - histos.add("dcaCharm", "", kTH2F, {{axisPtEl}, {axisTrackIp}}); - histos.add("dcaDalitz", "", kTH2F, {{axisPtEl}, {axisTrackIp}}); - histos.add("dcaConv", "", kTH2F, {{axisPtEl}, {axisTrackIp}}); + histos.add("dcaTrack", "", kTH2D, {{axisPtEl}, {axisTrackIp}}); + histos.add("dcaBeauty", "", kTH2D, {{axisPtEl}, {axisTrackIp}}); + histos.add("dcaCharm", "", kTH2D, {{axisPtEl}, {axisTrackIp}}); + histos.add("dcaDalitz", "", kTH2D, {{axisPtEl}, {axisTrackIp}}); + histos.add("dcaConv", "", kTH2D, {{axisPtEl}, {axisTrackIp}}); // QA plots for MC - histos.add("hPdgC", "", kTH1F, {{10001, -0.5, 10000.5}}); - histos.add("hPdgB", "", kTH1F, {{10001, -0.5, 10000.5}}); - histos.add("hPdgDa", "", kTH1F, {{10001, -0.5, 10000.5}}); - histos.add("hPdgCo", "", kTH1F, {{10001, -0.5, 10000.5}}); + histos.add("hPdgC", "", kTH1D, {{10001, -0.5, 10000.5}}); + histos.add("hPdgB", "", kTH1D, {{10001, -0.5, 10000.5}}); + histos.add("hPdgDa", "", kTH1D, {{10001, -0.5, 10000.5}}); + histos.add("hPdgCo", "", kTH1D, {{10001, -0.5, 10000.5}}); } template @@ -191,7 +194,7 @@ struct HfTaskSingleElectron { { auto mcpart = track.mcParticle(); if (std::abs(mcpart.pdgCode()) != kElectron) { - return NotElec; + return fNotElec; } int motherPdg = -999; @@ -220,27 +223,27 @@ struct HfTaskSingleElectron { auto const& grmothersIdsVec = mctrack.front().mothersIds(); if (grmothersIdsVec.empty()) { - return DirectCharm; + return fDirectCharm; } else { grmotherPt = mctrack.front().pt(); grmotherPdg = std::abs(mctrack.front().pdgCode()); if ((static_cast(grmotherPdg / 100.) % 10) == kBottom || (static_cast(grmotherPdg / 1000.) % 10) == kBottom) { mpt = grmotherPt; mpdg = grmotherPdg; - return BeautyCharm; + return fBeautyCharm; } } } partMother = mctrack; } } else if ((static_cast(motherPdg / 100.) % 10) == kBottom || (static_cast(motherPdg / 1000.) % 10) == kBottom) { // check if electron from beauty hadrons - return DirectBeauty; + return fDirectBeauty; } else if (motherPdg == kGamma) { // check if electron from photon conversion mctrack = partMother.front().template mothers_as(); if (mctrack.size()) { auto const& grmothersIdsVec = mctrack.front().mothersIds(); if (grmothersIdsVec.empty()) { - return DirectGamma; + return fDirectGamma; } else { grmotherPdg = std::abs(mctrack.front().pdgCode()); mpdg = grmotherPdg; @@ -252,19 +255,19 @@ struct HfTaskSingleElectron { auto const& ggrmothersIdsVec = mctrack.front().mothersIds(); if (ggrmothersIdsVec.empty()) { if (grmotherPdg == kPi0) { - return GammaPi0; + return fGammaPi0; } else if (grmotherPdg == kEta) { - return GammaEta; + return fGammaEta; } else if (grmotherPdg == kOmega) { - return GammaOmega; + return fGammaOmega; } else if (grmotherPdg == kPhi) { - return GammaPhi; + return fGammaPhi; } else if (grmotherPdg == kEtaPrime) { - return GammaEtaPrime; + return fGammaEtaPrime; } else if (grmotherPdg == kRho770_0) { - return GammaRho0; + return fGammaRho0; } else { - return Else; + return fElse; } } else { ggrmotherPdg = mctrack.front().pdgCode(); @@ -273,42 +276,42 @@ struct HfTaskSingleElectron { mpt = ggrmotherPt; if (grmotherPdg == kPi0) { if (ggrmotherPdg == kK0Short) { - return GammaK0s; + return fGammaK0s; } else if (ggrmotherPdg == kK0Long) { - return GammaK0l; + return fGammaK0l; } else if (ggrmotherPdg == kKPlus) { - return GammaKe3; + return fGammaKe3; } else if (ggrmotherPdg == kLambda0) { - return GammaLambda0; + return fGammaLambda0; } else if (ggrmotherPdg == kSigmaPlus) { - return GammaSigma; + return fGammaSigma; } else { mpdg = grmotherPdg; mpt = grmotherPt; - return GammaPi0; + return fGammaPi0; } } else if (grmotherPdg == kEta) { mpdg = grmotherPdg; mpt = grmotherPt; - return GammaEta; + return fGammaEta; } else if (grmotherPdg == kOmega) { mpdg = grmotherPdg; mpt = grmotherPt; - return GammaOmega; + return fGammaOmega; } else if (grmotherPdg == kPhi) { mpdg = grmotherPdg; mpt = grmotherPt; - return GammaPhi; + return fGammaPhi; } else if (grmotherPdg == kEtaPrime) { mpdg = grmotherPdg; mpt = grmotherPt; - return GammaEtaPrime; + return fGammaEtaPrime; } else if (grmotherPdg == kRho770_0) { mpdg = grmotherPdg; mpt = grmotherPt; - return GammaRho0; + return fGammaRho0; } else { - return Else; + return fElse; } } } @@ -319,25 +322,22 @@ struct HfTaskSingleElectron { if (mctrack.size()) { auto const& grmothersIdsVec = mctrack.front().mothersIds(); if (grmothersIdsVec.empty()) { - if (motherPdg == kPi0) { - return Pi0; - } else if (motherPdg == kEta) { - return Eta; - } else if (motherPdg == kOmega) { - return Omega; - } else if (motherPdg == kPhi) { - return Phi; - } else if (motherPdg == kEtaPrime) { - return EtaPrime; - } else if (motherPdg == kRho770_0) { - return Rho0; - } else if (motherPdg == kKPlus) { - return Ke3; - } else if (motherPdg == kK0Long) { - return K0l; - } else { - return Else; + static const std::map pdgToSource = { + {kPi0, fPi0}, + {kEta, fEta}, + {kOmega, fOmega}, + {kPhi, fPhi}, + {kEtaPrime, fEtaPrime}, + {kRho770_0, fRho0}, + {kKPlus, fKe3}, + {kK0Long, fK0l}}; + + auto it = pdgToSource.find(motherPdg); + if (it != pdgToSource.end()) { + return it->second; } + return fElse; + } else { if (motherPdg == kPi0) { grmotherPt = mctrack.front().pt(); @@ -345,42 +345,42 @@ struct HfTaskSingleElectron { mpt = grmotherPt; mpdg = grmotherPdg; if (grmotherPdg == kK0Short) { - return K0s; + return fK0s; } else if (grmotherPdg == kK0Long) { - return K0l; + return fK0l; } else if (grmotherPdg == kKPlus) { - return Ke3; + return fKe3; } else if (grmotherPdg == kLambda0) { - return Lambda0; + return fLambda0; } else if (grmotherPdg == kSigmaPlus) { - return Sigma; + return fSigma; } else { mpt = motherPt; mpdg = motherPdg; - return Pi0; + return fPi0; } } else if (motherPdg == kEta) { - return Eta; + return fEta; } else if (motherPdg == kOmega) { - return Omega; + return fOmega; } else if (motherPdg == kPhi) { - return Phi; + return fPhi; } else if (motherPdg == kEtaPrime) { - return EtaPrime; + return fEtaPrime; } else if (motherPdg == kRho770_0) { - return Rho0; + return fRho0; } else if (motherPdg == kKPlus) { - return Ke3; + return fKe3; } else if (motherPdg == kK0Long) { - return K0l; + return fK0l; } else { - return Else; + return fElse; } } } } - return Else; + return fElse; } void processData(soa::Filtered::iterator const& collision, @@ -474,22 +474,22 @@ struct HfTaskSingleElectron { double mpt; // electron source pt int source = getElecSource(track, mpt, mpdg); - if (source == DirectBeauty || source == BeautyCharm) { + if (source == fDirectBeauty || source == fBeautyCharm) { histos.fill(HIST("hPdgB"), mpdg); histos.fill(HIST("dcaBeauty"), track.pt(), track.dcaXY()); } - if (source == DirectCharm) { + if (source == fDirectCharm) { histos.fill(HIST("hPdgC"), mpdg); histos.fill(HIST("dcaCharm"), track.pt(), track.dcaXY()); } - if (source >= GammaPi0 && source <= GammaSigma) { + if (source >= fGammaPi0 && source <= fGammaSigma) { histos.fill(HIST("hPdgCo"), mpdg); histos.fill(HIST("dcaConv"), track.pt(), track.dcaXY()); } - if (source >= Pi0 && source <= Sigma) { + if (source >= fPi0 && source <= fSigma) { histos.fill(HIST("hPdgDa"), mpdg); histos.fill(HIST("dcaDalitz"), track.pt(), track.dcaXY()); } From 9aa3d154d412526dfe2dc5239257bc6c262c8a6d Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Wed, 13 Aug 2025 15:01:37 +0200 Subject: [PATCH 039/986] [PWGCF] FemtoUniverse: Making the headers self-sufficient, filling MC Truth tracks (#12544) Co-authored-by: ALICE Action Bot --- .../Core/FemtoUniverse3DContainer.h | 13 ++- .../Core/FemtoUniverseAngularContainer.h | 15 ++- .../Core/FemtoUniverseCascadeSelection.h | 7 +- .../Core/FemtoUniverseCollisionSelection.h | 4 +- .../Core/FemtoUniverseContainer.h | 3 +- .../Core/FemtoUniverseCutculator.h | 17 +-- .../Core/FemtoUniverseEfficiencyCalculator.h | 16 +-- .../Core/FemtoUniverseEventHisto.h | 1 + .../Core/FemtoUniverseFemtoContainer.h | 11 +- PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h | 8 +- .../Core/FemtoUniverseObjectSelection.h | 14 ++- .../FemtoUniversePairAngularWithCentMultKt.h | 3 +- .../Core/FemtoUniversePairCleaner.h | 1 + .../Core/FemtoUniversePairSHCentMultKt.h | 9 +- .../Core/FemtoUniversePairWithCentMultKt.h | 3 +- .../Core/FemtoUniversePhiSelection.h | 8 +- .../Core/FemtoUniverseSHContainer.h | 18 +-- .../Core/FemtoUniverseSoftPionRemoval.h | 5 +- .../Core/FemtoUniverseSpherHarMath.h | 9 +- .../Core/FemtoUniverseTrackSelection.h | 16 +-- .../Core/FemtoUniverseV0Selection.h | 7 +- PWGCF/FemtoUniverse/Core/femtoUtils.h | 10 +- ...irTaskTrackTrackSpherHarMultKtExtended.cxx | 106 +++++++++++------- 23 files changed, 183 insertions(+), 121 deletions(-) diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverse3DContainer.h b/PWGCF/FemtoUniverse/Core/FemtoUniverse3DContainer.h index 864487cdcb0..77c8798a3b7 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverse3DContainer.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverse3DContainer.h @@ -17,15 +17,18 @@ #ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSE3DCONTAINER_H_ #define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSE3DCONTAINER_H_ -#include -#include -#include +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h" #include "Framework/HistogramRegistry.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h" +#include + #include "Math/Vector4D.h" -#include "TMath.h" #include "TDatabasePDG.h" +#include "TMath.h" + +#include +#include using namespace o2::framework; diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseAngularContainer.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseAngularContainer.h index 4d267fb67d3..4a1fb507b4a 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseAngularContainer.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseAngularContainer.h @@ -20,17 +20,20 @@ #ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEANGULARCONTAINER_H_ #define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEANGULARCONTAINER_H_ -#include -#include -#include +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h" -#include "Framework/HistogramRegistry.h" #include "Common/Core/RecoDecay.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h" + +#include "Framework/HistogramRegistry.h" +#include #include "Math/Vector4D.h" -#include "TMath.h" #include "TDatabasePDG.h" +#include "TMath.h" + +#include +#include using namespace o2::framework; diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseCascadeSelection.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseCascadeSelection.h index ff8206ea551..7a9e078c7ce 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseCascadeSelection.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseCascadeSelection.h @@ -21,15 +21,18 @@ #ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSECASCADESELECTION_H_ #define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSECASCADESELECTION_H_ -#include -#include #include "PWGCF/FemtoUniverse/Core/FemtoUniverseObjectSelection.h" #include "PWGCF/FemtoUniverse/Core/FemtoUniverseSelection.h" #include "PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h" + #include "Common/Core/RecoDecay.h" + #include "Framework/HistogramRegistry.h" #include "ReconstructionDataFormats/PID.h" +#include +#include + namespace o2::analysis::femto_universe { namespace femto_universe_cascade_selection diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseCollisionSelection.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseCollisionSelection.h index 633bba05760..ab47405cb9c 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseCollisionSelection.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseCollisionSelection.h @@ -18,11 +18,13 @@ #ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSECOLLISIONSELECTION_H_ #define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSECOLLISIONSELECTION_H_ -#include #include "Common/CCDB/TriggerAliases.h" + #include "Framework/HistogramRegistry.h" #include "Framework/Logger.h" +#include + using namespace o2::framework; namespace o2::analysis::femto_universe diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseContainer.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseContainer.h index 8b5df274887..6f45d43f977 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseContainer.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseContainer.h @@ -26,13 +26,12 @@ #include "Common/Core/RecoDecay.h" #include "Framework/HistogramRegistry.h" +#include #include "Math/Vector4D.h" #include "TDatabasePDG.h" #include "TMath.h" -#include - #include #include diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseCutculator.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseCutculator.h index 40b7c425e5c..58e278cdde7 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseCutculator.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseCutculator.h @@ -18,19 +18,20 @@ #ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSECUTCULATOR_H_ #define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSECUTCULATOR_H_ +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseSelection.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseV0Selection.h" + +#include +#include + +#include #include #include +#include #include #include #include -#include -#include -#include -#include - -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseSelection.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseV0Selection.h" namespace o2::analysis::femto_universe { diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseEfficiencyCalculator.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseEfficiencyCalculator.h index a96b70180aa..da40cfbf4d3 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseEfficiencyCalculator.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseEfficiencyCalculator.h @@ -16,15 +16,17 @@ #ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEEFFICIENCYCALCULATOR_H_ #define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEEFFICIENCYCALCULATOR_H_ -#include -#include -#include -#include +#include "FemtoUniverseParticleHisto.h" -#include "Framework/Configurable.h" -#include "CCDB/BasicCCDBManager.h" #include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" -#include "FemtoUniverseParticleHisto.h" + +#include "CCDB/BasicCCDBManager.h" +#include "Framework/Configurable.h" + +#include +#include +#include +#include namespace o2::analysis::femto_universe::efficiency { diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h index 03d4b5b1fb4..dfe2bd35d62 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h @@ -18,6 +18,7 @@ #define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEEVENTHISTO_H_ #include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" + #include "Framework/HistogramRegistry.h" using namespace o2::framework; diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseFemtoContainer.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseFemtoContainer.h index 4719561ccf6..eb9f25dff14 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseFemtoContainer.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseFemtoContainer.h @@ -20,16 +20,17 @@ #ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEFEMTOCONTAINER_H_ #define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEFEMTOCONTAINER_H_ -#include -#include -#include +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h" #include "Framework/HistogramRegistry.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h" +#include #include "Math/Vector4D.h" -#include "TMath.h" #include "TDatabasePDG.h" +#include "TMath.h" + +#include +#include using namespace o2::framework; diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h index ec40ea035e6..aee87f1a057 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h @@ -19,14 +19,14 @@ #ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEMATH_H_ #define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEMATH_H_ -#include -#include - -#include "Math/Vector4D.h" #include "Math/Boost.h" +#include "Math/Vector4D.h" #include "TLorentzVector.h" #include "TMath.h" +#include +#include + namespace o2::analysis::femto_universe { diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseObjectSelection.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseObjectSelection.h index 07491f92c8f..8487ef11bc0 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseObjectSelection.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseObjectSelection.h @@ -17,15 +17,16 @@ #ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEOBJECTSELECTION_H_ #define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEOBJECTSELECTION_H_ +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseSelection.h" +#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" + +#include "Framework/HistogramRegistry.h" +#include "ReconstructionDataFormats/PID.h" + #include #include #include -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseSelection.h" -#include "ReconstructionDataFormats/PID.h" -#include "Framework/HistogramRegistry.h" -#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" - using namespace o2; using namespace o2::framework; @@ -181,7 +182,8 @@ class FemtoUniverseObjectSelection std::vector selVarVec; for (auto it : mSelections) { auto selVar = it.getSelectionVariable(); - if (std::none_of(selVarVec.begin(), selVarVec.end(), [selVar](selVariable a) { return a == selVar; })) { + if (std::none_of(selVarVec.begin(), selVarVec.end(), + [selVar](selVariable a) { return a == selVar; })) { selVarVec.push_back(selVar); } } diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniversePairAngularWithCentMultKt.h b/PWGCF/FemtoUniverse/Core/FemtoUniversePairAngularWithCentMultKt.h index 31b256f43f7..b63455ee3cf 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniversePairAngularWithCentMultKt.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniversePairAngularWithCentMultKt.h @@ -17,9 +17,10 @@ #ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEPAIRANGULARWITHCENTMULTKT_H_ #define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEPAIRANGULARWITHCENTMULTKT_H_ +#include "Framework/HistogramRegistry.h" + #include #include -#include "Framework/HistogramRegistry.h" namespace o2::analysis::femto_universe { diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniversePairCleaner.h b/PWGCF/FemtoUniverse/Core/FemtoUniversePairCleaner.h index b27d8e25abf..32da4810b85 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniversePairCleaner.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniversePairCleaner.h @@ -20,6 +20,7 @@ #define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEPAIRCLEANER_H_ #include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" + #include "Framework/HistogramRegistry.h" namespace o2::analysis::femto_universe diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniversePairSHCentMultKt.h b/PWGCF/FemtoUniverse/Core/FemtoUniversePairSHCentMultKt.h index ea8626cbe32..377e7677c0b 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniversePairSHCentMultKt.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniversePairSHCentMultKt.h @@ -16,11 +16,14 @@ #ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEPAIRSHCENTMULTKT_H_ #define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEPAIRSHCENTMULTKT_H_ -#include -#include +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseSHContainer.h" + +#include "Framework/HistogramRegistry.h" + #include #include -#include "Framework/HistogramRegistry.h" +#include +#include // using namespace o2::constants::physics; diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniversePairWithCentMultKt.h b/PWGCF/FemtoUniverse/Core/FemtoUniversePairWithCentMultKt.h index 5cfef9c433f..1f2651ad2f6 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniversePairWithCentMultKt.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniversePairWithCentMultKt.h @@ -17,9 +17,10 @@ #ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEPAIRWITHCENTMULTKT_H_ #define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEPAIRWITHCENTMULTKT_H_ +#include "Framework/HistogramRegistry.h" + #include #include -#include "Framework/HistogramRegistry.h" namespace o2::analysis::femto_universe { diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniversePhiSelection.h b/PWGCF/FemtoUniverse/Core/FemtoUniversePhiSelection.h index 0ee0bfe4162..c43217ceb72 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniversePhiSelection.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniversePhiSelection.h @@ -19,18 +19,20 @@ #ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEPHISELECTION_H_ #define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEPHISELECTION_H_ -#include -#include - #include "PWGCF/FemtoUniverse/Core/FemtoUniverseObjectSelection.h" #include "PWGCF/FemtoUniverse/Core/FemtoUniverseSelection.h" #include "PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h" #include "Common/Core/RecoDecay.h" + #include "Framework/HistogramRegistry.h" #include "ReconstructionDataFormats/PID.h" + #include "TLorentzVector.h" +#include +#include + namespace o2::analysis::femto_universe { namespace femto_universe_phi_selection diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseSHContainer.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseSHContainer.h index 558874133cb..b99cccb338a 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseSHContainer.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseSHContainer.h @@ -17,18 +17,20 @@ #ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSESHCONTAINER_H_ #define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSESHCONTAINER_H_ -#include -#include -#include -#include -#include - -#include "Framework/HistogramRegistry.h" #include "PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h" #include "PWGCF/FemtoUniverse/Core/FemtoUniverseSpherHarMath.h" + +#include "Framework/HistogramRegistry.h" +#include + #include "Math/Vector4D.h" -#include "TMath.h" #include "TDatabasePDG.h" +#include "TMath.h" + +#include +#include +#include +#include namespace o2::analysis::femto_universe { diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseSoftPionRemoval.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseSoftPionRemoval.h index 9631b5b3377..4a97c83865d 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseSoftPionRemoval.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseSoftPionRemoval.h @@ -16,11 +16,12 @@ #ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSESOFTPIONREMOVAL_H_ #define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSESOFTPIONREMOVAL_H_ -#include - #include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" + #include "Framework/HistogramRegistry.h" +#include + namespace o2::analysis::femto_universe { diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseSpherHarMath.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseSpherHarMath.h index d92560ceb72..082ddd25663 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseSpherHarMath.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseSpherHarMath.h @@ -16,14 +16,15 @@ #ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSESPHERHARMATH_H_ #define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSESPHERHARMATH_H_ -#include -#include - -#include "Math/Vector4D.h" #include "Math/Boost.h" +#include "Math/Vector4D.h" #include "TLorentzVector.h" #include "TMath.h" +#include +#include +#include + namespace o2::analysis::femto_universe { diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h index 75276f24a6d..51c711c8165 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h @@ -18,17 +18,19 @@ #ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSETRACKSELECTION_H_ #define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSETRACKSELECTION_H_ -#include -#include -#include - +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseObjectSelection.h" #include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" -#include "Common/DataModel/TrackSelectionTables.h" + #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectionDefaults.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseObjectSelection.h" -#include "ReconstructionDataFormats/PID.h" +#include "Common/DataModel/TrackSelectionTables.h" + #include "Framework/HistogramRegistry.h" +#include "ReconstructionDataFormats/PID.h" + +#include +#include +#include // using namespace o2::framework; diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseV0Selection.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseV0Selection.h index 805da180cc3..8b45f664f15 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseV0Selection.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseV0Selection.h @@ -19,17 +19,18 @@ #ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEV0SELECTION_H_ #define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEV0SELECTION_H_ -#include -#include - #include "PWGCF/FemtoUniverse/Core/FemtoUniverseObjectSelection.h" #include "PWGCF/FemtoUniverse/Core/FemtoUniverseSelection.h" #include "PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h" #include "Common/Core/RecoDecay.h" + #include "Framework/HistogramRegistry.h" #include "ReconstructionDataFormats/PID.h" +#include +#include + namespace o2::analysis::femto_universe { namespace femto_universe_v0_selection diff --git a/PWGCF/FemtoUniverse/Core/femtoUtils.h b/PWGCF/FemtoUniverse/Core/femtoUtils.h index 70a02e98b8c..ddc1833c335 100644 --- a/PWGCF/FemtoUniverse/Core/femtoUtils.h +++ b/PWGCF/FemtoUniverse/Core/femtoUtils.h @@ -17,12 +17,14 @@ #ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUTILS_H_ #define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUTILS_H_ -#include -#include -#include -#include "Framework/ASoAHelpers.h" #include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" +#include "Framework/ASoAHelpers.h" + +#include +#include +#include + namespace o2::analysis::femto_universe { diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx index 2a813550b22..f71c6f5dada 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx @@ -14,29 +14,32 @@ /// \remark This file is inherited from ~/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx on 17/06/2024 /// \author Pritam Chakraborty, WUT Warsaw, pritam.chakraborty@pw.edu.pl -#include -#include -#include "TRandom2.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniversePairCleaner.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniversePairSHCentMultKt.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseSHContainer.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h" +#include "PWGCF/FemtoUniverse/Core/femtoUtils.h" +#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" + +#include "Common/DataModel/PIDResponse.h" + +#include "Framework/ASoAHelpers.h" #include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" #include "Framework/HistogramRegistry.h" -#include "Framework/ASoAHelpers.h" +#include "Framework/O2DatabasePDGPlugin.h" #include "Framework/RunningWorkflowInfo.h" #include "Framework/StepTHn.h" -#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/PID.h" -#include "Common/DataModel/PIDResponse.h" -#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniversePairCleaner.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseSHContainer.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h" -#include "PWGCF/FemtoUniverse/Core/femtoUtils.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniversePairSHCentMultKt.h" +#include "TRandom2.h" + +#include +#include using namespace o2; using namespace o2::analysis::femto_universe; @@ -73,6 +76,15 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { Configurable ConfIsMC{"ConfIsMC", false, "Enable additional Histogramms in the case of a MonteCarlo Run"}; Configurable> ConfTrkPIDnSigmaMax{"ConfTrkPIDnSigmaMax", std::vector{4.f, 3.f, 2.f}, "This configurable needs to be the same as the one used in the producer task"}; Configurable ConfUse3D{"ConfUse3D", false, "Enable three dimensional histogramms (to be used only for analysis with high statistics): k* vs mT vs multiplicity"}; + Configurable ConfPhiBins{"ConfPhiBins", 29, "Number of phi bins in deta dphi"}; + Configurable ConfEtaBins{"ConfEtaBins", 29, "Number of eta bins in deta dphi"}; + Configurable ConfIsCPR{"ConfIsCPR", true, "Close Pair Rejection"}; + Configurable ConfCPRPlotPerRadii{"ConfCPRPlotPerRadii", false, "Plot CPR per radii"}; + Configurable ConfCPRdeltaPhiCutMax{"ConfCPRdeltaPhiCutMax", 0.0, "Delta Phi max cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaPhiCutMin{"ConfCPRdeltaPhiCutMin", 0.0, "Delta Phi min cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaEtaCutMax{"ConfCPRdeltaEtaCutMax", 0.0, "Delta Eta max cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaEtaCutMin{"ConfCPRdeltaEtaCutMin", 0.0, "Delta Eta min cut for Close Pair Rejection"}; + Configurable ConfCPRChosenRadii{"ConfCPRChosenRadii", 0.80, "Delta Eta cut for Close Pair Rejection"}; } twotracksconfigs; using FemtoFullParticles = soa::Join; @@ -80,6 +92,8 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { Filter trackAdditionalfilter = (nabs(aod::femtouniverseparticle::eta) < twotracksconfigs.ConfEtaMax); // example filtering on configurable using FilteredFemtoFullParticles = soa::Filtered; // using FilteredFemtoFullParticles = FemtoFullParticles; //if no filtering is applied uncomment this option + using FemtoRecoParticles = soa::Join; + using FilteredFemtoRecoParticles = soa::Filtered; SliceCache cache; Preslice perCol = aod::femtouniverseparticle::fdCollisionId; @@ -96,8 +110,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { /// Partition for particle 1 Partition partsOne = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && aod::femtouniverseparticle::sign == trackonefilter.ConfChargePart1 && aod::femtouniverseparticle::pt < trackonefilter.ConfPtHighPart1 && aod::femtouniverseparticle::pt > trackonefilter.ConfPtLowPart1; - - Partition> partsOneMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && aod::femtouniverseparticle::sign == trackonefilter.ConfChargePart1 && aod::femtouniverseparticle::pt < trackonefilter.ConfPtHighPart1 && aod::femtouniverseparticle::pt > trackonefilter.ConfPtLowPart1; + Partition partsOneMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && aod::femtouniverseparticle::sign == trackonefilter.ConfChargePart1 && aod::femtouniverseparticle::pt < trackonefilter.ConfPtHighPart1 && aod::femtouniverseparticle::pt > trackonefilter.ConfPtLowPart1; // /// Histogramming for particle 1 @@ -116,8 +129,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { /// Partition for particle 2 Partition partsTwo = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == tracktwofilter.ConfChargePart2) && aod::femtouniverseparticle::pt < tracktwofilter.ConfPtHighPart2 && aod::femtouniverseparticle::pt > tracktwofilter.ConfPtLowPart2; - - Partition> partsTwoMC = aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack) && (aod::femtouniverseparticle::sign == tracktwofilter.ConfChargePart2) && aod::femtouniverseparticle::pt < tracktwofilter.ConfPtHighPart2 && aod::femtouniverseparticle::pt > tracktwofilter.ConfPtLowPart2; + Partition partsTwoMC = aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack) && (aod::femtouniverseparticle::sign == tracktwofilter.ConfChargePart2) && aod::femtouniverseparticle::pt < tracktwofilter.ConfPtHighPart2 && aod::femtouniverseparticle::pt > tracktwofilter.ConfPtLowPart2; /// Histogramming for particle 2 FemtoUniverseParticleHisto trackHistoPartTwo; @@ -169,13 +181,6 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { Configurable ConfIsLCMS{"ConfIsLCMS", true, "Choosing LCMS or PRF"}; Configurable ConfNEventsMix{"ConfNEventsMix", 5, "Number of events for mixing"}; Configurable ConfLMax{"ConfLMax", 2, "Maximum value of l"}; - Configurable ConfIsCPR{"ConfIsCPR", true, "Close Pair Rejection"}; - Configurable ConfCPRPlotPerRadii{"ConfCPRPlotPerRadii", false, "Plot CPR per radii"}; - Configurable ConfCPRdeltaPhiCutMax{"ConfCPRdeltaPhiCutMax", 0.0, "Delta Phi max cut for Close Pair Rejection"}; - Configurable ConfCPRdeltaPhiCutMin{"ConfCPRdeltaPhiCutMin", 0.0, "Delta Phi min cut for Close Pair Rejection"}; - Configurable ConfCPRdeltaEtaCutMax{"ConfCPRdeltaEtaCutMax", 0.0, "Delta Eta max cut for Close Pair Rejection"}; - Configurable ConfCPRdeltaEtaCutMin{"ConfCPRdeltaEtaCutMin", 0.0, "Delta Eta min cut for Close Pair Rejection"}; - Configurable ConfCPRChosenRadii{"ConfCPRChosenRadii", 0.80, "Delta Eta cut for Close Pair Rejection"}; Configurable cfgProcessPM{"cfgProcessPM", false, "Process particles of the opposite charge"}; Configurable cfgProcessPP{"cfgProcessPP", true, "Process particles of the same, positice charge"}; Configurable cfgProcessMM{"cfgProcessMM", true, "Process particles of the same, positice charge"}; @@ -197,6 +202,8 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { FemtoUniverseSHContainer sameEventContMM; FemtoUniverseSHContainer mixedEventContMM; + FemtoUniverseContainer sameEventCont1D; + FemtoUniversePairCleaner pairCleaner; FemtoUniverseDetaDphiStar pairCloseRejection; FemtoUniverseTrackSelection trackCuts; @@ -216,6 +223,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { /// Histogram output HistogramRegistry qaRegistry{"TrackQA", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry resultRegistry{"Correlations", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry resultRegistry1D{"Correlations1D", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry resultRegistryPM{"CorrelationsPM", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry resultRegistryPP{"CorrelationsPP", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry resultRegistryMM{"CorrelationsMM", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; @@ -404,6 +412,8 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { sameEventMultContPP.init(&SameMultRegistryPP, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, ConfLMax); mixedEventMultContPP.init(&MixedMultRegistryPP, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, ConfLMax); } + sameEventCont1D.init(&resultRegistry1D, ConfkstarBins, ConfMultBinsCent, ConfkTBins, ConfmTBins, ConfmultBins3D, ConfmTBins3D, twotracksconfigs.ConfEtaBins, twotracksconfigs.ConfPhiBins, twotracksconfigs.ConfIsMC, twotracksconfigs.ConfUse3D); + sameEventCont1D.setPDGCodes(trackonefilter.ConfPDGCodePartOne, tracktwofilter.ConfPDGCodePartTwo); } if (cfgProcessMM) { @@ -416,11 +426,13 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { sameEventMultContMM.init(&SameMultRegistryMM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, ConfLMax); mixedEventMultContMM.init(&MixedMultRegistryMM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, ConfLMax); } + sameEventCont1D.init(&resultRegistry1D, ConfkstarBins, ConfMultBinsCent, ConfkTBins, ConfmTBins, ConfmultBins3D, ConfmTBins3D, twotracksconfigs.ConfEtaBins, twotracksconfigs.ConfPhiBins, twotracksconfigs.ConfIsMC, twotracksconfigs.ConfUse3D); + sameEventCont1D.setPDGCodes(trackonefilter.ConfPDGCodePartOne, tracktwofilter.ConfPDGCodePartTwo); } pairCleaner.init(&qaRegistry); - if (ConfIsCPR.value) { - pairCloseRejection.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiCutMin.value, ConfCPRdeltaPhiCutMax.value, ConfCPRdeltaEtaCutMin.value, ConfCPRdeltaEtaCutMax.value, ConfCPRChosenRadii.value, ConfCPRPlotPerRadii.value); + if (twotracksconfigs.ConfIsCPR.value) { + pairCloseRejection.init(&resultRegistry, &qaRegistry, twotracksconfigs.ConfCPRdeltaPhiCutMin.value, twotracksconfigs.ConfCPRdeltaPhiCutMax.value, twotracksconfigs.ConfCPRdeltaEtaCutMin.value, twotracksconfigs.ConfCPRdeltaEtaCutMax.value, twotracksconfigs.ConfCPRChosenRadii.value, twotracksconfigs.ConfCPRPlotPerRadii.value); } vPIDPartOne = trackonefilter.ConfPIDPartOne.value; @@ -485,7 +497,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { continue; } - if (ConfIsCPR.value) { + if (twotracksconfigs.ConfIsCPR.value) { if (confCPRIsAtITS.value) { if (pairCloseRejection.isClosePairAtITS(p1, p2, magFieldTesla, femto_universe_container::EventType::same)) { continue; @@ -515,7 +527,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { continue; } - if (ConfIsCPR.value) { + if (twotracksconfigs.ConfIsCPR.value) { if (confCPRIsAtITS.value) { if (pairCloseRejection.isClosePairAtITS(p1, p2, magFieldTesla, femto_universe_container::EventType::same)) { continue; @@ -544,9 +556,17 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { if (rand > 0.5) { sameEventMultContPP.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); f3d = FemtoUniverseMath::newpairfunc(p1, mass1, p2, mass2, ConfIsIden); + if (twotracksconfigs.ConfIsMC) { + float weight = 1.0f; + sameEventCont1D.setPair(p1, p2, multCol, twotracksconfigs.ConfUse3D, weight, ConfIsIden); + } } else if (rand <= 0.5) { sameEventMultContPP.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); f3d = FemtoUniverseMath::newpairfunc(p2, mass2, p1, mass1, ConfIsIden); + if (twotracksconfigs.ConfIsMC) { + float weight = 1.0f; + sameEventCont1D.setPair(p2, p1, multCol, twotracksconfigs.ConfUse3D, weight, ConfIsIden); + } } if (ConfIsFillAngqLCMS) { kv = std::sqrt(f3d[1] * f3d[1] + f3d[2] * f3d[2] + f3d[3] * f3d[3]); @@ -559,9 +579,17 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { if (rand > 0.5) { sameEventMultContMM.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); f3d = FemtoUniverseMath::newpairfunc(p1, mass1, p2, mass2, ConfIsIden); + if (twotracksconfigs.ConfIsMC) { + float weight = 1.0f; + sameEventCont1D.setPair(p1, p2, multCol, twotracksconfigs.ConfUse3D, weight, ConfIsIden); + } } else if (rand <= 0.5) { sameEventMultContMM.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); f3d = FemtoUniverseMath::newpairfunc(p2, mass2, p1, mass1, ConfIsIden); + if (twotracksconfigs.ConfIsMC) { + float weight = 1.0f; + sameEventCont1D.setPair(p2, p1, multCol, twotracksconfigs.ConfUse3D, weight, ConfIsIden); + } } if (ConfIsFillAngqLCMS) { kv = std::sqrt(f3d[1] * f3d[1] + f3d[2] * f3d[2] + f3d[3] * f3d[3]); @@ -620,8 +648,8 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { /// \param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth /// \param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table void processSameEventMC(o2::aod::FdCollision const& col, - soa::Join const& parts, - o2::aod::FdMCParticles const&) + FilteredFemtoRecoParticles const& parts, + aod::FdMCParticles const&) { fillCollision(col, ConfIsCent); @@ -635,20 +663,20 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { doSameEvent(thegroupPartsOne, thegroupPartsTwo, parts, col.magField(), col.multV0M(), 1, fillQA); } if (cfgProcessPP) { - doSameEvent(thegroupPartsOne, thegroupPartsOne, parts, col.magField(), col.multV0M(), 2, fillQA); + doSameEvent(thegroupPartsOne, thegroupPartsOne, parts, col.magField(), col.multV0M(), 2, fillQA); } if (cfgProcessMM) { - doSameEvent(thegroupPartsTwo, thegroupPartsTwo, parts, col.magField(), col.multV0M(), 3, fillQA); + doSameEvent(thegroupPartsTwo, thegroupPartsTwo, parts, col.magField(), col.multV0M(), 3, fillQA); } } else { if (cfgProcessPM) { doSameEvent(thegroupPartsOne, thegroupPartsTwo, parts, col.magField(), col.multNtr(), 1, fillQA); } if (cfgProcessPP) { - doSameEvent(thegroupPartsOne, thegroupPartsOne, parts, col.magField(), col.multNtr(), 2, fillQA); + doSameEvent(thegroupPartsOne, thegroupPartsOne, parts, col.magField(), col.multNtr(), 2, fillQA); } if (cfgProcessMM) { - doSameEvent(thegroupPartsTwo, thegroupPartsTwo, parts, col.magField(), col.multNtr(), 3, fillQA); + doSameEvent(thegroupPartsTwo, thegroupPartsTwo, parts, col.magField(), col.multNtr(), 3, fillQA); } } delete randgen; @@ -679,7 +707,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { continue; } - if (ConfIsCPR.value) { + if (twotracksconfigs.ConfIsCPR.value) { if (confCPRIsAtITS.value) { if (pairCloseRejection.isClosePairAtITS(p1, p2, magFieldTesla, femto_universe_container::EventType::mixed)) { continue; From af494322eb725cba4d487ba9c348716b63024867 Mon Sep 17 00:00:00 2001 From: Jaideep Tanwar <141036812+jtanwar2212@users.noreply.github.com> Date: Wed, 13 Aug 2025 18:39:39 +0530 Subject: [PATCH 040/986] [PWGLF] Update nucleitpcpbpb.cxx for memory consuption (#12547) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx | 188 ++++++++++++--------------- 1 file changed, 83 insertions(+), 105 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx b/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx index d69d0b97b93..aa7fa01413c 100644 --- a/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx +++ b/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx @@ -76,6 +76,17 @@ constexpr double kTrackPIDSettings[nParticles][nTrkSettings]{ {1, 0, 4, 70, 4.0, 0.5, 100, 0.50, 5.0, 3.0, -1, 0, 100, 2., 2., 0., 1000, 70, 1}, {1, 0, 4, 75, 4.0, 0.5, 100, 0.50, 5.0, 5.0, -1, 0, 100, 2., 2., 0., 1000, 70, 1}, {1, 0, 4, 70, 4.0, 0.5, 100, 0.50, 5.0, 5.0, -1, 0, 100, 2., 2., 0., 1000, 70, 1}}; + +const int nTrkSettings2 = 3; +static const std::vector trackPIDsettingsNames2{"useITSnsigma", "minITSnsigma", "maxITSnsigma"}; +constexpr double kTrackPIDSettings2[nParticles][nTrkSettings2]{ + {1, -5, 4}, + {1, -5, 4}, + {1, -5, 4}, + {1, -5, 4}, + {1, -5, 4}, + {1, -5, 4}}; + struct PrimParticles { TString name; int pdgCode, charge; @@ -92,8 +103,6 @@ struct PrimParticles { } }; // struct PrimParticles //---------------------------------------------------------------------------------------------------------------- -std::vector> hDeDx; -std::vector> hNsigmaPt; std::vector> hmass; } // namespace //---------------------------------------------------------------------------------------------------------------- @@ -143,8 +152,9 @@ struct NucleitpcPbPb { Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {kBetheBlochDefault[0], nParticles, nBetheParams, particleNames, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for light nuclei"}; Configurable> cfgTrackPIDsettings{"cfgTrackPIDsettings", {kTrackPIDSettings[0], nParticles, nTrkSettings, particleNames, trackPIDsettingsNames}, "track selection and PID criteria"}; - Configurable cfgFillDeDxWithCut{"cfgFillDeDxWithCut", true, "Fill with cut beth bloch"}; - Configurable cfgFillnsigma{"cfgFillnsigma", false, "Fill n-sigma histograms"}; + Configurable> cfgTrackPIDsettings2{"cfgTrackPIDsettings2", {kTrackPIDSettings2[0], nParticles, nTrkSettings2, particleNames, trackPIDsettingsNames2}, "track selection and PID criteria"}; + Configurable cfgFillhspectra{"cfgFillhspectra", true, "fill data sparsh"}; + Configurable cfgFillQAplots{"cfgFillQAplots", false, "Fill QA sparsh"}; Configurable cfgFillmass{"cfgFillmass", false, "Fill mass histograms"}; Configurable centcut{"centcut", 80.0f, "centrality cut"}; Configurable cfgCutRapidity{"cfgCutRapidity", 0.5f, "Rapidity range"}; @@ -169,6 +179,13 @@ struct NucleitpcPbPb { ConfigurableAxis axisrapidity{"axisrapidity", {100, -2, 2}, "rapidity"}; ConfigurableAxis axismass{"axismass", {100, -10, 10}, "mass^{2}"}; ConfigurableAxis nsigmaAxis{"nsigmaAxis", {160, -20, 20}, "n#sigma_{#pi^{+}}"}; + ConfigurableAxis speciesBitAxis{"speciesBitAxis", {8, -0.5, 7.5}, "particle type 0: pion, 1: proton, 2: deuteron, 3: triton, 4:He3, 5:He4"}; + ConfigurableAxis axisDCA{"axisDCA", {400, -10., 10.}, "DCA axis"}; + ConfigurableAxis axisTPCcls{"axisTPCcls", {400, 0., 200.}, "TPCcls axis"}; + ConfigurableAxis axisITScls{"axisITScls", {400, 0., 200.}, "ITScls axis"}; + ConfigurableAxis axisITSchi2{"axisITSchi2", {400, 0., 100.}, "ITSchi2 axis"}; + ConfigurableAxis axisTPCchi2{"axisTPCchi2", {400, 0., 100.}, "TPCchi2 axis"}; + // CCDB Service ccdb; Configurable bField{"bField", -999, "bz field, -999 is automatic"}; @@ -211,31 +228,22 @@ struct NucleitpcPbPb { } histos.add("histeta", "histeta", kTH1F, {axiseta}); histos.add("Tofsignal", "Tofsignal", kTH2F, {axisRigidity, {4000, 0.2, 1.2, "#beta"}}); - histos.add("histDcaZVsPtData_particle", "dcaZ vs Pt (particle)", HistType::kTH2F, {{1000, 0, 20}, {1000, -2.5, 2.5, "dca"}}); - histos.add("histDcaXYVsPtData_particle", "dcaXY vs Pt (particle)", HistType::kTH2F, {{1000, 0, 20}, {1000, -2.0, 2.0, "dca"}}); - histos.add("histDcaZVsPtData_antiparticle", "dcaZ vs Pt (antiparticle)", HistType::kTH2F, {{1000, 0, 20}, {1000, -2.5, 2.5, "dca"}}); - histos.add("histDcaXYVsPtData_antiparticle", "dcaXY vs Pt (antiparticle)", HistType::kTH2F, {{1000, 0, 20}, {1000, -2.0, 2.0, "dca"}}); - hDeDx.resize(2 * nParticles + 2); - hNsigmaPt.resize(2 * nParticles + 2); + histos.add("Tpcsignal", "Tpcsignal", kTH2F, {axisRigidity, axisdEdx}); + hmass.resize(2 * nParticles + 2); - for (int i = 0; i < nParticles + 1; i++) { - TString histName = i < nParticles ? primaryParticles[i].name : "all"; - if (cfgFillDeDxWithCut) { - hDeDx[2 * i] = histos.add(Form("dedx/histdEdx_%s_Cuts", histName.Data()), ";p_{TPC}/z (GeV/#it{c}); d#it{E}/d#it{x}", HistType::kTH2F, {axisRigidity, axisdEdx}); - } - } + for (int i = 0; i < nParticles; i++) { TString histName = primaryParticles[i].name; - if (cfgFillnsigma) { - hNsigmaPt[2 * i] = histos.add(Form("histnsigmaTPC_%s", histName.Data()), ";p_T{TPC} (GeV/#it{c}); TPCnsigma", HistType::kTH2F, {ptAxis, nsigmaAxis}); - hNsigmaPt[2 * i + 1] = histos.add(Form("histnsigmaTPC_anti_%s", histName.Data()), ";p_T{TPC} (GeV/#it{c}); TPCnsigma", HistType::kTH2F, {ptAxis, nsigmaAxis}); - } if (cfgFillmass) { hmass[2 * i] = histos.add(Form("histmass_pt/histmass_%s", histName.Data()), ";p_T{TPC} (GeV/#it{c}); mass^{2}", HistType::kTH2F, {ptAxis, axismass}); hmass[2 * i + 1] = histos.add(Form("histmass_ptanti/histmass_%s", histName.Data()), ";p_T{TPC} (GeV/#it{c}); mass^{2}", HistType::kTH2F, {ptAxis, axismass}); } } + histos.add("hSpectra", " ", HistType::kTHnSparseF, {speciesBitAxis, ptAxis, nsigmaAxis, {5, -2.5, 2.5}, axisCent, axisRigidity, axisdEdx, axisDCA, axisDCA, nsigmaAxis}); + + histos.add("hQAtest", "", HistType::kTHnSparseF, {speciesBitAxis, ptAxis, {5, -2.5, 2.5}, axisTPCcls, axisITScls, axisITSchi2, axisTPCchi2}); + if (doprocessMC) { histomc.add("histVtxZgen", "histVtxZgen", kTH1F, {axisVtxZ}); histomc.add("ImptParameter", "ImptParameter", kTH1F, {axisImpt}); @@ -259,7 +267,7 @@ struct NucleitpcPbPb { } } //---------------------------------------------------------------------------------------------------------------- - void findprimaryParticles(aod::TrackAssoc const& tracksByColl, TracksFull const& tracks) + void findprimaryParticles(aod::TrackAssoc const& tracksByColl, TracksFull const& tracks, float cent) { for (const auto& trackId : tracksByColl) { const auto& track = tracks.rawIteratorAt(trackId.trackId()); @@ -276,6 +284,21 @@ struct NucleitpcPbPb { if (std::abs(track.eta()) > cfgCutEta && cfgetaRequire) continue; for (size_t i = 0; i < primaryParticles.size(); i++) { + + float ptMomn; + setTrackParCov(track, mTrackParCov); + mTrackParCov.setPID(track.pidForTracking()); + ptMomn = (i == he3 || i == he4) ? 2 * mTrackParCov.getPt() : mTrackParCov.getPt(); + int sign = 0; + if (track.sign() > 0) { + sign = 1; + } + if (track.sign() < 0) { + sign = -1; + } // <- This redeclares a new local variable! + if (cfgFillQAplots) { + histos.fill(HIST("hQAtest"), i, ptMomn, sign, track.tpcNClsFound(), track.itsNCls(), track.itsChi2NCl(), track.tpcChi2NCl()); + } if (std::abs(getRapidity(track, i)) > cfgCutRapidity && cfgRapidityRequire) continue; if (track.tpcNClsFound() < cfgTrackPIDsettings->get(i, "minTPCnCls") && cfgTPCNClsfoundRequire) @@ -299,44 +322,31 @@ struct NucleitpcPbPb { continue; if (getMeanItsClsSize(track) > cfgTrackPIDsettings->get(i, "maxITSclsSize") && cfgmaxGetMeanItsClsSizeRequire) continue; - if ((getRigidity(track) < cfgTrackPIDsettings->get(i, "minRigidity") || getRigidity(track) > cfgTrackPIDsettings->get(i, "maxRigidity")) && cfgRigidityCutRequire) - continue; - float ptMomn; - setTrackParCov(track, mTrackParCov); - mTrackParCov.setPID(track.pidForTracking()); - ptMomn = (i == he3 || i == he4) ? 2 * mTrackParCov.getPt() : mTrackParCov.getPt(); + bool insideDCAxy = (std::abs(track.dcaXY()) <= (cfgTrackPIDsettings->get(i, "maxDcaXY") * (0.0105f + 0.0350f / std::pow(ptMomn, 1.1f)))); // o2-linter: disable=magic-number (To be checked) if ((!(insideDCAxy) || std::abs(track.dcaZ()) > dcazSigma(ptMomn, cfgTrackPIDsettings->get(i, "maxDcaZ"))) && cfgDCAwithptRequire) continue; - if (track.sign() > 0) { - histos.fill(HIST("histDcaZVsPtData_particle"), ptMomn, track.dcaZ()); - histos.fill(HIST("histDcaXYVsPtData_particle"), ptMomn, track.dcaXY()); - } - if (track.sign() < 0) { - histos.fill(HIST("histDcaZVsPtData_antiparticle"), ptMomn, track.dcaZ()); - histos.fill(HIST("histDcaXYVsPtData_antiparticle"), ptMomn, track.dcaXY()); - } + float tpcNsigma = getTPCnSigma(track, primaryParticles.at(i)); if ((std::abs(tpcNsigma) > cfgTrackPIDsettings->get(i, "maxTPCnSigma")) && cfgmaxTPCnSigmaRequire) continue; float itsSigma = getITSnSigma(track, primaryParticles.at(i)); - if ((std::abs(itsSigma) > cfgITSnsigma) && cfgmaxITSnSigmaRequire) - continue; - fillnsigma(track, i); - filldedx(track, i); - // TOF selection - if (!track.hasTOF() && cfgTrackPIDsettings->get(i, "TOFrequiredabove") < 1) + + if (itsSigma < cfgTrackPIDsettings2->get(i, "minITSnsigma") && cfgTrackPIDsettings2->get(i, "useITSnsigma") < 1) continue; - float beta{o2::pid::tof::Beta::GetBeta(track)}; - float charge{1.f + static_cast(i == he3 || i == he4)}; - float tofMasses = getRigidity(track) * charge * std::sqrt(1.f / (beta * beta) - 1.f); - if ((getRigidity(track) > cfgTrackPIDsettings->get(i, "TOFrequiredabove") && (tofMasses < cfgTrackPIDsettings->get(i, "minTOFmass") || tofMasses > cfgTrackPIDsettings->get(i, "maxTOFmass"))) && cfgmassRequire) + if (itsSigma > cfgTrackPIDsettings2->get(i, "maxITSnsigma") && cfgTrackPIDsettings2->get(i, "useITSnsigma") < 1) continue; + fillhmass(track, i); + if (cfgFillhspectra) { + histos.fill(HIST("hSpectra"), i, ptMomn, tpcNsigma, sign, cent, getRigidity(track) * track.sign(), track.tpcSignal(), track.dcaZ(), track.dcaXY(), itsSigma); + } if (cfgRequirebetaplot) { histos.fill(HIST("Tofsignal"), getRigidity(track) * track.sign(), o2::pid::tof::Beta::GetBeta(track)); } - filldedx(track, nParticles); + } + if (track.tpcNClsFound() < cfgtpcNClsFound || track.itsNCls() < cfgitsNCls) { + histos.fill(HIST("Tpcsignal"), getRigidity(track) * track.sign(), track.tpcSignal()); } histos.fill(HIST("histeta"), track.eta()); } // track loop @@ -365,7 +375,8 @@ struct NucleitpcPbPb { histos.fill(HIST("histCentFTOC_cut"), collision.centFT0C()); const uint64_t collIdx = collision.globalIndex(); auto tracksByColl = tracksColl.sliceBy(perCollision, collIdx); - findprimaryParticles(tracksByColl, tracks); + + findprimaryParticles(tracksByColl, tracks, collision.centFT0C()); if (!collHasCandidate) continue; } @@ -473,6 +484,21 @@ struct NucleitpcPbPb { for (size_t i = 0; i < primaryParticles.size(); i++) { if (std::abs(pdg) != std::abs(particlePdgCodes.at(i))) continue; + + float ptMomn; + setTrackParCov(track, mTrackParCov); + mTrackParCov.setPID(track.pidForTracking()); + ptMomn = (i == he3 || i == he4) ? 2 * mTrackParCov.getPt() : mTrackParCov.getPt(); + int sign = 0; + if (track.sign() > 0) { + sign = 1; + } + if (track.sign() < 0) { + sign = -1; + } // <- This redeclares a new local variable! + if (cfgFillQAplots) { + histos.fill(HIST("hQAtest"), i, ptMomn, sign, track.tpcNClsFound(), track.itsNCls(), track.itsChi2NCl(), track.tpcChi2NCl()); + } if (std::abs(getRapidity(track, i)) > cfgCutRapidity && cfgRapidityRequire) continue; if (track.tpcNClsFound() < cfgTrackPIDsettings->get(i, "minTPCnCls") && cfgTPCNClsfoundRequire) @@ -496,43 +522,29 @@ struct NucleitpcPbPb { continue; if (getMeanItsClsSize(track) > cfgTrackPIDsettings->get(i, "maxITSclsSize") && cfgmaxGetMeanItsClsSizeRequire) continue; - if ((getRigidity(track) < cfgTrackPIDsettings->get(i, "minRigidity") || getRigidity(track) > cfgTrackPIDsettings->get(i, "maxRigidity")) && cfgRigidityCutRequire) - continue; - float ptMomn; - setTrackParCov(track, mTrackParCov); - mTrackParCov.setPID(track.pidForTracking()); - ptMomn = (i == he3 || i == he4) ? 2 * mTrackParCov.getPt() : mTrackParCov.getPt(); + bool insideDCAxy = (std::abs(track.dcaXY()) <= (cfgTrackPIDsettings->get(i, "maxDcaXY") * (0.0105f + 0.0350f / std::pow(ptMomn, 1.1f)))); // o2-linter: disable=magic-number (To be checked) if ((!(insideDCAxy) || std::abs(track.dcaZ()) > dcazSigma(ptMomn, cfgTrackPIDsettings->get(i, "maxDcaZ"))) && cfgDCAwithptRequire) continue; - if (track.sign() > 0) { - histos.fill(HIST("histDcaZVsPtData_particle"), ptMomn, track.dcaZ()); - histos.fill(HIST("histDcaXYVsPtData_particle"), ptMomn, track.dcaXY()); - } - if (track.sign() < 0) { - histos.fill(HIST("histDcaZVsPtData_antiparticle"), ptMomn, track.dcaZ()); - histos.fill(HIST("histDcaXYVsPtData_antiparticle"), ptMomn, track.dcaXY()); - } + float tpcNsigma = getTPCnSigma(track, primaryParticles.at(i)); if ((std::abs(tpcNsigma) > cfgTrackPIDsettings->get(i, "maxTPCnSigma")) && cfgmaxTPCnSigmaRequire) continue; float itsSigma = getITSnSigma(track, primaryParticles.at(i)); - if ((std::abs(itsSigma) > cfgITSnsigma) && cfgmaxITSnSigmaRequire) - continue; - fillnsigma(track, i); - filldedx(track, i); - if (!track.hasTOF() && cfgTrackPIDsettings->get(i, "TOFrequiredabove") < 1) + + if (itsSigma < cfgTrackPIDsettings2->get(i, "minITSnsigma") && cfgTrackPIDsettings2->get(i, "useITSnsigma") < 1) continue; - float beta{o2::pid::tof::Beta::GetBeta(track)}; - float charge{1.f + static_cast(i == he3 || i == he4)}; - float tofMasses = getRigidity(track) * charge * std::sqrt(1.f / (beta * beta) - 1.f); - if ((getRigidity(track) > cfgTrackPIDsettings->get(i, "TOFrequiredabove") && (tofMasses < cfgTrackPIDsettings->get(i, "minTOFmass") || tofMasses > cfgTrackPIDsettings->get(i, "maxTOFmass"))) && cfgmassRequire) + if (itsSigma > cfgTrackPIDsettings2->get(i, "maxITSnsigma") && cfgTrackPIDsettings2->get(i, "useITSnsigma") < 1) continue; + fillhmass(track, i); + if (cfgFillhspectra) { + histos.fill(HIST("hSpectra"), i, ptMomn, tpcNsigma, sign, collision.centFT0C(), getRigidity(track) * track.sign(), track.tpcSignal(), track.dcaZ(), track.dcaXY(), itsSigma); + } if (cfgRequirebetaplot) { histos.fill(HIST("Tofsignal"), getRigidity(track) * track.sign(), o2::pid::tof::Beta::GetBeta(track)); } - filldedx(track, nParticles); + /*----------------------------------------------------------------------------------------------------------------*/ float ptReco; mTrackParCov.setPID(track.pidForTracking()); @@ -631,42 +643,8 @@ struct NucleitpcPbPb { } //---------------------------------------------------------------------------------------------------------------- template - void filldedx(T const& track, int species) - { - const float rigidity = getRigidity(track); - if (track.tpcNClsFound() < cfgtpcNClsFound || track.itsNCls() < cfgitsNCls) - return; - if (cfgFillDeDxWithCut) { - hDeDx[2 * species]->Fill(track.sign() * rigidity, track.tpcSignal()); - } - } - //---------------------------------------------------------------------------------------------------------------- - template - void fillnsigma(T const& track, int species) - { - if (track.tpcNClsFound() < cfgtpcNClsFound || track.itsNCls() < cfgitsNCls) - return; - if (cfgFillnsigma) { - int i = species; - const float tpcNsigma = getTPCnSigma(track, primaryParticles.at(i)); - float ptMomn; - setTrackParCov(track, mTrackParCov); - mTrackParCov.setPID(track.pidForTracking()); - ptMomn = (i == he3 || i == he4) ? 2 * mTrackParCov.getPt() : mTrackParCov.getPt(); - if (track.sign() > 0) { - hNsigmaPt[2 * species]->Fill(ptMomn, tpcNsigma); - } - if (track.sign() < 0) { - hNsigmaPt[2 * species + 1]->Fill(ptMomn, tpcNsigma); - } - } - } - //---------------------------------------------------------------------------------------------------------------- - template void fillhmass(T const& track, int species) { - if (track.tpcNClsFound() < cfgtpcNClsFound || track.itsNCls() < cfgitsNCls) - return; if (!track.hasTOF() || !cfgFillmass) return; float beta{o2::pid::tof::Beta::GetBeta(track)}; From 132a790cffdf16772e257a8c461d5236430fabda Mon Sep 17 00:00:00 2001 From: Sebastian Scheid Date: Wed, 13 Aug 2025 15:43:31 +0200 Subject: [PATCH 041/986] [PWGEM] Add task for model predictions for meson spectra from OTF sims (#12558) --- PWGEM/Dilepton/Tasks/CMakeLists.txt | 4 + .../Tasks/mcParticlePredictionsOTF.cxx | 98 +++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx diff --git a/PWGEM/Dilepton/Tasks/CMakeLists.txt b/PWGEM/Dilepton/Tasks/CMakeLists.txt index 94ccb5f2ea4..fb0fb81fbcc 100644 --- a/PWGEM/Dilepton/Tasks/CMakeLists.txt +++ b/PWGEM/Dilepton/Tasks/CMakeLists.txt @@ -161,3 +161,7 @@ o2physics_add_dpl_workflow(dimuon-hadron-mpc PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2Physics::MLCore O2Physics::PWGEMDileptonCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(mc-particle-predictions-otf + SOURCES mcParticlePredictionsOTF.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx b/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx new file mode 100644 index 00000000000..5504e45b3aa --- /dev/null +++ b/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx @@ -0,0 +1,98 @@ +// 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 mcParticlePrediction.cxx +/// \author Sebastian Scheid, s.scheid@cern.ch +/// \brief Task to build the predictions from the models based on the generated particles +/// + +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" + +using namespace o2; +using namespace o2::framework; + +struct otfParticlePrediction { + // histogram registry + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + // define configurables + ConfigurableAxis binsEta{"binsEta", {100, -5, 5}, "Binning of the Eta axis"}; + ConfigurableAxis binsPt{"binsPt", {100, 0, 10}, "Binning of the Pt axis"}; + + Configurable maxEtaParticle{"maxEtaParticle", 5.f, "Max eta of particles considered"}; + + // init function + void + init() + { + + const AxisSpec axisEta{binsEta, "#eta"}; + const AxisSpec axisPt{binsPt, "#it{p}_{T} (GeV/#it{c})"}; + + histos.add("collisions/generated", "collisions", kTH1D, {{2, -0.5, 1.5}}); + histos.add("particles/generated/pi0", "pi0", kTH2D, {axisPt, axisEta}); + histos.add("particles/generated/eta", "eta", kTH2D, {axisPt, axisEta}); + histos.add("particles/generated/etaP", "etaP", kTH2D, {axisPt, axisEta}); + histos.add("particles/generated/rho", "rho", kTH2D, {axisPt, axisEta}); + histos.add("particles/generated/omega", "omega", kTH2D, {axisPt, axisEta}); + histos.add("particles/generated/phi", "phi", kTH2D, {axisPt, axisEta}); + } + + void process(aod::McCollisions const& mcCollisions, + aod::McParticles const& mcParticles) + { + + histos.fill(HIST("collisions/generated"), 0, mcCollisions.size()); + + for (const auto& particle : mcParticles) { + auto pdg = std::abs(particle.pdgCode()); + if (particle.eta() < maxEtaParticle) { + continue; + } + if (pdg < 100) { + continue; + } + if (pdg > 1000) { + continue; + } + switch (pdg) { + case 111: + histos.fill(HIST("particles/generated/pi0"), particle.pt(), particle.eta()); + break; + case 221: + histos.fill(HIST("particles/generated/eta"), particle.pt(), particle.eta()); + break; + case 331: + histos.fill(HIST("particles/generated/etaP"), particle.pt(), particle.eta()); + break; + case 223: + histos.fill(HIST("particles/generated/omega"), particle.pt(), particle.eta()); + break; + case 113: + histos.fill(HIST("particles/generated/rho"), particle.pt(), particle.eta()); + break; + case 333: + histos.fill(HIST("particles/generated/phi"), particle.pt(), particle.eta()); + break; + default: + break; + } + } + } +}; + +WorkflowSpec + defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From 7e0a2c7b6f649a39a6d0168546e214f94e540bc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Wed, 13 Aug 2025 16:00:51 +0200 Subject: [PATCH 042/986] [PWGUD] SGSelector: Fix const correctness (#12550) --- PWGUD/Core/SGSelector.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/PWGUD/Core/SGSelector.h b/PWGUD/Core/SGSelector.h index a80224ef82b..2c5868df303 100644 --- a/PWGUD/Core/SGSelector.h +++ b/PWGUD/Core/SGSelector.h @@ -31,8 +31,8 @@ template struct SelectionResult { - int value; // The original integer return value - BC* bc; // Pointer to the BC object + int value; // The original integer return value + const BC* bc; // Pointer to the BC object }; namespace o2::aod::sgselector @@ -54,14 +54,14 @@ class SGSelector SGSelector() : myRCTChecker{"CBT"}, myRCTCheckerHadron{"CBT_hadronPID"}, myRCTCheckerZDC{"CBT", true}, myRCTCheckerHadronZDC{"CBT_hadronPID", true} {} template - int Print(SGCutParHolder /*diffCuts*/, CC& collision, BCs& /*bcRange*/, TCs& /*tracks*/, FWs& /*fwdtracks*/) + int Print(SGCutParHolder const& /*diffCuts*/, CC const& collision, BCs const& /*bcRange*/, TCs const& /*tracks*/, FWs const& /*fwdtracks*/) { LOGF(info, "Size of array %i", collision.size()); return 1; } template - SelectionResult IsSelected(SGCutParHolder diffCuts, CC& collision, BCs& bcRange, BC& oldbc) + SelectionResult IsSelected(SGCutParHolder const& diffCuts, CC const& collision, BCs const& bcRange, BC const& oldbc) { // LOGF(info, "Collision %f", collision.collisionTime()); // LOGF(info, "Number of close BCs: %i", bcRange.size()); @@ -138,9 +138,9 @@ class SGSelector } template - int trueGap(CC& collision, float fv0, float ft0a, float ft0c, float zdc_cut) + int trueGap(CC const& collision, const float fv0, const float ft0a, const float ft0c, const float zdc_cut) { - float fit_cut[3] = {fv0, ft0a, ft0c}; + const float fit_cut[3] = {fv0, ft0a, ft0c}; int gap = collision.gapSide(); int true_gap = gap; // float FV0A, FT0A, FT0C, ZNA, ZNC; @@ -174,7 +174,7 @@ class SGSelector // check CBT flags template - bool isCBTOk(CC& collision) + bool isCBTOk(CC const& collision) { if (myRCTChecker(collision)) return true; @@ -183,7 +183,7 @@ class SGSelector // check CBT+hadronPID flags template - bool isCBTHadronOk(CC& collision) + bool isCBTHadronOk(CC const& collision) { if (myRCTCheckerHadron(collision)) return true; @@ -192,7 +192,7 @@ class SGSelector // check CBT+ZDC flags template - bool isCBTZdcOk(CC& collision) + bool isCBTZdcOk(CC const& collision) { if (myRCTCheckerZDC(collision)) return true; @@ -201,7 +201,7 @@ class SGSelector // check CBT+hadronPID+ZDC flags template - bool isCBTHadronZdcOk(CC& collision) + bool isCBTHadronZdcOk(CC const& collision) { if (myRCTCheckerHadronZDC(collision)) return true; From 5d9260df003d4c54c769f1e5bdc6a6dd3b307d97 Mon Sep 17 00:00:00 2001 From: Sebastian Scheid Date: Wed, 13 Aug 2025 17:45:42 +0200 Subject: [PATCH 043/986] [PWGEM] Select only physical primaries in peredictions from OTF (#12564) --- PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx b/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx index 5504e45b3aa..4ebd94f90a1 100644 --- a/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx +++ b/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx @@ -59,6 +59,9 @@ struct otfParticlePrediction { if (particle.eta() < maxEtaParticle) { continue; } + if (!particle.isPhysicalPrimary()) { + continue; + } if (pdg < 100) { continue; } From 00ba0ad1a747b183b8aca5e1951b8e4f207741c9 Mon Sep 17 00:00:00 2001 From: Rashi gupta <167059733+rashigupt@users.noreply.github.com> Date: Wed, 13 Aug 2025 22:01:23 +0530 Subject: [PATCH 044/986] [PWGHF] Apply associated-hadron selection for mixed-event electron-hadron correlation (#12554) --- PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx index 3469c1fad69..0a824c1e9b5 100644 --- a/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx @@ -154,6 +154,9 @@ struct HfCorrelatorHfeHadrons { // Add hadron Table For Mix Event Electron Hadron correlation for (const auto& hTrack : tracks) { + if (!selAssoHadron(hTrack)) { + continue; + } registry.fill(HIST("hTracksBin"), poolBin); entryHadron(hTrack.phi(), hTrack.eta(), hTrack.pt(), poolBin, gCollisionId, timeStamp); } From 4153d223a8dbee16b1a7dee180d936b4d8a49b8a Mon Sep 17 00:00:00 2001 From: Victor Gonzalez Date: Wed, 13 Aug 2025 19:14:22 +0200 Subject: [PATCH 045/986] [PWGCF] DptDpt - Event selection expansion and flexibilization (#12568) Co-authored-by: Victor --- PWGCF/TableProducer/dptDptFilter.cxx | 57 +-- PWGCF/TableProducer/dptDptFilter.h | 632 +++++++++++---------------- 2 files changed, 272 insertions(+), 417 deletions(-) diff --git a/PWGCF/TableProducer/dptDptFilter.cxx b/PWGCF/TableProducer/dptDptFilter.cxx index c55cec45f1e..2e9e7dcc721 100644 --- a/PWGCF/TableProducer/dptDptFilter.cxx +++ b/PWGCF/TableProducer/dptDptFilter.cxx @@ -97,32 +97,12 @@ const char* speciesName[kDptDptNoOfSpecies] = {"h", "e", "mu", "pi", "ka", "p"}; const char* speciesTitle[kDptDptNoOfSpecies] = {"", "e", "#mu", "#pi", "K", "p"}; -const char* eventSelectionSteps[knCollisionSelectionFlags] = { - "IN", - "MB", - "INT7", - "SEL7", - "SEL8", - "NOSAMEBUNCHPUP", - "ISGOODZVTXFT0VSPV", - "ISVERTEXITSTPC", - "ISVERTEXTOFMATCHED", - "ISVERTEXTRDMATCHED", - "NOCOLLINTIMERANGE", - "NOCOLLINROF", - "OCCUPANCY", - "ISGOODITSLAYER3", - "ISGOODITSLAYER0123", - "ISGOODITSLAYERALL", - "CENTRALITY", - "ZVERTEX", - "SELECTED"}; - //============================================================================================ // The DptDptFilter histogram objects // TODO: consider registering in the histogram registry //============================================================================================ TH1D* fhEventSelection = nullptr; +TH1D* fhTriggerSelection = nullptr; TH1F* fhCentMultB = nullptr; TH1F* fhCentMultA = nullptr; TH1F* fhVertexZB = nullptr; @@ -374,7 +354,6 @@ struct DptDptFilter { struct : ConfigurableGroup { std::string prefix = "cfgEventSelection"; - Configurable itsDeadMaps{"itsDeadMaps", "", "Level of inactive chips: nocheck(empty), goodIts3, goodIts0123, goodItsAll. Default empty"}; Configurable minOrbit{"minOrbit", -1, "Lowest orbit to track"}; Configurable maxOrbit{"maxOrbit", INT64_MAX, "Highest orbit to track"}; struct : ConfigurableGroup { @@ -433,9 +412,9 @@ struct DptDptFilter { /* the track types and combinations */ /* the centrality/multiplicity estimation */ if (doprocessWithoutCent || doprocessWithoutCentDetectorLevel || doprocessWithoutCentGeneratorLevel) { - fCentMultEstimator = kNOCM; + fCentMultEstimator = CentMultNOCM; } else if (doprocessOnTheFlyGeneratorLevel) { - fCentMultEstimator = kFV0A; + fCentMultEstimator = CentMultFV0A; } else { fCentMultEstimator = getCentMultEstimator(cfgCentMultEstimator); } @@ -443,11 +422,9 @@ struct DptDptFilter { fOccupancyEstimation = getOccupancyEstimator(cfgEventSelection.cfgOccupancySelection.cfgOccupancyEstimation); fMinOccupancy = cfgEventSelection.cfgOccupancySelection.cfgMinOccupancy; fMaxOccupancy = cfgEventSelection.cfgOccupancySelection.cfgMaxOccupancy; - /* the ITS dead map check */ - fItsDeadMapCheck = getItsDeadMapCheck(cfgEventSelection.itsDeadMaps); /* the trigger selection */ - fTriggerSelection = getTriggerSelection(cfgTriggSel); + triggerSelectionFlags = getTriggerSelection(cfgTriggSel); traceCollId0 = cfgTraceCollId0; /* if the system type is not known at this time, we have to put the initialization somewhere else */ @@ -461,9 +438,13 @@ struct DptDptFilter { if ((fDataType == kData) || (fDataType == kDataNoEvtSel) || (fDataType == kMC)) { /* create the reconstructed data histograms */ - fhEventSelection = new TH1D("EventSelection", ";;counts", knCollisionSelectionFlags, -0.5f, static_cast(knCollisionSelectionFlags) - 0.5f); - for (int ix = 0; ix < knCollisionSelectionFlags; ++ix) { - fhEventSelection->GetXaxis()->SetBinLabel(ix + 1, eventSelectionSteps[ix]); + fhEventSelection = new TH1D("EventSelection", ";;counts", CollSelNOOFFLAGS, -0.5f, static_cast(CollSelNOOFFLAGS) - 0.5f); + for (int ix = 0; ix < CollSelNOOFFLAGS; ++ix) { + fhEventSelection->GetXaxis()->SetBinLabel(ix + 1, collisionSelectionExternalNamesMap.at(ix).c_str()); + } + fhTriggerSelection = new TH1D("TriggerSelection", ";;counts", TriggSelNOOFTRIGGERS, -0.5f, static_cast(TriggSelNOOFTRIGGERS) - 0.5f); + for (int ix = 0; ix < TriggSelNOOFTRIGGERS; ++ix) { + fhTriggerSelection->GetXaxis()->SetBinLabel(ix + 1, TString::Format("#color[%d]{%s}", triggerSelectionFlags.test(ix) ? 2 : 1, triggerSelectionExternalNamesMap.at(ix).c_str()).Data()); } /* TODO: proper axes and axes titles according to the system; still incomplete */ std::string multestimator = getCentMultEstimatorName(fCentMultEstimator); @@ -485,6 +466,7 @@ struct DptDptFilter { /* add the hstograms to the output list */ fOutputList->Add(fhEventSelection); + fOutputList->Add(fhTriggerSelection); fOutputList->Add(fhCentMultB); fOutputList->Add(fhCentMultA); fOutputList->Add(fhMultB); @@ -617,8 +599,13 @@ void DptDptFilter::processReconstructed(CollisionObject const& collision, Tracks collisionsinfo(uint8_t(false), 105.0); } } - /* report the event selection */ - for (int iflag = 0; iflag < knCollisionSelectionFlags; ++iflag) { + /* report the trigger and event selection */ + for (int iflag = 0; iflag < TriggSelNOOFTRIGGERS; ++iflag) { + if (triggerFlags.test(iflag)) { + fhTriggerSelection->Fill(iflag); + } + } + for (int iflag = 0; iflag < CollSelNOOFFLAGS; ++iflag) { if (collisionFlags.test(iflag)) { fhEventSelection->Fill(iflag); } @@ -1757,10 +1744,8 @@ void DptDptFilterTracks::fillParticleHistosAfterSelection(ParticleObject const& WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - WorkflowSpec workflow{adaptAnalysisTask(cfgc, - SetDefaultProcesses{ - {{"processWithoutCent", true}, - {"processWithoutCentMC", true}}}), + metadataInfo.initMetadata(cfgc); + WorkflowSpec workflow{adaptAnalysisTask(cfgc), adaptAnalysisTask(cfgc)}; return workflow; } diff --git a/PWGCF/TableProducer/dptDptFilter.h b/PWGCF/TableProducer/dptDptFilter.h index 3e44818103c..f0107b77a2e 100644 --- a/PWGCF/TableProducer/dptDptFilter.h +++ b/PWGCF/TableProducer/dptDptFilter.h @@ -95,67 +95,143 @@ enum DataType { /// \enum CentMultEstimatorType /// \brief The detector used to estimate centrality/multiplicity enum CentMultEstimatorType { - kNOCM = 0, ///< do not use centrality/multiplicity estimator - kV0M, ///< V0M centrality/multiplicity estimator Run 1/2 - kCL0, ///< CL0 centrality/multiplicity estimator Run 1/2 - kCL1, ///< CL1 centrality/multiplicity estimator Run 1/2 - kFV0A, ///< FV0A centrality/multiplicity estimator Run 3 - kFT0M, ///< FT0M centrality/multiplicity estimator Run 3 - kFT0A, ///< FT0A centrality/multiplicity estimator Run 3 - kFT0C, ///< FT0C centrality/multiplicity estimator Run 3 - kNTPV, ///< NTPV centrality/multiplicity estimator Run 3 - knCentMultEstimators ///< number of centrality/mutiplicity estimator + CentMultNOCM = 0, ///< do not use centrality/multiplicity estimator + CentMultV0M, ///< V0M centrality/multiplicity estimator Run 1/2 + CentMultCL0, ///< CL0 centrality/multiplicity estimator Run 1/2 + CentMultCL1, ///< CL1 centrality/multiplicity estimator Run 1/2 + CentMultFV0A, ///< FV0A centrality/multiplicity estimator Run 3 + CentMultFT0M, ///< FT0M centrality/multiplicity estimator Run 3 + CentMultFT0A, ///< FT0A centrality/multiplicity estimator Run 3 + CentMultFT0C, ///< FT0C centrality/multiplicity estimator Run 3 + CentMultNTPV, ///< NTPV centrality/multiplicity estimator Run 3 + CentMultNOOFESTIMATORS ///< number of centrality/mutiplicity estimator }; -/// \enum TriggerSelectionType -/// \brief The type of trigger to apply for event selection -enum TriggerSelectionType { - kNONE = 0, ///< do not use trigger selection - kMB, ///< Minimum bias trigger - kMBEXTRA, ///< Additional Run3 event quality - kVTXTOFMATCHED, ///< at least one vertex contributor is matched to TOF - kVTXTRDMATCHED, ///< at least one vertex contributor is matched to TRD - kVTXTRDTOFMATCHED, ///< at least one vertex contributor is matched to TRD and TOF - kEXTRAVTXTOFMATCHED, ///< Additional Run3 event quality and at least one vertex contributor is matched to TOF - kEXTRAVTXTRDMATCHED, ///< Additional Run3 event quality and at least one vertex contributor is matched to TRD - kEXTRAVTXTRDTOFMATCHED, ///< Additional Run3 event quality and at least one vertex contributor is matched to TRD and TOF - knEventSelection ///< number of triggers for event selection +/// \std::map estimatorInternalCodesMap +/// \brief maps centrality/multiplicity estimator names to internal estimator codes +static const std::map estimatorInternalCodesMap{ + {"NOCM", CentMultNOCM}, + {"V0M", CentMultV0M}, + {"CL0", CentMultCL0}, + {"CL1", CentMultCL1}, + {"FV0A", CentMultFV0A}, + {"FT0M", CentMultFT0M}, + {"FT0A", CentMultFT0A}, + {"FT0C", CentMultFT0C}, + {"NTPV", CentMultNTPV}}; + +/// \std::map estimatorExternalNamesMap +/// \brief maps internal estimator codes to centrality/multiplicity estimator external names +static const std::map estimatorExternalNamesMap{ + {CentMultNOCM, "NOCM"}, + {CentMultV0M, "V0M"}, + {CentMultCL0, "CL0"}, + {CentMultCL1, "CL1"}, + {CentMultFV0A, "FV0A"}, + {CentMultFT0M, "FT0M"}, + {CentMultFT0A, "FT0A"}, + {CentMultFT0C, "FT0C"}, + {CentMultNTPV, "NTPV"}}; + +/// \enum TriggerSelectionTags +/// \brief The potential trigger tags to apply for event selection +enum TriggerSelectionTags { + TriggSelNONE = 0, ///< do not use trigger selection + TriggSelMB, ///< Minimum bias trigger + TriggSelNOSAMEBUNCHPUP, ///< No same bunch pile up + TriggSelNUMPVCONTRIBUTORS, ///< Number of primary vertex contributors + TriggSelVTXTOFMATCHED, ///< at least one primary vertex contributor is matched to TOF + TriggSelVTXTRDMATCHED, ///< at least one primary vertex contributor is matched to TRD + TriggSelNOCOLLINTRSTD, ///< no other collision in standard time range gap + TriggSelNOCOLLINROFSTD, ///< no other collision in standard readout frame gap + TriggSelISVERTEXITSTPC, ///< primary vertex contributors are matched tracks ITS+TPC + TriggSelISGOODZVTXFT0VSPV, ///< vertex extracted from FT0 is compatible with the one from primary vertex contributors + TriggSelGOODITSLAYER3, ///< good the 3 ITS layer + TriggSelGOODITSLAYER0123, ///< check good the 0,1,2,and 3 ITS layers + TriggSelGOODITSLAYERALL, ///< check good all ITS layers + TriggSelNOGOODITSLAYER3, ///< check no good the 3 ITS layer + TriggSelNOGOODITSLAYER0123, ///< check no good the 0,1,2,and 3 ITS layers + TriggSelNOGOODITSLAYERALL, ///< check no good all ITS layers + TriggSelNOOFTRIGGERS ///< number of triggers for event selection }; +/// \std::map triggerSelectionBitsMap +/// \brief maps trigger selection tags to internal trigger selection bits +static const std::map triggerSelectionBitsMap{ + {"none", TriggSelNONE}, + {"mb", TriggSelMB}, + {"nosamebunchpup", TriggSelNOSAMEBUNCHPUP}, + {"numpvcontr", TriggSelNUMPVCONTRIBUTORS}, + {"vtxtofmatched", TriggSelVTXTOFMATCHED}, + {"vtxtrdmatched", TriggSelVTXTRDMATCHED}, + {"nocollintrstd", TriggSelNOCOLLINTRSTD}, + {"nocollinrofstd", TriggSelNOCOLLINROFSTD}, + {"isvtxitstpc", TriggSelISVERTEXITSTPC}, + {"isgoodvtxft0vspv", TriggSelISGOODZVTXFT0VSPV}, + {"gooditslayer3", TriggSelGOODITSLAYER3}, + {"gooditslayer0123", TriggSelGOODITSLAYER0123}, + {"gooditslayerall", TriggSelGOODITSLAYERALL}, + {"nogooditslayer3", TriggSelNOGOODITSLAYER3}, + {"nogooditslayer0123", TriggSelNOGOODITSLAYER0123}, + {"nogooditslayerall", TriggSelNOGOODITSLAYERALL}}; + +/// \std::map triggerSelectionExternalNamesMap +/// \brief maps trigger selection bits to external names +static const std::map triggerSelectionExternalNamesMap{ + {TriggSelNONE, "none"}, + {TriggSelMB, "Sel8"}, ///< Sel8 includes kIsTriggerTVX, kNoTimeFrameBorder, and kNoITSROFrameBorder + {TriggSelNOSAMEBUNCHPUP, "No same bunch pileup"}, + {TriggSelNUMPVCONTRIBUTORS, "Number PV contributors"}, + {TriggSelVTXTOFMATCHED, "PV contributor TOF matched"}, + {TriggSelVTXTRDMATCHED, "PV contributor TRD matched"}, + {TriggSelNOCOLLINTRSTD, "No coll in TR standard"}, + {TriggSelNOCOLLINROFSTD, "No coll in ROF standard"}, + {TriggSelISVERTEXITSTPC, "Vertex from ITS and TPC"}, + {TriggSelISGOODZVTXFT0VSPV, "Good vtx FT0 vs PV"}, + {TriggSelGOODITSLAYER3, "Good ITS layer 3"}, + {TriggSelGOODITSLAYER0123, "Good ITS layers 0,1,2,3"}, + {TriggSelGOODITSLAYERALL, "Good ITS layer all"}, + {TriggSelNOGOODITSLAYER3, "No good ITS layer 3"}, + {TriggSelNOGOODITSLAYER0123, "No good ITS layer 0,1,2,3"}, + {TriggSelNOGOODITSLAYERALL, "No good ITS layer all"}}; + /// \enum OccupancyEstimationType /// \brief The type of occupancy estimation enum OccupancyEstimationType { - kNOOCC = 0, ///< do not use occupancy estimation - kTRACKSOCC, ///< occupancy estimated using tracks - kFT0COCC, ///< occupancy estimated using the FT0C - knOccupancyEstimators ///< the number of occupancy estimators + OccupancyNOOCC = 0, ///< do not use occupancy estimation + OccupancyTRACKSOCC, ///< occupancy estimated using tracks + OccupancyFT0COCC, ///< occupancy estimated using the FT0C + OccupancyNOOFESTIMATORS ///< the number of occupancy estimators }; /// \enum CollisionSelectionFlags /// \brief The different criteria for selecting/rejecting collisions enum CollisionSelectionFlags { - kIN = 0, ///< new unhandled, yet, event - kMBBIT, ///< minimum bias - kINT7BIT, ///< INT7 Run 1/2 - kSEL7BIT, ///< Sel7 Run 1/2 - kSEL8BIT, ///< Sel8 - kNOSAMEBUNCHPUPBIT, ///< no same bunch pile up - kISGOODZVTXFT0VSPVBIT, ///< good zvtx FT0 vs PV - kISVERTEXITSTPCBIT, ///< is vertex TPC and ITS - kISVERTEXTOFMATCHEDBIT, ///< vertex contributor with TOF matched - kISVERTEXTRDMATCHEDBIT, ///< vertex contributor with TRD matche - kNOCOLLINTIMERANGEBIT, ///< no collision in time range - kNOCOLLINROFBIT, ///< no collision in readout - kOCCUPANCYBIT, ///< occupancy within limits - kISGOODITSLAYER3BIT, ///< right level of inactive chips for ITS layer 3 - kISGOODITSLAYER0123BIT, ///< right level of inactive chips for ITS layers 0,1,2, and 3 - kISGOODITSLAYERALLBIT, ///< right level of inactive chips for all seven ITS layers - kCENTRALITYBIT, ///< centrality cut passed - kZVERTEXBIT, ///< zvtx cut passed - kSELECTED, ///< the event has passed all selections - knCollisionSelectionFlags ///< number of flags + CollSelIN = 0, ///< new unhandled, yet, event + CollSelMBBIT, ///< minimum bias + CollSelINT7BIT, ///< INT7 Run 1/2 + CollSelSEL7BIT, ///< Sel7 Run 1/2 + CollSelTRIGGSELBIT, ///< Accepted by trigger selection + CollSelOCCUPANCYBIT, ///< occupancy within limits + CollSelCENTRALITYBIT, ///< centrality cut passed + CollSelZVERTEXBIT, ///< zvtx cut passed + CollSelSELECTED, ///< the event has passed all selections + CollSelNOOFFLAGS ///< number of flags }; +/// \std::mag collisionSelectionExternalNamesMap +/// \brief maps collision selection bits to external names +static const std::map collisionSelectionExternalNamesMap{ + {CollSelIN, "In"}, + {CollSelMBBIT, "MB"}, + {CollSelINT7BIT, "INT7"}, + {CollSelSEL7BIT, "Sel7"}, + {CollSelTRIGGSELBIT, "Trigger selection"}, + {CollSelOCCUPANCYBIT, "Occupancy"}, + {CollSelCENTRALITYBIT, "Centrality"}, + {CollSelZVERTEXBIT, "z vertex"}, + {CollSelSELECTED, "Selected"}}; + /// \enum StrongDebugging /// \brief Enable a per track information debugging. Only for local analyses enum StrongDebugging { @@ -171,18 +247,6 @@ enum TpcExclusionMethod { kDYNAMIC ///< pT dependent exclusion matching the sector borders a la Alex Dobrin }; -/// \enum ItsDeadMapsCheckType -/// \brief Check for the right level of ITS dead chips -enum ItsDeadMapsCheckType { - kNOCHECK = 0, ///< no check - kGOODITSLAYER3, ///< check good the 3 ITS layer - kGOODITSLAYER0123, ///< check good the 0,1,2,and 3 ITS layers - kGOODITSLAYERALL, ///< check good all ITS layers - kNOGOODITSLAYER3, ///< check no good the 3 ITS layer - kNOGOODITSLAYER0123, ///< check no good the 0,1,2,and 3 ITS layers - kNOGOODITSLAYERALL ///< check no good all ITS layers -}; - //============================================================================================ // The debug output stream //============================================================================================ @@ -194,9 +258,12 @@ std::ofstream debugstream; float overallminp = 0.0f; //============================================================================================ -// The collision selection flags and configuration objects +// The collision selection and trigger selection flags and configuration objects //============================================================================================ std::bitset<32> collisionFlags; +std::bitset<32> collisionSelectionFlags; +std::bitset<32> triggerFlags; +std::bitset<32> triggerSelectionFlags; //============================================================================================ // The input data metadata access helper @@ -528,10 +595,8 @@ inline TList* getCCDBInput(auto& ccdb, const char* ccdbpath, const char* ccdbdat SystemType fSystem = kNoSystem; DataType fDataType = kData; -CentMultEstimatorType fCentMultEstimator = kV0M; -TriggerSelectionType fTriggerSelection = kMB; -OccupancyEstimationType fOccupancyEstimation = kNOOCC; /* the occupancy estimator to use */ -ItsDeadMapsCheckType fItsDeadMapCheck = kNOCHECK; /* the check of the ITS dead maps to use */ +CentMultEstimatorType fCentMultEstimator = CentMultV0M; +OccupancyEstimationType fOccupancyEstimation = OccupancyNOOCC; /* the occupancy estimator to use */ float fMinOccupancy = 0.0f; /* the minimum allowed occupancy */ float fMaxOccupancy = 1e6f; /* the maximum allowed occupancy */ @@ -544,30 +609,35 @@ float particleMaxDCAxy = 999.9f; float particleMaxDCAZ = 999.9f; bool traceCollId0 = false; -inline TriggerSelectionType getTriggerSelection(std::string const& triggstr) +inline std::bitset<32> getTriggerSelection(std::string const& triggstr) { - if (triggstr.empty() || triggstr == "MB") { - return kMB; - } else if (triggstr == "MBEXTRA") { - return kMBEXTRA; - } else if (triggstr == "VTXTOFMATCHED") { - return kVTXTOFMATCHED; - } else if (triggstr == "VTXTRDMATCHED") { - return kVTXTRDMATCHED; - } else if (triggstr == "VTXTRDTOFMATCHED") { - return kVTXTRDTOFMATCHED; - } else if (triggstr == "EXTRAVTXTOFMATCHED") { - return kEXTRAVTXTOFMATCHED; - } else if (triggstr == "EXTRAVTXTRDMATCHED") { - return kEXTRAVTXTRDMATCHED; - } else if (triggstr == "EXTRAVTXTRDTOFMATCHED") { - return kEXTRAVTXTRDTOFMATCHED; - } else if (triggstr == "None") { - return kNONE; - } else { - LOGF(fatal, "Wrong trigger selection: %s", triggstr.c_str()); - return kNONE; + std::bitset<32> flags; + + auto split = [](const auto s) { + std::vector tokens; + std::string token; + + size_t posStart = 0; + size_t posEnd; + while ((posEnd = s.find("+", posStart)) != std::string::npos) { + token = s.substr(posStart, posEnd - posStart); + posStart = posEnd + 1; + tokens.push_back(token); + } + tokens.push_back(s.substr(posStart)); + return tokens; + }; + + std::vector tags = split(triggstr); + + for (const auto& tag : tags) { + if (triggerSelectionBitsMap.contains(tag)) { + flags.set(triggerSelectionBitsMap.at(tag), true); + } else { + LOGF(fatal, "Wrong trigger selection tag: %s", tag.c_str()); + } } + return flags; } inline SystemType getSytemTypeFromMetaData() @@ -575,10 +645,13 @@ inline SystemType getSytemTypeFromMetaData() auto period = metadataInfo.get("LPMProductionTag"); if (period == "LHC25ad" || period == "LHC25g5") { + LOGF(info, "Configuring for p-O LHC25ad period"); return kpORun3; } else if (period == "LHC25ae" || period == "LHC25g6") { + LOGF(info, "Configuring for O-O LHC25ae period"); return kOORun3; } else if (period == "LHC25af" || period == "LHC25g7") { + LOGF(info, "Configuring for Ne-Ne LHC25af period"); return kNeNeRun3; } else { LOGF(fatal, "DptDptCorrelations::getSystemTypeFromMetadata(). No automatic system type configuration for %s period", period.c_str()); @@ -635,100 +708,35 @@ inline DataType getDataType(std::string const& datastr) inline CentMultEstimatorType getCentMultEstimator(std::string const& datastr) { - if (datastr == "V0M") { - return kV0M; - } else if (datastr == "CL0") { - return kCL0; - } else if (datastr == "CL1") { - return kCL1; - } else if (datastr == "FV0A") { - return kFV0A; - } else if (datastr == "FT0M") { - return kFT0M; - } else if (datastr == "FT0A") { - return kFT0A; - } else if (datastr == "FT0C") { - return kFT0C; - } else if (datastr == "NTPV") { - return kNTPV; - } else if (datastr == "NOCM") { - return kNOCM; + if (estimatorInternalCodesMap.contains(datastr)) { + return static_cast(estimatorInternalCodesMap.at(datastr)); } else { LOGF(fatal, "Centrality/Multiplicity estimator %s not supported yet", datastr.c_str()); } - return kNOCM; + return CentMultNOCM; } inline std::string getCentMultEstimatorName(CentMultEstimatorType est) { - switch (est) { - case kV0M: - return "V0M"; - break; - case kCL0: - return "CL0"; - break; - case kCL1: - return "CL1"; - break; - case kFV0A: - return "FV0A"; - break; - case kFT0M: - return "FT0M"; - break; - case kFT0A: - return "FT0A"; - break; - case kFT0C: - return "FT0C"; - break; - case kNTPV: - return "NTPV"; - break; - case kNOCM: - return "NOCM"; - break; - default: - LOGF(fatal, "Centrality/Multiplicity estimator %d not supported yet", (int)est); - return "WRONG"; - break; + if (estimatorExternalNamesMap.contains(est)) { + return estimatorExternalNamesMap.at(est); + } else { + LOGF(fatal, "Centrality/Multiplicity estimator %d not supported yet", static_cast(est)); } + return "WRONG"; } inline OccupancyEstimationType getOccupancyEstimator(const std::string& estimator) { if (estimator == "None") { - return kNOOCC; + return OccupancyNOOCC; } else if (estimator == "Tracks") { - return kTRACKSOCC; + return OccupancyTRACKSOCC; } else if (estimator == "FT0C") { - return kFT0COCC; + return OccupancyFT0COCC; } else { LOGF(fatal, "Occupancy estimator %s not supported yet", estimator.c_str()); - return kNOOCC; - } -} - -inline ItsDeadMapsCheckType getItsDeadMapCheck(const std::string& check) -{ - if (check.length() == 0 || check == "None") { - return kNOCHECK; - } else if (check == "goodIts3") { - return kGOODITSLAYER3; - } else if (check == "goodIts0123") { - return kGOODITSLAYER0123; - } else if (check == "goodItsAll") { - return kGOODITSLAYERALL; - } else if (check == "noGoodIts3") { - return kNOGOODITSLAYER3; - } else if (check == "noGoodIts0123") { - return kNOGOODITSLAYER0123; - } else if (check == "noGoodItsAll") { - return kNOGOODITSLAYERALL; - } else { - LOGF(fatal, "ITS dead map check %s not implemented", check.c_str()); - return kNOCHECK; + return OccupancyNOOCC; } } @@ -747,115 +755,67 @@ inline bool triggerSelectionReco(CollisionObject const& collision) case kPbp: case kPbPb: case kXeXe: - switch (fTriggerSelection) { - case kMB: - switch (fDataType) { - case kData: - if (collision.alias_bit(kINT7)) { - collisionFlags.set(kINT7BIT); - if (collision.sel7()) { - trigsel = true; - collisionFlags.set(kSEL7BIT); - } - } - break; - case kMC: + if (triggerSelectionFlags.test(TriggSelMB)) { + switch (fDataType) { + case kData: + if (collision.alias_bit(kINT7)) { + collisionFlags.set(CollSelINT7BIT); if (collision.sel7()) { trigsel = true; - collisionFlags.set(kSEL7BIT); + collisionFlags.set(CollSelSEL7BIT); } - break; - default: - collisionFlags.set(kMBBIT); + } + break; + case kMC: + if (collision.sel7()) { trigsel = true; - break; - } - break; - case kNONE: - trigsel = true; - break; - default: - break; + collisionFlags.set(CollSelSEL7BIT); + } + break; + default: + collisionFlags.set(CollSelMBBIT); + trigsel = true; + break; + } + } else if (triggerSelectionFlags.test(TriggSelNONE)) { + trigsel = true; } break; case kppRun3: - case kPbPbRun3: { - auto run3Accepted = [](auto const& coll) { - return coll.sel8() && - coll.selection_bit(aod::evsel::kNoCollInTimeRangeStandard) && - coll.selection_bit(aod::evsel::kNoCollInRofStandard); - }; - auto run3ExtraAccepted = [](auto const& coll) { - return coll.sel8() && - coll.selection_bit(aod::evsel::kNoSameBunchPileup) && - coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) && - coll.selection_bit(aod::evsel::kIsVertexITSTPC); + case kPbPbRun3: + case kNeNeRun3: + case kpORun3: + case kOORun3: { + auto setTriggerFlags = [](auto& flags, auto const& coll) { + flags.set(TriggSelMB, coll.sel8() != 0); + flags.set(TriggSelNOSAMEBUNCHPUP, coll.selection_bit(aod::evsel::kNoSameBunchPileup)); + flags.set(TriggSelNUMPVCONTRIBUTORS, coll.numContrib() > 1); /* TODO: make it configurable */ + flags.set(TriggSelVTXTOFMATCHED, coll.selection_bit(aod::evsel::kIsVertexTOFmatched)); + flags.set(TriggSelVTXTRDMATCHED, coll.selection_bit(aod::evsel::kIsVertexTRDmatched)); + flags.set(TriggSelNOCOLLINTRSTD, coll.selection_bit(aod::evsel::kNoCollInTimeRangeStandard)); + flags.set(TriggSelNOCOLLINROFSTD, coll.selection_bit(aod::evsel::kNoCollInRofStandard)); + flags.set(TriggSelISVERTEXITSTPC, coll.selection_bit(aod::evsel::kIsVertexITSTPC)); + flags.set(TriggSelISGOODZVTXFT0VSPV, coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)); + flags.set(TriggSelGOODITSLAYER3, coll.selection_bit(aod::evsel::kIsGoodITSLayer3)); + flags.set(TriggSelGOODITSLAYER0123, coll.selection_bit(aod::evsel::kIsGoodITSLayer0123)); + flags.set(TriggSelGOODITSLAYERALL, coll.selection_bit(aod::evsel::kIsGoodITSLayersAll)); + flags.set(TriggSelNOGOODITSLAYER3, !coll.selection_bit(aod::evsel::kIsGoodITSLayer3)); + flags.set(TriggSelNOGOODITSLAYER0123, !coll.selection_bit(aod::evsel::kIsGoodITSLayer0123)); + flags.set(TriggSelNOGOODITSLAYERALL, !coll.selection_bit(aod::evsel::kIsGoodITSLayersAll)); }; - auto setCollisionFlags = [](auto& flags, auto const& coll) { - flags.set(kSEL8BIT, coll.sel8() != 0); - flags.set(kNOSAMEBUNCHPUPBIT, coll.selection_bit(aod::evsel::kNoSameBunchPileup)); - flags.set(kISGOODZVTXFT0VSPVBIT, coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)); - flags.set(kISVERTEXITSTPCBIT, coll.selection_bit(aod::evsel::kIsVertexITSTPC)); - flags.set(kISVERTEXTOFMATCHEDBIT, coll.selection_bit(aod::evsel::kIsVertexTOFmatched)); - flags.set(kISVERTEXTRDMATCHEDBIT, coll.selection_bit(aod::evsel::kIsVertexTRDmatched)); - flags.set(kNOCOLLINTIMERANGEBIT, coll.selection_bit(aod::evsel::kNoCollInTimeRangeStandard)); - flags.set(kNOCOLLINROFBIT, coll.selection_bit(aod::evsel::kNoCollInRofStandard)); - flags.set(kISGOODITSLAYER3BIT, coll.selection_bit(aod::evsel::kIsGoodITSLayer3)); - flags.set(kISGOODITSLAYER0123BIT, coll.selection_bit(aod::evsel::kIsGoodITSLayer0123)); - flags.set(kISGOODITSLAYERALLBIT, coll.selection_bit(aod::evsel::kIsGoodITSLayersAll)); - }; - switch (fTriggerSelection) { - case kMB: - if (run3Accepted(collision)) { - trigsel = true; - } - break; - case kMBEXTRA: - if (run3ExtraAccepted(collision)) { - trigsel = true; - } - break; - case kVTXTOFMATCHED: - if (run3Accepted(collision) && collision.selection_bit(aod::evsel::kIsVertexTOFmatched)) { - trigsel = true; - } - break; - case kVTXTRDMATCHED: - if (run3Accepted(collision) && collision.selection_bit(aod::evsel::kIsVertexTRDmatched)) { - trigsel = true; - } - break; - case kVTXTRDTOFMATCHED: - if (run3Accepted(collision) && collision.selection_bit(aod::evsel::kIsVertexTRDmatched) && collision.selection_bit(aod::evsel::kIsVertexTOFmatched)) { - trigsel = true; - } - break; - case kEXTRAVTXTOFMATCHED: - if (run3ExtraAccepted(collision) && collision.selection_bit(aod::evsel::kIsVertexTOFmatched)) { - trigsel = true; - } - break; - case kEXTRAVTXTRDMATCHED: - if (run3ExtraAccepted(collision) && collision.selection_bit(aod::evsel::kIsVertexTRDmatched)) { - trigsel = true; - } - break; - case kEXTRAVTXTRDTOFMATCHED: - if (run3ExtraAccepted(collision) && collision.selection_bit(aod::evsel::kIsVertexTRDmatched) && collision.selection_bit(aod::evsel::kIsVertexTOFmatched)) { - trigsel = true; - } - break; - case kNONE: - trigsel = true; - break; - default: - break; + setTriggerFlags(triggerFlags, collision); + + /* special treatment for no trigger selection */ + if (triggerSelectionFlags.test(TriggSelNONE)) { + trigsel = true; + } else { + trigsel = ((triggerSelectionFlags & triggerFlags) == triggerSelectionFlags); } - setCollisionFlags(collisionFlags, collision); } break; default: break; } + collisionFlags.set(CollSelTRIGGSELBIT, trigsel); return trigsel; } @@ -927,31 +887,31 @@ template inline float extractMultiplicity(CollisionObject const& collision, CentMultEstimatorType est) { switch (est) { - case kV0M: + case CentMultV0M: return collision.multFV0M(); break; - case kCL0: + case CentMultCL0: return collision.multTracklets(); break; - case kCL1: + case CentMultCL1: return collision.multTracklets(); break; - case kFV0A: + case CentMultFV0A: return collision.multFV0A(); break; - case kFT0M: + case CentMultFT0M: return collision.multFT0M(); break; - case kFT0A: + case CentMultFT0A: return collision.multFT0A(); break; - case kFT0C: + case CentMultFT0C: return collision.multFT0M(); break; - case kNTPV: + case CentMultNTPV: return collision.multNTracksPV(); break; - case kNOCM: + case CentMultNOCM: return collision.multFT0M(); break; default: @@ -971,11 +931,11 @@ template float getCentMultPercentile(CollisionObject collision) { switch (fCentMultEstimator) { - case kV0M: + case CentMultV0M: return collision.centRun2V0M(); - case kCL0: + case CentMultCL0: return collision.centRun2CL0(); - case kCL1: + case CentMultCL1: return collision.centRun2CL1(); default: return 105.0; @@ -987,15 +947,15 @@ template float getCentMultPercentile(CollisionObject collision) { switch (fCentMultEstimator) { - case kFV0A: + case CentMultFV0A: return collision.centFV0A(); - case kFT0M: + case CentMultFT0M: return collision.centFT0M(); - case kFT0A: + case CentMultFT0A: return collision.centFT0A(); - case kFT0C: + case CentMultFT0C: return collision.centFT0C(); - case kNTPV: + case CentMultNTPV: return collision.centNTPV(); default: return 105.0; @@ -1009,7 +969,7 @@ inline bool centralitySelectionMult(CollisionObject collision, float& centmult) float mult = getCentMultPercentile(collision); if (mult < kValidPercentileUpLimit && kValidPercentileLowLimit < mult) { centmult = mult; - collisionFlags.set(kCENTRALITYBIT); + collisionFlags.set(CollSelCENTRALITYBIT); return true; } return false; @@ -1021,10 +981,10 @@ inline bool centralitySelectionNoMult(CollisionObject const&, float& centmult) { bool centmultsel = false; switch (fCentMultEstimator) { - case kNOCM: + case CentMultNOCM: centmult = 50.0; centmultsel = true; - collisionFlags.set(kCENTRALITYBIT); + collisionFlags.set(CollSelCENTRALITYBIT); break; default: break; @@ -1103,19 +1063,19 @@ template inline bool selectOnOccupancy(CollisionObject collision) { switch (fOccupancyEstimation) { - case kNOOCC: - collisionFlags.set(kOCCUPANCYBIT); + case OccupancyNOOCC: + collisionFlags.set(CollSelOCCUPANCYBIT); return true; - case kTRACKSOCC: + case OccupancyTRACKSOCC: if ((fMinOccupancy <= collision.trackOccupancyInTimeRange()) && (collision.trackOccupancyInTimeRange() < fMaxOccupancy)) { - collisionFlags.set(kOCCUPANCYBIT); + collisionFlags.set(CollSelOCCUPANCYBIT); return true; } else { return false; } - case kFT0COCC: + case OccupancyFT0COCC: if ((fMinOccupancy <= collision.ft0cOccupancyInTimeRange()) && (collision.ft0cOccupancyInTimeRange() < fMaxOccupancy)) { - collisionFlags.set(kOCCUPANCYBIT); + collisionFlags.set(CollSelOCCUPANCYBIT); return true; } else { return false; @@ -1182,95 +1142,6 @@ inline bool occupancySelection(aod::McCollision const&) return true; } -////////////////////////////////////////////////////////////////////////////////// -/// ITS dead maps selection -////////////////////////////////////////////////////////////////////////////////// - -/// \brief select on the ITS dead maps -/// \return true if the collision passes the ITS dead maps check false otherwise -template -inline bool selectOnItsDeadMaps(CollisionObject coll) -{ - auto checkFlag = [](auto flag, bool invert = false) { - return invert ? !flag : flag; - }; - switch (fItsDeadMapCheck) { - case kNOCHECK: - return true; - case kGOODITSLAYER3: - return checkFlag(coll.selection_bit(aod::evsel::kIsGoodITSLayer3)); - case kGOODITSLAYER0123: - return checkFlag(coll.selection_bit(aod::evsel::kIsGoodITSLayer0123)); - case kGOODITSLAYERALL: - return checkFlag(coll.selection_bit(aod::evsel::kIsGoodITSLayersAll)); - case kNOGOODITSLAYER3: - return checkFlag(coll.selection_bit(aod::evsel::kIsGoodITSLayer3), true); - case kNOGOODITSLAYER0123: - return checkFlag(coll.selection_bit(aod::evsel::kIsGoodITSLayer0123), true); - case kNOGOODITSLAYERALL: - return checkFlag(coll.selection_bit(aod::evsel::kIsGoodITSLayersAll), true); - default: - return false; - } -} - -/// \brief Occupancy selection by default: unknown subscribed collision table -template -inline bool itsDeadMapsSelection(CollisionObject const&) -{ - LOGF(fatal, "Occupancy selection not implemented for this kind of collisions"); - return false; -} - -/// \brief Occupancy selection for reconstructed and detector level collision tables with centrality/multiplicity information -template <> -inline bool itsDeadMapsSelection(aod::CollisionEvSelCent const& collision) -{ - return selectOnItsDeadMaps(collision); -} - -/// \brief Occupancy selection for reconstructed and detector level collision tables with Run 2 centrality/multiplicity information -template <> -inline bool itsDeadMapsSelection(aod::CollisionEvSelRun2Cent const&) -{ - return true; -} - -/// \brief Occupancy selection for reconstructed and detector level collision tables without centrality/multiplicity information -template <> -inline bool itsDeadMapsSelection(aod::CollisionEvSel const& collision) -{ - return selectOnItsDeadMaps(collision); -} - -/// \brief Occupancy selection for detector level collision tables without centrality/multiplicity -template <> -inline bool itsDeadMapsSelection::iterator>(soa::Join::iterator const& collision) -{ - return selectOnItsDeadMaps(collision); -} - -/// \brief Occupancy selection for detector level collision tables with centrality/multiplicity -template <> -inline bool itsDeadMapsSelection::iterator>(soa::Join::iterator const& collision) -{ - return selectOnItsDeadMaps(collision); -} - -/// \brief Occupancy selection for detector level collision tables with Run 2 centrality/multiplicity -template <> -inline bool itsDeadMapsSelection::iterator>(soa::Join::iterator const&) -{ - return true; -} - -/// \brief Occupancy selection for generator level collision table -template <> -inline bool itsDeadMapsSelection(aod::McCollision const&) -{ - return true; -} - ////////////////////////////////////////////////////////////////////////////////// /// Event selection ////////////////////////////////////////////////////////////////////////////////// @@ -1278,15 +1149,14 @@ inline bool itsDeadMapsSelection(aod::McCollision const&) template inline bool isEventSelected(CollisionObject const& collision, float& centormult) { + triggerFlags.reset(); collisionFlags.reset(); - collisionFlags.set(kIN); + collisionFlags.set(CollSelIN); bool trigsel = triggerSelection(collision); bool occupancysel = occupancySelection(collision); - bool itsdeadmapssel = itsDeadMapsSelection(collision); - bool zvtxsel = false; /* TODO: vertex quality checks */ if (zvtxlow < collision.posZ() && collision.posZ() < zvtxup) { @@ -1294,20 +1164,20 @@ inline bool isEventSelected(CollisionObject const& collision, float& centormult) if (collision.posZ() != 0.0) { /* if only one side, we accept collisions which have zvtx different than zero */ zvtxsel = true; - collisionFlags.set(kZVERTEXBIT); + collisionFlags.set(CollSelZVERTEXBIT); } } else { zvtxsel = true; - collisionFlags.set(kZVERTEXBIT); + collisionFlags.set(CollSelZVERTEXBIT); } } bool centmultsel = centralitySelection(collision, centormult); - bool accepted = trigsel && occupancysel && itsdeadmapssel && zvtxsel && centmultsel; + bool accepted = trigsel && occupancysel && zvtxsel && centmultsel; if (accepted) { - collisionFlags.set(kSELECTED); + collisionFlags.set(CollSelSELECTED); } return accepted; From 68867348e85fbe56da5f606b39fc849951248969 Mon Sep 17 00:00:00 2001 From: Giovanni Malfattore <89481844+giovannimalfattore@users.noreply.github.com> Date: Wed, 13 Aug 2025 20:40:26 +0200 Subject: [PATCH 046/986] [PWGLF] NucleiTask - Add DCA THnSparse (#12561) --- PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx b/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx index 8e5f159d331..288c5fecf21 100644 --- a/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx +++ b/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx @@ -466,6 +466,7 @@ struct LFNucleiBATask { // DCAxy,z if (outFlagOptions.makeDCABeforeCutPlots) { histos.add("tracks/dca/before/hDCAxyVsDCAzVsPt", "DCAxy vs DCAz vs Pt/z; DCAxy; DCAz", HistType::kTH3F, {{140, -0.7f, 0.7f}, {160, -0.8f, 0.8f}, {binsPtHe}}); + histos.add("tracks/dca/before/hDCAxyVsDCAz", "DCAxy vs DCAz (before cuts)", HistType::kTH2F, {{550, -1.1, 1.1}, {550, -1.1, 1.1}}); histos.add("tracks/dca/before/hDCAxy", "DCAxy", HistType::kTH1F, {dcaxyAxis}); histos.add("tracks/dca/before/hDCAz", "DCAz", HistType::kTH1F, {dcazAxis}); @@ -505,6 +506,9 @@ struct LFNucleiBATask { if (enableHe) { histos.add("tracks/helium/dca/before/hDCAxyVsDCAzVsPtHelium", "DCAxy vs DCAz vs Pt/z (He); DCAxy; DCAz", HistType::kTH3F, {{140, -0.7f, 0.7f}, {160, -0.8f, 0.8f}, {binsPtZHe}}); histos.add("tracks/helium/dca/before/hDCAxyVsDCAzVsPtantiHelium", "DCAxy vs DCAz vs Pt/z (#bar{He}); DCAxy; DCAz", HistType::kTH3F, {{140, -0.7f, 0.7f}, {160, -0.8f, 0.8f}, {binsPtZHe}}); + histos.add("tracks/helium/dca/before/h3DCAvsPtHelium", "", HistType::kTHnSparseD, {dcaxyAxis, dcazAxis, ptZHeAxis}); + histos.add("tracks/helium/dca/before/h3DCAvsPtantiHelium", "", HistType::kTHnSparseD, {dcaxyAxis, dcazAxis, ptZHeAxis}); + histos.add("tracks/helium/dca/before/hDCAxyVsPtHelium", "DCAxy vs Pt (He)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/hDCAxyVsPtantiHelium", "DCAxy vs Pt (#bar{He})", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/hDCAzVsPtHelium", "DCAz vs Pt (He)", HistType::kTH2F, {{ptZHeAxis}, {dcazAxis}}); @@ -561,6 +565,8 @@ struct LFNucleiBATask { if (enableHe && outFlagOptions.makeDCAAfterCutPlots) { histos.add("tracks/helium/dca/after/hDCAxyVsDCAzVsPtHelium", "DCAxy vs DCAz vs Pt/z (He); DCAxy; DCAz", HistType::kTH3F, {{140, -0.7f, 0.7f}, {160, -0.8f, 0.8f}, {binsPtZHe}}); histos.add("tracks/helium/dca/after/hDCAxyVsDCAzVsPtantiHelium", "DCAxy vs DCAz vs Pt/z (#bar{He}); DCAxy; DCAz", HistType::kTH3F, {{140, -0.7f, 0.7f}, {160, -0.8f, 0.8f}, {binsPtZHe}}); + histos.add("tracks/helium/dca/after/h3DCAvsPtHelium", "", HistType::kTHnSparseD, {dcaxyAxis, dcazAxis, ptZHeAxis}); + histos.add("tracks/helium/dca/after/h3DCAvsPtantiHelium", "", HistType::kTHnSparseD, {dcaxyAxis, dcazAxis, ptZHeAxis}); histos.add("tracks/helium/dca/after/hDCAxyVsPtHelium", "DCAxy vs Pt (He)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/after/hDCAxyVsPtantiHelium", "DCAxy vs Pt (#bar{He})", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/after/hDCAzVsPtHelium", "DCAz vs Pt (He)", HistType::kTH2F, {{ptZHeAxis}, {dcazAxis}}); @@ -2531,12 +2537,14 @@ struct LFNucleiBATask { if (isHe && std::abs(track.tpcNSigmaHe()) < nsigmaTPCvar.nsigmaTPCHe) { histos.fill(HIST("tracks/helium/dca/before/hDCAxyVsDCAzVsPtHelium"), track.dcaXY(), track.dcaZ(), hePt); + histos.fill(HIST("tracks/helium/dca/before/h3DCAvsPtHelium"), track.dcaXY(), track.dcaZ(), hePt); if (track.hasTOF() && outFlagOptions.doTOFplots) { histos.fill(HIST("tracks/helium/dca/before/TOF/hDCAxyVsDCAzVsPtHelium"), track.dcaXY(), track.dcaZ(), hePt); } } if (isAntiHe && std::abs(track.tpcNSigmaHe()) < nsigmaTPCvar.nsigmaTPCHe) { histos.fill(HIST("tracks/helium/dca/before/hDCAxyVsDCAzVsPtantiHelium"), track.dcaXY(), track.dcaZ(), antihePt); + histos.fill(HIST("tracks/helium/dca/before/h3DCAvsPtantiHelium"), track.dcaXY(), track.dcaZ(), antihePt); if (track.hasTOF() && outFlagOptions.doTOFplots) { histos.fill(HIST("tracks/helium/dca/before/TOF/hDCAxyVsDCAzVsPtantiHelium"), track.dcaXY(), track.dcaZ(), antihePt); } @@ -3697,12 +3705,14 @@ struct LFNucleiBATask { if (isHeWTPCpid) { histos.fill(HIST("tracks/helium/dca/after/hDCAxyVsDCAzVsPtHelium"), track.dcaXY(), track.dcaZ(), hePt); + histos.fill(HIST("tracks/helium/dca/after/h3DCAvsPtHelium"), track.dcaXY(), track.dcaZ(), hePt); if (track.hasTOF() && outFlagOptions.doTOFplots) { histos.fill(HIST("tracks/helium/dca/after/TOF/hDCAxyVsDCAzVsPtHelium"), track.dcaXY(), track.dcaZ(), hePt); } } if (isAntiHeWTPCpid) { histos.fill(HIST("tracks/helium/dca/after/hDCAxyVsDCAzVsPtantiHelium"), track.dcaXY(), track.dcaZ(), antihePt); + histos.fill(HIST("tracks/helium/dca/after/h3DCAvsPtantiHelium"), track.dcaXY(), track.dcaZ(), antihePt); if (track.hasTOF() && outFlagOptions.doTOFplots) { histos.fill(HIST("tracks/helium/dca/after/TOF/hDCAxyVsDCAzVsPtantiHelium"), track.dcaXY(), track.dcaZ(), antihePt); } From b330ad1559b5eaf3c4658d931ee4ee99e6f02312 Mon Sep 17 00:00:00 2001 From: Shirajum Monira <38348689+Eloviyo@users.noreply.github.com> Date: Wed, 13 Aug 2025 22:26:49 +0200 Subject: [PATCH 047/986] [PWGCF] FemtoUniverse cascade task -- added CPR check option for track-cascade (#12569) Co-authored-by: Shirajum Monira --- .../femtoUniversePairTaskTrackCascadeExtended.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx index 6d6e22c5bb2..00c2947bc81 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx @@ -368,6 +368,7 @@ struct femtoUniversePairTaskTrackCascadeExtended { template void doSameEvent(const FilteredFDCollision& col, const TableType& parts, PartitionType& partsOne, PartitionType& partsTwo) { + const auto& magFieldTesla = col.magField(); auto groupPartsOne = partsOne->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); auto groupPartsTwo = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); @@ -458,6 +459,11 @@ struct femtoUniversePairTaskTrackCascadeExtended { if (!pairCleaner.isCleanPair(p1, p2, parts)) { continue; } + if (confIsCPR.value) { + if (pairCloseRejection.isClosePair(p1, p2, parts, magFieldTesla, femto_universe_container::EventType::same)) { + return; + } + } const auto& posChild = parts.iteratorAt(p2.globalIndex() - 3 - parts.begin().globalIndex()); const auto& negChild = parts.iteratorAt(p2.globalIndex() - 2 - parts.begin().globalIndex()); @@ -682,6 +688,11 @@ struct femtoUniversePairTaskTrackCascadeExtended { if (!pairCleaner.isCleanPair(p1, p2, parts)) { continue; } + if (confIsCPR.value) { + if (pairCloseRejection.isClosePair(p1, p2, parts, magFieldTesla1, femto_universe_container::EventType::same)) { + return; + } + } mixedEventCont.setPair(p1, p2, multCol, confUse3D, 1.0f); } From f3790ae6fac9494bfe17cc145aee3e37f1c0e09c Mon Sep 17 00:00:00 2001 From: altsybee Date: Wed, 13 Aug 2025 22:42:05 +0200 Subject: [PATCH 048/986] [DPG] new configs for nITScls, isGoodStaves etc. (#12562) --- DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx | 69 ++++++++++++++++++---- 1 file changed, 57 insertions(+), 12 deletions(-) diff --git a/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx b/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx index dbe678d987b..7d23ded67aa 100644 --- a/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx +++ b/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx @@ -100,6 +100,11 @@ struct DetectorOccupancyQaTask { Configurable confUseAorCsideForPhiStudy{"UseAorCsideForPhiStudy", -1, "-1 - use full eta range, 0 - A, 1 - C sides"}; // o2-linter: disable=name/configurable (temporary fix) Configurable confRadiusForPhiCorrection{"RadiusForPhiCorrection", 0.8, "default: inner TPC radius, cm"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable confApplyGoodITSstavesFlaginEvSel{"ApplyGoodITSstavesFlaginEvSel", 0, "0 - no, 1 - yes"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable confMinITSclsPerTrack{"MinITSclsPerTrack", 5, "should be in 4..7"}; // o2-linter: disable=name/configurable (temporary fix) + + Configurable> confTimeSlicesForPastFutureStudies{"TimeSlicesForPastFutureStudies", {-40, -10, 20, 50, 80}, "Time slices for past/future studies, us"}; + uint64_t minGlobalBC = 0; Service ccdb; HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -275,6 +280,18 @@ struct DetectorOccupancyQaTask { histos.add("track_distr_nITStrThisEv_10_200/hPhi_highOccupInDistantFuture", ";#varphi;n tracks", kTH1D, {axisPhi}); histos.add("track_distr_nITStrThisEv_10_200/hPhi_highOccupInNeighbourEvents", ";#varphi;n tracks", kTH1D, {axisPhi}); + histos.add("track_distr_nITStrThisEv_10_200/hPhi_lowOccupInTPC_pos_vs_pt", ";#varphi;n tracks", kTH2D, {axisPhi, confAxisPtBinsForPhiStudy}); + histos.add("track_distr_nITStrThisEv_10_200/hPhi_highOccupInRecentPast_pos_vs_pt", ";#varphi;n tracks", kTH2D, {axisPhi, confAxisPtBinsForPhiStudy}); + histos.add("track_distr_nITStrThisEv_10_200/hPhi_highOccupInCloseFuture_pos_vs_pt", ";#varphi;n tracks", kTH2D, {axisPhi, confAxisPtBinsForPhiStudy}); + histos.add("track_distr_nITStrThisEv_10_200/hPhi_highOccupInDistantFuture_pos_vs_pt", ";#varphi;n tracks", kTH2D, {axisPhi, confAxisPtBinsForPhiStudy}); + histos.add("track_distr_nITStrThisEv_10_200/hPhi_highOccupInNeighbourEvents_pos_vs_pt", ";#varphi;n tracks", kTH2D, {axisPhi, confAxisPtBinsForPhiStudy}); + + histos.add("track_distr_nITStrThisEv_10_200/hPhi_lowOccupInTPC_neg_vs_pt", ";#varphi;n tracks", kTH2D, {axisPhi, confAxisPtBinsForPhiStudy}); + histos.add("track_distr_nITStrThisEv_10_200/hPhi_highOccupInRecentPast_neg_vs_pt", ";#varphi;n tracks", kTH2D, {axisPhi, confAxisPtBinsForPhiStudy}); + histos.add("track_distr_nITStrThisEv_10_200/hPhi_highOccupInCloseFuture_neg_vs_pt", ";#varphi;n tracks", kTH2D, {axisPhi, confAxisPtBinsForPhiStudy}); + histos.add("track_distr_nITStrThisEv_10_200/hPhi_highOccupInDistantFuture_neg_vs_pt", ";#varphi;n tracks", kTH2D, {axisPhi, confAxisPtBinsForPhiStudy}); + histos.add("track_distr_nITStrThisEv_10_200/hPhi_highOccupInNeighbourEvents_neg_vs_pt", ";#varphi;n tracks", kTH2D, {axisPhi, confAxisPtBinsForPhiStudy}); + histos.add("track_distr_nITStrThisEv_above_2000/hPhi_lowOccupInTPC", ";#varphi;n tracks", kTH1D, {axisPhi}); histos.add("track_distr_nITStrThisEv_above_2000/hPhi_highOccupInRecentPast", ";#varphi;n tracks", kTH1D, {axisPhi}); histos.add("track_distr_nITStrThisEv_above_2000/hPhi_highOccupInCloseFuture", ";#varphi;n tracks", kTH1D, {axisPhi}); @@ -590,7 +607,7 @@ struct DetectorOccupancyQaTask { if (!track.isPVContributor()) { continue; } - if (track.itsNCls() < 5) + if (track.itsNCls() < confMinITSclsPerTrack) continue; nITS567cls++; nITSTPCtracks += track.hasITS() && track.hasTPC(); @@ -860,17 +877,17 @@ struct DetectorOccupancyQaTask { // counters of occupancy in specified delta-time ranges, to monitor eta, phi, pt distributions later float integralFullDeltaTime = histos.get(HIST("thisEventITStracksInTimeBins"))->Integral(); - int binMin = histos.get(HIST("thisEventITStracksInTimeBins"))->FindBin(-39.5); // us - int binMax = histos.get(HIST("thisEventITStracksInTimeBins"))->FindBin(-10.5); + int binMin = histos.get(HIST("thisEventITStracksInTimeBins"))->FindBin(confTimeSlicesForPastFutureStudies->at(0) + 0.5); // default was: -39.5 us + int binMax = histos.get(HIST("thisEventITStracksInTimeBins"))->FindBin(confTimeSlicesForPastFutureStudies->at(1) - 0.5); // -10.5 float integralPast = histos.get(HIST("thisEventITStracksInTimeBins"))->Integral(binMin, binMax); - binMin = histos.get(HIST("thisEventITStracksInTimeBins"))->FindBin(20.5); - binMax = histos.get(HIST("thisEventITStracksInTimeBins"))->FindBin(49.5); + binMin = histos.get(HIST("thisEventITStracksInTimeBins"))->FindBin(confTimeSlicesForPastFutureStudies->at(2) + 0.5); // 20.5 + binMax = histos.get(HIST("thisEventITStracksInTimeBins"))->FindBin(confTimeSlicesForPastFutureStudies->at(3) - 0.5); // 49.5 float integralFuture1 = histos.get(HIST("thisEventITStracksInTimeBins"))->Integral(binMin, binMax); - binMin = histos.get(HIST("thisEventITStracksInTimeBins"))->FindBin(50.5); - binMax = histos.get(HIST("thisEventITStracksInTimeBins"))->FindBin(79.5); + binMin = histos.get(HIST("thisEventITStracksInTimeBins"))->FindBin(confTimeSlicesForPastFutureStudies->at(3) + 0.5); // 50.5 + binMax = histos.get(HIST("thisEventITStracksInTimeBins"))->FindBin(confTimeSlicesForPastFutureStudies->at(4) - 0.5); // 79.5 float integralFuture2 = histos.get(HIST("thisEventITStracksInTimeBins"))->Integral(binMin, binMax); - binMin = histos.get(HIST("thisEventITStracksInTimeBins"))->FindBin(-9.5); - binMax = histos.get(HIST("thisEventITStracksInTimeBins"))->FindBin(19.5); + binMin = histos.get(HIST("thisEventITStracksInTimeBins"))->FindBin(confTimeSlicesForPastFutureStudies->at(1) + 0.5); // -9.5 + binMax = histos.get(HIST("thisEventITStracksInTimeBins"))->FindBin(confTimeSlicesForPastFutureStudies->at(2) - 0.5); // 19.5 float integralNeighbourEvents = histos.get(HIST("thisEventITStracksInTimeBins"))->Integral(binMin, binMax); // recent past @@ -961,6 +978,9 @@ struct DetectorOccupancyQaTask { if (!col.sel8()) continue; + if (confApplyGoodITSstavesFlaginEvSel && !col.selection_bit(aod::evsel::kIsGoodITSLayersAll)) + continue; + // if (!col.selection_bit(kIsTriggerTVX)) // continue; @@ -997,7 +1017,7 @@ struct DetectorOccupancyQaTask { continue; if (track.eta() < confCutEtaMinTracksThisEvent || track.eta() > confCutEtaMaxTracksThisEvent) continue; - if (track.itsNCls() < 5) + if (track.itsNCls() < confMinITSclsPerTrack) continue; nPV++; } @@ -1023,7 +1043,7 @@ struct DetectorOccupancyQaTask { if (track.eta() < confCutEtaMinTracksThisEvent || track.eta() > confCutEtaMaxTracksThisEvent) continue; histos.fill(HIST("nTrackCounter_after_cuts_QA"), 3); - if (track.itsNCls() < 5) + if (track.itsNCls() < confMinITSclsPerTrack) continue; histos.fill(HIST("nTrackCounter_after_cuts_QA"), 4); // nPV++; @@ -1236,7 +1256,7 @@ struct DetectorOccupancyQaTask { for (const auto& track : tracksGrouped) { if (!track.isPVContributor()) continue; - if (track.itsNCls() < 5) + if (track.itsNCls() < confMinITSclsPerTrack) continue; // if (!(track.isGlobalTrack() && track.tpcNClsFound() >= confCutMinTPCcls)) // continue; @@ -1272,26 +1292,51 @@ struct DetectorOccupancyQaTask { histos.fill(HIST("track_distr_nITStrThisEv_10_200/hEta_lowOccupInTPC"), eta); histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPhi_lowOccupInTPC"), phi); histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPt_lowOccupInTPC"), pt); + + if (sign > 0) + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPhi_lowOccupInTPC_pos_vs_pt"), phi, pt); + else + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPhi_lowOccupInTPC_neg_vs_pt"), phi, pt); } if (flagWhichDeltaTimeWin == 2 && flagNoCollNearby) { histos.fill(HIST("track_distr_nITStrThisEv_10_200/hEta_highOccupInRecentPast"), eta); histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPhi_highOccupInRecentPast"), phi); histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPt_highOccupInRecentPast"), pt); + + if (sign > 0) + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPhi_highOccupInRecentPast_pos_vs_pt"), phi, pt); + else + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPhi_highOccupInRecentPast_neg_vs_pt"), phi, pt); } if (flagWhichDeltaTimeWin == 3 && flagNoCollNearby) { histos.fill(HIST("track_distr_nITStrThisEv_10_200/hEta_highOccupInCloseFuture"), eta); histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPhi_highOccupInCloseFuture"), phi); histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPt_highOccupInCloseFuture"), pt); + + if (sign > 0) + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPhi_highOccupInCloseFuture_pos_vs_pt"), phi, pt); + else + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPhi_highOccupInCloseFuture_neg_vs_pt"), phi, pt); } if (flagWhichDeltaTimeWin == 4 && flagNoCollNearby) { histos.fill(HIST("track_distr_nITStrThisEv_10_200/hEta_highOccupInDistantFuture"), eta); histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPhi_highOccupInDistantFuture"), phi); histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPt_highOccupInDistantFuture"), pt); + + if (sign > 0) + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPhi_highOccupInDistantFuture_pos_vs_pt"), phi, pt); + else + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPhi_highOccupInDistantFuture_neg_vs_pt"), phi, pt); } if (flagWhichDeltaTimeWin == 5) { histos.fill(HIST("track_distr_nITStrThisEv_10_200/hEta_highOccupInNeighbourEvents"), eta); histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPhi_highOccupInNeighbourEvents"), phi); histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPt_highOccupInNeighbourEvents"), pt); + + if (sign > 0) + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPhi_highOccupInNeighbourEvents_pos_vs_pt"), phi, pt); + else + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPhi_highOccupInNeighbourEvents_neg_vs_pt"), phi, pt); } histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPt_vs_tpcInnerPt_vs_occup"), pt, track.tpcInnerParam(), occupancy); } // end of TPC good global From 05af22b7d500c43271483f2c7d4afed1c9b26897 Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Thu, 14 Aug 2025 04:13:29 +0530 Subject: [PATCH 049/986] [PWGLF] Added MID in MC (#12565) Co-authored-by: Sawan Sawan --- PWGLF/Tasks/Resonances/kstarqa.cxx | 132 +++++++++++++++++++++-------- 1 file changed, 97 insertions(+), 35 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarqa.cxx b/PWGLF/Tasks/Resonances/kstarqa.cxx index c7dc0c9c3ed..1211294828d 100644 --- a/PWGLF/Tasks/Resonances/kstarqa.cxx +++ b/PWGLF/Tasks/Resonances/kstarqa.cxx @@ -97,9 +97,9 @@ struct Kstarqa { Configurable rotationalCut{"rotationalCut", 10, "Cut value (Rotation angle pi - pi/cut and pi + pi/cut)"}; Configurable cfgCutPT{"cfgCutPT", 0.2f, "PT cut on daughter track"}; Configurable cfgCutEtaMax{"cfgCutEtaMax", 0.8f, "Eta cut on daughter track"}; - Configurable cfgCutEtaMin{"cfgCutEtaMin", 0.0f, "Eta cut on daughter track"}; + // Configurable cfgCutEtaMin{"cfgCutEtaMin", 0.0f, "Eta cut on daughter track"}; Configurable cfgCutDCAxyMax{"cfgCutDCAxyMax", 2.0f, "DCAxy range for tracks"}; - Configurable cfgCutDCAxyMin{"cfgCutDCAxyMin", 0.0f, "DCAxy range for tracks"}; + // Configurable cfgCutDCAxyMin{"cfgCutDCAxyMin", 0.0f, "DCAxy range for tracks"}; Configurable cfgCutDCAz{"cfgCutDCAz", 2.0f, "DCAz range for tracks"}; Configurable ctrackRapidity{"ctrackRapidity", 0.3f, "Cut on track rapidity"}; Configurable cfgNoMixedEvents{"cfgNoMixedEvents", 5, "Number of mixed events per event"}; @@ -324,18 +324,20 @@ struct Kstarqa { std::shared_ptr hrecLabel = rEventSelection.get(HIST("recMCparticles")); hrecLabel->GetXaxis()->SetBinLabel(1, "All tracks"); - hrecLabel->GetXaxis()->SetBinLabel(2, "Track selection"); - hrecLabel->GetXaxis()->SetBinLabel(3, "has_MC"); + hrecLabel->GetXaxis()->SetBinLabel(2, "has_MC"); + hrecLabel->GetXaxis()->SetBinLabel(3, "Track selection"); hrecLabel->GetXaxis()->SetBinLabel(4, "StrictlyUpperIndex"); hrecLabel->GetXaxis()->SetBinLabel(5, "Unlike Sign"); hrecLabel->GetXaxis()->SetBinLabel(6, "Physical Primary"); - hrecLabel->GetXaxis()->SetBinLabel(7, "PID Cut"); - hrecLabel->GetXaxis()->SetBinLabel(8, "Rapidity Cut"); - hrecLabel->GetXaxis()->SetBinLabel(9, "Same mother"); - hrecLabel->GetXaxis()->SetBinLabel(10, "Generator"); - hrecLabel->GetXaxis()->SetBinLabel(11, "Rapidity"); - hrecLabel->GetXaxis()->SetBinLabel(12, "MotherPID313"); - hrecLabel->GetXaxis()->SetBinLabel(13, "Split track"); + hrecLabel->GetXaxis()->SetBinLabel(7, "Track PDG"); + hrecLabel->GetXaxis()->SetBinLabel(8, "Global Index"); + hrecLabel->GetXaxis()->SetBinLabel(9, "Generator"); + hrecLabel->GetXaxis()->SetBinLabel(10, "Mother y"); + hrecLabel->GetXaxis()->SetBinLabel(11, "Mother PDG"); + hrecLabel->GetXaxis()->SetBinLabel(12, "Track PID"); + hrecLabel->GetXaxis()->SetBinLabel(13, "Track MID"); + hrecLabel->GetXaxis()->SetBinLabel(14, "Track y"); + hrecLabel->GetXaxis()->SetBinLabel(15, "Split tracks"); std::shared_ptr hDataTracks = rEventSelection.get(HIST("tracksCheckData")); hDataTracks->GetXaxis()->SetBinLabel(1, "All tracks"); @@ -455,16 +457,18 @@ struct Kstarqa { return false; if (std::abs(candidate.pt()) < selectionConfig.cfgCutPT) return false; - if (std::abs(candidate.eta()) > selectionConfig.cfgCutEtaMax || std::abs(candidate.eta()) < selectionConfig.cfgCutEtaMin) + // if (std::abs(candidate.eta()) > selectionConfig.cfgCutEtaMax || std::abs(candidate.eta()) < selectionConfig.cfgCutEtaMin) + if (std::abs(candidate.eta()) > selectionConfig.cfgCutEtaMax) return false; if (!selectionConfig.isApplyPtDepDCAxyCut) { - if (std::abs(candidate.dcaXY()) > selectionConfig.cfgCutDCAxyMax || std::abs(candidate.dcaXY()) < selectionConfig.cfgCutDCAxyMin) + // if (std::abs(candidate.dcaXY()) > selectionConfig.cfgCutDCAxyMax || std::abs(candidate.dcaXY()) < selectionConfig.cfgCutDCAxyMin) + if (std::abs(candidate.dcaXY()) > selectionConfig.cfgCutDCAxyMax) return false; } else { if (std::abs(candidate.dcaXY()) > (0.0105 + 0.035 / std::pow(candidate.pt(), 1.1))) return false; } - if (selectionConfig.isGoldenChi2 && candidate.passedGoldenChi2()) + if (selectionConfig.isGoldenChi2 && !candidate.passedGoldenChi2()) return false; if (std::abs(candidate.dcaZ()) > selectionConfig.cfgCutDCAz) return false; @@ -485,9 +489,11 @@ struct Kstarqa { } else if (!selectionConfig.isGlobalTracks) { if (std::abs(candidate.pt()) < selectionConfig.cfgCutPT) return false; - if (std::abs(candidate.eta()) > selectionConfig.cfgCutEtaMax || std::abs(candidate.eta()) < selectionConfig.cfgCutEtaMin) + // if (std::abs(candidate.eta()) > selectionConfig.cfgCutEtaMax || std::abs(candidate.eta()) < selectionConfig.cfgCutEtaMin) + if (std::abs(candidate.eta()) > selectionConfig.cfgCutEtaMax) return false; - if (std::abs(candidate.dcaXY()) > selectionConfig.cfgCutDCAxyMax || std::abs(candidate.dcaXY()) < selectionConfig.cfgCutDCAxyMin) + // if (std::abs(candidate.dcaXY()) > selectionConfig.cfgCutDCAxyMax || std::abs(candidate.dcaXY()) < selectionConfig.cfgCutDCAxyMin) + if (std::abs(candidate.dcaXY()) > selectionConfig.cfgCutDCAxyMax) return false; if (std::abs(candidate.dcaZ()) > selectionConfig.cfgCutDCAz) return false; @@ -650,8 +656,10 @@ struct Kstarqa { // Filter eventFilter = (o2::aod::evsel::sel8 == true); Filter posZFilter = (nabs(o2::aod::collision::posZ) < selectionConfig.cutzvertex); - Filter acceptanceFilter = (nabs(aod::track::eta) < selectionConfig.cfgCutEtaMax && nabs(aod::track::pt) > selectionConfig.cfgCutPT) && (nabs(aod::track::eta) > selectionConfig.cfgCutEtaMin); - Filter fDCAcutFilter = (nabs(aod::track::dcaXY) < selectionConfig.cfgCutDCAxyMax) && (nabs(aod::track::dcaZ) < selectionConfig.cfgCutDCAz) && (nabs(aod::track::dcaXY) > selectionConfig.cfgCutDCAxyMin); + // Filter acceptanceFilter = (nabs(aod::track::eta) < selectionConfig.cfgCutEtaMax && nabs(aod::track::pt) > selectionConfig.cfgCutPT) && (nabs(aod::track::eta) > selectionConfig.cfgCutEtaMin); + Filter acceptanceFilter = (nabs(aod::track::eta) < selectionConfig.cfgCutEtaMax && nabs(aod::track::pt) > selectionConfig.cfgCutPT); + // Filter fDCAcutFilter = (nabs(aod::track::dcaXY) < selectionConfig.cfgCutDCAxyMax) && (nabs(aod::track::dcaZ) < selectionConfig.cfgCutDCAz) && (nabs(aod::track::dcaXY) > selectionConfig.cfgCutDCAxyMin); + Filter fDCAcutFilter = (nabs(aod::track::dcaXY) < selectionConfig.cfgCutDCAxyMax) && (nabs(aod::track::dcaZ) < selectionConfig.cfgCutDCAz); using EventCandidates = soa::Filtered>; // aod::CentNGlobals, aod::CentNTPVs, aod::CentMFTs using EventCandidatesMix = soa::Filtered>; // aod::CentNGlobals, aod::CentNTPVs, aod::CentMFTs @@ -1126,6 +1134,17 @@ struct Kstarqa { if (!selectionPID(t1, 1) || !selectionPID(t2, 0)) continue; + if (selectionConfig.isApplyParticleMID) { + if (selectionPID(t1, 0)) // Kaon misidentified as pion + continue; + if (selectionPID(t1, 2)) // Kaon misidentified as proton + continue; + if (selectionPID(t2, 1)) // Pion misidentified as kaon + continue; + if (selectionPID(t2, 2)) // Pion misidentified as proton + continue; + } + if (!t1.has_mcParticle() || !t2.has_mcParticle()) { continue; // skip if no MC particle associated } @@ -1282,12 +1301,23 @@ struct Kstarqa { continue; rEventSelection.fill(HIST("tracksCheckData"), 3.5); + if (selectionConfig.isApplyParticleMID) { + if (selectionPID(track1, 0)) // Kaon misidentified as pion + continue; + if (selectionPID(track1, 2)) // Kaon misidentified as proton + continue; + if (selectionPID(track2, 1)) // Pion misidentified as kaon + continue; + if (selectionPID(track2, 2)) // Pion misidentified as proton + continue; + } + + rEventSelection.fill(HIST("tracksCheckData"), 4.5); if (std::abs(track1.rapidity(o2::track::PID::getMass(o2::track::PID::Kaon))) > selectionConfig.ctrackRapidity) continue; if (std::abs(track2.rapidity(o2::track::PID::getMass(o2::track::PID::Pion))) > selectionConfig.ctrackRapidity) continue; - rEventSelection.fill(HIST("tracksCheckData"), 4.5); // if (cFakeTrack && isFakeTrack(track1, 1)) // Kaon // continue; @@ -1731,22 +1761,14 @@ struct Kstarqa { // if (!(track1PDG == PDG_t::kKPlus && track2PDG == PDG_t::kPiPlus)) { // continue; // } - if (selectionConfig.isPDGCheckMC && (track1PDG != PDG_t::kPiPlus) && (track1PDG != PDG_t::kKPlus)) { + if (selectionConfig.isPDGCheckMC && (track1PDG != PDG_t::kKPlus) && (track1PDG != PDG_t::kPiPlus)) { continue; } - if (selectionConfig.isPDGCheckMC && (track2PDG != PDG_t::kPiPlus) && (track2PDG != PDG_t::kKPlus)) { + if (selectionConfig.isPDGCheckMC && (track2PDG != PDG_t::kKPlus) && (track2PDG != PDG_t::kPiPlus)) { continue; } rEventSelection.fill(HIST("recMCparticles"), 6.5); - if (std::abs(track1.rapidity(o2::track::PID::getMass(o2::track::PID::Kaon))) > selectionConfig.ctrackRapidity) - continue; - - if (std::abs(track2.rapidity(o2::track::PID::getMass(o2::track::PID::Pion))) > selectionConfig.ctrackRapidity) - continue; - - rEventSelection.fill(HIST("recMCparticles"), 7.5); - for (const auto& mothertrack1 : mctrack1.mothers_as()) { for (const auto& mothertrack2 : mctrack2.mothers_as()) { if (selectionConfig.isPDGCheckMC && (mothertrack1.pdgCode() != mothertrack2.pdgCode())) { @@ -1756,22 +1778,22 @@ struct Kstarqa { if (mothertrack1.globalIndex() != mothertrack2.globalIndex()) { continue; } - rEventSelection.fill(HIST("recMCparticles"), 8.5); + rEventSelection.fill(HIST("recMCparticles"), 7.5); if (!mothertrack1.producedByGenerator()) { continue; } - rEventSelection.fill(HIST("recMCparticles"), 9.5); + rEventSelection.fill(HIST("recMCparticles"), 8.5); if (std::abs(mothertrack1.y()) >= selectionConfig.rapidityMotherData) { continue; } - rEventSelection.fill(HIST("recMCparticles"), 10.5); + rEventSelection.fill(HIST("recMCparticles"), 9.5); if (selectionConfig.isPDGCheckMC && (std::abs(mothertrack1.pdgCode()) != o2::constants::physics::kK0Star892)) { continue; } - rEventSelection.fill(HIST("recMCparticles"), 11.5); + rEventSelection.fill(HIST("recMCparticles"), 10.5); if (selectionConfig.isPDGCheckMC && (track1PDG == PDG_t::kPiPlus)) { if (!applypTdepPID && !(selectionPID(track1, 0) && selectionPID(track2, 1))) { // pion and kaon @@ -1779,12 +1801,52 @@ struct Kstarqa { } else if (applypTdepPID && !(selectionPIDNew(track1, 0) && selectionPIDNew(track2, 1))) { // pion and kaon continue; } - } else if (selectionConfig.isPDGCheckMC) { + rEventSelection.fill(HIST("recMCparticles"), 11.5); + if (selectionConfig.isApplyParticleMID) { + if (selectionPID(track2, 0)) // Kaon misidentified as pion + continue; + if (selectionPID(track2, 2)) // Kaon misidentified as proton + continue; + if (selectionPID(track1, 1)) // Pion misidentified as kaon + continue; + if (selectionPID(track1, 2)) // Pion misidentified as proton + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 12.5); + + if (std::abs(track1.rapidity(o2::track::PID::getMass(o2::track::PID::Pion))) > selectionConfig.ctrackRapidity) + continue; + + if (std::abs(track2.rapidity(o2::track::PID::getMass(o2::track::PID::Kaon))) > selectionConfig.ctrackRapidity) + continue; + rEventSelection.fill(HIST("recMCparticles"), 13.5); + + } else if (selectionConfig.isPDGCheckMC && (track1PDG == PDG_t::kKPlus)) { if (!applypTdepPID && !(selectionPID(track1, 1) && selectionPID(track2, 0))) { // kaon and pion continue; } else if (applypTdepPID && !(selectionPIDNew(track1, 1) && selectionPIDNew(track2, 0))) { // kaon and pion continue; } + rEventSelection.fill(HIST("recMCparticles"), 11.5); + + if (selectionConfig.isApplyParticleMID) { + if (selectionPID(track1, 0)) // Kaon misidentified as pion + continue; + if (selectionPID(track1, 2)) // Kaon misidentified as proton + continue; + if (selectionPID(track2, 1)) // Pion misidentified as kaon + continue; + if (selectionPID(track2, 2)) // Pion misidentified as proton + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 12.5); + + if (std::abs(track1.rapidity(o2::track::PID::getMass(o2::track::PID::Kaon))) > selectionConfig.ctrackRapidity) + continue; + + if (std::abs(track2.rapidity(o2::track::PID::getMass(o2::track::PID::Pion))) > selectionConfig.ctrackRapidity) + continue; + rEventSelection.fill(HIST("recMCparticles"), 13.5); } if (selectionConfig.isApplyCutsOnMother) { @@ -1798,7 +1860,7 @@ struct Kstarqa { hInvMass.fill(HIST("h1KSRecsplit"), mothertrack1.pt()); continue; } - rEventSelection.fill(HIST("recMCparticles"), 12.5); + rEventSelection.fill(HIST("recMCparticles"), 14.5); oldindex = mothertrack1.globalIndex(); if (track1.sign() * track2.sign() < 0) { From 7af8f70c082cfe1cb20977c2d45d8818ad841bec Mon Sep 17 00:00:00 2001 From: Victor Gonzalez Date: Thu, 14 Aug 2025 01:17:18 +0200 Subject: [PATCH 050/986] [PWGCF] DptDpt - RCT validation support (#12572) Co-authored-by: Victor --- PWGCF/TableProducer/dptDptFilter.cxx | 12 +++++++++++- PWGCF/TableProducer/dptDptFilter.h | 26 +++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/PWGCF/TableProducer/dptDptFilter.cxx b/PWGCF/TableProducer/dptDptFilter.cxx index 2e9e7dcc721..7d49129b992 100644 --- a/PWGCF/TableProducer/dptDptFilter.cxx +++ b/PWGCF/TableProducer/dptDptFilter.cxx @@ -356,8 +356,9 @@ struct DptDptFilter { std::string prefix = "cfgEventSelection"; Configurable minOrbit{"minOrbit", -1, "Lowest orbit to track"}; Configurable maxOrbit{"maxOrbit", INT64_MAX, "Highest orbit to track"}; + Configurable rctSource{"rctSource", "None", "RCT selection source: None,CBT,CBT_hadronPID,CBT_electronPID,CBT_calo,CBT_muon,CBT_muon_glo. Default: None"}; struct : ConfigurableGroup { - std::string prefix = "cfgOccupancySelection"; + std::string prefix = "cfgEventSelection.cfgOccupancySelection"; Configurable cfgOccupancyEstimation{"cfgOccupancyEstimation", "None", "Occupancy estimation: None, Tracks, FT0C. Default None"}; Configurable cfgMinOccupancy{"cfgMinOccupancy", 0.0f, "Minimum allowed occupancy. Depends on the occupancy estimation"}; Configurable cfgMaxOccupancy{"cfgMaxOccupancy", 1e6f, "Maximum allowed occupancy. Depends on the occupancy estimation"}; @@ -418,6 +419,15 @@ struct DptDptFilter { } else { fCentMultEstimator = getCentMultEstimator(cfgCentMultEstimator); } + /* RCT information usage */ + if (cfgEventSelection.rctSource.value == "None") { + useRctInformation = false; + } else { + /* for the time being we don't require ZDC and treat limited acceptance as faulty */ + rctChecker.init(cfgEventSelection.rctSource.value, false, true); + useRctInformation = true; + } + /* the occupancy selection */ fOccupancyEstimation = getOccupancyEstimator(cfgEventSelection.cfgOccupancySelection.cfgOccupancyEstimation); fMinOccupancy = cfgEventSelection.cfgOccupancySelection.cfgMinOccupancy; diff --git a/PWGCF/TableProducer/dptDptFilter.h b/PWGCF/TableProducer/dptDptFilter.h index f0107b77a2e..0652e4c2750 100644 --- a/PWGCF/TableProducer/dptDptFilter.h +++ b/PWGCF/TableProducer/dptDptFilter.h @@ -18,6 +18,7 @@ #include "PWGCF/Core/AnalysisConfigurableCuts.h" +#include "Common/CCDB/RCTSelectionFlags.h" #include "Common/Core/MetadataHelper.h" #include "Common/Core/RecoDecay.h" #include "Common/Core/TrackSelection.h" @@ -212,6 +213,7 @@ enum CollisionSelectionFlags { CollSelINT7BIT, ///< INT7 Run 1/2 CollSelSEL7BIT, ///< Sel7 Run 1/2 CollSelTRIGGSELBIT, ///< Accepted by trigger selection + CollSelRCTBIT, ///< Accetped by the RCT information CollSelOCCUPANCYBIT, ///< occupancy within limits CollSelCENTRALITYBIT, ///< centrality cut passed CollSelZVERTEXBIT, ///< zvtx cut passed @@ -227,6 +229,7 @@ static const std::map collisionSelectionExternalNamesMap{ {CollSelINT7BIT, "INT7"}, {CollSelSEL7BIT, "Sel7"}, {CollSelTRIGGSELBIT, "Trigger selection"}, + {CollSelRCTBIT, "RCT accepted"}, {CollSelOCCUPANCYBIT, "Occupancy"}, {CollSelCENTRALITYBIT, "Centrality"}, {CollSelZVERTEXBIT, "z vertex"}, @@ -270,6 +273,12 @@ std::bitset<32> triggerSelectionFlags; //============================================================================================ o2::common::core::MetadataHelper metadataInfo; +//============================================================================================ +// The RCT information access +//============================================================================================ +bool useRctInformation = false; +o2::aod::rctsel::RCTFlagsChecker rctChecker; + //============================================================================================ // The DptDptFilter configuration objects //============================================================================================ @@ -1155,6 +1164,21 @@ inline bool isEventSelected(CollisionObject const& collision, float& centormult) bool trigsel = triggerSelection(collision); + bool rctsel = false; + if (useRctInformation) { + if constexpr (framework::has_type_v) { + if (rctChecker.checkTable(collision)) { + rctsel = true; + collisionFlags.set(CollSelRCTBIT); + } + } else { + LOGF(fatal, "RCT check required but the dataset does not have RCT information associated. Please, fix it"); + } + } else { + collisionFlags.set(CollSelRCTBIT); + rctsel = true; + } + bool occupancysel = occupancySelection(collision); bool zvtxsel = false; @@ -1174,7 +1198,7 @@ inline bool isEventSelected(CollisionObject const& collision, float& centormult) bool centmultsel = centralitySelection(collision, centormult); - bool accepted = trigsel && occupancysel && zvtxsel && centmultsel; + bool accepted = trigsel && rctsel && occupancysel && zvtxsel && centmultsel; if (accepted) { collisionFlags.set(CollSelSELECTED); From 84dc5a13177e1a83516c873be9d0ea31bad58c88 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Thu, 14 Aug 2025 05:56:40 +0200 Subject: [PATCH 051/986] [PWGEM/Dilepton] speed up 2pc (#12574) --- PWGEM/Dilepton/Core/DileptonHadronMPC.h | 47 +++++++++------------- PWGEM/Dilepton/Utils/EventMixingHandler.h | 5 +++ PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h | 36 ++++++++--------- 3 files changed, 42 insertions(+), 46 deletions(-) diff --git a/PWGEM/Dilepton/Core/DileptonHadronMPC.h b/PWGEM/Dilepton/Core/DileptonHadronMPC.h index 058d69f9190..335b50af12d 100644 --- a/PWGEM/Dilepton/Core/DileptonHadronMPC.h +++ b/PWGEM/Dilepton/Core/DileptonHadronMPC.h @@ -127,7 +127,7 @@ struct DileptonHadronMPC { ConfigurableAxis ConfPtHadronBins{"ConfPtHadronBins", {VARIABLE_WIDTH, 0.00, 0.15, 0.2, 0.3, 0.4, 0.50, 1.00, 2.00, 3.00, 4.00, 5.00}, "pT,h bins for output histograms"}; ConfigurableAxis ConfRapidityBins{"ConfRapidityBins", {20, -1, 1}, "rapidity bins for output histograms"}; - ConfigurableAxis ConfDEtaBins{"ConfDEtaBins", {60, -3, 3}, "deta bins for output histograms"}; + ConfigurableAxis ConfDEtaBins{"ConfDEtaBins", {120, -6, 6}, "deta bins for output histograms"}; Configurable cfgNbinsDPhi{"cfgNbinsDPhi", 36, "nbins in dphi for output histograms"}; Configurable cfgNbinsCosNDPhi{"cfgNbinsCosNDPhi", 200, "nbins in cos(n(dphi)) for output histograms"}; Configurable cfgNmod{"cfgNmod", 2, "n-th harmonics"}; @@ -463,7 +463,7 @@ struct DileptonHadronMPC { o2::aod::pwgem::dilepton::utils::eventhistogram::addEventHistograms<-1>(&fRegistry); std::string mass_axis_title = "m_{ll} (GeV/c^{2})"; - std::string pair_pt_axis_title = "p_{T,ll}^{trg} (GeV/c)"; + std::string pair_pt_axis_title = "p_{T,ll} (GeV/c)"; std::string pair_dca_axis_title = "DCA_{ll} (#sigma)"; std::string pair_rapidity_axis_title = "y_{ll}"; std::string deta_axis_title = "#Delta#eta = #eta_{ll} - #eta_{h}"; @@ -539,7 +539,7 @@ struct DileptonHadronMPC { fRegistry.addClone("DileptonHadron/same/", "DileptonHadron/mix/"); // hadron-hadron - const AxisSpec axis_cosndphi_hh{cfgNbinsCosNDPhi, -1, +1, std::format("cos({0:d}(#varphi_{{h}}^{{trg}} - #varphi_{{h}}^{{ref}}))", cfgNmod.value)}; + const AxisSpec axis_cosndphi_hh{cfgNbinsCosNDPhi, -1, +1, std::format("cos({0:d}(#varphi_{{h}}^{{ref1}} - #varphi_{{h}}^{{ref2}}))", cfgNmod.value)}; fRegistry.add("HadronHadron/same/hDEtaCosNDPhi", "hadron-hadron 2PC", kTH2D, {axis_cosndphi_hh, axis_deta_hh}, true); } fRegistry.add("Dilepton/mix/hDiffBC", "diff. global BC in mixed event;|BC_{current} - BC_{mixed}|", kTH1D, {{10001, -0.5, 10000.5}}, true); @@ -1014,24 +1014,6 @@ struct DileptonHadronMPC { float cosndphi = std::cos(cfgNmod * dphi); fRegistry.fill(HIST("HadronHadron/") + HIST(event_pair_types[ev_id]) + HIST("hDEtaCosNDPhi"), cosndphi, deta, weight); } - - // store ref tracks for mixed event in case of kAzimuthalCorrelation - if constexpr (ev_id == 0) { - if (cfgDoMix && cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kAzimuthalCorrelation)) { - std::pair key_df_collision = std::make_pair(ndf, collision.globalIndex()); - std::pair pair_tmp_id1 = std::make_pair(ndf, t1.globalIndex()); - std::pair pair_tmp_id2 = std::make_pair(ndf, t2.globalIndex()); - if (std::find(used_refTrackIds.begin(), used_refTrackIds.end(), pair_tmp_id1) == used_refTrackIds.end()) { - used_refTrackIds.emplace_back(pair_tmp_id1); - emh_ref->AddTrackToEventPool(key_df_collision, EMTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.trackId(), t1.pt(), t1.eta(), t1.phi(), 0.139)); - } // store t1 - if (std::find(used_refTrackIds.begin(), used_refTrackIds.end(), pair_tmp_id2) == used_refTrackIds.end()) { - used_refTrackIds.emplace_back(pair_tmp_id2); - emh_ref->AddTrackToEventPool(key_df_collision, EMTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.trackId(), t2.pt(), t2.eta(), t2.phi(), 0.139)); - } // store t2 - } - } - return true; } @@ -1149,15 +1131,27 @@ struct DileptonHadronMPC { } } + std::pair key_df_collision = std::make_pair(ndf, collision.globalIndex()); + if (nuls > 0 || nlspp > 0 || nlsmm > 0) { // at least 1 pair exists. + emh_ref->ReserveNTracksPerCollision(key_df_collision, refTracks_per_coll.size()); for (const auto& track : refTracks_per_coll) { if (fEMTrackCut.IsSelected(track)) { fRegistry.fill(HIST("Hadron/hs"), track.pt(), track.eta(), track.phi()); fRegistry.fill(HIST("Hadron/hTrackBit"), track.trackBit()); + + // store ref tracks for mixed event in case of kAzimuthalCorrelation + if (cfgDoMix && cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kAzimuthalCorrelation)) { + std::pair pair_tmp_refTrack = std::make_pair(ndf, track.globalIndex()); + if (std::find(used_refTrackIds.begin(), used_refTrackIds.end(), pair_tmp_refTrack) == used_refTrackIds.end()) { + used_refTrackIds.emplace_back(pair_tmp_refTrack); + emh_ref->AddTrackToEventPool(key_df_collision, EMTrack(ndf, track.globalIndex(), collision.globalIndex(), track.trackId(), track.pt(), track.eta(), track.phi(), 0.139)); + } // store ref tracks + } } } - for (const auto& [trg, ref] : combinations(CombinationsStrictlyUpperIndexPolicy(refTracks_per_coll, refTracks_per_coll))) { - fillHadronHadron<0>(collision, trg, ref, posTracks_per_coll, negTracks_per_coll, cut); + for (const auto& [ref1, ref2] : combinations(CombinationsStrictlyUpperIndexPolicy(refTracks_per_coll, refTracks_per_coll))) { + fillHadronHadron<0>(collision, ref1, ref2, posTracks_per_coll, negTracks_per_coll, cut); } } @@ -1198,7 +1192,6 @@ struct DileptonHadronMPC { } std::tuple key_bin = std::make_tuple(zbin, centbin, epbin, occbin); - std::pair key_df_collision = std::make_pair(ndf, collision.globalIndex()); // make a vector of selected electrons in this collision. auto selected_posTracks_in_this_event = emh_pos->GetTracksPerCollision(key_df_collision); @@ -1256,7 +1249,6 @@ struct DileptonHadronMPC { if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kAzimuthalCorrelation)) { auto selected_refTracks_in_this_event = emh_ref->GetTracksPerCollision(key_df_collision); auto collisionIds_in_mixing_pool_hadron = emh_ref->GetCollisionIdsFromEventPool(key_bin); - // LOGF(info, "selected_refTracks_in_this_event.size() = %d, collisionIds_in_mixing_pool_hadron.size() = %d", selected_refTracks_in_this_event.size(), collisionIds_in_mixing_pool_hadron.size()); for (const auto& mix_dfId_collisionId : collisionIds_in_mixing_pool_hadron) { int mix_dfId = mix_dfId_collisionId.first; @@ -1273,13 +1265,14 @@ struct DileptonHadronMPC { } auto refTracks_from_event_pool = emh_ref->GetTracksPerCollision(mix_dfId_collisionId); - // LOGF(info, "refTracks_from_event_pool.size() = %d", refTracks_from_event_pool.size()); + // LOGF(info, "selected_refTracks_in_this_event.size() = %d, collisionIds_in_mixing_pool_hadron.size() = %d, refTracks_from_event_pool.size() = %d", selected_refTracks_in_this_event.size(), collisionIds_in_mixing_pool_hadron.size(), refTracks_from_event_pool.size()); for (const auto& ref1 : selected_refTracks_in_this_event) { // ref-ref mix for (const auto& ref2 : refTracks_from_event_pool) { + // LOGF(info, "ref1.pt() = %f, ref2.pt() = %f", ref1.pt(), ref2.pt()); fillHadronHadron<1>(collision, ref1, ref2, nullptr, nullptr, nullptr); } } - } // end of loop over mixed event pool for lepton-lepton + } // end of loop over mixed event pool for hadron-hadron } if (nuls > 0 || nlspp > 0 || nlsmm > 0) { diff --git a/PWGEM/Dilepton/Utils/EventMixingHandler.h b/PWGEM/Dilepton/Utils/EventMixingHandler.h index 1fa83c60240..20b38399979 100644 --- a/PWGEM/Dilepton/Utils/EventMixingHandler.h +++ b/PWGEM/Dilepton/Utils/EventMixingHandler.h @@ -47,6 +47,11 @@ class EventMixingHandler void SetNdepth(int ndepth) { fNdepth = ndepth; } + void ReserveNTracksPerCollision(U key_df_collision, int ntrack) + { + fMap_Tracks_per_collision[key_df_collision].reserve(ntrack); + } + void AddTrackToEventPool(U key_df_collision, V obj) { fMap_Tracks_per_collision[key_df_collision].emplace_back(obj); diff --git a/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h index 38379707151..b8a61b258d7 100644 --- a/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h +++ b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h @@ -105,7 +105,7 @@ struct DiphotonHadronMPC { ConfigurableAxis ConfPtggBins{"ConfPtggBins", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.50, 1.00, 1.50, 2.00, 2.50, 3.00, 3.50, 4.00, 4.50, 5.00, 6.00, 7.00, 8.00, 9.00, 10.00}, "pTgg bins for output histograms"}; ConfigurableAxis ConfPtHadronBins{"ConfPtHadronBins", {VARIABLE_WIDTH, 0.00, 0.15, 0.2, 0.3, 0.4, 0.50, 1.00, 2.00, 3.00, 4.00, 5.00}, "pT,h bins for output histograms"}; - ConfigurableAxis ConfDEtaBins{"ConfDEtaBins", {60, -3, 3}, "deta bins for output histograms"}; + ConfigurableAxis ConfDEtaBins{"ConfDEtaBins", {120, -6, 6}, "deta bins for output histograms"}; Configurable cfgNbinsDPhi{"cfgNbinsDPhi", 36, "nbins in dphi for output histograms"}; // Configurable cfgNbinsCosNDPhi{"cfgNbinsCosNDPhi", 100, "nbins in cos(n(dphi)) for output histograms"}; // Configurable cfgNmod{"cfgNmod", 2, "n-th harmonics"}; @@ -556,12 +556,6 @@ struct DiphotonHadronMPC { // LOGF(info, "collision.globalIndex() = %d, collision.posZ() = %f, centrality = %f, ep2 = %f, collision.trackOccupancyInTimeRange() = %d, zbin = %d, centbin = %d, epbin = %d, occbin = %d", collision.globalIndex(), collision.posZ(), centrality, ep2, collision.trackOccupancyInTimeRange(), zbin, centbin, epbin, occbin); auto refTracks_per_collision = refTracks.sliceBy(perCollision_track, collision.globalIndex()); - for (const auto& track : refTracks_per_collision) { - if (fEMTrackCut.IsSelected(track)) { - fRegistry.fill(HIST("Hadron/hs"), track.pt(), track.eta(), track.phi()); - fRegistry.fill(HIST("Hadron/hTrackBit"), track.trackBit()); - } - } std::tuple key_bin = std::make_tuple(zbin, centbin, epbin, occbin); std::pair key_df_collision = std::make_pair(ndf, collision.globalIndex()); @@ -587,7 +581,7 @@ struct DiphotonHadronMPC { auto pos2 = g2.template posTrack_as(); auto ele2 = g2.template negTrack_as(); - int npair = 0; + int npair = 0; // the number of diphoton-h pairs for (const auto& track : refTracks_per_collision) { if (pos1.trackId() == track.trackId() || ele1.trackId() == track.trackId()) { continue; @@ -604,11 +598,6 @@ struct DiphotonHadronMPC { dphi = RecoDecay::constrainAngle(dphi, -M_PI / 2, 1U); fRegistry.fill(HIST("DiphotonHadron/same/hs"), v12.M(), v12.Pt(), deta, dphi); npair++; - std::pair pair_tmp_ref = std::make_pair(ndf, track.globalIndex()); - if (std::find(used_refTrackIds.begin(), used_refTrackIds.end(), pair_tmp_ref) == used_refTrackIds.end()) { // add a ref track in mixing pool - emh_ref->AddTrackToEventPool(key_df_collision, EMTrack(ndf, track.globalIndex(), collision.globalIndex(), track.globalIndex(), track.pt(), track.eta(), track.phi(), 0.139)); - used_refTrackIds.emplace_back(pair_tmp_ref); - } } } // end of ref track loop @@ -671,7 +660,7 @@ struct DiphotonHadronMPC { } fRegistry.fill(HIST("Diphoton/same/hs"), veeg.M(), veeg.Pt()); - int npair = 0; + int npair = 0; // the number of diphoton-h pairs for (const auto& track : refTracks_per_collision) { if (pos1.trackId() == track.trackId() || ele1.trackId() == track.trackId()) { continue; @@ -688,11 +677,6 @@ struct DiphotonHadronMPC { fRegistry.fill(HIST("DiphotonHadron/same/hs"), veeg.M(), veeg.Pt(), deta, dphi); npair++; - std::pair pair_tmp_ref = std::make_pair(ndf, track.globalIndex()); - if (std::find(used_refTrackIds.begin(), used_refTrackIds.end(), pair_tmp_ref) == used_refTrackIds.end()) { // add a ref track in mixing pool - emh_ref->AddTrackToEventPool(key_df_collision, EMTrack(ndf, track.globalIndex(), collision.globalIndex(), track.globalIndex(), track.pt(), track.eta(), track.phi(), 0.139)); - used_refTrackIds.emplace_back(pair_tmp_ref); - } } // end of ref track loop if (npair > 0) { @@ -719,6 +703,20 @@ struct DiphotonHadronMPC { } // end of pairing in same event if (ndiphoton > 0) { + emh_ref->ReserveNTracksPerCollision(key_df_collision, refTracks_per_collision.size()); + for (const auto& track : refTracks_per_collision) { + if (fEMTrackCut.IsSelected(track)) { + fRegistry.fill(HIST("Hadron/hs"), track.pt(), track.eta(), track.phi()); + fRegistry.fill(HIST("Hadron/hTrackBit"), track.trackBit()); + + std::pair pair_tmp_ref = std::make_pair(ndf, track.globalIndex()); + if (std::find(used_refTrackIds.begin(), used_refTrackIds.end(), pair_tmp_ref) == used_refTrackIds.end()) { // add a ref track in mixing pool + emh_ref->AddTrackToEventPool(key_df_collision, EMTrack(ndf, track.globalIndex(), collision.globalIndex(), track.globalIndex(), track.pt(), track.eta(), track.phi(), 0.139)); + used_refTrackIds.emplace_back(pair_tmp_ref); + } + } + } + for (const auto& [ref1, ref2] : combinations(CombinationsStrictlyUpperIndexPolicy(refTracks_per_collision, refTracks_per_collision))) { if (fEMTrackCut.IsSelected(ref1) && fEMTrackCut.IsSelected(ref2)) { float deta = ref1.eta() - ref2.eta(); From 54cb6d5da35899696f79e71c48bab086bfa8d0fe Mon Sep 17 00:00:00 2001 From: JimunLee Date: Thu, 14 Aug 2025 14:39:02 +0900 Subject: [PATCH 052/986] [PWGLF] Added the data && the MC(Gen) of kstarInOO.cxx (#12540) Co-authored-by: jimun_lee --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 321 +++++++++++++++++++++++---- 1 file changed, 279 insertions(+), 42 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 47259ec84ed..d17c9e87110 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -70,7 +70,6 @@ struct kstarInOO { // Event Selection Configurable cfgEventVtxCut{"cfgEventVtxCut", 10.0, "V_z cut selection"}; - ConfigurableAxis cfgCentAxis{"cfgCentAxis", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"}; // Track Selection @@ -81,6 +80,7 @@ struct kstarInOO { Configurable cfgTrackMaxDCAzToPVcut{"cfgTrackMaxDCAzToPVcut", 2.0, "Track DCAz cut to PV Maximum"}; Configurable cfgTrackPrimaryTrack{"cfgTrackPrimaryTrack", true, "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz Configurable cfgTrackConnectedToPV{"cfgTrackConnectedToPV", true, "PV contributor track selection"}; // PV Contriuibutor + Configurable cfgGlobalTrack{"cfgGlobalTrack", false, "Global track selection"}; // kGoldenChi2 | kDCAxy | kDCAz Configurable cfgTrackGlobalWoDCATrack{"cfgTrackGlobalWoDCATrack", true, "Global track selection without DCA"}; // kQualityTracks (kTrackType | kTPCNCls | kTPCCrossedRows | kTPCCrossedRowsOverNCls | kTPCChi2NDF | kTPCRefit | kITSNCls | kITSChi2NDF | kITSRefit | kITSHits) | kInAcceptanceTracks (kPtRange | kEtaRange) // TPC Configurable cfgTracknFindableTPCClusters{"cfgTrackFindableTPCClusters", 50, "nFindable TPC Clusters"}; @@ -88,7 +88,7 @@ struct kstarInOO { Configurable cfgTracknRowsOverFindable{"cfgTrackRowsOverFindable", 1.2, "nRowsOverFindable TPC CLusters"}; Configurable cfgTracknTPCChi2{"cfgTrackTPCChi2", 4.0, "nTPC Chi2 per Cluster"}; - // IT + // ITS Configurable cfgTracknITSChi2{"cfgTrackITSChi2", 36.0, "nITS Chi2 per Cluster"}; // PID @@ -103,6 +103,12 @@ struct kstarInOO { ConfigurableAxis cfgBinsMixVtx{"cfgBinsMixVtx", {VARIABLE_WIDTH, -10.0f, -5.f, 0.f, 5.f, 10.f}, "Mixing bins - z-vertex"}; Configurable cfgMixNMixedEvents{"cfgMixNMixedEvents", 10, "Number of mixed events per event"}; + // MCGen + Configurable cfgForceGenReco{"cfgForceGenReco", false, "Only consider events which are reconstructed (neglect event-loss)"}; + // Configurable cfgForceBR{"cfgForceBR", false, "Only consider K*0->K(pm)pi(mp)"}; + // Configurable cfgForceKaonAcceptence{"cfgForceKaonAcceptence", false, "Only consider K*0's whose daughters decay inside acceptence (no signal loss)"}; + // Configurable cfgForcePionAcceptence{"cfgForcePionAcceptence", false, "Only consider K*0's whose daughters decay inside acceptence (no signal loss)"}; + // Pair Configurable cfgMinvNBins{"cfgMinvNBins", 300, "Number of bins for Minv axis"}; Configurable cfgMinvMin{"cfgMinvMin", 0.60, "Minimum Minv value"}; @@ -111,8 +117,8 @@ struct kstarInOO { // Histogram Configurable cfgEventCutQA{"cfgEventCutsQA", false, "Enable Event QA Hists"}; Configurable cfgTrackCutQA{"cfgTrackCutQA", false, "Enable Track QA Hists"}; - - // std::vector eventSelectionBits; + Configurable cfgDataHistos{"cfgDataHistos", false, "Enable Data Hists"}; + Configurable cfgMcHistos{"cfgMcHistos", false, "Enable MC Hists"}; void init(o2::framework::InitContext&) { @@ -129,9 +135,6 @@ struct kstarInOO { } if (cfgTrackCutQA) { - // histos.add("h_rawpT", "h_rawpT", kTH1F, {{1000, 0.0, 10.0}}); - // histos.add("h_rawpT_Kaon", "h_rawpT_Kaon", kTH1F, {{1000, 0.0, 10.0}}); - // histos.add("h_rawpT_Pion", "h_rawpT_Pion", kTH1F, {{1000, 0.0, 10.0}}); // histos.add("h_eta", "h_eta", kTH1F, {axisEta}); // histos.add("h_phi", "h_phi", kTH1F, {axisPhi}); @@ -152,23 +155,34 @@ struct kstarInOO { histos.add("QA_kaon_TPC_TOF_AC", "QA_kaon_TPC_TOF_AC", {HistType::kTH2F, {pidAxis, pidAxis}}); } - // MC histos - histos.add("hMC_USS", "hMC_USS", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_LSS", "hMC_LSS", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_USS_Mix", "hMC_USS_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_LSS_Mix", "hMC_LSS_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + if (cfgDataHistos) { + histos.add("nEvents", "nEvents", kTH1F, {{4, 0.0, 4.0}}); + histos.add("nEvents_Mix", "nEvents_Mix", kTH1F, {{4, 0.0, 4.0}}); - // histos.add("hMC_pt_Pion", "hMC_pt_Pion", kTH1F, {ptAxis}); - // histos.add("hMC_pt_Kaon", "hMC_pt_Kaon", kTH1F, {ptAxis}); - // histos.add("hMC_pt_Proton", "hMC_pt_Proton", kTH1F, {ptAxis}); + histos.add("hUSS", "hUSS", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hLSS", "hLSS", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hUSS_Mix", "hUSS_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hLSS_Mix", "hLSS_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + } - // Event Histograms - histos.add("nEvents_MC", "nEvents_MC", kTH1F, {{4, 0.0, 4.0}}); - histos.add("nEvents_MC_Mix", "nEvents_MC_Mix", kTH1F, {{4, 0.0, 4.0}}); + if (cfgMcHistos) { + histos.add("nEvents_MC", "nEvents_MC", kTH1F, {{4, 0.0, 4.0}}); + histos.add("nEvents_MC_Mix", "nEvents_MC_Mix", kTH1F, {{4, 0.0, 4.0}}); + histos.add("nEvents_MC_True", "nEvents_MC_True", kTH1F, {{4, 0.0, 4.0}}); + + histos.add("hMC_USS", "hMC_USS", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_LSS", "hMC_LSS", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_USS_Mix", "hMC_USS_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_LSS_Mix", "hMC_LSS_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_USS_True", "hMC_USS_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_kstar_True", "hMC_kstar_True", kTHnSparseF, {cfgCentAxis, ptAxis}); + } } // end of init using EventCandidates = soa::Join; //, aod::CentFT0Ms, aod::CentFT0As + using EventCandidatesTrue = aod::McCollisions; + using TrackCandidates = soa::Join; using TrackCandidatesMC = soa::Join; + Partition kaon = !cfgTrackTPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfgTrackTPCPIDnSig); + Partition pion = !cfgTrackTPCPID || (nabs(aod::pidtpc::tpcNSigmaPi) <= cfgTrackTPCPIDnSig); + Partition kaonMC = !cfgTrackTPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfgTrackTPCPIDnSig); Partition pionMC = !cfgTrackTPCPID || (nabs(aod::pidtpc::tpcNSigmaPi) <= cfgTrackTPCPIDnSig); @@ -224,6 +241,9 @@ struct kstarInOO { if (std::abs(track.eta()) > cfgTrackMaxEta) return false; + if (cfgGlobalTrack && !track.isGlobalTrack()) + return false; + if (std::abs(track.dcaXY()) > cfgTrackMaxDCArToPVcut) return false; @@ -324,6 +344,43 @@ struct kstarInOO { return false; } + template + void TrackSlicing(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool IsMix) + { + auto tracks1 = kaon->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); + auto tracks2 = pion->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); + auto centrality = collision1.centFT0C(); + + for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { + + if (!trackSelection(trk1) || !trackSelection(trk2)) + continue; + if (!trackPIDKaon(trk1) || !trackPIDPion(trk2)) + continue; + + auto [KstarPt, Minv] = minvReconstruction(trk1, trk2); + if (Minv < 0) + continue; + + double conjugate = trk1.sign() * trk2.sign(); + if (cfgDataHistos) { + if (!IsMix) { + if (conjugate < 0) { + histos.fill(HIST("hUSS"), centrality, KstarPt, Minv); + } else if (conjugate > 0) { + histos.fill(HIST("hLSS"), centrality, KstarPt, Minv); + } + } else { + if (conjugate < 0) { + histos.fill(HIST("hUSS_Mix"), centrality, KstarPt, Minv); + } else if (conjugate > 0) { + histos.fill(HIST("hLSS_Mix"), centrality, KstarPt, Minv); + } + } + } // cfgDataHistos + } // for + } // TrackSlicing + template void TrackSlicingMC(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool IsMix) { @@ -343,21 +400,66 @@ struct kstarInOO { continue; double conjugate = trk1.sign() * trk2.sign(); - if (!IsMix) { - if (conjugate < 0) { - histos.fill(HIST("hMC_USS"), centrality, KstarPt, Minv); - } else if (conjugate > 0) { - histos.fill(HIST("hMC_LSS"), centrality, KstarPt, Minv); - } - } else { - if (conjugate < 0) { - histos.fill(HIST("hMC_USS_Mix"), centrality, KstarPt, Minv); - } else if (conjugate > 0) { - histos.fill(HIST("hMC_LSS_Mix"), centrality, KstarPt, Minv); + if (cfgMcHistos) { + if (!IsMix) { + if (conjugate < 0) { + histos.fill(HIST("hMC_USS"), centrality, KstarPt, Minv); + } else if (conjugate > 0) { + histos.fill(HIST("hMC_LSS"), centrality, KstarPt, Minv); + } + } else { + if (conjugate < 0) { + histos.fill(HIST("hMC_USS_Mix"), centrality, KstarPt, Minv); + } else if (conjugate > 0) { + histos.fill(HIST("hMC_LSS_Mix"), centrality, KstarPt, Minv); + } } + } // cfgMcHistos + + //====================== + // Gen MC + if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) + continue; + auto particle1 = trk1.mcParticle(); + auto particle2 = trk2.mcParticle(); + if (std::fabs(particle1.pdgCode()) != 321) + continue; // Not Kaon + if (std::fabs(particle2.pdgCode()) != 211) + continue; // Not Pion + + if (!particle1.has_mothers()) { + continue; } - } - } + if (!particle2.has_mothers()) + continue; + + std::vector mothers1{}; + std::vector mothers1PDG{}; + for (auto& particle1_mom : particle1.template mothers_as()) { + mothers1.push_back(particle1_mom.globalIndex()); + mothers1PDG.push_back(particle1_mom.pdgCode()); + } + + std::vector mothers2{}; + std::vector mothers2PDG{}; + for (auto& particle2_mom : particle2.template mothers_as()) { + mothers2.push_back(particle2_mom.globalIndex()); + mothers2PDG.push_back(particle2_mom.pdgCode()); + } + + if (mothers1PDG[0] != 313) + continue; // mother not K*0 + if (mothers2PDG[0] != 313) + continue; // mothers not K*0 + + if (mothers1[0] != mothers2[0]) + continue; // Kaon and pion not from the same K*0 + + if (cfgMcHistos) { + histos.fill(HIST("hMC_USS_True"), centrality, KstarPt, Minv); + } + } // for + } // TrackSlicingMC template std::pair minvReconstruction(const TracksType& trk1, const TracksType& trk2) @@ -384,6 +486,82 @@ struct kstarInOO { return {lResonance.Pt(), lResonance.M()}; } + //======================================================= + //| + //| DATA STUFF (SE) + //| + //======================================================= + + int nEvents = 0; + void processDataSameEvent(EventCandidates::iterator const& collision, TrackCandidates const& tracks) + { + if (cDebugLevel > 0) { + nEvents++; + if ((nEvents + 1) % 10000 == 0) { + std::cout << "Processed Data Events: " << nEvents << std::endl; + } + } + + auto goodEv = eventSelection(collision); + if (cfgDataHistos) { + histos.fill(HIST("nEvents"), 0.5); + } + if (!goodEv) + return; + + bool INELgt0 = false; + for (const auto& track : tracks) { + if (std::fabs(track.eta()) < cfgTrackMaxEta) { + INELgt0 = true; + break; + } + } + if (!INELgt0) + return; + if (cfgDataHistos) { + histos.fill(HIST("nEvents"), 1.5); + } + TrackSlicing(collision, tracks, collision, tracks, false); + + } // processSameEvents + PROCESS_SWITCH(kstarInOO, processDataSameEvent, "process Data Same Event", false); + + //======================================================= + //| + //| DATA STUFF (ME) + //| + //======================================================= + + int nEventsMix = 0; + void processDataMixedEvent(EventCandidates const& collisions, TrackCandidates const& tracks) + { + auto tracksTuple = std::make_tuple(tracks); + BinningType colBinning{{cfgBinsMixVtx, cfgBinsMixMult}, true}; // true is for 'ignore overflows' (true by default) + SameKindPair pairs{colBinning, cfgMixNMixedEvents, -1, collisions, tracksTuple, &cache}; + for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { + if (cDebugLevel > 0) { + nEventsMix++; + if ((nEventsMix + 1) % 10000 == 0) { + std::cout << "Processed DATA Mixed Events : " << nEventsMix << std::endl; + } + } + auto goodEv1 = eventSelection(collision1); + auto goodEv2 = eventSelection(collision2); + if (cfgDataHistos) { + histos.fill(HIST("nEvents_Mix"), 0.5); + } + + if (!goodEv1 || !goodEv2) + continue; + + if (cfgDataHistos) { + histos.fill(HIST("nEvents_Mix"), 1.5); + } + TrackSlicing(collision1, tracks1, collision2, tracks2, true); + } + } + PROCESS_SWITCH(kstarInOO, processDataMixedEvent, "process DATA Mixed Event", false); + //======================================================= //| //| MC STUFF (SE) @@ -391,19 +569,21 @@ struct kstarInOO { //======================================================= int nEventsMC = 0; - void processSameEventMC(EventCandidates::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const&) + void processMCSameEvent(EventCandidates::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const&) { if (cDebugLevel > 0) { nEventsMC++; if ((nEventsMC + 1) % 10000 == 0) { double histmem = histos.getSize(); std::cout << histmem << std::endl; - std::cout << "process_SameEvent_MC: " << nEventsMC << std::endl; + std::cout << "process MC Same Event : " << nEventsMC << std::endl; } } auto goodEv = eventSelection(collision); - histos.fill(HIST("nEvents_MC"), 0.5); + if (cfgMcHistos) { + histos.fill(HIST("nEvents_MC"), 0.5); + } if (!goodEv) return; @@ -417,11 +597,13 @@ struct kstarInOO { if (!INELgt0) return; - histos.fill(HIST("nEvents_MC"), 1.5); + if (cfgMcHistos) { + histos.fill(HIST("nEvents_MC"), 1.5); + } TrackSlicingMC(collision, tracks, collision, tracks, false); } // processSameEvents_MC - PROCESS_SWITCH(kstarInOO, processSameEventMC, "process Same Event MC", true); + PROCESS_SWITCH(kstarInOO, processMCSameEvent, "process MC Same Event", false); //======================================================= //| @@ -430,7 +612,7 @@ struct kstarInOO { //======================================================= int nEventsMCMix = 0; - void processMixedEventMC(EventCandidates const& collisions, TrackCandidatesMC const& tracks, aod::McParticles const&) + void processMCMixedEvent(EventCandidates const& collisions, TrackCandidatesMC const& tracks, aod::McParticles const&) { auto tracksTuple = std::make_tuple(tracks); BinningType colBinning{{cfgBinsMixVtx, cfgBinsMixMult}, true}; // true is for 'ignore overflows' (true by default) @@ -439,22 +621,77 @@ struct kstarInOO { if (cDebugLevel > 0) { nEventsMCMix++; if ((nEventsMCMix + 1) % 10000 == 0) { - std::cout << "Processed Mixed Events: " << nEventsMCMix << std::endl; + std::cout << "Processed MC Mixed Events : " << nEventsMCMix << std::endl; } } auto goodEv1 = eventSelection(collision1); auto goodEv2 = eventSelection(collision2); - histos.fill(HIST("nEvents_MC_Mix"), 0.5); + if (cfgMcHistos) { + histos.fill(HIST("nEvents_MC_Mix"), 0.5); + } if (!goodEv1 || !goodEv2) continue; - histos.fill(HIST("nEvents_MC_Mix"), 1.5); - + if (cfgMcHistos) { + histos.fill(HIST("nEvents_MC_Mix"), 1.5); + } TrackSlicingMC(collision1, tracks1, collision2, tracks2, true); } // mixing } // processMixedEvent_MC - PROCESS_SWITCH(kstarInOO, processMixedEventMC, "process Mixed Event MC", false); + PROCESS_SWITCH(kstarInOO, processMCMixedEvent, "process MC Mixed Event", false); + + //======================================================= + //| + //| GENERATED MC STUFF (TRUE) + //| + //======================================================= + + int nEventsTrue = 0; + void processMCTrue(EventCandidatesTrue::iterator const& collision, soa::SmallGroups> const& recocolls, aod::McParticles const& particles) + { + if (cDebugLevel > 0) { + ++nEventsTrue; + if ((nEventsTrue & 10000) == 0) { + std::cout << "Processed MC True Events : " << nEventsTrue << std::endl; + } + } + + if (fabs(collision.posZ()) > cfgEventVtxCut) + return; + + if (recocolls.size() <= 0) { // not reconstructed + if (cfgForceGenReco) { + return; + } + } + + double centrality = -1; + for (auto& recocoll : recocolls) { + centrality = recocoll.centFT0C(); + auto goodEv = eventSelection(recocoll); + + if (cfgMcHistos) { + histos.fill(HIST("nEvents_MC_True"), 0.5); + } + if (!goodEv) + continue; + } // for + + for (auto& particle : particles) { + if (particle.pdgCode() != 313) + continue; // Not K*0 + if (std::fabs(particle.eta()) > cfgTrackMaxEta) + continue; + + if (cfgMcHistos) { + histos.fill(HIST("hMC_kstar_True"), centrality, particle.pt()); + } + + } // loop over particles + + } // processMCTrue + PROCESS_SWITCH(kstarInOO, processMCTrue, "process MC True", false); void processEventsDummy(EventCandidates::iterator const&, TrackCandidates const&) { From 8c8de7ffae5522c4af9e7296c1cadbeea1d2d0c1 Mon Sep 17 00:00:00 2001 From: Jonghan Park <40240384+jpxrk@users.noreply.github.com> Date: Thu, 14 Aug 2025 16:06:13 +0900 Subject: [PATCH 053/986] [PWGHF] taskSingleElectron: Fix enumerator names. (#12557) --- PWGHF/HFL/Tasks/taskSingleElectron.cxx | 160 ++++++++++++------------- 1 file changed, 80 insertions(+), 80 deletions(-) diff --git a/PWGHF/HFL/Tasks/taskSingleElectron.cxx b/PWGHF/HFL/Tasks/taskSingleElectron.cxx index 76998fdf90f..f57f5f1675a 100644 --- a/PWGHF/HFL/Tasks/taskSingleElectron.cxx +++ b/PWGHF/HFL/Tasks/taskSingleElectron.cxx @@ -38,34 +38,34 @@ enum PdgCode { }; enum SourceType { - fNotElec = 0, // not electron - fDirectCharm = 1, // electrons from prompt charm hadrons - fDirectBeauty = 2, // electrons from primary beauty hadrons - fBeautyCharm = 3, // electrons from non-prompt charm hadrons - fDirectGamma = 4, // electrons from direct photon - fGammaPi0 = 5, - fGammaEta = 6, - fGammaOmega = 7, - fGammaPhi = 8, - fGammaEtaPrime = 9, - fGammaRho0 = 10, - fGammaK0s = 11, - fGammaK0l = 12, - fGammaKe3 = 13, - fGammaLambda0 = 14, - fGammaSigma = 15, - fPi0 = 16, - fEta = 17, - fOmega = 18, - fPhi = 19, - fEtaPrime = 20, - fRho0 = 21, - fK0s = 22, - fK0l = 23, - fKe3 = 24, - fLambda0 = 25, - fSigma = 26, - fElse = 27 + NotElec = 0, // not electron + DirectCharm = 1, // electrons from prompt charm hadrons + DirectBeauty = 2, // electrons from primary beauty hadrons + BeautyCharm = 3, // electrons from non-prompt charm hadrons + DirectGamma = 4, // electrons from direct photon + GammaPi0 = 5, + GammaEta = 6, + GammaOmega = 7, + GammaPhi = 8, + GammaEtaPrime = 9, + GammaRho0 = 10, + GammaK0s = 11, + GammaK0l = 12, + GammaKe3 = 13, + GammaLambda0 = 14, + GammaSigma = 15, + Pi0 = 16, + Eta = 17, + Omega = 18, + Phi = 19, + EtaPrime = 20, + Rho0 = 21, + K0s = 22, + K0l = 23, + Ke3 = 24, + Lambda0 = 25, + Sigma = 26, + Else = 27 }; struct HfTaskSingleElectron { @@ -194,7 +194,7 @@ struct HfTaskSingleElectron { { auto mcpart = track.mcParticle(); if (std::abs(mcpart.pdgCode()) != kElectron) { - return fNotElec; + return NotElec; } int motherPdg = -999; @@ -223,27 +223,27 @@ struct HfTaskSingleElectron { auto const& grmothersIdsVec = mctrack.front().mothersIds(); if (grmothersIdsVec.empty()) { - return fDirectCharm; + return DirectCharm; } else { grmotherPt = mctrack.front().pt(); grmotherPdg = std::abs(mctrack.front().pdgCode()); if ((static_cast(grmotherPdg / 100.) % 10) == kBottom || (static_cast(grmotherPdg / 1000.) % 10) == kBottom) { mpt = grmotherPt; mpdg = grmotherPdg; - return fBeautyCharm; + return BeautyCharm; } } } partMother = mctrack; } } else if ((static_cast(motherPdg / 100.) % 10) == kBottom || (static_cast(motherPdg / 1000.) % 10) == kBottom) { // check if electron from beauty hadrons - return fDirectBeauty; + return DirectBeauty; } else if (motherPdg == kGamma) { // check if electron from photon conversion mctrack = partMother.front().template mothers_as(); if (mctrack.size()) { auto const& grmothersIdsVec = mctrack.front().mothersIds(); if (grmothersIdsVec.empty()) { - return fDirectGamma; + return DirectGamma; } else { grmotherPdg = std::abs(mctrack.front().pdgCode()); mpdg = grmotherPdg; @@ -255,19 +255,19 @@ struct HfTaskSingleElectron { auto const& ggrmothersIdsVec = mctrack.front().mothersIds(); if (ggrmothersIdsVec.empty()) { if (grmotherPdg == kPi0) { - return fGammaPi0; + return GammaPi0; } else if (grmotherPdg == kEta) { - return fGammaEta; + return GammaEta; } else if (grmotherPdg == kOmega) { - return fGammaOmega; + return GammaOmega; } else if (grmotherPdg == kPhi) { - return fGammaPhi; + return GammaPhi; } else if (grmotherPdg == kEtaPrime) { - return fGammaEtaPrime; + return GammaEtaPrime; } else if (grmotherPdg == kRho770_0) { - return fGammaRho0; + return GammaRho0; } else { - return fElse; + return Else; } } else { ggrmotherPdg = mctrack.front().pdgCode(); @@ -276,42 +276,42 @@ struct HfTaskSingleElectron { mpt = ggrmotherPt; if (grmotherPdg == kPi0) { if (ggrmotherPdg == kK0Short) { - return fGammaK0s; + return GammaK0s; } else if (ggrmotherPdg == kK0Long) { - return fGammaK0l; + return GammaK0l; } else if (ggrmotherPdg == kKPlus) { - return fGammaKe3; + return GammaKe3; } else if (ggrmotherPdg == kLambda0) { - return fGammaLambda0; + return GammaLambda0; } else if (ggrmotherPdg == kSigmaPlus) { - return fGammaSigma; + return GammaSigma; } else { mpdg = grmotherPdg; mpt = grmotherPt; - return fGammaPi0; + return GammaPi0; } } else if (grmotherPdg == kEta) { mpdg = grmotherPdg; mpt = grmotherPt; - return fGammaEta; + return GammaEta; } else if (grmotherPdg == kOmega) { mpdg = grmotherPdg; mpt = grmotherPt; - return fGammaOmega; + return GammaOmega; } else if (grmotherPdg == kPhi) { mpdg = grmotherPdg; mpt = grmotherPt; - return fGammaPhi; + return GammaPhi; } else if (grmotherPdg == kEtaPrime) { mpdg = grmotherPdg; mpt = grmotherPt; - return fGammaEtaPrime; + return GammaEtaPrime; } else if (grmotherPdg == kRho770_0) { mpdg = grmotherPdg; mpt = grmotherPt; - return fGammaRho0; + return GammaRho0; } else { - return fElse; + return Else; } } } @@ -323,20 +323,20 @@ struct HfTaskSingleElectron { auto const& grmothersIdsVec = mctrack.front().mothersIds(); if (grmothersIdsVec.empty()) { static const std::map pdgToSource = { - {kPi0, fPi0}, - {kEta, fEta}, - {kOmega, fOmega}, - {kPhi, fPhi}, - {kEtaPrime, fEtaPrime}, - {kRho770_0, fRho0}, - {kKPlus, fKe3}, - {kK0Long, fK0l}}; + {kPi0, Pi0}, + {kEta, Eta}, + {kOmega, Omega}, + {kPhi, Phi}, + {kEtaPrime, EtaPrime}, + {kRho770_0, Rho0}, + {kKPlus, Ke3}, + {kK0Long, K0l}}; auto it = pdgToSource.find(motherPdg); if (it != pdgToSource.end()) { return it->second; } - return fElse; + return Else; } else { if (motherPdg == kPi0) { @@ -345,42 +345,42 @@ struct HfTaskSingleElectron { mpt = grmotherPt; mpdg = grmotherPdg; if (grmotherPdg == kK0Short) { - return fK0s; + return K0s; } else if (grmotherPdg == kK0Long) { - return fK0l; + return K0l; } else if (grmotherPdg == kKPlus) { - return fKe3; + return Ke3; } else if (grmotherPdg == kLambda0) { - return fLambda0; + return Lambda0; } else if (grmotherPdg == kSigmaPlus) { - return fSigma; + return Sigma; } else { mpt = motherPt; mpdg = motherPdg; - return fPi0; + return Pi0; } } else if (motherPdg == kEta) { - return fEta; + return Eta; } else if (motherPdg == kOmega) { - return fOmega; + return Omega; } else if (motherPdg == kPhi) { - return fPhi; + return Phi; } else if (motherPdg == kEtaPrime) { - return fEtaPrime; + return EtaPrime; } else if (motherPdg == kRho770_0) { - return fRho0; + return Rho0; } else if (motherPdg == kKPlus) { - return fKe3; + return Ke3; } else if (motherPdg == kK0Long) { - return fK0l; + return K0l; } else { - return fElse; + return Else; } } } } - return fElse; + return Else; } void processData(soa::Filtered::iterator const& collision, @@ -474,22 +474,22 @@ struct HfTaskSingleElectron { double mpt; // electron source pt int source = getElecSource(track, mpt, mpdg); - if (source == fDirectBeauty || source == fBeautyCharm) { + if (source == DirectBeauty || source == BeautyCharm) { histos.fill(HIST("hPdgB"), mpdg); histos.fill(HIST("dcaBeauty"), track.pt(), track.dcaXY()); } - if (source == fDirectCharm) { + if (source == DirectCharm) { histos.fill(HIST("hPdgC"), mpdg); histos.fill(HIST("dcaCharm"), track.pt(), track.dcaXY()); } - if (source >= fGammaPi0 && source <= fGammaSigma) { + if (source >= GammaPi0 && source <= GammaSigma) { histos.fill(HIST("hPdgCo"), mpdg); histos.fill(HIST("dcaConv"), track.pt(), track.dcaXY()); } - if (source >= fPi0 && source <= fSigma) { + if (source >= Pi0 && source <= Sigma) { histos.fill(HIST("hPdgDa"), mpdg); histos.fill(HIST("dcaDalitz"), track.pt(), track.dcaXY()); } From f7e9d3b57e0e40b4116b9a9d9a127b6d68e73174 Mon Sep 17 00:00:00 2001 From: yuanzhe <90246048+wang-yuanzhe@users.noreply.github.com> Date: Thu, 14 Aug 2025 11:46:14 +0200 Subject: [PATCH 054/986] [PWGLF] Avoid initialize unused parameters while running over reduced hypertrition 3body candidates (#12571) --- PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx b/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx index 7757cbc72a1..bcd914b3df3 100644 --- a/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx +++ b/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx @@ -284,9 +284,11 @@ struct decay3bodyBuilder { ccdb->setFatalWhenNull(false); // TOF PID parameters initialization - mTOFCalibConfig.metadataInfo = metadataInfo; - mTOFCalibConfig.inheritFromBaseTask(initContext); - mTOFCalibConfig.initSetup(mRespParamsV3, ccdb); + if (doprocessRealData == true || doprocessMonteCarlo == true) { + mTOFCalibConfig.metadataInfo = metadataInfo; + mTOFCalibConfig.inheritFromBaseTask(initContext); + mTOFCalibConfig.initSetup(mRespParamsV3, ccdb); + } // Set material correction if (useMatCorrType == 1) { From b246336045d1229f8ceda513afc0d3d1114b02c8 Mon Sep 17 00:00:00 2001 From: Shirajum Monira <38348689+Eloviyo@users.noreply.github.com> Date: Thu, 14 Aug 2025 11:53:42 +0200 Subject: [PATCH 055/986] [PWGCF] FemtoUniverse cascade task -- added track-cascade CPR option (#12567) Co-authored-by: Shirajum Monira --- .../Core/FemtoUniverseDetaDphiStar.h | 56 ++++++++++++++++++- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h index 1e336f20abd..5ab5c65c0a5 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h @@ -125,6 +125,21 @@ class FemtoUniverseDetaDphiStar } } } + if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kCascade) { + /// Track-Xi and Track-Omega combination + for (int k = 0; k < 3; k++) { + std::string dirName = static_cast(DirNames[6]); + histdetadpisame[k][0] = mHistogramRegistry->add((dirName + static_cast(HistNamesSame[0][k])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpisame[k][1] = mHistogramRegistry->add((dirName + static_cast(HistNamesSame[1][k])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpimixed[k][0] = mHistogramRegistry->add((dirName + static_cast(HistNamesMixed[0][k])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpimixed[k][1] = mHistogramRegistry->add((dirName + static_cast(HistNamesMixed[1][k])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + if (plotForEveryRadii) { + for (int l = 0; l < 9; l++) { + histdetadpiRadii[k][l] = mHistogramRegistryQA->add((dirName + static_cast(HistNamesRadii[k][l])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + } + } + } + } if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kPhi) { for (int i = 0; i < 2; i++) { std::string dirName = static_cast(DirNames[3]); @@ -277,7 +292,7 @@ class FemtoUniverseDetaDphiStar bool pass = false; static constexpr int CascChildTable[][2] = {{-1, -1}, {-1, -2}, {-1, -3}, {-2, -2}, {-3, -3}, {-2, -1}, {-3, -1}}; - for (int i = 0; i < 5; i++) { + for (int i = 0; i < 7; i++) { auto indexOfDaughterpart1 = (ChosenEventType == femto_universe_container::EventType::mixed ? part1.globalIndex() : part1.index()) + CascChildTable[i][0]; auto indexOfDaughterpart2 = (ChosenEventType == femto_universe_container::EventType::mixed ? part2.globalIndex() : part2.index()) + CascChildTable[i][1]; auto daughterpart1 = particles.begin() + indexOfDaughterpart1; @@ -308,6 +323,43 @@ class FemtoUniverseDetaDphiStar } return pass; + } else if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kCascade) { + /// Track-Xi and Track-Omega combination + if (part1.partType() != o2::aod::femtouniverseparticle::ParticleType::kTrack || part2.partType() != o2::aod::femtouniverseparticle::ParticleType::kCascade) { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar instantiation! Please provide kTrack,kCascade candidates."; + return false; + } + + bool pass = false; + for (int i = 0; i < 3; i++) { + auto indexOfDaughter = (ChosenEventType == femto_universe_container::EventType::mixed ? part2.globalIndex() : part2.index()) - 3 + i; + auto daughter = particles.begin() + indexOfDaughter; + if (isSameSignCPR && (part1.mAntiLambda() != daughter.mAntiLambda())) // mAntiLambda() is used here as sign getter + continue; + auto deta = part1.eta() - daughter.eta(); + auto dphiAvg = averagePhiStar(*part1, *daughter, i); + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[i][0]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[i][0]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; + } + + if ((dphiAvg > cutDeltaPhiStarMin) && (dphiAvg < cutDeltaPhiStarMax) && (deta > cutDeltaEtaMin) && (deta < cutDeltaEtaMax)) { + pass = true; + } else { + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[i][1]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[i][1]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; + } + } + } + return pass; + } else if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kD0) { /// Track-D0 combination // check if provided particles are in agreement with the class instantiation @@ -534,7 +586,7 @@ class FemtoUniverseDetaDphiStar private: HistogramRegistry* mHistogramRegistry = nullptr; ///< For main output HistogramRegistry* mHistogramRegistryQA = nullptr; ///< For QA output - static constexpr std::string_view DirNames[6] = {"kTrack_kTrack/", "kTrack_kV0/", "kV0_kV0/", "kTrack_kPhi/", "kTrack_kD0/", "kCascade_kCascade/"}; + static constexpr std::string_view DirNames[7] = {"kTrack_kTrack/", "kTrack_kV0/", "kV0_kV0/", "kTrack_kPhi/", "kTrack_kD0/", "kCascade_kCascade/", "kTrack_kCascade/"}; static constexpr std::string_view HistNamesSame[2][8] = {{"detadphidetadphi0BeforeSame_0", "detadphidetadphi0BeforeSame_1", "detadphidetadphi0BeforeSame_2", "detadphidetadphi0BeforeSame_3", "detadphidetadphi0BeforeSame_4", "detadphidetadphi0BeforeSame_5", From 878fb4b2f5365f78db815d17117b6fa06c1f5927 Mon Sep 17 00:00:00 2001 From: Marcello Di Costanzo <96481191+Marcellocosti@users.noreply.github.com> Date: Thu, 14 Aug 2025 15:44:17 +0200 Subject: [PATCH 056/986] [PWGHF] Add D*pi channel in B0 reduced workflow (#12451) Co-authored-by: ALICE Action Bot --- PWGHF/Core/HfHelper.h | 11 + PWGHF/Core/HfMlResponseB0ToDPi.h | 96 ++- PWGHF/D2H/DataModel/ReducedDataModel.h | 83 ++- .../candidateCreatorB0Reduced.cxx | 306 +++++++-- .../candidateSelectorB0ToDPiReduced.cxx | 110 +++- .../dataCreatorCharmHadPiReduced.cxx | 37 +- PWGHF/D2H/Tasks/taskB0Reduced.cxx | 592 ++++++++++++++---- PWGHF/D2H/Utils/utilsRedDataFormat.h | 24 + .../DataModel/CandidateReconstructionTables.h | 45 +- .../candidateSelectorDstarToD0Pi.cxx | 1 - 10 files changed, 1086 insertions(+), 219 deletions(-) diff --git a/PWGHF/Core/HfHelper.h b/PWGHF/Core/HfHelper.h index 41239c48179..37798045914 100644 --- a/PWGHF/Core/HfHelper.h +++ b/PWGHF/Core/HfHelper.h @@ -33,6 +33,11 @@ #include #include +template +concept IsB0ToDstarPiChannel = requires(T candidate) { + candidate.prongD0Id(); +}; + class HfHelper { public: @@ -634,6 +639,12 @@ class HfHelper return candidate.m(std::array{o2::constants::physics::MassDMinus, o2::constants::physics::MassPiPlus}); } + template + auto invMassB0ToDPi(const T& candidate) + { + return candidate.m(std::array{o2::constants::physics::MassD0, o2::constants::physics::MassPiPlus, o2::constants::physics::MassPiPlus}); + } + template auto cosThetaStarB0(const T& candidate) { diff --git a/PWGHF/Core/HfMlResponseB0ToDPi.h b/PWGHF/Core/HfMlResponseB0ToDPi.h index 1f6d4940b7f..4874b56543b 100644 --- a/PWGHF/Core/HfMlResponseB0ToDPi.h +++ b/PWGHF/Core/HfMlResponseB0ToDPi.h @@ -75,9 +75,12 @@ namespace o2::analysis enum class InputFeaturesB0ToDPi : uint8_t { ptProng0 = 0, ptProng1, + ptProng2, impactParameter0, impactParameter1, + impactParameter2, impactParameterProduct, + impactParameterProngSqSum, chi2PCA, decayLength, decayLengthXY, @@ -91,7 +94,13 @@ enum class InputFeaturesB0ToDPi : uint8_t { prong0MlScoreNonprompt, tpcNSigmaPi1, tofNSigmaPi1, - tpcTofNSigmaPi1 + tpcTofNSigmaPi1, + tpcNSigmaPiBachPi, + tofNSigmaPiBachPi, + tpcTofNSigmaPiBachPi, + tpcNSigmaPiSoftPi, + tofNSigmaPiSoftPi, + tpcTofNSigmaPiSoftPi }; template @@ -109,7 +118,7 @@ class HfMlResponseB0ToDPi : public HfMlResponse /// \return inputFeatures vector template std::vector getInputFeatures(T1 const& candidate, - T2 const& prong1, + T2 const& prongBachPi, const std::vector* mlScoresD = nullptr) { std::vector inputFeatures; @@ -130,11 +139,77 @@ class HfMlResponseB0ToDPi : public HfMlResponse CHECK_AND_FILL_VEC_B0(cpaXY); CHECK_AND_FILL_VEC_B0(maxNormalisedDeltaIP); // TPC PID variable - CHECK_AND_FILL_VEC_B0_FULL(prong1, tpcNSigmaPi1, tpcNSigmaPi); + CHECK_AND_FILL_VEC_B0_FULL(prongBachPi, tpcNSigmaPi1, tpcNSigmaPi); // TOF PID variable - CHECK_AND_FILL_VEC_B0_FULL(prong1, tofNSigmaPi1, tofNSigmaPi); + CHECK_AND_FILL_VEC_B0_FULL(prongBachPi, tofNSigmaPi1, tofNSigmaPi); // Combined PID variables - CHECK_AND_FILL_VEC_B0_FUNC(prong1, tpcTofNSigmaPi1, o2::pid_tpc_tof_utils::getTpcTofNSigmaPi1); + CHECK_AND_FILL_VEC_B0_FUNC(prongBachPi, tpcTofNSigmaPi1, o2::pid_tpc_tof_utils::getTpcTofNSigmaPi1); + } + if constexpr (withDmesMl) { + if constexpr (reduced) { + switch (idx) { + CHECK_AND_FILL_VEC_B0(prong0MlScoreBkg); + CHECK_AND_FILL_VEC_B0(prong0MlScorePrompt); + CHECK_AND_FILL_VEC_B0(prong0MlScoreNonprompt); + } + } else { + if (mlScoresD) { + switch (idx) { + CHECK_AND_FILL_VEC_B0_INDEX(prong0MlScoreBkg, *mlScoresD, 0); + CHECK_AND_FILL_VEC_B0_INDEX(prong0MlScorePrompt, *mlScoresD, 1); + CHECK_AND_FILL_VEC_B0_INDEX(prong0MlScoreNonprompt, *mlScoresD, 2); + } + } else { + LOG(fatal) << "ML scores of D not provided"; + } + } + } + } + + return inputFeatures; + } + + /// Method to get the input features vector needed for ML inference + /// \param candidate is the B0 candidate + /// \param prongBachPi is the candidate's bachelor pion prong + /// \param prongSoftPi is the candidate's soft pion prong + /// \param mlScoresD is the vector of ML scores for the D meson (if available) + /// \note this method is used for B0 → D*∓ π± candidates with D meson ML scores + /// \return inputFeatures vector + template + std::vector getInputFeaturesDStarPi(T1 const& candidate, + T2 const& prongBachPi, + T3 const& prongSoftPi, + const std::vector* mlScoresD = nullptr) + { + std::vector inputFeatures; + + for (const auto& idx : MlResponse::mCachedIndices) { + switch (idx) { + CHECK_AND_FILL_VEC_B0(ptProng0); + CHECK_AND_FILL_VEC_B0(ptProng1); + CHECK_AND_FILL_VEC_B0(ptProng2); + CHECK_AND_FILL_VEC_B0(impactParameter0); + CHECK_AND_FILL_VEC_B0(impactParameter1); + CHECK_AND_FILL_VEC_B0(impactParameter2); + CHECK_AND_FILL_VEC_B0(impactParameterProngSqSum); + CHECK_AND_FILL_VEC_B0(chi2PCA); + CHECK_AND_FILL_VEC_B0(decayLength); + CHECK_AND_FILL_VEC_B0(decayLengthXY); + CHECK_AND_FILL_VEC_B0(decayLengthNormalised); + CHECK_AND_FILL_VEC_B0(decayLengthXYNormalised); + CHECK_AND_FILL_VEC_B0(cpa); + CHECK_AND_FILL_VEC_B0(cpaXY); + CHECK_AND_FILL_VEC_B0(maxNormalisedDeltaIP); + // TPC PID variable + CHECK_AND_FILL_VEC_B0_FULL(prongBachPi, tpcNSigmaPiBachPi, tpcNSigmaPi); + CHECK_AND_FILL_VEC_B0_FULL(prongSoftPi, tpcNSigmaPiSoftPi, tpcNSigmaPiSoftPi); + // TOF PID variable + CHECK_AND_FILL_VEC_B0_FULL(prongBachPi, tofNSigmaPiBachPi, tofNSigmaPi); + CHECK_AND_FILL_VEC_B0_FULL(prongSoftPi, tofNSigmaPiSoftPi, tofNSigmaPiSoftPi); + // Combined PID variables + CHECK_AND_FILL_VEC_B0_FUNC(prongBachPi, tpcTofNSigmaPiBachPi, o2::pid_tpc_tof_utils::getTpcTofNSigmaPi1); + CHECK_AND_FILL_VEC_B0_FUNC(prongSoftPi, tpcTofNSigmaPiSoftPi, o2::pid_tpc_tof_utils::getTpcTofNSigmaSoftPi); } if constexpr (withDmesMl) { if constexpr (reduced) { @@ -167,9 +242,12 @@ class HfMlResponseB0ToDPi : public HfMlResponse MlResponse::mAvailableInputFeatures = { FILL_MAP_B0(ptProng0), FILL_MAP_B0(ptProng1), + FILL_MAP_B0(ptProng2), FILL_MAP_B0(impactParameter0), FILL_MAP_B0(impactParameter1), + FILL_MAP_B0(impactParameter2), FILL_MAP_B0(impactParameterProduct), + FILL_MAP_B0(impactParameterProngSqSum), FILL_MAP_B0(chi2PCA), FILL_MAP_B0(decayLength), FILL_MAP_B0(decayLengthXY), @@ -183,10 +261,16 @@ class HfMlResponseB0ToDPi : public HfMlResponse FILL_MAP_B0(prong0MlScoreNonprompt), // TPC PID variable FILL_MAP_B0(tpcNSigmaPi1), + FILL_MAP_B0(tpcNSigmaPiSoftPi), + FILL_MAP_B0(tpcNSigmaPiBachPi), // TOF PID variable FILL_MAP_B0(tofNSigmaPi1), + FILL_MAP_B0(tofNSigmaPiSoftPi), + FILL_MAP_B0(tofNSigmaPiBachPi), // Combined PID variable - FILL_MAP_B0(tpcTofNSigmaPi1)}; + FILL_MAP_B0(tpcTofNSigmaPi1), + FILL_MAP_B0(tpcTofNSigmaPiSoftPi), + FILL_MAP_B0(tpcTofNSigmaPiBachPi)}; } }; diff --git a/PWGHF/D2H/DataModel/ReducedDataModel.h b/PWGHF/D2H/DataModel/ReducedDataModel.h index 06b219be522..c2a4d1858a3 100644 --- a/PWGHF/D2H/DataModel/ReducedDataModel.h +++ b/PWGHF/D2H/DataModel/ReducedDataModel.h @@ -293,24 +293,12 @@ DECLARE_SOA_TABLE(HfRedTracksCov, "AOD", "HFREDTRACKCOV", //! Table with track c HFTRACKPARCOV_COLUMNS, o2::soa::Marker<1>); -DECLARE_SOA_TABLE(HfRedSoftPiBases, "AOD", "HFREDSOFTPIBASE", //! Table with track information for reduced workflow - soa::Index<>, - hf_track_index_reduced::TrackId, - hf_track_index_reduced::HfRedCollisionId, - HFTRACKPAR_COLUMNS, - hf_track_vars_reduced::ItsNCls, - hf_track_vars_reduced::TpcNClsCrossedRows, - hf_track_vars_reduced::TpcChi2NCl, - aod::track::Px, - aod::track::Py, - aod::track::Pz, - aod::track::PVector, - o2::soa::Marker<2>); - -DECLARE_SOA_TABLE(HfRedSoftPiCov, "AOD", "HFREDSOFTPICOV", //! Table with track covariance information for reduced workflow +DECLARE_SOA_TABLE(HfRedTracksMom, "AOD", "HFREDTRACKMOM", //! Table with track momentum information for reduced workflow soa::Index<>, - HFTRACKPARCOV_COLUMNS, - o2::soa::Marker<2>); + hf_track_vars_reduced::Px, + hf_track_vars_reduced::Py, + hf_track_vars_reduced::Pz, + hf_track_vars_reduced::Sign); // CAREFUL: need to follow convention [Name = Description + 's'] in DECLARE_SOA_TABLE(Name, "AOD", Description) // to call DECLARE_SOA_INDEX_COLUMN_FULL later on @@ -546,6 +534,39 @@ DECLARE_SOA_TABLE(HfRed2ProngsMl, "AOD", "HFRED2PRONGML", //! Table with 2prong hf_charm_cand_reduced::MlScorePromptMassHypo1, hf_charm_cand_reduced::MlScoreNonpromptMassHypo1); +// CAREFUL: need to follow convention [Name = Description + 's'] in DECLARE_SOA_TABLE(Name, "AOD", Description) +// to call DECLARE_SOA_INDEX_COLUMN_FULL later on +DECLARE_SOA_TABLE(HfRedSoftPiBases, "AOD", "HFREDSOFTPIBASE", //! Table with track information for reduced workflow + soa::Index<>, + hf_track_index_reduced::TrackId, + hf_track_index_reduced::HfRedCollisionId, + HFTRACKPAR_COLUMNS, + hf_track_vars_reduced::ItsNCls, + hf_track_vars_reduced::TpcNClsCrossedRows, + hf_track_vars_reduced::TpcChi2NCl, + aod::track::Px, + aod::track::Py, + aod::track::Pz, + aod::track::PVector); + +DECLARE_SOA_TABLE(HfRedSoftPiCov, "AOD", "HFREDSOFTPICOV", //! Table with track covariance information for reduced workflow + soa::Index<>, + HFTRACKPARCOV_COLUMNS, + o2::soa::Marker<2>); + +DECLARE_SOA_TABLE(HfRedSoftPiPid, "AOD", "HFREDSOFTPIPID", + soa::Index<>, + hf_cand_dstar::TPCNSigmaPiSoftPi, + hf_cand_dstar::TOFNSigmaPiSoftPi, + hf_track_vars_reduced::HasTOF, + hf_track_vars_reduced::HasTPC, + hf_cand_dstar::TPCTOFNSigmaPiSoftPi) + +namespace hf_track_index_reduced +{ +DECLARE_SOA_INDEX_COLUMN_FULL(SoftPi, softPi, int, HfRedSoftPiBases, ""); //! ReducedCollision index +}; // namespace hf_track_index_reduced + // CAREFUL: need to follow convention [Name = Description + 's'] in DECLARE_SOA_TABLE(Name, "AOD", Description) // to call DECLARE_SOA_INDEX_COLUMN_FULL later on DECLARE_SOA_TABLE(HfRed3Prongs, "AOD", "HFRED3PRONG", //! Table with 3prong candidate information for reduced workflow @@ -583,6 +604,17 @@ DECLARE_SOA_TABLE_VERSIONED(HfRed3ProngsMl_001, "AOD", "HFRED3PRONGML", 1, //! T using HfRed3ProngsMl = HfRed3ProngsMl_001; +DECLARE_SOA_TABLE(HfRedMomDDaugs, "AOD", "HFREDMOMDDAUGS", //! Table with 2prong candidate ML scores + hf_cand::PxProng0, + hf_cand::PyProng0, + hf_cand::PzProng0, + hf_cand::PxProng1, + hf_cand::PyProng1, + hf_cand::PzProng1, + hf_cand::PxProng2, + hf_cand::PyProng2, + hf_cand::PzProng2); + // CAREFUL: need to follow convention [Name = Description + 's'] in DECLARE_SOA_TABLE(Name, "AOD", Description) // to call DECLARE_SOA_INDEX_COLUMN_FULL later on DECLARE_SOA_TABLE(HfRedJpsis, "AOD", "HFREDJPSI", //! Table with J/Psi candidate information for reduced workflow @@ -711,11 +743,15 @@ using HfRedPidDau2s = HfRedPidDau2s_001; using HfRedPidDau0 = HfRedPidDau0s::iterator; using HfRedPidDau1 = HfRedPidDau1s::iterator; using HfRedPidDau2 = HfRedPidDau2s::iterator; + // Beauty candidates prongs namespace hf_cand_b0_reduced { DECLARE_SOA_INDEX_COLUMN_FULL(Prong0, prong0, int, HfRed3Prongs, "_0"); //! Prong0 index DECLARE_SOA_INDEX_COLUMN_FULL(Prong1, prong1, int, HfRedTrackBases, "_1"); //! Prong1 index +DECLARE_SOA_INDEX_COLUMN_FULL(ProngD0, prongD0, int, HfRed2Prongs, "_0"); //! ProngD0 index +DECLARE_SOA_INDEX_COLUMN_FULL(ProngBachPi, prongBachPi, int, HfRedTrackBases, "_1"); //! ProngBachPi index +DECLARE_SOA_INDEX_COLUMN_FULL(ProngSoftPi, prongSoftPi, int, HfRedSoftPiBases, "_2"); //! ProngSoftPi index DECLARE_SOA_COLUMN(Prong0MlScoreBkg, prong0MlScoreBkg, float); //! Bkg ML score of the D daughter DECLARE_SOA_COLUMN(Prong0MlScorePrompt, prong0MlScorePrompt, float); //! Prompt ML score of the D daughter DECLARE_SOA_COLUMN(Prong0MlScoreNonprompt, prong0MlScoreNonprompt, float); //! Nonprompt ML score of the D daughter @@ -724,6 +760,9 @@ DECLARE_SOA_COLUMN(Prong0MlScoreNonprompt, prong0MlScoreNonprompt, float); //! N DECLARE_SOA_TABLE(HfRedB0Prongs, "AOD", "HFREDB0PRONG", //! Table with B0 daughter indices hf_cand_b0_reduced::Prong0Id, hf_cand_b0_reduced::Prong1Id); +DECLARE_SOA_TABLE(HfRedB0ProngDStars, "AOD", "HFREDB0PRONGDST", //! Table with B0 daughter indices + hf_cand_b0_reduced::ProngD0Id, hf_cand_b0_reduced::ProngBachPiId, hf_cand_b0_reduced::ProngSoftPiId); + DECLARE_SOA_TABLE(HfRedB0DpMls, "AOD", "HFREDB0DPML", //! Table with ML scores for the D+ daughter hf_cand_b0_reduced::Prong0MlScoreBkg, hf_cand_b0_reduced::Prong0MlScorePrompt, @@ -731,6 +770,7 @@ DECLARE_SOA_TABLE(HfRedB0DpMls, "AOD", "HFREDB0DPML", //! Table with ML scores f o2::soa::Marker<1>); using HfRedCandB0 = soa::Join; +using HfRedCandB0DStar = soa::Join; namespace hf_cand_bplus_reduced { @@ -848,6 +888,15 @@ DECLARE_SOA_TABLE(HfMcCheckDpPis, "AOD", "HFMCCHECKDPPI", //! Table with reconst hf_b0_mc::PdgCodeProng3, o2::soa::Marker<1>); +// table with results of reconstruction level MC matching +DECLARE_SOA_TABLE(HfMcRecRedDStarPis, "AOD", "HFMCRECREDDSTPI", //! Table with reconstructed MC information on DStarPi pairs for reduced workflow + hf_cand_b0_reduced::ProngD0Id, + hf_cand_b0_reduced::ProngBachPiId, + hf_cand_b0::FlagMcMatchRec, + hf_cand_b0::FlagWrongCollision, + hf_cand_b0::DebugMcRec, + hf_b0_mc::PtMother); + // Table with same size as HFCANDB0 DECLARE_SOA_TABLE(HfMcRecRedB0s, "AOD", "HFMCRECREDB0", //! Reconstruction-level MC information on B0 candidates for reduced workflow hf_cand_b0::FlagMcMatchRec, diff --git a/PWGHF/D2H/TableProducer/candidateCreatorB0Reduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorB0Reduced.cxx index a5815359f4b..fd6a2b4098c 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorB0Reduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorB0Reduced.cxx @@ -51,9 +51,11 @@ using namespace o2::hf_trkcandsel; /// Reconstruction of B0 candidates struct HfCandidateCreatorB0Reduced { - Produces rowCandidateBase; // table defined in CandidateReconstructionTables.h - Produces rowCandidateProngs; // table defined in ReducedDataModel.h - Produces rowCandidateDmesMlScores; // table defined in ReducedDataModel.h + Produces rowCandidateBase; // table defined in CandidateReconstructionTables.h + Produces rowCandidateB0DStar; // table defined in CandidateReconstructionTables.h + Produces rowCandidateProngs; // table defined in ReducedDataModel.h + Produces rowCandidateProngsDStar; // table defined in ReducedDataModel.h + Produces rowCandidateDmesMlScores; // table defined in ReducedDataModel.h // vertexing Configurable propagateToPCA{"propagateToPCA", true, "create tracks version propagated to PCA"}; @@ -67,17 +69,18 @@ struct HfCandidateCreatorB0Reduced { Configurable invMassWindowDPiTolerance{"invMassWindowDPiTolerance", 0.01, "invariant-mass window tolerance for DPi pair preselections (GeV/c2)"}; float myInvMassWindowDPi{1.}; // variable that will store the value of invMassWindowDPi (defined in dataCreatorDplusPiReduced.cxx) - float massPi{0.}; - float massD{0.}; - float massB0{0.}; float bz{0.}; - o2::vertexing::DCAFitterN<2> df2; // fitter for B vertex (2-prong vertex fitter) + o2::vertexing::DCAFitterN<2> df2; // fitter for B vertex (2-prong vertex fitter for DpPi candidates) + o2::vertexing::DCAFitterN<3> df3; // fitter for B vertex (3-prong vertex fitter for DstarPi candidates) using HfRedCollisionsWithExtras = soa::Join; + using HfSoftPiWCovAndPid = soa::Join; - Preslice> candsDPerCollision = hf_track_index_reduced::hfRedCollisionId; - Preslice> candsDWithMlPerCollision = hf_track_index_reduced::hfRedCollisionId; + Preslice> candsDplusPerCollision = hf_track_index_reduced::hfRedCollisionId; + Preslice> candsDplusWithMlPerCollision = hf_track_index_reduced::hfRedCollisionId; + Preslice> candsDstarPerCollision = hf_track_index_reduced::hfRedCollisionId; + Preslice> candsDstarWithMlPerCollision = hf_track_index_reduced::hfRedCollisionId; Preslice> tracksPionPerCollision = hf_track_index_reduced::hfRedCollisionId; std::shared_ptr hCandidates; @@ -85,16 +88,11 @@ struct HfCandidateCreatorB0Reduced { void init(InitContext const&) { - std::array doprocess{doprocessData, doprocessDataWithDmesMl}; + std::array doprocess{doprocessDataDplusPi, doprocessDataDplusPiWithDmesMl, doprocessDataDstarPi, doprocessDataDstarPiWithDmesMl}; if ((std::accumulate(doprocess.begin(), doprocess.end(), 0)) != 1) { LOGP(fatal, "Only one process function for data should be enabled at a time."); } - // invariant-mass window cut - massPi = o2::constants::physics::MassPiPlus; - massD = o2::constants::physics::MassDMinus; - massB0 = o2::constants::physics::MassB0; - // Initialize fitter df2.setPropagateToPCA(propagateToPCA); df2.setMaxR(maxR); @@ -104,8 +102,20 @@ struct HfCandidateCreatorB0Reduced { df2.setUseAbsDCA(useAbsDCA); df2.setWeightedFinalPCA(useWeightedFinalPCA); + df3.setPropagateToPCA(propagateToPCA); + df3.setMaxR(maxR); + df3.setMaxDZIni(maxDZIni); + df3.setMinParamChange(minParamChange); + df3.setMinRelChi2Change(minRelChi2Change); + df3.setUseAbsDCA(useAbsDCA); + df3.setWeightedFinalPCA(useWeightedFinalPCA); + // histograms - registry.add("hMassB0ToDPi", "2-prong candidates;inv. mass (B^{0} #rightarrow D^{#minus}#pi^{#plus} #rightarrow #pi^{#minus}K^{#plus}#pi^{#minus}#pi^{#plus}) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{500, 3., 8.}}}); + if (doprocessDataDplusPi || doprocessDataDplusPiWithDmesMl) { + registry.add("hMassB0ToDPi", "2-prong candidates;inv. mass (B^{0} #rightarrow D^{#minus}#pi^{#plus} #rightarrow #pi^{#minus}K^{#plus}#pi^{#minus}#pi^{#plus}) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{500, 3., 8.}}}); + } else if (doprocessDataDstarPi || doprocessDataDstarPiWithDmesMl) { + registry.add("hMassB0ToDPi", "3-prong candidates;inv. mass (B^{0} #rightarrow D^{0}#pi^{#plus}#pi^{#plus} #rightarrow #pi^{#minus}K^{#plus}#pi^{#minus}#pi^{#plus}) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{500, 3., 8.}}}); + } registry.add("hCovPVXX", "2-prong candidates;XX element of cov. matrix of prim. vtx. position (cm^{2});entries", {HistType::kTH1F, {{100, 0., 1.e-4}}}); registry.add("hCovSVXX", "2-prong candidates;XX element of cov. matrix of sec. vtx. position (cm^{2});entries", {HistType::kTH1F, {{100, 0., 0.2}}}); registry.add("hEvents", "Events;;entries", HistType::kTH1F, {{1, 0.5, 1.5}}); @@ -115,6 +125,118 @@ struct HfCandidateCreatorB0Reduced { setLabelHistoCands(hCandidates); } + /// Main function to perform B0 candidate creation + /// \param withDmesMl is the flag to use the table with ML scores for the D- daughter (only possible if present in the derived data) + /// \param collision the collision + /// \param candsDThisColl B0 candidates in this collision + /// \param tracksPionThisCollision pion tracks in this collision + /// \param invMass2DPiMin minimum B0 invariant-mass + /// \param invMass2DPiMax maximum B0 invariant-mass + template + void runCandidateCreationDStar(Coll const& collision, + Cands const& candsDThisColl, + SoftPions const& softPions, + Pions const& tracksPionThisCollision, + const float invMass2DPiMin, + const float invMass2DPiMax) + { + auto primaryVertex = getPrimaryVertex(collision); + auto covMatrixPV = primaryVertex.getCov(); + + // Set the magnetic field from ccdb + bz = collision.bz(); + df3.setBz(bz); + + for (const auto& candD : candsDThisColl) { + auto trackParCovD = getTrackParCov(candD); + std::array pVecD0 = candD.pVector(); + auto trackSoftPion = softPions.rawIteratorAt(candD.globalIndex()); + std::array pVecSoftPion = trackSoftPion.pVector(); + auto trackParCovSoftPi = getTrackParCov(trackSoftPion); + + for (const auto& trackBachPion : tracksPionThisCollision) { + // this track is among daughters + if (trackBachPion.trackId() == candD.prong0Id() || trackBachPion.trackId() == candD.prong1Id() || trackBachPion.trackId() == trackSoftPion.trackId()) { + continue; + } + + auto trackParCovPi = getTrackParCov(trackBachPion); + std::array pVecBachPion = trackBachPion.pVector(); + + // compute invariant mass square and apply selection + auto invMass2DPi = RecoDecay::m2(std::array{pVecD0, pVecSoftPion, pVecBachPion}, std::array{o2::constants::physics::MassD0, o2::constants::physics::MassPiPlus, o2::constants::physics::MassPiPlus}); + if ((invMass2DPi < invMass2DPiMin) || (invMass2DPi > invMass2DPiMax)) { + continue; + } + + // --------------------------------- + // reconstruct the 3-prong B0 vertex + hCandidates->Fill(SVFitting::BeforeFit); + try { + if (df3.process(trackParCovD, trackParCovSoftPi, trackParCovPi) == 0) { + continue; + } + } catch (const std::runtime_error& error) { + LOG(info) << "Run time error found: " << error.what() << ". DCAFitterN cannot work, skipping the candidate."; + hCandidates->Fill(SVFitting::Fail); + continue; + } + hCandidates->Fill(SVFitting::FitOk); + + // DPi passed B0 reconstruction + + // calculate relevant properties + const auto& secondaryVertexB0 = df3.getPCACandidate(); + auto chi2PCA = df3.getChi2AtPCACandidate(); + auto covMatrixPCA = df3.calcPCACovMatrixFlat(); + registry.fill(HIST("hCovSVXX"), covMatrixPCA[0]); + registry.fill(HIST("hCovPVXX"), covMatrixPV[0]); + + // propagate D and Pi to the B0 vertex + df3.propagateTracksToVertex(); + // track.getPxPyPzGlo(pVec) modifies pVec of track + df3.getTrack(0).getPxPyPzGlo(pVecD0); // momentum of D at the B0 vertex + df3.getTrack(1).getPxPyPzGlo(pVecSoftPion); // momentum of SoftPi at the B0 vertex + df3.getTrack(2).getPxPyPzGlo(pVecBachPion); // momentum of Pi at the B0 vertex + + registry.fill(HIST("hMassB0ToDPi"), std::sqrt(invMass2DPi)); + + // compute impact parameters of D and Pi + o2::dataformats::DCA dcaD; + o2::dataformats::DCA dcaSoftPion; + o2::dataformats::DCA dcaBachPion; + trackParCovD.propagateToDCA(primaryVertex, bz, &dcaD); + trackParCovSoftPi.propagateToDCA(primaryVertex, bz, &dcaSoftPion); + trackParCovPi.propagateToDCA(primaryVertex, bz, &dcaBachPion); + + // get uncertainty of the decay length + float phi, theta; + // getPointDirection modifies phi and theta + getPointDirection(std::array{collision.posX(), collision.posY(), collision.posZ()}, secondaryVertexB0, phi, theta); + auto errorDecayLength = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, theta) + getRotatedCovMatrixXX(covMatrixPCA, phi, theta)); + auto errorDecayLengthXY = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, 0.) + getRotatedCovMatrixXX(covMatrixPCA, phi, 0.)); + + // fill the candidate table for the B0 here: + rowCandidateB0DStar(collision.globalIndex(), + collision.posX(), collision.posY(), collision.posZ(), + secondaryVertexB0[0], secondaryVertexB0[1], secondaryVertexB0[2], + errorDecayLength, errorDecayLengthXY, + chi2PCA, + pVecD0[0], pVecD0[1], pVecD0[2], + pVecSoftPion[0], pVecSoftPion[1], pVecSoftPion[2], + pVecBachPion[0], pVecBachPion[1], pVecBachPion[2], + dcaD.getY(), dcaSoftPion.getY(), dcaBachPion.getY(), + std::sqrt(dcaD.getSigmaY2()), std::sqrt(dcaSoftPion.getSigmaY2()), std::sqrt(dcaBachPion.getSigmaY2())); + + rowCandidateProngsDStar(candD.globalIndex(), trackBachPion.globalIndex(), trackSoftPion.globalIndex()); + + if constexpr (withDmesMl) { + rowCandidateDmesMlScores(candD.mlScoreBkgMassHypo0(), candD.mlScorePromptMassHypo0(), candD.mlScoreNonpromptMassHypo0()); + } + } // pi loop + } // D loop + } + /// Main function to perform B0 candidate creation /// \param withDmesMl is the flag to use the table with ML scores for the D- daughter (only possible if present in the derived data) /// \param collision the collision @@ -126,8 +248,8 @@ struct HfCandidateCreatorB0Reduced { void runCandidateCreation(Coll const& collision, Cands const& candsDThisColl, Pions const& tracksPionThisCollision, - const float& invMass2DPiMin, - const float& invMass2DPiMax) + const float invMass2DPiMin, + const float invMass2DPiMax) { auto primaryVertex = getPrimaryVertex(collision); auto covMatrixPV = primaryVertex.getCov(); @@ -150,7 +272,7 @@ struct HfCandidateCreatorB0Reduced { std::array pVecPion = trackPion.pVector(); // compute invariant mass square and apply selection - auto invMass2DPi = RecoDecay::m2(std::array{pVecD, pVecPion}, std::array{massD, massPi}); + auto invMass2DPi = RecoDecay::m2(std::array{pVecD, pVecPion}, std::array{o2::constants::physics::MassDMinus, o2::constants::physics::MassPiPlus}); if ((invMass2DPi < invMass2DPiMin) || (invMass2DPi > invMass2DPiMax)) { continue; } @@ -218,11 +340,11 @@ struct HfCandidateCreatorB0Reduced { } // D loop } - void processData(HfRedCollisionsWithExtras const& collisions, - soa::Join const& candsD, - soa::Join const& tracksPion, - aod::HfOrigColCounts const& collisionsCounter, - aod::HfCandB0Configs const& configs) + void processDataDplusPi(HfRedCollisionsWithExtras const& collisions, + soa::Join const& candsD, + soa::Join const& tracksPion, + aod::HfOrigColCounts const& collisionsCounter, + aod::HfCandB0Configs const& configs) { // DPi invariant-mass window cut for (const auto& config : configs) { @@ -230,8 +352,8 @@ struct HfCandidateCreatorB0Reduced { } // invMassWindowDPiTolerance is used to apply a slightly tighter cut than in DPi pair preselection // to avoid accepting DPi pairs that were not formed in DPi pair creator - float invMass2DPiMin = (massB0 - myInvMassWindowDPi + invMassWindowDPiTolerance) * (massB0 - myInvMassWindowDPi + invMassWindowDPiTolerance); - float invMass2DPiMax = (massB0 + myInvMassWindowDPi - invMassWindowDPiTolerance) * (massB0 + myInvMassWindowDPi - invMassWindowDPiTolerance); + float invMass2DPiMin = (o2::constants::physics::MassB0 - myInvMassWindowDPi + invMassWindowDPiTolerance) * (o2::constants::physics::MassB0 - myInvMassWindowDPi + invMassWindowDPiTolerance); + float invMass2DPiMax = (o2::constants::physics::MassB0 + myInvMassWindowDPi - invMassWindowDPiTolerance) * (o2::constants::physics::MassB0 + myInvMassWindowDPi - invMassWindowDPiTolerance); for (const auto& collisionCounter : collisionsCounter) { registry.fill(HIST("hEvents"), 1, collisionCounter.originalCollisionCount()); @@ -240,7 +362,7 @@ struct HfCandidateCreatorB0Reduced { static int ncol = 0; for (const auto& collision : collisions) { auto thisCollId = collision.globalIndex(); - auto candsDThisColl = candsD.sliceBy(candsDPerCollision, thisCollId); + auto candsDThisColl = candsD.sliceBy(candsDplusPerCollision, thisCollId); auto tracksPionThisCollision = tracksPion.sliceBy(tracksPionPerCollision, thisCollId); runCandidateCreation(collision, candsDThisColl, tracksPionThisCollision, invMass2DPiMin, invMass2DPiMax); if (ncol % 10000 == 0) { @@ -248,15 +370,15 @@ struct HfCandidateCreatorB0Reduced { } ncol++; } - } // processData + } // processDataDplusPi - PROCESS_SWITCH(HfCandidateCreatorB0Reduced, processData, "Process data without any ML score", true); + PROCESS_SWITCH(HfCandidateCreatorB0Reduced, processDataDplusPi, "Process data D-pi without any ML score", true); - void processDataWithDmesMl(HfRedCollisionsWithExtras const& collisions, - soa::Join const& candsD, - soa::Join const& tracksPion, - aod::HfOrigColCounts const& collisionsCounter, - aod::HfCandB0Configs const& configs) + void processDataDplusPiWithDmesMl(HfRedCollisionsWithExtras const& collisions, + soa::Join const& candsD, + soa::Join const& tracksPion, + aod::HfOrigColCounts const& collisionsCounter, + aod::HfCandB0Configs const& configs) { // DPi invariant-mass window cut for (const auto& config : configs) { @@ -264,8 +386,8 @@ struct HfCandidateCreatorB0Reduced { } // invMassWindowDPiTolerance is used to apply a slightly tighter cut than in DPi pair preselection // to avoid accepting DPi pairs that were not formed in DPi pair creator - float invMass2DPiMin = (massB0 - myInvMassWindowDPi + invMassWindowDPiTolerance) * (massB0 - myInvMassWindowDPi + invMassWindowDPiTolerance); - float invMass2DPiMax = (massB0 + myInvMassWindowDPi - invMassWindowDPiTolerance) * (massB0 + myInvMassWindowDPi - invMassWindowDPiTolerance); + float invMass2DPiMin = (o2::constants::physics::MassB0 - myInvMassWindowDPi + invMassWindowDPiTolerance) * (o2::constants::physics::MassB0 - myInvMassWindowDPi + invMassWindowDPiTolerance); + float invMass2DPiMax = (o2::constants::physics::MassB0 + myInvMassWindowDPi - invMassWindowDPiTolerance) * (o2::constants::physics::MassB0 + myInvMassWindowDPi - invMassWindowDPiTolerance); for (const auto& collisionCounter : collisionsCounter) { registry.fill(HIST("hEvents"), 1, collisionCounter.originalCollisionCount()); @@ -274,7 +396,7 @@ struct HfCandidateCreatorB0Reduced { static int ncol = 0; for (const auto& collision : collisions) { auto thisCollId = collision.globalIndex(); - auto candsDThisColl = candsD.sliceBy(candsDPerCollision, thisCollId); + auto candsDThisColl = candsD.sliceBy(candsDplusPerCollision, thisCollId); auto tracksPionThisCollision = tracksPion.sliceBy(tracksPionPerCollision, thisCollId); runCandidateCreation(collision, candsDThisColl, tracksPionThisCollision, invMass2DPiMin, invMass2DPiMax); if (ncol % 10000 == 0) { @@ -282,14 +404,86 @@ struct HfCandidateCreatorB0Reduced { } ncol++; } - } // processDataWithDmesMl + } // processDataDplusPiWithDmesMl + + PROCESS_SWITCH(HfCandidateCreatorB0Reduced, processDataDplusPiWithDmesMl, "Process data D-pi with ML scores of D mesons", false); + + void processDataDstarPi(HfRedCollisionsWithExtras const& collisions, + soa::Join const& candsD, + HfSoftPiWCovAndPid const& softPions, + soa::Join const& tracksPion, + aod::HfOrigColCounts const& collisionsCounter, + aod::HfCandB0Configs const& configs) + { + // DPi invariant-mass window cut + for (const auto& config : configs) { + myInvMassWindowDPi = config.myInvMassWindowDPi(); + } + // invMassWindowDPiTolerance is used to apply a slightly tighter cut than in DPi pair preselection + // to avoid accepting DPi pairs that were not formed in DPi pair creator + float invMass2DPiMin = (o2::constants::physics::MassB0 - myInvMassWindowDPi + invMassWindowDPiTolerance) * (o2::constants::physics::MassB0 - myInvMassWindowDPi + invMassWindowDPiTolerance); + float invMass2DPiMax = (o2::constants::physics::MassB0 + myInvMassWindowDPi - invMassWindowDPiTolerance) * (o2::constants::physics::MassB0 + myInvMassWindowDPi - invMassWindowDPiTolerance); + + for (const auto& collisionCounter : collisionsCounter) { + registry.fill(HIST("hEvents"), 1, collisionCounter.originalCollisionCount()); + } + + static int ncol = 0; + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto candsDThisColl = candsD.sliceBy(candsDstarPerCollision, thisCollId); + auto tracksPionThisCollision = tracksPion.sliceBy(tracksPionPerCollision, thisCollId); + runCandidateCreationDStar(collision, candsDThisColl, softPions, tracksPionThisCollision, invMass2DPiMin, invMass2DPiMax); + if (ncol % 10000 == 0) { + LOGP(debug, "collisions parsed {}", ncol); + } + ncol++; + } + } // processDataDstarPi + + PROCESS_SWITCH(HfCandidateCreatorB0Reduced, processDataDstarPi, "Process data D*pi without any ML score", false); + + void processDataDstarPiWithDmesMl(HfRedCollisionsWithExtras const& collisions, + soa::Join const& candsD, + HfSoftPiWCovAndPid const& softPions, + soa::Join const& tracksPion, + aod::HfOrigColCounts const& collisionsCounter, + aod::HfCandB0Configs const& configs) + { + // DPi invariant-mass window cut + for (const auto& config : configs) { + myInvMassWindowDPi = config.myInvMassWindowDPi(); + } + // invMassWindowDPiTolerance is used to apply a slightly tighter cut than in DPi pair preselection + // to avoid accepting DPi pairs that were not formed in DPi pair creator + float invMass2DPiMin = (o2::constants::physics::MassB0 - myInvMassWindowDPi + invMassWindowDPiTolerance) * (o2::constants::physics::MassB0 - myInvMassWindowDPi + invMassWindowDPiTolerance); + float invMass2DPiMax = (o2::constants::physics::MassB0 + myInvMassWindowDPi - invMassWindowDPiTolerance) * (o2::constants::physics::MassB0 + myInvMassWindowDPi - invMassWindowDPiTolerance); + + for (const auto& collisionCounter : collisionsCounter) { + registry.fill(HIST("hEvents"), 1, collisionCounter.originalCollisionCount()); + } + + static int ncol = 0; + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto candsDThisColl = candsD.sliceBy(candsDstarWithMlPerCollision, thisCollId); + auto tracksPionThisCollision = tracksPion.sliceBy(tracksPionPerCollision, thisCollId); + runCandidateCreationDStar(collision, candsDThisColl, softPions, tracksPionThisCollision, invMass2DPiMin, invMass2DPiMax); + if (ncol % 10000 == 0) { + LOGP(debug, "collisions parsed {}", ncol); + } + ncol++; + } + } // processDataDstarPiWithDmesMl + + PROCESS_SWITCH(HfCandidateCreatorB0Reduced, processDataDstarPiWithDmesMl, "Process data D*pi with ML scores of D mesons", false); - PROCESS_SWITCH(HfCandidateCreatorB0Reduced, processDataWithDmesMl, "Process data with ML scores of D mesons", false); }; // struct /// Extends the table base with expression columns and performs MC matching. struct HfCandidateCreatorB0ReducedExpressions { Spawns rowCandidateB0; + Spawns rowCandidateB0DSt; Spawns rowTracksExt; Produces rowB0McRec; Produces rowB0McCheck; @@ -298,14 +492,20 @@ struct HfCandidateCreatorB0ReducedExpressions { /// \param checkDecayTypeMc /// \param rowsDPiMcRec MC reco information on DPi pairs /// \param candsB0 prong global indices of B0 candidates - template - void fillB0McRec(McRec const& rowsDPiMcRec, HfRedB0Prongs const& candsB0) + template + void fillB0McRec(McRec const& rowsDPiMcRec, B0Prongs const& candsB0) { for (const auto& candB0 : candsB0) { bool filledMcInfo{false}; for (const auto& rowDPiMcRec : rowsDPiMcRec) { - if ((rowDPiMcRec.prong0Id() != candB0.prong0Id()) || (rowDPiMcRec.prong1Id() != candB0.prong1Id())) { - continue; + if constexpr (std::is_same_v) { + if ((rowDPiMcRec.prong0Id() != candB0.prong0Id()) || (rowDPiMcRec.prong1Id() != candB0.prong1Id())) { + continue; + } + } else if constexpr (std::is_same_v) { // No need to check ID of soft pion, it is the same as D0 + if ((rowDPiMcRec.prongD0Id() != candB0.prongD0Id()) || (rowDPiMcRec.prongBachPiId() != candB0.prongBachPiId())) { + continue; + } } rowB0McRec(rowDPiMcRec.flagMcMatchRec(), -1 /*channel*/, rowDPiMcRec.flagWrongCollision(), rowDPiMcRec.debugMcRec(), rowDPiMcRec.ptMother()); filledMcInfo = true; @@ -328,17 +528,29 @@ struct HfCandidateCreatorB0ReducedExpressions { } } - void processMc(HfMcRecRedDpPis const& rowsDPiMcRec, HfRedB0Prongs const& candsB0) + void processMcDplusPi(HfMcRecRedDpPis const& rowsDPiMcRec, HfRedB0Prongs const& candsB0) + { + fillB0McRec(rowsDPiMcRec, candsB0); + } + PROCESS_SWITCH(HfCandidateCreatorB0ReducedExpressions, processMcDplusPi, "Process MC for DplusPi", false); + + void processMcDplusPiWithDecayTypeCheck(soa::Join const& rowsDPiMcRec, HfRedB0Prongs const& candsB0) + { + fillB0McRec(rowsDPiMcRec, candsB0); + } + PROCESS_SWITCH(HfCandidateCreatorB0ReducedExpressions, processMcDplusPiWithDecayTypeCheck, "Process MC with decay type checks for DplusPi", false); + + void processMcDstarPi(HfMcRecRedDStarPis const& rowsDPiMcRec, HfRedB0ProngDStars const& candsB0) { fillB0McRec(rowsDPiMcRec, candsB0); } - PROCESS_SWITCH(HfCandidateCreatorB0ReducedExpressions, processMc, "Process MC", false); + PROCESS_SWITCH(HfCandidateCreatorB0ReducedExpressions, processMcDstarPi, "Process MC for DstarPi", false); - void processMcWithDecayTypeCheck(soa::Join const& rowsDPiMcRec, HfRedB0Prongs const& candsB0) + void processMcDstarPiWithDecayTypeCheck(soa::Join const& rowsDPiMcRec, HfRedB0ProngDStars const& candsB0) { fillB0McRec(rowsDPiMcRec, candsB0); } - PROCESS_SWITCH(HfCandidateCreatorB0ReducedExpressions, processMcWithDecayTypeCheck, "Process MC with decay type checks", false); + PROCESS_SWITCH(HfCandidateCreatorB0ReducedExpressions, processMcDstarPiWithDecayTypeCheck, "Process MC with decay type checks for DstarPi", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGHF/D2H/TableProducer/candidateSelectorB0ToDPiReduced.cxx b/PWGHF/D2H/TableProducer/candidateSelectorB0ToDPiReduced.cxx index 53609fc66c9..51ba23c8511 100644 --- a/PWGHF/D2H/TableProducer/candidateSelectorB0ToDPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateSelectorB0ToDPiReduced.cxx @@ -103,13 +103,14 @@ struct HfCandidateSelectorB0ToDPiReduced { TrackSelectorPi selectorPion; HfHelper hfHelper; - using TracksPion = soa::Join; + using TracksBachPion = soa::Join; + using TracksSoftPions = soa::Join; HistogramRegistry registry{"registry"}; void init(InitContext const&) { - std::array doprocess{doprocessSelection, doprocessSelectionWithDmesMl}; + std::array doprocess{doprocessSelectionDplusPi, doprocessSelectionDplusPiWithDmesMl, doprocessSelectionDstarPi, doprocessSelectionDstarPiWithDmesMl}; if ((std::accumulate(doprocess.begin(), doprocess.end(), 0)) != 1) { LOGP(fatal, "Only one process function for data should be enabled at a time."); } @@ -155,6 +156,55 @@ struct HfCandidateSelectorB0ToDPiReduced { } } + /// Utility function to retrieve the bach pion track + /// from the B0 candidate in the D*-pi decay channel + /// \param candidate is the B0 candidate + /// \return bach pion track + template + auto getTrackBachPi(const T1& candidate) + { + return candidate.template prongBachPi_as(); + } + + /// Method to get the input features vector needed for ML inference + /// \param candidate is the B0 candidate + /// \param prongBachPi is the candidate's bachelor pion prong + /// \note this method is used for B0 → D*- π+ candidates with D meson ML scores + template + auto getMlInputFeatures(const T1& candB0, const T2& prongBachPi) + { + auto prongSoftPi = candB0.template prongSoftPi_as(); + if constexpr (withDmesMl) { + return hfMlResponse.getInputFeaturesDStarPi(candB0, prongBachPi, prongSoftPi); + } else { + return hfMlResponse.getInputFeaturesDStarPi(candB0, prongBachPi, prongSoftPi); + } + } + + /// Utility function to retrieve the bach pion track + /// from the B0 candidate in the D-pi decay channel + /// \param candidate is the B0 candidate + /// \return bach pion track + template + auto getTrackBachPi(const T1& candidate) + { + return candidate.template prong1_as(); + } + + /// Method to get the input features vector needed for ML inference + /// \param candB0 is the B0 candidate + /// \param prongBachPi is the candidate's bachelor pion prong + /// \note this method is used for B0 → D- π+ candidates with D meson ML scores + template + auto getMlInputFeatures(const T1& candB0, const T2& prongBachPi) + { + if constexpr (withDmesMl) { + return hfMlResponse.getInputFeatures(candB0, prongBachPi); + } else { + return hfMlResponse.getInputFeatures(candB0, prongBachPi); + } + } + /// Main function to perform B0 candidate creation /// \param withDmesMl is the flag to use the table with ML scores for the D- daughter (only possible if present in the derived data) /// \param hfCandsB0 B0 candidates @@ -162,7 +212,7 @@ struct HfCandidateSelectorB0ToDPiReduced { /// \param configs config inherited from the Dpi data creator template void runSelection(Cands const& hfCandsB0, - TracksPion const&, + TracksBachPion const&, HfCandB0Configs const& configs) { // get DplusPi creator configurable @@ -205,16 +255,15 @@ struct HfCandidateSelectorB0ToDPiReduced { registry.fill(HIST("hSelections"), 2 + SelectionStep::RecoTopol, ptCandB0); } - // track-level PID selection - auto trackPi = hfCandB0.template prong1_as(); + auto trackBachPi = getTrackBachPi(hfCandB0); if (pionPidMethod == PidMethod::TpcOrTof || pionPidMethod == PidMethod::TpcAndTof) { - int pidTrackPi{TrackSelectorPID::Status::NotApplicable}; + int pidTrackBachPi{TrackSelectorPID::Status::NotApplicable}; if (pionPidMethod == PidMethod::TpcOrTof) { - pidTrackPi = selectorPion.statusTpcOrTof(trackPi); + pidTrackBachPi = selectorPion.statusTpcOrTof(trackBachPi); } else if (pionPidMethod == PidMethod::TpcAndTof) { - pidTrackPi = selectorPion.statusTpcAndTof(trackPi); + pidTrackBachPi = selectorPion.statusTpcAndTof(trackBachPi); } - if (!hfHelper.selectionB0ToDPiPid(pidTrackPi, acceptPIDNotApplicable.value)) { + if (!hfHelper.selectionB0ToDPiPid(pidTrackBachPi, acceptPIDNotApplicable.value)) { // LOGF(info, "B0 candidate selection failed at PID selection"); hfSelB0ToDPiCandidate(statusB0ToDPi); if (applyB0Ml) { @@ -227,10 +276,9 @@ struct HfCandidateSelectorB0ToDPiReduced { registry.fill(HIST("hSelections"), 2 + SelectionStep::RecoPID, ptCandB0); } } - if (applyB0Ml) { // B0 ML selections - std::vector inputFeatures = hfMlResponse.getInputFeatures(hfCandB0, trackPi); + std::vector inputFeatures = getMlInputFeatures(hfCandB0, trackBachPi); bool isSelectedMl = hfMlResponse.isSelectedMl(inputFeatures, ptCandB0, outputMl); hfMlB0ToDPiCandidate(outputMl[1]); // storing ML score for signal class @@ -249,23 +297,43 @@ struct HfCandidateSelectorB0ToDPiReduced { } } - void processSelection(HfRedCandB0 const& hfCandsB0, - TracksPion const& pionTracks, - HfCandB0Configs const& configs) + void processSelectionDplusPi(HfRedCandB0 const& hfCandsB0, + TracksBachPion const& pionTracks, + HfCandB0Configs const& configs) + { + runSelection(hfCandsB0, pionTracks, configs); + } // processSelectionDplusPi + + PROCESS_SWITCH(HfCandidateSelectorB0ToDPiReduced, processSelectionDplusPi, "Process selection DplusPi without ML scores of D mesons", true); + + void processSelectionDplusPiWithDmesMl(soa::Join const& hfCandsB0, + TracksBachPion const& pionTracks, + HfCandB0Configs const& configs) + { + runSelection(hfCandsB0, pionTracks, configs); + } // processSelectionDplusPiWithDmesMl + + PROCESS_SWITCH(HfCandidateSelectorB0ToDPiReduced, processSelectionDplusPiWithDmesMl, "Process selection DplusPi with ML scores of D mesons", false); + + void processSelectionDstarPi(HfRedCandB0DStar const& hfCandsB0, + TracksBachPion const& pionTracks, + HfCandB0Configs const& configs, + TracksSoftPions const& /*softPions*/) { runSelection(hfCandsB0, pionTracks, configs); - } // processSelection + } // processSelectionDstarPi - PROCESS_SWITCH(HfCandidateSelectorB0ToDPiReduced, processSelection, "Process selection without ML scores of D mesons", true); + PROCESS_SWITCH(HfCandidateSelectorB0ToDPiReduced, processSelectionDstarPi, "Process selection DstarPi without ML scores of D mesons", false); - void processSelectionWithDmesMl(soa::Join const& hfCandsB0, - TracksPion const& pionTracks, - HfCandB0Configs const& configs) + void processSelectionDstarPiWithDmesMl(soa::Join const& hfCandsB0, + TracksBachPion const& pionTracks, + HfCandB0Configs const& configs, + TracksSoftPions const& /*softPions*/) { runSelection(hfCandsB0, pionTracks, configs); - } // processSelectionWithDmesMl + } // processSelectionDstarPiWithDmesMl - PROCESS_SWITCH(HfCandidateSelectorB0ToDPiReduced, processSelectionWithDmesMl, "Process selection with ML scores of D mesons", false); + PROCESS_SWITCH(HfCandidateSelectorB0ToDPiReduced, processSelectionDstarPiWithDmesMl, "Process selection DstarPi with ML scores of D mesons", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx index 0b73b385893..52ff971df9e 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx @@ -122,6 +122,7 @@ struct HfDataCreatorCharmHadPiReduced { Produces hfTrackPion; Produces hfTrackCovPion; Produces hfTrackPidPion; + Produces hfTrackMomPion; // charm hadron related tables Produces hfCand2Prong; Produces hfCand2ProngCov; @@ -129,9 +130,11 @@ struct HfDataCreatorCharmHadPiReduced { Produces hfCand3Prong; Produces hfCand3ProngCov; Produces hfCand3ProngMl; - // D* soft pion related tables + Produces hfMomDMesDaugs; + // D* related tables Produces hfTrackSoftPion; Produces hfTrackCovSoftPion; + Produces hfTrackPidSoftPion; // PID tables for charm-hadron candidate daughter tracks Produces hfCandPidProng0; Produces hfCandPidProng1; @@ -141,6 +144,7 @@ struct HfDataCreatorCharmHadPiReduced { Produces rowCandidateConfigB0; Produces rowHfDPiMcRecReduced; Produces rowHfDPiMcCheckReduced; + Produces rowHfDStarPiMcRecReduced; Produces rowHfB0McGenReduced; Produces rowCandidateConfigBplus; @@ -266,7 +270,7 @@ struct HfDataCreatorCharmHadPiReduced { PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; } preslices; - std::shared_ptr hCandidatesD0, hCandidatesDPlus, hCandidatesDs, hCandidatesLc, hCandidatesDstar; + std::shared_ptr hCandidatesD0, hCandidatesDPlus, hCandidatesDs, hCandidatesLc, hCandidatesD0FromDstar; HistogramRegistry registry{"registry"}; std::array arrPDGResonantDsPhiPi = {kPhi, kPiPlus}; // Ds± → Phi π± @@ -306,8 +310,7 @@ struct HfDataCreatorCharmHadPiReduced { // Initialize fitter if (doprocessDplusPiData || doprocessDplusPiDataWithMl || doprocessDplusPiDataWithQvec || doprocessDplusPiDataWithMlAndQvec || doprocessDplusPiMc || doprocessDplusPiMcWithMl || doprocessDsPiData || doprocessDsPiDataWithMl || doprocessDsPiDataWithQvec || doprocessDsPiDataWithMlAndQvec || doprocessDsPiMc || doprocessDsPiMcWithMl || - doprocessLcPiData || doprocessLcPiDataWithMl || doprocessLcPiMc || doprocessLcPiMcWithMl || - doprocessDstarPiData || doprocessDstarPiDataWithMl || doprocessDstarPiDataWithQvec || doprocessDstarPiDataWithMlAndQvec || doprocessDstarPiMc || doprocessDstarPiMcWithMl) { + doprocessLcPiData || doprocessLcPiDataWithMl || doprocessLcPiMc || doprocessLcPiMcWithMl) { df3.setPropagateToPCA(vertexConfigurations.propagateToPCA); df3.setMaxR(vertexConfigurations.maxR); df3.setMaxDZIni(vertexConfigurations.maxDZIni); @@ -316,7 +319,8 @@ struct HfDataCreatorCharmHadPiReduced { df3.setUseAbsDCA(vertexConfigurations.useAbsDCA); df3.setWeightedFinalPCA(vertexConfigurations.useWeightedFinalPCA); df3.setMatCorrType(noMatCorr); - } else if (doprocessD0PiData || doprocessD0PiDataWithMl || doprocessD0PiDataWithQvec || doprocessD0PiDataWithMlAndQvec || doprocessD0PiMc || doprocessD0PiMcWithMl) { + } else if (doprocessD0PiData || doprocessD0PiDataWithMl || doprocessD0PiDataWithQvec || doprocessD0PiDataWithMlAndQvec || doprocessD0PiMc || doprocessD0PiMcWithMl || + doprocessDstarPiData || doprocessDstarPiDataWithMl || doprocessDstarPiDataWithQvec || doprocessDstarPiDataWithMlAndQvec || doprocessDstarPiMc || doprocessDstarPiMcWithMl) { df2.setPropagateToPCA(vertexConfigurations.propagateToPCA); df2.setMaxR(vertexConfigurations.maxR); df2.setMaxDZIni(vertexConfigurations.maxDZIni); @@ -381,13 +385,13 @@ struct HfDataCreatorCharmHadPiReduced { hCandidatesDPlus = registry.add("hCandidatesDPlus", "Dplus candidate counter", {HistType::kTH1D, {axisCands}}); hCandidatesDs = registry.add("hCandidatesDs", "Ds candidate counter", {HistType::kTH1D, {axisCands}}); hCandidatesLc = registry.add("hCandidatesLc", "Lc candidate counter", {HistType::kTH1D, {axisCands}}); - hCandidatesDstar = registry.add("hCandidatesDstar", "Dstar candidate counter", {HistType::kTH1D, {axisCands}}); + hCandidatesD0FromDstar = registry.add("hCandidatesD0FromDstar", "D0 from D* candidate counter", {HistType::kTH1D, {axisCands}}); setLabelHistoCands(hCandidatesD0); setLabelHistoCands(hCandidatesDPlus); setLabelHistoCands(hCandidatesDs); setLabelHistoCands(hCandidatesLc); - setLabelHistoCands(hCandidatesDstar); + setLabelHistoCands(hCandidatesD0FromDstar); // init HF event selection helper hfEvSel.init(registry); @@ -1006,7 +1010,7 @@ struct HfDataCreatorCharmHadPiReduced { checkWrongCollision(particleMother, collision, indexCollisionMaxNumContrib, flagWrongCollision); } } - tables.rowHfDPiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); + tables.rowHfDStarPiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); } } @@ -1050,6 +1054,7 @@ struct HfDataCreatorCharmHadPiReduced { LOG(info) << ">>>>>>>>>>>> Magnetic field: " << bz; runNumber = bc.runNumber(); } + df2.setBz(bz); df3.setBz(bz); auto thisCollId = collision.globalIndex(); @@ -1099,7 +1104,7 @@ struct HfDataCreatorCharmHadPiReduced { registry.fill(HIST("hPtLc"), candC.pt()); registry.fill(HIST("hCpaLc"), candC.cpa()); } else if constexpr (decChannel == DecayChannel::B0ToDstarPi) { - indexHfCandCharm = tables.hfCand3Prong.lastIndex() + 1; + indexHfCandCharm = tables.hfCand2Prong.lastIndex() + 1; if (candC.signSoftPi() > 0) { invMassC0 = candC.invMassDstar() - candC.invMassD0(); } else { @@ -1219,7 +1224,7 @@ struct HfDataCreatorCharmHadPiReduced { trackParCovCharmHad.setAbsCharge(0); // to be sure } else if constexpr (decChannel == DecayChannel::B0ToDstarPi) { - hCandidatesDstar->Fill(SVFitting::BeforeFit); + hCandidatesD0FromDstar->Fill(SVFitting::BeforeFit); try { // D0 vertex if (df2.process(trackParCov0, trackParCov1) == 0) { @@ -1227,10 +1232,10 @@ struct HfDataCreatorCharmHadPiReduced { } } catch (const std::runtime_error& error) { LOG(info) << "Run time error found: " << error.what() << ". DCAFitterN cannot work, skipping the candidate."; - hCandidatesDstar->Fill(SVFitting::Fail); + hCandidatesD0FromDstar->Fill(SVFitting::Fail); continue; } - hCandidatesDstar->Fill(SVFitting::FitOk); + hCandidatesD0FromDstar->Fill(SVFitting::FitOk); auto secondaryVertexCharm = df2.getPCACandidate(); trackParCov0.propagateTo(secondaryVertexCharm[0], bz); trackParCov1.propagateTo(secondaryVertexCharm[0], bz); @@ -1312,6 +1317,7 @@ struct HfDataCreatorCharmHadPiReduced { trackParCovPion.getSigma1PtTgl(), trackParCovPion.getSigma1Pt2()); tables.hfTrackPidPion(trackPion.hasTPC(), trackPion.hasTOF(), trackPion.tpcNSigmaPi(), trackPion.tofNSigmaPi()); + tables.hfTrackMomPion(pVecPion[0], pVecPion[1], pVecPion[2], trackPion.sign()); // add trackPion.globalIndex() to a list // to keep memory of the pions filled in the table and avoid refilling them if they are paired to another D candidate // and keep track of their index in tables.hfTrackPion for McRec purposes @@ -1445,13 +1451,18 @@ struct HfDataCreatorCharmHadPiReduced { trackParCovSoftPion.getSigmaTglSnp(), trackParCovSoftPion.getSigmaTgl2(), trackParCovSoftPion.getSigma1PtY(), trackParCovSoftPion.getSigma1PtZ(), trackParCovSoftPion.getSigma1PtSnp(), trackParCovSoftPion.getSigma1PtTgl(), trackParCovSoftPion.getSigma1Pt2()); + tables.hfTrackPidSoftPion(candC.nSigTpcPi2(), candC.nSigTofPi2(), charmHadDauTracks[2].hasTOF(), charmHadDauTracks[2].hasTPC()); if constexpr (withMl) { std::array mlScores = {-1.f, -1.f, -1.f, -1.f, -1.f, -1.f}; if (candC.mlProbDstarToD0Pi().size() == NSizeMLScore) { std::copy(candC.mlProbDstarToD0Pi().begin(), candC.mlProbDstarToD0Pi().end(), mlScores.begin()); } - tables.hfCand3ProngMl(mlScores[0], mlScores[1], mlScores[2], -1.f, -1.f, -1.f); + tables.hfCand3ProngMl(mlScores[0], mlScores[1], mlScores[2], mlScores[3], mlScores[4], mlScores[5]); } + + tables.hfMomDMesDaugs(pVec0[0], pVec0[1], pVec0[2], + pVec1[0], pVec1[1], pVec1[2], + pVecSoftPion[0], pVecSoftPion[1], pVecSoftPion[2]); } fillHfReducedCollision = true; } diff --git a/PWGHF/D2H/Tasks/taskB0Reduced.cxx b/PWGHF/D2H/Tasks/taskB0Reduced.cxx index e1e30490f18..169e4fcd834 100644 --- a/PWGHF/D2H/Tasks/taskB0Reduced.cxx +++ b/PWGHF/D2H/Tasks/taskB0Reduced.cxx @@ -40,6 +40,7 @@ #include #include #include +#include using namespace o2; using namespace o2::aod; @@ -191,8 +192,10 @@ struct HfTaskB0Reduced { HfHelper hfHelper; - using TracksPion = soa::Join; + using TracksBachPions = soa::Join; using CandsDplus = soa::Join; + using CandsDstar = soa::Join; + using TracksSoftPions = soa::Join; Filter filterSelectCandidates = (aod::hf_sel_candidate_b0::isSelB0ToDPi >= selectionFlagB0); @@ -200,11 +203,13 @@ struct HfTaskB0Reduced { void init(InitContext&) { - std::array processFuncData{doprocessData, doprocessDataWithDmesMl, doprocessDataWithB0Ml}; + std::array processFuncData{doprocessDataDplusPi, doprocessDataDplusPiWithDmesMl, doprocessDataDplusPiWithB0Ml, + doprocessDataDstarPi, doprocessDataDstarPiWithDmesMl}; if ((std::accumulate(processFuncData.begin(), processFuncData.end(), 0)) > 1) { LOGP(fatal, "Only one process function for data can be enabled at a time."); } - std::array processFuncMc{doprocessMc, doprocessMcWithDecayTypeCheck, doprocessMcWithDmesMl, doprocessMcWithDmesMlAndDecayTypeCheck, doprocessMcWithB0Ml, doprocessMcWithB0MlAndDecayTypeCheck}; + std::array processFuncMc{doprocessMcDplusPi, doprocessMcDplusPiWithDecayTypeCheck, doprocessMcDplusPiWithDmesMl, doprocessMcDplusPiWithDmesMlAndDecayTypeCheck, doprocessMcDplusPiWithB0Ml, doprocessMcDplusPiWithB0MlAndDecayTypeCheck, + doprocessMcDstarPi, doprocessMcDstarPiWithDmesMl}; if ((std::accumulate(processFuncMc.begin(), processFuncMc.end(), 0)) > 1) { LOGP(fatal, "Only one process function for MC can be enabled at a time."); } @@ -212,6 +217,7 @@ struct HfTaskB0Reduced { const AxisSpec axisMlScore{100, 0.f, 1.f}; const AxisSpec axisMassB0{300, 4.5f, 6.0f}; const AxisSpec axisMassDminus{300, 1.75f, 2.05f}; + const AxisSpec axisMassDeltaMassDStar{300, 0.05f, 0.3f}; const AxisSpec axisDecayLength{200, 0.f, 0.4f}; const AxisSpec axisNormDecayLength{100, 0.f, 50.f}; const AxisSpec axisDca{100, -0.05f, 0.05f}; @@ -219,63 +225,94 @@ struct HfTaskB0Reduced { const AxisSpec axisEta{30, -1.5f, 1.5f}; const AxisSpec axisError{100, 0.f, 1.f}; const AxisSpec axisImpParProd{100, -1.e-3, 1.e-3}; + const AxisSpec axisImpParProngSqSum{100, 0, 1.e-3}; const AxisSpec axisPtB0{100, 0.f, 50.f}; const AxisSpec axisPtDminus{100, 0.f, 50.f}; const AxisSpec axisPtPi{100, 0.f, 10.f}; + const AxisSpec axisPtSoftPi{100, 0.f, 1.f}; - if (doprocessData || doprocessDataWithDmesMl || doprocessDataWithB0Ml) { + std::array processFuncDplusPi = {doprocessDataDplusPi, doprocessDataDplusPiWithDmesMl, doprocessDataDplusPiWithB0Ml, + doprocessMcDplusPi, doprocessMcDplusPiWithDecayTypeCheck, doprocessMcDplusPiWithDmesMl, + doprocessMcDplusPiWithDmesMlAndDecayTypeCheck, doprocessMcDplusPiWithB0Ml, + doprocessMcDplusPiWithB0MlAndDecayTypeCheck}; + const AxisSpec axisMass = ((std::accumulate(processFuncDplusPi.begin(), processFuncDplusPi.end(), 0)) > 0) ? axisMassDminus : axisMassDeltaMassDStar; + std::string dMesSpecie{""}; + if ((std::accumulate(processFuncDplusPi.begin(), processFuncDplusPi.end(), 0)) > 0) { + dMesSpecie += "D^{#minus}"; + } else { + dMesSpecie += "D^{0}#pi^{#minus}"; + } + + if (doprocessDataDplusPi || doprocessDataDplusPiWithDmesMl || doprocessDataDplusPiWithB0Ml || doprocessDataDstarPi || doprocessDataDstarPiWithDmesMl) { if (fillHistograms) { registry.add("hMass", "B^{0} candidates;#it{p}_{T}(B^{0}) (GeV/#it{c});#it{M} (D#pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPtB0, axisMassB0}}); registry.add("hDecLength", "B^{0} candidates;#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate decay length (cm);entries", {HistType::kTH2F, {axisPtB0, axisDecayLength}}); registry.add("hDecLengthXy", "B^{0} candidates;#it{p}_{T}(B^{0}) (GeV/#it{c});decay length XY (cm);entries", {HistType::kTH2F, {axisPtB0, axisDecayLength}}); registry.add("hNormDecLengthXy", "B^{0} candidates;#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate norm. decay length XY (cm);entries", {HistType::kTH2F, {axisPtB0, axisNormDecayLength}}); - registry.add("hDcaProng0", "B^{0} candidates;#it{p}_{T}(B^{0}) (GeV/#it{c});prong 0 (D^{#minus}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {axisPtB0, axisDca}}); + registry.add("hDcaProng0", Form("B^{0} candidates;#it{p}_{T}(B^{0}) (GeV/#it{c});prong 0 (%s) DCAxy to prim. vertex (cm);entries", dMesSpecie.c_str()), {HistType::kTH2F, {axisPtB0, axisDca}}); registry.add("hDcaProng1", "B^{0} candidates;#it{p}_{T}(B^{0}) (GeV/#it{c});prong 1 (#pi^{#plus}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {axisPtB0, axisDca}}); - registry.add("hPtProng0", "B^{0} candidates;#it{p}_{T}(B^{0}) (GeV/#it{c});#it{p}_{T}(D^{#minus}) (GeV/#it{c});entries", {HistType::kTH2F, {axisPtB0, axisPtDminus}}); - registry.add("hPtProng1", "B^{0} candidates;#it{p}_{T}(B^{0}) (GeV/#it{c});#it{p}_{T}(#pi^{#plus}) (GeV/#it{c});entries", {HistType::kTH2F, {axisPtB0, axisPtPi}}); registry.add("hCosp", "B^{0} candidates;#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate cos(#vartheta_{P});entries", {HistType::kTH2F, {axisPtB0, axisCosp}}); registry.add("hCospXy", "B^{0} candidates;#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate cos(#vartheta_{P}^{XY});entries", {HistType::kTH2F, {axisPtB0, axisCosp}}); registry.add("hEta", "B^{0} candidates;#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate #it{#eta};entries", {HistType::kTH2F, {axisPtB0, axisEta}}); registry.add("hRapidity", "B^{0} candidates;#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate #it{y};entries", {HistType::kTH2F, {axisPtB0, axisEta}}); - registry.add("hImpParProd", "B^{0} candidates;#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate impact parameter product;entries", {HistType::kTH2F, {axisPtB0, axisImpParProd}}); - registry.add("hInvMassD", "B^{0} candidates;#it{p}_{T}(D^{#minus}) (GeV/#it{c});prong0, #it{M}(K#pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPtDminus, axisMassDminus}}); - registry.add("hDecLengthD", "B^{0} candidates;#it{p}_{T}(D^{#minus}) (GeV/#it{c});D^{#minus} candidate decay length (cm);entries", {HistType::kTH2F, {axisPtDminus, axisDecayLength}}); - registry.add("hDecLengthXyD", "B^{0} candidates;#it{p}_{T}(D^{#minus}) (GeV/#it{c});decay length XY (cm);entries", {HistType::kTH2F, {axisPtDminus, axisDecayLength}}); - registry.add("hCospD", "B^{0} candidates;#it{p}_{T}(D^{#minus}) (GeV/#it{c});D^{#minus} candidate cos(#vartheta_{P});entries", {HistType::kTH2F, {axisPtDminus, axisCosp}}); - registry.add("hCospXyD", "B^{0} candidates;#it{p}_{T}(D^{#minus}) (GeV/#it{c});D^{#minus} candidate cos(#vartheta_{P}^{XY});entries", {HistType::kTH2F, {axisPtDminus, axisCosp}}); + registry.add("hInvMassD", Form("B^{0} candidates;#it{p}_{T}(%s) (GeV/#it{c});prong0, #it{M}(K#pi) (GeV/#it{c}^{2});entries", dMesSpecie.c_str()), {HistType::kTH2F, {axisPtDminus, axisMass}}); + registry.add("hDecLengthD", Form("B^{0} candidates;#it{p}_{T}(%s) (GeV/#it{c});%s candidate decay length (cm);entries", dMesSpecie.c_str(), dMesSpecie.c_str()), {HistType::kTH2F, {axisPtDminus, axisDecayLength}}); + registry.add("hDecLengthXyD", Form("B^{0} candidates;#it{p}_{T}(%s) (GeV/#it{c});decay length XY (cm);entries", dMesSpecie.c_str()), {HistType::kTH2F, {axisPtDminus, axisDecayLength}}); + registry.add("hCospD", Form("B^{0} candidates;#it{p}_{T}(%s) (GeV/#it{c});%s candidate cos(#vartheta_{P});entries", dMesSpecie.c_str(), dMesSpecie.c_str()), {HistType::kTH2F, {axisPtDminus, axisCosp}}); + registry.add("hCospXyD", Form("B^{0} candidates;#it{p}_{T}(%s) (GeV/#it{c});%s candidate cos(#vartheta_{P}^{XY});entries", dMesSpecie.c_str(), dMesSpecie.c_str()), {HistType::kTH2F, {axisPtDminus, axisCosp}}); + if ((std::accumulate(processFuncDplusPi.begin(), processFuncDplusPi.end(), 0)) > 0) { + registry.add("hImpParProd", "B^{0} candidates;#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate impact parameter product;entries", {HistType::kTH2F, {axisPtB0, axisImpParProd}}); + registry.add("hPtProng0", Form("B^{0} candidates;#it{p}_{T}(B^{0}) (GeV/#it{c});#it{p}_{T}(%s) (GeV/#it{c});entries", dMesSpecie.c_str()), {HistType::kTH2F, {axisPtB0, axisPtDminus}}); + registry.add("hPtProng1", "B^{0} candidates;#it{p}_{T}(B^{0}) (GeV/#it{c});#it{p}_{T}(#pi^{#plus}) (GeV/#it{c});entries", {HistType::kTH2F, {axisPtB0, axisPtPi}}); + } else { + registry.add("hImpParProngSqSum", "B^{0} candidates;#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate impact parameter sum;entries", {HistType::kTH2F, {axisPtB0, axisImpParProngSqSum}}); + registry.add("hPtProngD0", Form("B^{0} candidates;#it{p}_{T}(B^{0}) (GeV/#it{c});#it{p}_{T}(%s) (GeV/#it{c});entries", dMesSpecie.c_str()), {HistType::kTH2F, {axisPtB0, axisPtDminus}}); + registry.add("hPtProngSoftPi", "B^{0} candidates;#it{p}_{T}(B^{0}) (GeV/#it{c});#it{p}_{T}(#pi^{#plus}) (GeV/#it{c});entries", {HistType::kTH2F, {axisPtB0, axisPtSoftPi}}); + registry.add("hPtProngBachPi", "B^{0} candidates;#it{p}_{T}(B^{0}) (GeV/#it{c});#it{p}_{T}(#pi^{#plus}) (GeV/#it{c});entries", {HistType::kTH2F, {axisPtB0, axisPtPi}}); + registry.add("hDcaProng2", "B^{0} candidates;#it{p}_{T}(B^{0}) (GeV/#it{c});prong 2 (#pi^{#plus}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {axisPtB0, axisDca}}); + } // ML scores of D- daughter - if (doprocessDataWithDmesMl) { - registry.add("hMlScoreBkgD", "B^{0} candidates;#it{p}_{T}(D^{#minus}) (GeV/#it{c});prong0, D^{#minus} ML background score;entries", {HistType::kTH2F, {axisPtDminus, axisMlScore}}); - registry.add("hMlScorePromptD", "B^{0} candidates;#it{p}_{T}(D^{#minus}) (GeV/#it{c});prong0, D^{#minus} ML prompt score;entries", {HistType::kTH2F, {axisPtDminus, axisMlScore}}); - registry.add("hMlScoreNonPromptD", "B^{0} candidates;#it{p}_{T}(D^{#minus}) (GeV/#it{c});prong0, D^{#minus} ML nonprompt score;entries", {HistType::kTH2F, {axisPtDminus, axisMlScore}}); + if (doprocessDataDplusPiWithDmesMl || doprocessDataDstarPiWithDmesMl) { + registry.add("hMlScoreBkgD", Form("B^{0} candidates;#it{p}_{T}(%s) (GeV/#it{c});prong0, %s ML background score;entries", dMesSpecie.c_str(), dMesSpecie.c_str()), {HistType::kTH2F, {axisPtDminus, axisMlScore}}); + registry.add("hMlScorePromptD", Form("B^{0} candidates;#it{p}_{T}(%s) (GeV/#it{c});prong0, %s ML prompt score;entries", dMesSpecie.c_str(), dMesSpecie.c_str()), {HistType::kTH2F, {axisPtDminus, axisMlScore}}); + registry.add("hMlScoreNonPromptD", Form("B^{0} candidates;#it{p}_{T}(%s) (GeV/#it{c});prong0, %s ML nonprompt score;entries", dMesSpecie.c_str(), dMesSpecie.c_str()), {HistType::kTH2F, {axisPtDminus, axisMlScore}}); } // ML scores of B0 candidate - if (doprocessDataWithB0Ml) { + if (doprocessDataDplusPiWithB0Ml) { registry.add("hMlScoreSigB0", "B^{0} candidates;#it{p}_{T}(B^{0}) (GeV/#it{c});prong0, B^{0} ML signal score;entries", {HistType::kTH2F, {axisPtB0, axisMlScore}}); } } if (fillSparses) { - if (!(doprocessDataWithDmesMl || doprocessDataWithB0Ml)) { - registry.add("hMassPtCutVars", "B^{0} candidates;#it{M} (D#pi) (GeV/#it{c}^{2});#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate decay length (cm);B^{0} candidate norm. decay length XY (cm);B^{0} candidate impact parameter product (cm);B^{0} candidate cos(#vartheta_{P});#it{M} (K#pi) (GeV/#it{c}^{2});#it{p}_{T}(D^{#minus}) (GeV/#it{c});D^{#minus} candidate decay length (cm);D^{#minus} candidate cos(#vartheta_{P})", {HistType::kTHnSparseF, {axisMassB0, axisPtB0, axisDecayLength, axisNormDecayLength, axisImpParProd, axisCosp, axisMassDminus, axisPtDminus, axisDecayLength, axisCosp}}); + if (!(doprocessDataDplusPiWithDmesMl || doprocessDataDplusPiWithB0Ml || doprocessDataDstarPiWithDmesMl)) { + if ((std::accumulate(processFuncDplusPi.begin(), processFuncDplusPi.end(), 0)) > 0) { + registry.add("hMassPtCutVars", "B^{0} candidates;#it{M} (D#pi) (GeV/#it{c}^{2});#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate decay length (cm);B^{0} candidate norm. decay length XY (cm);B^{0} candidate impact parameter product (cm);B^{0} candidate cos(#vartheta_{P});#it{M} (K#pi) (GeV/#it{c}^{2});#it{p}_{T}(%s) (GeV/#it{c});%s candidate decay length (cm);%s candidate cos(#vartheta_{P})", {HistType::kTHnSparseF, {axisMassB0, axisPtB0, axisDecayLength, axisNormDecayLength, axisImpParProd, axisCosp, axisMass, axisPtDminus, axisDecayLength, axisCosp}}); + } else { + registry.add("hMassPtCutVars", "B^{0} candidates;#it{M} (D#pi) (GeV/#it{c}^{2});#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate decay length (cm);B^{0} candidate norm. decay length XY (cm);B^{0} candidate impact parameter product (cm);B^{0} candidate cos(#vartheta_{P});#it{M} (K#pi) (GeV/#it{c}^{2});#it{p}_{T}(%s) (GeV/#it{c});%s candidate decay length (cm);%s candidate cos(#vartheta_{P})", {HistType::kTHnSparseF, {axisMassB0, axisPtB0, axisDecayLength, axisNormDecayLength, axisImpParProngSqSum, axisCosp, axisMass, axisPtDminus, axisDecayLength, axisCosp}}); + } } else { - registry.add("hMassPtCutVars", "B^{0} candidates;#it{M} (D#pi) (GeV/#it{c}^{2});#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate decay length (cm);B^{0} candidate norm. decay length XY (cm);B^{0} candidate impact parameter product (cm);B^{0} candidate cos(#vartheta_{P});#it{M} (K#pi) (GeV/#it{c}^{2});#it{p}_{T}(D^{#minus}) (GeV/#it{c});D^{#minus} candidate ML score bkg;D^{#minus} candidate ML score nonprompt", {HistType::kTHnSparseF, {axisMassB0, axisPtB0, axisDecayLength, axisNormDecayLength, axisImpParProd, axisCosp, axisMassDminus, axisPtDminus, axisMlScore, axisMlScore}}); + if ((std::accumulate(processFuncDplusPi.begin(), processFuncDplusPi.end(), 0)) > 0) { + registry.add("hMassPtCutVars", "B^{0} candidates;#it{M} (D#pi) (GeV/#it{c}^{2});#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate decay length (cm);B^{0} candidate norm. decay length XY (cm);B^{0} candidate impact parameter product (cm);B^{0} candidate cos(#vartheta_{P});#it{M} (K#pi) (GeV/#it{c}^{2});#it{p}_{T}(%s) (GeV/#it{c});%s candidate ML score bkg;%s candidate ML score nonprompt", {HistType::kTHnSparseF, {axisMassB0, axisPtB0, axisDecayLength, axisNormDecayLength, axisImpParProd, axisCosp, axisMass, axisPtDminus, axisMlScore, axisMlScore}}); + } else { + registry.add("hMassPtCutVars", "B^{0} candidates;#it{M} (D#pi) (GeV/#it{c}^{2});#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate decay length (cm);B^{0} candidate norm. decay length XY (cm);B^{0} candidate impact parameter product (cm);B^{0} candidate cos(#vartheta_{P});#it{M} (K#pi) (GeV/#it{c}^{2});#it{p}_{T}(%s) (GeV/#it{c});%s candidate ML score bkg;%s candidate ML score nonprompt", {HistType::kTHnSparseF, {axisMassB0, axisPtB0, axisDecayLength, axisNormDecayLength, axisImpParProngSqSum, axisCosp, axisMass, axisPtDminus, axisMlScore, axisMlScore}}); + } } } } - if (doprocessMc || doprocessMcWithDecayTypeCheck || doprocessMcWithDmesMl || doprocessMcWithDmesMlAndDecayTypeCheck || doprocessMcWithB0Ml || doprocessMcWithB0MlAndDecayTypeCheck) { + if (doprocessMcDplusPi || doprocessMcDplusPiWithDecayTypeCheck || doprocessMcDplusPiWithDmesMl || doprocessMcDplusPiWithDmesMlAndDecayTypeCheck || doprocessMcDplusPiWithB0Ml || doprocessMcDplusPiWithB0MlAndDecayTypeCheck || + doprocessMcDstarPi || doprocessMcDstarPiWithDmesMl) { if (fillHistograms) { // gen histos registry.add("hEtaGen", "B^{0} particles (generated);#it{p}_{T}^{gen}(B^{0}) (GeV/#it{c});#it{#eta}^{gen}(B^{0});entries", {HistType::kTH2F, {axisPtB0, axisEta}}); registry.add("hYGen", "B^{0} particles (generated);#it{p}_{T}^{gen}(B^{0}) (GeV/#it{c});#it{y}^{gen}(B^{0});entries", {HistType::kTH2F, {axisPtB0, axisEta}}); registry.add("hYGenWithProngsInAcceptance", "MC particles (generated-daughters in acceptance);#it{p}_{T}^{gen}(B^{0}) (GeV/#it{c});#it{y}^{gen}(B^{0});entries", {HistType::kTH2F, {axisPtB0, axisEta}}); - registry.add("hPtProng0Gen", "B^{0} particles (generated);#it{p}_{T}^{gen}(B^{0}) (GeV/#it{c});#it{p}_{T}^{gen}(D^{#minus}) (GeV/#it{c});entries", {HistType::kTH2F, {axisPtB0, axisPtDminus}}); + registry.add("hPtProng0Gen", Form("B^{0} particles (generated);#it{p}_{T}^{gen}(B^{0}) (GeV/#it{c});#it{p}_{T}^{gen}(%s) (GeV/#it{c});entries", dMesSpecie.c_str()), {HistType::kTH2F, {axisPtB0, axisPtDminus}}); registry.add("hPtProng1Gen", "B^{0} particles (generated);#it{p}_{T}^{gen}(B^{0}) (GeV/#it{c});#it{p}_{T}^{gen}(#pi^{#plus}) (GeV/#it{c});entries", {HistType::kTH2F, {axisPtB0, axisPtPi}}); - registry.add("hYProng0Gen", "B^{0} particles (generated);#it{p}_{T}^{gen}(B^{0}) (GeV/#it{c});#it{y}^{gen}(D^{#minus});entries", {HistType::kTH2F, {axisPtB0, axisEta}}); + registry.add("hYProng0Gen", Form("B^{0} particles (generated);#it{p}_{T}^{gen}(B^{0}) (GeV/#it{c});#it{y}^{gen}(%s);entries", dMesSpecie.c_str()), {HistType::kTH2F, {axisPtB0, axisEta}}); registry.add("hYProng1Gen", "B^{0} particles (generated);#it{p}_{T}^{gen}(B^{0}) (GeV/#it{c});#it{y}^{gen}(#pi^{#plus});entries", {HistType::kTH2F, {axisPtB0, axisEta}}); - registry.add("hEtaProng0Gen", "B^{0} particles (generated);#it{p}_{T}^{gen}(B^{0}) (GeV/#it{c});#it{#eta}^{gen}(D^{#minus});entries", {HistType::kTH2F, {axisPtB0, axisEta}}); + registry.add("hEtaProng0Gen", Form("B^{0} particles (generated);#it{p}_{T}^{gen}(B^{0}) (GeV/#it{c});#it{#eta}^{gen}(%s);entries", dMesSpecie.c_str()), {HistType::kTH2F, {axisPtB0, axisEta}}); registry.add("hEtaProng1Gen", "B^{0} particles (generated);#it{p}_{T}^{gen}(B^{0}) (GeV/#it{c});#it{#eta}^{gen}(#pi^{#plus});entries", {HistType::kTH2F, {axisPtB0, axisEta}}); // reco histos @@ -284,49 +321,68 @@ struct HfTaskB0Reduced { registry.add("hDecLengthRecSig", "B^{0} candidates (matched);#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate decay length (cm);entries", {HistType::kTH2F, {axisPtB0, axisDecayLength}}); registry.add("hDecLengthXyRecSig", "B^{0} candidates (matched);#it{p}_{T}(B^{0}) (GeV/#it{c});decay length XY (cm);entries", {HistType::kTH2F, {axisPtB0, axisDecayLength}}); registry.add("hNormDecLengthXyRecSig", "B^{0} candidates (matched);#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate norm. decay length XY (cm);entries", {HistType::kTH2F, {axisPtB0, axisNormDecayLength}}); - registry.add("hDcaProng0RecSig", "B^{0} candidates (matched);#it{p}_{T}(B^{0}) (GeV/#it{c});prong 0 (D^{#minus}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {axisPtB0, axisDca}}); + registry.add("hDcaProng0RecSig", Form("B^{0} candidates (matched);#it{p}_{T}(B^{0}) (GeV/#it{c});prong 0 (%s) DCAxy to prim. vertex (cm);entries", dMesSpecie.c_str()), {HistType::kTH2F, {axisPtB0, axisDca}}); registry.add("hDcaProng1RecSig", "B^{0} candidates (matched);#it{p}_{T}(B^{0}) (GeV/#it{c});prong 1 (#pi^{#plus}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {axisPtB0, axisDca}}); - registry.add("hPtProng0RecSig", "B^{0} candidates (matched);#it{p}_{T}(B^{0}) (GeV/#it{c});#it{p}_{T}(D^{#minus}) (GeV/#it{c});entries", {HistType::kTH2F, {axisPtB0, axisPtDminus}}); - registry.add("hPtProng1RecSig", "B^{0} candidates (matched);#it{p}_{T}(B^{0}) (GeV/#it{c});#it{p}_{T}(#pi^{#plus}) (GeV/#it{c});entries", {HistType::kTH2F, {axisPtB0, axisPtPi}}); registry.add("hCospRecSig", "B^{0} candidates (matched);#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate cos(#vartheta_{P});entries", {HistType::kTH2F, {axisPtB0, axisCosp}}); registry.add("hCospXyRecSig", "B^{0} candidates (matched);#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate cos(#vartheta_{P}^{XY});entries", {HistType::kTH2F, {axisPtB0, axisCosp}}); registry.add("hEtaRecSig", "B^{0} candidates (matched);#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate #it{#eta};entries", {HistType::kTH2F, {axisPtB0, axisEta}}); registry.add("hRapidityRecSig", "B^{0} candidates (matched);#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate #it{y};entries", {HistType::kTH2F, {axisPtB0, axisEta}}); - registry.add("hImpParProdRecSig", "B^{0} candidates (matched);#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate impact parameter product;entries", {HistType::kTH2F, {axisPtB0, axisImpParProd}}); - registry.add("hInvMassDRecSig", "B^{0} candidates (matched);#it{p}_{T}(D^{#minus}) (GeV/#it{c});prong0, #it{M}(K#pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPtDminus, axisMassDminus}}); - registry.add("hDecLengthDRecSig", "B^{0} candidates (matched);#it{p}_{T}(D^{#minus}) (GeV/#it{c});D^{#minus} candidate decay length (cm);entries", {HistType::kTH2F, {axisPtDminus, axisDecayLength}}); - registry.add("hDecLengthXyDRecSig", "B^{0} candidates (matched);#it{p}_{T}(D^{#minus}) (GeV/#it{c});decay length XY (cm);entries", {HistType::kTH2F, {axisPtDminus, axisDecayLength}}); - registry.add("hCospDRecSig", "B^{0} candidates (matched);#it{p}_{T}(D^{#minus}) (GeV/#it{c});D^{#minus} candidate cos(#vartheta_{P});entries", {HistType::kTH2F, {axisPtDminus, axisCosp}}); - registry.add("hCospXyDRecSig", "B^{0} candidates (matched);#it{p}_{T}(D^{#minus}) (GeV/#it{c});D^{#minus} candidate cos(#vartheta_{P}^{XY});entries", {HistType::kTH2F, {axisPtDminus, axisCosp}}); + registry.add("hInvMassDRecSig", Form("B^{0} candidates (matched);#it{p}_{T}(%s) (GeV/#it{c});prong0, #it{M}(K#pi) (GeV/#it{c}^{2});entries", dMesSpecie.c_str()), {HistType::kTH2F, {axisPtDminus, axisMass}}); + registry.add("hDecLengthDRecSig", Form("B^{0} candidates (matched);#it{p}_{T}(%s) (GeV/#it{c});%s candidate decay length (cm);entries", dMesSpecie.c_str(), dMesSpecie.c_str()), {HistType::kTH2F, {axisPtDminus, axisDecayLength}}); + registry.add("hDecLengthXyDRecSig", Form("B^{0} candidates (matched);#it{p}_{T}(%s) (GeV/#it{c});decay length XY (cm);entries", dMesSpecie.c_str()), {HistType::kTH2F, {axisPtDminus, axisDecayLength}}); + registry.add("hCospDRecSig", Form("B^{0} candidates (matched);#it{p}_{T}(%s) (GeV/#it{c});%s candidate cos(#vartheta_{P});entries", dMesSpecie.c_str(), dMesSpecie.c_str()), {HistType::kTH2F, {axisPtDminus, axisCosp}}); + registry.add("hCospXyDRecSig", Form("B^{0} candidates (matched);#it{p}_{T}(%s) (GeV/#it{c});%s candidate cos(#vartheta_{P}^{XY});entries", dMesSpecie.c_str(), dMesSpecie.c_str()), {HistType::kTH2F, {axisPtDminus, axisCosp}}); + + if ((std::accumulate(processFuncDplusPi.begin(), processFuncDplusPi.end(), 0)) > 0) { + registry.add("hPtProng0RecSig", Form("B^{0} candidates (matched);#it{p}_{T}(B^{0}) (GeV/#it{c});#it{p}_{T}(%s) (GeV/#it{c});entries", dMesSpecie.c_str()), {HistType::kTH2F, {axisPtB0, axisPtDminus}}); + registry.add("hPtProng1RecSig", "B^{0} candidates (matched);#it{p}_{T}(B^{0}) (GeV/#it{c});#it{p}_{T}(#pi^{#plus}) (GeV/#it{c});entries", {HistType::kTH2F, {axisPtB0, axisPtPi}}); + registry.add("hImpParProdRecSig", "B^{0} candidates (matched);#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate impact parameter product;entries", {HistType::kTH2F, {axisPtB0, axisImpParProd}}); + } else { + registry.add("hPtProngD0RecSig", Form("B^{0} candidates (matched);#it{p}_{T}(B^{0}) (GeV/#it{c});#it{p}_{T}(%s) (GeV/#it{c});entries", dMesSpecie.c_str()), {HistType::kTH2F, {axisPtB0, axisPtDminus}}); + registry.add("hPtProngSoftPiRecSig", "B^{0} candidates (matched);#it{p}_{T}(B^{0}) (GeV/#it{c});#it{p}_{T}(#pi^{#plus}) (GeV/#it{c});entries", {HistType::kTH2F, {axisPtB0, axisPtSoftPi}}); + registry.add("hPtProngBachPiRecSig", "B^{0} candidates (matched);#it{p}_{T}(B^{0}) (GeV/#it{c});#it{p}_{T}(#pi^{#plus}) (GeV/#it{c});entries", {HistType::kTH2F, {axisPtB0, axisPtPi}}); + registry.add("hDcaProng2RecSig", "B^{0} candidates (matched);#it{p}_{T}(B^{0}) (GeV/#it{c});prong 2 (#pi^{#minus}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {axisPtB0, axisDca}}); + registry.add("hImpParProngSqSumRecSig", "B^{0} candidates (matched);#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate impact parameter product;entries", {HistType::kTH2F, {axisPtB0, axisImpParProngSqSum}}); + } + // background if (fillBackground) { registry.add("hMassRecBg", "B^{0} candidates (unmatched);#it{p}_{T}(B^{0}) (GeV/#it{c});#it{M} (D#pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPtB0, axisMassB0}}); registry.add("hDecLengthRecBg", "B^{0} candidates (unmatched);#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate decay length (cm);entries", {HistType::kTH2F, {axisPtB0, axisDecayLength}}); registry.add("hDecLengthXyRecBg", "B^{0} candidates (unmatched);#it{p}_{T}(B^{0}) (GeV/#it{c});decay length XY (cm);entries", {HistType::kTH2F, {axisPtB0, axisDecayLength}}); registry.add("hNormDecLengthXyRecBg", "B^{0} candidates (unmatched);#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate norm. decay length XY (cm);entries", {HistType::kTH2F, {axisPtB0, axisNormDecayLength}}); - registry.add("hDcaProng0RecBg", "B^{0} candidates (unmatched);#it{p}_{T}(B^{0}) (GeV/#it{c});prong 0 (D^{#minus}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {axisPtB0, axisDca}}); + registry.add("hDcaProng0RecBg", Form("B^{0} candidates (unmatched);#it{p}_{T}(B^{0}) (GeV/#it{c});prong 0 (%s) DCAxy to prim. vertex (cm);entries", dMesSpecie.c_str()), {HistType::kTH2F, {axisPtB0, axisDca}}); registry.add("hDcaProng1RecBg", "B^{0} candidates (unmatched);#it{p}_{T}(B^{0}) (GeV/#it{c});prong 1 (#pi^{#plus}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {axisPtB0, axisDca}}); - registry.add("hPtProng0RecBg", "B^{0} candidates (unmatched);#it{p}_{T}(B^{0}) (GeV/#it{c});#it{p}_{T}(D^{#minus}) (GeV/#it{c});entries", {HistType::kTH2F, {axisPtB0, axisPtDminus}}); - registry.add("hPtProng1RecBg", "B^{0} candidates (unmatched);#it{p}_{T}(B^{0}) (GeV/#it{c});#it{p}_{T}(#pi^{#plus}) (GeV/#it{c});entries", {HistType::kTH2F, {axisPtB0, axisPtPi}}); registry.add("hCospRecBg", "B^{0} candidates (unmatched);#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate cos(#vartheta_{P});entries", {HistType::kTH2F, {axisPtB0, axisCosp}}); registry.add("hCospXyRecBg", "B^{0} candidates (unmatched);#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate cos(#vartheta_{P}^{XY});entries", {HistType::kTH2F, {axisPtB0, axisCosp}}); registry.add("hEtaRecBg", "B^{0} candidates (unmatched);#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate #it{#eta};entries", {HistType::kTH2F, {axisPtB0, axisEta}}); registry.add("hRapidityRecBg", "B^{0} candidates (unmatched);#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate #it{y};entries", {HistType::kTH2F, {axisPtB0, axisEta}}); - registry.add("hImpParProdRecBg", "B^{0} candidates (unmatched);#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate impact parameter product;entries", {HistType::kTH2F, {axisPtB0, axisImpParProd}}); - registry.add("hInvMassDRecBg", "B^{0} candidates (unmatched);#it{p}_{T}(D^{#minus}) (GeV/#it{c});prong0, #it{M}(K#pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPtDminus, axisMassDminus}}); - registry.add("hDecLengthDRecBg", "B^{0} candidates (unmatched);#it{p}_{T}(D^{#minus}) (GeV/#it{c});D^{#minus} candidate decay length (cm);entries", {HistType::kTH2F, {axisPtDminus, axisDecayLength}}); - registry.add("hDecLengthXyDRecBg", "B^{0} candidates (unmatched);#it{p}_{T}(D^{#minus}) (GeV/#it{c});decay length XY (cm);entries", {HistType::kTH2F, {axisPtDminus, axisDecayLength}}); - registry.add("hCospDRecBg", "B^{0} candidates (unmatched);#it{p}_{T}(D^{#minus}) (GeV/#it{c});D^{#minus} candidate cos(#vartheta_{P});entries", {HistType::kTH2F, {axisPtDminus, axisCosp}}); - registry.add("hCospXyDRecBg", "B^{0} candidates (unmatched);#it{p}_{T}(D^{#minus}) (GeV/#it{c});D^{#minus} candidate cos(#vartheta_{P}^{XY});entries", {HistType::kTH2F, {axisPtDminus, axisCosp}}); + registry.add("hInvMassDRecBg", Form("B^{0} candidates (unmatched);#it{p}_{T}(%s) (GeV/#it{c});prong0, #it{M}(K#pi) (GeV/#it{c}^{2});entries", dMesSpecie.c_str()), {HistType::kTH2F, {axisPtDminus, axisMass}}); + registry.add("hDecLengthDRecBg", Form("B^{0} candidates (unmatched);#it{p}_{T}(%s) (GeV/#it{c});%s candidate decay length (cm);entries", dMesSpecie.c_str(), dMesSpecie.c_str()), {HistType::kTH2F, {axisPtDminus, axisDecayLength}}); + registry.add("hDecLengthXyDRecBg", Form("B^{0} candidates (unmatched);#it{p}_{T}(%s) (GeV/#it{c});decay length XY (cm);entries", dMesSpecie.c_str()), {HistType::kTH2F, {axisPtDminus, axisDecayLength}}); + registry.add("hCospDRecBg", Form("B^{0} candidates (unmatched);#it{p}_{T}(%s) (GeV/#it{c});%s candidate cos(#vartheta_{P});entries", dMesSpecie.c_str(), dMesSpecie.c_str()), {HistType::kTH2F, {axisPtDminus, axisCosp}}); + registry.add("hCospXyDRecBg", Form("B^{0} candidates (unmatched);#it{p}_{T}(%s) (GeV/#it{c});%s candidate cos(#vartheta_{P}^{XY});entries", dMesSpecie.c_str(), dMesSpecie.c_str()), {HistType::kTH2F, {axisPtDminus, axisCosp}}); + + if ((std::accumulate(processFuncDplusPi.begin(), processFuncDplusPi.end(), 0)) > 0) { + registry.add("hPtProng0RecBg", Form("B^{0} candidates (unmatched);#it{p}_{T}(B^{0}) (GeV/#it{c});#it{p}_{T}(%s) (GeV/#it{c});entries", dMesSpecie.c_str()), {HistType::kTH2F, {axisPtB0, axisPtDminus}}); + registry.add("hPtProng1RecBg", "B^{0} candidates (unmatched);#it{p}_{T}(B^{0}) (GeV/#it{c});#it{p}_{T}(#pi^{#plus}) (GeV/#it{c});entries", {HistType::kTH2F, {axisPtB0, axisPtPi}}); + registry.add("hImpParProdRecBg", "B^{0} candidates (unmatched);#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate impact parameter product;entries", {HistType::kTH2F, {axisPtB0, axisImpParProd}}); + } else { + registry.add("hPtProngD0RecBg", Form("B^{0} candidates (unmatched);#it{p}_{T}(B^{0}) (GeV/#it{c});#it{p}_{T}(%s) (GeV/#it{c});entries", dMesSpecie.c_str()), {HistType::kTH2F, {axisPtB0, axisPtDminus}}); + registry.add("hPtProngSoftPiRecBg", "B^{0} candidates (unmatched);#it{p}_{T}(B^{0}) (GeV/#it{c});#it{p}_{T}(#pi^{#plus}) (GeV/#it{c});entries", {HistType::kTH2F, {axisPtB0, axisPtSoftPi}}); + registry.add("hPtProngBachPiRecBg", "B^{0} candidates (unmatched);#it{p}_{T}(B^{0}) (GeV/#it{c});#it{p}_{T}(#pi^{#plus}) (GeV/#it{c});entries", {HistType::kTH2F, {axisPtB0, axisPtPi}}); + registry.add("hImpParProngSqSumRecBg", "B^{0} candidates (unmatched);#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate impact parameter product;entries", {HistType::kTH2F, {axisPtB0, axisImpParProngSqSum}}); + registry.add("hDcaProng2RecBg", "B^{0} candidates (unmatched);#it{p}_{T}(B^{0}) (GeV/#it{c});prong 2 (#pi^{#plus}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {axisPtB0, axisDca}}); + } } // MC checks - if (doprocessMcWithDecayTypeCheck || doprocessMcWithB0MlAndDecayTypeCheck || doprocessMcWithDmesMlAndDecayTypeCheck) { + if (doprocessMcDplusPiWithDecayTypeCheck || doprocessMcDplusPiWithB0MlAndDecayTypeCheck || doprocessMcDplusPiWithDmesMlAndDecayTypeCheck) { constexpr uint8_t kNBinsDecayTypeMc = hf_cand_b0::DecayTypeMc::NDecayTypeMc; TString labels[kNBinsDecayTypeMc]; - labels[hf_cand_b0::DecayTypeMc::B0ToDplusPiToPiKPiPi] = "B^{0} #rightarrow (D^{#minus} #rightarrow #pi^{#minus} K^{#plus} #pi^{#minus}) #pi^{#plus}"; - labels[hf_cand_b0::DecayTypeMc::B0ToDsPiToKKPiPi] = "B^{0} #rightarrow (D^{#minus}_{s} #rightarrow K^{#minus} K^{#plus} #pi^{#minus}) #pi^{#plus}"; - labels[hf_cand_b0::DecayTypeMc::BsToDsPiToKKPiPi] = "B_{s}^{0} #rightarrow (D^{#minus}_{s} #rightarrow K^{#minus} K^{#plus} #pi^{#minus}) #pi^{#plus}"; - labels[hf_cand_b0::DecayTypeMc::B0ToDplusKToPiKPiK] = "B^{0} #rightarrow (D^{#minus} #rightarrow #pi^{#minus} K^{#plus} #pi^{#minus}) K^{#plus}"; + labels[hf_cand_b0::DecayTypeMc::B0ToDplusPiToPiKPiPi] = Form("B^{0} #rightarrow (%s #rightarrow #pi^{#minus} K^{#plus} #pi^{#minus}) #pi^{#plus}", dMesSpecie.c_str()); + labels[hf_cand_b0::DecayTypeMc::B0ToDsPiToKKPiPi] = Form("B^{0} #rightarrow (%s_{s} #rightarrow K^{#minus} K^{#plus} #pi^{#minus}) #pi^{#plus}", dMesSpecie.c_str()); + labels[hf_cand_b0::DecayTypeMc::BsToDsPiToKKPiPi] = Form("B_{s}^{0} #rightarrow (%s_{s} #rightarrow K^{#minus} K^{#plus} #pi^{#minus}) #pi^{#plus}", dMesSpecie.c_str()); + labels[hf_cand_b0::DecayTypeMc::B0ToDplusKToPiKPiK] = Form("B^{0} #rightarrow (%s #rightarrow #pi^{#minus} K^{#plus} #pi^{#minus}) K^{#plus}", dMesSpecie.c_str()); labels[hf_cand_b0::DecayTypeMc::PartlyRecoDecay] = "Partly reconstructed decay channel"; labels[hf_cand_b0::DecayTypeMc::OtherDecay] = "Other decays"; static const AxisSpec axisDecayType = {kNBinsDecayTypeMc, 0.5, kNBinsDecayTypeMc + 0.5, ""}; @@ -336,18 +392,18 @@ struct HfTaskB0Reduced { } } // ML scores of D- daughter - if (doprocessMcWithDmesMl || doprocessMcWithDmesMlAndDecayTypeCheck) { + if (doprocessMcDplusPiWithDmesMl || doprocessMcDplusPiWithDmesMlAndDecayTypeCheck || doprocessMcDstarPiWithDmesMl) { // signal - registry.add("hMlScoreBkgDRecSig", "B^{0} candidates (matched);#it{p}_{T}(D^{#minus}) (GeV/#it{c});prong0, D^{#minus} ML background score;entries", {HistType::kTH2F, {axisPtDminus, axisMlScore}}); - registry.add("hMlScorePromptDRecSig", "B^{0} candidates (matched);#it{p}_{T}(D^{#minus}) (GeV/#it{c});prong0, D^{#minus} ML prompt score;entries", {HistType::kTH2F, {axisPtDminus, axisMlScore}}); - registry.add("hMlScoreNonPromptDRecSig", "B^{0} candidates (matched);#it{p}_{T}(D^{#minus}) (GeV/#it{c});prong0, D^{#minus} ML nonprompt score;entries", {HistType::kTH2F, {axisPtDminus, axisMlScore}}); + registry.add("hMlScoreBkgDRecSig", Form("B^{0} candidates (matched);#it{p}_{T}(%s) (GeV/#it{c});prong0, %s ML background score;entries", dMesSpecie.c_str(), dMesSpecie.c_str()), {HistType::kTH2F, {axisPtDminus, axisMlScore}}); + registry.add("hMlScorePromptDRecSig", Form("B^{0} candidates (matched);#it{p}_{T}(%s) (GeV/#it{c});prong0, %s ML prompt score;entries", dMesSpecie.c_str(), dMesSpecie.c_str()), {HistType::kTH2F, {axisPtDminus, axisMlScore}}); + registry.add("hMlScoreNonPromptDRecSig", Form("B^{0} candidates (matched);#it{p}_{T}(%s) (GeV/#it{c});prong0, %s ML nonprompt score;entries", dMesSpecie.c_str(), dMesSpecie.c_str()), {HistType::kTH2F, {axisPtDminus, axisMlScore}}); // background - registry.add("hMlScoreBkgDRecBg", "B^{0} candidates (unmatched);#it{p}_{T}(D^{#minus}) (GeV/#it{c});prong0, D^{#minus} ML background score;entries", {HistType::kTH2F, {axisPtDminus, axisMlScore}}); - registry.add("hMlScorePromptDRecBg", "B^{0} candidates (unmatched);#it{p}_{T}(D^{#minus}) (GeV/#it{c});prong0, D^{#minus} ML prompt score;entries", {HistType::kTH2F, {axisPtDminus, axisMlScore}}); - registry.add("hMlScoreNonPromptDRecBg", "B^{0} candidates (unmatched);#it{p}_{T}(D^{#minus}) (GeV/#it{c});prong0, D^{#minus} ML nonprompt score;entries", {HistType::kTH2F, {axisPtDminus, axisMlScore}}); + registry.add("hMlScoreBkgDRecBg", Form("B^{0} candidates (unmatched);#it{p}_{T}(%s) (GeV/#it{c});prong0, %s ML background score;entries", dMesSpecie.c_str(), dMesSpecie.c_str()), {HistType::kTH2F, {axisPtDminus, axisMlScore}}); + registry.add("hMlScorePromptDRecBg", Form("B^{0} candidates (unmatched);#it{p}_{T}(%s) (GeV/#it{c});prong0, %s ML prompt score;entries", dMesSpecie.c_str(), dMesSpecie.c_str()), {HistType::kTH2F, {axisPtDminus, axisMlScore}}); + registry.add("hMlScoreNonPromptDRecBg", Form("B^{0} candidates (unmatched);#it{p}_{T}(%s) (GeV/#it{c});prong0, %s ML nonprompt score;entries", dMesSpecie.c_str(), dMesSpecie.c_str()), {HistType::kTH2F, {axisPtDminus, axisMlScore}}); } // ML scores of B0 candidate - if (doprocessMcWithB0Ml || doprocessMcWithB0MlAndDecayTypeCheck) { + if (doprocessMcDplusPiWithB0Ml || doprocessMcDplusPiWithB0MlAndDecayTypeCheck) { // signal registry.add("hMlScoreSigB0RecSig", "B^{0} candidates (matched);#it{p}_{T}(B^{0}) (GeV/#it{c});prong0, B^{0} ML signal score;entries", {HistType::kTH2F, {axisPtB0, axisMlScore}}); // background @@ -360,15 +416,15 @@ struct HfTaskB0Reduced { registry.add("hPtYWithProngsInAccepanceGenSig", "B^{0} particles (generated-daughters in acceptance);#it{p}_{T}(B^{0}) (GeV/#it{c});#it{y}(B^{0})", {HistType::kTHnSparseF, {axisPtB0, axisEta}}); // reco sparses - if (!(doprocessDataWithDmesMl || doprocessDataWithB0Ml)) { - registry.add("hMassPtCutVarsRecSig", "B^{0} candidates (matched);#it{M} (D#pi) (GeV/#it{c}^{2});#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate decay length (cm);B^{0} candidate norm. decay length XY (cm);B^{0} candidate impact parameter product (cm);B^{0} candidate cos(#vartheta_{P});#it{M} (K#pi) (GeV/#it{c}^{2});#it{p}_{T}(D^{#minus}) (GeV/#it{c});D^{#minus} candidate decay length (cm);D^{#minus} candidate cos(#vartheta_{P})", {HistType::kTHnSparseF, {axisMassB0, axisPtB0, axisDecayLength, axisNormDecayLength, axisImpParProd, axisCosp, axisMassDminus, axisPtDminus, axisDecayLength, axisCosp}}); + if (!(doprocessDataDplusPiWithDmesMl || doprocessDataDplusPiWithB0Ml || doprocessDataDstarPiWithDmesMl)) { + registry.add("hMassPtCutVarsRecSig", Form("B^{0} candidates (matched);#it{M} (D#pi) (GeV/#it{c}^{2});#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate decay length (cm);B^{0} candidate norm. decay length XY (cm);B^{0} candidate impact parameter product (cm);B^{0} candidate cos(#vartheta_{P});#it{M} (K#pi) (GeV/#it{c}^{2});#it{p}_{T}(%s) (GeV/#it{c});%s candidate decay length (cm);%s candidate cos(#vartheta_{P})", dMesSpecie.c_str(), dMesSpecie.c_str(), dMesSpecie.c_str()), {HistType::kTHnSparseF, {axisMassB0, axisPtB0, axisDecayLength, axisNormDecayLength, axisImpParProd, axisCosp, axisMass, axisPtDminus, axisDecayLength, axisCosp}}); if (fillBackground) { - registry.add("hMassPtCutVarsRecBg", "B^{0} candidates (unmatched);#it{M} (D#pi) (GeV/#it{c}^{2});#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate decay length (cm);B^{0} candidate norm. decay length XY (cm);B^{0} candidate impact parameter product (cm);B^{0} candidate cos(#vartheta_{P});#it{M} (K#pi) (GeV/#it{c}^{2});#it{p}_{T}(D^{#minus}) (GeV/#it{c});D^{#minus} candidate decay length (cm);D^{#minus} candidate cos(#vartheta_{P})", {HistType::kTHnSparseF, {axisMassB0, axisPtB0, axisDecayLength, axisNormDecayLength, axisImpParProd, axisCosp, axisMassDminus, axisPtDminus, axisDecayLength, axisCosp}}); + registry.add("hMassPtCutVarsRecBg", Form("B^{0} candidates (unmatched);#it{M} (D#pi) (GeV/#it{c}^{2});#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate decay length (cm);B^{0} candidate norm. decay length XY (cm);B^{0} candidate impact parameter product (cm);B^{0} candidate cos(#vartheta_{P});#it{M} (K#pi) (GeV/#it{c}^{2});#it{p}_{T}(%s) (GeV/#it{c});%s candidate decay length (cm);%s candidate cos(#vartheta_{P})", dMesSpecie.c_str(), dMesSpecie.c_str(), dMesSpecie.c_str()), {HistType::kTHnSparseF, {axisMassB0, axisPtB0, axisDecayLength, axisNormDecayLength, axisImpParProd, axisCosp, axisMass, axisPtDminus, axisDecayLength, axisCosp}}); } } else { - registry.add("hMassPtCutVarsRecSig", "B^{0} candidates (matched);#it{M} (D#pi) (GeV/#it{c}^{2});#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate decay length (cm);B^{0} candidate norm. decay length XY (cm);B^{0} candidate impact parameter product (cm);B^{0} candidate cos(#vartheta_{P});#it{M} (K#pi) (GeV/#it{c}^{2});#it{p}_{T}(D^{#minus}) (GeV/#it{c});D^{#minus} candidate ML score bkg;D^{#minus} candidate ML score nonprompt", {HistType::kTHnSparseF, {axisMassB0, axisPtB0, axisDecayLength, axisNormDecayLength, axisImpParProd, axisCosp, axisMassDminus, axisPtDminus, axisMlScore, axisMlScore}}); + registry.add("hMassPtCutVarsRecSig", Form("B^{0} candidates (matched);#it{M} (D#pi) (GeV/#it{c}^{2});#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate decay length (cm);B^{0} candidate norm. decay length XY (cm);B^{0} candidate impact parameter product (cm);B^{0} candidate cos(#vartheta_{P});#it{M} (K#pi) (GeV/#it{c}^{2});#it{p}_{T}(%s) (GeV/#it{c});%s candidate ML score bkg;%s candidate ML score nonprompt", dMesSpecie.c_str(), dMesSpecie.c_str(), dMesSpecie.c_str()), {HistType::kTHnSparseF, {axisMassB0, axisPtB0, axisDecayLength, axisNormDecayLength, axisImpParProd, axisCosp, axisMass, axisPtDminus, axisMlScore, axisMlScore}}); if (fillBackground) { - registry.add("hMassPtCutVarsRecBg", "B^{0} candidates (unmatched);#it{M} (D#pi) (GeV/#it{c}^{2});#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate decay length (cm);B^{0} candidate norm. decay length XY (cm);B^{0} candidate impact parameter product (cm);B^{0} candidate cos(#vartheta_{P});#it{M} (K#pi) (GeV/#it{c}^{2});#it{p}_{T}(D^{#minus}) (GeV/#it{c});D^{#minus} candidate ML score bkg;D^{#minus} candidate ML score nonprompt", {HistType::kTHnSparseF, {axisMassB0, axisPtB0, axisDecayLength, axisNormDecayLength, axisImpParProd, axisCosp, axisMassDminus, axisPtDminus, axisMlScore, axisMlScore}}); + registry.add("hMassPtCutVarsRecBg", Form("B^{0} candidates (unmatched);#it{M} (D#pi) (GeV/#it{c}^{2});#it{p}_{T}(B^{0}) (GeV/#it{c});B^{0} candidate decay length (cm);B^{0} candidate norm. decay length XY (cm);B^{0} candidate impact parameter product (cm);B^{0} candidate cos(#vartheta_{P});#it{M} (K#pi) (GeV/#it{c}^{2});#it{p}_{T}(%s) (GeV/#it{c});%s candidate ML score bkg;%s candidate ML score nonprompt", dMesSpecie.c_str(), dMesSpecie.c_str(), dMesSpecie.c_str()), {HistType::kTHnSparseF, {axisMassB0, axisPtB0, axisDecayLength, axisNormDecayLength, axisImpParProd, axisCosp, axisMass, axisPtDminus, axisMlScore, axisMlScore}}); } } } @@ -385,6 +441,244 @@ struct HfTaskB0Reduced { return std::abs(etaProng) <= etaTrackMax && ptProng >= ptTrackMin; } + /// Fill candidate information at reconstruction level + /// \param doMc is the flag to enable the filling with MC information + /// \param withDecayTypeCheck is the flag to enable MC with decay type check + /// \param withDmesMl is the flag to enable the filling with ML scores for the D- daughter + /// \param withB0Ml is the flag to enable the filling with ML scores for the B0 candidate + /// \param candidate is the B0 candidate + /// \param candidatesD is the table with D- candidates + template + void fillCandDStarPi(Cand const& candidate, + SoftPions const& softPions, + CandsDmes const&) + { + auto ptCandB0 = candidate.pt(); + auto invMassB0 = hfHelper.invMassB0ToDPi(candidate); + auto candD = candidate.template prongD0_as(); + auto ptD = candidate.ptProng0(); + auto invMassD = candD.invMassHypo0(); + auto softPi = softPions.rawIteratorAt(candD.globalIndex()); + std::array posPv{candidate.posX(), candidate.posY(), candidate.posZ()}; + std::array posSvD{candD.xSecondaryVertex(), candD.ySecondaryVertex(), candD.zSecondaryVertex()}; + std::array momD{candD.pVector()}; + auto cospD = RecoDecay::cpa(posPv, posSvD, momD); + auto cospXyD = RecoDecay::cpaXY(posPv, posSvD, momD); + auto decLenD = RecoDecay::distance(posPv, posSvD); + auto decLenXyD = RecoDecay::distanceXY(posPv, posSvD); + + int8_t flagMcMatchRec = 0; + int8_t flagWrongCollision = 0; + bool isSignal = false; + if constexpr (doMc) { + flagMcMatchRec = candidate.flagMcMatchRec(); + flagWrongCollision = candidate.flagWrongCollision(); + isSignal = TESTBIT(std::abs(flagMcMatchRec), hf_cand_b0::DecayTypeMc::B0ToDstarPiToD0PiPiToKPiPiPi); + } + + if (fillHistograms) { + if constexpr (doMc) { + if (isSignal) { + registry.fill(HIST("hMassRecSig"), ptCandB0, hfHelper.invMassB0ToDPi(candidate)); + registry.fill(HIST("hPtProngD0RecSig"), ptCandB0, candidate.ptProng0()); + registry.fill(HIST("hPtProngSoftPiRecSig"), ptCandB0, candidate.ptProng1()); + registry.fill(HIST("hPtProngBachPiRecSig"), ptCandB0, candidate.ptProng2()); + registry.fill(HIST("hImpParProngSqSumRecSig"), ptCandB0, candidate.impactParameterProngSqSum()); + registry.fill(HIST("hDecLengthRecSig"), ptCandB0, candidate.decayLength()); + registry.fill(HIST("hDecLengthXyRecSig"), ptCandB0, candidate.decayLengthXY()); + registry.fill(HIST("hNormDecLengthXyRecSig"), ptCandB0, candidate.decayLengthXY() / candidate.errorDecayLengthXY()); + registry.fill(HIST("hDcaProng0RecSig"), ptCandB0, candidate.impactParameter0()); + registry.fill(HIST("hDcaProng1RecSig"), ptCandB0, candidate.impactParameter1()); + registry.fill(HIST("hDcaProng2RecSig"), ptCandB0, candidate.impactParameter2()); + registry.fill(HIST("hCospRecSig"), ptCandB0, candidate.cpa()); + registry.fill(HIST("hCospXyRecSig"), ptCandB0, candidate.cpaXY()); + registry.fill(HIST("hEtaRecSig"), ptCandB0, candidate.eta()); + registry.fill(HIST("hRapidityRecSig"), ptCandB0, hfHelper.yB0(candidate)); + registry.fill(HIST("hInvMassDRecSig"), ptD, invMassD); + registry.fill(HIST("hDecLengthDRecSig"), ptD, decLenD); + registry.fill(HIST("hDecLengthXyDRecSig"), ptD, decLenXyD); + registry.fill(HIST("hCospDRecSig"), ptD, cospD); + registry.fill(HIST("hCospXyDRecSig"), ptD, cospXyD); + if constexpr (withDmesMl) { + registry.fill(HIST("hMlScoreBkgDRecSig"), ptD, candidate.prong0MlScoreBkg()); + registry.fill(HIST("hMlScorePromptDRecSig"), ptD, candidate.prong0MlScorePrompt()); + registry.fill(HIST("hMlScoreNonPromptDRecSig"), ptD, candidate.prong0MlScoreNonprompt()); + } + } else if (fillBackground) { + registry.fill(HIST("hMassRecBg"), ptCandB0, hfHelper.invMassB0ToDPi(candidate)); + registry.fill(HIST("hPtProngD0RecBg"), ptCandB0, candidate.ptProng0()); + registry.fill(HIST("hPtProngSoftPiRecBg"), ptCandB0, candidate.ptProng1()); + registry.fill(HIST("hPtProngBachPiRecBg"), ptCandB0, candidate.ptProng2()); + registry.fill(HIST("hImpParProngSqSumRecBg"), ptCandB0, candidate.impactParameterProngSqSum()); + registry.fill(HIST("hDecLengthRecBg"), ptCandB0, candidate.decayLength()); + registry.fill(HIST("hDecLengthXyRecBg"), ptCandB0, candidate.decayLengthXY()); + registry.fill(HIST("hNormDecLengthXyRecBg"), ptCandB0, candidate.decayLengthXY() / candidate.errorDecayLengthXY()); + registry.fill(HIST("hDcaProng0RecBg"), ptCandB0, candidate.impactParameter0()); + registry.fill(HIST("hDcaProng1RecBg"), ptCandB0, candidate.impactParameter1()); + registry.fill(HIST("hDcaProng2RecBg"), ptCandB0, candidate.impactParameter2()); + registry.fill(HIST("hCospRecBg"), ptCandB0, candidate.cpa()); + registry.fill(HIST("hCospXyRecBg"), ptCandB0, candidate.cpaXY()); + registry.fill(HIST("hEtaRecBg"), ptCandB0, candidate.eta()); + registry.fill(HIST("hRapidityRecBg"), ptCandB0, hfHelper.yB0(candidate)); + registry.fill(HIST("hInvMassDRecBg"), ptD, invMassD); + registry.fill(HIST("hDecLengthDRecBg"), ptD, decLenD); + registry.fill(HIST("hDecLengthXyDRecBg"), ptD, decLenXyD); + registry.fill(HIST("hCospDRecBg"), ptD, cospD); + registry.fill(HIST("hCospXyDRecBg"), ptD, cospXyD); + if constexpr (withDmesMl) { + registry.fill(HIST("hMlScoreBkgDRecBg"), ptD, candidate.prong0MlScoreBkg()); + registry.fill(HIST("hMlScorePromptDRecBg"), ptD, candidate.prong0MlScorePrompt()); + registry.fill(HIST("hMlScoreNonPromptDRecBg"), ptD, candidate.prong0MlScoreNonprompt()); + } + } + } else { + registry.fill(HIST("hMass"), ptCandB0, invMassB0); + registry.fill(HIST("hPtProngD0"), ptCandB0, candidate.ptProng0()); + registry.fill(HIST("hPtProngSoftPi"), ptCandB0, candidate.ptProng1()); + registry.fill(HIST("hPtProngBachPi"), ptCandB0, candidate.ptProng2()); + registry.fill(HIST("hDecLength"), ptCandB0, candidate.decayLength()); + registry.fill(HIST("hDecLengthXy"), ptCandB0, candidate.decayLengthXY()); + registry.fill(HIST("hNormDecLengthXy"), ptCandB0, candidate.decayLengthXY() / candidate.errorDecayLengthXY()); + registry.fill(HIST("hImpParProngSqSum"), ptCandB0, candidate.impactParameterProngSqSum()); + registry.fill(HIST("hDcaProng0"), ptCandB0, candidate.impactParameter0()); + registry.fill(HIST("hDcaProng1"), ptCandB0, candidate.impactParameter1()); + registry.fill(HIST("hDcaProng2"), ptCandB0, candidate.impactParameter2()); + registry.fill(HIST("hCosp"), ptCandB0, candidate.cpa()); + registry.fill(HIST("hCospXy"), ptCandB0, candidate.cpaXY()); + registry.fill(HIST("hEta"), ptCandB0, candidate.eta()); + registry.fill(HIST("hRapidity"), ptCandB0, hfHelper.yB0(candidate)); + registry.fill(HIST("hInvMassD"), ptD, invMassD); + registry.fill(HIST("hDecLengthD"), ptD, decLenD); + registry.fill(HIST("hDecLengthXyD"), ptD, decLenXyD); + registry.fill(HIST("hCospD"), ptD, cospD); + registry.fill(HIST("hCospXyD"), ptD, cospXyD); + + if constexpr (withDmesMl) { + registry.fill(HIST("hMlScoreBkgD"), ptD, candidate.prong0MlScoreBkg()); + registry.fill(HIST("hMlScorePromptD"), ptD, candidate.prong0MlScorePrompt()); + registry.fill(HIST("hMlScoreNonPromptD"), ptD, candidate.prong0MlScoreNonprompt()); + } + } + } + if (fillSparses) { + if constexpr (doMc) { + if (isSignal) { + if constexpr (withDmesMl) { + registry.fill(HIST("hMassPtCutVarsRecSig"), invMassB0, ptCandB0, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProngSqSum(), candidate.cpa(), invMassD, ptD, candidate.prong0MlScoreBkg(), candidate.prong0MlScoreNonprompt()); + } else { + registry.fill(HIST("hMassPtCutVarsRecSig"), invMassB0, ptCandB0, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProngSqSum(), candidate.cpa(), invMassD, ptD, decLenD, cospD); + } + } else if (fillBackground) { + if constexpr (withDmesMl) { + registry.fill(HIST("hMassPtCutVarsRecBg"), invMassB0, ptCandB0, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProngSqSum(), candidate.cpa(), invMassD, ptD, candidate.prong0MlScoreBkg(), candidate.prong0MlScoreNonprompt()); + } else { + registry.fill(HIST("hMassPtCutVarsRecBg"), invMassB0, ptCandB0, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProngSqSum(), candidate.cpa(), invMassD, ptD, decLenD, cospD); + } + } + } else { + if constexpr (withDmesMl) { + registry.fill(HIST("hMassPtCutVars"), invMassB0, ptCandB0, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProngSqSum(), candidate.cpa(), invMassD, ptD, candidate.prong0MlScoreBkg(), candidate.prong0MlScoreNonprompt()); + } else { + registry.fill(HIST("hMassPtCutVars"), invMassB0, ptCandB0, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProngSqSum(), candidate.cpa(), invMassD, ptD, decLenD, cospD); + } + } + } + if (fillTree) { + float pseudoRndm = ptD * 1000. - static_cast(ptD * 1000); + if (flagMcMatchRec != 0 || (((doMc && fillBackground) || !doMc) && (ptCandB0 >= ptMaxForDownSample || pseudoRndm < downSampleBkgFactor))) { + float prong0MlScoreBkg = -1.; + float prong0MlScorePrompt = -1.; + float prong0MlScoreNonprompt = -1.; + float candidateMlScoreSig = -1; + if constexpr (withDmesMl) { + prong0MlScoreBkg = candidate.prong0MlScoreBkg(); + prong0MlScorePrompt = candidate.prong0MlScorePrompt(); + prong0MlScoreNonprompt = candidate.prong0MlScoreNonprompt(); + } + auto prongBachPi = candidate.template prongBachPi_as(); + + float ptMother = -1.; + if constexpr (doMc) { + ptMother = candidate.ptMother(); + } + + hfRedCandB0Lite( + // B-meson features + invMassB0, + ptCandB0, + candidate.eta(), + candidate.phi(), + hfHelper.yB0(candidate), + candidate.cpa(), + candidate.cpaXY(), + candidate.chi2PCA(), + candidate.decayLength(), + candidate.decayLengthXY(), + candidate.decayLengthNormalised(), + candidate.decayLengthXYNormalised(), + candidate.impactParameterProngSqSum(), + candidate.maxNormalisedDeltaIP(), + candidateMlScoreSig, + candidate.isSelB0ToDPi(), + // D-meson features + invMassD, + ptD, + decLenD, + decLenXyD, + candidate.impactParameter0(), + candD.ptProngMin(), + candD.absEtaProngMin(), + candD.itsNClsProngMin(), + candD.tpcNClsCrossedRowsProngMin(), + candD.tpcChi2NClProngMax(), + candD.tpcNSigmaPiProng0(), + candD.tofNSigmaPiProng0(), + candD.tpcTofNSigmaPiProng0(), + candD.tpcNSigmaKaProng1(), + candD.tofNSigmaKaProng1(), + candD.tpcTofNSigmaKaProng1(), + softPi.tpcNSigmaPiSoftPi(), + softPi.tofNSigmaPiSoftPi(), + softPi.tpcTofNSigmaPiSoftPi(), + prong0MlScoreBkg, + prong0MlScorePrompt, + prong0MlScoreNonprompt, + // pion features + candidate.ptProng1(), + std::abs(RecoDecay::eta(prongBachPi.pVector())), + prongBachPi.itsNCls(), + prongBachPi.tpcNClsCrossedRows(), + prongBachPi.tpcChi2NCl(), + candidate.impactParameter1(), + prongBachPi.tpcNSigmaPi(), + prongBachPi.tofNSigmaPi(), + prongBachPi.tpcTofNSigmaPi(), + // MC truth + flagMcMatchRec, + isSignal, + flagWrongCollision, + ptMother); + + if constexpr (withDecayTypeCheck) { + hfRedB0McCheck( + flagMcMatchRec, + flagWrongCollision, + invMassD, + ptD, + invMassB0, + ptCandB0, + candidateMlScoreSig, + candidate.pdgCodeBeautyMother(), + candidate.pdgCodeCharmMother(), + candidate.pdgCodeProng0(), + candidate.pdgCodeProng1(), + candidate.pdgCodeProng2(), + candidate.pdgCodeProng3()); + } + } + } + } + /// Fill candidate information at reconstruction level /// \param doMc is the flag to enable the filling with MC information /// \param withDecayTypeCheck is the flag to enable MC with decay type check @@ -558,7 +852,7 @@ struct HfTaskB0Reduced { if constexpr (withB0Ml) { candidateMlScoreSig = candidate.mlProbB0ToDPi(); } - auto prong1 = candidate.template prong1_as(); + auto prong1 = candidate.template prong1_as(); float ptMother = -1.; if constexpr (doMc) { @@ -681,9 +975,9 @@ struct HfTaskB0Reduced { } // Process functions - void processData(soa::Filtered> const& candidates, - CandsDplus const& candidatesD, - TracksPion const&) + void processDataDplusPi(soa::Filtered> const& candidates, + CandsDplus const& candidatesD, + TracksBachPions const&) { for (const auto& candidate : candidates) { if (yCandRecoMax >= 0. && std::abs(hfHelper.yB0(candidate)) > yCandRecoMax) { @@ -691,12 +985,12 @@ struct HfTaskB0Reduced { } fillCand(candidate, candidatesD); } // candidate loop - } // processData - PROCESS_SWITCH(HfTaskB0Reduced, processData, "Process data without ML scores for B0 and D daughter", true); + } // processDataDplusPi + PROCESS_SWITCH(HfTaskB0Reduced, processDataDplusPi, "Process data without ML scores for B0 and Dplus daughter", true); - void processDataWithDmesMl(soa::Filtered> const& candidates, - CandsDplus const& candidatesD, - TracksPion const&) + void processDataDplusPiWithDmesMl(soa::Filtered> const& candidates, + CandsDplus const& candidatesD, + TracksBachPions const&) { for (const auto& candidate : candidates) { if (yCandRecoMax >= 0. && std::abs(hfHelper.yB0(candidate)) > yCandRecoMax) { @@ -704,12 +998,12 @@ struct HfTaskB0Reduced { } fillCand(candidate, candidatesD); } // candidate loop - } // processDataWithDmesMl - PROCESS_SWITCH(HfTaskB0Reduced, processDataWithDmesMl, "Process data with(out) ML scores for D daughter (B0)", false); + } // processDataDplusPiWithDmesMl + PROCESS_SWITCH(HfTaskB0Reduced, processDataDplusPiWithDmesMl, "Process data with(out) ML scores for Dplus daughter (B0)", false); - void processDataWithB0Ml(soa::Filtered> const& candidates, - CandsDplus const& candidatesD, - TracksPion const&) + void processDataDplusPiWithB0Ml(soa::Filtered> const& candidates, + CandsDplus const& candidatesD, + TracksBachPions const&) { for (const auto& candidate : candidates) { if (yCandRecoMax >= 0. && std::abs(hfHelper.yB0(candidate)) > yCandRecoMax) { @@ -717,13 +1011,42 @@ struct HfTaskB0Reduced { } fillCand(candidate, candidatesD); } // candidate loop - } // processDataWithB0Ml - PROCESS_SWITCH(HfTaskB0Reduced, processDataWithB0Ml, "Process data with(out) ML scores for B0 (D daughter)", false); + } // processDataDplusPiWithB0Ml + PROCESS_SWITCH(HfTaskB0Reduced, processDataDplusPiWithB0Ml, "Process data with(out) ML scores for B0 (Dplus daughter)", false); + + // Process functions + void processDataDstarPi(soa::Filtered> const& candidates, + CandsDstar const& candidatesD, + TracksSoftPions const& softPions, + TracksBachPions const&) + { + for (const auto& candidate : candidates) { + if (yCandRecoMax >= 0. && std::abs(hfHelper.yB0(candidate)) > yCandRecoMax) { + continue; + } + fillCandDStarPi(candidate, softPions, candidatesD); + } // candidate loop + } // processDataDstarPi + PROCESS_SWITCH(HfTaskB0Reduced, processDataDstarPi, "Process data without ML scores for B0 and Dstar daughter", false); + + void processDataDstarPiWithDmesMl(soa::Filtered> const& candidates, + CandsDstar const& candidatesD, + TracksSoftPions const& softPions, + TracksBachPions const&) + { + for (const auto& candidate : candidates) { + if (yCandRecoMax >= 0. && std::abs(hfHelper.yB0(candidate)) > yCandRecoMax) { + continue; + } + fillCandDStarPi(candidate, softPions, candidatesD); + } // candidate loop + } // processDataDstarPiWithDmesMl + PROCESS_SWITCH(HfTaskB0Reduced, processDataDstarPiWithDmesMl, "Process data with(out) ML scores for Dstar daughter (B0)", false); - void processMc(soa::Filtered> const& candidates, - aod::HfMcGenRedB0s const& mcParticles, - CandsDplus const& candidatesD, - TracksPion const&) + void processMcDplusPi(soa::Filtered> const& candidates, + aod::HfMcGenRedB0s const& mcParticles, + CandsDplus const& candidatesD, + TracksBachPions const&) { // MC rec for (const auto& candidate : candidates) { @@ -737,13 +1060,13 @@ struct HfTaskB0Reduced { for (const auto& particle : mcParticles) { fillCandMcGen(particle); } // gen - } // processMc - PROCESS_SWITCH(HfTaskB0Reduced, processMc, "Process MC without ML scores for B0 and D daughter", false); + } // processMcDplusPi + PROCESS_SWITCH(HfTaskB0Reduced, processMcDplusPi, "Process MC without ML scores for B0 and Dplus daughter", false); - void processMcWithDecayTypeCheck(soa::Filtered> const& candidates, - aod::HfMcGenRedB0s const& mcParticles, - CandsDplus const& candidatesD, - TracksPion const&) + void processMcDplusPiWithDecayTypeCheck(soa::Filtered> const& candidates, + aod::HfMcGenRedB0s const& mcParticles, + CandsDplus const& candidatesD, + TracksBachPions const&) { // MC rec for (const auto& candidate : candidates) { @@ -757,13 +1080,13 @@ struct HfTaskB0Reduced { for (const auto& particle : mcParticles) { fillCandMcGen(particle); } // gen - } // processMc - PROCESS_SWITCH(HfTaskB0Reduced, processMcWithDecayTypeCheck, "Process MC with decay type check and without ML scores for B0 and D daughter", false); + } // processMcDplusPi + PROCESS_SWITCH(HfTaskB0Reduced, processMcDplusPiWithDecayTypeCheck, "Process MC with decay type check and without ML scores for B0 and Dplus daughter", false); - void processMcWithDmesMl(soa::Filtered> const& candidates, - aod::HfMcGenRedB0s const& mcParticles, - CandsDplus const& candidatesD, - TracksPion const&) + void processMcDplusPiWithDmesMl(soa::Filtered> const& candidates, + aod::HfMcGenRedB0s const& mcParticles, + CandsDplus const& candidatesD, + TracksBachPions const&) { // MC rec for (const auto& candidate : candidates) { @@ -777,13 +1100,13 @@ struct HfTaskB0Reduced { for (const auto& particle : mcParticles) { fillCandMcGen(particle); } // gen - } // processMcWithDmesMl - PROCESS_SWITCH(HfTaskB0Reduced, processMcWithDmesMl, "Process MC with(out) ML scores for D daughter (B0)", false); + } // processMcDplusPiWithDmesMl + PROCESS_SWITCH(HfTaskB0Reduced, processMcDplusPiWithDmesMl, "Process MC with(out) ML scores for Dplus daughter (B0)", false); - void processMcWithDmesMlAndDecayTypeCheck(soa::Filtered> const& candidates, - aod::HfMcGenRedB0s const& mcParticles, - CandsDplus const& candidatesD, - TracksPion const&) + void processMcDplusPiWithDmesMlAndDecayTypeCheck(soa::Filtered> const& candidates, + aod::HfMcGenRedB0s const& mcParticles, + CandsDplus const& candidatesD, + TracksBachPions const&) { // MC rec for (const auto& candidate : candidates) { @@ -797,13 +1120,13 @@ struct HfTaskB0Reduced { for (const auto& particle : mcParticles) { fillCandMcGen(particle); } // gen - } // processMc - PROCESS_SWITCH(HfTaskB0Reduced, processMcWithDmesMlAndDecayTypeCheck, "Process MC with decay type check and with(out) ML scores for B0 (D daughter)", false); + } // processMcDplusPi + PROCESS_SWITCH(HfTaskB0Reduced, processMcDplusPiWithDmesMlAndDecayTypeCheck, "Process MC with decay type check and with(out) ML scores for B0 (Dplus daughter)", false); - void processMcWithB0Ml(soa::Filtered> const& candidates, - aod::HfMcGenRedB0s const& mcParticles, - CandsDplus const& candidatesD, - TracksPion const&) + void processMcDplusPiWithB0Ml(soa::Filtered> const& candidates, + aod::HfMcGenRedB0s const& mcParticles, + CandsDplus const& candidatesD, + TracksBachPions const&) { // MC rec for (const auto& candidate : candidates) { @@ -817,13 +1140,13 @@ struct HfTaskB0Reduced { for (const auto& particle : mcParticles) { fillCandMcGen(particle); } // gen - } // processMcWithB0Ml - PROCESS_SWITCH(HfTaskB0Reduced, processMcWithB0Ml, "Process MC with(out) ML scores for B0 (D daughter)", false); + } // processMcDplusPiWithB0Ml + PROCESS_SWITCH(HfTaskB0Reduced, processMcDplusPiWithB0Ml, "Process MC with(out) ML scores for B0 (Dplus daughter)", false); - void processMcWithB0MlAndDecayTypeCheck(soa::Filtered> const& candidates, - aod::HfMcGenRedB0s const& mcParticles, - CandsDplus const& candidatesD, - TracksPion const&) + void processMcDplusPiWithB0MlAndDecayTypeCheck(soa::Filtered> const& candidates, + aod::HfMcGenRedB0s const& mcParticles, + CandsDplus const& candidatesD, + TracksBachPions const&) { // MC rec for (const auto& candidate : candidates) { @@ -837,8 +1160,51 @@ struct HfTaskB0Reduced { for (const auto& particle : mcParticles) { fillCandMcGen(particle); } // gen - } // processMc - PROCESS_SWITCH(HfTaskB0Reduced, processMcWithB0MlAndDecayTypeCheck, "Process MC with decay type check and with(out) ML scores for B0 (D daughter)", false); + } // processMcDplusPi + PROCESS_SWITCH(HfTaskB0Reduced, processMcDplusPiWithB0MlAndDecayTypeCheck, "Process MC with decay type check and with(out) ML scores for B0 (Dplus daughter)", false); + + void processMcDstarPi(soa::Filtered> const& candidates, + aod::HfMcGenRedB0s const& mcParticles, + CandsDstar const& candidatesD, + TracksSoftPions const& softPions, + TracksBachPions const&) + { + // MC rec + for (const auto& candidate : candidates) { + if (yCandRecoMax >= 0. && std::abs(hfHelper.yB0(candidate)) > yCandRecoMax) { + continue; + } + fillCandDStarPi(candidate, softPions, candidatesD); + } // rec + + // MC gen. level + for (const auto& particle : mcParticles) { + fillCandMcGen(particle); + } // gen + } // processMcDstarPi + PROCESS_SWITCH(HfTaskB0Reduced, processMcDstarPi, "Process MC without ML scores for B0 and Dstar daughter", false); + + void processMcDstarPiWithDmesMl(soa::Filtered> const& candidates, + aod::HfMcGenRedB0s const& mcParticles, + CandsDstar const& candidatesD, + TracksSoftPions const& softPions, + TracksBachPions const&) + { + // MC rec + for (const auto& candidate : candidates) { + if (yCandRecoMax >= 0. && std::abs(hfHelper.yB0(candidate)) > yCandRecoMax) { + continue; + } + fillCandDStarPi(candidate, softPions, candidatesD); + } // rec + + // MC gen. level + for (const auto& particle : mcParticles) { + fillCandMcGen(particle); + } // gen + } // processMcDstarPiWithDmesMl + PROCESS_SWITCH(HfTaskB0Reduced, processMcDstarPiWithDmesMl, "Process MC with(out) ML scores for Dstar daughter (B0)", false); + }; // struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGHF/D2H/Utils/utilsRedDataFormat.h b/PWGHF/D2H/Utils/utilsRedDataFormat.h index 4e4bc2b9b3c..f5115e59ac0 100644 --- a/PWGHF/D2H/Utils/utilsRedDataFormat.h +++ b/PWGHF/D2H/Utils/utilsRedDataFormat.h @@ -82,6 +82,30 @@ float getTpcTofNSigmaPi1(const T1& prong1) return defaultNSigma; } +/// Helper function to retrive PID information of bachelor pion from b-hadron decay +/// \param prongSoftPi soft pion track +template +float getTpcTofNSigmaSoftPi(const T1& prongSoftPi) +{ + float defaultNSigma = -999.f; // -999.f is the default value set in TPCPIDResponse.h and PIDTOF.h + + bool hasTpc = prongSoftPi.hasTPC(); + bool hasTof = prongSoftPi.hasTOF(); + + if (hasTpc && hasTof) { + float tpcNSigma = prongSoftPi.tpcNSigmaPiSoftPi(); + float tofNSigma = prongSoftPi.tofNSigmaPiSoftPi(); + return std::sqrt(.5f * tpcNSigma * tpcNSigma + .5f * tofNSigma * tofNSigma); + } + if (hasTpc) { + return std::abs(prongSoftPi.tpcNSigmaPiSoftPi()); + } + if (hasTof) { + return std::abs(prongSoftPi.tofNSigmaPiSoftPi()); + } + return defaultNSigma; +} + /// Helper function to retrive PID information of bachelor kaon from b-hadron decay /// \param prong1 kaon track from reduced data format, aod::HfRedBachProng0Tracks /// \return the combined TPC and TOF n-sigma for kaon diff --git a/PWGHF/DataModel/CandidateReconstructionTables.h b/PWGHF/DataModel/CandidateReconstructionTables.h index 3ee949eadc8..57f465f3b76 100644 --- a/PWGHF/DataModel/CandidateReconstructionTables.h +++ b/PWGHF/DataModel/CandidateReconstructionTables.h @@ -2237,6 +2237,40 @@ DECLARE_SOA_TABLE(HfCandB0Base, "AOD", "HFCANDB0BASE", hf_cand::E, hf_cand::E2); +DECLARE_SOA_TABLE(HfCandB0DStar, "AOD", "HFCANDB0DSTAR", + // general columns + HFCAND_COLUMNS, + /* prong 2 */ hf_cand::ImpactParameterNormalised2, + hf_cand::PtProng2, + hf_cand::Pt2Prong2, + hf_cand::PVectorProng2, + // 3-prong specific columns + hf_cand::PxProng0, hf_cand::PyProng0, hf_cand::PzProng0, + hf_cand::PxProng1, hf_cand::PyProng1, hf_cand::PzProng1, + hf_cand::PxProng2, hf_cand::PyProng2, hf_cand::PzProng2, + hf_cand::ImpactParameter0, hf_cand::ImpactParameter1, hf_cand::ImpactParameter2, + hf_cand::ErrorImpactParameter0, hf_cand::ErrorImpactParameter1, hf_cand::ErrorImpactParameter2, + /* dynamic columns */ + hf_cand_3prong::M, + hf_cand_3prong::M2, + hf_cand_3prong::ImpactParameterProngSqSum, + /* dynamic columns that use candidate momentum components */ + hf_cand::Pt, + hf_cand::Pt2, + hf_cand::P, + hf_cand::P2, + hf_cand::PVector, + hf_cand::Cpa, + hf_cand::CpaXY, + hf_cand::Ct, + hf_cand::ImpactParameterXY, + hf_cand_3prong::MaxNormalisedDeltaIP, + hf_cand::Eta, + hf_cand::Phi, + hf_cand::Y, + hf_cand::E, + hf_cand::E2); + // extended table with expression columns that can be used as arguments of dynamic columns DECLARE_SOA_EXTENDED_TABLE_USER(HfCandB0Ext, HfCandB0Base, "HFCANDB0EXT", hf_cand_2prong::Px, hf_cand_2prong::Py, hf_cand_2prong::Pz); @@ -2246,6 +2280,10 @@ DECLARE_SOA_TABLE(HfCandB0Prongs, "AOD", "HFCANDB0PRONGS", using HfCandB0 = soa::Join; +// extended table with expression columns that can be used as arguments of dynamic columns +DECLARE_SOA_EXTENDED_TABLE_USER(HfCandB0DStExt, HfCandB0DStar, "HFCANDB0DSTEXT", + hf_cand_3prong::Px, hf_cand_3prong::Py, hf_cand_3prong::Pz); + // table with results of reconstruction level MC matching DECLARE_SOA_TABLE(HfCandB0McRec, "AOD", "HFCANDB0MCREC", hf_cand_b0::FlagMcMatchRec, @@ -2678,7 +2716,11 @@ DECLARE_SOA_DYNAMIC_COLUMN(NormalisedImpParamZSoftPi, normalisedImpParamZSoftPi, DECLARE_SOA_COLUMN(PxSoftPi, pxSoftPi, float); DECLARE_SOA_COLUMN(PySoftPi, pySoftPi, float); DECLARE_SOA_COLUMN(PzSoftPi, pzSoftPi, float); +DECLARE_SOA_COLUMN(DcaYSoftPi, dcaYSoftPi, float); +DECLARE_SOA_COLUMN(SigmaYSoftPi, sigmaYSoftPi, float); DECLARE_SOA_COLUMN(SignSoftPi, signSoftPi, int8_t); +DECLARE_SOA_COLUMN(TPCNSigmaPiSoftPi, tpcNSigmaPiSoftPi, float); //! NsigmaTPCPi for soft pi, o2-linter: disable=name/o2-column (written to disk) +DECLARE_SOA_COLUMN(TOFNSigmaPiSoftPi, tofNSigmaPiSoftPi, float); //! NsigmaTOFPi for soft pi, o2-linter: disable=name/o2-column (written to disk) // Dstar momenta DECLARE_SOA_EXPRESSION_COLUMN(PxDstar, pxDstar, float, 1.f * aod::hf_cand::pxProng0 + 1.f * aod::hf_cand::pxProng1 + 1.f * aod::hf_cand_dstar::pxSoftPi); DECLARE_SOA_EXPRESSION_COLUMN(PyDstar, pyDstar, float, 1.f * aod::hf_cand::pyProng0 + 1.f * aod::hf_cand::pyProng1 + 1.f * aod::hf_cand_dstar::pySoftPi); @@ -2694,7 +2736,8 @@ DECLARE_SOA_DYNAMIC_COLUMN(InvMassAntiDstar, invMassAntiDstar, DECLARE_SOA_DYNAMIC_COLUMN(PtSoftPi, ptSoftPi, [](float pxSoftPi, float pySoftPi) -> float { return RecoDecay::pt(pxSoftPi, pySoftPi); }); DECLARE_SOA_DYNAMIC_COLUMN(PVecSoftPi, pVecSoftPi, [](float px, float py, float pz) -> std::array { return std::array{px, py, pz}; }); - +DECLARE_SOA_DYNAMIC_COLUMN(TPCTOFNSigmaPiSoftPi, tpcTofNSigmaPiSoftPi, //! Combination of NsigmaTPC and NsigmaTOF, o2-linter: disable=name/o2-column (written to disk) + [](float tpcNSigmaPiSoftPi, float TOFNSigmaPiSoftPi) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPiSoftPi, TOFNSigmaPiSoftPi); }); // MC matching result: DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); //! reconstruction level DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); //! generator level diff --git a/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx b/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx index dbc06282ce0..bd3cb47b28f 100644 --- a/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx @@ -16,7 +16,6 @@ /// \author Fabrizio Grosa , CERN #include "PWGHF/Core/HfHelper.h" -#include "PWGHF/Core/HfMlResponseD0ToKPi.h" #include "PWGHF/Core/HfMlResponseDstarToD0Pi.h" #include "PWGHF/Core/SelectorCuts.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" From 23ee70e107e0330899c02e40d3aa3e8b385506b2 Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Thu, 14 Aug 2025 21:45:28 +0530 Subject: [PATCH 057/986] [PWGLF] Optimised code and added new reconstructed MC function (#12579) Co-authored-by: Sawan Sawan --- PWGLF/Tasks/Resonances/kstarqa.cxx | 383 +++++++++++++++++++++++++++-- 1 file changed, 359 insertions(+), 24 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarqa.cxx b/PWGLF/Tasks/Resonances/kstarqa.cxx index 1211294828d..e6e32885ad5 100644 --- a/PWGLF/Tasks/Resonances/kstarqa.cxx +++ b/PWGLF/Tasks/Resonances/kstarqa.cxx @@ -132,6 +132,12 @@ struct Kstarqa { Configurable nsigmaCutTOFPr{"nsigmaCutTOFPr", 3.0, "TOF Nsigma cut for protons (for MID)"}; Configurable nsigmaCutCombinedKa{"nsigmaCutCombinedKa", 3.0, "Combined Nsigma cut for kaon"}; Configurable nsigmaCutCombinedPi{"nsigmaCutCombinedPi", 3.0, "Combined Nsigma cut for pion"}; + Configurable nsigmaCutCombinedMIDKa{"nsigmaCutCombinedMIDKa", 3.0, "Combined Nsigma cut for kaon in MID"}; + Configurable nsigmaCutCombinedMIDPi{"nsigmaCutCombinedMIDPi", 3.0, "Combined Nsigma cut for pion in MID"}; + Configurable nsigmaCutTPCMIDPi{"nsigmaCutTPCMIDPi", 1.0, "MID Nsigma cut for pion in TPC"}; + Configurable nsigmaCutTPCMIDKa{"nsigmaCutTPCMIDKa", 1.0, "MID Nsigma cut for kaon in TPC"}; + Configurable nsigmaCutTOFMIDPi{"nsigmaCutTOFMIDPi", 1.0, "MID Nsigma cut for pion in TOF"}; + Configurable nsigmaCutTOFMIDKa{"nsigmaCutTOFMIDKa", 1.0, "MID Nsigma cut for kaon in TOF"}; // Other fixed variables float lowPtCutPID = 0.5; @@ -609,6 +615,85 @@ struct Kstarqa { return false; } + template + bool selectionMID(const T& candidate, int PID) + { + if (PID == PIDParticle::kPion) { + if (onlyTOF) { + if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) < selectionConfig.nsigmaCutTOFMIDPi && candidate.beta() > cBetaCutTOF) { + return true; + } + } else if (onlyTOFHIT) { + if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) < selectionConfig.nsigmaCutTOFMIDPi && candidate.beta() > cBetaCutTOF) { + return true; + } + if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaPi()) < selectionConfig.nsigmaCutTPCMIDPi) { + return true; + } + } else if (onlyTPC) { + if (std::abs(candidate.tpcNSigmaPi()) < selectionConfig.nsigmaCutTPCMIDPi) { + return true; + } + } else { + if (candidate.hasTOF() && (candidate.tofNSigmaPi() * candidate.tofNSigmaPi() + candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi()) < (selectionConfig.nsigmaCutCombinedMIDPi * selectionConfig.nsigmaCutCombinedMIDPi) && candidate.beta() > cBetaCutTOF) { + return true; + } + if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaPi()) < selectionConfig.nsigmaCutTPCMIDPi) { + return true; + } + } + } else if (PID == PIDParticle::kKaon) { + if (onlyTOF) { + if (candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) < selectionConfig.nsigmaCutTOFMIDKa && candidate.beta() > cBetaCutTOF) { + return true; + } + } else if (onlyTOFHIT) { + if (candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) < selectionConfig.nsigmaCutTOFMIDKa && candidate.beta() > cBetaCutTOF) { + return true; + } + if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < selectionConfig.nsigmaCutTPCMIDKa) { + return true; + } + } else if (onlyTPC) { + if (std::abs(candidate.tpcNSigmaKa()) < selectionConfig.nsigmaCutTPCMIDKa) { + return true; + } + } else { + if (candidate.hasTOF() && (candidate.tofNSigmaKa() * candidate.tofNSigmaKa() + candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa()) < (selectionConfig.nsigmaCutCombinedMIDKa * selectionConfig.nsigmaCutCombinedMIDKa) && candidate.beta() > cBetaCutTOF) { + return true; + } + if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < selectionConfig.nsigmaCutTPCMIDKa) { + return true; + } + } + } else if (PID == PIDParticle::kProton) { // for proton + if (onlyTOF) { + if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPr()) < selectionConfig.nsigmaCutTOFPr && candidate.beta() > cBetaCutTOF) { + return true; + } + } else if (onlyTOFHIT) { + if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPr()) < selectionConfig.nsigmaCutTOFPr && candidate.beta() > cBetaCutTOF) { + return true; + } + if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaPr()) < selectionConfig.nsigmaCutTPCPr) { + return true; + } + } else if (onlyTPC) { + if (std::abs(candidate.tpcNSigmaPr()) < selectionConfig.nsigmaCutTPCPr) { + return true; + } + } else { + if (candidate.hasTOF() && (candidate.tofNSigmaPr() * candidate.tofNSigmaPr() + candidate.tpcNSigmaPr() * candidate.tpcNSigmaPr()) < (selectionConfig.nsigmaCutTOFPr * selectionConfig.nsigmaCutTOFPr) && candidate.beta() > cBetaCutTOF) { + return true; + } + if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaPr()) < selectionConfig.nsigmaCutTPCPr) { + return true; + } + } + } + return false; + } + template bool selectionPIDNew(const T& candidate, int PID) { @@ -953,13 +1038,13 @@ struct Kstarqa { rEventSelection.fill(HIST("tracksCheckData"), 4.5); if (selectionConfig.isApplyParticleMID) { - if (selectionPID(track1, 0)) // Kaon misidentified as pion + if (selectionMID(track1, 0)) // Kaon misidentified as pion continue; - if (selectionPID(track1, 2)) // Kaon misidentified as proton + if (selectionMID(track1, 2)) // Kaon misidentified as proton continue; - if (selectionPID(track2, 1)) // Pion misidentified as kaon + if (selectionMID(track2, 1)) // Pion misidentified as kaon continue; - if (selectionPID(track2, 2)) // Pion misidentified as proton + if (selectionMID(track2, 2)) // Pion misidentified as proton continue; } @@ -1076,13 +1161,13 @@ struct Kstarqa { continue; if (selectionConfig.isApplyParticleMID) { - if (selectionPID(t1, 0)) // Kaon misidentified as pion + if (selectionMID(t1, 0)) // Kaon misidentified as pion continue; - if (selectionPID(t1, 2)) // Kaon misidentified as proton + if (selectionMID(t1, 2)) // Kaon misidentified as proton continue; - if (selectionPID(t2, 1)) // Pion misidentified as kaon + if (selectionMID(t2, 1)) // Pion misidentified as kaon continue; - if (selectionPID(t2, 2)) // Pion misidentified as proton + if (selectionMID(t2, 2)) // Pion misidentified as proton continue; } @@ -1135,13 +1220,13 @@ struct Kstarqa { continue; if (selectionConfig.isApplyParticleMID) { - if (selectionPID(t1, 0)) // Kaon misidentified as pion + if (selectionMID(t1, 0)) // Kaon misidentified as pion continue; - if (selectionPID(t1, 2)) // Kaon misidentified as proton + if (selectionMID(t1, 2)) // Kaon misidentified as proton continue; - if (selectionPID(t2, 1)) // Pion misidentified as kaon + if (selectionMID(t2, 1)) // Pion misidentified as kaon continue; - if (selectionPID(t2, 2)) // Pion misidentified as proton + if (selectionMID(t2, 2)) // Pion misidentified as proton continue; } @@ -1302,13 +1387,13 @@ struct Kstarqa { rEventSelection.fill(HIST("tracksCheckData"), 3.5); if (selectionConfig.isApplyParticleMID) { - if (selectionPID(track1, 0)) // Kaon misidentified as pion + if (selectionMID(track1, 0)) // Kaon misidentified as pion continue; - if (selectionPID(track1, 2)) // Kaon misidentified as proton + if (selectionMID(track1, 2)) // Kaon misidentified as proton continue; - if (selectionPID(track2, 1)) // Pion misidentified as kaon + if (selectionMID(track2, 1)) // Pion misidentified as kaon continue; - if (selectionPID(track2, 2)) // Pion misidentified as proton + if (selectionMID(track2, 2)) // Pion misidentified as proton continue; } @@ -1803,13 +1888,13 @@ struct Kstarqa { } rEventSelection.fill(HIST("recMCparticles"), 11.5); if (selectionConfig.isApplyParticleMID) { - if (selectionPID(track2, 0)) // Kaon misidentified as pion + if (selectionMID(track2, 0)) // Kaon misidentified as pion continue; - if (selectionPID(track2, 2)) // Kaon misidentified as proton + if (selectionMID(track2, 2)) // Kaon misidentified as proton continue; - if (selectionPID(track1, 1)) // Pion misidentified as kaon + if (selectionMID(track1, 1)) // Pion misidentified as kaon continue; - if (selectionPID(track1, 2)) // Pion misidentified as proton + if (selectionMID(track1, 2)) // Pion misidentified as proton continue; } rEventSelection.fill(HIST("recMCparticles"), 12.5); @@ -1830,13 +1915,13 @@ struct Kstarqa { rEventSelection.fill(HIST("recMCparticles"), 11.5); if (selectionConfig.isApplyParticleMID) { - if (selectionPID(track1, 0)) // Kaon misidentified as pion + if (selectionMID(track1, 0)) // Kaon misidentified as pion continue; - if (selectionPID(track1, 2)) // Kaon misidentified as proton + if (selectionMID(track1, 2)) // Kaon misidentified as proton continue; - if (selectionPID(track2, 1)) // Pion misidentified as kaon + if (selectionMID(track2, 1)) // Pion misidentified as kaon continue; - if (selectionPID(track2, 2)) // Pion misidentified as proton + if (selectionMID(track2, 2)) // Pion misidentified as proton continue; } rEventSelection.fill(HIST("recMCparticles"), 12.5); @@ -1883,6 +1968,256 @@ struct Kstarqa { } } PROCESS_SWITCH(Kstarqa, processRec, "Process Reconstructed", false); + + void processRec2(EventCandidatesMC::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const&, aod::McCollisions const& /*mcCollisions*/) + { + + if (!collision.has_mcCollision()) { + return; + } + + if (selectionConfig.isINELgt0 && !collision.isInelGt0()) { + return; + } + // multiplicity = collision.centFT0M(); + + multiplicity = -1.0; + + if (cSelectMultEstimator == kFT0M) { + multiplicity = collision.centFT0M(); + } else if (cSelectMultEstimator == kFT0A) { + multiplicity = collision.centFT0A(); + } else if (cSelectMultEstimator == kFT0C) { + multiplicity = collision.centFT0C(); + } else if (cSelectMultEstimator == kFV0A) { + multiplicity = collision.centFV0A(); + } else { + multiplicity = collision.centFT0M(); // default + } + + hInvMass.fill(HIST("hAllRecCollisions"), multiplicity); + + if (!selectionEvent(collision, false)) { + return; + } + + // // if (std::abs(collision.mcCollision().posZ()) > selectionConfig.cutzvertex || !collision.sel8()) { + // if (std::abs(collision.mcCollision().posZ()) > selectionConfig.cutzvertex) { + // return; + // } + + // if (selectionConfig.isNoTimeFrameBorder && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + // return; + // } + + // if (selectionConfig.isTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { + // return; + // } + + // if (!collision.sel8()) { + // return; + // } + + // if (selectionConfig.isNoSameBunchPileup && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { + // return; + // } + // if (selectionConfig.isGoodZvtxFT0vsPV && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + // return; + // } + + // multiplicity = collision.centFT0M(); + + multiplicity = -1.0; + + if (cSelectMultEstimator == kFT0M) { + multiplicity = collision.centFT0M(); + } else if (cSelectMultEstimator == kFT0A) { + multiplicity = collision.centFT0A(); + } else if (cSelectMultEstimator == kFT0C) { + multiplicity = collision.centFT0C(); + } else if (cSelectMultEstimator == kFV0A) { + multiplicity = collision.centFV0A(); + } else { + multiplicity = collision.centFT0M(); // default + } + + hInvMass.fill(HIST("h1RecMult"), multiplicity); + + auto oldindex = -999; + for (const auto& track1 : tracks) { + if (!selectionTrack(track1)) { + continue; + } + + if (!track1.has_mcParticle()) { + continue; + } + + auto track1ID = track1.index(); + for (const auto& track2 : tracks) { + rEventSelection.fill(HIST("recMCparticles"), 0.5); + if (!track2.has_mcParticle()) { + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 1.5); + + if (!selectionTrack(track2)) { + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 2.5); + + auto track2ID = track2.index(); + if (track2ID == track1ID) { + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 3.5); + + if (track1.sign() * track2.sign() >= 0) { + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 4.5); + + const auto mctrack1 = track1.mcParticle(); + const auto mctrack2 = track2.mcParticle(); + int track1PDG = std::abs(mctrack1.pdgCode()); + int track2PDG = std::abs(mctrack2.pdgCode()); + + if (cQAplots && (mctrack2.pdgCode() == PDG_t::kPiPlus)) { // pion + hPID.fill(HIST("Before/h1PID_TPC_pos_pion"), track2.tpcNSigmaPi()); + hPID.fill(HIST("Before/h1PID_TOF_pos_pion"), track2.tofNSigmaPi()); + hPID.fill(HIST("Before/hNsigmaTPC_Pi_before"), track2.pt(), track2.tpcNSigmaPi()); + hPID.fill(HIST("Before/hNsigmaTOF_Pi_before"), track2.pt(), track2.tofNSigmaPi()); + } + if (cQAplots && (mctrack2.pdgCode() == PDG_t::kKPlus)) { // kaon + hPID.fill(HIST("Before/h1PID_TPC_pos_kaon"), track2.tpcNSigmaKa()); + hPID.fill(HIST("Before/h1PID_TOF_pos_kaon"), track2.tofNSigmaKa()); + hPID.fill(HIST("Before/hNsigmaTPC_Ka_before"), track2.pt(), track2.tpcNSigmaKa()); + hPID.fill(HIST("Before/hNsigmaTOF_Ka_before"), track2.pt(), track2.tofNSigmaKa()); + } + if (cQAplots && (mctrack2.pdgCode() == -PDG_t::kPiMinus)) { // negative track pion + hPID.fill(HIST("Before/h1PID_TPC_neg_pion"), track2.tpcNSigmaPi()); + hPID.fill(HIST("Before/h1PID_TOF_neg_pion"), track2.tofNSigmaPi()); + hPID.fill(HIST("Before/hNsigmaTPC_Pi_before"), track2.pt(), track2.tpcNSigmaPi()); + hPID.fill(HIST("Before/hNsigmaTOF_Pi_before"), track2.pt(), track2.tofNSigmaPi()); + } + if (cQAplots && (mctrack2.pdgCode() == -PDG_t::kKMinus)) { // negative track kaon + hPID.fill(HIST("Before/h1PID_TPC_neg_kaon"), track2.tpcNSigmaKa()); + hPID.fill(HIST("Before/h1PID_TOF_neg_kaon"), track2.tofNSigmaKa()); + hPID.fill(HIST("Before/hNsigmaTPC_Ka_before"), track2.pt(), track2.tpcNSigmaKa()); + hPID.fill(HIST("Before/hNsigmaTOF_Ka_before"), track2.pt(), track2.tofNSigmaKa()); + } + if (cQAplots && (std::abs(mctrack1.pdgCode()) == PDG_t::kKPlus && std::abs(mctrack2.pdgCode()) == PDG_t::kPiPlus)) { + hPID.fill(HIST("Before/hNsigma_TPC_TOF_Ka_before"), track1.tpcNSigmaKa(), track1.tofNSigmaKa()); + hPID.fill(HIST("Before/hNsigma_TPC_TOF_Pi_before"), track2.tpcNSigmaPi(), track2.tofNSigmaPi()); + } + + if (!mctrack1.isPhysicalPrimary()) { + continue; + } + + if (!mctrack2.isPhysicalPrimary()) { + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 5.5); + + // if (!(track1PDG == PDG_t::kKPlus && track2PDG == PDG_t::kPiPlus)) { + // continue; + // } + if (selectionConfig.isPDGCheckMC && (track1PDG != PDG_t::kKPlus)) { + continue; + } + if (selectionConfig.isPDGCheckMC && (track2PDG != PDG_t::kPiPlus)) { + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 6.5); + + for (const auto& mothertrack1 : mctrack1.mothers_as()) { + for (const auto& mothertrack2 : mctrack2.mothers_as()) { + if (selectionConfig.isPDGCheckMC && (mothertrack1.pdgCode() != mothertrack2.pdgCode())) { + continue; + } + + if (mothertrack1.globalIndex() != mothertrack2.globalIndex()) { + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 7.5); + + if (!mothertrack1.producedByGenerator()) { + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 8.5); + + if (std::abs(mothertrack1.y()) >= selectionConfig.rapidityMotherData) { + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 9.5); + + if (selectionConfig.isPDGCheckMC && (std::abs(mothertrack1.pdgCode()) != o2::constants::physics::kK0Star892)) { + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 10.5); + + if (!applypTdepPID && !(selectionPID(track1, 1) && selectionPID(track2, 0))) { + continue; + } else if (applypTdepPID && !(selectionPIDNew(track1, 1) && selectionPIDNew(track2, 0))) { + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 11.5); + + if (selectionConfig.isApplyParticleMID) { + if (selectionMID(track1, 0)) // Kaon misidentified as pion + continue; + if (selectionMID(track1, 2)) // Kaon misidentified as proton + continue; + if (selectionMID(track2, 1)) // Pion misidentified as kaon + continue; + if (selectionMID(track2, 2)) // Pion misidentified as proton + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 12.5); + + if (std::abs(track1.rapidity(o2::track::PID::getMass(o2::track::PID::Kaon))) > selectionConfig.ctrackRapidity) + continue; + + if (std::abs(track2.rapidity(o2::track::PID::getMass(o2::track::PID::Pion))) > selectionConfig.ctrackRapidity) + continue; + + rEventSelection.fill(HIST("recMCparticles"), 13.5); + + if (selectionConfig.isApplyCutsOnMother) { + if (mothertrack1.pt() >= selectionConfig.cMaxPtMotherCut) // excluding candidates in overflow + continue; + if ((std::sqrt(mothertrack1.e() * mothertrack1.e() - mothertrack1.p() * mothertrack1.p())) >= selectionConfig.cMaxMinvMotherCut) // excluding candidates in overflow + continue; + } + + if (avoidsplitrackMC && oldindex == mothertrack1.globalIndex()) { + hInvMass.fill(HIST("h1KSRecsplit"), mothertrack1.pt()); + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 14.5); + + oldindex = mothertrack1.globalIndex(); + if (track1.sign() * track2.sign() < 0) { + daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); + daughter2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massPi); + mother = daughter1 + daughter2; // Kstar meson + + hInvMass.fill(HIST("h2KstarRecpt2"), mothertrack1.pt(), multiplicity, std::sqrt(mothertrack1.e() * mothertrack1.e() - mothertrack1.p() * mothertrack1.p())); + + if (applyRecMotherRapidity && mother.Rapidity() >= selectionConfig.rapidityMotherData) { + continue; + } + + hInvMass.fill(HIST("h1KstarRecMass"), mother.M()); + hInvMass.fill(HIST("h2KstarRecpt1"), mother.Pt(), multiplicity, mother.M()); + } + } + } + } + } + } + PROCESS_SWITCH(Kstarqa, processRec2, "Process Reconstructed 2", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 267bfc5a4a6e397bc35be0d9e3fc9e5a7221b252 Mon Sep 17 00:00:00 2001 From: sarjeetagami <162087855+sarjeetagami@users.noreply.github.com> Date: Thu, 14 Aug 2025 22:55:30 +0530 Subject: [PATCH 058/986] [PWGLF] event selection cut kIsGoodZvtxFT0vsPV added (#12583) Co-authored-by: sarjeeta gami --- .../Tasks/Resonances/phianalysisrun3_PbPb.cxx | 34 ++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx b/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx index 520fd541b26..b1d5e088685 100644 --- a/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx +++ b/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx @@ -101,6 +101,8 @@ struct phianalysisrun3_PbPb { Configurable ispTdepPID{"ispTdepPID", true, "pT dependent PID"}; Configurable cfgITScluster{"cfgITScluster", 0, "Number of ITS cluster"}; Configurable confRapidity{"confRapidity", 0.5, "Rapidity cut"}; + Configurable rapiditycut1{"rapiditycut1", -1.0f, "Rapidity cut lower"}; + Configurable rapiditycut2{"rapiditycut2", 1.0f, "Rapidity cut upper"}; Configurable timFrameEvsel{"timFrameEvsel", false, "TPC Time frame boundary cut"}; Configurable isDeepAngle{"isDeepAngle", false, "Deep Angle cut"}; Configurable cfgDeepAngle{"cfgDeepAngle", 0.04, "Deep Angle cut value"}; @@ -311,7 +313,7 @@ struct phianalysisrun3_PbPb { return false; if (additionalEvSel5 && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) return false; - if (additionalEvSel6 && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) + if (additionalEvSel6 && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) return false; int occupancy = collision.trackOccupancyInTimeRange(); if (fillOccupancy && (occupancy > cfgCutOccupancy)) @@ -358,12 +360,10 @@ struct phianalysisrun3_PbPb { candidate1.pz() + candidate2.pz()}, mass); - constexpr float kRapidityCut = 0.5; constexpr int kOppositeCharge = 0; // default filling - if (std::abs(rapidity) < kRapidityCut && track1Sign * track2Sign < kOppositeCharge) { - + if (rapidity > rapiditycut1 && rapidity < rapiditycut2 && track1Sign * track2Sign < kOppositeCharge) { if (unlike) { histos.fill(HIST("h3PhiInvMassUnlikeSign"), multiplicity, pT, mass); histos.fill(HIST("h2PhiRapidity"), pT, rapidity); @@ -434,7 +434,7 @@ struct phianalysisrun3_PbPb { return; } histos.fill(HIST("hEvtSelInfo"), 7.5); - if (additionalEvSel6 && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { + if (additionalEvSel6 && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { return; } histos.fill(HIST("hEvtSelInfo"), 8.5); @@ -588,7 +588,7 @@ struct phianalysisrun3_PbPb { if (additionalEvSel5 && (!c1.selection_bit(aod::evsel::kNoCollInTimeRangeStandard) || !c2.selection_bit(aod::evsel::kNoCollInTimeRangeStandard))) { continue; } - if (additionalEvSel6 && (!c1.selection_bit(aod::evsel::kNoCollInRofStandard) || !c2.selection_bit(aod::evsel::kNoCollInRofStandard))) { + if (additionalEvSel6 && (!c1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !c2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { continue; } int occupancy1 = c1.trackOccupancyInTimeRange(); @@ -655,7 +655,7 @@ struct phianalysisrun3_PbPb { if (additionalEvSel5 && (!c1.selection_bit(aod::evsel::kNoCollInTimeRangeStandard) || !c2.selection_bit(aod::evsel::kNoCollInTimeRangeStandard))) { continue; } - if (additionalEvSel6 && (!c1.selection_bit(aod::evsel::kNoCollInRofStandard) || !c2.selection_bit(aod::evsel::kNoCollInRofStandard))) { + if (additionalEvSel6 && (!c1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !c2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { continue; } int occupancy1 = c1.trackOccupancyInTimeRange(); @@ -723,7 +723,7 @@ struct phianalysisrun3_PbPb { if (additionalEvSel5 && (!c1.selection_bit(aod::evsel::kNoCollInTimeRangeStandard) || !c2.selection_bit(aod::evsel::kNoCollInTimeRangeStandard))) { continue; } - if (additionalEvSel6 && (!c1.selection_bit(aod::evsel::kNoCollInRofStandard) || !c2.selection_bit(aod::evsel::kNoCollInRofStandard))) { + if (additionalEvSel6 && (!c1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !c2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { continue; } int occupancy1 = c1.trackOccupancyInTimeRange(); @@ -791,7 +791,7 @@ struct phianalysisrun3_PbPb { if (additionalEvSel5 && (!c1.selection_bit(aod::evsel::kNoCollInTimeRangeStandard) || !c2.selection_bit(aod::evsel::kNoCollInTimeRangeStandard))) { continue; } - if (additionalEvSel6 && (!c1.selection_bit(aod::evsel::kNoCollInRofStandard) || !c2.selection_bit(aod::evsel::kNoCollInRofStandard))) { + if (additionalEvSel6 && (!c1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !c2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { continue; } int occupancy1 = c1.trackOccupancyInTimeRange(); @@ -1315,7 +1315,7 @@ struct phianalysisrun3_PbPb { if (additionalEvSel5 && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { return; } - if (additionalEvSel6 && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { + if (additionalEvSel6 && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { return; } int occupancy = collision.trackOccupancyInTimeRange(); @@ -1410,7 +1410,7 @@ struct phianalysisrun3_PbPb { if (additionalEvSel5 && (!c1.selection_bit(aod::evsel::kNoCollInTimeRangeStandard) || !c2.selection_bit(aod::evsel::kNoCollInTimeRangeStandard))) { continue; } - if (additionalEvSel6 && (!c1.selection_bit(aod::evsel::kNoCollInRofStandard) || !c2.selection_bit(aod::evsel::kNoCollInRofStandard))) { + if (additionalEvSel6 && (!c1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !c2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { continue; } int occupancy1 = c1.trackOccupancyInTimeRange(); @@ -1488,7 +1488,7 @@ struct phianalysisrun3_PbPb { continue; } histos.fill(HIST("hMC1"), 8.5); - if (additionalEvSel6 && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + if (additionalEvSel6 && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { continue; } histos.fill(HIST("hMC1"), 9.5); @@ -1522,9 +1522,8 @@ struct phianalysisrun3_PbPb { } histos.fill(HIST("hMC1"), 12.5); for (const auto& mcParticle : mcParticles) { - const double kMaxRapidityCut = 0.5; - if (std::abs(mcParticle.y()) >= kMaxRapidityCut) { + if (mcParticle.y() < rapiditycut1 || mcParticle.y() > rapiditycut2) { continue; } @@ -1584,7 +1583,7 @@ struct phianalysisrun3_PbPb { if (additionalEvSel5 && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { return; } - if (additionalEvSel6 && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + if (additionalEvSel6 && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { return; } int occupancy = collision.trackOccupancyInTimeRange(); @@ -1657,12 +1656,9 @@ struct phianalysisrun3_PbPb { if (!mothertrack1.producedByGenerator()) { continue; } - const double kMaxRapidityCut = 0.5; - - if (std::abs(mothertrack1.y()) >= kMaxRapidityCut) { + if (mothertrack1.y() < rapiditycut1 || mothertrack1.y() > rapiditycut2) { continue; } - if (std::abs(mothertrack1.pdgCode()) != o2::constants::physics::kPhi) { continue; } From a691e4cafc4b3b5e7a1098393c7f2750f847402d Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Thu, 14 Aug 2025 23:56:40 +0200 Subject: [PATCH 059/986] [PWGCF] FemtoUniverse: Add hist. binnings for momentum as configurables (#12585) Co-authored-by: ALICE Action Bot --- .../Core/FemtoUniverseParticleHisto.h | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h index dc46dae8df7..0fa792fb3be 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h @@ -69,8 +69,8 @@ class FemtoUniverseParticleHisto } // comment - template - void init_debug(std::string folderName) // o2-linter: disable=name/function-variable + template + void init_debug(std::string folderName, T& tempFitVarpTAxis) // o2-linter: disable=name/function-variable { std::string folderSuffix = static_cast(o2::aod::femtouniverse_mc_particle::MCTypeName[mc]).c_str(); if constexpr (mParticleType == o2::aod::femtouniverseparticle::ParticleType::kTrack || mParticleType == o2::aod::femtouniverseparticle::ParticleType::kV0Child || mParticleType == o2::aod::femtouniverseparticle::ParticleType::kCascadeBachelor || mParticleType == o2::aod::femtouniverseparticle::ParticleType::kMCTruthTrack) { @@ -86,22 +86,22 @@ class FemtoUniverseParticleHisto mHistogramRegistry->add((folderName + folderSuffix + "/hITSclustersIB").c_str(), "; ITS clusters in IB; Entries", kTH1F, {{10, -0.5, 9.5}}); mHistogramRegistry->add((folderName + folderSuffix + "/hDCAz").c_str(), "; #it{p}_{T} (GeV/#it{c}); DCA_{z} (cm)", kTH2F, {{100, 0, 10}, {500, -5, 5}}); mHistogramRegistry->add((folderName + folderSuffix + "/hDCA").c_str(), "; #it{p}_{T} (GeV/#it{c}); DCA (cm)", kTH2F, {{100, 0, 10}, {301, 0., 1.5}}); - mHistogramRegistry->add((folderName + folderSuffix + "/hTPCdEdX").c_str(), "; #it{p} (GeV/#it{c}); TPC Signal", kTH2F, {{100, 0, 10}, {1000, 0, 1000}}); - mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTPC_el").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{TPC}^{e}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); - mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTPC_pi").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{TPC}^{#pi}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); - mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTPC_K").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{TPC}^{K}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); - mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTPC_p").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{TPC}^{p}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); - mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTPC_d").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{TPC}^{d}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); - mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTOF_el").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{TOF}^{e}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); - mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTOF_pi").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{TOF}^{#pi}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); - mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTOF_K").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{TOF}^{K}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); - mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTOF_p").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{TOF}^{p}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); - mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTOF_d").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{TOF}^{d}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); - mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaComb_el").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{comb}^{e}", kTH2F, {{100, 0, 10}, {100, 0, 5}}); - mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaComb_pi").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{comb}^{#pi}", kTH2F, {{100, 0, 10}, {100, 0, 5}}); - mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaComb_K").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{comb}^{K}", kTH2F, {{100, 0, 10}, {100, 0, 5}}); - mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaComb_p").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{comb}^{p}", kTH2F, {{100, 0, 10}, {100, 0, 5}}); - mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaComb_d").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{comb}^{d}", kTH2F, {{100, 0, 10}, {100, 0, 5}}); + mHistogramRegistry->add((folderName + folderSuffix + "/hTPCdEdX").c_str(), "; #it{p} (GeV/#it{c}); TPC Signal", kTH2F, {{tempFitVarpTAxis}, {1000, 0, 1000}}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTPC_el").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{TPC}^{e}", kTH2F, {{tempFitVarpTAxis}, {200, -4.975, 5.025}}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTPC_pi").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{TPC}^{#pi}", kTH2F, {{tempFitVarpTAxis}, {200, -4.975, 5.025}}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTPC_K").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{TPC}^{K}", kTH2F, {{tempFitVarpTAxis}, {200, -4.975, 5.025}}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTPC_p").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{TPC}^{p}", kTH2F, {{tempFitVarpTAxis}, {200, -4.975, 5.025}}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTPC_d").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{TPC}^{d}", kTH2F, {{tempFitVarpTAxis}, {200, -4.975, 5.025}}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTOF_el").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{TOF}^{e}", kTH2F, {{tempFitVarpTAxis}, {200, -4.975, 5.025}}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTOF_pi").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{TOF}^{#pi}", kTH2F, {{tempFitVarpTAxis}, {200, -4.975, 5.025}}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTOF_K").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{TOF}^{K}", kTH2F, {{tempFitVarpTAxis}, {200, -4.975, 5.025}}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTOF_p").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{TOF}^{p}", kTH2F, {{tempFitVarpTAxis}, {200, -4.975, 5.025}}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTOF_d").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{TOF}^{d}", kTH2F, {{tempFitVarpTAxis}, {200, -4.975, 5.025}}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaComb_el").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{comb}^{e}", kTH2F, {{tempFitVarpTAxis}, {100, 0, 5}}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaComb_pi").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{comb}^{#pi}", kTH2F, {{tempFitVarpTAxis}, {100, 0, 5}}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaComb_K").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{comb}^{K}", kTH2F, {{tempFitVarpTAxis}, {100, 0, 5}}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaComb_p").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{comb}^{p}", kTH2F, {{tempFitVarpTAxis}, {100, 0, 5}}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaComb_d").c_str(), "; #it{p} (GeV/#it{c}); n#sigma_{comb}^{d}", kTH2F, {{tempFitVarpTAxis}, {100, 0, 5}}); } else if constexpr (mParticleType == o2::aod::femtouniverseparticle::ParticleType::kV0) { mHistogramRegistry->add((folderName + folderSuffix + "/hDaughDCA").c_str(), "; DCA^{daugh} (cm); Entries", kTH1F, {{1000, 0, 10}}); mHistogramRegistry->add((folderName + folderSuffix + "/hTransRadius").c_str(), "; #it{r}_{xy} (cm); Entries", kTH1F, {{1500, 0, 150}}); @@ -242,7 +242,7 @@ class FemtoUniverseParticleHisto // Fill here the actual histogramms by calling init_base and init_MC init_base(folderName, tempFitVarAxisTitle, tempFitVarpTAxis, tempFitVarAxis); if (isDebug) { - init_debug(folderName); + init_debug(folderName, tempFitVarpTAxis); } if (isMC) { init_base(folderName, tempFitVarAxisTitle, tempFitVarpTAxis, tempFitVarAxis); From 4f47c95b5ce0e64e569b03815e71f9645ba473a7 Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Fri, 15 Aug 2025 01:59:15 +0200 Subject: [PATCH 060/986] [PWGCF] FemtoUniverse: Add fill function for misidentifications (#12587) --- .../femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx index f71c6f5dada..3dfb7d7f4ed 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx @@ -472,6 +472,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { continue; } trackHistoPartOne.fillQA(part); + trackHistoPartOne.fillQAMisIden(part, trackonefilter.ConfPDGCodePartOne); } } From c8b8dc17a81fa493114357cccc67d0aca311d416 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 15 Aug 2025 02:58:56 +0200 Subject: [PATCH 061/986] [PWGEM/PhotonMeson] reduce dependency in MC (#12588) --- PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h | 5 +++-- PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h | 13 +++++++------ PWGEM/PhotonMeson/Core/TaggingPi0MC.h | 7 ++++--- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h index cf859a59fc4..8d2f16d34f6 100644 --- a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h +++ b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h @@ -114,7 +114,8 @@ struct Pi0EtaToGammaGamma { EMPhotonEventCut fEMEventCut; struct : ConfigurableGroup { std::string prefix = "eventcut_group"; - Configurable cfgZvtxMax{"cfgZvtxMax", 10.f, "max. Zvtx"}; + Configurable cfgZvtxMin{"cfgZvtxMin", -10.f, "min. Zvtx"}; + Configurable cfgZvtxMax{"cfgZvtxMax", +10.f, "max. Zvtx"}; Configurable cfgRequireSel8{"cfgRequireSel8", true, "require sel8 in event cut"}; Configurable cfgRequireFT0AND{"cfgRequireFT0AND", true, "require FT0AND in event cut"}; Configurable cfgRequireNoTFB{"cfgRequireNoTFB", false, "require No time frame border in event cut"}; @@ -339,7 +340,7 @@ struct Pi0EtaToGammaGamma { fEMEventCut = EMPhotonEventCut("fEMEventCut", "fEMEventCut"); fEMEventCut.SetRequireSel8(eventcuts.cfgRequireSel8); fEMEventCut.SetRequireFT0AND(eventcuts.cfgRequireFT0AND); - fEMEventCut.SetZvtxRange(-eventcuts.cfgZvtxMax, +eventcuts.cfgZvtxMax); + fEMEventCut.SetZvtxRange(eventcuts.cfgZvtxMin, eventcuts.cfgZvtxMax); fEMEventCut.SetRequireNoTFB(eventcuts.cfgRequireNoTFB); fEMEventCut.SetRequireNoITSROFB(eventcuts.cfgRequireNoITSROFB); fEMEventCut.SetRequireNoSameBunchPileup(eventcuts.cfgRequireNoSameBunchPileup); diff --git a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h index b329e9a52a3..16cd3054172 100644 --- a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h +++ b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h @@ -57,7 +57,7 @@ using namespace o2::aod::pwgem::photonmeson::photonpair; using namespace o2::aod::pwgem::photonmeson::utils::mcutil; using namespace o2::aod::pwgem::dilepton::utils::mcutil; -using MyCollisions = soa::Join; +using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; using MyCollisionsWithJJMC = soa::Join; @@ -91,7 +91,7 @@ struct Pi0EtaToGammaGammaMC { Configurable cfgQvecEstimator{"cfgQvecEstimator", 0, "FT0M:0, FT0A:1, FT0C:2"}; Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; - Configurable cfgCentMin{"cfgCentMin", 0, "min. centrality"}; + Configurable cfgCentMin{"cfgCentMin", -1, "min. centrality"}; Configurable cfgCentMax{"cfgCentMax", 999, "max. centrality"}; Configurable maxY_rec{"maxY_rec", 0.9, "maximum rapidity for reconstructed particles"}; Configurable fd_k0s_to_pi0{"fd_k0s_pi0", "1.0", "feed down correction to pi0"}; @@ -100,10 +100,11 @@ struct Pi0EtaToGammaGammaMC { EMPhotonEventCut fEMEventCut; struct : ConfigurableGroup { std::string prefix = "eventcut_group"; - Configurable cfgZvtxMax{"cfgZvtxMax", 10.f, "max. Zvtx"}; - Configurable cfgRequireSel8{"cfgRequireSel8", true, "require sel8 in event cut"}; + Configurable cfgZvtxMin{"cfgZvtxMin", -10.f, "min. Zvtx"}; + Configurable cfgZvtxMax{"cfgZvtxMax", +10.f, "max. Zvtx"}; + Configurable cfgRequireSel8{"cfgRequireSel8", false, "require sel8 in event cut"}; Configurable cfgRequireFT0AND{"cfgRequireFT0AND", true, "require FT0AND in event cut"}; - Configurable cfgRequireNoTFB{"cfgRequireNoTFB", false, "require No time frame border in event cut"}; + Configurable cfgRequireNoTFB{"cfgRequireNoTFB", true, "require No time frame border in event cut"}; Configurable cfgRequireNoITSROFB{"cfgRequireNoITSROFB", false, "require no ITS readout frame border in event cut"}; Configurable cfgRequireNoSameBunchPileup{"cfgRequireNoSameBunchPileup", false, "require no same bunch pileup in event cut"}; Configurable cfgRequireVertexITSTPC{"cfgRequireVertexITSTPC", false, "require Vertex ITSTPC in event cut"}; // ITS-TPC matched track contributes PV. @@ -298,7 +299,7 @@ struct Pi0EtaToGammaGammaMC { fEMEventCut = EMPhotonEventCut("fEMEventCut", "fEMEventCut"); fEMEventCut.SetRequireSel8(eventcuts.cfgRequireSel8); fEMEventCut.SetRequireFT0AND(eventcuts.cfgRequireFT0AND); - fEMEventCut.SetZvtxRange(-eventcuts.cfgZvtxMax, +eventcuts.cfgZvtxMax); + fEMEventCut.SetZvtxRange(eventcuts.cfgZvtxMin, eventcuts.cfgZvtxMax); fEMEventCut.SetRequireNoTFB(eventcuts.cfgRequireNoTFB); fEMEventCut.SetRequireNoITSROFB(eventcuts.cfgRequireNoITSROFB); fEMEventCut.SetRequireNoSameBunchPileup(eventcuts.cfgRequireNoSameBunchPileup); diff --git a/PWGEM/PhotonMeson/Core/TaggingPi0MC.h b/PWGEM/PhotonMeson/Core/TaggingPi0MC.h index ac3b51be4f2..faf777d0185 100644 --- a/PWGEM/PhotonMeson/Core/TaggingPi0MC.h +++ b/PWGEM/PhotonMeson/Core/TaggingPi0MC.h @@ -56,7 +56,7 @@ using namespace o2::aod::pwgem::photonmeson::photonpair; using namespace o2::aod::pwgem::photonmeson::utils::mcutil; using namespace o2::aod::pwgem::dilepton::utils::mcutil; -using MyCollisions = soa::Join; +using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; using MyMCCollisions = soa::Join; @@ -87,7 +87,7 @@ struct TaggingPi0MC { Configurable cfgQvecEstimator{"cfgQvecEstimator", 0, "FT0M:0, FT0A:1, FT0C:2"}; Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; - Configurable cfgCentMin{"cfgCentMin", 0, "min. centrality"}; + Configurable cfgCentMin{"cfgCentMin", -1, "min. centrality"}; Configurable cfgCentMax{"cfgCentMax", 999, "max. centrality"}; Configurable fd_k0s_to_pi0{"fd_k0s_pi0", "1.0", "feed down correction to pi0"}; Configurable cfgRequireTrueAssociation{"cfgRequireTrueAssociation", false, "flag to require true mc collision association"}; @@ -96,6 +96,7 @@ struct TaggingPi0MC { EMPhotonEventCut fEMEventCut; struct : ConfigurableGroup { std::string prefix = "eventcut_group"; + Configurable cfgZvtxMin{"cfgZvtxMin", -10.f, "min. Zvtx"}; Configurable cfgZvtxMax{"cfgZvtxMax", 10.f, "max. Zvtx"}; Configurable cfgRequireSel8{"cfgRequireSel8", true, "require sel8 in event cut"}; Configurable cfgRequireFT0AND{"cfgRequireFT0AND", true, "require FT0AND in event cut"}; @@ -304,7 +305,7 @@ struct TaggingPi0MC { fEMEventCut = EMPhotonEventCut("fEMEventCut", "fEMEventCut"); fEMEventCut.SetRequireSel8(eventcuts.cfgRequireSel8); fEMEventCut.SetRequireFT0AND(eventcuts.cfgRequireFT0AND); - fEMEventCut.SetZvtxRange(-eventcuts.cfgZvtxMax, +eventcuts.cfgZvtxMax); + fEMEventCut.SetZvtxRange(eventcuts.cfgZvtxMin, eventcuts.cfgZvtxMax); fEMEventCut.SetRequireNoTFB(eventcuts.cfgRequireNoTFB); fEMEventCut.SetRequireNoITSROFB(eventcuts.cfgRequireNoITSROFB); fEMEventCut.SetRequireNoSameBunchPileup(eventcuts.cfgRequireNoSameBunchPileup); From 09d9d9977dd7173277a2cf70b8875891086b9422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Fri, 15 Aug 2025 03:42:24 +0200 Subject: [PATCH 062/986] [PWGHF] Utils: Fix and improve type safety, const correctness, readability. (#12575) --- PWGHF/Core/CentralityEstimation.h | 60 ++++---- PWGHF/Core/DecayChannels.h | 22 +-- PWGHF/D2H/DataModel/ReducedDataModel.h | 26 ++-- .../dataCreatorCharmHadPiReduced.cxx | 9 +- .../dataCreatorCharmResoReduced.cxx | 8 +- .../dataCreatorJpsiHadReduced.cxx | 24 ++-- PWGHF/D2H/Tasks/taskD0.cxx | 6 +- PWGHF/D2H/Tasks/taskDplus.cxx | 8 +- PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx | 41 +++--- .../DataModel/CandidateReconstructionTables.h | 4 +- .../TableProducer/candidateCreator2Prong.cxx | 18 +-- .../TableProducer/candidateCreator3Prong.cxx | 18 +-- .../TableProducer/candidateCreatorCascade.cxx | 2 +- PWGHF/TableProducer/candidateCreatorDstar.cxx | 2 +- .../candidateCreatorSigmac0plusplus.cxx | 2 +- .../candidateCreatorXic0Omegac0.cxx | 2 +- .../candidateCreatorXicToXiPiPi.cxx | 8 +- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 10 +- PWGHF/Tasks/taskCharmHadImpactPar.cxx | 6 +- PWGHF/Tasks/taskMcValidation.cxx | 6 +- PWGHF/Utils/utilsAnalysis.h | 61 ++++---- PWGHF/Utils/utilsBfieldCCDB.h | 9 +- PWGHF/Utils/utilsDerivedData.h | 67 +++++---- PWGHF/Utils/utilsEvSelHf.h | 133 ++++++++++-------- PWGHF/Utils/utilsMcGen.h | 26 ++-- PWGHF/Utils/utilsPid.h | 42 +++--- PWGHF/Utils/utilsTrkCandHf.h | 27 ++-- 27 files changed, 348 insertions(+), 299 deletions(-) diff --git a/PWGHF/Core/CentralityEstimation.h b/PWGHF/Core/CentralityEstimation.h index bd1746c4604..fbe18d28d89 100644 --- a/PWGHF/Core/CentralityEstimation.h +++ b/PWGHF/Core/CentralityEstimation.h @@ -59,8 +59,8 @@ concept hasNTracksPVCent = requires(T collision) { /// Evaluate centrality/multiplicity percentile using FT0A estimator /// \param candidate is candidate /// \return centrality/multiplicity percentile of the collision -template -float getCentralityColl(const Coll& collision) +template +float getCentralityColl(const TCollision& collision) { return collision.centFT0A(); } @@ -68,8 +68,8 @@ float getCentralityColl(const Coll& collision) /// Evaluate centrality/multiplicity percentile using FT0C estimator /// \param candidate is candidate /// \return centrality/multiplicity percentile of the collision -template -float getCentralityColl(const Coll& collision) +template +float getCentralityColl(const TCollision& collision) { return collision.centFT0C(); } @@ -77,8 +77,8 @@ float getCentralityColl(const Coll& collision) /// Evaluate centrality/multiplicity percentile using FT0M estimator /// \param candidate is candidate /// \return centrality/multiplicity percentile of the collision -template -float getCentralityColl(const Coll& collision) +template +float getCentralityColl(const TCollision& collision) { return collision.centFT0M(); } @@ -86,8 +86,8 @@ float getCentralityColl(const Coll& collision) /// Evaluate centrality/multiplicity percentile using FV0A estimator /// \param candidate is candidate /// \return centrality/multiplicity percentile of the collision -template -float getCentralityColl(const Coll& collision) +template +float getCentralityColl(const TCollision& collision) { return collision.centFV0A(); } @@ -95,8 +95,8 @@ float getCentralityColl(const Coll& collision) /// Evaluate centrality/multiplicity percentile using NTracksPV estimator /// \param candidate is candidate /// \return centrality/multiplicity percentile of the collision -template -float getCentralityColl(const Coll& collision) +template +float getCentralityColl(const TCollision& collision) { return collision.centNTPV(); } @@ -104,8 +104,8 @@ float getCentralityColl(const Coll& collision) /// Default case if no centrality/multiplicity estimator is provided /// \param candidate is candidate /// \return dummy value for centrality/multiplicity percentile of the collision -template -float getCentralityColl(const Coll&) +template +float getCentralityColl(const TCollision&) { return 105.0f; } @@ -114,36 +114,36 @@ float getCentralityColl(const Coll&) /// \param collision is the collision with the centrality information /// \param centEstimator integer to select the centrality estimator /// \return collision centrality -template -float getCentralityColl(const Coll& collision, int centEstimator) +template +float getCentralityColl(const TCollision& collision, const int centEstimator) { switch (centEstimator) { case CentralityEstimator::FT0A: - if constexpr (hasFT0ACent) { + if constexpr (hasFT0ACent) { return collision.centFT0A(); } LOG(fatal) << "Collision does not have centFT0A()."; break; case CentralityEstimator::FT0C: - if constexpr (hasFT0CCent) { + if constexpr (hasFT0CCent) { return collision.centFT0C(); } LOG(fatal) << "Collision does not have centFT0C()."; break; case CentralityEstimator::FT0M: - if constexpr (hasFT0MCent) { + if constexpr (hasFT0MCent) { return collision.centFT0M(); } LOG(fatal) << "Collision does not have centFT0M()."; break; case CentralityEstimator::FV0A: - if constexpr (hasFV0ACent) { + if constexpr (hasFV0ACent) { return collision.centFV0A(); } LOG(fatal) << "Collision does not have centFV0A()."; break; default: - LOG(fatal) << "Centrality estimator not valid. Possible values are V0A, T0M, T0A, T0C."; + LOG(fatal) << "Centrality estimator not valid. See CentralityEstimator for valid values."; break; } return -999.f; @@ -152,13 +152,14 @@ float getCentralityColl(const Coll& collision, int centEstimator) /// \brief Function to get MC collision centrality /// \param collSlice collection of reconstructed collisions associated to a generated one /// \return generated MC collision centrality -template -float getCentralityGenColl(CCs const& collSlice) +template +float getCentralityGenColl(TCollisions const& collSlice) { - float centrality{-1}; - float multiplicity{0.f}; + using TMult = uint16_t; // type of numContrib + float centrality{-1.f}; + TMult multiplicity{}; for (const auto& collision : collSlice) { - float collMult = collision.numContrib(); + const TMult collMult = collision.numContrib(); if (collMult > multiplicity) { centrality = getCentralityColl(collision); multiplicity = collMult; @@ -171,13 +172,14 @@ float getCentralityGenColl(CCs const& collSlice) /// \param collSlice collection of reconstructed collisions associated to a generated one /// \param centEstimator integer to select the centrality estimator /// \return generated MC collision centrality -template -float getCentralityGenColl(CCs const& collSlice, int centEstimator) +template +float getCentralityGenColl(TCollisions const& collSlice, const int centEstimator) { - float centrality{-1}; - float multiplicity{0.f}; + using TMult = uint16_t; // type of numContrib + float centrality{-1.f}; + TMult multiplicity{}; for (const auto& collision : collSlice) { - float collMult = collision.numContrib(); + const TMult collMult = collision.numContrib(); if (collMult > multiplicity) { centrality = getCentralityColl(collision, centEstimator); multiplicity = collMult; diff --git a/PWGHF/Core/DecayChannels.h b/PWGHF/Core/DecayChannels.h index 0398afed1c2..0c0392d99e2 100644 --- a/PWGHF/Core/DecayChannels.h +++ b/PWGHF/Core/DecayChannels.h @@ -30,10 +30,12 @@ namespace o2::hf_decay // - HF cascades to LF cascades (Ωc0/Ξc0 → Ξ+ π−, Ξc+ → Ξ+ π− π+) // - Σc +using HfDecayChannel = int8_t; + namespace hf_cand_2prong { /// @brief 2-prong candidates: main channels -enum DecayChannelMain : int8_t { +enum DecayChannelMain : HfDecayChannel { // D0 D0ToPiK = 1, // π+ K− D0ToPiKPi0 = 2, // π+ K− π0 @@ -47,7 +49,7 @@ enum DecayChannelMain : int8_t { NChannelsMain = JpsiToMuMu // last channel }; /// @brief 2-prong candidates: resonant channels -enum DecayChannelResonant : int8_t { +enum DecayChannelResonant : HfDecayChannel { // D0 D0ToRhoplusPi = 1, // ρ+ π− D0ToRhoplusK = 2, // ρ+ K− @@ -61,7 +63,7 @@ enum DecayChannelResonant : int8_t { namespace hf_cand_3prong { /// @brief 3-prong candidates: main channels -enum DecayChannelMain : int8_t { +enum DecayChannelMain : HfDecayChannel { // D+ DplusToPiKPi = 1, // π+ K− π+ DplusToPiKPiPi0 = 2, // π+ K− π+ π0 @@ -94,7 +96,7 @@ enum DecayChannelMain : int8_t { NChannelsMain = XicToSPiPi // last channel }; /// @brief 3-prong candidates: resonant channels -enum DecayChannelResonant : int8_t { +enum DecayChannelResonant : HfDecayChannel { // D+ DplusToPhiPi = 1, // φ π+ DplusToKstar0K = 2, // anti-K*0 K+ @@ -136,7 +138,7 @@ enum DecayChannelResonant : int8_t { namespace hf_cand_dstar { /// @brief D*+ candidates: main channels -enum DecayChannelMain : int8_t { +enum DecayChannelMain : HfDecayChannel { // D*+ DstarToPiKPi = 1, // π+ K− π+ (from [(D0 → π+ K−) π+]) DstarToPiKPiPi0 = 2, // π+ K− π+ π0 (from [(D0 → π+ K− π0) π+] or [(D+ → π+ K− π+) π0]) @@ -148,7 +150,7 @@ enum DecayChannelMain : int8_t { namespace hf_cand_beauty { /// @brief beauty candidates: main channels -enum DecayChannelMain : int8_t { +enum DecayChannelMain : HfDecayChannel { // B0 B0ToDminusPi = 1, // D− π+ B0ToDminusPiPi0 = 2, // D− π+ π0 @@ -176,7 +178,7 @@ enum DecayChannelMain : int8_t { NChannelsMain = B0ToDsPi // last channel }; /// @brief beauty candidates: resonant channels -enum DecayChannelResonant : int8_t { +enum DecayChannelResonant : HfDecayChannel { // B0 B0ToDminusRhoplus = 1, // D− ρ+ B0ToDstarminusPi = 2, // D*− π+ @@ -195,7 +197,7 @@ enum DecayChannelResonant : int8_t { NChannelsResonant = BplusToDstar0Pi // last channel }; /// @brief beauty candidates: beauty to J/ψ decay channels -enum DecayChannelToJpsiMain : int8_t { +enum DecayChannelToJpsiMain : HfDecayChannel { // B0 B0ToJpsiPiK = 1, // J/ψ π− K+ // Bs0 @@ -210,7 +212,7 @@ enum DecayChannelToJpsiMain : int8_t { NChannelsToJpsiMain = BcToJpsiPi // last channel }; /// @brief beauty candidates: beauty to J/ψ resonant decay channels -enum DecayChannelToJpsiResonant : int8_t { +enum DecayChannelToJpsiResonant : HfDecayChannel { // B0 B0ToJpsiKstar0 = 1, // J/ψ K*0(892) // Bs0 @@ -223,7 +225,7 @@ enum DecayChannelToJpsiResonant : int8_t { namespace hf_cand_reso { /// @brief resonance candidates: main channels -enum DecayChannelMain : int8_t { +enum DecayChannelMain : HfDecayChannel { // D1(2420)0 D1zeroToDstarPi = 1, // D*+ π- // D2*(2460)0 diff --git a/PWGHF/D2H/DataModel/ReducedDataModel.h b/PWGHF/D2H/DataModel/ReducedDataModel.h index c2a4d1858a3..3473321a0a5 100644 --- a/PWGHF/D2H/DataModel/ReducedDataModel.h +++ b/PWGHF/D2H/DataModel/ReducedDataModel.h @@ -50,8 +50,8 @@ namespace aod { namespace hf_reduced_collision { -DECLARE_SOA_COLUMN(Bz, bz, float); //! Magnetic field in z-direction -DECLARE_SOA_COLUMN(HfCollisionRejectionMap, hfCollisionRejectionMap, uint32_t); //! Bitmask with failed selection criteria +DECLARE_SOA_COLUMN(Bz, bz, float); //! Magnetic field in z-direction +DECLARE_SOA_COLUMN(HfCollisionRejectionMap, hfCollisionRejectionMap, o2::hf_evsel::HfCollisionRejectionMask); //! Bitmask with failed selection criteria // keep track of the number of studied events (for normalization purposes) DECLARE_SOA_COLUMN(OriginalCollisionCount, originalCollisionCount, int); //! Size of COLLISION table processed DECLARE_SOA_COLUMN(ZvtxSelectedCollisionCount, zvtxSelectedCollisionCount, int); //! Number of COLLISIONS with |zvtx| < zvtxMax @@ -1235,7 +1235,7 @@ DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! DECLARE_SOA_COLUMN(ItsNClsSoftPi, itsNClsSoftPi, int); //! minimum value of number of ITS clusters for the decay daughter tracks DECLARE_SOA_COLUMN(TpcNClsCrossedRowsSoftPi, tpcNClsCrossedRowsSoftPi, int); //! minimum value of number of TPC crossed rows for the decay daughter tracks DECLARE_SOA_COLUMN(TpcChi2NClSoftPi, tpcChi2NClSoftPi, float); //! maximum value of TPC chi2 for the decay daughter tracks -DECLARE_SOA_DYNAMIC_COLUMN(Px, px, //! +DECLARE_SOA_DYNAMIC_COLUMN(Px, px, //! [](float pxProng0, float pxProng1, float pxProng2) -> float { return 1.f * pxProng0 + 1.f * pxProng1 + 1.f * pxProng2; }); DECLARE_SOA_DYNAMIC_COLUMN(Py, py, //! [](float pyProng0, float pyProng1, float pyProng2) -> float { return 1.f * pyProng0 + 1.f * pyProng1 + 1.f * pyProng2; }); @@ -1447,16 +1447,16 @@ DECLARE_SOA_COLUMN(InvMassProng1, invMassProng1, float); //! Invariant Mass of V DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! Sign of the Resonance candidate DECLARE_SOA_COLUMN(IsWrongSign, isWrongSign, int8_t); //! Flag for wrong sign of the Resonance candidate, 1 = wrong sign, 0 = right sign -DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); // flag for resonance decay channel classification reconstruction level -DECLARE_SOA_COLUMN(FlagMcMatchRecD, flagMcMatchRecD, int8_t); // flag for D meson bachelor decay channel classification reconstruction level -DECLARE_SOA_COLUMN(FlagMcMatchChanD, flagMcMatchChanD, int8_t); // flag for D meson resonant channel classification reconstruction level -DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); // flag for decay channel classification generator level -DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, uint16_t); // debug flag for mis-association at reconstruction level -DECLARE_SOA_COLUMN(Origin, origin, int8_t); // Flag for origin of MC particle 1=promt, 2=FD -DECLARE_SOA_COLUMN(SignD0, signD0, int8_t); // Sign of the D0 in the channels with D* -> D0 pi, needed in case of non-matched D* -DECLARE_SOA_COLUMN(PtGen, ptGen, float); // Pt at generation level in GeV/c -DECLARE_SOA_COLUMN(InvMassGen, invMassGen, float); //! Invariant mass at generation level in GeV/c2 -DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, //! +DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); // flag for resonance decay channel classification reconstruction level +DECLARE_SOA_COLUMN(FlagMcMatchRecD, flagMcMatchRecD, int8_t); // flag for D meson bachelor decay channel classification reconstruction level +DECLARE_SOA_COLUMN(FlagMcMatchChanD, flagMcMatchChanD, int8_t); // flag for D meson resonant channel classification reconstruction level +DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); // flag for decay channel classification generator level +DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, uint16_t); // debug flag for mis-association at reconstruction level +DECLARE_SOA_COLUMN(Origin, origin, int8_t); // Flag for origin of MC particle 1=promt, 2=FD +DECLARE_SOA_COLUMN(SignD0, signD0, int8_t); // Sign of the D0 in the channels with D* -> D0 pi, needed in case of non-matched D* +DECLARE_SOA_COLUMN(PtGen, ptGen, float); // Pt at generation level in GeV/c +DECLARE_SOA_COLUMN(InvMassGen, invMassGen, float); //! Invariant mass at generation level in GeV/c2 +DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, //! [](float pxProng0, float pxProng1, float pyProng0, float pyProng1) -> float { return RecoDecay::pt((1.f * pxProng0 + 1.f * pxProng1), (1.f * pyProng0 + 1.f * pyProng1)); }); DECLARE_SOA_DYNAMIC_COLUMN(PtProng0, ptProng0, //! [](float pxProng0, float pyProng0) -> float { return RecoDecay::pt(pxProng0, pyProng0); }); diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx index 52ff971df9e..8b38982c477 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx @@ -1025,7 +1025,7 @@ struct HfDataCreatorCharmHadPiReduced { { registry.fill(HIST("hEvents"), 1 + Event::Processed); float centrality = -1.f; - auto hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (configs.skipRejectedCollisions && hfRejMap != 0) { return; } @@ -1498,15 +1498,16 @@ struct HfDataCreatorCharmHadPiReduced { // Check event selection float centDummy{-1.f}, centFT0C{-1.f}, centFT0M{-1.f}; const auto collSlice = collisions.sliceBy(preslices.colPerMcCollision, mcCollision.globalIndex()); - auto hfRejMap = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centDummy); + const auto hfRejMap = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centDummy); if (configs.skipRejectedCollisions && hfRejMap != 0) { return; } // get centrality - float multiplicity{0.f}; + using TMult = uint16_t; // type of numContrib + TMult multiplicity{}; for (const auto& collision : collSlice) { - float collMult = collision.numContrib(); + const TMult collMult = collision.numContrib(); if (collMult > multiplicity) { centFT0C = collision.centFT0C(); centFT0M = collision.centFT0M(); diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx index fb1964d0ef9..c2d7d6f3047 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx @@ -830,8 +830,8 @@ struct HfDataCreatorCharmResoReduced { CCand const& candCharmBach, BBachTr const& bachelorTrack, Tr const& tracks, - int& indexHfCandCharm, - int64_t& indexCandTrBach) + const int64_t indexHfCandCharm, + const int64_t indexCandTrBach) { std::vector vecDaughtersReso{}; int8_t sign{0}, nKinkedTracks{0}, origin{0}, flagCharmBach{0}, flagCharmBachInterm{0}, flagTrack{0}, flagReso{0}; @@ -992,7 +992,7 @@ struct HfDataCreatorCharmResoReduced { { // helpers for ReducedTables filling float centrality = -1.f; - uint16_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectCollisionsWithBadEvSel && hfRejMap != 0) { return; } @@ -1546,7 +1546,7 @@ struct HfDataCreatorCharmResoReduced { const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex()); // Slice the collisions table to get the collision info for the current MC collision float centrality{-1.f}; - uint16_t rejectionMask{0}; + o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; int nSplitColl = 0; const auto collSlice = collInfos.sliceBy(colPerMcCollision, mcCollision.globalIndex()); rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); diff --git a/PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx index cf6785d286c..41ee2790334 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx @@ -511,10 +511,10 @@ struct HfDataCreatorJpsiHadReduced { /// \param indexHfCandJpsi is the index of the Jpsi candidate /// \param selectedTracksBach is the map with the indices of selected bachelor pion tracks template - void fillMcRecoInfo(const CColl& collision, - const PParticles& particlesMc, - const std::vector& vecDaughtersB, - int& indexHfCandJpsi, + void fillMcRecoInfo(CColl const& collision, + PParticles const& particlesMc, + std::vector const& vecDaughtersB, + const int64_t indexHfCandJpsi, std::array, 2> selectedTracksBach, const int64_t indexCollisionMaxNumContrib) { @@ -728,13 +728,13 @@ struct HfDataCreatorJpsiHadReduced { registry.fill(HIST("hEvents"), 1 + Event::Processed); float centrality = -1.f; - auto hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (skipRejectedCollisions && hfRejMap != 0) { return; } // helpers for ReducedTables filling - int indexHfReducedCollision = hfReducedCollision.lastIndex() + 1; + int const indexHfReducedCollision = hfReducedCollision.lastIndex() + 1; // std::map where the key is the track.globalIndex() and // the value is the track index in the table of the selected tracks std::map selectedTracksBach; @@ -797,8 +797,8 @@ struct HfDataCreatorJpsiHadReduced { // --------------------------------- // reconstruct J/Psi candidate secondary vertex - o2::track::TrackParCov trackParCovJpsi{}; - std::array pVecJpsi{}; + o2::track::TrackParCov trackParCovJpsi{}; // FIXME: unused + std::array pVecJpsi{}; // FIXME: unused registry.fill(HIST("hFitCandidatesJpsi"), SVFitting::BeforeFit); try { if (df2.process(trackPosParCov, trackNegParCov) == 0) { @@ -823,8 +823,8 @@ struct HfDataCreatorJpsiHadReduced { } registry.fill(HIST("hSelectionsJpsi"), 2 + aod::SelectionStep::RecoPID, candidate.pt()); - int indexHfCandJpsi = hfJpsi.lastIndex() + 1; - float invMassJpsi = runJpsiToee ? hfHelper.invMassJpsiToEE(candidate) : hfHelper.invMassJpsiToMuMu(candidate); + int const indexHfCandJpsi = hfJpsi.lastIndex() + 1; + float const invMassJpsi = runJpsiToee ? hfHelper.invMassJpsiToEE(candidate) : hfHelper.invMassJpsiToMuMu(candidate); registry.fill(HIST("hMassJpsi"), invMassJpsi); registry.fill(HIST("hPtJpsi"), candidate.pt()); registry.fill(HIST("hCpaJpsi"), candidate.cpa()); @@ -1189,7 +1189,7 @@ struct HfDataCreatorJpsiHadReduced { auto candsJpsiThisColl = candsJpsi.sliceBy(candsJpsiPerCollision, thisCollId); auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId()); - int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); + int64_t const indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); runDataCreation(collision, candsJpsiThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); } // handle normalization by the right number of collisions @@ -1226,7 +1226,7 @@ struct HfDataCreatorJpsiHadReduced { auto candsJpsiThisColl = candsJpsi.sliceBy(candsJpsiPerCollision, thisCollId); auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId()); - int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); + int64_t const indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); runDataCreation(collision, candsJpsiThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); } // handle normalization by the right number of collisions diff --git a/PWGHF/D2H/Tasks/taskD0.cxx b/PWGHF/D2H/Tasks/taskD0.cxx index 30bc3787e24..3e4be3ca15c 100644 --- a/PWGHF/D2H/Tasks/taskD0.cxx +++ b/PWGHF/D2H/Tasks/taskD0.cxx @@ -391,7 +391,7 @@ struct HfTaskD0 { cent = getCentralityColl(collision, centEstimator); } if (storeOccupancy && occEstimator != OccupancyEstimator::None) { - occ = getOccupancyColl(collision, occEstimator); + occ = o2::hf_occupancy::getOccupancyColl(collision, occEstimator); } } @@ -558,7 +558,7 @@ struct HfTaskD0 { cent = getCentralityColl(collision, centEstimator); } if (storeOccupancy && occEstimator != OccupancyEstimator::None) { - occ = getOccupancyColl(collision, occEstimator); + occ = o2::hf_occupancy::getOccupancyColl(collision, occEstimator); } float massD0, massD0bar; if constexpr (reconstructionType == aod::hf_cand::VertexerType::KfParticle) { @@ -844,7 +844,7 @@ struct HfTaskD0 { cent = getCentralityGenColl(recoCollsPerMcCollCent, centEstimator); } if (storeOccupancy && occEstimator != OccupancyEstimator::None) { - occ = getOccupancyGenColl(recoCollsPerMcCollCent, occEstimator); + occ = o2::hf_occupancy::getOccupancyGenColl(recoCollsPerMcCollCent, occEstimator); } } else { const auto& recoCollsPerMcColl = collisions.sliceBy(colPerMcCollision, particle.mcCollision().globalIndex()); diff --git a/PWGHF/D2H/Tasks/taskDplus.cxx b/PWGHF/D2H/Tasks/taskDplus.cxx index 921d39364e6..9740516e91c 100644 --- a/PWGHF/D2H/Tasks/taskDplus.cxx +++ b/PWGHF/D2H/Tasks/taskDplus.cxx @@ -506,7 +506,7 @@ struct HfTaskDplus { cent = getCentralityColl(collision, centEstimator); } if (storeOccupancy && occEstimator != OccupancyEstimator::None) { - occ = getOccupancyColl(collision, occEstimator); + occ = o2::hf_occupancy::getOccupancyColl(collision, occEstimator); } if (storePvContributors) { numPvContr = collision.numContrib(); @@ -563,7 +563,7 @@ struct HfTaskDplus { cent = getCentralityColl(collision, centEstimator); } if (storeOccupancy && occEstimator != OccupancyEstimator::None) { - occ = getOccupancyColl(collision, occEstimator); + occ = o2::hf_occupancy::getOccupancyColl(collision, occEstimator); } if (storePvContributors) { numPvContr = collision.numContrib(); @@ -587,7 +587,7 @@ struct HfTaskDplus { cent = getCentralityColl(collision, centEstimator); } if (storeOccupancy && occEstimator != OccupancyEstimator::None) { - occ = getOccupancyColl(collision, occEstimator); + occ = o2::hf_occupancy::getOccupancyColl(collision, occEstimator); } if (storePvContributors) { numPvContr = collision.numContrib(); @@ -622,7 +622,7 @@ struct HfTaskDplus { cent = getCentralityGenColl(recoCollsPerGenMcColl, centEstimator); } if (storeOccupancy && occEstimator != OccupancyEstimator::None) { - occ = getOccupancyGenColl(recoCollsPerGenMcColl, occEstimator); + occ = o2::hf_occupancy::getOccupancyGenColl(recoCollsPerGenMcColl, occEstimator); } for (const auto& particle : mcParticlesPerGenMcColl) { diff --git a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx index 7960aeb7f4f..5666daeaacb 100644 --- a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx +++ b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx @@ -317,10 +317,10 @@ struct HfTaskFlowCharmHadrons { /// \param tracksQy is the Y component of the Q vector for the tracks /// \param channel is the decay channel template - void getQvecDtracks(const T1& cand, + void getQvecDtracks(T1 const& cand, std::vector& tracksQx, std::vector& tracksQy, - float& ampl) + const float ampl) { // TODO: add possibility to consider different weights for the tracks, at the moment only pT is considered; float pXTrack0 = cand.pxProng0(); @@ -398,7 +398,7 @@ struct HfTaskFlowCharmHadrons { /// Get the event selection flags /// \param hfevselflag is the event selection flag - std::vector getEventSelectionFlags(uint32_t hfevselflag) + std::vector getEventSelectionFlags(const o2::hf_evsel::HfCollisionRejectionMask hfevselflag) { return { TESTBIT(hfevselflag, o2::hf_evsel::EventRejection::NoSameBunchPileup), @@ -419,16 +419,16 @@ struct HfTaskFlowCharmHadrons { /// \param outputMl are the ML scores /// \param occupancy is the occupancy of the collision using the track estimator /// \param hfevselflag flag of the collision associated to utilsEvSelHf.h - void fillThn(float& mass, - float& pt, - float& cent, - float& cosNPhi, - float& sinNPhi, - float& cosDeltaPhi, - float& sp, - std::vector& outputMl, - float& occupancy, - uint32_t& hfevselflag) + void fillThn(const float mass, + const float pt, + const float cent, + const float cosNPhi, + const float sinNPhi, + const float cosDeltaPhi, + const float sp, + const std::vector& outputMl, + const float occupancy, + const o2::hf_evsel::HfCollisionRejectionMask hfevselflag) { if (occEstimator != 0) { std::vector evtSelFlags = getEventSelectionFlags(hfevselflag); @@ -476,7 +476,7 @@ struct HfTaskFlowCharmHadrons { aod::BCsWithTimestamps const&, float& centrality) { - float occupancy = getOccupancyColl(collision, occEstimator); + const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, occEstimator); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); @@ -546,9 +546,9 @@ struct HfTaskFlowCharmHadrons { return; } float occupancy = 0.; - uint32_t hfevflag{}; + o2::hf_evsel::HfCollisionRejectionMask hfevflag{}; if (occEstimator != 0) { - occupancy = getOccupancyColl(collision, occEstimator); + occupancy = o2::hf_occupancy::getOccupancyColl(collision, occEstimator); registry.fill(HIST("trackOccVsFT0COcc"), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, cent, ccdb, registry); } @@ -668,7 +668,7 @@ struct HfTaskFlowCharmHadrons { // If TPC is used for the SP estimation, the tracks of the hadron candidate must be removed from the TPC Q vector to avoid double counting if (qvecDetector == QvecEstimator::TPCNeg || qvecDetector == QvecEstimator::TPCPos) { - float ampl = amplQVec - static_cast(nProngs); + float const ampl = amplQVec - static_cast(nProngs); std::vector tracksQx = {}; std::vector tracksQy = {}; if constexpr (std::is_same_v || std::is_same_v) { @@ -846,11 +846,10 @@ struct HfTaskFlowCharmHadrons { centrality = o2::hf_centrality::getCentralityColl(collision, o2::hf_centrality::CentralityEstimator::FT0C); if (storeResoOccu) { - float occupancy{-1.f}; - occupancy = getOccupancyColl(collision, occEstimator); + const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, occEstimator); registry.fill(HIST("trackOccVsFT0COcc"), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); - uint32_t hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); - std::vector evtSelFlags = getEventSelectionFlags(hfevflag); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + std::vector evtSelFlags = getEventSelectionFlags(rejectionMask); registry.fill(HIST("spReso/hSparseReso"), centrality, xQVecFT0c * xQVecFV0a + yQVecFT0c * yQVecFV0a, xQVecFT0c * xQVecBTot + yQVecFT0c * yQVecBTot, xQVecFV0a * xQVecBTot + yQVecFV0a * yQVecBTot, diff --git a/PWGHF/DataModel/CandidateReconstructionTables.h b/PWGHF/DataModel/CandidateReconstructionTables.h index 57f465f3b76..d4b6a74a867 100644 --- a/PWGHF/DataModel/CandidateReconstructionTables.h +++ b/PWGHF/DataModel/CandidateReconstructionTables.h @@ -18,7 +18,9 @@ #ifndef PWGHF_DATAMODEL_CANDIDATERECONSTRUCTIONTABLES_H_ #define PWGHF_DATAMODEL_CANDIDATERECONSTRUCTIONTABLES_H_ +#include "PWGHF/Utils/utilsEvSelHf.h" #include "PWGHF/Utils/utilsPid.h" +// #include "PWGLF/DataModel/LFStrangenessTables.h" #include "ALICE3/DataModel/ECAL.h" @@ -192,7 +194,7 @@ DECLARE_SOA_TABLE(PidTpcTofTinyPr, "AOD", "PIDTPCTOFTINYPR", //! Table of the TP namespace hf_sel_collision { -DECLARE_SOA_COLUMN(WhyRejectColl, whyRejectColl, uint32_t); //! +DECLARE_SOA_COLUMN(WhyRejectColl, whyRejectColl, o2::hf_evsel::HfCollisionRejectionMask); //! } // namespace hf_sel_collision DECLARE_SOA_TABLE(HfSelCollision, "AOD", "HFSELCOLLISION", //! diff --git a/PWGHF/TableProducer/candidateCreator2Prong.cxx b/PWGHF/TableProducer/candidateCreator2Prong.cxx index a4c7c4ced21..a897d9fd2f3 100644 --- a/PWGHF/TableProducer/candidateCreator2Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator2Prong.cxx @@ -234,7 +234,7 @@ struct HfCandidateCreator2Prong { /// reject candidates not satisfying the event selections auto collision = rowTrackIndexProng2.template collision_as(); float centrality{-1.f}; - uint32_t rejectionMask{0}; + o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; if constexpr (applyUpcSel) { rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, registry, bcs); } else { @@ -340,7 +340,7 @@ struct HfCandidateCreator2Prong { if (indexCollision == track1.collisionId() && track1.isPVContributor()) { SETBIT(bitmapProngsContributorsPV, 1); } - uint8_t nProngsContributorsPV = hf_trkcandsel::countOnesInBinary(bitmapProngsContributorsPV); + const auto nProngsContributorsPV = hf_trkcandsel::countOnesInBinary(bitmapProngsContributorsPV); // fill candidate table rows rowCandidateBase(indexCollision, @@ -391,7 +391,7 @@ struct HfCandidateCreator2Prong { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexProng2.template collision_as(); float centrality{-1.f}; - uint32_t rejectionMask{0}; + o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; if constexpr (applyUpcSel) { rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, registry, bcs); } else { @@ -501,7 +501,7 @@ struct HfCandidateCreator2Prong { if (indexCollision == track1.collisionId() && track1.isPVContributor()) { SETBIT(bitmapProngsContributorsPV, 1); } - uint8_t nProngsContributorsPV = hf_trkcandsel::countOnesInBinary(bitmapProngsContributorsPV); + const auto nProngsContributorsPV = hf_trkcandsel::countOnesInBinary(bitmapProngsContributorsPV); // fill candidate table rows rowCandidateBase(indexCollision, @@ -750,7 +750,7 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; - float occupancy = getOccupancyColl(collision, hfEvSel.occEstimator); + const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections @@ -768,7 +768,7 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; - float occupancy = getOccupancyColl(collision, hfEvSel.occEstimator); + const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections @@ -786,7 +786,7 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; - float occupancy = getOccupancyColl(collision, hfEvSel.occEstimator); + const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections @@ -809,7 +809,7 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; - float occupancy = getOccupancyColl(collision, hfEvSel.occEstimator); + const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections @@ -1028,7 +1028,7 @@ struct HfCandidateCreator2ProngExpressions { const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex()); // Slice the collisions table to get the collision info for the current MC collision float centrality{-1.f}; - uint32_t rejectionMask{0u}; + o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; int nSplitColl = 0; if constexpr (centEstimator == CentralityEstimator::FT0C) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex()); diff --git a/PWGHF/TableProducer/candidateCreator3Prong.cxx b/PWGHF/TableProducer/candidateCreator3Prong.cxx index f3bfce8ba51..dce9db32828 100644 --- a/PWGHF/TableProducer/candidateCreator3Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator3Prong.cxx @@ -276,7 +276,7 @@ struct HfCandidateCreator3Prong { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexProng3.template collision_as(); float centrality{-1.f}; - uint32_t rejectionMask{0}; + o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; if constexpr (applyUpcSel) { rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, registry, bcs); } else { @@ -394,7 +394,7 @@ struct HfCandidateCreator3Prong { if (indexCollision == track2.collisionId() && track2.isPVContributor()) { SETBIT(bitmapProngsContributorsPV, 2); } - uint8_t nProngsContributorsPV = hf_trkcandsel::countOnesInBinary(bitmapProngsContributorsPV); + const auto nProngsContributorsPV = hf_trkcandsel::countOnesInBinary(bitmapProngsContributorsPV); // fill candidate table rows rowCandidateBase(indexCollision, @@ -447,7 +447,7 @@ struct HfCandidateCreator3Prong { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexProng3.template collision_as(); float centrality{-1.f}; - uint32_t rejectionMask{0}; + o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; if constexpr (applyUpcSel) { rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, registry, bcs); } else { @@ -635,7 +635,7 @@ struct HfCandidateCreator3Prong { if (indexCollision == track2.collisionId() && track2.isPVContributor()) { SETBIT(bitmapProngsContributorsPV, 2); } - uint8_t nProngsContributorsPV = hf_trkcandsel::countOnesInBinary(bitmapProngsContributorsPV); + const auto nProngsContributorsPV = hf_trkcandsel::countOnesInBinary(bitmapProngsContributorsPV); // fill candidate table rows rowCandidateBase(indexCollision, @@ -894,7 +894,7 @@ struct HfCandidateCreator3Prong { /// bitmask with event. selection info float centrality{-1.f}; - float occupancy = getOccupancyColl(collision, hfEvSel.occEstimator); + const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections @@ -912,7 +912,7 @@ struct HfCandidateCreator3Prong { /// bitmask with event. selection info float centrality{-1.f}; - float occupancy = getOccupancyColl(collision, hfEvSel.occEstimator); + const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections @@ -930,7 +930,7 @@ struct HfCandidateCreator3Prong { /// bitmask with event. selection info float centrality{-1.f}; - float occupancy = getOccupancyColl(collision, hfEvSel.occEstimator); + const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections @@ -953,7 +953,7 @@ struct HfCandidateCreator3Prong { /// bitmask with event. selection info float centrality{-1.f}; - float occupancy = getOccupancyColl(collision, hfEvSel.occEstimator); + const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections @@ -1316,7 +1316,7 @@ struct HfCandidateCreator3ProngExpressions { const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex()); // Slice the collisions table to get the collision info for the current MC collision float centrality{-1.f}; - uint32_t rejectionMask{0u}; + o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; int nSplitColl = 0; if constexpr (centEstimator == CentralityEstimator::FT0C) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex()); diff --git a/PWGHF/TableProducer/candidateCreatorCascade.cxx b/PWGHF/TableProducer/candidateCreatorCascade.cxx index 20e16710463..1bfe94031cb 100644 --- a/PWGHF/TableProducer/candidateCreatorCascade.cxx +++ b/PWGHF/TableProducer/candidateCreatorCascade.cxx @@ -564,7 +564,7 @@ struct HfCandidateCreatorCascadeMc { const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex()); // Slice the collisions table to get the collision info for the current MC collision float centrality{-1.f}; - uint32_t rejectionMask{0u}; + o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; int nSplitColl = 0; if constexpr (centEstimator == CentralityEstimator::FT0C) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex()); diff --git a/PWGHF/TableProducer/candidateCreatorDstar.cxx b/PWGHF/TableProducer/candidateCreatorDstar.cxx index 9036717104b..3bb4472be62 100644 --- a/PWGHF/TableProducer/candidateCreatorDstar.cxx +++ b/PWGHF/TableProducer/candidateCreatorDstar.cxx @@ -732,7 +732,7 @@ struct HfCandidateCreatorDstarExpressions { const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex()); // Slice the collisions table to get the collision info for the current MC collision float centrality{-1.f}; - uint32_t rejectionMask{0u}; + o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; int nSplitColl = 0; if constexpr (centEstimator == CentralityEstimator::FT0C) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex()); diff --git a/PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx b/PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx index 9a59c28cf9c..e826254ea35 100644 --- a/PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx +++ b/PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx @@ -587,7 +587,7 @@ struct HfCandidateSigmac0plusplusMc { auto mcCollision = particle.mcCollision(); float centrality{-1.f}; const auto collSlice = collInfos.sliceBy(colPerMcCollision, mcCollision.globalIndex()); - auto rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + const auto rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); hfEvSelMc.fillHistograms(mcCollision, rejectionMask, 0); if (rejectionMask != 0) { // at least one event selection not satisfied --> reject gen particles from this collision diff --git a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx index 9d7413d75d1..5f3e0b3ebba 100644 --- a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx +++ b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx @@ -2726,7 +2726,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex()); // Slice the collisions table to get the collision info for the current MC collision float centrality{-1.f}; - uint32_t rejectionMask{0u}; + o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; int nSplitColl = 0; if constexpr (centEstimator == CentralityEstimator::FT0C) { const auto collSlice = collsWithMcLabels.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex()); diff --git a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx index 5fea174e4f9..192465b5e33 100644 --- a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx @@ -798,7 +798,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// bitmask with event. selection info float centrality{-1.f}; - float occupancy = getOccupancyColl(collision, hfEvSel.occEstimator); + const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections @@ -815,7 +815,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// bitmask with event. selection info float centrality{-1.f}; - float occupancy = getOccupancyColl(collision, hfEvSel.occEstimator); + const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections @@ -832,7 +832,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// bitmask with event. selection info float centrality{-1.f}; - float occupancy = getOccupancyColl(collision, hfEvSel.occEstimator); + const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, hfEvSel.occEstimator); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections @@ -1071,7 +1071,7 @@ struct HfCandidateCreatorXicToXiPiPiExpressions { const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex()); // Slice the collisions table to get the collision info for the current MC collision float centrality{-1.f}; - uint32_t rejectionMask{0u}; + o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; int nSplitColl = 0; if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FT0C) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex()); diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index 4b03533ce1f..8bfd706500a 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -160,8 +160,8 @@ struct HfTrackIndexSkimCreatorTagSelCollisions { template void selectCollision(const Col& collision, const BCsType& bcs) { - float centrality = -1.; - uint32_t rejectionMask; + float centrality = -1.f; + o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; if constexpr (applyUpcSel) { rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc( @@ -1294,7 +1294,7 @@ struct HfTrackIndexSkimCreator { using FilteredTrackAssocSel = soa::Filtered>; // filter collisions - Filter filterSelectCollisions = (aod::hf_sel_collision::whyRejectColl == static_cast(0)); + Filter filterSelectCollisions = (aod::hf_sel_collision::whyRejectColl == static_cast(0)); // filter track indices Filter filterSelectTrackIds = ((aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::Cand2Prong))) != 0u) || ((aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::Cand3Prong))) != 0u) || ((aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::CandDstar))) != 0u); @@ -3094,7 +3094,7 @@ struct HfTrackIndexSkimCreatorCascades { using SelectedCollisions = soa::Filtered>; using FilteredTrackAssocSel = soa::Filtered>; - Filter filterSelectCollisions = (aod::hf_sel_collision::whyRejectColl == static_cast(0)); + Filter filterSelectCollisions = (aod::hf_sel_collision::whyRejectColl == static_cast(0)); Filter filterSelectTrackIds = (aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::CandV0bachelor))) != 0u && (config.applyProtonPid == false || (aod::hf_sel_track::isIdentifiedPid & static_cast(BIT(ChannelsProtonPid::LcToPK0S))) != 0u); Preslice trackIndicesPerCollision = aod::track_association::collisionId; @@ -3363,7 +3363,7 @@ struct HfTrackIndexSkimCreatorLfCascades { using CascFull = soa::Join; using V0Full = soa::Join; - Filter filterSelectCollisions = (aod::hf_sel_collision::whyRejectColl == static_cast(0)); + Filter filterSelectCollisions = (aod::hf_sel_collision::whyRejectColl == static_cast(0)); Filter filterSelectTrackIds = (aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::CandCascadeBachelor))) != 0u; Preslice tracksPerCollision = aod::track::collisionId; // needed for PV refit diff --git a/PWGHF/Tasks/taskCharmHadImpactPar.cxx b/PWGHF/Tasks/taskCharmHadImpactPar.cxx index 3000d5bf8c5..01c838df129 100644 --- a/PWGHF/Tasks/taskCharmHadImpactPar.cxx +++ b/PWGHF/Tasks/taskCharmHadImpactPar.cxx @@ -269,13 +269,13 @@ struct HfTaskCharmHadImpactPar { } } } - float centrality = 0.; - float occupancy = 0.; + float centrality = 0.f; + float occupancy = 0.f; if (centEstimator != CentralityEstimator::None) { centrality = getCentralityColl(collision, centEstimator); } if (occEstimator != OccupancyEstimator::None) { - occupancy = getOccupancyColl(collision, occEstimator); + occupancy = o2::hf_occupancy::getOccupancyColl(collision, occEstimator); } int8_t flagMcMatchRec = 0; diff --git a/PWGHF/Tasks/taskMcValidation.cxx b/PWGHF/Tasks/taskMcValidation.cxx index 97b57f150bc..8cf7ea7d0ce 100644 --- a/PWGHF/Tasks/taskMcValidation.cxx +++ b/PWGHF/Tasks/taskMcValidation.cxx @@ -283,11 +283,11 @@ struct HfTaskMcValidationGen { // Slice the collisions table to get the collision info for the current MC collision float centrality{105.f}; - int occupancy = 0; + float occupancy{0.f}; if (storeOccupancy) { - occupancy = getOccupancyGenColl(recoCollisions, OccupancyEstimator::Its); + occupancy = o2::hf_occupancy::getOccupancyGenColl(recoCollisions, OccupancyEstimator::Its); } - uint32_t rejectionMask{0u}; + o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; if constexpr (centEstimator == CentralityEstimator::FT0C) { rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, recoCollisions, centrality); } else if constexpr (centEstimator == CentralityEstimator::FT0M) { diff --git a/PWGHF/Utils/utilsAnalysis.h b/PWGHF/Utils/utilsAnalysis.h index 7a2c2f45d0a..d5879647f94 100644 --- a/PWGHF/Utils/utilsAnalysis.h +++ b/PWGHF/Utils/utilsAnalysis.h @@ -35,7 +35,7 @@ enum BHadMothers { NotMatched = 0, LambdaBZero }; /// Convert the B hadron mother PDG for non prompt candidates to a flag -/// \param pdg of the b hadron mother +/// \param flagBHad pdg of the b hadron mother /// \return integer map to specific mothers' PDG codes BHadMothers getBHadMotherFlag(const int flagBHad) { @@ -54,21 +54,21 @@ BHadMothers getBHadMotherFlag(const int flagBHad) return BHadMothers::NotMatched; } -/// Finds pT bin in an array. -/// \param bins array of pT bins -/// \param value pT +/// Finds bin in an array that contains a value. +/// \param bins array of bins +/// \param value value to find /// \return index of the pT bin /// \note Accounts for the offset so that pT bin array can be used to also configure a histogram axis. -template -int findBin(T1 const& binsPt, T2 value) +template +int findBin(TArrayPt const& bins, TNumber const value) { - if (value < binsPt->front()) { + if (value < bins->front()) { return -1; } - if (value >= binsPt->back()) { + if (value >= bins->back()) { return -1; } - return std::distance(binsPt->begin(), std::upper_bound(binsPt->begin(), binsPt->end(), value)) - 1; + return std::distance(bins->begin(), std::upper_bound(bins->begin(), bins->end(), value)) - 1; } /// Single-track cut on DCAxy and DCAz @@ -78,8 +78,12 @@ int findBin(T1 const& binsPt, T2 value) /// \param dcaXY is the prong dcaXY /// \param dcaZ is the prong dcaZ /// \return true if track passes all cuts -template -bool isSelectedTrackDca(T1 const& binsPt, T2 const& cuts, const float pt, const float dcaXY, const float dcaZ) +template +bool isSelectedTrackDca(TArrayPt const& binsPt, + TArrayCuts const& cuts, + const float pt, + const float dcaXY, + const float dcaZ) { auto binPt = findBin(binsPt, pt); if (binPt == -1) { @@ -105,8 +109,10 @@ bool isSelectedTrackDca(T1 const& binsPt, T2 const& cuts, const float pt, const /// \param itsNClustersFoundMin is the minimum number of ITS clusters /// \param itsChi2PerClusterMax is the maximum value of chi2 fit over ITS clusters /// \return true if track passes all cuts -template -bool isSelectedTrackItsQuality(T const& track, const int itsNClustersFoundMin, const float itsChi2PerClusterMax) +template +bool isSelectedTrackItsQuality(TTrack const& track, + const int itsNClustersFoundMin, + const float itsChi2PerClusterMax) { if (track.itsNCls() < itsNClustersFoundMin) { return false; @@ -124,8 +130,12 @@ bool isSelectedTrackItsQuality(T const& track, const int itsNClustersFoundMin, c /// \param tpcNCrossedRowsOverFindableClustersMin is the minimum of TPC CrossedRows/FindableClusters value /// \param tpcChi2PerClusterMax is the maximum value of chi2 fit over TPC clusters /// \return true if track passes all cuts -template -bool isSelectedTrackTpcQuality(T const& track, const int tpcNClustersFoundMin, const int tpcNCrossedRowsMin, const float tpcNCrossedRowsOverFindableClustersMin, const float tpcChi2PerClusterMax) +template +bool isSelectedTrackTpcQuality(TTrack const& track, + const int tpcNClustersFoundMin, + const int tpcNCrossedRowsMin, + const float tpcNCrossedRowsOverFindableClustersMin, + const float tpcChi2PerClusterMax) { if (track.tpcNClsFound() < tpcNClustersFoundMin) { return false; @@ -142,7 +152,7 @@ bool isSelectedTrackTpcQuality(T const& track, const int tpcNClustersFoundMin, c return true; } -/// Mass selection of 2 or 3 prong canidates in triggered data analysis +/// Mass selection of 2 or 3 prong candidates in triggered data analysis /// \tparam nProngs switch between 2-prong and 3-prong selection /// \param invMass is the invariant mass of the candidate /// \param pdgMass is the pdg Mass of the candidate particle @@ -150,10 +160,13 @@ bool isSelectedTrackTpcQuality(T const& track, const int tpcNClustersFoundMin, c /// \param cutConfig is the struct with the pt-dependent mass configurations /// \return true if candidate passes selection template -bool isCandidateInMassRange(const float& invMass, const double& pdgMass, const float& pt, Config const& cutConfig) +bool isCandidateInMassRange(const float invMass, + const double pdgMass, + const float pt, + Config const& cutConfig) { - float peakMean = (pt < cutConfig.ptDeltaMassMax.value) ? ((pdgMass + cutConfig.deltaMassPars->get("constant")) + cutConfig.deltaMassPars->get("linear") * pt) : pdgMass; - float peakWidth = cutConfig.sigmaPars->get("constant") + cutConfig.sigmaPars->get("linear") * pt; + const float peakMean = (pt < cutConfig.ptDeltaMassMax.value) ? ((pdgMass + cutConfig.deltaMassPars->get("constant")) + cutConfig.deltaMassPars->get("linear") * pt) : pdgMass; + const float peakWidth = cutConfig.sigmaPars->get("constant") + cutConfig.sigmaPars->get("linear") * pt; return (!(std::abs(invMass - peakMean) > cutConfig.nSigmaMax.value * peakWidth && pt < cutConfig.ptMassCutMax.value)); } @@ -164,9 +177,9 @@ struct HfTrigger2ProngCuts : o2::framework::ConfigurableGroup { static constexpr float DefaultDeltaMassPars[1][2] = {{-0.0025f, 0.0001f}}; static constexpr float DefaultSigmaPars[1][2] = {{0.01424f, 0.00178f}}; - o2::framework::Configurable nSigmaMax{"nSigmaMax", 2, "Maximum number of sigmas for pT-differential mass cut for 2-prong candidates"}; - o2::framework::Configurable ptDeltaMassMax{"ptDeltaMassMax", 10., "Max pT to apply delta mass shift to PDG mass value for 2-prong candidates"}; - o2::framework::Configurable ptMassCutMax{"ptMassCutMax", 9999., "Max pT to apply pT-differential cut for 2-prong candidates"}; + o2::framework::Configurable nSigmaMax{"nSigmaMax", 2.f, "Maximum number of sigmas for pT-differential mass cut for 2-prong candidates"}; + o2::framework::Configurable ptDeltaMassMax{"ptDeltaMassMax", 10.f, "Max pT to apply delta mass shift to PDG mass value for 2-prong candidates"}; + o2::framework::Configurable ptMassCutMax{"ptMassCutMax", 9999.f, "Max pT to apply pT-differential cut for 2-prong candidates"}; o2::framework::Configurable> deltaMassPars{"deltaMassPars", {DefaultDeltaMassPars[0], 2, {"constant", "linear"}}, "delta mass parameters for HF 2-prong trigger mass cut"}; o2::framework::Configurable> sigmaPars{"sigmaPars", {DefaultSigmaPars[0], 2, {"constant", "linear"}}, "sigma parameters for HF 2-prong trigger mass cut"}; }; @@ -178,8 +191,8 @@ struct HfTrigger3ProngCuts : o2::framework::ConfigurableGroup { static constexpr float DefaultDeltaMassPars[1][2] = {{-0.0025f, 0.0001f}}; static constexpr float DefaultSigmaPars[1][2] = {{0.00796f, 0.00176f}}; o2::framework::Configurable nSigmaMax{"nSigmaMax", 2, "Maximum number of sigmas for pT-differential mass cut for 3-prong candidates"}; - o2::framework::Configurable ptDeltaMassMax{"ptDeltaMassMax", 10., "Max pT to apply delta mass shift to PDG mass value for 3-prong candidates"}; - o2::framework::Configurable ptMassCutMax{"ptMassCutMax", 9999., "Max pT to apply pT-differential cut for 3-prong candidates"}; + o2::framework::Configurable ptDeltaMassMax{"ptDeltaMassMax", 10.f, "Max pT to apply delta mass shift to PDG mass value for 3-prong candidates"}; + o2::framework::Configurable ptMassCutMax{"ptMassCutMax", 9999.f, "Max pT to apply pT-differential cut for 3-prong candidates"}; o2::framework::Configurable> deltaMassPars{"deltaMassPars", {DefaultDeltaMassPars[0], 2, {"constant", "linear"}}, "delta mass parameters for HF 3-prong trigger mass cut"}; o2::framework::Configurable> sigmaPars{"sigmaPars", {DefaultSigmaPars[0], 2, {"constant", "linear"}}, "sigma parameters for HF 3-prong trigger mass cut"}; }; diff --git a/PWGHF/Utils/utilsBfieldCCDB.h b/PWGHF/Utils/utilsBfieldCCDB.h index 8d7166eca4a..d14203161e4 100644 --- a/PWGHF/Utils/utilsBfieldCCDB.h +++ b/PWGHF/Utils/utilsBfieldCCDB.h @@ -34,9 +34,12 @@ /// \param lut is a pointer to the o2::base::MatLayerCylSet object /// \param isRun2 tells whether we are analysing Run2 converted data or not (different GRP object type) template -void initCCDB(TBc const& bc, int& mRunNumber, - o2::framework::Service const& ccdb, std::string const& ccdbPathGrp, o2::base::MatLayerCylSet* lut, - bool isRun2) +void initCCDB(TBc const& bc, + int& mRunNumber, + o2::framework::Service const& ccdb, + std::string const& ccdbPathGrp, + o2::base::MatLayerCylSet* lut, + const bool isRun2) { if (mRunNumber != bc.runNumber()) { LOGF(info, "====== initCCDB function called (isRun2==%d)", isRun2); diff --git a/PWGHF/Utils/utilsDerivedData.h b/PWGHF/Utils/utilsDerivedData.h index 044abed2f90..4a08d37d535 100644 --- a/PWGHF/Utils/utilsDerivedData.h +++ b/PWGHF/Utils/utilsDerivedData.h @@ -39,8 +39,10 @@ namespace o2::analysis::hf_derived /// \param cursor cursor of the filled table /// \param enabled switch for filling the table /// \param size size of the source table -template -void reserveTable(T& cursor, const o2::framework::Configurable& enabled, const uint64_t size) +template +void reserveTable(TCursor& cursor, + const o2::framework::Configurable& enabled, + const uint64_t size) { if (enabled.value) { cursor.reserve(size); @@ -94,36 +96,34 @@ struct HfProducesDerivedData : o2::framework::ProducesGroup { conf = &c; } - template - void reserveTablesCandidates(T size) + void reserveTablesCandidates(const uint64_t size) { o2::analysis::hf_derived::reserveTable(rowCandidateBase, conf->fillCandidateBase, size); } - template - void reserveTablesColl(T size) + void reserveTablesColl(const uint64_t size) { o2::analysis::hf_derived::reserveTable(rowCollBase, conf->fillCollBase, size); o2::analysis::hf_derived::reserveTable(rowCollId, conf->fillCollId, size); } - template - void reserveTablesMcColl(T size) + void reserveTablesMcColl(const uint64_t size) { o2::analysis::hf_derived::reserveTable(rowMcCollBase, conf->fillMcCollBase, size); o2::analysis::hf_derived::reserveTable(rowMcCollId, conf->fillMcCollId, size); o2::analysis::hf_derived::reserveTable(rowMcRCollId, conf->fillMcRCollId, size); } - template - void reserveTablesParticles(T size) + void reserveTablesParticles(const uint64_t size) { o2::analysis::hf_derived::reserveTable(rowParticleBase, conf->fillParticleBase, size); o2::analysis::hf_derived::reserveTable(rowParticleId, conf->fillParticleId, size); } - template - void fillTablesCandidate(const T& candidate, double invMass, double y) + template + void fillTablesCandidate(const TCandidate& candidate, + const double invMass, + const double y) { if (conf->fillCandidateBase.value) { rowCandidateBase( @@ -136,9 +136,8 @@ struct HfProducesDerivedData : o2::framework::ProducesGroup { } } - template - // void fillTablesCollision(const T& collision, int isEventReject, int runNumber) - void fillTablesCollision(const T& collision) + template + void fillTablesCollision(TCollision const& collision) { if (conf->fillCollBase.value) { rowCollBase( @@ -165,8 +164,8 @@ struct HfProducesDerivedData : o2::framework::ProducesGroup { } } - template - void fillTablesMcCollision(const T& mcCollision) + template + void fillTablesMcCollision(TMcCollision const& mcCollision) { if (conf->fillMcCollBase.value) { rowMcCollBase( @@ -186,8 +185,8 @@ struct HfProducesDerivedData : o2::framework::ProducesGroup { } } - template - void fillTablesParticle(const T& particle, U mass) + template + void fillTablesParticle(TMcParticle const& particle, const TMass mass) { if (conf->fillParticleBase.value) { rowParticleBase( @@ -206,10 +205,10 @@ struct HfProducesDerivedData : o2::framework::ProducesGroup { } } - template - void preProcessMcCollisions(CollisionType const& mcCollisions, - o2::framework::Preslice const& mcParticlesPerMcCollision, - ParticleType const& mcParticles) + template + void preProcessMcCollisions(TMcCollisions const& mcCollisions, + o2::framework::Preslice const& mcParticlesPerMcCollision, + TMcParticles const& mcParticles) { if (!conf->fillMcRCollId.value) { return; @@ -217,26 +216,26 @@ struct HfProducesDerivedData : o2::framework::ProducesGroup { hasMcParticles.clear(); // Fill MC collision flags for (const auto& mcCollision : mcCollisions) { - auto thisMcCollId = mcCollision.globalIndex(); - auto particlesThisMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, thisMcCollId); + const auto thisMcCollId = mcCollision.globalIndex(); + const auto particlesThisMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, thisMcCollId); LOGF(debug, "MC collision %d has %d MC particles (preprocess)", thisMcCollId, particlesThisMcColl.size()); hasMcParticles[thisMcCollId] = (particlesThisMcColl.size() > 0); } } - template - void processMcParticles(CollisionType const& mcCollisions, - o2::framework::Preslice const& mcParticlesPerMcCollision, - ParticleType const& mcParticles, - TMass const massParticle) + template + void processMcParticles(TMcCollisions const& mcCollisions, + o2::framework::Preslice const& mcParticlesPerMcCollision, + TMcParticles const& mcParticles, + const TMass massParticle) { // Fill MC collision properties - auto sizeTableMcColl = mcCollisions.size(); + const auto sizeTableMcColl = mcCollisions.size(); reserveTablesMcColl(sizeTableMcColl); for (const auto& mcCollision : mcCollisions) { - auto thisMcCollId = mcCollision.globalIndex(); - auto particlesThisMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, thisMcCollId); - auto sizeTablePart = particlesThisMcColl.size(); + const auto thisMcCollId = mcCollision.globalIndex(); + const auto particlesThisMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, thisMcCollId); + const auto sizeTablePart = particlesThisMcColl.size(); LOGF(debug, "MC collision %d has %d MC particles", thisMcCollId, sizeTablePart); // Skip MC collisions without HF particles (and without HF candidates in matched reconstructed collisions if saving indices of reconstructed collisions matched to MC collisions) LOGF(debug, "MC collision %d has %d saved derived rec. collisions", thisMcCollId, matchedCollisions[thisMcCollId].size()); diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index d54c17b2eb2..4af173070d5 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -55,16 +55,16 @@ enum OccupancyEstimator { None = 0, /// Get the occupancy /// \param collision is the collision with the occupancy information /// \return collision occupancy -template -float getOccupancyColl(Coll const& collision, int occEstimator) +template +float getOccupancyColl(TCollision const& collision, const int occEstimator) { switch (occEstimator) { case OccupancyEstimator::Its: - return collision.trackOccupancyInTimeRange(); + return static_cast(collision.trackOccupancyInTimeRange()); case OccupancyEstimator::Ft0c: - return collision.ft0cOccupancyInTimeRange(); + return static_cast(collision.ft0cOccupancyInTimeRange()); default: - LOG(fatal) << "Occupancy estimator not valid. Possible values are ITS or FT0C."; + LOG(fatal) << "Occupancy estimator not valid. See OccupancyEstimator for valid values."; break; } return -999.f; @@ -73,14 +73,14 @@ float getOccupancyColl(Coll const& collision, int occEstimator) /// \brief Function to get MC collision occupancy /// \param collSlice collection of reconstructed collisions associated to a generated one /// \return generated MC collision occupancy -template -int getOccupancyGenColl(CCs const& collSlice, int occEstimator) +template +float getOccupancyGenColl(TCollisions const& collSlice, const int occEstimator) { - float multiplicity{0.f}; - int occupancy = 0; + using TMult = uint16_t; // type of numContrib + TMult multiplicity{}; + float occupancy{0.f}; for (const auto& collision : collSlice) { - float collMult{0.f}; - collMult = collision.numContrib(); + const TMult collMult = collision.numContrib(); if (collMult > multiplicity) { occupancy = getOccupancyColl(collision, occEstimator); multiplicity = collMult; @@ -115,14 +115,16 @@ enum EventRejection { NEventRejection }; -o2::framework::AxisSpec axisEvents = {EventRejection::NEventRejection, -0.5f, +EventRejection::NEventRejection - 0.5f, ""}; -o2::framework::AxisSpec axisUpcEvents = {o2::aod::sgselector::DoubleGap + 1, -0.5f, +o2::aod::sgselector::DoubleGap + 0.5f, ""}; +using HfCollisionRejectionMask = uint32_t; // 32 bits, in case new ev. selections will be added + +const o2::framework::AxisSpec axisEvents = {EventRejection::NEventRejection, -0.5f, +EventRejection::NEventRejection - 0.5f, ""}; +const o2::framework::AxisSpec axisUpcEvents = {o2::aod::sgselector::DoubleGap + 1, -0.5f, +o2::aod::sgselector::DoubleGap + 0.5f, ""}; /// \brief Function to put labels on monitoring histogram /// \param hRejection monitoring histogram /// \param softwareTriggerLabel bin label for software trigger rejection template -void setEventRejectionLabels(Histo& hRejection, std::string softwareTriggerLabel = "") +void setEventRejectionLabels(Histo& hRejection, std::string const& softwareTriggerLabel = "") { // Puts labels on the collision monitoring histogram. hRejection->GetXaxis()->SetBinLabel(EventRejection::None + 1, "All"); @@ -148,8 +150,8 @@ void setEventRejectionLabels(Histo& hRejection, std::string softwareTriggerLabel struct HfEventSelection : o2::framework::ConfigurableGroup { std::string prefix = "hfEvSel"; // JSON group name // event selection parameters (in chronological order of application) - o2::framework::Configurable centralityMin{"centralityMin", 0., "Minimum centrality"}; - o2::framework::Configurable centralityMax{"centralityMax", 100., "Maximum centrality"}; + o2::framework::Configurable centralityMin{"centralityMin", 0.f, "Minimum centrality"}; + o2::framework::Configurable centralityMax{"centralityMax", 100.f, "Maximum centrality"}; o2::framework::Configurable useSel8Trigger{"useSel8Trigger", true, "Apply the sel8 event selection"}; o2::framework::Configurable triggerClass{"triggerClass", -1, "Trigger class different from sel8 (e.g. kINT7 for Run2) used only if useSel8Trigger is false"}; o2::framework::Configurable useTvxTrigger{"useTvxTrigger", true, "Apply TVX trigger sel"}; @@ -262,10 +264,13 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { /// \param ccdb ccdb service needed to retrieve the needed info for zorro /// \param registry reference to the histogram registry needed for zorro /// \return bitmask with the event selection criteria not satisfied by the collision - template - uint32_t getHfCollisionRejectionMask(const Coll& collision, float& centrality, o2::framework::Service const& ccdb, o2::framework::HistogramRegistry& registry) + template + HfCollisionRejectionMask getHfCollisionRejectionMask(TCollision const& collision, + float& centrality, + o2::framework::Service const& ccdb, + o2::framework::HistogramRegistry& registry) { - uint32_t rejectionMask{0}; // 32 bits, in case new ev. selections will be added + HfCollisionRejectionMask rejectionMask{}; if constexpr (centEstimator != o2::hf_centrality::CentralityEstimator::None) { centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); @@ -317,7 +322,7 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { SETBIT(rejectionMask, EventRejection::NoCollInRofStandard); } if (useOccupancyCut) { - float occupancy = o2::hf_occupancy::getOccupancyColl(collision, occEstimator); + const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, occEstimator); if (occupancy < occupancyMin || occupancy > occupancyMax) { SETBIT(rejectionMask, EventRejection::Occupancy); } @@ -341,9 +346,8 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { if (softwareTrigger.value != "") { // we might have to update it from CCDB - auto bc = collision.template bc_as(); - - int runNumber = bc.runNumber(); + const auto bc = collision.template bc_as(); + const auto runNumber = bc.runNumber(); if (runNumber != currentRun) { // We might need to update Zorro from CCDB if the run number changes zorro.setCCDBpath(ccdbPathSoftwareTrigger); zorro.setBCtolerance(bcMarginForSoftwareTrigger); @@ -366,17 +370,21 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { return rejectionMask; } - template - uint32_t getHfCollisionRejectionMaskWithUpc(const Coll& collision, float& centrality, o2::framework::Service const& ccdb, o2::framework::HistogramRegistry& registry, const BCsType& bcs) + template + HfCollisionRejectionMask getHfCollisionRejectionMaskWithUpc(TCollision const& collision, + float& centrality, + o2::framework::Service const& ccdb, + o2::framework::HistogramRegistry& registry, + TBcs const& bcs) { - auto rejectionMaskWithUpc = getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + auto rejectionMaskWithUpc = getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (useEvSel) { - SGCutParHolder sgCuts = setSgPreselection(); - auto bc = collision.template foundBC_as(); - auto bcRange = udhelpers::compatibleBCs(collision, sgCuts.NDtcoll(), bcs, sgCuts.minNBCs()); - auto sgSelectionResult = sgSelector.IsSelected(sgCuts, collision, bcRange, bc); - int upcEventType = sgSelectionResult.value; + const SGCutParHolder sgCuts = setSgPreselection(); + const auto bc = collision.template foundBC_as(); + const auto bcRange = udhelpers::compatibleBCs(collision, sgCuts.NDtcoll(), bcs, sgCuts.minNBCs()); + const auto sgSelectionResult = sgSelector.IsSelected(sgCuts, collision, bcRange, bc); + const int upcEventType = sgSelectionResult.value; if (upcEventType > o2::aod::sgselector::DoubleGap) { SETBIT(rejectionMaskWithUpc, EventRejection::UpcEventCut); } else { @@ -390,11 +398,14 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { /// \brief Fills histograms for monitoring event selections satisfied by the collision. /// \param collision analysed collision /// \param rejectionMask bitmask storing the info about which ev. selections are not satisfied by the collision - template - void fillHistograms(Coll const& collision, const uint32_t rejectionMask, float& centrality, float occupancy = -1) + template + void fillHistograms(TCollision const& collision, + const HfCollisionRejectionMask rejectionMask, + const float centrality, + const float occupancy = -1.f) { hCollisions->Fill(EventRejection::None); - const float posZ = collision.posZ(); + const auto posZ = collision.posZ(); hPosZBeforeEvSel->Fill(posZ); for (std::size_t reason = 1; reason < EventRejection::NEventRejection; reason++) { @@ -415,30 +426,31 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { struct HfEventSelectionMc { // event selection parameters (in chronological order of application) - bool useSel8Trigger{false}; // Apply the Sel8 selection - bool useTvxTrigger{false}; // Apply the TVX trigger - bool useTimeFrameBorderCut{true}; // Apply TF border cut - bool useItsRofBorderCut{false}; // Apply the ITS RO frame border cut - float zPvPosMin{-1000.f}; // Minimum PV posZ (cm) - float zPvPosMax{1000.f}; // Maximum PV posZ (cm) - float centralityMin{0.f}; // Minimum centrality - float centralityMax{100.f}; // Maximum centrality - bool requireGoodRct{false}; // Apply RCT selection - std::string rctLabel{""}; // RCT selection flag - bool rctCheckZDC; // require ZDC from RCT - bool rctTreatLimitedAcceptanceAsBad; // RCT flag to reject events with limited acceptance for selected detectors + bool useSel8Trigger{false}; // Apply the Sel8 selection + bool useTvxTrigger{false}; // Apply the TVX trigger + bool useTimeFrameBorderCut{true}; // Apply TF border cut + bool useItsRofBorderCut{false}; // Apply the ITS RO frame border cut + float zPvPosMin{-1000.f}; // Minimum PV posZ (cm) + float zPvPosMax{1000.f}; // Maximum PV posZ (cm) + float centralityMin{0.f}; // Minimum centrality + float centralityMax{100.f}; // Maximum centrality + bool requireGoodRct{false}; // Apply RCT selection + std::string rctLabel{""}; // RCT selection flag + bool rctCheckZDC{false}; // require ZDC from RCT + bool rctTreatLimitedAcceptanceAsBad{false}; // RCT flag to reject events with limited acceptance for selected detectors // util to retrieve the RCT info from CCDB o2::aod::rctsel::RCTFlagsChecker rctChecker; // histogram names static constexpr char NameHistGenCollisionsCent[] = "hGenCollisionsCent"; - std::shared_ptr hGenCollisionsCent; static constexpr char NameHistRecCollisionsCentMc[] = "hRecCollisionsCentMc"; - std::shared_ptr hRecCollisionsCentMc; static constexpr char NameHistNSplitVertices[] = "hNSplitVertices"; - std::shared_ptr hNSplitVertices; static constexpr char NameHistGenCollisions[] = "hGenCollisions"; + + std::shared_ptr hGenCollisionsCent; + std::shared_ptr hRecCollisionsCentMc; + std::shared_ptr hNSplitVertices; std::shared_ptr hGenCollisions; /// \brief Adds collision monitoring histograms in the histogram registry. @@ -456,7 +468,7 @@ struct HfEventSelectionMc { /// \brief Configures the object from the reco workflow /// \param registry reference to the histogram registry /// \param device device spec to get the configs from the reco workflow - void configureFromDevice(const o2::framework::DeviceSpec& device) + void configureFromDevice(o2::framework::DeviceSpec const& device) { for (const auto& option : device.options) { if (option.name.compare("hfEvSel.useSel8Trigger") == 0) { @@ -490,7 +502,8 @@ struct HfEventSelectionMc { /// \brief Inits the HF event selection object /// \param device device spec to get the configs from the reco workflow /// \param registry reference to the histogram registry - void init(const o2::framework::DeviceSpec& device, o2::framework::HistogramRegistry& registry) + void init(o2::framework::DeviceSpec const& device, + o2::framework::HistogramRegistry& registry) { // we get the configuration from the reco workflow configureFromDevice(device); @@ -509,12 +522,14 @@ struct HfEventSelectionMc { /// \param collSlice collection of reconstructed collisions /// \param centrality centrality variable to be set in this function /// \return a bitmask with the event selections not satisfied by the analysed collision - template - uint32_t getHfMcCollisionRejectionMask(TMcColl const& mcCollision, CCs const& collSlice, float& centrality) + template + HfCollisionRejectionMask getHfMcCollisionRejectionMask(TMcCollision const& mcCollision, + TCollisions const& collSlice, + float& centrality) { - uint32_t rejectionMask{0}; - float zPv = mcCollision.posZ(); - auto bc = mcCollision.template bc_as(); + HfCollisionRejectionMask rejectionMask{}; + const auto zPv = mcCollision.posZ(); + const auto bc = mcCollision.template bc_as(); if constexpr (centEstimator != o2::hf_centrality::CentralityEstimator::None) { centrality = o2::hf_centrality::getCentralityGenColl(collSlice, centEstimator); @@ -560,8 +575,10 @@ struct HfEventSelectionMc { /// \brief Fills histogram for monitoring event selections satisfied by the collision. /// \param collision analysed collision /// \param rejectionMask bitmask storing the info about which ev. selections are not satisfied by the collision - template - void fillHistograms(Coll const& mcCollision, const uint32_t rejectionMask, int nSplitColl = 0) + template + void fillHistograms(TMcCollision const& mcCollision, + const HfCollisionRejectionMask rejectionMask, + const int nSplitColl = 0) { hGenCollisions->Fill(EventRejection::None); diff --git a/PWGHF/Utils/utilsMcGen.h b/PWGHF/Utils/utilsMcGen.h index 76152505906..485b15de1af 100644 --- a/PWGHF/Utils/utilsMcGen.h +++ b/PWGHF/Utils/utilsMcGen.h @@ -35,8 +35,12 @@ namespace hf_mc_gen { -template -void fillMcMatchGen2Prong(T const& mcParticles, U const& mcParticlesPerMcColl, V& rowMcMatchGen, bool rejectBackground, bool matchCorrelatedBackground) +template +void fillMcMatchGen2Prong(TMcParticles const& mcParticles, + TMcParticlesPerColl const& mcParticlesPerMcColl, + TCursor& rowMcMatchGen, + const bool rejectBackground, + const bool matchCorrelatedBackground) { using namespace o2::constants::physics; using namespace o2::hf_decay::hf_cand_2prong; @@ -123,8 +127,12 @@ void fillMcMatchGen2Prong(T const& mcParticles, U const& mcParticlesPerMcColl, V } } -template -void fillMcMatchGen3Prong(T const& mcParticles, U const& mcParticlesPerMcColl, V& rowMcMatchGen, bool rejectBackground, std::vector const& pdgMothersCorrelBkg = {}) +template +void fillMcMatchGen3Prong(TMcParticles const& mcParticles, + TMcParticlesPerColl const& mcParticlesPerMcColl, + TCursor& rowMcMatchGen, + const bool rejectBackground, + std::vector const& pdgMothersCorrelBkg = {}) { using namespace o2::constants::physics; using namespace o2::hf_decay::hf_cand_3prong; @@ -157,7 +165,7 @@ void fillMcMatchGen3Prong(T const& mcParticles, U const& mcParticlesPerMcColl, V if (std::abs(particle.pdgCode()) != pdgMother) { continue; // Skip if the particle PDG code does not match the mother PDG code } - auto finalStates = getDecayChannelsMain(pdgMother); + const auto finalStates = getDecayChannelsMain(pdgMother); constexpr int DepthMainMax = 2; // Depth for final state matching constexpr int DepthResoMax = 1; // Depth for resonant decay matching @@ -307,8 +315,8 @@ void fillMcMatchGen3Prong(T const& mcParticles, U const& mcParticlesPerMcColl, V } } -template -void fillMcMatchGenBplus(T const& mcParticles, U& rowMcMatchGen) +template +void fillMcMatchGenBplus(TMcParticles const& mcParticles, TCursor& rowMcMatchGen) { using namespace o2::constants::physics; using namespace o2::hf_decay::hf_cand_beauty; @@ -340,8 +348,8 @@ void fillMcMatchGenBplus(T const& mcParticles, U& rowMcMatchGen) } // B candidate } -template -void fillMcMatchGenB0(T const& mcParticles, U& rowMcMatchGen) +template +void fillMcMatchGenB0(TMcParticles const& mcParticles, TCursor& rowMcMatchGen) { using namespace o2::constants::physics; using namespace o2::hf_decay::hf_cand_beauty; diff --git a/PWGHF/Utils/utilsPid.h b/PWGHF/Utils/utilsPid.h index 4590bb50b2c..bc5024daf75 100644 --- a/PWGHF/Utils/utilsPid.h +++ b/PWGHF/Utils/utilsPid.h @@ -44,40 +44,40 @@ enum PidMethod { /// Function to combine TPC and TOF NSigma /// \param tiny switch between full and tiny (binned) PID tables -/// \param tpcNSigma is the (binned) NSigma separation in TPC (if tiny = true) -/// \param tofNSigma is the (binned) NSigma separation in TOF (if tiny = true) +/// \param nSigmaTpc is the (binned) NSigma separation in TPC (if tiny = true) +/// \param nSigmaTof is the (binned) NSigma separation in TOF (if tiny = true) /// \return combined NSigma of TPC and TOF -template -T1 combineNSigma(T1 tpcNSigma, T1 tofNSigma) +template +TNumber combineNSigma(TNumber nSigmaTpc, TNumber nSigmaTof) { static constexpr float DefaultNSigmaTolerance = .1f; static constexpr float DefaultNSigma = -999.f + DefaultNSigmaTolerance; // -999.f is the default value set in TPCPIDResponse.h and PIDTOF.h if constexpr (tiny) { - tpcNSigma *= aod::pidtpc_tiny::binning::bin_width; - tofNSigma *= aod::pidtof_tiny::binning::bin_width; + nSigmaTpc *= aod::pidtpc_tiny::binning::bin_width; + nSigmaTof *= aod::pidtof_tiny::binning::bin_width; } - if ((tpcNSigma > DefaultNSigma) && (tofNSigma > DefaultNSigma)) { // TPC and TOF - return std::sqrt(.5f * (tpcNSigma * tpcNSigma + tofNSigma * tofNSigma)); + if ((nSigmaTpc > DefaultNSigma) && (nSigmaTof > DefaultNSigma)) { // TPC and TOF + return std::sqrt(.5f * (nSigmaTpc * nSigmaTpc + nSigmaTof * nSigmaTof)); } - if (tpcNSigma > DefaultNSigma) { // only TPC - return std::abs(tpcNSigma); + if (nSigmaTpc > DefaultNSigma) { // only TPC + return std::abs(nSigmaTpc); } - if (tofNSigma > DefaultNSigma) { // only TOF - return std::abs(tofNSigma); + if (nSigmaTof > DefaultNSigma) { // only TOF + return std::abs(nSigmaTof); } - return tofNSigma; // no TPC nor TOF + return nSigmaTof; // no TPC nor TOF } -/// @brief Function to fill tables with HF prong PID information -/// @tparam TRK datatype of the prong track -/// @tparam ROW datatype of the prong PID table to fill -/// @tparam specPid particle species -/// @param track prong track -/// @param rowPid cursor of the prong PID table to fill -template -void fillProngPid(TRK const& track, ROW& rowPid) +/// \brief Function to fill tables with HF prong PID information +/// \tparam specPid particle species +/// \tparam TTrack datatype of the prong track +/// \tparam TCursor datatype of the cursor of the prong PID table to fill +/// \param track prong track +/// \param rowPid cursor of the prong PID table to fill +template +void fillProngPid(TTrack const& track, TCursor& rowPid) { // get PID information for the daughter tracks diff --git a/PWGHF/Utils/utilsTrkCandHf.h b/PWGHF/Utils/utilsTrkCandHf.h index 43db7a21e08..295b8fb7538 100644 --- a/PWGHF/Utils/utilsTrkCandHf.h +++ b/PWGHF/Utils/utilsTrkCandHf.h @@ -22,6 +22,7 @@ #include +#include #include namespace o2::hf_trkcandsel @@ -36,10 +37,10 @@ enum SVFitting { o2::framework::AxisSpec axisCands = {SVFitting::NCases, -0.5f, static_cast(SVFitting::NCases) - 0.5f, ""}; -/// @brief Function to put labels on candidate monitoring histogram +/// \brief Function to put labels on candidate monitoring histogram /// \param hCandidates is the histogram -template -void setLabelHistoCands(Histo& hCandidates) +template +void setLabelHistoCands(THisto& hCandidates) { hCandidates->SetTitle("HF candidate counter;;candidates"); hCandidates->GetXaxis()->SetBinLabel(SVFitting::BeforeFit + 1, "Before secondary vertexing"); @@ -47,16 +48,15 @@ void setLabelHistoCands(Histo& hCandidates) hCandidates->GetXaxis()->SetBinLabel(SVFitting::Fail + 1, "Run-time error in secondary vertexing"); } -/// @brief Function to evaluate number of ones in a binary representation of the argument +/// \brief Function to evaluate number of ones in a binary representation of the argument /// \param num is the input argument -int countOnesInBinary(uint8_t num) +int countOnesInBinary(const uint8_t num) { - int count = 0; - - for (int iBit = 0; iBit < 8; iBit++) { + int count{0}; + constexpr std::size_t NBits{8u}; + for (std::size_t iBit{0u}; iBit < NBits; iBit++) { count += TESTBIT(num, iBit); } - return count; } @@ -66,10 +66,13 @@ int countOnesInBinary(uint8_t num) /// \param binsPtTrack is the array of pt bins for track selection /// \param cutsTrackDCA are the cuts for track DCA selection /// \return true if track passes all cuts -template -bool isSelectedTrackDCA(const T1& trackPar, const T2& dca, const C1& binsPtTrack, const C2& cutsTrackDCA) +template +bool isSelectedTrackDCA(TTrackPar const& trackPar, + TArrayDca const& dca, + TArrayPt const& binsPtTrack, + TArrayCuts const& cutsTrackDCA) { - auto binPtTrack = o2::analysis::findBin(binsPtTrack, trackPar.getPt()); + const auto binPtTrack = o2::analysis::findBin(binsPtTrack, trackPar.getPt()); if (binPtTrack == -1) { return false; } From b9f6ff304840351d8a43507cd981db962d9255d8 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 15 Aug 2025 05:44:50 +0200 Subject: [PATCH 063/986] [PWGEM/Dilepton] treeCreatorElectronMLDDA.cxx (#12578) --- .../TableProducer/treeCreatorElectronMLDDA.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx index b87ce1be2bd..ffcd498881a 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx @@ -124,11 +124,15 @@ struct TreeCreatorElectronMLDDA { Configurable downscaling_kaon_highP{"downscaling_kaon_highP", 1.1, "down scaling factor to store kaon at high p"}; Configurable downscaling_proton_highP{"downscaling_proton_highP", 1.1, "down scaling factor to store proton at high p"}; + Configurable downscaling_electron_midP{"downscaling_electron_midP", 0.1, "down scaling factor to store electron at intermediate p"}; + Configurable downscaling_electron_lowP{"downscaling_electron_lowP", 0.01, "down scaling factor to store electron at low p"}; Configurable downscaling_pion_lowP{"downscaling_pion_lowP", 0.01, "down scaling factor to store pion at low p"}; Configurable downscaling_kaon_lowP{"downscaling_kaon_lowP", 1.1, "down scaling factor to store kaon at low p"}; Configurable downscaling_proton_lowP{"downscaling_proton_lowP", 0.01, "down scaling factor to store proton at low p"}; + Configurable mid_p_for_downscaling_electron{"mid_p_for_downscaling_electron", 0.8, "intermediate p to apply down scaling factor to store electron"}; + Configurable max_p_for_downscaling_electron{"max_p_for_downscaling_electron", 2.0, "max p to apply down scaling factor to store electron"}; Configurable max_p_for_downscaling_pion{"max_p_for_downscaling_pion", 2.0, "max p to apply down scaling factor to store pion"}; Configurable max_p_for_downscaling_kaon{"max_p_for_downscaling_kaon", 0.0, "max p to apply down scaling factor to store kaon"}; @@ -593,10 +597,14 @@ struct TreeCreatorElectronMLDDA { // float dcaZ = mDcaInfoCov.getZ(); if (pidlabel == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)) { - if (track.tpcInnerParam() < max_p_for_downscaling_electron) { + if (track.tpcInnerParam() < mid_p_for_downscaling_electron) { if (dist01(engine) > downscaling_electron_lowP) { return; } + } else if (track.tpcInnerParam() < max_p_for_downscaling_electron) { + if (dist01(engine) > downscaling_electron_midP) { + return; + } } else { if (dist01(engine) > downscaling_electron_highP) { return; From 93e063bec07cce4db3054980e219b7adeab95401 Mon Sep 17 00:00:00 2001 From: Sebastian Scheid Date: Fri, 15 Aug 2025 06:17:29 +0200 Subject: [PATCH 064/986] [PWGEM] Fix init overload in OTF model prediction task (#12577) --- PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx b/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx index 4ebd94f90a1..7d7679b42d9 100644 --- a/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx +++ b/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx @@ -32,8 +32,7 @@ struct otfParticlePrediction { Configurable maxEtaParticle{"maxEtaParticle", 5.f, "Max eta of particles considered"}; // init function - void - init() + void init(InitContext&) { const AxisSpec axisEta{binsEta, "#eta"}; @@ -56,12 +55,12 @@ struct otfParticlePrediction { for (const auto& particle : mcParticles) { auto pdg = std::abs(particle.pdgCode()); - if (particle.eta() < maxEtaParticle) { - continue; - } - if (!particle.isPhysicalPrimary()) { + if (std::abs(particle.eta()) > maxEtaParticle) { continue; } + // if (!(particle.isPhysicalPrimary())) { + // continue; + // } if (pdg < 100) { continue; } From ab93ffec60acc85e978a8ba9a7969016e72031f7 Mon Sep 17 00:00:00 2001 From: Maximiliano Puccio Date: Fri, 15 Aug 2025 10:01:42 +0200 Subject: [PATCH 065/986] [Trigger] feat: Update OTS object upload process (#12563) --- EventFiltering/macros/uploadOTSobjects.C | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/EventFiltering/macros/uploadOTSobjects.C b/EventFiltering/macros/uploadOTSobjects.C index 8e4c6c27136..eb2011308ce 100644 --- a/EventFiltering/macros/uploadOTSobjects.C +++ b/EventFiltering/macros/uploadOTSobjects.C @@ -31,13 +31,10 @@ constexpr uint32_t chunkSize = 1000000; -void uploadOTSobjects(std::string inputList, std::string passName, bool useAlien, bool chunkedProcessing) +void uploadOTSobjects(std::string inputList, std::string passName, bool useAlien, bool chunkedProcessing = true) { - const std::string kBaseCCDBPath = "Users/m/mpuccio/EventFiltering/OTS/"; + const std::string kBaseCCDBPath = "EventFiltering/Zorro/"; std::string baseCCDBpath = passName.empty() ? kBaseCCDBPath : kBaseCCDBPath + passName + "/"; - if (chunkedProcessing) { - baseCCDBpath += "Chunked/"; - } if (useAlien) { TGrid::Connect("alien://"); } @@ -141,9 +138,9 @@ void uploadOTSobjects(std::string inputList, std::string passName, bool useAlien } } -void uploadOTSobjects(std::string periodName, bool chunkedProcessing) +void uploadOTSobjects(std::string periodName) { int year = 2000 + std::stoi(periodName.substr(3, 2)); gSystem->Exec(Form("alien_find /alice/data/%i/%s/ ctf_skim_full/AnalysisResults_fullrun.root | sed 's:/AnalysisResults_fullrun\\.root::' > list_%s.txt", year, periodName.data(), periodName.data())); - uploadOTSobjects(Form("list_%s.txt", periodName.data()), "", true, chunkedProcessing); + uploadOTSobjects(Form("list_%s.txt", periodName.data()), "", true, true); } From 9fd8fa21e4daf2748bb6f4b9602170a9fb4594e8 Mon Sep 17 00:00:00 2001 From: Yash Patley <52608802+yashpatley@users.noreply.github.com> Date: Fri, 15 Aug 2025 13:56:54 +0530 Subject: [PATCH 066/986] [PWGCF] Update lambdaR2Correlation.cxx (#12581) --- .../TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx index ba34f15f58d..814899e0261 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx @@ -1519,7 +1519,7 @@ struct LambdaR2Correlation { // Event histos.add("Event/Reco/h1f_collision_posz", "V_{Z} Distribution", kTH1F, {axisPosZ}); histos.add("Event/Reco/h1f_ft0m_mult_percentile", "FT0M (%)", kTH1F, {axisCent}); - histos.add("Event/Reco/h2f_Mult_vs_Centrality", "N_{TPC} vs FT0M(%)", kTH2F, {axisCent, axisChMult}); + histos.add("Event/Reco/h2f_Mult_vs_Centrality", "N_{ch} vs FT0M(%)", kTH2F, {axisCent, axisChMult}); histos.add("Event/Reco/h2f_lambda_mult", "#Lambda - Multiplicity", kTH2F, {axisCent, axisMult}); histos.add("Event/Reco/h2f_antilambda_mult", "#bar{#Lambda} - Multiplicity", kTH2F, {axisCent, axisMult}); @@ -1534,8 +1534,8 @@ struct LambdaR2Correlation { // Single and Two Particle Densities // 1D Histograms - histos.add("Reco/Primary/h2f_n1_mass_LaP", "#rho_{1}^{#Lambda}", kTH2F, {axisCent, axisMass}); - histos.add("Reco/Primary/h2f_n1_mass_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH2F, {axisCent, axisMass}); + histos.add("Reco/Primary/h3f_n1_centmasspt_LaP", "#rho_{1}^{#Lambda}", kTH3F, {axisCent, axisMass, axisPt}); + histos.add("Reco/Primary/h3f_n1_centmasspt_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH3F, {axisCent, axisMass, axisPt}); histos.add("Reco/Primary/h2f_n1_pt_LaP", "#rho_{1}^{#Lambda}", kTH2F, {axisCent, axisPt}); histos.add("Reco/Primary/h2f_n1_pt_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH2F, {axisCent, axisPt}); histos.add("Reco/Primary/h2f_n1_eta_LaP", "#rho_{1}^{#Lambda}", kTH2F, {axisCent, axisEta}); @@ -1648,7 +1648,7 @@ struct LambdaR2Correlation { histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("Efficiency/h3f_n1_centptrap_") + HIST(SubDirHist[part]), cent, track.pt(), track.rap()); // QA Plots - histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h2f_n1_mass_") + HIST(SubDirHist[part]), cent, track.mass()); + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h3f_n1_centmasspt_") + HIST(SubDirHist[part]), cent, track.mass(), track.pt()); histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h2f_n1_pt_") + HIST(SubDirHist[part]), cent, track.pt(), track.corrFact()); histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h2f_n1_eta_") + HIST(SubDirHist[part]), cent, track.eta(), track.corrFact()); histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h2f_n1_phi_") + HIST(SubDirHist[part]), cent, track.phi(), track.corrFact()); From bb80d72b6c1b162ff8ebf60a281e5b8d7a4d3646 Mon Sep 17 00:00:00 2001 From: omvazque Date: Fri, 15 Aug 2025 06:08:10 -0500 Subject: [PATCH 067/986] [PWGLF] Removed weights when filling pt moments (#12586) --- PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx | 117 +++++++++---------- 1 file changed, 55 insertions(+), 62 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx index 69db7b49952..4316f393539 100644 --- a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx @@ -254,6 +254,8 @@ struct UccZdc { registry.add("ExcludedEvtVsNPV", Form(";%s;Entries;", tiNPV), kTH1F, {{nBinsITSTrack, 0, maxITSTrack}}); registry.add("Nch", Form(";%s;Entries;", tiNch), kTH1F, {{nBinsNch, minNch, maxNch}}); registry.add("NchVsOneParCorr", Form(";%s;%s;", tiNch, tiOneParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); + registry.add("NchVsTwoParCorr", Form(";%s;#LT[#it{p}_{T}^{(2)}]#GT;", tiNch), kTProfile, {{nBinsNch, minNch, maxNch}}); + registry.add("NchVsThreeParCorr", Form(";%s;#LT[#it{p}_{T}^{(3)}]#GT;", tiNch), kTProfile, {{nBinsNch, minNch, maxNch}}); auto hstat = registry.get(HIST("hEventCounter")); auto* x = hstat->GetXaxis(); @@ -645,7 +647,7 @@ struct UccZdc { return; } - double meanpt{0.}; + double sumpt{0.}; for (const auto& track : tracks) { // Track Selection if (!track.isGlobalTrack()) { @@ -662,7 +664,7 @@ struct UccZdc { registry.fill(HIST("EtaVsPhi"), track.eta(), track.phi()); registry.fill(HIST("sigma1Pt"), track.pt(), track.sigma1Pt()); registry.fill(HIST("dcaXYvspT"), track.dcaXY(), track.pt()); - meanpt += track.pt(); + sumpt += track.pt(); } registry.fill(HIST("zPos"), collision.posZ()); @@ -693,7 +695,7 @@ struct UccZdc { registry.fill(HIST("ZNVsNch"), glbTracks, sumZNs); registry.fill(HIST("ZNDifVsNch"), glbTracks, znA - znC); if (glbTracks >= minNchSel) - registry.fill(HIST("NchVsOneParCorr"), glbTracks, meanpt / glbTracks); + registry.fill(HIST("NchVsOneParCorr"), glbTracks, sumpt / glbTracks); } PROCESS_SWITCH(UccZdc, processQA, "Process QA", true); void processZdcCollAss(o2::aod::ColEvSels::iterator const& collision, o2::aod::BCsRun3 const& /*bcs*/, aod::Zdcs const& /*zdcs*/, aod::FV0As const& /*fv0as*/, aod::FT0s const& /*ft0s*/, TheFilteredTracks const& tracks) @@ -944,45 +946,41 @@ struct UccZdc { getPTpowers(pTs, vecEff, vecFD, p1, w1, p2, w2, p3, w3, p4, w4); // EbE one-particle pT correlation - double oneParCorr{p1 / w1}; + const double oneParCorr{p1 / w1}; // EbE two-particle pT correlation - double denTwoParCorr{std::pow(w1, 2.) - w2}; - double numTwoParCorr{std::pow(p1, 2.) - p2}; - double twoParCorr{numTwoParCorr / denTwoParCorr}; + const double denTwoParCorr{std::pow(w1, 2.) - w2}; + const double numTwoParCorr{std::pow(p1, 2.) - p2}; + const double twoParCorr{numTwoParCorr / denTwoParCorr}; // EbE three-particle pT correlation - double denThreeParCorr{std::pow(w1, 3.) - 3. * w2 * w1 + 2. * w3}; - double numThreeParCorr{std::pow(p1, 3.) - 3. * p2 * p1 + 2. * p3}; - double threeParCorr{numThreeParCorr / denThreeParCorr}; - - // EbE four-particle pT correlation - // double denFourParCorr{std::pow(w1, 4.) - 6. * w2 * std::pow(w1, 2.) + 3. * std::pow(w2, 2.) + 8 * w3 * w1 - 6. * w4}; - // double numFourParCorr{std::pow(p1, 4.) - 6. * p2 * std::pow(p1, 2.) + 3. * std::pow(p2, 2.) + 8 * p3 * p1 - 6. * p4}; - // double fourParCorr{numFourParCorr / denFourParCorr}; + const double denThreeParCorr{std::pow(w1, 3.) - (3. * w2 * w1) + (2. * w3)}; + const double numThreeParCorr{std::pow(p1, 3.) - (3. * p2 * p1) + (2. * p3)}; + const double threeParCorr{numThreeParCorr / denThreeParCorr}; // One-dimensional distributions registry.fill(HIST("Nch"), nchMult); registry.fill(HIST("NchUncorrected"), glbTracks); - registry.fill(HIST("NchVsV0A"), nchMult, normV0A); registry.fill(HIST("NchVsT0M"), nchMult, normT0M); registry.fill(HIST("NchVsZN"), nchMult, sumZNs); registry.fill(HIST("NchVsZP"), nchMult, sumZPs); - registry.fill(HIST("NchVsOneParCorr"), nchMult, oneParCorr, w1); + registry.fill(HIST("NchVsOneParCorr"), nchMult, oneParCorr); + registry.fill(HIST("NchVsTwoParCorr"), nchMult, twoParCorr); + registry.fill(HIST("NchVsThreeParCorr"), nchMult, threeParCorr); - registry.fill(HIST("NchVsOneParCorrVsZN"), nchMult, sumZNs, oneParCorr, w1); - registry.fill(HIST("NchVsTwoParCorrVsZN"), nchMult, sumZNs, twoParCorr, denTwoParCorr); - registry.fill(HIST("NchVsThreeParCorrVsZN"), nchMult, sumZNs, threeParCorr, denThreeParCorr); + registry.fill(HIST("NchVsOneParCorrVsZN"), nchMult, sumZNs, oneParCorr); + registry.fill(HIST("NchVsTwoParCorrVsZN"), nchMult, sumZNs, twoParCorr); + registry.fill(HIST("NchVsThreeParCorrVsZN"), nchMult, sumZNs, threeParCorr); - registry.fill(HIST("NchVsOneParCorrVsT0M"), nchMult, normT0M, oneParCorr, w1); - registry.fill(HIST("NchVsTwoParCorrVsT0M"), nchMult, normT0M, twoParCorr, denTwoParCorr); - registry.fill(HIST("NchVsThreeParCorrVsT0M"), nchMult, normT0M, threeParCorr, denThreeParCorr); + registry.fill(HIST("NchVsOneParCorrVsT0M"), nchMult, normT0M, oneParCorr); + registry.fill(HIST("NchVsTwoParCorrVsT0M"), nchMult, normT0M, twoParCorr); + registry.fill(HIST("NchVsThreeParCorrVsT0M"), nchMult, normT0M, threeParCorr); - registry.fill(HIST("NchVsOneParCorrVsV0A"), nchMult, normV0A, oneParCorr, w1); - registry.fill(HIST("NchVsTwoParCorrVsV0A"), nchMult, normV0A, twoParCorr, denTwoParCorr); - registry.fill(HIST("NchVsThreeParCorrVsV0A"), nchMult, normV0A, threeParCorr, denThreeParCorr); + registry.fill(HIST("NchVsOneParCorrVsV0A"), nchMult, normV0A, oneParCorr); + registry.fill(HIST("NchVsTwoParCorrVsV0A"), nchMult, normV0A, twoParCorr); + registry.fill(HIST("NchVsThreeParCorrVsV0A"), nchMult, normV0A, threeParCorr); const uint64_t timeStamp{foundBC.timestamp()}; eventSampling(tracks, normV0A, normT0M, sumZNs, timeStamp); @@ -1146,10 +1144,8 @@ struct UccZdc { const double denTwoParCorr{std::pow(w1, 2.) - w2}; const double numTwoParCorr{std::pow(p1, 2.) - p2}; - const double denThreeParCorr{std::pow(w1, 3.) - 3. * w2 * w1 + 2. * w3}; - const double numThreeParCorr{std::pow(p1, 3.) - 3. * p2 * p1 + 2. * p3}; - // const double denFourParCorr{std::pow(w1, 4.) - 6. * w2 * std::pow(w1, 2.) + 3. * std::pow(w2, 2.) + 8 * w3 * w1 - 6. * w4}; - // const double numFourParCorr{std::pow(p1, 4.) - 6. * p2 * std::pow(p1, 2.) + 3. * std::pow(p2, 2.) + 8 * p3 * p1 - 6. * p4}; + const double denThreeParCorr{std::pow(w1, 3.) - (3. * w2 * w1) + (2. * w3)}; + const double numThreeParCorr{std::pow(p1, 3.) - (3. * p2 * p1) + (2. * p3)}; const double oneParCorr{p1 / w1}; const double twoParCorr{numTwoParCorr / denTwoParCorr}; @@ -1157,9 +1153,9 @@ struct UccZdc { registry.fill(HIST("Nch"), nchMult); registry.fill(HIST("NchUncorrected"), nchRaw); - registry.fill(HIST("NchVsOneParCorr"), nchMult, oneParCorr, w1); - registry.fill(HIST("NchVsTwoParCorr"), nchMult, twoParCorr, denTwoParCorr); - registry.fill(HIST("NchVsThreeParCorr"), nchMult, threeParCorr, denThreeParCorr); + registry.fill(HIST("NchVsOneParCorr"), nchMult, oneParCorr); + registry.fill(HIST("NchVsTwoParCorr"), nchMult, twoParCorr); + registry.fill(HIST("NchVsThreeParCorr"), nchMult, threeParCorr); //--------------------------- Generated MC --------------------------- std::vector pTsMC; @@ -1211,20 +1207,17 @@ struct UccZdc { const double denTwoParCorrMC{std::pow(w1MC, 2.) - w2MC}; const double numTwoParCorrMC{std::pow(p1MC, 2.) - p2MC}; - const double denThreeParCorrMC{std::pow(w1MC, 3.) - 3. * w2MC * w1MC + 2. * w3MC}; - const double numThreeParCorrMC{std::pow(p1MC, 3.) - 3. * p2MC * p1MC + 2. * p3MC}; - // const double denFourParCorrMC{std::pow(w1MC, 4.) - 6. * w2MC * std::pow(w1MC, 2.) + 3. * std::pow(w2MC, 2.) + 8 * w3MC * w1MC - 6. * w4MC}; - // const double numFourParCorrMC{std::pow(p1MC, 4.) - 6. * p2MC * std::pow(p1MC, 2.) + 3. * std::pow(p2MC, 2.) + 8 * p3MC * p1MC - 6. * p4MC}; + const double denThreeParCorrMC{std::pow(w1MC, 3.) - (3. * w2MC * w1MC) + (2. * w3MC)}; + const double numThreeParCorrMC{std::pow(p1MC, 3.) - (3. * p2MC * p1MC) + (2. * p3MC)}; const double oneParCorrMC{p1MC / w1MC}; const double twoParCorrMC{numTwoParCorrMC / denTwoParCorrMC}; const double threeParCorrMC{numThreeParCorrMC / denThreeParCorrMC}; - // const double fourParCorrMC{numFourParCorrMC / denFourParCorrMC}; registry.fill(HIST("NchGen"), nchMC); - registry.fill(HIST("NchvsOneParCorrGen"), nchMC, oneParCorrMC, w1MC); - registry.fill(HIST("NchvsTwoParCorrGen"), nchMC, twoParCorrMC, denTwoParCorrMC); - registry.fill(HIST("NchvsThreeParCorrGen"), nchMC, threeParCorrMC, denThreeParCorrMC); + registry.fill(HIST("NchvsOneParCorrGen"), nchMC, oneParCorrMC); + registry.fill(HIST("NchvsTwoParCorrGen"), nchMC, twoParCorrMC); + registry.fill(HIST("NchvsThreeParCorrGen"), nchMC, threeParCorrMC); //------------------ Poisson sampling eventSamplingMC(mcParticles, timeStamp); @@ -1441,14 +1434,14 @@ struct UccZdc { const double twoParCorr{numTwoParCorr / denTwoParCorr}; // EbE three-particle pT correlation - const double denThreeParCorr{std::pow(w1, 3.) - 3. * w2 * w1 + 2. * w3}; - const double numThreeParCorr{std::pow(p1, 3.) - 3. * p2 * p1 + 2. * p3}; + const double denThreeParCorr{std::pow(w1, 3.) - (3. * w2 * w1) + (2. * w3)}; + const double numThreeParCorr{std::pow(p1, 3.) - (3. * p2 * p1) + (2. * p3)}; const double threeParCorr{numThreeParCorr / denThreeParCorr}; hNchGen[replica]->Fill(nchMult); - pOneParCorrVsNchGen[replica]->Fill(nchMult, oneParCorr, w1); - pTwoParCorrVsNchGen[replica]->Fill(nchMult, twoParCorr, denTwoParCorr); - pThreeParCorrVsNchGen[replica]->Fill(nchMult, threeParCorr, denThreeParCorr); + pOneParCorrVsNchGen[replica]->Fill(nchMult, oneParCorr); + pTwoParCorrVsNchGen[replica]->Fill(nchMult, twoParCorr); + pThreeParCorrVsNchGen[replica]->Fill(nchMult, threeParCorr); } // event per replica } // replica's loop } @@ -1584,14 +1577,14 @@ struct UccZdc { const double twoParCorr{numTwoParCorr / denTwoParCorr}; // EbE three-particle pT correlation - const double denThreeParCorr{std::pow(w1, 3.) - 3. * w2 * w1 + 2. * w3}; - const double numThreeParCorr{std::pow(p1, 3.) - 3. * p2 * p1 + 2. * p3}; + const double denThreeParCorr{std::pow(w1, 3.) - (3. * w2 * w1) + (2. * w3)}; + const double numThreeParCorr{std::pow(p1, 3.) - (3. * p2 * p1) + (2. * p3)}; const double threeParCorr{numThreeParCorr / denThreeParCorr}; hNch[replica]->Fill(nchMult); - pOneParCorrVsNch[replica]->Fill(nchMult, oneParCorr, w1); - pTwoParCorrVsNch[replica]->Fill(nchMult, twoParCorr, denTwoParCorr); - pThreeParCorrVsNch[replica]->Fill(nchMult, threeParCorr, denThreeParCorr); + pOneParCorrVsNch[replica]->Fill(nchMult, oneParCorr); + pTwoParCorrVsNch[replica]->Fill(nchMult, twoParCorr); + pThreeParCorrVsNch[replica]->Fill(nchMult, threeParCorr); } // event per replica } // replica's loop } @@ -1732,25 +1725,25 @@ struct UccZdc { const double twoParCorr{numTwoParCorr / denTwoParCorr}; // EbE three-particle pT correlation - const double denThreeParCorr{std::pow(w1, 3.) - 3. * w2 * w1 + 2. * w3}; - const double numThreeParCorr{std::pow(p1, 3.) - 3. * p2 * p1 + 2. * p3}; + const double denThreeParCorr{std::pow(w1, 3.) - (3. * w2 * w1) + (2. * w3)}; + const double numThreeParCorr{std::pow(p1, 3.) - (3. * p2 * p1) + (2. * p3)}; const double threeParCorr{numThreeParCorr / denThreeParCorr}; hNchVsZN[replica]->Fill(nchMult, sumZNs); hNchVsV0A[replica]->Fill(nchMult, normV0A); hNchVsT0M[replica]->Fill(nchMult, normT0M); - pNchVsOneParCorrVsZN[replica]->Fill(nchMult, sumZNs, oneParCorr, w1); - pNchVsTwoParCorrVsZN[replica]->Fill(nchMult, sumZNs, twoParCorr, denTwoParCorr); - pNchVsThreeParCorrVsZN[replica]->Fill(nchMult, sumZNs, threeParCorr, denThreeParCorr); + pNchVsOneParCorrVsZN[replica]->Fill(nchMult, sumZNs, oneParCorr); + pNchVsTwoParCorrVsZN[replica]->Fill(nchMult, sumZNs, twoParCorr); + pNchVsThreeParCorrVsZN[replica]->Fill(nchMult, sumZNs, threeParCorr); - pNchVsOneParCorrVsT0M[replica]->Fill(nchMult, normT0M, oneParCorr, w1); - pNchVsTwoParCorrVsT0M[replica]->Fill(nchMult, normT0M, twoParCorr, denTwoParCorr); - pNchVsThreeParCorrVsT0M[replica]->Fill(nchMult, normT0M, threeParCorr, denThreeParCorr); + pNchVsOneParCorrVsT0M[replica]->Fill(nchMult, normT0M, oneParCorr); + pNchVsTwoParCorrVsT0M[replica]->Fill(nchMult, normT0M, twoParCorr); + pNchVsThreeParCorrVsT0M[replica]->Fill(nchMult, normT0M, threeParCorr); - pNchVsOneParCorrVsV0A[replica]->Fill(nchMult, normV0A, oneParCorr, w1); - pNchVsTwoParCorrVsV0A[replica]->Fill(nchMult, normV0A, twoParCorr, denTwoParCorr); - pNchVsThreeParCorrVsV0A[replica]->Fill(nchMult, normV0A, threeParCorr, denThreeParCorr); + pNchVsOneParCorrVsV0A[replica]->Fill(nchMult, normV0A, oneParCorr); + pNchVsTwoParCorrVsV0A[replica]->Fill(nchMult, normV0A, twoParCorr); + pNchVsThreeParCorrVsV0A[replica]->Fill(nchMult, normV0A, threeParCorr); } // event per replica } // replica's loop } From e3f388d05606659466473f4353f67206cefbf740 Mon Sep 17 00:00:00 2001 From: Chiara De Martin <39315597+ChiaraDeMartin95@users.noreply.github.com> Date: Fri, 15 Aug 2025 15:10:45 +0200 Subject: [PATCH 068/986] [PWGLF] Add inv. mass cut on lambda to reduce size of stored tree (#12580) Co-authored-by: Chiara De Martin Co-authored-by: ALICE Action Bot --- .../TableProducer/Strangeness/cascadeflow.cxx | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx index c83984f3a7c..72faae0ec23 100644 --- a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx @@ -228,6 +228,8 @@ struct cascadeFlow { Configurable MaxPtV0{"MaxPtV0", 10, "Max pt of v0"}; Configurable MinMassLambda{"MinMassLambda", 1.105, ""}; Configurable MaxMassLambda{"MaxMassLambda", 1.125, ""}; + Configurable MinMassLambdaInTree{"MinMassLambdaInTree", 1.09, ""}; + Configurable MaxMassLambdaInTree{"MaxMassLambdaInTree", 1.14, ""}; Configurable etaV0{"etaV0", 0.8, "etaV0"}; Configurable v0cospa{"v0cospa", 0.97, "min V0 CosPA"}; Configurable dcav0dau{"dcav0dau", 1.0, "max DCA V0 Daughters (cm)"}; @@ -577,13 +579,20 @@ struct cascadeFlow { template void fillAnalysedLambdaTable(collision_t coll, bool hasEventPlane, bool hasSpectatorPlane, int chargeIndex, v0_t v0, float v2CEP, float psiT0C, double pzs2Lambda, double cos2ThetaLambda, double cosThetaLambda) { + double invMassLambda = 0; + if (chargeIndex == 0) + invMassLambda = v0.mLambda(); + else if (chargeIndex == 1) + invMassLambda = v0.mAntiLambda(); + else + invMassLambda = v0.mLambda(); analysisLambdaSample(coll.centFT0C(), hasEventPlane, hasSpectatorPlane, chargeIndex, v0.pt(), v0.phi(), - v0.mLambda(), + invMassLambda, v0.v0radius(), v0.dcapostopv(), v0.dcanegtopv(), @@ -1659,6 +1668,18 @@ struct cascadeFlow { histos.get(HIST("hLambdaCos2ThetaVsPsi"))->Fill(coll.centFT0C(), chargeIndex, v0.eta(), v0.pt(), v0.mLambda(), cos2ThetaLambda, 2 * lambdaminuspsiT0C); } + double invMassLambda = 0; + if (chargeIndex == 0) + invMassLambda = v0.mLambda(); + else if (chargeIndex == 1) + invMassLambda = v0.mAntiLambda(); + else + invMassLambda = v0.mLambda(); + + // mass selection + if (invMassLambda < V0Configs.MinMassLambdaInTree || invMassLambda > V0Configs.MaxMassLambdaInTree) + continue; + if (fillingConfigs.isFillTree) fillAnalysedLambdaTable(coll, hasEventPlane, hasSpectatorPlane, chargeIndex, v0, v2CEP, psiT0C, pzs2Lambda, cos2ThetaLambda, cosThetaLambda); } From bebd0d8a1e8a7f4b807d095ffefce171fd0c9710 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 15 Aug 2025 19:16:10 +0200 Subject: [PATCH 069/986] [PWGEM/Dilepton] add skimmerPrimaryElectronQC.cxx (#12591) --- PWGEM/Dilepton/TableProducer/CMakeLists.txt | 5 + .../TableProducer/skimmerPrimaryElectron.cxx | 2 + .../skimmerPrimaryElectronQC.cxx | 805 ++++++++++++++++++ 3 files changed, 812 insertions(+) create mode 100644 PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx diff --git a/PWGEM/Dilepton/TableProducer/CMakeLists.txt b/PWGEM/Dilepton/TableProducer/CMakeLists.txt index d234ee0d2b4..9dbfc1b7d61 100644 --- a/PWGEM/Dilepton/TableProducer/CMakeLists.txt +++ b/PWGEM/Dilepton/TableProducer/CMakeLists.txt @@ -25,6 +25,11 @@ o2physics_add_dpl_workflow(skimmer-primary-electron PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::MLCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(skimmer-primary-electron-qc + SOURCES skimmerPrimaryElectronQC.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::MLCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(skimmer-primary-muon SOURCES skimmerPrimaryMuon.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::GlobalTracking diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx index b40a5e11e7d..778c765aebd 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx @@ -982,6 +982,7 @@ struct prefilterPrimaryElectron { if constexpr (loose_track_sign > 0) { // positive track is loose track auto trackParCov = getTrackParCov(pos); + trackParCov.setPID(o2::track::PID::Electron); o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); getPxPyPz(trackParCov, pVec_recalc); @@ -992,6 +993,7 @@ struct prefilterPrimaryElectron { phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pVec_recalc[0], pVec_recalc[1], pVec_recalc[2], ele.px(), ele.py(), ele.pz(), pos.sign(), ele.sign(), d_bz); } else { auto trackParCov = getTrackParCov(ele); + trackParCov.setPID(o2::track::PID::Electron); o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); getPxPyPz(trackParCov, pVec_recalc); diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx new file mode 100644 index 00000000000..8e3f8228299 --- /dev/null +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx @@ -0,0 +1,805 @@ +// 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. + +/// \brief write relevant information about primary electrons. +/// \author daiki.sekihata@cern.ch + +#include "PWGEM/Dilepton/DataModel/dileptonTables.h" +#include "PWGEM/Dilepton/Utils/MlResponseO2Track.h" +#include "PWGEM/Dilepton/Utils/PairUtilities.h" + +#include "Common/Core/TableHelper.h" +#include "Common/Core/trackUtilities.h" +// #include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseITS.h" +#include "Tools/ML/MlResponse.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/PhysicsConstants.h" +#include "DataFormatsCalibration/MeanVertexObject.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +#include "Math/Vector4D.h" + +#include +#include +#include +#include + +using namespace o2; +using namespace o2::soa; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::constants::physics; + +using MyCollisions = soa::Join; +using MyCollisionsWithSWT = soa::Join; + +using MyTracks = soa::Join; +using MyTrack = MyTracks::iterator; +using MyTracksMC = soa::Join; +using MyTrackMC = MyTracksMC::iterator; + +struct skimmerPrimaryElectronQC { + SliceCache cache; + Preslice perCol = o2::aod::track::collisionId; + Produces emprimaryelectrons; + Produces emprimaryelectronscov; + + // Configurables + Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; + Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; + Configurable mVtxPath{"mVtxPath", "GLO/Calib/MeanVertex", "Path of the mean vertex file"}; + Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; + + // Operation and minimisation criteria + Configurable fillQAHistogram{"fillQAHistogram", false, "flag to fill QA histograms"}; + Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; + + struct : ConfigurableGroup { + std::string prefix = "trackcut"; + Configurable min_ncluster_tpc{"min_ncluster_tpc", 0, "min ncluster tpc"}; + Configurable mincrossedrows{"mincrossedrows", 40, "min. crossed rows"}; + Configurable min_ncluster_its{"min_ncluster_its", 2, "min ncluster its"}; + Configurable min_ncluster_itsib{"min_ncluster_itsib", 0, "min ncluster itsib"}; + Configurable min_tpc_cr_findable_ratio{"min_tpc_cr_findable_ratio", 0.8, "min. TPC Ncr/Nf ratio"}; + Configurable max_frac_shared_clusters_tpc{"max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; + Configurable maxchi2tpc{"maxchi2tpc", 5.0, "max. chi2/NclsTPC"}; + Configurable maxchi2its{"maxchi2its", 36.0, "max. chi2/NclsITS"}; + Configurable minpt{"minpt", 0.05, "min pt for ITS-TPC track"}; + Configurable maxeta{"maxeta", 0.9, "eta acceptance"}; + Configurable dca_xy_max{"dca_xy_max", 1.0, "max DCAxy in cm"}; + Configurable dca_z_max{"dca_z_max", 1.0, "max DCAz in cm"}; + Configurable minTPCNsigmaEl{"minTPCNsigmaEl", -3.5, "min. TPC n sigma for electron inclusion"}; + Configurable maxTPCNsigmaEl{"maxTPCNsigmaEl", +3.5, "max. TPC n sigma for electron inclusion"}; + } trackcut; + + struct : ConfigurableGroup { + std::string prefix = "tighttrackcut"; + Configurable min_ncluster_tpc{"min_ncluster_tpc", 0, "min ncluster tpc"}; + Configurable mincrossedrows{"mincrossedrows", 100, "min. crossed rows"}; + Configurable min_ncluster_its{"min_ncluster_its", 5, "min ncluster its"}; + Configurable min_ncluster_itsib{"min_ncluster_itsib", 3, "min ncluster itsib"}; + Configurable min_tpc_cr_findable_ratio{"min_tpc_cr_findable_ratio", 0.8, "min. TPC Ncr/Nf ratio"}; + Configurable max_frac_shared_clusters_tpc{"max_frac_shared_clusters_tpc", 0.7, "max fraction of shared clusters in TPC"}; + Configurable maxchi2tpc{"maxchi2tpc", 4.0, "max. chi2/NclsTPC"}; + Configurable maxchi2its{"maxchi2its", 5.0, "max. chi2/NclsITS"}; + Configurable dca_xy_max{"dca_xy_max", 0.2, "max DCAxy in cm"}; + Configurable dca_z_max{"dca_z_max", 0.2, "max DCAz in cm"}; + Configurable minTPCNsigmaEl{"minTPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; // Don't change. + Configurable maxTPCNsigmaEl{"maxTPCNsigmaEl", +2.0, "max. TPC n sigma for electron inclusion"}; // Don't change. + Configurable minTOFNsigmaEl{"minTOFNsigmaEl", -2.0, "min. TOF n sigma for electron inclusion"}; // Don't change. + Configurable maxTOFNsigmaEl{"maxTOFNsigmaEl", +2.0, "max. TOF n sigma for electron inclusion"}; // Don't change. + } tighttrackcut; + + Configurable storeOnlyTrueElectronMC{"storeOnlyTrueElectronMC", false, "Flag to store only true electron in MC"}; + Configurable maxMee{"maxMee", 0.005, "max mee for pi0 -> ee"}; + Configurable maxPhiV{"maxPhiV", M_PI / 2, "max phiv for pi0 -> ee"}; + + // configuration for PID ML + Configurable usePIDML{"usePIDML", false, "Flag to use PID ML"}; + Configurable> onnxFileNames{"onnxFileNames", std::vector{"filename"}, "ONNX file names for each bin (if not from CCDB full path)"}; + Configurable> onnxPathsCCDB{"onnxPathsCCDB", std::vector{"path"}, "Paths of models on CCDB"}; + Configurable> binsMl{"binsMl", std::vector{-999999., 999999.}, "Bin limits for ML application"}; + Configurable> cutsMl{"cutsMl", std::vector{0.95}, "ML cuts per bin"}; + Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature"}, "Names of ML model input features"}; + Configurable nameBinningFeature{"nameBinningFeature", "pt", "Names of ML model binning feature"}; + Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB. Exceptions: > 0 for the specific timestamp, 0 gets the run dependent timestamp"}; + Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; + Configurable enableOptimizations{"enableOptimizations", false, "Enables the ONNX extended model-optimization: sessionOptions.SetGraphOptimizationLevel(GraphOptimizationLevel::ORT_ENABLE_EXTENDED)"}; + + HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; + o2::analysis::MlResponseO2Track mlResponseSingleTrack; + + int mRunNumber; + float d_bz; + Service ccdb; + // o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; + o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; + + o2::dataformats::VertexBase mVtx; + o2::dataformats::DCA mDcaInfoCov; + + const o2::dataformats::MeanVertexObject* mMeanVtx = nullptr; + o2::base::MatLayerCylSet* lut = nullptr; + o2::ccdb::CcdbApi ccdbApi; + + void init(InitContext&) + { + mRunNumber = 0; + d_bz = 0; + + ccdb->setURL(ccdburl); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setFatalWhenNull(false); + ccdbApi.init(ccdburl); + + if (fillQAHistogram) { + fRegistry.add("Track/hPt", "pT;p_{T} (GeV/c)", kTH1F, {{1000, 0.0f, 10}}, false); + fRegistry.add("Track/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{400, -20, 20}}, false); + fRegistry.add("Track/hEtaPhi", "#eta vs. #varphi;#varphi (rad.);#eta", kTH2F, {{180, 0, 2 * M_PI}, {20, -1.0f, 1.0f}}, false); + fRegistry.add("Track/hDCAxyz", "DCA xy vs. z;DCA_{xy} (cm);DCA_{z} (cm)", kTH2F, {{200, -1.0f, 1.0f}, {200, -1.0f, 1.0f}}, false); + fRegistry.add("Track/hDCAxyzSigma", "DCA xy vs. z;DCA_{xy} (#sigma);DCA_{z} (#sigma)", kTH2F, {{200, -10.0f, 10.0f}, {200, -10.0f, 10.0f}}, false); + fRegistry.add("Track/hDCAxyRes_Pt", "DCA_{xy} resolution vs. pT;p_{T} (GeV/c);DCA_{xy} resolution (#mum)", kTH2F, {{1000, 0, 10}, {500, 0., 500}}, false); + fRegistry.add("Track/hDCAzRes_Pt", "DCA_{z} resolution vs. pT;p_{T} (GeV/c);DCA_{z} resolution (#mum)", kTH2F, {{1000, 0, 10}, {500, 0., 500}}, false); + fRegistry.add("Track/hNclsTPC", "number of TPC clusters", kTH1F, {{161, -0.5, 160.5}}, false); + fRegistry.add("Track/hNcrTPC", "number of TPC crossed rows", kTH1F, {{161, -0.5, 160.5}}, false); + fRegistry.add("Track/hChi2TPC", "chi2/number of TPC clusters", kTH1F, {{100, 0, 10}}, false); + fRegistry.add("Track/hChi2TOF", "chi2 of TOF", kTH1F, {{100, 0, 10}}, false); + fRegistry.add("Track/hTPCNcr2Nf", "TPC Ncr/Nfindable", kTH1F, {{200, 0, 2}}, false); + fRegistry.add("Track/hTPCNcls2Nf", "TPC Ncls/Nfindable", kTH1F, {{200, 0, 2}}, false); + fRegistry.add("Track/hTPCNclsShared", "TPC Ncls shared/Ncls;p_{T} (GeV/c);N_{cls}^{shared}/N_{cls} in TPC", kTH2F, {{1000, 0, 10}, {100, 0, 1}}, false); + fRegistry.add("Track/hNclsITS", "number of ITS clusters", kTH1F, {{8, -0.5, 7.5}}, false); + fRegistry.add("Track/hChi2ITS", "chi2/number of ITS clusters", kTH1F, {{400, 0, 40}}, false); + fRegistry.add("Track/hITSClusterMap", "ITS cluster map", kTH1F, {{128, -0.5, 127.5}}, false); + fRegistry.add("Track/hTPCdEdx", "TPC dE/dx;p_{in} (GeV/c);TPC dE/dx (a.u.)", kTH2F, {{1000, 0, 10}, {200, 0, 200}}, false); + fRegistry.add("Track/hTPCdEdxMC", "TPC dE/dx;p_{in} (GeV/c);TPC dE/dx (a.u.)", kTH2F, {{1000, 0, 10}, {200, 0, 200}}, false); + fRegistry.add("Track/hTPCNsigmaEl", "TPC n sigma el;p_{in} (GeV/c);n #sigma_{e}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + fRegistry.add("Track/hTPCNsigmaPi", "TPC n sigma pi;p_{in} (GeV/c);n #sigma_{#pi}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + fRegistry.add("Track/hTPCNsigmaKa", "TPC n sigma ka;p_{in} (GeV/c);n #sigma_{K}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + fRegistry.add("Track/hTPCNsigmaPr", "TPC n sigma pr;p_{in} (GeV/c);n #sigma_{p}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + fRegistry.add("Track/hTOFbeta", "TOF beta;p_{pv} (GeV/c);#beta", kTH2F, {{1000, 0, 10}, {240, 0, 1.2}}, false); + fRegistry.add("Track/hTOFNsigmaEl", "TOF n sigma el;p_{in} (GeV/c);n #sigma_{e}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + fRegistry.add("Track/hTOFNsigmaPi", "TOF n sigma pi;p_{in} (GeV/c);n #sigma_{#pi}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + fRegistry.add("Track/hTOFNsigmaKa", "TOF n sigma ka;p_{in} (GeV/c);n #sigma_{K}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + fRegistry.add("Track/hTOFNsigmaPr", "TOF n sigma pr;p_{in} (GeV/c);n #sigma_{p}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + fRegistry.add("Track/hMeanClusterSizeITS", "mean cluster size ITS;p_{pv} (GeV/c); #times cos(#lambda)", kTH2F, {{1000, 0, 10}, {150, 0, 15}}, false); + fRegistry.add("Track/hMeanClusterSizeITSib", "mean cluster size ITSib;p_{pv} (GeV/c); #times cos(#lambda)", kTH2F, {{1000, 0, 10}, {150, 0, 15}}, false); + fRegistry.add("Track/hMeanClusterSizeITSob", "mean cluster size ITSob;p_{pv} (GeV/c); #times cos(#lambda)", kTH2F, {{1000, 0, 10}, {150, 0, 15}}, false); + fRegistry.add("Pair/hMvsPhiV", "m_{ee} vs. #varphi_{V} ULS;#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", kTH2F, {{180, 0.f, M_PI}, {100, 0, 0.1}}); + } + + if (usePIDML) { + static constexpr int nClassesMl = 2; + const std::vector cutDirMl = {o2::cuts_ml::CutNot, o2::cuts_ml::CutSmaller}; + const std::vector labelsClasses = {"Background", "Signal"}; + const uint32_t nBinsMl = binsMl.value.size() - 1; + const std::vector labelsBins(nBinsMl, "bin"); + double cutsMlArr[nBinsMl][nClassesMl]; + for (uint32_t i = 0; i < nBinsMl; i++) { + cutsMlArr[i][0] = 0.0; + cutsMlArr[i][1] = cutsMl.value[i]; + } + o2::framework::LabeledArray cutsMl = {cutsMlArr[0], nBinsMl, nClassesMl, labelsBins, labelsClasses}; + + mlResponseSingleTrack.configure(binsMl.value, cutsMl, cutDirMl, nClassesMl); + if (loadModelsFromCCDB) { + ccdbApi.init(ccdburl); + mlResponseSingleTrack.setModelPathsCCDB(onnxFileNames.value, ccdbApi, onnxPathsCCDB.value, timestampCCDB.value); + } else { + mlResponseSingleTrack.setModelPathsLocal(onnxFileNames.value); + } + mlResponseSingleTrack.cacheInputFeaturesIndices(namesInputFeatures); + mlResponseSingleTrack.cacheBinningIndex(nameBinningFeature); + mlResponseSingleTrack.init(enableOptimizations.value); + } // end of PID ML + } + + void initCCDB(aod::BCsWithTimestamps::iterator const& bc) + { + if (mRunNumber == bc.runNumber()) { + return; + } + + // load matLUT for this timestamp + if (!lut) { + LOG(info) << "Loading material look-up table for timestamp: " << bc.timestamp(); + lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->getForTimeStamp(lutPath, bc.timestamp())); + } else { + LOG(info) << "Material look-up table already in place. Not reloading."; + } + + // In case override, don't proceed, please - no CCDB access required + if (d_bz_input > -990) { + d_bz = d_bz_input; + o2::parameters::GRPMagField grpmag; + if (std::fabs(d_bz) > 1e-5) { + grpmag.setL3Current(30000.f / (d_bz / 5.0f)); + } + o2::base::Propagator::initFieldFromGRP(&grpmag); + o2::base::Propagator::Instance()->setMatLUT(lut); + mMeanVtx = ccdb->getForTimeStamp(mVtxPath, bc.timestamp()); + mRunNumber = bc.runNumber(); + return; + } + + auto run3grp_timestamp = bc.timestamp(); + o2::parameters::GRPObject* grpo = 0x0; + o2::parameters::GRPMagField* grpmag = 0x0; + if (!skipGRPOquery) { + grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); + } + if (grpo) { + o2::base::Propagator::initFieldFromGRP(grpo); + o2::base::Propagator::Instance()->setMatLUT(lut); + mMeanVtx = ccdb->getForTimeStamp(mVtxPath, bc.timestamp()); + // Fetch magnetic field from ccdb for current collision + d_bz = grpo->getNominalL3Field(); + LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; + } else { + grpmag = ccdb->getForTimeStamp(grpmagPath, run3grp_timestamp); + if (!grpmag) { + LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp; + } + o2::base::Propagator::initFieldFromGRP(grpmag); + o2::base::Propagator::Instance()->setMatLUT(lut); + mMeanVtx = ccdb->getForTimeStamp(mVtxPath, bc.timestamp()); + + // Fetch magnetic field from ccdb for current collision + d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); + LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; + } + mRunNumber = bc.runNumber(); + } + + template + bool checkTrack(TCollision const& collision, TTrack const& track) + { + if constexpr (isMC) { + if (!track.has_mcParticle()) { + return false; + } + if (storeOnlyTrueElectronMC) { + const auto& mcParticle = track.template mcParticle_as(); + if (std::abs(mcParticle.pdgCode()) != 11) { + return false; + } + } + } + + if (!track.hasITS()) { + return false; + } + + if (trackcut.maxchi2its < track.itsChi2NCl()) { // accept ITS afterburner (itsChi2NCl = -999) + return false; + } + if (track.itsNCls() < trackcut.min_ncluster_its) { + return false; + } + if (track.itsNClsInnerBarrel() < trackcut.min_ncluster_itsib) { + return false; + } + + if (track.hasTPC()) { + if (track.tpcChi2NCl() < 0.f || trackcut.maxchi2tpc < track.tpcChi2NCl()) { + return false; + } + + if (track.tpcNClsFound() < trackcut.min_ncluster_tpc) { + return false; + } + + if (track.tpcNClsCrossedRows() < trackcut.mincrossedrows) { + return false; + } + + if (track.tpcCrossedRowsOverFindableCls() < trackcut.min_tpc_cr_findable_ratio) { + return false; + } + + if (track.tpcFractionSharedCls() > trackcut.max_frac_shared_clusters_tpc) { + return false; + } + } + + mDcaInfoCov.set(999, 999, 999, 999, 999); + auto trackParCov = getTrackParCov(track); + trackParCov.setPID(o2::track::PID::Electron); + mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); + mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + float dcaXY = mDcaInfoCov.getY(); + float dcaZ = mDcaInfoCov.getZ(); + + if (std::fabs(dcaXY) > trackcut.dca_xy_max || std::fabs(dcaZ) > trackcut.dca_z_max) { + return false; + } + + if (trackParCov.getPt() < trackcut.minpt || std::fabs(trackParCov.getEta()) > trackcut.maxeta) { + return false; + } + + return true; + } + + template + bool checkTrackTight(TCollision const& collision, TTrack const& track) + { + if constexpr (isMC) { + if (!track.has_mcParticle()) { + return false; + } + if (storeOnlyTrueElectronMC) { + const auto& mcParticle = track.template mcParticle_as(); + if (std::abs(mcParticle.pdgCode()) != 11) { + return false; + } + } + } + + if (!track.hasITS() || !track.hasTPC()) { + return false; + } + + if (track.itsChi2NCl() < 0.f || tighttrackcut.maxchi2its < track.itsChi2NCl()) { + return false; + } + if (track.itsNCls() < tighttrackcut.min_ncluster_its) { + return false; + } + if (track.itsNClsInnerBarrel() < tighttrackcut.min_ncluster_itsib) { + return false; + } + + if (track.tpcChi2NCl() < 0.f || tighttrackcut.maxchi2tpc < track.tpcChi2NCl()) { + return false; + } + + if (track.tpcNClsFound() < tighttrackcut.min_ncluster_tpc) { + return false; + } + + if (track.tpcNClsCrossedRows() < tighttrackcut.mincrossedrows) { + return false; + } + + if (track.tpcCrossedRowsOverFindableCls() < tighttrackcut.min_tpc_cr_findable_ratio) { + return false; + } + + if (track.tpcFractionSharedCls() > tighttrackcut.max_frac_shared_clusters_tpc) { + return false; + } + + mDcaInfoCov.set(999, 999, 999, 999, 999); + auto trackParCov = getTrackParCov(track); + trackParCov.setPID(o2::track::PID::Electron); + mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); + mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + float dcaXY = mDcaInfoCov.getY(); + float dcaZ = mDcaInfoCov.getZ(); + + if (std::fabs(dcaXY) > tighttrackcut.dca_xy_max || std::fabs(dcaZ) > tighttrackcut.dca_z_max) { + return false; + } + + if (trackParCov.getPt() < trackcut.minpt || std::fabs(trackParCov.getEta()) > trackcut.maxeta) { + return false; + } + + return true; + } + + template + bool isElectron(TTrack const& track) + { + if (track.hasTPC() && (trackcut.minTPCNsigmaEl < track.tpcNSigmaEl() && track.tpcNSigmaEl() < trackcut.maxTPCNsigmaEl)) { + return true; // accept ITSsa too + } else { + return false; + } + + // if (usePIDML) { + // mDcaInfoCov.set(999, 999, 999, 999, 999); + // auto trackParCov = getTrackParCov(track); + // trackParCov.setPID(o2::track::PID::Electron); + // mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); + // mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); + // o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + + // std::vector inputFeatures = mlResponseSingleTrack.getInputFeatures(track, trackParCov, collision); + // float binningFeature = mlResponseSingleTrack.getBinningFeature(track, trackParCov, collision); + // return mlResponseSingleTrack.isSelectedMl(inputFeatures, binningFeature); + // } else { + // return isElectronTPC(track); + // } + } + + template + bool isElectronTight(TTrack const& track) + { + bool is_El_TPC = tighttrackcut.minTPCNsigmaEl < track.tpcNSigmaEl() && track.tpcNSigmaEl() < tighttrackcut.maxTPCNsigmaEl; + bool is_El_TOF = tighttrackcut.minTOFNsigmaEl < track.tofNSigmaEl() && track.tofNSigmaEl() < tighttrackcut.maxTOFNsigmaEl; + return is_El_TPC && is_El_TOF; + } + + template + void fillTrackTable(TCollision const& collision, TTrack const& track) + { + if (std::find(stored_trackIds.begin(), stored_trackIds.end(), std::pair{collision.globalIndex(), track.globalIndex()}) == stored_trackIds.end()) { + mDcaInfoCov.set(999, 999, 999, 999, 999); + auto trackParCov = getTrackParCov(track); + trackParCov.setPID(o2::track::PID::Electron); + mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); + mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + float dcaXY = mDcaInfoCov.getY(); + float dcaZ = mDcaInfoCov.getZ(); + + float pt_recalc = trackParCov.getPt(); + float eta_recalc = trackParCov.getEta(); + float phi_recalc = trackParCov.getPhi(); + o2::math_utils::bringTo02Pi(phi_recalc); + + bool isAssociatedToMPC = collision.globalIndex() == track.collisionId(); + float mcTunedTPCSignal = 0.f; + if constexpr (isMC) { + mcTunedTPCSignal = track.mcTunedTPCSignal(); + } + + emprimaryelectrons(collision.globalIndex(), track.globalIndex(), track.sign(), + pt_recalc, eta_recalc, phi_recalc, + dcaXY, dcaZ, trackParCov.getSigmaY2(), trackParCov.getSigmaZY(), trackParCov.getSigmaZ2(), + track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), track.tpcNClsShared(), + track.tpcChi2NCl(), track.tpcInnerParam(), + track.tpcSignal(), track.tpcNSigmaEl(), track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), + track.beta(), track.tofNSigmaEl(), /*track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(),*/ + track.itsClusterSizes(), + track.itsChi2NCl(), track.tofChi2(), track.detectorMap(), + // trackParCov.getTgl(), + isAssociatedToMPC, false, 1.f, mcTunedTPCSignal); + + emprimaryelectronscov( + trackParCov.getX(), + trackParCov.getAlpha(), + trackParCov.getY(), + trackParCov.getZ(), + trackParCov.getSnp(), + // trackParCov.getTgl(), + // trackParCov.getSigmaY2(), + // trackParCov.getSigmaZY(), + // trackParCov.getSigmaZ2(), + trackParCov.getSigmaSnpY(), + trackParCov.getSigmaSnpZ(), + trackParCov.getSigmaSnp2(), + trackParCov.getSigmaTglY(), + trackParCov.getSigmaTglZ(), + trackParCov.getSigmaTglSnp(), + trackParCov.getSigmaTgl2(), + trackParCov.getSigma1PtY(), + trackParCov.getSigma1PtZ(), + trackParCov.getSigma1PtSnp(), + trackParCov.getSigma1PtTgl(), + trackParCov.getSigma1Pt2()); + + stored_trackIds.emplace_back(std::pair{collision.globalIndex(), track.globalIndex()}); + + if (fillQAHistogram) { + int total_cluster_size = 0, nl = 0; + for (unsigned int layer = 0; layer < 7; layer++) { + int cluster_size_per_layer = track.itsClsSizeInLayer(layer); + if (cluster_size_per_layer > 0) { + nl++; + } + total_cluster_size += cluster_size_per_layer; + } + + int total_cluster_size_ib = 0, nl_ib = 0; + for (unsigned int layer = 0; layer < 3; layer++) { + int cluster_size_per_layer = track.itsClsSizeInLayer(layer); + if (cluster_size_per_layer > 0) { + nl_ib++; + } + total_cluster_size_ib += cluster_size_per_layer; + } + + int total_cluster_size_ob = 0, nl_ob = 0; + for (unsigned int layer = 3; layer < 7; layer++) { + int cluster_size_per_layer = track.itsClsSizeInLayer(layer); + if (cluster_size_per_layer > 0) { + nl_ob++; + } + total_cluster_size_ob += cluster_size_per_layer; + } + + fRegistry.fill(HIST("Track/hPt"), pt_recalc); + fRegistry.fill(HIST("Track/hQoverPt"), track.sign() / pt_recalc); + fRegistry.fill(HIST("Track/hEtaPhi"), phi_recalc, eta_recalc); + fRegistry.fill(HIST("Track/hDCAxyz"), dcaXY, dcaZ); + fRegistry.fill(HIST("Track/hDCAxyzSigma"), dcaXY / std::sqrt(trackParCov.getSigmaY2()), dcaZ / std::sqrt(trackParCov.getSigmaZ2())); + fRegistry.fill(HIST("Track/hDCAxyRes_Pt"), pt_recalc, std::sqrt(trackParCov.getSigmaY2()) * 1e+4); // convert cm to um + fRegistry.fill(HIST("Track/hDCAzRes_Pt"), pt_recalc, std::sqrt(trackParCov.getSigmaZ2()) * 1e+4); // convert cm to um + fRegistry.fill(HIST("Track/hNclsITS"), track.itsNCls()); + fRegistry.fill(HIST("Track/hNclsTPC"), track.tpcNClsFound()); + fRegistry.fill(HIST("Track/hNcrTPC"), track.tpcNClsCrossedRows()); + fRegistry.fill(HIST("Track/hTPCNcr2Nf"), track.tpcCrossedRowsOverFindableCls()); + fRegistry.fill(HIST("Track/hTPCNcls2Nf"), track.tpcFoundOverFindableCls()); + fRegistry.fill(HIST("Track/hTPCNclsShared"), track.pt(), track.tpcFractionSharedCls()); + fRegistry.fill(HIST("Track/hChi2TPC"), track.tpcChi2NCl()); + fRegistry.fill(HIST("Track/hChi2ITS"), track.itsChi2NCl()); + fRegistry.fill(HIST("Track/hChi2TOF"), track.tofChi2()); + fRegistry.fill(HIST("Track/hITSClusterMap"), track.itsClusterMap()); + fRegistry.fill(HIST("Track/hTPCdEdx"), track.tpcInnerParam(), track.tpcSignal()); + fRegistry.fill(HIST("Track/hTPCdEdxMC"), track.tpcInnerParam(), mcTunedTPCSignal); + fRegistry.fill(HIST("Track/hTPCNsigmaEl"), track.tpcInnerParam(), track.tpcNSigmaEl()); + fRegistry.fill(HIST("Track/hTPCNsigmaPi"), track.tpcInnerParam(), track.tpcNSigmaPi()); + fRegistry.fill(HIST("Track/hTPCNsigmaKa"), track.tpcInnerParam(), track.tpcNSigmaKa()); + fRegistry.fill(HIST("Track/hTPCNsigmaPr"), track.tpcInnerParam(), track.tpcNSigmaPr()); + fRegistry.fill(HIST("Track/hTOFbeta"), trackParCov.getP(), track.beta()); + fRegistry.fill(HIST("Track/hTOFNsigmaEl"), track.tpcInnerParam(), track.tofNSigmaEl()); + fRegistry.fill(HIST("Track/hTOFNsigmaPi"), track.tpcInnerParam(), track.tofNSigmaPi()); + fRegistry.fill(HIST("Track/hTOFNsigmaKa"), track.tpcInnerParam(), track.tofNSigmaKa()); + fRegistry.fill(HIST("Track/hTOFNsigmaPr"), track.tpcInnerParam(), track.tofNSigmaPr()); + fRegistry.fill(HIST("Track/hMeanClusterSizeITS"), trackParCov.getP(), static_cast(total_cluster_size) / static_cast(nl) * std::cos(std::atan(trackParCov.getTgl()))); + fRegistry.fill(HIST("Track/hMeanClusterSizeITSib"), trackParCov.getP(), static_cast(total_cluster_size_ib) / static_cast(nl_ib) * std::cos(std::atan(trackParCov.getTgl()))); + fRegistry.fill(HIST("Track/hMeanClusterSizeITSob"), trackParCov.getP(), static_cast(total_cluster_size_ob) / static_cast(nl_ob) * std::cos(std::atan(trackParCov.getTgl()))); + } + } + } + + template + bool isDielectronFromPi0(TCollision const& collision, TTrack const& t1, TTrack const& t2) + { + mDcaInfoCov.set(999, 999, 999, 999, 999); + std::array pVec1 = {0, 0, 0}; // px, py, pz + std::array pVec2 = {0, 0, 0}; // px, py, pz + mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); + mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); + + auto t1ParCov = getTrackParCov(t1); + t1ParCov.setPID(o2::track::PID::Electron); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, t1ParCov, 2.f, matCorr, &mDcaInfoCov); + getPxPyPz(t1ParCov, pVec1); + + auto t2ParCov = getTrackParCov(t2); + t2ParCov.setPID(o2::track::PID::Electron); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, t2ParCov, 2.f, matCorr, &mDcaInfoCov); + getPxPyPz(t2ParCov, pVec2); + + ROOT::Math::PtEtaPhiMVector v1(t1ParCov.getPt(), t1ParCov.getEta(), t1ParCov.getPhi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v2(t2ParCov.getPt(), t2ParCov.getEta(), t2ParCov.getPhi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + float mee = v12.M(); + float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pVec1[0], pVec1[1], pVec1[2], pVec2[0], pVec2[1], pVec2[2], t1.sign(), t2.sign(), d_bz); + + if (fillQAHistogram) { + fRegistry.fill(HIST("Pair/hMvsPhiV"), phiv, mee); + } + if (mee < maxMee && phiv < maxPhiV) { + return true; + } else { + return false; + } + } + + std::vector> stored_trackIds; + Filter trackFilter = trackcut.minpt < o2::aod::track::pt && nabs(o2::aod::track::eta) < trackcut.maxeta && o2::aod::track::itsChi2NCl < trackcut.maxchi2its && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true; + Filter pidFilter = trackcut.minTPCNsigmaEl < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < trackcut.maxTPCNsigmaEl; + using MyFilteredTracks = soa::Filtered; + + Partition posTracks = o2::aod::track::signed1Pt > 0.f; + Partition negTracks = o2::aod::track::signed1Pt < 0.f; + + // ---------- for data ---------- + + void processRec(MyCollisions const& collisions, aod::BCsWithTimestamps const&, MyFilteredTracks const& tracks) + { + stored_trackIds.reserve(tracks.size()); + + for (const auto& collision : collisions) { + auto bc = collision.template foundBC_as(); + initCCDB(bc); + + if (!collision.isSelected()) { + continue; + } + + const auto& posTracks_per_coll = posTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); + const auto& negTracks_per_coll = negTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); + + for (const auto& [pos, ele] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { + if ((checkTrackTight(collision, pos) && isElectronTight(pos)) && (checkTrack(collision, ele) && isElectron(ele))) { + if (isDielectronFromPi0(collision, pos, ele)) { + fillTrackTable(collision, ele); + } + } + if ((checkTrackTight(collision, ele) && isElectronTight(ele)) && (checkTrack(collision, pos) && isElectron(pos))) { + if (isDielectronFromPi0(collision, pos, ele)) { + fillTrackTable(collision, pos); + } + } + + // if (isDielectronFromPi0(collision, pos, ele)) { + // if ((checkTrackTight(collision, pos) && isElectronTight(pos)) && (checkTrack(collision, ele) && isElectron(ele)) ) { + // fillTrackTable(collision, ele); + // } + // if ((checkTrackTight(collision, ele) && isElectronTight(ele)) && (checkTrack(collision, pos) && isElectron(pos)) ) { + // fillTrackTable(collision, pos); + // } + // } + + } // end of ULS pairing + } // end of collision loop + + stored_trackIds.clear(); + stored_trackIds.shrink_to_fit(); + } + PROCESS_SWITCH(skimmerPrimaryElectronQC, processRec, "process reconstructed info only", true); // standalone + + void processRec_SWT(MyCollisionsWithSWT const& collisions, aod::BCsWithTimestamps const&, MyFilteredTracks const& tracks) + { + stored_trackIds.reserve(tracks.size()); + + for (const auto& collision : collisions) { + auto bc = collision.template foundBC_as(); + initCCDB(bc); + + if (!collision.isSelected()) { + continue; + } + + if (collision.swtaliastmp_raw() == 0) { + continue; + } + + const auto& posTracks_per_coll = posTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); + const auto& negTracks_per_coll = negTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); + + for (const auto& [pos, ele] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { + if ((checkTrackTight(collision, pos) && isElectronTight(pos)) && (checkTrack(collision, ele) && isElectron(ele))) { + if (isDielectronFromPi0(collision, pos, ele)) { + fillTrackTable(collision, ele); + } + } + if ((checkTrackTight(collision, ele) && isElectronTight(ele)) && (checkTrack(collision, pos) && isElectron(pos))) { + if (isDielectronFromPi0(collision, pos, ele)) { + fillTrackTable(collision, pos); + } + } + + // if (isDielectronFromPi0(collision, pos, ele)) { + // if ((checkTrackTight(collision, pos) && isElectronTight(pos)) && (checkTrack(collision, ele) && isElectron(ele)) ) { + // fillTrackTable(collision, ele); + // } + // if ((checkTrackTight(collision, ele) && isElectronTight(ele)) && (checkTrack(collision, pos) && isElectron(pos)) ) { + // fillTrackTable(collision, pos); + // } + // } + + } // end of ULS pairing + + } // end of collision loop + + stored_trackIds.clear(); + stored_trackIds.shrink_to_fit(); + } + PROCESS_SWITCH(skimmerPrimaryElectronQC, processRec_SWT, "process reconstructed info only", false); // standalone with swt + + // ---------- for MC ---------- + using MyFilteredTracksMC = soa::Filtered; + Partition posTracksMC = o2::aod::track::signed1Pt > 0.f; + Partition negTracksMC = o2::aod::track::signed1Pt < 0.f; + void processMC(soa::Join const& collisions, aod::McCollisions const&, aod::BCsWithTimestamps const&, MyFilteredTracksMC const& tracks, aod::McParticles const&) + { + stored_trackIds.reserve(tracks.size()); + + for (const auto& collision : collisions) { + if (!collision.has_mcCollision()) { + continue; + } + auto bc = collision.template foundBC_as(); + initCCDB(bc); + + if (!collision.isSelected()) { + continue; + } + const auto& posTracks_per_coll = posTracksMC->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); + const auto& negTracks_per_coll = negTracksMC->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); + + for (const auto& [pos, ele] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { + if ((checkTrackTight(collision, pos) && isElectronTight(pos)) && (checkTrack(collision, ele) && isElectron(ele))) { + if (isDielectronFromPi0(collision, pos, ele)) { + fillTrackTable(collision, ele); + } + } + if ((checkTrackTight(collision, ele) && isElectronTight(ele)) && (checkTrack(collision, pos) && isElectron(pos))) { + if (isDielectronFromPi0(collision, pos, ele)) { + fillTrackTable(collision, pos); + } + } + + // if (isDielectronFromPi0(collision, pos, ele)) { + // if ((checkTrackTight(collision, pos) && isElectronTight(pos)) && (checkTrack(collision, ele) && isElectron(ele)) ) { + // fillTrackTable(collision, ele); + // } + // if ((checkTrackTight(collision, ele) && isElectronTight(ele)) && (checkTrack(collision, pos) && isElectron(pos)) ) { + // fillTrackTable(collision, pos); + // } + // } + + } // end of ULS pairing + + } // end of collision loop + + stored_trackIds.clear(); + stored_trackIds.shrink_to_fit(); + } + PROCESS_SWITCH(skimmerPrimaryElectronQC, processMC, "process reconstructed and MC info ", false); +}; + +struct prefilterPrimaryElectron { + Produces ele_pfb; + + void init(InitContext&) {} + + void process(aod::EMPrimaryElectrons const& primaryelectrons) + { + for (int i = 0; i < primaryelectrons.size(); i++) { + ele_pfb(0); + } + } +}; + +struct associateAmbiguousElectron { + Produces em_amb_ele_ids; + + SliceCache cache; + PresliceUnsorted perTrack = o2::aod::emprimaryelectron::trackId; + std::vector ambele_self_Ids; + + void process(aod::EMPrimaryElectrons const& electrons) + { + for (const auto& electron : electrons) { + auto electrons_with_same_trackId = electrons.sliceBy(perTrack, electron.trackId()); + ambele_self_Ids.reserve(electrons_with_same_trackId.size()); + for (const auto& amb_ele : electrons_with_same_trackId) { + if (amb_ele.globalIndex() == electron.globalIndex()) { // don't store myself. + continue; + } + ambele_self_Ids.emplace_back(amb_ele.globalIndex()); + } + em_amb_ele_ids(ambele_self_Ids); + ambele_self_Ids.clear(); + ambele_self_Ids.shrink_to_fit(); + } + } +}; +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc, TaskName{"skimmer-primary-electron-qc"}), + adaptAnalysisTask(cfgc, TaskName{"prefilter-primary-electron"}), + adaptAnalysisTask(cfgc, TaskName{"associate-ambiguous-electron"})}; +} From fb76e471d0b0e88b5ee474ba320c7fd2bee1ff1d Mon Sep 17 00:00:00 2001 From: Shirajum Monira <38348689+Eloviyo@users.noreply.github.com> Date: Fri, 15 Aug 2025 20:05:51 +0200 Subject: [PATCH 070/986] [PWGCF] FemtoUniverse cascade task -- CPR check optimization (#12590) Co-authored-by: Shirajum Monira --- .../femtoUniversePairTaskTrackCascadeExtended.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx index 00c2947bc81..477c43d44ec 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx @@ -141,7 +141,8 @@ struct femtoUniversePairTaskTrackCascadeExtended { FemtoUniverseContainer mixedEventCont; FemtoUniversePairCleaner pairCleaner; FemtoUniversePairCleaner pairCleanerCasc; - FemtoUniverseDetaDphiStar pairCloseRejection; + FemtoUniverseDetaDphiStar pairCloseRejection; + FemtoUniverseDetaDphiStar pairCloseRejectionCasc; HistogramRegistry rXiQA{"xi", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry qaRegistry{"TrackQA", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -308,7 +309,10 @@ struct femtoUniversePairTaskTrackCascadeExtended { pairCleaner.init(&qaRegistry); pairCleanerCasc.init(&qaRegistry); if (confIsCPR.value) { - pairCloseRejection.init(&resultRegistry, &qaRegistry, confCPRdeltaPhiCutMin.value, confCPRdeltaPhiCutMax.value, confCPRdeltaEtaCutMin.value, confCPRdeltaEtaCutMax.value, confCPRChosenRadii.value, confCPRPlotPerRadii.value, 0, 0, confIsSameSignCPR.value); + if (doprocessSameEvent || doprocessSameEventBitmask || doprocessMixedEvent || doprocessMixedEventBitmask) + pairCloseRejection.init(&resultRegistry, &qaRegistry, confCPRdeltaPhiCutMin.value, confCPRdeltaPhiCutMax.value, confCPRdeltaEtaCutMin.value, confCPRdeltaEtaCutMax.value, confCPRChosenRadii.value, confCPRPlotPerRadii.value, 0, 0, confIsSameSignCPR.value); + if (doprocessSameEventCasc || doprocessSameEventCascBitmask || doprocessMixedEventCasc || doprocessMixedEventCascBitmask) + pairCloseRejectionCasc.init(&resultRegistry, &qaRegistry, confCPRdeltaPhiCutMin.value, confCPRdeltaPhiCutMax.value, confCPRdeltaEtaCutMin.value, confCPRdeltaEtaCutMax.value, confCPRChosenRadii.value, confCPRPlotPerRadii.value, 0, 0, confIsSameSignCPR.value); } } @@ -565,7 +569,7 @@ struct femtoUniversePairTaskTrackCascadeExtended { if (!invMCascade(p2.mLambda(), p2.mAntiLambda(), confCascType2)) return; if (confIsCPR.value) { - if (pairCloseRejection.isClosePair(p1, p2, parts, magFieldTesla, femto_universe_container::EventType::same)) { + if (pairCloseRejectionCasc.isClosePair(p1, p2, parts, magFieldTesla, femto_universe_container::EventType::same)) { return; } } @@ -785,7 +789,7 @@ struct femtoUniversePairTaskTrackCascadeExtended { continue; } if (confIsCPR.value) { - if (pairCloseRejection.isClosePair(p1, p2, parts, magFieldTesla1, femto_universe_container::EventType::mixed)) { + if (pairCloseRejectionCasc.isClosePair(p1, p2, parts, magFieldTesla1, femto_universe_container::EventType::mixed)) { continue; } } From 37fceb98fcab693758b96e7c61079c74cc3a4899 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Fri, 15 Aug 2025 20:56:07 +0200 Subject: [PATCH 071/986] [Common] Fix bugs, bad practice, performance, includes (#11688) --- Common/CCDB/TriggerAliases.h | 5 +- Common/CCDB/ctpRateFetcher.cxx | 15 +- Common/CCDB/ctpRateFetcher.h | 6 +- Common/Core/CollisionAssociation.h | 50 +++--- Common/Core/CollisionTypeHelper.cxx | 5 +- Common/Core/EventPlaneHelper.cxx | 21 +-- Common/Core/FFitWeights.cxx | 8 +- Common/Core/FFitWeights.h | 30 ++-- Common/Core/MetadataHelper.cxx | 6 +- Common/Core/OrbitRange.h | 11 +- Common/Core/PID/DetectorResponse.h | 28 ++-- Common/Core/PID/PIDTOF.h | 27 +-- Common/Core/PID/ParamBase.cxx | 15 +- Common/Core/PID/ParamBase.h | 26 +-- Common/Core/TableHelper.cxx | 8 +- Common/Core/TableHelper.h | 8 +- Common/Core/TrackSelection.cxx | 9 +- Common/Core/TrackSelection.h | 12 +- Common/Core/trackUtilities.h | 18 +- Common/TableProducer/PID/pidBayes.cxx | 53 +++--- Common/TableProducer/PID/pidTOFBase.cxx | 36 ++-- Common/TableProducer/PID/pidTOFMerge.cxx | 26 +-- Common/TableProducer/PID/pidTPC.cxx | 28 ++-- Common/TableProducer/caloClusterProducer.cxx | 117 +++++++------ Common/TableProducer/centralityTable.cxx | 39 +++-- Common/TableProducer/eventSelection.cxx | 75 ++++++--- Common/TableProducer/multiplicityTable.cxx | 49 +++--- Common/TableProducer/qVectorsTable.cxx | 45 +++-- Common/TableProducer/trackselection.cxx | 16 +- Common/Tasks/checkDataModelMC.cxx | 13 +- Common/Tasks/evtPlanesResolution.cxx | 156 ------------------ Common/Tasks/propagatorQa.cxx | 76 ++++----- Common/Tasks/trackqa.cxx | 26 ++- Common/Tools/EventSelectionTools.h | 60 ++++--- Common/Tools/MultModule.h | 38 +++-- Common/Tools/Multiplicity/multCalibrator.cxx | 77 ++++----- Common/Tools/Multiplicity/multCalibrator.h | 46 +++--- .../Multiplicity/multGlauberNBDFitter.cxx | 75 +++++---- .../Tools/Multiplicity/multGlauberNBDFitter.h | 69 ++++---- .../Tools/Multiplicity/multMCCalibrator.cxx | 40 +++-- Common/Tools/Multiplicity/multMCCalibrator.h | 27 +-- Common/Tools/PID/handleParamBase.h | 17 +- Common/Tools/TrackPropagationModule.h | 27 ++- Common/Tools/TrackTuner.h | 55 +++--- Common/Tools/trackSelectionRequest.h | 16 +- 45 files changed, 777 insertions(+), 833 deletions(-) delete mode 100644 Common/Tasks/evtPlanesResolution.cxx diff --git a/Common/CCDB/TriggerAliases.h b/Common/CCDB/TriggerAliases.h index f1baf04fdcc..3ee5c3ba87c 100644 --- a/Common/CCDB/TriggerAliases.h +++ b/Common/CCDB/TriggerAliases.h @@ -12,10 +12,11 @@ #ifndef COMMON_CCDB_TRIGGERALIASES_H_ #define COMMON_CCDB_TRIGGERALIASES_H_ +#include + #include #include #include -#include enum triggerAliases { kINT7 = 0, @@ -57,7 +58,7 @@ class TriggerAliases TriggerAliases() = default; ~TriggerAliases() = default; - void AddAlias(uint32_t aliasId, std::string classNames) { mAliasToClassNames[aliasId] = classNames; } + void AddAlias(uint32_t aliasId, std::string const& classNames) { mAliasToClassNames[aliasId] = classNames; } void AddClassIdToAlias(uint32_t aliasId, int classId); const std::map& GetAliasToClassNamesMap() const { return mAliasToClassNames; } const std::map& GetAliasToTriggerMaskMap() const { return mAliasToTriggerMask; } diff --git a/Common/CCDB/ctpRateFetcher.cxx b/Common/CCDB/ctpRateFetcher.cxx index 6940fd1e921..4dbec5d8c0c 100644 --- a/Common/CCDB/ctpRateFetcher.cxx +++ b/Common/CCDB/ctpRateFetcher.cxx @@ -11,18 +11,19 @@ #include "ctpRateFetcher.h" +#include +#include +#include +#include +#include + #include +#include #include -#include "CommonConstants/LHCConstants.h" -#include "DataFormatsCTP/Configuration.h" -#include "DataFormatsCTP/Scalers.h" -#include "DataFormatsParameters/GRPLHCIFData.h" -#include "CCDB/BasicCCDBManager.h" - namespace o2 { -double ctpRateFetcher::fetch(o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp, int runNumber, std::string sourceName, bool fCrashOnNull) +double ctpRateFetcher::fetch(o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp, int runNumber, const std::string& sourceName, bool fCrashOnNull) { setupRun(runNumber, ccdb, timeStamp); if (sourceName.find("ZNC") != std::string::npos) { diff --git a/Common/CCDB/ctpRateFetcher.h b/Common/CCDB/ctpRateFetcher.h index 6aaf5e3ebaa..9d4de6215d3 100644 --- a/Common/CCDB/ctpRateFetcher.h +++ b/Common/CCDB/ctpRateFetcher.h @@ -12,9 +12,9 @@ #ifndef COMMON_CCDB_CTPRATEFETCHER_H_ #define COMMON_CCDB_CTPRATEFETCHER_H_ -#include +#include -#include "CCDB/BasicCCDBManager.h" +#include namespace o2 { @@ -34,7 +34,7 @@ class ctpRateFetcher { public: ctpRateFetcher() = default; - double fetch(o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp, int runNumber, std::string sourceName, bool fCrashOnNull = true); + double fetch(o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp, int runNumber, const std::string& sourceName, bool fCrashOnNull = true); void setManualCleanup(bool manualCleanup = true) { mManualCleanup = manualCleanup; } diff --git a/Common/Core/CollisionAssociation.h b/Common/Core/CollisionAssociation.h index 69ec38a24db..e6b7f9f8cc5 100644 --- a/Common/Core/CollisionAssociation.h +++ b/Common/Core/CollisionAssociation.h @@ -20,13 +20,13 @@ #ifndef COMMON_CORE_COLLISIONASSOCIATION_H_ #define COMMON_CORE_COLLISIONASSOCIATION_H_ -#include +#include +#include +#include + #include #include - -#include "CommonConstants/LHCConstants.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" +#include namespace o2::aod { @@ -191,30 +191,30 @@ class CollisionAssociation for (auto& iterationWindow : trackIterationWindows) { bool iteratorMoved = false; const bool isAssignedTrackWindow = (iterationWindow.first != iterationWindow.second) ? iterationWindow.first.has_collision() : false; - for (auto track = iterationWindow.first; track != iterationWindow.second; ++track) { - int64_t trackBC = globalBC[track.filteredIndex()]; + for (auto trackInWindow = iterationWindow.first; trackInWindow != iterationWindow.second; ++trackInWindow) { + int64_t trackBC = globalBC[trackInWindow.filteredIndex()]; if (trackBC < 0) { continue; } // Optimization to avoid looping over the full track list each time. This builds on that tracks are sorted by BCs (which they should be because collisions are sorted by BCs) - const int64_t bcOffset = trackBC - (int64_t)collBC; + const int64_t bcOffset = trackBC - static_cast(collBC); if constexpr (isCentralBarrel) { // only for blocks with collision association if (isAssignedTrackWindow) { constexpr int margin = 200; if (!iteratorMoved && bcOffset > -bcOffsetMax - margin) { - iterationWindow.first.setCursor(track.filteredIndex()); + iterationWindow.first.setCursor(trackInWindow.filteredIndex()); iteratorMoved = true; - LOGP(debug, "Moving iterator begin {}", track.filteredIndex()); + LOGP(debug, "Moving iterator begin {}", trackInWindow.filteredIndex()); } else if (bcOffset > bcOffsetMax + margin) { - LOGP(debug, "Stopping iterator {}", track.filteredIndex()); + LOGP(debug, "Stopping iterator {}", trackInWindow.filteredIndex()); break; } } } - int64_t bcOffsetWindow = trackBCCache[track.filteredIndex()] - (int64_t)collBC; + int64_t bcOffsetWindow = trackBCCache[trackInWindow.filteredIndex()] - static_cast(collBC); if (std::abs(bcOffsetWindow) > bcOffsetMax) { continue; } @@ -222,27 +222,27 @@ class CollisionAssociation float trackTime = 0; float trackTimeRes = 0; if constexpr (isCentralBarrel) { - if (mUsePvAssociation && track.isPVContributor()) { - trackTime = track.collision().collisionTime(); // if PV contributor, we assume the time to be the one of the collision - trackTimeRes = o2::constants::lhc::LHCBunchSpacingNS; // 1 BC + if (mUsePvAssociation && trackInWindow.isPVContributor()) { + trackTime = trackInWindow.collision().collisionTime(); // if PV contributor, we assume the time to be the one of the collision + trackTimeRes = o2::constants::lhc::LHCBunchSpacingNS; // 1 BC } else { - trackTime = track.trackTime(); - trackTimeRes = track.trackTimeRes(); + trackTime = trackInWindow.trackTime(); + trackTimeRes = trackInWindow.trackTimeRes(); } } else { - trackTime = track.trackTime(); - trackTimeRes = track.trackTimeRes(); + trackTime = trackInWindow.trackTime(); + trackTimeRes = trackInWindow.trackTimeRes(); } const float deltaTime = trackTime - collTime + bcOffset * o2::constants::lhc::LHCBunchSpacingNS; float sigmaTimeRes2 = collTimeRes2 + trackTimeRes * trackTimeRes; - LOGP(debug, "collision time={}, collision time res={}, track time={}, track time res={}, bc collision={}, bc track={}, delta time={}", collTime, collision.collisionTimeRes(), track.trackTime(), track.trackTimeRes(), collBC, trackBC, deltaTime); + LOGP(debug, "collision time={}, collision time res={}, track time={}, track time res={}, bc collision={}, bc track={}, delta time={}", collTime, collision.collisionTimeRes(), trackInWindow.trackTime(), trackInWindow.trackTimeRes(), collBC, trackBC, deltaTime); float thresholdTime = 0.; if constexpr (isCentralBarrel) { - if (mUsePvAssociation && track.isPVContributor()) { + if (mUsePvAssociation && trackInWindow.isPVContributor()) { thresholdTime = trackTimeRes; - } else if (TESTBIT(track.flags(), o2::aod::track::TrackTimeResIsRange)) { + } else if (TESTBIT(trackInWindow.flags(), o2::aod::track::TrackTimeResIsRange)) { // the track time resolution is a range, not a gaussian resolution thresholdTime = trackTimeRes + mNumSigmaForTimeCompat * std::sqrt(collTimeRes2) + mTimeMargin; } else { @@ -262,7 +262,7 @@ class CollisionAssociation if (std::abs(deltaTime) < thresholdTime) { const auto collIdx = collision.globalIndex(); - const auto trackIdx = track.globalIndex(); + const auto trackIdx = trackInWindow.globalIndex(); LOGP(debug, "Filling track id {} for coll id {}", trackIdx, collIdx); association(collIdx, trackIdx); if (mFillTableOfCollIdsPerTrack) { @@ -278,9 +278,9 @@ class CollisionAssociation // create reverse index track to collisions if enabled if (mFillTableOfCollIdsPerTrack) { std::vector empty{}; - for (const auto& track : tracksUnfiltered) { + for (const auto& trackUnfiltered : tracksUnfiltered) { - const auto trackId = track.globalIndex(); + const auto trackId = trackUnfiltered.globalIndex(); if (collsPerTrack[trackId] == nullptr) { reverseIndices(empty); } else { diff --git a/Common/Core/CollisionTypeHelper.cxx b/Common/Core/CollisionTypeHelper.cxx index 4d7e1de3f87..10e23f19423 100644 --- a/Common/Core/CollisionTypeHelper.cxx +++ b/Common/Core/CollisionTypeHelper.cxx @@ -17,9 +17,8 @@ #include "Common/Core/CollisionTypeHelper.h" -#include "DataFormatsParameters/GRPLHCIFData.h" - -#include +#include +#include #include diff --git a/Common/Core/EventPlaneHelper.cxx b/Common/Core/EventPlaneHelper.cxx index 75424d900d9..8c8cb88c896 100644 --- a/Common/Core/EventPlaneHelper.cxx +++ b/Common/Core/EventPlaneHelper.cxx @@ -20,13 +20,14 @@ #include "Common/Core/EventPlaneHelper.h" +#include +#include + #include +#include #include -#include #include - -#include "TMath.h" -#include "TVector3.h" +#include double EventPlaneHelper::GetPhiFV0(int chno, o2::fv0::Geometry* fv0geom) { @@ -37,8 +38,8 @@ double EventPlaneHelper::GetPhiFV0(int chno, o2::fv0::Geometry* fv0geom) float offsetX = 0.; float offsetY = 0.; - int cellsInLeft[] = {0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27, - 32, 40, 33, 41, 34, 42, 35, 43}; + const int cellsInLeft[] = {0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27, + 32, 40, 33, 41, 34, 42, 35, 43}; bool isChnoInLeft = std::find(std::begin(cellsInLeft), std::end(cellsInLeft), chno) != std::end(cellsInLeft); if (isChnoInLeft) { @@ -131,10 +132,10 @@ void EventPlaneHelper::DoCorrections(float& qx, float& qy, qy = (qy - corrections[2] * qx) / (1.0 - corrections[3] * corrections[2]); // Rescaling of the Qx-Qy into a circle. - if (fabs(corrections[4]) > 1e-8) { + if (std::fabs(corrections[4]) > 1e-8) { qx /= corrections[4]; } - if (fabs(corrections[5]) > 1e-8) { + if (std::fabs(corrections[5]) > 1e-8) { qy /= corrections[5]; } } @@ -153,9 +154,9 @@ void EventPlaneHelper::DoTwist(float& qx, float& qy, float lp, float lm) void EventPlaneHelper::DoRescale(float& qx, float& qy, float ap, float am) { - if (fabs(ap) > 1e-8) + if (std::fabs(ap) > 1e-8) qx /= ap; - if (fabs(am) > 1e-8) + if (std::fabs(am) > 1e-8) qy /= am; } diff --git a/Common/Core/FFitWeights.cxx b/Common/Core/FFitWeights.cxx index 3a92114f48c..4133d6453eb 100644 --- a/Common/Core/FFitWeights.cxx +++ b/Common/Core/FFitWeights.cxx @@ -16,12 +16,12 @@ #include "FFitWeights.h" -#include +#include + #include +#include #include -#include - ClassImp(FFitWeights) FFitWeights::FFitWeights() : TNamed("", ""), @@ -111,7 +111,7 @@ void FFitWeights::addArray(TObjArray* targ, TObjArray* sour) } }; -void FFitWeights::qSelection(std::vector nhv, std::vector stv) /* only execute OFFLINE */ +void FFitWeights::qSelection(const std::vector& nhv, const std::vector& stv) /* only execute OFFLINE */ { TObjArray* tar{nullptr}; diff --git a/Common/Core/FFitWeights.h b/Common/Core/FFitWeights.h index c80165730f7..68470f95b55 100644 --- a/Common/Core/FFitWeights.h +++ b/Common/Core/FFitWeights.h @@ -17,22 +17,22 @@ #ifndef COMMON_CORE_FFITWEIGHTS_H_ #define COMMON_CORE_FFITWEIGHTS_H_ -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include #include #include - -#include "TNamed.h" -#include "TObjArray.h" -#include "TH3D.h" -#include "TH2D.h" -#include "TH1D.h" -#include "TFile.h" -#include "TCollection.h" -#include "TString.h" -#include "TMath.h" +#include +#include +#include class FFitWeights : public TNamed { @@ -53,11 +53,11 @@ class FFitWeights : public TNamed TAxis* getqVecAx() { return qAxis; } Long64_t Merge(TCollection* collist); - void qSelection(std::vector nhv, std::vector stv); + void qSelection(const std::vector& nhv, const std::vector& stv); float eval(float centr, const float& dqn, const int nh, const char* pf = ""); void setResolution(int res) { nResolution = res; } int getResolution() const { return nResolution; } - void setQnType(std::vector> qninp) { qnTYPE = qninp; } + void setQnType(const std::vector>& qninp) { qnTYPE = qninp; } private: TObjArray* fW_data; diff --git a/Common/Core/MetadataHelper.cxx b/Common/Core/MetadataHelper.cxx index b8c2fe6ad22..91037d615d0 100644 --- a/Common/Core/MetadataHelper.cxx +++ b/Common/Core/MetadataHelper.cxx @@ -17,8 +17,10 @@ #include "Common/Core/MetadataHelper.h" -#include "Framework/InitContext.h" -#include "Framework/RunningWorkflowInfo.h" +#include +#include + +#include using namespace o2::common::core; diff --git a/Common/Core/OrbitRange.h b/Common/Core/OrbitRange.h index 65e3abe2c69..f499b771e9b 100644 --- a/Common/Core/OrbitRange.h +++ b/Common/Core/OrbitRange.h @@ -13,16 +13,17 @@ // Container to store minimum and maximum orbit counter // -#ifndef OrbitRange_H -#define OrbitRange_H +#ifndef COMMON_CORE_ORBITRANGE_H_ +#define COMMON_CORE_ORBITRANGE_H_ + +#include -#include "TNamed.h" class TCollection; class OrbitRange : public TNamed { public: - OrbitRange(const char* name = "orbitRange") : TNamed(name, name), fRunNumber(0), fMinOrbit(0xFFFFFFFF), fMaxOrbit(0) {} + explicit OrbitRange(const char* name = "orbitRange") : TNamed(name, name), fRunNumber(0), fMinOrbit(0xFFFFFFFF), fMaxOrbit(0) {} ~OrbitRange() {} void SetRunNumber(uint32_t runNumber) { fRunNumber = runNumber; } void SetMinOrbit(uint32_t orbit) { fMinOrbit = orbit; } @@ -39,4 +40,4 @@ class OrbitRange : public TNamed ClassDef(OrbitRange, 1) }; -#endif +#endif // COMMON_CORE_ORBITRANGE_H_ diff --git a/Common/Core/PID/DetectorResponse.h b/Common/Core/PID/DetectorResponse.h index 1f687a4605c..7b8c5bb2406 100644 --- a/Common/Core/PID/DetectorResponse.h +++ b/Common/Core/PID/DetectorResponse.h @@ -17,21 +17,25 @@ /// This provides the basic quantities computed by any response i.e. expected values, resolutions and Nsigmas /// -#ifndef O2_ANALYSIS_PID_DETECTORRESPONSE_H_ -#define O2_ANALYSIS_PID_DETECTORRESPONSE_H_ +#ifndef COMMON_CORE_PID_DETECTORRESPONSE_H_ +#define COMMON_CORE_PID_DETECTORRESPONSE_H_ + +#include #include +#include #include -#include "Framework/Logger.h" // ROOT includes -#include "Rtypes.h" -#include "TMath.h" -#include "TFile.h" +#include +#include + +#include // O2 includes -#include "ReconstructionDataFormats/PID.h" #include "Common/Core/PID/ParamBase.h" +#include + namespace o2::pid { /// \brief Class to handle the general detector response @@ -52,7 +56,7 @@ class DetectorResponse /// \param fname File name used for input /// \param pname Name of the parametrization in the file /// \param ptype Type of the parametrization - void LoadParamFromFile(const TString fname, const TString pname, const Param_t ptype); + void LoadParamFromFile(const TString& fname, const TString& pname, const Param_t ptype); /// Setter for the parametrization /// \param ptype Type of the parametrization @@ -65,7 +69,7 @@ class DetectorResponse /// Setter for the parametrizations parameters, if the parametrization is not yet initialized a new parametrization is created without any implementation and just parameters /// \param ptype parametrization type /// \param p vector with parameters - void SetParameters(const Param_t ptype, std::vector p); + void SetParameters(const Param_t ptype, const std::vector& p); /// Getter for the value of the parametrization /// \param ptype parametrization type @@ -85,7 +89,7 @@ inline void DetectorResponse::LoadParam(const Param_t ptype, Parametrization* pa mParam[ptype] = param; } -inline void DetectorResponse::LoadParamFromFile(const TString fname, const TString pname, const Param_t ptype) +inline void DetectorResponse::LoadParamFromFile(const TString& fname, const TString& pname, const Param_t ptype) { TFile f(fname, "READ"); if (!f.Get(pname)) { @@ -97,7 +101,7 @@ inline void DetectorResponse::LoadParamFromFile(const TString fname, const TStri mParam[ptype]->Print(); } -inline void DetectorResponse::SetParameters(const DetectorResponse::Param_t ptype, std::vector p) +inline void DetectorResponse::SetParameters(const DetectorResponse::Param_t ptype, const std::vector& p) { if (!mParam[ptype]) { const std::string pname = std::string(ParamName[ptype]) + "_default_param"; @@ -110,4 +114,4 @@ inline void DetectorResponse::SetParameters(const DetectorResponse::Param_t ptyp } // namespace o2::pid -#endif // O2_ANALYSIS_PID_DETECTORRESPONSE_H_ +#endif // COMMON_CORE_PID_DETECTORRESPONSE_H_ diff --git a/Common/Core/PID/PIDTOF.h b/Common/Core/PID/PIDTOF.h index ad16716916c..5822732dc5c 100644 --- a/Common/Core/PID/PIDTOF.h +++ b/Common/Core/PID/PIDTOF.h @@ -24,18 +24,19 @@ #include // ROOT includes -#include "Rtypes.h" -#include "TMath.h" -#include "TGraph.h" -#include "TFile.h" -#include "TF2.h" +#include +#include +#include +#include + +#include // O2 includes -#include "DataFormatsTOF/ParameterContainers.h" -#include "Framework/Logger.h" -#include "ReconstructionDataFormats/PID.h" -#include "Framework/DataTypes.h" -#include "CommonConstants/PhysicsConstants.h" +#include +#include +#include +#include +#include namespace o2::pid::tof { @@ -444,7 +445,7 @@ class ExpTimes static constexpr float mMassZSqared = mMassZ * mMassZ; /// (M/z)^2 /// Computes the expected time of a track, given it TOF expected momentum - static float ComputeExpectedTime(const float tofExpMom, const float length) { return length * sqrt((mMassZSqared) + (tofExpMom * tofExpMom)) / (o2::constants::physics::LightSpeedCm2PS * tofExpMom); } + static float ComputeExpectedTime(const float tofExpMom, const float length) { return length * std::sqrt((mMassZSqared) + (tofExpMom * tofExpMom)) / (o2::constants::physics::LightSpeedCm2PS * tofExpMom); } /// Gets the expected signal of the track of interest under the PID assumption /// \param track Track of interest @@ -485,11 +486,11 @@ class ExpTimes static float GetExpectedSigma(const ParamType& parameters, const TrackType& track, const float tofSignal, const float collisionTimeRes) { const float& mom = track.p(); - const float& eta = track.eta(); + const float& etaTrack = track.eta(); if (mom <= 0) { return -999.f; } - const float reso = parameters.template getResolution(mom, eta); + const float reso = parameters.template getResolution(mom, etaTrack); if (reso > 0) { return std::sqrt(reso * reso + parameters[4] * parameters[4] + collisionTimeRes * collisionTimeRes); } diff --git a/Common/Core/PID/ParamBase.cxx b/Common/Core/PID/ParamBase.cxx index 74824781d07..a79ed660b7d 100644 --- a/Common/Core/PID/ParamBase.cxx +++ b/Common/Core/PID/ParamBase.cxx @@ -17,14 +17,17 @@ /// These are the basic storage elements to be kept in the CCDB /// -#include "PID/ParamBase.h" -#include "Framework/Logger.h" -#include "TFile.h" +#include +#include + +#include + +#include namespace o2::pid { -void Parameters::SetParameters(const std::vector params) +void Parameters::SetParameters(const std::vector& params) { if (mPar.size() != params.size()) { LOG(fatal) << "Updating parametrization size! Trying to fit a parametrization of size " << params.size() << " into one of size " << mPar.size(); @@ -40,7 +43,7 @@ void Parameters::Print(Option_t* /*options*/) const } }; -void Parameters::LoadParamFromFile(const TString FileName, const TString ParamName) +void Parameters::LoadParamFromFile(const TString& FileName, const TString& ParamName) { TFile f(FileName, "READ"); if (!f.Get(ParamName)) { @@ -66,7 +69,7 @@ void Parametrization::Print(Option_t* options) const mParameters.Print(options); }; -void Parametrization::LoadParamFromFile(const TString FileName, const TString ParamName) +void Parametrization::LoadParamFromFile(const TString& FileName, const TString& ParamName) { TFile f(FileName, "READ"); if (!f.Get(ParamName)) { diff --git a/Common/Core/PID/ParamBase.h b/Common/Core/PID/ParamBase.h index ec4b17083f4..cc7812c3036 100644 --- a/Common/Core/PID/ParamBase.h +++ b/Common/Core/PID/ParamBase.h @@ -26,10 +26,10 @@ #include // std::vector // ROOT includes -#include "TNamed.h" -#include "TFile.h" +#include -#include "Framework/Logger.h" +#include +#include namespace o2::pid { @@ -49,11 +49,11 @@ class Parameters : public TNamed /// Parametric constructor /// \param size Number of parameters in the container - Parameters(const TString name, unsigned int size) : TNamed(name, name), mPar(std::vector(size)) {} + Parameters(const TString& name, unsigned int size) : TNamed(name, name), mPar(std::vector(size)) {} /// Parametric constructor /// \param params Parameters to initialize the container - Parameters(const TString name, const std::vector params) : TNamed(name, name), mPar{} { SetParameters(params); } + Parameters(const TString& name, const std::vector& params) : TNamed(name, name), mPar{} { SetParameters(params); } /// Default destructor ~Parameters() override = default; @@ -69,11 +69,11 @@ class Parameters : public TNamed /// Setter for the parameter, using a vector /// \param params vector with parameters - void SetParameters(const std::vector params); + void SetParameters(const std::vector& params); /// Setter for the parameter, using a parameter object /// \param params parameter object with parameters - void SetParameters(const Parameters params) { SetParameters(params.mPar); } + void SetParameters(const Parameters& params) { SetParameters(params.mPar); } /// Setter for the parameter, using a parameter pointer /// \param params pointer to parameter object with parameters @@ -85,7 +85,7 @@ class Parameters : public TNamed /// Loader from file /// \param FileName name of the input file /// \param ParamName name of the input object - void LoadParamFromFile(const TString FileName, const TString ParamName); + void LoadParamFromFile(const TString& FileName, const TString& ParamName); /// Getter for the parameters /// \return returns an array of parameters @@ -138,7 +138,7 @@ class PidParameters : public TNamed /// Setter for the parameter, using a parameter object /// \param params parameter object with parameters - void SetParameters(const PidParameters params) { SetParameters(params.mPar); } + void SetParameters(const PidParameters& params) { SetParameters(params.mPar); } /// Setter for the parameter, using a parameter pointer /// \param params pointer to parameter object with parameters @@ -164,7 +164,7 @@ class PidParameters : public TNamed /// Loader from file /// \param FileName name of the input file /// \param ParamName name of the input object - void LoadParamFromFile(const TString FileName, const TString ParamName) + void LoadParamFromFile(const TString& FileName, const TString& ParamName) { TFile f(FileName, "READ"); if (!f.Get(ParamName)) { @@ -215,12 +215,12 @@ class Parametrization : public TNamed /// Parametric constructor /// \param name Name (and title) of the parametrization /// \param size Number of parameters of the parametrization - Parametrization(TString name, unsigned int size) : TNamed(name, name), mParameters(name + "Parameters", size) {} + Parametrization(const TString& name, unsigned int size) : TNamed(name, name), mParameters(name + "Parameters", size) {} /// Parametric constructor /// \param name Name (and title) of the parametrization /// \param params Parameters of the parametrization - Parametrization(TString name, const std::vector params) : TNamed(name, name), mParameters{name + "Parameters", params} {} + Parametrization(const TString& name, const std::vector& params) : TNamed(name, name), mParameters{name + "Parameters", params} {} /// Default destructor ~Parametrization() override = default; @@ -235,7 +235,7 @@ class Parametrization : public TNamed /// Loader from file /// \param FileName name of the input file /// \param ParamName name of the input object - void LoadParamFromFile(const TString FileName, const TString ParamName); + void LoadParamFromFile(const TString& FileName, const TString& ParamName); /// Setter for the parameter at position iparam /// \param iparam index in the array of the parameters diff --git a/Common/Core/TableHelper.cxx b/Common/Core/TableHelper.cxx index 04745ffe694..57f03e43c35 100644 --- a/Common/Core/TableHelper.cxx +++ b/Common/Core/TableHelper.cxx @@ -17,8 +17,8 @@ #include "Common/Core/TableHelper.h" -#include "Framework/InitContext.h" -#include "Framework/RunningWorkflowInfo.h" +#include +#include #include @@ -26,7 +26,7 @@ /// @param initContext initContext of the init function void o2::common::core::printTablesInWorkflow(o2::framework::InitContext& initContext) { - auto& workflows = initContext.services().get(); + const auto& workflows = initContext.services().get(); for (auto const& device : workflows.devices) { for (auto const& input : device.inputs) { LOG(info) << "Table: " << input.matcher.binding << " in device: " << device.name; @@ -41,7 +41,7 @@ bool o2::common::core::isTableRequiredInWorkflow(o2::framework::InitContext& ini { LOG(debug) << "Checking if table " << table << " is needed"; bool tableNeeded = false; - auto& workflows = initContext.services().get(); + const auto& workflows = initContext.services().get(); for (auto const& device : workflows.devices) { for (auto const& input : device.inputs) { if (input.matcher.binding == table) { diff --git a/Common/Core/TableHelper.h b/Common/Core/TableHelper.h index 56d2264ed6c..40f31515a79 100644 --- a/Common/Core/TableHelper.h +++ b/Common/Core/TableHelper.h @@ -18,9 +18,9 @@ #ifndef COMMON_CORE_TABLEHELPER_H_ #define COMMON_CORE_TABLEHELPER_H_ -#include "Framework/Configurable.h" -#include "Framework/InitContext.h" -#include "Framework/RunningWorkflowInfo.h" +#include +#include +#include #include @@ -70,7 +70,7 @@ bool getTaskOptionValue(o2::framework::InitContext& initContext, const std::stri if (verbose) { LOG(info) << "Checking for option '" << optName << "' in task '" << taskName << "'"; } - auto& workflows = initContext.services().get(); + const auto& workflows = initContext.services().get(); int deviceCounter = 0; bool found = false; for (auto const& device : workflows.devices) { diff --git a/Common/Core/TrackSelection.cxx b/Common/Core/TrackSelection.cxx index 717d7db77f5..474a6859e0c 100644 --- a/Common/Core/TrackSelection.cxx +++ b/Common/Core/TrackSelection.cxx @@ -13,9 +13,14 @@ // Class for track selection // -#include "Framework/Logger.h" #include "Common/Core/TrackSelection.h" +#include + +#include +#include +#include + bool TrackSelection::FulfillsITSHitRequirements(uint8_t itsClusterMap) const { constexpr uint8_t bit = 1; @@ -167,7 +172,7 @@ void TrackSelection::print() const LOG(info) << mCutNames[i] << " == " << mRequireITSRefit; break; case TrackCuts::kITSHits: - for (auto& itsRequirement : mRequiredITSHits) { + for (const auto& itsRequirement : mRequiredITSHits) { LOG(info) << mCutNames[i] << " == " << itsRequirement.first; } break; diff --git a/Common/Core/TrackSelection.h b/Common/Core/TrackSelection.h index 19d77a198e1..4be97408f73 100644 --- a/Common/Core/TrackSelection.h +++ b/Common/Core/TrackSelection.h @@ -16,13 +16,15 @@ #ifndef COMMON_CORE_TRACKSELECTION_H_ #define COMMON_CORE_TRACKSELECTION_H_ +#include "Framework/DataTypes.h" +#include "Framework/Logger.h" + +#include + #include -#include -#include #include -#include "Framework/Logger.h" -#include "Framework/DataTypes.h" -#include "Rtypes.h" +#include +#include class TrackSelection { diff --git a/Common/Core/trackUtilities.h b/Common/Core/trackUtilities.h index e67e0f82d6f..21d30990e72 100644 --- a/Common/Core/trackUtilities.h +++ b/Common/Core/trackUtilities.h @@ -17,12 +17,14 @@ #ifndef COMMON_CORE_TRACKUTILITIES_H_ #define COMMON_CORE_TRACKUTILITIES_H_ -#include // std::move -#include "CommonConstants/MathConstants.h" -#include "ReconstructionDataFormats/Track.h" -#include "ReconstructionDataFormats/Vertex.h" #include "Common/Core/RecoDecay.h" +#include +#include +#include + +#include // std::move + /// Extracts track parameters from a track. template o2::track::TrackParametrization getTrackPar(const T& track) @@ -122,12 +124,12 @@ auto getRotatedCovMatrixXX(const T& matrix, U phi, V theta) template void getPxPyPz(T const& trackPars, U& pVec) { - auto pt = 1.f / std::abs(trackPars.getQ2Pt()); + auto ptTrack = 1.f / std::abs(trackPars.getQ2Pt()); float cs = cosf(trackPars.getAlpha()), sn = sinf(trackPars.getAlpha()); auto r = std::sqrt((1.f - trackPars.getSnp()) * (1.f + trackPars.getSnp())); - pVec[0] = pt * (r * cs - trackPars.getSnp() * sn); - pVec[1] = pt * (trackPars.getSnp() * cs + r * sn); - pVec[2] = pt * trackPars.getTgl(); + pVec[0] = ptTrack * (r * cs - trackPars.getSnp() * sn); + pVec[1] = ptTrack * (trackPars.getSnp() * cs + r * sn); + pVec[2] = ptTrack * trackPars.getTgl(); } /// Calculates DCA XYZ of a track w.r.t. the primary vertex and its uncertainty if required. diff --git a/Common/TableProducer/PID/pidBayes.cxx b/Common/TableProducer/PID/pidBayes.cxx index abedb281668..5a91afa6f70 100644 --- a/Common/TableProducer/PID/pidBayes.cxx +++ b/Common/TableProducer/PID/pidBayes.cxx @@ -16,29 +16,30 @@ /// Only the tables for the mass hypotheses requested are filled, the others are sent empty. /// -#include #include -#include #include #include +#include +#include // O2 includes -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/Array2D.h" -#include "CCDB/BasicCCDBManager.h" -#include "Common/Core/PID/TPCPIDResponse.h" +#include "pidTOFBase.h" + #include "Common/Core/PID/DetectorResponse.h" -#include "Common/Core/PID/ParamBase.h" #include "Common/Core/PID/PIDTOF.h" +#include "Common/Core/PID/ParamBase.h" +#include "Common/Core/PID/TPCPIDResponse.h" #include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/PIDResponseCombined.h" -#include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" +#include "Common/DataModel/TrackSelectionTables.h" -#include "pidTOFBase.h" +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -52,7 +53,7 @@ void customize(std::vector& workflowOptions) std::swap(workflowOptions, options); } -#include "Framework/runDataProcessing.h" +#include struct bayesPid { using Trks = soa::Join; @@ -163,7 +164,7 @@ struct bayesPid { } // Checking the tables are requested in the workflow and enabling them - auto& workflows = initContext.services().get(); + const auto& workflows = initContext.services().get(); for (DeviceSpec const& device : workflows.devices) { for (auto const& input : device.inputs) { auto enableFlag = [&input](const PID::ID& id, Configurable& flag) { @@ -284,12 +285,12 @@ struct bayesPid { // bethe = fTPCResponse.GetExpectedSignal(track, type, AliTPCPIDResponse::kdEdxDefault, fUseTPCEtaCorrection, fUseTPCMultiplicityCorrection, fUseTPCPileupCorrection); // sigma = fTPCResponse.GetExpectedSigma(track, type, AliTPCPIDResponse::kdEdxDefault, fUseTPCEtaCorrection, fUseTPCMultiplicityCorrection, fUseTPCPileupCorrection); - if (abs(dedx - bethe) > fRange * sigma) { - // Probability[kTPC][pid] = exp(-0.5 * fRange * fRange) / sigma; // BUG fix - Probability[kTPC][pid] = exp(-0.5 * fRange * fRange); + if (std::abs(dedx - bethe) > fRange * sigma) { + // Probability[kTPC][pid] = std::exp(-0.5 * fRange * fRange) / sigma; // BUG fix + Probability[kTPC][pid] = std::exp(-0.5 * fRange * fRange); } else { - // Probability[kTPC][pid] = exp(-0.5 * (dedx - bethe) * (dedx - bethe) / (sigma * sigma)) / sigma; //BUG fix - Probability[kTPC][pid] = exp(-0.5 * (dedx - bethe) * (dedx - bethe) / (sigma * sigma)); + // Probability[kTPC][pid] = std::exp(-0.5 * (dedx - bethe) * (dedx - bethe) / (sigma * sigma)) / sigma; //BUG fix + Probability[kTPC][pid] = std::exp(-0.5 * (dedx - bethe) * (dedx - bethe) / (sigma * sigma)); mismatch = false; } if (Probability[kTPC][pid] <= 0.f) { @@ -325,10 +326,10 @@ struct bayesPid { constexpr respTOF responseTOFPID; // const float pt = track.pt(); - float mismPropagationFactor[10] = {1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}; + const float mismPropagationFactor[10] = {1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}; // In the O2 this cannot be done because the cluster information is missing in the AOD // if (!fNoTOFmism) { // this flag allows to disable mismatch for iterative procedure to get prior probabilities - // mismPropagationFactor[3] = 1 + exp(1 - 1.12 * pt); // it has to be aligned with the one in AliPIDCombined + // mismPropagationFactor[3] = 1 + std::exp(1 - 1.12 * pt); // it has to be aligned with the one in AliPIDCombined // mismPropagationFactor[4] = 1 + 1. / (4.71114 - 5.72372 * pt + 2.94715 * pt * pt); // it has to be aligned with the one in AliPIDCombined // int nTOFcluster = 0; @@ -342,10 +343,10 @@ struct bayesPid { // nTOFcluster = 80; // break; // case kPPB: // pPb 5.05 ATeV - // nTOFcluster = int(308 - 2.12 * fCurrCentrality + exp(4.917 - 0.1604 * fCurrCentrality)); + // nTOFcluster = int(308 - 2.12 * fCurrCentrality + std::exp(4.917 - 0.1604 * fCurrCentrality)); // break; // case kPBPB: // PbPb 2.76 ATeV - // nTOFcluster = int(exp(9.4 - 0.022 * fCurrCentrality)); + // nTOFcluster = int(std::exp(9.4 - 0.022 * fCurrCentrality)); // break; // } // } @@ -376,9 +377,9 @@ struct bayesPid { const float sig = /*responseTOFPID.GetExpectedSigma(Response[kTOF], track)*/ +0.f; if (nsigmas < fTOFtail) { - Probability[kTOF][pid] = exp(-0.5 * nsigmas * nsigmas) / sig; + Probability[kTOF][pid] = std::exp(-0.5 * nsigmas * nsigmas) / sig; } else { - Probability[kTOF][pid] = exp(-(nsigmas - fTOFtail * 0.5) * fTOFtail) / sig; + Probability[kTOF][pid] = std::exp(-(nsigmas - fTOFtail * 0.5) * fTOFtail) / sig; } Probability[kTOF][pid] += fgTOFmismatchProb * mismPropagationFactor[pid]; @@ -556,7 +557,7 @@ struct bayesPidQa { double lmin = TMath::Log10(min); double ldelta = (TMath::Log10(max) - lmin) / (static_cast(kNBins)); for (int i = 0; i < kNBins; i++) { - binp[i] = exp(TMath::Log(10) * (lmin + i * ldelta)); + binp[i] = std::exp(TMath::Log(10) * (lmin + i * ldelta)); } binp[kNBins] = max + 1; h->GetXaxis()->Set(kNBins, binp); diff --git a/Common/TableProducer/PID/pidTOFBase.cxx b/Common/TableProducer/PID/pidTOFBase.cxx index f0f9722fc6b..f55a4049e04 100644 --- a/Common/TableProducer/PID/pidTOFBase.cxx +++ b/Common/TableProducer/PID/pidTOFBase.cxx @@ -15,25 +15,27 @@ /// \brief Base to build tasks for TOF PID tasks. /// +#include #include #include -#include // O2 includes -#include "CCDB/BasicCCDBManager.h" -#include "TOFBase/EventTimeMaker.h" -#include "Framework/AnalysisTask.h" -#include "ReconstructionDataFormats/Track.h" +#include +#include +#include +#include // O2Physics includes -#include "Common/DataModel/TrackSelectionTables.h" +#include "TableHelper.h" +#include "pidTOFBase.h" + #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/FT0Corrected.h" #include "Common/DataModel/Multiplicity.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" -#include "TableHelper.h" -#include "pidTOFBase.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include using namespace o2; using namespace o2::framework; @@ -111,7 +113,7 @@ struct tofSignal { if (enableTableFlags) { tableFlags.reserve(tracks.size()); } - for (auto& t : tracks) { + for (const auto& t : tracks) { const auto s = o2::pid::tof::TOFSignal::GetTOFSignal(t); if (enableQaHistograms) { histos.fill(HIST("tofSignal"), s); @@ -139,7 +141,7 @@ struct tofSignal { if (enableTableFlags) { tableFlags.reserve(tracks.size()); } - for (auto& t : tracks) { + for (const auto& t : tracks) { table(o2::pid::tof::TOFSignal::GetTOFSignal(t)); if (!enableTableFlags) { continue; @@ -388,7 +390,7 @@ struct tofEventTime { evTimeTOF.removeBias(trk, nGoodTracksForTOF, et, erret, 2); } uint8_t flags = 0; - if (erret < errDiamond && (maxEvTimeTOF <= 0.f || abs(et) < maxEvTimeTOF)) { + if (erret < errDiamond && (maxEvTimeTOF <= 0.f || std::abs(et) < maxEvTimeTOF)) { flags |= o2::aod::pidflags::enums::PIDFlags::EvTimeTOF; } else { et = 0.f; @@ -407,7 +409,7 @@ struct tofEventTime { /// /// Process function to prepare the event for each track on Run 3 data with the FT0 using EvTimeCollisionsFT0 = soa::Join; - void processFT0(TrksEvTime& tracks, + void processFT0(TrksEvTime const& tracks, aod::FT0s const&, EvTimeCollisionsFT0 const&) { @@ -463,7 +465,7 @@ struct tofEventTime { if constexpr (removeTOFEvTimeBias) { evTimeTOF.removeBias(trk, nGoodTracksForTOF, t0TOF[0], t0TOF[1], 2); } - if (t0TOF[1] < errDiamond && (maxEvTimeTOF <= 0 || abs(t0TOF[0]) < maxEvTimeTOF)) { + if (t0TOF[1] < errDiamond && (maxEvTimeTOF <= 0 || std::abs(t0TOF[0]) < maxEvTimeTOF)) { flags |= o2::aod::pidflags::enums::PIDFlags::EvTimeTOF; weight = 1.f / (t0TOF[1] * t0TOF[1]); @@ -491,7 +493,7 @@ struct tofEventTime { } else { tableFlags(flags); } - tableEvTime(eventTime / sumOfWeights, sqrt(1. / sumOfWeights)); + tableEvTime(eventTime / sumOfWeights, std::sqrt(1. / sumOfWeights)); if (enableTableTOFOnly) { tableEvTimeTOFOnly((uint8_t)filterForTOFEventTime(trk), t0TOF[0], t0TOF[1], evTimeTOF.mEventTimeMultiplicity); } @@ -502,7 +504,7 @@ struct tofEventTime { /// /// Process function to prepare the event for each track on Run 3 data with only the FT0 - void processOnlyFT0(TrksEvTime& tracks, + void processOnlyFT0(TrksEvTime const& tracks, aod::FT0s const&, EvTimeCollisionsFT0 const&) { diff --git a/Common/TableProducer/PID/pidTOFMerge.cxx b/Common/TableProducer/PID/pidTOFMerge.cxx index 7ea0ac3b3b1..91c76e6e50a 100644 --- a/Common/TableProducer/PID/pidTOFMerge.cxx +++ b/Common/TableProducer/PID/pidTOFMerge.cxx @@ -22,12 +22,12 @@ #include // O2 includes -#include "CCDB/BasicCCDBManager.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/Track.h" -#include "TOFBase/EventTimeMaker.h" +#include +#include +#include +#include +#include +#include // O2Physics includes #include "CollisionTypeHelper.h" @@ -83,14 +83,14 @@ struct TOFCalibConfig { } template - void getCfg(o2::framework::InitContext& initContext, const std::string name, VType& v, const std::string task) + void getCfg(o2::framework::InitContext& initContext, const std::string& name, VType& v, const std::string& task) { if (!getTaskOptionValue(initContext, task, name, v, false)) { LOG(fatal) << "Could not get " << name << " from " << task << " task"; } } - void inheritFromBaseTask(o2::framework::InitContext& initContext, const std::string task = "tof-signal") + void inheritFromBaseTask(o2::framework::InitContext& initContext, const std::string& task = "tof-signal") { mInitMode = 2; getCfg(initContext, "ccdb-url", mUrl, task); @@ -329,7 +329,7 @@ struct TOFCalibConfig { // Configurable options std::string mUrl; std::string mPathGrpLhcIf; - int64_t mTimestamp; + int64_t mTimestamp{0}; std::string mTimeShiftCCDBPathPos; std::string mTimeShiftCCDBPathNeg; std::string mTimeShiftCCDBPathPosMC; @@ -338,10 +338,10 @@ struct TOFCalibConfig { std::string mParametrizationPath; std::string mReconstructionPass; std::string mReconstructionPassDefault; - bool mFatalOnPassNotAvailable; - bool mEnableTimeDependentResponse; - int mCollisionSystem; - bool mAutoSetProcessFunctions; + bool mFatalOnPassNotAvailable{false}; + bool mEnableTimeDependentResponse{false}; + int mCollisionSystem{-1}; + bool mAutoSetProcessFunctions{false}; }; // Part 1 TOF signal definition diff --git a/Common/TableProducer/PID/pidTPC.cxx b/Common/TableProducer/PID/pidTPC.cxx index e9c2015afbc..fd6efd7bff8 100644 --- a/Common/TableProducer/PID/pidTPC.cxx +++ b/Common/TableProducer/PID/pidTPC.cxx @@ -24,9 +24,9 @@ #include #include // ROOT includes -#include "TFile.h" -#include "TRandom.h" -#include "TSystem.h" +#include +#include +#include // O2 includes #include "MetadataHelper.h" @@ -39,13 +39,13 @@ #include "Common/DataModel/PIDResponseTPC.h" #include "Tools/ML/model.h" -#include "CCDB/BasicCCDBManager.h" -#include "CCDB/CcdbApi.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/Track.h" +#include +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -166,7 +166,7 @@ struct tpcPid { } response = new o2::pid::tpc::Response(); // Checking the tables are requested in the workflow and enabling them - auto enableFlag = [&](const std::string particle, Configurable& flag) { + auto enableFlag = [&](const std::string& particle, Configurable& flag) { enableFlagIfTableRequired(initContext, "pidTPC" + particle, flag); }; enableFlag("FullEl", pidFullEl); @@ -376,7 +376,7 @@ struct tpcPid { if ((in_batch_counter == track_prop_size) || (total_input_count == total_eval_size)) { // If the batch size is reached, reset the counter int32_t fill_shift = (exec_counter * track_prop_size - ((total_input_count == total_eval_size) ? (total_input_count % track_prop_size) : 0)) * output_dimensions; auto start_network_eval = std::chrono::high_resolution_clock::now(); - float* output_network = network.evalModel(track_properties); + const float* output_network = network.evalModel(track_properties); auto stop_network_eval = std::chrono::high_resolution_clock::now(); duration_network += std::chrono::duration>(stop_network_eval - start_network_eval).count(); @@ -437,8 +437,8 @@ struct tpcPid { } } auto expSignal = response->GetExpectedSignal(trk, pid); - auto expSigma = trk.has_collision() ? response->GetExpectedSigma(collisions.iteratorAt(trk.collisionId()), trk, pid) : 0.07 * expSignal; // use default sigma value of 7% if no collision information to estimate resolution - if (expSignal < 0. || expSigma < 0.) { // skip if expected signal invalid + auto expSigma = trk.has_collision() ? response->GetExpectedSigma(collisions.iteratorAt(trk.collisionId()), trk, pid) : 0.07f * expSignal; // use default sigma value of 7% if no collision information to estimate resolution + if (expSignal < 0. || expSigma < 0.) { // skip if expected signal invalid if (flagFull) tableFull(-999.f, -999.f); if (flagTiny) diff --git a/Common/TableProducer/caloClusterProducer.cxx b/Common/TableProducer/caloClusterProducer.cxx index 086885beb4c..6b660ad4c68 100644 --- a/Common/TableProducer/caloClusterProducer.cxx +++ b/Common/TableProducer/caloClusterProducer.cxx @@ -14,36 +14,35 @@ /// /// \author Dmitri Peresunko +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/CaloClusters.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include #include #include #include #include -#include "Framework/ConfigParamSpec.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/CaloClusters.h" -#include "Common/Core/trackUtilities.h" -#include "ReconstructionDataFormats/TrackParametrization.h" -#include "DetectorsBase/Propagator.h" - -#include "CommonUtils/NameConf.h" -#include "CCDB/BasicCCDBManager.h" -#include "SimulationDataFormat/MCTruthContainer.h" - -#include "DataFormatsParameters/GRPMagField.h" -#include "DataFormatsPHOS/Cell.h" -#include "DataFormatsPHOS/Cluster.h" -#include "DataFormatsPHOS/TriggerRecord.h" -#include "DataFormatsPHOS/MCLabel.h" -#include "DataFormatsPHOS/BadChannelsMap.h" -#include "DataFormatsPHOS/CalibParams.h" -#include "PHOSBase/Geometry.h" -#include "PHOSReconstruction/Clusterer.h" - using namespace o2::framework; using namespace o2; @@ -105,9 +104,9 @@ struct CaloClusterProducer { ~TrackTrigRec() = default; public: - int64_t mTR; // BC ref - int mStart[kCpvCells]; // X (phi) track coordinate in PHOS plane - int mEnd[kCpvCells]; // Z (theta) track coordinate in PHOS plane + int64_t mTR{-1}; // BC ref + int mStart[kCpvCells] = {0}; // X (phi) track coordinate in PHOS plane + int mEnd[kCpvCells] = {0}; // Z (theta) track coordinate in PHOS plane }; void init(o2::framework::InitContext&) @@ -141,18 +140,18 @@ struct CaloClusterProducer { // If several collisions appear in BC, choose one with largers number of contributors std::map colMap; - int colId = 0; + int colIdOuter = 0; for (const auto& cl : colls) { auto colbc = colMap.find(cl.bc_as().globalBC()); if (colbc == colMap.end()) { // single collision per BC - colMap[cl.bc_as().globalBC()] = colId; + colMap[cl.bc_as().globalBC()] = colIdOuter; } else { // not unique collision per BC auto coll2 = colls.begin() + colbc->second; if (cl.numContrib() > coll2.numContrib()) { - colMap[cl.bc_as().globalBC()] = colId; + colMap[cl.bc_as().globalBC()] = colIdOuter; } } - colId++; + colIdOuter++; } // Fill list of cells and cell TrigRecs per TF as an input for clusterizer @@ -272,13 +271,13 @@ struct CaloClusterProducer { // Extract primary vertex TVector3 vtx = {0., 0., 0.}; // default, if not collision will be found - int colId = -1; + int colIdInner = -1; auto coliter = colMap.find(cluTR.getBCData().toLong()); if (coliter != colMap.end()) { // get vertex from collision // find collision corresponding to current BC auto clvtx = colls.begin() + coliter->second; vtx.SetXYZ(clvtx.posX(), clvtx.posY(), clvtx.posZ()); - colId = coliter->second; + colIdInner = coliter->second; } bool cpvExist = false; @@ -381,7 +380,7 @@ struct CaloClusterProducer { clu.getElipsAxis(lambdaShort, lambdaLong); // Clear Collision assignment - if (colId == -1) { + if (colIdInner == -1) { // Ambiguos Collision assignment cluambcursor( bcMap[cluTR.getBCData().toLong()], @@ -395,7 +394,7 @@ struct CaloClusterProducer { clu.getDistanceToBadChannel()); } else { // Normal collision - auto col = colls.begin() + colId; + auto col = colls.begin() + colIdInner; clucursor( col, mom.X(), mom.Y(), mom.Z(), e, @@ -435,18 +434,18 @@ struct CaloClusterProducer { // If several collisions appear in BC, choose one with largers number of contributors std::map colMap; - int colId = 0; + int colIdOuter = 0; for (auto const& cl : colls) { auto colbc = colMap.find(cl.bc_as().globalBC()); if (colbc == colMap.end()) { // single collision per BC - colMap[cl.bc_as().globalBC()] = colId; + colMap[cl.bc_as().globalBC()] = colIdOuter; } else { // not unique collision per BC auto coll2 = colls.begin() + colbc->second; if (cl.numContrib() > coll2.numContrib()) { - colMap[cl.bc_as().globalBC()] = colId; + colMap[cl.bc_as().globalBC()] = colIdOuter; } } - colId++; + colIdOuter++; } // Fill list of cells and cell TrigRecs per TF as an input for clusterizer @@ -588,13 +587,13 @@ struct CaloClusterProducer { // Extract primary vertex TVector3 vtx = {0., 0., 0.}; // default, if not collision will be found - int colId = -1; + int colIdInner = -1; auto coliter = colMap.find(cluTR.getBCData().toLong()); if (coliter != colMap.end()) { // get vertex from collision // find collision corresponding to current BC auto clvtx = colls.begin() + coliter->second; vtx.SetXYZ(clvtx.posX(), clvtx.posY(), clvtx.posZ()); - colId = coliter->second; + colIdInner = coliter->second; } bool cpvExist = false; @@ -705,7 +704,7 @@ struct CaloClusterProducer { mcamplitudes.push_back(cellLab.getEdep()); } // Clear Collision assignment - if (colId == -1) { + if (colIdInner == -1) { // Ambiguos Collision assignment cluambcursor( bcMap[cluTR.getBCData().toLong()], @@ -722,7 +721,7 @@ struct CaloClusterProducer { mcamplitudes); } else { // Normal collision - auto col = colls.begin() + colId; + auto col = colls.begin() + colIdInner; clucursor( col, mom.X(), mom.Y(), mom.Z(), e, @@ -778,18 +777,18 @@ struct CaloClusterProducer { // If several collisions appear in BC, choose one with largers number of contributors std::map colMap; - int colId = 0; + int colIdOuter = 0; for (const auto& cl : colls) { auto colbc = colMap.find(cl.bc_as().globalBC()); if (colbc == colMap.end()) { // single collision per BC - colMap[cl.bc_as().globalBC()] = colId; + colMap[cl.bc_as().globalBC()] = colIdOuter; } else { // not unique collision per BC auto coll2 = colls.begin() + colbc->second; if (cl.numContrib() > coll2.numContrib()) { - colMap[cl.bc_as().globalBC()] = colId; + colMap[cl.bc_as().globalBC()] = colIdOuter; } } - colId++; + colIdOuter++; } // Fill list of cells and cell TrigRecs per TF as an input for clusterizer // clusterize @@ -982,13 +981,13 @@ struct CaloClusterProducer { // Extract primary vertex TVector3 vtx = {0., 0., 0.}; // default, if not collision will be found - int colId = -1; + int colIdInner = -1; auto coliter = colMap.find(cluTR.getBCData().toLong()); if (coliter != colMap.end()) { // get vertex from collision // find collision corresponding to current BC auto clvtx = colls.begin() + coliter->second; vtx.SetXYZ(clvtx.posX(), clvtx.posY(), clvtx.posZ()); - colId = coliter->second; + colIdInner = coliter->second; } bool cpvExist = false; @@ -1119,7 +1118,7 @@ struct CaloClusterProducer { if (cpvExist) { cpvindex = -1; // there were CPV clusters } - if (colId == -1) { + if (colIdInner == -1) { // Ambiguos Collision assignment cluambcursor( bcMap[cluTR.getBCData().toLong()], @@ -1133,7 +1132,7 @@ struct CaloClusterProducer { clu.getDistanceToBadChannel()); } else { // Normal collision - auto col = colls.begin() + colId; + auto col = colls.begin() + colIdInner; clucursor( col, mom.X(), mom.Y(), mom.Z(), e, @@ -1187,18 +1186,18 @@ struct CaloClusterProducer { // If several collisions appear in BC, choose one with largers number of contributors std::map colMap; - int colId = 0; + int colIdOuter = 0; for (const auto& cl : colls) { auto colbc = colMap.find(cl.bc_as().globalBC()); if (colbc == colMap.end()) { // single collision per BC - colMap[cl.bc_as().globalBC()] = colId; + colMap[cl.bc_as().globalBC()] = colIdOuter; } else { // not unique collision per BC auto coll2 = colls.begin() + colbc->second; if (cl.numContrib() > coll2.numContrib()) { - colMap[cl.bc_as().globalBC()] = colId; + colMap[cl.bc_as().globalBC()] = colIdOuter; } } - colId++; + colIdOuter++; } // Fill list of cells and cell TrigRecs per TF as an input for clusterizer // clusterize @@ -1413,13 +1412,13 @@ struct CaloClusterProducer { // Extract primary vertex TVector3 vtx = {0., 0., 0.}; // default, if not collision will be found - int colId = -1; + int colIdInner = -1; auto coliter = colMap.find(cluTR.getBCData().toLong()); if (coliter != colMap.end()) { // get vertex from collision // find collision corresponding to current BC auto clvtx = colls.begin() + coliter->second; vtx.SetXYZ(clvtx.posX(), clvtx.posY(), clvtx.posZ()); - colId = coliter->second; + colIdInner = coliter->second; } bool cpvExist = false; @@ -1555,7 +1554,7 @@ struct CaloClusterProducer { mclabels.push_back(cellLab.getTrackID()); // Track ID in current event? mcamplitudes.push_back(cellLab.getEdep()); } - if (colId == -1) { + if (colIdInner == -1) { // Ambiguos Collision assignment cluambcursor( bcMap[cluTR.getBCData().toLong()], @@ -1571,7 +1570,7 @@ struct CaloClusterProducer { mclabels, mcamplitudes); } else { // Normal collision - auto col = colls.begin() + colId; + auto col = colls.begin() + colIdInner; clucursor( col, mom.X(), mom.Y(), mom.Z(), e, diff --git a/Common/TableProducer/centralityTable.cxx b/Common/TableProducer/centralityTable.cxx index 9198f79499e..e83c41d00c1 100644 --- a/Common/TableProducer/centralityTable.cxx +++ b/Common/TableProducer/centralityTable.cxx @@ -15,25 +15,28 @@ /// \author ALICE // -#include -#include -#include -#include +#include "MetadataHelper.h" +#include "TableHelper.h" -#include -#include -#include -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/HistogramRegistry.h" -#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" -#include "MetadataHelper.h" -#include "TableHelper.h" -#include "TList.h" +#include "Common/DataModel/Multiplicity.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -410,7 +413,7 @@ struct CentralityTable { } } - auto scaleMC = [](float x, float pars[6]) { + auto scaleMC = [](float x, const float pars[6]) { return std::pow(((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4], 1.0f / pars[5]); }; @@ -647,7 +650,7 @@ struct CentralityTable { auto populateTable = [&](auto& table, struct CalibrationInfo& estimator, float multiplicity) { const bool assignOutOfRange = embedINELgtZEROselection && !collision.isInelGt0(); - auto scaleMC = [](float x, float pars[6]) { + auto scaleMC = [](float x, const float pars[6]) { return std::pow(((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4], 1.0f / pars[5]); }; diff --git a/Common/TableProducer/eventSelection.cxx b/Common/TableProducer/eventSelection.cxx index f32c4723a47..25225144ab5 100644 --- a/Common/TableProducer/eventSelection.cxx +++ b/Common/TableProducer/eventSelection.cxx @@ -14,34 +14,55 @@ /// /// \author Evgeny Kryshen and Igor Altsybeev -#include -#include -#include -#include - -#include "Framework/ConfigParamSpec.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" #include "Common/DataModel/EventSelection.h" + #include "Common/CCDB/EventSelectionParams.h" +#include "Common/CCDB/RCTSelectionFlags.h" #include "Common/CCDB/TriggerAliases.h" -#include "CCDB/BasicCCDBManager.h" -#include "CommonConstants/LHCConstants.h" -#include "Framework/HistogramRegistry.h" -#include "DataFormatsFT0/Digit.h" -#include "DataFormatsParameters/GRPLHCIFData.h" -#include "DataFormatsParameters/GRPECSObject.h" -#include "ITSMFTBase/DPLAlpideParam.h" -#include "MetadataHelper.h" -#include "DataFormatsParameters/AggregatedRunInfo.h" -#include "DataFormatsITSMFT/NoiseMap.h" // missing include in TimeDeadMap.h -#include "DataFormatsITSMFT/TimeDeadMap.h" -#include "ITSMFTReconstruction/ChipMappingITS.h" -#include "DataFormatsCTP/Configuration.h" -#include "DataFormatsCTP/Scalers.h" - -#include "TH1D.h" +#include "Common/Core/MetadataHelper.h" + +#include +#include +#include +#include +#include +#include // missing include in TimeDeadMap. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -317,7 +338,7 @@ struct BcSelectionTask { if (mapRCT == nullptr) { LOGP(info, "rct object missing... inserting dummy rct flags"); mapRCT = new std::map; - uint32_t dummyValue = 1 << 31; // setting bit 31 to indicate that rct object is missing + uint32_t dummyValue = 1u << 31; // setting bit 31 to indicate that rct object is missing mapRCT->insert(std::pair(sorTimestamp, dummyValue)); } } @@ -521,7 +542,7 @@ struct EventSelectionTask { int rofLength = -1; // ITS ROF length, in bc std::string strLPMProductionTag = ""; // MC production tag to be retrieved from AO2D metadata - int32_t findClosest(int64_t globalBC, std::map& bcs) + int32_t findClosest(int64_t globalBC, const std::map& bcs) { auto it = bcs.lower_bound(globalBC); int64_t bc1 = it->first; diff --git a/Common/TableProducer/multiplicityTable.cxx b/Common/TableProducer/multiplicityTable.cxx index 12cde8a9869..efbb87908d2 100644 --- a/Common/TableProducer/multiplicityTable.cxx +++ b/Common/TableProducer/multiplicityTable.cxx @@ -15,26 +15,29 @@ /// \author ALICE /// -#include -#include -#include -#include +#include "PWGMM/Mult/DataModel/bestCollisionTable.h" -#include "Framework/ConfigParamSpec.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "CCDB/BasicCCDBManager.h" -#include "Common/DataModel/Multiplicity.h" +#include "Common/Core/MetadataHelper.h" +#include "Common/Core/TableHelper.h" #include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "TableHelper.h" -#include "MetadataHelper.h" -#include "TList.h" -#include "PWGMM/Mult/DataModel/bestCollisionTable.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -100,9 +103,9 @@ struct MultiplicityTable { Produces tablePVZeqs; // 12 Produces tableExtraMc; // 13 Produces tableExtraMult2MCExtras; - Produces multHepMCHIs; // Not accounted for, produced using custom process function to avoid dependencies - Produces mftMults; // Not accounted for, produced using custom process function to avoid dependencies - Produces multsGlobal; // Not accounted for, produced based on process function processGlobalTrackingCounters + Produces multHepMCHIs; // Not accounted for, produced using custom process function to avoid dependencies + Produces mftMults; // Not accounted for, produced using custom process function to avoid dependencies + Produces multsGlobal; // Not accounted for, produced based on process function processGlobalTrackingCounters // For vertex-Z corrections in calibration Service ccdb; @@ -521,12 +524,6 @@ struct MultiplicityTable { } break; case kZDCMults: // ZDC { - multZNA = -1.f; - multZNC = -1.f; - multZEM1 = -1.f; - multZEM2 = -1.f; - multZPA = -1.f; - multZPC = -1.f; if (bc.has_zdc()) { multZNA = bc.zdc().amplitudeZNA(); multZNC = bc.zdc().amplitudeZNC(); diff --git a/Common/TableProducer/qVectorsTable.cxx b/Common/TableProducer/qVectorsTable.cxx index bfdb319db75..9b6189ef121 100644 --- a/Common/TableProducer/qVectorsTable.cxx +++ b/Common/TableProducer/qVectorsTable.cxx @@ -18,7 +18,22 @@ /// (with or without corrections) and save the results in a dedicated table. /// -// C++/ROOT includes. +#include "Common/Core/EventPlaneHelper.h" +#include "Common/Core/TrackSelection.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/FT0Corrected.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/Qvectors.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include +#include +#include +#include + #include #include @@ -27,26 +42,6 @@ #include #include -// o2Physics includes. -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "Framework/RunningWorkflowInfo.h" - -#include "Common/Core/EventPlaneHelper.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/FT0Corrected.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" - -#include "Common/DataModel/Qvectors.h" - -#include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -// o2 includes. -#include "CCDB/BasicCCDBManager.h" -#include "DetectorsCommonDataFormats/AlignParam.h" - using namespace o2; using namespace o2::framework; @@ -169,7 +164,7 @@ struct qVectorsTable { void init(InitContext& initContext) { // Check the sub-detector used - auto& workflows = initContext.services().get(); + const auto& workflows = initContext.services().get(); for (DeviceSpec const& device : workflows.devices) { for (auto const& input : device.inputs) { if (input.matcher.binding == "Qvectors") { @@ -260,7 +255,7 @@ struct qVectorsTable { } fullPath = cfgGainEqPath; fullPath += "/FT0"; - auto objft0Gain = getForTsOrRun>(fullPath, timestamp, runnumber); + const auto objft0Gain = getForTsOrRun>(fullPath, timestamp, runnumber); if (!objft0Gain || cfgCorrLevel == 0) { for (auto i{0u}; i < 208; i++) { FT0RelGainConst.push_back(1.); @@ -271,7 +266,7 @@ struct qVectorsTable { fullPath = cfgGainEqPath; fullPath += "/FV0"; - auto objfv0Gain = getForTsOrRun>(fullPath, timestamp, runnumber); + const auto objfv0Gain = getForTsOrRun>(fullPath, timestamp, runnumber); if (!objfv0Gain || cfgCorrLevel == 0) { for (auto i{0u}; i < 48; i++) { FV0RelGainConst.push_back(1.); @@ -560,7 +555,7 @@ struct qVectorsTable { runNumber = currentRun; } - float centAllEstim[4] = { + const float centAllEstim[4] = { coll.centFT0M(), coll.centFT0A(), coll.centFT0C(), coll.centFV0A()}; cent = centAllEstim[cfgCentEsti]; diff --git a/Common/TableProducer/trackselection.cxx b/Common/TableProducer/trackselection.cxx index 8ce5a88e0bd..142ae81a2e1 100644 --- a/Common/TableProducer/trackselection.cxx +++ b/Common/TableProducer/trackselection.cxx @@ -17,14 +17,16 @@ /// \brief Task performing basic track selection. /// -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" #include "Common/Core/TrackSelection.h" + +#include "Common/Core/TableHelper.h" #include "Common/Core/TrackSelectionDefaults.h" -#include "Common/DataModel/TrackSelectionTables.h" #include "Common/Core/trackUtilities.h" -#include "TableHelper.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -149,7 +151,7 @@ struct TrackSelectionTask { return; } if (isRun3) { - for (auto& track : tracks) { + for (const auto& track : tracks) { if (produceTable == 1) { filterTable((uint8_t)0, @@ -190,7 +192,7 @@ struct TrackSelectionTask { return; } - for (auto& track : tracks) { + for (const auto& track : tracks) { o2::aod::track::TrackSelectionFlags::flagtype trackflagGlob = globalTracks.IsSelectedMask(track); if (produceTable == 1) { filterTable((uint8_t)globalTracksSDD.IsSelected(track), diff --git a/Common/Tasks/checkDataModelMC.cxx b/Common/Tasks/checkDataModelMC.cxx index fb2762a02b7..c8c0ecdda62 100644 --- a/Common/Tasks/checkDataModelMC.cxx +++ b/Common/Tasks/checkDataModelMC.cxx @@ -13,8 +13,11 @@ /// \author /// \since -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" +#include +#include + +#include +#include using namespace o2; using namespace o2::framework; @@ -42,7 +45,7 @@ void checkDaughters(const T& particlesMC, LOG(fatal) << "MC particle " << particle.globalIndex() << " with PDG " << particle.pdgCode() << " has first and last daughter indices " << firstDauIdx << ", " << lastDauIdx; } } - for (auto& idxDau : particle.daughtersIds()) { + for (const auto& idxDau : particle.daughtersIds()) { if (idxDau >= 0 && ((unsigned long int)idxDau > offset + particlesMC.size() || (unsigned long int)idxDau < offset)) { if (debugMode) { debugHisto->Fill(1); @@ -88,7 +91,7 @@ struct CheckMcParticlesIndices { void process(aod::McParticles const& particlesMC) { long unsigned int offset = 0; - for (auto& particle : particlesMC) { + for (const auto& particle : particlesMC) { checkDaughters(particlesMC, particle, offset, debugMode.value, hDebug); } } @@ -112,7 +115,7 @@ struct CheckMcParticlesIndicesGrouped { void process(aod::McCollision const&, aod::McParticles const& particlesMC) { - for (auto& particle : particlesMC) { + for (const auto& particle : particlesMC) { checkDaughters(particlesMC, particle, particlesMC.offset(), debugMode.value, hDebug); } } diff --git a/Common/Tasks/evtPlanesResolution.cxx b/Common/Tasks/evtPlanesResolution.cxx deleted file mode 100644 index e493ff3f00e..00000000000 --- a/Common/Tasks/evtPlanesResolution.cxx +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// -/// \file evtPlanesResolution.cxx -/// \author Cindy Mordasini -/// \author Anna Önnerstad -/// -/// \brief ... -/// - -// C++/ROOT includes. -#include -#include -#include -#include -#include -#include -#include - -// o2Physics includes. -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/StaticFor.h" - -#include "Common/DataModel/EvtPlanes.h" -#include "Common/Core/EventPlaneHelper.h" - -// o2 includes. - -using namespace o2; -using namespace o2::framework; - -namespace ep -{ -static constexpr std::string_view centClasses[] = { - "Centrality_0-5/", "Centrality_5-10/", "Centrality_10-20/", "Centrality_20-30/", - "Centrality_30-40/", "Centrality_40-50/", "Centrality_50-60/", "Centrality_60-80/"}; -} // namespace ep - -struct evtPlanesResolution { - // Configurables. - - // Histogram registry for the output QA figures and list of centrality classes for it. - // Objects are NOT saved in alphabetical orders, and registry names are NOT saved - // as TDirectoryFile. - HistogramRegistry histosQA{"histosQA", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; - - // Helper variables. - EventPlaneHelper helperEP; - - Configurable cfgMinTPCTracks{"cfgMinTPCTracks", 20, "minimum TPC tracks participating in Q-vector reconstruction"}; - Configurable cfgnMod{"cfgnMod", 2, "Modulation of interest"}; - - void init(InitContext const&) - { - // Fill the registry with the needed objects. - const AxisSpec axisEvtPl{360, -constants::math::PI, constants::math::PI}; - - histosQA.add("Centrality_0-5/histEvtPlUncor", "", {HistType::kTH1F, {axisEvtPl}}); - histosQA.add("Centrality_0-5/histEvtPlRectr", "", {HistType::kTH1F, {axisEvtPl}}); - histosQA.add("Centrality_0-5/histEvtPlTwist", "", {HistType::kTH1F, {axisEvtPl}}); - histosQA.add("Centrality_0-5/histEvtPlFinal", "", {HistType::kTH1F, {axisEvtPl}}); - - histosQA.add("Centrality_0-5/histEvtPlBPosUncor", "", {HistType::kTH1F, {axisEvtPl}}); - histosQA.add("Centrality_0-5/histEvtPlBPosRectr", "", {HistType::kTH1F, {axisEvtPl}}); - histosQA.add("Centrality_0-5/histEvtPlBPosTwist", "", {HistType::kTH1F, {axisEvtPl}}); - histosQA.add("Centrality_0-5/histEvtPlBPosFinal", "", {HistType::kTH1F, {axisEvtPl}}); - - histosQA.add("Centrality_0-5/histEvtPlBNegUncor", "", {HistType::kTH1F, {axisEvtPl}}); - histosQA.add("Centrality_0-5/histEvtPlBNegRectr", "", {HistType::kTH1F, {axisEvtPl}}); - histosQA.add("Centrality_0-5/histEvtPlBNegTwist", "", {HistType::kTH1F, {axisEvtPl}}); - histosQA.add("Centrality_0-5/histEvtPlBNegFinal", "", {HistType::kTH1F, {axisEvtPl}}); - - histosQA.add("Centrality_0-5/histEvtPlResolution", "", {HistType::kTH1F, {axisEvtPl}}); - - for (int iBin = 1; iBin < 8; iBin++) { - histosQA.addClone("Centrality_0-5/", ep::centClasses[iBin].data()); - } - } // End void init(InitContext const&) - - template - void fillHistosEvtPl(const T& vec) - { - histosQA.fill(HIST(ep::centClasses[cBin]) + HIST("histEvtPlUncor"), vec.evtPlUncor()); - histosQA.fill(HIST(ep::centClasses[cBin]) + HIST("histEvtPlRectr"), vec.evtPlRectr()); - histosQA.fill(HIST(ep::centClasses[cBin]) + HIST("histEvtPlTwist"), vec.evtPlTwist()); - histosQA.fill(HIST(ep::centClasses[cBin]) + HIST("histEvtPlFinal"), vec.evtPlFinal()); - - if (vec.nTrkBPos() < cfgMinTPCTracks || vec.nTrkBNeg() < cfgMinTPCTracks) - return; - - histosQA.fill(HIST(ep::centClasses[cBin]) + HIST("histEvtPlBPosUncor"), vec.evtPlBPosUncor()); - histosQA.fill(HIST(ep::centClasses[cBin]) + HIST("histEvtPlBPosRectr"), vec.evtPlBPosRectr()); - histosQA.fill(HIST(ep::centClasses[cBin]) + HIST("histEvtPlBPosTwist"), vec.evtPlBPosTwist()); - histosQA.fill(HIST(ep::centClasses[cBin]) + HIST("histEvtPlBPosFinal"), vec.evtPlBPosFinal()); - - histosQA.fill(HIST(ep::centClasses[cBin]) + HIST("histEvtPlBNegUncor"), vec.evtPlBNegUncor()); - histosQA.fill(HIST(ep::centClasses[cBin]) + HIST("histEvtPlBNegRectr"), vec.evtPlBNegRectr()); - histosQA.fill(HIST(ep::centClasses[cBin]) + HIST("histEvtPlBNegTwist"), vec.evtPlBNegTwist()); - histosQA.fill(HIST(ep::centClasses[cBin]) + HIST("histEvtPlBNegFinal"), vec.evtPlBNegFinal()); - - histosQA.fill(HIST(ep::centClasses[cBin]) + HIST("histEvtPlResolution"), - std::sqrt(std::cos((vec.evtPlFinal() - vec.evtPlBPosFinal()) * cfgnMod) * std::cos((vec.evtPlFinal() - vec.evtPlBNegFinal()) * cfgnMod) / - std::cos((vec.evtPlBPosFinal() - vec.evtPlBNegFinal()) * cfgnMod))); - } - - void process(aod::EvtPlane const& evPl) - { - int centBin = helperEP.GetCentBin(evPl.cent()); - switch (centBin) { - case 0: - fillHistosEvtPl<0>(evPl); - break; - case 1: - fillHistosEvtPl<1>(evPl); - break; - case 2: - fillHistosEvtPl<2>(evPl); - break; - case 3: - fillHistosEvtPl<3>(evPl); - break; - case 4: - fillHistosEvtPl<4>(evPl); - break; - case 5: - fillHistosEvtPl<5>(evPl); - break; - case 6: - fillHistosEvtPl<6>(evPl); - break; - case 7: - fillHistosEvtPl<7>(evPl); - break; - } // End switch(centBin) - } // End void process(...) -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - return WorkflowSpec{ - adaptAnalysisTask(cfgc)}; -} diff --git a/Common/Tasks/propagatorQa.cxx b/Common/Tasks/propagatorQa.cxx index f978f8bc564..3a426d2cf09 100644 --- a/Common/Tasks/propagatorQa.cxx +++ b/Common/Tasks/propagatorQa.cxx @@ -14,27 +14,29 @@ // Work in progress! More to follow, use at your own peril // -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Common/DataModel/TrackSelectionTables.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectionDefaults.h" -#include "ReconstructionDataFormats/Track.h" #include "Common/Core/trackUtilities.h" -#include "CCDB/BasicCCDBManager.h" -#include "DetectorsBase/GeometryManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DetectorsBase/Propagator.h" -#include "trackSelectionRequest.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/Tools/trackSelectionRequest.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -#include "Framework/runDataProcessing.h" - struct propagatorQa { Service ccdb; @@ -100,12 +102,12 @@ struct propagatorQa { ccdb->setFatalWhenNull(false); // output objects - const AxisSpec axisX{(int)NbinsX, 0.0f, +250.0f, "X value"}; - const AxisSpec axisDCAxy{(int)NbinsDCA, -windowDCA, windowDCA, "DCA_{xy} (cm)"}; - const AxisSpec axisPt{(int)NbinsPt, 0.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"}; - const AxisSpec axisPtCoarse{(int)NbinsPtCoarse, 0.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"}; - const AxisSpec axisTanLambda{(int)NbinsTanLambda, -TanLambdaLimit, +TanLambdaLimit, "tan(#lambda)"}; - const AxisSpec axisDeltaPt{(int)NbinsDeltaPt, -DeltaPtLimit, +DeltaPtLimit, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec axisX{NbinsX, 0.0f, +250.0f, "X value"}; + const AxisSpec axisDCAxy{NbinsDCA, -windowDCA, windowDCA, "DCA_{xy} (cm)"}; + const AxisSpec axisPt{NbinsPt, 0.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec axisPtCoarse{NbinsPtCoarse, 0.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec axisTanLambda{NbinsTanLambda, -TanLambdaLimit, +TanLambdaLimit, "tan(#lambda)"}; + const AxisSpec axisDeltaPt{NbinsDeltaPt, -DeltaPtLimit, +DeltaPtLimit, "#it{p}_{T} (GeV/#it{c})"}; // All tracks histos.add("hTrackX", "hTrackX", kTH1F, {axisX}); @@ -145,8 +147,8 @@ struct propagatorQa { histos.add("hdcaXYusedInSVertexer", "hdcaXYusedInSVertexer", kTH1F, {axisDCAxy}); histos.add("hUpdateRadiiusedInSVertexer", "hUpdateRadiiusedInSVertexer", kTH1F, {axisX}); // bit packed ITS cluster map - const AxisSpec axisITSCluMap{(int)128, -0.5f, +127.5f, "Packed ITS map"}; - const AxisSpec axisRadius{(int)dQANBinsRadius, 0.0f, +50.0f, "Radius (cm)"}; + const AxisSpec axisITSCluMap{128, -0.5f, +127.5f, "Packed ITS map"}; + const AxisSpec axisRadius{dQANBinsRadius, 0.0f, +50.0f, "Radius (cm)"}; // Histogram to bookkeep cluster maps histos.add("h2dITSCluMap", "h2dITSCluMap", kTH3D, {axisITSCluMap, axisRadius, axisPtCoarse}); @@ -170,7 +172,7 @@ struct propagatorQa { if (d_bz_input > -990) { d_bz = d_bz_input; o2::parameters::GRPMagField grpmag; - if (fabs(d_bz) > 1e-5) { + if (std::fabs(d_bz) > 1e-5) { grpmag.setL3Current(30000.f / (d_bz / 5.0f)); } o2::base::Propagator::initFieldFromGRP(&grpmag); @@ -210,7 +212,7 @@ struct propagatorQa { initCCDB(bc); std::array dcaInfo; - for (auto& track : tracks) { + for (const auto& track : tracks) { if (track.tpcNClsFound() < minTPCClustersRequired) continue; @@ -273,7 +275,7 @@ struct propagatorQa { // ITS cluster map float lMCCreation = TMath::Sqrt(mctrack.vx() * mctrack.vx() + mctrack.vy() * mctrack.vy()); - histos.fill(HIST("h2dITSCluMap"), (float)track.itsClusterMap(), lMCCreation, track.pt()); + histos.fill(HIST("h2dITSCluMap"), static_cast(track.itsClusterMap()), lMCCreation, track.pt()); if (lIsPrimary) { histos.fill(HIST("hPrimaryDeltaTanLambdaVsPt"), track.tgl(), track.tgl() - lTrackParametrization.getTgl()); @@ -291,12 +293,12 @@ struct propagatorQa { histos.fill(HIST("hPrimaryDeltaDCAs"), lCircleDCA - lDCA); histos.fill(HIST("hPrimaryDeltaDCAsVsPt"), track.pt(), lCircleDCA - lDCA); histos.fill(HIST("hPrimaryRecalculatedDeltaDCAsVsPt"), track.pt(), lRecalculatedDCA - lDCA); - histos.fill(HIST("h2dITSCluMapPrimaries"), (float)track.itsClusterMap(), lMCCreation, track.pt()); + histos.fill(HIST("h2dITSCluMapPrimaries"), static_cast(track.itsClusterMap()), lMCCreation, track.pt()); } // determine if track was used in svertexer bool usedInSVertexer = false; bool lUsedByV0 = false, lUsedByCascade = false; - for (auto& V0 : V0s) { + for (const auto& V0 : V0s) { if (V0.posTrackId() == track.globalIndex()) { lUsedByV0 = true; break; @@ -306,7 +308,7 @@ struct propagatorQa { break; } } - for (auto& cascade : cascades) { + for (const auto& cascade : cascades) { if (cascade.bachelorId() == track.globalIndex()) { lUsedByCascade = true; break; @@ -315,10 +317,10 @@ struct propagatorQa { if (lUsedByV0 || lUsedByCascade) usedInSVertexer = true; - if (usedInSVertexer) + if (usedInSVertexer) { histos.fill(HIST("hUpdateRadiiusedInSVertexer"), lRadiusOfLastUpdate); - if (usedInSVertexer) histos.fill(HIST("hdcaXYusedInSVertexer"), lDCA); + } } } PROCESS_SWITCH(propagatorQa, processMC, "process MC", true); @@ -330,7 +332,7 @@ struct propagatorQa { initCCDB(bc); std::array dcaInfo; - for (auto& track : tracks) { + for (const auto& track : tracks) { if (track.tpcNClsFound() < minTPCClustersRequired) continue; @@ -388,7 +390,7 @@ struct propagatorQa { // ITS cluster map float lMCCreation = 0.1; // dummy value, we don't know - histos.fill(HIST("h2dITSCluMap"), (float)track.itsClusterMap(), lMCCreation, track.pt()); + histos.fill(HIST("h2dITSCluMap"), static_cast(track.itsClusterMap()), lMCCreation, track.pt()); // A hack: use DCA as equiv to primary if (TMath::Abs(lDCA) < 0.05) { // 500 microns @@ -406,13 +408,13 @@ struct propagatorQa { histos.fill(HIST("hPrimaryDeltaDCAs"), lCircleDCA - lDCA); histos.fill(HIST("hPrimaryDeltaDCAsVsPt"), track.pt(), lCircleDCA - lDCA); histos.fill(HIST("hPrimaryRecalculatedDeltaDCAsVsPt"), track.pt(), lRecalculatedDCA - lDCA); - histos.fill(HIST("h2dITSCluMapPrimaries"), (float)track.itsClusterMap(), lMCCreation, track.pt()); + histos.fill(HIST("h2dITSCluMapPrimaries"), static_cast(track.itsClusterMap()), lMCCreation, track.pt()); } // determine if track was used in svertexer bool usedInSVertexer = false; bool lUsedByV0 = false, lUsedByCascade = false; - for (auto& V0 : V0s) { + for (const auto& V0 : V0s) { if (V0.posTrackId() == track.globalIndex()) { lUsedByV0 = true; break; @@ -422,7 +424,7 @@ struct propagatorQa { break; } } - for (auto& cascade : cascades) { + for (const auto& cascade : cascades) { if (cascade.bachelorId() == track.globalIndex()) { lUsedByCascade = true; break; @@ -431,10 +433,10 @@ struct propagatorQa { if (lUsedByV0 || lUsedByCascade) usedInSVertexer = true; - if (usedInSVertexer) + if (usedInSVertexer) { histos.fill(HIST("hUpdateRadiiusedInSVertexer"), lRadiusOfLastUpdate); - if (usedInSVertexer) histos.fill(HIST("hdcaXYusedInSVertexer"), lDCA); + } } } PROCESS_SWITCH(propagatorQa, processData, "process data", false); @@ -446,7 +448,7 @@ struct propagatorQa { initCCDB(bc); std::array dcaInfo; - for (auto& trackIU : tracksIU) { + for (const auto& trackIU : tracksIU) { if (trackIU.tpcNClsFound() < minTPCClustersRequired) continue; // skip if not enough TPC clusters diff --git a/Common/Tasks/trackqa.cxx b/Common/Tasks/trackqa.cxx index d10d42af8da..788fba7e29b 100644 --- a/Common/Tasks/trackqa.cxx +++ b/Common/Tasks/trackqa.cxx @@ -13,15 +13,25 @@ // Task producing basic tracking qa histograms // +#include "Common/Core/TrackSelection.h" +#include "Common/Core/TrackSelectionDefaults.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + #include // std::swap #include -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/TrackSelectionDefaults.h" +#include using namespace o2; using namespace o2::framework; @@ -34,7 +44,7 @@ void customize(std::vector& workflowOptions) {"add-cut-qa", VariantType::Int, 0, {"Add track cut QA histograms."}}}; std::swap(workflowOptions, options); } -#include "Framework/runDataProcessing.h" +#include //**************************************************************************************** /** @@ -105,7 +115,7 @@ struct TrackQa { histos.fill(HIST("TrackPar/snp"), track.snp()); histos.fill(HIST("TrackPar/tgl"), track.tgl()); for (unsigned int i = 0; i < 32; i++) { - if (track.flags() & (1 << i)) { + if (track.flags() & (1u << i)) { histos.fill(HIST("TrackPar/flags"), i); } } diff --git a/Common/Tools/EventSelectionTools.h b/Common/Tools/EventSelectionTools.h index eef9ddaf7f6..a798e1b7142 100644 --- a/Common/Tools/EventSelectionTools.h +++ b/Common/Tools/EventSelectionTools.h @@ -19,33 +19,35 @@ #define bitcheck(var, nbit) ((var) & (static_cast(1) << (nbit))) #define bitcheck64(var, nbit) ((var) & (static_cast(1) << (nbit))) -#include "MetadataHelper.h" -#include "TableHelper.h" - #include "Common/CCDB/EventSelectionParams.h" #include "Common/CCDB/TriggerAliases.h" +#include "Common/Core/MetadataHelper.h" +#include "Common/Core/TableHelper.h" #include "Common/DataModel/EventSelection.h" -#include "CCDB/BasicCCDBManager.h" -#include "CommonConstants/LHCConstants.h" -#include "DataFormatsCTP/Configuration.h" -#include "DataFormatsCTP/Scalers.h" -#include "DataFormatsFT0/Digit.h" -#include "DataFormatsITSMFT/NoiseMap.h" // missing include in TimeDeadMap.h -#include "DataFormatsITSMFT/TimeDeadMap.h" -#include "DataFormatsParameters/AggregatedRunInfo.h" -#include "DataFormatsParameters/GRPECSObject.h" -#include "DataFormatsParameters/GRPLHCIFData.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/HistogramRegistry.h" -#include "ITSMFTBase/DPLAlpideParam.h" -#include "ITSMFTReconstruction/ChipMappingITS.h" +#include +#include +#include +#include +#include +#include // missing include in TimeDeadMap.h +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include +#include +#include #include #include +#include //__________________________________________ // MultModule @@ -191,8 +193,9 @@ class BcSelectionModule template bool configure(TCCDB& ccdb, TBCs const& bcs) { - if (bcs.size() == 0) + if (bcs.size() == 0) { return false; + } int run = bcs.iteratorAt(0).runNumber(); if (run != lastRun) { lastRun = run; @@ -266,7 +269,7 @@ class BcSelectionModule if (mapRCT == nullptr) { LOGP(info, "rct object missing... inserting dummy rct flags"); mapRCT = new std::map; - uint32_t dummyValue = 1 << 31; // setting bit 31 to indicate that rct object is missing + uint32_t dummyValue = 1u << 31; // setting bit 31 to indicate that rct object is missing mapRCT->insert(std::pair(sorTimestamp, dummyValue)); } } @@ -623,7 +626,7 @@ class EventSelectionModule std::vector diffVzParMean; // parameterization for mean of diff vZ by FT0 vs by tracks std::vector diffVzParSigma; // parameterization for stddev of diff vZ by FT0 vs by tracks - int32_t findClosest(int64_t globalBC, std::map& bcs) + int32_t findClosest(const int64_t globalBC, const std::map& bcs) { auto it = bcs.lower_bound(globalBC); int64_t bc1 = it->first; @@ -716,6 +719,9 @@ class EventSelectionModule template bool configure(TCCDB& ccdb, TTimestamps const& timestamps, TBCs const& bcs) { + if (bcs.size() == 0) { + return false; + } int run = bcs.iteratorAt(0).runNumber(); // extract bc pattern from CCDB for data or anchored MC only if (run != lastRun && run >= run3min) { @@ -1364,11 +1370,11 @@ class EventSelectionModule // compare zVtx from FT0 and from PV bool isGoodZvtxFT0vsPV = 0; if (bcselEntry.foundFT0Id > -1) { - auto foundFT0 = ft0s.rawIteratorAt(bcselEntry.foundFT0Id); - float diffVz = foundFT0.posZ() - col.posZ(); - if (runLightIons == -1) + auto foundFT0Inner = ft0s.rawIteratorAt(bcselEntry.foundFT0Id); + float diffVz = foundFT0Inner.posZ() - col.posZ(); + if (runLightIons == -1) { isGoodZvtxFT0vsPV = std::fabs(diffVz) < evselOpts.maxDiffZvtxFT0vsPV; - else { // special treatment of light ion runs + } else { // special treatment of light ion runs float multT0A = bc.ft0().sumAmpA(); float multT0C = bc.ft0().sumAmpC(); float T0M = multT0A + multT0C; @@ -1540,11 +1546,13 @@ class LumiModule template bool configure(TCCDB& ccdb, TTimestamps const& timestamps, TBCs const& bcs) { - if (bcs.size() == 0) + if (bcs.size() == 0) { return false; + } int run = bcs.iteratorAt(0).runNumber(); - if (run < 500000) // o2-linter: disable=magic-number (skip for unanchored MCs) + if (run < 500000) { // o2-linter: disable=magic-number (skip for unanchored MCs) return false; + } if (run != lastRun && run >= 520259) { // o2-linter: disable=magic-number (scalers available for runs above 520120) lastRun = run; int64_t ts = timestamps[0]; diff --git a/Common/Tools/MultModule.h b/Common/Tools/MultModule.h index 2250717a601..d37f37a11fb 100644 --- a/Common/Tools/MultModule.h +++ b/Common/Tools/MultModule.h @@ -16,22 +16,26 @@ #ifndef COMMON_TOOLS_MULTMODULE_H_ #define COMMON_TOOLS_MULTMODULE_H_ -#include -#include -#include -#include -#include -#include -#include -#include "Framework/AnalysisDataModel.h" -#include "Framework/Configurable.h" -#include "Framework/HistogramSpec.h" -#include "TableHelper.h" +#include "PWGMM/Mult/DataModel/bestCollisionTable.h" + #include "Common/Core/TPCVDriftManager.h" -#include "Common/DataModel/Multiplicity.h" +#include "Common/Core/TableHelper.h" #include "Common/DataModel/Centrality.h" -#include "PWGMM/Mult/DataModel/bestCollisionTable.h" -#include "TFormula.h" +#include "Common/DataModel/Multiplicity.h" + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include //__________________________________________ // MultModule @@ -435,7 +439,7 @@ class MultModule internalOpts.mEnabledTables.resize(nTablesConst, 0); LOGF(info, "Configuring tables to generate"); - auto& workflows = context.services().template get(); + const auto& workflows = context.services().template get(); TString listOfRequestors[nTablesConst]; for (int i = 0; i < nTablesConst; i++) { @@ -1246,7 +1250,7 @@ class MultModule auto populateTable = [&](auto& table, struct CalibrationInfo& estimator, float multiplicity, bool isInelGt0) { const bool assignOutOfRange = internalOpts.embedINELgtZEROselection && !isInelGt0; - auto scaleMC = [](float x, float pars[6]) { + auto scaleMC = [](float x, const float pars[6]) { return std::pow(((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4], 1.0f / pars[5]); }; @@ -1331,7 +1335,7 @@ class MultModule const auto& firstbc = bcs.begin(); ConfigureCentralityRun2(ccdb, metadataInfo, firstbc); - auto scaleMC = [](float x, float pars[6]) { + auto scaleMC = [](float x, const float pars[6]) { return std::pow(((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4], 1.0f / pars[5]); }; diff --git a/Common/Tools/Multiplicity/multCalibrator.cxx b/Common/Tools/Multiplicity/multCalibrator.cxx index e9931c0389f..493a3d5feac 100644 --- a/Common/Tools/Multiplicity/multCalibrator.cxx +++ b/Common/Tools/Multiplicity/multCalibrator.cxx @@ -16,17 +16,20 @@ // - victor.gonzalez@cern.ch // - david.dobrigkeit.chinellato@cern.ch // -#include "TList.h" -#include "TDirectory.h" -#include "TFile.h" -#include "TH1F.h" -#include "TH1D.h" -#include "TProfile.h" -#include "TStopwatch.h" -#include "TArrayL64.h" -#include "TArrayF.h" #include "multCalibrator.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include // FIXME + using namespace std; const TString multCalibrator::fCentEstimName[kNCentEstim] = { @@ -100,10 +103,10 @@ Bool_t multCalibrator::Calibrate() return kFALSE; } - //Step 1: verify if input file contains desired histograms + // Step 1: verify if input file contains desired histograms TH1D* hRaw[kNCentEstim]; for (Int_t iv = 0; iv < kNCentEstim; iv++) { - hRaw[iv] = (TH1D*)fileInput->Get(Form("multiplicity-qa/multiplicityQa/h%s", fCentEstimName[iv].Data())); + hRaw[iv] = reinterpret_cast(fileInput->Get(Form("multiplicity-qa/multiplicityQa/h%s", fCentEstimName[iv].Data()))); if (!hRaw[iv]) { cout << Form("File does not contain histogram h%s, which is necessary for calibration!", fCentEstimName[iv].Data()) << endl; return kFALSE; @@ -112,7 +115,7 @@ Bool_t multCalibrator::Calibrate() cout << "Histograms loaded! Will now calibrate..." << endl; - //Create output file + // Create output file TFile* fOut = new TFile(fOutputFileName.Data(), "RECREATE"); TH1F* hCalib[kNCentEstim]; for (Int_t iv = 0; iv < kNCentEstim; iv++) { @@ -129,7 +132,7 @@ Bool_t multCalibrator::Calibrate() Double_t multCalibrator::GetRawMax(TH1* histo) { - //This function gets the max X value (right edge) which is filled. + // This function gets the max X value (right edge) which is filled. for (Int_t ii = histo->GetNbinsX(); ii > 0; ii--) { if (histo->GetBinContent(ii) < 1e-10) return histo->GetBinLowEdge(ii + 1); @@ -139,24 +142,24 @@ Double_t multCalibrator::GetRawMax(TH1* histo) Double_t multCalibrator::GetBoundaryForPercentile(TH1* histo, Double_t lPercentileRequested, Double_t& lPrecisionEstimate) { - //This function returns the boundary for a specific percentile. - //It uses a linear interpolation in an attempt to get more precision - //than the binning of the histogram used for quantiling. + // This function returns the boundary for a specific percentile. + // It uses a linear interpolation in an attempt to get more precision + // than the binning of the histogram used for quantiling. // - //It also estimates a certain level of precision of the procedure - //by explicitly comparing the bin content of the bins around the boundary - //with the entire cross section, effectively reporting back a percentage - //that corresponds to those bins. If this percentage is O(percentile bin - //width requested), then the user should worry and we print out a warning. + // It also estimates a certain level of precision of the procedure + // by explicitly comparing the bin content of the bins around the boundary + // with the entire cross section, effectively reporting back a percentage + // that corresponds to those bins. If this percentage is O(percentile bin + // width requested), then the user should worry and we print out a warning. const Double_t lPrecisionConstant = 2.0; Double_t lRawMax = GetRawMax(histo); if (lPercentileRequested < 1e-7) - return lRawMax; //safeguard + return lRawMax; // safeguard if (lPercentileRequested > 100 - 1e-7) - return 0.0; //safeguard + return 0.0; // safeguard Double_t lReturnValue = 0.0; Double_t lPercentile = 100.0 - lPercentileRequested; @@ -182,7 +185,7 @@ Double_t multCalibrator::GetBoundaryForPercentile(TH1* histo, Double_t lPercenti for (Long_t ibin = lFirstBin; ibin < lNBins; ibin++) { lCount += histo->GetBinContent(ibin); if (lCount >= lCountDesired) { - //Found bin I am looking for! + // Found bin I am looking for! Double_t lWidth = histo->GetBinWidth(ibin); Double_t lLeftPercentile = 100. * (lCount - histo->GetBinContent(ibin)) / lHadronicTotal; Double_t lRightPercentile = 100. * lCount / lHadronicTotal; @@ -200,12 +203,12 @@ Double_t multCalibrator::GetBoundaryForPercentile(TH1* histo, Double_t lPercenti //________________________________________________________________ void multCalibrator::SetStandardAdaptiveBoundaries() { - //Function to set standard adaptive boundaries - //Typically used in pp, goes to 0.001% binning for highest multiplicity + // Function to set standard adaptive boundaries + // Typically used in pp, goes to 0.001% binning for highest multiplicity lNDesiredBoundaries = 0; lDesiredBoundaries = new Double_t[1100]; lDesiredBoundaries[0] = 100; - //From Low To High Multiplicity + // From Low To High Multiplicity for (Int_t ib = 1; ib < 91; ib++) { lNDesiredBoundaries++; lDesiredBoundaries[lNDesiredBoundaries] = lDesiredBoundaries[lNDesiredBoundaries - 1] - 1.0; @@ -229,12 +232,12 @@ void multCalibrator::SetStandardAdaptiveBoundaries() //________________________________________________________________ void multCalibrator::SetStandardOnePercentBoundaries() { - //Function to set standard adaptive boundaries - //Typically used in pp, goes to 0.001% binning for highest multiplicity + // Function to set standard adaptive boundaries + // Typically used in pp, goes to 0.001% binning for highest multiplicity lNDesiredBoundaries = 101; lDesiredBoundaries = new Double_t[101]; lDesiredBoundaries[0] = 100; - //From Low To High Multiplicity + // From Low To High Multiplicity for (Int_t ib = 1; ib < 101; ib++) lDesiredBoundaries[ib] = lDesiredBoundaries[ib - 1] - 1.0; cout << "Set standard 1%-wide percentile boundaries! Nboundaries: " << lNDesiredBoundaries << endl; @@ -243,10 +246,10 @@ void multCalibrator::SetStandardOnePercentBoundaries() //________________________________________________________________ TH1F* multCalibrator::GetCalibrationHistogram(TH1* histoRaw, TString lHistoName) { - //This function returns a calibration histogram + // This function returns a calibration histogram //(pp or p-Pb like, no anchor point considered) - //Reset + recreate precision histogram + // Reset + recreate precision histogram ResetPrecisionHistogram(); // Consistency check @@ -256,10 +259,10 @@ TH1F* multCalibrator::GetCalibrationHistogram(TH1* histoRaw, TString lHistoName) cout << "Last boundary: " << lDesiredBoundaries[0] << endl; } - //Aux vars + // Aux vars Double_t lMiddleOfBins[1000]; for (Long_t lB = 1; lB < lNDesiredBoundaries; lB++) { - //place squarely at the middle to ensure it's all fine + // place squarely at the middle to ensure it's all fine lMiddleOfBins[lB - 1] = 0.5 * (lDesiredBoundaries[lB] + lDesiredBoundaries[lB - 1]); } Double_t lBounds[lNDesiredBoundaries + 1]; @@ -276,7 +279,7 @@ TH1F* multCalibrator::GetCalibrationHistogram(TH1* histoRaw, TString lHistoName) lBounds[lDisplacedii] = GetBoundaryForPercentile(histoRaw, lDesiredBoundaries[ii], lPrecision[ii]); TString lPrecisionString = "(Precision OK)"; if (ii != 0 && ii != lNDesiredBoundaries - 1) { - //check precision, please + // check precision, please if (lPrecision[ii] / TMath::Abs(lDesiredBoundaries[ii + 1] - lDesiredBoundaries[ii]) > fkPrecisionWarningThreshold) lPrecisionString = "(WARNING: BINNING MAY LEAD TO IMPRECISION!)"; if (lPrecision[ii] / TMath::Abs(lDesiredBoundaries[ii - 1] - lDesiredBoundaries[ii]) > fkPrecisionWarningThreshold) @@ -302,8 +305,8 @@ void multCalibrator::ResetPrecisionHistogram() delete fPrecisionHistogram; fPrecisionHistogram = 0x0; } - if (lNDesiredBoundaries > 0) { //only if initialized - //invert boundaries, please + if (lNDesiredBoundaries > 0) { // only if initialized + // invert boundaries, please Double_t lInverseDesiredBoundaries[1100]; for (Int_t ii = 0; ii < lNDesiredBoundaries; ii++) { lInverseDesiredBoundaries[ii] = lDesiredBoundaries[lNDesiredBoundaries - (ii + 1)]; diff --git a/Common/Tools/Multiplicity/multCalibrator.h b/Common/Tools/Multiplicity/multCalibrator.h index b5c618bdc3d..1ad8839a1f1 100644 --- a/Common/Tools/Multiplicity/multCalibrator.h +++ b/Common/Tools/Multiplicity/multCalibrator.h @@ -16,33 +16,33 @@ // - victor.gonzalez@cern.ch // - david.dobrigkeit.chinellato@cern.ch // -#ifndef MULTCALIBRATOR_H -#define MULTCALIBRATOR_H +#ifndef COMMON_TOOLS_MULTIPLICITY_MULTCALIBRATOR_H_ +#define COMMON_TOOLS_MULTIPLICITY_MULTCALIBRATOR_H_ + +#include +#include #include #include -#include "TNamed.h" -#include "TH1D.h" - class multCalibrator : public TNamed { public: - //Constructors/Destructor + // Constructors/Destructor multCalibrator(); - multCalibrator(const char* name, const char* title = "Multiplicity Calibration Class"); + explicit multCalibrator(const char* name, const char* title = "Multiplicity Calibration Class"); ~multCalibrator(); - //void Print(Option_t *option="") const; + // void Print(Option_t *option="") const; //_________________________________________________________________________ - //Interface: steering functions to be used in calibration macro + // Interface: steering functions to be used in calibration macro - //Set Filenames + // Set Filenames void SetInputFile(TString lFile) { fInputFileName = lFile.Data(); } void SetOutputFile(TString lFile) { fOutputFileName = lFile.Data(); } - //Set Boundaries to find + // Set Boundaries to find void SetBoundaries(Long_t lNB, Double_t* lB) { if (lNB < 2 || lNB > 1e+6) { @@ -56,24 +56,24 @@ class multCalibrator : public TNamed void SetAnchorPointRaw(Float_t lRaw) { fAnchorPointValue = lRaw; } void SetAnchorPointPercentage(Float_t lPer) { fAnchorPointPercentage = lPer; } - void SetStandardAdaptiveBoundaries(); //standard adaptive (pp-like) - void SetStandardOnePercentBoundaries(); //standard 1% (Pb-Pb like) + void SetStandardAdaptiveBoundaries(); // standard adaptive (pp-like) + void SetStandardOnePercentBoundaries(); // standard 1% (Pb-Pb like) - //Master Function in this Class: To be called once filenames are set + // Master Function in this Class: To be called once filenames are set Bool_t Calibrate(); - //Aux function. Keep public, accessible outside as rather useful utility + // Aux function. Keep public, accessible outside as rather useful utility TH1F* GetCalibrationHistogram(TH1* histoRaw, TString lHistoName = "hCalib"); - //Auxiliary functions + // Auxiliary functions Double_t GetRawMax(TH1* histo); Double_t GetBoundaryForPercentile(TH1* histo, Double_t lPercentileRequested, Double_t& lPrecisionEstimate); - //Precision bookkeeping - TH1D* GetPrecisionHistogram() { return fPrecisionHistogram; }; //gets precision histogram from current object - void ResetPrecisionHistogram(); //Reset precision histogram, if it exists + // Precision bookkeeping + TH1D* GetPrecisionHistogram() { return fPrecisionHistogram; } // gets precision histogram from current object + void ResetPrecisionHistogram(); // Reset precision histogram, if it exists - //Aliases for centrality estimators + // Aliases for centrality estimators enum fCentEstim { kCentRawV0M = 0, kCentRawT0M, @@ -89,7 +89,7 @@ class multCalibrator : public TNamed static const TString fCentEstimName[kNCentEstim]; //! name (internal) private: - //Calibration Boundaries to locate + // Calibration Boundaries to locate Double_t* lDesiredBoundaries; Long_t lNDesiredBoundaries; Double_t fkPrecisionWarningThreshold; @@ -105,11 +105,11 @@ class multCalibrator : public TNamed // TList object for storing histograms TList* fCalibHists; - TH1D* fPrecisionHistogram; //for bookkeeping of precision report + TH1D* fPrecisionHistogram; // for bookkeeping of precision report ClassDef(multCalibrator, 1); //(this classdef is only for bookkeeping, class will not usually // be streamed according to current workflow except in very specific // tests!) }; -#endif +#endif // COMMON_TOOLS_MULTIPLICITY_MULTCALIBRATOR_H_ diff --git a/Common/Tools/Multiplicity/multGlauberNBDFitter.cxx b/Common/Tools/Multiplicity/multGlauberNBDFitter.cxx index a765db72448..dbdefd874d4 100644 --- a/Common/Tools/Multiplicity/multGlauberNBDFitter.cxx +++ b/Common/Tools/Multiplicity/multGlauberNBDFitter.cxx @@ -26,13 +26,16 @@ **********************************************/ #include "multGlauberNBDFitter.h" -#include "TList.h" -#include "TFile.h" -#include "TF1.h" -#include "TStopwatch.h" -#include "TVirtualFitter.h" -#include "TProfile.h" -#include "TFitResult.h" + +#include +#include +#include +#include +#include +#include +#include + +#include // FIXME using namespace std; @@ -42,6 +45,7 @@ multGlauberNBDFitter::multGlauberNBDFitter() : TNamed(), fNBD(0x0), fhNanc(0x0), fhNpNc(0x0), + fhV0M(0x0), ffChanged(kTRUE), fCurrentf(-1), fAncestorMode(2), @@ -63,14 +67,14 @@ multGlauberNBDFitter::multGlauberNBDFitter() : TNamed(), fNcoll = new Double_t[fMaxNpNcPairs]; fContent = new Long_t[fMaxNpNcPairs]; - //Ancestor histo + // Ancestor histo fhNanc = new TH1D("fhNanc", "", 1000, -0.5, 999.5); - //NBD + // NBD fNBD = new TF1("fNBD", "ROOT::Math::negative_binomial_pdf(x,[0],[1])", 0, 45000); fNBD->SetNpx(45000); - //master function + // master function fGlauberNBD = new TF1("fGlauberNBD", this, &multGlauberNBDFitter::ProbDistrib, 0, 50000, 4, "multGlauberNBDFitter", "ProbDistrib"); fGlauberNBD->SetParameter(0, fMu); @@ -89,6 +93,7 @@ multGlauberNBDFitter::multGlauberNBDFitter(const char* name, const char* title) fNBD(0x0), fhNanc(0x0), fhNpNc(0x0), + fhV0M(0x0), ffChanged(kTRUE), fCurrentf(-1), fAncestorMode(2), @@ -105,19 +110,19 @@ multGlauberNBDFitter::multGlauberNBDFitter(const char* name, const char* title) fFitOptions("R0"), fFitNpx(5000) { - //Named constructor + // Named constructor fNpart = new Double_t[fMaxNpNcPairs]; fNcoll = new Double_t[fMaxNpNcPairs]; fContent = new Long_t[fMaxNpNcPairs]; - //Ancestor histo - //fhNanc = new TH1D("fhNanc", "", fAncestorMode==2?10000:1000, -0.5, 999.5); + // Ancestor histo + // fhNanc = new TH1D("fhNanc", "", fAncestorMode==2?10000:1000, -0.5, 999.5); - //NBD + // NBD fNBD = new TF1("fNBD", "ROOT::Math::negative_binomial_pdf(x,[0],[1])", 0, 45000); fNBD->SetNpx(45000); - //master function + // master function fGlauberNBD = new TF1("fGlauberNBD", this, &multGlauberNBDFitter::ProbDistrib, 0, 50000, 5, "multGlauberNBDFitter", "ProbDistrib"); fGlauberNBD->SetParameter(0, fMu); @@ -157,18 +162,18 @@ multGlauberNBDFitter::~multGlauberNBDFitter() //______________________________________________________ Double_t multGlauberNBDFitter::ProbDistrib(Double_t* x, Double_t* par) -//Master fitter function +// Master fitter function { Double_t lMultValue = x[0]; Double_t lProbability = 0.0; ffChanged = kTRUE; const Double_t lAlmost0 = 1.e-13; - //Comment this line in order to make the code evaluate Nancestor all the time + // Comment this line in order to make the code evaluate Nancestor all the time if (TMath::Abs(fCurrentf - par[2]) < lAlmost0) ffChanged = kFALSE; //______________________________________________________ - //Recalculate the ancestor distribution in case f changed + // Recalculate the ancestor distribution in case f changed if (ffChanged) { fCurrentf = par[2]; fhNanc->Reset(); @@ -192,12 +197,12 @@ Double_t multGlauberNBDFitter::ProbDistrib(Double_t* x, Double_t* par) fhNanc->Scale(1. / fhNanc->Integral()); } //______________________________________________________ - //Actually evaluate function + // Actually evaluate function Int_t lStartBin = fhNanc->FindBin(0.0) + 1; for (Long_t iNanc = lStartBin; iNanc < fhNanc->GetNbinsX() + 1; iNanc++) { Double_t lNancestors = fhNanc->GetBinCenter(iNanc); Double_t lNancestorCount = fhNanc->GetBinContent(iNanc); - //if(lNancestorCount<1e-12&&lNancestors>10) break; + // if(lNancestorCount<1e-12&&lNancestors>10) break; // allow for variable mu in case requested Double_t lThisMu = (((Double_t)lNancestors)) * (par[0] + par[4] * lNancestors); @@ -219,7 +224,7 @@ Bool_t multGlauberNBDFitter::SetNpartNcollCorrelation(TH2* hNpNc) { Bool_t lReturnValue = kTRUE; if (hNpNc) { - fhNpNc = (TH2*)hNpNc; + fhNpNc = reinterpret_cast(hNpNc); } else { lReturnValue = kFALSE; } @@ -231,7 +236,7 @@ Bool_t multGlauberNBDFitter::SetInputV0M(TH1* hV0M) { Bool_t lReturnValue = kTRUE; if (hV0M) { - fhV0M = (TH1*)hV0M; + fhV0M = reinterpret_cast(hV0M); } else { lReturnValue = kFALSE; } @@ -279,7 +284,7 @@ void multGlauberNBDFitter::InitAncestor() Bool_t multGlauberNBDFitter::DoFit() { InitAncestor(); - //Try very hard, please + // Try very hard, please TVirtualFitter::SetMaxIterations(5000000); if (!InitializeNpNc()) { cout << "---> Initialization of Npart x Ncoll correlation info failed!" << endl; @@ -317,12 +322,12 @@ Bool_t multGlauberNBDFitter::DoFit() //________________________________________________________________ Bool_t multGlauberNBDFitter::InitializeNpNc() { - //This function initializes fhNpNc - //Warning: X == Npart, Y == Ncoll + // This function initializes fhNpNc + // Warning: X == Npart, Y == Ncoll Bool_t lReturnValue = kFALSE; if (fhNpNc) { fNNpNcPairs = 0; - //Sweep all allowed values of Npart, Ncoll; find counters + // Sweep all allowed values of Npart, Ncoll; find counters for (int xbin = 1; xbin < 500; xbin++) { for (int ybin = 1; ybin < 3000; ybin++) { if (fhNpNc->GetBinContent(fhNpNc->FindBin(xbin, ybin)) != 0) { @@ -345,12 +350,12 @@ Bool_t multGlauberNBDFitter::InitializeNpNc() //________________________________________________________________ Double_t multGlauberNBDFitter::ContinuousNBD(Double_t n, Double_t mu, Double_t k) { - //Adaptation of the negative binomial distribution - //for non-integer arguments: analytical continuation + // Adaptation of the negative binomial distribution + // for non-integer arguments: analytical continuation // - //This function would actually also be fine with integers; - //in fact it is equivalent to that if 'n' is typecast as - //an integer prior to use + // This function would actually also be fine with integers; + // in fact it is equivalent to that if 'n' is typecast as + // an integer prior to use Double_t F; Double_t f; @@ -390,10 +395,10 @@ void multGlauberNBDFitter::CalculateAvNpNc(TProfile* lNPartProf, TProfile* lNCol cout << "Glauber NBD norm ..........: " << fnorm << endl; cout << "Glauber NBD dmu/dNanc .....: " << fdMu << endl; - //2-fold nested loop: - // + looping over all Nancestor combinations - // + looping over all possible final multiplicities - // ^---> final product already multiplicity-binned + // 2-fold nested loop: + // + looping over all Nancestor combinations + // + looping over all possible final multiplicities + // ^---> final product already multiplicity-binned //______________________________________________________ if (lLoRange < -1 && lHiRange < -1) { diff --git a/Common/Tools/Multiplicity/multGlauberNBDFitter.h b/Common/Tools/Multiplicity/multGlauberNBDFitter.h index 42d5cab046f..951be39bd50 100644 --- a/Common/Tools/Multiplicity/multGlauberNBDFitter.h +++ b/Common/Tools/Multiplicity/multGlauberNBDFitter.h @@ -9,59 +9,60 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // -#ifndef MULTGLAUBERNBDFITTER_H -#define MULTGLAUBERNBDFITTER_H +#ifndef COMMON_TOOLS_MULTIPLICITY_MULTGLAUBERNBDFITTER_H_ +#define COMMON_TOOLS_MULTIPLICITY_MULTGLAUBERNBDFITTER_H_ + +#include +#include +#include +#include +#include +#include #include -#include "TNamed.h" -#include "TF1.h" -#include "TH1.h" -#include "TH1D.h" -#include "TH2.h" -#include "TProfile.h" class multGlauberNBDFitter : public TNamed { public: - //basic functionality + // basic functionality multGlauberNBDFitter(); - multGlauberNBDFitter(const char* name, const char* title = "Glauber+NBD fitter"); + explicit multGlauberNBDFitter(const char* name, const char* title = "Glauber+NBD fitter"); ~multGlauberNBDFitter(); - //Master fitter function + // Master fitter function Double_t ProbDistrib(Double_t* x, Double_t* par); void InitAncestor(); - //Do Fit: where everything happens + // Do Fit: where everything happens Bool_t DoFit(); - //Set input characteristics: the 2D plot with Npart, Nanc + // Set input characteristics: the 2D plot with Npart, Nanc Bool_t SetNpartNcollCorrelation(TH2* hNpNc); - //Set main input to be fitted (the V0M distribution) + // Set main input to be fitted (the V0M distribution) Bool_t SetInputV0M(TH1* hV0M); - //Interface to get funtions if asked to + // Interface to get funtions if asked to TF1* GetNBD(); TF1* GetGlauberNBD(); - //Helper + // Helper Bool_t InitializeNpNc(); - //Interface for debug + // Interface for debug void SetAncestorMode(Int_t lAncMode = 0) { fAncestorMode = lAncMode; } Int_t GetAncestorMode() { return fAncestorMode; } TH1D* GetAncestorHistogram() { return fhNanc; } - //Interface to set vals + // Interface to set vals void SetMu(Double_t lVal) { fMu = lVal; } void Setk(Double_t lVal) { fk = lVal; } void Setf(Double_t lVal) { ff = lVal; } void SetNorm(Double_t lVal) { fnorm = lVal; } - //Interface to get vals + // Interface to get vals Double_t GetMu() { return fMu; } Double_t Getk() { return fk; } Double_t Getf() { return ff; } @@ -71,41 +72,41 @@ class multGlauberNBDFitter : public TNamed void SetFitOptions(TString lOpt); void SetFitNpx(Long_t lNpx); - //For ancestor mode 2 + // For ancestor mode 2 Double_t ContinuousNBD(Double_t n, Double_t mu, Double_t k); - //For estimating Npart, Ncoll in multiplicity bins + // For estimating Npart, Ncoll in multiplicity bins void CalculateAvNpNc(TProfile* lNPartProf, TProfile* lNCollProf, TH2F* lNPart2DPlot, TH2F* lNColl2DPlot, TH1F* hPercentileMap, Double_t lLoRange = -1, Double_t lHiRange = -1); - //void Print(Option_t *option="") const; + // void Print(Option_t *option="") const; private: - //This function serves as the (analytical) NBD + // This function serves as the (analytical) NBD TF1* fNBD; - //This function is the key fitting function + // This function is the key fitting function TF1* fGlauberNBD; - //Reference histo - TH1D* fhNanc; //basic ancestor distribution - TH2* fhNpNc; //correlation between Npart and Ncoll - TH1* fhV0M; //basic ancestor distribution + // Reference histo + TH1D* fhNanc; // basic ancestor distribution + TH2* fhNpNc; // correlation between Npart and Ncoll + TH1* fhV0M; // basic ancestor distribution - //Fitting utilities + // Fitting utilities Bool_t ffChanged; Double_t fCurrentf; - //0: truncation, 1: rounding, 2: analytical continuation + // 0: truncation, 1: rounding, 2: analytical continuation Int_t fAncestorMode; - //Buffer for (Npart, Ncoll) pairs in memory + // Buffer for (Npart, Ncoll) pairs in memory Double_t* fNpart; Double_t* fNcoll; Long_t* fContent; - Long_t fNNpNcPairs; //number of pairs to use + Long_t fNNpNcPairs; // number of pairs to use Long_t fMaxNpNcPairs; - //The actual output: mu, k, f, norm + // The actual output: mu, k, f, norm Double_t fMu; Double_t fdMu; // variable mu option Double_t fk; @@ -117,4 +118,4 @@ class multGlauberNBDFitter : public TNamed ClassDef(multGlauberNBDFitter, 1); }; -#endif +#endif // COMMON_TOOLS_MULTIPLICITY_MULTGLAUBERNBDFITTER_H_ diff --git a/Common/Tools/Multiplicity/multMCCalibrator.cxx b/Common/Tools/Multiplicity/multMCCalibrator.cxx index 5b490daf77d..7e93e9b023e 100644 --- a/Common/Tools/Multiplicity/multMCCalibrator.cxx +++ b/Common/Tools/Multiplicity/multMCCalibrator.cxx @@ -16,19 +16,23 @@ // - victor.gonzalez@cern.ch // - david.dobrigkeit.chinellato@cern.ch // -#include "TList.h" -#include "TDirectory.h" -#include "TFile.h" -#include "TF1.h" -#include "TH1F.h" -#include "TH1D.h" -#include "TProfile.h" -#include "TStopwatch.h" -#include "TArrayL64.h" -#include "TArrayF.h" -#include "multCalibrator.h" #include "multMCCalibrator.h" +#include "multCalibrator.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include // FIXME + using namespace std; multMCCalibrator::multMCCalibrator() : TNamed(), @@ -79,22 +83,22 @@ Bool_t multMCCalibrator::Calibrate() cout << " * Output File............: " << fOutputFileName.Data() << endl; cout << endl; - //Opening data and simulation file... + // Opening data and simulation file... TFile* fileData = new TFile(fDataInputFileName.Data(), "READ"); TFile* fileSim = new TFile(fSimInputFileName.Data(), "READ"); - //Step 1: verify if input file contains desired histograms + // Step 1: verify if input file contains desired histograms TProfile* hProfData[multCalibrator::kNCentEstim]; TProfile* hProfSim[multCalibrator::kNCentEstim]; cout << " * acquiring input profiles..." << endl; for (Int_t iv = 0; iv < multCalibrator::kNCentEstim; iv++) { - hProfData[iv] = (TProfile*)fileData->Get(Form("multiplicity-qa/multiplicityQa/hProf%s", multCalibrator::fCentEstimName[iv].Data())); + hProfData[iv] = reinterpret_cast(fileData->Get(Form("multiplicity-qa/multiplicityQa/hProf%s", multCalibrator::fCentEstimName[iv].Data()))); if (!hProfData[iv]) { cout << Form("Data file does not contain histogram h%s, which is necessary for calibration!", multCalibrator::fCentEstimName[iv].Data()) << endl; return kFALSE; } hProfData[iv]->SetName(Form("hProfData_%s", multCalibrator::fCentEstimName[iv].Data())); - hProfSim[iv] = (TProfile*)fileSim->Get(Form("multiplicity-qa/multiplicityQa/hProf%s", multCalibrator::fCentEstimName[iv].Data())); + hProfSim[iv] = reinterpret_cast(fileSim->Get(Form("multiplicity-qa/multiplicityQa/hProf%s", multCalibrator::fCentEstimName[iv].Data()))); if (!hProfSim[iv]) { cout << Form("Sim file does not contain histogram h%s, which is necessary for calibration!", multCalibrator::fCentEstimName[iv].Data()) << endl; return kFALSE; @@ -135,14 +139,14 @@ Bool_t multMCCalibrator::Calibrate() //________________________________________________________________ TF1* multMCCalibrator::GetFit(TProfile* fProf, Bool_t lQuadratic) { - TString fFormula = "[0]*x"; //old/deprecated (avoid if possible, please) + TString fFormula = "[0]*x"; // old/deprecated (avoid if possible, please) if (lQuadratic) fFormula = "[0]+[1]*TMath::Power(x,[2])"; // Function to return fit function to profile for posterior inversion TF1* fit = new TF1(Form("%s_fit", fProf->GetName()), fFormula.Data(), fProf->GetBinLowEdge(1), fProf->GetBinLowEdge(fProf->GetNbinsX())); - //Guesstimate inclination from data points in profile + // Guesstimate inclination from data points in profile Double_t lMeanInclination = 0; Long_t lInclinationCount = 0; for (Int_t ii = 2; ii < fProf->GetNbinsX(); ii++) { @@ -158,7 +162,7 @@ TF1* multMCCalibrator::GetFit(TProfile* fProf, Bool_t lQuadratic) if (lInclinationCount >= 5) lMeanInclination /= lInclinationCount; - //Give it a little nudge, cause life's hard + // Give it a little nudge, cause life's hard fit->SetParameter(0, 0.0); fit->SetParameter(1, lMeanInclination); fit->SetParameter(2, 1.0); diff --git a/Common/Tools/Multiplicity/multMCCalibrator.h b/Common/Tools/Multiplicity/multMCCalibrator.h index f88bddf98c3..7d355146728 100644 --- a/Common/Tools/Multiplicity/multMCCalibrator.h +++ b/Common/Tools/Multiplicity/multMCCalibrator.h @@ -16,34 +16,35 @@ // - victor.gonzalez@cern.ch // - david.dobrigkeit.chinellato@cern.ch // -#ifndef MULTMCCALIBRATOR_H -#define MULTMCCALIBRATOR_H +#ifndef COMMON_TOOLS_MULTIPLICITY_MULTMCCALIBRATOR_H_ +#define COMMON_TOOLS_MULTIPLICITY_MULTMCCALIBRATOR_H_ -#include -#include "TNamed.h" -#include "TF1.h" -#include "TH1D.h" -#include "TProfile.h" +#include +#include +#include +#include + +#include // FIXME #include class multMCCalibrator : public TNamed { public: - //Constructors/Destructor + // Constructors/Destructor multMCCalibrator(); - multMCCalibrator(const char* name, const char* title = "MC Multiplicity Calibration Class"); + explicit multMCCalibrator(const char* name, const char* title = "MC Multiplicity Calibration Class"); ~multMCCalibrator(); //_________________________________________________________________________ - //Interface: steering functions to be used in calibration macro + // Interface: steering functions to be used in calibration macro - //Set Filenames + // Set Filenames void SetDataInputFile(TString lFile) { fDataInputFileName = lFile.Data(); } void SetSimInputFile(TString lFile) { fSimInputFileName = lFile.Data(); } void SetOutputFile(TString lFile) { fOutputFileName = lFile.Data(); } - //Master Function in this Class: To be called once filenames are set + // Master Function in this Class: To be called once filenames are set Bool_t Calibrate(); TF1* GetFit(TProfile* fProf, Bool_t lQuadratic = kTRUE); @@ -63,4 +64,4 @@ class multMCCalibrator : public TNamed // be streamed according to current workflow except in very specific // tests!) }; -#endif +#endif // COMMON_TOOLS_MULTIPLICITY_MULTMCCALIBRATOR_H_ diff --git a/Common/Tools/PID/handleParamBase.h b/Common/Tools/PID/handleParamBase.h index 01c2a66ab8b..53938f26b7f 100644 --- a/Common/Tools/PID/handleParamBase.h +++ b/Common/Tools/PID/handleParamBase.h @@ -19,12 +19,15 @@ #ifndef COMMON_TOOLS_PID_HANDLEPARAMBASE_H_ #define COMMON_TOOLS_PID_HANDLEPARAMBASE_H_ +#include +#include + +#include + +#include + #include #include -#include "CCDB/CcdbApi.h" -#include -#include "Framework/Logger.h" -#include "TFile.h" // Global executable arguments namespace bpo = boost::program_options; @@ -79,9 +82,9 @@ void setStandardOpt(bpo::options_description& options) } template -T* retrieveFromCCDB(const std::string path, +T* retrieveFromCCDB(const std::string& path, const int64_t timestamp, - std::map metadata) + const std::map& metadata) { std::map headers; LOG(info) << "Object " << path << " for timestamp " << timestamp << " -> " << timeStampToHReadble(timestamp); @@ -99,7 +102,7 @@ T* retrieveFromCCDB(const std::string path, } template -T* retrieveFromCCDB(const std::string path, +T* retrieveFromCCDB(const std::string& path, const int64_t timestamp) { std::map metadata; diff --git a/Common/Tools/TrackPropagationModule.h b/Common/Tools/TrackPropagationModule.h index 305a7c774f2..a08ec358993 100644 --- a/Common/Tools/TrackPropagationModule.h +++ b/Common/Tools/TrackPropagationModule.h @@ -16,16 +16,25 @@ #ifndef COMMON_TOOLS_TRACKPROPAGATIONMODULE_H_ #define COMMON_TOOLS_TRACKPROPAGATIONMODULE_H_ -#include "TableHelper.h" - +#include "Common/Core/TableHelper.h" +#include "Common/DataModel/TrackSelectionTables.h" #include "Common/Tools/TrackTuner.h" -#include "DataFormatsCalibration/MeanVertexObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DetectorsBase/Propagator.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/Configurable.h" -#include "Framework/HistogramSpec.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include #include #include @@ -89,7 +98,7 @@ class TrackPropagationModule std::shared_ptr trackTunedTracks; // Running variables - std::array mDcaInfo; + std::array mDcaInfo{}; o2::dataformats::DCA mDcaInfoCov; o2::dataformats::VertexBase mVtx; o2::track::TrackParametrization mTrackPar; diff --git a/Common/Tools/TrackTuner.h b/Common/Tools/TrackTuner.h index 26937eb9131..60cf377a410 100644 --- a/Common/Tools/TrackTuner.h +++ b/Common/Tools/TrackTuner.h @@ -18,34 +18,37 @@ #ifndef COMMON_TOOLS_TRACKTUNER_H_ #define COMMON_TOOLS_TRACKTUNER_H_ +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include #include #include +#include #include #include #include -#include -#include -#include - -#include "CCDB/BasicCCDBManager.h" -#include "CCDB/CcdbApi.h" -#include "CommonConstants/GeomConstants.h" -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "CommonUtils/NameConf.h" -#include "DataFormatsCalibration/MeanVertexObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/Configurable.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" -#include "Framework/RunningWorkflowInfo.h" -#include "ReconstructionDataFormats/DCA.h" -#include "ReconstructionDataFormats/Track.h" -#include namespace o2::aod { @@ -246,7 +249,7 @@ struct TrackTuner : o2::framework::ConfigurableGroup { LOG(info) << "[TrackTuner]"; LOG(info) << "[TrackTuner] >>> String slices:"; - for (std::string& s : slices) + for (const std::string& s : slices) LOG(info) << "[TrackTuner] " << s; /// check if the number of input parameters is correct @@ -260,7 +263,7 @@ struct TrackTuner : o2::framework::ConfigurableGroup { /// lambda expression to search for the parameter value (as string) in the configuration string auto getValueString = [&](uint8_t iPar) { /// this allows to search the parameter configuration even if they are not written in order - auto it = std::find_if(slices.begin(), slices.end(), [&](std::string s) { return s.find(mapParNames[iPar]) != std::string::npos; }); + auto it = std::find_if(slices.begin(), slices.end(), [&](const std::string& s) { return s.find(mapParNames[iPar]) != std::string::npos; }); if (it == std::end(slices)) { // parameter not found LOG(fatal) << "\"" << mapParNames[iPar] << "\" not found in the configuration string"; @@ -274,7 +277,7 @@ struct TrackTuner : o2::framework::ConfigurableGroup { }; /// further lambda expression to handle bool initialization - auto setBoolFromString = [=](bool& b, std::string str) { + auto setBoolFromString = [=](bool& b, const std::string& str) { if (!str.compare("1") || str.find("true") != std::string::npos || str.find("True") != std::string::npos || str.find("TRUE") != std::string::npos) { b = true; } else if (!str.compare("0") || str.find("false") != std::string::npos || str.find("False") != std::string::npos || str.find("FALSE") != std::string::npos) { diff --git a/Common/Tools/trackSelectionRequest.h b/Common/Tools/trackSelectionRequest.h index 123392611f0..a056eaaaed0 100644 --- a/Common/Tools/trackSelectionRequest.h +++ b/Common/Tools/trackSelectionRequest.h @@ -21,18 +21,20 @@ // Because of this, it is particularly important that the cuts in this object // in an analysis! -#ifndef TRACKSELECTIONREQUEST_H -#define TRACKSELECTIONREQUEST_H +#ifndef COMMON_TOOLS_TRACKSELECTIONREQUEST_H_ +#define COMMON_TOOLS_TRACKSELECTIONREQUEST_H_ -#include -#include #include +#include + +#include + class trackSelectionRequest { public: trackSelectionRequest() - : trackPhysicsType{0}, minPt{0.0}, maxPt{1e+6}, minEta{-100}, maxEta{+100}, maxDCAz{1e+6}, maxDCAxyPtDep{1e+6}, requireTPC{false}, minTPCclusters{-1}, minTPCcrossedrows{-1}, minTPCcrossedrowsoverfindable{0.0}, requireITS{false}, minITSclusters{-1}, maxITSChi2percluster{1e+6} + : trackPhysicsType{0}, minPt{0.0}, maxPt{1e+6}, minEta{-100}, maxEta{+100}, maxDCAz{1e+6}, maxDCAxyPtDep{1e+6}, requireTPC{false}, minTPCclusters{-1}, minTPCcrossedrows{-1}, minTPCcrossedrowsoverfindable{0.0}, maxTPCFractionSharedCls{0.0}, requireITS{false}, minITSclusters{-1}, maxITSChi2percluster{1e+6} { // constructor } @@ -88,7 +90,7 @@ class trackSelectionRequest if (lTrack.eta() > maxEta) return false; // DCA to PV - if (fabs(lTrack.dcaXY()) < maxDCAz) + if (std::fabs(lTrack.dcaXY()) < maxDCAz) return false; // TracksExtra-based if (lTrack.hasTPC() == false && requireTPC) @@ -163,4 +165,4 @@ class trackSelectionRequest std::ostream& operator<<(std::ostream& os, trackSelectionRequest const& c); -#endif // TRACKSELECTIONREQUEST_H +#endif // COMMON_TOOLS_TRACKSELECTIONREQUEST_H_ From 9b714f776f692fedacbaeeca1a3cf4d787180e18 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 15 Aug 2025 23:26:12 +0200 Subject: [PATCH 072/986] [PWGEM/Dilepton] remove unnecessary std::find (#12594) --- PWGEM/Dilepton/Core/DileptonHadronMPC.h | 11 ++--------- PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h | 10 +--------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/PWGEM/Dilepton/Core/DileptonHadronMPC.h b/PWGEM/Dilepton/Core/DileptonHadronMPC.h index 335b50af12d..5f157ade948 100644 --- a/PWGEM/Dilepton/Core/DileptonHadronMPC.h +++ b/PWGEM/Dilepton/Core/DileptonHadronMPC.h @@ -453,8 +453,6 @@ struct DileptonHadronMPC { used_trackIds.clear(); used_trackIds.shrink_to_fit(); - used_refTrackIds.clear(); - used_refTrackIds.shrink_to_fit(); } void addhistograms() @@ -1063,7 +1061,6 @@ struct DileptonHadronMPC { std::map, uint64_t> map_mixed_eventId_to_globalBC; std::vector> used_trackIds; - std::vector> used_refTrackIds; int ndf = 0; template @@ -1142,12 +1139,8 @@ struct DileptonHadronMPC { // store ref tracks for mixed event in case of kAzimuthalCorrelation if (cfgDoMix && cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kAzimuthalCorrelation)) { - std::pair pair_tmp_refTrack = std::make_pair(ndf, track.globalIndex()); - if (std::find(used_refTrackIds.begin(), used_refTrackIds.end(), pair_tmp_refTrack) == used_refTrackIds.end()) { - used_refTrackIds.emplace_back(pair_tmp_refTrack); - emh_ref->AddTrackToEventPool(key_df_collision, EMTrack(ndf, track.globalIndex(), collision.globalIndex(), track.trackId(), track.pt(), track.eta(), track.phi(), 0.139)); - } // store ref tracks - } + emh_ref->AddTrackToEventPool(key_df_collision, EMTrack(ndf, track.globalIndex(), collision.globalIndex(), track.trackId(), track.pt(), track.eta(), track.phi(), 0.139)); + } // store ref tracks } } for (const auto& [ref1, ref2] : combinations(CombinationsStrictlyUpperIndexPolicy(refTracks_per_coll, refTracks_per_coll))) { diff --git a/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h index b8a61b258d7..01619ba089c 100644 --- a/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h +++ b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h @@ -325,8 +325,6 @@ struct DiphotonHadronMPC { used_photonIds.shrink_to_fit(); used_dileptonIds.clear(); used_dileptonIds.shrink_to_fit(); - used_refTrackIds.clear(); - used_refTrackIds.shrink_to_fit(); map_mixed_eventId_to_globalBC.clear(); } @@ -486,7 +484,6 @@ struct DiphotonHadronMPC { std::vector> used_photonIds; // std::vector> used_dileptonIds; // - std::vector> used_refTrackIds; // std::vector> used_diphotonIds; // std::map, uint64_t> map_mixed_eventId_to_globalBC; @@ -708,12 +705,7 @@ struct DiphotonHadronMPC { if (fEMTrackCut.IsSelected(track)) { fRegistry.fill(HIST("Hadron/hs"), track.pt(), track.eta(), track.phi()); fRegistry.fill(HIST("Hadron/hTrackBit"), track.trackBit()); - - std::pair pair_tmp_ref = std::make_pair(ndf, track.globalIndex()); - if (std::find(used_refTrackIds.begin(), used_refTrackIds.end(), pair_tmp_ref) == used_refTrackIds.end()) { // add a ref track in mixing pool - emh_ref->AddTrackToEventPool(key_df_collision, EMTrack(ndf, track.globalIndex(), collision.globalIndex(), track.globalIndex(), track.pt(), track.eta(), track.phi(), 0.139)); - used_refTrackIds.emplace_back(pair_tmp_ref); - } + emh_ref->AddTrackToEventPool(key_df_collision, EMTrack(ndf, track.globalIndex(), collision.globalIndex(), track.globalIndex(), track.pt(), track.eta(), track.phi(), 0.139)); } } From 7d27715cd77b5e2c44a0d4458d9c07de2d4c0e54 Mon Sep 17 00:00:00 2001 From: Sebastian Scheid Date: Fri, 15 Aug 2025 23:35:42 +0200 Subject: [PATCH 073/986] [PWGEM] Swith eta to y for mc predictions (#12589) --- .../Dilepton/Tasks/mcParticlePredictionsOTF.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx b/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx index 7d7679b42d9..9ec7f079712 100644 --- a/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx +++ b/PWGEM/Dilepton/Tasks/mcParticlePredictionsOTF.cxx @@ -29,7 +29,7 @@ struct otfParticlePrediction { ConfigurableAxis binsEta{"binsEta", {100, -5, 5}, "Binning of the Eta axis"}; ConfigurableAxis binsPt{"binsPt", {100, 0, 10}, "Binning of the Pt axis"}; - Configurable maxEtaParticle{"maxEtaParticle", 5.f, "Max eta of particles considered"}; + Configurable maxYParticle{"maxYParticle", 5.f, "Max rapidity of particles considered"}; // init function void init(InitContext&) @@ -55,7 +55,7 @@ struct otfParticlePrediction { for (const auto& particle : mcParticles) { auto pdg = std::abs(particle.pdgCode()); - if (std::abs(particle.eta()) > maxEtaParticle) { + if (std::abs(particle.y()) > maxYParticle) { continue; } // if (!(particle.isPhysicalPrimary())) { @@ -69,22 +69,22 @@ struct otfParticlePrediction { } switch (pdg) { case 111: - histos.fill(HIST("particles/generated/pi0"), particle.pt(), particle.eta()); + histos.fill(HIST("particles/generated/pi0"), particle.pt(), particle.y()); break; case 221: - histos.fill(HIST("particles/generated/eta"), particle.pt(), particle.eta()); + histos.fill(HIST("particles/generated/eta"), particle.pt(), particle.y()); break; case 331: - histos.fill(HIST("particles/generated/etaP"), particle.pt(), particle.eta()); + histos.fill(HIST("particles/generated/etaP"), particle.pt(), particle.y()); break; case 223: - histos.fill(HIST("particles/generated/omega"), particle.pt(), particle.eta()); + histos.fill(HIST("particles/generated/omega"), particle.pt(), particle.y()); break; case 113: - histos.fill(HIST("particles/generated/rho"), particle.pt(), particle.eta()); + histos.fill(HIST("particles/generated/rho"), particle.pt(), particle.y()); break; case 333: - histos.fill(HIST("particles/generated/phi"), particle.pt(), particle.eta()); + histos.fill(HIST("particles/generated/phi"), particle.pt(), particle.y()); break; default: break; From 38bd655aae29fd5c15e884428ad693c1e6370033 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 15 Aug 2025 23:44:04 +0200 Subject: [PATCH 074/986] [PWGEM/Dilepton] add option to require TOF in treeCreatorElectronMLDD.cxx (#12593) --- .../treeCreatorElectronMLDDA.cxx | 98 +++++++++++-------- 1 file changed, 59 insertions(+), 39 deletions(-) diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx index ffcd498881a..1d78d7b6381 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx @@ -211,6 +211,7 @@ struct TreeCreatorElectronMLDDA { Configurable cfg_includeITSsa{"cfg_includeITSsa", false, "Flag to include ITSsa tracks"}; Configurable cfg_max_pt_itssa{"cfg_max_pt_itssa", 0.15, "mix pt for ITSsa track"}; Configurable cfg_min_qt_strangeness{"cfg_min_qt_strangeness", 0.015, "min qt for Lambda and K0S"}; + Configurable requireTOF_for_tagging{"requireTOF_for_tagging", false, "flag to require TOF for tagging 1 leg from V0"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -5, "min n sigma e in TPC"}; Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +5, "max n sigma e in TPC"}; @@ -262,6 +263,7 @@ struct TreeCreatorElectronMLDDA { Configurable cfg_min_rxy{"cfg_min_rxy", 0.5, "minimum V0 rxy in cascade"}; Configurable cfg_min_dcaxy_v0leg{"cfg_min_dcaxy_v0leg", 0.1, "min dca XY for v0 legs in cm"}; Configurable cfg_min_dcaxy_bachelor{"cfg_min_dcaxy_bachelor", 0.1, "min dca XY for bachelor in cm"}; + Configurable requireTOF_for_tagging{"requireTOF_for_tagging", false, "flag to require TOF for tagging 1 leg from V0"}; } cascadecuts; // for RCT @@ -803,64 +805,76 @@ struct TreeCreatorElectronMLDDA { if (v0cuts.cfg_min_qt_strangeness < v0.qtarm()) { if (!(v0cuts.cfg_min_mass_lambda_veto < v0.mLambda() && v0.mLambda() < v0cuts.cfg_max_mass_lambda_veto) && !(v0cuts.cfg_min_mass_lambda_veto < v0.mAntiLambda() && v0.mAntiLambda() < v0cuts.cfg_max_mass_lambda_veto)) { if (isPionTight(pos) && isPion(neg)) { - registry.fill(HIST("V0/hMassK0Short"), v0.mK0Short()); - if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) { - registry.fill(HIST("V0/hTPCdEdx_P_Pi"), neg.tpcInnerParam(), neg.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_Pi"), neg.tpcInnerParam(), neg.beta()); - fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)); + if (!v0cuts.requireTOF_for_tagging || pos.hasTOF()) { + registry.fill(HIST("V0/hMassK0Short"), v0.mK0Short()); + if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) { + registry.fill(HIST("V0/hTPCdEdx_P_Pi"), neg.tpcInnerParam(), neg.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_Pi"), neg.tpcInnerParam(), neg.beta()); + fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)); + } } } if (isPion(pos) && isPionTight(neg)) { - registry.fill(HIST("V0/hMassK0Short"), v0.mK0Short()); - if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) { - registry.fill(HIST("V0/hTPCdEdx_P_Pi"), pos.tpcInnerParam(), pos.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_Pi"), pos.tpcInnerParam(), pos.beta()); - fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)); + if (!v0cuts.requireTOF_for_tagging || neg.hasTOF()) { + registry.fill(HIST("V0/hMassK0Short"), v0.mK0Short()); + if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) { + registry.fill(HIST("V0/hTPCdEdx_P_Pi"), pos.tpcInnerParam(), pos.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_Pi"), pos.tpcInnerParam(), pos.beta()); + fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)); + } } } - } + } // end of K0S if (!(v0cuts.cfg_min_mass_k0s_veto < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s_veto)) { if (isProton(pos) && isPionTight(neg)) { - registry.fill(HIST("V0/hMassLambda"), v0.mLambda()); - if (v0cuts.cfg_min_mass_lambda < v0.mLambda() && v0.mLambda() < v0cuts.cfg_max_mass_lambda) { - fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton)); - registry.fill(HIST("V0/hTPCdEdx_P_Pr"), pos.tpcInnerParam(), pos.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_Pr"), pos.tpcInnerParam(), pos.beta()); + if (!v0cuts.requireTOF_for_tagging || neg.hasTOF()) { + registry.fill(HIST("V0/hMassLambda"), v0.mLambda()); + if (v0cuts.cfg_min_mass_lambda < v0.mLambda() && v0.mLambda() < v0cuts.cfg_max_mass_lambda) { + fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton)); + registry.fill(HIST("V0/hTPCdEdx_P_Pr"), pos.tpcInnerParam(), pos.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_Pr"), pos.tpcInnerParam(), pos.beta()); + } } - } + } // end of Lambda if (isPionTight(pos) && isProton(neg)) { - registry.fill(HIST("V0/hMassAntiLambda"), v0.mAntiLambda()); - if (v0cuts.cfg_min_mass_lambda < v0.mAntiLambda() && v0.mAntiLambda() < v0cuts.cfg_max_mass_lambda) { - fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton)); - registry.fill(HIST("V0/hTPCdEdx_P_Pr"), neg.tpcInnerParam(), neg.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_Pr"), neg.tpcInnerParam(), neg.beta()); + if (!v0cuts.requireTOF_for_tagging || pos.hasTOF()) { + registry.fill(HIST("V0/hMassAntiLambda"), v0.mAntiLambda()); + if (v0cuts.cfg_min_mass_lambda < v0.mAntiLambda() && v0.mAntiLambda() < v0cuts.cfg_max_mass_lambda) { + fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton)); + registry.fill(HIST("V0/hTPCdEdx_P_Pr"), neg.tpcInnerParam(), neg.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_Pr"), neg.tpcInnerParam(), neg.beta()); + } } - } + } // end of AntiLambda } } // end of stangeness if (isElectronTight(pos) && isElectron(neg)) { - registry.fill(HIST("V0/hMassGamma"), v0.mGamma()); - registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma()); - if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) { - registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y()); - fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)); - registry.fill(HIST("V0/hTPCdEdx_P_El"), neg.tpcInnerParam(), neg.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_El"), neg.tpcInnerParam(), neg.beta()); + if (!v0cuts.requireTOF_for_tagging || pos.hasTOF()) { + registry.fill(HIST("V0/hMassGamma"), v0.mGamma()); + registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma()); + if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) { + registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y()); + fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)); + registry.fill(HIST("V0/hTPCdEdx_P_El"), neg.tpcInnerParam(), neg.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_El"), neg.tpcInnerParam(), neg.beta()); + } } - } + } // end of photon conversion if (isElectron(pos) && isElectronTight(neg)) { - registry.fill(HIST("V0/hMassGamma"), v0.mGamma()); - registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma()); - if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) { - registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y()); - fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)); - registry.fill(HIST("V0/hTPCdEdx_P_El"), pos.tpcInnerParam(), pos.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_El"), pos.tpcInnerParam(), pos.beta()); + if (!v0cuts.requireTOF_for_tagging || neg.hasTOF()) { + registry.fill(HIST("V0/hMassGamma"), v0.mGamma()); + registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma()); + if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) { + registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y()); + fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)); + registry.fill(HIST("V0/hTPCdEdx_P_El"), pos.tpcInnerParam(), pos.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_El"), pos.tpcInnerParam(), pos.beta()); + } } - } + } // end of photon conversion } // end of v0 loop @@ -878,10 +892,16 @@ struct TreeCreatorElectronMLDDA { if (!isProtonTight(pos) || !isPionTight(neg)) { continue; } + if (cascadecuts.requireTOF_for_tagging && !pos.hasTOF()) { // require TOF to proton candidates. // pion from L is soft. Don't require TOF for soft pions. + continue; + } } else { // Omegabar+ -> Lbar + K+ -> pbar + pi+ + K+ if (!isProtonTight(neg) || !isPionTight(pos)) { continue; } + if (cascadecuts.requireTOF_for_tagging && !neg.hasTOF()) { // require TOF to anti-proton candidates. // pion from L is soft. Don't require TOF for soft pions. + continue; + } } if (!(cascadecuts.cfg_min_mass_lambda < cascade.mLambda() && cascade.mLambda() < cascadecuts.cfg_max_mass_lambda)) { From 905f02a4317173c4d8eb2d5314e3a254045d602c Mon Sep 17 00:00:00 2001 From: amaringarcia Date: Sat, 16 Aug 2025 00:13:19 +0200 Subject: [PATCH 075/986] [Common] Use NN including Hadronic Rate in the training, mitigation of run by run variations (#12573) Co-authored-by: Ana Marin Co-authored-by: Ana Marin --- Common/TableProducer/PID/CMakeLists.txt | 2 +- Common/TableProducer/PID/pidTPC.cxx | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Common/TableProducer/PID/CMakeLists.txt b/Common/TableProducer/PID/CMakeLists.txt index e0ea2d40ab3..86787fd13b7 100644 --- a/Common/TableProducer/PID/CMakeLists.txt +++ b/Common/TableProducer/PID/CMakeLists.txt @@ -55,7 +55,7 @@ o2physics_add_dpl_workflow(pid-tpc-base o2physics_add_dpl_workflow(pid-tpc SOURCES pidTPC.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DetectorsBase O2Physics::AnalysisCCDB O2Physics::MLCore COMPONENT_NAME Analysis) # HMPID diff --git a/Common/TableProducer/PID/pidTPC.cxx b/Common/TableProducer/PID/pidTPC.cxx index fd6efd7bff8..bd126939f0f 100644 --- a/Common/TableProducer/PID/pidTPC.cxx +++ b/Common/TableProducer/PID/pidTPC.cxx @@ -33,6 +33,7 @@ #include "TableHelper.h" #include "pidTPCBase.h" +#include "Common/CCDB/ctpRateFetcher.h" #include "Common/Core/PID/TPCPIDResponse.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" @@ -151,7 +152,8 @@ struct tpcPid { Configurable useNetworkAl{"useNetworkAl", 1, {"Switch for applying neural network on the alpha mass hypothesis (if network enabled) (set to 0 to disable)"}}; Configurable networkBetaGammaCutoff{"networkBetaGammaCutoff", 0.45, {"Lower value of beta-gamma to override the NN application"}}; Configurable networkInputBatchedMode{"networkInputBatchedMode", -1, {"-1: Takes all tracks, >0: Takes networkInputBatchedMode number of tracks at once"}}; - + Configurable irSource{"irSource", "ZNC hadronic", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"}; + ctpRateFetcher mRateFetcher; // Parametrization configuration bool useCCDBParam = false; std::vector track_properties; @@ -400,6 +402,16 @@ struct tpcPid { if (input_dimensions == 7 && networkVersion == "2") { track_properties[counter_track_props + 6] = trk.has_collision() ? collisions.iteratorAt(trk.collisionId()).ft0cOccupancyInTimeRange() / 60000. : 1.; } + if (input_dimensions == 8 && networkVersion == "3") { + if (trk.has_collision()) { + auto trk_bc = (collisions.iteratorAt(trk.collisionId())).template bc_as(); + float hadronicRate = mRateFetcher.fetch(ccdb.service, trk_bc.timestamp(), trk_bc.runNumber(), irSource) * 1.e-3; + track_properties[counter_track_props + 7] = hadronicRate / 50.; + } else { + track_properties[counter_track_props + 7] = 1; + } + } + counter_track_props += input_dimensions; in_batch_counter++; total_input_count++; From 22f97c9db0a5d7fce9a2b879ebada2d8456a2054 Mon Sep 17 00:00:00 2001 From: Shirajum Monira <38348689+Eloviyo@users.noreply.github.com> Date: Sat, 16 Aug 2025 13:23:35 +0200 Subject: [PATCH 076/986] [PWGCF] FemtoUniverse v0cascade task -- implemented bitmask and CPR in v0-cascade task (#12595) Co-authored-by: Shirajum Monira --- .../Core/FemtoUniverseDetaDphiStar.h | 66 ++++- ...femtoUniversePairTaskV0CascadeExtended.cxx | 245 +++++++++++++----- 2 files changed, 247 insertions(+), 64 deletions(-) diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h index 5ab5c65c0a5..ac5f1c9aad5 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h @@ -111,7 +111,7 @@ class FemtoUniverseDetaDphiStar } } if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kCascade && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kCascade) { - /// Xi-Xi and Omega-Omega combination + /// Cascade-Cascade combination for (int k = 0; k < 7; k++) { std::string dirName = static_cast(DirNames[5]); histdetadpisame[k][0] = mHistogramRegistry->add((dirName + static_cast(HistNamesSame[0][k])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); @@ -126,7 +126,7 @@ class FemtoUniverseDetaDphiStar } } if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kCascade) { - /// Track-Xi and Track-Omega combination + /// Track-Cascade combination for (int k = 0; k < 3; k++) { std::string dirName = static_cast(DirNames[6]); histdetadpisame[k][0] = mHistogramRegistry->add((dirName + static_cast(HistNamesSame[0][k])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); @@ -140,6 +140,21 @@ class FemtoUniverseDetaDphiStar } } } + if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kV0 && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kCascade) { + /// V0-Cascade combination + for (int k = 0; k < 3; k++) { + std::string dirName = static_cast(DirNames[7]); + histdetadpisame[k][0] = mHistogramRegistry->add((dirName + static_cast(HistNamesSame[0][k])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpisame[k][1] = mHistogramRegistry->add((dirName + static_cast(HistNamesSame[1][k])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpimixed[k][0] = mHistogramRegistry->add((dirName + static_cast(HistNamesMixed[0][k])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpimixed[k][1] = mHistogramRegistry->add((dirName + static_cast(HistNamesMixed[1][k])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + if (plotForEveryRadii) { + for (int l = 0; l < 9; l++) { + histdetadpiRadii[k][l] = mHistogramRegistryQA->add((dirName + static_cast(HistNamesRadii[k][l])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + } + } + } + } if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kPhi) { for (int i = 0; i < 2; i++) { std::string dirName = static_cast(DirNames[3]); @@ -219,7 +234,6 @@ class FemtoUniverseDetaDphiStar bool pass = false; for (int i = 0; i < 2; i++) { auto indexOfDaughter = (ChosenEventType == femto_universe_container::EventType::mixed ? part2.globalIndex() : part2.index()) - 2 + i; - // auto indexOfDaughter = part2.globalIndex() - 2 + i; auto daughter = particles.begin() + indexOfDaughter; auto deta = part1.eta() - daughter.eta(); auto dphiAvg = averagePhiStar(part1, *daughter, i); @@ -284,7 +298,7 @@ class FemtoUniverseDetaDphiStar return pass; } else if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kCascade && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kCascade) { - /// Xi-Xi and Omega-Omega combination + /// Cascade-Cascade combination if (part1.partType() != o2::aod::femtouniverseparticle::ParticleType::kCascade || part2.partType() != o2::aod::femtouniverseparticle::ParticleType::kCascade) { LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar instantiation! Please provide kCascade,kCascade candidates."; return false; @@ -324,7 +338,7 @@ class FemtoUniverseDetaDphiStar return pass; } else if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kCascade) { - /// Track-Xi and Track-Omega combination + /// Track-Cascade combination if (part1.partType() != o2::aod::femtouniverseparticle::ParticleType::kTrack || part2.partType() != o2::aod::femtouniverseparticle::ParticleType::kCascade) { LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar instantiation! Please provide kTrack,kCascade candidates."; return false; @@ -360,6 +374,46 @@ class FemtoUniverseDetaDphiStar } return pass; + } else if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kV0 && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kCascade) { + /// V0-Cascade combination + if (part1.partType() != o2::aod::femtouniverseparticle::ParticleType::kV0 || part2.partType() != o2::aod::femtouniverseparticle::ParticleType::kCascade) { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar instantiation! Please provide kV0,kCascade candidates."; + return false; + } + + bool pass = false; + static constexpr int V0CascChildTable[][2] = {{-1, -1}, {-1, -2}, {-1, -3}, {-2, -1}, {-2, -2}, {-2, -3}}; + for (int i = 0; i < 3; i++) { + auto indexOfDaughterV0 = (ChosenEventType == femto_universe_container::EventType::mixed ? part1.globalIndex() : part1.index()) + V0CascChildTable[i][0]; + auto indexOfDaughterCasc = (ChosenEventType == femto_universe_container::EventType::mixed ? part2.globalIndex() : part2.index()) + V0CascChildTable[i][1]; + auto daughterV0 = particles.begin() + indexOfDaughterV0; + auto daughterCasc = particles.begin() + indexOfDaughterCasc; + if (isSameSignCPR && (daughterV0.mAntiLambda() != daughterCasc.mAntiLambda())) // mAntiLambda() is used here as sign getter + continue; + auto deta = daughterV0.eta() - daughterCasc.eta(); + auto dphiAvg = averagePhiStar(*daughterV0, *daughterCasc, i); + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[i][0]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[i][0]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; + } + + if ((dphiAvg > cutDeltaPhiStarMin) && (dphiAvg < cutDeltaPhiStarMax) && (deta > cutDeltaEtaMin) && (deta < cutDeltaEtaMax)) { + pass = true; + } else { + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[i][1]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[i][1]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; + } + } + } + return pass; + } else if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kD0) { /// Track-D0 combination // check if provided particles are in agreement with the class instantiation @@ -586,7 +640,7 @@ class FemtoUniverseDetaDphiStar private: HistogramRegistry* mHistogramRegistry = nullptr; ///< For main output HistogramRegistry* mHistogramRegistryQA = nullptr; ///< For QA output - static constexpr std::string_view DirNames[7] = {"kTrack_kTrack/", "kTrack_kV0/", "kV0_kV0/", "kTrack_kPhi/", "kTrack_kD0/", "kCascade_kCascade/", "kTrack_kCascade/"}; + static constexpr std::string_view DirNames[8] = {"kTrack_kTrack/", "kTrack_kV0/", "kV0_kV0/", "kTrack_kPhi/", "kTrack_kD0/", "kCascade_kCascade/", "kTrack_kCascade/", "kV0_kCascade/"}; static constexpr std::string_view HistNamesSame[2][8] = {{"detadphidetadphi0BeforeSame_0", "detadphidetadphi0BeforeSame_1", "detadphidetadphi0BeforeSame_2", "detadphidetadphi0BeforeSame_3", "detadphidetadphi0BeforeSame_4", "detadphidetadphi0BeforeSame_5", diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskV0CascadeExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskV0CascadeExtended.cxx index a9212ab208a..1df76704efd 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskV0CascadeExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskV0CascadeExtended.cxx @@ -43,7 +43,6 @@ struct FemtoUniversePairTaskV0CascadeExtended { SliceCache cache; using FemtoParticles = soa::Join; - Preslice perCol = aod::femtouniverseparticle::fdCollisionId; /// applying narrow cut Configurable confZVertexCut{"confZVertexCut", 10.f, "Event sel: Maximum z-Vertex (cm)"}; @@ -66,12 +65,23 @@ struct FemtoUniversePairTaskV0CascadeExtended { Configurable confCascType{"confCascType", 0, "select one of the cascades (Omega = 0, Xi = 1, anti-Omega = 2, anti-Xi = 3)"}; Configurable confCascInvMassLowLimit{"confCascInvMassLowLimit", 1.315, "Lower limit of the cascade invariant mass"}; Configurable confCascInvMassUpLimit{"confCascInvMassUpLimit", 1.325, "Upper limit of the cascade invariant mass"}; + Configurable confCascPDGCode{"confCascPDGCode", 3312, "Particle 2 (Cascade) - PDG code"}; /// nSigma cuts Configurable confmom{"confmom", 0.75, "momentum threshold for particle identification using TOF"}; Configurable confNsigmaTPCParticleChild{"confNsigmaTPCParticleChild", 3.0, "TPC Sigma for cascade (daugh & bach) momentum < Confmom"}; Configurable confNsigmaTOFParticleChild{"confNsigmaTOFParticleChild", 3.0, "TOF Sigma for cascade (daugh & bach) momentum > Confmom"}; + /// CPR + Configurable confIsCPR{"confIsCPR", false, "Close Pair Rejection"}; + Configurable confCPRdeltaPhiCutMax{"confCPRdeltaPhiCutMax", 0.0, "Delta Phi max cut for CPR"}; + Configurable confCPRdeltaPhiCutMin{"confCPRdeltaPhiCutMin", 0.0, "Delta Phi min cut for CPR"}; + Configurable confCPRdeltaEtaCutMax{"confCPRdeltaEtaCutMax", 0.0, "Delta Eta max cut for CPR"}; + Configurable confCPRdeltaEtaCutMin{"confCPRdeltaEtaCutMin", 0.0, "Delta Eta min cut for CPR"}; + Configurable confCPRPlotPerRadii{"confCPRPlotPerRadii", false, "Plot CPR per radii"}; + Configurable confCPRChosenRadii{"confCPRChosenRadii", 0.0, "Delta Eta cut for Close Pair Rejection"}; + Configurable confIsSameSignCPR{"confIsSameSignCPR", false, "Close Pair Rejection for same sign children of cascades"}; + /// for correlation part Configurable confIsMC{"confIsMC", false, "Enable additional Histograms in the case of a MonteCarlo Run"}; ConfigurableAxis confkstarBins{"confkstarBins", {1500, 0., 6.}, "binning kstar"}; @@ -91,12 +101,18 @@ struct FemtoUniversePairTaskV0CascadeExtended { ConfigurableAxis confV0TempFitVarpTBins{"confV0TempFitVarpTBins", {20, 0.5, 4.05}, "V0: pT binning of the pT vs. TempFitVar plot"}; ConfigurableAxis confV0TempFitVarBins{"confV0TempFitVarBins", {300, 0.95, 1.}, "V0: binning of the TempFitVar in the pT vs. TempFitVar plot"}; - /// Partition for particle 1 + /// Partition for particle 1 (V0) Partition partsOne = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kV0)) && (aod::femtouniverseparticle::pt < confHPtPart1) && (aod::femtouniverseparticle::pt > confLPtPart1); - /// Partition for particle 2 + /// Partition for particle 1 (V0) without extended table + Partition partsOnebitmask = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kV0)) && (aod::femtouniverseparticle::pt < confHPtPart1) && (aod::femtouniverseparticle::pt > confLPtPart1); + + /// Partition for particle 2 (Cascade) Partition partsTwo = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kCascade)) && (aod::femtouniverseparticle::pt < confHPtPart2) && (aod::femtouniverseparticle::pt > confLPtPart2); + /// Partition for particle 2 (Cascade) without extended table + Partition partsTwobitmask = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kCascade)) && (aod::femtouniverseparticle::pt < confHPtPart2) && (aod::femtouniverseparticle::pt > confLPtPart2); + /// Histogramming for v0 FemtoUniverseParticleHisto trackHistoV0; FemtoUniverseParticleHisto posChildV0; @@ -114,6 +130,7 @@ struct FemtoUniversePairTaskV0CascadeExtended { FemtoUniverseContainer sameEventCont; FemtoUniverseContainer mixedEventCont; FemtoUniversePairCleaner pairCleaner; + FemtoUniverseDetaDphiStar pairCloseRejection; HistogramRegistry qaRegistry{"TrackQA", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry resultRegistry{"Correlations", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -162,18 +179,20 @@ struct FemtoUniversePairTaskV0CascadeExtended { } template - bool isParticleTPC(const T& part, int id) + bool isParticleTPC(const T& part, int id, float* partSigma = 0) { const float tpcNSigmas[3] = {unPackInTable(part.tpcNSigmaStorePr()), unPackInTable(part.tpcNSigmaStorePi()), unPackInTable(part.tpcNSigmaStoreKa())}; - + if (partSigma) + *partSigma = tpcNSigmas[id]; return isNSigmaTPC(tpcNSigmas[id]); } template - bool isParticleTOF(const T& part, int id) + bool isParticleTOF(const T& part, int id, float* partSigma = 0) { const float tofNSigmas[3] = {unPackInTable(part.tofNSigmaStorePr()), unPackInTable(part.tofNSigmaStorePi()), unPackInTable(part.tofNSigmaStoreKa())}; - + if (partSigma) + *partSigma = tofNSigmas[id]; return isNSigmaTOF(part.p(), tofNSigmas[id], part.tempFitVar()); } @@ -190,12 +209,24 @@ struct FemtoUniversePairTaskV0CascadeExtended { sameEventCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, confIsMC, confUse3D); mixedEventCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, confIsMC, confUse3D); + sameEventCont.setPDGCodes(confV0PDGCode, confCascPDGCode); + mixedEventCont.setPDGCodes(confV0PDGCode, confCascPDGCode); + pairCleaner.init(&qaRegistry); + if (confIsCPR.value) { + pairCloseRejection.init(&resultRegistry, &qaRegistry, confCPRdeltaPhiCutMin.value, confCPRdeltaPhiCutMax.value, confCPRdeltaEtaCutMin.value, confCPRdeltaEtaCutMax.value, confCPRChosenRadii.value, confCPRPlotPerRadii.value, 0, 0, confIsSameSignCPR.value); + } } + template + using hasSigma = decltype(std::declval().tpcNSigmaStorePr()); + /// v0-cascade correlations same event - void processSameEvent(const FilteredFDCollision& col, const FemtoParticles& parts) + template + void doSameEvent(const FilteredFDCollision& col, const TableType& parts, PartitionType& partsOne, PartitionType& partsTwo) { + const auto& magFieldTesla = col.magField(); + auto groupPartsOne = partsOne->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); auto groupPartsTwo = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); @@ -206,70 +237,136 @@ struct FemtoUniversePairTaskV0CascadeExtended { if (!invMCascade(part.mLambda(), part.mAntiLambda(), confCascType)) continue; - cascQAHistos.fillQA(part); - - const auto& posChild1 = parts.iteratorAt(part.index() - 3); - const auto& negChild1 = parts.iteratorAt(part.index() - 2); - const auto& bachelor1 = parts.iteratorAt(part.index() - 1); + const auto& posChild = parts.iteratorAt(part.globalIndex() - 3 - parts.begin().globalIndex()); + const auto& negChild = parts.iteratorAt(part.globalIndex() - 2 - parts.begin().globalIndex()); + const auto& bachelor = parts.iteratorAt(part.globalIndex() - 1 - parts.begin().globalIndex()); /// Children of cascade must pass this condition to be selected - if (!isParticleTPC(posChild1, CascChildTable[confCascType][0]) || !isParticleTPC(negChild1, CascChildTable[confCascType][1]) || !isParticleTPC(bachelor1, CascChildTable[confCascType][2])) - continue; + if constexpr (std::experimental::is_detected::value) { + if (!isParticleTPC(posChild, CascChildTable[confCascType][0]) || !isParticleTPC(negChild, CascChildTable[confCascType][1]) || !isParticleTPC(bachelor, CascChildTable[confCascType][2])) + continue; - if (!isParticleTOF(posChild1, CascChildTable[confCascType][0]) || !isParticleTOF(negChild1, CascChildTable[confCascType][1]) || !isParticleTOF(bachelor1, CascChildTable[confCascType][2])) - continue; + if (!isParticleTOF(posChild, CascChildTable[confCascType][0]) || !isParticleTOF(negChild, CascChildTable[confCascType][1]) || !isParticleTOF(bachelor, CascChildTable[confCascType][2])) + continue; + + posChildHistosCasc.fillQABase(posChild, HIST("posChildCasc")); + negChildHistosCasc.fillQABase(negChild, HIST("negChildCasc")); + bachHistosCasc.fillQABase(bachelor, HIST("hBachelor")); + cascQAHistos.fillQA(part); - posChildHistosCasc.fillQABase(posChild1, HIST("posChildCasc")); - negChildHistosCasc.fillQABase(negChild1, HIST("negChildCasc")); - bachHistosCasc.fillQABase(bachelor1, HIST("hBachelor")); + } else { + if ((posChild.pidCut() & (1u << CascChildTable[confCascType][0])) == 0 || (negChild.pidCut() & (1u << CascChildTable[confCascType][1])) == 0 || (bachelor.pidCut() & (1u << CascChildTable[confCascType][2])) == 0) + continue; + + if ((posChild.pidCut() & (8u << CascChildTable[confCascType][0])) == 0 || (negChild.pidCut() & (8u << CascChildTable[confCascType][1])) == 0 || (bachelor.pidCut() & (8u << CascChildTable[confCascType][2])) == 0) + continue; + + posChildHistosCasc.fillQABase(posChild, HIST("posChildCasc")); + negChildHistosCasc.fillQABase(negChild, HIST("negChildCasc")); + bachHistosCasc.fillQABase(bachelor, HIST("hBachelor")); + cascQAHistos.fillQA(part); + } } + for (const auto& part : groupPartsOne) { /// inv Mass check for V0s if (!invMLambda(part.mLambda(), part.mAntiLambda())) continue; - const auto& posChild2 = parts.iteratorAt(part.index() - 2); - const auto& negChild2 = parts.iteratorAt(part.index() - 1); + + const auto& posChild = parts.iteratorAt(part.globalIndex() - 2 - parts.begin().globalIndex()); + const auto& negChild = parts.iteratorAt(part.globalIndex() - 1 - parts.begin().globalIndex()); /// Daughters of v0 must pass this condition to be selected - if (!isParticleTPC(posChild2, V0ChildTable[confV0Type][0]) || !isParticleTPC(negChild2, V0ChildTable[confV0Type][1])) - continue; + if constexpr (std::experimental::is_detected::value) { + if (!isParticleTPC(posChild, V0ChildTable[confV0Type][0]) || !isParticleTPC(negChild, V0ChildTable[confV0Type][1])) + continue; + + if (!isParticleTOF(posChild, V0ChildTable[confV0Type][0]) || !isParticleTOF(negChild, V0ChildTable[confV0Type][1])) + continue; - trackHistoV0.fillQABase(part, HIST("trackHistoV0")); - posChildV0.fillQABase(posChild2, HIST("posChildV0")); - negChildV0.fillQABase(negChild2, HIST("negChildV0")); + trackHistoV0.fillQABase(part, HIST("trackHistoV0")); + posChildV0.fillQABase(posChild, HIST("posChildV0")); + negChildV0.fillQABase(negChild, HIST("negChildV0")); + + } else { + if ((posChild.pidCut() & (1u << V0ChildTable[confV0Type][0])) == 0 || (negChild.pidCut() & (1u << V0ChildTable[confV0Type][1])) == 0) + continue; + + if ((posChild.pidCut() & (8u << V0ChildTable[confV0Type][0])) == 0 || (negChild.pidCut() & (8u << V0ChildTable[confV0Type][1])) == 0) + continue; + + trackHistoV0.fillQABase(part, HIST("trackHistoV0")); + posChildV0.fillQABase(posChild, HIST("posChildV0")); + negChildV0.fillQABase(negChild, HIST("negChildV0")); + } } + for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { if (!invMLambda(p1.mLambda(), p1.mAntiLambda())) continue; // Cascase inv Mass cut (mLambda stores Xi mass, mAntiLambda stored Omega mass) if (!invMCascade(p2.mLambda(), p2.mAntiLambda(), confCascType)) continue; - // track cleaning - if (!pairCleaner.isCleanPair(p1, p2, parts)) { - continue; - } + // V0 - const auto& posChild2 = parts.iteratorAt(p1.index() - 2); - const auto& negChild2 = parts.iteratorAt(p1.index() - 1); + const auto& posChild1 = parts.iteratorAt(p1.globalIndex() - 2 - parts.begin().globalIndex()); + const auto& negChild1 = parts.iteratorAt(p1.globalIndex() - 1 - parts.begin().globalIndex()); /// Daughters of v0 must pass this condition to be selected - if (!isParticleTPC(posChild2, V0ChildTable[confV0Type][0]) || !isParticleTPC(negChild2, V0ChildTable[confV0Type][1])) - continue; + if constexpr (std::experimental::is_detected::value) { + if (!isParticleTPC(posChild1, V0ChildTable[confV0Type][0]) || !isParticleTPC(negChild1, V0ChildTable[confV0Type][1])) + continue; + if (!isParticleTOF(posChild1, V0ChildTable[confV0Type][0]) || !isParticleTOF(negChild1, V0ChildTable[confV0Type][1])) + continue; + } else { + if ((posChild1.pidCut() & (1u << V0ChildTable[confV0Type][0])) == 0 || (negChild1.pidCut() & (1u << V0ChildTable[confV0Type][1])) == 0) + continue; + if ((posChild1.pidCut() & (8u << V0ChildTable[confV0Type][0])) == 0 || (negChild1.pidCut() & (8u << V0ChildTable[confV0Type][1])) == 0) + continue; + } + // cascade - const auto& posChild1 = parts.iteratorAt(p2.index() - 3); - const auto& negChild1 = parts.iteratorAt(p2.index() - 2); - const auto& bachelor1 = parts.iteratorAt(p2.index() - 1); + const auto& posChild2 = parts.iteratorAt(p2.globalIndex() - 3 - parts.begin().globalIndex()); + const auto& negChild2 = parts.iteratorAt(p2.globalIndex() - 2 - parts.begin().globalIndex()); + const auto& bachelor = parts.iteratorAt(p2.globalIndex() - 1 - parts.begin().globalIndex()); /// Daughters of cascade must pass this condition to be selected - if (!isParticleTPC(posChild1, CascChildTable[confCascType][0]) || !isParticleTPC(negChild1, CascChildTable[confCascType][1]) || !isParticleTPC(bachelor1, CascChildTable[confCascType][2])) - continue; + if constexpr (std::experimental::is_detected::value) { + if (!isParticleTPC(posChild2, CascChildTable[confCascType][0]) || !isParticleTPC(negChild2, CascChildTable[confCascType][1]) || !isParticleTPC(bachelor, CascChildTable[confCascType][2])) + continue; + if (!isParticleTOF(posChild2, CascChildTable[confCascType][0]) || !isParticleTOF(negChild2, CascChildTable[confCascType][1]) || !isParticleTOF(bachelor, CascChildTable[confCascType][2])) + continue; + } else { + if ((posChild2.pidCut() & (1u << CascChildTable[confCascType][0])) == 0 || (negChild2.pidCut() & (1u << CascChildTable[confCascType][1])) == 0 || (bachelor.pidCut() & (1u << CascChildTable[confCascType][2])) == 0) + continue; + if ((posChild2.pidCut() & (8u << CascChildTable[confCascType][0])) == 0 || (negChild2.pidCut() & (8u << CascChildTable[confCascType][1])) == 0 || (bachelor.pidCut() & (8u << CascChildTable[confCascType][2])) == 0) + continue; + } - if (!isParticleTOF(posChild1, CascChildTable[confCascType][0]) || !isParticleTOF(negChild1, CascChildTable[confCascType][1]) || !isParticleTOF(bachelor1, CascChildTable[confCascType][2])) + // track cleaning + if (!pairCleaner.isCleanPair(p1, p2, parts)) { continue; - + } + if (confIsCPR.value) { + if (pairCloseRejection.isClosePair(p1, p2, parts, magFieldTesla, femto_universe_container::EventType::same)) { + return; + } + } sameEventCont.setPair(p1, p2, col.multNtr(), confUse3D, 1.0f); } } - PROCESS_SWITCH(FemtoUniversePairTaskV0CascadeExtended, processSameEvent, "Enable processing same event for v0 - cascade", false); + + void processSameEvent(const FilteredFDCollision& col, const FemtoParticles& parts) + { + doSameEvent(col, parts, partsOne, partsTwo); + } + PROCESS_SWITCH(FemtoUniversePairTaskV0CascadeExtended, processSameEvent, "Enable processing same event for v0 - cascade with debug table", false); + + void processSameEventBitmask(const FilteredFDCollision& col, const aod::FDParticles& parts) + { + doSameEvent(col, parts, partsOnebitmask, partsTwobitmask); + } + PROCESS_SWITCH(FemtoUniversePairTaskV0CascadeExtended, processSameEventBitmask, "Enable processing same event for v0 - cascade with bitmask", false); /// v0-cascade correlations mixed event - void processMixedEvent(const FilteredFDCollisions& cols, const FemtoParticles& parts) + template + void doMixedEvent(const FilteredFDCollisions& cols, const TableType& parts, PartitionType& partsOne, PartitionType& partsTwo) { ColumnBinningPolicy colBinning{{confVtxBins, confMultBins}, true}; @@ -291,33 +388,65 @@ struct FemtoUniversePairTaskV0CascadeExtended { // Cascase inv Mass cut (mLambda stores Xi mass, mAntiLambda stored Omega mass) if (!invMCascade(p2.mLambda(), p2.mAntiLambda(), confCascType)) continue; + // V0 - const auto& posChild2 = parts.iteratorAt(p1.index() - 2); - const auto& negChild2 = parts.iteratorAt(p1.index() - 1); + const auto& posChild1 = parts.iteratorAt(p1.globalIndex() - 2 - parts.begin().globalIndex()); + const auto& negChild1 = parts.iteratorAt(p1.globalIndex() - 1 - parts.begin().globalIndex()); /// Daughters of v0 must pass this condition to be selected - if (!isParticleTPC(posChild2, V0ChildTable[confV0Type][0]) || !isParticleTPC(negChild2, V0ChildTable[confV0Type][1])) - continue; - // cascade - const auto& posChild1 = parts.iteratorAt(p2.index() - 3); - const auto& negChild1 = parts.iteratorAt(p2.index() - 2); - const auto& bachelor1 = parts.iteratorAt(p2.index() - 1); - /// Daughters of cascade must pass this condition to be selected - if (!isParticleTPC(posChild1, CascChildTable[confCascType][0]) || !isParticleTPC(negChild1, CascChildTable[confCascType][1]) || !isParticleTPC(bachelor1, CascChildTable[confCascType][2])) - continue; + if constexpr (std::experimental::is_detected::value) { + if (!isParticleTPC(posChild1, V0ChildTable[confV0Type][0]) || !isParticleTPC(negChild1, V0ChildTable[confV0Type][1])) + continue; + if (!isParticleTOF(posChild1, V0ChildTable[confV0Type][0]) || !isParticleTOF(negChild1, V0ChildTable[confV0Type][1])) + continue; + } else { + if ((posChild1.pidCut() & (1u << V0ChildTable[confV0Type][0])) == 0 || (negChild1.pidCut() & (1u << V0ChildTable[confV0Type][1])) == 0) + continue; + if ((posChild1.pidCut() & (8u << V0ChildTable[confV0Type][0])) == 0 || (negChild1.pidCut() & (8u << V0ChildTable[confV0Type][1])) == 0) + continue; + } - if (!isParticleTOF(posChild1, CascChildTable[confCascType][0]) || !isParticleTOF(negChild1, CascChildTable[confCascType][1]) || !isParticleTOF(bachelor1, CascChildTable[confCascType][2])) - continue; + // Cascade + const auto& posChild2 = parts.iteratorAt(p2.globalIndex() - 3 - parts.begin().globalIndex()); + const auto& negChild2 = parts.iteratorAt(p2.globalIndex() - 2 - parts.begin().globalIndex()); + const auto& bachelor = parts.iteratorAt(p2.globalIndex() - 1 - parts.begin().globalIndex()); + /// Daughters of cascade must pass this condition to be selected + if constexpr (std::experimental::is_detected::value) { + if (!isParticleTPC(posChild2, CascChildTable[confCascType][0]) || !isParticleTPC(negChild2, CascChildTable[confCascType][1]) || !isParticleTPC(bachelor, CascChildTable[confCascType][2])) + continue; + if (!isParticleTOF(posChild2, CascChildTable[confCascType][0]) || !isParticleTOF(negChild2, CascChildTable[confCascType][1]) || !isParticleTOF(bachelor, CascChildTable[confCascType][2])) + continue; + } else { + if ((posChild2.pidCut() & (1u << CascChildTable[confCascType][0])) == 0 || (negChild2.pidCut() & (1u << CascChildTable[confCascType][1])) == 0 || (bachelor.pidCut() & (1u << CascChildTable[confCascType][2])) == 0) + continue; + if ((posChild2.pidCut() & (8u << CascChildTable[confCascType][0])) == 0 || (negChild2.pidCut() & (8u << CascChildTable[confCascType][1])) == 0 || (bachelor.pidCut() & (8u << CascChildTable[confCascType][2])) == 0) + continue; + } // track cleaning if (!pairCleaner.isCleanPair(p1, p2, parts)) { continue; } + if (confIsCPR.value) { + if (pairCloseRejection.isClosePair(p1, p2, parts, magFieldTesla1, femto_universe_container::EventType::same)) { + return; + } + } mixedEventCont.setPair(p1, p2, multCol, confUse3D, 1.0f); } } } - PROCESS_SWITCH(FemtoUniversePairTaskV0CascadeExtended, processMixedEvent, "Enable processing mixed event for v0 - cascade", false); + void processMixedEvent(const FilteredFDCollisions& cols, const FemtoParticles& parts) + { + doMixedEvent(cols, parts, partsOne, partsTwo); + } + PROCESS_SWITCH(FemtoUniversePairTaskV0CascadeExtended, processMixedEvent, "Enable processing mixed event for v0 - cascade with debug table", false); + + void processMixedEventBitmask(const FilteredFDCollisions& cols, const aod::FDParticles& parts) + { + doMixedEvent(cols, parts, partsOnebitmask, partsTwobitmask); + } + PROCESS_SWITCH(FemtoUniversePairTaskV0CascadeExtended, processMixedEventBitmask, "Enable processing mixed event for v0 - cascade with bitmask", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From b7cfa924ce6800a9c01f73e54b73d22a3ddd82a0 Mon Sep 17 00:00:00 2001 From: alcaliva <32872606+alcaliva@users.noreply.github.com> Date: Sat, 16 Aug 2025 17:19:19 +0200 Subject: [PATCH 077/986] [PWGLF] Added nsigmaTOF templates, nsigmaITS in data and MC for comparison, rounded-off variables and requirement on first 3 ITS layers (#12600) --- PWGLF/Tasks/Nuspex/antinucleiInJets.cxx | 174 ++++++++++++++---------- 1 file changed, 103 insertions(+), 71 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx index a84c39ed953..c710fce3735 100644 --- a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx +++ b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx @@ -113,8 +113,6 @@ struct AntinucleiInJets { Configurable applyAreaCut{"applyAreaCut", false, "apply area cut"}; Configurable maxNormalizedJetArea{"maxNormalizedJetArea", 0.6, "area cut"}; Configurable deltaEtaEdge{"deltaEtaEdge", 0.05, "eta gap from the edge"}; - Configurable applyRandomEventRejection{"applyRandomEventRejection", false, "reject some events for syst"}; - Configurable rejectionPercentage{"rejectionPercentage", 3.0, "percentage of events to reject"}; Configurable nSyst{"nSyst", 50, "number of systematic variations"}; // Track quality, kinematic, and PID selection parameters @@ -213,7 +211,6 @@ struct AntinucleiInJets { // Event counters registryData.add("number_of_events_data", "number of events in data", HistType::kTH1F, {{20, 0, 20, "counter"}}); - registryData.add("number_of_rejected_events", "check on number of events rejected", HistType::kTH1F, {{10, 0, 10, "counter"}}); // Jet effective area over piR^2 registryData.add("jetEffectiveAreaOverPiR2", "jet effective area / piR^2", HistType::kTH1F, {{2000, 0, 2, "Area/#piR^{2}"}}); @@ -245,6 +242,9 @@ struct AntinucleiInJets { // Helium-3 registryData.add("helium3_jet_tpc", "helium3_jet_tpc", HistType::kTH2F, {{nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); registryData.add("helium3_ue_tpc", "helium3_ue_tpc", HistType::kTH2F, {{nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); + + // nsigmaITS for antiproton candidates + registryData.add("antiproton_nsigma_its_data", "antiproton_nsigma_its_data", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{ITS}"}}); } // Generated antiproton spectra in jets and UE from MC truth @@ -281,6 +281,12 @@ struct AntinucleiInJets { registryMC.add("antiproton_prim_dca_ue", "antiproton_prim_dca_ue", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {200, -1, 1, "DCA_{xy} (cm)"}}); registryMC.add("antiproton_all_dca_jet", "antiproton_all_dca_jet", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {200, -1, 1, "DCA_{xy} (cm)"}}); registryMC.add("antiproton_all_dca_ue", "antiproton_all_dca_ue", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {200, -1, 1, "DCA_{xy} (cm)"}}); + + // nsigmaITS for antiproton candidates + registryMC.add("antiproton_nsigma_its_mc", "antiproton_nsigma_its_mc", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{ITS}"}}); + + // nsigmaTOF for antiprotons + registryMC.add("antiproton_nsigma_tof_jet_mc", "antiproton_nsigma_tof_jet_mc", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TOF}"}}); } // Efficiency of antinuclei @@ -538,6 +544,8 @@ struct AntinucleiInJets { return false; if (!track.hasITS()) return false; + if ((!hasITSHit(track, 1)) && (!hasITSHit(track, 2)) && (!hasITSHit(track, 3))) + return false; if (track.itsNCls() < minItsNclusters) return false; if (!track.hasTPC()) @@ -567,30 +575,35 @@ struct AntinucleiInJets { 6, 5, 3, 5, 4, 3, 6, 6, 4, 7, 3, 4, 3, 5, 7, 6, 6, 4, 3, 5, 4, 7, 3, 6, 4, 5, 6, 3, 7, 5}; + static std::vector minTpcNcrossedRowsSyst = { 90, 108, 112, 119, 92, 111, 98, 105, 86, 117, 118, 101, 87, 116, 82, 109, 80, 115, 89, 97, 107, 120, 104, 94, 100, 93, 103, 84, 102, 85, 108, 96, 113, 117, 91, 88, 99, 110, 106, 83, 118, 95, 112, 114, 109, 89, 116, 92, 98, 120}; + static std::vector maxChiSquareTpcSyst = { 4.28, 4.81, 4.43, 4.02, 3.38, 3.58, 3.11, 4.17, 3.51, 4.53, 4.90, 3.07, 3.20, 4.86, 4.62, 3.91, 3.98, 4.38, 3.66, 3.84, 3.03, 3.14, 4.96, 4.07, 4.75, 4.32, 3.31, 3.78, 4.11, 3.23, 3.87, 3.70, 4.99, 4.48, 4.69, 4.25, 3.93, 3.45, 4.58, 3.35, 3.18, 3.60, 4.21, 3.75, 4.64, 4.35, 3.26, 3.42, 4.15, 3.09}; + static std::vector maxChiSquareItsSyst = { 42.84, 48.66, 39.27, 34.09, 43.73, 36.98, 30.23, 49.11, 37.67, 35.10, 44.55, 46.79, 38.92, 40.66, 47.14, 33.46, 30.88, 41.32, 45.90, 39.68, 31.42, 32.71, 43.17, 36.04, 49.80, 33.95, 31.89, 38.37, 48.08, 35.87, 47.61, 44.02, 32.15, 46.21, 34.75, 40.17, 37.14, 30.55, 45.42, 42.30, 41.79, 33.21, 39.12, 47.98, 36.52, 31.58, 49.44, 38.02, 35.56, 43.49}; + static std::vector minEtaSyst = { -0.804, -0.844, -0.751, -0.784, -0.819, -0.823, -0.768, -0.781, -0.845, -0.787, -0.758, -0.828, -0.776, -0.842, -0.808, -0.763, -0.849, -0.770, -0.799, -0.754, -0.825, -0.847, -0.806, -0.783, -0.796, -0.835, -0.777, -0.752, -0.838, -0.813, -0.785, -0.802, -0.795, -0.846, -0.780, -0.829, -0.817, -0.773, -0.765, -0.789, -0.800, -0.839, -0.758, -0.820, -0.833, -0.762, -0.792, -0.809, -0.827, -0.751}; + static std::vector maxEtaSyst = { 0.804, 0.844, 0.751, 0.784, 0.819, 0.823, 0.768, 0.781, 0.845, 0.787, 0.758, 0.828, 0.776, 0.842, 0.808, 0.763, 0.849, 0.770, 0.799, 0.754, @@ -689,16 +702,6 @@ struct AntinucleiInJets { return (track.hasTOF() && std::abs(nsigmaTOF) < kNsigmaMax); } - // Event rejection - bool rejectEvent() - { - static std::random_device rd; - static std::mt19937 gen(rd()); - static std::uniform_real_distribution dis(0.0, 100.0); - - return dis(gen) < rejectionPercentage; - } - // Process Data void processData(SelectedCollisions::iterator const& collision, AntiNucleiTracks const& tracks, aod::BCsWithTimestamps const&) { @@ -845,6 +848,11 @@ struct AntinucleiInJets { double nSigmaITSdeut = static_cast(itsResponse.nSigmaITS(track)); double nSigmaITShel3 = static_cast(itsResponse.nSigmaITS(track)); + // Fill nsigmaITS for antiproton candidates + if (isHighPurityAntiproton(track)) { + registryData.fill(HIST("antiproton_nsigma_its_data"), pt, nSigmaITSprot); + } + if (applyItsPid && pt < ptMaxItsPidProt && (nSigmaITSprot < nSigmaItsMin || nSigmaITSprot > nSigmaItsMax)) { passedItsPidProt = false; } @@ -1543,7 +1551,7 @@ struct AntinucleiInJets { // Loop over reconstructed tracks int id(-1); std::vector fjParticles; - std::vector trackIndex; + std::vector antiprotonTrackIndex; for (auto const& track : mcTracks) { id++; @@ -1554,7 +1562,7 @@ struct AntinucleiInJets { // Store track index for antiproton tracks if (passedTrackSelection(track) && track.sign() < 0 && mcparticle.pdgCode() == PDG_t::kProtonBar) { - trackIndex.emplace_back(id); + antiprotonTrackIndex.emplace_back(id); } // Apply track selection for jet reconstruction @@ -1626,10 +1634,6 @@ struct AntinucleiInJets { continue; const auto mcparticle = track.mcParticle(); - // Antiproton selection based on the PDG - if (mcparticle.pdgCode() != PDG_t::kProtonBar) - continue; - // Define variables double nsigmaTPCPr = track.tpcNSigmaPr(); double nsigmaTOFPr = track.tofNSigmaPr(); @@ -1637,6 +1641,15 @@ struct AntinucleiInJets { double dcaxy = track.dcaXY(); double dcaz = track.dcaZ(); + // Fill nsigmaTOF template + if (track.hasTOF() && std::fabs(dcaxy) < maxDcaxy && std::fabs(dcaz) < maxDcaz && mcparticle.isPhysicalPrimary() && nsigmaTPCPr > minNsigmaTpc && nsigmaTPCPr < maxNsigmaTpc && mcparticle.pdgCode() != PDG_t::kProtonBar) { + registryMC.fill(HIST("antiproton_nsigma_tof_jet_mc"), pt, nsigmaTOFPr); + } + + // Antiproton selection based on the PDG + if (mcparticle.pdgCode() != PDG_t::kProtonBar) + continue; + // Fill DCA templates if (std::fabs(dcaz) < maxDcaz) { if (mcparticle.isPhysicalPrimary()) { @@ -1650,9 +1663,16 @@ struct AntinucleiInJets { if (std::fabs(dcaxy) > maxDcaxy || std::fabs(dcaz) > maxDcaz) continue; + // nsigmaITS for antiprotons + double nSigmaITSprot = static_cast(itsResponse.nSigmaITS(track)); + + // Fill nsigmaITS for antiproton candidates + if (isHighPurityAntiproton(track)) { + registryMC.fill(HIST("antiproton_nsigma_its_mc"), pt, nSigmaITSprot); + } + // Particle identification using the ITS cluster size bool passedItsPidProt(true); - double nSigmaITSprot = static_cast(itsResponse.nSigmaITS(track)); if (applyItsPid && pt < ptMaxItsPidProt && (nSigmaITSprot < nSigmaItsMin || nSigmaITSprot > nSigmaItsMax)) { passedItsPidProt = false; } @@ -1677,7 +1697,7 @@ struct AntinucleiInJets { } // Loop over tracks in the underlying event - for (auto const& index : trackIndex) { + for (auto const& index : antiprotonTrackIndex) { // retrieve track associated to index auto const& track = mcTracks.iteratorAt(index); @@ -1808,36 +1828,41 @@ struct AntinucleiInJets { 0.057, 0.055, 0.073, 0.038, 0.050, 0.075, 0.041, 0.061, 0.033, 0.069, 0.035, 0.044, 0.076, 0.049, 0.037, 0.054, 0.072, 0.046, 0.058, 0.040, 0.068, 0.042, 0.056, 0.039, 0.047, 0.065, 0.051, 0.053, 0.063, 0.030}; + static std::vector maxDcazSyst = { 0.064, 0.047, 0.032, 0.076, 0.039, 0.058, 0.043, 0.069, 0.050, 0.035, 0.074, 0.061, 0.045, 0.033, 0.068, 0.055, 0.037, 0.071, 0.042, 0.053, 0.077, 0.038, 0.065, 0.049, 0.036, 0.059, 0.044, 0.067, 0.041, 0.034, 0.073, 0.052, 0.040, 0.063, 0.046, 0.031, 0.070, 0.054, 0.037, 0.062, 0.048, 0.035, 0.075, 0.051, 0.039, 0.066, 0.043, 0.060, 0.032, 0.056}; + static std::vector nSigmaItsMinSyst = { - -2.91, -2.77, -3.03, -3.40, -2.69, -3.28, -2.96, -3.11, -3.36, -3.14, - -2.99, -2.75, -3.17, -2.64, -2.72, -3.44, -2.87, -2.95, -3.00, -2.66, - -2.93, -3.31, -3.05, -3.12, -3.21, -3.01, -2.89, -2.73, -3.26, -2.97, - -2.81, -3.33, -2.68, -3.30, -2.78, -3.39, -2.84, -3.45, -2.92, -3.15, - -3.22, -2.58, -3.07, -2.86, -3.10, -2.76, -2.94, -3.25, -3.04, -2.82}; + -2.9, -2.8, -3.0, -3.4, -2.7, -3.3, -3.0, -3.1, -3.4, -3.1, + -3.0, -2.8, -3.2, -2.6, -2.7, -3.4, -2.9, -3.0, -3.0, -2.7, + -2.9, -3.3, -3.0, -3.1, -3.2, -3.0, -2.9, -2.7, -3.3, -3.0, + -2.8, -3.3, -2.7, -3.3, -2.8, -3.4, -2.8, -3.4, -2.9, -3.1, + -3.2, -2.6, -3.1, -2.9, -3.1, -2.8, -2.9, -3.3, -3.0, -2.8}; + static std::vector nSigmaItsMaxSyst = { - 2.91, 2.77, 3.03, 3.40, 2.69, 3.28, 2.96, 3.11, 3.36, 3.14, - 2.99, 2.75, 3.17, 2.64, 2.72, 3.44, 2.87, 2.95, 3.00, 2.66, - 2.93, 3.31, 3.05, 3.12, 3.21, 3.01, 2.89, 2.73, 3.26, 2.97, - 2.81, 3.33, 2.68, 3.30, 2.78, 3.39, 2.84, 3.45, 2.92, 3.15, - 3.22, 2.58, 3.07, 2.86, 3.10, 2.76, 2.94, 3.25, 3.04, 2.82}; + 2.9, 2.8, 3.0, 3.4, 2.7, 3.3, 3.0, 3.1, 3.4, 3.1, + 3.0, 2.8, 3.2, 2.6, 2.7, 3.4, 2.9, 3.0, 3.0, 2.7, + 2.9, 3.3, 3.0, 3.1, 3.2, 3.0, 2.9, 2.7, 3.3, 3.0, + 2.8, 3.3, 2.7, 3.3, 2.8, 3.4, 2.8, 3.4, 2.9, 3.1, + 3.2, 2.6, 3.1, 2.9, 3.1, 2.8, 2.9, 3.3, 3.0, 2.8}; + static std::vector minNsigmaTpcSyst = { - -3.18, -2.86, -3.12, -2.91, -3.49, -2.57, -3.33, -2.98, -3.46, -2.70, - -3.01, -2.65, -3.27, -3.40, -2.81, -3.10, -2.55, -3.22, -3.07, -2.77, - -3.35, -2.68, -3.43, -2.88, -3.04, -2.53, -3.30, -2.79, -3.15, -2.66, - -3.41, -2.75, -3.26, -2.61, -3.09, -2.54, -3.36, -2.95, -3.20, -2.58, - -3.44, -2.83, -3.11, -2.62, -3.28, -2.69, -3.23, -2.73, -3.39, -2.90}; + -3.2, -2.9, -3.1, -2.9, -3.5, -2.6, -3.3, -3.0, -3.5, -2.7, + -3.0, -2.6, -3.3, -3.4, -2.8, -3.1, -2.6, -3.2, -3.1, -2.8, + -3.4, -2.7, -3.4, -2.9, -3.0, -2.5, -3.3, -2.8, -3.1, -2.7, + -3.4, -2.8, -3.3, -2.6, -3.1, -2.5, -3.4, -3.0, -3.2, -2.6, + -3.4, -2.8, -3.1, -2.6, -3.3, -2.7, -3.2, -2.7, -3.4, -2.9}; + static std::vector maxNsigmaTpcSyst = { - 3.18, 2.86, 3.12, 2.91, 3.49, 2.57, 3.33, 2.98, 3.46, 2.70, - 3.01, 2.65, 3.27, 3.40, 2.81, 3.10, 2.55, 3.22, 3.07, 2.77, - 3.35, 2.68, 3.43, 2.88, 3.04, 2.53, 3.30, 2.79, 3.15, 2.66, - 3.41, 2.75, 3.26, 2.61, 3.09, 2.54, 3.36, 2.95, 3.20, 2.58, - 3.44, 2.83, 3.11, 2.62, 3.28, 2.69, 3.23, 2.73, 3.39, 2.90}; + 3.2, 2.9, 3.1, 2.9, 3.5, 2.6, 3.3, 3.0, 3.5, 2.7, + 3.0, 2.6, 3.3, 3.4, 2.8, 3.1, 2.6, 3.2, 3.1, 2.8, + 3.4, 2.7, 3.4, 2.9, 3.0, 2.5, 3.3, 2.8, 3.1, 2.7, + 3.4, 2.8, 3.3, 2.6, 3.1, 2.5, 3.4, 3.0, 3.2, 2.6, + 3.4, 2.8, 3.1, 2.6, 3.3, 2.7, 3.2, 2.7, 3.4, 2.9}; // Loop over reconstructed tracks for (auto const& track : tracks) { @@ -1912,48 +1937,55 @@ struct AntinucleiInJets { 0.057, 0.055, 0.073, 0.038, 0.050, 0.075, 0.041, 0.061, 0.033, 0.069, 0.035, 0.044, 0.076, 0.049, 0.037, 0.054, 0.072, 0.046, 0.058, 0.040, 0.068, 0.042, 0.056, 0.039, 0.047, 0.065, 0.051, 0.053, 0.063, 0.030}; + static std::vector maxDcazSyst = { 0.064, 0.047, 0.032, 0.076, 0.039, 0.058, 0.043, 0.069, 0.050, 0.035, 0.074, 0.061, 0.045, 0.033, 0.068, 0.055, 0.037, 0.071, 0.042, 0.053, 0.077, 0.038, 0.065, 0.049, 0.036, 0.059, 0.044, 0.067, 0.041, 0.034, 0.073, 0.052, 0.040, 0.063, 0.046, 0.031, 0.070, 0.054, 0.037, 0.062, 0.048, 0.035, 0.075, 0.051, 0.039, 0.066, 0.043, 0.060, 0.032, 0.056}; + static std::vector nSigmaItsMinSyst = { - -2.91, -2.77, -3.03, -3.40, -2.69, -3.28, -2.96, -3.11, -3.36, -3.14, - -2.99, -2.75, -3.17, -2.64, -2.72, -3.44, -2.87, -2.95, -3.00, -2.66, - -2.93, -3.31, -3.05, -3.12, -3.21, -3.01, -2.89, -2.73, -3.26, -2.97, - -2.81, -3.33, -2.68, -3.30, -2.78, -3.39, -2.84, -3.45, -2.92, -3.15, - -3.22, -2.58, -3.07, -2.86, -3.10, -2.76, -2.94, -3.25, -3.04, -2.82}; + -2.9, -2.8, -3.0, -3.4, -2.7, -3.3, -3.0, -3.1, -3.4, -3.1, + -3.0, -2.8, -3.2, -2.6, -2.7, -3.4, -2.9, -3.0, -3.0, -2.7, + -2.9, -3.3, -3.0, -3.1, -3.2, -3.0, -2.9, -2.7, -3.3, -3.0, + -2.8, -3.3, -2.7, -3.3, -2.8, -3.4, -2.8, -3.4, -2.9, -3.1, + -3.2, -2.6, -3.1, -2.9, -3.1, -2.8, -2.9, -3.3, -3.0, -2.8}; + static std::vector nSigmaItsMaxSyst = { - 2.91, 2.77, 3.03, 3.40, 2.69, 3.28, 2.96, 3.11, 3.36, 3.14, - 2.99, 2.75, 3.17, 2.64, 2.72, 3.44, 2.87, 2.95, 3.00, 2.66, - 2.93, 3.31, 3.05, 3.12, 3.21, 3.01, 2.89, 2.73, 3.26, 2.97, - 2.81, 3.33, 2.68, 3.30, 2.78, 3.39, 2.84, 3.45, 2.92, 3.15, - 3.22, 2.58, 3.07, 2.86, 3.10, 2.76, 2.94, 3.25, 3.04, 2.82}; + 2.9, 2.8, 3.0, 3.4, 2.7, 3.3, 3.0, 3.1, 3.4, 3.1, + 3.0, 2.8, 3.2, 2.6, 2.7, 3.4, 2.9, 3.0, 3.0, 2.7, + 2.9, 3.3, 3.0, 3.1, 3.2, 3.0, 2.9, 2.7, 3.3, 3.0, + 2.8, 3.3, 2.7, 3.3, 2.8, 3.4, 2.8, 3.4, 2.9, 3.1, + 3.2, 2.6, 3.1, 2.9, 3.1, 2.8, 2.9, 3.3, 3.0, 2.8}; + static std::vector minNsigmaTpcSyst = { - -3.18, -2.86, -3.12, -2.91, -3.49, -2.57, -3.33, -2.98, -3.46, -2.70, - -3.01, -2.65, -3.27, -3.40, -2.81, -3.10, -2.55, -3.22, -3.07, -2.77, - -3.35, -2.68, -3.43, -2.88, -3.04, -2.53, -3.30, -2.79, -3.15, -2.66, - -3.41, -2.75, -3.26, -2.61, -3.09, -2.54, -3.36, -2.95, -3.20, -2.58, - -3.44, -2.83, -3.11, -2.62, -3.28, -2.69, -3.23, -2.73, -3.39, -2.90}; + -3.2, -2.9, -3.1, -2.9, -3.5, -2.6, -3.3, -3.0, -3.5, -2.7, + -3.0, -2.6, -3.3, -3.4, -2.8, -3.1, -2.6, -3.2, -3.1, -2.8, + -3.4, -2.7, -3.4, -2.9, -3.0, -2.5, -3.3, -2.8, -3.1, -2.7, + -3.4, -2.8, -3.3, -2.6, -3.1, -2.5, -3.4, -3.0, -3.2, -2.6, + -3.4, -2.8, -3.1, -2.6, -3.3, -2.7, -3.2, -2.7, -3.4, -2.9}; + static std::vector maxNsigmaTpcSyst = { - 3.18, 2.86, 3.12, 2.91, 3.49, 2.57, 3.33, 2.98, 3.46, 2.70, - 3.01, 2.65, 3.27, 3.40, 2.81, 3.10, 2.55, 3.22, 3.07, 2.77, - 3.35, 2.68, 3.43, 2.88, 3.04, 2.53, 3.30, 2.79, 3.15, 2.66, - 3.41, 2.75, 3.26, 2.61, 3.09, 2.54, 3.36, 2.95, 3.20, 2.58, - 3.44, 2.83, 3.11, 2.62, 3.28, 2.69, 3.23, 2.73, 3.39, 2.90}; + 3.2, 2.9, 3.1, 2.9, 3.5, 2.6, 3.3, 3.0, 3.5, 2.7, + 3.0, 2.6, 3.3, 3.4, 2.8, 3.1, 2.6, 3.2, 3.1, 2.8, + 3.4, 2.7, 3.4, 2.9, 3.0, 2.5, 3.3, 2.8, 3.1, 2.7, + 3.4, 2.8, 3.3, 2.6, 3.1, 2.5, 3.4, 3.0, 3.2, 2.6, + 3.4, 2.8, 3.1, 2.6, 3.3, 2.7, 3.2, 2.7, 3.4, 2.9}; + static std::vector minNsigmaTofSyst = { - -3.18, -2.86, -3.12, -2.91, -3.49, -2.57, -3.33, -2.98, -3.46, -2.70, - -3.01, -2.65, -3.27, -3.40, -2.81, -3.10, -2.55, -3.22, -3.07, -2.77, - -3.35, -2.68, -3.43, -2.88, -3.04, -2.53, -3.30, -2.79, -3.15, -2.66, - -3.41, -2.75, -3.26, -2.61, -3.09, -2.54, -3.36, -2.95, -3.20, -2.58, - -3.44, -2.83, -3.11, -2.62, -3.28, -2.69, -3.23, -2.73, -3.39, -2.90}; + -3.2, -2.9, -3.1, -2.9, -3.5, -2.6, -3.3, -3.0, -3.5, -2.7, + -3.0, -2.6, -3.3, -3.4, -2.8, -3.1, -2.6, -3.2, -3.1, -2.8, + -3.4, -2.7, -3.4, -2.9, -3.0, -2.5, -3.3, -2.8, -3.1, -2.7, + -3.4, -2.8, -3.3, -2.6, -3.1, -2.5, -3.4, -3.0, -3.2, -2.6, + -3.4, -2.8, -3.1, -2.6, -3.3, -2.7, -3.2, -2.7, -3.4, -2.9}; + static std::vector maxNsigmaTofSyst = { - 3.94, 3.62, 3.83, 3.15, 3.23, 3.49, 3.10, 3.78, 3.54, 3.36, - 3.91, 3.84, 3.72, 3.00, 3.63, 3.13, 3.68, 3.40, 3.97, 3.01, - 3.74, 3.25, 3.89, 3.08, 3.30, 3.48, 3.59, 3.16, 3.47, 3.31, - 3.92, 3.03, 3.43, 3.24, 3.11, 3.86, 3.60, 3.07, 3.21, 3.98, - 3.14, 3.69, 3.56, 3.12, 3.28, 3.46, 3.34, 3.39, 3.05, 3.76}; + 3.9, 3.6, 3.8, 3.2, 3.2, 3.5, 3.1, 3.8, 3.5, 3.4, + 3.9, 3.8, 3.7, 3.0, 3.6, 3.1, 3.7, 3.4, 4.0, 3.0, + 3.7, 3.3, 3.9, 3.1, 3.3, 3.5, 3.6, 3.2, 3.5, 3.3, + 3.9, 3.0, 3.4, 3.2, 3.1, 3.9, 3.6, 3.1, 3.2, 4.0, + 3.1, 3.7, 3.6, 3.1, 3.3, 3.5, 3.3, 3.4, 3.1, 3.8}; // Loop over generated collisions for (const auto& collision : genCollisions) { From 556ea82bb76ca0098e015221ceca9200226743d0 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sat, 16 Aug 2025 19:05:31 +0200 Subject: [PATCH 078/986] [PWGEM/Dilepton] add tpcNClsPID in treeCreatorElectronMLDDA.cxx (#12603) --- PWGEM/Dilepton/DataModel/lmeeMLTables.h | 3 +- .../treeCreatorElectronMLDDA.cxx | 210 +++++++++--------- 2 files changed, 106 insertions(+), 107 deletions(-) diff --git a/PWGEM/Dilepton/DataModel/lmeeMLTables.h b/PWGEM/Dilepton/DataModel/lmeeMLTables.h index f2000b0f4a4..04232c50114 100644 --- a/PWGEM/Dilepton/DataModel/lmeeMLTables.h +++ b/PWGEM/Dilepton/DataModel/lmeeMLTables.h @@ -49,6 +49,7 @@ DECLARE_SOA_COLUMN(PIDLabel, pidlabel, uint8_t); //! DECLARE_SOA_COLUMN(TrackType, tracktype, uint8_t); //! DECLARE_SOA_COLUMN(TPCNClsFound, tpcNClsFound, uint8_t); //! DECLARE_SOA_COLUMN(TPCNClsCrossedRows, tpcNClsCrossedRows, uint8_t); //! +DECLARE_SOA_COLUMN(TPCNClsPID, tpcNClsPID, uint8_t); //! DECLARE_SOA_COLUMN(IsForValidation, isForValidation, bool); //! DECLARE_SOA_COLUMN(Sign, sign, short); //! DECLARE_SOA_COLUMN(P, p, float); //! @@ -89,7 +90,7 @@ DECLARE_SOA_DYNAMIC_COLUMN(MeanClusterSizeITSob, meanClusterSizeITSob, [](uint32 DECLARE_SOA_TABLE(EMTracksForMLPID, "AOD", "EMTRACKMLPID", //! o2::soa::Index<>, collision::NumContrib, evsel::NumTracksInTimeRange, evsel::SumAmpFT0CInTimeRange, emmltrack::P, track::Tgl, emmltrack::Sign, - track::TPCNClsFindable, emmltrack::TPCNClsFound, emmltrack::TPCNClsCrossedRows, + track::TPCNClsFindable, emmltrack::TPCNClsFound, emmltrack::TPCNClsCrossedRows, emmltrack::TPCNClsPID, track::TPCChi2NCl, track::TPCInnerParam, track::TPCSignal, pidtpc::TPCNSigmaEl, pidtpc::TPCNSigmaPi, pidtpc::TPCNSigmaKa, pidtpc::TPCNSigmaPr, pidtofbeta::Beta, pidtof::TOFNSigmaEl, pidtof::TOFNSigmaPi, pidtof::TOFNSigmaKa, pidtof::TOFNSigmaPr, diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx index 1d78d7b6381..b35d73698e7 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx @@ -165,22 +165,6 @@ struct TreeCreatorElectronMLDDA { Configurable cfgRequireGoodITSLayersAll{"cfgRequireGoodITSLayersAll", false, "number of inactive chips on all ITS layers are below threshold "}; } eventcuts; - struct : ConfigurableGroup { - std::string prefix = "trackcut_group"; - Configurable cfg_min_pt{"cfg_min_pt", 0.05, "min pt for v0 legs"}; - Configurable cfg_max_eta{"cfg_max_eta", 0.9, "max. eta for v0 legs"}; - Configurable cfg_min_cr2findable_ratio_tpc{"cfg_min_cr2findable_ratio_tpc", 0.8, "min. TPC Ncr/Nf ratio"}; - Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 0.7, "max fraction of shared clusters in TPC"}; - Configurable cfg_min_ncrossedrows_tpc{"cfg_min_ncrossedrows_tpc", 70, "min ncrossed rows"}; - Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; - Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 4, "min ncluster its"}; - Configurable cfg_min_ncluster_itsib{"cfg_min_ncluster_itsib", 1, "min ncluster itsib"}; - Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 5.0, "max chi2/NclsTPC"}; // comment - Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; - Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 1.0, "max dca XY in cm"}; - Configurable cfg_max_dcaz{"cfg_max_dcaz", 1.0, "max dca Z in cm"}; - } trackcuts; - struct : ConfigurableGroup { std::string prefix = "v0cut_group"; Configurable cfg_min_pt{"cfg_min_pt", 0.05, "min pt for v0 legs"}; @@ -199,9 +183,12 @@ struct TreeCreatorElectronMLDDA { Configurable cfg_min_cospa{"cfg_min_cospa", 0.9998, "min cospa for v0"}; Configurable cfg_max_dcadau{"cfg_max_dcadau", 0.1, "max distance between 2 legs for v0"}; + Configurable cfg_min_qt_strangeness{"cfg_min_qt_strangeness", 0.015, "min qt for Lambda and K0S"}; + Configurable cfg_min_cr2findable_ratio_tpc{"cfg_min_cr2findable_ratio_tpc", 0.8, "min. TPC Ncr/Nf ratio"}; Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 0.7, "max fraction of shared clusters in TPC"}; Configurable cfg_min_ncrossedrows_tpc{"cfg_min_ncrossedrows_tpc", 70, "min ncrossed rows"}; + Configurable cfg_min_ncluster_tpc_pid{"cfg_min_ncluster_tpc_pid", 0, "min ncluster tpc"}; Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 2, "min ncluster its"}; Configurable cfg_min_ncluster_itsib{"cfg_min_ncluster_itsib", 0, "min ncluster itsib"}; @@ -210,8 +197,6 @@ struct TreeCreatorElectronMLDDA { Configurable cfg_min_dcaxy_v0leg{"cfg_min_dcaxy_v0leg", 0.1, "min dca XY to PV for v0 legs in cm"}; Configurable cfg_includeITSsa{"cfg_includeITSsa", false, "Flag to include ITSsa tracks"}; Configurable cfg_max_pt_itssa{"cfg_max_pt_itssa", 0.15, "mix pt for ITSsa track"}; - Configurable cfg_min_qt_strangeness{"cfg_min_qt_strangeness", 0.015, "min qt for Lambda and K0S"}; - Configurable requireTOF_for_tagging{"requireTOF_for_tagging", false, "flag to require TOF for tagging 1 leg from V0"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -5, "min n sigma e in TPC"}; Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +5, "max n sigma e in TPC"}; @@ -230,22 +215,36 @@ struct TreeCreatorElectronMLDDA { Configurable cfg_max_TOFNsigmaKa{"cfg_max_TOFNsigmaKa", +5, "max n sigma ka in TOF"}; Configurable cfg_min_TOFNsigmaPr{"cfg_min_TOFNsigmaPr", -5, "min n sigma pr in TOF"}; Configurable cfg_max_TOFNsigmaPr{"cfg_max_TOFNsigmaPr", +5, "max n sigma pr in TOF"}; + } v0cuts; - Configurable cfg_min_TPCNsigmaEl_tight{"cfg_min_TPCNsigmaEl_tight", -2, "min n sigma e in TPC for pi0->eeg"}; - Configurable cfg_max_TPCNsigmaEl_tight{"cfg_max_TPCNsigmaEl_tight", +2, "max n sigma e in TPC for pi0->eeg"}; - Configurable cfg_min_TOFNsigmaEl_tight{"cfg_min_TOFNsigmaEl_tight", -2, "min n sigma e in TOF for pi0->eeg"}; - Configurable cfg_max_TOFNsigmaEl_tight{"cfg_max_TOFNsigmaEl_tight", +2, "max n sigma e in TOF for pi0->eeg"}; + struct : ConfigurableGroup { + std::string prefix = "tightv0cut_group"; + Configurable cfg_min_cr2findable_ratio_tpc{"cfg_min_cr2findable_ratio_tpc", 0.8, "min. TPC Ncr/Nf ratio"}; + Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 0.7, "max fraction of shared clusters in TPC"}; + Configurable cfg_min_ncrossedrows_tpc{"cfg_min_ncrossedrows_tpc", 80, "min ncrossed rows"}; + Configurable cfg_min_ncluster_tpc_pid{"cfg_min_ncluster_tpc_pid", 60, "min ncluster tpc"}; + Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; + Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 2, "min ncluster its"}; + Configurable cfg_min_ncluster_itsib{"cfg_min_ncluster_itsib", 0, "min ncluster itsib"}; + Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; + Configurable cfg_max_chi2its{"cfg_max_chi2its", 5.0, "max chi2/NclsITS"}; + Configurable requireTOF_for_tagging{"requireTOF_for_tagging", false, "flag to require TOF for tagging 1 leg from V0"}; - Configurable cfg_min_TPCNsigmaPi_tight{"cfg_min_TPCNsigmaPi_tight", -2, "min n sigma pi in TPC for Lambda and cascade"}; - Configurable cfg_max_TPCNsigmaPi_tight{"cfg_max_TPCNsigmaPi_tight", +2, "max n sigma pi in TPC for Lambda and cascade"}; - Configurable cfg_min_TPCNsigmaPr_tight{"cfg_min_TPCNsigmaPr_tight", -2, "min n sigma pr in TPC for cascade"}; - Configurable cfg_max_TPCNsigmaPr_tight{"cfg_max_TPCNsigmaPr_tight", +2, "max n sigma pr in TPC for cascade"}; + Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2, "min n sigma e in TPC for pc->ee"}; + Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +2, "max n sigma e in TPC for pc->ee"}; + Configurable cfg_min_TOFNsigmaEl{"cfg_min_TOFNsigmaEl", -2, "min n sigma e in TOF for pc->ee"}; + Configurable cfg_max_TOFNsigmaEl{"cfg_max_TOFNsigmaEl", +2, "max n sigma e in TOF for pc->ee"}; - Configurable cfg_min_TOFNsigmaPi_tight{"cfg_min_TOFNsigmaPi_tight", -2, "min n sigma pi in TOF for Lambda and cascade"}; - Configurable cfg_max_TOFNsigmaPi_tight{"cfg_max_TOFNsigmaPi_tight", +2, "max n sigma pi in TOF for Lambda and cascade"}; - Configurable cfg_min_TOFNsigmaPr_tight{"cfg_min_TOFNsigmaPr_tight", -2, "min n sigma pr in TOF for cascade"}; - Configurable cfg_max_TOFNsigmaPr_tight{"cfg_max_TOFNsigmaPr_tight", +2, "max n sigma pr in TOF for cascade"}; - } v0cuts; + Configurable cfg_min_TPCNsigmaPi{"cfg_min_TPCNsigmaPi", -2, "min n sigma pi in TPC for Lambda and cascade"}; + Configurable cfg_max_TPCNsigmaPi{"cfg_max_TPCNsigmaPi", +2, "max n sigma pi in TPC for Lambda and cascade"}; + Configurable cfg_min_TPCNsigmaPr{"cfg_min_TPCNsigmaPr", -2, "min n sigma pr in TPC for cascade"}; + Configurable cfg_max_TPCNsigmaPr{"cfg_max_TPCNsigmaPr", +2, "max n sigma pr in TPC for cascade"}; + + Configurable cfg_min_TOFNsigmaPi{"cfg_min_TOFNsigmaPi", -2, "min n sigma pi in TOF for Lambda and cascade"}; + Configurable cfg_max_TOFNsigmaPi{"cfg_max_TOFNsigmaPi", +2, "max n sigma pi in TOF for Lambda and cascade"}; + Configurable cfg_min_TOFNsigmaPr{"cfg_min_TOFNsigmaPr", -2, "min n sigma pr in TOF for cascade"}; + Configurable cfg_max_TOFNsigmaPr{"cfg_max_TOFNsigmaPr", +2, "max n sigma pr in TOF for cascade"}; + } tightv0cuts; struct : ConfigurableGroup { std::string prefix = "cascadecut_group"; @@ -262,7 +261,8 @@ struct TreeCreatorElectronMLDDA { Configurable cfg_min_rxy_v0{"cfg_min_rxy_v0", 1.2, "minimum V0 rxy in cascade"}; Configurable cfg_min_rxy{"cfg_min_rxy", 0.5, "minimum V0 rxy in cascade"}; Configurable cfg_min_dcaxy_v0leg{"cfg_min_dcaxy_v0leg", 0.1, "min dca XY for v0 legs in cm"}; - Configurable cfg_min_dcaxy_bachelor{"cfg_min_dcaxy_bachelor", 0.1, "min dca XY for bachelor in cm"}; + Configurable cfg_min_dcaxy_bachelor{"cfg_min_dcaxy_bachelor", 0.05, "min dca XY for bachelor in cm"}; + Configurable cfg_min_dcaxy_v0{"cfg_min_dcaxy_v0", 0.05, "min dca XY for V0 in cm"}; Configurable requireTOF_for_tagging{"requireTOF_for_tagging", false, "flag to require TOF for tagging 1 leg from V0"}; } cascadecuts; @@ -387,19 +387,19 @@ struct TreeCreatorElectronMLDDA { } template - bool isSelectedTrack(TCollision const& collision, TTrack const& track) + bool isSelectedV0Leg(TCollision const& collision, TTrack const& track) { if (!track.hasITS()) { return false; } - if (track.itsNCls() < trackcuts.cfg_min_ncluster_its) { + if (track.itsNCls() < v0cuts.cfg_min_ncluster_its) { return false; } - if (track.itsNClsInnerBarrel() < trackcuts.cfg_min_ncluster_itsib) { + if (track.itsNClsInnerBarrel() < v0cuts.cfg_min_ncluster_itsib) { return false; } - if (track.itsChi2NCl() > trackcuts.cfg_max_chi2its) { + if (track.itsChi2NCl() > v0cuts.cfg_max_chi2its) { return false; } @@ -408,19 +408,22 @@ struct TreeCreatorElectronMLDDA { } if (track.hasTPC()) { - if (track.tpcNClsCrossedRows() < trackcuts.cfg_min_ncrossedrows_tpc) { + if (track.tpcNClsCrossedRows() < v0cuts.cfg_min_ncrossedrows_tpc) { return false; } - if (track.tpcNClsFound() < trackcuts.cfg_min_ncluster_tpc) { + if (track.tpcNClsFound() < v0cuts.cfg_min_ncluster_tpc) { return false; } - if (track.tpcChi2NCl() > trackcuts.cfg_max_chi2tpc) { + if (track.tpcChi2NCl() > v0cuts.cfg_max_chi2tpc) { return false; } - if (track.tpcCrossedRowsOverFindableCls() < trackcuts.cfg_min_cr2findable_ratio_tpc) { + if (track.tpcCrossedRowsOverFindableCls() < v0cuts.cfg_min_cr2findable_ratio_tpc) { return false; } - if (track.tpcFractionSharedCls() > trackcuts.cfg_max_frac_shared_clusters_tpc) { + if (track.tpcFractionSharedCls() > v0cuts.cfg_max_frac_shared_clusters_tpc) { + return false; + } + if (track.tpcNClsPID() < v0cuts.cfg_min_ncluster_tpc_pid) { return false; } } @@ -431,20 +434,18 @@ struct TreeCreatorElectronMLDDA { mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); - float dcaXY = mDcaInfoCov.getY(); - float dcaZ = mDcaInfoCov.getZ(); + // float dcaXY = mDcaInfoCov.getY(); + // float dcaZ = mDcaInfoCov.getZ(); - if (std::fabs(dcaXY) > trackcuts.cfg_max_dcaxy) { - return false; - } - if (std::fabs(dcaZ) > trackcuts.cfg_max_dcaz) { - return false; - } + // if (std::fabs(dcaXY) < v0cuts.cfg_min_dcaxy_v0leg) { // this is applied in filter. + // return false; + // } - if (std::fabs(trackParCov.getEta()) > trackcuts.cfg_max_eta || trackParCov.getPt() < trackcuts.cfg_min_pt) { + if (std::fabs(trackParCov.getEta()) > v0cuts.cfg_max_eta || trackParCov.getPt() < v0cuts.cfg_min_pt) { return false; } - if ((track.hasITS() && !track.hasTPC() && !track.hasTRD() && !track.hasTOF()) && v0cuts.cfg_max_pt_itssa < trackParCov.getPt()) { + + if ((track.hasITS() && !track.hasTPC() && !track.hasTRD() && !track.hasTOF()) && v0cuts.cfg_max_pt_itssa < track.pt()) { return true; } @@ -452,42 +453,39 @@ struct TreeCreatorElectronMLDDA { } template - bool isSelectedV0Leg(TCollision const& collision, TTrack const& track) + bool isSelectedV0LegTight(TCollision const& collision, TTrack const& track) { - if (!track.hasITS()) { + if (!track.hasITS() || !track.hasTPC()) { return false; } - if (track.itsNCls() < v0cuts.cfg_min_ncluster_its) { + if (track.itsNCls() < tightv0cuts.cfg_min_ncluster_its) { return false; } - if (track.itsNClsInnerBarrel() < v0cuts.cfg_min_ncluster_itsib) { + if (track.itsNClsInnerBarrel() < tightv0cuts.cfg_min_ncluster_itsib) { return false; } - if (track.itsChi2NCl() > v0cuts.cfg_max_chi2its) { + if (tightv0cuts.cfg_max_chi2its < track.itsChi2NCl()) { return false; } - if (!v0cuts.cfg_includeITSsa && (!track.hasITS() || !track.hasTPC())) { + if (track.tpcNClsCrossedRows() < tightv0cuts.cfg_min_ncrossedrows_tpc) { return false; } - - if (track.hasTPC()) { - if (track.tpcNClsCrossedRows() < v0cuts.cfg_min_ncrossedrows_tpc) { - return false; - } - if (track.tpcNClsFound() < v0cuts.cfg_min_ncluster_tpc) { - return false; - } - if (track.tpcChi2NCl() > v0cuts.cfg_max_chi2tpc) { - return false; - } - if (track.tpcCrossedRowsOverFindableCls() < v0cuts.cfg_min_cr2findable_ratio_tpc) { - return false; - } - if (track.tpcFractionSharedCls() > v0cuts.cfg_max_frac_shared_clusters_tpc) { - return false; - } + if (track.tpcNClsFound() < tightv0cuts.cfg_min_ncluster_tpc) { + return false; + } + if (track.tpcChi2NCl() < 0.f || tightv0cuts.cfg_max_chi2tpc < track.tpcChi2NCl()) { + return false; + } + if (track.tpcCrossedRowsOverFindableCls() < tightv0cuts.cfg_min_cr2findable_ratio_tpc) { + return false; + } + if (track.tpcFractionSharedCls() > tightv0cuts.cfg_max_frac_shared_clusters_tpc) { + return false; + } + if (track.tpcNClsPID() < tightv0cuts.cfg_min_ncluster_tpc_pid) { + return false; } mDcaInfoCov.set(999, 999, 999, 999, 999); @@ -496,21 +494,17 @@ struct TreeCreatorElectronMLDDA { mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); - float dcaXY = mDcaInfoCov.getY(); + // float dcaXY = mDcaInfoCov.getY(); // float dcaZ = mDcaInfoCov.getZ(); - if (std::fabs(dcaXY) < v0cuts.cfg_min_dcaxy_v0leg) { // this is applied in filter. - return false; - } + // if (std::fabs(dcaXY) < v0cuts.cfg_min_dcaxy_v0leg) { // this is applied in filter. + // return false; + // } if (std::fabs(trackParCov.getEta()) > v0cuts.cfg_max_eta || trackParCov.getPt() < v0cuts.cfg_min_pt) { return false; } - if ((track.hasITS() && !track.hasTPC() && !track.hasTRD() && !track.hasTOF()) && v0cuts.cfg_max_pt_itssa < track.pt()) { - return true; - } - return true; } @@ -561,24 +555,24 @@ struct TreeCreatorElectronMLDDA { template bool isElectronTight(TTrack const& track) { - bool is_El_TPC = v0cuts.cfg_min_TPCNsigmaEl_tight < track.tpcNSigmaEl() && track.tpcNSigmaEl() < v0cuts.cfg_max_TPCNsigmaEl_tight; - bool is_El_TOF = track.hasTOF() ? v0cuts.cfg_min_TOFNsigmaEl_tight < track.tofNSigmaEl() && track.tofNSigmaEl() < v0cuts.cfg_max_TOFNsigmaEl_tight : true; // TOFif + bool is_El_TPC = tightv0cuts.cfg_min_TPCNsigmaEl < track.tpcNSigmaEl() && track.tpcNSigmaEl() < tightv0cuts.cfg_max_TPCNsigmaEl; + bool is_El_TOF = track.hasTOF() ? tightv0cuts.cfg_min_TOFNsigmaEl < track.tofNSigmaEl() && track.tofNSigmaEl() < tightv0cuts.cfg_max_TOFNsigmaEl : true; // TOFif return is_El_TPC && is_El_TOF; } template bool isPionTight(TTrack const& track) { - bool is_Pi_TPC = v0cuts.cfg_min_TPCNsigmaPi_tight < track.tpcNSigmaPi() && track.tpcNSigmaPi() < v0cuts.cfg_max_TPCNsigmaPi_tight; - bool is_Pi_TOF = track.hasTOF() ? v0cuts.cfg_min_TOFNsigmaPi_tight < track.tofNSigmaPi() && track.tofNSigmaPi() < v0cuts.cfg_max_TOFNsigmaPi_tight : true; // TOFif + bool is_Pi_TPC = tightv0cuts.cfg_min_TPCNsigmaPi < track.tpcNSigmaPi() && track.tpcNSigmaPi() < tightv0cuts.cfg_max_TPCNsigmaPi; + bool is_Pi_TOF = track.hasTOF() ? tightv0cuts.cfg_min_TOFNsigmaPi < track.tofNSigmaPi() && track.tofNSigmaPi() < tightv0cuts.cfg_max_TOFNsigmaPi : true; // TOFif return is_Pi_TPC && is_Pi_TOF; } template bool isProtonTight(TTrack const& track) { - bool is_Pr_TPC = v0cuts.cfg_min_TPCNsigmaPr_tight < track.tpcNSigmaPr() && track.tpcNSigmaPr() < v0cuts.cfg_max_TPCNsigmaPr_tight; - bool is_Pr_TOF = track.hasTOF() ? v0cuts.cfg_min_TOFNsigmaPr_tight < track.tofNSigmaPr() && track.tofNSigmaPr() < v0cuts.cfg_max_TOFNsigmaPr_tight : true; // TOFif + bool is_Pr_TPC = tightv0cuts.cfg_min_TPCNsigmaPr < track.tpcNSigmaPr() && track.tpcNSigmaPr() < tightv0cuts.cfg_max_TPCNsigmaPr; + bool is_Pr_TOF = track.hasTOF() ? tightv0cuts.cfg_min_TOFNsigmaPr < track.tofNSigmaPr() && track.tofNSigmaPr() < tightv0cuts.cfg_max_TOFNsigmaPr : true; // TOFif return is_Pr_TPC && is_Pr_TOF; } @@ -647,7 +641,7 @@ struct TreeCreatorElectronMLDDA { if (std::find(stored_trackIds.begin(), stored_trackIds.end(), track.globalIndex()) == stored_trackIds.end()) { emprimarytracks(collision.numContrib(), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange(), trackParCov.getP(), trackParCov.getTgl(), track.sign(), - track.tpcNClsFindable(), track.tpcNClsFound(), track.tpcNClsCrossedRows(), + track.tpcNClsFindable(), track.tpcNClsFound(), track.tpcNClsCrossedRows(), track.tpcNClsPID(), track.tpcChi2NCl(), track.tpcInnerParam(), track.tpcSignal(), track.tpcNSigmaEl(), /*track.tpcNSigmaMu(),*/ track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), track.beta(), track.tofNSigmaEl(), /*track.tofNSigmaMu(),*/ track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), @@ -804,8 +798,8 @@ struct TreeCreatorElectronMLDDA { if (v0cuts.cfg_min_qt_strangeness < v0.qtarm()) { if (!(v0cuts.cfg_min_mass_lambda_veto < v0.mLambda() && v0.mLambda() < v0cuts.cfg_max_mass_lambda_veto) && !(v0cuts.cfg_min_mass_lambda_veto < v0.mAntiLambda() && v0.mAntiLambda() < v0cuts.cfg_max_mass_lambda_veto)) { - if (isPionTight(pos) && isPion(neg)) { - if (!v0cuts.requireTOF_for_tagging || pos.hasTOF()) { + if ((isPionTight(pos) && isSelectedV0LegTight(collision, pos)) && (isPion(neg) && isSelectedV0Leg(collision, neg))) { + if (!tightv0cuts.requireTOF_for_tagging || pos.hasTOF()) { registry.fill(HIST("V0/hMassK0Short"), v0.mK0Short()); if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) { registry.fill(HIST("V0/hTPCdEdx_P_Pi"), neg.tpcInnerParam(), neg.tpcSignal()); @@ -814,8 +808,8 @@ struct TreeCreatorElectronMLDDA { } } } - if (isPion(pos) && isPionTight(neg)) { - if (!v0cuts.requireTOF_for_tagging || neg.hasTOF()) { + if (isPion(pos) && isSelectedV0Leg(collision, pos) && isPionTight(neg) && isSelectedV0LegTight(collision, neg)) { + if (!tightv0cuts.requireTOF_for_tagging || neg.hasTOF()) { registry.fill(HIST("V0/hMassK0Short"), v0.mK0Short()); if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) { registry.fill(HIST("V0/hTPCdEdx_P_Pi"), pos.tpcInnerParam(), pos.tpcSignal()); @@ -827,8 +821,8 @@ struct TreeCreatorElectronMLDDA { } // end of K0S if (!(v0cuts.cfg_min_mass_k0s_veto < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s_veto)) { - if (isProton(pos) && isPionTight(neg)) { - if (!v0cuts.requireTOF_for_tagging || neg.hasTOF()) { + if (isProton(pos) && isSelectedV0Leg(collision, pos) && isPionTight(neg) && isSelectedV0LegTight(collision, neg)) { + if (!tightv0cuts.requireTOF_for_tagging || (neg.hasTOF() || neg.tpcInnerParam() < 0.4)) { registry.fill(HIST("V0/hMassLambda"), v0.mLambda()); if (v0cuts.cfg_min_mass_lambda < v0.mLambda() && v0.mLambda() < v0cuts.cfg_max_mass_lambda) { fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton)); @@ -837,8 +831,8 @@ struct TreeCreatorElectronMLDDA { } } } // end of Lambda - if (isPionTight(pos) && isProton(neg)) { - if (!v0cuts.requireTOF_for_tagging || pos.hasTOF()) { + if (isPionTight(pos) && isSelectedV0LegTight(collision, pos) && isProton(neg) && isSelectedV0Leg(collision, neg)) { + if (!tightv0cuts.requireTOF_for_tagging || (pos.hasTOF() || pos.tpcInnerParam() < 0.4)) { registry.fill(HIST("V0/hMassAntiLambda"), v0.mAntiLambda()); if (v0cuts.cfg_min_mass_lambda < v0.mAntiLambda() && v0.mAntiLambda() < v0cuts.cfg_max_mass_lambda) { fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton)); @@ -850,8 +844,8 @@ struct TreeCreatorElectronMLDDA { } } // end of stangeness - if (isElectronTight(pos) && isElectron(neg)) { - if (!v0cuts.requireTOF_for_tagging || pos.hasTOF()) { + if (isElectronTight(pos) && isSelectedV0LegTight(collision, pos) && isElectron(neg) && isSelectedV0Leg(collision, neg)) { + if (!tightv0cuts.requireTOF_for_tagging || pos.hasTOF()) { registry.fill(HIST("V0/hMassGamma"), v0.mGamma()); registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma()); if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) { @@ -863,8 +857,8 @@ struct TreeCreatorElectronMLDDA { } } // end of photon conversion - if (isElectron(pos) && isElectronTight(neg)) { - if (!v0cuts.requireTOF_for_tagging || neg.hasTOF()) { + if (isElectron(pos) && isSelectedV0Leg(collision, pos) && isElectronTight(neg) && isSelectedV0LegTight(collision, neg)) { + if (!tightv0cuts.requireTOF_for_tagging || neg.hasTOF()) { registry.fill(HIST("V0/hMassGamma"), v0.mGamma()); registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma()); if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) { @@ -892,14 +886,14 @@ struct TreeCreatorElectronMLDDA { if (!isProtonTight(pos) || !isPionTight(neg)) { continue; } - if (cascadecuts.requireTOF_for_tagging && !pos.hasTOF()) { // require TOF to proton candidates. // pion from L is soft. Don't require TOF for soft pions. + if (cascadecuts.requireTOF_for_tagging && (!pos.hasTOF() && !neg.hasTOF())) { // require TOF to proton candidates. // pion from L is soft. Don't require TOF for soft pions. continue; } } else { // Omegabar+ -> Lbar + K+ -> pbar + pi+ + K+ if (!isProtonTight(neg) || !isPionTight(pos)) { continue; } - if (cascadecuts.requireTOF_for_tagging && !neg.hasTOF()) { // require TOF to anti-proton candidates. // pion from L is soft. Don't require TOF for soft pions. + if (cascadecuts.requireTOF_for_tagging && (!pos.hasTOF() && !neg.hasTOF())) { // require TOF to anti-proton candidates. // pion from L is soft. Don't require TOF for soft pions. continue; } } @@ -933,7 +927,11 @@ struct TreeCreatorElectronMLDDA { continue; } - if (!isSelectedV0Leg(collision, pos) || !isSelectedV0Leg(collision, neg) || !isSelectedV0Leg(collision, bachelor)) { + if (cascade.dcav0topv(collision.posX(), collision.posY(), collision.posZ()) < cascadecuts.cfg_min_dcaxy_v0) { + continue; + } + + if (!isSelectedV0LegTight(collision, pos) || !isSelectedV0LegTight(collision, neg) || !isSelectedV0Leg(collision, bachelor)) { continue; } @@ -974,8 +972,8 @@ struct TreeCreatorElectronMLDDA { // please choose only 1 process function. void processDummy(filteredMyCollisions const&) {} - PROCESS_SWITCH(TreeCreatorElectronMLDDA, processPID, "produce ML input for single track level", false); // this is for eID with ITSsa. e/pi/k/p are selected by TOF, and these can be used for ITS-TPC PID. - PROCESS_SWITCH(TreeCreatorElectronMLDDA, processDummy, "process dummy", true); + PROCESS_SWITCH(TreeCreatorElectronMLDDA, processPID, "produce ML input for single track level", true); // this is for eID with ITSsa. e/pi/k/p are selected by TOF, and these can be used for ITS-TPC PID. + PROCESS_SWITCH(TreeCreatorElectronMLDDA, processDummy, "process dummy", false); }; struct MLTrackQC { From 26a34192652d751b31644cd914aac04461adfa59 Mon Sep 17 00:00:00 2001 From: Shirajum Monira <38348689+Eloviyo@users.noreply.github.com> Date: Sat, 16 Aug 2025 21:00:15 +0200 Subject: [PATCH 079/986] [PWGCF] FemtoUniverse cascade task -- added efficiency correction for cascade task (#12602) Co-authored-by: Shirajum Monira --- ...toUniversePairTaskTrackCascadeExtended.cxx | 44 +++++++++++++++++-- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx index 477c43d44ec..7487576f8e6 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx @@ -32,7 +32,9 @@ #include +#include #include +#include #include using namespace o2; @@ -104,6 +106,9 @@ struct femtoUniversePairTaskTrackCascadeExtended { ConfigurableAxis confTrkTempFitVarBins{"confTrkTempFitVarBins", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot"}; Configurable confNEventsMix{"confNEventsMix", 5, "Number of events for mixing"}; + // Efficiency + Configurable confLocalEfficiency{"confLocalEfficiency", "", "Local path to efficiency .root file"}; + Filter collisionFilter = (nabs(aod::collision::posZ) < confZVertexCut); using FilteredFDCollisions = soa::Filtered; using FilteredFDCollision = FilteredFDCollisions::iterator; @@ -152,6 +157,10 @@ struct femtoUniversePairTaskTrackCascadeExtended { std::set cascDuplicates; + std::unique_ptr plocalEffFile; + std::unique_ptr plocalEffp1; + std::unique_ptr plocalEffp2; + // Table to select cascade daughters // Charges: = +--, +--, +-+, +-+ static constexpr unsigned int CascChildTable[][3] = {{0, 1, 2}, {0, 1, 1}, {1, 0, 2}, {1, 0, 1}}; @@ -314,6 +323,21 @@ struct femtoUniversePairTaskTrackCascadeExtended { if (doprocessSameEventCasc || doprocessSameEventCascBitmask || doprocessMixedEventCasc || doprocessMixedEventCascBitmask) pairCloseRejectionCasc.init(&resultRegistry, &qaRegistry, confCPRdeltaPhiCutMin.value, confCPRdeltaPhiCutMax.value, confCPRdeltaEtaCutMin.value, confCPRdeltaEtaCutMax.value, confCPRChosenRadii.value, confCPRPlotPerRadii.value, 0, 0, confIsSameSignCPR.value); } + + if (!confLocalEfficiency.value.empty()) { + plocalEffFile = std::unique_ptr(TFile::Open(confLocalEfficiency.value.c_str(), "read")); + if (!plocalEffFile || plocalEffFile.get()->IsZombie()) + LOGF(fatal, "Could not load efficiency histogram from %s", confLocalEfficiency.value.c_str()); + if (doprocessSameEvent || doprocessSameEventBitmask || doprocessMixedEvent || doprocessMixedEventBitmask) { + plocalEffp1 = (confChargePart1 > 0) ? std::unique_ptr(plocalEffFile.get()->Get("PrPlus")) : std::unique_ptr(plocalEffFile.get()->Get("PrMinus")); // note: works only for protons for now + plocalEffp2 = (confCascType1 == 0 || confCascType1 == 1) ? std::unique_ptr(plocalEffFile.get()->Get("Cascade")) : std::unique_ptr(plocalEffFile.get()->Get("AntiCascade")); + LOGF(info, "Loaded efficiency histograms for track-Cascade."); + } else if (doprocessSameEventCasc || doprocessSameEventCascBitmask || doprocessMixedEventCasc || doprocessMixedEventCascBitmask) { + plocalEffp1 = (confCascType1 == 0 || confCascType1 == 1) ? std::unique_ptr(plocalEffFile.get()->Get("Cascade")) : std::unique_ptr(plocalEffFile.get()->Get("AntiCascade")); + plocalEffp2 = (confCascType2 == 0 || confCascType2 == 1) ? std::unique_ptr(plocalEffFile.get()->Get("Cascade")) : std::unique_ptr(plocalEffFile.get()->Get("AntiCascade")); + LOGF(info, "Loaded efficiency histograms for Cascade-Cascade."); + } + } } void processCascadeQA([[maybe_unused]] const FilteredFDCollision& col, const FemtoFullParticles& parts, const aod::FDCascParticles& fdcascs) @@ -484,7 +508,10 @@ struct femtoUniversePairTaskTrackCascadeExtended { if ((!confCheckTOFBachelorOnly && ((posChild.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0)) || (bachelor.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) continue; } - sameEventCont.setPair(p1, p2, multCol, confUse3D, 1.0f); + float weight = 1.0f; + if (plocalEffp1) + weight = plocalEffp1.get()->GetBinContent(plocalEffp1->FindBin(p1.pt(), p1.eta())) * plocalEffp2.get()->GetBinContent(plocalEffp2->FindBin(p2.pt(), p2.eta())); + sameEventCont.setPair(p1, p2, multCol, confUse3D, weight); } } @@ -606,7 +633,10 @@ struct femtoUniversePairTaskTrackCascadeExtended { return; } - sameEventCont.setPair(p1, p2, multCol, confUse3D, 1.0f); + float weight = 1.0f; + if (plocalEffp1) + weight = plocalEffp1.get()->GetBinContent(plocalEffp1->FindBin(p1.pt(), p1.eta())) * plocalEffp2.get()->GetBinContent(plocalEffp2->FindBin(p2.pt(), p2.eta())); + sameEventCont.setPair(p1, p2, multCol, confUse3D, weight); }; cascDuplicates.clear(); if (confCascType1 == confCascType2) { @@ -698,7 +728,10 @@ struct femtoUniversePairTaskTrackCascadeExtended { } } - mixedEventCont.setPair(p1, p2, multCol, confUse3D, 1.0f); + float weight = 1.0f; + if (plocalEffp1) + weight = plocalEffp1.get()->GetBinContent(plocalEffp1->FindBin(p1.pt(), p1.eta())) * plocalEffp2.get()->GetBinContent(plocalEffp2->FindBin(p2.pt(), p2.eta())); + mixedEventCont.setPair(p1, p2, multCol, confUse3D, weight); } }; @@ -794,7 +827,10 @@ struct femtoUniversePairTaskTrackCascadeExtended { } } - mixedEventCont.setPair(p1, p2, multCol, confUse3D, 1.0f); + float weight = 1.0f; + if (plocalEffp1) + weight = plocalEffp1.get()->GetBinContent(plocalEffp1->FindBin(p1.pt(), p1.eta())) * plocalEffp2.get()->GetBinContent(plocalEffp2->FindBin(p2.pt(), p2.eta())); + mixedEventCont.setPair(p1, p2, multCol, confUse3D, weight); } } } From 706f0f0d4f4e443b520025ba90c0e67b975a3b4a Mon Sep 17 00:00:00 2001 From: prottayCMT <61418725+prottayCMT@users.noreply.github.com> Date: Sat, 16 Aug 2025 21:09:02 +0200 Subject: [PATCH 080/986] [PWGLF] added different centrality estimators (#12584) Co-authored-by: Prottay Das --- PWGLF/Tasks/Strangeness/lambdapolsp.cxx | 29 ++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/lambdapolsp.cxx b/PWGLF/Tasks/Strangeness/lambdapolsp.cxx index 492f71e8d7d..c9af2944e34 100644 --- a/PWGLF/Tasks/Strangeness/lambdapolsp.cxx +++ b/PWGLF/Tasks/Strangeness/lambdapolsp.cxx @@ -99,6 +99,7 @@ struct lambdapolsp { Configurable cfgMaxOccupancy{"cfgMaxOccupancy", 1000, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; Configurable cfgMinOccupancy{"cfgMinOccupancy", 0, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; Configurable sys{"sys", 1, "flag to select systematic source"}; + Configurable centestim{"centestim", 0, "flag to select centrality estimator"}; Configurable dosystematic{"dosystematic", false, "flag to perform systematic study"}; Configurable needetaaxis{"needetaaxis", false, "flag to use last axis"}; struct : ConfigurableGroup { @@ -483,6 +484,7 @@ struct lambdapolsp { /*if (TMath::Abs(eta) > ConfDaughEta) { return false; }*/ + if (tpcNClsF < ConfDaughTPCnclsMin) { return false; } @@ -541,6 +543,7 @@ struct lambdapolsp { if (posTrackExtra.tpcNClsCrossedRows() < cfgTPCcluster || negTrackExtra.tpcNClsCrossedRows() < cfgTPCcluster) { return false; } + if (posTrackExtra.tpcNClsFound() < ConfDaughTPCnclsMin || negTrackExtra.tpcNClsFound() < ConfDaughTPCnclsMin) { return false; } @@ -587,12 +590,14 @@ struct lambdapolsp { if (posTrackExtra.tpcNClsCrossedRows() < cfgTPCcluster || negTrackExtra.tpcNClsCrossedRows() < cfgTPCcluster) { return false; } + if (posTrackExtra.tpcNClsFound() < ConfDaughTPCnclsMin || negTrackExtra.tpcNClsFound() < ConfDaughTPCnclsMin) { return false; } if (posTrackExtra.tpcCrossedRowsOverFindableCls() < rcrfc || negTrackExtra.tpcCrossedRowsOverFindableCls() < rcrfc) { return false; } + // check TPC PID if (((std::abs(posTrackExtra.tpcNSigmaPi()) > ConfDaughPIDCuts) || (std::abs(negTrackExtra.tpcNSigmaPi()) > ConfDaughPIDCuts))) { return false; @@ -798,7 +803,16 @@ struct lambdapolsp { if (!collision.sel8()) { return; } - auto centrality = collision.centFT0C(); + double centrality = -999.; + if (centestim == 0) + centrality = collision.centFT0C(); + else if (centestim == 1) + centrality = collision.centFT0M(); + else if (centestim == 2) + centrality = collision.centFT0A(); + else if (centestim == 3) + centrality = collision.centFV0A(); + // histos.fill(HIST("hCentrality0"), centrality); if (!collision.triggereventsp()) { return; @@ -1199,7 +1213,17 @@ struct lambdapolsp { if (!collision.sel8()) { return; } - auto centrality = collision.centFT0C(); + double centrality = -999.; + if (centestim == 0) + centrality = collision.centFT0C(); + else if (centestim == 1) + centrality = collision.centFT0M(); + else if (centestim == 2) + centrality = collision.centFT0A(); + else if (centestim == 3) + centrality = collision.centFV0A(); + + // auto centrality = collision.centFT0C(); if (!collision.triggereventsp()) { // provided by StraZDCSP return; } @@ -1617,7 +1641,6 @@ struct lambdapolsp { if (additionalEvSel4 && !collision2.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { continue; } - auto centrality = collision1.centFT0C(); auto qxZDCA = collision1.qxZDCA(); auto qxZDCC = collision1.qxZDCC(); From 4da2ac78beea83ddc25afa6b2d28f24c94a1067c Mon Sep 17 00:00:00 2001 From: abmodak <67369858+abmodak@users.noreply.github.com> Date: Sat, 16 Aug 2025 16:15:28 -0500 Subject: [PATCH 081/986] [PWGCF] Modify in FV0 eta calculation and add kIsGoodZvtxFT0vsPV event selection (#12597) --- .../Tasks/longrangeCorrelation.cxx | 102 +++++++++++------- 1 file changed, 65 insertions(+), 37 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx index f9839d9e502..02cd3ac1d0a 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx @@ -75,6 +75,19 @@ static constexpr TrackSelectionFlags::flagtype TrackSelectionDca = static constexpr TrackSelectionFlags::flagtype TrackSelectionDcaxyOnly = TrackSelectionFlags::kDCAxy; +enum KindOfEvntType { + kSE, + kME +}; + +enum KindOfCorrType { + kFT0AGLOBAL, + kFT0CGLOBAL, + kFV0GLOBAL, + kMFTGLOBAL, + kFV0MFT +}; + static constexpr std::string_view kCorrType[] = {"Ft0aGlobal/", "Ft0cGlobal/", "Fv0Global/", "MftGlobal/", "Fv0Mft/"}; static constexpr std::string_view kEvntType[] = {"SE/", "ME/"}; @@ -107,6 +120,8 @@ struct LongrangeCorrelation { Configurable cfigMftCluster{"cfigMftCluster", 5, "cut on MFT Cluster"}; Configurable cfgSampleSize{"cfgSampleSize", 10, "Sample size for mixed event"}; Configurable isApplySameBunchPileup{"isApplySameBunchPileup", false, "Enable SameBunchPileup cut"}; + Configurable isApplyGoodZvtxFT0vsPV{"isApplyGoodZvtxFT0vsPV", false, "Enable GoodZvtxFT0vsPV cut"}; + Configurable isReadoutCenter{"isReadoutCenter", false, "Enable Readout Center"}; ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -PIHalf, PIHalf * 3}, "delta phi axis for histograms"}; ConfigurableAxis axisDeltaEta{"axisDeltaEta", {40, -6, -2}, "delta eta axis for histograms"}; ConfigurableAxis axisPtTrigger{"axisPtTrigger", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 10.0}, "pt trigger axis for histograms"}; @@ -145,7 +160,7 @@ struct LongrangeCorrelation { OutputObj sameFv0Mft{Form("sameEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; OutputObj mixedFv0Mft{Form("mixedEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; - template + template void addHistos() { histos.add(Form("%s%shMult", kCorrType[corrType].data(), kEvntType[evntType].data()), "", kTH1D, {axisMultiplicity}); @@ -200,40 +215,41 @@ struct LongrangeCorrelation { x->SetBinLabel(1, "All events"); x->SetBinLabel(2, "sel8"); x->SetBinLabel(3, "kNoSameBunchPileup"); // reject collisions in case of pileup with another collision in the same foundBC - x->SetBinLabel(4, "|vz|<10"); + x->SetBinLabel(4, "kIsGoodZvtxFT0vsPV"); // small difference between z-vertex from PV and from FT0 + x->SetBinLabel(5, "|vz|<10"); } if (doprocessFt0aGlobalSE || doprocessFt0aGlobalME) { - addHistos<0, 0>(); - addHistos<0, 1>(); + addHistos(); + addHistos(); sameFt0aGlobal.setObject(new CorrelationContainer(Form("sameEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); mixedFt0aGlobal.setObject(new CorrelationContainer(Form("mixedEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); } if (doprocessFt0cGlobalSE || doprocessFt0cGlobalME) { - addHistos<1, 0>(); - addHistos<1, 1>(); + addHistos(); + addHistos(); sameFt0cGlobal.setObject(new CorrelationContainer(Form("sameEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); mixedFt0cGlobal.setObject(new CorrelationContainer(Form("mixedEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); } if (doprocessFv0GlobalSE || doprocessFv0GlobalME) { - addHistos<2, 0>(); - addHistos<2, 1>(); + addHistos(); + addHistos(); sameFv0Global.setObject(new CorrelationContainer(Form("sameEventFv0Global_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFv0Global_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); mixedFv0Global.setObject(new CorrelationContainer(Form("mixedEventFv0Global_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFv0Global_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); } if (doprocessMftGlobalSE || doprocessMftGlobalME) { - addHistos<3, 0>(); - addHistos<3, 1>(); + addHistos(); + addHistos(); sameMftGlobal.setObject(new CorrelationContainer(Form("sameEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); mixedMftGlobal.setObject(new CorrelationContainer(Form("mixedEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); } if (doprocessFv0MftSE || doprocessFv0MftME) { - addHistos<4, 0>(); - addHistos<4, 1>(); + addHistos(); + addHistos(); sameFv0Mft.setObject(new CorrelationContainer(Form("sameEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); mixedFv0Mft.setObject(new CorrelationContainer(Form("mixedEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); } @@ -252,14 +268,14 @@ struct LongrangeCorrelation { Filter fMftTrackColID = (aod::fwdtrack::bestCollisionId >= 0); Filter fMftTrackDca = (nabs(aod::fwdtrack::bestDCAXY) < cfigMftDcaxy); - double getPhiFT0(int chno, int i) + double getPhiFT0(UInt_t chno, int i) { ft0Det.calculateChannelCenter(); auto chPos = ft0Det.getChannelCenter(chno); return RecoDecay::phi(chPos.X() + (*offsetFT0)[i].getX(), chPos.Y() + (*offsetFT0)[i].getY()); } - double getPhiFV0(int chno) + double getPhiFV0(UInt_t chno) { int cellsInLeft[] = {0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27, 32, 40, 33, 41, 34, 42, 35, 43}; bool isChnoInLeft = std::find(std::begin(cellsInLeft), std::end(cellsInLeft), chno) != std::end(cellsInLeft); @@ -272,11 +288,15 @@ struct LongrangeCorrelation { offsetY = (*offsetFV0)[1].getY(); } - auto chPos = fv0Det->getReadoutCenter(chno); + o2::fv0::Point3Dsimple chPos; + if (isReadoutCenter) + chPos = fv0Det->getReadoutCenter(chno); + else + chPos = fv0Det->getCellCenter(chno); return RecoDecay::phi(chPos.x + offsetX, chPos.y + offsetY); } - double getEtaFT0(int chno, int i) + double getEtaFT0(UInt_t chno, int i) { ft0Det.calculateChannelCenter(); auto chPos = ft0Det.getChannelCenter(chno); @@ -288,7 +308,7 @@ struct LongrangeCorrelation { return -std::log(std::tan(0.5 * theta)); } - double getEtaFV0(int chno) + double getEtaFV0(UInt_t chno) { int cellsInLeft[] = {0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27, 32, 40, 33, 41, 34, 42, 35, 43}; bool isChnoInLeft = std::find(std::begin(cellsInLeft), std::end(cellsInLeft), chno) != std::end(cellsInLeft); @@ -303,7 +323,12 @@ struct LongrangeCorrelation { offsetZ = (*offsetFV0)[1].getZ(); } - auto chPos = fv0Det->getReadoutCenter(chno); + o2::fv0::Point3Dsimple chPos; + if (isReadoutCenter) + chPos = fv0Det->getReadoutCenter(chno); + else + chPos = fv0Det->getCellCenter(chno); + auto x = chPos.x + offsetX; auto y = chPos.y + offsetY; auto z = chPos.z + offsetZ; @@ -321,6 +346,9 @@ struct LongrangeCorrelation { if (isApplySameBunchPileup && !col.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { return false; } + if (isApplyGoodZvtxFT0vsPV && !col.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + return false; + } if (std::abs(col.posZ()) >= cfgVtxCut) { return false; } @@ -336,7 +364,7 @@ struct LongrangeCorrelation { return true; } - template + template void fillYield(TTracks tracks) { if (evntType == 1) { @@ -371,8 +399,7 @@ struct LongrangeCorrelation { for (std::size_t iCh = 0; iCh < ft0.channelA().size(); iCh++) { auto chanelid = ft0.channelA()[iCh]; float ampl = ft0.amplitudeA()[iCh]; - if (ampl <= 0) - continue; + if (mixing) histos.fill(HIST("Ft0aGlobal/ME/Assoc_amp"), chanelid, ampl); else @@ -414,8 +441,7 @@ struct LongrangeCorrelation { for (std::size_t iCh = 0; iCh < ft0.channelC().size(); iCh++) { auto chanelid = ft0.channelC()[iCh]; float ampl = ft0.amplitudeC()[iCh]; - if (ampl <= 0) - continue; + if (mixing) histos.fill(HIST("Ft0cGlobal/ME/Assoc_amp"), chanelid, ampl); else @@ -493,8 +519,7 @@ struct LongrangeCorrelation { for (std::size_t iCh = 0; iCh < fv0.channel().size(); iCh++) { auto chanelid = fv0.channel()[iCh]; float ampl = fv0.amplitude()[iCh]; - if (ampl <= 0) - continue; + if (mixing) histos.fill(HIST("Fv0Global/ME/Assoc_amp"), chanelid, ampl); else @@ -542,8 +567,7 @@ struct LongrangeCorrelation { for (std::size_t iCh = 0; iCh < fv0.channel().size(); iCh++) { auto chanelid = fv0.channel()[iCh]; float ampl = fv0.amplitude()[iCh]; - if (ampl <= 0) - continue; + if (mixing) histos.fill(HIST("Fv0Mft/ME/Assoc_amp"), chanelid, ampl); else @@ -584,10 +608,14 @@ struct LongrangeCorrelation { return; } histos.fill(HIST("QA/EventHist"), 3); - if (std::abs(col.posZ()) >= cfgVtxCut) { + if (isApplyGoodZvtxFT0vsPV && !col.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { return; } histos.fill(HIST("QA/EventHist"), 4); + if (std::abs(col.posZ()) >= cfgVtxCut) { + return; + } + histos.fill(HIST("QA/EventHist"), 5); histos.fill(HIST("QA/VtxZHist"), col.posZ()); } @@ -597,7 +625,7 @@ struct LongrangeCorrelation { return; } if (col.has_foundFT0()) { - fillYield<0, 0>(tracks); + fillYield(tracks); const auto& ft0 = col.foundFT0(); if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { return; @@ -612,7 +640,7 @@ struct LongrangeCorrelation { return; } if (col.has_foundFT0()) { - fillYield<1, 0>(tracks); + fillYield(tracks); const auto& ft0 = col.foundFT0(); if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { return; @@ -626,7 +654,7 @@ struct LongrangeCorrelation { if (!isEventSelected(col)) { return; } - fillYield<3, 0>(tracks); + fillYield(tracks); if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { return; } @@ -639,7 +667,7 @@ struct LongrangeCorrelation { return; } if (col.has_foundFV0()) { - fillYield<2, 0>(tracks); + fillYield(tracks); const auto& fv0 = col.foundFV0(); if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { return; @@ -654,7 +682,7 @@ struct LongrangeCorrelation { return; } if (col.has_foundFV0()) { - fillYield<4, 0>(mfttracks); + fillYield(mfttracks); const auto& fv0 = col.foundFV0(); if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { return; @@ -681,7 +709,7 @@ struct LongrangeCorrelation { } if (col1.has_foundFT0() && col2.has_foundFT0()) { auto slicedTriggerTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); - fillYield<0, 1>(slicedTriggerTracks); + fillYield(slicedTriggerTracks); const auto& ft0 = col2.foundFT0(); if (slicedTriggerTracks.size() < cfgMinMult || slicedTriggerTracks.size() >= cfgMaxMult) { continue; @@ -709,7 +737,7 @@ struct LongrangeCorrelation { } if (col1.has_foundFT0() && col2.has_foundFT0()) { auto slicedTriggerTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); - fillYield<1, 1>(slicedTriggerTracks); + fillYield(slicedTriggerTracks); const auto& ft0 = col2.foundFT0(); if (slicedTriggerTracks.size() < cfgMinMult || slicedTriggerTracks.size() >= cfgMaxMult) { continue; @@ -759,7 +787,7 @@ struct LongrangeCorrelation { } if (col1.has_foundFV0() && col2.has_foundFV0()) { auto slicedTriggerTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); - fillYield<2, 1>(slicedTriggerTracks); + fillYield(slicedTriggerTracks); const auto& fv0 = col2.foundFV0(); if (slicedTriggerTracks.size() < cfgMinMult || slicedTriggerTracks.size() >= cfgMaxMult) { continue; @@ -788,7 +816,7 @@ struct LongrangeCorrelation { if (col1.has_foundFV0() && col2.has_foundFV0()) { auto slicedGlobalTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); auto slicedTriggerMftTracks = mfttracks.sliceBy(perColMft, col1.globalIndex()); - fillYield<4, 1>(slicedTriggerMftTracks); + fillYield(slicedTriggerMftTracks); const auto& fv0 = col2.foundFV0(); if (slicedGlobalTracks.size() < cfgMinMult || slicedGlobalTracks.size() >= cfgMaxMult) { continue; From e1df710bff14dec35c2d027c87d8b16a8def04a9 Mon Sep 17 00:00:00 2001 From: Victor Gonzalez Date: Sun, 17 Aug 2025 01:57:17 +0200 Subject: [PATCH 082/986] [PWGCF] DptDpt - Multiplicity observables correlations (#12604) Co-authored-by: Victor --- PWGCF/TableProducer/dptDptFilter.cxx | 170 ++++++++++++++++++++++++--- 1 file changed, 154 insertions(+), 16 deletions(-) diff --git a/PWGCF/TableProducer/dptDptFilter.cxx b/PWGCF/TableProducer/dptDptFilter.cxx index 7d49129b992..ee44859500f 100644 --- a/PWGCF/TableProducer/dptDptFilter.cxx +++ b/PWGCF/TableProducer/dptDptFilter.cxx @@ -97,18 +97,59 @@ const char* speciesName[kDptDptNoOfSpecies] = {"h", "e", "mu", "pi", "ka", "p"}; const char* speciesTitle[kDptDptNoOfSpecies] = {"", "e", "#mu", "#pi", "K", "p"}; +/// \enum BeforeAfter +/// \brief when filling the histograms +enum BeforeAfter { + BeforeAfterBEFORE = 0, ///< filling the histograms before selections + BeforeAfterAFTER, ///< filling the histograms after selections + BeforeAfterNOOFTIMES ///< how many times fill the histograms +}; + +static const std::vector beforeAfterName = {"before", ""}; +static const std::vector beforeAfterSufix = {"B", "A"}; + +/* helpers for the multiplicity axes definition */ +#define DPTDPTCENTRALITYAXIS 105, -0.5f, 104.5f +#define DPTDPTMULTIPLIICTYAXIS 1001, -0.5f, 1000.5f +#define DPTDPTFWMULTIPLICITYAXIS 1000, 0.0f, 100000.0f + //============================================================================================ // The DptDptFilter histogram objects // TODO: consider registering in the histogram registry //============================================================================================ +/* event/collision histograms */ TH1D* fhEventSelection = nullptr; TH1D* fhTriggerSelection = nullptr; +TH2D* fhTriggerSelectionCorrelations = nullptr; TH1F* fhCentMultB = nullptr; TH1F* fhCentMultA = nullptr; TH1F* fhVertexZB = nullptr; TH1F* fhVertexZA = nullptr; TH1F* fhMultB = nullptr; TH1F* fhMultA = nullptr; + +/* multiplicty correlation histograms */ +/* B: before, A: after collision selection */ +/* credits: A. Dobrin team! */ +TH2F* fhMultiplicityVsCentrality[BeforeAfterNOOFTIMES] = {nullptr}; +TH2F* fhMultiplicityVsT0cMultiplicity[BeforeAfterNOOFTIMES] = {nullptr}; +TH2F* fhMultiplicityVsT0aMultiplicity[BeforeAfterNOOFTIMES] = {nullptr}; +TH2F* fhMultiplicityVsV0aMultiplicity[BeforeAfterNOOFTIMES] = {nullptr}; +TH2F* fhMultiplicityVsPvMultiplicity[BeforeAfterNOOFTIMES] = {nullptr}; +TH2F* fhPvMultiplicityVsCentrality[BeforeAfterNOOFTIMES] = {nullptr}; +TH2F* fhPvMultiplicityVsT0cMultiplicity[BeforeAfterNOOFTIMES] = {nullptr}; +TH2F* fhPvMultiplicityVsT0aMultiplicity[BeforeAfterNOOFTIMES] = {nullptr}; +TH2F* fhPvMultiplicityVsV0aMultiplicity[BeforeAfterNOOFTIMES] = {nullptr}; +TH2F* fhV0aMultiplicityVsCentrality[BeforeAfterNOOFTIMES] = {nullptr}; +TH2F* fhV0aMultiplicityVsT0cMultiplicity[BeforeAfterNOOFTIMES] = {nullptr}; +TH2F* fhV0aMultiplicityVsT0aMultiplicity[BeforeAfterNOOFTIMES] = {nullptr}; +TH2F* fhT0cMultiplicityVsCentrality[BeforeAfterNOOFTIMES] = {nullptr}; +TH2F* fhT0cMultiplicityVsT0aMultiplicity[BeforeAfterNOOFTIMES] = {nullptr}; +TH2F* fhT0CentralityVsCentrality[BeforeAfterNOOFTIMES] = {nullptr}; +TH2F* fhV0aCentralityVsCentrality[BeforeAfterNOOFTIMES] = {nullptr}; +TH2F* fhNtpvCentralityVsCentrality[BeforeAfterNOOFTIMES] = {nullptr}; + +/* track histograms */ TH1F* fhPB = nullptr; std::vector fhPA; TH1F* fhPtB = nullptr; @@ -138,11 +179,14 @@ TH2F* fhAmbiguousTrackPt = nullptr; TH2F* fhAmbiguityDegree = nullptr; TH2F* fhCompatibleCollisionsZVtxRms = nullptr; +/* MC generator level event/collision histograms */ TH1F* fhTrueCentMultB = nullptr; TH1F* fhTrueCentMultA = nullptr; TH1F* fhTrueVertexZB = nullptr; TH1F* fhTrueVertexZA = nullptr; TH1F* fhTrueVertexZAA = nullptr; + +/* MC generator level particle histograms */ TH1F* fhTruePB = nullptr; std::vector fhTruePA; TH1F* fhTruePtB = nullptr; @@ -344,25 +388,27 @@ struct Multiplicity { struct DptDptFilter { struct : ConfigurableGroup { - Configurable cfgCCDBUrl{"cfgCCDBUrl", "http://ccdb-test.cern.ch:8080", "The CCDB url for the input file"}; - Configurable cfgCCDBPathName{"cfgCCDBPathName", "", "The CCDB path for the input file. Default \"\", i.e. don't load from CCDB"}; - Configurable cfgCCDBDate{"cfgCCDBDate", "20220307", "The CCDB date for the input file"}; - Configurable cfgCCDBPeriod{"cfgCCDBPeriod", "LHC22o", "The CCDB dataset period for the input file"}; + std::string prefix = "cfgCCDB"; + Configurable url{"url", "http://ccdb-test.cern.ch:8080", "The CCDB url for the input file"}; + Configurable pathName{"pathName", "", "The CCDB path for the input file. Default \"\", i.e. don't load from CCDB"}; + Configurable date{"date", "20220307", "The CCDB date for the input file"}; + Configurable period{"period", "LHC22o", "The CCDB dataset period for the input file"}; } cfginputfile; Configurable cfgFullDerivedData{"cfgFullDerivedData", false, "Produce the full derived data for external storage. Default false"}; Configurable cfgCentMultEstimator{"cfgCentMultEstimator", "V0M", "Centrality/multiplicity estimator detector: V0M,CL0,CL1,FV0A,FT0M,FT0A,FT0C,NTPV,NOCM: none. Default V0M"}; struct : ConfigurableGroup { std::string prefix = "cfgEventSelection"; + Configurable fillQc{"fillQc", false, "Fill the quality control histograms. Default: false"}; Configurable minOrbit{"minOrbit", -1, "Lowest orbit to track"}; Configurable maxOrbit{"maxOrbit", INT64_MAX, "Highest orbit to track"}; Configurable rctSource{"rctSource", "None", "RCT selection source: None,CBT,CBT_hadronPID,CBT_electronPID,CBT_calo,CBT_muon,CBT_muon_glo. Default: None"}; struct : ConfigurableGroup { - std::string prefix = "cfgEventSelection.cfgOccupancySelection"; - Configurable cfgOccupancyEstimation{"cfgOccupancyEstimation", "None", "Occupancy estimation: None, Tracks, FT0C. Default None"}; - Configurable cfgMinOccupancy{"cfgMinOccupancy", 0.0f, "Minimum allowed occupancy. Depends on the occupancy estimation"}; - Configurable cfgMaxOccupancy{"cfgMaxOccupancy", 1e6f, "Maximum allowed occupancy. Depends on the occupancy estimation"}; - } cfgOccupancySelection; + std::string prefix = "cfgEventSelection.occupancySelection"; + Configurable occupancyEstimation{"occupancyEstimation", "None", "Occupancy estimation: None, Tracks, FT0C. Default None"}; + Configurable minOccupancy{"minOccupancy", 0.0f, "Minimum allowed occupancy. Depends on the occupancy estimation"}; + Configurable maxOccupancy{"maxOccupancy", 1e6f, "Maximum allowed occupancy. Depends on the occupancy estimation"}; + } occupancySelection; } cfgEventSelection; Configurable cfgSystem{"cfgSystem", "PbPb", "System: pp, PbPb, Pbp, pPb, XeXe, ppRun3, PbPbRun3. Default PbPb"}; Configurable cfgDataType{"cfgDataType", "data", "Data type: data, datanoevsel, MC, FastMC, OnTheFlyMC. Default data"}; @@ -429,9 +475,9 @@ struct DptDptFilter { } /* the occupancy selection */ - fOccupancyEstimation = getOccupancyEstimator(cfgEventSelection.cfgOccupancySelection.cfgOccupancyEstimation); - fMinOccupancy = cfgEventSelection.cfgOccupancySelection.cfgMinOccupancy; - fMaxOccupancy = cfgEventSelection.cfgOccupancySelection.cfgMaxOccupancy; + fOccupancyEstimation = getOccupancyEstimator(cfgEventSelection.occupancySelection.occupancyEstimation); + fMinOccupancy = cfgEventSelection.occupancySelection.minOccupancy; + fMaxOccupancy = cfgEventSelection.occupancySelection.maxOccupancy; /* the trigger selection */ triggerSelectionFlags = getTriggerSelection(cfgTriggSel); @@ -456,6 +502,13 @@ struct DptDptFilter { for (int ix = 0; ix < TriggSelNOOFTRIGGERS; ++ix) { fhTriggerSelection->GetXaxis()->SetBinLabel(ix + 1, TString::Format("#color[%d]{%s}", triggerSelectionFlags.test(ix) ? 2 : 1, triggerSelectionExternalNamesMap.at(ix).c_str()).Data()); } + fhTriggerSelectionCorrelations = new TH2D("TriggerSelectionCorrelations", ";;;counts", + TriggSelNOOFTRIGGERS, -0.5f, static_cast(TriggSelNOOFTRIGGERS) - 0.5f, + TriggSelNOOFTRIGGERS, -0.5f, static_cast(TriggSelNOOFTRIGGERS) - 0.5f); + for (int ixy = 0; ixy < TriggSelNOOFTRIGGERS; ++ixy) { + fhTriggerSelectionCorrelations->GetXaxis()->SetBinLabel(ixy + 1, TString::Format("#color[%d]{%s}", triggerSelectionFlags.test(ixy) ? 2 : 1, triggerSelectionExternalNamesMap.at(ixy).c_str()).Data()); + fhTriggerSelectionCorrelations->GetYaxis()->SetBinLabel(ixy + 1, TString::Format("#color[%d]{%s}", triggerSelectionFlags.test(ixy) ? 2 : 1, triggerSelectionExternalNamesMap.at(ixy).c_str()).Data()); + } /* TODO: proper axes and axes titles according to the system; still incomplete */ std::string multestimator = getCentMultEstimatorName(fCentMultEstimator); if (fSystem > kPbp) { @@ -474,15 +527,61 @@ struct DptDptFilter { fhVertexZB = new TH1F("VertexZB", "Vertex Z; z_{vtx}", 60, -15, 15); fhVertexZA = new TH1F("VertexZA", "Vertex Z; z_{vtx}", zvtxbins, zvtxlow, zvtxup); + if (cfgEventSelection.fillQc) { + /* the quality control histograms */ + for (int i = 0; i < BeforeAfterNOOFTIMES; ++i) { + fhMultiplicityVsCentrality[i] = new TH2F(TString::Format("MultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;Centrality (%%);Number of tracks", beforeAfterName[i].c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLIICTYAXIS); + fhMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsT0cMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0C Multiplicity;Number of tracks", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS, DPTDPTMULTIPLIICTYAXIS); + fhMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsT0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0A Multiplicity;Number of tracks", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS, DPTDPTMULTIPLIICTYAXIS); + fhMultiplicityVsV0aMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsV0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;V0A Multiplicity;Number of tracks", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS, DPTDPTMULTIPLIICTYAXIS); + fhMultiplicityVsPvMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsPvMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;PV contributors;Number of tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLIICTYAXIS, DPTDPTMULTIPLIICTYAXIS); + fhPvMultiplicityVsCentrality[i] = new TH2F(TString::Format("PvMultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;Centrality (%%);PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLIICTYAXIS); + fhPvMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("PvMultiplicityVsT0cMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0C multiplicity;PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS, DPTDPTMULTIPLIICTYAXIS); + fhPvMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("PvMultiplicityVsT0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0A multiplicity;PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS, DPTDPTMULTIPLIICTYAXIS); + fhPvMultiplicityVsV0aMultiplicity[i] = new TH2F(TString::Format("PvMultiplicityVsV0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;V0A multiplicity;PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS, DPTDPTMULTIPLIICTYAXIS); + fhV0aMultiplicityVsCentrality[i] = new TH2F(TString::Format("V0aMultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;Centrality (%%);V0A multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTFWMULTIPLICITYAXIS); + fhV0aMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("V0aMultiplicityVsT0cMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0C multiplicity;V0A multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS, DPTDPTFWMULTIPLICITYAXIS); + fhV0aMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("V0aMultiplicityVsT0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0A multiplicity;V0A multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS, DPTDPTFWMULTIPLICITYAXIS); + fhT0cMultiplicityVsCentrality[i] = new TH2F(TString::Format("T0cMultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;Centrality (%%);T0C multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTFWMULTIPLICITYAXIS); + fhT0cMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("T0cMultiplicityVsT0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0A multiplicity;T0C multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS, DPTDPTFWMULTIPLICITYAXIS); + fhT0CentralityVsCentrality[i] = new TH2F(TString::Format("T0CentralityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;Centrality (%%);T0 centrality(%%)", beforeAfterName[i].c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTCENTRALITYAXIS); + fhV0aCentralityVsCentrality[i] = new TH2F(TString::Format("V0aCentralityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;Centrality (%%);V0A centrality (%%)", beforeAfterName[i].c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTCENTRALITYAXIS); + fhNtpvCentralityVsCentrality[i] = new TH2F(TString::Format("NtpvCentralityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;Centrality (%%);NTPV centrality (%%)", beforeAfterName[i].c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTCENTRALITYAXIS); + } + } + /* add the hstograms to the output list */ fOutputList->Add(fhEventSelection); fOutputList->Add(fhTriggerSelection); + fOutputList->Add(fhTriggerSelectionCorrelations); fOutputList->Add(fhCentMultB); fOutputList->Add(fhCentMultA); fOutputList->Add(fhMultB); fOutputList->Add(fhMultA); fOutputList->Add(fhVertexZB); fOutputList->Add(fhVertexZA); + if (cfgEventSelection.fillQc) { + for (int i = 0; i < BeforeAfterNOOFTIMES; ++i) { + /* the quality control histograms */ + fOutputList->Add(fhMultiplicityVsCentrality[i]); + fOutputList->Add(fhMultiplicityVsT0cMultiplicity[i]); + fOutputList->Add(fhMultiplicityVsT0aMultiplicity[i]); + fOutputList->Add(fhMultiplicityVsV0aMultiplicity[i]); + fOutputList->Add(fhMultiplicityVsPvMultiplicity[i]); + fOutputList->Add(fhPvMultiplicityVsCentrality[i]); + fOutputList->Add(fhPvMultiplicityVsT0cMultiplicity[i]); + fOutputList->Add(fhPvMultiplicityVsT0aMultiplicity[i]); + fOutputList->Add(fhPvMultiplicityVsV0aMultiplicity[i]); + fOutputList->Add(fhV0aMultiplicityVsCentrality[i]); + fOutputList->Add(fhV0aMultiplicityVsT0cMultiplicity[i]); + fOutputList->Add(fhV0aMultiplicityVsT0aMultiplicity[i]); + fOutputList->Add(fhT0cMultiplicityVsCentrality[i]); + fOutputList->Add(fhT0cMultiplicityVsT0aMultiplicity[i]); + fOutputList->Add(fhT0CentralityVsCentrality[i]); + fOutputList->Add(fhV0aCentralityVsCentrality[i]); + fOutputList->Add(fhNtpvCentralityVsCentrality[i]); + } + } } if ((fDataType != kData) && (fDataType != kDataNoEvtSel)) { @@ -613,13 +712,52 @@ void DptDptFilter::processReconstructed(CollisionObject const& collision, Tracks for (int iflag = 0; iflag < TriggSelNOOFTRIGGERS; ++iflag) { if (triggerFlags.test(iflag)) { fhTriggerSelection->Fill(iflag); + for (int jflag = 0; jflag < TriggSelNOOFTRIGGERS; ++jflag) { + if (triggerFlags.test(jflag)) { + fhTriggerSelectionCorrelations->Fill(iflag, jflag); + } + } } } for (int iflag = 0; iflag < CollSelNOOFFLAGS; ++iflag) { if (collisionFlags.test(iflag)) { fhEventSelection->Fill(iflag); + } else { + if (iflag >= CollSelTRIGGSELBIT) { + /* don't report not accepted events */ + break; + } } } + /* report QC information if required */ + if (cfgEventSelection.fillQc) { + [&](bool accepted) { + for (int i = 0; i < BeforeAfterNOOFTIMES; ++i) { + fhMultiplicityVsCentrality[i]->Fill(centormult, ftracks.size()); + fhMultiplicityVsT0cMultiplicity[i]->Fill(collision.multFT0C(), ftracks.size()); + fhMultiplicityVsT0aMultiplicity[i]->Fill(collision.multFT0A(), ftracks.size()); + fhMultiplicityVsV0aMultiplicity[i]->Fill(collision.multFV0A(), ftracks.size()); + fhMultiplicityVsPvMultiplicity[i]->Fill(collision.multNTracksPV(), ftracks.size()); + fhPvMultiplicityVsCentrality[i]->Fill(centormult, collision.multNTracksPV()); + fhPvMultiplicityVsT0cMultiplicity[i]->Fill(collision.multFT0C(), collision.multNTracksPV()); + fhPvMultiplicityVsT0aMultiplicity[i]->Fill(collision.multFT0A(), collision.multNTracksPV()); + fhPvMultiplicityVsV0aMultiplicity[i]->Fill(collision.multFV0A(), collision.multNTracksPV()); + fhV0aMultiplicityVsCentrality[i]->Fill(centormult, collision.multFV0A()); + fhV0aMultiplicityVsT0cMultiplicity[i]->Fill(collision.multFT0C(), collision.multFV0A()); + fhV0aMultiplicityVsT0aMultiplicity[i]->Fill(collision.multFT0A(), collision.multFV0A()); + fhT0cMultiplicityVsCentrality[i]->Fill(centormult, collision.multFT0C()); + fhT0cMultiplicityVsT0aMultiplicity[i]->Fill(collision.multFT0A(), collision.multFT0C()); + if constexpr (framework::has_type_v) { + fhT0CentralityVsCentrality[i]->Fill(centormult, collision.centFT0M()); + fhV0aCentralityVsCentrality[i]->Fill(centormult, collision.centFV0A()); + fhNtpvCentralityVsCentrality[i]->Fill(centormult, collision.centNTPV()); + } + /* if not accepted only before is filled */ + if (!accepted) + break; + } + }(acceptedevent); + } } void DptDptFilter::processWithCent(aod::CollisionEvSelCent const& collision, DptDptFullTracks const& ftracks, aod::BCsWithTimestamps const&) @@ -863,10 +1001,10 @@ struct DptDptFilterTracks { tpcExclude = static_cast(tmpTpcExclude); } /* self configure the CCDB access to the input file */ - getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDBUrl", cfgCCDBUrl, false); - getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDBPathName", cfgCCDBPathName, false); - getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDBDate", cfgCCDBDate, false); - getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDBPeriod", cfgCCDBPeriod, false); + getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.url", cfgCCDBUrl, false); + getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.pathName", cfgCCDBPathName, false); + getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.date", cfgCCDBDate, false); + getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.period", cfgCCDBPeriod, false); /* create the output list which will own the task histograms */ TList* fOutputList = new TList(); From d7797f9ff7b2c616ba91669801f9d0ad59921c18 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sun, 17 Aug 2025 16:02:24 +0200 Subject: [PATCH 083/986] [PWGEM/Dilepton] update 2pc (#12606) --- PWGEM/Dilepton/Core/DileptonHadronMPC.h | 2 +- PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGEM/Dilepton/Core/DileptonHadronMPC.h b/PWGEM/Dilepton/Core/DileptonHadronMPC.h index 5f157ade948..11fedd03212 100644 --- a/PWGEM/Dilepton/Core/DileptonHadronMPC.h +++ b/PWGEM/Dilepton/Core/DileptonHadronMPC.h @@ -523,7 +523,7 @@ struct DileptonHadronMPC { // fRegistry.addClone("DileptonHadron/same/", "DileptonHadron/mix/"); // hadron-hadron - const AxisSpec axis_dphi_hh{cfgNbinsDPhi, -M_PI / 2, 3 * M_PI / 2, "#Delta#varphi = #varphi_{h}^{ref1} - #varphi_{h}^{ref2} (rad.)"}; + const AxisSpec axis_dphi_hh{90, -M_PI / 2, 3 * M_PI / 2, "#Delta#varphi = #varphi_{h}^{ref1} - #varphi_{h}^{ref2} (rad.)"}; fRegistry.add("HadronHadron/same/hDEtaDPhi", "hadron-hadron 2PC", kTH2D, {axis_dphi_hh, axis_deta_hh}, true); fRegistry.addClone("HadronHadron/same/", "HadronHadron/mix/"); fRegistry.add("HadronHadron/mix/hDiffBC", "diff. global BC in mixed event;|BC_{current} - BC_{mixed}|", kTH1D, {{10001, -0.5, 10000.5}}, true); diff --git a/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h index 01619ba089c..7478a70a764 100644 --- a/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h +++ b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h @@ -368,7 +368,7 @@ struct DiphotonHadronMPC { // hadron-hadron const AxisSpec axis_deta_hh{60, -3, +3, "#Delta#eta = #eta_{h}^{ref1} - #eta_{h}^{ref2}"}; - const AxisSpec axis_dphi_hh{cfgNbinsDPhi, -M_PI / 2, +3 * M_PI / 2, "#Delta#varphi = #varphi_{h}^{ref1} - #varphi_{h}^{ref2} (rad.)"}; + const AxisSpec axis_dphi_hh{90, -M_PI / 2, +3 * M_PI / 2, "#Delta#varphi = #varphi_{h}^{ref1} - #varphi_{h}^{ref2} (rad.)"}; // const AxisSpec axis_cosndphi_hh{cfgNbinsCosNDPhi, -1, +1, std::format("cos({0:d}(#varphi_{{h}}^{{ref1}} - #varphi_{{h}}^{{ref2}}))", cfgNmod.value)}; fRegistry.add("HadronHadron/same/hDEtaDPhi", "hadron-hadron 2PC", kTH2D, {axis_dphi_hh, axis_deta_hh}, true); fRegistry.addClone("HadronHadron/same/", "HadronHadron/mix/"); From 039aadc8b43275cb3b677e0b1b96255dc063fd6f Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Mon, 18 Aug 2025 01:10:45 +0530 Subject: [PATCH 084/986] [PWGLF] Optimised code (#12601) --- .../Tasks/Resonances/higherMassResonances.cxx | 1096 +++++++---------- 1 file changed, 471 insertions(+), 625 deletions(-) diff --git a/PWGLF/Tasks/Resonances/higherMassResonances.cxx b/PWGLF/Tasks/Resonances/higherMassResonances.cxx index 3a34c13fad2..7b13c8e0596 100644 --- a/PWGLF/Tasks/Resonances/higherMassResonances.cxx +++ b/PWGLF/Tasks/Resonances/higherMassResonances.cxx @@ -51,6 +51,7 @@ #include #include #include +#include #include #include @@ -69,50 +70,57 @@ struct HigherMassResonances { HistogramRegistry hglue{"hglueball", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry hMChists{"hMChists", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - struct RCTCut : ConfigurableGroup { + struct : ConfigurableGroup { Configurable requireRCTFlagChecker{"requireRCTFlagChecker", true, "Check event quality in run condition table"}; Configurable cfgEvtRCTFlagCheckerLabel{"cfgEvtRCTFlagCheckerLabel", "CBT_hadronPID", "Evt sel: RCT flag checker label"}; Configurable cfgEvtRCTFlagCheckerZDCCheck{"cfgEvtRCTFlagCheckerZDCCheck", false, "Evt sel: RCT flag checker ZDC check"}; Configurable cfgEvtRCTFlagCheckerLimitAcceptAsBad{"cfgEvtRCTFlagCheckerLimitAcceptAsBad", true, "Evt sel: RCT flag checker treat Limited Acceptance As Bad"}; - - RCTFlagsChecker rctChecker; + } rctCut; + RCTFlagsChecker rctChecker; + + enum MultEstimator { + kFT0M, + kFT0A, + kFT0C, + kFV0A, + kFV0C, + kFV0M, + kNEstimators // useful if you want to iterate or size things }; - RCTCut rctCut; struct : ConfigurableGroup { // PID and QA Configurable qAv0{"qAv0", false, "qAv0"}; Configurable qAPID{"qAPID", true, "qAPID"}; - // Configurable qAv0Daughters{"qAv0Daughters", false, "QA of v0 daughters"}; Configurable qAevents{"qAevents", false, "QA of events"}; - // Configurable invMass1D{"invMass1D", false, "1D invariant mass histograms"}; Configurable correlation2Dhist{"correlation2Dhist", true, "Lamda K0 mass correlation"}; - Configurable cDCAv0topv{"cDCAv0topv", false, "DCA V0 to PV"}; - // Configurable armcut{"armcut", false, "arm cut"}; - Configurable globalTracks{"globalTracks", false, "Global tracks"}; + Configurable isApplyDCAv0topv{"isApplyDCAv0topv", false, "DCA V0 to PV"}; Configurable hasTPC{"hasTPC", false, "TPC"}; - Configurable selectTWOKsOnly{"selectTWOKsOnly", true, "Select only events with two K0s"}; - Configurable applyPairRapidityRec{"applyPairRapidityRec", false, "Apply pair rapidity cut on reconstructed mother (after already applying rapidity cut on generated mother)"}; - Configurable applyPairRapidityGen{"applyPairRapidityGen", false, "Apply pair rapidity cut on generated mother (before applying rapidity cut on reconstructed mother)"}; + Configurable isselectTWOKsOnly{"isselectTWOKsOnly", true, "Select only events with two K0s"}; + Configurable isapplyPairRapidityRec{"isapplyPairRapidityRec", false, "Apply pair rapidity cut on reconstructed mother (after already applying rapidity cut on generated mother)"}; + Configurable isapplyPairRapidityGen{"isapplyPairRapidityGen", false, "Apply pair rapidity cut on generated mother (before applying rapidity cut on reconstructed mother)"}; + Configurable cSelectMultEstimator{"cSelectMultEstimator", 0, "Select multiplicity estimator: 0 - FT0M, 1 - FT0A, 2 - FT0C"}; + Configurable configOccCut{"configOccCut", 1000, "Occupancy cut"}; + Configurable isVertexTOFMatched{"isVertexTOFMatched", false, "Vertex TOF Matched"}; + Configurable isNoCollInTimeRangeStandard{"isNoCollInTimeRangeStandard", false, "No collision in time range standard"}; // Configurables for event selection + // Configurable isINELgt0{"isINELgt0", true, "INEL>0 selection"}; + Configurable isTriggerTVX{"isTriggerTVX", false, "TriggerTVX"}; + Configurable isGoodZvtxFT0vsPV{"isGoodZvtxFT0vsPV", false, "IsGoodZvtxFT0vsPV"}; + Configurable isApplyOccCut{"isApplyOccCut", true, "Apply occupancy cut"}; Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; - Configurable cfgETAcut{"cfgETAcut", 0.8f, "Track ETA cut"}; Configurable timFrameEvsel{"timFrameEvsel", true, "TPC Time frame boundary cut"}; - // Configurable piluprejection{"piluprejection", false, "Pileup rejection"}; - // Configurable goodzvertex{"goodzvertex", false, "removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference."}; - // Configurable itstpctracks{"itstpctracks", false, "selects collisions with at least one ITS-TPC track,"}; - // Configurable additionalEvsel{"additionalEvsel", false, "Additional event selcection"}; - // Configurable applyOccupancyCut{"applyOccupancyCut", false, "Apply occupancy cut"}; - // Configurable occupancyCut{"occupancyCut", 1000, "Mimimum Occupancy cut"}; + Configurable isNoSameBunchPileup{"isNoSameBunchPileup", true, "kNoSameBunchPileup"}; + Configurable isAllLayersGoodITS{"isAllLayersGoodITS", true, "Require all ITS layers to be good"}; + Configurable isNoTimeFrameBorder{"isNoTimeFrameBorder", true, "kNoTimeFrameBorder"}; + Configurable isNoITSROFrameBorder{"isNoITSROFrameBorder", true, "kNoITSROFrameBorder"}; // Configurable parameters for V0 selection Configurable confV0DCADaughMax{"confV0DCADaughMax", 1.0f, "DCA b/w V0 daughters"}; Configurable v0settingDcapostopv{"v0settingDcapostopv", 0.06, "DCA Pos To PV"}; Configurable v0settingDcanegtopv{"v0settingDcanegtopv", 0.06, "DCA Neg To PV"}; - Configurable cMaxV0DCA{"cMaxV0DCA", 1, "DCA V0 to PV"}; - // Configurable isStandarv0{"isStandarv0", false, "Standard V0"}; - // Configurable ConfDaughDCAMin{"ConfDaughDCAMin", 0.06f, "V0 Daugh sel: Max. DCA Daugh to PV (cm)"}; // same as DCA pos to pv and neg to pv + Configurable cMaxV0DCA{"cMaxV0DCA", 0.3, "DCA V0 to PV"}; Configurable confV0PtMin{"confV0PtMin", 0.f, "Minimum transverse momentum of V0"}; Configurable confV0CPAMin{"confV0CPAMin", 0.97f, "Minimum CPA of V0"}; Configurable confV0TranRadV0Min{"confV0TranRadV0Min", 0.5f, "Minimum transverse radius"}; @@ -122,27 +130,27 @@ struct HigherMassResonances { Configurable cWidthKs0{"cWidthKs0", 0.005, "Width of KS0"}; Configurable confDaughEta{"confDaughEta", 0.8f, "V0 Daugh sel: max eta"}; Configurable confDaughTPCnclsMin{"confDaughTPCnclsMin", 70.f, "V0 Daugh sel: Min. nCls TPC"}; - Configurable confDaughPIDCuts{"confDaughPIDCuts", 5, "PID selections for KS0 daughters"}; - // Configurable confarmcut{"confarmcut", 0.2f, "Armenteros cut"}; + Configurable confDaughPIDCutTPC{"confDaughPIDCutTPC", 5, "PID selections for KS0 daughters"}; + Configurable confDaughPIDCutTOF{"confDaughPIDCutTOF", 5, "PID selections for KS0 daughters in TOF"}; Configurable confKsrapidity{"confKsrapidity", 0.5f, "Rapidity cut on K0s"}; - // Configurable lowmasscutks0{"lowmasscutks0", 0.497 - 4 * 0.005, "Low mass cut on K0s"}; - // Configurable highmasscutks0{"highmasscutks0", 0.497 + 4 * 0.005, "High mass cut on K0s"}; - Configurable applyAngSepCut{"applyAngSepCut", false, "Apply angular separation cut"}; Configurable angSepCut{"angSepCut", 0.01f, "Angular separation cut"}; + Configurable isapplyAngSepCut{"isapplyAngSepCut", false, "Apply angular separation cut"}; + Configurable isStandardV0{"isStandardV0", false, "Standard V0 selection"}; + Configurable isApplyEtaCutK0s{"isApplyEtaCutK0s", false, "Apply eta cut on K0s daughters"}; + Configurable cfgETAcut{"cfgETAcut", 0.8f, "Track ETA cut"}; // Configurable for track selection and multiplicity Configurable cfgPTcut{"cfgPTcut", 0.2f, "Track PT cut"}; Configurable cfgNmixedEvents{"cfgNmixedEvents", 5, "Number of mixed events"}; - Configurable cfgMultFOTM{"cfgMultFOTM", true, "Use FOTM multiplicity if pp else use 0 here for PbPb (FT0C)"}; ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0., 5., 10., 30., 50., 70., 100., 110., 150.}, "Binning of the centrality axis"}; // Configurable for MC Configurable isMC{"isMC", false, "Is MC"}; - Configurable allGenCollisions{"allGenCollisions", true, "To fill all generated collisions for the signal loss calculations"}; - Configurable cTVXEvsel{"cTVXEvsel", true, "Triggger selection"}; - Configurable avoidsplitrackMC{"avoidsplitrackMC", false, "avoid split track in MC"}; + Configurable isallGenCollisions{"isallGenCollisions", true, "To fill all generated collisions for the signal loss calculations"}; + Configurable iscTVXEvsel{"iscTVXEvsel", true, "Triggger selection"}; + Configurable isavoidsplitrackMC{"isavoidsplitrackMC", false, "avoid split track in MC"}; + Configurable isapplyRapidityMC{"isapplyRapidityMC", true, "Apply rapidity cut on generated and reconstructed particles"}; Configurable selectMCparticles{"selectMCparticles", 1, "0: f0(1710), 1: f2(1525), 2: a2(1320), 3: f0(1370), 4: f0(1500)"}; - Configurable applyRapidityMC{"applyRapidityMC", true, "Apply rapidity cut on generated and reconstructed particles"}; std::vector pdgCodes = {10331, 335, 115, 10221, 9030221}; // output THnSparses @@ -153,10 +161,8 @@ struct HigherMassResonances { Configurable cRotations{"cRotations", 3, "Number of random rotations in the rotational background"}; // Other cuts on Ks and glueball - // Configurable rapidityks{"rapidityks", true, "rapidity cut on K0s"}; - Configurable applyCompetingcut{"applyCompetingcut", false, "Competing cascade rejection cut"}; + Configurable isapplyCompetingcut{"isapplyCompetingcut", false, "Competing cascade rejection cut"}; Configurable competingcascrejlambda{"competingcascrejlambda", 0.005, "rejecting competing cascade lambda"}; - // Configurable competingcascrejlambdaanti{"competingcascrejlambdaanti", 0.005, "rejecting competing cascade anti-lambda"}; // If one of the pions is misidentified as a proton, then instead of Ks we reconstruct lambda, therefore the competing cascade rejection cut is applied in which if the reconstrcted mass of a pion and proton (which we are assuming to be misidentified as proton) is close to lambda or anti-lambda, then the track is rejected Configurable tpcCrossedrows{"tpcCrossedrows", 70, "TPC crossed rows"}; Configurable tpcCrossedrowsOverfcls{"tpcCrossedrowsOverfcls", 0.8, "TPC crossed rows over findable clusters"}; @@ -167,9 +173,6 @@ struct HigherMassResonances { ConfigurableAxis ksMassBins{"ksMassBins", {200, 0.45f, 0.55f}, "K0s invariant mass axis"}; ConfigurableAxis cGlueMassBins{"cGlueMassBins", {200, 0.9f, 3.0f}, "Glueball invariant mass axis"}; ConfigurableAxis cPtBins{"cPtBins", {200, 0.0f, 20.0f}, "Glueball pT axis"}; - // ConfigurableAxis axisdEdx{"axisdEdx", {20000, 0.0f, 200.0f}, "dE/dx (a.u.)"}; - // ConfigurableAxis axisPtfordEbydx{"axisPtfordEbydx", {2000, 0, 20}, "pT (GeV/c)"}; - // ConfigurableAxis axisMultdist{"axisMultdist", {3500, 0, 70000}, "Multiplicity distribution"}; // fixed variables float rapidityMotherData = 0.5; @@ -199,10 +202,7 @@ struct HigherMassResonances { void init(InitContext const&) { - rctCut.rctChecker.init( - rctCut.cfgEvtRCTFlagCheckerLabel, - rctCut.cfgEvtRCTFlagCheckerZDCCheck, - rctCut.cfgEvtRCTFlagCheckerLimitAcceptAsBad); + rctChecker.init(rctCut.cfgEvtRCTFlagCheckerLabel, rctCut.cfgEvtRCTFlagCheckerZDCCheck, rctCut.cfgEvtRCTFlagCheckerLimitAcceptAsBad); // Axes AxisSpec k0ShortMassAxis = {config.ksMassBins, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; @@ -216,8 +216,6 @@ struct HigherMassResonances { // THnSparses std::array sparses = {config.activateTHnSparseCosThStarHelicity, config.activateTHnSparseCosThStarProduction, config.activateTHnSparseCosThStarBeam, config.activateTHnSparseCosThStarRandom}; - // std::array sparses = {config.activateTHnSparseCosThStarHelicity}; - if (std::accumulate(sparses.begin(), sparses.end(), 0) == 0) { LOGP(fatal, "No output THnSparses enabled"); } else { @@ -239,31 +237,71 @@ struct HigherMassResonances { if (config.qAevents) { rEventSelection.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexZAxis}}); rEventSelection.add("hmultiplicity", "multiplicity percentile distribution", {HistType::kTH1F, {{150, 0.0f, 150.0f}}}); - // rEventSelection.add("multdist_FT0M", "FT0M Multiplicity distribution", kTH1F, {config.axisMultdist}); - // rEventSelection.add("multdist_FT0A", "FT0A Multiplicity distribution", kTH1F, {config.axisMultdist}); - // rEventSelection.add("multdist_FT0C", "FT0C Multiplicity distribution", kTH1F, {config.axisMultdist}); - // rEventSelection.add("hNcontributor", "Number of primary vertex contributor", kTH1F, {{2000, 0.0f, 10000.0f}}); + hglue.add("htrackscheck_v0", "htrackscheck_v0", kTH1I, {{15, 0, 15}}); + hglue.add("htrackscheck_v0_daughters", "htrackscheck_v0_daughters", kTH1I, {{15, 0, 15}}); + hMChists.add("events_check", "No. of events in the generated MC", kTH1I, {{20, 0, 20}}); + hMChists.add("events_checkrec", "No. of events in the reconstructed MC", kTH1I, {{25, 0, 25}}); + + rEventSelection.add("hEventCut", "No. of event after cuts", kTH1I, {{20, 0, 20}}); + std::shared_ptr hCutFlow = rEventSelection.get(HIST("hEventCut")); + hCutFlow->GetXaxis()->SetBinLabel(1, "All Events"); + hCutFlow->GetXaxis()->SetBinLabel(2, "|Vz| < cut"); + hCutFlow->GetXaxis()->SetBinLabel(3, "sel8"); + hCutFlow->GetXaxis()->SetBinLabel(4, "kNoTimeFrameBorder"); + hCutFlow->GetXaxis()->SetBinLabel(5, "kNoITSROFrameBorder"); + hCutFlow->GetXaxis()->SetBinLabel(6, "kNoSameBunchPileup"); + hCutFlow->GetXaxis()->SetBinLabel(7, "kIsGoodITSLayersAll"); + hCutFlow->GetXaxis()->SetBinLabel(8, "Occupancy Cut"); + hCutFlow->GetXaxis()->SetBinLabel(9, "rctChecker"); + hCutFlow->GetXaxis()->SetBinLabel(10, "kIsTriggerTVX"); + hCutFlow->GetXaxis()->SetBinLabel(11, "kIsGoodZvtxFT0vsPV"); + hCutFlow->GetXaxis()->SetBinLabel(12, "IsINELgt0"); + hCutFlow->GetXaxis()->SetBinLabel(13, "isVertexITSTPC"); + hCutFlow->GetXaxis()->SetBinLabel(14, "isVertexTOFMatched"); + + std::shared_ptr hv0label = rEventSelection.get(HIST("htrackscheck_v0")); + hv0label->GetXaxis()->SetBinLabel(1, "All Tracks"); + hv0label->GetXaxis()->SetBinLabel(2, "DCA V0 to PV"); + hv0label->GetXaxis()->SetBinLabel(3, "y K0s"); + hv0label->GetXaxis()->SetBinLabel(4, "Min V0 pT"); + hv0label->GetXaxis()->SetBinLabel(5, "Daughter DCA"); + hv0label->GetXaxis()->SetBinLabel(6, "CosPA"); + hv0label->GetXaxis()->SetBinLabel(7, "Decay Radius"); + hv0label->GetXaxis()->SetBinLabel(8, "Lifetime"); + hv0label->GetXaxis()->SetBinLabel(9, "CompetingCascade"); + hv0label->GetXaxis()->SetBinLabel(10, "Standard V0"); + hv0label->GetXaxis()->SetBinLabel(11, "Mass Tolerance"); + + std::shared_ptr hv0DauLabel = rEventSelection.get(HIST("htrackscheck_v0_daughters")); + hv0DauLabel->GetXaxis()->SetBinLabel(1, "AllDau Tracks"); + hv0DauLabel->GetXaxis()->SetBinLabel(2, "has TPC"); + hv0DauLabel->GetXaxis()->SetBinLabel(3, "TPC CrossedRows"); + hv0DauLabel->GetXaxis()->SetBinLabel(4, "TPC CRFC"); + hv0DauLabel->GetXaxis()->SetBinLabel(5, "TPC Chi2NCL"); + hv0DauLabel->GetXaxis()->SetBinLabel(6, "Charge"); + hv0DauLabel->GetXaxis()->SetBinLabel(7, "Eta"); + hv0DauLabel->GetXaxis()->SetBinLabel(8, "PID TPC"); + + std::shared_ptr hv0labelmcrec = rEventSelection.get(HIST("events_checkrec")); + hv0labelmcrec->GetXaxis()->SetBinLabel(1, "All Tracks"); + hv0labelmcrec->GetXaxis()->SetBinLabel(2, "V0Daughter Sel."); + hv0labelmcrec->GetXaxis()->SetBinLabel(3, "V0 Sel."); + hv0labelmcrec->GetXaxis()->SetBinLabel(4, "V0 PDG"); + hv0labelmcrec->GetXaxis()->SetBinLabel(5, "Mother PDG"); + hv0labelmcrec->GetXaxis()->SetBinLabel(6, "Same Mother"); + hv0labelmcrec->GetXaxis()->SetBinLabel(7, "Split Track"); + hv0labelmcrec->GetXaxis()->SetBinLabel(8, "Global Index"); + hv0labelmcrec->GetXaxis()->SetBinLabel(9, "Generator"); + hv0labelmcrec->GetXaxis()->SetBinLabel(10, "Rapidity"); } hglue.add("h3glueInvMassDS", "h3glueInvMassDS", kTHnSparseF, {multiplicityAxis, ptAxis, glueballMassAxis, thnAxisPOL, thnAxisPhi}, true); hglue.add("h3glueInvMassME", "h3glueInvMassME", kTHnSparseF, {multiplicityAxis, ptAxis, glueballMassAxis, thnAxisPOL, thnAxisPhi}, true); hglue.add("h3glueInvMassRot", "h3glueInvMassRot", kTHnSparseF, {multiplicityAxis, ptAxis, glueballMassAxis, thnAxisPOL, thnAxisPhi}, true); - hglue.add("heventscheck", "heventscheck", kTH1I, {{10, 0, 10}}); - hglue.add("htrackscheck_v0", "htrackscheck_v0", kTH1I, {{15, 0, 15}}); - hglue.add("htrackscheck_v0_daughters", "htrackscheck_v0_daughters", kTH1I, {{15, 0, 15}}); // K0s topological/PID cuts if (config.correlation2Dhist) { rKzeroShort.add("mass_lambda_kshort_before", "mass under lambda hypotheses and Kshort mass", kTH2F, {{100, 0.2, 0.8}, {100, 0.9, 1.5}}); - // rKzeroShort.add("mass_lambda_kshort_after1", "mass under lambda hypotheses and Kshort mass", kTH2F, {{100, 0.2, 0.8}, {100, 0.9, 1.5}}); - // rKzeroShort.add("mass_lambda_kshort_after2", "mass under lambda hypotheses and Kshort mass", kTH2F, {{100, 0.2, 0.8}, {100, 0.9, 1.5}}); - // rKzeroShort.add("mass_lambda_kshort_after3", "mass under lambda hypotheses and Kshort mass", kTH2F, {{100, 0.2, 0.8}, {100, 0.9, 1.5}}); - // rKzeroShort.add("mass_lambda_kshort_after4", "mass under lambda hypotheses and Kshort mass", kTH2F, {{100, 0.2, 0.8}, {100, 0.9, 1.5}}); - // rKzeroShort.add("mass_lambda_kshort_after5", "mass under lambda hypotheses and Kshort mass", kTH2F, {{100, 0.2, 0.8}, {100, 0.9, 1.5}}); - // rKzeroShort.add("mass_lambda_kshort_after6", "mass under lambda hypotheses and Kshort mass", kTH2F, {{100, 0.2, 0.8}, {100, 0.9, 1.5}}); - // rKzeroShort.add("mass_lambda_kshort_after7", "mass under lambda hypotheses and Kshort mass", kTH2F, {{100, 0.2, 0.8}, {100, 0.9, 1.5}}); - // rKzeroShort.add("mass_lambda_kshort_after8", "mass under lambda hypotheses and Kshort mass", kTH2F, {{100, 0.2, 0.8}, {100, 0.9, 1.5}}); - // rKzeroShort.add("mass_lambda_kshort_after9", "mass under lambda hypotheses and Kshort mass", kTH2F, {{100, 0.2, 0.8}, {100, 0.9, 1.5}}); rKzeroShort.add("mass_lambda_kshort_after10", "mass under lambda hypotheses and Kshort mass", kTH2F, {{100, 0.2, 0.8}, {100, 0.9, 1.5}}); } if (config.qAv0) { @@ -276,25 +314,6 @@ struct HigherMassResonances { rKzeroShort.add("hV0CosPA", "hV0CosPA", {HistType::kTH1F, {{100, 0.96f, 1.1f}}}); rKzeroShort.add("hLT", "hLT", {HistType::kTH1F, {{100, 0.0f, 50.0f}}}); rKzeroShort.add("angularSeparation", "Angular distribution between two K0s vs pT", {HistType::kTH1F, {{200, 0.0f, 4.0f}}}); - // rKzeroShort.add("Mass_lambda", "Mass under lambda hypothesis", kTH1F, {glueballMassAxis}); - // rKzeroShort.add("mass_AntiLambda", "Mass under anti-lambda hypothesis", kTH1F, {glueballMassAxis}); - // rKzeroShort.add("mass_Gamma", "Mass under Gamma hypothesis", kTH1F, {glueballMassAxis}); - - // rKzeroShort.add("mass_Hypertriton", "Mass under hypertriton hypothesis", kTH1F, {glueballMassAxis}); - // rKzeroShort.add("mass_AnitHypertriton", "Mass under anti-hypertriton hypothesis", kTH1F, {glueballMassAxis}); - // rKzeroShort.add("rapidity", "Rapidity distribution", kTH1F, {{100, -1.0f, 1.0f}}); - // rKzeroShort.add("hv0radius", "hv0radius", kTH1F, {{100, 0.0f, 200.0f}}); - // rKzeroShort.add("hDCApostopv", "DCA positive daughter to PV", kTH1F, {{1000, -10.0f, 10.0f}}); - // rKzeroShort.add("hDCAnegtopv", "DCA negative daughter to PV", kTH1F, {{1000, -10.0f, 10.0f}}); - // rKzeroShort.add("hcDCAv0topv", "DCA V0 to PV", kTH1F, {{60, -3.0f, 3.0f}}); - // rKzeroShort.add("halpha", "Armenteros alpha", kTH1F, {{100, -5.0f, 5.0f}}); - // rKzeroShort.add("hqtarmbyalpha", "qtarm/alpha", kTH1F, {{100, 0.0f, 1.0f}}); - // rKzeroShort.add("hpsipair", "psi pair angle", kTH1F, {{100, -5.0f, 5.0f}}); - - // // Topological histograms (before the selection) - // rKzeroShort.add("hDCAV0Daughters_before", "DCA between v0 daughters before the selection", {HistType::kTH1F, {{60, -3.0f, 3.0f}}}); - // rKzeroShort.add("hV0CosPA_before", "hV0CosPA_before", {HistType::kTH1F, {{200, 0.91f, 1.1f}}}); - // rKzeroShort.add("hLT_before", "hLT_before", {HistType::kTH1F, {{100, 0.0f, 50.0f}}}); } rKzeroShort.add("NksProduced", "Number of K0s produced", kTH1I, {{15, -0.5, 14.5}}); @@ -305,29 +324,16 @@ struct HigherMassResonances { rKzeroShort.add("hNSigmaNegPionK0s_after", "hNSigmaNegPionK0s_after", {HistType::kTH2F, {{ptAxis}, {100, -5.f, 5.f}}}); // rKzeroShort.add("dE_by_dx_TPC", "dE/dx signal in the TPC as a function of pT", kTH2F, {config.axisPtfordEbydx, config.axisdEdx}); } - // if (config.qAv0Daughters) { - // rKzeroShort.add("negative_pt", "Negative daughter pT", kTH1F, {ptAxis}); - // rKzeroShort.add("positive_pt", "Positive daughter pT", kTH1F, {ptAxis}); - // rKzeroShort.add("negative_eta", "Negative daughter eta", kTH1F, {{100, -1.0f, 1.0f}}); - // rKzeroShort.add("positive_eta", "Positive daughter eta", kTH1F, {{100, -1.0f, 1.0f}}); - // rKzeroShort.add("negative_phi", "Negative daughter phi", kTH1F, {{70, 0.0f, 7.0f}}); - // rKzeroShort.add("positive_phi", "Positive daughter phi", kTH1F, {{70, 0.0f, 7.0f}}); - // } // For MC if (config.isMC) { - hMChists.add("events_check", "No. of events in the generated MC", kTH1I, {{20, 0, 20}}); - hMChists.add("events_checkrec", "No. of events in the reconstructed MC", kTH1I, {{25, 0, 25}}); hMChists.add("Genf1710", "Gen f_{0}(1710)", kTHnSparseF, {multiplicityAxis, ptAxis, thnAxisPOL}); hMChists.add("Genf17102", "Gen f_{0}(1710)", kTHnSparseF, {multiplicityAxis, ptAxis, thnAxisPOL}); hMChists.add("Recf1710_pt1", "Rec f_{0}(1710) p_{T}", kTHnSparseF, {multiplicityAxis, ptAxis, glueballMassAxis, thnAxisPOL}); hMChists.add("Recf1710_pt2", "Rec f_{0}(1710) p_{T}", kTHnSparseF, {multiplicityAxis, ptAxis, glueballMassAxis, thnAxisPOL}); - // hMChists.add("Recf1710_p", "Rec f_{0}(1710) p", kTH1F, {ptAxis}); hMChists.add("h1Recsplit", "Rec p_{T}2", kTH1F, {ptAxis}); - // hMChists.add("Recf1710_mass", "Rec f_{0}(1710) mass", kTH1F, {glueballMassAxis}); hMChists.add("Genf1710_mass", "Gen f_{0}(1710) mass", kTH1F, {glueballMassAxis}); hMChists.add("Genf1710_mass2", "Gen f_{0}(1710) mass", kTH1F, {glueballMassAxis}); - // hMChists.add("Genf1710_pt2", "Gen f_{0}(1710) p_{T}", kTH1F, {ptAxis}); hMChists.add("GenPhi", "Gen Phi", kTH1F, {{70, 0.0, 7.0f}}); hMChists.add("GenPhi2", "Gen Phi", kTH1F, {{70, 0.0, 7.0f}}); hMChists.add("GenEta", "Gen Eta", kTHnSparseF, {{150, -1.5f, 1.5f}}); @@ -342,41 +348,85 @@ struct HigherMassResonances { hMChists.add("RecRapidity2", "Rec Rapidity", kTH1F, {{100, -1.0f, 1.0f}}); hMChists.add("Rec_Multiplicity", "Multiplicity in MC", kTH1F, {multiplicityAxis}); hMChists.add("MC_mult_after_event_sel", "Multiplicity in MC", kTH1F, {multiplicityAxis}); - // hMChists.add("GenPx", "Gen Px", kTH1F, {{100, -10.0f, 10.0f}}); - // hMChists.add("GenPy", "Gen Py", kTH1F, {{100, -10.0f, 10.0f}}); - // hMChists.add("GenPz", "Gen Pz", kTH1F, {{100, -10.0f, 10.0f}}); } } - template - bool eventselection(Collision const& collision) + template + bool selectionEvent(const Coll& collision, bool fillHist = true) { - hglue.fill(HIST("heventscheck"), 1.5); + if (fillHist) + rEventSelection.fill(HIST("hEventCut"), 0); - if (config.timFrameEvsel && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { + if (std::abs(collision.posZ()) > config.cutzvertex) return false; - } - hglue.fill(HIST("heventscheck"), 2.5); + if (fillHist) + rEventSelection.fill(HIST("hEventCut"), 1); - if (!collision.sel8()) { + if (!collision.sel8()) return false; - } - hglue.fill(HIST("heventscheck"), 3.5); + if (fillHist) + rEventSelection.fill(HIST("hEventCut"), 2); + + if (config.isNoTimeFrameBorder && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) + return false; + if (fillHist) + rEventSelection.fill(HIST("hEventCut"), 3); + + if (config.isNoITSROFrameBorder && !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) + return false; + if (fillHist) + rEventSelection.fill(HIST("hEventCut"), 4); + + if (config.isNoSameBunchPileup && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup))) + return false; + if (fillHist) + rEventSelection.fill(HIST("hEventCut"), 5); + + if (config.isAllLayersGoodITS && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) + return false; + if (fillHist) + rEventSelection.fill(HIST("hEventCut"), 6); - // if (config.piluprejection && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + // if (config.isNoCollInTimeRangeStandard && (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) // return false; - // } - // hglue.fill(HIST("heventscheck"), 4.5); - // if (config.goodzvertex && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + if (config.isApplyOccCut && (std::abs(collision.trackOccupancyInTimeRange()) > config.configOccCut)) + return false; + if (fillHist) + rEventSelection.fill(HIST("hEventCut"), 7); + + if (rctCut.requireRCTFlagChecker && !rctChecker(collision)) + return false; + if (fillHist) + rEventSelection.fill(HIST("hEventCut"), 8); + + if (config.isTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) + return false; + if (fillHist) + rEventSelection.fill(HIST("hEventCut"), 9); + + if (config.isGoodZvtxFT0vsPV && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) + return false; + if (fillHist) + rEventSelection.fill(HIST("hEventCut"), 10); + + // if (config.isINELgt0 && !collision.isInelGt0()) { // return false; // } - // hglue.fill(HIST("heventscheck"), 5.5); + // if (fillHist) + rEventSelection.fill(HIST("hEventCut"), 11); - // if (config.itstpctracks && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + // if (config.isVertexITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { // return false; // } - // hglue.fill(HIST("heventscheck"), 6.5); + if (fillHist) + rEventSelection.fill(HIST("hEventCut"), 12); + + if (config.isVertexTOFMatched && !collision.selection_bit(aod::evsel::kIsVertexTOFmatched)) { + return false; + } + if (fillHist) + rEventSelection.fill(HIST("hEventCut"), 13); return true; } @@ -395,124 +445,89 @@ struct HigherMassResonances { float ctauK0s = candidate.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short; float lowmasscutks0 = o2::constants::physics::MassKPlus - config.cWidthKs0 * config.cSigmaMassKs0; float highmasscutks0 = o2::constants::physics::MassKPlus + config.cWidthKs0 * config.cSigmaMassKs0; - // float decayLength = candidate.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * RecoDecay::sqrtSumOfSquares(candidate.px(), candidate.py(), candidate.pz()); if (config.qAv0) { rKzeroShort.fill(HIST("hMassK0Shortbefore"), candidate.mK0Short(), candidate.pt()); rKzeroShort.fill(HIST("hLT"), ctauK0s); rKzeroShort.fill(HIST("hDCAV0Daughters"), candidate.dcaV0daughters()); rKzeroShort.fill(HIST("hV0CosPA"), candidate.v0cosPA()); - // rKzeroShort.fill(HIST("Mass_lambda"), candidate.mLambda()); - // rKzeroShort.fill(HIST("mass_AntiLambda"), candidate.mAntiLambda()); - // rKzeroShort.fill(HIST("mass_Gamma"), candidate.mGamma()); - // rKzeroShort.fill(HIST("mass_Hypertriton"), candidate.mHypertriton()); - // rKzeroShort.fill(HIST("mass_AnitHypertriton"), candidate.mAntiHypertriton()); - // rKzeroShort.fill(HIST("rapidity"), candidate.yK0Short()); - // rKzeroShort.fill(HIST("hv0radius"), candidate.v0radius()); - // rKzeroShort.fill(HIST("hDCApostopv"), candidate.dcapostopv()); - // rKzeroShort.fill(HIST("hDCAnegtopv"), candidate.dcanegtopv()); - // rKzeroShort.fill(HIST("hcDCAv0topv"), candidate.dcav0topv()); - // rKzeroShort.fill(HIST("halpha"), candidate.alpha()); - // rKzeroShort.fill(HIST("hqtarmbyalpha"), arm); - // rKzeroShort.fill(HIST("hpsipair"), candidate.psipair()); } if (config.correlation2Dhist) rKzeroShort.fill(HIST("mass_lambda_kshort_before"), candidate.mK0Short(), candidate.mLambda()); hglue.fill(HIST("htrackscheck_v0"), 0.5); - if (config.cDCAv0topv && std::fabs(candidate.dcav0topv()) > config.cMaxV0DCA) { + if (config.isApplyDCAv0topv && std::fabs(candidate.dcav0topv()) > config.cMaxV0DCA) { return false; } hglue.fill(HIST("htrackscheck_v0"), 1.5); - // if (config.correlation2Dhist) - // rKzeroShort.fill(HIST("mass_lambda_kshort_after1"), candidate.mK0Short(), candidate.mLambda()); - // if (config.rapidityks && std::abs(candidate.yK0Short()) >= config.confKsrapidity) { - // return false; - // } - if (std::abs(candidate.yK0Short()) >= config.confKsrapidity) { + if (std::abs(candidate.rapidity(0)) >= config.confKsrapidity) { return false; } hglue.fill(HIST("htrackscheck_v0"), 2.5); - // if (config.correlation2Dhist) - // rKzeroShort.fill(HIST("mass_lambda_kshort_after2"), candidate.mK0Short(), candidate.mLambda()); if (pT < config.confV0PtMin) { return false; } hglue.fill(HIST("htrackscheck_v0"), 3.5); - // if (config.correlation2Dhist) - // rKzeroShort.fill(HIST("mass_lambda_kshort_after3"), candidate.mK0Short(), candidate.mLambda()); if (dcaDaughv0 > config.confV0DCADaughMax) { return false; } hglue.fill(HIST("htrackscheck_v0"), 4.5); - // if (config.correlation2Dhist) - // rKzeroShort.fill(HIST("mass_lambda_kshort_after4"), candidate.mK0Short(), candidate.mLambda()); if (cpav0 < config.confV0CPAMin) { return false; } hglue.fill(HIST("htrackscheck_v0"), 5.5); - // if (config.correlation2Dhist) - // rKzeroShort.fill(HIST("mass_lambda_kshort_after5"), candidate.mK0Short(), candidate.mLambda()); if (tranRad < config.confV0TranRadV0Min) { return false; } hglue.fill(HIST("htrackscheck_v0"), 6.5); - // if (config.correlation2Dhist) - // rKzeroShort.fill(HIST("mass_lambda_kshort_after6"), candidate.mK0Short(), candidate.mLambda()); if (tranRad > config.confV0TranRadV0Max) { return false; } hglue.fill(HIST("htrackscheck_v0"), 7.5); - // if (config.correlation2Dhist) - // rKzeroShort.fill(HIST("mass_lambda_kshort_after7"), candidate.mK0Short(), candidate.mLambda()); if (std::fabs(ctauK0s) > config.cMaxV0LifeTime) { return false; } hglue.fill(HIST("htrackscheck_v0"), 8.5); - // if (config.correlation2Dhist) - // rKzeroShort.fill(HIST("mass_lambda_kshort_after8"), candidate.mK0Short(), candidate.mLambda()); - - // if (config.armcut && arm < config.confarmcut) { - // return false; - // } - hglue.fill(HIST("htrackscheck_v0"), 9.5); - // if (config.correlation2Dhist) - // rKzeroShort.fill(HIST("mass_lambda_kshort_after9"), candidate.mK0Short(), candidate.mLambda()); - // if (config.applyCompetingcut && (std::abs(candidate.mLambda() - PDGdatabase->Mass(3122)) <= config.competingcascrejlambda || std::abs(candidate.mAntiLambda() - PDGdatabase->Mass(-3122)) <= config.competingcascrejlambdaanti)) - if (config.applyCompetingcut && (std::abs(candidate.mLambda() - o2::constants::physics::MassLambda0) <= config.competingcascrejlambda || std::abs(candidate.mAntiLambda() - o2::constants::physics::MassLambda0) <= config.competingcascrejlambda)) { + if (config.isapplyCompetingcut && (std::abs(candidate.mLambda() - o2::constants::physics::MassLambda0) <= config.competingcascrejlambda || std::abs(candidate.mAntiLambda() - o2::constants::physics::MassLambda0) <= config.competingcascrejlambda)) { return false; } - hglue.fill(HIST("htrackscheck_v0"), 10.5); + hglue.fill(HIST("htrackscheck_v0"), 9.5); + if (config.correlation2Dhist) rKzeroShort.fill(HIST("mass_lambda_kshort_after10"), candidate.mK0Short(), candidate.mLambda()); if (config.qAv0) { rKzeroShort.fill(HIST("hMassK0ShortSelected"), candidate.mK0Short(), candidate.pt()); - // rKzeroShort.fill(HIST("mass_lambda_kshort_after"), candidate.mK0Short(), candidate.mLambda()); } + if (config.isStandardV0 && candidate.v0Type() != 1) { + return false; // Only standard V0s are selected + } + hglue.fill(HIST("htrackscheck_v0"), 10.5); + if (candidate.mK0Short() < lowmasscutks0 || candidate.mK0Short() > highmasscutks0) { return false; } + hglue.fill(HIST("htrackscheck_v0"), 11.5); + return true; } template - bool isSelectedV0Daughter(T const& track, float charge, double nsigmaV0Daughter, V0s const& /*candidate*/) + bool isSelectedV0Daughter(T const& track, float charge, double nsigmaV0DaughterTPC, V0s const& /*candidate*/) { if (config.qAPID) { // Filling the PID of the V0 daughters in the region of the K0 peak. (charge == 1) ? rKzeroShort.fill(HIST("hNSigmaPosPionK0s_before"), track.tpcInnerParam(), track.tpcNSigmaPi()) : rKzeroShort.fill(HIST("hNSigmaNegPionK0s_before"), track.tpcInnerParam(), track.tpcNSigmaPi()); - // rKzeroShort.fill(HIST("dE_by_dx_TPC"), track.p(), track.tpcSignal()); } const auto eta = track.eta(); const auto tpcNClsF = track.tpcNClsFound(); @@ -524,24 +539,18 @@ struct HigherMassResonances { return false; hglue.fill(HIST("htrackscheck_v0_daughters"), 1.5); - if (!config.globalTracks) { - if (track.tpcNClsCrossedRows() < config.tpcCrossedrows) - return false; - hglue.fill(HIST("htrackscheck_v0_daughters"), 2.5); + if (track.tpcNClsCrossedRows() < config.tpcCrossedrows) + return false; + hglue.fill(HIST("htrackscheck_v0_daughters"), 2.5); - if (track.tpcCrossedRowsOverFindableCls() < config.tpcCrossedrowsOverfcls) - return false; - hglue.fill(HIST("htrackscheck_v0_daughters"), 3.5); + if (track.tpcCrossedRowsOverFindableCls() < config.tpcCrossedrowsOverfcls) + return false; + hglue.fill(HIST("htrackscheck_v0_daughters"), 3.5); - if (tpcNClsF < config.confDaughTPCnclsMin) { - return false; - } - hglue.fill(HIST("htrackscheck_v0_daughters"), 4.5); - } else { - if (!track.isGlobalTrack()) - return false; - hglue.fill(HIST("htrackscheck_v0_daughters"), 4.5); + if (tpcNClsF < config.confDaughTPCnclsMin) { + return false; } + hglue.fill(HIST("htrackscheck_v0_daughters"), 4.5); if (charge < 0 && sign > 0) { return false; @@ -558,11 +567,13 @@ struct HigherMassResonances { } hglue.fill(HIST("htrackscheck_v0_daughters"), 7.5); - if (std::abs(nsigmaV0Daughter) > config.confDaughPIDCuts) { + if (std::abs(nsigmaV0DaughterTPC) > config.confDaughPIDCutTPC) { return false; } hglue.fill(HIST("htrackscheck_v0_daughters"), 8.5); + // if (std::abs()) + if (config.qAPID) { (charge == 1) ? rKzeroShort.fill(HIST("hNSigmaPosPionK0s_after"), track.tpcInnerParam(), track.tpcNSigmaPi()) : rKzeroShort.fill(HIST("hNSigmaNegPionK0s_after"), track.tpcInnerParam(), track.tpcNSigmaPi()); } @@ -584,7 +595,7 @@ struct HigherMassResonances { if (config.qAv0) { rKzeroShort.fill(HIST("angularSeparation"), angle); } - if (config.applyAngSepCut && angle > config.angSepCut) { + if (config.isapplyAngSepCut && angle > config.angSepCut) { return false; } return true; @@ -599,11 +610,11 @@ struct HigherMassResonances { Filter preFilterV0 = (nabs(aod::v0data::dcapostopv) > config.v0settingDcapostopv && nabs(aod::v0data::dcanegtopv) > config.v0settingDcanegtopv); // Defining the type of the daughter tracks - using EventCandidates = soa::Filtered>; + using EventCandidates = soa::Filtered>; using TrackCandidates = soa::Filtered>; using V0TrackCandidate = aod::V0Datas; // For Monte Carlo - using EventCandidatesMC = soa::Join; + using EventCandidatesMC = soa::Join; using TrackCandidatesMC = soa::Filtered>; using V0TrackCandidatesMC = soa::Filtered>; // zBeam direction in lab frame @@ -752,20 +763,26 @@ struct HigherMassResonances { void processSE(EventCandidates::iterator const& collision, TrackCandidates const& /*tracks*/, aod::V0Datas const& V0s) { - hglue.fill(HIST("heventscheck"), 0.5); multiplicity = 0.0; - if (config.cfgMultFOTM) { + + if (config.cSelectMultEstimator == kFT0M) { multiplicity = collision.centFT0M(); - } else { + } else if (config.cSelectMultEstimator == kFT0A) { + multiplicity = collision.centFT0A(); + } else if (config.cSelectMultEstimator == kFT0C) { multiplicity = collision.centFT0C(); - } - if (!eventselection(collision)) { - return; + } else if (config.cSelectMultEstimator == kFV0A) { + multiplicity = collision.centFV0A(); + } else { + multiplicity = collision.centFT0M(); // default } - if (rctCut.requireRCTFlagChecker && !rctCut.rctChecker(collision)) { + if (!selectionEvent(collision, true)) { return; } + // if (rctCut.requireRCTFlagChecker && !rctCut.rctChecker(collision)) { + // return; + // } // auto occupancyNumber = collision.trackOccupancyInTimeRange(); // if (applyOccupancyCut && occupancyNumber < occupancyCut) { @@ -814,26 +831,25 @@ struct HigherMassResonances { continue; } + if (postrack1.hasTOF() && negtrack1.hasTOF() && postrack2.hasTOF() && negtrack2.hasTOF()) { + double nTOFSigmaPos1{postrack1.tofNSigmaPi()}; + double nTOFSigmaNeg1{negtrack1.tofNSigmaPi()}; + double nTOFSigmaPos2{postrack2.tofNSigmaPi()}; + double nTOFSigmaNeg2{negtrack2.tofNSigmaPi()}; + if ((std::abs(nTOFSigmaPos1) > config.confDaughPIDCutTPC) || (std::abs(nTOFSigmaNeg1) > config.confDaughPIDCutTPC) || + (std::abs(nTOFSigmaPos2) > config.confDaughPIDCutTPC) || (std::abs(nTOFSigmaNeg2) > config.confDaughPIDCutTPC)) { + continue; + } + } + if (std::find(v0indexes.begin(), v0indexes.end(), v1.globalIndex()) == v0indexes.end()) { v0indexes.push_back(v1.globalIndex()); } - // if (!(std::find(v0indexes.begin(), v0indexes.end(), v2.globalIndex()) != v0indexes.end())) { - // v0indexes.push_back(v2.globalIndex()); - // } if (v2.globalIndex() <= v1.globalIndex()) { continue; } - // if (config.qAv0Daughters) { - // rKzeroShort.fill(HIST("negative_pt"), negtrack1.pt()); - // rKzeroShort.fill(HIST("positive_pt"), postrack1.pt()); - // rKzeroShort.fill(HIST("negative_eta"), negtrack1.eta()); - // rKzeroShort.fill(HIST("positive_eta"), postrack1.eta()); - // rKzeroShort.fill(HIST("negative_phi"), negtrack1.phi()); - // rKzeroShort.fill(HIST("positive_phi"), postrack1.phi()); - // } - if (postrack1.globalIndex() == postrack2.globalIndex()) { continue; } @@ -845,6 +861,10 @@ struct HigherMassResonances { continue; } + if (config.isApplyEtaCutK0s && (v1.eta() < config.confDaughEta || v2.eta() < config.confDaughEta)) { + continue; + } + if (config.qAv0) { rKzeroShort.fill(HIST("hMasscorrelationbefore"), v1.mK0Short(), v2.mK0Short()); } @@ -855,12 +875,12 @@ struct HigherMassResonances { mother = daughter1 + daughter2; // invariant mass of Kshort pair isMix = false; - if (!config.selectTWOKsOnly) + if (!config.isselectTWOKsOnly) fillInvMass(mother, multiplicity, daughter1, daughter2, isMix); } int sizeofv0indexes = v0indexes.size(); rKzeroShort.fill(HIST("NksProduced"), sizeofv0indexes); - if (config.selectTWOKsOnly && sizeofv0indexes == config.noOfDaughters && allConditionsMet) { + if (config.isselectTWOKsOnly && sizeofv0indexes == config.noOfDaughters && allConditionsMet) { fillInvMass(mother, multiplicity, daughter1, daughter2, false); } v0indexes.clear(); @@ -871,315 +891,41 @@ struct HigherMassResonances { using V0CandidatesDerivedData = soa::Join; using DauTracks = soa::Join; - void processSEderived(EventCandidatesDerivedData::iterator const& collision, TrackCandidates const& /*tracks*/, aod::V0Datas const& V0s) - { - hglue.fill(HIST("heventscheck"), 0.5); - multiplicity = 0.0; - if (config.cfgMultFOTM) { - multiplicity = collision.centFT0M(); - } else { - multiplicity = collision.centFT0C(); - } - if (!eventselection(collision)) { - return; - } + ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for ME mixing"}; + // ConfigurableAxis axisMultiplicityClass{"axisMultiplicityClass", {10, 0, 100}, "multiplicity percentile for ME mixing"}; + ConfigurableAxis axisMultiplicity{"axisMultiplicity", {2000, 0, 10000}, "TPC multiplicity axis for ME mixing"}; - if (rctCut.requireRCTFlagChecker && !rctCut.rctChecker(collision)) { - return; - } + // using BinningTypeTPCMultiplicity = ColumnBinningPolicy; + using BinningTypeFT0M = ColumnBinningPolicy; + using BinningTypeFT0A = ColumnBinningPolicy; + using BinningTypeFT0C = ColumnBinningPolicy; + using BinningTypeFV0A = ColumnBinningPolicy; - // auto occupancyNumber = collision.trackOccupancyInTimeRange(); - // if (applyOccupancyCut && occupancyNumber < occupancyCut) { - // return; - // } + BinningTypeFT0M binningOnFT0M{{axisVertex, axisMultiplicity}, true}; + BinningTypeFT0A binningOnFT0A{{axisVertex, axisMultiplicity}, true}; + BinningTypeFT0C binningOnFT0C{{axisVertex, axisMultiplicity}, true}; + BinningTypeFV0A binningOnFV0A{{axisVertex, axisMultiplicity}, true}; - if (config.qAevents) { - rEventSelection.fill(HIST("hVertexZRec"), collision.posZ()); - rEventSelection.fill(HIST("hmultiplicity"), multiplicity); - // rEventSelection.fill(HIST("multdist_FT0M"), collision.multFT0M()); - // rEventSelection.fill(HIST("multdist_FT0A"), collision.multFT0A()); - // rEventSelection.fill(HIST("multdist_FT0C"), collision.multFT0C()); - // rEventSelection.fill(HIST("hNcontributor"), collision.numContrib()); - } - - std::vector v0indexes; - bool allConditionsMet = 0; - - for (const auto& [v1, v2] : combinations(CombinationsFullIndexPolicy(V0s, V0s))) { - - if (v1.size() == 0 || v2.size() == 0) { - continue; - } - - if (!selectionV0(collision, v1, multiplicity)) { - continue; - } - if (!selectionV0(collision, v2, multiplicity)) { - continue; - } - - auto postrack1 = v1.template posTrack_as(); - auto negtrack1 = v1.template negTrack_as(); - auto postrack2 = v2.template posTrack_as(); - auto negtrack2 = v2.template negTrack_as(); - - double nTPCSigmaPos1{postrack1.tpcNSigmaPi()}; - double nTPCSigmaNeg1{negtrack1.tpcNSigmaPi()}; - double nTPCSigmaPos2{postrack2.tpcNSigmaPi()}; - double nTPCSigmaNeg2{negtrack2.tpcNSigmaPi()}; - - if (!(isSelectedV0Daughter(negtrack1, -1, nTPCSigmaNeg1, v1) && isSelectedV0Daughter(postrack1, 1, nTPCSigmaPos1, v1))) { - continue; - } - if (!(isSelectedV0Daughter(postrack2, 1, nTPCSigmaPos2, v2) && isSelectedV0Daughter(negtrack2, -1, nTPCSigmaNeg2, v2))) { - continue; - } - - if (std::find(v0indexes.begin(), v0indexes.end(), v1.globalIndex()) == v0indexes.end()) { - v0indexes.push_back(v1.globalIndex()); - } - // if (!(std::find(v0indexes.begin(), v0indexes.end(), v2.globalIndex()) != v0indexes.end())) { - // v0indexes.push_back(v2.globalIndex()); - // } - - if (v2.globalIndex() <= v1.globalIndex()) { - continue; - } - - // if (config.qAv0Daughters) { - // rKzeroShort.fill(HIST("negative_pt"), negtrack1.pt()); - // rKzeroShort.fill(HIST("positive_pt"), postrack1.pt()); - // rKzeroShort.fill(HIST("negative_eta"), negtrack1.eta()); - // rKzeroShort.fill(HIST("positive_eta"), postrack1.eta()); - // rKzeroShort.fill(HIST("negative_phi"), negtrack1.phi()); - // rKzeroShort.fill(HIST("positive_phi"), postrack1.phi()); - // } - - if (postrack1.globalIndex() == postrack2.globalIndex()) { - continue; - } - if (negtrack1.globalIndex() == negtrack2.globalIndex()) { - continue; - } - - if (!applyAngSep(v1, v2)) { - continue; - } - - if (config.qAv0) { - rKzeroShort.fill(HIST("hMasscorrelationbefore"), v1.mK0Short(), v2.mK0Short()); - } - allConditionsMet = 1; - daughter1 = ROOT::Math::PxPyPzMVector(v1.px(), v1.py(), v1.pz(), o2::constants::physics::MassK0Short); // Kshort - daughter2 = ROOT::Math::PxPyPzMVector(v2.px(), v2.py(), v2.pz(), o2::constants::physics::MassK0Short); // Kshort - - mother = daughter1 + daughter2; // invariant mass of Kshort pair - isMix = false; - - if (!config.selectTWOKsOnly) - fillInvMass(mother, multiplicity, daughter1, daughter2, isMix); - } - int sizeofv0indexes = v0indexes.size(); - rKzeroShort.fill(HIST("NksProduced"), sizeofv0indexes); - if (config.selectTWOKsOnly && sizeofv0indexes == config.noOfDaughters && allConditionsMet) { - fillInvMass(mother, multiplicity, daughter1, daughter2, false); - } - v0indexes.clear(); - } - PROCESS_SWITCH(HigherMassResonances, processSEderived, "same event process in strangeness derived data", true); - - ConfigurableAxis mevz = {"mevz", {10, -10., 10.}, "mixed event vertex z binning"}; - ConfigurableAxis memult = {"memult", {20, 0, 100}, "mixed event multiplicity binning"}; - - // Processing Event Mixing using BinningType = ColumnBinningPolicy; - BinningType colBinning{{mevz, memult}, true}; + BinningType colBinning{{axisVertex, axisMultiplicity}, true}; // for derived data only Preslice tracksPerCollisionV0Mixed = o2::aod::v0data::straCollisionId; // for derived data only - void processMEderived(EventCandidatesDerivedData const& collisions, TrackCandidates const& /*tracks*/, V0CandidatesDerivedData const& v0s) - { - // auto tracksTuple = std::make_tuple(v0s); - // BinningTypeVertexContributor binningOnPositions1{{mevz, memult}, true}; - // BinningTypeCentralityM binningOnPositions2{{mevz, memult}, true}; - - // SameKindPair pair1{binningOnPositions1, config.cfgNmixedEvents, -1, collisions, tracksTuple, &cache}; // for PbPb - // SameKindPair pair2{binningOnPositions2, config.cfgNmixedEvents, -1, collisions, tracksTuple, &cache}; // for pp - - // if (config.cfgMultFOTM) { - for (const auto& [c1, c2] : selfCombinations(colBinning, config.cfgNmixedEvents, -1, collisions, collisions)) // two different centrality c1 and c2 and tracks corresponding to them - { - - multiplicity = 0.0; - multiplicity = c1.centFT0M(); - - if (!eventselection(c1) || !eventselection(c2)) { - continue; - } - // auto occupancyNumber = c1.trackOccupancyInTimeRange(); - // auto occupancyNumber2 = c2.trackOccupancyInTimeRange(); - // if (applyOccupancyCut && (occupancyNumber < occupancyCut || occupancyNumber2 < occupancyCut)) { - // return; - // } - - if (rctCut.requireRCTFlagChecker && !rctCut.rctChecker(c1)) { - return; - } - if (rctCut.requireRCTFlagChecker && !rctCut.rctChecker(c2)) { - return; - } - auto groupV01 = v0s.sliceBy(tracksPerCollisionV0Mixed, c1.index()); - auto groupV02 = v0s.sliceBy(tracksPerCollisionV0Mixed, c2.index()); - for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(groupV01, groupV02))) { - - if (t1.size() == 0 || t2.size() == 0) { - continue; - } - - if (!selectionV0(c1, t1, multiplicity)) - continue; - if (!selectionV0(c2, t2, multiplicity)) - continue; - - auto postrack1 = t1.template posTrackExtra_as(); - auto negtrack1 = t1.template negTrackExtra_as(); - auto postrack2 = t2.template posTrackExtra_as(); - auto negtrack2 = t2.template negTrackExtra_as(); - - if (postrack1.globalIndex() == postrack2.globalIndex()) { - continue; - } - if (negtrack1.globalIndex() == negtrack2.globalIndex()) { - continue; - } - double nTPCSigmaPos1{postrack1.tpcNSigmaPi()}; - double nTPCSigmaNeg1{negtrack1.tpcNSigmaPi()}; - double nTPCSigmaPos2{postrack2.tpcNSigmaPi()}; - double nTPCSigmaNeg2{negtrack2.tpcNSigmaPi()}; - - if (!isSelectedV0Daughter(postrack1, 1, nTPCSigmaPos1, t1)) { - continue; - } - if (!isSelectedV0Daughter(postrack2, 1, nTPCSigmaPos2, t2)) { - continue; - } - if (!isSelectedV0Daughter(negtrack1, -1, nTPCSigmaNeg1, t1)) { - continue; - } - if (!isSelectedV0Daughter(negtrack2, -1, nTPCSigmaNeg2, t2)) { - continue; - } - - daughter1 = ROOT::Math::PxPyPzMVector(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassK0Short); // Kshort - daughter2 = ROOT::Math::PxPyPzMVector(t2.px(), t2.py(), t2.pz(), o2::constants::physics::MassK0Short); // Kshort - - mother = daughter1 + daughter2; // invariant mass of Kshort pair - isMix = true; - fillInvMass(mother, multiplicity, daughter1, daughter2, isMix); - } - } - // } - // else { - // for (const auto& [c1, tracks1, c2, tracks2] : pair1) // two different centrality c1 and c2 and tracks corresponding to them - // { - // multiplicity = 0.0f; - // multiplicity = c1.centFT0C(); - - // if (!eventselection(c1) || !eventselection(c2)) { - // continue; - // } - // // auto occupancyNumber = c1.trackOccupancyInTimeRange(); - // // auto occupancyNumber2 = c2.trackOccupancyInTimeRange(); - // // if (applyOccupancyCut && (occupancyNumber < occupancyCut || occupancyNumber2 < occupancyCut)) { - // // return; - // // } - - // for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - // if (t1.size() == 0 || t2.size() == 0) { - // continue; - // } - - // if (!selectionV0(c1, t1, multiplicity)) - // continue; - // if (!selectionV0(c2, t2, multiplicity)) - // continue; - - // auto postrack1 = t1.template posTrack_as(); - // auto negtrack1 = t1.template negTrack_as(); - // auto postrack2 = t2.template posTrack_as(); - // auto negtrack2 = t2.template negTrack_as(); - // if (postrack1.globalIndex() == postrack2.globalIndex()) { - // continue; - // } - // if (negtrack1.globalIndex() == negtrack2.globalIndex()) { - // continue; - // } - // double nTPCSigmaPos1{postrack1.tpcNSigmaPi()}; - // double nTPCSigmaNeg1{negtrack1.tpcNSigmaPi()}; - // double nTPCSigmaPos2{postrack2.tpcNSigmaPi()}; - // double nTPCSigmaNeg2{negtrack2.tpcNSigmaPi()}; - - // if (!isSelectedV0Daughter(postrack1, 1, nTPCSigmaPos1, t1)) { - // continue; - // } - // if (!isSelectedV0Daughter(postrack2, 1, nTPCSigmaPos2, t2)) { - // continue; - // } - // if (!isSelectedV0Daughter(negtrack1, -1, nTPCSigmaNeg1, t1)) { - // continue; - // } - // if (!isSelectedV0Daughter(negtrack2, -1, nTPCSigmaNeg2, t2)) { - // continue; - // } - // daughter1 = ROOT::Math::PxPyPzMVector(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassK0Short); // Kshort - // daughter2 = ROOT::Math::PxPyPzMVector(t2.px(), t2.py(), t2.pz(), o2::constants::physics::MassK0Short); // Kshort - - // mother = daughter1 + daughter2; // invariant mass of Kshort pair - // isMix = true; - // fillInvMass(mother, multiplicity, daughter1, daughter2, isMix); - // } - // } - // } - } - PROCESS_SWITCH(HigherMassResonances, processMEderived, "mixed event process in derived data", true); - - array pvec0; - array pvec1; - // use any one of 3 alias depending on the dataset. If pp then FT0M and if pbpb then FTOC - using BinningTypeTPCMultiplicity = ColumnBinningPolicy; - using BinningTypeCentralityM = ColumnBinningPolicy; - using BinningTypeVertexContributor = ColumnBinningPolicy; - void processME(EventCandidates const& collisions, TrackCandidates const& /*tracks*/, V0TrackCandidate const& v0s) { auto tracksTuple = std::make_tuple(v0s); - BinningTypeVertexContributor binningOnPositions1{{mevz, memult}, true}; - BinningTypeCentralityM binningOnPositions2{{mevz, memult}, true}; + SameKindPair pair1{binningOnFT0M, config.cfgNmixedEvents, -1, collisions, tracksTuple, &cache}; + SameKindPair pair2{binningOnFT0A, config.cfgNmixedEvents, -1, collisions, tracksTuple, &cache}; + SameKindPair pair3{binningOnFT0C, config.cfgNmixedEvents, -1, collisions, tracksTuple, &cache}; + SameKindPair pair4{binningOnFV0A, config.cfgNmixedEvents, -1, collisions, tracksTuple, &cache}; - SameKindPair pair1{binningOnPositions1, config.cfgNmixedEvents, -1, collisions, tracksTuple, &cache}; // for PbPb - SameKindPair pair2{binningOnPositions2, config.cfgNmixedEvents, -1, collisions, tracksTuple, &cache}; // for pp - - if (config.cfgMultFOTM) { - for (const auto& [c1, tracks1, c2, tracks2] : pair2) // two different centrality c1 and c2 and tracks corresponding to them - { + auto runMixing = [&](auto& pair, auto multiplicityGetter) { + for (const auto& [c1, tracks1, c2, tracks2] : pair) { - multiplicity = 0.0; - multiplicity = c1.centFT0M(); + multiplicity = multiplicityGetter(c1); - if (!eventselection(c1) || !eventselection(c2)) { + if (!selectionEvent(c1, false) || !selectionEvent(c2, false)) { continue; } - // auto occupancyNumber = c1.trackOccupancyInTimeRange(); - // auto occupancyNumber2 = c2.trackOccupancyInTimeRange(); - // if (applyOccupancyCut && (occupancyNumber < occupancyCut || occupancyNumber2 < occupancyCut)) { - // return; - // } - - if (rctCut.requireRCTFlagChecker && !rctCut.rctChecker(c1)) { - return; - } - if (rctCut.requireRCTFlagChecker && !rctCut.rctChecker(c2)) { - return; - } for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { @@ -1228,66 +974,16 @@ struct HigherMassResonances { fillInvMass(mother, multiplicity, daughter1, daughter2, isMix); } } - } else { - for (const auto& [c1, tracks1, c2, tracks2] : pair1) // two different centrality c1 and c2 and tracks corresponding to them - { - multiplicity = 0.0f; - multiplicity = c1.centFT0C(); - - if (!eventselection(c1) || !eventselection(c2)) { - continue; - } - // auto occupancyNumber = c1.trackOccupancyInTimeRange(); - // auto occupancyNumber2 = c2.trackOccupancyInTimeRange(); - // if (applyOccupancyCut && (occupancyNumber < occupancyCut || occupancyNumber2 < occupancyCut)) { - // return; - // } - - for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - if (t1.size() == 0 || t2.size() == 0) { - continue; - } - - if (!selectionV0(c1, t1, multiplicity)) - continue; - if (!selectionV0(c2, t2, multiplicity)) - continue; - - auto postrack1 = t1.template posTrack_as(); - auto negtrack1 = t1.template negTrack_as(); - auto postrack2 = t2.template posTrack_as(); - auto negtrack2 = t2.template negTrack_as(); - if (postrack1.globalIndex() == postrack2.globalIndex()) { - continue; - } - if (negtrack1.globalIndex() == negtrack2.globalIndex()) { - continue; - } - double nTPCSigmaPos1{postrack1.tpcNSigmaPi()}; - double nTPCSigmaNeg1{negtrack1.tpcNSigmaPi()}; - double nTPCSigmaPos2{postrack2.tpcNSigmaPi()}; - double nTPCSigmaNeg2{negtrack2.tpcNSigmaPi()}; - - if (!isSelectedV0Daughter(postrack1, 1, nTPCSigmaPos1, t1)) { - continue; - } - if (!isSelectedV0Daughter(postrack2, 1, nTPCSigmaPos2, t2)) { - continue; - } - if (!isSelectedV0Daughter(negtrack1, -1, nTPCSigmaNeg1, t1)) { - continue; - } - if (!isSelectedV0Daughter(negtrack2, -1, nTPCSigmaNeg2, t2)) { - continue; - } - daughter1 = ROOT::Math::PxPyPzMVector(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassK0Short); // Kshort - daughter2 = ROOT::Math::PxPyPzMVector(t2.px(), t2.py(), t2.pz(), o2::constants::physics::MassK0Short); // Kshort - - mother = daughter1 + daughter2; // invariant mass of Kshort pair - isMix = true; - fillInvMass(mother, multiplicity, daughter1, daughter2, isMix); - } - } + }; + // Call mixing based on selected estimator + if (config.cSelectMultEstimator == kFT0M) { + runMixing(pair1, [](const auto& c) { return c.centFT0M(); }); + } else if (config.cSelectMultEstimator == kFT0A) { + runMixing(pair2, [](const auto& c) { return c.centFT0A(); }); + } else if (config.cSelectMultEstimator == kFT0C) { + runMixing(pair3, [](const auto& c) { return c.centFT0C(); }); + } else if (config.cSelectMultEstimator == kFV0A) { + runMixing(pair4, [](const auto& c) { return c.centFV0A(); }); } } PROCESS_SWITCH(HigherMassResonances, processME, "mixed event process", true); @@ -1304,45 +1000,36 @@ struct HigherMassResonances { return; } hMChists.fill(HIST("events_check"), 0.5); - if (std::abs(mcCollision.posZ()) < config.cutzvertex) { - hMChists.fill(HIST("events_check"), 1.5); - } - // int Nchinel = 0; - // for (const auto& mcParticle : mcParticles) { - // auto pdgcode = std::abs(mcParticle.pdgCode()); - // if (mcParticle.isPhysicalPrimary() && (pdgcode == 211 || pdgcode == 321 || pdgcode == 2212 || pdgcode == 11 || pdgcode == 13)) { - // if (std::abs(mcParticle.eta()) < 1.0) { - // Nchinel = Nchinel + 1; - // } - // } - // } - // if (Nchinel > 0 && std::abs(mcCollision.posZ()) < config.cutzvertex) - hMChists.fill(HIST("events_check"), 2.5); std::vector selectedEvents(collisions.size()); int nevts = 0; - multiplicityGen = 0.0; + multiplicityGen = -999.0; for (const auto& collision : collisions) { - if (std::abs(collision.mcCollision().posZ()) > config.cutzvertex) { - continue; - } - if (config.timFrameEvsel && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { - continue; + // multiplicityGen = collision.centFT0M(); + if (config.cSelectMultEstimator == kFT0M) { + multiplicityGen = collision.centFT0M(); + } else if (config.cSelectMultEstimator == kFT0A) { + multiplicityGen = collision.centFT0A(); + } else if (config.cSelectMultEstimator == kFT0C) { + multiplicityGen = collision.centFT0C(); + } else if (config.cSelectMultEstimator == kFV0A) { + multiplicityGen = collision.centFV0A(); + } else { + multiplicityGen = collision.centFT0M(); // default } - if (config.cTVXEvsel && (!collision.selection_bit(aod::evsel::kIsTriggerTVX))) { + + if (!selectionEvent(collision, true)) { continue; } - multiplicityGen = collision.centFT0M(); - selectedEvents[nevts++] = collision.mcCollision_as().globalIndex(); } selectedEvents.resize(nevts); hMChists.fill(HIST("events_check"), 3.5); const auto evtReconstructedAndSelected = std::find(selectedEvents.begin(), selectedEvents.end(), mcCollision.globalIndex()) != selectedEvents.end(); - if (!config.allGenCollisions && !evtReconstructedAndSelected) { // Check that the event is reconstructed and that the reconstructed events pass the selection + if (!config.isallGenCollisions && !evtReconstructedAndSelected) { // Check that the event is reconstructed and that the reconstructed events pass the selection return; } hMChists.fill(HIST("events_check"), 4.5); @@ -1354,15 +1041,11 @@ struct HigherMassResonances { } hMChists.fill(HIST("events_check"), 5.5); - if (config.applyRapidityMC && std::abs(mcParticle.y()) >= config.rapidityMotherData) { + if (config.isapplyRapidityMC && std::abs(mcParticle.y()) >= config.rapidityMotherData) { continue; } hMChists.fill(HIST("events_check"), 6.5); - // if (counter < 1e3) - // std::cout << "px " << mcParticle.px() << " py " << mcParticle.py() << " pz " << mcParticle.pz() << " y " << mcParticle.y() << std::endl; - // counter++; - auto kDaughters = mcParticle.daughters_as(); if (kDaughters.size() != config.noOfDaughters) { continue; @@ -1405,7 +1088,7 @@ struct HigherMassResonances { hMChists.fill(HIST("GenEta"), mcParticle.eta()); hMChists.fill(HIST("GenPhi"), mcParticle.phi()); - if (config.applyPairRapidityGen && std::abs(lResonanceGen1.Rapidity()) >= config.rapidityMotherData) { + if (config.isapplyPairRapidityGen && std::abs(lResonanceGen1.Rapidity()) >= config.rapidityMotherData) { continue; } @@ -1428,42 +1111,35 @@ struct HigherMassResonances { return; } - auto multiplicity = collision.centFT0M(); - hMChists.fill(HIST("Rec_Multiplicity"), multiplicity); - - hMChists.fill(HIST("events_checkrec"), 0.5); - if (!collision.has_mcCollision()) { - return; + auto multiplicity = -999.0; + if (config.cSelectMultEstimator == kFT0M) { + multiplicity = collision.centFT0M(); + } else if (config.cSelectMultEstimator == kFT0A) { + multiplicity = collision.centFT0A(); + } else if (config.cSelectMultEstimator == kFT0C) { + multiplicity = collision.centFT0C(); + } else if (config.cSelectMultEstimator == kFV0A) { + multiplicity = collision.centFV0A(); + } else { + multiplicity = collision.centFT0M(); // default } - hMChists.fill(HIST("events_checkrec"), 1.5); - // // if (std::abs(collision.mcCollision().posZ()) > config.cutzvertex || !collision.sel8()) { - if (std::abs(collision.mcCollision().posZ()) > config.cutzvertex) { + + if (!selectionEvent(collision, false)) { return; } - hMChists.fill(HIST("events_checkrec"), 2.5); - - // if (config.timFrameEvsel && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { - // return; - // } - // hMChists.fill(HIST("events_checkrec"), 3.5); - // if (config.cTVXEvsel && (!collision.selection_bit(aod::evsel::kIsTriggerTVX))) { - // return; - // } + hMChists.fill(HIST("Rec_Multiplicity"), multiplicity); - if (!collision.sel8()) { + if (!collision.has_mcCollision()) { return; } - hMChists.fill(HIST("events_checkrec"), 4.5); + hMChists.fill(HIST("MC_mult_after_event_sel"), multiplicity); eventCounter++; - // auto oldindex = -999; for (const auto& v01 : V0s) { for (const auto& v02 : V0s) { - hMChists.fill(HIST("events_checkrec"), 5.5); - if (v02.index() <= v01.index()) { continue; } @@ -1471,7 +1147,7 @@ struct HigherMassResonances { if (!v01.has_mcParticle() || !v02.has_mcParticle()) { continue; } - hMChists.fill(HIST("events_checkrec"), 6.5); + hMChists.fill(HIST("events_checkrec"), 0.5); auto postrack1 = v01.template posTrack_as(); auto negtrack1 = v01.template negTrack_as(); @@ -1481,11 +1157,9 @@ struct HigherMassResonances { if (!postrack1.has_mcParticle() || !postrack2.has_mcParticle()) continue; // Checking that the daughter tracks come from particles and are not fake - hMChists.fill(HIST("events_checkrec"), 7.5); if (!negtrack1.has_mcParticle() || !negtrack2.has_mcParticle()) continue; - hMChists.fill(HIST("events_checkrec"), 8.5); double nTPCSigmaPos1[1]{postrack1.tpcNSigmaPi()}; double nTPCSigmaNeg1[1]{negtrack1.tpcNSigmaPi()}; @@ -1495,17 +1169,16 @@ struct HigherMassResonances { if (!isSelectedV0Daughter(postrack1, 1, nTPCSigmaPos1[0], v01) || !isSelectedV0Daughter(postrack2, 1, nTPCSigmaPos2[0], v02)) { continue; } - hMChists.fill(HIST("events_checkrec"), 9.5); if (!isSelectedV0Daughter(negtrack1, -1, nTPCSigmaNeg1[0], v01) || !isSelectedV0Daughter(negtrack2, -1, nTPCSigmaNeg2[0], v02)) { continue; } - hMChists.fill(HIST("events_checkrec"), 10.5); + hMChists.fill(HIST("events_checkrec"), 1.5); if (!selectionV0(collision, v01, multiplicity) || !selectionV0(collision, v02, multiplicity)) { continue; } - hMChists.fill(HIST("events_checkrec"), 11.5); + hMChists.fill(HIST("events_checkrec"), 2.5); auto mctrackv01 = v01.mcParticle(); auto mctrackv02 = v02.mcParticle(); @@ -1516,7 +1189,7 @@ struct HigherMassResonances { if (std::abs(trackv0PDG1) != PDG_t::kK0Short || std::abs(trackv0PDG2) != PDG_t::kK0Short) { continue; } - hMChists.fill(HIST("events_checkrec"), 12.5); + hMChists.fill(HIST("events_checkrec"), 3.5); for (const auto& mothertrack1 : mctrackv01.mothers_as()) { @@ -1530,17 +1203,15 @@ struct HigherMassResonances { for (const auto& mothertrack2 : mctrackv02.mothers_as()) { - hMChists.fill(HIST("events_checkrec"), 13.5); - if (mothertrack1.pdgCode() != config.pdgCodes[config.selectMCparticles]) { continue; } - hMChists.fill(HIST("events_checkrec"), 14.5); + hMChists.fill(HIST("events_checkrec"), 4.5); if (mothertrack1.pdgCode() != mothertrack2.pdgCode()) { continue; } - hMChists.fill(HIST("events_checkrec"), 15.5); + hMChists.fill(HIST("events_checkrec"), 5.5); gindex2.push_back(mothertrack2.globalIndex()); if (gindex2.size() > 1) { @@ -1548,24 +1219,24 @@ struct HigherMassResonances { continue; } } - hMChists.fill(HIST("events_checkrec"), 16.5); + hMChists.fill(HIST("events_checkrec"), 6.5); if (mothertrack1.globalIndex() != mothertrack2.globalIndex()) { continue; } - hMChists.fill(HIST("events_checkrec"), 17.5); + hMChists.fill(HIST("events_checkrec"), 7.5); if (!mothertrack1.producedByGenerator()) { continue; } - hMChists.fill(HIST("events_checkrec"), 18.5); + hMChists.fill(HIST("events_checkrec"), 8.5); - if (config.applyRapidityMC && std::abs(mothertrack1.y()) >= config.rapidityMotherData) { + if (config.isapplyRapidityMC && std::abs(mothertrack1.y()) >= config.rapidityMotherData) { continue; } - hMChists.fill(HIST("events_checkrec"), 19.5); + hMChists.fill(HIST("events_checkrec"), 9.5); - // if (config.avoidsplitrackMC && oldindex == mothertrack1.globalIndex()) { + // if (config.isavoidsplitrackMC && oldindex == mothertrack1.globalIndex()) { // hMChists.fill(HIST("h1Recsplit"), mothertrack1.pt()); // continue; // } @@ -1592,7 +1263,7 @@ struct HigherMassResonances { hMChists.fill(HIST("RecPhi"), mothertrack1.phi()); hMChists.fill(HIST("RecEta"), mothertrack1.eta()); - if (config.applyPairRapidityRec && std::abs(mother.Rapidity()) >= config.rapidityMotherData) { + if (config.isapplyPairRapidityRec && std::abs(mother.Rapidity()) >= config.rapidityMotherData) { continue; } @@ -1608,6 +1279,181 @@ struct HigherMassResonances { } } PROCESS_SWITCH(HigherMassResonances, processRec, "Process Reconstructed", false); + + void processSEderived(EventCandidatesDerivedData::iterator const& collision, TrackCandidates const& /*tracks*/, aod::V0Datas const& V0s) + { + if (config.cSelectMultEstimator == kFT0M) { + multiplicity = collision.centFT0M(); + } else if (config.cSelectMultEstimator == kFT0A) { + multiplicity = collision.centFT0A(); + } else if (config.cSelectMultEstimator == kFT0C) { + multiplicity = collision.centFT0C(); + } else if (config.cSelectMultEstimator == kFV0A) { + multiplicity = collision.centFV0A(); + } else { + multiplicity = collision.centFT0M(); // default + } + + if (!selectionEvent(collision, true)) { + return; + } + + if (config.qAevents) { + rEventSelection.fill(HIST("hVertexZRec"), collision.posZ()); + rEventSelection.fill(HIST("hmultiplicity"), multiplicity); + } + + std::vector v0indexes; + bool allConditionsMet = 0; + + for (const auto& [v1, v2] : combinations(CombinationsFullIndexPolicy(V0s, V0s))) { + + if (v1.size() == 0 || v2.size() == 0) { + continue; + } + + if (!selectionV0(collision, v1, multiplicity)) { + continue; + } + if (!selectionV0(collision, v2, multiplicity)) { + continue; + } + + auto postrack1 = v1.template posTrack_as(); + auto negtrack1 = v1.template negTrack_as(); + auto postrack2 = v2.template posTrack_as(); + auto negtrack2 = v2.template negTrack_as(); + + double nTPCSigmaPos1{postrack1.tpcNSigmaPi()}; + double nTPCSigmaNeg1{negtrack1.tpcNSigmaPi()}; + double nTPCSigmaPos2{postrack2.tpcNSigmaPi()}; + double nTPCSigmaNeg2{negtrack2.tpcNSigmaPi()}; + + if (!(isSelectedV0Daughter(negtrack1, -1, nTPCSigmaNeg1, v1) && isSelectedV0Daughter(postrack1, 1, nTPCSigmaPos1, v1))) { + continue; + } + if (!(isSelectedV0Daughter(postrack2, 1, nTPCSigmaPos2, v2) && isSelectedV0Daughter(negtrack2, -1, nTPCSigmaNeg2, v2))) { + continue; + } + + if (std::find(v0indexes.begin(), v0indexes.end(), v1.globalIndex()) == v0indexes.end()) { + v0indexes.push_back(v1.globalIndex()); + } + // if (!(std::find(v0indexes.begin(), v0indexes.end(), v2.globalIndex()) != v0indexes.end())) { + // v0indexes.push_back(v2.globalIndex()); + // } + + if (v2.globalIndex() <= v1.globalIndex()) { + continue; + } + + // if (config.qAv0Daughters) { + // rKzeroShort.fill(HIST("negative_pt"), negtrack1.pt()); + // rKzeroShort.fill(HIST("positive_pt"), postrack1.pt()); + // rKzeroShort.fill(HIST("negative_eta"), negtrack1.eta()); + // rKzeroShort.fill(HIST("positive_eta"), postrack1.eta()); + // rKzeroShort.fill(HIST("negative_phi"), negtrack1.phi()); + // rKzeroShort.fill(HIST("positive_phi"), postrack1.phi()); + // } + + if (postrack1.globalIndex() == postrack2.globalIndex()) { + continue; + } + if (negtrack1.globalIndex() == negtrack2.globalIndex()) { + continue; + } + + if (!applyAngSep(v1, v2)) { + continue; + } + + if (config.qAv0) { + rKzeroShort.fill(HIST("hMasscorrelationbefore"), v1.mK0Short(), v2.mK0Short()); + } + allConditionsMet = 1; + daughter1 = ROOT::Math::PxPyPzMVector(v1.px(), v1.py(), v1.pz(), o2::constants::physics::MassK0Short); // Kshort + daughter2 = ROOT::Math::PxPyPzMVector(v2.px(), v2.py(), v2.pz(), o2::constants::physics::MassK0Short); // Kshort + + mother = daughter1 + daughter2; // invariant mass of Kshort pair + isMix = false; + + if (!config.isselectTWOKsOnly) + fillInvMass(mother, multiplicity, daughter1, daughter2, isMix); + } + int sizeofv0indexes = v0indexes.size(); + rKzeroShort.fill(HIST("NksProduced"), sizeofv0indexes); + if (config.isselectTWOKsOnly && sizeofv0indexes == config.noOfDaughters && allConditionsMet) { + fillInvMass(mother, multiplicity, daughter1, daughter2, false); + } + v0indexes.clear(); + } + PROCESS_SWITCH(HigherMassResonances, processSEderived, "same event process in strangeness derived data", false); + + void processMEderived(EventCandidatesDerivedData const& collisions, TrackCandidates const& /*tracks*/, V0CandidatesDerivedData const& v0s) + { + + for (const auto& [c1, c2] : selfCombinations(colBinning, config.cfgNmixedEvents, -1, collisions, collisions)) // two different centrality c1 and c2 and tracks corresponding to them + { + + multiplicity = 0.0; + multiplicity = c1.centFT0M(); + + if (!selectionEvent(c1, false) || !selectionEvent(c2, false)) { + continue; + } + + auto groupV01 = v0s.sliceBy(tracksPerCollisionV0Mixed, c1.index()); + auto groupV02 = v0s.sliceBy(tracksPerCollisionV0Mixed, c2.index()); + for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(groupV01, groupV02))) { + + if (t1.size() == 0 || t2.size() == 0) { + continue; + } + + if (!selectionV0(c1, t1, multiplicity)) + continue; + if (!selectionV0(c2, t2, multiplicity)) + continue; + + auto postrack1 = t1.template posTrackExtra_as(); + auto negtrack1 = t1.template negTrackExtra_as(); + auto postrack2 = t2.template posTrackExtra_as(); + auto negtrack2 = t2.template negTrackExtra_as(); + + if (postrack1.globalIndex() == postrack2.globalIndex()) { + continue; + } + if (negtrack1.globalIndex() == negtrack2.globalIndex()) { + continue; + } + double nTPCSigmaPos1{postrack1.tpcNSigmaPi()}; + double nTPCSigmaNeg1{negtrack1.tpcNSigmaPi()}; + double nTPCSigmaPos2{postrack2.tpcNSigmaPi()}; + double nTPCSigmaNeg2{negtrack2.tpcNSigmaPi()}; + + if (!isSelectedV0Daughter(postrack1, 1, nTPCSigmaPos1, t1)) { + continue; + } + if (!isSelectedV0Daughter(postrack2, 1, nTPCSigmaPos2, t2)) { + continue; + } + if (!isSelectedV0Daughter(negtrack1, -1, nTPCSigmaNeg1, t1)) { + continue; + } + if (!isSelectedV0Daughter(negtrack2, -1, nTPCSigmaNeg2, t2)) { + continue; + } + + daughter1 = ROOT::Math::PxPyPzMVector(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassK0Short); // Kshort + daughter2 = ROOT::Math::PxPyPzMVector(t2.px(), t2.py(), t2.pz(), o2::constants::physics::MassK0Short); // Kshort + + mother = daughter1 + daughter2; // invariant mass of Kshort pair + isMix = true; + fillInvMass(mother, multiplicity, daughter1, daughter2, isMix); + } + } + } + PROCESS_SWITCH(HigherMassResonances, processMEderived, "mixed event process in derived data", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From fe6c8eded94d253359f24290397c4a899bbfd963 Mon Sep 17 00:00:00 2001 From: prottayCMT <61418725+prottayCMT@users.noreply.github.com> Date: Sun, 17 Aug 2025 22:19:56 +0200 Subject: [PATCH 085/986] [PWGLF] updated derived data process function (#12605) Co-authored-by: Prottay Das --- PWGLF/Tasks/Strangeness/lambdapolsp.cxx | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/lambdapolsp.cxx b/PWGLF/Tasks/Strangeness/lambdapolsp.cxx index c9af2944e34..b64a0e793b6 100644 --- a/PWGLF/Tasks/Strangeness/lambdapolsp.cxx +++ b/PWGLF/Tasks/Strangeness/lambdapolsp.cxx @@ -205,6 +205,7 @@ struct lambdapolsp { ConfigurableAxis axisRadius{"axisRadius", {200, 0, 100}, "radius axis"}; ConfigurableAxis axisDca{"axisDca", {100, -5, 5}, "dca axis"}; ConfigurableAxis axisLT{"axisLT", {50, 0, 50}, "lifetime axis"}; + ConfigurableAxis axisCR{"axisCR", {40, 0, 200}, "CR axis"}; Configurable filldist{"filldist", true, "fill topo distr"}; } distGrp; @@ -406,6 +407,7 @@ struct lambdapolsp { histos.add("hdcaneglambda", "hdcaneglambda", HistType::kTH1D, {distGrp.axisDca}, true); histos.add("hdcaposantilambda", "hdcaposantilambda", HistType::kTH1D, {distGrp.axisDca}, true); histos.add("hdcanegantilambda", "hdcanegantilambda", HistType::kTH1D, {distGrp.axisDca}, true); + histos.add("htpcCR", "htpcCR", HistType::kTH1D, {distGrp.axisCR}, true); } ccdb->setURL(cfgCcdbParam.cfgURL); @@ -1165,11 +1167,13 @@ struct lambdapolsp { } } } else { + if (distGrp.filldist) { histos.fill(HIST("hcosine"), v0.v0cosPA()); histos.fill(HIST("hdcabwv0daugh"), v0.dcaV0daughters()); histos.fill(HIST("hlifetime"), TMath::Abs(v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * massLambda)); histos.fill(HIST("hradius"), v0.v0radius()); + histos.fill(HIST("htpcCR"), postrack.tpcNClsCrossedRows()); } if (LambdaTag) { @@ -1223,6 +1227,7 @@ struct lambdapolsp { else if (centestim == 3) centrality = collision.centFV0A(); + auto runnumber = collision.runNumber(); // auto centrality = collision.centFT0C(); if (!collision.triggereventsp()) { // provided by StraZDCSP return; @@ -1257,6 +1262,16 @@ struct lambdapolsp { accprofileAL = ccdb->getForTimeStamp(ConfAccPathAL.value, bc.timestamp()); } */ + auto timestamps = ccdb->getRunDuration(runnumber, true); /// fatalise if timestamps are not found + int64_t sorTimestamp = timestamps.first; // timestamp of the SOR/SOX/STF in ms + int64_t eorTimestamp = timestamps.second; // timestamp of the EOR/EOX/ETF in ms + int64_t ts = eorTimestamp / 2 + sorTimestamp / 2; // timestamp of the middle of the run + + if (useAccCorr) { + accprofileL = ccdb->getForTimeStamp(ConfAccPathL.value, ts); + accprofileAL = ccdb->getForTimeStamp(ConfAccPathAL.value, ts); + } + //___________________________________________________________________________________________________ // retrieve further info provided by StraZDCSP auto qxZDCA = collision.qxZDCA(); @@ -1430,7 +1445,10 @@ struct lambdapolsp { if (analyzeLambda && LambdaTag) { Lambda = Proton + AntiPion; tagb = 0; - double acvalue = 1.0; + int binx = accprofileL->GetXaxis()->FindBin(v0.eta()); + int biny = accprofileL->GetYaxis()->FindBin(v0.pt()); + double acvalue = accprofileL->GetBinContent(binx, biny); + // double acvalue = 1.0; fillHistograms(taga, tagb, Lambda, Proton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mLambda(), v0.pt(), v0.eta(), acvalue, 1.0); } @@ -1438,7 +1456,10 @@ struct lambdapolsp { if (analyzeLambda && aLambdaTag) { AntiLambda = AntiProton + Pion; taga = 0; - double acvalue = 1.0; + int binx = accprofileAL->GetXaxis()->FindBin(v0.eta()); + int biny = accprofileAL->GetYaxis()->FindBin(v0.pt()); + double acvalue = accprofileAL->GetBinContent(binx, biny); + // double acvalue = 1.0; fillHistograms(taga, tagb, AntiLambda, AntiProton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mAntiLambda(), v0.pt(), v0.eta(), acvalue, 1.0); } } From 598271a6db708b810fd5d57a0ec3df398bc82b6a Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Sun, 17 Aug 2025 23:07:26 +0200 Subject: [PATCH 086/986] [PWGLF] Add new QA task for phi meson spectra + fix bug lambda spin correlation (#12607) --- PWGLF/Tasks/Resonances/CMakeLists.txt | 7 +- PWGLF/Tasks/Resonances/phispectrapbpbqa.cxx | 710 ++++++++++++++++++ .../Strangeness/lambdaspincorrderived.cxx | 33 +- 3 files changed, 740 insertions(+), 10 deletions(-) create mode 100644 PWGLF/Tasks/Resonances/phispectrapbpbqa.cxx diff --git a/PWGLF/Tasks/Resonances/CMakeLists.txt b/PWGLF/Tasks/Resonances/CMakeLists.txt index 709643f75f4..de23fa67237 100644 --- a/PWGLF/Tasks/Resonances/CMakeLists.txt +++ b/PWGLF/Tasks/Resonances/CMakeLists.txt @@ -239,7 +239,12 @@ o2physics_add_dpl_workflow(kstarinoo PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(phioo +o2physics_add_dpl_workflow(phioo SOURCES phiOO.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(phispectrapbpbqa + SOURCES phispectrapbpbqa.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGLF/Tasks/Resonances/phispectrapbpbqa.cxx b/PWGLF/Tasks/Resonances/phispectrapbpbqa.cxx new file mode 100644 index 00000000000..276db4b4c5f --- /dev/null +++ b/PWGLF/Tasks/Resonances/phispectrapbpbqa.cxx @@ -0,0 +1,710 @@ +// 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. +// Phi meson spin alignment task +// sourav.kundu@cern.ch + +#include "PWGMM/Mult/DataModel/Index.h" // for Particles2Tracks table + +#include "Common/Core/TrackSelection.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CcdbApi.h" +#include "CommonConstants/PhysicsConstants.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/ConfigParamSpec.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/DCA.h" +#include "ReconstructionDataFormats/Track.h" +#include "ReconstructionDataFormats/V0.h" + +#include "Math/GenVector/Boost.h" +#include "Math/Vector3D.h" +#include "Math/Vector4D.h" +#include "TF1.h" +#include "TRandom3.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using std::array; +struct phispectrapbpbqa { + double bz = 0.; + + // Enable access to the CCDB for the offset and correction constants and save them in dedicated variables. + Service ccdb; + o2::ccdb::CcdbApi ccdbApi; + Service pdg; + struct : ConfigurableGroup { + Configurable cfgURL{"cfgURL", "http://alice-ccdb.cern.ch", "Address of the CCDB to browse"}; + Configurable nolaterthan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "Latest acceptable timestamp of creation for the object"}; + } cfgCcdbParam; + TH3D* hTPCCallib; + TH3D* hTOFCallib; + + Configurable ConfPathTPC{"ConfPathTPC", "Users/s/skundu/My/Object/PIDcallib/TPC", "Weight path TPC"}; + Configurable ConfPathTOF{"ConfPathTOF", "Users/s/skundu/My/Object/PIDcallib/TOF", "Weight path TOF"}; + + // events + Configurable cfgNoMixedEvents{"cfgNoMixedEvents", 10, "Number of event mixing"}; + ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for bin"}; + // ConfigurableAxis axisMultiplicityClass{"axisMultiplicityClass", {8, 0, 80}, "multiplicity percentile for bin"}; + + Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; + Configurable cfgCutCentrality{"cfgCutCentrality", 80.0f, "Accepted maximum Centrality"}; + + // track + Configurable cfgCutPT{"cfgCutPT", 0.2, "PT cut on daughter track"}; + Configurable cfgCutCharge{"cfgCutCharge", 0.0, "cut on Charge"}; + Configurable cfgCutEta{"cfgCutEta", 0.8, "Eta cut on daughter track"}; + + Configurable cfgITScluster{"cfgITScluster", 4, "Number of ITS cluster"}; + Configurable cfgTPCcluster{"cfgTPCcluster", 80, "Number of TPC cluster"}; + Configurable cfgTPCcrossedRows{"cfgTPCcrossedRows", 90, "Number of TPC crossed Rows"}; + + Configurable cfgUpdatePID{"cfgUpdatePID", false, "Update PID callibration"}; + Configurable applyPID{"applyPID", true, "Apply PID"}; + Configurable isDeepAngle{"isDeepAngle", false, "Deep Angle cut"}; + Configurable cfgDeepAngle{"cfgDeepAngle", 0.04, "Deep Angle cut value"}; + Configurable timeFrameMC{"timeFrameMC", false, "time frame cut in MC"}; + Configurable readOutFrameMC{"readOutFrameMC", true, "ITS read out frame cut in MC"}; + Configurable ispTdepPID{"ispTdepPID", false, "pT dependent PID"}; + Configurable cfgCutTOFBeta{"cfgCutTOFBeta", 0.5, "cut TOF beta"}; + Configurable nsigmaCutTPC{"nsigmacutTPC", 2.0, "Value of the TPC Nsigma cut"}; + Configurable nsigmaCutCombined{"nsigmaCutCombined", 2.0, "Value of the Combined TPC-TOF Nsigma cut"}; + ConfigurableAxis axisOccupancy{"axisOccupancy", {VARIABLE_WIDTH, -1.0, 200.0, 500.0, 1000.0, 2000.0f, 4000.0, 10000.0f, 100000.0f}, "occupancy axis"}; + struct : ConfigurableGroup { + ConfigurableAxis configThnAxisInvMass{"configThnAxisInvMass", {90, 0.98, 1.07}, "#it{M} (GeV/#it{c}^{2})"}; + ConfigurableAxis configThnAxisPt{"configThnAxisPt", {100, 0.0, 10.}, "#it{p}_{T} (GeV/#it{c})"}; + ConfigurableAxis configThnAxisCentrality{"configThnAxisCentrality", {8, 0., 80}, "Centrality"}; + ConfigurableAxis configThnAxisSector{"configThnAxisSector", {2, 0.0, 2.0}, "TPC sector"}; + + } cnfgaxis; + Configurable isMC{"isMC", false, "use MC"}; + Configurable avoidsplitrackMC{"avoidsplitrackMC", false, "avoid split track in MC"}; + + Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; + Filter centralityFilter = nabs(aod::cent::centFT0C) < cfgCutCentrality; + Filter acceptanceFilter = (nabs(aod::track::eta) < cfgCutEta && nabs(aod::track::pt) > cfgCutPT); + // Filter PIDcutFilter = nabs(aod::pidtpc::tpcNSigmaKa) < nsigmaCutTPC; + // Filter DCAcutFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz); + + using EventCandidates = soa::Filtered>; + using TrackCandidates = soa::Filtered>; + + using CollisionMCTrueTable = aod::McCollisions; + using TrackMCTrueTable = aod::McParticles; + + using CollisionMCRecTableCentFT0C = soa::SmallGroups>; + using TrackMCRecTable = soa::Join; + using FilTrackMCRecTable = soa::Filtered; + Preslice perCollision = aod::track::collisionId; + + SliceCache cache; + Partition posTracks = aod::track::signed1Pt > cfgCutCharge; + Partition negTracks = aod::track::signed1Pt < cfgCutCharge; + + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // Event selection cuts - Alex + // TF1* fMultPVCutLow = nullptr; + + void init(o2::framework::InitContext&) + { + + histos.add("hphiSE", "hphiSE", HistType::kTHnSparseF, {cnfgaxis.configThnAxisInvMass, cnfgaxis.configThnAxisPt, cnfgaxis.configThnAxisCentrality, axisOccupancy, cnfgaxis.configThnAxisSector}, true); + histos.add("hphiME", "hphiME", HistType::kTHnSparseF, {cnfgaxis.configThnAxisInvMass, cnfgaxis.configThnAxisPt, cnfgaxis.configThnAxisCentrality, axisOccupancy, cnfgaxis.configThnAxisSector}, true); + histos.add("hphiGen", "hphiGen", HistType::kTHnSparseF, {cnfgaxis.configThnAxisInvMass, cnfgaxis.configThnAxisPt, cnfgaxis.configThnAxisCentrality, axisOccupancy}, true); + + histos.add("hNsigmaTPC", "NsigmaKaon TPC", HistType::kTHnSparseF, {{200, -10.0f, 10.0f}, {100, 0.0, 10.0}, axisOccupancy, cnfgaxis.configThnAxisCentrality}); + histos.add("hNsigmaTOF", "NsigmaKaon TOF", HistType::kTHnSparseF, {{200, -10.0f, 10.0f}, {100, 0.0, 10.0}, axisOccupancy, cnfgaxis.configThnAxisCentrality}); + + histos.add("hPhiMommentum", "hPhiMommentum", kTH3F, {{36, 0, 6.283}, {200, -10.0, 10.0}, axisOccupancy}); + + histos.add("hNsigmaTPCAfterCut", "NsigmaKaon TPC After Cut", kTH3F, {{200, -10.0f, 10.0f}, {100, 0.0, 10.0}, axisOccupancy}); + histos.add("hNsigmaTOFAfterCut", "NsigmaKaon TOF After Cut", kTH3F, {{200, -10.0f, 10.0f}, {100, 0.0, 10.0}, axisOccupancy}); + + histos.add("hNsigmaKaonTOFTPC", "NsigmaKaon TOFTPC distribution", kTH3F, {{200, -10.0f, 10.0f}, {200, -10.0f, 10.0f}, {100, 0.0, 10.0}}); + + histos.add("hdcaxy", "DCA xy dist.", kTH2F, {{1000, -1.0f, 1.0f}, {200, -10.0, 10.0}}); + histos.add("hdcaz", "DCA z dist.", kTH2F, {{1000, -1.0f, 1.0f}, {200, -10.0, 10.0}}); + + histos.add("hCentrality", "hCentrality", kTH1F, {{8, 0.0f, 80.0f}}); + histos.add("hVtxZ", "hVtxZ", kTH1F, {{8, 0.0f, 80.0f}}); + histos.add("hOccupancy", "hOccupancy", kTH2F, {axisOccupancy, cnfgaxis.configThnAxisCentrality}); + histos.add("hMC", "hMC", kTH1F, {{20, 0.0f, 20.0f}}); + histos.add("h1PhiRecsplit", "h1PhiRecsplit", kTH1F, {{100, 0.0f, 10.0f}}); + + ccdb->setURL(cfgCcdbParam.cfgURL); + ccdbApi.init("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + if (cfgUpdatePID) { + hTPCCallib = ccdb->getForTimeStamp(ConfPathTPC.value, cfgCcdbParam.nolaterthan.value); + hTOFCallib = ccdb->getForTimeStamp(ConfPathTOF.value, cfgCcdbParam.nolaterthan.value); + } + } + + double massKa = o2::constants::physics::MassKPlus; + + int getMagneticField(uint64_t timestamp) + { + // Get the magnetic field + static o2::parameters::GRPMagField* grpo = nullptr; + if (grpo == nullptr) { + grpo = ccdb->getForTimeStamp("/GLO/Config/GRPMagField", timestamp); + if (grpo == nullptr) { + LOGF(fatal, "GRP object not found for timestamp %llu", timestamp); + return 0; + } + LOGF(info, "Retrieved GRP for timestamp %llu with magnetic field of %d kG", timestamp, grpo->getNominalL3Field()); + } + return grpo->getNominalL3Field(); + } + + template + bool selectionTrack(const T& candidate) + { + if (!(candidate.isGlobalTrack() && candidate.isPVContributor() && candidate.itsNCls() > cfgITScluster && candidate.tpcNClsFound() > cfgTPCcluster && candidate.tpcNClsCrossedRows() > cfgTPCcrossedRows)) { + return false; + } + return true; + } + + template + bool selectionPIDpTdependent(const T& candidate, double nsigmaTPC, double nsigmaTOF) + { + if (candidate.p() < 0.7 && TMath::Abs(nsigmaTPC) < nsigmaCutTPC) { + return true; + } + if (candidate.p() >= 0.7 && candidate.hasTOF() && candidate.beta() > cfgCutTOFBeta && TMath::Sqrt(nsigmaTPC * nsigmaTPC + nsigmaTOF * nsigmaTOF) < nsigmaCutCombined) { + return true; + } + return false; + } + + template + bool selectionPID(const T& candidate, double nsigmaTPC, double nsigmaTOF) + { + if (candidate.p() < 0.7 && TMath::Abs(nsigmaTPC) < nsigmaCutTPC) { + return true; + } + if (candidate.p() >= 0.7 && candidate.hasTOF() && candidate.beta() > cfgCutTOFBeta && TMath::Sqrt(nsigmaTPC * nsigmaTPC + nsigmaTOF * nsigmaTOF) < nsigmaCutCombined) { + return true; + } + if (candidate.p() >= 0.7 && !candidate.hasTOF() && TMath::Abs(nsigmaTPC) < nsigmaCutTPC) { + return true; + } + return false; + } + + // deep angle cut on pair to remove photon conversion + template + bool selectionPair(const T1& candidate1, const T2& candidate2) + { + double pt1, pt2, pz1, pz2, p1, p2, angle; + pt1 = candidate1.pt(); + pt2 = candidate2.pt(); + pz1 = candidate1.pz(); + pz2 = candidate2.pz(); + p1 = candidate1.p(); + p2 = candidate2.p(); + angle = TMath::ACos((pt1 * pt2 + pz1 * pz2) / (p1 * p2)); + if (isDeepAngle && angle < cfgDeepAngle) { + return false; + } + return true; + } + + // Keep a track only if its azimuth is NOT inside the periodic boundary window. + // phi : track azimuth (radians) at your chosen reference radius (e.g. Rout ~ 247 cm) + // badHalfWidth : half-width of the bad strip near each boundary (rad). Your example: 0.15 + // nSectors : 18 for ALICE TPC + bool keepTrackNoTPCBoundary(float phi, + float badWidth = 0.15f, + int nSectors = 18) + { + constexpr float TwoPi = 6.283185307179586f; + float ph = std::fmod(phi, TwoPi); + if (ph < 0.f) + ph += TwoPi; // wrap phi into [0, 2π) + + const float secW = TwoPi / static_cast(nSectors); // ≈ 0.349 rad + + float rel = std::fmod(ph, secW); // position inside sector [0, secW) + + return rel > badWidth; // keep if NOT inside boundary strip [0, badWidth] + } + + using BinningTypeVertexContributor = ColumnBinningPolicy; + ROOT::Math::PxPyPzMVector PhiMesonMother, KaonPlus, KaonMinus, fourVecDauCM; + int currentRunNumber = -999; + int lastRunNumber = -999; + void processSameEvent(EventCandidates::iterator const& collision, TrackCandidates const&, aod::BCsWithTimestamps const&) + { + if (!collision.sel8() || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) || !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + return; + } + auto centrality = collision.centFT0C(); + int occupancy = collision.trackOccupancyInTimeRange(); + histos.fill(HIST("hCentrality"), centrality); + histos.fill(HIST("hVtxZ"), collision.posZ()); + auto bc = collision.template bc_as(); + currentRunNumber = collision.bc_as().runNumber(); + if (currentRunNumber != lastRunNumber) { + bz = getMagneticField(bc.timestamp()); + } + lastRunNumber = currentRunNumber; + auto posThisColl = posTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + auto negThisColl = negTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + + int Npostrack = 0; + histos.fill(HIST("hOccupancy"), occupancy, centrality); + for (auto track1 : posThisColl) { + if (!selectionTrack(track1)) { + continue; + } + histos.fill(HIST("hdcaxy"), track1.dcaXY(), track1.p() / track1.sign()); + histos.fill(HIST("hdcaz"), track1.dcaZ(), track1.p() / track1.sign()); + double nSigmaTPC = track1.tpcNSigmaKa(); + double nSigmaTOF = track1.tofNSigmaKa(); + if (!track1.hasTOF()) { + nSigmaTOF = -9999.99; + } + + if (cfgUpdatePID) { + // update PID + nSigmaTPC = (nSigmaTPC - hTPCCallib->GetBinContent(hTPCCallib->FindBin(track1.p(), centrality, occupancy))) / hTPCCallib->GetBinError(hTPCCallib->FindBin(track1.p(), centrality, occupancy)); + if (track1.hasTOF()) { + nSigmaTOF = (nSigmaTOF - hTOFCallib->GetBinContent(hTOFCallib->FindBin(track1.p(), centrality, occupancy))) / hTOFCallib->GetBinError(hTOFCallib->FindBin(track1.p(), centrality, occupancy)); + } + } + if (track1.p() < 0.6) { + histos.fill(HIST("hNsigmaTPC"), nSigmaTPC, track1.p(), occupancy, centrality); + } else if (track1.p() > 0.6 && track1.hasTOF() && std::abs(nSigmaTOF) < 4.0) { + histos.fill(HIST("hNsigmaTPC"), nSigmaTPC, track1.p(), occupancy, centrality); + } + if (track1.hasTOF()) { + histos.fill(HIST("hNsigmaTOF"), nSigmaTOF, track1.p(), occupancy, centrality); + } + if (applyPID) { + if (ispTdepPID && !selectionPIDpTdependent(track1, nSigmaTPC, nSigmaTOF)) { + continue; + } + if (!ispTdepPID && !selectionPID(track1, nSigmaTPC, nSigmaTOF)) { + continue; + } + } + histos.fill(HIST("hNsigmaTPCAfterCut"), nSigmaTPC, track1.p(), occupancy); + histos.fill(HIST("hNsigmaTOFAfterCut"), nSigmaTOF, track1.p(), occupancy); + if (track1.hasTOF()) { + histos.fill(HIST("hNsigmaKaonTOFTPC"), nSigmaTOF, nSigmaTPC, track1.p()); + } + Npostrack = Npostrack + 1; + + // 1) φ at a chosen radius (e.g., outer pad rows ~247 cm) + histos.fill(HIST("hPhiMommentum"), track1.phi(), track1.p(), occupancy); + + for (auto track2 : negThisColl) { + if (track1.sign() * track2.sign() > 0.0) { + continue; + } + if (!selectionTrack(track2)) { + continue; + } + if (Npostrack == 1) { + histos.fill(HIST("hdcaxy"), track2.dcaXY(), track2.p() / track2.sign()); + histos.fill(HIST("hdcaz"), track2.dcaZ(), track2.p() / track2.sign()); + } + double nSigmaTPC2 = track2.tpcNSigmaKa(); + double nSigmaTOF2 = track2.tofNSigmaKa(); + if (!track2.hasTOF()) { + nSigmaTOF2 = -9999.9; + } + if (cfgUpdatePID) { + // update PID + nSigmaTPC2 = (nSigmaTPC2 - hTPCCallib->GetBinContent(hTPCCallib->FindBin(track2.p(), centrality, occupancy))) / hTPCCallib->GetBinError(hTPCCallib->FindBin(track2.p(), centrality, occupancy)); + if (track2.hasTOF()) { + nSigmaTOF2 = (nSigmaTOF2 - hTOFCallib->GetBinContent(hTOFCallib->FindBin(track2.p(), centrality, occupancy))) / hTOFCallib->GetBinError(hTOFCallib->FindBin(track2.p(), centrality, occupancy)); + } + } + if (Npostrack == 1) { + if (track2.p() < 0.6) { + histos.fill(HIST("hNsigmaTPC"), nSigmaTPC2, track2.p(), occupancy, centrality); + } else if (track2.p() > 0.6 && track2.hasTOF() && std::abs(nSigmaTOF2) < 4.0) { + histos.fill(HIST("hNsigmaTPC"), nSigmaTPC2, track2.p(), occupancy, centrality); + } + if (track2.hasTOF()) { + histos.fill(HIST("hNsigmaTOF"), nSigmaTOF2, track2.p(), occupancy, centrality); + } + } + if (applyPID) { + if (ispTdepPID && !selectionPIDpTdependent(track2, nSigmaTPC2, nSigmaTOF2)) { + continue; + } + if (!ispTdepPID && !selectionPID(track2, nSigmaTPC2, nSigmaTOF2)) { + continue; + } + } + if (Npostrack == 1) { + histos.fill(HIST("hNsigmaTPCAfterCut"), nSigmaTPC2, track2.p(), occupancy); + histos.fill(HIST("hNsigmaTOFAfterCut"), nSigmaTOF2, track2.p(), occupancy); + if (track2.hasTOF()) { + histos.fill(HIST("hNsigmaKaonTOFTPC"), nSigmaTOF2, nSigmaTPC2, track2.p()); + } + } + if (Npostrack == 1) { + histos.fill(HIST("hPhiMommentum"), track2.phi(), track2.p(), occupancy); + } + auto track1ID = track1.globalIndex(); + auto track2ID = track2.globalIndex(); + if (track2ID == track1ID) { + continue; + } + if (!selectionPair(track1, track2)) { + continue; + } + bool crossed1 = keepTrackNoTPCBoundary(track1.phi(), 0.15, 18); + bool crossed2 = keepTrackNoTPCBoundary(track2.phi(), 0.15, 18); + float passsector = -999.0; + if (crossed1 && crossed2) { + passsector = 1.5; + } else { + passsector = 0.5; + } + + KaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); + KaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); + PhiMesonMother = KaonPlus + KaonMinus; + + if (TMath::Abs(PhiMesonMother.Rapidity()) < 0.5) { + histos.fill(HIST("hphiSE"), PhiMesonMother.M(), PhiMesonMother.Pt(), centrality, occupancy, passsector); + } + } + } + } + PROCESS_SWITCH(phispectrapbpbqa, processSameEvent, "Process Same event", true); + + void processMixedEventOpti(EventCandidates const& collisions, TrackCandidates const& tracks) + { + auto tracksTuple = std::make_tuple(tracks); + BinningTypeVertexContributor binningOnPositions{{axisVertex, cnfgaxis.configThnAxisCentrality, axisOccupancy}, true}; + SameKindPair pair{binningOnPositions, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; + for (auto& [collision1, tracks1, collision2, tracks2] : pair) { + if (!collision1.sel8() || !collision1.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision1.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision1.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !collision1.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) || !collision1.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + continue; + } + if (!collision2.sel8() || !collision2.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision2.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision2.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !collision2.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) || !collision2.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + continue; + } + int occupancy = collision1.trackOccupancyInTimeRange(); + auto centrality = collision1.centFT0C(); + for (auto& [track1, track2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { + if (track1.sign() * track2.sign() > 0) { + continue; + } + if (!selectionTrack(track1)) { + continue; + } + if (!selectionTrack(track2)) { + continue; + } + // PID track 1 + double nSigmaTPC = track1.tpcNSigmaKa(); + double nSigmaTOF = track1.tofNSigmaKa(); + if (!track1.hasTOF()) { + nSigmaTOF = -9999.99; + } + if (cfgUpdatePID) { + nSigmaTPC = (nSigmaTPC - hTPCCallib->GetBinContent(hTPCCallib->FindBin(track1.p(), centrality, occupancy))) / hTPCCallib->GetBinError(hTPCCallib->FindBin(track1.p(), centrality, occupancy)); + if (track1.hasTOF()) { + nSigmaTOF = (nSigmaTOF - hTOFCallib->GetBinContent(hTOFCallib->FindBin(track1.p(), centrality, occupancy))) / hTOFCallib->GetBinError(hTOFCallib->FindBin(track1.p(), centrality, occupancy)); + } + } + // PID track 2 + double nSigmaTPC2 = track2.tpcNSigmaKa(); + double nSigmaTOF2 = track2.tofNSigmaKa(); + if (!track2.hasTOF()) { + nSigmaTOF2 = -9999.99; + } + if (cfgUpdatePID) { + nSigmaTPC2 = (nSigmaTPC2 - hTPCCallib->GetBinContent(hTPCCallib->FindBin(track2.p(), centrality, occupancy))) / hTPCCallib->GetBinError(hTPCCallib->FindBin(track2.p(), centrality, occupancy)); + if (track2.hasTOF()) { + nSigmaTOF2 = (nSigmaTOF2 - hTOFCallib->GetBinContent(hTOFCallib->FindBin(track2.p(), centrality, occupancy))) / hTOFCallib->GetBinError(hTOFCallib->FindBin(track2.p(), centrality, occupancy)); + } + } + if (applyPID) { + if (ispTdepPID && !selectionPIDpTdependent(track1, nSigmaTPC, nSigmaTOF)) { + continue; + } + if (!ispTdepPID && !selectionPID(track1, nSigmaTPC, nSigmaTOF)) { + continue; + } + + if (ispTdepPID && !selectionPIDpTdependent(track2, nSigmaTPC2, nSigmaTOF2)) { + continue; + } + if (!ispTdepPID && !selectionPID(track2, nSigmaTPC2, nSigmaTOF2)) { + continue; + } + } + if (!selectionPair(track1, track2)) { + continue; + } + bool crossed1 = keepTrackNoTPCBoundary(track1.phi(), 0.15, 18); + bool crossed2 = keepTrackNoTPCBoundary(track2.phi(), 0.15, 18); + float passsector = -999.0; + if (crossed1 && crossed2) { + passsector = 1.5; + } else { + passsector = 0.5; + } + KaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); + KaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); + PhiMesonMother = KaonPlus + KaonMinus; + if (TMath::Abs(PhiMesonMother.Rapidity()) < 0.5) { + histos.fill(HIST("hphiME"), PhiMesonMother.M(), PhiMesonMother.Pt(), centrality, occupancy, passsector); + } + } + } + } + PROCESS_SWITCH(phispectrapbpbqa, processMixedEventOpti, "Process Mixed event new", true); + + void processMC(CollisionMCTrueTable::iterator const&, CollisionMCRecTableCentFT0C const& RecCollisions, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks) + { + histos.fill(HIST("hMC"), 0); + if (RecCollisions.size() == 0) { + histos.fill(HIST("hMC"), 1); + return; + } + if (RecCollisions.size() > 1) { + histos.fill(HIST("hMC"), 2); + return; + } + for (auto& RecCollision : RecCollisions) { + if (!RecCollision.sel8()) { + histos.fill(HIST("hMC"), 3); + continue; + } + if (!RecCollision.selection_bit(aod::evsel::kNoSameBunchPileup) || !RecCollision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !RecCollision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) || !RecCollision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + histos.fill(HIST("hMC"), 4); + continue; + } + if (TMath::Abs(RecCollision.posZ()) > cfgCutVertex) { + histos.fill(HIST("hMC"), 6); + continue; + } + + if (timeFrameMC && !RecCollision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + histos.fill(HIST("hMC"), 7); + continue; + } + if (readOutFrameMC && RecCollision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + histos.fill(HIST("hMC"), 8); + continue; + } + + histos.fill(HIST("hMC"), 9); + auto centrality = RecCollision.centFT0C(); + int occupancy = RecCollision.trackOccupancyInTimeRange(); + histos.fill(HIST("hOccupancy"), occupancy, centrality); + + auto oldindex = -999; + auto Rectrackspart = RecTracks.sliceBy(perCollision, RecCollision.globalIndex()); + // loop over reconstructed particle + for (auto track1 : Rectrackspart) { + if (!selectionTrack(track1)) { + continue; + } + if (!track1.has_mcParticle()) { + continue; + } + auto track1ID = track1.index(); + for (auto track2 : Rectrackspart) { + auto track2ID = track2.index(); + if (track2ID <= track1ID) { + continue; + } + if (!selectionTrack(track2)) { + continue; + } + if (!track2.has_mcParticle()) { + continue; + } + if (!selectionPair(track1, track2)) { + continue; + } + if (track1.sign() * track2.sign() > 0) { + continue; + } + // PID track 1 + double nSigmaTPC = track1.tpcNSigmaKa(); + double nSigmaTOF = track1.tofNSigmaKa(); + if (!track1.hasTOF()) { + nSigmaTOF = -9999.99; + } + if (cfgUpdatePID) { + nSigmaTPC = (nSigmaTPC - hTPCCallib->GetBinContent(hTPCCallib->FindBin(track1.p(), centrality, occupancy))) / hTPCCallib->GetBinError(hTPCCallib->FindBin(track1.p(), centrality, occupancy)); + if (track1.hasTOF()) { + nSigmaTOF = (nSigmaTOF - hTOFCallib->GetBinContent(hTOFCallib->FindBin(track1.p(), centrality, occupancy))) / hTOFCallib->GetBinError(hTOFCallib->FindBin(track1.p(), centrality, occupancy)); + } + } + // PID track 2 + double nSigmaTPC2 = track2.tpcNSigmaKa(); + double nSigmaTOF2 = track2.tofNSigmaKa(); + if (!track2.hasTOF()) { + nSigmaTOF2 = -9999.99; + } + if (cfgUpdatePID) { + nSigmaTPC2 = (nSigmaTPC2 - hTPCCallib->GetBinContent(hTPCCallib->FindBin(track2.p(), centrality, occupancy))) / hTPCCallib->GetBinError(hTPCCallib->FindBin(track2.p(), centrality, occupancy)); + if (track2.hasTOF()) { + nSigmaTOF2 = (nSigmaTOF2 - hTOFCallib->GetBinContent(hTOFCallib->FindBin(track2.p(), centrality, occupancy))) / hTOFCallib->GetBinError(hTOFCallib->FindBin(track2.p(), centrality, occupancy)); + } + } + if (applyPID) { + if (ispTdepPID && !selectionPIDpTdependent(track1, nSigmaTPC, nSigmaTOF)) { + continue; + } + if (!ispTdepPID && !selectionPID(track1, nSigmaTPC, nSigmaTOF)) { + continue; + } + + if (ispTdepPID && !selectionPIDpTdependent(track2, nSigmaTPC2, nSigmaTOF2)) { + continue; + } + if (!ispTdepPID && !selectionPID(track2, nSigmaTPC2, nSigmaTOF2)) { + continue; + } + } + + const auto mctrack1 = track1.mcParticle(); + const auto mctrack2 = track2.mcParticle(); + int track1PDG = TMath::Abs(mctrack1.pdgCode()); + int track2PDG = TMath::Abs(mctrack2.pdgCode()); + if (!mctrack1.isPhysicalPrimary()) { + continue; + } + if (!mctrack2.isPhysicalPrimary()) { + continue; + } + if (!(track1PDG == 321 && track2PDG == 321)) { + continue; + } + for (auto& mothertrack1 : mctrack1.mothers_as()) { + for (auto& mothertrack2 : mctrack2.mothers_as()) { + if (mothertrack1.pdgCode() != mothertrack2.pdgCode()) { + continue; + } + if (mothertrack1 != mothertrack2) { + continue; + } + if (TMath::Abs(mothertrack1.pdgCode()) != 333) { + continue; + } + if (avoidsplitrackMC && oldindex == mothertrack1.globalIndex()) { + histos.fill(HIST("h1PhiRecsplit"), mothertrack1.pt()); + continue; + } + oldindex = mothertrack1.globalIndex(); + bool crossed1 = keepTrackNoTPCBoundary(track1.phi(), 0.15, 18); + bool crossed2 = keepTrackNoTPCBoundary(track2.phi(), 0.15, 18); + float passsector = -999.0; + if (crossed1 && crossed2) { + passsector = 1.5; + } else { + passsector = 0.5; + } + KaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); + KaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); + PhiMesonMother = KaonPlus + KaonMinus; + if (TMath::Abs(PhiMesonMother.Rapidity()) < 0.5) { + histos.fill(HIST("hphiSE"), PhiMesonMother.M(), PhiMesonMother.Pt(), centrality, occupancy, passsector); + } + } + } + } + } + // loop over generated particle + for (auto& mcParticle : GenParticles) { + if (TMath::Abs(mcParticle.y()) > 0.5) { + continue; + } + if (mcParticle.pdgCode() != 333) { + continue; + } + auto kDaughters = mcParticle.daughters_as(); + if (kDaughters.size() != 2) { + continue; + } + auto daughtp = false; + auto daughtm = false; + for (auto kCurrentDaughter : kDaughters) { + if (!kCurrentDaughter.isPhysicalPrimary()) { + continue; + } + if (kCurrentDaughter.pdgCode() == +321) { + if (kCurrentDaughter.pt() > cfgCutPT && TMath::Abs(kCurrentDaughter.eta()) < cfgCutEta) { + daughtp = true; + } + KaonPlus = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massKa); + } else if (kCurrentDaughter.pdgCode() == -321) { + if (kCurrentDaughter.pt() > cfgCutPT && TMath::Abs(kCurrentDaughter.eta()) < cfgCutEta) { + daughtm = true; + } + KaonMinus = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massKa); + } + } + if (daughtp && daughtm) { + PhiMesonMother = KaonPlus + KaonMinus; + if (TMath::Abs(PhiMesonMother.Rapidity()) < 0.5) { + histos.fill(HIST("hphiGen"), PhiMesonMother.M(), PhiMesonMother.Pt(), centrality, occupancy); + } + } + } + } // rec collision loop + + } // process MC + PROCESS_SWITCH(phispectrapbpbqa, processMC, "Process MC", false); +}; +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc, TaskName{"phispectrapbpbqa"})}; +} diff --git a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx index 5db586eb880..3a350f5b6d0 100644 --- a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx @@ -68,10 +68,12 @@ struct lambdaspincorrderived { TH3D* hweight1; TH3D* hweight2; TH3D* hweight3; + TH3D* hweight4; Configurable ConfWeightPathLL{"ConfWeightPathLL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; Configurable ConfWeightPathALAL{"ConfWeightPathALAL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; Configurable ConfWeightPathLAL{"ConfWeightPathLAL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; + Configurable ConfWeightPathALL{"ConfWeightPathALL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; // event sel///////// Configurable centMin{"centMin", 0, "Minimum Centrality"}; @@ -121,18 +123,22 @@ struct lambdaspincorrderived { histos.add("hLambdaSameForLL", "hLambdaSameForLL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); histos.add("hLambdaSameForLAL", "hLambdaSameForLAL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); + histos.add("hLambdaSameForALL", "hLambdaSameForALL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); histos.add("hAntiLambdaSameForALAL", "hAntiLambdaSameForALAL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); histos.add("hLambdaMixForLL", "hLambdaMixForLL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); histos.add("hLambdaMixForLAL", "hLambdaMixForLAL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); + histos.add("hLambdaMixForALL", "hLambdaMixForALL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); histos.add("hAntiLambdaMixForALAL", "hAntiLambdaMixForALAL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); histos.add("hSparseLambdaLambda", "hSparseLambdaLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisCentrality, configThnAxisR}, true); histos.add("hSparseLambdaAntiLambda", "hSparseLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisCentrality, configThnAxisR}, true); + histos.add("hSparseAntiLambdaLambda", "hSparseAntiLambdLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisCentrality, configThnAxisR}, true); histos.add("hSparseAntiLambdaAntiLambda", "hSparseAntiLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisCentrality, configThnAxisR}, true); histos.add("hSparseLambdaLambdaMixed", "hSparseLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisCentrality, configThnAxisR}, true); histos.add("hSparseLambdaAntiLambdaMixed", "hSparseLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisCentrality, configThnAxisR}, true); + histos.add("hSparseAntiLambdaLambdaMixed", "hSparseAntiLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisCentrality, configThnAxisR}, true); histos.add("hSparseAntiLambdaAntiLambdaMixed", "hSparseAntiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisCentrality, configThnAxisR}, true); ccdb->setURL(cfgCcdbParam.cfgURL); @@ -142,8 +148,9 @@ struct lambdaspincorrderived { ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); LOGF(info, "Getting alignment offsets from the CCDB..."); hweight1 = ccdb->getForTimeStamp(ConfWeightPathLL.value, cfgCcdbParam.nolaterthan.value); - hweight2 = ccdb->getForTimeStamp(ConfWeightPathALAL.value, cfgCcdbParam.nolaterthan.value); - hweight3 = ccdb->getForTimeStamp(ConfWeightPathLAL.value, cfgCcdbParam.nolaterthan.value); + hweight2 = ccdb->getForTimeStamp(ConfWeightPathLAL.value, cfgCcdbParam.nolaterthan.value); + hweight3 = ccdb->getForTimeStamp(ConfWeightPathALL.value, cfgCcdbParam.nolaterthan.value); + hweight4 = ccdb->getForTimeStamp(ConfWeightPathALAL.value, cfgCcdbParam.nolaterthan.value); } template @@ -252,9 +259,12 @@ struct lambdaspincorrderived { if (tag1 == 0 && tag2 == 0) { histos.fill(HIST("hSparseLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR, mixpairweight); histos.fill(HIST("hLambdaSameForLL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), mixpairweight); - } else if ((tag1 == 0 && tag2 == 1) || (tag1 == 1 && tag2 == 0)) { + } else if (tag1 == 0 && tag2 == 1) { histos.fill(HIST("hSparseLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR, mixpairweight); histos.fill(HIST("hLambdaSameForLAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), mixpairweight); + } else if (tag1 == 1 && tag2 == 0) { + histos.fill(HIST("hSparseAntiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR, mixpairweight); + histos.fill(HIST("hLambdaSameForALL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), mixpairweight); } else if (tag1 == 1 && tag2 == 1) { histos.fill(HIST("hSparseAntiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR, mixpairweight); histos.fill(HIST("hAntiLambdaSameForALAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), mixpairweight); @@ -263,21 +273,26 @@ struct lambdaspincorrderived { double weight1 = mixpairweight; double weight2 = mixpairweight; double weight3 = mixpairweight; + double weight4 = mixpairweight; if (useweight) { weight1 = mixpairweight * hweight1->GetBinContent(hweight1->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic))); weight2 = mixpairweight * hweight2->GetBinContent(hweight2->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic))); weight3 = mixpairweight * hweight3->GetBinContent(hweight3->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic))); + weight4 = mixpairweight * hweight4->GetBinContent(hweight4->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic))); } histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity()); if (tag1 == 0 && tag2 == 0) { histos.fill(HIST("hSparseLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR, weight1); histos.fill(HIST("hLambdaMixForLL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), weight1); - } else if ((tag1 == 0 && tag2 == 1) || (tag1 == 1 && tag2 == 0)) { + } else if (tag1 == 0 && tag2 == 1) { histos.fill(HIST("hSparseLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR, weight2); histos.fill(HIST("hLambdaMixForLAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), weight2); + } else if (tag1 == 1 && tag2 == 0) { + histos.fill(HIST("hSparseAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR, weight3); + histos.fill(HIST("hLambdaMixForALL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), weight3); } else if (tag1 == 1 && tag2 == 1) { - histos.fill(HIST("hSparseAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR, weight3); - histos.fill(HIST("hAntiLambdaMixForALAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), weight3); + histos.fill(HIST("hSparseAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR, weight4); + histos.fill(HIST("hAntiLambdaMixForALAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), weight4); } } } @@ -325,7 +340,7 @@ struct lambdaspincorrderived { fillHistograms(0, 1, lambda, lambda2, proton, proton2, centrality, 0, 1.0); } if (v0.v0Status() == 1 && v02.v0Status() == 0) { - fillHistograms(1, 0, lambda2, lambda, proton2, proton, centrality, 0, 1.0); + fillHistograms(1, 0, lambda, lambda2, proton, proton2, centrality, 0, 1.0); } if (v0.v0Status() == 1 && v02.v0Status() == 1) { fillHistograms(1, 1, lambda, lambda2, proton, proton2, centrality, 0, 1.0); @@ -397,7 +412,7 @@ struct lambdaspincorrderived { fillHistograms(0, 1, lambda, lambda2, proton, proton2, centrality, 1, 1.0); } if (t3.v0Status() == 1 && t2.v0Status() == 0) { - fillHistograms(1, 0, lambda2, lambda, proton2, proton, centrality, 1, 1.0); + fillHistograms(1, 0, lambda, lambda2, proton, proton2, centrality, 1, 1.0); } if (t3.v0Status() == 1 && t2.v0Status() == 1) { fillHistograms(1, 1, lambda, lambda2, proton, proton2, centrality, 1, 1.0); @@ -477,7 +492,7 @@ struct lambdaspincorrderived { fillHistograms(0, 1, lambda, lambda2, proton, proton2, centrality, 1, invN); } if (t3.v0Status() == 1 && t2.v0Status() == 0) { - fillHistograms(1, 0, lambda2, lambda, proton2, proton, centrality, 1, invN); + fillHistograms(1, 0, lambda, lambda2, proton, proton2, centrality, 1, invN); } if (t3.v0Status() == 1 && t2.v0Status() == 1) { fillHistograms(1, 1, lambda, lambda2, proton, proton2, centrality, 1, invN); From 628457408a369c07fb3eb6b6741e6b071b1bd9a2 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Mon, 18 Aug 2025 01:11:30 +0200 Subject: [PATCH 087/986] [PWGEM/Dilepton] update skimmerPrimaryElectronQC.cxx (#12608) --- PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx index 8e3f8228299..c448464ceab 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx @@ -95,6 +95,7 @@ struct skimmerPrimaryElectronQC { struct : ConfigurableGroup { std::string prefix = "tighttrackcut"; + Configurable min_ncluster_tpc_pid{"min_ncluster_tpc_pid", 60, "min ncluster tpc used for PID"}; Configurable min_ncluster_tpc{"min_ncluster_tpc", 0, "min ncluster tpc"}; Configurable mincrossedrows{"mincrossedrows", 100, "min. crossed rows"}; Configurable min_ncluster_its{"min_ncluster_its", 5, "min ncluster its"}; @@ -392,6 +393,10 @@ struct skimmerPrimaryElectronQC { return false; } + if (track.tpcNClsPID() < tighttrackcut.min_ncluster_tpc_pid) { + return false; + } + mDcaInfoCov.set(999, 999, 999, 999, 999); auto trackParCov = getTrackParCov(track); trackParCov.setPID(o2::track::PID::Electron); From da6cc5fe67b3f357e5bfce08af2081dd9675b8bd Mon Sep 17 00:00:00 2001 From: omvazque Date: Mon, 18 Aug 2025 03:28:16 -0500 Subject: [PATCH 088/986] [PWGLF] Fixed naming conflict (#12609) --- PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx index 4316f393539..db3a65c374e 100644 --- a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx @@ -334,8 +334,6 @@ struct UccZdc { registry.add("NchvsOneParCorrGen", Form("MC Closure;%s;%s", tiNch, tiOneParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); registry.add("NchvsTwoParCorrGen", Form("MC Closure;%s;%s", tiNch, tiTwoParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); registry.add("NchvsThreeParCorrGen", Form("MC Closure;%s;%s", tiNch, tiThreeParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); - registry.add("NchVsTwoParCorr", Form("MC Closure;%s;%s", tiNch, tiTwoParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); - registry.add("NchVsThreeParCorr", Form("MC Closure;%s;%s", tiNch, tiThreeParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); // Corrections registry.add("zPosMC", "Filled at MC closure + Corrections;;Entries;", kTH1F, {axisZpos}); registry.add("hEventCounterMC", "Event counter", kTH1F, {axisEvent}); From 23c1fcfa9d343f0599abebe052480b5081d6c476 Mon Sep 17 00:00:00 2001 From: Jonghan Park <40240384+jpxrk@users.noreply.github.com> Date: Mon, 18 Aug 2025 18:45:04 +0900 Subject: [PATCH 089/986] [PWGHF] Add ITS chi2 requirement, TPC and ITS refit conditions (#12612) --- PWGHF/HFL/Tasks/taskSingleElectron.cxx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/PWGHF/HFL/Tasks/taskSingleElectron.cxx b/PWGHF/HFL/Tasks/taskSingleElectron.cxx index f57f5f1675a..12bf351c84d 100644 --- a/PWGHF/HFL/Tasks/taskSingleElectron.cxx +++ b/PWGHF/HFL/Tasks/taskSingleElectron.cxx @@ -82,6 +82,7 @@ struct HfTaskSingleElectron { Configurable tpcNClsFoundOverFindableMin{"tpcNClsFoundOverFindableMin", 0.8, "min # of TPC found/findable clusters"}; Configurable tpcChi2perNClMax{"tpcChi2perNClMax", 4., "min # of tpc chi2 per clusters"}; Configurable itsIBClsMin{"itsIBClsMin", 3, "min # of its clusters in IB"}; + Configurable itsChi2perNClMax{"itsChi2perNClMax", 6., "min # of tpc chi2 per clusters"}; Configurable dcaxyMax{"dcaxyMax", 1., "max of track dca in xy"}; Configurable dcazMax{"dcazMax", 2., "max of track dca in z"}; Configurable tofNSigmaMax{"tofNSigmaMax", 3., "max of tof nsigma"}; @@ -95,7 +96,7 @@ struct HfTaskSingleElectron { // using declarations using MyCollisions = soa::Join; - using TracksEl = soa::Join; + using TracksEl = soa::Join; using McTracksEl = soa::Join; // Filter @@ -131,6 +132,7 @@ struct HfTaskSingleElectron { histos.add("tpcFoundFindableTrack", "", kTH1D, {{10, 0, 1}}); histos.add("tpcChi2Track", "", kTH1D, {{100, 0, 10}}); histos.add("itsIBClsTrack", "", kTH1D, {{10, 0, 10}}); + histos.add("itsChi2Track", "", kTH1D, {{50, 0, 50}}); histos.add("dcaXYTrack", "", kTH1D, {{600, -3, 3}}); histos.add("dcaZTrack", "", kTH1D, {{600, -3, 3}}); @@ -168,9 +170,11 @@ struct HfTaskSingleElectron { if (track.tpcNClsCrossedRows() < tpcNCrossedRowMin) { return false; } + if (track.tpcCrossedRowsOverFindableCls() < tpcNClsFoundOverFindableMin) { return false; } + if (track.tpcChi2NCl() > tpcChi2perNClMax) { return false; } @@ -179,9 +183,14 @@ struct HfTaskSingleElectron { return false; } + if (track.itsChi2NCl() > itsChi2perNClMax) { + return false; + } + if (std::abs(track.dcaXY()) > dcaxyMax) { return false; } + if (std::abs(track.dcaZ()) > dcazMax) { return false; } @@ -405,6 +414,10 @@ struct HfTaskSingleElectron { continue; } + if (!(track.passedITSRefit() && track.passedTPCRefit())) { + continue; + } + histos.fill(HIST("etaTrack"), track.eta()); histos.fill(HIST("ptTrack"), track.pt()); @@ -412,6 +425,7 @@ struct HfTaskSingleElectron { histos.fill(HIST("tpcFoundFindableTrack"), track.tpcCrossedRowsOverFindableCls()); histos.fill(HIST("tpcChi2Track"), track.tpcChi2NCl()); histos.fill(HIST("itsIBClsTrack"), track.itsNClsInnerBarrel()); + histos.fill(HIST("itsChi2Track"), track.itsChi2NCl()); histos.fill(HIST("dcaXYTrack"), track.dcaXY()); histos.fill(HIST("dcaZTrack"), track.dcaZ()); From 03c3303106d7c68c453d09c6790ccc5d00ef59fa Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Mon, 18 Aug 2025 20:43:15 +0530 Subject: [PATCH 090/986] [PWGLF] Added ITSTPCMatching condition (#12613) Co-authored-by: Sawan Sawan --- PWGLF/Tasks/Resonances/kstarqa.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarqa.cxx b/PWGLF/Tasks/Resonances/kstarqa.cxx index e6e32885ad5..c2a721948ca 100644 --- a/PWGLF/Tasks/Resonances/kstarqa.cxx +++ b/PWGLF/Tasks/Resonances/kstarqa.cxx @@ -110,7 +110,7 @@ struct Kstarqa { Configurable cfgTPCChi2NClMax{"cfgTPCChi2NClMax", 4.0, "TPC Chi2/NCl"}; Configurable cfgTPCChi2NClMin{"cfgTPCChi2NClMin", 0.0, "TPC Chi2/NCl"}; Configurable cfgUseITSTPCRefit{"cfgUseITSTPCRefit", false, "Require ITS Refit"}; - // Configurable isVertexITSTPC{"isVertexITSTPC", false, "Vertex ITS TPC"}; + Configurable isVertexITSTPC{"isVertexITSTPC", false, "Vertex ITS TPC"}; Configurable isVertexTOFMatched{"isVertexTOFMatched", false, "Vertex TOF Matched"}; Configurable isNoCollInTimeRangeStandard{"isNoCollInTimeRangeStandard", false, "No collision in time range standard"}; Configurable isApplyPtDepDCAxyCut{"isApplyPtDepDCAxyCut", false, "Apply pT dependent DCAxy cut"}; @@ -440,9 +440,9 @@ struct Kstarqa { if (fillHist) rEventSelection.fill(HIST("hEventCut"), 11); - // if (selectionConfig.isVertexITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { - // return false; - // } + if (selectionConfig.isVertexITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + return false; + } if (fillHist) rEventSelection.fill(HIST("hEventCut"), 12); From 2ae7fe571058f92750d62e93b8b4de7dcc5f4272 Mon Sep 17 00:00:00 2001 From: prottayCMT <61418725+prottayCMT@users.noreply.github.com> Date: Mon, 18 Aug 2025 17:29:10 +0200 Subject: [PATCH 091/986] [PWGLF] detailed QA plots separately for lambda and antilambda (#12617) Co-authored-by: Prottay Das --- PWGLF/Tasks/Strangeness/lambdapolsp.cxx | 58 ++++++++++++++++++------- 1 file changed, 43 insertions(+), 15 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/lambdapolsp.cxx b/PWGLF/Tasks/Strangeness/lambdapolsp.cxx index b64a0e793b6..1399d4d293c 100644 --- a/PWGLF/Tasks/Strangeness/lambdapolsp.cxx +++ b/PWGLF/Tasks/Strangeness/lambdapolsp.cxx @@ -206,7 +206,11 @@ struct lambdapolsp { ConfigurableAxis axisDca{"axisDca", {100, -5, 5}, "dca axis"}; ConfigurableAxis axisLT{"axisLT", {50, 0, 50}, "lifetime axis"}; ConfigurableAxis axisCR{"axisCR", {40, 0, 200}, "CR axis"}; + ConfigurableAxis axisnsig{"axisnsig", {100, -10, 10}, "nsigma axis"}; + ConfigurableAxis axispt{"axispt", {100, 0, 10}, "pt axis"}; Configurable filldist{"filldist", true, "fill topo distr"}; + Configurable lowmasscut{"lowmasscut", 1.11, "low mass cut"}; + Configurable highmasscut{"highmasscut", 1.12, "high mass cut"}; } distGrp; RCTFlagsChecker rctChecker; @@ -399,15 +403,29 @@ struct lambdapolsp { } if (distGrp.filldist) { - histos.add("hcosine", "hcosine", HistType::kTH1D, {distGrp.axisCosine}, true); - histos.add("hdcabwv0daugh", "hdcabwv0daugh", HistType::kTH1D, {distGrp.axisDca}, true); - histos.add("hlifetime", "hlifetime", HistType::kTH1D, {distGrp.axisLT}, true); - histos.add("hradius", "hradius", HistType::kTH1D, {distGrp.axisRadius}, true); + histos.add("hcosinelambda", "hcosinelambda", HistType::kTH1D, {distGrp.axisCosine}, true); + histos.add("hdcabwv0daughlambda", "hdcabwv0daughlambda", HistType::kTH1D, {distGrp.axisDca}, true); + histos.add("hlifetimelambda", "hlifetimelambda", HistType::kTH1D, {distGrp.axisLT}, true); + histos.add("hradiuslambda", "hradiuslambda", HistType::kTH1D, {distGrp.axisRadius}, true); histos.add("hdcaposlambda", "hdcaposlambda", HistType::kTH1D, {distGrp.axisDca}, true); histos.add("hdcaneglambda", "hdcaneglambda", HistType::kTH1D, {distGrp.axisDca}, true); + histos.add("htpcCRlambda", "htpcCRlambda", HistType::kTH1D, {distGrp.axisCR}, true); + histos.add("htpcposlambda", "htpcposlambda", HistType::kTH1D, {distGrp.axisnsig}, true); + histos.add("htpcneglambda", "htpcneglambda", HistType::kTH1D, {distGrp.axisnsig}, true); + histos.add("hptposlambda", "hptposlambda", HistType::kTH1D, {distGrp.axispt}, true); + histos.add("hptneglambda", "hptneglambda", HistType::kTH1D, {distGrp.axispt}, true); + + histos.add("hcosineantilambda", "hcosineantilambda", HistType::kTH1D, {distGrp.axisCosine}, true); + histos.add("hdcabwv0daughantilambda", "hdcabwv0daughantilambda", HistType::kTH1D, {distGrp.axisDca}, true); + histos.add("hlifetimeantilambda", "hlifetimeantilambda", HistType::kTH1D, {distGrp.axisLT}, true); + histos.add("hradiusantilambda", "hradiusantilambda", HistType::kTH1D, {distGrp.axisRadius}, true); histos.add("hdcaposantilambda", "hdcaposantilambda", HistType::kTH1D, {distGrp.axisDca}, true); histos.add("hdcanegantilambda", "hdcanegantilambda", HistType::kTH1D, {distGrp.axisDca}, true); - histos.add("htpcCR", "htpcCR", HistType::kTH1D, {distGrp.axisCR}, true); + histos.add("htpcCRantilambda", "htpcCRantilambda", HistType::kTH1D, {distGrp.axisCR}, true); + histos.add("htpcposantilambda", "htpcposantilambda", HistType::kTH1D, {distGrp.axisnsig}, true); + histos.add("htpcnegantilambda", "htpcnegantilambda", HistType::kTH1D, {distGrp.axisnsig}, true); + histos.add("hptposantilambda", "hptposantilambda", HistType::kTH1D, {distGrp.axispt}, true); + histos.add("hptnegantilambda", "hptnegantilambda", HistType::kTH1D, {distGrp.axispt}, true); } ccdb->setURL(cfgCcdbParam.cfgURL); @@ -1168,23 +1186,24 @@ struct lambdapolsp { } } else { - if (distGrp.filldist) { - histos.fill(HIST("hcosine"), v0.v0cosPA()); - histos.fill(HIST("hdcabwv0daugh"), v0.dcaV0daughters()); - histos.fill(HIST("hlifetime"), TMath::Abs(v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * massLambda)); - histos.fill(HIST("hradius"), v0.v0radius()); - histos.fill(HIST("htpcCR"), postrack.tpcNClsCrossedRows()); - } - if (LambdaTag) { Lambda = Proton + AntiPion; tagb = 0; int binx = accprofileL->GetXaxis()->FindBin(v0.eta()); int biny = accprofileL->GetYaxis()->FindBin(v0.pt()); double acvalue = accprofileL->GetBinContent(binx, biny); - if (distGrp.filldist) { + if (distGrp.filldist && aLambdaTag == 0 && Lambda.M() > distGrp.lowmasscut && Lambda.M() < distGrp.highmasscut) { + histos.fill(HIST("hcosinelambda"), v0.v0cosPA()); + histos.fill(HIST("hdcabwv0daughlambda"), v0.dcaV0daughters()); + histos.fill(HIST("hlifetimelambda"), TMath::Abs(v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * massLambda)); + histos.fill(HIST("hradiuslambda"), v0.v0radius()); + histos.fill(HIST("htpcCRlambda"), postrack.tpcNClsCrossedRows()); histos.fill(HIST("hdcaposlambda"), v0.dcapostopv()); histos.fill(HIST("hdcaneglambda"), v0.dcanegtopv()); + histos.fill(HIST("htpcposlambda"), postrack.tpcNSigmaPr()); + histos.fill(HIST("htpcneglambda"), negtrack.tpcNSigmaPi()); + histos.fill(HIST("hptposlambda"), Proton.Pt()); + histos.fill(HIST("hptneglambda"), AntiPion.Pt()); } fillHistograms(taga, tagb, Lambda, Proton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mLambda(), v0.pt(), v0.eta(), acvalue, 1.0); } @@ -1196,9 +1215,18 @@ struct lambdapolsp { int binx = accprofileAL->GetXaxis()->FindBin(v0.eta()); int biny = accprofileAL->GetYaxis()->FindBin(v0.pt()); double acvalue = accprofileAL->GetBinContent(binx, biny); - if (distGrp.filldist) { + if (distGrp.filldist && LambdaTag == 0 && AntiLambda.M() > distGrp.lowmasscut && AntiLambda.M() < distGrp.highmasscut) { + histos.fill(HIST("hcosineantilambda"), v0.v0cosPA()); + histos.fill(HIST("hdcabwv0daughantilambda"), v0.dcaV0daughters()); + histos.fill(HIST("hlifetimeantilambda"), TMath::Abs(v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * massLambda)); + histos.fill(HIST("hradiusantilambda"), v0.v0radius()); + histos.fill(HIST("htpcCRantilambda"), postrack.tpcNClsCrossedRows()); histos.fill(HIST("hdcaposantilambda"), v0.dcapostopv()); histos.fill(HIST("hdcanegantilambda"), v0.dcanegtopv()); + histos.fill(HIST("htpcposantilambda"), postrack.tpcNSigmaPi()); + histos.fill(HIST("htpcnegantilambda"), negtrack.tpcNSigmaPr()); + histos.fill(HIST("hptposantilambda"), Pion.Pt()); + histos.fill(HIST("hptnegantilambda"), AntiProton.Pt()); } fillHistograms(taga, tagb, AntiLambda, AntiProton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mAntiLambda(), v0.pt(), v0.eta(), acvalue, wgtvalue); } From 41e44e10f0ddcfe7f62931bed2bcc6322742450c Mon Sep 17 00:00:00 2001 From: Marvin Hemmer <53471402+mhemmer-cern@users.noreply.github.com> Date: Mon, 18 Aug 2025 18:31:00 +0200 Subject: [PATCH 092/986] =?UTF-8?q?[PWGEM,PWGEM-36]=20skimmerGammaCalo:=20?= =?UTF-8?q?Fix=20processMC=20processRec=20cut=20diffe=E2=80=A6=20(#12618)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx index 0de9fee8f62..731a9ed9331 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx @@ -175,6 +175,10 @@ struct SkimmerGammaCalo { return; } + if (needEMCTrigger.value && !collision.alias_bit(kTVXinEMC)) { + return; + } + for (const auto& emccluster : emcclusters) { // Definition cut From 95d1efe3562f0003e04d6f36652aceed27aa20f2 Mon Sep 17 00:00:00 2001 From: Katarzyna <116073883+kgwizdzi@users.noreply.github.com> Date: Mon, 18 Aug 2025 20:19:57 +0200 Subject: [PATCH 093/986] [PWGCF] FemtoUniverse: update in the MC functions for D0s (#12619) --- .../femtoUniverseProducerMCTruthTask.cxx | 12 +- .../femtoUniverseProducerTask.cxx | 94 ++++------ .../Tasks/femtoUniversePairTaskTrackD0.cxx | 8 +- ...femtoUniversePairTaskTrackTrackMcTruth.cxx | 162 +++++++++--------- 4 files changed, 126 insertions(+), 150 deletions(-) diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerMCTruthTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerMCTruthTask.cxx index 9ab5dcecd68..83c197ea0ad 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerMCTruthTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerMCTruthTask.cxx @@ -19,6 +19,7 @@ #include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" #include "Common/CCDB/TriggerAliases.h" +#include "Common/Core/RecoDecay.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" @@ -171,10 +172,10 @@ struct FemtoUniverseProducerMCTruthTask { if (confAnalysisWithPID) { bool pass = false; std::vector tmpPDGCodes = confPDGCodes; // necessary due to some features of the Configurable - for (const int& pdg : tmpPDGCodes) { + for (auto const& pdg : tmpPDGCodes) { if (pdgCode == Pdg::kPhi) { // phi meson pass = true; - } else if (pdgCode == Pdg::kD0) { // D0 meson + } else if (std::abs(pdgCode) == Pdg::kD0) { // D0(bar) meson pass = true; } else if (pdgCode == Pdg::kDPlus) { // D+ meson pass = true; @@ -187,6 +188,13 @@ struct FemtoUniverseProducerMCTruthTask { continue; } + /// check if we end-up with the correct final state using MC info + int8_t sign = 0; + if (std::abs(pdgCode) == Pdg::kD0 && !RecoDecay::isMatchedMCGen(tracks, particle, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &sign)) { + /// check if we have D0(bar) → π± K∓ + continue; + } + // we cannot use isSelectedMinimal since it takes Ncls // if (!trackCuts.isSelectedMinimal(track)) { // continue; diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx index bf16f78ba14..d4cdefecf3b 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx @@ -328,10 +328,7 @@ struct FemtoUniverseProducerTask { // D0/D0bar mesons struct : o2::framework::ConfigurableGroup { - Configurable confD0D0barCandMaxY{"confD0D0barCandMaxY", -1., "max. cand. rapidity"}; Configurable confD0D0barCandEtaCut{"confD0D0barCandEtaCut", 0.8, "max. cand. pseudorapidity"}; - Configurable yD0D0barCandRecoMax{"yD0D0barCandRecoMax", 0.8, "MC Reco, max. rapidity of D0/D0bar cand."}; - Configurable yD0D0barCandGenMax{"yD0D0barCandGenMax", 0.8, "MC Truth, max. rapidity of D0/D0bar cand."}; Configurable trackD0pTGenMin{"trackD0pTGenMin", 0.0, "MC Truth, min. pT for tracks and D0/D0bar cand."}; Configurable trackD0pTGenMax{"trackD0pTGenMax", 24.0, "MC Truth, max. pT for tracks and D0/D0bar cand."}; Configurable storeD0D0barDoubleMassHypo{"storeD0D0barDoubleMassHypo", false, "Store D0/D0bar cand. which pass selection criteria for both, D0 and D0bar"}; @@ -1357,10 +1354,6 @@ struct FemtoUniverseProducerTask { continue; } - if (ConfD0Selection.confD0D0barCandMaxY >= 0. && std::abs(hfHelper.yD0(hfCand)) > ConfD0Selection.confD0D0barCandMaxY) { - continue; - } - if (std::abs(hfCand.eta()) > ConfD0Selection.confD0D0barCandEtaCut) { continue; } @@ -1480,10 +1473,6 @@ struct FemtoUniverseProducerTask { continue; } - if (ConfD0Selection.confD0D0barCandMaxY >= 0. && std::abs(hfHelper.yD0(hfCand)) > ConfD0Selection.confD0D0barCandMaxY) { - continue; - } - if (std::abs(hfCand.eta()) > ConfD0Selection.confD0D0barCandEtaCut) { continue; } @@ -1610,10 +1599,6 @@ struct FemtoUniverseProducerTask { continue; } - if (ConfD0Selection.confD0D0barCandMaxY >= 0. && std::abs(hfHelper.yD0(hfCand)) > ConfD0Selection.confD0D0barCandMaxY) { - continue; - } - if (std::abs(hfCand.eta()) > ConfD0Selection.confD0D0barCandEtaCut) { continue; } @@ -1997,20 +1982,18 @@ struct FemtoUniverseProducerTask { } template - void fillMCTruthParticlesD0(TrackType const& mcParts, std::optional>> recoMcIds = std::nullopt) + void fillMCTruthParticlesD0(TrackType const& mcParts) { std::vector childIDs = {0, 0}; // these IDs are necessary to keep track of the children std::vector tmpIDtrack; - float ptGenB = -1; for (const auto& particle : mcParts) { - if (particle.eta() < -ConfFilterCuts.confEtaFilterCut || particle.eta() > ConfFilterCuts.confEtaFilterCut) continue; if (particle.pt() < ConfD0Selection.trackD0pTGenMin || particle.pt() > ConfD0Selection.trackD0pTGenMax) continue; - uint32_t pdgCode = static_cast(particle.pdgCode()); + int pdgCode = particle.pdgCode(); if (ConfGeneral.confMCTruthAnalysisWithPID) { bool pass = false; @@ -2019,10 +2002,10 @@ struct FemtoUniverseProducerTask { if (static_cast(pdg) == static_cast(pdgCode)) { if (pdgCode == Pdg::kPhi) { pass = true; - } else if (pdgCode == Pdg::kD0) { + } else if (std::abs(pdgCode) == Pdg::kD0) { pass = true; } else { - if (particle.isPhysicalPrimary() || (ConfGeneral.confActivateSecondaries && recoMcIds && recoMcIds->get().contains(particle.globalIndex()))) + if (particle.isPhysicalPrimary()) pass = true; } } @@ -2031,41 +2014,31 @@ struct FemtoUniverseProducerTask { continue; } - if (pdgCode == Pdg::kD0) { - if (std::abs(particle.flagMcMatchGen()) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { - if (ConfD0Selection.yD0D0barCandGenMax >= 0. && std::abs(RecoDecay::y(particle.pVector(), o2::constants::physics::MassD0)) > ConfD0Selection.yD0D0barCandGenMax) { - continue; - } - if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { - ptGenB = -1; - } else { - ptGenB = mcParts.rawIteratorAt(particle.idxBhadMotherPart()).pt(); - } - outputParts(outputCollision.lastIndex(), - particle.pt(), - particle.eta(), - particle.phi(), - aod::femtouniverseparticle::ParticleType::kMCTruthTrack, - -999., - pdgCode, - pdgCode, // getter tempFitVar - childIDs, - particle.flagMcMatchGen(), - ptGenB); // pT of the B hadron (mother particle, only when non-prompt D0) - } - } else { - outputParts(outputCollision.lastIndex(), - particle.pt(), - particle.eta(), - particle.phi(), - aod::femtouniverseparticle::ParticleType::kMCTruthTrack, - -999., - pdgCode, - pdgCode, - childIDs, - -999., - -999.); + /// check if we end-up with the correct final state using MC info + int8_t sign = 0; + int8_t origin = -99; + int8_t mcGenFlag = -99; + if (std::abs(particle.pdgCode()) == Pdg::kD0 && !RecoDecay::isMatchedMCGen(mcParts, particle, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &sign)) { + /// check if we have D0(bar) → π± K∓ + continue; + } + if (std::abs(particle.pdgCode()) == Pdg::kD0) { + origin = RecoDecay::getCharmHadronOrigin(mcParts, particle); + mcGenFlag = particle.flagMcMatchGen(); } + + outputParts(outputCollision.lastIndex(), + particle.pt(), + particle.eta(), + particle.phi(), + aod::femtouniverseparticle::ParticleType::kMCTruthTrack, + -999., + pdgCode, + pdgCode, // getter tempFitVar + childIDs, + mcGenFlag, + origin); // D0(bar) origin + if (confIsDebug) { fillDebugParticle(particle); } @@ -2074,7 +2047,7 @@ struct FemtoUniverseProducerTask { // aligned, so that they can be joined in the task. if constexpr (transientLabels) { outputPartsMCLabels(-1); - outputDebugPartsMC(9999); + outputDebugPartsMC(-999); } } } @@ -2534,7 +2507,6 @@ struct FemtoUniverseProducerTask { aod::McParticles const& mcParts) { // MC Reco - std::set recoMcIds; for (const auto& col : collisions) { auto groupedTracks = tracks.sliceBy(perCollisionTracks, col.globalIndex()); auto groupedD0s = hfMcRecoCands.sliceBy(perCollisionD0s, col.globalIndex()); @@ -2545,18 +2517,14 @@ struct FemtoUniverseProducerTask { if (colcheck) { fillTracks(groupedTracks); fillD0D0barMcMl(col, groupedTracks, groupedD0s, mcParts); - for (const auto& track : groupedTracks) { - if (trackCuts.isSelectedMinimal(track)) - recoMcIds.insert(track.mcParticleId()); - } } } // MC Truth for (const auto& mccol : mccols) { auto groupedMCParticles = hfMcGenCands.sliceBy(mcPartPerMcColl, mccol.globalIndex()); auto groupedCollisions = collisions.sliceBy(recoCollsPerMCColl, mccol.globalIndex()); - fillMCTruthCollisions(groupedCollisions, groupedMCParticles); // fills the reco collisions for mc collision - fillMCTruthParticlesD0(groupedMCParticles, recoMcIds); // fills mc particles + fillMCTruthCollisions(groupedCollisions, groupedMCParticles); // fills the reco collisions for mc collision + fillMCTruthParticlesD0(groupedMCParticles); // fills mc particles } } PROCESS_SWITCH(FemtoUniverseProducerTask, processTrackD0MC, "Provide MC data for track D0 analysis", false); diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx index 9075414cab1..698865577b1 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx @@ -1252,9 +1252,9 @@ struct FemtoUniversePairTaskTrackD0 { if (pdgCode == o2::constants::physics::Pdg::kD0) { if (std::abs(hfFlagMcGen) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { mcTruthRegistry.fill(HIST("hMcGenD0"), part.pt(), part.eta()); - if (part.mAntiLambda() > 0) { + if (part.mAntiLambda() == 1) { mcTruthRegistry.fill(HIST("hMcGenD0Prompt"), part.pt(), part.eta()); - } else { + } else if (part.mAntiLambda() == 2) { mcTruthRegistry.fill(HIST("hMcGenD0NonPrompt"), part.pt(), part.eta()); } } @@ -1278,9 +1278,9 @@ struct FemtoUniversePairTaskTrackD0 { if (pdgCode == o2::constants::physics::Pdg::kD0Bar) { if (std::abs(hfFlagMcGen) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { mcTruthRegistry.fill(HIST("hMcGenD0bar"), part.pt(), part.eta()); - if (part.mAntiLambda() > 0) { + if (part.mAntiLambda() == 1) { mcTruthRegistry.fill(HIST("hMcGenD0barPrompt"), part.pt(), part.eta()); - } else { + } else if (part.mAntiLambda() == 2) { mcTruthRegistry.fill(HIST("hMcGenD0barNonPrompt"), part.pt(), part.eta()); } } diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMcTruth.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMcTruth.cxx index d74b76ab237..a678a6a078e 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMcTruth.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMcTruth.cxx @@ -14,24 +14,24 @@ /// \author Malgorzata Janik, WUT, majanik@cern.ch /// \author Zuzanna Chochulska, WUT Warsaw & CTU Prague, zchochul@cern.ch -#include -#include +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseContainer.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniversePairCleaner.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h" +#include "PWGCF/FemtoUniverse/Core/femtoUtils.h" +#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" + +#include "Framework/ASoAHelpers.h" #include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" #include "Framework/HistogramRegistry.h" -#include "Framework/ASoAHelpers.h" +#include "Framework/O2DatabasePDGPlugin.h" #include "Framework/RunningWorkflowInfo.h" #include "Framework/StepTHn.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "TDatabasePDG.h" +#include "Framework/runDataProcessing.h" -#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniversePairCleaner.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseContainer.h" -#include "PWGCF/FemtoUniverse/Core/femtoUtils.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h" +#include +#include using namespace o2; using namespace o2::analysis::femto_universe; @@ -39,39 +39,39 @@ using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::soa; -struct femtoUniversePairTaskTrackTrackMcTruth { +struct FemtoUniversePairTaskTrackTrackMcTruth { SliceCache cache; Preslice perCol = aod::femtouniverseparticle::fdCollisionId; /// Particle selection part /// Configurables for both particles - Configurable ConfUse3D{"ConfUse3D", false, "Enable three dimensional histogramms (to be used only for analysis with high statistics): k* vs mT vs multiplicity"}; - Configurable ConfEtaMax{"ConfEtaMax", 0.8f, "Higher limit for |Eta| (the same for both particles)"}; + Configurable confUse3D{"confUse3D", false, "Enable three dimensional histogramms (to be used only for analysis with high statistics): k* vs mT vs multiplicity"}; + Configurable confEtaMax{"confEtaMax", 0.8f, "Higher limit for |Eta| (the same for both particles)"}; /// Particle 1 - Configurable ConfPDGCodePartOne{"ConfPDGCodePartOne", 2212, "Particle 1 - PDG code"}; - Configurable ConfNoPDGPartOne{"ConfNoPDGPartOne", false, "0: selecting part by PDG, 1: no PID selection"}; - Configurable ConfPtLowPart1{"ConfPtLowPart1", 0.2, "Lower limit for Pt for the first particle"}; - Configurable ConfPtHighPart1{"ConfPtHighPart1", 2.5, "Higher limit for Pt for the first particle"}; + Configurable confPDGCodePartOne{"confPDGCodePartOne", 2212, "Particle 1 - PDG code"}; + Configurable confNoPDGPartOne{"confNoPDGPartOne", false, "0: selecting part by PDG, 1: no PID selection"}; + Configurable confPtLowPart1{"confPtLowPart1", 0.2, "Lower limit for Pt for the first particle"}; + Configurable confPtHighPart1{"confPtHighPart1", 2.5, "Higher limit for Pt for the first particle"}; /// Partition for particle 1 Partition partsOne = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && - (aod::femtouniverseparticle::pt < ConfPtHighPart1) && (aod::femtouniverseparticle::pt > ConfPtLowPart1) && (nabs(aod::femtouniverseparticle::eta) < ConfEtaMax); + (aod::femtouniverseparticle::pt < confPtHighPart1) && (aod::femtouniverseparticle::pt > confPtLowPart1) && (nabs(aod::femtouniverseparticle::eta) < confEtaMax); /// Histogramming for particle 1 FemtoUniverseParticleHisto trackHistoPartOne; /// Particle 2 - Configurable ConfIsSame{"ConfIsSame", false, "Pairs of the same particle"}; - Configurable ConfPDGCodePartTwo{"ConfPDGCodePartTwo", 333, "Particle 2 - PDG code"}; - Configurable ConfNoPDGPartTwo{"ConfNoPDGPartTwo", false, "0: selecting part by PDG, 1: no PID selection"}; - Configurable ConfPtLowPart2{"ConfPtLowPart2", 0.2, "Lower limit for Pt for the second particle"}; - Configurable ConfPtHighPart2{"ConfPtHighPart2", 2.5, "Higher limit for Pt for the second particle"}; + Configurable confIsSame{"confIsSame", false, "Pairs of the same particle"}; + Configurable confPDGCodePartTwo{"confPDGCodePartTwo", 333, "Particle 2 - PDG code"}; + Configurable confNoPDGPartTwo{"confNoPDGPartTwo", false, "0: selecting part by PDG, 1: no PID selection"}; + Configurable confPtLowPart2{"confPtLowPart2", 0.2, "Lower limit for Pt for the second particle"}; + Configurable confPtHighPart2{"confPtHighPart2", 2.5, "Higher limit for Pt for the second particle"}; /// Partition for particle 2 Partition partsTwo = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && - (aod::femtouniverseparticle::pt < ConfPtHighPart2) && (aod::femtouniverseparticle::pt > ConfPtLowPart2) && (nabs(aod::femtouniverseparticle::eta) < ConfEtaMax); + (aod::femtouniverseparticle::pt < confPtHighPart2) && (aod::femtouniverseparticle::pt > confPtLowPart2) && (nabs(aod::femtouniverseparticle::eta) < confEtaMax); /// Histogramming for particle 2 FemtoUniverseParticleHisto trackHistoPartTwo; @@ -84,27 +84,27 @@ struct femtoUniversePairTaskTrackTrackMcTruth { std::vector kNsigma; /// particle part - ConfigurableAxis ConfTempFitVarpTBins{"ConfTempFitVarpTBins", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot"}; - ConfigurableAxis ConfTempFitVarPDGBins{"ConfDTempFitVarInvMassBins", {6000, -2300, 2300}, "binning of the TempFitVar in the pT vs. TempFitVar plot"}; + ConfigurableAxis confTempFitVarpTBins{"confTempFitVarpTBins", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot"}; + ConfigurableAxis confTempFitVarPDGBins{"confTempFitVarPDGBins", {6000, -2300, 2300}, "binning of the TempFitVar in the pT vs. TempFitVar plot"}; /// Correlation part - ConfigurableAxis ConfMultBins{"ConfMultBins", {VARIABLE_WIDTH, 0.0f, 4.0f, 8.0f, 12.0f, 16.0f, 20.0f, 24.0f, 28.0f, 32.0f, 36.0f, 40.0f, 44.0f, 48.0f, 52.0f, 56.0f, 60.0f, 64.0f, 68.0f, 72.0f, 76.0f, 80.0f, 84.0f, 88.0f, 92.0f, 96.0f, 100.0f, 200.0f, 99999.f}, "Mixing bins - multiplicity"}; // \todo to be obtained from the hash task - // ConfigurableAxis ConfMultBins{"CfgMultBins", {VARIABLE_WIDTH, 0.0f, 20.0f, 40.0f, 60.0f, 80.0f, 100.0f, 200.0f, 99999.f}, "Mixing bins - multiplicity"}; - ConfigurableAxis ConfVtxBins{"ConfVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; + ConfigurableAxis confMultBins{"confMultBins", {VARIABLE_WIDTH, 0.0f, 4.0f, 8.0f, 12.0f, 16.0f, 20.0f, 24.0f, 28.0f, 32.0f, 36.0f, 40.0f, 44.0f, 48.0f, 52.0f, 56.0f, 60.0f, 64.0f, 68.0f, 72.0f, 76.0f, 80.0f, 84.0f, 88.0f, 92.0f, 96.0f, 100.0f, 200.0f, 99999.f}, "Mixing bins - multiplicity"}; // \todo to be obtained from the hash task + // ConfigurableAxis confMultBins{"CfgMultBins", {VARIABLE_WIDTH, 0.0f, 20.0f, 40.0f, 60.0f, 80.0f, 100.0f, 200.0f, 99999.f}, "Mixing bins - multiplicity"}; + ConfigurableAxis confVtxBins{"confVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; - ConfigurableAxis ConfmTBins3D{"ConfmTBins3D", {VARIABLE_WIDTH, 1.02f, 1.14f, 1.20f, 1.26f, 1.38f, 1.56f, 1.86f, 4.50f}, "mT Binning for the 3Dimensional plot: k* vs multiplicity vs mT (set <> to true in order to use)"}; - ConfigurableAxis ConfmultBins3D{"ConfmultBins3D", {VARIABLE_WIDTH, 0.0f, 20.0f, 30.0f, 40.0f, 99999.0f}, "multiplicity Binning for the 3Dimensional plot: k* vs multiplicity vs mT (set <> to true in order to use)"}; + ConfigurableAxis confmTBins3D{"confmTBins3D", {VARIABLE_WIDTH, 1.02f, 1.14f, 1.20f, 1.26f, 1.38f, 1.56f, 1.86f, 4.50f}, "mT Binning for the 3Dimensional plot: k* vs multiplicity vs mT (set <> to true in order to use)"}; + ConfigurableAxis confMultBins3D{"confMultBins3D", {VARIABLE_WIDTH, 0.0f, 20.0f, 30.0f, 40.0f, 99999.0f}, "multiplicity Binning for the 3Dimensional plot: k* vs multiplicity vs mT (set <> to true in order to use)"}; - ColumnBinningPolicy colBinning{{ConfVtxBins, ConfMultBins}, true}; + ColumnBinningPolicy colBinning{{confVtxBins, confMultBins}, true}; - ConfigurableAxis ConfkstarBins{"ConfkstarBins", {1500, 0., 6.}, "binning kstar"}; - ConfigurableAxis ConfkTBins{"ConfkTBins", {150, 0., 9.}, "binning kT"}; - ConfigurableAxis ConfmTBins{"ConfmTBins", {225, 0., 7.5}, "binning mT"}; - Configurable ConfNEventsMix{"ConfNEventsMix", 5, "Number of events for mixing"}; - Configurable ConfIsCPR{"ConfIsCPR", true, "Close Pair Rejection"}; - Configurable ConfCPRPlotPerRadii{"ConfCPRPlotPerRadii", false, "Plot CPR per radii"}; - Configurable ConfPhiBins{"ConfPhiBins", 29, "Number of phi bins in deta dphi"}; - Configurable ConfEtaBins{"ConfEtaBins", 29, "Number of eta bins in deta dphi"}; + ConfigurableAxis confkstarBins{"confkstarBins", {1500, 0., 6.}, "binning kstar"}; + ConfigurableAxis confkTBins{"confkTBins", {150, 0., 9.}, "binning kT"}; + ConfigurableAxis confmTBins{"confmTBins", {225, 0., 7.5}, "binning mT"}; + Configurable confNEventsMix{"confNEventsMix", 5, "Number of events for mixing"}; + Configurable confIsCPR{"confIsCPR", true, "Close Pair Rejection"}; + Configurable confCPRPlotPerRadii{"confCPRPlotPerRadii", false, "Plot CPR per radii"}; + Configurable confPhiBins{"confPhiBins", 29, "Number of phi bins in deta dphi"}; + Configurable confEtaBins{"confEtaBins", 29, "Number of eta bins in deta dphi"}; FemtoUniverseContainer sameEventCont; FemtoUniverseContainer mixedEventCont; @@ -112,7 +112,7 @@ struct femtoUniversePairTaskTrackTrackMcTruth { /// Histogram output HistogramRegistry qaRegistry{"TrackQA", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry resultRegistry{"Correlations", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry MixQaRegistry{"MixQaRegistry", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry mixQaRegistry{"mixQaRegistry", {}, OutputObjHandlingPolicy::AnalysisObject}; /// @brief Counter for particle swapping int fNeventsProcessed = 0; @@ -121,25 +121,25 @@ struct femtoUniversePairTaskTrackTrackMcTruth { { eventHisto.init(&qaRegistry); - trackHistoPartOne.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarPDGBins, 0, ConfPDGCodePartOne, false); - if (!ConfIsSame) { - trackHistoPartTwo.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarPDGBins, 0, ConfPDGCodePartTwo, false); + trackHistoPartOne.init(&qaRegistry, confTempFitVarpTBins, confTempFitVarPDGBins, 0, confPDGCodePartOne, false); + if (!confIsSame) { + trackHistoPartTwo.init(&qaRegistry, confTempFitVarpTBins, confTempFitVarPDGBins, 0, confPDGCodePartTwo, false); } - MixQaRegistry.add("MixingQA/hSECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); - MixQaRegistry.add("MixingQA/hMECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); + mixQaRegistry.add("MixingQA/hSECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); + mixQaRegistry.add("MixingQA/hMECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); - sameEventCont.init(&resultRegistry, ConfkstarBins, ConfMultBins, ConfkTBins, ConfmTBins, ConfmultBins3D, ConfmTBins3D, ConfEtaBins, ConfPhiBins, 0, ConfUse3D); - mixedEventCont.init(&resultRegistry, ConfkstarBins, ConfMultBins, ConfkTBins, ConfmTBins, ConfmultBins3D, ConfmTBins3D, ConfEtaBins, ConfPhiBins, 0, ConfUse3D); - sameEventCont.setPDGCodes(ConfPDGCodePartOne, ConfPDGCodePartTwo); - mixedEventCont.setPDGCodes(ConfPDGCodePartOne, ConfPDGCodePartTwo); + sameEventCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, 0, confUse3D); + mixedEventCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, 0, confUse3D); + sameEventCont.setPDGCodes(confPDGCodePartOne, confPDGCodePartTwo); + mixedEventCont.setPDGCodes(confPDGCodePartOne, confPDGCodePartTwo); pairCleaner.init(&qaRegistry); } template void fillCollision(CollisionType col) { - MixQaRegistry.fill(HIST("MixingQA/hSECollisionBins"), colBinning.getBin({col.posZ(), col.multNtr()})); + mixQaRegistry.fill(HIST("MixingQA/hSECollisionBins"), colBinning.getBin({col.posZ(), col.multNtr()})); eventHisto.fillQA(col); } @@ -160,53 +160,53 @@ struct femtoUniversePairTaskTrackTrackMcTruth { fNeventsProcessed++; /// Histogramming same event - for (auto& part : groupPartsOne) { - if (!ConfNoPDGPartOne && part.tempFitVar() != ConfPDGCodePartOne) { + for (auto const& part : groupPartsOne) { + if (!confNoPDGPartOne && part.tempFitVar() != confPDGCodePartOne) { continue; } trackHistoPartOne.fillQA(part); } - if (!ConfIsSame) { - for (auto& part : groupPartsTwo) { - if (!ConfNoPDGPartTwo && part.tempFitVar() != ConfPDGCodePartTwo) { + if (!confIsSame) { + for (auto const& part : groupPartsTwo) { + if (!confNoPDGPartTwo && part.tempFitVar() != confPDGCodePartTwo) { continue; } trackHistoPartTwo.fillQA(part); } } /// Now build the combinations - if (!ConfIsSame) { + if (!confIsSame) { // Build the combinations for pairs of non-identical particles - for (auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { + for (auto const& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { // track cleaning if (!pairCleaner.isCleanPair(p1, p2, parts)) { continue; } - if ((!ConfNoPDGPartOne && p2.tempFitVar() != ConfPDGCodePartOne) || (!ConfNoPDGPartTwo && p1.tempFitVar() != ConfPDGCodePartTwo)) { + if ((!confNoPDGPartOne && p2.tempFitVar() != confPDGCodePartOne) || (!confNoPDGPartTwo && p1.tempFitVar() != confPDGCodePartTwo)) { continue; } if (swpart) - sameEventCont.setPair(p1, p2, multCol, ConfUse3D); + sameEventCont.setPair(p1, p2, multCol, confUse3D); else - sameEventCont.setPair(p2, p1, multCol, ConfUse3D); + sameEventCont.setPair(p2, p1, multCol, confUse3D); swpart = !swpart; } } else { // Build the combinations for pairs of identical pairs - for (auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsOne, groupPartsTwo))) { + for (auto const& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsOne, groupPartsTwo))) { // track cleaning if (!pairCleaner.isCleanPair(p1, p2, parts)) { continue; } - if ((!ConfNoPDGPartOne && p2.tempFitVar() != ConfPDGCodePartOne) || (!ConfNoPDGPartTwo && p1.tempFitVar() != ConfPDGCodePartTwo)) { + if ((!confNoPDGPartOne && p2.tempFitVar() != confPDGCodePartOne) || (!confNoPDGPartTwo && p1.tempFitVar() != confPDGCodePartTwo)) { continue; } if (swpart) - sameEventCont.setPair(p1, p2, multCol, ConfUse3D); + sameEventCont.setPair(p1, p2, multCol, confUse3D); else - sameEventCont.setPair(p2, p1, multCol, ConfUse3D); + sameEventCont.setPair(p2, p1, multCol, confUse3D); swpart = !swpart; } @@ -215,8 +215,8 @@ struct femtoUniversePairTaskTrackTrackMcTruth { /// process function for to call doSameEvent with Data /// \param col subscribe to the collision table (Data) /// \param parts subscribe to the femtoUniverseParticleTable - void processSameEvent(o2::aod::FdCollision& col, - o2::aod::FDParticles& parts) + void processSameEvent(o2::aod::FdCollision const& col, + o2::aod::FDParticles const& parts) { fillCollision(col); @@ -225,7 +225,7 @@ struct femtoUniversePairTaskTrackTrackMcTruth { doSameEvent(thegroupPartsOne, thegroupPartsTwo, parts, col.magField(), col.multNtr()); } - PROCESS_SWITCH(femtoUniversePairTaskTrackTrackMcTruth, processSameEvent, "Enable processing same event", true); + PROCESS_SWITCH(FemtoUniversePairTaskTrackTrackMcTruth, processSameEvent, "Enable processing same event", true); /// This function processes the mixed event /// \todo the trivial loops over the collisions and tracks should be factored out since they will be common to all combinations of T-T, T-V0, V0-V0, ... @@ -243,14 +243,14 @@ struct femtoUniversePairTaskTrackTrackMcTruth { bool swpart = fNeventsProcessed % 2; fNeventsProcessed++; - for (auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { - if ((!ConfNoPDGPartOne && p2.tempFitVar() != ConfPDGCodePartOne) || (!ConfNoPDGPartTwo && p1.tempFitVar() != ConfPDGCodePartTwo)) { + for (auto const& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { + if ((!confNoPDGPartOne && p2.tempFitVar() != confPDGCodePartOne) || (!confNoPDGPartTwo && p1.tempFitVar() != confPDGCodePartTwo)) { continue; } if (swpart) - mixedEventCont.setPair(p1, p2, multCol, ConfUse3D); + mixedEventCont.setPair(p1, p2, multCol, confUse3D); else - mixedEventCont.setPair(p2, p1, multCol, ConfUse3D); + mixedEventCont.setPair(p2, p1, multCol, confUse3D); swpart = !swpart; } @@ -259,13 +259,13 @@ struct femtoUniversePairTaskTrackTrackMcTruth { /// process function for to call doMixedEvent with Data /// @param cols subscribe to the collisions table (Data) /// @param parts subscribe to the femtoUniverseParticleTable - void processMixedEvent(o2::aod::FdCollisions& cols, - o2::aod::FDParticles& parts) + void processMixedEvent(o2::aod::FdCollisions const& cols, + o2::aod::FDParticles const& parts) { - for (auto& [collision1, collision2] : soa::selfCombinations(colBinning, 5, -1, cols, cols)) { + for (auto const& [collision1, collision2] : soa::selfCombinations(colBinning, 5, -1, cols, cols)) { const int multiplicityCol = collision1.multNtr(); - MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinning.getBin({collision1.posZ(), multiplicityCol})); + mixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinning.getBin({collision1.posZ(), multiplicityCol})); auto groupPartsOne = partsOne->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); auto groupPartsTwo = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); @@ -282,13 +282,13 @@ struct femtoUniversePairTaskTrackTrackMcTruth { doMixedEvent(groupPartsOne, groupPartsTwo, parts, magFieldTesla1, multiplicityCol); } } - PROCESS_SWITCH(femtoUniversePairTaskTrackTrackMcTruth, processMixedEvent, "Enable processing mixed events", true); + PROCESS_SWITCH(FemtoUniversePairTaskTrackTrackMcTruth, processMixedEvent, "Enable processing mixed events", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { WorkflowSpec workflow{ - adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc), }; return workflow; } From e9bd27ca9079c851d904d1d2121a31fd51db5166 Mon Sep 17 00:00:00 2001 From: Tushar Bhalla Date: Tue, 19 Aug 2025 01:00:41 +0530 Subject: [PATCH 094/986] [PWGHF] Centrality changes in Lc correlator, Correlation task (#11724) --- PWGHF/HFC/DataModel/CorrelationTables.h | 4 +- .../HFC/TableProducer/correlatorLcHadrons.cxx | 165 +++++++++++------- .../TableProducer/correlatorLcScHadrons.cxx | 13 +- PWGHF/HFC/Tasks/taskCorrelationLcHadrons.cxx | 92 +++++----- 4 files changed, 163 insertions(+), 111 deletions(-) diff --git a/PWGHF/HFC/DataModel/CorrelationTables.h b/PWGHF/HFC/DataModel/CorrelationTables.h index a77035b7f3f..d453d894978 100644 --- a/PWGHF/HFC/DataModel/CorrelationTables.h +++ b/PWGHF/HFC/DataModel/CorrelationTables.h @@ -161,6 +161,7 @@ DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); //! U DECLARE_SOA_COLUMN(IsPrompt, isPrompt, bool); //! Used in MC-Rec, Lc Prompt or Non-Prompt DECLARE_SOA_COLUMN(IsPhysicalPrimary, isPhysicalPrimary, bool); //! Used in MC-Rec, primary associated particles DECLARE_SOA_COLUMN(IsAutoCorrelated, isAutoCorrelated, bool); //! Correlation Status +DECLARE_SOA_COLUMN(Cent, cent, float); //! Centrality of Collision DECLARE_SOA_COLUMN(PrNsigmTPC, prNsigmTPC, float); //! Associated Particle TPC nSigma proton DECLARE_SOA_COLUMN(KaNsigmTPC, kaNsigmTPC, float); //! Associated Particle TPC nSigma Kaon DECLARE_SOA_COLUMN(PiNsigmTPC, piNsigmTPC, float); //! Associated Particle TPC nSigma Pion @@ -175,7 +176,8 @@ DECLARE_SOA_TABLE(LcHadronPair, "AOD", "LCHPAIR", //! Lc-Hadrons pairs Informati aod::hf_correlation_lc_hadron::PtLc, aod::hf_correlation_lc_hadron::PtHadron, aod::hf_correlation_lc_hadron::PoolBin, - aod::hf_correlation_lc_hadron::IsAutoCorrelated); + aod::hf_correlation_lc_hadron::IsAutoCorrelated, + aod::hf_correlation_lc_hadron::Cent); DECLARE_SOA_TABLE(LcHadronRecoInfo, "AOD", "LCHRECOINFO", //! Lc-Hadrons pairs Reconstructed Informations aod::hf_correlation_lc_hadron::MLc, diff --git a/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx index 22770502878..98d2728572a 100644 --- a/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx @@ -27,6 +27,7 @@ #include "Common/CCDB/EventSelectionParams.h" #include "Common/Core/RecoDecay.h" +#include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponseTOF.h" @@ -65,7 +66,6 @@ using namespace o2::constants::math; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::analysis::hf_correlations; - /// /// Returns deltaPhi values in range [-pi/2., 3.*pi/2.], typically used for correlation studies /// @@ -88,11 +88,14 @@ struct HfCorrelatorLcHadronsSelection { Configurable selectionFlagLc{"selectionFlagLc", 1, "Selection Flag for Lc"}; Configurable yCandMax{"yCandMax", 0.8, "max. cand. rapidity"}; Configurable ptCandMin{"ptCandMin", 1., "min. cand. pT"}; + Configurable centMin{"centMin", 0., "Minimum Centrality"}; + Configurable centMax{"centMax", 100., "Maximum Centrality"}; + Configurable useCentrality{"useCentrality", false, "Flag for centrality dependent analyses"}; HfHelper hfHelper; SliceCache cache; - using SelCollisions = soa::Join; + using SelCollisions = soa::Join; using CandidatesLcData = soa::Filtered>; using CandidatesLcMcRec = soa::Filtered>; using CandidatesLcMcGen = soa::Join; @@ -108,6 +111,7 @@ struct HfCorrelatorLcHadronsSelection { bool isLcFound = true; bool isSel8 = true; bool isNosameBunchPileUp = true; + bool isCentInRange = false; if (doSelLcCollision) { for (const auto& candidate : candidates) { if (std::abs(hfHelper.yLc(candidate)) > yCandMax || candidate.pt() < ptCandMin) { @@ -118,13 +122,21 @@ struct HfCorrelatorLcHadronsSelection { break; } } + + float cent = 0.; + if (useCentrality) { + cent = collision.centFT0M(); + } + if (useSel8) { isSel8 = collision.sel8(); } if (selNoSameBunchPileUpColl) { isNosameBunchPileUp = static_cast(collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)); } - isSelColl = isLcFound && isSel8 && isNosameBunchPileUp; + + isCentInRange = (cent >= centMin && cent < centMax); + isSelColl = isLcFound && isSel8 && isNosameBunchPileUp && isCentInRange; lcSel(isSelColl); } PROCESS_SWITCH(HfCorrelatorLcHadronsSelection, processLcSelectionData, "Process Lc Collision Selection Data", true); @@ -226,6 +238,7 @@ struct HfCorrelatorLcHadrons { Configurable isRecTrkPhyPrimary{"isRecTrkPhyPrimary", true, "Calculate the efficiency of reconstructed primary physical tracks"}; Configurable calEffLcEvent{"calEffLcEvent", true, "Calculate the efficiency of Lc candidate"}; Configurable eventFractionToAnalyze{"eventFractionToAnalyze", -1, "Fraction of events to analyze (use only for ME offline on very large samples)"}; + Configurable useCentrality{"useCentrality", false, "Flag for centrality dependent analyses"}; HfHelper hfHelper; SliceCache cache; @@ -236,7 +249,7 @@ struct HfCorrelatorLcHadrons { TRandom3* rnd = new TRandom3(0); // Event Mixing for the Data Mode - using SelCollisionsWithLc = soa::Filtered>; + using SelCollisionsWithLc = soa::Filtered>; using SelCollisionsWithLcMc = soa::Filtered>; // collisionFilter applied using CandidatesLcData = soa::Filtered>; // Event Mixing for the MCRec Mode @@ -267,6 +280,7 @@ struct HfCorrelatorLcHadrons { ConfigurableAxis binsPoolBin{"binsPoolBin", {9, 0., 9.}, "PoolBin"}; ConfigurableAxis binsMultFT0M{"binsMultFT0M", {600, 0., 6000.}, "Multiplicity as FT0M signal amplitude"}; ConfigurableAxis binsMassLc{"binsMassLc", {200, 1.98, 2.58}, "inv. mass (p K #pi) (GeV/#it{c}^{2})"}; + ConfigurableAxis binsCentFt0m{"binsCentFt0m", {100, 0., 100.}, "Centrality percentile (FT0M)"}; BinningType corrBinning{{binsZVtx, binsMultiplicity}, true}; @@ -286,49 +300,51 @@ struct HfCorrelatorLcHadrons { AxisSpec axisPoolBin = {binsPoolBin, "PoolBin"}; AxisSpec axisRapidity = {100, -2, 2, "Rapidity"}; AxisSpec axisSign = {2, -1, 1, "Sign"}; - - registry.add("hPtCand", "Lc,Hadron candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPtLc}}); - registry.add("hPtProng0", "Lc,Hadron candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPtLc}}); - registry.add("hPtProng1", "Lc,Hadron candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPtLc}}); - registry.add("hPtProng2", "Lc,Hadron candidates;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPtLc}}); - registry.add("hSelectionStatusLcToPKPi", "Lc,Hadron candidates;selection status;entries", {HistType::kTH1F, {{8, -0.5, 7.5}}}); - registry.add("hSelectionStatusLcToPiKP", "Lc,Hadron candidates;selection status;entries", {HistType::kTH1F, {{8, -0.5, 7.5}}}); - registry.add("hEta", "Lc,Hadron candidates;candidate #it{#eta};entries", {HistType::kTH1F, {axisEta}}); - registry.add("hPhi", "Lc,Hadron candidates;candidate #it{#varphi};entries", {HistType::kTH1F, {axisPhi}}); - registry.add("hY", "Lc,Hadron candidates;candidate #it{#y};entries", {HistType::kTH1F, {axisRapidity}}); - registry.add("hCountLcHadronPerEvent", "Lc,Hadron particles - MC gen;Number per event;entries", {HistType::kTH1F, {{21, -0.5, 20.5}}}); - registry.add("hMultiplicityPreSelection", "multiplicity prior to selection;multiplicity;entries", {HistType::kTH1F, {{10000, 0., 10000.}}}); - registry.add("hMultiplicity", "multiplicity;multiplicity;entries", {HistType::kTH1F, {{10000, 0., 10000.}}}); - registry.add("hMultFT0M", "multiplicity;multiplicity;entries", {HistType::kTH1F, {{10000, 0., 10000.}}}); - registry.add("hZvtx", "z vertex;z vertex;entries", {HistType::kTH1F, {{200, -20., 20.}}}); - registry.add("hLcBin", "Lc selected in pool Bin;pool Bin;entries", {HistType::kTH1F, {{9, 0., 9.}}}); - registry.add("hTracksBin", "Tracks selected in pool Bin;pool Bin;entries", {HistType::kTH1F, {{9, 0., 9.}}}); - registry.add("hMassLcVsPt", "Lc candidates;inv. mass (p K #pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{axisMassLc}, {axisPtLc}}}); - registry.add("hMassLcData", "Lc candidates;inv. mass (p K #pi) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{axisMassLc}}}); - registry.add("hLcPoolBin", "Lc candidates pool bin", {HistType::kTH1F, {axisPoolBin}}); - registry.add("hTracksPoolBin", "Particles associated pool bin", {HistType::kTH1F, {axisPoolBin}}); + AxisSpec axisCent = {binsCentFt0m, "Centrality"}; + + registry.add("hPtCand", "Lc,Hadron candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1D, {axisPtLc}}); + registry.add("hPtProng0", "Lc,Hadron candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1D, {axisPtLc}}); + registry.add("hPtProng1", "Lc,Hadron candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1D, {axisPtLc}}); + registry.add("hPtProng2", "Lc,Hadron candidates;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1D, {axisPtLc}}); + registry.add("hSelectionStatusLcToPKPi", "Lc,Hadron candidates;selection status;entries", {HistType::kTH1D, {{8, -0.5, 7.5}}}); + registry.add("hSelectionStatusLcToPiKP", "Lc,Hadron candidates;selection status;entries", {HistType::kTH1D, {{8, -0.5, 7.5}}}); + registry.add("hEta", "Lc,Hadron candidates;candidate #it{#eta};entries", {HistType::kTH1D, {axisEta}}); + registry.add("hPhi", "Lc,Hadron candidates;candidate #it{#varphi};entries", {HistType::kTH1D, {axisPhi}}); + registry.add("hY", "Lc,Hadron candidates;candidate #it{#y};entries", {HistType::kTH1D, {axisRapidity}}); + registry.add("hCountLcHadronPerEvent", "Lc,Hadron particles - MC gen;Number per event;entries", {HistType::kTH1D, {{21, -0.5, 20.5}}}); + registry.add("hMultiplicityPreSelection", "multiplicity prior to selection;multiplicity;entries", {HistType::kTH1D, {{10000, 0., 10000.}}}); + registry.add("hMultiplicity", "multiplicity;multiplicity;entries", {HistType::kTH1D, {{10000, 0., 10000.}}}); + registry.add("hMultFT0M", "multiplicity;multiplicity;entries", {HistType::kTH1D, {{10000, 0., 10000.}}}); + registry.add("hZvtx", "z vertex;z vertex;entries", {HistType::kTH1D, {{200, -20., 20.}}}); + registry.add("hCentFT0M", "Centrality FT0M; Centrality;entries", {HistType::kTH1D, {{100, 0., 100.}}}); + registry.add("hLcBin", "Lc selected in pool Bin;pool Bin;entries", {HistType::kTH1D, {{9, 0., 9.}}}); + registry.add("hTracksBin", "Tracks selected in pool Bin;pool Bin;entries", {HistType::kTH1D, {{9, 0., 9.}}}); + registry.add("hMassLcVsPtVsCent", "Lc candidates;inv. mass (p K #pi) (GeV/#it{c}^{2});entries", {HistType::kTH3F, {{axisMassLc}, {axisPtLc}, {axisCent}}}); + registry.add("hMassLcData", "Lc candidates;inv. mass (p K #pi) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{axisMassLc}}}); + registry.add("hLcPoolBin", "Lc candidates pool bin", {HistType::kTH1D, {axisPoolBin}}); + registry.add("hTracksPoolBin", "Particles associated pool bin", {HistType::kTH1D, {axisPoolBin}}); // Histograms for MC Reco analysis - registry.add("hSelectionStatusLcToPKPiMcRec", "Lc,Hadron candidates - MC reco;selection status;entries", {HistType::kTH1F, {{8, -0.5, 7.5}}}); - registry.add("hSelectionStatusLcToPiKPMcRec", "Lc,Hadron candidates - MC reco;selection status;entries", {HistType::kTH1F, {{8, -0.5, 7.5}}}); - registry.add("hMcEvtCount", "Event counter - MC gen;;entries", {HistType::kTH1F, {{1, -0.5, 0.5}}}); - registry.add("hPtProng0McRec", "Lc,Hadron candidates - MC reco;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPtLc}}); - registry.add("hPtProng1McRec", "Lc,Hadron candidates - MC reco;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPtLc}}); - registry.add("hPtProng2McRec", "Lc,Hadron candidates - MC reco;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPtLc}}); - registry.add("hMassLcMcRec", "Lc candidates;inv. mass (P K #pi) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{axisMassLc}}}); + registry.add("hSelectionStatusLcToPKPiMcRec", "Lc,Hadron candidates - MC reco;selection status;entries", {HistType::kTH1D, {{8, -0.5, 7.5}}}); + registry.add("hSelectionStatusLcToPiKPMcRec", "Lc,Hadron candidates - MC reco;selection status;entries", {HistType::kTH1D, {{8, -0.5, 7.5}}}); + registry.add("hMcEvtCount", "Event counter - MC gen;;entries", {HistType::kTH1D, {{1, -0.5, 0.5}}}); + registry.add("hPtProng0McRec", "Lc,Hadron candidates - MC reco;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1D, {axisPtLc}}); + registry.add("hPtProng1McRec", "Lc,Hadron candidates - MC reco;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1D, {axisPtLc}}); + registry.add("hPtProng2McRec", "Lc,Hadron candidates - MC reco;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1D, {axisPtLc}}); + registry.add("hMassLcMcRec", "Lc candidates;inv. mass (P K #pi) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{axisMassLc}}}); registry.add("hMassLcVsPtMcRec", "Lc candidates - MC Reco", {HistType::kTH2F, {{axisMassLc}, {axisPtLc}}}); registry.add("hMassLcMcRecSig", "Lc signal candidates - MC reco;inv. mass (p K #pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{axisMassLc}, {axisPtLc}}}); registry.add("hMassLcMcRecBkg", "Lc background candidates - MC reco;inv. mass (p K #pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{axisMassLc}, {axisPtLc}}}); - registry.add("hPtCandMcRecSig", "Lc,Hadron candidates - MC Reco", {HistType::kTH1F, {axisPtLc}}); - registry.add("hPtCandMcRecSigPrompt", "Lc,Hadron candidates Prompt - MC Reco", {HistType::kTH1F, {axisPtLc}}); - registry.add("hPtCandMcRecSigNonPrompt", "Lc,Hadron candidates Non Prompt - MC Reco", {HistType::kTH1F, {axisPtLc}}); - registry.add("hPtCandMcRecBkg", "Lc,Hadron candidates - MC Reco", {HistType::kTH1F, {axisPtLc}}); - registry.add("hEtaMcRecSig", "Lc,Hadron candidates - MC Reco", {HistType::kTH1F, {axisEta}}); - registry.add("hPhiMcRecSig", "Lc,Hadron candidates - MC Reco", {HistType::kTH1F, {axisPhi}}); - registry.add("hYMcRecSig", "Lc,Hadron candidates - MC reco;candidate #it{#y};entries", {HistType::kTH1F, {axisRapidity}}); - registry.add("hEtaMcRecBkg", "Lc,Hadron candidates - MC Reco", {HistType::kTH1F, {axisEta}}); - registry.add("hPhiMcRecBkg", "Lc,Hadron candidates - MC Reco", {HistType::kTH1F, {axisPhi}}); - registry.add("hYMcRecBkg", "Lc,Hadron candidates - MC reco;candidate #it{#y};entries", {HistType::kTH1F, {axisRapidity}}); - registry.add("hFakeTracksMcRec", "Fake tracks - MC Rec", {HistType::kTH1F, {axisPtHadron}}); + registry.add("hPtCandMcRecSig", "Lc,Hadron candidates - MC Reco", {HistType::kTH1D, {axisPtLc}}); + registry.add("hPtCandMcRecSigPrompt", "Lc,Hadron candidates Prompt - MC Reco", {HistType::kTH1D, {axisPtLc}}); + registry.add("hPtCandMcRecSigNonPrompt", "Lc,Hadron candidates Non Prompt - MC Reco", {HistType::kTH1D, {axisPtLc}}); + registry.add("hPtCandMcRecBkg", "Lc,Hadron candidates - MC Reco", {HistType::kTH1D, {axisPtLc}}); + registry.add("hEtaMcRecSig", "Lc,Hadron candidates - MC Reco", {HistType::kTH1D, {axisEta}}); + registry.add("hPhiMcRecSig", "Lc,Hadron candidates - MC Reco", {HistType::kTH1D, {axisPhi}}); + registry.add("hYMcRecSig", "Lc,Hadron candidates - MC reco;candidate #it{#y};entries", {HistType::kTH1D, {axisRapidity}}); + registry.add("hEtaMcRecBkg", "Lc,Hadron candidates - MC Reco", {HistType::kTH1D, {axisEta}}); + registry.add("hPhiMcRecBkg", "Lc,Hadron candidates - MC Reco", {HistType::kTH1D, {axisPhi}}); + registry.add("hYMcRecBkg", "Lc,Hadron candidates - MC reco;candidate #it{#y};entries", {HistType::kTH1D, {axisRapidity}}); + registry.add("hFakeTracksMcRec", "Fake tracks - MC Rec", {HistType::kTH1D, {axisPtHadron}}); registry.add("hPtParticleAssocVsCandMcRec", "Associated Particle - MC Rec", {HistType::kTH2F, {{axisPtHadron}, {axisPtLc}}}); registry.add("hPtTracksVsSignRec", "Associated Particle - MC Rec", {HistType::kTH2F, {{axisPtTrack}, {axisSign}}}); registry.add("hPtTracksVsSignRecTrue", "Associated Particle - MC Rec (True)", {HistType::kTH2F, {{axisPtTrack}, {axisSign}}}); @@ -338,15 +354,14 @@ struct HfCorrelatorLcHadrons { registry.add("hPtVsMultiplicityMcRecNonPrompt", "Multiplicity FT0M - MC Rec Non Prompt", {HistType::kTH2F, {{axisPtLc}, {axisMultFT0M}}}); // Histograms for MC Gen analysis registry.add("hcountLctriggersMcGen", "Lc trigger particles - MC gen;;N of trigger Lc", {HistType::kTH2F, {{1, -0.5, 0.5}, {axisPtLc}}}); - registry.add("hPtCandMcGen", "Lc,Hadron particles - MC gen;particle #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPtLc}}); - registry.add("hYMcGen", "Lc,Hadron candidates - MC gen;candidate #it{#y};entries", {HistType::kTH1F, {axisRapidity}}); - registry.add("hPtCandMcGenPrompt", "Lc,Hadron particles - MC Gen Prompt", {HistType::kTH1F, {axisPtLc}}); - registry.add("hPtCandMcGenNonPrompt", "Lc,Hadron particles - MC Gen Non Prompt", {HistType::kTH1F, {axisPtLc}}); - registry.add("hPtParticleAssocMcGen", "Associated Particle - MC Gen", {HistType::kTH1F, {axisPtHadron}}); - registry.add("hEtaMcGen", "Lc,Hadron particles - MC Gen", {HistType::kTH1F, {axisEta}}); - registry.add("hPhiMcGen", "Lc,Hadron particles - MC Gen", {HistType::kTH1F, {axisPhi}}); - registry.add("hMultFT0AMcGen", "Lc,Hadron multiplicity FT0A - MC Gen", {HistType::kTH1F, {axisMultiplicity}}); - + registry.add("hPtCandMcGen", "Lc,Hadron particles - MC gen;particle #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1D, {axisPtLc}}); + registry.add("hYMcGen", "Lc,Hadron candidates - MC gen;candidate #it{#y};entries", {HistType::kTH1D, {axisRapidity}}); + registry.add("hPtCandMcGenPrompt", "Lc,Hadron particles - MC Gen Prompt", {HistType::kTH1D, {axisPtLc}}); + registry.add("hPtCandMcGenNonPrompt", "Lc,Hadron particles - MC Gen Non Prompt", {HistType::kTH1D, {axisPtLc}}); + registry.add("hPtParticleAssocMcGen", "Associated Particle - MC Gen", {HistType::kTH1D, {axisPtHadron}}); + registry.add("hEtaMcGen", "Lc,Hadron particles - MC Gen", {HistType::kTH1D, {axisEta}}); + registry.add("hPhiMcGen", "Lc,Hadron particles - MC Gen", {HistType::kTH1D, {axisPhi}}); + registry.add("hMultFT0AMcGen", "Lc,Hadron multiplicity FT0A - MC Gen", {HistType::kTH1D, {axisMultiplicity}}); corrBinning = {{binsZVtx, binsMultiplicity}, true}; } @@ -374,6 +389,10 @@ struct HfCorrelatorLcHadrons { int gCollisionId = collision.globalIndex(); int64_t timeStamp = bc.timestamp(); + float cent = 0.; + if (useCentrality) { + cent = collision.centFT0M(); + } int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFT0M())); int nTracks = 0; if (collision.numContrib() > 1) { @@ -412,8 +431,9 @@ struct HfCorrelatorLcHadrons { registry.fill(HIST("hPhi"), RecoDecay::constrainAngle(candidate.phi(), -PIHalf)); registry.fill(HIST("hY"), hfHelper.yLc(candidate)); registry.fill(HIST("hLcBin"), poolBin); + if (candidate.isSelLcToPKPi() >= selectionFlagLc) { - registry.fill(HIST("hMassLcVsPt"), hfHelper.invMassLcToPKPi(candidate), candidate.pt(), efficiencyWeightLc); + registry.fill(HIST("hMassLcVsPtVsCent"), hfHelper.invMassLcToPKPi(candidate), candidate.pt(), cent, efficiencyWeightLc); registry.fill(HIST("hMassLcData"), hfHelper.invMassLcToPKPi(candidate), efficiencyWeightLc); registry.fill(HIST("hSelectionStatusLcToPKPi"), candidate.isSelLcToPKPi()); for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { @@ -423,7 +443,7 @@ struct HfCorrelatorLcHadrons { entryLc(candidate.phi(), candidate.eta(), candidate.pt() * chargeLc, hfHelper.invMassLcToPKPi(candidate), poolBin, gCollisionId, timeStamp); } if (candidate.isSelLcToPiKP() >= selectionFlagLc) { - registry.fill(HIST("hMassLcVsPt"), hfHelper.invMassLcToPiKP(candidate), candidate.pt(), efficiencyWeightLc); + registry.fill(HIST("hMassLcVsPtVsCent"), hfHelper.invMassLcToPiKP(candidate), candidate.pt(), cent, efficiencyWeightLc); registry.fill(HIST("hMassLcData"), hfHelper.invMassLcToPiKP(candidate), efficiencyWeightLc); registry.fill(HIST("hSelectionStatusLcToPiKP"), candidate.isSelLcToPiKP()); for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { @@ -463,7 +483,8 @@ struct HfCorrelatorLcHadrons { candidate.pt() * chargeLc, track.pt() * track.sign(), poolBin, - correlationStatus); + correlationStatus, + cent); entryLcHadronPairY(track.rapidity(MassProton) - hfHelper.yLc(candidate)); // only for proton as of now entryLcHadronRecoInfo(hfHelper.invMassLcToPKPi(candidate), false); entryLcHadronGenInfo(false, false, 0); @@ -479,7 +500,8 @@ struct HfCorrelatorLcHadrons { candidate.pt() * chargeLc, track.pt() * track.sign(), poolBin, - correlationStatus); + correlationStatus, + cent); entryLcHadronPairY(track.rapidity(MassProton) - hfHelper.yLc(candidate)); // only for proton as of now entryLcHadronRecoInfo(hfHelper.invMassLcToPiKP(candidate), false); entryLcHadronGenInfo(false, false, 0); @@ -503,6 +525,7 @@ struct HfCorrelatorLcHadrons { } // end outer Lc loop registry.fill(HIST("hZvtx"), collision.posZ()); registry.fill(HIST("hMultFT0M"), collision.multFT0M()); + registry.fill(HIST("hCentFT0M"), cent); } PROCESS_SWITCH(HfCorrelatorLcHadrons, processData, "Process data", true); @@ -667,6 +690,7 @@ struct HfCorrelatorLcHadrons { } //} } + float cent = 100.0; // will be updated later // Lc-Hadron correlation dedicated section // if the candidate is selected as Lc, search for Hadron ad evaluate correlations @@ -716,7 +740,8 @@ struct HfCorrelatorLcHadrons { candidate.pt() * chargeLc, track.pt() * track.sign(), poolBin, - correlationStatus); + correlationStatus, + cent); entryLcHadronPairY(track.rapidity(MassProton) - hfHelper.yLc(candidate)); // only for proton as of now entryLcHadronRecoInfo(hfHelper.invMassLcToPKPi(candidate), isLcSignal); if (fillTrkPID) { @@ -746,7 +771,8 @@ struct HfCorrelatorLcHadrons { candidate.pt() * chargeLc, track.pt() * track.sign(), poolBin, - correlationStatus); + correlationStatus, + cent); entryLcHadronPairY(track.rapidity(MassProton) - hfHelper.yLc(candidate)); // only for proton as of now entryLcHadronRecoInfo(hfHelper.invMassLcToPiKP(candidate), isLcSignal); if (fillTrkPID) { @@ -790,6 +816,7 @@ struct HfCorrelatorLcHadrons { bool isLcPrompt = false; bool isLcNonPrompt = false; + float cent = 100.0; // will be updated later // find leading particle if (correlateLcWithLeadingParticle) { @@ -878,7 +905,8 @@ struct HfCorrelatorLcHadrons { particle.pt() * chargeLc / std::abs(chargeLc), particleAssoc.pt() * chargeAssoc / std::abs(chargeAssoc), poolBin, - correlationStatus); + correlationStatus, + cent); entryLcHadronPairY(particleAssoc.y() - yL); entryLcHadronRecoInfo(MassLambdaCPlus, true); entryLcHadronGenInfo(isLcPrompt, particleAssoc.isPhysicalPrimary(), trackOrigin); @@ -911,6 +939,8 @@ struct HfCorrelatorLcHadrons { auto trackPos1 = trigLc.template prong0_as(); // positive daughter (negative for the antiparticles) int8_t chargeLc = trackPos1.sign(); // charge of 1st prong will be the charge of Lc candidate + float cent = 100.0; // will be updated later + std::vector outputMl = {-1., -1., -1.}; // LcToPKPi and LcToPiKP division if (trigLc.isSelLcToPKPi() >= selectionFlagLc) { @@ -919,7 +949,8 @@ struct HfCorrelatorLcHadrons { trigLc.pt() * chargeLc, assocParticle.pt() * assocParticle.sign(), poolBin, - correlationStatus); + correlationStatus, + cent); entryLcHadronPairY(assocParticle.y() - hfHelper.yLc(trigLc)); entryLcHadronRecoInfo(hfHelper.invMassLcToPKPi(trigLc), false); entryLcHadronGenInfo(false, false, 0); @@ -938,7 +969,8 @@ struct HfCorrelatorLcHadrons { trigLc.pt() * chargeLc, assocParticle.pt() * assocParticle.sign(), poolBin, - correlationStatus); + correlationStatus, + cent); entryLcHadronPairY(assocParticle.y() - hfHelper.yLc(trigLc)); entryLcHadronRecoInfo(hfHelper.invMassLcToPiKP(trigLc), false); entryLcHadronGenInfo(false, false, 0); @@ -1006,6 +1038,7 @@ struct HfCorrelatorLcHadrons { registry.fill(HIST("hZvtx"), c1.posZ()); registry.fill(HIST("hTracksPoolBin"), poolBin); registry.fill(HIST("hLcPoolBin"), poolBinLc); + float cent = 100.0; // will be updated later for (const auto& [candidate, pAssoc] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { if (std::abs(hfHelper.yLc(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { continue; @@ -1038,7 +1071,8 @@ struct HfCorrelatorLcHadrons { candidate.pt() * chargeLc, pAssoc.pt() * pAssoc.sign(), poolBin, - correlationStatus); + correlationStatus, + cent); entryLcHadronPairY(pAssoc.y() - hfHelper.yLc(candidate)); entryLcHadronRecoInfo(hfHelper.invMassLcToPKPi(candidate), isLcSignal); entryLcHadronGenInfo(isLcPrompt, isPhysicalPrimary, trackOrigin); @@ -1057,7 +1091,8 @@ struct HfCorrelatorLcHadrons { candidate.pt() * chargeLc, pAssoc.pt() * pAssoc.sign(), poolBin, - correlationStatus); + correlationStatus, + cent); entryLcHadronPairY(pAssoc.y() - hfHelper.yLc(candidate)); entryLcHadronRecoInfo(hfHelper.invMassLcToPiKP(candidate), isLcSignal); entryLcHadronGenInfo(isLcPrompt, isPhysicalPrimary, trackOrigin); @@ -1105,6 +1140,7 @@ struct HfCorrelatorLcHadrons { } int8_t chargeLc = pdg->GetParticle(candidate.pdgCode())->Charge(); // Retrieve charge int8_t chargeAssoc = pdg->GetParticle(particleAssoc.pdgCode())->Charge(); // Retrieve charge + float cent = 100.0; // will be updated later int trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, particleAssoc, true); bool isLcPrompt = candidate.originMcGen() == RecoDecay::OriginType::Prompt; @@ -1113,7 +1149,8 @@ struct HfCorrelatorLcHadrons { candidate.pt() * chargeLc / std::abs(chargeLc), particleAssoc.pt() * chargeAssoc / std::abs(chargeAssoc), poolBin, - correlationStatus); + correlationStatus, + cent); entryLcHadronPairY(particleAssoc.y() - yL); entryLcHadronRecoInfo(MassLambdaCPlus, true); entryLcHadronGenInfo(isLcPrompt, particleAssoc.isPhysicalPrimary(), trackOrigin); diff --git a/PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx index b06f67990a9..7ce63015c54 100644 --- a/PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx @@ -476,13 +476,15 @@ struct HfCorrelatorLcScHadrons { { bool isPhysicalPrimary = false; int trackOrigin = -1; + float cent = 100.0; // will be updated later entryCandHadronPair(getDeltaPhi(track.phi(), candidate.phi()), track.eta() - candidate.eta(), candidate.pt(), track.pt() * track.sign(), binPool, - correlStatus); + correlStatus, + cent); entryCandHadronPairY(track.rapidity(MassProton) - yCand); entryCandHadronMlInfo(outMl[0], outMl[1]); entryTrackRecoInfo(track.dcaXY(), track.dcaZ(), track.tpcNClsCrossedRows()); @@ -1020,12 +1022,15 @@ struct HfCorrelatorLcScHadrons { int8_t chargeAssoc = pdg->GetParticle(particleAssoc.pdgCode())->Charge(); // Retrieve charge chargeAssoc = chargeAssoc / std::abs(chargeAssoc); registry.fill(HIST("hPtParticleAssocMcGen"), particleAssoc.pt()); + float cent = 100.0; // will be updated later + entryCandHadronPair(getDeltaPhi(particleAssoc.phi(), particle.phi()), particleAssoc.eta() - particle.eta(), particle.pt(), particleAssoc.pt() * chargeAssoc, poolBin, - correlationStatus); + correlationStatus, + cent); entryCandHadronPairY(particleAssoc.y() - yCand); entryCandHadronRecoInfo(massCand, true); entryCandHadronGenInfo(isPrompt, particleAssoc.isPhysicalPrimary(), trackOrigin); @@ -1166,6 +1171,7 @@ struct HfCorrelatorLcScHadrons { } int8_t chargeLc = pdg->GetParticle(candidate.pdgCode())->Charge(); // Retrieve charge int8_t chargeAssoc = pdg->GetParticle(particleAssoc.pdgCode())->Charge(); // Retrieve charge + float cent = 100.0; // will be updated later int trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, particleAssoc, true); bool isPrompt = candidate.originMcGen() == RecoDecay::OriginType::Prompt; @@ -1174,7 +1180,8 @@ struct HfCorrelatorLcScHadrons { candidate.pt() * chargeLc / std::abs(chargeLc), particleAssoc.pt() * chargeAssoc / std::abs(chargeAssoc), poolBin, - correlationStatus); + correlationStatus, + cent); entryCandHadronPairY(particleAssoc.y() - yL); entryCandHadronRecoInfo(MassLambdaCPlus, true); entryCandHadronGenInfo(isPrompt, particleAssoc.isPhysicalPrimary(), trackOrigin); diff --git a/PWGHF/HFC/Tasks/taskCorrelationLcHadrons.cxx b/PWGHF/HFC/Tasks/taskCorrelationLcHadrons.cxx index 84386ab9794..fa308c257f0 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationLcHadrons.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationLcHadrons.cxx @@ -142,6 +142,7 @@ struct HfTaskCorrelationLcHadrons { Configurable ptDaughterMin{"ptDaughterMin", 0.1, "min. daughter pT"}; Configurable activateQA{"activateQA", false, "Flag to enable debug histogram"}; Configurable nTpcCrossedRaws{"nTpcCrossedRaws", 70, "Number of crossed TPC Rows"}; + Configurable useCentrality{"useCentrality", false, "Flag for centrality dependent analyses"}; // sign and invMasss Configurable fillSignAndMass{"fillSignAndMass", false, "flag to select Lc-h corr with Lc invarient mass and sign of pairs"}; Configurable calSign{"calSign", false, "flag to calculate sign of pairs"}; @@ -186,6 +187,7 @@ struct HfTaskCorrelationLcHadrons { ConfigurableAxis binsPhi{"binsPhi", {64, -PIHalf, 3. * PIHalf}, "#it{#varphi}"}; ConfigurableAxis binsMultFT0M{"binsMultFT0M", {600, 0., 8000.}, "Multiplicity as FT0M signal amplitude"}; ConfigurableAxis binsPoolBin{"binsPoolBin", {9, 0., 9.}, "PoolBin"}; + ConfigurableAxis binsCentFt0m{"binsCentFt0m", {100, 0., 100.}, "Centrality percentile (FT0M)"}; HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -204,32 +206,33 @@ struct HfTaskCorrelationLcHadrons { AxisSpec axisBdtScore = {binsBdtScore, "Bdt score"}; AxisSpec axisCorrelationState = {2, 0., 2., ""}; AxisSpec axisSignPair = {4, 1., 5.}; + AxisSpec axisCentFT0M = {binsCentFt0m, "Centrality percentile (FT0M)"}; + // Histograms for data analysis - registry.add("hBdtScorePrompt", "Lc BDT prompt score", {HistType::kTH1F, {axisBdtScore}}); - registry.add("hBdtScoreBkg", "Lc BDT bkg score", {HistType::kTH1F, {axisBdtScore}}); + registry.add("hBdtScorePrompt", "Lc BDT prompt score", {HistType::kTH1D, {axisBdtScore}}); + registry.add("hBdtScoreBkg", "Lc BDT bkg score", {HistType::kTH1D, {axisBdtScore}}); registry.add("hMassLcVsPt", "Lc candidates massVsPt", {HistType::kTH2F, {{axisMassLc}, {axisPtLc}}}); registry.add("hMassLcVsPtWoEff", "Lc candidates massVsPt without efficiency", {HistType::kTH2F, {{axisMassLc}, {axisPtLc}}}); if (fillHistoData) { - registry.add("hDeltaEtaPtIntSignalRegion", stringLcHadron + stringSignal + stringDeltaEta + "entries", {HistType::kTH1F, {axisDeltaEta}}); - registry.add("hDeltaPhiPtIntSignalRegion", stringLcHadron + stringSignal + stringDeltaPhi + "entries", {HistType::kTH1F, {axisDeltaPhi}}); + registry.add("hDeltaEtaPtIntSignalRegion", stringLcHadron + stringSignal + stringDeltaEta + "entries", {HistType::kTH1D, {axisDeltaEta}}); + registry.add("hDeltaPhiPtIntSignalRegion", stringLcHadron + stringSignal + stringDeltaPhi + "entries", {HistType::kTH1D, {axisDeltaPhi}}); registry.add("hCorrel2DPtIntSignalRegion", stringLcHadron + stringSignal + stringDeltaPhi + stringDeltaEta + "entries", {HistType::kTH2F, {{axisDeltaPhi}, {axisDeltaEta}}}); - registry.add("hDeltaEtaPtIntSidebands", stringLcHadron + stringSideband + stringDeltaEta + "entries", {HistType::kTH1F, {axisDeltaEta}}); - registry.add("hDeltaPhiPtIntSidebands", stringLcHadron + stringSideband + stringDeltaPhi + "entries", {HistType::kTH1F, {axisDeltaPhi}}); + registry.add("hDeltaEtaPtIntSidebands", stringLcHadron + stringSideband + stringDeltaEta + "entries", {HistType::kTH1D, {axisDeltaEta}}); + registry.add("hDeltaPhiPtIntSidebands", stringLcHadron + stringSideband + stringDeltaPhi + "entries", {HistType::kTH1D, {axisDeltaPhi}}); registry.add("hCorrel2DPtIntSidebands", stringLcHadron + stringSideband + stringDeltaPhi + stringDeltaEta + "entries", {HistType::kTH2F, {{axisDeltaPhi}, {axisDeltaEta}}}); - registry.add("hCorrel2DVsPtSidebands", stringLcHadron + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtCorr}, {axisPtHadron}, {axisPoolBin}}}); - registry.add("hDeltaEtaPtIntSidebandLeft", stringLcHadron + "Left" + stringSideband + stringDeltaEta, {HistType::kTH1F, {axisDeltaEta}}); - registry.add("hDeltaPhiPtIntSidebandLeft", stringLcHadron + "Left" + stringSideband + stringDeltaPhi, {HistType::kTH1F, {axisDeltaPhi}}); - registry.add("hDeltaEtaPtIntSidebandRight", stringLcHadron + "Right" + stringSideband + stringDeltaEta, {HistType::kTH1F, {axisDeltaEta}}); - registry.add("hDeltaPhiPtIntSidebandRight", stringLcHadron + "Right" + stringSideband + stringDeltaPhi, {HistType::kTH1F, {axisDeltaPhi}}); + registry.add("hCorrel2DVsPtSidebands", stringLcHadron + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTHnSparseF, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtCorr}, {axisPtHadron}, {axisPoolBin}, {axisCentFT0M}}}); + registry.add("hDeltaEtaPtIntSidebandLeft", stringLcHadron + "Left" + stringSideband + stringDeltaEta, {HistType::kTH1D, {axisDeltaEta}}); + registry.add("hDeltaPhiPtIntSidebandLeft", stringLcHadron + "Left" + stringSideband + stringDeltaPhi, {HistType::kTH1D, {axisDeltaPhi}}); + registry.add("hDeltaEtaPtIntSidebandRight", stringLcHadron + "Right" + stringSideband + stringDeltaEta, {HistType::kTH1D, {axisDeltaEta}}); + registry.add("hDeltaPhiPtIntSidebandRight", stringLcHadron + "Right" + stringSideband + stringDeltaPhi, {HistType::kTH1D, {axisDeltaPhi}}); if (!fillSign) { - registry.add("hCorrel2DVsPtSidebandLeft", stringLcHadron + "Left" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisPoolBin}}}); - registry.add("hCorrel2DVsPtSidebandRight", stringLcHadron + "Right" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisPoolBin}}}); - registry.add("hCorrel2DVsPtSignalRegion", stringLcHadron + stringSignal + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtCorr}, {axisPtHadron}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtSidebandLeft", stringLcHadron + "Left" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTHnSparseF, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisPoolBin}, {axisCentFT0M}}}); + registry.add("hCorrel2DVsPtSidebandRight", stringLcHadron + "Right" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTHnSparseF, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisPoolBin}, {axisCentFT0M}}}); + registry.add("hCorrel2DVsPtSignalRegion", stringLcHadron + stringSignal + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTHnSparseF, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtCorr}, {axisPtHadron}, {axisPoolBin}, {axisCentFT0M}}}); registry.get(HIST("hCorrel2DVsPtSidebandLeft"))->Sumw2(); registry.get(HIST("hCorrel2DVsPtSidebandRight"))->Sumw2(); registry.get(HIST("hCorrel2DVsPtSignalRegion"))->Sumw2(); - } else { registry.add("hCorrel2DVsPtSignSidebandLeft", stringLcHadron + "Left" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + stringSign + "entries", {HistType::kTHnSparseF, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisSignPair}, {axisPoolBin}}}); registry.add("hCorrel2DVsPtSignSidebandRight", stringLcHadron + "Right" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + stringSign + "entries", {HistType::kTHnSparseF, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisSignPair}, {axisPoolBin}}}); @@ -254,18 +257,18 @@ struct HfTaskCorrelationLcHadrons { if (fillHistoMcRec) { registry.add("hMassPromptLcVsPt", "Lc prompt candidates mass Vs Pt", {HistType::kTH2F, {{axisMassLc}, {axisPtLc}}}); registry.add("hMassNonPromptLcVsPt", "Lc non prompt candidates mass Vs Pt", {HistType::kTH2F, {{axisMassLc}, {axisPtLc}}}); - registry.add("hDeltaEtaPtIntSignalRegionMcRec", stringLcHadron + stringSignal + stringDeltaEta + "entries", {HistType::kTH1F, {axisDeltaEta}}); - registry.add("hDeltaPhiPtIntSignalRegionMcRec", stringLcHadron + stringSignal + stringDeltaPhi + "entries", {HistType::kTH1F, {axisDeltaPhi}}); - registry.add("hDeltaEtaPtIntSidebandsMcRec", stringLcHadron + stringSideband + stringDeltaEta + "entries", {HistType::kTH1F, {axisDeltaEta}}); + registry.add("hDeltaEtaPtIntSignalRegionMcRec", stringLcHadron + stringSignal + stringDeltaEta + "entries", {HistType::kTH1D, {axisDeltaEta}}); + registry.add("hDeltaPhiPtIntSignalRegionMcRec", stringLcHadron + stringSignal + stringDeltaPhi + "entries", {HistType::kTH1D, {axisDeltaPhi}}); + registry.add("hDeltaEtaPtIntSidebandsMcRec", stringLcHadron + stringSideband + stringDeltaEta + "entries", {HistType::kTH1D, {axisDeltaEta}}); registry.add("hCorrel2DPtIntSignalRegionMcRec", stringLcHadron + stringSignal + stringDeltaPhi + stringDeltaEta + "entries", {HistType::kTH2F, {{axisDeltaPhi}, {axisDeltaEta}}}); - registry.add("hDeltaPhiPtIntSidebandsMcRec", stringLcHadron + stringSideband + stringDeltaPhi + "entries", {HistType::kTH1F, {axisDeltaPhi}}); + registry.add("hDeltaPhiPtIntSidebandsMcRec", stringLcHadron + stringSideband + stringDeltaPhi + "entries", {HistType::kTH1D, {axisDeltaPhi}}); registry.add("hCorrel2DPtIntSidebandsMcRec", stringLcHadron + stringSideband + stringDeltaPhi + stringDeltaEta + "entries", {HistType::kTH2F, {{axisDeltaPhi}, {axisDeltaEta}}}); registry.add("hCorrel2DVsPtSidebandsMcRec", stringLcHadron + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtCorr}, {axisPtHadron}, {axisPoolBin}}}); registry.add("hCorrel2DVsPtPhysicalPrimaryMcRec", stringLcHadron + "(only true primary particles)" + stringSignal, {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisLcPrompt}, {axisPoolBin}}}); - registry.add("hDeltaEtaPtIntSidebandLeftMcRec", stringLcHadron + "Left" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTH1F, {axisDeltaEta}}); - registry.add("hDeltaPhiPtIntSidebandLeftMcRec", stringLcHadron + "Left" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTH1F, {axisDeltaPhi}}); - registry.add("hDeltaEtaPtIntSidebandRightMcRec", stringLcHadron + "Right" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTH1F, {axisDeltaEta}}); - registry.add("hDeltaPhiPtIntSidebandRightMcRec", stringLcHadron + "Right" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTH1F, {axisDeltaPhi}}); + registry.add("hDeltaEtaPtIntSidebandLeftMcRec", stringLcHadron + "Left" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTH1D, {axisDeltaEta}}); + registry.add("hDeltaPhiPtIntSidebandLeftMcRec", stringLcHadron + "Left" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTH1D, {axisDeltaPhi}}); + registry.add("hDeltaEtaPtIntSidebandRightMcRec", stringLcHadron + "Right" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTH1D, {axisDeltaEta}}); + registry.add("hDeltaPhiPtIntSidebandRightMcRec", stringLcHadron + "Right" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTH1D, {axisDeltaPhi}}); if (!fillSign) { registry.add("hCorrel2DVsPtSidebandLeftMcRec", stringLcHadron + "Left" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtLc + stringPtHadron + "entries", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtLc}, {axisPtHadron}, {axisPoolBin}}}); @@ -317,8 +320,8 @@ struct HfTaskCorrelationLcHadrons { } // Histograms for MC Gen analysis if (fillHistoMcGen) { - registry.add("hDeltaEtaPtIntMcGen", stringMcParticles + stringDeltaEta + "entries", {HistType::kTH1F, {axisDeltaEta}}); - registry.add("hDeltaPhiPtIntMcGen", stringMcParticles + stringDeltaPhi + "entries", {HistType::kTH1F, {axisDeltaPhi}}); + registry.add("hDeltaEtaPtIntMcGen", stringMcParticles + stringDeltaEta + "entries", {HistType::kTH1D, {axisDeltaEta}}); + registry.add("hDeltaPhiPtIntMcGen", stringMcParticles + stringDeltaPhi + "entries", {HistType::kTH1D, {axisDeltaPhi}}); registry.add("hCorrel2DPtIntMcGen", stringMcParticles + stringDeltaPhi + stringDeltaEta + "entries", {HistType::kTH2F, {{axisDeltaPhi}, {axisDeltaEta}}}); if (!fillSign) { @@ -353,11 +356,11 @@ struct HfTaskCorrelationLcHadrons { registry.add("hAwayGen", "Away invmass; ptLc; correlationState;entries", {HistType::kTH3F, {{axisMassLc}, {axisPtLc}, {axisCorrelationState}}}); } // Histograms for efficiencies - registry.add("Efficiency/hPtCandMcRecPrompt", stringMcRecoLcPrompt + stringPtLc, {HistType::kTH1F, {axisPtLc}}); - registry.add("Efficiency/hPtCandMcGenPrompt", stringMcGenLcPrompt + stringPtLc, {HistType::kTH1F, {axisPtLc}}); - registry.add("Efficiency/hPtCandMcRecNonPrompt", stringMcRecoLcFd + stringPtLc, {HistType::kTH1F, {axisPtLc}}); - registry.add("Efficiency/hPtCandMcGenNonPrompt", stringMcGenLcFd + stringPtLc, {HistType::kTH1F, {axisPtLc}}); - registry.add("Efficiency/hPtCandMcGenDaughterInAcc", stringMcGenLcFd + stringPtLc, {HistType::kTH1F, {axisPtLc}}); + registry.add("Efficiency/hPtCandMcRecPrompt", stringMcRecoLcPrompt + stringPtLc, {HistType::kTH1D, {axisPtLc}}); + registry.add("Efficiency/hPtCandMcGenPrompt", stringMcGenLcPrompt + stringPtLc, {HistType::kTH1D, {axisPtLc}}); + registry.add("Efficiency/hPtCandMcRecNonPrompt", stringMcRecoLcFd + stringPtLc, {HistType::kTH1D, {axisPtLc}}); + registry.add("Efficiency/hPtCandMcGenNonPrompt", stringMcGenLcFd + stringPtLc, {HistType::kTH1D, {axisPtLc}}); + registry.add("Efficiency/hPtCandMcGenDaughterInAcc", stringMcGenLcFd + stringPtLc, {HistType::kTH1D, {axisPtLc}}); auto hCandidates = registry.add("hCandidates", "Candidate count at different steps", {HistType::kStepTHnF, {axisPtLc, axisMultFT0M, {RecoDecay::OriginType::NonPrompt + 1, +RecoDecay::OriginType::None - 0.5, +RecoDecay::OriginType::NonPrompt + 0.5}}, kCandidateNSteps}); hCandidates->GetAxis(0)->SetTitle("#it{p}_{T} (GeV/#it{c})"); @@ -371,19 +374,19 @@ struct HfTaskCorrelationLcHadrons { ccdb->setLocalObjectValidityChecking(); ccdb->setCreatedNotAfter(ccdbNoLaterThan.value); - mEfficiencyPrompt = std::shared_ptr(ccdb->getForTimeStamp(promptEffCcdbPath, timestampCcdb)); + mEfficiencyPrompt = std::shared_ptr(ccdb->getForTimeStamp(promptEffCcdbPath, timestampCcdb)); if (mEfficiencyPrompt == nullptr) { LOGF(fatal, "Could not load efficiency histogram for trigger particles from %s", promptEffCcdbPath.value.c_str()); } LOGF(info, "Loaded trigger efficiency (prompt Lc) histogram from %s", promptEffCcdbPath.value.c_str()); - mEfficiencyFD = std::shared_ptr(ccdb->getForTimeStamp(fdEffCcdbPath, timestampCcdb)); + mEfficiencyFD = std::shared_ptr(ccdb->getForTimeStamp(fdEffCcdbPath, timestampCcdb)); if (mEfficiencyFD == nullptr) { LOGF(fatal, "Could not load efficiency histogram for trigger particles from %s", fdEffCcdbPath.value.c_str()); } LOGF(info, "Loaded feed-down Lc efficiency histogram from %s", fdEffCcdbPath.value.c_str()); - mEfficiencyAssociated = std::shared_ptr(ccdb->getForTimeStamp(associatedEffCcdbPath, timestampCcdb)); + mEfficiencyAssociated = std::shared_ptr(ccdb->getForTimeStamp(associatedEffCcdbPath, timestampCcdb)); if (mEfficiencyAssociated == nullptr) { LOGF(fatal, "Could not load efficiency histogram for associated particles from %s", associatedEffCcdbPath.value.c_str()); } @@ -442,6 +445,10 @@ struct HfTaskCorrelationLcHadrons { for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities float deltaPhi = pairEntry.deltaPhi(); + float cent = 0.; + if (useCentrality) { + cent = pairEntry.cent(); + } float deltaEta = pairEntry.deltaEta(); double ptLc = std::abs(pairEntry.ptLc()); double ptHadron = std::abs(pairEntry.ptHadron()); @@ -503,14 +510,13 @@ struct HfTaskCorrelationLcHadrons { if (fillSignAndMass) { registry.fill(HIST("hCorrel2DVsPtSignMass"), deltaPhi, deltaEta, ptLc, ptHadron, massLc, signPair, poolBin, efficiencyWeight); } - // check if correlation entry belongs to signal region, sidebands or is outside both, and fill correlation plots if (massLc > signalRegionInner->at(ptBinLc) && massLc < signalRegionOuter->at(ptBinLc)) { // in signal region if (fillSign) { registry.fill(HIST("hCorrel2DVsPtSignSignalRegion"), deltaPhi, deltaEta, ptLc, ptHadron, signPair, poolBin, efficiencyWeight); } else { - registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, cent, efficiencyWeight); } registry.fill(HIST("hCorrel2DPtIntSignalRegion"), deltaPhi, deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaEtaPtIntSignalRegion"), deltaEta, efficiencyWeight); @@ -521,11 +527,11 @@ struct HfTaskCorrelationLcHadrons { if (fillSign) { registry.fill(HIST("hCorrel2DVsPtSignSidebandLeft"), deltaPhi, deltaEta, ptLc, ptHadron, signPair, poolBin, efficiencyWeight); } else { - registry.fill(HIST("hCorrel2DVsPtSidebandLeft"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSidebandLeft"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, cent, efficiencyWeight); } registry.fill(HIST("hDeltaEtaPtIntSidebandLeft"), deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaPhiPtIntSidebandLeft"), deltaPhi, efficiencyWeight); - registry.fill(HIST("hCorrel2DVsPtSidebands"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSidebands"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, cent, efficiencyWeight); registry.fill(HIST("hCorrel2DPtIntSidebands"), deltaPhi, deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaEtaPtIntSidebands"), deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaPhiPtIntSidebands"), deltaPhi, efficiencyWeight); @@ -535,11 +541,11 @@ struct HfTaskCorrelationLcHadrons { if (fillSign) { registry.fill(HIST("hCorrel2DVsPtSignSidebandRight"), deltaPhi, deltaEta, ptLc, ptHadron, signPair, poolBin, efficiencyWeight); } else { - registry.fill(HIST("hCorrel2DVsPtSidebandRight"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSidebandRight"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, cent, efficiencyWeight); } registry.fill(HIST("hDeltaEtaPtIntSidebandRight"), deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaPhiPtIntSidebandRight"), deltaPhi, efficiencyWeight); - registry.fill(HIST("hCorrel2DVsPtSidebands"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSidebands"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, cent, efficiencyWeight); registry.fill(HIST("hCorrel2DPtIntSidebands"), deltaPhi, deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaEtaPtIntSidebands"), deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaPhiPtIntSidebands"), deltaPhi, efficiencyWeight); @@ -697,13 +703,13 @@ struct HfTaskCorrelationLcHadrons { registry.fill(HIST("hDeltaPhiPtIntSignalRegionMcRec"), deltaPhi, efficiencyWeight); if (isPhysicalPrimary) { registry.fill(HIST("hCorrel2DVsPtPhysicalPrimaryMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, statusLcPrompt, poolBin, efficiencyWeight); - if (statusLcPrompt == 1 && statusPromptHadron == 1) { + if (statusLcPrompt == 1 && statusPromptHadron == RecoDecay::OriginType::Prompt) { if (fillSign) { registry.fill(HIST("hCorrel2DVsPtSignSignalRegionPromptLcPromptHadronMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, signPair, poolBin, efficiencyWeight); } else { registry.fill(HIST("hCorrel2DVsPtSignalRegionPromptLcPromptHadronMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, efficiencyWeight); } - } else if (statusLcPrompt == 0 && statusPromptHadron == 2) { + } else if (statusLcPrompt == 0 && statusPromptHadron == RecoDecay::OriginType::NonPrompt) { if (fillSign) { registry.fill(HIST("hCorrel2DVsPtSignSignalRegionNonPromptLcNonPromptHadronMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, signPair, poolBin, efficiencyWeight); } else { @@ -796,7 +802,7 @@ struct HfTaskCorrelationLcHadrons { } else { registry.fill(HIST("hCorrel2DVsPtMcGenPrompt"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin); } - if (statusPromptHadron == 1) { + if (statusPromptHadron == RecoDecay::OriginType::Prompt) { if (fillSign) { registry.fill(HIST("hCorrel2DVsPtSignMcGenPromptLcPromptHadron"), deltaPhi, deltaEta, ptLc, ptHadron, signPair, poolBin); } else { @@ -809,7 +815,7 @@ struct HfTaskCorrelationLcHadrons { } else { registry.fill(HIST("hCorrel2DVsPtMcGenNonPrompt"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin); } - if (statusPromptHadron == 2) { + if (statusPromptHadron == RecoDecay::OriginType::NonPrompt) { if (fillSign) { registry.fill(HIST("hCorrel2DVsPtSignMcGenNonPromptLcNonPromptHadron"), deltaPhi, deltaEta, ptLc, ptHadron, signPair, poolBin); } else { From d44e68b1b43abfbd96b936cffbdfe8b2e5875ada Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Tue, 19 Aug 2025 01:34:11 +0200 Subject: [PATCH 095/986] [PWGLF] Fill histogram for efficiency correction (#12625) --- PWGLF/Tasks/Resonances/phipbpb.cxx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/PWGLF/Tasks/Resonances/phipbpb.cxx b/PWGLF/Tasks/Resonances/phipbpb.cxx index 521e505ebd2..5ab2cc0e35e 100644 --- a/PWGLF/Tasks/Resonances/phipbpb.cxx +++ b/PWGLF/Tasks/Resonances/phipbpb.cxx @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -230,6 +231,12 @@ struct phipbpb { histos.add("hVtxZ", "Vertex distribution in Z;Z (cm)", kTH1F, {{400, -20.0, 20.0}}); if (!fillv1) { + + histos.add("hKaonpIsotropic", "hKaonpIsotropic", HistType::kTHnSparseD, {{8, 0.0, 80.0}, {100, 0.0, 10.0}, {8, -0.8, 0.8}, {36, 0.0, TMath::Pi()}}); + histos.add("hKaonpData", "hKaonpData", HistType::kTHnSparseD, {{8, 0.0, 80.0}, {100, 0.0, 10.0}, {8, -0.8, 0.8}, {36, 0.0, TMath::Pi()}}); + histos.add("hKaonmIsotropic", "hKaonmIsotropic", HistType::kTHnSparseD, {{8, 0.0, 80.0}, {100, 0.0, 10.0}, {8, -0.8, 0.8}, {36, 0.0, TMath::Pi()}}); + histos.add("hKaonmData", "hKaonmData", HistType::kTHnSparseD, {{8, 0.0, 80.0}, {100, 0.0, 10.0}, {8, -0.8, 0.8}, {36, 0.0, TMath::Pi()}}); + histos.add("hTPCglobalmomcorr", "Momentum correlation", kTH3F, {{200, -10.0f, 10.0f}, {200, -10.0f, 10.0f}, {8, 0.0f, 80.0f}}); histos.add("hpTvsRapidity", "pT vs Rapidity", kTH2F, {{100, 0.0f, 10.0f}, {300, -1.5f, 1.5f}}); histos.add("hFTOCvsTPCNoCut", "Mult correlation FT0C vs. TPC without any cut", kTH2F, {{80, 0.0f, 80.0f}, {100, -0.5f, 5999.5f}}); @@ -501,6 +508,24 @@ struct phipbpb { return false; } + void fillHisoWithTGenPS(const ROOT::Math::PxPyPzMVector& Pphi_lab, double psi2, double ptMin, double etaMax, double centrality) + { + TLorentzVector parent; + double masses[2] = {0.493, 0.493}; + parent.SetPxPyPzE(Pphi_lab.Px(), Pphi_lab.Py(), Pphi_lab.Pz(), Pphi_lab.E()); + TGenPhaseSpace gen; + gen.SetDecay(parent, 2, masses); + gen.Generate(); + + TLorentzVector* K1 = gen.GetDecay(0); + TLorentzVector* K2 = gen.GetDecay(1); + + if (K1->Pt() > ptMin && std::abs(K1->Eta()) < etaMax) + histos.fill(HIST("hKaonpIsotropic"), centrality, K1->Pt(), K1->Eta(), GetPhiInRange(K1->Phi() - psi2)); + if (K2->Pt() > ptMin && std::abs(K2->Eta()) < etaMax) + histos.fill(HIST("hKaonmIsotropic"), centrality, K2->Pt(), K2->Eta(), GetPhiInRange(K2->Phi() - psi2)); + } + ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for bin"}; ConfigurableAxis axisMultiplicityClass{"axisMultiplicityClass", {20, 0, 100}, "multiplicity percentile for bin"}; ConfigurableAxis axisEPAngle{"axisEPAngle", {6, -TMath::Pi() / 2, TMath::Pi() / 2}, "event plane angle"}; @@ -728,6 +753,11 @@ struct phipbpb { histos.fill(HIST("hSparseV2SameEventCosDeltaPhi"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2, centrality); histos.fill(HIST("hSparseV2SameEventCos2DeltaPhi"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2acc, centrality); } + + histos.fill(HIST("hKaonpData"), centrality, KaonPlus.Pt(), KaonPlus.Eta(), GetPhiInRange(KaonPlus.Phi() - psiFT0C)); + histos.fill(HIST("hKaonmData"), centrality, KaonMinus.Pt(), KaonMinus.Eta(), GetPhiInRange(KaonMinus.Phi() - psiFT0C)); + fillHisoWithTGenPS(PhiMesonMother, psiFT0C, cfgCutPT, cfgCutEta, centrality); + histos.fill(HIST("hSparseV2SameEventCosDeltaPhiSquare"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2 * v2, centrality); histos.fill(HIST("hSparseV2SameEventCosDeltaPhiCube"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2 * v2 * v2, centrality); histos.fill(HIST("hSparseV2SameEventSinDeltaPhi"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2sin * QFT0C, centrality); From 0cb77fbd399372e9bdef351288970b5e9a1a7a84 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Tue, 19 Aug 2025 02:35:04 +0200 Subject: [PATCH 096/986] [Common] Add missing MultSelection for derived data option (#12626) --- Common/Tools/MultModule.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Common/Tools/MultModule.h b/Common/Tools/MultModule.h index d37f37a11fb..3623543a54d 100644 --- a/Common/Tools/MultModule.h +++ b/Common/Tools/MultModule.h @@ -761,6 +761,12 @@ class MultModule cursors.tableZDC(mults.multZNA, mults.multZNC, mults.multZEM1, mults.multZEM2, mults.multZPA, mults.multZPC); } + //_______________________________________________________________________ + // fill selections (for posterior derived analysis if requested) + if (internalOpts.mEnabledTables[kMultSelections]) { + cursors.multSelections(collision.selection_raw()); + } + //_______________________________________________________________________ // vertex-Z equalized signals if (internalOpts.mEnabledTables[kFV0MultZeqs]) { From 70aa8c248b583b793d0008f04a152f2927b14e75 Mon Sep 17 00:00:00 2001 From: Georgios Mantzaridis <62671855+gmantzar@users.noreply.github.com> Date: Tue, 19 Aug 2025 02:46:13 +0200 Subject: [PATCH 097/986] [PWGCF] Adding V0-V0 pair task (#12614) Co-authored-by: Bianca-Maria Popa --- .../FemtoDream/Core/femtoDreamDetaDphiStar.h | 104 ++++- PWGCF/FemtoDream/Tasks/CMakeLists.txt | 15 +- .../Tasks/femtoDreamPairTaskV0V0.cxx | 426 ++++++++++++++++++ 3 files changed, 533 insertions(+), 12 deletions(-) create mode 100644 PWGCF/FemtoDream/Tasks/femtoDreamPairTaskV0V0.cxx diff --git a/PWGCF/FemtoDream/Core/femtoDreamDetaDphiStar.h b/PWGCF/FemtoDream/Core/femtoDreamDetaDphiStar.h index 58dc6c9ded4..7dadb08df78 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamDetaDphiStar.h +++ b/PWGCF/FemtoDream/Core/femtoDreamDetaDphiStar.h @@ -16,11 +16,13 @@ #ifndef PWGCF_FEMTODREAM_CORE_FEMTODREAMDETADPHISTAR_H_ #define PWGCF_FEMTODREAM_CORE_FEMTODREAMDETADPHISTAR_H_ +#include "PWGCF/DataModel/FemtoDerived.h" + +#include "Framework/HistogramRegistry.h" + #include #include #include -#include "PWGCF/DataModel/FemtoDerived.h" -#include "Framework/HistogramRegistry.h" using namespace o2; using namespace o2::framework; @@ -98,6 +100,24 @@ class FemtoDreamDetaDphiStar } } } + if constexpr (mPartOneType == o2::aod::femtodreamparticle::ParticleType::kV0 && mPartTwoType == o2::aod::femtodreamparticle::ParticleType::kV0) { + for (int i = 0; i < 4; i++) { + std::string dirName = static_cast(dirNames[1]); + histdetadpi[i][0] = mHistogramRegistry->add((dirName + static_cast(histNames[0][i]) + static_cast(histNameSEorME[meORse])).c_str(), "; #Delta #eta; #Delta #phi^{*}", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpi[i][1] = mHistogramRegistry->add((dirName + static_cast(histNames[1][i]) + static_cast(histNameSEorME[meORse])).c_str(), "; #Delta #eta; #Delta #phi^{*}", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpi[i][2] = mHistogramRegistry->add((dirName + "at_PV_" + std::to_string(i) + "_before" + static_cast(histNameSEorME[meORse])).c_str(), "; #Delta #eta; #Delta #phi^{*}", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpi[i][3] = mHistogramRegistry->add((dirName + "at_PV_" + std::to_string(i) + "_after" + static_cast(histNameSEorME[meORse])).c_str(), "; #Delta #eta; #Delta #phi^{*}", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + if (plotForEveryRadii) { + for (int j = 0; j < 9; j++) { + histdetadpiRadii[i][j] = mHistogramRegistryQA->add((dirName + static_cast(histNamesRadii[i][j]) + static_cast(histNameSEorME[meORse])).c_str(), "; #Delta #eta; #Delta #phi^{*}", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + } + } + if (fillQA) { + histdetadpi_eta[i] = mHistogramRegistry->add((dirName + "dEtadPhi_Eta_" + std::to_string(i) + static_cast(histNameSEorME[meORse])).c_str(), "; #Delta #eta; #Delta #phi^{*}; #eta_{1}; #eta_{2}", kTHnSparseF, {{100, -0.15, 0.15}, {100, -0.15, 0.15}, {100, -0.8, 0.8}, {100, -0.8, 0.8}}); + histdetadpi_phi[i] = mHistogramRegistry->add((dirName + "dEtadPhi_Phi_" + std::to_string(i) + static_cast(histNameSEorME[meORse])).c_str(), "; #Delta #eta; #Delta #phi^{*}; #phi_{1}; #phi_{2}", kTHnSparseF, {{100, -0.15, 0.15}, {100, -0.15, 0.15}, {100, 0, 6.28}, {100, 0, 6.28}}); + } + } + } if constexpr (mPartOneType == o2::aod::femtodreamparticle::ParticleType::kTrack && mPartTwoType == o2::aod::femtodreamparticle::ParticleType::kCharmHadron) { for (int i = 0; i < Nprongs; i++) { std::string dirName = static_cast(dirNames[2]); @@ -293,6 +313,86 @@ class FemtoDreamDetaDphiStar } } } + return pass; + } else if constexpr (mPartOneType == o2::aod::femtodreamparticle::ParticleType::kV0 && mPartTwoType == o2::aod::femtodreamparticle::ParticleType::kV0) { + /// V0-V0 combination + // check if provided particles are in agreement with the class instantiation + if (part1.partType() != o2::aod::femtodreamparticle::ParticleType::kV0 || part2.partType() != o2::aod::femtodreamparticle::ParticleType::kV0) { + LOG(fatal) << "FemtoDreamDetaDphiStar: passed arguments don't agree with FemtoDreamDetaDphiStar instantiation! Please provide kV0,kV0 candidates."; + return false; + } + + bool pass = false; + int nhist = 0; + for (int i = 0; i < 2; i++) { + int indexOfDaughterPart1, indexOfDaughterPart2; + for (int j = 0; j < 2; j++) { + if (isMixedEventLambda) { + indexOfDaughterPart1 = part1.globalIndex() - 2 + i; + indexOfDaughterPart2 = part2.globalIndex() - 2 + j; + } else { + indexOfDaughterPart1 = part1.index() - 2 + i; + indexOfDaughterPart2 = part2.index() - 2 + j; + } + + auto daughterPart1 = particles.begin() + indexOfDaughterPart1; + auto daughterPart2 = particles.begin() + indexOfDaughterPart2; + auto deta = daughterPart1.eta() - daughterPart2.eta(); + auto dphi_AT_PV = daughterPart1.phi() - daughterPart2.phi(); + auto dphi_AT_SpecificRadii = PhiAtSpecificRadiiTPC(daughterPart1, radiiTPC) - PhiAtSpecificRadiiTPC(daughterPart2, radiiTPC); + bool sameCharge = false; + auto dphiAvg = AveragePhiStar(*daughterPart1, *daughterPart2, nhist, &sameCharge); + if (Q3 == 999) { + histdetadpi[nhist][0]->Fill(deta, dphiAvg); + histdetadpi[nhist][2]->Fill(deta, dphi_AT_PV); + if (fillQA) { + histdetadpi_eta[nhist]->Fill(deta, dphiAvg, daughterPart1.eta(), daughterPart2.eta()); + histdetadpi_phi[nhist]->Fill(deta, dphiAvg, daughterPart1.phi(), daughterPart2.phi()); + } + } + if (sameCharge) { + if (atWhichRadiiToSelect == 1) { + if (pow(dphiAvg, 2) / pow(deltaPhiMax, 2) + pow(deta, 2) / pow(deltaEtaMax, 2) < 1.) { + pass = true; + } else { + if (Q3 == 999) { + histdetadpi[nhist][1]->Fill(deta, dphiAvg); + histdetadpi[nhist][3]->Fill(deta, dphi_AT_PV); + } else if (Q3 < upperQ3LimitForPlotting) { + histdetadpi[nhist][1]->Fill(deta, dphiAvg); + histdetadpi[nhist][3]->Fill(deta, dphi_AT_PV); + } + } + } else if (atWhichRadiiToSelect == 0) { + if (pow(dphi_AT_PV, 2) / pow(deltaPhiMax, 2) + pow(deta, 2) / pow(deltaEtaMax, 2) < 1.) { + pass = true; + } else { + if (Q3 == 999) { + histdetadpi[nhist][1]->Fill(deta, dphiAvg); + histdetadpi[nhist][3]->Fill(deta, dphi_AT_PV); + } else if (Q3 < upperQ3LimitForPlotting) { + histdetadpi[nhist][1]->Fill(deta, dphiAvg); + histdetadpi[nhist][3]->Fill(deta, dphi_AT_PV); + } + } + } else if (atWhichRadiiToSelect == 2) { + if (pow(dphi_AT_SpecificRadii, 2) / pow(deltaPhiMax, 2) + pow(deta, 2) / pow(deltaEtaMax, 2) < 1.) { + pass = true; + } else { + if (Q3 == 999) { + histdetadpi[nhist][1]->Fill(deta, dphiAvg); + histdetadpi[nhist][3]->Fill(deta, dphi_AT_PV); + } else if (Q3 < upperQ3LimitForPlotting) { + histdetadpi[nhist][1]->Fill(deta, dphiAvg); + histdetadpi[nhist][3]->Fill(deta, dphi_AT_PV); + } + } + } + } + nhist += 1; + } + } + return pass; } else if constexpr (mPartOneType == o2::aod::femtodreamparticle::ParticleType::kTrack && mPartTwoType == o2::aod::femtodreamparticle::ParticleType::kCharmHadron) { // check if provided particles are in agreement with the class instantiation diff --git a/PWGCF/FemtoDream/Tasks/CMakeLists.txt b/PWGCF/FemtoDream/Tasks/CMakeLists.txt index 3341346bb24..933d50035a9 100644 --- a/PWGCF/FemtoDream/Tasks/CMakeLists.txt +++ b/PWGCF/FemtoDream/Tasks/CMakeLists.txt @@ -19,11 +19,6 @@ o2physics_add_dpl_workflow(femtodream-triplet-track-track-track PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(femtodream-triplet-track-track-track-pb-pb - SOURCES femtoDreamTripletTaskTrackTrackTrackPbPb.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(femtodream-pair-track-v0 SOURCES femtoDreamPairTaskTrackV0.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore @@ -59,12 +54,12 @@ o2physics_add_dpl_workflow(femtodream-collision-masker PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(femtodream-pair-efficiency - SOURCES femtoDreamPairEfficiency.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(femtodream-hash SOURCES femtoDreamHashTask.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(femtodream-pair-v0-v0 + SOURCES femtoDreamPairTaskV0V0.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) \ No newline at end of file diff --git a/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskV0V0.cxx b/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskV0V0.cxx new file mode 100644 index 00000000000..21be57205e3 --- /dev/null +++ b/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskV0V0.cxx @@ -0,0 +1,426 @@ +// Copyright 2019-2025 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 femtoDreamPairTaskV0V0.cxx +/// \brief Tasks that reads the track tables used for the pairing and builds pairs of two tracks +/// \author Andi Mathis, TU München, andreas.mathis@ph.tum.de +/// \author Georgios Mantzaridis, TU München, georgios.mantzaridis@tum.de +/// \author Anton Riedel, TU München, anton.riedel@tum.de +/// \author Bianca Popa, TU München, bianca.popa@tum.de + +#include "PWGCF/DataModel/FemtoDerived.h" +#include "PWGCF/FemtoDream/Core/femtoDreamContainer.h" +#include "PWGCF/FemtoDream/Core/femtoDreamDetaDphiStar.h" +#include "PWGCF/FemtoDream/Core/femtoDreamEventHisto.h" +#include "PWGCF/FemtoDream/Core/femtoDreamPairCleaner.h" +#include "PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h" +#include "PWGCF/FemtoDream/Core/femtoDreamUtils.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/Configurable.h" +#include "Framework/Expressions.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" + +#include "TRandom3.h" + +#include +#include +#include +#include + +using namespace o2::aod; +using namespace o2::soa; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::analysis::femtoDream; + +struct femtoDreamPairTaskV0V0 { + SliceCache cache; + Preslice perCol = aod::femtodreamparticle::fdCollisionId; + + /// General options + struct : ConfigurableGroup { + std::string prefix = std::string("Option"); + Configurable IsMC{"IsMC", false, "Enable additional Histogramms in the case of runninger over Monte Carlo"}; + Configurable Use4D{"Use4D", false, "Enable four dimensional histogramms (to be used only for analysis with high statistics): k* vs multiplicity vs multiplicity percentil vs mT"}; + Configurable ExtendedPlots{"ExtendedPlots", false, "Enable additional three dimensional histogramms. High memory consumption. Use for debugging"}; + Configurable HighkstarCut{"HighkstarCut", -1., "Set a cut for high k*, above which the pairs are rejected. Set it to -1 to deactivate it"}; + Configurable SameSpecies{"SameSpecies", true, "Set to true if particle 1 and particle 2 are the same species"}; + Configurable MixEventWithPairs{"MixEventWithPairs", false, "Only use events that contain particle 1 and partile 2 for the event mixing"}; + Configurable RandomizePair{"RandomizePair", false, "Randomly mix particle 1 and particle 2 in case both are identical"}; + Configurable CPROn{"CPROn", true, "Close Pair Rejection"}; + Configurable CPROld{"CPROld", false, "Set to FALSE to use fixed version of CPR (for testing now, will be default soon)"}; + Configurable CPRSepMeSe{"CPRSepMESE", true, "Use seperated plots for same and mixed event for CPR plots"}; + Configurable CPRPlotPerRadii{"CPRPlotPerRadii", false, "Plot CPR per radii"}; + Configurable CPRdeltaPhiMax{"CPRdeltaPhiMax", 0.01, "Max. Delta Phi for Close Pair Rejection"}; + Configurable CPRdeltaEtaMax{"CPRdeltaEtaMax", 0.01, "Max. Delta Eta for Close Pair Rejection"}; + Configurable DCACutPtDep{"DCACutPtDep", false, "Use pt dependent dca cut"}; + Configurable SmearingByOrigin{"SmearingByOrigin", false, "Obtain the smearing matrix differential in the MC origin of particle 1 and particle 2. High memory consumption"}; + ConfigurableAxis Dummy{"Dummy", {1, 0, 1}, "Dummy axis"}; + } Option; + + /// Event selection + struct : ConfigurableGroup { + std::string prefix = std::string("EventSel"); + Configurable MultMin{"MultMin", 0, "Minimum Multiplicity (MultNtr)"}; + Configurable MultMax{"MultMax", 99999, "Maximum Multiplicity (MultNtr)"}; + Configurable MultPercentileMin{"MultPercentileMin", 0, "Maximum Multiplicity Percentile"}; + Configurable MultPercentileMax{"MultPercentileMax", 100, "Minimum Multiplicity Percentile"}; + } EventSel; + + Filter EventMultiplicity = aod::femtodreamcollision::multNtr >= EventSel.MultMin && aod::femtodreamcollision::multNtr <= EventSel.MultMax; + Filter EventMultiplicityPercentile = aod::femtodreamcollision::multV0M >= EventSel.MultPercentileMin && aod::femtodreamcollision::multV0M <= EventSel.MultPercentileMax; + + using FilteredCollisions = soa::Filtered; + using FilteredCollision = FilteredCollisions::iterator; + using FilteredMCCollisions = soa::Filtered>; + using FilteredMCCollision = FilteredMCCollisions::iterator; + + using FilteredMaskedCollisions = soa::Filtered>; + using FilteredMaskedCollision = FilteredMaskedCollisions::iterator; + using FilteredMaskedMCCollisions = soa::Filtered>; + using FilteredMaskedMCCollision = FilteredMaskedMCCollisions::iterator; + + femtodreamcollision::BitMaskType BitMask = 0; + + /// Particle 1 (V0) + struct : ConfigurableGroup { + std::string prefix = std::string("V01"); + Configurable PDGCode{"PDGCode", 3122, "PDG code of particle 1 (V0)"}; + Configurable CutBit{"CutBit", 7518, "Selection bit for particle 1 (V0)"}; + Configurable ChildPos_CutBit{"ChildPos_CutBit", 210, "Selection bit for positive child of V0"}; + Configurable ChildPos_TPCBit{"ChildPos_TPCBit", 64, "PID TPC bit for positive child of V0"}; + Configurable ChildNeg_CutBit{"ChildNeg_CutBit", 209, "Selection bit for negative child of V0"}; + Configurable ChildNeg_TPCBit{"ChildNeg_TPCBit", 256, "PID TPC bit for negative child of V0"}; + + Configurable InvMassMin{"InvMassMin", 1.08, "Minimum invariant mass of Partricle 1 (particle) (V0)"}; + Configurable InvMassMax{"InvMassMax", 1.15, "Maximum invariant mass of Partricle 1 (particle) (V0)"}; + Configurable InvMassAntiMin{"InvMassAntiMin", 0., "Minimum invariant mass of Partricle 1 (antiparticle) (V0)"}; + Configurable InvMassAntiMax{"InvMassAntiMax", 999., "Maximum invariant mass of Partricle 1 (antiparticle) (V0)"}; + + Configurable PtMin{"PtMin", 0., "Minimum pT of Partricle 1 (V0)"}; + Configurable PtMax{"PtMax", 999., "Maximum pT of Partricle 1 (V0)"}; + Configurable EtaMin{"EtaMin", -10., "Minimum eta of Partricle 1 (V0)"}; + Configurable EtaMax{"EtaMax", 10., "Maximum eta of Partricle 1 (V0)"}; + } V01; + + /// Partition for particle 1 + Partition PartitionV01 = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kV0)) && + ((aod::femtodreamparticle::cut & V01.CutBit) == V01.CutBit) && + (aod::femtodreamparticle::pt > V01.PtMin) && + (aod::femtodreamparticle::pt < V01.PtMax) && + (aod::femtodreamparticle::eta > V01.EtaMin) && + (aod::femtodreamparticle::eta < V01.EtaMax) && + (aod::femtodreamparticle::mLambda > V01.InvMassMin) && + (aod::femtodreamparticle::mLambda < V01.InvMassMax) && + (aod::femtodreamparticle::mAntiLambda > V01.InvMassAntiMin) && + (aod::femtodreamparticle::mAntiLambda < V01.InvMassAntiMax); + + /// Histogramming for particle 1 + FemtoDreamParticleHisto trackHistoPartOne; + FemtoDreamParticleHisto posChildHistos; + FemtoDreamParticleHisto negChildHistos; + + /// Particle 2 (V0) + struct : ConfigurableGroup { + std::string prefix = std::string("V02"); + Configurable PDGCode{"PDGCode", 3122, "PDG code of particle 2 (V0)"}; + Configurable CutBit{"CutBit", 7518, "Selection bit for particle 2 (V0)"}; + Configurable ChildPos_CutBit{"ChildPos_CutBit", 210, "Selection bit for positive child of V0"}; + Configurable ChildPos_TPCBit{"ChildPos_TPCBit", 64, "PID TPC bit for positive child of V0"}; + Configurable ChildNeg_CutBit{"ChildNeg_CutBit", 209, "Selection bit for negative child of V0"}; + Configurable ChildNeg_TPCBit{"ChildNeg_TPCBit", 256, "PID TPC bit for negative child of V0"}; + + Configurable InvMassMin{"InvMassMin", 1.08, "Minimum invariant mass of Partricle 2 (particle) (V0)"}; + Configurable InvMassMax{"InvMassMax", 1.15, "Maximum invariant mass of Partricle 2 (particle) (V0)"}; + Configurable InvMassAntiMin{"InvMassAntiMin", 0., "Minimum invariant mass of Partricle 2 (antiparticle) (V0)"}; + Configurable InvMassAntiMax{"InvMassAntiMax", 999., "Maximum invariant mass of Partricle 2 (antiparticle) (V0)"}; + + Configurable PtMin{"PtMin", 0., "Minimum pT of Partricle 2 (V0)"}; + Configurable PtMax{"PtMax", 999., "Maximum pT of Partricle 2 (V0)"}; + Configurable EtaMin{"EtaMin", -10., "Minimum eta of Partricle 2 (V0)"}; + Configurable EtaMax{"EtaMax", 10., "Maximum eta of Partricle 2 (V0)"}; + } V02; + + /// Partition for particle 2 + Partition PartitionV02 = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kV0)) && + ((aod::femtodreamparticle::cut & V02.CutBit) == V02.CutBit) && + (aod::femtodreamparticle::pt > V02.PtMin) && + (aod::femtodreamparticle::pt < V02.PtMax) && + (aod::femtodreamparticle::eta > V02.EtaMin) && + (aod::femtodreamparticle::eta < V02.EtaMax) && + (aod::femtodreamparticle::mLambda > V02.InvMassMin) && + (aod::femtodreamparticle::mLambda < V02.InvMassMax) && + (aod::femtodreamparticle::mAntiLambda > V02.InvMassAntiMin) && + (aod::femtodreamparticle::mAntiLambda < V02.InvMassAntiMax); + + /// Histogramming for Event + FemtoDreamEventHisto eventHisto; + + /// Binning configurables + struct : ConfigurableGroup { + std::string prefix = std::string("Binning"); + ConfigurableAxis TempFitVarTrack{"TempFitVarTrack", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot (Track)"}; + ConfigurableAxis TempFitVarV0{"TempFitVarV0", {300, 0.9, 1}, "binning of the TempFitVar in the pT vs. TempFitVar plot (V0)"}; + ConfigurableAxis TempFitVarV0Child{"TempFitVarV0Child", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot (V0 child)"}; + ConfigurableAxis InvMass{"InvMass", {200, 1, 1.2}, "InvMass binning"}; + ConfigurableAxis pTTrack{"pTTrack", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot (Track)"}; + ConfigurableAxis pTV0{"pTV0", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot (V0)"}; + ConfigurableAxis pTV0Child{"pTV0Child", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot (V0)"}; + ConfigurableAxis pT{"pT", {20, 0.5, 4.05}, "pT binning"}; + ConfigurableAxis kstar{"kstar", {1500, 0., 6.}, "binning kstar"}; + ConfigurableAxis kT{"kT", {150, 0., 9.}, "binning kT"}; + ConfigurableAxis mT{"mT", {225, 0., 7.5}, "binning mT"}; + ConfigurableAxis multTempFit{"multTempFit", {1, 0, 1}, "multiplicity for the TempFitVar plot"}; + } Binning; + + struct : ConfigurableGroup { + std::string prefix = "Binning4D"; + ConfigurableAxis kstar{"kstar", {1500, 0., 6.}, "binning kstar for the 4Dimensional plot: k* vs multiplicity vs multiplicity percentile vs mT (set <> to true)"}; + ConfigurableAxis mT{"mT", {VARIABLE_WIDTH, 1.02f, 1.14f, 1.20f, 1.26f, 1.38f, 1.56f, 1.86f, 4.50f}, "mT Binning for the 4Dimensional plot: k* vs multiplicity vs multiplicity percentile vs mT (set <> to true)"}; + ConfigurableAxis mult{"mult", {VARIABLE_WIDTH, 0.0f, 4.0f, 8.0f, 12.0f, 16.0f, 20.0f, 24.0f, 28.0f, 32.0f, 36.0f, 40.0f, 44.0f, 48.0f, 52.0f, 56.0f, 60.0f, 64.0f, 68.0f, 72.0f, 76.0f, 80.0f, 84.0f, 88.0f, 92.0f, 96.0f, 100.0f, 200.0f}, "multiplicity Binning for the 4Dimensional plot: k* vs multiplicity vs multiplicity percentile vs mT (set <> to true)"}; + ConfigurableAxis multPercentile{"multPercentile", {10, 0.0f, 100.0f}, "multiplicity percentile Binning for the 4Dimensional plot: k* vs multiplicity vs multiplicity percentile vs mT (set <> to true)"}; + } Binning4D; + + // Mixing configurables + struct : ConfigurableGroup { + std::string prefix = "Mixing"; + ConfigurableAxis MultMixBins{"MultMixBins", {VARIABLE_WIDTH, 0.0f, 4.0f, 8.0f, 12.0f, 16.0f, 20.0f, 24.0f, 28.0f, 32.0f, 36.0f, 40.0f, 44.0f, 48.0f, 52.0f, 56.0f, 60.0f, 64.0f, 68.0f, 72.0f, 76.0f, 80.0f, 84.0f, 88.0f, 92.0f, 96.0f, 100.0f, 200.0f}, "Mixing bins - multiplicity"}; + ConfigurableAxis MultPercentileMixBins{"MultPercentileMixBins", {VARIABLE_WIDTH, 0.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.0f}, "Mixing bins - multiplicity percentile"}; + ConfigurableAxis VztxMixBins{"VztxMixBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; + Configurable Depth{"Depth", 5, "Number of events for mixing"}; + Configurable Policy{"Policy", 0, "Binning policy for mixing - 0: multiplicity, 1: multipliciy percentile, 2: both"}; + } Mixing; + + ColumnBinningPolicy colBinningMult{{Mixing.VztxMixBins, Mixing.MultMixBins}, true}; + ColumnBinningPolicy colBinningMultPercentile{{Mixing.VztxMixBins, Mixing.MultPercentileMixBins}, true}; + ColumnBinningPolicy colBinningMultMultPercentile{{Mixing.VztxMixBins, Mixing.MultMixBins, Mixing.MultPercentileMixBins}, true}; + + FemtoDreamContainer sameEventCont; + FemtoDreamContainer mixedEventCont; + // FemtoDreamPairCleaner pairCleaner; + FemtoDreamDetaDphiStar pairCloseRejectionSE; + FemtoDreamDetaDphiStar pairCloseRejectionME; + /// Histogram output + HistogramRegistry Registry{"Output", {}, OutputObjHandlingPolicy::AnalysisObject}; + + TRandom3* random; + + void init(InitContext&) + { + // setup columnpolicy for binning + colBinningMult = {{Mixing.VztxMixBins, Mixing.MultMixBins}, true}; + colBinningMultPercentile = {{Mixing.VztxMixBins, Mixing.MultPercentileMixBins}, true}; + colBinningMultMultPercentile = {{Mixing.VztxMixBins, Mixing.MultMixBins, Mixing.MultPercentileMixBins}, true}; + + if (Option.RandomizePair.value) { + random = new TRandom3(0); + } + eventHisto.init(&Registry, Option.IsMC); + trackHistoPartOne.init(&Registry, Binning.multTempFit, Option.Dummy, Binning.pT, Option.Dummy, Option.Dummy, Binning.TempFitVarV0, Option.Dummy, Option.Dummy, Option.Dummy, Option.Dummy, Binning.InvMass, Option.Dummy, Option.IsMC, V01.PDGCode); + posChildHistos.init(&Registry, Binning.multTempFit, Option.Dummy, Binning.pTV0Child, Option.Dummy, Option.Dummy, Binning.TempFitVarV0Child, Option.Dummy, Option.Dummy, Option.Dummy, Option.Dummy, Option.Dummy, Option.Dummy, false, 0); + negChildHistos.init(&Registry, Binning.multTempFit, Option.Dummy, Binning.pTV0Child, Option.Dummy, Option.Dummy, Binning.TempFitVarV0Child, Option.Dummy, Option.Dummy, Option.Dummy, Option.Dummy, Option.Dummy, Option.Dummy, false, 0); + + sameEventCont.init(&Registry, + Binning.kstar, Binning.pT, Binning.kT, Binning.mT, Mixing.MultMixBins, Mixing.MultPercentileMixBins, + Binning4D.kstar, Binning4D.mT, Binning4D.mult, Binning4D.multPercentile, + Option.IsMC, Option.Use4D, Option.ExtendedPlots, + Option.HighkstarCut, + Option.SmearingByOrigin); + + mixedEventCont.init(&Registry, + Binning.kstar, Binning.pT, Binning.kT, Binning.mT, Mixing.MultMixBins, Mixing.MultPercentileMixBins, + Binning4D.kstar, Binning4D.mT, Binning4D.mult, Binning4D.multPercentile, + Option.IsMC, Option.Use4D, Option.ExtendedPlots, + Option.HighkstarCut, + Option.SmearingByOrigin); + sameEventCont.setPDGCodes(V01.PDGCode, V02.PDGCode); + mixedEventCont.setPDGCodes(V01.PDGCode, V02.PDGCode); + // pairCleaner.init(&Registry); + + if (Option.CPROn.value) { + pairCloseRejectionSE.init(&Registry, &Registry, Option.CPRdeltaPhiMax.value, Option.CPRdeltaEtaMax.value, Option.CPRPlotPerRadii.value, 1, Option.CPROld.value); + pairCloseRejectionME.init(&Registry, &Registry, Option.CPRdeltaPhiMax.value, Option.CPRdeltaEtaMax.value, Option.CPRPlotPerRadii.value, 2, Option.CPROld.value); + } + }; + + template + void fillCollision(CollisionType col) + { + eventHisto.fillQA(col); + } + + /// This function processes the same event and takes care of all the histogramming + /// \todo the trivial loops over the tracks should be factored out since they will be common to all combinations of T-T, T-V0, V0-V0, ... + /// @tparam PartitionType + /// @tparam PartType + /// @tparam isMC: enables Monte Carlo truth specific histograms + /// @param groupPartsOne partition for the first particle passed by the process function + /// @param groupPartsTwo partition for the second particle passed by the process function + /// @param parts femtoDreamParticles table (in case of Monte Carlo joined with FemtoDreamMCLabels) + /// @param magFieldTesla magnetic field of the collision + /// @param multCol multiplicity of the collision + template + void doSameEvent(PartitionType SliceV01, PartitionType SliceV02, PartType parts, Collision col) + { + for (auto& v0 : SliceV01) { + const auto& posChild = parts.iteratorAt(v0.index() - 2); + const auto& negChild = parts.iteratorAt(v0.index() - 1); + if (((posChild.cut() & V01.ChildPos_CutBit) == V01.ChildPos_CutBit) && + ((posChild.pidcut() & V01.ChildPos_TPCBit) == V01.ChildPos_TPCBit) && + ((negChild.cut() & V01.ChildNeg_CutBit) == V01.ChildNeg_CutBit) && + ((negChild.pidcut() & V01.ChildNeg_TPCBit) == V01.ChildNeg_TPCBit)) { + trackHistoPartOne.fillQA(v0, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + posChildHistos.fillQA(posChild, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + negChildHistos.fillQA(negChild, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + } + } + + /// Now build the combinations + float rand = 0.; + if (Option.SameSpecies.value) { + for (auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(SliceV01, SliceV02))) { + const auto& posChild_1 = parts.iteratorAt(p1.index() - 2); + const auto& negChild_1 = parts.iteratorAt(p1.index() - 1); + const auto& posChild_2 = parts.iteratorAt(p2.index() - 2); + const auto& negChild_2 = parts.iteratorAt(p2.index() - 1); + if (((posChild_1.cut() & V01.ChildPos_CutBit) == V01.ChildPos_CutBit) && + ((posChild_1.pidcut() & V01.ChildPos_TPCBit) == V01.ChildPos_TPCBit) && + ((negChild_1.cut() & V01.ChildNeg_CutBit) == V01.ChildNeg_CutBit) && + ((negChild_1.pidcut() & V01.ChildNeg_TPCBit) == V01.ChildNeg_TPCBit) && + ((posChild_2.cut() & V02.ChildPos_CutBit) == V02.ChildPos_CutBit) && + ((posChild_2.pidcut() & V02.ChildPos_TPCBit) == V02.ChildPos_TPCBit) && + ((negChild_2.cut() & V02.ChildNeg_CutBit) == V02.ChildNeg_CutBit) && + ((negChild_2.pidcut() & V02.ChildNeg_TPCBit) == V02.ChildNeg_TPCBit)) { + + if (Option.CPROn.value) { + if (pairCloseRejectionSE.isClosePair(p1, p2, parts, col.magField())) { + continue; + } + } + /* + // track cleaning + if (!pairCleaner.isCleanPair(p1, p2, parts)) { + continue; + } + */ + + if (Option.RandomizePair.value) { + rand = random->Rndm(); + } + if (rand <= 0.5) { + sameEventCont.setPair(p1, p2, col.multNtr(), col.multV0M(), Option.Use4D, Option.ExtendedPlots, Option.SmearingByOrigin); + } else { + sameEventCont.setPair(p2, p1, col.multNtr(), col.multV0M(), Option.Use4D, Option.ExtendedPlots, Option.SmearingByOrigin); + } + } + } + } else { + for (auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(SliceV01, SliceV02))) { + if (Option.CPROn.value) { + if (pairCloseRejectionSE.isClosePair(p1, p2, parts, col.magField())) { + continue; + } + } + /* + // track cleaning + if (!pairCleaner.isCleanPair(p1, p2, parts)) { + continue; + } + */ + sameEventCont.setPair(p1, p2, col.multNtr(), col.multV0M(), Option.Use4D, Option.ExtendedPlots, Option.SmearingByOrigin); + } + } + } + + /// process function for to call doSameEvent with Data + /// \param col subscribe to the collision table (Data) + /// \param parts subscribe to the femtoDreamParticleTable + void processSameEvent(FilteredCollision& col, o2::aod::FDParticles& parts) + { + fillCollision(col); + auto SliceV01 = PartitionV01->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); + auto SliceV02 = PartitionV02->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); + if (SliceV01.size() == 0 && SliceV02.size() == 0) { + return; + } + doSameEvent(SliceV01, SliceV02, parts, col); + } + PROCESS_SWITCH(femtoDreamPairTaskV0V0, processSameEvent, "Enable processing same event", true); + + template + void doMixedEvent_NotMasked(CollisionType& cols, PartType& parts, PartitionType& part1, PartitionType& part2, BinningType policy) + { + for (auto const& [collision1, collision2] : soa::selfCombinations(policy, Mixing.Depth.value, -1, cols, cols)) { + auto SliceV01 = part1->sliceByCached(aod::femtodreamparticle::fdCollisionId, collision1.globalIndex(), cache); + auto SliceV02 = part2->sliceByCached(aod::femtodreamparticle::fdCollisionId, collision2.globalIndex(), cache); + if (SliceV01.size() == 0 || SliceV02.size() == 0) { + continue; + } + for (auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(SliceV01, SliceV02))) { + const auto& posChild_1 = parts.iteratorAt(p1.index() - 2); + const auto& negChild_1 = parts.iteratorAt(p1.index() - 1); + const auto& posChild_2 = parts.iteratorAt(p2.index() - 2); + const auto& negChild_2 = parts.iteratorAt(p2.index() - 1); + if (((posChild_1.cut() & V01.ChildPos_CutBit) == V01.ChildPos_CutBit) && + ((posChild_1.pidcut() & V01.ChildPos_TPCBit) == V01.ChildPos_TPCBit) && + ((negChild_1.cut() & V01.ChildNeg_CutBit) == V01.ChildNeg_CutBit) && + ((negChild_1.pidcut() & V01.ChildNeg_TPCBit) == V01.ChildNeg_TPCBit) && + ((posChild_2.cut() & V02.ChildPos_CutBit) == V02.ChildPos_CutBit) && + ((posChild_2.pidcut() & V02.ChildPos_TPCBit) == V02.ChildPos_TPCBit) && + ((negChild_2.cut() & V02.ChildNeg_CutBit) == V02.ChildNeg_CutBit) && + ((negChild_2.pidcut() & V02.ChildNeg_TPCBit) == V02.ChildNeg_TPCBit)) { + + if (Option.CPROn.value) { + if (pairCloseRejectionME.isClosePair(p1, p2, parts, collision1.magField())) { + continue; + } + } + mixedEventCont.setPair(p1, p2, collision1.multNtr(), collision1.multV0M(), Option.Use4D, Option.ExtendedPlots, Option.SmearingByOrigin); + } + } + } + } + + /// process function for to call doMixedEvent with Data + /// @param cols subscribe to the collisions table (Data) + /// @param parts subscribe to the femtoDreamParticleTable + void processMixedEvent(FilteredCollisions& cols, o2::aod::FDParticles& parts) + { + switch (Mixing.Policy.value) { + case femtodreamcollision::kMult: + doMixedEvent_NotMasked(cols, parts, PartitionV01, PartitionV02, colBinningMult); + break; + case femtodreamcollision::kMultPercentile: + doMixedEvent_NotMasked(cols, parts, PartitionV01, PartitionV02, colBinningMultPercentile); + break; + case femtodreamcollision::kMultMultPercentile: + doMixedEvent_NotMasked(cols, parts, PartitionV01, PartitionV02, colBinningMultMultPercentile); + break; + default: + LOG(fatal) << "Invalid binning policiy specifed. Breaking..."; + } + } + PROCESS_SWITCH(femtoDreamPairTaskV0V0, processMixedEvent, "Enable processing mixed events", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{ + adaptAnalysisTask(cfgc), + }; + return workflow; +} From 41df74dd1102bc1c78d000c5c051686e58d144ef Mon Sep 17 00:00:00 2001 From: Victor Gonzalez Date: Tue, 19 Aug 2025 04:48:20 +0200 Subject: [PATCH 098/986] [PWGCF] DptDpt - Multiplicity observables limits for each system (#12628) Co-authored-by: Victor --- PWGCF/TableProducer/dptDptFilter.cxx | 91 ++++++------ PWGCF/TableProducer/dptDptFilter.h | 198 +++++++++++++++++++++------ 2 files changed, 200 insertions(+), 89 deletions(-) diff --git a/PWGCF/TableProducer/dptDptFilter.cxx b/PWGCF/TableProducer/dptDptFilter.cxx index ee44859500f..2fe925102b8 100644 --- a/PWGCF/TableProducer/dptDptFilter.cxx +++ b/PWGCF/TableProducer/dptDptFilter.cxx @@ -109,9 +109,20 @@ static const std::vector beforeAfterName = {"before", ""}; static const std::vector beforeAfterSufix = {"B", "A"}; /* helpers for the multiplicity axes definition */ -#define DPTDPTCENTRALITYAXIS 105, -0.5f, 104.5f -#define DPTDPTMULTIPLIICTYAXIS 1001, -0.5f, 1000.5f -#define DPTDPTFWMULTIPLICITYAXIS 1000, 0.0f, 100000.0f +static constexpr float MultiplicityUpperLimitBase[11][8] = { + /* T0A, T0C, T0M, V0A, V0C, V0M, tracks, PV contr. tracks */ + {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 100e3f, 10e3f, 400.0f}, /* no system */ + {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 100e3f, 10e3f, 400.0f}, /* pp Run2 */ + {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 100e3f, 10e3f, 400.0f}, /* pPb Run2 */ + {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 100e3f, 10e3f, 400.0f}, /* Pbp Run2 */ + {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 100e3f, 10e3f, 400.0f}, /* PbPb Run2 */ + {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 100e3f, 10e3f, 400.0f}, /* XeXe Run2 */ + {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 100e3f, 10e3f, 400.0f}, /* pp Run3 */ + {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 100e3f, 10e3f, 400.0f}, /* PbPb Run3 */ + {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 100e3f, 10e3f, 400.0f}, /* NeNe Run3 */ + {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 100e3f, 10e3f, 400.0f}, /* OO Run3 */ + {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 100e3f, 10e3f, 400.0f} /* pO Run3 */ +}; //============================================================================================ // The DptDptFilter histogram objects @@ -403,6 +414,7 @@ struct DptDptFilter { Configurable minOrbit{"minOrbit", -1, "Lowest orbit to track"}; Configurable maxOrbit{"maxOrbit", INT64_MAX, "Highest orbit to track"}; Configurable rctSource{"rctSource", "None", "RCT selection source: None,CBT,CBT_hadronPID,CBT_electronPID,CBT_calo,CBT_muon,CBT_muon_glo. Default: None"}; + Configurable> multiplicityUpperLimit{"multiplicityUpperLimit", {&MultiplicityUpperLimitBase[0][0], 11, 8, {systemExternalNamesMap.at(0), systemExternalNamesMap.at(1), systemExternalNamesMap.at(2), systemExternalNamesMap.at(3), systemExternalNamesMap.at(4), systemExternalNamesMap.at(5), systemExternalNamesMap.at(6), systemExternalNamesMap.at(7), systemExternalNamesMap.at(8), systemExternalNamesMap.at(9), systemExternalNamesMap.at(10)}, {multiplicitySourceConfigNamesMap.at(0), multiplicitySourceConfigNamesMap.at(1), multiplicitySourceConfigNamesMap.at(2), multiplicitySourceConfigNamesMap.at(3), multiplicitySourceConfigNamesMap.at(4), multiplicitySourceConfigNamesMap.at(5), multiplicitySourceConfigNamesMap.at(6), multiplicitySourceConfigNamesMap.at(7)}}, "Upper limits for the multiplicity observables"}; struct : ConfigurableGroup { std::string prefix = "cfgEventSelection.occupancySelection"; Configurable occupancyEstimation{"occupancyEstimation", "None", "Occupancy estimation: None, Tracks, FT0C. Default None"}; @@ -410,7 +422,7 @@ struct DptDptFilter { Configurable maxOccupancy{"maxOccupancy", 1e6f, "Maximum allowed occupancy. Depends on the occupancy estimation"}; } occupancySelection; } cfgEventSelection; - Configurable cfgSystem{"cfgSystem", "PbPb", "System: pp, PbPb, Pbp, pPb, XeXe, ppRun3, PbPbRun3. Default PbPb"}; + Configurable cfgSystem{"cfgSystem", "PbPb", "System: Auto, pp, PbPb, Pbp, pPb, XeXe, ppRun3, PbPbRun3. Default PbPb"}; Configurable cfgDataType{"cfgDataType", "data", "Data type: data, datanoevsel, MC, FastMC, OnTheFlyMC. Default data"}; Configurable cfgTriggSel{"cfgTriggSel", "MB", "Trigger selection: MB,VTXTOFMATCHED,VTXTRDMATCHED,VTXTRDTOFMATCHED,None. Default MB"}; Configurable cfgCentSpec{"cfgCentSpec", "00-10,10-20,20-30,30-40,40-50,50-60,60-70,70-80", "Centrality/multiplicity ranges in min-max separated by commas"}; @@ -485,6 +497,7 @@ struct DptDptFilter { /* if the system type is not known at this time, we have to put the initialization somewhere else */ fSystem = getSystemType(cfgSystem); + fLhcRun = multRunForSystemMap.at(fSystem); fDataType = getDataType(cfgDataType); /* create the output list which will own the task histograms */ @@ -509,44 +522,40 @@ struct DptDptFilter { fhTriggerSelectionCorrelations->GetXaxis()->SetBinLabel(ixy + 1, TString::Format("#color[%d]{%s}", triggerSelectionFlags.test(ixy) ? 2 : 1, triggerSelectionExternalNamesMap.at(ixy).c_str()).Data()); fhTriggerSelectionCorrelations->GetYaxis()->SetBinLabel(ixy + 1, TString::Format("#color[%d]{%s}", triggerSelectionFlags.test(ixy) ? 2 : 1, triggerSelectionExternalNamesMap.at(ixy).c_str()).Data()); } - /* TODO: proper axes and axes titles according to the system; still incomplete */ - std::string multestimator = getCentMultEstimatorName(fCentMultEstimator); - if (fSystem > kPbp) { - fhCentMultB = new TH1F("CentralityB", "Centrality before cut; centrality (%)", 100, 0, 100); - fhCentMultA = new TH1F("CentralityA", "Centrality; centrality (%)", 100, 0, 100); - fhMultB = new TH1F("MultB", TString::Format("%s Multiplicity before cut;%s Multiplicity;Collisions", multestimator.c_str(), multestimator.c_str()), 4001, -0.5, 4000.5); - fhMultA = new TH1F("MultA", TString::Format("%s Multiplicity;%s Multiplicity;Collisions", multestimator.c_str(), multestimator.c_str()), 4001, -0.5, 4000.5); - } else { - /* for pp, pPb and Pbp systems use multiplicity instead */ - fhCentMultB = new TH1F("MultiplicityB", "Multiplicity before cut; multiplicity (%)", 100, 0, 100); - fhCentMultA = new TH1F("MultiplicityA", "Multiplicity; multiplicity (%)", 100, 0, 100); - fhMultB = new TH1F("MultB", TString::Format("%s Multiplicity before cut;%s Multiplicity;Collisions", multestimator.c_str(), multestimator.c_str()), 601, -0.5, 600.5); - fhMultA = new TH1F("MultA", TString::Format("%s Multiplicity;%s Multiplicity;Collisions", multestimator.c_str(), multestimator.c_str()), 601, -0.5, 600.5); - } fhVertexZB = new TH1F("VertexZB", "Vertex Z; z_{vtx}", 60, -15, 15); fhVertexZA = new TH1F("VertexZA", "Vertex Z; z_{vtx}", zvtxbins, zvtxlow, zvtxup); +/* helpers for the multiplicity/centrality axes definition */ +#define DPTDPTCENTRALITYAXIS 105, -0.5f, 104.5f +#define DPTDPTMULTIPLICITYAXIS(est) 1001, -0.5f, cfgEventSelection.multiplicityUpperLimit->getData()[fSystem][est] - 0.5f + + std::string multestimator = getCentMultEstimatorName(fCentMultEstimator); + fhCentMultB = new TH1F("CentralityB", "Centrality before cut; centrality (%)", DPTDPTCENTRALITYAXIS); + fhCentMultA = new TH1F("CentralityA", "Centrality; centrality (%)", DPTDPTCENTRALITYAXIS); + fhMultB = new TH1F("MultB", TString::Format("%s Multiplicity before cut;%s Multiplicity;Collisions", multestimator.c_str(), multestimator.c_str()), DPTDPTMULTIPLICITYAXIS(estimatorMultiplicitySourceMap.at(fCentMultEstimator))); + fhMultA = new TH1F("MultA", TString::Format("%s Multiplicity;%s Multiplicity;Collisions", multestimator.c_str(), multestimator.c_str()), DPTDPTMULTIPLICITYAXIS(estimatorMultiplicitySourceMap.at(fCentMultEstimator))); + if (cfgEventSelection.fillQc) { /* the quality control histograms */ for (int i = 0; i < BeforeAfterNOOFTIMES; ++i) { - fhMultiplicityVsCentrality[i] = new TH2F(TString::Format("MultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;Centrality (%%);Number of tracks", beforeAfterName[i].c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLIICTYAXIS); - fhMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsT0cMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0C Multiplicity;Number of tracks", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS, DPTDPTMULTIPLIICTYAXIS); - fhMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsT0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0A Multiplicity;Number of tracks", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS, DPTDPTMULTIPLIICTYAXIS); - fhMultiplicityVsV0aMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsV0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;V0A Multiplicity;Number of tracks", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS, DPTDPTMULTIPLIICTYAXIS); - fhMultiplicityVsPvMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsPvMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;PV contributors;Number of tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLIICTYAXIS, DPTDPTMULTIPLIICTYAXIS); - fhPvMultiplicityVsCentrality[i] = new TH2F(TString::Format("PvMultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;Centrality (%%);PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLIICTYAXIS); - fhPvMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("PvMultiplicityVsT0cMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0C multiplicity;PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS, DPTDPTMULTIPLIICTYAXIS); - fhPvMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("PvMultiplicityVsT0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0A multiplicity;PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS, DPTDPTMULTIPLIICTYAXIS); - fhPvMultiplicityVsV0aMultiplicity[i] = new TH2F(TString::Format("PvMultiplicityVsV0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;V0A multiplicity;PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS, DPTDPTMULTIPLIICTYAXIS); - fhV0aMultiplicityVsCentrality[i] = new TH2F(TString::Format("V0aMultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;Centrality (%%);V0A multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTFWMULTIPLICITYAXIS); - fhV0aMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("V0aMultiplicityVsT0cMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0C multiplicity;V0A multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS, DPTDPTFWMULTIPLICITYAXIS); - fhV0aMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("V0aMultiplicityVsT0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0A multiplicity;V0A multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS, DPTDPTFWMULTIPLICITYAXIS); - fhT0cMultiplicityVsCentrality[i] = new TH2F(TString::Format("T0cMultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;Centrality (%%);T0C multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTFWMULTIPLICITYAXIS); - fhT0cMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("T0cMultiplicityVsT0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0A multiplicity;T0C multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS, DPTDPTFWMULTIPLICITYAXIS); - fhT0CentralityVsCentrality[i] = new TH2F(TString::Format("T0CentralityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;Centrality (%%);T0 centrality(%%)", beforeAfterName[i].c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTCENTRALITYAXIS); - fhV0aCentralityVsCentrality[i] = new TH2F(TString::Format("V0aCentralityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;Centrality (%%);V0A centrality (%%)", beforeAfterName[i].c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTCENTRALITYAXIS); - fhNtpvCentralityVsCentrality[i] = new TH2F(TString::Format("NtpvCentralityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;Centrality (%%);NTPV centrality (%%)", beforeAfterName[i].c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTCENTRALITYAXIS); + fhMultiplicityVsCentrality[i] = new TH2F(TString::Format("MultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);Number of tracks", beforeAfterName[i].c_str(), multestimator.c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); + fhMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsT0cMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0C Multiplicity;Number of tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0C), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); + fhMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsT0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0A Multiplicity;Number of tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0A), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); + fhMultiplicityVsV0aMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsV0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;V0A Multiplicity;Number of tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceV0A), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); + fhMultiplicityVsPvMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsPvMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;PV contributors;Number of tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); + fhPvMultiplicityVsCentrality[i] = new TH2F(TString::Format("PvMultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);PV contributors", beforeAfterName[i].c_str(), multestimator.c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); + fhPvMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("PvMultiplicityVsT0cMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0C multiplicity;PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0C), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); + fhPvMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("PvMultiplicityVsT0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0A multiplicity;PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0A), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); + fhPvMultiplicityVsV0aMultiplicity[i] = new TH2F(TString::Format("PvMultiplicityVsV0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;V0A multiplicity;PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceV0A), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); + fhV0aMultiplicityVsCentrality[i] = new TH2F(TString::Format("V0aMultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);V0A multiplicity", beforeAfterName[i].c_str(), multestimator.c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourceV0A)); + fhV0aMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("V0aMultiplicityVsT0cMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0C multiplicity;V0A multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0C), DPTDPTMULTIPLICITYAXIS(MultSourceV0A)); + fhV0aMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("V0aMultiplicityVsT0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0A multiplicity;V0A multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0A), DPTDPTMULTIPLICITYAXIS(MultSourceV0A)); + fhT0cMultiplicityVsCentrality[i] = new TH2F(TString::Format("T0cMultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);T0C multiplicity", beforeAfterName[i].c_str(), multestimator.c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourceT0C)); + fhT0cMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("T0cMultiplicityVsT0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0A multiplicity;T0C multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0A), DPTDPTMULTIPLICITYAXIS(MultSourceT0C)); + fhT0CentralityVsCentrality[i] = new TH2F(TString::Format("T0CentralityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);T0 centrality(%%)", beforeAfterName[i].c_str(), multestimator.c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTCENTRALITYAXIS); + fhV0aCentralityVsCentrality[i] = new TH2F(TString::Format("V0aCentralityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);V0A centrality (%%)", beforeAfterName[i].c_str(), multestimator.c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTCENTRALITYAXIS); + fhNtpvCentralityVsCentrality[i] = new TH2F(TString::Format("NtpvCentralityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);NTPV centrality (%%)", beforeAfterName[i].c_str(), multestimator.c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTCENTRALITYAXIS); } } @@ -586,16 +595,8 @@ struct DptDptFilter { if ((fDataType != kData) && (fDataType != kDataNoEvtSel)) { /* create the true data histograms */ - /* TODO: proper axes and axes titles according to the system; still incomplete */ - if (fSystem > kPbp) { - fhTrueCentMultB = new TH1F("TrueCentralityB", "Centrality before (truth); centrality (%)", 100, 0, 100); - fhTrueCentMultA = new TH1F("TrueCentralityA", "Centrality (truth); centrality (%)", 100, 0, 100); - } else { - /* for pp, pPb and Pbp systems use multiplicity instead */ - fhTrueCentMultB = new TH1F("TrueMultiplicityB", "Multiplicity before (truth); multiplicity (%)", 100, 0, 100); - fhTrueCentMultA = new TH1F("TrueMultiplicityA", "Multiplicity (truth); multiplicity (%)", 100, 0, 100); - } - + fhTrueCentMultB = new TH1F("TrueCentralityB", "Centrality before (truth); centrality (%)", 100, 0, 100); + fhTrueCentMultA = new TH1F("TrueCentralityA", "Centrality (truth); centrality (%)", 100, 0, 100); fhTrueVertexZB = new TH1F("TrueVertexZB", "Vertex Z before (truth); z_{vtx}", 60, -15, 15); fhTrueVertexZA = new TH1F("TrueVertexZA", "Vertex Z (truth); z_{vtx}", zvtxbins, zvtxlow, zvtxup); if (!doprocessOnTheFlyGeneratorLevel) { diff --git a/PWGCF/TableProducer/dptDptFilter.h b/PWGCF/TableProducer/dptDptFilter.h index 0652e4c2750..d99ae8951d8 100644 --- a/PWGCF/TableProducer/dptDptFilter.h +++ b/PWGCF/TableProducer/dptDptFilter.h @@ -68,20 +68,50 @@ namespace dptdptfilter /// \enum SystemType /// \brief The type of the system under analysis enum SystemType { - kNoSystem = 0, ///< no system defined - kpp, ///< **p-p** system - kpPb, ///< **p-Pb** system - kPbp, ///< **Pb-p** system - kPbPb, ///< **Pb-Pb** system - kXeXe, ///< **Xe-Xe** system - kppRun3, ///< **p-p Run 3** system - kPbPbRun3, ///< **Pb-Pb Run 3** system - kNeNeRun3, ///< **Ne-Ne Run 3** system - kOORun3, ///< **O-O Run 3** system - kpORun3, ///< **p-O Run 3** system - knSystems ///< number of handled systems + SystemNoSystem = 0, ///< no system defined + SystemPp, ///< **p-p** system + SystemPPb, ///< **p-Pb** system + SystemPbp, ///< **Pb-p** system + SystemPbPb, ///< **Pb-Pb** system + SystemXeXe, ///< **Xe-Xe** system + SystemPpRun3, ///< **p-p Run 3** system + SystemPbPbRun3, ///< **Pb-Pb Run 3** system + SystemNeNeRun3, ///< **Ne-Ne Run 3** system + SystemOORun3, ///< **O-O Run 3** system + SystemPORun3, ///< **p-O Run 3** system + SystemNoOfSystems ///< number of handled systems }; +/// \std::map systemInternalCodesMap +/// \brief maps system names to internal system codes +static const std::map systemInternalCodesMap{ + {"", SystemNoSystem}, + {"pp", SystemPp}, + {"pPb", SystemPPb}, + {"Pbp", SystemPbp}, + {"PbPb", SystemPbPb}, + {"XeXe", SystemXeXe}, + {"ppRun3", SystemPpRun3}, + {"PbPbRun3", SystemPbPbRun3}, + {"NeNeRun3", SystemNeNeRun3}, + {"OORun3", SystemOORun3}, + {"pORun3", SystemPORun3}}; + +/// \std::map systemExternalNamesMap +/// \brief maps system internal codes to system external names +static const std::map systemExternalNamesMap{ + {SystemNoSystem, ""}, + {SystemPp, "pp"}, + {SystemPPb, "pPb"}, + {SystemPbp, "Pbp"}, + {SystemPbPb, "PbPb"}, + {SystemXeXe, "XeXe"}, + {SystemPpRun3, "ppRun3"}, + {SystemPbPbRun3, "PbPbRun3"}, + {SystemNeNeRun3, "NeNeRun3"}, + {SystemOORun3, "OORun3"}, + {SystemPORun3, "pORun3"}}; + /// \enum DataType /// \brief Which kind of data is the task addressing enum DataType { @@ -134,6 +164,93 @@ static const std::map estimatorExternalNamesMap{ {CentMultFT0C, "FT0C"}, {CentMultNTPV, "NTPV"}}; +/// \enum MultSourceType +/// \brief The multiplicity source +enum MultSourceType { + MultSourceT0A = 0, ///< T0A multiplicity + MultSourceT0C, ///< T0C multiplicity + MultSourceT0M, ///< T0M multiplicity + MultSourceV0A, ///< V0A multiplicity + MultSourceV0C, ///< V0C multiplicity + MultSourceV0M, ///< V0M multiplicity + MultSourceNtracks, ///< number of tracks multiplicity + MultSourcePvContributors, ///< number of primary vertex contributors + MultSourceNOOFSOURCES ///< number multiplicity sources +}; + +/// \enum MultRunType +/// \brief The multiplicity LHC run +enum MultRunType { + MultRunRUN1RUN2 = 0, ///< LHC Run 1 or Run 2 + MultRunRUN3, ///< LHC Run 3 + MultRunNOOFRUNS ///< number of runs for multiplicity +}; + +/// \std::map multRunForSystemMap +/// \brief maps the system to the lhc Run for multiplicity +static const std::map multRunForSystemMap{ + {SystemNoSystem, MultRunRUN1RUN2}, + {SystemPp, MultRunRUN1RUN2}, + {SystemPPb, MultRunRUN1RUN2}, + {SystemPbp, MultRunRUN1RUN2}, + {SystemPbPb, MultRunRUN1RUN2}, + {SystemXeXe, MultRunRUN1RUN2}, + {SystemPpRun3, MultRunRUN3}, + {SystemPbPbRun3, MultRunRUN3}, + {SystemNeNeRun3, MultRunRUN3}, + {SystemOORun3, MultRunRUN3}, + {SystemPORun3, MultRunRUN3}}; + +/// \std::map estimatorMultiplicitySourceMap +/// \brief maps internal estimator codes internal multiplicity sources +static const std::map estimatorMultiplicitySourceMap{ + {CentMultNOCM, MultSourceT0C}, + {CentMultV0M, MultSourceV0M}, + {CentMultCL0, MultSourceT0C}, /* TODO: for Run1,2 */ + {CentMultCL1, MultSourceT0C}, /* TODO: for Run1,2 */ + {CentMultFV0A, MultSourceV0A}, + {CentMultFT0M, MultSourceT0M}, + {CentMultFT0A, MultSourceT0A}, + {CentMultFT0C, MultSourceT0C}, + {CentMultNTPV, MultSourcePvContributors}}; + +/// \std::vector multiplicitySourceExternalNamesMap +/// \brief maps internal multiplicity source to external names for the LHC runs +static const std::vector> multiplicitySourceExternalNamesMap{ + /* Run 1 and Run 2 */ + { + {MultSourceT0A, "T0A multiplicity"}, + {MultSourceT0C, "T0C multiplicity"}, + {MultSourceT0M, "T0M multiplicity"}, + {MultSourceV0A, "V0A multiplicity"}, + {MultSourceV0C, "V0C multiplicity"}, + {MultSourceV0M, "V0M multiplicity"}, + {MultSourceNtracks, "Number of tracks"}, + {MultSourcePvContributors, "PV contributors"}}, + /* Run 3 */ + { + {MultSourceT0A, "FT0A multiplicity"}, + {MultSourceT0C, "FT0C multiplicity"}, + {MultSourceT0M, "FT0M multiplicity"}, + {MultSourceV0A, "FV0A multiplicity"}, + {MultSourceV0C, "WRONG SOURCE"}, + {MultSourceV0M, "FV0M multiplicity"}, + {MultSourceNtracks, "Number of tracks"}, + {MultSourcePvContributors, "PV contributors"}}}; + +/// \std::map multiplicitySourceConfigNamesMap +/// \brief maps internal multiplicity source to external configuration names +/// At configuration time neither the system nor the lhc run is known +static const std::map multiplicitySourceConfigNamesMap{ + {MultSourceT0A, "FT0A"}, + {MultSourceT0C, "FT0C"}, + {MultSourceT0M, "FT0M"}, + {MultSourceV0A, "FV0A"}, + {MultSourceV0C, "V0C"}, + {MultSourceV0M, "FV0M"}, + {MultSourceNtracks, "Number of tracks"}, + {MultSourcePvContributors, "PV contributors"}}; + /// \enum TriggerSelectionTags /// \brief The potential trigger tags to apply for event selection enum TriggerSelectionTags { @@ -602,7 +719,8 @@ inline TList* getCCDBInput(auto& ccdb, const char* ccdbpath, const char* ccdbdat return lst; } -SystemType fSystem = kNoSystem; +SystemType fSystem = SystemNoSystem; +MultRunType fLhcRun = MultRunRUN1RUN2; DataType fDataType = kData; CentMultEstimatorType fCentMultEstimator = CentMultV0M; OccupancyEstimationType fOccupancyEstimation = OccupancyNOOCC; /* the occupancy estimator to use */ @@ -655,42 +773,34 @@ inline SystemType getSytemTypeFromMetaData() if (period == "LHC25ad" || period == "LHC25g5") { LOGF(info, "Configuring for p-O LHC25ad period"); - return kpORun3; + return SystemPORun3; } else if (period == "LHC25ae" || period == "LHC25g6") { LOGF(info, "Configuring for O-O LHC25ae period"); - return kOORun3; + return SystemOORun3; } else if (period == "LHC25af" || period == "LHC25g7") { LOGF(info, "Configuring for Ne-Ne LHC25af period"); - return kNeNeRun3; + return SystemNeNeRun3; } else { LOGF(fatal, "DptDptCorrelations::getSystemTypeFromMetadata(). No automatic system type configuration for %s period", period.c_str()); } - return kPbp; + return SystemPbPb; } inline SystemType getSystemType(std::string const& sysstr) { /* we have to figure out how extract the system type */ - if (sysstr.empty() || (sysstr == "PbPb")) { - return kPbPb; - } else if (sysstr == "pp") { - return kpp; - } else if (sysstr == "pPb") { - return kpPb; - } else if (sysstr == "Pbp") { - return kPbp; - } else if (sysstr == "XeXe") { - return kXeXe; - } else if (sysstr == "ppRun3") { - return kppRun3; - } else if (sysstr == "PbPbRun3") { - return kPbPbRun3; - } else if (sysstr == "Auto") { + if (sysstr == "Auto") { + /* special treatment for self configuration */ + /* TODO: expand it to all systems */ return getSytemTypeFromMetaData(); } else { - LOGF(fatal, "DptDptCorrelations::getSystemType(). Wrong system type: %s", sysstr.c_str()); + if (systemInternalCodesMap.contains(sysstr)) { + return static_cast(systemInternalCodesMap.at(sysstr)); + } else { + LOGF(fatal, "DptDptCorrelations::getSystemType(). Wrong system type: %s", sysstr.c_str()); + } } - return kPbPb; + return SystemPbPb; } /// \brief Type of data according to the configuration string @@ -759,11 +869,11 @@ inline bool triggerSelectionReco(CollisionObject const& collision) { bool trigsel = false; switch (fSystem) { - case kpp: - case kpPb: - case kPbp: - case kPbPb: - case kXeXe: + case SystemPp: + case SystemPPb: + case SystemPbp: + case SystemPbPb: + case SystemXeXe: if (triggerSelectionFlags.test(TriggSelMB)) { switch (fDataType) { case kData: @@ -790,11 +900,11 @@ inline bool triggerSelectionReco(CollisionObject const& collision) trigsel = true; } break; - case kppRun3: - case kPbPbRun3: - case kNeNeRun3: - case kpORun3: - case kOORun3: { + case SystemPpRun3: + case SystemPbPbRun3: + case SystemNeNeRun3: + case SystemPORun3: + case SystemOORun3: { auto setTriggerFlags = [](auto& flags, auto const& coll) { flags.set(TriggSelMB, coll.sel8() != 0); flags.set(TriggSelNOSAMEBUNCHPUP, coll.selection_bit(aod::evsel::kNoSameBunchPileup)); From 8cb07094d588618d50e900e2116e2abc66b246c2 Mon Sep 17 00:00:00 2001 From: Mattia Faggin Date: Tue, 19 Aug 2025 08:39:22 +0200 Subject: [PATCH 099/986] [DPG] Bug fix for physical-primary selection in DPG dca task. (#12620) Co-authored-by: Mattia Faggin --- DPG/Tasks/AOTTrack/qaImpPar.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DPG/Tasks/AOTTrack/qaImpPar.cxx b/DPG/Tasks/AOTTrack/qaImpPar.cxx index 7d9304e982d..90c9252f5a4 100644 --- a/DPG/Tasks/AOTTrack/qaImpPar.cxx +++ b/DPG/Tasks/AOTTrack/qaImpPar.cxx @@ -583,7 +583,7 @@ struct QaImpactPar { continue; } auto particle = track.mcParticle(); - if (keepOnlyPhysPrimary && particle.isPhysicalPrimary()) { + if (!particle.isPhysicalPrimary()) { continue; } pdgIndex = PDGtoIndex(std::abs(particle.pdgCode())); From d44e76ed15a73c99e8438128284f3ed0cca36c7e Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Tue, 19 Aug 2025 08:47:04 +0200 Subject: [PATCH 100/986] [PWGLF] Minor adjustments and improvements to strangeness TOF PID (#12616) Co-authored-by: ALICE Builder --- PWGLF/DataModel/LFStrangenessPIDTables.h | 88 +- .../TableProducer/Strangeness/CMakeLists.txt | 9 +- .../TableProducer/Strangeness/cascadepid.cxx | 632 ---------- .../Strangeness/lambdakzeropid.cxx | 656 ----------- .../Strangeness/strangenesstofpid.cxx | 1012 +++++++++++++++++ PWGLF/Tasks/QC/strangepidqa.cxx | 119 +- 6 files changed, 1191 insertions(+), 1325 deletions(-) delete mode 100644 PWGLF/TableProducer/Strangeness/cascadepid.cxx delete mode 100644 PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx create mode 100644 PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx diff --git a/PWGLF/DataModel/LFStrangenessPIDTables.h b/PWGLF/DataModel/LFStrangenessPIDTables.h index e689dc28141..0b7e95ce302 100644 --- a/PWGLF/DataModel/LFStrangenessPIDTables.h +++ b/PWGLF/DataModel/LFStrangenessPIDTables.h @@ -47,6 +47,10 @@ DECLARE_SOA_TABLE(DauTrackTOFPIDs, "AOD", "DAUTRACKTOFPID", // raw table (for po namespace v0data { +// define constants for NSigma operation +const float kNoTOFValue = -1e+6; +const float kEpsilon = 1e-4; + // ==== TOF INFORMATION === // lengths as stored in the AO2D for TOF calculations DECLARE_SOA_COLUMN(PosTOFLengthToPV, posTOFLengthToPV, float); //! positive track length to PV @@ -79,6 +83,45 @@ DECLARE_SOA_COLUMN(TOFNSigmaALaPi, tofNSigmaALaPi, float); //! positive DECLARE_SOA_COLUMN(TOFNSigmaK0PiPlus, tofNSigmaK0PiPlus, float); //! positive track NSigma from pion <- k0short expectation DECLARE_SOA_COLUMN(TOFNSigmaK0PiMinus, tofNSigmaK0PiMinus, float); //! negative track NSigma from pion <- k0short expectation +// dynamics based on n-sigmas with use-only-if-tof-present logic +DECLARE_SOA_DYNAMIC_COLUMN(TofLambdaCompatibility, tofLambdaCompatibility, //! compatibility with being lambda, checked only if TOF present. Argument: number of sigmas + [](float tofNSigmaLaPr, float tofNSigmaLaPi, float nsigma) -> float { + bool compatible = true; + if (std::abs(tofNSigmaLaPr - kNoTOFValue) > kEpsilon && std::abs(tofNSigmaLaPr) > nsigma) { + compatible = false; // reject only if info present and incompatible + } + if (std::abs(tofNSigmaLaPi - kNoTOFValue) > kEpsilon && std::abs(tofNSigmaLaPi) > nsigma) { + compatible = false; // reject only if info present and incompatible + } + return compatible; + }); + +// dynamics based on n-sigmas with use-only-if-tof-present logic +DECLARE_SOA_DYNAMIC_COLUMN(TofAntiLambdaCompatibility, tofAntiLambdaCompatibility, //! compatibility with being lambda, checked only if TOF present. Argument: number of sigmas + [](float tofNSigmaALaPr, float tofNSigmaALaPi, float nsigma) -> float { + bool compatible = true; + if (std::abs(tofNSigmaALaPr - kNoTOFValue) > kEpsilon && std::abs(tofNSigmaALaPr) > nsigma) { + compatible = false; // reject only if info present and incompatible + } + if (std::abs(tofNSigmaALaPi - kNoTOFValue) > kEpsilon && std::abs(tofNSigmaALaPi) > nsigma) { + compatible = false; // reject only if info present and incompatible + } + return compatible; + }); + +// dynamics based on n-sigmas with use-only-if-tof-present logic +DECLARE_SOA_DYNAMIC_COLUMN(TofK0ShortCompatibility, tofK0ShortCompatibility, //! compatibility with being lambda, checked only if TOF present. Argument: number of sigmas + [](float tofNSigmaK0PiPlus, float tofNSigmaK0PiMinus, float nsigma) -> float { + bool compatible = true; + if (std::abs(tofNSigmaK0PiPlus - kNoTOFValue) > kEpsilon && std::abs(tofNSigmaK0PiPlus) > nsigma) { + compatible = false; // reject only if info present and incompatible + } + if (std::abs(tofNSigmaK0PiMinus - kNoTOFValue) > kEpsilon && std::abs(tofNSigmaK0PiMinus) > nsigma) { + compatible = false; // reject only if info present and incompatible + } + return compatible; + }); + // beta values DECLARE_SOA_COLUMN(TofBetaLambda, tofBetaLambda, float); //! beta value with Lambda hypothesis DECLARE_SOA_COLUMN(TofBetaAntiLambda, tofBetaAntiLambda, float); //! beta value with AntiLambda hypothesis @@ -120,10 +163,17 @@ DECLARE_SOA_TABLE(V0TOFBetas, "AOD", "V0TOFBETA", // processed info table (for a DECLARE_SOA_TABLE(V0TOFNSigmas, "AOD", "V0TOFNSIGMA", // processed NSigma table (for analysis) v0data::TOFNSigmaLaPr, v0data::TOFNSigmaLaPi, v0data::TOFNSigmaALaPr, v0data::TOFNSigmaALaPi, - v0data::TOFNSigmaK0PiPlus, v0data::TOFNSigmaK0PiMinus); + v0data::TOFNSigmaK0PiPlus, v0data::TOFNSigmaK0PiMinus, + v0data::TofLambdaCompatibility, + v0data::TofAntiLambdaCompatibility, + v0data::TofK0ShortCompatibility); namespace cascdata { +// define constants for NSigma operation +const float kNoTOFValue = -1e+6; +const float kEpsilon = 1e-4; + // lengths as stored in the AO2D for TOF calculations DECLARE_SOA_COLUMN(PosTOFLengthToPV, posTOFLengthToPV, float); //! positive track length DECLARE_SOA_COLUMN(NegTOFLengthToPV, negTOFLengthToPV, float); //! negative track length @@ -154,6 +204,38 @@ DECLARE_SOA_COLUMN(TOFNSigmaXiPi, tofNSigmaXiPi, float); //! bachelor track DECLARE_SOA_COLUMN(TOFNSigmaOmLaPi, tofNSigmaOmLaPi, float); //! meson track NSigma from pion <- lambda <- om expectation DECLARE_SOA_COLUMN(TOFNSigmaOmLaPr, tofNSigmaOmLaPr, float); //! baryon track NSigma from proton <- lambda <- om expectation DECLARE_SOA_COLUMN(TOFNSigmaOmKa, tofNSigmaOmKa, float); //! bachelor track NSigma from kaon <- om expectation + +// dynamics based on n-sigmas with use-only-if-tof-present logic +DECLARE_SOA_DYNAMIC_COLUMN(TofXiCompatibility, tofXiCompatibility, //! compatibility with being lambda, checked only if TOF present. Argument: number of sigmas + [](float tofNSigmaXiLaPr, float tofNSigmaXiLaPi, float tofNSigmaXiPi, float nsigma) -> float { + bool compatible = true; + if (std::abs(tofNSigmaXiLaPr - kNoTOFValue) > kEpsilon && std::abs(tofNSigmaXiLaPr) > nsigma) { + compatible = false; // reject only if info present and incompatible + } + if (std::abs(tofNSigmaXiLaPi - kNoTOFValue) > kEpsilon && std::abs(tofNSigmaXiLaPi) > nsigma) { + compatible = false; // reject only if info present and incompatible + } + if (std::abs(tofNSigmaXiPi - kNoTOFValue) > kEpsilon && std::abs(tofNSigmaXiPi) > nsigma) { + compatible = false; // reject only if info present and incompatible + } + return compatible; + }); + +DECLARE_SOA_DYNAMIC_COLUMN(TofOmegaCompatibility, tofOmegaCompatibility, //! compatibility with being lambda, checked only if TOF present. Argument: number of sigmas + [](float tofNSigmaOmLaPr, float tofNSigmaOmLaPi, float tofNSigmaOmKa, float nsigma) -> float { + bool compatible = true; + if (std::abs(tofNSigmaOmLaPr - kNoTOFValue) > kEpsilon && std::abs(tofNSigmaOmLaPr) > nsigma) { + compatible = false; // reject only if info present and incompatible + } + if (std::abs(tofNSigmaOmLaPi - kNoTOFValue) > kEpsilon && std::abs(tofNSigmaOmLaPi) > nsigma) { + compatible = false; // reject only if info present and incompatible + } + if (std::abs(tofNSigmaOmKa - kNoTOFValue) > kEpsilon && std::abs(tofNSigmaOmKa) > nsigma) { + compatible = false; // reject only if info present and incompatible + } + return compatible; + }); + } // namespace cascdata // /-|-\-|-/-|-\-|-/-|-\-|-/-|-\-|-/-|-\-|-/-|-\-|-/-|-\-|-/-|-\-|-/-|-\-|-/-|-\-|-/ @@ -173,7 +255,9 @@ DECLARE_SOA_TABLE(CascTOFPIDs, "AOD", "CASCTOFPID", // processed information for cascdata::BachTOFDeltaTOmKa); DECLARE_SOA_TABLE(CascTOFNSigmas, "AOD", "CascTOFNSigmas", // Nsigmas for cascades cascdata::TOFNSigmaXiLaPi, cascdata::TOFNSigmaXiLaPr, cascdata::TOFNSigmaXiPi, - cascdata::TOFNSigmaOmLaPi, cascdata::TOFNSigmaOmLaPr, cascdata::TOFNSigmaOmKa); + cascdata::TOFNSigmaOmLaPi, cascdata::TOFNSigmaOmLaPr, cascdata::TOFNSigmaOmKa, + cascdata::TofXiCompatibility, + cascdata::TofOmegaCompatibility); } // namespace o2::aod #endif // PWGLF_DATAMODEL_LFSTRANGENESSPIDTABLES_H_ diff --git a/PWGLF/TableProducer/Strangeness/CMakeLists.txt b/PWGLF/TableProducer/Strangeness/CMakeLists.txt index 9e4a3fa04f8..b9ae33532f2 100644 --- a/PWGLF/TableProducer/Strangeness/CMakeLists.txt +++ b/PWGLF/TableProducer/Strangeness/CMakeLists.txt @@ -36,8 +36,8 @@ o2physics_add_dpl_workflow(cascademcfinder PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(cascadepid - SOURCES cascadepid.cxx +o2physics_add_dpl_workflow(strangenesstofpid + SOURCES strangenesstofpid.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DetectorsBase COMPONENT_NAME Analysis) @@ -81,11 +81,6 @@ o2physics_add_dpl_workflow(lambdakzeromcfinder PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(lambdakzeropid - SOURCES lambdakzeropid.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DetectorsBase - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(lambdakzerospawner SOURCES lambdakzerospawner.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore diff --git a/PWGLF/TableProducer/Strangeness/cascadepid.cxx b/PWGLF/TableProducer/Strangeness/cascadepid.cxx deleted file mode 100644 index 3c7c82dacdd..00000000000 --- a/PWGLF/TableProducer/Strangeness/cascadepid.cxx +++ /dev/null @@ -1,632 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -// -// *+-+*+-+*+-+*+-+*+-+*+-+* -// Cascade PID tables -// *+-+*+-+*+-+*+-+*+-+*+-+* -// -/// \author Nicolò Jacazio -/// \author David Dobrigkeit Chinellato -/// \since 22/11/2023 -/// \brief Table producer for Casc daughter PID info -// -// This task produces daughter PID information for strange daughters -// taking into account the (candidate-by-candidate) time spent as a heavier -// (strange, weakly-decaying) particle. This task is meant to be a test, as -// it hasn't been fully tested yet! Use at your own peril for now :-) - -#include -#include -#include -#include -#include -#include - -#include "Framework/runDataProcessing.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "DCAFitter/DCAFitterN.h" -#include "ReconstructionDataFormats/Track.h" -#include "Common/Core/RecoDecay.h" -#include "Common/Core/trackUtilities.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/DataModel/LFStrangenessPIDTables.h" -#include "PWGLF/DataModel/LFParticleIdentification.h" -#include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "CCDB/BasicCCDBManager.h" -#include "CommonConstants/PhysicsConstants.h" -#include "Common/TableProducer/PID/pidTOFBase.h" -#include "Common/DataModel/PIDResponse.h" - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; -using std::array; - -// For original data loops -using CascOriginalDatas = soa::Join; -using TracksWithAllExtras = soa::Join; - -// Cores with references and TOF pid -using dauTracks = soa::Join; -using CascDerivedDatas = soa::Join; - -struct cascadepid { - // TOF pid for strangeness (recalculated with topology) - Produces casctofpids; // table with base info - Produces casctofnsigmas; // table with Nsigmas - - Service ccdb; - - // For manual sliceBy - Preslice perCollisionOriginal = o2::aod::cascdata::collisionId; - ; - Preslice perCollisionDerived = o2::aod::cascdata::straCollisionId; - - HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - - // Operation and minimisation criteria - Configurable d_bz_input{"d_bz", -999, "bz field, -999 is automatic"}; - Configurable tofPosition{"tofPosition", 377.934f, "TOF effective (inscribed) radius"}; - Configurable doQA{"doQA", true, "create QA histos"}; - Configurable qaV0DCADau{"qaV0DCADau", 0.5, "DCA daughters (cm) for QA plots"}; - Configurable qaCascDCADau{"qaCascDCADau", 0.5, "DCA daughters (cm) for QA plots"}; - Configurable qaV0CosPA{"qaV0CosPA", 0.995, "CosPA for QA plots"}; - Configurable qaCascCosPA{"qaCascCosPA", 0.995, "CosPA for QA plots"}; - Configurable qaMassWindow{"qaMassWindow", 0.005, "Mass window around expected (in GeV/c2) for QA plots"}; - Configurable qaTPCNSigma{"qaTPCNSigma", 5, "TPC N-sigma to apply for qa plots"}; - Configurable doNSigmas{"doNSigmas", false, "calculate TOF N-sigma"}; - Configurable doQANSigma{"doQANSigma", false, "create QA of Nsigma histos"}; - - // CCDB options - Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; - Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; - Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; - Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; - Configurable nSigmaPath{"nSigmaPath", "Users/d/ddobrigk/stratof", "Path of information for n-sigma calculation"}; - - // manual - Configurable useCustomRunNumber{"useCustomRunNumber", false, "Use custom timestamp"}; - Configurable manualRunNumber{"manualRunNumber", 544122, "manual run number if no collisions saved"}; - - ConfigurableAxis axisEta{"axisEta", {20, -1.0f, +1.0f}, "#eta"}; - ConfigurableAxis axisDeltaTime{"axisDeltaTime", {2000, -1000.0f, +1000.0f}, "delta-time (ps)"}; - ConfigurableAxis axisNSigma{"axisNSigma", {200, -10.0f, +10.0f}, "N(#sigma)"}; - ConfigurableAxis axisTime{"axisTime", {200, 0.0f, +20000.0f}, "T (ps)"}; - ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "p_{T} (GeV/c)"}; - - bool nSigmaCalibLoaded; - TList* nSigmaCalibObjects; - TH1 *hMeanPosXiPi, *hSigmaPosXiPi; - TH1 *hMeanPosXiPr, *hSigmaPosXiPr; - TH1 *hMeanNegXiPi, *hSigmaNegXiPi; - TH1 *hMeanNegXiPr, *hSigmaNegXiPr; - TH1 *hMeanBachXiPi, *hSigmaBachXiPi; - TH1 *hMeanPosOmPi, *hSigmaPosOmPi; - TH1 *hMeanPosOmPr, *hSigmaPosOmPr; - TH1 *hMeanNegOmPi, *hSigmaNegOmPi; - TH1 *hMeanNegOmPr, *hSigmaNegOmPr; - TH1 *hMeanBachOmKa, *hSigmaBachOmKa; - - int mRunNumber; - float d_bz; - float maxSnp; // max sine phi for propagation - float maxStep; // max step size (cm) for propagation - - /// function to calculate track length of this track up to a certain segment of a detector - /// to be used internally in another funcrtion that calculates length until it finds the proper one - /// warning: this could be optimised further for speed - /// \param track the input track - /// \param x1 x of the first point of the detector segment - /// \param y1 y of the first point of the detector segment - /// \param x2 x of the first point of the detector segment - /// \param y2 y of the first point of the detector segment - /// \param magneticField the magnetic field to use when propagating - float trackLengthToSegment(o2::track::TrackPar track, float x1, float y1, float x2, float y2, float magneticField) - { - // don't make use of the track parametrization - float length = -104; - - // causality protection - std::array mom; - track.getPxPyPzGlo(mom); - // get start point - std::array startPoint; - track.getXYZGlo(startPoint); - - // better replaced with scalar momentum check later - // if (((x1 + x2) * mom[0] + (y1 + y2) * mom[1]) < 0.0f) - // return -101; - - // get circle X, Y please - o2::math_utils::CircleXYf_t trcCircle; - float sna, csa; - track.getCircleParams(magneticField, trcCircle, sna, csa); - - // Calculate necessary inner product - float segmentModulus = std::hypot(x2 - x1, y2 - y1); - float alongSegment = ((trcCircle.xC - x1) * (x2 - x1) + (trcCircle.yC - y1) * (y2 - y1)) / segmentModulus; - - // find point of closest approach between segment and circle center - float pcaX = (x2 - x1) * alongSegment / segmentModulus + x1; - float pcaY = (y2 - y1) * alongSegment / segmentModulus + y1; - - float centerDistToPC = std::hypot(pcaX - trcCircle.xC, pcaY - trcCircle.yC); - - // distance pca-to-intercept in multiples of segment modulus (for convenience) - if (centerDistToPC > trcCircle.rC) - return -103; - - float pcaToIntercept = TMath::Sqrt(TMath::Abs(trcCircle.rC * trcCircle.rC - centerDistToPC * centerDistToPC)); - - float interceptX1 = pcaX + (x2 - x1) / segmentModulus * pcaToIntercept; - float interceptY1 = pcaY + (y2 - y1) / segmentModulus * pcaToIntercept; - float interceptX2 = pcaX - (x2 - x1) / segmentModulus * pcaToIntercept; - float interceptY2 = pcaY - (y2 - y1) / segmentModulus * pcaToIntercept; - - float scalarCheck1 = ((x2 - x1) * (interceptX1 - x1) + (y2 - y1) * (interceptY1 - y1)) / segmentModulus; - float scalarCheck2 = ((x2 - x1) * (interceptX2 - x1) + (y2 - y1) * (interceptY2 - y1)) / segmentModulus; - - float cosAngle1 = -1000, sinAngle1 = -1000, modulus1 = -1000; - float cosAngle2 = -1000, sinAngle2 = -1000, modulus2 = -1000; - float length1 = -1000, length2 = -1000; - - modulus1 = std::hypot(interceptX1 - trcCircle.xC, interceptY1 - trcCircle.yC) * std::hypot(startPoint[0] - trcCircle.xC, startPoint[1] - trcCircle.yC); - cosAngle1 = (interceptX1 - trcCircle.xC) * (startPoint[0] - trcCircle.xC) + (interceptY1 - trcCircle.yC) * (startPoint[1] - trcCircle.yC); - sinAngle1 = (interceptX1 - trcCircle.xC) * (startPoint[1] - trcCircle.yC) - (interceptY1 - trcCircle.yC) * (startPoint[0] - trcCircle.xC); - cosAngle1 /= modulus1; - sinAngle1 /= modulus1; - length1 = trcCircle.rC * TMath::ACos(cosAngle1); - length1 *= sqrt(1.0f + track.getTgl() * track.getTgl()); - - modulus2 = std::hypot(interceptX2 - trcCircle.xC, interceptY2 - trcCircle.yC) * std::hypot(startPoint[0] - trcCircle.xC, startPoint[1] - trcCircle.yC); - cosAngle2 = (interceptX2 - trcCircle.xC) * (startPoint[0] - trcCircle.xC) + (interceptY2 - trcCircle.yC) * (startPoint[1] - trcCircle.yC); - sinAngle2 = (interceptX2 - trcCircle.xC) * (startPoint[1] - trcCircle.yC) - (interceptY2 - trcCircle.yC) * (startPoint[0] - trcCircle.xC); - cosAngle2 /= modulus2; - sinAngle2 /= modulus2; - length2 = trcCircle.rC * TMath::ACos(cosAngle2); - length2 *= sqrt(1.0f + track.getTgl() * track.getTgl()); - - // rotate transverse momentum vector such that it is at intercepts - float angle1 = TMath::ACos(cosAngle1); - if (sinAngle1 < 0) - angle1 *= -1.0f; - float px1 = +TMath::Cos(angle1) * mom[0] + TMath::Sin(angle1) * mom[1]; - float py1 = -TMath::Sin(angle1) * mom[0] + TMath::Cos(angle1) * mom[1]; - - float angle2 = TMath::ACos(cosAngle2); - if (sinAngle2 < 0) - angle2 *= -1.0f; - float px2 = +TMath::Cos(angle2) * mom[0] + TMath::Sin(angle2) * mom[1]; - float py2 = -TMath::Sin(angle2) * mom[0] + TMath::Cos(angle2) * mom[1]; - - float midSegX = 0.5f * (x2 + x1); - float midSegY = 0.5f * (y2 + y1); - - float scalarMomentumCheck1 = px1 * midSegX + py1 * midSegY; - float scalarMomentumCheck2 = px2 * midSegX + py2 * midSegY; - - if (scalarCheck1 > 0.0f && scalarCheck1 < segmentModulus && scalarMomentumCheck1 > 0.0f) { - length = length1; - // X = interceptX1; Y = interceptY1; - } - if (scalarCheck2 > 0.0f && scalarCheck2 < segmentModulus && scalarMomentumCheck2 > 0.0f) { - length = length2; - // X = interceptX2; Y = interceptY2; - } - return length; - } - - /// function to calculate track length of this track up to a certain segmented detector - /// \param track the input track - /// \param magneticField the magnetic field to use when propagating - float findInterceptLength(o2::track::TrackPar track, float magneticField) - { - float length = 1e+6; - for (int iSeg = 0; iSeg < 18; iSeg++) { - // Detector segmentation loop - float segmentAngle = 20.0f / 180.0f * TMath::Pi(); - float theta = static_cast(iSeg) * 20.0f / 180.0f * TMath::Pi(); - float halfWidth = tofPosition * TMath::Tan(0.5f * segmentAngle); - float x1 = TMath::Cos(theta) * (-halfWidth) + TMath::Sin(theta) * tofPosition; - float y1 = -TMath::Sin(theta) * (-halfWidth) + TMath::Cos(theta) * tofPosition; - float x2 = TMath::Cos(theta) * (+halfWidth) + TMath::Sin(theta) * tofPosition; - float y2 = -TMath::Sin(theta) * (+halfWidth) + TMath::Cos(theta) * tofPosition; - float thisLength = trackLengthToSegment(track, x1, y1, x2, y2, magneticField); - if (thisLength < length && thisLength > 0) - length = thisLength; - } - if (length > 1e+5) - length = -100; // force negative to avoid misunderstandings - return length; - } - - void init(InitContext&) - { - mRunNumber = 0; - d_bz = 0; - maxSnp = 0.85f; // could be changed later - maxStep = 2.00f; // could be changed later - - ccdb->setURL(ccdburl); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - ccdb->setFatalWhenNull(false); - - nSigmaCalibLoaded = false; - nSigmaCalibObjects = nullptr; - - // measured vs expected total time QA - if (doQA) { - // standard deltaTime values - histos.add("hArcDebug", "hArcDebug", kTH2F, {axisPt, {500, -5.0f, 10.0f}}); - histos.add("h2dposDeltaTimeAsXiPi", "h2dposDeltaTimeAsXiPi", {HistType::kTH3F, {axisPt, axisEta, axisDeltaTime}}); - histos.add("h2dposDeltaTimeAsXiPr", "h2dposDeltaTimeAsXiPr", {HistType::kTH3F, {axisPt, axisEta, axisDeltaTime}}); - histos.add("h2dnegDeltaTimeAsXiPi", "h2dnegDeltaTimeAsXiPi", {HistType::kTH3F, {axisPt, axisEta, axisDeltaTime}}); - histos.add("h2dnegDeltaTimeAsXiPr", "h2dnegDeltaTimeAsXiPr", {HistType::kTH3F, {axisPt, axisEta, axisDeltaTime}}); - histos.add("h2dbachDeltaTimeAsXiPi", "h2dbachDeltaTimeAsXiPi", {HistType::kTH3F, {axisPt, axisEta, axisDeltaTime}}); - - histos.add("h2dposDeltaTimeAsOmPi", "h2dposDeltaTimeAsOmPi", {HistType::kTH3F, {axisPt, axisEta, axisDeltaTime}}); - histos.add("h2dposDeltaTimeAsOmPr", "h2dposDeltaTimeAsOmPr", {HistType::kTH3F, {axisPt, axisEta, axisDeltaTime}}); - histos.add("h2dnegDeltaTimeAsOmPi", "h2dnegDeltaTimeAsOmPi", {HistType::kTH3F, {axisPt, axisEta, axisDeltaTime}}); - histos.add("h2dnegDeltaTimeAsOmPr", "h2dnegDeltaTimeAsOmPr", {HistType::kTH3F, {axisPt, axisEta, axisDeltaTime}}); - histos.add("h2dbachDeltaTimeAsOmKa", "h2dbachDeltaTimeAsOmKa", {HistType::kTH3F, {axisPt, axisEta, axisDeltaTime}}); - } - - if (doQANSigma) { - // standard NSigma values - histos.add("h2dNSigmaXiLaPi", "h2dNSigmaXiLaPi", {HistType::kTH2F, {axisPt, axisNSigma}}); - histos.add("h2dNSigmaXiLaPr", "h2dNSigmaXiLaPr", {HistType::kTH2F, {axisPt, axisNSigma}}); - histos.add("h2dNSigmaXiPi", "h2dNSigmaXiPi", {HistType::kTH2F, {axisPt, axisNSigma}}); - histos.add("h2dNSigmaOmLaPi", "h2dNSigmaOmLaPi", {HistType::kTH2F, {axisPt, axisNSigma}}); - histos.add("h2dNSigmaOmLaPr", "h2dNSigmaOmLaPr", {HistType::kTH2F, {axisPt, axisNSigma}}); - histos.add("h2dNSigmaOmKa", "h2dNSigmaOmKa", {HistType::kTH2F, {axisPt, axisNSigma}}); - } - } - - void initCCDB(int runNumber) - { - if (mRunNumber == runNumber) { - return; - } - - // In case override, don't proceed, please - no CCDB access required - if (d_bz_input > -990) { - d_bz = d_bz_input; - o2::parameters::GRPMagField grpmag; - if (fabs(d_bz) > 1e-5) { - grpmag.setL3Current(30000.f / (d_bz / 5.0f)); - } - o2::base::Propagator::initFieldFromGRP(&grpmag); - mRunNumber = runNumber; - return; - } - - o2::parameters::GRPObject* grpo = ccdb->getForRun(grpPath, runNumber); - o2::parameters::GRPMagField* grpmag = 0x0; - if (grpo) { - o2::base::Propagator::initFieldFromGRP(grpo); - // Fetch magnetic field from ccdb for current collision - d_bz = grpo->getNominalL3Field(); - LOG(info) << "Retrieved GRP for run " << runNumber << " with magnetic field of " << d_bz << " kZG"; - } else { - grpmag = ccdb->getForRun(grpmagPath, runNumber); - if (!grpmag) { - LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for run " << runNumber; - } - o2::base::Propagator::initFieldFromGRP(grpmag); - // Fetch magnetic field from ccdb for current collision - d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); - LOG(info) << "Retrieved GRP for run " << runNumber << " with magnetic field of " << d_bz << " kZG"; - } - - // if TOF Nsigma desired - if (doNSigmas) { - nSigmaCalibObjects = ccdb->getForRun(nSigmaPath, runNumber); - if (nSigmaCalibObjects) { - LOGF(info, "loaded TList with this many objects: %i", nSigmaCalibObjects->GetEntries()); - - hMeanPosXiPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanPosXiPi")); - hMeanPosXiPr = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanPosXiPr")); - hMeanNegXiPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanNegXiPi")); - hMeanNegXiPr = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanNegXiPr")); - hMeanBachXiPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanBachXiPi")); - hMeanPosOmPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanPosOmPi")); - hMeanPosOmPr = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanPosOmPr")); - hMeanNegOmPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanNegOmPi")); - hMeanNegOmPr = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanNegOmPr")); - hMeanBachOmKa = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanBachOmKa")); - - hSigmaPosXiPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaPosXiPi")); - hSigmaPosXiPr = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaPosXiPr")); - hSigmaNegXiPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaNegXiPi")); - hSigmaNegXiPr = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaNegXiPr")); - hSigmaBachXiPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaBachXiPi")); - hSigmaPosOmPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaPosOmPi")); - hSigmaPosOmPr = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaPosOmPr")); - hSigmaNegOmPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaNegOmPi")); - hSigmaNegOmPr = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaNegOmPr")); - hSigmaBachOmKa = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaBachOmKa")); - - if (!hMeanPosXiPi || !hMeanPosXiPr || !hMeanNegXiPi || !hMeanNegXiPr || !hMeanBachXiPi) - LOG(info) << "Problems finding xi mean histograms!"; - if (!hMeanPosOmPi || !hMeanPosOmPr || !hMeanNegOmPi || !hMeanNegOmPr || !hMeanBachOmKa) - LOG(info) << "Problems finding omega sigma histograms!"; - if (!hSigmaPosXiPi || !hSigmaPosXiPr || !hSigmaNegXiPi || !hSigmaNegXiPr || !hSigmaBachXiPi) - LOG(info) << "Problems finding xi sigma histograms!"; - if (!hSigmaPosOmPi || !hSigmaPosOmPr || !hSigmaNegOmPi || !hSigmaNegOmPr || !hSigmaBachOmKa) - LOG(info) << "Problems finding omega sigma histograms!"; - } - } - mRunNumber = runNumber; - } - - float velocity(float lMomentum, float lMass) - { - // Momentum p and mass m -> returns speed in centimeters per picosecond - // Useful for TOF calculations - float lA = (lMomentum / lMass) * (lMomentum / lMass); - return 0.0299792458 * TMath::Sqrt(lA / (1 + lA)); - } - - template - void processCascadeCandidate(TCollision const& collision, TCascade const& cascade, TTrack const& pTra, TTrack const& nTra, TTrack const& bTra) - { - // initialize from positions and momenta as needed - o2::track::TrackPar posTrack = o2::track::TrackPar({cascade.xlambda(), cascade.ylambda(), cascade.zlambda()}, {cascade.pxpos(), cascade.pypos(), cascade.pzpos()}, +1); - o2::track::TrackPar negTrack = o2::track::TrackPar({cascade.xlambda(), cascade.ylambda(), cascade.zlambda()}, {cascade.pxneg(), cascade.pyneg(), cascade.pzneg()}, -1); - o2::track::TrackPar bachTrack = o2::track::TrackPar({cascade.x(), cascade.y(), cascade.z()}, {cascade.pxbach(), cascade.pybach(), cascade.pzbach()}, cascade.sign()); - o2::track::TrackPar cascTrack = o2::track::TrackPar({cascade.x(), cascade.y(), cascade.z()}, {cascade.px(), cascade.py(), cascade.pz()}, cascade.sign()); - - // start calculation: calculate velocities - float velocityPositivePr = velocity(posTrack.getP(), o2::constants::physics::MassProton); - float velocityPositivePi = velocity(posTrack.getP(), o2::constants::physics::MassPionCharged); - float velocityNegativePr = velocity(negTrack.getP(), o2::constants::physics::MassProton); - float velocityNegativePi = velocity(negTrack.getP(), o2::constants::physics::MassPionCharged); - float velocityBachelorPi = velocity(bachTrack.getP(), o2::constants::physics::MassPionCharged); - float velocityBachelorKa = velocity(bachTrack.getP(), o2::constants::physics::MassKaonCharged); - float velocityXi = velocity(cascTrack.getP(), o2::constants::physics::MassXiMinus); - float velocityOm = velocity(cascTrack.getP(), o2::constants::physics::MassOmegaMinus); - float velocityLa = velocity(std::hypot(cascade.pxlambda(), cascade.pylambda(), cascade.pzlambda()), o2::constants::physics::MassLambda); - - // calculate daughter length to TOF intercept - float lengthPositive = findInterceptLength(posTrack, d_bz); // FIXME: tofPosition ok? adjust? - float lengthNegative = findInterceptLength(negTrack, d_bz); // FIXME: tofPosition ok? adjust? - float lengthBachelor = findInterceptLength(bachTrack, d_bz); // FIXME: tofPosition ok? adjust? - - // calculate mother lengths - float lengthV0 = std::hypot(cascade.xlambda() - cascade.x(), cascade.ylambda() - cascade.y(), cascade.zlambda() - cascade.z()); - float lengthCascade = -1e+6; - const o2::math_utils::Point3D collVtx{collision.posX(), collision.posY(), collision.posZ()}; - bool successPropag = o2::base::Propagator::Instance()->propagateToDCA(collVtx, cascTrack, d_bz, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrNONE); - float d = -1.0f, d3d = 0.0f; - float linearToPV = std::hypot(cascade.x() - collision.posX(), cascade.y() - collision.posY(), cascade.z() - collision.posZ()); - if (successPropag) { - std::array cascCloseToPVPosition; - cascTrack.getXYZGlo(cascCloseToPVPosition); - o2::math_utils::CircleXYf_t trcCircleCascade; - float sna, csa; - cascTrack.getCircleParams(d_bz, trcCircleCascade, sna, csa); - - // calculate 2D distance between two points - d = std::hypot(cascade.x() - cascCloseToPVPosition[0], cascade.y() - cascCloseToPVPosition[1]); - d3d = std::hypot(cascade.x() - cascCloseToPVPosition[0], cascade.y() - cascCloseToPVPosition[1], cascade.z() - cascCloseToPVPosition[2]); // cross-check variable - float sinThetaOverTwo = d / (2.0f * trcCircleCascade.rC); - lengthCascade = 2.0f * trcCircleCascade.rC * TMath::ASin(sinThetaOverTwo); - lengthCascade *= sqrt(1.0f + cascTrack.getTgl() * cascTrack.getTgl()); - } - - if (!successPropag) { - lengthCascade = linearToPV; // if propagation failed, use linear estimate (optional: actually do not define?) - } - - // lambda, xi and omega flight time is always defined - float lambdaFlight = lengthV0 / velocityLa; - float xiFlight = lengthCascade / velocityXi; - float omFlight = lengthCascade / velocityOm; - float posFlightPi = lengthPositive / velocityPositivePi; - float posFlightPr = lengthPositive / velocityPositivePr; - float negFlightPi = lengthNegative / velocityNegativePi; - float negFlightPr = lengthNegative / velocityNegativePr; - float bachFlightPi = lengthBachelor / velocityBachelorPi; - float bachFlightKa = lengthBachelor / velocityBachelorKa; - - // initialize delta-times (actual PID variables) - float posDeltaTimeAsXiPi = -1e+6, posDeltaTimeAsXiPr = -1e+6; - float negDeltaTimeAsXiPi = -1e+6, negDeltaTimeAsXiPr = -1e+6; - float bachDeltaTimeAsXiPi = -1e+6; - float posDeltaTimeAsOmPi = -1e+6, posDeltaTimeAsOmPr = -1e+6; - float negDeltaTimeAsOmPi = -1e+6, negDeltaTimeAsOmPr = -1e+6; - float bachDeltaTimeAsOmKa = -1e+6; - - if (pTra.hasTOF()) { - posDeltaTimeAsXiPi = (pTra.tofSignal() - pTra.tofEvTime()) - (xiFlight + lambdaFlight + posFlightPi); - posDeltaTimeAsXiPr = (pTra.tofSignal() - pTra.tofEvTime()) - (xiFlight + lambdaFlight + posFlightPr); - posDeltaTimeAsOmPi = (pTra.tofSignal() - pTra.tofEvTime()) - (omFlight + lambdaFlight + posFlightPi); - posDeltaTimeAsOmPr = (pTra.tofSignal() - pTra.tofEvTime()) - (omFlight + lambdaFlight + posFlightPr); - } - if (nTra.hasTOF()) { - negDeltaTimeAsXiPi = (nTra.tofSignal() - nTra.tofEvTime()) - (xiFlight + lambdaFlight + negFlightPi); - negDeltaTimeAsXiPr = (nTra.tofSignal() - nTra.tofEvTime()) - (xiFlight + lambdaFlight + negFlightPr); - negDeltaTimeAsOmPi = (nTra.tofSignal() - nTra.tofEvTime()) - (omFlight + lambdaFlight + negFlightPi); - negDeltaTimeAsOmPr = (nTra.tofSignal() - nTra.tofEvTime()) - (omFlight + lambdaFlight + negFlightPr); - } - if (bTra.hasTOF()) { - bachDeltaTimeAsXiPi = (bTra.tofSignal() - bTra.tofEvTime()) - (xiFlight + bachFlightPi); - bachDeltaTimeAsOmKa = (bTra.tofSignal() - bTra.tofEvTime()) - (omFlight + bachFlightKa); - } - - casctofpids( - posDeltaTimeAsXiPi, posDeltaTimeAsXiPr, negDeltaTimeAsXiPi, negDeltaTimeAsXiPr, bachDeltaTimeAsXiPi, - posDeltaTimeAsOmPi, posDeltaTimeAsOmPr, negDeltaTimeAsOmPi, negDeltaTimeAsOmPr, bachDeltaTimeAsOmKa); - - float nSigmaXiLaPr = -1e+6; - float nSigmaXiLaPi = -1e+6; - float nSigmaXiPi = -1e+6; - float nSigmaOmLaPr = -1e+6; - float nSigmaOmLaPi = -1e+6; - float nSigmaOmKa = -1e+6; - - // go for Nsigma values if requested - if (doNSigmas) { - // Xi hypothesis ________________________ - if (cascade.sign() < 0) { // XiMinus - if (posDeltaTimeAsXiPr > -1e+5) // proton from Lambda from XiMinus has signal - nSigmaXiLaPr = (posDeltaTimeAsXiPr - hMeanPosXiPr->Interpolate(cascade.pt())) / hSigmaPosXiPr->Interpolate(cascade.pt()); - if (negDeltaTimeAsXiPi > -1e+5) // pion from Lambda from XiMinus has signal - nSigmaXiLaPi = (negDeltaTimeAsXiPi - hMeanNegXiPi->Interpolate(cascade.pt())) / hSigmaNegXiPi->Interpolate(cascade.pt()); - if (bachDeltaTimeAsXiPi > -1e+5) // pion from XiMinus has signal - nSigmaXiPi = (bachDeltaTimeAsXiPi - hMeanBachXiPi->Interpolate(cascade.pt())) / hSigmaBachXiPi->Interpolate(cascade.pt()); - if (posDeltaTimeAsOmPr > -1e+5) // proton from Lambda from OmegaMinus has signal - nSigmaOmLaPr = (posDeltaTimeAsOmPr - hMeanPosOmPr->Interpolate(cascade.pt())) / hSigmaPosOmPr->Interpolate(cascade.pt()); - if (negDeltaTimeAsOmPi > -1e+5) // pion from Lambda from OmegaMinus has signal - nSigmaOmLaPi = (negDeltaTimeAsOmPi - hMeanNegOmPi->Interpolate(cascade.pt())) / hSigmaNegOmPi->Interpolate(cascade.pt()); - if (bachDeltaTimeAsOmKa > -1e+5) // kaon from OmegaMinus has signal - nSigmaOmKa = (bachDeltaTimeAsOmKa - hMeanBachOmKa->Interpolate(cascade.pt())) / hSigmaBachOmKa->Interpolate(cascade.pt()); - } else { - if (posDeltaTimeAsXiPi > -1e+5) // proton from Lambda from XiMinus has signal - nSigmaXiLaPi = (posDeltaTimeAsXiPi - hMeanPosXiPi->Interpolate(cascade.pt())) / hSigmaPosXiPi->Interpolate(cascade.pt()); - if (negDeltaTimeAsXiPr > -1e+5) // pion from Lambda from XiMinus has signal - nSigmaXiLaPr = (negDeltaTimeAsXiPr - hMeanNegXiPr->Interpolate(cascade.pt())) / hSigmaNegXiPr->Interpolate(cascade.pt()); - if (bachDeltaTimeAsXiPi > -1e+5) // pion from XiMinus has signal - nSigmaXiPi = (bachDeltaTimeAsXiPi - hMeanBachXiPi->Interpolate(cascade.pt())) / hSigmaBachXiPi->Interpolate(cascade.pt()); - if (posDeltaTimeAsOmPi > -1e+5) // proton from Lambda from OmegaMinus has signal - nSigmaOmLaPi = (posDeltaTimeAsOmPi - hMeanPosOmPi->Interpolate(cascade.pt())) / hSigmaPosOmPi->Interpolate(cascade.pt()); - if (negDeltaTimeAsOmPr > -1e+5) // pion from Lambda from OmegaMinus has signal - nSigmaOmLaPr = (negDeltaTimeAsOmPr - hMeanNegOmPr->Interpolate(cascade.pt())) / hSigmaNegOmPr->Interpolate(cascade.pt()); - if (bachDeltaTimeAsOmKa > -1e+5) // kaon from OmegaMinus has signal - nSigmaOmKa = (bachDeltaTimeAsOmKa - hMeanBachOmKa->Interpolate(cascade.pt())) / hSigmaBachOmKa->Interpolate(cascade.pt()); - } - casctofnsigmas(nSigmaXiLaPi, nSigmaXiLaPr, nSigmaXiPi, nSigmaOmLaPi, nSigmaOmLaPr, nSigmaOmKa); - } - - if (doQA) { - // fill QA histograms for cross-checking - histos.fill(HIST("hArcDebug"), cascade.pt(), lengthCascade - d3d); // for debugging purposes - - if (cascade.dcaV0daughters() < qaV0DCADau && cascade.dcacascdaughters() < qaCascDCADau && cascade.v0cosPA(collision.posX(), collision.posY(), collision.posZ()) > qaV0CosPA && cascade.casccosPA(collision.posX(), collision.posY(), collision.posZ()) > qaCascCosPA) { - if (cascade.sign() < 0) { - if (std::abs(cascade.mXi() - 1.32171) < qaMassWindow && fabs(pTra.tpcNSigmaPr()) < qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < qaTPCNSigma && fabs(bTra.tpcNSigmaPi()) < qaTPCNSigma) { - histos.fill(HIST("h2dposDeltaTimeAsXiPr"), cascade.pt(), cascade.eta(), posDeltaTimeAsXiPr); - histos.fill(HIST("h2dnegDeltaTimeAsXiPi"), cascade.pt(), cascade.eta(), negDeltaTimeAsXiPi); - histos.fill(HIST("h2dbachDeltaTimeAsXiPi"), cascade.pt(), cascade.eta(), bachDeltaTimeAsXiPi); - if (doQANSigma) { - histos.fill(HIST("h2dNSigmaXiLaPi"), cascade.pt(), nSigmaXiLaPi); - histos.fill(HIST("h2dNSigmaXiLaPr"), cascade.pt(), nSigmaXiLaPr); - histos.fill(HIST("h2dNSigmaXiPi"), cascade.pt(), nSigmaXiPi); - } - } - if (std::abs(cascade.mOmega() - 1.67245) < qaMassWindow && fabs(pTra.tpcNSigmaPr()) < qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < qaTPCNSigma && fabs(bTra.tpcNSigmaKa()) < qaTPCNSigma) { - histos.fill(HIST("h2dposDeltaTimeAsOmPr"), cascade.pt(), cascade.eta(), posDeltaTimeAsOmPr); - histos.fill(HIST("h2dnegDeltaTimeAsOmPi"), cascade.pt(), cascade.eta(), negDeltaTimeAsOmPi); - histos.fill(HIST("h2dbachDeltaTimeAsOmKa"), cascade.pt(), cascade.eta(), bachDeltaTimeAsOmKa); - if (doQANSigma) { - histos.fill(HIST("h2dNSigmaOmLaPi"), cascade.pt(), nSigmaOmLaPi); - histos.fill(HIST("h2dNSigmaOmLaPr"), cascade.pt(), nSigmaOmLaPr); - histos.fill(HIST("h2dNSigmaOmKa"), cascade.pt(), nSigmaOmKa); - } - } - } else { - if (std::abs(cascade.mXi() - 1.32171) < qaMassWindow && fabs(pTra.tpcNSigmaPi()) < qaTPCNSigma && fabs(nTra.tpcNSigmaPr()) < qaTPCNSigma && fabs(bTra.tpcNSigmaPi()) < qaTPCNSigma) { - histos.fill(HIST("h2dposDeltaTimeAsXiPi"), cascade.pt(), cascade.eta(), posDeltaTimeAsXiPi); - histos.fill(HIST("h2dnegDeltaTimeAsXiPr"), cascade.pt(), cascade.eta(), negDeltaTimeAsXiPr); - histos.fill(HIST("h2dbachDeltaTimeAsXiPi"), cascade.pt(), cascade.eta(), bachDeltaTimeAsXiPi); - if (doQANSigma) { - histos.fill(HIST("h2dNSigmaXiLaPi"), cascade.pt(), nSigmaXiLaPi); - histos.fill(HIST("h2dNSigmaXiLaPr"), cascade.pt(), nSigmaXiLaPr); - histos.fill(HIST("h2dNSigmaXiPi"), cascade.pt(), nSigmaXiPi); - } - } - if (std::abs(cascade.mOmega() - 1.67245) < qaMassWindow && fabs(pTra.tpcNSigmaPi()) < qaTPCNSigma && fabs(nTra.tpcNSigmaPr()) < qaTPCNSigma && fabs(bTra.tpcNSigmaKa()) < qaTPCNSigma) { - histos.fill(HIST("h2dposDeltaTimeAsOmPi"), cascade.pt(), cascade.eta(), posDeltaTimeAsOmPi); - histos.fill(HIST("h2dnegDeltaTimeAsOmPr"), cascade.pt(), cascade.eta(), negDeltaTimeAsOmPr); - histos.fill(HIST("h2dbachDeltaTimeAsOmKa"), cascade.pt(), cascade.eta(), bachDeltaTimeAsOmKa); - if (doQANSigma) { - histos.fill(HIST("h2dNSigmaOmLaPi"), cascade.pt(), nSigmaOmLaPi); - histos.fill(HIST("h2dNSigmaOmLaPr"), cascade.pt(), nSigmaOmLaPr); - histos.fill(HIST("h2dNSigmaOmKa"), cascade.pt(), nSigmaOmKa); - } - } - } - } - } - } - - void processStandardData(aod::Collisions const& collisions, CascOriginalDatas const& Cascades, TracksWithAllExtras const&, aod::BCsWithTimestamps const& /*bcs*/) - { - // Fire up CCDB with first collision in record. If no collisions, bypass - if (useCustomRunNumber || collisions.size() < 1) { - initCCDB(manualRunNumber); - } else { - auto collision = collisions.begin(); - auto bc = collision.bc_as(); - initCCDB(bc.runNumber()); - } - - for (const auto& collision : collisions) { - // Do analysis with collision-grouped V0s, retain full collision information - const uint64_t collIdx = collision.globalIndex(); - auto CascTable_thisCollision = Cascades.sliceBy(perCollisionOriginal, collIdx); - // cascade table sliced - for (auto const& cascade : CascTable_thisCollision) { - // de-reference interlinks by hand for derived data - auto pTra = cascade.posTrack_as(); - auto nTra = cascade.negTrack_as(); - auto bTra = cascade.bachelor_as(); - - processCascadeCandidate(collision, cascade, pTra, nTra, bTra); - } - } - } - - void processDerivedData(soa::Join const& collisions, CascDerivedDatas const& Cascades, dauTracks const&) - { - // Fire up CCDB with first collision in record. If no collisions, bypass - if (useCustomRunNumber || collisions.size() < 1) { - initCCDB(manualRunNumber); - } else { - auto collision = collisions.begin(); - initCCDB(collision.runNumber()); - } - - for (const auto& collision : collisions) { - // Do analysis with collision-grouped V0s, retain full collision information - const uint64_t collIdx = collision.globalIndex(); - auto CascTable_thisCollision = Cascades.sliceBy(perCollisionDerived, collIdx); - // cascade table sliced - for (auto const& cascade : CascTable_thisCollision) { - // de-reference interlinks by hand for derived data - auto pTra = cascade.posTrackExtra_as(); - auto nTra = cascade.negTrackExtra_as(); - auto bTra = cascade.bachTrackExtra_as(); - - processCascadeCandidate(collision, cascade, pTra, nTra, bTra); - } - } - } - - PROCESS_SWITCH(cascadepid, processStandardData, "Process standard data", true); - PROCESS_SWITCH(cascadepid, processDerivedData, "Process derived data", false); -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - return WorkflowSpec{ - adaptAnalysisTask(cfgc)}; -} diff --git a/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx b/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx deleted file mode 100644 index c6041aa0e02..00000000000 --- a/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx +++ /dev/null @@ -1,656 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -// -// *+-+*+-+*+-+*+-+*+-+*+-+* -// Lambdakzero PID -// *+-+*+-+*+-+*+-+*+-+*+-+* -// -/// \author Nicolò Jacazio -/// \author David Dobrigkeit Chinellato -/// \since 11/05/2023 -/// \brief Table producer for V0 daughter PID info -// -// This task produces daughter PID information for strange daughters -// taking into account the (candidate-by-candidate) time spent as a heavier -// (strange, weakly-decaying) particle. This task is meant to be a test, as -// it hasn't been fully tested yet! Use at your own peril for now :-) - -#include -#include -#include -#include -#include -#include - -#include "Framework/runDataProcessing.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "DCAFitter/DCAFitterN.h" -#include "ReconstructionDataFormats/Track.h" -#include "Common/Core/RecoDecay.h" -#include "Common/Core/trackUtilities.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/DataModel/LFStrangenessPIDTables.h" -#include "PWGLF/DataModel/LFParticleIdentification.h" -#include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsCalibration/MeanVertexObject.h" -#include "CommonConstants/PhysicsConstants.h" -#include "Common/TableProducer/PID/pidTOFBase.h" -#include "Common/DataModel/PIDResponse.h" - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; -using std::array; - -// For original data loops -using V0OriginalDatas = soa::Join; -using TracksWithAllExtras = soa::Join; - -// For derived data analysis -using dauTracks = soa::Join; -using V0DerivedDatas = soa::Join; - -struct lambdakzeropid { - // TOF pid for strangeness (recalculated with topology) - Produces v0tofpid; // table with Nsigmas - Produces v0tofbeta; // table with betas - Produces v0tofdebugs; // table with extra debug information - Produces v0tofnsigmas; // table with nsigmas - - Service ccdb; - - // mean vertex position to be used if no collision associated - o2::dataformats::MeanVertexObject* mVtx = nullptr; - - // For manual sliceBy - Preslice perCollisionOriginal = o2::aod::v0data::collisionId; - ; - Preslice perCollisionDerived = o2::aod::v0data::straCollisionId; - - HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - - // Operation and minimisation criteria - Configurable d_bz_input{"d_bz", -999, "bz field, -999 is automatic"}; - Configurable tofPosition{"tofPosition", 377.934f, "TOF effective (inscribed) radius"}; - Configurable doQA{"doQA", true, "create QA histos"}; - Configurable doQANSigma{"doQANSigma", true, "create QA of Nsigma histos"}; - Configurable qaDCADau{"qaDCADau", 0.5, "DCA daughters (cm) for QA plots"}; - Configurable qaCosPA{"qaCosPA", 0.999, "CosPA for QA plots"}; - Configurable qaMassWindow{"qaMassWindow", 0.005, "Mass window around expected (in GeV/c2) for QA plots"}; - Configurable qaTPCNSigma{"qaTPCNSigma", 5, "TPC N-sigma to apply for qa plots"}; - Configurable doNSigmas{"doNSigmas", false, "calculate TOF N-sigma"}; - - // CCDB options - Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; - Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; - Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; - Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; - Configurable nSigmaPath{"nSigmaPath", "Users/d/ddobrigk/stratof", "Path of information for n-sigma calculation"}; - Configurable mVtxPath{"mVtxPath", "GLO/Calib/MeanVertex", "Path of the mean vertex file"}; - - // manual - Configurable useCustomRunNumber{"useCustomRunNumber", false, "Use custom timestamp"}; - Configurable manualRunNumber{"manualRunNumber", 544122, "manual run number if no collisions saved"}; - - ConfigurableAxis axisEta{"axisEta", {20, -1.0f, +1.0f}, "#eta"}; - ConfigurableAxis axisDeltaTime{"axisDeltaTime", {2000, -1000.0f, +1000.0f}, "delta-time (ps)"}; - ConfigurableAxis axisTime{"axisTime", {200, 0.0f, +20000.0f}, "T (ps)"}; - ConfigurableAxis axisNSigma{"axisNSigma", {200, -10.0f, +10.0f}, "N(#sigma)"}; - ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "p_{T} (GeV/c)"}; - - // for n-sigma calibration - bool nSigmaCalibLoaded; - TList* nSigmaCalibObjects; - TH1 *hMeanPosLaPi, *hSigmaPosLaPi; - TH1 *hMeanPosLaPr, *hSigmaPosLaPr; - TH1 *hMeanNegLaPi, *hSigmaNegLaPi; - TH1 *hMeanNegLaPr, *hSigmaNegLaPr; - TH1 *hMeanPosK0Pi, *hSigmaPosK0Pi; - TH1 *hMeanNegK0Pi, *hSigmaNegK0Pi; - - int mRunNumber; - float d_bz; - float maxSnp; // max sine phi for propagation - float maxStep; // max step size (cm) for propagation - - // enum to keep track of the TOF-related properties for V0s - enum tofEnum { kLength = 0, - kHasTOF, - kNEnums }; - - /// function to calculate track length of this track up to a certain segment of a detector - /// to be used internally in another funcrtion that calculates length until it finds the proper one - /// warning: this could be optimised further for speed - /// \param track the input track - /// \param x1 x of the first point of the detector segment - /// \param y1 y of the first point of the detector segment - /// \param x2 x of the first point of the detector segment - /// \param y2 y of the first point of the detector segment - /// \param magneticField the magnetic field to use when propagating - float trackLengthToSegment(o2::track::TrackPar track, float x1, float y1, float x2, float y2, float magneticField) - { - // don't make use of the track parametrization - float length = -104; - - // causality protection - std::array mom; - track.getPxPyPzGlo(mom); - // get start point - std::array startPoint; - track.getXYZGlo(startPoint); - - // better replaced with scalar momentum check later - // if (((x1 + x2) * mom[0] + (y1 + y2) * mom[1]) < 0.0f) - // return -101; - - // get circle X, Y please - o2::math_utils::CircleXYf_t trcCircle; - float sna, csa; - track.getCircleParams(magneticField, trcCircle, sna, csa); - - // Calculate necessary inner product - float segmentModulus = std::hypot(x2 - x1, y2 - y1); - float alongSegment = ((trcCircle.xC - x1) * (x2 - x1) + (trcCircle.yC - y1) * (y2 - y1)) / segmentModulus; - - // find point of closest approach between segment and circle center - float pcaX = (x2 - x1) * alongSegment / segmentModulus + x1; - float pcaY = (y2 - y1) * alongSegment / segmentModulus + y1; - - float centerDistToPC = std::hypot(pcaX - trcCircle.xC, pcaY - trcCircle.yC); - - // distance pca-to-intercept in multiples of segment modulus (for convenience) - if (centerDistToPC > trcCircle.rC) - return -103; - - float pcaToIntercept = TMath::Sqrt(TMath::Abs(trcCircle.rC * trcCircle.rC - centerDistToPC * centerDistToPC)); - - float interceptX1 = pcaX + (x2 - x1) / segmentModulus * pcaToIntercept; - float interceptY1 = pcaY + (y2 - y1) / segmentModulus * pcaToIntercept; - float interceptX2 = pcaX - (x2 - x1) / segmentModulus * pcaToIntercept; - float interceptY2 = pcaY - (y2 - y1) / segmentModulus * pcaToIntercept; - - float scalarCheck1 = ((x2 - x1) * (interceptX1 - x1) + (y2 - y1) * (interceptY1 - y1)) / segmentModulus; - float scalarCheck2 = ((x2 - x1) * (interceptX2 - x1) + (y2 - y1) * (interceptY2 - y1)) / segmentModulus; - - float cosAngle1 = -1000, sinAngle1 = -1000, modulus1 = -1000; - float cosAngle2 = -1000, sinAngle2 = -1000, modulus2 = -1000; - float length1 = -1000, length2 = -1000; - - modulus1 = std::hypot(interceptX1 - trcCircle.xC, interceptY1 - trcCircle.yC) * std::hypot(startPoint[0] - trcCircle.xC, startPoint[1] - trcCircle.yC); - cosAngle1 = (interceptX1 - trcCircle.xC) * (startPoint[0] - trcCircle.xC) + (interceptY1 - trcCircle.yC) * (startPoint[1] - trcCircle.yC); - sinAngle1 = (interceptX1 - trcCircle.xC) * (startPoint[1] - trcCircle.yC) - (interceptY1 - trcCircle.yC) * (startPoint[0] - trcCircle.xC); - cosAngle1 /= modulus1; - sinAngle1 /= modulus1; - length1 = trcCircle.rC * TMath::ACos(cosAngle1); - length1 *= sqrt(1.0f + track.getTgl() * track.getTgl()); - - modulus2 = std::hypot(interceptX2 - trcCircle.xC, interceptY2 - trcCircle.yC) * std::hypot(startPoint[0] - trcCircle.xC, startPoint[1] - trcCircle.yC); - cosAngle2 = (interceptX2 - trcCircle.xC) * (startPoint[0] - trcCircle.xC) + (interceptY2 - trcCircle.yC) * (startPoint[1] - trcCircle.yC); - sinAngle2 = (interceptX2 - trcCircle.xC) * (startPoint[1] - trcCircle.yC) - (interceptY2 - trcCircle.yC) * (startPoint[0] - trcCircle.xC); - cosAngle2 /= modulus2; - sinAngle2 /= modulus2; - length2 = trcCircle.rC * TMath::ACos(cosAngle2); - length2 *= sqrt(1.0f + track.getTgl() * track.getTgl()); - - // rotate transverse momentum vector such that it is at intercepts - float angle1 = TMath::ACos(cosAngle1); - if (sinAngle1 < 0) - angle1 *= -1.0f; - float px1 = +TMath::Cos(angle1) * mom[0] + TMath::Sin(angle1) * mom[1]; - float py1 = -TMath::Sin(angle1) * mom[0] + TMath::Cos(angle1) * mom[1]; - - float angle2 = TMath::ACos(cosAngle2); - if (sinAngle2 < 0) - angle2 *= -1.0f; - float px2 = +TMath::Cos(angle2) * mom[0] + TMath::Sin(angle2) * mom[1]; - float py2 = -TMath::Sin(angle2) * mom[0] + TMath::Cos(angle2) * mom[1]; - - float midSegX = 0.5f * (x2 + x1); - float midSegY = 0.5f * (y2 + y1); - - float scalarMomentumCheck1 = px1 * midSegX + py1 * midSegY; - float scalarMomentumCheck2 = px2 * midSegX + py2 * midSegY; - - if (scalarCheck1 > 0.0f && scalarCheck1 < segmentModulus && scalarMomentumCheck1 > 0.0f) { - length = length1; - // X = interceptX1; Y = interceptY1; - } - if (scalarCheck2 > 0.0f && scalarCheck2 < segmentModulus && scalarMomentumCheck2 > 0.0f) { - length = length2; - // X = interceptX2; Y = interceptY2; - } - return length; - } - - /// function to calculate track length of this track up to a certain segmented detector - /// \param track the input track - /// \param magneticField the magnetic field to use when propagating - float findInterceptLength(o2::track::TrackPar track, float magneticField) - { - float length = 1e+6; - for (int iSeg = 0; iSeg < 18; iSeg++) { - // Detector segmentation loop - float segmentAngle = 20.0f / 180.0f * TMath::Pi(); - float theta = static_cast(iSeg) * 20.0f / 180.0f * TMath::Pi(); - float halfWidth = tofPosition * TMath::Tan(0.5f * segmentAngle); - float x1 = TMath::Cos(theta) * (-halfWidth) + TMath::Sin(theta) * tofPosition; - float y1 = -TMath::Sin(theta) * (-halfWidth) + TMath::Cos(theta) * tofPosition; - float x2 = TMath::Cos(theta) * (+halfWidth) + TMath::Sin(theta) * tofPosition; - float y2 = -TMath::Sin(theta) * (+halfWidth) + TMath::Cos(theta) * tofPosition; - float thisLength = trackLengthToSegment(track, x1, y1, x2, y2, magneticField); - if (thisLength < length && thisLength > 0) - length = thisLength; - } - if (length > 1e+5) - length = -100; // force negative to avoid misunderstandings - return length; - } - - void init(InitContext&) - { - nSigmaCalibLoaded = false; - nSigmaCalibObjects = nullptr; - - // for n-sigma calibration - hMeanPosLaPi = nullptr; - hSigmaPosLaPi = nullptr; - hMeanPosLaPr = nullptr; - hSigmaPosLaPr = nullptr; - hMeanNegLaPi = nullptr; - hSigmaNegLaPi = nullptr; - hMeanNegLaPr = nullptr; - hSigmaNegLaPr = nullptr; - hMeanPosK0Pi = nullptr; - hSigmaNegK0Pi = nullptr; - hMeanNegK0Pi = nullptr; - hSigmaNegK0Pi = nullptr; - - mRunNumber = 0; - d_bz = 0; - maxSnp = 0.85f; // could be changed later - maxStep = 2.00f; // could be changed later - - ccdb->setURL(ccdburl); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - ccdb->setFatalWhenNull(false); - - // per event - histos.add("hCandidateCounter", "hCandidateCounter", kTH1F, {{500, -0.5f, 499.5f}}); - - // measured vs expected total time QA - if (doQA) { - histos.add("h2dProtonMeasuredVsExpected", "h2dProtonMeasuredVsExpected", {HistType::kTH2F, {axisTime, axisTime}}); - histos.add("h2dPionMeasuredVsExpected", "h2dPionMeasuredVsExpected", {HistType::kTH2F, {axisTime, axisTime}}); - - // standard deltaTime values - histos.add("h2dDeltaTimePositiveLambdaPi", "h2dDeltaTimePositiveLambdaPi", {HistType::kTH3F, {axisPt, axisEta, axisDeltaTime}}); - histos.add("h2dDeltaTimeNegativeLambdaPi", "h2dDeltaTimeNegativeLambdaPi", {HistType::kTH3F, {axisPt, axisEta, axisDeltaTime}}); - histos.add("h2dDeltaTimePositiveLambdaPr", "h2dDeltaTimePositiveLambdaPr", {HistType::kTH3F, {axisPt, axisEta, axisDeltaTime}}); - histos.add("h2dDeltaTimeNegativeLambdaPr", "h2dDeltaTimeNegativeLambdaPr", {HistType::kTH3F, {axisPt, axisEta, axisDeltaTime}}); - histos.add("h2dDeltaTimePositiveK0ShortPi", "h2dDeltaTimePositiveK0ShortPi", {HistType::kTH3F, {axisPt, axisEta, axisDeltaTime}}); - histos.add("h2dDeltaTimeNegativeK0ShortPi", "h2dDeltaTimeNegativeK0ShortPi", {HistType::kTH3F, {axisPt, axisEta, axisDeltaTime}}); - - histos.add("h2dPositiveTOFProperties", "h2dPositiveTOFProperties", {HistType::kTH2F, {axisPt, {4, -0.5, 3.5f}}}); - histos.add("h2dNegativeTOFProperties", "h2dNegativeTOFProperties", {HistType::kTH2F, {axisPt, {4, -0.5, 3.5f}}}); - - if (doQANSigma) { - // standard NSigma values - histos.add("h2dNSigmaPositiveLambdaPi", "h2dNSigmaPositiveLambdaPi", {HistType::kTH2F, {axisPt, axisNSigma}}); - histos.add("h2dNSigmaNegativeLambdaPi", "h2dNSigmaNegativeLambdaPi", {HistType::kTH2F, {axisPt, axisNSigma}}); - histos.add("h2dNSigmaPositiveLambdaPr", "h2dNSigmaPositiveLambdaPr", {HistType::kTH2F, {axisPt, axisNSigma}}); - histos.add("h2dNSigmaNegativeLambdaPr", "h2dNSigmaNegativeLambdaPr", {HistType::kTH2F, {axisPt, axisNSigma}}); - histos.add("h2dNSigmaPositiveK0ShortPi", "h2dNSigmaPositiveK0ShortPi", {HistType::kTH2F, {axisPt, axisNSigma}}); - histos.add("h2dNSigmaNegativeK0ShortPi", "h2dNSigmaNegativeK0ShortPi", {HistType::kTH2F, {axisPt, axisNSigma}}); - } - - // delta lambda decay time - histos.add("h2dLambdaDeltaDecayTime", "h2dLambdaDeltaDecayTime", {HistType::kTH2F, {axisPt, axisDeltaTime}}); - } - } - - void initCCDB(int runNumber) - { - if (mRunNumber == runNumber) { - return; - } - - // In case override, don't proceed, please - no CCDB access required - if (d_bz_input > -990) { - d_bz = d_bz_input; - o2::parameters::GRPMagField grpmag; - if (fabs(d_bz) > 1e-5) { - grpmag.setL3Current(30000.f / (d_bz / 5.0f)); - } - o2::base::Propagator::initFieldFromGRP(&grpmag); - mVtx = ccdb->getForRun(mVtxPath, runNumber); - mRunNumber = runNumber; - return; - } - - o2::parameters::GRPObject* grpo = ccdb->getForRun(grpPath, runNumber); - o2::parameters::GRPMagField* grpmag = 0x0; - if (grpo) { - o2::base::Propagator::initFieldFromGRP(grpo); - // Fetch magnetic field from ccdb for current collision - d_bz = grpo->getNominalL3Field(); - LOG(info) << "Retrieved GRP for run " << runNumber << " with magnetic field of " << d_bz << " kZG"; - } else { - grpmag = ccdb->getForRun(grpmagPath, runNumber); - if (!grpmag) { - LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for run " << runNumber; - } - o2::base::Propagator::initFieldFromGRP(grpmag); - // Fetch magnetic field from ccdb for current collision - d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); - mVtx = ccdb->getForRun(mVtxPath, runNumber); - LOG(info) << "Retrieved GRP for run " << runNumber << " with magnetic field of " << d_bz << " kZG"; - } - - // if TOF Nsigma desired - if (doNSigmas) { - nSigmaCalibObjects = ccdb->getForRun(nSigmaPath, runNumber); - if (nSigmaCalibObjects) { - LOGF(info, "loaded TList with this many objects: %i", nSigmaCalibObjects->GetEntries()); - - hMeanPosLaPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanPosLaPi")); - hMeanPosLaPr = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanPosLaPr")); - hMeanNegLaPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanNegLaPi")); - hMeanNegLaPr = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanNegLaPr")); - hMeanPosK0Pi = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanPosK0Pi")); - hMeanNegK0Pi = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanNegK0Pi")); - - hSigmaPosLaPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaPosLaPi")); - hSigmaPosLaPr = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaPosLaPr")); - hSigmaNegLaPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaNegLaPi")); - hSigmaNegLaPr = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaNegLaPr")); - hSigmaPosK0Pi = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaPosK0Pi")); - hSigmaNegK0Pi = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaNegK0Pi")); - - if (!hMeanPosLaPi) - LOG(info) << "Problems finding mean histogram hMeanPosLaPi!"; - if (!hMeanPosLaPr) - LOG(info) << "Problems finding mean histogram hMeanPosLaPr!"; - if (!hMeanNegLaPi) - LOG(info) << "Problems finding mean histogram hMeanNegLaPi!"; - if (!hMeanNegLaPr) - LOG(info) << "Problems finding mean histogram hMeanNegLaPr!"; - if (!hMeanPosK0Pi) - LOG(info) << "Problems finding mean histogram hMeanPosK0Pi!"; - if (!hMeanNegK0Pi) - LOG(info) << "Problems finding mean histogram hMeanNegK0Pi!"; - if (!hSigmaPosK0Pi || !hSigmaNegK0Pi || !hSigmaPosLaPi || !hSigmaPosLaPr || !hSigmaNegLaPi || !hSigmaNegLaPr) { - LOG(info) << "Problems finding sigma histograms!"; - } - } - } - mRunNumber = runNumber; - } - - float velocity(float lMomentum, float lMass) - { - // Momentum p and mass m -> returns speed in centimeters per picosecond - // Useful for TOF calculations - float lA = (lMomentum / lMass) * (lMomentum / lMass); - return 0.0299792458 * TMath::Sqrt(lA / (1 + lA)); - } - - // templatized process function for symmetric operation in derived and original AO2D - template - void processV0Candidate(TCollision const& collision, TV0 const& v0, TTrack const& pTra, TTrack const& nTra) - { - // time of V0 segment - float lengthV0 = std::hypot(v0.x() - collision.getX(), v0.y() - collision.getY(), v0.z() - collision.getZ()); - float velocityK0Short = velocity(v0.p(), o2::constants::physics::MassKaonNeutral); - float velocityLambda = velocity(v0.p(), o2::constants::physics::MassLambda); - float timeK0Short = lengthV0 / velocityK0Short; // in picoseconds - float timeLambda = lengthV0 / velocityLambda; // in picoseconds - - // initialize from V0 position and momenta - o2::track::TrackPar posTrack = o2::track::TrackPar({v0.x(), v0.y(), v0.z()}, {v0.pxpos(), v0.pypos(), v0.pzpos()}, +1); - o2::track::TrackPar negTrack = o2::track::TrackPar({v0.x(), v0.y(), v0.z()}, {v0.pxneg(), v0.pyneg(), v0.pzneg()}, -1); - - float deltaTimePositiveLambdaPi = -1e+6; - float deltaTimeNegativeLambdaPi = -1e+6; - float deltaTimePositiveLambdaPr = -1e+6; - float deltaTimeNegativeLambdaPr = -1e+6; - float deltaTimePositiveK0ShortPi = -1e+6; - float deltaTimeNegativeK0ShortPi = -1e+6; - - float nSigmaPositiveLambdaPi = -1e+3; - float nSigmaPositiveLambdaPr = -1e+3; - float nSigmaNegativeLambdaPi = -1e+3; - float nSigmaNegativeLambdaPr = -1e+3; - float nSigmaPositiveK0ShortPi = -1e+3; - float nSigmaNegativeK0ShortPi = -1e+3; - - float velocityPositivePr = velocity(posTrack.getP(), o2::constants::physics::MassProton); - float velocityPositivePi = velocity(posTrack.getP(), o2::constants::physics::MassPionCharged); - float velocityNegativePr = velocity(negTrack.getP(), o2::constants::physics::MassProton); - float velocityNegativePi = velocity(negTrack.getP(), o2::constants::physics::MassPionCharged); - - float lengthPositive = findInterceptLength(posTrack, d_bz); // FIXME: tofPosition ok? adjust? - float lengthNegative = findInterceptLength(negTrack, d_bz); // FIXME: tofPosition ok? adjust? - float timePositivePr = lengthPositive / velocityPositivePr; - float timePositivePi = lengthPositive / velocityPositivePi; - float timeNegativePr = lengthNegative / velocityNegativePr; - float timeNegativePi = lengthNegative / velocityNegativePi; - - if (pTra.hasTOF() && lengthPositive > 0) { - deltaTimePositiveLambdaPr = (pTra.tofSignal() - pTra.tofEvTime()) - (timeLambda + timePositivePr); - deltaTimePositiveLambdaPi = (pTra.tofSignal() - pTra.tofEvTime()) - (timeLambda + timePositivePi); - deltaTimePositiveK0ShortPi = (pTra.tofSignal() - pTra.tofEvTime()) - (timeK0Short + timePositivePi); - } - if (nTra.hasTOF() && lengthNegative > 0) { - deltaTimeNegativeLambdaPr = (nTra.tofSignal() - nTra.tofEvTime()) - (timeLambda + timeNegativePr); - deltaTimeNegativeLambdaPi = (nTra.tofSignal() - nTra.tofEvTime()) - (timeLambda + timeNegativePi); - deltaTimeNegativeK0ShortPi = (nTra.tofSignal() - nTra.tofEvTime()) - (timeK0Short + timeNegativePi); - } - - if (doQA) { - // calculate and pack properties for QA purposes - int posProperties = 0; - if (lengthPositive > 0) - posProperties = posProperties | (static_cast(1) << kLength); - if (pTra.hasTOF()) - posProperties = posProperties | (static_cast(1) << kHasTOF); - int negProperties = 0; - if (lengthNegative > 0) - negProperties = negProperties | (static_cast(1) << kLength); - if (nTra.hasTOF()) - negProperties = negProperties | (static_cast(1) << kHasTOF); - - histos.fill(HIST("h2dPositiveTOFProperties"), v0.pt(), posProperties); - histos.fill(HIST("h2dNegativeTOFProperties"), v0.pt(), negProperties); - } - - float deltaDecayTimeLambda = -10e+4; - float deltaDecayTimeAntiLambda = -10e+4; - float deltaDecayTimeK0Short = -10e+4; - if (nTra.hasTOF() && pTra.hasTOF() > 0 && lengthPositive > 0 && lengthNegative > 0) { // does not depend on event time - deltaDecayTimeLambda = (pTra.tofSignal() - timePositivePr) - (nTra.tofSignal() - timeNegativePi); - deltaDecayTimeAntiLambda = (pTra.tofSignal() - timePositivePi) - (nTra.tofSignal() - timeNegativePr); - deltaDecayTimeK0Short = (pTra.tofSignal() - timePositivePi) - (nTra.tofSignal() - timeNegativePi); - } - - // calculate betas - - float evTimeMean = 0.5f * (pTra.tofEvTime() + nTra.tofEvTime()); - float decayTimeLambda = 0.5f * ((pTra.tofSignal() - timePositivePr) + (nTra.tofSignal() - timeNegativePi)) - evTimeMean; - float decayTimeAntiLambda = 0.5f * ((pTra.tofSignal() - timePositivePi) + (nTra.tofSignal() - timeNegativePr)) - evTimeMean; - float decayTimeK0Short = 0.5f * ((pTra.tofSignal() - timePositivePi) + (nTra.tofSignal() - timeNegativePi)) - evTimeMean; - - float betaLambda = -1e+6; - float betaAntiLambda = -1e+6; - float betaK0Short = -1e+6; - - if (nTra.hasTOF() && pTra.hasTOF()) { - betaLambda = (lengthV0 / decayTimeLambda) / 0.0299792458; - betaAntiLambda = (lengthV0 / decayTimeAntiLambda) / 0.0299792458; - betaK0Short = (lengthV0 / decayTimeK0Short) / 0.0299792458; - } - - v0tofpid(deltaTimePositiveLambdaPi, deltaTimePositiveLambdaPr, - deltaTimeNegativeLambdaPi, deltaTimeNegativeLambdaPr, - deltaTimePositiveK0ShortPi, deltaTimeNegativeK0ShortPi, - deltaDecayTimeLambda, deltaDecayTimeAntiLambda, deltaDecayTimeK0Short); - v0tofbeta(betaLambda, betaAntiLambda, betaK0Short); - v0tofdebugs(timeLambda, timeK0Short, timePositivePr, timePositivePi, timeNegativePr, timeNegativePi); - - // do Nsigmas if requested - if (doNSigmas) { - // sweep through all viable hypotheses and produce N-sigma - - if (deltaTimePositiveLambdaPi > -1e+5) - nSigmaPositiveLambdaPi = (deltaTimePositiveLambdaPi - hMeanPosLaPi->Interpolate(v0.pt())) / hSigmaPosLaPi->Interpolate(v0.pt()); - if (deltaTimePositiveLambdaPr > -1e+5) - nSigmaPositiveLambdaPr = (deltaTimePositiveLambdaPr - hMeanPosLaPr->Interpolate(v0.pt())) / hSigmaPosLaPr->Interpolate(v0.pt()); - if (deltaTimeNegativeLambdaPi > -1e+5) - nSigmaNegativeLambdaPi = (deltaTimeNegativeLambdaPi - hMeanNegLaPi->Interpolate(v0.pt())) / hSigmaNegLaPi->Interpolate(v0.pt()); - if (deltaTimeNegativeLambdaPr > -1e+5) - nSigmaNegativeLambdaPr = (deltaTimeNegativeLambdaPr - hMeanNegLaPr->Interpolate(v0.pt())) / hSigmaNegLaPr->Interpolate(v0.pt()); - if (deltaTimePositiveK0ShortPi > -1e+5) - nSigmaPositiveK0ShortPi = (deltaTimePositiveK0ShortPi - hMeanPosK0Pi->Interpolate(v0.pt())) / hSigmaPosK0Pi->Interpolate(v0.pt()); - if (deltaTimeNegativeK0ShortPi > -1e+5) - nSigmaNegativeK0ShortPi = (deltaTimeNegativeK0ShortPi - hMeanNegK0Pi->Interpolate(v0.pt())) / hSigmaNegK0Pi->Interpolate(v0.pt()); - - v0tofnsigmas( - nSigmaPositiveLambdaPr, nSigmaNegativeLambdaPi, - nSigmaNegativeLambdaPr, nSigmaPositiveLambdaPi, - nSigmaPositiveK0ShortPi, nSigmaNegativeK0ShortPi); - } - - if (doQA) { - if (pTra.hasTOF()) { - histos.fill(HIST("h2dProtonMeasuredVsExpected"), - (timeLambda + timePositivePr), - (pTra.tofSignal() - pTra.tofEvTime())); - if (v0.v0cosPA() > qaCosPA && v0.dcaV0daughters() < qaDCADau) { - if (std::abs(v0.mLambda() - 1.115683) < qaMassWindow && fabs(pTra.tpcNSigmaPr()) < qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < qaTPCNSigma) { - histos.fill(HIST("h2dDeltaTimePositiveLambdaPr"), v0.pt(), v0.eta(), deltaTimePositiveLambdaPr); - if (doQANSigma) - histos.fill(HIST("h2dNSigmaPositiveLambdaPr"), v0.pt(), nSigmaPositiveLambdaPr); - } - if (std::abs(v0.mAntiLambda() - 1.115683) < qaMassWindow && fabs(pTra.tpcNSigmaPi()) < qaTPCNSigma && fabs(nTra.tpcNSigmaPr()) < qaTPCNSigma) { - histos.fill(HIST("h2dDeltaTimePositiveLambdaPi"), v0.pt(), v0.eta(), deltaTimePositiveLambdaPi); - if (doQANSigma) - histos.fill(HIST("h2dNSigmaPositiveLambdaPi"), v0.pt(), nSigmaPositiveLambdaPi); - } - if (std::abs(v0.mK0Short() - 0.497) < qaMassWindow && fabs(pTra.tpcNSigmaPi()) < qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < qaTPCNSigma) { - histos.fill(HIST("h2dDeltaTimePositiveK0ShortPi"), v0.pt(), v0.eta(), deltaTimePositiveK0ShortPi); - if (doQANSigma) - histos.fill(HIST("h2dNSigmaPositiveK0ShortPi"), v0.pt(), nSigmaPositiveK0ShortPi); - } - } - } - - if (nTra.hasTOF()) { - histos.fill(HIST("h2dPionMeasuredVsExpected"), - (timeLambda + timeNegativePi), - (nTra.tofSignal() - nTra.tofEvTime())); - if (v0.v0cosPA() > qaCosPA && v0.dcaV0daughters() < qaDCADau) { - if (std::abs(v0.mLambda() - 1.115683) < qaMassWindow && fabs(pTra.tpcNSigmaPr()) < qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < qaTPCNSigma) { - histos.fill(HIST("h2dDeltaTimeNegativeLambdaPi"), v0.pt(), v0.eta(), deltaTimeNegativeLambdaPi); - if (doQANSigma) - histos.fill(HIST("h2dNSigmaNegativeLambdaPi"), v0.pt(), nSigmaNegativeLambdaPi); - } - if (std::abs(v0.mAntiLambda() - 1.115683) < qaMassWindow && fabs(pTra.tpcNSigmaPi()) < qaTPCNSigma && fabs(nTra.tpcNSigmaPr()) < qaTPCNSigma) { - histos.fill(HIST("h2dDeltaTimeNegativeLambdaPr"), v0.pt(), v0.eta(), deltaTimeNegativeLambdaPr); - if (doQANSigma) - histos.fill(HIST("h2dNSigmaNegativeLambdaPr"), v0.pt(), nSigmaNegativeLambdaPr); - } - if (std::abs(v0.mK0Short() - 0.497) < qaMassWindow && fabs(pTra.tpcNSigmaPi()) < qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < qaTPCNSigma) { - histos.fill(HIST("h2dDeltaTimeNegativeK0ShortPi"), v0.pt(), v0.eta(), deltaTimeNegativeK0ShortPi); - if (doQANSigma) - histos.fill(HIST("h2dNSigmaNegativeK0ShortPi"), v0.pt(), nSigmaNegativeK0ShortPi); - } - } - } - // delta lambda decay time - histos.fill(HIST("h2dLambdaDeltaDecayTime"), v0.pt(), deltaDecayTimeLambda); - } - } - - void processStandardData(aod::Collisions const& collisions, V0OriginalDatas const& V0s, TracksWithAllExtras const&, aod::BCsWithTimestamps const& /*bcs*/) - { - // Fire up CCDB with first collision in record. If no collisions, bypass - if (useCustomRunNumber || collisions.size() < 1) { - initCCDB(manualRunNumber); - } else { - auto collision = collisions.begin(); - auto bc = collision.bc_as(); - initCCDB(bc.runNumber()); - } - - for (const auto& V0 : V0s) { - // for storing whatever is the relevant quantity for the PV - o2::dataformats::VertexBase primaryVertex; - if (V0.has_collision()) { - auto const& collision = V0.collision(); - primaryVertex.setPos({collision.posX(), collision.posY(), collision.posZ()}); - primaryVertex.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - } else { - primaryVertex.setPos({mVtx->getX(), mVtx->getY(), mVtx->getZ()}); - } - - auto pTra = V0.posTrack_as(); - auto nTra = V0.negTrack_as(); - processV0Candidate(primaryVertex, V0, pTra, nTra); - } - } - - void processDerivedData(soa::Join const& collisions, V0DerivedDatas const& V0s, dauTracks const&) - { - // Fire up CCDB with first collision in record. If no collisions, bypass - if (useCustomRunNumber || collisions.size() < 1) { - initCCDB(manualRunNumber); - } else { - auto collision = collisions.begin(); - initCCDB(collision.runNumber()); - } - - for (const auto& V0 : V0s) { - // for storing whatever is the relevant quantity for the PV - o2::dataformats::VertexBase primaryVertex; - if (V0.has_straCollision()) { - auto const& collision = V0.straCollision_as>(); - primaryVertex.setPos({collision.posX(), collision.posY(), collision.posZ()}); - // cov: won't be used anyways, all fine - primaryVertex.setCov(1e-6, 1e-6, 1e-6, 1e-6, 1e-6, 1e-6); - } else { - primaryVertex.setPos({mVtx->getX(), mVtx->getY(), mVtx->getZ()}); - } - - auto pTra = V0.posTrackExtra_as(); - auto nTra = V0.negTrackExtra_as(); - processV0Candidate(primaryVertex, V0, pTra, nTra); - } - } - - PROCESS_SWITCH(lambdakzeropid, processStandardData, "Process standard data", true); - PROCESS_SWITCH(lambdakzeropid, processDerivedData, "Process derived data", false); -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - return WorkflowSpec{ - adaptAnalysisTask(cfgc)}; -} diff --git a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx new file mode 100644 index 00000000000..75cb771dbea --- /dev/null +++ b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx @@ -0,0 +1,1012 @@ +// 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. +// +// *+-+*+-+*+-+*+-+*+-+*+-+* +// Lambdakzero PID +// *+-+*+-+*+-+*+-+*+-+*+-+* +// +/// \author Nicolò Jacazio +/// \author David Dobrigkeit Chinellato +/// \since 11/05/2023 +/// \brief Table producer for V0 daughter PID info +// +// This task produces daughter PID information for strange daughters +// taking into account the (candidate-by-candidate) time spent as a heavier +// (strange, weakly-decaying) particle. This task is meant to be a test, as +// it hasn't been fully tested yet! Use at your own peril for now :-) + +#include "TableHelper.h" + +#include "PWGLF/DataModel/LFParticleIdentification.h" +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/TableProducer/PID/pidTOFBase.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/PhysicsConstants.h" +#include "DCAFitter/DCAFitterN.h" +#include "DataFormatsCalibration/MeanVertexObject.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" + +#include +#include +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using std::array; + +// For original data loops +using V0OriginalDatas = soa::Join; +using CascOriginalDatas = soa::Join; +using TracksWithAllExtras = soa::Join; + +// For derived data analysis +using dauTracks = soa::Join; +using V0DerivedDatas = soa::Join; +using CascDerivedDatas = soa::Join; + +struct strangenesstofpid { + // TOF pid for strangeness (recalculated with topology) + Produces v0tofpid; // table with Nsigmas + Produces v0tofbeta; // table with betas + Produces v0tofdebugs; // table with extra debug information + Produces v0tofnsigmas; // table with nsigmas + Produces casctofpids; // cascades: table with base info + Produces casctofnsigmas; // cascades: table with Nsigmas + + Service ccdb; + + // mean vertex position to be used if no collision associated + o2::dataformats::MeanVertexObject* mVtx = nullptr; + + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // master switches + Configurable calculateV0s{"calculateV0s", -1, "calculate V0-related TOF PID (0: no, 1: yes, -1: auto)"}; + Configurable calculateCascades{"calculateCascades", -1, "calculate cascade-related TOF PID (0: no, 1: yes, -1: auto)"}; + + // Operation and minimisation criteria + Configurable d_bz_input{"d_bz", -999, "bz field, -999 is automatic"}; + Configurable tofPosition{"tofPosition", 377.934f, "TOF effective (inscribed) radius"}; + Configurable doQA{"doQA", true, "create QA histos"}; + Configurable doNSigmas{"doNSigmas", false, "calculate TOF N-sigma"}; + Configurable doQANSigma{"doQANSigma", true, "create QA of Nsigma histos"}; + + // configurables related to V0s + struct : ConfigurableGroup { + std::string prefix = "v0Calibration"; + Configurable qaDCADau{"qaDCADau", 0.5, "DCA daughters (cm) for QA plots"}; + Configurable qaCosPA{"qaCosPA", 0.999, "CosPA for QA plots"}; + Configurable qaMassWindow{"qaMassWindow", 0.005, "Mass window around expected (in GeV/c2) for QA plots"}; + Configurable qaTPCNSigma{"qaTPCNSigma", 5, "TPC N-sigma to apply for qa plots"}; + } v0Group; + + // configurables related to V0s + struct : ConfigurableGroup { + std::string prefix = "cascadeCalibration"; + Configurable qaV0DCADau{"qaV0DCADau", 0.5, "DCA daughters (cm) for QA plots"}; + Configurable qaCascDCADau{"qaCascDCADau", 0.5, "DCA daughters (cm) for QA plots"}; + Configurable qaV0CosPA{"qaV0CosPA", 0.995, "CosPA for QA plots"}; + Configurable qaCascCosPA{"qaCascCosPA", 0.995, "CosPA for QA plots"}; + Configurable qaMassWindow{"qaMassWindow", 0.005, "Mass window around expected (in GeV/c2) for QA plots"}; + Configurable qaTPCNSigma{"qaTPCNSigma", 5, "TPC N-sigma to apply for qa plots"}; + } cascadeGroup; + + // CCDB options + Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; + Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; + Configurable nSigmaPath{"nSigmaPath", "Users/d/ddobrigk/stratof", "Path of information for n-sigma calculation"}; + Configurable mVtxPath{"mVtxPath", "GLO/Calib/MeanVertex", "Path of the mean vertex file"}; + + // manual + Configurable useCustomRunNumber{"useCustomRunNumber", false, "Use custom timestamp"}; + Configurable manualRunNumber{"manualRunNumber", 544122, "manual run number if no collisions saved"}; + + ConfigurableAxis axisEta{"axisEta", {20, -1.0f, +1.0f}, "#eta"}; + ConfigurableAxis axisDeltaTime{"axisDeltaTime", {2000, -1000.0f, +1000.0f}, "delta-time (ps)"}; + ConfigurableAxis axisTime{"axisTime", {200, 10000.0f, +20000.0f}, "T (ps)"}; + ConfigurableAxis axisNSigma{"axisNSigma", {200, -10.0f, +10.0f}, "N(#sigma)"}; + ConfigurableAxis axisExpectedOverMeasured{"axisExpectedOverMeasured", {200, 0.9f, 2.9f}, "T_{exp}/T_{meas}"}; + + // master p axis + ConfigurableAxis axisP{"axisP", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "p_{T} (GeV/c)"}; + + // for zooming in at low values only (e-loss studies and effective correction) + ConfigurableAxis axisSmallP{"axisSmallP", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f}, "p_{T} (GeV/c)"}; + + // for n-sigma calibration + bool nSigmaCalibLoaded; + TList* nSigmaCalibObjects; + TH1 *hMeanPosLaPi, *hSigmaPosLaPi; + TH1 *hMeanPosLaPr, *hSigmaPosLaPr; + TH1 *hMeanNegLaPi, *hSigmaNegLaPi; + TH1 *hMeanNegLaPr, *hSigmaNegLaPr; + TH1 *hMeanPosK0Pi, *hSigmaPosK0Pi; + TH1 *hMeanNegK0Pi, *hSigmaNegK0Pi; + TH1 *hMeanPosXiPi, *hSigmaPosXiPi; + TH1 *hMeanPosXiPr, *hSigmaPosXiPr; + TH1 *hMeanNegXiPi, *hSigmaNegXiPi; + TH1 *hMeanNegXiPr, *hSigmaNegXiPr; + TH1 *hMeanBachXiPi, *hSigmaBachXiPi; + TH1 *hMeanPosOmPi, *hSigmaPosOmPi; + TH1 *hMeanPosOmPr, *hSigmaPosOmPr; + TH1 *hMeanNegOmPi, *hSigmaNegOmPi; + TH1 *hMeanNegOmPr, *hSigmaNegOmPr; + TH1 *hMeanBachOmKa, *hSigmaBachOmKa; + + int mRunNumber; + float d_bz; + float maxSnp; // max sine phi for propagation + float maxStep; // max step size (cm) for propagation + + // enum to keep track of the TOF-related properties for V0s + enum tofEnum { kLength = 0, + kHasTOF, + kNEnums }; + + /// function to calculate track length of this track up to a certain segment of a detector + /// to be used internally in another funcrtion that calculates length until it finds the proper one + /// warning: this could be optimised further for speed + /// \param track the input track + /// \param x1 x of the first point of the detector segment + /// \param y1 y of the first point of the detector segment + /// \param x2 x of the first point of the detector segment + /// \param y2 y of the first point of the detector segment + /// \param magneticField the magnetic field to use when propagating + float trackLengthToSegment(o2::track::TrackPar track, float x1, float y1, float x2, float y2, float magneticField) + { + // don't make use of the track parametrization + float length = -104; + + // causality protection + std::array mom; + track.getPxPyPzGlo(mom); + // get start point + std::array startPoint; + track.getXYZGlo(startPoint); + + // better replaced with scalar momentum check later + // if (((x1 + x2) * mom[0] + (y1 + y2) * mom[1]) < 0.0f) + // return -101; + + // get circle X, Y please + o2::math_utils::CircleXYf_t trcCircle; + float sna, csa; + track.getCircleParams(magneticField, trcCircle, sna, csa); + + // Calculate necessary inner product + float segmentModulus = std::hypot(x2 - x1, y2 - y1); + float alongSegment = ((trcCircle.xC - x1) * (x2 - x1) + (trcCircle.yC - y1) * (y2 - y1)) / segmentModulus; + + // find point of closest approach between segment and circle center + float pcaX = (x2 - x1) * alongSegment / segmentModulus + x1; + float pcaY = (y2 - y1) * alongSegment / segmentModulus + y1; + + float centerDistToPC = std::hypot(pcaX - trcCircle.xC, pcaY - trcCircle.yC); + + // distance pca-to-intercept in multiples of segment modulus (for convenience) + if (centerDistToPC > trcCircle.rC) + return -103; + + float pcaToIntercept = TMath::Sqrt(TMath::Abs(trcCircle.rC * trcCircle.rC - centerDistToPC * centerDistToPC)); + + float interceptX1 = pcaX + (x2 - x1) / segmentModulus * pcaToIntercept; + float interceptY1 = pcaY + (y2 - y1) / segmentModulus * pcaToIntercept; + float interceptX2 = pcaX - (x2 - x1) / segmentModulus * pcaToIntercept; + float interceptY2 = pcaY - (y2 - y1) / segmentModulus * pcaToIntercept; + + float scalarCheck1 = ((x2 - x1) * (interceptX1 - x1) + (y2 - y1) * (interceptY1 - y1)) / segmentModulus; + float scalarCheck2 = ((x2 - x1) * (interceptX2 - x1) + (y2 - y1) * (interceptY2 - y1)) / segmentModulus; + + float cosAngle1 = -1000, sinAngle1 = -1000, modulus1 = -1000; + float cosAngle2 = -1000, sinAngle2 = -1000, modulus2 = -1000; + float length1 = -1000, length2 = -1000; + + modulus1 = std::hypot(interceptX1 - trcCircle.xC, interceptY1 - trcCircle.yC) * std::hypot(startPoint[0] - trcCircle.xC, startPoint[1] - trcCircle.yC); + cosAngle1 = (interceptX1 - trcCircle.xC) * (startPoint[0] - trcCircle.xC) + (interceptY1 - trcCircle.yC) * (startPoint[1] - trcCircle.yC); + sinAngle1 = (interceptX1 - trcCircle.xC) * (startPoint[1] - trcCircle.yC) - (interceptY1 - trcCircle.yC) * (startPoint[0] - trcCircle.xC); + cosAngle1 /= modulus1; + sinAngle1 /= modulus1; + length1 = trcCircle.rC * TMath::ACos(cosAngle1); + length1 *= sqrt(1.0f + track.getTgl() * track.getTgl()); + + modulus2 = std::hypot(interceptX2 - trcCircle.xC, interceptY2 - trcCircle.yC) * std::hypot(startPoint[0] - trcCircle.xC, startPoint[1] - trcCircle.yC); + cosAngle2 = (interceptX2 - trcCircle.xC) * (startPoint[0] - trcCircle.xC) + (interceptY2 - trcCircle.yC) * (startPoint[1] - trcCircle.yC); + sinAngle2 = (interceptX2 - trcCircle.xC) * (startPoint[1] - trcCircle.yC) - (interceptY2 - trcCircle.yC) * (startPoint[0] - trcCircle.xC); + cosAngle2 /= modulus2; + sinAngle2 /= modulus2; + length2 = trcCircle.rC * TMath::ACos(cosAngle2); + length2 *= sqrt(1.0f + track.getTgl() * track.getTgl()); + + // rotate transverse momentum vector such that it is at intercepts + float angle1 = TMath::ACos(cosAngle1); + if (sinAngle1 < 0) + angle1 *= -1.0f; + float px1 = +TMath::Cos(angle1) * mom[0] + TMath::Sin(angle1) * mom[1]; + float py1 = -TMath::Sin(angle1) * mom[0] + TMath::Cos(angle1) * mom[1]; + + float angle2 = TMath::ACos(cosAngle2); + if (sinAngle2 < 0) + angle2 *= -1.0f; + float px2 = +TMath::Cos(angle2) * mom[0] + TMath::Sin(angle2) * mom[1]; + float py2 = -TMath::Sin(angle2) * mom[0] + TMath::Cos(angle2) * mom[1]; + + float midSegX = 0.5f * (x2 + x1); + float midSegY = 0.5f * (y2 + y1); + + float scalarMomentumCheck1 = px1 * midSegX + py1 * midSegY; + float scalarMomentumCheck2 = px2 * midSegX + py2 * midSegY; + + if (scalarCheck1 > 0.0f && scalarCheck1 < segmentModulus && scalarMomentumCheck1 > 0.0f) { + length = length1; + // X = interceptX1; Y = interceptY1; + } + if (scalarCheck2 > 0.0f && scalarCheck2 < segmentModulus && scalarMomentumCheck2 > 0.0f) { + length = length2; + // X = interceptX2; Y = interceptY2; + } + return length; + } + + /// function to calculate track length of this track up to a certain segmented detector + /// \param track the input track + /// \param magneticField the magnetic field to use when propagating + float findInterceptLength(o2::track::TrackPar track, float magneticField) + { + float length = 1e+6; + for (int iSeg = 0; iSeg < 18; iSeg++) { + // Detector segmentation loop + float segmentAngle = 20.0f / 180.0f * TMath::Pi(); + float theta = static_cast(iSeg) * 20.0f / 180.0f * TMath::Pi(); + float halfWidth = tofPosition * TMath::Tan(0.5f * segmentAngle); + float x1 = TMath::Cos(theta) * (-halfWidth) + TMath::Sin(theta) * tofPosition; + float y1 = -TMath::Sin(theta) * (-halfWidth) + TMath::Cos(theta) * tofPosition; + float x2 = TMath::Cos(theta) * (+halfWidth) + TMath::Sin(theta) * tofPosition; + float y2 = -TMath::Sin(theta) * (+halfWidth) + TMath::Cos(theta) * tofPosition; + float thisLength = trackLengthToSegment(track, x1, y1, x2, y2, magneticField); + if (thisLength < length && thisLength > 0) + length = thisLength; + } + if (length > 1e+5) + length = -100; // force negative to avoid misunderstandings + return length; + } + + void init(InitContext& initContext) + { + if (calculateV0s.value < 0) { + // check if TOF information is required, enable if so + calculateV0s.value = isTableRequiredInWorkflow(initContext, "V0TOFNSigmas"); + if (calculateV0s.value > 0) { + LOGF(info, "Strangeness TOF PID: V0 calculations enabled automatically"); + } + } + if (calculateCascades.value < 0) { + // check if TOF information is required, enable if so + calculateCascades.value = isTableRequiredInWorkflow(initContext, "CascTOFNSigmas"); + if (calculateCascades.value > 0) { + LOGF(info, "Strangeness TOF PID: Cascade calculations enabled automatically"); + } + } + + nSigmaCalibLoaded = false; + nSigmaCalibObjects = nullptr; + + // for n-sigma calibration + hMeanPosLaPi = nullptr; + hSigmaPosLaPi = nullptr; + hMeanPosLaPr = nullptr; + hSigmaPosLaPr = nullptr; + hMeanNegLaPi = nullptr; + hSigmaNegLaPi = nullptr; + hMeanNegLaPr = nullptr; + hSigmaNegLaPr = nullptr; + hMeanPosK0Pi = nullptr; + hSigmaNegK0Pi = nullptr; + hMeanNegK0Pi = nullptr; + hSigmaNegK0Pi = nullptr; + + mRunNumber = 0; + d_bz = 0; + maxSnp = 0.85f; // could be changed later + maxStep = 2.00f; // could be changed later + + ccdb->setURL(ccdburl); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setFatalWhenNull(false); + + // per event + histos.add("hCandidateCounter", "hCandidateCounter", kTH1F, {{500, -0.5f, 499.5f}}); + + // measured vs expected total time QA + if (doQA) { + // plots for effective eloss corrections - Lambda case + histos.add("h2dProtonMeasuredVsExpected", "h2dProtonMeasuredVsExpected", {HistType::kTH3F, {axisSmallP, axisExpectedOverMeasured, axisEta}}); + histos.add("h2dPionMeasuredVsExpected", "h2dPionMeasuredVsExpected", {HistType::kTH3F, {axisSmallP, axisExpectedOverMeasured, axisEta}}); + + histos.add("hArcDebug", "hArcDebug", kTH2F, {axisP, {50, -5.0f, 10.0f}}); + + // standard deltaTime values + if (calculateV0s.value > 0) { + histos.add("h2dDeltaTimePositiveLambdaPi", "h2dDeltaTimePositiveLambdaPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); + histos.add("h2dDeltaTimeNegativeLambdaPi", "h2dDeltaTimeNegativeLambdaPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); + histos.add("h2dDeltaTimePositiveLambdaPr", "h2dDeltaTimePositiveLambdaPr", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); + histos.add("h2dDeltaTimeNegativeLambdaPr", "h2dDeltaTimeNegativeLambdaPr", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); + histos.add("h2dDeltaTimePositiveK0ShortPi", "h2dDeltaTimePositiveK0ShortPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); + histos.add("h2dDeltaTimeNegativeK0ShortPi", "h2dDeltaTimeNegativeK0ShortPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); + } + + if (calculateCascades.value > 0) { + histos.add("h2dposDeltaTimeAsXiPi", "h2dposDeltaTimeAsXiPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); + histos.add("h2dposDeltaTimeAsXiPr", "h2dposDeltaTimeAsXiPr", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); + histos.add("h2dnegDeltaTimeAsXiPi", "h2dnegDeltaTimeAsXiPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); + histos.add("h2dnegDeltaTimeAsXiPr", "h2dnegDeltaTimeAsXiPr", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); + histos.add("h2dbachDeltaTimeAsXiPi", "h2dbachDeltaTimeAsXiPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); + + histos.add("h2dposDeltaTimeAsOmPi", "h2dposDeltaTimeAsOmPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); + histos.add("h2dposDeltaTimeAsOmPr", "h2dposDeltaTimeAsOmPr", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); + histos.add("h2dnegDeltaTimeAsOmPi", "h2dnegDeltaTimeAsOmPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); + histos.add("h2dnegDeltaTimeAsOmPr", "h2dnegDeltaTimeAsOmPr", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); + histos.add("h2dbachDeltaTimeAsOmKa", "h2dbachDeltaTimeAsOmKa", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); + } + + histos.add("h2dPositiveTOFProperties", "h2dPositiveTOFProperties", {HistType::kTH2F, {axisP, {4, -0.5, 3.5f}}}); + histos.add("h2dNegativeTOFProperties", "h2dNegativeTOFProperties", {HistType::kTH2F, {axisP, {4, -0.5, 3.5f}}}); + + if (doQANSigma) { + if (calculateV0s.value > 0) { + histos.add("h2dNSigmaPositiveLambdaPi", "h2dNSigmaPositiveLambdaPi", {HistType::kTH2F, {axisP, axisNSigma}}); + histos.add("h2dNSigmaNegativeLambdaPi", "h2dNSigmaNegativeLambdaPi", {HistType::kTH2F, {axisP, axisNSigma}}); + histos.add("h2dNSigmaPositiveLambdaPr", "h2dNSigmaPositiveLambdaPr", {HistType::kTH2F, {axisP, axisNSigma}}); + histos.add("h2dNSigmaNegativeLambdaPr", "h2dNSigmaNegativeLambdaPr", {HistType::kTH2F, {axisP, axisNSigma}}); + histos.add("h2dNSigmaPositiveK0ShortPi", "h2dNSigmaPositiveK0ShortPi", {HistType::kTH2F, {axisP, axisNSigma}}); + histos.add("h2dNSigmaNegativeK0ShortPi", "h2dNSigmaNegativeK0ShortPi", {HistType::kTH2F, {axisP, axisNSigma}}); + } + + if (calculateCascades.value > 0) { + histos.add("h2dNSigmaXiLaPi", "h2dNSigmaXiLaPi", {HistType::kTH2F, {axisP, axisNSigma}}); + histos.add("h2dNSigmaXiLaPr", "h2dNSigmaXiLaPr", {HistType::kTH2F, {axisP, axisNSigma}}); + histos.add("h2dNSigmaXiPi", "h2dNSigmaXiPi", {HistType::kTH2F, {axisP, axisNSigma}}); + histos.add("h2dNSigmaOmLaPi", "h2dNSigmaOmLaPi", {HistType::kTH2F, {axisP, axisNSigma}}); + histos.add("h2dNSigmaOmLaPr", "h2dNSigmaOmLaPr", {HistType::kTH2F, {axisP, axisNSigma}}); + histos.add("h2dNSigmaOmKa", "h2dNSigmaOmKa", {HistType::kTH2F, {axisP, axisNSigma}}); + } + } + + // delta lambda decay time + histos.add("h2dLambdaDeltaDecayTime", "h2dLambdaDeltaDecayTime", {HistType::kTH2F, {axisP, axisDeltaTime}}); + } + } + + void initCCDB(int runNumber) + { + if (mRunNumber == runNumber) { + return; + } + + // In case override, don't proceed, please - no CCDB access required + if (d_bz_input > -990) { + d_bz = d_bz_input; + o2::parameters::GRPMagField grpmag; + if (fabs(d_bz) > 1e-5) { + grpmag.setL3Current(30000.f / (d_bz / 5.0f)); + } + o2::base::Propagator::initFieldFromGRP(&grpmag); + mVtx = ccdb->getForRun(mVtxPath, runNumber); + mRunNumber = runNumber; + return; + } + + o2::parameters::GRPObject* grpo = ccdb->getForRun(grpPath, runNumber); + o2::parameters::GRPMagField* grpmag = 0x0; + if (grpo) { + o2::base::Propagator::initFieldFromGRP(grpo); + // Fetch magnetic field from ccdb for current collision + d_bz = grpo->getNominalL3Field(); + LOG(info) << "Retrieved GRP for run " << runNumber << " with magnetic field of " << d_bz << " kZG"; + } else { + grpmag = ccdb->getForRun(grpmagPath, runNumber); + if (!grpmag) { + LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for run " << runNumber; + } + o2::base::Propagator::initFieldFromGRP(grpmag); + // Fetch magnetic field from ccdb for current collision + d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); + mVtx = ccdb->getForRun(mVtxPath, runNumber); + LOG(info) << "Retrieved GRP for run " << runNumber << " with magnetic field of " << d_bz << " kZG"; + } + + // if TOF Nsigma desired + if (doNSigmas) { + nSigmaCalibObjects = ccdb->getForRun(nSigmaPath, runNumber); + if (nSigmaCalibObjects) { + LOGF(info, "loaded TList with this many objects: %i", nSigmaCalibObjects->GetEntries()); + nSigmaCalibLoaded = true; // made it thus far, mark loaded + + if (calculateV0s.value) { + hMeanPosLaPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanPosLaPi")); + hMeanPosLaPr = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanPosLaPr")); + hMeanNegLaPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanNegLaPi")); + hMeanNegLaPr = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanNegLaPr")); + hMeanPosK0Pi = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanPosK0Pi")); + hMeanNegK0Pi = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanNegK0Pi")); + + hSigmaPosLaPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaPosLaPi")); + hSigmaPosLaPr = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaPosLaPr")); + hSigmaNegLaPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaNegLaPi")); + hSigmaNegLaPr = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaNegLaPr")); + hSigmaPosK0Pi = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaPosK0Pi")); + hSigmaNegK0Pi = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaNegK0Pi")); + + if (!hMeanPosLaPi) + LOG(info) << "Problems finding mean histogram hMeanPosLaPi!"; + if (!hMeanPosLaPr) + LOG(info) << "Problems finding mean histogram hMeanPosLaPr!"; + if (!hMeanNegLaPi) + LOG(info) << "Problems finding mean histogram hMeanNegLaPi!"; + if (!hMeanNegLaPr) + LOG(info) << "Problems finding mean histogram hMeanNegLaPr!"; + if (!hMeanPosK0Pi) + LOG(info) << "Problems finding mean histogram hMeanPosK0Pi!"; + if (!hMeanNegK0Pi) + LOG(info) << "Problems finding mean histogram hMeanNegK0Pi!"; + if (!hSigmaPosK0Pi || !hSigmaNegK0Pi || !hSigmaPosLaPi || !hSigmaPosLaPr || !hSigmaNegLaPi || !hSigmaNegLaPr) { + LOG(info) << "Problems finding sigma histograms!"; + } + + if (calculateCascades.value) { + hMeanPosXiPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanPosXiPi")); + hMeanPosXiPr = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanPosXiPr")); + hMeanNegXiPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanNegXiPi")); + hMeanNegXiPr = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanNegXiPr")); + hMeanBachXiPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanBachXiPi")); + hMeanPosOmPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanPosOmPi")); + hMeanPosOmPr = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanPosOmPr")); + hMeanNegOmPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanNegOmPi")); + hMeanNegOmPr = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanNegOmPr")); + hMeanBachOmKa = reinterpret_cast(nSigmaCalibObjects->FindObject("hMeanBachOmKa")); + + hSigmaPosXiPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaPosXiPi")); + hSigmaPosXiPr = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaPosXiPr")); + hSigmaNegXiPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaNegXiPi")); + hSigmaNegXiPr = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaNegXiPr")); + hSigmaBachXiPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaBachXiPi")); + hSigmaPosOmPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaPosOmPi")); + hSigmaPosOmPr = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaPosOmPr")); + hSigmaNegOmPi = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaNegOmPi")); + hSigmaNegOmPr = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaNegOmPr")); + hSigmaBachOmKa = reinterpret_cast(nSigmaCalibObjects->FindObject("hSigmaBachOmKa")); + + if (!hMeanPosXiPi || !hMeanPosXiPr || !hMeanNegXiPi || !hMeanNegXiPr || !hMeanBachXiPi) + LOG(info) << "Problems finding xi mean histograms!"; + if (!hMeanPosOmPi || !hMeanPosOmPr || !hMeanNegOmPi || !hMeanNegOmPr || !hMeanBachOmKa) + LOG(info) << "Problems finding omega sigma histograms!"; + if (!hSigmaPosXiPi || !hSigmaPosXiPr || !hSigmaNegXiPi || !hSigmaNegXiPr || !hSigmaBachXiPi) + LOG(info) << "Problems finding xi sigma histograms!"; + if (!hSigmaPosOmPi || !hSigmaPosOmPr || !hSigmaNegOmPi || !hSigmaNegOmPr || !hSigmaBachOmKa) + LOG(info) << "Problems finding omega sigma histograms!"; + } + } + } + } + mRunNumber = runNumber; + } + + float velocity(float lMomentum, float lMass) + { + // Momentum p and mass m -> returns speed in centimeters per picosecond + // Useful for TOF calculations + float lA = (lMomentum / lMass) * (lMomentum / lMass); + return 0.0299792458 * TMath::Sqrt(lA / (1 + lA)); + } + + // templatized process function for symmetric operation in derived and original AO2D + template + void processV0Candidate(TCollision const& collision, TV0 const& v0, TTrack const& pTra, TTrack const& nTra) + { + // time of V0 segment + float lengthV0 = std::hypot(v0.x() - collision.getX(), v0.y() - collision.getY(), v0.z() - collision.getZ()); + float velocityK0Short = velocity(v0.p(), o2::constants::physics::MassKaonNeutral); + float velocityLambda = velocity(v0.p(), o2::constants::physics::MassLambda); + float timeK0Short = lengthV0 / velocityK0Short; // in picoseconds + float timeLambda = lengthV0 / velocityLambda; // in picoseconds + + // initialize from V0 position and momenta + o2::track::TrackPar posTrack = o2::track::TrackPar({v0.x(), v0.y(), v0.z()}, {v0.pxpos(), v0.pypos(), v0.pzpos()}, +1); + o2::track::TrackPar negTrack = o2::track::TrackPar({v0.x(), v0.y(), v0.z()}, {v0.pxneg(), v0.pyneg(), v0.pzneg()}, -1); + + float deltaTimePositiveLambdaPi = o2::aod::v0data::kNoTOFValue; + float deltaTimeNegativeLambdaPi = o2::aod::v0data::kNoTOFValue; + float deltaTimePositiveLambdaPr = o2::aod::v0data::kNoTOFValue; + float deltaTimeNegativeLambdaPr = o2::aod::v0data::kNoTOFValue; + float deltaTimePositiveK0ShortPi = o2::aod::v0data::kNoTOFValue; + float deltaTimeNegativeK0ShortPi = o2::aod::v0data::kNoTOFValue; + + float nSigmaPositiveLambdaPi = o2::aod::v0data::kNoTOFValue; + float nSigmaPositiveLambdaPr = o2::aod::v0data::kNoTOFValue; + float nSigmaNegativeLambdaPi = o2::aod::v0data::kNoTOFValue; + float nSigmaNegativeLambdaPr = o2::aod::v0data::kNoTOFValue; + float nSigmaPositiveK0ShortPi = o2::aod::v0data::kNoTOFValue; + float nSigmaNegativeK0ShortPi = o2::aod::v0data::kNoTOFValue; + + float velocityPositivePr = velocity(posTrack.getP(), o2::constants::physics::MassProton); + float velocityPositivePi = velocity(posTrack.getP(), o2::constants::physics::MassPionCharged); + float velocityNegativePr = velocity(negTrack.getP(), o2::constants::physics::MassProton); + float velocityNegativePi = velocity(negTrack.getP(), o2::constants::physics::MassPionCharged); + + float lengthPositive = findInterceptLength(posTrack, d_bz); // FIXME: tofPosition ok? adjust? + float lengthNegative = findInterceptLength(negTrack, d_bz); // FIXME: tofPosition ok? adjust? + float timePositivePr = lengthPositive / velocityPositivePr; + float timePositivePi = lengthPositive / velocityPositivePi; + float timeNegativePr = lengthNegative / velocityNegativePr; + float timeNegativePi = lengthNegative / velocityNegativePi; + + if (pTra.hasTOF() && lengthPositive > 0) { + deltaTimePositiveLambdaPr = (pTra.tofSignal() - pTra.tofEvTime()) - (timeLambda + timePositivePr); + deltaTimePositiveLambdaPi = (pTra.tofSignal() - pTra.tofEvTime()) - (timeLambda + timePositivePi); + deltaTimePositiveK0ShortPi = (pTra.tofSignal() - pTra.tofEvTime()) - (timeK0Short + timePositivePi); + } + if (nTra.hasTOF() && lengthNegative > 0) { + deltaTimeNegativeLambdaPr = (nTra.tofSignal() - nTra.tofEvTime()) - (timeLambda + timeNegativePr); + deltaTimeNegativeLambdaPi = (nTra.tofSignal() - nTra.tofEvTime()) - (timeLambda + timeNegativePi); + deltaTimeNegativeK0ShortPi = (nTra.tofSignal() - nTra.tofEvTime()) - (timeK0Short + timeNegativePi); + } + + if (doQA) { + // calculate and pack properties for QA purposes + int posProperties = 0; + if (lengthPositive > 0) + posProperties = posProperties | (static_cast(1) << kLength); + if (pTra.hasTOF()) + posProperties = posProperties | (static_cast(1) << kHasTOF); + int negProperties = 0; + if (lengthNegative > 0) + negProperties = negProperties | (static_cast(1) << kLength); + if (nTra.hasTOF()) + negProperties = negProperties | (static_cast(1) << kHasTOF); + + histos.fill(HIST("h2dPositiveTOFProperties"), v0.p(), posProperties); + histos.fill(HIST("h2dNegativeTOFProperties"), v0.p(), negProperties); + } + + float deltaDecayTimeLambda = -10e+4; + float deltaDecayTimeAntiLambda = -10e+4; + float deltaDecayTimeK0Short = -10e+4; + if (nTra.hasTOF() && pTra.hasTOF() > 0 && lengthPositive > 0 && lengthNegative > 0) { // does not depend on event time + deltaDecayTimeLambda = (pTra.tofSignal() - timePositivePr) - (nTra.tofSignal() - timeNegativePi); + deltaDecayTimeAntiLambda = (pTra.tofSignal() - timePositivePi) - (nTra.tofSignal() - timeNegativePr); + deltaDecayTimeK0Short = (pTra.tofSignal() - timePositivePi) - (nTra.tofSignal() - timeNegativePi); + } + + // calculate betas + + float evTimeMean = 0.5f * (pTra.tofEvTime() + nTra.tofEvTime()); + float decayTimeLambda = 0.5f * ((pTra.tofSignal() - timePositivePr) + (nTra.tofSignal() - timeNegativePi)) - evTimeMean; + float decayTimeAntiLambda = 0.5f * ((pTra.tofSignal() - timePositivePi) + (nTra.tofSignal() - timeNegativePr)) - evTimeMean; + float decayTimeK0Short = 0.5f * ((pTra.tofSignal() - timePositivePi) + (nTra.tofSignal() - timeNegativePi)) - evTimeMean; + + float betaLambda = o2::aod::cascdata::kNoTOFValue; + ; + float betaAntiLambda = o2::aod::cascdata::kNoTOFValue; + ; + float betaK0Short = o2::aod::cascdata::kNoTOFValue; + ; + + if (nTra.hasTOF() && pTra.hasTOF()) { + betaLambda = (lengthV0 / decayTimeLambda) / 0.0299792458; + betaAntiLambda = (lengthV0 / decayTimeAntiLambda) / 0.0299792458; + betaK0Short = (lengthV0 / decayTimeK0Short) / 0.0299792458; + } + + v0tofpid(deltaTimePositiveLambdaPi, deltaTimePositiveLambdaPr, + deltaTimeNegativeLambdaPi, deltaTimeNegativeLambdaPr, + deltaTimePositiveK0ShortPi, deltaTimeNegativeK0ShortPi, + deltaDecayTimeLambda, deltaDecayTimeAntiLambda, deltaDecayTimeK0Short); + v0tofbeta(betaLambda, betaAntiLambda, betaK0Short); + v0tofdebugs(timeLambda, timeK0Short, timePositivePr, timePositivePi, timeNegativePr, timeNegativePi); + + // do Nsigmas if requested + if (doNSigmas && nSigmaCalibLoaded) { + // sweep through all viable hypotheses and produce N-sigma + + if (deltaTimePositiveLambdaPi > -1e+5) + nSigmaPositiveLambdaPi = (deltaTimePositiveLambdaPi - hMeanPosLaPi->Interpolate(v0.p())) / hSigmaPosLaPi->Interpolate(v0.p()); + if (deltaTimePositiveLambdaPr > -1e+5) + nSigmaPositiveLambdaPr = (deltaTimePositiveLambdaPr - hMeanPosLaPr->Interpolate(v0.p())) / hSigmaPosLaPr->Interpolate(v0.p()); + if (deltaTimeNegativeLambdaPi > -1e+5) + nSigmaNegativeLambdaPi = (deltaTimeNegativeLambdaPi - hMeanNegLaPi->Interpolate(v0.p())) / hSigmaNegLaPi->Interpolate(v0.p()); + if (deltaTimeNegativeLambdaPr > -1e+5) + nSigmaNegativeLambdaPr = (deltaTimeNegativeLambdaPr - hMeanNegLaPr->Interpolate(v0.p())) / hSigmaNegLaPr->Interpolate(v0.p()); + if (deltaTimePositiveK0ShortPi > -1e+5) + nSigmaPositiveK0ShortPi = (deltaTimePositiveK0ShortPi - hMeanPosK0Pi->Interpolate(v0.p())) / hSigmaPosK0Pi->Interpolate(v0.p()); + if (deltaTimeNegativeK0ShortPi > -1e+5) + nSigmaNegativeK0ShortPi = (deltaTimeNegativeK0ShortPi - hMeanNegK0Pi->Interpolate(v0.p())) / hSigmaNegK0Pi->Interpolate(v0.p()); + + v0tofnsigmas( + nSigmaPositiveLambdaPr, nSigmaNegativeLambdaPi, + nSigmaNegativeLambdaPr, nSigmaPositiveLambdaPi, + nSigmaPositiveK0ShortPi, nSigmaNegativeK0ShortPi); + } + + float positiveP = std::hypot(v0.pxpos(), v0.pypos(), v0.pzpos()); + float negativeP = std::hypot(v0.pxneg(), v0.pyneg(), v0.pzneg()); + + if (doQA) { + if (pTra.hasTOF()) { + if (v0.v0cosPA() > v0Group.qaCosPA && v0.dcaV0daughters() < v0Group.qaDCADau) { + if (std::abs(v0.mLambda() - 1.115683) < v0Group.qaMassWindow && fabs(pTra.tpcNSigmaPr()) < v0Group.qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma) { + histos.fill(HIST("h2dDeltaTimePositiveLambdaPr"), v0.p(), v0.eta(), deltaTimePositiveLambdaPr); + histos.fill(HIST("h2dProtonMeasuredVsExpected"), + (timeLambda + timePositivePr) / (pTra.tofSignal() - pTra.tofEvTime()), + positiveP, v0.positiveeta()); + if (doQANSigma) + histos.fill(HIST("h2dNSigmaPositiveLambdaPr"), v0.p(), nSigmaPositiveLambdaPr); + } + if (std::abs(v0.mAntiLambda() - 1.115683) < v0Group.qaMassWindow && fabs(pTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma && fabs(nTra.tpcNSigmaPr()) < v0Group.qaTPCNSigma) { + histos.fill(HIST("h2dDeltaTimePositiveLambdaPi"), v0.p(), v0.eta(), deltaTimePositiveLambdaPi); + if (doQANSigma) + histos.fill(HIST("h2dNSigmaPositiveLambdaPi"), v0.p(), nSigmaPositiveLambdaPi); + } + if (std::abs(v0.mK0Short() - 0.497) < v0Group.qaMassWindow && fabs(pTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma) { + histos.fill(HIST("h2dDeltaTimePositiveK0ShortPi"), v0.p(), v0.eta(), deltaTimePositiveK0ShortPi); + if (doQANSigma) + histos.fill(HIST("h2dNSigmaPositiveK0ShortPi"), v0.p(), nSigmaPositiveK0ShortPi); + } + } + } + + if (nTra.hasTOF()) { + if (v0.v0cosPA() > v0Group.qaCosPA && v0.dcaV0daughters() < v0Group.qaDCADau) { + if (std::abs(v0.mLambda() - 1.115683) < v0Group.qaMassWindow && fabs(pTra.tpcNSigmaPr()) < v0Group.qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma) { + histos.fill(HIST("h2dDeltaTimeNegativeLambdaPi"), v0.p(), v0.eta(), deltaTimeNegativeLambdaPi); + histos.fill(HIST("h2dPionMeasuredVsExpected"), + (timeLambda + timeNegativePi) / (nTra.tofSignal() - nTra.tofEvTime()), + negativeP, v0.negativeeta()); + if (doQANSigma) + histos.fill(HIST("h2dNSigmaNegativeLambdaPi"), v0.p(), nSigmaNegativeLambdaPi); + } + if (std::abs(v0.mAntiLambda() - 1.115683) < v0Group.qaMassWindow && fabs(pTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma && fabs(nTra.tpcNSigmaPr()) < v0Group.qaTPCNSigma) { + histos.fill(HIST("h2dDeltaTimeNegativeLambdaPr"), v0.p(), v0.eta(), deltaTimeNegativeLambdaPr); + if (doQANSigma) + histos.fill(HIST("h2dNSigmaNegativeLambdaPr"), v0.p(), nSigmaNegativeLambdaPr); + } + if (std::abs(v0.mK0Short() - 0.497) < v0Group.qaMassWindow && fabs(pTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma) { + histos.fill(HIST("h2dDeltaTimeNegativeK0ShortPi"), v0.p(), v0.eta(), deltaTimeNegativeK0ShortPi); + if (doQANSigma) + histos.fill(HIST("h2dNSigmaNegativeK0ShortPi"), v0.p(), nSigmaNegativeK0ShortPi); + } + } + } + // delta lambda decay time + histos.fill(HIST("h2dLambdaDeltaDecayTime"), v0.p(), deltaDecayTimeLambda); + } + } + + template + void processCascadeCandidate(TCollision const& collision, TCascade const& cascade, TTrack const& pTra, TTrack const& nTra, TTrack const& bTra) + { + // initialize from positions and momenta as needed + o2::track::TrackPar posTrack = o2::track::TrackPar({cascade.xlambda(), cascade.ylambda(), cascade.zlambda()}, {cascade.pxpos(), cascade.pypos(), cascade.pzpos()}, +1); + o2::track::TrackPar negTrack = o2::track::TrackPar({cascade.xlambda(), cascade.ylambda(), cascade.zlambda()}, {cascade.pxneg(), cascade.pyneg(), cascade.pzneg()}, -1); + o2::track::TrackPar bachTrack = o2::track::TrackPar({cascade.x(), cascade.y(), cascade.z()}, {cascade.pxbach(), cascade.pybach(), cascade.pzbach()}, cascade.sign()); + o2::track::TrackPar cascTrack = o2::track::TrackPar({cascade.x(), cascade.y(), cascade.z()}, {cascade.px(), cascade.py(), cascade.pz()}, cascade.sign()); + + // start calculation: calculate velocities + float velocityPositivePr = velocity(posTrack.getP(), o2::constants::physics::MassProton); + float velocityPositivePi = velocity(posTrack.getP(), o2::constants::physics::MassPionCharged); + float velocityNegativePr = velocity(negTrack.getP(), o2::constants::physics::MassProton); + float velocityNegativePi = velocity(negTrack.getP(), o2::constants::physics::MassPionCharged); + float velocityBachelorPi = velocity(bachTrack.getP(), o2::constants::physics::MassPionCharged); + float velocityBachelorKa = velocity(bachTrack.getP(), o2::constants::physics::MassKaonCharged); + float velocityXi = velocity(cascTrack.getP(), o2::constants::physics::MassXiMinus); + float velocityOm = velocity(cascTrack.getP(), o2::constants::physics::MassOmegaMinus); + float velocityLa = velocity(std::hypot(cascade.pxlambda(), cascade.pylambda(), cascade.pzlambda()), o2::constants::physics::MassLambda); + + // calculate daughter length to TOF intercept + float lengthPositive = findInterceptLength(posTrack, d_bz); // FIXME: tofPosition ok? adjust? + float lengthNegative = findInterceptLength(negTrack, d_bz); // FIXME: tofPosition ok? adjust? + float lengthBachelor = findInterceptLength(bachTrack, d_bz); // FIXME: tofPosition ok? adjust? + + // calculate mother lengths + float lengthV0 = std::hypot(cascade.xlambda() - cascade.x(), cascade.ylambda() - cascade.y(), cascade.zlambda() - cascade.z()); + float lengthCascade = o2::aod::cascdata::kNoTOFValue; + ; + const o2::math_utils::Point3D collVtx{collision.getX(), collision.getY(), collision.getZ()}; + bool successPropag = o2::base::Propagator::Instance()->propagateToDCA(collVtx, cascTrack, d_bz, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrNONE); + float d = -1.0f, d3d = 0.0f; + float linearToPV = std::hypot(cascade.x() - collision.getX(), cascade.y() - collision.getY(), cascade.z() - collision.getZ()); + if (successPropag) { + std::array cascCloseToPVPosition; + cascTrack.getXYZGlo(cascCloseToPVPosition); + o2::math_utils::CircleXYf_t trcCircleCascade; + float sna, csa; + cascTrack.getCircleParams(d_bz, trcCircleCascade, sna, csa); + + // calculate 2D distance between two points + d = std::hypot(cascade.x() - cascCloseToPVPosition[0], cascade.y() - cascCloseToPVPosition[1]); + d3d = std::hypot(cascade.x() - cascCloseToPVPosition[0], cascade.y() - cascCloseToPVPosition[1], cascade.z() - cascCloseToPVPosition[2]); // cross-check variable + float sinThetaOverTwo = d / (2.0f * trcCircleCascade.rC); + lengthCascade = 2.0f * trcCircleCascade.rC * TMath::ASin(sinThetaOverTwo); + lengthCascade *= sqrt(1.0f + cascTrack.getTgl() * cascTrack.getTgl()); + } + + if (!successPropag) { + lengthCascade = linearToPV; // if propagation failed, use linear estimate (optional: actually do not define?) + } + + // lambda, xi and omega flight time is always defined + float lambdaFlight = lengthV0 / velocityLa; + float xiFlight = lengthCascade / velocityXi; + float omFlight = lengthCascade / velocityOm; + float posFlightPi = lengthPositive / velocityPositivePi; + float posFlightPr = lengthPositive / velocityPositivePr; + float negFlightPi = lengthNegative / velocityNegativePi; + float negFlightPr = lengthNegative / velocityNegativePr; + float bachFlightPi = lengthBachelor / velocityBachelorPi; + float bachFlightKa = lengthBachelor / velocityBachelorKa; + + // initialize delta-times (actual PID variables) + float posDeltaTimeAsXiPi = o2::aod::cascdata::kNoTOFValue, posDeltaTimeAsXiPr = o2::aod::cascdata::kNoTOFValue; + float negDeltaTimeAsXiPi = o2::aod::cascdata::kNoTOFValue, negDeltaTimeAsXiPr = o2::aod::cascdata::kNoTOFValue; + float bachDeltaTimeAsXiPi = o2::aod::cascdata::kNoTOFValue; + float posDeltaTimeAsOmPi = o2::aod::cascdata::kNoTOFValue, posDeltaTimeAsOmPr = o2::aod::cascdata::kNoTOFValue; + float negDeltaTimeAsOmPi = o2::aod::cascdata::kNoTOFValue, negDeltaTimeAsOmPr = o2::aod::cascdata::kNoTOFValue; + float bachDeltaTimeAsOmKa = o2::aod::cascdata::kNoTOFValue; + + if (pTra.hasTOF()) { + posDeltaTimeAsXiPi = (pTra.tofSignal() - pTra.tofEvTime()) - (xiFlight + lambdaFlight + posFlightPi); + posDeltaTimeAsXiPr = (pTra.tofSignal() - pTra.tofEvTime()) - (xiFlight + lambdaFlight + posFlightPr); + posDeltaTimeAsOmPi = (pTra.tofSignal() - pTra.tofEvTime()) - (omFlight + lambdaFlight + posFlightPi); + posDeltaTimeAsOmPr = (pTra.tofSignal() - pTra.tofEvTime()) - (omFlight + lambdaFlight + posFlightPr); + } + if (nTra.hasTOF()) { + negDeltaTimeAsXiPi = (nTra.tofSignal() - nTra.tofEvTime()) - (xiFlight + lambdaFlight + negFlightPi); + negDeltaTimeAsXiPr = (nTra.tofSignal() - nTra.tofEvTime()) - (xiFlight + lambdaFlight + negFlightPr); + negDeltaTimeAsOmPi = (nTra.tofSignal() - nTra.tofEvTime()) - (omFlight + lambdaFlight + negFlightPi); + negDeltaTimeAsOmPr = (nTra.tofSignal() - nTra.tofEvTime()) - (omFlight + lambdaFlight + negFlightPr); + } + if (bTra.hasTOF()) { + bachDeltaTimeAsXiPi = (bTra.tofSignal() - bTra.tofEvTime()) - (xiFlight + bachFlightPi); + bachDeltaTimeAsOmKa = (bTra.tofSignal() - bTra.tofEvTime()) - (omFlight + bachFlightKa); + } + + casctofpids( + posDeltaTimeAsXiPi, posDeltaTimeAsXiPr, negDeltaTimeAsXiPi, negDeltaTimeAsXiPr, bachDeltaTimeAsXiPi, + posDeltaTimeAsOmPi, posDeltaTimeAsOmPr, negDeltaTimeAsOmPi, negDeltaTimeAsOmPr, bachDeltaTimeAsOmKa); + + float nSigmaXiLaPr = o2::aod::cascdata::kNoTOFValue; + ; + float nSigmaXiLaPi = o2::aod::cascdata::kNoTOFValue; + ; + float nSigmaXiPi = o2::aod::cascdata::kNoTOFValue; + ; + float nSigmaOmLaPr = o2::aod::cascdata::kNoTOFValue; + ; + float nSigmaOmLaPi = o2::aod::cascdata::kNoTOFValue; + ; + float nSigmaOmKa = o2::aod::cascdata::kNoTOFValue; + ; + + // go for Nsigma values if requested + if (doNSigmas && nSigmaCalibLoaded) { + // Xi hypothesis ________________________ + if (cascade.sign() < 0) { // XiMinus + if (posDeltaTimeAsXiPr > -1e+5) // proton from Lambda from XiMinus has signal + nSigmaXiLaPr = (posDeltaTimeAsXiPr - hMeanPosXiPr->Interpolate(cascade.p())) / hSigmaPosXiPr->Interpolate(cascade.p()); + if (negDeltaTimeAsXiPi > -1e+5) // pion from Lambda from XiMinus has signal + nSigmaXiLaPi = (negDeltaTimeAsXiPi - hMeanNegXiPi->Interpolate(cascade.p())) / hSigmaNegXiPi->Interpolate(cascade.p()); + if (bachDeltaTimeAsXiPi > -1e+5) // pion from XiMinus has signal + nSigmaXiPi = (bachDeltaTimeAsXiPi - hMeanBachXiPi->Interpolate(cascade.p())) / hSigmaBachXiPi->Interpolate(cascade.p()); + if (posDeltaTimeAsOmPr > -1e+5) // proton from Lambda from OmegaMinus has signal + nSigmaOmLaPr = (posDeltaTimeAsOmPr - hMeanPosOmPr->Interpolate(cascade.p())) / hSigmaPosOmPr->Interpolate(cascade.p()); + if (negDeltaTimeAsOmPi > -1e+5) // pion from Lambda from OmegaMinus has signal + nSigmaOmLaPi = (negDeltaTimeAsOmPi - hMeanNegOmPi->Interpolate(cascade.p())) / hSigmaNegOmPi->Interpolate(cascade.p()); + if (bachDeltaTimeAsOmKa > -1e+5) // kaon from OmegaMinus has signal + nSigmaOmKa = (bachDeltaTimeAsOmKa - hMeanBachOmKa->Interpolate(cascade.p())) / hSigmaBachOmKa->Interpolate(cascade.p()); + } else { + if (posDeltaTimeAsXiPi > -1e+5) // proton from Lambda from XiMinus has signal + nSigmaXiLaPi = (posDeltaTimeAsXiPi - hMeanPosXiPi->Interpolate(cascade.p())) / hSigmaPosXiPi->Interpolate(cascade.p()); + if (negDeltaTimeAsXiPr > -1e+5) // pion from Lambda from XiMinus has signal + nSigmaXiLaPr = (negDeltaTimeAsXiPr - hMeanNegXiPr->Interpolate(cascade.p())) / hSigmaNegXiPr->Interpolate(cascade.p()); + if (bachDeltaTimeAsXiPi > -1e+5) // pion from XiMinus has signal + nSigmaXiPi = (bachDeltaTimeAsXiPi - hMeanBachXiPi->Interpolate(cascade.p())) / hSigmaBachXiPi->Interpolate(cascade.p()); + if (posDeltaTimeAsOmPi > -1e+5) // proton from Lambda from OmegaMinus has signal + nSigmaOmLaPi = (posDeltaTimeAsOmPi - hMeanPosOmPi->Interpolate(cascade.p())) / hSigmaPosOmPi->Interpolate(cascade.p()); + if (negDeltaTimeAsOmPr > -1e+5) // pion from Lambda from OmegaMinus has signal + nSigmaOmLaPr = (negDeltaTimeAsOmPr - hMeanNegOmPr->Interpolate(cascade.p())) / hSigmaNegOmPr->Interpolate(cascade.p()); + if (bachDeltaTimeAsOmKa > -1e+5) // kaon from OmegaMinus has signal + nSigmaOmKa = (bachDeltaTimeAsOmKa - hMeanBachOmKa->Interpolate(cascade.p())) / hSigmaBachOmKa->Interpolate(cascade.p()); + } + casctofnsigmas(nSigmaXiLaPi, nSigmaXiLaPr, nSigmaXiPi, nSigmaOmLaPi, nSigmaOmLaPr, nSigmaOmKa); + } + + if (doQA) { + // fill QA histograms for cross-checking + histos.fill(HIST("hArcDebug"), cascade.p(), lengthCascade - d3d); // for debugging purposes + + if (cascade.dcaV0daughters() < cascadeGroup.qaV0DCADau && cascade.dcacascdaughters() < cascadeGroup.qaCascDCADau && cascade.v0cosPA(collision.getX(), collision.getY(), collision.getZ()) > cascadeGroup.qaV0CosPA && cascade.casccosPA(collision.getX(), collision.getY(), collision.getZ()) > cascadeGroup.qaCascCosPA) { + if (cascade.sign() < 0) { + if (std::abs(cascade.mXi() - 1.32171) < cascadeGroup.qaMassWindow && fabs(pTra.tpcNSigmaPr()) < cascadeGroup.qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < cascadeGroup.qaTPCNSigma && fabs(bTra.tpcNSigmaPi()) < cascadeGroup.qaTPCNSigma) { + histos.fill(HIST("h2dposDeltaTimeAsXiPr"), cascade.p(), cascade.eta(), posDeltaTimeAsXiPr); + histos.fill(HIST("h2dnegDeltaTimeAsXiPi"), cascade.p(), cascade.eta(), negDeltaTimeAsXiPi); + histos.fill(HIST("h2dbachDeltaTimeAsXiPi"), cascade.p(), cascade.eta(), bachDeltaTimeAsXiPi); + if (doQANSigma) { + histos.fill(HIST("h2dNSigmaXiLaPi"), cascade.p(), nSigmaXiLaPi); + histos.fill(HIST("h2dNSigmaXiLaPr"), cascade.p(), nSigmaXiLaPr); + histos.fill(HIST("h2dNSigmaXiPi"), cascade.p(), nSigmaXiPi); + } + } + if (std::abs(cascade.mOmega() - 1.67245) < cascadeGroup.qaMassWindow && fabs(pTra.tpcNSigmaPr()) < cascadeGroup.qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < cascadeGroup.qaTPCNSigma && fabs(bTra.tpcNSigmaKa()) < cascadeGroup.qaTPCNSigma) { + histos.fill(HIST("h2dposDeltaTimeAsOmPr"), cascade.p(), cascade.eta(), posDeltaTimeAsOmPr); + histos.fill(HIST("h2dnegDeltaTimeAsOmPi"), cascade.p(), cascade.eta(), negDeltaTimeAsOmPi); + histos.fill(HIST("h2dbachDeltaTimeAsOmKa"), cascade.p(), cascade.eta(), bachDeltaTimeAsOmKa); + if (doQANSigma) { + histos.fill(HIST("h2dNSigmaOmLaPi"), cascade.p(), nSigmaOmLaPi); + histos.fill(HIST("h2dNSigmaOmLaPr"), cascade.p(), nSigmaOmLaPr); + histos.fill(HIST("h2dNSigmaOmKa"), cascade.p(), nSigmaOmKa); + } + } + } else { + if (std::abs(cascade.mXi() - 1.32171) < cascadeGroup.qaMassWindow && fabs(pTra.tpcNSigmaPi()) < cascadeGroup.qaTPCNSigma && fabs(nTra.tpcNSigmaPr()) < cascadeGroup.qaTPCNSigma && fabs(bTra.tpcNSigmaPi()) < cascadeGroup.qaTPCNSigma) { + histos.fill(HIST("h2dposDeltaTimeAsXiPi"), cascade.p(), cascade.eta(), posDeltaTimeAsXiPi); + histos.fill(HIST("h2dnegDeltaTimeAsXiPr"), cascade.p(), cascade.eta(), negDeltaTimeAsXiPr); + histos.fill(HIST("h2dbachDeltaTimeAsXiPi"), cascade.p(), cascade.eta(), bachDeltaTimeAsXiPi); + if (doQANSigma) { + histos.fill(HIST("h2dNSigmaXiLaPi"), cascade.p(), nSigmaXiLaPi); + histos.fill(HIST("h2dNSigmaXiLaPr"), cascade.p(), nSigmaXiLaPr); + histos.fill(HIST("h2dNSigmaXiPi"), cascade.p(), nSigmaXiPi); + } + } + if (std::abs(cascade.mOmega() - 1.67245) < cascadeGroup.qaMassWindow && fabs(pTra.tpcNSigmaPi()) < cascadeGroup.qaTPCNSigma && fabs(nTra.tpcNSigmaPr()) < cascadeGroup.qaTPCNSigma && fabs(bTra.tpcNSigmaKa()) < cascadeGroup.qaTPCNSigma) { + histos.fill(HIST("h2dposDeltaTimeAsOmPi"), cascade.p(), cascade.eta(), posDeltaTimeAsOmPi); + histos.fill(HIST("h2dnegDeltaTimeAsOmPr"), cascade.p(), cascade.eta(), negDeltaTimeAsOmPr); + histos.fill(HIST("h2dbachDeltaTimeAsOmKa"), cascade.p(), cascade.eta(), bachDeltaTimeAsOmKa); + if (doQANSigma) { + histos.fill(HIST("h2dNSigmaOmLaPi"), cascade.p(), nSigmaOmLaPi); + histos.fill(HIST("h2dNSigmaOmLaPr"), cascade.p(), nSigmaOmLaPr); + histos.fill(HIST("h2dNSigmaOmKa"), cascade.p(), nSigmaOmKa); + } + } + } + } + } + } + + void processStandardData(aod::Collisions const& collisions, V0OriginalDatas const& V0s, CascOriginalDatas const& cascades, TracksWithAllExtras const&, aod::BCsWithTimestamps const& /*bcs*/) + { + // Fire up CCDB with first collision in record. If no collisions, bypass + if (useCustomRunNumber || collisions.size() < 1) { + initCCDB(manualRunNumber); + } else { + auto collision = collisions.begin(); + auto bc = collision.bc_as(); + initCCDB(bc.runNumber()); + } + + if (calculateV0s.value) { + for (const auto& V0 : V0s) { + // for storing whatever is the relevant quantity for the PV + o2::dataformats::VertexBase primaryVertex; + if (V0.has_collision()) { + auto const& collision = V0.collision(); + primaryVertex.setPos({collision.posX(), collision.posY(), collision.posZ()}); + primaryVertex.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); + } else { + primaryVertex.setPos({mVtx->getX(), mVtx->getY(), mVtx->getZ()}); + } + + auto pTra = V0.posTrack_as(); + auto nTra = V0.negTrack_as(); + processV0Candidate(primaryVertex, V0, pTra, nTra); + } + } + + if (calculateCascades.value) { + for (const auto& cascade : cascades) { + // for storing whatever is the relevant quantity for the PV + o2::dataformats::VertexBase primaryVertex; + if (cascade.has_collision()) { + auto const& collision = cascade.collision(); + primaryVertex.setPos({collision.posX(), collision.posY(), collision.posZ()}); + primaryVertex.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); + } else { + primaryVertex.setPos({mVtx->getX(), mVtx->getY(), mVtx->getZ()}); + } + + auto pTra = cascade.posTrack_as(); + auto nTra = cascade.negTrack_as(); + auto bTra = cascade.bachelor_as(); + processCascadeCandidate(primaryVertex, cascade, pTra, nTra, bTra); + } + } + } + + void processDerivedData(soa::Join const& collisions, V0DerivedDatas const& V0s, CascDerivedDatas const& cascades, dauTracks const&) + { + // Fire up CCDB with first collision in record. If no collisions, bypass + if (useCustomRunNumber || collisions.size() < 1) { + initCCDB(manualRunNumber); + } else { + auto collision = collisions.begin(); + initCCDB(collision.runNumber()); + } + + if (calculateV0s.value) { + for (const auto& V0 : V0s) { + // for storing whatever is the relevant quantity for the PV + o2::dataformats::VertexBase primaryVertex; + if (V0.has_straCollision()) { + auto const& collision = V0.straCollision_as>(); + primaryVertex.setPos({collision.posX(), collision.posY(), collision.posZ()}); + // cov: won't be used anyways, all fine + primaryVertex.setCov(1e-6, 1e-6, 1e-6, 1e-6, 1e-6, 1e-6); + } else { + primaryVertex.setPos({mVtx->getX(), mVtx->getY(), mVtx->getZ()}); + } + + auto pTra = V0.posTrackExtra_as(); + auto nTra = V0.negTrackExtra_as(); + processV0Candidate(primaryVertex, V0, pTra, nTra); + } + } + + if (calculateCascades.value) { + for (const auto& cascade : cascades) { + // for storing whatever is the relevant quantity for the PV + o2::dataformats::VertexBase primaryVertex; + if (cascade.has_straCollision()) { + auto const& collision = cascade.straCollision_as>(); + primaryVertex.setPos({collision.posX(), collision.posY(), collision.posZ()}); + primaryVertex.setCov(1e-6, 1e-6, 1e-6, 1e-6, 1e-6, 1e-6); + } else { + primaryVertex.setPos({mVtx->getX(), mVtx->getY(), mVtx->getZ()}); + } + + auto pTra = cascade.posTrackExtra_as(); + auto nTra = cascade.negTrackExtra_as(); + auto bTra = cascade.bachTrackExtra_as(); + processCascadeCandidate(primaryVertex, cascade, pTra, nTra, bTra); + } + } + } + + PROCESS_SWITCH(strangenesstofpid, processStandardData, "Process standard data", true); + PROCESS_SWITCH(strangenesstofpid, processDerivedData, "Process derived data", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/Tasks/QC/strangepidqa.cxx b/PWGLF/Tasks/QC/strangepidqa.cxx index c2bd9d89774..2dd9c58b4e7 100644 --- a/PWGLF/Tasks/QC/strangepidqa.cxx +++ b/PWGLF/Tasks/QC/strangepidqa.cxx @@ -54,11 +54,13 @@ struct strangepidqa { ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "p_{T} (GeV/c)"}; ConfigurableAxis axisRadius{"axisRadius", {200, 0.0f, 100.0f}, "V0 radius (cm)"}; - AxisSpec centAxis = {100, 0.0f, 100.0f, "mult percentile"}; + ConfigurableAxis centAxis{"centAxis", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 50.0f, 70.0f, 100.0f}, "FT0C centrality"}; + AxisSpec massAxisXi = {200, 1.222f, 1.422f, "Inv. Mass (GeV/c^{2})"}; AxisSpec massAxisOmega = {200, 1.572f, 1.772f, "Inv. Mass (GeV/c^{2})"}; // Invariant Mass + ConfigurableAxis axisK0ShortMass{"axisK0ShortMass", {200, 0.497f - 0.050f, 0.497f + 0.050f}, "M_{K0s} (GeV/c^{2})"}; ConfigurableAxis axisLambdaMass{"axisLambdaMass", {200, 1.08f, 1.16f}, "M_{#Lambda} (GeV/c^{2})"}; // time axes @@ -117,6 +119,9 @@ struct strangepidqa { Configurable tofNsigmaOmLaPr{"tpcNsigmaOmLaPr", 1e+5, "TOF NSigma proton <- lambda <- Omega (>10 is no cut)"}; Configurable tofNsigmaOmLaPi{"tpcNsigmaOmLaPi", 1e+5, "TOF NSigma pion <- lambda <- Omega (>10 is no cut)"}; Configurable tofNsigmaOmKa{"tpcNsigmaOmKa", 1e+5, "TOF NSigma Kaon <- Omega (>10 is no cut)"}; + + Configurable tofNsigmaCompatibility{"tofNsigmaCompatibility", 4, "compatibility check for V0s"}; + Configurable tofNsigmaCompatibilityCascades{"tofNsigmaCompatibilityCascades", 4, "compatibility check for cascades"}; //*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+* void init(InitContext const&) @@ -215,6 +220,21 @@ struct strangepidqa { histos.add("h2dTimeVsLengthProtonProng", "h2dTimeVsLengthProtonProng", {HistType::kTH2F, {axisLength, axisTime}}); histos.add("h2dTimeVsLengthPionProng", "h2dTimeVsLengthPionProng", {HistType::kTH2F, {axisLength, axisTime}}); + histos.add("h1dMassK0Short", "h1dMassK0Short", {HistType::kTH1F, {axisK0ShortMass}}); + histos.add("h1dMassLambda", "h1dMassLambda", {HistType::kTH1F, {axisLambdaMass}}); + histos.add("h1dMassAntiLambda", "h1dMassAntiLambda", {HistType::kTH1F, {axisLambdaMass}}); + histos.add("h1dMassCompatibleK0Short", "h1dMassCompatibleK0Short", {HistType::kTH1F, {axisK0ShortMass}}); + histos.add("h1dMassCompatibleLambda", "h1dMassCompatibleLambda", {HistType::kTH1F, {axisLambdaMass}}); + histos.add("h1dMassCompatibleAntiLambda", "h1dMassCompatibleAntiLambda", {HistType::kTH1F, {axisLambdaMass}}); + + histos.add("h3dMassK0Short", "h3dMassK0Short", {HistType::kTH3F, {centAxis, axisPt, axisK0ShortMass}}); + histos.add("h3dMassLambda", "h3dMassLambda", {HistType::kTH3F, {centAxis, axisPt, axisLambdaMass}}); + histos.add("h3dMassAntiLambda", "h3dMassAntiLambda", {HistType::kTH3F, {centAxis, axisPt, axisLambdaMass}}); + + histos.add("h3dMassCompatibleK0Short", "h3dMassCompatibleK0Short", {HistType::kTH3F, {centAxis, axisPt, axisK0ShortMass}}); + histos.add("h3dMassCompatibleLambda", "h3dMassCompatibleLambda", {HistType::kTH3F, {centAxis, axisPt, axisLambdaMass}}); + histos.add("h3dMassCompatibleAntiLambda", "h3dMassCompatibleAntiLambda", {HistType::kTH3F, {centAxis, axisPt, axisLambdaMass}}); + // --- ASSOCIATED --- // V0 Radius if (doprocessSim) { @@ -243,17 +263,29 @@ struct strangepidqa { } if (doprocessCascades) { + histos.add("h1dMassXiMinus", "h1dMassXiMinus", {HistType::kTH1F, {massAxisXi}}); + histos.add("h1dMassXiPlus", "h1dMassXiPlus", {HistType::kTH1F, {massAxisXi}}); + histos.add("h1dMassOmegaMinus", "h1dMassOmegaMinus", {HistType::kTH1F, {massAxisOmega}}); + histos.add("h1dMassOmegaPlus", "h1dMassOmegaPlus", {HistType::kTH1F, {massAxisOmega}}); + histos.add("h1dMassCompatibleXiMinus", "h1dMassCompatibleXiMinus", {HistType::kTH1F, {massAxisXi}}); + histos.add("h1dMassCompatibleXiPlus", "h1dMassCompatibleXiPlus", {HistType::kTH1F, {massAxisXi}}); + histos.add("h1dMassCompatibleOmegaMinus", "h1dMassCompatibleOmegaMinus", {HistType::kTH1F, {massAxisOmega}}); + histos.add("h1dMassCompatibleOmegaPlus", "h1dMassCompatibleOmegaPlus", {HistType::kTH1F, {massAxisOmega}}); + histos.add("h3dMassXiMinus", "h3dMassXiMinus", {HistType::kTH3F, {centAxis, axisPt, massAxisXi}}); histos.add("h3dMassXiPlus", "h3dMassXiPlus", {HistType::kTH3F, {centAxis, axisPt, massAxisXi}}); histos.add("h3dMassOmegaMinus", "h3dMassOmegaMinus", {HistType::kTH3F, {centAxis, axisPt, massAxisOmega}}); histos.add("h3dMassOmegaPlus", "h3dMassOmegaPlus", {HistType::kTH3F, {centAxis, axisPt, massAxisOmega}}); + + histos.add("h3dMassCompatibleXiMinus", "h3dMassCompatibleXiMinus", {HistType::kTH3F, {centAxis, axisPt, massAxisXi}}); + histos.add("h3dMassCompatibleXiPlus", "h3dMassCompatibleXiPlus", {HistType::kTH3F, {centAxis, axisPt, massAxisXi}}); + histos.add("h3dMassCompatibleOmegaMinus", "h3dMassCompatibleOmegaMinus", {HistType::kTH3F, {centAxis, axisPt, massAxisOmega}}); + histos.add("h3dMassCompatibleOmegaPlus", "h3dMassCompatibleOmegaPlus", {HistType::kTH3F, {centAxis, axisPt, massAxisOmega}}); } } - void processReal(soa::Join::iterator const& coll, soa::Join const& v0s) + void processReal(soa::Join::iterator const& coll, soa::Join const& v0s, soa::Join const&) { - histos.fill(HIST("hEventVertexZ"), coll.posZ()); - if (coll.centFT0C() > maxCentrality || coll.centFT0C() < minCentrality) return; @@ -262,6 +294,39 @@ struct strangepidqa { if (TMath::Abs(lambda.eta()) > 0.5) continue; + auto negExtra = lambda.negTrackExtra_as>(); + auto posExtra = lambda.posTrackExtra_as>(); + + if (TMath::Abs(posExtra.tpcNSigmaPr()) < tpcNsigmaProton && TMath::Abs(negExtra.tpcNSigmaPi()) < tpcNsigmaPion) { + // lambda case + histos.fill(HIST("h3dMassLambda"), coll.centFT0C(), lambda.pt(), lambda.mLambda()); + histos.fill(HIST("h1dMassLambda"), lambda.mLambda()); + if (lambda.tofLambdaCompatibility(tofNsigmaCompatibility.value)) { + histos.fill(HIST("h3dMassCompatibleLambda"), coll.centFT0C(), lambda.pt(), lambda.mLambda()); + histos.fill(HIST("h1dMassCompatibleLambda"), lambda.mLambda()); + } + } + + if (TMath::Abs(posExtra.tpcNSigmaPi()) < tpcNsigmaProton && TMath::Abs(negExtra.tpcNSigmaPr()) < tpcNsigmaPion) { + // lambda case + histos.fill(HIST("h3dMassAntiLambda"), coll.centFT0C(), lambda.pt(), lambda.mAntiLambda()); + histos.fill(HIST("h1dMassAntiLambda"), lambda.mAntiLambda()); + if (lambda.tofAntiLambdaCompatibility(tofNsigmaCompatibility.value)) { + histos.fill(HIST("h3dMassCompatibleAntiLambda"), coll.centFT0C(), lambda.pt(), lambda.mAntiLambda()); + histos.fill(HIST("h1dMassCompatibleAntiLambda"), lambda.mAntiLambda()); + } + } + + if (TMath::Abs(posExtra.tpcNSigmaPi()) < tpcNsigmaPion && TMath::Abs(negExtra.tpcNSigmaPr()) < tpcNsigmaPion) { + // lambda case + histos.fill(HIST("h3dMassK0Short"), coll.centFT0C(), lambda.pt(), lambda.mK0Short()); + histos.fill(HIST("h1dMassK0Short"), lambda.mK0Short()); + if (lambda.tofK0ShortCompatibility(tofNsigmaCompatibility.value)) { + histos.fill(HIST("h3dMassCompatibleK0Short"), coll.centFT0C(), lambda.pt(), lambda.mK0Short()); + histos.fill(HIST("h1dMassCompatibleK0Short"), lambda.mK0Short()); + } + } + histos.fill(HIST("h2dLambdaMassVsTOFCut"), lambda.mLambda(), TMath::Abs(lambda.posTOFDeltaTLaPr())); histos.fill(HIST("h2dLambdaMassVsTOFCutMeson"), lambda.mLambda(), TMath::Abs(lambda.negTOFDeltaTLaPi())); @@ -378,6 +443,8 @@ struct strangepidqa { void processCascades(soa::Join::iterator const& col, soa::Filtered> const& Cascades, soa::Join const&) { histos.fill(HIST("hEventCentrality"), col.centFT0C()); + if (col.centFT0C() > maxCentrality || col.centFT0C() < minCentrality) + return; for (auto& casc : Cascades) { // major selections here @@ -397,42 +464,38 @@ struct strangepidqa { if (casc.sign() < 0) { if (TMath::Abs(posExtra.tpcNSigmaPr()) < tpcNsigmaProton && TMath::Abs(negExtra.tpcNSigmaPi()) < tpcNsigmaPion && TMath::Abs(bachExtra.tpcNSigmaPi()) < tpcNsigmaBachelor) { - if (tofNsigmaXiLaPr < 100 && fabs(casc.tofNSigmaXiLaPr()) > tofNsigmaXiLaPr) - continue; - if (tofNsigmaXiLaPi < 100 && fabs(casc.tofNSigmaXiLaPi()) > tofNsigmaXiLaPi) - continue; - if (tofNsigmaXiPi < 100 && fabs(casc.tofNSigmaXiPi()) > tofNsigmaXiPi) - continue; histos.fill(HIST("h3dMassXiMinus"), col.centFT0C(), casc.pt(), casc.mXi()); + histos.fill(HIST("h1dMassXiMinus"), casc.mXi()); + if (casc.tofXiCompatibility(tofNsigmaCompatibilityCascades.value)) { + histos.fill(HIST("h3dMassCompatibleXiMinus"), col.centFT0C(), casc.pt(), casc.mXi()); + histos.fill(HIST("h1dMassCompatibleXiMinus"), casc.mXi()); + } } if (TMath::Abs(posExtra.tpcNSigmaPr()) < tpcNsigmaProton && TMath::Abs(negExtra.tpcNSigmaPi()) < tpcNsigmaPion && TMath::Abs(bachExtra.tpcNSigmaKa()) < tpcNsigmaBachelor) { - if (tofNsigmaOmLaPr < 100 && fabs(casc.tofNSigmaOmLaPr()) > tofNsigmaOmLaPr) - continue; - if (tofNsigmaOmLaPi < 100 && fabs(casc.tofNSigmaOmLaPi()) > tofNsigmaOmLaPi) - continue; - if (tofNsigmaOmKa < 100 && fabs(casc.tofNSigmaOmKa()) > tofNsigmaOmKa) - continue; histos.fill(HIST("h3dMassOmegaMinus"), col.centFT0C(), casc.pt(), casc.mOmega()); + histos.fill(HIST("h1dMassOmegaMinus"), casc.mOmega()); + if (casc.tofOmegaCompatibility(tofNsigmaCompatibilityCascades.value)) { + histos.fill(HIST("h3dMassCompatibleOmegaMinus"), col.centFT0C(), casc.pt(), casc.mOmega()); + histos.fill(HIST("h1dMassCompatibleOmegaMinus"), casc.mOmega()); + } } } else { if (TMath::Abs(posExtra.tpcNSigmaPi()) < tpcNsigmaPion && TMath::Abs(negExtra.tpcNSigmaPr()) < tpcNsigmaProton && TMath::Abs(bachExtra.tpcNSigmaPi()) < tpcNsigmaBachelor) { - if (tofNsigmaXiLaPr < 100 && fabs(casc.tofNSigmaXiLaPr()) > tofNsigmaXiLaPr) - continue; - if (tofNsigmaXiLaPi < 100 && fabs(casc.tofNSigmaXiLaPi()) > tofNsigmaXiLaPi) - continue; - if (tofNsigmaXiPi < 100 && fabs(casc.tofNSigmaXiPi()) > tofNsigmaXiPi) - continue; histos.fill(HIST("h3dMassXiPlus"), col.centFT0C(), casc.pt(), casc.mXi()); + histos.fill(HIST("h1dMassXiPlus"), casc.mXi()); + if (casc.tofXiCompatibility(tofNsigmaCompatibilityCascades.value)) { + histos.fill(HIST("h3dMassCompatibleXiPlus"), col.centFT0C(), casc.pt(), casc.mXi()); + histos.fill(HIST("h1dMassCompatibleXiPlus"), casc.mXi()); + } } if (TMath::Abs(posExtra.tpcNSigmaPi()) < tpcNsigmaPion && TMath::Abs(negExtra.tpcNSigmaPr()) < tpcNsigmaProton && TMath::Abs(bachExtra.tpcNSigmaKa()) < tpcNsigmaBachelor) { - if (tofNsigmaOmLaPr < 100 && fabs(casc.tofNSigmaOmLaPr()) > tofNsigmaOmLaPr) - continue; - if (tofNsigmaOmLaPi < 100 && fabs(casc.tofNSigmaOmLaPi()) > tofNsigmaOmLaPi) - continue; - if (tofNsigmaOmKa < 100 && fabs(casc.tofNSigmaOmKa()) > tofNsigmaOmKa) - continue; histos.fill(HIST("h3dMassOmegaPlus"), col.centFT0C(), casc.pt(), casc.mOmega()); + histos.fill(HIST("h1dMassOmegaPlus"), casc.mOmega()); + if (casc.tofOmegaCompatibility(tofNsigmaCompatibilityCascades.value)) { + histos.fill(HIST("h3dMassCompatibleOmegaPlus"), col.centFT0C(), casc.pt(), casc.mOmega()); + histos.fill(HIST("h1dMassCompatibleOmegaPlus"), casc.mOmega()); + } } } } From 24467311026ec89d39a0ec8e456cd08d4ce962db Mon Sep 17 00:00:00 2001 From: dajones2 <140733426+dajones2@users.noreply.github.com> Date: Tue, 19 Aug 2025 08:26:36 +0100 Subject: [PATCH 101/986] [PWGJE] Removing old delta r functionality (#12566) --- PWGJE/Tasks/jetHadronRecoil.cxx | 154 +++++++++++--------------------- 1 file changed, 52 insertions(+), 102 deletions(-) diff --git a/PWGJE/Tasks/jetHadronRecoil.cxx b/PWGJE/Tasks/jetHadronRecoil.cxx index 1bc88828066..d327fa277b6 100644 --- a/PWGJE/Tasks/jetHadronRecoil.cxx +++ b/PWGJE/Tasks/jetHadronRecoil.cxx @@ -81,7 +81,6 @@ struct JetHadronRecoil { Configurable triggerMasks{"triggerMasks", "", "possible JE Trigger masks: fJetChLowPt,fJetChHighPt,fTrackLowPt,fTrackHighPt,fJetD0ChLowPt,fJetD0ChHighPt,fJetLcChLowPt,fJetLcChHighPt,fEMCALReadout,fJetFullHighPt,fJetFullLowPt,fJetNeutralHighPt,fJetNeutralLowPt,fGammaVeryHighPtEMCAL,fGammaVeryHighPtDCAL,fGammaHighPtEMCAL,fGammaHighPtDCAL,fGammaLowPtEMCAL,fGammaLowPtDCAL,fGammaVeryLowPtEMCAL,fGammaVeryLowPtDCAL"}; Configurable skipMBGapEvents{"skipMBGapEvents", false, "flag to choose to reject min. bias gap events; jet-level rejection applied at the jet finder level, here rejection is applied for collision and track process functions"}; Configurable outlierRejectEvent{"outlierRejectEvent", true, "where outliers are found, reject event (true) or just reject the single track/jet (false)"}; - Configurable wtaMethod{"wtaMethod", 1, "method for WTA axis definition: 0 = matching closest WTA jet (incorrect), 1 = recluster original jet"}; Preslice> partJetsPerCollision = aod::jet::mcCollisionId; @@ -206,8 +205,8 @@ struct JetHadronRecoil { jetReclusterer.recombScheme = fastjet::WTA_pt_scheme; } - template - void fillHistograms(T const& jets, W const& jetsWTA, U const& tracks, float weight = 1.0, float rho = 0.0, float pTHat = 999.0) + template + void fillHistograms(T const& jets, U const& tracks, float weight = 1.0, float rho = 0.0, float pTHat = 999.0) { bool isSigCol; std::vector phiTTAr; @@ -305,7 +304,7 @@ struct JetHadronRecoil { registry.fill(HIST("hJetPhi"), jet.phi(), weight); registry.fill(HIST("hJet3D"), jet.pt() - (rho * jet.area()), jet.eta(), jet.phi(), weight); - double dR = getWTAaxisDifference(jet, jetsWTA, tracks); + double dR = getWTAaxisDifference(jet, tracks); registry.fill(HIST("hDeltaR"), dR, weight); registry.fill(HIST("hDeltaRpT"), jet.pt() - (rho * jet.area()), dR, weight); @@ -348,8 +347,8 @@ struct JetHadronRecoil { registry.fill(HIST("hTracksvsJets"), leadingTrackPt, leadingJetPt, pTHat, weight); } - template - void fillMCPHistograms(T const& jets, W const& jetsWTA, U const& particles, float weight = 1.0, float pTHat = 999.0) + template + void fillMCPHistograms(T const& jets, U const& particles, float weight = 1.0, float pTHat = 999.0) { bool isSigCol; std::vector phiTTAr; @@ -436,7 +435,7 @@ struct JetHadronRecoil { registry.fill(HIST("hJetPhi"), jet.phi(), weight); registry.fill(HIST("hJet3D"), jet.pt(), jet.eta(), jet.phi(), weight); - double dR = getWTAaxisDifference(jet, jetsWTA, particles); + double dR = getWTAaxisDifference(jet, particles); registry.fill(HIST("hDeltaRPart"), dR, weight); registry.fill(HIST("hDeltaRpTPart"), jet.pt(), dR, weight); @@ -471,8 +470,8 @@ struct JetHadronRecoil { registry.fill(HIST("hPartvsJets"), leadingPartPt, leadingJetPt, pTHat, weight); } - template - void fillMatchedHistograms(T const& jetsBase, V const& mcdjetsWTA, W const& mcpjetsWTA, U const&, X const& tracks, Y const& particles, float weight = 1.0, float rho = 0.0, float pTHat = 999.0) + template + void fillMatchedHistograms(T const& jetsBase, U const&, X const& tracks, Y const& particles, float weight = 1.0, float rho = 0.0, float pTHat = 999.0) { for (const auto& jetBase : jetsBase) { double dR = 0; @@ -486,7 +485,7 @@ struct JetHadronRecoil { } } - dR = getWTAaxisDifference(jetBase, mcdjetsWTA, tracks, true); + dR = getWTAaxisDifference(jetBase, tracks); if (jetBase.has_matchedJetGeo()) { for (const auto& jetTag : jetBase.template matchedJetGeo_as>()) { @@ -498,7 +497,7 @@ struct JetHadronRecoil { } } - dRp = getWTAaxisDifference(jetTag, mcpjetsWTA, particles, true); + dRp = getWTAaxisDifference(jetTag, particles); registry.fill(HIST("hPtMatched"), jetBase.pt() - (rho * jetBase.area()), jetTag.pt(), weight); registry.fill(HIST("hPhiMatched"), jetBase.phi(), jetTag.phi(), weight); @@ -514,8 +513,8 @@ struct JetHadronRecoil { } } - template - void fillRecoilJetMatchedHistograms(T const& jetsBase, V const& mcdjetsWTA, W const& mcpjetsWTA, U const&, X const& tracks, Y const& particles, float weight = 1.0, float rho = 0.0, float pTHat = 999.0) + template + void fillRecoilJetMatchedHistograms(T const& jetsBase, U const&, X const& tracks, Y const& particles, float weight = 1.0, float rho = 0.0, float pTHat = 999.0) { std::vector phiTTAr; std::vector phiTTArPart; @@ -549,7 +548,7 @@ struct JetHadronRecoil { if (nTT > 0) { trigNumber = rand->Integer(nTT); phiTT = phiTTAr[trigNumber]; - phiTTPart = phiTTAr[trigNumber]; + phiTTPart = phiTTArPart[trigNumber]; } else { return; } @@ -567,7 +566,7 @@ struct JetHadronRecoil { } float dphi = RecoDecay::constrainAngle(jetBase.phi() - phiTT); - dR = getWTAaxisDifference(jetBase, mcdjetsWTA, tracks, true); + dR = getWTAaxisDifference(jetBase, tracks); if (jetBase.has_matchedJetGeo()) { for (const auto& jetTag : jetBase.template matchedJetGeo_as>()) { @@ -580,15 +579,15 @@ struct JetHadronRecoil { } float dphip = RecoDecay::constrainAngle(jetTag.phi() - phiTTPart); - dRp = getWTAaxisDifference(jetTag, mcpjetsWTA, particles, true); + dRp = getWTAaxisDifference(jetTag, particles); + registry.fill(HIST("hPtMatched"), jetBase.pt() - (rho * jetBase.area()), jetTag.pt(), weight); + registry.fill(HIST("hPhiMatched"), dphi, dphip, weight); + registry.fill(HIST("hPtResolution"), jetTag.pt(), (jetTag.pt() - (jetBase.pt() - (rho * jetBase.area()))) / jetTag.pt(), weight); + registry.fill(HIST("hPhiResolution"), jetTag.pt(), dphip - dphi, weight); + registry.fill(HIST("hDeltaRMatched"), dR, dRp, weight); + registry.fill(HIST("hDeltaRResolution"), jetTag.pt(), dRp - dR, weight); + registry.fill(HIST("hFullMatching"), jetBase.pt() - (rho * jetBase.area()), jetTag.pt(), dphi, dphip, dR, dRp, weight); if ((std::abs(dphi - o2::constants::math::PI) < 0.6) || (std::abs(dphip - o2::constants::math::PI) < 0.6)) { - registry.fill(HIST("hPtMatched"), jetBase.pt() - (rho * jetBase.area()), jetTag.pt(), weight); - registry.fill(HIST("hPhiMatched"), dphi, dphip, weight); - registry.fill(HIST("hPtResolution"), jetTag.pt(), (jetTag.pt() - (jetBase.pt() - (rho * jetBase.area()))) / jetTag.pt(), weight); - registry.fill(HIST("hPhiResolution"), jetTag.pt(), dphip - dphi, weight); - registry.fill(HIST("hDeltaRMatched"), dR, dRp, weight); - registry.fill(HIST("hDeltaRResolution"), jetTag.pt(), dRp - dR, weight); - registry.fill(HIST("hFullMatching"), jetBase.pt() - (rho * jetBase.area()), jetTag.pt(), dphi, dphip, dR, dRp, weight); registry.fill(HIST("hPtMatched1d"), jetTag.pt(), weight); registry.fill(HIST("hDeltaRMatched1d"), dRp, weight); } @@ -599,7 +598,6 @@ struct JetHadronRecoil { void processData(soa::Filtered::iterator const& collision, soa::Filtered> const& jets, - soa::Filtered> const& jetsWTA, soa::Filtered const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { @@ -609,13 +607,12 @@ struct JetHadronRecoil { return; } registry.fill(HIST("hZvtxSelected"), collision.posZ()); - fillHistograms(jets, jetsWTA, tracks); + fillHistograms(jets, tracks); } PROCESS_SWITCH(JetHadronRecoil, processData, "process data", true); void processDataWithRhoSubtraction(soa::Filtered>::iterator const& collision, soa::Filtered> const& jets, - soa::Filtered> const& jetsWTA, soa::Filtered const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { @@ -625,14 +622,13 @@ struct JetHadronRecoil { return; } registry.fill(HIST("hZvtxSelected"), collision.posZ()); - fillHistograms(jets, jetsWTA, tracks, 1.0, collision.rho()); + fillHistograms(jets, tracks, 1.0, collision.rho()); } PROCESS_SWITCH(JetHadronRecoil, processDataWithRhoSubtraction, "process data with rho subtraction", false); void processMCD(soa::Filtered>::iterator const& collision, aod::JMcCollisions const&, soa::Filtered> const& jets, - soa::Filtered> const& jetsWTA, soa::Filtered const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { @@ -648,14 +644,13 @@ struct JetHadronRecoil { return; } registry.fill(HIST("hZvtxSelected"), collision.posZ()); - fillHistograms(jets, jetsWTA, tracks, 1.0, 0.0, collision.mcCollision().ptHard()); + fillHistograms(jets, tracks, 1.0, 0.0, collision.mcCollision().ptHard()); } PROCESS_SWITCH(JetHadronRecoil, processMCD, "process MC detector level", false); void processMCDWithRhoSubtraction(soa::Filtered>::iterator const& collision, aod::JMcCollisions const&, soa::Filtered> const& jets, - soa::Filtered> const& jetsWTA, soa::Filtered const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { @@ -671,14 +666,13 @@ struct JetHadronRecoil { return; } registry.fill(HIST("hZvtxSelected"), collision.posZ()); - fillHistograms(jets, jetsWTA, tracks, 1.0, collision.rho(), collision.mcCollision().ptHard()); + fillHistograms(jets, tracks, 1.0, collision.rho(), collision.mcCollision().ptHard()); } PROCESS_SWITCH(JetHadronRecoil, processMCDWithRhoSubtraction, "process MC detector level with rho subtraction", false); void processMCDWeighted(soa::Filtered>::iterator const& collision, aod::JMcCollisions const&, soa::Filtered> const& jets, - soa::Filtered> const& jetsWTA, soa::Filtered const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { @@ -694,14 +688,13 @@ struct JetHadronRecoil { return; } registry.fill(HIST("hZvtxSelected"), collision.posZ(), collision.mcCollision().weight()); - fillHistograms(jets, jetsWTA, tracks, collision.mcCollision().weight(), 0.0, collision.mcCollision().ptHard()); + fillHistograms(jets, tracks, collision.mcCollision().weight(), 0.0, collision.mcCollision().ptHard()); } PROCESS_SWITCH(JetHadronRecoil, processMCDWeighted, "process MC detector level with event weights", false); void processMCDWeightedWithRhoSubtraction(soa::Filtered>::iterator const& collision, aod::JMcCollisions const&, soa::Filtered> const& jets, - soa::Filtered> const& jetsWTA, soa::Filtered const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { @@ -717,13 +710,12 @@ struct JetHadronRecoil { return; } registry.fill(HIST("hZvtxSelected"), collision.posZ(), collision.mcCollision().weight()); - fillHistograms(jets, jetsWTA, tracks, collision.mcCollision().weight(), collision.rho(), collision.mcCollision().ptHard()); + fillHistograms(jets, tracks, collision.mcCollision().weight(), collision.rho(), collision.mcCollision().ptHard()); } PROCESS_SWITCH(JetHadronRecoil, processMCDWeightedWithRhoSubtraction, "process MC detector level with event weights and rho subtraction", false); void processMCP(aod::JetMcCollision const& collision, soa::Filtered> const& jets, - soa::Filtered> const& jetsWTA, soa::Filtered const& particles) { if (std::abs(collision.posZ()) > vertexZCut) { @@ -736,13 +728,12 @@ struct JetHadronRecoil { return; } registry.fill(HIST("hZvtxSelected"), collision.posZ()); - fillMCPHistograms(jets, jetsWTA, particles, 1.0, collision.ptHard()); + fillMCPHistograms(jets, particles, 1.0, collision.ptHard()); } PROCESS_SWITCH(JetHadronRecoil, processMCP, "process MC particle level", false); void processMCPWeighted(aod::JetMcCollision const& collision, soa::Filtered> const& jets, - soa::Filtered> const& jetsWTA, soa::Filtered const& particles) { if (std::abs(collision.posZ()) > vertexZCut) { @@ -755,14 +746,12 @@ struct JetHadronRecoil { return; } registry.fill(HIST("hZvtxSelected"), collision.posZ(), collision.weight()); - fillMCPHistograms(jets, jetsWTA, particles, collision.weight(), collision.ptHard()); + fillMCPHistograms(jets, particles, collision.weight(), collision.ptHard()); } PROCESS_SWITCH(JetHadronRecoil, processMCPWeighted, "process MC particle level with event weights", false); void processJetsMCPMCDMatched(soa::Filtered>::iterator const& collision, soa::Filtered> const& mcdjets, - soa::Filtered> const& mcdjetsWTA, - soa::Filtered> const& mcpjetsWTA, aod::JetTracks const& tracks, aod::JetParticles const& particles, aod::JetMcCollisions const&, @@ -778,15 +767,12 @@ struct JetHadronRecoil { return; } registry.fill(HIST("hZvtxSelected"), collision.posZ()); - const auto& mcpjetsWTACut = mcpjetsWTA.sliceBy(partJetsPerCollision, collision.mcCollisionId()); - fillMatchedHistograms(mcdjets, mcdjetsWTA, mcpjetsWTACut, mcpjets, tracks, particles); + fillMatchedHistograms(mcdjets, mcpjets, tracks, particles); } PROCESS_SWITCH(JetHadronRecoil, processJetsMCPMCDMatched, "process MC matched (inc jets)", false); void processJetsMCPMCDMatchedWithRhoSubtraction(soa::Filtered>::iterator const& collision, soa::Filtered> const& mcdjets, - soa::Filtered> const& mcdjetsWTA, - soa::Filtered> const& mcpjetsWTA, aod::JetTracks const& tracks, aod::JetParticles const& particles, aod::JetMcCollisions const&, @@ -802,15 +788,12 @@ struct JetHadronRecoil { return; } registry.fill(HIST("hZvtxSelected"), collision.posZ()); - const auto& mcpjetsWTACut = mcpjetsWTA.sliceBy(partJetsPerCollision, collision.mcCollisionId()); - fillMatchedHistograms(mcdjets, mcdjetsWTA, mcpjetsWTACut, mcpjets, tracks, particles, 1.0, 0.0, collision.mcCollision().ptHard()); + fillMatchedHistograms(mcdjets, mcpjets, tracks, particles, 1.0, 0.0, collision.mcCollision().ptHard()); } PROCESS_SWITCH(JetHadronRecoil, processJetsMCPMCDMatchedWithRhoSubtraction, "process MC matched (inc jets) with rho subtraction", false); void processJetsMCPMCDMatchedWeighted(soa::Filtered>::iterator const& collision, soa::Filtered> const& mcdjets, - soa::Filtered> const& mcdjetsWTA, - soa::Filtered> const& mcpjetsWTA, aod::JetTracks const& tracks, aod::JetParticles const& particles, aod::JetMcCollisions const&, @@ -826,15 +809,12 @@ struct JetHadronRecoil { return; } registry.fill(HIST("hZvtxSelected"), collision.posZ()); - const auto& mcpjetsWTACut = mcpjetsWTA.sliceBy(partJetsPerCollision, collision.mcCollisionId()); - fillMatchedHistograms(mcdjets, mcdjetsWTA, mcpjetsWTACut, mcpjets, tracks, particles, collision.mcCollision().weight(), 0.0, collision.mcCollision().ptHard()); + fillMatchedHistograms(mcdjets, mcpjets, tracks, particles, collision.mcCollision().weight(), 0.0, collision.mcCollision().ptHard()); } PROCESS_SWITCH(JetHadronRecoil, processJetsMCPMCDMatchedWeighted, "process MC matched with event weights (inc jets)", false); void processJetsMCPMCDMatchedWeightedWithRhoSubtraction(soa::Filtered>::iterator const& collision, soa::Filtered> const& mcdjets, - soa::Filtered> const& mcdjetsWTA, - soa::Filtered> const& mcpjetsWTA, aod::JetTracks const& tracks, aod::JetParticles const& particles, aod::JetMcCollisions const&, @@ -850,15 +830,12 @@ struct JetHadronRecoil { return; } registry.fill(HIST("hZvtxSelected"), collision.posZ()); - const auto& mcpjetsWTACut = mcpjetsWTA.sliceBy(partJetsPerCollision, collision.mcCollisionId()); - fillMatchedHistograms(mcdjets, mcdjetsWTA, mcpjetsWTACut, mcpjets, tracks, particles, collision.mcCollision().weight(), collision.rho(), collision.mcCollision().ptHard()); + fillMatchedHistograms(mcdjets, mcpjets, tracks, particles, collision.mcCollision().weight(), collision.rho(), collision.mcCollision().ptHard()); } PROCESS_SWITCH(JetHadronRecoil, processJetsMCPMCDMatchedWeightedWithRhoSubtraction, "process MC matched with event weights (inc jets) and rho subtraction", false); void processRecoilJetsMCPMCDMatched(soa::Filtered>::iterator const& collision, soa::Filtered> const& mcdjets, - soa::Filtered> const& mcdjetsWTA, - soa::Filtered> const& mcpjetsWTA, soa::Filtered const& tracks, soa::Filtered const& particles, aod::JetMcCollisions const&, @@ -874,15 +851,12 @@ struct JetHadronRecoil { return; } registry.fill(HIST("hZvtxSelected"), collision.posZ()); - const auto& mcpjetsWTACut = mcpjetsWTA.sliceBy(partJetsPerCollision, collision.mcCollisionId()); - fillRecoilJetMatchedHistograms(mcdjets, mcdjetsWTA, mcpjetsWTACut, mcpjets, tracks, particles, 1.0, 0.0, collision.mcCollision().ptHard()); + fillRecoilJetMatchedHistograms(mcdjets, mcpjets, tracks, particles, 1.0, 0.0, collision.mcCollision().ptHard()); } PROCESS_SWITCH(JetHadronRecoil, processRecoilJetsMCPMCDMatched, "process MC matched (recoil jets)", false); void processRecoilJetsMCPMCDMatchedWeighted(soa::Filtered>::iterator const& collision, soa::Filtered> const& mcdjets, - soa::Filtered> const& mcdjetsWTA, - soa::Filtered> const& mcpjetsWTA, soa::Filtered const& tracks, soa::Filtered const& particles, aod::JetMcCollisions const&, @@ -898,54 +872,30 @@ struct JetHadronRecoil { return; } registry.fill(HIST("hZvtxSelected"), collision.posZ()); - const auto& mcpjetsWTACut = mcpjetsWTA.sliceBy(partJetsPerCollision, collision.mcCollisionId()); - fillRecoilJetMatchedHistograms(mcdjets, mcdjetsWTA, mcpjetsWTACut, mcpjets, tracks, particles, collision.mcCollision().weight(), 0.0, collision.mcCollision().ptHard()); + fillRecoilJetMatchedHistograms(mcdjets, mcpjets, tracks, particles, collision.mcCollision().weight(), 0.0, collision.mcCollision().ptHard()); } PROCESS_SWITCH(JetHadronRecoil, processRecoilJetsMCPMCDMatchedWeighted, "process MC matched with event weights (recoil jets)", false); - template - double getWTAaxisDifference(T const& jet, U const& jetsWTA, X const& /*tracks or particles*/, bool isMatched = false) + template + double getWTAaxisDifference(T const& jet, X const& /*tracks or particles*/) { double deltaPhi = -1; - double deltaEta = -1; double deltaY = -1; double dR = -1; - if (wtaMethod == 0) { - // get WTA matched jet - should just be one jet matched geometrically - if (isMatched) { - // response - requires alternative method - for (const auto& jetWTA : jetsWTA) { - double djetp = RecoDecay::sqrtSumOfSquares(RecoDecay::constrainAngle(jet.phi() - jetWTA.phi(), -o2::constants::math::PI), jet.eta() - jetWTA.eta()); - if (djetp < 0.6 * jetR) { - dR = djetp; - break; - } - } - } else { - // MCP or MCD - for (const auto& jetWTA : jet.template matchedJetGeo_as>()) { - deltaPhi = RecoDecay::constrainAngle(jetWTA.phi() - jet.phi(), -o2::constants::math::PI); - deltaEta = jetWTA.eta() - jet.eta(); - dR = RecoDecay::sqrtSumOfSquares(deltaPhi, deltaEta); - } - } - } else if (wtaMethod == 1) { - // recluster jet - jetConstituents.clear(); - for (auto& jetConstituent : jet.template tracks_as()) { - fastjetutilities::fillTracks(jetConstituent, jetConstituents, jetConstituent.globalIndex()); - } - jetReclustered.clear(); - fastjet::ClusterSequenceArea clusterSeq(jetReclusterer.findJets(jetConstituents, jetReclustered)); - jetReclustered = sorted_by_pt(jetReclustered); - - deltaPhi = RecoDecay::constrainAngle(jet.phi() - jetReclustered[0].phi(), -o2::constants::math::PI); - deltaY = jet.y() - jetReclustered[0].rap(); - dR = RecoDecay::sqrtSumOfSquares(deltaPhi, deltaY); - LOG(debug) << "orig. jet n const = " << jet.tracksIds().size() << " pt = " << jet.pt() << " eta = " << jet.eta() << " phi = " << jet.phi(); - LOG(debug) << "recl. jet n const = " << clusterSeq.constituents(jetReclustered[0]).size() << " pt = " << jetReclustered[0].pt() << " eta = " << jetReclustered[0].eta() << " phi = " << jetReclustered[0].phi(); - LOG(debug) << "distance = " << dR; - } + jetConstituents.clear(); + for (auto& jetConstituent : jet.template tracks_as()) { + fastjetutilities::fillTracks(jetConstituent, jetConstituents, jetConstituent.globalIndex()); + } + jetReclustered.clear(); + fastjet::ClusterSequenceArea clusterSeq(jetReclusterer.findJets(jetConstituents, jetReclustered)); + jetReclustered = sorted_by_pt(jetReclustered); + + deltaPhi = RecoDecay::constrainAngle(jet.phi() - jetReclustered[0].phi(), -o2::constants::math::PI); + deltaY = jet.y() - jetReclustered[0].rap(); + dR = RecoDecay::sqrtSumOfSquares(deltaPhi, deltaY); + LOG(debug) << "orig. jet n const = " << jet.tracksIds().size() << " pt = " << jet.pt() << " eta = " << jet.eta() << " phi = " << jet.phi(); + LOG(debug) << "recl. jet n const = " << clusterSeq.constituents(jetReclustered[0]).size() << " pt = " << jetReclustered[0].pt() << " eta = " << jetReclustered[0].eta() << " phi = " << jetReclustered[0].phi(); + LOG(debug) << "distance = " << dR; return dR; } }; From 9cfa928969694636b1abaafbacd3b461ee2ab73a Mon Sep 17 00:00:00 2001 From: Jaideep Tanwar <141036812+jtanwar2212@users.noreply.github.com> Date: Tue, 19 Aug 2025 13:01:06 +0530 Subject: [PATCH 102/986] [PWGLF] centrality variable with less memory consuption (#12629) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx | 212 ++++++++++++--------------- 1 file changed, 96 insertions(+), 116 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx b/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx index aa7fa01413c..78edc84586b 100644 --- a/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx +++ b/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx @@ -67,25 +67,25 @@ constexpr double kBetheBlochDefault[nParticles][nBetheParams]{ {5.393020, 7.859534, 0.004048, 2.323197, 1.609307, 0.09}, // triton {-126.557359, -0.858569, 1.111643, 1.210323, 2.656374, 0.09}, // helion {-126.557359, -0.858569, 1.111643, 1.210323, 2.656374, 0.09}}; // alpha -const int nTrkSettings = 19; -static const std::vector trackPIDsettingsNames{"useBBparams", "minITSnCls", "minITSnClscos", "minTPCnCls", "maxTPCchi2", "minTPCchi2", "maxITSchi2", "minRigidity", "maxRigidity", "maxTPCnSigma", "TOFrequiredabove", "minTOFmass", "maxTOFmass", "maxDcaXY", "maxDcaZ", "minITSclsSize", "maxITSclsSize", "minTPCnClsCrossedRows", "minReqClusterITSib"}; +const int nTrkSettings = 14; +static const std::vector trackPIDsettingsNames{"useBBparams", "minITSnCls", "minITSnClscos", "minTPCnCls", "maxTPCchi2", "minTPCchi2", "maxITSchi2", "maxTPCnSigma", "maxDcaXY", "maxDcaZ", "minITSclsSize", "maxITSclsSize", "minTPCnClsCrossedRows", "minReqClusterITSib"}; constexpr double kTrackPIDSettings[nParticles][nTrkSettings]{ - {0, 0, 4, 60, 4.0, 0.5, 100, 0.15, 1.2, 2.5, -1, 0, 100, 2., 2., 0., 1000, 70, 1}, - {1, 0, 4, 70, 4.0, 0.5, 100, 0.20, 4.0, 3.0, -1, 0, 100, 2., 2., 0., 1000, 70, 1}, - {1, 0, 4, 70, 4.0, 0.5, 100, 0.50, 5.0, 3.0, -1, 0, 100, 2., 2., 0., 1000, 70, 1}, - {1, 0, 4, 70, 4.0, 0.5, 100, 0.50, 5.0, 3.0, -1, 0, 100, 2., 2., 0., 1000, 70, 1}, - {1, 0, 4, 75, 4.0, 0.5, 100, 0.50, 5.0, 5.0, -1, 0, 100, 2., 2., 0., 1000, 70, 1}, - {1, 0, 4, 70, 4.0, 0.5, 100, 0.50, 5.0, 5.0, -1, 0, 100, 2., 2., 0., 1000, 70, 1}}; + {0, 0, 4, 60, 4.0, 0.5, 100, 2.5, 2., 2., 0., 1000, 70, 1}, + {1, 0, 4, 70, 4.0, 0.5, 100, 3.0, 2., 2., 0., 1000, 70, 1}, + {1, 0, 4, 70, 4.0, 0.5, 100, 3.0, 2., 2., 0., 1000, 70, 1}, + {1, 0, 4, 70, 4.0, 0.5, 100, 3.0, 2., 2., 0., 1000, 70, 1}, + {1, 0, 4, 75, 4.0, 0.5, 100, 5.0, 2., 2., 0., 1000, 70, 1}, + {1, 0, 4, 70, 4.0, 0.5, 100, 5.0, 2., 2., 0., 1000, 70, 1}}; -const int nTrkSettings2 = 3; -static const std::vector trackPIDsettingsNames2{"useITSnsigma", "minITSnsigma", "maxITSnsigma"}; +const int nTrkSettings2 = 4; +static const std::vector trackPIDsettingsNames2{"useITSnsigma", "minITSnsigma", "maxITSnsigma", "fillsparsh"}; constexpr double kTrackPIDSettings2[nParticles][nTrkSettings2]{ - {1, -5, 4}, - {1, -5, 4}, - {1, -5, 4}, - {1, -5, 4}, - {1, -5, 4}, - {1, -5, 4}}; + {1, -5, 4, 0}, + {1, -5, 4, 0}, + {1, -5, 4, 0}, + {1, -5, 4, 1}, + {1, -5, 4, 1}, + {1, -5, 4, 1}}; struct PrimParticles { TString name; @@ -139,22 +139,16 @@ struct NucleitpcPbPb { Configurable cfgminReqClusterITSibRequire{"cfgminReqClusterITSibRequire", true, " Require min number of clusters required in ITS inner barrel"}; Configurable cfgmaxITSchi2Require{"cfgmaxITSchi2Require", true, "Require maxITSchi2 Cut"}; Configurable cfgmaxTPCnSigmaRequire{"cfgmaxTPCnSigmaRequire", true, "Require maxTPCnSigma Cut"}; - Configurable cfgmaxITSnSigmaRequire{"cfgmaxITSnSigmaRequire", true, "Require maxITSnSigma Cut for helium"}; Configurable cfgminGetMeanItsClsSizeRequire{"cfgminGetMeanItsClsSizeRequire", true, "Require minGetMeanItsClsSize Cut"}; Configurable cfgmaxGetMeanItsClsSizeRequire{"cfgmaxGetMeanItsClsSizeRequire", true, "Require maxGetMeanItsClsSize Cut"}; - Configurable cfgRigidityCutRequire{"cfgRigidityCutRequire", true, "Require Rigidity Cut"}; - Configurable cfgmassRequire{"cfgmassRequire", true, "Require mass Cuts"}; Configurable cfgDCAwithptRequire{"cfgDCAwithptRequire", true, "Require DCA cuts with pt dependance"}; Configurable cfgDCAnopt{"cfgDCAnopt", true, "Require DCA cuts without pt dependance"}; - Configurable cfgTwicemass{"cfgTwicemass", true, "multiply mass by its charge"}; Configurable cfgRequirebetaplot{"cfgRequirebetaplot", true, "Require beta plot"}; - Configurable cfgRequireMCposZ{"cfgRequireMCposZ", true, "Require beta plot"}; Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {kBetheBlochDefault[0], nParticles, nBetheParams, particleNames, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for light nuclei"}; Configurable> cfgTrackPIDsettings{"cfgTrackPIDsettings", {kTrackPIDSettings[0], nParticles, nTrkSettings, particleNames, trackPIDsettingsNames}, "track selection and PID criteria"}; Configurable> cfgTrackPIDsettings2{"cfgTrackPIDsettings2", {kTrackPIDSettings2[0], nParticles, nTrkSettings2, particleNames, trackPIDsettingsNames2}, "track selection and PID criteria"}; Configurable cfgFillhspectra{"cfgFillhspectra", true, "fill data sparsh"}; - Configurable cfgFillQAplots{"cfgFillQAplots", false, "Fill QA sparsh"}; Configurable cfgFillmass{"cfgFillmass", false, "Fill mass histograms"}; Configurable centcut{"centcut", 80.0f, "centrality cut"}; Configurable cfgCutRapidity{"cfgCutRapidity", 0.5f, "Rapidity range"}; @@ -162,7 +156,6 @@ struct NucleitpcPbPb { Configurable cfgZvertexRequire{"cfgZvertexRequire", true, "Pos Z cut require"}; Configurable cfgZvertexRequireMC{"cfgZvertexRequireMC", true, "Pos Z cut require for generated particles"}; Configurable cfgsel8Require{"cfgsel8Require", true, "sel8 cut require"}; - Configurable cfgITSnsigma{"cfgITSnsigma", 5, "Max ITS nsigma value"}; Configurable cfgtpcNClsFound{"cfgtpcNClsFound", 100.0f, "min. no. of tpcNClsFound"}; Configurable cfgitsNCls{"cfgitsNCls", 2.0f, "min. no. of itsNCls"}; o2::track::TrackParametrizationWithError mTrackParCov; @@ -242,8 +235,6 @@ struct NucleitpcPbPb { histos.add("hSpectra", " ", HistType::kTHnSparseF, {speciesBitAxis, ptAxis, nsigmaAxis, {5, -2.5, 2.5}, axisCent, axisRigidity, axisdEdx, axisDCA, axisDCA, nsigmaAxis}); - histos.add("hQAtest", "", HistType::kTHnSparseF, {speciesBitAxis, ptAxis, {5, -2.5, 2.5}, axisTPCcls, axisITScls, axisITSchi2, axisTPCchi2}); - if (doprocessMC) { histomc.add("histVtxZgen", "histVtxZgen", kTH1F, {axisVtxZ}); histomc.add("ImptParameter", "ImptParameter", kTH1F, {axisImpt}); @@ -267,90 +258,6 @@ struct NucleitpcPbPb { } } //---------------------------------------------------------------------------------------------------------------- - void findprimaryParticles(aod::TrackAssoc const& tracksByColl, TracksFull const& tracks, float cent) - { - for (const auto& trackId : tracksByColl) { - const auto& track = tracks.rawIteratorAt(trackId.trackId()); - if (!track.isPVContributor() && cfgUsePVcontributors) - continue; - if (!track.hasITS() && cfgITSrequire) - continue; - if (!track.hasTPC() && cfgTPCrequire) - continue; - if (!track.passedITSRefit() && cfgPassedITSRefit) - continue; - if (!track.passedTPCRefit() && cfgPassedTPCRefit) - continue; - if (std::abs(track.eta()) > cfgCutEta && cfgetaRequire) - continue; - for (size_t i = 0; i < primaryParticles.size(); i++) { - - float ptMomn; - setTrackParCov(track, mTrackParCov); - mTrackParCov.setPID(track.pidForTracking()); - ptMomn = (i == he3 || i == he4) ? 2 * mTrackParCov.getPt() : mTrackParCov.getPt(); - int sign = 0; - if (track.sign() > 0) { - sign = 1; - } - if (track.sign() < 0) { - sign = -1; - } // <- This redeclares a new local variable! - if (cfgFillQAplots) { - histos.fill(HIST("hQAtest"), i, ptMomn, sign, track.tpcNClsFound(), track.itsNCls(), track.itsChi2NCl(), track.tpcChi2NCl()); - } - if (std::abs(getRapidity(track, i)) > cfgCutRapidity && cfgRapidityRequire) - continue; - if (track.tpcNClsFound() < cfgTrackPIDsettings->get(i, "minTPCnCls") && cfgTPCNClsfoundRequire) - continue; - if (((track.tpcNClsCrossedRows() < cfgTrackPIDsettings->get(i, "minTPCnClsCrossedRows")) || track.tpcNClsCrossedRows() < 0.8 * track.tpcNClsFindable()) && cfgTPCNClsCrossedRowsRequire) // o2-linter: disable=magic-number (To be checked) - continue; - if (track.tpcChi2NCl() > cfgTrackPIDsettings->get(i, "maxTPCchi2") && cfgmaxTPCchi2Require) - continue; - if (track.tpcChi2NCl() < cfgTrackPIDsettings->get(i, "minTPCchi2") && cfgminTPCchi2Require) - continue; - if (track.itsNCls() < cfgTrackPIDsettings->get(i, "minITSnCls") && cfgminITSnClsRequire) - continue; - double cosheta = std::cosh(track.eta()); - if ((track.itsNCls() / cosheta) < cfgTrackPIDsettings->get(i, "minITSnClscos") && cfgminITSnClscosRequire) - continue; - if ((track.itsNClsInnerBarrel() < cfgTrackPIDsettings->get(i, "minReqClusterITSib")) && cfgminReqClusterITSibRequire) - continue; - if (track.itsChi2NCl() > cfgTrackPIDsettings->get(i, "maxITSchi2") && cfgmaxITSchi2Require) - continue; - if (getMeanItsClsSize(track) < cfgTrackPIDsettings->get(i, "minITSclsSize") && cfgminGetMeanItsClsSizeRequire) - continue; - if (getMeanItsClsSize(track) > cfgTrackPIDsettings->get(i, "maxITSclsSize") && cfgmaxGetMeanItsClsSizeRequire) - continue; - - bool insideDCAxy = (std::abs(track.dcaXY()) <= (cfgTrackPIDsettings->get(i, "maxDcaXY") * (0.0105f + 0.0350f / std::pow(ptMomn, 1.1f)))); // o2-linter: disable=magic-number (To be checked) - if ((!(insideDCAxy) || std::abs(track.dcaZ()) > dcazSigma(ptMomn, cfgTrackPIDsettings->get(i, "maxDcaZ"))) && cfgDCAwithptRequire) - continue; - - float tpcNsigma = getTPCnSigma(track, primaryParticles.at(i)); - if ((std::abs(tpcNsigma) > cfgTrackPIDsettings->get(i, "maxTPCnSigma")) && cfgmaxTPCnSigmaRequire) - continue; - float itsSigma = getITSnSigma(track, primaryParticles.at(i)); - - if (itsSigma < cfgTrackPIDsettings2->get(i, "minITSnsigma") && cfgTrackPIDsettings2->get(i, "useITSnsigma") < 1) - continue; - if (itsSigma > cfgTrackPIDsettings2->get(i, "maxITSnsigma") && cfgTrackPIDsettings2->get(i, "useITSnsigma") < 1) - continue; - - fillhmass(track, i); - if (cfgFillhspectra) { - histos.fill(HIST("hSpectra"), i, ptMomn, tpcNsigma, sign, cent, getRigidity(track) * track.sign(), track.tpcSignal(), track.dcaZ(), track.dcaXY(), itsSigma); - } - if (cfgRequirebetaplot) { - histos.fill(HIST("Tofsignal"), getRigidity(track) * track.sign(), o2::pid::tof::Beta::GetBeta(track)); - } - } - if (track.tpcNClsFound() < cfgtpcNClsFound || track.itsNCls() < cfgitsNCls) { - histos.fill(HIST("Tpcsignal"), getRigidity(track) * track.sign(), track.tpcSignal()); - } - histos.fill(HIST("histeta"), track.eta()); - } // track loop - } //---------------------------------------------------------------------------------------------------------------- void processData(CollisionsFull const& collisions, TracksFull const& tracks, aod::BCsWithTimestamps const&, aod::TrackAssoc const& tracksColl) { @@ -375,10 +282,86 @@ struct NucleitpcPbPb { histos.fill(HIST("histCentFTOC_cut"), collision.centFT0C()); const uint64_t collIdx = collision.globalIndex(); auto tracksByColl = tracksColl.sliceBy(perCollision, collIdx); + ///////////////////////////////////////////////////////////////////////////////// + for (const auto& trackId : tracksByColl) { + const auto& track = tracks.rawIteratorAt(trackId.trackId()); + if (!track.isPVContributor() && cfgUsePVcontributors) + continue; + if (!track.hasITS() && cfgITSrequire) + continue; + if (!track.hasTPC() && cfgTPCrequire) + continue; + if (!track.passedITSRefit() && cfgPassedITSRefit) + continue; + if (!track.passedTPCRefit() && cfgPassedTPCRefit) + continue; + if (std::abs(track.eta()) > cfgCutEta && cfgetaRequire) + continue; + for (size_t i = 0; i < primaryParticles.size(); i++) { - findprimaryParticles(tracksByColl, tracks, collision.centFT0C()); - if (!collHasCandidate) - continue; + float ptMomn; + setTrackParCov(track, mTrackParCov); + mTrackParCov.setPID(track.pidForTracking()); + ptMomn = (i == he3 || i == he4) ? 2 * mTrackParCov.getPt() : mTrackParCov.getPt(); + int sign = 0; + if (track.sign() > 0) { + sign = 1; + } + if (track.sign() < 0) { + sign = -1; + } // <- This redeclares a new local variable! + if (std::abs(getRapidity(track, i)) > cfgCutRapidity && cfgRapidityRequire) + continue; + if (track.tpcNClsFound() < cfgTrackPIDsettings->get(i, "minTPCnCls") && cfgTPCNClsfoundRequire) + continue; + if (((track.tpcNClsCrossedRows() < cfgTrackPIDsettings->get(i, "minTPCnClsCrossedRows")) || track.tpcNClsCrossedRows() < 0.8 * track.tpcNClsFindable()) && cfgTPCNClsCrossedRowsRequire) // o2-linter: disable=magic-number (To be checked) + continue; + if (track.tpcChi2NCl() > cfgTrackPIDsettings->get(i, "maxTPCchi2") && cfgmaxTPCchi2Require) + continue; + if (track.tpcChi2NCl() < cfgTrackPIDsettings->get(i, "minTPCchi2") && cfgminTPCchi2Require) + continue; + if (track.itsNCls() < cfgTrackPIDsettings->get(i, "minITSnCls") && cfgminITSnClsRequire) + continue; + double cosheta = std::cosh(track.eta()); + if ((track.itsNCls() / cosheta) < cfgTrackPIDsettings->get(i, "minITSnClscos") && cfgminITSnClscosRequire) + continue; + if ((track.itsNClsInnerBarrel() < cfgTrackPIDsettings->get(i, "minReqClusterITSib")) && cfgminReqClusterITSibRequire) + continue; + if (track.itsChi2NCl() > cfgTrackPIDsettings->get(i, "maxITSchi2") && cfgmaxITSchi2Require) + continue; + if (getMeanItsClsSize(track) < cfgTrackPIDsettings->get(i, "minITSclsSize") && cfgminGetMeanItsClsSizeRequire) + continue; + if (getMeanItsClsSize(track) > cfgTrackPIDsettings->get(i, "maxITSclsSize") && cfgmaxGetMeanItsClsSizeRequire) + continue; + + bool insideDCAxy = (std::abs(track.dcaXY()) <= (cfgTrackPIDsettings->get(i, "maxDcaXY") * (0.0105f + 0.0350f / std::pow(ptMomn, 1.1f)))); // o2-linter: disable=magic-number (To be checked) + if ((!(insideDCAxy) || std::abs(track.dcaZ()) > dcazSigma(ptMomn, cfgTrackPIDsettings->get(i, "maxDcaZ"))) && cfgDCAwithptRequire) + continue; + + float tpcNsigma = getTPCnSigma(track, primaryParticles.at(i)); + if ((std::abs(tpcNsigma) > cfgTrackPIDsettings->get(i, "maxTPCnSigma")) && cfgmaxTPCnSigmaRequire) + continue; + float itsSigma = getITSnSigma(track, primaryParticles.at(i)); + + if (itsSigma < cfgTrackPIDsettings2->get(i, "minITSnsigma") && cfgTrackPIDsettings2->get(i, "useITSnsigma") < 1) + continue; + if (itsSigma > cfgTrackPIDsettings2->get(i, "maxITSnsigma") && cfgTrackPIDsettings2->get(i, "useITSnsigma") < 1) + continue; + + fillhmass(track, i); + if (cfgFillhspectra && cfgTrackPIDsettings2->get(i, "fillsparsh") == 1) { + histos.fill(HIST("hSpectra"), i, ptMomn, tpcNsigma, sign, collision.centFT0C(), getRigidity(track) * track.sign(), track.tpcSignal(), track.dcaZ(), track.dcaXY(), itsSigma); + } + if (cfgRequirebetaplot) { + histos.fill(HIST("Tofsignal"), getRigidity(track) * track.sign(), o2::pid::tof::Beta::GetBeta(track)); + } + } + if (track.tpcNClsFound() > cfgtpcNClsFound || track.itsNCls() > cfgitsNCls) { + histos.fill(HIST("Tpcsignal"), getRigidity(track) * track.sign(), track.tpcSignal()); + } + histos.fill(HIST("histeta"), track.eta()); + } // track loop + /////////////////////////////////////////////// } } PROCESS_SWITCH(NucleitpcPbPb, processData, "data analysis", false); @@ -496,9 +479,6 @@ struct NucleitpcPbPb { if (track.sign() < 0) { sign = -1; } // <- This redeclares a new local variable! - if (cfgFillQAplots) { - histos.fill(HIST("hQAtest"), i, ptMomn, sign, track.tpcNClsFound(), track.itsNCls(), track.itsChi2NCl(), track.tpcChi2NCl()); - } if (std::abs(getRapidity(track, i)) > cfgCutRapidity && cfgRapidityRequire) continue; if (track.tpcNClsFound() < cfgTrackPIDsettings->get(i, "minTPCnCls") && cfgTPCNClsfoundRequire) @@ -538,7 +518,7 @@ struct NucleitpcPbPb { continue; fillhmass(track, i); - if (cfgFillhspectra) { + if (cfgFillhspectra && cfgTrackPIDsettings2->get(i, "fillsparsh") == 1) { histos.fill(HIST("hSpectra"), i, ptMomn, tpcNsigma, sign, collision.centFT0C(), getRigidity(track) * track.sign(), track.tpcSignal(), track.dcaZ(), track.dcaXY(), itsSigma); } if (cfgRequirebetaplot) { From 6cd4f27b8d94b02020c2b18016ae1b80e05aaaee Mon Sep 17 00:00:00 2001 From: Artem Kotliarov <71133985+KotliarovAr@users.noreply.github.com> Date: Tue, 19 Aug 2025 10:57:05 +0200 Subject: [PATCH 103/986] [PWGJE] exclude jets with constituents have pT larger than some threshold (#12622) Co-authored-by: ALICE Builder --- PWGJE/Tasks/recoilJets.cxx | 87 ++++++++++++++++++++++++++------------ 1 file changed, 60 insertions(+), 27 deletions(-) diff --git a/PWGJE/Tasks/recoilJets.cxx b/PWGJE/Tasks/recoilJets.cxx index ebf69f44e10..286b0b5004c 100644 --- a/PWGJE/Tasks/recoilJets.cxx +++ b/PWGJE/Tasks/recoilJets.cxx @@ -126,6 +126,9 @@ struct RecoilJets { Configurable recoilRegion{"recoilRegion", 0.6, "Width of recoil acceptance"}; + Configurable maxJetConstituentPt{"maxJetConstituentPt", 100., + "Remove jets with constituent above this pt cut"}; + // List of configurable parameters for histograms Configurable histJetPt{"histJetPt", 100, "Maximum value of jet pT shown in histograms"}; @@ -416,9 +419,9 @@ struct RecoilJets { spectra.add("hScaleMultFT0C", "Scaled mult. signal from FTOC", kTH1F, {{200, 0.0, 20.}}); spectra.add("hScaleMultFT0M", "Scaled total mult. signal from FT0A & FTOC", kTH1F, - {{200, 0.0, 20.}}); + {{2000, 0.0, 20.}}); spectra.add("hScaleMultFT0M_v2", "Scaled total mult. signal from FT0A & FTOC", kTH1F, - {{200, 0.0, 20.}}); + {{2000, 0.0, 20.}}); spectra.add("hMultZNA", "Mult. signal from ZDC A-side", kTH1F, {{500, 0.0, 10000.}}); @@ -505,6 +508,10 @@ struct RecoilJets { } for (const auto& jet : jets) { + // skip jets which have a constituent with pT above specified cut + if (isJetWithHighPtConstituent(jet, tracks)) + continue; + spectra.fill(HIST("hJetPtEtaPhiRhoArea"), jet.pt(), jet.eta(), jet.phi(), collision.rho(), jet.area(), weight); @@ -674,13 +681,13 @@ struct RecoilJets { for (const auto& jetBase : jetsBase) { bool bIsBaseJetRecoil = get<1>(isRecoilJet(jetBase, phiTTSig)) && bIsThereTTSig; - dataForUnfolding(jetBase, jetsTag, bIsBaseJetRecoil, weight); + dataForUnfolding(jetBase, jetsTag, bIsBaseJetRecoil, tracks, weight); } } template void fillMultiplicityHistograms(Collision const& collision, - float weight = 1.0) + float weight = 1.) { spectra.fill(HIST("hMultFT0A"), collision.multFT0A(), weight); @@ -830,12 +837,11 @@ struct RecoilJets { PROCESS_SWITCH(RecoilJets, processJetsMatched, "process matching of MC jets (no weight)", false); - void - processJetsMatchedWeighted(FilteredCollDetLevelGetWeight const& collision, - aod::JetMcCollisions const&, - FilteredTracks const& tracks, - FilteredMatchedJetsDetLevel const& mcdjets, - FilteredMatchedJetsPartLevel const& mcpjets) + void processJetsMatchedWeighted(FilteredCollDetLevelGetWeight const& collision, + aod::JetMcCollisions const&, + FilteredTracks const& tracks, + FilteredMatchedJetsDetLevel const& mcdjets, + FilteredMatchedJetsPartLevel const& mcpjets) { if (skipEvent(collision) || skipMBGapEvent(collision)) return; @@ -903,9 +909,22 @@ struct RecoilJets { return 10. / (std::pow(weight, 1.0 / pTHatExponent)); } - template + template + bool isJetWithHighPtConstituent(Jet const& jet, Tracks const&) + { + bool bIsJetWithHighPtConstituent = false; + for (const auto& jetConstituent : jet.template tracks_as()) { + if (jetConstituent.pt() > maxJetConstituentPt) { + bIsJetWithHighPtConstituent = true; + break; + } + } + return bIsJetWithHighPtConstituent; + } + + template void dataForUnfolding(PartJet const& partJet, DetJet const& detJets, - bool bIsBaseJetRecoil, float weight = 1.0) + bool bIsBaseJetRecoil, TracksTable const& tracks, float weight = 1.) { bool bIsThereMatchedJet = partJet.has_matchedJetGeo(); @@ -915,24 +934,35 @@ struct RecoilJets { partJet.template matchedJetGeo_as>(); for (const auto& jetMatched : jetsMatched) { - spectra.fill(HIST("hNumberMatchedJetsPerOneBaseJet"), - jetsMatched.size(), jetMatched.pt(), weight); - spectra.fill(HIST("hJetPt_DetLevel_vs_PartLevel"), jetMatched.pt(), - partJet.pt(), weight); - spectra.fill(HIST("hJetPt_resolution"), - (partJet.pt() - jetMatched.pt()) / partJet.pt(), - partJet.pt(), weight); - spectra.fill(HIST("hJetPhi_resolution"), - partJet.phi() - jetMatched.phi(), partJet.pt(), weight); - - if (bIsBaseJetRecoil) { - spectra.fill(HIST("hJetPt_DetLevel_vs_PartLevel_RecoilJets"), - jetMatched.pt(), partJet.pt(), weight); - spectra.fill(HIST("hJetPt_resolution_RecoilJets"), + + // skip matches where detector level jets have a constituent with pT above specified cut + bool skipMatchedDetJet = isJetWithHighPtConstituent(jetMatched, tracks); + + if (skipMatchedDetJet) { + // Miss jets + spectra.fill(HIST("hMissedJets_pT"), partJet.pt(), weight); + if (bIsBaseJetRecoil) + spectra.fill(HIST("hMissedJets_pT_RecoilJets"), partJet.pt(), weight); + } else { + spectra.fill(HIST("hNumberMatchedJetsPerOneBaseJet"), + jetsMatched.size(), jetMatched.pt(), weight); + spectra.fill(HIST("hJetPt_DetLevel_vs_PartLevel"), jetMatched.pt(), + partJet.pt(), weight); + spectra.fill(HIST("hJetPt_resolution"), (partJet.pt() - jetMatched.pt()) / partJet.pt(), partJet.pt(), weight); - spectra.fill(HIST("hJetPhi_resolution_RecoilJets"), + spectra.fill(HIST("hJetPhi_resolution"), partJet.phi() - jetMatched.phi(), partJet.pt(), weight); + + if (bIsBaseJetRecoil) { + spectra.fill(HIST("hJetPt_DetLevel_vs_PartLevel_RecoilJets"), + jetMatched.pt(), partJet.pt(), weight); + spectra.fill(HIST("hJetPt_resolution_RecoilJets"), + (partJet.pt() - jetMatched.pt()) / partJet.pt(), + partJet.pt(), weight); + spectra.fill(HIST("hJetPhi_resolution_RecoilJets"), + partJet.phi() - jetMatched.phi(), partJet.pt(), weight); + } } } } else { @@ -944,6 +974,9 @@ struct RecoilJets { // Fake jets for (const auto& detJet : detJets) { + if (isJetWithHighPtConstituent(detJet, tracks)) + continue; + bIsThereMatchedJet = detJet.has_matchedJetGeo(); if (!bIsThereMatchedJet) { spectra.fill(HIST("hFakeJets_pT"), detJet.pt(), weight); From f7f3381f39e9dedde02cf86debe1acc71c0b1360 Mon Sep 17 00:00:00 2001 From: GijsvWeelden <55794847+GijsvWeelden@users.noreply.github.com> Date: Tue, 19 Aug 2025 10:57:22 +0200 Subject: [PATCH 104/986] [PWGJE] V0 QA: (#12623) --- PWGJE/Tasks/v0QA.cxx | 352 ++++++++++++++----------------------------- 1 file changed, 117 insertions(+), 235 deletions(-) diff --git a/PWGJE/Tasks/v0QA.cxx b/PWGJE/Tasks/v0QA.cxx index 3fb2215b51f..8b79b780ae4 100644 --- a/PWGJE/Tasks/v0QA.cxx +++ b/PWGJE/Tasks/v0QA.cxx @@ -124,87 +124,65 @@ struct V0QA { const AxisSpec axisSharedFraction{binTPCNClSharedFraction, "Fraction shared clusters TPC"}; const AxisSpec axisCrossedRowsOverFindable{binTPCCrossedRowsOverFindableCl, "Crossed rows / findable clusters TPC"}; + const bool doSumw2 = true; + if (doprocessFlags) { registry.add("inclusive/V0Flags", "V0Flags", HistType::kTH2D, {{5, -0.5, 4.5}, {5, -0.5, 4.5}}); } if (doprocessMcD) { - registry.add("inclusive/hEvents", "Events", {HistType::kTH1D, {{2, 0.0f, 2.0f}}}); - - registry.add("inclusive/K0SPtEtaMass", "K0S Pt, Eta, Mass", HistType::kTH3D, {axisV0Pt, axisEta, axisK0SM}); - registry.add("inclusive/InvMassK0STrue", "Invariant mass of K0S", HistType::kTH3D, {axisV0Pt, axisV0Radius, axisK0SM}); - registry.add("inclusive/K0SPtEtaMassWrongCollision", "K0S Pt, Eta, Mass (Wrong Collision)", HistType::kTH3D, {axisV0Pt, axisEta, axisK0SM}); - registry.add("inclusive/LambdaPtEtaMass", "Lambda Pt, Eta, Mass", HistType::kTH3D, {axisV0Pt, axisEta, axisLambdaM}); - registry.add("inclusive/InvMassLambdaTrue", "Invariant mass of Lambda", HistType::kTH3D, {axisV0Pt, axisV0Radius, axisLambdaM}); - registry.add("inclusive/LambdaPtEtaMassWrongCollision", "Lambda Pt, Eta, Mass (Wrong Collision)", HistType::kTH3D, {axisV0Pt, axisEta, axisLambdaM}); - registry.add("inclusive/AntiLambdaPtEtaMass", "AntiLambda Pt, Eta, Mass", HistType::kTH3D, {axisV0Pt, axisEta, axisAntiLambdaM}); - registry.add("inclusive/InvMassAntiLambdaTrue", "Invariant mass of AntiLambda", HistType::kTH3D, {axisV0Pt, axisV0Radius, axisAntiLambdaM}); - registry.add("inclusive/AntiLambdaPtEtaMassWrongCollision", "AntiLambda Pt, Eta, Mass (Wrong Collision)", HistType::kTH3D, {axisV0Pt, axisEta, axisAntiLambdaM}); - - registry.add("jets/JetPtEtaK0SPt", "Jet Pt, Eta, K0S Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); - registry.add("jets/JetPtEtaK0SZ", "Jet Pt, Eta, K0S Z", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); - registry.add("jets/JetPtEtaK0SPtWrongCollision", "Jet Pt, Eta, K0S Pt (Wrong Collision)", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); - registry.add("jets/JetPtEtaK0SZWrongCollision", "Jet Pt, Eta, K0S Z (Wrong Collision)", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); - registry.add("jets/JetPtEtaLambdaPt", "Jet Pt, Eta, Lambda Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); - registry.add("jets/JetPtEtaLambdaZ", "Jet Pt, Eta, Lambda Z", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); - registry.add("jets/JetPtEtaLambdaPtWrongCollision", "Jet Pt, Eta, Lambda Pt (Wrong Collision)", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); - registry.add("jets/JetPtEtaLambdaZWrongCollision", "Jet Pt, Eta, Lambda Z (Wrong Collision)", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); - registry.add("jets/JetPtEtaAntiLambdaPt", "Jet Pt, Eta, AntiLambda Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); - registry.add("jets/JetPtEtaAntiLambdaZ", "Jet Pt, Eta, AntiLambda Z", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); - registry.add("jets/JetPtEtaAntiLambdaPtWrongCollision", "Jet Pt, Eta, AntiLambda Pt (Wrong Collision)", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); - registry.add("jets/JetPtEtaAntiLambdaZWrongCollision", "Jet Pt, Eta, AntiLambda Z (Wrong Collision)", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); - - registry.add("jets/JetsPtEtaK0SPt", "Matched Jet Pt, Eta, K0S Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}); - registry.add("jets/JetsPtEtaK0SZ", "Matched Jet Pt, Eta, K0S Z", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Z}); - registry.add("jets/JetsPtEtaK0SPtWrongCollision", "Matched Jet Pt, Eta, K0S Pt (Wrong Collision)", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}); - registry.add("jets/JetsPtEtaK0SZWrongCollision", "Matched Jet Pt, Eta, K0S Z (Wrong Collision)", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Z}); - registry.add("jets/JetsPtEtaLambdaPt", "Matched Jet Pt, Eta, Lambda Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}); - registry.add("jets/JetsPtEtaLambdaZ", "Matched Jet Pt, Eta, Lambda Z", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Z}); - registry.add("jets/JetsPtEtaLambdaPtWrongCollision", "Matched Jet Pt, Eta, Lambda Pt (Wrong Collision)", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}); - registry.add("jets/JetsPtEtaLambdaZWrongCollision", "Matched Jet Pt, Eta, Lambda Z (Wrong Collision)", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Z}); - registry.add("jets/JetsPtEtaAntiLambdaPt", "Matched Jet Pt, Eta, AntiLambda Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}); - registry.add("jets/JetsPtEtaAntiLambdaZ", "Matched Jet Pt, Eta, AntiLambda Z", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Z}); - registry.add("jets/JetsPtEtaAntiLambdaPtWrongCollision", "Matched Jet Pt, Eta, AntiLambda Pt (Wrong Collision)", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}); - registry.add("jets/JetsPtEtaAntiLambdaZWrongCollision", "Matched Jet Pt, Eta, AntiLambda Z (Wrong Collision)", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Z}); + registry.add("inclusive/hEvents", "Events", {HistType::kTH1D, {{3, 0.0f, 3.0f}}}, doSumw2); + + registry.add("inclusive/K0SPtEtaMass", "K0S Pt, Eta, Mass", HistType::kTH3D, {axisV0Pt, axisEta, axisK0SM}, doSumw2); + registry.add("inclusive/InvMassK0STrue", "Invariant mass of K0S", HistType::kTH3D, {axisV0Pt, axisV0Radius, axisK0SM}, doSumw2); + registry.add("inclusive/K0SPtEtaMassWrongCollision", "K0S Pt, Eta, Mass (Wrong Collision)", HistType::kTH3D, {axisV0Pt, axisEta, axisK0SM}, doSumw2); + registry.add("inclusive/LambdaPtEtaMass", "Lambda Pt, Eta, Mass", HistType::kTH3D, {axisV0Pt, axisEta, axisLambdaM}, doSumw2); + registry.add("inclusive/InvMassLambdaTrue", "Invariant mass of Lambda", HistType::kTH3D, {axisV0Pt, axisV0Radius, axisLambdaM}, doSumw2); + registry.add("inclusive/LambdaPtEtaMassWrongCollision", "Lambda Pt, Eta, Mass (Wrong Collision)", HistType::kTH3D, {axisV0Pt, axisEta, axisLambdaM}, doSumw2); + registry.add("inclusive/AntiLambdaPtEtaMass", "AntiLambda Pt, Eta, Mass", HistType::kTH3D, {axisV0Pt, axisEta, axisAntiLambdaM}, doSumw2); + registry.add("inclusive/InvMassAntiLambdaTrue", "Invariant mass of AntiLambda", HistType::kTH3D, {axisV0Pt, axisV0Radius, axisAntiLambdaM}, doSumw2); + registry.add("inclusive/AntiLambdaPtEtaMassWrongCollision", "AntiLambda Pt, Eta, Mass (Wrong Collision)", HistType::kTH3D, {axisV0Pt, axisEta, axisAntiLambdaM}, doSumw2); + + registry.add("jets/JetPtEtaPhi", "Jet Pt, Eta, Phi", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}, doSumw2); + registry.add("jets/JetPtEtaK0SPt", "Jet Pt, Eta, K0S Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}, doSumw2); + registry.add("jets/JetPtEtaK0SZ", "Jet Pt, Eta, K0S Z", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}, doSumw2); + registry.add("jets/JetPtEtaK0SPtWrongCollision", "Jet Pt, Eta, K0S Pt (Wrong Collision)", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}, doSumw2); + registry.add("jets/JetPtEtaK0SZWrongCollision", "Jet Pt, Eta, K0S Z (Wrong Collision)", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}, doSumw2); + registry.add("jets/JetPtEtaLambdaPt", "Jet Pt, Eta, Lambda Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}, doSumw2); + registry.add("jets/JetPtEtaLambdaZ", "Jet Pt, Eta, Lambda Z", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}, doSumw2); + registry.add("jets/JetPtEtaLambdaPtWrongCollision", "Jet Pt, Eta, Lambda Pt (Wrong Collision)", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}, doSumw2); + registry.add("jets/JetPtEtaLambdaZWrongCollision", "Jet Pt, Eta, Lambda Z (Wrong Collision)", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}, doSumw2); + registry.add("jets/JetPtEtaAntiLambdaPt", "Jet Pt, Eta, AntiLambda Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}, doSumw2); + registry.add("jets/JetPtEtaAntiLambdaZ", "Jet Pt, Eta, AntiLambda Z", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}, doSumw2); + registry.add("jets/JetPtEtaAntiLambdaPtWrongCollision", "Jet Pt, Eta, AntiLambda Pt (Wrong Collision)", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}, doSumw2); + registry.add("jets/JetPtEtaAntiLambdaZWrongCollision", "Jet Pt, Eta, AntiLambda Z (Wrong Collision)", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}, doSumw2); + + registry.add("jets/JetsPtEta", "Matched Jet Pt, Eta", HistType::kTH3D, {axisJetPt, axisJetPt, axisEta}, doSumw2); + registry.add("jets/JetsPtEtaK0SPt", "Matched Jet Pt, Eta, K0S Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}, doSumw2); + registry.add("jets/JetsPtEtaK0SZ", "Matched Jet Pt, Eta, K0S Z", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Z}, doSumw2); + registry.add("jets/JetsPtEtaK0SPtWrongCollision", "Matched Jet Pt, Eta, K0S Pt (Wrong Collision)", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}, doSumw2); + registry.add("jets/JetsPtEtaK0SZWrongCollision", "Matched Jet Pt, Eta, K0S Z (Wrong Collision)", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Z}, doSumw2); + registry.add("jets/JetsPtEtaLambdaPt", "Matched Jet Pt, Eta, Lambda Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}, doSumw2); + registry.add("jets/JetsPtEtaLambdaZ", "Matched Jet Pt, Eta, Lambda Z", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Z}, doSumw2); + registry.add("jets/JetsPtEtaLambdaPtWrongCollision", "Matched Jet Pt, Eta, Lambda Pt (Wrong Collision)", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}, doSumw2); + registry.add("jets/JetsPtEtaLambdaZWrongCollision", "Matched Jet Pt, Eta, Lambda Z (Wrong Collision)", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Z}, doSumw2); + registry.add("jets/JetsPtEtaAntiLambdaPt", "Matched Jet Pt, Eta, AntiLambda Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}, doSumw2); + registry.add("jets/JetsPtEtaAntiLambdaZ", "Matched Jet Pt, Eta, AntiLambda Z", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Z}, doSumw2); + registry.add("jets/JetsPtEtaAntiLambdaPtWrongCollision", "Matched Jet Pt, Eta, AntiLambda Pt (Wrong Collision)", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}, doSumw2); + registry.add("jets/JetsPtEtaAntiLambdaZWrongCollision", "Matched Jet Pt, Eta, AntiLambda Z (Wrong Collision)", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Z}, doSumw2); } if (doprocessMcP) { - registry.add("inclusive/hMcEvents", "MC Events", {HistType::kTH1D, {{2, 0.0f, 2.0f}}}); - registry.add("inclusive/GeneratedK0S", "Generated K0S", HistType::kTH3D, {axisV0Pt, axisEta, axisV0Radius}); - registry.add("inclusive/GeneratedLambda", "Generated Lambda", HistType::kTH3D, {axisV0Pt, axisEta, axisV0Radius}); - registry.add("inclusive/GeneratedAntiLambda", "Generated AntiLambda", HistType::kTH3D, {axisV0Pt, axisEta, axisV0Radius}); - - registry.add("jets/GeneratedJetK0S", "Generated Jet K0S", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); - registry.add("jets/GeneratedJetK0SFrag", "Generated Jet K0S", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); - registry.add("jets/GeneratedJetLambda", "Generated Jet Lambda", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); - registry.add("jets/GeneratedJetLambdaFrag", "Generated Jet Lambda", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); - registry.add("jets/GeneratedJetAntiLambda", "Generated Jet AntiLambda", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); - registry.add("jets/GeneratedJetAntiLambdaFrag", "Generated Jet AntiLambda", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); - } - if (doprocessMcDJets) { - registry.add("jets/hJetEvents", "Jet Events", {HistType::kTH1D, {{2, 0.0f, 2.0f}}}); - registry.add("jets/JetPtEtaK0SPt", "Jet Pt, Eta, K0S Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); - registry.add("jets/InvMassJetK0STrue", "Invariant mass of K0S in jets", HistType::kTH3D, {axisJetPt, axisV0Pt, axisK0SM}); - registry.add("jets/JetPtEtaLambdaPt", "Jet Pt, Eta, Lambda Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); - registry.add("jets/InvMassJetLambdaTrue", "Invariant mass of Lambda in jets", HistType::kTH3D, {axisJetPt, axisV0Pt, axisLambdaM}); - registry.add("jets/JetPtEtaAntiLambdaPt", "Jet Pt, Eta, AntiLambda Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); - registry.add("jets/InvMassJetAntiLambdaTrue", "Invariant mass of AntiLambda in jets", HistType::kTH3D, {axisJetPt, axisV0Pt, axisAntiLambdaM}); - } - if (doprocessMcDMatchedJets) { - registry.add("jets/hMatchedJetEvents", "Matched Jet Events", {HistType::kTH1D, {{2, 0.0f, 2.0f}}}); - registry.add("jets/JetsPtEtaK0SPt", "Matched Jet Pt, Eta, K0S Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}); - registry.add("jets/InvMassJetsK0STrue", "Invariant mass of K0S in matched jets", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisV0Pt, axisK0SM}); - registry.add("jets/JetsPtEtaLambdaPt", "Matched Jet Pt, Eta, Lambda Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}); - registry.add("jets/InvMassJetsLambdaTrue", "Invariant mass of Lambda in matched jets", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisV0Pt, axisLambdaM}); - registry.add("jets/JetsPtEtaAntiLambdaPt", "Matched Jet Pt, Eta, AntiLambda Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}); - registry.add("jets/InvMassJetsAntiLambdaTrue", "Invariant mass of AntiLambda in matched jets", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisV0Pt, axisAntiLambdaM}); - } - if (doprocessMcPJets) { - registry.add("jets/hMcJetEvents", "MC Jet Events", {HistType::kTH1D, {{2, 0.0f, 2.0f}}}); - registry.add("jets/GeneratedJetK0S", "Generated Jet K0S", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); - registry.add("jets/GeneratedJetK0SFrag", "Generated Jet K0S", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); - registry.add("jets/GeneratedJetLambda", "Generated Jet Lambda", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); - registry.add("jets/GeneratedJetLambdaFrag", "Generated Jet Lambda", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); - registry.add("jets/GeneratedJetAntiLambda", "Generated Jet AntiLambda", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); - registry.add("jets/GeneratedJetAntiLambdaFrag", "Generated Jet AntiLambda", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); + registry.add("inclusive/hMcEvents", "MC Events", {HistType::kTH1D, {{3, 0.0f, 3.0f}}}, doSumw2); + registry.add("inclusive/GeneratedK0S", "Generated K0S", HistType::kTH3D, {axisV0Pt, axisEta, axisV0Radius}, doSumw2); + registry.add("inclusive/GeneratedLambda", "Generated Lambda", HistType::kTH3D, {axisV0Pt, axisEta, axisV0Radius}, doSumw2); + registry.add("inclusive/GeneratedAntiLambda", "Generated AntiLambda", HistType::kTH3D, {axisV0Pt, axisEta, axisV0Radius}, doSumw2); + + registry.add("jets/GeneratedJets", "Generated Jets", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}, doSumw2); + registry.add("jets/GeneratedJetK0S", "Generated Jet K0S", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}, doSumw2); + registry.add("jets/GeneratedJetK0SFrag", "Generated Jet K0S", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}, doSumw2); + registry.add("jets/GeneratedJetLambda", "Generated Jet Lambda", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}, doSumw2); + registry.add("jets/GeneratedJetLambdaFrag", "Generated Jet Lambda", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}, doSumw2); + registry.add("jets/GeneratedJetAntiLambda", "Generated Jet AntiLambda", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}, doSumw2); + registry.add("jets/GeneratedJetAntiLambdaFrag", "Generated Jet AntiLambda", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}, doSumw2); } if (doprocessCollisionAssociation) { registry.add("collisions/V0PtEta", "V0 Pt, Eta", HistType::kTH2D, {axisV0Pt, axisEta}); @@ -275,6 +253,7 @@ struct V0QA { registry.add("feeddown/JetsPtXiPlusPtAntiLambdaPt", "Jets Pt, #Xi^{+} Pt, #bar{#Lambda} Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisV0Pt, axisV0Pt}); } if (doprocessTestWeightedJetFinder) { + registry.add("tests/weighted/hEvents", "Events", {HistType::kTH1D, {{2, 0.0f, 2.0f}}}); registry.add("tests/weighted/JetPtEtaPhi", "Jet Pt, Eta, Phi", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); registry.add("tests/weighted/JetPtEtaV0Pt", "Jet Pt, Eta, V0 Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); registry.add("tests/weighted/JetPtEtaV0Z", "Jet Pt, Eta, V0 Z", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); @@ -286,6 +265,7 @@ struct V0QA { registry.add("tests/weighted/JetPtEtaAntiLambdaZ", "Jet Pt, Eta, AntiLambda Z", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); } if (doprocessTestSubtractedJetFinder) { + registry.add("tests/hEvents", "Events", {HistType::kTH1D, {{2, 0.0f, 2.0f}}}); registry.add("tests/nosub/JetPtEtaPhi", "Jet Pt, Eta, Phi", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); registry.add("tests/nosub/JetPtEtaV0Pt", "Jet Pt, Eta, V0 Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); registry.add("tests/nosub/JetPtEtaV0Z", "Jet Pt, Eta, V0 Z", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); @@ -531,6 +511,14 @@ struct V0QA { } } + template + void fillMcDJets(U const& mcdjet, double weight) + { + registry.fill(HIST("jets/JetPtEtaPhi"), mcdjet.pt(), mcdjet.eta(), mcdjet.phi(), weight); + for (const auto& mcpjet : mcdjet.template matchedJetGeo_as()) { + registry.fill(HIST("jets/JetsPtEta"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), weight); + } + } template void fillMcDV0InJets(T const& mcdjet, U const& v0, bool correctCollision, double weight) { @@ -589,6 +577,47 @@ struct V0QA { } } + template + void fillMcPV0(T const& pv0, double weight) + { + // Can calculate this from aod::CandidatesV0MCD (contains decay vertex) + double rDecay = 1.0; + + if (pv0.pdgCode() == PDG_t::kK0Short) { + registry.fill(HIST("inclusive/GeneratedK0S"), pv0.pt(), pv0.eta(), rDecay, weight); + } + if (pv0.pdgCode() == PDG_t::kLambda0) { + registry.fill(HIST("inclusive/GeneratedLambda"), pv0.pt(), pv0.eta(), rDecay, weight); + } + if (pv0.pdgCode() == PDG_t::kLambda0Bar) { + registry.fill(HIST("inclusive/GeneratedAntiLambda"), pv0.pt(), pv0.eta(), rDecay, weight); + } + } + + template + void fillMcPJets(T const& jet, double weight) + { + registry.fill(HIST("jets/GeneratedJets"), jet.pt(), jet.eta(), jet.phi(), weight); + } + + template + void fillMcPV0InJets(T const& jet, U const& pv0, double weight) + { + double z = pv0.pt() / jet.pt(); + if (pv0.pdgCode() == PDG_t::kK0Short) { + registry.fill(HIST("jets/GeneratedJetK0S"), jet.pt(), jet.eta(), pv0.pt(), weight); + registry.fill(HIST("jets/GeneratedJetK0SFrag"), jet.pt(), jet.eta(), z, weight); + } + if (pv0.pdgCode() == PDG_t::kLambda0) { + registry.fill(HIST("jets/GeneratedJetLambda"), jet.pt(), jet.eta(), pv0.pt(), weight); + registry.fill(HIST("jets/GeneratedJetLambdaFrag"), jet.pt(), jet.eta(), z, weight); + } + if (pv0.pdgCode() == PDG_t::kLambda0Bar) { + registry.fill(HIST("jets/GeneratedJetAntiLambda"), jet.pt(), jet.eta(), pv0.pt(), weight); + registry.fill(HIST("jets/GeneratedJetAntiLambdaFrag"), jet.pt(), jet.eta(), z, weight); + } + } + template void fillTrackQa(V const& v0) { @@ -855,6 +884,7 @@ struct V0QA { registry.fill(HIST("inclusive/hEvents"), 1.5); auto mcColl = jcoll.template mcCollision_as(); double weight = mcColl.weight(); + registry.fill(HIST("inclusive/hEvents"), 2.5, weight); for (const auto& v0 : v0s) { if (!v0.has_mcParticle() || v0.isRejectedCandidate()) @@ -865,6 +895,7 @@ struct V0QA { } // v0 loop for (const auto& mcdjet : mcdjets) { + fillMcDJets(mcdjet, weight); for (const auto& v0 : mcdjet.template candidates_as()) { if (!v0.has_mcParticle() || v0.isRejectedCandidate()) continue; @@ -905,6 +936,7 @@ struct V0QA { registry.fill(HIST("inclusive/hMcEvents"), 1.5); double weight = mccoll.weight(); + registry.fill(HIST("inclusive/hMcEvents"), 2.5, weight); for (const auto& pv0 : pv0s) { if (!pv0.has_daughters() || !pv0.isPhysicalPrimary()) @@ -912,181 +944,25 @@ struct V0QA { if (std::abs(pv0.y()) > yPartMax) continue; - // Can calculate this from aod::CandidatesV0MCD (contains decay vertex) - double rDecay = 1.0; - - if (pv0.pdgCode() == PDG_t::kK0Short) { - registry.fill(HIST("inclusive/GeneratedK0S"), pv0.pt(), pv0.eta(), rDecay, weight); - } - if (pv0.pdgCode() == PDG_t::kLambda0) { - registry.fill(HIST("inclusive/GeneratedLambda"), pv0.pt(), pv0.eta(), rDecay, weight); - } - if (pv0.pdgCode() == PDG_t::kLambda0Bar) { - registry.fill(HIST("inclusive/GeneratedAntiLambda"), pv0.pt(), pv0.eta(), rDecay, weight); - } + fillMcPV0(pv0, weight); } for (const auto& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, -99., -99., -1. * yPartMax, yPartMax)) continue; + fillMcPJets(jet, weight); + for (const auto& pv0 : jet.template candidates_as()) { if (!pv0.has_daughters() || !pv0.isPhysicalPrimary()) continue; - double z = pv0.pt() / jet.pt(); - - if (pv0.pdgCode() == PDG_t::kK0Short) { - registry.fill(HIST("jets/GeneratedJetK0S"), jet.pt(), jet.eta(), pv0.pt(), weight); - registry.fill(HIST("jets/GeneratedJetK0SFrag"), jet.pt(), jet.eta(), z, weight); - } - if (pv0.pdgCode() == PDG_t::kLambda0) { - registry.fill(HIST("jets/GeneratedJetLambda"), jet.pt(), jet.eta(), pv0.pt(), weight); - registry.fill(HIST("jets/GeneratedJetLambdaFrag"), jet.pt(), jet.eta(), z, weight); - } - if (pv0.pdgCode() == PDG_t::kLambda0Bar) { - registry.fill(HIST("jets/GeneratedJetAntiLambda"), jet.pt(), jet.eta(), pv0.pt(), weight); - registry.fill(HIST("jets/GeneratedJetAntiLambdaFrag"), jet.pt(), jet.eta(), z, weight); - } + fillMcPV0InJets(jet, pv0, weight); } } } PROCESS_SWITCH(V0QA, processMcP, "Particle level V0s", false); - void processMcDJets(soa::Filtered::iterator const& jcoll, aod::JetMcCollisions const&, MCDV0JetsWithConstituents const& mcdjets, CandidatesV0MCDWithFlags const&, aod::McParticles const&) - { - registry.fill(HIST("jets/hJetEvents"), 0.5); - if (!isCollisionReconstructed(jcoll, eventSelectionBits)) - return; - - registry.fill(HIST("jets/hJetEvents"), 1.5); - double weight = jcoll.mcCollision().weight(); - - for (const auto& mcdjet : mcdjets) { - // if (!jetfindingutilities::isInEtaAcceptance(jet, -99., -99., v0EtaMin, v0EtaMax)) - for (const auto& v0 : mcdjet.template candidates_as()) { - if (!v0.has_mcParticle()) - continue; - - int pdg = v0.mcParticle().pdgCode(); - - // Check V0 decay kinematics - if (v0.isRejectedCandidate()) - continue; - - // K0S - if (std::abs(pdg) == PDG_t::kK0Short) { - registry.fill(HIST("jets/JetPtEtaK0SPt"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); - registry.fill(HIST("jets/InvMassJetK0STrue"), mcdjet.pt(), v0.pt(), v0.mK0Short(), weight); - } - // Lambda - if (pdg == PDG_t::kLambda0) { - registry.fill(HIST("jets/JetPtEtaLambdaPt"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); - registry.fill(HIST("jets/InvMassJetLambdaTrue"), mcdjet.pt(), v0.pt(), v0.mLambda(), weight); - } - if (pdg == PDG_t::kLambda0Bar) { - registry.fill(HIST("jets/JetPtEtaAntiLambdaPt"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); - registry.fill(HIST("jets/InvMassJetAntiLambdaTrue"), mcdjet.pt(), v0.pt(), v0.mAntiLambda(), weight); - } - } - } - } - PROCESS_SWITCH(V0QA, processMcDJets, "Reconstructed true V0s in jets", false); - - void processMcDMatchedJets(soa::Filtered::iterator const& jcoll, aod::JetMcCollisions const&, MatchedMCDV0JetsWithConstituents const& mcdjets, MatchedMCPV0JetsWithConstituents const&, CandidatesV0MCDWithFlags const&, aod::CandidatesV0MCP const&, aod::JetTracksMCD const& jTracks, aod::McParticles const&) - { - registry.fill(HIST("jets/hMatchedJetEvents"), 0.5); - if (!isCollisionReconstructed(jcoll, eventSelectionBits)) - return; - - registry.fill(HIST("jets/hMatchedJetEvents"), 1.5); - double weight = jcoll.mcCollision().weight(); - - for (const auto& mcdjet : mcdjets) { - // if (!jetfindingutilities::isInEtaAcceptance(mcdjet, -99., -99., v0EtaMin, v0EtaMax)) - for (const auto& mcpjet : mcdjet.template matchedJetGeo_as()) { - for (const auto& v0 : mcdjet.template candidates_as()) { - if (!v0.has_mcParticle()) - continue; - - for (const auto& pv0 : mcpjet.template candidates_as()) { - if (!v0sAreMatched(v0, pv0, jTracks)) - continue; - int pdg = pv0.pdgCode(); - - // Check V0 decay kinematics - if (v0.isRejectedCandidate()) - continue; - - // K0S - if (std::abs(pdg) == PDG_t::kK0Short) { - registry.fill(HIST("jets/JetsPtEtaK0SPt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); - registry.fill(HIST("jets/InvMassJetsK0STrue"), mcpjet.pt(), mcdjet.pt(), v0.pt(), v0.mK0Short(), weight); - } - // Lambda - if (pdg == PDG_t::kLambda0) { - registry.fill(HIST("jets/JetsPtEtaLambdaPt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); - registry.fill(HIST("jets/InvMassJetsLambdaTrue"), mcpjet.pt(), mcdjet.pt(), v0.pt(), v0.mLambda(), weight); - } - if (pdg == PDG_t::kLambda0Bar) { - registry.fill(HIST("jets/JetsPtEtaAntiLambdaPt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); - registry.fill(HIST("jets/InvMassJetsAntiLambdaTrue"), mcpjet.pt(), mcdjet.pt(), v0.pt(), v0.mAntiLambda(), weight); - } - } - } - } - } - } - PROCESS_SWITCH(V0QA, processMcDMatchedJets, "Reconstructed true V0s in jets", false); - - void processMcPJets(aod::JetMcCollision const& mccoll, soa::SmallGroups const& collisions, MCPV0JetsWithConstituents const& jets, aod::CandidatesV0MCP const&) - { - registry.fill(HIST("jets/hMcJetEvents"), 0.5); - bool isReconstructed = false; - - for (const auto& collision : collisions) { - if (!isCollisionReconstructed(collision, eventSelectionBits)) - continue; - - if (collision.mcCollision().globalIndex() != mccoll.globalIndex()) - continue; - - isReconstructed = true; - break; - } - if (!isReconstructed) - return; - - registry.fill(HIST("jets/hMcJetEvents"), 1.5); - double weight = mccoll.weight(); - - for (const auto& jet : jets) { - if (!jetfindingutilities::isInEtaAcceptance(jet, -99., -99., -1. * yPartMax, yPartMax)) - continue; - - for (const auto& pv0 : jet.template candidates_as()) { - if (!pv0.has_daughters()) - continue; - if (!pv0.isPhysicalPrimary()) - continue; - - if (pv0.pdgCode() == PDG_t::kK0Short) { - registry.fill(HIST("jets/GeneratedJetK0S"), jet.pt(), jet.eta(), pv0.pt(), weight); - registry.fill(HIST("jets/GeneratedJetK0SFrag"), jet.pt(), jet.eta(), pv0.pt() / jet.pt(), weight); - } - if (pv0.pdgCode() == PDG_t::kLambda0) { - registry.fill(HIST("jets/GeneratedJetLambda"), jet.pt(), jet.eta(), pv0.pt(), weight); - registry.fill(HIST("jets/GeneratedJetLambdaFrag"), jet.pt(), jet.eta(), pv0.pt() / jet.pt(), weight); - } - if (pv0.pdgCode() == PDG_t::kLambda0Bar) { - registry.fill(HIST("jets/GeneratedJetAntiLambda"), jet.pt(), jet.eta(), pv0.pt(), weight); - registry.fill(HIST("jets/GeneratedJetAntiLambdaFrag"), jet.pt(), jet.eta(), pv0.pt() / jet.pt(), weight); - } - } - } - } - PROCESS_SWITCH(V0QA, processMcPJets, "Particle level V0s in jets", false); - void processCollisionAssociation(soa::Filtered::iterator const& jcoll, CandidatesV0MCDWithFlags const& v0s, JetMcCollisionsWithPIs const&, aod::McCollisions const&, aod::McParticles const&) { // Based on PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx @@ -1428,9 +1304,12 @@ struct V0QA { // Test the difference between excluding V0s from jet finding and subtracting V0s from jets afterwards void processTestWeightedJetFinder(soa::Filtered::iterator const& jcoll, soa::Join const& jets, aod::CandidatesV0Data const&) { + registry.fill(HIST("tests/weighted/hEvents"), 0.5); if (!jetderiveddatautilities::selectCollision(jcoll, eventSelectionBits)) return; + registry.fill(HIST("tests/weighted/hEvents"), 1.5); + for (const auto& jet : jets) { registry.fill(HIST("tests/weighted/JetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi()); @@ -1462,9 +1341,12 @@ struct V0QA { void processTestSubtractedJetFinder(soa::Filtered::iterator const& jcoll, soa::Join const& jets, aod::CandidatesV0Data const&) { + registry.fill(HIST("tests/hEvents"), 0.5); if (!jetderiveddatautilities::selectCollision(jcoll, eventSelectionBits)) return; + registry.fill(HIST("tests/hEvents"), 1.5); + for (const auto& jet : jets) { registry.fill(HIST("tests/nosub/JetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi()); From b87008d541475faf08a04a34e8f69b8c4a4bf4ed Mon Sep 17 00:00:00 2001 From: Chiara De Martin <39315597+ChiaraDeMartin95@users.noreply.github.com> Date: Tue, 19 Aug 2025 17:37:11 +0200 Subject: [PATCH 105/986] [PWGLF] Add flag to analyse pp collisions (change in centrality definition) (#12632) Co-authored-by: Chiara De Martin Co-authored-by: ALICE Action Bot --- PWGLF/TableProducer/Strangeness/lambdaspincorrelation.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PWGLF/TableProducer/Strangeness/lambdaspincorrelation.cxx b/PWGLF/TableProducer/Strangeness/lambdaspincorrelation.cxx index 3878bf4e29a..8d48b8d991b 100644 --- a/PWGLF/TableProducer/Strangeness/lambdaspincorrelation.cxx +++ b/PWGLF/TableProducer/Strangeness/lambdaspincorrelation.cxx @@ -78,6 +78,7 @@ struct lambdaspincorrelation { ConfigurableAxis axisMultiplicityClass{"axisMultiplicityClass", {8, 0, 80}, "multiplicity percentile for bin"}; // events + Configurable cfgEventTypepp{"cfgEventTypepp", false, "Type of collisions"}; Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; Configurable cfgCutCentralityMax{"cfgCutCentralityMax", 80.0f, "Accepted maximum Centrality"}; Configurable cfgCutCentralityMin{"cfgCutCentralityMin", 0.0f, "Accepted minimum Centrality"}; @@ -242,7 +243,7 @@ struct lambdaspincorrelation { Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; Filter centralityFilter = (nabs(aod::cent::centFT0C) < cfgCutCentralityMax && nabs(aod::cent::centFT0C) > cfgCutCentralityMin); - using EventCandidates = soa::Filtered>; + using EventCandidates = soa::Filtered>; using AllTrackCandidates = soa::Join; using ResoV0s = aod::V0Datas; @@ -261,6 +262,8 @@ struct lambdaspincorrelation { int numbV0 = 0; // LOGF(info, "event collisions: (%d)", collision.index()); auto centrality = collision.centFT0C(); + if (cfgEventTypepp) + centrality = collision.centFT0M(); auto vz = collision.posZ(); int occupancy = collision.trackOccupancyInTimeRange(); histos.fill(HIST("hEvtSelInfo"), 0.5); @@ -359,6 +362,8 @@ struct lambdaspincorrelation { int numbV0 = 0; // LOGF(info, "event collisions: (%d)", collision.index()); auto centrality = collision.centFT0C(); + if (cfgEventTypepp) + centrality = collision.centFT0M(); auto vz = collision.posZ(); int occupancy = collision.trackOccupancyInTimeRange(); histos.fill(HIST("hEvtSelInfo"), 0.5); From 9295aa4ab7e81c8fa57bb093a90b8b7ac5d31252 Mon Sep 17 00:00:00 2001 From: Bong-Hwi Lim Date: Wed, 20 Aug 2025 01:17:23 +0900 Subject: [PATCH 106/986] [PWGCF] jFlucEfficiencyTask - Modify structure and add systematic study histograms (#12610) Co-authored-by: ALICE Action Bot --- PWGCF/JCorran/Tasks/jFlucEfficiencyTask.cxx | 546 +++++++++++++------- 1 file changed, 366 insertions(+), 180 deletions(-) diff --git a/PWGCF/JCorran/Tasks/jFlucEfficiencyTask.cxx b/PWGCF/JCorran/Tasks/jFlucEfficiencyTask.cxx index 4ca33837d1e..213e7ff7ae4 100644 --- a/PWGCF/JCorran/Tasks/jFlucEfficiencyTask.cxx +++ b/PWGCF/JCorran/Tasks/jFlucEfficiencyTask.cxx @@ -14,25 +14,33 @@ /// \author DongJo Kim, Jasper Parkkila, Bong-Hwi Lim (djkim@cern.ch, jparkkil@cern.ch, bong-hwi.lim@cern.ch) /// \since March 2024 -#include -#include -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" -#include "Framework/O2DatabasePDGPlugin.h" +#include "PWGCF/DataModel/CorrelationsDerived.h" +#include "PWGLF/Utils/collisionCuts.h" + #include "Common/Core/TrackSelection.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "PWGCF/DataModel/CorrelationsDerived.h" -#include "PWGLF/Utils/collisionCuts.h" + +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/runDataProcessing.h" + +#include + +#include +#include using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace o2::soa; using namespace o2::aod::rctsel; +using namespace o2::constants::physics; struct JFlucEfficiencyTask { Service pdg; @@ -105,6 +113,8 @@ struct JFlucEfficiencyTask { // DCA to PV Configurable cfgMaxbDCArToPVcut{"cfgMaxbDCArToPVcut", 0.5, "Track DCAr cut to PV Maximum"}; Configurable cfgMaxbDCAzToPVcut{"cfgMaxbDCAzToPVcut", 1.0, "Track DCAz cut to PV Maximum"}; + // PID + Configurable cfgPIDnSigmaCut{"cfgPIDnSigmaCut", 3.0, "PID nSigma cut"}; } TrackCuts; Configurable applyMCStudy{"applyMCStudy", false, "Apply MC study"}; @@ -130,10 +140,12 @@ struct JFlucEfficiencyTask { Configurable cfgCentBinsForMC{"cfgCentBinsForMC", 1, "Centrality bins for MC, 0: off, 1: on"}; using CollisionCandidates = soa::Join; using CollisionRun2Candidates = soa::Join; - using TrackCandidates = soa::Join; + using TrackCandidates = soa::Join; + using TrackCandidatesPID = soa::Join; using MCCollisionCandidates = soa::Join; using MCRun2CollisionCandidates = soa::Join; using MCTrackCandidates = soa::Join; + using MCTrackCandidatesPID = soa::Join; using BCsWithRun2Info = soa::Join; // Histogram Registry @@ -172,58 +184,71 @@ struct JFlucEfficiencyTask { rctChecker.init(EventCuts.cfgEvtRCTFlagCheckerLabel, EventCuts.cfgEvtRCTFlagCheckerZDCCheck, EventCuts.cfgEvtRCTFlagCheckerLimitAcceptAsBad); - if (doprocessDerivedMC || doprocessMC || doprocessMCRun2) { - registry.add("hPtGen", "Generated p_{T} (all);p_{T} (GeV/c);Centrality (%);Counts", - o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); + // Helper function to add histograms with consistent naming + auto addHistograms = [this](const std::string& prefix, bool isMC = false) { + if (isMC) { + // Generated (MC) histograms - pT has all variations + registry.add(Form("hPtGen%s", prefix.c_str()), + Form("Generated p_{T} %s;p_{T} (GeV/c);Centrality (%%);Counts", prefix.c_str()), + {HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}}); + } + + // Reconstructed histograms - pT has all variations + registry.add(Form("hPtRec%s", prefix.c_str()), + Form("Reconstructed p_{T} %s;p_{T} (GeV/c);Centrality (%%);Counts", prefix.c_str()), + {HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}}); + }; + + // Add MC histograms if MC processing is enabled + if (doprocessDerivedMC || doprocessMC || doprocessMCRun2 || doprocessMCPID) { + addHistograms("", true); // hPtGen, hPtRec + addHistograms("Pos", true); // hPtGenPos, hPtRecPos + addHistograms("Neg", true); // hPtGenNeg, hPtRecNeg + addHistograms("_Pos", true); // hPtGen_Pos, hPtRec_Pos + addHistograms("_Neg", true); // hPtGen_Neg, hPtRec_Neg + addHistograms("Pos_Pos", true); // hPtGenPos_Pos, hPtRecPos_Pos + addHistograms("Pos_Neg", true); // hPtGenPos_Neg, hPtRecPos_Neg + addHistograms("Neg_Pos", true); // hPtGenNeg_Pos, hPtRecNeg_Pos + addHistograms("Neg_Neg", true); // hPtGenNeg_Neg, hPtRecNeg_Neg + } else { + // Add reconstructed histograms + addHistograms(""); // hPtRec + addHistograms("_Pos"); // hPtRec_Pos + addHistograms("_Neg"); // hPtRec_Neg + addHistograms("Pos"); // hPtRecPos + addHistograms("Neg"); // hPtRecNeg + addHistograms("Pos_Pos"); // hPtRecPos_Pos + addHistograms("Pos_Neg"); // hPtRecPos_Neg + addHistograms("Neg_Pos"); // hPtRecNeg_Pos + addHistograms("Neg_Neg"); // hPtRecNeg_Neg + } + // Add basic eta histograms separately + if (doprocessDerivedMC || doprocessMC || doprocessMCRun2 || doprocessMCPID) { registry.add("hEtaGen", "Generated #eta (all);#eta;Centrality (%);Counts", - o2::framework::HistType::kTH2F, {AxisSpec(100, -1, 1), AxisSpec(axisMultiplicity)}); - registry.add("hPtGenPos", "Generated p_{T} (positive);p_{T} (GeV/c);Centrality (%);Counts", - o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); - registry.add("hPtGenPos_Pos", "Generated p_{T} (positive) in TPC positive side;p_{T} (GeV/c);Centrality (%);Counts", - o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); - registry.add("hPtGenPos_Neg", "Generated p_{T} (positive) in TPC negative side;p_{T} (GeV/c);Centrality (%);Counts", - o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); - registry.add("hPtGenNeg", "Generated p_{T} (negative);p_{T} (GeV/c);Centrality (%);Counts", - o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); - registry.add("hPtGenNeg_Pos", "Generated p_{T} (negative) in TPC positive side;p_{T} (GeV/c);Centrality (%);Counts", - o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); - registry.add("hPtGenNeg_Neg", "Generated p_{T} (negative) in TPC negative side;p_{T} (GeV/c);Centrality (%);Counts", - o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); - } - registry.add("hPtRec", "Reconstructed p_{T} (all);p_{T} (GeV/c);Centrality (%);Counts", - o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); - registry.add("hEtaRec", "Reconstructed #eta (all);#eta;Centrality (%);Counts", - o2::framework::HistType::kTH2F, {AxisSpec(100, -1, 1), AxisSpec(axisMultiplicity)}); - registry.add("hPtRecPos", "Reconstructed p_{T} (positive);p_{T} (GeV/c);Centrality (%);Counts", - o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); - registry.add("hPtRecPos_Pos", "Reconstructed p_{T} (positive) in TPC positive side;p_{T} (GeV/c);Centrality (%);Counts", - o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); - registry.add("hPtRecPos_Neg", "Reconstructed p_{T} (positive) in TPC negative side;p_{T} (GeV/c);Centrality (%);Counts", - o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); - registry.add("hPtRecNeg", "Reconstructed p_{T} (negative);p_{T} (GeV/c);Centrality (%);Counts", - o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); - registry.add("hPtRecNeg_Pos", "Reconstructed p_{T} (negative) in TPC positive side;p_{T} (GeV/c);Centrality (%);Counts", - o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); - registry.add("hPtRecNeg_Neg", "Reconstructed p_{T} (negative) in TPC negative side;p_{T} (GeV/c);Centrality (%);Counts", - o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); - if (applyMCStudy) { - registry.add("hChargeSignMismatch", "Charge-Sign mismatch cases", {HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}}); - registry.add("hChargeSignMismatchPos", "MC charge + but track sign -", {HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}}); - registry.add("hChargeSignMismatchNeg", "MC charge - but track sign +", {HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}}); - registry.add("hChargeSignMatch", "Charge-Sign match cases", {HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}}); - registry.add("hChargeSignMatchPos", "MC charge + and track sign +", {HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}}); - registry.add("hChargeSignMatchNeg", "MC charge - and track sign -", {HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}}); - registry.add("hChargeSignRatio", "Ratio of mismatch to total", {HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}}); - - // pT resolution - registry.add("hPtResolution", "p_{T} resolution;p_{T} (GeV/c);Centrality (%);Counts", - o2::framework::HistType::kTH3F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity), AxisSpec(60, -3, 3)}); - registry.add("hPtResolutionPos", "p_{T} resolution (positive);p_{T} (GeV/c);Centrality (%);Counts", - o2::framework::HistType::kTH3F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity), AxisSpec(60, -3, 3)}); - registry.add("hPtResolutionNeg", "p_{T} resolution (negative);p_{T} (GeV/c);Centrality (%);Counts", - o2::framework::HistType::kTH3F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity), AxisSpec(60, -3, 3)}); + {HistType::kTH2F, {AxisSpec(100, -1, 1), AxisSpec(axisMultiplicity)}}); } - + registry.add("hEtaRec", "Reconstructed #eta (all);#eta;Centrality (%);Counts", + {HistType::kTH2F, {AxisSpec(100, -1, 1), AxisSpec(axisMultiplicity)}}); + + // Add pT uncertainty histograms + registry.add("hPtUncertainty", "Track p_{T} uncertainty;p_{T} (GeV/c);Centrality (%);p_{T} uncertainty (GeV/c)", + {HistType::kTH3F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity), AxisSpec(100, 0, 10)}}); + registry.add("hPtUncertaintyPos", "Track p_{T} uncertainty (positive);p_{T} (GeV/c);Centrality (%);p_{T} uncertainty (GeV/c)", + {HistType::kTH3F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity), AxisSpec(100, 0, 10)}}); + registry.add("hPtUncertaintyNeg", "Track p_{T} uncertainty (negative);p_{T} (GeV/c);Centrality (%);p_{T} uncertainty (GeV/c)", + {HistType::kTH3F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity), AxisSpec(100, 0, 10)}}); + + // Add MC study histograms if enabled + if (applyMCStudy && (doprocessDerivedMC || doprocessMC || doprocessMCRun2 || doprocessMCPID)) { + registry.add("hChargeSignMismatch", "Charge-Sign mismatch cases", {HistType::kTH2D, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}}); + registry.add("hChargeSignMismatchPos", "MC charge + but track sign -", {HistType::kTH2D, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}}); + registry.add("hChargeSignMismatchNeg", "MC charge - but track sign +", {HistType::kTH2D, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}}); + registry.add("hChargeSignMatch", "Charge-Sign match cases", {HistType::kTH2D, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}}); + registry.add("hChargeSignMatchPos", "MC charge + and track sign +", {HistType::kTH2D, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}}); + registry.add("hChargeSignMatchNeg", "MC charge - and track sign -", {HistType::kTH2D, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}}); + } + + // Add efficiency histograms if enabled if (doprocessEfficiency) { registry.add("hPtGenData", "Generated p_{T} from data events (all);p_{T} (GeV/c);Centrality (%);Counts", {HistType::kTH2F, {axisPt, axisMultiplicity}}); @@ -234,16 +259,16 @@ struct JFlucEfficiencyTask { registry.add("hPtGenDataNeg", "Generated p_{T} from data events (negative);p_{T} (GeV/c);Centrality (%);Counts", {HistType::kTH2F, {axisPt, axisMultiplicity}}); registry.add("hPtRecData", "Reconstructed p_{T} (all);p_{T} (GeV/c);Centrality (%);Counts", - o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); + {HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}}); registry.add("hEtaRecData", "Reconstructed #eta (all);#eta;Centrality (%);Counts", - o2::framework::HistType::kTH2F, {AxisSpec(100, -1, 1), AxisSpec(axisMultiplicity)}); + {HistType::kTH2F, {AxisSpec(100, -1, 1), AxisSpec(axisMultiplicity)}}); registry.add("hPtRecDataPos", "Reconstructed p_{T} (positive);p_{T} (GeV/c);Centrality (%);Counts", - o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); + {HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}}); registry.add("hPtRecDataNeg", "Reconstructed p_{T} (negative);p_{T} (GeV/c);Centrality (%);Counts", - o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); + {HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}}); } - // Initialize histogram labels + // Histogram labels auto h1 = registry.get(HIST("hEventCounterMC")); auto h2 = registry.get(HIST("hEventCounterReco")); @@ -376,6 +401,123 @@ struct JFlucEfficiencyTask { } Preslice perCollision = aod::track::collisionId; + // Common histogram filling function for tracks + template + void fillTrackHistograms(const TrackType& track, float centrality) + { + // Basic pT and eta histograms + registry.fill(HIST("hPtRec"), track.pt(), centrality); + registry.fill(HIST("hEtaRec"), track.eta(), centrality); + + // pT histograms by eta direction + if (track.eta() > 0) { + registry.fill(HIST("hPtRec_Pos"), track.pt(), centrality); + } else if (track.eta() < 0) { + registry.fill(HIST("hPtRec_Neg"), track.pt(), centrality); + } + + // Charge sign specific histograms + if (track.sign() > 0) { // Positive tracks + registry.fill(HIST("hPtRecPos"), track.pt(), centrality); + if (track.eta() > 0) { + registry.fill(HIST("hPtRecPos_Pos"), track.pt(), centrality); + } else if (track.eta() < 0) { + registry.fill(HIST("hPtRecPos_Neg"), track.pt(), centrality); + } + } else if (track.sign() < 0) { // Negative tracks + registry.fill(HIST("hPtRecNeg"), track.pt(), centrality); + if (track.eta() > 0) { + registry.fill(HIST("hPtRecNeg_Pos"), track.pt(), centrality); + } else if (track.eta() < 0) { + registry.fill(HIST("hPtRecNeg_Neg"), track.pt(), centrality); + } + } + + // pT uncertainty histograms + auto ptUncertaintySigma = track.c1Pt21Pt2() * track.pt() * track.pt(); // Variance of pT + auto ptUncertainty = std::sqrt(ptUncertaintySigma); // Standard deviation of pT + registry.fill(HIST("hPtUncertainty"), track.pt(), centrality, ptUncertainty); + + if (track.sign() > 0) { + registry.fill(HIST("hPtUncertaintyPos"), track.pt(), centrality, ptUncertainty); + } else if (track.sign() < 0) { + registry.fill(HIST("hPtUncertaintyNeg"), track.pt(), centrality, ptUncertainty); + } + } + + // Common histogram filling function for MC particles + template + void fillMCParticleHistograms(const ParticleType& particle, float centrality) + { + registry.fill(HIST("hPtGen"), particle.pt(), centrality); + registry.fill(HIST("hEtaGen"), particle.eta(), centrality); + + // pT histograms by eta direction + if (particle.eta() > 0) { + registry.fill(HIST("hPtGen_Pos"), particle.pt(), centrality); + } else if (particle.eta() < 0) { + registry.fill(HIST("hPtGen_Neg"), particle.pt(), centrality); + } + + // Charge sign specific histograms + auto charge = getCharge(particle); + if (charge > 0) { // Positive particles + registry.fill(HIST("hPtGenPos"), particle.pt(), centrality); + if (particle.eta() > 0) { + registry.fill(HIST("hPtGenPos_Pos"), particle.pt(), centrality); + } else if (particle.eta() < 0) { + registry.fill(HIST("hPtGenPos_Neg"), particle.pt(), centrality); + } + } else if (charge < 0) { // Negative particles + registry.fill(HIST("hPtGenNeg"), particle.pt(), centrality); + if (particle.eta() > 0) { + registry.fill(HIST("hPtGenNeg_Pos"), particle.pt(), centrality); + } else if (particle.eta() < 0) { + registry.fill(HIST("hPtGenNeg_Neg"), particle.pt(), centrality); + } + } + } + + // Common event selection function + template + bool selectEvent(const CollisionType& collision, float& centrality) + { + if (!colCuts.isSelected(collision)) { + return false; + } + + if (EventCuts.cfgEvtUseRCTFlagChecker && !rctChecker(collision)) { + return false; + } + + colCuts.fillQA(collision); + centrality = collision.centFT0C(); + + if (centrality < EventCuts.cfgCentMin || centrality > EventCuts.cfgCentMax) { + return false; + } + + return true; + } + + // Common event selection function for Run2 data + template + bool selectEventRun2(const CollisionType& collision, float& centrality) + { + if (!colCuts.isSelected(collision)) { + return false; + } + + colCuts.fillQARun2(collision); + centrality = collision.centRun2V0M(); + + if (centrality < EventCuts.cfgCentMin || centrality > EventCuts.cfgCentMax) { + return false; + } + + return true; + } + void processMC(aod::McCollisions::iterator const& mcCollision, soa::SmallGroups const& collisions, soa::Filtered const& mcTracks, @@ -391,8 +533,9 @@ struct JFlucEfficiencyTask { if (cfgAcceptSplitCollisions == 0 && collisions.size() > 1) { return; } + float centrality = -999; - for (const auto& collision : collisions) { // Anayway only 1 collision per mcCollision will be selected + for (const auto& collision : collisions) { // Anyway only 1 collision per mcCollision will be selected if (!colCuts.isSelected(collision)) // Default event selection return; if (EventCuts.cfgEvtUseRCTFlagChecker && !rctChecker(collision)) { @@ -401,47 +544,32 @@ struct JFlucEfficiencyTask { colCuts.fillQA(collision); centrality = collision.centFT0C(); } + registry.fill(HIST("hEventCounterMC"), 1); registry.fill(HIST("hZVertexMC"), mcCollision.posZ(), centrality); + if (centrality < EventCuts.cfgCentMin || centrality > EventCuts.cfgCentMax) { return; } + + // Fill MC particle histograms for (const auto& particle : mcParticles) { - auto charge = getCharge(particle); if ((!particle.isPhysicalPrimary()) || !isChargedParticle(particle.pdgCode())) { continue; } // pT and eta selections - if (particle.pt() < TrackCuts.cfgMinPt || particle.pt() > TrackCuts.cfgMaxPt || particle.eta() < TrackCuts.cfgEtaMin || particle.eta() > TrackCuts.cfgEtaMax) { + if (particle.pt() < TrackCuts.cfgMinPt || particle.pt() > TrackCuts.cfgMaxPt || + particle.eta() < TrackCuts.cfgEtaMin || particle.eta() > TrackCuts.cfgEtaMax) { continue; } - registry.fill(HIST("hPtGen"), particle.pt(), centrality); - registry.fill(HIST("hEtaGen"), particle.eta(), centrality); - if (particle.eta() > 0) { - registry.fill(HIST("hPtGenPos_Pos"), particle.pt(), centrality); - } else if (particle.eta() < 0) { - registry.fill(HIST("hPtGenNeg_Neg"), particle.pt(), centrality); - } - if (charge > 0) { // Positive particles - registry.fill(HIST("hPtGenPos"), particle.pt(), centrality); - if (particle.eta() > 0) { - registry.fill(HIST("hPtGenPos_Pos"), particle.pt(), centrality); - } else if (particle.eta() < 0) { - registry.fill(HIST("hPtGenPos_Neg"), particle.pt(), centrality); - } - } else if (charge < 0) { // Negative particles - registry.fill(HIST("hPtGenNeg"), particle.pt(), centrality); - if (particle.eta() > 0) { - registry.fill(HIST("hPtGenNeg_Pos"), particle.pt(), centrality); - } else if (particle.eta() < 0) { - registry.fill(HIST("hPtGenNeg_Neg"), particle.pt(), centrality); - } - } + fillMCParticleHistograms(particle, centrality); } - // Reconstruct tracks from MC particles + + // Process reconstructed tracks for (const auto& collision : collisions) { registry.fill(HIST("hZVertexReco"), collision.posZ(), centrality); registry.fill(HIST("hZVertexCorrelation"), mcCollision.posZ(), collision.posZ()); + auto tracks = mcTracks.sliceBy(perCollision, collision.globalIndex()); for (const auto& track : tracks) { if (!track.has_mcParticle()) { @@ -454,6 +582,7 @@ struct JFlucEfficiencyTask { if (!mcPart.isPhysicalPrimary() || !isChargedParticle(mcPart.pdgCode())) { continue; } + if (applyMCStudy) { // Check charge-sign consistency auto mcCharge = getCharge(mcPart); @@ -476,35 +605,114 @@ struct JFlucEfficiencyTask { registry.fill(HIST("hChargeSignMismatchNeg"), track.pt(), centrality); registry.fill(HIST("hChargeSignMismatch"), track.pt(), centrality); } + } - // pT resolution - auto ptRec = track.pt(); - auto ptGen = mcPart.pt(); - auto ptResolution = (ptRec - ptGen); - registry.fill(HIST("hPtResolution"), ptRec, centrality, ptResolution); - if (track.sign() > 0) { - registry.fill(HIST("hPtResolutionPos"), ptRec, centrality, ptResolution); - } else if (track.sign() < 0) { - registry.fill(HIST("hPtResolutionNeg"), ptRec, centrality, ptResolution); - } + fillTrackHistograms(track, centrality); + } + } + } + + Preslice perCollisionPID = aod::track::collisionId; + void processMCPID(aod::McCollisions::iterator const& mcCollision, + soa::SmallGroups const& collisions, + soa::Filtered const& mcTracks, + aod::McParticles const& mcParticles) + { + registry.fill(HIST("hEventCounterMC"), 0); + if (!(std::abs(mcCollision.posZ()) < EventCuts.cfgEvtZvtx)) { + return; + } + if (collisions.size() < 1) { + return; + } + if (cfgAcceptSplitCollisions == 0 && collisions.size() > 1) { + return; + } + + float centrality = -999; + for (const auto& collision : collisions) { // Anyway only 1 collision per mcCollision will be selected + if (!colCuts.isSelected(collision)) // Default event selection + return; + if (EventCuts.cfgEvtUseRCTFlagChecker && !rctChecker(collision)) { + return; + } + colCuts.fillQA(collision); + centrality = collision.centFT0C(); + } + + registry.fill(HIST("hEventCounterMC"), 1); + registry.fill(HIST("hZVertexMC"), mcCollision.posZ(), centrality); + + if (centrality < EventCuts.cfgCentMin || centrality > EventCuts.cfgCentMax) { + return; + } + + // Fill MC particle histograms + for (const auto& particle : mcParticles) { + if (!isChargedParticle(particle.pdgCode())) { + continue; + } + // pT and eta selections + if (particle.pt() < TrackCuts.cfgMinPt || particle.pt() > TrackCuts.cfgMaxPt || + particle.eta() < TrackCuts.cfgEtaMin || particle.eta() > TrackCuts.cfgEtaMax) { + continue; + } + // Check if the particle is a pion + if (std::abs(particle.pdgCode()) != std::abs(kPiPlus)) { + continue; + } + fillMCParticleHistograms(particle, centrality); + } + + // Process reconstructed tracks + for (const auto& collision : collisions) { + registry.fill(HIST("hZVertexReco"), collision.posZ(), centrality); + registry.fill(HIST("hZVertexCorrelation"), mcCollision.posZ(), collision.posZ()); + + auto tracks = mcTracks.sliceBy(perCollisionPID, collision.globalIndex()); + for (const auto& track : tracks) { + if (!track.has_mcParticle()) { + continue; } - registry.fill(HIST("hPtRec"), track.pt(), centrality); - registry.fill(HIST("hEtaRec"), track.eta(), centrality); - if (track.sign() > 0) { // Positive tracks - registry.fill(HIST("hPtRecPos"), track.pt(), centrality); - if (track.eta() > 0) { - registry.fill(HIST("hPtRecPos_Pos"), track.pt(), centrality); - } else if (track.eta() < 0) { - registry.fill(HIST("hPtRecPos_Neg"), track.pt(), centrality); - } - } else if (track.sign() < 0) { // Negative tracks - registry.fill(HIST("hPtRecNeg"), track.pt(), centrality); - if (track.eta() > 0) { - registry.fill(HIST("hPtRecNeg_Pos"), track.pt(), centrality); - } else if (track.eta() < 0) { - registry.fill(HIST("hPtRecNeg_Neg"), track.pt(), centrality); + if (std::abs(track.tpcNSigmaPi()) > TrackCuts.cfgPIDnSigmaCut) { + continue; + } + if (!trackCut(track)) { + continue; + } + auto mcPart = track.mcParticle(); + if (!isChargedParticle(mcPart.pdgCode())) { + continue; + } + if (std::abs(mcPart.pdgCode()) != kPiPlus) { + continue; + } + + if (applyMCStudy) { + // Check charge-sign consistency + auto mcCharge = getCharge(mcPart); + auto trackSign = track.sign(); + + if (mcCharge > 0 && trackSign > 0) { + // MC charge + and track sign + + registry.fill(HIST("hChargeSignMatchPos"), track.pt(), centrality); + registry.fill(HIST("hChargeSignMatch"), track.pt(), centrality); + } else if (mcCharge < 0 && trackSign < 0) { + // MC charge - and track sign - + registry.fill(HIST("hChargeSignMatchNeg"), track.pt(), centrality); + registry.fill(HIST("hChargeSignMatch"), track.pt(), centrality); + } else if (mcCharge > 0 && trackSign < 0) { + // MC charge + but track sign - + registry.fill(HIST("hChargeSignMismatchPos"), track.pt(), centrality); + registry.fill(HIST("hChargeSignMismatch"), track.pt(), centrality); + } else if (mcCharge < 0 && trackSign > 0) { + // MC charge - but track sign + + registry.fill(HIST("hChargeSignMismatchNeg"), track.pt(), centrality); + registry.fill(HIST("hChargeSignMismatch"), track.pt(), centrality); } } + + fillTrackHistograms(track, centrality); } } } @@ -525,39 +733,40 @@ struct JFlucEfficiencyTask { if (cfgAcceptSplitCollisions == 0 && collisions.size() > 1) { return; } + float centrality = -999; - for (const auto& collision : collisions) { // Anayway only 1 collision per mcCollision will be selected + for (const auto& collision : collisions) { // Anyway only 1 collision per mcCollision will be selected if (!colCuts.isSelected(collision)) // Default event selection return; colCuts.fillQARun2(collision); centrality = collision.centRun2V0M(); } + registry.fill(HIST("hEventCounterMC"), 1); registry.fill(HIST("hZVertexMC"), mcCollision.posZ(), centrality); + if (centrality < EventCuts.cfgCentMin || centrality > EventCuts.cfgCentMax) { return; } + + // Fill MC particle histograms for (const auto& particle : mcParticles) { - auto charge = getCharge(particle); if ((!particle.isPhysicalPrimary()) || !isChargedParticle(particle.pdgCode())) { continue; } // pT and eta selections - if (particle.pt() < TrackCuts.cfgMinPt || particle.pt() > TrackCuts.cfgMaxPt || particle.eta() < TrackCuts.cfgEtaMin || particle.eta() > TrackCuts.cfgEtaMax) { + if (particle.pt() < TrackCuts.cfgMinPt || particle.pt() > TrackCuts.cfgMaxPt || + particle.eta() < TrackCuts.cfgEtaMin || particle.eta() > TrackCuts.cfgEtaMax) { continue; } - registry.fill(HIST("hPtGen"), particle.pt(), centrality); - registry.fill(HIST("hEtaGen"), particle.eta(), centrality); - if (charge > 0) { // Positive particles - registry.fill(HIST("hPtGenPos"), particle.pt(), centrality); - } else if (charge < 0) { // Negative particles - registry.fill(HIST("hPtGenNeg"), particle.pt(), centrality); - } + fillMCParticleHistograms(particle, centrality); } - // Reconstruct tracks from MC particles + + // Process reconstructed tracks for (const auto& collision : collisions) { registry.fill(HIST("hZVertexReco"), collision.posZ(), centrality); registry.fill(HIST("hZVertexCorrelation"), mcCollision.posZ(), collision.posZ()); + auto tracks = mcTracks.sliceBy(perCollision, collision.globalIndex()); for (const auto& track : tracks) { if (!track.has_mcParticle()) { @@ -567,91 +776,66 @@ struct JFlucEfficiencyTask { if (!mcPart.isPhysicalPrimary() || !isChargedParticle(mcPart.pdgCode())) { continue; } - // pT and eta selections if (!trackCut(track)) { continue; } - registry.fill(HIST("hPtRec"), track.pt(), centrality); - registry.fill(HIST("hEtaRec"), track.eta(), centrality); - if (track.sign() > 0) { // Positive tracks - registry.fill(HIST("hPtRecPos"), track.pt(), centrality); - } else if (track.sign() < 0) { // Negative tracks - registry.fill(HIST("hPtRecNeg"), track.pt(), centrality); - if (track.eta() > 0) { - registry.fill(HIST("hPtRecNeg_Pos"), track.pt(), centrality); - } else if (track.eta() < 0) { - registry.fill(HIST("hPtRecNeg_Neg"), track.pt(), centrality); - } - } + + fillTrackHistograms(track, centrality); } } } void processData(CollisionCandidates::iterator const& collision, soa::Filtered const& tracks) { - if (!colCuts.isSelected(collision)) // Default event selection - return; - if (EventCuts.cfgEvtUseRCTFlagChecker && !rctChecker(collision)) { + float centrality; + if (!selectEvent(collision, centrality)) { return; } - colCuts.fillQA(collision); - auto centrality = collision.centFT0C(); - if (centrality < EventCuts.cfgCentMin || centrality > EventCuts.cfgCentMax) { + + registry.fill(HIST("hZVertexReco"), collision.posZ(), centrality); + + for (const auto& track : tracks) { + if (!trackCut(track)) { + continue; + } + fillTrackHistograms(track, centrality); + } + } + + void processDataPID(CollisionCandidates::iterator const& collision, soa::Filtered const& tracks) + { + float centrality; + if (!selectEvent(collision, centrality)) { return; } + registry.fill(HIST("hZVertexReco"), collision.posZ(), centrality); + for (const auto& track : tracks) { - // pT and eta selections if (!trackCut(track)) { continue; } - registry.fill(HIST("hPtRec"), track.pt(), centrality); - registry.fill(HIST("hEtaRec"), track.eta(), centrality); - if (track.sign() > 0) { // Positive tracks - registry.fill(HIST("hPtRecPos"), track.pt(), centrality); - if (track.eta() > 0) { - registry.fill(HIST("hPtRecPos_Pos"), track.pt(), centrality); - } else if (track.eta() < 0) { - registry.fill(HIST("hPtRecPos_Neg"), track.pt(), centrality); - } - } else if (track.sign() < 0) { // Negative tracks - registry.fill(HIST("hPtRecNeg"), track.pt(), centrality); - if (track.eta() > 0) { - registry.fill(HIST("hPtRecPos_Pos"), track.pt(), centrality); - } else if (track.eta() < 0) { - registry.fill(HIST("hPtRecPos_Neg"), track.pt(), centrality); - } + if (std::abs(track.tpcNSigmaPi()) > TrackCuts.cfgPIDnSigmaCut) { + continue; } + fillTrackHistograms(track, centrality); } } void processDataRun2(CollisionRun2Candidates::iterator const& collision, soa::Filtered const& tracks, BCsWithRun2Info const&) { - if (!colCuts.isSelected(collision)) // Default event selection - return; - colCuts.fillQARun2(collision); - auto centrality = collision.centRun2V0M(); - if (centrality < EventCuts.cfgCentMin || centrality > EventCuts.cfgCentMax) { + float centrality; + if (!selectEventRun2(collision, centrality)) { return; } + registry.fill(HIST("hZVertexReco"), collision.posZ(), centrality); + for (const auto& track : tracks) { - // pT and eta selections if (!trackCut(track)) { continue; } - registry.fill(HIST("hPtRec"), track.pt(), centrality); - registry.fill(HIST("hEtaRec"), track.eta(), centrality); - if (track.sign() > 0) { // Positive tracks - registry.fill(HIST("hPtRecPos"), track.pt(), centrality); - } else if (track.sign() < 0) { // Negative tracks - registry.fill(HIST("hPtRecNeg"), track.pt(), centrality); - if (track.eta() > 0) { - registry.fill(HIST("hPtRecNeg_Pos"), track.pt(), centrality); - } else if (track.eta() < 0) { - registry.fill(HIST("hPtRecNeg_Neg"), track.pt(), centrality); - } - } + fillTrackHistograms(track, centrality); } } @@ -760,8 +944,10 @@ struct JFlucEfficiencyTask { } PROCESS_SWITCH(JFlucEfficiencyTask, processMC, "Process MC only", false); + PROCESS_SWITCH(JFlucEfficiencyTask, processMCPID, "Process MC with PID only", false); PROCESS_SWITCH(JFlucEfficiencyTask, processMCRun2, "Process Run2 MC only", false); PROCESS_SWITCH(JFlucEfficiencyTask, processData, "Process data only", false); + PROCESS_SWITCH(JFlucEfficiencyTask, processDataPID, "Process data with PID only", false); PROCESS_SWITCH(JFlucEfficiencyTask, processDataRun2, "Process Run2 data only", false); PROCESS_SWITCH(JFlucEfficiencyTask, processDerivedMC, "Process derived MC only", false); PROCESS_SWITCH(JFlucEfficiencyTask, processDerivedData, "Process derived data only", false); From 9eda1e2ce373fd24fae7906a6f7c30d29e9e141c Mon Sep 17 00:00:00 2001 From: Preet-Bhanjan Date: Tue, 19 Aug 2025 18:37:26 +0200 Subject: [PATCH 107/986] [PWGCF] Rectification in PID track selection (#12633) Co-authored-by: Preet Pati Co-authored-by: ALICE Action Bot --- .../Tasks/pidDiHadron.cxx | 57 ++++++++++--------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/pidDiHadron.cxx b/PWGCF/TwoParticleCorrelations/Tasks/pidDiHadron.cxx index b5190b2927c..ac08c333121 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/pidDiHadron.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/pidDiHadron.cxx @@ -193,19 +193,19 @@ struct PidDiHadron { // Event Counter if (doprocessSame && cfgUseAdditionalEventCut) { - registry.add("hEventCountSpecific", "Number of Event;; Count", {HistType::kTH1D, {{12, 0, 12}}}); - registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(1, "after sel8"); - registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(2, "kNoSameBunchPileup"); - registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(3, "kNoITSROFrameBorder"); - registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(4, "kNoTimeFrameBorder"); - registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(5, "kIsGoodZvtxFT0vsPV"); - registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(6, "kNoCollInTimeRangeStandard"); - registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(7, "kIsGoodITSLayersAll"); - registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(8, "kNoCollInRofStandard"); - registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(9, "kNoHighMultCollInPrevRof"); - registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(10, "occupancy"); - registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(11, "MultCorrelation"); - registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(12, "cfgEvSelV0AT0ACut"); + registry.add("hEventCount", "Number of Event;; Count", {HistType::kTH1D, {{12, 0, 12}}}); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(1, "after sel8"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(2, "kNoSameBunchPileup"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(3, "kNoITSROFrameBorder"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(4, "kNoTimeFrameBorder"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(5, "kIsGoodZvtxFT0vsPV"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(6, "kNoCollInTimeRangeStandard"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(7, "kIsGoodITSLayersAll"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(8, "kNoCollInRofStandard"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(9, "kNoHighMultCollInPrevRof"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(10, "occupancy"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(11, "MultCorrelation"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(12, "cfgEvSelV0AT0ACut"); } if (cfgUseAdditionalEventCut) { @@ -311,9 +311,6 @@ struct PidDiHadron { template bool trackSelected(TTrack track) { - if (cfgPIDParticle && getNsigmaPID(track) != cfgPIDParticle) { - return false; - } return ((track.tpcNClsFound() >= cfgCutTPCclu) && (track.tpcNClsCrossedRows() >= cfgCutTPCCrossedRows) && (track.itsNCls() >= cfgCutITSclu)); } @@ -363,6 +360,8 @@ struct PidDiHadron { for (auto const& track1 : tracks) { if (!trackSelected(track1)) continue; + if (cfgPIDParticle && getNsigmaPID(track1) != cfgPIDParticle) + continue; // if PID is selected, check if the track has the right PID if (!getEfficiencyCorrection(weff1, track1.eta(), track1.pt(), vtxz)) continue; registry.fill(HIST("Phi"), RecoDecay::constrainAngle(track1.phi(), 0.0)); @@ -426,6 +425,8 @@ struct PidDiHadron { if (!trackSelected(track1)) continue; + if (cfgPIDParticle && getNsigmaPID(track1) != cfgPIDParticle) + continue; // if PID is selected, check if the track has the right PID if (!getEfficiencyCorrection(triggerWeight, track1.eta(), track1.pt(), posZ)) continue; if (system == SameEvent) { @@ -489,61 +490,61 @@ struct PidDiHadron { template bool eventSelected(TCollision collision, const int multTrk, const float centrality, const bool fillCounter) { - registry.fill(HIST("hEventCountSpecific"), 0.5); + registry.fill(HIST("hEventCount"), 0.5); if (cfgEvSelkNoSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { // rejects collisions which are associated with the same "found-by-T0" bunch crossing // https://indico.cern.ch/event/1396220/#1-event-selection-with-its-rof return 0; } if (fillCounter && cfgEvSelkNoSameBunchPileup) - registry.fill(HIST("hEventCountSpecific"), 1.5); + registry.fill(HIST("hEventCount"), 1.5); if (cfgEvSelkNoITSROFrameBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { return 0; } if (fillCounter && cfgEvSelkNoITSROFrameBorder) - registry.fill(HIST("hEventCountSpecific"), 2.5); + registry.fill(HIST("hEventCount"), 2.5); if (cfgEvSelkNoTimeFrameBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { return 0; } if (fillCounter && cfgEvSelkNoTimeFrameBorder) - registry.fill(HIST("hEventCountSpecific"), 3.5); + registry.fill(HIST("hEventCount"), 3.5); if (cfgEvSelkIsGoodZvtxFT0vsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { // removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference // use this cut at low multiplicities with caution return 0; } if (fillCounter && cfgEvSelkIsGoodZvtxFT0vsPV) - registry.fill(HIST("hEventCountSpecific"), 4.5); + registry.fill(HIST("hEventCount"), 4.5); if (cfgEvSelkNoCollInTimeRangeStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { // no collisions in specified time range return 0; } if (fillCounter && cfgEvSelkNoCollInTimeRangeStandard) - registry.fill(HIST("hEventCountSpecific"), 5.5); + registry.fill(HIST("hEventCount"), 5.5); if (cfgEvSelkIsGoodITSLayersAll && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { // from Jan 9 2025 AOT meeting // cut time intervals with dead ITS staves return 0; } if (fillCounter && cfgEvSelkIsGoodITSLayersAll) - registry.fill(HIST("hEventCountSpecific"), 6.5); + registry.fill(HIST("hEventCount"), 6.5); if (cfgEvSelkNoCollInRofStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { // no other collisions in this Readout Frame with per-collision multiplicity above threshold return 0; } if (fillCounter && cfgEvSelkNoCollInRofStandard) - registry.fill(HIST("hEventCountSpecific"), 7.5); + registry.fill(HIST("hEventCount"), 7.5); if (cfgEvSelkNoHighMultCollInPrevRof && !collision.selection_bit(o2::aod::evsel::kNoHighMultCollInPrevRof)) { // veto an event if FT0C amplitude in previous ITS ROF is above threshold return 0; } if (fillCounter && cfgEvSelkNoHighMultCollInPrevRof) - registry.fill(HIST("hEventCountSpecific"), 8.5); + registry.fill(HIST("hEventCount"), 8.5); auto occupancy = collision.trackOccupancyInTimeRange(); if (cfgEvSelOccupancy && (occupancy < cfgCutOccupancyLow || occupancy > cfgCutOccupancyHigh)) return 0; if (fillCounter && cfgEvSelOccupancy) - registry.fill(HIST("hEventCountSpecific"), 9.5); + registry.fill(HIST("hEventCount"), 9.5); auto multNTracksPV = collision.multNTracksPV(); if (cfgEvSelMultCorrelation) { @@ -557,14 +558,14 @@ struct PidDiHadron { return 0; } if (fillCounter && cfgEvSelMultCorrelation) - registry.fill(HIST("hEventCountSpecific"), 10.5); + registry.fill(HIST("hEventCount"), 10.5); // V0A T0A 5 sigma cut float sigma = 5.0; if (cfgEvSelV0AT0ACut && (std::fabs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > sigma * fT0AV0ASigma->Eval(collision.multFT0A()))) return 0; if (fillCounter && cfgEvSelV0AT0ACut) - registry.fill(HIST("hEventCountSpecific"), 11.5); + registry.fill(HIST("hEventCount"), 11.5); return 1; } From 573b13eb04756886d0c8fbf50cf06ad7b3dd2254 Mon Sep 17 00:00:00 2001 From: Jseo <47848181+JinjooSeo@users.noreply.github.com> Date: Tue, 19 Aug 2025 19:36:18 +0200 Subject: [PATCH 108/986] [PWGDQ] Add DielectronsAll table (#12462) --- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index 6351a49157f..95243956b78 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -1251,6 +1251,7 @@ struct AnalysisSameEventPairing { Produces dimuonList; Produces dielectronsExtraList; Produces dielectronInfoList; + Produces dielectronAllList; Produces dimuonsExtraList; Produces dimuonAllList; Produces dileptonMiniTreeGen; @@ -1715,6 +1716,7 @@ struct AnalysisSameEventPairing { dielectronInfoList.reserve(1); dileptonInfoList.reserve(1); if (fConfigOptions.flatTables.value) { + dielectronAllList.reserve(1); dimuonAllList.reserve(1); } if (useMiniTree.fConfigMiniTree) { @@ -1802,6 +1804,18 @@ struct AnalysisSameEventPairing { } if constexpr (trackHasCov && TTwoProngFitter) { dielectronsExtraList(t1.globalIndex(), t2.globalIndex(), VarManager::fgValues[VarManager::kVertexingTauzProjected], VarManager::fgValues[VarManager::kVertexingLzProjected], VarManager::fgValues[VarManager::kVertexingLxyProjected]); + if constexpr ((TTrackFillMap & VarManager::ObjTypes::ReducedTrackCollInfo) > 0) { + if (fConfigOptions.flatTables.value && t1.has_reducedMCTrack() && t2.has_reducedMCTrack()) { + dielectronAllList(VarManager::fgValues[VarManager::kMass], VarManager::fgValues[VarManager::kPt], VarManager::fgValues[VarManager::kEta], VarManager::fgValues[VarManager::kPhi], t1.sign() + t2.sign(), twoTrackFilter, mcDecision, + t1.pt(), t1.eta(), t1.phi(), t1.itsClusterMap(), t1.itsChi2NCl(), t1.tpcNClsCrossedRows(), t1.tpcNClsFound(), t1.tpcChi2NCl(), t1.dcaXY(), t1.dcaZ(), t1.tpcSignal(), t1.tpcNSigmaEl(), t1.tpcNSigmaPi(), t1.tpcNSigmaPr(), t1.beta(), t1.tofNSigmaEl(), t1.tofNSigmaPi(), t1.tofNSigmaPr(), + t2.pt(), t2.eta(), t2.phi(), t2.itsClusterMap(), t2.itsChi2NCl(), t2.tpcNClsCrossedRows(), t2.tpcNClsFound(), t2.tpcChi2NCl(), t2.dcaXY(), t2.dcaZ(), t2.tpcSignal(), t2.tpcNSigmaEl(), t2.tpcNSigmaPi(), t2.tpcNSigmaPr(), t2.beta(), t2.tofNSigmaEl(), t2.tofNSigmaPi(), t2.tofNSigmaPr(), + VarManager::fgValues[VarManager::kKFTrack0DCAxyz], VarManager::fgValues[VarManager::kKFTrack1DCAxyz], VarManager::fgValues[VarManager::kKFDCAxyzBetweenProngs], VarManager::fgValues[VarManager::kKFTrack0DCAxy], VarManager::fgValues[VarManager::kKFTrack1DCAxy], VarManager::fgValues[VarManager::kKFDCAxyBetweenProngs], + VarManager::fgValues[VarManager::kKFTrack0DeviationFromPV], VarManager::fgValues[VarManager::kKFTrack1DeviationFromPV], VarManager::fgValues[VarManager::kKFTrack0DeviationxyFromPV], VarManager::fgValues[VarManager::kKFTrack1DeviationxyFromPV], + VarManager::fgValues[VarManager::kKFMass], VarManager::fgValues[VarManager::kKFChi2OverNDFGeo], VarManager::fgValues[VarManager::kVertexingLxyz], VarManager::fgValues[VarManager::kVertexingLxyzOverErr], VarManager::fgValues[VarManager::kVertexingLxy], VarManager::fgValues[VarManager::kVertexingLxyOverErr], VarManager::fgValues[VarManager::kVertexingTauxy], VarManager::fgValues[VarManager::kVertexingTauxyErr], VarManager::fgValues[VarManager::kKFCosPA], VarManager::fgValues[VarManager::kKFJpsiDCAxyz], VarManager::fgValues[VarManager::kKFJpsiDCAxy], + VarManager::fgValues[VarManager::kKFPairDeviationFromPV], VarManager::fgValues[VarManager::kKFPairDeviationxyFromPV], + VarManager::fgValues[VarManager::kKFMassGeoTop], VarManager::fgValues[VarManager::kKFChi2OverNDFGeoTop]); + } + } } } } From 208256b240f32e6a4a8e4283bc5296e720f73736 Mon Sep 17 00:00:00 2001 From: kpradhan-kshitish <149397157+kpradhan-kshitish@users.noreply.github.com> Date: Tue, 19 Aug 2025 23:07:29 +0530 Subject: [PATCH 109/986] [PWGDQ] Extended the masss range of mctruth_pair histograms to 15.0 GeV/c^2. (#12560) --- PWGDQ/Core/HistogramsLibrary.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGDQ/Core/HistogramsLibrary.cxx b/PWGDQ/Core/HistogramsLibrary.cxx index 65d07c909e1..dd875822000 100644 --- a/PWGDQ/Core/HistogramsLibrary.cxx +++ b/PWGDQ/Core/HistogramsLibrary.cxx @@ -915,12 +915,12 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "Rapidity", "", false, 400, -4.0, 4.0, VarManager::kRap); } if (!groupStr.CompareTo("mctruth_pair")) { - hm->AddHistogram(histClass, "Mass_Pt", "", false, 500, 0.0, 5.0, VarManager::kMass, 40, 0.0, 20.0, VarManager::kPt); + hm->AddHistogram(histClass, "Mass_Pt", "", false, 500, 0.0, 15.0, VarManager::kMass, 40, 0.0, 20.0, VarManager::kPt); hm->AddHistogram(histClass, "Pt", "", false, 200, 0.0, 20.0, VarManager::kPt); hm->AddHistogram(histClass, "Pt_Dilepton", "", false, 200, 0.0, 20.0, VarManager::kPairPtDau); hm->AddHistogram(histClass, "Eta_Pt_lepton1", "", false, 100, -2.0, 2.0, VarManager::kEta1, 200, 0.0, 20.0, VarManager::kPt1); hm->AddHistogram(histClass, "Eta_Pt_lepton2", "", false, 100, -2.0, 2.0, VarManager::kEta2, 200, 0.0, 20.0, VarManager::kPt2); - hm->AddHistogram(histClass, "Mass", "", false, 500, 0.0, 5.0, VarManager::kMass); + hm->AddHistogram(histClass, "Mass", "", false, 500, 0.0, 15.0, VarManager::kMass); hm->AddHistogram(histClass, "Eta_Pt", "", false, 40, -2.0, 2.0, VarManager::kEta, 200, 0.0, 20.0, VarManager::kPt); hm->AddHistogram(histClass, "Phi_Eta", "#phi vs #eta distribution", false, 200, -5.0, 5.0, VarManager::kEta, 200, -2. * o2::constants::math::PI, 2. * o2::constants::math::PI, VarManager::kPhi); int varspTHE[3] = {VarManager::kMCPt, VarManager::kMCCosThetaHE, VarManager::kMCPhiHE}; From 012b1af35f194e4eb83ad840382c8dd59f237e2e Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Tue, 19 Aug 2025 23:32:43 +0200 Subject: [PATCH 110/986] [PWGLF] Change TOF selection cut (#12639) --- PWGLF/Tasks/Resonances/phispectrapbpbqa.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGLF/Tasks/Resonances/phispectrapbpbqa.cxx b/PWGLF/Tasks/Resonances/phispectrapbpbqa.cxx index 276db4b4c5f..4ea692e246e 100644 --- a/PWGLF/Tasks/Resonances/phispectrapbpbqa.cxx +++ b/PWGLF/Tasks/Resonances/phispectrapbpbqa.cxx @@ -318,7 +318,7 @@ struct phispectrapbpbqa { } if (track1.p() < 0.6) { histos.fill(HIST("hNsigmaTPC"), nSigmaTPC, track1.p(), occupancy, centrality); - } else if (track1.p() > 0.6 && track1.hasTOF() && std::abs(nSigmaTOF) < 4.0) { + } else if (track1.p() > 0.6 && track1.hasTOF() && std::abs(nSigmaTOF) < 2.5) { histos.fill(HIST("hNsigmaTPC"), nSigmaTPC, track1.p(), occupancy, centrality); } if (track1.hasTOF()) { @@ -368,7 +368,7 @@ struct phispectrapbpbqa { if (Npostrack == 1) { if (track2.p() < 0.6) { histos.fill(HIST("hNsigmaTPC"), nSigmaTPC2, track2.p(), occupancy, centrality); - } else if (track2.p() > 0.6 && track2.hasTOF() && std::abs(nSigmaTOF2) < 4.0) { + } else if (track2.p() > 0.6 && track2.hasTOF() && std::abs(nSigmaTOF2) < 2.5) { histos.fill(HIST("hNsigmaTPC"), nSigmaTPC2, track2.p(), occupancy, centrality); } if (track2.hasTOF()) { From 762650a779a84a808099c880b85296df17b14a3a Mon Sep 17 00:00:00 2001 From: omvazque Date: Tue, 19 Aug 2025 17:36:35 -0500 Subject: [PATCH 111/986] [PWGLF] Removed global ZEM cut (#12635) --- PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx | 247 +++++++++++-------- 1 file changed, 140 insertions(+), 107 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx index db3a65c374e..465b0caa8a3 100644 --- a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx @@ -115,7 +115,6 @@ struct UccZdc { Configurable isOccupancyCut{"isOccupancyCut", true, "Occupancy cut?"}; Configurable isApplyFT0CbasedOccupancy{"isApplyFT0CbasedOccupancy", false, "T0C Occu cut"}; Configurable isTDCcut{"isTDCcut", false, "Use TDC cut"}; - Configurable isZEMcut{"isZEMcut", true, "Use ZEM cut"}; Configurable useMidRapNchSel{"useMidRapNchSel", true, "Use mid-rapidit Nch selection"}; Configurable applyEff{"applyEff", true, "Apply track-by-track efficiency correction"}; Configurable applyFD{"applyFD", false, "Apply track-by-track feed down correction"}; @@ -147,6 +146,7 @@ struct UccZdc { Configurable minNch{"minNch", 0, "Min Nch (|eta|<0.8)"}; Configurable minZN{"minZN", -0.5, "Min ZN signal"}; Configurable minTdc{"minTdc", -15.0, "minimum TDC"}; + Configurable arbScale{"arbScale", 100.0, "Scale factor for forward multiplicity"}; Configurable maxNch{"maxNch", 3000, "Max Nch (|eta|<0.8)"}; Configurable maxITSTrack{"maxITSTrack", 6000., "Min ITS tracks"}; @@ -498,8 +498,8 @@ struct UccZdc { if (occuValue < minOccCut || occuValue > maxOccCut) { return false; } + registry.fill(HIST("hEventCounter"), EvCutLabel::OccuCut); } - registry.fill(HIST("hEventCounter"), EvCutLabel::OccuCut); if (col.centFT0C() < minT0CcentCut || col.centFT0C() > maxT0CcentCut) { return false; @@ -530,8 +530,8 @@ struct UccZdc { registry.fill(HIST("hEventCounter"), EvCutLabel::Zdc); auto zdc = foundBC.zdc(); - double aT0A{-999.}; - double aT0C{-999.}; + double aT0A{0.}; + double aT0C{0.}; if (foundBC.has_ft0()) { for (const auto& amplitude : foundBC.ft0().amplitudeA()) { aT0A += amplitude; @@ -544,7 +544,7 @@ struct UccZdc { } registry.fill(HIST("hEventCounter"), EvCutLabel::TZero); - double aV0A{-999.}; + double aV0A{0.}; if (foundBC.has_fv0a()) { for (const auto& amplitude : foundBC.fv0a().amplitude()) { aV0A += amplitude; @@ -552,10 +552,10 @@ struct UccZdc { } const double nPV{collision.multNTracksPVeta1() / 1.}; - const double normT0M{(aT0A + aT0C) / 100.}; - const double normV0A{aV0A / 100.}; - const double normT0A{aT0A / 100.}; - const double normT0C{aT0C / 100.}; + const double normT0M{(aT0A + aT0C) / arbScale}; + const double normV0A{aV0A / arbScale}; + const double normT0A{aT0A / arbScale}; + const double normT0C{aT0C / arbScale}; float znA{zdc.amplitudeZNA()}; float znC{zdc.amplitudeZNC()}; float zpA{zdc.amplitudeZPA()}; @@ -582,14 +582,6 @@ struct UccZdc { registry.fill(HIST("hEventCounter"), EvCutLabel::Tdc); } - // ZEM cut - if (isZEMcut) { - if (sumZEMs < zemCut) { - return; - } - registry.fill(HIST("hEventCounter"), EvCutLabel::Zem); - } - int itsTracks = 0, glbTracks = 0; for (const auto& track : tracks) { if (track.hasITS() && ((track.eta() > minEta) && (track.eta() < maxEta))) { @@ -667,19 +659,7 @@ struct UccZdc { registry.fill(HIST("zPos"), collision.posZ()); registry.fill(HIST("T0Ccent"), collision.centFT0C()); - registry.fill(HIST("ZNAamp"), znA); - registry.fill(HIST("ZNCamp"), znC); - registry.fill(HIST("ZPAamp"), zpA); - registry.fill(HIST("ZPCamp"), zpC); - registry.fill(HIST("ZNAVsZNC"), znC, znA); - registry.fill(HIST("ZNAVsZPA"), zpA, znA); - registry.fill(HIST("ZNCVsZPC"), zpC, znC); - registry.fill(HIST("ZPAVsZPC"), zpC, zpA); - registry.fill(HIST("ZNVsZEM"), sumZEMs, sumZNs); registry.fill(HIST("Debunch"), tZDCdif, tZDCsum); - registry.fill(HIST("ZNVsFT0A"), normT0A, sumZNs); - registry.fill(HIST("ZNVsFT0C"), normT0C, sumZNs); - registry.fill(HIST("ZNVsFT0M"), normT0M, sumZNs); registry.fill(HIST("NchVsFV0A"), normV0A, glbTracks); registry.fill(HIST("NchVsFT0A"), normT0A, glbTracks); registry.fill(HIST("NchVsFT0C"), normT0C, glbTracks); @@ -688,12 +668,29 @@ struct UccZdc { registry.fill(HIST("Nch"), glbTracks); registry.fill(HIST("NchVsNPV"), collision.multNTracksPVeta1(), glbTracks); registry.fill(HIST("NchVsITStracks"), itsTracks, glbTracks); - registry.fill(HIST("ZNAVsNch"), glbTracks, znA); - registry.fill(HIST("ZNCVsNch"), glbTracks, znC); - registry.fill(HIST("ZNVsNch"), glbTracks, sumZNs); - registry.fill(HIST("ZNDifVsNch"), glbTracks, znA - znC); if (glbTracks >= minNchSel) registry.fill(HIST("NchVsOneParCorr"), glbTracks, sumpt / glbTracks); + + // ZEM cut + if (sumZEMs > zemCut) { + registry.fill(HIST("hEventCounter"), EvCutLabel::Zem); + registry.fill(HIST("ZNAamp"), znA); + registry.fill(HIST("ZNCamp"), znC); + registry.fill(HIST("ZPAamp"), zpA); + registry.fill(HIST("ZPCamp"), zpC); + registry.fill(HIST("ZNAVsZNC"), znC, znA); + registry.fill(HIST("ZNAVsZPA"), zpA, znA); + registry.fill(HIST("ZNCVsZPC"), zpC, znC); + registry.fill(HIST("ZPAVsZPC"), zpC, zpA); + registry.fill(HIST("ZNVsZEM"), sumZEMs, sumZNs); + registry.fill(HIST("ZNVsFT0A"), normT0A, sumZNs); + registry.fill(HIST("ZNVsFT0C"), normT0C, sumZNs); + registry.fill(HIST("ZNVsFT0M"), normT0M, sumZNs); + registry.fill(HIST("ZNAVsNch"), glbTracks, znA); + registry.fill(HIST("ZNCVsNch"), glbTracks, znC); + registry.fill(HIST("ZNVsNch"), glbTracks, sumZNs); + registry.fill(HIST("ZNDifVsNch"), glbTracks, znA - znC); + } } PROCESS_SWITCH(UccZdc, processQA, "Process QA", true); void processZdcCollAss(o2::aod::ColEvSels::iterator const& collision, o2::aod::BCsRun3 const& /*bcs*/, aod::Zdcs const& /*zdcs*/, aod::FV0As const& /*fv0as*/, aod::FT0s const& /*ft0s*/, TheFilteredTracks const& tracks) @@ -711,8 +708,8 @@ struct UccZdc { } registry.fill(HIST("hEventCounter"), EvCutLabel::Zdc); - double aT0A{-999.}; - double aT0C{-999.}; + double aT0A{0.}; + double aT0C{0.}; if (foundBC.has_ft0()) { for (const auto& amplitude : foundBC.ft0().amplitudeA()) { aT0A += amplitude; @@ -725,7 +722,7 @@ struct UccZdc { } registry.fill(HIST("hEventCounter"), EvCutLabel::TZero); - double aV0A{-999.}; + double aV0A{0.}; if (foundBC.has_fv0a()) { for (const auto& amplitude : foundBC.fv0a().amplitude()) { aV0A += amplitude; @@ -733,8 +730,8 @@ struct UccZdc { } const double nPV{collision.multNTracksPVeta1() / 1.}; - const double normT0M{(aT0A + aT0C) / 100.}; - const double normV0A{aV0A / 100.}; + const double normT0M{(aT0A + aT0C) / arbScale}; + const double normV0A{aV0A / arbScale}; float znA{foundBC.zdc().amplitudeZNA()}; float znC{foundBC.zdc().amplitudeZNC()}; float zpA{foundBC.zdc().amplitudeZPA()}; @@ -772,14 +769,6 @@ struct UccZdc { registry.fill(HIST("hEventCounter"), EvCutLabel::Tdc); } - // ZEM cut - if (isZEMcut) { - if (sumZEMs < zemCut) { - return; - } - registry.fill(HIST("hEventCounter"), EvCutLabel::Zem); - } - // Nch-based selection double glbTracks{0.0}; for (const auto& track : tracks) { @@ -961,17 +950,11 @@ struct UccZdc { registry.fill(HIST("NchUncorrected"), glbTracks); registry.fill(HIST("NchVsV0A"), nchMult, normV0A); registry.fill(HIST("NchVsT0M"), nchMult, normT0M); - registry.fill(HIST("NchVsZN"), nchMult, sumZNs); - registry.fill(HIST("NchVsZP"), nchMult, sumZPs); registry.fill(HIST("NchVsOneParCorr"), nchMult, oneParCorr); registry.fill(HIST("NchVsTwoParCorr"), nchMult, twoParCorr); registry.fill(HIST("NchVsThreeParCorr"), nchMult, threeParCorr); - registry.fill(HIST("NchVsOneParCorrVsZN"), nchMult, sumZNs, oneParCorr); - registry.fill(HIST("NchVsTwoParCorrVsZN"), nchMult, sumZNs, twoParCorr); - registry.fill(HIST("NchVsThreeParCorrVsZN"), nchMult, sumZNs, threeParCorr); - registry.fill(HIST("NchVsOneParCorrVsT0M"), nchMult, normT0M, oneParCorr); registry.fill(HIST("NchVsTwoParCorrVsT0M"), nchMult, normT0M, twoParCorr); registry.fill(HIST("NchVsThreeParCorrVsT0M"), nchMult, normT0M, threeParCorr); @@ -980,8 +963,17 @@ struct UccZdc { registry.fill(HIST("NchVsTwoParCorrVsV0A"), nchMult, normV0A, twoParCorr); registry.fill(HIST("NchVsThreeParCorrVsV0A"), nchMult, normV0A, threeParCorr); + if (sumZEMs > zemCut) { + registry.fill(HIST("hEventCounter"), EvCutLabel::Zem); + registry.fill(HIST("NchVsZN"), nchMult, sumZNs); + registry.fill(HIST("NchVsZP"), nchMult, sumZPs); + registry.fill(HIST("NchVsOneParCorrVsZN"), nchMult, sumZNs, oneParCorr); + registry.fill(HIST("NchVsTwoParCorrVsZN"), nchMult, sumZNs, twoParCorr); + registry.fill(HIST("NchVsThreeParCorrVsZN"), nchMult, sumZNs, threeParCorr); + } + const uint64_t timeStamp{foundBC.timestamp()}; - eventSampling(tracks, normV0A, normT0M, sumZNs, timeStamp); + eventSampling(tracks, normV0A, normT0M, sumZNs, sumZEMs, timeStamp); } PROCESS_SWITCH(UccZdc, processZdcCollAss, "Process ZDC W/Coll Ass.", true); @@ -1021,17 +1013,10 @@ struct UccZdc { aT0C += amplitude; } } else { - return; + continue; } - // double aV0A{-999.}; - // if (foundBC.has_fv0a()) { - // for (const auto& amplitude : foundBC.fv0a().amplitude()) { aV0A += amplitude; } - // } - - const double normT0M{(aT0A + aT0C) / 100.}; - // const double normV0A{aV0A/100.}; - + const double normT0M{(aT0A + aT0C) / arbScale}; double nchRaw{0.}; double nchMult{0.}; double nchMC{0.}; @@ -1083,18 +1068,18 @@ struct UccZdc { // Reject event if nchRaw less than a lower cutoff if (nchRaw < minNchSel) { - return; + continue; } - // Calculates the event weight, W_k const int foundNchBin{cfg.hEfficiency->GetXaxis()->FindBin(nchRaw)}; + // Calculates the event weight, W_k for (const auto& track : groupedTracks) { // Track Selection if (track.eta() < minEta || track.eta() > maxEta) { continue; } - if (track.pt() < minPt || track.pt() > maxPt) { + if (track.pt() < minPt || track.pt() > maxPtSpectra) { continue; } if (!track.isGlobalTrack()) { @@ -1118,8 +1103,6 @@ struct UccZdc { if (std::abs(charge) < kMinCharge) { continue; } - // Is it a primary particle? - // if (!particle.isPhysicalPrimary()) { continue; } const double pt{static_cast(track.pt())}; const int foundPtBin{cfg.hEfficiency->GetYaxis()->FindBin(pt)}; @@ -1160,7 +1143,7 @@ struct UccZdc { std::vector vecFullEff; std::vector vecFDEqualOne; - // Calculates the event weight, W_k + // calculates the true Nch for (const auto& particle : mcParticles) { if (particle.eta() < minEta || particle.eta() > maxEta) { continue; @@ -1186,18 +1169,45 @@ struct UccZdc { if (!particle.isPhysicalPrimary()) { continue; } - - float pt{particle.pt()}; - pTsMC.emplace_back(pt); - vecFullEff.emplace_back(1.); - vecFDEqualOne.emplace_back(1.); nchMC++; } if (nchMC < minNchSel) { continue; } - // printf("nchMult = %f | nchMC = %f | nchMult/nchMc = %f\n",nchMult,nchMC,nchMult/nchMC); + + // Calculates the event weight, W_k + for (const auto& particle : mcParticles) { + if (particle.eta() < minEta || particle.eta() > maxEta) { + continue; + } + if (particle.pt() < minPt || particle.pt() > maxPtSpectra) { + continue; + } + + auto charge{0.}; + // Get the MC particle + auto* pdgParticle = pdg->GetParticle(particle.pdgCode()); + if (pdgParticle != nullptr) { + charge = pdgParticle->Charge(); + } else { + continue; + } + + // Is it a charged particle? + if (std::abs(charge) < kMinCharge) { + continue; + } + // Is it a primary particle? + if (!particle.isPhysicalPrimary()) { + continue; + } + + const float pt{particle.pt()}; + pTsMC.emplace_back(pt); + vecFullEff.emplace_back(1.); + vecFDEqualOne.emplace_back(1.); + } double p1MC, p2MC, p3MC, p4MC, w1MC, w2MC, w3MC, w4MC; p1MC = p2MC = p3MC = p4MC = w1MC = w2MC = w3MC = w4MC = 0.0; @@ -1223,7 +1233,6 @@ struct UccZdc { } else { // Correction with the remaining half of the sample registry.fill(HIST("EvtsDivided"), 1); //----- MC reconstructed -----// - // const auto& groupedTracks{simTracks.sliceBy(perCollision, collision.globalIndex())}; for (const auto& track : groupedTracks) { // Track Selection if (track.eta() < minEta || track.eta() > maxEta) { @@ -1235,9 +1244,6 @@ struct UccZdc { if (!track.isGlobalTrack()) { continue; } - registry.fill(HIST("ZposVsEta"), collision.posZ(), track.eta()); - registry.fill(HIST("EtaVsPhi"), track.eta(), track.phi()); - registry.fill(HIST("dcaXYvspT"), track.dcaXY(), track.pt()); nchRaw++; } @@ -1246,7 +1252,7 @@ struct UccZdc { if (track.eta() < minEta || track.eta() > maxEta) { continue; } - if (track.pt() < minPt || track.pt() > maxPt) { + if (track.pt() < minPt || track.pt() > maxPtSpectra) { continue; } if (!track.isGlobalTrack()) { @@ -1270,8 +1276,13 @@ struct UccZdc { if (std::abs(charge) < kMinCharge) { continue; } + // All charged particles registry.fill(HIST("Pt_all_ch"), nchRaw, track.pt()); + registry.fill(HIST("ZposVsEta"), collision.posZ(), track.eta()); + registry.fill(HIST("EtaVsPhi"), track.eta(), track.phi()); + registry.fill(HIST("dcaXYvspT"), track.dcaXY(), track.pt()); + // Is it a primary particle? if (!particle.isPhysicalPrimary()) { continue; @@ -1298,7 +1309,7 @@ struct UccZdc { if (particle.eta() < minEta || particle.eta() > maxEta) { continue; } - if (particle.pt() < minPt || particle.pt() > maxPt) { + if (particle.pt() < minPt || particle.pt() > maxPtSpectra) { continue; } @@ -1380,7 +1391,7 @@ struct UccZdc { std::vector vecFD; std::vector vecEff; - // Calculates the event weight, W_k + // Calculates the true Nch for (const auto& particle : mcParticles) { if (particle.eta() < minEta || particle.eta() > maxEta) { continue; @@ -1406,18 +1417,45 @@ struct UccZdc { if (!particle.isPhysicalPrimary()) { continue; } - - float pt{particle.pt()}; - pTs.emplace_back(pt); - vecEff.emplace_back(1.); - vecFD.emplace_back(1.); nchMult++; } if (nchMult < minNchSel) { continue; } - // printf("nchMult = %f | nchMC = %f | nchMult/nchMc = %f\n",nchMult,nchMC,nchMult/nchMC); + + // Calculates the event weight, W_k + for (const auto& particle : mcParticles) { + if (particle.eta() < minEta || particle.eta() > maxEta) { + continue; + } + if (particle.pt() < minPt || particle.pt() > maxPtSpectra) { + continue; + } + + auto charge{0.}; + // Get the MC particle + auto* pdgParticle = pdg->GetParticle(particle.pdgCode()); + if (pdgParticle != nullptr) { + charge = pdgParticle->Charge(); + } else { + continue; + } + + // Is it a charged particle? + if (std::abs(charge) < kMinCharge) { + continue; + } + // Is it a primary particle? + if (!particle.isPhysicalPrimary()) { + continue; + } + + const float pt{particle.pt()}; + pTs.emplace_back(pt); + vecEff.emplace_back(1.); + vecFD.emplace_back(1.); + } double p1, p2, p3, p4, w1, w2, w3, w4; p1 = p2 = p3 = p4 = w1 = w2 = w3 = w4 = 0.0; @@ -1464,7 +1502,7 @@ struct UccZdc { std::vector vecFD; std::vector vecEff; - // Calculates the uncorrected Nch multiplicity + // Calculates the uncorrected Nch for (const auto& track : tracks) { // Track Selection if (!track.isGlobalTrack()) { @@ -1498,10 +1536,10 @@ struct UccZdc { continue; } - float pt{track.pt()}; + const float pt{track.pt()}; double fdValue{1.}; - int foundPtBin{cfg.hEfficiency->GetYaxis()->FindBin(pt)}; - double effValue{cfg.hEfficiency->GetBinContent(foundNchBin, foundPtBin)}; + const int foundPtBin{cfg.hEfficiency->GetYaxis()->FindBin(pt)}; + const double effValue{cfg.hEfficiency->GetBinContent(foundNchBin, foundPtBin)}; if (applyFD) fdValue = cfg.hFeedDown->GetBinContent(foundNchBin, foundPtBin); @@ -1532,10 +1570,10 @@ struct UccZdc { continue; } - float pt{track.pt()}; + const float pt{track.pt()}; double fdValue{1.}; - int foundPtBin{cfg.hEfficiency->GetYaxis()->FindBin(pt)}; - double effValue{cfg.hEfficiency->GetBinContent(foundNchBin, foundPtBin)}; + const int foundPtBin{cfg.hEfficiency->GetYaxis()->FindBin(pt)}; + const double effValue{cfg.hEfficiency->GetBinContent(foundNchBin, foundPtBin)}; if (applyFD) fdValue = cfg.hFeedDown->GetBinContent(foundNchBin, foundPtBin); @@ -1588,7 +1626,7 @@ struct UccZdc { } template - void eventSampling(const T& tracks, const U& normV0A, const U& normT0M, const U& sumZNs, const V& timeStamp) + void eventSampling(const T& tracks, const U& normV0A, const U& normT0M, const U& sumZNs, const U& sumZEMs, const V& timeStamp) { TRandom3 rndGen(timeStamp); std::vector vPoisson; @@ -1687,8 +1725,6 @@ struct UccZdc { pTs.emplace_back(pt); vecEff.emplace_back(effValue); vecFD.emplace_back(fdValue); - // To calculate event-averaged - registry.fill(HIST("NchVsZNVsPt"), nchMult, sumZNs, pt * (fdValue / effValue)); } } } else { @@ -1704,9 +1740,6 @@ struct UccZdc { pTs.emplace_back(track.pt()); vecEff.emplace_back(1.); vecFD.emplace_back(1.); - - // To calculate event-averaged - registry.fill(HIST("NchVsZNVsPt"), nchMult, sumZNs, track.pt()); } } @@ -1727,14 +1760,9 @@ struct UccZdc { const double numThreeParCorr{std::pow(p1, 3.) - (3. * p2 * p1) + (2. * p3)}; const double threeParCorr{numThreeParCorr / denThreeParCorr}; - hNchVsZN[replica]->Fill(nchMult, sumZNs); hNchVsV0A[replica]->Fill(nchMult, normV0A); hNchVsT0M[replica]->Fill(nchMult, normT0M); - pNchVsOneParCorrVsZN[replica]->Fill(nchMult, sumZNs, oneParCorr); - pNchVsTwoParCorrVsZN[replica]->Fill(nchMult, sumZNs, twoParCorr); - pNchVsThreeParCorrVsZN[replica]->Fill(nchMult, sumZNs, threeParCorr); - pNchVsOneParCorrVsT0M[replica]->Fill(nchMult, normT0M, oneParCorr); pNchVsTwoParCorrVsT0M[replica]->Fill(nchMult, normT0M, twoParCorr); pNchVsThreeParCorrVsT0M[replica]->Fill(nchMult, normT0M, threeParCorr); @@ -1742,14 +1770,19 @@ struct UccZdc { pNchVsOneParCorrVsV0A[replica]->Fill(nchMult, normV0A, oneParCorr); pNchVsTwoParCorrVsV0A[replica]->Fill(nchMult, normV0A, twoParCorr); pNchVsThreeParCorrVsV0A[replica]->Fill(nchMult, normV0A, threeParCorr); + + if (sumZEMs > zemCut) { + hNchVsZN[replica]->Fill(nchMult, sumZNs); + pNchVsOneParCorrVsZN[replica]->Fill(nchMult, sumZNs, oneParCorr); + pNchVsTwoParCorrVsZN[replica]->Fill(nchMult, sumZNs, twoParCorr); + pNchVsThreeParCorrVsZN[replica]->Fill(nchMult, sumZNs, threeParCorr); + } } // event per replica } // replica's loop } void loadCorrections(uint64_t timeStamp) { - // if (cfg.correctionsLoaded) return; - if (paTHEff.value.empty() == false) { cfg.hEfficiency = ccdb->getForTimeStamp(paTHEff, timeStamp); if (cfg.hEfficiency == nullptr) { From 288f0f53dbe04645c83b49d06401822eb5c4de95 Mon Sep 17 00:00:00 2001 From: nkaratze Date: Wed, 20 Aug 2025 00:50:04 +0200 Subject: [PATCH 112/986] [PWGLF] Bug fix, removed signal splitting (#12634) Co-authored-by: nkaratze --- PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx | 208 +++++++++---------- 1 file changed, 97 insertions(+), 111 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx b/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx index b6a459fab70..d91e8ae5f49 100644 --- a/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx +++ b/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx @@ -225,9 +225,9 @@ struct V0PtInvMassPlots { rPtAnalysis.add("hNEvents", "hNEvents", {HistType::kTH1D, {{10, 0.f, 10.f}}}); rPtAnalysis.add("hNRecEvents_Data", "hNRecEvents_Data", {HistType::kTH1D, {{1, 0.f, 1.f}}}); rPtAnalysis.add("hNV0s", "hNV0s", {HistType::kTH1D, {{10, 0.f, 10.f}}}); - rPtAnalysis.add("hNK0sh", "hNK0sh", {HistType::kTH1D, {{10, 0.f, 10.f}}}); - rPtAnalysis.add("hNLambda", "hNLambda", {HistType::kTH1D, {{10, 0.f, 10.f}}}); - rPtAnalysis.add("hNAntilambda", "hNAntilambda", {HistType::kTH1D, {{10, 0.f, 10.f}}}); + rPtAnalysis.add("hNK0sh", "hNK0sh", {HistType::kTH1D, {{11, 0.f, 11.f}}}); + rPtAnalysis.add("hNLambda", "hNLambda", {HistType::kTH1D, {{11, 0.f, 11.f}}}); + rPtAnalysis.add("hNAntilambda", "hNAntilambda", {HistType::kTH1D, {{11, 0.f, 11.f}}}); rPtAnalysis.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexZAxis}}); rPtAnalysis.add("hArmenterosPodolanskiPlot", "hArmenterosPodolanskiPlot", {HistType::kTH2F, {{armenterosasymAxis}, {armenterosQtAxis}}}); @@ -339,42 +339,42 @@ struct V0PtInvMassPlots { } rPtAnalysis.fill(HIST("hNEvents"), 1.5); rPtAnalysis.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(2, "sel 8"); - if (!(collision.selection_bit(aod::evsel::kNoTimeFrameBorder) && doNoTimeFrameBorder)) { + if (!(doNoTimeFrameBorder && collision.selection_bit(aod::evsel::kNoTimeFrameBorder))) { return false; } rPtAnalysis.fill(HIST("hNEvents"), 2.5); rPtAnalysis.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(3, "NoTimeFrameBorder"); - if (!(collision.selection_bit(aod::evsel::kNoITSROFrameBorder) && doNoITSROFrameBorder)) { + if (!(doNoITSROFrameBorder && collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { return false; } rPtAnalysis.fill(HIST("hNEvents"), 3.5); rPtAnalysis.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(4, "NoITSROFrameBorder"); - if (!(collision.selection_bit(aod::evsel::kIsTriggerTVX) && doIsTriggerTVX)) { + if (!(doIsTriggerTVX && collision.selection_bit(aod::evsel::kIsTriggerTVX))) { return false; } rPtAnalysis.fill(HIST("hNEvents"), 4.5); rPtAnalysis.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(5, "IsTriggerTVX"); - if (!(std::abs(collision.posZ()) < cutZVertex && docutZVertex)) { + if (!(docutZVertex && std::abs(collision.posZ()) < cutZVertex)) { return false; } rPtAnalysis.fill(HIST("hNEvents"), 5.5); rPtAnalysis.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(6, "cutZVertex"); - if (!(collision.selection_bit(aod::evsel::kIsVertexTOFmatched) && doIsVertexTOFmatched)) { + if (!(doIsVertexTOFmatched && collision.selection_bit(aod::evsel::kIsVertexTOFmatched))) { return false; } rPtAnalysis.fill(HIST("hNEvents"), 6.5); rPtAnalysis.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(7, "IsVertexTOFmatched"); - if (!(collision.selection_bit(aod::evsel::kNoSameBunchPileup) && doNoSameBunchPileup)) { + if (!(doNoSameBunchPileup && collision.selection_bit(aod::evsel::kNoSameBunchPileup))) { return false; } rPtAnalysis.fill(HIST("hNEvents"), 7.5); rPtAnalysis.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(8, "NoSameBunchPileup"); - if (!(collision.selection_bit(aod::evsel::kIsVertexITSTPC) && doIsVertexITSTPC)) { + if (!(doIsVertexITSTPC && collision.selection_bit(aod::evsel::kIsVertexITSTPC))) { return false; } rPtAnalysis.fill(HIST("hNEvents"), 8.5); rPtAnalysis.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(9, "IsVertexITSTPC"); - if (!(collision.isInelGt0() && doisInelGt0)) { + if (!(doisInelGt0 && collision.isInelGt0())) { return false; } rPtAnalysis.fill(HIST("hNEvents"), 9.5); @@ -394,27 +394,21 @@ struct V0PtInvMassPlots { rPtAnalysis.fill(HIST("hNV0s"), 0.5); rPtAnalysis.get(HIST("hNV0s"))->GetXaxis()->SetBinLabel(1, "All V0s"); - if (std::abs(v0.y()) > rapidityCut && doRapidityCut) { // V0 Rapidity Cut + if (doDaughterPseudorapidityCut && (std::abs(posDaughterTrack.eta()) > etadau && std::abs(negDaughterTrack.eta()) > etadau)) { // Daughters Pseudorapidity Cut return false; } rPtAnalysis.fill(HIST("hNV0s"), 1.5); - rPtAnalysis.get(HIST("hNV0s"))->GetXaxis()->SetBinLabel(2, "Rapidity"); - if ((std::abs(posDaughterTrack.eta()) > etadau && std::abs(negDaughterTrack.eta()) > etadau) && doDaughterPseudorapidityCut) { // Daughters Pseudorapidity Cut + rPtAnalysis.get(HIST("hNV0s"))->GetXaxis()->SetBinLabel(2, "Dau Pseudorapidity"); + if (!doisITSAfterburner && (posDaughterTrack.isITSAfterburner() || negDaughterTrack.isITSAfterburner())) { // ITS After Burner on daughter tracks return false; } rPtAnalysis.fill(HIST("hNV0s"), 2.5); - rPtAnalysis.get(HIST("hNV0s"))->GetXaxis()->SetBinLabel(3, "Dau Pseudorapidity"); - if ((posDaughterTrack.isITSAfterburner() || negDaughterTrack.isITSAfterburner()) && !doisITSAfterburner) { // ITS After Burner on daughter tracks + rPtAnalysis.get(HIST("hNV0s"))->GetXaxis()->SetBinLabel(3, "ITS Afterburner"); + if (doitsMinHits && posDaughterTrack.itsNCls() <= itsMinHits && negDaughterTrack.itsNCls() <= itsMinHits) { // Minimum hits in the ITS return false; - } - rPtAnalysis.fill(HIST("hNV0s"), 3.5); - rPtAnalysis.get(HIST("hNV0s"))->GetXaxis()->SetBinLabel(4, "ITS Afterburner"); - if (posDaughterTrack.itsNCls() <= itsMinHits && negDaughterTrack.itsNCls() <= itsMinHits && doitsMinHits) { // Minimum hits in the ITS - return false; - rPtAnalysis.fill(HIST("hNV0s"), 4.5); - rPtAnalysis.get(HIST("hNV0s"))->GetXaxis()->SetBinLabel(5, "ITS Min Hits"); + rPtAnalysis.fill(HIST("hNV0s"), 3.5); + rPtAnalysis.get(HIST("hNV0s"))->GetXaxis()->SetBinLabel(4, "ITS Min Hits"); // Cut Plots - rPtAnalysis.fill(HIST("V0Rapidity"), v0.y()); rPtAnalysis.fill(HIST("hV0EtaDaughters"), v0.template posTrack_as().eta()); rPtAnalysis.fill(HIST("hV0EtaDaughters"), v0.template negTrack_as().eta()); } @@ -431,60 +425,67 @@ struct V0PtInvMassPlots { rPtAnalysis.fill(HIST("hNK0sh"), 0.5); rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(1, "All"); rPtAnalysis.fill(HIST("hMassK0ShortvsCuts"), 0.5, v0.mK0Short()); - if ((std::abs(posDaughterTrack.tpcNSigmaPi()) > nSigmaTPCPion && std::abs(negDaughterTrack.tpcNSigmaPi()) > nSigmaTPCPion) && doK0shTPCPID) { // TPC PID for two pions + + if (doRapidityCut && std::abs(v0.rapidity(0)) > rapidityCut) { // V0 Rapidity Cut return false; } rPtAnalysis.fill(HIST("hNK0sh"), 1.5); - rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(2, "TPC_PID"); + rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(2, "Rapidity"); rPtAnalysis.fill(HIST("hMassK0ShortvsCuts"), 1.5, v0.mK0Short()); - if (std::abs(v0.mLambda() - o2::constants::physics::MassLambda0) < compv0masscut && std::abs(v0.mAntiLambda() - o2::constants::physics::MassLambda0) < compv0masscut && doK0shcomptmasscut) { // Kzero competitive v0 mass cut (cut out Lambdas and Anti-Lambdas) + if (doK0shTPCPID && (std::abs(posDaughterTrack.tpcNSigmaPi()) > nSigmaTPCPion && std::abs(negDaughterTrack.tpcNSigmaPi()) > nSigmaTPCPion)) { // TPC PID for two pions return false; } rPtAnalysis.fill(HIST("hNK0sh"), 2.5); - rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(3, "Compt_Mass"); + rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(3, "TPC_PID"); rPtAnalysis.fill(HIST("hMassK0ShortvsCuts"), 2.5, v0.mK0Short()); - if (v0.v0radius() > kaonshmaxct && doK0shMaxct) { // K0sh max ct + if (doK0shcomptmasscut && std::abs(v0.mLambda() - o2::constants::physics::MassLambda0) < compv0masscut && std::abs(v0.mAntiLambda() - o2::constants::physics::MassLambda0) < compv0masscut) { // Kzero competitive v0 mass cut (cut out Lambdas and Anti-Lambdas) return false; } rPtAnalysis.fill(HIST("hNK0sh"), 3.5); - rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(4, "Max_ct"); + rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(4, "Compt_Mass"); rPtAnalysis.fill(HIST("hMassK0ShortvsCuts"), 3.5, v0.mK0Short()); - if (v0.qtarm() < (k0shparamArmenterosCut * std::abs(v0.alpha())) && doK0shArmenterosCut) { // K0sh Armenteros Cut + if (doK0shMaxct && v0.v0radius() > kaonshmaxct) { // K0sh max ct return false; } rPtAnalysis.fill(HIST("hNK0sh"), 4.5); - rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(5, "Armenteros"); + rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(5, "Max_ct"); rPtAnalysis.fill(HIST("hMassK0ShortvsCuts"), 4.5, v0.mK0Short()); - if (v0.v0cosPA() < kaonshSettingcosPA && doK0shcosPACut) { // K0sh cosPA Topological Cut + if (doK0shArmenterosCut && v0.qtarm() < (k0shparamArmenterosCut * std::abs(v0.alpha()))) { // K0sh Armenteros Cut return false; } rPtAnalysis.fill(HIST("hNK0sh"), 5.5); - rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(6, "cosPA"); + rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(6, "Armenteros"); rPtAnalysis.fill(HIST("hMassK0ShortvsCuts"), 5.5, v0.mK0Short()); - if (v0.dcaV0daughters() > kaonshSettingdcav0dau && doK0shDCAdauCut) { // K0sh DCAdaughters Topological Cut + if (doK0shcosPACut && v0.v0cosPA() < kaonshSettingcosPA) { // K0sh cosPA Topological Cut return false; } rPtAnalysis.fill(HIST("hNK0sh"), 6.5); - rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(7, "DCAdau"); + rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(7, "cosPA"); rPtAnalysis.fill(HIST("hMassK0ShortvsCuts"), 6.5, v0.mK0Short()); - if (v0.v0radius() < kaonshSettingradius && doK0shv0radiusCut) { // K0sh v0radius Topological Cut + if (doK0shDCAdauCut && v0.dcaV0daughters() > kaonshSettingdcav0dau) { // K0sh DCAdaughters Topological Cut return false; } rPtAnalysis.fill(HIST("hNK0sh"), 7.5); - rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(8, "v0radius"); + rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(8, "DCAdau"); rPtAnalysis.fill(HIST("hMassK0ShortvsCuts"), 7.5, v0.mK0Short()); - if (std::abs(v0.dcapostopv()) < kaonshSettingdcapostopv && doK0shdcaposdautopv) { // K0sh DCAPosDaughterToPV Topological Cut + if (doK0shv0radiusCut && v0.v0radius() < kaonshSettingradius) { // K0sh v0radius Topological Cut return false; } rPtAnalysis.fill(HIST("hNK0sh"), 8.5); - rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(9, "DCAPosDautoPV"); + rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(9, "v0radius"); rPtAnalysis.fill(HIST("hMassK0ShortvsCuts"), 8.5, v0.mK0Short()); - if (std::abs(v0.dcanegtopv()) < kaonshSettingdcanegtopv && doK0shdcanegdautopv) { // K0sh DCANegDaughterToPV Topological Cut + if (doK0shdcaposdautopv && std::abs(v0.dcapostopv()) < kaonshSettingdcapostopv) { // K0sh DCAPosDaughterToPV Topological Cut return false; } rPtAnalysis.fill(HIST("hNK0sh"), 9.5); - rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(10, "DCANegDautoPV"); + rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(10, "DCAPosDautoPV"); rPtAnalysis.fill(HIST("hMassK0ShortvsCuts"), 9.5, v0.mK0Short()); + if (doK0shdcanegdautopv && std::abs(v0.dcanegtopv()) < kaonshSettingdcanegtopv) { // K0sh DCANegDaughterToPV Topological Cut + return false; + } + rPtAnalysis.fill(HIST("hNK0sh"), 10.5); + rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(11, "DCANegDautoPV"); + rPtAnalysis.fill(HIST("hMassK0ShortvsCuts"), 10.5, v0.mK0Short()); // Cut Plots rPtAnalysis.fill(HIST("hArmenterosPodolanskiPlotK0sh"), v0.alpha(), v0.qtarm()); @@ -495,6 +496,7 @@ struct V0PtInvMassPlots { rPtAnalysis.fill(HIST("hK0shDCAV0Daughters"), v0.dcaV0daughters()); rPtAnalysis.fill(HIST("hK0shDCAPosDaughter"), v0.dcapostopv()); rPtAnalysis.fill(HIST("hK0shDCANegDaughter"), v0.dcanegtopv()); + rPtAnalysis.fill(HIST("V0Rapidity"), v0.rapidity(0)); return true; } @@ -508,60 +510,67 @@ struct V0PtInvMassPlots { rPtAnalysis.fill(HIST("hNLambda"), 0.5); rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(1, "All"); rPtAnalysis.fill(HIST("hMassLambdavsCuts"), 0.5, v0.mLambda()); - if (std::abs(posDaughterTrack.tpcNSigmaPr()) > nSigmaTPCProton && std::abs(negDaughterTrack.tpcNSigmaPi()) > nSigmaTPCPion && doLambdaTPCPID) { // TPC PID on daughter pion and proton for Lambda + + if (doRapidityCut && std::abs(v0.rapidity(1)) > rapidityCut) { // V0 Rapidity Cut return false; } rPtAnalysis.fill(HIST("hNLambda"), 1.5); - rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(2, "TPC_PID"); + rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(2, "Rapidity"); rPtAnalysis.fill(HIST("hMassLambdavsCuts"), 1.5, v0.mLambda()); - if (std::abs(v0.mK0Short() - o2::constants::physics::MassK0Short) < compv0masscut && doLambdacomptmasscut) { // Lambda competitive v0 mass cut (cut out Kaons) + if (doLambdaTPCPID && std::abs(posDaughterTrack.tpcNSigmaPr()) > nSigmaTPCProton && std::abs(negDaughterTrack.tpcNSigmaPi()) > nSigmaTPCPion) { // TPC PID on daughter pion and proton for Lambda return false; } rPtAnalysis.fill(HIST("hNLambda"), 2.5); - rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(3, "Compt_Mass"); + rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(3, "TPC_PID"); rPtAnalysis.fill(HIST("hMassLambdavsCuts"), 2.5, v0.mLambda()); - if (v0.v0radius() > lambdamaxct && doLambdaMaxct) { // Lambda max ct + if (doLambdacomptmasscut && std::abs(v0.mK0Short() - o2::constants::physics::MassK0Short) < compv0masscut) { // Lambda competitive v0 mass cut (cut out Kaons) return false; } rPtAnalysis.fill(HIST("hNLambda"), 3.5); - rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(4, "Max_ct"); + rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(4, "Compt_Mass"); rPtAnalysis.fill(HIST("hMassLambdavsCuts"), 3.5, v0.mLambda()); - if (v0.qtarm() < (lambdaparamArmenterosCut * std::abs(v0.alpha())) && doLambdaArmenterosCut) { // Lambda Armenteros Cut + if (doLambdaMaxct && v0.v0radius() > lambdamaxct) { // Lambda max ct return false; } rPtAnalysis.fill(HIST("hNLambda"), 4.5); - rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(5, "Armenteros"); + rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(5, "Max_ct"); rPtAnalysis.fill(HIST("hMassLambdavsCuts"), 4.5, v0.mLambda()); - if (v0.v0cosPA() < lambdaSettingcosPA && doLambdacosPACut) { // Lambda cosPA Topological Cut + if (doLambdaArmenterosCut && v0.qtarm() < (lambdaparamArmenterosCut * std::abs(v0.alpha()))) { // Lambda Armenteros Cut return false; } rPtAnalysis.fill(HIST("hNLambda"), 5.5); - rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(6, "cosPA"); + rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(6, "Armenteros"); rPtAnalysis.fill(HIST("hMassLambdavsCuts"), 5.5, v0.mLambda()); - if (v0.dcaV0daughters() > lambdaSettingdcav0dau && doLambdaDCAdauCut) { // Lambda DCAdaughters Topological Cut + if (doLambdacosPACut && v0.v0cosPA() < lambdaSettingcosPA) { // Lambda cosPA Topological Cut return false; } rPtAnalysis.fill(HIST("hNLambda"), 6.5); - rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(7, "DCAdau"); + rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(7, "cosPA"); rPtAnalysis.fill(HIST("hMassLambdavsCuts"), 6.5, v0.mLambda()); - if (v0.v0radius() < lambdaSettingradius && doLambdav0radiusCut) { // Lambda v0radius Topological Cut + if (doLambdaDCAdauCut && v0.dcaV0daughters() > lambdaSettingdcav0dau) { // Lambda DCAdaughters Topological Cut return false; } rPtAnalysis.fill(HIST("hNLambda"), 7.5); - rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(8, "v0radius"); + rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(8, "DCAdau"); rPtAnalysis.fill(HIST("hMassLambdavsCuts"), 7.5, v0.mLambda()); - if (std::abs(v0.dcapostopv()) < lambdaSettingdcapostopv && doLambdadcaposdautopv) { // Lambda DCAPosDaughterToPV Topological Cut + if (doLambdav0radiusCut && v0.v0radius() < lambdaSettingradius) { // Lambda v0radius Topological Cut return false; } rPtAnalysis.fill(HIST("hNLambda"), 8.5); - rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(9, "DCAPosDautoPV"); + rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(9, "v0radius"); rPtAnalysis.fill(HIST("hMassLambdavsCuts"), 8.5, v0.mLambda()); - if (std::abs(v0.dcanegtopv()) < lambdaSettingdcanegtopv && doLambdadcanegdautopv) { // Lambda DCANegDaughterToPV Topological Cut + if (doLambdadcaposdautopv && std::abs(v0.dcapostopv()) < lambdaSettingdcapostopv) { // Lambda DCAPosDaughterToPV Topological Cut return false; } rPtAnalysis.fill(HIST("hNLambda"), 9.5); - rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(10, "DCANegDautoPV"); + rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(10, "DCAPosDautoPV"); rPtAnalysis.fill(HIST("hMassLambdavsCuts"), 9.5, v0.mLambda()); + if (doLambdadcanegdautopv && std::abs(v0.dcanegtopv()) < lambdaSettingdcanegtopv) { // Lambda DCANegDaughterToPV Topological Cut + return false; + } + rPtAnalysis.fill(HIST("hNLambda"), 10.5); + rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(11, "DCANegDautoPV"); + rPtAnalysis.fill(HIST("hMassLambdavsCuts"), 10.5, v0.mLambda()); // Cut Plots rPtAnalysis.fill(HIST("hArmenterosPodolanskiPlotLambda"), v0.alpha(), v0.qtarm()); @@ -572,6 +581,7 @@ struct V0PtInvMassPlots { rPtAnalysis.fill(HIST("hLambdaDCAV0Daughters"), v0.dcaV0daughters()); rPtAnalysis.fill(HIST("hLambdaDCAPosDaughter"), v0.dcapostopv()); rPtAnalysis.fill(HIST("hLambdaDCANegDaughter"), v0.dcanegtopv()); + rPtAnalysis.fill(HIST("V0Rapidity"), v0.rapidity(1)); return true; } @@ -585,60 +595,67 @@ struct V0PtInvMassPlots { rPtAnalysis.fill(HIST("hNAntilambda"), 0.5); rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(1, "All"); rPtAnalysis.fill(HIST("hMassAntilambdavsCuts"), 0.5, v0.mAntiLambda()); - if (std::abs(negDaughterTrack.tpcNSigmaPr()) > nSigmaTPCProton && std::abs(posDaughterTrack.tpcNSigmaPi()) > nSigmaTPCPion) { // TPC PID on daughter pion and proton for AntiLambda + + if (doRapidityCut && std::abs(v0.rapidity(2)) > rapidityCut) { // V0 Rapidity Cut return false; } rPtAnalysis.fill(HIST("hNAntilambda"), 1.5); - rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(2, "TPC_PID"); + rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(2, "Rapidity"); rPtAnalysis.fill(HIST("hMassAntilambdavsCuts"), 1.5, v0.mAntiLambda()); - if (std::abs(v0.mK0Short() - o2::constants::physics::MassK0Short) < compv0masscut && doAntilambdacomptmasscut) { // Antilambda competitive v0 mass cut (cut out Kaons) + if (doAntilambdaTPCPID && std::abs(negDaughterTrack.tpcNSigmaPr()) > nSigmaTPCProton && std::abs(posDaughterTrack.tpcNSigmaPi()) > nSigmaTPCPion) { // TPC PID on daughter pion and proton for AntiLambda return false; } rPtAnalysis.fill(HIST("hNAntilambda"), 2.5); - rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(3, "Compt_Mass"); + rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(3, "TPC_PID"); rPtAnalysis.fill(HIST("hMassAntilambdavsCuts"), 2.5, v0.mAntiLambda()); - if (v0.v0radius() > antilambdamaxct && doAntilambdaMaxct) { // Antilambda max ct + if (doAntilambdacomptmasscut && std::abs(v0.mK0Short() - o2::constants::physics::MassK0Short) < compv0masscut) { // Antilambda competitive v0 mass cut (cut out Kaons) return false; } rPtAnalysis.fill(HIST("hNAntilambda"), 3.5); - rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(4, "Max_ct"); + rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(4, "Compt_Mass"); rPtAnalysis.fill(HIST("hMassAntilambdavsCuts"), 3.5, v0.mAntiLambda()); - if (v0.qtarm() < (antilambdaparamArmenterosCut * std::abs(v0.alpha())) && doAntilambdaArmenterosCut) { // Antilambda Armenteros Cut + if (doAntilambdaMaxct && v0.v0radius() > antilambdamaxct) { // Antilambda max ct return false; } rPtAnalysis.fill(HIST("hNAntilambda"), 4.5); - rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(5, "Armenteros"); + rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(5, "Max_ct"); rPtAnalysis.fill(HIST("hMassAntilambdavsCuts"), 4.5, v0.mAntiLambda()); - if (v0.v0cosPA() < antilambdaSettingcosPA && doAntilambdacosPACut) { // Antilambda cosPA Topological Cut + if (doAntilambdaArmenterosCut && v0.qtarm() < (antilambdaparamArmenterosCut * std::abs(v0.alpha()))) { // Antilambda Armenteros Cut return false; } rPtAnalysis.fill(HIST("hNAntilambda"), 5.5); - rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(6, "cosPA"); + rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(6, "Armenteros"); rPtAnalysis.fill(HIST("hMassAntilambdavsCuts"), 5.5, v0.mAntiLambda()); - if (v0.dcaV0daughters() > antilambdaSettingdcav0dau && doAntilambdaDCAdauCut) { // Antilambda DCAdaughters Topological Cut + if (doAntilambdacosPACut && v0.v0cosPA() < antilambdaSettingcosPA) { // Antilambda cosPA Topological Cut return false; } rPtAnalysis.fill(HIST("hNAntilambda"), 6.5); - rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(7, "DCAdau"); + rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(7, "cosPA"); rPtAnalysis.fill(HIST("hMassAntilambdavsCuts"), 6.5, v0.mAntiLambda()); - if (v0.v0radius() < antilambdaSettingradius && doAntilambdav0radiusCut) { // Antilambda v0radius Topological Cut + if (doAntilambdaDCAdauCut && v0.dcaV0daughters() > antilambdaSettingdcav0dau) { // Antilambda DCAdaughters Topological Cut return false; } rPtAnalysis.fill(HIST("hNAntilambda"), 7.5); - rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(8, "v0radius"); + rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(8, "DCAdau"); rPtAnalysis.fill(HIST("hMassAntilambdavsCuts"), 7.5, v0.mAntiLambda()); - if (std::abs(v0.dcapostopv()) < antilambdaSettingdcapostopv && doAntilambdadcaposdautopv) { // Antilambda DCAPosDaughterToPV Topological Cut + if (doAntilambdav0radiusCut && v0.v0radius() < antilambdaSettingradius) { // Antilambda v0radius Topological Cut return false; } rPtAnalysis.fill(HIST("hNAntilambda"), 8.5); - rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(9, "DCAPosDautoPV"); + rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(9, "v0radius"); rPtAnalysis.fill(HIST("hMassAntilambdavsCuts"), 8.5, v0.mAntiLambda()); - if (std::abs(v0.dcanegtopv()) < antilambdaSettingdcanegtopv && doAntilambdadcanegdautopv) { // Antilambda DCANegDaughterToPV Topological Cut + if (doAntilambdadcaposdautopv && std::abs(v0.dcapostopv()) < antilambdaSettingdcapostopv) { // Antilambda DCAPosDaughterToPV Topological Cut return false; } rPtAnalysis.fill(HIST("hNAntilambda"), 9.5); - rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(10, "DCANegDautoPV"); + rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(10, "DCAPosDautoPV"); rPtAnalysis.fill(HIST("hMassAntilambdavsCuts"), 9.5, v0.mAntiLambda()); + if (doAntilambdadcanegdautopv && std::abs(v0.dcanegtopv()) < antilambdaSettingdcanegtopv) { // Antilambda DCANegDaughterToPV Topological Cut + return false; + } + rPtAnalysis.fill(HIST("hNAntilambda"), 10.5); + rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(11, "DCANegDautoPV"); + rPtAnalysis.fill(HIST("hMassAntilambdavsCuts"), 10.5, v0.mAntiLambda()); // Cut plots rPtAnalysis.fill(HIST("hArmenterosPodolanskiPlotAntilambda"), v0.alpha(), v0.qtarm()); @@ -649,6 +666,7 @@ struct V0PtInvMassPlots { rPtAnalysis.fill(HIST("hAntilambdaDCAV0Daughters"), v0.dcaV0daughters()); rPtAnalysis.fill(HIST("hAntilambdaDCAPosDaughter"), v0.dcapostopv()); rPtAnalysis.fill(HIST("hAntilambdaDCANegDaughter"), v0.dcanegtopv()); + rPtAnalysis.fill(HIST("V0Rapidity"), v0.rapidity(2)); return true; } @@ -745,7 +763,7 @@ struct V0PtInvMassPlots { void recMCProcess(soa::Join::iterator const& collision, soa::Join const& V0s, DaughterTracks const&, // no need to define a variable for tracks, if we don't access them directly - aod::McParticles const& mcParticles) + aod::McParticles const& /*mcParticles*/) { // tokenise strings into individual values pthistos::kaonPtBins = o2::utils::Str::tokenize(kzeroSettingPtBinsString, ','); @@ -767,43 +785,11 @@ struct V0PtInvMassPlots { } rMCCorrections.fill(HIST("hNRecEvents_MC"), 0.5); // Event Split Numenator - // v0 Signal Splitting Numenator Start - for (const auto& mcParticle : mcParticles) { - if (mcParticle.isPhysicalPrimary()) { - if (std::abs(mcParticle.y()) < rapidityCut) { - if (mcParticle.pdgCode() == kK0Short) { // kzero matched - rMCCorrections.fill(HIST("hK0ShSplitNumenatorPtSpectrum"), mcParticle.pt()); - } - if (mcParticle.pdgCode() == kLambda0) { // lambda matched - rMCCorrections.fill(HIST("hLambdaSplitNumenatorPtSpectrum"), mcParticle.pt()); - } - if (mcParticle.pdgCode() == kLambda0Bar) { // antilambda matched - rMCCorrections.fill(HIST("hAntilambdaSplitNumenatorPtSpectrum"), mcParticle.pt()); - } - } - } - } - // V0 Signal Splitting Numenator End - for (const auto& v0 : V0s) { // Checking that the V0 is a true K0s/Lambdas/Antilambdas and then filling the parameter histograms and the invariant mass plots for different cuts (which are taken from namespace) if (v0.has_mcParticle()) { auto v0mcParticle = v0.mcParticle(); - // signal splitting demoninator - if (v0mcParticle.isPhysicalPrimary()) { - if (v0mcParticle.pdgCode() == kK0Short) { // kzero matched - rMCCorrections.fill(HIST("hK0ShSplitDenominatorPtSpectrum"), v0mcParticle.pt()); - } - if (v0mcParticle.pdgCode() == kLambda0) { // lambda matched - rMCCorrections.fill(HIST("hLambdaSplitDenominatorPtSpectrum"), v0mcParticle.pt()); - } - if (v0mcParticle.pdgCode() == kLambda0Bar) { // antilambda matched - rMCCorrections.fill(HIST("hAntilambdaSplitDenominatorPtSpectrum"), v0mcParticle.pt()); - } - } - // signal splitting demoninator end - if (!acceptV0(v0)) { // V0 Selections continue; } From 2ad89769edbe134d0a7b280b6266b89643661cac Mon Sep 17 00:00:00 2001 From: jaelpark Date: Wed, 20 Aug 2025 01:40:19 +0200 Subject: [PATCH 113/986] [PWGCF] CF task multiplicity correlations and outlier cuts (#12631) --- PWGCF/Tasks/correlations.cxx | 87 +++++++++++++++++++++++++++++++----- 1 file changed, 76 insertions(+), 11 deletions(-) diff --git a/PWGCF/Tasks/correlations.cxx b/PWGCF/Tasks/correlations.cxx index 0fdbb0499df..8304b0e95cc 100644 --- a/PWGCF/Tasks/correlations.cxx +++ b/PWGCF/Tasks/correlations.cxx @@ -36,12 +36,14 @@ #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -87,6 +89,8 @@ struct CorrelationTask { O2_DEFINE_CONFIGURABLE(cfgCentBinsForMC, int, 0, "0 = OFF and 1 = ON for data like multiplicity/centrality bins for MC steps"); O2_DEFINE_CONFIGURABLE(cfgTrackBitMask, uint16_t, 0, "BitMask for track selection systematics; refer to the enum TrackSelectionCuts in filtering task"); O2_DEFINE_CONFIGURABLE(cfgMultCorrelationsMask, uint16_t, 0, "Selection bitmask for the multiplicity correlations. This should match the filter selection cfgEstimatorBitMask.") + O2_DEFINE_CONFIGURABLE(cfgMultCutFormula, std::string, "", "Multiplicity correlations cut formula. A result greater than zero results in accepted event. Parameters: [cFT0C] FT0C centrality, [mFV0A] V0A multiplicity, [mGlob] global track multiplicity, [mPV] PV track multiplicity") + // Suggested values: Photon: 0.004; K0 and Lambda: 0.005 Configurable> cfgPairCut{"cfgPairCut", {kCfgPairCutDefaults[0], 5, {"Photon", "K0", "Lambda", "Phi", "Rho"}}, "Pair cuts on various particles"}; @@ -142,6 +146,9 @@ struct CorrelationTask { std::vector efficiencyAssociatedCache; std::vector p2indexCache; + std::unique_ptr multCutFormula; + std::array multCutFormulaParamIndex; + struct Config { bool mPairCuts = false; THn* mEfficiencyTrigger = nullptr; @@ -184,11 +191,11 @@ struct CorrelationTask { if (cfgMultCorrelationsMask & aod::cfmultset::CentFT0C) multAxes.emplace_back(100, 0, 100, "FT0C centrality"); if (cfgMultCorrelationsMask & aod::cfmultset::MultFV0A) - multAxes.emplace_back(100, 0, 100000, "V0A multiplicity"); + multAxes.emplace_back(10000, 0, 100000, "V0A multiplicity"); if (cfgMultCorrelationsMask & aod::cfmultset::MultNTracksPV) - multAxes.emplace_back(100, 0, 1000, "Nch PV"); + multAxes.emplace_back(1000, 0, 1000, "Nch PV"); if (cfgMultCorrelationsMask & aod::cfmultset::MultNTracksGlobal) - multAxes.emplace_back(100, 0, 1000, "Nch Global"); + multAxes.emplace_back(1000, 0, 1000, "Nch Global"); registry.add("multCorrelations", "Multiplicity correlations", {HistType::kTHnSparseF, multAxes}); } registry.add("multiplicity", "event multiplicity", {HistType::kTH1F, {{1000, 0, 100, "/multiplicity/centrality"}}}); @@ -218,6 +225,26 @@ struct CorrelationTask { // --- OBJECT INIT --- + if (!cfgMultCutFormula.value.empty()) { + multCutFormula = std::make_unique("multCutFormula", cfgMultCutFormula.value.c_str()); + std::fill_n(multCutFormulaParamIndex.begin(), std::size(multCutFormulaParamIndex), ~0u); + std::array pars = {"cFT0C", "mFV0A", "mPV", "mGlob"}; // must correspond the order of MultiplicityEstimators + for (uint i = 0, n = multCutFormula->GetNpar(); i < n; ++i) { + auto m = std::find(pars.begin(), pars.end(), multCutFormula->GetParName(i)); + if (m == pars.end()) { + + LOGF(warning, "Unknown parameter in cfgMultCutFormula: %s", multCutFormula->GetParName(i)); + continue; + } + if ((cfgMultCorrelationsMask.value & (1u << i)) == 0) { + LOGF(warning, "The centrality/multiplicity estimator %s is not available to be used in cfgMultCutFormula. Ensure cfgMultCorrelationsMask is correct and matches the CFMultSets in derived data."); + } else { + multCutFormulaParamIndex[std::distance(pars.begin(), m)] = i; + LOGF(info, "Multiplicity cut parameter %s in use.", m->c_str()); + } + } + } + std::vector corrAxis = {{axisDeltaEta, "#Delta#eta"}, {axisPtAssoc, "p_{T} (GeV/c)"}, {axisPtTrigger, "p_{T} (GeV/c)"}, @@ -426,6 +453,24 @@ struct CorrelationTask { template using HasPartDaugh1Id = decltype(std::declval().cfParticleDaugh1Id()); + /* + OO outlier cut (requires mask 15): +(567.785+172.715*[mGlob]+0.77888*[mGlob]*[mGlob]+-0.00693466*[mGlob]*[mGlob]*[mGlob]+1.40564e-05*[mGlob]*[mGlob]*[mGlob]*[mGlob] + 3.5*(679.853+66.8068*[mGlob]+-0.444332*[mGlob]*[mGlob]+0.00115002*[mGlob]*[mGlob]*[mGlob]+-4.92064e-07*[mGlob]*[mGlob]*[mGlob]*[mGlob])) > [mFV0A] && (567.785+172.715*[mGlob]+0.77888*[mGlob]*[mGlob]+-0.00693466*[mGlob]*[mGlob]*[mGlob]+1.40564e-05*[mGlob]*[mGlob]*[mGlob]*[mGlob] - 3.0*(679.853+66.8068*[mGlob]+-0.444332*[mGlob]*[mGlob]+0.00115002*[mGlob]*[mGlob]*[mGlob]+-4.92064e-07*[mGlob]*[mGlob]*[mGlob]*[mGlob])) < [mFV0A] && (172.406 + -4.50219*[cFT0C] + 0.0543038*[cFT0C]*[cFT0C] + -0.000373213*[cFT0C]*[cFT0C]*[cFT0C] + 1.15322e-06*[cFT0C]*[cFT0C]*[cFT0C]*[cFT0C] + 4.0*(49.7503 + -1.29008*[cFT0C] + 0.0160059*[cFT0C]*[cFT0C] + -7.86846e-05*[cFT0C]*[cFT0C]*[cFT0C])) > [mPV] && (172.406 + -4.50219*[cFT0C] + 0.0543038*[cFT0C]*[cFT0C] + -0.000373213*[cFT0C]*[cFT0C]*[cFT0C] + 1.15322e-06*[cFT0C]*[cFT0C]*[cFT0C]*[cFT0C] - 2.5*(49.7503 + -1.29008*[cFT0C] + 0.0160059*[cFT0C]*[cFT0C] + -7.86846e-05*[cFT0C]*[cFT0C]*[cFT0C])) < [mPV] && (125.02 + -3.30255*[cFT0C] + 0.0398663*[cFT0C]*[cFT0C] + -0.000271942*[cFT0C]*[cFT0C]*[cFT0C] + 8.34098e-07*[cFT0C]*[cFT0C]*[cFT0C]*[cFT0C] + 4.0*(37.0244 + -0.949883*[cFT0C] + 0.0116622*[cFT0C]*[cFT0C] + -5.71117e-05*[cFT0C]*[cFT0C]*[cFT0C])) > [mGlob] && (125.02 + -3.30255*[cFT0C] + 0.0398663*[cFT0C]*[cFT0C] + -0.000271942*[cFT0C]*[cFT0C]*[cFT0C] + 8.34098e-07*[cFT0C]*[cFT0C]*[cFT0C]*[cFT0C] - 2.5*(37.0244 + -0.949883*[cFT0C] + 0.0116622*[cFT0C]*[cFT0C] + -5.71117e-05*[cFT0C]*[cFT0C]*[cFT0C])) < [mGlob] && (-0.223013 + 0.715849*[mPV] + 3*(0.664242 + 0.0829653*[mPV] + -0.000503733*[mPV]*[mPV] + 1.21185e-06*[mPV]*[mPV]*[mPV])) > [mGlob] +*/ + template + bool passOutlier(CollType const& collision) + { + if (cfgMultCutFormula.value.empty()) + return true; + for (uint i = 0; i < 4; ++i) { + if ((cfgMultCorrelationsMask.value & (1u << i)) == 0 || multCutFormulaParamIndex[i] == ~0u) + continue; + auto estIndex = std::popcount(cfgMultCorrelationsMask.value & ((1u << i) - 1)); + multCutFormula->SetParameter(multCutFormulaParamIndex[i], collision.multiplicities()[estIndex]); + } + return multCutFormula->Eval() > 0.0f; + } + template std::tuple getV0Rapidity(const T& track) { @@ -770,6 +815,7 @@ struct CorrelationTask { template void processSameDerivedT(CollType const& collision, TTracks1 const& tracks1, TTracks2 const& tracks2) { + using BinningTypeDerived = ColumnBinningPolicy; BinningTypeDerived configurableBinningDerived{{axisVertex, axisMultiplicity}, true}; // true is for 'ignore overflows' (true by default). Underflows and overflows will have bin -1. if (cfgVerbosity > 0) { LOGF(info, "processSameDerivedT: Tracks for collision: %d/%d | Vertex: %.1f | Multiplicity/Centrality: %.1f", tracks1.size(), tracks2.size(), collision.posZ(), collision.multiplicity()); @@ -807,6 +853,8 @@ struct CorrelationTask { void processSameDerivedMultSet(soa::Filtered>::iterator const& collision, soa::Filtered const& tracks) { + if (!passOutlier(collision)) + return; processSameDerivedT(collision, tracks, tracks); } PROCESS_SWITCH(CorrelationTask, processSameDerivedMultSet, "Process same event on derived data with multiplicity sets", false); @@ -878,21 +926,32 @@ struct CorrelationTask { } PROCESS_SWITCH(CorrelationTask, processMixedAOD, "Process mixed events on AOD", false); - using BinningTypeDerived = ColumnBinningPolicy; - - template - void processMixedDerivedT(DerivedCollisions const& collisions, TrackTypes&&... tracks) + template + void processMixedDerivedT(CollType const& collisions, TrackTypes&&... tracks) { - BinningTypeDerived configurableBinningDerived{{axisVertex, axisMultiplicity}, true}; // true is for 'ignore overflows' (true by default). Underflows and overflows will have bin -1. - // Strictly upper categorised collisions, for cfgNoMixedEvents combinations per bin, skipping those in entry -1 + auto getMultiplicity = + [this](auto& col) { + if constexpr (std::experimental::is_detected::value) { + if (!passOutlier(col)) + return -1.0f; + } else { + (void)this; // fix compile error on unused 'this' capture + } + return col.multiplicity(); + }; + + using BinningTypeDerived = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getMultiplicity)>; + BinningTypeDerived configurableBinningDerived{{getMultiplicity}, {axisVertex, axisMultiplicity}, true}; // true is for 'ignore overflows' (true by default). Underflows and overflows will have bin -1. + // Strictly upper categorised collisions, for cfgNoMixedEvents combinations per bin, skipping those in entry -1 auto tracksTuple = std::make_tuple(std::forward(tracks)...); using TA = std::tuple_element<0, decltype(tracksTuple)>::type; using TB = std::tuple_element - 1, decltype(tracksTuple)>::type; - Pair pairs{configurableBinningDerived, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip + Pair pairs{configurableBinningDerived, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip for (auto it = pairs.begin(); it != pairs.end(); it++) { auto& [collision1, tracks1, collision2, tracks2] = *it; - int bin = configurableBinningDerived.getBin({collision1.posZ(), collision1.multiplicity()}); + float multiplicity = getMultiplicity(collision1); + int bin = configurableBinningDerived.getBin(std::tuple(collision1.posZ(), multiplicity)); float eventWeight = 1.0f / it.currentWindowNeighbours(); int field = 0; if (cfgTwoTrackCut > 0) { @@ -930,6 +989,12 @@ struct CorrelationTask { } PROCESS_SWITCH(CorrelationTask, processMixedDerived, "Process mixed events on derived data", false); + void processMixedDerivedMultSet(soa::Filtered> const& collisions, DerivedTracks const& tracks) + { + processMixedDerivedT(collisions, tracks); + } + PROCESS_SWITCH(CorrelationTask, processMixedDerivedMultSet, "Process mixed events on derived data with multiplicity sets", false); + void processMixed2ProngDerived(DerivedCollisions const& collisions, DerivedTracks const& tracks, soa::Filtered const& p2tracks) { processMixedDerivedT(collisions, p2tracks, tracks); From a14f9925e1cefde9ac63bb01509490ec89b8c9af Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Wed, 20 Aug 2025 06:13:52 +0200 Subject: [PATCH 114/986] [PWGEM/Dilepton] update taggingHFE.cxx (#12643) --- PWGEM/Dilepton/Tasks/taggingHFE.cxx | 2079 +++++++++++++++------------ 1 file changed, 1157 insertions(+), 922 deletions(-) diff --git a/PWGEM/Dilepton/Tasks/taggingHFE.cxx b/PWGEM/Dilepton/Tasks/taggingHFE.cxx index f843b20819a..b3098ef9774 100644 --- a/PWGEM/Dilepton/Tasks/taggingHFE.cxx +++ b/PWGEM/Dilepton/Tasks/taggingHFE.cxx @@ -13,52 +13,68 @@ /// \brief a task to study tagging e from charm hadron decays in MC /// \author daiki.sekihata@cern.ch -#include -#include -#include -#include -#include - -#include "Math/Vector4D.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DataFormatsCalibration/MeanVertexObject.h" -#include "CCDB/BasicCCDBManager.h" -#include "Common/Core/trackUtilities.h" -#include "CommonConstants/PhysicsConstants.h" -#include "Common/Core/TableHelper.h" -#include "Common/Core/RecoDecay.h" -#include "DCAFitter/DCAFitterN.h" +#include "PWGEM/Dilepton/Utils/MCUtilities.h" #include "PWGLF/DataModel/LFStrangenessTables.h" +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TableHelper.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" #include "Common/DataModel/CollisionAssociationTables.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/PIDResponse.h" -#include "PWGEM/Dilepton/Utils/MCUtilities.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/PhysicsConstants.h" +#include "DCAFitter/DCAFitterN.h" +#include "DataFormatsCalibration/MeanVertexObject.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +#include "Math/Vector4D.h" + +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::soa; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::constants::physics; +using namespace o2::aod::pwgem::dilepton::utils::mcutil; struct taggingHFE { - using MyCollisions = soa::Join; + using MyCollisions = soa::Join; + using MyCollisionsWithMCLabel = soa::Join; - using MyTracks = soa::Join; + using MyTracks = soa::Join; + using MyTracksWithMCLabel = soa::Join; using MyV0s = soa::Join; + using MyCascades = soa::Join; + + struct EBPair { // electron-baryon pair + float mass{-999.f}; + float dca2legs{-999.f}; + float cospa{-999.f}; + float lxy{-999.f}; + float lz{-999.f}; + float ptepv{-999.f}; + float dca3dinsigma{-999.f}; + }; // Configurables Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; @@ -72,7 +88,7 @@ struct taggingHFE { Configurable d_UseWeightedPCA{"d_UseWeightedPCA", false, "Vertices use cov matrices"}; struct : ConfigurableGroup { - std::string prefix = "electroncut_group"; + std::string prefix = "electroncut"; Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.05, "min pT for single track"}; Configurable cfg_max_pt_track{"cfg_max_pt_track", 1e+10, "max pT for single track"}; Configurable cfg_min_eta_track{"cfg_min_eta_track", -0.9, "min eta for single track"}; @@ -82,16 +98,41 @@ struct taggingHFE { Configurable cfg_min_ncrossedrows_tpc{"cfg_min_ncrossedrows_tpc", 70, "min ncrossed rows"}; Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 5, "min ncluster its"}; - Configurable cfg_min_ncluster_itsib{"cfg_min_ncluster_itsib", 1, "min ncluster itsib"}; + Configurable cfg_min_ncluster_itsib{"cfg_min_ncluster_itsib", 3, "min ncluster itsib"}; Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; Configurable cfg_max_chi2its{"cfg_max_chi2its", 5.0, "max chi2/NclsITS"}; - Configurable cfg_max_chi2tof{"cfg_max_chi2tof", 1e+10, "max chi2/NclsTOF"}; - Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 0.3, "max dca XY for single track in cm"}; - Configurable cfg_max_dcaz{"cfg_max_dcaz", 0.3, "max dca Z for single track in cm"}; - } electroncuts; + Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 1.0, "max dca XY for single track in cm"}; + Configurable cfg_max_dcaz{"cfg_max_dcaz", 1.0, "max dca Z for single track in cm"}; + Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2, "min n sigma el in TPC"}; + Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +3, "max n sigma el in TPC"}; + Configurable cfg_min_TOFNsigmaEl{"cfg_min_TOFNsigmaEl", -3, "min n sigma el in TOF"}; + Configurable cfg_max_TOFNsigmaEl{"cfg_max_TOFNsigmaEl", +3, "max n sigma el in TOF"}; + } electroncut; struct : ConfigurableGroup { - std::string prefix = "kaoncut_group"; + std::string prefix = "loose_electroncut"; + Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.05, "min pT for single track"}; + Configurable cfg_max_pt_track{"cfg_max_pt_track", 1e+10, "max pT for single track"}; + Configurable cfg_min_eta_track{"cfg_min_eta_track", -1.2, "min eta for single track"}; + Configurable cfg_max_eta_track{"cfg_max_eta_track", +1.2, "max eta for single track"}; + Configurable cfg_min_cr2findable_ratio_tpc{"cfg_min_cr2findable_ratio_tpc", 0.8, "min. TPC Ncr/Nf ratio"}; + Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; + Configurable cfg_min_ncrossedrows_tpc{"cfg_min_ncrossedrows_tpc", 40, "min ncrossed rows"}; + Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; + Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 2, "min ncluster its"}; + Configurable cfg_min_ncluster_itsib{"cfg_min_ncluster_itsib", 0, "min ncluster itsib"}; + Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; + Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; + Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 1.0, "max dca XY for single track in cm"}; + Configurable cfg_max_dcaz{"cfg_max_dcaz", 1.0, "max dca Z for single track in cm"}; + Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2, "min n sigma el in TPC"}; + Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +3, "max n sigma el in TPC"}; + Configurable cfg_min_TOFNsigmaEl{"cfg_min_TOFNsigmaEl", -3, "min n sigma el in TOF"}; + Configurable cfg_max_TOFNsigmaEl{"cfg_max_TOFNsigmaEl", +3, "max n sigma el in TOF"}; + } loose_electroncut; + + struct : ConfigurableGroup { + std::string prefix = "kaoncut"; Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.05, "min pT for single track"}; Configurable cfg_max_pt_track{"cfg_max_pt_track", 1e+10, "max pT for single track"}; Configurable cfg_min_eta_track{"cfg_min_eta_track", -1.2, "min eta for single track"}; @@ -104,62 +145,77 @@ struct taggingHFE { Configurable cfg_min_ncluster_itsib{"cfg_min_ncluster_itsib", 1, "min ncluster itsib"}; Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; - Configurable cfg_max_chi2tof{"cfg_max_chi2tof", 1e+10, "max chi2/NclsTOF"}; Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 0.5, "max dca XY for single track in cm"}; Configurable cfg_max_dcaz{"cfg_max_dcaz", 0.5, "max dca Z for single track in cm"}; Configurable cfg_min_TPCNsigmaKa{"cfg_min_TPCNsigmaKa", -3, "min n sigma ka in TPC"}; Configurable cfg_max_TPCNsigmaKa{"cfg_max_TPCNsigmaKa", +3, "max n sigma ka in TPC"}; Configurable cfg_min_TOFNsigmaKa{"cfg_min_TOFNsigmaKa", -3, "min n sigma ka in TOF"}; Configurable cfg_max_TOFNsigmaKa{"cfg_max_TOFNsigmaKa", +3, "max n sigma ka in TOF"}; - } kaoncuts; + } kaoncut; struct : ConfigurableGroup { - std::string prefix = "svcut_group"; - Configurable cfg_min_cospa{"cfg_min_cospa", 0.8, "min cospa"}; - Configurable cfg_min_cospaXY{"cfg_min_cospaXY", 0.8, "min cospaXY"}; - Configurable cfg_max_dca2legs{"cfg_max_dca2legs", 1.0, "max distance between 2 legs"}; - Configurable cfg_min_lxy{"cfg_min_lxy", -1, "min lxy for charm hadron candidate"}; - Configurable cfg_max_mass_eK{"cfg_max_mass_eK", 2.0, "max mass for eK pair"}; - Configurable cfg_max_mass_eL{"cfg_max_mass_eL", 2.3, "max mass for eL pair"}; - } svcuts; - - struct : ConfigurableGroup { - std::string prefix = "v0cut_group"; - Configurable cfg_min_mass_k0s{"cfg_min_mass_k0s", 0.485, "min mass for K0S"}; - Configurable cfg_max_mass_k0s{"cfg_max_mass_k0s", 0.510, "max mass for K0S"}; - Configurable cfg_min_mass_lambda{"cfg_min_mass_lambda", 1.11, "min mass for Lambda rejection"}; - Configurable cfg_max_mass_lambda{"cfg_max_mass_lambda", 1.12, "max mass for Lambda rejection"}; - Configurable cfg_min_cospa{"cfg_min_cospa", 0.95, "min cospa for v0hadron"}; - Configurable cfg_max_dca2legs{"cfg_max_dca2legs", 0.2, "max distance between 2 legs for v0hadron"}; + std::string prefix = "v0cut"; + Configurable cfg_min_mass_k0s_veto{"cfg_min_mass_k0s_veto", 0.47, "min mass for K0S veto"}; + Configurable cfg_max_mass_k0s_veto{"cfg_max_mass_k0s_veto", 0.52, "max mass for K0S veto"}; + Configurable cfg_min_mass_lambda{"cfg_min_mass_lambda", 1.113, "min mass for Lambda"}; + Configurable cfg_max_mass_lambda{"cfg_max_mass_lambda", 1.118, "max mass for Lambda"}; + Configurable cfg_min_cospa{"cfg_min_cospa", 0.999, "min cospa for v0hadron"}; + Configurable cfg_max_dca2legs{"cfg_max_dca2legs", 0.1, "max distance between 2 legs for v0hadron"}; // Configurable cfg_min_radius{"cfg_min_radius", 0.1, "min rxy for v0hadron"}; Configurable cfg_min_cr2findable_ratio_tpc{"cfg_min_cr2findable_ratio_tpc", 0.8, "min. TPC Ncr/Nf ratio"}; - Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; - Configurable cfg_min_ncrossedrows_tpc{"cfg_min_ncrossedrows_tpc", 40, "min ncrossed rows"}; + Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 0.7, "max fraction of shared clusters in TPC"}; + Configurable cfg_min_ncrossedrows_tpc{"cfg_min_ncrossedrows_tpc", 70, "min ncrossed rows"}; Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 2, "min ncluster its"}; Configurable cfg_min_ncluster_itsib{"cfg_min_ncluster_itsib", 0, "min ncluster itsib"}; - Configurable cfg_max_chi2tof{"cfg_max_chi2tof", 1e+10, "max chi2 for TOF"}; Configurable cfg_min_dcaxy{"cfg_min_dcaxy", 0.1, "min dca XY for v0 legs in cm"}; - Configurable cfg_min_TPCNsigmaPi{"cfg_min_TPCNsigmaPi", -3, "min n sigma pi in TPC"}; - Configurable cfg_max_TPCNsigmaPi{"cfg_max_TPCNsigmaPi", +3, "max n sigma pi in TPC"}; - Configurable cfg_min_TPCNsigmaPr{"cfg_min_TPCNsigmaPr", -3, "min n sigma pr in TPC"}; - Configurable cfg_max_TPCNsigmaPr{"cfg_max_TPCNsigmaPr", +3, "max n sigma pr in TPC"}; - Configurable cfg_min_TOFNsigmaPi{"cfg_min_TOFNsigmaPi", -3, "min n sigma pi in TOF"}; - Configurable cfg_max_TOFNsigmaPi{"cfg_max_TOFNsigmaPi", +3, "max n sigma pi in TOF"}; - Configurable cfg_min_TOFNsigmaPr{"cfg_min_TOFNsigmaPr", -3, "min n sigma pr in TOF"}; - Configurable cfg_max_TOFNsigmaPr{"cfg_max_TOFNsigmaPr", +3, "max n sigma pr in TOF"}; - } v0cuts; + Configurable cfg_min_TPCNsigmaPi{"cfg_min_TPCNsigmaPi", -2, "min n sigma pi in TPC"}; + Configurable cfg_max_TPCNsigmaPi{"cfg_max_TPCNsigmaPi", +2, "max n sigma pi in TPC"}; + Configurable cfg_min_TPCNsigmaPr{"cfg_min_TPCNsigmaPr", -2, "min n sigma pr in TPC"}; + Configurable cfg_max_TPCNsigmaPr{"cfg_max_TPCNsigmaPr", +2, "max n sigma pr in TPC"}; + Configurable cfg_min_TOFNsigmaPi{"cfg_min_TOFNsigmaPi", -2, "min n sigma pi in TOF"}; + Configurable cfg_max_TOFNsigmaPi{"cfg_max_TOFNsigmaPi", +2, "max n sigma pi in TOF"}; + Configurable cfg_min_TOFNsigmaPr{"cfg_min_TOFNsigmaPr", -2, "min n sigma pr in TOF"}; + Configurable cfg_max_TOFNsigmaPr{"cfg_max_TOFNsigmaPr", +2, "max n sigma pr in TOF"}; + } v0cut; - Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; - Configurable cfgCentMin{"cfgCentMin", -1.f, "min. centrality"}; - Configurable cfgCentMax{"cfgCentMax", 999.f, "max. centrality"}; - Configurable cfgZvtxMin{"cfgZvtxMin", -10.f, "min. Zvtx"}; - Configurable cfgZvtxMax{"cfgZvtxMax", 10.f, "max. Zvtx"}; + struct : ConfigurableGroup { + std::string prefix = "cascadecut"; + Configurable cfg_min_mass_lambda{"cfg_min_mass_lambda", 1.11, "min mass for lambda in cascade"}; + Configurable cfg_max_mass_lambda{"cfg_max_mass_lambda", 1.12, "max mass for lambda in cascade"}; + Configurable cfg_min_mass_Xi{"cfg_min_mass_Xi", 1.316, "min mass for Xi"}; + Configurable cfg_max_mass_Xi{"cfg_max_mass_Xi", 1.326, "max mass for Xi"}; + Configurable cfg_min_mass_Xi_veto{"cfg_min_mass_Xi_veto", 1.31, "min mass for Xi veto"}; + Configurable cfg_max_mass_Xi_veto{"cfg_max_mass_Xi_veto", 1.33, "max mass for Xi veto"}; + Configurable cfg_min_mass_Omega{"cfg_min_mass_Omega", 1.669, "min mass for Omega"}; + Configurable cfg_max_mass_Omega{"cfg_max_mass_Omega", 1.675, "max mass for Omega"}; + Configurable cfg_min_mass_Omega_veto{"cfg_min_mass_Omega_veto", 1.66, "min mass for Omega veto"}; + Configurable cfg_max_mass_Omega_veto{"cfg_max_mass_Omega_veto", 1.68, "max mass for Omega veto"}; + Configurable cfg_min_cospa_v0{"cfg_min_cospa_v0", 0.995, "minimum V0 CosPA in cascade"}; + Configurable cfg_max_dcadau_v0{"cfg_max_dcadau_v0", 0.1, "max distance between V0 Daughters in cascade"}; + Configurable cfg_min_cospa{"cfg_min_cospa", 0.9998, "minimum cascade CosPA"}; + Configurable cfg_max_dcadau{"cfg_max_dcadau", 0.1, "max distance between bachelor and V0"}; + Configurable cfg_min_rxy_v0{"cfg_min_rxy_v0", 1.2, "minimum V0 rxy in cascade"}; + Configurable cfg_min_rxy{"cfg_min_rxy", 0.5, "minimum V0 rxy in cascade"}; + Configurable cfg_min_dcaxy_v0leg{"cfg_min_dcaxy_v0leg", 0.1, "min dca XY for v0 legs in cm"}; + Configurable cfg_min_dcaxy_bachelor{"cfg_min_dcaxy_bachelor", 0.05, "min dca XY for bachelor in cm"}; + Configurable cfg_min_dcaxy_v0{"cfg_min_dcaxy_v0", 0.05, "min dca XY for V0 in cm"}; + } cascadecut; - Configurable cfgEventGeneratorType{"cfgEventGeneratorType", -1, "if positive, select event generator type. i.e. gap or signal"}; + struct : ConfigurableGroup { + std::string prefix = "eventcut"; + Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; + Configurable cfgCentMin{"cfgCentMin", -1.f, "min. centrality"}; + Configurable cfgCentMax{"cfgCentMax", 999.f, "max. centrality"}; + Configurable cfgZvtxMin{"cfgZvtxMin", -10.f, "min. Zvtx"}; + Configurable cfgZvtxMax{"cfgZvtxMax", 10.f, "max. Zvtx"}; + Configurable cfgEventGeneratorType{"cfgEventGeneratorType", -1, "if positive, select event generator type. i.e. gap or signal"}; + } eventcut; + + Configurable cfgMeeMaxPF{"cfgMeeMaxPF", 0.08, "max mee for prefilter to reject pi0->ee and gamma->ee in LMR"}; HistogramRegistry fRegistry{"fRegistry"}; static constexpr std::string_view hadron_names[6] = {"LF/", "Jpsi/", "D0/", "Dpm/", "Ds/", "Lc/"}; @@ -169,9 +225,9 @@ struct taggingHFE { void init(o2::framework::InitContext&) { - if (doprocessSA && doprocessTTCA) { - LOGF(fatal, "Cannot enable doprocessWithoutFTTCA and doprocessWithFTTCA at the same time. Please choose one."); - } + // if (doprocessSA && doprocessTTCA) { + // LOGF(fatal, "Cannot enable doprocessWithoutFTTCA and doprocessWithFTTCA at the same time. Please choose one."); + // } ccdb->setURL(ccdburl); ccdb->setCaching(true); @@ -276,80 +332,97 @@ struct taggingHFE { fRegistry.add("Event/hCentFT0CvsMultNTracksPV", "hCentFT0CvsMultNTracksPV;centrality FT0C (%);N_{track} to PV", kTH2F, {{110, 0, 110}, {600, 0, 6000}}, false); fRegistry.add("Event/hMultFT0CvsMultNTracksPV", "hMultFT0CvsMultNTracksPV;mult. FT0C;N_{track} to PV", kTH2F, {{60, 0, 60000}, {600, 0, 6000}}, false); - // for charm hadrons - fRegistry.add("e_Kpm/all/hLxy", "decay length XY from PV;L_{xy} (cm)", kTH1F, {{500, 0, 0.5}}, false); - fRegistry.add("e_Kpm/all/hLz", "decay length Z from PV;L_{z} (cm)", kTH1F, {{500, 0, 0.5}}, false); - fRegistry.add("e_Kpm/all/hCosPA", "cosPA;cosine of pointing angle", kTH1F, {{200, 0.8, 1}}, false); - fRegistry.add("e_Kpm/all/hCosPAXY", "cosPA in XY;cosine of pointing angle in XY", kTH1F, {{200, 0.8, 1}}, false); - fRegistry.add("e_Kpm/all/hDCA2Legs", "distance between 2 legs;distance between 2 legs (cm)", kTH1F, {{500, 0, 0.5}}, false); - fRegistry.add("e_Kpm/all/hMass", "mass;mass (GeV/c^{2})", kTH1F, {{200, 0.5, 2.5}}, false); - fRegistry.add("e_Kpm/all/hMass_CosPA", "mass vs. cosPA;mass (GeV/c^{2});cosine of pointing angle", kTH2F, {{200, 0.5, 2.5}, {200, 0.8, 1.0}}, false); - fRegistry.add("e_Kpm/all/hDeltaEtaDeltaPhi", "#Delta#varphi vs. #Delta#eta;#Delta#varphi = #varphi_{h} - #varphi_{e} (rad.);#Delta#eta = #eta_{h} - #eta_{e}", kTH2F, {{180, -M_PI, M_PI}, {200, -2, +2}}, false); - fRegistry.add("e_Kpm/all/hRelDeltaPt", "rel delta pT;(p_{T,h} - p_{T,e})/p_{T,e}", kTH1F, {{80, -2, +2}}, false); - fRegistry.add("e_Kpm/all/hProdDCAxy", "product of DCAxy;d_{xy}^{e} #times d_{xy}^{h} (#sigma)^{2}", kTH1F, {{200, -100, +100}}, false); - fRegistry.add("e_Kpm/all/hCorrelationDCAxy", "correlation of DCAxy;DCA^{xy}_{e} (#sigma);DCA^{xy}_{h} (#sigma)", kTH2F, {{200, -10, +10}, {200, -10, +10}}, false); - fRegistry.add("e_Kpm/all/hCorrelationDCAz", "correlation of DCAz;DCA^{z}_{e} (#sigma);DCA^{z}_{h} (#sigma)", kTH2F, {{200, -10, +10}, {200, -10, +10}}, false); - - fRegistry.addClone("e_Kpm/all/", "e_Kpm/D0/"); - fRegistry.addClone("e_Kpm/all/", "e_Kpm/Dpm/"); - fRegistry.addClone("e_Kpm/all/", "e_Kpm/Ds/"); - fRegistry.addClone("e_Kpm/all/", "e_Kpm/fake/"); - - fRegistry.addClone("e_Kpm/all/", "e_K0S/all/"); - fRegistry.addClone("e_Kpm/all/", "e_K0S/D0/"); - fRegistry.addClone("e_Kpm/all/", "e_K0S/Dpm/"); - fRegistry.addClone("e_Kpm/all/", "e_K0S/Ds/"); - fRegistry.addClone("e_Kpm/all/", "e_K0S/fake/"); - - fRegistry.addClone("e_Kpm/all/", "e_Lambda/all/"); - fRegistry.addClone("e_Kpm/all/", "e_Lambda/Lc/"); - fRegistry.addClone("e_Kpm/all/", "e_Lambda/fake/"); - - // for V0s - fRegistry.add("V0/K0S/hPt", "pT of V0;p_{T} (GeV/c)", kTH1F, {{100, 0, 10}}, false); - fRegistry.add("V0/K0S/hYPhi", "Y vs. #varphi of V0;#varphi (rad.);rapidity", kTH2F, {{36, 0, 2 * M_PI}, {80, -2, +2}}, false); - fRegistry.add("V0/K0S/hAP", "Ap plot;#alpha;q_{T} (GeV/c)", kTH2F, {{200, -1, 1}, {250, 0, 0.25}}, false); - fRegistry.add("V0/K0S/hLxy", "decay length from PV;L_{xy} (cm)", kTH1F, {{100, 0, 10}}, false); - fRegistry.add("V0/K0S/hCosPA", "cosPA;cosine of pointing angle", kTH1F, {{100, 0.9, 1}}, false); - fRegistry.add("V0/K0S/hDCA2Legs", "distance between 2 legs;distance between 2 legs (cm)", kTH1F, {{100, 0, 1}}, false); - fRegistry.addClone("V0/K0S/", "V0/Lambda/"); - fRegistry.addClone("V0/K0S/", "V0/AntiLambda/"); - fRegistry.add("V0/K0S/hMassK0S", "K0S mass;m_{#pi#pi} (GeV/c^{2})", kTH1F, {{100, 0.45, 0.55}}, false); - fRegistry.add("V0/Lambda/hMassLambda", "Lambda mass;m_{p#pi} (GeV/c^{2})", kTH1F, {{100, 1.08, 1.18}}, false); - fRegistry.add("V0/AntiLambda/hMassAntiLambda", "Anti-Lambda mass;m_{p#pi} (GeV/c^{2})", kTH1F, {{100, 1.08, 1.18}}, false); - - const AxisSpec axis_pt{{0, 0.05, 0.1, 0.15, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 6, 7, 8, 9, 10}, "p_{T,e} (GeV/c)"}; - const AxisSpec axis_dca_sigma{{0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7, 7.5, 8, 8.5, 9, 9.5, 10}, "DCA_{e}^{3D} (#sigma)"}; - - // for tracks - fRegistry.add("LF/electron/prompt/findable/hs", "electron;p_{T,e} (GeV/c);#eta_{e};#varphi_{e} (rad.);DCA_{e}^{3D} (#sigma)", kTHnSparseF, {{axis_pt}, {80, -2, +2}, {36, 0, 2 * M_PI}, {axis_dca_sigma}}, false); - fRegistry.add("LF/electron/prompt/findable/hTPCdEdx", "TPC dE/dx;p_{in} (GeV/c);TPC dE/dx (a.u.)", kTH2F, {{1000, 0, 10}, {200, 0, 200}}, false); - fRegistry.add("LF/electron/prompt/findable/hTOFbeta", "TOF #beta;p_{pv} (GeV/c);#beta", kTH2F, {{1000, 0, 10}, {240, 0, 1.2}}, false); - - fRegistry.addClone("LF/electron/prompt/findable/", "LF/electron/prompt/correct/"); - fRegistry.addClone("LF/electron/prompt/findable/", "LF/electron/prompt/fake/"); - fRegistry.addClone("LF/electron/prompt/", "LF/electron/nonprompt/"); - fRegistry.addClone("LF/electron/", "Jpsi/electron/"); - - fRegistry.addClone("LF/electron/", "D0/electron/"); // D0 -> K- e+ nu, Br = 0.03549 | D0 -> K- e+ pi0 nu, Br = 0.016 | D0 -> K*(892)- e+ nu, Br = 0.0215 // D0 -> anti-K0S e+ pi- nu, Br = 0.0144 - fRegistry.addClone("LF/electron/", "Dpm/electron/"); // D+ -> K- pi+ e+ nu, Br = 0.0402 | D+ -> anti-K*(892)0 e+ nu, Br = 0.0540 // D+ -> anti-K0S e+ nu, Br = 0.0872 - fRegistry.addClone("LF/electron/", "Ds/electron/"); // Ds+ -> K0S e+ nu, Br = 0.0034 // Ds+ -> phi e+ nu, Br = 0.0239 - fRegistry.addClone("LF/electron/", "Lc/electron/"); // Lc+ -> L e+ nu, Br = 0.0356 - - fRegistry.addClone("D0/electron/", "D0/kaon/"); // D0 -> K- e+ nu, Br = 0.03549 | D0 -> K- e+ pi0 nu, Br = 0.016 | D0 -> K*(892)- e+ nu, Br = 0.0215 // D0 -> anti-K0S e+ pi- nu, Br = 0.0144 - fRegistry.addClone("Dpm/electron/", "Dpm/kaon/"); // D+ -> K- pi+ e+ nu, Br = 0.0402 | D+ -> anti-K*(892)0 e+ nu, Br = 0.0540 // D+ -> anti-K0S e+ nu, Br = 0.0872 - fRegistry.addClone("Ds/electron/", "Ds/kaon/"); // Ds+ -> K0S e+ nu, Br = 0.0034 // Ds+ -> phi e+ nu, Br = 0.0239 - - fRegistry.add("Generated/D0/prompt/hs", "#eta correlation from charm hadron;p_{T,e} (GeV/c);p_{T,K} (GeV/c);#eta_{e};#eta_{K};", kTHnSparseF, {{100, 0, 10}, {100, 0, 10}, {200, -10, +10}, {200, -10, 10}}, false); - fRegistry.addClone("Generated/D0/prompt/", "Generated/D0/nonprompt/"); + fRegistry.add("Prefilter/before/uls/hMee", "hMee;m_{ee} (GeV/c^{2});", kTH1F, {{500, 0, 5}}, false); + fRegistry.addClone("Prefilter/before/uls/", "Prefilter/before/lspp/"); + fRegistry.addClone("Prefilter/before/uls/", "Prefilter/before/lsmm/"); + fRegistry.addClone("Prefilter/before/", "Prefilter/after/"); + + // electron-related histograms + fRegistry.add("Data/electron/hs", "hs;p_{T,e} (GeV/c);#eta_{e};#varphi_{e} (rad.);DCA_{e}^{3D} (#sigma);", kTHnSparseF, {{100, 0, 10}, {20, -1, +1}, {90, 0, 2 * M_PI}, {100, 0, 10}}, false); + fRegistry.addClone("Data/electron/", "MC/eFromPromptLF/"); + fRegistry.addClone("Data/electron/", "MC/eFromNonPromptLF/"); + fRegistry.addClone("Data/electron/", "MC/eFromPromptJpsi/"); + fRegistry.addClone("Data/electron/", "MC/eFromNonPromptJpsi/"); + fRegistry.addClone("Data/electron/", "MC/eFromPromptD0/"); + fRegistry.addClone("Data/electron/", "MC/eFromPromptDpm/"); + fRegistry.addClone("Data/electron/", "MC/eFromPromptDs/"); + fRegistry.addClone("Data/electron/", "MC/eFromPromptLcpm/"); + fRegistry.addClone("Data/electron/", "MC/eFromPromptXic0/"); + // fRegistry.addClone("Data/electron/", "MC/eFromPromptXicpm/"); // cannot be detected + fRegistry.addClone("Data/electron/", "MC/eFromPromptOmegac0/"); + fRegistry.addClone("Data/electron/", "MC/eFromNonPromptD0/"); + fRegistry.addClone("Data/electron/", "MC/eFromNonPromptDpm/"); + fRegistry.addClone("Data/electron/", "MC/eFromNonPromptDs/"); + fRegistry.addClone("Data/electron/", "MC/eFromNonPromptLcpm/"); + fRegistry.addClone("Data/electron/", "MC/eFromNonPromptXic0/"); + // fRegistry.addClone("Data/electron/", "MC/eFromNonPromptXicpm/"); // cannot be detected + fRegistry.addClone("Data/electron/", "MC/eFromNonPromptOmegac0/"); + fRegistry.addClone("Data/electron/", "MC/eFromB0/"); + fRegistry.addClone("Data/electron/", "MC/eFromBpm/"); + fRegistry.addClone("Data/electron/", "MC/eFromBs/"); + fRegistry.addClone("Data/electron/", "MC/eFromBc/"); + fRegistry.addClone("Data/electron/", "MC/eFromLb0/"); + + // for V0 (Lambda) + fRegistry.add("Data/V0/hPt", "pT of V0;p_{T} (GeV/c)", kTH1F, {{100, 0, 10}}, false); + fRegistry.add("Data/V0/hYPhi", "rapidity vs. #varphi of V0;#varphi (rad.);rapidity_{#Lambda}", kTH2F, {{90, 0, 2 * M_PI}, {80, -2, +2}}, false); + fRegistry.add("Data/V0/hAP", "Ap plot;#alpha;q_{T} (GeV/c)", kTH2F, {{200, -1, 1}, {250, 0, 0.25}}, false); + fRegistry.add("Data/V0/hLxy", "decay length from PV;L_{xy} (cm)", kTH1F, {{100, 0, 10}}, false); + fRegistry.add("Data/V0/hCosPA", "cosPA;cosine of pointing angle", kTH1F, {{100, 0.99, 1}}, false); + fRegistry.add("Data/V0/hDCA2Legs", "distance between 2 legs at PCA;distance between 2 legs (cm)", kTH1F, {{100, 0, 1}}, false); + fRegistry.add("Data/V0/hMassK0S", "K0S mass;m_{#pi#pi} (GeV/c^{2})", kTH1F, {{100, 0.45, 0.55}}, false); + fRegistry.add("Data/V0/hMassLambda", "Lambda mass;m_{p#pi^{-}} (GeV/c^{2})", kTH1F, {{100, 1.08, 1.18}}, false); + fRegistry.add("Data/V0/hMassAntiLambda", "Anti-Lambda mass;m_{#bar{p}#pi^{+}} (GeV/c^{2})", kTH1F, {{100, 1.08, 1.18}}, false); + + // for cascade + fRegistry.add("Data/Cascade/hPt", "pT of V0;p_{T} (GeV/c)", kTH1F, {{100, 0, 10}}, false); + fRegistry.add("Data/Cascade/hYPhi", "rapidity vs. #varphi of V0;#varphi (rad.);rapidity_{#Lambda}", kTH2F, {{90, 0, 2 * M_PI}, {80, -2, +2}}, false); + fRegistry.add("Data/Cascade/hCosPA", "cosPA;cosine of pointing angle", kTH1F, {{100, 0.99, 1}}, false); + fRegistry.add("Data/Cascade/hDCA2Legs", "distance between 2 legs at PCA;distance between 2 legs (cm)", kTH1F, {{100, 0, 1}}, false); + fRegistry.add("Data/Cascade/hV0CosPA", "cosPA of V0 in cascade;cosine of pointing angle", kTH1F, {{100, 0.99, 1}}, false); + fRegistry.add("Data/Cascade/hV0DCA2Legs", "distance between 2 legs at PCA of V0 in cascade;distance between 2 legs (cm)", kTH1F, {{100, 0, 1}}, false); + + fRegistry.add("Data/Cascade/hMassLambda", "Lambda mass;m_{p#pi^{-}} (GeV/c^{2})", kTH1F, {{100, 1.08, 1.18}}, false); + fRegistry.add("Data/Cascade/hMassXi", "#Xi mass;m_{#Lambda#pi} (GeV/c^{2})", kTH1F, {{100, 1.27, 1.37}}, false); + fRegistry.add("Data/Cascade/hMassOmega", "#Omega mass;m_{#LambdaK} (GeV/c^{2})", kTH1F, {{100, 1.62, 1.72}}, false); + + // for e-L pair + fRegistry.add("Data/eL/RS/hs", "hs;m_{e#Lambda} (GeV/c^{2});p_{T,e} (GeV/c);DCA_{e}^{3D} (#sigma);L_{xy} (cm);", kTHnSparseF, {{20, 1.1, 3.1}, {100, 0, 10}, {100, 0, 10}, {500, 0, 0.5}}, false); + fRegistry.add("Data/eL/RS/hCosPA", "cos PA;cosPA", kTH1F, {{100, 0.99, 1.0}}, false); + fRegistry.add("Data/eL/RS/hDCA2Legs", "distance between 2 legs at PCA;distance between 2 legs at PCA (cm)", kTH1F, {{500, 0.0, 0.5}}, false); + fRegistry.add("Data/eL/RS/hLxy", "distance between PV and SV in XY;L_{xy} (cm)", kTH1F, {{500, 0.0, 0.5}}, false); + fRegistry.add("Data/eL/RS/hLz", "distance between PV and SV in Z;L_{z} (cm)", kTH1F, {{500, 0.0, 0.5}}, false); + fRegistry.addClone("Data/eL/RS/", "Data/eL/WS/"); // right and wrong sign + fRegistry.addClone("Data/eL/RS/", "MC/eLfromPromptLcpm/"); + fRegistry.addClone("Data/eL/RS/", "MC/eLfromNonPromptLcpm/"); + + // for e-Xi pair + fRegistry.add("Data/eXi/RS/hs", "hs;m_{e#Xi} (GeV/c^{2});p_{T,e} (GeV/c);DCA_{e}^{3D} (#sigma);L_{xy} (cm);", kTHnSparseF, {{20, 1.1, 3.1}, {100, 0, 10}, {100, 0, 10}, {500, 0, 0.5}}, false); + fRegistry.add("Data/eXi/RS/hCosPA", "cos PA;cosPA", kTH1F, {{100, 0.99, 1.0}}, false); + fRegistry.add("Data/eXi/RS/hDCA2Legs", "distance between 2 legs at PCA;distance between 2 legs at PCA (cm)", kTH1F, {{500, 0.0, 0.5}}, false); + fRegistry.add("Data/eXi/RS/hLxy", "distance between PV and SV in XY;L_{xy} (cm)", kTH1F, {{500, 0.0, 0.5}}, false); + fRegistry.add("Data/eXi/RS/hLz", "distance between PV and SV in Z;L_{z} (cm)", kTH1F, {{500, 0.0, 0.5}}, false); + fRegistry.addClone("Data/eXi/RS/", "Data/eXi/WS/"); // right and wrong sign + fRegistry.addClone("Data/eXi/RS/", "MC/eXifromPromptXic0/"); + fRegistry.addClone("Data/eXi/RS/", "MC/eXifromNonPromptXic0/"); + + // for e-Omega pair + fRegistry.add("Data/eOmega/RS/hs", "hs;m_{e#Omega} (GeV/c^{2});p_{T,e} (GeV/c);DCA_{e}^{3D} (#sigma);L_{xy} (cm);", kTHnSparseF, {{20, 1.1, 3.1}, {100, 0, 10}, {100, 0, 10}, {500, 0, 0.5}}, false); + fRegistry.add("Data/eOmega/RS/hCosPA", "cos PA;cosPA", kTH1F, {{100, 0.99, 1.0}}, false); + fRegistry.add("Data/eOmega/RS/hDCA2Legs", "distance between 2 legs at PCA;distance between 2 legs at PCA (cm)", kTH1F, {{500, 0.0, 0.5}}, false); + fRegistry.add("Data/eOmega/RS/hLxy", "distance between PV and SV in XY;L_{xy} (cm)", kTH1F, {{500, 0.0, 0.5}}, false); + fRegistry.add("Data/eOmega/RS/hLz", "distance between PV and SV in Z;L_{z} (cm)", kTH1F, {{500, 0.0, 0.5}}, false); + fRegistry.addClone("Data/eOmega/RS/", "Data/eOmega/WS/"); // right and wrong sign + fRegistry.addClone("Data/eOmega/RS/", "MC/eOmegafromPromptOmegac0/"); + fRegistry.addClone("Data/eOmega/RS/", "MC/eOmegafromNonPromptOmegac0/"); } template bool isKaon(TTrack const& track) { // TOFif - bool is_ka_included_TPC = kaoncuts.cfg_min_TPCNsigmaKa < track.tpcNSigmaKa() && track.tpcNSigmaKa() < kaoncuts.cfg_max_TPCNsigmaKa; - bool is_ka_included_TOF = track.hasTOF() ? (kaoncuts.cfg_min_TOFNsigmaKa < track.tofNSigmaKa() && track.tofNSigmaKa() < kaoncuts.cfg_max_TOFNsigmaKa && track.tofChi2() < kaoncuts.cfg_max_chi2tof) : true; + bool is_ka_included_TPC = kaoncut.cfg_min_TPCNsigmaKa < track.tpcNSigmaKa() && track.tpcNSigmaKa() < kaoncut.cfg_max_TPCNsigmaKa; + bool is_ka_included_TOF = track.hasTOF() ? (kaoncut.cfg_min_TOFNsigmaKa < track.tofNSigmaKa() && track.tofNSigmaKa() < kaoncut.cfg_max_TOFNsigmaKa) : true; return is_ka_included_TPC && is_ka_included_TOF; } @@ -357,8 +430,8 @@ struct taggingHFE { bool isPion(TTrack const& track) { // TOFif - bool is_pi_included_TPC = v0cuts.cfg_min_TPCNsigmaPi < track.tpcNSigmaPi() && track.tpcNSigmaPi() < v0cuts.cfg_max_TPCNsigmaPi; - bool is_pi_included_TOF = track.hasTOF() ? (v0cuts.cfg_min_TOFNsigmaPi < track.tofNSigmaPi() && track.tofNSigmaPi() < v0cuts.cfg_max_TOFNsigmaPi && track.tofChi2() < v0cuts.cfg_max_chi2tof) : true; + bool is_pi_included_TPC = v0cut.cfg_min_TPCNsigmaPi < track.tpcNSigmaPi() && track.tpcNSigmaPi() < v0cut.cfg_max_TPCNsigmaPi; + bool is_pi_included_TOF = track.hasTOF() ? (v0cut.cfg_min_TOFNsigmaPi < track.tofNSigmaPi() && track.tofNSigmaPi() < v0cut.cfg_max_TOFNsigmaPi) : true; return is_pi_included_TPC && is_pi_included_TOF; } @@ -366,63 +439,76 @@ struct taggingHFE { bool isProton(TTrack const& track) { // TOFif - bool is_pr_included_TPC = v0cuts.cfg_min_TPCNsigmaPr < track.tpcNSigmaPr() && track.tpcNSigmaPr() < v0cuts.cfg_max_TPCNsigmaPr; - bool is_pr_included_TOF = track.hasTOF() ? (v0cuts.cfg_min_TOFNsigmaPr < track.tofNSigmaPr() && track.tofNSigmaPr() < v0cuts.cfg_max_TOFNsigmaPr && track.tofChi2() < v0cuts.cfg_max_chi2tof) : true; + bool is_pr_included_TPC = v0cut.cfg_min_TPCNsigmaPr < track.tpcNSigmaPr() && track.tpcNSigmaPr() < v0cut.cfg_max_TPCNsigmaPr; + bool is_pr_included_TOF = track.hasTOF() ? (v0cut.cfg_min_TOFNsigmaPr < track.tofNSigmaPr() && track.tofNSigmaPr() < v0cut.cfg_max_TOFNsigmaPr) : true; return is_pr_included_TPC && is_pr_included_TOF; } + template + bool isElectron(TTrack const& track) + { + // TOFif + bool is_el_included_TPC = electroncut.cfg_min_TPCNsigmaEl < track.tpcNSigmaEl() && track.tpcNSigmaEl() < electroncut.cfg_max_TPCNsigmaEl; + bool is_el_included_TOF = track.hasTOF() ? (electroncut.cfg_min_TOFNsigmaEl < track.tofNSigmaEl() && track.tofNSigmaEl() < electroncut.cfg_max_TOFNsigmaEl) : true; + return is_el_included_TPC && is_el_included_TOF; + } + template - bool isSelectedTrackForElectron(TTrack const& track, TTrackParCov const& trackParCov, const float dcaXY, const float dcaZ) + bool isSelectedElectron(TTrack const& track, TTrackParCov const& trackParCov, const float dcaXY, const float dcaZ) { if (!track.hasITS() || !track.hasTPC()) { return false; } - if (trackParCov.getPt() < electroncuts.cfg_min_pt_track || electroncuts.cfg_max_pt_track < trackParCov.getPt()) { + if (trackParCov.getPt() < electroncut.cfg_min_pt_track || electroncut.cfg_max_pt_track < trackParCov.getPt()) { return false; } - if (trackParCov.getEta() < electroncuts.cfg_min_eta_track || electroncuts.cfg_max_eta_track < trackParCov.getEta()) { + if (trackParCov.getEta() < electroncut.cfg_min_eta_track || electroncut.cfg_max_eta_track < trackParCov.getEta()) { return false; } - if (std::fabs(dcaXY) > electroncuts.cfg_max_dcaxy) { + if (std::fabs(dcaXY) > electroncut.cfg_max_dcaxy) { return false; } - if (std::fabs(dcaZ) > electroncuts.cfg_max_dcaz) { + if (std::fabs(dcaZ) > electroncut.cfg_max_dcaz) { return false; } - if (track.itsChi2NCl() > electroncuts.cfg_max_chi2its) { + if (track.itsChi2NCl() < 0.f || electroncut.cfg_max_chi2its < track.itsChi2NCl()) { return false; } - if (track.itsNCls() < electroncuts.cfg_min_ncluster_its) { + if (track.itsNCls() < electroncut.cfg_min_ncluster_its) { return false; } - if (track.itsNClsInnerBarrel() < electroncuts.cfg_min_ncluster_itsib) { + if (track.itsNClsInnerBarrel() < electroncut.cfg_min_ncluster_itsib) { return false; } - if (track.tpcChi2NCl() > electroncuts.cfg_max_chi2tpc) { + if (track.tpcChi2NCl() < 0.f || electroncut.cfg_max_chi2tpc < track.tpcChi2NCl()) { return false; } - if (track.tpcNClsFound() < electroncuts.cfg_min_ncluster_tpc) { + if (track.tpcNClsFound() < electroncut.cfg_min_ncluster_tpc) { return false; } - if (track.tpcNClsCrossedRows() < electroncuts.cfg_min_ncrossedrows_tpc) { + if (track.tpcNClsCrossedRows() < electroncut.cfg_min_ncrossedrows_tpc) { return false; } - if (track.tpcCrossedRowsOverFindableCls() < electroncuts.cfg_min_cr2findable_ratio_tpc) { + if (track.tpcCrossedRowsOverFindableCls() < electroncut.cfg_min_cr2findable_ratio_tpc) { return false; } - if (track.tpcFractionSharedCls() > electroncuts.cfg_max_frac_shared_clusters_tpc) { + if (track.tpcFractionSharedCls() > electroncut.cfg_max_frac_shared_clusters_tpc) { + return false; + } + + if (!isElectron(track)) { return false; } @@ -430,103 +516,135 @@ struct taggingHFE { } template - bool isSelectedTrackForKaon(TTrack const& track, TTrackParCov const& trackParCov, const float dcaXY, const float dcaZ) + bool isSelectedElectronLoose(TTrack const& track, TTrackParCov const& trackParCov, const float dcaXY, const float dcaZ) { - if (!track.hasITS() || !track.hasTPC()) { + if (!track.hasITS()) { return false; } - if (trackParCov.getPt() < kaoncuts.cfg_min_pt_track || kaoncuts.cfg_max_pt_track < trackParCov.getPt()) { + if (trackParCov.getPt() < loose_electroncut.cfg_min_pt_track || loose_electroncut.cfg_max_pt_track < trackParCov.getPt()) { return false; } - if (trackParCov.getEta() < kaoncuts.cfg_min_eta_track || kaoncuts.cfg_max_eta_track < trackParCov.getEta()) { + if (trackParCov.getEta() < loose_electroncut.cfg_min_eta_track || loose_electroncut.cfg_max_eta_track < trackParCov.getEta()) { return false; } - if (std::fabs(dcaXY) > kaoncuts.cfg_max_dcaxy) { + if (std::fabs(dcaXY) > loose_electroncut.cfg_max_dcaxy) { return false; } - if (std::fabs(dcaZ) > kaoncuts.cfg_max_dcaz) { + if (std::fabs(dcaZ) > loose_electroncut.cfg_max_dcaz) { return false; } - if (track.itsChi2NCl() > kaoncuts.cfg_max_chi2its) { + if (loose_electroncut.cfg_max_chi2its < track.itsChi2NCl()) { return false; } - if (track.itsNCls() < kaoncuts.cfg_min_ncluster_its) { + if (track.itsNCls() < loose_electroncut.cfg_min_ncluster_its) { return false; } - if (track.itsNClsInnerBarrel() < kaoncuts.cfg_min_ncluster_itsib) { + if (track.itsNClsInnerBarrel() < loose_electroncut.cfg_min_ncluster_itsib) { return false; } - if (track.tpcChi2NCl() > kaoncuts.cfg_max_chi2tpc) { - return false; - } + if (track.hasTPC()) { + if (loose_electroncut.cfg_max_chi2tpc < track.tpcChi2NCl()) { + return false; + } - if (track.tpcNClsFound() < kaoncuts.cfg_min_ncluster_tpc) { - return false; - } + if (track.tpcNClsFound() < loose_electroncut.cfg_min_ncluster_tpc) { + return false; + } - if (track.tpcNClsCrossedRows() < kaoncuts.cfg_min_ncrossedrows_tpc) { - return false; - } + if (track.tpcNClsCrossedRows() < loose_electroncut.cfg_min_ncrossedrows_tpc) { + return false; + } - if (track.tpcCrossedRowsOverFindableCls() < kaoncuts.cfg_min_cr2findable_ratio_tpc) { - return false; - } + if (track.tpcCrossedRowsOverFindableCls() < loose_electroncut.cfg_min_cr2findable_ratio_tpc) { + return false; + } - if (track.tpcFractionSharedCls() > kaoncuts.cfg_max_frac_shared_clusters_tpc) { - return false; + if (track.tpcFractionSharedCls() > loose_electroncut.cfg_max_frac_shared_clusters_tpc) { + return false; + } + + if (!isElectron(track)) { + return false; + } } return true; } - template - bool isSelectedV0Leg(TTrack const& track, const float dcaXY) + template + bool isLambda(TV0 const& v0) { - if (!track.hasITS() || !track.hasTPC()) { - return false; + return (v0cut.cfg_min_mass_lambda < v0.mLambda() && v0.mLambda() < v0cut.cfg_max_mass_lambda) && (v0.mK0Short() < v0cut.cfg_min_mass_k0s_veto || v0cut.cfg_max_mass_k0s_veto < v0.mK0Short()); + } + + template + bool isAntiLambda(TV0 const& v0) + { + return (v0cut.cfg_min_mass_lambda < v0.mAntiLambda() && v0.mAntiLambda() < v0cut.cfg_max_mass_lambda) && (v0.mK0Short() < v0cut.cfg_min_mass_k0s_veto || v0cut.cfg_max_mass_k0s_veto < v0.mK0Short()); + } + + template + bool isXi(TCascade const& cascade) + { + return (cascadecut.cfg_min_mass_Xi < cascade.mXi() && cascade.mXi() < cascadecut.cfg_max_mass_Xi) && (cascade.mOmega() < cascadecut.cfg_min_mass_Omega_veto || cascadecut.cfg_max_mass_Omega_veto < cascade.mOmega()); + } + + template + bool isOmega(TCascade const& cascade) + { + return (cascadecut.cfg_min_mass_Omega < cascade.mOmega() && cascade.mOmega() < cascadecut.cfg_max_mass_Omega) && (cascade.mXi() < cascadecut.cfg_min_mass_Xi || cascadecut.cfg_max_mass_Xi < cascade.mXi()); + } + + template + bool isSelectedV0Leg(TTrack const& track) + { + if constexpr (isMC) { + if (!track.has_mcParticle()) { + return false; + } } - if (std::fabs(dcaXY) < v0cuts.cfg_min_dcaxy) { + if (!track.hasITS() || !track.hasTPC()) { return false; } - if (track.itsChi2NCl() > v0cuts.cfg_max_chi2its) { + if (track.itsChi2NCl() > v0cut.cfg_max_chi2its) { return false; } - if (track.itsNCls() < v0cuts.cfg_min_ncluster_its) { + if (track.itsNCls() < v0cut.cfg_min_ncluster_its) { return false; } - if (track.itsNClsInnerBarrel() < v0cuts.cfg_min_ncluster_itsib) { + if (track.itsNClsInnerBarrel() < v0cut.cfg_min_ncluster_itsib) { return false; } - if (track.tpcChi2NCl() > v0cuts.cfg_max_chi2tpc) { + if (track.tpcChi2NCl() > v0cut.cfg_max_chi2tpc) { return false; } - if (track.tpcNClsFound() < v0cuts.cfg_min_ncluster_tpc) { + if (track.tpcNClsFound() < v0cut.cfg_min_ncluster_tpc) { return false; } - if (track.tpcNClsCrossedRows() < v0cuts.cfg_min_ncrossedrows_tpc) { + if (track.tpcNClsCrossedRows() < v0cut.cfg_min_ncrossedrows_tpc) { return false; } - if (track.tpcCrossedRowsOverFindableCls() < v0cuts.cfg_min_cr2findable_ratio_tpc) { + if (track.tpcCrossedRowsOverFindableCls() < v0cut.cfg_min_cr2findable_ratio_tpc) { return false; } - if (track.tpcFractionSharedCls() > v0cuts.cfg_max_frac_shared_clusters_tpc) { + if (track.tpcFractionSharedCls() > v0cut.cfg_max_frac_shared_clusters_tpc) { return false; } @@ -547,777 +665,906 @@ struct taggingHFE { fRegistry.fill(HIST("Event/hMultFT0CvsMultNTracksPV"), collision.multFT0C(), collision.multNTracksPV()); } - template - void fillElectronHistograms(TTrack const& track, TTrackParCov const& trackParCov, const float dcaXY, const float dcaZ) + template + void fillV0Histograms(TV0 const& v0) { - if (std::find(used_electronIds.begin(), used_electronIds.end(), std::make_pair(findId, track.globalIndex())) == used_electronIds.end()) { - float dca3DinSigma = dca3DinSigmaOTF(dcaXY, dcaZ, trackParCov.getSigmaY2(), trackParCov.getSigmaZ2(), trackParCov.getSigmaZY()); - fRegistry.fill(HIST(hadron_names[charmHadronId]) + HIST("electron/") + HIST(promptTypes[promptId]) + HIST(hTypes[findId]) + HIST("hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); - fRegistry.fill(HIST(hadron_names[charmHadronId]) + HIST("electron/") + HIST(promptTypes[promptId]) + HIST(hTypes[findId]) + HIST("hTPCdEdx"), track.tpcInnerParam(), track.tpcSignal()); - fRegistry.fill(HIST(hadron_names[charmHadronId]) + HIST("electron/") + HIST(promptTypes[promptId]) + HIST(hTypes[findId]) + HIST("hTOFbeta"), trackParCov.getP(), track.beta()); - used_electronIds.emplace_back(std::make_pair(findId, track.globalIndex())); - } + fRegistry.fill(HIST("Data/V0/hPt"), v0.pt()); + fRegistry.fill(HIST("Data/V0/hYPhi"), v0.phi(), v0.yLambda()); + fRegistry.fill(HIST("Data/V0/hAP"), v0.alpha(), v0.qtarm()); + fRegistry.fill(HIST("Data/V0/hCosPA"), v0.v0cosPA()); + fRegistry.fill(HIST("Data/V0/hLxy"), v0.v0radius()); + fRegistry.fill(HIST("Data/V0/hDCA2Legs"), v0.dcaV0daughters()); + fRegistry.fill(HIST("Data/V0/hMassK0S"), v0.mK0Short()); + fRegistry.fill(HIST("Data/V0/hMassLambda"), v0.mLambda()); + fRegistry.fill(HIST("Data/V0/hMassAntiLambda"), v0.mAntiLambda()); } - template - void fillKaonHistograms(TTrack const& track, TTrackParCov const& trackParCov, const float dcaXY, const float dcaZ) + template + void fillCascadeHistograms(TCollision const& collision, TCascade const& cascade) { - float dca3DinSigma = dca3DinSigmaOTF(dcaXY, dcaZ, trackParCov.getSigmaY2(), trackParCov.getSigmaZ2(), trackParCov.getSigmaZY()); - fRegistry.fill(HIST(hadron_names[charmHadronId]) + HIST("kaon/") + HIST(promptTypes[promptId]) + HIST(hTypes[findId]) + HIST("hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); - fRegistry.fill(HIST(hadron_names[charmHadronId]) + HIST("kaon/") + HIST(promptTypes[promptId]) + HIST(hTypes[findId]) + HIST("hTPCdEdx"), track.tpcInnerParam(), track.tpcSignal()); - fRegistry.fill(HIST(hadron_names[charmHadronId]) + HIST("kaon/") + HIST(promptTypes[promptId]) + HIST(hTypes[findId]) + HIST("hTOFbeta"), trackParCov.getP(), track.beta()); + fRegistry.fill(HIST("Data/Cascade/hPt"), cascade.pt()); + fRegistry.fill(HIST("Data/Cascade/hMassLambda"), cascade.mLambda()); + fRegistry.fill(HIST("Data/Cascade/hCosPA"), cascade.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + fRegistry.fill(HIST("Data/Cascade/hDCA2Legs"), cascade.dcacascdaughters()); + fRegistry.fill(HIST("Data/Cascade/hV0CosPA"), cascade.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); + fRegistry.fill(HIST("Data/Cascade/hV0DCA2Legs"), cascade.dcaV0daughters()); + fRegistry.fill(HIST("Data/Cascade/hMassXi"), cascade.mXi()); + fRegistry.fill(HIST("Data/Cascade/hMassOmega"), cascade.mOmega()); } - float dca3DinSigmaOTF(const float dcaXY, const float dcaZ, const float cYY, const float cZZ, const float cZY) + template + void fillElectronHistograms(TTrack const& track, TMCParticles const& mcParticles) { - float det = cYY * cZZ - cZY * cZY; // determinant - if (det < 0) { - return 999.f; - } else { - return std::sqrt(std::fabs((dcaXY * dcaXY * cZZ + dcaZ * dcaZ * cYY - 2. * dcaXY * dcaZ * cZY) / det / 2.)); // dca 3d in sigma - } - } - - template - void runPairEandTrack(TCollision const& collision, TElectron const& ele, TTrackIds const& trackIds, TTracks const& tracks, TMCParticles const& mcParticles, TMCCollisions const&) - { - std::array pVtx = {collision.posX(), collision.posY(), collision.posZ()}; - const auto& mcele = ele.template mcParticle_as(); - const auto& mcCollision1 = mcele.template mcCollision_as(); - - if (cfgEventGeneratorType >= 0 && mcCollision1.getSubGeneratorId() != cfgEventGeneratorType) { - return; - } - - // o2::dataformats::DCA mDcaInfoCov; mDcaInfoCov.set(999, 999, 999, 999, 999); - auto eleParCov = getTrackParCov(ele); - eleParCov.setPID(o2::track::PID::Electron); - // mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); - // mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, eleParCov, 2.f, matCorr, &mDcaInfoCov); + auto trackParCov = getTrackParCov(track); + trackParCov.setPID(o2::track::PID::Electron); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); float dcaXY = mDcaInfoCov.getY(); float dcaZ = mDcaInfoCov.getZ(); + float dca3DinSigma = dca3DinSigmaOTF(dcaXY, dcaZ, trackParCov.getSigmaY2(), trackParCov.getSigmaZ2(), trackParCov.getSigmaZY()); - for (const auto& trackId : trackIds) { - if (trackId == ele.globalIndex()) { - continue; - } + if (isSelectedElectron(track, trackParCov, dcaXY, dcaZ)) { + return; + } - const auto& track = tracks.rawIteratorAt(trackId); + if constexpr (isMC) { const auto& mctrack = track.template mcParticle_as(); - const auto& mcCollision2 = mctrack.template mcCollision_as(); - - auto trackParCov = getTrackParCov(track); - trackParCov.setPID(o2::track::PID::Kaon); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); - float dcaXY_h = mDcaInfoCov.getY(); - float dcaZ_h = mDcaInfoCov.getZ(); - std::array svpos = {0.}; // secondary vertex position - std::array pvec0 = {0.}; - std::array pvec1 = {0.}; - - int nCand = 0; - try { - nCand = fitter.process(eleParCov, trackParCov); - } catch (...) { - LOG(error) << "Exception caught in DCA fitter process call!"; - continue; - } - if (nCand == 0) { - continue; + if (std::abs(mctrack.pdgCode()) != 11) { + return; } - - fitter.propagateTracksToVertex(); // propagate e and K to D vertex - const auto& vtx = fitter.getPCACandidate(); - for (int i = 0; i < 3; i++) { - svpos[i] = vtx[i]; - } - fitter.getTrack(0).getPxPyPzGlo(pvec0); // electron - fitter.getTrack(1).getPxPyPzGlo(pvec1); // strange hadron - std::array pvecSum = {pvec0[0] + pvec1[0], pvec0[1] + pvec1[1], pvec0[2] + pvec1[2]}; - - float dca2legs = std::sqrt(fitter.getChi2AtPCACandidate()); - float lxy = std::sqrt(std::pow(svpos[0] - collision.posX(), 2) + std::pow(svpos[1] - collision.posY(), 2)); - float lz = std::fabs(svpos[2] - collision.posZ()); - float mEK = RecoDecay::m(std::array{pvec0, pvec1}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassKaonCharged}); - float cpa = RecoDecay::cpa(pVtx, svpos, pvecSum); - float cpaXY = RecoDecay::cpaXY(pVtx, svpos, pvecSum); - // float ptEK = RecoDecay::sqrtSumOfSquares(pvec0[0] + pvec1[0], pvec0[1] + pvec1[1]); - - float deta = RecoDecay::eta(pvec1) - RecoDecay::eta(pvec0); - float dphi = RecoDecay::phi(pvec1[0], pvec1[1]) - RecoDecay::phi(pvec0[0], pvec0[1]); - o2::math_utils::bringToPMPi(dphi); - float reldpt = (RecoDecay::sqrtSumOfSquares(pvec1[0], pvec1[1]) - RecoDecay::sqrtSumOfSquares(pvec0[0], pvec0[1])) / RecoDecay::sqrtSumOfSquares(pvec0[0], pvec0[1]); - - if (cpa < svcuts.cfg_min_cospa || cpaXY < svcuts.cfg_min_cospaXY || svcuts.cfg_max_mass_eK < mEK || lxy < svcuts.cfg_min_lxy || svcuts.cfg_max_dca2legs < dca2legs) { - continue; + if (!(mctrack.isPhysicalPrimary() || mctrack.producedByGenerator())) { + return; } + const auto& mcmother = mctrack.template mothers_first_as(); // mother particle of electron + int pdg_mother = std::abs(mcmother.pdgCode()); - fRegistry.fill(HIST("e_Kpm/all/hDCA2Legs"), dca2legs); - fRegistry.fill(HIST("e_Kpm/all/hLxy"), lxy); - fRegistry.fill(HIST("e_Kpm/all/hLz"), lz); - fRegistry.fill(HIST("e_Kpm/all/hCosPAXY"), cpaXY); - fRegistry.fill(HIST("e_Kpm/all/hCosPA"), cpa); - fRegistry.fill(HIST("e_Kpm/all/hMass"), mEK); - fRegistry.fill(HIST("e_Kpm/all/hMass_CosPA"), mEK, cpa); - fRegistry.fill(HIST("e_Kpm/all/hDeltaEtaDeltaPhi"), dphi, deta); - fRegistry.fill(HIST("e_Kpm/all/hRelDeltaPt"), reldpt); - fRegistry.fill(HIST("e_Kpm/all/hProdDCAxy"), dcaXY / std::sqrt(eleParCov.getSigmaY2()) * dcaXY_h / std::sqrt(trackParCov.getSigmaY2())); - fRegistry.fill(HIST("e_Kpm/all/hCorrelationDCAxy"), dcaXY / std::sqrt(eleParCov.getSigmaY2()), dcaXY_h / std::sqrt(trackParCov.getSigmaY2())); - fRegistry.fill(HIST("e_Kpm/all/hCorrelationDCAz"), dcaZ / std::sqrt(eleParCov.getSigmaZ2()), dcaZ_h / std::sqrt(trackParCov.getSigmaZ2())); - - int commonMotherId = o2::aod::pwgem::dilepton::utils::mcutil::FindCommonMotherFrom2ProngsWithoutPDG(mcele, mctrack); // e and K+/- - if (commonMotherId < 0 && mctrack.has_mothers()) { - const auto& mctrack_mother = mctrack.template mothers_first_as(); // mother particle of Kaon. For example K*(892)+ -> K+ pi0 or K*(892)0 -> K+ pi- and CC, or phi->K+K- - if (std::abs(mctrack_mother.pdgCode()) == 313 || std::abs(mctrack_mother.pdgCode()) == 323 || std::abs(mctrack_mother.pdgCode()) == 333) { - commonMotherId = o2::aod::pwgem::dilepton::utils::mcutil::FindCommonMotherFrom2ProngsWithoutPDG(mcele, mctrack_mother); // e and K*(892)0 or K*(892)+/- or phi(1019) + if (pdg_mother == 111 || pdg_mother == 221 || pdg_mother == 331 || pdg_mother == 113 || pdg_mother == 223 || pdg_mother == 333) { // LF + if (IsFromCharm(mcmother, mcParticles) < 0 && IsFromBeauty(mcmother, mcParticles) < 0) { + fRegistry.fill(HIST("MC/eFromPromptLF/hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); + } else { + fRegistry.fill(HIST("MC/eFromNonPromptLF/hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); } - } - if (commonMotherId >= 0) { // common mother is correctly found by DCAFitterN. - if (std::abs(mctrack.pdgCode()) == 321 && mcCollision1.globalIndex() == mcCollision2.globalIndex()) { // common mother is correctly found by DCAFitterN. - const auto& cmp = mcParticles.rawIteratorAt(commonMotherId); - if (std::abs(cmp.pdgCode()) == 421) { // D0 - if (o2::aod::pwgem::dilepton::utils::mcutil::IsFromBeauty(cmp, mcParticles) < 0) { - fillElectronHistograms<2, 1, 0>(ele, eleParCov, dcaXY, dcaZ); // nprompt charm - } else { - fillElectronHistograms<2, 1, 1>(ele, eleParCov, dcaXY, dcaZ); // nonprompt charm - } - - fRegistry.fill(HIST("e_Kpm/D0/hDCA2Legs"), dca2legs); - fRegistry.fill(HIST("e_Kpm/D0/hLxy"), lxy); - fRegistry.fill(HIST("e_Kpm/D0/hLz"), lz); - fRegistry.fill(HIST("e_Kpm/D0/hCosPAXY"), cpaXY); - fRegistry.fill(HIST("e_Kpm/D0/hCosPA"), cpa); - fRegistry.fill(HIST("e_Kpm/D0/hMass"), mEK); - fRegistry.fill(HIST("e_Kpm/D0/hMass_CosPA"), mEK, cpa); - fRegistry.fill(HIST("e_Kpm/D0/hDeltaEtaDeltaPhi"), dphi, deta); - fRegistry.fill(HIST("e_Kpm/D0/hRelDeltaPt"), reldpt); - fRegistry.fill(HIST("e_Kpm/D0/hProdDCAxy"), dcaXY / std::sqrt(eleParCov.getSigmaY2()) * dcaXY_h / std::sqrt(trackParCov.getSigmaY2())); - fRegistry.fill(HIST("e_Kpm/D0/hCorrelationDCAxy"), dcaXY / std::sqrt(eleParCov.getSigmaY2()), dcaXY_h / std::sqrt(trackParCov.getSigmaY2())); - fRegistry.fill(HIST("e_Kpm/D0/hCorrelationDCAz"), dcaZ / std::sqrt(eleParCov.getSigmaZ2()), dcaZ_h / std::sqrt(trackParCov.getSigmaZ2())); - } else if (std::abs(cmp.pdgCode()) == 411) { // Dpm - if (o2::aod::pwgem::dilepton::utils::mcutil::IsFromBeauty(cmp, mcParticles) < 0) { - fillElectronHistograms<3, 1, 0>(ele, eleParCov, dcaXY, dcaZ); // prompt charm - } else { - fillElectronHistograms<3, 1, 1>(ele, eleParCov, dcaXY, dcaZ); // nonprompt charm - } - fRegistry.fill(HIST("e_Kpm/Dpm/hDCA2Legs"), dca2legs); - fRegistry.fill(HIST("e_Kpm/Dpm/hLxy"), lxy); - fRegistry.fill(HIST("e_Kpm/Dpm/hLz"), lz); - fRegistry.fill(HIST("e_Kpm/Dpm/hCosPAXY"), cpaXY); - fRegistry.fill(HIST("e_Kpm/Dpm/hCosPA"), cpa); - fRegistry.fill(HIST("e_Kpm/Dpm/hMass"), mEK); - fRegistry.fill(HIST("e_Kpm/Dpm/hMass_CosPA"), mEK, cpa); - fRegistry.fill(HIST("e_Kpm/Dpm/hDeltaEtaDeltaPhi"), dphi, deta); - fRegistry.fill(HIST("e_Kpm/Dpm/hRelDeltaPt"), reldpt); - fRegistry.fill(HIST("e_Kpm/Dpm/hProdDCAxy"), dcaXY / std::sqrt(eleParCov.getSigmaY2()) * dcaXY_h / std::sqrt(trackParCov.getSigmaY2())); - fRegistry.fill(HIST("e_Kpm/Dpm/hCorrelationDCAxy"), dcaXY / std::sqrt(eleParCov.getSigmaY2()), dcaXY_h / std::sqrt(trackParCov.getSigmaY2())); - fRegistry.fill(HIST("e_Kpm/Dpm/hCorrelationDCAz"), dcaZ / std::sqrt(eleParCov.getSigmaZ2()), dcaZ_h / std::sqrt(trackParCov.getSigmaZ2())); - } else if (std::abs(cmp.pdgCode()) == 431) { // Ds - if (o2::aod::pwgem::dilepton::utils::mcutil::IsFromBeauty(cmp, mcParticles) < 0) { - fillElectronHistograms<4, 1, 0>(ele, eleParCov, dcaXY, dcaZ); // prompt charm - } else { - fillElectronHistograms<4, 1, 1>(ele, eleParCov, dcaXY, dcaZ); // nonprompt charm - } - fRegistry.fill(HIST("e_Kpm/Ds/hDCA2Legs"), dca2legs); - fRegistry.fill(HIST("e_Kpm/Ds/hLxy"), lxy); - fRegistry.fill(HIST("e_Kpm/Ds/hLz"), lz); - fRegistry.fill(HIST("e_Kpm/Ds/hCosPAXY"), cpaXY); - fRegistry.fill(HIST("e_Kpm/Ds/hCosPA"), cpa); - fRegistry.fill(HIST("e_Kpm/Ds/hMass"), mEK); - fRegistry.fill(HIST("e_Kpm/Ds/hMass_CosPA"), mEK, cpa); - fRegistry.fill(HIST("e_Kpm/Ds/hDeltaEtaDeltaPhi"), dphi, deta); - fRegistry.fill(HIST("e_Kpm/Ds/hRelDeltaPt"), reldpt); - fRegistry.fill(HIST("e_Kpm/Ds/hProdDCAxy"), dcaXY / std::sqrt(eleParCov.getSigmaY2()) * dcaXY_h / std::sqrt(trackParCov.getSigmaY2())); - fRegistry.fill(HIST("e_Kpm/Ds/hCorrelationDCAxy"), dcaXY / std::sqrt(eleParCov.getSigmaY2()), dcaXY_h / std::sqrt(trackParCov.getSigmaY2())); - fRegistry.fill(HIST("e_Kpm/Ds/hCorrelationDCAz"), dcaZ / std::sqrt(eleParCov.getSigmaZ2()), dcaZ_h / std::sqrt(trackParCov.getSigmaZ2())); - } + } else if (pdg_mother == 443) { // Jpsi + if (IsFromBeauty(mcmother, mcParticles) < 0) { + fRegistry.fill(HIST("MC/eFromPromptJpsi/hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); + } else { + fRegistry.fill(HIST("MC/eFromNonPromptJpsi/hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); } - } else { // common mother does not exist, but DCAFitterN found something. i.e. fake - const auto& mp = mcele.template mothers_first_as(); - if ((mcele.isPhysicalPrimary() || mcele.producedByGenerator()) && (std::abs(mp.pdgCode()) == 111 || std::abs(mp.pdgCode()) == 221 || std::abs(mp.pdgCode()) == 331 || std::abs(mp.pdgCode()) == 113 || std::abs(mp.pdgCode()) == 223 || std::abs(mp.pdgCode()) == 333)) { // LF - if (o2::aod::pwgem::dilepton::utils::mcutil::IsFromCharm(mcele, mcParticles) < 0 && o2::aod::pwgem::dilepton::utils::mcutil::IsFromBeauty(mcele, mcParticles) < 0) { - fillElectronHistograms<0, 2, 0>(ele, eleParCov, dcaXY, dcaZ); - } else { - fillElectronHistograms<0, 2, 1>(ele, eleParCov, dcaXY, dcaZ); - } + } else if (pdg_mother == 411) { // D+/- + if (IsFromBeauty(mcmother, mcParticles) < 0) { + fRegistry.fill(HIST("MC/eFromPromptDpm/hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); + } else { + fRegistry.fill(HIST("MC/eFromNonPromptDpm/hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); + } + } else if (pdg_mother == 421) { // D0 + if (IsFromBeauty(mcmother, mcParticles) < 0) { + fRegistry.fill(HIST("MC/eFromPromptD0/hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); + } else { + fRegistry.fill(HIST("MC/eFromNonPromptD0/hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); + } + } else if (pdg_mother == 431) { // Ds+/- + if (IsFromBeauty(mcmother, mcParticles) < 0) { + fRegistry.fill(HIST("MC/eFromPromptDs/hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); + } else { + fRegistry.fill(HIST("MC/eFromNonPromptDs/hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); + } + } else if (pdg_mother == 4122) { // Lc+/- + if (IsFromBeauty(mcmother, mcParticles) < 0) { + fRegistry.fill(HIST("MC/eFromPromptLcpm/hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); + } else { + fRegistry.fill(HIST("MC/eFromNonPromptLcpm/hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); + } + } else if (pdg_mother == 4132) { // Xic0 + if (IsFromBeauty(mcmother, mcParticles) < 0) { + fRegistry.fill(HIST("MC/eFromPromptXic0/hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); + } else { + fRegistry.fill(HIST("MC/eFromNonPromptXic0/hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); } - fRegistry.fill(HIST("e_Kpm/fake/hDCA2Legs"), dca2legs); - fRegistry.fill(HIST("e_Kpm/fake/hLxy"), lxy); - fRegistry.fill(HIST("e_Kpm/fake/hLz"), lz); - fRegistry.fill(HIST("e_Kpm/fake/hCosPAXY"), cpaXY); - fRegistry.fill(HIST("e_Kpm/fake/hCosPA"), cpa); - fRegistry.fill(HIST("e_Kpm/fake/hMass"), mEK); - fRegistry.fill(HIST("e_Kpm/fake/hMass_CosPA"), mEK, cpa); - fRegistry.fill(HIST("e_Kpm/fake/hDeltaEtaDeltaPhi"), dphi, deta); - fRegistry.fill(HIST("e_Kpm/fake/hRelDeltaPt"), reldpt); - fRegistry.fill(HIST("e_Kpm/fake/hProdDCAxy"), dcaXY / std::sqrt(eleParCov.getSigmaY2()) * dcaXY_h / std::sqrt(trackParCov.getSigmaY2())); - fRegistry.fill(HIST("e_Kpm/fake/hCorrelationDCAxy"), dcaXY / std::sqrt(eleParCov.getSigmaY2()), dcaXY_h / std::sqrt(trackParCov.getSigmaY2())); - fRegistry.fill(HIST("e_Kpm/fake/hCorrelationDCAz"), dcaZ / std::sqrt(eleParCov.getSigmaZ2()), dcaZ_h / std::sqrt(trackParCov.getSigmaZ2())); + } else if (pdg_mother == 4332) { // Omegac0 + if (IsFromBeauty(mcmother, mcParticles) < 0) { + fRegistry.fill(HIST("MC/eFromPromptOmegac0/hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); + } else { + fRegistry.fill(HIST("MC/eFromNonPromptOmegac0/hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); + } + } else if (pdg_mother == 511) { // B0 + fRegistry.fill(HIST("MC/eFromB0/hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); + } else if (pdg_mother == 521) { // B+/- + fRegistry.fill(HIST("MC/eFromBpm/hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); + } else if (pdg_mother == 531) { // Bs0 + fRegistry.fill(HIST("MC/eFromBs/hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); + } else if (pdg_mother == 541) { // Bc+/- + fRegistry.fill(HIST("MC/eFromBc/hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); + } else if (pdg_mother == 5122) { // Lb0 + fRegistry.fill(HIST("MC/eFromLb0/hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); } - } // end of kaon loop + } else { + fRegistry.fill(HIST("Data/electron/hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); + } } - template - void runPairEandV0(TCollision const& collision, TElectron const& ele, TV0Ids const& v0Ids, TV0s const& v0s, TMCParticles const& mcParticles, TMCCollisions const&) + float dca3DinSigmaOTF(const float dcaXY, const float dcaZ, const float cYY, const float cZZ, const float cZY) { - std::array pVtx = {collision.posX(), collision.posY(), collision.posZ()}; - const auto& mcele = ele.template mcParticle_as(); - const auto& mcCollision1 = mcele.template mcCollision_as(); - if (cfgEventGeneratorType >= 0 && mcCollision1.getSubGeneratorId() != cfgEventGeneratorType) { - return; + float det = cYY * cZZ - cZY * cZY; // determinant + if (det < 0) { + return 999.f; + } else { + return std::sqrt(std::fabs((dcaXY * dcaXY * cZZ + dcaZ * dcaZ * cYY - 2. * dcaXY * dcaZ * cZY) / det / 2.)); // dca 3d in sigma } + } - // o2::dataformats::DCA mDcaInfoCov; + template + bool isSemiLeptonic(TMCParticle const& mcParticle, TMCParticles const& mcParticles) + { + if (!mcParticle.has_daughters()) { + return false; + } + bool is_lepton_involved = false; + bool is_neutrino_involved = false; + for (int d = mcParticle.daughtersIds()[0]; d <= mcParticle.daughtersIds()[1]; ++d) { + if (d < mcParticles.size()) { // protect against bad daughter indices + const auto& daughter = mcParticles.rawIteratorAt(d); + if (daughter.pdgCode() == pdgLepton) { + is_lepton_involved = true; + } else if (daughter.pdgCode() == pdgNeutrino) { + is_neutrino_involved = true; + } + } else { + std::cout << "Daughter label (" << d << ") exceeds the McParticles size (" << mcParticles.size() << ")" << std::endl; + std::cout << " Check the MC generator" << std::endl; + return false; + } + } + + if (is_lepton_involved && is_neutrino_involved) { + return true; + } else { + return false; + } + } + + template + EBPair makeELPair(TCollision const& collision, TTrack const& track, TV0 const& v0) + { mDcaInfoCov.set(999, 999, 999, 999, 999); - auto eleParCov = getTrackParCov(ele); - eleParCov.setPID(o2::track::PID::Electron); - // mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); - // mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, eleParCov, 2.f, matCorr, &mDcaInfoCov); + auto trackParCov = getTrackParCov(track); + trackParCov.setPID(o2::track::PID::Electron); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); float dcaXY = mDcaInfoCov.getY(); float dcaZ = mDcaInfoCov.getZ(); + float dca3DinSigma = dca3DinSigmaOTF(dcaXY, dcaZ, trackParCov.getSigmaY2(), trackParCov.getSigmaZ2(), trackParCov.getSigmaZY()); - for (const auto& v0Id : v0Ids) { - const auto& v0 = v0s.rawIteratorAt(v0Id); - auto pos = v0.template posTrack_as(); - // auto neg = v0.template negTrack_as(); - - const auto& mcpos = pos.template mcParticle_as(); - // const auto& mcneg = neg.template mcParticle_as(); - const auto& mcv0 = mcpos.template mothers_first_as(); // check mother of K0S. namely, K0 [311 or -311]. - const auto& mcCollision2 = mcv0.template mcCollision_as(); - - const std::array vertex = {v0.x(), v0.y(), v0.z()}; - const std::array momentum = {v0.px(), v0.py(), v0.pz()}; - std::array covV0 = {0.f}; - - constexpr int MomInd[6] = {9, 13, 14, 18, 19, 20}; // cov matrix elements for momentum component - for (int i = 0; i < 6; i++) { - covV0[MomInd[i]] = v0.momentumCovMat()[i]; - covV0[i] = v0.positionCovMat()[i]; - } - - auto tV0 = o2::track::TrackParCov(vertex, momentum, covV0, 0, true); - tV0.setAbsCharge(0); - tV0.setPID(o2::track::PID::K0); - - std::array svpos = {0.}; // secondary vertex position - std::array pvec0 = {0.}; - std::array pvec1 = {0.}; + EBPair eLpair; + eLpair.ptepv = trackParCov.getPt(); + eLpair.dca3dinsigma = dca3DinSigma; - int nCand = 0; - try { - nCand = fitter.process(eleParCov, tV0); - } catch (...) { - LOG(error) << "Exception caught in DCA fitter process call!"; - continue; - } - if (nCand == 0) { - continue; - } + const std::array vertex = {v0.x(), v0.y(), v0.z()}; + const std::array momentum = {v0.px(), v0.py(), v0.pz()}; + std::array covV0 = {0.f}; - fitter.propagateTracksToVertex(); // propagate e and K to D vertex - const auto& vtx = fitter.getPCACandidate(); - for (int i = 0; i < 3; i++) { - svpos[i] = vtx[i]; - } - fitter.getTrack(0).getPxPyPzGlo(pvec0); // electron - fitter.getTrack(1).getPxPyPzGlo(pvec1); // v0 - std::array pvecSum = {pvec0[0] + pvec1[0], pvec0[1] + pvec1[1], pvec0[2] + pvec1[2]}; - - float dca2legs = std::sqrt(fitter.getChi2AtPCACandidate()); - float lxy = std::sqrt(std::pow(svpos[0] - collision.posX(), 2) + std::pow(svpos[1] - collision.posY(), 2)); - float lz = std::fabs(svpos[2] - collision.posZ()); - // float ptEK = RecoDecay::sqrtSumOfSquares(pvec0[0] + pvec1[0], pvec0[1] + pvec1[1]); - - float deta = RecoDecay::eta(pvec1) - RecoDecay::eta(pvec0); - float dphi = RecoDecay::phi(pvec1[0], pvec1[1]) - RecoDecay::phi(pvec0[0], pvec0[1]); - o2::math_utils::bringToPMPi(dphi); - float reldpt = (RecoDecay::sqrtSumOfSquares(pvec1[0], pvec1[1]) - RecoDecay::sqrtSumOfSquares(pvec0[0], pvec0[1])) / RecoDecay::sqrtSumOfSquares(pvec0[0], pvec0[1]); - - float mEK = 0; - if constexpr (pairId == 1) { - mEK = RecoDecay::m(std::array{pvec0, pvec1}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassK0Short}); - if (svcuts.cfg_max_mass_eK < mEK) { - continue; - } - } else if constexpr (pairId == 2) { - mEK = RecoDecay::m(std::array{pvec0, pvec1}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassLambda}); - if (svcuts.cfg_max_mass_eL < mEK) { - continue; - } - } - float cpa = RecoDecay::cpa(pVtx, svpos, pvecSum); - float cpaXY = RecoDecay::cpaXY(pVtx, svpos, pvecSum); + constexpr int MomInd[6] = {9, 13, 14, 18, 19, 20}; // cov matrix elements for momentum component + for (int i = 0; i < 6; i++) { + covV0[MomInd[i]] = v0.momentumCovMat()[i]; + covV0[i] = v0.positionCovMat()[i]; + } - if (cpa < svcuts.cfg_min_cospa || cpaXY < svcuts.cfg_min_cospaXY || lxy < svcuts.cfg_min_lxy || svcuts.cfg_max_dca2legs < dca2legs) { - continue; - } + auto v0ParCov = o2::track::TrackParCov(vertex, momentum, covV0, 0, true); + v0ParCov.setAbsCharge(0); + v0ParCov.setPID(o2::track::PID::Lambda); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("all/hDCA2Legs"), dca2legs); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("all/hLxy"), lxy); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("all/hLz"), lz); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("all/hCosPAXY"), cpaXY); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("all/hCosPA"), cpa); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("all/hMass"), mEK); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("all/hMass_CosPA"), mEK, cpa); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("all/hDeltaEtaDeltaPhi"), dphi, deta); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("all/hRelDeltaPt"), reldpt); - - int commonMotherId = -1; - if constexpr (pairId == 1) { - const auto& mcv0_mother = mcv0.template mothers_first_as(); // mother particle of K0S. - commonMotherId = o2::aod::pwgem::dilepton::utils::mcutil::FindCommonMotherFrom2ProngsWithoutPDG(mcele, mcv0_mother); // K0, not K0S - } else if constexpr (pairId == 2) { - commonMotherId = o2::aod::pwgem::dilepton::utils::mcutil::FindCommonMotherFrom2ProngsWithoutPDG(mcele, mcv0); // lambda - } + std::array svpos = {0.}; // secondary vertex position + std::array pvec0 = {0.}; + std::array pvec1 = {0.}; - if (commonMotherId >= 0) { // common mother is correctly found by DCAFitterN. - const auto& cmp = mcParticles.rawIteratorAt(commonMotherId); - if constexpr (pairId == 1) { - if (std::abs(mcv0.pdgCode()) == 310 && mcCollision1.globalIndex() == mcCollision2.globalIndex()) { - if (std::abs(cmp.pdgCode()) == 421) { // D0 - if (o2::aod::pwgem::dilepton::utils::mcutil::IsFromBeauty(cmp, mcParticles) < 0) { - fillElectronHistograms<2, 1, 0>(ele, eleParCov, dcaXY, dcaZ); // prompt charm - } else { - fillElectronHistograms<2, 1, 1>(ele, eleParCov, dcaXY, dcaZ); // nonprompt charm - } - fRegistry.fill(HIST(pair_names[pairId]) + HIST("D0/hDCA2Legs"), dca2legs); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("D0/hLxy"), lxy); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("D0/hLz"), lz); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("D0/hCosPAXY"), cpaXY); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("D0/hCosPA"), cpa); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("D0/hMass"), mEK); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("D0/hMass_CosPA"), mEK, cpa); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("D0/hDeltaEtaDeltaPhi"), dphi, deta); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("D0/hRelDeltaPt"), reldpt); - } else if (std::abs(cmp.pdgCode()) == 411) { // Dpm - if (o2::aod::pwgem::dilepton::utils::mcutil::IsFromBeauty(cmp, mcParticles) < 0) { - fillElectronHistograms<3, 1, 0>(ele, eleParCov, dcaXY, dcaZ); // prompt charm - } else { - fillElectronHistograms<3, 1, 1>(ele, eleParCov, dcaXY, dcaZ); // nonprompt charm - } - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Dpm/hDCA2Legs"), dca2legs); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Dpm/hLxy"), lxy); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Dpm/hLz"), lz); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Dpm/hCosPAXY"), cpaXY); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Dpm/hCosPA"), cpa); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Dpm/hMass"), mEK); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Dpm/hMass_CosPA"), mEK, cpa); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Dpm/hDeltaEtaDeltaPhi"), dphi, deta); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Dpm/hRelDeltaPt"), reldpt); - } else if (std::abs(cmp.pdgCode()) == 431) { // Ds - if (o2::aod::pwgem::dilepton::utils::mcutil::IsFromBeauty(cmp, mcParticles) < 0) { - fillElectronHistograms<4, 1, 0>(ele, eleParCov, dcaXY, dcaZ); // prompt charm - } else { - fillElectronHistograms<4, 1, 1>(ele, eleParCov, dcaXY, dcaZ); // nonprompt charm - } - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Ds/hDCA2Legs"), dca2legs); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Ds/hLxy"), lxy); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Ds/hLz"), lz); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Ds/hCosPAXY"), cpaXY); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Ds/hCosPA"), cpa); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Ds/hMass"), mEK); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Ds/hMass_CosPA"), mEK, cpa); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Ds/hDeltaEtaDeltaPhi"), dphi, deta); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Ds/hRelDeltaPt"), reldpt); - } - } - } else if constexpr (pairId == 2) { - if (std::abs(mcv0.pdgCode()) == 3122 && mcCollision1.globalIndex() == mcCollision2.globalIndex()) { - if (std::abs(cmp.pdgCode()) == 4122) { // Lc - if (o2::aod::pwgem::dilepton::utils::mcutil::IsFromBeauty(cmp, mcParticles) < 0) { - fillElectronHistograms<5, 1, 0>(ele, eleParCov, dcaXY, dcaZ); // prompt charm - } else { - fillElectronHistograms<5, 1, 1>(ele, eleParCov, dcaXY, dcaZ); // nonprompt charm - } - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Lc/hDCA2Legs"), dca2legs); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Lc/hLxy"), lxy); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Lc/hLz"), lz); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Lc/hCosPAXY"), cpaXY); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Lc/hCosPA"), cpa); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Lc/hMass"), mEK); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Lc/hMass_CosPA"), mEK, cpa); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Lc/hDeltaEtaDeltaPhi"), dphi, deta); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("Lc/hRelDeltaPt"), reldpt); - } - } - } - } else { // common mother does not exist, but DCAFitterN found something. i.e. fake - const auto& mp = mcele.template mothers_first_as(); - if ((mcele.isPhysicalPrimary() || mcele.producedByGenerator()) && (std::abs(mp.pdgCode()) == 111 || std::abs(mp.pdgCode()) == 221 || std::abs(mp.pdgCode()) == 331 || std::abs(mp.pdgCode()) == 113 || std::abs(mp.pdgCode()) == 223 || std::abs(mp.pdgCode()) == 333)) { // LF - if (o2::aod::pwgem::dilepton::utils::mcutil::IsFromCharm(mcele, mcParticles) < 0 && o2::aod::pwgem::dilepton::utils::mcutil::IsFromBeauty(mcele, mcParticles) < 0) { - fillElectronHistograms<0, 2, 0>(ele, eleParCov, dcaXY, dcaZ); - } else { - fillElectronHistograms<0, 2, 1>(ele, eleParCov, dcaXY, dcaZ); - } - } - fRegistry.fill(HIST(pair_names[pairId]) + HIST("fake/hDCA2Legs"), dca2legs); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("fake/hLxy"), lxy); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("fake/hLz"), lz); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("fake/hCosPAXY"), cpaXY); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("fake/hCosPA"), cpa); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("fake/hMass"), mEK); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("fake/hMass_CosPA"), mEK, cpa); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("fake/hDeltaEtaDeltaPhi"), dphi, deta); - fRegistry.fill(HIST(pair_names[pairId]) + HIST("fake/hRelDeltaPt"), reldpt); - } + int nCand = 0; + try { + nCand = fitter.process(trackParCov, v0ParCov); + } catch (...) { + LOG(error) << "Exception caught in DCA fitter process call!"; + return eLpair; + } + if (nCand == 0) { + return eLpair; + } - } // end of v0 loop + fitter.propagateTracksToVertex(); // propagate e and K to D vertex + const auto& vtx = fitter.getPCACandidate(); + for (int i = 0; i < 3; i++) { + svpos[i] = vtx[i]; + } + fitter.getTrack(0).getPxPyPzGlo(pvec0); // electron + fitter.getTrack(1).getPxPyPzGlo(pvec1); // v0 + std::array pvecSum = {pvec0[0] + pvec1[0], pvec0[1] + pvec1[1], pvec0[2] + pvec1[2]}; + + float cospa = RecoDecay::cpa(vertex, svpos, pvecSum); + float dca2legs = std::sqrt(fitter.getChi2AtPCACandidate()); + float lxy = std::sqrt(std::pow(svpos[0] - collision.posX(), 2) + std::pow(svpos[1] - collision.posY(), 2)); + float lz = std::fabs(svpos[2] - collision.posZ()); + ROOT::Math::PxPyPzMVector v1(pvec0[0], pvec0[1], pvec0[2], o2::constants::physics::MassElectron); + ROOT::Math::PxPyPzMVector v2(pvec1[0], pvec1[1], pvec1[2], o2::constants::physics::MassLambda); + ROOT::Math::PxPyPzMVector v12 = v1 + v2; + + eLpair.mass = v12.M(); + eLpair.dca2legs = dca2legs; + eLpair.cospa = cospa; + eLpair.lxy = lxy; + eLpair.lz = lz; + return eLpair; } - SliceCache cache; - Preslice perCol = o2::aod::track::collisionId; - Preslice perCol_v0 = o2::aod::v0data::collisionId; - - Filter collisionFilter_evsel = o2::aod::evsel::sel8 == true && (cfgZvtxMin < o2::aod::collision::posZ && o2::aod::collision::posZ < cfgZvtxMax); - Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); - using FilteredMyCollisions = soa::Filtered; - - Preslice trackIndicesPerCollision = aod::track_association::collisionId; - std::vector> stored_trackIds; - Filter trackFilter = ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC) == true; - using MyFilteredTracks = soa::Filtered; - - Partition posTracks = o2::aod::track::signed1Pt > 0.f; - Partition negTracks = o2::aod::track::signed1Pt < 0.f; + template + EBPair makeECascadePair(TCollision const& collision, TTrack const& track, TCascade const& cascade) + { + mDcaInfoCov.set(999, 999, 999, 999, 999); + auto trackParCov = getTrackParCov(track); + trackParCov.setPID(o2::track::PID::Electron); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + float dcaXY = mDcaInfoCov.getY(); + float dcaZ = mDcaInfoCov.getZ(); + float dca3DinSigma = dca3DinSigmaOTF(dcaXY, dcaZ, trackParCov.getSigmaY2(), trackParCov.getSigmaZ2(), trackParCov.getSigmaZY()); - //! type of V0. 0: built solely for cascades (does not pass standard V0 cuts), 1: standard 2, 3: photon-like with TPC-only use. Regular analysis should always use type 1. - Filter v0Filter = o2::aod::v0data::v0Type == uint8_t(1) && o2::aod::v0data::v0cosPA > v0cuts.cfg_min_cospa&& o2::aod::v0data::dcaV0daughters < v0cuts.cfg_max_dca2legs; - using filteredV0s = soa::Filtered; + EBPair eCascPair; + eCascPair.ptepv = trackParCov.getPt(); + eCascPair.dca3dinsigma = dca3DinSigma; - std::vector electronIds; - std::vector positronIds; - std::vector negKaonIds; - std::vector posKaonIds; + const std::array vertex = {cascade.x(), cascade.y(), cascade.z()}; + const std::array momentum = {cascade.px(), cascade.py(), cascade.pz()}; - std::vector k0sIds; - std::vector lambdaIds; - std::vector antilambdaIds; + std::array covCasc = {0.}; + constexpr int MomInd[6] = {9, 13, 14, 18, 19, 20}; // cov matrix elements for momentum component + for (int i = 0; i < 6; i++) { + covCasc[MomInd[i]] = cascade.momentumCovMat()[i]; + covCasc[i] = cascade.positionCovMat()[i]; + } - std::vector> used_electronIds; // pair of hTypeId and electronId + auto cascParCov = o2::track::TrackParCov(vertex, momentum, covCasc, cascade.sign(), true); + cascParCov.setAbsCharge(1); + if constexpr (cascType == 0) { + cascParCov.setPID(o2::track::PID::XiMinus); + } else if constexpr (cascType == 1) { + cascParCov.setPID(o2::track::PID::OmegaMinus); + } + std::array svpos = {0.}; // secondary vertex position + std::array pvec0 = {0.}; + std::array pvec1 = {0.}; + + int nCand = 0; + try { + nCand = fitter.process(trackParCov, cascParCov); + } catch (...) { + LOG(error) << "Exception caught in DCA fitter process call!"; + return eCascPair; + } + if (nCand == 0) { + return eCascPair; + } - void processSA(FilteredMyCollisions const&, aod::BCsWithTimestamps const&, MyTracks const&, filteredV0s const&, aod::McParticles const&, aod::McCollisions const&) {} - PROCESS_SWITCH(taggingHFE, processSA, "process without TTCA", false); + fitter.propagateTracksToVertex(); // propagate e and Xi/Omega to decay vertex of charm baryon + const auto& vtx = fitter.getPCACandidate(); + for (int i = 0; i < 3; i++) { + svpos[i] = vtx[i]; + } + fitter.getTrack(0).getPxPyPzGlo(pvec0); // electron + fitter.getTrack(1).getPxPyPzGlo(pvec1); // v0 + std::array pvecSum = {pvec0[0] + pvec1[0], pvec0[1] + pvec1[1], pvec0[2] + pvec1[2]}; + + float cospa = RecoDecay::cpa(vertex, svpos, pvecSum); + float dca2legs = std::sqrt(fitter.getChi2AtPCACandidate()); + float lxy = std::sqrt(std::pow(svpos[0] - collision.posX(), 2) + std::pow(svpos[1] - collision.posY(), 2)); + float lz = std::fabs(svpos[2] - collision.posZ()); + ROOT::Math::PxPyPzMVector v1(pvec0[0], pvec0[1], pvec0[2], o2::constants::physics::MassElectron); + ROOT::Math::PxPyPzMVector v2(pvec1[0], pvec1[1], pvec1[2], o2::constants::physics::MassXiMinus); + if constexpr (cascType == 0) { + v2.SetM(o2::constants::physics::MassXiMinus); + } else if constexpr (cascType == 1) { + v2.SetM(o2::constants::physics::MassOmegaMinus); + } + ROOT::Math::PxPyPzMVector v12 = v1 + v2; + + eCascPair.mass = v12.M(); + eCascPair.dca2legs = dca2legs; + eCascPair.cospa = cospa; + eCascPair.lxy = lxy; + eCascPair.lz = lz; + return eCascPair; + } - void processTTCA(FilteredMyCollisions const& collisions, aod::BCsWithTimestamps const&, MyTracks const& tracks, aod::TrackAssoc const& trackIndices, filteredV0s const& v0s, aod::McParticles const& mcParticles, aod::McCollisions const& mcCollisions) + template + void runPairing(TBCs const&, TCollisions const& collisions, TTracks const& tracks, TTrackAssoc const& trackIndices, TV0s const& v0s, TCascades const& cascades, TMCCollisions const&, TMCParticles const& mcParticles) { used_electronIds.reserve(tracks.size()); for (const auto& collision : collisions) { - const auto& bc = collision.template foundBC_as(); + const auto& bc = collision.template foundBC_as(); initCCDB(bc); fRegistry.fill(HIST("Event/hCollisionCounter"), 0); if (!collision.has_mcCollision()) { continue; } const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; - if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { + if (centralities[eventcut.cfgCentEstimator] < eventcut.cfgCentMin || eventcut.cfgCentMax < centralities[eventcut.cfgCentEstimator]) { continue; } fRegistry.fill(HIST("Event/hCollisionCounter"), 1); const auto& mcCollision = collision.template mcCollision_as(); - if (cfgEventGeneratorType < 0 || mcCollision.getSubGeneratorId() == cfgEventGeneratorType) { + if (eventcut.cfgEventGeneratorType < 0 || mcCollision.getSubGeneratorId() == eventcut.cfgEventGeneratorType) { fillEventHistograms(collision); } + mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); + mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); + const auto& trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, collision.globalIndex()); electronIds.reserve(trackIdsThisCollision.size()); positronIds.reserve(trackIdsThisCollision.size()); negKaonIds.reserve(trackIdsThisCollision.size()); posKaonIds.reserve(trackIdsThisCollision.size()); - mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); - mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); for (const auto& trackId : trackIdsThisCollision) { - const auto& track = trackId.template track_as(); + const auto& track = trackId.template track_as(); if (!track.hasITS() || !track.hasTPC()) { continue; } - if (!track.has_mcParticle()) { - continue; - } - const auto& mctrack = track.template mcParticle_as(); - if (std::abs(mctrack.pdgCode()) != 11) { - continue; - } - const auto& mcCollision1 = mctrack.template mcCollision_as(); - if (cfgEventGeneratorType >= 0 && mcCollision1.getSubGeneratorId() != cfgEventGeneratorType) { - continue; - } - if (!mctrack.has_mothers() || !(mctrack.isPhysicalPrimary() || mctrack.producedByGenerator())) { - continue; - } - const auto& mp = mctrack.template mothers_first_as(); // mother particle of electron - - // o2::dataformats::DCA mDcaInfoCov; - mDcaInfoCov.set(999, 999, 999, 999, 999); - auto track_par_cov_recalc = getTrackParCov(track); - track_par_cov_recalc.setPID(o2::track::PID::Electron); - // mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); - // mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, track_par_cov_recalc, 2.f, matCorr, &mDcaInfoCov); - float dcaXY = mDcaInfoCov.getY(); - float dcaZ = mDcaInfoCov.getZ(); - - if (!isSelectedTrackForElectron(track, track_par_cov_recalc, dcaXY, dcaZ)) { - continue; - } - if (std::abs(mp.pdgCode()) == 111 || std::abs(mp.pdgCode()) == 221 || std::abs(mp.pdgCode()) == 331 || std::abs(mp.pdgCode()) == 113 || std::abs(mp.pdgCode()) == 223 || std::abs(mp.pdgCode()) == 333) { // LF - if (o2::aod::pwgem::dilepton::utils::mcutil::IsFromCharm(mp, mcParticles) < 0 && o2::aod::pwgem::dilepton::utils::mcutil::IsFromBeauty(mp, mcParticles) < 0) { - fillElectronHistograms<0, 0, 0>(track, track_par_cov_recalc, dcaXY, dcaZ); // prompt LF - } else { - fillElectronHistograms<0, 0, 1>(track, track_par_cov_recalc, dcaXY, dcaZ); // nonprompt LF + if constexpr (isMC) { + if (!track.has_mcParticle()) { + continue; } - } else if (std::abs(mp.pdgCode()) == 443) { // Jpsi - if (o2::aod::pwgem::dilepton::utils::mcutil::IsFromBeauty(mp, mcParticles) < 0) { - fillElectronHistograms<1, 0, 0>(track, track_par_cov_recalc, dcaXY, dcaZ); // prompt Jpsi - } else { - fillElectronHistograms<1, 0, 1>(track, track_par_cov_recalc, dcaXY, dcaZ); // nonprompt Jpsi + const auto& mctrack = track.template mcParticle_as(); + const auto& mcCollision = mctrack.template mcCollision_as(); + if (eventcut.cfgEventGeneratorType >= 0 && mcCollision.getSubGeneratorId() != eventcut.cfgEventGeneratorType) { + continue; } - } else if (std::abs(mp.pdgCode()) == 421) { // D0 - if (o2::aod::pwgem::dilepton::utils::mcutil::IsFromBeauty(mp, mcParticles) < 0) { - fillElectronHistograms<2, 0, 0>(track, track_par_cov_recalc, dcaXY, dcaZ); - } else { - fillElectronHistograms<2, 0, 1>(track, track_par_cov_recalc, dcaXY, dcaZ); + if (!mctrack.has_mothers() || !(mctrack.isPhysicalPrimary() || mctrack.producedByGenerator())) { + continue; } - } else if (std::abs(mp.pdgCode()) == 411) { // Dpm - if (o2::aod::pwgem::dilepton::utils::mcutil::IsFromBeauty(mp, mcParticles) < 0) { - fillElectronHistograms<3, 0, 0>(track, track_par_cov_recalc, dcaXY, dcaZ); - } else { - fillElectronHistograms<3, 0, 1>(track, track_par_cov_recalc, dcaXY, dcaZ); - } - } else if (std::abs(mp.pdgCode()) == 431) { // Ds - if (o2::aod::pwgem::dilepton::utils::mcutil::IsFromBeauty(mp, mcParticles) < 0) { - fillElectronHistograms<4, 0, 0>(track, track_par_cov_recalc, dcaXY, dcaZ); - } else { - fillElectronHistograms<4, 0, 1>(track, track_par_cov_recalc, dcaXY, dcaZ); - } - } else if (std::abs(mp.pdgCode()) == 4122) { // Lc - if (o2::aod::pwgem::dilepton::utils::mcutil::IsFromBeauty(mp, mcParticles) < 0) { - fillElectronHistograms<5, 0, 0>(track, track_par_cov_recalc, dcaXY, dcaZ); - } else { - fillElectronHistograms<5, 0, 1>(track, track_par_cov_recalc, dcaXY, dcaZ); - } + fillElectronHistograms(track, mcParticles); } - if (track.sign() > 0) { // positron - positronIds.emplace_back(trackId.trackId()); - } else { // electron - electronIds.emplace_back(trackId.trackId()); - } - } // end of track loop for electron selection - - for (const auto& trackId : trackIdsThisCollision) { - const auto& track = trackId.template track_as(); - if (!track.hasITS() || !track.hasTPC()) { - continue; - } - if (!track.has_mcParticle()) { - continue; - } - - const auto& mctrack = track.template mcParticle_as(); - const auto& mcCollision1 = mctrack.template mcCollision_as(); - - // o2::dataformats::DCA mDcaInfoCov; mDcaInfoCov.set(999, 999, 999, 999, 999); - auto track_par_cov_recalc = getTrackParCov(track); - track_par_cov_recalc.setPID(o2::track::PID::Kaon); - // mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); - // mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, track_par_cov_recalc, 2.f, matCorr, &mDcaInfoCov); + auto trackParCov = getTrackParCov(track); + trackParCov.setPID(o2::track::PID::Electron); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); float dcaXY = mDcaInfoCov.getY(); float dcaZ = mDcaInfoCov.getZ(); - if (!isSelectedTrackForKaon(track, track_par_cov_recalc, dcaXY, dcaZ)) { - continue; + if (isSelectedElectron(track, trackParCov, dcaXY, dcaZ)) { + if (track.sign() > 0) { // positron + positronIds.emplace_back(trackId.trackId()); + } else { // electron + electronIds.emplace_back(trackId.trackId()); + } } - if (isKaon(track)) { - if (track.sign() > 0) { // positive kaon - posKaonIds.emplace_back(trackId.trackId()); - } else { // negative kaon - negKaonIds.emplace_back(trackId.trackId()); - } - if (std::abs(mctrack.pdgCode()) == 321) { - if (!mctrack.has_mothers() || !(mctrack.isPhysicalPrimary() || mctrack.producedByGenerator())) { - continue; - } - const auto& mp = mctrack.template mothers_first_as(); // mother particle of electron - if (cfgEventGeneratorType < 0 || mcCollision1.getSubGeneratorId() == cfgEventGeneratorType) { - if (std::abs(mp.pdgCode()) == 421) { // D0 - if (o2::aod::pwgem::dilepton::utils::mcutil::IsFromBeauty(mp, mcParticles) < 0) { - fillKaonHistograms<2, 0, 0>(track, track_par_cov_recalc, dcaXY, dcaZ); - } else { - fillKaonHistograms<2, 0, 1>(track, track_par_cov_recalc, dcaXY, dcaZ); - } - } else if (std::abs(mp.pdgCode()) == 411) { // Dpm - if (o2::aod::pwgem::dilepton::utils::mcutil::IsFromBeauty(mp, mcParticles) < 0) { - fillKaonHistograms<3, 0, 0>(track, track_par_cov_recalc, dcaXY, dcaZ); - } else { - fillKaonHistograms<3, 0, 1>(track, track_par_cov_recalc, dcaXY, dcaZ); - } - } else if (std::abs(mp.pdgCode()) == 431) { // Ds - if (o2::aod::pwgem::dilepton::utils::mcutil::IsFromBeauty(mp, mcParticles) < 0) { - fillKaonHistograms<4, 0, 0>(track, track_par_cov_recalc, dcaXY, dcaZ); - } else { - fillKaonHistograms<4, 0, 1>(track, track_par_cov_recalc, dcaXY, dcaZ); - } - } - } + if (isSelectedElectronLoose(track, trackParCov, dcaXY, dcaZ)) { + if (track.sign() > 0) { // positron + positronIdsLoose.emplace_back(trackId.trackId()); + } else { // electron + electronIdsLoose.emplace_back(trackId.trackId()); } } - } // end of track loop for kaon selection - - const auto& v0s_per_coll = v0s.sliceBy(perCol_v0, collision.globalIndex()); - k0sIds.reserve(v0s_per_coll.size()); - lambdaIds.reserve(v0s_per_coll.size()); - antilambdaIds.reserve(v0s_per_coll.size()); + } // end of track loop for electron selection - for (const auto& v0 : v0s_per_coll) { - if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) { - auto pos = v0.template posTrack_as(); - auto neg = v0.template negTrack_as(); + // First, apply pi0 prefilter to imporove S/B + std::vector vec_eFromPi0; + vec_eFromPi0.reserve(electronIds.size() + positronIds.size()); - if (!isPion(pos) || !isPion(neg)) { - continue; - } + for (const auto& positronId : positronIds) { + const auto& pos = tracks.rawIteratorAt(positronId); + mDcaInfoCov.set(999, 999, 999, 999, 999); + auto posParCov = getTrackParCov(pos); + posParCov.setPID(o2::track::PID::Electron); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, posParCov, 2.f, matCorr, &mDcaInfoCov); + ROOT::Math::PtEtaPhiMVector v1(posParCov.getPt(), posParCov.getEta(), posParCov.getPhi(), o2::constants::physics::MassElectron); - float dcaXY = 999.f; - // o2::dataformats::DCA mDcaInfoCov; + for (const auto& electronId : electronIdsLoose) { + const auto& ele = tracks.rawIteratorAt(electronId); mDcaInfoCov.set(999, 999, 999, 999, 999); - auto track_par_cov_recalc_pos = getTrackParCov(pos); - track_par_cov_recalc_pos.setPID(o2::track::PID::Pion); - // mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); - // mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, track_par_cov_recalc_pos, 2.f, matCorr, &mDcaInfoCov); - dcaXY = mDcaInfoCov.getY(); - if (!isSelectedV0Leg(pos, dcaXY)) { - continue; + auto eleParCov = getTrackParCov(ele); + eleParCov.setPID(o2::track::PID::Electron); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, eleParCov, 2.f, matCorr, &mDcaInfoCov); + ROOT::Math::PtEtaPhiMVector v2(eleParCov.getPt(), eleParCov.getEta(), eleParCov.getPhi(), o2::constants::physics::MassElectron); + + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + float mee = v12.M(); + fRegistry.fill(HIST("Prefilter/before/uls/hMee"), mee); + if (mee < cfgMeeMaxPF) { + vec_eFromPi0.emplace_back(positronId); } + } // end of loose electron sample + } // end of main positron sample + for (const auto& electronId : electronIds) { + const auto& ele = tracks.rawIteratorAt(electronId); + mDcaInfoCov.set(999, 999, 999, 999, 999); + auto eleParCov = getTrackParCov(ele); + eleParCov.setPID(o2::track::PID::Electron); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, eleParCov, 2.f, matCorr, &mDcaInfoCov); + ROOT::Math::PtEtaPhiMVector v1(eleParCov.getPt(), eleParCov.getEta(), eleParCov.getPhi(), o2::constants::physics::MassElectron); + + for (const auto& positronId : positronIdsLoose) { + const auto& pos = tracks.rawIteratorAt(positronId); mDcaInfoCov.set(999, 999, 999, 999, 999); - auto track_par_cov_recalc_neg = getTrackParCov(neg); - track_par_cov_recalc_neg.setPID(o2::track::PID::Pion); - // mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); - // mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, track_par_cov_recalc_neg, 2.f, matCorr, &mDcaInfoCov); - dcaXY = mDcaInfoCov.getY(); - if (!isSelectedV0Leg(neg, dcaXY)) { - continue; + auto posParCov = getTrackParCov(pos); + posParCov.setPID(o2::track::PID::Electron); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, posParCov, 2.f, matCorr, &mDcaInfoCov); + ROOT::Math::PtEtaPhiMVector v2(posParCov.getPt(), posParCov.getEta(), posParCov.getPhi(), o2::constants::physics::MassElectron); + + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + float mee = v12.M(); + fRegistry.fill(HIST("Prefilter/before/uls/hMee"), mee); + if (mee < cfgMeeMaxPF) { + vec_eFromPi0.emplace_back(electronId); } + } // end of loose positron sample + } // end of main electron sample - fRegistry.fill(HIST("V0/K0S/hPt"), v0.pt()); - fRegistry.fill(HIST("V0/K0S/hYPhi"), v0.phi(), v0.yK0Short()); - fRegistry.fill(HIST("V0/K0S/hCosPA"), v0.v0cosPA()); - fRegistry.fill(HIST("V0/K0S/hLxy"), v0.v0radius()); - fRegistry.fill(HIST("V0/K0S/hDCA2Legs"), v0.dcaV0daughters()); - fRegistry.fill(HIST("V0/K0S/hAP"), v0.alpha(), v0.qtarm()); - fRegistry.fill(HIST("V0/K0S/hMassK0S"), v0.mK0Short()); - k0sIds.emplace_back(v0.globalIndex()); - - } else if (v0cuts.cfg_min_mass_lambda < v0.mLambda() && v0.mLambda() < v0cuts.cfg_max_mass_lambda) { - auto pos = v0.template posTrack_as(); - auto neg = v0.template negTrack_as(); - - if (!isProton(pos) || !isPion(neg)) { + for (const auto& positronId1 : positronIds) { + const auto& pos1 = tracks.rawIteratorAt(positronId1); + mDcaInfoCov.set(999, 999, 999, 999, 999); + auto pos1ParCov = getTrackParCov(pos1); + pos1ParCov.setPID(o2::track::PID::Electron); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, pos1ParCov, 2.f, matCorr, &mDcaInfoCov); + ROOT::Math::PtEtaPhiMVector v1(pos1ParCov.getPt(), pos1ParCov.getEta(), pos1ParCov.getPhi(), o2::constants::physics::MassElectron); + + for (const auto& positronId2 : positronIdsLoose) { + const auto& pos2 = tracks.rawIteratorAt(positronId2); + if (positronId1 == positronId2) { continue; } - - float dcaXY = 999.f; - // o2::dataformats::DCA mDcaInfoCov; mDcaInfoCov.set(999, 999, 999, 999, 999); - auto track_par_cov_recalc_pos = getTrackParCov(pos); - track_par_cov_recalc_pos.setPID(o2::track::PID::Proton); - // mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); - // mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, track_par_cov_recalc_pos, 2.f, matCorr, &mDcaInfoCov); - dcaXY = mDcaInfoCov.getY(); - if (!isSelectedV0Leg(pos, dcaXY)) { + auto pos2ParCov = getTrackParCov(pos2); + pos2ParCov.setPID(o2::track::PID::Electron); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, pos2ParCov, 2.f, matCorr, &mDcaInfoCov); + ROOT::Math::PtEtaPhiMVector v2(pos2ParCov.getPt(), pos2ParCov.getEta(), pos2ParCov.getPhi(), o2::constants::physics::MassElectron); + + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + float mee = v12.M(); + fRegistry.fill(HIST("Prefilter/before/lspp/hMee"), mee); + } // end of loose positron sample + } // end of main positron sample + + for (const auto& electronId1 : electronIds) { + const auto& ele1 = tracks.rawIteratorAt(electronId1); + mDcaInfoCov.set(999, 999, 999, 999, 999); + auto ele1ParCov = getTrackParCov(ele1); + ele1ParCov.setPID(o2::track::PID::Electron); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, ele1ParCov, 2.f, matCorr, &mDcaInfoCov); + ROOT::Math::PtEtaPhiMVector v1(ele1ParCov.getPt(), ele1ParCov.getEta(), ele1ParCov.getPhi(), o2::constants::physics::MassElectron); + + for (const auto& electronId2 : electronIdsLoose) { + const auto& ele2 = tracks.rawIteratorAt(electronId2); + if (electronId1 == electronId2) { continue; } + mDcaInfoCov.set(999, 999, 999, 999, 999); + auto ele2ParCov = getTrackParCov(ele2); + ele2ParCov.setPID(o2::track::PID::Electron); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, ele2ParCov, 2.f, matCorr, &mDcaInfoCov); + ROOT::Math::PtEtaPhiMVector v2(ele2ParCov.getPt(), ele2ParCov.getEta(), ele2ParCov.getPhi(), o2::constants::physics::MassElectron); + + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + float mee = v12.M(); + fRegistry.fill(HIST("Prefilter/before/lsmm/hMee"), mee); + } // end of loose electron sample + } // end of main electron sample + + std::vector vec_diff_pos; + std::set_difference(positronIds.begin(), positronIds.end(), vec_eFromPi0.begin(), vec_eFromPi0.end(), std::back_inserter(vec_diff_pos)); + positronIds = vec_diff_pos; + + std::vector vec_diff_ele; + std::set_difference(electronIds.begin(), electronIds.end(), vec_eFromPi0.begin(), vec_eFromPi0.end(), std::back_inserter(vec_diff_ele)); + electronIds = vec_diff_ele; + + vec_eFromPi0.clear(); + vec_eFromPi0.shrink_to_fit(); + + for (const auto& electronId : electronIds) { + const auto& ele = tracks.rawIteratorAt(electronId); + mDcaInfoCov.set(999, 999, 999, 999, 999); + auto eleParCov = getTrackParCov(ele); + eleParCov.setPID(o2::track::PID::Electron); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, eleParCov, 2.f, matCorr, &mDcaInfoCov); + ROOT::Math::PtEtaPhiMVector v1(eleParCov.getPt(), eleParCov.getEta(), eleParCov.getPhi(), o2::constants::physics::MassElectron); + for (const auto& positronId : positronIds) { + const auto& pos = tracks.rawIteratorAt(positronId); mDcaInfoCov.set(999, 999, 999, 999, 999); - auto track_par_cov_recalc_neg = getTrackParCov(neg); - track_par_cov_recalc_neg.setPID(o2::track::PID::Pion); - // mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); - // mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, track_par_cov_recalc_neg, 2.f, matCorr, &mDcaInfoCov); - dcaXY = mDcaInfoCov.getY(); - if (!isSelectedV0Leg(neg, dcaXY)) { - continue; - } + auto posParCov = getTrackParCov(pos); + posParCov.setPID(o2::track::PID::Electron); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, posParCov, 2.f, matCorr, &mDcaInfoCov); + ROOT::Math::PtEtaPhiMVector v2(posParCov.getPt(), posParCov.getEta(), posParCov.getPhi(), o2::constants::physics::MassElectron); + + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + float mee = v12.M(); + fRegistry.fill(HIST("Prefilter/after/uls/hMee"), mee); + } // end of main positron sample + } // end of main electron sample - fRegistry.fill(HIST("V0/Lambda/hPt"), v0.pt()); - fRegistry.fill(HIST("V0/Lambda/hYPhi"), v0.phi(), v0.yLambda()); - fRegistry.fill(HIST("V0/Lambda/hCosPA"), v0.v0cosPA()); - fRegistry.fill(HIST("V0/Lambda/hLxy"), v0.v0radius()); - fRegistry.fill(HIST("V0/Lambda/hDCA2Legs"), v0.dcaV0daughters()); - fRegistry.fill(HIST("V0/Lambda/hAP"), v0.alpha(), v0.qtarm()); - fRegistry.fill(HIST("V0/Lambda/hMassLambda"), v0.mLambda()); + const auto& v0s_per_coll = v0s.sliceBy(perCol_v0, collision.globalIndex()); + lambdaIds.reserve(v0s_per_coll.size()); + lambdaIds.reserve(v0s_per_coll.size()); + antilambdaIds.reserve(v0s_per_coll.size()); + antilambdaIds.reserve(v0s_per_coll.size()); + for (const auto& v0 : v0s_per_coll) { + auto pos = v0.template posTrack_as(); + auto neg = v0.template negTrack_as(); + if (!isSelectedV0Leg(pos) || !isSelectedV0Leg(neg)) { + continue; + } + fillV0Histograms(v0); + if (isLambda(v0) && isProton(pos) && isPion(neg)) { lambdaIds.emplace_back(v0.globalIndex()); - } else if (v0cuts.cfg_min_mass_lambda < v0.mAntiLambda() && v0.mAntiLambda() < v0cuts.cfg_max_mass_lambda) { - auto pos = v0.template posTrack_as(); - auto neg = v0.template negTrack_as(); + } else if (isAntiLambda(v0) && isProton(neg) && isPion(pos)) { + antilambdaIds.emplace_back(v0.globalIndex()); + } + } // end of V0 loop + + const auto& cascades_per_coll = cascades.sliceBy(perCol_casc, collision.globalIndex()); + xiPlusIds.reserve(cascades_per_coll.size()); + xiPlusIds.reserve(cascades_per_coll.size()); + xiMinusIds.reserve(cascades_per_coll.size()); + xiMinusIds.reserve(cascades_per_coll.size()); + omegaPlusIds.reserve(cascades_per_coll.size()); + omegaPlusIds.reserve(cascades_per_coll.size()); + omegaMinusIds.reserve(cascades_per_coll.size()); + omegaMinusIds.reserve(cascades_per_coll.size()); + for (const auto& cascade : cascades_per_coll) { + auto pos = cascade.template posTrack_as(); + auto neg = cascade.template negTrack_as(); + auto bachelor = cascade.template bachelor_as(); + if (pos.sign() * neg.sign() > 0) { + continue; + } + if (cascade.mLambda() < cascadecut.cfg_min_mass_lambda || cascadecut.cfg_max_mass_lambda < cascade.mLambda()) { + continue; + } - if (!isPion(pos) || !isProton(neg)) { - continue; - } - float dcaXY = 999.f; - // o2::dataformats::DCA mDcaInfoCov; - mDcaInfoCov.set(999, 999, 999, 999, 999); - auto track_par_cov_recalc_pos = getTrackParCov(pos); - track_par_cov_recalc_pos.setPID(o2::track::PID::Pion); - // mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); - // mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, track_par_cov_recalc_pos, 2.f, matCorr, &mDcaInfoCov); - dcaXY = mDcaInfoCov.getY(); - if (!isSelectedV0Leg(pos, dcaXY)) { + if (!isSelectedV0Leg(pos) || !isSelectedV0Leg(neg) || !isSelectedV0Leg(bachelor)) { + continue; + } + + if (cascade.sign() < 0) { // L-> p pi- + if (!isProton(pos) || !isPion(neg)) { continue; } - - mDcaInfoCov.set(999, 999, 999, 999, 999); - auto track_par_cov_recalc_neg = getTrackParCov(neg); - track_par_cov_recalc_neg.setPID(o2::track::PID::Proton); - // mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); - // mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, track_par_cov_recalc_neg, 2.f, matCorr, &mDcaInfoCov); - dcaXY = mDcaInfoCov.getY(); - if (!isSelectedV0Leg(neg, dcaXY)) { + } else { // Lbar-> pbar pi+ + if (!isProton(neg) || !isPion(pos)) { continue; } - fRegistry.fill(HIST("V0/AntiLambda/hPt"), v0.pt()); - fRegistry.fill(HIST("V0/AntiLambda/hYPhi"), v0.phi(), v0.yLambda()); - fRegistry.fill(HIST("V0/AntiLambda/hCosPA"), v0.v0cosPA()); - fRegistry.fill(HIST("V0/AntiLambda/hLxy"), v0.v0radius()); - fRegistry.fill(HIST("V0/AntiLambda/hDCA2Legs"), v0.dcaV0daughters()); - fRegistry.fill(HIST("V0/AntiLambda/hAP"), v0.alpha(), v0.qtarm()); - fRegistry.fill(HIST("V0/AntiLambda/hMassAntiLambda"), v0.mAntiLambda()); - antilambdaIds.emplace_back(v0.globalIndex()); } - } // end of v0 loop + if (cascade.casccosPA(collision.posX(), collision.posY(), collision.posZ()) < cascadecut.cfg_min_cospa) { + continue; + } + if (cascade.v0cosPA(collision.posX(), collision.posY(), collision.posZ()) < cascadecut.cfg_min_cospa_v0) { + continue; + } - for (const auto& trackId : electronIds) { - const auto& ele = tracks.rawIteratorAt(trackId); - runPairEandTrack<0>(collision, ele, posKaonIds, tracks, mcParticles, mcCollisions); - runPairEandTrack<0>(collision, ele, negKaonIds, tracks, mcParticles, mcCollisions); // only for Ds - runPairEandV0<1>(collision, ele, k0sIds, v0s, mcParticles, mcCollisions); - runPairEandV0<2>(collision, ele, antilambdaIds, v0s, mcParticles, mcCollisions); - } // end of electron loop + fillCascadeHistograms(collision, cascade); + if (cascade.sign() < 0) { // Xi- or Omega- + if (isXi(cascade) && isPion(bachelor)) { + xiMinusIds.emplace_back(cascade.globalIndex()); + } else if (isOmega(cascade) && isKaon(bachelor)) { + omegaMinusIds.emplace_back(cascade.globalIndex()); + } + } else { // Xi+ or Omega+ + if (isXi(cascade) && isPion(bachelor)) { + xiPlusIds.emplace_back(cascade.globalIndex()); + } else if (isOmega(cascade) && isKaon(bachelor)) { + omegaPlusIds.emplace_back(cascade.globalIndex()); + } + } + } // end of cascade loop + + // Lc+ -> e+ Lambda nu_e, br = 0.0356, ctau = 60.75 um, m = 2286 MeV/c2 + for (const auto& positronId : positronIds) { + const auto& pos = tracks.rawIteratorAt(positronId); + + for (const auto& lambdaId : lambdaIds) { + const auto& lambda = v0s.rawIteratorAt(lambdaId); + const auto& eLpair = makeELPair(collision, pos, lambda); // RS + fRegistry.fill(HIST("Data/eL/RS/hs"), eLpair.mass, eLpair.ptepv, eLpair.dca3dinsigma, eLpair.lxy); + fRegistry.fill(HIST("Data/eL/RS/hCosPA"), eLpair.cospa); + fRegistry.fill(HIST("Data/eL/RS/hDCA2Legs"), eLpair.dca2legs); + fRegistry.fill(HIST("Data/eL/RS/hLxy"), eLpair.lxy); + fRegistry.fill(HIST("Data/eL/RS/hLz"), eLpair.lz); + + if constexpr (isMC) { + const auto& mcpos = pos.template mcParticle_as(); + auto posLeg = lambda.template posTrack_as(); + auto negLeg = lambda.template negTrack_as(); + const auto& mcposLeg = posLeg.template mcParticle_as(); + const auto& mcnegLeg = negLeg.template mcParticle_as(); + int mcLambdaId = FindCommonMotherFrom2Prongs(mcposLeg, mcnegLeg, 2212, -211, 3122, mcParticles); + if (mcLambdaId > 0) { // true lambda + const auto& mcLambda = mcParticles.rawIteratorAt(mcLambdaId); + int mcLambdacId = FindCommonMotherFrom2Prongs(mcpos, mcLambda, -11, 3122, 4122, mcParticles); + if (mcLambdacId > 0) { // true Lc0 + const auto& mcLambdac0 = mcParticles.rawIteratorAt(mcLambdacId); + if (IsFromBeauty(mcLambdac0, mcParticles) < 0) { + fRegistry.fill(HIST("MC/eLfromPromptLcpm/hs"), eLpair.mass, eLpair.ptepv, eLpair.dca3dinsigma, eLpair.lxy); + } else { + fRegistry.fill(HIST("MC/eLfromNonPromptLcpm/hs"), eLpair.mass, eLpair.ptepv, eLpair.dca3dinsigma, eLpair.lxy); + } + } + } + } // end of MC truth + } // end of Lambda loop + + for (const auto& antilambdaId : antilambdaIds) { + const auto& antilambda = v0s.rawIteratorAt(antilambdaId); + const auto& eLpair = makeELPair(collision, pos, antilambda); // WS + fRegistry.fill(HIST("Data/eL/WS/hs"), eLpair.mass, eLpair.ptepv, eLpair.dca3dinsigma, eLpair.lxy); + fRegistry.fill(HIST("Data/eL/WS/hCosPA"), eLpair.cospa); + fRegistry.fill(HIST("Data/eL/WS/hDCA2Legs"), eLpair.dca2legs); + fRegistry.fill(HIST("Data/eL/WS/hLxy"), eLpair.lxy); + fRegistry.fill(HIST("Data/eL/WS/hLz"), eLpair.lz); + } // end of AntiLambda loop + + } // end of main positron sample + + for (const auto& electronId : electronIds) { + const auto& ele = tracks.rawIteratorAt(electronId); + + for (const auto& lambdaId : lambdaIds) { + const auto& lambda = v0s.rawIteratorAt(lambdaId); + const auto& eLpair = makeELPair(collision, ele, lambda); // WS + fRegistry.fill(HIST("Data/eL/WS/hs"), eLpair.mass, eLpair.ptepv, eLpair.dca3dinsigma, eLpair.lxy); + fRegistry.fill(HIST("Data/eL/WS/hCosPA"), eLpair.cospa); + fRegistry.fill(HIST("Data/eL/WS/hDCA2Legs"), eLpair.dca2legs); + fRegistry.fill(HIST("Data/eL/WS/hLxy"), eLpair.lxy); + fRegistry.fill(HIST("Data/eL/WS/hLz"), eLpair.lz); + } // end of Lambda loop + + for (const auto& antilambdaId : antilambdaIds) { + const auto& antilambda = v0s.rawIteratorAt(antilambdaId); + const auto& eLpair = makeELPair(collision, ele, antilambda); // RS + fRegistry.fill(HIST("Data/eL/RS/hs"), eLpair.mass, eLpair.ptepv, eLpair.dca3dinsigma, eLpair.lxy); + fRegistry.fill(HIST("Data/eL/RS/hCosPA"), eLpair.cospa); + fRegistry.fill(HIST("Data/eL/RS/hDCA2Legs"), eLpair.dca2legs); + fRegistry.fill(HIST("Data/eL/RS/hLxy"), eLpair.lxy); + fRegistry.fill(HIST("Data/eL/RS/hLz"), eLpair.lz); + + if constexpr (isMC) { + const auto& mcele = ele.template mcParticle_as(); + auto posLeg = antilambda.template posTrack_as(); + auto negLeg = antilambda.template negTrack_as(); + const auto& mcposLeg = posLeg.template mcParticle_as(); + const auto& mcnegLeg = negLeg.template mcParticle_as(); + int mcLambdaId = FindCommonMotherFrom2Prongs(mcposLeg, mcnegLeg, 221, -2212, -3122, mcParticles); + if (mcLambdaId > 0) { // true lambda + const auto& mcLambda = mcParticles.rawIteratorAt(mcLambdaId); + int mcLambdacId = FindCommonMotherFrom2Prongs(mcele, mcLambda, 11, -3122, -4122, mcParticles); + if (mcLambdacId > 0) { // true Lc0 + const auto& mcLambdac0 = mcParticles.rawIteratorAt(mcLambdacId); + if (IsFromBeauty(mcLambdac0, mcParticles) < 0) { + fRegistry.fill(HIST("MC/eLfromPromptLcpm/hs"), eLpair.mass, eLpair.ptepv, eLpair.dca3dinsigma, eLpair.lxy); + } else { + fRegistry.fill(HIST("MC/eLfromNonPromptLcpm/hs"), eLpair.mass, eLpair.ptepv, eLpair.dca3dinsigma, eLpair.lxy); + } + } + } + } // end of MC truth + + } // end of AntiLambda loop + + } // end of main electron sample + + // Xic0 -> e+ Xi- nu_e, br = 0.0105, ctau = 45.1 um, m = 2470 MeV/c2 + for (const auto& positronId : positronIds) { + const auto& pos = tracks.rawIteratorAt(positronId); + + for (const auto& xiMinusId : xiMinusIds) { + const auto& xiMinus = cascades.rawIteratorAt(xiMinusId); + const auto& eXipair = makeECascadePair<0>(collision, pos, xiMinus); // RS + fRegistry.fill(HIST("Data/eXi/RS/hs"), eXipair.mass, eXipair.ptepv, eXipair.dca3dinsigma, eXipair.lxy); + fRegistry.fill(HIST("Data/eXi/RS/hCosPA"), eXipair.cospa); + fRegistry.fill(HIST("Data/eXi/RS/hDCA2Legs"), eXipair.dca2legs); + fRegistry.fill(HIST("Data/eXi/RS/hLxy"), eXipair.lxy); + fRegistry.fill(HIST("Data/eXi/RS/hLz"), eXipair.lz); + + if constexpr (isMC) { + const auto& mcpos = pos.template mcParticle_as(); + auto posLeg = xiMinus.template posTrack_as(); + auto negLeg = xiMinus.template negTrack_as(); + auto bachelor = xiMinus.template bachelor_as(); + const auto& mcposLeg = posLeg.template mcParticle_as(); + const auto& mcnegLeg = negLeg.template mcParticle_as(); + const auto& mcbachelor = bachelor.template mcParticle_as(); + int mcLambdaId = FindCommonMotherFrom2Prongs(mcposLeg, mcnegLeg, 2212, -211, 3122, mcParticles); + if (mcLambdaId > 0) { // true Lambda + const auto& mcLambda = mcParticles.rawIteratorAt(mcLambdaId); + int mcXiId = FindCommonMotherFrom2Prongs(mcLambda, mcbachelor, 3122, -211, 3312, mcParticles); + if (mcXiId > 0) { // true xiMinus + const auto& mcXi = mcParticles.rawIteratorAt(mcXiId); + int mcXic0Id = FindCommonMotherFrom2Prongs(mcpos, mcXi, -11, 3312, 4132, mcParticles); + if (mcXic0Id > 0) { // true Xic0 + const auto& mcXic0 = mcParticles.rawIteratorAt(mcXic0Id); + if (IsFromBeauty(mcXic0, mcParticles) < 0) { + fRegistry.fill(HIST("MC/eXifromPromptXic0/hs"), eXipair.mass, eXipair.ptepv, eXipair.dca3dinsigma, eXipair.lxy); + } else { + fRegistry.fill(HIST("MC/eXifromNonPromptXic0/hs"), eXipair.mass, eXipair.ptepv, eXipair.dca3dinsigma, eXipair.lxy); + } + } + } + } + } // end of MC truth + } // end of Lambda loop + + for (const auto& xiPlusId : xiPlusIds) { + const auto& xiPlus = cascades.rawIteratorAt(xiPlusId); + const auto& eXipair = makeECascadePair<0>(collision, pos, xiPlus); // WS + fRegistry.fill(HIST("Data/eXi/WS/hs"), eXipair.mass, eXipair.ptepv, eXipair.dca3dinsigma, eXipair.lxy); + fRegistry.fill(HIST("Data/eXi/WS/hCosPA"), eXipair.cospa); + fRegistry.fill(HIST("Data/eXi/WS/hDCA2Legs"), eXipair.dca2legs); + fRegistry.fill(HIST("Data/eXi/WS/hLxy"), eXipair.lxy); + fRegistry.fill(HIST("Data/eXi/WS/hLz"), eXipair.lz); + } // end of AntiLambda loop + } // end of main positron sample + + for (const auto& electronId : electronIds) { + const auto& ele = tracks.rawIteratorAt(electronId); + + for (const auto& xiMinusId : xiMinusIds) { + const auto& xiMinus = cascades.rawIteratorAt(xiMinusId); + const auto& eXipair = makeECascadePair<0>(collision, ele, xiMinus); // WS + fRegistry.fill(HIST("Data/eXi/WS/hs"), eXipair.mass, eXipair.ptepv, eXipair.dca3dinsigma, eXipair.lxy); + fRegistry.fill(HIST("Data/eXi/WS/hCosPA"), eXipair.cospa); + fRegistry.fill(HIST("Data/eXi/WS/hDCA2Legs"), eXipair.dca2legs); + fRegistry.fill(HIST("Data/eXi/WS/hLxy"), eXipair.lxy); + fRegistry.fill(HIST("Data/eXi/WS/hLz"), eXipair.lz); + + } // end of Xi- loop + + for (const auto& xiPlusId : xiPlusIds) { + const auto& xiPlus = cascades.rawIteratorAt(xiPlusId); + const auto& eXipair = makeECascadePair<0>(collision, ele, xiPlus); // RS + fRegistry.fill(HIST("Data/eXi/RS/hs"), eXipair.mass, eXipair.ptepv, eXipair.dca3dinsigma, eXipair.lxy); + fRegistry.fill(HIST("Data/eXi/RS/hCosPA"), eXipair.cospa); + fRegistry.fill(HIST("Data/eXi/RS/hDCA2Legs"), eXipair.dca2legs); + fRegistry.fill(HIST("Data/eXi/RS/hLxy"), eXipair.lxy); + fRegistry.fill(HIST("Data/eXi/RS/hLz"), eXipair.lz); + + if constexpr (isMC) { + const auto& mcele = ele.template mcParticle_as(); + auto posLeg = xiPlus.template posTrack_as(); + auto negLeg = xiPlus.template negTrack_as(); + auto bachelor = xiPlus.template bachelor_as(); + const auto& mcposLeg = posLeg.template mcParticle_as(); + const auto& mcnegLeg = negLeg.template mcParticle_as(); + const auto& mcbachelor = bachelor.template mcParticle_as(); + int mcLambdaId = FindCommonMotherFrom2Prongs(mcposLeg, mcnegLeg, 211, -2212, -3122, mcParticles); + if (mcLambdaId > 0) { // true AntiLambda + const auto& mcLambda = mcParticles.rawIteratorAt(mcLambdaId); + int mcXiId = FindCommonMotherFrom2Prongs(mcLambda, mcbachelor, -3122, 211, -3312, mcParticles); + if (mcXiId > 0) { // true xiPlus + const auto& mcXi = mcParticles.rawIteratorAt(mcXiId); + int mcXic0Id = FindCommonMotherFrom2Prongs(mcele, mcXi, 11, -3312, 4132, mcParticles); + if (mcXic0Id > 0) { // true Xic0 + const auto& mcXic0 = mcParticles.rawIteratorAt(mcXic0Id); + if (IsFromBeauty(mcXic0, mcParticles) < 0) { + fRegistry.fill(HIST("MC/eXifromPromptXic0/hs"), eXipair.mass, eXipair.ptepv, eXipair.dca3dinsigma, eXipair.lxy); + } else { + fRegistry.fill(HIST("MC/eXifromNonPromptXic0/hs"), eXipair.mass, eXipair.ptepv, eXipair.dca3dinsigma, eXipair.lxy); + } + } + } + } + } // end of MC truth + + } // end of Xi+ loop + } // end of main electron sample + + // Omegac0 -> e+ Omega- nu_e, br(Omegac0 -> e+ Omega- nu_e) / br(Omegac0 -> Omega- pi+) = 1.98, ctau = 82 um, m = 2695 MeV/c2 + for (const auto& positronId : positronIds) { + const auto& pos = tracks.rawIteratorAt(positronId); + + for (const auto& omegaMinusId : omegaMinusIds) { + const auto& omegaMinus = cascades.rawIteratorAt(omegaMinusId); + const auto& eOmegapair = makeECascadePair<1>(collision, pos, omegaMinus); // RS + fRegistry.fill(HIST("Data/eOmega/RS/hs"), eOmegapair.mass, eOmegapair.ptepv, eOmegapair.dca3dinsigma, eOmegapair.lxy); + fRegistry.fill(HIST("Data/eOmega/RS/hCosPA"), eOmegapair.cospa); + fRegistry.fill(HIST("Data/eOmega/RS/hDCA2Legs"), eOmegapair.dca2legs); + fRegistry.fill(HIST("Data/eOmega/RS/hLxy"), eOmegapair.lxy); + fRegistry.fill(HIST("Data/eOmega/RS/hLz"), eOmegapair.lz); + + if constexpr (isMC) { + const auto& mcpos = pos.template mcParticle_as(); + auto posLeg = omegaMinus.template posTrack_as(); + auto negLeg = omegaMinus.template negTrack_as(); + auto bachelor = omegaMinus.template bachelor_as(); + const auto& mcposLeg = posLeg.template mcParticle_as(); + const auto& mcnegLeg = negLeg.template mcParticle_as(); + const auto& mcbachelor = bachelor.template mcParticle_as(); + int mcLambdaId = FindCommonMotherFrom2Prongs(mcposLeg, mcnegLeg, 2212, -211, 3122, mcParticles); + if (mcLambdaId > 0) { // true Lambda + const auto& mcLambda = mcParticles.rawIteratorAt(mcLambdaId); + int mcOmegaId = FindCommonMotherFrom2Prongs(mcLambda, mcbachelor, 3122, -211, 3312, mcParticles); + if (mcOmegaId > 0) { // true omegaMinus + const auto& mcOmega = mcParticles.rawIteratorAt(mcOmegaId); + int mcOmegac0Id = FindCommonMotherFrom2Prongs(mcpos, mcOmega, -11, 3312, 4132, mcParticles); + if (mcOmegac0Id > 0) { // true Omegac0 + const auto& mcOmegac0 = mcParticles.rawIteratorAt(mcOmegac0Id); + if (IsFromBeauty(mcOmegac0, mcParticles) < 0) { + fRegistry.fill(HIST("MC/eOmegafromPromptOmegac0/hs"), eOmegapair.mass, eOmegapair.ptepv, eOmegapair.dca3dinsigma, eOmegapair.lxy); + } else { + fRegistry.fill(HIST("MC/eOmegafromNonPromptOmegac0/hs"), eOmegapair.mass, eOmegapair.ptepv, eOmegapair.dca3dinsigma, eOmegapair.lxy); + } + } + } + } + } // end of MC truth + } // end of Lambda loop + + for (const auto& omegaPlusId : omegaPlusIds) { + const auto& omegaPlus = cascades.rawIteratorAt(omegaPlusId); + const auto& eOmegapair = makeECascadePair<1>(collision, pos, omegaPlus); // WS + fRegistry.fill(HIST("Data/eOmega/WS/hs"), eOmegapair.mass, eOmegapair.ptepv, eOmegapair.dca3dinsigma, eOmegapair.lxy); + fRegistry.fill(HIST("Data/eOmega/WS/hCosPA"), eOmegapair.cospa); + fRegistry.fill(HIST("Data/eOmega/WS/hDCA2Legs"), eOmegapair.dca2legs); + fRegistry.fill(HIST("Data/eOmega/WS/hLxy"), eOmegapair.lxy); + fRegistry.fill(HIST("Data/eOmega/WS/hLz"), eOmegapair.lz); + } // end of AntiLambda loop + } // end of main positron sample + + for (const auto& electronId : electronIds) { + const auto& ele = tracks.rawIteratorAt(electronId); + + for (const auto& omegaMinusId : omegaMinusIds) { + const auto& omegaMinus = cascades.rawIteratorAt(omegaMinusId); + const auto& eOmegapair = makeECascadePair<1>(collision, ele, omegaMinus); // WS + fRegistry.fill(HIST("Data/eOmega/WS/hs"), eOmegapair.mass, eOmegapair.ptepv, eOmegapair.dca3dinsigma, eOmegapair.lxy); + fRegistry.fill(HIST("Data/eOmega/WS/hCosPA"), eOmegapair.cospa); + fRegistry.fill(HIST("Data/eOmega/WS/hDCA2Legs"), eOmegapair.dca2legs); + fRegistry.fill(HIST("Data/eOmega/WS/hLxy"), eOmegapair.lxy); + fRegistry.fill(HIST("Data/eOmega/WS/hLz"), eOmegapair.lz); + + } // end of Omega- loop + + for (const auto& omegaPlusId : omegaPlusIds) { + const auto& omegaPlus = cascades.rawIteratorAt(omegaPlusId); + const auto& eOmegapair = makeECascadePair<1>(collision, ele, omegaPlus); // RS + fRegistry.fill(HIST("Data/eOmega/RS/hs"), eOmegapair.mass, eOmegapair.ptepv, eOmegapair.dca3dinsigma, eOmegapair.lxy); + fRegistry.fill(HIST("Data/eOmega/RS/hCosPA"), eOmegapair.cospa); + fRegistry.fill(HIST("Data/eOmega/RS/hDCA2Legs"), eOmegapair.dca2legs); + fRegistry.fill(HIST("Data/eOmega/RS/hLxy"), eOmegapair.lxy); + fRegistry.fill(HIST("Data/eOmega/RS/hLz"), eOmegapair.lz); + + if constexpr (isMC) { + const auto& mcele = ele.template mcParticle_as(); + auto posLeg = omegaPlus.template posTrack_as(); + auto negLeg = omegaPlus.template negTrack_as(); + auto bachelor = omegaPlus.template bachelor_as(); + const auto& mcposLeg = posLeg.template mcParticle_as(); + const auto& mcnegLeg = negLeg.template mcParticle_as(); + const auto& mcbachelor = bachelor.template mcParticle_as(); + int mcLambdaId = FindCommonMotherFrom2Prongs(mcposLeg, mcnegLeg, 211, -2212, -3122, mcParticles); + if (mcLambdaId > 0) { // true AntiLambda + const auto& mcLambda = mcParticles.rawIteratorAt(mcLambdaId); + int mcOmegaId = FindCommonMotherFrom2Prongs(mcLambda, mcbachelor, -3122, 211, -3312, mcParticles); + if (mcOmegaId > 0) { // true omegaPlus + const auto& mcOmega = mcParticles.rawIteratorAt(mcOmegaId); + int mcOmegac0Id = FindCommonMotherFrom2Prongs(mcele, mcOmega, 11, -3312, 4132, mcParticles); + if (mcOmegac0Id > 0) { // true Omegac0 + const auto& mcOmegac0 = mcParticles.rawIteratorAt(mcOmegac0Id); + if (IsFromBeauty(mcOmegac0, mcParticles) < 0) { + fRegistry.fill(HIST("MC/eOmegafromPromptOmegac0/hs"), eOmegapair.mass, eOmegapair.ptepv, eOmegapair.dca3dinsigma, eOmegapair.lxy); + } else { + fRegistry.fill(HIST("MC/eOmegafromNonPromptOmegac0/hs"), eOmegapair.mass, eOmegapair.ptepv, eOmegapair.dca3dinsigma, eOmegapair.lxy); + } + } + } + } + } // end of MC truth - for (const auto& trackId : positronIds) { - const auto& pos = tracks.rawIteratorAt(trackId); - runPairEandTrack<0>(collision, pos, negKaonIds, tracks, mcParticles, mcCollisions); - runPairEandTrack<0>(collision, pos, posKaonIds, tracks, mcParticles, mcCollisions); // only for Ds - runPairEandV0<1>(collision, pos, k0sIds, v0s, mcParticles, mcCollisions); // only for Ds - runPairEandV0<2>(collision, pos, lambdaIds, v0s, mcParticles, mcCollisions); - } // end of positron loop + } // end of Omega+ loop + } // end of main electron sample + electronIdsLoose.clear(); + electronIdsLoose.shrink_to_fit(); + positronIdsLoose.clear(); + positronIdsLoose.shrink_to_fit(); electronIds.clear(); electronIds.shrink_to_fit(); positronIds.clear(); @@ -1327,87 +1574,75 @@ struct taggingHFE { posKaonIds.clear(); posKaonIds.shrink_to_fit(); - k0sIds.clear(); - k0sIds.shrink_to_fit(); lambdaIds.clear(); lambdaIds.shrink_to_fit(); antilambdaIds.clear(); antilambdaIds.shrink_to_fit(); + + xiPlusIds.clear(); + xiPlusIds.shrink_to_fit(); + xiMinusIds.clear(); + xiMinusIds.shrink_to_fit(); + + omegaPlusIds.clear(); + omegaPlusIds.shrink_to_fit(); + omegaMinusIds.clear(); + omegaMinusIds.shrink_to_fit(); } // end of collision loop used_electronIds.clear(); used_electronIds.shrink_to_fit(); } - PROCESS_SWITCH(taggingHFE, processTTCA, "process with TTCA", true); - template - bool isSemiLeptonic(TMCParticle const& mcParticle, TMCParticles const& mcParticles) - { - if (!mcParticle.has_daughters()) { - return false; - } - bool is_lepton_involved = false; - bool is_neutrino_involved = false; - for (int d = mcParticle.daughtersIds()[0]; d <= mcParticle.daughtersIds()[1]; ++d) { - if (d < mcParticles.size()) { // protect against bad daughter indices - const auto& daughter = mcParticles.rawIteratorAt(d); - if (daughter.pdgCode() == pdgLepton) { - is_lepton_involved = true; - } else if (daughter.pdgCode() == pdgNeutrino) { - is_neutrino_involved = true; - } - } else { - std::cout << "Daughter label (" << d << ") exceeds the McParticles size (" << mcParticles.size() << ")" << std::endl; - std::cout << " Check the MC generator" << std::endl; - return false; - } - } + SliceCache cache; + Preslice perCol = o2::aod::track::collisionId; + Preslice perCol_v0 = o2::aod::v0data::collisionId; + Preslice perCol_casc = o2::aod::cascdata::collisionId; - if (is_lepton_involved && is_neutrino_involved) { - return true; - } else { - return false; - } - } + Filter collisionFilter_evsel = o2::aod::evsel::sel8 == true && (eventcut.cfgZvtxMin < o2::aod::collision::posZ && o2::aod::collision::posZ < eventcut.cfgZvtxMax); + Filter collisionFilter_centrality = (eventcut.cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < eventcut.cfgCentMax) || (eventcut.cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < eventcut.cfgCentMax) || (eventcut.cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < eventcut.cfgCentMax); + using FilteredMyCollisions = soa::Filtered; + using FilteredMyCollisionsWithMCLabel = soa::Filtered; - Partition genDpms = nabs(o2::aod::mcparticle::pdgCode) == 411; - Partition genD0s = nabs(o2::aod::mcparticle::pdgCode) == 421; - Partition genDss = nabs(o2::aod::mcparticle::pdgCode) == 431; - Partition genLcs = nabs(o2::aod::mcparticle::pdgCode) == 4122; + Preslice trackIndicesPerCollision = aod::track_association::collisionId; + std::vector> stored_trackIds; - void processGen(aod::McCollisions const&, aod::McParticles const& mcParticles) - { - for (const auto& genD0 : genD0s) { - const auto& mcCollision = genD0.template mcCollision_as(); - if (cfgEventGeneratorType >= 0 && mcCollision.getSubGeneratorId() != cfgEventGeneratorType) { - continue; - } - if (!(genD0.isPhysicalPrimary() || genD0.producedByGenerator())) { - continue; - } - if ((isSemiLeptonic<11, -12>(genD0, mcParticles) || isSemiLeptonic<-11, 12>(genD0, mcParticles))) { - float ptE = 999.f, ptK = 999.f; - float etaE = 999.f, etaK = 999.f; - for (int d = genD0.daughtersIds()[0]; d <= genD0.daughtersIds()[1]; ++d) { - const auto& daughter = mcParticles.rawIteratorAt(d); - if (std::abs(daughter.pdgCode()) == 11) { - ptE = daughter.pt(); - etaE = daughter.eta(); - } else if (std::abs(daughter.pdgCode()) == 321) { - ptK = daughter.pt(); - etaK = daughter.eta(); - } - } - if (o2::aod::pwgem::dilepton::utils::mcutil::IsFromBeauty(genD0, mcParticles) < 0) { - fRegistry.fill(HIST("Generated/D0/prompt/hs"), ptE, ptK, etaE, etaK); - } else { - fRegistry.fill(HIST("Generated/D0/nonprompt/hs"), ptE, ptK, etaE, etaK); - } - } + // Filter trackFilter = ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC) == true; + // using MyFilteredTracks = soa::Filtered; + // using MyFilteredTracksWithMCLabel = soa::Filtered; + // Partition posTracks = o2::aod::track::signed1Pt > 0.f; + // Partition negTracks = o2::aod::track::signed1Pt < 0.f; + + //! type of V0. 0: built solely for cascades (does not pass standard V0 cut), 1: standard 2, 3: photon-like with TPC-only use. Regular analysis should always use type 1. + Filter v0Filter = o2::aod::v0data::v0Type == uint8_t(1) && o2::aod::v0data::v0cosPA > v0cut.cfg_min_cospa&& o2::aod::v0data::dcaV0daughters v0cut.cfg_min_dcaxy&& nabs(o2::aod::v0data::dcanegtopv) > v0cut.cfg_min_dcaxy; + using filteredV0s = soa::Filtered; + + Filter cascadeFilter = nabs(o2::aod::cascdata::dcanegtopv) > cascadecut.cfg_min_dcaxy_v0leg&& nabs(o2::aod::cascdata::dcanegtopv) > cascadecut.cfg_min_dcaxy_v0leg&& nabs(o2::aod::cascdata::dcabachtopv) > cascadecut.cfg_min_dcaxy_bachelor; + Filter cascadeFilter_dca = o2::aod::cascdata::dcacascdaughters < cascadecut.cfg_max_dcadau && o2::aod::cascdata::dcaV0daughters < cascadecut.cfg_max_dcadau_v0; + using filteredMyCascades = soa::Filtered; + + std::vector electronIdsLoose; + std::vector positronIdsLoose; + std::vector electronIds; + std::vector positronIds; + std::vector negKaonIds; + std::vector posKaonIds; - } // end of gen. D0 loop + std::vector lambdaIds; + std::vector antilambdaIds; + + std::vector xiPlusIds; + std::vector xiMinusIds; + std::vector omegaPlusIds; + std::vector omegaMinusIds; + + std::vector> used_electronIds; // pair of hTypeId and electronId + + void processMC(FilteredMyCollisionsWithMCLabel const& collisions, aod::BCsWithTimestamps const& bcs, MyTracksWithMCLabel const& tracks, aod::TrackAssoc const& trackIndices, filteredV0s const& v0s, filteredMyCascades const& cascades, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) + { + runPairing(bcs, collisions, tracks, trackIndices, v0s, cascades, mcCollisions, mcParticles); } - PROCESS_SWITCH(taggingHFE, processGen, "process gen. info", true); + PROCESS_SWITCH(taggingHFE, processMC, "process with TTCA", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { From 35c309d7226a10c78f30d8979f7bdc4683157a52 Mon Sep 17 00:00:00 2001 From: Debadatta3337 Date: Wed, 20 Aug 2025 14:55:14 +0530 Subject: [PATCH 115/986] [PWGDQ] Updated CutLibrary.cxx (#12641) Co-authored-by: Debadatta3337 --- PWGDQ/Core/CutsLibrary.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/PWGDQ/Core/CutsLibrary.cxx b/PWGDQ/Core/CutsLibrary.cxx index 14d8b6aa256..20a4c7c548f 100644 --- a/PWGDQ/Core/CutsLibrary.cxx +++ b/PWGDQ/Core/CutsLibrary.cxx @@ -3953,6 +3953,17 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName) return cut; } + if (!nameStr.compare("eventStandardSel8ppQualityNoVtxZ")) { + cut->AddCut(VarManager::kIsSel8, 0.5, 1.5); + cut->AddCut(VarManager::kIsNoTFBorder, 0.5, 1.5); + cut->AddCut(VarManager::kIsNoITSROFBorder, 0.5, 1.5); + cut->AddCut(VarManager::kIsNoSameBunch, 0.5, 1.5); + cut->AddCut(VarManager::kIsGoodZvtxFT0vsPV, 0.5, 1.5); + cut->AddCut(VarManager::kIsVertexITSTPC, 0.5, 1.5); + cut->AddCut(VarManager::kIsVertexTOFmatched, 0.5, 1.5); + return cut; + } + if (!nameStr.compare("eventStandardSel8multAnalysis")) { cut->AddCut(VarManager::kVtxZ, -10.0, 10.0); cut->AddCut(VarManager::kIsSel8, 0.5, 1.5); From 19495cb95df9abe259c77334224641753b8444f8 Mon Sep 17 00:00:00 2001 From: Shirajum Monira <38348689+Eloviyo@users.noreply.github.com> Date: Wed, 20 Aug 2025 11:26:24 +0200 Subject: [PATCH 116/986] [PWGCF] FemtoUniverse cascade task -- fixed bugs (#12642) Co-authored-by: Shirajum Monira --- ...toUniversePairTaskTrackCascadeExtended.cxx | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx index 7487576f8e6..8cad618d1dd 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx @@ -489,7 +489,7 @@ struct femtoUniversePairTaskTrackCascadeExtended { } if (confIsCPR.value) { if (pairCloseRejection.isClosePair(p1, p2, parts, magFieldTesla, femto_universe_container::EventType::same)) { - return; + continue; } } @@ -723,8 +723,8 @@ struct femtoUniversePairTaskTrackCascadeExtended { continue; } if (confIsCPR.value) { - if (pairCloseRejection.isClosePair(p1, p2, parts, magFieldTesla1, femto_universe_container::EventType::same)) { - return; + if (pairCloseRejection.isClosePair(p1, p2, parts, magFieldTesla1, femto_universe_container::EventType::mixed)) { + continue; } } @@ -792,14 +792,14 @@ struct femtoUniversePairTaskTrackCascadeExtended { /// Child particles must pass this condition to be selected if constexpr (std::experimental::is_detected::value) { if (!isParticleTPC(posChild1, CascChildTable[confCascType1][0]) || !isParticleTPC(negChild1, CascChildTable[confCascType1][1]) || !isParticleTPC(bachelor1, CascChildTable[confCascType1][2])) - return; + continue; if ((!confCheckTOFBachelorOnly && (!isParticleTOF(posChild1, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild1, CascChildTable[confCascType1][1]))) || !isParticleTOF(bachelor1, CascChildTable[confCascType1][2])) - return; + continue; } else { if ((posChild1.pidCut() & (1u << CascChildTable[confCascType1][0])) == 0 || (negChild1.pidCut() & (1u << CascChildTable[confCascType1][1])) == 0 || (bachelor1.pidCut() & (1u << CascChildTable[confCascType1][2])) == 0) - return; + continue; if ((!confCheckTOFBachelorOnly && ((posChild1.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild1.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0)) || (bachelor1.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) - return; + continue; } const auto& posChild2 = parts.iteratorAt(p2.globalIndex() - 3 - parts.begin().globalIndex()); @@ -808,14 +808,14 @@ struct femtoUniversePairTaskTrackCascadeExtended { /// Child particles must pass this condition to be selected if constexpr (std::experimental::is_detected::value) { if (!isParticleTPC(posChild2, CascChildTable[confCascType2][0]) || !isParticleTPC(negChild2, CascChildTable[confCascType2][1]) || !isParticleTPC(bachelor2, CascChildTable[confCascType2][2])) - return; + continue; if ((!confCheckTOFBachelorOnly && (!isParticleTOF(posChild2, CascChildTable[confCascType2][0]) || !isParticleTOF(negChild2, CascChildTable[confCascType2][1]))) || !isParticleTOF(bachelor2, CascChildTable[confCascType2][2])) - return; + continue; } else { if ((posChild2.pidCut() & (1u << CascChildTable[confCascType1][0])) == 0 || (negChild2.pidCut() & (1u << CascChildTable[confCascType1][1])) == 0 || (bachelor2.pidCut() & (1u << CascChildTable[confCascType1][2])) == 0) - return; + continue; if ((!confCheckTOFBachelorOnly && ((posChild2.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild2.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0)) || (bachelor2.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) - return; + continue; } // track cleaning if (!pairCleanerCasc.isCleanPair(p1, p2, parts)) { From f2644b25f6e1ec83386716fa06291622541b2229 Mon Sep 17 00:00:00 2001 From: Chiara De Martin <39315597+ChiaraDeMartin95@users.noreply.github.com> Date: Wed, 20 Aug 2025 13:13:19 +0200 Subject: [PATCH 117/986] [PWGLF] Add shift correctionfor event plane calibration (#12630) Co-authored-by: Chiara De Martin Co-authored-by: ALICE Action Bot --- .../TableProducer/Strangeness/cascadeflow.cxx | 209 +++++++++++++++--- 1 file changed, 175 insertions(+), 34 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx index 72faae0ec23..dc38426e90e 100644 --- a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx @@ -42,10 +42,10 @@ using namespace o2::framework::expressions; using std::array; using DauTracks = soa::Join; -using CollEventPlane = soa::Join::iterator; -using CollEventPlaneCentralFW = soa::Join::iterator; -using CollEventAndSpecPlane = soa::Join::iterator; -using CollEventAndSpecPlaneCentralFW = soa::Join::iterator; +using CollEventPlane = soa::Join::iterator; +using CollEventPlaneCentralFW = soa::Join::iterator; +using CollEventAndSpecPlane = soa::Join::iterator; +using CollEventAndSpecPlaneCentralFW = soa::Join::iterator; using MCCollisionsStra = soa::Join; using V0Candidates = soa::Join; using CascCandidates = soa::Join; @@ -170,6 +170,11 @@ struct cascadeFlow { ConfigurableAxis axisQVs{"axisQVs", {500, -10.f, 10.f}, "axisQVs"}; ConfigurableAxis axisQVsNorm{"axisQVsNorm", {200, -1.f, 1.f}, "axisQVsNorm"}; + // Configurable for shift correction + Configurable cfgShiftCorr{"cfgShiftCorr", 0, ""}; + Configurable cfgShiftPath{"cfgShiftPath", "Users/j/junlee/Qvector/QvecCalib/Shift", "Path for Shift"}; + Configurable cfgnMods{"cfgnMods", 1, "The number of modulations of interest starting from 2"}; + // THN axes ConfigurableAxis thnConfigAxisFT0C{"thnConfigAxisFT0C", {8, 0, 80}, "FT0C centrality (%)"}; ConfigurableAxis thnConfigAxisEta{"thnConfigAxisEta", {8, -0.8, 0.8}, "pseudorapidity"}; @@ -464,6 +469,53 @@ struct cascadeFlow { return phi; } + int currentRunNumber = -999; + int lastRunNumber = -999; + std::vector shiftprofile{}; + std::string fullCCDBShiftCorrPath; + + template + double ApplyShiftCorrection(TCollision coll, double psiT0C) + { + int nmode = 2; + auto deltapsiFT0C = 0.0; + + for (int ishift = 1; ishift <= 10; ishift++) { + auto coeffshiftxFT0C = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 0.5, ishift - 0.5)); + auto coeffshiftyFT0C = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 1.5, ishift - 0.5)); + + deltapsiFT0C += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0C * TMath::Cos(ishift * static_cast(nmode) * psiT0C) + coeffshiftyFT0C * TMath::Sin(ishift * static_cast(nmode) * psiT0C))); + } + return psiT0C + deltapsiFT0C; + } + + template + double ComputeEPResolutionwShifts(TCollision coll, double psiT0C, double psiTPCA, double psiTPCC) + { + int nmode = 2; + auto deltapsiFT0C = 0.0; + auto deltapsiTPCA = 0.0; + auto deltapsiTPCC = 0.0; + for (int ishift = 1; ishift <= 10; ishift++) { + auto coeffshiftxFT0C = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 0.5, ishift - 0.5)); + auto coeffshiftyFT0C = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 1.5, ishift - 0.5)); + auto coeffshiftxTPCA = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 2.5, ishift - 0.5)); + auto coeffshiftyTPCA = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 3.5, ishift - 0.5)); + auto coeffshiftxTPCC = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 4.5, ishift - 0.5)); + auto coeffshiftyTPCC = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 5.5, ishift - 0.5)); + deltapsiFT0C += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0C * TMath::Cos(ishift * static_cast(nmode) * psiT0C) + coeffshiftyFT0C * TMath::Sin(ishift * static_cast(nmode) * psiT0C))); + deltapsiTPCA += ((1 / (1.0 * ishift)) * (-coeffshiftxTPCA * TMath::Cos(ishift * static_cast(nmode) * psiTPCA) + coeffshiftyTPCA * TMath::Sin(ishift * static_cast(nmode) * psiTPCA))); + deltapsiTPCC += ((1 / (1.0 * ishift)) * (-coeffshiftxTPCC * TMath::Cos(ishift * static_cast(nmode) * psiTPCC) + coeffshiftyTPCC * TMath::Sin(ishift * static_cast(nmode) * psiTPCC))); + } + // histos.fill(HIST("psi2/QA/EP_FT0C_shifted"), coll.centFT0C(), psiT0C + deltapsiFT0C); + // histos.fill(HIST("psi2/QA/EP_TPCA_shifted"), coll.centFT0C(), psiTPCA + deltapsiTPCA); + // histos.fill(HIST("psi2/QA/EP_TPCC_shifted"), coll.centFT0C(), psiTPCC + deltapsiTPCC); + resolution.fill(HIST("QVectorsT0CTPCA_Shifted"), coll.centFT0C(), TMath::Cos(static_cast(nmode) * (psiT0C + deltapsiFT0C - psiTPCA - deltapsiTPCA))); + resolution.fill(HIST("QVectorsT0CTPCC_Shifted"), coll.centFT0C(), TMath::Cos(static_cast(nmode) * (psiT0C + deltapsiFT0C - psiTPCC - deltapsiTPCC))); + resolution.fill(HIST("QVectorsTPCAC_Shifted"), coll.centFT0C(), TMath::Cos(static_cast(nmode) * (psiTPCA + deltapsiTPCA - psiTPCC - deltapsiTPCC))); + return true; + } + // objects to use for acceptance correction TH2F* hAcceptanceXi; TH2F* hAcceptanceOmega; @@ -670,6 +722,9 @@ struct cascadeFlow { resolution.add("QVectorsNormT0CTPCC", "QVectorsNormT0CTPCC", HistType::kTH2F, {axisQVsNorm, CentAxis}); resolution.add("QVectorsNormTPCAC", "QVectorsNormTPCCB", HistType::kTH2F, {axisQVsNorm, CentAxis}); resolution.add("QVectorsSpecPlane", "QVectorsSpecPlane", HistType::kTH2F, {axisQVsNorm, CentAxis}); + resolution.add("QVectorsT0CTPCA_Shifted", "QVectorsT0CTPCA_Shifted", HistType::kTH2F, {axisQVs, CentAxis}); + resolution.add("QVectorsT0CTPCC_Shifted", "QVectorsT0CTPCC_Shifted", HistType::kTH2F, {axisQVs, CentAxis}); + resolution.add("QVectorsTPCAC_Shifted", "QVectorsTPCAC_Shifted", HistType::kTH2F, {axisQVs, CentAxis}); histos.add("hNEvents", "hNEvents", {HistType::kTH1F, {{10, 0.f, 10.f}}}); for (Int_t n = 1; n <= histos.get(HIST("hNEvents"))->GetNbinsX(); n++) { @@ -981,10 +1036,33 @@ struct cascadeFlow { ROOT::Math::XYZVector spectatorplaneVecZDCA{std::cos(coll.psiZDCA()), std::sin(coll.psiZDCA()), 0}; // eta positive = projectile ROOT::Math::XYZVector spectatorplaneVecZDCC{std::cos(coll.psiZDCC()), std::sin(coll.psiZDCC()), 0}; // eta negative = target - const float PsiT0C = std::atan2(coll.qvecFT0CIm(), coll.qvecFT0CRe()) * 0.5f; - histos.fill(HIST("hPsiT0C"), PsiT0C); + const float psiT0C = std::atan2(coll.qvecFT0CIm(), coll.qvecFT0CRe()) * 0.5f; + const float psiTPCA = std::atan2(coll.qvecBPosIm(), coll.qvecBPosRe()) * 0.5f; + const float psiTPCC = std::atan2(coll.qvecBNegIm(), coll.qvecBNegRe()) * 0.5f; + float psiT0CCorr = psiT0C; + + if (cfgShiftCorr) { + currentRunNumber = coll.runNumber(); + if (currentRunNumber != lastRunNumber) { + shiftprofile.clear(); + for (int i = 2; i < cfgnMods + 2; i++) { + fullCCDBShiftCorrPath = cfgShiftPath; + fullCCDBShiftCorrPath += "/v"; + fullCCDBShiftCorrPath += std::to_string(i); + auto objshift = ccdb->getForTimeStamp(fullCCDBShiftCorrPath, coll.timestamp()); + shiftprofile.push_back(objshift); + } + lastRunNumber = currentRunNumber; + } + } + if (cfgShiftCorr) { + psiT0CCorr = ApplyShiftCorrection(coll, psiT0C); + ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC); + } + + histos.fill(HIST("hPsiT0C"), psiT0CCorr); histos.fill(HIST("hPsiZDCA_vs_ZDCC"), coll.psiZDCC(), coll.psiZDCA()); - histos.fill(HIST("hPsiT0CvsCentFT0C"), coll.centFT0C(), PsiT0C); + histos.fill(HIST("hPsiT0CvsCentFT0C"), coll.centFT0C(), psiT0CCorr); resolution.fill(HIST("QVectorsT0CTPCA"), eventplaneVecT0C.Dot(eventplaneVecTPCA), coll.centFT0C()); resolution.fill(HIST("QVectorsT0CTPCC"), eventplaneVecT0C.Dot(eventplaneVecTPCC), coll.centFT0C()); @@ -1060,7 +1138,7 @@ struct cascadeFlow { ROOT::Math::XYZVector cascQvec{std::cos(2 * casc.phi()), std::sin(2 * casc.phi()), 0}; auto v2CSP = cascQvec.Dot(eventplaneVecT0C); // not normalised by amplitude - auto cascminuspsiT0C = GetPhiInRange(casc.phi() - PsiT0C); + auto cascminuspsiT0C = GetPhiInRange(casc.phi() - psiT0CCorr); auto v2CEP = std::cos(2.0 * cascminuspsiT0C); ROOT::Math::XYZVector cascUvec{std::cos(casc.phi()), std::sin(casc.phi()), 0}; auto v1SP_ZDCA = cascUvec.Dot(spectatorplaneVecZDCA); @@ -1116,11 +1194,11 @@ struct cascadeFlow { int chargeIndex = 0; if (casc.sign() > 0) chargeIndex = 1; - double pzs2Xi = cosThetaStarLambda[0] * std::sin(2 * (casc.phi() - PsiT0C)) / cascadev2::AlphaXi[chargeIndex] / meanCos2ThetaLambdaFromXi; - double pzs2Omega = cosThetaStarLambda[1] * std::sin(2 * (casc.phi() - PsiT0C)) / cascadev2::AlphaOmega[chargeIndex] / meanCos2ThetaLambdaFromOmega; + double pzs2Xi = cosThetaStarLambda[0] * std::sin(2 * (casc.phi() - psiT0CCorr)) / cascadev2::AlphaXi[chargeIndex] / meanCos2ThetaLambdaFromXi; + double pzs2Omega = cosThetaStarLambda[1] * std::sin(2 * (casc.phi() - psiT0CCorr)) / cascadev2::AlphaOmega[chargeIndex] / meanCos2ThetaLambdaFromOmega; double cos2ThetaXi = cosThetaStarLambda[0] * cosThetaStarLambda[0]; double cos2ThetaOmega = cosThetaStarLambda[1] * cosThetaStarLambda[1]; - double pzs2LambdaFromCasc = cosThetaStarProton * std::sin(2 * (casc.phi() - PsiT0C)) / cascadev2::AlphaLambda[chargeIndex] / meanCos2ThetaProtonFromLambda; + double pzs2LambdaFromCasc = cosThetaStarProton * std::sin(2 * (casc.phi() - psiT0CCorr)) / cascadev2::AlphaLambda[chargeIndex] / meanCos2ThetaProtonFromLambda; double cos2ThetaLambda = cosThetaStarProton * cosThetaStarProton; double cosThetaXiWithAlpha = cosThetaStarLambda[0] / cascadev2::AlphaXi[chargeIndex]; @@ -1226,7 +1304,7 @@ struct cascadeFlow { if (isSelectedCasc[0] || isSelectedCasc[1]) { if (fillingConfigs.isFillTree) - fillAnalysedTable(coll, hasEventPlane, hasSpectatorPlane, casc, v2CSP, v2CEP, v1SP_ZDCA, v1SP_ZDCC, PsiT0C, BDTresponse[0], BDTresponse[1], 0); + fillAnalysedTable(coll, hasEventPlane, hasSpectatorPlane, casc, v2CSP, v2CEP, v1SP_ZDCA, v1SP_ZDCC, psiT0CCorr, BDTresponse[0], BDTresponse[1], 0); } } } @@ -1262,9 +1340,30 @@ struct cascadeFlow { ROOT::Math::XYZVector eventplaneVecTPCA{coll.qvecBPosRe(), coll.qvecBPosIm(), 0}; ROOT::Math::XYZVector eventplaneVecTPCC{coll.qvecBNegRe(), coll.qvecBNegIm(), 0}; - const float PsiT0C = std::atan2(coll.qvecFT0CIm(), coll.qvecFT0CRe()) * 0.5f; - histos.fill(HIST("hPsiT0C"), PsiT0C); - histos.fill(HIST("hPsiT0CvsCentFT0C"), coll.centFT0C(), PsiT0C); + const float psiT0C = std::atan2(coll.qvecFT0CIm(), coll.qvecFT0CRe()) * 0.5f; + const float psiTPCA = std::atan2(coll.qvecBPosIm(), coll.qvecBPosRe()) * 0.5f; + const float psiTPCC = std::atan2(coll.qvecBNegIm(), coll.qvecBNegRe()) * 0.5f; + float psiT0CCorr = psiT0C; + if (cfgShiftCorr) { + currentRunNumber = coll.runNumber(); + if (currentRunNumber != lastRunNumber) { + shiftprofile.clear(); + for (int i = 2; i < cfgnMods + 2; i++) { + fullCCDBShiftCorrPath = cfgShiftPath; + fullCCDBShiftCorrPath += "/v"; + fullCCDBShiftCorrPath += std::to_string(i); + auto objshift = ccdb->getForTimeStamp(fullCCDBShiftCorrPath, coll.timestamp()); + shiftprofile.push_back(objshift); + } + lastRunNumber = currentRunNumber; + } + } + if (cfgShiftCorr) { + psiT0CCorr = ApplyShiftCorrection(coll, psiT0C); + ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC); + } + histos.fill(HIST("hPsiT0C"), psiT0CCorr); + histos.fill(HIST("hPsiT0CvsCentFT0C"), coll.centFT0C(), psiT0CCorr); resolution.fill(HIST("QVectorsT0CTPCA"), eventplaneVecT0C.Dot(eventplaneVecTPCA), coll.centFT0C()); resolution.fill(HIST("QVectorsT0CTPCC"), eventplaneVecT0C.Dot(eventplaneVecTPCC), coll.centFT0C()); @@ -1339,7 +1438,7 @@ struct cascadeFlow { ROOT::Math::XYZVector cascQvec{std::cos(2 * casc.phi()), std::sin(2 * casc.phi()), 0}; auto v2CSP = cascQvec.Dot(eventplaneVecT0C); // not normalised by amplitude - auto cascminuspsiT0C = GetPhiInRange(casc.phi() - PsiT0C); + auto cascminuspsiT0C = GetPhiInRange(casc.phi() - psiT0CCorr); auto v2CEP = std::cos(2.0 * cascminuspsiT0C); ROOT::Math::XYZVector cascUvec{std::cos(casc.phi()), std::sin(casc.phi()), 0}; @@ -1389,11 +1488,11 @@ struct cascadeFlow { int chargeIndex = 0; if (casc.sign() > 0) chargeIndex = 1; - double pzs2Xi = cosThetaStarLambda[0] * std::sin(2 * (casc.phi() - PsiT0C)) / cascadev2::AlphaXi[chargeIndex] / meanCos2ThetaLambdaFromXi; - double pzs2Omega = cosThetaStarLambda[1] * std::sin(2 * (casc.phi() - PsiT0C)) / cascadev2::AlphaOmega[chargeIndex] / meanCos2ThetaLambdaFromOmega; + double pzs2Xi = cosThetaStarLambda[0] * std::sin(2 * (casc.phi() - psiT0CCorr)) / cascadev2::AlphaXi[chargeIndex] / meanCos2ThetaLambdaFromXi; + double pzs2Omega = cosThetaStarLambda[1] * std::sin(2 * (casc.phi() - psiT0CCorr)) / cascadev2::AlphaOmega[chargeIndex] / meanCos2ThetaLambdaFromOmega; double cos2ThetaXi = cosThetaStarLambda[0] * cosThetaStarLambda[0]; double cos2ThetaOmega = cosThetaStarLambda[1] * cosThetaStarLambda[1]; - double pzs2LambdaFromCasc = cosThetaStarProton * std::sin(2 * (casc.phi() - PsiT0C)) / cascadev2::AlphaLambda[chargeIndex] / meanCos2ThetaProtonFromLambda; + double pzs2LambdaFromCasc = cosThetaStarProton * std::sin(2 * (casc.phi() - psiT0CCorr)) / cascadev2::AlphaLambda[chargeIndex] / meanCos2ThetaProtonFromLambda; double cos2ThetaLambda = cosThetaStarProton * cosThetaStarProton; double cosThetaXiWithAlpha = cosThetaStarLambda[0] / cascadev2::AlphaXi[chargeIndex]; @@ -1497,7 +1596,7 @@ struct cascadeFlow { if (isSelectedCasc[0] || isSelectedCasc[1]) { if (fillingConfigs.isFillTree) - fillAnalysedTable(coll, hasEventPlane, 0, casc, v2CSP, v2CEP, 0, 0, PsiT0C, BDTresponse[0], BDTresponse[1], 0); + fillAnalysedTable(coll, hasEventPlane, 0, casc, v2CSP, v2CEP, 0, 0, psiT0CCorr, BDTresponse[0], BDTresponse[1], 0); } } } @@ -1532,8 +1631,29 @@ struct cascadeFlow { ROOT::Math::XYZVector eventplaneVecTPCC{coll.qvecBNegRe(), coll.qvecBNegIm(), 0}; const float psiT0C = std::atan2(coll.qvecFT0CIm(), coll.qvecFT0CRe()) * 0.5f; - histos.fill(HIST("hPsiT0C"), psiT0C); - histos.fill(HIST("hPsiT0CvsCentFT0C"), coll.centFT0C(), psiT0C); + const float psiTPCA = std::atan2(coll.qvecBPosIm(), coll.qvecBPosRe()) * 0.5f; + const float psiTPCC = std::atan2(coll.qvecBNegIm(), coll.qvecBNegRe()) * 0.5f; + float psiT0CCorr = psiT0C; + if (cfgShiftCorr) { + currentRunNumber = coll.runNumber(); + if (currentRunNumber != lastRunNumber) { + shiftprofile.clear(); + for (int i = 2; i < cfgnMods + 2; i++) { + fullCCDBShiftCorrPath = cfgShiftPath; + fullCCDBShiftCorrPath += "/v"; + fullCCDBShiftCorrPath += std::to_string(i); + auto objshift = ccdb->getForTimeStamp(fullCCDBShiftCorrPath, coll.timestamp()); + shiftprofile.push_back(objshift); + } + lastRunNumber = currentRunNumber; + } + } + if (cfgShiftCorr) { + psiT0CCorr = ApplyShiftCorrection(coll, psiT0C); + ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC); + } + histos.fill(HIST("hPsiT0C"), psiT0CCorr); + histos.fill(HIST("hPsiT0CvsCentFT0C"), coll.centFT0C(), psiT0CCorr); resolution.fill(HIST("QVectorsT0CTPCA"), eventplaneVecT0C.Dot(eventplaneVecTPCA), coll.centFT0C()); resolution.fill(HIST("QVectorsT0CTPCC"), eventplaneVecT0C.Dot(eventplaneVecTPCC), coll.centFT0C()); @@ -1604,7 +1724,7 @@ struct cascadeFlow { ROOT::Math::XYZVector lambdaQvec{std::cos(2 * v0.phi()), std::sin(2 * v0.phi()), 0}; auto v2CSP = lambdaQvec.Dot(eventplaneVecT0C); // not normalised by amplitude - auto lambdaminuspsiT0C = GetPhiInRange(v0.phi() - psiT0C); + auto lambdaminuspsiT0C = GetPhiInRange(v0.phi() - psiT0CCorr); auto v2CEP = std::cos(2.0 * lambdaminuspsiT0C); ROOT::Math::XYZVector lambdaUvec{std::cos(v0.phi()), std::sin(v0.phi()), 0}; @@ -1634,15 +1754,15 @@ struct cascadeFlow { double cos2ThetaLambda = 0; double cosThetaLambda = 0; if (chargeIndex == 0) { - pzs2Lambda = cosThetaStarProton[0] * std::sin(2 * (v0.phi() - psiT0C)) / lambdav2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda; + pzs2Lambda = cosThetaStarProton[0] * std::sin(2 * (v0.phi() - psiT0CCorr)) / lambdav2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda; cos2ThetaLambda = cosThetaStarProton[0] * cosThetaStarProton[0]; cosThetaLambda = cosThetaStarProton[0] / cascadev2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda; } else if (chargeIndex == 1) { - pzs2Lambda = cosThetaStarProton[1] * std::sin(2 * (v0.phi() - psiT0C)) / lambdav2::AlphaLambda[1] / meanCos2ThetaProtonFromLambda; + pzs2Lambda = cosThetaStarProton[1] * std::sin(2 * (v0.phi() - psiT0CCorr)) / lambdav2::AlphaLambda[1] / meanCos2ThetaProtonFromLambda; cos2ThetaLambda = cosThetaStarProton[1] * cosThetaStarProton[1]; cosThetaLambda = cosThetaStarProton[1] / cascadev2::AlphaLambda[1] / meanCos2ThetaProtonFromLambda; } else { // I treat these bkg candidates as Lambdas for the purpose of calculating Pz - pzs2Lambda = cosThetaStarProton[0] * std::sin(2 * (v0.phi() - psiT0C)) / lambdav2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda; + pzs2Lambda = cosThetaStarProton[0] * std::sin(2 * (v0.phi() - psiT0CCorr)) / lambdav2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda; cos2ThetaLambda = cosThetaStarProton[0] * cosThetaStarProton[0]; cosThetaLambda = cosThetaStarProton[0] / cascadev2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda; } @@ -1681,7 +1801,7 @@ struct cascadeFlow { continue; if (fillingConfigs.isFillTree) - fillAnalysedLambdaTable(coll, hasEventPlane, hasSpectatorPlane, chargeIndex, v0, v2CEP, psiT0C, pzs2Lambda, cos2ThetaLambda, cosThetaLambda); + fillAnalysedLambdaTable(coll, hasEventPlane, hasSpectatorPlane, chargeIndex, v0, v2CEP, psiT0CCorr, pzs2Lambda, cos2ThetaLambda, cosThetaLambda); } } @@ -1727,9 +1847,30 @@ struct cascadeFlow { float NormQvTPCA = std::sqrt(eventplaneVecTPCA.Dot(eventplaneVecTPCA)); float NormQvTPCC = std::sqrt(eventplaneVecTPCC.Dot(eventplaneVecTPCC)); - const float PsiT0C = std::atan2(coll.qvecFT0CIm(), coll.qvecFT0CRe()) * 0.5f; - histos.fill(HIST("hPsiT0C"), PsiT0C); - histos.fill(HIST("hPsiT0CvsCentFT0C"), coll.centFT0C(), PsiT0C); + const float psiT0C = std::atan2(coll.qvecFT0CIm(), coll.qvecFT0CRe()) * 0.5f; + const float psiTPCA = std::atan2(coll.qvecBPosIm(), coll.qvecBPosRe()) * 0.5f; + const float psiTPCC = std::atan2(coll.qvecBNegIm(), coll.qvecBNegRe()) * 0.5f; + float psiT0CCorr = psiT0C; + if (cfgShiftCorr) { + currentRunNumber = coll.runNumber(); + if (currentRunNumber != lastRunNumber) { + shiftprofile.clear(); + for (int i = 2; i < cfgnMods + 2; i++) { + fullCCDBShiftCorrPath = cfgShiftPath; + fullCCDBShiftCorrPath += "/v"; + fullCCDBShiftCorrPath += std::to_string(i); + auto objshift = ccdb->getForTimeStamp(fullCCDBShiftCorrPath, coll.timestamp()); + shiftprofile.push_back(objshift); + } + lastRunNumber = currentRunNumber; + } + } + if (cfgShiftCorr) { + psiT0CCorr = ApplyShiftCorrection(coll, psiT0C); + ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC); + } + histos.fill(HIST("hpsiT0C"), psiT0CCorr); + histos.fill(HIST("hpsiT0CvsCentFT0C"), coll.centFT0C(), psiT0CCorr); resolution.fill(HIST("QVectorsT0CTPCA"), eventplaneVecT0C.Dot(eventplaneVecTPCA), coll.centFT0C()); resolution.fill(HIST("QVectorsT0CTPCC"), eventplaneVecT0C.Dot(eventplaneVecTPCC), coll.centFT0C()); @@ -1805,7 +1946,7 @@ struct cascadeFlow { ROOT::Math::XYZVector cascQvec{std::cos(2 * casc.phi()), std::sin(2 * casc.phi()), 0}; auto v2CSP = cascQvec.Dot(eventplaneVecT0C); - auto cascminuspsiT0C = GetPhiInRange(casc.phi() - PsiT0C); + auto cascminuspsiT0C = GetPhiInRange(casc.phi() - psiT0CCorr); auto v2CEP = std::cos(2.0 * cascminuspsiT0C); ROOT::Math::XYZVector cascUvec{std::cos(casc.phi()), std::sin(casc.phi()), 0}; auto v1SP_ZDCA = cascUvec.Dot(spectatorplaneVecZDCA); @@ -1837,7 +1978,7 @@ struct cascadeFlow { } if (isSelectedCasc[0] || isSelectedCasc[1]) if (fillingConfigs.isFillTree) - fillAnalysedTable(coll, hasEventPlane, hasSpectatorPlane, casc, v2CSP, v2CEP, v1SP_ZDCA, v1SP_ZDCC, PsiT0C, BDTresponse[0], BDTresponse[1], 0); + fillAnalysedTable(coll, hasEventPlane, hasSpectatorPlane, casc, v2CSP, v2CEP, v1SP_ZDCA, v1SP_ZDCC, psiT0CCorr, BDTresponse[0], BDTresponse[1], 0); } } @@ -1955,7 +2096,7 @@ struct cascadeFlow { histos.fill(HIST("hCascadePhi"), casc.phi()); float BDTresponse[nParticles]{0.f, 0.f}; - const float PsiT0C = 0; // not defined in MC for now + const float psiT0C = 0; // not defined in MC for now auto v2CSP = 0; // not defined in MC for now auto v2CEP = 0; // not defined in MC for now auto v1SP_ZDCA = 0; // not defined in MC for now @@ -1970,7 +2111,7 @@ struct cascadeFlow { continue; } if (isSelectedCasc[0] || isSelectedCasc[1]) - fillAnalysedTable(coll, hasEventPlane, hasSpectatorPlane, casc, v2CSP, v2CEP, v1SP_ZDCA, v1SP_ZDCC, PsiT0C, BDTresponse[0], BDTresponse[1], pdgCode); + fillAnalysedTable(coll, hasEventPlane, hasSpectatorPlane, casc, v2CSP, v2CEP, v1SP_ZDCA, v1SP_ZDCC, psiT0C, BDTresponse[0], BDTresponse[1], pdgCode); } } From b11abd5ee846354188fc1bba76fed8fa48ca588f Mon Sep 17 00:00:00 2001 From: nzardosh Date: Wed, 20 Aug 2025 13:16:58 +0100 Subject: [PATCH 118/986] [PWGJE] Adding Ds and Xic to jet framework (#12640) --- PWGJE/Core/JetCandidateUtilities.h | 12 +- PWGJE/Core/JetHFUtilities.h | 305 +++++++++++++++++- PWGJE/DataModel/Jet.h | 18 ++ PWGJE/DataModel/JetReducedDataHF.h | 85 +++++ PWGJE/DataModel/JetSubstructure.h | 2 + PWGJE/DataModel/JetSubtraction.h | 134 +++++++- PWGJE/JetFinders/CMakeLists.txt | 30 ++ PWGJE/JetFinders/jetFinderDsDataCharged.cxx | 38 +++ PWGJE/JetFinders/jetFinderDsMCDCharged.cxx | 38 +++ PWGJE/JetFinders/jetFinderDsMCPCharged.cxx | 38 +++ PWGJE/JetFinders/jetFinderHF.cxx | 10 +- .../jetFinderXicToXiPiPiDataCharged.cxx | 38 +++ .../jetFinderXicToXiPiPiMCDCharged.cxx | 38 +++ .../jetFinderXicToXiPiPiMCPCharged.cxx | 38 +++ PWGJE/TableProducer/Matching/CMakeLists.txt | 30 ++ .../Matching/Substructure/CMakeLists.txt | 20 ++ .../Substructure/jetSubstructureMatching.cxx | 22 +- .../jetSubstructureMatchingMCDsCharged.cxx | 51 +++ ...bstructureMatchingMCXicToXiPiPiCharged.cxx | 51 +++ .../jetSubstructureMatchingSub.cxx | 26 +- .../jetSubstructureMatchingSubDsCharged.cxx | 50 +++ ...structureMatchingSubXicToXiPiPiCharged.cxx | 50 +++ .../Matching/jetMatchingMCDsCharged.cxx | 42 +++ .../Matching/jetMatchingMCSubDsCharged.cxx | 39 +++ .../jetMatchingMCSubXicToXiPiPiCharged.cxx | 39 +++ .../jetMatchingMCXicToXiPiPiCharged.cxx | 42 +++ .../Matching/jetMatchingSubDsCharged.cxx | 41 +++ .../jetMatchingSubXicToXiPiPiCharged.cxx | 41 +++ PWGJE/TableProducer/derivedDataProducer.cxx | 76 +++++ PWGJE/TableProducer/derivedDataSelector.cxx | 30 +- PWGJE/TableProducer/derivedDataWriter.cxx | 168 ++++++++++ .../eventwiseConstituentSubtractor.cxx | 28 ++ PWGJE/TableProducer/jetEventWeightMCD.cxx | 10 + PWGJE/TableProducer/jetEventWeightMCP.cxx | 10 + PWGJE/TableProducer/mcOutlierRejector.cxx | 12 +- PWGJE/TableProducer/rhoEstimator.cxx | 64 +++- PWGJE/Tasks/CMakeLists.txt | 24 ++ PWGJE/Tasks/jetFinderDsQA.cxx | 37 +++ PWGJE/Tasks/jetFinderHFQA.cxx | 4 +- PWGJE/Tasks/jetFinderXicToXiPiPiQA.cxx | 37 +++ PWGJE/Tasks/jetSubstructureDs.cxx | 39 +++ PWGJE/Tasks/jetSubstructureDsOutput.cxx | 40 +++ PWGJE/Tasks/jetSubstructureHF.cxx | 12 +- PWGJE/Tasks/jetSubstructureHFOutput.cxx | 36 ++- PWGJE/Tasks/jetSubstructureXicToXiPiPi.cxx | 39 +++ .../jetSubstructureXicToXiPiPiOutput.cxx | 40 +++ 46 files changed, 2015 insertions(+), 59 deletions(-) create mode 100644 PWGJE/JetFinders/jetFinderDsDataCharged.cxx create mode 100644 PWGJE/JetFinders/jetFinderDsMCDCharged.cxx create mode 100644 PWGJE/JetFinders/jetFinderDsMCPCharged.cxx create mode 100644 PWGJE/JetFinders/jetFinderXicToXiPiPiDataCharged.cxx create mode 100644 PWGJE/JetFinders/jetFinderXicToXiPiPiMCDCharged.cxx create mode 100644 PWGJE/JetFinders/jetFinderXicToXiPiPiMCPCharged.cxx create mode 100644 PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatchingMCDsCharged.cxx create mode 100644 PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatchingMCXicToXiPiPiCharged.cxx create mode 100644 PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatchingSubDsCharged.cxx create mode 100644 PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatchingSubXicToXiPiPiCharged.cxx create mode 100644 PWGJE/TableProducer/Matching/jetMatchingMCDsCharged.cxx create mode 100644 PWGJE/TableProducer/Matching/jetMatchingMCSubDsCharged.cxx create mode 100644 PWGJE/TableProducer/Matching/jetMatchingMCSubXicToXiPiPiCharged.cxx create mode 100644 PWGJE/TableProducer/Matching/jetMatchingMCXicToXiPiPiCharged.cxx create mode 100644 PWGJE/TableProducer/Matching/jetMatchingSubDsCharged.cxx create mode 100644 PWGJE/TableProducer/Matching/jetMatchingSubXicToXiPiPiCharged.cxx create mode 100644 PWGJE/Tasks/jetFinderDsQA.cxx create mode 100644 PWGJE/Tasks/jetFinderXicToXiPiPiQA.cxx create mode 100644 PWGJE/Tasks/jetSubstructureDs.cxx create mode 100644 PWGJE/Tasks/jetSubstructureDsOutput.cxx create mode 100644 PWGJE/Tasks/jetSubstructureXicToXiPiPi.cxx create mode 100644 PWGJE/Tasks/jetSubstructureXicToXiPiPiOutput.cxx diff --git a/PWGJE/Core/JetCandidateUtilities.h b/PWGJE/Core/JetCandidateUtilities.h index 921b88af9b8..cf745964359 100644 --- a/PWGJE/Core/JetCandidateUtilities.h +++ b/PWGJE/Core/JetCandidateUtilities.h @@ -205,11 +205,11 @@ auto matchedParticle(const T& candidate, const U& tracks, const V& particles) * @param candidate candidate that is being checked * @param table the table to be sliced */ -template -auto slicedPerCandidate(T const& table, U const& candidate, V const& perD0Candidate, M const& perDplusCandidate, N const& perDstarCandidate, O const& perLcCandidate, P const& perB0Candidate, Q const& perBplusCandidate, R const& perDielectronCandidate) +template +auto slicedPerCandidate(T const& table, U const& candidate, V const& perD0Candidate, M const& perDplusCandidate, N const& perDsCandidate, O const& perDstarCandidate, P const& perLcCandidate, Q const& perB0Candidate, R const& perBplusCandidate, S const& perXicToXiPiPiCandidate, A const& perDielectronCandidate) { if constexpr (jethfutilities::isHFCandidate()) { - return jethfutilities::slicedPerHFCandidate(table, candidate, perD0Candidate, perDplusCandidate, perDstarCandidate, perLcCandidate, perB0Candidate, perBplusCandidate); + return jethfutilities::slicedPerHFCandidate(table, candidate, perD0Candidate, perDplusCandidate, perDsCandidate, perDstarCandidate, perLcCandidate, perB0Candidate, perBplusCandidate, perXicToXiPiPiCandidate); } else if constexpr (jetdqutilities::isDielectronCandidate()) { return jetdqutilities::slicedPerDielectronCandidate(table, candidate, perDielectronCandidate); } else { @@ -223,11 +223,11 @@ auto slicedPerCandidate(T const& table, U const& candidate, V const& perD0Candid * @param jet jet that the slice is based on * @param table the table to be sliced */ -template -auto slicedPerJet(T const& table, U const& jet, V const& perD0Jet, M const& perDplusJet, N const& perDstarJet, O const& perLcJet, P const& perB0Jet, Q const& perBplusJet, R const& perDielectronJet) +template +auto slicedPerJet(T const& table, U const& jet, V const& perD0Jet, M const& perDplusJet, N const& perDsJet, O const& perDstarJet, P const& perLcJet, Q const& perB0Jet, R const& perBplusJet, S const& perXicToXiPiPiJet, A const& perDielectronJet) { if constexpr (jethfutilities::isHFTable() || jethfutilities::isHFMcTable()) { - return jethfutilities::slicedPerHFJet(table, jet, perD0Jet, perDplusJet, perDstarJet, perLcJet, perB0Jet, perBplusJet); + return jethfutilities::slicedPerHFJet(table, jet, perD0Jet, perDplusJet, perDsJet, perDstarJet, perLcJet, perB0Jet, perBplusJet, perXicToXiPiPiJet); } else if constexpr (jetdqutilities::isDielectronTable() || jetdqutilities::isDielectronMcTable()) { return jetdqutilities::slicedPerDielectronJet(table, jet, perDielectronJet); } else { diff --git a/PWGJE/Core/JetHFUtilities.h b/PWGJE/Core/JetHFUtilities.h index 9c3edc54f13..6e25d808d37 100644 --- a/PWGJE/Core/JetHFUtilities.h +++ b/PWGJE/Core/JetHFUtilities.h @@ -104,6 +104,42 @@ constexpr bool isDplusMcTable() return isDplusMcCandidate() || isDplusMcCandidate(); } +/** + * returns true if the candidate is from a Ds table + */ +template +constexpr bool isDsCandidate() +{ + return std::is_same_v, o2::aod::CandidatesDsData::iterator> || std::is_same_v, o2::aod::CandidatesDsData::filtered_iterator> || std::is_same_v, o2::aod::CandidatesDsMCD::iterator> || std::is_same_v, o2::aod::CandidatesDsMCD::filtered_iterator>; +} + +/** + * returns true if the particle is from a Ds MC table + */ +template +constexpr bool isDsMcCandidate() +{ + return std::is_same_v, o2::aod::CandidatesDsMCP::iterator> || std::is_same_v, o2::aod::CandidatesDsMCP::filtered_iterator>; +} + +/** + * returns true if the table is a Ds table + */ +template +constexpr bool isDsTable() +{ + return isDsCandidate() || isDsCandidate(); +} + +/** + * returns true if the table is a Ds MC table + */ +template +constexpr bool isDsMcTable() +{ + return isDsMcCandidate() || isDsMcCandidate(); +} + /** * returns true if the candidate is from a D* table */ @@ -248,6 +284,42 @@ constexpr bool isBplusMcTable() return isBplusMcCandidate() || isBplusMcCandidate(); } +/** + * returns true if the candidate is from a XicToXiPiPi table + */ +template +constexpr bool isXicToXiPiPiCandidate() +{ + return std::is_same_v, o2::aod::CandidatesXicToXiPiPiData::iterator> || std::is_same_v, o2::aod::CandidatesXicToXiPiPiData::filtered_iterator> || std::is_same_v, o2::aod::CandidatesXicToXiPiPiMCD::iterator> || std::is_same_v, o2::aod::CandidatesXicToXiPiPiMCD::filtered_iterator>; +} + +/** + * returns true if the particle is from a XicToXiPiPi MC table + */ +template +constexpr bool isXicToXiPiPiMcCandidate() +{ + return std::is_same_v, o2::aod::CandidatesXicToXiPiPiMCP::iterator> || std::is_same_v, o2::aod::CandidatesXicToXiPiPiMCP::filtered_iterator>; +} + +/** + * returns true if the table is a XicToXiPiPi table + */ +template +constexpr bool isXicToXiPiPiTable() +{ + return isXicToXiPiPiCandidate() || isXicToXiPiPiCandidate(); +} + +/** + * returns true if the table is a XicToXiPiPi MC table + */ +template +constexpr bool isXicToXiPiPiMcTable() +{ + return isXicToXiPiPiMcCandidate() || isXicToXiPiPiMcCandidate(); +} + /** * returns true if the candidate is from a HF table * * @param candidate candidate that is being checked @@ -259,6 +331,8 @@ constexpr bool isHFCandidate() return true; } else if constexpr (isDplusCandidate()) { return true; + } else if constexpr (isDsCandidate()) { + return true; } else if constexpr (isDstarCandidate()) { return true; } else if constexpr (isLcCandidate()) { @@ -267,6 +341,8 @@ constexpr bool isHFCandidate() return true; } else if constexpr (isBplusCandidate()) { return true; + } else if constexpr (isXicToXiPiPiCandidate()) { + return true; } else { return false; } @@ -283,13 +359,17 @@ constexpr bool isHFMcCandidate() return true; } else if constexpr (isDplusMcCandidate()) { return true; + } else if constexpr (isDsMcCandidate()) { + return true; } else if constexpr (isDstarMcCandidate()) { return true; } else if constexpr (isLcMcCandidate()) { return true; } else if constexpr (isB0McCandidate()) { return true; - } else if constexpr (isBplusMcCandidate()) { + } else if constexpr (isXicToXiPiPiMcCandidate()) { + return true; + } else if constexpr (isDstarMcCandidate()) { return true; } else { return false; @@ -306,6 +386,8 @@ constexpr bool isHFTable() return true; } else if constexpr (isDplusCandidate() || isDplusCandidate()) { return true; + } else if constexpr (isDsCandidate() || isDsCandidate()) { + return true; } else if constexpr (isDstarCandidate() || isDstarCandidate()) { return true; } else if constexpr (isLcCandidate() || isLcCandidate()) { @@ -314,6 +396,8 @@ constexpr bool isHFTable() return true; } else if constexpr (isBplusCandidate() || isBplusCandidate()) { return true; + } else if constexpr (isXicToXiPiPiCandidate() || isXicToXiPiPiCandidate()) { + return true; } else { return false; } @@ -329,6 +413,8 @@ constexpr bool isHFMcTable() return true; } else if constexpr (isDplusMcCandidate() || isDplusMcCandidate()) { return true; + } else if constexpr (isDsMcCandidate() || isDsMcCandidate()) { + return true; } else if constexpr (isDstarMcCandidate() || isDstarMcCandidate()) { return true; } else if constexpr (isLcMcCandidate() || isLcMcCandidate()) { @@ -337,6 +423,8 @@ constexpr bool isHFMcTable() return true; } else if constexpr (isBplusMcCandidate() || isBplusMcCandidate()) { return true; + } else if constexpr (isXicToXiPiPiMcCandidate() || isXicToXiPiPiMcCandidate()) { + return true; } else { return false; } @@ -361,6 +449,12 @@ constexpr bool isMatchedHFCandidate(T const& candidate) } else { return false; } + } else if constexpr (isDsCandidate()) { + if (std::abs(candidate.flagMcMatchRec()) == o2::hf_decay::hf_cand_3prong::DecayChannelMain::DsToPiKK) { + return true; + } else { + return false; + } } else if constexpr (isDstarCandidate()) { if (std::abs(candidate.flagMcMatchRec()) == o2::hf_decay::hf_cand_dstar::DecayChannelMain::DstarToPiKPi) { return true; @@ -385,6 +479,12 @@ constexpr bool isMatchedHFCandidate(T const& candidate) } else { return false; } + } else if constexpr (isXicToXiPiPiCandidate()) { + if (std::abs(candidate.flagMcMatchRec()) == o2::aod::hf_cand_xic_to_xi_pi_pi::DecayType::XicToXiPiPi) { + return true; + } else { + return false; + } } else if constexpr (isD0McCandidate()) { if (std::abs(candidate.flagMcMatchGen()) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { return true; @@ -397,6 +497,12 @@ constexpr bool isMatchedHFCandidate(T const& candidate) } else { return false; } + } else if constexpr (isDsMcCandidate()) { + if (std::abs(candidate.flagMcMatchGen()) == o2::hf_decay::hf_cand_3prong::DecayChannelMain::DsToPiKK) { + return true; + } else { + return false; + } } else if constexpr (isDstarMcCandidate()) { if (std::abs(candidate.flagMcMatchGen()) == o2::hf_decay::hf_cand_dstar::DecayChannelMain::DstarToPiKPi) { return true; @@ -421,6 +527,12 @@ constexpr bool isMatchedHFCandidate(T const& candidate) } else { return false; } + } else if constexpr (isXicToXiPiPiMcCandidate()) { + if (std::abs(candidate.flagMcMatchGen()) == o2::aod::hf_cand_xic_to_xi_pi_pi::DecayType::XicToXiPiPi) { + return true; + } else { + return false; + } } else { return false; } @@ -448,6 +560,12 @@ bool isHFDaughterTrack(T& track, U& candidate, V const& /*tracks*/) } else { return false; } + } else if constexpr (isDsCandidate()) { + if (candidate.prong0Id() == track.globalIndex() || candidate.prong1Id() == track.globalIndex() || candidate.prong2Id() == track.globalIndex()) { + return true; + } else { + return false; + } } else if constexpr (isDstarCandidate()) { if (candidate.prong0Id() == track.globalIndex() || candidate.prong1Id() == track.globalIndex() || candidate.prong2Id() == track.globalIndex()) { return true; @@ -472,6 +590,12 @@ bool isHFDaughterTrack(T& track, U& candidate, V const& /*tracks*/) } else { return false; } + } else if constexpr (isXicToXiPiPiCandidate()) { + if (candidate.prong0Id() == track.globalIndex() || candidate.prong1Id() == track.globalIndex() || candidate.prong2Id() == track.globalIndex() || candidate.prong3Id() == track.globalIndex() || candidate.prong4Id() == track.globalIndex()) { + return true; + } else { + return false; + } } else { return false; } @@ -511,8 +635,8 @@ auto matchedHFParticle(const T& candidate, const U& /*tracks*/, const V& /*parti * @param candidate HF candidate that is being checked * @param table the table to be sliced */ -template -auto slicedPerHFCandidate(T const& table, U const& candidate, V const& perD0Candidate, M const& perDplusCandidate, N const& perDstarCandidate, O const& perLcCandidate, P const& perB0Candidate, Q const& perBplusCandidate) +template +auto slicedPerHFCandidate(T const& table, U const& candidate, V const& perD0Candidate, M const& perDplusCandidate, N const& perDsCandidate, O const& perDstarCandidate, P const& perLcCandidate, Q const& perB0Candidate, R const& perBplusCandidate, S const& perXicToXiPiPiCandidate) { if constexpr (isD0Candidate()) { return table.sliceBy(perD0Candidate, candidate.globalIndex()); @@ -520,12 +644,16 @@ auto slicedPerHFCandidate(T const& table, U const& candidate, V const& perD0Cand return table.sliceBy(perDplusCandidate, candidate.globalIndex()); } else if constexpr (isDstarCandidate()) { return table.sliceBy(perDstarCandidate, candidate.globalIndex()); + } else if constexpr (isDsCandidate()) { + return table.sliceBy(perDsCandidate, candidate.globalIndex()); } else if constexpr (isLcCandidate()) { return table.sliceBy(perLcCandidate, candidate.globalIndex()); } else if constexpr (isB0Candidate()) { return table.sliceBy(perB0Candidate, candidate.globalIndex()); } else if constexpr (isBplusCandidate()) { return table.sliceBy(perBplusCandidate, candidate.globalIndex()); + } else if constexpr (isXicToXiPiPiCandidate()) { + return table.sliceBy(perXicToXiPiPiCandidate, candidate.globalIndex()); } else { return table; } @@ -538,8 +666,8 @@ auto slicedPerHFCandidate(T const& table, U const& candidate, V const& perD0Cand * @param jet jet that is being sliced based on * @param table the table to be sliced */ -template -auto slicedPerHFJet(T const& table, U const& jet, V const& perD0Jet, M const& perDplusJet, N const& perDstarJet, O const& perLcJet, P const& perB0Jet, Q const& perBplusJet) +template +auto slicedPerHFJet(T const& table, U const& jet, V const& perD0Jet, M const& perDplusJet, N const& perDsJet, O const& perDstarJet, P const& perLcJet, Q const& perB0Jet, R const& perBplusJet, S const& perXicToXiPiPiJet) { if constexpr (isD0Table() || isD0McTable()) { return table.sliceBy(perD0Jet, jet.globalIndex()); @@ -547,12 +675,16 @@ auto slicedPerHFJet(T const& table, U const& jet, V const& perD0Jet, M const& pe return table.sliceBy(perDplusJet, jet.globalIndex()); } else if constexpr (isDstarTable() || isDstarMcTable()) { return table.sliceBy(perDstarJet, jet.globalIndex()); + } else if constexpr (isDsTable() || isDsMcTable()) { + return table.sliceBy(perDsJet, jet.globalIndex()); } else if constexpr (isLcTable() || isLcMcTable()) { return table.sliceBy(perLcJet, jet.globalIndex()); } else if constexpr (isB0Table() || isB0McTable()) { return table.sliceBy(perB0Jet, jet.globalIndex()); } else if constexpr (isBplusTable() || isBplusMcTable()) { return table.sliceBy(perBplusJet, jet.globalIndex()); + } else if constexpr (isXicToXiPiPiTable() || isXicToXiPiPiMcTable()) { + return table.sliceBy(perXicToXiPiPiJet, jet.globalIndex()); } else { return table; } @@ -592,6 +724,8 @@ int getHFCandidatePDG(T const& /*candidate*/) return static_cast(o2::constants::physics::Pdg::kD0); } else if constexpr (isDplusCandidate() || isDplusMcCandidate()) { return static_cast(o2::constants::physics::Pdg::kDPlus); + } else if constexpr (isDsCandidate() || isDsMcCandidate()) { + return static_cast(o2::constants::physics::Pdg::kDS); } else if constexpr (isDstarCandidate() || isDstarMcCandidate()) { return static_cast(o2::constants::physics::Pdg::kDStar); } else if constexpr (isLcCandidate() || isLcMcCandidate()) { @@ -600,6 +734,8 @@ int getHFCandidatePDG(T const& /*candidate*/) return static_cast(o2::constants::physics::Pdg::kB0); } else if constexpr (isBplusCandidate() || isBplusMcCandidate()) { return static_cast(o2::constants::physics::Pdg::kBPlus); + } else if constexpr (isXicToXiPiPiCandidate() || isXicToXiPiPiMcCandidate()) { + return static_cast(o2::constants::physics::Pdg::kXiCPlus); } else { return 0; } @@ -615,6 +751,8 @@ int getHFTablePDG() return static_cast(o2::constants::physics::Pdg::kD0); } else if constexpr (isDplusTable() || isDplusMcTable()) { return static_cast(o2::constants::physics::Pdg::kDPlus); + } else if constexpr (isDsTable() || isDsMcTable()) { + return static_cast(o2::constants::physics::Pdg::kDS); } else if constexpr (isDstarTable() || isDstarMcTable()) { return static_cast(o2::constants::physics::Pdg::kDStar); } else if constexpr (isLcTable() || isLcMcTable()) { @@ -623,6 +761,8 @@ int getHFTablePDG() return static_cast(o2::constants::physics::Pdg::kB0); } else if constexpr (isBplusTable() || isBplusMcTable()) { return static_cast(o2::constants::physics::Pdg::kBPlus); + } else if constexpr (isXicToXiPiPiTable() || isXicToXiPiPiMcTable()) { + return static_cast(o2::constants::physics::Pdg::kXiCPlus); } else { return 0; } @@ -640,6 +780,8 @@ float getHFCandidatePDGMass(T const& /*candidate*/) return static_cast(o2::constants::physics::MassD0); } else if constexpr (isDplusCandidate() || isDplusMcCandidate()) { return static_cast(o2::constants::physics::MassDPlus); + } else if constexpr (isDsCandidate() || isDsMcCandidate()) { + return static_cast(o2::constants::physics::MassDS); } else if constexpr (isDstarCandidate() || isDstarMcCandidate()) { return static_cast(o2::constants::physics::MassDStar); } else if constexpr (isLcCandidate() || isLcMcCandidate()) { @@ -648,6 +790,8 @@ float getHFCandidatePDGMass(T const& /*candidate*/) return static_cast(o2::constants::physics::MassB0); } else if constexpr (isBplusCandidate() || isBplusMcCandidate()) { return static_cast(o2::constants::physics::MassBPlus); + } else if constexpr (isXicToXiPiPiCandidate() || isXicToXiPiPiMcCandidate()) { + return static_cast(o2::constants::physics::MassXiCPlus); } else { return -1.0; } @@ -664,6 +808,8 @@ float getHFTablePDGMass() return static_cast(o2::constants::physics::MassD0); } else if constexpr (isDplusTable() || isDplusMcTable()) { return static_cast(o2::constants::physics::MassDPlus); + } else if constexpr (isDsTable() || isDsMcTable()) { + return static_cast(o2::constants::physics::MassDS); } else if constexpr (isDstarTable() || isDstarMcTable()) { return static_cast(o2::constants::physics::MassDStar); } else if constexpr (isLcTable() || isLcMcTable()) { @@ -672,6 +818,8 @@ float getHFTablePDGMass() return static_cast(o2::constants::physics::MassB0); } else if constexpr (isBplusTable() || isBplusMcTable()) { return static_cast(o2::constants::physics::MassBPlus); + } else if constexpr (isXicToXiPiPiTable() || isXicToXiPiPiMcTable()) { + return static_cast(o2::constants::physics::MassXiCPlus); } else { return -1.0; } @@ -829,6 +977,78 @@ void fillDplusCandidateTable(T const& candidate, U& DplusParTable, V& DplusParET } } +template +void fillDsCandidateTable(T const& candidate, U& DsParTable, V& DsParETable, M& DsMlTable, N& DsMCDTable) +{ + + DsParTable( + candidate.chi2PCA(), + candidate.nProngsContributorsPV(), + candidate.cpa(), + candidate.cpaXY(), + candidate.decayLength(), + candidate.decayLengthXY(), + candidate.decayLengthNormalised(), + candidate.decayLengthXYNormalised(), + candidate.ptProng0(), + candidate.ptProng1(), + candidate.ptProng2(), + candidate.impactParameter0(), + candidate.impactParameter1(), + candidate.impactParameter2(), + candidate.impactParameterNormalised0(), + candidate.impactParameterNormalised1(), + candidate.impactParameterNormalised2(), + candidate.nSigTpcPi0(), + candidate.nSigTpcKa0(), + candidate.nSigTofPi0(), + candidate.nSigTofKa0(), + candidate.nSigTpcTofPi0(), + candidate.nSigTpcTofKa0(), + candidate.nSigTpcKa1(), + candidate.nSigTofKa1(), + candidate.nSigTpcTofKa1(), + candidate.nSigTpcPi2(), + candidate.nSigTpcKa2(), + candidate.nSigTofPi2(), + candidate.nSigTofKa2(), + candidate.nSigTpcTofPi2(), + candidate.nSigTpcTofKa2()); + + DsParETable( + candidate.xSecondaryVertex(), + candidate.ySecondaryVertex(), + candidate.zSecondaryVertex(), + candidate.errorDecayLength(), + candidate.errorDecayLengthXY(), + candidate.rSecondaryVertex(), + candidate.pProng0(), + candidate.pProng1(), + candidate.pProng2(), + candidate.pxProng0(), + candidate.pyProng0(), + candidate.pzProng0(), + candidate.pxProng1(), + candidate.pyProng1(), + candidate.pzProng1(), + candidate.pxProng2(), + candidate.pyProng2(), + candidate.pzProng2(), + candidate.errorImpactParameter0(), + candidate.errorImpactParameter1(), + candidate.errorImpactParameter2(), + candidate.ct()); + + std::vector mlScoresVector; + auto mlScoresSpan = candidate.mlScores(); + std::copy(mlScoresSpan.begin(), mlScoresSpan.end(), std::back_inserter(mlScoresVector)); + DsMlTable(mlScoresVector); + + if constexpr (isMc) { + DsMCDTable(candidate.flagMcMatchRec(), candidate.originMcRec(), candidate.isCandidateSwapped(), candidate.flagMcDecayChanRec()); + } +} + template void fillDstarCandidateTable(T const& candidate, U& DstarParTable, V& DstarParDaughterTable, M& DstarMlTable, N& DstarMCDTable) { @@ -1128,6 +1348,75 @@ void fillBplusCandidateTable(T const& candidate, U& BplusParTable, V& BplusParET } } +template +void fillXicToXiPiPiCandidateTable(T const& candidate, U& XicToXiPiPiParTable, V& XicToXiPiPiParETable, M& XicToXiPiPiMlTable, N& XicToXiPiPiMCDTable) +{ + + XicToXiPiPiParTable( + candidate.sign(), + candidate.ptProngXi(), + candidate.ptProngPi0(), + candidate.ptProngPi1(), + candidate.invMassXi(), + candidate.invMassLambda(), + candidate.invMassXiPi0(), + candidate.invMassXiPi1(), + candidate.chi2PCA(), + candidate.ct(), + candidate.decayLength(), + candidate.decayLengthXY(), + candidate.decayLengthNormalised(), + candidate.decayLengthXYNormalised(), + candidate.cpa(), + candidate.cpaXY(), + candidate.cpaXi(), + candidate.cpaXYXi(), + candidate.cpaLambda(), + candidate.cpaXYLambda(), + candidate.impactParameterXi(), + candidate.impactParameterNormalisedXi(), + candidate.impactParameterPi0(), + candidate.impactParameterNormalisedPi0(), + candidate.impactParameterPi1(), + candidate.impactParameterNormalisedPi1(), + candidate.maxNormalisedDeltaIP()); + + XicToXiPiPiParETable( + candidate.cpaLambdaToXi(), + candidate.cpaXYLambdaToXi(), + candidate.pProngPi0(), + candidate.pProngPi1(), + candidate.pBachelorPi(), + candidate.pPiFromLambda(), + candidate.pPrFromLambda(), + candidate.dcaXiDaughters(), + candidate.dcaV0Daughters(), + candidate.dcaPosToPV(), + candidate.dcaNegToPV(), + candidate.dcaBachelorToPV(), + candidate.dcaXYCascToPV(), + candidate.dcaZCascToPV(), + candidate.nSigTpcPiFromXicPlus0(), + candidate.nSigTpcPiFromXicPlus1(), + candidate.nSigTpcBachelorPi(), + candidate.nSigTpcPiFromLambda(), + candidate.nSigTpcPrFromLambda(), + candidate.nSigTofPiFromXicPlus0(), + candidate.nSigTofPiFromXicPlus1(), + candidate.nSigTofBachelorPi(), + candidate.nSigTofPiFromLambda(), + candidate.nSigTofPrFromLambda()); + + std::vector mlScoresVector; + auto mlScoresSpan = candidate.mlScores(); + std::copy(mlScoresSpan.begin(), mlScoresSpan.end(), std::back_inserter(mlScoresVector)); + XicToXiPiPiMlTable(mlScoresVector); + + if constexpr (isMc) { + XicToXiPiPiMCDTable(candidate.flagMcMatchRec(), candidate.originMcRec()); + } +} + template void fillHFCandidateTable(T const& candidate, int32_t collisionIndex, U& HFBaseTable, V& HFParTable, M& HFParETable, N& HFParDaughterTable, O& HFSelectionFlagTable, P& HFMlTable, Q& HFMlDaughterTable, S& HFMCDTable) { @@ -1140,6 +1429,9 @@ void fillHFCandidateTable(T const& candidate, int32_t collisionIndex, U& HFBaseT if constexpr (isDplusCandidate()) { fillDplusCandidateTable(candidate, HFParTable, HFParETable, HFMlTable, HFMCDTable); } + if constexpr (isDsCandidate()) { + fillDsCandidateTable(candidate, HFParTable, HFParETable, HFMlTable, HFMCDTable); + } if constexpr (isDstarCandidate()) { fillDstarCandidateTable(candidate, HFParTable, HFParDaughterTable, HFMlTable, HFMCDTable); } @@ -1152,6 +1444,9 @@ void fillHFCandidateTable(T const& candidate, int32_t collisionIndex, U& HFBaseT if constexpr (isBplusCandidate()) { fillBplusCandidateTable(candidate, HFParTable, HFParETable, HFParDaughterTable, HFMlTable, HFMlDaughterTable, HFMCDTable); } + if constexpr (isXicToXiPiPiCandidate()) { + fillXicToXiPiPiCandidateTable(candidate, HFParTable, HFParETable, HFMlTable, HFMCDTable); + } } template diff --git a/PWGJE/DataModel/Jet.h b/PWGJE/DataModel/Jet.h index 52939d0b16c..9ff72f65448 100644 --- a/PWGJE/DataModel/Jet.h +++ b/PWGJE/DataModel/Jet.h @@ -181,10 +181,12 @@ DECLARE_JET_TABLES_LEVELS(Full, JTrackSub, HfD0Bases, HfD0PBases, "F"); DECLARE_JET_TABLES_LEVELS(Neutral, JTrackSub, HfD0Bases, HfD0PBases, "N"); DECLARE_JET_TABLES_LEVELS(D0Charged, JTrackD0Sub, HfD0Bases, HfD0PBases, "D0"); DECLARE_JET_TABLES_LEVELS(DplusCharged, JTrackDplusSub, HfDplusBases, HfDplusPBases, "DP"); +DECLARE_JET_TABLES_LEVELS(DsCharged, JTrackDsSub, HfDsBases, HfDsPBases, "DS"); DECLARE_JET_TABLES_LEVELS(DstarCharged, JTrackDstarSub, HfDstarBases, HfDstarPBases, "DST"); DECLARE_JET_TABLES_LEVELS(LcCharged, JTrackLcSub, HfLcBases, HfLcPBases, "Lc"); DECLARE_JET_TABLES_LEVELS(B0Charged, JTrackB0Sub, HfB0Bases, HfB0PBases, "B0"); DECLARE_JET_TABLES_LEVELS(BplusCharged, JTrackBplusSub, HfBplusBases, HfBplusPBases, "BP"); +DECLARE_JET_TABLES_LEVELS(XicToXiPiPiCharged, JTrackXicToXiPiPiSub, HfXicToXiPiPiBases, HfXicToXiPiPiPBases, "XICXPP"); DECLARE_JET_TABLES_LEVELS(V0Charged, JTrackSub, V0Cores, JV0Mcs, "V0"); DECLARE_JET_TABLES_LEVELS(DielectronCharged, JTrackSub, Dielectrons, JDielectronMcs, "DIEL"); @@ -231,6 +233,14 @@ using JetParticlesSubDplus = JMcParticleDplusSubs; using McCollisionsDplus = o2::soa::Join; using CandidatesDplusMCP = o2::soa::Join; +using CollisionsDs = o2::soa::Join; +using CandidatesDsData = o2::soa::Join; +using CandidatesDsMCD = o2::soa::Join; +using JetTracksSubDs = JTrackDsSubs; +using JetParticlesSubDs = JMcParticleDsSubs; +using McCollisionsDs = o2::soa::Join; +using CandidatesDsMCP = o2::soa::Join; + using CollisionsDstar = o2::soa::Join; using CandidatesDstarData = o2::soa::Join; using CandidatesDstarMCD = o2::soa::Join; @@ -263,6 +273,14 @@ using JetParticlesSubBplus = JMcParticleBplusSubs; using McCollisionsBplus = o2::soa::Join; using CandidatesBplusMCP = o2::soa::Join; +using CollisionsXicToXiPiPi = o2::soa::Join; +using CandidatesXicToXiPiPiData = o2::soa::Join; +using CandidatesXicToXiPiPiMCD = o2::soa::Join; +using JetTracksSubXicToXiPiPi = JTrackXicToXiPiPiSubs; +using JetParticlesSubXicToXiPiPi = JMcParticleXicToXiPiPiSubs; +using McCollisionsXicToXiPiPi = o2::soa::Join; +using CandidatesXicToXiPiPiMCP = o2::soa::Join; + using CandidatesV0Data = o2::soa::Join; using CandidatesV0MCD = o2::soa::Join; // using V0Daughters = DauTrackExtras; diff --git a/PWGJE/DataModel/JetReducedDataHF.h b/PWGJE/DataModel/JetReducedDataHF.h index f295dbfa398..7a2f1c86cd1 100644 --- a/PWGJE/DataModel/JetReducedDataHF.h +++ b/PWGJE/DataModel/JetReducedDataHF.h @@ -37,6 +37,8 @@ constexpr uint JMarkerBplus = 4; constexpr uint JMarkerDielectron = 5; constexpr uint JMarkerDstar = 6; constexpr uint JMarkerB0 = 7; +constexpr uint JMarkerDs = 8; +constexpr uint JMarkerXicToXiPiPi = 9; namespace jcandidateindices { @@ -124,6 +126,46 @@ DECLARE_SOA_TABLE(JDumDplusMlDaus, "AOD", "JDUMDPMLDAU", // might have to update!!!!!!!!!!!!!!!!!!!!!! +namespace jdsindices +{ +DECLARE_SOA_INDEX_COLUMN_FULL(Prong0, prong0, int, JTracks, "_0"); +DECLARE_SOA_INDEX_COLUMN_FULL(Prong1, prong1, int, JTracks, "_1"); +DECLARE_SOA_INDEX_COLUMN_FULL(Prong2, prong2, int, JTracks, "_2"); +} // namespace jdsindices + +DECLARE_SOA_TABLE_STAGED(JDsCollisionIds, "JDSCOLLID", + jcandidateindices::JCollisionId, + o2::soa::Marker); + +DECLARE_SOA_TABLE_STAGED(JDsMcCollisionIds, "JDSMCCOLLID", + jcandidateindices::JMcCollisionId, + o2::soa::Marker); + +DECLARE_SOA_TABLE_STAGED(JDsIds, "JDSID", + jcandidateindices::JCollisionId, + jdsindices::Prong0Id, + jdsindices::Prong1Id, + jdsindices::Prong2Id); + +DECLARE_SOA_TABLE_STAGED(JDsPIds, "JDSPID", + jcandidateindices::JMcCollisionId, + jcandidateindices::JMcParticleId, + o2::soa::Marker); + +namespace jdummyds +{ + +DECLARE_SOA_COLUMN(DummyDs, dummyDs, bool); + +} // namespace jdummyds +DECLARE_SOA_TABLE(JDumDsParDaus, "AOD", "JDUMDSPARDAU", + jdummyds::DummyDs, + o2::soa::Marker<1>); + +DECLARE_SOA_TABLE(JDumDsMlDaus, "AOD", "JDUMDSMLDAU", + jdummyds::DummyDs, + o2::soa::Marker<2>); + namespace jdstarindices { DECLARE_SOA_INDEX_COLUMN_FULL(Prong0, prong0, int, JTracks, "_0"); @@ -258,6 +300,49 @@ DECLARE_SOA_TABLE_STAGED(JBplusPIds, "JBPPID", jcandidateindices::JMcParticleId, o2::soa::Marker); +namespace jxictoxipipiindices +{ +DECLARE_SOA_INDEX_COLUMN_FULL(Prong0, prong0, int, JTracks, "_0"); +DECLARE_SOA_INDEX_COLUMN_FULL(Prong1, prong1, int, JTracks, "_1"); +DECLARE_SOA_INDEX_COLUMN_FULL(Prong2, prong2, int, JTracks, "_2"); +DECLARE_SOA_INDEX_COLUMN_FULL(Prong3, prong3, int, JTracks, "_3"); +DECLARE_SOA_INDEX_COLUMN_FULL(Prong4, prong4, int, JTracks, "_4"); +} // namespace jxictoxipipiindices + +DECLARE_SOA_TABLE_STAGED(JXicToXiPiPiCollisionIds, "JXICXPPCOLLID", + jcandidateindices::JCollisionId, + o2::soa::Marker); + +DECLARE_SOA_TABLE_STAGED(JXicToXiPiPiMcCollisionIds, "JXICXPPMCCOLLID", + jcandidateindices::JMcCollisionId, + o2::soa::Marker); + +DECLARE_SOA_TABLE_STAGED(JXicToXiPiPiIds, "JXICXPPID", + jcandidateindices::JCollisionId, + jxictoxipipiindices::Prong0Id, + jxictoxipipiindices::Prong1Id, + jxictoxipipiindices::Prong2Id, + jxictoxipipiindices::Prong3Id, + jxictoxipipiindices::Prong4Id); + +DECLARE_SOA_TABLE_STAGED(JXicToXiPiPiPIds, "JXICXPPPID", + jcandidateindices::JMcCollisionId, + jcandidateindices::JMcParticleId, + o2::soa::Marker); + +namespace jdummyxictoxipipi +{ +DECLARE_SOA_COLUMN(DummyXicToXiPiPi, dummyXicToXiPiPi, bool); + +} // namespace jdummyxictoxipipi +DECLARE_SOA_TABLE(JDumXicToXiPiPiParDaus, "AOD", "JDUMXICXPPPARDAU", + jdummyxictoxipipi::DummyXicToXiPiPi, + o2::soa::Marker<1>); + +DECLARE_SOA_TABLE(JDumXicToXiPiPiMlDaus, "AOD", "JDUMXICXPPMLDAU", + jdummyxictoxipipi::DummyXicToXiPiPi, + o2::soa::Marker<2>); + } // namespace o2::aod #endif // PWGJE_DATAMODEL_JETREDUCEDDATAHF_H_ diff --git a/PWGJE/DataModel/JetSubstructure.h b/PWGJE/DataModel/JetSubstructure.h index 88f0578d469..9e09948b253 100644 --- a/PWGJE/DataModel/JetSubstructure.h +++ b/PWGJE/DataModel/JetSubstructure.h @@ -260,10 +260,12 @@ DECLARE_SOA_COLUMN(JetNConstituents, jetNConstituents, int); //! JETSUBSTRUCTURE_TABLES_DEF(C, "C", Charged, charged, JTracks, CJetCOs, "CJETCO", JTrackSubs, CEWSJetCOs, "CEWSJETCO", JTracks, CMCDJetCOs, "CMCDJETCO", JMcParticles, CMCPJetCOs, "CMCPJETCO"); JETSUBSTRUCTURE_TABLES_DEF(D0C, "D0C", D0Charged, d0charged, JTracks, HfD0Bases, "HFD0BASE", JTrackD0Subs, HfD0Bases, "HFD0BASE", JTracks, HfD0Bases, "HFD0BASE", JMcParticles, HfD0PBases, "HFD0PBASE"); JETSUBSTRUCTURE_TABLES_DEF(DplusC, "DPC", DplusCharged, dpluscharged, JTracks, HfDplusBases, "HFDPBASE", JTrackDplusSubs, HfDplusBases, "HFDPBASE", JTracks, HfDplusBases, "HFDPBASE", JMcParticles, HfDplusPBases, "HFDPPBASE"); +JETSUBSTRUCTURE_TABLES_DEF(DsC, "DSC", DsCharged, dscharged, JTracks, HfDsBases, "HFDSBASE", JTrackDsSubs, HfDsBases, "HFDSBASE", JTracks, HfDsBases, "HFDSBASE", JMcParticles, HfDsPBases, "HFDSPBASE"); JETSUBSTRUCTURE_TABLES_DEF(DstarC, "DSTC", DstarCharged, dstarcharged, JTracks, HfDstarBases, "HFDSTBASE", JTrackDstarSubs, HfDstarBases, "HFDSTBASE", JTracks, HfDstarBases, "HFDSTBASE", JMcParticles, HfDstarPBases, "HFDSTPBASE"); JETSUBSTRUCTURE_TABLES_DEF(LcC, "LCC", LcCharged, lccharged, JTracks, HfLcBases, "HFLCBASE", JTrackLcSubs, HfLcBases, "HFLCBASE", JTracks, HfLcBases, "HFLCBASE", JMcParticles, HfLcPBases, "HFLCPBASE"); JETSUBSTRUCTURE_TABLES_DEF(B0C, "B0C", B0Charged, b0charged, JTracks, HfB0Bases, "HFB0BASE", JTrackB0Subs, HfB0Bases, "HFB0BASE", JTracks, HfB0Bases, "HFB0BASE", JMcParticles, HfB0PBases, "HFB0PBASE"); JETSUBSTRUCTURE_TABLES_DEF(BplusC, "BPC", BplusCharged, bpluscharged, JTracks, HfBplusBases, "HFBPBASE", JTrackBplusSubs, HfBplusBases, "HFBPBASE", JTracks, HfBplusBases, "HFBPBASE", JMcParticles, HfBplusPBases, "HFBPPBASE"); +JETSUBSTRUCTURE_TABLES_DEF(XicToXiPiPiC, "XICXPPC", XicToXiPiPiCharged, xictoxipipicharged, JTracks, HfXicToXiPiPiBases, "HFXICXPPBASE", JTrackXicToXiPiPiSubs, HfXicToXiPiPiBases, "HFXICXPPBASE", JTracks, HfXicToXiPiPiBases, "HFXICXPPBASE", JMcParticles, HfXicToXiPiPiPBases, "HFXICXPPPBASE"); JETSUBSTRUCTURE_TABLES_DEF(DielectronC, "DIELC", DielectronCharged, dielectroncharged, JTracks, Dielectrons, "RTDIELECTRON", JTrackDielectronSubs, Dielectrons, "RTDIELECTRON", JTracks, Dielectrons, "RTDIELECTRON", JMcParticles, JDielectronMcs, "JDIELMC"); } // namespace o2::aod diff --git a/PWGJE/DataModel/JetSubtraction.h b/PWGJE/DataModel/JetSubtraction.h index d22237380c7..0635ff8cb77 100644 --- a/PWGJE/DataModel/JetSubtraction.h +++ b/PWGJE/DataModel/JetSubtraction.h @@ -62,6 +62,16 @@ namespace bkgdplusmc DECLARE_SOA_INDEX_COLUMN_FULL(Candidate, candidate, int, HfDplusPBases, "_0"); } // namespace bkgdplusmc +namespace bkgds +{ +DECLARE_SOA_INDEX_COLUMN_FULL(Candidate, candidate, int, HfDsBases, "_0"); +} // namespace bkgds + +namespace bkgdsmc +{ +DECLARE_SOA_INDEX_COLUMN_FULL(Candidate, candidate, int, HfDsPBases, "_0"); +} // namespace bkgdsmc + namespace bkgdstar { DECLARE_SOA_INDEX_COLUMN_FULL(Candidate, candidate, int, HfDstarBases, "_0"); @@ -102,6 +112,16 @@ namespace bkgbplusmc DECLARE_SOA_INDEX_COLUMN_FULL(Candidate, candidate, int, HfBplusPBases, "_0"); } // namespace bkgbplusmc +namespace bkgxictoxipipi +{ +DECLARE_SOA_INDEX_COLUMN_FULL(Candidate, candidate, int, HfXicToXiPiPiBases, "_0"); +} // namespace bkgxictoxipipi + +namespace bkgxictoxipipimc +{ +DECLARE_SOA_INDEX_COLUMN_FULL(Candidate, candidate, int, HfXicToXiPiPiPBases, "_0"); +} // namespace bkgxictoxipipimc + namespace bkgdielectron { DECLARE_SOA_INDEX_COLUMN_FULL(Candidate, candidate, int, Dielectrons, "_0"); @@ -147,66 +167,90 @@ DECLARE_SOA_TABLE(BkgDplusMcRhos, "AOD", "BkgDPMcRho", bkgrho::RhoM, o2::soa::Marker<5>); -DECLARE_SOA_TABLE(BkgDstarRhos, "AOD", "BkgDSTRho", +DECLARE_SOA_TABLE(BkgDsRhos, "AOD", "BkgDSRho", o2::soa::Index<>, bkgrho::Rho, bkgrho::RhoM, o2::soa::Marker<6>); -DECLARE_SOA_TABLE(BkgDstarMcRhos, "AOD", "BkgDSTMcRho", +DECLARE_SOA_TABLE(BkgDsMcRhos, "AOD", "BkgDSMcRho", o2::soa::Index<>, bkgrho::Rho, bkgrho::RhoM, o2::soa::Marker<7>); -DECLARE_SOA_TABLE(BkgLcRhos, "AOD", "BkgLCRho", +DECLARE_SOA_TABLE(BkgDstarRhos, "AOD", "BkgDSTRho", o2::soa::Index<>, bkgrho::Rho, bkgrho::RhoM, o2::soa::Marker<8>); -DECLARE_SOA_TABLE(BkgLcMcRhos, "AOD", "BkgLCMcRho", +DECLARE_SOA_TABLE(BkgDstarMcRhos, "AOD", "BkgDSTMcRho", o2::soa::Index<>, bkgrho::Rho, bkgrho::RhoM, o2::soa::Marker<9>); -DECLARE_SOA_TABLE(BkgB0Rhos, "AOD", "BkgB0Rho", +DECLARE_SOA_TABLE(BkgLcRhos, "AOD", "BkgLCRho", o2::soa::Index<>, bkgrho::Rho, bkgrho::RhoM, o2::soa::Marker<10>); -DECLARE_SOA_TABLE(BkgB0McRhos, "AOD", "BkgB0McRho", +DECLARE_SOA_TABLE(BkgLcMcRhos, "AOD", "BkgLCMcRho", o2::soa::Index<>, bkgrho::Rho, bkgrho::RhoM, o2::soa::Marker<11>); -DECLARE_SOA_TABLE(BkgBplusRhos, "AOD", "BkgBPRho", +DECLARE_SOA_TABLE(BkgB0Rhos, "AOD", "BkgB0Rho", o2::soa::Index<>, bkgrho::Rho, bkgrho::RhoM, o2::soa::Marker<12>); -DECLARE_SOA_TABLE(BkgBplusMcRhos, "AOD", "BkgBPMcRho", +DECLARE_SOA_TABLE(BkgB0McRhos, "AOD", "BkgB0McRho", o2::soa::Index<>, bkgrho::Rho, bkgrho::RhoM, o2::soa::Marker<13>); -DECLARE_SOA_TABLE(BkgDielectronRhos, "AOD", "BkgDIELRho", +DECLARE_SOA_TABLE(BkgBplusRhos, "AOD", "BkgBPRho", o2::soa::Index<>, bkgrho::Rho, bkgrho::RhoM, o2::soa::Marker<14>); -DECLARE_SOA_TABLE(BkgDielectronMcRhos, "AOD", "BkgDIELMcRho", +DECLARE_SOA_TABLE(BkgBplusMcRhos, "AOD", "BkgBPMcRho", o2::soa::Index<>, bkgrho::Rho, bkgrho::RhoM, o2::soa::Marker<15>); +DECLARE_SOA_TABLE(BkgXicToXiPiPiRhos, "AOD", "BkgXICXPPRho", + o2::soa::Index<>, + bkgrho::Rho, + bkgrho::RhoM, + o2::soa::Marker<16>); + +DECLARE_SOA_TABLE(BkgXicToXiPiPiMcRhos, "AOD", "BkgXICXPPMcRho", + o2::soa::Index<>, + bkgrho::Rho, + bkgrho::RhoM, + o2::soa::Marker<17>); + +DECLARE_SOA_TABLE(BkgDielectronRhos, "AOD", "BkgDIELRho", + o2::soa::Index<>, + bkgrho::Rho, + bkgrho::RhoM, + o2::soa::Marker<18>); + +DECLARE_SOA_TABLE(BkgDielectronMcRhos, "AOD", "BkgDIELMcRho", + o2::soa::Index<>, + bkgrho::Rho, + bkgrho::RhoM, + o2::soa::Marker<19>); + DECLARE_SOA_TABLE(JTrackSubs, "AOD", "JTrackSubs", o2::soa::Index<>, bkgcharged::JCollisionId, @@ -312,6 +356,41 @@ DECLARE_SOA_TABLE(JMcParticleDplusSubs, "AOD", "JMcPartDPSubs", using JMcParticleDplusSub = JMcParticleDplusSubs::iterator; +DECLARE_SOA_TABLE(JTrackDsSubs, "AOD", "JTrackDSSubs", + o2::soa::Index<>, + bkgds::CandidateId, + jtrack::Pt, + jtrack::Eta, + jtrack::Phi, + jtrack::TrackSel, + jtrack::Px, + jtrack::Py, + jtrack::Pz, + jtrack::P, + jtrack::Energy); + +using JTrackDsSub = JTrackDsSubs::iterator; + +DECLARE_SOA_TABLE(JMcParticleDsSubs, "AOD", "JMcPartDSSubs", + o2::soa::Index<>, + bkgdsmc::CandidateId, + jmcparticle::Pt, + jmcparticle::Eta, + jmcparticle::Phi, + jmcparticle::Y, + jmcparticle::E, + jmcparticle::PdgCode, + jmcparticle::GenStatusCode, + jmcparticle::HepMCStatusCode, + jmcparticle::IsPhysicalPrimary, + jmcparticle::Px, + jmcparticle::Py, + jmcparticle::Pz, + jmcparticle::P, + jmcparticle::Energy); + +using JMcParticleDsSub = JMcParticleDsSubs::iterator; + DECLARE_SOA_TABLE(JTrackDstarSubs, "AOD", "JTrackDSTSubs", o2::soa::Index<>, bkgdstar::CandidateId, @@ -452,6 +531,41 @@ DECLARE_SOA_TABLE(JMcParticleBplusSubs, "AOD", "JMcPartBPSubs", using JMcParticleBplusSub = JMcParticleBplusSubs::iterator; +DECLARE_SOA_TABLE(JTrackXicToXiPiPiSubs, "AOD", "JTrackXICXPPCSubs", + o2::soa::Index<>, + bkgxictoxipipi::CandidateId, + jtrack::Pt, + jtrack::Eta, + jtrack::Phi, + jtrack::TrackSel, + jtrack::Px, + jtrack::Py, + jtrack::Pz, + jtrack::P, + jtrack::Energy); + +using JTrackXicToXiPiPiSub = JTrackXicToXiPiPiSubs::iterator; + +DECLARE_SOA_TABLE(JMcParticleXicToXiPiPiSubs, "AOD", "JMcPartXICXPPCSubs", + o2::soa::Index<>, + bkgxictoxipipimc::CandidateId, + jmcparticle::Pt, + jmcparticle::Eta, + jmcparticle::Phi, + jmcparticle::Y, + jmcparticle::E, + jmcparticle::PdgCode, + jmcparticle::GenStatusCode, + jmcparticle::HepMCStatusCode, + jmcparticle::IsPhysicalPrimary, + jmcparticle::Px, + jmcparticle::Py, + jmcparticle::Pz, + jmcparticle::P, + jmcparticle::Energy); + +using JMcParticleXicToXiPiPiSub = JMcParticleXicToXiPiPiSubs::iterator; + DECLARE_SOA_TABLE(JTrackDielectronSubs, "AOD", "JTrackDIELSubs", o2::soa::Index<>, bkgdielectron::CandidateId, diff --git a/PWGJE/JetFinders/CMakeLists.txt b/PWGJE/JetFinders/CMakeLists.txt index 86052ffbe88..396fe93a838 100644 --- a/PWGJE/JetFinders/CMakeLists.txt +++ b/PWGJE/JetFinders/CMakeLists.txt @@ -89,6 +89,21 @@ o2physics_add_dpl_workflow(jet-finder-dplus-mcp-charged PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(jet-finder-ds-data-charged + SOURCES jetFinderDsDataCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-finder-ds-mcd-charged + SOURCES jetFinderDsMCDCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-finder-ds-mcp-charged + SOURCES jetFinderDsMCPCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-finder-dstar-data-charged SOURCES jetFinderDstarDataCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport @@ -149,6 +164,21 @@ o2physics_add_dpl_workflow(jet-finder-bplus-mcp-charged PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(jet-finder-xictoxipipi-data-charged + SOURCES jetFinderXicToXiPiPiDataCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-finder-xictoxipipi-mcd-charged + SOURCES jetFinderXicToXiPiPiMCDCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-finder-xictoxipipi-mcp-charged + SOURCES jetFinderXicToXiPiPiMCPCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-finder-v0-data-charged SOURCES jetFinderV0DataCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport diff --git a/PWGJE/JetFinders/jetFinderDsDataCharged.cxx b/PWGJE/JetFinders/jetFinderDsDataCharged.cxx new file mode 100644 index 00000000000..a822389b6d4 --- /dev/null +++ b/PWGJE/JetFinders/jetFinderDsDataCharged.cxx @@ -0,0 +1,38 @@ +// 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. + +// jet finder Ds data charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/JetFinders/jetFinderHF.cxx" + +#include "PWGJE/DataModel/Jet.h" + +#include +#include +#include +#include + +#include + +using JetFinderDsDataCharged = JetFinderHFTask; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + + tasks.emplace_back(adaptAnalysisTask(cfgc, + SetDefaultProcesses{{{"processChargedJetsData", true}}}, + TaskName{"jet-finder-ds-data-charged"})); + + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/JetFinders/jetFinderDsMCDCharged.cxx b/PWGJE/JetFinders/jetFinderDsMCDCharged.cxx new file mode 100644 index 00000000000..004a732f9a2 --- /dev/null +++ b/PWGJE/JetFinders/jetFinderDsMCDCharged.cxx @@ -0,0 +1,38 @@ +// 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. + +// jet finder Ds mcd charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/JetFinders/jetFinderHF.cxx" + +#include "PWGJE/DataModel/Jet.h" + +#include +#include +#include +#include + +#include + +using JetFinderDsMCDetectorLevelCharged = JetFinderHFTask; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + + tasks.emplace_back(adaptAnalysisTask(cfgc, + SetDefaultProcesses{{{"processChargedJetsMCD", true}}}, + TaskName{"jet-finder-ds-mcd-charged"})); + + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/JetFinders/jetFinderDsMCPCharged.cxx b/PWGJE/JetFinders/jetFinderDsMCPCharged.cxx new file mode 100644 index 00000000000..5c9b54543b2 --- /dev/null +++ b/PWGJE/JetFinders/jetFinderDsMCPCharged.cxx @@ -0,0 +1,38 @@ +// 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. + +// jet finder Ds mcp charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/JetFinders/jetFinderHF.cxx" + +#include "PWGJE/DataModel/Jet.h" + +#include +#include +#include +#include + +#include + +using JetFinderDsMCParticleLevelCharged = JetFinderHFTask; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + + tasks.emplace_back(adaptAnalysisTask(cfgc, + SetDefaultProcesses{{{"processChargedJetsMCP", true}}}, + TaskName{"jet-finder-ds-mcp-charged"})); + + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/JetFinders/jetFinderHF.cxx b/PWGJE/JetFinders/jetFinderHF.cxx index 34409335767..d9b988c7abc 100644 --- a/PWGJE/JetFinders/jetFinderHF.cxx +++ b/PWGJE/JetFinders/jetFinderHF.cxx @@ -179,6 +179,8 @@ struct JetFinderHFTask { PresliceOptional> perD0McCandidate = aod::bkgd0mc::candidateId; PresliceOptional> perDplusCandidate = aod::bkgdplus::candidateId; PresliceOptional> perDplusMcCandidate = aod::bkgdplusmc::candidateId; + PresliceOptional> perDsCandidate = aod::bkgds::candidateId; + PresliceOptional> perDsMcCandidate = aod::bkgdsmc::candidateId; PresliceOptional> perDstarCandidate = aod::bkgdstar::candidateId; PresliceOptional> perDstarMcCandidate = aod::bkgdstarmc::candidateId; PresliceOptional> perLcCandidate = aod::bkglc::candidateId; @@ -187,6 +189,8 @@ struct JetFinderHFTask { PresliceOptional> perB0McCandidate = aod::bkgb0mc::candidateId; PresliceOptional> perBplusCandidate = aod::bkgbplus::candidateId; PresliceOptional> perBplusMcCandidate = aod::bkgbplusmc::candidateId; + PresliceOptional> perXicToXiPiPiCandidate = aod::bkgxictoxipipi::candidateId; + PresliceOptional> perXicToXiPiPiMcCandidate = aod::bkgxictoxipipimc::candidateId; PresliceOptional> perDielectronCandidate = aod::bkgdielectron::candidateId; PresliceOptional> perDielectronMcCandidate = aod::bkgdielectronmc::candidateId; @@ -254,7 +258,7 @@ struct JetFinderHFTask { void processChargedEvtWiseSubJetsData(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, CandidateTableData const& candidates) { for (typename CandidateTableData::iterator const& candidate : candidates) { - analyseCharged(collision, jetcandidateutilities::slicedPerCandidate(tracks, candidate, perD0Candidate, perDplusCandidate, perDstarCandidate, perLcCandidate, perB0Candidate, perBplusCandidate, perDielectronCandidate), candidate, jetsEvtWiseSubTable, constituentsEvtWiseSubTable, tracks, jetEWSPtMin, jetEWSPtMax); + analyseCharged(collision, jetcandidateutilities::slicedPerCandidate(tracks, candidate, perD0Candidate, perDplusCandidate, perDsCandidate, perDstarCandidate, perLcCandidate, perB0Candidate, perBplusCandidate, perXicToXiPiPiCandidate, perDielectronCandidate), candidate, jetsEvtWiseSubTable, constituentsEvtWiseSubTable, tracks, jetEWSPtMin, jetEWSPtMax); } } PROCESS_SWITCH(JetFinderHFTask, processChargedEvtWiseSubJetsData, "charged hf jet finding on data with event-wise constituent subtraction", false); @@ -270,7 +274,7 @@ struct JetFinderHFTask { void processChargedEvtWiseSubJetsMCD(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, CandidateTableMCD const& candidates) { for (typename CandidateTableMCD::iterator const& candidate : candidates) { - analyseCharged(collision, jetcandidateutilities::slicedPerCandidate(tracks, candidate, perD0Candidate, perDplusCandidate, perDstarCandidate, perLcCandidate, perB0Candidate, perBplusCandidate, perDielectronCandidate), candidate, jetsEvtWiseSubTable, constituentsEvtWiseSubTable, tracks, jetEWSPtMin, jetEWSPtMax); + analyseCharged(collision, jetcandidateutilities::slicedPerCandidate(tracks, candidate, perD0Candidate, perDplusCandidate, perDsCandidate, perDstarCandidate, perLcCandidate, perB0Candidate, perBplusCandidate, perXicToXiPiPiCandidate, perDielectronCandidate), candidate, jetsEvtWiseSubTable, constituentsEvtWiseSubTable, tracks, jetEWSPtMin, jetEWSPtMax); } } PROCESS_SWITCH(JetFinderHFTask, processChargedEvtWiseSubJetsMCD, "charged hf jet finding on MC detector level with event-wise constituent subtraction", false); @@ -290,7 +294,7 @@ struct JetFinderHFTask { CandidateTableMCP const& candidates) { for (typename CandidateTableMCP::iterator const& candidate : candidates) { - analyseMCP(collision, jetcandidateutilities::slicedPerCandidate(particles, candidate, perD0McCandidate, perDplusMcCandidate, perDstarMcCandidate, perLcMcCandidate, perB0McCandidate, perBplusMcCandidate, perDielectronMcCandidate), candidate, 1, jetPtMin, jetPtMax); + analyseMCP(collision, jetcandidateutilities::slicedPerCandidate(particles, candidate, perD0McCandidate, perDplusMcCandidate, perDsMcCandidate, perDstarMcCandidate, perLcMcCandidate, perB0McCandidate, perBplusMcCandidate, perXicToXiPiPiMcCandidate, perDielectronMcCandidate), candidate, 1, jetPtMin, jetPtMax); } } PROCESS_SWITCH(JetFinderHFTask, processChargedEvtWiseSubJetsMCP, "hf jet finding on MC particle level", false); diff --git a/PWGJE/JetFinders/jetFinderXicToXiPiPiDataCharged.cxx b/PWGJE/JetFinders/jetFinderXicToXiPiPiDataCharged.cxx new file mode 100644 index 00000000000..3ed339e8a32 --- /dev/null +++ b/PWGJE/JetFinders/jetFinderXicToXiPiPiDataCharged.cxx @@ -0,0 +1,38 @@ +// 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. + +// jet finder XicToXiPiPi data charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/JetFinders/jetFinderHF.cxx" + +#include "PWGJE/DataModel/Jet.h" + +#include +#include +#include +#include + +#include + +using JetFinderXicToXiPiPiDataCharged = JetFinderHFTask; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + + tasks.emplace_back(adaptAnalysisTask(cfgc, + SetDefaultProcesses{{{"processChargedJetsData", true}}}, + TaskName{"jet-finder-xictoxipipi-data-charged"})); + + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/JetFinders/jetFinderXicToXiPiPiMCDCharged.cxx b/PWGJE/JetFinders/jetFinderXicToXiPiPiMCDCharged.cxx new file mode 100644 index 00000000000..64c35fe78c6 --- /dev/null +++ b/PWGJE/JetFinders/jetFinderXicToXiPiPiMCDCharged.cxx @@ -0,0 +1,38 @@ +// 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. + +// jet finder D+ mcd charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/JetFinders/jetFinderHF.cxx" + +#include "PWGJE/DataModel/Jet.h" + +#include +#include +#include +#include + +#include + +using JetFinderXicToXiPiPiMCDetectorLevelCharged = JetFinderHFTask; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + + tasks.emplace_back(adaptAnalysisTask(cfgc, + SetDefaultProcesses{{{"processChargedJetsMCD", true}}}, + TaskName{"jet-finder-xictoxipipi-mcd-charged"})); + + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/JetFinders/jetFinderXicToXiPiPiMCPCharged.cxx b/PWGJE/JetFinders/jetFinderXicToXiPiPiMCPCharged.cxx new file mode 100644 index 00000000000..ca4cc98938f --- /dev/null +++ b/PWGJE/JetFinders/jetFinderXicToXiPiPiMCPCharged.cxx @@ -0,0 +1,38 @@ +// 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. + +// jet finder D+ mcp charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/JetFinders/jetFinderHF.cxx" + +#include "PWGJE/DataModel/Jet.h" + +#include +#include +#include +#include + +#include + +using JetFinderXicToXiPiPiMCParticleLevelCharged = JetFinderHFTask; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + + tasks.emplace_back(adaptAnalysisTask(cfgc, + SetDefaultProcesses{{{"processChargedJetsMCP", true}}}, + TaskName{"jet-finder-xictoxipipi-mcp-charged"})); + + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/CMakeLists.txt b/PWGJE/TableProducer/Matching/CMakeLists.txt index e6526d90f1e..a5450dfb05e 100644 --- a/PWGJE/TableProducer/Matching/CMakeLists.txt +++ b/PWGJE/TableProducer/Matching/CMakeLists.txt @@ -39,6 +39,11 @@ o2physics_add_dpl_workflow(jet-matching-mc-dplus-ch PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(jet-matching-mc-ds-ch + SOURCES jetMatchingMCDsCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-matching-mc-dstar-ch SOURCES jetMatchingMCDstarCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport @@ -59,6 +64,11 @@ o2physics_add_dpl_workflow(jet-matching-mc-bplus-ch PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(jet-matching-mc-xictoxipipi-ch + SOURCES jetMatchingMCXicToXiPiPiCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-matching-mc-dielectron-ch SOURCES jetMatchingMCDielectronCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport @@ -84,6 +94,11 @@ o2physics_add_dpl_workflow(jet-matching-mc-sub-dplus-ch PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(jet-matching-mc-sub-ds-ch + SOURCES jetMatchingMCSubDsCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-matching-mc-sub-dstar-ch SOURCES jetMatchingMCSubDstarCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport @@ -104,6 +119,11 @@ o2physics_add_dpl_workflow(jet-matching-mc-sub-bplus-ch PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(jet-matching-mc-sub-xictoxipipi-ch + SOURCES jetMatchingMCSubXicToXiPiPiCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-matching-mc-sub-dielectron-ch SOURCES jetMatchingMCSubDielectronCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport @@ -124,6 +144,11 @@ o2physics_add_dpl_workflow(jet-matching-sub-dplus-ch PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(jet-matching-sub-ds-ch + SOURCES jetMatchingSubDsCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-matching-sub-dstar-ch SOURCES jetMatchingSubDstarCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport @@ -144,6 +169,11 @@ o2physics_add_dpl_workflow(jet-matching-sub-b0-ch PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(jet-matching-sub-xictoxipipi-ch + SOURCES jetMatchingSubXicToXiPiPiCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-matching-sub-dielectron-ch SOURCES jetMatchingSubDielectronCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport diff --git a/PWGJE/TableProducer/Matching/Substructure/CMakeLists.txt b/PWGJE/TableProducer/Matching/Substructure/CMakeLists.txt index e004a0a52ee..238e84ddc91 100644 --- a/PWGJE/TableProducer/Matching/Substructure/CMakeLists.txt +++ b/PWGJE/TableProducer/Matching/Substructure/CMakeLists.txt @@ -27,6 +27,11 @@ o2physics_add_dpl_workflow(jet-substructure-matching-mc-dplus-ch PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(jet-substructure-matching-mc-ds-ch + SOURCES jetSubstructureMatchingMCDsCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-substructure-matching-mc-dstar-ch SOURCES jetSubstructureMatchingMCDstarCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport @@ -47,6 +52,11 @@ o2physics_add_dpl_workflow(jet-substructure-matching-mc-bplus-ch PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(jet-substructure-matching-mc-xictoxipipi-ch + SOURCES jetSubstructureMatchingMCXicToXiPiPiCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-substructure-matching-mc-dielectron-ch SOURCES jetSubstructureMatchingMCDielectronCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport @@ -67,6 +77,11 @@ o2physics_add_dpl_workflow(jet-substructure-matching-sub-dplus-ch PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(jet-substructure-matching-sub-ds-ch + SOURCES jetSubstructureMatchingSubDsCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-substructure-matching-sub-dstar-ch SOURCES jetSubstructureMatchingSubDstarCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport @@ -87,6 +102,11 @@ o2physics_add_dpl_workflow(jet-substructure-matching-sub-bplus-ch PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(jet-substructure-matching-sub-xictoxipipi-ch + SOURCES jetSubstructureMatchingSubXicToXiPiPiCharged.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-substructure-matching-sub-dielectron-ch SOURCES jetSubstructureMatchingSubDielectronCharged.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport diff --git a/PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatching.cxx b/PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatching.cxx index 02b4c1b87d1..8cca2025f5e 100644 --- a/PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatching.cxx +++ b/PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatching.cxx @@ -61,6 +61,8 @@ struct JetSubstructureMatching { PresliceOptional TagSplittingsPerTagJetD0 = aod::d0chargedmcparticlelevelsplitting::jetId; PresliceOptional BaseSplittingsPerBaseJetDplus = aod::dpluschargedmcdetectorlevelsplitting::jetId; PresliceOptional TagSplittingsPerTagJetDplus = aod::dpluschargedmcparticlelevelsplitting::jetId; + PresliceOptional BaseSplittingsPerBaseJetDs = aod::dschargedmcdetectorlevelsplitting::jetId; + PresliceOptional TagSplittingsPerTagJetDs = aod::dschargedmcparticlelevelsplitting::jetId; PresliceOptional BaseSplittingsPerBaseJetDstar = aod::dstarchargedmcdetectorlevelsplitting::jetId; PresliceOptional TagSplittingsPerTagJetDstar = aod::dstarchargedmcparticlelevelsplitting::jetId; PresliceOptional BaseSplittingsPerBaseJetLc = aod::lcchargedmcdetectorlevelsplitting::jetId; @@ -69,6 +71,8 @@ struct JetSubstructureMatching { PresliceOptional TagSplittingsPerTagJetB0 = aod::b0chargedmcparticlelevelsplitting::jetId; PresliceOptional BaseSplittingsPerBaseJetBplus = aod::bpluschargedmcdetectorlevelsplitting::jetId; PresliceOptional TagSplittingsPerTagJetBplus = aod::bpluschargedmcparticlelevelsplitting::jetId; + PresliceOptional BaseSplittingsPerBaseJetXicToXiPiPi = aod::xictoxipipichargedmcdetectorlevelsplitting::jetId; + PresliceOptional TagSplittingsPerTagJetXicToXiPiPi = aod::xictoxipipichargedmcparticlelevelsplitting::jetId; PresliceOptional BaseSplittingsPerBaseJetDielectron = aod::dielectronchargedmcdetectorlevelsplitting::jetId; PresliceOptional TagSplittingsPerTagJetDielectron = aod::dielectronchargedmcparticlelevelsplitting::jetId; @@ -78,6 +82,8 @@ struct JetSubstructureMatching { PresliceOptional TagPairsPerTagJetD0 = aod::d0chargedmcparticlelevelpair::jetId; PresliceOptional BasePairsPerBaseJetDplus = aod::dpluschargedmcdetectorlevelpair::jetId; PresliceOptional TagPairsPerTagJetDplus = aod::dpluschargedmcparticlelevelpair::jetId; + PresliceOptional BasePairsPerBaseJetDs = aod::dschargedmcdetectorlevelpair::jetId; + PresliceOptional TagPairsPerTagJetDs = aod::dschargedmcparticlelevelpair::jetId; PresliceOptional BasePairsPerBaseJetDstar = aod::dstarchargedmcdetectorlevelpair::jetId; PresliceOptional TagPairsPerTagJetDstar = aod::dstarchargedmcparticlelevelpair::jetId; PresliceOptional BasePairsPerBaseJetLc = aod::lcchargedmcdetectorlevelpair::jetId; @@ -86,15 +92,17 @@ struct JetSubstructureMatching { PresliceOptional TagPairsPerTagJetB0 = aod::b0chargedmcparticlelevelpair::jetId; PresliceOptional BasePairsPerBaseJetBplus = aod::bpluschargedmcdetectorlevelpair::jetId; PresliceOptional TagPairsPerTagJetBplus = aod::bpluschargedmcparticlelevelpair::jetId; + PresliceOptional BasePairsPerBaseJetXicToXiPiPi = aod::xictoxipipichargedmcdetectorlevelpair::jetId; + PresliceOptional TagPairsPerTagJetXicToXiPiPi = aod::xictoxipipichargedmcparticlelevelpair::jetId; PresliceOptional BasePairsPerBaseJetDielectron = aod::dielectronchargedmcdetectorlevelpair::jetId; PresliceOptional TagPairsPerTagJetDielectron = aod::dielectronchargedmcparticlelevelpair::jetId; // workaround till binding nodes can be passed as template arguments - template - auto slicedPerJetForMatching(T const& table, U const& jet, V const& perIncluisveJet, M const& perD0Jet, N const& perDplusJet, O const& perDstarJet, P const& perLcJet, Q const& perB0Jet, R const& perBplusJet, S const& perDielectronJet) + template + auto slicedPerJetForMatching(T const& table, U const& jet, V const& perIncluisveJet, M const& perD0Jet, N const& perDplusJet, O const& perDsJet, P const& perDstarJet, Q const& perLcJet, R const& perB0Jet, S const& perBplusJet, A const& perXicToXiPiPiJet, B const& perDielectronJet) { if constexpr (jethfutilities::isHFTable() || jethfutilities::isHFMcTable()) { - return jethfutilities::slicedPerHFJet(table, jet, perD0Jet, perDplusJet, perDstarJet, perLcJet, perB0Jet, perBplusJet); + return jethfutilities::slicedPerHFJet(table, jet, perD0Jet, perDplusJet, perDsJet, perDstarJet, perLcJet, perB0Jet, perBplusJet, perXicToXiPiPiJet); } else if constexpr (jetdqutilities::isDielectronTable() || jetdqutilities::isDielectronMcTable()) { return jetdqutilities::slicedPerDielectronJet(table, jet, perDielectronJet); } else { @@ -157,14 +165,14 @@ struct JetSubstructureMatching { } if (hasMatchedJet) { // auto const& jetTagSplittings = jetsTagSplittings.sliceBy(TagSplittingsPerTagJet, jetTag.globalIndex()); - auto const& jetTagSplittings = slicedPerJetForMatching(jetsTagSplittings, jetTag, TagSplittingsPerTagJetInclusive, TagSplittingsPerTagJetD0, TagSplittingsPerTagJetDplus, TagSplittingsPerTagJetDstar, TagSplittingsPerTagJetLc, TagSplittingsPerTagJetB0, TagSplittingsPerTagJetBplus, TagSplittingsPerTagJetDielectron); + auto const& jetTagSplittings = slicedPerJetForMatching(jetsTagSplittings, jetTag, TagSplittingsPerTagJetInclusive, TagSplittingsPerTagJetD0, TagSplittingsPerTagJetDplus, TagSplittingsPerTagJetDs, TagSplittingsPerTagJetDstar, TagSplittingsPerTagJetLc, TagSplittingsPerTagJetB0, TagSplittingsPerTagJetBplus, TagSplittingsPerTagJetXicToXiPiPi, TagSplittingsPerTagJetDielectron); int tagSplittingIndex = 0; for (auto const& jetTagSplitting : jetTagSplittings) { jetTagSplittingsMap[jetTagSplitting.globalIndex()] = tagSplittingIndex; tagSplittingIndex++; } // auto const& jetTagPairs = jetsTagPairs.sliceBy(TagPairsPerTagJet, jetTag.globalIndex()); - auto const& jetTagPairs = slicedPerJetForMatching(jetsTagPairs, jetTag, TagPairsPerTagJetInclusive, TagPairsPerTagJetD0, TagPairsPerTagJetDplus, TagPairsPerTagJetDstar, TagPairsPerTagJetLc, TagPairsPerTagJetB0, TagPairsPerTagJetBplus, TagPairsPerTagJetDielectron); + auto const& jetTagPairs = slicedPerJetForMatching(jetsTagPairs, jetTag, TagPairsPerTagJetInclusive, TagPairsPerTagJetD0, TagPairsPerTagJetDplus, TagPairsPerTagJetDs, TagPairsPerTagJetDstar, TagPairsPerTagJetLc, TagPairsPerTagJetB0, TagPairsPerTagJetBplus, TagPairsPerTagJetXicToXiPiPi, TagPairsPerTagJetDielectron); int tagPairIndex = 0; for (auto const& jetTagPair : jetTagPairs) { jetTagPairsMap[jetTagPair.globalIndex()] = tagPairIndex; @@ -205,7 +213,7 @@ struct JetSubstructureMatching { } } // auto const& jetBaseSplittings = jetsBaseSplittings.sliceBy(BaseSplittingsPerBaseJet, jetBase.globalIndex()); - auto const& jetBaseSplittings = slicedPerJetForMatching(jetsBaseSplittings, jetBase, BaseSplittingsPerBaseJetInclusive, BaseSplittingsPerBaseJetD0, BaseSplittingsPerBaseJetDplus, BaseSplittingsPerBaseJetDstar, BaseSplittingsPerBaseJetLc, BaseSplittingsPerBaseJetB0, BaseSplittingsPerBaseJetBplus, BaseSplittingsPerBaseJetDielectron); + auto const& jetBaseSplittings = slicedPerJetForMatching(jetsBaseSplittings, jetBase, BaseSplittingsPerBaseJetInclusive, BaseSplittingsPerBaseJetD0, BaseSplittingsPerBaseJetDplus, BaseSplittingsPerBaseJetDs, BaseSplittingsPerBaseJetDstar, BaseSplittingsPerBaseJetLc, BaseSplittingsPerBaseJetB0, BaseSplittingsPerBaseJetBplus, BaseSplittingsPerBaseJetXicToXiPiPi, BaseSplittingsPerBaseJetDielectron); int baseSplittingIndex = 0; for (auto const& jetBaseSplitting : jetBaseSplittings) { jetBaseSplittingsMap[jetBaseSplitting.globalIndex()] = baseSplittingIndex; @@ -213,7 +221,7 @@ struct JetSubstructureMatching { } jetmatchingutilities::doAllMatching(jetBaseSplittings, jetTagSplittings, jetsBasetoTagSplittingsMatchingGeo, jetsBasetoTagSplittingsMatchingPt, jetsBasetoTagSplittingsMatchingHF, jetsTagtoBaseSplittingsMatchingGeo, jetsTagtoBaseSplittingsMatchingPt, jetsTagtoBaseSplittingsMatchingHF, candidatesBase, tracksBase, clustersBase, candidatesTag, tracksTag, tracksTag, doMatchingGeo, doMatchingHf, doMatchingPt, maxMatchingDistance, minPtFraction); // auto const& jetBasePairs = jetsBasePairs.sliceBy(BasePairsPerBaseJet, jetBase.globalIndex()); - auto const& jetBasePairs = slicedPerJetForMatching(jetsBasePairs, jetBase, BasePairsPerBaseJetInclusive, BasePairsPerBaseJetD0, BasePairsPerBaseJetDplus, BasePairsPerBaseJetDstar, BasePairsPerBaseJetLc, BasePairsPerBaseJetB0, BasePairsPerBaseJetBplus, BasePairsPerBaseJetDielectron); + auto const& jetBasePairs = slicedPerJetForMatching(jetsBasePairs, jetBase, BasePairsPerBaseJetInclusive, BasePairsPerBaseJetD0, BasePairsPerBaseJetDplus, BasePairsPerBaseJetDs, BasePairsPerBaseJetDstar, BasePairsPerBaseJetLc, BasePairsPerBaseJetB0, BasePairsPerBaseJetBplus, BasePairsPerBaseJetXicToXiPiPi, BasePairsPerBaseJetDielectron); int basePairIndex = 0; for (auto const& jetBasePair : jetBasePairs) { jetBasePairsMap[jetBasePair.globalIndex()] = basePairIndex; diff --git a/PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatchingMCDsCharged.cxx b/PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatchingMCDsCharged.cxx new file mode 100644 index 00000000000..e6e76c930be --- /dev/null +++ b/PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatchingMCDsCharged.cxx @@ -0,0 +1,51 @@ +// 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. + +// Ds substructure matching mc charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatching.cxx" + +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/DataModel/JetReducedData.h" +#include "PWGJE/DataModel/JetSubstructure.h" + +#include +#include +#include +#include +#include + +#include + +using DsChargedJetSubstructureMatchingMC = JetSubstructureMatching, + soa::Join, + aod::DsChargedMCDetectorLevelSPsMatchedToDsChargedMCParticleLevelSPs, + aod::DsChargedMCParticleLevelSPsMatchedToDsChargedMCDetectorLevelSPs, + aod::DsChargedMCDetectorLevelPRsMatchedToDsChargedMCParticleLevelPRs, + aod::DsChargedMCParticleLevelPRsMatchedToDsChargedMCDetectorLevelPRs, + aod::DsChargedMCDetectorLevelSPs, + aod::DsChargedMCParticleLevelSPs, + aod::DsChargedMCDetectorLevelPRs, + aod::DsChargedMCParticleLevelPRs, + aod::CandidatesDsMCD, + aod::CandidatesDsMCP, + aod::JetTracksMCD, + aod::JetParticles, + aod::JDummys>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-substructure-matching-mc-ds-ch"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatchingMCXicToXiPiPiCharged.cxx b/PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatchingMCXicToXiPiPiCharged.cxx new file mode 100644 index 00000000000..b0eea7a3e6d --- /dev/null +++ b/PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatchingMCXicToXiPiPiCharged.cxx @@ -0,0 +1,51 @@ +// 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. + +// XicToXiPiPi substructure matching mc charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatching.cxx" + +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/DataModel/JetReducedData.h" +#include "PWGJE/DataModel/JetSubstructure.h" + +#include +#include +#include +#include +#include + +#include + +using XicToXiPiPiChargedJetSubstructureMatchingMC = JetSubstructureMatching, + soa::Join, + aod::XicToXiPiPiChargedMCDetectorLevelSPsMatchedToXicToXiPiPiChargedMCParticleLevelSPs, + aod::XicToXiPiPiChargedMCParticleLevelSPsMatchedToXicToXiPiPiChargedMCDetectorLevelSPs, + aod::XicToXiPiPiChargedMCDetectorLevelPRsMatchedToXicToXiPiPiChargedMCParticleLevelPRs, + aod::XicToXiPiPiChargedMCParticleLevelPRsMatchedToXicToXiPiPiChargedMCDetectorLevelPRs, + aod::XicToXiPiPiChargedMCDetectorLevelSPs, + aod::XicToXiPiPiChargedMCParticleLevelSPs, + aod::XicToXiPiPiChargedMCDetectorLevelPRs, + aod::XicToXiPiPiChargedMCParticleLevelPRs, + aod::CandidatesXicToXiPiPiMCD, + aod::CandidatesXicToXiPiPiMCP, + aod::JetTracksMCD, + aod::JetParticles, + aod::JDummys>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-substructure-matching-mc-xictoxipipi-ch"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatchingSub.cxx b/PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatchingSub.cxx index 179a4b96b05..bad062a3044 100644 --- a/PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatchingSub.cxx +++ b/PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatchingSub.cxx @@ -62,6 +62,8 @@ struct JetSubstructureMatchingSub { PresliceOptional TagSplittingsPerTagJetD0 = aod::d0chargedeventwisesubtractedsplitting::jetId; PresliceOptional BaseSplittingsPerBaseJetDplus = aod::dpluschargedsplitting::jetId; PresliceOptional TagSplittingsPerTagJetDplus = aod::dpluschargedeventwisesubtractedsplitting::jetId; + PresliceOptional BaseSplittingsPerBaseJetDs = aod::dschargedsplitting::jetId; + PresliceOptional TagSplittingsPerTagJetDs = aod::dschargedeventwisesubtractedsplitting::jetId; PresliceOptional BaseSplittingsPerBaseJetDstar = aod::dstarchargedsplitting::jetId; PresliceOptional TagSplittingsPerTagJetDstar = aod::dstarchargedeventwisesubtractedsplitting::jetId; PresliceOptional BaseSplittingsPerBaseJetLc = aod::lcchargedsplitting::jetId; @@ -70,6 +72,8 @@ struct JetSubstructureMatchingSub { PresliceOptional TagSplittingsPerTagJetB0 = aod::b0chargedeventwisesubtractedsplitting::jetId; PresliceOptional BaseSplittingsPerBaseJetBplus = aod::bpluschargedsplitting::jetId; PresliceOptional TagSplittingsPerTagJetBplus = aod::bpluschargedeventwisesubtractedsplitting::jetId; + PresliceOptional BaseSplittingsPerBaseJetXicToXiPiPi = aod::xictoxipipichargedsplitting::jetId; + PresliceOptional TagSplittingsPerTagJetXicToXiPiPi = aod::xictoxipipichargedeventwisesubtractedsplitting::jetId; PresliceOptional BaseSplittingsPerBaseJetDielectron = aod::dielectronchargedsplitting::jetId; PresliceOptional TagSplittingsPerTagJetDielectron = aod::dielectronchargedeventwisesubtractedsplitting::jetId; @@ -79,23 +83,27 @@ struct JetSubstructureMatchingSub { PresliceOptional TagPairsPerTagJetD0 = aod::d0chargedeventwisesubtractedpair::jetId; PresliceOptional BasePairsPerBaseJetDplus = aod::dpluschargedpair::jetId; PresliceOptional TagPairsPerTagJetDplus = aod::dpluschargedeventwisesubtractedpair::jetId; + PresliceOptional BasePairsPerBaseJetDs = aod::dschargedpair::jetId; + PresliceOptional TagPairsPerTagJetDs = aod::dschargedeventwisesubtractedpair::jetId; PresliceOptional BasePairsPerBaseJetDstar = aod::dstarchargedpair::jetId; PresliceOptional TagPairsPerTagJetDstar = aod::dstarchargedeventwisesubtractedpair::jetId; PresliceOptional BasePairsPerBaseJetLc = aod::lcchargedpair::jetId; PresliceOptional TagPairsPerTagJetLc = aod::lcchargedeventwisesubtractedpair::jetId; - PresliceOptional BasePairsPerBaseJetBplus = aod::bpluschargedpair::jetId; - PresliceOptional TagPairsPerTagJetBplus = aod::bpluschargedeventwisesubtractedpair::jetId; PresliceOptional BasePairsPerBaseJetB0 = aod::b0chargedpair::jetId; PresliceOptional TagPairsPerTagJetB0 = aod::b0chargedeventwisesubtractedpair::jetId; + PresliceOptional BasePairsPerBaseJetBplus = aod::bpluschargedpair::jetId; + PresliceOptional TagPairsPerTagJetBplus = aod::bpluschargedeventwisesubtractedpair::jetId; + PresliceOptional BasePairsPerBaseJetXicToXiPiPi = aod::xictoxipipichargedpair::jetId; + PresliceOptional TagPairsPerTagJetXicToXiPiPi = aod::xictoxipipichargedeventwisesubtractedpair::jetId; PresliceOptional BasePairsPerBaseJetDielectron = aod::dielectronchargedpair::jetId; PresliceOptional TagPairsPerTagJetDielectron = aod::dielectronchargedeventwisesubtractedpair::jetId; // workaround till binding nodes can be passed as template arguments - template - auto slicedPerJetForMatching(T const& table, U const& jet, V const& perIncluisveJet, M const& perD0Jet, N const& perDplusJet, O const& perDstarJet, P const& perLcJet, Q const& perB0Jet, R const& perBplusJet, S const& perDielectronJet) + template + auto slicedPerJetForMatching(T const& table, U const& jet, V const& perIncluisveJet, M const& perD0Jet, N const& perDplusJet, O const& perDsJet, P const& perDstarJet, Q const& perLcJet, R const& perB0Jet, S const& perBplusJet, A const& perXicToXiPiPiJet, B const& perDielectronJet) { if constexpr (jethfutilities::isHFTable() || jethfutilities::isHFMcTable()) { - return jethfutilities::slicedPerHFJet(table, jet, perD0Jet, perDplusJet, perDstarJet, perLcJet, perB0Jet, perBplusJet); + return jethfutilities::slicedPerHFJet(table, jet, perD0Jet, perDplusJet, perDsJet, perDstarJet, perLcJet, perB0Jet, perBplusJet, perXicToXiPiPiJet); } else if constexpr (jetdqutilities::isDielectronTable() || jetdqutilities::isDielectronMcTable()) { return jetdqutilities::slicedPerDielectronJet(table, jet, perDielectronJet); } else { @@ -158,14 +166,14 @@ struct JetSubstructureMatchingSub { } if (hasMatchedJet) { // auto const& jetTagSplittings = jetsTagSplittings.sliceBy(TagSplittingsPerTagJet, jetTag.globalIndex()); - auto const& jetTagSplittings = slicedPerJetForMatching(jetsTagSplittings, jetTag, TagSplittingsPerTagJetInclusive, TagSplittingsPerTagJetD0, TagSplittingsPerTagJetDplus, TagSplittingsPerTagJetDstar, TagSplittingsPerTagJetLc, TagSplittingsPerTagJetB0, TagSplittingsPerTagJetBplus, TagSplittingsPerTagJetDielectron); + auto const& jetTagSplittings = slicedPerJetForMatching(jetsTagSplittings, jetTag, TagSplittingsPerTagJetInclusive, TagSplittingsPerTagJetD0, TagSplittingsPerTagJetDplus, TagSplittingsPerTagJetDs, TagSplittingsPerTagJetDstar, TagSplittingsPerTagJetLc, TagSplittingsPerTagJetB0, TagSplittingsPerTagJetBplus, TagSplittingsPerTagJetXicToXiPiPi, TagSplittingsPerTagJetDielectron); int tagSplittingIndex = 0; for (auto const& jetTagSplitting : jetTagSplittings) { jetTagSplittingsMap[jetTagSplitting.globalIndex()] = tagSplittingIndex; tagSplittingIndex++; } // auto const& jetTagPairs = jetsTagPairs.sliceBy(TagPairsPerTagJet, jetTag.globalIndex()); - auto const& jetTagPairs = slicedPerJetForMatching(jetsTagPairs, jetTag, TagPairsPerTagJetInclusive, TagPairsPerTagJetD0, TagPairsPerTagJetDplus, TagPairsPerTagJetDstar, TagPairsPerTagJetLc, TagPairsPerTagJetB0, TagPairsPerTagJetBplus, TagPairsPerTagJetDielectron); + auto const& jetTagPairs = slicedPerJetForMatching(jetsTagPairs, jetTag, TagPairsPerTagJetInclusive, TagPairsPerTagJetD0, TagPairsPerTagJetDplus, TagPairsPerTagJetDs, TagPairsPerTagJetDstar, TagPairsPerTagJetLc, TagPairsPerTagJetB0, TagPairsPerTagJetBplus, TagPairsPerTagJetXicToXiPiPi, TagPairsPerTagJetDielectron); int tagPairIndex = 0; for (auto const& jetTagPair : jetTagPairs) { jetTagPairsMap[jetTagPair.globalIndex()] = tagPairIndex; @@ -206,7 +214,7 @@ struct JetSubstructureMatchingSub { } } // auto const& jetBaseSplittings = jetsBaseSplittings.sliceBy(BaseSplittingsPerBaseJet, jetBase.globalIndex()); - auto const& jetBaseSplittings = slicedPerJetForMatching(jetsBaseSplittings, jetBase, BaseSplittingsPerBaseJetInclusive, BaseSplittingsPerBaseJetD0, BaseSplittingsPerBaseJetDplus, BaseSplittingsPerBaseJetDstar, BaseSplittingsPerBaseJetLc, BaseSplittingsPerBaseJetB0, BaseSplittingsPerBaseJetBplus, BaseSplittingsPerBaseJetDielectron); + auto const& jetBaseSplittings = slicedPerJetForMatching(jetsBaseSplittings, jetBase, BaseSplittingsPerBaseJetInclusive, BaseSplittingsPerBaseJetD0, BaseSplittingsPerBaseJetDplus, BaseSplittingsPerBaseJetDs, BaseSplittingsPerBaseJetDstar, BaseSplittingsPerBaseJetLc, BaseSplittingsPerBaseJetB0, BaseSplittingsPerBaseJetBplus, BaseSplittingsPerBaseJetXicToXiPiPi, BaseSplittingsPerBaseJetDielectron); int baseSplittingIndex = 0; for (auto const& jetBaseSplitting : jetBaseSplittings) { jetBaseSplittingsMap[jetBaseSplitting.globalIndex()] = baseSplittingIndex; @@ -214,7 +222,7 @@ struct JetSubstructureMatchingSub { } jetmatchingutilities::doAllMatching(jetBaseSplittings, jetTagSplittings, jetsBasetoTagSplittingsMatchingGeo, jetsBasetoTagSplittingsMatchingPt, jetsBasetoTagSplittingsMatchingHF, jetsTagtoBaseSplittingsMatchingGeo, jetsTagtoBaseSplittingsMatchingPt, jetsTagtoBaseSplittingsMatchingHF, candidates, tracksBase, clustersBase, candidates, tracksTag, tracksTag, doMatchingGeo, doMatchingHf, doMatchingPt, maxMatchingDistance, minPtFraction); // auto const& jetBasePairs = jetsBasePairs.sliceBy(BasePairsPerBaseJet, jetBase.globalIndex()); - auto const& jetBasePairs = slicedPerJetForMatching(jetsBasePairs, jetBase, BasePairsPerBaseJetInclusive, BasePairsPerBaseJetD0, BasePairsPerBaseJetDplus, BasePairsPerBaseJetDstar, BasePairsPerBaseJetLc, BasePairsPerBaseJetB0, BasePairsPerBaseJetBplus, BasePairsPerBaseJetDielectron); + auto const& jetBasePairs = slicedPerJetForMatching(jetsBasePairs, jetBase, BasePairsPerBaseJetInclusive, BasePairsPerBaseJetD0, BasePairsPerBaseJetDplus, BasePairsPerBaseJetDs, BasePairsPerBaseJetDstar, BasePairsPerBaseJetLc, BasePairsPerBaseJetB0, BasePairsPerBaseJetBplus, BasePairsPerBaseJetXicToXiPiPi, BasePairsPerBaseJetDielectron); int basePairIndex = 0; for (auto const& jetBasePair : jetBasePairs) { jetBasePairsMap[jetBasePair.globalIndex()] = basePairIndex; diff --git a/PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatchingSubDsCharged.cxx b/PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatchingSubDsCharged.cxx new file mode 100644 index 00000000000..0fa4f86388d --- /dev/null +++ b/PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatchingSubDsCharged.cxx @@ -0,0 +1,50 @@ +// 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. + +// substructure matching event-wise subtracted Ds charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatchingSub.cxx" + +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/DataModel/JetReducedData.h" +#include "PWGJE/DataModel/JetSubstructure.h" + +#include +#include +#include +#include +#include + +#include + +using DsChargedJetSubstructureMatchingSub = JetSubstructureMatchingSub, + soa::Join, + aod::DsChargedSPsMatchedToDsChargedEventWiseSubtractedSPs, + aod::DsChargedEventWiseSubtractedSPsMatchedToDsChargedSPs, + aod::DsChargedPRsMatchedToDsChargedEventWiseSubtractedPRs, + aod::DsChargedEventWiseSubtractedPRsMatchedToDsChargedPRs, + aod::DsChargedSPs, + aod::DsChargedEventWiseSubtractedSPs, + aod::DsChargedPRs, + aod::DsChargedEventWiseSubtractedPRs, + aod::CandidatesDsData, + aod::JetTracks, + aod::JetTracksSubDs, + aod::JDummys>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-substructure-matching-sub-ds-ch"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatchingSubXicToXiPiPiCharged.cxx b/PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatchingSubXicToXiPiPiCharged.cxx new file mode 100644 index 00000000000..e5641af7a0d --- /dev/null +++ b/PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatchingSubXicToXiPiPiCharged.cxx @@ -0,0 +1,50 @@ +// 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. + +// substructure matching event-wise subtracted XicToXiPiPi charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/Substructure/jetSubstructureMatchingSub.cxx" + +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/DataModel/JetReducedData.h" +#include "PWGJE/DataModel/JetSubstructure.h" + +#include +#include +#include +#include +#include + +#include + +using XicToXiPiPiChargedJetSubstructureMatchingSub = JetSubstructureMatchingSub, + soa::Join, + aod::XicToXiPiPiChargedSPsMatchedToXicToXiPiPiChargedEventWiseSubtractedSPs, + aod::XicToXiPiPiChargedEventWiseSubtractedSPsMatchedToXicToXiPiPiChargedSPs, + aod::XicToXiPiPiChargedPRsMatchedToXicToXiPiPiChargedEventWiseSubtractedPRs, + aod::XicToXiPiPiChargedEventWiseSubtractedPRsMatchedToXicToXiPiPiChargedPRs, + aod::XicToXiPiPiChargedSPs, + aod::XicToXiPiPiChargedEventWiseSubtractedSPs, + aod::XicToXiPiPiChargedPRs, + aod::XicToXiPiPiChargedEventWiseSubtractedPRs, + aod::CandidatesXicToXiPiPiData, + aod::JetTracks, + aod::JetTracksSubXicToXiPiPi, + aod::JDummys>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-substructure-matching-sub-xictoxipipi-ch"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/jetMatchingMCDsCharged.cxx b/PWGJE/TableProducer/Matching/jetMatchingMCDsCharged.cxx new file mode 100644 index 00000000000..df7a49e8940 --- /dev/null +++ b/PWGJE/TableProducer/Matching/jetMatchingMCDsCharged.cxx @@ -0,0 +1,42 @@ +// 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. + +// jet matching mc Ds charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/jetMatchingMC.cxx" + +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/DataModel/JetReducedData.h" + +#include +#include +#include +#include +#include + +#include + +using DsChargedJetMatchingMC = JetMatchingMc, + soa::Join, + aod::DsChargedMCDetectorLevelJetsMatchedToDsChargedMCParticleLevelJets, + aod::DsChargedMCParticleLevelJetsMatchedToDsChargedMCDetectorLevelJets, + aod::CandidatesDsMCD, + aod::CandidatesDsMCP, + aod::JDummys>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-ds-ch"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/jetMatchingMCSubDsCharged.cxx b/PWGJE/TableProducer/Matching/jetMatchingMCSubDsCharged.cxx new file mode 100644 index 00000000000..2fa5d9f74d9 --- /dev/null +++ b/PWGJE/TableProducer/Matching/jetMatchingMCSubDsCharged.cxx @@ -0,0 +1,39 @@ +// 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. + +// jet matching mc subtracted Ds charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/jetMatchingMCSub.cxx" + +#include "PWGJE/DataModel/Jet.h" + +#include +#include +#include +#include +#include + +#include + +using DsChargedJetMatchingMCSub = JetMatchingMcSub, + soa::Join, + aod::DsChargedMCDetectorLevelJetsMatchedToDsChargedMCDetectorLevelEventWiseSubtractedJets, + aod::DsChargedMCDetectorLevelEventWiseSubtractedJetsMatchedToDsChargedMCDetectorLevelJets, + aod::CandidatesDsMCD>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-sub-ds-ch"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/jetMatchingMCSubXicToXiPiPiCharged.cxx b/PWGJE/TableProducer/Matching/jetMatchingMCSubXicToXiPiPiCharged.cxx new file mode 100644 index 00000000000..595be4a2124 --- /dev/null +++ b/PWGJE/TableProducer/Matching/jetMatchingMCSubXicToXiPiPiCharged.cxx @@ -0,0 +1,39 @@ +// 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. + +// jet matching mc subtracted XicToXiPiPi charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/jetMatchingMCSub.cxx" + +#include "PWGJE/DataModel/Jet.h" + +#include +#include +#include +#include +#include + +#include + +using XicToXiPiPiChargedJetMatchingMCSub = JetMatchingMcSub, + soa::Join, + aod::XicToXiPiPiChargedMCDetectorLevelJetsMatchedToXicToXiPiPiChargedMCDetectorLevelEventWiseSubtractedJets, + aod::XicToXiPiPiChargedMCDetectorLevelEventWiseSubtractedJetsMatchedToXicToXiPiPiChargedMCDetectorLevelJets, + aod::CandidatesXicToXiPiPiMCD>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-sub-xictoxipipi-ch"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/jetMatchingMCXicToXiPiPiCharged.cxx b/PWGJE/TableProducer/Matching/jetMatchingMCXicToXiPiPiCharged.cxx new file mode 100644 index 00000000000..1d14c10bef6 --- /dev/null +++ b/PWGJE/TableProducer/Matching/jetMatchingMCXicToXiPiPiCharged.cxx @@ -0,0 +1,42 @@ +// 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. + +// jet matching mc XicToXiPiPi charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/jetMatchingMC.cxx" + +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/DataModel/JetReducedData.h" + +#include +#include +#include +#include +#include + +#include + +using XicToXiPiPiChargedJetMatchingMC = JetMatchingMc, + soa::Join, + aod::XicToXiPiPiChargedMCDetectorLevelJetsMatchedToXicToXiPiPiChargedMCParticleLevelJets, + aod::XicToXiPiPiChargedMCParticleLevelJetsMatchedToXicToXiPiPiChargedMCDetectorLevelJets, + aod::CandidatesXicToXiPiPiMCD, + aod::CandidatesXicToXiPiPiMCP, + aod::JDummys>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-xictoxipipi-ch"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/jetMatchingSubDsCharged.cxx b/PWGJE/TableProducer/Matching/jetMatchingSubDsCharged.cxx new file mode 100644 index 00000000000..d08dd8e6155 --- /dev/null +++ b/PWGJE/TableProducer/Matching/jetMatchingSubDsCharged.cxx @@ -0,0 +1,41 @@ +// 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. + +// jet matching subtracted Ds charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/jetMatchingSub.cxx" + +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/DataModel/JetSubtraction.h" + +#include +#include +#include +#include +#include + +#include + +using DsChargedJetMatchingSub = JetMatchingSub, + soa::Join, + aod::DsChargedJetsMatchedToDsChargedEventWiseSubtractedJets, + aod::DsChargedEventWiseSubtractedJetsMatchedToDsChargedJets, + aod::JTrackDsSubs, + aod::CandidatesDsData>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-sub-ds-ch"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/Matching/jetMatchingSubXicToXiPiPiCharged.cxx b/PWGJE/TableProducer/Matching/jetMatchingSubXicToXiPiPiCharged.cxx new file mode 100644 index 00000000000..a2efd7f0cde --- /dev/null +++ b/PWGJE/TableProducer/Matching/jetMatchingSubXicToXiPiPiCharged.cxx @@ -0,0 +1,41 @@ +// 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. + +// jet matching subtracted XicToXiPiPi charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/TableProducer/Matching/jetMatchingSub.cxx" + +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/DataModel/JetSubtraction.h" + +#include +#include +#include +#include +#include + +#include + +using XicToXiPiPiChargedJetMatchingSub = JetMatchingSub, + soa::Join, + aod::XicToXiPiPiChargedJetsMatchedToXicToXiPiPiChargedEventWiseSubtractedJets, + aod::XicToXiPiPiChargedEventWiseSubtractedJetsMatchedToXicToXiPiPiChargedJets, + aod::JTrackXicToXiPiPiSubs, + aod::CandidatesXicToXiPiPiData>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-sub-xictoxipipi-ch"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/derivedDataProducer.cxx b/PWGJE/TableProducer/derivedDataProducer.cxx index 045c2648acd..c3de10e5e90 100644 --- a/PWGJE/TableProducer/derivedDataProducer.cxx +++ b/PWGJE/TableProducer/derivedDataProducer.cxx @@ -100,6 +100,10 @@ struct JetDerivedDataProducerTask { Produces jDplusMcCollisionIdsTable; Produces jDplusIdsTable; Produces jDplusParticleIdsTable; + Produces jDsCollisionIdsTable; + Produces jDsMcCollisionIdsTable; + Produces jDsIdsTable; + Produces jDsParticleIdsTable; Produces jDstarCollisionIdsTable; Produces jDstarMcCollisionIdsTable; Produces jDstarIdsTable; @@ -116,6 +120,10 @@ struct JetDerivedDataProducerTask { Produces jBplusMcCollisionIdsTable; Produces jBplusIdsTable; Produces jBplusParticleIdsTable; + Produces jXicToXiPiPiCollisionIdsTable; + Produces jXicToXiPiPiMcCollisionIdsTable; + Produces jXicToXiPiPiIdsTable; + Produces jXicToXiPiPiParticleIdsTable; Produces jV0IdsTable; Produces jV0McCollisionsTable; Produces jV0McCollisionIdsTable; @@ -542,6 +550,38 @@ struct JetDerivedDataProducerTask { } PROCESS_SWITCH(JetDerivedDataProducerTask, processDplusMC, "produces derived index for Dplus particles", false); + void processDsCollisions(aod::HfDsCollIds::iterator const& DsCollision) + { + products.jDsCollisionIdsTable(DsCollision.collisionId()); + } + PROCESS_SWITCH(JetDerivedDataProducerTask, processDsCollisions, "produces derived index for Ds collisions", false); + + void processDsMcCollisions(aod::HfDsMcCollIds::iterator const& DsMcCollision) + { + products.jDsMcCollisionIdsTable(DsMcCollision.mcCollisionId()); + } + PROCESS_SWITCH(JetDerivedDataProducerTask, processDsMcCollisions, "produces derived index for Ds MC collisions", false); + + void processDs(aod::HfDsIds::iterator const& DsCandidate, aod::Tracks const&) + { + auto JProng0ID = trackCollisionMapping.find({DsCandidate.prong0Id(), DsCandidate.prong0_as().collisionId()}); + auto JProng1ID = trackCollisionMapping.find({DsCandidate.prong1Id(), DsCandidate.prong1_as().collisionId()}); + auto JProng2ID = trackCollisionMapping.find({DsCandidate.prong2Id(), DsCandidate.prong2_as().collisionId()}); + if (withCollisionAssociator) { + JProng0ID = trackCollisionMapping.find({DsCandidate.prong0Id(), DsCandidate.collisionId()}); + JProng1ID = trackCollisionMapping.find({DsCandidate.prong1Id(), DsCandidate.collisionId()}); + JProng2ID = trackCollisionMapping.find({DsCandidate.prong2Id(), DsCandidate.collisionId()}); + } + products.jDsIdsTable(DsCandidate.collisionId(), JProng0ID->second, JProng1ID->second, JProng2ID->second); + } + PROCESS_SWITCH(JetDerivedDataProducerTask, processDs, "produces derived index for Ds candidates", false); + + void processDsMC(aod::HfDsPIds::iterator const& DsParticle) + { + products.jDsParticleIdsTable(DsParticle.mcCollisionId(), DsParticle.mcParticleId()); + } + PROCESS_SWITCH(JetDerivedDataProducerTask, processDsMC, "produces derived index for Ds particles", false); + void processDstarCollisions(aod::HfDstarCollIds::iterator const& DstarCollision) { products.jDstarCollisionIdsTable(DstarCollision.collisionId()); @@ -672,6 +712,42 @@ struct JetDerivedDataProducerTask { } PROCESS_SWITCH(JetDerivedDataProducerTask, processBplusMC, "produces derived index for Bplus particles", false); + void processXicToXiPiPiCollisions(aod::HfXicToXiPiPiCollIds::iterator const& XicToXiPiPiCollision) + { + products.jXicToXiPiPiCollisionIdsTable(XicToXiPiPiCollision.collisionId()); + } + PROCESS_SWITCH(JetDerivedDataProducerTask, processXicToXiPiPiCollisions, "produces derived index for XicToXiPiPi collisions", false); + + void processXicToXiPiPiMcCollisions(aod::HfXicToXiPiPiMcCollIds::iterator const& XicToXiPiPiMcCollision) + { + products.jXicToXiPiPiMcCollisionIdsTable(XicToXiPiPiMcCollision.mcCollisionId()); + } + PROCESS_SWITCH(JetDerivedDataProducerTask, processXicToXiPiPiMcCollisions, "produces derived index for XicToXiPiPi MC collisions", false); + + void processXicToXiPiPi(aod::HfXicToXiPiPiIds::iterator const& XicToXiPiPiCandidate, aod::Tracks const&) + { + auto JProng0ID = trackCollisionMapping.find({XicToXiPiPiCandidate.prong0Id(), XicToXiPiPiCandidate.prong0_as().collisionId()}); + auto JProng1ID = trackCollisionMapping.find({XicToXiPiPiCandidate.prong1Id(), XicToXiPiPiCandidate.prong1_as().collisionId()}); + auto JProng2ID = trackCollisionMapping.find({XicToXiPiPiCandidate.prong2Id(), XicToXiPiPiCandidate.prong2_as().collisionId()}); + auto JProng3ID = trackCollisionMapping.find({XicToXiPiPiCandidate.prong3Id(), XicToXiPiPiCandidate.prong3_as().collisionId()}); + auto JProng4ID = trackCollisionMapping.find({XicToXiPiPiCandidate.prong4Id(), XicToXiPiPiCandidate.prong4_as().collisionId()}); + if (withCollisionAssociator) { + JProng0ID = trackCollisionMapping.find({XicToXiPiPiCandidate.prong0Id(), XicToXiPiPiCandidate.collisionId()}); + JProng1ID = trackCollisionMapping.find({XicToXiPiPiCandidate.prong1Id(), XicToXiPiPiCandidate.collisionId()}); + JProng2ID = trackCollisionMapping.find({XicToXiPiPiCandidate.prong2Id(), XicToXiPiPiCandidate.collisionId()}); + JProng3ID = trackCollisionMapping.find({XicToXiPiPiCandidate.prong3Id(), XicToXiPiPiCandidate.collisionId()}); + JProng4ID = trackCollisionMapping.find({XicToXiPiPiCandidate.prong4Id(), XicToXiPiPiCandidate.collisionId()}); + } + products.jXicToXiPiPiIdsTable(XicToXiPiPiCandidate.collisionId(), JProng0ID->second, JProng1ID->second, JProng2ID->second, JProng3ID->second, JProng4ID->second); + } + PROCESS_SWITCH(JetDerivedDataProducerTask, processXicToXiPiPi, "produces derived index for XicToXiPiPi candidates", false); + + void processXicToXiPiPiMC(aod::HfXicToXiPiPiPIds::iterator const& XicToXiPiPiParticle) + { + products.jXicToXiPiPiParticleIdsTable(XicToXiPiPiParticle.mcCollisionId(), XicToXiPiPiParticle.mcParticleId()); + } + PROCESS_SWITCH(JetDerivedDataProducerTask, processXicToXiPiPiMC, "produces derived index for XicToXiPiPi particles", false); + void processV0(aod::V0Indices::iterator const& V0Candidate, aod::Tracks const&) { auto JPosTrackID = trackCollisionMapping.find({V0Candidate.posTrackId(), V0Candidate.posTrack_as().collisionId()}); diff --git a/PWGJE/TableProducer/derivedDataSelector.cxx b/PWGJE/TableProducer/derivedDataSelector.cxx index 9e04a6332b4..215f56b00eb 100644 --- a/PWGJE/TableProducer/derivedDataSelector.cxx +++ b/PWGJE/TableProducer/derivedDataSelector.cxx @@ -60,6 +60,9 @@ struct JetDerivedDataSelector { Configurable thresholdChargedDplusJetPtMin{"thresholdChargedDplusJetPtMin", 0.0, "Minimum charged Dplus jet pt to accept event"}; Configurable thresholdChargedEventWiseSubtractedDplusJetPtMin{"thresholdChargedEventWiseSubtractedDplusJetPtMin", 0.0, "Minimum charged event-wise subtracted Dplus jet pt to accept event"}; Configurable thresholdChargedDplusMCPJetPtMin{"thresholdChargedDplusMCPJetPtMin", 0.0, "Minimum charged Dplus mcp jet pt to accept event"}; + Configurable thresholdChargedDsJetPtMin{"thresholdChargedDsJetPtMin", 0.0, "Minimum charged Ds jet pt to accept event"}; + Configurable thresholdChargedEventWiseSubtractedDsJetPtMin{"thresholdChargedEventWiseSubtractedDsJetPtMin", 0.0, "Minimum charged event-wise subtracted Ds jet pt to accept event"}; + Configurable thresholdChargedDsMCPJetPtMin{"thresholdChargedDsMCPJetPtMin", 0.0, "Minimum charged Ds mcp jet pt to accept event"}; Configurable thresholdChargedDstarJetPtMin{"thresholdChargedDstarJetPtMin", 0.0, "Minimum charged Dstar jet pt to accept event"}; Configurable thresholdChargedEventWiseSubtractedDstarJetPtMin{"thresholdChargedEventWiseSubtractedDstarJetPtMin", 0.0, "Minimum charged event-wise subtracted Dstar jet pt to accept event"}; Configurable thresholdChargedDstarMCPJetPtMin{"thresholdChargedDstarMCPJetPtMin", 0.0, "Minimum charged Dstar mcp jet pt to accept event"}; @@ -72,6 +75,9 @@ struct JetDerivedDataSelector { Configurable thresholdChargedBplusJetPtMin{"thresholdChargedBplusJetPtMin", 0.0, "Minimum charged Bplus jet pt to accept event"}; Configurable thresholdChargedEventWiseSubtractedBplusJetPtMin{"thresholdChargedEventWiseSubtractedBplusJetPtMin", 0.0, "Minimum charged event-wise subtracted Bplus jet pt to accept event"}; Configurable thresholdChargedBplusMCPJetPtMin{"thresholdChargedBplusMCPJetPtMin", 0.0, "Minimum charged Bplus mcp jet pt to accept event"}; + Configurable thresholdChargedXicToXiPiPiJetPtMin{"thresholdChargedXicToXiPiPiJetPtMin", 0.0, "Minimum charged XicToXiPiPi jet pt to accept event"}; + Configurable thresholdChargedEventWiseSubtractedXicToXiPiPiJetPtMin{"thresholdChargedEventWiseSubtractedXicToXiPiPiJetPtMin", 0.0, "Minimum charged event-wise subtracted XicToXiPiPi jet pt to accept event"}; + Configurable thresholdChargedXicToXiPiPiMCPJetPtMin{"thresholdChargedXicToXiPiPiMCPJetPtMin", 0.0, "Minimum charged XicToXiPiPi mcp jet pt to accept event"}; Configurable thresholdChargedDielectronJetPtMin{"thresholdChargedDielectronJetPtMin", 0.0, "Minimum charged Dielectron jet pt to accept event"}; Configurable thresholdChargedEventWiseSubtractedDielectronJetPtMin{"thresholdChargedEventWiseSubtractedDielectronJetPtMin", 0.0, "Minimum charged event-wise subtracted Dielectron jet pt to accept event"}; Configurable thresholdChargedDielectronMCPJetPtMin{"thresholdChargedDielectronMCPJetPtMin", 0.0, "Minimum charged Dielectron mcp jet pt to accept event"}; @@ -218,6 +224,12 @@ struct JetDerivedDataSelector { selectionObjectPtMin = config.thresholdChargedEventWiseSubtractedDplusJetPtMin; } else if constexpr (std::is_same_v, aod::DplusChargedMCParticleLevelJets>) { selectionObjectPtMin = config.thresholdChargedDplusMCPJetPtMin; + } else if constexpr (std::is_same_v, aod::DsChargedJets> || std::is_same_v, aod::DsChargedMCDetectorLevelJets>) { + selectionObjectPtMin = config.thresholdChargedDsJetPtMin; + } else if constexpr (std::is_same_v, aod::DsChargedEventWiseSubtractedJets> || std::is_same_v, aod::DsChargedMCDetectorLevelEventWiseSubtractedJets>) { + selectionObjectPtMin = config.thresholdChargedEventWiseSubtractedDsJetPtMin; + } else if constexpr (std::is_same_v, aod::DsChargedMCParticleLevelJets>) { + selectionObjectPtMin = config.thresholdChargedDsMCPJetPtMin; } else if constexpr (std::is_same_v, aod::DstarChargedJets> || std::is_same_v, aod::DstarChargedMCDetectorLevelJets>) { selectionObjectPtMin = config.thresholdChargedDstarJetPtMin; } else if constexpr (std::is_same_v, aod::DstarChargedEventWiseSubtractedJets> || std::is_same_v, aod::DstarChargedMCDetectorLevelEventWiseSubtractedJets>) { @@ -242,6 +254,12 @@ struct JetDerivedDataSelector { selectionObjectPtMin = config.thresholdChargedEventWiseSubtractedBplusJetPtMin; } else if constexpr (std::is_same_v, aod::BplusChargedMCParticleLevelJets>) { selectionObjectPtMin = config.thresholdChargedBplusMCPJetPtMin; + } else if constexpr (std::is_same_v, aod::XicToXiPiPiChargedJets> || std::is_same_v, aod::XicToXiPiPiChargedMCDetectorLevelJets>) { + selectionObjectPtMin = config.thresholdChargedXicToXiPiPiJetPtMin; + } else if constexpr (std::is_same_v, aod::XicToXiPiPiChargedEventWiseSubtractedJets> || std::is_same_v, aod::XicToXiPiPiChargedMCDetectorLevelEventWiseSubtractedJets>) { + selectionObjectPtMin = config.thresholdChargedEventWiseSubtractedXicToXiPiPiJetPtMin; + } else if constexpr (std::is_same_v, aod::XicToXiPiPiChargedMCParticleLevelJets>) { + selectionObjectPtMin = config.thresholdChargedXicToXiPiPiMCPJetPtMin; } else if constexpr (std::is_same_v, aod::DielectronChargedJets> || std::is_same_v, aod::DielectronChargedMCDetectorLevelJets>) { selectionObjectPtMin = config.thresholdChargedDielectronJetPtMin; } else if constexpr (std::is_same_v, aod::DielectronChargedEventWiseSubtractedJets> || std::is_same_v, aod::DielectronChargedMCDetectorLevelEventWiseSubtractedJets>) { @@ -275,7 +293,7 @@ struct JetDerivedDataSelector { } } if (isTriggerObject) { - if constexpr (std::is_same_v, aod::ChargedMCParticleLevelJets> || std::is_same_v, aod::NeutralMCParticleLevelJets> || std::is_same_v, aod::FullMCParticleLevelJets> || std::is_same_v, aod::D0ChargedMCParticleLevelJets> || std::is_same_v, aod::DplusChargedMCParticleLevelJets> || std::is_same_v, aod::DstarChargedMCParticleLevelJets> || std::is_same_v, aod::LcChargedMCParticleLevelJets> || std::is_same_v, aod::B0ChargedMCParticleLevelJets> || std::is_same_v, aod::BplusChargedMCParticleLevelJets> || std::is_same_v, aod::DielectronChargedMCParticleLevelJets>) { + if constexpr (std::is_same_v, aod::ChargedMCParticleLevelJets> || std::is_same_v, aod::NeutralMCParticleLevelJets> || std::is_same_v, aod::FullMCParticleLevelJets> || std::is_same_v, aod::D0ChargedMCParticleLevelJets> || std::is_same_v, aod::DplusChargedMCParticleLevelJets> || std::is_same_v, aod::DsChargedMCParticleLevelJets> || std::is_same_v, aod::DstarChargedMCParticleLevelJets> || std::is_same_v, aod::LcChargedMCParticleLevelJets> || std::is_same_v, aod::B0ChargedMCParticleLevelJets> || std::is_same_v, aod::BplusChargedMCParticleLevelJets> || std::is_same_v, aod::XicToXiPiPiChargedMCParticleLevelJets> || std::is_same_v, aod::DielectronChargedMCParticleLevelJets>) { if (selectionObject.mcCollisionId() >= 0) { McCollisionFlag[selectionObject.mcCollisionId()] = true; } @@ -314,6 +332,11 @@ struct JetDerivedDataSelector { PROCESS_SWITCH_FULL(JetDerivedDataSelector, processSelectionObjects, processSelectingDplusChargedMCDJets, "process Dplus charged mcd jets", false); PROCESS_SWITCH_FULL(JetDerivedDataSelector, processSelectionObjects, processSelectingDplusChargedMCDetectorLevelEventWiseSubtractedJets, "process Dplus event-wise subtracted charged mcd jets", false); PROCESS_SWITCH_FULL(JetDerivedDataSelector, processSelectionObjects, processSelectingDplusChargedMCPJets, "process Dplus charged mcp jets", false); + PROCESS_SWITCH_FULL(JetDerivedDataSelector, processSelectionObjects, processSelectingDsChargedJets, "process Ds charged jets", false); + PROCESS_SWITCH_FULL(JetDerivedDataSelector, processSelectionObjects, processSelectingDsChargedEventWiseSubtractedJets, "process Ds event-wise subtracted charged jets", false); + PROCESS_SWITCH_FULL(JetDerivedDataSelector, processSelectionObjects, processSelectingDsChargedMCDJets, "process Ds charged mcd jets", false); + PROCESS_SWITCH_FULL(JetDerivedDataSelector, processSelectionObjects, processSelectingDsChargedMCDetectorLevelEventWiseSubtractedJets, "process Ds event-wise subtracted charged mcd jets", false); + PROCESS_SWITCH_FULL(JetDerivedDataSelector, processSelectionObjects, processSelectingDsChargedMCPJets, "process Ds charged mcp jets", false); PROCESS_SWITCH_FULL(JetDerivedDataSelector, processSelectionObjects, processSelectingDstarChargedJets, "process Dstar charged jets", false); PROCESS_SWITCH_FULL(JetDerivedDataSelector, processSelectionObjects, processSelectingDstarChargedEventWiseSubtractedJets, "process Dstar event-wise subtracted charged jets", false); PROCESS_SWITCH_FULL(JetDerivedDataSelector, processSelectionObjects, processSelectingDstarChargedMCDJets, "process Dstar charged mcd jets", false); @@ -334,6 +357,11 @@ struct JetDerivedDataSelector { PROCESS_SWITCH_FULL(JetDerivedDataSelector, processSelectionObjects, processSelectingBplusChargedMCDJets, "process Bplus charged mcd jets", false); PROCESS_SWITCH_FULL(JetDerivedDataSelector, processSelectionObjects, processSelectingBplusChargedMCDetectorLevelEventWiseSubtractedJets, "process Bplus event-wise subtracted charged mcd jets", false); PROCESS_SWITCH_FULL(JetDerivedDataSelector, processSelectionObjects, processSelectingBplusChargedMCPJets, "process Bplus charged mcp jets", false); + PROCESS_SWITCH_FULL(JetDerivedDataSelector, processSelectionObjects, processSelectingXicToXiPiPiChargedJets, "process XicToXiPiPi charged jets", false); + PROCESS_SWITCH_FULL(JetDerivedDataSelector, processSelectionObjects, processSelectingXicToXiPiPiChargedEventWiseSubtractedJets, "process XicToXiPiPi event-wise subtracted charged jets", false); + PROCESS_SWITCH_FULL(JetDerivedDataSelector, processSelectionObjects, processSelectingXicToXiPiPiChargedMCDJets, "process XicToXiPiPi charged mcd jets", false); + PROCESS_SWITCH_FULL(JetDerivedDataSelector, processSelectionObjects, processSelectingXicToXiPiPiChargedMCDetectorLevelEventWiseSubtractedJets, "process XicToXiPiPi event-wise subtracted charged mcd jets", false); + PROCESS_SWITCH_FULL(JetDerivedDataSelector, processSelectionObjects, processSelectingXicToXiPiPiChargedMCPJets, "process XicToXiPiPi charged mcp jets", false); PROCESS_SWITCH_FULL(JetDerivedDataSelector, processSelectionObjects, processSelectingDielectronChargedJets, "process Dielectron charged jets", false); PROCESS_SWITCH_FULL(JetDerivedDataSelector, processSelectionObjects, processSelectingDielectronChargedEventWiseSubtractedJets, "process Dielectron event-wise subtracted charged jets", false); PROCESS_SWITCH_FULL(JetDerivedDataSelector, processSelectionObjects, processSelectingDielectronChargedMCDJets, "process Dielectron charged mcd jets", false); diff --git a/PWGJE/TableProducer/derivedDataWriter.cxx b/PWGJE/TableProducer/derivedDataWriter.cxx index d583250d49f..0a73a14b24b 100644 --- a/PWGJE/TableProducer/derivedDataWriter.cxx +++ b/PWGJE/TableProducer/derivedDataWriter.cxx @@ -120,6 +120,25 @@ struct JetDerivedDataWriter { Produces storedDplusParticleIdsTable; } productsDplus; + struct : ProducesGroup { + Produces storedDsCollisionsTable; + Produces storedDsCollisionIdsTable; + Produces storedDssTable; + Produces storedDsParsTable; + Produces storedDsParExtrasTable; + Produces storedDsParDaughtersDummyTable; + Produces storedDsSelsTable; + Produces storedDsMlsTable; + Produces storedDsMlDughtersDummyTable; + Produces storedDsMcsTable; + Produces storedDsIdsTable; + Produces storedDsMcCollisionsTable; + Produces storedDsMcCollisionIdsTable; + Produces storedDsMcCollisionsMatchingTable; + Produces storedDsParticlesTable; + Produces storedDsParticleIdsTable; + } productsDs; + struct : ProducesGroup { Produces storedDstarCollisionsTable; Produces storedDstarCollisionIdsTable; @@ -196,6 +215,25 @@ struct JetDerivedDataWriter { Produces storedBplusParticleIdsTable; } productsBplus; + struct : ProducesGroup { + Produces storedXicToXiPiPiCollisionsTable; + Produces storedXicToXiPiPiCollisionIdsTable; + Produces storedXicToXiPiPisTable; + Produces storedXicToXiPiPiParsTable; + Produces storedXicToXiPiPiParExtrasTable; + Produces storedXicToXiPiPiParDaughtersDummyTable; + Produces storedXicToXiPiPiSelsTable; + Produces storedXicToXiPiPiMlsTable; + Produces storedXicToXiPiPiMlDughtersDummyTable; + Produces storedXicToXiPiPiMcsTable; + Produces storedXicToXiPiPiIdsTable; + Produces storedXicToXiPiPiMcCollisionsTable; + Produces storedXicToXiPiPiMcCollisionIdsTable; + Produces storedXicToXiPiPiMcCollisionsMatchingTable; + Produces storedXicToXiPiPiParticlesTable; + Produces storedXicToXiPiPiParticleIdsTable; + } productsXicToXiPiPi; + struct : ProducesGroup { Produces storedDielectronCollisionsTable; Produces storedDielectronCollisionIdsTable; @@ -216,17 +254,21 @@ struct JetDerivedDataWriter { Preslice> ParticlesPerMcCollision = aod::jmcparticle::mcCollisionId; Preslice D0McCollisionsPerMcCollision = aod::jcandidateindices::mcCollisionId; Preslice DplusMcCollisionsPerMcCollision = aod::jcandidateindices::mcCollisionId; + Preslice DsMcCollisionsPerMcCollision = aod::jcandidateindices::mcCollisionId; Preslice DstarMcCollisionsPerMcCollision = aod::jcandidateindices::mcCollisionId; Preslice LcMcCollisionsPerMcCollision = aod::jcandidateindices::mcCollisionId; Preslice B0McCollisionsPerMcCollision = aod::jcandidateindices::mcCollisionId; Preslice BplusMcCollisionsPerMcCollision = aod::jcandidateindices::mcCollisionId; + Preslice XicToXiPiPiMcCollisionsPerMcCollision = aod::jcandidateindices::mcCollisionId; Preslice DielectronMcCollisionsPerMcCollision = aod::jcandidateindices::mcCollisionId; Preslice D0ParticlesPerMcCollision = aod::jcandidateindices::mcCollisionId; Preslice DplusParticlesPerMcCollision = aod::jcandidateindices::mcCollisionId; + Preslice DsParticlesPerMcCollision = aod::jcandidateindices::mcCollisionId; Preslice DstarParticlesPerMcCollision = aod::jcandidateindices::mcCollisionId; Preslice LcParticlesPerMcCollision = aod::jcandidateindices::mcCollisionId; Preslice B0ParticlesPerMcCollision = aod::jcandidateindices::mcCollisionId; Preslice BplusParticlesPerMcCollision = aod::jcandidateindices::mcCollisionId; + Preslice XicToXiPiPiParticlesPerMcCollision = aod::jcandidateindices::mcCollisionId; PresliceUnsorted EMCTrackPerTrack = aod::jemctrack::trackId; } preslices; @@ -282,6 +324,21 @@ struct JetDerivedDataWriter { } } + template + void storeDs(soa::Join::iterator const& collision, aod::JTracks const&, aod::CollisionsDs const& DsCollisions, T const& DsCandidates) + { + if (collision.isCollisionSelected()) { + for (const auto& DsCollision : DsCollisions) { // should only ever be one + jethfutilities::fillHFCollisionTable(DsCollision, products.productsDs.storedDsCollisionsTable); + products.productsDs.storedDsCollisionIdsTable(collisionMapping[collision.globalIndex()]); + } + for (const auto& DsCandidate : DsCandidates) { + jethfutilities::fillHFCandidateTable(DsCandidate, products.productsDs.storedDsCollisionsTable.lastIndex(), products.productsDs.storedDssTable, products.productsDs.storedDsParsTable, products.productsDs.storedDsParExtrasTable, products.productsDs.storedDsParDaughtersDummyTable, products.productsDs.storedDsSelsTable, products.productsDs.storedDsMlsTable, products.productsDs.storedDsMlDughtersDummyTable, products.productsDs.storedDsMcsTable); + products.productsDs.storedDsIdsTable(collisionMapping[collision.globalIndex()], trackMapping[DsCandidate.prong0Id()], trackMapping[DsCandidate.prong1Id()], trackMapping[DsCandidate.prong2Id()]); + } + } + } + template void storeDstar(soa::Join::iterator const& collision, aod::JTracks const&, aod::CollisionsDstar const& DstarCollisions, T const& DstarCandidates) { @@ -343,6 +400,21 @@ struct JetDerivedDataWriter { } } + template + void storeXicToXiPiPi(soa::Join::iterator const& collision, aod::JTracks const&, aod::CollisionsXicToXiPiPi const& XicToXiPiPiCollisions, T const& XicToXiPiPiCandidates) + { + if (collision.isCollisionSelected()) { + for (const auto& XicToXiPiPiCollision : XicToXiPiPiCollisions) { // should only ever be one + jethfutilities::fillHFCollisionTable(XicToXiPiPiCollision, products.productsXicToXiPiPi.storedXicToXiPiPiCollisionsTable); + products.productsXicToXiPiPi.storedXicToXiPiPiCollisionIdsTable(collisionMapping[collision.globalIndex()]); + } + for (const auto& XicToXiPiPiCandidate : XicToXiPiPiCandidates) { + jethfutilities::fillHFCandidateTable(XicToXiPiPiCandidate, products.productsXicToXiPiPi.storedXicToXiPiPiCollisionsTable.lastIndex(), products.productsXicToXiPiPi.storedXicToXiPiPisTable, products.productsXicToXiPiPi.storedXicToXiPiPiParsTable, products.productsXicToXiPiPi.storedXicToXiPiPiParExtrasTable, products.productsXicToXiPiPi.storedXicToXiPiPiParDaughtersDummyTable, products.productsXicToXiPiPi.storedXicToXiPiPiSelsTable, products.productsXicToXiPiPi.storedXicToXiPiPiMlsTable, products.productsXicToXiPiPi.storedXicToXiPiPiMlDughtersDummyTable, products.productsXicToXiPiPi.storedXicToXiPiPiMcsTable); + products.productsXicToXiPiPi.storedXicToXiPiPiIdsTable(collisionMapping[collision.globalIndex()], trackMapping[XicToXiPiPiCandidate.prong0Id()], trackMapping[XicToXiPiPiCandidate.prong1Id()], trackMapping[XicToXiPiPiCandidate.prong2Id()], trackMapping[XicToXiPiPiCandidate.prong3Id()], trackMapping[XicToXiPiPiCandidate.prong4Id()]); + } + } + } + void processDummyTable(aod::JDummys const&) { products.storedJDummysTable(1); @@ -474,6 +546,18 @@ struct JetDerivedDataWriter { } PROCESS_SWITCH(JetDerivedDataWriter, processDplusMCD, "write out mcd output tables for Dplus", false); + void processDsData(soa::Join::iterator const& collision, aod::JTracks const& tracks, aod::CollisionsDs const& DsCollisions, aod::CandidatesDsData const& DsCandidates) + { + storeDs(collision, tracks, DsCollisions, DsCandidates); + } + PROCESS_SWITCH(JetDerivedDataWriter, processDsData, "write out data output tables for Ds", false); + + void processDsMCD(soa::Join::iterator const& collision, aod::JTracks const& tracks, aod::CollisionsDs const& DsCollisions, aod::CandidatesDsMCD const& DsCandidates) + { + storeDs(collision, tracks, DsCollisions, DsCandidates); + } + PROCESS_SWITCH(JetDerivedDataWriter, processDsMCD, "write out mcd output tables for Ds", false); + void processDstarData(soa::Join::iterator const& collision, aod::JTracks const& tracks, aod::CollisionsDstar const& DstarCollisions, aod::CandidatesDstarData const& DstarCandidates) { storeDstar(collision, tracks, DstarCollisions, DstarCandidates); @@ -522,6 +606,18 @@ struct JetDerivedDataWriter { } PROCESS_SWITCH(JetDerivedDataWriter, processBplusMCD, "write out mcd output tables for bplus", false); + void processXicToXiPiPiData(soa::Join::iterator const& collision, aod::JTracks const& tracks, aod::CollisionsXicToXiPiPi const& XicToXiPiPiCollisions, aod::CandidatesXicToXiPiPiData const& XicToXiPiPiCandidates) + { + storeXicToXiPiPi(collision, tracks, XicToXiPiPiCollisions, XicToXiPiPiCandidates); + } + PROCESS_SWITCH(JetDerivedDataWriter, processXicToXiPiPiData, "write out data output tables for XicToXiPiPi", false); + + void processXicToXiPiPiMCD(soa::Join::iterator const& collision, aod::JTracks const& tracks, aod::CollisionsXicToXiPiPi const& XicToXiPiPiCollisions, aod::CandidatesXicToXiPiPiMCD const& XicToXiPiPiCandidates) + { + storeXicToXiPiPi(collision, tracks, XicToXiPiPiCollisions, XicToXiPiPiCandidates); + } + PROCESS_SWITCH(JetDerivedDataWriter, processXicToXiPiPiMCD, "write out mcd output tables for XicToXiPiPi", false); + void processDielectron(soa::Join::iterator const& collision, aod::JTracks const&, aod::CollisionsDielectron const& DielectronCollisions, aod::CandidatesDielectronData const& DielectronCandidates) { if (collision.isCollisionSelected()) { @@ -637,6 +733,28 @@ struct JetDerivedDataWriter { } PROCESS_SWITCH(JetDerivedDataWriter, processDplusMCP, "write out Dplus mcp output tables", false); + void processDsMCP(soa::Join const& mcCollisions, aod::McCollisionsDs const& DsMcCollisions, aod::CandidatesDsMCP const& DsParticles) + { + dplusMcCollisionMapping.clear(); + dplusMcCollisionMapping.resize(DsMcCollisions.size(), -1); + for (auto const& mcCollision : mcCollisions) { + if (mcCollision.isMcCollisionSelected()) { + const auto dplusMcCollisionsPerMcCollision = DsMcCollisions.sliceBy(preslices.DsMcCollisionsPerMcCollision, mcCollision.globalIndex()); + for (const auto& dplusMcCollisionPerMcCollision : dplusMcCollisionsPerMcCollision) { // should only ever be one + jethfutilities::fillHFMcCollisionTable(dplusMcCollisionPerMcCollision, products.productsDs.storedDsMcCollisionsTable); + products.productsDs.storedDsMcCollisionIdsTable(mcCollisionMapping[mcCollision.globalIndex()]); + dplusMcCollisionMapping[dplusMcCollisionPerMcCollision.globalIndex()] = products.productsDs.storedDsMcCollisionsTable.lastIndex(); + } + const auto dplusParticlesPerMcCollision = DsParticles.sliceBy(preslices.DsParticlesPerMcCollision, mcCollision.globalIndex()); + for (const auto& DsParticle : dplusParticlesPerMcCollision) { + jethfutilities::fillHFCandidateMcTable(DsParticle, products.productsDs.storedDsMcCollisionsTable.lastIndex(), products.productsDs.storedDsParticlesTable); + products.productsDs.storedDsParticleIdsTable(mcCollisionMapping[mcCollision.globalIndex()], particleMapping[DsParticle.mcParticleId()]); + } + } + } + } + PROCESS_SWITCH(JetDerivedDataWriter, processDsMCP, "write out Ds mcp output tables", false); + void processDstarMCP(soa::Join const& mcCollisions, aod::McCollisionsDstar const& DstarMcCollisions, aod::CandidatesDstarMCP const& DstarParticles) { dstarMcCollisionMapping.clear(); @@ -725,6 +843,28 @@ struct JetDerivedDataWriter { } PROCESS_SWITCH(JetDerivedDataWriter, processBplusMCP, "write out Bplus mcp output tables", false); + void processXicToXiPiPiMCP(soa::Join const& mcCollisions, aod::McCollisionsXicToXiPiPi const& XicToXiPiPiMcCollisions, aod::CandidatesXicToXiPiPiMCP const& XicToXiPiPiParticles) + { + dplusMcCollisionMapping.clear(); + dplusMcCollisionMapping.resize(XicToXiPiPiMcCollisions.size(), -1); + for (auto const& mcCollision : mcCollisions) { + if (mcCollision.isMcCollisionSelected()) { + const auto dplusMcCollisionsPerMcCollision = XicToXiPiPiMcCollisions.sliceBy(preslices.XicToXiPiPiMcCollisionsPerMcCollision, mcCollision.globalIndex()); + for (const auto& dplusMcCollisionPerMcCollision : dplusMcCollisionsPerMcCollision) { // should only ever be one + jethfutilities::fillHFMcCollisionTable(dplusMcCollisionPerMcCollision, products.productsXicToXiPiPi.storedXicToXiPiPiMcCollisionsTable); + products.productsXicToXiPiPi.storedXicToXiPiPiMcCollisionIdsTable(mcCollisionMapping[mcCollision.globalIndex()]); + dplusMcCollisionMapping[dplusMcCollisionPerMcCollision.globalIndex()] = products.productsXicToXiPiPi.storedXicToXiPiPiMcCollisionsTable.lastIndex(); + } + const auto dplusParticlesPerMcCollision = XicToXiPiPiParticles.sliceBy(preslices.XicToXiPiPiParticlesPerMcCollision, mcCollision.globalIndex()); + for (const auto& XicToXiPiPiParticle : dplusParticlesPerMcCollision) { + jethfutilities::fillHFCandidateMcTable(XicToXiPiPiParticle, products.productsXicToXiPiPi.storedXicToXiPiPiMcCollisionsTable.lastIndex(), products.productsXicToXiPiPi.storedXicToXiPiPiParticlesTable); + products.productsXicToXiPiPi.storedXicToXiPiPiParticleIdsTable(mcCollisionMapping[mcCollision.globalIndex()], particleMapping[XicToXiPiPiParticle.mcParticleId()]); + } + } + } + } + PROCESS_SWITCH(JetDerivedDataWriter, processXicToXiPiPiMCP, "write out XicToXiPiPi mcp output tables", false); + void processDielectronMCP(soa::Join::iterator const& mcCollision, aod::JMcParticles const&, soa::Join const& DielectronMcCollisions, aod::CandidatesDielectronMCP const& DielectronParticles) { if (mcCollision.isMcCollisionSelected()) { @@ -830,6 +970,20 @@ struct JetDerivedDataWriter { } PROCESS_SWITCH(JetDerivedDataWriter, processDplusMcCollisionMatch, "write out Dplus McCollision collision label output tables", false); + void processDsMcCollisionMatch(soa::Join::iterator const& mcCollision, soa::Join const& DsMcCollisions, aod::CollisionsDs const&) + { + if (mcCollision.isMcCollisionSelected()) { + for (const auto& DsMcCollision : DsMcCollisions) { // should just be one + std::vector dplusCollisionIDs; + for (auto const& dplusCollisionPerMcCollision : DsMcCollision.hfCollBases_as()) { + dplusCollisionIDs.push_back(dplusMcCollisionMapping[dplusCollisionPerMcCollision.globalIndex()]); + } + products.productsDs.storedDsMcCollisionsMatchingTable(dplusCollisionIDs); + } + } + } + PROCESS_SWITCH(JetDerivedDataWriter, processDsMcCollisionMatch, "write out Ds McCollision collision label output tables", false); + void processDstarMcCollisionMatch(soa::Join::iterator const& mcCollision, soa::Join const& DstarMcCollisions, aod::CollisionsDstar const&) { if (mcCollision.isMcCollisionSelected()) { @@ -885,6 +1039,20 @@ struct JetDerivedDataWriter { } } PROCESS_SWITCH(JetDerivedDataWriter, processBplusMcCollisionMatch, "write out Bplus McCollision collision label output tables", false); + + void processXicToXiPiPiMcCollisionMatch(soa::Join::iterator const& mcCollision, soa::Join const& XicToXiPiPiMcCollisions, aod::CollisionsXicToXiPiPi const&) + { + if (mcCollision.isMcCollisionSelected()) { + for (const auto& XicToXiPiPiMcCollision : XicToXiPiPiMcCollisions) { // should just be one + std::vector dplusCollisionIDs; + for (auto const& dplusCollisionPerMcCollision : XicToXiPiPiMcCollision.hfCollBases_as()) { + dplusCollisionIDs.push_back(dplusMcCollisionMapping[dplusCollisionPerMcCollision.globalIndex()]); + } + products.productsXicToXiPiPi.storedXicToXiPiPiMcCollisionsMatchingTable(dplusCollisionIDs); + } + } + } + PROCESS_SWITCH(JetDerivedDataWriter, processXicToXiPiPiMcCollisionMatch, "write out XicToXiPiPi McCollision collision label output tables", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGJE/TableProducer/eventwiseConstituentSubtractor.cxx b/PWGJE/TableProducer/eventwiseConstituentSubtractor.cxx index f840a339534..fb914aa0277 100644 --- a/PWGJE/TableProducer/eventwiseConstituentSubtractor.cxx +++ b/PWGJE/TableProducer/eventwiseConstituentSubtractor.cxx @@ -44,6 +44,8 @@ struct eventWiseConstituentSubtractorTask { Produces particleSubtractedD0Table; Produces trackSubtractedDplusTable; Produces particleSubtractedDplusTable; + Produces trackSubtractedDsTable; + Produces particleSubtractedDsTable; Produces trackSubtractedDstarTable; Produces particleSubtractedDstarTable; Produces trackSubtractedLcTable; @@ -52,6 +54,8 @@ struct eventWiseConstituentSubtractorTask { Produces particleSubtractedB0Table; Produces trackSubtractedBplusTable; Produces particleSubtractedBplusTable; + Produces trackSubtractedXicToXiPiPiTable; + Produces particleSubtractedXicToXiPiPiTable; Produces trackSubtractedDielectronTable; Produces particleSubtractedDielectronTable; @@ -184,6 +188,18 @@ struct eventWiseConstituentSubtractorTask { } PROCESS_SWITCH(eventWiseConstituentSubtractorTask, processDplusMcCollisions, "Fill table of subtracted tracks for collisions with Dplus MCP candidates", false); + void processDsCollisions(aod::JetCollision const&, soa::Filtered const& tracks, soa::Join const& candidates) + { + analyseHF(tracks, candidates, trackSubtractedDsTable); + } + PROCESS_SWITCH(eventWiseConstituentSubtractorTask, processDsCollisions, "Fill table of subtracted tracks for collisions with Ds candidates", false); + + void processDsMcCollisions(aod::JetMcCollision const&, soa::Filtered const& tracks, soa::Join const& candidates) + { + analyseHFMc(tracks, candidates, particleSubtractedDsTable); + } + PROCESS_SWITCH(eventWiseConstituentSubtractorTask, processDsMcCollisions, "Fill table of subtracted tracks for collisions with Ds MCP candidates", false); + void processDstarCollisions(aod::JetCollision const&, soa::Filtered const& tracks, soa::Join const& candidates) { analyseHF(tracks, candidates, trackSubtractedDstarTable); @@ -232,6 +248,18 @@ struct eventWiseConstituentSubtractorTask { } PROCESS_SWITCH(eventWiseConstituentSubtractorTask, processBplusMcCollisions, "Fill table of subtracted tracks for collisions with Bplus MCP candidates", false); + void processXicToXiPiPiCollisions(aod::JetCollision const&, soa::Filtered const& tracks, soa::Join const& candidates) + { + analyseHF(tracks, candidates, trackSubtractedXicToXiPiPiTable); + } + PROCESS_SWITCH(eventWiseConstituentSubtractorTask, processXicToXiPiPiCollisions, "Fill table of subtracted tracks for collisions with XicToXiPiPi candidates", false); + + void processXicToXiPiPiMcCollisions(aod::JetMcCollision const&, soa::Filtered const& tracks, soa::Join const& candidates) + { + analyseHFMc(tracks, candidates, particleSubtractedXicToXiPiPiTable); + } + PROCESS_SWITCH(eventWiseConstituentSubtractorTask, processXicToXiPiPiMcCollisions, "Fill table of subtracted tracks for collisions with XicToXiPiPi MCP candidates", false); + void processDielectronCollisions(aod::JetCollision const&, soa::Filtered const& tracks, soa::Join const& candidates) { analyseHF(tracks, candidates, trackSubtractedDielectronTable); diff --git a/PWGJE/TableProducer/jetEventWeightMCD.cxx b/PWGJE/TableProducer/jetEventWeightMCD.cxx index 7036f5407f6..ddb518e1bba 100644 --- a/PWGJE/TableProducer/jetEventWeightMCD.cxx +++ b/PWGJE/TableProducer/jetEventWeightMCD.cxx @@ -60,10 +60,12 @@ using NeutralMCJetsEventWeight = JetEventWeightMCDTask; using D0ChargedMCJetsEventWeight = JetEventWeightMCDTask; using DplusChargedMCJetsEventWeight = JetEventWeightMCDTask; +using DsChargedMCJetsEventWeight = JetEventWeightMCDTask; using DstarChargedMCJetsEventWeight = JetEventWeightMCDTask; using LcChargedMCJetsEventWeight = JetEventWeightMCDTask; using B0ChargedMCJetsEventWeight = JetEventWeightMCDTask; using BplusChargedMCJetsEventWeight = JetEventWeightMCDTask; +using XicToXiPiPiChargedMCJetsEventWeight = JetEventWeightMCDTask; using V0ChargedMCJetsEventWeight = JetEventWeightMCDTask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) @@ -91,6 +93,10 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-dplus-eventweight-mcd-charged"})); + tasks.emplace_back( + adaptAnalysisTask(cfgc, + SetDefaultProcesses{}, TaskName{"jet-ds-eventweight-mcd-charged"})); + tasks.emplace_back( adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-dstar-eventweight-mcd-charged"})); @@ -107,6 +113,10 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-bplus-eventweight-mcd-charged"})); + tasks.emplace_back( + adaptAnalysisTask(cfgc, + SetDefaultProcesses{}, TaskName{"jet-xictoxipipi-eventweight-mcd-charged"})); + tasks.emplace_back( adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-v0-eventweight-mcd-charged"})); diff --git a/PWGJE/TableProducer/jetEventWeightMCP.cxx b/PWGJE/TableProducer/jetEventWeightMCP.cxx index ba2efb56ced..7f262e998ea 100644 --- a/PWGJE/TableProducer/jetEventWeightMCP.cxx +++ b/PWGJE/TableProducer/jetEventWeightMCP.cxx @@ -49,10 +49,12 @@ using NeutralMCJetsEventWeight = JetEventWeightMCPTask; using D0ChargedMCJetsEventWeight = JetEventWeightMCPTask; using DplusChargedMCJetsEventWeight = JetEventWeightMCPTask; +using DsChargedMCJetsEventWeight = JetEventWeightMCPTask; using DstarChargedMCJetsEventWeight = JetEventWeightMCPTask; using LcChargedMCJetsEventWeight = JetEventWeightMCPTask; using B0ChargedMCJetsEventWeight = JetEventWeightMCPTask; using BplusChargedMCJetsEventWeight = JetEventWeightMCPTask; +using XicToXiPiPiChargedMCJetsEventWeight = JetEventWeightMCPTask; using V0ChargedMCJetsEventWeight = JetEventWeightMCPTask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) @@ -80,6 +82,10 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-dplus-eventweight-mcp-charged"})); + tasks.emplace_back( + adaptAnalysisTask(cfgc, + SetDefaultProcesses{}, TaskName{"jet-ds-eventweight-mcp-charged"})); + tasks.emplace_back( adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-dstar-eventweight-mcp-charged"})); @@ -96,6 +102,10 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-bplus-eventweight-mcp-charged"})); + tasks.emplace_back( + adaptAnalysisTask(cfgc, + SetDefaultProcesses{}, TaskName{"jet-xictoxipipi-eventweight-mcp-charged"})); + tasks.emplace_back( adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-v0-eventweight-mcp-charged"})); diff --git a/PWGJE/TableProducer/mcOutlierRejector.cxx b/PWGJE/TableProducer/mcOutlierRejector.cxx index 427a5afdfad..48241281565 100644 --- a/PWGJE/TableProducer/mcOutlierRejector.cxx +++ b/PWGJE/TableProducer/mcOutlierRejector.cxx @@ -94,10 +94,12 @@ struct McOutlierRejectorTask { PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionObjects, processSelectingFullMCDetectorLevelJets, "process mc detector level full jets", false); PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionObjects, processSelectingD0ChargedMCDetectorLevelJets, "process mc detector level D0 charged jets", false); PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionObjects, processSelectingDplusChargedMCDetectorLevelJets, "process mc detector level Dplus charged jets", false); - // PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionObjects, processSelectingDstarChargedMCDetectorLevelJets, "process mc detector level Dstar charged jets", false); + PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionObjects, processSelectingDsChargedMCDetectorLevelJets, "process mc detector level Ds charged jets", false); + PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionObjects, processSelectingDstarChargedMCDetectorLevelJets, "process mc detector level Dstar charged jets", false); PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionObjects, processSelectingLcChargedMCDetectorLevelJets, "process mc detector level Lc charged jets", false); - // PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionObjects, processSelectingB0ChargedMCDetectorLevelJets, "process mc detector level B0 charged jets", false); + PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionObjects, processSelectingB0ChargedMCDetectorLevelJets, "process mc detector level B0 charged jets", false); PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionObjects, processSelectingBplusChargedMCDetectorLevelJets, "process mc detector level Bplus charged jets", false); + PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionObjects, processSelectingXicToXiPiPiChargedMCDetectorLevelJets, "process mc detector level XicToXiPiPi charged jets", false); PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionObjects, processSelectingDielectronChargedMCDetectorLevelJets, "process mc detector level Dielectron charged jets", false); PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionObjects, processSelectingTracks, "process tracks", false); PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionMcObjects, processSelectingChargedMCParticleLevelJets, "process mc particle level charged jets", true); @@ -105,10 +107,12 @@ struct McOutlierRejectorTask { PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionMcObjects, processSelectingFullMCParticleLevelJets, "process mc particle level full jets", false); PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionMcObjects, processSelectingD0ChargedMCParticleLevelJets, "process mc particle level D0 charged jets", false); PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionMcObjects, processSelectingDplusChargedMCParticleLevelJets, "process mc particle level Dplus charged jets", false); - // PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionMcObjects, processSelectingDstarChargedMCParticleLevelJets, "process mc particle level Dstar charged jets", false); + PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionMcObjects, processSelectingDsChargedMCParticleLevelJets, "process mc particle level Ds charged jets", false); + PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionMcObjects, processSelectingDstarChargedMCParticleLevelJets, "process mc particle level Dstar charged jets", false); PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionMcObjects, processSelectingLcChargedMCParticleLevelJets, "process mc particle level Lc charged jets", false); - // PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionMcObjects, processSelectingB0ChargedMCParticleLevelJets, "process mc particle level B0 charged jets", false); + PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionMcObjects, processSelectingB0ChargedMCParticleLevelJets, "process mc particle level B0 charged jets", false); PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionMcObjects, processSelectingBplusChargedMCParticleLevelJets, "process mc particle level Bplus charged jets", false); + PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionMcObjects, processSelectingXicToXiPiPiChargedMCParticleLevelJets, "process mc particle level XicToXiPiPi charged jets", false); PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionMcObjects, processSelectingDielectronChargedMCParticleLevelJets, "process mc particle level Dielectron charged jets", false); PROCESS_SWITCH_FULL(McOutlierRejectorTask, processSelectionMcObjects, processSelectingParticles, "process mc particles", false); diff --git a/PWGJE/TableProducer/rhoEstimator.cxx b/PWGJE/TableProducer/rhoEstimator.cxx index b6026e46291..e854868a840 100644 --- a/PWGJE/TableProducer/rhoEstimator.cxx +++ b/PWGJE/TableProducer/rhoEstimator.cxx @@ -48,14 +48,18 @@ struct RhoEstimatorTask { Produces rhoD0McTable; Produces rhoDplusTable; Produces rhoDplusMcTable; + Produces rhoDsTable; + Produces rhoDsMcTable; Produces rhoDstarTable; Produces rhoDstarMcTable; Produces rhoLcTable; Produces rhoLcMcTable; - Produces rhoBplusTable; - Produces rhoBplusMcTable; Produces rhoB0Table; Produces rhoB0McTable; + Produces rhoBplusTable; + Produces rhoBplusMcTable; + Produces rhoXicToXiPiPiTable; + Produces rhoXicToXiPiPiMcTable; Produces rhoDielectronTable; Produces rhoDielectronMcTable; @@ -279,6 +283,34 @@ struct RhoEstimatorTask { } PROCESS_SWITCH(RhoEstimatorTask, processDplusMcCollisions, "Fill rho tables for collisions with Dplus MCP candidates", false); + void processDsCollisions(aod::JetCollision const& collision, soa::Filtered const& tracks, aod::CandidatesDsData const& candidates) + { + for (auto& candidate : candidates) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || collision.centFT0M() < config.centralityMin || collision.centFT0M() >= config.centralityMax || collision.trackOccupancyInTimeRange() > config.trackOccupancyInTimeRangeMax || std::abs(collision.posZ()) > config.vertexZCut) { + rhoDsTable(0.0, 0.0); + continue; + } + inputParticles.clear(); + jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, config.trackingEfficiency, &candidate); + + auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, config.doSparse); + rhoDsTable(rho, rhoM); + } + } + PROCESS_SWITCH(RhoEstimatorTask, processDsCollisions, "Fill rho tables for collisions with Ds candidates", false); + + void processDsMcCollisions(aod::JetMcCollision const&, soa::Filtered const& particles, aod::CandidatesDsMCP const& candidates) + { + for (auto& candidate : candidates) { + inputParticles.clear(); + jetfindingutilities::analyseParticles(inputParticles, particleSelection, 1, particles, pdgDatabase, &candidate); + + auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, config.doSparse); + rhoDsMcTable(rho, rhoM); + } + } + PROCESS_SWITCH(RhoEstimatorTask, processDsMcCollisions, "Fill rho tables for collisions with Ds MCP candidates", false); + void processDstarCollisions(aod::JetCollision const& collision, soa::Filtered const& tracks, aod::CandidatesDstarData const& candidates) { for (auto& candidate : candidates) { @@ -391,6 +423,34 @@ struct RhoEstimatorTask { } PROCESS_SWITCH(RhoEstimatorTask, processBplusMcCollisions, "Fill rho tables for collisions with Bplus MCP candidates", false); + void processXicToXiPiPiCollisions(aod::JetCollision const& collision, soa::Filtered const& tracks, aod::CandidatesXicToXiPiPiData const& candidates) + { + for (auto& candidate : candidates) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || collision.centFT0M() < config.centralityMin || collision.centFT0M() >= config.centralityMax || collision.trackOccupancyInTimeRange() > config.trackOccupancyInTimeRangeMax || std::abs(collision.posZ()) > config.vertexZCut) { + rhoXicToXiPiPiTable(0.0, 0.0); + continue; + } + inputParticles.clear(); + jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, config.trackingEfficiency, &candidate); + + auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, config.doSparse); + rhoXicToXiPiPiTable(rho, rhoM); + } + } + PROCESS_SWITCH(RhoEstimatorTask, processXicToXiPiPiCollisions, "Fill rho tables for collisions with XicToXiPiPi candidates", false); + + void processXicToXiPiPiMcCollisions(aod::JetMcCollision const&, soa::Filtered const& particles, aod::CandidatesXicToXiPiPiMCP const& candidates) + { + for (auto& candidate : candidates) { + inputParticles.clear(); + jetfindingutilities::analyseParticles(inputParticles, particleSelection, 1, particles, pdgDatabase, &candidate); + + auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, config.doSparse); + rhoXicToXiPiPiMcTable(rho, rhoM); + } + } + PROCESS_SWITCH(RhoEstimatorTask, processXicToXiPiPiMcCollisions, "Fill rho tables for collisions with XicToXiPiPi MCP candidates", false); + void processDielectronCollisions(aod::JetCollision const& collision, soa::Filtered const& tracks, aod::CandidatesDielectronData const& candidates) { for (auto& candidate : candidates) { diff --git a/PWGJE/Tasks/CMakeLists.txt b/PWGJE/Tasks/CMakeLists.txt index 3b0d896108c..289cff5bd3b 100644 --- a/PWGJE/Tasks/CMakeLists.txt +++ b/PWGJE/Tasks/CMakeLists.txt @@ -80,6 +80,10 @@ if(FastJet_FOUND) SOURCES jetSubstructureDplus.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-substructure-ds + SOURCES jetSubstructureDs.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-substructure-dstar SOURCES jetSubstructureDstar.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore @@ -96,6 +100,10 @@ if(FastJet_FOUND) SOURCES jetSubstructureBplus.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-substructure-xictoxipipi + SOURCES jetSubstructureXicToXiPiPi.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-substructure-dielectron SOURCES jetSubstructureDielectron.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore @@ -108,6 +116,10 @@ if(FastJet_FOUND) SOURCES jetSubstructureDplusOutput.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-substructure-ds-output + SOURCES jetSubstructureDsOutput.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-substructure-dstar-output SOURCES jetSubstructureDstarOutput.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore @@ -124,6 +136,10 @@ if(FastJet_FOUND) SOURCES jetSubstructureBplusOutput.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-substructure-xictoxipipi-output + SOURCES jetSubstructureXicToXiPiPiOutput.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-substructure-dielectron-output SOURCES jetSubstructureDielectronOutput.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore @@ -156,6 +172,10 @@ if(FastJet_FOUND) SOURCES jetFinderDplusQA.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-finder-ds-qa + SOURCES jetFinderDsQA.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-dstar-qa SOURCES jetFinderDstarQA.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore @@ -172,6 +192,10 @@ if(FastJet_FOUND) SOURCES jetFinderBplusQA.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-finder-xictoxipipi-qa + SOURCES jetFinderXicToXiPiPiQA.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-finder-dielectron-qa SOURCES jetFinderDielectronQA.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore diff --git a/PWGJE/Tasks/jetFinderDsQA.cxx b/PWGJE/Tasks/jetFinderDsQA.cxx new file mode 100644 index 00000000000..e04915fb975 --- /dev/null +++ b/PWGJE/Tasks/jetFinderDsQA.cxx @@ -0,0 +1,37 @@ +// 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. + +// jet finder Ds charged QA task +// +/// \author Nima Zardoshti + +#include "PWGJE/Tasks/jetFinderHFQA.cxx" + +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/DataModel/JetSubtraction.h" + +#include +#include +#include +#include + +#include + +using JetFinderDsQATask = JetFinderHFQATask; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, + SetDefaultProcesses{}, + TaskName{"jet-finder-charged-ds-qa"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/Tasks/jetFinderHFQA.cxx b/PWGJE/Tasks/jetFinderHFQA.cxx index fee889a62ea..b82a5943265 100644 --- a/PWGJE/Tasks/jetFinderHFQA.cxx +++ b/PWGJE/Tasks/jetFinderHFQA.cxx @@ -493,10 +493,12 @@ struct JetFinderHFQATask { PresliceOptional> perD0CandidateTracks = aod::bkgd0::candidateId; PresliceOptional> perDplusCandidateTracks = aod::bkgdplus::candidateId; + PresliceOptional> perDsCandidateTracks = aod::bkgds::candidateId; PresliceOptional> perDstarCandidateTracks = aod::bkgdstar::candidateId; PresliceOptional> perLcCandidateTracks = aod::bkglc::candidateId; PresliceOptional> perB0CandidateTracks = aod::bkgb0::candidateId; PresliceOptional> perBplusCandidateTracks = aod::bkgbplus::candidateId; + PresliceOptional> perXicToXiPiPiCandidateTracks = aod::bkgxictoxipipi::candidateId; PresliceOptional> perDielectronCandidateTracks = aod::bkgdielectron::candidateId; template @@ -1523,7 +1525,7 @@ struct JetFinderHFQATask { } for (auto const& candidate : candidates) { - for (auto const& track : jetcandidateutilities::slicedPerCandidate(tracks, candidate, perD0CandidateTracks, perDplusCandidateTracks, perDstarCandidateTracks, perLcCandidateTracks, perB0CandidateTracks, perBplusCandidateTracks, perDielectronCandidateTracks)) { + for (auto const& track : jetcandidateutilities::slicedPerCandidate(tracks, candidate, perD0CandidateTracks, perDplusCandidateTracks, perDsCandidateTracks, perDstarCandidateTracks, perLcCandidateTracks, perB0CandidateTracks, perBplusCandidateTracks, perXicToXiPiPiCandidateTracks, perDielectronCandidateTracks)) { registry.fill(HIST("h3_centrality_track_pt_track_phi_eventwiseconstituentsubtracted"), collision.centFT0M(), track.pt(), track.phi()); registry.fill(HIST("h3_centrality_track_pt_track_eta_eventwiseconstituentsubtracted"), collision.centFT0M(), track.pt(), track.eta()); registry.fill(HIST("h3_track_pt_track_eta_track_phi_eventwiseconstituentsubtracted"), track.pt(), track.eta(), track.phi()); diff --git a/PWGJE/Tasks/jetFinderXicToXiPiPiQA.cxx b/PWGJE/Tasks/jetFinderXicToXiPiPiQA.cxx new file mode 100644 index 00000000000..a86a40f0d67 --- /dev/null +++ b/PWGJE/Tasks/jetFinderXicToXiPiPiQA.cxx @@ -0,0 +1,37 @@ +// 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. + +// jet finder XicToXiPiPi charged QA task +// +/// \author Nima Zardoshti + +#include "PWGJE/Tasks/jetFinderHFQA.cxx" + +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/DataModel/JetSubtraction.h" + +#include +#include +#include +#include + +#include + +using JetFinderXicToXiPiPiQATask = JetFinderHFQATask; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, + SetDefaultProcesses{}, + TaskName{"jet-finder-charged-xictoxipipi-qa"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/Tasks/jetSubstructureDs.cxx b/PWGJE/Tasks/jetSubstructureDs.cxx new file mode 100644 index 00000000000..3207ba667e3 --- /dev/null +++ b/PWGJE/Tasks/jetSubstructureDs.cxx @@ -0,0 +1,39 @@ +// 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. + +// jet substructure Ds charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/Tasks/jetSubstructureHF.cxx" + +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/DataModel/JetSubstructure.h" +#include "PWGJE/DataModel/JetSubtraction.h" + +#include +#include +#include +#include +#include + +#include + +using JetSubstructureDs = JetSubstructureHFTask, soa::Join, soa::Join, soa::Join, aod::CandidatesDsData, aod::CandidatesDsMCP, aod::DsCJetSSs, aod::DsChargedSPs, aod::DsChargedPRs, aod::DsCMCDJetSSs, aod::DsChargedMCDetectorLevelSPs, aod::DsChargedMCDetectorLevelPRs, aod::DsCMCPJetSSs, aod::DsChargedMCParticleLevelSPs, aod::DsChargedMCParticleLevelPRs, aod::DsCEWSJetSSs, aod::DsChargedEventWiseSubtractedSPs, aod::DsChargedEventWiseSubtractedPRs, aod::JTrackDsSubs>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, + SetDefaultProcesses{}, + TaskName{"jet-substructure-ds"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/Tasks/jetSubstructureDsOutput.cxx b/PWGJE/Tasks/jetSubstructureDsOutput.cxx new file mode 100644 index 00000000000..91f0ae4b54d --- /dev/null +++ b/PWGJE/Tasks/jetSubstructureDsOutput.cxx @@ -0,0 +1,40 @@ +// 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. + +// jet substructure output Ds charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/Tasks/jetSubstructureHFOutput.cxx" + +#include "PWGHF/DataModel/DerivedTables.h" +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/DataModel/JetReducedDataHF.h" +#include "PWGJE/DataModel/JetSubstructure.h" +#include "PWGJE/DataModel/JetSubtraction.h" + +#include +#include +#include +#include +#include + +#include + +using JetSubstructureOutputDs = JetSubstructureHFOutputTask, aod::McCollisionsDs, aod::CandidatesDsData, aod::CandidatesDsMCD, aod::CandidatesDsMCP, aod::BkgDsRhos, aod::BkgDsMcRhos, aod::JTrackDsSubs, soa::Join, soa::Join, soa::Join, soa::Join, aod::DsCJetCOs, aod::DsCJetOs, aod::DsCJetSSOs, aod::DsCJetMOs, soa::Join, soa::Join, soa::Join, aod::DsCMCDJetCOs, aod::DsCMCDJetOs, aod::DsCMCDJetSSOs, aod::DsCMCDJetMOs, soa::Join, soa::Join, soa::Join, soa::Join, aod::DsCMCPJetCOs, aod::DsCMCPJetMCCOs, aod::DsCMCPJetOs, aod::DsCMCPJetSSOs, aod::DsCMCPJetMOs, soa::Join, soa::Join, soa::Join, aod::DsCEWSJetCOs, aod::DsCEWSJetOs, aod::DsCEWSJetSSOs, aod::DsCEWSJetMOs, aod::StoredHfDsCollBase, aod::StoredHfDsBases, aod::StoredHfDsPars, aod::StoredHfDsParEs, aod::JDumDsParDaus, aod::StoredHfDsSels, aod::StoredHfDsMls, aod::JDumDsMlDaus, aod::StoredHfDsMcs, aod::StoredHfDsMcCollBases, aod::StoredHfDsMcRCollIds, aod::StoredHfDsPBases>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-substructure-ds-output"})); + + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/Tasks/jetSubstructureHF.cxx b/PWGJE/Tasks/jetSubstructureHF.cxx index c098236dae7..1117a79bd37 100644 --- a/PWGJE/Tasks/jetSubstructureHF.cxx +++ b/PWGJE/Tasks/jetSubstructureHF.cxx @@ -130,20 +130,24 @@ struct JetSubstructureHFTask { Preslice TracksPerCollision = aod::jtrack::collisionId; PresliceOptional TracksPerD0DataSub = aod::bkgd0::candidateId; PresliceOptional TracksPerDplusDataSub = aod::bkgdplus::candidateId; + PresliceOptional TracksPerDsDataSub = aod::bkgds::candidateId; PresliceOptional TracksPerDstarDataSub = aod::bkgdstar::candidateId; PresliceOptional TracksPerLcDataSub = aod::bkglc::candidateId; PresliceOptional TracksPerB0DataSub = aod::bkgb0::candidateId; PresliceOptional TracksPerBplusDataSub = aod::bkgbplus::candidateId; + PresliceOptional TracksPerXicToXiPiPiDataSub = aod::bkgxictoxipipi::candidateId; PresliceOptional TracksPerDielectronDataSub = aod::bkgdielectron::candidateId; Preslice ParticlesPerMcCollision = aod::jmcparticle::mcCollisionId; - template - auto selectSlicer(T const& D0Slicer, U const& DplusSlicer, V const& DstarSlicer, M const& LcSlicer, N const& B0Slicer, O const& BplusSlicer, P const& DielectronSlicer) + template + auto selectSlicer(T const& D0Slicer, U const& DplusSlicer, V const& DsSlicer, M const& DstarSlicer, N const& LcSlicer, O const& B0Slicer, P const& BplusSlicer, Q const& XicToXiPiPiSlicer, R const& DielectronSlicer) { if constexpr (jethfutilities::isD0Table()) { return D0Slicer; } else if constexpr (jethfutilities::isDplusTable()) { return DplusSlicer; + } else if constexpr (jethfutilities::isDsTable()) { + return DsSlicer; } else if constexpr (jethfutilities::isDstarTable()) { return DstarSlicer; } else if constexpr (jethfutilities::isLcTable()) { @@ -152,6 +156,8 @@ struct JetSubstructureHFTask { return B0Slicer; } else if constexpr (jethfutilities::isBplusTable()) { return BplusSlicer; + } else if constexpr (jethfutilities::isXicToXiPiPiTable()) { + return XicToXiPiPiSlicer; } else if constexpr (jetdqutilities::isDielectronTable()) { return DielectronSlicer; } else { @@ -441,7 +447,7 @@ struct JetSubstructureHFTask { CandidateTable const& candidates, TracksSub const& tracks) { - analyseCharged(jet, tracks, candidates, selectSlicer(TracksPerD0DataSub, TracksPerDplusDataSub, TracksPerDstarDataSub, TracksPerLcDataSub, TracksPerB0DataSub, TracksPerBplusDataSub, TracksPerDielectronDataSub), jetSubstructureDataSubTable, jetSplittingsDataSubTable, jetPairsDataSubTable); + analyseCharged(jet, tracks, candidates, selectSlicer(TracksPerD0DataSub, TracksPerDplusDataSub, TracksPerDsDataSub, TracksPerDstarDataSub, TracksPerLcDataSub, TracksPerB0DataSub, TracksPerBplusDataSub, TracksPerXicToXiPiPiDataSub, TracksPerDielectronDataSub), jetSubstructureDataSubTable, jetSplittingsDataSubTable, jetPairsDataSubTable); } PROCESS_SWITCH(JetSubstructureHFTask, processChargedJetsDataSub, "HF jet substructure on data", false); diff --git a/PWGJE/Tasks/jetSubstructureHFOutput.cxx b/PWGJE/Tasks/jetSubstructureHFOutput.cxx index ee3aaebc142..0a77074c8ce 100644 --- a/PWGJE/Tasks/jetSubstructureHFOutput.cxx +++ b/PWGJE/Tasks/jetSubstructureHFOutput.cxx @@ -151,6 +151,16 @@ struct JetSubstructureHFOutputTask { PresliceOptional> DplusPairsPerJetMCD = aod::dpluschargedmcdetectorlevelpair::jetId; PresliceOptional> DplusPairsPerJetMCP = aod::dpluschargedmcparticlelevelpair::jetId; + PresliceOptional> DsSplittingsPerJetData = aod::dschargedsplitting::jetId; + PresliceOptional> DsSplittingsPerJetDataSub = aod::dschargedeventwisesubtractedsplitting::jetId; + PresliceOptional> DsSplittingsPerJetMCD = aod::dschargedmcdetectorlevelsplitting::jetId; + PresliceOptional> DsSplittingsPerJetMCP = aod::dschargedmcparticlelevelsplitting::jetId; + + PresliceOptional> DsPairsPerJetData = aod::dschargedpair::jetId; + PresliceOptional> DsPairsPerJetDataSub = aod::dschargedeventwisesubtractedpair::jetId; + PresliceOptional> DsPairsPerJetMCD = aod::dschargedmcdetectorlevelpair::jetId; + PresliceOptional> DsPairsPerJetMCP = aod::dschargedmcparticlelevelpair::jetId; + PresliceOptional> DstarSplittingsPerJetData = aod::dstarchargedsplitting::jetId; PresliceOptional> DstarSplittingsPerJetDataSub = aod::dstarchargedeventwisesubtractedsplitting::jetId; PresliceOptional> DstarSplittingsPerJetMCD = aod::dstarchargedmcdetectorlevelsplitting::jetId; @@ -191,6 +201,16 @@ struct JetSubstructureHFOutputTask { PresliceOptional> BplusPairsPerJetMCD = aod::bpluschargedmcdetectorlevelpair::jetId; PresliceOptional> BplusPairsPerJetMCP = aod::bpluschargedmcparticlelevelpair::jetId; + PresliceOptional> XicToXiPiPiSplittingsPerJetData = aod::xictoxipipichargedsplitting::jetId; + PresliceOptional> XicToXiPiPiSplittingsPerJetDataSub = aod::xictoxipipichargedeventwisesubtractedsplitting::jetId; + PresliceOptional> XicToXiPiPiSplittingsPerJetMCD = aod::xictoxipipichargedmcdetectorlevelsplitting::jetId; + PresliceOptional> XicToXiPiPiSplittingsPerJetMCP = aod::xictoxipipichargedmcparticlelevelsplitting::jetId; + + PresliceOptional> XicToXiPiPiPairsPerJetData = aod::xictoxipipichargedpair::jetId; + PresliceOptional> XicToXiPiPiPairsPerJetDataSub = aod::xictoxipipichargedeventwisesubtractedpair::jetId; + PresliceOptional> XicToXiPiPiPairsPerJetMCD = aod::xictoxipipichargedmcdetectorlevelpair::jetId; + PresliceOptional> XicToXiPiPiPairsPerJetMCP = aod::xictoxipipichargedmcparticlelevelpair::jetId; + PresliceOptional> DielectronSplittingsPerJetData = aod::dielectronchargedsplitting::jetId; PresliceOptional> DielectronSplittingsPerJetDataSub = aod::dielectronchargedeventwisesubtractedsplitting::jetId; PresliceOptional> DielectronSplittingsPerJetMCD = aod::dielectronchargedmcdetectorlevelsplitting::jetId; @@ -383,8 +403,8 @@ struct JetSubstructureHFOutputTask { } } - template - void analyseSubstructureMatched(T const& jets, U const& allSplittings, V const& allPairs, M const& D0SplittingsPerJet, N const DplusSplittingsPerJet, O const DstarSplittingsPerJet, P const& LcSplittingsPerJet, Q const& B0SplittingsPerJet, R const& BplusSplittingsPerJet, S const& DielectronSplittingsPerJet, A const& D0PairsPerJet, B const DplusPairsPerJet, C const& DstarPairsPerJet, D const& LcPairsPerJet, E const& B0PairsPerJet, F const& BplusPairsPerJet, G const& DielectronPairsPerJet, std::vector>& splittingMatchesGeoVecVec, std::vector>& splittingMatchesPtVecVec, std::vector>& splittingMatchesHFVecVec, std::vector>& pairMatchesVecVec, float jetPtMin) + template + void analyseSubstructureMatched(T const& jets, U const& allSplittings, V const& allPairs, M const& D0SplittingsPerJet, N const DplusSplittingsPerJet, O const& DsSplittingsPerJet, P const DstarSplittingsPerJet, Q const& LcSplittingsPerJet, R const& B0SplittingsPerJet, S const& BplusSplittingsPerJet, A const& XicToXiPiPiSplittingsPerJet, B const& DielectronSplittingsPerJet, C const& D0PairsPerJet, D const DplusPairsPerJet, E const& DsPairsPerJet, F const& DstarPairsPerJet, G const& LcPairsPerJet, H const& B0PairsPerJet, I const& BplusPairsPerJet, J const& XicToXiPiPiPairsPerJet, K const& DielectronPairsPerJet, std::vector>& splittingMatchesGeoVecVec, std::vector>& splittingMatchesPtVecVec, std::vector>& splittingMatchesHFVecVec, std::vector>& pairMatchesVecVec, float jetPtMin) { for (const auto& jet : jets) { if (jet.pt() < jetPtMin) { @@ -395,9 +415,9 @@ struct JetSubstructureHFOutputTask { } for (const auto& jetRadiiValue : jetRadiiValues) { if (jet.r() == round(jetRadiiValue * 100.0f)) { - auto splittings = jetcandidateutilities::slicedPerJet(allSplittings, jet, D0SplittingsPerJet, DplusSplittingsPerJet, DstarSplittingsPerJet, LcSplittingsPerJet, B0SplittingsPerJet, BplusSplittingsPerJet, DielectronSplittingsPerJet); + auto splittings = jetcandidateutilities::slicedPerJet(allSplittings, jet, D0SplittingsPerJet, DplusSplittingsPerJet, DsSplittingsPerJet, DstarSplittingsPerJet, LcSplittingsPerJet, B0SplittingsPerJet, BplusSplittingsPerJet, XicToXiPiPiSplittingsPerJet, DielectronSplittingsPerJet); fillSplittingMatchingVectors(splittings, jet.globalIndex(), splittingMatchesGeoVecVec, splittingMatchesPtVecVec, splittingMatchesHFVecVec); - auto pairs = jetcandidateutilities::slicedPerJet(allPairs, jet, D0PairsPerJet, DplusPairsPerJet, DstarPairsPerJet, LcPairsPerJet, B0PairsPerJet, BplusPairsPerJet, DielectronPairsPerJet); + auto pairs = jetcandidateutilities::slicedPerJet(allPairs, jet, D0PairsPerJet, DplusPairsPerJet, DsPairsPerJet, DstarPairsPerJet, LcPairsPerJet, B0PairsPerJet, BplusPairsPerJet, XicToXiPiPiPairsPerJet, DielectronPairsPerJet); fillPairMatchingVectors(pairs, jet.globalIndex(), pairMatchesVecVec); } } @@ -656,12 +676,12 @@ struct JetSubstructureHFOutputTask { splittingMatchesPtVecVecData.assign(jets.size(), {}); splittingMatchesHFVecVecData.assign(jets.size(), {}); pairMatchesVecVecData.assign(jets.size(), {}); - analyseSubstructureMatched(jets, splittingsData, pairsData, preslices.D0SplittingsPerJetData, preslices.DplusSplittingsPerJetData, preslices.DstarSplittingsPerJetData, preslices.LcSplittingsPerJetData, preslices.B0SplittingsPerJetData, preslices.BplusSplittingsPerJetData, preslices.DielectronSplittingsPerJetData, preslices.D0PairsPerJetData, preslices.DplusPairsPerJetData, preslices.DstarPairsPerJetData, preslices.LcPairsPerJetData, preslices.B0PairsPerJetData, preslices.BplusPairsPerJetData, preslices.DielectronPairsPerJetData, splittingMatchesGeoVecVecData, splittingMatchesPtVecVecData, splittingMatchesHFVecVecData, pairMatchesVecVecData, configs.jetPtMinData); + analyseSubstructureMatched(jets, splittingsData, pairsData, preslices.D0SplittingsPerJetData, preslices.DplusSplittingsPerJetData, preslices.DsSplittingsPerJetData, preslices.DstarSplittingsPerJetData, preslices.LcSplittingsPerJetData, preslices.B0SplittingsPerJetData, preslices.BplusSplittingsPerJetData, preslices.XicToXiPiPiSplittingsPerJetData, preslices.DielectronSplittingsPerJetData, preslices.D0PairsPerJetData, preslices.DplusPairsPerJetData, preslices.DsPairsPerJetData, preslices.DstarPairsPerJetData, preslices.LcPairsPerJetData, preslices.B0PairsPerJetData, preslices.BplusPairsPerJetData, preslices.XicToXiPiPiPairsPerJetData, preslices.DielectronPairsPerJetData, splittingMatchesGeoVecVecData, splittingMatchesPtVecVecData, splittingMatchesHFVecVecData, pairMatchesVecVecData, configs.jetPtMinData); splittingMatchesGeoVecVecDataSub.assign(jetsSub.size(), {}); splittingMatchesPtVecVecDataSub.assign(jetsSub.size(), {}); splittingMatchesHFVecVecDataSub.assign(jetsSub.size(), {}); pairMatchesVecVecDataSub.assign(jetsSub.size(), {}); - analyseSubstructureMatched(jetsSub, splittingsDataSub, pairsDataSub, preslices.D0SplittingsPerJetDataSub, preslices.DplusSplittingsPerJetDataSub, preslices.DstarSplittingsPerJetDataSub, preslices.LcSplittingsPerJetDataSub, preslices.B0SplittingsPerJetDataSub, preslices.BplusSplittingsPerJetDataSub, preslices.DielectronSplittingsPerJetDataSub, preslices.D0PairsPerJetDataSub, preslices.DplusPairsPerJetDataSub, preslices.DstarPairsPerJetDataSub, preslices.LcPairsPerJetDataSub, preslices.B0PairsPerJetDataSub, preslices.BplusPairsPerJetDataSub, preslices.DielectronPairsPerJetDataSub, splittingMatchesGeoVecVecDataSub, splittingMatchesPtVecVecDataSub, splittingMatchesHFVecVecDataSub, pairMatchesVecVecDataSub, configs.jetPtMinDataSub); + analyseSubstructureMatched(jetsSub, splittingsDataSub, pairsDataSub, preslices.D0SplittingsPerJetDataSub, preslices.DplusSplittingsPerJetDataSub, preslices.DsSplittingsPerJetDataSub, preslices.DstarSplittingsPerJetDataSub, preslices.LcSplittingsPerJetDataSub, preslices.B0SplittingsPerJetDataSub, preslices.BplusSplittingsPerJetDataSub, preslices.XicToXiPiPiSplittingsPerJetDataSub, preslices.DielectronSplittingsPerJetDataSub, preslices.D0PairsPerJetDataSub, preslices.DplusPairsPerJetDataSub, preslices.DsPairsPerJetDataSub, preslices.DstarPairsPerJetDataSub, preslices.LcPairsPerJetDataSub, preslices.B0PairsPerJetDataSub, preslices.BplusPairsPerJetDataSub, preslices.XicToXiPiPiPairsPerJetDataSub, preslices.DielectronPairsPerJetDataSub, splittingMatchesGeoVecVecDataSub, splittingMatchesPtVecVecDataSub, splittingMatchesHFVecVecDataSub, pairMatchesVecVecDataSub, configs.jetPtMinDataSub); } PROCESS_SWITCH(JetSubstructureHFOutputTask, processOutputSubstructureMatchingData, "jet substructure matching output Data", false); @@ -702,12 +722,12 @@ struct JetSubstructureHFOutputTask { splittingMatchesPtVecVecMCD.assign(jetsMCD.size(), {}); splittingMatchesHFVecVecMCD.assign(jetsMCD.size(), {}); pairMatchesVecVecMCD.assign(jetsMCD.size(), {}); - analyseSubstructureMatched(jetsMCD, splittingsMCD, pairsMCD, preslices.D0SplittingsPerJetMCD, preslices.DplusSplittingsPerJetMCD, preslices.DstarSplittingsPerJetMCD, preslices.LcSplittingsPerJetMCD, preslices.B0SplittingsPerJetMCD, preslices.BplusSplittingsPerJetMCD, preslices.DielectronSplittingsPerJetMCD, preslices.D0PairsPerJetMCD, preslices.DplusPairsPerJetMCD, preslices.DstarPairsPerJetMCD, preslices.LcPairsPerJetMCD, preslices.B0PairsPerJetMCD, preslices.BplusPairsPerJetMCD, preslices.DielectronPairsPerJetMCD, splittingMatchesGeoVecVecMCD, splittingMatchesPtVecVecMCD, splittingMatchesHFVecVecMCD, pairMatchesVecVecMCD, configs.jetPtMinMCD); + analyseSubstructureMatched(jetsMCD, splittingsMCD, pairsMCD, preslices.D0SplittingsPerJetMCD, preslices.DplusSplittingsPerJetMCD, preslices.DsSplittingsPerJetMCD, preslices.DstarSplittingsPerJetMCD, preslices.LcSplittingsPerJetMCD, preslices.B0SplittingsPerJetMCD, preslices.BplusSplittingsPerJetMCD, preslices.XicToXiPiPiSplittingsPerJetMCD, preslices.DielectronSplittingsPerJetMCD, preslices.D0PairsPerJetMCD, preslices.DplusPairsPerJetMCD, preslices.DsPairsPerJetMCD, preslices.DstarPairsPerJetMCD, preslices.LcPairsPerJetMCD, preslices.B0PairsPerJetMCD, preslices.BplusPairsPerJetMCD, preslices.XicToXiPiPiPairsPerJetMCD, preslices.DielectronPairsPerJetMCD, splittingMatchesGeoVecVecMCD, splittingMatchesPtVecVecMCD, splittingMatchesHFVecVecMCD, pairMatchesVecVecMCD, configs.jetPtMinMCD); splittingMatchesGeoVecVecMCP.assign(jetsMCP.size(), {}); splittingMatchesPtVecVecMCP.assign(jetsMCP.size(), {}); splittingMatchesHFVecVecMCP.assign(jetsMCP.size(), {}); pairMatchesVecVecMCP.assign(jetsMCP.size(), {}); - analyseSubstructureMatched(jetsMCP, splittingsMCP, pairsMCP, preslices.D0SplittingsPerJetMCP, preslices.DplusSplittingsPerJetMCP, preslices.DstarSplittingsPerJetMCP, preslices.LcSplittingsPerJetMCP, preslices.B0SplittingsPerJetMCP, preslices.BplusSplittingsPerJetMCP, preslices.DielectronSplittingsPerJetMCP, preslices.D0PairsPerJetMCP, preslices.DplusPairsPerJetMCP, preslices.DstarPairsPerJetMCP, preslices.LcPairsPerJetMCP, preslices.B0PairsPerJetMCP, preslices.BplusPairsPerJetMCP, preslices.DielectronPairsPerJetMCP, splittingMatchesGeoVecVecMCP, splittingMatchesPtVecVecMCP, splittingMatchesHFVecVecMCP, pairMatchesVecVecMCP, configs.jetPtMinMCP); + analyseSubstructureMatched(jetsMCP, splittingsMCP, pairsMCP, preslices.D0SplittingsPerJetMCP, preslices.DplusSplittingsPerJetMCP, preslices.DsSplittingsPerJetMCP, preslices.DstarSplittingsPerJetMCP, preslices.LcSplittingsPerJetMCP, preslices.B0SplittingsPerJetMCP, preslices.BplusSplittingsPerJetMCP, preslices.XicToXiPiPiSplittingsPerJetMCP, preslices.DielectronSplittingsPerJetMCP, preslices.D0PairsPerJetMCP, preslices.DplusPairsPerJetMCP, preslices.DsPairsPerJetMCP, preslices.DstarPairsPerJetMCP, preslices.LcPairsPerJetMCP, preslices.B0PairsPerJetMCP, preslices.BplusPairsPerJetMCP, preslices.XicToXiPiPiPairsPerJetMCP, preslices.DielectronPairsPerJetMCP, splittingMatchesGeoVecVecMCP, splittingMatchesPtVecVecMCP, splittingMatchesHFVecVecMCP, pairMatchesVecVecMCP, configs.jetPtMinMCP); } PROCESS_SWITCH(JetSubstructureHFOutputTask, processOutputSubstructureMatchingMC, "jet substructure matching output MC", false); diff --git a/PWGJE/Tasks/jetSubstructureXicToXiPiPi.cxx b/PWGJE/Tasks/jetSubstructureXicToXiPiPi.cxx new file mode 100644 index 00000000000..ca58df3a425 --- /dev/null +++ b/PWGJE/Tasks/jetSubstructureXicToXiPiPi.cxx @@ -0,0 +1,39 @@ +// 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. + +// jet substructure XicToXiPiPi charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/Tasks/jetSubstructureHF.cxx" + +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/DataModel/JetSubstructure.h" +#include "PWGJE/DataModel/JetSubtraction.h" + +#include +#include +#include +#include +#include + +#include + +using JetSubstructureXicToXiPiPi = JetSubstructureHFTask, soa::Join, soa::Join, soa::Join, aod::CandidatesXicToXiPiPiData, aod::CandidatesXicToXiPiPiMCP, aod::XicToXiPiPiCJetSSs, aod::XicToXiPiPiChargedSPs, aod::XicToXiPiPiChargedPRs, aod::XicToXiPiPiCMCDJetSSs, aod::XicToXiPiPiChargedMCDetectorLevelSPs, aod::XicToXiPiPiChargedMCDetectorLevelPRs, aod::XicToXiPiPiCMCPJetSSs, aod::XicToXiPiPiChargedMCParticleLevelSPs, aod::XicToXiPiPiChargedMCParticleLevelPRs, aod::XicToXiPiPiCEWSJetSSs, aod::XicToXiPiPiChargedEventWiseSubtractedSPs, aod::XicToXiPiPiChargedEventWiseSubtractedPRs, aod::JTrackXicToXiPiPiSubs>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, + SetDefaultProcesses{}, + TaskName{"jet-substructure-xictoxipipi"})); + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/Tasks/jetSubstructureXicToXiPiPiOutput.cxx b/PWGJE/Tasks/jetSubstructureXicToXiPiPiOutput.cxx new file mode 100644 index 00000000000..93d3f884090 --- /dev/null +++ b/PWGJE/Tasks/jetSubstructureXicToXiPiPiOutput.cxx @@ -0,0 +1,40 @@ +// 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. + +// jet substructure output XicToXiPiPi charged task +// +/// \author Nima Zardoshti + +#include "PWGJE/Tasks/jetSubstructureHFOutput.cxx" + +#include "PWGHF/DataModel/DerivedTables.h" +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/DataModel/JetReducedDataHF.h" +#include "PWGJE/DataModel/JetSubstructure.h" +#include "PWGJE/DataModel/JetSubtraction.h" + +#include +#include +#include +#include +#include + +#include + +using JetSubstructureOutputXicToXiPiPi = JetSubstructureHFOutputTask, aod::McCollisionsXicToXiPiPi, aod::CandidatesXicToXiPiPiData, aod::CandidatesXicToXiPiPiMCD, aod::CandidatesXicToXiPiPiMCP, aod::BkgXicToXiPiPiRhos, aod::BkgXicToXiPiPiMcRhos, aod::JTrackXicToXiPiPiSubs, soa::Join, soa::Join, soa::Join, soa::Join, aod::XicToXiPiPiCJetCOs, aod::XicToXiPiPiCJetOs, aod::XicToXiPiPiCJetSSOs, aod::XicToXiPiPiCJetMOs, soa::Join, soa::Join, soa::Join, aod::XicToXiPiPiCMCDJetCOs, aod::XicToXiPiPiCMCDJetOs, aod::XicToXiPiPiCMCDJetSSOs, aod::XicToXiPiPiCMCDJetMOs, soa::Join, soa::Join, soa::Join, soa::Join, aod::XicToXiPiPiCMCPJetCOs, aod::XicToXiPiPiCMCPJetMCCOs, aod::XicToXiPiPiCMCPJetOs, aod::XicToXiPiPiCMCPJetSSOs, aod::XicToXiPiPiCMCPJetMOs, soa::Join, soa::Join, soa::Join, aod::XicToXiPiPiCEWSJetCOs, aod::XicToXiPiPiCEWSJetOs, aod::XicToXiPiPiCEWSJetSSOs, aod::XicToXiPiPiCEWSJetMOs, aod::StoredHfXicToXiPiPiCollBase, aod::StoredHfXicToXiPiPiBases, aod::StoredHfXicToXiPiPiPars, aod::StoredHfXicToXiPiPiParEs, aod::JDumXicToXiPiPiParDaus, aod::StoredHfXicToXiPiPiSels, aod::StoredHfXicToXiPiPiMls, aod::JDumXicToXiPiPiMlDaus, aod::StoredHfXicToXiPiPiMcs, aod::StoredHfXicToXiPiPiMcCollBases, aod::StoredHfXicToXiPiPiMcRCollIds, aod::StoredHfXicToXiPiPiPBases>; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-substructure-xictoxipipi-output"})); + + return WorkflowSpec{tasks}; +} From f216f7c0c71e361edf1df6625d66cd0cc6269567 Mon Sep 17 00:00:00 2001 From: GijsvWeelden <55794847+GijsvWeelden@users.noreply.github.com> Date: Wed, 20 Aug 2025 15:21:17 +0200 Subject: [PATCH 119/986] [PWGJE] V0 Jet Finder (#12636) --- PWGJE/JetFinders/jetFinder.cxx | 6 +++--- PWGJE/JetFinders/jetFinderHF.cxx | 4 ++-- PWGJE/JetFinders/jetFinderV0.cxx | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/PWGJE/JetFinders/jetFinder.cxx b/PWGJE/JetFinders/jetFinder.cxx index 990286c61eb..93a257360c9 100644 --- a/PWGJE/JetFinders/jetFinder.cxx +++ b/PWGJE/JetFinders/jetFinder.cxx @@ -157,9 +157,9 @@ struct JetFinderTask { double jetPtMaxDouble = static_cast(jetPtMaxInt); if (fillTHnSparse) { - registry.add("hJet", "sparse for data or mcd jets", {HistType::kTHnC, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); - registry.add("hJetEWS", "sparse for data or mcd event-wise subtracted jets", {HistType::kTHnC, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); - registry.add("hJetMCP", "sparse for mcp jets", {HistType::kTHnC, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); + registry.add("hJet", "sparse for data or mcd jets", {HistType::kTHnD, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); + registry.add("hJetEWS", "sparse for data or mcd event-wise subtracted jets", {HistType::kTHnD, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); + registry.add("hJetMCP", "sparse for mcp jets", {HistType::kTHnD, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); } } diff --git a/PWGJE/JetFinders/jetFinderHF.cxx b/PWGJE/JetFinders/jetFinderHF.cxx index d9b988c7abc..b32921de7b7 100644 --- a/PWGJE/JetFinders/jetFinderHF.cxx +++ b/PWGJE/JetFinders/jetFinderHF.cxx @@ -163,8 +163,8 @@ struct JetFinderHFTask { double jetPtMinDouble = static_cast(jetPtMinInt); double jetPtMaxDouble = static_cast(jetPtMaxInt); - registry.add("hJet", "sparse for data or mcd jets", {HistType::kTHnC, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); - registry.add("hJetMCP", "sparse for mcp jets", {HistType::kTHnC, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); + registry.add("hJet", "sparse for data or mcd jets", {HistType::kTHnD, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); + registry.add("hJetMCP", "sparse for mcp jets", {HistType::kTHnD, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); } aod::EMCALClusterDefinition clusterDefinition = aod::emcalcluster::getClusterDefinitionFromString(clusterDefinitionS.value); diff --git a/PWGJE/JetFinders/jetFinderV0.cxx b/PWGJE/JetFinders/jetFinderV0.cxx index 6d8b94d905a..ef4aaba93ab 100644 --- a/PWGJE/JetFinders/jetFinderV0.cxx +++ b/PWGJE/JetFinders/jetFinderV0.cxx @@ -153,8 +153,8 @@ struct JetFinderV0Task { double jetPtMinDouble = static_cast(jetPtMinInt); double jetPtMaxDouble = static_cast(jetPtMaxInt); - registry.add("hJet", "sparse for data or mcd jets", {HistType::kTHnC, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); - registry.add("hJetMCP", "sparse for mcp jets", {HistType::kTHnC, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); + registry.add("hJet", "sparse for data or mcd jets", {HistType::kTHnD, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); + registry.add("hJetMCP", "sparse for mcp jets", {HistType::kTHnD, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); } Filter collisionFilter = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centFT0M >= centralityMin && aod::jcollision::centFT0M < centralityMax && aod::jcollision::trackOccupancyInTimeRange <= trackOccupancyInTimeRangeMax && ((skipMBGapEvents.node() == false) || (aod::jcollision::subGeneratorId != static_cast(jetderiveddatautilities::JCollisionSubGeneratorId::mbGap)))); From 356abf4d6ecf3c1c7f6fc5e98a9491c5f16b73e0 Mon Sep 17 00:00:00 2001 From: CyF1rmiana <3326561594@qq.com> Date: Wed, 20 Aug 2025 22:24:14 +0800 Subject: [PATCH 120/986] [PWGCF] Modify the file to select polarization (#12645) --- PWGCF/Flow/Tasks/flowEseTask.cxx | 1297 ++++++++++++++++++++++-------- 1 file changed, 947 insertions(+), 350 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowEseTask.cxx b/PWGCF/Flow/Tasks/flowEseTask.cxx index 15bb95d27be..6ab2155788a 100644 --- a/PWGCF/Flow/Tasks/flowEseTask.cxx +++ b/PWGCF/Flow/Tasks/flowEseTask.cxx @@ -9,443 +9,1040 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \author Junlee Kim (jikim1290@gmail.com) /// \file flowEseTask.cxx /// \brief Task for flow and event shape engineering correlation with other observation. -/// \author Alice Collaboration /// \since 2023-05-15 /// \version 1.0 -/// -/// This task calculates flow and event shape engineering -/// using Q-vector and event plane methods. - -// C++/ROOT includes. -#include -#include -#include -#include -#include -#include -#include -#include +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGMM/Mult/DataModel/Index.h" // for Particles2Tracks table -// o2Physics includes. -#include "Common/Core/EventPlaneHelper.h" +#include "Common/Core/RecoDecay.h" #include "Common/Core/TrackSelection.h" +#include "Common/Core/trackUtilities.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseITS.h" #include "Common/DataModel/Qvectors.h" #include "Common/DataModel/TrackSelectionTables.h" +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CcdbApi.h" #include "CommonConstants/PhysicsConstants.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" -#include "Framework/RunningWorkflowInfo.h" +#include "Framework/O2DatabasePDGPlugin.h" #include "Framework/StaticFor.h" +#include "Framework/StepTHn.h" #include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" -// o2 includes. +#include "Math/GenVector/Boost.h" +#include "Math/Vector3D.h" +#include "Math/Vector4D.h" +#include "TF1.h" +#include "TRandom3.h" +#include "TVector2.h" +#include + +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; - -using MyCollisions = soa::Join; -using MyTracks = soa::Join; -using BCsWithRun3Matchings = soa::Join; +using namespace o2::framework::expressions; +using namespace o2::soa; +using namespace o2::constants::physics; struct FlowEseTask { - HistogramRegistry histosQA{"histosQA", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; + // using EventCandidates = soa::Filtered>; + using EventCandidates = soa::Join; + using TrackCandidates = soa::Join; + using V0TrackCandidate = aod::V0Datas; + + HistogramRegistry histos{ + "histos", + {}, + OutputObjHandlingPolicy::AnalysisObject}; + + struct : ConfigurableGroup { + Configurable cfgURL{"cfgURL", + "http://alice-ccdb.cern.ch", "Address of the CCDB to browse"}; + Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "Latest acceptable timestamp of creation for the object"}; + } cfgCcdbParam; + Service ccdb; + o2::ccdb::CcdbApi ccdbApi; + + Configurable cfgCentSel{"cfgCentSel", 80., "Centrality selection"}; + Configurable cfgCentEst{"cfgCentEst", 1, "Centrality estimator, 1: FT0C, 2: FT0M"}; + + Configurable cfgPVSel{"cfgPVSel", false, "Additional PV selection flag for syst"}; + Configurable cfgPV{"cfgPV", 8.0, "Additional PV selection range for syst"}; + Configurable cfgAddEvtSelPileup{"cfgAddEvtSelPileup", false, "flag for additional pileup selection"}; + Configurable cfgMaxOccupancy{"cfgMaxOccupancy", 999999, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; + Configurable cfgMinOccupancy{"cfgMinOccupancy", 0, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; + + Configurable cfgv0radiusMin{"cfgv0radiusMin", 1.2, "minimum decay radius"}; + Configurable cfgDCAPrToPVMin{"cfgDCAPrToPVMin", 0.05, "minimum DCA to PV for proton track"}; + Configurable cfgDCAPiToPVMin{"cfgDCAPiToPVMin", 0.1, "minimum DCA to PV for pion track"}; + Configurable cfgv0CosPA{"cfgv0CosPA", 0.995, "minimum v0 cosine"}; + Configurable cfgDCAV0Dau{"cfgDCAV0Dau", 1.0, "maximum DCA between daughters"}; + + Configurable cfgV0PtMin{"cfgV0PtMin", 0, "minimum pT for lambda"}; + Configurable cfgV0EtaMin{"cfgV0EtaMin", -0.5, "maximum rapidity"}; + Configurable cfgV0EtaMax{"cfgV0EtaMax", 0.5, "maximum rapidity"}; + Configurable cfgV0LifeTime{"cfgV0LifeTime", 30., "maximum lambda lifetime"}; - Configurable> cfgNmods{"cfgNmods", {2}, "Modulation of interest"}; - Configurable cfgDetName{"cfgDetName", "FT0C", "The name of detector to be analyzed"}; - Configurable cfgRefAName{"cfgRefAName", "TPCpos", "The name of detector for reference A"}; - Configurable cfgRefBName{"cfgRefBName", "TPCneg", "The name of detector for reference B"}; + Configurable cfgQAv0{"cfgQAv0", true, "QA plot"}; - Configurable cfgMinPt{"cfgMinPt", 0.15f, "Minimum transverse momentum for charged track"}; - Configurable cfgMaxEta{"cfgMaxEta", 0.8f, "Maximum pseudorapidiy for charged track"}; - Configurable cfgMaxDCArToPVcut{"cfgMaxDCArToPVcut", 0.1f, "Maximum transverse DCA"}; - Configurable cfgMaxDCAzToPVcut{"cfgMaxDCAzToPVcut", 1.0f, "Maximum longitudinal DCA"}; + Configurable cfgDaughTPCnclsMin{"cfgDaughTPCnclsMin", 70, "minimum fired crossed rows"}; + Configurable cfgDaughPIDCutsTPCPr{"cfgDaughPIDCutsTPCPr", 5, "proton nsigma for TPC"}; + Configurable cfgDaughPIDCutsTPCPi{"cfgDaughPIDCutsTPCPi", 5, "pion nsigma for TPC"}; + Configurable cfgDaughEtaMin{"cfgDaughEtaMin", -0.8, "minimum daughter eta"}; + Configurable cfgDaughEtaMax{"cfgDaughEtaMax", 0.8, "maximum daughter eta"}; + Configurable cfgDaughPrPt{"cfgDaughPrPt", 0.5, "minimum daughter proton pt"}; + Configurable cfgDaughPiPt{"cfgDaughPiPt", 0.5, "minimum daughter pion pt"}; - ConfigurableAxis cfgAxisQvecF{"cfgAxisQvecF", {300, -1, 1}, ""}; - ConfigurableAxis cfgAxisQvec{"cfgAxisQvec", {100, -3, 3}, ""}; - ConfigurableAxis cfgAxisCent{"cfgAxisCent", {100, 0, 100}, ""}; + Configurable cfgnMods{"cfgnMods", 1, "The number of modulations of interest starting from 2"}; + Configurable cfgNQvec{"cfgNQvec", 7, "The number of total Qvectors for looping over the task"}; - ConfigurableAxis cfgAxisCos{"cfgAxisCos", {102, -1.02, 1.02}, ""}; - ConfigurableAxis cfgAxisPt{"cfgAxisPt", {100, 0, 10}, ""}; - ConfigurableAxis cfgAxisCentMerged{"cfgAxisCentMerged", {20, 0, 100}, ""}; - ConfigurableAxis cfgAxisMultNum{"cfgAxisMultNum", {300, 0, 2700}, ""}; - ConfigurableAxis cfgaxisQ{"cfgaxisQ", {1000, 0, 1000}, ""}; + Configurable cfgQvecDetName{"cfgQvecDetName", "FT0C", "The name of detector to be analyzed"}; + Configurable cfgQvecRefAName{"cfgQvecRefAName", "TPCpos", "The name of detector for reference A"}; + Configurable cfgQvecRefBName{"cfgQvecRefBName", "TPCneg", "The name of detector for reference B"}; - static constexpr float kMinAmplitudeThreshold = 1e-4f; - static constexpr int kDefaultModulation = 2; - static constexpr std::array kCent = {0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}; - static constexpr std::array kSeparator = {125, 204, 110, 172, 92, 143, 74, 116, 57, 92, 43, 70, 31, 50, 21, 34, 14, 22, 5, 9}; + Configurable cfgPhiDepStudy{"cfgPhiDepStudy", false, "cfg for phi dependent study"}; + Configurable cfgUSESP{"cfgUSESP", false, "cfg for sp"}; + Configurable cfgPhiDepSig{"cfgPhiDepSig", 0.2, "cfg for significance on phi dependent study"}; - EventPlaneHelper helperEP; + Configurable cfgShiftCorr{"cfgShiftCorr", false, "additional shift correction"}; + Configurable cfgShiftCorrDef{"cfgShiftCorrDef", false, "additional shift correction definition"}; + Configurable cfgShiftPath{"cfgShiftPath", "Users/j/junlee/Qvector/QvecCalib/Shift", "Path for Shift"}; - void init(InitContext const&) + Configurable cfgEffCor{"cfgEffCor", false, "flag to apply efficiency correction"}; + Configurable cfgEffCorPath{"cfgEffCorPath", "", "path for pseudo efficiency correction"}; + + Configurable cfgAccCor{"cfgAccCor", false, "flag to apply acceptance correction"}; + Configurable cfgAccCorPath{"cfgAccCorPath", "", "path for pseudo acceptance correction"}; + + Configurable cfgCalcCum{"cfgCalcCum", false, "flag to calculate cumulants of cossin"}; + Configurable cfgCalcCum1{"cfgCalcCum1", false, "flag to calculate cumulants of coscos"}; + + Configurable cfgRapidityDep{"cfgRapidityDep", false, "flag for rapidity dependent study"}; + Configurable cfgAccAzimuth{"cfgAccAzimuth", false, "flag for azimuth closure study"}; + + ConfigurableAxis massAxis{"massAxis", {30, 1.1, 1.13}, "Invariant mass axis"}; + ConfigurableAxis ptAxis{"ptAxis", {VARIABLE_WIDTH, 0.2, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 6.5, 8.0, 10.0, 100.0}, "Transverse momentum bins"}; + ConfigurableAxis centAxis{"centAxis", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 100}, "Centrality interval"}; + ConfigurableAxis cosAxis{"cosAxis", {110, -1.05, 1.05}, "Cosine axis"}; + ConfigurableAxis rapAxis{"rapAxis", {10, -0.5, 0.5}, "Rapidity axis"}; + ConfigurableAxis qqAxis{"qqAxis", {100, -0.1, 0.1}, "qq axis"}; + ConfigurableAxis lowerQAxis{"lowerQAxis", {800, 0, 800}, "result of q2"}; + ConfigurableAxis multNumAxis{"multNumAxis", {300, 0, 2700}, "mult num"}; + ConfigurableAxis qvecAxis{"qvecAxis", {300, -1, 1}, "range of Qvector"}; + + static constexpr float kMinAmplitudeThreshold = 1e-5f; + static constexpr int kShiftLevel = 10; + static constexpr int kLambdaId = 3122; + static constexpr std::array kCorrLevel = {2, 3, 4, 1}; + static constexpr std::array kCentBoundaries = {0.0f, 3.49f, 4.93f, 6.98f, 8.55f, 9.87f, 11.0f, 12.1f, 13.1f, 14.0f}; + static constexpr std::array kCentValues = {2.5f, 7.5f, 15.0f, 25.0f, 35.0f, 45.0f, 55.0f, 65.0f, 75.0f}; + static constexpr float kEtaAcceptance = 0.8f; + static constexpr float kCentUpperLimit = 80.0f; + + TF1* fMultPVCutLow = nullptr; + TF1* fMultPVCutHigh = nullptr; + + int detId; + int refAId; + int refBId; + + int qvecDetInd; + int qvecRefAInd; + int qvecRefBInd; + + float centrality; + + double angle; + double psi; + double relphi; + + int currentRunNumber = -999; + int lastRunNumber = -999; + std::vector shiftprofile{}; + TProfile2D* effMap = nullptr; + TProfile2D* accMap = nullptr; + + std::string fullCCDBShiftCorrPath; + + template + int getDetId(const T& name) { - AxisSpec axisCent{cfgAxisCent, "centrality"}; - AxisSpec axisQvec{cfgAxisQvec, "Q"}; - AxisSpec axisQvecF{cfgAxisQvecF, "Q"}; - AxisSpec axisEvtPl = {100, -1.0 * constants::math::PI, constants::math::PI}; - - AxisSpec axisCos{cfgAxisCos, "angle function"}; - AxisSpec axisPt{cfgAxisPt, "trasverse momentum"}; - AxisSpec axisCentMerged{cfgAxisCentMerged, "merged centrality"}; - AxisSpec axisMultNum{cfgAxisMultNum, "statistic of mult"}; - AxisSpec axisQ{cfgaxisQ, "result of q2"}; - - histosQA.add(Form("histQvecV2"), "", {HistType::kTH3F, {axisQvecF, axisQvecF, axisCent}}); - histosQA.add(Form("histQvecCent"), "", {HistType::kTH2F, {axisQ, axisCent}}); - histosQA.add(Form("histEvtPlV2"), "", {HistType::kTH2F, {axisEvtPl, axisCent}}); - histosQA.add(Form("histQvecRes_SigRefAV2"), "", {HistType::kTH2F, {axisQvecF, axisCent}}); - histosQA.add(Form("histCosDetV2"), "", {HistType::kTH3F, {axisCentMerged, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_0010Left"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_0010Mid"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_0010Right"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_1020Left"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_1020Mid"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_1020Right"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_2030Left"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_2030Mid"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_2030Right"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_3040Left"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_3040Mid"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_3040Right"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_4050Left"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_4050Mid"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_4050Right"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_5060Left"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_5060Mid"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_5060Right"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_6070Left"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_6070Mid"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_6070Right"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_7080Left"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_7080Mid"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_7080Right"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_8090Left"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_8090Mid"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_8090Right"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_9010Left"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_9010Mid"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histCosDetV2_9010Right"), "", {HistType::kTH3F, {axisQvecF, axisPt, axisCos}}); - histosQA.add(Form("histMult_Cent"), "", {HistType::kTH2F, {axisMultNum, axisCent}}); + if (name.value == "FT0C") { + return 0; + } else if (name.value == "FT0A") { + return 1; + } else if (name.value == "FT0M") { + return 2; + } else if (name.value == "FV0A") { + return 3; + } else if (name.value == "TPCpos") { + return 4; + } else if (name.value == "TPCneg") { + return 5; + } else if (name.value == "TPCall") { + return 6; + } else { + return 0; + } + } + + void init(o2::framework::InitContext&) + { + AxisSpec centQaAxis = {80, 0.0, 80.0}; + AxisSpec pVzQaAxis = {300, -15.0, 15.0}; + AxisSpec epAxis = {6, 0.0, o2::constants::math::TwoPI}; + AxisSpec epQaAxis = {100, -1.0 * o2::constants::math::PI, o2::constants::math::PI}; + + AxisSpec pidAxis = {100, -10, 10}; + + AxisSpec shiftAxis = {10, 0, 10, "shift"}; + AxisSpec basisAxis = {20, 0, 20, "basis"}; + + histos.add(Form("histQvecV2"), "", {HistType::kTH3F, {qvecAxis, qvecAxis, centAxis}}); + histos.add(Form("histMult_Cent"), "", {HistType::kTH2F, {multNumAxis, centAxis}}); + histos.add(Form("histQvecCent"), "", {HistType::kTH2F, {lowerQAxis, centAxis}}); + + for (auto i = 2; i < cfgnMods + 2; i++) { + histos.add(Form("psi%d/h_lambda_cos", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis, epAxis}}); + histos.add(Form("psi%d/h_alambda_cos", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis, epAxis}}); + histos.add(Form("psi%d/h_lambda_cos2", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis, epAxis}}); + histos.add(Form("psi%d/h_alambda_cos2", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis, epAxis}}); + + if (cfgRapidityDep) { + histos.add(Form("psi%d/h_lambda_cos2_rap", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis, rapAxis}}); + histos.add(Form("psi%d/h_alambda_cos2_rap", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis, rapAxis}}); + } + + histos.add(Form("psi%d/h_lambda_cossin", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add(Form("psi%d/h_alambda_cossin", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + + if (cfgAccAzimuth) { + histos.add(Form("psi%d/h_lambda_coscos", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add(Form("psi%d/h_alambda_coscos", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + } + + histos.add(Form("psi%d/h_lambda_vncos", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add(Form("psi%d/h_lambda_vnsin", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add(Form("psi%d/h_alambda_vncos", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add(Form("psi%d/h_alambda_vnsin", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + } + histos.add("QA/ptspec_l", "", {HistType::kTH3F, {massAxis, ptAxis, centAxis}}); + histos.add("QA/ptspec_al", "", {HistType::kTH3F, {massAxis, ptAxis, centAxis}}); + histos.add("QA/ptspecCor_l", "", {HistType::kTH3F, {massAxis, ptAxis, centAxis}}); + histos.add("QA/ptspecCor_al", "", {HistType::kTH3F, {massAxis, ptAxis, centAxis}}); + + if (cfgCalcCum) { + histos.add("psi2/QA/cosTheta_l", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add("psi2/QA/cosPsi_l", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add("psi2/QA/cosPhi_l", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + + histos.add("psi2/QA/sinPsi_l", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add("psi2/QA/sinPhi_l", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + + histos.add("psi2/QA/cosTheta_cosPhi_l", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add("psi2/QA/cosTheta_cosPsi_l", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + + histos.add("psi2/QA/cosTheta_sinPhi_l", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add("psi2/QA/cosTheta_sinPsi_l", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + + histos.add("psi2/QA/cosPhi_sinPsi_l", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add("psi2/QA/sinPhi_cosPsi_l", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + + histos.add("psi2/QA/cosTheta_al", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add("psi2/QA/cosPsi_al", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add("psi2/QA/cosPhi_al", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + + histos.add("psi2/QA/sinPsi_al", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add("psi2/QA/sinPhi_al", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + + histos.add("psi2/QA/cosTheta_cosPhi_al", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add("psi2/QA/cosTheta_cosPsi_al", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + + histos.add("psi2/QA/cosTheta_sinPhi_al", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add("psi2/QA/cosTheta_sinPsi_al", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + + histos.add("psi2/QA/cosPhi_sinPsi_al", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add("psi2/QA/sinPhi_cosPsi_al", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + } + + if (cfgCalcCum1) { + histos.add("psi2/QA/cosTheta_l", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add("psi2/QA/cosPsi_l", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add("psi2/QA/cosPhi_l", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + + histos.add("psi2/QA/cosPhi_cosPsi_l", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add("psi2/QA/cosTheta_cosPhi_l", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add("psi2/QA/cosTheta_cosPsi_l", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + + histos.add("psi2/QA/sinPhi_sinPsi_l", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add("psi2/QA/cosTheta_sinPhi_l", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add("psi2/QA/cosTheta_sinPsi_l", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + + histos.add("psi2/QA/sinPsi_l", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add("psi2/QA/sinPhi_l", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + + histos.add("psi2/QA/cosTheta_al", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add("psi2/QA/cosPsi_al", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add("psi2/QA/cosPhi_al", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + + histos.add("psi2/QA/cosPhi_cosPsi_al", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add("psi2/QA/cosTheta_cosPhi_al", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add("psi2/QA/cosTheta_cosPsi_al", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + + histos.add("psi2/QA/sinPhi_sinPsi_al", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add("psi2/QA/cosTheta_sinPhi_al", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add("psi2/QA/cosTheta_sinPsi_al", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + + histos.add("psi2/QA/sinPsi_al", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add("psi2/QA/sinPhi_al", "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + } + + if (cfgQAv0) { + histos.add("QA/CentDist", "", {HistType::kTH1F, {centQaAxis}}); + histos.add("QA/PVzDist", "", {HistType::kTH1F, {pVzQaAxis}}); + + histos.add("QA/nsigma_tpc_pt_ppr", "", {HistType::kTH2F, {ptAxis, pidAxis}}); + histos.add("QA/nsigma_tpc_pt_ppi", "", {HistType::kTH2F, {ptAxis, pidAxis}}); + histos.add("QA/nsigma_tpc_pt_mpr", "", {HistType::kTH2F, {ptAxis, pidAxis}}); + histos.add("QA/nsigma_tpc_pt_mpi", "", {HistType::kTH2F, {ptAxis, pidAxis}}); + + for (auto i = 2; i < cfgnMods + 2; i++) { + histos.add(Form("psi%d/QA/EP_Det", i), "", {HistType::kTH2F, {centQaAxis, epQaAxis}}); + histos.add(Form("psi%d/QA/EP_RefA", i), "", {HistType::kTH2F, {centQaAxis, epQaAxis}}); + histos.add(Form("psi%d/QA/EP_RefB", i), "", {HistType::kTH2F, {centQaAxis, epQaAxis}}); + + histos.add(Form("psi%d/QA/qqAxis_Det_RefA_xx", i), "", {HistType::kTH2F, {centQaAxis, qqAxis}}); + histos.add(Form("psi%d/QA/qqAxis_Det_RefB_xx", i), "", {HistType::kTH2F, {centQaAxis, qqAxis}}); + histos.add(Form("psi%d/QA/qqAxis_RefA_RefB_xx", i), "", {HistType::kTH2F, {centQaAxis, qqAxis}}); + + histos.add(Form("psi%d/QA/qqAxis_Det_RefA_yy", i), "", {HistType::kTH2F, {centQaAxis, qqAxis}}); + histos.add(Form("psi%d/QA/qqAxis_Det_RefB_yy", i), "", {HistType::kTH2F, {centQaAxis, qqAxis}}); + histos.add(Form("psi%d/QA/qqAxis_RefA_RefB_yy", i), "", {HistType::kTH2F, {centQaAxis, qqAxis}}); + + histos.add(Form("psi%d/QA/EPRes_Det_RefA", i), "", {HistType::kTH2F, {centQaAxis, cosAxis}}); + histos.add(Form("psi%d/QA/EPRes_Det_RefB", i), "", {HistType::kTH2F, {centQaAxis, cosAxis}}); + histos.add(Form("psi%d/QA/EPRes_RefA_RefB", i), "", {HistType::kTH2F, {centQaAxis, cosAxis}}); + + histos.add(Form("psi%d/QA/EP_FT0C_shifted", i), "", {HistType::kTH2F, {centQaAxis, epQaAxis}}); + histos.add(Form("psi%d/QA/EP_FT0A_shifted", i), "", {HistType::kTH2F, {centQaAxis, epQaAxis}}); + histos.add(Form("psi%d/QA/EP_FV0A_shifted", i), "", {HistType::kTH2F, {centQaAxis, epQaAxis}}); + + histos.add(Form("psi%d/QA/EPRes_FT0C_FT0A_shifted", i), "", {HistType::kTH2F, {centQaAxis, cosAxis}}); + histos.add(Form("psi%d/QA/EPRes_FT0C_FV0A_shifted", i), "", {HistType::kTH2F, {centQaAxis, cosAxis}}); + histos.add(Form("psi%d/QA/EPRes_FT0A_FV0A_shifted", i), "", {HistType::kTH2F, {centQaAxis, cosAxis}}); + } + } + + if (doprocessMcItsTpc) { + histos.add("hImpactParameter", "Impact parameter", kTH1F, {{200, 0.0f, 20.0f}}); + histos.add("hEventPlaneAngle", "hEventPlaneAngle", kTH1F, {{200, -1.0 * o2::constants::math::TwoPI, 1.0 * o2::constants::math::TwoPI}}); + histos.add("hEventPlaneAngleRec", "hEventPlaneAngleRec", kTH1F, {{200, -1.0 * o2::constants::math::TwoPI, 1.0 * o2::constants::math::TwoPI}}); + histos.add("hNchVsImpactParameter", "hNchVsImpactParameter", kTH2F, {{200, 0.0f, 20.0f}, {500, -0.5f, 5000.5f}}); + histos.add("hSparseMCGenWeight", "hSparseMCGenWeight", HistType::kTHnSparseF, {centAxis, {36, 0.0f, o2::constants::math::PI}, {50, 0.0f, 1}, ptAxis, {8, -0.8, 0.8}}); + histos.add("hSparseMCRecWeight", "hSparseMCRecWeight", HistType::kTHnSparseF, {centAxis, {36, 0.0f, o2::constants::math::PI}, {50, 0.0f, 1}, ptAxis, {8, -0.8, 0.8}}); + histos.add("hSparseMCRecAllTrackWeight", "hSparseMCRecAllTrackWeight", HistType::kTHnSparseF, {centAxis, {36, 0.0, o2::constants::math::PI}, {50, 0.0f, 1}, ptAxis, {8, -0.8, 0.8}}); + } + + if (cfgShiftCorrDef) { + for (auto i = 2; i < cfgnMods + 2; i++) { + histos.add(Form("psi%d/ShiftFIT", i), "", kTProfile3D, {centQaAxis, basisAxis, shiftAxis}); + } + } + + detId = getDetId(cfgQvecDetName); + refAId = getDetId(cfgQvecRefAName); + refBId = getDetId(cfgQvecRefBName); + + if (detId == refAId || detId == refBId || refAId == refBId) { + LOGF(info, "Wrong detector configuration \n The FT0C will be used to get Q-Vector \n The TPCpos and TPCneg will be used as reference systems"); + detId = 0; + refAId = 4; + refBId = 5; + } + + fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.5*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); + fMultPVCutLow->SetParameters(2834.66, -87.0127, 0.915126, -0.00330136, 332.513, -12.3476, 0.251663, -0.00272819, 1.12242e-05); + fMultPVCutHigh = new TF1("fMultPVCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x + 2.5*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); + fMultPVCutHigh->SetParameters(2834.66, -87.0127, 0.915126, -0.00330136, 332.513, -12.3476, 0.251663, -0.00272819, 1.12242e-05); + + ccdb->setURL(cfgCcdbParam.cfgURL); + ccdbApi.init("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); } - template - bool selectEvent(CollType const& collision) + double massLambda = o2::constants::physics::MassLambda; + double massPr = o2::constants::physics::MassProton; + double massPi = o2::constants::physics::MassPionCharged; + + ROOT::Math::PxPyPzMVector protonVec, pionVec, LambdaVec, protonBoostedVec, pionBoostedVec; + + template + bool eventSelected(TCollision collision) { if (!collision.sel8()) { - return false; + return 0; } + + if (cfgCentSel < centrality) { + return 0; + } + /* + auto multNTracksPV = collision.multNTracksPV(); + if (multNTracksPV < fMultPVCutLow->Eval(centrality)) { + return 0; + } + if (multNTracksPV > fMultPVCutHigh->Eval(centrality)) { + return 0; + } + */ if (!collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { - return false; + return 0; } if (!collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { - return false; + return 0; } - if (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { - return false; + if (cfgPVSel && std::abs(collision.posZ()) > cfgPV) { + return 0; + } + if (cfgAddEvtSelPileup && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return 0; + } + if (collision.trackOccupancyInTimeRange() > cfgMaxOccupancy || collision.trackOccupancyInTimeRange() < cfgMinOccupancy) { + return 0; } - return true; - } + return 1; + } // event selection - template - bool selectTrack(TrackType const& track) + template + bool selectionV0(TCollision const& collision, V0 const& candidate, int lambdaTag) { - if (track.pt() < cfgMinPt) { + if (candidate.v0radius() < cfgv0radiusMin) return false; + if (lambdaTag) { + if (std::abs(candidate.dcapostopv()) < cfgDCAPrToPVMin) + return false; + if (std::abs(candidate.dcanegtopv()) < cfgDCAPiToPVMin) + return false; + } else if (!lambdaTag) { + if (std::abs(candidate.dcapostopv()) < cfgDCAPiToPVMin) + return false; + if (std::abs(candidate.dcanegtopv()) < cfgDCAPrToPVMin) + return false; } - if (std::abs(track.eta()) > cfgMaxEta) { + if (candidate.v0cosPA() < cfgv0CosPA) return false; - } - if (!track.passedITSNCls()) { + if (std::abs(candidate.dcaV0daughters()) > cfgDCAV0Dau) return false; - } - if (!track.passedITSChi2NDF()) { + if (candidate.pt() < cfgV0PtMin) return false; - } - if (!track.passedITSHits()) { + if (candidate.yLambda() < cfgV0EtaMin) return false; - } - if (!track.passedTPCCrossedRowsOverNCls()) { + if (candidate.yLambda() > cfgV0EtaMax) return false; - } - if (!track.passedTPCChi2NDF()) { + if (candidate.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * massLambda > cfgV0LifeTime) return false; - } - if (!track.passedDCAxy()) { + + return true; + } + + template + bool isSelectedV0Daughter(T const& track, int pid) // pid 0: proton, pid 1: pion + { + if (track.tpcNClsFound() < cfgDaughTPCnclsMin) return false; - } - if (!track.passedDCAz()) { + if (pid == 0 && std::abs(track.tpcNSigmaPr()) > cfgDaughPIDCutsTPCPr) + return false; + if (pid == 1 && std::abs(track.tpcNSigmaPi()) > cfgDaughPIDCutsTPCPi) + return false; + if (track.eta() > cfgDaughEtaMax) + return false; + if (track.eta() < cfgDaughEtaMin) + return false; + if (pid == 0 && track.pt() < cfgDaughPrPt) + return false; + if (pid == 1 && track.pt() < cfgDaughPiPt) return false; - } return true; } - template - void fillHistosQvec(CollType const& collision, int nmode) + template + void fillShiftCorrection(TCollision const& collision, int nmode) { - if (nmode == kDefaultModulation) { - histosQA.fill(HIST("histQvecV2"), collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], - collision.centFT0C()); - histosQA.fill(HIST("histQvecCent"), std::sqrt(collision.qvecFT0CReVec()[0] * collision.qvecFT0CReVec()[0] + collision.qvecFT0CImVec()[0] * collision.qvecFT0CImVec()[0]) * std::sqrt(collision.sumAmplFT0C()), collision.centFT0C()); - histosQA.fill(HIST("histEvtPlV2"), - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), - collision.centFT0C()); - histosQA.fill(HIST("histQvecRes_SigRefAV2"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), - collision.centFT0C()); - histosQA.fill(HIST("histMult_Cent"), collision.sumAmplFT0C(), collision.centFT0C()); + qvecDetInd = detId * 4 + 3 + (nmode - 2) * cfgNQvec * 4; + qvecRefAInd = refAId * 4 + 3 + (nmode - 2) * cfgNQvec * 4; + qvecRefBInd = refBId * 4 + 3 + (nmode - 2) * cfgNQvec * 4; + + for (int ishift = 1; ishift <= kShiftLevel; ishift++) { + if (nmode == kCorrLevel[0]) { + histos.fill(HIST("psi2/ShiftFIT"), centrality, 0.5, ishift - 0.5, std::sin(ishift * static_cast(nmode) * std::atan2(collision.qvecIm()[qvecDetInd], collision.qvecRe()[qvecDetInd]) / static_cast(nmode))); + histos.fill(HIST("psi2/ShiftFIT"), centrality, 1.5, ishift - 0.5, std::cos(ishift * static_cast(nmode) * std::atan2(collision.qvecIm()[qvecDetInd], collision.qvecRe()[qvecDetInd]) / static_cast(nmode))); + + histos.fill(HIST("psi2/ShiftFIT"), centrality, 2.5, ishift - 0.5, std::sin(ishift * static_cast(nmode) * std::atan2(collision.qvecIm()[qvecRefAInd], collision.qvecRe()[qvecRefAInd]) / static_cast(nmode))); + histos.fill(HIST("psi2/ShiftFIT"), centrality, 3.5, ishift - 0.5, std::cos(ishift * static_cast(nmode) * std::atan2(collision.qvecIm()[qvecRefAInd], collision.qvecRe()[qvecRefAInd]) / static_cast(nmode))); + + histos.fill(HIST("psi2/ShiftFIT"), centrality, 4.5, ishift - 0.5, std::sin(ishift * static_cast(nmode) * std::atan2(collision.qvecIm()[qvecRefBInd], collision.qvecRe()[qvecRefBInd]) / static_cast(nmode))); + histos.fill(HIST("psi2/ShiftFIT"), centrality, 5.5, ishift - 0.5, std::cos(ishift * static_cast(nmode) * std::atan2(collision.qvecIm()[qvecRefBInd], collision.qvecRe()[qvecRefBInd]) / static_cast(nmode))); + } else if (nmode == kCorrLevel[1]) { + histos.fill(HIST("psi3/ShiftFIT"), centrality, 0.5, ishift - 0.5, std::sin(ishift * static_cast(nmode) * std::atan2(collision.qvecIm()[qvecDetInd], collision.qvecRe()[qvecDetInd]) / static_cast(nmode))); + histos.fill(HIST("psi3/ShiftFIT"), centrality, 1.5, ishift - 0.5, std::cos(ishift * static_cast(nmode) * std::atan2(collision.qvecIm()[qvecDetInd], collision.qvecRe()[qvecDetInd]) / static_cast(nmode))); + + histos.fill(HIST("psi3/ShiftFIT"), centrality, 2.5, ishift - 0.5, std::sin(ishift * static_cast(nmode) * std::atan2(collision.qvecIm()[qvecRefAInd], collision.qvecRe()[qvecRefAInd]) / static_cast(nmode))); + histos.fill(HIST("psi3/ShiftFIT"), centrality, 3.5, ishift - 0.5, std::cos(ishift * static_cast(nmode) * std::atan2(collision.qvecIm()[qvecRefAInd], collision.qvecRe()[qvecRefAInd]) / static_cast(nmode))); + + histos.fill(HIST("psi3/ShiftFIT"), centrality, 4.5, ishift - 0.5, std::sin(ishift * static_cast(nmode) * std::atan2(collision.qvecIm()[qvecRefBInd], collision.qvecRe()[qvecRefBInd]) / static_cast(nmode))); + histos.fill(HIST("psi3/ShiftFIT"), centrality, 5.5, ishift - 0.5, std::cos(ishift * static_cast(nmode) * std::atan2(collision.qvecIm()[qvecRefBInd], collision.qvecRe()[qvecRefBInd]) / static_cast(nmode))); + } else if (nmode == kCorrLevel[2]) { + histos.fill(HIST("psi4/ShiftFIT"), centrality, 0.5, ishift - 0.5, std::sin(ishift * static_cast(nmode) * std::atan2(collision.qvecIm()[qvecDetInd], collision.qvecRe()[qvecDetInd]) / static_cast(nmode))); + histos.fill(HIST("psi4/ShiftFIT"), centrality, 1.5, ishift - 0.5, std::cos(ishift * static_cast(nmode) * std::atan2(collision.qvecIm()[qvecDetInd], collision.qvecRe()[qvecDetInd]) / static_cast(nmode))); + + histos.fill(HIST("psi4/ShiftFIT"), centrality, 2.5, ishift - 0.5, std::sin(ishift * static_cast(nmode) * std::atan2(collision.qvecIm()[qvecRefAInd], collision.qvecRe()[qvecRefAInd]) / static_cast(nmode))); + histos.fill(HIST("psi4/ShiftFIT"), centrality, 3.5, ishift - 0.5, std::cos(ishift * static_cast(nmode) * std::atan2(collision.qvecIm()[qvecRefAInd], collision.qvecRe()[qvecRefAInd]) / static_cast(nmode))); + + histos.fill(HIST("psi4/ShiftFIT"), centrality, 4.5, ishift - 0.5, std::sin(ishift * static_cast(nmode) * std::atan2(collision.qvecIm()[qvecRefBInd], collision.qvecRe()[qvecRefBInd]) / static_cast(nmode))); + histos.fill(HIST("psi4/ShiftFIT"), centrality, 5.5, ishift - 0.5, std::cos(ishift * static_cast(nmode) * std::atan2(collision.qvecIm()[qvecRefBInd], collision.qvecRe()[qvecRefBInd]) / static_cast(nmode))); + } } } - template - void fillHistosFlow(CollType const& collision, TrackType const& tracks, int nmode) + template + void fillEPQA(TCollision const& collision, int nmode) { - double q2 = std::sqrt(collision.qvecFT0CReVec()[0] * collision.qvecFT0CReVec()[0] + collision.qvecFT0CImVec()[0] * collision.qvecFT0CImVec()[0]) * std::sqrt(collision.sumAmplFT0C()); - if (collision.sumAmplFT0C() < kMinAmplitudeThreshold) { + qvecDetInd = detId * 4 + 3 + (nmode - 2) * cfgNQvec * 4; + qvecRefAInd = refAId * 4 + 3 + (nmode - 2) * cfgNQvec * 4; + qvecRefBInd = refBId * 4 + 3 + (nmode - 2) * cfgNQvec * 4; + + if (collision.qvecAmp()[detId] < kMinAmplitudeThreshold || collision.qvecAmp()[refAId] < kMinAmplitudeThreshold || collision.qvecAmp()[refBId] < kMinAmplitudeThreshold) return; + + if (nmode == kCorrLevel[0]) { + histos.fill(HIST("psi2/QA/EP_Det"), centrality, std::atan2(collision.qvecIm()[qvecDetInd], collision.qvecRe()[qvecDetInd]) / static_cast(nmode)); + histos.fill(HIST("psi2/QA/EP_RefA"), centrality, std::atan2(collision.qvecIm()[qvecRefAInd], collision.qvecRe()[qvecRefAInd]) / static_cast(nmode)); + histos.fill(HIST("psi2/QA/EP_RefB"), centrality, std::atan2(collision.qvecIm()[qvecRefBInd], collision.qvecRe()[qvecRefBInd]) / static_cast(nmode)); + + histos.fill(HIST("psi2/QA/qqAxis_Det_RefA_xx"), centrality, collision.qvecRe()[qvecDetInd] * collision.qvecRe()[qvecRefAInd]); + histos.fill(HIST("psi2/QA/qqAxis_Det_RefB_xx"), centrality, collision.qvecRe()[qvecDetInd] * collision.qvecRe()[qvecRefBInd]); + histos.fill(HIST("psi2/QA/qqAxis_RefA_RefB_xx"), centrality, collision.qvecRe()[qvecRefAInd] * collision.qvecRe()[qvecRefBInd]); + + histos.fill(HIST("psi2/QA/qqAxis_Det_RefA_yy"), centrality, collision.qvecIm()[qvecDetInd] * collision.qvecIm()[qvecRefAInd]); + histos.fill(HIST("psi2/QA/qqAxis_Det_RefB_yy"), centrality, collision.qvecIm()[qvecDetInd] * collision.qvecIm()[qvecRefBInd]); + histos.fill(HIST("psi2/QA/qqAxis_RefA_RefB_yy"), centrality, collision.qvecIm()[qvecRefAInd] * collision.qvecIm()[qvecRefBInd]); + + histos.fill(HIST("psi2/QA/EPRes_Det_RefA"), centrality, std::cos(std::atan2(collision.qvecIm()[qvecDetInd], collision.qvecRe()[qvecDetInd]) - std::atan2(collision.qvecIm()[qvecRefAInd], collision.qvecRe()[qvecRefAInd]))); + histos.fill(HIST("psi2/QA/EPRes_Det_RefB"), centrality, std::cos(std::atan2(collision.qvecIm()[qvecDetInd], collision.qvecRe()[qvecDetInd]) - std::atan2(collision.qvecIm()[qvecRefBInd], collision.qvecRe()[qvecRefBInd]))); + histos.fill(HIST("psi2/QA/EPRes_RefA_RefB"), centrality, std::cos(std::atan2(collision.qvecIm()[qvecRefAInd], collision.qvecRe()[qvecRefAInd]) - std::atan2(collision.qvecIm()[qvecRefBInd], collision.qvecRe()[qvecRefBInd]))); + } else if (nmode == kCorrLevel[1]) { + histos.fill(HIST("psi3/QA/EP_Det"), centrality, std::atan2(collision.qvecIm()[qvecDetInd], collision.qvecRe()[qvecDetInd]) / static_cast(nmode)); + histos.fill(HIST("psi3/QA/EP_RefA"), centrality, std::atan2(collision.qvecIm()[qvecRefAInd], collision.qvecRe()[qvecRefAInd]) / static_cast(nmode)); + histos.fill(HIST("psi3/QA/EP_RefB"), centrality, std::atan2(collision.qvecIm()[qvecRefBInd], collision.qvecRe()[qvecRefBInd]) / static_cast(nmode)); + + histos.fill(HIST("psi3/QA/qqAxis_Det_RefA_xx"), centrality, collision.qvecRe()[qvecDetInd] * collision.qvecRe()[qvecRefAInd]); + histos.fill(HIST("psi3/QA/qqAxis_Det_RefB_xx"), centrality, collision.qvecRe()[qvecDetInd] * collision.qvecRe()[qvecRefBInd]); + histos.fill(HIST("psi3/QA/qqAxis_RefA_RefB_xx"), centrality, collision.qvecRe()[qvecRefAInd] * collision.qvecRe()[qvecRefBInd]); + + histos.fill(HIST("psi3/QA/qqAxis_Det_RefA_yy"), centrality, collision.qvecIm()[qvecDetInd] * collision.qvecIm()[qvecRefAInd]); + histos.fill(HIST("psi3/QA/qqAxis_Det_RefB_yy"), centrality, collision.qvecIm()[qvecDetInd] * collision.qvecIm()[qvecRefBInd]); + histos.fill(HIST("psi3/QA/qqAxis_RefA_RefB_yy"), centrality, collision.qvecIm()[qvecRefAInd] * collision.qvecIm()[qvecRefBInd]); + + histos.fill(HIST("psi3/QA/EPRes_Det_RefA"), centrality, std::cos(std::atan2(collision.qvecIm()[qvecDetInd], collision.qvecRe()[qvecDetInd]) - std::atan2(collision.qvecIm()[qvecRefAInd], collision.qvecRe()[qvecRefAInd]))); + histos.fill(HIST("psi3/QA/EPRes_Det_RefB"), centrality, std::cos(std::atan2(collision.qvecIm()[qvecDetInd], collision.qvecRe()[qvecDetInd]) - std::atan2(collision.qvecIm()[qvecRefBInd], collision.qvecRe()[qvecRefBInd]))); + histos.fill(HIST("psi3/QA/EPRes_RefA_RefB"), centrality, std::cos(std::atan2(collision.qvecIm()[qvecRefAInd], collision.qvecRe()[qvecRefAInd]) - std::atan2(collision.qvecIm()[qvecRefBInd], collision.qvecRe()[qvecRefBInd]))); + } else if (nmode == kCorrLevel[2]) { + histos.fill(HIST("psi4/QA/EP_Det"), centrality, std::atan2(collision.qvecIm()[qvecDetInd], collision.qvecRe()[qvecDetInd]) / static_cast(nmode)); + histos.fill(HIST("psi4/QA/EP_RefA"), centrality, std::atan2(collision.qvecIm()[qvecRefAInd], collision.qvecRe()[qvecRefAInd]) / static_cast(nmode)); + histos.fill(HIST("psi4/QA/EP_RefB"), centrality, std::atan2(collision.qvecIm()[qvecRefBInd], collision.qvecRe()[qvecRefBInd]) / static_cast(nmode)); + + histos.fill(HIST("psi4/QA/qqAxis_Det_RefA_xx"), centrality, collision.qvecRe()[qvecDetInd] * collision.qvecRe()[qvecRefAInd]); + histos.fill(HIST("psi4/QA/qqAxis_Det_RefB_xx"), centrality, collision.qvecRe()[qvecDetInd] * collision.qvecRe()[qvecRefBInd]); + histos.fill(HIST("psi4/QA/qqAxis_RefA_RefB_xx"), centrality, collision.qvecRe()[qvecRefAInd] * collision.qvecRe()[qvecRefBInd]); + + histos.fill(HIST("psi4/QA/qqAxis_Det_RefA_yy"), centrality, collision.qvecIm()[qvecDetInd] * collision.qvecIm()[qvecRefAInd]); + histos.fill(HIST("psi4/QA/qqAxis_Det_RefB_yy"), centrality, collision.qvecIm()[qvecDetInd] * collision.qvecIm()[qvecRefBInd]); + histos.fill(HIST("psi4/QA/qqAxis_RefA_RefB_yy"), centrality, collision.qvecIm()[qvecRefAInd] * collision.qvecIm()[qvecRefBInd]); + + histos.fill(HIST("psi4/QA/EPRes_Det_RefA"), centrality, std::cos(std::atan2(collision.qvecIm()[qvecDetInd], collision.qvecRe()[qvecDetInd]) - std::atan2(collision.qvecIm()[qvecRefAInd], collision.qvecRe()[qvecRefAInd]))); + histos.fill(HIST("psi4/QA/EPRes_Det_RefB"), centrality, std::cos(std::atan2(collision.qvecIm()[qvecDetInd], collision.qvecRe()[qvecDetInd]) - std::atan2(collision.qvecIm()[qvecRefBInd], collision.qvecRe()[qvecRefBInd]))); + histos.fill(HIST("psi4/QA/EPRes_RefA_RefB"), centrality, std::cos(std::atan2(collision.qvecIm()[qvecRefAInd], collision.qvecRe()[qvecRefAInd]) - std::atan2(collision.qvecIm()[qvecRefBInd], collision.qvecRe()[qvecRefBInd]))); + } + + if (cfgShiftCorr) { + auto deltapsiFT0C = 0.0; + auto deltapsiFT0A = 0.0; + auto deltapsiFV0A = 0.0; + + auto psidefFT0C = std::atan2(collision.qvecIm()[qvecDetInd], collision.qvecRe()[qvecDetInd]) / static_cast(nmode); + auto psidefFT0A = std::atan2(collision.qvecIm()[qvecRefAInd], collision.qvecRe()[qvecRefAInd]) / static_cast(nmode); + auto psidefFV0A = std::atan2(collision.qvecIm()[qvecRefBInd], collision.qvecRe()[qvecRefBInd]) / static_cast(nmode); + for (int ishift = 1; ishift <= kShiftLevel; ishift++) { + auto coeffshiftxFT0C = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(centrality, 0.5, ishift - 0.5)); + auto coeffshiftyFT0C = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(centrality, 1.5, ishift - 0.5)); + auto coeffshiftxFT0A = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(centrality, 2.5, ishift - 0.5)); + auto coeffshiftyFT0A = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(centrality, 3.5, ishift - 0.5)); + auto coeffshiftxFV0A = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(centrality, 4.5, ishift - 0.5)); + auto coeffshiftyFV0A = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(centrality, 5.5, ishift - 0.5)); + + deltapsiFT0C += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0C * std::cos(ishift * static_cast(nmode) * psidefFT0C) + coeffshiftyFT0C * std::sin(ishift * static_cast(nmode) * psidefFT0C))); + deltapsiFT0A += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0A * std::cos(ishift * static_cast(nmode) * psidefFT0A) + coeffshiftyFT0A * std::sin(ishift * static_cast(nmode) * psidefFT0A))); + deltapsiFV0A += ((1 / (1.0 * ishift)) * (-coeffshiftxFV0A * std::cos(ishift * static_cast(nmode) * psidefFV0A) + coeffshiftyFV0A * std::sin(ishift * static_cast(nmode) * psidefFV0A))); + } + if (nmode == kCorrLevel[0]) { + histos.fill(HIST("psi2/QA/EP_FT0C_shifted"), centrality, psidefFT0C + deltapsiFT0C); + histos.fill(HIST("psi2/QA/EP_FT0A_shifted"), centrality, psidefFT0A + deltapsiFT0A); + histos.fill(HIST("psi2/QA/EP_FV0A_shifted"), centrality, psidefFV0A + deltapsiFV0A); + + histos.fill(HIST("psi2/QA/EPRes_FT0C_FT0A_shifted"), centrality, std::cos(static_cast(nmode) * (psidefFT0C + deltapsiFT0C - psidefFT0A - deltapsiFT0A))); + histos.fill(HIST("psi2/QA/EPRes_FT0C_FV0A_shifted"), centrality, std::cos(static_cast(nmode) * (psidefFT0C + deltapsiFT0C - psidefFV0A - deltapsiFV0A))); + histos.fill(HIST("psi2/QA/EPRes_FT0A_FV0A_shifted"), centrality, std::cos(static_cast(nmode) * (psidefFT0A + deltapsiFT0A - psidefFV0A - deltapsiFV0A))); + } else if (nmode == kCorrLevel[1]) { + histos.fill(HIST("psi3/QA/EP_FT0C_shifted"), centrality, psidefFT0C + deltapsiFT0C); + histos.fill(HIST("psi3/QA/EP_FT0A_shifted"), centrality, psidefFT0A + deltapsiFT0A); + histos.fill(HIST("psi3/QA/EP_FV0A_shifted"), centrality, psidefFV0A + deltapsiFV0A); + + histos.fill(HIST("psi3/QA/EPRes_FT0C_FT0A_shifted"), centrality, std::cos(static_cast(nmode) * (psidefFT0C + deltapsiFT0C - psidefFT0A - deltapsiFT0A))); + histos.fill(HIST("psi3/QA/EPRes_FT0C_FV0A_shifted"), centrality, std::cos(static_cast(nmode) * (psidefFT0C + deltapsiFT0C - psidefFV0A - deltapsiFV0A))); + histos.fill(HIST("psi3/QA/EPRes_FT0A_FV0A_shifted"), centrality, std::cos(static_cast(nmode) * (psidefFT0A + deltapsiFT0A - psidefFV0A - deltapsiFV0A))); + } else if (nmode == kCorrLevel[2]) { + histos.fill(HIST("psi4/QA/EP_FT0C_shifted"), centrality, psidefFT0C + deltapsiFT0C); + histos.fill(HIST("psi4/QA/EP_FT0A_shifted"), centrality, psidefFT0A + deltapsiFT0A); + histos.fill(HIST("psi4/QA/EP_FV0A_shifted"), centrality, psidefFV0A + deltapsiFV0A); + + histos.fill(HIST("psi4/QA/EPRes_FT0C_FT0A_shifted"), centrality, std::cos(static_cast(nmode) * (psidefFT0C + deltapsiFT0C - psidefFT0A - deltapsiFT0A))); + histos.fill(HIST("psi4/QA/EPRes_FT0C_FV0A_shifted"), centrality, std::cos(static_cast(nmode) * (psidefFT0C + deltapsiFT0C - psidefFV0A - deltapsiFV0A))); + histos.fill(HIST("psi4/QA/EPRes_FT0A_FV0A_shifted"), centrality, std::cos(static_cast(nmode) * (psidefFT0A + deltapsiFT0A - psidefFV0A - deltapsiFV0A))); + } } - for (auto const& trk : tracks) { - if (!selectTrack(trk)) { + } + + template + void fillHistograms(TCollision const& collision, V0 const& V0s, int nmode) + { + qvecDetInd = detId * 4 + 3 + (nmode - 2) * cfgNQvec * 4; + qvecRefAInd = refAId * 4 + 3 + (nmode - 2) * cfgNQvec * 4; + qvecRefBInd = refBId * 4 + 3 + (nmode - 2) * cfgNQvec * 4; + + histos.fill(HIST("histQvecCent"), std::sqrt(collision.qvecFT0CReVec()[0] * collision.qvecFT0CReVec()[0] + collision.qvecFT0CImVec()[0] * collision.qvecFT0CImVec()[0]) * std::sqrt(collision.sumAmplFT0C()), collision.centFT0C()); + histos.fill(HIST("histQvecV2"), collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], collision.centFT0C()); + histos.fill(HIST("histMult_Cent"), collision.sumAmplFT0C(), collision.centFT0C()); + + for (const auto& v0 : V0s) { + auto postrack = v0.template posTrack_as(); + auto negtrack = v0.template negTrack_as(); + + double nTPCSigmaPosPr = postrack.tpcNSigmaPr(); + double nTPCSigmaNegPi = negtrack.tpcNSigmaPi(); + + double nTPCSigmaNegPr = negtrack.tpcNSigmaPr(); + double nTPCSigmaPosPi = postrack.tpcNSigmaPi(); + + if (cfgQAv0 && nmode == kCorrLevel[0]) { + histos.fill(HIST("QA/nsigma_tpc_pt_ppr"), postrack.pt(), nTPCSigmaPosPr); + histos.fill(HIST("QA/nsigma_tpc_pt_ppi"), postrack.pt(), nTPCSigmaPosPi); + + histos.fill(HIST("QA/nsigma_tpc_pt_mpr"), negtrack.pt(), nTPCSigmaNegPr); + histos.fill(HIST("QA/nsigma_tpc_pt_mpi"), negtrack.pt(), nTPCSigmaNegPi); + } + + int lambdaTag = 0; + int aLambdaTag = 0; + + if (isSelectedV0Daughter(postrack, 0) && isSelectedV0Daughter(negtrack, 1)) { + lambdaTag = 1; + } + if (isSelectedV0Daughter(negtrack, 0) && isSelectedV0Daughter(postrack, 1)) { + aLambdaTag = 1; + } + + if (lambdaTag == aLambdaTag) + continue; + + if (!selectionV0(collision, v0, lambdaTag)) continue; + + if (lambdaTag) { + protonVec = ROOT::Math::PxPyPzMVector(v0.pxpos(), v0.pypos(), v0.pzpos(), massPr); + pionVec = ROOT::Math::PxPyPzMVector(v0.pxneg(), v0.pyneg(), v0.pzneg(), massPi); } - if (nmode == kDefaultModulation) { - histosQA.fill(HIST("histCosDetV2"), collision.centFT0C(), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); - if (collision.centFT0C() > kCent[0] && collision.centFT0C() <= kCent[1] && q2 < kSeparator[0]) { - histosQA.fill(HIST("histCosDetV2_0010Left"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); - } - if (collision.centFT0C() > kCent[0] && collision.centFT0C() <= kCent[1] && q2 > kSeparator[0] && q2 <= kSeparator[1]) { - histosQA.fill(HIST("histCosDetV2_0010Mid"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); - } - if (collision.centFT0C() > kCent[0] && collision.centFT0C() <= kCent[1] && q2 > kSeparator[1]) { - histosQA.fill(HIST("histCosDetV2_0010Right"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); - } - if (collision.centFT0C() > kCent[1] && collision.centFT0C() <= kCent[2] && q2 < kSeparator[2]) { - histosQA.fill(HIST("histCosDetV2_1020Left"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); - } - if (collision.centFT0C() > kCent[1] && collision.centFT0C() <= kCent[2] && q2 > kSeparator[2] && q2 <= kSeparator[3]) { - histosQA.fill(HIST("histCosDetV2_1020Mid"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); - } - if (collision.centFT0C() > kCent[1] && collision.centFT0C() <= kCent[2] && q2 > kSeparator[3]) { - histosQA.fill(HIST("histCosDetV2_1020Right"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); - } - if (collision.centFT0C() > kCent[2] && collision.centFT0C() <= kCent[3] && q2 < kSeparator[4]) { - histosQA.fill(HIST("histCosDetV2_2030Left"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); - } - if (collision.centFT0C() > kCent[2] && collision.centFT0C() <= kCent[3] && q2 > kSeparator[4] && q2 <= kSeparator[5]) { - histosQA.fill(HIST("histCosDetV2_2030Mid"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); - } - if (collision.centFT0C() > kCent[2] && collision.centFT0C() <= kCent[3] && q2 > kSeparator[5]) { - histosQA.fill(HIST("histCosDetV2_2030Right"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); - } - if (collision.centFT0C() > kCent[3] && collision.centFT0C() <= kCent[4] && q2 < kSeparator[6]) { - histosQA.fill(HIST("histCosDetV2_3040Left"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); - } - if (collision.centFT0C() > kCent[3] && collision.centFT0C() <= kCent[4] && q2 > kSeparator[6] && q2 <= kSeparator[7]) { - histosQA.fill(HIST("histCosDetV2_3040Mid"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); - } - if (collision.centFT0C() > kCent[3] && collision.centFT0C() <= kCent[4] && q2 > kSeparator[7]) { - histosQA.fill(HIST("histCosDetV2_3040Right"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); - } - if (collision.centFT0C() > kCent[4] && collision.centFT0C() <= kCent[5] && q2 < kSeparator[8]) { - histosQA.fill(HIST("histCosDetV2_4050Left"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); - } - if (collision.centFT0C() > kCent[4] && collision.centFT0C() <= kCent[5] && q2 > kSeparator[8] && q2 <= kSeparator[9]) { - histosQA.fill(HIST("histCosDetV2_4050Mid"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); - } - if (collision.centFT0C() > kCent[4] && collision.centFT0C() <= kCent[5] && q2 > kSeparator[9]) { - histosQA.fill(HIST("histCosDetV2_4050Right"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); - } - if (collision.centFT0C() > kCent[5] && collision.centFT0C() <= kCent[6] && q2 < kSeparator[10]) { - histosQA.fill(HIST("histCosDetV2_5060Left"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); - } - if (collision.centFT0C() > kCent[5] && collision.centFT0C() <= kCent[6] && q2 > kSeparator[10] && q2 <= kSeparator[11]) { - histosQA.fill(HIST("histCosDetV2_5060Mid"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); - } - if (collision.centFT0C() > kCent[5] && collision.centFT0C() <= kCent[6] && q2 > kSeparator[11]) { - histosQA.fill(HIST("histCosDetV2_5060Right"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); - } - if (collision.centFT0C() > kCent[6] && collision.centFT0C() <= kCent[7] && q2 < kSeparator[12]) { - histosQA.fill(HIST("histCosDetV2_6070Left"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); - } - if (collision.centFT0C() > kCent[6] && collision.centFT0C() <= kCent[7] && q2 > kSeparator[12] && q2 <= kSeparator[13]) { - histosQA.fill(HIST("histCosDetV2_6070Mid"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); - } - if (collision.centFT0C() > kCent[6] && collision.centFT0C() <= kCent[7] && q2 > kSeparator[13]) { - histosQA.fill(HIST("histCosDetV2_6070Right"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); + if (aLambdaTag) { + protonVec = ROOT::Math::PxPyPzMVector(v0.pxneg(), v0.pyneg(), v0.pzneg(), massPr); + pionVec = ROOT::Math::PxPyPzMVector(v0.pxpos(), v0.pypos(), v0.pzpos(), massPi); + } + LambdaVec = protonVec + pionVec; + LambdaVec.SetM(massLambda); + + ROOT::Math::Boost boost{LambdaVec.BoostToCM()}; + protonBoostedVec = boost(protonVec); + + angle = protonBoostedVec.Pz() / protonBoostedVec.P(); + psi = std::atan2(collision.qvecIm()[qvecDetInd], collision.qvecRe()[qvecDetInd]) / static_cast(nmode); + relphi = TVector2::Phi_0_2pi(static_cast(nmode) * (LambdaVec.Phi() - psi)); + + if (cfgShiftCorr) { + auto deltapsiFT0C = 0.0; + auto deltapsiFT0A = 0.0; + auto deltapsiFV0A = 0.0; + + auto psidefFT0C = std::atan2(collision.qvecIm()[qvecDetInd], collision.qvecRe()[qvecDetInd]) / static_cast(nmode); + auto psidefFT0A = std::atan2(collision.qvecIm()[qvecRefAInd], collision.qvecRe()[qvecRefAInd]) / static_cast(nmode); + auto psidefFV0A = std::atan2(collision.qvecIm()[qvecRefBInd], collision.qvecRe()[qvecRefBInd]) / static_cast(nmode); + for (int ishift = 1; ishift <= kShiftLevel; ishift++) { + auto coeffshiftxFT0C = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(centrality, 0.5, ishift - 0.5)); + auto coeffshiftyFT0C = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(centrality, 1.5, ishift - 0.5)); + auto coeffshiftxFT0A = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(centrality, 2.5, ishift - 0.5)); + auto coeffshiftyFT0A = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(centrality, 3.5, ishift - 0.5)); + auto coeffshiftxFV0A = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(centrality, 4.5, ishift - 0.5)); + auto coeffshiftyFV0A = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(centrality, 5.5, ishift - 0.5)); + + deltapsiFT0C += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0C * std::cos(ishift * static_cast(nmode) * psidefFT0C) + coeffshiftyFT0C * std::sin(ishift * static_cast(nmode) * psidefFT0C))); + deltapsiFT0A += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0A * std::cos(ishift * static_cast(nmode) * psidefFT0A) + coeffshiftyFT0A * std::sin(ishift * static_cast(nmode) * psidefFT0A))); + deltapsiFV0A += ((1 / (1.0 * ishift)) * (-coeffshiftxFV0A * std::cos(ishift * static_cast(nmode) * psidefFV0A) + coeffshiftyFV0A * std::sin(ishift * static_cast(nmode) * psidefFV0A))); } - if (collision.centFT0C() > kCent[7] && collision.centFT0C() <= kCent[8] && q2 < kSeparator[14]) { - histosQA.fill(HIST("histCosDetV2_7080Left"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); + psi += deltapsiFT0C; + relphi = TVector2::Phi_0_2pi(static_cast(nmode) * (LambdaVec.Phi() - psidefFT0C - deltapsiFT0C)); + } + + if (cfgPhiDepStudy && cfgPhiDepSig * std::abs(std::sin(relphi)) > gRandom->Uniform(0, 1)) { + continue; + } + + if (lambdaTag) { + histos.fill(HIST("QA/ptspec_l"), v0.mLambda(), v0.pt(), centrality); + if (cfgEffCor) { + histos.fill(HIST("QA/ptspecCor_l"), v0.mLambda(), v0.pt(), centrality, + 1.0 / effMap->GetBinContent(effMap->GetXaxis()->FindBin(v0.pt()), effMap->GetYaxis()->FindBin(centrality))); } - if (collision.centFT0C() > kCent[7] && collision.centFT0C() <= kCent[8] && q2 > kSeparator[14] && q2 <= kSeparator[15]) { - histosQA.fill(HIST("histCosDetV2_7080Mid"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); + } + if (aLambdaTag) { + histos.fill(HIST("QA/ptspec_al"), v0.mAntiLambda(), v0.pt(), centrality); + if (cfgEffCor) { + histos.fill(HIST("QA/ptspecCor_al"), v0.mAntiLambda(), v0.pt(), centrality, + 1.0 / effMap->GetBinContent(effMap->GetXaxis()->FindBin(v0.pt()), effMap->GetYaxis()->FindBin(centrality))); } - if (collision.centFT0C() > kCent[7] && collision.centFT0C() <= kCent[8] && q2 > kSeparator[15]) { - histosQA.fill(HIST("histCosDetV2_7080Right"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); + } + double weight = 1.0; + weight *= cfgEffCor ? 1.0 / effMap->GetBinContent(effMap->GetXaxis()->FindBin(v0.pt()), effMap->GetYaxis()->FindBin(centrality)) : 1.; + weight *= cfgAccCor ? 1.0 / accMap->GetBinContent(accMap->GetXaxis()->FindBin(v0.pt()), accMap->GetYaxis()->FindBin(v0.yLambda())) : 1.; + + double qvecMag = 1.0; + if (cfgUSESP) + qvecMag *= std::sqrt(std::pow(collision.qvecIm()[3 + (nmode - 2) * 28], 2) + std::pow(collision.qvecRe()[3 + (nmode - 2) * 28], 2)); + + if (nmode == kCorrLevel[0]) { //////////// + if (lambdaTag) { + histos.fill(HIST("psi2/h_lambda_cos"), v0.mLambda(), v0.pt(), angle * weight, centrality, relphi); + histos.fill(HIST("psi2/h_lambda_cos2"), v0.mLambda(), v0.pt(), angle * angle, centrality, relphi); + histos.fill(HIST("psi2/h_lambda_cossin"), v0.mLambda(), v0.pt(), angle * std::sin(relphi) * weight, centrality); + histos.fill(HIST("psi2/h_lambda_vncos"), v0.mLambda(), v0.pt(), qvecMag * std::cos(relphi) * weight, centrality); + histos.fill(HIST("psi2/h_lambda_vnsin"), v0.mLambda(), v0.pt(), std::sin(relphi), centrality); + + if (cfgRapidityDep) { + histos.fill(HIST("psi2/h_lambda_cos2_rap"), v0.mLambda(), v0.pt(), angle * angle, centrality, v0.yLambda(), weight); + } + + if (cfgAccAzimuth) { + histos.fill(HIST("psi2/h_lambda_coscos"), v0.mLambda(), v0.pt(), angle * std::cos(relphi), centrality, weight); + } + + if (cfgCalcCum) { + histos.fill(HIST("psi2/QA/cosTheta_l"), v0.mLambda(), v0.pt(), angle, centrality); + histos.fill(HIST("psi2/QA/cosPsi_l"), v0.mLambda(), v0.pt(), std::cos(psi * 2.0), centrality); + histos.fill(HIST("psi2/QA/cosPhi_l"), v0.mLambda(), v0.pt(), std::cos(v0.phi() * 2.0), centrality); + + histos.fill(HIST("psi2/QA/sinPsi_l"), v0.mLambda(), v0.pt(), std::sin(psi * 2.0), centrality); + histos.fill(HIST("psi2/QA/sinPhi_l"), v0.mLambda(), v0.pt(), std::sin(v0.phi() * 2.0), centrality); + + histos.fill(HIST("psi2/QA/cosTheta_cosPhi_l"), v0.mLambda(), v0.pt(), angle * std::cos(v0.phi() * 2.0), centrality); + histos.fill(HIST("psi2/QA/cosTheta_cosPsi_l"), v0.mLambda(), v0.pt(), angle * std::cos(psi * 2.0), centrality); + + histos.fill(HIST("psi2/QA/cosTheta_sinPhi_l"), v0.mLambda(), v0.pt(), angle * std::sin(v0.phi() * 2.0), centrality); + histos.fill(HIST("psi2/QA/cosTheta_sinPsi_l"), v0.mLambda(), v0.pt(), angle * std::sin(psi * 2.0), centrality); + + histos.fill(HIST("psi2/QA/cosPhi_sinPsi_l"), v0.mLambda(), v0.pt(), std::cos(v0.phi() * 2.0) * std::sin(psi * 2.0), centrality); + histos.fill(HIST("psi2/QA/sinPhi_cosPsi_l"), v0.mLambda(), v0.pt(), std::sin(v0.phi() * 2.0) * std::cos(psi * 2.0), centrality); + } + if (cfgCalcCum1) { + histos.fill(HIST("psi2/QA/cosTheta_l"), v0.mLambda(), v0.pt(), angle, centrality); + histos.fill(HIST("psi2/QA/cosPsi_l"), v0.mLambda(), v0.pt(), std::cos(psi * 2.0), centrality); + histos.fill(HIST("psi2/QA/cosPhi_l"), v0.mLambda(), v0.pt(), std::cos(v0.phi() * 2.0), centrality); + + histos.fill(HIST("psi2/QA/cosPhi_cosPsi_l"), v0.mLambda(), v0.pt(), std::cos(v0.phi() * 2.0) * std::cos(psi * 2.0), centrality); + histos.fill(HIST("psi2/QA/cosTheta_cosPhi_l"), v0.mLambda(), v0.pt(), angle * std::cos(v0.phi() * 2.0), centrality); + histos.fill(HIST("psi2/QA/cosTheta_cosPsi_l"), v0.mLambda(), v0.pt(), angle * std::cos(psi * 2.0), centrality); + + histos.fill(HIST("psi2/QA/sinPhi_sinPsi_l"), v0.mLambda(), v0.pt(), std::sin(v0.phi() * 2.0) * std::sin(psi * 2.0), centrality); + histos.fill(HIST("psi2/QA/cosTheta_sinPhi_l"), v0.mLambda(), v0.pt(), angle * std::sin(v0.phi() * 2.0), centrality); + histos.fill(HIST("psi2/QA/cosTheta_sinPsi_l"), v0.mLambda(), v0.pt(), angle * std::sin(psi * 2.0), centrality); + + histos.fill(HIST("psi2/QA/sinPsi_l"), v0.mLambda(), v0.pt(), std::sin(psi * 2.0), centrality); + histos.fill(HIST("psi2/QA/sinPhi_l"), v0.mLambda(), v0.pt(), std::sin(v0.phi() * 2.0), centrality); + } } - if (collision.centFT0C() > kCent[8] && collision.centFT0C() <= kCent[9] && q2 < kSeparator[16]) { - histosQA.fill(HIST("histCosDetV2_8090Left"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); + if (aLambdaTag) { + histos.fill(HIST("psi2/h_alambda_cos"), v0.mAntiLambda(), v0.pt(), angle * weight, centrality, relphi); + histos.fill(HIST("psi2/h_alambda_cos2"), v0.mAntiLambda(), v0.pt(), angle * angle, centrality, relphi); + histos.fill(HIST("psi2/h_alambda_cossin"), v0.mAntiLambda(), v0.pt(), angle * std::sin(relphi) * weight, centrality); + histos.fill(HIST("psi2/h_alambda_vncos"), v0.mAntiLambda(), v0.pt(), qvecMag * std::cos(relphi) * weight, centrality); + histos.fill(HIST("psi2/h_alambda_vnsin"), v0.mAntiLambda(), v0.pt(), std::sin(relphi), centrality); + + if (cfgRapidityDep) { + histos.fill(HIST("psi2/h_alambda_cos2_rap"), v0.mAntiLambda(), v0.pt(), angle * angle, centrality, v0.yLambda(), weight); + } + + if (cfgAccAzimuth) { + histos.fill(HIST("psi2/h_alambda_coscos"), v0.mAntiLambda(), v0.pt(), angle * std::cos(relphi), centrality, weight); + } + + if (cfgCalcCum) { + histos.fill(HIST("psi2/QA/cosTheta_al"), v0.mAntiLambda(), v0.pt(), angle, centrality); + histos.fill(HIST("psi2/QA/cosPsi_al"), v0.mAntiLambda(), v0.pt(), std::cos(psi * 2.0), centrality); + histos.fill(HIST("psi2/QA/cosPhi_al"), v0.mAntiLambda(), v0.pt(), std::cos(v0.phi() * 2.0), centrality); + + histos.fill(HIST("psi2/QA/sinPsi_al"), v0.mAntiLambda(), v0.pt(), std::sin(psi * 2.0), centrality); + histos.fill(HIST("psi2/QA/sinPhi_al"), v0.mAntiLambda(), v0.pt(), std::sin(v0.phi() * 2.0), centrality); + + histos.fill(HIST("psi2/QA/cosTheta_cosPhi_al"), v0.mAntiLambda(), v0.pt(), angle * std::cos(v0.phi() * 2.0), centrality); + histos.fill(HIST("psi2/QA/cosTheta_cosPsi_al"), v0.mAntiLambda(), v0.pt(), angle * std::cos(psi * 2.0), centrality); + + histos.fill(HIST("psi2/QA/cosTheta_sinPhi_al"), v0.mAntiLambda(), v0.pt(), angle * std::sin(v0.phi() * 2.0), centrality); + histos.fill(HIST("psi2/QA/cosTheta_sinPsi_al"), v0.mAntiLambda(), v0.pt(), angle * std::sin(psi * 2.0), centrality); + + histos.fill(HIST("psi2/QA/cosPhi_sinPsi_al"), v0.mAntiLambda(), v0.pt(), std::cos(v0.phi() * 2.0) * std::sin(psi * 2.0), centrality); + histos.fill(HIST("psi2/QA/sinPhi_cosPsi_al"), v0.mAntiLambda(), v0.pt(), std::sin(v0.phi() * 2.0) * std::cos(psi * 2.0), centrality); + } + if (cfgCalcCum1) { + histos.fill(HIST("psi2/QA/cosTheta_al"), v0.mAntiLambda(), v0.pt(), angle, centrality); + histos.fill(HIST("psi2/QA/cosPsi_al"), v0.mAntiLambda(), v0.pt(), std::cos(psi * 2.0), centrality); + histos.fill(HIST("psi2/QA/cosPhi_al"), v0.mAntiLambda(), v0.pt(), std::cos(v0.phi() * 2.0), centrality); + + histos.fill(HIST("psi2/QA/cosPhi_cosPsi_al"), v0.mAntiLambda(), v0.pt(), std::cos(v0.phi() * 2.0) * std::cos(psi * 2.0), centrality); + histos.fill(HIST("psi2/QA/cosTheta_cosPhi_al"), v0.mAntiLambda(), v0.pt(), angle * std::cos(v0.phi() * 2.0), centrality); + histos.fill(HIST("psi2/QA/cosTheta_cosPsi_al"), v0.mAntiLambda(), v0.pt(), angle * std::cos(psi * 2.0), centrality); + + histos.fill(HIST("psi2/QA/sinPhi_sinPsi_al"), v0.mAntiLambda(), v0.pt(), std::sin(v0.phi() * 2.0) * std::sin(psi * 2.0), centrality); + histos.fill(HIST("psi2/QA/cosTheta_sinPhi_al"), v0.mAntiLambda(), v0.pt(), angle * std::sin(v0.phi() * 2.0), centrality); + histos.fill(HIST("psi2/QA/cosTheta_sinPsi_al"), v0.mAntiLambda(), v0.pt(), angle * std::sin(psi * 2.0), centrality); + + histos.fill(HIST("psi2/QA/sinPsi_al"), v0.mAntiLambda(), v0.pt(), std::sin(psi * 2.0), centrality); + histos.fill(HIST("psi2/QA/sinPhi_al"), v0.mAntiLambda(), v0.pt(), std::sin(v0.phi() * 2.0), centrality); + } } - if (collision.centFT0C() > kCent[8] && collision.centFT0C() <= kCent[9] && q2 > kSeparator[16] && q2 <= kSeparator[17]) { - histosQA.fill(HIST("histCosDetV2_8090Mid"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); + } else if (nmode == kCorrLevel[1]) { + if (lambdaTag) { + histos.fill(HIST("psi3/h_lambda_cos"), v0.mLambda(), v0.pt(), angle * weight, centrality, relphi); + histos.fill(HIST("psi3/h_lambda_cos2"), v0.mLambda(), v0.pt(), angle * angle, centrality, relphi); + histos.fill(HIST("psi3/h_lambda_cossin"), v0.mLambda(), v0.pt(), angle * std::sin(relphi) * weight, centrality); + histos.fill(HIST("psi3/h_lambda_vncos"), v0.mLambda(), v0.pt(), qvecMag * std::cos(relphi) * weight, centrality); + histos.fill(HIST("psi3/h_lambda_vnsin"), v0.mLambda(), v0.pt(), std::sin(relphi), centrality); + + if (cfgRapidityDep) { + histos.fill(HIST("psi3/h_lambda_cos2_rap"), v0.mLambda(), v0.pt(), angle * angle, centrality, v0.yLambda(), weight); + } + + if (cfgAccAzimuth) { + histos.fill(HIST("psi3/h_lambda_coscos"), v0.mLambda(), v0.pt(), angle * std::cos(relphi), centrality, weight); + } } - if (collision.centFT0C() > kCent[8] && collision.centFT0C() <= kCent[9] && q2 > kSeparator[17]) { - histosQA.fill(HIST("histCosDetV2_8090Right"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); + if (aLambdaTag) { + histos.fill(HIST("psi3/h_alambda_cos"), v0.mAntiLambda(), v0.pt(), angle * weight, centrality, relphi); + histos.fill(HIST("psi3/h_alambda_cos2"), v0.mAntiLambda(), v0.pt(), angle * angle, centrality, relphi, weight); + histos.fill(HIST("psi3/h_alambda_cossin"), v0.mAntiLambda(), v0.pt(), angle * std::sin(relphi) * weight, centrality); + histos.fill(HIST("psi3/h_alambda_vncos"), v0.mAntiLambda(), v0.pt(), qvecMag * std::cos(relphi) * weight, centrality); + histos.fill(HIST("psi3/h_alambda_vnsin"), v0.mAntiLambda(), v0.pt(), std::sin(relphi), centrality); + + if (cfgRapidityDep) { + histos.fill(HIST("psi3/h_alambda_cos2_rap"), v0.mAntiLambda(), v0.pt(), angle * angle, centrality, v0.yLambda(), weight); + } + + if (cfgAccAzimuth) { + histos.fill(HIST("psi3/h_alambda_coscos"), v0.mAntiLambda(), v0.pt(), angle * std::cos(relphi), centrality, weight); + } } - if (collision.centFT0C() > kCent[9] && collision.centFT0C() <= kCent[10] && q2 < kSeparator[18]) { - histosQA.fill(HIST("histCosDetV2_9010Left"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); + } else if (nmode == kCorrLevel[2]) { + if (lambdaTag) { + histos.fill(HIST("psi4/h_lambda_cos"), v0.mLambda(), v0.pt(), angle * weight, centrality, relphi); + histos.fill(HIST("psi4/h_lambda_cos2"), v0.mLambda(), v0.pt(), angle * angle, centrality, relphi); + histos.fill(HIST("psi4/h_lambda_cossin"), v0.mLambda(), v0.pt(), angle * std::sin(relphi) * weight, centrality); + histos.fill(HIST("psi4/h_lambda_vncos"), v0.mLambda(), v0.pt(), qvecMag * std::cos(relphi) * weight, centrality); + histos.fill(HIST("psi4/h_lambda_vnsin"), v0.mLambda(), v0.pt(), std::sin(relphi), centrality); + + if (cfgRapidityDep) { + histos.fill(HIST("psi4/h_lambda_cos2_rap"), v0.mLambda(), v0.pt(), angle * angle, centrality, v0.yLambda(), weight); + } + + if (cfgAccAzimuth) { + histos.fill(HIST("psi4/h_lambda_coscos"), v0.mLambda(), v0.pt(), angle * std::cos(relphi), centrality, weight); + } } - if (collision.centFT0C() > kCent[9] && collision.centFT0C() <= kCent[10] && q2 > kSeparator[18] && q2 <= kSeparator[19]) { - histosQA.fill(HIST("histCosDetV2_9010Mid"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); + if (aLambdaTag) { + histos.fill(HIST("psi4/h_alambda_cos"), v0.mAntiLambda(), v0.pt(), angle * weight, centrality, relphi); + histos.fill(HIST("psi4/h_alambda_cos2"), v0.mAntiLambda(), v0.pt(), angle * angle, centrality, relphi); + histos.fill(HIST("psi4/h_alambda_cossin"), v0.mAntiLambda(), v0.pt(), angle * std::sin(relphi) * weight, centrality); + histos.fill(HIST("psi4/h_alambda_vncos"), v0.mAntiLambda(), v0.pt(), qvecMag * std::cos(relphi) * weight, centrality); + histos.fill(HIST("psi4/h_alambda_vnsin"), v0.mAntiLambda(), v0.pt(), std::sin(relphi), centrality); + + if (cfgRapidityDep) { + histos.fill(HIST("psi4/h_alambda_cos2_rap"), v0.mAntiLambda(), v0.pt(), angle * angle, centrality, v0.yLambda(), weight); + } + + if (cfgAccAzimuth) { + histos.fill(HIST("psi4/h_alambda_coscos"), v0.mAntiLambda(), v0.pt(), angle * std::cos(relphi), centrality, weight); + } } - if (collision.centFT0C() > kCent[9] && collision.centFT0C() <= kCent[10] && q2 > kSeparator[19]) { - histosQA.fill(HIST("histCosDetV2_9010Right"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), trk.pt(), - std::cos(static_cast(nmode) * (trk.phi() - - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], - collision.qvecFT0CImVec()[0], - nmode)))); + } ////////// FIXME: not possible to get histograms using nmode + } + } + + void processData(EventCandidates::iterator const& collision, + TrackCandidates const& /*tracks*/, aod::V0Datas const& V0s, + aod::BCsWithTimestamps const&) + { + if (cfgCentEst == kCorrLevel[3]) { + centrality = collision.centFT0C(); + } else if (cfgCentEst == kCorrLevel[0]) { + centrality = collision.centFT0M(); + } + if (!eventSelected(collision)) { + return; + } + histos.fill(HIST("QA/CentDist"), centrality, 1.0); + histos.fill(HIST("QA/PVzDist"), collision.posZ(), 1.0); + + if (cfgShiftCorr) { + auto bc = collision.bc_as(); + currentRunNumber = bc.runNumber(); + if (currentRunNumber != lastRunNumber) { + shiftprofile.clear(); + for (int i = 2; i < cfgnMods + 2; i++) { + fullCCDBShiftCorrPath = cfgShiftPath; + fullCCDBShiftCorrPath += "/v"; + fullCCDBShiftCorrPath += std::to_string(i); + auto objshift = ccdb->getForTimeStamp(fullCCDBShiftCorrPath, bc.timestamp()); + shiftprofile.push_back(objshift); } + lastRunNumber = currentRunNumber; } } + auto bc = collision.bc_as(); + if (cfgEffCor) { + effMap = ccdb->getForTimeStamp(cfgEffCorPath.value, bc.timestamp()); + } + if (cfgAccCor) { + accMap = ccdb->getForTimeStamp(cfgAccCorPath.value, bc.timestamp()); + } + for (int i = 2; i < cfgnMods + 2; i++) { + if (cfgShiftCorrDef) { + fillShiftCorrection(collision, i); + } + if (cfgQAv0) { + fillEPQA(collision, i); + } + fillHistograms(collision, V0s, i); + } // FIXME: need to fill different histograms for different harmonic } + PROCESS_SWITCH(FlowEseTask, processData, "Process Event for data", true); - void process(MyCollisions::iterator const& collision, MyTracks const& tracks) + using RecoTracks = soa::Join; + void processMcItsTpc(aod::McCollision const& mcCollision, soa::Join const& mcParticles, RecoTracks const&) { - if (!selectEvent(collision)) { - return; + float imp = mcCollision.impactParameter(); + float evPhi = mcCollision.eventPlaneAngle() / 2.0; + float centclass = -999; + if (imp >= kCentBoundaries[0] && imp < kCentBoundaries[1]) { + centclass = kCentValues[0]; + } + if (imp >= kCentBoundaries[1] && imp < kCentBoundaries[2]) { + centclass = kCentValues[1]; + } + if (imp >= kCentBoundaries[2] && imp < kCentBoundaries[3]) { + centclass = kCentValues[2]; + } + if (imp >= kCentBoundaries[3] && imp < kCentBoundaries[4]) { + centclass = kCentValues[3]; + } + if (imp >= kCentBoundaries[4] && imp < kCentBoundaries[5]) { + centclass = kCentValues[4]; + } + if (imp >= kCentBoundaries[5] && imp < kCentBoundaries[6]) { + centclass = kCentValues[5]; + } + if (imp >= kCentBoundaries[6] && imp < kCentBoundaries[7]) { + centclass = kCentValues[6]; + } + if (imp >= kCentBoundaries[7] && imp < kCentBoundaries[8]) { + centclass = kCentValues[7]; } - for (std::size_t i = 0; i < cfgNmods->size(); i++) { - fillHistosQvec(collision, cfgNmods->at(i)); - fillHistosFlow(collision, tracks, cfgNmods->at(i)); + if (imp >= kCentBoundaries[8] && imp < kCentBoundaries[9]) { + centclass = kCentValues[8]; + } + + int nCh = 0; + + if (centclass > 0 && centclass < kCentUpperLimit) { + // event within range + histos.fill(HIST("hImpactParameter"), imp); + histos.fill(HIST("hEventPlaneAngle"), evPhi); + for (auto const& mcParticle : mcParticles) { + float deltaPhi = mcParticle.phi() - mcCollision.eventPlaneAngle(); + // focus on bulk: e, mu, pi, k, p + int pdgCode = std::abs(mcParticle.pdgCode()); + if (pdgCode != kLambdaId) + continue; + if (!mcParticle.isPhysicalPrimary()) + continue; + if (std::abs(mcParticle.eta()) > kEtaAcceptance) // main acceptance + continue; + histos.fill(HIST("hSparseMCGenWeight"), centclass, RecoDecay::constrainAngle(deltaPhi), std::pow(std::cos(2.0 * RecoDecay::constrainAngle(deltaPhi)), 2.0), mcParticle.pt(), mcParticle.eta()); + nCh++; + bool validGlobal = false; + bool validAny = false; + if (mcParticle.has_tracks()) { + auto const& tracks = mcParticle.tracks_as(); + for (auto const& track : tracks) { + if (track.hasTPC() && track.hasITS()) { + validGlobal = true; + } + if (track.hasTPC() || track.hasITS()) { + validAny = true; + } + } + } + // if valid global, fill + if (validGlobal) { + histos.fill(HIST("hSparseMCRecWeight"), centclass, RecoDecay::constrainAngle(deltaPhi), std::pow(std::cos(2.0 * RecoDecay::constrainAngle(deltaPhi)), 2.0), mcParticle.pt(), mcParticle.eta()); + } + if (validAny) { + histos.fill(HIST("hSparseMCRecAllTrackWeight"), centclass, RecoDecay::constrainAngle(deltaPhi), std::pow(std::cos(2.0 * RecoDecay::constrainAngle(deltaPhi)), 2.0), mcParticle.pt(), mcParticle.eta()); + histos.fill(HIST("hEventPlaneAngleRec"), RecoDecay::constrainAngle(deltaPhi)); + } + // if any track present, fill + } } + histos.fill(HIST("hNchVsImpactParameter"), imp, nCh); } + PROCESS_SWITCH(FlowEseTask, processMcItsTpc, "Process MC for ITSTPC", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From fbdd1f144d85ee164046fa20471fbdfb657a2f9a Mon Sep 17 00:00:00 2001 From: Marvin Hemmer <53471402+mhemmer-cern@users.noreply.github.com> Date: Wed, 20 Aug 2025 16:36:05 +0200 Subject: [PATCH 121/986] [PWGEM] taskPi0FlowEMC.cxx: increase energy binning for calibration (#12647) --- PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx b/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx index 3f019289988..62974a0c885 100644 --- a/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx @@ -311,7 +311,7 @@ struct TaskPi0FlowEMC { const AxisSpec thAxisAlpha{100, -1., +1, "#alpha"}; const AxisSpec thAxisMult{1000, 0., +1000, "#it{N}_{ch}"}; const AxisSpec thAxisEnergy{1000, 0., 100., "#it{E}_{clus} (GeV)"}; - const AxisSpec thAxisEnergyCalib{100, 0., 20., "#it{E}_{clus} (GeV)"}; + const AxisSpec thAxisEnergyCalib{400, 0., 20., "#it{E}_{clus} (GeV)"}; const AxisSpec thAxisTime{1500, -600, 900, "#it{t}_{cl} (ns)"}; const AxisSpec thAxisEta{320, -0.8, 0.8, "#eta"}; const AxisSpec thAxisPhi{500, 0, 2 * 3.14159, "phi"}; From 9c40da504a10a3cc6d780bd6ff15e1d7fe42679e Mon Sep 17 00:00:00 2001 From: creetz16 <79141119+creetz16@users.noreply.github.com> Date: Wed, 20 Aug 2025 18:48:55 +0200 Subject: [PATCH 122/986] [Trigger] Remove metadata from Zorro ccdb access (#12656) --- EventFiltering/Zorro.cxx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/EventFiltering/Zorro.cxx b/EventFiltering/Zorro.cxx index ccdf063307d..3f9ca800024 100644 --- a/EventFiltering/Zorro.cxx +++ b/EventFiltering/Zorro.cxx @@ -185,15 +185,11 @@ std::vector Zorro::initCCDB(o2::ccdb::BasicCCDBManager* ccdb, int runNumber mCCDB = ccdb; mRunNumber = runNumber; mBCtolerance = bcRange; - std::map metadata; - metadata["runNumber"] = std::to_string(runNumber); - mRunDuration = mCCDB->getRunDuration(runNumber, true); - int64_t runTs = (mRunDuration.first / 2 + mRunDuration.second / 2); - auto ctp = ccdb->getForTimeStamp>("CTP/Calib/OrbitReset", runTs); + auto ctp = ccdb->getForRun>("CTP/Calib/OrbitReset", runNumber, false); mOrbitResetTimestamp = (*ctp)[0]; - mScalers = mCCDB->getSpecific(mBaseCCDBPath + "FilterCounters", runTs, metadata); - mSelections = mCCDB->getSpecific(mBaseCCDBPath + "SelectionCounters", runTs, metadata); - mInspectedTVX = mCCDB->getSpecific(mBaseCCDBPath + "InspectedTVX", runTs, metadata); + mScalers = mCCDB->getForRun(mBaseCCDBPath + "FilterCounters", runNumber, true); + mSelections = mCCDB->getForRun(mBaseCCDBPath + "SelectionCounters", runNumber, true); + mInspectedTVX = mCCDB->getForRun(mBaseCCDBPath + "InspectedTVX", runNumber, true); setupHelpers(timestamp); mLastBCglobalId = 0; mLastSelectedIdx = 0; From 833356689b98b10dddad40f70c0ab48ac5fabbba Mon Sep 17 00:00:00 2001 From: Preet-Bhanjan Date: Wed, 20 Aug 2025 23:15:52 +0200 Subject: [PATCH 123/986] [PWGCF] Modification in Likesign method (#12648) Co-authored-by: Preet Pati Co-authored-by: ALICE Action Bot --- PWGCF/Flow/Tasks/resonancesGfwFlow.cxx | 31 +------------------------- 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/PWGCF/Flow/Tasks/resonancesGfwFlow.cxx b/PWGCF/Flow/Tasks/resonancesGfwFlow.cxx index de9c43aeb88..5e9662b49b4 100644 --- a/PWGCF/Flow/Tasks/resonancesGfwFlow.cxx +++ b/PWGCF/Flow/Tasks/resonancesGfwFlow.cxx @@ -66,13 +66,11 @@ namespace { std::vector> refV2; std::vector> phiV2; -std::vector> lsPhiV2; std::vector> k0V2; std::vector> lambdaV2; std::vector>> refBoot; std::vector>> phiBoot; -std::vector>> lsPhiBoot; std::vector>> k0Boot; std::vector>> lambdaBoot; } // namespace @@ -316,7 +314,6 @@ struct ResonancesGfwFlow { refBoot.resize(cfgNbootstrap); phiBoot.resize(cfgNbootstrap); - lsPhiBoot.resize(cfgNbootstrap); k0Boot.resize(cfgNbootstrap); lambdaBoot.resize(cfgNbootstrap); @@ -331,14 +328,6 @@ struct ResonancesGfwFlow { } // end of bootstrap condition } // end of phi loop - if (cfgUseLsPhi && configs.GetHeads()[i].starts_with("LsPhi")) { - lsPhiV2.push_back(histos.add(Form("h%spt", configs.GetHeads()[i].c_str()), "", {HistType::kTProfile3D, {axisPt, axisPhiMass, axisMultiplicity}})); - if (cfgUseBootStrap) { - for (int j = 0; j < cfgNbootstrap; ++j) { - phiBoot[j].push_back(histos.add(Form("BootStrap/h%spt_boot_%d", configs.GetHeads()[i].c_str(), j), "", {HistType::kTProfile3D, {axisPt, axisPhiMass, axisMultiplicity}})); - } - } // end of bootstrap condition - } if (resoSwitchVals[K0][kUseParticle] && configs.GetHeads()[i].starts_with("K0")) { k0V2.push_back(histos.add(Form("h%spt", configs.GetHeads()[i].c_str()), "", {HistType::kTProfile3D, {axisPt, axisK0Mass, axisMultiplicity}})); if (cfgUseBootStrap) { @@ -1000,20 +989,11 @@ struct ResonancesGfwFlow { double pt = mom.Pt(); double invMass = mom.M(); double phi = mom.Phi(); - bool withinPtPOI = (cfgCutPtPOIMin < pt) && (pt < cfgCutPtPOIMax); // within POI pT range - bool withinPtRef = (cfgCutPtMin < pt) && (pt < cfgCutPtMax); phi = RecoDecay::constrainAngle(phi, 0.0, 1); // constrain azimuthal angle to [0,2pi] if (std::abs(mom.Rapidity()) < resoCutVals[PHI][kRapidity]) { histos.fill(hist, invMass, pt, collision.centFT0C()); - double weff = 1; - double waccPOI = 1; - - if (withinPtPOI) - fGFW->Fill(mom.Eta(), ((fPtAxis->FindBin(pt) - 1) * fPhiMassAxis->GetNbins()) + (fPhiMassAxis->FindBin(invMass) - 1), phi, weff * waccPOI, 512); - if (withinPtPOI && withinPtRef) - fGFW->Fill(mom.Eta(), ((fPtAxis->FindBin(pt) - 1) * fPhiMassAxis->GetNbins()) + (fPhiMassAxis->FindBin(invMass) - 1), phi, weff * waccPOI, 1024); } } // end of positive combinations loop return; @@ -1409,7 +1389,7 @@ struct ResonancesGfwFlow { } } // End of v0 loop - // Filling the cumulant profiles + // Filling cumulant profiles double r = fRndm->Rndm(); int bootId = static_cast(r * 10); @@ -1423,15 +1403,6 @@ struct ResonancesGfwFlow { } } // end of phi condition - if (cfgUseLsPhi && corrconfigs.at(i).Head.starts_with("LsPhi")) { - int pIndex = findComponent(lsPhiV2, Form("h%spt", corrconfigs.at(i).Head.c_str())); - fillProfileBoot3D(corrconfigs.at(i), lsPhiV2[pIndex], cent, fPhiMassAxis); - - if (cfgUseBootStrap) { - fillProfileBoot3D(corrconfigs.at(i), phiBoot[bootId][pIndex], cent, fPhiMassAxis); - } - } // end of LikeSign phi condition - if (resoSwitchVals[K0][kUseParticle] && corrconfigs.at(i).Head.starts_with("K0")) { int pIndex = findComponent(k0V2, Form("h%spt", corrconfigs.at(i).Head.c_str())); fillProfileBoot3D(corrconfigs.at(i), k0V2[pIndex], cent, fK0MassAxis); From 4658ebbd81465e5b3a0fdf6951f679266ec51498 Mon Sep 17 00:00:00 2001 From: jaelpark Date: Wed, 20 Aug 2025 23:16:57 +0200 Subject: [PATCH 124/986] [PWGCF] Reduce multiplicity correlations histogram size (#12651) --- PWGCF/Tasks/correlations.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PWGCF/Tasks/correlations.cxx b/PWGCF/Tasks/correlations.cxx index 8304b0e95cc..2a6101a5b9a 100644 --- a/PWGCF/Tasks/correlations.cxx +++ b/PWGCF/Tasks/correlations.cxx @@ -191,11 +191,11 @@ struct CorrelationTask { if (cfgMultCorrelationsMask & aod::cfmultset::CentFT0C) multAxes.emplace_back(100, 0, 100, "FT0C centrality"); if (cfgMultCorrelationsMask & aod::cfmultset::MultFV0A) - multAxes.emplace_back(10000, 0, 100000, "V0A multiplicity"); + multAxes.emplace_back(1000, 0, 100000, "V0A multiplicity"); if (cfgMultCorrelationsMask & aod::cfmultset::MultNTracksPV) - multAxes.emplace_back(1000, 0, 1000, "Nch PV"); + multAxes.emplace_back(100, 0, 1000, "Nch PV"); if (cfgMultCorrelationsMask & aod::cfmultset::MultNTracksGlobal) - multAxes.emplace_back(1000, 0, 1000, "Nch Global"); + multAxes.emplace_back(100, 0, 1000, "Nch Global"); registry.add("multCorrelations", "Multiplicity correlations", {HistType::kTHnSparseF, multAxes}); } registry.add("multiplicity", "event multiplicity", {HistType::kTH1F, {{1000, 0, 100, "/multiplicity/centrality"}}}); From cb44e4c21d3d924a2953a397c57b3c114262b929 Mon Sep 17 00:00:00 2001 From: Stefano Cannito <143754257+scannito@users.noreply.github.com> Date: Thu, 21 Aug 2025 00:08:23 +0200 Subject: [PATCH 125/986] [PWGLF] Improved event selection MCReco and added dependencies to event and signal loss (#12665) --- .../Tasks/Strangeness/phik0shortanalysis.cxx | 234 ++++++++++++++---- 1 file changed, 179 insertions(+), 55 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx b/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx index b38931be584..a59ea761daf 100644 --- a/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx @@ -162,13 +162,16 @@ struct Phik0shortanalysis { // Configurables on phi pT bins Configurable> binspTPhi{"binspTPhi", {0.4, 0.8, 1.4, 2.0, 2.8, 4.0, 6.0, 10.0}, "pT bin limits for Phi"}; - Configurable minPhiPt{"minPhiPt", 0.4f, "Minimum pT for Phi"}; - Configurable maxPhiPt{"maxPhiPt", 10.0f, "Maximum pT for Phi"}; - // Configurables on phi mass - Configurable nBinsMPhi{"nBinsMPhi", 13, "N bins in cfgmassPhiaxis"}; - Configurable lowMPhi{"lowMPhi", 1.0095f, "Upper limits on Phi mass for signal extraction"}; - Configurable upMPhi{"upMPhi", 1.029f, "Upper limits on Phi mass for signal extraction"}; + // Configurables on phi selection + struct : ConfigurableGroup { + Configurable nBinsMPhi{"nBinsMPhi", 13, "N bins in cfgmassPhiaxis"}; + Configurable lowMPhi{"lowMPhi", 1.0095f, "Upper limits on Phi mass for signal extraction"}; + Configurable upMPhi{"upMPhi", 1.029f, "Upper limits on Phi mass for signal extraction"}; + + Configurable minPhiPt{"minPhiPt", 0.4f, "Minimum pT for Phi"}; + Configurable maxPhiPt{"maxPhiPt", 10.0f, "Maximum pT for Phi"}; + } phiConfigs; // Configurables for V0 selection struct : ConfigurableGroup { @@ -185,11 +188,10 @@ struct Phik0shortanalysis { Configurable ctauK0s{"ctauK0s", 20.0f, "C tau K0s(cm)"}; Configurable paramArmenterosCut{"paramArmenterosCut", 0.2f, "parameter Armenteros Cut"}; Configurable v0rejK0s{"v0rejK0s", 0.005f, "V0 rej K0s"}; - } v0Configs; - // Configurables on K0S mass - Configurable lowMK0S{"lowMK0S", 0.48f, "Lower limit on K0Short mass"}; - Configurable upMK0S{"upMK0S", 0.52f, "Upper limit on K0Short mass"}; + Configurable lowMK0S{"lowMK0S", 0.48f, "Lower limit on K0Short mass"}; + Configurable upMK0S{"upMK0S", 0.52f, "Upper limit on K0Short mass"}; + } v0Configs; // Configurable on K0S pT bins Configurable> binspTK0S{"binspTK0S", {0.1, 0.5, 0.8, 1.2, 1.6, 2.0, 2.5, 3.0, 4.0, 6.0}, "pT bin limits for K0S"}; @@ -222,7 +224,8 @@ struct Phik0shortanalysis { // Configurables for dN/deta with phi computation Configurable furtherCheckonMcCollision{"furtherCheckonMcCollision", true, "Further check on MC collisions"}; - Configurable filterOnMcPhi{"filterOnMcPhi", true, "Filter on MC Phi"}; + Configurable filterOnGenPhi{"filterOnGenPhi", true, "Filter on MC Phi"}; + Configurable filterOnRecoPhiWPDG{"filterOnRecoPhiWPDG", true, "Filter on Reco Phi with WPDG"}; // Configurable for event mixing Configurable cfgNoMixedEvents{"cfgNoMixedEvents", 5, "Number of mixed events per event"}; @@ -322,7 +325,7 @@ struct Phik0shortanalysis { { // Axes AxisSpec massPhiAxis = {200, 0.9f, 1.2f, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; - AxisSpec sigmassPhiAxis = {nBinsMPhi, lowMPhi, upMPhi, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; + AxisSpec sigmassPhiAxis = {phiConfigs.nBinsMPhi, phiConfigs.lowMPhi, phiConfigs.upMPhi, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; AxisSpec massK0SAxis = {200, 0.45f, 0.55f, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; AxisSpec nSigmaPiAxis = {100, -10.0f, 10.0f, "N#sigma #pi"}; AxisSpec vertexZAxis = {100, -cutZVertex, cutZVertex, "vrtx_{Z} [cm]"}; @@ -383,10 +386,12 @@ struct Phik0shortanalysis { mcEventHist.add("hRecoMCMultiplicityPercent", "RecoMC Multiplicity Percentile", kTH1F, {binnedmultAxis}); mcEventHist.add("hRecoMCMultiplicityPercentWithPhi", "RecoMC Multiplicity Percentile in Events with a Phi Candidate", kTH1F, {binnedmultAxis}); mcEventHist.add("h2RecoMCVertexZvsMult", "RecoMC Vertex Z vs Multiplicity Percentile", kTH2F, {vertexZAxis, binnedmultAxis}); + mcEventHist.add("hSplitVertexZ", "Split in z-vtx", kTH1F, {{100, -5.0f, 5.0f}}); mcEventHist.add("hGenMCVertexZ", "hGenMCVertexZ", kTH1F, {vertexZAxis}); mcEventHist.add("hGenMCMultiplicityPercent", "GenMC Multiplicity Percentile", kTH1F, {binnedmultAxis}); mcEventHist.add("hGenMCAssocRecoMultiplicityPercent", "GenMC AssocReco Multiplicity Percentile", kTH1F, {binnedmultAxis}); + mcEventHist.add("h2GenMCAssocRecoVertexZvsMult", "GenMC AssocReco Vertex Z vs Multiplicity Percentile", kTH2F, {vertexZAxis, binnedmultAxis}); mcEventHist.add("hGenMCRecoMultiplicityPercent", "GenMCReco Multiplicity Percentile", kTH1F, {binnedmultAxis}); mcEventHist.add("h2GenMCRecoVertexZvsMult", "GenMCReco Vertex Z vs Multiplicity Percentile", kTH2F, {vertexZAxis, binnedmultAxis}); @@ -394,8 +399,8 @@ struct Phik0shortanalysis { mcEventHist.add("h6RecoMCEtaDistribution", "Eta vs multiplicity in MCReco", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, phiAxis, {6, -0.5f, 5.5f}, {3, -0.5f, 2.5f}}); mcEventHist.add("h6RecoCheckMCEtaDistribution", "Eta vs multiplicity in MCReco Check", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, phiAxis, {6, -0.5f, 5.5f}, {3, -0.5f, 2.5f}}); - mcEventHist.add("h2GenMCEtaDistribution", "Eta vs multiplicity in MCGen", kTH2F, {binnedmultAxis, etaAxis}); - mcEventHist.add("h2GenMCEtaDistributionAssocReco", "Eta vs multiplicity in MCGen Assoc Reco", kTH2F, {binnedmultAxis, etaAxis}); + mcEventHist.add("h5GenMCEtaDistribution", "Eta vs multiplicity in MCGen", kTHnSparseF, {binnedmultAxis, etaAxis, phiAxis, {6, -0.5f, 5.5f}, {3, -0.5f, 2.5f}}); + mcEventHist.add("h6GenMCEtaDistributionAssocReco", "Eta vs multiplicity in MCGen Assoc Reco", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, phiAxis, {6, -0.5f, 5.5f}, {3, -0.5f, 2.5f}}); mcEventHist.add("h6GenMCEtaDistributionReco", "Eta vs multiplicity in MCGen Reco", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, phiAxis, {6, -0.5f, 5.5f}, {3, -0.5f, 2.5f}}); mcEventHist.add("h6GenMCEtaDistributionRecoCheck", "Eta vs multiplicity in MCGen Reco Check", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, phiAxis, {6, -0.5f, 5.5f}, {3, -0.5f, 2.5f}}); @@ -938,7 +943,7 @@ struct Phik0shortanalysis { } template - bool eventHasPhi(const T1& posTracks, const T2& negTracks) + bool eventHasRecoPhi(const T1& posTracks, const T2& negTracks) { int nPhi = 0; @@ -957,9 +962,9 @@ struct Phik0shortanalysis { continue; // condition to avoid double counting of pair ROOT::Math::PxPyPzMVector recPhi = recMother(track1, track2, massKa, massKa); - if (recPhi.Pt() < minPhiPt || recPhi.Pt() > maxPhiPt) + if (recPhi.Pt() < phiConfigs.minPhiPt) continue; - if (recPhi.M() < lowMPhi || recPhi.M() > upMPhi) + if (recPhi.M() < phiConfigs.lowMPhi || recPhi.M() > phiConfigs.upMPhi) continue; if (std::abs(recPhi.Rapidity()) > deltaYConfigs.cfgYAcceptance) continue; @@ -973,19 +978,95 @@ struct Phik0shortanalysis { return false; } + template + bool eventHasRecoPhiWPDG(const T1& posTracks, const T2& negTracks) + { + int nPhi = 0; + + for (const auto& track1 : posTracks) { + if (!selectionTrackResonance(track1, false) || !selectionPIDKaonpTdependent(track1)) + continue; // topological and PID selection + + auto track1ID = track1.globalIndex(); + + if (!track1.has_mcParticle()) + continue; + auto mcTrack1 = track1.template mcParticle_as(); + if (mcTrack1.pdgCode() != PDG_t::kKPlus || !mcTrack1.isPhysicalPrimary()) + continue; + + for (const auto& track2 : negTracks) { + if (!selectionTrackResonance(track2, false) || !selectionPIDKaonpTdependent(track2)) + continue; // topological and PID selection + + auto track2ID = track2.globalIndex(); + if (track2ID == track1ID) + continue; // condition to avoid double counting of pair + + if (!track2.has_mcParticle()) + continue; + auto mcTrack2 = track2.template mcParticle_as(); + if (mcTrack2.pdgCode() != PDG_t::kKMinus || !mcTrack2.isPhysicalPrimary()) + continue; + + float pTMother = -1.0f; + float yMother = -1.0f; + bool isMCMotherPhi = false; + for (const auto& motherOfMcTrack1 : mcTrack1.template mothers_as()) { + for (const auto& motherOfMcTrack2 : mcTrack2.template mothers_as()) { + if (motherOfMcTrack1.pdgCode() != motherOfMcTrack2.pdgCode()) + continue; + if (motherOfMcTrack1.globalIndex() != motherOfMcTrack2.globalIndex()) + continue; + if (motherOfMcTrack1.pdgCode() != o2::constants::physics::Pdg::kPhi) + continue; + + pTMother = motherOfMcTrack1.pt(); + yMother = motherOfMcTrack1.y(); + isMCMotherPhi = true; + } + } + + if (!isMCMotherPhi) + continue; + if (pTMother < phiConfigs.minPhiPt || std::abs(yMother) > deltaYConfigs.cfgYAcceptance) + continue; + + nPhi++; + } + } + + if (nPhi > 0) + return true; + return false; + } + template - bool eventHasMCPhi(const T& mcParticles) + bool eventHasGenPhi(const T& mcParticles) { int nPhi = 0; for (const auto& mcParticle : mcParticles) { if (mcParticle.pdgCode() != o2::constants::physics::Pdg::kPhi) continue; - if (mcParticle.pt() < minPhiPt || mcParticle.pt() > maxPhiPt) + if (mcParticle.pt() < phiConfigs.minPhiPt) continue; if (std::abs(mcParticle.y()) > deltaYConfigs.cfgYAcceptance) continue; + auto kDaughters = mcParticle.template daughters_as(); + if (kDaughters.size() != 2) + continue; + bool isPosKaon = false, isNegKaon = false; + for (const auto& kDaughter : kDaughters) { + if (kDaughter.pdgCode() == PDG_t::kKPlus) + isPosKaon = true; + if (kDaughter.pdgCode() == PDG_t::kKMinus) + isNegKaon = true; + } + if (!isPosKaon || !isNegKaon) + continue; + nPhi++; } @@ -1219,7 +1300,7 @@ struct Phik0shortanalysis { continue; // condition to avoid double counting of pair ROOT::Math::PxPyPzMVector recPhi = recMother(track1, track2, massKa, massKa); - if (recPhi.Pt() < minPhiPt || recPhi.Pt() > maxPhiPt) + if (recPhi.Pt() < phiConfigs.minPhiPt || recPhi.Pt() > phiConfigs.maxPhiPt) continue; if (std::abs(recPhi.Rapidity()) > deltaYConfigs.cfgYAcceptance) continue; @@ -1253,7 +1334,7 @@ struct Phik0shortanalysis { dataK0SHist.fill(HIST("hV0CosPA"), v0.v0cosPA()); // Filling the PID of the V0 daughters in the region of the K0 peak - if (lowMK0S < v0.mK0Short() && v0.mK0Short() < upMK0S) { + if (v0Configs.lowMK0S < v0.mK0Short() && v0.mK0Short() < v0Configs.upMK0S) { dataK0SHist.fill(HIST("hNSigmaPosPionFromK0S"), posDaughterTrack.tpcInnerParam(), posDaughterTrack.tpcNSigmaPi()); dataK0SHist.fill(HIST("hNSigmaNegPionFromK0S"), negDaughterTrack.tpcInnerParam(), negDaughterTrack.tpcNSigmaPi()); } @@ -1358,9 +1439,9 @@ struct Phik0shortanalysis { continue; // condition to avoid double counting of pair ROOT::Math::PxPyPzMVector recPhi = recMother(track1, track2, massKa, massKa); - if (recPhi.Pt() < minPhiPt || recPhi.Pt() > maxPhiPt) + if (recPhi.Pt() < phiConfigs.minPhiPt || recPhi.Pt() > phiConfigs.maxPhiPt) continue; - if (recPhi.M() < lowMPhi || recPhi.M() > upMPhi) + if (recPhi.M() < phiConfigs.lowMPhi || recPhi.M() > phiConfigs.upMPhi) continue; if (std::abs(recPhi.Rapidity()) > deltaYConfigs.cfgYAcceptance) continue; @@ -1445,9 +1526,9 @@ struct Phik0shortanalysis { continue; // condition to avoid double counting of pair ROOT::Math::PxPyPzMVector recPhi = recMother(track1, track2, massKa, massKa); - if (recPhi.Pt() < minPhiPt || recPhi.Pt() > maxPhiPt) + if (recPhi.Pt() < phiConfigs.minPhiPt || recPhi.Pt() > phiConfigs.maxPhiPt) continue; - if (recPhi.M() < lowMPhi || recPhi.M() > upMPhi) + if (recPhi.M() < phiConfigs.lowMPhi || recPhi.M() > phiConfigs.upMPhi) continue; if (std::abs(recPhi.Rapidity()) > deltaYConfigs.cfgYAcceptance) continue; @@ -1551,7 +1632,7 @@ struct Phik0shortanalysis { continue; ROOT::Math::PxPyPzMVector recPhi = recMother(track1, track2, massKa, massKa); - if (recPhi.Pt() < minPhiPt || recPhi.Pt() > maxPhiPt) + if (recPhi.Pt() < phiConfigs.minPhiPt || recPhi.Pt() > phiConfigs.maxPhiPt) continue; mcPhiHist.fill(HIST("h3PhiRapiditySmearing"), genmultiplicity, recPhi.Rapidity(), mcMotherPhi.y()); @@ -1693,7 +1774,7 @@ struct Phik0shortanalysis { for (const auto& mcParticle : mcParticlesThisColl) { if (mcParticle.pdgCode() != o2::constants::physics::Pdg::kPhi) continue; - if (mcParticle.pt() < minPhiPt || mcParticle.pt() > maxPhiPt) + if (mcParticle.pt() < phiConfigs.minPhiPt || mcParticle.pt() > phiConfigs.maxPhiPt) continue; if (std::abs(mcParticle.y()) > deltaYConfigs.cfgYAcceptance) continue; @@ -1771,7 +1852,7 @@ struct Phik0shortanalysis { for (const auto& mcParticle : mcParticlesThisColl) { if (mcParticle.pdgCode() != o2::constants::physics::Pdg::kPhi) continue; - if (mcParticle.pt() < minPhiPt || mcParticle.pt() > maxPhiPt) + if (mcParticle.pt() < phiConfigs.minPhiPt || mcParticle.pt() > phiConfigs.maxPhiPt) continue; if (std::abs(mcParticle.y()) > deltaYConfigs.cfgYAcceptance) continue; @@ -1799,7 +1880,7 @@ struct Phik0shortanalysis { for (const auto& mcParticle : mcParticlesThisColl) { if (mcParticle.pdgCode() != o2::constants::physics::Pdg::kPhi) continue; - if (mcParticle.pt() < minPhiPt || mcParticle.pt() > maxPhiPt) + if (mcParticle.pt() < phiConfigs.minPhiPt || mcParticle.pt() > phiConfigs.maxPhiPt) continue; if (std::abs(mcParticle.y()) > deltaYConfigs.cfgYAcceptance) continue; @@ -1860,7 +1941,7 @@ struct Phik0shortanalysis { continue; // condition to avoid double counting of pair ROOT::Math::PxPyPzMVector recPhi = recMother(track1, track2, massKa, massKa); - if (recPhi.Pt() < minPhiPt || recPhi.Pt() > maxPhiPt) + if (recPhi.Pt() < phiConfigs.minPhiPt || recPhi.Pt() > phiConfigs.maxPhiPt) continue; if (std::abs(recPhi.Rapidity()) > deltaYConfigs.cfgYAcceptance) continue; @@ -2036,9 +2117,9 @@ struct Phik0shortanalysis { } ROOT::Math::PxPyPzMVector recPhi = recMother(track1, track2, massKa, massKa); - if (recPhi.Pt() < minPhiPt || recPhi.Pt() > maxPhiPt) + if (recPhi.Pt() < phiConfigs.minPhiPt || recPhi.Pt() > phiConfigs.maxPhiPt) continue; - if (recPhi.M() < lowMPhi || recPhi.M() > upMPhi) + if (recPhi.M() < phiConfigs.lowMPhi || recPhi.M() > phiConfigs.upMPhi) continue; if (std::abs(recPhi.Rapidity()) > deltaYConfigs.cfgYAcceptance) continue; @@ -2158,9 +2239,9 @@ struct Phik0shortanalysis { } ROOT::Math::PxPyPzMVector recPhi = recMother(track1, track2, massKa, massKa); - if (recPhi.Pt() < minPhiPt || recPhi.Pt() > maxPhiPt) + if (recPhi.Pt() < phiConfigs.minPhiPt || recPhi.Pt() > phiConfigs.maxPhiPt) continue; - if (recPhi.M() < lowMPhi || recPhi.M() > upMPhi) + if (recPhi.M() < phiConfigs.lowMPhi || recPhi.M() > phiConfigs.upMPhi) continue; if (std::abs(recPhi.Rapidity()) > deltaYConfigs.cfgYAcceptance) continue; @@ -2376,7 +2457,7 @@ struct Phik0shortanalysis { if (!isPosKaon || !isNegKaon) continue; } - if (mcParticle2.pt() < minPhiPt || mcParticle2.pt() > maxPhiPt) + if (mcParticle2.pt() < phiConfigs.minPhiPt || mcParticle2.pt() > phiConfigs.maxPhiPt) continue; if (std::abs(mcParticle2.y()) > deltaYConfigs.cfgYAcceptance) continue; @@ -2453,7 +2534,7 @@ struct Phik0shortanalysis { if (!isPosKaon || !isNegKaon) continue; } - if (mcParticle2.pt() < minPhiPt || mcParticle2.pt() > maxPhiPt) + if (mcParticle2.pt() < phiConfigs.minPhiPt || mcParticle2.pt() > phiConfigs.maxPhiPt) continue; if (std::abs(mcParticle2.y()) > deltaYConfigs.cfgYAcceptance) continue; @@ -2489,7 +2570,7 @@ struct Phik0shortanalysis { auto negThisColl = negFiltTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); // Check if the event contains a phi candidate - if (!eventHasPhi(posThisColl, negThisColl)) + if (!eventHasRecoPhi(posThisColl, negThisColl)) return; dataEventHist.fill(HIST("hMultiplicityPercent"), collision.centFT0M()); @@ -2523,7 +2604,7 @@ struct Phik0shortanalysis { if (furtherCheckonMcCollision && (std::abs(mcCollision.posZ()) > cutZVertex || !pwglf::isINELgtNmc(mcParticlesThisColl, 0, pdgDB))) return; - if (filterOnMcPhi && !eventHasMCPhi(mcParticlesThisColl)) + if (filterOnGenPhi && !eventHasGenPhi(mcParticlesThisColl)) return; mcEventHist.fill(HIST("hRecoMCMultiplicityPercent"), mcCollision.centFT0M()); @@ -2573,20 +2654,31 @@ struct Phik0shortanalysis { void processdNdetaWPhiMCGen(MCCollisions::iterator const& mcCollision, soa::SmallGroups const& collisions, FilteredMCTracks const& filteredMCTracks, aod::McParticles const& mcParticles) { - if (std::abs(mcCollision.posZ()) > cutZVertex) - return; if (!pwglf::isINELgtNmc(mcParticles, 0, pdgDB)) return; - if (filterOnMcPhi && !eventHasMCPhi(mcParticles)) + if (filterOnGenPhi && !eventHasGenPhi(mcParticles)) return; uint64_t numberAssocColl = 0; + std::vector zVtxs; + for (const auto& collision : collisions) { if (acceptEventQA(collision, false)) { + auto filteredMCTracksThisColl = filteredMCTracks.sliceBy(preslices.perColl, collision.globalIndex()); + + Partition posFiltMCTracks = aod::track::signed1Pt > trackConfigs.cfgCutCharge; + posFiltMCTracks.bindTable(filteredMCTracksThisColl); + Partition negFiltMCTracks = aod::track::signed1Pt < trackConfigs.cfgCutCharge; + negFiltMCTracks.bindTable(filteredMCTracksThisColl); + + if (filterOnRecoPhiWPDG && !eventHasRecoPhiWPDG(posFiltMCTracks, negFiltMCTracks)) + continue; + mcEventHist.fill(HIST("hGenMCRecoMultiplicityPercent"), mcCollision.centFT0M()); mcEventHist.fill(HIST("h2GenMCRecoVertexZvsMult"), collision.posZ(), mcCollision.centFT0M()); - auto filteredMCTracksThisColl = filteredMCTracks.sliceBy(preslices.perColl, collision.globalIndex()); + zVtxs.push_back(collision.posZ()); + for (const auto& track : filteredMCTracksThisColl) { if (trackConfigs.applyExtraPhiCuts && ((track.phi() > trackConfigs.extraPhiCuts->at(0) && track.phi() < trackConfigs.extraPhiCuts->at(1)) || track.phi() <= trackConfigs.extraPhiCuts->at(2) || track.phi() >= trackConfigs.extraPhiCuts->at(3))) @@ -2631,16 +2723,48 @@ struct Phik0shortanalysis { } mcEventHist.fill(HIST("hGenMCMultiplicityPercent"), mcCollision.centFT0M()); - if (numberAssocColl > 0) + + if (numberAssocColl > 0) { + float zVtxRef = zVtxs[0]; + if (zVtxs.size() > 1) { + for (size_t i = 1; i < zVtxs.size(); ++i) { + mcEventHist.fill(HIST("hSplitVertexZ"), zVtxs[i] - zVtxRef); + } + } + mcEventHist.fill(HIST("hGenMCAssocRecoMultiplicityPercent"), mcCollision.centFT0M()); + mcEventHist.fill(HIST("h2GenMCAssocRecoVertexZvsMult"), zVtxRef, mcCollision.centFT0M()); + } for (const auto& mcParticle : mcParticles) { if (!isGenParticleCharged(mcParticle)) continue; - mcEventHist.fill(HIST("h2GenMCEtaDistribution"), mcCollision.centFT0M(), mcParticle.eta()); - if (numberAssocColl > 0) - mcEventHist.fill(HIST("h2GenMCEtaDistributionAssocReco"), mcCollision.centFT0M(), mcParticle.eta()); + int pid = fromPDGToEnum(mcParticle.pdgCode()); + + mcEventHist.fill(HIST("h5GenMCEtaDistribution"), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kNoGenpTVar); + if (mcParticle.pt() < trackConfigs.cMinChargedParticlePtcut) { + mcEventHist.fill(HIST("h5GenMCEtaDistribution"), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup, -10.0f * mcParticle.pt() + 2.0f); + mcEventHist.fill(HIST("h5GenMCEtaDistribution"), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown, 5.0f * mcParticle.pt() + 0.5f); + } else { + mcEventHist.fill(HIST("h5GenMCEtaDistribution"), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup); + mcEventHist.fill(HIST("h5GenMCEtaDistribution"), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown); + } + mcEventHist.fill(HIST("h5GenMCEtaDistribution"), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), pid, kNoGenpTVar); + + if (numberAssocColl > 0) { + float zVtxRef = zVtxs[0]; + + mcEventHist.fill(HIST("h6GenMCEtaDistributionAssocReco"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kNoGenpTVar); + if (mcParticle.pt() < trackConfigs.cMinChargedParticlePtcut) { + mcEventHist.fill(HIST("h6GenMCEtaDistributionAssocReco"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup, -10.0f * mcParticle.pt() + 2.0f); + mcEventHist.fill(HIST("h6GenMCEtaDistributionAssocReco"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown, 5.0f * mcParticle.pt() + 0.5f); + } else { + mcEventHist.fill(HIST("h6GenMCEtaDistributionAssocReco"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup); + mcEventHist.fill(HIST("h6GenMCEtaDistributionAssocReco"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown); + } + mcEventHist.fill(HIST("h6GenMCEtaDistributionAssocReco"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), pid, kNoGenpTVar); + } } } @@ -2684,7 +2808,7 @@ struct Phik0shortanalysis { continue; // condition to avoid double counting of pair ROOT::Math::PxPyPzMVector recPhi = recMother(track1, track2, massKa, massKa); - if (recPhi.Pt() < minPhiPt || recPhi.Pt() > maxPhiPt) + if (recPhi.Pt() < phiConfigs.minPhiPt || recPhi.Pt() > phiConfigs.maxPhiPt) continue; if (std::abs(recPhi.Rapidity()) > deltaYConfigs.cfgYAcceptance) continue; @@ -2720,7 +2844,7 @@ struct Phik0shortanalysis { dataK0SHist.fill(HIST("hV0CosPA"), v0.v0cosPA()); // Filling the PID of the V0 daughters in the region of the K0 peak - if (lowMK0S < v0.mK0Short() && v0.mK0Short() < upMK0S) { + if (v0Configs.lowMK0S < v0.mK0Short() && v0.mK0Short() < v0Configs.upMK0S) { dataK0SHist.fill(HIST("hNSigmaPosPionFromK0S"), posDaughterTrack.tpcInnerParam(), posDaughterTrack.tpcNSigmaPi()); dataK0SHist.fill(HIST("hNSigmaNegPionFromK0S"), negDaughterTrack.tpcInnerParam(), negDaughterTrack.tpcNSigmaPi()); } @@ -2802,7 +2926,7 @@ struct Phik0shortanalysis { continue; // condition to avoid double counting of pair ROOT::Math::PxPyPzMVector recPhi = recMother(track1, track2, massKa, massKa); - if (recPhi.Pt() < minPhiPt || recPhi.Pt() > maxPhiPt) + if (recPhi.Pt() < phiConfigs.minPhiPt || recPhi.Pt() > phiConfigs.maxPhiPt) continue; if (std::abs(recPhi.Rapidity()) > deltaYConfigs.cfgYAcceptance) continue; @@ -2947,7 +3071,7 @@ struct Phik0shortanalysis { if (!isMCMotherPhi) continue; - if (pTMother < minPhiPt || std::abs(yMother) > deltaYConfigs.cfgYAcceptance) + if (pTMother < phiConfigs.minPhiPt || std::abs(yMother) > deltaYConfigs.cfgYAcceptance) continue; mcPhiHist.fill(HIST("h3PhiMCRecoNewProc"), genmultiplicity, pTMother, yMother); @@ -3018,7 +3142,7 @@ struct Phik0shortanalysis { continue; // Phi selection - if (mcParticle.pdgCode() == o2::constants::physics::Pdg::kPhi && mcParticle.pt() >= minPhiPt) + if (mcParticle.pdgCode() == o2::constants::physics::Pdg::kPhi && mcParticle.pt() >= phiConfigs.minPhiPt) mcPhiHist.fill(HIST("h3PhiMCGenRecoCheckNewProc"), genmultiplicity, mcParticle.pt(), mcParticle.y()); // K0S selection @@ -3054,7 +3178,7 @@ struct Phik0shortanalysis { continue; // Phi selection - if (mcParticle.pdgCode() == o2::constants::physics::Pdg::kPhi && mcParticle.pt() >= minPhiPt) + if (mcParticle.pdgCode() == o2::constants::physics::Pdg::kPhi && mcParticle.pt() >= phiConfigs.minPhiPt) mcPhiHist.fill(HIST("h3PhiMCGenRecoNewProc"), genmultiplicity, mcParticle.pt(), mcParticle.y()); // K0S selection @@ -3083,7 +3207,7 @@ struct Phik0shortanalysis { continue; // Phi selection - if (mcParticle.pdgCode() == o2::constants::physics::Pdg::kPhi && mcParticle.pt() >= minPhiPt) { + if (mcParticle.pdgCode() == o2::constants::physics::Pdg::kPhi && mcParticle.pt() >= phiConfigs.minPhiPt) { mcPhiHist.fill(HIST("h3PhiMCGenNewProc"), genmultiplicity, mcParticle.pt(), mcParticle.y()); if (numberAssocColl > 0) mcPhiHist.fill(HIST("h3PhiMCGenAssocRecoNewProc"), genmultiplicity, mcParticle.pt(), mcParticle.y()); @@ -3129,7 +3253,7 @@ struct Phik0shortanalysis { continue; ROOT::Math::PxPyPzMVector recPhi = recMother(posTrack1, negTrack1, massKa, massKa); - if (recPhi.Pt() < minPhiPt) + if (recPhi.Pt() < phiConfigs.minPhiPt) continue; if (std::abs(recPhi.Rapidity()) > deltaYConfigs.cfgYAcceptance) continue; @@ -3180,7 +3304,7 @@ struct Phik0shortanalysis { continue; ROOT::Math::PxPyPzMVector recPhi = recMother(posTrack1, negTrack1, massKa, massKa); - if (recPhi.Pt() < minPhiPt) + if (recPhi.Pt() < phiConfigs.minPhiPt) continue; if (std::abs(recPhi.Rapidity()) > deltaYConfigs.cfgYAcceptance) continue; From e7ecee584318157c7f47e38d0d4b05f4ee12474d Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Thu, 21 Aug 2025 10:39:55 +0530 Subject: [PATCH 126/986] [PWGLF] Generated multiplicity added (#12663) Co-authored-by: Sawan Sawan --- PWGLF/Tasks/Resonances/kstarqa.cxx | 115 ++++++++++------------------- 1 file changed, 40 insertions(+), 75 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarqa.cxx b/PWGLF/Tasks/Resonances/kstarqa.cxx index c2a721948ca..b4a6e3a2ee4 100644 --- a/PWGLF/Tasks/Resonances/kstarqa.cxx +++ b/PWGLF/Tasks/Resonances/kstarqa.cxx @@ -305,23 +305,32 @@ struct Kstarqa { // MC histograms hInvMass.add("hk892GenpT", "pT distribution of True MC K(892)0", kTHnSparseF, {ptAxis, multiplicityAxis}); hInvMass.add("hk892GenpT2", "pT distribution of True MC K(892)0", kTHnSparseF, {ptAxis, multiplicityAxis}); + hInvMass.add("hk892GenpTCalib1", "pT distribution of True MC K(892)0", kTHnSparseF, {ptAxis, multiplicityAxis}); + hInvMass.add("hk892GenpTCalib2", "pT distribution of True MC K(892)0", kTHnSparseF, {ptAxis, multiplicityAxis}); hInvMass.add("h1KstarRecMass", "Invariant mass of kstar meson", kTH1F, {invmassAxis}); hInvMass.add("h2KstarRecpt1", "pT of kstar meson", kTHnSparseF, {ptAxis, multiplicityAxis, invmassAxis}); - hInvMass.add("h2KstarRecpt2", "pT of generated kstar meson", kTHnSparseF, {ptAxis, multiplicityAxis, invmassAxis}); + hInvMass.add("h2KstarRecpt2", "pT of kstar meson", kTHnSparseF, {ptAxis, multiplicityAxis, invmassAxis}); + hInvMass.add("h2KstarRecptCalib1", "pT of kstar meson", kTHnSparseF, {ptAxis, multiplicityAxis, invmassAxis}); + hInvMass.add("h2KstarRecptCalib2", "pT of kstar meson", kTHnSparseF, {ptAxis, multiplicityAxis, invmassAxis}); hInvMass.add("h1genmass", "Invariant mass of generated kstar meson", kTH1F, {invmassAxis}); hInvMass.add("h1GenMult", "Multiplicity generated", kTH1F, {multiplicityAxis}); + hInvMass.add("h1GenMult2", "Multiplicity generated (direct)", kTH1F, {multiplicityAxis}); hInvMass.add("h1RecMult", "Multiplicity reconstructed", kTH1F, {multiplicityAxis}); + hInvMass.add("h1RecMult2", "Multiplicity reconstructed", kTH1F, {multiplicityAxis}); hInvMass.add("h1KSRecsplit", "KS meson Rec split", kTH1F, {{100, 0.0f, 10.0f}}); - hInvMass.add("MCcorrections/hSignalLossDenominator", "Kstar generated before event selection", kTH2F, {{ptAxis}, {impactParAxis}}); - hInvMass.add("MCcorrections/hSignalLossNumerator", "Kstar generated after event selection", kTH2F, {{ptAxis}, {impactParAxis}}); + hInvMass.add("MCcorrections/hSignalLossDenominator", "Kstar generated before event selection", kTH2F, {{ptAxis}, {multiplicityAxis}}); + hInvMass.add("MCcorrections/hSignalLossNumerator", "Kstar generated after event selection", kTH2F, {{ptAxis}, {multiplicityAxis}}); // hInvMass.add("hAllGenCollisionsImpact", "All generated collisions vs impact parameter", kTH1F, {multiplicityAxis}); hInvMass.add("hAllGenCollisions", "All generated events", kTH1F, {multiplicityAxis}); hInvMass.add("hAllGenCollisions1Rec", "All gen events with at least one rec event", kTH1F, {multiplicityAxis}); hInvMass.add("hAllKstarGenCollisisons", "All generated Kstar in events with rapidity in 0.5", kTH2F, {{multiplicityAxis}, {ptAxis}}); hInvMass.add("hAllKstarGenCollisisons1Rec", "All generated Kstar in events with at least one rec event in rapidity in 0.5", kTH2F, {{multiplicityAxis}, {ptAxis}}); hInvMass.add("hAllRecCollisions", "All reconstructed events", kTH1F, {multiplicityAxis}); + hInvMass.add("hAllRecCollisionsCalib", "All reconstructed events", kTH1F, {multiplicityAxis}); hInvMass.add("MCcorrections/hImpactParameterRec", "Impact parameter in reconstructed MC", kTH1F, {impactParAxis}); + hInvMass.add("MCcorrections/MultiplicityRec", "Multiplicity in reconstructed MC", kTH1F, {multiplicityAxis}); hInvMass.add("MCcorrections/hImpactParameterGen", "Impact parameter in generated MC", kTH1F, {impactParAxis}); + hInvMass.add("MCcorrections/MultiplicityGen", "Multiplicity in generated MC", kTH1F, {multiplicityAxis}); hInvMass.add("MCcorrections/hImpactParametervsMultiplicity", "Impact parameter vs multiplicity in reconstructed MC", kTH2F, {{impactParAxis}, {multiplicityAxis}}); rEventSelection.add("tracksCheckData", "No. of events in the data", kTH1I, {{10, 0, 10}}); rEventSelection.add("eventsCheckGen", "No. of events in the generated MC", kTH1I, {{10, 0, 10}}); @@ -753,7 +762,8 @@ struct Kstarqa { // using EventCandidatesMC = soa::Filtered>; using TrackCandidatesMC = soa::Filtered>; - using EventMCGenerated = soa::Join; // aod::CentNGlobals, aod::CentNTPVs, aod::CentMFTs + // using EventMCGenerated = soa::Join; // aod::CentNGlobals, aod::CentNTPVs, aod::CentMFTs + using EventMCGenerated = soa::Join; //*********Varibles declaration*************** float multiplicity{-1.0}, theta2; @@ -1484,8 +1494,8 @@ struct Kstarqa { Service pdgDB; - // void processGen(EventMCGenerated::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& collisions) - void processGen(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& collisions) + void processGen(EventMCGenerated::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& collisions) + // void processGen(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& collisions) { rEventSelection.fill(HIST("eventsCheckGen"), 0.5); @@ -1521,32 +1531,10 @@ struct Kstarqa { rEventSelection.fill(HIST("eventsCheckGen"), 2.5); for (const auto& collision : collisions) { - // if (!collision.sel8() || std::abs(collision.mcCollision().posZ()) > selectionConfig.cutzvertex) { - // if (std::abs(collision.mcCollision().posZ()) > selectionConfig.cutzvertex) { - // continue; - // } - // if (!collision.sel8()) { - // continue; - // } - // if (selectionConfig.isNoTimeFrameBorder && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { - // continue; - // } - // if (selectionConfig.isTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { - // continue; - // } - // if (selectionConfig.isINELgt0 && !collision.isInelGt0()) { - // continue; - // } - // if (selectionConfig.isNoSameBunchPileup && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { - // continue; - // } - // if (selectionConfig.isGoodZvtxFT0vsPV && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { - // continue; - // } if (!selectionEvent(collision, true)) { continue; } - // multiplicity = collision.centFT0M(); + multiplicity = collision.centFT0M(); if (cSelectMultEstimator == kFT0M) { multiplicity = collision.centFT0M(); @@ -1564,7 +1552,7 @@ struct Kstarqa { int occupancy = collision.trackOccupancyInTimeRange(); rEventSelection.fill(HIST("hOccupancy"), occupancy); - selectedEvents[nevts++] = collision.mcCollision_as().globalIndex(); + selectedEvents[nevts++] = collision.mcCollision_as().globalIndex(); } selectedEvents.resize(nevts); @@ -1579,6 +1567,8 @@ struct Kstarqa { if (!cAllGenCollisions && !evtReconstructedAndSelected) { // Check that the event is reconstructed and that the reconstructed events pass the selection return; } + double genMultiplicity = mcCollision.centFT0M(); + hInvMass.fill(HIST("h1GenMult2"), genMultiplicity); hInvMass.fill(HIST("hAllGenCollisions1Rec"), multiplicity); rEventSelection.fill(HIST("eventsCheckGen"), 3.5); @@ -1625,14 +1615,16 @@ struct Kstarqa { mother = daughter1 + daughter2; // Kstar meson hInvMass.fill(HIST("hk892GenpT"), mcParticle.pt(), multiplicity); hInvMass.fill(HIST("hk892GenpT2"), mother.Pt(), multiplicity); + hInvMass.fill(HIST("hk892GenpTCalib1"), mcParticle.pt(), genMultiplicity); + hInvMass.fill(HIST("hk892GenpTCalib2"), mother.Pt(), genMultiplicity); hInvMass.fill(HIST("h1genmass"), mother.M()); } } } PROCESS_SWITCH(Kstarqa, processGen, "Process Generated", false); - // void processEvtLossSigLossMC(EventMCGenerated::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions) - void processEvtLossSigLossMC(aod::McCollisions::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions) + void processEvtLossSigLossMC(EventMCGenerated::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions) + // void processEvtLossSigLossMC(aod::McCollisions::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions) { // if (selectionConfig.isINELgt0 && !mcCollision.isInelGt0()) { // return; @@ -1648,7 +1640,10 @@ struct Kstarqa { } auto impactPar = mcCollision.impactParameter(); + multiplicity = -1; + multiplicity = mcCollision.centFT0M(); hInvMass.fill(HIST("MCcorrections/hImpactParameterGen"), impactPar); + hInvMass.fill(HIST("MCcorrections/MultiplicityGen"), multiplicity); bool isSelectedEvent = false; auto multiplicity1 = -999.; @@ -1675,6 +1670,7 @@ struct Kstarqa { // Event loss if (isSelectedEvent) { hInvMass.fill(HIST("MCcorrections/hImpactParameterRec"), impactPar); + hInvMass.fill(HIST("MCcorrections/MultiplicityRec"), multiplicity); hInvMass.fill(HIST("MCcorrections/hImpactParametervsMultiplicity"), impactPar, multiplicity1); } @@ -1684,21 +1680,26 @@ struct Kstarqa { continue; // signal loss estimation - hInvMass.fill(HIST("MCcorrections/hSignalLossDenominator"), mcPart.pt(), impactPar); + hInvMass.fill(HIST("MCcorrections/hSignalLossDenominator"), mcPart.pt(), multiplicity); if (isSelectedEvent) { - hInvMass.fill(HIST("MCcorrections/hSignalLossNumerator"), mcPart.pt(), impactPar); + hInvMass.fill(HIST("MCcorrections/hSignalLossNumerator"), mcPart.pt(), multiplicity); } } // end loop on gen particles } PROCESS_SWITCH(Kstarqa, processEvtLossSigLossMC, "Process Signal Loss, Event Loss", false); - void processRec(EventCandidatesMC::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const&, aod::McCollisions const& /*mcCollisions*/) + void processRec(EventCandidatesMC::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const&, aod::McCollisions const&) { if (!collision.has_mcCollision()) { return; } + double multiplicityRec = -1.0; + // multiplicityRec = collision.mcCollision_as().centFT0M(); + const auto& mcCollisionRec = collision.mcCollision_as(); + multiplicityRec = mcCollisionRec.centFT0M(); + if (selectionConfig.isINELgt0 && !collision.isInelGt0()) { return; } @@ -1719,52 +1720,14 @@ struct Kstarqa { } hInvMass.fill(HIST("hAllRecCollisions"), multiplicity); + hInvMass.fill(HIST("hAllRecCollisionsCalib"), multiplicityRec); if (!selectionEvent(collision, false)) { return; } - // // if (std::abs(collision.mcCollision().posZ()) > selectionConfig.cutzvertex || !collision.sel8()) { - // if (std::abs(collision.mcCollision().posZ()) > selectionConfig.cutzvertex) { - // return; - // } - - // if (selectionConfig.isNoTimeFrameBorder && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { - // return; - // } - - // if (selectionConfig.isTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { - // return; - // } - - // if (!collision.sel8()) { - // return; - // } - - // if (selectionConfig.isNoSameBunchPileup && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { - // return; - // } - // if (selectionConfig.isGoodZvtxFT0vsPV && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { - // return; - // } - - // multiplicity = collision.centFT0M(); - - multiplicity = -1.0; - - if (cSelectMultEstimator == kFT0M) { - multiplicity = collision.centFT0M(); - } else if (cSelectMultEstimator == kFT0A) { - multiplicity = collision.centFT0A(); - } else if (cSelectMultEstimator == kFT0C) { - multiplicity = collision.centFT0C(); - } else if (cSelectMultEstimator == kFV0A) { - multiplicity = collision.centFV0A(); - } else { - multiplicity = collision.centFT0M(); // default - } - hInvMass.fill(HIST("h1RecMult"), multiplicity); + hInvMass.fill(HIST("h1RecMult2"), multiplicityRec); auto oldindex = -999; for (const auto& track1 : tracks) { @@ -1954,6 +1917,7 @@ struct Kstarqa { mother = daughter1 + daughter2; // Kstar meson hInvMass.fill(HIST("h2KstarRecpt2"), mothertrack1.pt(), multiplicity, std::sqrt(mothertrack1.e() * mothertrack1.e() - mothertrack1.p() * mothertrack1.p())); + hInvMass.fill(HIST("h2KstarRecptCalib2"), mothertrack1.pt(), multiplicityRec, std::sqrt(mothertrack1.e() * mothertrack1.e() - mothertrack1.p() * mothertrack1.p())); if (applyRecMotherRapidity && mother.Rapidity() >= selectionConfig.rapidityMotherData) { continue; @@ -1961,6 +1925,7 @@ struct Kstarqa { hInvMass.fill(HIST("h1KstarRecMass"), mother.M()); hInvMass.fill(HIST("h2KstarRecpt1"), mother.Pt(), multiplicity, mother.M()); + hInvMass.fill(HIST("h2KstarRecptCalib1"), mother.Pt(), multiplicityRec, mother.M()); } } } From c94441143a533be9bf4c15b9b65bd0b58868a873 Mon Sep 17 00:00:00 2001 From: mj525 <99000728+mjkim525@users.noreply.github.com> Date: Thu, 21 Aug 2025 16:21:13 +0900 Subject: [PATCH 127/986] [PWGLF] added initializerevetqa.cxx and updated xi1530Analysisqa.cxx (#12657) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Resonances/CMakeLists.txt | 5 + PWGLF/Tasks/Resonances/initializereventqa.cxx | 473 ++++++++++++++++++ PWGLF/Tasks/Resonances/xi1530Analysisqa.cxx | 181 +++++-- 3 files changed, 607 insertions(+), 52 deletions(-) create mode 100644 PWGLF/Tasks/Resonances/initializereventqa.cxx diff --git a/PWGLF/Tasks/Resonances/CMakeLists.txt b/PWGLF/Tasks/Resonances/CMakeLists.txt index de23fa67237..27aad7c24c3 100644 --- a/PWGLF/Tasks/Resonances/CMakeLists.txt +++ b/PWGLF/Tasks/Resonances/CMakeLists.txt @@ -174,6 +174,11 @@ o2physics_add_dpl_workflow(xi1530analysisqa PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(initializereventqa + SOURCES initializereventqa.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(kaonkaonanalysis SOURCES kaonkaonanalysis.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore diff --git a/PWGLF/Tasks/Resonances/initializereventqa.cxx b/PWGLF/Tasks/Resonances/initializereventqa.cxx new file mode 100644 index 00000000000..076163e6ef0 --- /dev/null +++ b/PWGLF/Tasks/Resonances/initializereventqa.cxx @@ -0,0 +1,473 @@ +// Copyright 2019-2025 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 initializereventqa.cxx +/// \brief QA for the event-loss and signal-loss correction at the generator level for the ResonanceInitializer in pp collisions (referred to TableProducer/Strangeness/cascqaanalysis.cxx) +/// +/// Following the discussions at the two PAG meetings (https://indico.cern.ch/event/1518979, https://indico.cern.ch/event/1575984) +/// we have introduced an auxiliary task that, when the resonanceInitializer.cxx is used, +/// computes the event-loss and signal-loss correction factors at the generator level. +/// With minor configuration tuning for a truth-tagging, +/// we expect it to be applicable to most analyses that rely on the initializer. +/// +/// \author Minjae Kim (minjae.kim@cern.ch) + +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/cascqaanalysis.h" +#include "PWGLF/DataModel/mcCentrality.h" +#include "PWGLF/Utils/inelGt.h" + +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "Framework/AnalysisTask.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/runDataProcessing.h" + +#include "TRandom2.h" +#include + +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +using TrkPidInfo = soa::Join; +using DauTracks = soa::Join; + +struct Initializereventqa { + + // Templates used, new hedder wil be added + Produces mycascades; + Produces myMCcascades; + + HistogramRegistry registry{"registry"}; + + // Axes + ConfigurableAxis ptAxis{"ptAxis", {400, 0.0f, 20.0f}, "#it{p}_{T} (GeV/#it{c})"}; + ConfigurableAxis rapidityAxis{"rapidityAxis", {200, -2.0f, 2.0f}, "y"}; + ConfigurableAxis centFT0MAxis{"centFT0MAxis", + {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 15.0, 20.0, 30.0, 40.0, 50.0, 70.0, 100.0, 110.0}, + "FT0M (%)"}; + ConfigurableAxis eventTypeAxis{"eventTypeAxis", {2, -0.5f, 1.5f}, "Event Type"}; + + ConfigurableAxis nAssocCollAxis{"nAssocCollAxis", {5, -0.5f, 4.5f}, "N_{assoc.}"}; + ConfigurableAxis nChargedFT0MGenAxis{"nChargedFT0MGenAxis", {300, 0, 300}, "N_{FT0M, gen.}"}; + ConfigurableAxis multNTracksAxis{"multNTracksAxis", {500, 0, 500}, "N_{tracks}"}; + ConfigurableAxis signalFT0MAxis{"signalFT0MAxis", {4000, 0, 40000}, "FT0M amplitude"}; + ConfigurableAxis signalFV0AAxis{"signalFV0AAxis", {4000, 0, 40000}, "FV0A amplitude"}; + ConfigurableAxis nCandidates{"nCandidates", {30, -0.5, 29.5}, "N_{cand.}"}; + + // Event selection criteria + Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; + Configurable isZvtxcut{"isZvtxcut", 1, "Select collisions with Accepted z-vertex"}; + Configurable isVertexITSTPC{"isVertexITSTPC", 0, "Select collisions with at least one ITS-TPC track"}; + Configurable isNoSameBunchPileup{"isNoSameBunchPileup", 0, "Same found-by-T0 bunch crossing rejection"}; + Configurable isGoodZvtxFT0vsPV{"isGoodZvtxFT0vsPV", 0, "z of PV by tracks and z of PV from FT0 A-C time difference cut"}; + Configurable isVertexTOFmatched{"isVertexTOFmatched", 0, "Is Vertex TOF matched"}; + + Configurable isTriggerTVX{"isTriggerTVX", 1, "TVX trigger"}; + Configurable isNoTimeFrameBorder{"isNoTimeFrameBorder", 1, "TF border cut"}; + Configurable isNoITSROFrameBorder{"isNoITSROFrameBorder", 1, "ITS ROF border cut"}; + Configurable isNoCollInTimeRangeNarrow{"isNoCollInTimeRangeNarrow", 0, "No collisions in +-2us window"}; + + // QA histograms for the multiplicity estimation + Configurable multQA{"multQA", 1, "0 - not to do QA, 1 - do the QA"}; + + // Selection for signal-loss corrections + Configurable isDaughterCheck{"isDaughterCheck", 1, "Check if the candidate has the correct daughters when it is considered"}; + + Configurable cfgRapidityCut{"cfgRapidityCut", 0.5, "Rapidity cut for the truth particle"}; + + Configurable pdgTruthMother{"pdgTruthMother", 3324, "pdgcode for the truth mother particle, e.g. Xi(1530) (3324)"}; + Configurable pdgTruthDaughter1{"pdgTruthDaughter1", 3312, "pdgcode for the first daughter particle, e.g. Xi-3312"}; + Configurable pdgTruthDaughter2{"pdgTruthDaughter2", 211, "pdgcode for the second daughter particle, e.g. Xi-3312"}; + + // Necessary for particle charges + Service pdgDB; + + SliceCache cache; + + // Struct to select on event type + typedef struct CollisionIndexAndType { + int64_t index; + uint8_t typeFlag; + } CollisionIndexAndType; + + void init(InitContext const&) + { + TString hNEventsMCLabels[5] = {"All", "z vrtx", "INEL", "INEL>0", "Associated with rec. collision"}; + TString hNEventsLabels[12] = {"All", "kIsTriggerTVX", "kNoTimeFrameBorder", "kNoITSROFrameBorder", "kIsVertexITSTPC", "kNoSameBunchPileup", "kIsGoodZvtxFT0vsPV", "isVertexTOFmatched", "kNoCollInTimeRangeNarrow", "z vrtx", "INEL", "INEL>0"}; + + registry.add("hNEvents", "hNEvents", {HistType::kTH1D, {{12, 0.f, 12.f}}}); + + for (int n = 1; n <= registry.get(HIST("hNEvents"))->GetNbinsX(); n++) { + registry.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(n, hNEventsLabels[n - 1]); + } + registry.add("hZCollision", "hZCollision", {HistType::kTH1D, {{200, -20.f, 20.f}}}); + + registry.add("fakeEvents", "fakeEvents", {HistType::kTH1F, {{1, -0.5f, 0.5f}}}); + + registry.add("hNEventsMC", "hNEventsMC", {HistType::kTH1D, {{5, 0.0f, 5.0f}}}); + for (int n = 1; n <= registry.get(HIST("hNEventsMC"))->GetNbinsX(); n++) { + registry.get(HIST("hNEventsMC"))->GetXaxis()->SetBinLabel(n, hNEventsMCLabels[n - 1]); + } + registry.add("hZCollisionGen", "hZCollisionGen", {HistType::kTH1D, {{200, -20.f, 20.f}}}); + registry.add("hCentFT0MNAssocMCCollisions", "hCentFT0MNAssocMCCollisions", {HistType::kTH3D, {centFT0MAxis, nAssocCollAxis, eventTypeAxis}}); + registry.add("hCentFT0MNAssocMCCollisionsSameType", "hCentFT0MNAssocMCCollisionsSameType", {HistType::kTH3D, {centFT0MAxis, nAssocCollAxis, eventTypeAxis}}); + registry.add("hNchFT0MNAssocMCCollisions", "hNchFT0MNAssocMCCollisions", {HistType::kTH3D, {nChargedFT0MGenAxis, nAssocCollAxis, eventTypeAxis}}); + registry.add("hNchFT0MNAssocMCCollisionsSameType", "hNchFT0MNAssocMCCollisionsSameType", {HistType::kTH3D, {nChargedFT0MGenAxis, nAssocCollAxis, eventTypeAxis}}); + registry.add("hNContributorsCorrelation", "hNContributorsCorrelation", {HistType::kTH2F, {{250, -0.5f, 249.5f, "Secondary Contributor"}, {250, -0.5f, 249.5f, "Main Contributor"}}}); + registry.add("hNchFT0MGenEvType", "hNchFT0MGenEvType", {HistType::kTH2D, {nChargedFT0MGenAxis, eventTypeAxis}}); + registry.add("hCentFT0M_genMC", "hCentFT0M_genMC", {HistType::kTH2D, {centFT0MAxis, eventTypeAxis}}); + + registry.add("hCentFT0M_rec", "hCentFT0M_rec", {HistType::kTH2D, {centFT0MAxis, eventTypeAxis}}); + registry.add("hCentFT0M_corr", "hCentFT0M_Corr", {HistType::kTH2D, {centFT0MAxis, centFT0MAxis}}); + + if (multQA) { + registry.add("hNchFT0Mglobal", "hNchFT0Mglobal", {HistType::kTH3D, {nChargedFT0MGenAxis, multNTracksAxis, eventTypeAxis}}); + registry.add("hNchFT0MPVContr", "hNchFT0MPVContr", {HistType::kTH3D, {nChargedFT0MGenAxis, multNTracksAxis, eventTypeAxis}}); + registry.add("hFT0MpvContr", "hFT0MpvContr", {HistType::kTH3D, {centFT0MAxis, multNTracksAxis, eventTypeAxis}}); + registry.add("hFT0Mglobal", "hFT0Mglobal", {HistType::kTH3D, {centFT0MAxis, multNTracksAxis, eventTypeAxis}}); + registry.add("hFT0MsignalPVContr", "hFT0MsignalPVContr", {HistType::kTH3D, {signalFT0MAxis, multNTracksAxis, eventTypeAxis}}); + } + + registry.add("h3ResonanceTruth", "pT distribution of True Resonance", kTHnSparseF, {eventTypeAxis, ptAxis, centFT0MAxis}); + registry.add("h3ResonanceTruthAnti", "pT distribution of True Resonance Anti", kTHnSparseF, {eventTypeAxis, ptAxis, centFT0MAxis}); + } + float pvEta1 = 1.0f; + float globalEta05 = 0.5f; + + Partition pvContribTracksIUEta1 = (nabs(aod::track::eta) < pvEta1) && ((aod::track::flags & static_cast(o2::aod::track::PVContributor)) == static_cast(o2::aod::track::PVContributor)); + Partition globalTracksIUEta05 = (nabs(aod::track::eta) < globalEta05) && (requireGlobalTrackInFilter()); + + template + uint16_t getGenNchInFT0Mregion(TMcParticles particles) + { + float region1FT0 = -3.3f; + float region2FT0 = -2.1f; + float region3FT0 = 3.5f; + float region4FT0 = 4.9f; + // Particle counting in FITFT0: -3.3<η<-2.1; 3.5<η<4.9 + uint16_t nchFT0 = 0; + for (const auto& mcParticle : particles) { + if (!mcParticle.isPhysicalPrimary()) { + continue; + } + const auto& pdgInfo = pdgDB->GetParticle(mcParticle.pdgCode()); + if (!pdgInfo) { + continue; + } + if (pdgInfo->Charge() == 0) { + continue; + } + if (mcParticle.eta() < region1FT0 || mcParticle.eta() > region4FT0 || (mcParticle.eta() > region2FT0 && mcParticle.eta() < region3FT0)) { + continue; // select on T0M Nch region + } + nchFT0++; // increment + } + return nchFT0; + } + + template + bool acceptEvent(TCollision const& collision, bool isFillEventSelectionQA) + { + if (isFillEventSelectionQA) { + registry.fill(HIST("hNEvents"), 0.5); + } + + // kIsTriggerTVX selection + if (isTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { + return false; + } + + if (isFillEventSelectionQA) { + registry.fill(HIST("hNEvents"), 1.5); + } + + // kNoTimeFrameBorder selection + if (isNoTimeFrameBorder && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + return false; + } + + if (isFillEventSelectionQA) { + registry.fill(HIST("hNEvents"), 2.5); + } + + // kNoITSROFrameBorder selection + if (isNoITSROFrameBorder && !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + return false; + } + + if (isFillEventSelectionQA) { + registry.fill(HIST("hNEvents"), 3.5); + } + + // kIsVertexITSTPC selection + if (isVertexITSTPC && !collision.selection_bit(aod::evsel::kIsVertexITSTPC)) { + return false; + } + if (isFillEventSelectionQA) { + registry.fill(HIST("hNEvents"), 4.5); + } + // kNoSameBunchPileup selection + if (isNoSameBunchPileup && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { + return false; + } + if (isFillEventSelectionQA) { + registry.fill(HIST("hNEvents"), 5.5); + } + // kIsGoodZvtxFT0vsPV selection + if (isGoodZvtxFT0vsPV && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + return false; + } + if (isFillEventSelectionQA) { + registry.fill(HIST("hNEvents"), 6.5); + } + // isVertexTOFmatched selection + if (isVertexTOFmatched && !collision.selection_bit(aod::evsel::kIsVertexTOFmatched)) { + return false; + } + if (isFillEventSelectionQA) { + registry.fill(HIST("hNEvents"), 7.5); + } + // kNoCollInTimeRangeNarrow selection + if (isNoCollInTimeRangeNarrow && !collision.selection_bit(aod::evsel::kNoCollInTimeRangeNarrow)) { + return false; + } + if (isFillEventSelectionQA) { + registry.fill(HIST("hNEvents"), 8.5); + } + + // Z vertex selection + if (isZvtxcut && std::fabs(collision.posZ()) > cutzvertex) { + return false; + } + if (isFillEventSelectionQA) { + registry.fill(HIST("hNEvents"), 9.5); + registry.fill(HIST("hZCollision"), collision.posZ()); + } + + return true; + } + + template + void fillMCParticles(TotalMCParts const& mcParticles, MultMCGen const& multiplicity, evtType const& eventType) + { + for (auto const& mcPart : mcParticles) { + + if (std::abs(mcPart.pdgCode()) != pdgTruthMother || std::abs(mcPart.y()) >= cfgRapidityCut) + continue; + std::vector daughterPDGs; + if (mcPart.has_daughters()) { + auto daughter01 = mcParticles.rawIteratorAt(mcPart.daughtersIds()[0] - mcParticles.offset()); + auto daughter02 = mcParticles.rawIteratorAt(mcPart.daughtersIds()[1] - mcParticles.offset()); + daughterPDGs = {daughter01.pdgCode(), daughter02.pdgCode()}; + } else { + daughterPDGs = {-1, -1}; + } + + if (isDaughterCheck) { + bool pass1 = std::abs(daughterPDGs[0]) == pdgTruthDaughter1 || std::abs(daughterPDGs[1]) == pdgTruthDaughter1; + bool pass2 = std::abs(daughterPDGs[0]) == pdgTruthDaughter2 || std::abs(daughterPDGs[1]) == pdgTruthDaughter2; + if (!pass1 || !pass2) + continue; + } + if (mcPart.pdgCode() > 0) // Consider INELt0 or INEL + registry.fill(HIST("h3ResonanceTruth"), eventType, mcPart.pt(), multiplicity); + else + registry.fill(HIST("h3ResonanceTruthAnti"), eventType, mcPart.pt(), multiplicity); + + daughterPDGs.clear(); + } + } + void processData(soa::Join::iterator const& collision, + DauTracks const&) + { + if (!acceptEvent(collision, 1)) { + return; + } + + int evType = 0; + registry.fill(HIST("hNEvents"), 10.5); // INEL + if (collision.isInelGt0()) { + evType += 1; + registry.fill(HIST("hNEvents"), 11.5); // INEL>0 + } + + auto tracksGroupedPVcontr = pvContribTracksIUEta1->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + int nTracksPVcontr = tracksGroupedPVcontr.size(); + + auto tracksGroupedGlobal = globalTracksIUEta05->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + int nTracksGlobal = tracksGroupedGlobal.size(); + + registry.fill(HIST("hCentFT0M_rec"), collision.centFT0M(), evType); + + if (multQA) { + registry.fill(HIST("hFT0MpvContr"), collision.centFT0M(), nTracksPVcontr, evType); + registry.fill(HIST("hFT0Mglobal"), collision.centFT0M(), nTracksGlobal, evType); + registry.fill(HIST("hFT0MsignalPVContr"), collision.multFT0A() + collision.multFT0C(), nTracksPVcontr, evType); + } + } + + Preslice perMcCollision = aod::mcparticle::mcCollisionId; + void processMCrec(soa::Join::iterator const& collision, + soa::Join const&, + DauTracks const&, + aod::McParticles const& mcParticles) + { + if (!acceptEvent(collision, 1)) { + return; + } + + if (!collision.has_mcCollision()) { + registry.fill(HIST("fakeEvents"), 0); // no assoc. MC collisions + return; + } + + const auto& mcCollision = collision.mcCollision_as>(); + + auto tracksGroupedPVcontr = pvContribTracksIUEta1->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + int nTracksPVcontr = tracksGroupedPVcontr.size(); + + auto tracksGroupedGlobal = globalTracksIUEta05->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + int nTracksGlobal = tracksGroupedGlobal.size(); + + // N charged in FT0M region in corresponding gen. MC collision + auto mcPartSlice = mcParticles.sliceBy(perMcCollision, collision.mcCollision_as>().globalIndex()); + uint16_t nchFT0 = getGenNchInFT0Mregion(mcPartSlice); + + int evType = 0; + registry.fill(HIST("hNEvents"), 10.5); // reco INEL + if (collision.isInelGt0()) { + evType += 1; + registry.fill(HIST("hNEvents"), 11.5); // reco INEL>0 + } + + registry.fill(HIST("hCentFT0M_rec"), mcCollision.centFT0M(), evType); // correction only reco level in this stage + registry.fill(HIST("hCentFT0M_corr"), mcCollision.centFT0M(), mcCollision.centFT0M(), evType); + + if (multQA) { + registry.fill(HIST("hNchFT0MPVContr"), nchFT0, nTracksPVcontr, evType); + registry.fill(HIST("hFT0MpvContr"), mcCollision.centFT0M(), nTracksPVcontr, evType); + registry.fill(HIST("hFT0Mglobal"), mcCollision.centFT0M(), nTracksGlobal, evType); + registry.fill(HIST("hNchFT0Mglobal"), nchFT0, nTracksGlobal, evType); + registry.fill(HIST("hFT0MsignalPVContr"), collision.multFT0A() + collision.multFT0C(), nTracksPVcontr, evType); + } + } + + void processMCgen(soa::Join::iterator const& mcCollision, + aod::McParticles const& mcParticles, + const soa::SmallGroups>& collisions) + { + auto cent = mcCollision.centFT0M(); + + registry.fill(HIST("hNEventsMC"), 0.5); + + if (isZvtxcut && std::fabs(mcCollision.posZ()) > cutzvertex) { + return; + } + registry.fill(HIST("hZCollisionGen"), mcCollision.posZ()); + registry.fill(HIST("hNEventsMC"), 1.5); + + int evType = 0; + registry.fill(HIST("hNEventsMC"), 2.5); + if (pwglf::isINELgtNmc(mcParticles, 0, pdgDB)) { // Truth INEL>0 + evType++; + registry.fill(HIST("hNEventsMC"), 3.5); + } + + fillMCParticles(mcParticles, cent, evType); + + registry.fill(HIST("hCentFT0M_genMC"), cent, evType); + + uint16_t nchFT0 = getGenNchInFT0Mregion(mcParticles); + registry.fill(HIST("hNchFT0MGenEvType"), nchFT0, evType); + + std::vector selectedEvents(collisions.size()); + std::vector numberOfContributors; + int nevts = 0; + int nAssocColl = 0; + const int nContSize = 2; + for (const auto& collision : collisions) { + CollisionIndexAndType collWithType = {0, 0x0}; + if (!acceptEvent(collision, 0)) { + continue; + } + collWithType.index = collision.mcCollision_as>().globalIndex(); + collWithType.typeFlag |= o2::aod::myMCcascades::EvFlags::EvINEL; + + if (collision.isInelGt0()) { // reco INEL>0 + collWithType.typeFlag |= o2::aod::myMCcascades::EvFlags::EvINELgt0; + } + selectedEvents[nevts++] = collWithType; + if (collision.mcCollision_as>().globalIndex() == mcCollision.globalIndex()) { + nAssocColl++; + numberOfContributors.push_back(collision.numContrib()); + } + } + selectedEvents.resize(nevts); + + registry.fill(HIST("hCentFT0MNAssocMCCollisions"), cent, nAssocColl, evType); + registry.fill(HIST("hNchFT0MNAssocMCCollisions"), nchFT0, nAssocColl, evType); + + if (numberOfContributors.size() == nContSize) { + std::sort(numberOfContributors.begin(), numberOfContributors.end()); + registry.fill(HIST("hNContributorsCorrelation"), numberOfContributors[0], numberOfContributors[1]); + } + + auto isAssocToINEL = [&mcCollision](CollisionIndexAndType i) { return (i.index == mcCollision.globalIndex()) && ((i.typeFlag & o2::aod::myMCcascades::EvFlags::EvINEL) == o2::aod::myMCcascades::EvFlags::EvINEL); }; + auto isAssocToINELgt0 = [&mcCollision](CollisionIndexAndType i) { return (i.index == mcCollision.globalIndex()) && ((i.typeFlag & o2::aod::myMCcascades::EvFlags::EvINELgt0) == o2::aod::myMCcascades::EvFlags::EvINELgt0); }; + // number of reconstructed INEL events that have the same global index as mcCollision + const auto evtReconstructedAndINEL = std::count_if(selectedEvents.begin(), selectedEvents.end(), isAssocToINEL); + // number of reconstructed INEL > 0 events that have the same global index as mcCollision + const auto evtReconstructedAndINELgt0 = std::count_if(selectedEvents.begin(), selectedEvents.end(), isAssocToINELgt0); + switch (evType) { + case 0: { + registry.fill(HIST("hCentFT0MNAssocMCCollisionsSameType"), cent, evtReconstructedAndINEL, evType); + registry.fill(HIST("hNchFT0MNAssocMCCollisionsSameType"), nchFT0, evtReconstructedAndINEL, evType); + break; + } + case 1: { + registry.fill(HIST("hCentFT0MNAssocMCCollisionsSameType"), cent, evtReconstructedAndINELgt0, evType); + registry.fill(HIST("hNchFT0MNAssocMCCollisionsSameType"), nchFT0, evtReconstructedAndINELgt0, evType); + break; + } + default: + LOGF(fatal, "incorrect evType in event task"); + break; + } + + if (evtReconstructedAndINELgt0) { // N INEL>0 reconstructed events associated with the MC collision + registry.fill(HIST("hNEventsMC"), 4.5); + } + } + PROCESS_SWITCH(Initializereventqa, processData, "Process Run 3 data", false); + PROCESS_SWITCH(Initializereventqa, processMCrec, "Process Run 3 mc, Reconstructed", true); + PROCESS_SWITCH(Initializereventqa, processMCgen, "Process Run 3 mc, genereated", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc), + }; +} diff --git a/PWGLF/Tasks/Resonances/xi1530Analysisqa.cxx b/PWGLF/Tasks/Resonances/xi1530Analysisqa.cxx index 42773fa2947..07ed10a9460 100644 --- a/PWGLF/Tasks/Resonances/xi1530Analysisqa.cxx +++ b/PWGLF/Tasks/Resonances/xi1530Analysisqa.cxx @@ -14,21 +14,25 @@ /// /// \author Min-jae Kim , Bong-Hwi Lim // #include -#include "Math/Vector4D.h" -#include "TF1.h" -#include "TRandom3.h" +#include "PWGLF/DataModel/LFResonanceTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/mcCentrality.h" +#include "PWGLF/Utils/inelGt.h" -#include "Common/DataModel/PIDResponse.h" +#include "Common/Core/RecoDecay.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" -#include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/runDataProcessing.h" -#include "PWGLF/DataModel/LFResonanceTables.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "Common/DataModel/PIDResponse.h" + #include "CommonConstants/PhysicsConstants.h" -#include "Common/Core/RecoDecay.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" #include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/runDataProcessing.h" + +#include "Math/Vector4D.h" +#include "TF1.h" +#include "TRandom3.h" using namespace o2; using namespace o2::framework; @@ -36,7 +40,7 @@ using namespace o2::framework::expressions; using namespace o2::soa; using namespace o2::constants::physics; using LorentzVectorPtEtaPhiMass = ROOT::Math::PtEtaPhiMVector; -// Service pdgDB; +Service pdgDB; enum { kData = 0, @@ -57,6 +61,10 @@ struct Xi1530Analysisqa { SliceCache cache; Preslice perRCol = aod::resodaughter::resoCollisionId; Preslice perCollision = aod::track::collisionId; + Preslice perResoCollision = + aod::resodaughter::resoCollisionId; + Preslice perResoCollisionCasc = + aod::resodaughter::resoCollisionId; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; using ResoMCCols = soa::Join; @@ -65,7 +73,7 @@ struct Xi1530Analysisqa { // Associated with histograms ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5.0, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 6.0, 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9, 9.0, 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7, 9.8, 9.9, 10.0, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 11.0, 11.1, 11.2, 11.3, 11.4, 11.5, 11.6, 11.7, 11.8, 11.9, 12.0, 12.1, 12.2, 12.3, 12.4, 12.5, 12.6, 12.7, 12.8, 12.9, 13.0, 13.1, 13.2, 13.3, 13.4, 13.5, 13.6, 13.7, 13.8, 13.9, 14.0, 14.1, 14.2, 14.3, 14.4, 14.5, 14.6, 14.7, 14.8, 14.9, 15.0}, "Binning of the pT axis"}; ConfigurableAxis binsPtQA{"binsPtQA", {VARIABLE_WIDTH, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8, 5.0, 5.2, 5.4, 5.6, 5.8, 6.0, 6.2, 6.4, 6.6, 6.8, 7.0, 7.2, 7.4, 7.6, 7.8, 8.0, 8.2, 8.4, 8.6, 8.8, 9.0, 9.2, 9.4, 9.6, 9.8, 10.0}, "Binning of the pT axis"}; - ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"}; + ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 15.0, 20.0, 30.0, 40.0, 50.0, 70.0, 100.0, 110.0}, "Binning of the centrality axis"}; Configurable cInvMassStart{"cInvMassStart", 1.4, "Invariant mass start"}; Configurable cInvMassEnd{"cInvMassEnd", 3.0, "Invariant mass end"}; @@ -98,8 +106,8 @@ struct Xi1530Analysisqa { Configurable cfgTPCRows{"cfgTPCRows", 80, "Minimum Number of TPC Crossed Rows "}; Configurable cfgRatioTPCRowsOverFindableCls{"cfgRatioTPCRowsOverFindableCls", 0.8, "Minimum of TPC Crossed Rows to Findable Clusters"}; // Minmimum - Configurable cfgUseTPCRefit{"cfgUseTPCRefit", true, "Require TPC Refit"}; - Configurable cfgUseITSRefit{"cfgUseITSRefit", true, "Require ITS Refit"}; + // Configurable cfgUseTPCRefit{"cfgUseTPCRefit", true, "Require TPC Refit"}; //refit is included in global track selection + // Configurable cfgUseITSRefit{"cfgUseITSRefit", true, "Require ITS Refit"}; Configurable cfgHasTOF{"cfgHasTOF", false, "Require TOF"}; @@ -200,7 +208,6 @@ struct Xi1530Analysisqa { // MC Event selection // Configurable cZvertCutMC{"cZvertCutMC", 10.0, "MC Z-vertex cut"}; - Configurable cIsPhysicalPrimaryMC{"cIsPhysicalPrimaryMC", true, "Physical primary selection for a MC Parent"}; //*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*// @@ -209,8 +216,10 @@ struct Xi1530Analysisqa { Configurable cMaxPtMotherCut{"cMaxPtMotherCut", 9.0, "Maximum pt of mother cut"}; Configurable cMaxMinvMotherCut{"cMaxMinvMotherCut", 3.0, "Maximum Minv of mother cut"}; - Configurable cMicroTrack{"cMicroTrack", false, "Using Micro track for first pion"}; - Configurable studyStableXi{"studyStableXi", true, "Study stable Xi"}; + Configurable studyStableXi{"studyStableXi", false, "Study stable Xi"}; + + Configurable cMCCent{"cMCCent", true, "Using calibrated MC centrality (for FT0M)"}; + Configurable cRecoINELgt0{"cRecoINELgt0", true, "check if INEL>0 for reco events"}; TRandom* rn = new TRandom(); //*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*// @@ -251,11 +260,11 @@ struct Xi1530Analysisqa { // event histograms histos.add("QAevent/hEvtCounterSameE", "Number of analyzed Same Events", HistType::kTH1F, {{1, 0.5, 1.5}}); histos.add("QAevent/hVertexZSameE", "Collision Vertex Z position", HistType::kTH1F, {{100, -15., 15.}}); - histos.add("QAevent/hMultiplicityPercentSameE", "Multiplicity percentile of collision", HistType::kTH1F, {{120, 0.0f, 120.0f}}); + histos.add("QAevent/hMultiplicityPercentSameE", "Multiplicity percentile of collision", HistType::kTH1F, {centAxis}); histos.add("QAevent/hEvtCounterMixedE", "Number of analyzed Mixed Events", HistType::kTH1F, {{1, 0.5, 1.5}}); histos.add("QAevent/hVertexZMixedE", "Collision Vertex Z position", HistType::kTH1F, {{100, -15., 15.}}); - histos.add("QAevent/hMultiplicityPercentMixedE", "Multiplicity percentile of collision", HistType::kTH1F, {{120, 0.0f, 120.0f}}); + histos.add("QAevent/hMultiplicityPercentMixedE", "Multiplicity percentile of collision", HistType::kTH1F, {centAxis}); } if (invMass1D) { @@ -456,10 +465,10 @@ struct Xi1530Analysisqa { } if (cfgHasTOF && !track.hasTOF()) return false; - if (cfgUseITSRefit && !track.passedITSRefit()) - return false; - if (cfgUseTPCRefit && !track.passedTPCRefit()) - return false; + // if (cfgUseITSRefit && !track.passedITSRefit()) + // return false; + // if (cfgUseTPCRefit && !track.passedTPCRefit()) + // return false; if (cfgPVContributor && !track.isPVContributor()) return false; if (cfgPrimaryTrack && !track.isPrimaryTrack()) @@ -467,7 +476,7 @@ struct Xi1530Analysisqa { return true; } - bool hasSubsystemInfo(float Nsigma) // this will be replaced // .hasXX() was not appied in resocascade yet + bool hasSubsystemInfo(float Nsigma) { return std::abs(Nsigma) < cPIDBound; } @@ -492,7 +501,7 @@ struct Xi1530Analysisqa { return true; } - // Secondary track selection for cascades // need to more information, + // Secondary track selection for cascades // // Topological cuts for cascades template @@ -663,20 +672,20 @@ struct Xi1530Analysisqa { return lConsistentWithXi && lConsistentWithLambda; } - template - void fillHistograms(const CollisionType& collision, const TracksType& dTracks1, const TracksTypeCasc& dTracks2) // Order: ResoColl, ResoTrack, ResoCascTrack + template + void fillHistograms(const CollisionType& collision, const CenMult& multiplicity, const TracksType& dTracks1, const TracksTypeCasc& dTracks2) // Order: ResoColl, ResoTrack, ResoCascTrack { - auto multiplicity = collision.cent(); + // auto multiplicity = collision.cent(); { if constexpr (!IsMix) { histos.fill(HIST("QAevent/hVertexZSameE"), collision.posZ()); - histos.fill(HIST("QAevent/hMultiplicityPercentSameE"), collision.cent()); + histos.fill(HIST("QAevent/hMultiplicityPercentSameE"), multiplicity); histos.fill(HIST("TestME/hCollisionIndexSameE"), collision.globalIndex()); histos.fill(HIST("TestME/hnTrksSameE"), dTracks1.size()); } else { histos.fill(HIST("QAevent/hVertexZMixedE"), collision.posZ()); - histos.fill(HIST("QAevent/hMultiplicityPercentMixedE"), collision.cent()); + histos.fill(HIST("QAevent/hMultiplicityPercentMixedE"), multiplicity); histos.fill(HIST("TestME/hCollisionIndexMixedE"), collision.globalIndex()); histos.fill(HIST("TestME/hnTrksMixedE"), dTracks1.size()); } @@ -742,7 +751,7 @@ struct Xi1530Analysisqa { float trk2NSigmaPiNegTOF = trk2.daughterTOFNSigmaNegPi(); if constexpr (!IsMix) { - //// QA plots before the selection // need to pt for cascade tracks + //// QA plots before the selection // // --- PID QA if (pidPlots) { histos.fill(HIST("QAbefore/TPC_Nsigma_pi_first_all"), multiplicity, trk1ptPi, trk1NSigmaPiTPC); @@ -750,7 +759,6 @@ struct Xi1530Analysisqa { histos.fill(HIST("QAbefore/TOF_Nsigma_pi_first_all"), multiplicity, trk1ptPi, trk1NSigmaPiTOF); histos.fill(HIST("QAbefore/TOF_TPC_Map_pi_first_all"), trk1NSigmaPiTOF, trk1NSigmaPiTPC); } - // hasSubsystemInfo is Temporary, it will be replaced. histos.fill(HIST("QAbefore/TPC_Nsigma_pi_bachelor_all"), multiplicity, 0, trk2NSigmaPiBachelorTPC); // can't take pt information for the cascade secondary if (hasSubsystemInfo(trk2NSigmaPiBachelorTOF)) { @@ -819,10 +827,6 @@ struct Xi1530Analysisqa { if (!casctopCut(trk2)) continue; - // TPCncluster distributions - // histos.fill(HIST("TPCncluster/TPCnclusterpifirst"), trk1.tpcNClsFound()); - // histos.fill(HIST("TPCncluster/TPCnclusterPhipifirst"), trk1.tpcNClsFound(), trk1.phi()); - if constexpr (!IsMix) { //// QA plots after the selection // --- PID QA @@ -1048,25 +1052,74 @@ struct Xi1530Analysisqa { } } - void processData(aod::ResoCollision const& resoCollision, aod::ResoTracks const& resoTracks, aod::ResoCascades const& cascTracks) + void processData(aod::ResoCollision const& resoCollision, + aod::ResoCollisionColls const& collisionIndex, + soa::Join const& collisions, + aod::ResoTracks const& resoTracks, + aod::ResoCascades const& cascTracks) { + auto linkRow = collisionIndex.iteratorAt(resoCollision.globalIndex()); + auto collId = linkRow.collisionId(); // Take original collision global index matched with resoCollision + + auto coll = collisions.iteratorAt(collId); // Take original collision matched with resoCollision + + if (cRecoINELgt0 && !coll.isInelGt0()) // Check reco INELgt0 (at least one PV track in |eta| < 1) about the collision + return; histos.fill(HIST("QAevent/hEvtCounterSameE"), 1.0); - fillHistograms(resoCollision, resoTracks, cascTracks); + auto multiplicity = resoCollision.cent(); + fillHistograms(resoCollision, multiplicity, resoTracks, cascTracks); } + // Reconstructed level MC for the track void processMC(ResoMCCols::iterator const& resoCollision, + aod::ResoCollisionColls const& resoCollisionIndex, + soa::Join const& collisionsMC, soa::Join const& cascTracks, - soa::Join const& resoTracks) + soa::Join const& resoTracks, + soa::Join const&) { if (!resoCollision.isInAfterAllCuts() || (std::abs(resoCollision.posZ()) > cZvertCutMC)) // MC event selection, all cuts missing vtx cut return; - fillHistograms(resoCollision, resoTracks, cascTracks); + + auto linkRow = resoCollisionIndex.iteratorAt(resoCollision.globalIndex()); + const int collId = linkRow.collisionId(); + + auto coll = collisionsMC.iteratorAt(collId); + + if (cRecoINELgt0 && !coll.isInelGt0()) + return; + + auto mcColl = coll.mcCollision_as>(); + + auto multiplicityReco = resoCollision.cent(); // Reco level multiplicity per. + auto multiplicityGen = mcColl.centFT0M(); // Gen level multiplicity per. + + float multiplicity = cMCCent ? multiplicityGen : multiplicityReco; + + fillHistograms(resoCollision, multiplicity, resoTracks, cascTracks); } - void processMCTrue(ResoMCCols::iterator const& resoCollision, aod::ResoMCParents const& resoParents) + // Truth level MC for the track with reco event + void processMCTrue(ResoMCCols::iterator const& resoCollision, + aod::ResoCollisionColls const& resoCollisionIndex, + aod::ResoMCParents const& resoParents, + aod::ResoCollisionCandidatesMC const& collisionsMC, + soa::Join const&) { - auto multiplicity = resoCollision.cent(); + + auto linkRow = resoCollisionIndex.iteratorAt(resoCollision.globalIndex()); + const int collId = linkRow.collisionId(); + + auto coll = collisionsMC.iteratorAt(collId); + + auto mcColl = coll.mcCollision_as>(); + + auto multiplicityReco = resoCollision.cent(); // Reco level multiplicity per. + auto multiplicityGen = mcColl.centFT0M(); // Gen level multiplicity per. + + float multiplicity = cMCCent ? multiplicityGen : multiplicityReco; + for (const auto& part : resoParents) { // loop over all pre-filtered MC particles if (std::abs(part.pdgCode()) != kXiStar || std::abs(part.y()) >= cfgRapidityCut) continue; @@ -1076,9 +1129,6 @@ struct Xi1530Analysisqa { if (!pass1 || !pass2) continue; - if (cIsPhysicalPrimaryMC && !part.isPhysicalPrimary()) - continue; - if (part.pdgCode() > 0) // INELt0 or INEL histos.fill(HIST("h3Xi1530Gen"), -1, part.pt(), multiplicity); else @@ -1115,11 +1165,23 @@ struct Xi1530Analysisqa { } } - void processDataMicro(aod::ResoCollision const& resoCollision, aod::ResoMicroTracks const& resomicrotracks, aod::ResoCascades const& cascTracks) + void processDataMicro(aod::ResoCollision const& resoCollision, + aod::ResoCollisionColls const& collisionIndex, + soa::Join const& collisions, + aod::ResoMicroTracks const& resomicrotracks, + aod::ResoCascades const& cascTracks) { + auto linkRow = collisionIndex.iteratorAt(resoCollision.globalIndex()); + auto collId = linkRow.collisionId(); // Take original collision global index matched with resoCollision + + auto coll = collisions.iteratorAt(collId); // Take original collision matched with resoCollision + + if (cRecoINELgt0 && !coll.isInelGt0()) // Check reco INELgt0 (at least one PV track in |eta| < 1) about the collision + return; histos.fill(HIST("QAevent/hEvtCounterSameE"), 1.0); - fillHistograms(resoCollision, resomicrotracks, cascTracks); + auto multiplicity = resoCollision.cent(); + fillHistograms(resoCollision, multiplicity, resomicrotracks, cascTracks); } using BinningTypeVtxZT0M = ColumnBinningPolicy; @@ -1137,16 +1199,21 @@ struct Xi1530Analysisqa { for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { histos.fill(HIST("QAevent/hEvtCounterMixedE"), 1.0); - fillHistograms(collision1, tracks1, tracks2); + auto multiplicity = collision1.cent(); + fillHistograms(collision1, multiplicity, tracks1, tracks2); } } void processDataDF(aod::ResoCollisionDF const& resoCollision, aod::ResoTrackDFs const& resotracks, aod::ResoCascadeDFs const& cascTracks) { - - fillHistograms(resoCollision, resotracks, cascTracks); + auto multiplicity = resoCollision.cent(); + fillHistograms(resoCollision, multiplicity, resotracks, cascTracks); } - void processMEMicro(aod::ResoCollisions const& resoCollisions, aod::ResoMicroTracks const& resomicrotracks, aod::ResoCascades const& cascTracks) + void processMEMicro(aod::ResoCollisions const& resoCollisions, + aod::ResoCollisionColls const& collisionIndex, + soa::Join const& collisions, + aod::ResoMicroTracks const& resomicrotracks, + aod::ResoCascades const& cascTracks) { auto tracksTuple = std::make_tuple(resomicrotracks, cascTracks); @@ -1155,8 +1222,18 @@ struct Xi1530Analysisqa { for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { + const auto rcIdx = collision1.globalIndex(); + + const auto linkRow = collisionIndex.iteratorAt(rcIdx); + const auto collId = linkRow.collisionId(); + + auto coll = collisions.iteratorAt(collId); + if (cRecoINELgt0 && !coll.isInelGt0()) // Check reco INELgt0 (at least one PV track in |eta| < 1) about the collision + continue; + histos.fill(HIST("QAevent/hEvtCounterMixedE"), 1.0); - fillHistograms(collision1, tracks1, tracks2); + auto multiplicity = collision1.cent(); + fillHistograms(collision1, multiplicity, tracks1, tracks2); } } From da09a1a52713c4b7a06fa42eed01237ce59ee4a6 Mon Sep 17 00:00:00 2001 From: Marvin Hemmer <53471402+mhemmer-cern@users.noreply.github.com> Date: Thu, 21 Aug 2025 10:24:21 +0200 Subject: [PATCH 128/986] [PWGEM,PWGEM-36] taskPi0FlowEMC: Add additional EMCal calib (#12661) --- PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx | 103 ++++++++++++--------- 1 file changed, 60 insertions(+), 43 deletions(-) diff --git a/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx b/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx index 62974a0c885..aa837b02233 100644 --- a/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx @@ -50,12 +50,14 @@ #include #include #include // IWYU pragma: keep +#include #include #include #include #include #include +#include #include #include #include @@ -100,6 +102,8 @@ enum Harmonics { }; struct TaskPi0FlowEMC { + static constexpr float MinEnergy = 0.7f; + // configurable for flow Configurable harmonic{"harmonic", 2, "harmonic number"}; Configurable qvecDetector{"qvecDetector", 0, "Detector for Q vector estimation (FT0M: 0, FT0A: 1, FT0C: 2, TPC Pos: 3, TPC Neg: 4, TPC Tot: 5)"}; @@ -129,6 +133,7 @@ struct TaskPi0FlowEMC { ConfigurableAxis thnConfigAxisCosDeltaPhi{"thnConfigAxisCosDeltaPhi", {8, -1., 1.}, ""}; ConfigurableAxis thnConfigAxisScalarProd{"thnConfigAxisScalarProd", {100, -5., 5.}, ""}; ConfigurableAxis thnConfigAxisM02{"thnConfigAxisM02", {200, 0., 5.}, ""}; + ConfigurableAxis thnConfigAxisEnergyCalib{"thnConfigAxisEnergyCalib", {200, 0., 20.}, ""}; EMPhotonEventCut fEMEventCut; struct : ConfigurableGroup { @@ -195,6 +200,7 @@ struct TaskPi0FlowEMC { Configurable cfgSpresoPath{"cfgSpresoPath", "Users/m/mhemmer/EM/Flow/Resolution", "Path to SP resolution file"}; Configurable cfgApplySPresolution{"cfgApplySPresolution", 0, "Apply resolution correction"}; Configurable doEMCalCalib{"doEMCalCalib", 0, "Produce output for EMCal calibration"}; + Configurable cfgEnableNonLin{"cfgEnableNonLin", false, "flag to turn extra non linear energy calibration on/off"}; } correctionConfig; SliceCache cache; @@ -209,6 +215,7 @@ struct TaskPi0FlowEMC { using EMCalPhotons = soa::Join; using FilteredCollsWithQvecs = soa::Filtered>; using CollsWithQvecs = soa::Join; + using Colls = soa::Join; Preslice perCollisionEMC = aod::emccluster::emeventId; @@ -230,6 +237,9 @@ struct TaskPi0FlowEMC { // static constexpr static constexpr int64_t NMinPhotonRotBkg = 3; + // Usage when cfgEnableNonLin is enabled + std::unique_ptr fEMCalCorrectionFactor; // ("fEMCalCorrectionFactor","(1 + [0]/x + [1]/x^2) / (1 + [2]/x)", 0.3, 100.); + // To access the 1D array inline int getIndex(int iEta, int iPhi) { @@ -308,10 +318,10 @@ struct TaskPi0FlowEMC { const AxisSpec thnAxisM02{thnConfigAxisM02, "M_{02}"}; const AxisSpec thAxisTanThetaPhi{mesonConfig.thConfigAxisTanThetaPhi, "atan(#Delta#theta/#Delta#varphi)"}; const AxisSpec thAxisClusterEnergy{thnConfigAxisPt, "#it{E} (GeV)"}; + const AxisSpec thAxisEnergyCalib{thnConfigAxisEnergyCalib, "#it{E}_{clus} (GeV)"}; const AxisSpec thAxisAlpha{100, -1., +1, "#alpha"}; const AxisSpec thAxisMult{1000, 0., +1000, "#it{N}_{ch}"}; const AxisSpec thAxisEnergy{1000, 0., 100., "#it{E}_{clus} (GeV)"}; - const AxisSpec thAxisEnergyCalib{400, 0., 20., "#it{E}_{clus} (GeV)"}; const AxisSpec thAxisTime{1500, -600, 900, "#it{t}_{cl} (ns)"}; const AxisSpec thAxisEta{320, -0.8, 0.8, "#eta"}; const AxisSpec thAxisPhi{500, 0, 2 * 3.14159, "phi"}; @@ -439,6 +449,9 @@ struct TaskPi0FlowEMC { LOG(info) << "thnConfigAxisInvMass.value[1] = " << thnConfigAxisInvMass.value[1] << " thnConfigAxisInvMass.value.back() = " << thnConfigAxisInvMass.value.back(); LOG(info) << "thnConfigAxisPt.value[1] = " << thnConfigAxisPt.value[1] << " thnConfigAxisPt.value.back() = " << thnConfigAxisPt.value.back(); + + fEMCalCorrectionFactor = std::make_unique("fEMCalCorrectionFactor", "(1 + [0]/x + [1]/x^2) / (1 + [2]/x)", 0.3, 100.); + fEMCalCorrectionFactor->SetParameters(-5.33426e-01, 1.40144e-02, -5.24434e-01); }; // end init /// Change radians to degree @@ -475,7 +488,8 @@ struct TaskPi0FlowEMC { /// Get the centrality /// \param collision is the collision with the centrality information - float getCentrality(CollsWithQvecs::iterator const& collision) + template + float getCentrality(TCollision const& collision) { float cent = -999.; switch (centEstimator) { @@ -728,7 +742,11 @@ struct TaskPi0FlowEMC { if (checkEtaPhi1D(photon.eta(), RecoDecay::constrainAngle(photon.phi())) >= cfgEMCalMapLevelBackground.value) { continue; } - ROOT::Math::PtEtaPhiMVector photon3(photon.pt(), photon.eta(), photon.phi(), 0.); + float energyCorrectionFactor = 1.f; + if (correctionConfig.cfgEnableNonLin.value) { + energyCorrectionFactor = fEMCalCorrectionFactor->Eval(photon.e() > MinEnergy ? photon.e() : MinEnergy); + } + ROOT::Math::PtEtaPhiMVector photon3(energyCorrectionFactor * photon.pt(), photon.eta(), photon.phi(), 0.); if (iCellIDPhoton1 >= 0) { ROOT::Math::PtEtaPhiMVector mother1 = photon1 + photon3; float openingAngle1 = std::acos(photon1.Vect().Dot(photon3.Vect()) / (photon1.P() * photon3.P())); @@ -780,8 +798,8 @@ struct TaskPi0FlowEMC { } /// \brief Calculate background using rotation background method for calib - template - void rotationBackgroundCalib(const ROOT::Math::PtEtaPhiMVector& meson, ROOT::Math::PtEtaPhiMVector photon1, ROOT::Math::PtEtaPhiMVector photon2, TPhotons const& photons_coll, unsigned int ig1, unsigned int ig2, CollsWithQvecs::iterator const& collision) + template + void rotationBackgroundCalib(const ROOT::Math::PtEtaPhiMVector& meson, ROOT::Math::PtEtaPhiMVector photon1, ROOT::Math::PtEtaPhiMVector photon2, TPhotons const& photons_coll, unsigned int ig1, unsigned int ig2, TCollision const& collision) { // if less than 3 clusters are present skip event since we need at least 3 clusters if (photons_coll.size() < NMinPhotonRotBkg) { @@ -817,7 +835,11 @@ struct TaskPi0FlowEMC { if (checkEtaPhi1D(photon.eta(), RecoDecay::constrainAngle(photon.phi())) >= cfgEMCalMapLevelBackground.value) { continue; } - ROOT::Math::PtEtaPhiMVector photon3(photon.pt(), photon.eta(), photon.phi(), 0.); + float energyCorrectionFactor = 1.f; + if (correctionConfig.cfgEnableNonLin.value) { + energyCorrectionFactor = fEMCalCorrectionFactor->Eval(photon.e() > MinEnergy ? photon.e() : MinEnergy); + } + ROOT::Math::PtEtaPhiMVector photon3(energyCorrectionFactor * photon.pt(), photon.eta(), photon.phi(), 0.); if (iCellIDPhoton1 >= 0) { if (std::fabs((photon1.E() - photon3.E()) / (photon1.E() + photon3.E()) < cfgMaxAsymmetry)) { // only use symmetric decays ROOT::Math::PtEtaPhiMVector mother1 = photon1 + photon3; @@ -893,6 +915,10 @@ struct TaskPi0FlowEMC { void processEMCal(CollsWithQvecs const& collisions, EMCalPhotons const& clusters) { int nColl = 1; + float energyCorrectionFactor = 1.f; + if (cfgDoReverseScaling.value) { + energyCorrectionFactor = 1.0505f; + } for (const auto& collision : collisions) { auto photonsPerCollision = clusters.sliceBy(perCollisionEMC, collision.globalIndex()); @@ -971,18 +997,14 @@ struct TaskPi0FlowEMC { continue; } } - - ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); - ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); - if (cfgDoReverseScaling.value) { - // Convert to PxPyPzEVector to modify energy - ROOT::Math::PxPyPzEVector v1Mod(v1); - v1Mod.SetE(v1Mod.E() * 1.0505); - v1 = ROOT::Math::PtEtaPhiMVector(v1Mod.Pt(), v1Mod.Eta(), v1Mod.Phi(), 0.); - ROOT::Math::PxPyPzEVector v2Mod(v2); - v2Mod.SetE(v2Mod.E() * 1.0505); - v2 = ROOT::Math::PtEtaPhiMVector(v2Mod.Pt(), v2Mod.Eta(), v2Mod.Phi(), 0.); + if (correctionConfig.cfgEnableNonLin.value) { + energyCorrectionFactor = fEMCalCorrectionFactor->Eval(g1.e() > MinEnergy ? g1.e() : MinEnergy); } + ROOT::Math::PtEtaPhiMVector v1(energyCorrectionFactor * g1.pt(), g1.eta(), g1.phi(), 0.); + if (correctionConfig.cfgEnableNonLin.value) { + energyCorrectionFactor = fEMCalCorrectionFactor->Eval(g2.e() > MinEnergy ? g2.e() : MinEnergy); + } + ROOT::Math::PtEtaPhiMVector v2(energyCorrectionFactor * g2.pt(), g2.eta(), g2.phi(), 0.); ROOT::Math::PtEtaPhiMVector vMeson = v1 + v2; float dTheta = v1.Theta() - v2.Theta(); float dPhi = v1.Phi() - v2.Phi(); @@ -1031,6 +1053,10 @@ struct TaskPi0FlowEMC { // Pi0 from EMCal void processEMCalMixed(FilteredCollsWithQvecs const& collisions, FilteredEMCalPhotons const& clusters) { + float energyCorrectionFactor = 1.f; + if (cfgDoReverseScaling.value) { + energyCorrectionFactor = 1.0505f; + } auto getClustersSize = [&clusters, this](FilteredCollsWithQvecs::iterator const& col) { auto associatedClusters = clusters.sliceByCached(emccluster::emeventId, col.globalIndex(), this->cache); // it's cached, so slicing/grouping happens only once @@ -1079,18 +1105,14 @@ struct TaskPi0FlowEMC { continue; } } - ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); - ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); - - if (cfgDoReverseScaling.value) { - // Convert to PxPyPzEVector to modify energy - ROOT::Math::PxPyPzEVector v1Mod(v1); - v1Mod.SetE(v1Mod.E() * 1.0505); - v1 = ROOT::Math::PtEtaPhiMVector(v1Mod.Pt(), v1Mod.Eta(), v1Mod.Phi(), 0.); - ROOT::Math::PxPyPzEVector v2Mod(v2); - v2Mod.SetE(v2Mod.E() * 1.0505); - v2 = ROOT::Math::PtEtaPhiMVector(v2Mod.Pt(), v2Mod.Eta(), v2Mod.Phi(), 0.); + if (correctionConfig.cfgEnableNonLin.value) { + energyCorrectionFactor = fEMCalCorrectionFactor->Eval(g1.e() > MinEnergy ? g1.e() : MinEnergy); + } + ROOT::Math::PtEtaPhiMVector v1(energyCorrectionFactor * g1.pt(), g1.eta(), g1.phi(), 0.); + if (correctionConfig.cfgEnableNonLin.value) { + energyCorrectionFactor = fEMCalCorrectionFactor->Eval(g2.e() > MinEnergy ? g2.e() : MinEnergy); } + ROOT::Math::PtEtaPhiMVector v2(energyCorrectionFactor * g2.pt(), g2.eta(), g2.phi(), 0.); ROOT::Math::PtEtaPhiMVector vMeson = v1 + v2; float dTheta = v1.Theta() - v2.Theta(); @@ -1247,8 +1269,9 @@ struct TaskPi0FlowEMC { PROCESS_SWITCH(TaskPi0FlowEMC, processResolution, "Process resolution", false); // EMCal calibration - void processEMCalCalib(CollsWithQvecs const& collisions, EMCalPhotons const& clusters) + void processEMCalCalib(Colls const& collisions, EMCalPhotons const& clusters) { + float energyCorrectionFactor = 1.f; if (!correctionConfig.doEMCalCalib) { return; } @@ -1269,10 +1292,6 @@ struct TaskPi0FlowEMC { // event selection continue; } - if (!isQvecGood(getAllQvec(collision))) { - // selection based on QVector - continue; - } runNow = collision.runNumber(); if (runNow != runBefore) { initCCDB(collision); @@ -1306,18 +1325,16 @@ struct TaskPi0FlowEMC { } } - ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); - ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); - if (cfgDoReverseScaling.value) { - // Convert to PxPyPzEVector to modify energy - ROOT::Math::PxPyPzEVector v1Mod(v1); - v1Mod.SetE(v1Mod.E() * 1.0505); - v1 = ROOT::Math::PtEtaPhiMVector(v1Mod.Pt(), v1Mod.Eta(), v1Mod.Phi(), 0.); - ROOT::Math::PxPyPzEVector v2Mod(v2); - v2Mod.SetE(v2Mod.E() * 1.0505); - v2 = ROOT::Math::PtEtaPhiMVector(v2Mod.Pt(), v2Mod.Eta(), v2Mod.Phi(), 0.); + if (correctionConfig.cfgEnableNonLin.value) { + energyCorrectionFactor = fEMCalCorrectionFactor->Eval(g1.e() > MinEnergy ? g1.e() : MinEnergy); } + ROOT::Math::PtEtaPhiMVector v1(energyCorrectionFactor * g1.pt(), g1.eta(), g1.phi(), 0.); + if (correctionConfig.cfgEnableNonLin.value) { + energyCorrectionFactor = fEMCalCorrectionFactor->Eval(g2.e() > MinEnergy ? g2.e() : MinEnergy); + } + ROOT::Math::PtEtaPhiMVector v2(energyCorrectionFactor * g2.pt(), g2.eta(), g2.phi(), 0.); ROOT::Math::PtEtaPhiMVector vMeson = v1 + v2; + float dTheta = v1.Theta() - v2.Theta(); float dPhi = v1.Phi() - v2.Phi(); float openingAngle = std::acos(v1.Vect().Dot(v2.Vect()) / (v1.P() * v2.P())); From a5a507346582e8309d66383058495f410e11ec86 Mon Sep 17 00:00:00 2001 From: Fabio Catalano Date: Thu, 21 Aug 2025 10:58:41 +0200 Subject: [PATCH 129/986] [PWGHF] Split PID tables for 2prong, 3prong, Dstar (#12652) --- .../DataModel/CandidateReconstructionTables.h | 80 +++++++++++++------ .../TableProducer/candidateCreator2Prong.cxx | 8 +- .../TableProducer/candidateCreator3Prong.cxx | 18 ++--- PWGHF/TableProducer/candidateCreatorDstar.cxx | 12 +-- 4 files changed, 75 insertions(+), 43 deletions(-) diff --git a/PWGHF/DataModel/CandidateReconstructionTables.h b/PWGHF/DataModel/CandidateReconstructionTables.h index d4b6a74a867..26f91ee80a2 100644 --- a/PWGHF/DataModel/CandidateReconstructionTables.h +++ b/PWGHF/DataModel/CandidateReconstructionTables.h @@ -722,36 +722,21 @@ DECLARE_SOA_TABLE(HfCand2ProngBase, "AOD", "HFCAND2PBASE", //! DECLARE_SOA_EXTENDED_TABLE_USER(HfCand2ProngExt, HfCand2ProngBase, "HFCAND2PEXT", //! hf_cand_2prong::Px, hf_cand_2prong::Py, hf_cand_2prong::Pz); -DECLARE_SOA_TABLE(HfProng0PidPi, "AOD", "HFP0PIDPI", //! +DECLARE_SOA_TABLE(HfCand2Prong0PidPi, "AOD", "HFCAND2P0PIDPI", //! hf_cand::NSigTpcPi0, hf_cand::NSigTofPi0, hf_cand::TpcTofNSigmaPi0); -DECLARE_SOA_TABLE(HfProng1PidPi, "AOD", "HFP1PIDPI", //! +DECLARE_SOA_TABLE(HfCand2Prong1PidPi, "AOD", "HFCAND2P1PIDPI", //! hf_cand::NSigTpcPi1, hf_cand::NSigTofPi1, hf_cand::TpcTofNSigmaPi1); -DECLARE_SOA_TABLE(HfProng2PidPi, "AOD", "HFP2PIDPI", //! - hf_cand::NSigTpcPi2, hf_cand::NSigTofPi2, - hf_cand::TpcTofNSigmaPi2); -DECLARE_SOA_TABLE(HfProng0PidKa, "AOD", "HFP0PIDKA", //! +DECLARE_SOA_TABLE(HfCand2Prong0PidKa, "AOD", "HFCAND2P0PIDKA", //! hf_cand::NSigTpcKa0, hf_cand::NSigTofKa0, hf_cand::TpcTofNSigmaKa0); -DECLARE_SOA_TABLE(HfProng1PidKa, "AOD", "HFP1PIDKA", //! +DECLARE_SOA_TABLE(HfCand2Prong1PidKa, "AOD", "HFCAND2P1PIDKA", //! hf_cand::NSigTpcKa1, hf_cand::NSigTofKa1, hf_cand::TpcTofNSigmaKa1); -DECLARE_SOA_TABLE(HfProng2PidKa, "AOD", "HFP2PIDKA", //! - hf_cand::NSigTpcKa2, hf_cand::NSigTofKa2, - hf_cand::TpcTofNSigmaKa2); -DECLARE_SOA_TABLE(HfProng0PidPr, "AOD", "HFP0PIDPR", //! - hf_cand::NSigTpcPr0, hf_cand::NSigTofPr0, - hf_cand::TpcTofNSigmaPr0); -DECLARE_SOA_TABLE(HfProng1PidPr, "AOD", "HFP1PIDPR", //! - hf_cand::NSigTpcPr1, hf_cand::NSigTofPr1, - hf_cand::TpcTofNSigmaPr1); -DECLARE_SOA_TABLE(HfProng2PidPr, "AOD", "HFP2PIDPR", //! - hf_cand::NSigTpcPr2, hf_cand::NSigTofPr2, - hf_cand::TpcTofNSigmaPr2); using HfCand2Prong = HfCand2ProngExt; -using HfCand2ProngWPid = soa::Join; +using HfCand2ProngWPid = soa::Join; DECLARE_SOA_TABLE(HfCand2ProngKF, "AOD", "HFCAND2PKF", hf_cand::KfTopolChi2OverNdf, @@ -1089,9 +1074,37 @@ DECLARE_SOA_TABLE(HfCand3ProngBase, "AOD", "HFCAND3PBASE", //! DECLARE_SOA_EXTENDED_TABLE_USER(HfCand3ProngExt, HfCand3ProngBase, "HFCAND3PEXT", //! hf_cand_3prong::Px, hf_cand_3prong::Py, hf_cand_3prong::Pz); +DECLARE_SOA_TABLE(HfCand3Prong0PidPi, "AOD", "HFCAND3P0PIDPI", //! + hf_cand::NSigTpcPi0, hf_cand::NSigTofPi0, + hf_cand::TpcTofNSigmaPi0); +DECLARE_SOA_TABLE(HfCand3Prong1PidPi, "AOD", "HFCAND3P1PIDPI", //! + hf_cand::NSigTpcPi1, hf_cand::NSigTofPi1, + hf_cand::TpcTofNSigmaPi1); +DECLARE_SOA_TABLE(HfCand3Prong2PidPi, "AOD", "HFCAND3P2PIDPI", //! + hf_cand::NSigTpcPi2, hf_cand::NSigTofPi2, + hf_cand::TpcTofNSigmaPi2); +DECLARE_SOA_TABLE(HfCand3Prong0PidKa, "AOD", "HFCAND3P0PIDKA", //! + hf_cand::NSigTpcKa0, hf_cand::NSigTofKa0, + hf_cand::TpcTofNSigmaKa0); +DECLARE_SOA_TABLE(HfCand3Prong1PidKa, "AOD", "HFCAND3P1PIDKA", //! + hf_cand::NSigTpcKa1, hf_cand::NSigTofKa1, + hf_cand::TpcTofNSigmaKa1); +DECLARE_SOA_TABLE(HfCand3Prong2PidKa, "AOD", "HFCAND3P2PIDKA", //! + hf_cand::NSigTpcKa2, hf_cand::NSigTofKa2, + hf_cand::TpcTofNSigmaKa2); +DECLARE_SOA_TABLE(HfCand3Prong0PidPr, "AOD", "HFCAND3P0PIDPR", //! + hf_cand::NSigTpcPr0, hf_cand::NSigTofPr0, + hf_cand::TpcTofNSigmaPr0); +DECLARE_SOA_TABLE(HfCand3Prong1PidPr, "AOD", "HFCAND3P1PIDPR", //! + hf_cand::NSigTpcPr1, hf_cand::NSigTofPr1, + hf_cand::TpcTofNSigmaPr1); +DECLARE_SOA_TABLE(HfCand3Prong2PidPr, "AOD", "HFCAND3P2PIDPR", //! + hf_cand::NSigTpcPr2, hf_cand::NSigTofPr2, + hf_cand::TpcTofNSigmaPr2); + using HfCand3Prong = HfCand3ProngExt; -using HfCand3ProngWPidPiKaPr = soa::Join; -using HfCand3ProngWPidPiKa = soa::Join; +using HfCand3ProngWPidPiKaPr = soa::Join; +using HfCand3ProngWPidPiKa = soa::Join; DECLARE_SOA_TABLE(HfCand3ProngKF, "AOD", "HFCAND3PKF", hf_cand_3prong::KfXError, hf_cand_3prong::KfYError, hf_cand_3prong::KfZError, @@ -2812,8 +2825,27 @@ DECLARE_SOA_TABLE(HfD0FromDstarBase, "AOD", "HFD0FRMDSTR", DECLARE_SOA_EXTENDED_TABLE_USER(HfD0FromDstarExt, HfD0FromDstarBase, "HFD0FRMDSTREXT", hf_cand_dstar::PxD0, hf_cand_dstar::PyD0, hf_cand_dstar::PzD0); +DECLARE_SOA_TABLE(HfCandDstarProng0PidPi, "AOD", "HFDSTRP0PIDPI", //! + hf_cand::NSigTpcPi0, hf_cand::NSigTofPi0, + hf_cand::TpcTofNSigmaPi0); +DECLARE_SOA_TABLE(HfCandDstarProng1PidPi, "AOD", "HFDSTRP1PIDPI", //! + hf_cand::NSigTpcPi1, hf_cand::NSigTofPi1, + hf_cand::TpcTofNSigmaPi1); +DECLARE_SOA_TABLE(HfCandDstarProng2PidPi, "AOD", "HFDSTRP2PIDPI", //! + hf_cand::NSigTpcPi2, hf_cand::NSigTofPi2, + hf_cand::TpcTofNSigmaPi2); +DECLARE_SOA_TABLE(HfCandDstarProng0PidKa, "AOD", "HFDSTRP0PIDKA", //! + hf_cand::NSigTpcKa0, hf_cand::NSigTofKa0, + hf_cand::TpcTofNSigmaKa0); +DECLARE_SOA_TABLE(HfCandDstarProng1PidKa, "AOD", "HFDSTRP1PIDKA", //! + hf_cand::NSigTpcKa1, hf_cand::NSigTofKa1, + hf_cand::TpcTofNSigmaKa1); +DECLARE_SOA_TABLE(HfCandDstarProng2PidKa, "AOD", "HFDSTRP2PIDKA", //! + hf_cand::NSigTpcKa2, hf_cand::NSigTofKa2, + hf_cand::TpcTofNSigmaKa2); + using HfD0FromDstar = HfD0FromDstarExt; -using HfD0FromDstarWPid = soa::Join; +using HfD0FromDstarWPid = soa::Join; DECLARE_SOA_TABLE(HfCandDstarBase, "AOD", "HFCANDDSTRBASE", o2::soa::Index<>, @@ -2864,7 +2896,7 @@ DECLARE_SOA_EXTENDED_TABLE_USER(HfCandDstarExt, HfCandDstarBase, "HFCANDDSTREXT" using HfCandDstars = HfCandDstarExt; using HfCandDstar = HfCandDstars::iterator; -using HfCandDstarsWPid = soa::Join; +using HfCandDstarsWPid = soa::Join; // table with results of reconstruction level MC matching DECLARE_SOA_TABLE(HfCandDstarMcRec, "AOD", "HFCANDDSTRMCREC", diff --git a/PWGHF/TableProducer/candidateCreator2Prong.cxx b/PWGHF/TableProducer/candidateCreator2Prong.cxx index a897d9fd2f3..c8bc2bd1274 100644 --- a/PWGHF/TableProducer/candidateCreator2Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator2Prong.cxx @@ -89,11 +89,11 @@ using namespace o2::aod::pid_tpc_tof_utils; /// Reconstruction of heavy-flavour 2-prong decay candidates struct HfCandidateCreator2Prong { Produces rowCandidateBase; - Produces rowProng0PidPi; - Produces rowProng0PidKa; - Produces rowProng1PidPi; - Produces rowProng1PidKa; Produces rowCandidateKF; + Produces rowProng0PidPi; + Produces rowProng0PidKa; + Produces rowProng1PidPi; + Produces rowProng1PidKa; // vertexing Configurable constrainKfToPv{"constrainKfToPv", true, "constraint KFParticle to PV"}; diff --git a/PWGHF/TableProducer/candidateCreator3Prong.cxx b/PWGHF/TableProducer/candidateCreator3Prong.cxx index dce9db32828..a549cd24df7 100644 --- a/PWGHF/TableProducer/candidateCreator3Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator3Prong.cxx @@ -91,15 +91,15 @@ using namespace o2::aod::pid_tpc_tof_utils; struct HfCandidateCreator3Prong { Produces rowCandidateBase; Produces rowCandidateKF; - Produces rowProng0PidPi; - Produces rowProng0PidKa; - Produces rowProng0PidPr; - Produces rowProng1PidPi; - Produces rowProng1PidKa; - Produces rowProng1PidPr; - Produces rowProng2PidPi; - Produces rowProng2PidKa; - Produces rowProng2PidPr; + Produces rowProng0PidPi; + Produces rowProng0PidKa; + Produces rowProng0PidPr; + Produces rowProng1PidPi; + Produces rowProng1PidKa; + Produces rowProng1PidPr; + Produces rowProng2PidPi; + Produces rowProng2PidKa; + Produces rowProng2PidPr; // vertexing Configurable propagateToPCA{"propagateToPCA", true, "create tracks version propagated to PCA"}; diff --git a/PWGHF/TableProducer/candidateCreatorDstar.cxx b/PWGHF/TableProducer/candidateCreatorDstar.cxx index 3bb4472be62..2fb6092c4e3 100644 --- a/PWGHF/TableProducer/candidateCreatorDstar.cxx +++ b/PWGHF/TableProducer/candidateCreatorDstar.cxx @@ -77,12 +77,12 @@ using HfDstarsWithPvRefitInfo = soa::Join; struct HfCandidateCreatorDstar { Produces rowCandD0Base; Produces rowCandDstarBase; - Produces rowProng0PidPi; - Produces rowProng0PidKa; - Produces rowProng1PidPi; - Produces rowProng1PidKa; - Produces rowProngSoftPiPidPi; - Produces rowProngSoftPiPidKa; + Produces rowProng0PidPi; + Produces rowProng0PidKa; + Produces rowProng1PidPi; + Produces rowProng1PidKa; + Produces rowProngSoftPiPidPi; + Produces rowProngSoftPiPidKa; Configurable fillHistograms{"fillHistograms", true, "fill histograms"}; From cf8b32d953b1962abf45b8a68610768885d3539f Mon Sep 17 00:00:00 2001 From: JaeyoonCho Date: Thu, 21 Aug 2025 12:33:07 +0200 Subject: [PATCH 130/986] [PWGHF] XicToXiPiPi: Add DecayLengthMcGen column (#12627) --- PWGHF/DataModel/CandidateReconstructionTables.h | 4 +++- PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx | 12 +++++++++--- PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx | 9 ++++++--- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/PWGHF/DataModel/CandidateReconstructionTables.h b/PWGHF/DataModel/CandidateReconstructionTables.h index 26f91ee80a2..9fddeb3551d 100644 --- a/PWGHF/DataModel/CandidateReconstructionTables.h +++ b/PWGHF/DataModel/CandidateReconstructionTables.h @@ -1918,6 +1918,7 @@ DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); // reconstruction le DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); // generator level DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t); DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); +DECLARE_SOA_COLUMN(DecayLengthMcGen, decayLengthMcGen, float); // Residuals and pulls DECLARE_SOA_COLUMN(PtResidual, ptResidual, float); DECLARE_SOA_COLUMN(PResidual, pResidual, float); @@ -2025,7 +2026,8 @@ DECLARE_SOA_TABLE(HfCandXicMcRec, "AOD", "HFCANDXICMCREC", DECLARE_SOA_TABLE(HfCandXicMcGen, "AOD", "HFCANDXICMCGEN", hf_cand_xic_to_xi_pi_pi::FlagMcMatchGen, hf_cand_xic_to_xi_pi_pi::OriginMcGen, - hf_cand::PdgBhadMotherPart); + hf_cand::PdgBhadMotherPart, + hf_cand_xic_to_xi_pi_pi::DecayLengthMcGen); // table with residuals and pulls of PV DECLARE_SOA_TABLE(HfCandXicResid, "AOD", "HFCANDXICRESID", diff --git a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx index 192465b5e33..f88a6d573c9 100644 --- a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx @@ -912,6 +912,7 @@ struct HfCandidateCreatorXicToXiPiPiExpressions { int8_t sign = 0; int8_t flag = 0; int8_t origin = RecoDecay::OriginType::None; + float decayLengthGen = -999.f; int8_t nPionsDecayed = 0; int8_t nInteractionsWithMaterial = 0; // for resonance matching @@ -1088,7 +1089,7 @@ struct HfCandidateCreatorXicToXiPiPiExpressions { if (rejectionMask != 0) { // at least one event selection not satisfied --> reject all particles from this collision for (unsigned int i = 0; i < mcParticlesPerMcColl.size(); ++i) { - rowMcMatchGen(-99, -99, -99); + rowMcMatchGen(-99, -99, -99, decayLengthGen); } continue; } @@ -1134,13 +1135,18 @@ struct HfCandidateCreatorXicToXiPiPiExpressions { // Check whether the charm baryon is non-prompt (from a b quark). if (flag != 0) { origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle, false, &idxBhadMothers); + // Calculate the decay length of the generated particle + auto dau0 = particle.template daughters_as().begin(); + const std::array vtxDau{dau0.vx(), dau0.vy(), dau0.vz()}; + const std::array vtxPV{mcCollision.posX(), mcCollision.posY(), mcCollision.posZ()}; + decayLengthGen = RecoDecay::distance(vtxPV, vtxDau); } // Fill table if (origin == RecoDecay::OriginType::NonPrompt) { auto bHadMother = mcParticles.rawIteratorAt(idxBhadMothers[0]); - rowMcMatchGen(flag, origin, bHadMother.pdgCode()); + rowMcMatchGen(flag, origin, bHadMother.pdgCode(), decayLengthGen); } else { - rowMcMatchGen(flag, origin, 0); + rowMcMatchGen(flag, origin, 0, decayLengthGen); } } // close loop over generated particles } // close loop over McCollisions diff --git a/PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx b/PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx index 52a12a02b91..ca2f34ae5d3 100644 --- a/PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx @@ -334,7 +334,8 @@ DECLARE_SOA_TABLE(HfCandXicToXiPiPiFullPs, "AOD", "HFXICXI2PIFULLP", full::Pt, full::Eta, full::Phi, - full::Y); + full::Y, + hf_cand_xic_to_xi_pi_pi::DecayLengthMcGen); } // namespace o2::aod /// Writes the full information in an output TTree @@ -723,7 +724,8 @@ struct HfTreeCreatorXicToXiPiPi { particle.pt(), particle.eta(), particle.phi(), - RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCPlus)); + RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCPlus), + particle.decayLengthMcGen()); } } } @@ -776,7 +778,8 @@ struct HfTreeCreatorXicToXiPiPi { particle.pt(), particle.eta(), particle.phi(), - RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCPlus)); + RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCPlus), + particle.decayLengthMcGen()); } } } From 122cea3348d97beae23288c01e0e3f9c60b651b6 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Thu, 21 Aug 2025 12:38:43 +0200 Subject: [PATCH 131/986] [PWGEM/Dilepton] update PID ML in TableProducer (#12667) --- .../TableProducer/skimmerPrimaryElectron.cxx | 45 +++++++------------ .../skimmerPrimaryElectronQC.cxx | 36 +++++++-------- 2 files changed, 33 insertions(+), 48 deletions(-) diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx index 778c765aebd..bf1e2b61505 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx @@ -370,33 +370,15 @@ struct skimmerPrimaryElectron { return true; } - template - bool isElectron(TCollision const& collision, TTrack const& track) + template + bool isElectron(TTrack const& track) { if (includeITSsa && (track.hasITS() && !track.hasTPC() && !track.hasTRD() && !track.hasTOF())) { return true; } if (usePIDML) { - if (track.tpcNSigmaEl() < minTPCNsigmaEl || maxTPCNsigmaEl < track.tpcNSigmaEl()) { - return false; - } - if (track.hasTOF() && (maxTOFNsigmaEl < std::fabs(track.tofNSigmaEl()))) { - return false; - } - - // return false; - o2::dataformats::DCA mDcaInfoCov; - mDcaInfoCov.set(999, 999, 999, 999, 999); - auto trackParCov = getTrackParCov(track); - trackParCov.setPID(o2::track::PID::Electron); - mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); - mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); - - std::vector inputFeatures = mlResponseSingleTrack.getInputFeatures(track, trackParCov, collision); - float binningFeature = mlResponseSingleTrack.getBinningFeature(track, trackParCov, collision); - return mlResponseSingleTrack.isSelectedMl(inputFeatures, binningFeature); + return true; } else { return isElectron_TPChadrej(track) || isElectron_TOFreq(track); } @@ -457,6 +439,13 @@ struct skimmerPrimaryElectron { mcTunedTPCSignal = track.mcTunedTPCSignal(); } + float probaEl = 1.0; + if (usePIDML) { + std::vector inputFeatures = mlResponseSingleTrack.getInputFeatures(track, trackParCov, collision); + float binningFeature = mlResponseSingleTrack.getBinningFeature(track, trackParCov, collision); + probaEl = mlResponseSingleTrack.isSelectedMl(inputFeatures, binningFeature); + } + emprimaryelectrons(collision.globalIndex(), track.globalIndex(), track.sign(), pt_recalc, eta_recalc, phi_recalc, dcaXY, dcaZ, trackParCov.getSigmaY2(), trackParCov.getSigmaZY(), trackParCov.getSigmaZ2(), @@ -467,7 +456,7 @@ struct skimmerPrimaryElectron { track.itsClusterSizes(), track.itsChi2NCl(), track.tofChi2(), track.detectorMap(), // trackParCov.getTgl(), - isAssociatedToMPC, false, 1.f, mcTunedTPCSignal); + isAssociatedToMPC, false, probaEl, mcTunedTPCSignal); emprimaryelectronscov( trackParCov.getX(), @@ -584,7 +573,7 @@ struct skimmerPrimaryElectron { auto tracks_per_coll = tracks.sliceBy(perCol, collision.globalIndex()); for (const auto& track : tracks_per_coll) { - if (!checkTrack(collision, track) || !isElectron(collision, track)) { + if (!checkTrack(collision, track) || !isElectron(track)) { continue; } fillTrackTable(collision, track); @@ -613,7 +602,7 @@ struct skimmerPrimaryElectron { for (const auto& trackId : trackIdsThisCollision) { auto track = trackId.template track_as(); - if (!checkTrack(collision, track) || !isElectron(collision, track)) { + if (!checkTrack(collision, track) || !isElectron(track)) { continue; } fillTrackTable(collision, track); @@ -643,7 +632,7 @@ struct skimmerPrimaryElectron { auto tracks_per_coll = tracks.sliceBy(perCol, collision.globalIndex()); for (const auto& track : tracks_per_coll) { - if (!checkTrack(collision, track) || !isElectron(collision, track)) { + if (!checkTrack(collision, track) || !isElectron(track)) { continue; } fillTrackTable(collision, track); @@ -675,7 +664,7 @@ struct skimmerPrimaryElectron { for (const auto& trackId : trackIdsThisCollision) { auto track = trackId.template track_as(); - if (!checkTrack(collision, track) || !isElectron(collision, track)) { + if (!checkTrack(collision, track) || !isElectron(track)) { continue; } fillTrackTable(collision, track); @@ -709,7 +698,7 @@ struct skimmerPrimaryElectron { auto tracks_per_coll = tracks.sliceBy(perCol, collision.globalIndex()); for (const auto& track : tracks_per_coll) { - if (!checkTrack(collision, track) || !isElectron(collision, track)) { + if (!checkTrack(collision, track) || !isElectron(track)) { continue; } fillTrackTable(collision, track); @@ -740,7 +729,7 @@ struct skimmerPrimaryElectron { for (const auto& trackId : trackIdsThisCollision) { auto track = trackId.template track_as(); - if (!checkTrack(collision, track) || !isElectron(collision, track)) { + if (!checkTrack(collision, track) || !isElectron(track)) { continue; } fillTrackTable(collision, track); diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx index c448464ceab..68b0fad8593 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx @@ -420,26 +420,15 @@ struct skimmerPrimaryElectronQC { template bool isElectron(TTrack const& track) { - if (track.hasTPC() && (trackcut.minTPCNsigmaEl < track.tpcNSigmaEl() && track.tpcNSigmaEl() < trackcut.maxTPCNsigmaEl)) { - return true; // accept ITSsa too - } else { - return false; + if (track.hasTPC()) { + if (trackcut.minTPCNsigmaEl < track.tpcNSigmaEl() && track.tpcNSigmaEl() < trackcut.maxTPCNsigmaEl) { + return true; + } else { + return false; + } + } else { // accept ITSsa too + return true; } - - // if (usePIDML) { - // mDcaInfoCov.set(999, 999, 999, 999, 999); - // auto trackParCov = getTrackParCov(track); - // trackParCov.setPID(o2::track::PID::Electron); - // mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); - // mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - // o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); - - // std::vector inputFeatures = mlResponseSingleTrack.getInputFeatures(track, trackParCov, collision); - // float binningFeature = mlResponseSingleTrack.getBinningFeature(track, trackParCov, collision); - // return mlResponseSingleTrack.isSelectedMl(inputFeatures, binningFeature); - // } else { - // return isElectronTPC(track); - // } } template @@ -474,6 +463,13 @@ struct skimmerPrimaryElectronQC { mcTunedTPCSignal = track.mcTunedTPCSignal(); } + float probaEl = 1.0; + if (usePIDML) { + std::vector inputFeatures = mlResponseSingleTrack.getInputFeatures(track, trackParCov, collision); + float binningFeature = mlResponseSingleTrack.getBinningFeature(track, trackParCov, collision); + probaEl = mlResponseSingleTrack.isSelectedMl(inputFeatures, binningFeature); + } + emprimaryelectrons(collision.globalIndex(), track.globalIndex(), track.sign(), pt_recalc, eta_recalc, phi_recalc, dcaXY, dcaZ, trackParCov.getSigmaY2(), trackParCov.getSigmaZY(), trackParCov.getSigmaZ2(), @@ -484,7 +480,7 @@ struct skimmerPrimaryElectronQC { track.itsClusterSizes(), track.itsChi2NCl(), track.tofChi2(), track.detectorMap(), // trackParCov.getTgl(), - isAssociatedToMPC, false, 1.f, mcTunedTPCSignal); + isAssociatedToMPC, false, probaEl, mcTunedTPCSignal); emprimaryelectronscov( trackParCov.getX(), From f029fafe89ab5fbd09fb7b42f39cf7ec05c43059 Mon Sep 17 00:00:00 2001 From: choich08365 <157435123+choich08365@users.noreply.github.com> Date: Thu, 21 Aug 2025 20:19:48 +0900 Subject: [PATCH 132/986] [PWGJE] GNN-based b-jet tagging analysis code updated (#12644) Co-authored-by: Changhwan Choi --- PWGJE/Tasks/bjetTaggingGnn.cxx | 90 ++++++++++++--------------------- PWGJE/Tasks/bjetTreeCreator.cxx | 25 +++++---- 2 files changed, 44 insertions(+), 71 deletions(-) diff --git a/PWGJE/Tasks/bjetTaggingGnn.cxx b/PWGJE/Tasks/bjetTaggingGnn.cxx index 1e74fb21ff3..4e206c43027 100644 --- a/PWGJE/Tasks/bjetTaggingGnn.cxx +++ b/PWGJE/Tasks/bjetTaggingGnn.cxx @@ -57,9 +57,12 @@ struct BjetTaggingGnn { Configurable trackEtaMin{"trackEtaMin", -0.9, "minimum track eta"}; Configurable trackEtaMax{"trackEtaMax", 0.9, "maximum track eta"}; + Configurable maxIPxy{"maxIPxy", 10, "maximum track DCA in xy plane"}; + Configurable maxIPz{"maxIPz", 10, "maximum track DCA in z direction"}; + Configurable trackNppCrit{"trackNppCrit", 0.95, "track not physical primary ratio"}; - // track level configurables + // sv level configurables Configurable svPtMin{"svPtMin", 0.5, "minimum SV pT"}; // jet level configurables @@ -70,9 +73,15 @@ struct BjetTaggingGnn { Configurable> jetRadii{"jetRadii", std::vector{0.4}, "jet resolution parameters"}; + Configurable dbMin{"dbMin", -10., "minimum GNN Db"}; + Configurable dbMax{"dbMax", 20., "maximum GNN Db"}; + Configurable dbNbins{"dbNbins", 3000, "number of bins in axisDbFine"}; + Configurable doDataDriven{"doDataDriven", false, "Flag whether to use fill THnSpase for data driven methods"}; Configurable callSumw2{"callSumw2", false, "Flag whether to call THnSparse::Sumw2() for error calculation"}; + Configurable trainingDatasetRatioParam{"trainingDatasetRatioParam", 0, "Parameter for splitting training/evaluation datasets by collisionId"}; + std::vector eventSelectionBits; std::vector jetRadiiValues; @@ -83,11 +92,11 @@ struct BjetTaggingGnn { eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(static_cast(eventSelections)); - registry.add("h_vertexZ", "Vertex Z;#it{Z} (cm)", {HistType::kTH1F, {{40, -20.0, 20.0}}}); + registry.add("h_vertexZ", "Vertex Z;#it{Z} (cm)", {HistType::kTH1F, {{100, -20.0, 20.0}}}, callSumw2); const AxisSpec axisJetpT{200, 0., 200., "#it{p}_{T} (GeV/#it{c})"}; - const AxisSpec axisDb{200, -10., 20., "#it{D}_{b}"}; - const AxisSpec axisDbFine{3000, -10., 20., "#it{D}_{b}"}; + const AxisSpec axisDb{200, dbMin, dbMax, "#it{D}_{b}"}; + const AxisSpec axisDbFine{dbNbins, dbMin, dbMax, "#it{D}_{b}"}; const AxisSpec axisSVMass{200, 0., 10., "#it{m}_{SV} (GeV/#it{c}^{2})"}; const AxisSpec axisSVEnergy{200, 0., 100., "#it{E}_{SV} (GeV)"}; const AxisSpec axisSLxy{200, 0., 100., "#it{SL}_{xy}"}; @@ -95,40 +104,24 @@ struct BjetTaggingGnn { const AxisSpec axisJetProb{200, 0., 40., "-ln(JP)"}; const AxisSpec axisNTracks{42, 0, 42, "#it{n}_{tracks}"}; - registry.add("h_jetpT", "", {HistType::kTH1F, {axisJetpT}}); + registry.add("h_jetpT", "", {HistType::kTH1F, {axisJetpT}}, callSumw2); registry.add("h_Db", "", {HistType::kTH1F, {axisDbFine}}); registry.add("h2_jetpT_Db", "", {HistType::kTH2F, {axisJetpT, axisDb}}); - registry.add("h2_jetpT_SVMass", "", {HistType::kTH2F, {axisJetpT, axisSVMass}}); - registry.add("h2_jetpT_jetMass", "", {HistType::kTH2F, {axisJetpT, axisJetMass}}); - registry.add("h2_jetpT_jetProb", "", {HistType::kTH2F, {axisJetpT, axisJetProb}}); - registry.add("h2_jetpT_nTracks", "", {HistType::kTH2F, {axisJetpT, axisNTracks}}); if (doprocessMCJets) { - registry.add("h_jetpT_b", "b-jet", {HistType::kTH1F, {axisJetpT}}); - registry.add("h_jetpT_c", "c-jet", {HistType::kTH1F, {axisJetpT}}); - registry.add("h_jetpT_lf", "lf-jet", {HistType::kTH1F, {axisJetpT}}); + registry.add("h_jetpT_b", "b-jet", {HistType::kTH1F, {axisJetpT}}, callSumw2); + registry.add("h_jetpT_c", "c-jet", {HistType::kTH1F, {axisJetpT}}, callSumw2); + registry.add("h_jetpT_lf", "lf-jet", {HistType::kTH1F, {axisJetpT}}, callSumw2); registry.add("h_Db_b", "b-jet", {HistType::kTH1F, {axisDbFine}}); registry.add("h_Db_c", "c-jet", {HistType::kTH1F, {axisDbFine}}); registry.add("h_Db_lf", "lf-jet", {HistType::kTH1F, {axisDbFine}}); registry.add("h2_jetpT_Db_b", "b-jet", {HistType::kTH2F, {axisJetpT, axisDb}}); registry.add("h2_jetpT_Db_c", "c-jet", {HistType::kTH2F, {axisJetpT, axisDb}}); registry.add("h2_jetpT_Db_lf", "lf-jet", {HistType::kTH2F, {axisJetpT, axisDb}}); - registry.add("h2_jetpT_SVMass_b", "b-jet", {HistType::kTH2F, {axisJetpT, axisSVMass}}); - registry.add("h2_jetpT_SVMass_c", "c-jet", {HistType::kTH2F, {axisJetpT, axisSVMass}}); - registry.add("h2_jetpT_SVMass_lf", "lf-jet", {HistType::kTH2F, {axisJetpT, axisSVMass}}); - registry.add("h2_jetpT_jetMass_b", "b-jet", {HistType::kTH2F, {axisJetpT, axisJetMass}}); - registry.add("h2_jetpT_jetMass_c", "c-jet", {HistType::kTH2F, {axisJetpT, axisJetMass}}); - registry.add("h2_jetpT_jetMass_lf", "lf-jet", {HistType::kTH2F, {axisJetpT, axisJetMass}}); - registry.add("h2_jetpT_jetProb_b", "b-jet", {HistType::kTH2F, {axisJetpT, axisJetProb}}); - registry.add("h2_jetpT_jetProb_c", "c-jet", {HistType::kTH2F, {axisJetpT, axisJetProb}}); - registry.add("h2_jetpT_jetProb_lf", "lf-jet", {HistType::kTH2F, {axisJetpT, axisJetProb}}); - registry.add("h2_jetpT_nTracks_b", "b-jet", {HistType::kTH2F, {axisJetpT, axisNTracks}}); - registry.add("h2_jetpT_nTracks_c", "c-jet", {HistType::kTH2F, {axisJetpT, axisNTracks}}); - registry.add("h2_jetpT_nTracks_lf", "lf-jet", {HistType::kTH2F, {axisJetpT, axisNTracks}}); - registry.add("h2_Response_DetjetpT_PartjetpT", "", {HistType::kTH2F, {axisJetpT, axisJetpT}}); - registry.add("h2_Response_DetjetpT_PartjetpT_b", "b-jet", {HistType::kTH2F, {axisJetpT, axisJetpT}}); - registry.add("h2_Response_DetjetpT_PartjetpT_c", "c-jet", {HistType::kTH2F, {axisJetpT, axisJetpT}}); - registry.add("h2_Response_DetjetpT_PartjetpT_lf", "lf-jet", {HistType::kTH2F, {axisJetpT, axisJetpT}}); + registry.add("h2_Response_DetjetpT_PartjetpT", "", {HistType::kTH2F, {axisJetpT, axisJetpT}}, callSumw2); + registry.add("h2_Response_DetjetpT_PartjetpT_b", "b-jet", {HistType::kTH2F, {axisJetpT, axisJetpT}}, callSumw2); + registry.add("h2_Response_DetjetpT_PartjetpT_c", "c-jet", {HistType::kTH2F, {axisJetpT, axisJetpT}}, callSumw2); + registry.add("h2_Response_DetjetpT_PartjetpT_lf", "lf-jet", {HistType::kTH2F, {axisJetpT, axisJetpT}, callSumw2}); registry.add("h2_jetpT_Db_lf_none", "lf-jet (none)", {HistType::kTH2F, {axisJetpT, axisDb}}); registry.add("h2_jetpT_Db_lf_matched", "lf-jet (matched)", {HistType::kTH2F, {axisJetpT, axisDb}}); registry.add("h2_jetpT_Db_npp", "NotPhysPrim", {HistType::kTH2F, {axisJetpT, axisDb}}); @@ -139,17 +132,13 @@ struct BjetTaggingGnn { registry.add("h_Db_npp_b", "NotPhysPrim b-jet", {HistType::kTH1F, {axisDbFine}}); registry.add("h_Db_npp_c", "NotPhysPrim c-jet", {HistType::kTH1F, {axisDbFine}}); registry.add("h_Db_npp_lf", "NotPhysPrim lf-jet", {HistType::kTH1F, {axisDbFine}}); - // registry.add("h2_pT_dcaXY_pp", "tracks", {HistType::kTH2F, {axisJetpT, {200, 0., 1.}}}); - // registry.add("h2_pT_dcaXY_npp", "NotPhysPrim tracks", {HistType::kTH2F, {axisJetpT, {200, 0., 1.}}}); - // registry.add("h2_pT_dcaZ_pp", "tracks", {HistType::kTH2F, {axisJetpT, {200, 0., 2.}}}); - // registry.add("h2_pT_dcaZ_npp", "NotPhysPrim tracks", {HistType::kTH2F, {axisJetpT, {200, 0., 2.}}}); } if (doprocessMCTruthJets) { - registry.add("h_jetpT_particle", "", {HistType::kTH1F, {axisJetpT}}); - registry.add("h_jetpT_particle_b", "particle b-jet", {HistType::kTH1F, {axisJetpT}}); - registry.add("h_jetpT_particle_c", "particle c-jet", {HistType::kTH1F, {axisJetpT}}); - registry.add("h_jetpT_particle_lf", "particle lf-jet", {HistType::kTH1F, {axisJetpT}}); + registry.add("h_jetpT_particle", "", {HistType::kTH1F, {axisJetpT}}, callSumw2); + registry.add("h_jetpT_particle_b", "particle b-jet", {HistType::kTH1F, {axisJetpT}}, callSumw2); + registry.add("h_jetpT_particle_c", "particle c-jet", {HistType::kTH1F, {axisJetpT}}, callSumw2); + registry.add("h_jetpT_particle_lf", "particle lf-jet", {HistType::kTH1F, {axisJetpT}}, callSumw2); } if (doDataDriven) { @@ -181,7 +170,7 @@ struct BjetTaggingGnn { int nTracks = 0; for (const auto& constituent : analysisJet.template tracks_as()) { - if (constituent.pt() < trackPtMin) { + if (constituent.pt() < trackPtMin || !jettaggingutilities::trackAcceptanceWithDca(constituent, maxIPxy, maxIPz)) { continue; } @@ -266,10 +255,6 @@ struct BjetTaggingGnn { registry.fill(HIST("h_jetpT"), analysisJet.pt()); registry.fill(HIST("h_Db"), analysisJet.scoreML()); registry.fill(HIST("h2_jetpT_Db"), analysisJet.pt(), analysisJet.scoreML()); - registry.fill(HIST("h2_jetpT_SVMass"), analysisJet.pt(), mSV); - registry.fill(HIST("h2_jetpT_jetMass"), analysisJet.pt(), analysisJet.mass()); - registry.fill(HIST("h2_jetpT_jetProb"), analysisJet.pt(), analysisJet.jetProb()); - registry.fill(HIST("h2_jetpT_nTracks"), analysisJet.pt(), nTracks); if (doDataDriven) { registry.fill(HIST("hSparse_Incljets"), analysisJet.pt(), analysisJet.scoreML(), mSV, analysisJet.mass(), nTracks); @@ -288,7 +273,12 @@ struct BjetTaggingGnn { return; } - registry.fill(HIST("h_vertexZ"), collision.posZ()); + // Uses only collisionId % trainingDatasetRaioParam != 0 for evaluation dataset + if (trainingDatasetRatioParam && collision.collisionId() % trainingDatasetRatioParam == 0) { + return; + } + + registry.fill(HIST("h_vertexZ"), collision.posZ(), useEventWeight ? collision.weight() : 1.f); for (const auto& analysisJet : MCDjets) { @@ -347,35 +337,19 @@ struct BjetTaggingGnn { registry.fill(HIST("h_jetpT"), analysisJet.pt(), weight); registry.fill(HIST("h_Db"), analysisJet.scoreML(), weight); registry.fill(HIST("h2_jetpT_Db"), analysisJet.pt(), analysisJet.scoreML(), weight); - registry.fill(HIST("h2_jetpT_SVMass"), analysisJet.pt(), mSV, weight); - registry.fill(HIST("h2_jetpT_jetMass"), analysisJet.pt(), analysisJet.mass(), weight); - registry.fill(HIST("h2_jetpT_jetProb"), analysisJet.pt(), analysisJet.jetProb(), weight); - registry.fill(HIST("h2_jetpT_nTracks"), analysisJet.pt(), nTracks, weight); if (jetFlavor == JetTaggingSpecies::beauty) { registry.fill(HIST("h_jetpT_b"), analysisJet.pt(), weight); registry.fill(HIST("h_Db_b"), analysisJet.scoreML(), weight); registry.fill(HIST("h2_jetpT_Db_b"), analysisJet.pt(), analysisJet.scoreML(), weight); - registry.fill(HIST("h2_jetpT_SVMass_b"), analysisJet.pt(), mSV, weight); - registry.fill(HIST("h2_jetpT_jetMass_b"), analysisJet.pt(), analysisJet.mass(), weight); - registry.fill(HIST("h2_jetpT_jetProb_b"), analysisJet.pt(), analysisJet.jetProb(), weight); - registry.fill(HIST("h2_jetpT_nTracks_b"), analysisJet.pt(), nTracks, weight); } else if (jetFlavor == JetTaggingSpecies::charm) { registry.fill(HIST("h_jetpT_c"), analysisJet.pt(), weight); registry.fill(HIST("h_Db_c"), analysisJet.scoreML(), weight); registry.fill(HIST("h2_jetpT_Db_c"), analysisJet.pt(), analysisJet.scoreML(), weight); - registry.fill(HIST("h2_jetpT_SVMass_c"), analysisJet.pt(), mSV, weight); - registry.fill(HIST("h2_jetpT_jetMass_c"), analysisJet.pt(), analysisJet.mass(), weight); - registry.fill(HIST("h2_jetpT_jetProb_c"), analysisJet.pt(), analysisJet.jetProb(), weight); - registry.fill(HIST("h2_jetpT_nTracks_c"), analysisJet.pt(), nTracks, weight); } else { registry.fill(HIST("h_jetpT_lf"), analysisJet.pt(), weight); registry.fill(HIST("h_Db_lf"), analysisJet.scoreML(), weight); registry.fill(HIST("h2_jetpT_Db_lf"), analysisJet.pt(), analysisJet.scoreML(), weight); - registry.fill(HIST("h2_jetpT_SVMass_lf"), analysisJet.pt(), mSV, weight); - registry.fill(HIST("h2_jetpT_jetMass_lf"), analysisJet.pt(), analysisJet.mass(), weight); - registry.fill(HIST("h2_jetpT_jetProb_lf"), analysisJet.pt(), analysisJet.jetProb(), weight); - registry.fill(HIST("h2_jetpT_nTracks_lf"), analysisJet.pt(), nTracks, weight); if (jetFlavor == JetTaggingSpecies::none) { registry.fill(HIST("h2_jetpT_Db_lf_none"), analysisJet.pt(), analysisJet.scoreML(), weight); } else { diff --git a/PWGJE/Tasks/bjetTreeCreator.cxx b/PWGJE/Tasks/bjetTreeCreator.cxx index 103de117469..a3ea1f8611f 100644 --- a/PWGJE/Tasks/bjetTreeCreator.cxx +++ b/PWGJE/Tasks/bjetTreeCreator.cxx @@ -241,6 +241,8 @@ struct BJetTreeCreator { Configurable vtxRes{"vtxRes", 0.01, "Vertex position resolution (cluster size) for GNN vertex predictions (cm)"}; + Configurable trainingDatasetRatioParam{"trainingDatasetRatioParam", 0, "Parameter for splitting training/evaluation datasets by collisionId"}; + std::vector eventSelectionBits; std::vector jetRadiiValues; @@ -488,7 +490,7 @@ struct BJetTreeCreator { trkIdx++; - if (constituent.pt() < trackPtMin) { + if (constituent.pt() < trackPtMin || !jettaggingutilities::trackAcceptanceWithDca(constituent, maxIPxy, maxIPz)) { continue; } @@ -707,7 +709,7 @@ struct BJetTreeCreator { } PROCESS_SWITCH(BJetTreeCreator, processMCJets, "jet information in MC", false); - using MCDJetTableNoSV = soa::Filtered>; + using MCDJetTableNoSV = soa::Filtered>; using JetParticleswID = soa::Join; void processMCJetsForGNN(FilteredCollisionMCD::iterator const& collision, aod::JMcCollisions const&, MCDJetTableNoSV const& MCDjets, MCPJetTable const& MCPjets, JetTracksMCDwID const& allTracks, JetParticleswID const& MCParticles, OriginalTracks const& origTracks, aod::McParticles const& origParticles) @@ -716,7 +718,12 @@ struct BJetTreeCreator { return; } - registry.fill(HIST("h_vertexZ"), collision.posZ()); + // Uses only collisionId % trainingDatasetRaioParam == 0 for training dataset + if (trainingDatasetRatioParam && collision.collisionId() % trainingDatasetRatioParam != 0) { + return; + } + + registry.fill(HIST("h_vertexZ"), collision.posZ(), collision.weight()); auto const mcParticlesPerColl = MCParticles.sliceBy(mcParticlesPerCollision, collision.mcCollisionId()); auto const mcPJetsPerColl = MCPjets.sliceBy(mcpJetsPerCollision, collision.mcCollisionId()); @@ -738,15 +745,7 @@ struct BJetTreeCreator { std::vector indicesTracks; std::vector indicesSVs; - int16_t jetFlavor = 0; - - for (const auto& mcpjet : analysisJet.template matchedJetGeo_as()) { - if (useQuarkDef) { - jetFlavor = jettaggingutilities::getJetFlavor(mcpjet, mcParticlesPerColl); - } else { - jetFlavor = jettaggingutilities::getJetFlavorHadron(mcpjet, mcParticlesPerColl); - } - } + int16_t jetFlavor = analysisJet.origin(); if ((jetFlavor != JetTaggingSpecies::charm && jetFlavor != JetTaggingSpecies::beauty) && (static_cast(std::rand()) / RAND_MAX < getReductionFactor(analysisJet.pt()))) { continue; @@ -760,7 +759,7 @@ struct BJetTreeCreator { analyzeJetTrackInfoForGNN(collision, analysisJet, allTracks, origTracks, indicesTracks, jetFlavor, eventWeight, &trkLabels); registry.fill(HIST("h2_jetMass_jetpT"), analysisJet.pt(), analysisJet.mass(), eventWeight); - registry.fill(HIST("h2_nTracks_jetpT"), analysisJet.pt(), indicesTracks.size()); + registry.fill(HIST("h2_nTracks_jetpT"), analysisJet.pt(), indicesTracks.size(), eventWeight); //+jet registry.fill(HIST("h_jet_pt"), analysisJet.pt()); From f88c0a34f51f78ebe8453b921e560872032c12ab Mon Sep 17 00:00:00 2001 From: mj525 <99000728+mjkim525@users.noreply.github.com> Date: Thu, 21 Aug 2025 22:43:31 +0900 Subject: [PATCH 133/986] [PWGLF] Fix xi1530Analysisqa.cxx (#12673) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Resonances/xi1530Analysisqa.cxx | 119 ++++++++++++++------ 1 file changed, 82 insertions(+), 37 deletions(-) diff --git a/PWGLF/Tasks/Resonances/xi1530Analysisqa.cxx b/PWGLF/Tasks/Resonances/xi1530Analysisqa.cxx index 07ed10a9460..d33b0e589cf 100644 --- a/PWGLF/Tasks/Resonances/xi1530Analysisqa.cxx +++ b/PWGLF/Tasks/Resonances/xi1530Analysisqa.cxx @@ -1058,13 +1058,15 @@ struct Xi1530Analysisqa { aod::ResoTracks const& resoTracks, aod::ResoCascades const& cascTracks) { - auto linkRow = collisionIndex.iteratorAt(resoCollision.globalIndex()); - auto collId = linkRow.collisionId(); // Take original collision global index matched with resoCollision + if (cRecoINELgt0) { + auto linkRow = collisionIndex.iteratorAt(resoCollision.globalIndex()); + auto collId = linkRow.collisionId(); // Take original collision global index matched with resoCollision - auto coll = collisions.iteratorAt(collId); // Take original collision matched with resoCollision + auto coll = collisions.iteratorAt(collId); // Take original collision matched with resoCollision - if (cRecoINELgt0 && !coll.isInelGt0()) // Check reco INELgt0 (at least one PV track in |eta| < 1) about the collision - return; + if (!coll.isInelGt0()) // Check reco INELgt0 (at least one PV track in |eta| < 1) about the collision + return; + } histos.fill(HIST("QAevent/hEvtCounterSameE"), 1.0); auto multiplicity = resoCollision.cent(); @@ -1073,52 +1075,92 @@ struct Xi1530Analysisqa { // Reconstructed level MC for the track void processMC(ResoMCCols::iterator const& resoCollision, - aod::ResoCollisionColls const& resoCollisionIndex, + aod::ResoCollisionColls const& collisionIndex, soa::Join const& collisionsMC, soa::Join const& cascTracks, soa::Join const& resoTracks, soa::Join const&) { - if (!resoCollision.isInAfterAllCuts() || (std::abs(resoCollision.posZ()) > cZvertCutMC)) // MC event selection, all cuts missing vtx cut - return; + float multiplicity; + if (cMCCent && cRecoINELgt0) { + auto linkRow = collisionIndex.iteratorAt(resoCollision.globalIndex()); + auto collId = linkRow.collisionId(); // Take original collision global index matched with resoCollision - auto linkRow = resoCollisionIndex.iteratorAt(resoCollision.globalIndex()); - const int collId = linkRow.collisionId(); + auto coll = collisionsMC.iteratorAt(collId); // Take original collision matched with resoCollision - auto coll = collisionsMC.iteratorAt(collId); + if (!coll.isInelGt0()) // Check reco INELgt0 (at least one PV track in |eta| < 1) about the collision + return; - if (cRecoINELgt0 && !coll.isInelGt0()) - return; + auto mcColl = coll.mcCollision_as>(); + multiplicity = mcColl.centFT0M(); + } else if (!cMCCent && cRecoINELgt0) { + auto linkRow = collisionIndex.iteratorAt(resoCollision.globalIndex()); + auto collId = linkRow.collisionId(); // Take original collision global index matched with resoCollision + + auto coll = collisionsMC.iteratorAt(collId); // Take original collision matched with resoCollision - auto mcColl = coll.mcCollision_as>(); + if (!coll.isInelGt0()) // Check reco INELgt0 (at least one PV track in |eta| < 1) about the collision + return; - auto multiplicityReco = resoCollision.cent(); // Reco level multiplicity per. - auto multiplicityGen = mcColl.centFT0M(); // Gen level multiplicity per. + multiplicity = resoCollision.cent(); + } else if (cMCCent && !cRecoINELgt0) { + auto linkRow = collisionIndex.iteratorAt(resoCollision.globalIndex()); + auto collId = linkRow.collisionId(); // Take original collision global index matched with resoCollision - float multiplicity = cMCCent ? multiplicityGen : multiplicityReco; + auto coll = collisionsMC.iteratorAt(collId); // Take original collision matched with resoCollision + + auto mcColl = coll.mcCollision_as>(); + multiplicity = mcColl.centFT0M(); + } else { + multiplicity = resoCollision.cent(); + } + + if (!resoCollision.isInAfterAllCuts() || (std::abs(resoCollision.posZ()) > cZvertCutMC)) // MC event selection, all cuts missing vtx cut + return; fillHistograms(resoCollision, multiplicity, resoTracks, cascTracks); } // Truth level MC for the track with reco event void processMCTrue(ResoMCCols::iterator const& resoCollision, - aod::ResoCollisionColls const& resoCollisionIndex, + aod::ResoCollisionColls const& collisionIndex, aod::ResoMCParents const& resoParents, aod::ResoCollisionCandidatesMC const& collisionsMC, soa::Join const&) { + float multiplicity; + if (cMCCent && cRecoINELgt0) { + auto linkRow = collisionIndex.iteratorAt(resoCollision.globalIndex()); + auto collId = linkRow.collisionId(); // Take original collision global index matched with resoCollision - auto linkRow = resoCollisionIndex.iteratorAt(resoCollision.globalIndex()); - const int collId = linkRow.collisionId(); + auto coll = collisionsMC.iteratorAt(collId); // Take original collision matched with resoCollision - auto coll = collisionsMC.iteratorAt(collId); + if (!coll.isInelGt0()) // Check reco INELgt0 (at least one PV track in |eta| < 1) about the collision + return; - auto mcColl = coll.mcCollision_as>(); + auto mcColl = coll.mcCollision_as>(); + multiplicity = mcColl.centFT0M(); + } else if (!cMCCent && cRecoINELgt0) { + auto linkRow = collisionIndex.iteratorAt(resoCollision.globalIndex()); + auto collId = linkRow.collisionId(); // Take original collision global index matched with resoCollision - auto multiplicityReco = resoCollision.cent(); // Reco level multiplicity per. - auto multiplicityGen = mcColl.centFT0M(); // Gen level multiplicity per. + auto coll = collisionsMC.iteratorAt(collId); // Take original collision matched with resoCollision - float multiplicity = cMCCent ? multiplicityGen : multiplicityReco; + if (!coll.isInelGt0()) // Check reco INELgt0 (at least one PV track in |eta| < 1) about the collision + return; + + multiplicity = resoCollision.cent(); + } else if (cMCCent && !cRecoINELgt0) { + auto linkRow = collisionIndex.iteratorAt(resoCollision.globalIndex()); + auto collId = linkRow.collisionId(); // Take original collision global index matched with resoCollision + + auto coll = collisionsMC.iteratorAt(collId); // Take original collision matched with resoCollision + + auto mcColl = coll.mcCollision_as>(); + multiplicity = mcColl.centFT0M(); + } else { + multiplicity = resoCollision.cent(); + } for (const auto& part : resoParents) { // loop over all pre-filtered MC particles if (std::abs(part.pdgCode()) != kXiStar || std::abs(part.y()) >= cfgRapidityCut) @@ -1171,13 +1213,15 @@ struct Xi1530Analysisqa { aod::ResoMicroTracks const& resomicrotracks, aod::ResoCascades const& cascTracks) { - auto linkRow = collisionIndex.iteratorAt(resoCollision.globalIndex()); - auto collId = linkRow.collisionId(); // Take original collision global index matched with resoCollision + if (cRecoINELgt0) { + auto linkRow = collisionIndex.iteratorAt(resoCollision.globalIndex()); + auto collId = linkRow.collisionId(); // Take original collision global index matched with resoCollision - auto coll = collisions.iteratorAt(collId); // Take original collision matched with resoCollision + auto coll = collisions.iteratorAt(collId); // Take original collision matched with resoCollision - if (cRecoINELgt0 && !coll.isInelGt0()) // Check reco INELgt0 (at least one PV track in |eta| < 1) about the collision - return; + if (!coll.isInelGt0()) // Check reco INELgt0 (at least one PV track in |eta| < 1) about the collision + return; + } histos.fill(HIST("QAevent/hEvtCounterSameE"), 1.0); auto multiplicity = resoCollision.cent(); @@ -1222,15 +1266,16 @@ struct Xi1530Analysisqa { for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { - const auto rcIdx = collision1.globalIndex(); - - const auto linkRow = collisionIndex.iteratorAt(rcIdx); - const auto collId = linkRow.collisionId(); + if (cRecoINELgt0) { + const auto rcIdx = collision1.globalIndex(); + auto linkRow = collisionIndex.iteratorAt(rcIdx); + auto collId = linkRow.collisionId(); // Take original collision global index matched with resoCollision - auto coll = collisions.iteratorAt(collId); - if (cRecoINELgt0 && !coll.isInelGt0()) // Check reco INELgt0 (at least one PV track in |eta| < 1) about the collision - continue; + auto coll = collisions.iteratorAt(collId); // Take original collision matched with resoCollision + if (!coll.isInelGt0()) // Check reco INELgt0 (at least one PV track in |eta| < 1) about the collision + continue; + } histos.fill(HIST("QAevent/hEvtCounterMixedE"), 1.0); auto multiplicity = collision1.cent(); fillHistograms(collision1, multiplicity, tracks1, tracks2); From cedce217b40cdf9ea4c37e7465ee5301586b85a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Thu, 21 Aug 2025 16:12:48 +0200 Subject: [PATCH 134/986] [Tools/ML] model: Add const, pass by reference, add std prefix. (#12592) --- Tools/ML/model.cxx | 24 ++++++++++++------------ Tools/ML/model.h | 16 ++++++++-------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Tools/ML/model.cxx b/Tools/ML/model.cxx index 62ccd9f9839..a60abc65af5 100644 --- a/Tools/ML/model.cxx +++ b/Tools/ML/model.cxx @@ -42,17 +42,17 @@ namespace ml std::string OnnxModel::printShape(const std::vector& v) { std::stringstream ss(""); - for (size_t i = 0; i < v.size() - 1; i++) + for (std::size_t i = 0; i < v.size() - 1; i++) ss << v[i] << "x"; ss << v[v.size() - 1]; return ss.str(); } -bool OnnxModel::checkHyperloop(bool verbose) +bool OnnxModel::checkHyperloop(const bool verbose) { /// Testing hyperloop core settings const char* alienCores = gSystem->Getenv("ALIEN_JDL_CPUCORES"); - bool alienCoresFound = (alienCores != NULL); + const bool alienCoresFound = (alienCores != NULL); if (alienCoresFound) { if (verbose) { LOGP(info, "Hyperloop test/Grid job detected! Number of cores = {}. Setting threads anyway to 1.", alienCores); @@ -68,7 +68,7 @@ bool OnnxModel::checkHyperloop(bool verbose) return alienCoresFound; } -void OnnxModel::initModel(std::string localPath, bool enableOptimizations, int threads, uint64_t from, uint64_t until) +void OnnxModel::initModel(const std::string& localPath, const bool enableOptimizations, const int threads, const uint64_t from, const uint64_t until) { assert(from <= until); @@ -90,26 +90,26 @@ void OnnxModel::initModel(std::string localPath, bool enableOptimizations, int t mEnv = std::make_shared(ORT_LOGGING_LEVEL_WARNING, "onnx-model"); mSession = std::make_shared(*mEnv, modelPath.c_str(), sessionOptions); - Ort::AllocatorWithDefaultOptions tmpAllocator; - for (size_t i = 0; i < mSession->GetInputCount(); ++i) { + Ort::AllocatorWithDefaultOptions const tmpAllocator; + for (std::size_t i = 0; i < mSession->GetInputCount(); ++i) { mInputNames.push_back(mSession->GetInputNameAllocated(i, tmpAllocator).get()); } - for (size_t i = 0; i < mSession->GetInputCount(); ++i) { + for (std::size_t i = 0; i < mSession->GetInputCount(); ++i) { mInputShapes.emplace_back(mSession->GetInputTypeInfo(i).GetTensorTypeAndShapeInfo().GetShape()); } - for (size_t i = 0; i < mSession->GetOutputCount(); ++i) { + for (std::size_t i = 0; i < mSession->GetOutputCount(); ++i) { mOutputNames.push_back(mSession->GetOutputNameAllocated(i, tmpAllocator).get()); } - for (size_t i = 0; i < mSession->GetOutputCount(); ++i) { + for (std::size_t i = 0; i < mSession->GetOutputCount(); ++i) { mOutputShapes.emplace_back(mSession->GetOutputTypeInfo(i).GetTensorTypeAndShapeInfo().GetShape()); } LOG(info) << "Input Nodes:"; - for (size_t i = 0; i < mInputNames.size(); i++) { + for (std::size_t i = 0; i < mInputNames.size(); i++) { LOG(info) << "\t" << mInputNames[i] << " : " << printShape(mInputShapes[i]); } LOG(info) << "Output Nodes:"; - for (size_t i = 0; i < mOutputNames.size(); i++) { + for (std::size_t i = 0; i < mOutputNames.size(); i++) { LOG(info) << "\t" << mOutputNames[i] << " : " << printShape(mOutputShapes[i]); } @@ -121,7 +121,7 @@ void OnnxModel::initModel(std::string localPath, bool enableOptimizations, int t LOG(info) << "--- Model initialized! ---"; } -void OnnxModel::setActiveThreads(int threads) +void OnnxModel::setActiveThreads(const int threads) { activeThreads = threads; if (!checkHyperloop(false)) { diff --git a/Tools/ML/model.h b/Tools/ML/model.h index e08b84f129f..468c3dfd733 100644 --- a/Tools/ML/model.h +++ b/Tools/ML/model.h @@ -47,7 +47,7 @@ class OnnxModel ~OnnxModel() = default; // Inferencing - void initModel(std::string, bool = false, int = 0, uint64_t = 0, uint64_t = 0); + void initModel(const std::string&, const bool = false, const int = 0, const uint64_t = 0, const uint64_t = 0); // template methods -- best to define them in header template @@ -57,7 +57,7 @@ class OnnxModel // assert(input[0].GetTensorTypeAndShapeInfo().GetShape() == getNumInputNodes()); --> Fails build in debug mode, TODO: assertion should be checked somehow try { - Ort::RunOptions runOptions; + const Ort::RunOptions runOptions; std::vector inputNamesChar(mInputNames.size(), nullptr); std::transform(std::begin(mInputNames), std::end(mInputNames), std::begin(inputNamesChar), [&](const std::string& str) { return str.c_str(); }); @@ -87,7 +87,7 @@ class OnnxModel template T* evalModel(std::vector& input) { - int64_t size = input.size(); + const int64_t size = input.size(); assert(size % mInputShapes[0][1] == 0); std::vector inputShape{size / mInputShapes[0][1], mInputShapes[0][1]}; std::vector inputTensors; @@ -106,16 +106,16 @@ class OnnxModel Ort::MemoryInfo memInfo = Ort::MemoryInfo::CreateCpu(OrtAllocatorType::OrtArenaAllocator, OrtMemType::OrtMemTypeDefault); - for (size_t iinput = 0; iinput < input.size(); iinput++) { + for (std::size_t iinput = 0; iinput < input.size(); iinput++) { [[maybe_unused]] int totalSize = 1; int64_t size = input[iinput].size(); - for (size_t idim = 1; idim < mInputShapes[iinput].size(); idim++) { + for (std::size_t idim = 1; idim < mInputShapes[iinput].size(); idim++) { totalSize *= mInputShapes[iinput][idim]; } assert(size % totalSize == 0); std::vector inputShape{static_cast(size / totalSize)}; - for (size_t idim = 1; idim < mInputShapes[iinput].size(); idim++) { + for (std::size_t idim = 1; idim < mInputShapes[iinput].size(); idim++) { inputShape.push_back(mInputShapes[iinput][idim]); } @@ -142,7 +142,7 @@ class OnnxModel int getNumOutputNodes() const { return mOutputShapes[0][1]; } uint64_t getValidityFrom() const { return validFrom; } uint64_t getValidityUntil() const { return validUntil; } - void setActiveThreads(int); + void setActiveThreads(const int); private: // Environment variables for the ONNX runtime @@ -164,7 +164,7 @@ class OnnxModel // Internal function for printing the shape of tensors std::string printShape(const std::vector&); - bool checkHyperloop(bool = true); + bool checkHyperloop(const bool = true); }; } // namespace ml From 1a165c9ff569eaea1d72e70d4998001314df16ff Mon Sep 17 00:00:00 2001 From: yuanzhe <90246048+wang-yuanzhe@users.noreply.github.com> Date: Thu, 21 Aug 2025 16:50:07 +0200 Subject: [PATCH 135/986] [PWGLF] Update criteria for hypertriton kink analysis (#12664) --- PWGLF/DataModel/LFHyperNucleiKinkTables.h | 10 - .../Nuspex/hyperkinkRecoTask.cxx | 233 ++++++++++-------- 2 files changed, 137 insertions(+), 106 deletions(-) diff --git a/PWGLF/DataModel/LFHyperNucleiKinkTables.h b/PWGLF/DataModel/LFHyperNucleiKinkTables.h index a661e4dec32..bf69266a484 100644 --- a/PWGLF/DataModel/LFHyperNucleiKinkTables.h +++ b/PWGLF/DataModel/LFHyperNucleiKinkTables.h @@ -37,12 +37,6 @@ DECLARE_SOA_COLUMN(ZMothIU, zMothIU, float); //! Z of DECLARE_SOA_COLUMN(PxMothSV, pxMothSV, float); //! Px of the mother track at the decay vertex DECLARE_SOA_COLUMN(PyMothSV, pyMothSV, float); //! Py of the mother track at the decay vertex DECLARE_SOA_COLUMN(PzMothSV, pzMothSV, float); //! Pz of the mother track at the decay vertex -DECLARE_SOA_COLUMN(RefitPxMothPV, refitPxMothPV, float); //! Refit Px of the mother track at the primary vertex -DECLARE_SOA_COLUMN(RefitPyMothPV, refitPyMothPV, float); //! Refit Py of the mother track at the primary vertex -DECLARE_SOA_COLUMN(RefitPzMothPV, refitPzMothPV, float); //! Refit Pz of the mother track at the primary vertex -DECLARE_SOA_COLUMN(RefitPxMothSV, refitPxMothSV, float); //! Refit Px of the mother track at the decay vertex -DECLARE_SOA_COLUMN(RefitPyMothSV, refitPyMothSV, float); //! Refit Py of the mother track at the decay vertex -DECLARE_SOA_COLUMN(RefitPzMothSV, refitPzMothSV, float); //! Refit Pz of the mother track at the decay vertex DECLARE_SOA_COLUMN(PxDaugSV, pxDaugSV, float); //! Px of the daughter track at the decay vertex DECLARE_SOA_COLUMN(PyDaugSV, pyDaugSV, float); //! Py of the daughter track at the decay vertex DECLARE_SOA_COLUMN(PzDaugSV, pzDaugSV, float); //! Pz of the daughter track at the decay vertex @@ -90,8 +84,6 @@ DECLARE_SOA_TABLE(HypKinkCand, "AOD", "HYPKINKCANDS", hyperkink::IsMatter, hyperkink::XMothIU, hyperkink::YMothIU, hyperkink::ZMothIU, hyperkink::PxMothSV, hyperkink::PyMothSV, hyperkink::PzMothSV, - hyperkink::RefitPxMothPV, hyperkink::RefitPyMothPV, hyperkink::RefitPzMothPV, - hyperkink::RefitPxMothSV, hyperkink::RefitPyMothSV, hyperkink::RefitPzMothSV, hyperkink::PxDaugSV, hyperkink::PyDaugSV, hyperkink::PzDaugSV, hyperkink::DcaMothPv, hyperkink::DcaDaugPv, hyperkink::DcaKinkTopo, hyperkink::ItsChi2Moth, hyperkink::ItsClusterSizesMoth, hyperkink::ItsClusterSizesDaug, @@ -107,8 +99,6 @@ DECLARE_SOA_TABLE(MCHypKinkCand, "AOD", "MCHYPKINKCANDS", hyperkink::IsMatter, hyperkink::XMothIU, hyperkink::YMothIU, hyperkink::ZMothIU, hyperkink::PxMothSV, hyperkink::PyMothSV, hyperkink::PzMothSV, - hyperkink::RefitPxMothPV, hyperkink::RefitPyMothPV, hyperkink::RefitPzMothPV, - hyperkink::RefitPxMothSV, hyperkink::RefitPyMothSV, hyperkink::RefitPzMothSV, hyperkink::PxDaugSV, hyperkink::PyDaugSV, hyperkink::PzDaugSV, hyperkink::DcaMothPv, hyperkink::DcaDaugPv, hyperkink::DcaKinkTopo, hyperkink::ItsChi2Moth, hyperkink::ItsClusterSizesMoth, hyperkink::ItsClusterSizesDaug, diff --git a/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx b/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx index 4c7ac865c18..91245203c71 100644 --- a/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx @@ -70,8 +70,6 @@ constexpr int kITSLayers = 7; constexpr int kITSInnerBarrelLayers = 3; // constexpr int kITSOuterBarrelLayers = 4; -const std::array covPosSV{6.4462712107237135f, 0.1309793068144521f, 6.626654155592929f, -0.4510297694023185f, 0.16996629627762413f, 4.109195981415627f}; - std::shared_ptr hMothCounter; std::shared_ptr hDaugCounter; std::shared_ptr hDaugTPCNSigma; @@ -320,35 +318,6 @@ float getTPCNSigma(const TTrack& track, o2::track::PID partType) return nSigma; } -//-------------------------------------------------------------- -// Refit the momentum of the mother track -template -bool refitMotherTrack(const TTrack& track, o2::track::TrackParametrizationWithError& trackPar, const o2::dataformats::VertexBase& primaryVtx, const o2::dataformats::VertexBase& secondaryVtx) -{ - float trackIUPos[2] = {track.y(), track.z()}; - float trackIUCov[3] = {track.cYY(), track.cZY(), track.cZZ()}; - - o2::base::Propagator::Instance()->propagateToDCABxByBz(primaryVtx, trackPar, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrLUT); - - trackPar.resetCovariance(1e15); - if (!trackPar.update(primaryVtx)) { - return false; - } - - trackPar.rotate(track.alpha()); - o2::base::Propagator::Instance()->PropagateToXBxByBz(trackPar, track.x()); - if (!trackPar.update(trackIUPos, trackIUCov)) { - return false; - } - - o2::base::Propagator::Instance()->propagateToDCABxByBz(secondaryVtx, trackPar, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrLUT); - if (!trackPar.update(secondaryVtx)) { - return false; - } - - return true; -} - //-------------------------------------------------------------- struct HypKinkCandidate { @@ -409,6 +378,11 @@ struct HyperkinkRecoTask { Configurable cutTPCNSigmaDaug{"cutTPCNSigmaDaug", 5, "TPC NSigma cut for daughter tracks"}; Configurable cutTOFNSigmaDaug{"cutTOFNSigmaDaug", 1000, "TOF NSigma cut for daughter tracks"}; Configurable askTOFForDaug{"askTOFForDaug", false, "If true, ask for TOF signal"}; + Configurable minDaugPt{"minDaugPt", 1.0f, "Minimum pT of daughter track (GeV/c)"}; + Configurable minDCADaugToPV{"minDCADaugToPV", 0.f, "Minimum DCA of daughter track to primary vertex (cm)"}; + Configurable maxDCADaugToPV{"maxDCADaugToPV", 999.0f, "Maximum DCA of daughter track to primary vertex (cm)"}; + Configurable maxQtAP{"maxQtAP", 1.f, "Maximum qT of Armenteros-Podolanski Plot"}; + Configurable maxDCAKinkTopo{"maxDCAKinkTopo", 1.f, "Maximum DCA of kink topology (cm)"}; // CCDB options Configurable inputBz{"inputBz", -999, "bz field, -999 is automatic"}; @@ -422,6 +396,7 @@ struct HyperkinkRecoTask { o2::aod::ITSResponse itsResponse; + float massMoth = 999.f; float massChargedDaug = 999.f; float massNeutralDaug = 999.f; int pdgMoth = 0; @@ -438,6 +413,7 @@ struct HyperkinkRecoTask { void init(InitContext& initContext) { if (hypoMoth == kHypertriton) { + massMoth = o2::constants::physics::MassHyperTriton; massChargedDaug = o2::constants::physics::MassTriton; massNeutralDaug = o2::constants::physics::MassPi0; pdgMoth = o2::constants::physics::Pdg::kHyperTriton; @@ -445,6 +421,7 @@ struct HyperkinkRecoTask { pdgDaug[kDaugNeutral] = PDG_t::kPi0; pidTypeDaug = o2::track::PID::Triton; } else if (hypoMoth == kHyperhelium4sigma) { + massMoth = o2::constants::physics::MassHyperHelium4Sigma; massChargedDaug = o2::constants::physics::MassAlpha; massNeutralDaug = o2::constants::physics::MassPi0; pdgMoth = o2::constants::physics::Pdg::kHyperHelium4Sigma; @@ -463,27 +440,28 @@ struct HyperkinkRecoTask { if (hypoMoth == kHyperhelium4sigma) { massAxis = AxisSpec{100, 3.85, 4.25, "m (GeV/#it{c}^{2})"}; } - const AxisSpec diffPtAxis{200, -10.f, 10.f, "#Delta #it{p}_{T} (GeV/#it{c})"}; - const AxisSpec diffPzAxis{200, -10.f, 10.f, "#Delta #it{p}_{z} (GeV/#it{c})"}; - const AxisSpec radiusAxis{40, 0.f, 40.f, "R (cm)"}; + const AxisSpec deltaPtAxis{200, -10.f, 10.f, "#Delta #it{p}_{T} (GeV/#it{c})"}; + const AxisSpec deltaPzAxis{200, -10.f, 10.f, "#Delta #it{p}_{z} (GeV/#it{c})"}; + const AxisSpec recRadiusAxis{40, 0.f, 40.f, "Rec SV R (cm)"}; registry.add("hEventCounter", "hEventCounter", HistType::kTH1F, {{2, 0, 2}}); registry.add("hVertexZCollision", "hVertexZCollision", HistType::kTH1F, {vertexZAxis}); - registry.add("hCandidateCounter", "hCandidateCounter", HistType::kTH1F, {{4, 0, 4}}); + registry.add("hCandidateCounter", "hCandidateCounter", HistType::kTH1F, {{8, 0, 8}}); if (doprocessMC == true) { itsResponse.setMCDefaultParameters(); - registry.add("hTrueCandidateCounter", "hTrueCandidateCounter", HistType::kTH1F, {{4, 0, 4}}); - registry.add("hDiffSVx", ";#Delta x (cm);", HistType::kTH1F, {{200, -10, 10}}); - registry.add("hDiffSVy", ";#Delta y (cm);", HistType::kTH1F, {{200, -10, 10}}); - registry.add("hDiffSVz", ";#Delta z (cm);", HistType::kTH1F, {{200, -10, 10}}); - registry.add("h2RecSVRVsTrueSVR", ";Reconstruced SV R (cm);True SV R (cm);", HistType::kTH2F, {radiusAxis, radiusAxis}); - registry.add("h2TrueMotherDiffPtVsRecSVR", ";Reconstruced SV R (cm);#Delta #it{p}_{T} (GeV/#it{c});", HistType::kTH2F, {radiusAxis, diffPtAxis}); - registry.add("h2TrueMotherDiffEtaVsRecSVR", ";Reconstruced SV R (cm);#Delta #eta;", HistType::kTH2F, {radiusAxis, {200, -0.1, 0.1}}); - registry.add("hDiffDauPx", ";#Delta p_{x} (GeV/#it{c}); ", HistType::kTH1D, {{200, -10, 10}}); - registry.add("hDiffDauPy", ";#Delta p_{y} (GeV/#it{c}); ", HistType::kTH1D, {{200, -10, 10}}); - registry.add("hDiffDauPz", ";#Delta p_{z} (GeV/#it{c}); ", HistType::kTH1D, {{200, -10, 10}}); + registry.add("hTrueCandidateCounter", "hTrueCandidateCounter", HistType::kTH1F, {{8, 0, 8}}); + registry.add("hDeltaSVx", ";#Delta x (cm);", HistType::kTH1F, {{200, -2, 2}}); + registry.add("hDeltaSVy", ";#Delta y (cm);", HistType::kTH1F, {{200, -2, 2}}); + registry.add("hDeltaSVz", ";#Delta z (cm);", HistType::kTH1F, {{200, -2, 2}}); + registry.add("hDeltaSVRVsTrueSVR", ";True SVR (cm);#Delta R (cm)", HistType::kTH2F, {{200, 0, 40}, {200, -2, 2}}); + registry.add("h2RecSVRVsTrueSVR", ";Rec SV R (cm);True SV R (cm);", HistType::kTH2F, {recRadiusAxis, {40, 0, 40}}); + registry.add("h2TrueMotherDeltaPtVsRecSVR", ";Rec SV R (cm);#Delta #it{p}_{T} (GeV/#it{c});", HistType::kTH2F, {recRadiusAxis, deltaPtAxis}); + registry.add("h2TrueMotherDeltaEtaVsRecSVR", ";Rec SV R (cm);#Delta #eta;", HistType::kTH2F, {recRadiusAxis, {200, -0.1, 0.1}}); + registry.add("hDeltaDauPx", ";#Delta p_{x} (GeV/#it{c}); ", HistType::kTH1F, {{200, -2, 2}}); + registry.add("hDeltaDauPy", ";#Delta p_{y} (GeV/#it{c}); ", HistType::kTH1F, {{200, -2, 2}}); + registry.add("hDeltaDauPz", ";#Delta p_{z} (GeV/#it{c}); ", HistType::kTH1F, {{200, -2, 2}}); registry.add("h2TrueSignalMassPt", "h2TrueSignalMassPt", HistType::kTH2F, {{ptAxis, massAxis}}); registry.add("h2TrueDaugTPCNSigmaPt", "h2TrueDaugTPCNSigmaPt", HistType::kTH2F, {{ptAxis, nSigmaAxis}}); @@ -494,11 +472,15 @@ struct HyperkinkRecoTask { registry.add("hDaugOldTOFNSigma_WrongCol", "hDaugOldTOFNSigma_WrongCol", HistType::kTH1F, {{600, -300, 300}}); registry.add("hDaugNewTOFNSigma_CorrectCol", "hDaugNewTOFNSigma_CorrectCol", HistType::kTH1F, {{600, -300, 300}}); registry.add("hDaugNewTOFNSigma_WrongCol", "hDaugNewTOFNSigma_WrongCol", HistType::kTH1F, {{600, -300, 300}}); + + registry.add("hTrueSignalInvMassNegNeutDaugE", "hTrueSignalInvMassNegNeutDaugE", HistType::kTH1F, {{1000, 2.8, 4, "m (GeV/#it{c}^{2})"}}); } registry.add("h2MothMassPt", "h2MothMassPt", HistType::kTH2F, {{ptAxis, massAxis}}); registry.add("h2DaugTPCNSigmaPt", "h2DaugTPCNSigmaPt", HistType::kTH2F, {{ptAxis, nSigmaAxis}}); + registry.add("hInvMassNegNeutDaugE", "hInvMassNegNeutDaugE", HistType::kTH1F, {{1000, 2.8, 4, "m (GeV/#it{c}^{2})"}}); + ccdb->setURL(ccdbPath); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); @@ -675,23 +657,36 @@ struct HyperkinkRecoTask { if ((daugTrack.hasTOF() || askTOFForDaug) && std::abs(nSigmaTOF) > cutTOFNSigmaDaug) { continue; } + registry.fill(HIST("hCandidateCounter"), 3); + + if (kinkCand.ptDaug() < minDaugPt) { + continue; + } + registry.fill(HIST("hCandidateCounter"), 4); + + if (std::abs(kinkCand.dcaDaugPv()) < minDCADaugToPV || std::abs(kinkCand.dcaDaugPv()) > maxDCADaugToPV) { + continue; + } + registry.fill(HIST("hCandidateCounter"), 5); + + if (kinkCand.dcaKinkTopo() > maxDCAKinkTopo) { + continue; + } + registry.fill(HIST("hCandidateCounter"), 6); + + float p2Moth = kinkCand.pxMoth() * kinkCand.pxMoth() + kinkCand.pyMoth() * kinkCand.pyMoth() + kinkCand.pzMoth() * kinkCand.pzMoth(); + float p2Daug = kinkCand.pxDaug() * kinkCand.pxDaug() + kinkCand.pyDaug() * kinkCand.pyDaug() + kinkCand.pzDaug() * kinkCand.pzDaug(); + float sqKink = kinkCand.pxMoth() * kinkCand.pxDaug() + kinkCand.pyMoth() * kinkCand.pyDaug() + kinkCand.pzMoth() * kinkCand.pzDaug(); + float qt = std::sqrt(p2Daug - sqKink * sqKink / p2Moth); + if (qt > maxQtAP) { + continue; + } + registry.fill(HIST("hCandidateCounter"), 7); - registry.fill(HIST("hCandidateCounter"), 2); HypKinkCandidate hypkinkCand; fillCandidate(hypkinkCand, collision, kinkCand, motherTrack, daugTrack); hypkinkCand.nSigmaTOFDaug = nSigmaTOF; - o2::dataformats::VertexBase primaryVtx = {{collision.posX(), collision.posY(), collision.posZ()}, {collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()}}; - o2::dataformats::VertexBase secondaryVtx = {{kinkCand.xDecVtx() + collision.posX(), kinkCand.yDecVtx() + collision.posY(), kinkCand.zDecVtx() + collision.posZ()}, {covPosSV[0], covPosSV[1], covPosSV[2], covPosSV[3], covPosSV[4], covPosSV[5]}}; - std::array refitPPV = {-999.f}; - std::array refitPSV = {-999.f}; - auto motherTrackPar = getTrackParCov(motherTrack); - if (refitMotherTrack(motherTrack, motherTrackPar, primaryVtx, secondaryVtx)) { - motherTrackPar.getPxPyPzGlo(refitPSV); - o2::base::Propagator::Instance()->propagateToDCABxByBz(primaryVtx, motherTrackPar, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrLUT); - motherTrackPar.getPxPyPzGlo(refitPPV); - } - outputDataTable( mBz > 0 ? 1 : -1, hypkinkCand.posPV[0], hypkinkCand.posPV[1], hypkinkCand.posPV[2], @@ -699,8 +694,6 @@ struct HyperkinkRecoTask { hypkinkCand.isMatter, hypkinkCand.lastPosMoth[0], hypkinkCand.lastPosMoth[1], hypkinkCand.lastPosMoth[2], hypkinkCand.momMothSV[0], hypkinkCand.momMothSV[1], hypkinkCand.momMothSV[2], - refitPPV[0], refitPPV[1], refitPPV[2], - refitPSV[0], refitPSV[1], refitPSV[2], hypkinkCand.momDaugSV[0], hypkinkCand.momDaugSV[1], hypkinkCand.momDaugSV[2], hypkinkCand.dcaXYMothPv, hypkinkCand.dcaXYDaugPv, hypkinkCand.dcaKinkTopo, hypkinkCand.chi2ITSMoth, hypkinkCand.itsClusterSizeMoth, hypkinkCand.itsClusterSizeDaug, @@ -744,7 +737,9 @@ struct HyperkinkRecoTask { if (hypoMoth == kHypertriton) { auto dChannel = H3LDecay::getDecayChannel(mcMothTrack, dauIDList); if (dChannel == H3LDecay::k2bodyNeutral && dauIDList[0] == mcDaugTrack.globalIndex()) { - isKinkSignal = true; + if (std::hypot(mcDaugTrack.vx(), mcDaugTrack.vy()) > LayerRadii[3]) { + isKinkSignal = true; + } } } else if (hypoMoth == kHyperhelium4sigma) { auto dChannel = He4SDecay::getDecayChannel(mcMothTrack, dauIDList); @@ -776,8 +771,6 @@ struct HyperkinkRecoTask { if (isKinkSignal) { registry.fill(HIST("hTrueCandidateCounter"), 2); } - registry.fill(HIST("h2MothMassPt"), kinkCand.mothSign() * kinkCand.ptMoth(), invMass); - registry.fill(HIST("h2DaugTPCNSigmaPt"), kinkCand.mothSign() * kinkCand.ptDaug(), tpcNSigmaDaug); auto bc = collision.bc_as(); initCCDB(bc); @@ -802,38 +795,80 @@ struct HyperkinkRecoTask { registry.fill(HIST("hTrueCandidateCounter"), 3); } + if (kinkCand.ptDaug() < minDaugPt) { + continue; + } + registry.fill(HIST("hCandidateCounter"), 4); + if (isKinkSignal) { + registry.fill(HIST("hTrueCandidateCounter"), 4); + } + + if (std::abs(kinkCand.dcaDaugPv()) < minDCADaugToPV || std::abs(kinkCand.dcaDaugPv()) > maxDCADaugToPV) { + continue; + } + registry.fill(HIST("hCandidateCounter"), 5); + if (isKinkSignal) { + registry.fill(HIST("hTrueCandidateCounter"), 5); + } + + if (kinkCand.dcaKinkTopo() > maxDCAKinkTopo) { + continue; + } + registry.fill(HIST("hCandidateCounter"), 6); + if (isKinkSignal) { + registry.fill(HIST("hTrueCandidateCounter"), 6); + } + + float p2Moth = kinkCand.pxMoth() * kinkCand.pxMoth() + kinkCand.pyMoth() * kinkCand.pyMoth() + kinkCand.pzMoth() * kinkCand.pzMoth(); + float p2Daug = kinkCand.pxDaug() * kinkCand.pxDaug() + kinkCand.pyDaug() * kinkCand.pyDaug() + kinkCand.pzDaug() * kinkCand.pzDaug(); + float sqKink = kinkCand.pxMoth() * kinkCand.pxDaug() + kinkCand.pyMoth() * kinkCand.pyDaug() + kinkCand.pzMoth() * kinkCand.pzDaug(); + float qt = std::sqrt(p2Daug - sqKink * sqKink / p2Moth); + if (qt > maxQtAP) { + continue; + } + registry.fill(HIST("hCandidateCounter"), 7); + if (isKinkSignal) { + registry.fill(HIST("hTrueCandidateCounter"), 7); + } + + registry.fill(HIST("h2MothMassPt"), kinkCand.mothSign() * kinkCand.ptMoth(), invMass); + registry.fill(HIST("h2DaugTPCNSigmaPt"), kinkCand.mothSign() * kinkCand.ptDaug(), tpcNSigmaDaug); + + // qa for energy of charged daughter greater than the mother track with mass hypothesis + float pCharDaug = std::hypot(kinkCand.pxDaug(), kinkCand.pyDaug(), kinkCand.pzDaug()); + float pMoth = std::hypot(kinkCand.pxMoth(), kinkCand.pyMoth(), kinkCand.pzMoth()); + float chargedDauE = std::hypot(pCharDaug, massChargedDaug); + float motherE = std::hypot(pMoth, massMoth); + if (chargedDauE < motherE) { + registry.fill(HIST("hInvMassNegNeutDaugE"), invMass); + if (isKinkSignal) { + registry.fill(HIST("hTrueSignalInvMassNegNeutDaugE"), invMass); + } + } + HypKinkCandidate hypkinkCand; fillCandidate(hypkinkCand, collision, kinkCand, motherTrack, daugTrack); hypkinkCand.nSigmaTOFDaug = nSigmaTOF; std::array posDecVtx = {kinkCand.xDecVtx() + collision.posX(), kinkCand.yDecVtx() + collision.posY(), kinkCand.zDecVtx() + collision.posZ()}; - - o2::dataformats::VertexBase primaryVtx = {{collision.posX(), collision.posY(), collision.posZ()}, {collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()}}; - o2::dataformats::VertexBase secondaryVtx = {{posDecVtx[0], posDecVtx[1], posDecVtx[2]}, {covPosSV[0], covPosSV[1], covPosSV[2], covPosSV[3], covPosSV[4], covPosSV[5]}}; - std::array refitPPV = {-999.f}; - std::array refitPSV = {-999.f}; - auto motherTrackPar = getTrackParCov(motherTrack); - if (refitMotherTrack(motherTrack, motherTrackPar, primaryVtx, secondaryVtx)) { - motherTrackPar.getPxPyPzGlo(refitPSV); - o2::base::Propagator::Instance()->propagateToDCABxByBz(primaryVtx, motherTrackPar, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrLUT); - motherTrackPar.getPxPyPzGlo(refitPPV); - } + float recSVR = std::hypot(posDecVtx[0], posDecVtx[1]); // QA, store mcInfo for true signals if (isKinkSignal) { auto mcMothTrack = motherTrack.mcParticle_as(); auto mcDaugTrack = daugTrack.mcParticle_as(); auto mcNeutTrack = particlesMC.rawIteratorAt(dauIDList[1]); - float recSVR = std::sqrt(posDecVtx[0] * posDecVtx[0] + posDecVtx[1] * posDecVtx[1]); - registry.fill(HIST("hDiffSVx"), posDecVtx[0] - mcDaugTrack.vx()); - registry.fill(HIST("hDiffSVy"), posDecVtx[1] - mcDaugTrack.vy()); - registry.fill(HIST("hDiffSVz"), posDecVtx[2] - mcDaugTrack.vz()); - registry.fill(HIST("h2RecSVRVsTrueSVR"), recSVR, std::hypot(mcDaugTrack.vx(), mcDaugTrack.vy())); - registry.fill(HIST("h2TrueMotherDiffPtVsRecSVR"), recSVR, mcMothTrack.pt() - kinkCand.ptMoth()); - registry.fill(HIST("h2TrueMotherDiffEtaVsRecSVR"), recSVR, mcMothTrack.eta() - motherTrack.eta()); - registry.fill(HIST("hDiffDauPx"), kinkCand.pxDaug() - mcDaugTrack.px()); - registry.fill(HIST("hDiffDauPy"), kinkCand.pyDaug() - mcDaugTrack.py()); - registry.fill(HIST("hDiffDauPz"), kinkCand.pzDaug() - mcDaugTrack.pz()); + float trueSVR = std::hypot(mcDaugTrack.vx(), mcDaugTrack.vy()); + registry.fill(HIST("hDeltaSVx"), posDecVtx[0] - mcDaugTrack.vx()); + registry.fill(HIST("hDeltaSVy"), posDecVtx[1] - mcDaugTrack.vy()); + registry.fill(HIST("hDeltaSVz"), posDecVtx[2] - mcDaugTrack.vz()); + registry.fill(HIST("hDeltaSVRVsTrueSVR"), trueSVR, recSVR - trueSVR); + registry.fill(HIST("h2RecSVRVsTrueSVR"), recSVR, trueSVR); + registry.fill(HIST("h2TrueMotherDeltaPtVsRecSVR"), recSVR, mcMothTrack.pt() - kinkCand.ptMoth()); + registry.fill(HIST("h2TrueMotherDeltaEtaVsRecSVR"), recSVR, mcMothTrack.eta() - motherTrack.eta()); + registry.fill(HIST("hDeltaDauPx"), kinkCand.pxDaug() - mcDaugTrack.px()); + registry.fill(HIST("hDeltaDauPy"), kinkCand.pyDaug() - mcDaugTrack.py()); + registry.fill(HIST("hDeltaDauPz"), kinkCand.pzDaug() - mcDaugTrack.pz()); registry.fill(HIST("h2TrueSignalMassPt"), kinkCand.mothSign() * kinkCand.ptMoth(), invMass); registry.fill(HIST("h2TrueDaugTPCNSigmaPt"), kinkCand.mothSign() * kinkCand.ptDaug(), tpcNSigmaDaug); @@ -859,8 +894,6 @@ struct HyperkinkRecoTask { hypkinkCand.isMatter, hypkinkCand.lastPosMoth[0], hypkinkCand.lastPosMoth[1], hypkinkCand.lastPosMoth[2], hypkinkCand.momMothSV[0], hypkinkCand.momMothSV[1], hypkinkCand.momMothSV[2], - refitPPV[0], refitPPV[1], refitPPV[2], - refitPSV[0], refitPSV[1], refitPSV[2], hypkinkCand.momDaugSV[0], hypkinkCand.momDaugSV[1], hypkinkCand.momDaugSV[2], hypkinkCand.dcaXYMothPv, hypkinkCand.dcaXYDaugPv, hypkinkCand.dcaKinkTopo, hypkinkCand.chi2ITSMoth, hypkinkCand.itsClusterSizeMoth, hypkinkCand.itsClusterSizeDaug, @@ -922,8 +955,6 @@ struct HyperkinkRecoTask { -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, - -1, -1, -1, true, false, isReconstructedMCCollisions[mcparticle.mcCollisionId()], isSelectedMCCollisions[mcparticle.mcCollisionId()], hypkinkCand.truePosSV[0], hypkinkCand.truePosSV[1], hypkinkCand.truePosSV[2], hypkinkCand.trueMomMothPV[0], hypkinkCand.trueMomMothPV[1], hypkinkCand.trueMomMothPV[2], @@ -996,8 +1027,8 @@ struct HyperkinkQa { const AxisSpec nsigmaAxis{nsigmaBins, "TPC n#sigma"}; const AxisSpec itsnsigmaAxis{nsigmaBins, "ITS n#sigma"}; const AxisSpec invMassAxis{invMassBins, "Inv Mass (GeV/#it{c}^{2})"}; - const AxisSpec diffPtAxis{200, -10.f, 10.f, "#Delta p_{T} (GeV/#it{c})"}; - const AxisSpec diffPzAxis{200, -10.f, 10.f, "#Delta p_{z} (GeV/#it{c})"}; + const AxisSpec deltaPtAxis{200, -10.f, 10.f, "#Delta p_{T} (GeV/#it{c})"}; + const AxisSpec deltaPzAxis{200, -10.f, 10.f, "#Delta p_{z} (GeV/#it{c})"}; const AxisSpec itsRadiusAxis{radiusBins, "ITS R (cm)"}; const AxisSpec svRadiuAxis{radiusBins, "Decay Vertex R (cm)"}; @@ -1054,9 +1085,9 @@ struct HyperkinkQa { hMothCounter->GetXaxis()->SetBinLabel(7, "ITS IR"); hMothCounter->GetXaxis()->SetBinLabel(8, "ITS chi2"); hMothCounter->GetXaxis()->SetBinLabel(9, "pt"); - recoQAHist.add("h2TrueMotherDiffPtVsTrueSVR", ";Decay Vertex R (cm);#Delta p_{T} (GeV/#it{c});", HistType::kTH2F, {svRadiuAxis, diffPtAxis}); - recoQAHist.add("h2TrueMotherDiffEtaVsTrueSVR", ";Decay Vertex R (cm);#Delta #eta;", HistType::kTH2F, {svRadiuAxis, {200, -1.f, 1.f}}); - recoQAHist.add("h2GoodMotherDiffPtVsTrueSVR", ";Decay Vertex R (cm);#Delta p_{T} (GeV/#it{c});", HistType::kTH2F, {svRadiuAxis, diffPtAxis}); + recoQAHist.add("h2TrueMotherDeltaPtVsTrueSVR", ";Decay Vertex R (cm);#Delta p_{T} (GeV/#it{c});", HistType::kTH2F, {svRadiuAxis, deltaPtAxis}); + recoQAHist.add("h2TrueMotherDeltaEtaVsTrueSVR", ";Decay Vertex R (cm);#Delta #eta;", HistType::kTH2F, {svRadiuAxis, {200, -1.f, 1.f}}); + recoQAHist.add("h2GoodMotherDeltaPtVsTrueSVR", ";Decay Vertex R (cm);#Delta p_{T} (GeV/#it{c});", HistType::kTH2F, {svRadiuAxis, deltaPtAxis}); hDaugCounter = recoQAHist.add("hDaugCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); hDaugTPCNSigma = recoQAHist.add("hDaugTPCNSigma", "", HistType::kTH2F, {rigidityAxis, nsigmaAxis}); @@ -1082,6 +1113,10 @@ struct HyperkinkQa { recoQAHist.add("hDaugITSNSigma", "", HistType::kTH2F, {rigidityAxis, itsnsigmaAxis}); recoQAHist.add("hRecoDaugPVsITSNSigma", "", HistType::kTH2F, {rigidityAxis, itsnsigmaAxis}); recoQAHist.add("hRecoCandidateCount", "", HistType::kTH1F, {{4, 0.f, 4.f}}); + + recoQAHist.add("hDiffZTracks", "", HistType::kTH1F, {{200, -100.f, 100.f}}); + recoQAHist.add("hDiffAbsZTracks", "", HistType::kTH1F, {{200, -100.f, 100.f}}); + recoQAHist.add("hDiffXTracks", "", HistType::kTH1F, {{200, -100.f, 100.f}}); } } @@ -1308,12 +1343,12 @@ struct HyperkinkQa { auto motherTrack = tracks.rawIteratorAt(mcPartIndices[mcparticle.globalIndex()]); bool isGoodMother = motherTrackCheck(motherTrack, hMothCounter); float svR = RecoDecay::sqrtSumOfSquares(svPos[0], svPos[1]); - float diffpt = mcparticle.pt() - charge * motherTrack.pt(); + float deltapt = mcparticle.pt() - charge * motherTrack.pt(); - recoQAHist.fill(HIST("h2TrueMotherDiffPtVsTrueSVR"), svR, diffpt); - recoQAHist.fill(HIST("h2TrueMotherDiffEtaVsTrueSVR"), svR, mcparticle.eta() - motherTrack.eta()); + recoQAHist.fill(HIST("h2TrueMotherDeltaPtVsTrueSVR"), svR, deltapt); + recoQAHist.fill(HIST("h2TrueMotherDeltaEtaVsTrueSVR"), svR, mcparticle.eta() - motherTrack.eta()); if (isGoodMother) { - recoQAHist.fill(HIST("h2GoodMotherDiffPtVsTrueSVR"), svR, diffpt); + recoQAHist.fill(HIST("h2GoodMotherDeltaPtVsTrueSVR"), svR, deltapt); } // if mother track and charged daughters are all reconstructed @@ -1330,6 +1365,12 @@ struct HyperkinkQa { recoQAHist.fill(HIST("hMothIsPVContributer"), motherTrack.isPVContributor() ? 1.5 : 0.5); recoQAHist.fill(HIST("hDaugIsPVContributer"), daughterTrack.isPVContributor() ? 1.5 : 0.5); + if (svR > LayerRadii[3]) { + recoQAHist.fill(HIST("hDiffZTracks"), daughterTrack.z() - motherTrack.z()); + recoQAHist.fill(HIST("hDiffAbsZTracks"), std::abs(daughterTrack.z()) - std::abs(motherTrack.z())); + recoQAHist.fill(HIST("hDiffXTracks"), daughterTrack.x() - motherTrack.x()); + } + float itsNSigma = getITSNSigma(daughterTrack, itsResponse, pidTypeDaug); if (daughterTrack.hasITS()) { recoQAHist.fill(HIST("hDaugITSNSigma"), daughterTrack.sign() * daughterTrack.p(), itsNSigma); From 2f2a33605204fdb8dce01a05d7c52ac7028e309a Mon Sep 17 00:00:00 2001 From: Jesper Karlsson Gumprecht <113693781+jesgum@users.noreply.github.com> Date: Thu, 21 Aug 2025 17:55:08 +0200 Subject: [PATCH 136/986] [ALICE3] Update fasttracker and mcharm histograms (#12675) --- ALICE3/Core/FastTracker.cxx | 30 ++++++++++++++++++- ALICE3/Core/FastTracker.h | 3 ++ .../TableProducer/alice3-multicharmTable.cxx | 17 ++++++++++- ALICE3/Tasks/alice3-multicharm.cxx | 12 ++++---- 4 files changed, 54 insertions(+), 8 deletions(-) diff --git a/ALICE3/Core/FastTracker.cxx b/ALICE3/Core/FastTracker.cxx index 15ac7939af2..8d59501d3be 100644 --- a/ALICE3/Core/FastTracker.cxx +++ b/ALICE3/Core/FastTracker.cxx @@ -144,6 +144,34 @@ void FastTracker::AddSiliconALICE3v2(std::vector pixelResolution) AddLayer("B10", 80., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); } +void FastTracker::AddSiliconALICE3(std::vector pixelResolution) +{ + float x0IT = 0.001; // 0.1% + float x0OT = 0.01; // 1.0% + float xrhoIB = 2.3292e-02; // 100 mum Si + float xrhoOT = 2.3292e-01; // 1000 mum Si + float eff = 1.00; + + float resRPhiIT = pixelResolution[0]; + float resZIT = pixelResolution[1]; + float resRPhiOT = pixelResolution[2]; + float resZOT = pixelResolution[3]; + + AddLayer("bpipe0", 0.48, 250, 0.00042, 2.772e-02, 0.0f, 0.0f, 0.0f, 0); // 150 mum Be + AddLayer("B00", 0.5, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1); + AddLayer("B01", 1.2, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1); + AddLayer("B02", 2.5, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1); + AddLayer("bpipe1", 3.7, 250, 0.0014, 9.24e-02, 0.0f, 0.0f, 0.0f, 0); // 500 mum Be + AddLayer("B03", 7., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); + AddLayer("B04", 9., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); + AddLayer("B05", 12., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); + AddLayer("B06", 20., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); + AddLayer("B07", 30., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); + AddLayer("B08", 45., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); + AddLayer("B09", 60., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); + AddLayer("B10", 80., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); +} + void FastTracker::AddTPC(float phiResMean, float zResMean) { LOG(info) << " Adding standard time projection chamber"; @@ -307,7 +335,7 @@ int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa break; } } - if (firstActiveLayer <= 0) { + if (firstActiveLayer < 0) { LOG(fatal) << "No active layers found in FastTracker, check layer setup"; return -2; // no active layers } diff --git a/ALICE3/Core/FastTracker.h b/ALICE3/Core/FastTracker.h index a0dba5d7ec5..c65c3206618 100644 --- a/ALICE3/Core/FastTracker.h +++ b/ALICE3/Core/FastTracker.h @@ -42,9 +42,11 @@ class FastTracker // Layer and layer configuration void AddLayer(TString name, float r, float z, float x0, float xrho, float resRPhi = 0.0f, float resZ = 0.0f, float eff = 0.0f, int type = 0); DetLayer GetLayer(const int layer, bool ignoreBarrelLayers = true) const; + std::vector GetLayers() const { return layers; } int GetLayerIndex(const std::string& name) const; size_t GetNLayers() const { return layers.size(); } bool IsLayerInert(const int layer) const { return layers[layer].isInert(); } + void ClearLayers() { layers.clear(); } void SetRadiationLength(const std::string layerName, float x0) { layers[GetLayerIndex(layerName)].setRadiationLength(x0); } void SetRadius(const std::string layerName, float r) { layers[GetLayerIndex(layerName)].setRadius(r); } void SetResolutionRPhi(const std::string layerName, float resRPhi) { layers[GetLayerIndex(layerName)].setResolutionRPhi(resRPhi); } @@ -57,6 +59,7 @@ class FastTracker void AddSiliconALICE3v4(std::vector pixelResolution); void AddSiliconALICE3v2(std::vector pixelResolution); + void AddSiliconALICE3(std::vector pixelResolution); void AddTPC(float phiResMean, float zResMean); void Print(); diff --git a/ALICE3/TableProducer/alice3-multicharmTable.cxx b/ALICE3/TableProducer/alice3-multicharmTable.cxx index 3c81557082a..890b645bb51 100644 --- a/ALICE3/TableProducer/alice3-multicharmTable.cxx +++ b/ALICE3/TableProducer/alice3-multicharmTable.cxx @@ -162,7 +162,8 @@ struct alice3multicharmTable { Partition tracksPiFromXiC = ((aod::a3DecayMap::decayMap & trackSelectionPiFromXiC) == trackSelectionPiFromXiC) && aod::track::signed1Pt > 0.0f && 1.0f / nabs(aod::track::signed1Pt) > minPiCPt&& nabs(aod::track::dcaXY) > piFromXiC_dcaXYconstant + piFromXiC_dcaXYpTdep* nabs(aod::track::signed1Pt) && nabs(aod::track::dcaZ) > piFromXiC_dcaZconstant + piFromXiC_dcaZpTdep* nabs(aod::track::signed1Pt); - Partition tracksPiFromXiCC = ((aod::a3DecayMap::decayMap & trackSelectionPiFromXiCC) == trackSelectionPiFromXiCC) && aod::track::signed1Pt > 0.0f && 1.0f / nabs(aod::track::signed1Pt) > minPiCCPt&& nabs(aod::track::dcaXY) > piFromXiCC_dcaXYconstant + piFromXiCC_dcaXYpTdep* nabs(aod::track::signed1Pt); + Partition tracksPiFromXiCC = + ((aod::a3DecayMap::decayMap & trackSelectionPiFromXiCC) == trackSelectionPiFromXiCC) && aod::track::signed1Pt > 0.0f && 1.0f / nabs(aod::track::signed1Pt) > minPiCCPt&& nabs(aod::track::dcaXY) > piFromXiCC_dcaXYconstant + piFromXiCC_dcaXYpTdep* nabs(aod::track::signed1Pt) && nabs(aod::track::dcaZ) > piFromXiCC_dcaZconstant + piFromXiCC_dcaZpTdep* nabs(aod::track::signed1Pt); // Helper struct to pass candidate information struct { @@ -446,6 +447,13 @@ struct alice3multicharmTable { histos.add("hPi2cPt", "hPi2cPt", kTH1D, {axisPt}); histos.add("hPiccPt", "hPiccPt", kTH1D, {axisPt}); + histos.add("hPi1cDCAxy", "hPi1cDCAxy", kTH1D, {axisDCA}); + histos.add("hPi1cDCAz", "hPi1cDCAz", kTH1D, {axisDCA}); + histos.add("hPi2cDCAxy", "hPi2cDCAxy", kTH1D, {axisDCA}); + histos.add("hPi2cDCAz", "hPi2cDCAz", kTH1D, {axisDCA}); + histos.add("hPiccDCAxy", "hPiccDCAxy", kTH1D, {axisDCA}); + histos.add("hPiccDCAz", "hPiccDCAz", kTH1D, {axisDCA}); + histos.add("hMinXiDecayRadius", "hMinXiDecayRadius", kTH1D, {axisRadius2DXi}); histos.add("hMinXiCDecayRadius", "hMinXiCDecayRadius", kTH1D, {axisRadius}); histos.add("hMinXiCCDecayRadius", "hMinXiCCDecayRadius", kTH1D, {axisRadius}); @@ -780,6 +788,13 @@ struct alice3multicharmTable { piFromLa.pt(), piFromLa.eta(), piFromLa.dcaXY(), piFromLa.dcaZ(), pi1c.eta(), pi2c.eta(), picc.eta()); + + histos.fill(HIST("hPi1cDCAxy"), std::abs(pi1c.dcaXY() * 1e+4)); + histos.fill(HIST("hPi1cDCAz"), std::abs(pi1c.dcaZ() * 1e+4)); + histos.fill(HIST("hPi2cDCAxy"), std::abs(pi2c.dcaXY() * 1e+4)); + histos.fill(HIST("hPi2cDCAz"), std::abs(pi2c.dcaZ() * 1e+4)); + histos.fill(HIST("hPiccDCAxy"), std::abs(picc.dcaXY() * 1e+4)); + histos.fill(HIST("hPiccDCAz"), std::abs(picc.dcaZ() * 1e+4)); } } histos.fill(HIST("hCombinationsXiCC"), nCombinationsCC); diff --git a/ALICE3/Tasks/alice3-multicharm.cxx b/ALICE3/Tasks/alice3-multicharm.cxx index 15989109919..f001cb6e08c 100644 --- a/ALICE3/Tasks/alice3-multicharm.cxx +++ b/ALICE3/Tasks/alice3-multicharm.cxx @@ -255,7 +255,7 @@ struct alice3multicharm { histos.add("hBDTScoreVsXiccPt", "hBDTScoreVsXiccPt", kTH2D, {axisPt, axisBDTScore}); histos.add("h3dBDTScore", "h3dBDTScore", kTH3D, {axisPt, axisXiccMass, axisBDTScore}); for (const auto& score : bdt.requiredScores.value) { - histPath = std::format("MLQA/RequiredBDTScore_{}/", static_cast(score * 100)); + histPath = std::format("MLQA/RequiredBDTScore_{}/", static_cast(score * 10000)); histPointers.insert({histPath + "hDCAXicDaughters", histos.add((histPath + "hDCAXicDaughters").c_str(), "hDCAXicDaughters", {kTH1D, {{axisDcaDaughters}}})}); histPointers.insert({histPath + "hDCAXiccDaughters", histos.add((histPath + "hDCAXiccDaughters").c_str(), "hDCAXiccDaughters", {kTH1D, {{axisDcaDaughters}}})}); histPointers.insert({histPath + "hDCAxyXi", histos.add((histPath + "hDCAxyXi").c_str(), "hDCAxyXi", {kTH1D, {{axisDCA}}})}); @@ -329,7 +329,7 @@ struct alice3multicharm { for (const auto& requiredScore : bdt.requiredScores.value) { if (bdtScore > requiredScore) { - histPath = std::format("MLQA/RequiredBDTScore_{}/", static_cast(requiredScore * 100)); + histPath = std::format("MLQA/RequiredBDTScore_{}/", static_cast(requiredScore * 10000)); getHist(TH1, histPath + "hDCAXicDaughters")->Fill(xiccCand.xicDauDCA() * 1e+4); getHist(TH1, histPath + "hDCAXiccDaughters")->Fill(xiccCand.xiccDauDCA() * 1e+4); getHist(TH1, histPath + "hDCAxyXi")->Fill(std::fabs(xiccCand.xiDCAxy() * 1e+4)); @@ -349,13 +349,13 @@ struct alice3multicharm { getHist(TH1, histPath + "hPi2cDCAz")->Fill(xiccCand.pi2cDCAz() * 1e+4); getHist(TH1, histPath + "hPiccDCAxy")->Fill(xiccCand.piccDCAxy() * 1e+4); getHist(TH1, histPath + "hPiccDCAz")->Fill(xiccCand.piccDCAz() * 1e+4); - getHist(TH1, histPath + "hPi1cDCAz")->Fill(xiccCand.pi1cPt()); - getHist(TH1, histPath + "hPi2cDCAz")->Fill(xiccCand.pi2cPt()); - getHist(TH1, histPath + "hPiccDCAz")->Fill(xiccCand.piccPt()); + getHist(TH1, histPath + "hPi1cPt")->Fill(xiccCand.pi1cPt()); + getHist(TH1, histPath + "hPi2cPt")->Fill(xiccCand.pi2cPt()); + getHist(TH1, histPath + "hPiccPt")->Fill(xiccCand.piccPt()); getHist(TH1, histPath + "hXiccMass")->Fill(xiccCand.xiccMass()); getHist(TH1, histPath + "hXicMass")->Fill(xiccCand.xicMass()); - getHist(TH1, histPath + "hXiccPt")->Fill(xiccCand.xiccPt()); getHist(TH1, histPath + "hXicPt")->Fill(xiccCand.xicPt()); + getHist(TH1, histPath + "hXiccPt")->Fill(xiccCand.xiccPt()); getHist(TH3, histPath + "h3dXicc")->Fill(xiccCand.xiccPt(), xiccCand.xiccEta(), xiccCand.xiccMass()); } } From 28c141f4ff824c301acb9f9c7ccddcc8e585ab1f Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Thu, 21 Aug 2025 18:59:19 +0200 Subject: [PATCH 137/986] [PWGEM/Dilepton] add studyDCAFitter.cxx (#12666) --- PWGEM/Dilepton/Tasks/CMakeLists.txt | 6 + PWGEM/Dilepton/Tasks/studyDCAFitter.cxx | 973 ++++++++++++++++++++++++ 2 files changed, 979 insertions(+) create mode 100644 PWGEM/Dilepton/Tasks/studyDCAFitter.cxx diff --git a/PWGEM/Dilepton/Tasks/CMakeLists.txt b/PWGEM/Dilepton/Tasks/CMakeLists.txt index fb0fb81fbcc..4e75843e48d 100644 --- a/PWGEM/Dilepton/Tasks/CMakeLists.txt +++ b/PWGEM/Dilepton/Tasks/CMakeLists.txt @@ -165,3 +165,9 @@ o2physics_add_dpl_workflow(mc-particle-predictions-otf SOURCES mcParticlePredictionsOTF.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(study-dcafitter + SOURCES studyDCAFitter.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2::DCAFitter O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + diff --git a/PWGEM/Dilepton/Tasks/studyDCAFitter.cxx b/PWGEM/Dilepton/Tasks/studyDCAFitter.cxx new file mode 100644 index 00000000000..2bdba06ace6 --- /dev/null +++ b/PWGEM/Dilepton/Tasks/studyDCAFitter.cxx @@ -0,0 +1,973 @@ +// 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 studyDCAFitter.cxx +/// \brief a task to study tagging e from charm hadron decays in MC +/// \author daiki.sekihata@cern.ch + +#include "PWGEM/Dilepton/Utils/MCUtilities.h" +#include "PWGEM/Dilepton/Utils/PairUtilities.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TableHelper.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/PhysicsConstants.h" +#include "DCAFitter/DCAFitterN.h" +#include "DataFormatsCalibration/MeanVertexObject.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +#include "Math/Vector4D.h" + +#include +#include +#include +#include +#include + +using namespace o2; +using namespace o2::soa; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::constants::physics; +using namespace o2::aod::pwgem::dilepton::utils::mcutil; +using namespace o2::aod::pwgem::dilepton::utils::pairutil; + +struct studyDCAFitter { + using MyCollisions = soa::Join; + + using MyTracks = soa::Join; + + struct DielectronAtSV { // ee pair at SV + bool isfound{false}; + float mass{-999.f}; + float pt{-999.f}; + float dca2legs{-999.f}; + float cospa{-999.f}; + float lxy{-999.f}; + float lz{-999.f}; + float lxyz = std::sqrt(std::pow(lxy, 2) + std::pow(lz, 2)); + }; + + // Configurables + Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; + Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; + Configurable mVtxPath{"mVtxPath", "GLO/Calib/MeanVertex", "Path of the mean vertex file"}; + Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; + Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; + Configurable d_UseAbsDCA{"d_UseAbsDCA", true, "Use Abs DCAs"}; + Configurable d_UseWeightedPCA{"d_UseWeightedPCA", false, "Vertices use cov matrices"}; + + struct : ConfigurableGroup { + std::string prefix = "electroncut"; + Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.05, "min pT for single track"}; + Configurable cfg_max_pt_track{"cfg_max_pt_track", 1e+10, "max pT for single track"}; + Configurable cfg_min_eta_track{"cfg_min_eta_track", -0.9, "min eta for single track"}; + Configurable cfg_max_eta_track{"cfg_max_eta_track", +0.9, "max eta for single track"}; + Configurable cfg_min_cr2findable_ratio_tpc{"cfg_min_cr2findable_ratio_tpc", 0.8, "min. TPC Ncr/Nf ratio"}; + Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 0.7, "max fraction of shared clusters in TPC"}; + Configurable cfg_min_ncrossedrows_tpc{"cfg_min_ncrossedrows_tpc", 80, "min ncrossed rows"}; + Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; + Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 5, "min ncluster its"}; + Configurable cfg_min_ncluster_itsib{"cfg_min_ncluster_itsib", 3, "min ncluster itsib"}; + Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; + Configurable cfg_max_chi2its{"cfg_max_chi2its", 5.0, "max chi2/NclsITS"}; + Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 1.0, "max dca XY for single track in cm"}; + Configurable cfg_max_dcaz{"cfg_max_dcaz", 1.0, "max dca Z for single track in cm"}; + + Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2, "min TPC n sigma el inclusion"}; + Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +3, "max TPC n sigma el inclusion"}; + Configurable cfg_min_TPCNsigmaPi{"cfg_min_TPCNsigmaPi", -1e+10, "min TPC n sigma pi exclusion"}; + Configurable cfg_max_TPCNsigmaPi{"cfg_max_TPCNsigmaPi", +3, "max TPC n sigma pi exclusion"}; + Configurable cfg_min_TOFNsigmaEl{"cfg_min_TOFNsigmaEl", -3, "min TOF n sigma el inclusion"}; + Configurable cfg_max_TOFNsigmaEl{"cfg_max_TOFNsigmaEl", +3, "max TOF n sigma el inclusion"}; + } electroncut; + + struct : ConfigurableGroup { + std::string prefix = "svcut"; + Configurable cfg_min_cospa{"cfg_min_cospa", 0.999, "min cospa"}; + Configurable cfg_max_dca2legs{"cfg_max_dca2legs", 0.1, "max distance between 2 legs"}; + } svcut; + + Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; + Configurable cfgCentMin{"cfgCentMin", -1.f, "min. centrality"}; + Configurable cfgCentMax{"cfgCentMax", 999.f, "max. centrality"}; + Configurable cfgZvtxMin{"cfgZvtxMin", -10.f, "min. Zvtx"}; + Configurable cfgZvtxMax{"cfgZvtxMax", 10.f, "max. Zvtx"}; + + Configurable cfgEventGeneratorType{"cfgEventGeneratorType", -1, "if positive, select event generator type. i.e. gap or signal"}; + + HistogramRegistry fRegistry{"fRegistry"}; + static constexpr std::string_view hadron_names[6] = {"LF/", "Jpsi/", "D0/", "Dpm/", "Ds/", "Lc/"}; + static constexpr std::string_view pair_names[3] = {"e_Kpm/", "e_K0S/", "e_Lambda/"}; + static constexpr std::string_view hTypes[4] = {"findable/", "correct/", "fake/", "miss/"}; + static constexpr std::string_view promptTypes[2] = {"prompt/", "nonprompt/"}; + + void init(o2::framework::InitContext&) + { + ccdb->setURL(ccdburl); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setFatalWhenNull(false); + + fitter.setPropagateToPCA(true); + fitter.setMaxR(5.f); + fitter.setMinParamChange(1e-3); + fitter.setMinRelChi2Change(0.9); + fitter.setMaxDZIni(1e9); + fitter.setMaxChi2(1e9); + fitter.setUseAbsDCA(d_UseAbsDCA); + fitter.setWeightedFinalPCA(d_UseWeightedPCA); + fitter.setMatCorrType(matCorr); + + addHistograms(); + } + + int mRunNumber; + float d_bz; + Service ccdb; + // o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; + o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; + const o2::dataformats::MeanVertexObject* mMeanVtx = nullptr; + o2::base::MatLayerCylSet* lut = nullptr; + o2::vertexing::DCAFitterN<2> fitter; + o2::dataformats::DCA mDcaInfoCov; + o2::dataformats::VertexBase mVtx; + + template + void initCCDB(TBC const& bc) + { + if (mRunNumber == bc.runNumber()) { + return; + } + + // load matLUT for this timestamp + if (!lut) { + LOG(info) << "Loading material look-up table for timestamp: " << bc.timestamp(); + lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->getForTimeStamp(lutPath, bc.timestamp())); + } else { + LOG(info) << "Material look-up table already in place. Not reloading."; + } + + // In case override, don't proceed, please - no CCDB access required + if (d_bz_input > -990) { + d_bz = d_bz_input; + o2::parameters::GRPMagField grpmag; + if (std::fabs(d_bz) > 1e-5) { + grpmag.setL3Current(30000.f / (d_bz / 5.0f)); + } + o2::base::Propagator::initFieldFromGRP(&grpmag); + o2::base::Propagator::Instance()->setMatLUT(lut); + mMeanVtx = ccdb->getForTimeStamp(mVtxPath, bc.timestamp()); + mRunNumber = bc.runNumber(); + return; + } + + auto run3grp_timestamp = bc.timestamp(); + o2::parameters::GRPObject* grpo = 0x0; + o2::parameters::GRPMagField* grpmag = 0x0; + if (!skipGRPOquery) { + grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); + } + if (grpo) { + o2::base::Propagator::initFieldFromGRP(grpo); + o2::base::Propagator::Instance()->setMatLUT(lut); + mMeanVtx = ccdb->getForTimeStamp(mVtxPath, bc.timestamp()); + // Fetch magnetic field from ccdb for current collision + d_bz = grpo->getNominalL3Field(); + LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; + } else { + grpmag = ccdb->getForTimeStamp(grpmagPath, run3grp_timestamp); + if (!grpmag) { + LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp; + } + o2::base::Propagator::initFieldFromGRP(grpmag); + o2::base::Propagator::Instance()->setMatLUT(lut); + mMeanVtx = ccdb->getForTimeStamp(mVtxPath, bc.timestamp()); + + // Fetch magnetic field from ccdb for current collision + d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); + LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; + } + mRunNumber = bc.runNumber(); + fitter.setBz(d_bz); + } + + void addHistograms() + { + auto hCollisionCounter = fRegistry.add("Event/hCollisionCounter", "collision counter", kTH1D, {{5, -0.5f, 4.5f}}, false); + hCollisionCounter->GetXaxis()->SetBinLabel(1, "all"); + hCollisionCounter->GetXaxis()->SetBinLabel(2, "accepted"); + + fRegistry.add("Event/hZvtx", "vertex z; Z_{vtx} (cm)", kTH1F, {{100, -50, +50}}, false); + fRegistry.add("Event/hMultNTracksPV", "hMultNTracksPV; N_{track} to PV", kTH1F, {{6001, -0.5, 6000.5}}, false); + fRegistry.add("Event/hMultNTracksPVeta1", "hMultNTracksPVeta1; N_{track} to PV", kTH1F, {{6001, -0.5, 6000.5}}, false); + fRegistry.add("Event/hMultFT0", "hMultFT0;mult. FT0A;mult. FT0C", kTH2F, {{200, 0, 200000}, {60, 0, 60000}}, false); + fRegistry.add("Event/hCentFT0A", "hCentFT0A;centrality FT0A (%)", kTH1F, {{110, 0, 110}}, false); + fRegistry.add("Event/hCentFT0C", "hCentFT0C;centrality FT0C (%)", kTH1F, {{110, 0, 110}}, false); + fRegistry.add("Event/hCentFT0M", "hCentFT0M;centrality FT0M (%)", kTH1F, {{110, 0, 110}}, false); + fRegistry.add("Event/hCentFT0CvsMultNTracksPV", "hCentFT0CvsMultNTracksPV;centrality FT0C (%);N_{track} to PV", kTH2F, {{110, 0, 110}, {600, 0, 6000}}, false); + fRegistry.add("Event/hMultFT0CvsMultNTracksPV", "hMultFT0CvsMultNTracksPV;mult. FT0C;N_{track} to PV", kTH2F, {{60, 0, 60000}, {600, 0, 6000}}, false); + + // for pairs + fRegistry.add("Pair/PV/Data/uls/hs", "hs;m_{ee} (GeV/c^{2});p_{T,ee} (GeV/c);DCA_{ee}^{3D} (#sigma);", kTHnSparseF, {{500, 0, 5}, {100, 0, 10}, {100, 0, 10}}, true); + fRegistry.addClone("Pair/PV/Data/uls/", "Pair/PV/Data/lspp/"); + fRegistry.addClone("Pair/PV/Data/uls/", "Pair/PV/Data/lsmm/"); + fRegistry.addClone("Pair/PV/Data/", "Pair/PV/MC/PromptPhi/"); + fRegistry.addClone("Pair/PV/Data/", "Pair/PV/MC/NonPromptPhi/"); + fRegistry.addClone("Pair/PV/Data/", "Pair/PV/MC/PromptOmega/"); + fRegistry.addClone("Pair/PV/Data/", "Pair/PV/MC/NonPromptOmega/"); + fRegistry.addClone("Pair/PV/Data/", "Pair/PV/MC/PromptJpsi/"); + fRegistry.addClone("Pair/PV/Data/", "Pair/PV/MC/NonPromptJpsi/"); + fRegistry.addClone("Pair/PV/Data/", "Pair/PV/MC/c2e_c2e/"); + fRegistry.addClone("Pair/PV/Data/", "Pair/PV/MC/b2e_b2e/"); + fRegistry.addClone("Pair/PV/Data/", "Pair/PV/MC/b2c2e_b2c2e/"); + fRegistry.addClone("Pair/PV/Data/", "Pair/PV/MC/b2c2e_b2e_sameb/"); + fRegistry.addClone("Pair/PV/Data/", "Pair/PV/MC/b2c2e_b2e_diffb/"); + + fRegistry.add("Pair/SV/Data/uls/hs", "hs;m_{ee} (GeV/c^{2});p_{T,ee} (GeV/c);L_{xy} m_{ee}/p_{T,ee} (mm);", kTHnSparseF, {{500, 0, 5}, {100, 0, 10}, {200, -10, 10}}, true); + fRegistry.add("Pair/SV/Data/uls/hCosPA", "cosPA;cosPA;", kTH1F, {{200, -1, 1}}, false); + fRegistry.add("Pair/SV/Data/uls/hDCA2Legs", "distance between 2 legs at PCA;distance between 2 legs (cm);", kTH1F, {{100, 0, 0.1}}, false); + fRegistry.addClone("Pair/SV/Data/uls/", "Pair/SV/Data/lspp/"); + fRegistry.addClone("Pair/SV/Data/uls/", "Pair/SV/Data/lsmm/"); + fRegistry.addClone("Pair/SV/Data/", "Pair/SV/MC/PromptPhi/"); + fRegistry.addClone("Pair/SV/Data/", "Pair/SV/MC/NonPromptPhi/"); + fRegistry.addClone("Pair/SV/Data/", "Pair/SV/MC/PromptOmega/"); + fRegistry.addClone("Pair/SV/Data/", "Pair/SV/MC/NonPromptOmega/"); + fRegistry.addClone("Pair/SV/Data/", "Pair/SV/MC/PromptJpsi/"); + fRegistry.addClone("Pair/SV/Data/", "Pair/SV/MC/NonPromptJpsi/"); + fRegistry.addClone("Pair/SV/Data/", "Pair/SV/MC/c2e_c2e/"); + fRegistry.addClone("Pair/SV/Data/", "Pair/SV/MC/b2e_b2e/"); + fRegistry.addClone("Pair/SV/Data/", "Pair/SV/MC/b2c2e_b2c2e/"); + fRegistry.addClone("Pair/SV/Data/", "Pair/SV/MC/b2c2e_b2e_sameb/"); + fRegistry.addClone("Pair/SV/Data/", "Pair/SV/MC/b2c2e_b2e_diffb/"); + } + + template + bool isElectron(TTrack const& track) + { + // TOFif + bool is_el_included_TPC = electroncut.cfg_min_TPCNsigmaEl < track.tpcNSigmaEl() && track.tpcNSigmaEl() < electroncut.cfg_max_TPCNsigmaEl; + bool is_el_included_TOF = track.hasTOF() ? (electroncut.cfg_min_TOFNsigmaEl < track.tofNSigmaEl() && track.tofNSigmaEl() < electroncut.cfg_max_TOFNsigmaEl) : true; + return is_el_included_TPC && is_el_included_TOF; + } + + template + bool isSelectedTrack(TTrack const& track, TTrackParCov const& trackParCov, const float dcaXY, const float dcaZ) + { + + if (!track.hasITS() || !track.hasTPC()) { + return false; + } + + if (trackParCov.getPt() < electroncut.cfg_min_pt_track || electroncut.cfg_max_pt_track < trackParCov.getPt()) { + return false; + } + + if (trackParCov.getEta() < electroncut.cfg_min_eta_track || electroncut.cfg_max_eta_track < trackParCov.getEta()) { + return false; + } + + if (std::fabs(dcaXY) > electroncut.cfg_max_dcaxy) { + return false; + } + + if (std::fabs(dcaZ) > electroncut.cfg_max_dcaz) { + return false; + } + + if (track.itsChi2NCl() > electroncut.cfg_max_chi2its) { + return false; + } + + if (track.itsNCls() < electroncut.cfg_min_ncluster_its) { + return false; + } + + if (track.itsNClsInnerBarrel() < electroncut.cfg_min_ncluster_itsib) { + return false; + } + + if (track.tpcChi2NCl() > electroncut.cfg_max_chi2tpc) { + return false; + } + + if (track.tpcNClsFound() < electroncut.cfg_min_ncluster_tpc) { + return false; + } + + if (track.tpcNClsCrossedRows() < electroncut.cfg_min_ncrossedrows_tpc) { + return false; + } + + if (track.tpcCrossedRowsOverFindableCls() < electroncut.cfg_min_cr2findable_ratio_tpc) { + return false; + } + + if (track.tpcFractionSharedCls() > electroncut.cfg_max_frac_shared_clusters_tpc) { + return false; + } + + return true; + } + + template + void fillEventHistograms(TCollision const& collision) + { + fRegistry.fill(HIST("Event/hZvtx"), collision.posZ()); + fRegistry.fill(HIST("Event/hMultNTracksPV"), collision.multNTracksPV()); + fRegistry.fill(HIST("Event/hMultNTracksPVeta1"), collision.multNTracksPVeta1()); + fRegistry.fill(HIST("Event/hMultFT0"), collision.multFT0A(), collision.multFT0C()); + fRegistry.fill(HIST("Event/hCentFT0A"), collision.centFT0A()); + fRegistry.fill(HIST("Event/hCentFT0C"), collision.centFT0C()); + fRegistry.fill(HIST("Event/hCentFT0M"), collision.centFT0M()); + fRegistry.fill(HIST("Event/hCentFT0CvsMultNTracksPV"), collision.centFT0C(), collision.multNTracksPV()); + fRegistry.fill(HIST("Event/hMultFT0CvsMultNTracksPV"), collision.multFT0C(), collision.multNTracksPV()); + } + + template + void fillElectronHistograms(TTrack const& track, TTrackParCov const& trackParCov, const float dcaXY, const float dcaZ) + { + if (std::find(used_electronIds.begin(), used_electronIds.end(), std::make_pair(findId, track.globalIndex())) == used_electronIds.end()) { + float dca3DinSigma = dca3DinSigmaOTF(dcaXY, dcaZ, trackParCov.getSigmaY2(), trackParCov.getSigmaZ2(), trackParCov.getSigmaZY()); + fRegistry.fill(HIST(hadron_names[charmHadronId]) + HIST("electron/") + HIST(promptTypes[promptId]) + HIST(hTypes[findId]) + HIST("hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); + fRegistry.fill(HIST(hadron_names[charmHadronId]) + HIST("electron/") + HIST(promptTypes[promptId]) + HIST(hTypes[findId]) + HIST("hTPCdEdx"), track.tpcInnerParam(), track.tpcSignal()); + fRegistry.fill(HIST(hadron_names[charmHadronId]) + HIST("electron/") + HIST(promptTypes[promptId]) + HIST(hTypes[findId]) + HIST("hTOFbeta"), trackParCov.getP(), track.beta()); + used_electronIds.emplace_back(std::make_pair(findId, track.globalIndex())); + } + } + + float dca3DinSigmaOTF(const float dcaXY, const float dcaZ, const float cYY, const float cZZ, const float cZY) + { + float det = cYY * cZZ - cZY * cZY; // determinant + if (det < 0) { + return 999.f; + } else { + return std::sqrt(std::fabs((dcaXY * dcaXY * cZZ + dcaZ * dcaZ * cYY - 2. * dcaXY * dcaZ * cZY) / det / 2.)); // dca 3d in sigma + } + } + + template + int FindLF(TTrack const& posmc, TTrack const& negmc, TMCParticles const& mcparticles) + { + int arr[] = { + FindCommonMotherFrom2Prongs(posmc, negmc, -11, 11, 22, mcparticles), + FindCommonMotherFrom2Prongs(posmc, negmc, -11, 11, 111, mcparticles), + FindCommonMotherFrom2Prongs(posmc, negmc, -11, 11, 221, mcparticles), + FindCommonMotherFrom2Prongs(posmc, negmc, -11, 11, 331, mcparticles), + FindCommonMotherFrom2Prongs(posmc, negmc, -11, 11, 113, mcparticles), + FindCommonMotherFrom2Prongs(posmc, negmc, -11, 11, 223, mcparticles), + FindCommonMotherFrom2Prongs(posmc, negmc, -11, 11, 333, mcparticles), + FindCommonMotherFrom2Prongs(posmc, negmc, -11, 11, 443, mcparticles), + FindCommonMotherFrom2Prongs(posmc, negmc, -11, 11, 100443, mcparticles), + FindCommonMotherFrom2Prongs(posmc, negmc, -11, 11, 553, mcparticles), + FindCommonMotherFrom2Prongs(posmc, negmc, -11, 11, 100553, mcparticles), + FindCommonMotherFrom2Prongs(posmc, negmc, -11, 11, 200553, mcparticles), + FindCommonMotherFrom2Prongs(posmc, negmc, -11, 11, 300553, mcparticles)}; + int size = sizeof(arr) / sizeof(*arr); + int max = *std::max_element(arr, arr + size); + return max; + } + + template + void runPairingAtPV(TTrack const& t1, TTrack const& t2, TMCParticles const& mcParticles) + { + mDcaInfoCov.set(999, 999, 999, 999, 999); + auto trackParCov1 = getTrackParCov(t1); + trackParCov1.setPID(o2::track::PID::Electron); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov1, 2.f, matCorr, &mDcaInfoCov); + float dcaXY1 = mDcaInfoCov.getY(); + float dcaZ1 = mDcaInfoCov.getZ(); + + mDcaInfoCov.set(999, 999, 999, 999, 999); + auto trackParCov2 = getTrackParCov(t2); + trackParCov2.setPID(o2::track::PID::Electron); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov2, 2.f, matCorr, &mDcaInfoCov); + float dcaXY2 = mDcaInfoCov.getY(); + float dcaZ2 = mDcaInfoCov.getZ(); + + ROOT::Math::PtEtaPhiMVector v1(trackParCov1.getPt(), trackParCov1.getEta(), trackParCov1.getPhi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v2(trackParCov2.getPt(), trackParCov2.getEta(), trackParCov2.getPhi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + float dca3DinSigma1 = dca3DinSigmaOTF(dcaXY1, dcaZ1, trackParCov1.getSigmaY2(), trackParCov1.getSigmaZ2(), trackParCov1.getSigmaZY()); + float dca3DinSigma2 = dca3DinSigmaOTF(dcaXY2, dcaZ2, trackParCov2.getSigmaY2(), trackParCov2.getSigmaZ2(), trackParCov2.getSigmaZY()); + float pair_dca = pairDCAQuadSum(dca3DinSigma1, dca3DinSigma2); + + if constexpr (signType == 0) { // ULS + fRegistry.fill(HIST("Pair/PV/Data/uls/hs"), v12.M(), v12.Pt(), pair_dca); + } else if constexpr (signType == 1) { // LS++ + fRegistry.fill(HIST("Pair/PV/Data/lspp/hs"), v12.M(), v12.Pt(), pair_dca); + } else if constexpr (signType == 2) { // LS-- + fRegistry.fill(HIST("Pair/PV/Data/lsmm/hs"), v12.M(), v12.Pt(), pair_dca); + } + + if constexpr (isMC) { + const auto& t1mc = t1.template mcParticle_as(); + const auto& t2mc = t2.template mcParticle_as(); + if (std::abs(t1mc.pdgCode()) != 11) { + return; + } + if (!(t1mc.isPhysicalPrimary() || t1mc.producedByGenerator())) { + return; + } + if (std::abs(t2mc.pdgCode()) != 11) { + return; + } + if (!(t2mc.isPhysicalPrimary() || t2mc.producedByGenerator())) { + return; + } + // const auto& mp1 = t1mc.template mothers_first_as(); // mother particle of t1 + // const auto& mp2 = t2mc.template mothers_first_as(); // mother particle of t2 + int mcCommonMotherid = FindLF(t1mc, t2mc, mcParticles); + int hfee_type = IsHF(t1mc, t2mc, mcParticles); + + if (mcCommonMotherid > -1) { + const auto cmp = mcParticles.rawIteratorAt(mcCommonMotherid); + switch (std::abs(cmp.pdgCode())) { + case 223: + if (IsFromCharm(cmp, mcParticles) < 0 && IsFromBeauty(cmp, mcParticles) < 0) { // prompt + if constexpr (signType == 0) { // ULS + fRegistry.fill(HIST("Pair/PV/MC/PromptOmega/uls/hs"), v12.M(), v12.Pt(), pair_dca); + } else if constexpr (signType == 1) { // LS++ + fRegistry.fill(HIST("Pair/PV/MC/PromptOmega/lspp/hs"), v12.M(), v12.Pt(), pair_dca); + } else if constexpr (signType == 2) { // LS-- + fRegistry.fill(HIST("Pair/PV/MC/PromptOmega/lsmm/hs"), v12.M(), v12.Pt(), pair_dca); + } + } else { // nonprompt + if constexpr (signType == 0) { // ULS + fRegistry.fill(HIST("Pair/PV/MC/NonPromptOmega/uls/hs"), v12.M(), v12.Pt(), pair_dca); + } else if constexpr (signType == 1) { // LS++ + fRegistry.fill(HIST("Pair/PV/MC/NonPromptOmega/lspp/hs"), v12.M(), v12.Pt(), pair_dca); + } else if constexpr (signType == 2) { // LS-- + fRegistry.fill(HIST("Pair/PV/MC/NonPromptOmega/lsmm/hs"), v12.M(), v12.Pt(), pair_dca); + } + } + break; + case 333: + if (IsFromCharm(cmp, mcParticles) < 0 && IsFromBeauty(cmp, mcParticles) < 0) { // prompt + if constexpr (signType == 0) { // ULS + fRegistry.fill(HIST("Pair/PV/MC/PromptPhi/uls/hs"), v12.M(), v12.Pt(), pair_dca); + } else if constexpr (signType == 1) { // LS++ + fRegistry.fill(HIST("Pair/PV/MC/PromptPhi/lspp/hs"), v12.M(), v12.Pt(), pair_dca); + } else if constexpr (signType == 2) { // LS-- + fRegistry.fill(HIST("Pair/PV/MC/PromptPhi/lsmm/hs"), v12.M(), v12.Pt(), pair_dca); + } + } else { // nonprompt + if constexpr (signType == 0) { // ULS + fRegistry.fill(HIST("Pair/PV/MC/NonPromptPhi/uls/hs"), v12.M(), v12.Pt(), pair_dca); + } else if constexpr (signType == 1) { // LS++ + fRegistry.fill(HIST("Pair/PV/MC/NonPromptPhi/lspp/hs"), v12.M(), v12.Pt(), pair_dca); + } else if constexpr (signType == 2) { // LS-- + fRegistry.fill(HIST("Pair/PV/MC/NonPromptPhi/lsmm/hs"), v12.M(), v12.Pt(), pair_dca); + } + } + break; + case 443: + if (IsFromCharm(cmp, mcParticles) < 0 && IsFromBeauty(cmp, mcParticles) < 0) { // prompt + if constexpr (signType == 0) { // ULS + fRegistry.fill(HIST("Pair/PV/MC/PromptJpsi/uls/hs"), v12.M(), v12.Pt(), pair_dca); + } else if constexpr (signType == 1) { // LS++ + fRegistry.fill(HIST("Pair/PV/MC/PromptJpsi/lspp/hs"), v12.M(), v12.Pt(), pair_dca); + } else if constexpr (signType == 2) { // LS-- + fRegistry.fill(HIST("Pair/PV/MC/PromptJpsi/lsmm/hs"), v12.M(), v12.Pt(), pair_dca); + } + } else { // nonprompt + if constexpr (signType == 0) { // ULS + fRegistry.fill(HIST("Pair/PV/MC/NonPromptJpsi/uls/hs"), v12.M(), v12.Pt(), pair_dca); + } else if constexpr (signType == 1) { // LS++ + fRegistry.fill(HIST("Pair/PV/MC/NonPromptJpsi/lspp/hs"), v12.M(), v12.Pt(), pair_dca); + } else if constexpr (signType == 2) { // LS-- + fRegistry.fill(HIST("Pair/PV/MC/NonPromptJpsi/lsmm/hs"), v12.M(), v12.Pt(), pair_dca); + } + } + break; + default: + break; + } // end of switch for LF + } else if (hfee_type > -1) { + switch (hfee_type) { + case static_cast(EM_HFeeType::kCe_Ce): + if constexpr (signType == 0) { // ULS + fRegistry.fill(HIST("Pair/PV/MC/c2e_c2e/uls/hs"), v12.M(), v12.Pt(), pair_dca); + } else if constexpr (signType == 1) { // LS++ + fRegistry.fill(HIST("Pair/PV/MC/c2e_c2e/lspp/hs"), v12.M(), v12.Pt(), pair_dca); + } else if constexpr (signType == 2) { // LS-- + fRegistry.fill(HIST("Pair/PV/MC/c2e_c2e/lsmm/hs"), v12.M(), v12.Pt(), pair_dca); + } + break; + case static_cast(EM_HFeeType::kBe_Be): + if constexpr (signType == 0) { // ULS + fRegistry.fill(HIST("Pair/PV/MC/b2e_b2e/uls/hs"), v12.M(), v12.Pt(), pair_dca); + } else if constexpr (signType == 1) { // LS++ + fRegistry.fill(HIST("Pair/PV/MC/b2e_b2e/lspp/hs"), v12.M(), v12.Pt(), pair_dca); + } else if constexpr (signType == 2) { // LS-- + fRegistry.fill(HIST("Pair/PV/MC/b2e_b2e/lsmm/hs"), v12.M(), v12.Pt(), pair_dca); + } + break; + case static_cast(EM_HFeeType::kBCe_BCe): + if constexpr (signType == 0) { // ULS + fRegistry.fill(HIST("Pair/PV/MC/b2c2e_b2c2e/uls/hs"), v12.M(), v12.Pt(), pair_dca); + } else if constexpr (signType == 1) { // LS++ + fRegistry.fill(HIST("Pair/PV/MC/b2c2e_b2c2e/lspp/hs"), v12.M(), v12.Pt(), pair_dca); + } else if constexpr (signType == 2) { // LS-- + fRegistry.fill(HIST("Pair/PV/MC/b2c2e_b2c2e/lsmm/hs"), v12.M(), v12.Pt(), pair_dca); + } + break; + case static_cast(EM_HFeeType::kBCe_Be_SameB): + if constexpr (signType == 0) { // ULS + fRegistry.fill(HIST("Pair/PV/MC/b2c2e_b2e_sameb/uls/hs"), v12.M(), v12.Pt(), pair_dca); + } else if constexpr (signType == 1) { // LS++ + fRegistry.fill(HIST("Pair/PV/MC/b2c2e_b2e_sameb/lspp/hs"), v12.M(), v12.Pt(), pair_dca); + } else if constexpr (signType == 2) { // LS-- + fRegistry.fill(HIST("Pair/PV/MC/b2c2e_b2e_sameb/lsmm/hs"), v12.M(), v12.Pt(), pair_dca); + } + break; + case static_cast(EM_HFeeType::kBCe_Be_DiffB): + if constexpr (signType == 0) { // ULS + fRegistry.fill(HIST("Pair/PV/MC/b2c2e_b2e_diffb/uls/hs"), v12.M(), v12.Pt(), pair_dca); + } else if constexpr (signType == 1) { // LS+diff + fRegistry.fill(HIST("Pair/PV/MC/b2c2e_b2e_diffb/lspp/hs"), v12.M(), v12.Pt(), pair_dca); + } else if constexpr (signType == 2) { // LS-diff + fRegistry.fill(HIST("Pair/PV/MC/b2c2e_b2e_diffb/lsmm/hs"), v12.M(), v12.Pt(), pair_dca); + } + break; + + default: + break; + } // end of switch for HFee + } // end of HFee + } // end of isMC + } + + template + void runSVFinder(TCollision const& collision, TTrack const& t1, TTrack const& t2, TMCParticles const& mcParticles) + { + DielectronAtSV eeatsv; + + auto trackParCov1 = getTrackParCov(t1); + trackParCov1.setPID(o2::track::PID::Electron); + auto trackParCov2 = getTrackParCov(t2); + trackParCov2.setPID(o2::track::PID::Electron); + + std::array pVtx = {collision.posX(), collision.posY(), collision.posZ()}; + std::array svpos = {0.}; // secondary vertex position + std::array pvec0 = {0.}; + std::array pvec1 = {0.}; + + int nCand = 0; + try { + nCand = fitter.process(trackParCov1, trackParCov2); + } catch (...) { + LOG(error) << "Exception caught in DCA fitter process call!"; + return; + } + if (nCand == 0) { + return; + } + + fitter.propagateTracksToVertex(); // propagate e and K to D vertex + if (!fitter.isPropagateTracksToVertexDone()) { + return; + } + const auto& vtx = fitter.getPCACandidate(); + for (int i = 0; i < 3; i++) { + svpos[i] = vtx[i]; + } + fitter.getTrack(0).getPxPyPzGlo(pvec0); + fitter.getTrack(1).getPxPyPzGlo(pvec1); + std::array pvecSum = {pvec0[0] + pvec1[0], pvec0[1] + pvec1[1], pvec0[2] + pvec1[2]}; + + float cpa = RecoDecay::cpa(pVtx, svpos, pvecSum); + float dca2legs = std::sqrt(fitter.getChi2AtPCACandidate()); + // float lxy = std::sqrt(std::pow(svpos[0] - collision.posX(), 2) + std::pow(svpos[1] - collision.posY(), 2)); // in cm + float lz = std::fabs(svpos[2] - collision.posZ()); // in cm + + float meeAtSV = RecoDecay::m(std::array{pvec0, pvec1}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}); + float pteeAtSV = RecoDecay::sqrtSumOfSquares(pvecSum[0], pvecSum[1]); + float lxy = RecoDecay::dotProd(std::array{pvecSum[0], pvecSum[1]}, std::array{svpos[0] - collision.posX(), svpos[1] - collision.posY()}) / pteeAtSV; + float ppdl = lxy * 1e-2 * meeAtSV / pteeAtSV * 1e+3; // pseudo-proper decay length in mm + + if (cpa < svcut.cfg_min_cospa || svcut.cfg_max_dca2legs < dca2legs) { + return; + } + + if constexpr (signType == 0) { // ULS + fRegistry.fill(HIST("Pair/SV/Data/uls/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/Data/uls/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/Data/uls/hDCA2Legs"), dca2legs); + } else if constexpr (signType == 1) { // LS++ + fRegistry.fill(HIST("Pair/SV/Data/lspp/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/Data/lspp/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/Data/lspp/hDCA2Legs"), dca2legs); + } else if constexpr (signType == 2) { // LS-- + fRegistry.fill(HIST("Pair/SV/Data/lsmm/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/Data/lsmm/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/Data/lsmm/hDCA2Legs"), dca2legs); + } + + if constexpr (isMC) { + const auto& t1mc = t1.template mcParticle_as(); + const auto& t2mc = t2.template mcParticle_as(); + if (std::abs(t1mc.pdgCode()) != 11) { + return; + } + if (!(t1mc.isPhysicalPrimary() || t1mc.producedByGenerator())) { + return; + } + if (std::abs(t2mc.pdgCode()) != 11) { + return; + } + if (!(t2mc.isPhysicalPrimary() || t2mc.producedByGenerator())) { + return; + } + // const auto& mp1 = t1mc.template mothers_first_as(); // mother particle of t1 + // const auto& mp2 = t2mc.template mothers_first_as(); // mother particle of t2 + int mcCommonMotherid = FindLF(t1mc, t2mc, mcParticles); + int hfee_type = IsHF(t1mc, t2mc, mcParticles); + + if (mcCommonMotherid > -1) { + const auto cmp = mcParticles.rawIteratorAt(mcCommonMotherid); + switch (cmp.pdgCode()) { + case 223: + if (IsFromCharm(cmp, mcParticles) < 0 && IsFromBeauty(cmp, mcParticles) < 0) { // prompt + if constexpr (signType == 0) { // ULS + fRegistry.fill(HIST("Pair/SV/MC/PromptOmega/uls/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/PromptOmega/uls/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/PromptOmega/uls/hDCA2Legs"), dca2legs); + } else if constexpr (signType == 1) { // LS++ + fRegistry.fill(HIST("Pair/SV/MC/PromptOmega/lspp/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/PromptOmega/lspp/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/PromptOmega/lspp/hDCA2Legs"), dca2legs); + } else if constexpr (signType == 2) { // LS-- + fRegistry.fill(HIST("Pair/SV/MC/PromptOmega/lsmm/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/PromptOmega/lsmm/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/PromptOmega/lsmm/hDCA2Legs"), dca2legs); + } + } else { // nonprompt + if constexpr (signType == 0) { // ULS + fRegistry.fill(HIST("Pair/SV/MC/NonPromptOmega/uls/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/NonPromptOmega/uls/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/NonPromptOmega/uls/hDCA2Legs"), dca2legs); + } else if constexpr (signType == 1) { // LS++ + fRegistry.fill(HIST("Pair/SV/MC/NonPromptOmega/lspp/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/NonPromptOmega/lspp/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/NonPromptOmega/lspp/hDCA2Legs"), dca2legs); + } else if constexpr (signType == 2) { // LS-- + fRegistry.fill(HIST("Pair/SV/MC/NonPromptOmega/lsmm/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/NonPromptOmega/lsmm/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/NonPromptOmega/lsmm/hDCA2Legs"), dca2legs); + } + } + break; + case 333: + if (IsFromCharm(cmp, mcParticles) < 0 && IsFromBeauty(cmp, mcParticles) < 0) { // prompt + if constexpr (signType == 0) { // ULS + fRegistry.fill(HIST("Pair/SV/MC/PromptPhi/uls/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/PromptPhi/uls/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/PromptPhi/uls/hDCA2Legs"), dca2legs); + } else if constexpr (signType == 1) { // LS++ + fRegistry.fill(HIST("Pair/SV/MC/PromptPhi/lspp/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/PromptPhi/lspp/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/PromptPhi/lspp/hDCA2Legs"), dca2legs); + } else if constexpr (signType == 2) { // LS-- + fRegistry.fill(HIST("Pair/SV/MC/PromptPhi/lsmm/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/PromptPhi/lsmm/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/PromptPhi/lsmm/hDCA2Legs"), dca2legs); + } + } else { // nonprompt + if constexpr (signType == 0) { // ULS + fRegistry.fill(HIST("Pair/SV/MC/NonPromptPhi/uls/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/NonPromptPhi/uls/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/NonPromptPhi/uls/hDCA2Legs"), dca2legs); + } else if constexpr (signType == 1) { // LS++ + fRegistry.fill(HIST("Pair/SV/MC/NonPromptPhi/lspp/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/NonPromptPhi/lspp/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/NonPromptPhi/lspp/hDCA2Legs"), dca2legs); + } else if constexpr (signType == 2) { // LS-- + fRegistry.fill(HIST("Pair/SV/MC/NonPromptPhi/lsmm/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/NonPromptPhi/lsmm/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/NonPromptPhi/lsmm/hDCA2Legs"), dca2legs); + } + } + break; + case 443: + if (IsFromCharm(cmp, mcParticles) < 0 && IsFromBeauty(cmp, mcParticles) < 0) { // prompt + if constexpr (signType == 0) { // ULS + fRegistry.fill(HIST("Pair/SV/MC/PromptJpsi/uls/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/PromptJpsi/uls/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/PromptJpsi/uls/hDCA2Legs"), dca2legs); + } else if constexpr (signType == 1) { // LS++ + fRegistry.fill(HIST("Pair/SV/MC/PromptJpsi/lspp/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/PromptJpsi/lspp/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/PromptJpsi/lspp/hDCA2Legs"), dca2legs); + } else if constexpr (signType == 2) { // LS-- + fRegistry.fill(HIST("Pair/SV/MC/PromptJpsi/lsmm/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/PromptJpsi/lsmm/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/PromptJpsi/lsmm/hDCA2Legs"), dca2legs); + } + } else { // nonprompt + if constexpr (signType == 0) { // ULS + fRegistry.fill(HIST("Pair/SV/MC/NonPromptJpsi/uls/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/NonPromptJpsi/uls/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/NonPromptJpsi/uls/hDCA2Legs"), dca2legs); + } else if constexpr (signType == 1) { // LS++ + fRegistry.fill(HIST("Pair/SV/MC/NonPromptJpsi/lspp/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/NonPromptJpsi/lspp/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/NonPromptJpsi/lspp/hDCA2Legs"), dca2legs); + } else if constexpr (signType == 2) { // LS-- + fRegistry.fill(HIST("Pair/SV/MC/NonPromptJpsi/lsmm/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/NonPromptJpsi/lsmm/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/NonPromptJpsi/lsmm/hDCA2Legs"), dca2legs); + } + } + break; + default: + break; + } // end of switch for LF + } else if (hfee_type > -1) { + switch (hfee_type) { + case static_cast(EM_HFeeType::kCe_Ce): + if constexpr (signType == 0) { // ULS + fRegistry.fill(HIST("Pair/SV/MC/c2e_c2e/uls/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/c2e_c2e/uls/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/c2e_c2e/uls/hDCA2Legs"), dca2legs); + } else if constexpr (signType == 1) { // LS++ + fRegistry.fill(HIST("Pair/SV/MC/c2e_c2e/lspp/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/c2e_c2e/lspp/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/c2e_c2e/lspp/hDCA2Legs"), dca2legs); + } else if constexpr (signType == 2) { // LS-- + fRegistry.fill(HIST("Pair/SV/MC/c2e_c2e/lsmm/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/c2e_c2e/lsmm/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/c2e_c2e/lsmm/hDCA2Legs"), dca2legs); + } + break; + case static_cast(EM_HFeeType::kBe_Be): + if constexpr (signType == 0) { // ULS + fRegistry.fill(HIST("Pair/SV/MC/b2e_b2e/uls/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/b2e_b2e/uls/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/b2e_b2e/uls/hDCA2Legs"), dca2legs); + } else if constexpr (signType == 1) { // LS++ + fRegistry.fill(HIST("Pair/SV/MC/b2e_b2e/lspp/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/b2e_b2e/lspp/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/b2e_b2e/lspp/hDCA2Legs"), dca2legs); + } else if constexpr (signType == 2) { // LS-- + fRegistry.fill(HIST("Pair/SV/MC/b2e_b2e/lsmm/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/b2e_b2e/lsmm/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/b2e_b2e/lsmm/hDCA2Legs"), dca2legs); + } + break; + case static_cast(EM_HFeeType::kBCe_BCe): + if constexpr (signType == 0) { // ULS + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2c2e/uls/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2c2e/uls/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2c2e/uls/hDCA2Legs"), dca2legs); + } else if constexpr (signType == 1) { // LS++ + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2c2e/lspp/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2c2e/lspp/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2c2e/lspp/hDCA2Legs"), dca2legs); + } else if constexpr (signType == 2) { // LS-- + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2c2e/lsmm/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2c2e/lsmm/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2c2e/lsmm/hDCA2Legs"), dca2legs); + } + break; + case static_cast(EM_HFeeType::kBCe_Be_SameB): + if constexpr (signType == 0) { // ULS + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2e_sameb/uls/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2e_sameb/uls/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2e_sameb/uls/hDCA2Legs"), dca2legs); + } else if constexpr (signType == 1) { // LS++ + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2e_sameb/lspp/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2e_sameb/lspp/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2e_sameb/lspp/hDCA2Legs"), dca2legs); + } else if constexpr (signType == 2) { // LS-- + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2e_sameb/lsmm/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2e_sameb/lsmm/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2e_sameb/lsmm/hDCA2Legs"), dca2legs); + } + break; + case static_cast(EM_HFeeType::kBCe_Be_DiffB): + if constexpr (signType == 0) { // ULS + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2e_diffb/uls/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2e_diffb/uls/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2e_diffb/uls/hDCA2Legs"), dca2legs); + } else if constexpr (signType == 1) { // LS+diff + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2e_diffb/lspp/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2e_diffb/lspp/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2e_diffb/lspp/hDCA2Legs"), dca2legs); + } else if constexpr (signType == 2) { // LS-diff + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2e_diffb/lsmm/hs"), meeAtSV, pteeAtSV, ppdl); + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2e_diffb/lsmm/hCosPA"), cpa); + fRegistry.fill(HIST("Pair/SV/MC/b2c2e_b2e_diffb/lsmm/hDCA2Legs"), dca2legs); + } + break; + + default: + break; + } // end of switch for HFee + } // end of HFee + } // end of isMC + + eeatsv.isfound = true; + eeatsv.mass = meeAtSV; + eeatsv.pt = pteeAtSV; + eeatsv.cospa = cpa; + eeatsv.dca2legs = dca2legs; + eeatsv.lxy = lxy; + eeatsv.lz = lz; + return; + } + + template + void run(TBCs const&, TCollisions const& collisions, TTracks const& tracks, TTrackAssoc const& trackIndices, TMCCollisions const&, TMCParticles const& mcParticles) + { + used_electronIds.reserve(tracks.size()); + + for (const auto& collision : collisions) { + const auto& bc = collision.template foundBC_as(); + initCCDB(bc); + fRegistry.fill(HIST("Event/hCollisionCounter"), 0); + + const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; + if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { + continue; + } + fRegistry.fill(HIST("Event/hCollisionCounter"), 1); + fillEventHistograms(collision); + + const auto& trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, collision.globalIndex()); + electronIds.reserve(trackIdsThisCollision.size()); + positronIds.reserve(trackIdsThisCollision.size()); + mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); + mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); + + for (const auto& trackId : trackIdsThisCollision) { + const auto& track = trackId.template track_as(); + if (!track.hasITS() || !track.hasTPC()) { + continue; + } + + if constexpr (isMC) { + if (!track.has_mcParticle()) { + continue; + } + const auto& mctrack = track.template mcParticle_as(); + const auto& mcCollision = mctrack.template mcCollision_as(); + if (cfgEventGeneratorType >= 0 && mcCollision.getSubGeneratorId() != cfgEventGeneratorType) { + continue; + } + if (!mctrack.has_mothers()) { + continue; + } + } + + mDcaInfoCov.set(999, 999, 999, 999, 999); + auto trackParCov = getTrackParCov(track); + trackParCov.setPID(o2::track::PID::Electron); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + float dcaXY = mDcaInfoCov.getY(); + float dcaZ = mDcaInfoCov.getZ(); + + if (isSelectedTrack(track, trackParCov, dcaXY, dcaZ) && isElectron(track)) { + if (track.sign() > 0) { // positron + positronIds.emplace_back(trackId.trackId()); + } else { // electron + electronIds.emplace_back(trackId.trackId()); + } + } + } // end of track loop for electron selection + + for (const auto& posId : positronIds) { + const auto& pos = tracks.rawIteratorAt(posId); + for (const auto& eleId : electronIds) { + const auto& ele = tracks.rawIteratorAt(eleId); + runSVFinder(collision, pos, ele, mcParticles); + runPairingAtPV(pos, ele, mcParticles); + } // end of electron loop + } // end of positron loop + + for (const auto& posId1 : positronIds) { + const auto& pos1 = tracks.rawIteratorAt(posId1); + for (const auto& posId2 : positronIds) { + const auto& pos2 = tracks.rawIteratorAt(posId2); + if (pos1.globalIndex() == pos2.globalIndex()) { + continue; + } + runSVFinder(collision, pos1, pos2, mcParticles); + runPairingAtPV(pos1, pos2, mcParticles); + } // end of positron loop + } // end of positron loop + + for (const auto& eleId1 : electronIds) { + const auto& ele1 = tracks.rawIteratorAt(eleId1); + for (const auto& eleId2 : electronIds) { + const auto& ele2 = tracks.rawIteratorAt(eleId2); + if (ele1.globalIndex() == ele2.globalIndex()) { + continue; + } + runSVFinder(collision, ele1, ele2, mcParticles); + runPairingAtPV(ele1, ele2, mcParticles); + } // end of electron loop + } // end of electron loop + + electronIds.clear(); + electronIds.shrink_to_fit(); + positronIds.clear(); + positronIds.shrink_to_fit(); + } // end of collision loop + + used_electronIds.clear(); + used_electronIds.shrink_to_fit(); + } + + SliceCache cache; + Preslice perCol = o2::aod::track::collisionId; + + Filter collisionFilter_evsel = o2::aod::evsel::sel8 == true && (cfgZvtxMin < o2::aod::collision::posZ && o2::aod::collision::posZ < cfgZvtxMax); + Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); + using FilteredMyCollisions = soa::Filtered; + + Preslice trackIndicesPerCollision = aod::track_association::collisionId; + // Partition posTracks = o2::aod::track::signed1Pt > 0.f; + // Partition negTracks = o2::aod::track::signed1Pt < 0.f; + + std::vector electronIds; + std::vector positronIds; + std::vector> used_electronIds; // pair of hTypeId and electronId + + void processMC(FilteredMyCollisions const& collisions, aod::BCsWithTimestamps const& bcs, MyTracks const& tracks, aod::TrackAssoc const& trackIndices, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) + { + run(bcs, collisions, tracks, trackIndices, mcCollisions, mcParticles); + } + PROCESS_SWITCH(studyDCAFitter, processMC, "processMC", true); +}; +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"study-dcafitter"})}; +} From fbdd9ca1e6125ccf7694cffb815eb75e2d1984e3 Mon Sep 17 00:00:00 2001 From: Stefano Cannito <143754257+scannito@users.noreply.github.com> Date: Thu, 21 Aug 2025 21:07:10 +0200 Subject: [PATCH 138/986] [PWGLF] Fix process function dNdEtaWPhiMcGen (#12678) --- .../Tasks/Strangeness/phik0shortanalysis.cxx | 186 ++++++++++-------- 1 file changed, 103 insertions(+), 83 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx b/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx index a59ea761daf..5ed80040840 100644 --- a/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx @@ -226,6 +226,7 @@ struct Phik0shortanalysis { Configurable furtherCheckonMcCollision{"furtherCheckonMcCollision", true, "Further check on MC collisions"}; Configurable filterOnGenPhi{"filterOnGenPhi", true, "Filter on MC Phi"}; Configurable filterOnRecoPhiWPDG{"filterOnRecoPhiWPDG", true, "Filter on Reco Phi with WPDG"}; + Configurable fillMcPartsForAllReco{"fillMcPartsForAllReco", false, "Fill MC particles for all associated reco collisions"}; // Configurable for event mixing Configurable cfgNoMixedEvents{"cfgNoMixedEvents", 5, "Number of mixed events per event"}; @@ -2652,118 +2653,137 @@ struct Phik0shortanalysis { PROCESS_SWITCH(Phik0shortanalysis, processdNdetaWPhiMCReco, "Process function for dN/deta values in MCReco", false); - void processdNdetaWPhiMCGen(MCCollisions::iterator const& mcCollision, soa::SmallGroups const& collisions, FilteredMCTracks const& filteredMCTracks, aod::McParticles const& mcParticles) + void processdNdetaWPhiMCGen(MCCollisions const& mcCollisions, SimCollisions const& collisions, FilteredMCTracks const& filteredMCTracks, aod::McParticles const& mcParticles) { - if (!pwglf::isINELgtNmc(mcParticles, 0, pdgDB)) - return; - if (filterOnGenPhi && !eventHasGenPhi(mcParticles)) - return; - - uint64_t numberAssocColl = 0; - std::vector zVtxs; + std::vector> collsGrouped(mcCollisions.size()); for (const auto& collision : collisions) { - if (acceptEventQA(collision, false)) { - auto filteredMCTracksThisColl = filteredMCTracks.sliceBy(preslices.perColl, collision.globalIndex()); - - Partition posFiltMCTracks = aod::track::signed1Pt > trackConfigs.cfgCutCharge; - posFiltMCTracks.bindTable(filteredMCTracksThisColl); - Partition negFiltMCTracks = aod::track::signed1Pt < trackConfigs.cfgCutCharge; - negFiltMCTracks.bindTable(filteredMCTracksThisColl); + if (!collision.has_mcCollision()) + continue; + const auto& mcCollision = collision.mcCollision_as(); + collsGrouped[mcCollision.globalIndex()].push_back(collision.globalIndex()); + } - if (filterOnRecoPhiWPDG && !eventHasRecoPhiWPDG(posFiltMCTracks, negFiltMCTracks)) - continue; + for (const auto& mcCollision : mcCollisions) { + auto mcParticlesThisMcColl = mcParticles.sliceBy(preslices.perMCColl, mcCollision.globalIndex()); - mcEventHist.fill(HIST("hGenMCRecoMultiplicityPercent"), mcCollision.centFT0M()); - mcEventHist.fill(HIST("h2GenMCRecoVertexZvsMult"), collision.posZ(), mcCollision.centFT0M()); + if (!pwglf::isINELgtNmc(mcParticlesThisMcColl, 0, pdgDB)) + return; + if (filterOnGenPhi && !eventHasGenPhi(mcParticlesThisMcColl)) + return; - zVtxs.push_back(collision.posZ()); + uint64_t numberAssocColl = 0; + std::vector zVtxs; - for (const auto& track : filteredMCTracksThisColl) { - if (trackConfigs.applyExtraPhiCuts && ((track.phi() > trackConfigs.extraPhiCuts->at(0) && track.phi() < trackConfigs.extraPhiCuts->at(1)) || - track.phi() <= trackConfigs.extraPhiCuts->at(2) || track.phi() >= trackConfigs.extraPhiCuts->at(3))) - continue; - if (!track.has_mcParticle()) - continue; + auto& collIndexesThisMcColl = collsGrouped[mcCollision.globalIndex()]; - auto mcTrack = track.mcParticle(); - if (!mcTrack.isPhysicalPrimary() || std::abs(mcTrack.eta()) > trackConfigs.etaMax) - continue; + for (const auto& collisionIndex : collIndexesThisMcColl) { + auto collision = collisions.rawIteratorAt(collisionIndex); - mcEventHist.fill(HIST("h6RecoCheckMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), kSpAll, kGlobalplusITSonly); - if (track.hasTPC()) { - mcEventHist.fill(HIST("h6RecoCheckMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), kSpAll, kGlobalonly); - } else { - mcEventHist.fill(HIST("h6RecoCheckMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), kSpAll, kITSonly); - } + if (acceptEventQA(collision, false)) { + auto filteredMCTracksThisColl = filteredMCTracks.sliceBy(preslices.perColl, collision.globalIndex()); - int pid = fromPDGToEnum(mcTrack.pdgCode()); - mcEventHist.fill(HIST("h6RecoCheckMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), pid, kGlobalplusITSonly); - } + Partition posFiltMCTracks = aod::track::signed1Pt > trackConfigs.cfgCutCharge; + posFiltMCTracks.bindTable(filteredMCTracksThisColl); + Partition negFiltMCTracks = aod::track::signed1Pt < trackConfigs.cfgCutCharge; + negFiltMCTracks.bindTable(filteredMCTracksThisColl); - for (const auto& mcParticle : mcParticles) { - if (!isGenParticleCharged(mcParticle)) + if (filterOnRecoPhiWPDG && !eventHasRecoPhiWPDG(posFiltMCTracks, negFiltMCTracks)) continue; - mcEventHist.fill(HIST("h6GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kNoGenpTVar); - if (mcParticle.pt() < trackConfigs.cMinChargedParticlePtcut) { - mcEventHist.fill(HIST("h6GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup, -10.0f * mcParticle.pt() + 2.0f); - mcEventHist.fill(HIST("h6GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown, 5.0f * mcParticle.pt() + 0.5f); - } else { - mcEventHist.fill(HIST("h6GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup); - mcEventHist.fill(HIST("h6GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown); - } + mcEventHist.fill(HIST("hGenMCRecoMultiplicityPercent"), mcCollision.centFT0M()); + mcEventHist.fill(HIST("h2GenMCRecoVertexZvsMult"), collision.posZ(), mcCollision.centFT0M()); - int pid = fromPDGToEnum(mcParticle.pdgCode()); - mcEventHist.fill(HIST("h6GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), pid, kNoGenpTVar); - } + zVtxs.push_back(collision.posZ()); - numberAssocColl++; - } - } + for (const auto& track : filteredMCTracksThisColl) { + if (trackConfigs.applyExtraPhiCuts && ((track.phi() > trackConfigs.extraPhiCuts->at(0) && track.phi() < trackConfigs.extraPhiCuts->at(1)) || + track.phi() <= trackConfigs.extraPhiCuts->at(2) || track.phi() >= trackConfigs.extraPhiCuts->at(3))) + continue; + if (!track.has_mcParticle()) + continue; - mcEventHist.fill(HIST("hGenMCMultiplicityPercent"), mcCollision.centFT0M()); + auto mcTrack = track.mcParticle(); + if (!mcTrack.isPhysicalPrimary() || std::abs(mcTrack.eta()) > trackConfigs.etaMax) + continue; - if (numberAssocColl > 0) { - float zVtxRef = zVtxs[0]; - if (zVtxs.size() > 1) { - for (size_t i = 1; i < zVtxs.size(); ++i) { - mcEventHist.fill(HIST("hSplitVertexZ"), zVtxs[i] - zVtxRef); - } - } + mcEventHist.fill(HIST("h6RecoCheckMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), kSpAll, kGlobalplusITSonly); + if (track.hasTPC()) { + mcEventHist.fill(HIST("h6RecoCheckMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), kSpAll, kGlobalonly); + } else { + mcEventHist.fill(HIST("h6RecoCheckMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), kSpAll, kITSonly); + } - mcEventHist.fill(HIST("hGenMCAssocRecoMultiplicityPercent"), mcCollision.centFT0M()); - mcEventHist.fill(HIST("h2GenMCAssocRecoVertexZvsMult"), zVtxRef, mcCollision.centFT0M()); - } + int pid = fromPDGToEnum(mcTrack.pdgCode()); + mcEventHist.fill(HIST("h6RecoCheckMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), pid, kGlobalplusITSonly); + } - for (const auto& mcParticle : mcParticles) { - if (!isGenParticleCharged(mcParticle)) - continue; + if (fillMcPartsForAllReco) { + for (const auto& mcParticle : mcParticlesThisMcColl) { + if (!isGenParticleCharged(mcParticle)) + continue; + + mcEventHist.fill(HIST("h6GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kNoGenpTVar); + if (mcParticle.pt() < trackConfigs.cMinChargedParticlePtcut) { + mcEventHist.fill(HIST("h6GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup, -10.0f * mcParticle.pt() + 2.0f); + mcEventHist.fill(HIST("h6GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown, 5.0f * mcParticle.pt() + 0.5f); + } else { + mcEventHist.fill(HIST("h6GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup); + mcEventHist.fill(HIST("h6GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown); + } - int pid = fromPDGToEnum(mcParticle.pdgCode()); + int pid = fromPDGToEnum(mcParticle.pdgCode()); + mcEventHist.fill(HIST("h6GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), pid, kNoGenpTVar); + } + } - mcEventHist.fill(HIST("h5GenMCEtaDistribution"), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kNoGenpTVar); - if (mcParticle.pt() < trackConfigs.cMinChargedParticlePtcut) { - mcEventHist.fill(HIST("h5GenMCEtaDistribution"), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup, -10.0f * mcParticle.pt() + 2.0f); - mcEventHist.fill(HIST("h5GenMCEtaDistribution"), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown, 5.0f * mcParticle.pt() + 0.5f); - } else { - mcEventHist.fill(HIST("h5GenMCEtaDistribution"), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup); - mcEventHist.fill(HIST("h5GenMCEtaDistribution"), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown); + numberAssocColl++; + } } - mcEventHist.fill(HIST("h5GenMCEtaDistribution"), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), pid, kNoGenpTVar); + + mcEventHist.fill(HIST("hGenMCMultiplicityPercent"), mcCollision.centFT0M()); if (numberAssocColl > 0) { float zVtxRef = zVtxs[0]; + if (zVtxs.size() > 1) { + for (size_t i = 1; i < zVtxs.size(); ++i) { + mcEventHist.fill(HIST("hSplitVertexZ"), zVtxs[i] - zVtxRef); + } + } + + mcEventHist.fill(HIST("hGenMCAssocRecoMultiplicityPercent"), mcCollision.centFT0M()); + mcEventHist.fill(HIST("h2GenMCAssocRecoVertexZvsMult"), zVtxRef, mcCollision.centFT0M()); + } + + for (const auto& mcParticle : mcParticlesThisMcColl) { + if (!isGenParticleCharged(mcParticle)) + continue; - mcEventHist.fill(HIST("h6GenMCEtaDistributionAssocReco"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kNoGenpTVar); + int pid = fromPDGToEnum(mcParticle.pdgCode()); + + mcEventHist.fill(HIST("h5GenMCEtaDistribution"), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kNoGenpTVar); if (mcParticle.pt() < trackConfigs.cMinChargedParticlePtcut) { - mcEventHist.fill(HIST("h6GenMCEtaDistributionAssocReco"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup, -10.0f * mcParticle.pt() + 2.0f); - mcEventHist.fill(HIST("h6GenMCEtaDistributionAssocReco"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown, 5.0f * mcParticle.pt() + 0.5f); + mcEventHist.fill(HIST("h5GenMCEtaDistribution"), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup, -10.0f * mcParticle.pt() + 2.0f); + mcEventHist.fill(HIST("h5GenMCEtaDistribution"), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown, 5.0f * mcParticle.pt() + 0.5f); } else { - mcEventHist.fill(HIST("h6GenMCEtaDistributionAssocReco"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup); - mcEventHist.fill(HIST("h6GenMCEtaDistributionAssocReco"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown); + mcEventHist.fill(HIST("h5GenMCEtaDistribution"), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup); + mcEventHist.fill(HIST("h5GenMCEtaDistribution"), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown); + } + mcEventHist.fill(HIST("h5GenMCEtaDistribution"), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), pid, kNoGenpTVar); + + if (numberAssocColl > 0) { + float zVtxRef = zVtxs[0]; + + mcEventHist.fill(HIST("h6GenMCEtaDistributionAssocReco"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kNoGenpTVar); + if (mcParticle.pt() < trackConfigs.cMinChargedParticlePtcut) { + mcEventHist.fill(HIST("h6GenMCEtaDistributionAssocReco"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup, -10.0f * mcParticle.pt() + 2.0f); + mcEventHist.fill(HIST("h6GenMCEtaDistributionAssocReco"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown, 5.0f * mcParticle.pt() + 0.5f); + } else { + mcEventHist.fill(HIST("h6GenMCEtaDistributionAssocReco"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup); + mcEventHist.fill(HIST("h6GenMCEtaDistributionAssocReco"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown); + } + mcEventHist.fill(HIST("h6GenMCEtaDistributionAssocReco"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), pid, kNoGenpTVar); } - mcEventHist.fill(HIST("h6GenMCEtaDistributionAssocReco"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), pid, kNoGenpTVar); } } } From 91bcf5f446a62b6b0388fec5b1c74ec7b50a9aca Mon Sep 17 00:00:00 2001 From: Shirajum Monira <38348689+Eloviyo@users.noreply.github.com> Date: Thu, 21 Aug 2025 21:08:28 +0200 Subject: [PATCH 139/986] [PWGCF] FemtoUniverse cascade task -- implemented strangeness TOF sigmas for cascade analysis (#12668) Co-authored-by: Shirajum Monira --- .../femtoUniverseProducerTask.cxx | 60 ++++++++++++++----- 1 file changed, 44 insertions(+), 16 deletions(-) diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx index d4cdefecf3b..37a16abc46b 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx @@ -28,6 +28,7 @@ #include "PWGHF/Core/HfHelper.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" #include "PWGLF/DataModel/LFStrangenessTables.h" #include "Common/CCDB/ctpRateFetcher.h" @@ -472,6 +473,31 @@ struct FemtoUniverseProducerTask { return mask; } + template + using hasStrangeTOF = decltype(std::declval().tofNSigmaXiLaPi()); + + /// bitmask to save strangeness TOF for cascade analysis + template + aod::femtouniverseparticle::CutContainerType PIDStrangeTOFBitmask(const CascType& casc) + { + aod::femtouniverseparticle::CutContainerType mask = 0u; + if constexpr (std::experimental::is_detected::value) { + if (casc.tofNSigmaXiLaPi() < ConfPIDBitmask.confNsigmaTOFParticleChild) + mask |= (1u); + if (casc.tofNSigmaXiLaPr() < ConfPIDBitmask.confNsigmaTOFParticleChild) + mask |= (2u); + if (casc.tofNSigmaXiPi() < ConfPIDBitmask.confNsigmaTOFParticleChild) + mask |= (4u); + if (casc.tofNSigmaOmLaPi() < ConfPIDBitmask.confNsigmaTOFParticleChild) + mask |= (8u); + if (casc.tofNSigmaOmLaPr() < ConfPIDBitmask.confNsigmaTOFParticleChild) + mask |= (16u); + if (casc.tofNSigmaOmKa() < ConfPIDBitmask.confNsigmaTOFParticleChild) + mask |= (32u); + } + return mask; + } + Zorro zorro; OutputObj zorroSummary{"zorroSummary"}; int mRunNumberZorro = 0; @@ -683,7 +709,7 @@ struct FemtoUniverseProducerTask { mRunNumber = bc.runNumber(); } - template + template void fillDebugParticle(ParticleType const& particle) { if constexpr (isTrackOrV0) { @@ -706,13 +732,15 @@ struct FemtoUniverseProducerTask { -999., -999., -999., -999., -999., -999.); // QA for phi or D0/D0bar children - } else if constexpr (isXi) { - outputDebugParts(-999., -999., -999., -999., -999., -999., -999., -999., -999., - -999., -999., -999., -999., -999., -999., -999., -999., - -999., -999., -999., -999., -999., - particle.dcacascdaughters(), particle.cascradius(), - particle.x(), particle.y(), particle.z(), - particle.mOmega()); // QA for Xi Cascades (later do the same for Omegas) + } else if constexpr (isCasc) { + if constexpr (std::experimental::is_detected::value) { + outputDebugParts(-999., -999., -999., -999., -999., -999., -999., -999., -999., + -999., -999., -999., -999., -999., -999., -999., particle.tofNSigmaXiLaPi(), + particle.tofNSigmaXiLaPr(), particle.tofNSigmaXiPi(), particle.tofNSigmaOmLaPi(), + particle.tofNSigmaOmLaPr(), particle.tofNSigmaOmKa(), + particle.dcacascdaughters(), particle.cascradius(), + particle.x(), particle.y(), particle.z(), -999.); + } } else { // LOGF(info, "isTrack0orV0: %d, isPhi: %d", isTrackOrV0, isPhiOrD0); outputDebugParts(-999., -999., -999., -999., -999., -999., -999., -999., -999., @@ -1246,8 +1274,8 @@ struct FemtoUniverseProducerTask { casc.positiveeta(), casc.positivephi(), aod::femtouniverseparticle::ParticleType::kV0Child, - 0, // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kPosCuts), - PIDBitmask(posTrackCasc), // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kPosPID), + 0, + PIDBitmask(posTrackCasc), hasTOF, childIDs, 0, @@ -1268,8 +1296,8 @@ struct FemtoUniverseProducerTask { casc.negativeeta(), casc.negativephi(), aod::femtouniverseparticle::ParticleType::kV0Child, - 0, // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kNegCuts), - PIDBitmask(negTrackCasc), // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kNegPID), + 0, + PIDBitmask(negTrackCasc), hasTOF, childIDs, 0, @@ -1291,8 +1319,8 @@ struct FemtoUniverseProducerTask { casc.bacheloreta(), casc.bachelorphi(), aod::femtouniverseparticle::ParticleType::kCascadeBachelor, - 0, // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kNegCuts), - PIDBitmask(bachTrackCasc), // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kNegPID), + 0, + PIDBitmask(bachTrackCasc), hasTOF, childIDs, 0, @@ -1308,8 +1336,8 @@ struct FemtoUniverseProducerTask { casc.eta(), casc.phi(), aod::femtouniverseparticle::ParticleType::kCascade, - 0, // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kV0), 0, + PIDStrangeTOFBitmask(casc), 0, indexCascChildID, casc.mXi(), @@ -2112,7 +2140,7 @@ struct FemtoUniverseProducerTask { aod::BCsWithTimestamps const&, soa::Filtered const& tracks, o2::aod::V0Datas const& fullV0s, - o2::aod::CascDatas const& fullCascades) + soa::Join const& fullCascades) { getMagneticFieldTesla(col.bc_as()); const auto colcheck = fillCollisions(col, tracks); From cd8d769a3211d676e6f6ab9215ee83d2eeb480a8 Mon Sep 17 00:00:00 2001 From: prottayCMT <61418725+prottayCMT@users.noreply.github.com> Date: Thu, 21 Aug 2025 23:17:46 +0200 Subject: [PATCH 140/986] [PWGLF] few more QA and a small check (#12659) Co-authored-by: Prottay Das --- PWGLF/Tasks/Strangeness/lambdapolsp.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Strangeness/lambdapolsp.cxx b/PWGLF/Tasks/Strangeness/lambdapolsp.cxx index 1399d4d293c..4846108dc2f 100644 --- a/PWGLF/Tasks/Strangeness/lambdapolsp.cxx +++ b/PWGLF/Tasks/Strangeness/lambdapolsp.cxx @@ -1470,6 +1470,15 @@ struct lambdapolsp { } } } else { + + int binxwgt; + double wgtvalue; + if (useyldwgt) { + binxwgt = hwgtAL->GetXaxis()->FindBin(v0.pt()); + wgtvalue = hwgtAL->GetBinContent(binxwgt); + } else { + wgtvalue = 1.0; + } if (analyzeLambda && LambdaTag) { Lambda = Proton + AntiPion; tagb = 0; @@ -1488,7 +1497,7 @@ struct lambdapolsp { int biny = accprofileAL->GetYaxis()->FindBin(v0.pt()); double acvalue = accprofileAL->GetBinContent(binx, biny); // double acvalue = 1.0; - fillHistograms(taga, tagb, AntiLambda, AntiProton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mAntiLambda(), v0.pt(), v0.eta(), acvalue, 1.0); + fillHistograms(taga, tagb, AntiLambda, AntiProton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mAntiLambda(), v0.pt(), v0.eta(), acvalue, wgtvalue); } } } From 55810ad738f609430cb9dfe042748fa576ac8334 Mon Sep 17 00:00:00 2001 From: tutripat <73981392+tutripat@users.noreply.github.com> Date: Fri, 22 Aug 2025 00:22:02 +0100 Subject: [PATCH 141/986] [PWGLF] Update to include DCA cut (#12672) Co-authored-by: ALICE Action Bot --- .../GlobalEventProperties/dndeta-mft-pp.cxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/PWGLF/Tasks/GlobalEventProperties/dndeta-mft-pp.cxx b/PWGLF/Tasks/GlobalEventProperties/dndeta-mft-pp.cxx index c90a3d89474..a37b4f8c368 100644 --- a/PWGLF/Tasks/GlobalEventProperties/dndeta-mft-pp.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/dndeta-mft-pp.cxx @@ -35,6 +35,7 @@ #include "TFile.h" +#include #include #include #include @@ -91,6 +92,7 @@ struct PseudorapidityDensityMFT { "max allowed Z difference for reconstructed collisions (cm)"}; Configurable usePhiCut{"usePhiCut", true, "use azimuthal angle cut"}; + Configurable useDCAxyCut{"useDCAxyCut", false, "use DCAxy cut"}; Configurable cfgPhiCut{"cfgPhiCut", 0.1f, "Cut on azimuthal angle of MFT tracks"}; Configurable cfgPhiCut1{"cfgPhiCut1", 0.0f, @@ -108,6 +110,7 @@ struct PseudorapidityDensityMFT { Configurable cfgnEta2{"cfgnEta2", -1.0f, "Cut on eta1"}; Configurable cfgChi2NDFMax{"cfgChi2NDFMax", 2000.0f, "Max allowed chi2/NDF for MFT tracks"}; + Configurable maxDCAxy{"maxDCAxy", 2.0f, "Cut on dcaXY"}; HistogramRegistry registry{ "registry", @@ -588,6 +591,11 @@ struct PseudorapidityDensityMFT { if ((phi <= 0.02) || ((phi >= 3.10) && (phi <= 3.23)) || (phi >= 6.21)) continue; } + float dcaxy_cut = retrack.bestDCAXY(); + if (useDCAxyCut) { + if (dcaxy_cut > maxDCAxy) + continue; + } if ((cfgnEta1 < track.eta()) && (track.eta() < cfgnEta2) && track.nClusters() >= cfgnCluster && retrack.ambDegree() > 0 && chi2ndf < cfgChi2NDFMax && (phi > cfgPhiCut1 && phi < cfgPhiCut2)) { registry.fill(HIST("Tracks/2Danalysis/EtaZvtx"), track.eta(), z); } @@ -628,6 +636,11 @@ struct PseudorapidityDensityMFT { if ((phi <= 0.02) || ((phi >= 3.10) && (phi <= 3.23)) || (phi >= 6.21)) continue; } + float dcaxy_cut = retrack.bestDCAXY(); + if (useDCAxyCut) { + if (dcaxy_cut > maxDCAxy) + continue; + } if ((cfgnEta1 < track.eta()) && (track.eta() < cfgnEta2) && track.nClusters() >= cfgnCluster && retrack.ambDegree() > 0 && chi2ndf < cfgChi2NDFMax && (phi > cfgPhiCut1 && phi < cfgPhiCut2)) { registry.fill(HIST("Tracks/Control/Chi2NDF"), chi2ndf); registry.fill(HIST("Tracks/2Danalysis/EtaZvtx_sel8"), track.eta(), z); @@ -646,12 +659,17 @@ struct PseudorapidityDensityMFT { float ndf = std::max(2.0f * track.nClusters() - 5.0f, 1.0f); float chi2ndf = track.chi2() / ndf; float phi = track.phi(); + float dcaxy_cut = retrack.bestDCAXY(); o2::math_utils::bringTo02Pi(phi); if ((cfgnEta1 < track.eta()) && (track.eta() < cfgnEta2) && track.nClusters() >= cfgnCluster && chi2ndf < cfgChi2NDFMax && (phi > cfgPhiCut1 && phi < cfgPhiCut2)) { if (usePhiCut) { if ((phi <= 0.02) || ((phi >= 3.10) && (phi <= 3.23)) || (phi >= 6.21)) continue; } + if (useDCAxyCut) { + if (dcaxy_cut > maxDCAxy) + continue; + } registry.fill(HIST("TracksEtaZvtx"), track.eta(), z); if (midtracks.size() > 0 && retrack.ambDegree() > 0) { registry.fill(HIST("Tracks/EtaZvtx_gt0"), track.eta(), z); From 8e59519d006fea49eb6976c3efd9d5ef595b0c81 Mon Sep 17 00:00:00 2001 From: abmodak <67369858+abmodak@users.noreply.github.com> Date: Thu, 21 Aug 2025 18:26:48 -0500 Subject: [PATCH 142/986] [PWGLF] Add event and signal loss corrections (#12669) Co-authored-by: ALICE Action Bot --- .../heavyionMultiplicity.cxx | 91 +++++++++++++++++-- 1 file changed, 83 insertions(+), 8 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx b/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx index 6637d6f2dcd..40a0ebbffd4 100644 --- a/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx @@ -147,6 +147,7 @@ struct HeavyionMultiplicity { ConfigurableAxis centralityBinning{"centralityBinning", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, ""}; ConfigurableAxis occupancyBin{"occupancyBin", {VARIABLE_WIDTH, 0, 500, 1000, 2000, 5000, 10000}, ""}; ConfigurableAxis centBinGen{"centBinGen", {VARIABLE_WIDTH, 0, 500, 1000, 2000, 5000, 10000}, ""}; + ConfigurableAxis binsImpactPar{"binsImpactPar", {VARIABLE_WIDTH, 0.0, 3.00065, 4.28798, 6.14552, 7.6196, 8.90942, 10.0897, 11.2002, 12.2709, 13.3167, 14.4173, 23.2518}, "Binning of the impact parameter axis"}; Configurable isApplySameBunchPileup{"isApplySameBunchPileup", true, "Enable SameBunchPileup cut"}; Configurable isApplyGoodZvtxFT0vsPV{"isApplyGoodZvtxFT0vsPV", true, "Enable GoodZvtxFT0vsPV cut"}; @@ -178,6 +179,7 @@ struct HeavyionMultiplicity { AxisSpec axisPt = {ptHistBin, "pT", "pTAxis"}; AxisSpec axisOccupancy = {occupancyBin, "occupancy", "OccupancyAxis"}; AxisSpec axisCentBinGen = {centBinGen, "GenCentrality", "CentGenAxis"}; + AxisSpec impactParAxis = {binsImpactPar, "Impact Parameter"}; histos.add("EventHist", "EventHist", kTH1D, {axisEvent}, false); histos.add("VtxZHist", "VtxZHist", kTH1D, {axisVtxZ}, false); @@ -269,6 +271,21 @@ struct HeavyionMultiplicity { histos.add("mult10_vs_FT0C", "mult10_vs_FT0C", kTH2F, {axisMult, axisCentBinGen}, true); histos.add("mult10_vs_FT0A", "mult10_vs_FT0A", kTH2F, {axisMult, axisCentBinGen}, true); } + + if (doprocessEvtLossSigLossMC) { + histos.add("MCEventHist", "MCEventHist", kTH1F, {axisEvent}, false); + auto hstat = histos.get(HIST("MCEventHist")); + auto* x = hstat->GetXaxis(); + x->SetBinLabel(1, "All MC events"); + x->SetBinLabel(2, "MC events with atleast one reco event"); + histos.add("hImpactParameterGen", "Impact parameter of generated MC events", kTH1F, {impactParAxis}); + histos.add("hImpactParameterRec", "Impact parameter of selected MC events", kTH1F, {impactParAxis}); + histos.add("hImpactParvsCentrRec", "Impact parameter of selected MC events vs centrality", kTH2F, {axisCent, impactParAxis}); + histos.add("hgendndetaBeforeEvtSel", "Eta of all generated particles", kTH1F, {axisEta}); + histos.add("hgendndetaAfterEvtSel", "Eta of generated particles after EvtSel", kTH1F, {axisEta}); + histos.add("hgendndetaVscentBeforeEvtSel", "hgendndetaBeforeEvtSel vs centrality", kTH2F, {axisEta, impactParAxis}); + histos.add("hgendndetaVscentAfterEvtSel", "hgendndetaAfterEvtSel vs centrality", kTH2F, {axisEta, impactParAxis}); + } } template @@ -416,7 +433,6 @@ struct HeavyionMultiplicity { } } } - PROCESS_SWITCH(HeavyionMultiplicity, processData, "process data CentFT0C", false); void processCorrelation(CollisionDataTable::iterator const& cols, FilTrackDataTable const& tracks) { @@ -441,7 +457,6 @@ struct HeavyionMultiplicity { histos.fill(HIST("GlobalMult_vs_FV0A"), nchTracks, cols.multFV0A()); histos.fill(HIST("NPVtracks_vs_GlobalMult"), cols.multNTracksPV(), nchTracks); } - PROCESS_SWITCH(HeavyionMultiplicity, processCorrelation, "do correlation study in data", false); void processMonteCarlo(CollisionMCTrueTable::iterator const&, CollisionMCRecTable const& RecCols, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks) { @@ -541,7 +556,6 @@ struct HeavyionMultiplicity { } // track (mcgen) loop } // collision loop } - PROCESS_SWITCH(HeavyionMultiplicity, processMonteCarlo, "process MC CentFT0C", false); void processMCpTefficiency(CollisionMCTrueTable::iterator const&, CollisionMCRecTable const& RecCols, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks) { @@ -589,7 +603,6 @@ struct HeavyionMultiplicity { } } } - PROCESS_SWITCH(HeavyionMultiplicity, processMCpTefficiency, "process MC pTefficiency", false); void processMCcheckFakeTracks(CollisionMCTrueTable::iterator const&, CollisionMCRecTable const& RecCols, FilTrackMCRecTable const& RecTracks) { @@ -628,7 +641,6 @@ struct HeavyionMultiplicity { } } } - PROCESS_SWITCH(HeavyionMultiplicity, processMCcheckFakeTracks, "Check Fake tracks", false); void processStrangeYield(CollisionDataTable::iterator const& cols, V0TrackCandidates const&, aod::V0Datas const& v0data) { @@ -671,7 +683,6 @@ struct HeavyionMultiplicity { histos.fill(HIST("AntiLambdaCentEtaMass"), selColCent(cols), v0track.eta(), v0track.mAntiLambda()); } } - PROCESS_SWITCH(HeavyionMultiplicity, processStrangeYield, "Strange particle yield", false); void processppData(ColDataTablepp::iterator const& cols, FilTrackDataTable const& tracks) { @@ -696,7 +707,6 @@ struct HeavyionMultiplicity { } } // track loop } - PROCESS_SWITCH(HeavyionMultiplicity, processppData, "process pp data", false); void processppMonteCarlo(CollisionMCTrueTable::iterator const&, ColMCRecTablepp const& RecCols, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks) { @@ -796,7 +806,6 @@ struct HeavyionMultiplicity { } // track (mcgen) loop } // collision loop } - PROCESS_SWITCH(HeavyionMultiplicity, processppMonteCarlo, "process pp MC", false); void processGen(aod::McCollisions::iterator const&, aod::McParticles const& GenParticles) { @@ -836,7 +845,73 @@ struct HeavyionMultiplicity { histos.fill(HIST("dndeta10_vs_FT0C"), particle.eta(), multFT0C); } } + + void processEvtLossSigLossMC(soa::Join::iterator const& mcCollision, CollisionMCRecTable const& RecCols, TrackMCTrueTable const& GenParticles) + { + if (isApplyInelgt0 && !mcCollision.isInelGt0()) { + return; + } + if (std::abs(mcCollision.posZ()) >= vtxRange) { + return; + } + // All generated events + histos.fill(HIST("MCEventHist"), 1); + histos.fill(HIST("hImpactParameterGen"), mcCollision.impactParameter()); + + bool atLeastOne = false; + auto centrality = -999.; + auto numcontributors = -999; + for (const auto& RecCol : RecCols) { + if (!isEventSelected(RecCol)) { + continue; + } + if (std::abs(RecCol.posZ()) >= vtxRange) { + continue; + } + if (RecCol.numContrib() <= numcontributors) { + continue; + } else { + numcontributors = RecCol.numContrib(); + } + centrality = selColCent(RecCol); + atLeastOne = true; + } + + // Generated events with at least one reconstructed collision (event loss estimation) + if (atLeastOne) { + histos.fill(HIST("MCEventHist"), 2); + histos.fill(HIST("hImpactParameterRec"), mcCollision.impactParameter()); + histos.fill(HIST("hImpactParvsCentrRec"), centrality, mcCollision.impactParameter()); + } + + for (const auto& particle : GenParticles) { + + if (!isGenTrackSelected(particle)) { + continue; + } + + // All generated particles + histos.fill(HIST("hgendndetaBeforeEvtSel"), particle.eta()); + histos.fill(HIST("hgendndetaVscentBeforeEvtSel"), particle.eta(), mcCollision.impactParameter()); + + if (atLeastOne) { + // All generated particles with at least one reconstructed collision (signal loss estimation) + histos.fill(HIST("hgendndetaAfterEvtSel"), particle.eta()); + histos.fill(HIST("hgendndetaVscentAfterEvtSel"), particle.eta(), mcCollision.impactParameter()); + } + } + } + + PROCESS_SWITCH(HeavyionMultiplicity, processData, "process data CentFT0C", false); + PROCESS_SWITCH(HeavyionMultiplicity, processCorrelation, "do correlation study in data", false); + PROCESS_SWITCH(HeavyionMultiplicity, processMonteCarlo, "process MC CentFT0C", false); + PROCESS_SWITCH(HeavyionMultiplicity, processMCpTefficiency, "process MC pTefficiency", false); + PROCESS_SWITCH(HeavyionMultiplicity, processMCcheckFakeTracks, "Check Fake tracks", false); + PROCESS_SWITCH(HeavyionMultiplicity, processStrangeYield, "Strange particle yield", false); + PROCESS_SWITCH(HeavyionMultiplicity, processppData, "process pp data", false); + PROCESS_SWITCH(HeavyionMultiplicity, processppMonteCarlo, "process pp MC", false); PROCESS_SWITCH(HeavyionMultiplicity, processGen, "process pure MC gen", false); + PROCESS_SWITCH(HeavyionMultiplicity, processEvtLossSigLossMC, "process Signal Loss, Event Loss", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From c7cc561f18a3b0903335c4047bbcfc11831a4b7b Mon Sep 17 00:00:00 2001 From: Ionut Cristian Arsene Date: Fri, 22 Aug 2025 03:35:42 +0200 Subject: [PATCH 143/986] [PWGDQ] Implemented a postcalibration scheme for electrons in Pb-Pb collisions, and some cleanup (#12679) Co-authored-by: Ionut Cristian Arsene Co-authored-by: ALICE Action Bot --- PWGDQ/Core/CutsLibrary.cxx | 49 ------ PWGDQ/Core/VarManager.cxx | 152 ++++++++++++++++++- PWGDQ/Core/VarManager.h | 118 ++++---------- PWGDQ/TableProducer/tableMaker_withAssoc.cxx | 12 ++ PWGDQ/Tasks/tableReader_withAssoc.cxx | 8 + 5 files changed, 193 insertions(+), 146 deletions(-) diff --git a/PWGDQ/Core/CutsLibrary.cxx b/PWGDQ/Core/CutsLibrary.cxx index 20a4c7c548f..ee152f11b6b 100644 --- a/PWGDQ/Core/CutsLibrary.cxx +++ b/PWGDQ/Core/CutsLibrary.cxx @@ -1476,34 +1476,6 @@ AnalysisCompositeCut* o2::aod::dqcuts::GetCompositeCut(const char* cutName) } } - //--------------------------------------------------------------------------------------- - // NOTE: Below there are several TPC pid cuts used for studies of the dE/dx degradation - // and its impact on the high lumi pp quarkonia triggers - // To be removed when not needed anymore - if (!nameStr.compare("jpsiPID1Randomized")) { - cut->AddCut(GetAnalysisCut("jpsiStandardKine")); // standard kine cuts usually are applied via Filter in the task - cut->AddCut(GetAnalysisCut("electronStandardQuality")); - cut->AddCut(GetAnalysisCut("standardPrimaryTrack")); - cut->AddCut(GetAnalysisCut("electronPID1randomized")); - return cut; - } - - if (!nameStr.compare("jpsiPID2Randomized")) { - cut->AddCut(GetAnalysisCut("jpsiStandardKine")); - cut->AddCut(GetAnalysisCut("electronStandardQuality")); - cut->AddCut(GetAnalysisCut("standardPrimaryTrack")); - cut->AddCut(GetAnalysisCut("electronPID2randomized")); - return cut; - } - - if (!nameStr.compare("jpsiPIDnsigmaRandomized")) { - cut->AddCut(GetAnalysisCut("jpsiStandardKine")); - cut->AddCut(GetAnalysisCut("electronStandardQuality")); - cut->AddCut(GetAnalysisCut("standardPrimaryTrack")); - cut->AddCut(GetAnalysisCut("electronPIDnsigmaRandomized")); - return cut; - } - if (!nameStr.compare("jpsiPIDworseRes")) { cut->AddCut(GetAnalysisCut("jpsiStandardKine")); cut->AddCut(GetAnalysisCut("electronStandardQuality")); @@ -5136,13 +5108,6 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName) return cut; } - if (!nameStr.compare("electronPID1randomized")) { - cutLow1->SetParameters(130., -40.0); - cut->AddCut(VarManager::kTPCsignalRandomized, 70., 100.); - cut->AddCut(VarManager::kTPCsignalRandomized, cutLow1, 100.0, false, VarManager::kPin, 0.5, 3.0); - return cut; - } - if (!nameStr.compare("electronPID2")) { cutLow1->SetParameters(130., -40.0); cut->AddCut(VarManager::kTPCsignal, 73., 100.); @@ -5157,13 +5122,6 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName) return cut; } - if (!nameStr.compare("electronPID2randomized")) { - cutLow1->SetParameters(130., -40.0); - cut->AddCut(VarManager::kTPCsignalRandomized, 73., 100.); - cut->AddCut(VarManager::kTPCsignalRandomized, cutLow1, 100.0, false, VarManager::kPin, 0.5, 3.0); - return cut; - } - if (!nameStr.compare("electronPIDnsigma")) { cut->AddCut(VarManager::kTPCnSigmaEl, -3.0, 3.0); cut->AddCut(VarManager::kTPCnSigmaPr, 3.0, 3000.0); @@ -5645,13 +5603,6 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName) return cut; } - if (!nameStr.compare("electronPIDnsigmaRandomized")) { - cut->AddCut(VarManager::kTPCnSigmaElRandomized, -3.0, 3.0); - cut->AddCut(VarManager::kTPCnSigmaPrRandomized, 3.0, 3000.0); - cut->AddCut(VarManager::kTPCnSigmaPiRandomized, 3.0, 3000.0); - return cut; - } - if (!nameStr.compare("electronPIDworseRes")) { cut->AddCut(VarManager::kTPCnSigmaEl, -3.0, 3.0); cut->AddCut(VarManager::kTPCnSigmaPr, 3.0 * 0.8, 3000.0); // emulates a 20% degradation in PID resolution diff --git a/PWGDQ/Core/VarManager.cxx b/PWGDQ/Core/VarManager.cxx index 4bb8c419ad7..eb263b73373 100644 --- a/PWGDQ/Core/VarManager.cxx +++ b/PWGDQ/Core/VarManager.cxx @@ -45,6 +45,8 @@ o2::vertexing::FwdDCAFitterN<3> VarManager::fgFitterThreeProngFwd; o2::globaltracking::MatchGlobalFwd VarManager::mMatching; std::map VarManager::fgCalibs; bool VarManager::fgRunTPCPostCalibration[4] = {false, false, false, false}; +int VarManager::fgCalibrationType = 0; // 0 - no calibration, 1 - calibration vs (TPCncls,pIN,eta) typically for pp, 2 - calibration vs (eta,nPV,nLong,tLong) typically for PbPb +bool VarManager::fgUseInterpolatedCalibration = true; // use interpolated calibration histograms (default: true) //__________________________________________________________________ VarManager::VarManager() : TObject() @@ -209,6 +211,148 @@ float VarManager::calculateCosPA(KFParticle kfp, KFParticle PV) { return cpaFromKF(kfp, PV); } + +//__________________________________________________________________ +double VarManager::ComputePIDcalibration(int species, double nSigmaValue) +{ + // species: 0 - electron, 1 - pion, 2 - kaon, 3 - proton + // Depending on the PID calibration type, we use different types of calibration histograms + + if (fgCalibrationType == 1) { + // get the calibration histograms + CalibObjects calibMean, calibSigma; + switch (species) { + case 0: + calibMean = kTPCElectronMean; + calibSigma = kTPCElectronSigma; + break; + case 1: + calibMean = kTPCPionMean; + calibSigma = kTPCPionSigma; + break; + case 2: + calibMean = kTPCKaonMean; + calibSigma = kTPCKaonSigma; + break; + case 3: + calibMean = kTPCProtonMean; + calibSigma = kTPCProtonSigma; + break; + default: + LOG(fatal) << "Invalid species for PID calibration: " << species; + return -999.0; // Return zero if species is invalid + }; + + TH3F* calibMeanHist = reinterpret_cast(fgCalibs[calibMean]); + TH3F* calibSigmaHist = reinterpret_cast(fgCalibs[calibSigma]); + if (!calibMeanHist || !calibSigmaHist) { + LOG(fatal) << "Calibration histograms not found for species: " << species; + return -999.0; // Return zero if histograms are not found + } + + // Get the bin indices for the calibration histograms + int binTPCncls = calibMeanHist->GetXaxis()->FindBin(fgValues[kTPCncls]); + binTPCncls = (binTPCncls == 0 ? 1 : binTPCncls); + binTPCncls = (binTPCncls > calibMeanHist->GetXaxis()->GetNbins() ? calibMeanHist->GetXaxis()->GetNbins() : binTPCncls); + int binPin = calibMeanHist->GetYaxis()->FindBin(fgValues[kPin]); + binPin = (binPin == 0 ? 1 : binPin); + binPin = (binPin > calibMeanHist->GetYaxis()->GetNbins() ? calibMeanHist->GetYaxis()->GetNbins() : binPin); + int binEta = calibMeanHist->GetZaxis()->FindBin(fgValues[kEta]); + binEta = (binEta == 0 ? 1 : binEta); + binEta = (binEta > calibMeanHist->GetZaxis()->GetNbins() ? calibMeanHist->GetZaxis()->GetNbins() : binEta); + + double mean = calibMeanHist->GetBinContent(binTPCncls, binPin, binEta); + double sigma = calibSigmaHist->GetBinContent(binTPCncls, binPin, binEta); + return (nSigmaValue - mean) / sigma; // Return the calibrated nSigma value + } else if (fgCalibrationType == 2) { + // get the calibration histograms + CalibObjects calibMean, calibSigma, calibStatus; + switch (species) { + case 0: + calibMean = kTPCElectronMean; + calibSigma = kTPCElectronSigma; + calibStatus = kTPCElectronStatus; + break; + case 1: + calibMean = kTPCPionMean; + calibSigma = kTPCPionSigma; + calibStatus = kTPCPionStatus; + break; + case 2: + calibMean = kTPCKaonMean; + calibSigma = kTPCKaonSigma; + calibStatus = kTPCKaonStatus; + break; + case 3: + calibMean = kTPCProtonMean; + calibSigma = kTPCProtonSigma; + calibStatus = kTPCProtonStatus; + break; + default: + LOG(fatal) << "Invalid species for PID calibration: " << species; + return -999.0; // Return zero if species is invalid + }; + + THnF* calibMeanHist = reinterpret_cast(fgCalibs[calibMean]); + THnF* calibSigmaHist = reinterpret_cast(fgCalibs[calibSigma]); + THnF* calibStatusHist = reinterpret_cast(fgCalibs[calibStatus]); + if (!calibMeanHist || !calibSigmaHist || !calibStatusHist) { + LOG(fatal) << "Calibration histograms not found for species: " << species; + return -999.0; // Return zero if histograms are not found + } + + // Get the bin indices for the calibration histograms + int binEta = calibMeanHist->GetAxis(0)->FindBin(fgValues[kEta]); + binEta = (binEta == 0 ? 1 : binEta); + binEta = (binEta > calibMeanHist->GetAxis(0)->GetNbins() ? calibMeanHist->GetAxis(0)->GetNbins() : binEta); + int binNpv = calibMeanHist->GetAxis(1)->FindBin(fgValues[kVtxNcontribReal]); + binNpv = (binNpv == 0 ? 1 : binNpv); + binNpv = (binNpv > calibMeanHist->GetAxis(1)->GetNbins() ? calibMeanHist->GetAxis(1)->GetNbins() : binNpv); + int binNlong = calibMeanHist->GetAxis(2)->FindBin(fgValues[kNTPCcontribLongA]); + binNlong = (binNlong == 0 ? 1 : binNlong); + binNlong = (binNlong > calibMeanHist->GetAxis(2)->GetNbins() ? calibMeanHist->GetAxis(2)->GetNbins() : binNlong); + int binTlong = calibMeanHist->GetAxis(3)->FindBin(fgValues[kNTPCmedianTimeLongA]); + binTlong = (binTlong == 0 ? 1 : binTlong); + binTlong = (binTlong > calibMeanHist->GetAxis(3)->GetNbins() ? calibMeanHist->GetAxis(3)->GetNbins() : binTlong); + + int bin[4] = {binEta, binNpv, binNlong, binTlong}; + int status = static_cast(calibStatusHist->GetBinContent(bin)); + double mean = calibMeanHist->GetBinContent(bin); + double sigma = calibSigmaHist->GetBinContent(bin); + switch (status) { + case 0: + // good calibration, return the calibrated nSigma value + return (nSigmaValue - mean) / sigma; + break; + case 1: + // calibration not valid, return the original nSigma value + return nSigmaValue; + break; + case 2: // calibration constant has poor stat uncertainty, consider the user option for what to do + case 3: + // calibration constants have been interpolated + if (fgUseInterpolatedCalibration) { + return (nSigmaValue - mean) / sigma; + } else { + // return the original nSigma value + return nSigmaValue; + } + break; + case 4: + // calibration constants interpolation failed, return the original nSigma value + return nSigmaValue; + break; + default: + return nSigmaValue; // unknown status, return the original nSigma value + break; + }; + } else { + // unknown calibration type, return the original nSigma value + LOG(fatal) << "Unknown calibration type: " << fgCalibrationType; + return nSigmaValue; // Return the original nSigma value + } +} + //__________________________________________________________________ void VarManager::SetDefaultVarNames() { @@ -1451,8 +1595,6 @@ void VarManager::SetDefaultVarNames() fgVarNamesMap["kTPCnCRoverFindCls"] = kTPCnCRoverFindCls; fgVarNamesMap["kTPCchi2"] = kTPCchi2; fgVarNamesMap["kTPCsignal"] = kTPCsignal; - fgVarNamesMap["kTPCsignalRandomized"] = kTPCsignalRandomized; - fgVarNamesMap["kTPCsignalRandomizedDelta"] = kTPCsignalRandomizedDelta; fgVarNamesMap["kPhiTPCOuter"] = kPhiTPCOuter; fgVarNamesMap["kTrackIsInsideTPCModule"] = kTrackIsInsideTPCModule; fgVarNamesMap["kTRDsignal"] = kTRDsignal; @@ -1476,20 +1618,14 @@ void VarManager::SetDefaultVarNames() fgVarNamesMap["kTrackCTglTgl"] = kTrackCTglTgl; fgVarNamesMap["kTrackC1Pt21Pt2"] = kTrackC1Pt21Pt2; fgVarNamesMap["kTPCnSigmaEl"] = kTPCnSigmaEl; - fgVarNamesMap["kTPCnSigmaElRandomized"] = kTPCnSigmaElRandomized; - fgVarNamesMap["kTPCnSigmaElRandomizedDelta"] = kTPCnSigmaElRandomizedDelta; fgVarNamesMap["kTPCnSigmaMu"] = kTPCnSigmaMu; fgVarNamesMap["kTPCnSigmaPi"] = kTPCnSigmaPi; - fgVarNamesMap["kTPCnSigmaPiRandomized"] = kTPCnSigmaPiRandomized; - fgVarNamesMap["kTPCnSigmaPiRandomizedDelta"] = kTPCnSigmaPiRandomizedDelta; fgVarNamesMap["kTPCnSigmaKa"] = kTPCnSigmaKa; fgVarNamesMap["kTPCnSigmaPr"] = kTPCnSigmaPr; fgVarNamesMap["kTPCnSigmaEl_Corr"] = kTPCnSigmaEl_Corr; fgVarNamesMap["kTPCnSigmaPi_Corr"] = kTPCnSigmaPi_Corr; fgVarNamesMap["kTPCnSigmaKa_Corr"] = kTPCnSigmaKa_Corr; fgVarNamesMap["kTPCnSigmaPr_Corr"] = kTPCnSigmaPr_Corr; - fgVarNamesMap["kTPCnSigmaPrRandomized"] = kTPCnSigmaPrRandomized; - fgVarNamesMap["kTPCnSigmaPrRandomizedDelta"] = kTPCnSigmaPrRandomizedDelta; fgVarNamesMap["kTOFnSigmaEl"] = kTOFnSigmaEl; fgVarNamesMap["kTOFnSigmaMu"] = kTOFnSigmaMu; fgVarNamesMap["kTOFnSigmaPi"] = kTOFnSigmaPi; diff --git a/PWGDQ/Core/VarManager.h b/PWGDQ/Core/VarManager.h index d49e71677da..230a899d807 100644 --- a/PWGDQ/Core/VarManager.h +++ b/PWGDQ/Core/VarManager.h @@ -50,6 +50,7 @@ #include "Math/VectorUtil.h" #include "TGeoGlobalMagField.h" #include "TH3F.h" +#include "THn.h" #include "TRandom.h" #include #include @@ -506,8 +507,6 @@ class VarManager : public TObject kTPCnCRoverFindCls, kTPCchi2, kTPCsignal, - kTPCsignalRandomized, - kTPCsignalRandomizedDelta, kPhiTPCOuter, kTrackIsInsideTPCModule, kTRDsignal, @@ -531,20 +530,14 @@ class VarManager : public TObject kTrackCTglTgl, kTrackC1Pt21Pt2, kTPCnSigmaEl, - kTPCnSigmaElRandomized, - kTPCnSigmaElRandomizedDelta, kTPCnSigmaMu, kTPCnSigmaPi, - kTPCnSigmaPiRandomized, - kTPCnSigmaPiRandomizedDelta, kTPCnSigmaKa, kTPCnSigmaPr, kTPCnSigmaEl_Corr, kTPCnSigmaPi_Corr, kTPCnSigmaKa_Corr, kTPCnSigmaPr_Corr, - kTPCnSigmaPrRandomized, - kTPCnSigmaPrRandomizedDelta, kTOFnSigmaEl, kTOFnSigmaMu, kTOFnSigmaPi, @@ -866,12 +859,16 @@ class VarManager : public TObject enum CalibObjects { kTPCElectronMean = 0, kTPCElectronSigma, + kTPCElectronStatus, kTPCPionMean, kTPCPionSigma, + kTPCPionStatus, kTPCKaonMean, kTPCKaonSigma, + kTPCKaonStatus, kTPCProtonMean, kTPCProtonSigma, + kTPCProtonStatus, kNCalibObjects }; @@ -1156,6 +1153,17 @@ class VarManager : public TObject fgUsedVars[kTPCnSigmaPr_Corr] = true; } } + + static void SetCalibrationType(int type, bool useInterpolation = true) + { + if (type < 0 || type > 2) { + LOG(fatal) << "Invalid calibration type. Must be 0, 1, or 2."; + } + fgCalibrationType = type; + fgUseInterpolatedCalibration = useInterpolation; + } + static double ComputePIDcalibration(int species, double nSigmaValue); + static TObject* GetCalibrationObject(CalibObjects calib) { auto obj = fgCalibs.find(calib); @@ -1231,11 +1239,13 @@ class VarManager : public TObject static std::map fgCalibs; // map of calibration histograms static bool fgRunTPCPostCalibration[4]; // 0-electron, 1-pion, 2-kaon, 3-proton + static int fgCalibrationType; // 0 - no calibration, 1 - calibration vs (TPCncls,pIN,eta) typically for pp, 2 - calibration vs (eta,nPV,nLong,tLong) typically for PbPb + static bool fgUseInterpolatedCalibration; // use interpolated calibration histograms (default: true) VarManager& operator=(const VarManager& c); VarManager(const VarManager& c); - ClassDef(VarManager, 3); + ClassDef(VarManager, 4); }; template @@ -2434,92 +2444,38 @@ void VarManager::FillTrack(T const& track, float* values) } // compute TPC postcalibrated electron nsigma based on calibration histograms from CCDB if (fgUsedVars[kTPCnSigmaEl_Corr] && fgRunTPCPostCalibration[0]) { - TH3F* calibMean = reinterpret_cast(fgCalibs[kTPCElectronMean]); - TH3F* calibSigma = reinterpret_cast(fgCalibs[kTPCElectronSigma]); - - int binTPCncls = calibMean->GetXaxis()->FindBin(values[kTPCncls]); - binTPCncls = (binTPCncls == 0 ? 1 : binTPCncls); - binTPCncls = (binTPCncls > calibMean->GetXaxis()->GetNbins() ? calibMean->GetXaxis()->GetNbins() : binTPCncls); - int binPin = calibMean->GetYaxis()->FindBin(values[kPin]); - binPin = (binPin == 0 ? 1 : binPin); - binPin = (binPin > calibMean->GetYaxis()->GetNbins() ? calibMean->GetYaxis()->GetNbins() : binPin); - int binEta = calibMean->GetZaxis()->FindBin(values[kEta]); - binEta = (binEta == 0 ? 1 : binEta); - binEta = (binEta > calibMean->GetZaxis()->GetNbins() ? calibMean->GetZaxis()->GetNbins() : binEta); - - double mean = calibMean->GetBinContent(binTPCncls, binPin, binEta); - double width = calibSigma->GetBinContent(binTPCncls, binPin, binEta); if (!isTPCCalibrated) { - values[kTPCnSigmaEl_Corr] = (values[kTPCnSigmaEl] - mean) / width; + values[kTPCnSigmaEl_Corr] = ComputePIDcalibration(0, values[kTPCnSigmaEl]); } else { + LOG(fatal) << "TPC PID postcalibration is configured but the tracks are already postcalibrated. This is not allowed. Please check your configuration."; values[kTPCnSigmaEl_Corr] = track.tpcNSigmaEl(); } } + // compute TPC postcalibrated pion nsigma if required if (fgUsedVars[kTPCnSigmaPi_Corr] && fgRunTPCPostCalibration[1]) { - TH3F* calibMean = reinterpret_cast(fgCalibs[kTPCPionMean]); - TH3F* calibSigma = reinterpret_cast(fgCalibs[kTPCPionSigma]); - - int binTPCncls = calibMean->GetXaxis()->FindBin(values[kTPCncls]); - binTPCncls = (binTPCncls == 0 ? 1 : binTPCncls); - binTPCncls = (binTPCncls > calibMean->GetXaxis()->GetNbins() ? calibMean->GetXaxis()->GetNbins() : binTPCncls); - int binPin = calibMean->GetYaxis()->FindBin(values[kPin]); - binPin = (binPin == 0 ? 1 : binPin); - binPin = (binPin > calibMean->GetYaxis()->GetNbins() ? calibMean->GetYaxis()->GetNbins() : binPin); - int binEta = calibMean->GetZaxis()->FindBin(values[kEta]); - binEta = (binEta == 0 ? 1 : binEta); - binEta = (binEta > calibMean->GetZaxis()->GetNbins() ? calibMean->GetZaxis()->GetNbins() : binEta); - - double mean = calibMean->GetBinContent(binTPCncls, binPin, binEta); - double width = calibSigma->GetBinContent(binTPCncls, binPin, binEta); if (!isTPCCalibrated) { - values[kTPCnSigmaPi_Corr] = (values[kTPCnSigmaPi] - mean) / width; + values[kTPCnSigmaPi_Corr] = ComputePIDcalibration(1, values[kTPCnSigmaPi]); } else { + LOG(fatal) << "TPC PID postcalibration is configured but the tracks are already postcalibrated. This is not allowed. Please check your configuration."; values[kTPCnSigmaPi_Corr] = track.tpcNSigmaPi(); } } if (fgUsedVars[kTPCnSigmaKa_Corr] && fgRunTPCPostCalibration[2]) { - TH3F* calibMean = reinterpret_cast(fgCalibs[kTPCKaonMean]); - TH3F* calibSigma = reinterpret_cast(fgCalibs[kTPCKaonSigma]); - - int binTPCncls = calibMean->GetXaxis()->FindBin(values[kTPCncls]); - binTPCncls = (binTPCncls == 0 ? 1 : binTPCncls); - binTPCncls = (binTPCncls > calibMean->GetXaxis()->GetNbins() ? calibMean->GetXaxis()->GetNbins() : binTPCncls); - int binPin = calibMean->GetYaxis()->FindBin(values[kPin]); - binPin = (binPin == 0 ? 1 : binPin); - binPin = (binPin > calibMean->GetYaxis()->GetNbins() ? calibMean->GetYaxis()->GetNbins() : binPin); - int binEta = calibMean->GetZaxis()->FindBin(values[kEta]); - binEta = (binEta == 0 ? 1 : binEta); - binEta = (binEta > calibMean->GetZaxis()->GetNbins() ? calibMean->GetZaxis()->GetNbins() : binEta); - - double mean = calibMean->GetBinContent(binTPCncls, binPin, binEta); - double width = calibSigma->GetBinContent(binTPCncls, binPin, binEta); + // compute TPC postcalibrated kaon nsigma if required if (!isTPCCalibrated) { - values[kTPCnSigmaKa_Corr] = (values[kTPCnSigmaKa] - mean) / width; + values[kTPCnSigmaKa_Corr] = ComputePIDcalibration(2, values[kTPCnSigmaKa]); } else { + LOG(fatal) << "TPC PID postcalibration is configured but the tracks are already postcalibrated. This is not allowed. Please check your configuration."; values[kTPCnSigmaKa_Corr] = track.tpcNSigmaKa(); } } // compute TPC postcalibrated proton nsigma if required if (fgUsedVars[kTPCnSigmaPr_Corr] && fgRunTPCPostCalibration[3]) { - TH3F* calibMean = reinterpret_cast(fgCalibs[kTPCProtonMean]); - TH3F* calibSigma = reinterpret_cast(fgCalibs[kTPCProtonSigma]); - - int binTPCncls = calibMean->GetXaxis()->FindBin(values[kTPCncls]); - binTPCncls = (binTPCncls == 0 ? 1 : binTPCncls); - binTPCncls = (binTPCncls > calibMean->GetXaxis()->GetNbins() ? calibMean->GetXaxis()->GetNbins() : binTPCncls); - int binPin = calibMean->GetYaxis()->FindBin(values[kPin]); - binPin = (binPin == 0 ? 1 : binPin); - binPin = (binPin > calibMean->GetYaxis()->GetNbins() ? calibMean->GetYaxis()->GetNbins() : binPin); - int binEta = calibMean->GetZaxis()->FindBin(values[kEta]); - binEta = (binEta == 0 ? 1 : binEta); - binEta = (binEta > calibMean->GetZaxis()->GetNbins() ? calibMean->GetZaxis()->GetNbins() : binEta); - - double mean = calibMean->GetBinContent(binTPCncls, binPin, binEta); - double width = calibSigma->GetBinContent(binTPCncls, binPin, binEta); if (!isTPCCalibrated) { - values[kTPCnSigmaPr_Corr] = (values[kTPCnSigmaPr] - mean) / width; + values[kTPCnSigmaPr_Corr] = ComputePIDcalibration(3, values[kTPCnSigmaPr]); } else { + LOG(fatal) << "TPC PID postcalibration is configured but the tracks are already postcalibrated. This is not allowed. Please check your configuration."; values[kTPCnSigmaPr_Corr] = track.tpcNSigmaPr(); } } @@ -2531,22 +2487,6 @@ void VarManager::FillTrack(T const& track, float* values) values[kTOFnSigmaPr] = track.tofNSigmaPr(); } - if (fgUsedVars[kTPCsignalRandomized] || fgUsedVars[kTPCnSigmaElRandomized] || fgUsedVars[kTPCnSigmaPiRandomized] || fgUsedVars[kTPCnSigmaPrRandomized]) { - // NOTE: this is needed temporarily for the study of the impact of TPC pid degradation on the quarkonium triggers in high lumi pp - // This study involves a degradation from a dE/dx resolution of 5% to one of 6% (20% worsening) - // For this we smear the dE/dx and n-sigmas using a gaus distribution with a width of 3.3% - // which is approx the needed amount to get dE/dx to a resolution of 6% - double randomX = gRandom->Gaus(0.0, 0.033); - values[kTPCsignalRandomized] = values[kTPCsignal] * (1.0 + randomX); - values[kTPCsignalRandomizedDelta] = values[kTPCsignal] * randomX; - values[kTPCnSigmaElRandomized] = values[kTPCnSigmaEl] * (1.0 + randomX); - values[kTPCnSigmaElRandomizedDelta] = values[kTPCnSigmaEl] * randomX; - values[kTPCnSigmaPiRandomized] = values[kTPCnSigmaPi] * (1.0 + randomX); - values[kTPCnSigmaPiRandomizedDelta] = values[kTPCnSigmaPi] * randomX; - values[kTPCnSigmaPrRandomized] = values[kTPCnSigmaPr] * (1.0 + randomX); - values[kTPCnSigmaPrRandomizedDelta] = values[kTPCnSigmaPr] * randomX; - } - if constexpr ((fillMap & ReducedTrackBarrelPID) > 0) { values[kTPCnSigmaMu] = track.tpcNSigmaMu(); values[kTOFnSigmaMu] = track.tofNSigmaMu(); diff --git a/PWGDQ/TableProducer/tableMaker_withAssoc.cxx b/PWGDQ/TableProducer/tableMaker_withAssoc.cxx index 60670abfac6..c72742c3225 100644 --- a/PWGDQ/TableProducer/tableMaker_withAssoc.cxx +++ b/PWGDQ/TableProducer/tableMaker_withAssoc.cxx @@ -240,6 +240,8 @@ struct TableMaker { // TPC postcalibration related options struct : ConfigurableGroup { Configurable fConfigComputeTPCpostCalib{"cfgTPCpostCalib", false, "If true, compute TPC post-calibrated n-sigmas(electrons, pions, protons)"}; + Configurable fConfigTPCpostCalibType{"cfgTPCpostCalibType", 1, "1: (TPCncls,pIN,eta) calibration typically for pp, 2: (eta,nPV,nLong,tLong) calibration typically for PbPb"}; + Configurable fConfigTPCuseInterpolatedCalib{"cfgTPCpostCalibUseInterpolation", true, "If true, use interpolated calibration values (default: true)"}; Configurable fConfigComputeTPCpostCalibKaon{"cfgTPCpostCalibKaon", false, "If true, compute TPC post-calibrated n-sigmas for kaons"}; Configurable fConfigIsOnlyforMaps{"cfgIsforMaps", false, "If true, run for postcalibration maps only"}; Configurable fConfigSaveElectronSample{"cfgSaveElectronSample", false, "If true, only save electron sample"}; @@ -1013,6 +1015,7 @@ struct TableMaker { (reinterpret_cast(fStatsList->At(kStatsTracks)))->Fill(fTrackCuts.size() + static_cast(iv0)); } } + // TODO: this part should be removed since the calibration histogram can be filled as any other histogram if (fConfigPostCalibTPC.fConfigIsOnlyforMaps) { if (trackFilteringTag & (static_cast(1) << VarManager::kIsConversionLeg)) { // for electron fHistMan->FillHistClass("TrackBarrel_PostCalibElectron", VarManager::fgValues); @@ -1305,6 +1308,15 @@ struct TableMaker { VarManager::SetCalibrationObject(VarManager::kTPCKaonMean, calibList->FindObject("mean_map_kaon")); VarManager::SetCalibrationObject(VarManager::kTPCKaonSigma, calibList->FindObject("sigma_map_kaon")); } + if (fConfigPostCalibTPC.fConfigTPCpostCalibType == 2) { + VarManager::SetCalibrationObject(VarManager::kTPCElectronStatus, calibList->FindObject("status_map_electron")); + VarManager::SetCalibrationObject(VarManager::kTPCPionStatus, calibList->FindObject("status_map_pion")); + VarManager::SetCalibrationObject(VarManager::kTPCProtonStatus, calibList->FindObject("status_map_proton")); + if (fConfigPostCalibTPC.fConfigComputeTPCpostCalibKaon) { + VarManager::SetCalibrationObject(VarManager::kTPCKaonStatus, calibList->FindObject("status_map_kaon")); + } + } + VarManager::SetCalibrationType(fConfigPostCalibTPC.fConfigTPCpostCalibType, fConfigPostCalibTPC.fConfigTPCuseInterpolatedCalib); } if (fIsRun2 == true) { fGrpMagRun2 = fCCDB->getForTimeStamp(fConfigCCDB.fConfigGrpMagPathRun2, bcs.begin().timestamp()); diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index ae6c450ac3e..3d3cd926b31 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -563,6 +563,8 @@ struct AnalysisTrackSelection { Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable fConfigComputeTPCpostCalib{"cfgTPCpostCalib", false, "If true, compute TPC post-calibrated n-sigmas"}; + Configurable fConfigTPCpostCalibType{"cfgTPCpostCalibType", 1, "1: (TPCncls,pIN,eta) calibration typically for pp, 2: (eta,nPV,nLong,tLong) calibration typically for PbPb"}; + Configurable fConfigTPCuseInterpolatedCalib{"cfgTPCpostCalibUseInterpolation", true, "If true, use interpolated calibration values (default: true)"}; Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; // Track related options Configurable fPropTrack{"cfgPropTrack", true, "Propgate tracks to associated collision to recalculate DCA and momentum vector"}; @@ -648,6 +650,12 @@ struct AnalysisTrackSelection { VarManager::SetCalibrationObject(VarManager::kTPCPionSigma, calibList->FindObject("sigma_map_pion")); VarManager::SetCalibrationObject(VarManager::kTPCProtonMean, calibList->FindObject("mean_map_proton")); VarManager::SetCalibrationObject(VarManager::kTPCProtonSigma, calibList->FindObject("sigma_map_proton")); + if (fConfigTPCpostCalibType == 2) { + VarManager::SetCalibrationObject(VarManager::kTPCElectronStatus, calibList->FindObject("status_map_electron")); + VarManager::SetCalibrationObject(VarManager::kTPCPionStatus, calibList->FindObject("status_map_pion")); + VarManager::SetCalibrationObject(VarManager::kTPCProtonStatus, calibList->FindObject("status_map_proton")); + } + VarManager::SetCalibrationType(fConfigTPCpostCalibType, fConfigTPCuseInterpolatedCalib); } o2::parameters::GRPMagField* grpmag = fCCDB->getForTimeStamp(grpmagPath, events.begin().timestamp()); From 90060ee3864019f93d66f4f51bf0ac428ea0b08a Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 22 Aug 2025 05:44:48 +0200 Subject: [PATCH 144/986] [PWGEM/Dilepton] 1st version of PID ML (#12680) Co-authored-by: ALICE Action Bot --- PWGEM/Dilepton/Core/DielectronCut.h | 57 ++++++---- PWGEM/Dilepton/Core/Dilepton.h | 78 +++++++------ PWGEM/Dilepton/Core/DileptonHadronMPC.h | 104 ++++++++++-------- PWGEM/Dilepton/Core/DileptonMC.h | 86 ++++++++------- PWGEM/Dilepton/Core/PhotonHBT.h | 72 +++++++----- PWGEM/Dilepton/Core/SingleTrackQC.h | 71 +++++++----- PWGEM/Dilepton/Core/SingleTrackQCMC.h | 62 ++++++----- .../TableProducer/skimmerPrimaryElectron.cxx | 89 +++++++++++---- .../skimmerPrimaryElectronQC.cxx | 39 ++----- PWGEM/Dilepton/Tasks/prefilterDielectron.cxx | 56 ++++++---- PWGEM/Dilepton/Utils/MlResponseO2Track.h | 3 + 11 files changed, 420 insertions(+), 297 deletions(-) diff --git a/PWGEM/Dilepton/Core/DielectronCut.h b/PWGEM/Dilepton/Core/DielectronCut.h index 0dc108b05c5..20fc738b146 100644 --- a/PWGEM/Dilepton/Core/DielectronCut.h +++ b/PWGEM/Dilepton/Core/DielectronCut.h @@ -162,8 +162,8 @@ class DielectronCut : public TNamed return true; } - template - bool IsSelectedTrack(TTrack const& track, TCollision const& collision = 0) const + template + bool IsSelectedTrack(TTrack const& track) const { if (!track.hasITS()) { return false; @@ -252,36 +252,31 @@ class DielectronCut : public TNamed } // PID cuts - if constexpr (isML) { - if (!PassPIDML(track, collision)) { + if (track.hasITS() && !track.hasTPC() && !track.hasTRD() && !track.hasTOF()) { // ITSsa + float meanClusterSizeITS = track.meanClusterSizeITS() * std::cos(std::atan(track.tgl())); + if (meanClusterSizeITS < mMinMeanClusterSizeITS || mMaxMeanClusterSizeITS < meanClusterSizeITS) { return false; } - } else { - if (track.hasITS() && !track.hasTPC() && !track.hasTRD() && !track.hasTOF()) { // ITSsa - float meanClusterSizeITS = track.meanClusterSizeITS() * std::cos(std::atan(track.tgl())); - if (meanClusterSizeITS < mMinMeanClusterSizeITS || mMaxMeanClusterSizeITS < meanClusterSizeITS) { - return false; - } - } else { // not ITSsa - if (!PassPID(track)) { - return false; - } + } else { // not ITSsa + if (!PassPID(track)) { + return false; } } return true; } - template - bool PassPIDML(TTrack const&, TCollision const&) const + template + bool PassPIDML(TTrack const& track) const { - return false; - /*if (!PassTOFif(track)) { // Allows for pre-selection. But potentially dangerous if analyzers are not aware of it - return false; - }*/ - // std::vector inputFeatures = mPIDMlResponse->getInputFeatures(track, collision); - // float binningFeature = mPIDMlResponse->getBinningFeature(track, collision); - // return mPIDMlResponse->isSelectedMl(inputFeatures, binningFeature); + int pbin = lower_bound(mMLBins.begin(), mMLBins.end(), track.tpcInnerParam()) - mMLBins.begin() - 1; + if (pbin < 0) { + pbin = 0; + } else if (static_cast(mMLBins.size()) - 2 < pbin) { + pbin = static_cast(mMLBins.size()) - 2; + } + // LOGF(info, "track.tpcInnerParam() = %f, pbin = %d, track.probElBDT() = %f, mMLCuts[pbin] = %f", track.tpcInnerParam(), pbin, track.probElBDT(), mMLCuts[pbin]); + return track.probElBDT() > mMLCuts[pbin]; } template @@ -307,7 +302,7 @@ class DielectronCut : public TNamed return PassTOFif(track); case static_cast(PIDSchemes::kPIDML): - return true; // don't use kPIDML here. + return PassPIDML(track); case static_cast(PIDSchemes::kTPChadrejORTOFreq_woTOFif): return PassTPConlyhadrej(track) || PassTOFreq(track); @@ -517,6 +512,18 @@ class DielectronCut : public TNamed mPIDMlResponse = mlResponse; } + void SetMLThresholds(const std::vector bins, const std::vector cuts) + { + if (bins.size() != cuts.size() + 1) { + LOG(fatal) << "cuts.size() + 1 mutst be exactly the same as bins.size(). Check your bins and thresholds."; + } + mMLBins = bins; + mMLCuts = cuts; + // for (int i = 0; i < static_cast(mMLBins.size()) - 1; i++) { + // printf("Dielectron cut: mMLBins[%d] = %3.2f, mMLBins[%d] = %3.2f, mMLCuts[%d] = %3.2f\n", i, mMLBins[i], i + 1, mMLBins[i + 1], i, mMLCuts[i]); + // } + } + // Getters bool IsPhotonConversionSelected() const { return mSelectPC; } @@ -597,6 +604,8 @@ class DielectronCut : public TNamed // float mMinP_ITSNsigmaPr{0.0}, mMaxP_ITSNsigmaPr{0.0}; o2::analysis::MlResponseDielectronSingleTrack* mPIDMlResponse{nullptr}; + std::vector mMLBins{}; // binning for a feature variable. e.g. tpcInnerParam + std::vector mMLCuts{}; // threshold for each bin. mMLCuts.size() must be mMLBins.size()-1. ClassDef(DielectronCut, 1); }; diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index c928d1cc71f..fc06f13f92b 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -713,30 +713,42 @@ struct Dilepton { // fDielectronCut.SetPRangeForITSNsigmaPr(dielectroncuts.cfg_min_p_ITSNsigmaPr, dielectroncuts.cfg_max_p_ITSNsigmaPr); if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { // please call this at the end of DefineDileptonCut - static constexpr int nClassesMl = 2; - const std::vector cutDirMl = {o2::cuts_ml::CutNot, o2::cuts_ml::CutSmaller}; - const std::vector labelsClasses = {"Background", "Signal"}; - const uint32_t nBinsMl = dielectroncuts.binsMl.value.size() - 1; - const std::vector labelsBins(nBinsMl, "bin"); - double cutsMlArr[nBinsMl][nClassesMl]; - for (uint32_t i = 0; i < nBinsMl; i++) { - cutsMlArr[i][0] = 0.; - cutsMlArr[i][1] = dielectroncuts.cutsMl.value[i]; - } - o2::framework::LabeledArray cutsMl = {cutsMlArr[0], nBinsMl, nClassesMl, labelsBins, labelsClasses}; - - mlResponseSingleTrack.configure(dielectroncuts.binsMl.value, cutsMl, cutDirMl, nClassesMl); - if (dielectroncuts.loadModelsFromCCDB) { - ccdbApi.init(ccdburl); - mlResponseSingleTrack.setModelPathsCCDB(dielectroncuts.onnxFileNames.value, ccdbApi, dielectroncuts.onnxPathsCCDB.value, dielectroncuts.timestampCCDB.value); - } else { - mlResponseSingleTrack.setModelPathsLocal(dielectroncuts.onnxFileNames.value); - } - mlResponseSingleTrack.cacheInputFeaturesIndices(dielectroncuts.namesInputFeatures); - mlResponseSingleTrack.cacheBinningIndex(dielectroncuts.nameBinningFeature); - mlResponseSingleTrack.init(dielectroncuts.enableOptimizations.value); - - fDielectronCut.SetPIDMlResponse(&mlResponseSingleTrack); + std::vector binsML{}; + binsML.reserve(dielectroncuts.binsMl.value.size()); + for (size_t i = 0; i < dielectroncuts.binsMl.value.size(); i++) { + binsML.emplace_back(dielectroncuts.binsMl.value[i]); + } + std::vector thresholdsML{}; + thresholdsML.reserve(dielectroncuts.cutsMl.value.size()); + for (size_t i = 0; i < dielectroncuts.cutsMl.value.size(); i++) { + thresholdsML.emplace_back(dielectroncuts.cutsMl.value[i]); + } + fDielectronCut.SetMLThresholds(binsML, thresholdsML); + + // static constexpr int nClassesMl = 2; + // const std::vector cutDirMl = {o2::cuts_ml::CutNot, o2::cuts_ml::CutSmaller}; + // const std::vector labelsClasses = {"Background", "Signal"}; + // const uint32_t nBinsMl = dielectroncuts.binsMl.value.size() - 1; + // const std::vector labelsBins(nBinsMl, "bin"); + // double cutsMlArr[nBinsMl][nClassesMl]; + // for (uint32_t i = 0; i < nBinsMl; i++) { + // cutsMlArr[i][0] = 0.; + // cutsMlArr[i][1] = dielectroncuts.cutsMl.value[i]; + // } + // o2::framework::LabeledArray cutsMl = {cutsMlArr[0], nBinsMl, nClassesMl, labelsBins, labelsClasses}; + + // mlResponseSingleTrack.configure(dielectroncuts.binsMl.value, cutsMl, cutDirMl, nClassesMl); + // if (dielectroncuts.loadModelsFromCCDB) { + // ccdbApi.init(ccdburl); + // mlResponseSingleTrack.setModelPathsCCDB(dielectroncuts.onnxFileNames.value, ccdbApi, dielectroncuts.onnxPathsCCDB.value, dielectroncuts.timestampCCDB.value); + // } else { + // mlResponseSingleTrack.setModelPathsLocal(dielectroncuts.onnxFileNames.value); + // } + // mlResponseSingleTrack.cacheInputFeaturesIndices(dielectroncuts.namesInputFeatures); + // mlResponseSingleTrack.cacheBinningIndex(dielectroncuts.nameBinningFeature); + // mlResponseSingleTrack.init(dielectroncuts.enableOptimizations.value); + + // fDielectronCut.SetPIDMlResponse(&mlResponseSingleTrack); } // end of PID ML } @@ -836,11 +848,11 @@ struct Dilepton { if constexpr (ev_id == 0) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut.template IsSelectedTrack(t1, collision) || !cut.template IsSelectedTrack(t2, collision)) { + if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { return false; } } else { // cut-based - if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { + if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { return false; } } @@ -1377,16 +1389,16 @@ struct Dilepton { } // end of DF - template - bool isPairOK(TCollision const& collision, TTrack1 const& t1, TTrack2 const& t2, TCut const& cut, TAllTracks const& tracks) + template + bool isPairOK(TTrack1 const& t1, TTrack2 const& t2, TCut const& cut, TAllTracks const& tracks) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut.template IsSelectedTrack(t1, collision) || !cut.template IsSelectedTrack(t2, collision)) { + if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { return false; } } else { // cut-based - if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { + if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { return false; } } @@ -1470,17 +1482,17 @@ struct Dilepton { auto negTracks_per_coll = negTracks.sliceByCached(perCollision, collision.globalIndex(), cache); for (const auto& [pos, neg] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { // ULS - if (isPairOK(collision, pos, neg, cut, tracks)) { + if (isPairOK(pos, neg, cut, tracks)) { passed_pairIds.emplace_back(std::make_pair(pos.globalIndex(), neg.globalIndex())); } } for (const auto& [pos1, pos2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { // LS++ - if (isPairOK(collision, pos1, pos2, cut, tracks)) { + if (isPairOK(pos1, pos2, cut, tracks)) { passed_pairIds.emplace_back(std::make_pair(pos1.globalIndex(), pos2.globalIndex())); } } for (const auto& [neg1, neg2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { // LS-- - if (isPairOK(collision, neg1, neg2, cut, tracks)) { + if (isPairOK(neg1, neg2, cut, tracks)) { passed_pairIds.emplace_back(std::make_pair(neg1.globalIndex(), neg2.globalIndex())); } } diff --git a/PWGEM/Dilepton/Core/DileptonHadronMPC.h b/PWGEM/Dilepton/Core/DileptonHadronMPC.h index 11fedd03212..1e0e59dfd2c 100644 --- a/PWGEM/Dilepton/Core/DileptonHadronMPC.h +++ b/PWGEM/Dilepton/Core/DileptonHadronMPC.h @@ -611,30 +611,42 @@ struct DileptonHadronMPC { fDielectronCut.SetPinRangeForPionRejectionTPC(dielectroncuts.cfg_min_pin_pirejTPC, dielectroncuts.cfg_max_pin_pirejTPC); if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { // please call this at the end of DefineDileptonCut - static constexpr int nClassesMl = 2; - const std::vector cutDirMl = {o2::cuts_ml::CutNot, o2::cuts_ml::CutSmaller}; - const std::vector labelsClasses = {"Background", "Signal"}; - const uint32_t nBinsMl = dielectroncuts.binsMl.value.size() - 1; - const std::vector labelsBins(nBinsMl, "bin"); - double cutsMlArr[nBinsMl][nClassesMl]; - for (uint32_t i = 0; i < nBinsMl; i++) { - cutsMlArr[i][0] = 0.; - cutsMlArr[i][1] = dielectroncuts.cutsMl.value[i]; + std::vector binsML{}; + binsML.reserve(dielectroncuts.binsMl.value.size()); + for (size_t i = 0; i < dielectroncuts.binsMl.value.size(); i++) { + binsML.emplace_back(dielectroncuts.binsMl.value[i]); } - o2::framework::LabeledArray cutsMl = {cutsMlArr[0], nBinsMl, nClassesMl, labelsBins, labelsClasses}; - - mlResponseSingleTrack.configure(dielectroncuts.binsMl.value, cutsMl, cutDirMl, nClassesMl); - if (dielectroncuts.loadModelsFromCCDB) { - ccdbApi.init(ccdburl); - mlResponseSingleTrack.setModelPathsCCDB(dielectroncuts.onnxFileNames.value, ccdbApi, dielectroncuts.onnxPathsCCDB.value, dielectroncuts.timestampCCDB.value); - } else { - mlResponseSingleTrack.setModelPathsLocal(dielectroncuts.onnxFileNames.value); + std::vector thresholdsML{}; + thresholdsML.reserve(dielectroncuts.cutsMl.value.size()); + for (size_t i = 0; i < dielectroncuts.cutsMl.value.size(); i++) { + thresholdsML.emplace_back(dielectroncuts.cutsMl.value[i]); } - mlResponseSingleTrack.cacheInputFeaturesIndices(dielectroncuts.namesInputFeatures); - mlResponseSingleTrack.cacheBinningIndex(dielectroncuts.nameBinningFeature); - mlResponseSingleTrack.init(dielectroncuts.enableOptimizations.value); - - fDielectronCut.SetPIDMlResponse(&mlResponseSingleTrack); + fDielectronCut.SetMLThresholds(binsML, thresholdsML); + + // static constexpr int nClassesMl = 2; + // const std::vector cutDirMl = {o2::cuts_ml::CutNot, o2::cuts_ml::CutSmaller}; + // const std::vector labelsClasses = {"Background", "Signal"}; + // const uint32_t nBinsMl = dielectroncuts.binsMl.value.size() - 1; + // const std::vector labelsBins(nBinsMl, "bin"); + // double cutsMlArr[nBinsMl][nClassesMl]; + // for (uint32_t i = 0; i < nBinsMl; i++) { + // cutsMlArr[i][0] = 0.; + // cutsMlArr[i][1] = dielectroncuts.cutsMl.value[i]; + // } + // o2::framework::LabeledArray cutsMl = {cutsMlArr[0], nBinsMl, nClassesMl, labelsBins, labelsClasses}; + + // mlResponseSingleTrack.configure(dielectroncuts.binsMl.value, cutsMl, cutDirMl, nClassesMl); + // if (dielectroncuts.loadModelsFromCCDB) { + // ccdbApi.init(ccdburl); + // mlResponseSingleTrack.setModelPathsCCDB(dielectroncuts.onnxFileNames.value, ccdbApi, dielectroncuts.onnxPathsCCDB.value, dielectroncuts.timestampCCDB.value); + // } else { + // mlResponseSingleTrack.setModelPathsLocal(dielectroncuts.onnxFileNames.value); + // } + // mlResponseSingleTrack.cacheInputFeaturesIndices(dielectroncuts.namesInputFeatures); + // mlResponseSingleTrack.cacheBinningIndex(dielectroncuts.nameBinningFeature); + // mlResponseSingleTrack.init(dielectroncuts.enableOptimizations.value); + + // fDielectronCut.SetPIDMlResponse(&mlResponseSingleTrack); } // end of PID ML } @@ -701,11 +713,11 @@ struct DileptonHadronMPC { if constexpr (ev_id == 0) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut.template IsSelectedTrack(t1, collision) || !cut.template IsSelectedTrack(t2, collision)) { + if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { return false; } } else { // cut-based - if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { + if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { return false; } } @@ -831,8 +843,8 @@ struct DileptonHadronMPC { return true; } - template - bool fillDileptonHadron(TCollision const& collision, TTrack1 const& t1, TTrack2 const& t2, TCut const& cut, TAllTracks const& tracks, TRefTrack const& t3) + template + bool fillDileptonHadron(TTrack1 const& t1, TTrack2 const& t2, TCut const& cut, TAllTracks const& tracks, TRefTrack const& t3) { // this function must be called, if dilepton passes the cut. if constexpr (ev_id == 1) { @@ -860,11 +872,11 @@ struct DileptonHadronMPC { if constexpr (ev_id == 0) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut.template IsSelectedTrack(t1, collision) || !cut.template IsSelectedTrack(t2, collision)) { + if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { return false; } } else { // cut-based - if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { + if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { return false; } } @@ -951,8 +963,8 @@ struct DileptonHadronMPC { return true; } - template - bool fillHadronHadron(TCollision const& collision, TRefTrack const& t1, TRefTrack const& t2, TLeptons const& posLeptons, TLeptons const& negLeptons, TLeptonCut const& cut) + template + bool fillHadronHadron(TRefTrack const& t1, TRefTrack const& t2, TLeptons const& posLeptons, TLeptons const& negLeptons, TLeptonCut const& cut) { if constexpr (ev_id == 0) { if (!fEMTrackCut.IsSelected(t1) || !fEMTrackCut.IsSelected(t2)) { // for charged track @@ -963,11 +975,11 @@ struct DileptonHadronMPC { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { for (const auto& pos : posLeptons) { // leptons per collision if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut.template IsSelectedTrack(pos, collision)) { + if (!cut.template IsSelectedTrack(pos)) { continue; } } else { // cut based - if (!cut.template IsSelectedTrack(pos)) { + if (!cut.template IsSelectedTrack(pos)) { continue; } } @@ -978,11 +990,11 @@ struct DileptonHadronMPC { for (const auto& neg : negLeptons) { // leptons per collision if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut.template IsSelectedTrack(neg, collision)) { + if (!cut.template IsSelectedTrack(neg)) { continue; } } else { // cut based - if (!cut.template IsSelectedTrack(neg)) { + if (!cut.template IsSelectedTrack(neg)) { continue; } } @@ -1105,7 +1117,7 @@ struct DileptonHadronMPC { if (is_pair_ok) { nuls++; for (const auto& refTrack : refTracks_per_coll) { - fillDileptonHadron<0>(collision, pos, neg, cut, tracks, refTrack); + fillDileptonHadron<0>(pos, neg, cut, tracks, refTrack); } } } @@ -1114,7 +1126,7 @@ struct DileptonHadronMPC { if (is_pair_ok) { nlspp++; for (const auto& refTrack : refTracks_per_coll) { - fillDileptonHadron<0>(collision, pos1, pos2, cut, tracks, refTrack); + fillDileptonHadron<0>(pos1, pos2, cut, tracks, refTrack); } } } @@ -1123,7 +1135,7 @@ struct DileptonHadronMPC { if (is_pair_ok) { nlsmm++; for (const auto& refTrack : refTracks_per_coll) { - fillDileptonHadron<0>(collision, neg1, neg2, cut, tracks, refTrack); + fillDileptonHadron<0>(neg1, neg2, cut, tracks, refTrack); } } } @@ -1144,7 +1156,7 @@ struct DileptonHadronMPC { } } for (const auto& [ref1, ref2] : combinations(CombinationsStrictlyUpperIndexPolicy(refTracks_per_coll, refTracks_per_coll))) { - fillHadronHadron<0>(collision, ref1, ref2, posTracks_per_coll, negTracks_per_coll, cut); + fillHadronHadron<0>(ref1, ref2, posTracks_per_coll, negTracks_per_coll, cut); } } @@ -1262,7 +1274,7 @@ struct DileptonHadronMPC { for (const auto& ref1 : selected_refTracks_in_this_event) { // ref-ref mix for (const auto& ref2 : refTracks_from_event_pool) { // LOGF(info, "ref1.pt() = %f, ref2.pt() = %f", ref1.pt(), ref2.pt()); - fillHadronHadron<1>(collision, ref1, ref2, nullptr, nullptr, nullptr); + fillHadronHadron<1>(ref1, ref2, nullptr, nullptr, nullptr); } } } // end of loop over mixed event pool for hadron-hadron @@ -1279,16 +1291,16 @@ struct DileptonHadronMPC { } // end of DF - template - bool isPairOK(TCollision const& collision, TTrack1 const& t1, TTrack2 const& t2, TCut const& cut, TAllTracks const& tracks) + template + bool isPairOK(TTrack1 const& t1, TTrack2 const& t2, TCut const& cut, TAllTracks const& tracks) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut.template IsSelectedTrack(t1, collision) || !cut.template IsSelectedTrack(t2, collision)) { + if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { return false; } } else { // cut-based - if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { + if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { return false; } } @@ -1348,17 +1360,17 @@ struct DileptonHadronMPC { auto negTracks_per_coll = negTracks.sliceByCached(perCollision, collision.globalIndex(), cache); for (const auto& [pos, neg] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { // ULS - if (isPairOK(collision, pos, neg, cut, tracks)) { + if (isPairOK(pos, neg, cut, tracks)) { passed_pairIds.emplace_back(std::make_pair(pos.globalIndex(), neg.globalIndex())); } } for (const auto& [pos1, pos2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { // LS++ - if (isPairOK(collision, pos1, pos2, cut, tracks)) { + if (isPairOK(pos1, pos2, cut, tracks)) { passed_pairIds.emplace_back(std::make_pair(pos1.globalIndex(), pos2.globalIndex())); } } for (const auto& [neg1, neg2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { // LS-- - if (isPairOK(collision, neg1, neg2, cut, tracks)) { + if (isPairOK(neg1, neg2, cut, tracks)) { passed_pairIds.emplace_back(std::make_pair(neg1.globalIndex(), neg2.globalIndex())); } } diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index 57beff3f8f1..01d4bfabfd9 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -692,30 +692,42 @@ struct DileptonMC { // fDielectronCut.SetPRangeForITSNsigmaPr(dielectroncuts.cfg_min_p_ITSNsigmaPr, dielectroncuts.cfg_max_p_ITSNsigmaPr); if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { // please call this at the end of DefineDileptonCut - static constexpr int nClassesMl = 2; - const std::vector cutDirMl = {o2::cuts_ml::CutNot, o2::cuts_ml::CutSmaller}; - const std::vector labelsClasses = {"Background", "Signal"}; - const uint32_t nBinsMl = dielectroncuts.binsMl.value.size() - 1; - const std::vector labelsBins(nBinsMl, "bin"); - double cutsMlArr[nBinsMl][nClassesMl]; - for (uint32_t i = 0; i < nBinsMl; i++) { - cutsMlArr[i][0] = 0.; - cutsMlArr[i][1] = dielectroncuts.cutsMl.value[i]; - } - o2::framework::LabeledArray cutsMl = {cutsMlArr[0], nBinsMl, nClassesMl, labelsBins, labelsClasses}; - - mlResponseSingleTrack.configure(dielectroncuts.binsMl.value, cutsMl, cutDirMl, nClassesMl); - if (dielectroncuts.loadModelsFromCCDB) { - ccdbApi.init(ccdburl); - mlResponseSingleTrack.setModelPathsCCDB(dielectroncuts.onnxFileNames.value, ccdbApi, dielectroncuts.onnxPathsCCDB.value, dielectroncuts.timestampCCDB.value); - } else { - mlResponseSingleTrack.setModelPathsLocal(dielectroncuts.onnxFileNames.value); - } - mlResponseSingleTrack.cacheInputFeaturesIndices(dielectroncuts.namesInputFeatures); - mlResponseSingleTrack.cacheBinningIndex(dielectroncuts.nameBinningFeature); - mlResponseSingleTrack.init(dielectroncuts.enableOptimizations.value); - - fDielectronCut.SetPIDMlResponse(&mlResponseSingleTrack); + std::vector binsML{}; + binsML.reserve(dielectroncuts.binsMl.value.size()); + for (size_t i = 0; i < dielectroncuts.binsMl.value.size(); i++) { + binsML.emplace_back(dielectroncuts.binsMl.value[i]); + } + std::vector thresholdsML{}; + thresholdsML.reserve(dielectroncuts.cutsMl.value.size()); + for (size_t i = 0; i < dielectroncuts.cutsMl.value.size(); i++) { + thresholdsML.emplace_back(dielectroncuts.cutsMl.value[i]); + } + fDielectronCut.SetMLThresholds(binsML, thresholdsML); + + // static constexpr int nClassesMl = 2; + // const std::vector cutDirMl = {o2::cuts_ml::CutNot, o2::cuts_ml::CutSmaller}; + // const std::vector labelsClasses = {"Background", "Signal"}; + // const uint32_t nBinsMl = dielectroncuts.binsMl.value.size() - 1; + // const std::vector labelsBins(nBinsMl, "bin"); + // double cutsMlArr[nBinsMl][nClassesMl]; + // for (uint32_t i = 0; i < nBinsMl; i++) { + // cutsMlArr[i][0] = 0.; + // cutsMlArr[i][1] = dielectroncuts.cutsMl.value[i]; + // } + // o2::framework::LabeledArray cutsMl = {cutsMlArr[0], nBinsMl, nClassesMl, labelsBins, labelsClasses}; + + // mlResponseSingleTrack.configure(dielectroncuts.binsMl.value, cutsMl, cutDirMl, nClassesMl); + // if (dielectroncuts.loadModelsFromCCDB) { + // ccdbApi.init(ccdburl); + // mlResponseSingleTrack.setModelPathsCCDB(dielectroncuts.onnxFileNames.value, ccdbApi, dielectroncuts.onnxPathsCCDB.value, dielectroncuts.timestampCCDB.value); + // } else { + // mlResponseSingleTrack.setModelPathsLocal(dielectroncuts.onnxFileNames.value); + // } + // mlResponseSingleTrack.cacheInputFeaturesIndices(dielectroncuts.namesInputFeatures); + // mlResponseSingleTrack.cacheBinningIndex(dielectroncuts.nameBinningFeature); + // mlResponseSingleTrack.init(dielectroncuts.enableOptimizations.value); + + // fDielectronCut.SetPIDMlResponse(&mlResponseSingleTrack); } // end of PID ML } @@ -822,11 +834,11 @@ struct DileptonMC { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut.template IsSelectedTrack(t1, collision) || !cut.template IsSelectedTrack(t2, collision)) { + if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { return false; } } else { // cut-based - if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { + if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { return false; } } @@ -1871,16 +1883,16 @@ struct DileptonMC { } // end of collision loop } - template - bool isPairOK(TCollision const& collision, TTrack1 const& t1, TTrack2 const& t2, TCut const& cut, TAllTracks const& tracks) + template + bool isPairOK(TTrack1 const& t1, TTrack2 const& t2, TCut const& cut, TAllTracks const& tracks) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut.template IsSelectedTrack(t1, collision) || !cut.template IsSelectedTrack(t2, collision)) { + if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { return false; } } else { // cut-based - if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { + if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { return false; } } @@ -1949,7 +1961,7 @@ struct DileptonMC { continue; } - if (isPairOK(collision, pos, neg, cut, tracks)) { + if (isPairOK(pos, neg, cut, tracks)) { passed_pairIds.emplace_back(std::make_pair(pos.globalIndex(), neg.globalIndex())); } } @@ -1965,7 +1977,7 @@ struct DileptonMC { continue; } - if (isPairOK(collision, pos1, pos2, cut, tracks)) { + if (isPairOK(pos1, pos2, cut, tracks)) { passed_pairIds.emplace_back(std::make_pair(pos1.globalIndex(), pos2.globalIndex())); } } @@ -1980,7 +1992,7 @@ struct DileptonMC { if (cfgEventGeneratorType >= 0 && mccollision_from_neg2.getSubGeneratorId() != cfgEventGeneratorType) { continue; } - if (isPairOK(collision, neg1, neg2, cut, tracks)) { + if (isPairOK(neg1, neg2, cut, tracks)) { passed_pairIds.emplace_back(std::make_pair(neg1.globalIndex(), neg2.globalIndex())); } } @@ -2104,7 +2116,7 @@ struct DileptonMC { continue; } - if (!isPairOK(collision, pos, neg, cut, tracks)) { // without acceptance + if (!isPairOK(pos, neg, cut, tracks)) { // without acceptance continue; } @@ -2242,7 +2254,7 @@ struct DileptonMC { continue; } - if (!isPairOK(collision, pos1, pos2, cut, tracks)) { // without acceptance + if (!isPairOK(pos1, pos2, cut, tracks)) { // without acceptance continue; } @@ -2299,7 +2311,7 @@ struct DileptonMC { if (cfgEventGeneratorType >= 0 && mccollision_from_neg2.getSubGeneratorId() != cfgEventGeneratorType) { continue; } - if (!isPairOK(collision, neg1, neg2, cut, tracks)) { // without acceptance + if (!isPairOK(neg1, neg2, cut, tracks)) { // without acceptance continue; } if ((std::abs(mcneg1.pdgCode()) != pdg_lepton || std::abs(mcneg2.pdgCode()) != pdg_lepton) || (mcneg1.emmceventId() != mcneg2.emmceventId())) { @@ -2316,7 +2328,7 @@ struct DileptonMC { continue; } - if (!isPairOK(collision, neg1, neg2, cut, tracks)) { // without acceptance + if (!isPairOK(neg1, neg2, cut, tracks)) { // without acceptance continue; } diff --git a/PWGEM/Dilepton/Core/PhotonHBT.h b/PWGEM/Dilepton/Core/PhotonHBT.h index 180360e44f3..796f0c5da2b 100644 --- a/PWGEM/Dilepton/Core/PhotonHBT.h +++ b/PWGEM/Dilepton/Core/PhotonHBT.h @@ -589,30 +589,42 @@ struct PhotonHBT { // fDielectronCut.SetPRangeForITSNsigmaPr(dielectroncuts.cfg_min_p_ITSNsigmaPr, dielectroncuts.cfg_max_p_ITSNsigmaPr); if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { // please call this at the end of DefineDileptonCut - static constexpr int nClassesMl = 2; - const std::vector cutDirMl = {o2::cuts_ml::CutNot, o2::cuts_ml::CutSmaller}; - const std::vector labelsClasses = {"Background", "Signal"}; - const uint32_t nBinsMl = dielectroncuts.binsMl.value.size() - 1; - const std::vector labelsBins(nBinsMl, "bin"); - double cutsMlArr[nBinsMl][nClassesMl]; - for (uint32_t i = 0; i < nBinsMl; i++) { - cutsMlArr[i][0] = 0.; - cutsMlArr[i][1] = dielectroncuts.cutsMl.value[i]; + std::vector binsML{}; + binsML.reserve(dielectroncuts.binsMl.value.size()); + for (size_t i = 0; i < dielectroncuts.binsMl.value.size(); i++) { + binsML.emplace_back(dielectroncuts.binsMl.value[i]); } - o2::framework::LabeledArray cutsMl = {cutsMlArr[0], nBinsMl, nClassesMl, labelsBins, labelsClasses}; - - mlResponseSingleTrack.configure(dielectroncuts.binsMl.value, cutsMl, cutDirMl, nClassesMl); - if (dielectroncuts.loadModelsFromCCDB) { - ccdbApi.init(ccdburl); - mlResponseSingleTrack.setModelPathsCCDB(dielectroncuts.onnxFileNames.value, ccdbApi, dielectroncuts.onnxPathsCCDB.value, dielectroncuts.timestampCCDB.value); - } else { - mlResponseSingleTrack.setModelPathsLocal(dielectroncuts.onnxFileNames.value); + std::vector thresholdsML{}; + thresholdsML.reserve(dielectroncuts.cutsMl.value.size()); + for (size_t i = 0; i < dielectroncuts.cutsMl.value.size(); i++) { + thresholdsML.emplace_back(dielectroncuts.cutsMl.value[i]); } - mlResponseSingleTrack.cacheInputFeaturesIndices(dielectroncuts.namesInputFeatures); - mlResponseSingleTrack.cacheBinningIndex(dielectroncuts.nameBinningFeature); - mlResponseSingleTrack.init(dielectroncuts.enableOptimizations.value); - - fDielectronCut.SetPIDMlResponse(&mlResponseSingleTrack); + fDielectronCut.SetMLThresholds(binsML, thresholdsML); + + // static constexpr int nClassesMl = 2; + // const std::vector cutDirMl = {o2::cuts_ml::CutNot, o2::cuts_ml::CutSmaller}; + // const std::vector labelsClasses = {"Background", "Signal"}; + // const uint32_t nBinsMl = dielectroncuts.binsMl.value.size() - 1; + // const std::vector labelsBins(nBinsMl, "bin"); + // double cutsMlArr[nBinsMl][nClassesMl]; + // for (uint32_t i = 0; i < nBinsMl; i++) { + // cutsMlArr[i][0] = 0.; + // cutsMlArr[i][1] = dielectroncuts.cutsMl.value[i]; + // } + // o2::framework::LabeledArray cutsMl = {cutsMlArr[0], nBinsMl, nClassesMl, labelsBins, labelsClasses}; + + // mlResponseSingleTrack.configure(dielectroncuts.binsMl.value, cutsMl, cutDirMl, nClassesMl); + // if (dielectroncuts.loadModelsFromCCDB) { + // ccdbApi.init(ccdburl); + // mlResponseSingleTrack.setModelPathsCCDB(dielectroncuts.onnxFileNames.value, ccdbApi, dielectroncuts.onnxPathsCCDB.value, dielectroncuts.timestampCCDB.value); + // } else { + // mlResponseSingleTrack.setModelPathsLocal(dielectroncuts.onnxFileNames.value); + // } + // mlResponseSingleTrack.cacheInputFeaturesIndices(dielectroncuts.namesInputFeatures); + // mlResponseSingleTrack.cacheBinningIndex(dielectroncuts.nameBinningFeature); + // mlResponseSingleTrack.init(dielectroncuts.enableOptimizations.value); + + // fDielectronCut.SetPIDMlResponse(&mlResponseSingleTrack); } // end of PID ML } @@ -840,11 +852,11 @@ struct PhotonHBT { continue; } if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut1.template IsSelectedTrack(pos1, collision) || !cut1.template IsSelectedTrack(ele1, collision)) { + if (!cut1.template IsSelectedTrack(pos1) || !cut1.template IsSelectedTrack(ele1)) { continue; } } else { // cut-based - if (!cut1.template IsSelectedTrack(pos1, collision) || !cut1.template IsSelectedTrack(ele1, collision)) { + if (!cut1.template IsSelectedTrack(pos1) || !cut1.template IsSelectedTrack(ele1)) { continue; } } @@ -868,11 +880,11 @@ struct PhotonHBT { continue; } if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut2.template IsSelectedTrack(pos2, collision) || !cut2.template IsSelectedTrack(ele2, collision)) { + if (!cut2.template IsSelectedTrack(pos2) || !cut2.template IsSelectedTrack(ele2)) { continue; } } else { // cut-based - if (!cut2.template IsSelectedTrack(pos2, collision) || !cut2.template IsSelectedTrack(ele2, collision)) { + if (!cut2.template IsSelectedTrack(pos2) || !cut2.template IsSelectedTrack(ele2)) { continue; } } @@ -986,11 +998,11 @@ struct PhotonHBT { continue; } if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut2.template IsSelectedTrack(pos2, collision) || !cut2.template IsSelectedTrack(ele2, collision)) { + if (!cut2.template IsSelectedTrack(pos2) || !cut2.template IsSelectedTrack(ele2)) { continue; } } else { // cut-based - if (!cut2.template IsSelectedTrack(pos2, collision) || !cut2.template IsSelectedTrack(ele2, collision)) { + if (!cut2.template IsSelectedTrack(pos2) || !cut2.template IsSelectedTrack(ele2)) { continue; } } @@ -1354,11 +1366,11 @@ struct PhotonHBT { continue; } if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut.template IsSelectedTrack(pos, collision) || !cut.template IsSelectedTrack(ele, collision)) { + if (!cut.template IsSelectedTrack(pos) || !cut.template IsSelectedTrack(ele)) { continue; } } else { // cut-based - if (!cut.template IsSelectedTrack(pos, collision) || !cut.template IsSelectedTrack(ele, collision)) { + if (!cut.template IsSelectedTrack(pos) || !cut.template IsSelectedTrack(ele)) { continue; } } diff --git a/PWGEM/Dilepton/Core/SingleTrackQC.h b/PWGEM/Dilepton/Core/SingleTrackQC.h index 4f9744ea769..e073b6e2907 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQC.h @@ -269,6 +269,7 @@ struct SingleTrackQC { // fRegistry.add("Track/positive/hTOFNsigmaKa", "TOF n sigma ka;p_{pv} (GeV/c);n #sigma_{K}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); // fRegistry.add("Track/positive/hTOFNsigmaPr", "TOF n sigma pr;p_{pv} (GeV/c);n #sigma_{p}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + fRegistry.add("Track/positive/hProbElBDT", "probability to be e from BDT;p_{in} (GeV/c);BDT score;", kTH2F, {{1000, 0, 10}, {100, 0, 1}}, false); fRegistry.add("Track/positive/hMeanClusterSizeITS", "mean cluster size ITS;p_{pv} (GeV/c); on ITS #times cos(#lambda);", kTH2F, {{1000, 0.f, 10.f}, {150, 0, 15}}, false); fRegistry.add("Track/positive/hMeanClusterSizeITSib", "mean cluster size ITS inner barrel;p_{pv} (GeV/c); on ITS #times cos(#lambda);", kTH2F, {{1000, 0.f, 10.f}, {150, 0, 15}}, false); fRegistry.add("Track/positive/hMeanClusterSizeITSob", "mean cluster size ITS outer barrel;p_{pv} (GeV/c); on ITS #times cos(#lambda);", kTH2F, {{1000, 0.f, 10.f}, {150, 0, 15}}, false); @@ -417,30 +418,42 @@ struct SingleTrackQC { // fDielectronCut.SetPRangeForITSNsigmaPr(dielectroncuts.cfg_min_p_ITSNsigmaPr, dielectroncuts.cfg_max_p_ITSNsigmaPr); if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { // please call this at the end of DefineDileptonCut - static constexpr int nClassesMl = 2; - const std::vector cutDirMl = {o2::cuts_ml::CutNot, o2::cuts_ml::CutSmaller}; - const std::vector labelsClasses = {"Background", "Signal"}; - const uint32_t nBinsMl = dielectroncuts.binsMl.value.size() - 1; - const std::vector labelsBins(nBinsMl, "bin"); - double cutsMlArr[nBinsMl][nClassesMl]; - for (uint32_t i = 0; i < nBinsMl; i++) { - cutsMlArr[i][0] = 0.; - cutsMlArr[i][1] = dielectroncuts.cutsMl.value[i]; - } - o2::framework::LabeledArray cutsMl = {cutsMlArr[0], nBinsMl, nClassesMl, labelsBins, labelsClasses}; - - mlResponseSingleTrack.configure(dielectroncuts.binsMl.value, cutsMl, cutDirMl, nClassesMl); - if (dielectroncuts.loadModelsFromCCDB) { - ccdbApi.init(ccdburl); - mlResponseSingleTrack.setModelPathsCCDB(dielectroncuts.onnxFileNames.value, ccdbApi, dielectroncuts.onnxPathsCCDB.value, dielectroncuts.timestampCCDB.value); - } else { - mlResponseSingleTrack.setModelPathsLocal(dielectroncuts.onnxFileNames.value); - } - mlResponseSingleTrack.cacheInputFeaturesIndices(dielectroncuts.namesInputFeatures); - mlResponseSingleTrack.cacheBinningIndex(dielectroncuts.nameBinningFeature); - mlResponseSingleTrack.init(dielectroncuts.enableOptimizations.value); - - fDielectronCut.SetPIDMlResponse(&mlResponseSingleTrack); + std::vector binsML{}; + binsML.reserve(dielectroncuts.binsMl.value.size()); + for (size_t i = 0; i < dielectroncuts.binsMl.value.size(); i++) { + binsML.emplace_back(dielectroncuts.binsMl.value[i]); + } + std::vector thresholdsML{}; + thresholdsML.reserve(dielectroncuts.cutsMl.value.size()); + for (size_t i = 0; i < dielectroncuts.cutsMl.value.size(); i++) { + thresholdsML.emplace_back(dielectroncuts.cutsMl.value[i]); + } + fDielectronCut.SetMLThresholds(binsML, thresholdsML); + + // static constexpr int nClassesMl = 2; + // const std::vector cutDirMl = {o2::cuts_ml::CutNot, o2::cuts_ml::CutSmaller}; + // const std::vector labelsClasses = {"Background", "Signal"}; + // const uint32_t nBinsMl = dielectroncuts.binsMl.value.size() - 1; + // const std::vector labelsBins(nBinsMl, "bin"); + // double cutsMlArr[nBinsMl][nClassesMl]; + // for (uint32_t i = 0; i < nBinsMl; i++) { + // cutsMlArr[i][0] = 0.; + // cutsMlArr[i][1] = dielectroncuts.cutsMl.value[i]; + // } + // o2::framework::LabeledArray cutsMl = {cutsMlArr[0], nBinsMl, nClassesMl, labelsBins, labelsClasses}; + + // mlResponseSingleTrack.configure(dielectroncuts.binsMl.value, cutsMl, cutDirMl, nClassesMl); + // if (dielectroncuts.loadModelsFromCCDB) { + // ccdbApi.init(ccdburl); + // mlResponseSingleTrack.setModelPathsCCDB(dielectroncuts.onnxFileNames.value, ccdbApi, dielectroncuts.onnxPathsCCDB.value, dielectroncuts.timestampCCDB.value); + // } else { + // mlResponseSingleTrack.setModelPathsLocal(dielectroncuts.onnxFileNames.value); + // } + // mlResponseSingleTrack.cacheInputFeaturesIndices(dielectroncuts.namesInputFeatures); + // mlResponseSingleTrack.cacheBinningIndex(dielectroncuts.nameBinningFeature); + // mlResponseSingleTrack.init(dielectroncuts.enableOptimizations.value); + + // fDielectronCut.SetPIDMlResponse(&mlResponseSingleTrack); } // end of PID ML } @@ -499,6 +512,7 @@ struct SingleTrackQC { fRegistry.fill(HIST("Track/positive/hTPCdEdx"), track.tpcInnerParam(), track.tpcSignal()); fRegistry.fill(HIST("Track/positive/hTOFbeta"), track.p(), track.beta()); + fRegistry.fill(HIST("Track/positive/hProbElBDT"), track.tpcInnerParam(), track.probElBDT()); fRegistry.fill(HIST("Track/positive/hMeanClusterSizeITS"), track.p(), track.meanClusterSizeITS() * std::cos(std::atan(track.tgl()))); fRegistry.fill(HIST("Track/positive/hMeanClusterSizeITSib"), track.p(), track.meanClusterSizeITSib() * std::cos(std::atan(track.tgl()))); fRegistry.fill(HIST("Track/positive/hMeanClusterSizeITSob"), track.p(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); @@ -539,6 +553,7 @@ struct SingleTrackQC { fRegistry.fill(HIST("Track/negative/hTPCdEdx"), track.tpcInnerParam(), track.tpcSignal()); fRegistry.fill(HIST("Track/negative/hTOFbeta"), track.p(), track.beta()); + fRegistry.fill(HIST("Track/negative/hProbElBDT"), track.tpcInnerParam(), track.probElBDT()); fRegistry.fill(HIST("Track/negative/hMeanClusterSizeITS"), track.p(), track.meanClusterSizeITS() * std::cos(std::atan(track.tgl()))); fRegistry.fill(HIST("Track/negative/hMeanClusterSizeITSib"), track.p(), track.meanClusterSizeITSib() * std::cos(std::atan(track.tgl()))); fRegistry.fill(HIST("Track/negative/hMeanClusterSizeITSob"), track.p(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); @@ -643,11 +658,11 @@ struct SingleTrackQC { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { for (const auto& track : tracks_per_coll) { if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut.template IsSelectedTrack(track, collision)) { + if (!cut.template IsSelectedTrack(track)) { continue; } } else { // cut-based - if (!cut.template IsSelectedTrack(track)) { + if (!cut.template IsSelectedTrack(track)) { continue; } } @@ -698,11 +713,11 @@ struct SingleTrackQC { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { for (const auto& track : tracks_per_coll) { if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut.template IsSelectedTrack(track, collision)) { + if (!cut.template IsSelectedTrack(track)) { continue; } } else { // cut-based - if (!cut.template IsSelectedTrack(track)) { + if (!cut.template IsSelectedTrack(track)) { continue; } } diff --git a/PWGEM/Dilepton/Core/SingleTrackQCMC.h b/PWGEM/Dilepton/Core/SingleTrackQCMC.h index 95e4bc97507..16025e245af 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQCMC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQCMC.h @@ -487,30 +487,42 @@ struct SingleTrackQCMC { // fDielectronCut.SetPRangeForITSNsigmaPr(dielectroncuts.cfg_min_p_ITSNsigmaPr, dielectroncuts.cfg_max_p_ITSNsigmaPr); if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { // please call this at the end of DefineDileptonCut - static constexpr int nClassesMl = 2; - const std::vector cutDirMl = {o2::cuts_ml::CutNot, o2::cuts_ml::CutSmaller}; - const std::vector labelsClasses = {"Background", "Signal"}; - const uint32_t nBinsMl = dielectroncuts.binsMl.value.size() - 1; - const std::vector labelsBins(nBinsMl, "bin"); - double cutsMlArr[nBinsMl][nClassesMl]; - for (uint32_t i = 0; i < nBinsMl; i++) { - cutsMlArr[i][0] = 0.; - cutsMlArr[i][1] = dielectroncuts.cutsMl.value[i]; + std::vector binsML{}; + binsML.reserve(dielectroncuts.binsMl.value.size()); + for (size_t i = 0; i < dielectroncuts.binsMl.value.size(); i++) { + binsML.emplace_back(dielectroncuts.binsMl.value[i]); } - o2::framework::LabeledArray cutsMl = {cutsMlArr[0], nBinsMl, nClassesMl, labelsBins, labelsClasses}; - - mlResponseSingleTrack.configure(dielectroncuts.binsMl.value, cutsMl, cutDirMl, nClassesMl); - if (dielectroncuts.loadModelsFromCCDB) { - ccdbApi.init(ccdburl); - mlResponseSingleTrack.setModelPathsCCDB(dielectroncuts.onnxFileNames.value, ccdbApi, dielectroncuts.onnxPathsCCDB.value, dielectroncuts.timestampCCDB.value); - } else { - mlResponseSingleTrack.setModelPathsLocal(dielectroncuts.onnxFileNames.value); + std::vector thresholdsML{}; + thresholdsML.reserve(dielectroncuts.cutsMl.value.size()); + for (size_t i = 0; i < dielectroncuts.cutsMl.value.size(); i++) { + thresholdsML.emplace_back(dielectroncuts.cutsMl.value[i]); } - mlResponseSingleTrack.cacheInputFeaturesIndices(dielectroncuts.namesInputFeatures); - mlResponseSingleTrack.cacheBinningIndex(dielectroncuts.nameBinningFeature); - mlResponseSingleTrack.init(dielectroncuts.enableOptimizations.value); + fDielectronCut.SetMLThresholds(binsML, thresholdsML); + + // static constexpr int nClassesMl = 2; + // const std::vector cutDirMl = {o2::cuts_ml::CutNot, o2::cuts_ml::CutSmaller}; + // const std::vector labelsClasses = {"Background", "Signal"}; + // const uint32_t nBinsMl = dielectroncuts.binsMl.value.size() - 1; + // const std::vector labelsBins(nBinsMl, "bin"); + // double cutsMlArr[nBinsMl][nClassesMl]; + // for (uint32_t i = 0; i < nBinsMl; i++) { + // cutsMlArr[i][0] = 0.; + // cutsMlArr[i][1] = dielectroncuts.cutsMl.value[i]; + // } + // o2::framework::LabeledArray cutsMl = {cutsMlArr[0], nBinsMl, nClassesMl, labelsBins, labelsClasses}; + + // mlResponseSingleTrack.configure(dielectroncuts.binsMl.value, cutsMl, cutDirMl, nClassesMl); + // if (dielectroncuts.loadModelsFromCCDB) { + // ccdbApi.init(ccdburl); + // mlResponseSingleTrack.setModelPathsCCDB(dielectroncuts.onnxFileNames.value, ccdbApi, dielectroncuts.onnxPathsCCDB.value, dielectroncuts.timestampCCDB.value); + // } else { + // mlResponseSingleTrack.setModelPathsLocal(dielectroncuts.onnxFileNames.value); + // } + // mlResponseSingleTrack.cacheInputFeaturesIndices(dielectroncuts.namesInputFeatures); + // mlResponseSingleTrack.cacheBinningIndex(dielectroncuts.nameBinningFeature); + // mlResponseSingleTrack.init(dielectroncuts.enableOptimizations.value); - fDielectronCut.SetPIDMlResponse(&mlResponseSingleTrack); + // fDielectronCut.SetPIDMlResponse(&mlResponseSingleTrack); } // end of PID ML } @@ -806,11 +818,11 @@ struct SingleTrackQCMC { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut.template IsSelectedTrack(track, collision)) { + if (!cut.template IsSelectedTrack(track)) { continue; } } else { // cut-based - if (!cut.template IsSelectedTrack(track)) { + if (!cut.template IsSelectedTrack(track)) { continue; } } @@ -1001,11 +1013,11 @@ struct SingleTrackQCMC { } if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut.template IsSelectedTrack(track, collision)) { + if (!cut.template IsSelectedTrack(track)) { continue; } } else { // cut-based - if (!cut.template IsSelectedTrack(track)) { + if (!cut.template IsSelectedTrack(track)) { continue; } } diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx index bf1e2b61505..0f9cb82aa55 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx @@ -174,6 +174,7 @@ struct skimmerPrimaryElectron { fRegistry.add("Track/hMeanClusterSizeITS", "mean cluster size ITS;p_{pv} (GeV/c); #times cos(#lambda)", kTH2F, {{1000, 0, 10}, {150, 0, 15}}, false); fRegistry.add("Track/hMeanClusterSizeITSib", "mean cluster size ITSib;p_{pv} (GeV/c); #times cos(#lambda)", kTH2F, {{1000, 0, 10}, {150, 0, 15}}, false); fRegistry.add("Track/hMeanClusterSizeITSob", "mean cluster size ITSob;p_{pv} (GeV/c); #times cos(#lambda)", kTH2F, {{1000, 0, 10}, {150, 0, 15}}, false); + fRegistry.add("Track/hProbElBDT", "probability to be e from BDT;p_{in} (GeV/c);BDT score;", kTH2F, {{1000, 0, 10}, {100, 0, 1}}, false); } if (usePIDML) { @@ -370,20 +371,62 @@ struct skimmerPrimaryElectron { return true; } - template - bool isElectron(TTrack const& track) + template + bool isElectron(TCollision const& collision, TTrack const& track, float& probaEl) { + probaEl = 1.f; if (includeITSsa && (track.hasITS() && !track.hasTPC() && !track.hasTRD() && !track.hasTOF())) { return true; } if (usePIDML) { - return true; + if (!isElectron_TOFif(track)) { + return false; + } + o2::dataformats::DCA mDcaInfoCov; + mDcaInfoCov.set(999, 999, 999, 999, 999); + auto trackParCov = getTrackParCov(track); + trackParCov.setPID(o2::track::PID::Electron); + mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); + mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + + std::vector inputFeatures = mlResponseSingleTrack.getInputFeatures(track, trackParCov, collision); + float binningFeature = mlResponseSingleTrack.getBinningFeature(track, trackParCov, collision); + + // std::vector outputs = {}; + // bool isSelected = mlResponseSingleTrack.isSelectedMl(inputFeatures, binningFeature, outputs); // 0: hadron, 1:electron + // probaEl = outputs[1]; + // outputs.clear(); + // outputs.shrink_to_fit(); + + // std::vector inputFeatures = mlResponseSingleTrack.getInputFeatures(track, trackParCov, collision); + // float binningFeature = mlResponseSingleTrack.getBinningFeature(track, trackParCov, collision); + + int pbin = lower_bound(binsMl.value.begin(), binsMl.value.end(), binningFeature) - binsMl.value.begin() - 1; + if (pbin < 0) { + pbin = 0; + } else if (static_cast(binsMl.value.size()) - 2 < pbin) { + pbin = static_cast(binsMl.value.size()) - 2; + } + // LOGF(info, "track.tpcInnerParam() = %f (GeV/c), pbin = %d", track.tpcInnerParam(), pbin); + + probaEl = mlResponseSingleTrack.getModelOutput(inputFeatures, pbin)[1]; // 0: hadron, 1:electron + return probaEl > cutsMl.value[pbin]; + // return isSelected; } else { return isElectron_TPChadrej(track) || isElectron_TOFreq(track); } } + template + bool isElectron_TOFif(TTrack const& track) + { + bool is_EL_TPC = minTPCNsigmaEl < track.tpcNSigmaEl() && track.tpcNSigmaEl() < maxTPCNsigmaEl; + bool is_EL_TOF = track.hasTOF() ? (std::fabs(track.tofNSigmaEl()) < maxTOFNsigmaEl) : true; // TOFif + return is_EL_TPC && is_EL_TOF; + } + template bool isElectron_TPChadrej(TTrack const& track) { @@ -415,7 +458,7 @@ struct skimmerPrimaryElectron { } template - void fillTrackTable(TCollision const& collision, TTrack const& track) + void fillTrackTable(TCollision const& collision, TTrack const& track, const float probaEl) { if (std::find(stored_trackIds.begin(), stored_trackIds.end(), std::pair{collision.globalIndex(), track.globalIndex()}) == stored_trackIds.end()) { o2::dataformats::DCA mDcaInfoCov; @@ -439,13 +482,6 @@ struct skimmerPrimaryElectron { mcTunedTPCSignal = track.mcTunedTPCSignal(); } - float probaEl = 1.0; - if (usePIDML) { - std::vector inputFeatures = mlResponseSingleTrack.getInputFeatures(track, trackParCov, collision); - float binningFeature = mlResponseSingleTrack.getBinningFeature(track, trackParCov, collision); - probaEl = mlResponseSingleTrack.isSelectedMl(inputFeatures, binningFeature); - } - emprimaryelectrons(collision.globalIndex(), track.globalIndex(), track.sign(), pt_recalc, eta_recalc, phi_recalc, dcaXY, dcaZ, trackParCov.getSigmaY2(), trackParCov.getSigmaZY(), trackParCov.getSigmaZ2(), @@ -545,6 +581,7 @@ struct skimmerPrimaryElectron { fRegistry.fill(HIST("Track/hMeanClusterSizeITS"), trackParCov.getP(), static_cast(total_cluster_size) / static_cast(nl) * std::cos(std::atan(trackParCov.getTgl()))); fRegistry.fill(HIST("Track/hMeanClusterSizeITSib"), trackParCov.getP(), static_cast(total_cluster_size_ib) / static_cast(nl_ib) * std::cos(std::atan(trackParCov.getTgl()))); fRegistry.fill(HIST("Track/hMeanClusterSizeITSob"), trackParCov.getP(), static_cast(total_cluster_size_ob) / static_cast(nl_ob) * std::cos(std::atan(trackParCov.getTgl()))); + fRegistry.fill(HIST("Track/hProbElBDT"), track.tpcInnerParam(), probaEl); } } } @@ -573,10 +610,11 @@ struct skimmerPrimaryElectron { auto tracks_per_coll = tracks.sliceBy(perCol, collision.globalIndex()); for (const auto& track : tracks_per_coll) { - if (!checkTrack(collision, track) || !isElectron(track)) { + float probaEl = 1.0; + if (!checkTrack(collision, track) || !isElectron(collision, track, probaEl)) { continue; } - fillTrackTable(collision, track); + fillTrackTable(collision, track, probaEl); } } // end of collision loop @@ -602,10 +640,11 @@ struct skimmerPrimaryElectron { for (const auto& trackId : trackIdsThisCollision) { auto track = trackId.template track_as(); - if (!checkTrack(collision, track) || !isElectron(track)) { + float probaEl = 1.0; + if (!checkTrack(collision, track) || !isElectron(collision, track, probaEl)) { continue; } - fillTrackTable(collision, track); + fillTrackTable(collision, track, probaEl); } } // end of collision loop @@ -632,10 +671,11 @@ struct skimmerPrimaryElectron { auto tracks_per_coll = tracks.sliceBy(perCol, collision.globalIndex()); for (const auto& track : tracks_per_coll) { - if (!checkTrack(collision, track) || !isElectron(track)) { + float probaEl = 1.0; + if (!checkTrack(collision, track) || !isElectron(collision, track, probaEl)) { continue; } - fillTrackTable(collision, track); + fillTrackTable(collision, track, probaEl); } } // end of collision loop @@ -664,10 +704,11 @@ struct skimmerPrimaryElectron { for (const auto& trackId : trackIdsThisCollision) { auto track = trackId.template track_as(); - if (!checkTrack(collision, track) || !isElectron(track)) { + float probaEl = 1.0; + if (!checkTrack(collision, track) || !isElectron(collision, track, probaEl)) { continue; } - fillTrackTable(collision, track); + fillTrackTable(collision, track, probaEl); } } // end of collision loop @@ -698,10 +739,11 @@ struct skimmerPrimaryElectron { auto tracks_per_coll = tracks.sliceBy(perCol, collision.globalIndex()); for (const auto& track : tracks_per_coll) { - if (!checkTrack(collision, track) || !isElectron(track)) { + float probaEl = 1.0; + if (!checkTrack(collision, track) || !isElectron(collision, track, probaEl)) { continue; } - fillTrackTable(collision, track); + fillTrackTable(collision, track, probaEl); } } // end of collision loop @@ -729,10 +771,11 @@ struct skimmerPrimaryElectron { for (const auto& trackId : trackIdsThisCollision) { auto track = trackId.template track_as(); - if (!checkTrack(collision, track) || !isElectron(track)) { + float probaEl = 1.0; + if (!checkTrack(collision, track) || !isElectron(collision, track, probaEl)) { continue; } - fillTrackTable(collision, track); + fillTrackTable(collision, track, probaEl); } } // end of collision loop diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx index 68b0fad8593..89fc6cd09c3 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx @@ -187,6 +187,7 @@ struct skimmerPrimaryElectronQC { fRegistry.add("Track/hMeanClusterSizeITS", "mean cluster size ITS;p_{pv} (GeV/c); #times cos(#lambda)", kTH2F, {{1000, 0, 10}, {150, 0, 15}}, false); fRegistry.add("Track/hMeanClusterSizeITSib", "mean cluster size ITSib;p_{pv} (GeV/c); #times cos(#lambda)", kTH2F, {{1000, 0, 10}, {150, 0, 15}}, false); fRegistry.add("Track/hMeanClusterSizeITSob", "mean cluster size ITSob;p_{pv} (GeV/c); #times cos(#lambda)", kTH2F, {{1000, 0, 10}, {150, 0, 15}}, false); + fRegistry.add("Track/hProbElBDT", "probability to be e from BDT;p_{in} (GeV/c);BDT score;", kTH2F, {{1000, 0, 10}, {100, 0, 1}}, false); fRegistry.add("Pair/hMvsPhiV", "m_{ee} vs. #varphi_{V} ULS;#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", kTH2F, {{180, 0.f, M_PI}, {100, 0, 0.1}}); } @@ -467,7 +468,14 @@ struct skimmerPrimaryElectronQC { if (usePIDML) { std::vector inputFeatures = mlResponseSingleTrack.getInputFeatures(track, trackParCov, collision); float binningFeature = mlResponseSingleTrack.getBinningFeature(track, trackParCov, collision); - probaEl = mlResponseSingleTrack.isSelectedMl(inputFeatures, binningFeature); + + int pbin = lower_bound(binsMl.value.begin(), binsMl.value.end(), binningFeature) - binsMl.value.begin() - 1; + if (pbin < 0) { + pbin = 0; + } else if (static_cast(binsMl.value.size()) - 2 < pbin) { + pbin = static_cast(binsMl.value.size()) - 2; + } + probaEl = mlResponseSingleTrack.getModelOutput(inputFeatures, pbin)[1]; // 0: hadron, 1:electron } emprimaryelectrons(collision.globalIndex(), track.globalIndex(), track.sign(), @@ -566,6 +574,7 @@ struct skimmerPrimaryElectronQC { fRegistry.fill(HIST("Track/hMeanClusterSizeITS"), trackParCov.getP(), static_cast(total_cluster_size) / static_cast(nl) * std::cos(std::atan(trackParCov.getTgl()))); fRegistry.fill(HIST("Track/hMeanClusterSizeITSib"), trackParCov.getP(), static_cast(total_cluster_size_ib) / static_cast(nl_ib) * std::cos(std::atan(trackParCov.getTgl()))); fRegistry.fill(HIST("Track/hMeanClusterSizeITSob"), trackParCov.getP(), static_cast(total_cluster_size_ob) / static_cast(nl_ob) * std::cos(std::atan(trackParCov.getTgl()))); + fRegistry.fill(HIST("Track/hProbElBDT"), track.tpcInnerParam(), probaEl); } } } @@ -607,7 +616,6 @@ struct skimmerPrimaryElectronQC { std::vector> stored_trackIds; Filter trackFilter = trackcut.minpt < o2::aod::track::pt && nabs(o2::aod::track::eta) < trackcut.maxeta && o2::aod::track::itsChi2NCl < trackcut.maxchi2its && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true; - Filter pidFilter = trackcut.minTPCNsigmaEl < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < trackcut.maxTPCNsigmaEl; using MyFilteredTracks = soa::Filtered; Partition posTracks = o2::aod::track::signed1Pt > 0.f; @@ -642,15 +650,6 @@ struct skimmerPrimaryElectronQC { } } - // if (isDielectronFromPi0(collision, pos, ele)) { - // if ((checkTrackTight(collision, pos) && isElectronTight(pos)) && (checkTrack(collision, ele) && isElectron(ele)) ) { - // fillTrackTable(collision, ele); - // } - // if ((checkTrackTight(collision, ele) && isElectronTight(ele)) && (checkTrack(collision, pos) && isElectron(pos)) ) { - // fillTrackTable(collision, pos); - // } - // } - } // end of ULS pairing } // end of collision loop @@ -690,15 +689,6 @@ struct skimmerPrimaryElectronQC { } } - // if (isDielectronFromPi0(collision, pos, ele)) { - // if ((checkTrackTight(collision, pos) && isElectronTight(pos)) && (checkTrack(collision, ele) && isElectron(ele)) ) { - // fillTrackTable(collision, ele); - // } - // if ((checkTrackTight(collision, ele) && isElectronTight(ele)) && (checkTrack(collision, pos) && isElectron(pos)) ) { - // fillTrackTable(collision, pos); - // } - // } - } // end of ULS pairing } // end of collision loop @@ -741,15 +731,6 @@ struct skimmerPrimaryElectronQC { } } - // if (isDielectronFromPi0(collision, pos, ele)) { - // if ((checkTrackTight(collision, pos) && isElectronTight(pos)) && (checkTrack(collision, ele) && isElectron(ele)) ) { - // fillTrackTable(collision, ele); - // } - // if ((checkTrackTight(collision, ele) && isElectronTight(ele)) && (checkTrack(collision, pos) && isElectron(pos)) ) { - // fillTrackTable(collision, pos); - // } - // } - } // end of ULS pairing } // end of collision loop diff --git a/PWGEM/Dilepton/Tasks/prefilterDielectron.cxx b/PWGEM/Dilepton/Tasks/prefilterDielectron.cxx index d3a12ec6481..711bcc72c48 100644 --- a/PWGEM/Dilepton/Tasks/prefilterDielectron.cxx +++ b/PWGEM/Dilepton/Tasks/prefilterDielectron.cxx @@ -317,30 +317,42 @@ struct prefilterDielectron { fDielectronCut.SetTOFNsigmaElRange(dielectroncuts.cfg_min_TOFNsigmaEl, dielectroncuts.cfg_max_TOFNsigmaEl); if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { // please call this at the end of DefineDileptonCut - static constexpr int nClassesMl = 2; - const std::vector cutDirMl = {o2::cuts_ml::CutSmaller, o2::cuts_ml::CutNot}; - const std::vector labelsClasses = {"Signal", "Background"}; - const uint32_t nBinsMl = dielectroncuts.binsMl.value.size() - 1; - const std::vector labelsBins(nBinsMl, "bin"); - double cutsMlArr[nBinsMl][nClassesMl]; - for (uint32_t i = 0; i < nBinsMl; i++) { - cutsMlArr[i][0] = dielectroncuts.cutsMl.value[i]; - cutsMlArr[i][1] = 0.; + std::vector binsML{}; + binsML.reserve(dielectroncuts.binsMl.value.size()); + for (size_t i = 0; i < dielectroncuts.binsMl.value.size(); i++) { + binsML.emplace_back(dielectroncuts.binsMl.value[i]); } - o2::framework::LabeledArray cutsMl = {cutsMlArr[0], nBinsMl, nClassesMl, labelsBins, labelsClasses}; - - mlResponseSingleTrack.configure(dielectroncuts.binsMl.value, cutsMl, cutDirMl, nClassesMl); - if (dielectroncuts.loadModelsFromCCDB) { - ccdbApi.init(ccdburl); - mlResponseSingleTrack.setModelPathsCCDB(dielectroncuts.onnxFileNames.value, ccdbApi, dielectroncuts.onnxPathsCCDB.value, dielectroncuts.timestampCCDB.value); - } else { - mlResponseSingleTrack.setModelPathsLocal(dielectroncuts.onnxFileNames.value); + std::vector thresholdsML{}; + thresholdsML.reserve(dielectroncuts.cutsMl.value.size()); + for (size_t i = 0; i < dielectroncuts.cutsMl.value.size(); i++) { + thresholdsML.emplace_back(dielectroncuts.cutsMl.value[i]); } - mlResponseSingleTrack.cacheInputFeaturesIndices(dielectroncuts.namesInputFeatures); - mlResponseSingleTrack.cacheBinningIndex(dielectroncuts.nameBinningFeature); - mlResponseSingleTrack.init(dielectroncuts.enableOptimizations.value); - - fDielectronCut.SetPIDMlResponse(&mlResponseSingleTrack); + fDielectronCut.SetMLThresholds(binsML, thresholdsML); + + // static constexpr int nClassesMl = 2; + // const std::vector cutDirMl = {o2::cuts_ml::CutSmaller, o2::cuts_ml::CutNot}; + // const std::vector labelsClasses = {"Signal", "Background"}; + // const uint32_t nBinsMl = dielectroncuts.binsMl.value.size() - 1; + // const std::vector labelsBins(nBinsMl, "bin"); + // double cutsMlArr[nBinsMl][nClassesMl]; + // for (uint32_t i = 0; i < nBinsMl; i++) { + // cutsMlArr[i][0] = dielectroncuts.cutsMl.value[i]; + // cutsMlArr[i][1] = 0.; + // } + // o2::framework::LabeledArray cutsMl = {cutsMlArr[0], nBinsMl, nClassesMl, labelsBins, labelsClasses}; + + // mlResponseSingleTrack.configure(dielectroncuts.binsMl.value, cutsMl, cutDirMl, nClassesMl); + // if (dielectroncuts.loadModelsFromCCDB) { + // ccdbApi.init(ccdburl); + // mlResponseSingleTrack.setModelPathsCCDB(dielectroncuts.onnxFileNames.value, ccdbApi, dielectroncuts.onnxPathsCCDB.value, dielectroncuts.timestampCCDB.value); + // } else { + // mlResponseSingleTrack.setModelPathsLocal(dielectroncuts.onnxFileNames.value); + // } + // mlResponseSingleTrack.cacheInputFeaturesIndices(dielectroncuts.namesInputFeatures); + // mlResponseSingleTrack.cacheBinningIndex(dielectroncuts.nameBinningFeature); + // mlResponseSingleTrack.init(dielectroncuts.enableOptimizations.value); + + // fDielectronCut.SetPIDMlResponse(&mlResponseSingleTrack); } // end of PID ML } diff --git a/PWGEM/Dilepton/Utils/MlResponseO2Track.h b/PWGEM/Dilepton/Utils/MlResponseO2Track.h index ae0c17096fb..5e1f2fc4226 100644 --- a/PWGEM/Dilepton/Utils/MlResponseO2Track.h +++ b/PWGEM/Dilepton/Utils/MlResponseO2Track.h @@ -161,6 +161,7 @@ enum class InputFeaturesO2Track : uint8_t { tpctofNSigmaPr, tpcNClsFound, tpcNClsCrossedRows, + tpcChi2NCl, hasITS, hasTPC, hasTRD, @@ -215,6 +216,7 @@ class MlResponseO2Track : public MlResponse CHECK_AND_FILL_O2_TRACK_TPCTOF(tpctofNSigmaPr, tpcNSigmaPr, tofNSigmaPr, hasTOF); CHECK_AND_FILL_O2_TRACK(tpcNClsFound); CHECK_AND_FILL_O2_TRACK(tpcNClsCrossedRows); + CHECK_AND_FILL_O2_TRACK(tpcChi2NCl); CHECK_AND_FILL_O2_TRACK(hasITS); CHECK_AND_FILL_O2_TRACK(hasTPC); CHECK_AND_FILL_O2_TRACK(hasTRD); @@ -295,6 +297,7 @@ class MlResponseO2Track : public MlResponse FILL_MAP_O2_TRACK(tpctofNSigmaPr), FILL_MAP_O2_TRACK(tpcNClsFound), FILL_MAP_O2_TRACK(tpcNClsCrossedRows), + FILL_MAP_O2_TRACK(tpcChi2NCl), FILL_MAP_O2_TRACK(hasITS), FILL_MAP_O2_TRACK(hasTPC), FILL_MAP_O2_TRACK(hasTRD), From 36f3eb5c45cb465b227ba228fece7734765d5fd8 Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Fri, 22 Aug 2025 16:22:00 +0530 Subject: [PATCH 145/986] [PWGLF] optimised code (#12682) Co-authored-by: Sawan Sawan --- PWGLF/Tasks/Resonances/k892analysis.cxx | 135 +++++++++++++++++++----- PWGLF/Tasks/Resonances/kstarqa.cxx | 56 ++-------- 2 files changed, 121 insertions(+), 70 deletions(-) diff --git a/PWGLF/Tasks/Resonances/k892analysis.cxx b/PWGLF/Tasks/Resonances/k892analysis.cxx index 34e4cc662a0..f095fcb3d9a 100644 --- a/PWGLF/Tasks/Resonances/k892analysis.cxx +++ b/PWGLF/Tasks/Resonances/k892analysis.cxx @@ -15,19 +15,23 @@ /// /// \author Bong-Hwi Lim , Sawan Sawan -#include -#include "TF1.h" -#include "TRandom3.h" +#include "PWGLF/DataModel/LFResonanceTables.h" +#include "PWGLF/DataModel/mcCentrality.h" +#include "PWGLF/Utils/inelGt.h" -#include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" -#include "Framework/AnalysisTask.h" +#include "Common/DataModel/PIDResponse.h" + +#include "CommonConstants/PhysicsConstants.h" +#include "DataFormatsParameters/GRPObject.h" #include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" -#include "PWGLF/DataModel/LFResonanceTables.h" -#include "DataFormatsParameters/GRPObject.h" -#include "CommonConstants/PhysicsConstants.h" + +#include "TF1.h" +#include "TRandom3.h" +#include using namespace o2; using namespace o2::framework; @@ -59,6 +63,9 @@ struct K892analysis { Configurable invmass1D{"invmass1D", false, "Invariant mass 1D"}; Configurable studyAntiparticle{"studyAntiparticle", false, "Study anti-particles separately"}; Configurable fillPidPlots{"fillPidPlots", false, "Make TPC and TOF PID plots"}; + Configurable cisInelGt0{"cisInelGt0", true, "check if INEL>0"}; + Configurable cMCCent{"cMCCent", true, "Using calibrated MC centrality (for FT0M)"}; + // Configurable applyOccupancyCut{"applyOccupancyCut", false, "Apply occupancy cut"}; // Configurable occupancyCut{"occupancyCut", 1000, "Mimimum Occupancy cut"}; @@ -426,11 +433,11 @@ struct K892analysis { return false; } - template - void fillHistograms(const CollisionType& collision, const TracksType& dTracks1, const TracksType& dTracks2) + template + void fillHistograms(const CollisionType& collision, const TracksType& dTracks1, const TracksType& dTracks2, const Multdatamc& multiplicity) { // auto multNTracksPV = collision.multNTracksPV(); - auto multiplicity = collision.cent(); + // auto multiplicity = collision.cent(); if (additionalEvsel && !eventSelected(collision, multiplicity)) { return; } @@ -703,28 +710,105 @@ struct K892analysis { } } - void processDataLight(aod::ResoCollision const& collision, - aod::ResoTracks const& resotracks) + void processDataLight(aod::ResoCollision const& resocollisions, aod::ResoCollisionColls const& collisionIndex, soa::Join const& collisions, aod::ResoTracks const& resotracks) { // LOG(info) << "new collision, zvtx: " << collision.posZ(); + if (cisInelGt0) { + auto linkRow = collisionIndex.iteratorAt(resocollisions.globalIndex()); + auto collId = linkRow.collisionId(); // Take original collision global index matched with resoCollision + + auto coll = collisions.iteratorAt(collId); // Take original collision matched with resoCollision + + if (!coll.isInelGt0()) // Check reco INELgt0 (at least one PV track in |eta| < 1) about the collision + return; + } if (additionalQAeventPlots) histos.fill(HIST("QAevent/hEvtCounterSameE"), 1.0); - fillHistograms(collision, resotracks, resotracks); + auto multiplicity = resocollisions.cent(); + fillHistograms(resocollisions, resotracks, resotracks, multiplicity); } PROCESS_SWITCH(K892analysis, processDataLight, "Process Event for data", false); - void processMCLight(ResoMCCols::iterator const& collision, - soa::Join const& resotracks) + void processMCLight(ResoMCCols::iterator const& resoCollision, + aod::ResoCollisionColls const& collisionIndex, + soa::Join const& collisionsMC, + soa::Join const& resoTracks, + soa::Join const&) { - if (!collision.isInAfterAllCuts() || (std::abs(collision.posZ()) > cZvertCutMC)) // MC event selection, all cuts missing vtx cut + float multiplicity; + if (cMCCent && cisInelGt0) { + auto linkRow = collisionIndex.iteratorAt(resoCollision.globalIndex()); + auto collId = linkRow.collisionId(); // Take original collision global index matched with resoCollision + + auto coll = collisionsMC.iteratorAt(collId); // Take original collision matched with resoCollision + + if (!coll.isInelGt0()) // Check reco INELgt0 (at least one PV track in |eta| < 1) about the collision + return; + + auto mcColl = coll.mcCollision_as>(); + multiplicity = mcColl.centFT0M(); + } else if (!cMCCent && cisInelGt0) { + auto linkRow = collisionIndex.iteratorAt(resoCollision.globalIndex()); + auto collId = linkRow.collisionId(); // Take original collision global index matched with resoCollision + + auto coll = collisionsMC.iteratorAt(collId); // Take original collision matched with resoCollision + + if (!coll.isInelGt0()) // Check reco INELgt0 (at least one PV track in |eta| < 1) about the collision + return; + + multiplicity = resoCollision.cent(); + } else if (cMCCent && !cisInelGt0) { + auto linkRow = collisionIndex.iteratorAt(resoCollision.globalIndex()); + auto collId = linkRow.collisionId(); // Take original collision global index matched with resoCollision + + auto coll = collisionsMC.iteratorAt(collId); // Take original collision matched with resoCollision + + auto mcColl = coll.mcCollision_as>(); + multiplicity = mcColl.centFT0M(); + } else { + multiplicity = resoCollision.cent(); + } + if (!resoCollision.isInAfterAllCuts() || (std::abs(resoCollision.posZ()) > cZvertCutMC)) // MC event selection, all cuts missing vtx cut return; - fillHistograms(collision, resotracks, resotracks); + fillHistograms(resoCollision, resoTracks, resoTracks, multiplicity); } PROCESS_SWITCH(K892analysis, processMCLight, "Process Event for MC (Reconstructed)", false); - void processMCTrue(ResoMCCols::iterator const& collision, aod::ResoMCParents const& resoParents) + void processMCTrue(ResoMCCols::iterator const& resoCollision, aod::ResoCollisionColls const& collisionIndex, aod::ResoMCParents const& resoParents, aod::ResoCollisionCandidatesMC const& collisionsMC, soa::Join const&) { - auto multiplicity = collision.cent(); + float multiplicity; + if (cMCCent && cisInelGt0) { + auto linkRow = collisionIndex.iteratorAt(resoCollision.globalIndex()); + auto collId = linkRow.collisionId(); // Take original collision global index matched with resoCollision + + auto coll = collisionsMC.iteratorAt(collId); // Take original collision matched with resoCollision + + if (!coll.isInelGt0()) // Check reco INELgt0 (at least one PV track in |eta| < 1) about the collision + return; + + auto mcColl = coll.mcCollision_as>(); + multiplicity = mcColl.centFT0M(); + } else if (!cMCCent && cisInelGt0) { + auto linkRow = collisionIndex.iteratorAt(resoCollision.globalIndex()); + auto collId = linkRow.collisionId(); // Take original collision global index matched with resoCollision + + auto coll = collisionsMC.iteratorAt(collId); // Take original collision matched with resoCollision + + if (!coll.isInelGt0()) // Check reco INELgt0 (at least one PV track in |eta| < 1) about the collision + return; + + multiplicity = resoCollision.cent(); + } else if (cMCCent && !cisInelGt0) { + auto linkRow = collisionIndex.iteratorAt(resoCollision.globalIndex()); + auto collId = linkRow.collisionId(); // Take original collision global index matched with resoCollision + + auto coll = collisionsMC.iteratorAt(collId); // Take original collision matched with resoCollision + + auto mcColl = coll.mcCollision_as>(); + multiplicity = mcColl.centFT0M(); + } else { + multiplicity = resoCollision.cent(); + } for (const auto& part : resoParents) { // loop over all pre-filtered MC particles if (std::abs(part.pdgCode()) != 313 || std::abs(part.y()) >= 0.5) continue; @@ -734,28 +818,28 @@ struct K892analysis { if (!pass1 || !pass2) continue; - if (collision.isVtxIn10()) // INEL10 + if (resoCollision.isVtxIn10()) // INEL10 { if (part.pdgCode() > 0) histos.fill(HIST("k892Gen"), 0, part.pt(), multiplicity); else histos.fill(HIST("k892GenAnti"), 0, part.pt(), multiplicity); } - if (collision.isVtxIn10() && collision.isInSel8()) // INEL>10, vtx10 + if (resoCollision.isVtxIn10() && resoCollision.isInSel8()) // INEL>10, vtx10 { if (part.pdgCode() > 0) histos.fill(HIST("k892Gen"), 1, part.pt(), multiplicity); else histos.fill(HIST("k892GenAnti"), 1, part.pt(), multiplicity); } - if (collision.isVtxIn10() && collision.isTriggerTVX()) // vtx10, TriggerTVX + if (resoCollision.isVtxIn10() && resoCollision.isTriggerTVX()) // vtx10, TriggerTVX { if (part.pdgCode() > 0) histos.fill(HIST("k892Gen"), 2, part.pt(), multiplicity); else histos.fill(HIST("k892GenAnti"), 2, part.pt(), multiplicity); } - if (collision.isInAfterAllCuts()) // after all event selection + if (resoCollision.isInAfterAllCuts()) // after all event selection { if (part.pdgCode() > 0) histos.fill(HIST("k892Gen"), 3, part.pt(), multiplicity); @@ -775,9 +859,10 @@ struct K892analysis { SameKindPair pairs{colBinning, nEvtMixing, -1, collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { + auto multiplicity = collision1.cent(); if (additionalQAeventPlots) histos.fill(HIST("QAevent/hEvtCounterMixedE"), 1.0); - fillHistograms(collision1, tracks1, tracks2); + fillHistograms(collision1, tracks1, tracks2, multiplicity); } }; PROCESS_SWITCH(K892analysis, processMELight, "Process EventMixing light without partition", false); diff --git a/PWGLF/Tasks/Resonances/kstarqa.cxx b/PWGLF/Tasks/Resonances/kstarqa.cxx index b4a6e3a2ee4..176cfc117c4 100644 --- a/PWGLF/Tasks/Resonances/kstarqa.cxx +++ b/PWGLF/Tasks/Resonances/kstarqa.cxx @@ -1688,7 +1688,7 @@ struct Kstarqa { } PROCESS_SWITCH(Kstarqa, processEvtLossSigLossMC, "Process Signal Loss, Event Loss", false); - void processRec(EventCandidatesMC::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const&, aod::McCollisions const&) + void processRec(EventCandidatesMC::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const&, EventMCGenerated const&) { if (!collision.has_mcCollision()) { @@ -1705,8 +1705,6 @@ struct Kstarqa { } // multiplicity = collision.centFT0M(); - multiplicity = -1.0; - if (cSelectMultEstimator == kFT0M) { multiplicity = collision.centFT0M(); } else if (cSelectMultEstimator == kFT0A) { @@ -1934,20 +1932,22 @@ struct Kstarqa { } PROCESS_SWITCH(Kstarqa, processRec, "Process Reconstructed", false); - void processRec2(EventCandidatesMC::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const&, aod::McCollisions const& /*mcCollisions*/) + void processRec2(EventCandidatesMC::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const&, EventMCGenerated const&) { if (!collision.has_mcCollision()) { return; } + double multiplicityRec = -1.0; + const auto& mcCollisionRec = collision.mcCollision_as(); + multiplicityRec = mcCollisionRec.centFT0M(); + if (selectionConfig.isINELgt0 && !collision.isInelGt0()) { return; } // multiplicity = collision.centFT0M(); - multiplicity = -1.0; - if (cSelectMultEstimator == kFT0M) { multiplicity = collision.centFT0M(); } else if (cSelectMultEstimator == kFT0A) { @@ -1961,50 +1961,14 @@ struct Kstarqa { } hInvMass.fill(HIST("hAllRecCollisions"), multiplicity); + hInvMass.fill(HIST("hAllRecCollisionsCalib"), multiplicityRec); if (!selectionEvent(collision, false)) { return; } - // // if (std::abs(collision.mcCollision().posZ()) > selectionConfig.cutzvertex || !collision.sel8()) { - // if (std::abs(collision.mcCollision().posZ()) > selectionConfig.cutzvertex) { - // return; - // } - - // if (selectionConfig.isNoTimeFrameBorder && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { - // return; - // } - - // if (selectionConfig.isTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { - // return; - // } - - // if (!collision.sel8()) { - // return; - // } - - // if (selectionConfig.isNoSameBunchPileup && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { - // return; - // } - // if (selectionConfig.isGoodZvtxFT0vsPV && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { - // return; - // } - - // multiplicity = collision.centFT0M(); - - multiplicity = -1.0; - - if (cSelectMultEstimator == kFT0M) { - multiplicity = collision.centFT0M(); - } else if (cSelectMultEstimator == kFT0A) { - multiplicity = collision.centFT0A(); - } else if (cSelectMultEstimator == kFT0C) { - multiplicity = collision.centFT0C(); - } else if (cSelectMultEstimator == kFV0A) { - multiplicity = collision.centFV0A(); - } else { - multiplicity = collision.centFT0M(); // default - } + hInvMass.fill(HIST("h1RecMult"), multiplicity); + hInvMass.fill(HIST("h1RecMult2"), multiplicityRec); hInvMass.fill(HIST("h1RecMult"), multiplicity); @@ -2169,6 +2133,7 @@ struct Kstarqa { mother = daughter1 + daughter2; // Kstar meson hInvMass.fill(HIST("h2KstarRecpt2"), mothertrack1.pt(), multiplicity, std::sqrt(mothertrack1.e() * mothertrack1.e() - mothertrack1.p() * mothertrack1.p())); + hInvMass.fill(HIST("h2KstarRecptCalib2"), mothertrack1.pt(), multiplicityRec, std::sqrt(mothertrack1.e() * mothertrack1.e() - mothertrack1.p() * mothertrack1.p())); if (applyRecMotherRapidity && mother.Rapidity() >= selectionConfig.rapidityMotherData) { continue; @@ -2176,6 +2141,7 @@ struct Kstarqa { hInvMass.fill(HIST("h1KstarRecMass"), mother.M()); hInvMass.fill(HIST("h2KstarRecpt1"), mother.Pt(), multiplicity, mother.M()); + hInvMass.fill(HIST("h2KstarRecptCalib1"), mother.Pt(), multiplicityRec, mother.M()); } } } From 1dca2558e9040349b44dff8890c0d7a3d25d768a Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 22 Aug 2025 14:01:27 +0200 Subject: [PATCH 146/986] [PWGEM/Dilepton] update taggingHFE.cxx (#12683) --- PWGEM/Dilepton/Tasks/taggingHFE.cxx | 117 ++++++++++++++++------------ 1 file changed, 69 insertions(+), 48 deletions(-) diff --git a/PWGEM/Dilepton/Tasks/taggingHFE.cxx b/PWGEM/Dilepton/Tasks/taggingHFE.cxx index b3098ef9774..82df9228503 100644 --- a/PWGEM/Dilepton/Tasks/taggingHFE.cxx +++ b/PWGEM/Dilepton/Tasks/taggingHFE.cxx @@ -125,28 +125,10 @@ struct taggingHFE { Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 1.0, "max dca XY for single track in cm"}; Configurable cfg_max_dcaz{"cfg_max_dcaz", 1.0, "max dca Z for single track in cm"}; - Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2, "min n sigma el in TPC"}; - Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +3, "max n sigma el in TPC"}; - Configurable cfg_min_TOFNsigmaEl{"cfg_min_TOFNsigmaEl", -3, "min n sigma el in TOF"}; - Configurable cfg_max_TOFNsigmaEl{"cfg_max_TOFNsigmaEl", +3, "max n sigma el in TOF"}; } loose_electroncut; struct : ConfigurableGroup { std::string prefix = "kaoncut"; - Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.05, "min pT for single track"}; - Configurable cfg_max_pt_track{"cfg_max_pt_track", 1e+10, "max pT for single track"}; - Configurable cfg_min_eta_track{"cfg_min_eta_track", -1.2, "min eta for single track"}; - Configurable cfg_max_eta_track{"cfg_max_eta_track", +1.2, "max eta for single track"}; - Configurable cfg_min_cr2findable_ratio_tpc{"cfg_min_cr2findable_ratio_tpc", 0.8, "min. TPC Ncr/Nf ratio"}; - Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 0.7, "max fraction of shared clusters in TPC"}; - Configurable cfg_min_ncrossedrows_tpc{"cfg_min_ncrossedrows_tpc", 40, "min ncrossed rows"}; - Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; - Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 4, "min ncluster its"}; - Configurable cfg_min_ncluster_itsib{"cfg_min_ncluster_itsib", 1, "min ncluster itsib"}; - Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; - Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; - Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 0.5, "max dca XY for single track in cm"}; - Configurable cfg_max_dcaz{"cfg_max_dcaz", 0.5, "max dca Z for single track in cm"}; Configurable cfg_min_TPCNsigmaKa{"cfg_min_TPCNsigmaKa", -3, "min n sigma ka in TPC"}; Configurable cfg_max_TPCNsigmaKa{"cfg_max_TPCNsigmaKa", +3, "max n sigma ka in TPC"}; Configurable cfg_min_TOFNsigmaKa{"cfg_min_TOFNsigmaKa", -3, "min n sigma ka in TOF"}; @@ -215,7 +197,7 @@ struct taggingHFE { Configurable cfgEventGeneratorType{"cfgEventGeneratorType", -1, "if positive, select event generator type. i.e. gap or signal"}; } eventcut; - Configurable cfgMeeMaxPF{"cfgMeeMaxPF", 0.08, "max mee for prefilter to reject pi0->ee and gamma->ee in LMR"}; + Configurable cfgMeeMaxPF{"cfgMeeMaxPF", 0.04, "max mee for prefilter to reject pi0->ee and gamma->ee in LMR"}; HistogramRegistry fRegistry{"fRegistry"}; static constexpr std::string_view hadron_names[6] = {"LF/", "Jpsi/", "D0/", "Dpm/", "Ds/", "Lc/"}; @@ -368,7 +350,7 @@ struct taggingHFE { fRegistry.add("Data/V0/hYPhi", "rapidity vs. #varphi of V0;#varphi (rad.);rapidity_{#Lambda}", kTH2F, {{90, 0, 2 * M_PI}, {80, -2, +2}}, false); fRegistry.add("Data/V0/hAP", "Ap plot;#alpha;q_{T} (GeV/c)", kTH2F, {{200, -1, 1}, {250, 0, 0.25}}, false); fRegistry.add("Data/V0/hLxy", "decay length from PV;L_{xy} (cm)", kTH1F, {{100, 0, 10}}, false); - fRegistry.add("Data/V0/hCosPA", "cosPA;cosine of pointing angle", kTH1F, {{100, 0.99, 1}}, false); + fRegistry.add("Data/V0/hCosPA", "cosPA;cosine of pointing angle", kTH1F, {{200, -1, 1}}, false); fRegistry.add("Data/V0/hDCA2Legs", "distance between 2 legs at PCA;distance between 2 legs (cm)", kTH1F, {{100, 0, 1}}, false); fRegistry.add("Data/V0/hMassK0S", "K0S mass;m_{#pi#pi} (GeV/c^{2})", kTH1F, {{100, 0.45, 0.55}}, false); fRegistry.add("Data/V0/hMassLambda", "Lambda mass;m_{p#pi^{-}} (GeV/c^{2})", kTH1F, {{100, 1.08, 1.18}}, false); @@ -377,7 +359,7 @@ struct taggingHFE { // for cascade fRegistry.add("Data/Cascade/hPt", "pT of V0;p_{T} (GeV/c)", kTH1F, {{100, 0, 10}}, false); fRegistry.add("Data/Cascade/hYPhi", "rapidity vs. #varphi of V0;#varphi (rad.);rapidity_{#Lambda}", kTH2F, {{90, 0, 2 * M_PI}, {80, -2, +2}}, false); - fRegistry.add("Data/Cascade/hCosPA", "cosPA;cosine of pointing angle", kTH1F, {{100, 0.99, 1}}, false); + fRegistry.add("Data/Cascade/hCosPA", "cosPA;cosine of pointing angle", kTH1F, {{200, -1, 1}}, false); fRegistry.add("Data/Cascade/hDCA2Legs", "distance between 2 legs at PCA;distance between 2 legs (cm)", kTH1F, {{100, 0, 1}}, false); fRegistry.add("Data/Cascade/hV0CosPA", "cosPA of V0 in cascade;cosine of pointing angle", kTH1F, {{100, 0.99, 1}}, false); fRegistry.add("Data/Cascade/hV0DCA2Legs", "distance between 2 legs at PCA of V0 in cascade;distance between 2 legs (cm)", kTH1F, {{100, 0, 1}}, false); @@ -387,31 +369,31 @@ struct taggingHFE { fRegistry.add("Data/Cascade/hMassOmega", "#Omega mass;m_{#LambdaK} (GeV/c^{2})", kTH1F, {{100, 1.62, 1.72}}, false); // for e-L pair - fRegistry.add("Data/eL/RS/hs", "hs;m_{e#Lambda} (GeV/c^{2});p_{T,e} (GeV/c);DCA_{e}^{3D} (#sigma);L_{xy} (cm);", kTHnSparseF, {{20, 1.1, 3.1}, {100, 0, 10}, {100, 0, 10}, {500, 0, 0.5}}, false); - fRegistry.add("Data/eL/RS/hCosPA", "cos PA;cosPA", kTH1F, {{100, 0.99, 1.0}}, false); + fRegistry.add("Data/eL/RS/hs", "hs;m_{e#Lambda} (GeV/c^{2});p_{T,e} (GeV/c);DCA_{e}^{3D} (#sigma);L_{xy} (cm);", kTHnSparseF, {{20, 1.1, 3.1}, {100, 0, 10}, {100, 0, 10}, {100, 0, 1.0}}, false); + fRegistry.add("Data/eL/RS/hCosPA", "cos PA;cosPA", kTH1F, {{200, -1, 1}}, false); fRegistry.add("Data/eL/RS/hDCA2Legs", "distance between 2 legs at PCA;distance between 2 legs at PCA (cm)", kTH1F, {{500, 0.0, 0.5}}, false); - fRegistry.add("Data/eL/RS/hLxy", "distance between PV and SV in XY;L_{xy} (cm)", kTH1F, {{500, 0.0, 0.5}}, false); - fRegistry.add("Data/eL/RS/hLz", "distance between PV and SV in Z;L_{z} (cm)", kTH1F, {{500, 0.0, 0.5}}, false); + fRegistry.add("Data/eL/RS/hLxy", "distance between PV and SV in XY;L_{xy} (cm)", kTH1F, {{100, 0.0, 1}}, false); + fRegistry.add("Data/eL/RS/hLz", "distance between PV and SV in Z;L_{z} (cm)", kTH1F, {{100, 0.0, 1}}, false); fRegistry.addClone("Data/eL/RS/", "Data/eL/WS/"); // right and wrong sign fRegistry.addClone("Data/eL/RS/", "MC/eLfromPromptLcpm/"); fRegistry.addClone("Data/eL/RS/", "MC/eLfromNonPromptLcpm/"); // for e-Xi pair - fRegistry.add("Data/eXi/RS/hs", "hs;m_{e#Xi} (GeV/c^{2});p_{T,e} (GeV/c);DCA_{e}^{3D} (#sigma);L_{xy} (cm);", kTHnSparseF, {{20, 1.1, 3.1}, {100, 0, 10}, {100, 0, 10}, {500, 0, 0.5}}, false); - fRegistry.add("Data/eXi/RS/hCosPA", "cos PA;cosPA", kTH1F, {{100, 0.99, 1.0}}, false); + fRegistry.add("Data/eXi/RS/hs", "hs;m_{e#Xi} (GeV/c^{2});p_{T,e} (GeV/c);DCA_{e}^{3D} (#sigma);L_{xy} (cm);", kTHnSparseF, {{20, 1.3, 3.3}, {100, 0, 10}, {100, 0, 10}, {100, 0, 1.0}}, false); + fRegistry.add("Data/eXi/RS/hCosPA", "cos PA;cosPA", kTH1F, {{200, -1, 1}}, false); fRegistry.add("Data/eXi/RS/hDCA2Legs", "distance between 2 legs at PCA;distance between 2 legs at PCA (cm)", kTH1F, {{500, 0.0, 0.5}}, false); - fRegistry.add("Data/eXi/RS/hLxy", "distance between PV and SV in XY;L_{xy} (cm)", kTH1F, {{500, 0.0, 0.5}}, false); - fRegistry.add("Data/eXi/RS/hLz", "distance between PV and SV in Z;L_{z} (cm)", kTH1F, {{500, 0.0, 0.5}}, false); + fRegistry.add("Data/eXi/RS/hLxy", "distance between PV and SV in XY;L_{xy} (cm)", kTH1F, {{100, 0.0, 1}}, false); + fRegistry.add("Data/eXi/RS/hLz", "distance between PV and SV in Z;L_{z} (cm)", kTH1F, {{100, 0.0, 1}}, false); fRegistry.addClone("Data/eXi/RS/", "Data/eXi/WS/"); // right and wrong sign fRegistry.addClone("Data/eXi/RS/", "MC/eXifromPromptXic0/"); fRegistry.addClone("Data/eXi/RS/", "MC/eXifromNonPromptXic0/"); // for e-Omega pair - fRegistry.add("Data/eOmega/RS/hs", "hs;m_{e#Omega} (GeV/c^{2});p_{T,e} (GeV/c);DCA_{e}^{3D} (#sigma);L_{xy} (cm);", kTHnSparseF, {{20, 1.1, 3.1}, {100, 0, 10}, {100, 0, 10}, {500, 0, 0.5}}, false); - fRegistry.add("Data/eOmega/RS/hCosPA", "cos PA;cosPA", kTH1F, {{100, 0.99, 1.0}}, false); + fRegistry.add("Data/eOmega/RS/hs", "hs;m_{e#Omega} (GeV/c^{2});p_{T,e} (GeV/c);DCA_{e}^{3D} (#sigma);L_{xy} (cm);", kTHnSparseF, {{20, 1.6, 3.6}, {100, 0, 10}, {100, 0, 10}, {100, 0, 1.0}}, false); + fRegistry.add("Data/eOmega/RS/hCosPA", "cos PA;cosPA", kTH1F, {{200, -1, 1}}, false); fRegistry.add("Data/eOmega/RS/hDCA2Legs", "distance between 2 legs at PCA;distance between 2 legs at PCA (cm)", kTH1F, {{500, 0.0, 0.5}}, false); - fRegistry.add("Data/eOmega/RS/hLxy", "distance between PV and SV in XY;L_{xy} (cm)", kTH1F, {{500, 0.0, 0.5}}, false); - fRegistry.add("Data/eOmega/RS/hLz", "distance between PV and SV in Z;L_{z} (cm)", kTH1F, {{500, 0.0, 0.5}}, false); + fRegistry.add("Data/eOmega/RS/hLxy", "distance between PV and SV in XY;L_{xy} (cm)", kTH1F, {{100, 0.0, 1}}, false); + fRegistry.add("Data/eOmega/RS/hLz", "distance between PV and SV in Z;L_{z} (cm)", kTH1F, {{100, 0.0, 1}}, false); fRegistry.addClone("Data/eOmega/RS/", "Data/eOmega/WS/"); // right and wrong sign fRegistry.addClone("Data/eOmega/RS/", "MC/eOmegafromPromptOmegac0/"); fRegistry.addClone("Data/eOmega/RS/", "MC/eOmegafromNonPromptOmegac0/"); @@ -703,9 +685,10 @@ struct taggingHFE { float dcaZ = mDcaInfoCov.getZ(); float dca3DinSigma = dca3DinSigmaOTF(dcaXY, dcaZ, trackParCov.getSigmaY2(), trackParCov.getSigmaZ2(), trackParCov.getSigmaZY()); - if (isSelectedElectron(track, trackParCov, dcaXY, dcaZ)) { + if (!isSelectedElectron(track, trackParCov, dcaXY, dcaZ)) { return; } + fRegistry.fill(HIST("Data/electron/hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); if constexpr (isMC) { const auto& mctrack = track.template mcParticle_as(); @@ -777,8 +760,6 @@ struct taggingHFE { } else if (pdg_mother == 5122) { // Lb0 fRegistry.fill(HIST("MC/eFromLb0/hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); } - } else { - fRegistry.fill(HIST("Data/electron/hs"), trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), dca3DinSigma); } } @@ -995,8 +976,6 @@ struct taggingHFE { const auto& trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, collision.globalIndex()); electronIds.reserve(trackIdsThisCollision.size()); positronIds.reserve(trackIdsThisCollision.size()); - negKaonIds.reserve(trackIdsThisCollision.size()); - posKaonIds.reserve(trackIdsThisCollision.size()); for (const auto& trackId : trackIdsThisCollision) { const auto& track = trackId.template track_as(); @@ -1284,8 +1263,16 @@ struct taggingHFE { const auto& mcLambdac0 = mcParticles.rawIteratorAt(mcLambdacId); if (IsFromBeauty(mcLambdac0, mcParticles) < 0) { fRegistry.fill(HIST("MC/eLfromPromptLcpm/hs"), eLpair.mass, eLpair.ptepv, eLpair.dca3dinsigma, eLpair.lxy); + fRegistry.fill(HIST("MC/eLfromPromptLcpm/hCosPA"), eLpair.cospa); + fRegistry.fill(HIST("MC/eLfromPromptLcpm/hDCA2Legs"), eLpair.dca2legs); + fRegistry.fill(HIST("MC/eLfromPromptLcpm/hLxy"), eLpair.lxy); + fRegistry.fill(HIST("MC/eLfromPromptLcpm/hLz"), eLpair.lz); } else { fRegistry.fill(HIST("MC/eLfromNonPromptLcpm/hs"), eLpair.mass, eLpair.ptepv, eLpair.dca3dinsigma, eLpair.lxy); + fRegistry.fill(HIST("MC/eLfromNonPromptLcpm/hCosPA"), eLpair.cospa); + fRegistry.fill(HIST("MC/eLfromNonPromptLcpm/hDCA2Legs"), eLpair.dca2legs); + fRegistry.fill(HIST("MC/eLfromNonPromptLcpm/hLxy"), eLpair.lxy); + fRegistry.fill(HIST("MC/eLfromNonPromptLcpm/hLz"), eLpair.lz); } } } @@ -1340,8 +1327,16 @@ struct taggingHFE { const auto& mcLambdac0 = mcParticles.rawIteratorAt(mcLambdacId); if (IsFromBeauty(mcLambdac0, mcParticles) < 0) { fRegistry.fill(HIST("MC/eLfromPromptLcpm/hs"), eLpair.mass, eLpair.ptepv, eLpair.dca3dinsigma, eLpair.lxy); + fRegistry.fill(HIST("MC/eLfromPromptLcpm/hCosPA"), eLpair.cospa); + fRegistry.fill(HIST("MC/eLfromPromptLcpm/hDCA2Legs"), eLpair.dca2legs); + fRegistry.fill(HIST("MC/eLfromPromptLcpm/hLxy"), eLpair.lxy); + fRegistry.fill(HIST("MC/eLfromPromptLcpm/hLz"), eLpair.lz); } else { fRegistry.fill(HIST("MC/eLfromNonPromptLcpm/hs"), eLpair.mass, eLpair.ptepv, eLpair.dca3dinsigma, eLpair.lxy); + fRegistry.fill(HIST("MC/eLfromNonPromptLcpm/hCosPA"), eLpair.cospa); + fRegistry.fill(HIST("MC/eLfromNonPromptLcpm/hDCA2Legs"), eLpair.dca2legs); + fRegistry.fill(HIST("MC/eLfromNonPromptLcpm/hLxy"), eLpair.lxy); + fRegistry.fill(HIST("MC/eLfromNonPromptLcpm/hLz"), eLpair.lz); } } } @@ -1383,8 +1378,16 @@ struct taggingHFE { const auto& mcXic0 = mcParticles.rawIteratorAt(mcXic0Id); if (IsFromBeauty(mcXic0, mcParticles) < 0) { fRegistry.fill(HIST("MC/eXifromPromptXic0/hs"), eXipair.mass, eXipair.ptepv, eXipair.dca3dinsigma, eXipair.lxy); + fRegistry.fill(HIST("MC/eXifromPromptXic0/hCosPA"), eXipair.cospa); + fRegistry.fill(HIST("MC/eXifromPromptXic0/hDCA2Legs"), eXipair.dca2legs); + fRegistry.fill(HIST("MC/eXifromPromptXic0/hLxy"), eXipair.lxy); + fRegistry.fill(HIST("MC/eXifromPromptXic0/hLz"), eXipair.lz); } else { fRegistry.fill(HIST("MC/eXifromNonPromptXic0/hs"), eXipair.mass, eXipair.ptepv, eXipair.dca3dinsigma, eXipair.lxy); + fRegistry.fill(HIST("MC/eXifromNonPromptXic0/hCosPA"), eXipair.cospa); + fRegistry.fill(HIST("MC/eXifromNonPromptXic0/hDCA2Legs"), eXipair.dca2legs); + fRegistry.fill(HIST("MC/eXifromNonPromptXic0/hLxy"), eXipair.lxy); + fRegistry.fill(HIST("MC/eXifromNonPromptXic0/hLz"), eXipair.lz); } } } @@ -1445,8 +1448,16 @@ struct taggingHFE { const auto& mcXic0 = mcParticles.rawIteratorAt(mcXic0Id); if (IsFromBeauty(mcXic0, mcParticles) < 0) { fRegistry.fill(HIST("MC/eXifromPromptXic0/hs"), eXipair.mass, eXipair.ptepv, eXipair.dca3dinsigma, eXipair.lxy); + fRegistry.fill(HIST("MC/eXifromPromptXic0/hCosPA"), eXipair.cospa); + fRegistry.fill(HIST("MC/eXifromPromptXic0/hDCA2Legs"), eXipair.dca2legs); + fRegistry.fill(HIST("MC/eXifromPromptXic0/hLxy"), eXipair.lxy); + fRegistry.fill(HIST("MC/eXifromPromptXic0/hLz"), eXipair.lz); } else { fRegistry.fill(HIST("MC/eXifromNonPromptXic0/hs"), eXipair.mass, eXipair.ptepv, eXipair.dca3dinsigma, eXipair.lxy); + fRegistry.fill(HIST("MC/eXifromNonPromptXic0/hCosPA"), eXipair.cospa); + fRegistry.fill(HIST("MC/eXifromNonPromptXic0/hDCA2Legs"), eXipair.dca2legs); + fRegistry.fill(HIST("MC/eXifromNonPromptXic0/hLxy"), eXipair.lxy); + fRegistry.fill(HIST("MC/eXifromNonPromptXic0/hLz"), eXipair.lz); } } } @@ -1480,16 +1491,24 @@ struct taggingHFE { int mcLambdaId = FindCommonMotherFrom2Prongs(mcposLeg, mcnegLeg, 2212, -211, 3122, mcParticles); if (mcLambdaId > 0) { // true Lambda const auto& mcLambda = mcParticles.rawIteratorAt(mcLambdaId); - int mcOmegaId = FindCommonMotherFrom2Prongs(mcLambda, mcbachelor, 3122, -211, 3312, mcParticles); + int mcOmegaId = FindCommonMotherFrom2Prongs(mcLambda, mcbachelor, 3122, -321, 3334, mcParticles); if (mcOmegaId > 0) { // true omegaMinus const auto& mcOmega = mcParticles.rawIteratorAt(mcOmegaId); - int mcOmegac0Id = FindCommonMotherFrom2Prongs(mcpos, mcOmega, -11, 3312, 4132, mcParticles); + int mcOmegac0Id = FindCommonMotherFrom2Prongs(mcpos, mcOmega, -11, 3334, 4332, mcParticles); if (mcOmegac0Id > 0) { // true Omegac0 const auto& mcOmegac0 = mcParticles.rawIteratorAt(mcOmegac0Id); if (IsFromBeauty(mcOmegac0, mcParticles) < 0) { fRegistry.fill(HIST("MC/eOmegafromPromptOmegac0/hs"), eOmegapair.mass, eOmegapair.ptepv, eOmegapair.dca3dinsigma, eOmegapair.lxy); + fRegistry.fill(HIST("MC/eOmegafromPromptOmegac0/hCosPA"), eOmegapair.cospa); + fRegistry.fill(HIST("MC/eOmegafromPromptOmegac0/hDCA2Legs"), eOmegapair.dca2legs); + fRegistry.fill(HIST("MC/eOmegafromPromptOmegac0/hLxy"), eOmegapair.lxy); + fRegistry.fill(HIST("MC/eOmegafromPromptOmegac0/hLz"), eOmegapair.lz); } else { fRegistry.fill(HIST("MC/eOmegafromNonPromptOmegac0/hs"), eOmegapair.mass, eOmegapair.ptepv, eOmegapair.dca3dinsigma, eOmegapair.lxy); + fRegistry.fill(HIST("MC/eOmegafromNonPromptOmegac0/hCosPA"), eOmegapair.cospa); + fRegistry.fill(HIST("MC/eOmegafromNonPromptOmegac0/hDCA2Legs"), eOmegapair.dca2legs); + fRegistry.fill(HIST("MC/eOmegafromNonPromptOmegac0/hLxy"), eOmegapair.lxy); + fRegistry.fill(HIST("MC/eOmegafromNonPromptOmegac0/hLz"), eOmegapair.lz); } } } @@ -1542,16 +1561,24 @@ struct taggingHFE { int mcLambdaId = FindCommonMotherFrom2Prongs(mcposLeg, mcnegLeg, 211, -2212, -3122, mcParticles); if (mcLambdaId > 0) { // true AntiLambda const auto& mcLambda = mcParticles.rawIteratorAt(mcLambdaId); - int mcOmegaId = FindCommonMotherFrom2Prongs(mcLambda, mcbachelor, -3122, 211, -3312, mcParticles); + int mcOmegaId = FindCommonMotherFrom2Prongs(mcLambda, mcbachelor, -3122, 321, -3334, mcParticles); if (mcOmegaId > 0) { // true omegaPlus const auto& mcOmega = mcParticles.rawIteratorAt(mcOmegaId); - int mcOmegac0Id = FindCommonMotherFrom2Prongs(mcele, mcOmega, 11, -3312, 4132, mcParticles); + int mcOmegac0Id = FindCommonMotherFrom2Prongs(mcele, mcOmega, 11, -3334, 4332, mcParticles); if (mcOmegac0Id > 0) { // true Omegac0 const auto& mcOmegac0 = mcParticles.rawIteratorAt(mcOmegac0Id); if (IsFromBeauty(mcOmegac0, mcParticles) < 0) { fRegistry.fill(HIST("MC/eOmegafromPromptOmegac0/hs"), eOmegapair.mass, eOmegapair.ptepv, eOmegapair.dca3dinsigma, eOmegapair.lxy); + fRegistry.fill(HIST("MC/eOmegafromPromptOmegac0/hCosPA"), eOmegapair.cospa); + fRegistry.fill(HIST("MC/eOmegafromPromptOmegac0/hDCA2Legs"), eOmegapair.dca2legs); + fRegistry.fill(HIST("MC/eOmegafromPromptOmegac0/hLxy"), eOmegapair.lxy); + fRegistry.fill(HIST("MC/eOmegafromPromptOmegac0/hLz"), eOmegapair.lz); } else { fRegistry.fill(HIST("MC/eOmegafromNonPromptOmegac0/hs"), eOmegapair.mass, eOmegapair.ptepv, eOmegapair.dca3dinsigma, eOmegapair.lxy); + fRegistry.fill(HIST("MC/eOmegafromNonPromptOmegac0/hCosPA"), eOmegapair.cospa); + fRegistry.fill(HIST("MC/eOmegafromNonPromptOmegac0/hDCA2Legs"), eOmegapair.dca2legs); + fRegistry.fill(HIST("MC/eOmegafromNonPromptOmegac0/hLxy"), eOmegapair.lxy); + fRegistry.fill(HIST("MC/eOmegafromNonPromptOmegac0/hLz"), eOmegapair.lz); } } } @@ -1569,10 +1596,6 @@ struct taggingHFE { electronIds.shrink_to_fit(); positronIds.clear(); positronIds.shrink_to_fit(); - negKaonIds.clear(); - negKaonIds.shrink_to_fit(); - posKaonIds.clear(); - posKaonIds.shrink_to_fit(); lambdaIds.clear(); lambdaIds.shrink_to_fit(); @@ -1625,8 +1648,6 @@ struct taggingHFE { std::vector positronIdsLoose; std::vector electronIds; std::vector positronIds; - std::vector negKaonIds; - std::vector posKaonIds; std::vector lambdaIds; std::vector antilambdaIds; From ec4928c621327c4670a2a45c09d67c5553e98635 Mon Sep 17 00:00:00 2001 From: Kaare Endrup Iversen <69893472+kaareendrup@users.noreply.github.com> Date: Fri, 22 Aug 2025 14:24:10 +0200 Subject: [PATCH 147/986] [PWGDQ] Add geometryloading to dileptontrack task for MC with assoc (#12658) --- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index 95243956b78..890009b7c47 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -3270,6 +3270,10 @@ struct AnalysisDileptonTrack { Configurable fConfigUseRemoteField{"cfgUseRemoteField", false, "Chose whether to fetch the magnetic field from ccdb or set it manually"}; Configurable fConfigGRPmagPath{"cfgGrpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; Configurable fConfigMagField{"cfgMagField", 5.0f, "Manually set magnetic field"}; + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; + Configurable fConfigGeoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; Configurable fConfigMCRecSignals{"cfgMCRecSignals", "", "Comma separated list of MC signals (reconstructed)"}; Configurable fConfigMCGenSignals{"cfgMCGenSignals", "", "Comma separated list of MC signals (generated)"}; @@ -3333,6 +3337,15 @@ struct AnalysisDileptonTrack { } fCurrentRun = 0; + + fCCDB->setURL(fConfigCcdbUrl.value); + fCCDB->setCaching(true); + fCCDB->setLocalObjectValidityChecking(); + fCCDB->setCreatedNotAfter(fConfigNoLaterThan.value); + if (!o2::base::GeometryManager::isGeometryLoaded()) { + fCCDB->get(fConfigGeoPath); + } + fValuesDilepton = new float[VarManager::kNVars]; fValuesHadron = new float[VarManager::kNVars]; fTrackCutBitMap = 0; From b9b7d7d0f14898a9bbd82ce807901cfca6f35b64 Mon Sep 17 00:00:00 2001 From: Yuanjing Ji Date: Fri, 22 Aug 2025 14:37:28 +0200 Subject: [PATCH 148/986] [PWGDQ] Add MC proton definitions (#12662) Co-authored-by: Yuanjing Ji Co-authored-by: Yuanjing Ji --- PWGDQ/Core/MCSignalLibrary.cxx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/PWGDQ/Core/MCSignalLibrary.cxx b/PWGDQ/Core/MCSignalLibrary.cxx index 5e4f2ada1bb..4d6bd11a916 100644 --- a/PWGDQ/Core/MCSignalLibrary.cxx +++ b/PWGDQ/Core/MCSignalLibrary.cxx @@ -87,12 +87,33 @@ MCSignal* o2::aod::dqmcsignals::GetMCSignal(const char* name) signal = new MCSignal(name, "Primary Kaons", {prong}, {-1}); // define the signal using the full constructor return signal; } + if (!nameStr.compare("proton")) { + MCProng prong(1, {2212}, {true}, {false}, {0}, {0}, {false}); + signal = new MCSignal(name, "proton", {prong}, {-1}); + return signal; + } if (!nameStr.compare("protonPrimary")) { MCProng prong(1, {2212}, {true}, {false}, {0}, {0}, {false}); // define 1-generation prong using the full constructor prong.SetSourceBit(0, MCProng::kPhysicalPrimary); // set source to be ALICE primary particles signal = new MCSignal(name, "Primary Proton", {prong}, {-1}); // define the signal using the full constructor return signal; } + if (!nameStr.compare("protonFromTransport")) { + MCProng prong(1, {2212}, {true}, {false}, {0}, {0}, {false}); + prong.SetSourceBit(0, MCProng::kProducedInTransport); + signal = new MCSignal(name, "ProtonFromTransport", {prong}, {-1}); + return signal; + } + if (!nameStr.compare("protonFromLambda0")) { + MCProng prong(2, {2212, 3122}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}); + signal = new MCSignal(name, "Proton from Lambda0 decays", {prong}, {-1}); + return signal; + } + if (!nameStr.compare("protonFromSigmaPlus")) { + MCProng prong(2, {2212, 3222}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}); + signal = new MCSignal(name, "Proton from Sigma+ decays", {prong}, {-1}); + return signal; + } if (!nameStr.compare("phiMeson")) { MCProng prong(1, {333}, {true}, {false}, {0}, {0}, {false}); // define 1-generation prong using the full constructor signal = new MCSignal(name, "phi meson", {prong}, {-1}); // define the signal using the full constructor From 376392cb87349886a300c75fa2492b50b7f46725 Mon Sep 17 00:00:00 2001 From: Rafael Manhart <56776511+RafRaf11@users.noreply.github.com> Date: Fri, 22 Aug 2025 14:38:36 +0200 Subject: [PATCH 149/986] [PWGCF] FemtoDream: added event sphericity calculation (#12677) Co-authored-by: ALICE Action Bot --- .../Core/femtoDreamCollisionSelection.h | 69 +- PWGCF/FemtoDream/TableProducer/CMakeLists.txt | 5 - .../femtoDreamProducerReducedTask.cxx | 4 +- .../TableProducer/femtoDreamProducerTask.cxx | 4 +- .../femtoDreamProducerTaskWithCascades.cxx | 1173 ----------------- .../Tasks/femtoDreamPairTaskTrackTrack.cxx | 3 +- 6 files changed, 74 insertions(+), 1184 deletions(-) delete mode 100644 PWGCF/FemtoDream/TableProducer/femtoDreamProducerTaskWithCascades.cxx diff --git a/PWGCF/FemtoDream/Core/femtoDreamCollisionSelection.h b/PWGCF/FemtoDream/Core/femtoDreamCollisionSelection.h index 8fe58ce9d7b..73350e81c6c 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamCollisionSelection.h +++ b/PWGCF/FemtoDream/Core/femtoDreamCollisionSelection.h @@ -41,7 +41,7 @@ class FemtoDreamCollisionSelection /// \param checkTrigger whether or not to check for the trigger alias /// \param trig Requested trigger alias /// \param checkOffline whether or not to check for offline selection criteria - void setCuts(float zvtxMax, bool checkTrigger, int trig, bool checkOffline, bool addCheckOffline, bool checkRun3) + void setCuts(float zvtxMax, bool checkTrigger, int trig, bool checkOffline, bool addCheckOffline, bool checkRun3, float minSphericity, float sphericityPtmin) { mCutsSet = true; mZvtxMax = zvtxMax; @@ -50,6 +50,8 @@ class FemtoDreamCollisionSelection mCheckOffline = checkOffline; mAddCheckOffline = addCheckOffline; mCheckIsRun3 = checkRun3; + mMinSphericity = minSphericity; + mSphericityPtmin = sphericityPtmin; } /// Initializes histograms for the task @@ -66,6 +68,7 @@ class FemtoDreamCollisionSelection mHistogramRegistry->add("Event/MultNTracksPV", "; MultNTracksPV; Entries", kTH1F, {{200, 0, 200}}); mHistogramRegistry->add("Event/MultNTracklets", "; MultNTrackslets; Entries", kTH1F, {{300, 0, 300}}); mHistogramRegistry->add("Event/MultTPC", "; MultTPC; Entries", kTH1F, {{600, 0, 600}}); + mHistogramRegistry->add("Event/Sphericity", "; Sphericity; Entries", kTH1F, {{100, 0, 1}}); } /// Print some debug information @@ -76,6 +79,8 @@ class FemtoDreamCollisionSelection LOG(info) << "Check trigger: " << mCheckTrigger; LOG(info) << "Trigger: " << mTrigger; LOG(info) << " Check offline: " << mCheckOffline; + LOG(info) << "Min sphericity: " << mMinSphericity; + LOG(info) << "Min Pt (sphericity): " << mSphericityPtmin; } /// Check whether the collisions fulfills the specified selections @@ -180,9 +185,65 @@ class FemtoDreamCollisionSelection /// \param tracks All tracks /// \return value of the sphericity of the event template - float computeSphericity(T1 const& /*col*/, T2 const& /*tracks*/) + float computeSphericity(T1 const& col, T2 const& tracks) { - return 2.f; + double ptTot = 0.; + double s00 = 0.; // elements of the sphericity matrix taken form EPJC72:2124 + double s01 = 0.; + // double s10 = 0.; + double s11 = 0.; + + int numOfTracks = col.numContrib(); + if (numOfTracks < 3) + return -9999.; + + for (auto const& track : tracks) { + double pt = track.pt(); + double eta = track.eta(); + double px = track.px(); + double py = track.py(); + if (TMath::Abs(pt) < mSphericityPtmin || TMath::Abs(eta) > 0.8) { + continue; + } + + ptTot += pt; + + s00 += px * px / pt; + s01 += px * py / pt; + // s10 = s01; + s11 += py * py / pt; + } + + // normalize to total Pt to obtain a linear form: + if (ptTot == 0.) + return -9999.; + s00 /= ptTot; + s11 /= ptTot; + s01 /= ptTot; + + // Calculate the trace of the sphericity matrix: + double T = s00 + s11; + // Calculate the determinant of the sphericity matrix: + double D = s00 * s11 - s01 * s01; // S10 = S01 + + // Calculate the eigenvalues of the sphericity matrix: + double lambda1 = 0.5 * (T + std::sqrt(T * T - 4. * D)); + double lambda2 = 0.5 * (T - std::sqrt(T * T - 4. * D)); + + if ((lambda1 + lambda2) == 0.) + return -9999.; + + double spt = -1.; + + if (lambda2 > lambda1) { + spt = 2. * lambda1 / (lambda1 + lambda2); + } else { + spt = 2. * lambda2 / (lambda1 + lambda2); + } + + mHistogramRegistry->fill(HIST("Event/Sphericity"), spt); + + return spt; } private: @@ -194,6 +255,8 @@ class FemtoDreamCollisionSelection bool mCheckIsRun3 = false; ///< Check if running on Pilot Beam triggerAliases mTrigger = kINT7; ///< Trigger to check for float mZvtxMax = 999.f; ///< Maximal deviation from nominal z-vertex (cm) + float mMinSphericity = 0.f; + float mSphericityPtmin = 0.f; }; } // namespace o2::analysis::femtoDream diff --git a/PWGCF/FemtoDream/TableProducer/CMakeLists.txt b/PWGCF/FemtoDream/TableProducer/CMakeLists.txt index 77ece58f958..3af1c541683 100644 --- a/PWGCF/FemtoDream/TableProducer/CMakeLists.txt +++ b/PWGCF/FemtoDream/TableProducer/CMakeLists.txt @@ -14,11 +14,6 @@ o2physics_add_dpl_workflow(femtodream-producer PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(femtodream-producer-withcascades - SOURCES femtoDreamProducerTaskWithCascades.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(femtodream-producer-reduced SOURCES femtoDreamProducerReducedTask.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore diff --git a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerReducedTask.cxx b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerReducedTask.cxx index a879a18517f..a1cd73cbf6f 100644 --- a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerReducedTask.cxx +++ b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerReducedTask.cxx @@ -79,6 +79,8 @@ struct femtoDreamProducerReducedTask { Configurable ConfEvtTriggerSel{"ConfEvtTriggerSel", kINT7, "Evt sel: trigger"}; Configurable ConfEvtOfflineCheck{"ConfEvtOfflineCheck", false, "Evt sel: check for offline selection"}; Configurable ConfEvtAddOfflineCheck{"ConfEvtAddOfflineCheck", false, "Evt sel: additional checks for offline selection (not part of sel8 yet)"}; + Configurable ConfEvtMinSphericity{"ConfEvtMinSphericity", 0.0f, "Evt sel: Min. sphericity of event"}; + Configurable ConfEvtSphericityPtmin{"ConfEvtSphericityPtmin", 0.0f, "Evt sel: Min. Pt for sphericity calculation"}; Configurable ConfTrkRejectNotPropagated{"ConfTrkRejectNotPropagated", false, "True: reject not propagated tracks"}; @@ -116,7 +118,7 @@ struct femtoDreamProducerReducedTask { int CutBits = 8 * sizeof(o2::aod::femtodreamparticle::cutContainerType); Registry.add("AnalysisQA/CutCounter", "; Bit; Counter", kTH1F, {{CutBits + 1, -0.5, CutBits + 0.5}}); - colCuts.setCuts(ConfEvtZvtx.value, ConfEvtTriggerCheck.value, ConfEvtTriggerSel.value, ConfEvtOfflineCheck.value, ConfEvtAddOfflineCheck.value, ConfIsRun3.value); + colCuts.setCuts(ConfEvtZvtx.value, ConfEvtTriggerCheck.value, ConfEvtTriggerSel.value, ConfEvtOfflineCheck.value, ConfEvtAddOfflineCheck.value, ConfIsRun3.value, ConfEvtMinSphericity.value, ConfEvtSphericityPtmin.value); colCuts.init(&qaRegistry); trackCuts.setSelection(ConfTrkCharge, femtoDreamTrackSelection::kSign, femtoDreamSelection::kEqual); diff --git a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx index 0e190295508..f311518c56b 100644 --- a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx +++ b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx @@ -131,6 +131,8 @@ struct femtoDreamProducerTask { Configurable ConfEvtAddOfflineCheck{"ConfEvtAddOfflineCheck", false, "Evt sel: additional checks for offline selection (not part of sel8 yet)"}; Configurable ConfIsActivateV0{"ConfIsActivateV0", true, "Activate filling of V0 into femtodream tables"}; Configurable ConfIsActivateReso{"ConfIsActivateReso", false, "Activate filling of sl Resonances into femtodream tables"}; + Configurable ConfEvtMinSphericity{"ConfEvtMinSphericity", 0.0f, "Evt sel: Min. sphericity of event"}; + Configurable ConfEvtSphericityPtmin{"ConfEvtSphericityPtmin", 0.0f, "Evt sel: Min. Pt for sphericity calculation"}; Configurable ConfTrkRejectNotPropagated{"ConfTrkRejectNotPropagated", false, "True: reject not propagated tracks"}; // Configurable ConfRejectITSHitandTOFMissing{ "ConfRejectITSHitandTOFMissing", false, "True: reject if neither ITS hit nor TOF timing satisfied"}; @@ -270,7 +272,7 @@ struct femtoDreamProducerTask { rctChecker.init(rctCut.cfgEvtRCTFlagCheckerLabel, false, rctCut.cfgEvtRCTFlagCheckerLimitAcceptAsBad); - colCuts.setCuts(ConfEvtZvtx.value, ConfEvtTriggerCheck.value, ConfEvtTriggerSel.value, ConfEvtOfflineCheck.value, ConfEvtAddOfflineCheck.value, ConfIsRun3.value); + colCuts.setCuts(ConfEvtZvtx.value, ConfEvtTriggerCheck.value, ConfEvtTriggerSel.value, ConfEvtOfflineCheck.value, ConfEvtAddOfflineCheck.value, ConfIsRun3.value, ConfEvtMinSphericity.value, ConfEvtSphericityPtmin.value); colCuts.init(&qaRegistry); trackCuts.setSelection(ConfTrkCharge, femtoDreamTrackSelection::kSign, femtoDreamSelection::kEqual); diff --git a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTaskWithCascades.cxx b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTaskWithCascades.cxx deleted file mode 100644 index a7e02ec87e6..00000000000 --- a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTaskWithCascades.cxx +++ /dev/null @@ -1,1173 +0,0 @@ -// Copyright 2019-2025 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 femtoDreamProducerTaskWithCascades.cxx -/// \brief Tasks that produces the track tables used for the pairing -/// \author Laura Serksnyte, TU München, laura.serksnyte@tum.de - -#include -#include -#include -#include -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/PIDResponse.h" -#include "Common/DataModel/PIDResponseITS.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DataFormatsParameters/GRPObject.h" -#include "PWGCF/FemtoDream/Core/femtoDreamCollisionSelection.h" -#include "PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h" -#include "PWGCF/FemtoDream/Core/femtoDreamV0Selection.h" -#include "PWGCF/FemtoDream/Core/femtoDreamCascadeSelection.h" -#include "PWGCF/FemtoDream/Core/femtoDreamUtils.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" -#include "EventFiltering/Zorro.h" -#include "PWGCF/DataModel/FemtoDerived.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "ReconstructionDataFormats/Track.h" -#include "TMath.h" -#include "Math/Vector4D.h" - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; -using namespace o2::analysis::femtoDream; - -namespace o2::aod -{ - -using FemtoFullCollision = soa::Join::iterator; -using FemtoFullCollision_noCent = soa::Join::iterator; -using FemtoFullCollision_CentPbPb = soa::Join::iterator; -using FemtoFullCollisionMC = soa::Join::iterator; -using FemtoFullCollision_noCent_MC = soa::Join::iterator; -using FemtoFullCollisionMC_CentPbPb = soa::Join::iterator; -using FemtoFullMCgenCollisions = soa::Join; -using FemtoFullMCgenCollision = FemtoFullMCgenCollisions::iterator; - -using FemtoFullTracks = - soa::Join; -} // namespace o2::aod - -namespace softwareTriggers -{ -static const int nTriggers = 6; -static const std::vector triggerNames{"fPPP", "fPPL", "fPLL", "fLLL", "fPD", "fLD"}; -static const float triggerSwitches[1][nTriggers]{ - {0, 0, 0, 0, 0, 0}}; -} // namespace softwareTriggers - -template -int getRowDaughters(int daughID, T const& vecID) -{ - int rowInPrimaryTrackTableDaugh = -1; - for (size_t i = 0; i < vecID.size(); i++) { - if (vecID.at(i) == daughID) { - rowInPrimaryTrackTableDaugh = i; - break; - } - } - return rowInPrimaryTrackTableDaugh; -} - -struct femtoDreamProducerTaskWithCascades { - - Zorro zorro; - - Produces outputCollision; - Produces outputMCCollision; - Produces outputCollsMCLabels; - Produces outputParts; - Produces outputPartsMC; - Produces outputDebugParts; - Produces outputPartsMCLabels; - Produces outputDebugPartsMC; - Produces outputPartsExtMCLabels; - - Configurable ConfIsDebug{"ConfIsDebug", true, "Enable Debug tables"}; - Configurable ConfUseItsPid{"ConfUseItsPid", false, "Enable Debug tables"}; - Configurable ConfIsRun3{"ConfIsRun3", false, "Running on Run3 or pilot"}; - Configurable ConfIsForceGRP{"ConfIsForceGRP", false, "Set true if the magnetic field configuration is not available in the usual CCDB directory (e.g. for Run 2 converted data or unanchorad Monte Carlo)"}; - /// Event cuts - FemtoDreamCollisionSelection colCuts; - // Event cuts - Triggers - Configurable ConfEnableTriggerSelection{"ConfEnableTriggerSelection", false, "Should the trigger selection be enabled for collisions?"}; - Configurable> ConfTriggerSwitches{ - "ConfTriggerSwitches", - {softwareTriggers::triggerSwitches[0], 1, softwareTriggers::nTriggers, std::vector{"Switch"}, softwareTriggers::triggerNames}, - "Turn on which trigger should be checked for recorded events to pass selection"}; - Configurable ConfBaseCCDBPathForTriggers{"ConfBaseCCDBPathForTriggers", "Users/m/mpuccio/EventFiltering/OTS/Chunked/", "Provide ccdb path for trigger table; default - trigger coordination"}; - - // Event cuts - usual selection criteria - Configurable ConfEvtZvtx{"ConfEvtZvtx", 10.f, "Evt sel: Max. z-Vertex (cm)"}; - Configurable ConfEvtTriggerCheck{"ConfEvtTriggerCheck", true, "Evt sel: check for trigger"}; - Configurable ConfEvtTriggerSel{"ConfEvtTriggerSel", kINT7, "Evt sel: trigger"}; - Configurable ConfEvtOfflineCheck{"ConfEvtOfflineCheck", false, "Evt sel: check for offline selection"}; - Configurable ConfEvtAddOfflineCheck{"ConfEvtAddOfflineCheck", false, "Evt sel: additional checks for offline selection (not part of sel8 yet)"}; - Configurable ConfIsActivateV0{"ConfIsActivateV0", true, "Activate filling of V0 into femtodream tables"}; - Configurable ConfIsActivateReso{"ConfIsActivateReso", false, "Activate filling of sl Resonances into femtodream tables"}; - Configurable ConfIsActivateCascade{"ConfIsActivateCascade", false, "Activate filling of Cascades into femtodream tables"}; - - Configurable ConfTrkRejectNotPropagated{"ConfTrkRejectNotPropagated", false, "True: reject not propagated tracks"}; - // Configurable ConfRejectITSHitandTOFMissing{ "ConfRejectITSHitandTOFMissing", false, "True: reject if neither ITS hit nor TOF timing satisfied"}; - Configurable ConfTrkPDGCode{"ConfTrkPDGCode", 2212, "PDG code of the selected track for Monte Carlo truth"}; - FemtoDreamTrackSelection trackCuts; - Configurable> ConfTrkCharge{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kSign, "ConfTrk"), std::vector{-1, 1}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kSign, "Track selection: ")}; - Configurable> ConfTrkPtmin{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kpTMin, "ConfTrk"), std::vector{0.5f, 0.4f, 0.6f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kpTMin, "Track selection: ")}; - Configurable> ConfTrkPtmax{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kpTMax, "ConfTrk"), std::vector{5.4f, 5.6f, 5.5f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kpTMax, "Track selection: ")}; - Configurable> ConfTrkEta{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kEtaMax, "ConfTrk"), std::vector{0.8f, 0.7f, 0.9f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kEtaMax, "Track selection: ")}; - Configurable> ConfTrkTPCnclsMin{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kTPCnClsMin, "ConfTrk"), std::vector{80.f, 70.f, 60.f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kTPCnClsMin, "Track selection: ")}; - Configurable> ConfTrkTPCfCls{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kTPCfClsMin, "ConfTrk"), std::vector{0.7f, 0.83f, 0.9f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kTPCfClsMin, "Track selection: ")}; - Configurable> ConfTrkTPCcRowsMin{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kTPCcRowsMin, "ConfTrk"), std::vector{70.f, 60.f, 80.f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kTPCcRowsMin, "Track selection: ")}; - Configurable> ConfTrkTPCsCls{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kTPCsClsMax, "ConfTrk"), std::vector{0.1f, 160.f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kTPCsClsMax, "Track selection: ")}; - Configurable> ConfTrkITSnclsMin{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kITSnClsMin, "ConfTrk"), std::vector{-1.f, 2.f, 4.f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kITSnClsMin, "Track selection: ")}; - Configurable> ConfTrkITSnclsIbMin{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kITSnClsIbMin, "ConfTrk"), std::vector{-1.f, 1.f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kITSnClsIbMin, "Track selection: ")}; - Configurable> ConfTrkDCAxyMax{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kDCAxyMax, "ConfTrk"), std::vector{0.1f, 3.5f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kDCAxyMax, "Track selection: ")}; - Configurable> ConfTrkDCAzMax{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kDCAzMax, "ConfTrk"), std::vector{0.2f, 3.5f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kDCAzMax, "Track selection: ")}; - Configurable> ConfTrkPIDnSigmaMax{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kPIDnSigmaMax, "ConfTrk"), std::vector{3.5f, 3.f, 2.5f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kPIDnSigmaMax, "Track selection: ")}; - Configurable ConfTrkPIDnSigmaOffsetTPC{"ConfTrkPIDnSigmaOffsetTPC", 0., "Offset for TPC nSigma because of bad calibration"}; - Configurable ConfTrkPIDnSigmaOffsetTOF{"ConfTrkPIDnSigmaOffsetTOF", 0., "Offset for TOF nSigma because of bad calibration"}; - Configurable> ConfTrkPIDspecies{"ConfTrkPIDspecies", std::vector{o2::track::PID::Pion, o2::track::PID::Kaon, o2::track::PID::Proton, o2::track::PID::Deuteron}, "Trk sel: Particles species for PID"}; - - FemtoDreamV0Selection v0Cuts; - Configurable> ConfV0Sign{FemtoDreamV0Selection::getSelectionName(femtoDreamV0Selection::kV0Sign, "ConfV0"), std::vector{-1, 1}, FemtoDreamV0Selection::getSelectionHelper(femtoDreamV0Selection::kV0Sign, "V0 selection: ")}; - Configurable> ConfV0PtMin{FemtoDreamV0Selection::getSelectionName(femtoDreamV0Selection::kV0pTMin, "ConfV0"), std::vector{0.3f, 0.4f, 0.5f}, FemtoDreamV0Selection::getSelectionHelper(femtoDreamV0Selection::kV0pTMin, "V0 selection: ")}; - Configurable> ConfV0PtMax{FemtoDreamV0Selection::getSelectionName(femtoDreamV0Selection::kV0pTMax, "ConfV0"), std::vector{3.3f, 3.4f, 3.5f}, FemtoDreamV0Selection::getSelectionHelper(femtoDreamV0Selection::kV0pTMax, "V0 selection: ")}; - Configurable> ConfV0EtaMax{FemtoDreamV0Selection::getSelectionName(femtoDreamV0Selection::kV0etaMax, "ConfV0"), std::vector{0.8f, 0.7f, 0.9f}, FemtoDreamV0Selection::getSelectionHelper(femtoDreamV0Selection::kV0etaMax, "V0 selection: ")}; - Configurable> ConfV0DCADaughMax{FemtoDreamV0Selection::getSelectionName(femtoDreamV0Selection::kV0DCADaughMax, "ConfV0"), std::vector{1.2f, 1.5f}, FemtoDreamV0Selection::getSelectionHelper(femtoDreamV0Selection::kV0DCADaughMax, "V0 selection: ")}; - Configurable> ConfV0CPAMin{FemtoDreamV0Selection::getSelectionName(femtoDreamV0Selection::kV0CPAMin, "ConfV0"), std::vector{0.99f, 0.995f}, FemtoDreamV0Selection::getSelectionHelper(femtoDreamV0Selection::kV0CPAMin, "V0 selection: ")}; - Configurable> ConfV0TranRadMin{FemtoDreamV0Selection::getSelectionName(femtoDreamV0Selection::kV0TranRadMin, "ConfV0"), std::vector{0.2f}, FemtoDreamV0Selection::getSelectionHelper(femtoDreamV0Selection::kV0TranRadMin, "V0 selection: ")}; - Configurable> ConfV0TranRadMax{FemtoDreamV0Selection::getSelectionName(femtoDreamV0Selection::kV0TranRadMax, "ConfV0"), std::vector{100.f}, FemtoDreamV0Selection::getSelectionHelper(femtoDreamV0Selection::kV0TranRadMax, "V0 selection: ")}; - Configurable> ConfV0DecVtxMax{FemtoDreamV0Selection::getSelectionName(femtoDreamV0Selection::kV0DecVtxMax, "ConfV0"), std::vector{100.f}, FemtoDreamV0Selection::getSelectionHelper(femtoDreamV0Selection::kV0DecVtxMax, "V0 selection: ")}; - - Configurable ConfV0InvMassLowLimit{"ConfV0InvV0MassLowLimit", 1.05, "Lower limit of the V0 invariant mass"}; - Configurable ConfV0InvMassUpLimit{"ConfV0InvV0MassUpLimit", 1.30, "Upper limit of the V0 invariant mass"}; - Configurable ConfV0RejectKaons{"ConfV0RejectKaons", false, "Switch to reject kaons"}; - Configurable ConfV0InvKaonMassLowLimit{"ConfV0InvKaonMassLowLimit", 0.48, "Lower limit of the V0 invariant mass for Kaon rejection"}; - Configurable ConfV0InvKaonMassUpLimit{"ConfV0InvKaonMassUpLimit", 0.515, "Upper limit of the V0 invariant mass for Kaon rejection"}; - - Configurable> ConfChildCharge{"ConfChildSign", std::vector{-1, 1}, "V0 Child sel: Charge"}; - Configurable> ConfChildEtaMax{"ConfChildEtaMax", std::vector{0.8f}, "V0 Child sel: max eta"}; - Configurable> ConfChildTPCnClsMin{"ConfChildTPCnClsMin", std::vector{80.f, 70.f, 60.f}, "V0 Child sel: Min. nCls TPC"}; - Configurable> ConfChildDCAMin{"ConfChildDCAMin", std::vector{0.05f, 0.06f}, "V0 Child sel: Max. DCA Daugh to PV (cm)"}; - Configurable> ConfChildPIDnSigmaMax{"ConfChildPIDnSigmaMax", std::vector{5.f, 4.f}, "V0 Child sel: Max. PID nSigma TPC"}; - Configurable> ConfChildPIDspecies{"ConfChildPIDspecies", std::vector{o2::track::PID::Pion, o2::track::PID::Proton}, "V0 Child sel: Particles species for PID"}; - - FemtoDreamCascadeSelection cascadeCuts; - struct : o2::framework::ConfigurableGroup { - Configurable ConfCascInvMassLowLimit{"ConfCascInvMassLowLimit", 1.2, "Lower limit of the Cascade invariant mass"}; - Configurable ConfCascInvMassUpLimit{"ConfCascInvMassUpLimit", 1.5, "Upper limit of the Cascade invariant mass"}; - Configurable ConfCascIsSelectedOmega{"ConfCascIsSelectedOmega", false, "Select Omegas instead of Xis (invariant mass)"}; - // Cascade - Configurable> ConfCascadeSign{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadeSign, "ConfCascade"), std::vector{-1, 1}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadeSign, "Cascade selection: ")}; - Configurable> ConfCascadePtMin{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadePtMin, "ConfCascade"), std::vector{0.3f, 0.4f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadePtMin, "Cascade selection: ")}; - Configurable> ConfCascadePtMax{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadePtMax, "ConfCascade"), std::vector{5.5f, 6.0f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadePtMax, "Cascade selection: ")}; - Configurable> ConfCascadeEtaMax{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadeEtaMax, "ConfCascade"), std::vector{0.8f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadeEtaMax, "Cascade selection: ")}; - Configurable> ConfCascadeDCADaughMax{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadeDCADaughMax, "ConfCascade"), std::vector{1.f, 1.2f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadeDCADaughMax, "Cascade selection: ")}; - Configurable> ConfCascadeCPAMin{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadeCPAMin, "ConfCascade"), std::vector{0.99f, 0.95f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadeCPAMin, "Cascade selection: ")}; - Configurable> ConfCascadeTranRadMin{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadeTranRadMin, "ConfCascade"), std::vector{0.2f, 0.5f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadeTranRadMin, "Cascade selection: ")}; - Configurable> ConfCascadeTranRadMax{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadeTranRadMax, "ConfCascade"), std::vector{100.f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadeTranRadMax, "Cascade selection: ")}; - Configurable> ConfCascadeDecVtxMax{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadeDecVtxMax, "ConfCascade"), std::vector{100.f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadeDecVtxMax, "Cascade selection: ")}; - - // Cascade v0 daughters - Configurable> ConfCascadeV0DCADaughMax{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadeV0DCADaughMax, "ConfCascade"), std::vector{1.2f, 1.5f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadeV0DCADaughMax, "CascV0 selection: ")}; - Configurable> ConfCascadeV0CPAMin{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadeV0CPAMin, "ConfCascade"), std::vector{0.99f, 0.995f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadeV0CPAMin, "CascV0 selection: ")}; - Configurable> ConfCascadeV0TranRadMin{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadeV0TranRadMin, "ConfCascade"), std::vector{0.2f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadeV0TranRadMin, "CascV0 selection: ")}; - Configurable> ConfCascadeV0TranRadMax{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadeV0TranRadMax, "ConfCascade"), std::vector{100.f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadeV0TranRadMax, "CascV0 selection: ")}; - Configurable> ConfCascadeV0DCAtoPVMin{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadeV0DCAtoPVMin, "ConfCascade"), std::vector{100.f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadeV0DCAtoPVMin, "CascV0 selection: ")}; - Configurable> ConfCascadeV0DCAtoPVMax{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadeV0DCAtoPVMax, "ConfCascade"), std::vector{100.f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadeV0DCAtoPVMax, "CascV0 selection: ")}; - Configurable ConfCascV0InvMassLowLimit{"ConfCascV0InvMassLowLimit", 1.011461, "Lower limit of the Cascade invariant mass"}; - Configurable ConfCascV0InvMassUpLimit{"ConfCascV0InvMassUpLimit", 1.027461, "Upper limit of the Cascade invariant mass"}; - // Cascade Daughter Tracks - Configurable> ConfCascV0ChildCharge{"ConfCascV0ChildSign", std::vector{-1, 1}, "CascV0 Child sel: Charge"}; - Configurable> ConfCascV0ChildPtMin{"ConfCascV0ChildPtMin", std::vector{0.8f}, "CascV0 Child sel: min pt"}; - Configurable> ConfCascV0ChildEtaMax{"ConfCascV0ChildEtaMax", std::vector{0.8f}, "CascV0 Child sel: max eta"}; - Configurable> ConfCascV0ChildTPCnClsMin{"ConfCascV0ChildTPCnClsMin", std::vector{80.f, 70.f, 60.f}, "CascV0 Child sel: Min. nCls TPC"}; - Configurable> ConfCascV0ChildDCAMin{"ConfCascV0ChildDCAMin", std::vector{0.05f, 0.06f}, "CascV0 Child sel: Max. DCA Daugh to PV (cm)"}; - Configurable> ConfCascV0ChildPIDnSigmaMax{"ConfCascV0ChildPIDnSigmaMax", std::vector{5.f, 4.f}, "CascV0 Child sel: Max. PID nSigma TPC"}; - Configurable> ConfCascV0ChildPIDspecies{"ConfCascV0ChildPIDspecies", std::vector{o2::track::PID::Pion, o2::track::PID::Proton}, "CascV0 Child sel: Particles species for PID"}; - // Cascade Bachelor Track - Configurable> ConfCascBachelorCharge{"ConfCascBachelorSign", std::vector{-1, 1}, "Cascade Bachelor sel: Charge"}; - Configurable> ConfCascBachelorPtMin{"ConfCascBachelorPtMin", std::vector{0.8f}, "Cascade Bachelor sel: min pt"}; - Configurable> ConfCascBachelorEtaMax{"ConfCascBachelorEtaMax", std::vector{0.8f}, "Cascade Bachelor sel: max eta"}; - Configurable> ConfCascBachelorTPCnClsMin{"ConfCascBachelorTPCnClsMin", std::vector{80.f, 70.f, 60.f}, "Cascade Bachelor sel: Min. nCls TPC"}; - Configurable> ConfCascBachelorDCAMin{"ConfCascBachelorDCAMin", std::vector{0.05f, 0.06f}, "Cascade Bachelor sel: Max. DCA Daugh to PV (cm)"}; - Configurable> ConfCascBachelorPIDnSigmaMax{"ConfCascBachelorPIDnSigmaMax", std::vector{5.f, 4.f}, "Cascade Bachelor sel: Max. PID nSigma TPC"}; - Configurable> ConfCascBachelorPIDspecies{"ConfCascBachelorPIDspecies", std::vector{o2::track::PID::Pion}, "Cascade Bachelor sel: Particles species for PID"}; - - Configurable ConfCascRejectCompetingMass{"ConfCascRejectCompetingMass", false, "Switch on to reject Omegas (for Xi) or Xis (for Omegas)"}; - Configurable ConfCascInvCompetingMassLowLimit{"ConfCascInvCompetingMassLowLimit", 1.66, "Lower limit of the cascade invariant mass for competing mass rejection"}; - Configurable ConfCascInvCompetingMassUpLimit{"ConfCascInvCompetingMassUpLimit", 1.68, "Upper limit of the cascade invariant mass for competing mass rejection"}; - - } ConfCascSel; - - // Resonances - Configurable ConfResoInvMassLowLimit{"ConfResoInvMassLowLimit", 1.011461, "Lower limit of the Reso invariant mass"}; - Configurable ConfResoInvMassUpLimit{"ConfResoInvMassUpLimit", 1.027461, "Upper limit of the Reso invariant mass"}; - Configurable> ConfDaughterCharge{"ConfDaughterCharge", std::vector{1, -1}, "Reso Daughter sel: Charge"}; - Configurable> ConfDaughterEta{"ConfDaughterEta", std::vector{0.8, 0.8}, "Reso Daughter sel: Eta"}; // 0.8 - Configurable> ConfDaughterDCAxy{"ConfDaughterDCAxy", std::vector{0.1, 0.1}, "Reso Daughter sel: DCAxy"}; // 0.1 - Configurable> ConfDaughterDCAz{"ConfDaughterDCAz", std::vector{0.2, 0.2}, "Reso Daughter sel: DCAz"}; // 0.2 - Configurable> ConfDaughterNClus{"ConfDaughterNClus", std::vector{80, 80}, "Reso Daughter sel: NClusters"}; // 0.2 - Configurable> ConfDaughterNCrossed{"ConfDaughterNCrossed", std::vector{70, 70}, "Reso Daughter sel: NCrossedRowss"}; - Configurable> ConfDaughterTPCfCls{"ConfDaughterTPCfCls", std::vector{0.8, 0.8}, "Reso Daughter sel: Minimum fraction of crossed rows over findable cluster"}; // 0.2 - Configurable> ConfDaughterPtUp{"ConfDaughterPtUp", std::vector{2.0, 2.0}, "Reso Daughter sel: Upper limit pT"}; // 2.0 - Configurable> ConfDaughterPtLow{"ConfDaughterPtLow", std::vector{0.15, 0.15}, "Reso Daughter sel: Lower limit pT"}; // 0.15 - Configurable> ConfDaughterPTPCThr{"ConfDaughterPTPCThr", std::vector{0.40, 0.40}, "Reso Daughter sel: momentum threshold TPC only PID, p_TPC,Thr"}; // 0.4 - Configurable> ConfDaughterPIDnSigmaMax{"ConfDaughterPIDnSigmaMax", std::vector{3.00, 3.00}, "Reso Daughter sel: Max. PID nSigma TPC"}; // 3.0 - Configurable> ConfDaughterPIDspecies{"ConfDaughterPIDspecies", std::vector{o2::track::PID::Kaon, o2::track::PID::Kaon}, "Reso Daughter sel: Particles species for PID"}; - Configurable> ConfDaug1Daugh2ResoMass{"ConfDaug1Daugh2ResoMass", std::vector{o2::constants::physics::MassKPlus, o2::constants::physics::MassKMinus, o2::constants::physics::MassPhi}, "Masses: Daughter1 - Daughter2 - Resonance"}; - - /// \todo should we add filter on min value pT/eta of V0 and daughters? - /*Filter v0Filter = (nabs(aod::v0data::x) < V0DecVtxMax.value) && - (nabs(aod::v0data::y) < V0DecVtxMax.value) && - (nabs(aod::v0data::z) < V0DecVtxMax.value);*/ - // (aod::v0data::v0radius > V0TranRadV0Min.value); to be added, not working - // for now do not know why - - /// General options - struct : o2::framework::ConfigurableGroup { - Configurable ConfTrkMinChi2PerClusterTPC{"ConfTrkMinChi2PerClusterTPC", 0.f, "Lower limit for chi2 of TPC; currently for testing only"}; - Configurable ConfTrkMaxChi2PerClusterTPC{"ConfTrkMaxChi2PerClusterTPC", 1000.f, "Upper limit for chi2 of TPC; currently for testing only"}; - Configurable ConfTrkMaxChi2PerClusterITS{"ConfTrkMaxChi2PerClusterITS", 1000.0f, "Minimal track selection: max allowed chi2 per ITS cluster"}; // 36.0 is default - Configurable ConfTrkTPCRefit{"ConfTrkTPCRefit", false, "True: require TPC refit"}; - Configurable ConfTrkITSRefit{"ConfTrkITSRefit", false, "True: require ITS refit"}; - - } OptionTrackSpecialSelections; - - HistogramRegistry qaRegistry{"QAHistos", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry TrackRegistry{"Tracks", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry V0Registry{"V0", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry ResoRegistry{"Reso", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry CascadeRegistry{"Cascade", {}, OutputObjHandlingPolicy::AnalysisObject}; - - int mRunNumber; - float mMagField; - std::string zorroTriggerNames = ""; - Service ccdb; /// Accessing the CCDB - - void init(InitContext&) - { - if (doprocessData == false && doprocessData_noCentrality == false && doprocessData_CentPbPb == false && doprocessMC == false && doprocessMC_noCentrality == false && doprocessMC_CentPbPb == false) { - LOGF(fatal, "Neither processData nor processMC enabled. Please choose one."); - } - if ((doprocessData == true && doprocessMC == true) || (doprocessData == true && doprocessMC_noCentrality == true) || (doprocessMC == true && doprocessMC_noCentrality == true) || (doprocessData_noCentrality == true && doprocessData == true) || (doprocessData_noCentrality == true && doprocessMC == true) || (doprocessData_noCentrality == true && doprocessMC_noCentrality == true) || (doprocessData_CentPbPb == true && doprocessData == true) || (doprocessData_CentPbPb == true && doprocessData_noCentrality == true) || (doprocessData_CentPbPb == true && doprocessMC == true) || (doprocessData_CentPbPb == true && doprocessMC_noCentrality == true) || (doprocessData_CentPbPb == true && doprocessMC_CentPbPb == true)) { - LOGF(fatal, - "Cannot enable more than one process switch at the same time. " - "Please choose one."); - } - - int CutBits = 8 * sizeof(o2::aod::femtodreamparticle::cutContainerType); - TrackRegistry.add("AnalysisQA/CutCounter", "; Bit; Counter", kTH1F, {{CutBits + 1, -0.5, CutBits + 0.5}}); - TrackRegistry.add("AnalysisQA/Chi2ITSTPCperCluster", "; ITS_Chi2; TPC_Chi2", kTH2F, {{100, 0, 50}, {100, 0, 20}}); - TrackRegistry.add("AnalysisQA/RefitITSTPC", "; ITS_Refit; TPC_Refit", kTH2F, {{2, 0, 2}, {2, 0, 2}}); - TrackRegistry.add("AnalysisQA/getGenStatusCode", "; Bit; Entries", kTH1F, {{200, 0, 200}}); - TrackRegistry.add("AnalysisQA/getProcess", "; Bit; Entries", kTH1F, {{200, 0, 200}}); - TrackRegistry.add("AnalysisQA/Mother", "; Bit; Entries", kTH1F, {{4000, -4000, 4000}}); - TrackRegistry.add("AnalysisQA/Particle", "; Bit; Entries", kTH1F, {{4000, -4000, 4000}}); - V0Registry.add("AnalysisQA/CutCounter", "; Bit; Counter", kTH1F, {{CutBits + 1, -0.5, CutBits + 0.5}}); - CascadeRegistry.add("AnalysisQA/CutCounter", "; Bit; Counter", kTH1F, {{CutBits + 1, -0.5, CutBits + 0.5}}); - ResoRegistry.add("AnalysisQA/Reso/InvMass", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.8, 1.5}}); - ResoRegistry.add("AnalysisQA/Reso/InvMass_selected", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.8, 1.5}}); - ResoRegistry.add("AnalysisQA/Reso/Daughter1/Pt", "Transverse momentum of all processed tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - ResoRegistry.add("AnalysisQA/Reso/Daughter1/Eta", "Pseudorapidity of all processed tracks;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); - ResoRegistry.add("AnalysisQA/Reso/Daughter1/Phi", "Azimuthal angle of all processed tracks;#phi;Entries", HistType::kTH1F, {{720, 0, TMath::TwoPi()}}); - ResoRegistry.add("AnalysisQA/Reso/Daughter2/Pt", "Transverse momentum of all processed tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - ResoRegistry.add("AnalysisQA/Reso/Daughter2/Eta", "Pseudorapidity of all processed tracks;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); - ResoRegistry.add("AnalysisQA/Reso/Daughter2/Phi", "Azimuthal angle of all processed tracks;#phi;Entries", HistType::kTH1F, {{720, 0, TMath::TwoPi()}}); - ResoRegistry.add("AnalysisQA/Reso/PtD1_selected", "Transverse momentum of all processed tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - ResoRegistry.add("AnalysisQA/Reso/PtD2_selected", "Transverse momentum of all processed tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - - if (ConfEnableTriggerSelection) { - for (const std::string& triggerName : softwareTriggers::triggerNames) { - if (ConfTriggerSwitches->get("Switch", triggerName.c_str())) { - zorroTriggerNames += triggerName + ","; - } - } - zorroTriggerNames.pop_back(); - } - - colCuts.setCuts(ConfEvtZvtx.value, ConfEvtTriggerCheck.value, ConfEvtTriggerSel.value, ConfEvtOfflineCheck.value, ConfEvtAddOfflineCheck.value, ConfIsRun3.value); - colCuts.init(&qaRegistry); - - trackCuts.setSelection(ConfTrkCharge, femtoDreamTrackSelection::kSign, femtoDreamSelection::kEqual); - trackCuts.setSelection(ConfTrkPtmin, femtoDreamTrackSelection::kpTMin, femtoDreamSelection::kLowerLimit); - trackCuts.setSelection(ConfTrkPtmax, femtoDreamTrackSelection::kpTMax, femtoDreamSelection::kUpperLimit); - trackCuts.setSelection(ConfTrkEta, femtoDreamTrackSelection::kEtaMax, femtoDreamSelection::kAbsUpperLimit); - trackCuts.setSelection(ConfTrkTPCnclsMin, femtoDreamTrackSelection::kTPCnClsMin, femtoDreamSelection::kLowerLimit); - trackCuts.setSelection(ConfTrkTPCfCls, femtoDreamTrackSelection::kTPCfClsMin, femtoDreamSelection::kLowerLimit); - trackCuts.setSelection(ConfTrkTPCcRowsMin, femtoDreamTrackSelection::kTPCcRowsMin, femtoDreamSelection::kLowerLimit); - trackCuts.setSelection(ConfTrkTPCsCls, femtoDreamTrackSelection::kTPCsClsMax, femtoDreamSelection::kUpperLimit); - trackCuts.setSelection(ConfTrkITSnclsMin, femtoDreamTrackSelection::kITSnClsMin, femtoDreamSelection::kLowerLimit); - trackCuts.setSelection(ConfTrkITSnclsIbMin, femtoDreamTrackSelection::kITSnClsIbMin, femtoDreamSelection::kLowerLimit); - trackCuts.setSelection(ConfTrkDCAxyMax, femtoDreamTrackSelection::kDCAxyMax, femtoDreamSelection::kAbsUpperLimit); - trackCuts.setSelection(ConfTrkDCAzMax, femtoDreamTrackSelection::kDCAzMax, femtoDreamSelection::kAbsUpperLimit); - trackCuts.setSelection(ConfTrkPIDnSigmaMax, femtoDreamTrackSelection::kPIDnSigmaMax, femtoDreamSelection::kAbsUpperLimit); - trackCuts.setPIDSpecies(ConfTrkPIDspecies); - trackCuts.setnSigmaPIDOffset(ConfTrkPIDnSigmaOffsetTPC, ConfTrkPIDnSigmaOffsetTOF); - trackCuts.init(&qaRegistry, &TrackRegistry); - - /// \todo fix how to pass array to setSelection, getRow() passing a - /// different type! - // v0Cuts.setSelection(ConfV0Selection->getRow(0), - // femtoDreamV0Selection::kDecVtxMax, femtoDreamSelection::kAbsUpperLimit); - if (ConfIsActivateV0) { - v0Cuts.setSelection(ConfV0Sign, femtoDreamV0Selection::kV0Sign, femtoDreamSelection::kEqual); - v0Cuts.setSelection(ConfV0PtMin, femtoDreamV0Selection::kV0pTMin, femtoDreamSelection::kLowerLimit); - v0Cuts.setSelection(ConfV0PtMax, femtoDreamV0Selection::kV0pTMax, femtoDreamSelection::kUpperLimit); - v0Cuts.setSelection(ConfV0EtaMax, femtoDreamV0Selection::kV0etaMax, femtoDreamSelection::kAbsUpperLimit); - v0Cuts.setSelection(ConfV0DCADaughMax, femtoDreamV0Selection::kV0DCADaughMax, femtoDreamSelection::kUpperLimit); - v0Cuts.setSelection(ConfV0CPAMin, femtoDreamV0Selection::kV0CPAMin, femtoDreamSelection::kLowerLimit); - v0Cuts.setSelection(ConfV0TranRadMin, femtoDreamV0Selection::kV0TranRadMin, femtoDreamSelection::kLowerLimit); - v0Cuts.setSelection(ConfV0TranRadMax, femtoDreamV0Selection::kV0TranRadMax, femtoDreamSelection::kUpperLimit); - v0Cuts.setSelection(ConfV0DecVtxMax, femtoDreamV0Selection::kV0DecVtxMax, femtoDreamSelection::kUpperLimit); - v0Cuts.setChildCuts(femtoDreamV0Selection::kPosTrack, ConfChildCharge, femtoDreamTrackSelection::kSign, femtoDreamSelection::kEqual); - v0Cuts.setChildCuts(femtoDreamV0Selection::kPosTrack, ConfChildEtaMax, femtoDreamTrackSelection::kEtaMax, femtoDreamSelection::kAbsUpperLimit); - v0Cuts.setChildCuts(femtoDreamV0Selection::kPosTrack, ConfChildTPCnClsMin, femtoDreamTrackSelection::kTPCnClsMin, femtoDreamSelection::kLowerLimit); - v0Cuts.setChildCuts(femtoDreamV0Selection::kPosTrack, ConfChildDCAMin, femtoDreamTrackSelection::kDCAMin, femtoDreamSelection::kAbsLowerLimit); - v0Cuts.setChildCuts(femtoDreamV0Selection::kPosTrack, ConfChildPIDnSigmaMax, femtoDreamTrackSelection::kPIDnSigmaMax, femtoDreamSelection::kAbsUpperLimit); - - v0Cuts.setChildCuts(femtoDreamV0Selection::kNegTrack, ConfChildCharge, femtoDreamTrackSelection::kSign, femtoDreamSelection::kEqual); - v0Cuts.setChildCuts(femtoDreamV0Selection::kNegTrack, ConfChildEtaMax, femtoDreamTrackSelection::kEtaMax, femtoDreamSelection::kAbsUpperLimit); - v0Cuts.setChildCuts(femtoDreamV0Selection::kNegTrack, ConfChildTPCnClsMin, femtoDreamTrackSelection::kTPCnClsMin, femtoDreamSelection::kLowerLimit); - v0Cuts.setChildCuts(femtoDreamV0Selection::kNegTrack, ConfChildDCAMin, femtoDreamTrackSelection::kDCAMin, femtoDreamSelection::kAbsLowerLimit); - v0Cuts.setChildCuts(femtoDreamV0Selection::kNegTrack, ConfChildPIDnSigmaMax, femtoDreamTrackSelection::kPIDnSigmaMax, femtoDreamSelection::kAbsUpperLimit); - v0Cuts.setChildPIDSpecies(femtoDreamV0Selection::kPosTrack, ConfChildPIDspecies); - v0Cuts.setChildPIDSpecies(femtoDreamV0Selection::kNegTrack, ConfChildPIDspecies); - v0Cuts.init(&qaRegistry, &V0Registry); - v0Cuts.setInvMassLimits(ConfV0InvMassLowLimit, ConfV0InvMassUpLimit); - - v0Cuts.setChildRejectNotPropagatedTracks(femtoDreamV0Selection::kPosTrack, ConfTrkRejectNotPropagated); - v0Cuts.setChildRejectNotPropagatedTracks(femtoDreamV0Selection::kNegTrack, ConfTrkRejectNotPropagated); - - v0Cuts.setnSigmaPIDOffsetTPC(ConfTrkPIDnSigmaOffsetTPC); - v0Cuts.setChildnSigmaPIDOffset(femtoDreamV0Selection::kPosTrack, ConfTrkPIDnSigmaOffsetTPC, ConfTrkPIDnSigmaOffsetTOF); - v0Cuts.setChildnSigmaPIDOffset(femtoDreamV0Selection::kNegTrack, ConfTrkPIDnSigmaOffsetTPC, ConfTrkPIDnSigmaOffsetTOF); - - if (ConfV0RejectKaons) { - v0Cuts.setKaonInvMassLimits(ConfV0InvKaonMassLowLimit, ConfV0InvKaonMassUpLimit); - } - } - if (ConfIsActivateCascade) { - // Cascades - cascadeCuts.setSelection(ConfCascSel.ConfCascadeSign, femtoDreamCascadeSelection::kCascadeSign, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadeSign)); - cascadeCuts.setSelection(ConfCascSel.ConfCascadePtMin, femtoDreamCascadeSelection::kCascadePtMin, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadePtMin)); - cascadeCuts.setSelection(ConfCascSel.ConfCascadePtMax, femtoDreamCascadeSelection::kCascadePtMax, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadePtMax)); - cascadeCuts.setSelection(ConfCascSel.ConfCascadeEtaMax, femtoDreamCascadeSelection::kCascadeEtaMax, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadeEtaMax)); - cascadeCuts.setSelection(ConfCascSel.ConfCascadeDCADaughMax, femtoDreamCascadeSelection::kCascadeDCADaughMax, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadeDCADaughMax)); - cascadeCuts.setSelection(ConfCascSel.ConfCascadeCPAMin, femtoDreamCascadeSelection::kCascadeCPAMin, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadeCPAMin)); - cascadeCuts.setSelection(ConfCascSel.ConfCascadeTranRadMin, femtoDreamCascadeSelection::kCascadeTranRadMin, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadeTranRadMin)); - cascadeCuts.setSelection(ConfCascSel.ConfCascadeTranRadMax, femtoDreamCascadeSelection::kCascadeTranRadMax, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadeTranRadMax)); - cascadeCuts.setSelection(ConfCascSel.ConfCascadeDecVtxMax, femtoDreamCascadeSelection::kCascadeDecVtxMax, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadeDecVtxMax)); - // Cascade v0 - cascadeCuts.setSelection(ConfCascSel.ConfCascadeV0DCADaughMax, femtoDreamCascadeSelection::kCascadeV0DCADaughMax, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadeV0DCADaughMax)); - cascadeCuts.setSelection(ConfCascSel.ConfCascadeV0CPAMin, femtoDreamCascadeSelection::kCascadeV0CPAMin, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadeV0CPAMin)); - cascadeCuts.setSelection(ConfCascSel.ConfCascadeV0TranRadMin, femtoDreamCascadeSelection::kCascadeV0TranRadMin, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadeV0TranRadMin)); - cascadeCuts.setSelection(ConfCascSel.ConfCascadeV0TranRadMax, femtoDreamCascadeSelection::kCascadeV0TranRadMax, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadeV0TranRadMax)); - cascadeCuts.setSelection(ConfCascSel.ConfCascadeV0DCAtoPVMin, femtoDreamCascadeSelection::kCascadeV0DCAtoPVMin, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadeV0DCAtoPVMin)); - cascadeCuts.setSelection(ConfCascSel.ConfCascadeV0DCAtoPVMax, femtoDreamCascadeSelection::kCascadeV0DCAtoPVMax, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadeV0DCAtoPVMax)); - - // Cascade Daughter Tracks - cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kPosTrack, ConfCascSel.ConfCascV0ChildCharge, femtoDreamTrackSelection::kSign, femtoDreamSelection::kEqual); - cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kPosTrack, ConfCascSel.ConfCascV0ChildPtMin, femtoDreamTrackSelection::kpTMin, femtoDreamSelection::kLowerLimit); - cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kPosTrack, ConfCascSel.ConfCascV0ChildEtaMax, femtoDreamTrackSelection::kEtaMax, femtoDreamSelection::kAbsUpperLimit); - cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kPosTrack, ConfCascSel.ConfCascV0ChildTPCnClsMin, femtoDreamTrackSelection::kTPCnClsMin, femtoDreamSelection::kLowerLimit); - cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kPosTrack, ConfCascSel.ConfCascV0ChildDCAMin, femtoDreamTrackSelection::kDCAMin, femtoDreamSelection::kAbsLowerLimit); - cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kPosTrack, ConfCascSel.ConfCascV0ChildPIDnSigmaMax, femtoDreamTrackSelection::kPIDnSigmaMax, femtoDreamSelection::kAbsUpperLimit); - cascadeCuts.setChildPIDSpecies(femtoDreamCascadeSelection::kPosTrack, ConfCascSel.ConfCascV0ChildPIDspecies); - - cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kNegTrack, ConfCascSel.ConfCascV0ChildCharge, femtoDreamTrackSelection::kSign, femtoDreamSelection::kEqual); - cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kNegTrack, ConfCascSel.ConfCascV0ChildPtMin, femtoDreamTrackSelection::kpTMin, femtoDreamSelection::kLowerLimit); - cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kNegTrack, ConfCascSel.ConfCascV0ChildEtaMax, femtoDreamTrackSelection::kEtaMax, femtoDreamSelection::kAbsUpperLimit); - cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kNegTrack, ConfCascSel.ConfCascV0ChildTPCnClsMin, femtoDreamTrackSelection::kTPCnClsMin, femtoDreamSelection::kLowerLimit); - cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kNegTrack, ConfCascSel.ConfCascV0ChildDCAMin, femtoDreamTrackSelection::kDCAMin, femtoDreamSelection::kAbsLowerLimit); - cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kNegTrack, ConfCascSel.ConfCascV0ChildPIDnSigmaMax, femtoDreamTrackSelection::kPIDnSigmaMax, femtoDreamSelection::kAbsUpperLimit); - cascadeCuts.setChildPIDSpecies(femtoDreamCascadeSelection::kNegTrack, ConfCascSel.ConfCascV0ChildPIDspecies); - - // Cascade Bachelor Track - cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kBachTrack, ConfCascSel.ConfCascBachelorCharge, femtoDreamTrackSelection::kSign, femtoDreamSelection::kEqual); - cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kBachTrack, ConfCascSel.ConfCascBachelorPtMin, femtoDreamTrackSelection::kpTMin, femtoDreamSelection::kLowerLimit); - cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kBachTrack, ConfCascSel.ConfCascBachelorEtaMax, femtoDreamTrackSelection::kEtaMax, femtoDreamSelection::kAbsUpperLimit); - cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kBachTrack, ConfCascSel.ConfCascBachelorTPCnClsMin, femtoDreamTrackSelection::kTPCnClsMin, femtoDreamSelection::kLowerLimit); - cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kBachTrack, ConfCascSel.ConfCascBachelorDCAMin, femtoDreamTrackSelection::kDCAMin, femtoDreamSelection::kAbsLowerLimit); - cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kBachTrack, ConfCascSel.ConfCascBachelorPIDnSigmaMax, femtoDreamTrackSelection::kPIDnSigmaMax, femtoDreamSelection::kAbsUpperLimit); - cascadeCuts.setChildPIDSpecies(femtoDreamCascadeSelection::kBachTrack, ConfCascSel.ConfCascBachelorPIDspecies); - - cascadeCuts.init(&qaRegistry, &CascadeRegistry, ConfCascSel.ConfCascIsSelectedOmega); - cascadeCuts.setInvMassLimits(ConfCascSel.ConfCascInvMassLowLimit, ConfCascSel.ConfCascInvMassUpLimit); - cascadeCuts.setV0InvMassLimits(ConfCascSel.ConfCascV0InvMassLowLimit, ConfCascSel.ConfCascV0InvMassUpLimit); - if (ConfCascSel.ConfCascRejectCompetingMass) { - cascadeCuts.setCompetingInvMassLimits(ConfCascSel.ConfCascInvCompetingMassLowLimit, ConfCascSel.ConfCascInvCompetingMassUpLimit); - } - } - - mRunNumber = 0; - mMagField = 0.0; - /// Initializing CCDB - ccdb->setURL("http://alice-ccdb.cern.ch"); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - - int64_t now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); - ccdb->setCreatedNotAfter(now); - } - - /// Function to retrieve the nominal magnetic field in kG (0.1T) and convert it directly to T - void initCCDB_Mag_Trig(aod::BCsWithTimestamps::iterator bc) - { - // TODO done only once (and not per run). Will be replaced by CCDBConfigurable - // get magnetic field for run - if (mRunNumber == bc.runNumber()) - return; - auto timestamp = bc.timestamp(); - float output = -999; - - if (ConfIsRun3 && !ConfIsForceGRP) { - static o2::parameters::GRPMagField* grpo = nullptr; - grpo = ccdb->getForTimeStamp("GLO/Config/GRPMagField", timestamp); - if (grpo == nullptr) { - LOGF(fatal, "GRP object not found for timestamp %llu", timestamp); - return; - } - LOGF(info, "Retrieved GRP for timestamp %llu with L3 ", timestamp, grpo->getL3Current()); - // taken from GRP onject definition of getNominalL3Field; update later to something smarter (mNominalL3Field = std::lround(5.f * mL3Current / 30000.f);) - auto NominalL3Field = std::lround(5.f * grpo->getL3Current() / 30000.f); - output = 0.1 * (NominalL3Field); - - } else { - - static o2::parameters::GRPObject* grpo = nullptr; - grpo = ccdb->getForTimeStamp("GLO/GRP/GRP", timestamp); - if (grpo == nullptr) { - LOGF(fatal, "GRP object not found for timestamp %llu", timestamp); - return; - } - LOGF(info, "Retrieved GRP for timestamp %llu with magnetic field of %d kG", timestamp, grpo->getNominalL3Field()); - output = 0.1 * (grpo->getNominalL3Field()); - } - mMagField = output; - mRunNumber = bc.runNumber(); - - // Init for zorro to get trigger flags - if (ConfEnableTriggerSelection) { - zorro.setCCDBpath(ConfBaseCCDBPathForTriggers); - zorro.initCCDB(ccdb.service, mRunNumber, timestamp, zorroTriggerNames); - } - } - - template - void fillDebugParticle(ParticleType const& particle) - { - if constexpr (isTrackOrV0) { - if constexpr (hasItsPid) { - outputDebugParts(particle.sign(), - (uint8_t)particle.tpcNClsFound(), - particle.tpcNClsFindable(), - (uint8_t)particle.tpcNClsCrossedRows(), - particle.tpcNClsShared(), - particle.tpcInnerParam(), - particle.itsNCls(), - particle.itsNClsInnerBarrel(), - particle.dcaXY(), - particle.dcaZ(), - particle.tpcSignal(), - particle.tpcNSigmaEl(), - particle.tpcNSigmaPi(), - particle.tpcNSigmaKa(), - particle.tpcNSigmaPr(), - particle.tpcNSigmaDe(), - particle.tpcNSigmaTr(), - particle.tpcNSigmaHe(), - particle.tofNSigmaEl(), - particle.tofNSigmaPi(), - particle.tofNSigmaKa(), - particle.tofNSigmaPr(), - particle.tofNSigmaDe(), - particle.tofNSigmaTr(), - particle.tofNSigmaHe(), - o2::analysis::femtoDream::itsSignal(particle), - particle.itsNSigmaEl(), - particle.itsNSigmaPi(), - particle.itsNSigmaKa(), - particle.itsNSigmaPr(), - particle.itsNSigmaDe(), - particle.itsNSigmaTr(), - particle.itsNSigmaHe(), - -999., -999., -999., -999., -999., -999., - -999., -999., -999., -999., -999., -999., -999.); - } else { - outputDebugParts(particle.sign(), - (uint8_t)particle.tpcNClsFound(), - particle.tpcNClsFindable(), - (uint8_t)particle.tpcNClsCrossedRows(), - particle.tpcNClsShared(), - particle.tpcInnerParam(), - particle.itsNCls(), - particle.itsNClsInnerBarrel(), - particle.dcaXY(), - particle.dcaZ(), - particle.tpcSignal(), - particle.tpcNSigmaEl(), - particle.tpcNSigmaPi(), - particle.tpcNSigmaKa(), - particle.tpcNSigmaPr(), - particle.tpcNSigmaDe(), - particle.tpcNSigmaTr(), - particle.tpcNSigmaHe(), - particle.tofNSigmaEl(), - particle.tofNSigmaPi(), - particle.tofNSigmaKa(), - particle.tofNSigmaPr(), - particle.tofNSigmaDe(), - particle.tofNSigmaTr(), - particle.tofNSigmaHe(), - -999., -999., -999., -999., -999., -999., -999., -999., - -999., -999., -999., -999., -999., -999., - -999., -999., -999., -999., -999., -999., -999.); - } - } else { - outputDebugParts(-999., // sign - -999., -999., -999., -999., -999., -999., -999., -999., -999., // track properties (DCA, NCls, crossed rows, etc.) - -999., -999., -999., -999., -999., -999., -999., -999., // TPC PID (TPC signal + particle hypothesis) - -999., -999., -999., -999., -999., -999., -999., // TOF PID - -999., -999., -999., -999., -999., -999., -999., -999., // ITS PID - particle.dcaV0daughters(), - particle.v0radius(), - particle.x(), - particle.y(), - particle.z(), - particle.mK0Short(), - -999., -999., -999., -999., -999., -999., -999.); // Cascade properties - } - } - - template - void fillDebugCascade(ParticleType const& cascade, CollisionType const& col) - { - outputDebugParts(cascade.sign(), // sign - -999., -999., -999., -999., -999., -999., -999., -999., -999., // track properties (DCA, NCls, crossed rows, etc.) - -999., -999., -999., -999., -999., -999., -999., -999., // TPC PID (TPC signal + particle hypothesis) - -999., -999., -999., -999., -999., -999., -999., // TOF PID - -999., -999., -999., -999., -999., -999., -999., -999., // ITS PID - cascade.dcaV0daughters(), - cascade.v0radius(), - -999., // DecVtxV0 x - -999., // DecVtxV0 y - -999., // DecVtxV0 z - -999., // mKaon - cascade.dcav0topv(col.posX(), col.posY(), col.posZ()), - cascade.dcacascdaughters(), - cascade.cascradius(), - cascade.x(), - cascade.y(), - cascade.z(), - cascade.mOmega()); // QA for Reso - } - - template - void fillMCParticle(CollisionType const& col, ParticleType const& particle, o2::aod::femtodreamparticle::ParticleType fdparttype) - { - if (particle.has_mcParticle()) { - // get corresponding MC particle and its info - auto particleMC = particle.mcParticle(); - auto pdgCode = particleMC.pdgCode(); - TrackRegistry.fill(HIST("AnalysisQA/Particle"), pdgCode); - int particleOrigin = 99; - int pdgCodeMother = -1; - // get list of mothers, but it could be empty (for example in case of injected light nuclei) - auto motherparticlesMC = particleMC.template mothers_as(); - // check pdg code - TrackRegistry.fill(HIST("AnalysisQA/getGenStatusCode"), particleMC.getGenStatusCode()); - TrackRegistry.fill(HIST("AnalysisQA/getProcess"), particleMC.getProcess()); - // if this fails, the particle is a fake - if (abs(pdgCode) == abs(ConfTrkPDGCode.value)) { - // check first if particle is from pile up - // check if the collision associated with the particle is the same as the analyzed collision by checking their Ids - if ((col.has_mcCollision() && (particleMC.mcCollisionId() != col.mcCollisionId())) || !col.has_mcCollision()) { - particleOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kWrongCollision; - // check if particle is primary - } else if (particleMC.isPhysicalPrimary()) { - particleOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kPrimary; - // check if particle is secondary - // particle is from a decay -> getProcess() == 4 - // particle is generated during transport -> getGenStatusCode() == -1 - // list of mothers is not empty - } else if (particleMC.getProcess() == 4 && particleMC.getGenStatusCode() == -1 && !motherparticlesMC.empty()) { - // get direct mother - auto motherparticleMC = motherparticlesMC.front(); - pdgCodeMother = motherparticleMC.pdgCode(); - TrackRegistry.fill(HIST("AnalysisQA/Mother"), pdgCodeMother); - particleOrigin = checkDaughterType(fdparttype, motherparticleMC.pdgCode()); - // check if particle is material - // particle is from inelastic hadronic interaction -> getProcess() == 23 - // particle is generated during transport -> getGenStatusCode() == -1 - } else if (particleMC.getProcess() == 23 && particleMC.getGenStatusCode() == -1) { - particleOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kMaterial; - // cross check to see if we missed a case - } else { - particleOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kElse; - } - // if pdg code is wrong, particle is fake - } else { - particleOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kFake; - } - - outputPartsMC(particleOrigin, pdgCode, particleMC.pt(), particleMC.eta(), particleMC.phi()); - outputPartsMCLabels(outputPartsMC.lastIndex()); - if (ConfIsDebug) { - outputPartsExtMCLabels(outputPartsMC.lastIndex()); - outputDebugPartsMC(pdgCodeMother); - } - } else { - outputPartsMCLabels(-1); - if (ConfIsDebug) { - outputPartsExtMCLabels(-1); - } - } - } - - template - void fillMCCollision(CollisionType const& col) - { - if (col.has_mcCollision()) { - auto genMCcol = col.template mcCollision_as(); - outputMCCollision(genMCcol.multMCNParticlesEta08()); - outputCollsMCLabels(outputMCCollision.lastIndex()); - } else { - outputCollsMCLabels(-1); - } - } - template - void fillCollisionsAndTracksAndV0AndCascade(CollisionType const& col, TrackType const& tracks, TrackTypeWithItsPid const& tracksWithItsPid, V0Type const& fullV0s, CascadeType const& fullCascades) - { - // If triggering is enabled, select only events which were triggered wit our triggers - if (ConfEnableTriggerSelection) { - bool zorroSelected = zorro.isSelected(col.template bc_as().globalBC()); /// check if event was selected by triggers of interest - if (!zorroSelected) { - return; - } - } - - const auto vtxZ = col.posZ(); - const auto spher = colCuts.computeSphericity(col, tracks); - float mult = 0; - int multNtr = 0; - if (ConfIsRun3) { - if constexpr (useCentrality) { - if constexpr (analysePbPb) { - mult = col.centFT0C(); - } else { - mult = col.centFT0M(); - } - } else { - mult = 0; - } - multNtr = col.multNTracksPV(); - } else { - mult = 1; // multiplicity percentile is know in Run 2 - multNtr = col.multTracklets(); - } - - colCuts.fillQA(col, mult); - - // check whether the basic event selection criteria are fulfilled - // that included checking if there is at least on usable track or V0 - if (!colCuts.isSelectedCollision(col)) { - return; - } - bool emptyCollision = false; - if (ConfIsActivateCascade.value) { - if (colCuts.isEmptyCollision(col, tracks, trackCuts) && colCuts.isCollisionWithoutTrkCasc(col, fullCascades, cascadeCuts, tracks)) { - emptyCollision = true; - } - } - if (ConfIsActivateV0.value) { - if (colCuts.isEmptyCollision(col, tracks, trackCuts) && colCuts.isEmptyCollision(col, fullV0s, v0Cuts, tracks)) { - emptyCollision = true; - } - } else { - if (colCuts.isEmptyCollision(col, tracks, trackCuts)) { - emptyCollision = true; - } - } - if (emptyCollision) { - return; - } - - outputCollision(vtxZ, mult, multNtr, spher, mMagField); - if constexpr (isMC) { - fillMCCollision(col); - } - - std::vector childIDs = {0, 0}; // these IDs are necessary to keep track of the children - std::vector cascadechildIDs = {0, 0, 0}; // these IDs are necessary to keep track of the children - std::vector tmpIDtrack; // this vector keeps track of the matching of the primary track table row <-> aod::track table global index - std::vector Daughter1, Daughter2; - - for (auto& track : tracksWithItsPid) { - /// if the most open selection criteria are not fulfilled there is no - /// point looking further at the track - trackCuts.fillQA(track); - - if (track.tpcChi2NCl() < OptionTrackSpecialSelections.ConfTrkMinChi2PerClusterTPC || track.tpcChi2NCl() > OptionTrackSpecialSelections.ConfTrkMaxChi2PerClusterTPC) { - continue; - } - if (track.itsChi2NCl() > OptionTrackSpecialSelections.ConfTrkMaxChi2PerClusterITS) { - continue; - } - if ((OptionTrackSpecialSelections.ConfTrkTPCRefit && !track.hasTPC()) || (OptionTrackSpecialSelections.ConfTrkITSRefit && !track.hasITS())) { - continue; - } - - if (!trackCuts.isSelectedMinimal(track)) { - continue; - } - - TrackRegistry.fill(HIST("AnalysisQA/Chi2ITSTPCperCluster"), track.itsChi2NCl(), track.tpcChi2NCl()); - TrackRegistry.fill(HIST("AnalysisQA/RefitITSTPC"), track.hasITS(), track.hasTPC()); - - trackCuts.fillQA(track); - // the bit-wise container of the systematic variations is obtained - std::array cutContainer; - cutContainer = trackCuts.getCutContainer(track, track.pt(), track.eta(), sqrtf(powf(track.dcaXY(), 2.f) + powf(track.dcaZ(), 2.f))); - - // now the table is filled - outputParts(outputCollision.lastIndex(), - track.pt(), - track.eta(), - track.phi(), - aod::femtodreamparticle::ParticleType::kTrack, - cutContainer.at(femtoDreamTrackSelection::TrackContainerPosition::kCuts), - cutContainer.at(femtoDreamTrackSelection::TrackContainerPosition::kPID), - track.dcaXY(), childIDs, 0, 0); - tmpIDtrack.push_back(track.globalIndex()); - if (ConfIsDebug.value) { - fillDebugParticle(track); - } - - if constexpr (isMC) { - fillMCParticle(col, track, o2::aod::femtodreamparticle::ParticleType::kTrack); - } - - if (ConfIsActivateReso.value) { - // Already strict cuts for Daughter of reso selection - // TO DO: change TTV0 task to apply there the strict selection and have here only loose selection - - // select daugher 1 - if (track.sign() == ConfDaughterCharge.value[0] && track.pt() <= ConfDaughterPtUp.value[0] && track.pt() >= ConfDaughterPtLow.value[0] && std::abs(track.eta()) <= ConfDaughterEta.value[0] && std::abs(track.dcaXY()) <= ConfDaughterDCAxy.value[0] && std::abs(track.dcaZ()) <= ConfDaughterDCAz.value[0] && track.tpcNClsCrossedRows() >= ConfDaughterNCrossed.value[0] && track.tpcNClsFound() >= ConfDaughterNClus.value[0] && track.tpcCrossedRowsOverFindableCls() >= ConfDaughterTPCfCls.value[0]) { - if ((track.tpcInnerParam() < ConfDaughterPTPCThr.value[0] && std::abs(o2::aod::pidutils::tpcNSigma(ConfDaughterPIDspecies.value[0], track)) <= ConfDaughterPIDnSigmaMax.value[0]) || - (track.tpcInnerParam() >= ConfDaughterPTPCThr.value[0] && std::abs(std::sqrt(o2::aod::pidutils::tpcNSigma(ConfDaughterPIDspecies.value[0], track) * o2::aod::pidutils::tpcNSigma(ConfDaughterPIDspecies.value[0], track) + o2::aod::pidutils::tofNSigma(ConfDaughterPIDspecies.value[0], track) * o2::aod::pidutils::tofNSigma(ConfDaughterPIDspecies.value[0], track))) <= ConfDaughterPIDnSigmaMax.value[0])) { - Daughter1.push_back(track); - ResoRegistry.fill(HIST("AnalysisQA/Reso/Daughter1/Pt"), track.pt()); - ResoRegistry.fill(HIST("AnalysisQA/Reso/Daughter1/Eta"), track.eta()); - ResoRegistry.fill(HIST("AnalysisQA/Reso/Daughter1/Phi"), track.phi()); - } - } - // select daugher 2 - if (track.sign() == ConfDaughterCharge.value[1] && track.pt() <= ConfDaughterPtUp.value[1] && track.pt() >= ConfDaughterPtLow.value[1] && std::abs(track.eta()) <= ConfDaughterEta.value[1] && std::abs(track.dcaXY()) <= ConfDaughterDCAxy.value[1] && std::abs(track.dcaZ()) <= ConfDaughterDCAz.value[1] && track.tpcNClsCrossedRows() >= ConfDaughterNCrossed.value[1] && track.tpcNClsFound() >= ConfDaughterNClus.value[1] && track.tpcCrossedRowsOverFindableCls() >= ConfDaughterTPCfCls.value[1]) { - if ((track.tpcInnerParam() < ConfDaughterPTPCThr.value[1] && std::abs(o2::aod::pidutils::tpcNSigma(ConfDaughterPIDspecies.value[1], track)) <= ConfDaughterPIDnSigmaMax.value[1]) || - (track.tpcInnerParam() >= ConfDaughterPTPCThr.value[1] && std::abs(std::sqrt(o2::aod::pidutils::tpcNSigma(ConfDaughterPIDspecies.value[1], track) * o2::aod::pidutils::tpcNSigma(ConfDaughterPIDspecies.value[1], track) + o2::aod::pidutils::tofNSigma(ConfDaughterPIDspecies.value[1], track) * o2::aod::pidutils::tofNSigma(ConfDaughterPIDspecies.value[1], track))) <= ConfDaughterPIDnSigmaMax.value[1])) { - Daughter2.push_back(track); - ResoRegistry.fill(HIST("AnalysisQA/Reso/Daughter2/Pt"), track.pt()); - ResoRegistry.fill(HIST("AnalysisQA/Reso/Daughter2/Eta"), track.eta()); - ResoRegistry.fill(HIST("AnalysisQA/Reso/Daughter2/Phi"), track.phi()); - } - } - } - } - - if (ConfIsActivateV0.value) { - for (auto& v0 : fullV0s) { - - auto postrack = v0.template posTrack_as(); - auto negtrack = v0.template negTrack_as(); - ///\tocheck funnily enough if we apply the filter the - /// sign of Pos and Neg track is always negative - // const auto dcaXYpos = postrack.dcaXY(); - // const auto dcaZpos = postrack.dcaZ(); - // const auto dcapos = std::sqrt(pow(dcaXYpos, 2.) + pow(dcaZpos, 2.)); - v0Cuts.fillLambdaQA(col, v0, postrack, negtrack); - - if (!v0Cuts.isSelectedMinimal(col, v0, postrack, negtrack)) { - continue; - } - - // if (ConfRejectITSHitandTOFMissing) { - // Uncomment only when TOF timing is solved - // bool itsHit = o2PhysicsTrackSelection->IsSelected(postrack, - // TrackSelection::TrackCuts::kITSHits); bool itsHit = - // o2PhysicsTrackSelection->IsSelected(negtrack, - // TrackSelection::TrackCuts::kITSHits); - // } - - v0Cuts.fillQA(col, v0, postrack, negtrack); ///\todo fill QA also for daughters - auto cutContainerV0 = v0Cuts.getCutContainer(col, v0, postrack, negtrack); - - int postrackID = v0.posTrackId(); - int rowInPrimaryTrackTablePos = -1; - rowInPrimaryTrackTablePos = getRowDaughters(postrackID, tmpIDtrack); - childIDs[0] = rowInPrimaryTrackTablePos; - childIDs[1] = 0; - outputParts(outputCollision.lastIndex(), - v0.positivept(), v0.positiveeta(), v0.positivephi(), - aod::femtodreamparticle::ParticleType::kV0Child, - cutContainerV0.at(femtoDreamV0Selection::V0ContainerPosition::kPosCuts), - cutContainerV0.at(femtoDreamV0Selection::V0ContainerPosition::kPosPID), - postrack.dcaXY(), - childIDs, - 0, - 0); - const int rowOfPosTrack = outputParts.lastIndex(); - if constexpr (isMC) { - fillMCParticle(col, postrack, o2::aod::femtodreamparticle::ParticleType::kV0Child); - } - int negtrackID = v0.negTrackId(); - int rowInPrimaryTrackTableNeg = -1; - rowInPrimaryTrackTableNeg = getRowDaughters(negtrackID, tmpIDtrack); - childIDs[0] = 0; - childIDs[1] = rowInPrimaryTrackTableNeg; - outputParts(outputCollision.lastIndex(), - v0.negativept(), - v0.negativeeta(), - v0.negativephi(), - aod::femtodreamparticle::ParticleType::kV0Child, - cutContainerV0.at(femtoDreamV0Selection::V0ContainerPosition::kNegCuts), - cutContainerV0.at(femtoDreamV0Selection::V0ContainerPosition::kNegPID), - negtrack.dcaXY(), - childIDs, - 0, - 0); - const int rowOfNegTrack = outputParts.lastIndex(); - if constexpr (isMC) { - fillMCParticle(col, negtrack, o2::aod::femtodreamparticle::ParticleType::kV0Child); - } - std::vector indexChildID = {rowOfPosTrack, rowOfNegTrack}; - outputParts(outputCollision.lastIndex(), - v0.pt(), - v0.eta(), - v0.phi(), - aod::femtodreamparticle::ParticleType::kV0, - cutContainerV0.at(femtoDreamV0Selection::V0ContainerPosition::kV0), - 0, - v0.v0cosPA(), - indexChildID, - v0.mLambda(), - v0.mAntiLambda()); - if (ConfIsDebug.value) { - fillDebugParticle(postrack); // QA for positive daughter - fillDebugParticle(negtrack); // QA for negative daughter - fillDebugParticle(v0); // QA for v0 - } - if constexpr (isMC) { - fillMCParticle(col, v0, o2::aod::femtodreamparticle::ParticleType::kV0); - } - } - } - if (ConfIsActivateCascade.value) { - for (auto& casc : fullCascades) { - // get the daughter tracks - const auto& posTrackCasc = casc.template posTrack_as(); - const auto& negTrackCasc = casc.template negTrack_as(); - const auto& bachTrackCasc = casc.template bachelor_as(); - - cascadeCuts.fillQA<0, aod::femtodreamparticle::ParticleType::kCascade>(col, casc, posTrackCasc, negTrackCasc, bachTrackCasc); - if (!cascadeCuts.isSelectedMinimal(col, casc, posTrackCasc, negTrackCasc, bachTrackCasc)) { - continue; - } - cascadeCuts.fillQA<1, aod::femtodreamparticle::ParticleType::kCascade>(col, casc, posTrackCasc, negTrackCasc, bachTrackCasc); - - // auto cutContainerCasc = cascadeCuts.getCutContainer(col, casc, v0daugh, posTrackCasc, negTrackCasc, bachTrackCasc); - auto cutContainerCasc = cascadeCuts.getCutContainer(col, casc, posTrackCasc, negTrackCasc, bachTrackCasc); - - // Fill positive child - int poscasctrackID = casc.posTrackId(); - int rowInPrimaryTrackTablePosCasc = -1; - rowInPrimaryTrackTablePosCasc = getRowDaughters(poscasctrackID, tmpIDtrack); - cascadechildIDs[0] = rowInPrimaryTrackTablePosCasc; - cascadechildIDs[1] = 0; - cascadechildIDs[2] = 0; - outputParts(outputCollision.lastIndex(), - posTrackCasc.pt(), - posTrackCasc.eta(), - posTrackCasc.phi(), - aod::femtodreamparticle::ParticleType::kCascadeV0Child, - cutContainerCasc.at(femtoDreamCascadeSelection::CascadeContainerPosition::kPosCuts), - cutContainerCasc.at(femtoDreamCascadeSelection::CascadeContainerPosition::kPosPID), - posTrackCasc.dcaXY(), - cascadechildIDs, - 0, - 0); - const int rowOfPosCascadeTrack = outputParts.lastIndex(); - // TODO: include here MC filling - //------ - - // Fill negative child - int negcasctrackID = casc.negTrackId(); - int rowInPrimaryTrackTableNegCasc = -1; - rowInPrimaryTrackTableNegCasc = getRowDaughters(negcasctrackID, tmpIDtrack); - cascadechildIDs[0] = 0; - cascadechildIDs[1] = rowInPrimaryTrackTableNegCasc; - cascadechildIDs[2] = 0; - outputParts(outputCollision.lastIndex(), - negTrackCasc.pt(), - negTrackCasc.eta(), - negTrackCasc.phi(), - aod::femtodreamparticle::ParticleType::kCascadeV0Child, - cutContainerCasc.at(femtoDreamCascadeSelection::CascadeContainerPosition::kNegCuts), - cutContainerCasc.at(femtoDreamCascadeSelection::CascadeContainerPosition::kNegPID), - negTrackCasc.dcaXY(), - cascadechildIDs, - 0, - 0); - const int rowOfNegCascadeTrack = outputParts.lastIndex(); - // TODO: include here MC filling - //------ - - // Fill bachelor child - int bachelorcasctrackID = casc.bachelorId(); - int rowInPrimaryTrackTableBachelorCasc = -1; - rowInPrimaryTrackTableBachelorCasc = getRowDaughters(bachelorcasctrackID, tmpIDtrack); - cascadechildIDs[0] = 0; - cascadechildIDs[1] = 0; - cascadechildIDs[2] = rowInPrimaryTrackTableBachelorCasc; - outputParts(outputCollision.lastIndex(), - bachTrackCasc.pt(), - bachTrackCasc.eta(), - bachTrackCasc.phi(), - aod::femtodreamparticle::ParticleType::kCascadeBachelor, - cutContainerCasc.at(femtoDreamCascadeSelection::CascadeContainerPosition::kBachCuts), - cutContainerCasc.at(femtoDreamCascadeSelection::CascadeContainerPosition::kBachPID), - bachTrackCasc.dcaXY(), - cascadechildIDs, - 0, - 0); - const int rowOfBachelorCascadeTrack = outputParts.lastIndex(); - // TODO: include here MC filling - //------ - - // Fill cascades - std::vector indexCascadeChildID = {rowOfPosCascadeTrack, rowOfNegCascadeTrack, rowOfBachelorCascadeTrack}; - outputParts(outputCollision.lastIndex(), - casc.pt(), - casc.eta(), - casc.phi(), - aod::femtodreamparticle::ParticleType::kCascade, - cutContainerCasc.at(femtoDreamCascadeSelection::CascadeContainerPosition::kCascade), - 0, - casc.casccosPA(col.posX(), col.posY(), col.posZ()), - indexCascadeChildID, - casc.mXi(), - casc.mLambda()); - // TODO: include here MC filling - //------ - - if (ConfIsDebug.value) { - fillDebugParticle(posTrackCasc); // QA for positive daughter - fillDebugParticle(negTrackCasc); // QA for negative daughter - fillDebugParticle(bachTrackCasc); // QA for negative daughter - fillDebugCascade(casc, col); // QA for Cascade - } - } - } - - if (ConfIsActivateReso.value) { - for (std::size_t iDaug1 = 0; iDaug1 < Daughter1.size(); ++iDaug1) { - for (std::size_t iDaug2 = 0; iDaug2 < Daughter2.size(); ++iDaug2) { - // MC stuff is still missing, also V0 QA - // ALSO: fix indices and other table entries which are now set to 0 as deflaut as not needed for p-p-phi cf ana - - ROOT::Math::PtEtaPhiMVector tempD1(Daughter1.at(iDaug1).pt(), Daughter1.at(iDaug1).eta(), Daughter1.at(iDaug1).phi(), ConfDaug1Daugh2ResoMass.value[0]); - ROOT::Math::PtEtaPhiMVector tempD2(Daughter2.at(iDaug2).pt(), Daughter2.at(iDaug2).eta(), Daughter2.at(iDaug2).phi(), ConfDaug1Daugh2ResoMass.value[1]); - - ROOT::Math::PtEtaPhiMVector tempPhi = tempD1 + tempD2; - - ResoRegistry.fill(HIST("AnalysisQA/Reso/InvMass"), tempPhi.M()); - - if ((tempPhi.M() >= ConfResoInvMassLowLimit.value) && (tempPhi.M() <= ConfResoInvMassUpLimit.value)) { - - ResoRegistry.fill(HIST("AnalysisQA/Reso/InvMass_selected"), tempPhi.M()); - ResoRegistry.fill(HIST("AnalysisQA/Reso/PtD1_selected"), Daughter1.at(iDaug1).pt()); - ResoRegistry.fill(HIST("AnalysisQA/Reso/PtD2_selected"), Daughter2.at(iDaug2).pt()); - - childIDs[0] = 0; - childIDs[1] = 0; - std::vector indexChildID = {0, 0}; - outputParts(outputCollision.lastIndex(), - static_cast(Daughter1.at(iDaug1).pt()), static_cast(Daughter1.at(iDaug1).eta()), static_cast(Daughter1.at(iDaug1).phi()), - aod::femtodreamparticle::ParticleType::kV0Child, - static_cast(0), - static_cast(0), - static_cast(Daughter1.at(iDaug1).dcaXY()), - childIDs, - 0, - 0); - outputParts(outputCollision.lastIndex(), - static_cast(Daughter2.at(iDaug2).pt()), static_cast(Daughter2.at(iDaug2).eta()), static_cast(Daughter2.at(iDaug2).phi()), - aod::femtodreamparticle::ParticleType::kV0Child, - static_cast(0), - static_cast(0), - static_cast(Daughter2.at(iDaug2).dcaXY()), - childIDs, - 0, - 0); - outputParts(outputCollision.lastIndex(), - static_cast(tempPhi.pt()), - static_cast(tempPhi.eta()), - static_cast(tempPhi.phi()), - aod::femtodreamparticle::ParticleType::kV0, - static_cast(0), - 0, - 0.f, - indexChildID, - tempPhi.M(), - tempPhi.M()); - if (ConfIsDebug.value) { - fillDebugParticle(Daughter1.at(iDaug1)); // QA for positive daughter - fillDebugParticle(Daughter2.at(iDaug2)); // QA for negative daughter - outputDebugParts(-999., // sign - -999., -999., -999., -999., -999., -999., -999., -999., -999., // track properties (DCA, NCls, crossed rows, etc.) - -999., -999., -999., -999., -999., -999., -999., -999., // TPC PID (TPC signal + particle hypothesis) - -999., -999., -999., -999., -999., -999., -999., // TOF PID - -999., -999., -999., -999., -999., -999., -999., -999., // ITS PID - -999., -999., -999., -999., -999., -999., // V0 properties - -999., -999., -999., -999., -999., -999., -999.); // Cascade properties - } - } - } - } - } - } - - void - processData(aod::FemtoFullCollision const& col, - aod::BCsWithTimestamps const&, - aod::FemtoFullTracks const& tracks, - o2::aod::V0Datas const& fullV0s, - o2::aod::V0sLinked const&, - o2::aod::CascDatas const& fullCascades) - { - // get magnetic field for run - initCCDB_Mag_Trig(col.bc_as()); - // fill the tables - auto tracksWithItsPid = soa::Attach(tracks); - if (ConfUseItsPid.value) { - fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracksWithItsPid, fullV0s, fullCascades); - } else { - fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracks, fullV0s, fullCascades); - } - } - PROCESS_SWITCH(femtoDreamProducerTaskWithCascades, processData, - "Provide experimental data", true); - - void - processData_noCentrality(aod::FemtoFullCollision_noCent const& col, - aod::BCsWithTimestamps const&, - aod::FemtoFullTracks const& tracks, - o2::aod::V0Datas const& fullV0s, - o2::aod::V0sLinked const&, - o2::aod::CascDatas const& fullCascades) - { - // get magnetic field for run - initCCDB_Mag_Trig(col.bc_as()); - // fill the tables - auto tracksWithItsPid = soa::Attach(tracks); - if (ConfUseItsPid.value) { - fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracksWithItsPid, fullV0s, fullCascades); - } else { - fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracks, fullV0s, fullCascades); - } - } - PROCESS_SWITCH(femtoDreamProducerTaskWithCascades, processData_noCentrality, - "Provide experimental data without centrality information", false); - - void processData_CentPbPb(aod::FemtoFullCollision_CentPbPb const& col, - aod::BCsWithTimestamps const&, - aod::FemtoFullTracks const& tracks, - o2::aod::V0Datas const& fullV0s, - o2::aod::CascDatas const& fullCascades) - { - // get magnetic field for run - initCCDB_Mag_Trig(col.bc_as()); - // fill the tables - auto tracksWithItsPid = soa::Attach(tracks); - if (ConfUseItsPid.value) { - fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracksWithItsPid, fullV0s, fullCascades); - } else { - fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracks, fullV0s, fullCascades); - } - } - PROCESS_SWITCH(femtoDreamProducerTaskWithCascades, processData_CentPbPb, - "Provide experimental data with centrality information for PbPb collisions", false); - - void processMC(aod::FemtoFullCollisionMC const& col, - aod::BCsWithTimestamps const&, - soa::Join const& tracks, - aod::FemtoFullMCgenCollisions const&, - aod::McParticles const&, - soa::Join const& fullV0s, /// \todo with FilteredFullV0s - soa::Join const& fullCascades) - { - // get magnetic field for run - initCCDB_Mag_Trig(col.bc_as()); - // fill the tables - fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracks, fullV0s, fullCascades); - } - PROCESS_SWITCH(femtoDreamProducerTaskWithCascades, processMC, "Provide MC data", false); - - void processMC_noCentrality(aod::FemtoFullCollision_noCent_MC const& col, - aod::BCsWithTimestamps const&, - soa::Join const& tracks, - aod::FemtoFullMCgenCollisions const&, - aod::McParticles const&, - soa::Join const& fullV0s, /// \todo with FilteredFullV0s - soa::Join const& fullCascades) - { - // get magnetic field for run - initCCDB_Mag_Trig(col.bc_as()); - // fill the tables - fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracks, fullV0s, fullCascades); - } - PROCESS_SWITCH(femtoDreamProducerTaskWithCascades, processMC_noCentrality, "Provide MC data without requiring a centrality calibration", false); - - void processMC_CentPbPb(aod::FemtoFullCollisionMC_CentPbPb const& col, - aod::BCsWithTimestamps const&, - soa::Join const& tracks, - aod::FemtoFullMCgenCollisions const&, - aod::McParticles const&, - soa::Join const& fullV0s, /// \todo with FilteredFullV0s - soa::Join const& fullCascades) - { - // get magnetic field for run - initCCDB_Mag_Trig(col.bc_as()); - // fill the tables - fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracks, fullV0s, fullCascades); - } - PROCESS_SWITCH(femtoDreamProducerTaskWithCascades, processMC_CentPbPb, "Provide MC data with centrality information for PbPb collisions", false); -}; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - WorkflowSpec workflow{adaptAnalysisTask(cfgc)}; - return workflow; -} diff --git a/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackTrack.cxx b/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackTrack.cxx index 9f080fd2dd0..6f45f0c2672 100644 --- a/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackTrack.cxx +++ b/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackTrack.cxx @@ -76,9 +76,10 @@ struct femtoDreamPairTaskTrackTrack { Configurable MultMax{"MultMax", 99999, "Maximum Multiplicity (MultNtr)"}; Configurable MultPercentileMin{"MultPercentileMin", 0, "Maximum Multiplicity Percentile"}; Configurable MultPercentileMax{"MultPercentileMax", 100, "Minimum Multiplicity Percentile"}; + Configurable SphericityMin{"SphericityMin", 0, "Minimum event sphericity"}; } EventSel; - Filter EventMultiplicity = aod::femtodreamcollision::multNtr >= EventSel.MultMin && aod::femtodreamcollision::multNtr <= EventSel.MultMax; + Filter EventMultiplicity = aod::femtodreamcollision::multNtr >= EventSel.MultMin && aod::femtodreamcollision::multNtr <= EventSel.MultMax && aod::femtodreamcollision::sphericity >= EventSel.SphericityMin; Filter EventMultiplicityPercentile = aod::femtodreamcollision::multV0M >= EventSel.MultPercentileMin && aod::femtodreamcollision::multV0M <= EventSel.MultPercentileMax; using FilteredCollisions = soa::Filtered; From a93d2f88faadb04442fd8ff6615d4c6d5efeb70d Mon Sep 17 00:00:00 2001 From: basiach <74355517+basiach@users.noreply.github.com> Date: Fri, 22 Aug 2025 16:56:10 +0200 Subject: [PATCH 150/986] [PWGCF] FemtoUniverse - Improving daughter nSigma selection in processCascadeQA for Cascade task (#12685) Co-authored-by: Barbara Chytla --- ...toUniversePairTaskTrackCascadeExtended.cxx | 28 ++++++------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx index 8cad618d1dd..b6abc21628c 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx @@ -57,8 +57,9 @@ struct femtoUniversePairTaskTrackCascadeExtended { Configurable confCascInvMassLowLimit{"confCascInvMassLowLimit", 1.315, "Lower limit of the Casc invariant mass"}; Configurable confCascInvMassUpLimit{"confCascInvMassUpLimit", 1.325, "Upper limit of the Casc invariant mass"}; - Configurable confNSigmaTPCPion{"confNSigmaTPCPion", 4, "NSigmaTPCPion"}; - Configurable confNSigmaTPCProton{"confNSigmaTPCProton", 4, "NSigmaTPCProton"}; + // TODO: Add seperate selection for daughter particles + // Configurable confNSigmaTPCPion{"confNSigmaTPCPion", 4, "NSigmaTPCPion"}; + // Configurable confNSigmaTPCProton{"confNSigmaTPCProton", 4, "NSigmaTPCProton"}; /// applying narrow cut Configurable confZVertexCut{"confZVertexCut", 10.f, "Event sel: Maximum z-Vertex (cm)"}; @@ -350,25 +351,12 @@ struct femtoUniversePairTaskTrackCascadeExtended { const auto& negChild = parts.iteratorAt(part.globalIndex() - 2 - parts.begin().globalIndex()); const auto& bachelor = parts.iteratorAt(part.globalIndex() - 1 - parts.begin().globalIndex()); - // nSigma selection for daughter and bachelor tracks - if (part.sign() < 0) { - if (std::abs(posChild.tpcNSigmaPr()) > confNSigmaTPCProton) { - continue; - } - if (std::abs(negChild.tpcNSigmaPi()) > confNSigmaTPCPion) { - continue; - } - } else { - if (std::abs(negChild.tpcNSigmaPr()) > confNSigmaTPCProton) { - continue; - } - if (std::abs(posChild.tpcNSigmaPi()) > confNSigmaTPCPion) { - continue; - } - } - if (std::abs(bachelor.tpcNSigmaPi()) > confNSigmaTPCPion) { + float posChildTPC, negChildTPC, bachelorTPC, posChildTOF, negChildTOF, bachelorTOF; + if (!isParticleTPC(posChild, CascChildTable[confCascType1][0], &posChildTPC) || !isParticleTPC(negChild, CascChildTable[confCascType1][1], &negChildTPC) || !isParticleTPC(bachelor, CascChildTable[confCascType1][2], &bachelorTPC)) + continue; + + if ((!confCheckTOFBachelorOnly && (!isParticleTOF(posChild, CascChildTable[confCascType1][0], &posChildTOF) || !isParticleTOF(negChild, CascChildTable[confCascType1][1], &negChildTOF))) || !isParticleTOF(bachelor, CascChildTable[confCascType1][2], &bachelorTOF)) continue; - } rXiQA.fill(HIST("hPtXi"), part.pt()); rXiQA.fill(HIST("hEtaXi"), part.eta()); From 7281da1980c5145b96996430f28bbde8d5d9bd11 Mon Sep 17 00:00:00 2001 From: Fabio Catalano Date: Fri, 22 Aug 2025 17:38:01 +0200 Subject: [PATCH 151/986] [PWGHF] Add number of PV contributors to OmegaC trees (#12676) --- PWGHF/TableProducer/treeCreatorOmegac0ToOmegaPi.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/PWGHF/TableProducer/treeCreatorOmegac0ToOmegaPi.cxx b/PWGHF/TableProducer/treeCreatorOmegac0ToOmegaPi.cxx index 4fb9c92235c..f102151596c 100644 --- a/PWGHF/TableProducer/treeCreatorOmegac0ToOmegaPi.cxx +++ b/PWGHF/TableProducer/treeCreatorOmegac0ToOmegaPi.cxx @@ -211,7 +211,7 @@ DECLARE_SOA_TABLE(HfKfOmegacFulls, "AOD", "HFKFOMEGACFULL", full::MassV0Ndf, full::MassCascNdf, full::V0Chi2OverNdf, full::CascChi2OverNdf, full::OmegacChi2OverNdf, full::MassV0Chi2OverNdf, full::MassCascChi2OverNdf, full::CascRejectInvmass, - full::FlagMcMatchRec, full::OriginMcRec, full::CollisionMatched, hf_track_index::HFflag); + full::FlagMcMatchRec, full::OriginMcRec, full::CollisionMatched, hf_track_index::HFflag, collision::NumContrib); DECLARE_SOA_TABLE(HfKfOmegacLites, "AOD", "HFKFOMEGACLITE", full::NSigmaTPCPiFromOmegac, full::NSigmaTOFPiFromOmegac, full::NSigmaTPCKaFromCasc, full::NSigmaTOFKaFromCasc, @@ -225,7 +225,7 @@ DECLARE_SOA_TABLE(HfKfOmegacLites, "AOD", "HFKFOMEGACLITE", full::CosThetaStarPiFromOmegac, full::CtOmegac, full::EtaOmegac, full::V0Chi2OverNdf, full::CascChi2OverNdf, full::OmegacChi2OverNdf, full::CascRejectInvmass, - full::FlagMcMatchRec, full::OriginMcRec, full::CollisionMatched, hf_track_index::HFflag); + full::FlagMcMatchRec, full::OriginMcRec, full::CollisionMatched, hf_track_index::HFflag, collision::NumContrib); } // namespace o2::aod /// Writes the full information in an output TTree @@ -396,7 +396,8 @@ struct HfTreeCreatorOmegac0ToOmegaPi { flagMc, originMc, collisionMatched, - candidate.hfflag()); + candidate.hfflag(), + candidate.template collision_as().numContrib()); } } @@ -439,7 +440,8 @@ struct HfTreeCreatorOmegac0ToOmegaPi { flagMc, originMc, collisionMatched, - candidate.hfflag()); + candidate.hfflag(), + candidate.template collision_as().numContrib()); } } // fillKfCandidateLite end From e25d843d979ca67408c3d367465f98eb4387ca74 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 22 Aug 2025 17:54:10 +0200 Subject: [PATCH 152/986] [PWGEM/Dilepton] update trigger analysis (#12691) Co-authored-by: ALICE Action Bot --- PWGEM/Dilepton/Core/Dilepton.h | 4 ++-- PWGEM/Dilepton/Core/DileptonHadronMPC.h | 4 ++-- PWGEM/Dilepton/Core/SingleTrackQC.h | 4 ++-- PWGEM/Dilepton/DataModel/dileptonTables.h | 16 ++-------------- PWGEM/Dilepton/TableProducer/skimmerOTS.cxx | 2 ++ 5 files changed, 10 insertions(+), 20 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index fc06f13f92b..22031fb2d08 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -1554,8 +1554,8 @@ struct Dilepton { } PROCESS_SWITCH(Dilepton, processAnalysis, "run dilepton analysis", true); - using FilteredMyCollisionsWithSWT = soa::Filtered; - void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, Types const&... args) + // using FilteredMyCollisionsWithSWT = soa::Filtered; + void processTriggerAnalysis(MyCollisionsWithSWT const& collisions, Types const&... args) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { auto electrons = std::get<0>(std::tie(args...)); diff --git a/PWGEM/Dilepton/Core/DileptonHadronMPC.h b/PWGEM/Dilepton/Core/DileptonHadronMPC.h index 1e0e59dfd2c..ea6c7f43a82 100644 --- a/PWGEM/Dilepton/Core/DileptonHadronMPC.h +++ b/PWGEM/Dilepton/Core/DileptonHadronMPC.h @@ -1431,8 +1431,8 @@ struct DileptonHadronMPC { } PROCESS_SWITCH(DileptonHadronMPC, processAnalysis, "run dilepton analysis", true); - using FilteredMyCollisionsWithSWT = soa::Filtered; - void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, FilteredRefTracks const& refTracks, Types const&... args) + // using FilteredMyCollisionsWithSWT = soa::Filtered; + void processTriggerAnalysis(MyCollisionsWithSWT const& collisions, FilteredRefTracks const& refTracks, Types const&... args) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { auto electrons = std::get<0>(std::tie(args...)); diff --git a/PWGEM/Dilepton/Core/SingleTrackQC.h b/PWGEM/Dilepton/Core/SingleTrackQC.h index e073b6e2907..3ecc36ab7b9 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQC.h @@ -802,8 +802,8 @@ struct SingleTrackQC { } PROCESS_SWITCH(SingleTrackQC, processQC, "run single track QC", true); - using FilteredMyCollisionsWithSWT = soa::Filtered; - void processQC_TriggeredData(FilteredMyCollisionsWithSWT const& collisions, Types const&... args) + // using FilteredMyCollisionsWithSWT = soa::Filtered; + void processQC_TriggeredData(MyCollisionsWithSWT const& collisions, Types const&... args) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { auto electrons = std::get<0>(std::tie(args...)); diff --git a/PWGEM/Dilepton/DataModel/dileptonTables.h b/PWGEM/Dilepton/DataModel/dileptonTables.h index f507a5220ba..ae57b4cf69d 100644 --- a/PWGEM/Dilepton/DataModel/dileptonTables.h +++ b/PWGEM/Dilepton/DataModel/dileptonTables.h @@ -33,7 +33,7 @@ namespace pwgem::dilepton::swt { enum class swtAliases : int { // software trigger aliases for EM kHighTrackMult = 0, - kHighFt0Mult, + kHighFt0cFv0Mult, kSingleE, kLMeeIMR, kLMeeHMR, @@ -41,13 +41,12 @@ enum class swtAliases : int { // software trigger aliases for EM kSingleMuLow, kSingleMuHigh, kDiMuon, - kHighFt0cFv0Mult, kNaliases }; const std::unordered_map aliasLabels = { {"fHighTrackMult", static_cast(o2::aod::pwgem::dilepton::swt::swtAliases::kHighTrackMult)}, - {"fHighFt0Mult", static_cast(o2::aod::pwgem::dilepton::swt::swtAliases::kHighFt0Mult)}, + {"fHighFt0cFv0Mult", static_cast(o2::aod::pwgem::dilepton::swt::swtAliases::kHighFt0cFv0Mult)}, {"fSingleE", static_cast(o2::aod::pwgem::dilepton::swt::swtAliases::kSingleE)}, {"fLMeeIMR", static_cast(o2::aod::pwgem::dilepton::swt::swtAliases::kLMeeIMR)}, {"fLMeeHMR", static_cast(o2::aod::pwgem::dilepton::swt::swtAliases::kLMeeHMR)}, @@ -55,20 +54,9 @@ const std::unordered_map aliasLabels = { {"fSingleMuLow", static_cast(o2::aod::pwgem::dilepton::swt::swtAliases::kSingleMuLow)}, {"fSingleMuHigh", static_cast(o2::aod::pwgem::dilepton::swt::swtAliases::kSingleMuHigh)}, {"fDiMuon", static_cast(o2::aod::pwgem::dilepton::swt::swtAliases::kDiMuon)}, - {"fHighFt0cFv0Mult", static_cast(o2::aod::pwgem::dilepton::swt::swtAliases::kHighFt0cFv0Mult)}, }; } // namespace pwgem::dilepton::swt -// namespace embc -// { -// DECLARE_SOA_COLUMN(IsTriggerTVX, isTriggerTVX, bool); //! kIsTriggerTVX -// DECLARE_SOA_COLUMN(IsNoTimeFrameBorder, isNoTimeFrameBorder, bool); //! kIsNoTimeFrameBorder -// DECLARE_SOA_COLUMN(IsNoITSROFrameBorder, isNoITSROFrameBorder, bool); //! kNoITSROFrameBorder -// DECLARE_SOA_COLUMN(IsCollisionFound, isCollisionFound, bool); //! at least 1 collision is found in this BC. -// } // namespace embc -// DECLARE_SOA_TABLE(EMBCs, "AOD", "EMBC", //! bc information for normalization -// o2::soa::Index<>, embc::IsTriggerTVX, embc::IsNoTimeFrameBorder, embc::IsNoITSROFrameBorder, embc::IsCollisionFound); - DECLARE_SOA_TABLE(EMBCs, "AOD", "EMBC", //! bc information for normalization o2::soa::Index<>, evsel::Alias, evsel::Selection, evsel::Rct); using EMBC = EMBCs::iterator; diff --git a/PWGEM/Dilepton/TableProducer/skimmerOTS.cxx b/PWGEM/Dilepton/TableProducer/skimmerOTS.cxx index 997f8c4e6a5..ece9aef306d 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerOTS.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerOTS.cxx @@ -108,6 +108,8 @@ struct skimmerOTS { uint16_t trigger_bitmap = 0; registry.fill(HIST("hEventCounter"), 1); // all + zorro.populateHistRegistry(registry, bc.runNumber()); + if (zorro.isSelected(bc.globalBC())) { // triggered event auto swt_bitset = zorro.getLastResult(); // this has to be called after zorro::isSelected, or simply call zorro.fetch // LOGF(info, "swt_bitset.to_string().c_str() = %s", swt_bitset.to_string().c_str()); From 40414d7879cb0eb53edd25e2f593ec797ac9d93b Mon Sep 17 00:00:00 2001 From: ilofnes <35331175+ilofnes@users.noreply.github.com> Date: Fri, 22 Aug 2025 18:19:47 +0200 Subject: [PATCH 153/986] [PWGDQ] added variables to DielectronAll table (#12687) --- PWGDQ/DataModel/ReducedInfoTables.h | 7 +++++-- PWGDQ/Tasks/dqEfficiency.cxx | 4 +++- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 4 +++- PWGDQ/Tasks/tableReader.cxx | 2 +- PWGDQ/Tasks/tableReader_withAssoc.cxx | 3 ++- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/PWGDQ/DataModel/ReducedInfoTables.h b/PWGDQ/DataModel/ReducedInfoTables.h index ae5fd853bf9..244a1f7417c 100644 --- a/PWGDQ/DataModel/ReducedInfoTables.h +++ b/PWGDQ/DataModel/ReducedInfoTables.h @@ -752,7 +752,7 @@ DECLARE_SOA_COLUMN(CosThetaRM, costhetaRM, float); //! Cosine in the DECLARE_SOA_COLUMN(CosThetaStarTPC, costhetaStarTPC, float); //! global polarization, event plane reconstructed from TPC tracks DECLARE_SOA_COLUMN(CosThetaStarFT0A, costhetaStarFT0A, float); //! global polarization, event plane reconstructed from FT0A tracks DECLARE_SOA_COLUMN(CosThetaStarFT0C, costhetaStarFT0C, float); //! global polarization, event plane reconstructed from FT0C tracks -DECLARE_SOA_DYNAMIC_COLUMN(Px, px, //! +DECLARE_SOA_DYNAMIC_COLUMN(Px, px, //! [](float pt, float phi) -> float { return pt * std::cos(phi); }); DECLARE_SOA_DYNAMIC_COLUMN(Py, py, //! [](float pt, float phi) -> float { return pt * std::sin(phi); }); @@ -832,7 +832,10 @@ DECLARE_SOA_TABLE(DielectronsAll, "AOD", "RTDIELECTRONALL", //! dilepton_track_index::DeviationTrk0KF, dilepton_track_index::DeviationTrk1KF, dilepton_track_index::DeviationxyTrk0KF, dilepton_track_index::DeviationxyTrk1KF, reducedpair::MassKFGeo, reducedpair::Chi2OverNDFKFGeo, reducedpair::DecayLengthKFGeo, reducedpair::DecayLengthOverErrKFGeo, reducedpair::DecayLengthXYKFGeo, reducedpair::DecayLengthXYOverErrKFGeo, reducedpair::PseudoproperDecayTimeKFGeo, reducedpair::PseudoproperDecayTimeErrKFGeo, reducedpair::CosPAKFGeo, reducedpair::PairDCAxyz, reducedpair::PairDCAxy, reducedpair::DeviationPairKF, reducedpair::DeviationxyPairKF, - reducedpair::MassKFGeoTop, reducedpair::Chi2OverNDFKFGeoTop); + reducedpair::MassKFGeoTop, reducedpair::Chi2OverNDFKFGeoTop, + reducedpair::Tauz, reducedpair::Tauxy, + reducedpair::Lz, + reducedpair::Lxy); DECLARE_SOA_TABLE(DimuonsAll, "AOD", "RTDIMUONALL", //! collision::PosX, collision::PosY, collision::PosZ, collision::NumContrib, diff --git a/PWGDQ/Tasks/dqEfficiency.cxx b/PWGDQ/Tasks/dqEfficiency.cxx index bcbaa4fe1bf..3f97216f52d 100644 --- a/PWGDQ/Tasks/dqEfficiency.cxx +++ b/PWGDQ/Tasks/dqEfficiency.cxx @@ -830,7 +830,9 @@ struct AnalysisSameEventPairing { VarManager::fgValues[VarManager::kKFTrack0DeviationFromPV], VarManager::fgValues[VarManager::kKFTrack1DeviationFromPV], VarManager::fgValues[VarManager::kKFTrack0DeviationxyFromPV], VarManager::fgValues[VarManager::kKFTrack1DeviationxyFromPV], VarManager::fgValues[VarManager::kKFMass], VarManager::fgValues[VarManager::kKFChi2OverNDFGeo], VarManager::fgValues[VarManager::kVertexingLxyz], VarManager::fgValues[VarManager::kVertexingLxyzOverErr], VarManager::fgValues[VarManager::kVertexingLxy], VarManager::fgValues[VarManager::kVertexingLxyOverErr], VarManager::fgValues[VarManager::kVertexingTauxy], VarManager::fgValues[VarManager::kVertexingTauxyErr], VarManager::fgValues[VarManager::kKFCosPA], VarManager::fgValues[VarManager::kKFJpsiDCAxyz], VarManager::fgValues[VarManager::kKFJpsiDCAxy], VarManager::fgValues[VarManager::kKFPairDeviationFromPV], VarManager::fgValues[VarManager::kKFPairDeviationxyFromPV], - VarManager::fgValues[VarManager::kKFMassGeoTop], VarManager::fgValues[VarManager::kKFChi2OverNDFGeoTop]); + VarManager::fgValues[VarManager::kKFMassGeoTop], VarManager::fgValues[VarManager::kKFChi2OverNDFGeoTop], + VarManager::fgValues[VarManager::kVertexingTauzProjected], VarManager::fgValues[VarManager::kVertexingTauxyProjected], + VarManager::fgValues[VarManager::kVertexingLzProjected], VarManager::fgValues[VarManager::kVertexingLxyProjected]); } } } diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index 890009b7c47..f0b7965ccc4 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -1813,7 +1813,9 @@ struct AnalysisSameEventPairing { VarManager::fgValues[VarManager::kKFTrack0DeviationFromPV], VarManager::fgValues[VarManager::kKFTrack1DeviationFromPV], VarManager::fgValues[VarManager::kKFTrack0DeviationxyFromPV], VarManager::fgValues[VarManager::kKFTrack1DeviationxyFromPV], VarManager::fgValues[VarManager::kKFMass], VarManager::fgValues[VarManager::kKFChi2OverNDFGeo], VarManager::fgValues[VarManager::kVertexingLxyz], VarManager::fgValues[VarManager::kVertexingLxyzOverErr], VarManager::fgValues[VarManager::kVertexingLxy], VarManager::fgValues[VarManager::kVertexingLxyOverErr], VarManager::fgValues[VarManager::kVertexingTauxy], VarManager::fgValues[VarManager::kVertexingTauxyErr], VarManager::fgValues[VarManager::kKFCosPA], VarManager::fgValues[VarManager::kKFJpsiDCAxyz], VarManager::fgValues[VarManager::kKFJpsiDCAxy], VarManager::fgValues[VarManager::kKFPairDeviationFromPV], VarManager::fgValues[VarManager::kKFPairDeviationxyFromPV], - VarManager::fgValues[VarManager::kKFMassGeoTop], VarManager::fgValues[VarManager::kKFChi2OverNDFGeoTop]); + VarManager::fgValues[VarManager::kKFMassGeoTop], VarManager::fgValues[VarManager::kKFChi2OverNDFGeoTop], + VarManager::fgValues[VarManager::kVertexingTauzProjected], VarManager::fgValues[VarManager::kVertexingTauxyProjected], + VarManager::fgValues[VarManager::kVertexingLzProjected], VarManager::fgValues[VarManager::kVertexingLxyProjected]); } } } diff --git a/PWGDQ/Tasks/tableReader.cxx b/PWGDQ/Tasks/tableReader.cxx index 102eb26100f..2b35db2611c 100644 --- a/PWGDQ/Tasks/tableReader.cxx +++ b/PWGDQ/Tasks/tableReader.cxx @@ -1501,7 +1501,7 @@ struct AnalysisSameEventPairing { VarManager::fgValues[VarManager::kKFTrack0DeviationFromPV], VarManager::fgValues[VarManager::kKFTrack1DeviationFromPV], VarManager::fgValues[VarManager::kKFTrack0DeviationxyFromPV], VarManager::fgValues[VarManager::kKFTrack1DeviationxyFromPV], VarManager::fgValues[VarManager::kKFMass], VarManager::fgValues[VarManager::kKFChi2OverNDFGeo], VarManager::fgValues[VarManager::kVertexingLxyz], VarManager::fgValues[VarManager::kVertexingLxyzOverErr], VarManager::fgValues[VarManager::kVertexingLxy], VarManager::fgValues[VarManager::kVertexingLxyOverErr], VarManager::fgValues[VarManager::kVertexingTauxy], VarManager::fgValues[VarManager::kVertexingTauxyErr], VarManager::fgValues[VarManager::kKFCosPA], VarManager::fgValues[VarManager::kKFJpsiDCAxyz], VarManager::fgValues[VarManager::kKFJpsiDCAxy], VarManager::fgValues[VarManager::kKFPairDeviationFromPV], VarManager::fgValues[VarManager::kKFPairDeviationxyFromPV], - VarManager::fgValues[VarManager::kKFMassGeoTop], VarManager::fgValues[VarManager::kKFChi2OverNDFGeoTop]); + VarManager::fgValues[VarManager::kKFMassGeoTop], VarManager::fgValues[VarManager::kKFChi2OverNDFGeoTop], VarManager::fgValues[VarManager::kVertexingTauzProjected], VarManager::fgValues[VarManager::kVertexingTauxyProjected], VarManager::fgValues[VarManager::kVertexingLzProjected], VarManager::fgValues[VarManager::kVertexingLxyProjected]); } } if constexpr (TPairType == pairTypeMuMu) { diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index 3d3cd926b31..723a68e38bf 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -1826,7 +1826,8 @@ struct AnalysisSameEventPairing { VarManager::fgValues[VarManager::kKFTrack0DeviationFromPV], VarManager::fgValues[VarManager::kKFTrack1DeviationFromPV], VarManager::fgValues[VarManager::kKFTrack0DeviationxyFromPV], VarManager::fgValues[VarManager::kKFTrack1DeviationxyFromPV], VarManager::fgValues[VarManager::kKFMass], VarManager::fgValues[VarManager::kKFChi2OverNDFGeo], VarManager::fgValues[VarManager::kVertexingLxyz], VarManager::fgValues[VarManager::kVertexingLxyzOverErr], VarManager::fgValues[VarManager::kVertexingLxy], VarManager::fgValues[VarManager::kVertexingLxyOverErr], VarManager::fgValues[VarManager::kVertexingTauxy], VarManager::fgValues[VarManager::kVertexingTauxyErr], VarManager::fgValues[VarManager::kKFCosPA], VarManager::fgValues[VarManager::kKFJpsiDCAxyz], VarManager::fgValues[VarManager::kKFJpsiDCAxy], VarManager::fgValues[VarManager::kKFPairDeviationFromPV], VarManager::fgValues[VarManager::kKFPairDeviationxyFromPV], - VarManager::fgValues[VarManager::kKFMassGeoTop], VarManager::fgValues[VarManager::kKFChi2OverNDFGeoTop]); + VarManager::fgValues[VarManager::kKFMassGeoTop], + VarManager::fgValues[VarManager::kKFChi2OverNDFGeoTop], VarManager::fgValues[VarManager::kVertexingTauzProjected], VarManager::fgValues[VarManager::kVertexingTauxyProjected], VarManager::fgValues[VarManager::kVertexingLzProjected], VarManager::fgValues[VarManager::kVertexingLxyProjected]); } } } From e9a9887bc019d0c6a042ba4c1e26e3306da05e86 Mon Sep 17 00:00:00 2001 From: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Date: Fri, 22 Aug 2025 19:54:21 +0200 Subject: [PATCH 154/986] [PWGCF] add kIsGoodZvtxFT0vsPV flag in MC (#12689) --- PWGCF/Flow/Tasks/flowMc.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PWGCF/Flow/Tasks/flowMc.cxx b/PWGCF/Flow/Tasks/flowMc.cxx index 5884fa0e127..d804840870d 100644 --- a/PWGCF/Flow/Tasks/flowMc.cxx +++ b/PWGCF/Flow/Tasks/flowMc.cxx @@ -87,6 +87,7 @@ struct FlowMc { O2_DEFINE_CONFIGURABLE(cfgRecoEvSel8, bool, false, "require sel8 for reconstruction events") O2_DEFINE_CONFIGURABLE(cfgRecoEvkIsGoodITSLayersAll, bool, false, "require kIsGoodITSLayersAll for reconstruction events") O2_DEFINE_CONFIGURABLE(cfgRecoEvkNoSameBunchPileup, bool, false, "require kNoSameBunchPileup for reconstruction events") + O2_DEFINE_CONFIGURABLE(cfgEvSelkIsGoodZvtxFT0vsPV, bool, false, "removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference, use this cut at low multiplicities with caution") Configurable> cfgTrackDensityP0{"cfgTrackDensityP0", std::vector{0.6003720411, 0.6152630970, 0.6288860646, 0.6360694031, 0.6409494798, 0.6450540203, 0.6482117301, 0.6512592056, 0.6640008690, 0.6862631416, 0.7005738691, 0.7106567432, 0.7170728333}, "parameter 0 for track density efficiency correction"}; Configurable> cfgTrackDensityP1{"cfgTrackDensityP1", std::vector{-1.007592e-05, -8.932635e-06, -9.114538e-06, -1.054818e-05, -1.220212e-05, -1.312304e-05, -1.376433e-05, -1.412813e-05, -1.289562e-05, -1.050065e-05, -8.635725e-06, -7.380821e-06, -6.201250e-06}, "parameter 1 for track density efficiency correction"}; float maxEta = 0.8; @@ -405,6 +406,11 @@ struct FlowMc { // cut time intervals with dead ITS staves return 0; } + if (cfgEvSelkIsGoodZvtxFT0vsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + // removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference + // use this cut at low multiplicities with caution + return 0; + } return 1; } From 801df54de411337a78c9572a68cbafa081ac081d Mon Sep 17 00:00:00 2001 From: Gianni Shigeru Setoue Liveraro <81832939+gianniliveraro@users.noreply.github.com> Date: Fri, 22 Aug 2025 15:07:37 -0300 Subject: [PATCH 155/986] [PWGLF] Improvements in sigma0 tasks (#12684) Co-authored-by: ALICE Action Bot --- PWGLF/DataModel/LFSigmaTables.h | 926 ++++++++-- .../Strangeness/sigma0builder.cxx | 1577 +++++++---------- .../Strangeness/strangenessbuilder.cxx | 5 +- PWGLF/Tasks/Strangeness/sigmaanalysis.cxx | 1514 +++++++++++----- 4 files changed, 2488 insertions(+), 1534 deletions(-) diff --git a/PWGLF/DataModel/LFSigmaTables.h b/PWGLF/DataModel/LFSigmaTables.h index bd808cef106..fdeab068f44 100644 --- a/PWGLF/DataModel/LFSigmaTables.h +++ b/PWGLF/DataModel/LFSigmaTables.h @@ -9,19 +9,28 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include -#include -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" + #include "Common/Core/RecoDecay.h" -#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/Centrality.h" +#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/Qvectors.h" + #include "CommonConstants/PhysicsConstants.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" + +#include "Math/Vector3D.h" +#include "TVector3.h" + +#include +#include #ifndef PWGLF_DATAMODEL_LFSIGMATABLES_H_ #define PWGLF_DATAMODEL_LFSIGMATABLES_H_ +using std::array; + // Creating output TTree for sigma analysis namespace o2::aod { @@ -29,53 +38,173 @@ namespace o2::aod // for real data namespace sigma0Core { -DECLARE_SOA_COLUMN(SigmapT, sigmapT, float); -DECLARE_SOA_COLUMN(SigmaMass, sigmaMass, float); -DECLARE_SOA_COLUMN(SigmaRapidity, sigmaRapidity, float); -DECLARE_SOA_COLUMN(SigmaOPAngle, sigmaOPAngle, float); -DECLARE_SOA_COLUMN(SigmaCentrality, sigmaCentrality, float); -DECLARE_SOA_COLUMN(SigmaRunNumber, sigmaRunNumber, int); -DECLARE_SOA_COLUMN(SigmaTimestamp, sigmaTimestamp, uint64_t); +DECLARE_SOA_COLUMN(X, x, float); +DECLARE_SOA_COLUMN(Y, y, float); +DECLARE_SOA_COLUMN(Z, z, float); +DECLARE_SOA_COLUMN(DCADaughters, dcadaughters, float); + +DECLARE_SOA_COLUMN(PhotonPx, photonPx, float); +DECLARE_SOA_COLUMN(PhotonPy, photonPy, float); +DECLARE_SOA_COLUMN(PhotonPz, photonPz, float); +DECLARE_SOA_COLUMN(PhotonMass, photonMass, float); + +DECLARE_SOA_COLUMN(LambdaPx, lambdaPx, float); +DECLARE_SOA_COLUMN(LambdaPy, lambdaPy, float); +DECLARE_SOA_COLUMN(LambdaPz, lambdaPz, float); +DECLARE_SOA_COLUMN(LambdaMass, lambdaMass, float); +DECLARE_SOA_COLUMN(AntiLambdaMass, antilambdaMass, float); + +//______________________________________________________ +// DYNAMIC COLUMNS +// Sigma0 +DECLARE_SOA_DYNAMIC_COLUMN(Px, px, //! Sigma0 px + [](float photonPx, float lambdaPx) -> float { return photonPx + lambdaPx; }); +DECLARE_SOA_DYNAMIC_COLUMN(Py, py, //! Sigma0 py + [](float photonPy, float lambdaPy) -> float { return photonPy + lambdaPy; }); +DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, //! Sigma0 pz + [](float photonPz, float lambdaPz) -> float { return photonPz + lambdaPz; }); + +DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, + [](float photonPx, float photonPy, float lambdaPx, float lambdaPy) -> float { + return RecoDecay::pt(array{photonPx + lambdaPx, photonPy + lambdaPy}); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(P, p, //! Total momentum in GeV/c + [](float photonPx, float photonPy, float photonPz, float lambdaPx, float lambdaPy, float lambdaPz) -> float { + return RecoDecay::sqrtSumOfSquares(photonPx + lambdaPx, photonPy + lambdaPy, photonPz + lambdaPz); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Sigma0Mass, sigma0Mass, + [](float photonPx, float photonPy, float photonPz, float lambdaPx, float lambdaPy, float lambdaPz) -> float { + std::array pVecPhotons{photonPx, photonPy, photonPz}; + std::array pVecLambda{lambdaPx, lambdaPy, lambdaPz}; + auto arrMom = std::array{pVecPhotons, pVecLambda}; + return RecoDecay::m(arrMom, std::array{o2::constants::physics::MassPhoton, o2::constants::physics::MassLambda0}); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Sigma0Y, sigma0Y, + [](float photonPx, float photonPy, float photonPz, float lambdaPx, float lambdaPy, float lambdaPz) -> float { + return RecoDecay::y(std::array{photonPx + lambdaPx, photonPy + lambdaPy, photonPz + lambdaPz}, o2::constants::physics::MassSigma0); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Phi, phi, //! Phi in the range [0, 2pi) + [](float photonPx, float photonPy, float lambdaPx, float lambdaPy) -> float { return RecoDecay::phi(photonPx + lambdaPx, photonPy + lambdaPy); }); + +DECLARE_SOA_DYNAMIC_COLUMN(Eta, eta, //! Pseudorapidity + [](float photonPx, float photonPy, float photonPz, float lambdaPx, float lambdaPy, float lambdaPz) -> float { + return RecoDecay::eta(std::array{photonPx + lambdaPx, photonPy + lambdaPy, photonPz + lambdaPz}); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Radius, radius, //! Sigma0 decay radius (2D, centered at zero) + [](float x, float y) -> float { return RecoDecay::sqrtSumOfSquares(x, y); }); + +DECLARE_SOA_DYNAMIC_COLUMN(OPAngle, opAngle, + [](float photonPx, float photonPy, float photonPz, float lambdaPx, float lambdaPy, float lambdaPz) { + TVector3 v1(photonPx, photonPy, photonPz); + TVector3 v2(lambdaPx, lambdaPy, lambdaPz); + return v1.Angle(v2); + }); + +// Photon +DECLARE_SOA_DYNAMIC_COLUMN(PhotonPt, photonPt, //! Transverse momentum in GeV/c + [](float photonPx, float photonPy) -> float { + return RecoDecay::sqrtSumOfSquares(photonPx, photonPy); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(PhotonP, photonp, //! Total momentum in GeV/c + [](float photonPx, float photonPy, float photonPz) -> float { + return RecoDecay::sqrtSumOfSquares(photonPx, photonPy, photonPz); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(PhotonEta, photonEta, //! Pseudorapidity, conditionally defined to avoid FPEs + [](float photonPx, float photonPy, float photonPz) -> float { + return RecoDecay::eta(std::array{photonPx, photonPy, photonPz}); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(PhotonY, photonY, //! Rapidity + [](float photonPx, float photonPy, float photonPz) -> float { + return RecoDecay::y(std::array{photonPx, photonPy, photonPz}, o2::constants::physics::MassGamma); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(PhotonPhi, photonPhi, //! Phi in the range [0, 2pi) + [](float photonPx, float photonPy) -> float { return RecoDecay::phi(photonPx, photonPy); }); + +// Lambda/ALambda +DECLARE_SOA_DYNAMIC_COLUMN(LambdaPt, lambdaPt, //! Transverse momentum in GeV/c + [](float lambdaPx, float lambdaPy) -> float { + return RecoDecay::sqrtSumOfSquares(lambdaPx, lambdaPy); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(LambdaP, lambdap, //! Total momentum in GeV/c + [](float lambdaPx, float lambdaPy, float lambdaPz) -> float { + return RecoDecay::sqrtSumOfSquares(lambdaPx, lambdaPy, lambdaPz); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(LambdaEta, lambdaEta, //! Pseudorapidity, conditionally defined to avoid FPEs + [](float lambdaPx, float lambdaPy, float lambdaPz) -> float { + return RecoDecay::eta(std::array{lambdaPx, lambdaPy, lambdaPz}); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(LambdaY, lambdaY, //! Rapidity + [](float lambdaPx, float lambdaPy, float lambdaPz) -> float { + return RecoDecay::y(std::array{lambdaPx, lambdaPy, lambdaPz}, o2::constants::physics::MassLambda); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(LambdaPhi, lambdaPhi, //! Phi in the range [0, 2pi) + [](float lambdaPx, float lambdaPy) -> float { return RecoDecay::phi(lambdaPx, lambdaPy); }); } // namespace sigma0Core DECLARE_SOA_TABLE(Sigma0Cores, "AOD", "SIGMA0CORES", - sigma0Core::SigmapT, - sigma0Core::SigmaMass, - sigma0Core::SigmaRapidity, - sigma0Core::SigmaOPAngle, - sigma0Core::SigmaCentrality, - sigma0Core::SigmaRunNumber, - sigma0Core::SigmaTimestamp); + // Basic properties + sigma0Core::X, sigma0Core::Y, sigma0Core::Z, sigma0Core::DCADaughters, + sigma0Core::PhotonPx, sigma0Core::PhotonPy, sigma0Core::PhotonPz, sigma0Core::PhotonMass, + sigma0Core::LambdaPx, sigma0Core::LambdaPy, sigma0Core::LambdaPz, sigma0Core::LambdaMass, sigma0Core::AntiLambdaMass, + + // Dynamic columns + sigma0Core::Px, + sigma0Core::Py, + sigma0Core::Pz, + sigma0Core::Pt, + sigma0Core::P, + sigma0Core::Sigma0Mass, + sigma0Core::Sigma0Y, + sigma0Core::Phi, + sigma0Core::Eta, + sigma0Core::Radius, + sigma0Core::OPAngle, + + sigma0Core::PhotonPt, + sigma0Core::PhotonP, + sigma0Core::PhotonEta, + sigma0Core::PhotonY, + sigma0Core::PhotonPhi, + + sigma0Core::LambdaPt, + sigma0Core::LambdaP, + sigma0Core::LambdaEta, + sigma0Core::LambdaY, + sigma0Core::LambdaPhi); // For Photon extra info -namespace sigmaPhotonExtra +namespace sigma0PhotonExtra { -DECLARE_SOA_COLUMN(PhotonPt, photonPt, float); -DECLARE_SOA_COLUMN(PhotonMass, photonMass, float); +//______________________________________________________ +// REGULAR COLUMNS FOR SIGMA0PHOTON DECLARE_SOA_COLUMN(PhotonQt, photonQt, float); DECLARE_SOA_COLUMN(PhotonAlpha, photonAlpha, float); -DECLARE_SOA_COLUMN(PhotonRadius, photonRadius, float); DECLARE_SOA_COLUMN(PhotonCosPA, photonCosPA, float); DECLARE_SOA_COLUMN(PhotonDCADau, photonDCADau, float); DECLARE_SOA_COLUMN(PhotonDCANegPV, photonDCANegPV, float); DECLARE_SOA_COLUMN(PhotonDCAPosPV, photonDCAPosPV, float); +DECLARE_SOA_COLUMN(PhotonRadius, photonRadius, float); DECLARE_SOA_COLUMN(PhotonZconv, photonZconv, float); -DECLARE_SOA_COLUMN(PhotonEta, photonEta, float); -DECLARE_SOA_COLUMN(PhotonY, photonY, float); -DECLARE_SOA_COLUMN(PhotonPhi, photonPhi, float); DECLARE_SOA_COLUMN(PhotonPosTPCNSigmaEl, photonPosTPCNSigmaEl, float); DECLARE_SOA_COLUMN(PhotonNegTPCNSigmaEl, photonNegTPCNSigmaEl, float); -DECLARE_SOA_COLUMN(PhotonPosTPCNSigmaPi, photonPosTPCNSigmaPi, float); -DECLARE_SOA_COLUMN(PhotonNegTPCNSigmaPi, photonNegTPCNSigmaPi, float); DECLARE_SOA_COLUMN(PhotonPosTPCCrossedRows, photonPosTPCCrossedRows, uint8_t); DECLARE_SOA_COLUMN(PhotonNegTPCCrossedRows, photonNegTPCCrossedRows, uint8_t); -DECLARE_SOA_COLUMN(PhotonPosPt, photonPosPt, float); -DECLARE_SOA_COLUMN(PhotonNegPt, photonNegPt, float); DECLARE_SOA_COLUMN(PhotonPosEta, photonPosEta, float); DECLARE_SOA_COLUMN(PhotonNegEta, photonNegEta, float); -DECLARE_SOA_COLUMN(PhotonPosY, photonPosY, float); -DECLARE_SOA_COLUMN(PhotonNegY, photonNegY, float); DECLARE_SOA_COLUMN(PhotonPsiPair, photonPsiPair, float); DECLARE_SOA_COLUMN(PhotonPosITSCls, photonPosITSCls, int); DECLARE_SOA_COLUMN(PhotonNegITSCls, photonNegITSCls, int); @@ -84,52 +213,36 @@ DECLARE_SOA_COLUMN(PhotonNegITSChi2PerNcl, photonNegITSChi2PerNcl, float); DECLARE_SOA_COLUMN(PhotonPosTrackCode, photonPosTrackCode, uint8_t); DECLARE_SOA_COLUMN(PhotonNegTrackCode, photonNegTrackCode, uint8_t); DECLARE_SOA_COLUMN(PhotonV0Type, photonV0Type, uint8_t); -DECLARE_SOA_COLUMN(GammaBDTScore, gammaBDTScore, float); - -} // namespace sigmaPhotonExtra - -DECLARE_SOA_TABLE(SigmaPhotonExtras, "AOD", "SIGMA0PHOTON", - sigmaPhotonExtra::PhotonPt, - sigmaPhotonExtra::PhotonMass, - sigmaPhotonExtra::PhotonQt, - sigmaPhotonExtra::PhotonAlpha, - sigmaPhotonExtra::PhotonRadius, - sigmaPhotonExtra::PhotonCosPA, - sigmaPhotonExtra::PhotonDCADau, - sigmaPhotonExtra::PhotonDCANegPV, - sigmaPhotonExtra::PhotonDCAPosPV, - sigmaPhotonExtra::PhotonZconv, - sigmaPhotonExtra::PhotonEta, - sigmaPhotonExtra::PhotonY, - sigmaPhotonExtra::PhotonPhi, - sigmaPhotonExtra::PhotonPosTPCNSigmaEl, - sigmaPhotonExtra::PhotonNegTPCNSigmaEl, - sigmaPhotonExtra::PhotonPosTPCNSigmaPi, - sigmaPhotonExtra::PhotonNegTPCNSigmaPi, - sigmaPhotonExtra::PhotonPosTPCCrossedRows, - sigmaPhotonExtra::PhotonNegTPCCrossedRows, - sigmaPhotonExtra::PhotonPosPt, - sigmaPhotonExtra::PhotonNegPt, - sigmaPhotonExtra::PhotonPosEta, - sigmaPhotonExtra::PhotonNegEta, - sigmaPhotonExtra::PhotonPosY, - sigmaPhotonExtra::PhotonNegY, - sigmaPhotonExtra::PhotonPsiPair, - sigmaPhotonExtra::PhotonPosITSCls, - sigmaPhotonExtra::PhotonNegITSCls, - sigmaPhotonExtra::PhotonPosITSChi2PerNcl, - sigmaPhotonExtra::PhotonNegITSChi2PerNcl, - sigmaPhotonExtra::PhotonPosTrackCode, - sigmaPhotonExtra::PhotonNegTrackCode, - sigmaPhotonExtra::PhotonV0Type, - sigmaPhotonExtra::GammaBDTScore); + +} // namespace sigma0PhotonExtra + +DECLARE_SOA_TABLE(Sigma0PhotonExtras, "AOD", "SIGMA0PHOTON", + sigma0PhotonExtra::PhotonQt, + sigma0PhotonExtra::PhotonAlpha, + sigma0PhotonExtra::PhotonCosPA, + sigma0PhotonExtra::PhotonDCADau, + sigma0PhotonExtra::PhotonDCANegPV, + sigma0PhotonExtra::PhotonDCAPosPV, + sigma0PhotonExtra::PhotonRadius, + sigma0PhotonExtra::PhotonZconv, + sigma0PhotonExtra::PhotonPosTPCNSigmaEl, + sigma0PhotonExtra::PhotonNegTPCNSigmaEl, + sigma0PhotonExtra::PhotonPosTPCCrossedRows, + sigma0PhotonExtra::PhotonNegTPCCrossedRows, + sigma0PhotonExtra::PhotonPosEta, + sigma0PhotonExtra::PhotonNegEta, + sigma0PhotonExtra::PhotonPsiPair, + sigma0PhotonExtra::PhotonPosITSCls, + sigma0PhotonExtra::PhotonNegITSCls, + sigma0PhotonExtra::PhotonPosITSChi2PerNcl, + sigma0PhotonExtra::PhotonNegITSChi2PerNcl, + sigma0PhotonExtra::PhotonPosTrackCode, + sigma0PhotonExtra::PhotonNegTrackCode, + sigma0PhotonExtra::PhotonV0Type); // For Lambda extra info -namespace sigmaLambdaExtra +namespace sigma0LambdaExtra { -DECLARE_SOA_COLUMN(LambdaPt, lambdaPt, float); -DECLARE_SOA_COLUMN(LambdaMass, lambdaMass, float); -DECLARE_SOA_COLUMN(AntiLambdaMass, antilambdaMass, float); DECLARE_SOA_COLUMN(LambdaQt, lambdaQt, float); DECLARE_SOA_COLUMN(LambdaAlpha, lambdaAlpha, float); DECLARE_SOA_COLUMN(LambdaLifeTime, lambdaLifeTime, float); @@ -138,9 +251,6 @@ DECLARE_SOA_COLUMN(LambdaCosPA, lambdaCosPA, float); DECLARE_SOA_COLUMN(LambdaDCADau, lambdaDCADau, float); DECLARE_SOA_COLUMN(LambdaDCANegPV, lambdaDCANegPV, float); DECLARE_SOA_COLUMN(LambdaDCAPosPV, lambdaDCAPosPV, float); -DECLARE_SOA_COLUMN(LambdaEta, lambdaEta, float); -DECLARE_SOA_COLUMN(LambdaY, lambdaY, float); -DECLARE_SOA_COLUMN(LambdaPhi, lambdaPhi, float); DECLARE_SOA_COLUMN(LambdaPosPrTPCNSigma, lambdaPosPrTPCNSigma, float); DECLARE_SOA_COLUMN(LambdaPosPiTPCNSigma, lambdaPosPiTPCNSigma, float); DECLARE_SOA_COLUMN(LambdaNegPrTPCNSigma, lambdaNegPrTPCNSigma, float); @@ -151,14 +261,8 @@ DECLARE_SOA_COLUMN(ALambdaPrTOFNSigma, aLambdaPrTOFNSigma, float); DECLARE_SOA_COLUMN(ALambdaPiTOFNSigma, aLambdaPiTOFNSigma, float); DECLARE_SOA_COLUMN(LambdaPosTPCCrossedRows, lambdaPosTPCCrossedRows, uint8_t); DECLARE_SOA_COLUMN(LambdaNegTPCCrossedRows, lambdaNegTPCCrossedRows, uint8_t); -DECLARE_SOA_COLUMN(LambdaPosPt, lambdaPosPt, float); -DECLARE_SOA_COLUMN(LambdaNegPt, lambdaNegPt, float); DECLARE_SOA_COLUMN(LambdaPosEta, lambdaPosEta, float); DECLARE_SOA_COLUMN(LambdaNegEta, lambdaNegEta, float); -DECLARE_SOA_COLUMN(LambdaPosPrY, lambdaPosPrY, float); -DECLARE_SOA_COLUMN(LambdaPosPiY, lambdaPosPiY, float); -DECLARE_SOA_COLUMN(LambdaNegPrY, lambdaNegPrY, float); -DECLARE_SOA_COLUMN(LambdaNegPiY, lambdaNegPiY, float); DECLARE_SOA_COLUMN(LambdaPosITSCls, lambdaPosITSCls, int); DECLARE_SOA_COLUMN(LambdaNegITSCls, lambdaNegITSCls, int); DECLARE_SOA_COLUMN(LambdaPosITSChi2PerNcl, lambdaPosChi2PerNcl, float); @@ -166,87 +270,587 @@ DECLARE_SOA_COLUMN(LambdaNegITSChi2PerNcl, lambdaNegChi2PerNcl, float); DECLARE_SOA_COLUMN(LambdaPosTrackCode, lambdaPosTrackCode, uint8_t); DECLARE_SOA_COLUMN(LambdaNegTrackCode, lambdaNegTrackCode, uint8_t); DECLARE_SOA_COLUMN(LambdaV0Type, lambdaV0Type, uint8_t); -DECLARE_SOA_COLUMN(LambdaBDTScore, lambdaBDTScore, float); -DECLARE_SOA_COLUMN(AntiLambdaBDTScore, antilambdaBDTScore, float); - -} // namespace sigmaLambdaExtra - -DECLARE_SOA_TABLE(SigmaLambdaExtras, "AOD", "SIGMA0LAMBDA", - sigmaLambdaExtra::LambdaPt, - sigmaLambdaExtra::LambdaMass, - sigmaLambdaExtra::AntiLambdaMass, - sigmaLambdaExtra::LambdaQt, - sigmaLambdaExtra::LambdaAlpha, - sigmaLambdaExtra::LambdaLifeTime, - sigmaLambdaExtra::LambdaRadius, - sigmaLambdaExtra::LambdaCosPA, - sigmaLambdaExtra::LambdaDCADau, - sigmaLambdaExtra::LambdaDCANegPV, - sigmaLambdaExtra::LambdaDCAPosPV, - sigmaLambdaExtra::LambdaEta, - sigmaLambdaExtra::LambdaY, - sigmaLambdaExtra::LambdaPhi, - sigmaLambdaExtra::LambdaPosPrTPCNSigma, - sigmaLambdaExtra::LambdaPosPiTPCNSigma, - sigmaLambdaExtra::LambdaNegPrTPCNSigma, - sigmaLambdaExtra::LambdaNegPiTPCNSigma, - sigmaLambdaExtra::LambdaPrTOFNSigma, - sigmaLambdaExtra::LambdaPiTOFNSigma, - sigmaLambdaExtra::ALambdaPrTOFNSigma, - sigmaLambdaExtra::ALambdaPiTOFNSigma, - sigmaLambdaExtra::LambdaPosTPCCrossedRows, - sigmaLambdaExtra::LambdaNegTPCCrossedRows, - sigmaLambdaExtra::LambdaPosPt, - sigmaLambdaExtra::LambdaNegPt, - sigmaLambdaExtra::LambdaPosEta, - sigmaLambdaExtra::LambdaNegEta, - sigmaLambdaExtra::LambdaPosPrY, - sigmaLambdaExtra::LambdaPosPiY, - sigmaLambdaExtra::LambdaNegPrY, - sigmaLambdaExtra::LambdaNegPiY, - sigmaLambdaExtra::LambdaPosITSCls, - sigmaLambdaExtra::LambdaNegITSCls, - sigmaLambdaExtra::LambdaPosITSChi2PerNcl, - sigmaLambdaExtra::LambdaNegITSChi2PerNcl, - sigmaLambdaExtra::LambdaPosTrackCode, - sigmaLambdaExtra::LambdaNegTrackCode, - sigmaLambdaExtra::LambdaV0Type, - sigmaLambdaExtra::LambdaBDTScore, - sigmaLambdaExtra::AntiLambdaBDTScore); - -// for MC data -namespace sigmaMCCore + +} // namespace sigma0LambdaExtra + +DECLARE_SOA_TABLE(Sigma0LambdaExtras, "AOD", "SIGMA0LAMBDA", + sigma0LambdaExtra::LambdaQt, + sigma0LambdaExtra::LambdaAlpha, + sigma0LambdaExtra::LambdaLifeTime, + sigma0LambdaExtra::LambdaRadius, + sigma0LambdaExtra::LambdaCosPA, + sigma0LambdaExtra::LambdaDCADau, + sigma0LambdaExtra::LambdaDCANegPV, + sigma0LambdaExtra::LambdaDCAPosPV, + sigma0LambdaExtra::LambdaPosPrTPCNSigma, + sigma0LambdaExtra::LambdaPosPiTPCNSigma, + sigma0LambdaExtra::LambdaNegPrTPCNSigma, + sigma0LambdaExtra::LambdaNegPiTPCNSigma, + sigma0LambdaExtra::LambdaPrTOFNSigma, + sigma0LambdaExtra::LambdaPiTOFNSigma, + sigma0LambdaExtra::ALambdaPrTOFNSigma, + sigma0LambdaExtra::ALambdaPiTOFNSigma, + sigma0LambdaExtra::LambdaPosTPCCrossedRows, + sigma0LambdaExtra::LambdaNegTPCCrossedRows, + sigma0LambdaExtra::LambdaPosEta, + sigma0LambdaExtra::LambdaNegEta, + sigma0LambdaExtra::LambdaPosITSCls, + sigma0LambdaExtra::LambdaNegITSCls, + sigma0LambdaExtra::LambdaPosITSChi2PerNcl, + sigma0LambdaExtra::LambdaNegITSChi2PerNcl, + sigma0LambdaExtra::LambdaPosTrackCode, + sigma0LambdaExtra::LambdaNegTrackCode, + sigma0LambdaExtra::LambdaV0Type); + +// for MC +namespace sigma0MCCore { -DECLARE_SOA_COLUMN(IsSigma, isSigma, bool); // TODO: include PDG + IsPhysicalPrimary -DECLARE_SOA_COLUMN(IsAntiSigma, isAntiSigma, bool); -DECLARE_SOA_COLUMN(SigmaMCPt, sigmaMCPt, float); -DECLARE_SOA_COLUMN(PhotonCandPDGCode, photonCandPDGCode, int); -DECLARE_SOA_COLUMN(PhotonCandPDGCodeMother, photonCandPDGCodeMother, int); -DECLARE_SOA_COLUMN(IsPhotonCandPrimary, isPhotonCandPrimary, bool); -DECLARE_SOA_COLUMN(PhotonMCPt, photonMCPt, float); +DECLARE_SOA_COLUMN(MCradius, mcradius, float); +DECLARE_SOA_COLUMN(PDGCode, pdgCode, int); +DECLARE_SOA_COLUMN(PDGCodeMother, pdgCodeMother, int); +DECLARE_SOA_COLUMN(MCprocess, mcprocess, int); +DECLARE_SOA_COLUMN(IsProducedByGenerator, isProducedByGenerator, bool); + +DECLARE_SOA_COLUMN(PhotonMCPx, photonmcpx, float); +DECLARE_SOA_COLUMN(PhotonMCPy, photonmcpy, float); +DECLARE_SOA_COLUMN(PhotonMCPz, photonmcpz, float); +DECLARE_SOA_COLUMN(IsPhotonPrimary, isPhotonPrimary, bool); +DECLARE_SOA_COLUMN(PhotonPDGCode, photonPDGCode, int); +DECLARE_SOA_COLUMN(PhotonPDGCodeMother, photonPDGCodeMother, int); DECLARE_SOA_COLUMN(PhotonIsCorrectlyAssoc, photonIsCorrectlyAssoc, bool); -DECLARE_SOA_COLUMN(LambdaCandPDGCode, lambdaCandPDGCode, int); -DECLARE_SOA_COLUMN(LambdaCandPDGCodeMother, lambdaCandPDGCodeMother, int); -DECLARE_SOA_COLUMN(IsLambdaCandPrimary, isLambdaCandPrimary, bool); -DECLARE_SOA_COLUMN(LambdaMCPt, lambdaMCPt, float); + +DECLARE_SOA_COLUMN(LambdaMCPx, lambdamcpx, float); +DECLARE_SOA_COLUMN(LambdaMCPy, lambdamcpy, float); +DECLARE_SOA_COLUMN(LambdaMCPz, lambdamcpz, float); +DECLARE_SOA_COLUMN(IsLambdaPrimary, isLambdaPrimary, bool); +DECLARE_SOA_COLUMN(LambdaPDGCode, lambdaPDGCode, int); +DECLARE_SOA_COLUMN(LambdaPDGCodeMother, lambdaPDGCodeMother, int); DECLARE_SOA_COLUMN(LambdaIsCorrectlyAssoc, lambdaIsCorrectlyAssoc, bool); -} // namespace sigmaMCCore - -DECLARE_SOA_TABLE(SigmaMCCores, "AOD", "SIGMA0MCCORES", - sigmaMCCore::IsSigma, - sigmaMCCore::IsAntiSigma, - sigmaMCCore::SigmaMCPt, - sigmaMCCore::PhotonCandPDGCode, - sigmaMCCore::PhotonCandPDGCodeMother, - sigmaMCCore::IsPhotonCandPrimary, - sigmaMCCore::PhotonMCPt, - sigmaMCCore::PhotonIsCorrectlyAssoc, - sigmaMCCore::LambdaCandPDGCode, - sigmaMCCore::LambdaCandPDGCodeMother, - sigmaMCCore::IsLambdaCandPrimary, - sigmaMCCore::LambdaMCPt, - sigmaMCCore::LambdaIsCorrectlyAssoc); +DECLARE_SOA_DYNAMIC_COLUMN(IsSigma0, isSigma0, //! IsSigma0 + [](int pdgCode) -> bool { return pdgCode == 3212; }); + +DECLARE_SOA_DYNAMIC_COLUMN(IsAntiSigma0, isAntiSigma0, //! IsASigma0 + [](int pdgCode) -> bool { return pdgCode == -3212; }); + +DECLARE_SOA_DYNAMIC_COLUMN(MCPx, mcpx, //! Sigma0 px + [](float photonMCPx, float lambdaMCPx) -> float { return photonMCPx + lambdaMCPx; }); +DECLARE_SOA_DYNAMIC_COLUMN(MCPy, mcpy, //! Sigma0 py + [](float photonMCPy, float lambdaMCPy) -> float { return photonMCPy + lambdaMCPy; }); +DECLARE_SOA_DYNAMIC_COLUMN(MCPz, mcpz, //! Sigma0 pz + [](float photonMCPz, float lambdaMCPz) -> float { return photonMCPz + lambdaMCPz; }); + +DECLARE_SOA_DYNAMIC_COLUMN(MCPt, mcpt, + [](float photonMCPx, float photonMCPy, float lambdaMCPx, float lambdaMCPy) -> float { + return RecoDecay::pt(array{photonMCPx + lambdaMCPx, photonMCPy + lambdaMCPy}); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(MCP, mcp, //! Total momentum in GeV/c + [](float photonMCPx, float photonMCPy, float photonMCPz, float lambdaMCPx, float lambdaMCPy, float lambdaMCPz) -> float { + return RecoDecay::sqrtSumOfSquares(photonMCPx + lambdaMCPx, photonMCPy + lambdaMCPy, photonMCPz + lambdaMCPz); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Sigma0MCMass, sigma0MCMass, + [](float photonMCPx, float photonMCPy, float photonMCPz, float lambdaMCPx, float lambdaMCPy, float lambdaMCPz) -> float { + std::array pVecPhotons{photonMCPx, photonMCPy, photonMCPz}; + std::array pVecLambda{lambdaMCPx, lambdaMCPy, lambdaMCPz}; + auto arrMom = std::array{pVecPhotons, pVecLambda}; + return RecoDecay::m(arrMom, std::array{o2::constants::physics::MassPhoton, o2::constants::physics::MassLambda0}); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Sigma0MCY, sigma0MCY, + [](float photonMCPx, float photonMCPy, float photonMCPz, float lambdaMCPx, float lambdaMCPy, float lambdaMCPz) -> float { + return RecoDecay::y(std::array{photonMCPx + lambdaMCPx, photonMCPy + lambdaMCPy, photonMCPz + lambdaMCPz}, o2::constants::physics::MassSigma0); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(MCPhi, mcphi, //! Phi in the range [0, 2pi) + [](float photonMCPx, float photonMCPy, float lambdaMCPx, float lambdaMCPy) -> float { return RecoDecay::phi(photonMCPx + lambdaMCPx, photonMCPy + lambdaMCPy); }); + +DECLARE_SOA_DYNAMIC_COLUMN(MCEta, mceta, //! Pseudorapidity + [](float photonMCPx, float photonMCPy, float photonMCPz, float lambdaMCPx, float lambdaMCPy, float lambdaMCPz) -> float { + return RecoDecay::eta(std::array{photonMCPx + lambdaMCPx, photonMCPy + lambdaMCPy, photonMCPz + lambdaMCPz}); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(MCOPAngle, mcopAngle, + [](float photonMCPx, float photonMCPy, float photonMCPz, float lambdaMCPx, float lambdaMCPy, float lambdaMCPz) { + TVector3 v1(photonMCPx, photonMCPy, photonMCPz); + TVector3 v2(lambdaMCPx, lambdaMCPy, lambdaMCPz); + return v1.Angle(v2); + }); + +// Photon +DECLARE_SOA_DYNAMIC_COLUMN(PhotonMCPt, photonmcpt, //! Transverse momentum in GeV/c + [](float photonMCPx, float photonMCPy) -> float { + return RecoDecay::sqrtSumOfSquares(photonMCPx, photonMCPy); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(PhotonMCP, photonmcp, //! Total momentum in GeV/c + [](float photonMCPx, float photonMCPy, float photonMCPz) -> float { + return RecoDecay::sqrtSumOfSquares(photonMCPx, photonMCPy, photonMCPz); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(PhotonMCEta, photonMCEta, //! Pseudorapidity, conditionally defined to avoid FPEs + [](float photonMCPx, float photonMCPy, float photonMCPz) -> float { + return RecoDecay::eta(std::array{photonMCPx, photonMCPy, photonMCPz}); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(PhotonMCY, photonMCY, //! Rapidity + [](float photonMCPx, float photonMCPy, float photonMCPz) -> float { + return RecoDecay::y(std::array{photonMCPx, photonMCPy, photonMCPz}, o2::constants::physics::MassGamma); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(PhotonMCPhi, photonMCPhi, //! Phi in the range [0, 2pi) + [](float photonMCPx, float photonMCPy) -> float { return RecoDecay::phi(photonMCPx, photonMCPy); }); + +// Lambda/ALambda +DECLARE_SOA_DYNAMIC_COLUMN(LambdaMCPt, lambdamcpt, //! Transverse momentum in GeV/c + [](float lambdaMCPx, float lambdaMCPy) -> float { + return RecoDecay::sqrtSumOfSquares(lambdaMCPx, lambdaMCPy); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(LambdaMCP, lambdamcp, //! Total momentum in GeV/c + [](float lambdaMCPx, float lambdaMCPy, float lambdaMCPz) -> float { + return RecoDecay::sqrtSumOfSquares(lambdaMCPx, lambdaMCPy, lambdaMCPz); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(LambdaMCEta, lambdaMCEta, //! Pseudorapidity, conditionally defined to avoid FPEs + [](float lambdaMCPx, float lambdaMCPy, float lambdaMCPz) -> float { + return RecoDecay::eta(std::array{lambdaMCPx, lambdaMCPy, lambdaMCPz}); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(LambdaMCY, lambdaMCY, //! Rapidity + [](float lambdaMCPx, float lambdaMCPy, float lambdaMCPz) -> float { + return RecoDecay::y(std::array{lambdaMCPx, lambdaMCPy, lambdaMCPz}, o2::constants::physics::MassLambda); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(LambdaMCPhi, lambdaMCPhi, //! Phi in the range [0, 2pi) + [](float lambdaMCPx, float lambdaMCPy) -> float { return RecoDecay::phi(lambdaMCPx, lambdaMCPy); }); + +} // namespace sigma0MCCore + +DECLARE_SOA_TABLE(Sigma0MCCores, "AOD", "SIGMA0MCCORES", + // Basic properties + sigma0MCCore::MCradius, sigma0MCCore::PDGCode, sigma0MCCore::PDGCodeMother, sigma0MCCore::MCprocess, sigma0MCCore::IsProducedByGenerator, + + sigma0MCCore::PhotonMCPx, sigma0MCCore::PhotonMCPy, sigma0MCCore::PhotonMCPz, + sigma0MCCore::IsPhotonPrimary, sigma0MCCore::PhotonPDGCode, sigma0MCCore::PhotonPDGCodeMother, sigma0MCCore::PhotonIsCorrectlyAssoc, + + sigma0MCCore::LambdaMCPx, sigma0MCCore::LambdaMCPy, sigma0MCCore::LambdaMCPz, + sigma0MCCore::IsLambdaPrimary, sigma0MCCore::LambdaPDGCode, sigma0MCCore::LambdaPDGCodeMother, sigma0MCCore::LambdaIsCorrectlyAssoc, + + // Dynamic columns + sigma0MCCore::IsSigma0, + sigma0MCCore::IsAntiSigma0, + + sigma0MCCore::MCPx, + sigma0MCCore::MCPy, + sigma0MCCore::MCPz, + sigma0MCCore::MCPt, + sigma0MCCore::MCP, + sigma0MCCore::Sigma0MCMass, + sigma0MCCore::Sigma0MCY, + sigma0MCCore::MCPhi, + sigma0MCCore::MCEta, + sigma0MCCore::MCOPAngle, + + sigma0MCCore::PhotonMCPt, + sigma0MCCore::PhotonMCP, + sigma0MCCore::PhotonMCEta, + sigma0MCCore::PhotonMCY, + sigma0MCCore::PhotonMCPhi, + + sigma0MCCore::LambdaMCPt, + sigma0MCCore::LambdaMCP, + sigma0MCCore::LambdaMCEta, + sigma0MCCore::LambdaMCY, + sigma0MCCore::LambdaMCPhi); + +namespace sigma0Gen +{ +DECLARE_SOA_COLUMN(IsSigma0, isSigma0, bool); // true: sigma0, false: antisigma0 +DECLARE_SOA_COLUMN(ProducedByGenerator, producedByGenerator, bool); +DECLARE_SOA_COLUMN(Sigma0MCPt, sigma0MCPt, float); // MC pT + +} // namespace sigma0Gen + +DECLARE_SOA_TABLE(Sigma0Gens, "AOD", "SIGMA0GENS", + sigma0Gen::IsSigma0, + sigma0Gen::ProducedByGenerator, + sigma0Gen::Sigma0MCPt); + +DECLARE_SOA_TABLE(SigmaCollRef, "AOD", "SIGMACOLLREF", //! optional table to refer back to a collision + o2::soa::Index<>, v0data::StraCollisionId); + +DECLARE_SOA_TABLE(SigmaGenCollRef, "AOD", "SIGMAGENCOLLREF", //! optional table to refer back to a collision + o2::soa::Index<>, v0data::StraMCCollisionId); + +// ___________________________________________________________________________ +// pi0 QA +namespace Pi0Core +{ + +DECLARE_SOA_COLUMN(X, x, float); +DECLARE_SOA_COLUMN(Y, y, float); +DECLARE_SOA_COLUMN(Z, z, float); +DECLARE_SOA_COLUMN(DCADaughters, dcadaughters, float); +DECLARE_SOA_COLUMN(CosPA, cospa, float); + +DECLARE_SOA_COLUMN(Photon1Px, photon1Px, float); +DECLARE_SOA_COLUMN(Photon1Py, photon1Py, float); +DECLARE_SOA_COLUMN(Photon1Pz, photon1Pz, float); +DECLARE_SOA_COLUMN(Photon1Mass, photon1Mass, float); +DECLARE_SOA_COLUMN(Photon1Qt, photon1Qt, float); +DECLARE_SOA_COLUMN(Photon1Alpha, photon1Alpha, float); +DECLARE_SOA_COLUMN(Photon1DCAPosPV, photon1DCAPosPV, float); +DECLARE_SOA_COLUMN(Photon1DCANegPV, photon1DCANegPV, float); +DECLARE_SOA_COLUMN(Photon1DCADau, photon1DCADau, float); +DECLARE_SOA_COLUMN(Photon1NegEta, photon1NegEta, float); +DECLARE_SOA_COLUMN(Photon1PosEta, photon1PosEta, float); +DECLARE_SOA_COLUMN(Photon1CosPA, photon1CosPA, float); +DECLARE_SOA_COLUMN(Photon1Radius, photon1Radius, float); +DECLARE_SOA_COLUMN(Photon1Zconv, photon1Zconv, float); +DECLARE_SOA_COLUMN(Photon1PosTPCCrossedRows, photon1PosTPCCrossedRows, uint8_t); +DECLARE_SOA_COLUMN(Photon1NegTPCCrossedRows, photon1NegTPCCrossedRows, uint8_t); +DECLARE_SOA_COLUMN(Photon1PosTPCNSigmaEl, photon1PosTPCNSigmaEl, float); +DECLARE_SOA_COLUMN(Photon1NegTPCNSigmaEl, photon1NegTPCNSigmaEl, float); +DECLARE_SOA_COLUMN(Photon1V0Type, photon1V0Type, uint8_t); + +DECLARE_SOA_COLUMN(Photon2Px, photon2Px, float); +DECLARE_SOA_COLUMN(Photon2Py, photon2Py, float); +DECLARE_SOA_COLUMN(Photon2Pz, photon2Pz, float); +DECLARE_SOA_COLUMN(Photon2Mass, photon2Mass, float); +DECLARE_SOA_COLUMN(Photon2Qt, photon2Qt, float); +DECLARE_SOA_COLUMN(Photon2Alpha, photon2Alpha, float); +DECLARE_SOA_COLUMN(Photon2DCAPosPV, photon2DCAPosPV, float); +DECLARE_SOA_COLUMN(Photon2DCANegPV, photon2DCANegPV, float); +DECLARE_SOA_COLUMN(Photon2DCADau, photon2DCADau, float); +DECLARE_SOA_COLUMN(Photon2NegEta, photon2NegEta, float); +DECLARE_SOA_COLUMN(Photon2PosEta, photon2PosEta, float); +DECLARE_SOA_COLUMN(Photon2CosPA, photon2CosPA, float); +DECLARE_SOA_COLUMN(Photon2Radius, photon2Radius, float); +DECLARE_SOA_COLUMN(Photon2Zconv, photon2Zconv, float); +DECLARE_SOA_COLUMN(Photon2PosTPCCrossedRows, photon2PosTPCCrossedRows, uint8_t); +DECLARE_SOA_COLUMN(Photon2NegTPCCrossedRows, photon2NegTPCCrossedRows, uint8_t); +DECLARE_SOA_COLUMN(Photon2PosTPCNSigmaEl, photon2PosTPCNSigmaEl, float); +DECLARE_SOA_COLUMN(Photon2NegTPCNSigmaEl, photon2NegTPCNSigmaEl, float); +DECLARE_SOA_COLUMN(Photon2V0Type, photon2V0Type, uint8_t); + +//______________________________________________________ +// DYNAMIC COLUMNS +DECLARE_SOA_DYNAMIC_COLUMN(Px, px, //! Pi0 px + [](float photon1Px, float photon2Px) -> float { return photon1Px + photon2Px; }); +DECLARE_SOA_DYNAMIC_COLUMN(Py, py, //! Pi0 py + [](float photon1Py, float photon2Py) -> float { return photon1Py + photon2Py; }); +DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, //! Pi0 pz + [](float photon1Pz, float photon2Pz) -> float { return photon1Pz + photon2Pz; }); + +DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, + [](float photon1Px, float photon1Py, float photon2Px, float photon2Py) -> float { + return RecoDecay::pt(array{photon1Px + photon2Px, photon1Py + photon2Py}); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(P, p, //! Total momentum in GeV/c + [](float photon1Px, float photon1Py, float photon1Pz, float photon2Px, float photon2Py, float photon2Pz) -> float { + return RecoDecay::sqrtSumOfSquares(photon1Px + photon2Px, photon1Py + photon2Py, photon1Pz + photon2Pz); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Pi0Mass, pi0Mass, + [](float photon1Px, float photon1Py, float photon1Pz, float photon2Px, float photon2Py, float photon2Pz) -> float { + std::array pVecPhoton1{photon1Px, photon1Py, photon1Pz}; + std::array pVecPhoton2{photon2Px, photon2Py, photon2Pz}; + auto arrMom = std::array{pVecPhoton1, pVecPhoton2}; + return RecoDecay::m(arrMom, std::array{o2::constants::physics::MassPhoton, o2::constants::physics::MassPhoton}); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Pi0Y, pi0Y, + [](float photon1Px, float photon1Py, float photon1Pz, float photon2Px, float photon2Py, float photon2Pz) -> float { + return RecoDecay::y(std::array{photon1Px + photon2Px, photon1Py + photon2Py, photon1Pz + photon2Pz}, o2::constants::physics::MassPi0); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Phi, phi, //! Phi in the range [0, 2pi) + [](float photon1Px, float photon1Py, float photon2Px, float photon2Py) -> float { return RecoDecay::phi(photon1Px + photon2Px, photon1Py + photon2Py); }); + +DECLARE_SOA_DYNAMIC_COLUMN(Eta, eta, //! Pseudorapidity + [](float photon1Px, float photon1Py, float photon1Pz, float photon2Px, float photon2Py, float photon2Pz) -> float { + return RecoDecay::eta(std::array{photon1Px + photon2Px, photon1Py + photon2Py, photon1Pz + photon2Pz}); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Radius, radius, //! Pi0 decay radius (2D, centered at zero) + [](float x, float y) -> float { return RecoDecay::sqrtSumOfSquares(x, y); }); + +DECLARE_SOA_DYNAMIC_COLUMN(OPAngle, opAngle, + [](float photon1Px, float photon1Py, float photon1Pz, float photon2Px, float photon2Py, float photon2Pz) { + TVector3 v1(photon1Px, photon1Py, photon1Pz); + TVector3 v2(photon2Px, photon2Py, photon2Pz); + return v1.Angle(v2); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Photon1Pt, photon1Pt, //! Transverse momentum in GeV/c + [](float photon1Px, float photon1Py) -> float { + return RecoDecay::sqrtSumOfSquares(photon1Px, photon1Py); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Photon1P, photon1p, //! Total momentum in GeV/c + [](float photon1Px, float photon1Py, float photon1Pz) -> float { + return RecoDecay::sqrtSumOfSquares(photon1Px, photon1Py, photon1Pz); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Photon1Eta, photon1Eta, //! Pseudorapidity, conditionally defined to avoid FPEs + [](float photon1Px, float photon1Py, float photon1Pz) -> float { + return RecoDecay::eta(std::array{photon1Px, photon1Py, photon1Pz}); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Photon1Y, photon1Y, //! Rapidity + [](float photon1Px, float photon1Py, float photon1Pz) -> float { + return RecoDecay::y(std::array{photon1Px, photon1Py, photon1Pz}, o2::constants::physics::MassGamma); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Photon1Phi, photon1Phi, //! Phi in the range [0, 2pi) + [](float photon1Px, float photon1Py) -> float { return RecoDecay::phi(photon1Px, photon1Py); }); + +DECLARE_SOA_DYNAMIC_COLUMN(Photon2Pt, photon2Pt, //! Transverse momentum in GeV/c + [](float photon2Px, float photon2Py) -> float { + return RecoDecay::sqrtSumOfSquares(photon2Px, photon2Py); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Photon2P, photon2p, //! Total momentum in GeV/c + [](float photon2Px, float photon2Py, float photon2Pz) -> float { + return RecoDecay::sqrtSumOfSquares(photon2Px, photon2Py, photon2Pz); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Photon2Eta, photon2Eta, //! Pseudorapidity, conditionally defined to avoid FPEs + [](float photon2Px, float photon2Py, float photon2Pz) -> float { + return RecoDecay::eta(std::array{photon2Px, photon2Py, photon2Pz}); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Photon2Y, photon2Y, //! Rapidity + [](float photon2Px, float photon2Py, float photon2Pz) -> float { + return RecoDecay::y(std::array{photon2Px, photon2Py, photon2Pz}, o2::constants::physics::MassGamma); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Photon2Phi, photon2Phi, //! Phi in the range [0, 2pi) + [](float photon2Px, float photon2Py) -> float { return RecoDecay::phi(photon2Px, photon2Py); }); + +} // namespace Pi0Core + +DECLARE_SOA_TABLE(Pi0Cores, "AOD", "PI0CORES", + Pi0Core::X, Pi0Core::Y, Pi0Core::Z, Pi0Core::DCADaughters, Pi0Core::CosPA, + + // Photon 1 base properties + Pi0Core::Photon1Px, Pi0Core::Photon1Py, Pi0Core::Photon1Pz, + Pi0Core::Photon1Mass, Pi0Core::Photon1Qt, Pi0Core::Photon1Alpha, Pi0Core::Photon1DCAPosPV, Pi0Core::Photon1DCANegPV, Pi0Core::Photon1DCADau, + Pi0Core::Photon1NegEta, Pi0Core::Photon1PosEta, Pi0Core::Photon1CosPA, Pi0Core::Photon1Radius, Pi0Core::Photon1Zconv, + Pi0Core::Photon1PosTPCCrossedRows, Pi0Core::Photon1NegTPCCrossedRows, Pi0Core::Photon1PosTPCNSigmaEl, Pi0Core::Photon1NegTPCNSigmaEl, Pi0Core::Photon1V0Type, + + // Photon 2 base properties + Pi0Core::Photon2Px, Pi0Core::Photon2Py, Pi0Core::Photon2Pz, + Pi0Core::Photon2Mass, Pi0Core::Photon2Qt, Pi0Core::Photon2Alpha, Pi0Core::Photon2DCAPosPV, Pi0Core::Photon2DCANegPV, Pi0Core::Photon2DCADau, + Pi0Core::Photon2NegEta, Pi0Core::Photon2PosEta, Pi0Core::Photon2CosPA, Pi0Core::Photon2Radius, Pi0Core::Photon2Zconv, + Pi0Core::Photon2PosTPCCrossedRows, Pi0Core::Photon2NegTPCCrossedRows, Pi0Core::Photon2PosTPCNSigmaEl, Pi0Core::Photon2NegTPCNSigmaEl, Pi0Core::Photon2V0Type, + + // Dynamic columns + Pi0Core::Px, + Pi0Core::Py, + Pi0Core::Pz, + Pi0Core::Pt, + Pi0Core::P, + Pi0Core::Pi0Mass, + Pi0Core::Pi0Y, + Pi0Core::Phi, + Pi0Core::Eta, + Pi0Core::Radius, + Pi0Core::OPAngle, + + Pi0Core::Photon1Pt, + Pi0Core::Photon1P, + Pi0Core::Photon1Eta, + Pi0Core::Photon1Y, + Pi0Core::Photon1Phi, + + Pi0Core::Photon2Pt, + Pi0Core::Photon2P, + Pi0Core::Photon2Eta, + Pi0Core::Photon2Y, + Pi0Core::Photon2Phi); + +// for MC +namespace Pi0CoreMC +{ + +DECLARE_SOA_COLUMN(MCradius, mcradius, float); +DECLARE_SOA_COLUMN(PDGCode, pdgCode, int); +DECLARE_SOA_COLUMN(PDGCodeMother, pdgCodeMother, int); +DECLARE_SOA_COLUMN(MCprocess, mcprocess, int); +DECLARE_SOA_COLUMN(IsProducedByGenerator, isProducedByGenerator, bool); + +DECLARE_SOA_COLUMN(Photon1MCPx, photon1mcpx, float); +DECLARE_SOA_COLUMN(Photon1MCPy, photon1mcpy, float); +DECLARE_SOA_COLUMN(Photon1MCPz, photon1mcpz, float); +DECLARE_SOA_COLUMN(IsPhoton1Primary, isPhoton1Primary, bool); +DECLARE_SOA_COLUMN(Photon1PDGCode, photon1PDGCode, int); +DECLARE_SOA_COLUMN(Photon1PDGCodeMother, photon1PDGCodeMother, int); +DECLARE_SOA_COLUMN(Photon1IsCorrectlyAssoc, photon1IsCorrectlyAssoc, bool); + +DECLARE_SOA_COLUMN(Photon2MCPx, photon2mcpx, float); +DECLARE_SOA_COLUMN(Photon2MCPy, photon2mcpy, float); +DECLARE_SOA_COLUMN(Photon2MCPz, photon2mcpz, float); +DECLARE_SOA_COLUMN(IsPhoton2Primary, isPhoton2Primary, bool); +DECLARE_SOA_COLUMN(Photon2PDGCode, photon2PDGCode, int); +DECLARE_SOA_COLUMN(Photon2PDGCodeMother, photon2PDGCodeMother, int); +DECLARE_SOA_COLUMN(Photon2IsCorrectlyAssoc, photon2IsCorrectlyAssoc, bool); + +DECLARE_SOA_DYNAMIC_COLUMN(IsPi0, isPi0, //! IsPi0 + [](int pdgCode) -> bool { return pdgCode == 111; }); + +DECLARE_SOA_DYNAMIC_COLUMN(IsFromXi0, isFromXi0, //! Pi0 from Xi0 + [](int pdgCodeMother) -> bool { return pdgCodeMother == 3322; }); + +DECLARE_SOA_DYNAMIC_COLUMN(MCPx, mcpx, //! Pi0 MC px + [](float photon1MCPx, float photon2MCPx) -> float { return photon1MCPx + photon2MCPx; }); +DECLARE_SOA_DYNAMIC_COLUMN(MCPy, mcpy, //! Pi0 MC py + [](float photon1MCPy, float photon2MCPy) -> float { return photon1MCPy + photon2MCPy; }); +DECLARE_SOA_DYNAMIC_COLUMN(MCPz, mcpz, //! Pi0 MC pz + [](float photon1MCPz, float photon2MCPz) -> float { return photon1MCPz + photon2MCPz; }); + +DECLARE_SOA_DYNAMIC_COLUMN(MCPt, mcpt, + [](float photon1MCPx, float photon1MCPy, float photon2MCPx, float photon2MCPy) -> float { + return RecoDecay::pt(array{photon1MCPx + photon2MCPx, photon1MCPy + photon2MCPy}); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(MCP, mcp, //! Total momentum in GeV/c + [](float photon1MCPx, float photon1MCPy, float photon1MCPz, float photon2MCPx, float photon2MCPy, float photon2MCPz) -> float { + return RecoDecay::sqrtSumOfSquares(photon1MCPx + photon2MCPx, photon1MCPy + photon2MCPy, photon1MCPz + photon2MCPz); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Pi0MCMass, pi0MCMass, + [](float photon1MCPx, float photon1MCPy, float photon1MCPz, float photon2MCPx, float photon2MCPy, float photon2MCPz) -> float { + std::array pVecPhoton1{photon1MCPx, photon1MCPy, photon1MCPz}; + std::array pVecPhoton2{photon2MCPx, photon2MCPy, photon2MCPz}; + auto arrMom = std::array{pVecPhoton1, pVecPhoton2}; + return RecoDecay::m(arrMom, std::array{o2::constants::physics::MassPhoton, o2::constants::physics::MassPhoton}); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Pi0MCY, pi0MCY, + [](float photon1MCPx, float photon1MCPy, float photon1MCPz, float photon2MCPx, float photon2MCPy, float photon2MCPz) -> float { + return RecoDecay::y(std::array{photon1MCPx + photon2MCPx, photon1MCPy + photon2MCPy, photon1MCPz + photon2MCPz}, o2::constants::physics::MassPi0); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(MCPhi, mcphi, //! Phi in the range [0, 2pi) + [](float photon1MCPx, float photon1MCPy, float photon2MCPx, float photon2MCPy) -> float { return RecoDecay::phi(photon1MCPx + photon2MCPx, photon1MCPy + photon2MCPy); }); + +DECLARE_SOA_DYNAMIC_COLUMN(MCEta, mceta, //! Pseudorapidity + [](float photon1MCPx, float photon1MCPy, float photon1MCPz, float photon2MCPx, float photon2MCPy, float photon2MCPz) -> float { + return RecoDecay::eta(std::array{photon1MCPx + photon2MCPx, photon1MCPy + photon2MCPy, photon1MCPz + photon2MCPz}); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(MCOPAngle, mcopAngle, + [](float photon1MCPx, float photon1MCPy, float photon1MCPz, float photon2MCPx, float photon2MCPy, float photon2MCPz) { + TVector3 v1(photon1MCPx, photon1MCPy, photon1MCPz); + TVector3 v2(photon2MCPx, photon2MCPy, photon2MCPz); + return v1.Angle(v2); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Photon1MCPt, photon1MCPt, //! Transverse momentum in GeV/c + [](float photon1MCPx, float photon1MCPy) -> float { + return RecoDecay::sqrtSumOfSquares(photon1MCPx, photon1MCPy); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Photon1MCP, photon1MCp, //! Total momentum in GeV/c + [](float photon1MCPx, float photon1MCPy, float photon1MCPz) -> float { + return RecoDecay::sqrtSumOfSquares(photon1MCPx, photon1MCPy, photon1MCPz); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Photon1MCEta, photon1MCEta, //! Pseudorapidity, conditionally defined to avoid FPEs + [](float photon1MCPx, float photon1MCPy, float photon1MCPz) -> float { + return RecoDecay::eta(std::array{photon1MCPx, photon1MCPy, photon1MCPz}); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Photon1MCY, photon1MCY, //! Rapidity + [](float photon1MCPx, float photon1MCPy, float photon1MCPz) -> float { + return RecoDecay::y(std::array{photon1MCPx, photon1MCPy, photon1MCPz}, o2::constants::physics::MassGamma); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Photon1MCPhi, photon1MCPhi, //! Phi in the range [0, 2pi) + [](float photon1MCPx, float photon1MCPy) -> float { return RecoDecay::phi(photon1MCPx, photon1MCPy); }); + +DECLARE_SOA_DYNAMIC_COLUMN(Photon2MCPt, photon2MCPt, //! Transverse momentum in GeV/c + [](float photon2MCPx, float photon2MCPy) -> float { + return RecoDecay::sqrtSumOfSquares(photon2MCPx, photon2MCPy); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Photon2MCP, photon2MCp, //! Total momentum in GeV/c + [](float photon2MCPx, float photon2MCPy, float photon2MCPz) -> float { + return RecoDecay::sqrtSumOfSquares(photon2MCPx, photon2MCPy, photon2MCPz); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Photon2MCEta, photon2MCEta, //! Pseudorapidity, conditionally defined to avoid FPEs + [](float photon2MCPx, float photon2MCPy, float photon2MCPz) -> float { + return RecoDecay::eta(std::array{photon2MCPx, photon2MCPy, photon2MCPz}); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Photon2MCY, photon2MCY, //! Rapidity + [](float photon2MCPx, float photon2MCPy, float photon2MCPz) -> float { + return RecoDecay::y(std::array{photon2MCPx, photon2MCPy, photon2MCPz}, o2::constants::physics::MassGamma); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(Photon2MCPhi, photon2MCPhi, //! Phi in the range [0, 2pi) + [](float photon2MCPx, float photon2MCPy) -> float { return RecoDecay::phi(photon2MCPx, photon2MCPy); }); + +} // namespace Pi0CoreMC + +DECLARE_SOA_TABLE(Pi0CoresMC, "AOD", "PI0CORESMC", + // Basic properties + Pi0CoreMC::MCradius, Pi0CoreMC::PDGCode, Pi0CoreMC::PDGCodeMother, Pi0CoreMC::MCprocess, Pi0CoreMC::IsProducedByGenerator, + + Pi0CoreMC::Photon1MCPx, Pi0CoreMC::Photon1MCPy, Pi0CoreMC::Photon1MCPz, + Pi0CoreMC::IsPhoton1Primary, Pi0CoreMC::Photon1PDGCode, Pi0CoreMC::Photon1PDGCodeMother, Pi0CoreMC::Photon1IsCorrectlyAssoc, + + Pi0CoreMC::Photon2MCPx, Pi0CoreMC::Photon2MCPy, Pi0CoreMC::Photon2MCPz, + Pi0CoreMC::IsPhoton2Primary, Pi0CoreMC::Photon2PDGCode, Pi0CoreMC::Photon2PDGCodeMother, Pi0CoreMC::Photon2IsCorrectlyAssoc, + + // Dynamic columns + Pi0CoreMC::IsPi0, + Pi0CoreMC::IsFromXi0, + + Pi0CoreMC::MCPx, + Pi0CoreMC::MCPy, + Pi0CoreMC::MCPz, + Pi0CoreMC::MCPt, + Pi0CoreMC::MCP, + Pi0CoreMC::Pi0MCMass, + Pi0CoreMC::Pi0MCY, + Pi0CoreMC::MCPhi, + Pi0CoreMC::MCEta, + Pi0CoreMC::MCOPAngle, + + Pi0CoreMC::Photon1MCPt, + Pi0CoreMC::Photon1MCP, + Pi0CoreMC::Photon1MCEta, + Pi0CoreMC::Photon1MCY, + Pi0CoreMC::Photon1MCPhi, + + Pi0CoreMC::Photon2MCPt, + Pi0CoreMC::Photon2MCP, + Pi0CoreMC::Photon2MCEta, + Pi0CoreMC::Photon2MCY, + Pi0CoreMC::Photon2MCPhi); + +DECLARE_SOA_TABLE(Pi0CollRef, "AOD", "PI0COLLREF", //! optional table to refer back to a collision + o2::soa::Index<>, v0data::StraCollisionId); + +namespace pi0Gen +{ +DECLARE_SOA_COLUMN(ProducedByGenerator, producedByGenerator, bool); +DECLARE_SOA_COLUMN(Pi0MCPt, pi0MCPt, float); // MC pT +} // namespace pi0Gen + +DECLARE_SOA_TABLE(Pi0Gens, "AOD", "PI0GENS", + pi0Gen::ProducedByGenerator, + pi0Gen::Pi0MCPt); + +DECLARE_SOA_TABLE(Pi0GenCollRef, "AOD", "PI0GENCOLLREF", //! optional table to refer back to a collision + o2::soa::Index<>, v0data::StraMCCollisionId); + } // namespace o2::aod #endif // PWGLF_DATAMODEL_LFSIGMATABLES_H_ diff --git a/PWGLF/TableProducer/Strangeness/sigma0builder.cxx b/PWGLF/TableProducer/Strangeness/sigma0builder.cxx index 32ed292dddd..511dc283ce3 100644 --- a/PWGLF/TableProducer/Strangeness/sigma0builder.cxx +++ b/PWGLF/TableProducer/Strangeness/sigma0builder.cxx @@ -20,61 +20,74 @@ // gianni.shigeru.setoue.liveraro@cern.ch // -#include -#include -#include -#include +#include "PWGLF/DataModel/LFSigmaTables.h" +#include "PWGLF/DataModel/LFStrangenessMLTables.h" +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/ASoA.h" -#include "ReconstructionDataFormats/Track.h" +#include "Common/CCDB/ctpRateFetcher.h" #include "Common/Core/RecoDecay.h" -#include "Common/Core/trackUtilities.h" #include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/EventSelection.h" +#include "Common/Core/trackUtilities.h" #include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" #include "Common/DataModel/PIDResponse.h" -#include "Common/CCDB/ctpRateFetcher.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/DataModel/LFStrangenessPIDTables.h" -#include "PWGLF/DataModel/LFStrangenessMLTables.h" -#include "PWGLF/DataModel/LFSigmaTables.h" +#include "Common/DataModel/TrackSelectionTables.h" + #include "CCDB/BasicCCDBManager.h" +#include "Framework/ASoA.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" + +#include "Math/Vector3D.h" +#include +#include #include #include -#include #include #include -#include +#include + +#include +#include +#include using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; using std::array; using dauTracks = soa::Join; -using V0DerivedMCDatas = soa::Join; -using V0StandardDerivedDatas = soa::Join; +using V0StandardDerivedDatas = soa::Join; +using V0DerivedMCDatas = soa::Join; +using V0TOFStandardDerivedDatas = soa::Join; +using V0TOFDerivedMCDatas = soa::Join; struct sigma0builder { Service ccdb; ctpRateFetcher rateFetcher; - // SliceCache cache; - - Produces sigma0cores; // save sigma0 candidates for analysis - Produces sigmaPhotonExtras; // save sigma0 candidates for analysis - Produces sigmaLambdaExtras; // save sigma0 candidates for analysis - Produces sigma0mccores; - - // For manual sliceBy - // PresliceUnsorted perCollisionMCDerived = o2::aod::v0data::straCollisionId; - // PresliceUnsorted perCollisionSTDDerived = o2::aod::v0data::straCollisionId; - PresliceUnsorted> perMcCollision = aod::v0data::straMCCollisionId; - + //__________________________________________________ + // Sigma0 specific + Produces sigma0cores; // sigma0 candidates info for analysis + Produces sigmaPhotonExtras; // photons from sigma0 candidates info + Produces sigmaLambdaExtras; // lambdas from sigma0 candidates info + Produces sigma0CollRefs; // references collisions from Sigma0Cores + Produces sigma0mccores; // Reco sigma0 MC properties + Produces sigma0Gens; // Generated sigma0s + Produces sigma0GenCollRefs; // references collisions from sigma0Gens + + //__________________________________________________ + // Pi0 specific + Produces pi0cores; // pi0 candidates info for analysis + Produces pi0coresRefs; // references collisions from photonpair + Produces pi0coresmc; // Reco pi0 MC properties + Produces pi0Gens; // Generated pi0s + Produces pi0GenCollRefs; // references collisions from pi0Gens + + //__________________________________________________ // pack track quality but separte also afterburner // dynamic range: 0-31 enum selection : int { hasTPC = 0, @@ -86,48 +99,16 @@ struct sigma0builder { // Histogram registry HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - Configurable fillQAhistos{"fillQAhistos", false, "if true, fill QA histograms"}; - Configurable fillBkgQAhistos{"fillBkgQAhistos", false, "if true, fill MC QA histograms for Bkg study"}; - Configurable doPi0QA{"doPi0QA", true, "Flag to fill QA histos for pi0 rejection study."}; Configurable doAssocStudy{"doAssocStudy", false, "Do v0 to collision association study."}; - - // Event level Configurable doPPAnalysis{"doPPAnalysis", true, "if in pp, set to true"}; + Configurable fGetIR{"fGetIR", false, "Flag to retrieve the IR info."}; Configurable fIRCrashOnNull{"fIRCrashOnNull", false, "Flag to avoid CTP RateFetcher crash."}; Configurable irSource{"irSource", "T0VTX", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"}; - struct : ConfigurableGroup { - Configurable requireSel8{"requireSel8", true, "require sel8 event selection"}; - Configurable requireTriggerTVX{"requireTriggerTVX", true, "require FT0 vertex (acceptable FT0C-FT0A time difference) at trigger level"}; - Configurable rejectITSROFBorder{"rejectITSROFBorder", true, "reject events at ITS ROF border"}; - Configurable rejectTFBorder{"rejectTFBorder", true, "reject events at TF border"}; - Configurable requireIsVertexITSTPC{"requireIsVertexITSTPC", true, "require events with at least one ITS-TPC track"}; - Configurable requireIsGoodZvtxFT0VsPV{"requireIsGoodZvtxFT0VsPV", true, "require events with PV position along z consistent (within 1 cm) between PV reconstructed using tracks and PV using FT0 A-C time difference"}; - Configurable requireIsVertexTOFmatched{"requireIsVertexTOFmatched", false, "require events with at least one of vertex contributors matched to TOF"}; - Configurable requireIsVertexTRDmatched{"requireIsVertexTRDmatched", false, "require events with at least one of vertex contributors matched to TRD"}; - Configurable rejectSameBunchPileup{"rejectSameBunchPileup", false, "reject collisions in case of pileup with another collision in the same foundBC"}; - Configurable requireNoCollInTimeRangeStd{"requireNoCollInTimeRangeStd", false, "reject collisions corrupted by the cannibalism, with other collisions within +/- 2 microseconds or mult above a certain threshold in -4 - -2 microseconds"}; - Configurable requireNoCollInTimeRangeStrict{"requireNoCollInTimeRangeStrict", false, "reject collisions corrupted by the cannibalism, with other collisions within +/- 10 microseconds"}; - Configurable requireNoCollInTimeRangeNarrow{"requireNoCollInTimeRangeNarrow", false, "reject collisions corrupted by the cannibalism, with other collisions within +/- 2 microseconds"}; - Configurable requireNoCollInTimeRangeVzDep{"requireNoCollInTimeRangeVzDep", false, "reject collisions corrupted by the cannibalism, with other collisions with pvZ of drifting TPC tracks from past/future collisions within 2.5 cm the current pvZ"}; - Configurable requireNoCollInROFStd{"requireNoCollInROFStd", false, "reject collisions corrupted by the cannibalism, with other collisions within the same ITS ROF with mult. above a certain threshold"}; - Configurable requireNoCollInROFStrict{"requireNoCollInROFStrict", false, "reject collisions corrupted by the cannibalism, with other collisions within the same ITS ROF"}; - Configurable requireINEL0{"requireINEL0", false, "require INEL>0 event selection"}; - Configurable requireINEL1{"requireINEL1", false, "require INEL>1 event selection"}; - Configurable maxZVtxPosition{"maxZVtxPosition", 10., "max Z vtx position"}; - Configurable useEvtSelInDenomEff{"useEvtSelInDenomEff", false, "Consider event selections in the recoed <-> gen collision association for the denominator (or numerator) of the acc. x eff. (or signal loss)?"}; - Configurable applyZVtxSelOnMCPV{"applyZVtxSelOnMCPV", false, "Apply Z-vtx cut on the PV of the generated collision?"}; - Configurable useFT0CbasedOccupancy{"useFT0CbasedOccupancy", false, "Use sum of FT0-C amplitudes for estimating occupancy? (if not, use track-based definition)"}; - // fast check on occupancy - Configurable minOccupancy{"minOccupancy", -1, "minimum occupancy from neighbouring collisions"}; - Configurable maxOccupancy{"maxOccupancy", -1, "maximum occupancy from neighbouring collisions"}; - - // fast check on interaction rate - Configurable minIR{"minIR", -1, "minimum IR collisions"}; - Configurable maxIR{"maxIR", -1, "maximum IR collisions"}; - - } eventSelections; + // Tables to fill + Configurable fillPi0Tables{"fillPi0Tables", false, "fill pi0 tables for QA"}; + Configurable fillSigma0Tables{"fillSigma0Tables", true, "fill sigma0 tables for analysis"}; // For ML Selection Configurable useMLScores{"useMLScores", false, "use ML scores to select candidates"}; @@ -137,7 +118,7 @@ struct sigma0builder { // For standard approach: //// Lambda criteria: - Configurable V0Rapidity{"V0Rapidity", 0.8, "v0 rapidity"}; + Configurable V0Rapidity{"V0Rapidity", 0.5, "v0 rapidity"}; Configurable LambdaDauPseudoRap{"LambdaDauPseudoRap", 1.5, "Max pseudorapidity of daughter tracks"}; Configurable LambdaMinDCANegToPv{"LambdaMinDCANegToPv", 0.0, "min DCA Neg To PV (cm)"}; @@ -147,7 +128,7 @@ struct sigma0builder { Configurable LambdaMaxv0radius{"LambdaMaxv0radius", 60, "Max V0 radius (cm)"}; Configurable LambdaWindow{"LambdaWindow", 0.05, "Mass window around expected (in GeV/c2)"}; - //// Photon criteria: + //// Photon criteria (for sigma0s and pi0s): Configurable PhotonMaxDauPseudoRap{"PhotonMaxDauPseudoRap", 1.5, "Max pseudorapidity of daughter tracks"}; Configurable PhotonMinDCAToPv{"PhotonMinDCAToPv", 0.0, "Min DCA daughter To PV (cm)"}; Configurable PhotonMaxDCAV0Dau{"PhotonMaxDCAV0Dau", 3.5, "Max DCA V0 Daughters (cm)"}; @@ -159,18 +140,18 @@ struct sigma0builder { Configurable Sigma0Window{"Sigma0Window", 0.1, "Mass window around expected (in GeV/c2)"}; Configurable SigmaMaxRap{"SigmaMaxRap", 0.8, "Max sigma0 rapidity"}; - //// Extras: - Configurable Pi0PhotonMinDCADauToPv{"Pi0PhotonMinDCADauToPv", 0.0, "Min DCA daughter To PV (cm)"}; - Configurable Pi0PhotonMaxDCAV0Dau{"Pi0PhotonMaxDCAV0Dau", 3.5, "Max DCA V0 Daughters (cm)"}; - Configurable Pi0PhotonMinTPCCrossedRows{"Pi0PhotonMinTPCCrossedRows", 0, "Min daughter TPC Crossed Rows"}; - Configurable Pi0PhotonMaxTPCNSigmas{"Pi0PhotonMaxTPCNSigmas", 7, "Max TPC NSigmas for daughters"}; - Configurable Pi0PhotonMaxEta{"Pi0PhotonMaxEta", 0.8, "Max photon rapidity"}; - Configurable Pi0PhotonMinRadius{"Pi0PhotonMinRadius", 3.0, "Min photon conversion radius (cm)"}; - Configurable Pi0PhotonMaxRadius{"Pi0PhotonMaxRadius", 115, "Max photon conversion radius (cm)"}; - Configurable Pi0PhotonMaxQt{"Pi0PhotonMaxQt", 0.05, "Max photon qt value (AP plot) (GeV/c)"}; - Configurable Pi0PhotonMaxAlpha{"Pi0PhotonMaxAlpha", 0.95, "Max photon alpha absolute value (AP plot)"}; - Configurable Pi0PhotonMinV0cospa{"Pi0PhotonMinV0cospa", 0.80, "Min V0 CosPA"}; - Configurable Pi0PhotonMaxMass{"Pi0PhotonMaxMass", 0.10, "Max photon mass (GeV/c^{2})"}; + //// Pi0 criteria:: + Configurable Pi0MaxRap{"Pi0MaxRap", 0.8, "Max Pi0 Rapidity"}; + Configurable Pi0MassWindow{"Pi0MassWindow", 0.115, "Mass window around expected (in GeV/c2)"}; + + //// Generated particles criteria: + struct : ConfigurableGroup { + Configurable doQA{"doQA", true, "If True, fill QA histos"}; + Configurable mc_keepOnlyFromGenerator{"mc_keepOnlyFromGenerator", false, "Keep only mcparticles from the generator"}; + Configurable mc_keepOnlyFromTransport{"mc_keepOnlyFromTransport", false, "Keep only mcparticles from the transport code"}; + Configurable mc_selectMCProcess{"mc_selectMCProcess", -1, "Keep only mcparticles produced in the selected MC process"}; + Configurable mc_rapidityWindow{"mc_rapidityWindow", 0.5, "Max generated particle rapidity"}; + } genSelections; // Axis // base properties @@ -181,16 +162,8 @@ struct sigma0builder { ConfigurableAxis axisSigmaMass{"axisSigmaMass", {500, 1.10f, 1.30f}, "M_{#Sigma^{0}} (GeV/c^{2})"}; ConfigurableAxis axisLambdaMass{"axisLambdaMass", {200, 1.05f, 1.151f}, "M_{#Lambda} (GeV/c^{2})"}; ConfigurableAxis axisPhotonMass{"axisPhotonMass", {200, -0.1f, 0.5f}, "M_{#Gamma}"}; - ConfigurableAxis axisPi0Mass{"axisPi0Mass", {200, 0.08f, 0.18f}, "M_{#Pi^{0}}"}; ConfigurableAxis axisK0SMass{"axisK0SMass", {200, 0.4f, 0.6f}, "M_{K^{0}}"}; - // AP plot axes - ConfigurableAxis axisAPAlpha{"axisAPAlpha", {220, -1.1f, 1.1f}, "V0 AP alpha"}; - ConfigurableAxis axisAPQt{"axisAPQt", {220, 0.0f, 0.5f}, "V0 AP alpha"}; - - // Track quality axes - ConfigurableAxis axisTPCrows{"axisTPCrows", {160, 0.0f, 160.0f}, "N TPC rows"}; - // topological variable QA axes ConfigurableAxis axisDCAtoPV{"axisDCAtoPV", {500, 0.0f, 50.0f}, "DCA (cm)"}; ConfigurableAxis axisXY{"axisXY", {120, -120.0f, 120.0f}, "XY axis"}; @@ -199,47 +172,30 @@ struct sigma0builder { ConfigurableAxis axisPA{"axisPA", {100, 0.0f, 1}, "Pointing angle"}; ConfigurableAxis axisRapidity{"axisRapidity", {100, -2.0f, 2.0f}, "Rapidity"}; ConfigurableAxis axisCandSel{"axisCandSel", {7, 0.5f, +7.5f}, "Candidate Selection"}; - ConfigurableAxis axisNch{"axisNch", {300, 0.0f, 3000.0f}, "N_{ch}"}; - ConfigurableAxis axisIRBinning{"axisIRBinning", {150, 0, 1500}, "Binning for the interaction rate (kHz)"}; + ConfigurableAxis axisIRBinning{"axisIRBinning", {151, -10, 1500}, "Binning for the interaction rate (kHz)"}; - int nSigmaCandidates = 0; void init(InitContext const&) { + LOGF(info, "Initializing now: cross-checking correctness..."); + if (doprocessRealData + + doprocessRealDataWithTOF + + doprocessMonteCarlo + + doprocessMonteCarloWithTOF > + 1) { + LOGF(fatal, "You have enabled more than one process function. Please check your configuration! Aborting now."); + } + // setting CCDB service ccdb->setURL("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); ccdb->setFatalWhenNull(false); - // Event Counters - histos.add("hEventSelection", "hEventSelection", kTH1D, {{21, -0.5f, +20.5f}}); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(1, "All collisions"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(2, "sel8 cut"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(3, "kIsTriggerTVX"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(4, "kNoITSROFrameBorder"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(5, "kNoTimeFrameBorder"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(6, "posZ cut"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(7, "kIsVertexITSTPC"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(8, "kIsGoodZvtxFT0vsPV"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(9, "kIsVertexTOFmatched"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(10, "kIsVertexTRDmatched"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(11, "kNoSameBunchPileup"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(12, "kNoCollInTimeRangeStd"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(13, "kNoCollInTimeRangeStrict"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(14, "kNoCollInTimeRangeNarrow"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(15, "kNoCollInRofStd"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(16, "kNoCollInRofStrict"); - if (doPPAnalysis) { - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(17, "INEL>0"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(18, "INEL>1"); - } else { - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(17, "Below min occup."); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(18, "Above max occup."); - } - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(19, "Below min IR"); - histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(20, "Above max IR"); - histos.add("hEventCentrality", "hEventCentrality", kTH1D, {axisCentrality}); + histos.add("PhotonSel/h2dMassGammaVsK0S", "h2dMassGammaVsK0S", kTH2D, {axisPhotonMass, axisK0SMass}); + histos.add("PhotonSel/h2dMassGammaVsLambda", "h2dMassGammaVsLambda", kTH2D, {axisPhotonMass, axisLambdaMass}); + histos.add("PhotonSel/h2dV0XY", "h2dV0XY", kTH2F, {axisXY, axisXY}); + histos.add("PhotonSel/hSelectionStatistics", "hSelectionStatistics", kTH1D, {axisCandSel}); histos.get(HIST("PhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(1, "No Sel"); histos.get(HIST("PhotonSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(2, "Photon Mass Cut"); @@ -258,6 +214,8 @@ struct sigma0builder { histos.add("PhotonSel/hPhotonRadius", "hPhotonRadius", kTH1F, {axisRadius}); histos.add("PhotonSel/h3dPhotonMass", "h3dPhotonMass", kTH3D, {axisCentrality, axisPt, axisPhotonMass}); + histos.add("LambdaSel/h2dMassLambdaVsK0S", "h2dMassLambdaVsK0S", kTH2D, {axisLambdaMass, axisK0SMass}); + histos.add("LambdaSel/h2dMassLambdaVsGamma", "h2dMassLambdaVsGamma", kTH2D, {axisLambdaMass, axisPhotonMass}); histos.add("LambdaSel/hSelectionStatistics", "hSelectionStatistics", kTH1D, {axisCandSel}); histos.get(HIST("LambdaSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(1, "No Sel"); histos.get(HIST("LambdaSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(2, "Lambda Mass Cut"); @@ -284,32 +242,9 @@ struct sigma0builder { histos.get(HIST("SigmaSel/hSelectionStatistics"))->GetXaxis()->SetBinLabel(3, "Sigma Y Window"); // For selection: - histos.add("SigmaSel/h3dMassSigma0BeforeSel", "h3dMassSigma0BeforeSel", kTH3F, {axisCentrality, axisPt, axisSigmaMass}); - histos.add("SigmaSel/hSigmaMass", "hSigmaMass", kTH1F, {axisSigmaMass}); - histos.add("SigmaSel/hSigmaMassWindow", "hSigmaMassWindow", kTH1F, {{200, -0.09f, 0.11f}}); - histos.add("SigmaSel/hSigmaY", "hSigmaY", kTH1F, {axisRapidity}); histos.add("SigmaSel/hSigmaMassSelected", "hSigmaMassSelected", kTH1F, {axisSigmaMass}); - histos.add("SigmaSel/h3dMassSigma0AfterSel", "h3dMassSigma0AfterSel", kTH3D, {axisCentrality, axisPt, axisSigmaMass}); - - if (fillQAhistos) { - histos.add("GeneralQA/h2dMassGammaVsK0S", "h2dMassGammaVsK0S", kTH2D, {axisPhotonMass, axisK0SMass}); - histos.add("GeneralQA/h2dMassLambdaVsK0S", "h2dMassLambdaVsK0S", kTH2D, {axisLambdaMass, axisK0SMass}); - histos.add("GeneralQA/h2dMassGammaVsLambda", "h2dMassGammaVsLambda", kTH2D, {axisPhotonMass, axisLambdaMass}); - histos.add("GeneralQA/h2dMassLambdaVsGamma", "h2dMassLambdaVsGamma", kTH2D, {axisLambdaMass, axisPhotonMass}); - histos.add("GeneralQA/h3dMassSigma0VsDaupTs", "h3dMassSigma0VsDaupTs", kTH3F, {axisPt, axisPt, axisSigmaMass}); - histos.add("GeneralQA/h2dMassGammaVsK0SAfterMassSel", "h2dMassGammaVsK0SAfterMassSel", kTH2D, {axisPhotonMass, axisK0SMass}); - histos.add("GeneralQA/h2dMassLambdaVsK0SAfterMassSel", "h2dMassLambdaVsK0SAfterMassSel", kTH2D, {axisLambdaMass, axisK0SMass}); - histos.add("GeneralQA/h2dMassGammaVsLambdaAfterMassSel", "h2dMassGammaVsLambdaAfterMassSel", kTH2D, {axisPhotonMass, axisLambdaMass}); - histos.add("GeneralQA/h2dV0XY", "h2dV0XY", kTH2F, {axisXY, axisXY}); - } - if (fGetIR) { - histos.add("GeneralQA/hRunNumberNegativeIR", "", kTH1D, {{1, 0., 1.}}); - histos.add("GeneralQA/hInteractionRate", "hInteractionRate", kTH1F, {axisIRBinning}); - histos.add("GeneralQA/hCentralityVsInteractionRate", "hCentralityVsInteractionRate", kTH2F, {axisCentrality, axisIRBinning}); - } - - if (doAssocStudy && doprocessMonteCarlo) { + if (doAssocStudy && (doprocessMonteCarlo || doprocessMonteCarloWithTOF)) { histos.add("V0AssoQA/h2dIRVsPt_TrueGamma", "h2dIRVsPt_TrueGamma", kTH2F, {axisIRBinning, axisPt}); histos.add("V0AssoQA/h3dPAVsIRVsPt_TrueGamma", "h3dPAVsIRVsPt_TrueGamma", kTH3F, {axisPA, axisIRBinning, axisPt}); histos.add("V0AssoQA/h2dIRVsPt_TrueGamma_BadCollAssig", "h2dIRVsPt_TrueGamma_BadCollAssig", kTH2F, {axisIRBinning, axisPt}); @@ -322,225 +257,236 @@ struct sigma0builder { } // MC - if (doprocessMonteCarlo) { - histos.add("MC/h2dPtVsCentralityBeforeSel_MCAssocGamma", "h2dPtVsCentralityBeforeSel_MCAssocGamma", kTH2D, {axisCentrality, axisPt}); - histos.add("MC/h2dPtVsCentralityBeforeSel_MCAssocLambda", "h2dPtVsCentralityBeforeSel_MCAssocLambda", kTH2D, {axisCentrality, axisPt}); - histos.add("MC/h2dPtVsCentralityBeforeSel_MCAssocALambda", "h2dPtVsCentralityBeforeSel_MCAssocALambda", kTH2D, {axisCentrality, axisPt}); - histos.add("MC/h2dPtVsCentralityBeforeSel_MCAssocSigma0", "h2dPtVsCentralityBeforeSel_MCAssocSigma0", kTH2D, {axisCentrality, axisPt}); - histos.add("MC/h2dPtVsCentralityBeforeSel_MCAssocASigma0", "h2dPtVsCentralityBeforeSel_MCAssocASigma0", kTH2D, {axisCentrality, axisPt}); - histos.add("MC/h2dSigma0PtVsLambdaPtBeforeSel_MCAssoc", "h2dSigma0PtVsLambdaPtBeforeSel_MCAssoc", kTH2D, {axisPt, axisPt}); - histos.add("MC/h2dSigma0PtVsGammaPtBeforeSel_MCAssoc", "h2dSigma0PtVsGammaPtBeforeSel_MCAssoc", kTH2D, {axisPt, axisPt}); - histos.add("MC/h2dPtVsCentralityAfterSel_MCAssocSigma0", "h2dPtVsCentralityAfterSel_MCAssocSigma0", kTH2D, {axisCentrality, axisPt}); - histos.add("MC/h2dPtVsCentralityAfterSel_MCAssocASigma0", "h2dPtVsCentralityAfterSel_MCAssocASigma0", kTH2D, {axisCentrality, axisPt}); + if (doprocessMonteCarlo || doprocessMonteCarloWithTOF) { histos.add("MC/h2dGammaXYConversion", "h2dGammaXYConversion", kTH2F, {axisXY, axisXY}); + histos.add("MC/h2dPtVsCentrality_MCAssocGamma", "h2dPtVsCentrality_MCAssocGamma", kTH2D, {axisCentrality, axisPt}); + histos.add("MC/h2dPtVsCentrality_MCAssocLambda", "h2dPtVsCentrality_MCAssocLambda", kTH2D, {axisCentrality, axisPt}); + histos.add("MC/h2dPtVsCentrality_MCAssocALambda", "h2dPtVsCentrality_MCAssocALambda", kTH2D, {axisCentrality, axisPt}); } - // For background decomposition - if (fillBkgQAhistos && doprocessMonteCarlo) { - histos.add("BkgStudy/h2dPtVsMassSigma_All", "h2dPtVsMassSigma_All", kTH2D, {axisPt, axisSigmaMass}); - histos.add("BkgStudy/h2dPtVsMassSigma_TrueDaughters", "h2dPtVsMassSigma_TrueDaughters", kTH2D, {axisPt, axisSigmaMass}); - histos.add("BkgStudy/h2dPtVsMassSigma_TrueGammaFakeLambda", "h2dPtVsMassSigma_TrueGammaFakeLambda", kTH2D, {axisPt, axisSigmaMass}); - histos.add("BkgStudy/h2dPtVsMassSigma_FakeGammaTrueLambda", "h2dPtVsMassSigma_FakeGammaTrueLambda", kTH2D, {axisPt, axisSigmaMass}); - histos.add("BkgStudy/h2dPtVsMassSigma_FakeDaughters", "h2dPtVsMassSigma_FakeDaughters", kTH2D, {axisPt, axisSigmaMass}); - histos.add("BkgStudy/h2dTrueDaughtersMatrix", "h2dTrueDaughtersMatrix", kTHnSparseD, {{10001, -5000.5f, +5000.5f}, {10001, -5000.5f, +5000.5f}}); - histos.add("BkgStudy/h2dTrueGammaFakeLambdaMatrix", "h2dTrueGammaFakeLambdaMatrix", kTHnSparseD, {{10001, -5000.5f, +5000.5f}, {10001, -5000.5f, +5000.5f}}); - histos.add("BkgStudy/h2dFakeGammaTrueLambdaMatrix", "h2dFakeGammaTrueLambdaMatrix", kTHnSparseD, {{10001, -5000.5f, +5000.5f}, {10001, -5000.5f, +5000.5f}}); - histos.add("BkgStudy/h2dFakeDaughtersMatrix", "h2dFakeDaughtersMatrix", kTHnSparseD, {{10001, -5000.5f, +5000.5f}, {10001, -5000.5f, +5000.5f}}); - } + if (doprocessGeneratedRun3 && genSelections.doQA) { - // For Pi0 QA - if (doPi0QA) { - histos.add("Pi0QA/h3dMassPi0BeforeSel_MCAssoc", "h3dMassPi0BeforeSel_MCAssoc", kTH3D, {axisCentrality, axisPt, axisPi0Mass}); - histos.add("Pi0QA/h3dMassPi0AfterSel_MCAssoc", "h3dMassPi0AfterSel_MCAssoc", kTH3D, {axisCentrality, axisPt, axisPi0Mass}); - histos.add("Pi0QA/h3dMassPi0BeforeSel_Candidates", "h3dMassPi0BeforeSel_Candidates", kTH3D, {axisCentrality, axisPt, axisPi0Mass}); - histos.add("Pi0QA/h3dMassPi0AfterSel_Candidates", "h3dMassPi0AfterSel_Candidates", kTH3D, {axisCentrality, axisPt, axisPi0Mass}); - } + // Pi0s + histos.add("GenQA/hGenPi0", "hGenPi0", kTH1D, {axisPt}); + + auto hPrimaryPi0s = histos.add("GenQA/hPrimaryPi0s", "hPrimaryPi0s", kTH1D, {{2, -0.5f, 1.5f}}); + hPrimaryPi0s->GetXaxis()->SetBinLabel(1, "All Pi0s"); + hPrimaryPi0s->GetXaxis()->SetBinLabel(2, "Primary Pi0s"); + + histos.add("GenQA/h2dPi0MCSourceVsPDGMother", "h2dPi0MCSourceVsPDGMother", kTHnSparseD, {{2, -0.5f, 1.5f}, {10001, -5000.5f, +5000.5f}}); + histos.add("GenQA/h2dPi0NDaughtersVsPDG", "h2dPi0NDaughtersVsPDG", kTHnSparseD, {{10, -0.5f, +9.5f}, {10001, -5000.5f, +5000.5f}}); + + auto h2DGenPi0TypeVsProducedByGen = histos.add("GenQA/h2DGenPi0TypeVsProducedByGen", "h2DGenPi0TypeVsProducedByGen", kTH2D, {{2, -0.5f, 1.5f}, {2, -0.5f, 1.5f}}); + h2DGenPi0TypeVsProducedByGen->GetXaxis()->SetBinLabel(1, "Sterile"); + h2DGenPi0TypeVsProducedByGen->GetXaxis()->SetBinLabel(2, "Non-Sterile"); + h2DGenPi0TypeVsProducedByGen->GetYaxis()->SetBinLabel(1, "Generator"); + h2DGenPi0TypeVsProducedByGen->GetYaxis()->SetBinLabel(2, "Transport"); + + // ______________________________________________________ + // Sigma0s + histos.add("GenQA/hGenSigma0", "hGenSigma0", kTH1D, {axisPt}); + histos.add("GenQA/hGenAntiSigma0", "hGenAntiSigma0", kTH1D, {axisPt}); + + histos.add("GenQA/h2dGenSigma0xy_Generator", "hGenSigma0xy_Generator", kTH2D, {axisXY, axisXY}); + histos.add("GenQA/h2dGenSigma0xy_Transport", "hGenSigma0xy_Transport", kTH2D, {axisXY, axisXY}); + histos.add("GenQA/hGenSigma0Radius_Generator", "hGenSigma0Radius_Generator", kTH1D, {axisRadius}); + histos.add("GenQA/hGenSigma0Radius_Transport", "hGenSigma0Radius_Transport", kTH1D, {axisRadius}); + + histos.add("GenQA/h2dSigma0MCSourceVsPDGMother", "h2dSigma0MCSourceVsPDGMother", kTHnSparseD, {{2, -0.5f, 1.5f}, {10001, -5000.5f, +5000.5f}}); + histos.add("GenQA/h2dSigma0NDaughtersVsPDG", "h2dSigma0NDaughtersVsPDG", kTHnSparseD, {{10, -0.5f, +9.5f}, {10001, -5000.5f, +5000.5f}}); + + auto hPrimarySigma0s = histos.add("GenQA/hPrimarySigma0s", "hPrimarySigma0s", kTH1D, {{2, -0.5f, 1.5f}}); + hPrimarySigma0s->GetXaxis()->SetBinLabel(1, "All Sigma0s"); + hPrimarySigma0s->GetXaxis()->SetBinLabel(2, "Primary Sigma0s"); + + auto hGenSpecies = histos.add("GenQA/hGenSpecies", "hGenSpecies", kTH1D, {{4, -0.5f, 3.5f}}); + hGenSpecies->GetXaxis()->SetBinLabel(1, "All Prim. Lambda"); + hGenSpecies->GetXaxis()->SetBinLabel(2, "All Prim. ALambda"); + hGenSpecies->GetXaxis()->SetBinLabel(5, "All Sigma0s"); + hGenSpecies->GetXaxis()->SetBinLabel(6, "All ASigma0s"); - if (doprocessGeneratedRun3) { - - histos.add("Gen/hGenEvents", "hGenEvents", kTH2F, {{axisNch}, {2, -0.5f, +1.5f}}); - histos.get(HIST("Gen/hGenEvents"))->GetYaxis()->SetBinLabel(1, "All gen. events"); - histos.get(HIST("Gen/hGenEvents"))->GetYaxis()->SetBinLabel(2, "Gen. with at least 1 rec. events"); - - histos.add("Gen/hGenEventCentrality", "hGenEventCentrality", kTH1F, {{101, 0.0f, 101.0f}}); - histos.add("Gen/hCentralityVsNcoll_beforeEvSel", "hCentralityVsNcoll_beforeEvSel", kTH2F, {axisCentrality, {50, -0.5f, 49.5f}}); - histos.add("Gen/hCentralityVsNcoll_afterEvSel", "hCentralityVsNcoll_afterEvSel", kTH2F, {axisCentrality, {50, -0.5f, 49.5f}}); - histos.add("Gen/hCentralityVsMultMC", "hCentralityVsMultMC", kTH2F, {{101, 0.0f, 101.0f}, axisNch}); - histos.add("Gen/h2dGenGamma", "h2dGenGamma", kTH2D, {axisCentrality, axisPt}); - histos.add("Gen/h2dGenLambda", "h2dGenLambda", kTH2D, {axisCentrality, axisPt}); - histos.add("Gen/h2dGenAntiLambda", "h2dGenAntiLambda", kTH2D, {axisCentrality, axisPt}); - histos.add("Gen/h2dGenGammaVsMultMC_RecoedEvt", "h2dGenGammaVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); - histos.add("Gen/h2dGenLambdaVsMultMC_RecoedEvt", "h2dGenLambdaVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); - histos.add("Gen/h2dGenAntiLambdaVsMultMC_RecoedEvt", "h2dGenAntiLambdaVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); - histos.add("Gen/h2dGenGammaVsMultMC", "h2dGenGammaVsMultMC", kTH2D, {axisNch, axisPt}); - histos.add("Gen/h2dGenLambdaVsMultMC", "h2dGenLambdaVsMultMC", kTH2D, {axisNch, axisPt}); - histos.add("Gen/h2dGenAntiLambdaVsMultMC", "h2dGenAntiLambdaVsMultMC", kTH2D, {axisNch, axisPt}); - histos.add("Gen/hEventPVzMC", "hEventPVzMC", kTH1F, {{100, -20.0f, +20.0f}}); - histos.add("Gen/hCentralityVsPVzMC", "hCentralityVsPVzMC", kTH2F, {{101, 0.0f, 101.0f}, {100, -20.0f, +20.0f}}); - - auto hPrimaryV0s = histos.add("Gen/hPrimaryV0s", "hPrimaryV0s", kTH1D, {{2, -0.5f, 1.5f}}); - hPrimaryV0s->GetXaxis()->SetBinLabel(1, "All V0s"); - hPrimaryV0s->GetXaxis()->SetBinLabel(2, "Primary V0s"); + histos.add("GenQA/hSigma0NDau", "hSigma0NDau", kTH1D, {{10, -0.5f, +9.5f}}); + histos.add("GenQA/h2dSigma0NDauVsProcess", "h2dSigma0NDauVsProcess", kTH2D, {{10, -0.5f, +9.5f}, {50, -0.5f, 49.5f}}); + + auto h2DGenSigma0TypeVsProducedByGen = histos.add("GenQA/h2DGenSigma0TypeVsProducedByGen", "h2DGenSigma0TypeVsProducedByGen", kTH2D, {{2, -0.5f, 1.5f}, {2, -0.5f, 1.5f}}); + h2DGenSigma0TypeVsProducedByGen->GetXaxis()->SetBinLabel(1, "Sterile"); + h2DGenSigma0TypeVsProducedByGen->GetXaxis()->SetBinLabel(2, "Non-Sterile"); + h2DGenSigma0TypeVsProducedByGen->GetYaxis()->SetBinLabel(1, "Generator"); + h2DGenSigma0TypeVsProducedByGen->GetYaxis()->SetBinLabel(2, "Transport"); } } - template - bool IsEventAccepted(TCollision const& collision, bool fillHists) - // check whether the collision passes our collision selections + // ______________________________________________________ + // Struct to store V0Pair properties + struct V0PairTopoInfo { + float X = -999.f; + float Y = -999.f; + float Z = -999.f; + float DCADau = -999.f; + float CosPA = -1.f; + }; + + // ______________________________________________________ + // Struct to store V0Pair MC properties + struct V0PairMCInfo { + bool fIsV01CorrectlyAssign = false; + bool fIsV02CorrectlyAssign = false; + bool fIsV01Primary = false; + bool fIsV02Primary = false; + bool fV0PairProducedByGenerator = false; + int V01PDGCode = 0; + int V02PDGCode = 0; + int V01PDGCodeMother = 0; + int V02PDGCodeMother = 0; + int V0PairPDGCode = 0; + int V0PairPDGCodeMother = 0; + int V0PairMCProcess = -1; + int V0PairMCParticleID = -1; + float V01MCpx = -999.f; + float V01MCpy = -999.f; + float V01MCpz = -999.f; + float V02MCpx = -999.f; + float V02MCpy = -999.f; + float V02MCpz = -999.f; + float V0PairMCRadius = -999.f; + }; + + // ______________________________________________________ + // Struct to store V0Pair Generated properties + struct V0PairGenInfo { + bool IsPrimary = false; + bool IsV0Lambda = false; + bool IsV0AntiLambda = false; + bool IsPi0 = false; + bool IsSigma0 = false; + bool IsAntiSigma0 = false; + bool IsProducedByGenerator = false; + bool IsSterile = false; + int MCProcess = -1; + int MCCollId = -1; + int PDGCodeMother = 0; + int NDaughters = -1; + float MCPt = -999.f; + float MCvx = 999.f; + float MCvy = 999.f; + }; + + template + V0PairTopoInfo propagateV0PairToDCA(TV01 const& v01, TV02 const& v02) { - if (fillHists) - histos.fill(HIST("hEventSelection"), 0. /* all collisions */); - if (eventSelections.requireSel8 && !collision.sel8()) { - return false; - } - if (fillHists) - histos.fill(HIST("hEventSelection"), 1 /* sel8 collisions */); - if (eventSelections.requireTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { - return false; - } - if (fillHists) - histos.fill(HIST("hEventSelection"), 2 /* FT0 vertex (acceptable FT0C-FT0A time difference) collisions */); - if (eventSelections.rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { - return false; - } - if (fillHists) - histos.fill(HIST("hEventSelection"), 3 /* Not at ITS ROF border */); - if (eventSelections.rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { - return false; - } - if (fillHists) - histos.fill(HIST("hEventSelection"), 4 /* Not at TF border */); - if (std::abs(collision.posZ()) > eventSelections.maxZVtxPosition) { - return false; - } - if (fillHists) - histos.fill(HIST("hEventSelection"), 5 /* vertex-Z selected */); - if (eventSelections.requireIsVertexITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { - return false; - } - if (fillHists) - histos.fill(HIST("hEventSelection"), 6 /* Contains at least one ITS-TPC track */); - if (eventSelections.requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { - return false; - } - if (fillHists) - histos.fill(HIST("hEventSelection"), 7 /* PV position consistency check */); - if (eventSelections.requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { - return false; - } - if (fillHists) - histos.fill(HIST("hEventSelection"), 8 /* PV with at least one contributor matched with TOF */); - if (eventSelections.requireIsVertexTRDmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { - return false; - } - if (fillHists) - histos.fill(HIST("hEventSelection"), 9 /* PV with at least one contributor matched with TRD */); - if (eventSelections.rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - return false; - } - if (fillHists) - histos.fill(HIST("hEventSelection"), 10 /* Not at same bunch pile-up */); - if (eventSelections.requireNoCollInTimeRangeStd && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { - return false; - } - if (fillHists) - histos.fill(HIST("hEventSelection"), 11 /* No other collision within +/- 2 microseconds or mult above a certain threshold in -4 - -2 microseconds*/); - if (eventSelections.requireNoCollInTimeRangeStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStrict)) { - return false; - } - if (fillHists) - histos.fill(HIST("hEventSelection"), 12 /* No other collision within +/- 10 microseconds */); - if (eventSelections.requireNoCollInTimeRangeNarrow && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) { - return false; - } - if (fillHists) - histos.fill(HIST("hEventSelection"), 13 /* No other collision within +/- 2 microseconds */); - if (eventSelections.requireNoCollInROFStd && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { - return false; - } - if (fillHists) - histos.fill(HIST("hEventSelection"), 14 /* No other collision within the same ITS ROF with mult. above a certain threshold */); - if (eventSelections.requireNoCollInROFStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStrict)) { - return false; - } - if (fillHists) - histos.fill(HIST("hEventSelection"), 15 /* No other collision within the same ITS ROF */); - if (doPPAnalysis) { // we are in pp - if (eventSelections.requireINEL0 && collision.multNTracksPVeta1() < 1) { - return false; - } - if (fillHists) - histos.fill(HIST("hEventSelection"), 16 /* INEL > 0 */); - if (eventSelections.requireINEL1 && collision.multNTracksPVeta1() < 2) { - return false; - } - if (fillHists) - histos.fill(HIST("hEventSelection"), 17 /* INEL > 1 */); - } else { // we are in Pb-Pb - float collisionOccupancy = eventSelections.useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); - if (eventSelections.minOccupancy >= 0 && collisionOccupancy < eventSelections.minOccupancy) { - return false; - } - if (fillHists) - histos.fill(HIST("hEventSelection"), 16 /* Below min occupancy */); - if (eventSelections.maxOccupancy >= 0 && collisionOccupancy > eventSelections.maxOccupancy) { - return false; - } - if (fillHists) - histos.fill(HIST("hEventSelection"), 17 /* Above max occupancy */); - } - // Fetch interaction rate only if required (in order to limit ccdb calls) - double interactionRate = (eventSelections.minIR >= 0 || eventSelections.maxIR >= 0) ? rateFetcher.fetch(ccdb.service, collision.timestamp(), collision.runNumber(), irSource, fIRCrashOnNull) * 1.e-3 : -1; - if (eventSelections.minIR >= 0 && interactionRate < eventSelections.minIR) { - return false; - } - if (fillHists) - histos.fill(HIST("hEventSelection"), 18 /* Below min IR */); + V0PairTopoInfo info; - if (eventSelections.maxIR >= 0 && interactionRate > eventSelections.maxIR) { - return false; + // Positions + ROOT::Math::XYZVector v01position(v01.x(), v01.y(), v01.z()); + ROOT::Math::XYZVector v02position(v02.x(), v02.y(), v02.z()); + + // Momenta + ROOT::Math::XYZVector v01momentum(v01.px(), v01.py(), v01.pz()); + ROOT::Math::XYZVector v02momentum(v02.px(), v02.py(), v02.pz()); + + // Momenta (normalized) + ROOT::Math::XYZVector v01momentumNorm(v01.px() / v01.p(), v01.py() / v01.p(), v01.pz() / v01.p()); + ROOT::Math::XYZVector v02momentumNorm(v02.px() / v02.p(), v02.py() / v02.p(), v02.pz() / v02.p()); + + // DCADau calculation (using full momenta for precision) + ROOT::Math::XYZVector posdiff = v02position - v01position; + ROOT::Math::XYZVector cross = v01momentum.Cross(v02momentum); + + float d = 1.0f - TMath::Power(v01momentumNorm.Dot(v02momentumNorm), 2); + float t = posdiff.Dot(v01momentumNorm - v01momentumNorm.Dot(v02momentumNorm) * v02momentumNorm) / d; + float s = -posdiff.Dot(v02momentumNorm - v01momentumNorm.Dot(v02momentumNorm) * v01momentumNorm) / d; + + ROOT::Math::XYZVector pointOn1 = v01position + t * v01momentumNorm; + ROOT::Math::XYZVector pointOn2 = v02position + s * v02momentumNorm; + ROOT::Math::XYZVector PCA = 0.5 * (pointOn1 + pointOn2); + + // Calculate properties and fill struct + info.DCADau = (cross.Mag2() > 0) ? std::abs(posdiff.Dot(cross)) / cross.R() : 999.f; + info.CosPA = v01momentumNorm.Dot(v02momentumNorm); + + if (d < 1e-5f) { // Parallel or nearly parallel lines + info.X = info.Y = info.Z = 0.f; // should we use another dummy value? Perhaps 999.f? + return info; } - if (fillHists) - histos.fill(HIST("hEventSelection"), 19 /* Above max IR */); - float centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); - histos.fill(HIST("hEventCentrality"), centrality); - return true; + info.X = PCA.X(); + info.Y = PCA.Y(); + info.Z = PCA.Z(); + + return info; } - void runBkgAnalysis(bool fIsSigma, bool fIsAntiSigma, int PhotonPDGCode, int PhotonPDGCodeMother, int LambdaPDGCode, int LambdaPDGCodeMother, float sigmapT, float sigmaMass) + template + V0PairMCInfo getV0PairMCInfo(TV01 const& v01, TV02 const& v02, TCollision const& collision, TMCParticles const& mcparticles) { - histos.fill(HIST("BkgStudy/h2dPtVsMassSigma_All"), sigmapT, sigmaMass); + V0PairMCInfo MCinfo; - // Real Gamma x Real Lambda - but not from the same sigma0/antisigma0! - if ((PhotonPDGCode == 22) && ((LambdaPDGCode == 3122) || (LambdaPDGCode == -3122)) && (!fIsSigma && !fIsAntiSigma)) { - histos.fill(HIST("BkgStudy/h2dPtVsMassSigma_TrueDaughters"), sigmapT, sigmaMass); - histos.fill(HIST("BkgStudy/h2dTrueDaughtersMatrix"), LambdaPDGCodeMother, PhotonPDGCodeMother); - } + if (!v01.has_v0MCCore() || !v02.has_v0MCCore()) + return MCinfo; - // Real Gamma x fake Lambda - if ((PhotonPDGCode == 22) && (LambdaPDGCode != 3122) && (LambdaPDGCode != -3122)) { - histos.fill(HIST("BkgStudy/h2dPtVsMassSigma_TrueGammaFakeLambda"), sigmapT, sigmaMass); - histos.fill(HIST("BkgStudy/h2dTrueGammaFakeLambdaMatrix"), LambdaPDGCodeMother, PhotonPDGCodeMother); - } + auto v01MC = v01.template v0MCCore_as>(); + auto v02MC = v02.template v0MCCore_as>(); - // Fake Gamma x Real Lambda - if ((PhotonPDGCode != 22) && ((LambdaPDGCode == 3122) || (LambdaPDGCode == -3122))) { - histos.fill(HIST("BkgStudy/h2dPtVsMassSigma_FakeGammaTrueLambda"), sigmapT, sigmaMass); - histos.fill(HIST("BkgStudy/h2dFakeGammaTrueLambdaMatrix"), LambdaPDGCodeMother, PhotonPDGCodeMother); + if (collision.has_straMCCollision()) { + auto MCCollision = collision.template straMCCollision_as>(); + MCinfo.fIsV01CorrectlyAssign = (v01MC.straMCCollisionId() == MCCollision.globalIndex()); + MCinfo.fIsV02CorrectlyAssign = (v02MC.straMCCollisionId() == MCCollision.globalIndex()); } - // Fake Gamma x Fake Lambda - if ((PhotonPDGCode != 22) && (LambdaPDGCode != 3122) && (LambdaPDGCode != -3122)) { - histos.fill(HIST("BkgStudy/h2dPtVsMassSigma_FakeDaughters"), sigmapT, sigmaMass); - histos.fill(HIST("BkgStudy/h2dFakeDaughtersMatrix"), LambdaPDGCodeMother, PhotonPDGCodeMother); + MCinfo.V01MCpx = v01MC.pxMC(); + MCinfo.V01MCpy = v01MC.pyMC(); + MCinfo.V01MCpz = v01MC.pzMC(); + MCinfo.V02MCpx = v02MC.pxMC(); + MCinfo.V02MCpy = v02MC.pyMC(); + MCinfo.V02MCpz = v02MC.pzMC(); + + // Get corresponding entries in MCParticles table + auto MCParticle_v01 = mcparticles.rawIteratorAt(v01MC.particleIdMC()); + auto MCParticle_v02 = mcparticles.rawIteratorAt(v02MC.particleIdMC()); + + // Get MC Mothers + auto const& MCMothersList_v01 = MCParticle_v01.template mothers_as(); + auto const& MCMothersList_v02 = MCParticle_v02.template mothers_as(); + + if (!MCMothersList_v01.empty() && !MCMothersList_v02.empty()) { // Are there mothers? + + auto const& MCMother_v01 = MCMothersList_v01.front(); // First mother + auto const& MCMother_v02 = MCMothersList_v02.front(); // First mother + + if (MCMother_v01.globalIndex() == MCMother_v02.globalIndex()) { // Is it the same mother? + + MCinfo.fV0PairProducedByGenerator = MCMother_v01.producedByGenerator(); + MCinfo.V0PairPDGCode = MCMother_v01.pdgCode(); + MCinfo.V0PairMCProcess = MCMother_v01.getProcess(); + MCinfo.V0PairMCParticleID = MCMother_v01.globalIndex(); + MCinfo.V0PairMCRadius = std::hypot(MCMother_v01.vx(), MCMother_v01.vy()); // production position radius + + auto const& v0pairmothers = MCMother_v01.template mothers_as(); // Get mothers + if (!v0pairmothers.empty()) { + auto& v0PairMother = v0pairmothers.front(); // V0Pair mother, V0s grandmother + MCinfo.V0PairPDGCodeMother = v0PairMother.pdgCode(); + } + } } + + MCinfo.fIsV01Primary = v01MC.isPhysicalPrimary(); + MCinfo.fIsV02Primary = v02MC.isPhysicalPrimary(); + MCinfo.V01PDGCode = v01MC.pdgCode(); + MCinfo.V02PDGCode = v02MC.pdgCode(); + MCinfo.V01PDGCodeMother = v01MC.pdgCodeMother(); + MCinfo.V02PDGCodeMother = v02MC.pdgCodeMother(); + + return MCinfo; } + // ______________________________________________________ + // MC-specific + // Analyze v0-to-collision association template - void analyzeV0CollAssoc(TCollision const& collision, TV0Object const& fullv0s, std::vector selV0Indices, float IR, bool isPhotonAnalysis) + void analyzeV0CollAssoc(TCollision const& collision, TV0Object const& fullv0s, std::vector selV0Indices, bool isPhotonAnalysis) { auto v0MCCollision = collision.template straMCCollision_as>(); + float IR = (fGetIR) ? rateFetcher.fetch(ccdb.service, collision.timestamp(), collision.runNumber(), irSource, fIRCrashOnNull) * 1.e-3 : -1; for (size_t i = 0; i < selV0Indices.size(); ++i) { auto v0 = fullv0s.rawIteratorAt(selV0Indices[i]); @@ -572,277 +518,179 @@ struct sigma0builder { } } - // ______________________________________________________ - // Simulated processing - // Return the list of indices to the recoed collision associated to a given MC collision. - template - std::vector getListOfRecoCollIndices(TMCollisions const& mcCollisions, TCollisions const& collisions) + template + V0PairGenInfo getV0PairGenInfo(TMCParticle const& mcParticle) { - std::vector listBestCollisionIdx(mcCollisions.size()); - for (auto const& mcCollision : mcCollisions) { - auto groupedCollisions = collisions.sliceBy(perMcCollision, mcCollision.globalIndex()); - int biggestNContribs = -1; - int bestCollisionIndex = -1; - for (auto const& collision : groupedCollisions) { - // consider event selections in the recoed <-> gen collision association, for the denominator (or numerator) of the efficiency (or signal loss)? - if (eventSelections.useEvtSelInDenomEff) { - if (!IsEventAccepted(collision, false)) { - continue; - } - } - // Find the collision with the biggest nbr of PV contributors - // Follows what was done here: https://github.com/AliceO2Group/O2Physics/blob/master/Common/TableProducer/mcCollsExtra.cxx#L93 - if (biggestNContribs < collision.multPVTotalContributors()) { - biggestNContribs = collision.multPVTotalContributors(); - bestCollisionIndex = collision.globalIndex(); - } + V0PairGenInfo GenInfo; // auxiliary struct to store info + + // Fill with properties + GenInfo.IsPrimary = mcParticle.isPhysicalPrimary(); + GenInfo.IsV0Lambda = mcParticle.pdgCode() == 3122; + GenInfo.IsV0AntiLambda = mcParticle.pdgCode() == -3122; + GenInfo.IsPi0 = mcParticle.pdgCode() == 111; + GenInfo.IsSigma0 = mcParticle.pdgCode() == 3212; + GenInfo.IsAntiSigma0 = mcParticle.pdgCode() == -3212; + GenInfo.IsProducedByGenerator = mcParticle.producedByGenerator(); + GenInfo.MCProcess = mcParticle.getProcess(); + GenInfo.MCPt = mcParticle.pt(); + GenInfo.MCvx = mcParticle.vx(); // production position X + GenInfo.MCvy = mcParticle.vy(); // production position Y + + if (mcParticle.has_mcCollision()) + GenInfo.MCCollId = mcParticle.mcCollisionId(); // save this reference, please + + // Checking decay mode if sigma0 + if (GenInfo.IsSigma0 || GenInfo.IsAntiSigma0 || GenInfo.IsPi0) { + + // This is a costly operation, so we do it only for pi0s and sigma0s + auto const& daughters = mcParticle.template daughters_as(); + GenInfo.NDaughters = daughters.size(); + GenInfo.IsSterile = daughters.size() == 0; + + auto const& GenMothersList = mcParticle.template mothers_as(); + GenInfo.PDGCodeMother = (!GenMothersList.empty()) ? GenMothersList.front().pdgCode() : 0; + + if ((GenInfo.IsSigma0 || GenInfo.IsAntiSigma0) && genSelections.doQA) { + histos.fill(HIST("GenQA/h2dSigma0MCSourceVsPDGMother"), GenInfo.IsProducedByGenerator, GenInfo.PDGCodeMother); + for (auto& daughter : daughters) // checking decay modes + histos.fill(HIST("GenQA/h2dSigma0NDaughtersVsPDG"), daughters.size(), daughter.pdgCode()); + } + + if (GenInfo.IsPi0 && genSelections.doQA) { + histos.fill(HIST("GenQA/h2dPi0MCSourceVsPDGMother"), GenInfo.IsProducedByGenerator, GenInfo.PDGCodeMother); + for (auto& daughter : daughters) // checking decay modes + histos.fill(HIST("GenQA/h2dPi0NDaughtersVsPDG"), daughters.size(), daughter.pdgCode()); } - listBestCollisionIdx[mcCollision.globalIndex()] = bestCollisionIndex; } - return listBestCollisionIdx; + return GenInfo; } // ______________________________________________________ - // Simulated processing - // Fill generated event information (for event loss/splitting estimation) - template - void fillGeneratedEventProperties(TMCCollisions const& mcCollisions, TCollisions const& collisions) + // Simulated processing (subscribes to MC information too) + void fillGenQAHistos(V0PairGenInfo const& GenInfo) { - std::vector listBestCollisionIdx(mcCollisions.size()); - for (auto const& mcCollision : mcCollisions) { - // Apply selections on MC collisions - if (eventSelections.applyZVtxSelOnMCPV && std::abs(mcCollision.posZ()) > eventSelections.maxZVtxPosition) { - continue; + if (GenInfo.IsPi0) { + histos.fill(HIST("GenQA/hGenPi0"), GenInfo.MCPt); + histos.fill(HIST("GenQA/hPrimaryPi0s"), 0); + if (GenInfo.IsPrimary) + histos.fill(HIST("GenQA/hPrimaryPi0s"), 1); + + if (GenInfo.IsSterile) { + if (GenInfo.IsProducedByGenerator) + histos.fill(HIST("GenQA/h2DGenPi0TypeVsProducedByGen"), 0, 0); + else + histos.fill(HIST("GenQA/h2DGenPi0TypeVsProducedByGen"), 0, 1); + } else { + if (GenInfo.IsProducedByGenerator) + histos.fill(HIST("GenQA/h2DGenPi0TypeVsProducedByGen"), 1, 0); + else + histos.fill(HIST("GenQA/h2DGenPi0TypeVsProducedByGen"), 1, 1); } - if (doPPAnalysis) { // we are in pp - if (eventSelections.requireINEL0 && mcCollision.multMCNParticlesEta10() < 1) { - continue; - } + } - if (eventSelections.requireINEL1 && mcCollision.multMCNParticlesEta10() < 2) { - continue; - } + if (GenInfo.IsV0Lambda && GenInfo.IsPrimary) + histos.fill(HIST("GenQA/hGenSpecies"), 0); + if (GenInfo.IsV0AntiLambda && GenInfo.IsPrimary) + histos.fill(HIST("GenQA/hGenSpecies"), 1); + + // Checking decay mode + if (GenInfo.IsSigma0 || GenInfo.IsAntiSigma0) { + histos.fill(HIST("GenQA/hSigma0NDau"), GenInfo.NDaughters); + histos.fill(HIST("GenQA/h2dSigma0NDauVsProcess"), GenInfo.NDaughters, GenInfo.MCProcess); + + const auto radius = std::hypot(GenInfo.MCvx, GenInfo.MCvy); + // Sigma0 XY and radius (separate histos for Gen/Transport) + if (GenInfo.IsProducedByGenerator) { + histos.fill(HIST("GenQA/h2dGenSigma0xy_Generator"), GenInfo.MCvx, GenInfo.MCvy); + histos.fill(HIST("GenQA/hGenSigma0Radius_Generator"), radius); + } else { + histos.fill(HIST("GenQA/h2dGenSigma0xy_Transport"), GenInfo.MCvx, GenInfo.MCvy); + histos.fill(HIST("GenQA/hGenSigma0Radius_Transport"), radius); } - histos.fill(HIST("Gen/hGenEvents"), mcCollision.multMCNParticlesEta05(), 0 /* all gen. events*/); - - auto groupedCollisions = collisions.sliceBy(perMcCollision, mcCollision.globalIndex()); - // Check if there is at least one of the reconstructed collisions associated to this MC collision - // If so, we consider it - bool atLeastOne = false; - int biggestNContribs = -1; - float centrality = 100.5f; - int nCollisions = 0; - for (auto const& collision : groupedCollisions) { - - if (!IsEventAccepted(collision, false)) { - continue; - } + // Sigma0 type vs origin (single 2D histo) + const int genIndex = GenInfo.IsProducedByGenerator ? 0 : 1; // 0 = Generator, 1 = Transport + const int typeIndex = GenInfo.IsSterile ? 0 : 1; // 0 = Sterile, 1 = Normal + histos.fill(HIST("GenQA/h2DGenSigma0TypeVsProducedByGen"), typeIndex, genIndex); - if (biggestNContribs < collision.multPVTotalContributors()) { - biggestNContribs = collision.multPVTotalContributors(); - centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); - } + // Fill histograms + if (GenInfo.IsSigma0) { + histos.fill(HIST("GenQA/hGenSpecies"), 2); + histos.fill(HIST("GenQA/hGenSigma0"), GenInfo.MCPt); - nCollisions++; - atLeastOne = true; + histos.fill(HIST("GenQA/hPrimarySigma0s"), 0); + if (GenInfo.IsPrimary) + histos.fill(HIST("GenQA/hPrimarySigma0s"), 1); } - - histos.fill(HIST("Gen/hCentralityVsNcoll_beforeEvSel"), centrality, groupedCollisions.size()); - histos.fill(HIST("Gen/hCentralityVsNcoll_afterEvSel"), centrality, nCollisions); - histos.fill(HIST("Gen/hCentralityVsMultMC"), centrality, mcCollision.multMCNParticlesEta05()); - histos.fill(HIST("Gen/hCentralityVsPVzMC"), centrality, mcCollision.posZ()); - histos.fill(HIST("Gen/hEventPVzMC"), mcCollision.posZ()); - - if (atLeastOne) { - histos.fill(HIST("Gen/hGenEvents"), mcCollision.multMCNParticlesEta05(), 1 /* at least 1 rec. event*/); - histos.fill(HIST("Gen/hGenEventCentrality"), centrality); + if (GenInfo.IsAntiSigma0) { + histos.fill(HIST("GenQA/hGenSpecies"), 3); + histos.fill(HIST("GenQA/hGenAntiSigma0"), GenInfo.MCPt); } } - return; } // ______________________________________________________ // Simulated processing (subscribes to MC information too) - template - void analyzeGeneratedV0s(TMCCollisions const& mcCollisions, TV0MCs const& V0MCCores, TCollisions const& collisions) + template + void genProcess(TMCParticles const& mcParticles) { - fillGeneratedEventProperties(mcCollisions, collisions); - std::vector listBestCollisionIdx = getListOfRecoCollIndices(mcCollisions, collisions); - for (auto const& v0MC : V0MCCores) { - if (!v0MC.has_straMCCollision()) - continue; - - histos.fill(HIST("Gen/hPrimaryV0s"), 0); - if (!v0MC.isPhysicalPrimary()) + for (auto& mcParticle : mcParticles) { + // Rapidity selection + if (TMath::Abs(mcParticle.y()) > genSelections.mc_rapidityWindow) continue; - histos.fill(HIST("Gen/hPrimaryV0s"), 1); - - // TODO: get generated sigma0s - - float ptmc = v0MC.ptMC(); - float ymc = 1e3; - if (v0MC.pdgCode() == 22) - ymc = RecoDecay::y(std::array{v0MC.pxMC(), v0MC.pyMC(), v0MC.pzMC()}, o2::constants::physics::MassGamma); - - else if (std::abs(v0MC.pdgCode()) == 3122) - ymc = v0MC.rapidityMC(1); - - if (std::abs(ymc) > V0Rapidity) - continue; - - auto mcCollision = v0MC.template straMCCollision_as>(); - if (eventSelections.applyZVtxSelOnMCPV && std::abs(mcCollision.posZ()) > eventSelections.maxZVtxPosition) { - continue; - } - if (doPPAnalysis) { // we are in pp - if (eventSelections.requireINEL0 && mcCollision.multMCNParticlesEta10() < 1) { - continue; - } - - if (eventSelections.requireINEL1 && mcCollision.multMCNParticlesEta10() < 2) { + // Selection on the source (generator/transport) + if (genSelections.mc_keepOnlyFromGenerator && !genSelections.mc_keepOnlyFromTransport) { + if (!mcParticle.producedByGenerator()) continue; - } } - float centrality = 100.5f; - if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) { - auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]); - centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); - - if (v0MC.pdgCode() == 22) { - histos.fill(HIST("Gen/h2dGenGammaVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); - } - if (v0MC.pdgCode() == 3122) { - histos.fill(HIST("Gen/h2dGenLambdaVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); - } - if (v0MC.pdgCode() == -3122) { - histos.fill(HIST("Gen/h2dGenAntiLambdaVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); - } - } - if (v0MC.pdgCode() == 22) { - histos.fill(HIST("Gen/h2dGenGamma"), centrality, ptmc); - histos.fill(HIST("Gen/h2dGenGammaVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); - } - if (v0MC.pdgCode() == 3122) { - histos.fill(HIST("Gen/h2dGenLambda"), centrality, ptmc); - histos.fill(HIST("Gen/h2dGenLambdaVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); - } - if (v0MC.pdgCode() == -3122) { - histos.fill(HIST("Gen/h2dGenAntiLambda"), centrality, ptmc); - histos.fill(HIST("Gen/h2dGenAntiLambdaVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + if (genSelections.mc_keepOnlyFromTransport && !genSelections.mc_keepOnlyFromGenerator) { + if (mcParticle.producedByGenerator()) + continue; } - } - } - template - void runPi0QA(TV0Object const& gamma1, TV0Object const& gamma2, TCollision collision) - { - // Check if both V0s are made of the same tracks - if (gamma1.posTrackExtraId() == gamma2.posTrackExtraId() || - gamma1.negTrackExtraId() == gamma2.negTrackExtraId()) { - return; - } + // MC Process selection + if ((genSelections.mc_selectMCProcess >= 0) && (genSelections.mc_selectMCProcess != mcParticle.getProcess())) + continue; - // Calculate pi0 properties - std::array pVecGamma1{gamma1.px(), gamma1.py(), gamma1.pz()}; - std::array pVecGamma2{gamma2.px(), gamma2.py(), gamma2.pz()}; - std::array arrpi0{pVecGamma1, pVecGamma2}; - float pi0Mass = RecoDecay::m(arrpi0, std::array{o2::constants::physics::MassPhoton, o2::constants::physics::MassPhoton}); - float pi0Pt = RecoDecay::pt(std::array{gamma1.px() + gamma2.px(), gamma1.py() + gamma2.py()}); - float pi0Y = RecoDecay::y(std::array{gamma1.px() + gamma2.px(), gamma1.py() + gamma2.py(), gamma1.pz() + gamma2.pz()}, o2::constants::physics::MassPi0); - float centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); + // Get generated particle info + auto MCGenInfo = getV0PairGenInfo(mcParticle); - // MC-specific variables - bool fIsPi0 = false, fIsMC = false; + // Fill QA histos + if (genSelections.doQA) + fillGenQAHistos(MCGenInfo); - // Check if MC data and populate fIsMC, fIsPi0 - if constexpr (requires { gamma1.motherMCPartId(); gamma2.motherMCPartId(); }) { - if (gamma1.has_v0MCCore() && gamma2.has_v0MCCore()) { - fIsMC = true; - auto gamma1MC = gamma1.template v0MCCore_as>(); - auto gamma2MC = gamma2.template v0MCCore_as>(); - - if (gamma1MC.pdgCode() == 22 && gamma2MC.pdgCode() == 22 && - gamma1MC.pdgCodeMother() == 111 && gamma2MC.pdgCodeMother() == 111 && - gamma1.motherMCPartId() == gamma2.motherMCPartId()) { - fIsPi0 = true; - histos.fill(HIST("Pi0QA/h3dMassPi0BeforeSel_MCAssoc"), centrality, pi0Pt, pi0Mass); - } + // Fill tables + // Pi0 + if (fillPi0Tables && MCGenInfo.IsPi0) { + pi0Gens(MCGenInfo.IsProducedByGenerator, MCGenInfo.MCPt); // optional table to store generated pi0 candidates. Be careful, this is a large table! + pi0GenCollRefs(MCGenInfo.MCCollId); // link to stramccollision table } - } - - histos.fill(HIST("Pi0QA/h3dMassPi0BeforeSel_Candidates"), centrality, pi0Pt, pi0Mass); - - // Photon-specific selections - auto posTrackGamma1 = gamma1.template posTrackExtra_as(); - auto negTrackGamma1 = gamma1.template negTrackExtra_as(); - auto posTrackGamma2 = gamma2.template posTrackExtra_as(); - auto negTrackGamma2 = gamma2.template negTrackExtra_as(); - - // Gamma1 Selection - bool passedTPCGamma1 = (TMath::Abs(posTrackGamma1.tpcNSigmaEl()) < Pi0PhotonMaxTPCNSigmas) || - (TMath::Abs(negTrackGamma1.tpcNSigmaEl()) < Pi0PhotonMaxTPCNSigmas); - - if (TMath::Abs(gamma1.mGamma()) > Pi0PhotonMaxMass || - gamma1.qtarm() >= Pi0PhotonMaxQt || - TMath::Abs(gamma1.alpha()) >= Pi0PhotonMaxAlpha || - TMath::Abs(gamma1.dcapostopv()) < Pi0PhotonMinDCADauToPv || - TMath::Abs(gamma1.dcanegtopv()) < Pi0PhotonMinDCADauToPv || - TMath::Abs(gamma1.dcaV0daughters()) > Pi0PhotonMaxDCAV0Dau || - TMath::Abs(gamma1.negativeeta()) >= Pi0PhotonMaxEta || - TMath::Abs(gamma1.positiveeta()) >= Pi0PhotonMaxEta || - gamma1.v0cosPA() <= Pi0PhotonMinV0cospa || - gamma1.v0radius() <= Pi0PhotonMinRadius || - gamma1.v0radius() >= Pi0PhotonMaxRadius || - posTrackGamma1.tpcCrossedRows() < Pi0PhotonMinTPCCrossedRows || - negTrackGamma1.tpcCrossedRows() < Pi0PhotonMinTPCCrossedRows || - !passedTPCGamma1) { - return; - } - // Gamma2 Selection - bool passedTPCGamma2 = (TMath::Abs(posTrackGamma2.tpcNSigmaEl()) < Pi0PhotonMaxTPCNSigmas) || - (TMath::Abs(negTrackGamma2.tpcNSigmaEl()) < Pi0PhotonMaxTPCNSigmas); - - if (TMath::Abs(gamma2.mGamma()) > Pi0PhotonMaxMass || - gamma2.qtarm() >= Pi0PhotonMaxQt || - TMath::Abs(gamma2.alpha()) >= Pi0PhotonMaxAlpha || - TMath::Abs(gamma2.dcapostopv()) < Pi0PhotonMinDCADauToPv || - TMath::Abs(gamma2.dcanegtopv()) < Pi0PhotonMinDCADauToPv || - TMath::Abs(gamma2.dcaV0daughters()) > Pi0PhotonMaxDCAV0Dau || - TMath::Abs(gamma2.negativeeta()) >= Pi0PhotonMaxEta || - TMath::Abs(gamma2.positiveeta()) >= Pi0PhotonMaxEta || - gamma2.v0cosPA() <= Pi0PhotonMinV0cospa || - gamma2.v0radius() <= Pi0PhotonMinRadius || - gamma2.v0radius() >= Pi0PhotonMaxRadius || - posTrackGamma2.tpcCrossedRows() < Pi0PhotonMinTPCCrossedRows || - negTrackGamma2.tpcCrossedRows() < Pi0PhotonMinTPCCrossedRows || - !passedTPCGamma2) { - return; - } - - // Pi0-specific selections: - if (TMath::Abs(pi0Y) > 0.5) { - return; + // Sigma0/ASigma0 + if (fillSigma0Tables && (MCGenInfo.IsSigma0 || MCGenInfo.IsAntiSigma0)) { + sigma0Gens(MCGenInfo.IsSigma0, MCGenInfo.IsProducedByGenerator, MCGenInfo.MCPt); + sigma0GenCollRefs(MCGenInfo.MCCollId); // link to stramccollision table + } } - - // Fill histograms - histos.fill(HIST("Pi0QA/h3dMassPi0AfterSel_Candidates"), centrality, pi0Pt, pi0Mass); - if (fIsMC && fIsPi0) - histos.fill(HIST("Pi0QA/h3dMassPi0AfterSel_MCAssoc"), centrality, pi0Pt, pi0Mass); } + //_______________________________________________ // Process photon candidate template - bool processPhotonCandidate(TV0Object const& gamma, TCollision collision) + bool processPhotonCandidate(TV0Object const& gamma, TCollision const& collision) { + // V0 type selection if (gamma.v0Type() == 0) return false; + float centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); + float PhotonY = RecoDecay::y(std::array{gamma.px(), gamma.py(), gamma.pz()}, o2::constants::physics::MassGamma); + histos.fill(HIST("PhotonSel/h2dMassGammaVsK0S"), gamma.mGamma(), gamma.mK0Short()); + histos.fill(HIST("PhotonSel/h2dMassGammaVsLambda"), gamma.mGamma(), gamma.mLambda()); + if (useMLScores) { - // Gamma selection: if (gamma.gammaBDTScore() <= Gamma_MLThreshold) return false; @@ -853,7 +701,6 @@ struct sigma0builder { histos.fill(HIST("PhotonSel/hPhotonMass"), gamma.mGamma()); if ((gamma.mGamma() < 0) || (gamma.mGamma() > PhotonMaxMass)) return false; - float PhotonY = RecoDecay::y(std::array{gamma.px(), gamma.py(), gamma.pz()}, o2::constants::physics::MassGamma); histos.fill(HIST("PhotonSel/hPhotonNegEta"), gamma.negativeeta()); histos.fill(HIST("PhotonSel/hPhotonPosEta"), gamma.positiveeta()); histos.fill(HIST("PhotonSel/hPhotonY"), PhotonY); @@ -875,18 +722,38 @@ struct sigma0builder { return false; histos.fill(HIST("PhotonSel/hSelectionStatistics"), 6.); } - float centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); + + histos.fill(HIST("PhotonSel/h2dV0XY"), gamma.x(), gamma.y()); histos.fill(HIST("PhotonSel/h3dPhotonMass"), centrality, gamma.pt(), gamma.mGamma()); + + //_______________________________________________ + // MC Processing + if constexpr (requires { gamma.motherMCPartId(); }) { + if (gamma.has_v0MCCore()) { + auto gammaMC = gamma.template v0MCCore_as>(); + if (gammaMC.pdgCode() == 22) { + histos.fill(HIST("MC/h2dGammaXYConversion"), gamma.x(), gamma.y()); + histos.fill(HIST("MC/h2dPtVsCentrality_MCAssocGamma"), centrality, gamma.pt()); + } + } + } + return true; } - // Process photon candidate + //_______________________________________________ + // Process lambda candidate template - bool processLambdaCandidate(TV0Object const& lambda, TCollision collision) + bool processLambdaCandidate(TV0Object const& lambda, TCollision const& collision) { + // V0 type selection if (lambda.v0Type() != 1) return false; + float centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); + histos.fill(HIST("LambdaSel/h2dMassLambdaVsK0S"), lambda.mLambda(), lambda.mK0Short()); + histos.fill(HIST("LambdaSel/h2dMassLambdaVsGamma"), lambda.mLambda(), lambda.mGamma()); + if (useMLScores) { if ((lambda.lambdaBDTScore() <= Lambda_MLThreshold) && (lambda.antiLambdaBDTScore() <= AntiLambda_MLThreshold)) return false; @@ -920,116 +787,152 @@ struct sigma0builder { histos.fill(HIST("LambdaSel/hSelectionStatistics"), 6.); } - float centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); histos.fill(HIST("LambdaSel/h3dLambdaMass"), centrality, lambda.pt(), lambda.mLambda()); histos.fill(HIST("LambdaSel/h3dALambdaMass"), centrality, lambda.pt(), lambda.mAntiLambda()); + //_______________________________________________ + // MC Processing (if available) + if constexpr (requires { lambda.motherMCPartId(); }) { + if (lambda.has_v0MCCore()) { + auto lambdaMC = lambda.template v0MCCore_as>(); + if (lambdaMC.pdgCode() == 3122) // Is Lambda + histos.fill(HIST("MC/h2dPtVsCentrality_MCAssocLambda"), centrality, lambda.pt()); + if (lambdaMC.pdgCode() == -3122) // Is AntiLambda + histos.fill(HIST("MC/h2dPtVsCentrality_MCAssocALambda"), centrality, lambda.pt()); + } + } + return true; } - /////////// - // Process sigma candidate and store properties in object - template - bool buildSigma0(TV0Object const& lambda, TV0Object const& gamma, TCollision collision) + + //_______________________________________________ + // Build pi0 candidate for QA + template + bool buildPi0(TV0Object const& gamma1, TV0Object const& gamma2, TCollision const& collision, TMCParticles const& mcparticles) { + //_______________________________________________ + // Check if both V0s are made of the same tracks + if (gamma1.posTrackExtraId() == gamma2.posTrackExtraId() || + gamma1.negTrackExtraId() == gamma2.negTrackExtraId()) { + return false; + } + + //_______________________________________________ + // Calculate pi0 properties + std::array pVecGamma1{gamma1.px(), gamma1.py(), gamma1.pz()}; + std::array pVecGamma2{gamma2.px(), gamma2.py(), gamma2.pz()}; + std::array arrpi0{pVecGamma1, pVecGamma2}; + float pi0Mass = RecoDecay::m(arrpi0, std::array{o2::constants::physics::MassPhoton, o2::constants::physics::MassPhoton}); + float pi0Y = RecoDecay::y(std::array{gamma1.px() + gamma2.px(), gamma1.py() + gamma2.py(), gamma1.pz() + gamma2.pz()}, o2::constants::physics::MassPi0); + + //_______________________________________________ + // Pi0-specific selections: + if (TMath::Abs(pi0Y) > Pi0MaxRap) + return false; + + if (TMath::Abs(pi0Mass - o2::constants::physics::MassPi0) > Pi0MassWindow) + return false; + + // Fill optional tables for QA + // Define the table! + auto posTrackGamma1 = gamma1.template posTrackExtra_as(); + auto negTrackGamma1 = gamma1.template negTrackExtra_as(); + auto posTrackGamma2 = gamma2.template posTrackExtra_as(); + auto negTrackGamma2 = gamma2.template negTrackExtra_as(); + + // Calculate Pi0 topological info + auto pi0TopoInfo = propagateV0PairToDCA(gamma1, gamma2); + + // Check if MC data and populate corresponding table + if constexpr (requires { gamma1.motherMCPartId(); gamma2.motherMCPartId(); }) { + auto pi0MCInfo = getV0PairMCInfo(gamma1, gamma2, collision, mcparticles); + + pi0coresmc(pi0MCInfo.V0PairMCRadius, pi0MCInfo.V0PairPDGCode, pi0MCInfo.V0PairPDGCodeMother, pi0MCInfo.V0PairMCProcess, pi0MCInfo.fV0PairProducedByGenerator, + pi0MCInfo.V01MCpx, pi0MCInfo.V01MCpy, pi0MCInfo.V01MCpz, + pi0MCInfo.fIsV01Primary, pi0MCInfo.V01PDGCode, pi0MCInfo.V01PDGCodeMother, pi0MCInfo.fIsV01CorrectlyAssign, + pi0MCInfo.V02MCpx, pi0MCInfo.V02MCpy, pi0MCInfo.V02MCpz, + pi0MCInfo.fIsV02Primary, pi0MCInfo.V02PDGCode, pi0MCInfo.V02PDGCodeMother, pi0MCInfo.fIsV02CorrectlyAssign); + } + + pi0cores(pi0TopoInfo.X, pi0TopoInfo.Y, pi0TopoInfo.Z, pi0TopoInfo.DCADau, pi0TopoInfo.CosPA, + gamma1.px(), gamma1.py(), gamma1.pz(), + gamma1.mGamma(), gamma1.qtarm(), gamma1.alpha(), gamma1.dcapostopv(), gamma1.dcanegtopv(), gamma1.dcaV0daughters(), + gamma1.negativeeta(), gamma1.positiveeta(), gamma1.v0cosPA(), gamma1.v0radius(), gamma1.z(), + posTrackGamma1.tpcCrossedRows(), negTrackGamma1.tpcCrossedRows(), posTrackGamma1.tpcNSigmaEl(), negTrackGamma1.tpcNSigmaEl(), gamma1.v0Type(), + gamma2.px(), gamma2.py(), gamma2.pz(), + gamma2.mGamma(), gamma2.qtarm(), gamma2.alpha(), gamma2.dcapostopv(), gamma2.dcanegtopv(), gamma2.dcaV0daughters(), + gamma2.negativeeta(), gamma2.positiveeta(), gamma2.v0cosPA(), gamma2.v0radius(), gamma2.z(), + posTrackGamma2.tpcCrossedRows(), negTrackGamma2.tpcCrossedRows(), posTrackGamma2.tpcNSigmaEl(), negTrackGamma2.tpcNSigmaEl(), gamma2.v0Type()); + + pi0coresRefs(collision.globalIndex()); + + return true; + } + + //_______________________________________________ + // Build sigma0 candidate + template + bool buildSigma0(TV0Object const& lambda, TV0Object const& gamma, TCollision const& collision, TMCParticles const& mcparticles) + { + //_______________________________________________ // Checking if both V0s are made of the very same tracks if (gamma.posTrackExtraId() == lambda.posTrackExtraId() || gamma.negTrackExtraId() == lambda.negTrackExtraId()) { return false; } - // Sigma0 candidate properties + //_______________________________________________ + // Sigma0 pre-selections std::array pVecPhotons{gamma.px(), gamma.py(), gamma.pz()}; std::array pVecLambda{lambda.px(), lambda.py(), lambda.pz()}; + auto arrMom = std::array{pVecPhotons, pVecLambda}; float sigmaMass = RecoDecay::m(arrMom, std::array{o2::constants::physics::MassPhoton, o2::constants::physics::MassLambda0}); - float sigmaY = RecoDecay::y(std::array{gamma.px() + lambda.px(), gamma.py() + lambda.py(), gamma.pz() + lambda.pz()}, o2::constants::physics::MassSigma0); - float SigmapT = RecoDecay::pt(array{gamma.px() + lambda.px(), gamma.py() + lambda.py()}); - float centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); + float sigmaY = -999.f; - // Before any selection - histos.fill(HIST("SigmaSel/h3dMassSigma0BeforeSel"), centrality, SigmapT, sigmaMass); + if constexpr (requires { gamma.pxMC(); lambda.pxMC(); }) // If MC + sigmaY = RecoDecay::y(std::array{gamma.pxMC() + lambda.pxMC(), gamma.pyMC() + lambda.pyMC(), gamma.pzMC() + lambda.pzMC()}, o2::constants::physics::MassSigma0); + else // If DATA + sigmaY = RecoDecay::y(std::array{gamma.px() + lambda.px(), gamma.py() + lambda.py(), gamma.pz() + lambda.pz()}, o2::constants::physics::MassSigma0); histos.fill(HIST("SigmaSel/hSelectionStatistics"), 1.); - histos.fill(HIST("SigmaSel/hSigmaMass"), sigmaMass); - histos.fill(HIST("SigmaSel/hSigmaMassWindow"), sigmaMass - 1.192642); - - if (fillQAhistos) { - histos.fill(HIST("GeneralQA/h2dMassGammaVsK0S"), gamma.mGamma(), gamma.mK0Short()); - histos.fill(HIST("GeneralQA/h2dMassLambdaVsK0S"), lambda.mLambda(), lambda.mK0Short()); - histos.fill(HIST("GeneralQA/h2dMassGammaVsLambda"), gamma.mGamma(), gamma.mLambda()); - histos.fill(HIST("GeneralQA/h2dMassLambdaVsGamma"), lambda.mLambda(), lambda.mGamma()); - histos.fill(HIST("GeneralQA/h3dMassSigma0VsDaupTs"), gamma.pt(), lambda.pt(), sigmaMass); - } - - if (TMath::Abs(sigmaMass - 1.192642) > Sigma0Window) + if (TMath::Abs(sigmaMass - o2::constants::physics::MassSigma0) > Sigma0Window) return false; - histos.fill(HIST("SigmaSel/hSigmaY"), sigmaY); histos.fill(HIST("SigmaSel/hSelectionStatistics"), 2.); - if (TMath::Abs(sigmaY) > SigmaMaxRap) return false; histos.fill(HIST("SigmaSel/hSigmaMassSelected"), sigmaMass); histos.fill(HIST("SigmaSel/hSelectionStatistics"), 3.); + //_______________________________________________ + // Calculate properties & Fill tables - if (fillQAhistos) { - histos.fill(HIST("GeneralQA/h2dMassGammaVsK0SAfterMassSel"), gamma.mGamma(), gamma.mK0Short()); - histos.fill(HIST("GeneralQA/h2dMassLambdaVsK0SAfterMassSel"), lambda.mLambda(), lambda.mK0Short()); - histos.fill(HIST("GeneralQA/h2dMassGammaVsLambdaAfterMassSel"), gamma.mGamma(), lambda.mLambda()); - histos.fill(HIST("GeneralQA/h2dV0XY"), gamma.x(), gamma.y()); - } + // Sigma0 topological info + auto sigma0TopoInfo = propagateV0PairToDCA(gamma, lambda); - histos.fill(HIST("SigmaSel/h3dMassSigma0AfterSel"), centrality, SigmapT, sigmaMass); + sigma0cores(sigma0TopoInfo.X, sigma0TopoInfo.Y, sigma0TopoInfo.Z, sigma0TopoInfo.DCADau, + gamma.px(), gamma.py(), gamma.pz(), gamma.mGamma(), lambda.px(), lambda.py(), lambda.pz(), lambda.mLambda(), lambda.mAntiLambda()); - return true; - } + // MC properties + if constexpr (requires { gamma.motherMCPartId(); lambda.motherMCPartId(); }) { + auto sigma0MCInfo = getV0PairMCInfo(gamma, lambda, collision, mcparticles); - // Fill tables with reconstructed sigma0 candidate - template - void fillTables(TV0Object const& lambda, TV0Object const& gamma, TCollision const& coll) - { - float GammaBDTScore = gamma.gammaBDTScore(); - float LambdaBDTScore = lambda.lambdaBDTScore(); - float AntiLambdaBDTScore = lambda.antiLambdaBDTScore(); + sigma0mccores(sigma0MCInfo.V0PairMCRadius, sigma0MCInfo.V0PairPDGCode, sigma0MCInfo.V0PairPDGCodeMother, sigma0MCInfo.V0PairMCProcess, sigma0MCInfo.fV0PairProducedByGenerator, + sigma0MCInfo.V01MCpx, sigma0MCInfo.V01MCpy, sigma0MCInfo.V01MCpz, + sigma0MCInfo.fIsV01Primary, sigma0MCInfo.V01PDGCode, sigma0MCInfo.V01PDGCodeMother, sigma0MCInfo.fIsV01CorrectlyAssign, + sigma0MCInfo.V02MCpx, sigma0MCInfo.V02MCpy, sigma0MCInfo.V02MCpz, + sigma0MCInfo.fIsV02Primary, sigma0MCInfo.V02PDGCode, sigma0MCInfo.V02PDGCodeMother, sigma0MCInfo.fIsV02CorrectlyAssign); + } + + // Sigma0s -> stracollisions link + sigma0CollRefs(collision.globalIndex()); - // Daughters related - /// Photon + //_______________________________________________ + // Photon extra properties auto posTrackGamma = gamma.template posTrackExtra_as(); auto negTrackGamma = gamma.template negTrackExtra_as(); - float fPhotonPt = gamma.pt(); - float fPhotonMass = gamma.mGamma(); - float fPhotonQt = gamma.qtarm(); - float fPhotonAlpha = gamma.alpha(); - float fPhotonRadius = gamma.v0radius(); - float fPhotonCosPA = gamma.v0cosPA(); - float fPhotonDCADau = gamma.dcaV0daughters(); - float fPhotonDCANegPV = gamma.dcanegtopv(); - float fPhotonDCAPosPV = gamma.dcapostopv(); - float fPhotonZconv = gamma.z(); - float fPhotonEta = gamma.eta(); - float fPhotonY = RecoDecay::y(std::array{gamma.px(), gamma.py(), gamma.pz()}, o2::constants::physics::MassGamma); - float fPhotonPhi = RecoDecay::phi(gamma.px(), gamma.py()); - float fPhotonPosTPCNSigmaEl = posTrackGamma.tpcNSigmaEl(); - float fPhotonNegTPCNSigmaEl = negTrackGamma.tpcNSigmaEl(); - float fPhotonPosTPCNSigmaPi = posTrackGamma.tpcNSigmaPi(); - float fPhotonNegTPCNSigmaPi = negTrackGamma.tpcNSigmaPi(); - uint8_t fPhotonPosTPCCrossedRows = posTrackGamma.tpcCrossedRows(); - uint8_t fPhotonNegTPCCrossedRows = negTrackGamma.tpcCrossedRows(); - float fPhotonPosPt = gamma.positivept(); - float fPhotonNegPt = gamma.negativept(); - float fPhotonPosEta = gamma.positiveeta(); - float fPhotonNegEta = gamma.negativeeta(); - float fPhotonPosY = RecoDecay::y(std::array{gamma.pxpos(), gamma.pypos(), gamma.pzpos()}, o2::constants::physics::MassElectron); - float fPhotonNegY = RecoDecay::y(std::array{gamma.pxneg(), gamma.pyneg(), gamma.pzneg()}, o2::constants::physics::MassElectron); - float fPhotonPsiPair = gamma.psipair(); - int fPhotonPosITSCls = posTrackGamma.itsNCls(); - int fPhotonNegITSCls = negTrackGamma.itsNCls(); - float fPhotonPosITSChi2PerNcl = posTrackGamma.itsChi2PerNcl(); - float fPhotonNegITSChi2PerNcl = negTrackGamma.itsChi2PerNcl(); - uint8_t fPhotonV0Type = gamma.v0Type(); - uint8_t fPhotonPosTrackCode = ((uint8_t(posTrackGamma.hasTPC()) << hasTPC) | (uint8_t(posTrackGamma.hasITSTracker()) << hasITSTracker) | (uint8_t(posTrackGamma.hasITSAfterburner()) << hasITSAfterburner) | @@ -1042,50 +945,16 @@ struct sigma0builder { (uint8_t(negTrackGamma.hasTRD()) << hasTRD) | (uint8_t(negTrackGamma.hasTOF()) << hasTOF)); - // Lambda + sigmaPhotonExtras(gamma.qtarm(), gamma.alpha(), gamma.v0cosPA(), gamma.dcaV0daughters(), gamma.dcanegtopv(), gamma.dcapostopv(), gamma.v0radius(), gamma.z(), + posTrackGamma.tpcNSigmaEl(), negTrackGamma.tpcNSigmaEl(), posTrackGamma.tpcCrossedRows(), negTrackGamma.tpcCrossedRows(), + gamma.positiveeta(), gamma.negativeeta(), gamma.psipair(), posTrackGamma.itsNCls(), negTrackGamma.itsNCls(), posTrackGamma.itsChi2PerNcl(), negTrackGamma.itsChi2PerNcl(), + fPhotonPosTrackCode, fPhotonNegTrackCode, gamma.v0Type()); + + //_______________________________________________ + // Lambda extra properties auto posTrackLambda = lambda.template posTrackExtra_as(); auto negTrackLambda = lambda.template negTrackExtra_as(); - float fLambdaPt = lambda.pt(); - float fLambdaMass = lambda.mLambda(); - float fAntiLambdaMass = lambda.mAntiLambda(); - float fLambdaQt = lambda.qtarm(); - float fLambdaAlpha = lambda.alpha(); - float fLambdaLifeTime = lambda.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * o2::constants::physics::MassLambda0; - float fLambdaRadius = lambda.v0radius(); - float fLambdaCosPA = lambda.v0cosPA(); - float fLambdaDCADau = lambda.dcaV0daughters(); - float fLambdaDCANegPV = lambda.dcanegtopv(); - float fLambdaDCAPosPV = lambda.dcapostopv(); - float fLambdaEta = lambda.eta(); - float fLambdaY = lambda.yLambda(); - float fLambdaPhi = RecoDecay::phi(lambda.px(), lambda.py()); - float fLambdaPosPrTPCNSigma = posTrackLambda.tpcNSigmaPr(); - float fLambdaPosPiTPCNSigma = posTrackLambda.tpcNSigmaPi(); - float fLambdaNegPrTPCNSigma = negTrackLambda.tpcNSigmaPr(); - float fLambdaNegPiTPCNSigma = negTrackLambda.tpcNSigmaPi(); - - float fLambdaPrTOFNSigma = lambda.tofNSigmaLaPr(); - float fLambdaPiTOFNSigma = lambda.tofNSigmaLaPi(); - float fALambdaPrTOFNSigma = lambda.tofNSigmaALaPr(); - float fALambdaPiTOFNSigma = lambda.tofNSigmaALaPi(); - - uint8_t fLambdaPosTPCCrossedRows = posTrackLambda.tpcCrossedRows(); - uint8_t fLambdaNegTPCCrossedRows = negTrackLambda.tpcCrossedRows(); - float fLambdaPosPt = lambda.positivept(); - float fLambdaNegPt = lambda.negativept(); - float fLambdaPosEta = lambda.positiveeta(); - float fLambdaNegEta = lambda.negativeeta(); - float fLambdaPosPrY = RecoDecay::y(std::array{lambda.pxpos(), lambda.pypos(), lambda.pzpos()}, o2::constants::physics::MassProton); - float fLambdaPosPiY = RecoDecay::y(std::array{lambda.pxpos(), lambda.pypos(), lambda.pzpos()}, o2::constants::physics::MassPionCharged); - float fLambdaNegPrY = RecoDecay::y(std::array{lambda.pxneg(), lambda.pyneg(), lambda.pzneg()}, o2::constants::physics::MassProton); - float fLambdaNegPiY = RecoDecay::y(std::array{lambda.pxneg(), lambda.pyneg(), lambda.pzneg()}, o2::constants::physics::MassPionCharged); - int fLambdaPosITSCls = posTrackLambda.itsNCls(); - int fLambdaNegITSCls = negTrackLambda.itsNCls(); - float fLambdaPosITSChi2PerNcl = posTrackLambda.itsChi2PerNcl(); - float fLambdaNegITSChi2PerNcl = negTrackLambda.itsChi2PerNcl(); - uint8_t fLambdaV0Type = lambda.v0Type(); - uint8_t fLambdaPosTrackCode = ((uint8_t(posTrackLambda.hasTPC()) << hasTPC) | (uint8_t(posTrackLambda.hasITSTracker()) << hasITSTracker) | (uint8_t(posTrackLambda.hasITSAfterburner()) << hasITSAfterburner) | @@ -1098,109 +967,62 @@ struct sigma0builder { (uint8_t(negTrackLambda.hasTRD()) << hasTRD) | (uint8_t(negTrackLambda.hasTOF()) << hasTOF)); - // Sigma0 candidate properties - std::array pVecPhotons{gamma.px(), gamma.py(), gamma.pz()}; - std::array pVecLambda{lambda.px(), lambda.py(), lambda.pz()}; - auto arrMom = std::array{pVecPhotons, pVecLambda}; - TVector3 v1(gamma.px(), gamma.py(), gamma.pz()); - TVector3 v2(lambda.px(), lambda.py(), lambda.pz()); - - // Sigma related - float fSigmapT = RecoDecay::pt(array{gamma.px() + lambda.px(), gamma.py() + lambda.py()}); - float fSigmaMass = RecoDecay::m(arrMom, std::array{o2::constants::physics::MassPhoton, o2::constants::physics::MassLambda0}); - float fSigmaRap = RecoDecay::y(std::array{gamma.px() + lambda.px(), gamma.py() + lambda.py(), gamma.pz() + lambda.pz()}, o2::constants::physics::MassSigma0); - float fSigmaOPAngle = v1.Angle(v2); - float fSigmaCentrality = doPPAnalysis ? coll.centFT0M() : coll.centFT0C(); - uint64_t fSigmaTimeStamp = coll.timestamp(); - int fSigmaRunNumber = coll.runNumber(); - - // Filling TTree for ML analysis - sigma0cores(fSigmapT, fSigmaMass, fSigmaRap, fSigmaOPAngle, fSigmaCentrality, fSigmaRunNumber, fSigmaTimeStamp); - - sigmaPhotonExtras(fPhotonPt, fPhotonMass, fPhotonQt, fPhotonAlpha, fPhotonRadius, - fPhotonCosPA, fPhotonDCADau, fPhotonDCANegPV, fPhotonDCAPosPV, fPhotonZconv, - fPhotonEta, fPhotonY, fPhotonPhi, fPhotonPosTPCNSigmaEl, fPhotonNegTPCNSigmaEl, fPhotonPosTPCNSigmaPi, fPhotonNegTPCNSigmaPi, fPhotonPosTPCCrossedRows, - fPhotonNegTPCCrossedRows, fPhotonPosPt, fPhotonNegPt, fPhotonPosEta, - fPhotonNegEta, fPhotonPosY, fPhotonNegY, fPhotonPsiPair, - fPhotonPosITSCls, fPhotonNegITSCls, fPhotonPosITSChi2PerNcl, fPhotonNegITSChi2PerNcl, fPhotonPosTrackCode, fPhotonNegTrackCode, - fPhotonV0Type, GammaBDTScore); - - sigmaLambdaExtras(fLambdaPt, fLambdaMass, fAntiLambdaMass, fLambdaQt, fLambdaAlpha, fLambdaLifeTime, - fLambdaRadius, fLambdaCosPA, fLambdaDCADau, fLambdaDCANegPV, - fLambdaDCAPosPV, fLambdaEta, fLambdaY, fLambdaPhi, fLambdaPosPrTPCNSigma, - fLambdaPosPiTPCNSigma, fLambdaNegPrTPCNSigma, fLambdaNegPiTPCNSigma, + float fLambdaLifeTime = lambda.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0; + float fLambdaPrTOFNSigma = -999.f; + float fLambdaPiTOFNSigma = -999.f; + float fALambdaPrTOFNSigma = -999.f; + float fALambdaPiTOFNSigma = -999.f; + + if constexpr (requires { lambda.tofNSigmaLaPr(); }) { // If TOF info avaiable + fLambdaPrTOFNSigma = lambda.tofNSigmaLaPr(); + fLambdaPiTOFNSigma = lambda.tofNSigmaLaPi(); + fALambdaPrTOFNSigma = lambda.tofNSigmaALaPr(); + fALambdaPiTOFNSigma = lambda.tofNSigmaALaPi(); + } + + sigmaLambdaExtras(lambda.qtarm(), lambda.alpha(), fLambdaLifeTime, lambda.v0radius(), lambda.v0cosPA(), lambda.dcaV0daughters(), lambda.dcanegtopv(), lambda.dcapostopv(), + posTrackLambda.tpcNSigmaPr(), posTrackLambda.tpcNSigmaPi(), negTrackLambda.tpcNSigmaPr(), negTrackLambda.tpcNSigmaPi(), fLambdaPrTOFNSigma, fLambdaPiTOFNSigma, fALambdaPrTOFNSigma, fALambdaPiTOFNSigma, - fLambdaPosTPCCrossedRows, fLambdaNegTPCCrossedRows, fLambdaPosPt, fLambdaNegPt, fLambdaPosEta, - fLambdaNegEta, fLambdaPosPrY, fLambdaPosPiY, fLambdaNegPrY, fLambdaNegPiY, - fLambdaPosITSCls, fLambdaNegITSCls, fLambdaPosITSChi2PerNcl, fLambdaNegITSChi2PerNcl, fLambdaPosTrackCode, fLambdaNegTrackCode, - fLambdaV0Type, LambdaBDTScore, AntiLambdaBDTScore); + posTrackLambda.tpcCrossedRows(), negTrackLambda.tpcCrossedRows(), + lambda.positiveeta(), lambda.negativeeta(), + posTrackLambda.itsNCls(), negTrackLambda.itsNCls(), posTrackLambda.itsChi2PerNcl(), negTrackLambda.itsChi2PerNcl(), + fLambdaPosTrackCode, fLambdaNegTrackCode, lambda.v0Type()); + + return true; } - void processMonteCarlo(soa::Join const& collisions, V0DerivedMCDatas const& fullV0s, dauTracks const&, aod::MotherMCParts const&, soa::Join const&, soa::Join const&) + // Process photon and lambda candidates to build sigma0 candidates + template + void dataProcess(TCollision const& collisions, TV0s const& fullV0s, TMCParticles const& mcparticles) { - // Initialize auxiliary vectors + //_______________________________________________ + // Initial setup + // Auxiliary vectors to store best candidates std::vector bestGammasArray; std::vector bestLambdasArray; - // brute force grouped index construction + // Custom grouping std::vector> v0grouped(collisions.size()); for (const auto& v0 : fullV0s) { v0grouped[v0.straCollisionId()].push_back(v0.globalIndex()); } + //_______________________________________________ + // Collisions loop for (const auto& coll : collisions) { // Clear vectors bestGammasArray.clear(); bestLambdasArray.clear(); - if (!IsEventAccepted(coll, true)) - continue; - float centrality = doPPAnalysis ? coll.centFT0M() : coll.centFT0C(); - - bool fhasMCColl = false; - if (coll.has_straMCCollision()) - fhasMCColl = true; - - //_______________________________________________ - // Retrieving IR info - float interactionRate = -1; - if (fGetIR) { - interactionRate = rateFetcher.fetch(ccdb.service, coll.timestamp(), coll.runNumber(), irSource, fIRCrashOnNull) * 1.e-3; - if (interactionRate < 0) - histos.get(HIST("GeneralQA/hRunNumberNegativeIR"))->Fill(Form("%d", coll.runNumber()), 1); - - histos.fill(HIST("GeneralQA/hInteractionRate"), interactionRate); - histos.fill(HIST("GeneralQA/hCentralityVsInteractionRate"), centrality, interactionRate); - } + histos.fill(HIST("hEventCentrality"), centrality); //_______________________________________________ // V0s loop for (size_t i = 0; i < v0grouped[coll.globalIndex()].size(); i++) { auto v0 = fullV0s.rawIteratorAt(v0grouped[coll.globalIndex()][i]); - if (!v0.has_v0MCCore()) - continue; - - auto v0MC = v0.v0MCCore_as>(); - - if (v0MC.pdgCode() == 22) { - histos.fill(HIST("MC/h2dGammaXYConversion"), v0.x(), v0.y()); - float GammaY = TMath::Abs(RecoDecay::y(std::array{v0.px(), v0.py(), v0.pz()}, o2::constants::physics::MassGamma)); - if (GammaY < 0.5) { // rapidity selection - histos.fill(HIST("MC/h2dPtVsCentralityBeforeSel_MCAssocGamma"), centrality, v0.pt()); // isgamma - } - } - - float lambdaY = TMath::Abs(RecoDecay::y(std::array{v0.px(), v0.py(), v0.pz()}, o2::constants::physics::MassLambda)); - if (lambdaY < 0.5) { - if (v0MC.pdgCode() == 3122) // Is Lambda - histos.fill(HIST("MC/h2dPtVsCentralityBeforeSel_MCAssocLambda"), centrality, v0.pt()); - if (v0MC.pdgCode() == -3122) // Is AntiLambda - histos.fill(HIST("MC/h2dPtVsCentralityBeforeSel_MCAssocALambda"), centrality, v0.pt()); - } - if (processPhotonCandidate(v0, coll)) // selecting photons bestGammasArray.push_back(v0.globalIndex()); // Save indices of best gamma candidates @@ -1209,117 +1031,41 @@ struct sigma0builder { } //_______________________________________________ - // Pi0 optional loop - if (doPi0QA) { - for (size_t i = 0; i < bestGammasArray.size(); ++i) { - auto gamma1 = fullV0s.rawIteratorAt(bestGammasArray[i]); - for (size_t j = i + 1; j < bestGammasArray.size(); ++j) { - auto gamma2 = fullV0s.rawIteratorAt(bestGammasArray[j]); - runPi0QA(gamma1, gamma2, coll); - } + // Wrongly collision association study (MC-specific) + if constexpr (requires { coll.StraMCCollisionId(); }) { + if (doAssocStudy) { + analyzeV0CollAssoc(coll, fullV0s, bestGammasArray, true); // Photon-analysis + analyzeV0CollAssoc(coll, fullV0s, bestLambdasArray, false); // Lambda-analysis } } //_______________________________________________ - // Wrongly collision association study - if (doAssocStudy && fhasMCColl) { - analyzeV0CollAssoc(coll, fullV0s, bestGammasArray, interactionRate, true); // Gamma - analyzeV0CollAssoc(coll, fullV0s, bestLambdasArray, interactionRate, false); // Lambda - } - - //_______________________________________________ - // Sigma0 loop + // V0 nested loop for (size_t i = 0; i < bestGammasArray.size(); ++i) { - auto gamma = fullV0s.rawIteratorAt(bestGammasArray[i]); - - if (!gamma.has_v0MCCore()) - continue; + auto gamma1 = fullV0s.rawIteratorAt(bestGammasArray[i]); - auto gammaMC = gamma.v0MCCore_as>(); + //_______________________________________________ + // Sigma0 loop + if (fillSigma0Tables) { + for (size_t j = 0; j < bestLambdasArray.size(); ++j) { + auto lambda = fullV0s.rawIteratorAt(bestLambdasArray[j]); - bool fIsPhotonCorrectlyAssign = false; - if (fhasMCColl) { - auto gammaMCCollision = coll.template straMCCollision_as>(); - fIsPhotonCorrectlyAssign = (gammaMC.straMCCollisionId() == gammaMCCollision.globalIndex()); - } - - for (size_t j = 0; j < bestLambdasArray.size(); ++j) { - auto lambda = fullV0s.rawIteratorAt(bestLambdasArray[j]); - - if (!lambda.has_v0MCCore()) - continue; - - auto lambdaMC = lambda.v0MCCore_as>(); - - // Sigma0 candidate properties - std::array pVecPhotons{gamma.px(), gamma.py(), gamma.pz()}; - std::array pVecLambda{lambda.px(), lambda.py(), lambda.pz()}; - auto arrMom = std::array{pVecPhotons, pVecLambda}; - float SigmaMass = RecoDecay::m(arrMom, std::array{o2::constants::physics::MassPhoton, o2::constants::physics::MassLambda0}); - float SigmapT = RecoDecay::pt(array{gamma.px() + lambda.px(), gamma.py() + lambda.py()}); - float SigmaY = TMath::Abs(RecoDecay::y(std::array{gamma.px() + lambda.px(), gamma.py() + lambda.py(), gamma.pz() + lambda.pz()}, o2::constants::physics::MassSigma0)); - - // MC properties - bool fIsSigma = false; - bool fIsAntiSigma = false; - bool fIsPhotonPrimary = gammaMC.isPhysicalPrimary(); - bool fIsLambdaPrimary = lambdaMC.isPhysicalPrimary(); - bool fIsLambdaCorrectlyAssign = false; - - int PhotonCandPDGCode = gammaMC.pdgCode(); - int PhotonCandPDGCodeMother = gammaMC.pdgCodeMother(); - int LambdaCandPDGCode = lambdaMC.pdgCode(); - int LambdaCandPDGCodeMother = lambdaMC.pdgCodeMother(); - - float SigmaMCpT = RecoDecay::pt(array{gammaMC.pxMC() + lambdaMC.pxMC(), gammaMC.pyMC() + lambdaMC.pyMC()}); - float PhotonMCpT = RecoDecay::pt(array{gammaMC.pxMC(), gammaMC.pyMC()}); - float LambdaMCpT = RecoDecay::pt(array{lambdaMC.pxMC(), lambdaMC.pyMC()}); - - if (fhasMCColl) { - auto lambdaMCCollision = coll.template straMCCollision_as>(); - fIsLambdaCorrectlyAssign = (lambdaMC.straMCCollisionId() == lambdaMCCollision.globalIndex()); - } - - if ((PhotonCandPDGCode == 22) && (PhotonCandPDGCodeMother == 3212) && (LambdaCandPDGCode == 3122) && (LambdaCandPDGCodeMother == 3212) && (gamma.motherMCPartId() == lambda.motherMCPartId())) - fIsSigma = true; - if ((PhotonCandPDGCode == 22) && (PhotonCandPDGCodeMother == -3212) && (LambdaCandPDGCode == -3122) && (LambdaCandPDGCodeMother == -3212) && (gamma.motherMCPartId() == lambda.motherMCPartId())) - fIsAntiSigma = true; - - if (SigmaY < 0.5) { - if (fIsSigma) { - histos.fill(HIST("MC/h2dPtVsCentralityBeforeSel_MCAssocSigma0"), centrality, SigmaMCpT); - histos.fill(HIST("MC/h2dSigma0PtVsLambdaPtBeforeSel_MCAssoc"), SigmaMCpT, LambdaMCpT); - histos.fill(HIST("MC/h2dSigma0PtVsGammaPtBeforeSel_MCAssoc"), SigmaMCpT, PhotonMCpT); - } - if (fIsAntiSigma) - histos.fill(HIST("MC/h2dPtVsCentralityBeforeSel_MCAssocASigma0"), centrality, SigmaMCpT); + // Building sigma0 candidate & filling tables + if (!buildSigma0(lambda, gamma1, coll, mcparticles)) + continue; } + } - // Build sigma0 candidate, please - if (!buildSigma0(lambda, gamma, coll)) - continue; + //_______________________________________________ + // pi0 loop + if (fillPi0Tables) { + for (size_t j = i + 1; j < bestGammasArray.size(); ++j) { + auto gamma2 = fullV0s.rawIteratorAt(bestGammasArray[j]); - if (SigmaY < 0.5) { - if (fIsSigma) - histos.fill(HIST("MC/h2dPtVsCentralityAfterSel_MCAssocSigma0"), centrality, SigmaMCpT); - if (fIsAntiSigma) - histos.fill(HIST("MC/h2dPtVsCentralityAfterSel_MCAssocASigma0"), centrality, SigmaMCpT); + // Building pi0 candidate & filling tables + if (!buildPi0(gamma1, gamma2, coll, mcparticles)) + continue; } - - if (fillBkgQAhistos) - runBkgAnalysis(fIsSigma, fIsAntiSigma, PhotonCandPDGCode, PhotonCandPDGCodeMother, LambdaCandPDGCode, LambdaCandPDGCodeMother, SigmapT, SigmaMass); - - // Fill Tables please - sigma0mccores(fIsSigma, fIsAntiSigma, SigmaMCpT, - PhotonCandPDGCode, PhotonCandPDGCodeMother, fIsPhotonPrimary, PhotonMCpT, fIsPhotonCorrectlyAssign, - LambdaCandPDGCode, LambdaCandPDGCodeMother, fIsLambdaPrimary, LambdaMCpT, fIsLambdaCorrectlyAssign); - - // Filling tables with accepted candidates - fillTables(lambda, gamma, coll); - - nSigmaCandidates++; - if (nSigmaCandidates % 10000 == 0) - LOG(info) << "Sigma0 Candidates built: " << nSigmaCandidates; } } } @@ -1327,94 +1073,35 @@ struct sigma0builder { void processRealData(soa::Join const& collisions, V0StandardDerivedDatas const& fullV0s, dauTracks const&) { - // Initialize auxiliary vectors - std::vector bestGammasArray; - std::vector bestLambdasArray; - - // brute force grouped index construction - std::vector> v0grouped(collisions.size()); - - for (const auto& v0 : fullV0s) { - v0grouped[v0.straCollisionId()].push_back(v0.globalIndex()); - } - - for (const auto& coll : collisions) { - // Clear vectors - bestGammasArray.clear(); - bestLambdasArray.clear(); - - if (!IsEventAccepted(coll, true)) - continue; - - float centrality = doPPAnalysis ? coll.centFT0M() : coll.centFT0C(); - - //_______________________________________________ - // Retrieving IR info - float interactionRate = -1; - if (fGetIR) { - interactionRate = rateFetcher.fetch(ccdb.service, coll.timestamp(), coll.runNumber(), irSource, fIRCrashOnNull) * 1.e-3; - if (interactionRate < 0) - histos.get(HIST("GeneralQA/hRunNumberNegativeIR"))->Fill(Form("%d", coll.runNumber()), 1); - - histos.fill(HIST("GeneralQA/hInteractionRate"), interactionRate); - histos.fill(HIST("GeneralQA/hCentralityVsInteractionRate"), centrality, interactionRate); - } - - //_______________________________________________ - // V0s loop - for (size_t i = 0; i < v0grouped[coll.globalIndex()].size(); i++) { - auto v0 = fullV0s.rawIteratorAt(v0grouped[coll.globalIndex()][i]); - if (processPhotonCandidate(v0, coll)) // selecting photons - bestGammasArray.push_back(v0.globalIndex()); // Save indices of best gamma candidates - - if (processLambdaCandidate(v0, coll)) // selecting lambdas - bestLambdasArray.push_back(v0.globalIndex()); // Save indices of best lambda candidates - } - - //_______________________________________________ - // Pi0 optional loop - if (doPi0QA) { - for (size_t i = 0; i < bestGammasArray.size(); ++i) { - auto gamma1 = fullV0s.rawIteratorAt(bestGammasArray[i]); - for (size_t j = i + 1; j < bestGammasArray.size(); ++j) { - auto gamma2 = fullV0s.rawIteratorAt(bestGammasArray[j]); - runPi0QA(gamma1, gamma2, coll); - } - } - } - - //_______________________________________________ - // Sigma0 nested loop - for (size_t i = 0; i < bestGammasArray.size(); ++i) { - auto gamma = fullV0s.rawIteratorAt(bestGammasArray[i]); - - for (size_t j = 0; j < bestLambdasArray.size(); ++j) { - auto lambda = fullV0s.rawIteratorAt(bestLambdasArray[j]); + dataProcess(collisions, fullV0s, nullptr); + } - // Building sigma0 candidate - if (!buildSigma0(lambda, gamma, coll)) - continue; + void processRealDataWithTOF(soa::Join const& collisions, V0TOFStandardDerivedDatas const& fullV0s, dauTracks const&) + { + dataProcess(collisions, fullV0s, nullptr); + } - // Filling tables with accepted candidates - fillTables(lambda, gamma, coll); + void processMonteCarlo(soa::Join const& collisions, V0DerivedMCDatas const& fullV0s, aod::McParticles const& mcParticles, dauTracks const&, aod::MotherMCParts const&, soa::Join const&, soa::Join const&) + { + dataProcess(collisions, fullV0s, mcParticles); + } - nSigmaCandidates++; - if (nSigmaCandidates % 10000 == 0) - LOG(info) << "Sigma0 Candidates built: " << nSigmaCandidates; - } - } - } + void processMonteCarloWithTOF(soa::Join const& collisions, V0TOFDerivedMCDatas const& fullV0s, aod::McParticles const& mcParticles, dauTracks const&, aod::MotherMCParts const&, soa::Join const&, soa::Join const&) + { + dataProcess(collisions, fullV0s, mcParticles); } - // Simulated processing in Run 3 (subscribes to MC information too) - void processGeneratedRun3(soa::Join const& mcCollisions, soa::Join const& V0MCCores, soa::Join const& collisions) + // Simulated processing in Run 3 - run this over original AO2Ds + void processGeneratedRun3(aod::McParticles const& mcParticles) { - analyzeGeneratedV0s(mcCollisions, V0MCCores, collisions); + genProcess(mcParticles); } - PROCESS_SWITCH(sigma0builder, processMonteCarlo, "process as if MC data", false); PROCESS_SWITCH(sigma0builder, processRealData, "process as if real data", true); - PROCESS_SWITCH(sigma0builder, processGeneratedRun3, "process generated MC collisions", false); + PROCESS_SWITCH(sigma0builder, processRealDataWithTOF, "process as if real data", false); + PROCESS_SWITCH(sigma0builder, processMonteCarlo, "process as if MC data", false); + PROCESS_SWITCH(sigma0builder, processMonteCarloWithTOF, "process as if MC data, uses TOF PID info", false); + PROCESS_SWITCH(sigma0builder, processGeneratedRun3, "process generated MC info", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGLF/TableProducer/Strangeness/strangenessbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangenessbuilder.cxx index d7012626b4f..b4b2d393ec2 100644 --- a/PWGLF/TableProducer/Strangeness/strangenessbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenessbuilder.cxx @@ -644,6 +644,7 @@ struct StrangenessBuilder { histos.add("DeduplicationQA/hBestPA", "hBestPA", kTH1F, {{200, 0.0f, 0.4f}}); histos.add("DeduplicationQA/hBestDCADau", "hBestDCADau", kTH1F, {{200, -10.0f, 10.0f}}); histos.add("DeduplicationQA/hBestMLScore", "hBestMLScore", kTH1F, {{200, 0.0f, 1.0f}}); + histos.add("DeduplicationQA/hPAOfBestMLScore", "hPAOfBestMLScore", kTH1F, {{200, 0.0f, 0.4f}}); } auto hPrimaryV0s = histos.add("hPrimaryV0s", "hPrimaryV0s", kTH1D, {{2, -0.5f, 1.5f}}); @@ -1001,8 +1002,10 @@ struct StrangenessBuilder { V0DuplicateExtras[bestPointingAngleIndex].isBestPA = true; if (bestDCADaughtersIndex != static_cast(-1)) V0DuplicateExtras[bestDCADaughtersIndex].isBestDCADau = true; - if (bestMLScoreIndex != static_cast(-1)) + if (bestMLScoreIndex != static_cast(-1)) { V0DuplicateExtras[bestMLScoreIndex].isBestMLScore = true; + histos.fill(HIST("DeduplicationQA/hPAOfBestMLScore"), V0DuplicateExtras[bestMLScoreIndex].PA); + } // return vector with duplicates info return V0DuplicateExtras; diff --git a/PWGLF/Tasks/Strangeness/sigmaanalysis.cxx b/PWGLF/Tasks/Strangeness/sigmaanalysis.cxx index c01a0a71cae..6f94ba4dd67 100644 --- a/PWGLF/Tasks/Strangeness/sigmaanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/sigmaanalysis.cxx @@ -19,45 +19,50 @@ // gianni.shigeru.setoue.liveraro@cern.ch // -#include -#include -#include -#include -#include -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/ASoA.h" -#include "ReconstructionDataFormats/Track.h" +#include "PWGLF/DataModel/LFSigmaTables.h" +#include "PWGLF/DataModel/LFStrangenessMLTables.h" +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" + +#include "Common/CCDB/ctpRateFetcher.h" #include "Common/Core/RecoDecay.h" -#include "Common/Core/trackUtilities.h" #include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/EventSelection.h" +#include "Common/Core/trackUtilities.h" #include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" #include "Common/DataModel/PIDResponse.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/DataModel/LFStrangenessPIDTables.h" -#include "PWGLF/DataModel/LFStrangenessMLTables.h" -#include "PWGLF/DataModel/LFSigmaTables.h" +#include "Common/DataModel/TrackSelectionTables.h" + #include "CCDB/BasicCCDBManager.h" +#include "Framework/ASoA.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" + +#include +#include #include #include -#include #include #include -#include +#include + +#include +#include +#include +#include using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; using std::array; -using V0MCSigmas = soa::Join; -using V0Sigmas = soa::Join; +using MCSigma0s = soa::Join; +using Sigma0s = soa::Join; -static const std::vector PhotonSels = {"NoSel", "V0Type", "DaupT", "DCADauToPV", +static const std::vector PhotonSels = {"NoSel", "V0Type", "DCADauToPV", "DCADau", "DauTPCCR", "TPCNSigmaEl", "V0pT", "Y", "V0Radius", "RZCut", "Armenteros", "CosPA", "PsiPair", "Phi", "Mass"}; @@ -69,77 +74,139 @@ static const std::vector LambdaSels = {"NoSel", "V0Radius", "DCADau static const std::vector DirList = {"BeforeSel", "AfterSel"}; struct sigmaanalysis { + Service ccdb; + ctpRateFetcher rateFetcher; + + //__________________________________________________ + // For manual sliceBy + // SliceCache cache; + PresliceUnsorted> perMcCollision = aod::v0data::straMCCollisionId; + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - Configurable fillQAhistos{"fillQAhistos", false, "if true, fill QA histograms"}; + // Event level + Configurable doPPAnalysis{"doPPAnalysis", true, "if in pp, set to true"}; + Configurable fGetIR{"fGetIR", false, "Flag to retrieve the IR info."}; + Configurable fIRCrashOnNull{"fIRCrashOnNull", false, "Flag to avoid CTP RateFetcher crash."}; + Configurable irSource{"irSource", "T0VTX", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"}; + + struct : ConfigurableGroup { + Configurable requireSel8{"requireSel8", true, "require sel8 event selection"}; + Configurable requireTriggerTVX{"requireTriggerTVX", true, "require FT0 vertex (acceptable FT0C-FT0A time difference) at trigger level"}; + Configurable rejectITSROFBorder{"rejectITSROFBorder", true, "reject events at ITS ROF border"}; + Configurable rejectTFBorder{"rejectTFBorder", true, "reject events at TF border"}; + Configurable requireIsVertexITSTPC{"requireIsVertexITSTPC", true, "require events with at least one ITS-TPC track"}; + Configurable requireIsGoodZvtxFT0VsPV{"requireIsGoodZvtxFT0VsPV", true, "require events with PV position along z consistent (within 1 cm) between PV reconstructed using tracks and PV using FT0 A-C time difference"}; + Configurable requireIsVertexTOFmatched{"requireIsVertexTOFmatched", false, "require events with at least one of vertex contributors matched to TOF"}; + Configurable requireIsVertexTRDmatched{"requireIsVertexTRDmatched", false, "require events with at least one of vertex contributors matched to TRD"}; + Configurable rejectSameBunchPileup{"rejectSameBunchPileup", false, "reject collisions in case of pileup with another collision in the same foundBC"}; + Configurable requireNoCollInTimeRangeStd{"requireNoCollInTimeRangeStd", false, "reject collisions corrupted by the cannibalism, with other collisions within +/- 2 microseconds or mult above a certain threshold in -4 - -2 microseconds"}; + Configurable requireNoCollInTimeRangeStrict{"requireNoCollInTimeRangeStrict", false, "reject collisions corrupted by the cannibalism, with other collisions within +/- 10 microseconds"}; + Configurable requireNoCollInTimeRangeNarrow{"requireNoCollInTimeRangeNarrow", false, "reject collisions corrupted by the cannibalism, with other collisions within +/- 2 microseconds"}; + Configurable requireNoCollInTimeRangeVzDep{"requireNoCollInTimeRangeVzDep", false, "reject collisions corrupted by the cannibalism, with other collisions with pvZ of drifting TPC tracks from past/future collisions within 2.5 cm the current pvZ"}; + Configurable requireNoCollInROFStd{"requireNoCollInROFStd", false, "reject collisions corrupted by the cannibalism, with other collisions within the same ITS ROF with mult. above a certain threshold"}; + Configurable requireNoCollInROFStrict{"requireNoCollInROFStrict", false, "reject collisions corrupted by the cannibalism, with other collisions within the same ITS ROF"}; + Configurable requireINEL0{"requireINEL0", false, "require INEL>0 event selection"}; + Configurable requireINEL1{"requireINEL1", false, "require INEL>1 event selection"}; + Configurable maxZVtxPosition{"maxZVtxPosition", 10., "max Z vtx position"}; + Configurable useEvtSelInDenomEff{"useEvtSelInDenomEff", false, "Consider event selections in the recoed <-> gen collision association for the denominator (or numerator) of the acc. x eff. (or signal loss)?"}; + Configurable applyZVtxSelOnMCPV{"applyZVtxSelOnMCPV", false, "Apply Z-vtx cut on the PV of the generated collision?"}; + Configurable useFT0CbasedOccupancy{"useFT0CbasedOccupancy", false, "Use sum of FT0-C amplitudes for estimating occupancy? (if not, use track-based definition)"}; + // fast check on occupancy + Configurable minOccupancy{"minOccupancy", -1, "minimum occupancy from neighbouring collisions"}; + Configurable maxOccupancy{"maxOccupancy", -1, "maximum occupancy from neighbouring collisions"}; + + // fast check on interaction rate + Configurable minIR{"minIR", -1, "minimum IR collisions"}; + Configurable maxIR{"maxIR", -1, "maximum IR collisions"}; + + } eventSelections; + + // Generated Sigma0s + Configurable mc_keepOnlyFromGenerator{"mc_keepOnlyFromGenerator", true, "if true, consider only particles from generator to calculate efficiency."}; + + // QA Configurable fillBkgQAhistos{"fillBkgQAhistos", false, "if true, fill MC QA histograms for Bkg study. Only works with MC."}; - Configurable fillpTResoQAhistos{"fillpTResoQAhistos", false, "if true, fill MC QA histograms for pT resolution study. Only works with MC."}; + Configurable fillResoQAhistos{"fillResoQAhistos", false, "if true, fill MC QA histograms for pT resolution study. Only works with MC."}; // Analysis strategy: - Configurable fUseMLSel{"fUseMLSel", false, "Flag to use ML selection. If False, the standard selection is applied."}; - Configurable fselLambdaTPCPID{"fselLambdaTPCPID", true, "Flag to select lambda-like candidates using TPC NSigma."}; - Configurable fselLambdaTOFPID{"fselLambdaTOFPID", false, "Flag to select lambda-like candidates using TOF NSigma."}; Configurable doMCAssociation{"doMCAssociation", false, "Flag to process only signal candidates. Use only with processMonteCarlo!"}; + Configurable selRecoFromGenerator{"selRecoFromGenerator", false, "Flag to process only signal candidates from generator"}; Configurable doPhotonLambdaSelQA{"doPhotonLambdaSelQA", false, "Flag to fill photon and lambda QA histos!"}; - // For ML Selection - Configurable Gamma_MLThreshold{"Gamma_MLThreshold", 0.1, "Decision Threshold value to select gammas"}; - Configurable Lambda_MLThreshold{"Lambda_MLThreshold", 0.1, "Decision Threshold value to select lambdas"}; - Configurable AntiLambda_MLThreshold{"AntiLambda_MLThreshold", 0.1, "Decision Threshold value to select antilambdas"}; - - // For Standard Selection: - //// Lambda standard criteria:: - Configurable LambdaMinDCANegToPv{"LambdaMinDCANegToPv", .05, "min DCA Neg To PV (cm)"}; - Configurable LambdaMinDCAPosToPv{"LambdaMinDCAPosToPv", .05, "min DCA Pos To PV (cm)"}; - Configurable ALambdaMinDCANegToPv{"ALambdaMinDCANegToPv", .05, "min DCA Neg To PV (cm)"}; - Configurable ALambdaMinDCAPosToPv{"ALambdaMinDCAPosToPv", .05, "min DCA Pos To PV (cm)"}; - Configurable LambdaMaxDCAV0Dau{"LambdaMaxDCAV0Dau", 2.5, "Max DCA V0 Daughters (cm)"}; - Configurable LambdaMinv0radius{"LambdaMinv0radius", 0.0, "Min V0 radius (cm)"}; - Configurable LambdaMaxv0radius{"LambdaMaxv0radius", 40, "Max V0 radius (cm)"}; - Configurable LambdaMinQt{"LambdaMinQt", 0.01, "Min lambda qt value (AP plot) (GeV/c)"}; - Configurable LambdaMaxQt{"LambdaMaxQt", 0.17, "Max lambda qt value (AP plot) (GeV/c)"}; - Configurable LambdaMinAlpha{"LambdaMinAlpha", 0.25, "Min lambda alpha absolute value (AP plot)"}; - Configurable LambdaMaxAlpha{"LambdaMaxAlpha", 1.0, "Max lambda alpha absolute value (AP plot)"}; - Configurable LambdaMinv0cospa{"LambdaMinv0cospa", 0.95, "Min V0 CosPA"}; - Configurable LambdaMaxLifeTime{"LambdaMaxLifeTime", 30, "Max lifetime"}; - Configurable LambdaWindow{"LambdaWindow", 0.015, "Mass window around expected (in GeV/c2)"}; - Configurable LambdaMaxRap{"LambdaMaxRap", 0.8, "Max lambda rapidity"}; - Configurable LambdaMaxDauEta{"LambdaMaxDauEta", 0.8, "Max pseudorapidity of daughter tracks"}; - Configurable LambdaMaxTPCNSigmas{"LambdaMaxTPCNSigmas", 1e+9, "Max TPC NSigmas for daughters"}; - Configurable LambdaPrMaxTOFNSigmas{"LambdaPrMaxTOFNSigmas", 1e+9, "Max TOF NSigmas for daughters"}; - Configurable LambdaPiMaxTOFNSigmas{"LambdaPiMaxTOFNSigmas", 1e+9, "Max TOF NSigmas for daughters"}; - Configurable LambdaMinTPCCrossedRows{"LambdaMinTPCCrossedRows", 50, "Min daughter TPC Crossed Rows"}; - Configurable LambdaMinITSclusters{"LambdaMinITSclusters", 1, "minimum ITS clusters"}; - Configurable LambdaRejectPosITSafterburner{"LambdaRejectPosITSafterburner", false, "reject positive track formed out of afterburner ITS tracks"}; - Configurable LambdaRejectNegITSafterburner{"LambdaRejectNegITSafterburner", false, "reject negative track formed out of afterburner ITS tracks"}; - - //// Photon standard criteria: - Configurable Photonv0TypeSel{"Photonv0TypeSel", 7, "select on a certain V0 type (leave negative if no selection desired)"}; - Configurable PhotonDauMinPt{"PhotonDauMinPt", 0.0, "Min daughter pT (GeV/c)"}; - Configurable PhotonMinDCADauToPv{"PhotonMinDCADauToPv", 0.0, "Min DCA daughter To PV (cm)"}; - Configurable PhotonMaxDCAV0Dau{"PhotonMaxDCAV0Dau", 3.5, "Max DCA V0 Daughters (cm)"}; - Configurable PhotonMinTPCCrossedRows{"PhotonMinTPCCrossedRows", 30, "Min daughter TPC Crossed Rows"}; - Configurable PhotonMinTPCNSigmas{"PhotonMinTPCNSigmas", -7, "Min TPC NSigmas for daughters"}; - Configurable PhotonMaxTPCNSigmas{"PhotonMaxTPCNSigmas", 7, "Max TPC NSigmas for daughters"}; - Configurable PhotonMinPt{"PhotonMinPt", 0.0, "Min photon pT (GeV/c)"}; - Configurable PhotonMaxPt{"PhotonMaxPt", 50.0, "Max photon pT (GeV/c)"}; - Configurable PhotonMaxRap{"PhotonMaxRap", 0.5, "Max photon rapidity"}; - Configurable PhotonMinRadius{"PhotonMinRadius", 3.0, "Min photon conversion radius (cm)"}; - Configurable PhotonMaxRadius{"PhotonMaxRadius", 115, "Max photon conversion radius (cm)"}; - Configurable PhotonMaxZ{"PhotonMaxZ", 240, "Max photon conversion point z value (cm)"}; - Configurable PhotonMaxQt{"PhotonMaxQt", 0.05, "Max photon qt value (AP plot) (GeV/c)"}; - Configurable PhotonMaxAlpha{"PhotonMaxAlpha", 0.95, "Max photon alpha absolute value (AP plot)"}; - Configurable PhotonMinV0cospa{"PhotonMinV0cospa", 0.80, "Min V0 CosPA"}; - Configurable PhotonMaxMass{"PhotonMaxMass", 0.10, "Max photon mass (GeV/c^{2})"}; - Configurable PhotonPsiPairMax{"PhotonPsiPairMax", 1e+9, "maximum psi angle of the track pair"}; - Configurable PhotonMaxDauEta{"PhotonMaxDauEta", 0.8, "Max pseudorapidity of daughter tracks"}; - Configurable PhotonLineCutZ0{"PhotonLineCutZ0", 7.0, "The offset for the linecute used in the Z vs R plot"}; - Configurable PhotonPhiMin1{"PhotonPhiMin1", -1, "Phi min value to reject photons, region 1 (leave negative if no selection desired)"}; - Configurable PhotonPhiMax1{"PhotonPhiMax1", -1, "Phi max value to reject photons, region 1 (leave negative if no selection desired)"}; - Configurable PhotonPhiMin2{"PhotonPhiMin2", -1, "Phi max value to reject photons, region 2 (leave negative if no selection desired)"}; - Configurable PhotonPhiMax2{"PhotonPhiMax2", -1, "Phi min value to reject photons, region 2 (leave negative if no selection desired)"}; - - Configurable SigmaMaxRap{"SigmaMaxRap", 0.5, "Max sigma0 rapidity"}; + // For Selection: + //// Lambda criteria:: + struct : ConfigurableGroup { + Configurable Lambda_MLThreshold{"Lambda_MLThreshold", 0.1, "Decision Threshold value to select lambdas"}; + Configurable AntiLambda_MLThreshold{"AntiLambda_MLThreshold", 0.1, "Decision Threshold value to select antilambdas"}; + Configurable LambdaMinDCANegToPv{"LambdaMinDCANegToPv", .05, "min DCA Neg To PV (cm)"}; + Configurable LambdaMinDCAPosToPv{"LambdaMinDCAPosToPv", .05, "min DCA Pos To PV (cm)"}; + Configurable ALambdaMinDCANegToPv{"ALambdaMinDCANegToPv", .05, "min DCA Neg To PV (cm)"}; + Configurable ALambdaMinDCAPosToPv{"ALambdaMinDCAPosToPv", .05, "min DCA Pos To PV (cm)"}; + Configurable LambdaMaxDCAV0Dau{"LambdaMaxDCAV0Dau", 2.5, "Max DCA V0 Daughters (cm)"}; + Configurable LambdaMinv0radius{"LambdaMinv0radius", 0.0, "Min V0 radius (cm)"}; + Configurable LambdaMaxv0radius{"LambdaMaxv0radius", 40, "Max V0 radius (cm)"}; + Configurable LambdaMinQt{"LambdaMinQt", 0.01, "Min lambda qt value (AP plot) (GeV/c)"}; + Configurable LambdaMaxQt{"LambdaMaxQt", 0.17, "Max lambda qt value (AP plot) (GeV/c)"}; + Configurable LambdaMinAlpha{"LambdaMinAlpha", 0.25, "Min lambda alpha absolute value (AP plot)"}; + Configurable LambdaMaxAlpha{"LambdaMaxAlpha", 1.0, "Max lambda alpha absolute value (AP plot)"}; + Configurable LambdaMinv0cospa{"LambdaMinv0cospa", 0.95, "Min V0 CosPA"}; + Configurable LambdaMaxLifeTime{"LambdaMaxLifeTime", 30, "Max lifetime"}; + Configurable LambdaWindow{"LambdaWindow", 0.015, "Mass window around expected (in GeV/c2)"}; + Configurable LambdaMaxRap{"LambdaMaxRap", 0.8, "Max lambda rapidity"}; + Configurable LambdaMaxDauEta{"LambdaMaxDauEta", 0.8, "Max pseudorapidity of daughter tracks"}; + Configurable fselLambdaTPCPID{"fselLambdaTPCPID", true, "Flag to select lambda-like candidates using TPC NSigma."}; + Configurable fselLambdaTOFPID{"fselLambdaTOFPID", false, "Flag to select lambda-like candidates using TOF NSigma."}; + Configurable LambdaMaxTPCNSigmas{"LambdaMaxTPCNSigmas", 1e+9, "Max TPC NSigmas for daughters"}; + Configurable LambdaPrMaxTOFNSigmas{"LambdaPrMaxTOFNSigmas", 1e+9, "Max TOF NSigmas for daughters"}; + Configurable LambdaPiMaxTOFNSigmas{"LambdaPiMaxTOFNSigmas", 1e+9, "Max TOF NSigmas for daughters"}; + Configurable LambdaMinTPCCrossedRows{"LambdaMinTPCCrossedRows", 50, "Min daughter TPC Crossed Rows"}; + Configurable LambdaMinITSclusters{"LambdaMinITSclusters", 1, "minimum ITS clusters"}; + Configurable LambdaRejectPosITSafterburner{"LambdaRejectPosITSafterburner", false, "reject positive track formed out of afterburner ITS tracks"}; + Configurable LambdaRejectNegITSafterburner{"LambdaRejectNegITSafterburner", false, "reject negative track formed out of afterburner ITS tracks"}; + + } lambdaSelections; + + //// Photon criteria: + struct : ConfigurableGroup { + Configurable Gamma_MLThreshold{"Gamma_MLThreshold", 0.1, "Decision Threshold value to select gammas"}; + Configurable Photonv0TypeSel{"Photonv0TypeSel", 7, "select on a certain V0 type (leave negative if no selection desired)"}; + Configurable PhotonMinDCADauToPv{"PhotonMinDCADauToPv", 0.0, "Min DCA daughter To PV (cm)"}; + Configurable PhotonMaxDCAV0Dau{"PhotonMaxDCAV0Dau", 3.5, "Max DCA V0 Daughters (cm)"}; + Configurable PhotonMinTPCCrossedRows{"PhotonMinTPCCrossedRows", 30, "Min daughter TPC Crossed Rows"}; + Configurable PhotonMinTPCNSigmas{"PhotonMinTPCNSigmas", -7, "Min TPC NSigmas for daughters"}; + Configurable PhotonMaxTPCNSigmas{"PhotonMaxTPCNSigmas", 7, "Max TPC NSigmas for daughters"}; + Configurable PhotonMinPt{"PhotonMinPt", 0.0, "Min photon pT (GeV/c)"}; + Configurable PhotonMaxPt{"PhotonMaxPt", 50.0, "Max photon pT (GeV/c)"}; + Configurable PhotonMaxRap{"PhotonMaxRap", 0.5, "Max photon rapidity"}; + Configurable PhotonMinRadius{"PhotonMinRadius", 3.0, "Min photon conversion radius (cm)"}; + Configurable PhotonMaxRadius{"PhotonMaxRadius", 115, "Max photon conversion radius (cm)"}; + Configurable PhotonMaxZ{"PhotonMaxZ", 240, "Max photon conversion point z value (cm)"}; + Configurable PhotonMaxQt{"PhotonMaxQt", 0.05, "Max photon qt value (AP plot) (GeV/c)"}; + Configurable PhotonMaxAlpha{"PhotonMaxAlpha", 0.95, "Max photon alpha absolute value (AP plot)"}; + Configurable PhotonMinV0cospa{"PhotonMinV0cospa", 0.80, "Min V0 CosPA"}; + Configurable PhotonMaxMass{"PhotonMaxMass", 0.10, "Max photon mass (GeV/c^{2})"}; + Configurable PhotonPsiPairMax{"PhotonPsiPairMax", 1e+9, "maximum psi angle of the track pair"}; + Configurable PhotonMaxDauEta{"PhotonMaxDauEta", 0.8, "Max pseudorapidity of daughter tracks"}; + Configurable PhotonLineCutZ0{"PhotonLineCutZ0", 7.0, "The offset for the linecute used in the Z vs R plot"}; + Configurable PhotonPhiMin1{"PhotonPhiMin1", -1, "Phi min value to reject photons, region 1 (leave negative if no selection desired)"}; + Configurable PhotonPhiMax1{"PhotonPhiMax1", -1, "Phi max value to reject photons, region 1 (leave negative if no selection desired)"}; + Configurable PhotonPhiMin2{"PhotonPhiMin2", -1, "Phi max value to reject photons, region 2 (leave negative if no selection desired)"}; + Configurable PhotonPhiMax2{"PhotonPhiMax2", -1, "Phi min value to reject photons, region 2 (leave negative if no selection desired)"}; + } photonSelections; + + struct : ConfigurableGroup { + Configurable Sigma0MaxRap{"Sigma0MaxRap", 0.5, "Max sigma0 rapidity"}; + Configurable Sigma0MaxRadius{"Sigma0MaxRadius", 200, "Max sigma0 decay radius"}; + Configurable Sigma0MaxDCADau{"Sigma0MaxDCADau", 50, "Max sigma0 DCA between daughters"}; + Configurable Sigma0MaxOPAngle{"Sigma0MaxOPAngle", 7, "Max sigma0 OP Angle between daughters"}; + } sigma0Selections; + + struct : ConfigurableGroup { + Configurable Pi0MaxRap{"Pi0MaxRap", 0.5, "Max sigma0 rapidity"}; + Configurable Pi0MaxRadius{"Pi0MaxRadius", 200, "Max sigma0 decay radius"}; + Configurable Pi0MaxDCADau{"Pi0MaxDCADau", 50, "Max sigma0 DCA between daughters"}; + } pi0Selections; // Axis // base properties @@ -149,11 +216,14 @@ struct sigmaanalysis { ConfigurableAxis axisDeltaPt{"axisDeltaPt", {400, -50.0, 50.0}, ""}; ConfigurableAxis axisRapidity{"axisRapidity", {100, -2.0f, 2.0f}, "Rapidity"}; ConfigurableAxis axisIRBinning{"axisIRBinning", {150, 0, 1500}, "Binning for the interaction rate (kHz)"}; + ConfigurableAxis axisNch{"axisNch", {300, 0.0f, 3000.0f}, "N_{ch}"}; + ConfigurableAxis axisGeneratorIds{"axisGeneratorIds", {256, -0.5f, 255.5f}, "axis for generatorIds"}; // Invariant Mass ConfigurableAxis axisSigmaMass{"axisSigmaMass", {500, 1.10f, 1.30f}, "M_{#Sigma^{0}} (GeV/c^{2})"}; ConfigurableAxis axisLambdaMass{"axisLambdaMass", {200, 1.05f, 1.151f}, "M_{#Lambda} (GeV/c^{2})"}; ConfigurableAxis axisPhotonMass{"axisPhotonMass", {200, -0.1f, 0.5f}, "M_{#Gamma}"}; + ConfigurableAxis axisPi0Mass{"axisPi0Mass", {200, 0.08f, 0.18f}, "M_{#Pi^{0}}"}; // AP plot axes ConfigurableAxis axisAPAlpha{"axisAPAlpha", {220, -1.1f, 1.1f}, "V0 AP alpha"}; @@ -168,7 +238,8 @@ struct sigmaanalysis { ConfigurableAxis axisLifetime{"axisLifetime", {100, 0, 100}, "Chi2 Per Ncl"}; // topological variable QA axes - ConfigurableAxis axisRadius{"axisRadius", {240, 0.0f, 120.0f}, "V0 radius (cm)"}; + ConfigurableAxis axisV0Radius{"axisV0Radius", {240, 0.0f, 120.0f}, "V0 radius (cm)"}; + ConfigurableAxis axisV0PairRadius{"axisV0PairRadius", {200, 0.0f, 20.0f}, "V0Pair radius (cm)"}; ConfigurableAxis axisDCAtoPV{"axisDCAtoPV", {500, 0.0f, 50.0f}, "DCA (cm)"}; ConfigurableAxis axisDCAdau{"axisDCAdau", {50, 0.0f, 5.0f}, "DCA (cm)"}; ConfigurableAxis axisCosPA{"axisCosPA", {200, 0.5f, 1.0f}, "Cosine of pointing angle"}; @@ -184,173 +255,586 @@ struct sigmaanalysis { void init(InitContext const&) { + LOGF(info, "Initializing now: cross-checking correctness..."); + if ((doprocessRealData + doprocessMonteCarlo + doprocessPi0RealData + doprocessPi0MonteCarlo > 1) || + (doprocessGeneratedRun3 + doprocessPi0GeneratedRun3 > 1)) { + LOGF(fatal, "You have enabled more than one process function. Please check your configuration! Aborting now."); + } - for (const auto& histodir : DirList) { - - histos.add(histodir + "/Photon/hTrackCode", "hTrackCode", kTH1F, {{11, 0.5f, 11.5f}}); - histos.add(histodir + "/Photon/hV0Type", "hV0Type", kTH1F, {{8, 0.5f, 8.5f}}); - histos.add(histodir + "/Photon/hNegpT", "hNegpT", kTH1F, {axisPt}); - histos.add(histodir + "/Photon/hPospT", "hPospT", kTH1F, {axisPt}); - histos.add(histodir + "/Photon/hDCANegToPV", "hDCANegToPV", kTH1F, {axisDCAtoPV}); - histos.add(histodir + "/Photon/hDCAPosToPV", "hDCAPosToPV", kTH1F, {axisDCAtoPV}); - histos.add(histodir + "/Photon/hDCADau", "hDCADau", kTH1F, {axisDCAdau}); - histos.add(histodir + "/Photon/hPosTPCCR", "hPosTPCCR", kTH1F, {axisTPCrows}); - histos.add(histodir + "/Photon/hNegTPCCR", "hNegTPCCR", kTH1F, {axisTPCrows}); - histos.add(histodir + "/Photon/h2dPosTPCNSigmaEl", "h2dPosTPCNSigmaEl", kTH2F, {axisPt, axisTPCNSigma}); - histos.add(histodir + "/Photon/h2dNegTPCNSigmaEl", "h2dNegTPCNSigmaEl", kTH2F, {axisPt, axisTPCNSigma}); - histos.add(histodir + "/Photon/h2dPosTPCNSigmaPi", "h2dPosTPCNSigmaPi", kTH2F, {axisPt, axisTPCNSigma}); - histos.add(histodir + "/Photon/h2dNegTPCNSigmaPi", "h2dNegTPCNSigmaPi", kTH2F, {axisPt, axisTPCNSigma}); - histos.add(histodir + "/Photon/hpT", "hpT", kTH1F, {axisPt}); - histos.add(histodir + "/Photon/hY", "hY", kTH1F, {axisRapidity}); - histos.add(histodir + "/Photon/hPosEta", "hPosEta", kTH1F, {axisRapidity}); - histos.add(histodir + "/Photon/hNegEta", "hNegEta", kTH1F, {axisRapidity}); - histos.add(histodir + "/Photon/hRadius", "hRadius", kTH1F, {axisRadius}); - histos.add(histodir + "/Photon/hZ", "hZ", kTH1F, {axisZ}); - histos.add(histodir + "/Photon/h2dRZCut", "h2dRZCut", kTH2F, {axisZ, axisRadius}); - histos.add(histodir + "/Photon/h2dRZPlane", "h2dRZPlane", kTH2F, {axisZ, axisRadius}); - histos.add(histodir + "/Photon/hCosPA", "hCosPA", kTH1F, {axisCosPA}); - histos.add(histodir + "/Photon/hPsiPair", "hPsiPair", kTH1F, {axisPsiPair}); - histos.add(histodir + "/Photon/hPhi", "hPhi", kTH1F, {axisPhi}); - histos.add(histodir + "/Photon/h3dMass", "h3dMass", kTH3F, {axisCentrality, axisPt, axisPhotonMass}); - histos.add(histodir + "/Photon/hMass", "hMass", kTH1F, {axisPhotonMass}); - - histos.add(histodir + "/Lambda/hTrackCode", "hTrackCode", kTH1F, {{11, 0.5f, 11.5f}}); - histos.add(histodir + "/Lambda/hRadius", "hRadius", kTH1F, {axisRadius}); - histos.add(histodir + "/Lambda/hDCADau", "hDCADau", kTH1F, {axisDCAdau}); - histos.add(histodir + "/Lambda/hCosPA", "hCosPA", kTH1F, {axisCosPA}); - histos.add(histodir + "/Lambda/hY", "hY", kTH1F, {axisRapidity}); - histos.add(histodir + "/Lambda/hPosEta", "hPosEta", kTH1F, {axisRapidity}); - histos.add(histodir + "/Lambda/hNegEta", "hNegEta", kTH1F, {axisRapidity}); - histos.add(histodir + "/Lambda/hPosTPCCR", "hPosTPCCR", kTH1F, {axisTPCrows}); - histos.add(histodir + "/Lambda/hNegTPCCR", "hNegTPCCR", kTH1F, {axisTPCrows}); - histos.add(histodir + "/Lambda/hPosITSCls", "hPosITSCls", kTH1F, {axisNCls}); - histos.add(histodir + "/Lambda/hNegITSCls", "hNegITSCls", kTH1F, {axisNCls}); - histos.add(histodir + "/Lambda/hPosChi2PerNc", "hPosChi2PerNc", kTH1F, {axisChi2PerNcl}); - histos.add(histodir + "/Lambda/hNegChi2PerNc", "hNegChi2PerNc", kTH1F, {axisChi2PerNcl}); - histos.add(histodir + "/Lambda/hLifeTime", "hLifeTime", kTH1F, {axisLifetime}); - histos.add(histodir + "/Lambda/h2dTPCvsTOFNSigma_LambdaPr", "h2dTPCvsTOFNSigma_LambdaPr", kTH2F, {axisTPCNSigma, axisTOFNSigma}); - histos.add(histodir + "/Lambda/h2dTPCvsTOFNSigma_LambdaPi", "h2dTPCvsTOFNSigma_LambdaPi", kTH2F, {axisTPCNSigma, axisTOFNSigma}); - histos.add(histodir + "/Lambda/hLambdaDCANegToPV", "hLambdaDCANegToPV", kTH1F, {axisDCAtoPV}); - histos.add(histodir + "/Lambda/hLambdaDCAPosToPV", "hLambdaDCAPosToPV", kTH1F, {axisDCAtoPV}); - histos.add(histodir + "/Lambda/hLambdapT", "hLambdapT", kTH1F, {axisPt}); - histos.add(histodir + "/Lambda/hLambdaMass", "hLambdaMass", kTH1F, {axisLambdaMass}); - histos.add(histodir + "/Lambda/h3dLambdaMass", "h3dLambdaMass", kTH3F, {axisCentrality, axisPt, axisLambdaMass}); - histos.add(histodir + "/Lambda/h2dTPCvsTOFNSigma_ALambdaPr", "h2dTPCvsTOFNSigma_ALambdaPr", kTH2F, {axisTPCNSigma, axisTOFNSigma}); - histos.add(histodir + "/Lambda/h2dTPCvsTOFNSigma_ALambdaPi", "h2dTPCvsTOFNSigma_ALambdaPi", kTH2F, {axisTPCNSigma, axisTOFNSigma}); - histos.add(histodir + "/Lambda/hALambdaDCANegToPV", "hALambdaDCANegToPV", kTH1F, {axisDCAtoPV}); - histos.add(histodir + "/Lambda/hALambdaDCAPosToPV", "hALambdaDCAPosToPV", kTH1F, {axisDCAtoPV}); - histos.add(histodir + "/Lambda/hALambdapT", "hALambdapT", kTH1F, {axisPt}); - histos.add(histodir + "/Lambda/hAntiLambdaMass", "hAntiLambdaMass", kTH1F, {axisLambdaMass}); - histos.add(histodir + "/Lambda/h3dAntiLambdaMass", "h3dAntiLambdaMass", kTH3F, {axisCentrality, axisPt, axisLambdaMass}); - - histos.add(histodir + "/h2dArmenteros", "h2dArmenteros", kTH2F, {axisAPAlpha, axisAPQt}); - - histos.add(histodir + "/Sigma0/hMass", "hMass", kTH1F, {axisSigmaMass}); - histos.add(histodir + "/Sigma0/hPt", "hPt", kTH1F, {axisPt}); - histos.add(histodir + "/Sigma0/hY", "hY", kTH1F, {axisRapidity}); - histos.add(histodir + "/Sigma0/h3dMass", "h3dMass", kTH3F, {axisCentrality, axisPt, axisSigmaMass}); - histos.add(histodir + "/Sigma0/h3dPhotonRadiusVsMassSigma", "h3dPhotonRadiusVsMassSigma", kTH3F, {axisCentrality, axisRadius, axisSigmaMass}); - histos.add(histodir + "/Sigma0/h2dpTVsOPAngle", "h2dpTVsOPAngle", kTH2F, {axisPt, {140, 0.0f, +7.0f}}); - - histos.add(histodir + "/ASigma0/hMass", "hMass", kTH1F, {axisSigmaMass}); - histos.add(histodir + "/ASigma0/hPt", "hPt", kTH1F, {axisPt}); - histos.add(histodir + "/ASigma0/hY", "hY", kTH1F, {axisRapidity}); - histos.add(histodir + "/ASigma0/h3dMass", "h3dMass", kTH3F, {axisCentrality, axisPt, axisSigmaMass}); - histos.add(histodir + "/ASigma0/h3dPhotonRadiusVsMassSigma", "h3dPhotonRadiusVsMassSigma", kTH3F, {axisCentrality, axisRadius, axisSigmaMass}); - histos.add(histodir + "/ASigma0/h2dpTVsOPAngle", "h2dpTVsOPAngle", kTH2F, {axisPt, {140, 0.0f, +7.0f}}); - - // Process MC - if (doprocessMonteCarlo) { - histos.add(histodir + "/MC/Photon/hV0ToCollAssoc", "hV0ToCollAssoc", kTH1F, {{2, 0.0f, 2.0f}}); - histos.add(histodir + "/MC/Photon/hPt", "hPt", kTH1F, {axisPt}); - histos.add(histodir + "/MC/Photon/hMCPt", "hMCPt", kTH1F, {axisPt}); - histos.add(histodir + "/MC/Photon/h2dPosTPCNSigmaEl", "h2dPosTPCNSigmaEl", kTH2F, {axisPt, axisTPCNSigma}); - histos.add(histodir + "/MC/Photon/h2dNegTPCNSigmaEl", "h2dNegTPCNSigmaEl", kTH2F, {axisPt, axisTPCNSigma}); - histos.add(histodir + "/MC/Photon/h2dPosTPCNSigmaPi", "h2dPosTPCNSigmaPi", kTH2F, {axisPt, axisTPCNSigma}); - histos.add(histodir + "/MC/Photon/h2dNegTPCNSigmaPi", "h2dNegTPCNSigmaPi", kTH2F, {axisPt, axisTPCNSigma}); - histos.add(histodir + "/MC/Photon/h2dPAVsPt", "h2dPAVsPt", kTH2F, {axisPA, axisPt}); - histos.add(histodir + "/MC/Photon/hPt_BadCollAssig", "hPt_BadCollAssig", kTH1F, {axisPt}); - histos.add(histodir + "/MC/Photon/h2dPAVsPt_BadCollAssig", "h2dPAVsPt_BadCollAssig", kTH2F, {axisPA, axisPt}); - - histos.add(histodir + "/MC/Lambda/hV0ToCollAssoc", "hV0ToCollAssoc", kTH1F, {{2, 0.0f, 2.0f}}); - histos.add(histodir + "/MC/Lambda/hPt", "hPt", kTH1F, {axisPt}); - histos.add(histodir + "/MC/Lambda/hMCPt", "hMCPt", kTH1F, {axisPt}); - histos.add(histodir + "/MC/Lambda/h3dTPCvsTOFNSigma_Pr", "h3dTPCvsTOFNSigma_Pr", kTH3F, {axisTPCNSigma, axisTOFNSigma, axisPt}); - histos.add(histodir + "/MC/Lambda/h3dTPCvsTOFNSigma_Pi", "h3dTPCvsTOFNSigma_Pi", kTH3F, {axisTPCNSigma, axisTOFNSigma, axisPt}); - - histos.add(histodir + "/MC/ALambda/hV0ToCollAssoc", "hV0ToCollAssoc", kTH1F, {{2, 0.0f, 2.0f}}); - histos.add(histodir + "/MC/ALambda/hPt", "hPt", kTH1F, {axisPt}); - histos.add(histodir + "/MC/ALambda/hMCPt", "hMCPt", kTH1F, {axisPt}); - histos.add(histodir + "/MC/ALambda/h3dTPCvsTOFNSigma_Pr", "h3dTPCvsTOFNSigma_Pr", kTH3F, {axisTPCNSigma, axisTOFNSigma, axisPt}); - histos.add(histodir + "/MC/ALambda/h3dTPCvsTOFNSigma_Pi", "h3dTPCvsTOFNSigma_Pi", kTH3F, {axisTPCNSigma, axisTOFNSigma, axisPt}); - - histos.add(histodir + "/MC/h2dArmenteros", "h2dArmenteros", kTH2F, {axisAPAlpha, axisAPQt}); - - histos.add(histodir + "/MC/Sigma0/hPt", "hPt", kTH1F, {axisPt}); - histos.add(histodir + "/MC/Sigma0/hMCPt", "hMCPt", kTH1F, {axisPt}); - histos.add(histodir + "/MC/Sigma0/h2dMCPtVsLambdaMCPt", "h2dMCPtVsLambdaMCPt", kTH2F, {axisPt, axisPt}); - histos.add(histodir + "/MC/Sigma0/h2dMCPtVsGammaMCPt", "h2dMCPtVsGammaMCPt", kTH2F, {axisPt, axisPt}); - histos.add(histodir + "/MC/Sigma0/hMass", "hMass", kTH1F, {axisSigmaMass}); - histos.add(histodir + "/MC/Sigma0/h3dMass", "h3dMass", kTH3F, {axisCentrality, axisPt, axisSigmaMass}); - - histos.add(histodir + "/MC/ASigma0/hPt", "hPt", kTH1F, {axisPt}); - histos.add(histodir + "/MC/ASigma0/hMCPt", "hMCPt", kTH1F, {axisPt}); - histos.add(histodir + "/MC/ASigma0/h2dMCPtVsLambdaMCPt", "h2dMCPtVsLambdaMCPt", kTH2F, {axisPt, axisPt}); - histos.add(histodir + "/MC/ASigma0/h2dMCPtVsPhotonMCPt", "h2dMCPtVsPhotonMCPt", kTH2F, {axisPt, axisPt}); - histos.add(histodir + "/MC/ASigma0/hMass", "hMass", kTH1F, {axisSigmaMass}); - histos.add(histodir + "/MC/ASigma0/h3dMass", "h3dMass", kTH3F, {axisCentrality, axisPt, axisSigmaMass}); - - // 1/pT Resolution: - if (fillpTResoQAhistos && histodir == "BeforeSel") { - histos.add(histodir + "/MC/pTReso/h3dGammaPtResoVsTPCCR", "h3dGammaPtResoVsTPCCR", kTH3F, {axisInvPt, axisDeltaPt, axisTPCrows}); - histos.add(histodir + "/MC/pTReso/h3dGammaPtResoVsTPCCR", "h3dGammaPtResoVsTPCCR", kTH3F, {axisInvPt, axisDeltaPt, axisTPCrows}); - histos.add(histodir + "/MC/pTReso/h2dGammaPtResolution", "h2dGammaPtResolution", kTH2F, {axisInvPt, axisDeltaPt}); - histos.add(histodir + "/MC/pTReso/h2dLambdaPtResolution", "h2dLambdaPtResolution", kTH2F, {axisInvPt, axisDeltaPt}); - histos.add(histodir + "/MC/pTReso/h3dLambdaPtResoVsTPCCR", "h3dLambdaPtResoVsTPCCR", kTH3F, {axisInvPt, axisDeltaPt, axisTPCrows}); - histos.add(histodir + "/MC/pTReso/h3dLambdaPtResoVsTPCCR", "h3dLambdaPtResoVsTPCCR", kTH3F, {axisInvPt, axisDeltaPt, axisTPCrows}); - histos.add(histodir + "/MC/pTReso/h2dAntiLambdaPtResolution", "h2dAntiLambdaPtResolution", kTH2F, {axisInvPt, axisDeltaPt}); - histos.add(histodir + "/MC/pTReso/h3dAntiLambdaPtResoVsTPCCR", "h3dAntiLambdaPtResoVsTPCCR", kTH3F, {axisInvPt, axisDeltaPt, axisTPCrows}); - histos.add(histodir + "/MC/pTReso/h3dAntiLambdaPtResoVsTPCCR", "h3dAntiLambdaPtResoVsTPCCR", kTH3F, {axisInvPt, axisDeltaPt, axisTPCrows}); - histos.add(histodir + "/MC/pTReso/h2dSigma0PtResolution", "h2dSigma0PtResolution", kTH2F, {axisInvPt, axisDeltaPt}); - histos.add(histodir + "/MC/pTReso/h2dAntiSigma0PtResolution", "h2dAntiSigma0PtResolution", kTH2F, {axisInvPt, axisDeltaPt}); + // setting CCDB service + ccdb->setURL("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setFatalWhenNull(false); + + // Event Counters + histos.add("hEventCentrality", "hEventCentrality", kTH1D, {axisCentrality}); + + histos.add("hEventSelection", "hEventSelection", kTH1D, {{21, -0.5f, +20.5f}}); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(1, "All collisions"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(2, "sel8 cut"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(3, "kIsTriggerTVX"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(4, "kNoITSROFrameBorder"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(5, "kNoTimeFrameBorder"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(6, "posZ cut"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(7, "kIsVertexITSTPC"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(8, "kIsGoodZvtxFT0vsPV"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(9, "kIsVertexTOFmatched"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(10, "kIsVertexTRDmatched"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(11, "kNoSameBunchPileup"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(12, "kNoCollInTimeRangeStd"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(13, "kNoCollInTimeRangeStrict"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(14, "kNoCollInTimeRangeNarrow"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(15, "kNoCollInRofStd"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(16, "kNoCollInRofStrict"); + if (doPPAnalysis) { + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(17, "INEL>0"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(18, "INEL>1"); + } else { + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(17, "Below min occup."); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(18, "Above max occup."); + } + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(19, "Below min IR"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(20, "Above max IR"); + + if (fGetIR) { + histos.add("GeneralQA/hRunNumberNegativeIR", "", kTH1D, {{1, 0., 1.}}); + histos.add("GeneralQA/hInteractionRate", "hInteractionRate", kTH1D, {axisIRBinning}); + histos.add("GeneralQA/hCentralityVsInteractionRate", "hCentralityVsInteractionRate", kTH2D, {axisCentrality, axisIRBinning}); + } + + if (doprocessRealData || doprocessMonteCarlo) { + for (const auto& histodir : DirList) { + + histos.add(histodir + "/Photon/hTrackCode", "hTrackCode", kTH1D, {{11, 0.5f, 11.5f}}); + histos.add(histodir + "/Photon/hV0Type", "hV0Type", kTH1D, {{8, 0.5f, 8.5f}}); + histos.add(histodir + "/Photon/hDCANegToPV", "hDCANegToPV", kTH1D, {axisDCAtoPV}); + histos.add(histodir + "/Photon/hDCAPosToPV", "hDCAPosToPV", kTH1D, {axisDCAtoPV}); + histos.add(histodir + "/Photon/hDCADau", "hDCADau", kTH1D, {axisDCAdau}); + histos.add(histodir + "/Photon/hPosTPCCR", "hPosTPCCR", kTH1D, {axisTPCrows}); + histos.add(histodir + "/Photon/hNegTPCCR", "hNegTPCCR", kTH1D, {axisTPCrows}); + histos.add(histodir + "/Photon/hPosTPCNSigmaEl", "hPosTPCNSigmaEl", kTH1D, {axisTPCNSigma}); + histos.add(histodir + "/Photon/hNegTPCNSigmaEl", "hNegTPCNSigmaEl", kTH1D, {axisTPCNSigma}); + + histos.add(histodir + "/Photon/hpT", "hpT", kTH1D, {axisPt}); + histos.add(histodir + "/Photon/hY", "hY", kTH1D, {axisRapidity}); + histos.add(histodir + "/Photon/hPosEta", "hPosEta", kTH1D, {axisRapidity}); + histos.add(histodir + "/Photon/hNegEta", "hNegEta", kTH1D, {axisRapidity}); + histos.add(histodir + "/Photon/hRadius", "hRadius", kTH1D, {axisV0Radius}); + histos.add(histodir + "/Photon/hZ", "hZ", kTH1D, {axisZ}); + histos.add(histodir + "/Photon/h2dRZCut", "h2dRZCut", kTH2D, {axisZ, axisV0Radius}); + histos.add(histodir + "/Photon/h2dRZPlane", "h2dRZPlane", kTH2D, {axisZ, axisV0Radius}); + histos.add(histodir + "/Photon/hCosPA", "hCosPA", kTH1D, {axisCosPA}); + histos.add(histodir + "/Photon/hPsiPair", "hPsiPair", kTH1D, {axisPsiPair}); + histos.add(histodir + "/Photon/hPhi", "hPhi", kTH1D, {axisPhi}); + histos.add(histodir + "/Photon/h3dMass", "h3dMass", kTH3D, {axisCentrality, axisPt, axisPhotonMass}); + histos.add(histodir + "/Photon/hMass", "hMass", kTH1D, {axisPhotonMass}); + + histos.add(histodir + "/Lambda/hTrackCode", "hTrackCode", kTH1D, {{11, 0.5f, 11.5f}}); + histos.add(histodir + "/Lambda/hRadius", "hRadius", kTH1D, {axisV0Radius}); + histos.add(histodir + "/Lambda/hDCADau", "hDCADau", kTH1D, {axisDCAdau}); + histos.add(histodir + "/Lambda/hCosPA", "hCosPA", kTH1D, {axisCosPA}); + histos.add(histodir + "/Lambda/hY", "hY", kTH1D, {axisRapidity}); + histos.add(histodir + "/Lambda/hPosEta", "hPosEta", kTH1D, {axisRapidity}); + histos.add(histodir + "/Lambda/hNegEta", "hNegEta", kTH1D, {axisRapidity}); + histos.add(histodir + "/Lambda/hPosTPCCR", "hPosTPCCR", kTH1D, {axisTPCrows}); + histos.add(histodir + "/Lambda/hNegTPCCR", "hNegTPCCR", kTH1D, {axisTPCrows}); + histos.add(histodir + "/Lambda/hPosITSCls", "hPosITSCls", kTH1D, {axisNCls}); + histos.add(histodir + "/Lambda/hNegITSCls", "hNegITSCls", kTH1D, {axisNCls}); + histos.add(histodir + "/Lambda/hPosChi2PerNc", "hPosChi2PerNc", kTH1D, {axisChi2PerNcl}); + histos.add(histodir + "/Lambda/hNegChi2PerNc", "hNegChi2PerNc", kTH1D, {axisChi2PerNcl}); + histos.add(histodir + "/Lambda/hLifeTime", "hLifeTime", kTH1D, {axisLifetime}); + histos.add(histodir + "/Lambda/h2dTPCvsTOFNSigma_LambdaPr", "h2dTPCvsTOFNSigma_LambdaPr", kTH2D, {axisTPCNSigma, axisTOFNSigma}); + histos.add(histodir + "/Lambda/h2dTPCvsTOFNSigma_LambdaPi", "h2dTPCvsTOFNSigma_LambdaPi", kTH2D, {axisTPCNSigma, axisTOFNSigma}); + histos.add(histodir + "/Lambda/hLambdaDCANegToPV", "hLambdaDCANegToPV", kTH1D, {axisDCAtoPV}); + histos.add(histodir + "/Lambda/hLambdaDCAPosToPV", "hLambdaDCAPosToPV", kTH1D, {axisDCAtoPV}); + histos.add(histodir + "/Lambda/hLambdapT", "hLambdapT", kTH1D, {axisPt}); + histos.add(histodir + "/Lambda/hLambdaMass", "hLambdaMass", kTH1D, {axisLambdaMass}); + histos.add(histodir + "/Lambda/h3dLambdaMass", "h3dLambdaMass", kTH3D, {axisCentrality, axisPt, axisLambdaMass}); + histos.add(histodir + "/Lambda/h2dTPCvsTOFNSigma_ALambdaPr", "h2dTPCvsTOFNSigma_ALambdaPr", kTH2D, {axisTPCNSigma, axisTOFNSigma}); + histos.add(histodir + "/Lambda/h2dTPCvsTOFNSigma_ALambdaPi", "h2dTPCvsTOFNSigma_ALambdaPi", kTH2D, {axisTPCNSigma, axisTOFNSigma}); + histos.add(histodir + "/Lambda/hALambdaDCANegToPV", "hALambdaDCANegToPV", kTH1D, {axisDCAtoPV}); + histos.add(histodir + "/Lambda/hALambdaDCAPosToPV", "hALambdaDCAPosToPV", kTH1D, {axisDCAtoPV}); + histos.add(histodir + "/Lambda/hALambdapT", "hALambdapT", kTH1D, {axisPt}); + histos.add(histodir + "/Lambda/hAntiLambdaMass", "hAntiLambdaMass", kTH1D, {axisLambdaMass}); + histos.add(histodir + "/Lambda/h3dAntiLambdaMass", "h3dAntiLambdaMass", kTH3D, {axisCentrality, axisPt, axisLambdaMass}); + + histos.add(histodir + "/h2dArmenteros", "h2dArmenteros", kTH2D, {axisAPAlpha, axisAPQt}); + + histos.add(histodir + "/Sigma0/hMass", "hMass", kTH1D, {axisSigmaMass}); + histos.add(histodir + "/Sigma0/hPt", "hPt", kTH1D, {axisPt}); + histos.add(histodir + "/Sigma0/hY", "hY", kTH1D, {axisRapidity}); + histos.add(histodir + "/Sigma0/hRadius", "hRadius", kTH1D, {axisV0PairRadius}); + histos.add(histodir + "/Sigma0/h2dRadiusVspT", "h2dRadiusVspT", kTH2D, {axisV0PairRadius, axisPt}); + histos.add(histodir + "/Sigma0/hDCAPairDau", "hDCAPairDau", kTH1D, {axisDCAdau}); + histos.add(histodir + "/Sigma0/h3dMass", "h3dMass", kTH3D, {axisCentrality, axisPt, axisSigmaMass}); + histos.add(histodir + "/Sigma0/h3dOPAngleVsMass", "h3dOPAngleVsMass", kTH3D, {{140, 0.0f, +7.0f}, axisPt, axisSigmaMass}); + + histos.add(histodir + "/ASigma0/hMass", "hMass", kTH1D, {axisSigmaMass}); + histos.add(histodir + "/ASigma0/hPt", "hPt", kTH1D, {axisPt}); + histos.add(histodir + "/ASigma0/hY", "hY", kTH1D, {axisRapidity}); + histos.add(histodir + "/ASigma0/hRadius", "hRadius", kTH1D, {axisV0PairRadius}); + histos.add(histodir + "/ASigma0/h2dRadiusVspT", "h2dRadiusVspT", kTH2D, {axisV0PairRadius, axisPt}); + histos.add(histodir + "/ASigma0/hDCAPairDau", "hDCAPairDau", kTH1D, {axisDCAdau}); + histos.add(histodir + "/ASigma0/h3dMass", "h3dMass", kTH3D, {axisCentrality, axisPt, axisSigmaMass}); + histos.add(histodir + "/ASigma0/h3dOPAngleVsMass", "h3dOPAngleVsMass", kTH3D, {{140, 0.0f, +7.0f}, axisPt, axisSigmaMass}); + + // Process MC + if (doprocessMonteCarlo) { + histos.add(histodir + "/MC/Photon/hV0ToCollAssoc", "hV0ToCollAssoc", kTH1D, {{2, 0.0f, 2.0f}}); + histos.add(histodir + "/MC/Photon/hPt", "hPt", kTH1D, {axisPt}); + histos.add(histodir + "/MC/Photon/hMCPt", "hMCPt", kTH1D, {axisPt}); + histos.add(histodir + "/MC/Photon/hPosTPCNSigmaEl", "hPosTPCNSigmaEl", kTH1D, {axisTPCNSigma}); + histos.add(histodir + "/MC/Photon/hNegTPCNSigmaEl", "hNegTPCNSigmaEl", kTH1D, {axisTPCNSigma}); + histos.add(histodir + "/MC/Photon/h2dPAVsPt", "h2dPAVsPt", kTH2D, {axisPA, axisPt}); + histos.add(histodir + "/MC/Photon/hPt_BadCollAssig", "hPt_BadCollAssig", kTH1D, {axisPt}); + histos.add(histodir + "/MC/Photon/h2dPAVsPt_BadCollAssig", "h2dPAVsPt_BadCollAssig", kTH2D, {axisPA, axisPt}); + + histos.add(histodir + "/MC/Lambda/hV0ToCollAssoc", "hV0ToCollAssoc", kTH1D, {{2, 0.0f, 2.0f}}); + histos.add(histodir + "/MC/Lambda/hPt", "hPt", kTH1D, {axisPt}); + histos.add(histodir + "/MC/Lambda/hMCPt", "hMCPt", kTH1D, {axisPt}); + histos.add(histodir + "/MC/Lambda/h3dTPCvsTOFNSigma_Pr", "h3dTPCvsTOFNSigma_Pr", kTH3D, {axisTPCNSigma, axisTOFNSigma, axisPt}); + histos.add(histodir + "/MC/Lambda/h3dTPCvsTOFNSigma_Pi", "h3dTPCvsTOFNSigma_Pi", kTH3D, {axisTPCNSigma, axisTOFNSigma, axisPt}); + + histos.add(histodir + "/MC/ALambda/hV0ToCollAssoc", "hV0ToCollAssoc", kTH1D, {{2, 0.0f, 2.0f}}); + histos.add(histodir + "/MC/ALambda/hPt", "hPt", kTH1D, {axisPt}); + histos.add(histodir + "/MC/ALambda/hMCPt", "hMCPt", kTH1D, {axisPt}); + histos.add(histodir + "/MC/ALambda/h3dTPCvsTOFNSigma_Pr", "h3dTPCvsTOFNSigma_Pr", kTH3D, {axisTPCNSigma, axisTOFNSigma, axisPt}); + histos.add(histodir + "/MC/ALambda/h3dTPCvsTOFNSigma_Pi", "h3dTPCvsTOFNSigma_Pi", kTH3D, {axisTPCNSigma, axisTOFNSigma, axisPt}); + + histos.add(histodir + "/MC/h2dArmenteros", "h2dArmenteros", kTH2D, {axisAPAlpha, axisAPQt}); + + histos.add(histodir + "/MC/Sigma0/hPt", "hPt", kTH1D, {axisPt}); + histos.add(histodir + "/MC/Sigma0/hMCPt", "hMCPt", kTH1D, {axisPt}); + histos.add(histodir + "/MC/Sigma0/hMass", "hMass", kTH1D, {axisSigmaMass}); + histos.add(histodir + "/MC/Sigma0/hMCProcess", "hMCProcess", kTH1D, {{50, -0.5f, 49.5f}}); + histos.add(histodir + "/MC/Sigma0/hGenRadius", "hGenRadius", kTH1D, {axisV0PairRadius}); + histos.add(histodir + "/MC/Sigma0/h2dMCPtVsLambdaMCPt", "h2dMCPtVsLambdaMCPt", kTH2D, {axisPt, axisPt}); + histos.add(histodir + "/MC/Sigma0/h2dMCPtVsPhotonMCPt", "h2dMCPtVsPhotonMCPt", kTH2D, {axisPt, axisPt}); + histos.add(histodir + "/MC/Sigma0/h2dMCProcessVsGenRadius", "h2dMCProcessVsGenRadius", kTH2D, {{50, -0.5f, 49.5f}, axisV0PairRadius}); + histos.add(histodir + "/MC/Sigma0/h3dMass", "h3dMass", kTH3D, {axisCentrality, axisPt, axisSigmaMass}); + histos.add(histodir + "/MC/Sigma0/h3dMCProcess", "h3dMCProcess", kTH3D, {{50, -0.5f, 49.5f}, axisPt, axisSigmaMass}); + + histos.add(histodir + "/MC/ASigma0/hPt", "hPt", kTH1D, {axisPt}); + histos.add(histodir + "/MC/ASigma0/hMCPt", "hMCPt", kTH1D, {axisPt}); + histos.add(histodir + "/MC/ASigma0/hMass", "hMass", kTH1D, {axisSigmaMass}); + histos.add(histodir + "/MC/ASigma0/hMCProcess", "hMCProcess", kTH1D, {{50, -0.5f, 49.5f}}); + histos.add(histodir + "/MC/ASigma0/hGenRadius", "hGenRadius", kTH1D, {axisV0PairRadius}); + histos.add(histodir + "/MC/ASigma0/h2dMCPtVsLambdaMCPt", "h2dMCPtVsLambdaMCPt", kTH2D, {axisPt, axisPt}); + histos.add(histodir + "/MC/ASigma0/h2dMCPtVsPhotonMCPt", "h2dMCPtVsPhotonMCPt", kTH2D, {axisPt, axisPt}); + histos.add(histodir + "/MC/ASigma0/h2dMCProcessVsGenRadius", "h2dMCProcessVsGenRadius", kTH2D, {{50, -0.5f, 49.5f}, axisV0PairRadius}); + histos.add(histodir + "/MC/ASigma0/h3dMass", "h3dMass", kTH3D, {axisCentrality, axisPt, axisSigmaMass}); + histos.add(histodir + "/MC/ASigma0/h3dMCProcess", "h3dMCProcess", kTH3D, {{50, -0.5f, 49.5f}, axisPt, axisSigmaMass}); + + // 1/pT Resolution: + if (fillResoQAhistos && histodir == "BeforeSel") { + histos.add(histodir + "/MC/Reso/h3dGammaPtResoVsTPCCR", "h3dGammaPtResoVsTPCCR", kTH3D, {axisInvPt, axisDeltaPt, axisTPCrows}); + histos.add(histodir + "/MC/Reso/h3dGammaPtResoVsTPCCR", "h3dGammaPtResoVsTPCCR", kTH3D, {axisInvPt, axisDeltaPt, axisTPCrows}); + histos.add(histodir + "/MC/Reso/h2dGammaPtResolution", "h2dGammaPtResolution", kTH2D, {axisInvPt, axisDeltaPt}); + histos.add(histodir + "/MC/Reso/h2dLambdaPtResolution", "h2dLambdaPtResolution", kTH2D, {axisInvPt, axisDeltaPt}); + histos.add(histodir + "/MC/Reso/h3dLambdaPtResoVsTPCCR", "h3dLambdaPtResoVsTPCCR", kTH3D, {axisInvPt, axisDeltaPt, axisTPCrows}); + histos.add(histodir + "/MC/Reso/h3dLambdaPtResoVsTPCCR", "h3dLambdaPtResoVsTPCCR", kTH3D, {axisInvPt, axisDeltaPt, axisTPCrows}); + histos.add(histodir + "/MC/Reso/h2dAntiLambdaPtResolution", "h2dAntiLambdaPtResolution", kTH2D, {axisInvPt, axisDeltaPt}); + histos.add(histodir + "/MC/Reso/h3dAntiLambdaPtResoVsTPCCR", "h3dAntiLambdaPtResoVsTPCCR", kTH3D, {axisInvPt, axisDeltaPt, axisTPCrows}); + histos.add(histodir + "/MC/Reso/h3dAntiLambdaPtResoVsTPCCR", "h3dAntiLambdaPtResoVsTPCCR", kTH3D, {axisInvPt, axisDeltaPt, axisTPCrows}); + histos.add(histodir + "/MC/Reso/h2dSigma0PtResolution", "h2dSigma0PtResolution", kTH2D, {axisInvPt, axisDeltaPt}); + histos.add(histodir + "/MC/Reso/h2dAntiSigma0PtResolution", "h2dAntiSigma0PtResolution", kTH2D, {axisInvPt, axisDeltaPt}); + histos.add(histodir + "/MC/Reso/h2dSigma0RadiusResolution", "h2dSigma0RadiusResolution", kTH2D, {axisPt, axisDeltaPt}); + histos.add(histodir + "/MC/Reso/h2dASigma0RadiusResolution", "h2dASigma0RadiusResolution", kTH2D, {axisPt, axisDeltaPt}); + } + + // For background decomposition study + if (fillBkgQAhistos) { + histos.add(histodir + "/MC/BkgStudy/h2dPtVsMassSigma_All", "h2dPtVsMassSigma_All", kTH2D, {axisPt, axisSigmaMass}); + histos.add(histodir + "/MC/BkgStudy/h2dPtVsMassSigma_TrueDaughters", "h2dPtVsMassSigma_TrueDaughters", kTH2D, {axisPt, axisSigmaMass}); + histos.add(histodir + "/MC/BkgStudy/h2dTrueDaughtersMatrix", "h2dTrueDaughtersMatrix", kTHnSparseD, {{10001, -5000.5f, +5000.5f}, {10001, -5000.5f, +5000.5f}}); + histos.add(histodir + "/MC/BkgStudy/h2dPtVsMassSigma_TrueGammaFakeLambda", "h2dPtVsMassSigma_TrueGammaFakeLambda", kTH2D, {axisPt, axisSigmaMass}); + histos.add(histodir + "/MC/BkgStudy/h2dPtVsMassSigma_FakeGammaTrueLambda", "h2dPtVsMassSigma_FakeGammaTrueLambda", kTH2D, {axisPt, axisSigmaMass}); + histos.add(histodir + "/MC/BkgStudy/h2dPtVsMassSigma_FakeDaughters", "h2dPtVsMassSigma_FakeDaughters", kTH2D, {axisPt, axisSigmaMass}); + } } + } + + // Selections + histos.add("Selection/Photon/hCandidateSel", "hCandidateSel", kTH1D, {axisCandSel}); + histos.add("Selection/Lambda/hCandidateSel", "hCandidateSel", kTH1D, {axisCandSel}); + + // For background decomposition study + if (fillBkgQAhistos && doprocessMonteCarlo) { + histos.add("BkgStudy/h2dPtVsMassSigma_All", "h2dPtVsMassSigma_All", kTH2D, {axisPt, axisSigmaMass}); + histos.add("BkgStudy/h2dPtVsMassSigma_TrueDaughters", "h2dPtVsMassSigma_TrueDaughters", kTH2D, {axisPt, axisSigmaMass}); + histos.add("BkgStudy/h2dPtVsMassSigma_TrueGammaFakeLambda", "h2dPtVsMassSigma_TrueGammaFakeLambda", kTH2D, {axisPt, axisSigmaMass}); + histos.add("BkgStudy/h2dPtVsMassSigma_FakeGammaTrueLambda", "h2dPtVsMassSigma_FakeGammaTrueLambda", kTH2D, {axisPt, axisSigmaMass}); + histos.add("BkgStudy/h2dPtVsMassSigma_FakeDaughters", "h2dPtVsMassSigma_FakeDaughters", kTH2D, {axisPt, axisSigmaMass}); + histos.add("BkgStudy/h2dTrueDaughtersMatrix", "h2dTrueDaughtersMatrix", kTHnSparseD, {{10001, -5000.5f, +5000.5f}, {10001, -5000.5f, +5000.5f}}); + histos.add("BkgStudy/h2dTrueGammaFakeLambdaMatrix", "h2dTrueGammaFakeLambdaMatrix", kTHnSparseD, {{10001, -5000.5f, +5000.5f}, {10001, -5000.5f, +5000.5f}}); + histos.add("BkgStudy/h2dFakeGammaTrueLambdaMatrix", "h2dFakeGammaTrueLambdaMatrix", kTHnSparseD, {{10001, -5000.5f, +5000.5f}, {10001, -5000.5f, +5000.5f}}); + histos.add("BkgStudy/h2dFakeDaughtersMatrix", "h2dFakeDaughtersMatrix", kTHnSparseD, {{10001, -5000.5f, +5000.5f}, {10001, -5000.5f, +5000.5f}}); + } + + for (size_t i = 0; i < PhotonSels.size(); ++i) { + const auto& sel = PhotonSels[i]; + + histos.add(Form("Selection/Photon/h2d%s", sel.c_str()), ("h2d" + sel).c_str(), kTH2D, {axisPt, axisPhotonMass}); + histos.get(HIST("Selection/Photon/hCandidateSel"))->GetXaxis()->SetBinLabel(i + 1, sel.c_str()); + histos.add(Form("Selection/Sigma0/h2dPhoton%s", sel.c_str()), ("h2dPhoton" + sel).c_str(), kTH2D, {axisPt, axisSigmaMass}); + } + + for (size_t i = 0; i < LambdaSels.size(); ++i) { + const auto& sel = LambdaSels[i]; - // For background decomposition study - if (fillBkgQAhistos) { - histos.add(histodir + "/MC/BkgStudy/h2dPtVsMassSigma_All", "h2dPtVsMassSigma_All", kTH2F, {axisPt, axisSigmaMass}); - histos.add(histodir + "/MC/BkgStudy/h2dPtVsMassSigma_TrueDaughters", "h2dPtVsMassSigma_TrueDaughters", kTH2F, {axisPt, axisSigmaMass}); - histos.add(histodir + "/MC/BkgStudy/h2dTrueDaughtersMatrix", "h2dTrueDaughtersMatrix", kTHnSparseD, {{10001, -5000.5f, +5000.5f}, {10001, -5000.5f, +5000.5f}}); - histos.add(histodir + "/MC/BkgStudy/h2dPtVsMassSigma_TrueGammaFakeLambda", "h2dPtVsMassSigma_TrueGammaFakeLambda", kTH2F, {axisPt, axisSigmaMass}); - histos.add(histodir + "/MC/BkgStudy/h2dPtVsMassSigma_FakeGammaTrueLambda", "h2dPtVsMassSigma_FakeGammaTrueLambda", kTH2F, {axisPt, axisSigmaMass}); - histos.add(histodir + "/MC/BkgStudy/h2dPtVsMassSigma_FakeDaughters", "h2dPtVsMassSigma_FakeDaughters", kTH2F, {axisPt, axisSigmaMass}); + histos.add(Form("Selection/Lambda/h2d%s", sel.c_str()), ("h2d" + sel).c_str(), kTH2D, {axisPt, axisLambdaMass}); + histos.get(HIST("Selection/Lambda/hCandidateSel"))->GetXaxis()->SetBinLabel(i + 1, sel.c_str()); + histos.add(Form("Selection/Sigma0/h2dLambda%s", sel.c_str()), ("h2dLambda" + sel).c_str(), kTH2D, {axisPt, axisSigmaMass}); + } + } + + if (doprocessPi0RealData || doprocessPi0MonteCarlo) { + histos.add("Pi0/hMass", "hMass", kTH1D, {axisPi0Mass}); + histos.add("Pi0/hPt", "hPt", kTH1D, {axisPt}); + histos.add("Pi0/hY", "hY", kTH1D, {axisRapidity}); + histos.add("Pi0/h3dMass", "h3dMass", kTH3D, {axisCentrality, axisPt, axisPi0Mass}); + histos.add("Pi0/h3dMass_MCAssociated", "h3dMass_MCAssociated", kTH3D, {axisCentrality, axisPt, axisPi0Mass}); + } + + if (doprocessGeneratedRun3 || doprocessPi0GeneratedRun3) { + + histos.add("Gen/hGenEvents", "hGenEvents", kTH2D, {{axisNch}, {2, -0.5f, +1.5f}}); + histos.get(HIST("Gen/hGenEvents"))->GetYaxis()->SetBinLabel(1, "All gen. events"); + histos.get(HIST("Gen/hGenEvents"))->GetYaxis()->SetBinLabel(2, "Gen. with at least 1 rec. events"); + + histos.add("Gen/hGenEventCentrality", "hGenEventCentrality", kTH1D, {axisCentrality}); + histos.add("Gen/hCentralityVsNcoll_beforeEvSel", "hCentralityVsNcoll_beforeEvSel", kTH2D, {axisCentrality, {50, -0.5f, 49.5f}}); + histos.add("Gen/hCentralityVsNcoll_afterEvSel", "hCentralityVsNcoll_afterEvSel", kTH2D, {axisCentrality, {50, -0.5f, 49.5f}}); + histos.add("Gen/hCentralityVsMultMC", "hCentralityVsMultMC", kTH2D, {axisCentrality, axisNch}); + + histos.add("Gen/hEventPVzMC", "hEventPVzMC", kTH1D, {{100, -20.0f, +20.0f}}); + histos.add("Gen/hCentralityVsPVzMC", "hCentralityVsPVzMC", kTH2D, {{101, 0.0f, 101.0f}, {100, -20.0f, +20.0f}}); + + // Sigma0 specific + if (doprocessGeneratedRun3) { + histos.add("Gen/h2dGenSigma0", "h2dGenSigma0", kTH2D, {axisCentrality, axisPt}); + histos.add("Gen/h2dGenAntiSigma0", "h2dGenAntiSigma0", kTH2D, {axisCentrality, axisPt}); + histos.add("Gen/h2dGenSigma0VsMultMC_RecoedEvt", "h2dGenSigma0VsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); + histos.add("Gen/h2dGenAntiSigma0VsMultMC_RecoedEvt", "h2dGenAntiSigma0VsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); + histos.add("Gen/h2dGenSigma0VsMultMC", "h2dGenSigma0VsMultMC", kTH2D, {axisNch, axisPt}); + histos.add("Gen/h2dGenAntiSigma0VsMultMC", "h2dGenAntiSigma0VsMultMC", kTH2D, {axisNch, axisPt}); + + } else { // Pi0 specific + histos.add("Gen/h2dGenPi0VsMultMC_RecoedEvt", "h2dGenPi0VsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); + histos.add("Gen/h2dGenPi0", "h2dGenPi0", kTH2D, {axisCentrality, axisPt}); + histos.add("Gen/h2dGenPi0VsMultMC", "h2dGenPi0VsMultMC", kTH2D, {axisNch, axisPt}); + } + } + } + + // ______________________________________________________ + // Check whether the collision passes our collision selections + // Should work with collisions, mccollisions, stracollisions and stramccollisions tables! + template + bool IsEventAccepted(TCollision const& collision, bool fillHists) + { + if (fillHists) + histos.fill(HIST("hEventSelection"), 0. /* all collisions */); + if (eventSelections.requireSel8 && !collision.sel8()) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 1 /* sel8 collisions */); + if (eventSelections.requireTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 2 /* FT0 vertex (acceptable FT0C-FT0A time difference) collisions */); + if (eventSelections.rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 3 /* Not at ITS ROF border */); + if (eventSelections.rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 4 /* Not at TF border */); + if (std::abs(collision.posZ()) > eventSelections.maxZVtxPosition) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 5 /* vertex-Z selected */); + if (eventSelections.requireIsVertexITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 6 /* Contains at least one ITS-TPC track */); + if (eventSelections.requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 7 /* PV position consistency check */); + if (eventSelections.requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 8 /* PV with at least one contributor matched with TOF */); + if (eventSelections.requireIsVertexTRDmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 9 /* PV with at least one contributor matched with TRD */); + if (eventSelections.rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 10 /* Not at same bunch pile-up */); + if (eventSelections.requireNoCollInTimeRangeStd && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 11 /* No other collision within +/- 2 microseconds or mult above a certain threshold in -4 - -2 microseconds*/); + if (eventSelections.requireNoCollInTimeRangeStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStrict)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 12 /* No other collision within +/- 10 microseconds */); + if (eventSelections.requireNoCollInTimeRangeNarrow && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 13 /* No other collision within +/- 2 microseconds */); + if (eventSelections.requireNoCollInROFStd && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 14 /* No other collision within the same ITS ROF with mult. above a certain threshold */); + if (eventSelections.requireNoCollInROFStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStrict)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 15 /* No other collision within the same ITS ROF */); + if (doPPAnalysis) { // we are in pp + if (eventSelections.requireINEL0 && collision.multNTracksPVeta1() < 1) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 16 /* INEL > 0 */); + if (eventSelections.requireINEL1 && collision.multNTracksPVeta1() < 2) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 17 /* INEL > 1 */); + } else { // we are in Pb-Pb + float collisionOccupancy = eventSelections.useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); + if (eventSelections.minOccupancy >= 0 && collisionOccupancy < eventSelections.minOccupancy) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 16 /* Below min occupancy */); + if (eventSelections.maxOccupancy >= 0 && collisionOccupancy > eventSelections.maxOccupancy) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 17 /* Above max occupancy */); + } + + // Fetch interaction rate only if required (in order to limit ccdb calls) + float interactionRate = (fGetIR) ? rateFetcher.fetch(ccdb.service, collision.timestamp(), collision.runNumber(), irSource, fIRCrashOnNull) * 1.e-3 : -1; + float centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); + + if (fGetIR) { + if (interactionRate < 0) + histos.get(HIST("GeneralQA/hRunNumberNegativeIR"))->Fill(Form("%d", collision.runNumber()), 1); // This lists all run numbers without IR info! + + histos.fill(HIST("GeneralQA/hInteractionRate"), interactionRate); + histos.fill(HIST("GeneralQA/hCentralityVsInteractionRate"), centrality, interactionRate); + } + + if (eventSelections.minIR >= 0 && interactionRate < eventSelections.minIR) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 18 /* Below min IR */); + + if (eventSelections.maxIR >= 0 && interactionRate > eventSelections.maxIR) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 19 /* Above max IR */); + + // Fill centrality histogram after event selection + if (fillHists) + histos.fill(HIST("hEventCentrality"), centrality); + + return true; + } + + // ______________________________________________________ + // Simulated processing + // Return the list of indices to the recoed collision associated to a given MC collision. + template + std::vector getListOfRecoCollIndices(TMCollisions const& mcCollisions, TCollisions const& collisions) + { + std::vector listBestCollisionIdx(mcCollisions.size()); + for (auto const& mcCollision : mcCollisions) { + auto groupedCollisions = collisions.sliceBy(perMcCollision, mcCollision.globalIndex()); + int biggestNContribs = -1; + int bestCollisionIndex = -1; + for (auto const& collision : groupedCollisions) { + // consider event selections in the recoed <-> gen collision association, for the denominator (or numerator) of the efficiency (or signal loss)? + if (eventSelections.useEvtSelInDenomEff) { + if (!IsEventAccepted(collision, false)) { + continue; + } + } + // Find the collision with the biggest nbr of PV contributors + // Follows what was done here: https://github.com/AliceO2Group/O2Physics/blob/master/Common/TableProducer/mcCollsExtra.cxx#L93 + if (biggestNContribs < collision.multPVTotalContributors()) { + biggestNContribs = collision.multPVTotalContributors(); + bestCollisionIndex = collision.globalIndex(); } } + listBestCollisionIdx[mcCollision.globalIndex()] = bestCollisionIndex; } + return listBestCollisionIdx; + } - // Selections - histos.add("Selection/Photon/hCandidateSel", "hCandidateSel", kTH1F, {axisCandSel}); - histos.add("Selection/Lambda/hCandidateSel", "hCandidateSel", kTH1F, {axisCandSel}); + // ______________________________________________________ + // Simulated processing + // Fill generated event information (for event loss/splitting estimation) + template + void fillGeneratedEventProperties(TMCCollisions const& mcCollisions, TCollisions const& collisions) + { + std::vector listBestCollisionIdx(mcCollisions.size()); + for (auto const& mcCollision : mcCollisions) { + // Apply selections on MC collisions + if (eventSelections.applyZVtxSelOnMCPV && std::abs(mcCollision.posZ()) > eventSelections.maxZVtxPosition) { + continue; + } + if (doPPAnalysis) { // we are in pp + if (eventSelections.requireINEL0 && mcCollision.multMCNParticlesEta10() < 1) { + continue; + } + + if (eventSelections.requireINEL1 && mcCollision.multMCNParticlesEta10() < 2) { + continue; + } + } - for (size_t i = 0; i < PhotonSels.size(); ++i) { - const auto& sel = PhotonSels[i]; + histos.fill(HIST("Gen/hGenEvents"), mcCollision.multMCNParticlesEta05(), 0 /* all gen. events*/); - histos.add(Form("Selection/Photon/h2d%s", sel.c_str()), ("h2d" + sel).c_str(), kTH2F, {axisPt, axisPhotonMass}); - histos.get(HIST("Selection/Photon/hCandidateSel"))->GetXaxis()->SetBinLabel(i + 1, sel.c_str()); - histos.add(Form("Selection/Sigma0/h2dPhoton%s", sel.c_str()), ("h2dPhoton" + sel).c_str(), kTH2F, {axisPt, axisSigmaMass}); + auto groupedCollisions = collisions.sliceBy(perMcCollision, mcCollision.globalIndex()); + // Check if there is at least one of the reconstructed collisions associated to this MC collision + // If so, we consider it + bool atLeastOne = false; + int biggestNContribs = -1; + float centrality = 100.5f; + int nCollisions = 0; + for (auto const& collision : groupedCollisions) { + + if (!IsEventAccepted(collision, false)) { + continue; + } + + if (biggestNContribs < collision.multPVTotalContributors()) { + biggestNContribs = collision.multPVTotalContributors(); + centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); + } + + nCollisions++; + atLeastOne = true; + } + + histos.fill(HIST("Gen/hCentralityVsNcoll_beforeEvSel"), centrality, groupedCollisions.size()); + histos.fill(HIST("Gen/hCentralityVsNcoll_afterEvSel"), centrality, nCollisions); + histos.fill(HIST("Gen/hCentralityVsMultMC"), centrality, mcCollision.multMCNParticlesEta05()); + histos.fill(HIST("Gen/hCentralityVsPVzMC"), centrality, mcCollision.posZ()); + histos.fill(HIST("Gen/hEventPVzMC"), mcCollision.posZ()); + + if (atLeastOne) { + histos.fill(HIST("Gen/hGenEvents"), mcCollision.multMCNParticlesEta05(), 1 /* at least 1 rec. event*/); + histos.fill(HIST("Gen/hGenEventCentrality"), centrality); + } } + return; + } + + // ______________________________________________________ + // Simulated processing (subscribes to MC information too) + template + void analyzeGenerated(TMCCollisions const& mcCollisions, TCollisions const& collisions, TGenParticles const& genParticles) + { + fillGeneratedEventProperties(mcCollisions, collisions); + std::vector listBestCollisionIdx = getListOfRecoCollIndices(mcCollisions, collisions); + + for (auto& genParticle : genParticles) { + float centrality = 100.5f; - for (size_t i = 0; i < LambdaSels.size(); ++i) { - const auto& sel = LambdaSels[i]; + // Has MC collision + if (!genParticle.has_straMCCollision()) + continue; + + // Selection on the source (generator/transport) + if (!genParticle.producedByGenerator() && mc_keepOnlyFromGenerator) + continue; + + // Select corresponding mc collision && Basic event selection + auto mcCollision = genParticle.template straMCCollision_as>(); + if (eventSelections.applyZVtxSelOnMCPV && std::abs(mcCollision.posZ()) > eventSelections.maxZVtxPosition) { + continue; + } + if (doPPAnalysis) { // we are in pp + if (eventSelections.requireINEL0 && mcCollision.multMCNParticlesEta10() < 1) { + continue; + } - histos.add(Form("Selection/Lambda/h2d%s", sel.c_str()), ("h2d" + sel).c_str(), kTH2F, {axisPt, axisLambdaMass}); - histos.get(HIST("Selection/Lambda/hCandidateSel"))->GetXaxis()->SetBinLabel(i + 1, sel.c_str()); - histos.add(Form("Selection/Sigma0/h2dLambda%s", sel.c_str()), ("h2dLambda" + sel).c_str(), kTH2F, {axisPt, axisSigmaMass}); + if (eventSelections.requireINEL1 && mcCollision.multMCNParticlesEta10() < 2) { + continue; + } + } + + //______________________________________________________________________________ + // Generated Sigma0 processing + if constexpr (requires { genParticle.sigma0MCPt(); }) { + + float ptmc = genParticle.sigma0MCPt(); + + if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) { + auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]); + centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); + + if (genParticle.isSigma0()) + histos.fill(HIST("Gen/h2dGenSigma0VsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + + else + histos.fill(HIST("Gen/h2dGenAntiSigma0VsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } + + if (genParticle.isSigma0()) { + histos.fill(HIST("Gen/h2dGenSigma0"), centrality, ptmc); + histos.fill(HIST("Gen/h2dGenSigma0VsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + } else { + histos.fill(HIST("Gen/h2dGenAntiSigma0"), centrality, ptmc); + histos.fill(HIST("Gen/h2dGenAntiSigma0VsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + } + } + //______________________________________________________________________________ + // Generated Pi0 processing + if constexpr (requires { genParticle.pi0MCPt(); }) { + float ptmc = genParticle.pi0MCPt(); + + if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) { + auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]); + centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); + histos.fill(HIST("Gen/h2dGenPi0VsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } + + histos.fill(HIST("Gen/h2dGenPi0"), centrality, ptmc); + histos.fill(HIST("Gen/h2dGenPi0VsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + } } } //__________________________________________ - template - int retrieveV0TrackCode(TV0Object const& sigma) + template + int retrieveV0TrackCode(TSigma0Object const& sigma) { int TrkCode = 10; // 1: TPC-only, 2: TPC+Something, 3: ITS-Only, 4: ITS+TPC + Something, 10: anything else @@ -378,67 +862,69 @@ struct sigmaanalysis { return TrkCode; } - template - void getpTResolution(TV0Object const& sigma) + template + void getResolution(TSigma0Object const& sigma) { //_______________________________________ // Gamma MC association - if (sigma.photonCandPDGCode() == 22) { - if (sigma.photonMCPt() > 0) { - histos.fill(HIST("BeforeSel/MC/pTReso/h3dGammaPtResoVsTPCCR"), 1.f / sigma.lambdaMCPt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdaMCPt(), -1 * sigma.photonNegTPCCrossedRows()); // 1/pT resolution - histos.fill(HIST("BeforeSel/MC/pTReso/h3dGammaPtResoVsTPCCR"), 1.f / sigma.lambdaMCPt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdaMCPt(), sigma.photonPosTPCCrossedRows()); // 1/pT resolution - histos.fill(HIST("BeforeSel/MC/pTReso/h2dGammaPtResolution"), 1.f / sigma.photonMCPt(), 1.f / sigma.photonPt() - 1.f / sigma.photonMCPt()); // pT resolution + if (sigma.photonPDGCode() == 22) { + if (sigma.photonmcpt() > 0) { + histos.fill(HIST("BeforeSel/MC/Reso/h3dGammaPtResoVsTPCCR"), 1.f / sigma.lambdamcpt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdamcpt(), -1 * sigma.photonNegTPCCrossedRows()); // 1/pT resolution + histos.fill(HIST("BeforeSel/MC/Reso/h3dGammaPtResoVsTPCCR"), 1.f / sigma.lambdamcpt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdamcpt(), sigma.photonPosTPCCrossedRows()); // 1/pT resolution + histos.fill(HIST("BeforeSel/MC/Reso/h2dGammaPtResolution"), 1.f / sigma.photonmcpt(), 1.f / sigma.photonPt() - 1.f / sigma.photonmcpt()); // pT resolution } } //_______________________________________ // Lambda MC association - if (sigma.lambdaCandPDGCode() == 3122) { - if (sigma.lambdaMCPt() > 0) { - histos.fill(HIST("BeforeSel/MC/pTReso/h2dLambdaPtResolution"), 1.f / sigma.lambdaMCPt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdaMCPt()); // 1/pT resolution - histos.fill(HIST("BeforeSel/MC/pTReso/h3dLambdaPtResoVsTPCCR"), 1.f / sigma.lambdaMCPt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdaMCPt(), -1 * sigma.lambdaNegTPCCrossedRows()); // 1/pT resolution - histos.fill(HIST("BeforeSel/MC/pTReso/h3dLambdaPtResoVsTPCCR"), 1.f / sigma.lambdaMCPt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdaMCPt(), sigma.lambdaPosTPCCrossedRows()); // 1/pT resolution + if (sigma.lambdaPDGCode() == 3122) { + if (sigma.lambdamcpt() > 0) { + histos.fill(HIST("BeforeSel/MC/Reso/h2dLambdaPtResolution"), 1.f / sigma.lambdamcpt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdamcpt()); // 1/pT resolution + histos.fill(HIST("BeforeSel/MC/Reso/h3dLambdaPtResoVsTPCCR"), 1.f / sigma.lambdamcpt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdamcpt(), -1 * sigma.lambdaNegTPCCrossedRows()); // 1/pT resolution + histos.fill(HIST("BeforeSel/MC/Reso/h3dLambdaPtResoVsTPCCR"), 1.f / sigma.lambdamcpt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdamcpt(), sigma.lambdaPosTPCCrossedRows()); // 1/pT resolution } } //_______________________________________ // AntiLambda MC association - if (sigma.lambdaCandPDGCode() == -3122) { - if (sigma.lambdaMCPt() > 0) { - histos.fill(HIST("BeforeSel/MC/pTReso/h2dAntiLambdaPtResolution"), 1.f / sigma.lambdaMCPt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdaMCPt()); // pT resolution - histos.fill(HIST("BeforeSel/MC/pTReso/h3dAntiLambdaPtResoVsTPCCR"), 1.f / sigma.lambdaMCPt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdaMCPt(), -1 * sigma.lambdaNegTPCCrossedRows()); // 1/pT resolution - histos.fill(HIST("BeforeSel/MC/pTReso/h3dAntiLambdaPtResoVsTPCCR"), 1.f / sigma.lambdaMCPt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdaMCPt(), sigma.lambdaPosTPCCrossedRows()); // 1/pT resolution + if (sigma.lambdaPDGCode() == -3122) { + if (sigma.lambdamcpt() > 0) { + histos.fill(HIST("BeforeSel/MC/Reso/h2dAntiLambdaPtResolution"), 1.f / sigma.lambdamcpt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdamcpt()); // pT resolution + histos.fill(HIST("BeforeSel/MC/Reso/h3dAntiLambdaPtResoVsTPCCR"), 1.f / sigma.lambdamcpt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdamcpt(), -1 * sigma.lambdaNegTPCCrossedRows()); // 1/pT resolution + histos.fill(HIST("BeforeSel/MC/Reso/h3dAntiLambdaPtResoVsTPCCR"), 1.f / sigma.lambdamcpt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdamcpt(), sigma.lambdaPosTPCCrossedRows()); // 1/pT resolution } } //_______________________________________ // Sigma and AntiSigma MC association - if (sigma.isSigma()) { - if (sigma.sigmaMCPt() > 0) - histos.fill(HIST("BeforeSel/MC/pTReso/h2dSigma0PtResolution"), 1.f / sigma.sigmaMCPt(), 1.f / sigma.sigmapT() - 1.f / sigma.sigmaMCPt()); // pT resolution + if (sigma.isSigma0()) { + histos.fill(HIST("BeforeSel/MC/Reso/h2dSigma0RadiusResolution"), sigma.mcpt(), sigma.radius() - sigma.mcradius()); // pT resolution + if (sigma.mcpt() > 0) + histos.fill(HIST("BeforeSel/MC/Reso/h2dSigma0PtResolution"), 1.f / sigma.mcpt(), 1.f / sigma.pt() - 1.f / sigma.mcpt()); // pT resolution } - if (sigma.isAntiSigma()) { - if (sigma.sigmaMCPt() > 0) - histos.fill(HIST("BeforeSel/MC/pTReso/h2dAntiSigma0PtResolution"), 1.f / sigma.sigmaMCPt(), 1.f / sigma.sigmapT() - 1.f / sigma.sigmaMCPt()); // pT resolution + if (sigma.isAntiSigma0()) { + histos.fill(HIST("BeforeSel/MC/Reso/h2dASigma0RadiusResolution"), sigma.mcpt(), sigma.radius() - sigma.mcradius()); // pT resolution + if (sigma.mcpt() > 0) + histos.fill(HIST("BeforeSel/MC/Reso/h2dAntiSigma0PtResolution"), 1.f / sigma.mcpt(), 1.f / sigma.pt() - 1.f / sigma.mcpt()); // pT resolution } } // To save histograms for background analysis - template - void runBkgAnalysis(TV0Object const& sigma) + template + void runBkgAnalysis(TSigma0Object const& sigma) { // Check whether it is before or after selections static constexpr std::string_view MainDir[] = {"BeforeSel", "AfterSel"}; - bool fIsSigma = sigma.isSigma(); - bool fIsAntiSigma = sigma.isAntiSigma(); - int PhotonPDGCode = sigma.photonCandPDGCode(); - int PhotonPDGCodeMother = sigma.photonCandPDGCodeMother(); - int LambdaPDGCode = sigma.lambdaCandPDGCode(); - int LambdaPDGCodeMother = sigma.lambdaCandPDGCodeMother(); - float sigmapT = sigma.sigmapT(); - float sigmaMass = sigma.sigmaMass(); + bool fIsSigma = sigma.isSigma0(); + bool fIsAntiSigma = sigma.isAntiSigma0(); + int PhotonPDGCode = sigma.photonPDGCode(); + int PhotonPDGCodeMother = sigma.photonPDGCodeMother(); + int LambdaPDGCode = sigma.lambdaPDGCode(); + int LambdaPDGCodeMother = sigma.lambdaPDGCodeMother(); + float sigmapT = sigma.pt(); + float sigmaMass = sigma.sigma0Mass(); histos.fill(HIST(MainDir[mode]) + HIST("/MC/BkgStudy/h2dPtVsMassSigma_All"), sigmapT, sigmaMass); @@ -465,35 +951,31 @@ struct sigmaanalysis { histos.fill(HIST(MainDir[mode]) + HIST("/MC/BkgStudy/h2dPtVsMassSigma_FakeDaughters"), sigmapT, sigmaMass); } - template - void fillQAHistos(TV0Object const& sigma) + template + void fillHistos(TSigma0Object const& sigma, TCollision const& collision) { // Check whether it is before or after selections - // static std::string main_dir; - // main_dir = IsBeforeSel ? "BeforeSel" : "AfterSel"; static constexpr std::string_view MainDir[] = {"BeforeSel", "AfterSel"}; // Get V0trackCode int GammaTrkCode = retrieveV0TrackCode(sigma); int LambdaTrkCode = retrieveV0TrackCode(sigma); - float photonRZLineCut = TMath::Abs(sigma.photonZconv()) * TMath::Tan(2 * TMath::ATan(TMath::Exp(-PhotonMaxDauEta))) - PhotonLineCutZ0; + float photonRZLineCut = TMath::Abs(sigma.photonZconv()) * TMath::Tan(2 * TMath::ATan(TMath::Exp(-photonSelections.PhotonMaxDauEta))) - photonSelections.PhotonLineCutZ0; + float centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); //_______________________________________ // Photon histos.fill(HIST(MainDir[mode]) + HIST("/Photon/hTrackCode"), GammaTrkCode); histos.fill(HIST(MainDir[mode]) + HIST("/Photon/hV0Type"), sigma.photonV0Type()); - histos.fill(HIST(MainDir[mode]) + HIST("/Photon/hNegpT"), sigma.photonNegPt()); - histos.fill(HIST(MainDir[mode]) + HIST("/Photon/hPospT"), sigma.photonPosPt()); + histos.fill(HIST(MainDir[mode]) + HIST("/Photon/hDCANegToPV"), sigma.photonDCANegPV()); histos.fill(HIST(MainDir[mode]) + HIST("/Photon/hDCAPosToPV"), sigma.photonDCAPosPV()); histos.fill(HIST(MainDir[mode]) + HIST("/Photon/hDCADau"), sigma.photonDCADau()); histos.fill(HIST(MainDir[mode]) + HIST("/Photon/hPosTPCCR"), sigma.photonPosTPCCrossedRows()); histos.fill(HIST(MainDir[mode]) + HIST("/Photon/hNegTPCCR"), sigma.photonNegTPCCrossedRows()); - histos.fill(HIST(MainDir[mode]) + HIST("/Photon/h2dPosTPCNSigmaEl"), sigma.photonPosPt(), sigma.photonPosTPCNSigmaEl()); - histos.fill(HIST(MainDir[mode]) + HIST("/Photon/h2dNegTPCNSigmaEl"), sigma.photonNegPt(), sigma.photonNegTPCNSigmaEl()); - histos.fill(HIST(MainDir[mode]) + HIST("/Photon/h2dPosTPCNSigmaPi"), sigma.photonPosPt(), sigma.photonPosTPCNSigmaPi()); - histos.fill(HIST(MainDir[mode]) + HIST("/Photon/h2dNegTPCNSigmaPi"), sigma.photonNegPt(), sigma.photonNegTPCNSigmaPi()); + histos.fill(HIST(MainDir[mode]) + HIST("/Photon/hPosTPCNSigmaEl"), sigma.photonPosTPCNSigmaEl()); + histos.fill(HIST(MainDir[mode]) + HIST("/Photon/hNegTPCNSigmaEl"), sigma.photonNegTPCNSigmaEl()); histos.fill(HIST(MainDir[mode]) + HIST("/Photon/hpT"), sigma.photonPt()); histos.fill(HIST(MainDir[mode]) + HIST("/Photon/hY"), sigma.photonY()); histos.fill(HIST(MainDir[mode]) + HIST("/Photon/hPosEta"), sigma.photonPosEta()); @@ -505,7 +987,7 @@ struct sigmaanalysis { histos.fill(HIST(MainDir[mode]) + HIST("/Photon/hCosPA"), sigma.photonCosPA()); histos.fill(HIST(MainDir[mode]) + HIST("/Photon/hPsiPair"), sigma.photonPsiPair()); histos.fill(HIST(MainDir[mode]) + HIST("/Photon/hPhi"), sigma.photonPhi()); - histos.fill(HIST(MainDir[mode]) + HIST("/Photon/h3dMass"), sigma.sigmaCentrality(), sigma.photonPt(), sigma.photonMass()); + histos.fill(HIST(MainDir[mode]) + HIST("/Photon/h3dMass"), centrality, sigma.photonPt(), sigma.photonMass()); histos.fill(HIST(MainDir[mode]) + HIST("/Photon/hMass"), sigma.photonMass()); //_______________________________________ @@ -537,14 +1019,16 @@ struct sigmaanalysis { histos.fill(HIST(MainDir[mode]) + HIST("/Lambda/hLambdaDCAPosToPV"), sigma.lambdaDCAPosPV()); histos.fill(HIST(MainDir[mode]) + HIST("/Lambda/hLambdapT"), sigma.lambdaPt()); histos.fill(HIST(MainDir[mode]) + HIST("/Lambda/hLambdaMass"), sigma.lambdaMass()); - histos.fill(HIST(MainDir[mode]) + HIST("/Lambda/h3dLambdaMass"), sigma.sigmaCentrality(), sigma.lambdaPt(), sigma.lambdaMass()); - - histos.fill(HIST(MainDir[mode]) + HIST("/Sigma0/hMass"), sigma.sigmaMass()); - histos.fill(HIST(MainDir[mode]) + HIST("/Sigma0/hPt"), sigma.sigmapT()); - histos.fill(HIST(MainDir[mode]) + HIST("/Sigma0/hY"), sigma.sigmaRapidity()); - histos.fill(HIST(MainDir[mode]) + HIST("/Sigma0/h3dMass"), sigma.sigmaCentrality(), sigma.sigmapT(), sigma.sigmaMass()); - histos.fill(HIST(MainDir[mode]) + HIST("/Sigma0/h3dPhotonRadiusVsMassSigma"), sigma.sigmaCentrality(), sigma.photonRadius(), sigma.sigmaMass()); - histos.fill(HIST(MainDir[mode]) + HIST("/Sigma0/h2dpTVsOPAngle"), sigma.sigmapT(), sigma.sigmaOPAngle()); + histos.fill(HIST(MainDir[mode]) + HIST("/Lambda/h3dLambdaMass"), centrality, sigma.lambdaPt(), sigma.lambdaMass()); + + histos.fill(HIST(MainDir[mode]) + HIST("/Sigma0/hMass"), sigma.sigma0Mass()); + histos.fill(HIST(MainDir[mode]) + HIST("/Sigma0/hPt"), sigma.pt()); + histos.fill(HIST(MainDir[mode]) + HIST("/Sigma0/hY"), sigma.sigma0Y()); + histos.fill(HIST(MainDir[mode]) + HIST("/Sigma0/hRadius"), sigma.radius()); + histos.fill(HIST(MainDir[mode]) + HIST("/Sigma0/h2dRadiusVspT"), sigma.radius(), sigma.pt()); + histos.fill(HIST(MainDir[mode]) + HIST("/Sigma0/hDCAPairDau"), sigma.dcadaughters()); + histos.fill(HIST(MainDir[mode]) + HIST("/Sigma0/h3dMass"), centrality, sigma.pt(), sigma.sigma0Mass()); + histos.fill(HIST(MainDir[mode]) + HIST("/Sigma0/h3dOPAngleVsMass"), sigma.opAngle(), sigma.pt(), sigma.sigma0Mass()); } else { histos.fill(HIST(MainDir[mode]) + HIST("/Lambda/h2dTPCvsTOFNSigma_ALambdaPr"), sigma.lambdaNegPrTPCNSigma(), sigma.aLambdaPrTOFNSigma()); histos.fill(HIST(MainDir[mode]) + HIST("/Lambda/h2dTPCvsTOFNSigma_ALambdaPi"), sigma.lambdaPosPiTPCNSigma(), sigma.aLambdaPiTOFNSigma()); @@ -552,87 +1036,98 @@ struct sigmaanalysis { histos.fill(HIST(MainDir[mode]) + HIST("/Lambda/hALambdaDCAPosToPV"), sigma.lambdaDCAPosPV()); histos.fill(HIST(MainDir[mode]) + HIST("/Lambda/hALambdapT"), sigma.lambdaPt()); histos.fill(HIST(MainDir[mode]) + HIST("/Lambda/hAntiLambdaMass"), sigma.antilambdaMass()); - histos.fill(HIST(MainDir[mode]) + HIST("/Lambda/h3dAntiLambdaMass"), sigma.sigmaCentrality(), sigma.lambdaPt(), sigma.antilambdaMass()); - - histos.fill(HIST(MainDir[mode]) + HIST("/ASigma0/hMass"), sigma.sigmaMass()); - histos.fill(HIST(MainDir[mode]) + HIST("/ASigma0/hPt"), sigma.sigmapT()); - histos.fill(HIST(MainDir[mode]) + HIST("/ASigma0/hY"), sigma.sigmaRapidity()); - histos.fill(HIST(MainDir[mode]) + HIST("/ASigma0/h3dMass"), sigma.sigmaCentrality(), sigma.sigmapT(), sigma.sigmaMass()); - histos.fill(HIST(MainDir[mode]) + HIST("/ASigma0/h3dPhotonRadiusVsMassSigma"), sigma.sigmaCentrality(), sigma.photonRadius(), sigma.sigmaMass()); - histos.fill(HIST(MainDir[mode]) + HIST("/ASigma0/h2dpTVsOPAngle"), sigma.sigmapT(), sigma.sigmaOPAngle()); + histos.fill(HIST(MainDir[mode]) + HIST("/Lambda/h3dAntiLambdaMass"), centrality, sigma.lambdaPt(), sigma.antilambdaMass()); + + histos.fill(HIST(MainDir[mode]) + HIST("/ASigma0/hMass"), sigma.sigma0Mass()); + histos.fill(HIST(MainDir[mode]) + HIST("/ASigma0/hPt"), sigma.pt()); + histos.fill(HIST(MainDir[mode]) + HIST("/ASigma0/hY"), sigma.sigma0Y()); + histos.fill(HIST(MainDir[mode]) + HIST("/ASigma0/hRadius"), sigma.radius()); + histos.fill(HIST(MainDir[mode]) + HIST("/ASigma0/h2dRadiusVspT"), sigma.radius(), sigma.pt()); + histos.fill(HIST(MainDir[mode]) + HIST("/ASigma0/hDCAPairDau"), sigma.dcadaughters()); + histos.fill(HIST(MainDir[mode]) + HIST("/ASigma0/h3dMass"), centrality, sigma.pt(), sigma.sigma0Mass()); + histos.fill(HIST(MainDir[mode]) + HIST("/ASigma0/h3dOPAngleVsMass"), sigma.opAngle(), sigma.pt(), sigma.sigma0Mass()); } //_______________________________________ // MC specific if (doprocessMonteCarlo) { - if constexpr (requires { sigma.lambdaCandPDGCode(); sigma.photonCandPDGCode(); }) { + if constexpr (requires { sigma.lambdaPDGCode(); sigma.photonPDGCode(); }) { //_______________________________________ // Gamma MC association - if (sigma.photonCandPDGCode() == 22) { + if (sigma.photonPDGCode() == 22) { histos.fill(HIST(MainDir[mode]) + HIST("/MC/Photon/hV0ToCollAssoc"), sigma.photonIsCorrectlyAssoc()); histos.fill(HIST(MainDir[mode]) + HIST("/MC/Photon/hPt"), sigma.photonPt()); - histos.fill(HIST(MainDir[mode]) + HIST("/MC/Photon/hMCPt"), sigma.photonMCPt()); + histos.fill(HIST(MainDir[mode]) + HIST("/MC/Photon/hMCPt"), sigma.photonmcpt()); + histos.fill(HIST(MainDir[mode]) + HIST("/MC/Photon/hPosTPCNSigmaEl"), sigma.photonPosTPCNSigmaEl()); + histos.fill(HIST(MainDir[mode]) + HIST("/MC/Photon/hNegTPCNSigmaEl"), sigma.photonNegTPCNSigmaEl()); - histos.fill(HIST(MainDir[mode]) + HIST("/MC/Photon/h2dPosTPCNSigmaEl"), sigma.photonPosPt(), sigma.photonPosTPCNSigmaEl()); - histos.fill(HIST(MainDir[mode]) + HIST("/MC/Photon/h2dNegTPCNSigmaEl"), sigma.photonNegPt(), sigma.photonNegTPCNSigmaEl()); - histos.fill(HIST(MainDir[mode]) + HIST("/MC/Photon/h2dPosTPCNSigmaPi"), sigma.photonPosPt(), sigma.photonPosTPCNSigmaPi()); - histos.fill(HIST(MainDir[mode]) + HIST("/MC/Photon/h2dNegTPCNSigmaPi"), sigma.photonNegPt(), sigma.photonNegTPCNSigmaPi()); - - histos.fill(HIST(MainDir[mode]) + HIST("/MC/Photon/h2dPAVsPt"), TMath::ACos(sigma.photonCosPA()), sigma.photonMCPt()); + histos.fill(HIST(MainDir[mode]) + HIST("/MC/Photon/h2dPAVsPt"), TMath::ACos(sigma.photonCosPA()), sigma.photonmcpt()); if (!sigma.photonIsCorrectlyAssoc()) { - histos.fill(HIST(MainDir[mode]) + HIST("/MC/Photon/hPt_BadCollAssig"), sigma.photonMCPt()); - histos.fill(HIST(MainDir[mode]) + HIST("/MC/Photon/h2dPAVsPt_BadCollAssig"), TMath::ACos(sigma.photonCosPA()), sigma.photonMCPt()); + histos.fill(HIST(MainDir[mode]) + HIST("/MC/Photon/hPt_BadCollAssig"), sigma.photonmcpt()); + histos.fill(HIST(MainDir[mode]) + HIST("/MC/Photon/h2dPAVsPt_BadCollAssig"), TMath::ACos(sigma.photonCosPA()), sigma.photonmcpt()); } } //_______________________________________ // Lambda MC association - if (sigma.lambdaCandPDGCode() == 3122) { + if (sigma.lambdaPDGCode() == 3122) { histos.fill(HIST(MainDir[mode]) + HIST("/MC/Lambda/hV0ToCollAssoc"), sigma.lambdaIsCorrectlyAssoc()); histos.fill(HIST(MainDir[mode]) + HIST("/MC/Lambda/hPt"), sigma.lambdaPt()); - histos.fill(HIST(MainDir[mode]) + HIST("/MC/Lambda/hMCPt"), sigma.lambdaMCPt()); + histos.fill(HIST(MainDir[mode]) + HIST("/MC/Lambda/hMCPt"), sigma.lambdamcpt()); histos.fill(HIST(MainDir[mode]) + HIST("/MC/Lambda/h3dTPCvsTOFNSigma_Pr"), sigma.lambdaPosPrTPCNSigma(), sigma.lambdaPrTOFNSigma(), sigma.lambdaPt()); histos.fill(HIST(MainDir[mode]) + HIST("/MC/Lambda/h3dTPCvsTOFNSigma_Pi"), sigma.lambdaNegPiTPCNSigma(), sigma.lambdaPiTOFNSigma(), sigma.lambdaPt()); } //_______________________________________ // AntiLambda MC association - if (sigma.lambdaCandPDGCode() == -3122) { + if (sigma.lambdaPDGCode() == -3122) { histos.fill(HIST(MainDir[mode]) + HIST("/MC/ALambda/hV0ToCollAssoc"), sigma.lambdaIsCorrectlyAssoc()); histos.fill(HIST(MainDir[mode]) + HIST("/MC/ALambda/hPt"), sigma.lambdaPt()); - histos.fill(HIST(MainDir[mode]) + HIST("/MC/ALambda/hMCPt"), sigma.lambdaMCPt()); + histos.fill(HIST(MainDir[mode]) + HIST("/MC/ALambda/hMCPt"), sigma.lambdamcpt()); histos.fill(HIST(MainDir[mode]) + HIST("/MC/ALambda/h3dTPCvsTOFNSigma_Pr"), sigma.lambdaNegPrTPCNSigma(), sigma.aLambdaPrTOFNSigma(), sigma.lambdaPt()); histos.fill(HIST(MainDir[mode]) + HIST("/MC/ALambda/h3dTPCvsTOFNSigma_Pi"), sigma.lambdaPosPiTPCNSigma(), sigma.aLambdaPiTOFNSigma(), sigma.lambdaPt()); } //_______________________________________ // Sigma0 MC association - if (sigma.isSigma()) { + if (sigma.isSigma0()) { histos.fill(HIST(MainDir[mode]) + HIST("/MC/h2dArmenteros"), sigma.photonAlpha(), sigma.photonQt()); histos.fill(HIST(MainDir[mode]) + HIST("/MC/h2dArmenteros"), sigma.lambdaAlpha(), sigma.lambdaQt()); - histos.fill(HIST(MainDir[mode]) + HIST("/MC/Sigma0/hPt"), sigma.sigmapT()); - histos.fill(HIST(MainDir[mode]) + HIST("/MC/Sigma0/hMCPt"), sigma.sigmaMCPt()); - histos.fill(HIST(MainDir[mode]) + HIST("/MC/Sigma0/h2dMCPtVsLambdaMCPt"), sigma.sigmaMCPt(), sigma.lambdaMCPt()); - histos.fill(HIST(MainDir[mode]) + HIST("/MC/Sigma0/h2dMCPtVsGammaMCPt"), sigma.sigmaMCPt(), sigma.photonMCPt()); - histos.fill(HIST(MainDir[mode]) + HIST("/MC/Sigma0/hMass"), sigma.sigmaMass()); - histos.fill(HIST(MainDir[mode]) + HIST("/MC/Sigma0/h3dMass"), sigma.sigmaCentrality(), sigma.sigmapT(), sigma.sigmaMass()); + histos.fill(HIST(MainDir[mode]) + HIST("/MC/Sigma0/hPt"), sigma.pt()); + histos.fill(HIST(MainDir[mode]) + HIST("/MC/Sigma0/hMCPt"), sigma.mcpt()); + + histos.fill(HIST(MainDir[mode]) + HIST("/MC/Sigma0/h2dMCPtVsLambdaMCPt"), sigma.mcpt(), sigma.lambdamcpt()); + histos.fill(HIST(MainDir[mode]) + HIST("/MC/Sigma0/h2dMCPtVsPhotonMCPt"), sigma.mcpt(), sigma.photonmcpt()); + histos.fill(HIST(MainDir[mode]) + HIST("/MC/Sigma0/hMass"), sigma.sigma0Mass()); + histos.fill(HIST(MainDir[mode]) + HIST("/MC/Sigma0/h3dMass"), centrality, sigma.mcpt(), sigma.sigma0Mass()); + + histos.fill(HIST(MainDir[mode]) + HIST("/MC/Sigma0/hMCProcess"), sigma.mcprocess()); + histos.fill(HIST(MainDir[mode]) + HIST("/MC/Sigma0/hGenRadius"), sigma.mcradius()); + histos.fill(HIST(MainDir[mode]) + HIST("/MC/Sigma0/h2dMCProcessVsGenRadius"), sigma.mcprocess(), sigma.mcradius()); + histos.fill(HIST(MainDir[mode]) + HIST("/MC/Sigma0/h3dMCProcess"), sigma.mcprocess(), sigma.mcpt(), sigma.sigma0Mass()); } //_______________________________________ // AntiSigma0 MC association - if (sigma.isAntiSigma()) { + if (sigma.isAntiSigma0()) { histos.fill(HIST(MainDir[mode]) + HIST("/MC/h2dArmenteros"), sigma.photonAlpha(), sigma.photonQt()); histos.fill(HIST(MainDir[mode]) + HIST("/MC/h2dArmenteros"), sigma.lambdaAlpha(), sigma.lambdaQt()); - histos.fill(HIST(MainDir[mode]) + HIST("/MC/ASigma0/hPt"), sigma.sigmapT()); - histos.fill(HIST(MainDir[mode]) + HIST("/MC/ASigma0/hMCPt"), sigma.sigmaMCPt()); - histos.fill(HIST(MainDir[mode]) + HIST("/MC/ASigma0/h2dMCPtVsLambdaMCPt"), sigma.sigmaMCPt(), sigma.lambdaMCPt()); - histos.fill(HIST(MainDir[mode]) + HIST("/MC/ASigma0/h2dMCPtVsPhotonMCPt"), sigma.sigmaMCPt(), sigma.photonMCPt()); - histos.fill(HIST(MainDir[mode]) + HIST("/MC/ASigma0/hMass"), sigma.sigmaMass()); - histos.fill(HIST(MainDir[mode]) + HIST("/MC/ASigma0/h3dMass"), sigma.sigmaCentrality(), sigma.sigmapT(), sigma.sigmaMass()); + histos.fill(HIST(MainDir[mode]) + HIST("/MC/ASigma0/hPt"), sigma.pt()); + histos.fill(HIST(MainDir[mode]) + HIST("/MC/ASigma0/hMCPt"), sigma.mcpt()); + + histos.fill(HIST(MainDir[mode]) + HIST("/MC/ASigma0/h2dMCPtVsLambdaMCPt"), sigma.mcpt(), sigma.lambdamcpt()); + histos.fill(HIST(MainDir[mode]) + HIST("/MC/ASigma0/h2dMCPtVsPhotonMCPt"), sigma.mcpt(), sigma.photonmcpt()); + histos.fill(HIST(MainDir[mode]) + HIST("/MC/ASigma0/hMass"), sigma.sigma0Mass()); + histos.fill(HIST(MainDir[mode]) + HIST("/MC/ASigma0/h3dMass"), centrality, sigma.mcpt(), sigma.sigma0Mass()); + + histos.fill(HIST(MainDir[mode]) + HIST("/MC/ASigma0/hMCProcess"), sigma.mcprocess()); + histos.fill(HIST(MainDir[mode]) + HIST("/MC/ASigma0/hGenRadius"), sigma.mcradius()); + histos.fill(HIST(MainDir[mode]) + HIST("/MC/ASigma0/h2dMCProcessVsGenRadius"), sigma.mcprocess(), sigma.mcradius()); + histos.fill(HIST(MainDir[mode]) + HIST("/MC/ASigma0/h3dMCProcess"), sigma.mcprocess(), sigma.mcpt(), sigma.sigma0Mass()); } // For background studies: @@ -641,17 +1136,17 @@ struct sigmaanalysis { //_______________________________________ // pT resolution histos - if ((mode == 0) && fillpTResoQAhistos) - getpTResolution(sigma); + if ((mode == 0) && fillResoQAhistos) + getResolution(sigma); } } } - template - void fillSelHistos(TV0Object const& sigma, int PDGRequired) + template + void fillSelHistos(TSigma0Object const& sigma, int PDGRequired) { - static constexpr std::string_view PhotonSelsLocal[] = {"NoSel", "V0Type", "DaupT", "DCADauToPV", + static constexpr std::string_view PhotonSelsLocal[] = {"NoSel", "V0Type", "DCADauToPV", "DCADau", "DauTPCCR", "TPCNSigmaEl", "V0pT", "Y", "V0Radius", "RZCut", "Armenteros", "CosPA", "PsiPair", "Phi", "Mass"}; @@ -664,7 +1159,7 @@ struct sigmaanalysis { if constexpr (selection_index >= 0 && selection_index < (int)std::size(PhotonSelsLocal)) { histos.fill(HIST("Selection/Photon/hCandidateSel"), selection_index); histos.fill(HIST("Selection/Photon/h2d") + HIST(PhotonSelsLocal[selection_index]), sigma.photonPt(), sigma.photonMass()); - histos.fill(HIST("Selection/Sigma0/h2dPhoton") + HIST(PhotonSelsLocal[selection_index]), sigma.sigmapT(), sigma.sigmaMass()); + histos.fill(HIST("Selection/Sigma0/h2dPhoton") + HIST(PhotonSelsLocal[selection_index]), sigma.pt(), sigma.sigma0Mass()); } } @@ -672,7 +1167,7 @@ struct sigmaanalysis { if constexpr (selection_index >= 0 && selection_index < (int)std::size(LambdaSelsLocal)) { histos.fill(HIST("Selection/Lambda/hCandidateSel"), selection_index); histos.fill(HIST("Selection/Lambda/h2d") + HIST(LambdaSelsLocal[selection_index]), sigma.lambdaPt(), sigma.lambdaMass()); - histos.fill(HIST("Selection/Sigma0/h2dLambda") + HIST(LambdaSelsLocal[selection_index]), sigma.sigmapT(), sigma.sigmaMass()); + histos.fill(HIST("Selection/Sigma0/h2dLambda") + HIST(LambdaSelsLocal[selection_index]), sigma.pt(), sigma.sigma0Mass()); } } } @@ -682,73 +1177,69 @@ struct sigmaanalysis { bool selectPhoton(TV0Object const& cand) { fillSelHistos<0>(cand, 22); - if (cand.photonV0Type() != Photonv0TypeSel && Photonv0TypeSel > -1) + if (cand.photonV0Type() != photonSelections.Photonv0TypeSel && photonSelections.Photonv0TypeSel > -1) return false; fillSelHistos<1>(cand, 22); - if ((cand.photonPosPt() < PhotonDauMinPt) || (cand.photonNegPt() < PhotonDauMinPt)) + if ((TMath::Abs(cand.photonDCAPosPV()) < photonSelections.PhotonMinDCADauToPv) || (TMath::Abs(cand.photonDCANegPV()) < photonSelections.PhotonMinDCADauToPv)) return false; fillSelHistos<2>(cand, 22); - if ((TMath::Abs(cand.photonDCAPosPV()) < PhotonMinDCADauToPv) || (TMath::Abs(cand.photonDCANegPV()) < PhotonMinDCADauToPv)) + if (TMath::Abs(cand.photonDCADau()) > photonSelections.PhotonMaxDCAV0Dau) return false; fillSelHistos<3>(cand, 22); - if (TMath::Abs(cand.photonDCADau()) > PhotonMaxDCAV0Dau) + if ((cand.photonPosTPCCrossedRows() < photonSelections.PhotonMinTPCCrossedRows) || (cand.photonNegTPCCrossedRows() < photonSelections.PhotonMinTPCCrossedRows)) return false; fillSelHistos<4>(cand, 22); - if ((cand.photonPosTPCCrossedRows() < PhotonMinTPCCrossedRows) || (cand.photonNegTPCCrossedRows() < PhotonMinTPCCrossedRows)) + if (((cand.photonPosTPCNSigmaEl() < photonSelections.PhotonMinTPCNSigmas) || (cand.photonPosTPCNSigmaEl() > photonSelections.PhotonMaxTPCNSigmas))) return false; - fillSelHistos<5>(cand, 22); - if (((cand.photonPosTPCNSigmaEl() < PhotonMinTPCNSigmas) || (cand.photonPosTPCNSigmaEl() > PhotonMaxTPCNSigmas))) + if (((cand.photonNegTPCNSigmaEl() < photonSelections.PhotonMinTPCNSigmas) || (cand.photonNegTPCNSigmaEl() > photonSelections.PhotonMaxTPCNSigmas))) return false; - if (((cand.photonNegTPCNSigmaEl() < PhotonMinTPCNSigmas) || (cand.photonNegTPCNSigmaEl() > PhotonMaxTPCNSigmas))) + fillSelHistos<5>(cand, 22); + if ((cand.photonPt() < photonSelections.PhotonMinPt) || (cand.photonPt() > photonSelections.PhotonMaxPt)) return false; fillSelHistos<6>(cand, 22); - if ((cand.photonPt() < PhotonMinPt) || (cand.photonPt() > PhotonMaxPt)) + if ((TMath::Abs(cand.photonY()) > photonSelections.PhotonMaxRap) || (TMath::Abs(cand.photonPosEta()) > photonSelections.PhotonMaxDauEta) || (TMath::Abs(cand.photonNegEta()) > photonSelections.PhotonMaxDauEta)) return false; fillSelHistos<7>(cand, 22); - if ((TMath::Abs(cand.photonY()) > PhotonMaxRap) || (TMath::Abs(cand.photonPosEta()) > PhotonMaxDauEta) || (TMath::Abs(cand.photonNegEta()) > PhotonMaxDauEta)) + if ((cand.photonRadius() < photonSelections.PhotonMinRadius) || (cand.photonRadius() > photonSelections.PhotonMaxRadius)) return false; fillSelHistos<8>(cand, 22); - if ((cand.photonRadius() < PhotonMinRadius) || (cand.photonRadius() > PhotonMaxRadius)) + float photonRZLineCut = TMath::Abs(cand.photonZconv()) * TMath::Tan(2 * TMath::ATan(TMath::Exp(-photonSelections.PhotonMaxDauEta))) - photonSelections.PhotonLineCutZ0; + if ((TMath::Abs(cand.photonRadius()) < photonRZLineCut) || (TMath::Abs(cand.photonZconv()) > photonSelections.PhotonMaxZ)) return false; fillSelHistos<9>(cand, 22); - float photonRZLineCut = TMath::Abs(cand.photonZconv()) * TMath::Tan(2 * TMath::ATan(TMath::Exp(-PhotonMaxDauEta))) - PhotonLineCutZ0; - if ((TMath::Abs(cand.photonRadius()) < photonRZLineCut) || (TMath::Abs(cand.photonZconv()) > PhotonMaxZ)) + if (cand.photonQt() > photonSelections.PhotonMaxQt) return false; - fillSelHistos<10>(cand, 22); - if (cand.photonQt() > PhotonMaxQt) + if (TMath::Abs(cand.photonAlpha()) > photonSelections.PhotonMaxAlpha) return false; - if (TMath::Abs(cand.photonAlpha()) > PhotonMaxAlpha) + fillSelHistos<10>(cand, 22); + if (cand.photonCosPA() < photonSelections.PhotonMinV0cospa) return false; fillSelHistos<11>(cand, 22); - if (cand.photonCosPA() < PhotonMinV0cospa) + if (TMath::Abs(cand.photonPsiPair()) > photonSelections.PhotonPsiPairMax) return false; fillSelHistos<12>(cand, 22); - if (TMath::Abs(cand.photonPsiPair()) > PhotonPsiPairMax) + if ((((cand.photonPhi() > photonSelections.PhotonPhiMin1) && (cand.photonPhi() < photonSelections.PhotonPhiMax1)) || ((cand.photonPhi() > photonSelections.PhotonPhiMin2) && (cand.photonPhi() < photonSelections.PhotonPhiMax2))) && ((photonSelections.PhotonPhiMin1 != -1) && (photonSelections.PhotonPhiMax1 != -1) && (photonSelections.PhotonPhiMin2 != -1) && (photonSelections.PhotonPhiMax2 != -1))) return false; fillSelHistos<13>(cand, 22); - if ((((cand.photonPhi() > PhotonPhiMin1) && (cand.photonPhi() < PhotonPhiMax1)) || ((cand.photonPhi() > PhotonPhiMin2) && (cand.photonPhi() < PhotonPhiMax2))) && ((PhotonPhiMin1 != -1) && (PhotonPhiMax1 != -1) && (PhotonPhiMin2 != -1) && (PhotonPhiMax2 != -1))) + if (TMath::Abs(cand.photonMass()) > photonSelections.PhotonMaxMass) return false; fillSelHistos<14>(cand, 22); - if (TMath::Abs(cand.photonMass()) > PhotonMaxMass) - return false; - - fillSelHistos<15>(cand, 22); return true; } @@ -757,68 +1248,68 @@ struct sigmaanalysis { bool selectLambda(TV0Object const& cand) { fillSelHistos<0>(cand, 3122); - if ((cand.lambdaRadius() < LambdaMinv0radius) || (cand.lambdaRadius() > LambdaMaxv0radius)) + if ((cand.lambdaRadius() < lambdaSelections.LambdaMinv0radius) || (cand.lambdaRadius() > lambdaSelections.LambdaMaxv0radius)) return false; fillSelHistos<1>(cand, 3122); - if (TMath::Abs(cand.lambdaDCADau()) > LambdaMaxDCAV0Dau) + if (TMath::Abs(cand.lambdaDCADau()) > lambdaSelections.LambdaMaxDCAV0Dau) return false; fillSelHistos<2>(cand, 3122); - if ((cand.lambdaQt() < LambdaMinQt) || (cand.lambdaQt() > LambdaMaxQt)) + if ((cand.lambdaQt() < lambdaSelections.LambdaMinQt) || (cand.lambdaQt() > lambdaSelections.LambdaMaxQt)) return false; - if ((TMath::Abs(cand.lambdaAlpha()) < LambdaMinAlpha) || (TMath::Abs(cand.lambdaAlpha()) > LambdaMaxAlpha)) + if ((TMath::Abs(cand.lambdaAlpha()) < lambdaSelections.LambdaMinAlpha) || (TMath::Abs(cand.lambdaAlpha()) > lambdaSelections.LambdaMaxAlpha)) return false; fillSelHistos<3>(cand, 3122); - if (cand.lambdaCosPA() < LambdaMinv0cospa) + if (cand.lambdaCosPA() < lambdaSelections.LambdaMinv0cospa) return false; fillSelHistos<4>(cand, 3122); - if ((TMath::Abs(cand.lambdaY()) > LambdaMaxRap) || (TMath::Abs(cand.lambdaPosEta()) > LambdaMaxDauEta) || (TMath::Abs(cand.lambdaNegEta()) > LambdaMaxDauEta)) + if ((TMath::Abs(cand.lambdaY()) > lambdaSelections.LambdaMaxRap) || (TMath::Abs(cand.lambdaPosEta()) > lambdaSelections.LambdaMaxDauEta) || (TMath::Abs(cand.lambdaNegEta()) > lambdaSelections.LambdaMaxDauEta)) return false; fillSelHistos<5>(cand, 3122); - if ((cand.lambdaPosTPCCrossedRows() < LambdaMinTPCCrossedRows) || (cand.lambdaNegTPCCrossedRows() < LambdaMinTPCCrossedRows)) + if ((cand.lambdaPosTPCCrossedRows() < lambdaSelections.LambdaMinTPCCrossedRows) || (cand.lambdaNegTPCCrossedRows() < lambdaSelections.LambdaMinTPCCrossedRows)) return false; fillSelHistos<6>(cand, 3122); // check minimum number of ITS clusters + reject ITS afterburner tracks if requested bool posIsFromAfterburner = cand.lambdaPosChi2PerNcl() < 0; bool negIsFromAfterburner = cand.lambdaNegChi2PerNcl() < 0; - if (cand.lambdaPosITSCls() < LambdaMinITSclusters && (!LambdaRejectPosITSafterburner || posIsFromAfterburner)) + if (cand.lambdaPosITSCls() < lambdaSelections.LambdaMinITSclusters && (!lambdaSelections.LambdaRejectPosITSafterburner || posIsFromAfterburner)) return false; - if (cand.lambdaNegITSCls() < LambdaMinITSclusters && (!LambdaRejectNegITSafterburner || negIsFromAfterburner)) + if (cand.lambdaNegITSCls() < lambdaSelections.LambdaMinITSclusters && (!lambdaSelections.LambdaRejectNegITSafterburner || negIsFromAfterburner)) return false; fillSelHistos<7>(cand, 3122); - if (cand.lambdaLifeTime() > LambdaMaxLifeTime) + if (cand.lambdaLifeTime() > lambdaSelections.LambdaMaxLifeTime) return false; // Separating lambda and antilambda selections: fillSelHistos<8>(cand, 3122); if (cand.lambdaAlpha() > 0) { // Lambda selection // TPC Selection - if (fselLambdaTPCPID && (TMath::Abs(cand.lambdaPosPrTPCNSigma()) > LambdaMaxTPCNSigmas)) + if (lambdaSelections.fselLambdaTPCPID && (TMath::Abs(cand.lambdaPosPrTPCNSigma()) > lambdaSelections.LambdaMaxTPCNSigmas)) return false; - if (fselLambdaTPCPID && (TMath::Abs(cand.lambdaNegPiTPCNSigma()) > LambdaMaxTPCNSigmas)) + if (lambdaSelections.fselLambdaTPCPID && (TMath::Abs(cand.lambdaNegPiTPCNSigma()) > lambdaSelections.LambdaMaxTPCNSigmas)) return false; // TOF Selection - if (fselLambdaTOFPID && (TMath::Abs(cand.lambdaPrTOFNSigma()) > LambdaPrMaxTOFNSigmas)) + if (lambdaSelections.fselLambdaTOFPID && (TMath::Abs(cand.lambdaPrTOFNSigma()) > lambdaSelections.LambdaPrMaxTOFNSigmas)) return false; - if (fselLambdaTOFPID && (TMath::Abs(cand.lambdaPiTOFNSigma()) > LambdaPiMaxTOFNSigmas)) + if (lambdaSelections.fselLambdaTOFPID && (TMath::Abs(cand.lambdaPiTOFNSigma()) > lambdaSelections.LambdaPiMaxTOFNSigmas)) return false; // DCA Selection fillSelHistos<9>(cand, 3122); - if ((TMath::Abs(cand.lambdaDCAPosPV()) < LambdaMinDCAPosToPv) || (TMath::Abs(cand.lambdaDCANegPV()) < LambdaMinDCANegToPv)) + if ((TMath::Abs(cand.lambdaDCAPosPV()) < lambdaSelections.LambdaMinDCAPosToPv) || (TMath::Abs(cand.lambdaDCANegPV()) < lambdaSelections.LambdaMinDCANegToPv)) return false; // Mass Selection fillSelHistos<10>(cand, 3122); - if (TMath::Abs(cand.lambdaMass() - o2::constants::physics::MassLambda0) > LambdaWindow) + if (TMath::Abs(cand.lambdaMass() - o2::constants::physics::MassLambda0) > lambdaSelections.LambdaWindow) return false; fillSelHistos<11>(cand, 3122); @@ -826,25 +1317,25 @@ struct sigmaanalysis { } else { // AntiLambda selection // TPC Selection - if (fselLambdaTPCPID && (TMath::Abs(cand.lambdaPosPiTPCNSigma()) > LambdaMaxTPCNSigmas)) + if (lambdaSelections.fselLambdaTPCPID && (TMath::Abs(cand.lambdaPosPiTPCNSigma()) > lambdaSelections.LambdaMaxTPCNSigmas)) return false; - if (fselLambdaTPCPID && (TMath::Abs(cand.lambdaNegPrTPCNSigma()) > LambdaMaxTPCNSigmas)) + if (lambdaSelections.fselLambdaTPCPID && (TMath::Abs(cand.lambdaNegPrTPCNSigma()) > lambdaSelections.LambdaMaxTPCNSigmas)) return false; // TOF Selection - if (fselLambdaTOFPID && (TMath::Abs(cand.aLambdaPrTOFNSigma()) > LambdaPrMaxTOFNSigmas)) + if (lambdaSelections.fselLambdaTOFPID && (TMath::Abs(cand.aLambdaPrTOFNSigma()) > lambdaSelections.LambdaPrMaxTOFNSigmas)) return false; - if (fselLambdaTOFPID && (TMath::Abs(cand.aLambdaPiTOFNSigma()) > LambdaPiMaxTOFNSigmas)) + if (lambdaSelections.fselLambdaTOFPID && (TMath::Abs(cand.aLambdaPiTOFNSigma()) > lambdaSelections.LambdaPiMaxTOFNSigmas)) return false; // DCA Selection fillSelHistos<9>(cand, 3122); - if ((TMath::Abs(cand.lambdaDCAPosPV()) < ALambdaMinDCAPosToPv) || (TMath::Abs(cand.lambdaDCANegPV()) < ALambdaMinDCANegToPv)) + if ((TMath::Abs(cand.lambdaDCAPosPV()) < lambdaSelections.ALambdaMinDCAPosToPv) || (TMath::Abs(cand.lambdaDCANegPV()) < lambdaSelections.ALambdaMinDCANegToPv)) return false; // Mass Selection fillSelHistos<10>(cand, 3122); - if (TMath::Abs(cand.antilambdaMass() - o2::constants::physics::MassLambda0) > LambdaWindow) + if (TMath::Abs(cand.antilambdaMass() - o2::constants::physics::MassLambda0) > lambdaSelections.LambdaWindow) return false; fillSelHistos<11>(cand, 3122); @@ -854,85 +1345,254 @@ struct sigmaanalysis { } // Apply selections in sigma0 candidates - template - bool processSigmaCandidate(TV0Object const& cand) + template + bool processSigma0Candidate(TSigma0Object const& cand) { + // Photon specific selections + if (!selectPhoton(cand)) + return false; - // Do ML analysis - if (fUseMLSel) { - if ((cand.gammaBDTScore() == -1) || (cand.lambdaBDTScore() == -1) || (cand.antilambdaBDTScore() == -1)) { - LOGF(fatal, "ML Score is not available! Please, enable gamma and lambda selection with ML in sigmabuilder!"); - } - // Photon selection: - if (cand.gammaBDTScore() <= Gamma_MLThreshold) - return false; + // Lambda specific selections + if (!selectLambda(cand)) + return false; - // Lambda selection: - if (cand.lambdaBDTScore() <= Lambda_MLThreshold) + // Sigma0 specific selections + // Rapidity + if constexpr (requires { cand.sigma0MCY(); }) { // MC + if (TMath::Abs(cand.sigma0MCY()) > sigma0Selections.Sigma0MaxRap) return false; - - // AntiLambda selection: - if (cand.antilambdaBDTScore() <= AntiLambda_MLThreshold) + } else { // Real data + if (TMath::Abs(cand.sigma0Y()) > sigma0Selections.Sigma0MaxRap) return false; + } + + // V0Pair Radius + if (cand.radius() > sigma0Selections.Sigma0MaxRadius) + return false; + + // DCA V0Pair Daughters + if (cand.dcadaughters() > sigma0Selections.Sigma0MaxDCADau) + return false; + // Opening Angle + if (cand.opAngle() > sigma0Selections.Sigma0MaxOPAngle) + return false; + + return true; + } + + // Main analysis function + template + void analyzeRecoeSigma0s(TCollisions const& collisions, TSigma0s const& fullSigma0s) + { + // Custom grouping + std::vector> sigma0grouped(collisions.size()); + + for (const auto& sigma0 : fullSigma0s) { + sigma0grouped[sigma0.straCollisionId()].push_back(sigma0.globalIndex()); } - // Go for standard analysis - else { + // Collisions loop + for (const auto& coll : collisions) { - // Photon specific selections - if (!selectPhoton(cand)) - return false; + // Event selection + if (!IsEventAccepted(coll, true)) + continue; - // Lambda specific selections - if (!selectLambda(cand)) - return false; + // Sigma0s loop + for (size_t i = 0; i < sigma0grouped[coll.globalIndex()].size(); i++) { + auto sigma0 = fullSigma0s.rawIteratorAt(sigma0grouped[coll.globalIndex()][i]); + + // if MC + if constexpr (requires { sigma0.isSigma0(); sigma0.isAntiSigma0(); }) { + if (doMCAssociation && !(sigma0.isSigma0() || sigma0.isAntiSigma0())) + continue; + + if (selRecoFromGenerator && !sigma0.isProducedByGenerator()) + continue; + } + + // Fill histos before any selection + fillHistos<0>(sigma0, coll); + + // Select sigma0 candidates + if (!processSigma0Candidate(sigma0)) + continue; + + // Fill histos after all selections + fillHistos<1>(sigma0, coll); + } + } + } + + // Apply selections in sigma0 candidates + template + bool processPi0Candidate(TPi0Object const& cand) + { + if ((cand.photon1V0Type() != photonSelections.Photonv0TypeSel || cand.photon2V0Type() != photonSelections.Photonv0TypeSel) && photonSelections.Photonv0TypeSel > -1) + return false; + + if ((TMath::Abs(cand.photon1DCAPosPV()) < photonSelections.PhotonMinDCADauToPv) || + (TMath::Abs(cand.photon2DCAPosPV()) < photonSelections.PhotonMinDCADauToPv) || + (TMath::Abs(cand.photon1DCANegPV()) < photonSelections.PhotonMinDCADauToPv) || + (TMath::Abs(cand.photon2DCANegPV()) < photonSelections.PhotonMinDCADauToPv)) + return false; + + if ((TMath::Abs(cand.photon1DCADau()) > photonSelections.PhotonMaxDCAV0Dau) || (TMath::Abs(cand.photon2DCADau()) > photonSelections.PhotonMaxDCAV0Dau)) + return false; + + if ((cand.photon1PosTPCCrossedRows() < photonSelections.PhotonMinTPCCrossedRows) || + (cand.photon2PosTPCCrossedRows() < photonSelections.PhotonMinTPCCrossedRows) || + (cand.photon1NegTPCCrossedRows() < photonSelections.PhotonMinTPCCrossedRows) || + (cand.photon2NegTPCCrossedRows() < photonSelections.PhotonMinTPCCrossedRows)) + return false; + + if (((cand.photon1PosTPCNSigmaEl() < photonSelections.PhotonMinTPCNSigmas) || + (cand.photon1PosTPCNSigmaEl() > photonSelections.PhotonMaxTPCNSigmas)) || + ((cand.photon2PosTPCNSigmaEl() < photonSelections.PhotonMinTPCNSigmas) || + (cand.photon2PosTPCNSigmaEl() > photonSelections.PhotonMaxTPCNSigmas))) + return false; + + if (((cand.photon1NegTPCNSigmaEl() < photonSelections.PhotonMinTPCNSigmas) || + (cand.photon1NegTPCNSigmaEl() > photonSelections.PhotonMaxTPCNSigmas)) || + ((cand.photon2NegTPCNSigmaEl() < photonSelections.PhotonMinTPCNSigmas) || + (cand.photon2NegTPCNSigmaEl() > photonSelections.PhotonMaxTPCNSigmas))) + return false; + + if (((cand.photon1Pt() < photonSelections.PhotonMinPt) || + (cand.photon1Pt() > photonSelections.PhotonMaxPt)) || + ((cand.photon2Pt() < photonSelections.PhotonMinPt) || + (cand.photon2Pt() > photonSelections.PhotonMaxPt))) + return false; + + if ((TMath::Abs(cand.photon1Y()) > photonSelections.PhotonMaxRap) || (TMath::Abs(cand.photon1PosEta()) > photonSelections.PhotonMaxDauEta) || (TMath::Abs(cand.photon1NegEta()) > photonSelections.PhotonMaxDauEta)) + return false; + + if ((TMath::Abs(cand.photon2Y()) > photonSelections.PhotonMaxRap) || (TMath::Abs(cand.photon2PosEta()) > photonSelections.PhotonMaxDauEta) || (TMath::Abs(cand.photon2NegEta()) > photonSelections.PhotonMaxDauEta)) + return false; + + if (((cand.photon1Radius() < photonSelections.PhotonMinRadius) || (cand.photon1Radius() > photonSelections.PhotonMaxRadius)) || + ((cand.photon2Radius() < photonSelections.PhotonMinRadius) || (cand.photon2Radius() > photonSelections.PhotonMaxRadius))) + return false; + + if ((cand.photon1Qt() > photonSelections.PhotonMaxQt) || cand.photon2Qt() > photonSelections.PhotonMaxQt) + return false; + + if ((TMath::Abs(cand.photon1Alpha()) > photonSelections.PhotonMaxAlpha) || (TMath::Abs(cand.photon2Alpha()) > photonSelections.PhotonMaxAlpha)) + return false; + + if ((cand.photon1CosPA() < photonSelections.PhotonMinV0cospa) || (cand.photon2CosPA() < photonSelections.PhotonMinV0cospa)) + return false; - // Sigma0 specific selections - if (TMath::Abs(cand.sigmaRapidity()) > SigmaMaxRap) + if ((TMath::Abs(cand.photon1Mass()) > photonSelections.PhotonMaxMass) || (TMath::Abs(cand.photon2Mass()) > photonSelections.PhotonMaxMass)) + return false; + + // Pi0 specific selections + if constexpr (requires { cand.pi0MCY(); }) { // MC + if (TMath::Abs(cand.pi0MCY()) > pi0Selections.Pi0MaxRap) + return false; + } else { // DATA + if (TMath::Abs(cand.pi0Y()) > pi0Selections.Pi0MaxRap) return false; } + // V0Pair Radius + if (cand.radius() > pi0Selections.Pi0MaxRadius) + return false; + + // DCA V0Pair Daughters + if (cand.dcadaughters() > pi0Selections.Pi0MaxDCADau) + return false; + return true; } - void processMonteCarlo(V0MCSigmas const& sigmas) + // Main Pi0 QA analysis function + template + void analyzeRecoePi0s(TCollisions const& collisions, TPi0s const& fullPi0s) { - for (auto& sigma : sigmas) { // selecting Sigma0-like candidates - if (doMCAssociation && !(sigma.isSigma() || sigma.isAntiSigma())) { - continue; - } + // Custom grouping + std::vector> pi0grouped(collisions.size()); - // Fill histos before any selection - fillQAHistos<0>(sigma); + for (const auto& pi0 : fullPi0s) { + pi0grouped[pi0.straCollisionId()].push_back(pi0.globalIndex()); + } + + // Collisions loop + for (const auto& coll : collisions) { - // Select sigma0 candidates - if (!processSigmaCandidate(sigma)) + // Event selection + if (!IsEventAccepted(coll, true)) continue; - // Fill histos after all selections - fillQAHistos<1>(sigma); + // Pi0s loop + float centrality = doPPAnalysis ? coll.centFT0M() : coll.centFT0C(); + + for (size_t i = 0; i < pi0grouped[coll.globalIndex()].size(); i++) { + auto pi0 = fullPi0s.rawIteratorAt(pi0grouped[coll.globalIndex()][i]); + + // Select sigma0 candidates + if (!processPi0Candidate(pi0)) + continue; + + // If MC + if constexpr (requires { pi0.isPi0(); }) { + if (selRecoFromGenerator && !pi0.isProducedByGenerator()) + continue; + + if (pi0.isPi0()) + histos.fill(HIST("Pi0/h3dMass_MCAssociated"), centrality, pi0.mcpt(), pi0.pi0Mass()); + } + + // Fill histos after all selections + histos.fill(HIST("Pi0/hMass"), pi0.pi0Mass()); + histos.fill(HIST("Pi0/hPt"), pi0.pt()); + histos.fill(HIST("Pi0/hY"), pi0.pi0Y()); + histos.fill(HIST("Pi0/h3dMass"), centrality, pi0.pt(), pi0.pi0Mass()); + } } } - void processRealData(V0Sigmas const& sigmas) + void processRealData(soa::Join const& collisions, Sigma0s const& fullSigma0s) { - for (auto& sigma : sigmas) { // selecting Sigma0-like candidates + analyzeRecoeSigma0s(collisions, fullSigma0s); + } - // Fill histos before any selection - fillQAHistos<0>(sigma); + void processMonteCarlo(soa::Join const& collisions, MCSigma0s const& fullSigma0s) + { + analyzeRecoeSigma0s(collisions, fullSigma0s); + } - // Select sigma0 candidates - if (!processSigmaCandidate(sigma)) - continue; + // Simulated processing in Run 3 + void processGeneratedRun3(soa::Join const& mcCollisions, soa::Join const& collisions, soa::Join const& Sigma0Gens) + { + analyzeGenerated(mcCollisions, collisions, Sigma0Gens); + } - // Fill histos after all selections - fillQAHistos<1>(sigma); - } + // _____________________________________________________ + // Pi0 QA + void processPi0RealData(soa::Join const& collisions, soa::Join const& fullPi0s) + { + analyzeRecoePi0s(collisions, fullPi0s); } - PROCESS_SWITCH(sigmaanalysis, processMonteCarlo, "Do Monte-Carlo-based analysis", false); + void processPi0MonteCarlo(soa::Join const& collisions, soa::Join const& fullPi0s) + { + analyzeRecoePi0s(collisions, fullPi0s); + } + + void processPi0GeneratedRun3(soa::Join const& mcCollisions, soa::Join const& collisions, soa::Join const& Pi0Gens) + { + analyzeGenerated(mcCollisions, collisions, Pi0Gens); + } + + // _____________________________________________________ PROCESS_SWITCH(sigmaanalysis, processRealData, "Do real data analysis", true); + PROCESS_SWITCH(sigmaanalysis, processMonteCarlo, "Do Monte-Carlo-based analysis", false); + PROCESS_SWITCH(sigmaanalysis, processGeneratedRun3, "process MC generated Run 3", false); + PROCESS_SWITCH(sigmaanalysis, processPi0RealData, "Do real data analysis for pi0 QA", false); + PROCESS_SWITCH(sigmaanalysis, processPi0MonteCarlo, "Do Monte-Carlo-based analysis for pi0 QA", false); + PROCESS_SWITCH(sigmaanalysis, processPi0GeneratedRun3, "process MC generated Run 3 for pi0 QA", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 408545e89387a09044a2a2f956340f4822122138 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 22 Aug 2025 20:28:25 +0200 Subject: [PATCH 156/986] [PWGEM/PhotonMeson] add cfgRequireTVXinEMC (#12688) --- PWGEM/Dilepton/TableProducer/eventSelection.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PWGEM/Dilepton/TableProducer/eventSelection.cxx b/PWGEM/Dilepton/TableProducer/eventSelection.cxx index d4d33e83cc5..89acb23000c 100644 --- a/PWGEM/Dilepton/TableProducer/eventSelection.cxx +++ b/PWGEM/Dilepton/TableProducer/eventSelection.cxx @@ -61,6 +61,8 @@ struct EMEventSelection { Configurable cfgFT0COccupancyMax{"cfgFT0COccupancyMax", 1000000000, "max. occupancy"}; Configurable cfgRequireNoCollInTimeRangeStandard{"cfgRequireNoCollInTimeRangeStandard", false, "require no collision in time range standard"}; + Configurable cfgRequireTVXinEMC{"cfgRequireTVXinEMC", false, "require kTVXinEMC (only for EMC analyses)"}; + o2::aod::rctsel::RCTFlagsChecker rctChecker; void init(InitContext&) @@ -113,6 +115,10 @@ struct EMEventSelection { return false; } + if (cfgRequireTVXinEMC && !collision.alias_bit(triggerAliases::kTVXinEMC)) { + return false; + } + if constexpr (std::is_same_v, MyCollisions_Cent::iterator>) { const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { From c8f6cf32d281f66d4708b6f881b332b6f3a656d1 Mon Sep 17 00:00:00 2001 From: altsybee Date: Fri, 22 Aug 2025 22:16:09 +0200 Subject: [PATCH 157/986] [Common] Set orbitsPerTF to 8 for MC production LHC25f3 (#12694) --- Common/TableProducer/eventSelection.cxx | 2 ++ Common/Tools/EventSelectionTools.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Common/TableProducer/eventSelection.cxx b/Common/TableProducer/eventSelection.cxx index 25225144ab5..ee78a9d6f03 100644 --- a/Common/TableProducer/eventSelection.cxx +++ b/Common/TableProducer/eventSelection.cxx @@ -289,6 +289,8 @@ struct BcSelectionTask { bcSOR = runInfo.orbitSOR * nBCsPerOrbit; // duration of TF in bcs nBCsPerTF = confNumberOfOrbitsPerTF < 0 ? runInfo.orbitsPerTF * nBCsPerOrbit : confNumberOfOrbitsPerTF * nBCsPerOrbit; + if (strLPMProductionTag == "LHC25f3") // temporary workaround for MC production LHC25f3 anchored to Pb-Pb 2023 apass5 (to be removed once the info is in ccdb) + nBCsPerTF = 8 * nBCsPerOrbit; } // timestamp of the middle of the run used to access run-wise CCDB entries diff --git a/Common/Tools/EventSelectionTools.h b/Common/Tools/EventSelectionTools.h index a798e1b7142..741eb60b51e 100644 --- a/Common/Tools/EventSelectionTools.h +++ b/Common/Tools/EventSelectionTools.h @@ -220,6 +220,8 @@ class BcSelectionModule bcSOR = runInfo.orbitSOR * nBCsPerOrbit; // duration of TF in bcs nBCsPerTF = bcselOpts.confNumberOfOrbitsPerTF < 0 ? runInfo.orbitsPerTF * nBCsPerOrbit : bcselOpts.confNumberOfOrbitsPerTF * nBCsPerOrbit; + if (strLPMProductionTag == "LHC25f3") // temporary workaround for MC production LHC25f3 anchored to Pb-Pb 2023 apass5 (to be removed once the info is in ccdb) + nBCsPerTF = 8 * nBCsPerOrbit; } // timestamp of the middle of the run used to access run-wise CCDB entries From a7b3a93a512007af846e045c1cf531c63322bc8c Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 22 Aug 2025 22:37:33 +0200 Subject: [PATCH 158/986] [PWGEM/Dilepton] minor update skimmerPrimaryElectron.cxx (#12695) Co-authored-by: ALICE Action Bot --- PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx index 0f9cb82aa55..46a598aec87 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx @@ -821,7 +821,6 @@ struct prefilterPrimaryElectron { Configurable slope{"slope", 0.0185, "slope for m vs. phiv"}; Configurable intercept{"intercept", -0.0280, "intercept for m vs. phiv"}; Configurable includeITSsa{"includeITSsa", false, "Flag to include ITSsa tracks"}; - Configurable maxpt_itssa{"maxpt_itssa", 0.15, "mix pt for ITSsa track"}; Configurable maxMeanITSClusterSize{"maxMeanITSClusterSize", 16, "max x cos(lambda)"}; Configurable> max_mee_vec{"max_mee_vec", std::vector{0.06, 0.08, 0.10}, "vector fo max mee for prefilter in ULS. Please sort this by increasing order."}; // currently, 3 thoresholds are allowed. @@ -980,10 +979,6 @@ struct prefilterPrimaryElectron { return false; } - if ((track.hasITS() && !track.hasTPC() && !track.hasTOF() && !track.hasTRD()) && maxpt_itssa < trackParCov.getPt()) { - return false; - } - if (track.hasITS() && !track.hasTPC() && !track.hasTOF() && !track.hasTRD()) { int total_cluster_size = 0, nl = 0; for (unsigned int layer = 0; layer < 7; layer++) { @@ -1045,7 +1040,7 @@ struct prefilterPrimaryElectron { Preslice trackIndicesPerCollision = aod::track_association::collisionId; - Filter trackFilter = o2::aod::track::pt > minpt&& nabs(o2::aod::track::eta) < maxeta&& o2::aod::track::itsChi2NCl < maxchi2its&& ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true; + Filter trackFilter = o2::aod::track::itsChi2NCl < maxchi2its && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true; using MyFilteredTracks = soa::Filtered; Partition posTracks = o2::aod::track::signed1Pt > 0.f; Partition negTracks = o2::aod::track::signed1Pt < 0.f; From 17f8f3bcbe767637987ef00de87b1603ab845b0a Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sat, 23 Aug 2025 01:12:35 +0200 Subject: [PATCH 159/986] [PWGEM/Dilepton] minor update Dilepton.h (#12699) --- PWGEM/Dilepton/Core/Dilepton.h | 2 +- PWGEM/Dilepton/Core/DileptonMC.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 22031fb2d08..f3c38af643d 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -588,7 +588,7 @@ struct Dilepton { } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kPolarization)) { const AxisSpec axis_cos_theta_cs{10, 0.f, 1.f, "|cos(#theta_{CS})|"}; - const AxisSpec axis_phi_cs{18, 0.f, M_PI, "|#varphi_{CS}| (rad.)"}; + const AxisSpec axis_phi_cs{10, 0.f, M_PI, "|#varphi_{CS}| (rad.)"}; fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_cos_theta_cs, axis_phi_cs}, true); fRegistry.addClone("Pair/same/uls/", "Pair/same/lspp/"); fRegistry.addClone("Pair/same/uls/", "Pair/same/lsmm/"); diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index 01d4bfabfd9..5962ea22f0c 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -120,7 +120,7 @@ struct DileptonMC { Configurable cfg_nbin_dphi_ee{"cfg_nbin_dphi_ee", 1, "number of bins for dphi_ee"}; // 36 Configurable cfg_nbin_deta_ee{"cfg_nbin_deta_ee", 1, "number of bins for deta_ee"}; // 40 Configurable cfg_nbin_cos_theta_cs{"cfg_nbin_cos_theta_cs", 1, "number of bins for cos theta cs"}; // 10 - Configurable cfg_nbin_phi_cs{"cfg_nbin_phi_cs", 1, "number of bins for phi cs"}; // 18 + Configurable cfg_nbin_phi_cs{"cfg_nbin_phi_cs", 1, "number of bins for phi cs"}; // 10 Configurable cfg_nbin_aco{"cfg_nbin_aco", 1, "number of bins for acoplanarity"}; // 10 Configurable cfg_nbin_asym_pt{"cfg_nbin_asym_pt", 1, "number of bins for pt asymmetry"}; // 10 Configurable cfg_nbin_dphi_e_ee{"cfg_nbin_dphi_e_ee", 1, "number of bins for dphi_ee_e"}; // 18 From 546d49322d80f3d72c464c613d3a57f1b72579dc Mon Sep 17 00:00:00 2001 From: altsybee Date: Sat, 23 Aug 2025 02:55:34 +0200 Subject: [PATCH 160/986] [DPG] tuning config flags, adding THnD multi-dim QA histo (#12700) --- DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx | 266 +++++++++++++-------- 1 file changed, 171 insertions(+), 95 deletions(-) diff --git a/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx b/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx index 7d23ded67aa..3fc293c7e84 100644 --- a/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx +++ b/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx @@ -15,6 +15,7 @@ /// \author Igor Altsybeev #include "Common/CCDB/EventSelectionParams.h" +#include "Common/CCDB/ctpRateFetcher.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectionDefaults.h" #include "Common/DataModel/Centrality.h" @@ -49,7 +50,8 @@ using FullTracksIU = soa::Join confAddBasicQAhistos{"AddBasicQAhistos", true, "0 - add basic histograms, 1 - skip"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable confAddBasicQAhistos{"FlagAddBasicQAhistos", true, "0 - add basic histograms, 1 - skip"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable confAddTimeDependentHistos{"FlagAddTimeDependentHistos", true, "0 - add time-dependent histograms, 1 - skip"}; // o2-linter: disable=name/configurable (temporary fix) Configurable confTimeIntervalForOccupancyCalculation{"TimeIntervalForOccupancyCalculation", 100, "Time interval for TPC occupancy calculation, us"}; // o2-linter: disable=name/configurable (temporary fix) Configurable confOccupancyHistCoeffNtracksForOccupancy{"HistCoeffNtracksForOccupancy", 1., "Coefficient for max nTracks in occupancy histos"}; // o2-linter: disable=name/configurable (temporary fix) Configurable confOccupancyHistCoeffNbins2D{"HistCoeffNbins2D", 1., "Coefficient for nBins in occupancy 2D histos"}; // o2-linter: disable=name/configurable (temporary fix) @@ -63,7 +65,7 @@ struct DetectorOccupancyQaTask { Configurable confFlagUseNoHighMultCollInPrevRof{"FlagUseNoHighMultCollInPrevRof", false, "Suppress high-multiplicity prev-ROF events for occupancy historams"}; // o2-linter: disable=name/configurable (temporary fix) Configurable confFlagCentralityIsAvailable{"FlagCentralityIsAvailable", true, "Fill centrality-related historams"}; // o2-linter: disable=name/configurable (temporary fix) Configurable confFlagManyHeavyHistos{"FlagManyHeavyHistos", true, "Fill more TH2, TH3, THn historams"}; // o2-linter: disable=name/configurable (temporary fix) - Configurable confFlagIsTOFIsTRDdtStudy{"FlagIsTOFIsTRDdtStudy", true, "Fill THn dt historams with isTOF and isTRD condition"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable confFlagIsTOFIsTRDdtStudy{"FlagIsTOFIsTRDdtStudy", false, "Fill THn dt historams with isTOF and isTRD condition"}; // o2-linter: disable=name/configurable (temporary fix) // configuration for small time binning Configurable confTimeIntervalForSmallBins{"TimeIntervalForSmallBins", 100, "Time interval for TPC occupancy calculation in small bins, +/-, us"}; // o2-linter: disable=name/configurable (temporary fix) @@ -79,12 +81,12 @@ struct DetectorOccupancyQaTask { Configurable confCutMinTPCcls{"MinNumTPCcls", 50, "min number of TPC clusters for a current event"}; // o2-linter: disable=name/configurable (temporary fix) // config for QA histograms - Configurable confAddTracksVsFwdHistos{"AddTracksVsFwdHistos", true, "0 - add histograms, 1 - skip"}; // o2-linter: disable=name/configurable (temporary fix) - Configurable nBinsTracks{"nBinsTracks", 400, "N bins in n tracks histo"}; // o2-linter: disable=name/configurable (temporary fix) - Configurable nMaxTracks{"nMaxTracks", 8000, "N max in n tracks histo"}; // o2-linter: disable=name/configurable (temporary fix) - Configurable nMaxGlobalTracks{"nMaxGlobalTracks", 3000, "N max in n tracks histo"}; // o2-linter: disable=name/configurable (temporary fix) - Configurable nBinsMultFwd{"nBinsMultFwd", 400, "N bins in mult fwd histo"}; // o2-linter: disable=name/configurable (temporary fix) - Configurable nMaxMultFwd{"nMaxMultFwd", 200000, "N max in mult fwd histo"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable confAddTracksVsFwdHistos{"FlagAddTracksVsFwdHistos", true, "0 - add histograms, 1 - skip"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable nBinsTracks{"nBinsTracks", 400, "N bins in n tracks histo"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable nMaxTracks{"nMaxTracks", 8000, "N max in n tracks histo"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable nMaxGlobalTracks{"nMaxGlobalTracks", 3000, "N max in n tracks histo"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable nBinsMultFwd{"nBinsMultFwd", 400, "N bins in mult fwd histo"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable nMaxMultFwd{"nMaxMultFwd", 200000, "N max in mult fwd histo"}; // o2-linter: disable=name/configurable (temporary fix) Configurable nBinsOccupancy{"nBinsOccupancy", 150, "N bins for occupancy axis"}; // o2-linter: disable=name/configurable (temporary fix) Configurable nMaxOccupancy{"nMaxOccupancy", 15000, "N for max of the occupancy axis"}; // o2-linter: disable=name/configurable (temporary fix) @@ -105,6 +107,16 @@ struct DetectorOccupancyQaTask { Configurable> confTimeSlicesForPastFutureStudies{"TimeSlicesForPastFutureStudies", {-40, -10, 20, 50, 80}, "Time slices for past/future studies, us"}; + // configuration for THnD multi-dim histo(s): + Configurable confFlagFillTHn{"FlagFillTHn", false, "Fill THn historams for multi-dim QA"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable confTHnAxis_nPhiBins{"THn_nPhiBins", 180, "nPhiBins"}; // o2-linter: disable=name/configurable (temporary fix) + ConfigurableAxis confTHnAxis_R{"THn_R", {8, -0.5f, 7.5f}, "ids of radii"}; // o2-linter: disable=name/configurable (temporary fix) + ConfigurableAxis confTHnAxis_qOp{"THn_qOp", {16, -4.f, 4.f}, "qOp"}; // o2-linter: disable=name/configurable (temporary fix) + ConfigurableAxis confTHnAxis_IR{"THn_IR", {VARIABLE_WIDTH, 0, 12, 25, 38, 50}, "IR, kHz"}; // o2-linter: disable=name/configurable (temporary fix) + ConfigurableAxis confTHnAxis_occ{"THn_occupancy", {VARIABLE_WIDTH, 0, 500, 1000, 2000, 4000, 6000, 8000}, "weighted occupancy"}; // o2-linter: disable=name/configurable (temporary fix) + ConfigurableAxis confTHnAxis_centr{"THn_centr", {VARIABLE_WIDTH, 0, 500, 1000, 2000, 4000}, "centrality by nPVtracks"}; // o2-linter: disable=name/configurable (temporary fix) + ConfigurableAxis confTHnAxis_eta{"THn_eta", {8, -0.8f, 0.8f}, "eta"}; // o2-linter: disable=name/configurable (temporary fix) + uint64_t minGlobalBC = 0; Service ccdb; HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -115,6 +127,7 @@ struct DetectorOccupancyQaTask { double minOrbit; int64_t bcSOR = 0; // global bc of the start of the first orbit, setting 0 by default for unanchored MC int64_t nBCsPerTF = 32 * nBCsPerOrbit; // duration of TF in bcs, should be 128*3564 or 32*3564, setting 128 orbits by default sfor unanchored MC + ctpRateFetcher mRateFetcher; // save time "slices" for several collisions for QA bool flagFillQAtimeOccupHist = false; @@ -133,12 +146,38 @@ struct DetectorOccupancyQaTask { histos.add("hNcolVsBcInTF/hNcolVsBcInTF_vertexTOFmatched", ";bc in TF; n collisions", kTH1F, {axisBCinTF}); histos.add("hNcolVsBcInTF/hNcolVsBcInTFafterMaxBcCut", ";bc in TF; n collisions", kTH1F, {axisBCinTF}); + // QA of occupancy-based event selection + histos.add("hOccupancy", "", kTH1D, {{15002, -1.5, 15000.5}}); + + AxisSpec axisOccupancyTracks{nBinsOccupancy, 0., nMaxOccupancy, "occupancy (n ITS tracks weighted)"}; + if (confFlagCentralityIsAvailable) { + AxisSpec axisCentrality{100, 0, 100, "centrality, %"}; + histos.add("hCentrVsOccupancy", "hCentrVsOccupancy", kTH2F, {axisCentrality, axisOccupancyTracks}); + histos.add("hCentrVsOccupancyNoCollStd", "hCentrVsOccupancyNoCollStd", kTH2F, {axisCentrality, axisOccupancyTracks}); + } + // track QA counters + histos.add("nTrackCounter_after_cuts_QA", "", kTH1D, {{12, -0.5, 11.5, "track QA"}}); + TAxis* axTrackCounters = reinterpret_cast(histos.get(HIST("nTrackCounter_after_cuts_QA"))->GetXaxis()); + axTrackCounters->SetBinLabel(1, "all"); + axTrackCounters->SetBinLabel(2, "PVcontrib"); + axTrackCounters->SetBinLabel(3, "ptCut"); + axTrackCounters->SetBinLabel(4, "etaCut"); + axTrackCounters->SetBinLabel(5, "itsNCls>=5"); + axTrackCounters->SetBinLabel(6, "isGlobal,nTPCcls>=70"); + axTrackCounters->SetBinLabel(7, "passedTPCRefit"); + axTrackCounters->SetBinLabel(8, "occupancy>=0"); + axTrackCounters->SetBinLabel(9, "fracton nClsNoPID (0,0.8)"); + axTrackCounters->SetBinLabel(10, "pos"); + axTrackCounters->SetBinLabel(11, "neg"); + // histograms for occupancy-in-time-window study double kMaxOccup = confOccupancyHistCoeffNtracksForOccupancy; double kMaxThisEv = confCoeffMaxNtracksThisEvent; // 1D, dE/dx, etc. if (confAddBasicQAhistos) { + histos.add("hOccupancyVsOrbit", ";orbit id;weighted occupancy;n events", kTH2F, {{128, -0.5, 127.5}, {600, 0, 15000}}); + int nMax1D = kMaxThisEv * 8000; histos.add("hNumITS567tracksPerCollision", ";n tracks;n events", kTH1D, {{nMax1D, -0.5, nMax1D - 0.5}}); histos.add("hNumITS567tracksPerCollisionSel", ";n tracks;n events", kTH1D, {{nMax1D, -0.5, nMax1D - 0.5}}); @@ -158,21 +197,6 @@ struct DetectorOccupancyQaTask { histos.add("hNumUniqueBCInTimeWindow", ";n collisions;n events", kTH1D, {{201, -0.5, 200.5}}); - // track QA counters - histos.add("nTrackCounter_after_cuts_QA", "", kTH1D, {{12, -0.5, 11.5, "track QA"}}); - TAxis* axTrackCounters = reinterpret_cast(histos.get(HIST("nTrackCounter_after_cuts_QA"))->GetXaxis()); - axTrackCounters->SetBinLabel(1, "all"); - axTrackCounters->SetBinLabel(2, "PVcontrib"); - axTrackCounters->SetBinLabel(3, "ptCut"); - axTrackCounters->SetBinLabel(4, "etaCut"); - axTrackCounters->SetBinLabel(5, "itsNCls>=5"); - axTrackCounters->SetBinLabel(6, "isGlobal,nTPCcls>=70"); - axTrackCounters->SetBinLabel(7, "passedTPCRefit"); - axTrackCounters->SetBinLabel(8, "occupancy>=0"); - axTrackCounters->SetBinLabel(9, "fracton nClsNoPID (0,0.8)"); - axTrackCounters->SetBinLabel(10, "pos"); - axTrackCounters->SetBinLabel(11, "neg"); - // dE/dx AxisSpec axisDeDx{800, 0.0, 800.0, "dE/dx (a. u.)"}; histos.add("dEdx_vs_Momentum", "dE/dx", kTH2F, {{1000, -5.0, 5.0, "#it{p}/Z (GeV/c)"}, axisDeDx}); @@ -412,6 +436,15 @@ struct DetectorOccupancyQaTask { histos.add("hNumITSTPC_vs_FT0CthisCol_vs_FT0CamplInTimeWindow_kNoCollInTimeRangeNarrow", ";FT0C this collision;n ITS-TPC tracks, this collision;FT0C ampl. sum in time window", kTH3D, {{nBins3D, 0, kMaxThisEv * 80000}, {nBins3D, 0, kMaxThisEv * 8000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 250000}}); histos.add("hNumITS567_vs_FT0CthisCol_vs_FT0CamplInTimeWindow_kNoCollInTimeRangeNarrow", ";FT0C this collision;n ITS567cls tracks, this collision;FT0C ampl. sum in time window", kTH3D, {{nBins3D, 0, kMaxThisEv * 80000}, {nBins3D, 0, kMaxThisEv * 8000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 250000}}); } + + // THnD for Marian: + if (confFlagFillTHn) { + AxisSpec axis_THnF_phi{confTHnAxis_nPhiBins, 0, TMath::TwoPi(), ""}; // φ at radius: 360 bins + histos.add("THnD_histos/phi_R_qOp_IR_occ_centr_eta", ";phi;R;qOp;IR;occ;cent;eta", kTHnF, {axis_THnF_phi, confTHnAxis_R, confTHnAxis_qOp, confTHnAxis_IR, confTHnAxis_occ, confTHnAxis_centr, confTHnAxis_eta}); + + histos.add("THnD_histos/QA_under_asin", "", kTH1F, {{200, -4, 4}}); + histos.add("THnD_histos/QA_asin", "", kTH1F, {{200, -8, 8}}); + } // nD, time bins to cover the range -confTimeIntervalForSmallBins... +confTimeIntervalForSmallBins (us) double timeBinSize = 2 * confTimeIntervalForSmallBins / confNumberOfSmallTimeBins; std::vector arrTimeBins; @@ -420,50 +453,42 @@ struct DetectorOccupancyQaTask { const AxisSpec axisTimeBins{arrTimeBins, "#Delta t, #mus"}; int nBinsX = 20; int nBinsY = 40; - histos.add("occupancyInTimeBins", ";time bin (#mus);n ITS tracks with 5,6,7 cls, this collision;n ITS-TPC tracks, this collision;ITS tracks with 5,6,7 cls in time window", kTHnF, {axisTimeBins, {nBinsX, 0, kMaxThisEv * 4000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 10000}}); - histos.add("occupancyInTimeBins_vs_FT0thisCol_kNoCollInTimeRangeNarrow", ";time bin (#mus);FT0C this collision, this collision;n ITS-TPC tracks, this collision;ITS tracks with 5,6,7 cls in time window", kTHnF, {axisTimeBins, {nBins3D, 0, kMaxThisEv * 100000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 10000}}); - histos.add("occupancyInTimeBins_nITS567_vs_FT0thisCol_kNoCollInTimeRangeNarrow", ";time bin (#mus);FT0C this collision, this collision;n ITS567cls tracks, this collision;ITS tracks with 5,6,7 cls in time window", kTHnF, {axisTimeBins, {nBins3D, 0, kMaxThisEv * 100000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 10000}}); - if (confFlagManyHeavyHistos) { - histos.add("occupancyInTimeBins_BEFORE_sel", ";time bin (#mus);n ITS tracks with 5,6,7 cls, this collision;n ITS-TPC tracks, this collision;ITS tracks with 5,6,7 cls in time window", kTHnF, {axisTimeBins, {nBinsX, 0, kMaxThisEv * 4000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 10000}}); - histos.add("occupancyInTimeBins_occupByFT0_BEFORE_sel", ";time bin (#mus);n ITS tracks with 5,6,7 cls, this collision;n ITS-TPC tracks, this collision;sum FT0 in time window", kTHnF, {axisTimeBins, {nBinsX, 0, kMaxThisEv * 4000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 100000}}); + if (confAddTimeDependentHistos) { + histos.add("occupancyInTimeBins", ";time bin (#mus);n ITS tracks with 5,6,7 cls, this collision;n ITS-TPC tracks, this collision;ITS tracks with 5,6,7 cls in time window", kTHnF, {axisTimeBins, {nBinsX, 0, kMaxThisEv * 4000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 10000}}); + histos.add("occupancyInTimeBins_vs_FT0thisCol_kNoCollInTimeRangeNarrow", ";time bin (#mus);FT0C this collision, this collision;n ITS-TPC tracks, this collision;ITS tracks with 5,6,7 cls in time window", kTHnF, {axisTimeBins, {nBins3D, 0, kMaxThisEv * 100000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 10000}}); + histos.add("occupancyInTimeBins_nITS567_vs_FT0thisCol_kNoCollInTimeRangeNarrow", ";time bin (#mus);FT0C this collision, this collision;n ITS567cls tracks, this collision;ITS tracks with 5,6,7 cls in time window", kTHnF, {axisTimeBins, {nBins3D, 0, kMaxThisEv * 100000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 10000}}); - histos.add("occupancyInTimeBins_occupByFT0", ";time bin (#mus);n ITS tracks with 5,6,7 cls, this collision;n ITS-TPC tracks, this collision;sum FT0 in time window", kTHnF, {axisTimeBins, {nBinsX, 0, kMaxThisEv * 4000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 100000}}); - histos.add("occupancyInTimeBins_occupByFT0_kNoCollInTimeRangeNarrow", ";time bin (#mus);n ITS tracks with 5,6,7 cls, this collision;n ITS-TPC tracks, this collision;sum FT0 in time window", kTHnF, {axisTimeBins, {nBinsX, 0, kMaxThisEv * 4000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 100000}}); + if (confFlagManyHeavyHistos) { + histos.add("occupancyInTimeBins_BEFORE_sel", ";time bin (#mus);n ITS tracks with 5,6,7 cls, this collision;n ITS-TPC tracks, this collision;ITS tracks with 5,6,7 cls in time window", kTHnF, {axisTimeBins, {nBinsX, 0, kMaxThisEv * 4000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 10000}}); + histos.add("occupancyInTimeBins_occupByFT0_BEFORE_sel", ";time bin (#mus);n ITS tracks with 5,6,7 cls, this collision;n ITS-TPC tracks, this collision;sum FT0 in time window", kTHnF, {axisTimeBins, {nBinsX, 0, kMaxThisEv * 4000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 100000}}); - histos.add("occupancyInTimeBins_vs_FT0thisCol_occupByFT0_kNoCollInTimeRangeNarrow", ";time bin (#mus);FT0C this collision, this collision;n ITS-TPC tracks, this collision;sum FT0 in time window", kTHnF, {axisTimeBins, {nBins3D, 0, kMaxThisEv * 100000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 100000}}); + histos.add("occupancyInTimeBins_occupByFT0", ";time bin (#mus);n ITS tracks with 5,6,7 cls, this collision;n ITS-TPC tracks, this collision;sum FT0 in time window", kTHnF, {axisTimeBins, {nBinsX, 0, kMaxThisEv * 4000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 100000}}); + histos.add("occupancyInTimeBins_occupByFT0_kNoCollInTimeRangeNarrow", ";time bin (#mus);n ITS tracks with 5,6,7 cls, this collision;n ITS-TPC tracks, this collision;sum FT0 in time window", kTHnF, {axisTimeBins, {nBinsX, 0, kMaxThisEv * 4000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 100000}}); - histos.add("occupancyInTimeBins_nITS567_vs_FT0thisCol_occupByFT0_kNoCollInTimeRangeNarrow", ";time bin (#mus);FT0C this collision, this collision;n ITS567cls tracks, this collision;sum FT0 in time window", kTHnF, {axisTimeBins, {nBins3D, 0, kMaxThisEv * 100000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 100000}}); - histos.add("occupancyInTimeBins_nITS567_vs_FT0thisCol_occupByFT0_kNoCollInTimeRangeNarrow_NoCollInRofStrict", ";time bin (#mus);FT0C this collision, this collision;n ITS567cls tracks, this collision;sum FT0 in time window", kTHnF, {axisTimeBins, {nBins3D, 0, kMaxThisEv * 100000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 100000}}); - } - if (confFlagIsTOFIsTRDdtStudy) { - histos.add("occupancyInTimeBins_nITSTOF_vs_FT0thisCol_kNoCollInTimeRangeNarrow", ";time bin (#mus);FT0C this collision, this collision;n ITSTOF tracks, this collision;ITS tracks with 5,6,7 cls in time window", kTHnF, {axisTimeBins, {nBins3D, 0, kMaxThisEv * 100000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 10000}}); - histos.add("occupancyInTimeBins_nITSTRD_vs_FT0thisCol_kNoCollInTimeRangeNarrow", ";time bin (#mus);FT0C this collision, this collision;n ITSTRD tracks, this collision;ITS tracks with 5,6,7 cls in time window", kTHnF, {axisTimeBins, {nBins3D, 0, kMaxThisEv * 100000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 10000}}); + histos.add("occupancyInTimeBins_vs_FT0thisCol_occupByFT0_kNoCollInTimeRangeNarrow", ";time bin (#mus);FT0C this collision, this collision;n ITS-TPC tracks, this collision;sum FT0 in time window", kTHnF, {axisTimeBins, {nBins3D, 0, kMaxThisEv * 100000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 100000}}); + + histos.add("occupancyInTimeBins_nITS567_vs_FT0thisCol_occupByFT0_kNoCollInTimeRangeNarrow", ";time bin (#mus);FT0C this collision, this collision;n ITS567cls tracks, this collision;sum FT0 in time window", kTHnF, {axisTimeBins, {nBins3D, 0, kMaxThisEv * 100000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 100000}}); + histos.add("occupancyInTimeBins_nITS567_vs_FT0thisCol_occupByFT0_kNoCollInTimeRangeNarrow_NoCollInRofStrict", ";time bin (#mus);FT0C this collision, this collision;n ITS567cls tracks, this collision;sum FT0 in time window", kTHnF, {axisTimeBins, {nBins3D, 0, kMaxThisEv * 100000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 100000}}); + } + if (confFlagIsTOFIsTRDdtStudy) { + histos.add("occupancyInTimeBins_nITSTOF_vs_FT0thisCol_kNoCollInTimeRangeNarrow", ";time bin (#mus);FT0C this collision, this collision;n ITSTOF tracks, this collision;ITS tracks with 5,6,7 cls in time window", kTHnF, {axisTimeBins, {nBins3D, 0, kMaxThisEv * 100000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 10000}}); + histos.add("occupancyInTimeBins_nITSTRD_vs_FT0thisCol_kNoCollInTimeRangeNarrow", ";time bin (#mus);FT0C this collision, this collision;n ITSTRD tracks, this collision;ITS tracks with 5,6,7 cls in time window", kTHnF, {axisTimeBins, {nBins3D, 0, kMaxThisEv * 100000}, {nBinsY, 0, kMaxThisEv * 4000}, {nBins3DoccupancyAxis, 0, kMaxOccup * 10000}}); + } + + histos.add("qaForHighOccupITStracksInTimeBinPast", ";time bin (#mus);n tracks", kTH1F, {axisTimeBins}); + histos.add("qaForHighOccupITStracksInTimeBinFuture1", ";time bin (#mus);n tracks", kTH1F, {axisTimeBins}); + histos.add("qaForHighOccupITStracksInTimeBinFuture2", ";time bin (#mus);n tracks", kTH1F, {axisTimeBins}); + histos.add("qaForHighOccupITStracksForNeighbourEvents", ";time bin (#mus);n tracks", kTH1F, {axisTimeBins}); + + // save dt information for several first collisions for QA + histos.add("histOccupInTimeBinsQA", ";dt;this coll id", kTH2F, {axisTimeBins, {nCollisionsForTimeBinQA, -0.5, nCollisionsForTimeBinQA - 0.5}}); } histos.add("thisEventITStracksInTimeBins", ";time bin (#mus);n tracks", kTH1F, {axisTimeBins}); histos.add("thisEventITSTPCtracksInTimeBins", ";time bin (#mus);n tracks", kTH1F, {axisTimeBins}); histos.add("thisEventFT0CInTimeBins", ";time bin (#mus);n tracks", kTH1F, {axisTimeBins}); - histos.add("qaForHighOccupITStracksInTimeBinPast", ";time bin (#mus);n tracks", kTH1F, {axisTimeBins}); - histos.add("qaForHighOccupITStracksInTimeBinFuture1", ";time bin (#mus);n tracks", kTH1F, {axisTimeBins}); - histos.add("qaForHighOccupITStracksInTimeBinFuture2", ";time bin (#mus);n tracks", kTH1F, {axisTimeBins}); - histos.add("qaForHighOccupITStracksForNeighbourEvents", ";time bin (#mus);n tracks", kTH1F, {axisTimeBins}); - - // save dt information for several first collisions for QA - histos.add("histOccupInTimeBinsQA", ";dt;this coll id", kTH2F, {axisTimeBins, {nCollisionsForTimeBinQA, -0.5, nCollisionsForTimeBinQA - 0.5}}); - - // QA of occupancy-based event selection - histos.add("hOccupancy", "", kTH1D, {{15002, -1.5, 15000.5}}); - histos.add("hOccupancyVsOrbit", ";orbit id;weighted occupancy;n events", kTH2F, {{128, -0.5, 127.5}, {600, 0, 15000}}); - - AxisSpec axisOccupancyTracks{nBinsOccupancy, 0., nMaxOccupancy, "occupancy (n ITS tracks weighted)"}; - if (confFlagCentralityIsAvailable) { - AxisSpec axisCentrality{100, 0, 100, "centrality, %"}; - histos.add("hCentrVsOccupancy", "hCentrVsOccupancy", kTH2F, {axisCentrality, axisOccupancyTracks}); - histos.add("hCentrVsOccupancyNoCollStd", "hCentrVsOccupancyNoCollStd", kTH2F, {axisCentrality, axisOccupancyTracks}); - } - if (confAddTracksVsFwdHistos) { AxisSpec axisNtracks{nBinsTracks, -0.5, nMaxTracks - 0.5, "n tracks"}; AxisSpec axisNtracksGlobal{nBinsTracks, -0.5, nMaxGlobalTracks - 0.5, "n tracks"}; @@ -917,7 +942,7 @@ struct DetectorOccupancyQaTask { int nFT0CInTimeBin = histos.get(HIST("thisEventFT0CInTimeBins"))->GetBinContent(iT + 1); - if (confFlagManyHeavyHistos) { + if (confAddTimeDependentHistos && confFlagManyHeavyHistos) { histos.fill(HIST("occupancyInTimeBins_BEFORE_sel"), dt, vTracksITS567perCollPtEtaCuts[colIndex], confFlagUseGlobalTracks ? vTracksGlobalPerCollPtEtaCuts[colIndex] : vTracksITSTPCperCollPtEtaCuts[colIndex], nITStrInTimeBin); histos.fill(HIST("occupancyInTimeBins_occupByFT0_BEFORE_sel"), dt, vTracksITS567perCollPtEtaCuts[colIndex], confFlagUseGlobalTracks ? vTracksGlobalPerCollPtEtaCuts[colIndex] : vTracksITSTPCperCollPtEtaCuts[colIndex], nFT0CInTimeBin); } @@ -927,43 +952,45 @@ struct DetectorOccupancyQaTask { if (confFlagUseNoHighMultCollInPrevRof && !col.selection_bit(kNoHighMultCollInPrevRof)) flagFillOccupVsDt = false; - if (sel && std::fabs(col.posZ()) < 10 && flagFillOccupVsDt) { - histos.fill(HIST("occupancyInTimeBins"), dt, vTracksITS567perCollPtEtaCuts[colIndex], confFlagUseGlobalTracks ? vTracksGlobalPerCollPtEtaCuts[colIndex] : vTracksITSTPCperCollPtEtaCuts[colIndex], nITStrInTimeBin); - if (confFlagManyHeavyHistos) - histos.fill(HIST("occupancyInTimeBins_occupByFT0"), dt, vTracksITS567perCollPtEtaCuts[colIndex], confFlagUseGlobalTracks ? vTracksGlobalPerCollPtEtaCuts[colIndex] : vTracksITSTPCperCollPtEtaCuts[colIndex], nFT0CInTimeBin); - - if (col.selection_bit(kNoCollInTimeRangeNarrow)) { - histos.fill(HIST("occupancyInTimeBins_vs_FT0thisCol_kNoCollInTimeRangeNarrow"), dt, vAmpFT0CperColl[colIndex], confFlagUseGlobalTracks ? vTracksGlobalPerCollPtEtaCuts[colIndex] : vTracksITSTPCperCollPtEtaCuts[colIndex], nITStrInTimeBin); - histos.fill(HIST("occupancyInTimeBins_nITS567_vs_FT0thisCol_kNoCollInTimeRangeNarrow"), dt, vAmpFT0CperColl[colIndex], vTracksITS567perCollPtEtaCuts[colIndex], nITStrInTimeBin); - if (confFlagIsTOFIsTRDdtStudy) { - histos.fill(HIST("occupancyInTimeBins_nITSTOF_vs_FT0thisCol_kNoCollInTimeRangeNarrow"), dt, vAmpFT0CperColl[colIndex], vTracksITSTOFperCollPtEtaCuts[colIndex], nITStrInTimeBin); - histos.fill(HIST("occupancyInTimeBins_nITSTRD_vs_FT0thisCol_kNoCollInTimeRangeNarrow"), dt, vAmpFT0CperColl[colIndex], vTracksITSTRDperCollPtEtaCuts[colIndex], nITStrInTimeBin); - } - if (confFlagManyHeavyHistos) { - histos.fill(HIST("occupancyInTimeBins_occupByFT0_kNoCollInTimeRangeNarrow"), dt, vTracksITS567perCollPtEtaCuts[colIndex], confFlagUseGlobalTracks ? vTracksGlobalPerCollPtEtaCuts[colIndex] : vTracksITSTPCperCollPtEtaCuts[colIndex], nFT0CInTimeBin); - histos.fill(HIST("occupancyInTimeBins_vs_FT0thisCol_occupByFT0_kNoCollInTimeRangeNarrow"), dt, vAmpFT0CperColl[colIndex], confFlagUseGlobalTracks ? vTracksGlobalPerCollPtEtaCuts[colIndex] : vTracksITSTPCperCollPtEtaCuts[colIndex], nFT0CInTimeBin); + if (confAddTimeDependentHistos) { + if (sel && std::fabs(col.posZ()) < 10 && flagFillOccupVsDt) { + histos.fill(HIST("occupancyInTimeBins"), dt, vTracksITS567perCollPtEtaCuts[colIndex], confFlagUseGlobalTracks ? vTracksGlobalPerCollPtEtaCuts[colIndex] : vTracksITSTPCperCollPtEtaCuts[colIndex], nITStrInTimeBin); + if (confFlagManyHeavyHistos) + histos.fill(HIST("occupancyInTimeBins_occupByFT0"), dt, vTracksITS567perCollPtEtaCuts[colIndex], confFlagUseGlobalTracks ? vTracksGlobalPerCollPtEtaCuts[colIndex] : vTracksITSTPCperCollPtEtaCuts[colIndex], nFT0CInTimeBin); + + if (col.selection_bit(kNoCollInTimeRangeNarrow)) { + histos.fill(HIST("occupancyInTimeBins_vs_FT0thisCol_kNoCollInTimeRangeNarrow"), dt, vAmpFT0CperColl[colIndex], confFlagUseGlobalTracks ? vTracksGlobalPerCollPtEtaCuts[colIndex] : vTracksITSTPCperCollPtEtaCuts[colIndex], nITStrInTimeBin); + histos.fill(HIST("occupancyInTimeBins_nITS567_vs_FT0thisCol_kNoCollInTimeRangeNarrow"), dt, vAmpFT0CperColl[colIndex], vTracksITS567perCollPtEtaCuts[colIndex], nITStrInTimeBin); + if (confFlagIsTOFIsTRDdtStudy) { + histos.fill(HIST("occupancyInTimeBins_nITSTOF_vs_FT0thisCol_kNoCollInTimeRangeNarrow"), dt, vAmpFT0CperColl[colIndex], vTracksITSTOFperCollPtEtaCuts[colIndex], nITStrInTimeBin); + histos.fill(HIST("occupancyInTimeBins_nITSTRD_vs_FT0thisCol_kNoCollInTimeRangeNarrow"), dt, vAmpFT0CperColl[colIndex], vTracksITSTRDperCollPtEtaCuts[colIndex], nITStrInTimeBin); + } + if (confFlagManyHeavyHistos) { + histos.fill(HIST("occupancyInTimeBins_occupByFT0_kNoCollInTimeRangeNarrow"), dt, vTracksITS567perCollPtEtaCuts[colIndex], confFlagUseGlobalTracks ? vTracksGlobalPerCollPtEtaCuts[colIndex] : vTracksITSTPCperCollPtEtaCuts[colIndex], nFT0CInTimeBin); + histos.fill(HIST("occupancyInTimeBins_vs_FT0thisCol_occupByFT0_kNoCollInTimeRangeNarrow"), dt, vAmpFT0CperColl[colIndex], confFlagUseGlobalTracks ? vTracksGlobalPerCollPtEtaCuts[colIndex] : vTracksITSTPCperCollPtEtaCuts[colIndex], nFT0CInTimeBin); - histos.fill(HIST("occupancyInTimeBins_nITS567_vs_FT0thisCol_occupByFT0_kNoCollInTimeRangeNarrow"), dt, vAmpFT0CperColl[colIndex], vTracksITS567perCollPtEtaCuts[colIndex], nFT0CInTimeBin); - if (col.selection_bit(kNoCollInRofStrict)) - histos.fill(HIST("occupancyInTimeBins_nITS567_vs_FT0thisCol_occupByFT0_kNoCollInTimeRangeNarrow_NoCollInRofStrict"), dt, vAmpFT0CperColl[colIndex], vTracksITS567perCollPtEtaCuts[colIndex], nFT0CInTimeBin); + histos.fill(HIST("occupancyInTimeBins_nITS567_vs_FT0thisCol_occupByFT0_kNoCollInTimeRangeNarrow"), dt, vAmpFT0CperColl[colIndex], vTracksITS567perCollPtEtaCuts[colIndex], nFT0CInTimeBin); + if (col.selection_bit(kNoCollInRofStrict)) + histos.fill(HIST("occupancyInTimeBins_nITS567_vs_FT0thisCol_occupByFT0_kNoCollInTimeRangeNarrow_NoCollInRofStrict"), dt, vAmpFT0CperColl[colIndex], vTracksITS567perCollPtEtaCuts[colIndex], nFT0CInTimeBin); + } } } - } - - // - - if (counterQAtimeOccupHistos < nCollisionsForTimeBinQA) - histos.fill(HIST("histOccupInTimeBinsQA"), dt, counterQAtimeOccupHistos + 1, nITStrInTimeBin); - // QA for high occup in time bins - if (vFlagsForEtaQAvsOccupancyInDeltaTimeWins[colIndex] == 2) - histos.fill(HIST("qaForHighOccupITStracksInTimeBinPast"), dt, nITStrInTimeBin); - if (vFlagsForEtaQAvsOccupancyInDeltaTimeWins[colIndex] == 3) - histos.fill(HIST("qaForHighOccupITStracksInTimeBinFuture1"), dt, nITStrInTimeBin); - if (vFlagsForEtaQAvsOccupancyInDeltaTimeWins[colIndex] == 4) - histos.fill(HIST("qaForHighOccupITStracksInTimeBinFuture2"), dt, nITStrInTimeBin); - if (vFlagsForEtaQAvsOccupancyInDeltaTimeWins[colIndex] == 5) - histos.fill(HIST("qaForHighOccupITStracksForNeighbourEvents"), dt, nITStrInTimeBin); + // + + if (counterQAtimeOccupHistos < nCollisionsForTimeBinQA) + histos.fill(HIST("histOccupInTimeBinsQA"), dt, counterQAtimeOccupHistos + 1, nITStrInTimeBin); + + // QA for high occup in time bins + if (vFlagsForEtaQAvsOccupancyInDeltaTimeWins[colIndex] == 2) + histos.fill(HIST("qaForHighOccupITStracksInTimeBinPast"), dt, nITStrInTimeBin); + if (vFlagsForEtaQAvsOccupancyInDeltaTimeWins[colIndex] == 3) + histos.fill(HIST("qaForHighOccupITStracksInTimeBinFuture1"), dt, nITStrInTimeBin); + if (vFlagsForEtaQAvsOccupancyInDeltaTimeWins[colIndex] == 4) + histos.fill(HIST("qaForHighOccupITStracksInTimeBinFuture2"), dt, nITStrInTimeBin); + if (vFlagsForEtaQAvsOccupancyInDeltaTimeWins[colIndex] == 5) + histos.fill(HIST("qaForHighOccupITStracksForNeighbourEvents"), dt, nITStrInTimeBin); + } // end of confAddTimeDependentHistos } // reset delta time hist for this event @@ -1009,6 +1036,10 @@ struct DetectorOccupancyQaTask { int occupancy = col.trackOccupancyInTimeRange(); auto tracksGrouped = tracks.sliceBy(perCollision, col.globalIndex()); + const auto& bc = col.foundBC_as(); + int64_t ts = bc.timestamp(); + double IR = mRateFetcher.fetch(ccdb.service, ts, runNumber, "ZNC hadronic") * 1.e-3; // kHz + // pre-calc nPV for (const auto& track : tracksGrouped) { if (!track.isPVContributor()) @@ -1021,7 +1052,7 @@ struct DetectorOccupancyQaTask { continue; nPV++; } - if (occupancy >= 0) { + if (occupancy >= 0 && confAddBasicQAhistos) { histos.fill(HIST("hNcolVsBcInTF/hNcolVsBcInTF_vs_occupancy"), bcInTF, occupancy); if (col.selection_bit(kIsVertexTOFmatched)) histos.fill(HIST("hNcolVsBcInTF/hNcolVsBcInTF_vs_occupancy_vertexTOFmatched"), bcInTF, occupancy); @@ -1049,7 +1080,7 @@ struct DetectorOccupancyQaTask { // nPV++; // July 2025: more for data vs MC: - if (track.hasTPC() && occupancy >= 0) { + if (track.hasTPC() && occupancy >= 0 && confAddBasicQAhistos) { float pt = track.pt(); // pt 0.2-0.5 if (pt > 0.2 && pt < 0.5) { @@ -1093,7 +1124,7 @@ struct DetectorOccupancyQaTask { nGlobalTracks++; histos.fill(HIST("nTrackCounter_after_cuts_QA"), 5); - if (track.passedTPCRefit()) { + if (track.passedTPCRefit() && confAddBasicQAhistos) { histos.fill(HIST("nTrackCounter_after_cuts_QA"), 6); float signedP = track.sign() * track.tpcInnerParam(); @@ -1228,7 +1259,7 @@ struct DetectorOccupancyQaTask { // continue; histos.fill(HIST("hOccupancy"), occupancy); - if (occupancy >= 0) { + if (occupancy >= 0 && confAddBasicQAhistos) { int orbitId = bcInTF / o2::constants::lhc::LHCMaxBunches; histos.fill(HIST("hOccupancyVsOrbit"), orbitId, occupancy); } @@ -1448,6 +1479,51 @@ struct DetectorOccupancyQaTask { } // end of spec track loop to fill track histograms } // end of if (confAddBasicQAhistos) + // special loop to fill THn histograms + if (confFlagFillTHn && occupancy >= 0) { + for (const auto& track : tracksGrouped) { + if (!track.isPVContributor()) + continue; + if (track.itsNCls() < confMinITSclsPerTrack) + continue; + + float pt = track.pt(); + float eta = track.eta(); + + if (fabs(eta) > 0.8) + continue; + if (pt < 0.15) + continue; + + bool hasTPCspecCuts = (track.hasTPC() && track.tpcNClsFound() >= confCutMinTPCcls && track.tpcNClsCrossedRows() > 80 && track.tpcChi2NCl() < 4); + if (!hasTPCspecCuts) + continue; + + float sign = track.sign(); + // if (sign < 0) + // continue; + + float qpt = track.signed1Pt(); + + // fill THnF: + for (int iRadius = 0; iRadius < 8; iRadius++) { + float R = (iRadius == 0 ? 0 : 0.8 + iRadius * 0.2); // cm + float phiAtR = track.phi(); + if (iRadius > 0) { + histos.fill(HIST("THnD_histos/QA_under_asin"), R / 2 * 0.3 * sign * 0.5 / pt); + histos.fill(HIST("THnD_histos/QA_asin"), asin(R / 2 * 0.3 * sign * 0.5 / pt)); + + phiAtR -= asin(R / 2 * 0.3 * sign * 0.5 / pt); + if (phiAtR < 0) + phiAtR += TMath::TwoPi(); + else if (phiAtR > TMath::TwoPi()) + phiAtR -= TMath::TwoPi(); + } + histos.fill(HIST("THnD_histos/phi_R_qOp_IR_occ_centr_eta"), phiAtR, iRadius, qpt, IR, occupancy, nPV, eta); + } + } + } // end of confFlagFillTHn + // occupancy vs centrality if (confFlagCentralityIsAvailable) { auto t0cCentr = col.centFT0C(); From dc6624fc3642c3a0a95ae5963e4f30ecc9b0f280 Mon Sep 17 00:00:00 2001 From: Paola Vargas Torres <88360333+PaolaVT@users.noreply.github.com> Date: Sat, 23 Aug 2025 00:25:39 -0600 Subject: [PATCH 161/986] [PWGLF] Event selection was modified (#12698) --- PWGLF/Tasks/Nuspex/dedxPidAnalysis.cxx | 45 +++++++++++--------------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/dedxPidAnalysis.cxx b/PWGLF/Tasks/Nuspex/dedxPidAnalysis.cxx index d688f0c8e72..2d042bd5e96 100644 --- a/PWGLF/Tasks/Nuspex/dedxPidAnalysis.cxx +++ b/PWGLF/Tasks/Nuspex/dedxPidAnalysis.cxx @@ -79,7 +79,7 @@ struct DedxPidAnalysis { Configurable etaMin{"etaMin", -0.8f, "etaMin"}; Configurable etaMax{"etaMax", +0.8f, "etaMax"}; Configurable minNCrossedRowsOverFindableClustersTPC{"minNCrossedRowsOverFindableClustersTPC", 0.8f, "Additional cut on the minimum value of the ratio between crossed rows and findable clusters in the TPC"}; - Configurable maxDCAz{"maxDCAz", 2.f, "maxDCAz"}; + Configurable maxDCAz{"maxDCAz", 0.1f, "maxDCAz"}; // v0 cuts Configurable v0cospaMin{"v0cospaMin", 0.998f, "Minimum V0 CosPA"}; Configurable minimumV0Radius{"minimumV0Radius", 0.5f, @@ -201,11 +201,11 @@ struct DedxPidAnalysis { // pt vs p registryDeDx.add( - "hp_vs_pt_all_Neg", "p_vs_pT", HistType::kTH2F, - {{ptAxis}, {pAxis}}); + "heta_vs_p_vs_pt_all_Neg", "eta_vs_p_vs_pT", HistType::kTH3F, + {{etaAxis}, {ptAxis}, {pAxis}}); registryDeDx.add( - "hp_vs_pt_all_Pos", "p_vs_pT", HistType::kTH2F, - {{ptAxis}, {pAxis}}); + "heta_vs_p_vs_pt_all_Pos", "eta_vs_p_vs_pT", HistType::kTH3F, + {{etaAxis}, {ptAxis}, {pAxis}}); // De/Dx for ch and v0 particles for (int i = 0; i < kParticlesType; ++i) { @@ -596,19 +596,8 @@ struct DedxPidAnalysis { if (!collision.sel8()) return; - if (additionalCuts) { - if (!collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) - return; - - if (!collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) - return; - - if (std::abs(collision.posZ()) >= maxZDistanceToIP) - return; - - if (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) - return; - } + if (std::abs(collision.posZ()) > maxZDistanceToIP) + return; // Event Counter registryDeDx.fill(HIST("histRecVtxZData"), collision.posZ()); @@ -624,8 +613,10 @@ struct DedxPidAnalysis { continue; // phi and Ncl cut - if (!passedPhiCut(trk, magField, *fphiCutLow, *fphiCutHigh)) - continue; + if (additionalCuts) { + if (!passedPhiCut(trk, magField, *fphiCutLow, *fphiCutHigh)) + continue; + } float signedP = trk.sign() * trk.tpcInnerParam(); @@ -704,10 +695,10 @@ struct DedxPidAnalysis { if (trk.eta() > EtaCut[i] && trk.eta() < EtaCut[i + 1]) { if (signedP > 0) { registryDeDx.fill(HIST(kDedxvsMomentumPos[0]), signedP, trk.tpcSignal() * 50 / calibrationFactorPos->at(i), trk.eta()); - registryDeDx.fill(HIST("hp_vs_pt_all_Pos"), trk.pt(), signedP); + registryDeDx.fill(HIST("heta_vs_p_vs_pt_all_Pos"), trk.eta(), trk.pt(), signedP); } else { registryDeDx.fill(HIST(kDedxvsMomentumNeg[0]), std::abs(signedP), trk.tpcSignal() * 50 / calibrationFactorNeg->at(i), trk.eta()); - registryDeDx.fill(HIST("hp_vs_pt_all_Neg"), trk.pt(), std::abs(signedP)); + registryDeDx.fill(HIST("heta_vs_p_vs_pt_all_Neg"), trk.eta(), trk.pt(), std::abs(signedP)); } } } @@ -736,11 +727,13 @@ struct DedxPidAnalysis { if (!negTrack.passedTPCRefit()) continue; // phi and Ncl cut - if (!passedPhiCutSecondaries(posTrack, magField, *fphiCutLow, *fphiCutHigh)) - continue; + if (additionalCuts) { + if (!passedPhiCutSecondaries(posTrack, magField, *fphiCutLow, *fphiCutHigh)) + continue; - if (!passedPhiCutSecondaries(negTrack, magField, *fphiCutLow, *fphiCutHigh)) - continue; + if (!passedPhiCutSecondaries(negTrack, magField, *fphiCutLow, *fphiCutHigh)) + continue; + } float signedPpos = posTrack.sign() * posTrack.tpcInnerParam(); float signedPneg = negTrack.sign() * negTrack.tpcInnerParam(); From 136e75ce84bdf254be16b4609825c566fe915ec0 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sat, 23 Aug 2025 11:31:46 +0200 Subject: [PATCH 162/986] [PWGLF] Add e-loss to strangeness TOF (#12701) Co-authored-by: ALICE Builder --- .../Strangeness/strangenesstofpid.cxx | 622 +++++++++++++++--- 1 file changed, 528 insertions(+), 94 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx index 75cb771dbea..c9f4d76b726 100644 --- a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx @@ -49,6 +49,7 @@ #include "Framework/AnalysisTask.h" #include "Framework/RunningWorkflowInfo.h" #include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/PID.h" #include "ReconstructionDataFormats/Track.h" #include @@ -71,7 +72,9 @@ using TracksWithAllExtras = soa::Join; using V0DerivedDatas = soa::Join; +using V0DerivedDatasMC = soa::Join; using CascDerivedDatas = soa::Join; +using CascDerivedDatasMC = soa::Join; struct strangenesstofpid { // TOF pid for strangeness (recalculated with topology) @@ -87,11 +90,16 @@ struct strangenesstofpid { // mean vertex position to be used if no collision associated o2::dataformats::MeanVertexObject* mVtx = nullptr; + // LUT for Propagator + TrackLTIntegral + o2::base::MatLayerCylSet* lut = nullptr; + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; // master switches + Configurable calculationMethod{"calculationMethod", 0, "algorithm for TOF calculation. 0: fast analytical withouot eloss, 1: O2 Propagator + trackLTIntegral (slow), 2: both methods and do comparison studies (slow)"}; Configurable calculateV0s{"calculateV0s", -1, "calculate V0-related TOF PID (0: no, 1: yes, -1: auto)"}; Configurable calculateCascades{"calculateCascades", -1, "calculate cascade-related TOF PID (0: no, 1: yes, -1: auto)"}; + Configurable correctELossInclination{"correctELossInclination", true, "factor out inclination when doing effective e-loss correction (0: no, 1: yes)"}; // Operation and minimisation criteria Configurable d_bz_input{"d_bz", -999, "bz field, -999 is automatic"}; @@ -121,28 +129,33 @@ struct strangenesstofpid { } cascadeGroup; // CCDB options - Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; - Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; - Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; - Configurable nSigmaPath{"nSigmaPath", "Users/d/ddobrigk/stratof", "Path of information for n-sigma calculation"}; - Configurable mVtxPath{"mVtxPath", "GLO/Calib/MeanVertex", "Path of the mean vertex file"}; + // CCDB options + struct : ConfigurableGroup { + std::string prefix = "ccdb"; + Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; + Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; + Configurable nSigmaPath{"nSigmaPath", "Users/d/ddobrigk/stratof", "Path of information for n-sigma calculation"}; + Configurable mVtxPath{"mVtxPath", "GLO/Calib/MeanVertex", "Path of the mean vertex file"}; + } ccdbConfigurations; // manual Configurable useCustomRunNumber{"useCustomRunNumber", false, "Use custom timestamp"}; Configurable manualRunNumber{"manualRunNumber", 544122, "manual run number if no collisions saved"}; + ConfigurableAxis axisPosition{"axisPosition", {400, -400.f, +400.f}, "position (cm)"}; ConfigurableAxis axisEta{"axisEta", {20, -1.0f, +1.0f}, "#eta"}; ConfigurableAxis axisDeltaTime{"axisDeltaTime", {2000, -1000.0f, +1000.0f}, "delta-time (ps)"}; - ConfigurableAxis axisTime{"axisTime", {200, 10000.0f, +20000.0f}, "T (ps)"}; + ConfigurableAxis axisTime{"axisTime", {400, 10000.0f, +50000.0f}, "T (ps)"}; ConfigurableAxis axisNSigma{"axisNSigma", {200, -10.0f, +10.0f}, "N(#sigma)"}; - ConfigurableAxis axisExpectedOverMeasured{"axisExpectedOverMeasured", {200, 0.9f, 2.9f}, "T_{exp}/T_{meas}"}; + ConfigurableAxis axisRatioMethods{"axisRatioMethods", {400, 0.9f, 1.9f}, "T_{method 1}/T_{method 0}"}; // master p axis ConfigurableAxis axisP{"axisP", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "p_{T} (GeV/c)"}; // for zooming in at low values only (e-loss studies and effective correction) - ConfigurableAxis axisSmallP{"axisSmallP", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f}, "p_{T} (GeV/c)"}; + ConfigurableAxis axisSmallP{"axisSmallP", {250, 0.0f, 2.5f}, "p_{T} (GeV/c)"}; // for n-sigma calibration bool nSigmaCalibLoaded; @@ -302,6 +315,82 @@ struct strangenesstofpid { return length; } + /// O2 Propagator + TrackLTIntegral approach helpers + + /// function to calculate segmented (truncated) radius based on a certain x, y position + float segmentedRadius(float x, float y) + { + float atAngle = std::atan2(y, x); + float roundedAngle = TMath::Pi() / 9; // 18 segments = use 9 here + float angleSegmentAxis = 0.5f * roundedAngle + roundedAngle * static_cast(std::floor(atAngle / roundedAngle)); + float xSegmentAxis = TMath::Cos(angleSegmentAxis); + float ySegmentAxis = TMath::Sin(angleSegmentAxis); + return xSegmentAxis * x + ySegmentAxis * y; // inner product + } + + /// function to calculate track length of this track up to a certain segmented detector + /// \param track the input track + /// \param time returned time (with PID given by track PID) + void calculateTOF(o2::track::TrackPar track, float& time) + { + time = -1e+6; + + o2::track::TrackLTIntegral ltIntegral; + + float trackX = -100; + static constexpr float MAX_SIN_PHI = 0.85f; + static constexpr float MAX_STEP = 2.0f; + static constexpr float MAX_STEP_FINAL_STAGE = 0.5f; + static constexpr float MAX_FINAL_X = 390.0f; // maximum extra X on top of TOF X for correcting value + + bool trackOK = track.getXatLabR(tofPosition, trackX, d_bz); + if (trackOK) { + // propagate outwards to TOF: bulk of propagation + o2::base::Propagator::Instance()->propagateToX(track, trackX, d_bz, MAX_SIN_PHI, MAX_STEP, o2::base::Propagator::MatCorrType::USEMatCorrLUT, <Integral); + + // mark start position, define variables + std::array xyz; + track.getXYZGlo(xyz); + float segmentedR = segmentedRadius(xyz[0], xyz[1]); + float currentTime = ltIntegral.getTOF(track.getPID()); + if (calculationMethod.value == 2) { + histos.fill(HIST("hTOFPosition"), xyz[0], xyz[1]); // for debugging purposes + } + + // correct for TOF segmentation + float trackXextra = trackX; + bool trackOKextra = true; + while (trackXextra < MAX_FINAL_X) { + // propagate one step further + trackXextra += MAX_STEP_FINAL_STAGE; + trackOKextra = o2::base::Propagator::Instance()->propagateToX(track, trackXextra, d_bz, MAX_SIN_PHI, MAX_STEP, o2::base::Propagator::MatCorrType::USEMatCorrLUT, <Integral); + if (!trackOKextra) { + time = -1e+6; + return; // propagation failed, skip, won't look reasonable + } + + // re-evaluate - did we cross? if yes break + float previousX = xyz[0], previousY = xyz[1]; + track.getXYZGlo(xyz); + if (segmentedRadius(xyz[0], xyz[1]) > tofPosition) { + // crossed boundary -> do proportional scaling with how much we actually crossed the boundary + float segmentedRFinal = segmentedRadius(xyz[0], xyz[1]); + float timeFinal = ltIntegral.getTOF(track.getPID()); + float fraction = (tofPosition - segmentedR) / (segmentedRFinal - segmentedR + 1e-6); // proportional fraction + time = currentTime + (timeFinal - currentTime) * fraction; + if (calculationMethod.value == 2) { + histos.fill(HIST("hTOFPositionFinal"), previousX + fraction * (xyz[0] - previousX), previousY + fraction * (xyz[1] - previousY)); // for debugging purposes + } + return; // get out of the entire function and return (don't just break) + } + + // prepare for next step by setting current position and desired variables + segmentedR = segmentedRadius(xyz[0], xyz[1]); + currentTime = ltIntegral.getTOF(track.getPID()); + } + } + } + void init(InitContext& initContext) { if (calculateV0s.value < 0) { @@ -341,7 +430,7 @@ struct strangenesstofpid { maxSnp = 0.85f; // could be changed later maxStep = 2.00f; // could be changed later - ccdb->setURL(ccdburl); + ccdb->setURL(ccdbConfigurations.ccdburl); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); ccdb->setFatalWhenNull(false); @@ -351,12 +440,6 @@ struct strangenesstofpid { // measured vs expected total time QA if (doQA) { - // plots for effective eloss corrections - Lambda case - histos.add("h2dProtonMeasuredVsExpected", "h2dProtonMeasuredVsExpected", {HistType::kTH3F, {axisSmallP, axisExpectedOverMeasured, axisEta}}); - histos.add("h2dPionMeasuredVsExpected", "h2dPionMeasuredVsExpected", {HistType::kTH3F, {axisSmallP, axisExpectedOverMeasured, axisEta}}); - - histos.add("hArcDebug", "hArcDebug", kTH2F, {axisP, {50, -5.0f, 10.0f}}); - // standard deltaTime values if (calculateV0s.value > 0) { histos.add("h2dDeltaTimePositiveLambdaPi", "h2dDeltaTimePositiveLambdaPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); @@ -407,6 +490,62 @@ struct strangenesstofpid { // delta lambda decay time histos.add("h2dLambdaDeltaDecayTime", "h2dLambdaDeltaDecayTime", {HistType::kTH2F, {axisP, axisDeltaTime}}); } + + if (calculationMethod.value == 2) { + //_____________________________________________________________________ + // special mode in which comparison histograms are required + + // base ArcDebug: comparison between times of arrival in different methods + histos.add("hArcDebug", "hArcDebug", kTH2F, {axisTime, axisTime}); + + // Position of TrackLTIntegral method: intermediate (getXatLabR) and final (reach segmented detector) + histos.add("hTOFPosition", "hTOFPosition", kTH2F, {axisPosition, axisPosition}); + histos.add("hTOFPositionFinal", "hTOFPositionFinal", kTH2F, {axisPosition, axisPosition}); + + // Delta-times of each method for the various species + histos.add("hDeltaTimeMethodsVsP_posLaPr", "hDeltaTimeMethodsVsP_posLaPr", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); + histos.add("hDeltaTimeMethodsVsP_posLaPi", "hDeltaTimeMethodsVsP_posLaPi", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); + histos.add("hDeltaTimeMethodsVsP_posK0Pi", "hDeltaTimeMethodsVsP_posK0Pi", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); + histos.add("hDeltaTimeMethodsVsP_negLaPr", "hDeltaTimeMethodsVsP_negLaPr", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); + histos.add("hDeltaTimeMethodsVsP_negLaPi", "hDeltaTimeMethodsVsP_negLaPi", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); + histos.add("hDeltaTimeMethodsVsP_negK0Pi", "hDeltaTimeMethodsVsP_negK0Pi", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); + + histos.add("hDeltaTimeMethodsVsP_posXiPi", "hDeltaTimeMethodsVsP_posXiPi", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); + histos.add("hDeltaTimeMethodsVsP_posXiPr", "hDeltaTimeMethodsVsP_posXiPr", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); + histos.add("hDeltaTimeMethodsVsP_negXiPi", "hDeltaTimeMethodsVsP_negXiPi", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); + histos.add("hDeltaTimeMethodsVsP_negXiPr", "hDeltaTimeMethodsVsP_negXiPr", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); + histos.add("hDeltaTimeMethodsVsP_bachXiPi", "hDeltaTimeMethodsVsP_bachXiPi", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); + + histos.add("hDeltaTimeMethodsVsP_posOmPi", "hDeltaTimeMethodsVsP_posOmPi", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); + histos.add("hDeltaTimeMethodsVsP_posOmPr", "hDeltaTimeMethodsVsP_posOmPr", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); + histos.add("hDeltaTimeMethodsVsP_negOmPi", "hDeltaTimeMethodsVsP_negOmPi", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); + histos.add("hDeltaTimeMethodsVsP_negOmPr", "hDeltaTimeMethodsVsP_negOmPr", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); + histos.add("hDeltaTimeMethodsVsP_bachOmKa", "hDeltaTimeMethodsVsP_bachOmKa", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); + + histos.add("hRatioTimeMethodsVsP_posLaPr", "hRatioTimeMethodsVsP_posLaPr", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); + histos.add("hRatioTimeMethodsVsP_posLaPi", "hRatioTimeMethodsVsP_posLaPi", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); + histos.add("hRatioTimeMethodsVsP_posK0Pi", "hRatioTimeMethodsVsP_posK0Pi", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); + histos.add("hRatioTimeMethodsVsP_negLaPr", "hRatioTimeMethodsVsP_negLaPr", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); + histos.add("hRatioTimeMethodsVsP_negLaPi", "hRatioTimeMethodsVsP_negLaPi", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); + histos.add("hRatioTimeMethodsVsP_negK0Pi", "hRatioTimeMethodsVsP_negK0Pi", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); + + histos.add("hRatioTimeMethodsVsP_posXiPi", "hRatioTimeMethodsVsP_posXiPi", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); + histos.add("hRatioTimeMethodsVsP_posXiPr", "hRatioTimeMethodsVsP_posXiPr", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); + histos.add("hRatioTimeMethodsVsP_negXiPi", "hRatioTimeMethodsVsP_negXiPi", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); + histos.add("hRatioTimeMethodsVsP_negXiPr", "hRatioTimeMethodsVsP_negXiPr", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); + histos.add("hRatioTimeMethodsVsP_bachXiPi", "hRatioTimeMethodsVsP_bachXiPi", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); + + histos.add("hRatioTimeMethodsVsP_posOmPi", "hRatioTimeMethodsVsP_posOmPi", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); + histos.add("hRatioTimeMethodsVsP_posOmPr", "hRatioTimeMethodsVsP_posOmPr", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); + histos.add("hRatioTimeMethodsVsP_negOmPi", "hRatioTimeMethodsVsP_negOmPi", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); + histos.add("hRatioTimeMethodsVsP_negOmPr", "hRatioTimeMethodsVsP_negOmPr", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); + histos.add("hRatioTimeMethodsVsP_bachOmKa", "hRatioTimeMethodsVsP_bachOmKa", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); + } + + // list memory consumption at start if running in modes with more output + if (calculationMethod.value == 2 || doQA) { + histos.print(); + } } void initCCDB(int runNumber) @@ -423,12 +562,12 @@ struct strangenesstofpid { grpmag.setL3Current(30000.f / (d_bz / 5.0f)); } o2::base::Propagator::initFieldFromGRP(&grpmag); - mVtx = ccdb->getForRun(mVtxPath, runNumber); + mVtx = ccdb->getForRun(ccdbConfigurations.mVtxPath, runNumber); mRunNumber = runNumber; return; } - o2::parameters::GRPObject* grpo = ccdb->getForRun(grpPath, runNumber); + o2::parameters::GRPObject* grpo = ccdb->getForRun(ccdbConfigurations.grpPath, runNumber); o2::parameters::GRPMagField* grpmag = 0x0; if (grpo) { o2::base::Propagator::initFieldFromGRP(grpo); @@ -436,20 +575,20 @@ struct strangenesstofpid { d_bz = grpo->getNominalL3Field(); LOG(info) << "Retrieved GRP for run " << runNumber << " with magnetic field of " << d_bz << " kZG"; } else { - grpmag = ccdb->getForRun(grpmagPath, runNumber); + grpmag = ccdb->getForRun(ccdbConfigurations.grpmagPath, runNumber); if (!grpmag) { - LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for run " << runNumber; + LOG(fatal) << "Got nullptr from CCDB for path " << ccdbConfigurations.grpmagPath << " of object GRPMagField and " << ccdbConfigurations.grpPath << " of object GRPObject for run " << runNumber; } o2::base::Propagator::initFieldFromGRP(grpmag); // Fetch magnetic field from ccdb for current collision d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); - mVtx = ccdb->getForRun(mVtxPath, runNumber); + mVtx = ccdb->getForRun(ccdbConfigurations.mVtxPath, runNumber); LOG(info) << "Retrieved GRP for run " << runNumber << " with magnetic field of " << d_bz << " kZG"; } // if TOF Nsigma desired if (doNSigmas) { - nSigmaCalibObjects = ccdb->getForRun(nSigmaPath, runNumber); + nSigmaCalibObjects = ccdb->getForRun(ccdbConfigurations.nSigmaPath, runNumber); if (nSigmaCalibObjects) { LOGF(info, "loaded TList with this many objects: %i", nSigmaCalibObjects->GetEntries()); nSigmaCalibLoaded = true; // made it thus far, mark loaded @@ -520,6 +659,15 @@ struct strangenesstofpid { } } } + + if (calculationMethod.value > 0 && !lut) { + // setMatLUT only after magfield has been initalized + // (setMatLUT has implicit and problematic init field call if not) + LOG(info) << "Loading full (all-radius) material look-up table for run number: " << runNumber; + lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->getForRun(ccdbConfigurations.lutPath, runNumber)); + o2::base::Propagator::Instance()->setMatLUT(lut); + LOG(info) << "Material look-up table loaded!"; + } mRunNumber = runNumber; } @@ -533,7 +681,7 @@ struct strangenesstofpid { // templatized process function for symmetric operation in derived and original AO2D template - void processV0Candidate(TCollision const& collision, TV0 const& v0, TTrack const& pTra, TTrack const& nTra) + void processV0Candidate(TCollision const& collision, TV0 const& v0, TTrack const& pTra, TTrack const& nTra, int v0pdg) { // time of V0 segment float lengthV0 = std::hypot(v0.x() - collision.getX(), v0.y() - collision.getY(), v0.z() - collision.getZ()); @@ -546,6 +694,10 @@ struct strangenesstofpid { o2::track::TrackPar posTrack = o2::track::TrackPar({v0.x(), v0.y(), v0.z()}, {v0.pxpos(), v0.pypos(), v0.pzpos()}, +1); o2::track::TrackPar negTrack = o2::track::TrackPar({v0.x(), v0.y(), v0.z()}, {v0.pxneg(), v0.pyneg(), v0.pzneg()}, -1); + // at minimum + float positiveP = std::hypot(v0.pxpos(), v0.pypos(), v0.pzpos()); + float negativeP = std::hypot(v0.pxneg(), v0.pyneg(), v0.pzneg()); + float deltaTimePositiveLambdaPi = o2::aod::v0data::kNoTOFValue; float deltaTimeNegativeLambdaPi = o2::aod::v0data::kNoTOFValue; float deltaTimePositiveLambdaPr = o2::aod::v0data::kNoTOFValue; @@ -560,24 +712,81 @@ struct strangenesstofpid { float nSigmaPositiveK0ShortPi = o2::aod::v0data::kNoTOFValue; float nSigmaNegativeK0ShortPi = o2::aod::v0data::kNoTOFValue; - float velocityPositivePr = velocity(posTrack.getP(), o2::constants::physics::MassProton); - float velocityPositivePi = velocity(posTrack.getP(), o2::constants::physics::MassPionCharged); - float velocityNegativePr = velocity(negTrack.getP(), o2::constants::physics::MassProton); - float velocityNegativePi = velocity(negTrack.getP(), o2::constants::physics::MassPionCharged); + float timePositivePr = o2::aod::v0data::kNoTOFValue; + float timePositivePi = o2::aod::v0data::kNoTOFValue; + float timeNegativePr = o2::aod::v0data::kNoTOFValue; + float timeNegativePi = o2::aod::v0data::kNoTOFValue; + + float timePositivePr_Method0 = o2::aod::v0data::kNoTOFValue; + float timePositivePi_Method0 = o2::aod::v0data::kNoTOFValue; + float timeNegativePr_Method0 = o2::aod::v0data::kNoTOFValue; + float timeNegativePi_Method0 = o2::aod::v0data::kNoTOFValue; + + float timePositivePr_Method1 = o2::aod::v0data::kNoTOFValue; + float timePositivePi_Method1 = o2::aod::v0data::kNoTOFValue; + float timeNegativePr_Method1 = o2::aod::v0data::kNoTOFValue; + float timeNegativePi_Method1 = o2::aod::v0data::kNoTOFValue; + + if (calculationMethod.value == 0 || calculationMethod.value == 2) { + float velocityPositivePr = velocity(posTrack.getP(), o2::constants::physics::MassProton); + float velocityPositivePi = velocity(posTrack.getP(), o2::constants::physics::MassPionCharged); + float velocityNegativePr = velocity(negTrack.getP(), o2::constants::physics::MassProton); + float velocityNegativePi = velocity(negTrack.getP(), o2::constants::physics::MassPionCharged); + + float lengthPositive = findInterceptLength(posTrack, d_bz); // FIXME: tofPosition ok? adjust? + float lengthNegative = findInterceptLength(negTrack, d_bz); // FIXME: tofPosition ok? adjust? + + if (lengthPositive > 0) { + timePositivePr_Method0 = lengthPositive / velocityPositivePr; + timePositivePi_Method0 = lengthPositive / velocityPositivePi; + } + if (lengthNegative > 0) { + timeNegativePr_Method0 = lengthNegative / velocityNegativePr; + timeNegativePi_Method0 = lengthNegative / velocityNegativePi; + } + } + + if (calculationMethod.value > 0) { + // method to calculate the time and length via Propagator TrackLTIntegral + if (pTra.hasTOF()) { // calculate if signal present, otherwise skip + o2::track::TrackPar posTrackAsProton(posTrack); + posTrackAsProton.setPID(o2::track::PID::Proton); + calculateTOF(posTrackAsProton, timePositivePr_Method1); - float lengthPositive = findInterceptLength(posTrack, d_bz); // FIXME: tofPosition ok? adjust? - float lengthNegative = findInterceptLength(negTrack, d_bz); // FIXME: tofPosition ok? adjust? - float timePositivePr = lengthPositive / velocityPositivePr; - float timePositivePi = lengthPositive / velocityPositivePi; - float timeNegativePr = lengthNegative / velocityNegativePr; - float timeNegativePi = lengthNegative / velocityNegativePi; + o2::track::TrackPar posTrackAsPion(posTrack); + posTrackAsPion.setPID(o2::track::PID::Pion); + calculateTOF(posTrackAsPion, timePositivePi_Method1); + } + if (nTra.hasTOF()) { // calculate if signal present, otherwise skip + o2::track::TrackPar negTrackAsProton(negTrack); + negTrackAsProton.setPID(o2::track::PID::Proton); + calculateTOF(negTrackAsProton, timeNegativePr_Method1); + + o2::track::TrackPar negTrackAsPion(negTrack); + negTrackAsPion.setPID(o2::track::PID::Pion); + calculateTOF(negTrackAsPion, timeNegativePi_Method1); + } + } - if (pTra.hasTOF() && lengthPositive > 0) { + // assign values to be used in main calculation + if (calculationMethod.value == 0) { + timePositivePr = timePositivePr_Method0; + timePositivePi = timePositivePi_Method0; + timeNegativePr = timeNegativePr_Method0; + timeNegativePi = timeNegativePi_Method0; + } else { + timePositivePr = timePositivePr_Method1; + timePositivePi = timePositivePi_Method1; + timeNegativePr = timeNegativePr_Method1; + timeNegativePi = timeNegativePi_Method1; + } + + if (pTra.hasTOF() && timePositivePr > 0) { deltaTimePositiveLambdaPr = (pTra.tofSignal() - pTra.tofEvTime()) - (timeLambda + timePositivePr); deltaTimePositiveLambdaPi = (pTra.tofSignal() - pTra.tofEvTime()) - (timeLambda + timePositivePi); deltaTimePositiveK0ShortPi = (pTra.tofSignal() - pTra.tofEvTime()) - (timeK0Short + timePositivePi); } - if (nTra.hasTOF() && lengthNegative > 0) { + if (nTra.hasTOF() && timeNegativePr > 0) { deltaTimeNegativeLambdaPr = (nTra.tofSignal() - nTra.tofEvTime()) - (timeLambda + timeNegativePr); deltaTimeNegativeLambdaPi = (nTra.tofSignal() - nTra.tofEvTime()) - (timeLambda + timeNegativePi); deltaTimeNegativeK0ShortPi = (nTra.tofSignal() - nTra.tofEvTime()) - (timeK0Short + timeNegativePi); @@ -586,12 +795,12 @@ struct strangenesstofpid { if (doQA) { // calculate and pack properties for QA purposes int posProperties = 0; - if (lengthPositive > 0) + if (timePositivePr > 0) posProperties = posProperties | (static_cast(1) << kLength); if (pTra.hasTOF()) posProperties = posProperties | (static_cast(1) << kHasTOF); int negProperties = 0; - if (lengthNegative > 0) + if (timeNegativePr > 0) negProperties = negProperties | (static_cast(1) << kLength); if (nTra.hasTOF()) negProperties = negProperties | (static_cast(1) << kHasTOF); @@ -603,7 +812,7 @@ struct strangenesstofpid { float deltaDecayTimeLambda = -10e+4; float deltaDecayTimeAntiLambda = -10e+4; float deltaDecayTimeK0Short = -10e+4; - if (nTra.hasTOF() && pTra.hasTOF() > 0 && lengthPositive > 0 && lengthNegative > 0) { // does not depend on event time + if (nTra.hasTOF() && pTra.hasTOF() > 0 && timePositivePr > 0 && timeNegativePr > 0) { // does not depend on event time deltaDecayTimeLambda = (pTra.tofSignal() - timePositivePr) - (nTra.tofSignal() - timeNegativePi); deltaDecayTimeAntiLambda = (pTra.tofSignal() - timePositivePi) - (nTra.tofSignal() - timeNegativePr); deltaDecayTimeK0Short = (pTra.tofSignal() - timePositivePi) - (nTra.tofSignal() - timeNegativePi); @@ -617,11 +826,8 @@ struct strangenesstofpid { float decayTimeK0Short = 0.5f * ((pTra.tofSignal() - timePositivePi) + (nTra.tofSignal() - timeNegativePi)) - evTimeMean; float betaLambda = o2::aod::cascdata::kNoTOFValue; - ; float betaAntiLambda = o2::aod::cascdata::kNoTOFValue; - ; float betaK0Short = o2::aod::cascdata::kNoTOFValue; - ; if (nTra.hasTOF() && pTra.hasTOF()) { betaLambda = (lengthV0 / decayTimeLambda) / 0.0299792458; @@ -659,27 +865,40 @@ struct strangenesstofpid { nSigmaPositiveK0ShortPi, nSigmaNegativeK0ShortPi); } - float positiveP = std::hypot(v0.pxpos(), v0.pypos(), v0.pzpos()); - float negativeP = std::hypot(v0.pxneg(), v0.pyneg(), v0.pzneg()); - if (doQA) { + // length factor due to eta (to offset e-loss) + float positiveCosine = 1.0f / sqrt(1.0f + posTrack.getTgl() * posTrack.getTgl()); + float negativeCosine = 1.0f / sqrt(1.0f + negTrack.getTgl() * negTrack.getTgl()); + if (correctELossInclination.value == false) { + negativeCosine = positiveCosine = 1.0f; + } + if (pTra.hasTOF()) { if (v0.v0cosPA() > v0Group.qaCosPA && v0.dcaV0daughters() < v0Group.qaDCADau) { - if (std::abs(v0.mLambda() - 1.115683) < v0Group.qaMassWindow && fabs(pTra.tpcNSigmaPr()) < v0Group.qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma) { + if (std::abs(v0.mLambda() - 1.115683) < v0Group.qaMassWindow && fabs(pTra.tpcNSigmaPr()) < v0Group.qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma && ((v0pdg == 0) || (v0pdg == 3122))) { histos.fill(HIST("h2dDeltaTimePositiveLambdaPr"), v0.p(), v0.eta(), deltaTimePositiveLambdaPr); - histos.fill(HIST("h2dProtonMeasuredVsExpected"), - (timeLambda + timePositivePr) / (pTra.tofSignal() - pTra.tofEvTime()), - positiveP, v0.positiveeta()); + if (calculationMethod.value == 2 && std::abs(timePositivePr_Method0 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon && std::abs(timePositivePr_Method1 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { + histos.fill(HIST("hDeltaTimeMethodsVsP_posLaPr"), positiveP, v0.positiveeta(), (timePositivePr_Method0 - timePositivePr_Method1) * positiveCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_posLaPr"), positiveP, v0.positiveeta(), (timePositivePr_Method1 / timePositivePr_Method0) * positiveCosine); + } if (doQANSigma) histos.fill(HIST("h2dNSigmaPositiveLambdaPr"), v0.p(), nSigmaPositiveLambdaPr); } - if (std::abs(v0.mAntiLambda() - 1.115683) < v0Group.qaMassWindow && fabs(pTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma && fabs(nTra.tpcNSigmaPr()) < v0Group.qaTPCNSigma) { + if (std::abs(v0.mAntiLambda() - 1.115683) < v0Group.qaMassWindow && fabs(pTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma && fabs(nTra.tpcNSigmaPr()) < v0Group.qaTPCNSigma && ((v0pdg == 0) || (v0pdg == -3122))) { histos.fill(HIST("h2dDeltaTimePositiveLambdaPi"), v0.p(), v0.eta(), deltaTimePositiveLambdaPi); + if (calculationMethod.value == 2 && std::abs(timePositivePi_Method0 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon && std::abs(timePositivePi_Method1 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { + histos.fill(HIST("hDeltaTimeMethodsVsP_posLaPi"), positiveP, v0.positiveeta(), (timePositivePi_Method0 - timePositivePi_Method1) * positiveCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_posLaPi"), positiveP, v0.positiveeta(), (timePositivePi_Method1 / timePositivePi_Method0) * positiveCosine); + } if (doQANSigma) histos.fill(HIST("h2dNSigmaPositiveLambdaPi"), v0.p(), nSigmaPositiveLambdaPi); } - if (std::abs(v0.mK0Short() - 0.497) < v0Group.qaMassWindow && fabs(pTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma) { + if (std::abs(v0.mK0Short() - 0.497) < v0Group.qaMassWindow && fabs(pTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma && ((v0pdg == 0) || (v0pdg == 310))) { histos.fill(HIST("h2dDeltaTimePositiveK0ShortPi"), v0.p(), v0.eta(), deltaTimePositiveK0ShortPi); + if (calculationMethod.value == 2 && std::abs(timePositivePi_Method0 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon && std::abs(timePositivePi_Method1 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { + histos.fill(HIST("hDeltaTimeMethodsVsP_posK0Pi"), positiveP, v0.positiveeta(), (timePositivePi_Method0 - timePositivePi_Method1) * positiveCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_posK0Pi"), positiveP, v0.positiveeta(), (timePositivePi_Method1 / timePositivePi_Method0) * positiveCosine); + } if (doQANSigma) histos.fill(HIST("h2dNSigmaPositiveK0ShortPi"), v0.p(), nSigmaPositiveK0ShortPi); } @@ -688,21 +907,30 @@ struct strangenesstofpid { if (nTra.hasTOF()) { if (v0.v0cosPA() > v0Group.qaCosPA && v0.dcaV0daughters() < v0Group.qaDCADau) { - if (std::abs(v0.mLambda() - 1.115683) < v0Group.qaMassWindow && fabs(pTra.tpcNSigmaPr()) < v0Group.qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma) { + if (std::abs(v0.mLambda() - 1.115683) < v0Group.qaMassWindow && fabs(pTra.tpcNSigmaPr()) < v0Group.qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma && ((v0pdg == 0) || (v0pdg == 3122))) { histos.fill(HIST("h2dDeltaTimeNegativeLambdaPi"), v0.p(), v0.eta(), deltaTimeNegativeLambdaPi); - histos.fill(HIST("h2dPionMeasuredVsExpected"), - (timeLambda + timeNegativePi) / (nTra.tofSignal() - nTra.tofEvTime()), - negativeP, v0.negativeeta()); + if (calculationMethod.value == 2 && std::abs(timeNegativePi_Method0 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon && std::abs(timeNegativePi_Method1 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { + histos.fill(HIST("hDeltaTimeMethodsVsP_negLaPi"), negativeP, v0.negativeeta(), (timeNegativePi_Method0 - timeNegativePi_Method1) * negativeCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_negLaPi"), negativeP, v0.negativeeta(), (timeNegativePi_Method1 / timeNegativePi_Method0) * negativeCosine); + } if (doQANSigma) histos.fill(HIST("h2dNSigmaNegativeLambdaPi"), v0.p(), nSigmaNegativeLambdaPi); } - if (std::abs(v0.mAntiLambda() - 1.115683) < v0Group.qaMassWindow && fabs(pTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma && fabs(nTra.tpcNSigmaPr()) < v0Group.qaTPCNSigma) { + if (std::abs(v0.mAntiLambda() - 1.115683) < v0Group.qaMassWindow && fabs(pTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma && fabs(nTra.tpcNSigmaPr()) < v0Group.qaTPCNSigma && ((v0pdg == 0) || (v0pdg == -3122))) { histos.fill(HIST("h2dDeltaTimeNegativeLambdaPr"), v0.p(), v0.eta(), deltaTimeNegativeLambdaPr); + if (calculationMethod.value == 2 && std::abs(timeNegativePr_Method0 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon && std::abs(timeNegativePr_Method1 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { + histos.fill(HIST("hDeltaTimeMethodsVsP_negLaPr"), negativeP, v0.negativeeta(), (timeNegativePr_Method0 - timeNegativePr_Method1) * negativeCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_negLaPr"), negativeP, v0.negativeeta(), (timeNegativePr_Method1 / timeNegativePr_Method0) * negativeCosine); + } if (doQANSigma) histos.fill(HIST("h2dNSigmaNegativeLambdaPr"), v0.p(), nSigmaNegativeLambdaPr); } - if (std::abs(v0.mK0Short() - 0.497) < v0Group.qaMassWindow && fabs(pTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma) { + if (std::abs(v0.mK0Short() - 0.497) < v0Group.qaMassWindow && fabs(pTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma && ((v0pdg == 0) || (v0pdg == 310))) { histos.fill(HIST("h2dDeltaTimeNegativeK0ShortPi"), v0.p(), v0.eta(), deltaTimeNegativeK0ShortPi); + if (calculationMethod.value == 2 && std::abs(timeNegativePi_Method0 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon && std::abs(timeNegativePi_Method1 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { + histos.fill(HIST("hDeltaTimeMethodsVsP_negK0Pi"), negativeP, v0.negativeeta(), (timeNegativePi_Method0 - timeNegativePi_Method1) * negativeCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_negK0Pi"), negativeP, v0.negativeeta(), (timeNegativePi_Method1 / timeNegativePi_Method0) * negativeCosine); + } if (doQANSigma) histos.fill(HIST("h2dNSigmaNegativeK0ShortPi"), v0.p(), nSigmaNegativeK0ShortPi); } @@ -714,7 +942,7 @@ struct strangenesstofpid { } template - void processCascadeCandidate(TCollision const& collision, TCascade const& cascade, TTrack const& pTra, TTrack const& nTra, TTrack const& bTra) + void processCascadeCandidate(TCollision const& collision, TCascade const& cascade, TTrack const& pTra, TTrack const& nTra, TTrack const& bTra, int cascpdg) { // initialize from positions and momenta as needed o2::track::TrackPar posTrack = o2::track::TrackPar({cascade.xlambda(), cascade.ylambda(), cascade.zlambda()}, {cascade.pxpos(), cascade.pypos(), cascade.pzpos()}, +1); @@ -722,29 +950,22 @@ struct strangenesstofpid { o2::track::TrackPar bachTrack = o2::track::TrackPar({cascade.x(), cascade.y(), cascade.z()}, {cascade.pxbach(), cascade.pybach(), cascade.pzbach()}, cascade.sign()); o2::track::TrackPar cascTrack = o2::track::TrackPar({cascade.x(), cascade.y(), cascade.z()}, {cascade.px(), cascade.py(), cascade.pz()}, cascade.sign()); + float positiveP = std::hypot(cascade.pxpos(), cascade.pypos(), cascade.pzpos()); + float negativeP = std::hypot(cascade.pxneg(), cascade.pyneg(), cascade.pzneg()); + float bachelorP = std::hypot(cascade.pxbach(), cascade.pybach(), cascade.pzbach()); + // start calculation: calculate velocities - float velocityPositivePr = velocity(posTrack.getP(), o2::constants::physics::MassProton); - float velocityPositivePi = velocity(posTrack.getP(), o2::constants::physics::MassPionCharged); - float velocityNegativePr = velocity(negTrack.getP(), o2::constants::physics::MassProton); - float velocityNegativePi = velocity(negTrack.getP(), o2::constants::physics::MassPionCharged); - float velocityBachelorPi = velocity(bachTrack.getP(), o2::constants::physics::MassPionCharged); - float velocityBachelorKa = velocity(bachTrack.getP(), o2::constants::physics::MassKaonCharged); float velocityXi = velocity(cascTrack.getP(), o2::constants::physics::MassXiMinus); float velocityOm = velocity(cascTrack.getP(), o2::constants::physics::MassOmegaMinus); float velocityLa = velocity(std::hypot(cascade.pxlambda(), cascade.pylambda(), cascade.pzlambda()), o2::constants::physics::MassLambda); - // calculate daughter length to TOF intercept - float lengthPositive = findInterceptLength(posTrack, d_bz); // FIXME: tofPosition ok? adjust? - float lengthNegative = findInterceptLength(negTrack, d_bz); // FIXME: tofPosition ok? adjust? - float lengthBachelor = findInterceptLength(bachTrack, d_bz); // FIXME: tofPosition ok? adjust? - // calculate mother lengths float lengthV0 = std::hypot(cascade.xlambda() - cascade.x(), cascade.ylambda() - cascade.y(), cascade.zlambda() - cascade.z()); float lengthCascade = o2::aod::cascdata::kNoTOFValue; ; const o2::math_utils::Point3D collVtx{collision.getX(), collision.getY(), collision.getZ()}; bool successPropag = o2::base::Propagator::Instance()->propagateToDCA(collVtx, cascTrack, d_bz, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrNONE); - float d = -1.0f, d3d = 0.0f; + float d = -1.0f; float linearToPV = std::hypot(cascade.x() - collision.getX(), cascade.y() - collision.getY(), cascade.z() - collision.getZ()); if (successPropag) { std::array cascCloseToPVPosition; @@ -755,7 +976,7 @@ struct strangenesstofpid { // calculate 2D distance between two points d = std::hypot(cascade.x() - cascCloseToPVPosition[0], cascade.y() - cascCloseToPVPosition[1]); - d3d = std::hypot(cascade.x() - cascCloseToPVPosition[0], cascade.y() - cascCloseToPVPosition[1], cascade.z() - cascCloseToPVPosition[2]); // cross-check variable + // d3d = std::hypot(cascade.x() - cascCloseToPVPosition[0], cascade.y() - cascCloseToPVPosition[1], cascade.z() - cascCloseToPVPosition[2]); // cross-check variable float sinThetaOverTwo = d / (2.0f * trcCircleCascade.rC); lengthCascade = 2.0f * trcCircleCascade.rC * TMath::ASin(sinThetaOverTwo); lengthCascade *= sqrt(1.0f + cascTrack.getTgl() * cascTrack.getTgl()); @@ -769,12 +990,100 @@ struct strangenesstofpid { float lambdaFlight = lengthV0 / velocityLa; float xiFlight = lengthCascade / velocityXi; float omFlight = lengthCascade / velocityOm; - float posFlightPi = lengthPositive / velocityPositivePi; - float posFlightPr = lengthPositive / velocityPositivePr; - float negFlightPi = lengthNegative / velocityNegativePi; - float negFlightPr = lengthNegative / velocityNegativePr; - float bachFlightPi = lengthBachelor / velocityBachelorPi; - float bachFlightKa = lengthBachelor / velocityBachelorKa; + float posFlightPi = o2::aod::cascdata::kNoTOFValue; + float posFlightPr = o2::aod::cascdata::kNoTOFValue; + float negFlightPi = o2::aod::cascdata::kNoTOFValue; + float negFlightPr = o2::aod::cascdata::kNoTOFValue; + float bachFlightPi = o2::aod::cascdata::kNoTOFValue; + float bachFlightKa = o2::aod::cascdata::kNoTOFValue; + + float posFlightPi_Method0 = o2::aod::cascdata::kNoTOFValue; + float posFlightPr_Method0 = o2::aod::cascdata::kNoTOFValue; + float negFlightPi_Method0 = o2::aod::cascdata::kNoTOFValue; + float negFlightPr_Method0 = o2::aod::cascdata::kNoTOFValue; + float bachFlightPi_Method0 = o2::aod::cascdata::kNoTOFValue; + float bachFlightKa_Method0 = o2::aod::cascdata::kNoTOFValue; + + float posFlightPi_Method1 = o2::aod::cascdata::kNoTOFValue; + float posFlightPr_Method1 = o2::aod::cascdata::kNoTOFValue; + float negFlightPi_Method1 = o2::aod::cascdata::kNoTOFValue; + float negFlightPr_Method1 = o2::aod::cascdata::kNoTOFValue; + float bachFlightPi_Method1 = o2::aod::cascdata::kNoTOFValue; + float bachFlightKa_Method1 = o2::aod::cascdata::kNoTOFValue; + + // actual time-of-flight of daughter calculation + if (calculationMethod.value == 0 || calculationMethod.value == 2) { + float velocityPositivePr = velocity(posTrack.getP(), o2::constants::physics::MassProton); + float velocityPositivePi = velocity(posTrack.getP(), o2::constants::physics::MassPionCharged); + float velocityNegativePr = velocity(negTrack.getP(), o2::constants::physics::MassProton); + float velocityNegativePi = velocity(negTrack.getP(), o2::constants::physics::MassPionCharged); + float velocityBachelorPi = velocity(bachTrack.getP(), o2::constants::physics::MassPionCharged); + float velocityBachelorKa = velocity(bachTrack.getP(), o2::constants::physics::MassKaonCharged); + + float lengthPositive = findInterceptLength(posTrack, d_bz); // FIXME: tofPosition ok? adjust? + float lengthNegative = findInterceptLength(negTrack, d_bz); // FIXME: tofPosition ok? adjust? + float lengthBachelor = findInterceptLength(bachTrack, d_bz); // FIXME: tofPosition ok? adjust? + + if (lengthPositive > 0) { + posFlightPi_Method0 = lengthPositive / velocityPositivePi; + posFlightPr_Method0 = lengthPositive / velocityPositivePr; + } + if (lengthNegative > 0) { + negFlightPi_Method0 = lengthNegative / velocityNegativePi; + negFlightPr_Method0 = lengthNegative / velocityNegativePr; + } + if (lengthBachelor > 0) { + bachFlightPi_Method0 = lengthBachelor / velocityBachelorPi; + bachFlightKa_Method0 = lengthBachelor / velocityBachelorKa; + } + } + + if (calculationMethod.value > 0) { + if (pTra.hasTOF()) { // calculate if signal present, otherwise skip + o2::track::TrackPar posTrackAsProton(posTrack); + posTrackAsProton.setPID(o2::track::PID::Proton); + calculateTOF(posTrackAsProton, posFlightPr_Method1); + + o2::track::TrackPar posTrackAsPion(posTrack); + posTrackAsPion.setPID(o2::track::PID::Pion); + calculateTOF(posTrackAsPion, posFlightPi_Method1); + } + if (nTra.hasTOF()) { // calculate if signal present, otherwise skip + o2::track::TrackPar negTrackAsProton(negTrack); + negTrackAsProton.setPID(o2::track::PID::Proton); + calculateTOF(negTrackAsProton, negFlightPr_Method1); + + o2::track::TrackPar negTrackAsPion(negTrack); + negTrackAsPion.setPID(o2::track::PID::Pion); + calculateTOF(negTrackAsPion, negFlightPi_Method1); + } + if (bTra.hasTOF()) { // calculate if signal present, otherwise skip + o2::track::TrackPar bachTrackAsPion(bachTrack); + bachTrackAsPion.setPID(o2::track::PID::Pion); + calculateTOF(bachTrackAsPion, bachFlightPi_Method1); + + o2::track::TrackPar bachTrackAsKaon(bachTrack); + bachTrackAsKaon.setPID(o2::track::PID::Kaon); + calculateTOF(bachTrackAsKaon, bachFlightKa_Method1); + } + } + + // assign values to be used in main calculation + if (calculationMethod.value == 0) { + posFlightPi = posFlightPi_Method0; + posFlightPr = posFlightPr_Method0; + negFlightPi = negFlightPi_Method0; + negFlightPr = negFlightPr_Method0; + bachFlightPi = bachFlightPi_Method0; + bachFlightKa = bachFlightKa_Method0; + } else { + posFlightPi = posFlightPi_Method1; + posFlightPr = posFlightPr_Method1; + negFlightPi = negFlightPi_Method1; + negFlightPr = negFlightPr_Method1; + bachFlightPi = bachFlightPi_Method1; + bachFlightKa = bachFlightKa_Method1; + } // initialize delta-times (actual PID variables) float posDeltaTimeAsXiPi = o2::aod::cascdata::kNoTOFValue, posDeltaTimeAsXiPr = o2::aod::cascdata::kNoTOFValue; @@ -806,17 +1115,11 @@ struct strangenesstofpid { posDeltaTimeAsOmPi, posDeltaTimeAsOmPr, negDeltaTimeAsOmPi, negDeltaTimeAsOmPr, bachDeltaTimeAsOmKa); float nSigmaXiLaPr = o2::aod::cascdata::kNoTOFValue; - ; float nSigmaXiLaPi = o2::aod::cascdata::kNoTOFValue; - ; float nSigmaXiPi = o2::aod::cascdata::kNoTOFValue; - ; float nSigmaOmLaPr = o2::aod::cascdata::kNoTOFValue; - ; float nSigmaOmLaPi = o2::aod::cascdata::kNoTOFValue; - ; float nSigmaOmKa = o2::aod::cascdata::kNoTOFValue; - ; // go for Nsigma values if requested if (doNSigmas && nSigmaCalibLoaded) { @@ -852,25 +1155,58 @@ struct strangenesstofpid { } if (doQA) { - // fill QA histograms for cross-checking - histos.fill(HIST("hArcDebug"), cascade.p(), lengthCascade - d3d); // for debugging purposes + // length factor due to eta (to offset e-loss) + float positiveCosine = 1.0f / sqrt(1.0f + posTrack.getTgl() * posTrack.getTgl()); + float negativeCosine = 1.0f / sqrt(1.0f + negTrack.getTgl() * negTrack.getTgl()); + float bachelorCosine = 1.0f / sqrt(1.0f + bachTrack.getTgl() * bachTrack.getTgl()); + if (correctELossInclination.value == false) { + negativeCosine = positiveCosine = bachelorCosine = 1.0f; + } if (cascade.dcaV0daughters() < cascadeGroup.qaV0DCADau && cascade.dcacascdaughters() < cascadeGroup.qaCascDCADau && cascade.v0cosPA(collision.getX(), collision.getY(), collision.getZ()) > cascadeGroup.qaV0CosPA && cascade.casccosPA(collision.getX(), collision.getY(), collision.getZ()) > cascadeGroup.qaCascCosPA) { if (cascade.sign() < 0) { - if (std::abs(cascade.mXi() - 1.32171) < cascadeGroup.qaMassWindow && fabs(pTra.tpcNSigmaPr()) < cascadeGroup.qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < cascadeGroup.qaTPCNSigma && fabs(bTra.tpcNSigmaPi()) < cascadeGroup.qaTPCNSigma) { + if (std::abs(cascade.mXi() - 1.32171) < cascadeGroup.qaMassWindow && fabs(pTra.tpcNSigmaPr()) < cascadeGroup.qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < cascadeGroup.qaTPCNSigma && fabs(bTra.tpcNSigmaPi()) < cascadeGroup.qaTPCNSigma && ((cascpdg == 0) || (cascpdg == 3312))) { histos.fill(HIST("h2dposDeltaTimeAsXiPr"), cascade.p(), cascade.eta(), posDeltaTimeAsXiPr); histos.fill(HIST("h2dnegDeltaTimeAsXiPi"), cascade.p(), cascade.eta(), negDeltaTimeAsXiPi); histos.fill(HIST("h2dbachDeltaTimeAsXiPi"), cascade.p(), cascade.eta(), bachDeltaTimeAsXiPi); + if (calculationMethod.value == 2) { + if (std::abs(posFlightPr_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(posFlightPr_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { + histos.fill(HIST("hDeltaTimeMethodsVsP_posXiPr"), positiveP, cascade.positiveeta(), (posFlightPr_Method0 - posFlightPr_Method1) * positiveCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_posXiPr"), positiveP, cascade.positiveeta(), (posFlightPr_Method1 / posFlightPr_Method0) * positiveCosine); + } + if (std::abs(negFlightPi_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(negFlightPi_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { + histos.fill(HIST("hDeltaTimeMethodsVsP_negXiPi"), negativeP, cascade.negativeeta(), (negFlightPi_Method0 - negFlightPi_Method1) * negativeCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_negXiPi"), negativeP, cascade.negativeeta(), (negFlightPi_Method1 / negFlightPi_Method0) * negativeCosine); + } + if (std::abs(bachFlightPi_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(bachFlightPi_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { + histos.fill(HIST("hDeltaTimeMethodsVsP_bachXiPi"), bachelorP, cascade.bacheloreta(), (bachFlightPi_Method0 - bachFlightPi_Method1) * bachelorCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_bachXiPi"), bachelorP, cascade.bacheloreta(), (bachFlightPi_Method1 / bachFlightPi_Method0) * bachelorCosine); + } + } if (doQANSigma) { histos.fill(HIST("h2dNSigmaXiLaPi"), cascade.p(), nSigmaXiLaPi); histos.fill(HIST("h2dNSigmaXiLaPr"), cascade.p(), nSigmaXiLaPr); histos.fill(HIST("h2dNSigmaXiPi"), cascade.p(), nSigmaXiPi); } } - if (std::abs(cascade.mOmega() - 1.67245) < cascadeGroup.qaMassWindow && fabs(pTra.tpcNSigmaPr()) < cascadeGroup.qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < cascadeGroup.qaTPCNSigma && fabs(bTra.tpcNSigmaKa()) < cascadeGroup.qaTPCNSigma) { + if (std::abs(cascade.mOmega() - 1.67245) < cascadeGroup.qaMassWindow && fabs(pTra.tpcNSigmaPr()) < cascadeGroup.qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < cascadeGroup.qaTPCNSigma && fabs(bTra.tpcNSigmaKa()) < cascadeGroup.qaTPCNSigma && ((cascpdg == 0) || (cascpdg == 3334))) { histos.fill(HIST("h2dposDeltaTimeAsOmPr"), cascade.p(), cascade.eta(), posDeltaTimeAsOmPr); histos.fill(HIST("h2dnegDeltaTimeAsOmPi"), cascade.p(), cascade.eta(), negDeltaTimeAsOmPi); histos.fill(HIST("h2dbachDeltaTimeAsOmKa"), cascade.p(), cascade.eta(), bachDeltaTimeAsOmKa); + if (calculationMethod.value == 2) { + if (std::abs(posFlightPr_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(posFlightPr_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { + histos.fill(HIST("hDeltaTimeMethodsVsP_posOmPr"), positiveP, cascade.positiveeta(), (posFlightPr_Method0 - posFlightPr_Method1) * positiveCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_posOmPr"), positiveP, cascade.positiveeta(), (posFlightPr_Method1 / posFlightPr_Method0) * positiveCosine); + } + if (std::abs(negFlightPi_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(negFlightPi_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { + histos.fill(HIST("hDeltaTimeMethodsVsP_negOmPi"), negativeP, cascade.negativeeta(), (negFlightPi_Method0 - negFlightPi_Method1) * negativeCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_negOmPi"), negativeP, cascade.negativeeta(), (negFlightPi_Method1 / negFlightPi_Method0) * negativeCosine); + } + if (std::abs(bachFlightKa_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(bachFlightKa_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { + histos.fill(HIST("hDeltaTimeMethodsVsP_bachOmKa"), bachelorP, cascade.bacheloreta(), (bachFlightKa_Method0 - bachFlightKa_Method1) * bachelorCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_bachOmKa"), bachelorP, cascade.bacheloreta(), (bachFlightKa_Method1 / bachFlightKa_Method0) * bachelorCosine); + } + } if (doQANSigma) { histos.fill(HIST("h2dNSigmaOmLaPi"), cascade.p(), nSigmaOmLaPi); histos.fill(HIST("h2dNSigmaOmLaPr"), cascade.p(), nSigmaOmLaPr); @@ -878,20 +1214,48 @@ struct strangenesstofpid { } } } else { - if (std::abs(cascade.mXi() - 1.32171) < cascadeGroup.qaMassWindow && fabs(pTra.tpcNSigmaPi()) < cascadeGroup.qaTPCNSigma && fabs(nTra.tpcNSigmaPr()) < cascadeGroup.qaTPCNSigma && fabs(bTra.tpcNSigmaPi()) < cascadeGroup.qaTPCNSigma) { + if (std::abs(cascade.mXi() - 1.32171) < cascadeGroup.qaMassWindow && fabs(pTra.tpcNSigmaPi()) < cascadeGroup.qaTPCNSigma && fabs(nTra.tpcNSigmaPr()) < cascadeGroup.qaTPCNSigma && fabs(bTra.tpcNSigmaPi()) < cascadeGroup.qaTPCNSigma && ((cascpdg == 0) || (cascpdg == -3312))) { histos.fill(HIST("h2dposDeltaTimeAsXiPi"), cascade.p(), cascade.eta(), posDeltaTimeAsXiPi); histos.fill(HIST("h2dnegDeltaTimeAsXiPr"), cascade.p(), cascade.eta(), negDeltaTimeAsXiPr); histos.fill(HIST("h2dbachDeltaTimeAsXiPi"), cascade.p(), cascade.eta(), bachDeltaTimeAsXiPi); + if (calculationMethod.value == 2) { + if (std::abs(posFlightPi_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(posFlightPi_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { + histos.fill(HIST("hDeltaTimeMethodsVsP_posXiPi"), positiveP, cascade.positiveeta(), (posFlightPi_Method0 - posFlightPi_Method1) * positiveCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_posXiPi"), positiveP, cascade.positiveeta(), (posFlightPi_Method1 / posFlightPi_Method1) * positiveCosine); + } + if (std::abs(negFlightPr_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(negFlightPr_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { + histos.fill(HIST("hDeltaTimeMethodsVsP_negXiPr"), negativeP, cascade.negativeeta(), (negFlightPr_Method0 - negFlightPr_Method1) * negativeCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_negXiPr"), negativeP, cascade.negativeeta(), (negFlightPr_Method1 / negFlightPr_Method0) * negativeCosine); + } + if (std::abs(bachFlightPi_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(bachFlightPi_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { + histos.fill(HIST("hDeltaTimeMethodsVsP_bachXiPi"), bachelorP, cascade.bacheloreta(), (bachFlightPi_Method0 - bachFlightPi_Method1) * bachelorCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_bachXiPi"), bachelorP, cascade.bacheloreta(), (bachFlightPi_Method1 / bachFlightPi_Method0) * bachelorCosine); + } + } if (doQANSigma) { histos.fill(HIST("h2dNSigmaXiLaPi"), cascade.p(), nSigmaXiLaPi); histos.fill(HIST("h2dNSigmaXiLaPr"), cascade.p(), nSigmaXiLaPr); histos.fill(HIST("h2dNSigmaXiPi"), cascade.p(), nSigmaXiPi); } } - if (std::abs(cascade.mOmega() - 1.67245) < cascadeGroup.qaMassWindow && fabs(pTra.tpcNSigmaPi()) < cascadeGroup.qaTPCNSigma && fabs(nTra.tpcNSigmaPr()) < cascadeGroup.qaTPCNSigma && fabs(bTra.tpcNSigmaKa()) < cascadeGroup.qaTPCNSigma) { + if (std::abs(cascade.mOmega() - 1.67245) < cascadeGroup.qaMassWindow && fabs(pTra.tpcNSigmaPi()) < cascadeGroup.qaTPCNSigma && fabs(nTra.tpcNSigmaPr()) < cascadeGroup.qaTPCNSigma && fabs(bTra.tpcNSigmaKa()) < cascadeGroup.qaTPCNSigma && ((cascpdg == 0) || (cascpdg == -3334))) { histos.fill(HIST("h2dposDeltaTimeAsOmPi"), cascade.p(), cascade.eta(), posDeltaTimeAsOmPi); histos.fill(HIST("h2dnegDeltaTimeAsOmPr"), cascade.p(), cascade.eta(), negDeltaTimeAsOmPr); histos.fill(HIST("h2dbachDeltaTimeAsOmKa"), cascade.p(), cascade.eta(), bachDeltaTimeAsOmKa); + if (calculationMethod.value == 2) { + if (std::abs(posFlightPi_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(posFlightPi_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { + histos.fill(HIST("hDeltaTimeMethodsVsP_posOmPi"), positiveP, cascade.positiveeta(), (posFlightPi_Method0 - posFlightPi_Method1) * positiveCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_posOmPi"), positiveP, cascade.positiveeta(), (posFlightPi_Method1 / posFlightPi_Method1) * positiveCosine); + } + if (std::abs(negFlightPr_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(negFlightPr_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { + histos.fill(HIST("hDeltaTimeMethodsVsP_negOmPr"), negativeP, cascade.negativeeta(), (negFlightPr_Method0 - negFlightPr_Method1) * negativeCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_negOmPr"), negativeP, cascade.negativeeta(), (negFlightPr_Method1 / negFlightPr_Method0) * negativeCosine); + } + if (std::abs(bachFlightKa_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(bachFlightKa_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { + histos.fill(HIST("hDeltaTimeMethodsVsP_bachOmKa"), bachelorP, cascade.bacheloreta(), (bachFlightKa_Method0 - bachFlightKa_Method1) * bachelorCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_bachOmKa"), bachelorP, cascade.bacheloreta(), (bachFlightKa_Method1 / bachFlightKa_Method1) * bachelorCosine); + } + } if (doQANSigma) { histos.fill(HIST("h2dNSigmaOmLaPi"), cascade.p(), nSigmaOmLaPi); histos.fill(HIST("h2dNSigmaOmLaPr"), cascade.p(), nSigmaOmLaPr); @@ -928,7 +1292,7 @@ struct strangenesstofpid { auto pTra = V0.posTrack_as(); auto nTra = V0.negTrack_as(); - processV0Candidate(primaryVertex, V0, pTra, nTra); + processV0Candidate(primaryVertex, V0, pTra, nTra, 0); } } @@ -947,7 +1311,7 @@ struct strangenesstofpid { auto pTra = cascade.posTrack_as(); auto nTra = cascade.negTrack_as(); auto bTra = cascade.bachelor_as(); - processCascadeCandidate(primaryVertex, cascade, pTra, nTra, bTra); + processCascadeCandidate(primaryVertex, cascade, pTra, nTra, bTra, 0); } } } @@ -977,7 +1341,7 @@ struct strangenesstofpid { auto pTra = V0.posTrackExtra_as(); auto nTra = V0.negTrackExtra_as(); - processV0Candidate(primaryVertex, V0, pTra, nTra); + processV0Candidate(primaryVertex, V0, pTra, nTra, 0); } } @@ -996,13 +1360,83 @@ struct strangenesstofpid { auto pTra = cascade.posTrackExtra_as(); auto nTra = cascade.negTrackExtra_as(); auto bTra = cascade.bachTrackExtra_as(); - processCascadeCandidate(primaryVertex, cascade, pTra, nTra, bTra); + processCascadeCandidate(primaryVertex, cascade, pTra, nTra, bTra, 0); + } + } + } + + void processDerivedDataMCTest(soa::Join const& collisions, V0DerivedDatasMC const& V0s, CascDerivedDatasMC const& cascades, dauTracks const&, aod::V0MCCores const& v0mcs, aod::CascMCCores const& cascmcs) + { + // Fire up CCDB with first collision in record. If no collisions, bypass + if (useCustomRunNumber || collisions.size() < 1) { + initCCDB(manualRunNumber); + } else { + auto collision = collisions.begin(); + initCCDB(collision.runNumber()); + } + + if (calculateV0s.value) { + for (const auto& V0 : V0s) { + // for storing whatever is the relevant quantity for the PV + o2::dataformats::VertexBase primaryVertex; + if (V0.has_straCollision()) { + auto const& collision = V0.straCollision_as>(); + primaryVertex.setPos({collision.posX(), collision.posY(), collision.posZ()}); + // cov: won't be used anyways, all fine + primaryVertex.setCov(1e-6, 1e-6, 1e-6, 1e-6, 1e-6, 1e-6); + } else { + primaryVertex.setPos({mVtx->getX(), mVtx->getY(), mVtx->getZ()}); + } + + // check association + int v0pdg = 0; + if (V0.v0MCCoreId() > -1) { + auto v0mc = v0mcs.rawIteratorAt(V0.v0MCCoreId()); + v0pdg = v0mc.pdgCode(); + if (std::abs(v0pdg) != 3122 && v0pdg != 310) { + continue; // only associated from this point on + } + } + + auto pTra = V0.posTrackExtra_as(); + auto nTra = V0.negTrackExtra_as(); + processV0Candidate(primaryVertex, V0, pTra, nTra, v0pdg); + } + } + + if (calculateCascades.value) { + for (const auto& cascade : cascades) { + // for storing whatever is the relevant quantity for the PV + o2::dataformats::VertexBase primaryVertex; + if (cascade.has_straCollision()) { + auto const& collision = cascade.straCollision_as>(); + primaryVertex.setPos({collision.posX(), collision.posY(), collision.posZ()}); + primaryVertex.setCov(1e-6, 1e-6, 1e-6, 1e-6, 1e-6, 1e-6); + } else { + primaryVertex.setPos({mVtx->getX(), mVtx->getY(), mVtx->getZ()}); + } + + // check association + int cascpdg = 0; + if (cascade.cascMCCoreId() > -1) { + auto cascmc = cascmcs.rawIteratorAt(cascade.cascMCCoreId()); + cascpdg = cascmc.pdgCode(); + if (std::abs(cascpdg) != 3312 && std::abs(cascpdg) != 3334) { + continue; // only associated from this point on + } + } + + auto pTra = cascade.posTrackExtra_as(); + auto nTra = cascade.negTrackExtra_as(); + auto bTra = cascade.bachTrackExtra_as(); + processCascadeCandidate(primaryVertex, cascade, pTra, nTra, bTra, cascpdg); } } } - PROCESS_SWITCH(strangenesstofpid, processStandardData, "Process standard data", true); - PROCESS_SWITCH(strangenesstofpid, processDerivedData, "Process derived data", false); + PROCESS_SWITCH(strangenesstofpid, processStandardData, "Process standard data", false); + PROCESS_SWITCH(strangenesstofpid, processDerivedData, "Process derived data", true); + PROCESS_SWITCH(strangenesstofpid, processDerivedDataMCTest, "Process derived data / MC with assoc / not for analysis", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 3d95ef49b92ec7a043f2b463933199e3723aef51 Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Sat, 23 Aug 2025 15:38:09 +0530 Subject: [PATCH 163/986] [PWGLF] Minor corrections (#12697) Co-authored-by: Sawan Sawan --- .../Tasks/Resonances/higherMassResonances.cxx | 98 ++++++++++--------- 1 file changed, 51 insertions(+), 47 deletions(-) diff --git a/PWGLF/Tasks/Resonances/higherMassResonances.cxx b/PWGLF/Tasks/Resonances/higherMassResonances.cxx index 7b13c8e0596..fbb552a9b29 100644 --- a/PWGLF/Tasks/Resonances/higherMassResonances.cxx +++ b/PWGLF/Tasks/Resonances/higherMassResonances.cxx @@ -237,8 +237,8 @@ struct HigherMassResonances { if (config.qAevents) { rEventSelection.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexZAxis}}); rEventSelection.add("hmultiplicity", "multiplicity percentile distribution", {HistType::kTH1F, {{150, 0.0f, 150.0f}}}); - hglue.add("htrackscheck_v0", "htrackscheck_v0", kTH1I, {{15, 0, 15}}); - hglue.add("htrackscheck_v0_daughters", "htrackscheck_v0_daughters", kTH1I, {{15, 0, 15}}); + rEventSelection.add("htrackscheck_v0", "htrackscheck_v0", kTH1I, {{15, 0, 15}}); + rEventSelection.add("htrackscheck_v0_daughters", "htrackscheck_v0_daughters", kTH1I, {{15, 0, 15}}); hMChists.add("events_check", "No. of events in the generated MC", kTH1I, {{20, 0, 20}}); hMChists.add("events_checkrec", "No. of events in the reconstructed MC", kTH1I, {{25, 0, 25}}); @@ -282,7 +282,7 @@ struct HigherMassResonances { hv0DauLabel->GetXaxis()->SetBinLabel(7, "Eta"); hv0DauLabel->GetXaxis()->SetBinLabel(8, "PID TPC"); - std::shared_ptr hv0labelmcrec = rEventSelection.get(HIST("events_checkrec")); + std::shared_ptr hv0labelmcrec = hMChists.get(HIST("events_checkrec")); hv0labelmcrec->GetXaxis()->SetBinLabel(1, "All Tracks"); hv0labelmcrec->GetXaxis()->SetBinLabel(2, "V0Daughter Sel."); hv0labelmcrec->GetXaxis()->SetBinLabel(3, "V0 Sel."); @@ -455,52 +455,52 @@ struct HigherMassResonances { if (config.correlation2Dhist) rKzeroShort.fill(HIST("mass_lambda_kshort_before"), candidate.mK0Short(), candidate.mLambda()); - hglue.fill(HIST("htrackscheck_v0"), 0.5); + rEventSelection.fill(HIST("htrackscheck_v0"), 0.5); if (config.isApplyDCAv0topv && std::fabs(candidate.dcav0topv()) > config.cMaxV0DCA) { return false; } - hglue.fill(HIST("htrackscheck_v0"), 1.5); + rEventSelection.fill(HIST("htrackscheck_v0"), 1.5); if (std::abs(candidate.rapidity(0)) >= config.confKsrapidity) { return false; } - hglue.fill(HIST("htrackscheck_v0"), 2.5); + rEventSelection.fill(HIST("htrackscheck_v0"), 2.5); if (pT < config.confV0PtMin) { return false; } - hglue.fill(HIST("htrackscheck_v0"), 3.5); + rEventSelection.fill(HIST("htrackscheck_v0"), 3.5); if (dcaDaughv0 > config.confV0DCADaughMax) { return false; } - hglue.fill(HIST("htrackscheck_v0"), 4.5); + rEventSelection.fill(HIST("htrackscheck_v0"), 4.5); if (cpav0 < config.confV0CPAMin) { return false; } - hglue.fill(HIST("htrackscheck_v0"), 5.5); + rEventSelection.fill(HIST("htrackscheck_v0"), 5.5); if (tranRad < config.confV0TranRadV0Min) { return false; } - hglue.fill(HIST("htrackscheck_v0"), 6.5); + rEventSelection.fill(HIST("htrackscheck_v0"), 6.5); if (tranRad > config.confV0TranRadV0Max) { return false; } - hglue.fill(HIST("htrackscheck_v0"), 7.5); + rEventSelection.fill(HIST("htrackscheck_v0"), 7.5); if (std::fabs(ctauK0s) > config.cMaxV0LifeTime) { return false; } - hglue.fill(HIST("htrackscheck_v0"), 8.5); + rEventSelection.fill(HIST("htrackscheck_v0"), 8.5); if (config.isapplyCompetingcut && (std::abs(candidate.mLambda() - o2::constants::physics::MassLambda0) <= config.competingcascrejlambda || std::abs(candidate.mAntiLambda() - o2::constants::physics::MassLambda0) <= config.competingcascrejlambda)) { return false; } - hglue.fill(HIST("htrackscheck_v0"), 9.5); + rEventSelection.fill(HIST("htrackscheck_v0"), 9.5); if (config.correlation2Dhist) rKzeroShort.fill(HIST("mass_lambda_kshort_after10"), candidate.mK0Short(), candidate.mLambda()); @@ -512,12 +512,12 @@ struct HigherMassResonances { if (config.isStandardV0 && candidate.v0Type() != 1) { return false; // Only standard V0s are selected } - hglue.fill(HIST("htrackscheck_v0"), 10.5); + rEventSelection.fill(HIST("htrackscheck_v0"), 10.5); if (candidate.mK0Short() < lowmasscutks0 || candidate.mK0Short() > highmasscutks0) { return false; } - hglue.fill(HIST("htrackscheck_v0"), 11.5); + rEventSelection.fill(HIST("htrackscheck_v0"), 11.5); return true; } @@ -533,44 +533,44 @@ struct HigherMassResonances { const auto tpcNClsF = track.tpcNClsFound(); const auto sign = track.sign(); - hglue.fill(HIST("htrackscheck_v0_daughters"), 0.5); + rEventSelection.fill(HIST("htrackscheck_v0_daughters"), 0.5); if (config.hasTPC && !track.hasTPC()) return false; - hglue.fill(HIST("htrackscheck_v0_daughters"), 1.5); + rEventSelection.fill(HIST("htrackscheck_v0_daughters"), 1.5); if (track.tpcNClsCrossedRows() < config.tpcCrossedrows) return false; - hglue.fill(HIST("htrackscheck_v0_daughters"), 2.5); + rEventSelection.fill(HIST("htrackscheck_v0_daughters"), 2.5); if (track.tpcCrossedRowsOverFindableCls() < config.tpcCrossedrowsOverfcls) return false; - hglue.fill(HIST("htrackscheck_v0_daughters"), 3.5); + rEventSelection.fill(HIST("htrackscheck_v0_daughters"), 3.5); if (tpcNClsF < config.confDaughTPCnclsMin) { return false; } - hglue.fill(HIST("htrackscheck_v0_daughters"), 4.5); + rEventSelection.fill(HIST("htrackscheck_v0_daughters"), 4.5); if (charge < 0 && sign > 0) { return false; } - hglue.fill(HIST("htrackscheck_v0_daughters"), 5.5); + rEventSelection.fill(HIST("htrackscheck_v0_daughters"), 5.5); if (charge > 0 && sign < 0) { return false; } - hglue.fill(HIST("htrackscheck_v0_daughters"), 6.5); + rEventSelection.fill(HIST("htrackscheck_v0_daughters"), 6.5); if (std::abs(eta) > config.confDaughEta) { return false; } - hglue.fill(HIST("htrackscheck_v0_daughters"), 7.5); + rEventSelection.fill(HIST("htrackscheck_v0_daughters"), 7.5); if (std::abs(nsigmaV0DaughterTPC) > config.confDaughPIDCutTPC) { return false; } - hglue.fill(HIST("htrackscheck_v0_daughters"), 8.5); + rEventSelection.fill(HIST("htrackscheck_v0_daughters"), 8.5); // if (std::abs()) @@ -887,8 +887,12 @@ struct HigherMassResonances { } PROCESS_SWITCH(HigherMassResonances, processSE, "same event process", true); - using EventCandidatesDerivedData = soa::Join; - using V0CandidatesDerivedData = soa::Join; + // using EventCandidates = soa::Filtered>; + // using TrackCandidates = soa::Filtered>; + // using V0TrackCandidate = aod::V0Datas; + + using EventCandidatesDerivedData = soa::Join; + using V0CandidatesDerivedData = soa::Join; using DauTracks = soa::Join; ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for ME mixing"}; @@ -1280,7 +1284,7 @@ struct HigherMassResonances { } PROCESS_SWITCH(HigherMassResonances, processRec, "Process Reconstructed", false); - void processSEderived(EventCandidatesDerivedData::iterator const& collision, TrackCandidates const& /*tracks*/, aod::V0Datas const& V0s) + void processSEderived(EventCandidatesDerivedData::iterator const& collision, V0CandidatesDerivedData const& V0s) { if (config.cSelectMultEstimator == kFT0M) { multiplicity = collision.centFT0M(); @@ -1319,22 +1323,22 @@ struct HigherMassResonances { continue; } - auto postrack1 = v1.template posTrack_as(); - auto negtrack1 = v1.template negTrack_as(); - auto postrack2 = v2.template posTrack_as(); - auto negtrack2 = v2.template negTrack_as(); + // auto postrack1 = v1.template posTrack_as(); + // auto negtrack1 = v1.template negTrack_as(); + // auto postrack2 = v2.template posTrack_as(); + // auto negtrack2 = v2.template negTrack_as(); - double nTPCSigmaPos1{postrack1.tpcNSigmaPi()}; - double nTPCSigmaNeg1{negtrack1.tpcNSigmaPi()}; - double nTPCSigmaPos2{postrack2.tpcNSigmaPi()}; - double nTPCSigmaNeg2{negtrack2.tpcNSigmaPi()}; + // double nTPCSigmaPos1{postrack1.tpcNSigmaPi()}; + // double nTPCSigmaNeg1{negtrack1.tpcNSigmaPi()}; + // double nTPCSigmaPos2{postrack2.tpcNSigmaPi()}; + // double nTPCSigmaNeg2{negtrack2.tpcNSigmaPi()}; - if (!(isSelectedV0Daughter(negtrack1, -1, nTPCSigmaNeg1, v1) && isSelectedV0Daughter(postrack1, 1, nTPCSigmaPos1, v1))) { - continue; - } - if (!(isSelectedV0Daughter(postrack2, 1, nTPCSigmaPos2, v2) && isSelectedV0Daughter(negtrack2, -1, nTPCSigmaNeg2, v2))) { - continue; - } + // if (!(isSelectedV0Daughter(negtrack1, -1, nTPCSigmaNeg1, v1) && isSelectedV0Daughter(postrack1, 1, nTPCSigmaPos1, v1))) { + // continue; + // } + // if (!(isSelectedV0Daughter(postrack2, 1, nTPCSigmaPos2, v2) && isSelectedV0Daughter(negtrack2, -1, nTPCSigmaNeg2, v2))) { + // continue; + // } if (std::find(v0indexes.begin(), v0indexes.end(), v1.globalIndex()) == v0indexes.end()) { v0indexes.push_back(v1.globalIndex()); @@ -1356,12 +1360,12 @@ struct HigherMassResonances { // rKzeroShort.fill(HIST("positive_phi"), postrack1.phi()); // } - if (postrack1.globalIndex() == postrack2.globalIndex()) { - continue; - } - if (negtrack1.globalIndex() == negtrack2.globalIndex()) { - continue; - } + // if (postrack1.globalIndex() == postrack2.globalIndex()) { + // continue; + // } + // if (negtrack1.globalIndex() == negtrack2.globalIndex()) { + // continue; + // } if (!applyAngSep(v1, v2)) { continue; From fd7dcc28081656d869eefe1126984f38a9197e0a Mon Sep 17 00:00:00 2001 From: Stefano Cannito <143754257+scannito@users.noreply.github.com> Date: Sat, 23 Aug 2025 14:11:58 +0200 Subject: [PATCH 164/986] [PWGLF] Fixed reco phi w pdg filter function (#12703) --- .../Tasks/Strangeness/phik0shortanalysis.cxx | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx b/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx index 5ed80040840..b085b4e6ae0 100644 --- a/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx @@ -979,8 +979,8 @@ struct Phik0shortanalysis { return false; } - template - bool eventHasRecoPhiWPDG(const T1& posTracks, const T2& negTracks) + template + bool eventHasRecoPhiWPDG(const T1& posTracks, const T2& negTracks, const T3& mcParticles) { int nPhi = 0; @@ -992,7 +992,7 @@ struct Phik0shortanalysis { if (!track1.has_mcParticle()) continue; - auto mcTrack1 = track1.template mcParticle_as(); + auto mcTrack1 = mcParticles.rawIteratorAt(track1.mcParticleId()); if (mcTrack1.pdgCode() != PDG_t::kKPlus || !mcTrack1.isPhysicalPrimary()) continue; @@ -1006,24 +1006,28 @@ struct Phik0shortanalysis { if (!track2.has_mcParticle()) continue; - auto mcTrack2 = track2.template mcParticle_as(); + auto mcTrack2 = mcParticles.rawIteratorAt(track2.mcParticleId()); if (mcTrack2.pdgCode() != PDG_t::kKMinus || !mcTrack2.isPhysicalPrimary()) continue; + const auto mcTrack1MotherIndexes = mcTrack1.mothersIds(); + const auto mcTrack2MotherIndexes = mcTrack2.mothersIds(); + float pTMother = -1.0f; float yMother = -1.0f; bool isMCMotherPhi = false; - for (const auto& motherOfMcTrack1 : mcTrack1.template mothers_as()) { - for (const auto& motherOfMcTrack2 : mcTrack2.template mothers_as()) { - if (motherOfMcTrack1.pdgCode() != motherOfMcTrack2.pdgCode()) - continue; - if (motherOfMcTrack1.globalIndex() != motherOfMcTrack2.globalIndex()) + + for (const auto& mcTrack1MotherIndex : mcTrack1MotherIndexes) { + for (const auto& mcTrack2MotherIndex : mcTrack2MotherIndexes) { + if (mcTrack1MotherIndex != mcTrack2MotherIndex) continue; - if (motherOfMcTrack1.pdgCode() != o2::constants::physics::Pdg::kPhi) + + const auto mother = mcParticles.rawIteratorAt(mcTrack1MotherIndex); + if (mother.pdgCode() != o2::constants::physics::Pdg::kPhi) continue; - pTMother = motherOfMcTrack1.pt(); - yMother = motherOfMcTrack1.y(); + pTMother = mother.pt(); + yMother = mother.y(); isMCMotherPhi = true; } } @@ -2668,9 +2672,9 @@ struct Phik0shortanalysis { auto mcParticlesThisMcColl = mcParticles.sliceBy(preslices.perMCColl, mcCollision.globalIndex()); if (!pwglf::isINELgtNmc(mcParticlesThisMcColl, 0, pdgDB)) - return; + continue; if (filterOnGenPhi && !eventHasGenPhi(mcParticlesThisMcColl)) - return; + continue; uint64_t numberAssocColl = 0; std::vector zVtxs; @@ -2688,7 +2692,7 @@ struct Phik0shortanalysis { Partition negFiltMCTracks = aod::track::signed1Pt < trackConfigs.cfgCutCharge; negFiltMCTracks.bindTable(filteredMCTracksThisColl); - if (filterOnRecoPhiWPDG && !eventHasRecoPhiWPDG(posFiltMCTracks, negFiltMCTracks)) + if (filterOnRecoPhiWPDG && !eventHasRecoPhiWPDG(posFiltMCTracks, negFiltMCTracks, mcParticles)) continue; mcEventHist.fill(HIST("hGenMCRecoMultiplicityPercent"), mcCollision.centFT0M()); From 2496bd8e2b0476fba33f0644ac9d9771c1a746c5 Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Sat, 23 Aug 2025 19:15:02 +0530 Subject: [PATCH 165/986] [PWGLF] improved task using filter (#12702) --- .../Resonances/lambda1520analysisinpp.cxx | 119 ++++++++---------- 1 file changed, 55 insertions(+), 64 deletions(-) diff --git a/PWGLF/Tasks/Resonances/lambda1520analysisinpp.cxx b/PWGLF/Tasks/Resonances/lambda1520analysisinpp.cxx index 0348751dae9..fd7128850a0 100644 --- a/PWGLF/Tasks/Resonances/lambda1520analysisinpp.cxx +++ b/PWGLF/Tasks/Resonances/lambda1520analysisinpp.cxx @@ -187,9 +187,10 @@ struct Lambda1520analysisinpp { // switches Configurable cFillMultQA{"cFillMultQA", false, "Turn on/off additional QA plots"}; + Configurable cFillTrackQA{"cFillTrackQA", false, "Turn on/off additional QA plots"}; Configurable cFilladditionalQAeventPlots{"cFilladditionalQAeventPlots", false, "Additional QA event plots"}; Configurable cFilladditionalMEPlots{"cFilladditionalMEPlots", false, "Additional Mixed event plots"}; - Configurable cFilldeltaEtaPhiPlots{"cFilldeltaEtaPhiPlots", false, "Enamble additional cuts on daughters"}; + Configurable cFilldeltaEtaPhiPlots{"cFilldeltaEtaPhiPlots", false, "Enable additional cuts on daughters"}; Configurable cFill1DQAs{"cFill1DQAs", false, "Invariant mass 1D"}; Configurable centEstimator{"centEstimator", 0, "Select centrality estimator: 0 - FT0M, 1 - FT0A, 2 - FT0C"}; @@ -201,22 +202,22 @@ struct Lambda1520analysisinpp { // Filter centralityFilter = nabs(aod::cent::centFT0C) <= cfg_Event_CentralityMax; // Filter triggerFilter = (o2::aod::evsel::sel8 == true); - Filter tofPIDFilter = aod::track::tofExpMom < 0.0f || ((aod::track::tofExpMom > 0.0f) && (/* (nabs(aod::pidtof::tofNSigmaPi) < configPID.pidnSigmaPreSelectionCut) || */ (nabs(aod::pidtof::tofNSigmaKa) < configPID.pidnSigmaPreSelectionCut) || (nabs(aod::pidtof::tofNSigmaPr) < configPID.pidnSigmaPreSelectionCut))); // TOF - Filter tpcPIDFilter = /* nabs(aod::pidtpc::tpcNSigmaPi) < configPID.pidnSigmaPreSelectionCut || */ nabs(aod::pidtpc::tpcNSigmaKa) < configPID.pidnSigmaPreSelectionCut || nabs(aod::pidtpc::tpcNSigmaPr) < configPID.pidnSigmaPreSelectionCut; // TPC - Filter trackFilter = (configTracks.trackSelection == AllTracks) || - ((configTracks.trackSelection == GlobalTracks) && requireGlobalTrackInFilter()) || - ((configTracks.trackSelection == GlobalTracksWoPtEta) && requireGlobalTrackWoPtEtaInFilter()) || - ((configTracks.trackSelection == GlobalTracksWoDCA) && requireGlobalTrackWoDCAInFilter()) || - ((configTracks.trackSelection == QualityTracks) && requireQualityTracksInFilter()) || - ((configTracks.trackSelection == InAcceptanceTracks) && requireTrackCutInFilter(TrackSelectionFlags::kInAcceptanceTracks)); - - Filter acceptanceFilter = (nabs(aod::track::eta) < configTracks.cfgCutEta && nabs(aod::track::pt) > configTracks.cMinPtcut); - // Filter DCAcutFilter = (nabs(aod::track::dcaXY) < configTracks.cfgCutDCAxy) && (nabs(aod::track::dcaZ) < configTracks.cfgCutDCAz); + Filter acceptanceFilter = (nabs(aod::track::eta) < configTracks.cfgCutEta && nabs(aod::track::pt) > configTracks.cMinPtcut) && + (nabs(aod::track::dcaXY) < configTracks.cMaxDCArToPVcut) && (nabs(aod::track::dcaZ) < configTracks.cMaxDCAzToPVcut); + + // Filter tofPIDFilter = aod::track::tofExpMom < 0.0f || ((aod::track::tofExpMom > 0.0f) && ( (nabs(aod::pidtof::tofNSigmaPi) < configPID.pidnSigmaPreSelectionCut) || (nabs(aod::pidtof::tofNSigmaKa) < configPID.pidnSigmaPreSelectionCut) || (nabs(aod::pidtof::tofNSigmaPr) < configPID.pidnSigmaPreSelectionCut))); // TOF + // Filter tpcPIDFilter = nabs(aod::pidtpc::tpcNSigmaPi) < configPID.pidnSigmaPreSelectionCut || nabs(aod::pidtpc::tpcNSigmaKa) < configPID.pidnSigmaPreSelectionCut || nabs(aod::pidtpc::tpcNSigmaPr) < configPID.pidnSigmaPreSelectionCut; // TPC + /* Filter trackFilter = (configTracks.trackSelection == AllTracks) || + ((configTracks.trackSelection == GlobalTracks) && requireGlobalTrackInFilter()) || + ((configTracks.trackSelection == GlobalTracksWoPtEta) && requireGlobalTrackWoPtEtaInFilter()) || + ((configTracks.trackSelection == GlobalTracksWoDCA) && requireGlobalTrackWoDCAInFilter()) || + ((configTracks.trackSelection == QualityTracks) && requireQualityTracksInFilter()) || + ((configTracks.trackSelection == InAcceptanceTracks) && requireTrackCutInFilter(TrackSelectionFlags::kInAcceptanceTracks)); + */ // Filter primarytrackFilter = requirePVContributor() && requirePrimaryTrack() && requireGlobalTrackWoDCA(); using EventCandidates = soa::Join; using TrackCandidates = soa::Filtered>; - using MCEventCandidates = soa::Join; using MCTrackCandidates = soa::Filtered>; @@ -290,20 +291,21 @@ struct Lambda1520analysisinpp { if (doprocessData) { // Track QA before cuts // --- Track - histos.add("QA/QAbefore/Track/TOF_TPC_Map_ka_all", "TOF + TPC Combined PID for Kaon;{#sigma_{TOF}^{Kaon}};{#sigma_{TPC}^{Kaon}}", {HistType::kTH2F, {axisPIDQA, axisPIDQA}}); - histos.add("QA/QAbefore/Track/TOF_Nsigma_ka_all", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});{#sigma_{TOF}^{Kaon}};", {HistType::kTHnSparseF, {axisMult, axisPt, axisPIDQA}}); - histos.add("QA/QAbefore/Track/TPC_Nsigma_ka_all", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});{#sigma_{TPC}^{Kaon}};", {HistType::kTHnSparseF, {axisMult, axisPt, axisPIDQA}}); - histos.add("QA/QAbefore/Track/TPConly_Nsigma_ka", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});{#sigma_{TPC}^{Kaon}};", {HistType::kTH2F, {axisPt, axisPIDQA}}); - histos.add("QA/QAbefore/Track/TOF_TPC_Map_pr_all", "TOF + TPC Combined PID for Proton;{#sigma_{TOF}^{Proton}};{#sigma_{TPC}^{Proton}}", {HistType::kTH2F, {axisPIDQA, axisPIDQA}}); - histos.add("QA/QAbefore/Track/TOF_Nsigma_pr_all", "TOF NSigma for Proton;#it{p}_{T} (GeV/#it{c});{#sigma_{TOF}^{Proton}};", {HistType::kTHnSparseF, {axisMult, axisPt, axisPIDQA}}); - histos.add("QA/QAbefore/Track/TPC_Nsigma_pr_all", "TPC NSigma for Proton;#it{p}_{T} (GeV/#it{c});{#sigma_{TPC}^{Proton}};", {HistType::kTHnSparseF, {axisMult, axisPt, axisPIDQA}}); - histos.add("QA/QAbefore/Track/TPConly_Nsigma_pr", "TPC NSigma for Proton;#it{p}_{T} (GeV/#it{c});{#sigma_{TPC}^{Proton}};", {HistType::kTH2F, {axisPt, axisPIDQA}}); - histos.add("QA/QAbefore/Track/dcaZ", "DCA_{Z} distribution of selected Kaons; #it{p}_{T} (GeV/#it{c}); DCA_{Z} (cm); ", HistType::kTH2F, {axisPt, axisDCAz}); - histos.add("QA/QAbefore/Track/dcaXY", "DCA_{XY} momentum distribution of selected Kaons; #it{p}_{T} (GeV/#it{c}); DCA_{XY} (cm);", HistType::kTH2F, {axisPt, axisDCAxy}); - histos.add("QA/QAbefore/Track/TPC_CR", "# TPC Xrows distribution of selected Kaons; #it{p}_{T} (GeV/#it{c}); TPC X rows", HistType::kTH2F, {axisPt, axisTPCXrow}); - histos.add("QA/QAbefore/Track/pT", "pT distribution of Kaons; #it{p}_{T} (GeV/#it{c}); Counts;", {HistType::kTH1F, {axisPt}}); - histos.add("QA/QAbefore/Track/eta", "#eta distribution of Kaons; #eta; Counts;", {HistType::kTH1F, {axisEta}}); - + if (cFillTrackQA) { + histos.add("QA/QAbefore/Track/TOF_TPC_Map_ka_all", "TOF + TPC Combined PID for Kaon;{#sigma_{TOF}^{Kaon}};{#sigma_{TPC}^{Kaon}}", {HistType::kTH2F, {axisPIDQA, axisPIDQA}}); + histos.add("QA/QAbefore/Track/TOF_Nsigma_ka_all", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});{#sigma_{TOF}^{Kaon}};", {HistType::kTHnSparseF, {axisMult, axisPt, axisPIDQA}}); + histos.add("QA/QAbefore/Track/TPC_Nsigma_ka_all", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});{#sigma_{TPC}^{Kaon}};", {HistType::kTHnSparseF, {axisMult, axisPt, axisPIDQA}}); + histos.add("QA/QAbefore/Track/TPConly_Nsigma_ka", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});{#sigma_{TPC}^{Kaon}};", {HistType::kTH2F, {axisPt, axisPIDQA}}); + histos.add("QA/QAbefore/Track/TOF_TPC_Map_pr_all", "TOF + TPC Combined PID for Proton;{#sigma_{TOF}^{Proton}};{#sigma_{TPC}^{Proton}}", {HistType::kTH2F, {axisPIDQA, axisPIDQA}}); + histos.add("QA/QAbefore/Track/TOF_Nsigma_pr_all", "TOF NSigma for Proton;#it{p}_{T} (GeV/#it{c});{#sigma_{TOF}^{Proton}};", {HistType::kTHnSparseF, {axisMult, axisPt, axisPIDQA}}); + histos.add("QA/QAbefore/Track/TPC_Nsigma_pr_all", "TPC NSigma for Proton;#it{p}_{T} (GeV/#it{c});{#sigma_{TPC}^{Proton}};", {HistType::kTHnSparseF, {axisMult, axisPt, axisPIDQA}}); + histos.add("QA/QAbefore/Track/TPConly_Nsigma_pr", "TPC NSigma for Proton;#it{p}_{T} (GeV/#it{c});{#sigma_{TPC}^{Proton}};", {HistType::kTH2F, {axisPt, axisPIDQA}}); + histos.add("QA/QAbefore/Track/dcaZ", "DCA_{Z} distribution of selected Kaons; #it{p}_{T} (GeV/#it{c}); DCA_{Z} (cm); ", HistType::kTH2F, {axisPt, axisDCAz}); + histos.add("QA/QAbefore/Track/dcaXY", "DCA_{XY} momentum distribution of selected Kaons; #it{p}_{T} (GeV/#it{c}); DCA_{XY} (cm);", HistType::kTH2F, {axisPt, axisDCAxy}); + histos.add("QA/QAbefore/Track/TPC_CR", "# TPC Xrows distribution of selected Kaons; #it{p}_{T} (GeV/#it{c}); TPC X rows", HistType::kTH2F, {axisPt, axisTPCXrow}); + histos.add("QA/QAbefore/Track/pT", "pT distribution of Kaons; #it{p}_{T} (GeV/#it{c}); Counts;", {HistType::kTH1F, {axisPt}}); + histos.add("QA/QAbefore/Track/eta", "#eta distribution of Kaons; #eta; Counts;", {HistType::kTH1F, {axisEta}}); + } if (cFillMultQA) { // Multiplicity correlation calibrations histos.add("MultCalib/centGloPVpr", "Centrality vs Global-Tracks", kTHnSparseF, {{110, 0, 110, "Centrality"}, {500, 0, 5000, "Global Tracks"}, {500, 0, 5000, "PV tracks"}}); @@ -400,8 +402,8 @@ struct Lambda1520analysisinpp { histos.add("QA/MC/h2GenEtaPt_afterRapcut", " #phi-#it{p}_{T} distribution of Generated #Lambda(1520); #eta; #it{p}_{T}; Counts;", HistType::kTHnSparseF, {axisEta, axisPtQA}); histos.add("QA/MC/h2GenPhiRapidity_afterRapcut", " #phi-y distribution of Generated #Lambda(1520); #phi; y; Counts;", HistType::kTHnSparseF, {axisPhi, axisRap}); - histos.add("Result/MC/Genlambda1520pt", "pT distribution of True MC #Lambda(1520)0", kTHnSparseF, {axisMClabel, axisPt, axisMult}); - histos.add("Result/MC/Genantilambda1520pt", "pT distribution of True MC Anti-#Lambda(1520)0", kTHnSparseF, {axisMClabel, axisPt, axisMult}); + histos.add("Result/MC/Genlambda1520pt", "pT distribution of True MC #Lambda(1520)0", kTH3F, {axisMClabel, axisPt, axisMult}); + histos.add("Result/MC/Genantilambda1520pt", "pT distribution of True MC Anti-#Lambda(1520)0", kTH3F, {axisMClabel, axisPt, axisMult}); } if (doprocessMC) { histos.add("QA/MC/h2RecoEtaPt_after", " #eta-#it{p}_{T} distribution of Reconstructed #Lambda(1520); #eta; #it{p}_{T}; Counts;", HistType::kTHnSparseF, {axisEta, axisPt}); @@ -474,16 +476,7 @@ struct Lambda1520analysisinpp { bool trackCut(const TrackType track) { // basic track cuts - if (std::abs(track.pt()) < configTracks.cMinPtcut) - return false; - if (configTracks.cDCAr7SigCut) { - if (std::abs(track.dcaXY()) > (0.004f + 0.013f / (track.pt()))) // 7 - Sigma cut - return false; - } else { - if (std::abs(track.dcaXY()) > configTracks.cMaxDCArToPVcut) - return false; - } - if (std::abs(track.dcaZ()) > configTracks.cMaxDCAzToPVcut) + if (configTracks.cDCAr7SigCut && std::abs(track.dcaXY()) > (0.004f + 0.013f / (track.pt()))) // 7 - Sigma cut return false; if (configTracks.cTPCNClsFound && (track.tpcNClsFound() < configTracks.cMinTPCNClsFound)) return false; @@ -499,10 +492,6 @@ struct Lambda1520analysisinpp { return false; if (configTracks.cfgGlobalTrack && !track.isGlobalTrack()) return false; - if (configTracks.cfgUseITSRefit && !track.passedITSRefit()) - return false; - if (configTracks.cfgUseTPCRefit && !track.passedTPCRefit()) - return false; return true; } @@ -734,28 +723,30 @@ struct Lambda1520analysisinpp { //// QA plots before the selection // --- Track QA all if constexpr (IsData) { - histos.fill(HIST("QA/QAbefore/Track/TPC_Nsigma_pr_all"), centrality, trk1ptPr, trk1NSigmaPrTPC); - if (isTrk1hasTOF) { - histos.fill(HIST("QA/QAbefore/Track/TOF_Nsigma_pr_all"), centrality, trk1ptPr, trk1NSigmaPrTOF); - histos.fill(HIST("QA/QAbefore/Track/TOF_TPC_Map_pr_all"), trk1NSigmaPrTOF, trk1NSigmaPrTPC); - } - if (!isTrk1hasTOF) { - histos.fill(HIST("QA/QAbefore/Track/TPConly_Nsigma_pr"), trk1ptPr, trk1NSigmaPrTPC); - } - histos.fill(HIST("QA/QAbefore/Track/TPC_Nsigma_ka_all"), centrality, trk2ptKa, trk2NSigmaKaTPC); - if (isTrk2hasTOF) { - histos.fill(HIST("QA/QAbefore/Track/TOF_Nsigma_ka_all"), centrality, trk2ptKa, trk2NSigmaKaTOF); - histos.fill(HIST("QA/QAbefore/Track/TOF_TPC_Map_ka_all"), trk2NSigmaKaTOF, trk2NSigmaKaTPC); - } - if (!isTrk2hasTOF) { - histos.fill(HIST("QA/QAbefore/Track/TPConly_Nsigma_ka"), trk2ptKa, trk2NSigmaKaTPC); - } + if (cFillTrackQA) { + histos.fill(HIST("QA/QAbefore/Track/TPC_Nsigma_pr_all"), centrality, trk1ptPr, trk1NSigmaPrTPC); + if (isTrk1hasTOF) { + histos.fill(HIST("QA/QAbefore/Track/TOF_Nsigma_pr_all"), centrality, trk1ptPr, trk1NSigmaPrTOF); + histos.fill(HIST("QA/QAbefore/Track/TOF_TPC_Map_pr_all"), trk1NSigmaPrTOF, trk1NSigmaPrTPC); + } + if (!isTrk1hasTOF) { + histos.fill(HIST("QA/QAbefore/Track/TPConly_Nsigma_pr"), trk1ptPr, trk1NSigmaPrTPC); + } + histos.fill(HIST("QA/QAbefore/Track/TPC_Nsigma_ka_all"), centrality, trk2ptKa, trk2NSigmaKaTPC); + if (isTrk2hasTOF) { + histos.fill(HIST("QA/QAbefore/Track/TOF_Nsigma_ka_all"), centrality, trk2ptKa, trk2NSigmaKaTOF); + histos.fill(HIST("QA/QAbefore/Track/TOF_TPC_Map_ka_all"), trk2NSigmaKaTOF, trk2NSigmaKaTPC); + } + if (!isTrk2hasTOF) { + histos.fill(HIST("QA/QAbefore/Track/TPConly_Nsigma_ka"), trk2ptKa, trk2NSigmaKaTPC); + } - histos.fill(HIST("QA/QAbefore/Track/dcaZ"), trk1ptPr, trk1.dcaZ()); - histos.fill(HIST("QA/QAbefore/Track/dcaXY"), trk1ptPr, trk1.dcaXY()); - histos.fill(HIST("QA/QAbefore/Track/TPC_CR"), trk1ptPr, trk1.tpcNClsCrossedRows()); - histos.fill(HIST("QA/QAbefore/Track/pT"), trk1ptPr); - histos.fill(HIST("QA/QAbefore/Track/eta"), trk1etaPr); + histos.fill(HIST("QA/QAbefore/Track/dcaZ"), trk1ptPr, trk1.dcaZ()); + histos.fill(HIST("QA/QAbefore/Track/dcaXY"), trk1ptPr, trk1.dcaXY()); + histos.fill(HIST("QA/QAbefore/Track/TPC_CR"), trk1ptPr, trk1.tpcNClsCrossedRows()); + histos.fill(HIST("QA/QAbefore/Track/pT"), trk1ptPr); + histos.fill(HIST("QA/QAbefore/Track/eta"), trk1etaPr); + } if (cFilldeltaEtaPhiPlots) { histos.fill(HIST("QAbefore/deltaEta"), deltaEta); histos.fill(HIST("QAbefore/deltaPhi"), deltaPhi); From 87e41f9ab66cc1e95b7764dd7ce5627d9bf4fba7 Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Sat, 23 Aug 2025 16:06:48 +0200 Subject: [PATCH 166/986] [PWGLF] Improve TOF PID selection cut (#12704) --- PWGLF/Tasks/Resonances/phispectrapbpbqa.cxx | 122 +++++++++++++++----- 1 file changed, 93 insertions(+), 29 deletions(-) diff --git a/PWGLF/Tasks/Resonances/phispectrapbpbqa.cxx b/PWGLF/Tasks/Resonances/phispectrapbpbqa.cxx index 4ea692e246e..2abaf1fff47 100644 --- a/PWGLF/Tasks/Resonances/phispectrapbpbqa.cxx +++ b/PWGLF/Tasks/Resonances/phispectrapbpbqa.cxx @@ -107,7 +107,7 @@ struct phispectrapbpbqa { Configurable ispTdepPID{"ispTdepPID", false, "pT dependent PID"}; Configurable cfgCutTOFBeta{"cfgCutTOFBeta", 0.5, "cut TOF beta"}; Configurable nsigmaCutTPC{"nsigmacutTPC", 2.0, "Value of the TPC Nsigma cut"}; - Configurable nsigmaCutCombined{"nsigmaCutCombined", 2.0, "Value of the Combined TPC-TOF Nsigma cut"}; + Configurable applyTOF{"applyTOF", true, "Apply TOF"}; ConfigurableAxis axisOccupancy{"axisOccupancy", {VARIABLE_WIDTH, -1.0, 200.0, 500.0, 1000.0, 2000.0f, 4000.0, 10000.0f, 100000.0f}, "occupancy axis"}; struct : ConfigurableGroup { ConfigurableAxis configThnAxisInvMass{"configThnAxisInvMass", {90, 0.98, 1.07}, "#it{M} (GeV/#it{c}^{2})"}; @@ -157,6 +157,8 @@ struct phispectrapbpbqa { histos.add("hPhiMommentum", "hPhiMommentum", kTH3F, {{36, 0, 6.283}, {200, -10.0, 10.0}, axisOccupancy}); + histos.add("hNsigmaTPCBeforeCut", "NsigmaKaon TPC Before Cut", kTH3F, {{200, -10.0f, 10.0f}, {100, 0.0, 10.0}, axisOccupancy}); + histos.add("hNsigmaTOFBeforeCut", "NsigmaKaon TOF Before Cut", kTH3F, {{200, -10.0f, 10.0f}, {100, 0.0, 10.0}, axisOccupancy}); histos.add("hNsigmaTPCAfterCut", "NsigmaKaon TPC After Cut", kTH3F, {{200, -10.0f, 10.0f}, {100, 0.0, 10.0}, axisOccupancy}); histos.add("hNsigmaTOFAfterCut", "NsigmaKaon TOF After Cut", kTH3F, {{200, -10.0f, 10.0f}, {100, 0.0, 10.0}, axisOccupancy}); @@ -214,8 +216,28 @@ struct phispectrapbpbqa { if (candidate.p() < 0.7 && TMath::Abs(nsigmaTPC) < nsigmaCutTPC) { return true; } - if (candidate.p() >= 0.7 && candidate.hasTOF() && candidate.beta() > cfgCutTOFBeta && TMath::Sqrt(nsigmaTPC * nsigmaTPC + nsigmaTOF * nsigmaTOF) < nsigmaCutCombined) { - return true; + if (candidate.p() > 0.7 && candidate.hasTOF() && TMath::Abs(nsigmaTPC) < nsigmaCutTPC) { + if (candidate.p() > 0.7 && candidate.p() < 1.6 && candidate.beta() > cfgCutTOFBeta && nsigmaTOF > -5.0 && nsigmaTOF < 10.0) { + return true; + } + if (candidate.p() >= 1.6 && candidate.p() < 2.0 && candidate.beta() > cfgCutTOFBeta && nsigmaTOF > -3.0 && nsigmaTOF < 10.0) { + return true; + } + if (candidate.p() >= 2.0 && candidate.p() < 2.5 && candidate.beta() > cfgCutTOFBeta && nsigmaTOF > -3.0 && nsigmaTOF < 6.0) { + return true; + } + if (candidate.p() >= 2.5 && candidate.p() < 4.0 && candidate.beta() > cfgCutTOFBeta && nsigmaTOF > -2.5 && nsigmaTOF < 4.0) { + return true; + } + if (candidate.p() >= 4.0 && candidate.p() < 5.0 && candidate.beta() > cfgCutTOFBeta && nsigmaTOF > -4.0 && nsigmaTOF < 3.0) { + return true; + } + if (candidate.p() >= 5.0 && candidate.p() < 6.0 && candidate.beta() > cfgCutTOFBeta && nsigmaTOF > -4.0 && nsigmaTOF < 2.5) { + return true; + } + if (candidate.p() >= 6.0 && candidate.beta() > cfgCutTOFBeta && nsigmaTOF > -3.0 && nsigmaTOF < 3.0) { + return true; + } } return false; } @@ -223,13 +245,34 @@ struct phispectrapbpbqa { template bool selectionPID(const T& candidate, double nsigmaTPC, double nsigmaTOF) { - if (candidate.p() < 0.7 && TMath::Abs(nsigmaTPC) < nsigmaCutTPC) { - return true; - } - if (candidate.p() >= 0.7 && candidate.hasTOF() && candidate.beta() > cfgCutTOFBeta && TMath::Sqrt(nsigmaTPC * nsigmaTPC + nsigmaTOF * nsigmaTOF) < nsigmaCutCombined) { - return true; - } - if (candidate.p() >= 0.7 && !candidate.hasTOF() && TMath::Abs(nsigmaTPC) < nsigmaCutTPC) { + if (applyTOF) { + if (!candidate.hasTOF() && TMath::Abs(nsigmaTPC) < nsigmaCutTPC) { + return true; + } + if (candidate.p() > 0.5 && candidate.hasTOF() && TMath::Abs(nsigmaTPC) < nsigmaCutTPC) { + if (candidate.p() > 0.5 && candidate.p() < 1.6 && candidate.beta() > cfgCutTOFBeta && nsigmaTOF > -5.0 && nsigmaTOF < 10.0) { + return true; + } + if (candidate.p() >= 1.6 && candidate.p() < 2.0 && candidate.beta() > cfgCutTOFBeta && nsigmaTOF > -3.0 && nsigmaTOF < 10.0) { + return true; + } + if (candidate.p() >= 2.0 && candidate.p() < 2.5 && candidate.beta() > cfgCutTOFBeta && nsigmaTOF > -3.0 && nsigmaTOF < 6.0) { + return true; + } + if (candidate.p() >= 2.5 && candidate.p() < 4.0 && candidate.beta() > cfgCutTOFBeta && nsigmaTOF > -2.5 && nsigmaTOF < 4.0) { + return true; + } + if (candidate.p() >= 4.0 && candidate.p() < 5.0 && candidate.beta() > cfgCutTOFBeta && nsigmaTOF > -4.0 && nsigmaTOF < 3.0) { + return true; + } + if (candidate.p() >= 5.0 && candidate.p() < 6.0 && candidate.beta() > cfgCutTOFBeta && nsigmaTOF > -4.0 && nsigmaTOF < 2.5) { + return true; + } + if (candidate.p() >= 6.0 && candidate.beta() > cfgCutTOFBeta && nsigmaTOF > -3.0 && nsigmaTOF < 3.0) { + return true; + } + } + } else if (TMath::Abs(nsigmaTPC) < nsigmaCutTPC) { return true; } return false; @@ -324,6 +367,8 @@ struct phispectrapbpbqa { if (track1.hasTOF()) { histos.fill(HIST("hNsigmaTOF"), nSigmaTOF, track1.p(), occupancy, centrality); } + histos.fill(HIST("hNsigmaTPCBeforeCut"), nSigmaTPC, track1.p(), occupancy); + histos.fill(HIST("hNsigmaTOFBeforeCut"), nSigmaTOF, track1.p(), occupancy); if (applyPID) { if (ispTdepPID && !selectionPIDpTdependent(track1, nSigmaTPC, nSigmaTOF)) { continue; @@ -374,6 +419,8 @@ struct phispectrapbpbqa { if (track2.hasTOF()) { histos.fill(HIST("hNsigmaTOF"), nSigmaTOF2, track2.p(), occupancy, centrality); } + histos.fill(HIST("hNsigmaTPCBeforeCut"), nSigmaTPC2, track2.p(), occupancy); + histos.fill(HIST("hNsigmaTOFBeforeCut"), nSigmaTOF2, track2.p(), occupancy); } if (applyPID) { if (ispTdepPID && !selectionPIDpTdependent(track2, nSigmaTPC2, nSigmaTOF2)) { @@ -549,6 +596,7 @@ struct phispectrapbpbqa { auto oldindex = -999; auto Rectrackspart = RecTracks.sliceBy(perCollision, RecCollision.globalIndex()); // loop over reconstructed particle + int ntrack1 = 0; for (auto track1 : Rectrackspart) { if (!selectionTrack(track1)) { continue; @@ -557,6 +605,32 @@ struct phispectrapbpbqa { continue; } auto track1ID = track1.index(); + // PID track 1 + double nSigmaTPC = track1.tpcNSigmaKa(); + double nSigmaTOF = track1.tofNSigmaKa(); + if (!track1.hasTOF()) { + nSigmaTOF = -9999.99; + } + if (cfgUpdatePID) { + nSigmaTPC = (nSigmaTPC - hTPCCallib->GetBinContent(hTPCCallib->FindBin(track1.p(), centrality, occupancy))) / hTPCCallib->GetBinError(hTPCCallib->FindBin(track1.p(), centrality, occupancy)); + if (track1.hasTOF()) { + nSigmaTOF = (nSigmaTOF - hTOFCallib->GetBinContent(hTOFCallib->FindBin(track1.p(), centrality, occupancy))) / hTOFCallib->GetBinError(hTOFCallib->FindBin(track1.p(), centrality, occupancy)); + } + } + histos.fill(HIST("hNsigmaTPCBeforeCut"), nSigmaTPC, track1.p(), occupancy); + histos.fill(HIST("hNsigmaTOFBeforeCut"), nSigmaTOF, track1.p(), occupancy); + + if (applyPID) { + if (ispTdepPID && !selectionPIDpTdependent(track1, nSigmaTPC, nSigmaTOF)) { + continue; + } + if (!ispTdepPID && !selectionPID(track1, nSigmaTPC, nSigmaTOF)) { + continue; + } + histos.fill(HIST("hNsigmaTPCAfterCut"), nSigmaTPC, track1.p(), occupancy); + histos.fill(HIST("hNsigmaTOFAfterCut"), nSigmaTOF, track1.p(), occupancy); + } + ntrack1 = ntrack1 + 1; for (auto track2 : Rectrackspart) { auto track2ID = track2.index(); if (track2ID <= track1ID) { @@ -574,18 +648,7 @@ struct phispectrapbpbqa { if (track1.sign() * track2.sign() > 0) { continue; } - // PID track 1 - double nSigmaTPC = track1.tpcNSigmaKa(); - double nSigmaTOF = track1.tofNSigmaKa(); - if (!track1.hasTOF()) { - nSigmaTOF = -9999.99; - } - if (cfgUpdatePID) { - nSigmaTPC = (nSigmaTPC - hTPCCallib->GetBinContent(hTPCCallib->FindBin(track1.p(), centrality, occupancy))) / hTPCCallib->GetBinError(hTPCCallib->FindBin(track1.p(), centrality, occupancy)); - if (track1.hasTOF()) { - nSigmaTOF = (nSigmaTOF - hTOFCallib->GetBinContent(hTOFCallib->FindBin(track1.p(), centrality, occupancy))) / hTOFCallib->GetBinError(hTOFCallib->FindBin(track1.p(), centrality, occupancy)); - } - } + // PID track 2 double nSigmaTPC2 = track2.tpcNSigmaKa(); double nSigmaTOF2 = track2.tofNSigmaKa(); @@ -598,14 +661,11 @@ struct phispectrapbpbqa { nSigmaTOF2 = (nSigmaTOF2 - hTOFCallib->GetBinContent(hTOFCallib->FindBin(track2.p(), centrality, occupancy))) / hTOFCallib->GetBinError(hTOFCallib->FindBin(track2.p(), centrality, occupancy)); } } + if (ntrack1 == 1) { + histos.fill(HIST("hNsigmaTPCBeforeCut"), nSigmaTPC2, track2.p(), occupancy); + histos.fill(HIST("hNsigmaTOFBeforeCut"), nSigmaTOF2, track2.p(), occupancy); + } if (applyPID) { - if (ispTdepPID && !selectionPIDpTdependent(track1, nSigmaTPC, nSigmaTOF)) { - continue; - } - if (!ispTdepPID && !selectionPID(track1, nSigmaTPC, nSigmaTOF)) { - continue; - } - if (ispTdepPID && !selectionPIDpTdependent(track2, nSigmaTPC2, nSigmaTOF2)) { continue; } @@ -613,6 +673,10 @@ struct phispectrapbpbqa { continue; } } + if (ntrack1 == 1) { + histos.fill(HIST("hNsigmaTPCAfterCut"), nSigmaTPC2, track2.p(), occupancy); + histos.fill(HIST("hNsigmaTOFAfterCut"), nSigmaTOF2, track2.p(), occupancy); + } const auto mctrack1 = track1.mcParticle(); const auto mctrack2 = track2.mcParticle(); From 595c989b02c18d8162d52174f1f96f3b9c78bb9c Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sat, 23 Aug 2025 18:15:34 +0200 Subject: [PATCH 167/986] [PWGEM/Dilepton] try to reduce memory of ML PID (#12705) --- .../TableProducer/skimmerPrimaryElectron.cxx | 33 +++++++++++++++---- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx index 46a598aec87..68324a6b40a 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx @@ -588,7 +588,7 @@ struct skimmerPrimaryElectron { Preslice trackIndicesPerCollision = aod::track_association::collisionId; std::vector> stored_trackIds; - Filter trackFilter = o2::aod::track::pt > minpt&& nabs(o2::aod::track::eta) < maxeta&& o2::aod::track::itsChi2NCl < maxchi2its&& ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true; + Filter trackFilter = o2::aod::track::itsChi2NCl < maxchi2its && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true; using MyFilteredTracks = soa::Filtered; Partition posTracks = o2::aod::track::signed1Pt > 0.f; @@ -611,9 +611,13 @@ struct skimmerPrimaryElectron { auto tracks_per_coll = tracks.sliceBy(perCol, collision.globalIndex()); for (const auto& track : tracks_per_coll) { float probaEl = 1.0; - if (!checkTrack(collision, track) || !isElectron(collision, track, probaEl)) { + if (!checkTrack(collision, track)) { + continue; + } + if (!isElectron(collision, track, probaEl)) { continue; } + fillTrackTable(collision, track, probaEl); } @@ -641,7 +645,10 @@ struct skimmerPrimaryElectron { for (const auto& trackId : trackIdsThisCollision) { auto track = trackId.template track_as(); float probaEl = 1.0; - if (!checkTrack(collision, track) || !isElectron(collision, track, probaEl)) { + if (!checkTrack(collision, track)) { + continue; + } + if (!isElectron(collision, track, probaEl)) { continue; } fillTrackTable(collision, track, probaEl); @@ -672,7 +679,10 @@ struct skimmerPrimaryElectron { auto tracks_per_coll = tracks.sliceBy(perCol, collision.globalIndex()); for (const auto& track : tracks_per_coll) { float probaEl = 1.0; - if (!checkTrack(collision, track) || !isElectron(collision, track, probaEl)) { + if (!checkTrack(collision, track)) { + continue; + } + if (!isElectron(collision, track, probaEl)) { continue; } fillTrackTable(collision, track, probaEl); @@ -705,7 +715,10 @@ struct skimmerPrimaryElectron { for (const auto& trackId : trackIdsThisCollision) { auto track = trackId.template track_as(); float probaEl = 1.0; - if (!checkTrack(collision, track) || !isElectron(collision, track, probaEl)) { + if (!checkTrack(collision, track)) { + continue; + } + if (!isElectron(collision, track, probaEl)) { continue; } fillTrackTable(collision, track, probaEl); @@ -740,7 +753,10 @@ struct skimmerPrimaryElectron { auto tracks_per_coll = tracks.sliceBy(perCol, collision.globalIndex()); for (const auto& track : tracks_per_coll) { float probaEl = 1.0; - if (!checkTrack(collision, track) || !isElectron(collision, track, probaEl)) { + if (!checkTrack(collision, track)) { + continue; + } + if (!isElectron(collision, track, probaEl)) { continue; } fillTrackTable(collision, track, probaEl); @@ -772,7 +788,10 @@ struct skimmerPrimaryElectron { for (const auto& trackId : trackIdsThisCollision) { auto track = trackId.template track_as(); float probaEl = 1.0; - if (!checkTrack(collision, track) || !isElectron(collision, track, probaEl)) { + if (!checkTrack(collision, track)) { + continue; + } + if (!isElectron(collision, track, probaEl)) { continue; } fillTrackTable(collision, track, probaEl); From e088ce9e8d55b0ed2eee7c648fbd2e7cbb66b95d Mon Sep 17 00:00:00 2001 From: Shirajum Monira <38348689+Eloviyo@users.noreply.github.com> Date: Sat, 23 Aug 2025 20:24:36 +0200 Subject: [PATCH 168/986] [PWGCF] FemtoUniverse cascade task -- fixed bugs (#12706) Co-authored-by: Shirajum Monira --- ...toUniversePairTaskTrackCascadeExtended.cxx | 75 +++++++++---------- 1 file changed, 37 insertions(+), 38 deletions(-) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx index b6abc21628c..966c3ae0bac 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx @@ -851,32 +851,31 @@ struct femtoUniversePairTaskTrackCascadeExtended { continue; cascQAHistos.fillQA(part); - - for (const auto& part : groupPartsOne) { - int pdgCode = static_cast(part.pidCut()); - if (pdgCode != confTrkPDGCodePartOne) - continue; - const auto& pdgTrackParticle = pdgMC->GetParticle(pdgCode); - if (!pdgTrackParticle) { - continue; - } - - if (pdgTrackParticle->Charge() > 0) { - trackHistoPartOnePos.fillQA(part); - } else if (pdgTrackParticle->Charge() < 0) { - trackHistoPartOneNeg.fillQA(part); - } + } + for (const auto& part : groupPartsOne) { + int pdgCode = static_cast(part.pidCut()); + if (pdgCode != confTrkPDGCodePartOne) + continue; + const auto& pdgTrackParticle = pdgMC->GetParticle(pdgCode); + if (!pdgTrackParticle) { + continue; } - for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { - if (static_cast(p1.pidCut()) != confTrkPDGCodePartOne) - continue; - int pdgCodeCasc = static_cast(p2.pidCut()); - if ((confCascType1 == 0 && pdgCodeCasc != kOmegaMinus) || (confCascType1 == 2 && pdgCodeCasc != kOmegaPlusBar) || (confCascType1 == 1 && pdgCodeCasc != kXiMinus) || (confCascType1 == 3 && pdgCodeCasc != kXiPlusBar)) - continue; - sameEventCont.setPair(p1, p2, multCol, confUse3D, 1.0f); + if (pdgTrackParticle->Charge() > 0) { + trackHistoPartOnePos.fillQA(part); + } else if (pdgTrackParticle->Charge() < 0) { + trackHistoPartOneNeg.fillQA(part); } } + + for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { + if (static_cast(p1.pidCut()) != confTrkPDGCodePartOne) + continue; + int pdgCodeCasc = static_cast(p2.pidCut()); + if ((confCascType1 == 0 && pdgCodeCasc != kOmegaMinus) || (confCascType1 == 2 && pdgCodeCasc != kOmegaPlusBar) || (confCascType1 == 1 && pdgCodeCasc != kXiMinus) || (confCascType1 == 3 && pdgCodeCasc != kXiPlusBar)) + continue; + sameEventCont.setPair(p1, p2, multCol, confUse3D, 1.0f); + } } PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processSameEventMCgen, "Enable processing same event MC truth for track - cascade", false); @@ -895,24 +894,24 @@ struct femtoUniversePairTaskTrackCascadeExtended { continue; cascQAHistos.fillQA(part); + } - auto pairProcessFunc = [&](auto& p1, auto& p2) -> void { - int pdgCodeCasc1 = static_cast(p1.pidCut()); - if ((confCascType1 == 0 && pdgCodeCasc1 != kOmegaMinus) || (confCascType1 == 2 && pdgCodeCasc1 != kOmegaPlusBar) || (confCascType1 == 1 && pdgCodeCasc1 != kXiMinus) || (confCascType1 == 3 && pdgCodeCasc1 != kXiPlusBar)) - return; - int pdgCodeCasc2 = static_cast(p2.pidCut()); - if ((confCascType2 == 0 && pdgCodeCasc2 != kOmegaMinus) || (confCascType2 == 2 && pdgCodeCasc2 != kOmegaPlusBar) || (confCascType2 == 1 && pdgCodeCasc2 != kXiMinus) || (confCascType2 == 3 && pdgCodeCasc2 != kXiPlusBar)) - return; - sameEventCont.setPair(p1, p2, multCol, confUse3D, 1.0f); - }; + auto pairProcessFunc = [&](auto& p1, auto& p2) -> void { + int pdgCodeCasc1 = static_cast(p1.pidCut()); + if ((confCascType1 == 0 && pdgCodeCasc1 != kOmegaMinus) || (confCascType1 == 2 && pdgCodeCasc1 != kOmegaPlusBar) || (confCascType1 == 1 && pdgCodeCasc1 != kXiMinus) || (confCascType1 == 3 && pdgCodeCasc1 != kXiPlusBar)) + return; + int pdgCodeCasc2 = static_cast(p2.pidCut()); + if ((confCascType2 == 0 && pdgCodeCasc2 != kOmegaMinus) || (confCascType2 == 2 && pdgCodeCasc2 != kOmegaPlusBar) || (confCascType2 == 1 && pdgCodeCasc2 != kXiMinus) || (confCascType2 == 3 && pdgCodeCasc2 != kXiPlusBar)) + return; + sameEventCont.setPair(p1, p2, multCol, confUse3D, 1.0f); + }; - if (confCascType1 == confCascType2) { - for (const auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsTwo, groupPartsTwo))) - pairProcessFunc(p1, p2); - } else { - for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsTwo, groupPartsTwo))) - pairProcessFunc(p1, p2); - } + if (confCascType1 == confCascType2) { + for (const auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsTwo, groupPartsTwo))) + pairProcessFunc(p1, p2); + } else { + for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsTwo, groupPartsTwo))) + pairProcessFunc(p1, p2); } } PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processSameEventCascMCgen, "Enable processing same event MC truth for cascade - cascade", false); From fce7b8c4d94b531ecdd8bf195024c13550967401 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sat, 23 Aug 2025 21:13:17 +0200 Subject: [PATCH 169/986] [Common] Add centrality resolution histograms (#12709) Co-authored-by: ALICE Builder --- Common/Tasks/centralityStudy.cxx | 79 ++++++++++++++++++++++---------- 1 file changed, 55 insertions(+), 24 deletions(-) diff --git a/Common/Tasks/centralityStudy.cxx b/Common/Tasks/centralityStudy.cxx index a8cdea5ac09..1f9643dc0e3 100644 --- a/Common/Tasks/centralityStudy.cxx +++ b/Common/Tasks/centralityStudy.cxx @@ -149,6 +149,7 @@ struct centralityStudy { // For centrality studies if requested ConfigurableAxis axisCentrality{"axisCentrality", {100, 0, 100}, "FT0C percentile"}; + ConfigurableAxis axisImpactParameter{"axisImpactParameter", {200, 0.0f, 20.0f}, "b (fm)"}; ConfigurableAxis axisPVChi2{"axisPVChi2", {300, 0, 30}, "FT0C percentile"}; ConfigurableAxis axisDeltaTime{"axisDeltaTime", {300, 0, 300}, "#Delta time"}; @@ -240,6 +241,15 @@ struct centralityStudy { histos.add("hNGlobalTracksVsNTPV", "hNGlobalTracksVsNTPV", kTH2F, {axisMultPVContributors, axisMultGlobalTracks}); } + if (doprocessCollisionsWithResolutionStudy) { + histos.add("hImpactParameterVsFT0A", "hImpactParameterVsFT0A", kTH2F, {axisMultFT0A, axisImpactParameter}); + histos.add("hImpactParameterVsFT0C", "hImpactParameterVsFT0C", kTH2F, {axisMultFT0C, axisImpactParameter}); + histos.add("hImpactParameterVsFT0M", "hImpactParameterVsFT0M", kTH2F, {axisMultFT0M, axisImpactParameter}); + histos.add("hImpactParameterVsFV0A", "hImpactParameterVsFV0A", kTH2F, {axisMultFV0A, axisImpactParameter}); + histos.add("hImpactParameterVsNMFTTracks", "hImpactParameterVsNMFTTracks", kTH2F, {axisMultMFTTracks, axisImpactParameter}); + histos.add("hImpactParameterVsNTPV", "hImpactParameterVsNTPV", kTH2F, {axisMultPVContributors, axisImpactParameter}); + } + if (doOccupancyStudyVsRawValues2d) { histos.add("hNcontribsProfileVsTrackOccupancyVsFT0C", "hNcontribsProfileVsTrackOccupancyVsFT0C", kTProfile2D, {axisTrackOccupancy, axisMultFT0C}); histos.add("hNGlobalTracksProfileVsTrackOccupancyVsFT0C", "hNGlobalTracksProfileVsTrackOccupancyVsFT0C", kTProfile2D, {axisTrackOccupancy, axisMultFT0C}); @@ -676,6 +686,19 @@ struct centralityStudy { getHist(TH2, histPath + "hNGlobalTracksVsNTPV")->Fill(multNTracksPV, multNTracksGlobal); } + if constexpr (requires { collision.multMCExtraId(); }) { + // requires monte carlo information + if (collision.multMCExtraId() > -1) { + auto mcCollision = collision.template multMCExtra_as>(); + histos.fill(HIST("hImpactParameterVsFT0A"), multFT0A, mcCollision.impactParameter()); + histos.fill(HIST("hImpactParameterVsFT0C"), multFT0C, mcCollision.impactParameter()); + histos.fill(HIST("hImpactParameterVsFT0M"), (multFT0A + multFT0C), mcCollision.impactParameter()); + histos.fill(HIST("hImpactParameterVsFV0A"), multFV0A, mcCollision.impactParameter()); + histos.fill(HIST("hImpactParameterVsNMFTTracks"), mftNtracks, mcCollision.impactParameter()); + histos.fill(HIST("hImpactParameterVsNTPV"), multNTracksPV, mcCollision.impactParameter()); + } + } + // if the table has centrality information if constexpr (requires { collision.centFT0C(); }) { // process FT0C centrality plots @@ -709,29 +732,31 @@ struct centralityStudy { } } - if (doTimeStudies && collision.has_multBC()) { - initRun(collision); - auto multbc = collision.template multBC_as(); - uint64_t bcTimestamp = multbc.timestamp(); - float hoursAfterStartOfRun = static_cast(bcTimestamp - startOfRunTimestamp) / 3600000.0; - - getHist(TH2, histPath + "hFT0AVsTime")->Fill(hoursAfterStartOfRun, collision.multFT0A()); - getHist(TH2, histPath + "hFT0CVsTime")->Fill(hoursAfterStartOfRun, collision.multFT0C()); - getHist(TH2, histPath + "hFT0MVsTime")->Fill(hoursAfterStartOfRun, collision.multFT0M()); - getHist(TH2, histPath + "hFV0AVsTime")->Fill(hoursAfterStartOfRun, collision.multFV0A()); - getHist(TH2, histPath + "hFV0AOuterVsTime")->Fill(hoursAfterStartOfRun, collision.multFV0AOuter()); - getHist(TH2, histPath + "hMFTTracksVsTime")->Fill(hoursAfterStartOfRun, collision.mftNtracks()); - getHist(TH2, histPath + "hNGlobalVsTime")->Fill(hoursAfterStartOfRun, collision.multNTracksGlobal()); - getHist(TH2, histPath + "hNTPVContributorsVsTime")->Fill(hoursAfterStartOfRun, collision.multPVTotalContributors()); - getHist(TProfile, histPath + "hPVzProfileCoVsTime")->Fill(hoursAfterStartOfRun, collision.multPVz()); - getHist(TProfile, histPath + "hPVzProfileBcVsTime")->Fill(hoursAfterStartOfRun, multbc.multFT0PosZ()); - if (doTimeStudyFV0AOuterVsFT0A3d) { - histos.fill(HIST("h3dFV0AVsTime"), hoursAfterStartOfRun, collision.multFV0A(), collision.multFV0AOuter()); - } - - if (irDoRateVsTime) { - float interactionRate = mRateFetcher.fetch(ccdb.service, bcTimestamp, mRunNumber, irSource.value, irCrashOnNull) / 1000.; // kHz - getHist(TProfile, histPath + "hIRProfileVsTime")->Fill(hoursAfterStartOfRun, interactionRate); + if constexpr (requires { collision.has_multBC(); }) { + if (doTimeStudies && collision.has_multBC()) { + initRun(collision); + auto multbc = collision.template multBC_as(); + uint64_t bcTimestamp = multbc.timestamp(); + float hoursAfterStartOfRun = static_cast(bcTimestamp - startOfRunTimestamp) / 3600000.0; + + getHist(TH2, histPath + "hFT0AVsTime")->Fill(hoursAfterStartOfRun, collision.multFT0A()); + getHist(TH2, histPath + "hFT0CVsTime")->Fill(hoursAfterStartOfRun, collision.multFT0C()); + getHist(TH2, histPath + "hFT0MVsTime")->Fill(hoursAfterStartOfRun, collision.multFT0M()); + getHist(TH2, histPath + "hFV0AVsTime")->Fill(hoursAfterStartOfRun, collision.multFV0A()); + getHist(TH2, histPath + "hFV0AOuterVsTime")->Fill(hoursAfterStartOfRun, collision.multFV0AOuter()); + getHist(TH2, histPath + "hMFTTracksVsTime")->Fill(hoursAfterStartOfRun, collision.mftNtracks()); + getHist(TH2, histPath + "hNGlobalVsTime")->Fill(hoursAfterStartOfRun, collision.multNTracksGlobal()); + getHist(TH2, histPath + "hNTPVContributorsVsTime")->Fill(hoursAfterStartOfRun, collision.multPVTotalContributors()); + getHist(TProfile, histPath + "hPVzProfileCoVsTime")->Fill(hoursAfterStartOfRun, collision.multPVz()); + getHist(TProfile, histPath + "hPVzProfileBcVsTime")->Fill(hoursAfterStartOfRun, multbc.multFT0PosZ()); + if (doTimeStudyFV0AOuterVsFT0A3d) { + histos.fill(HIST("h3dFV0AVsTime"), hoursAfterStartOfRun, collision.multFV0A(), collision.multFV0AOuter()); + } + + if (irDoRateVsTime) { + float interactionRate = mRateFetcher.fetch(ccdb.service, bcTimestamp, mRunNumber, irSource.value, irCrashOnNull) / 1000.; // kHz + getHist(TProfile, histPath + "hIRProfileVsTime")->Fill(hoursAfterStartOfRun, interactionRate); + } } } } @@ -741,12 +766,17 @@ struct centralityStudy { genericProcessCollision(collision); } + void processCollisionsWithResolutionStudy(soa::Join::iterator const& collision, soa::Join const&) + { + genericProcessCollision(collision); + } + void processCollisionsWithCentrality(soa::Join::iterator const& collision, aod::MultBCs const&) { genericProcessCollision(collision); } - void processCollisionsWithCentralityWithNeighbours(soa::Join::iterator const& collision, aod::MultBCs const&) + void processCollisionsWithCentralityWithNeighbours(soa::Join::iterator const& collision) { genericProcessCollision(collision); } @@ -814,6 +844,7 @@ struct centralityStudy { } PROCESS_SWITCH(centralityStudy, processCollisions, "per-collision analysis", false); + PROCESS_SWITCH(centralityStudy, processCollisionsWithResolutionStudy, "per-collision analysis, with reso study", false); PROCESS_SWITCH(centralityStudy, processCollisionsWithCentrality, "per-collision analysis", true); PROCESS_SWITCH(centralityStudy, processCollisionsWithCentralityWithNeighbours, "per-collision analysis", false); PROCESS_SWITCH(centralityStudy, processBCs, "per-BC analysis", true); From 59756945f68ff2f59ee11e2df68632dc94584d18 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sat, 23 Aug 2025 22:33:11 +0200 Subject: [PATCH 170/986] [PWGEM/Dilepton] update treeCreatorMLDDA.cxx (#12707) Co-authored-by: ALICE Action Bot --- .../treeCreatorElectronMLDDA.cxx | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx index b35d73698e7..2cd479429bd 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx @@ -183,7 +183,8 @@ struct TreeCreatorElectronMLDDA { Configurable cfg_min_cospa{"cfg_min_cospa", 0.9998, "min cospa for v0"}; Configurable cfg_max_dcadau{"cfg_max_dcadau", 0.1, "max distance between 2 legs for v0"}; - Configurable cfg_min_qt_strangeness{"cfg_min_qt_strangeness", 0.015, "min qt for Lambda and K0S"}; + Configurable cfg_min_qt_strangeness{"cfg_min_qt_strangeness", 0.02, "min qt for Lambda and K0S"}; + Configurable cfg_min_qt_k0s{"cfg_min_qt_k0s", 0.11, "min qt for K0S"}; Configurable cfg_min_cr2findable_ratio_tpc{"cfg_min_cr2findable_ratio_tpc", 0.8, "min. TPC Ncr/Nf ratio"}; Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 0.7, "max fraction of shared clusters in TPC"}; @@ -797,28 +798,30 @@ struct TreeCreatorElectronMLDDA { registry.fill(HIST("V0/hAP"), v0.alpha(), v0.qtarm()); if (v0cuts.cfg_min_qt_strangeness < v0.qtarm()) { - if (!(v0cuts.cfg_min_mass_lambda_veto < v0.mLambda() && v0.mLambda() < v0cuts.cfg_max_mass_lambda_veto) && !(v0cuts.cfg_min_mass_lambda_veto < v0.mAntiLambda() && v0.mAntiLambda() < v0cuts.cfg_max_mass_lambda_veto)) { - if ((isPionTight(pos) && isSelectedV0LegTight(collision, pos)) && (isPion(neg) && isSelectedV0Leg(collision, neg))) { - if (!tightv0cuts.requireTOF_for_tagging || pos.hasTOF()) { - registry.fill(HIST("V0/hMassK0Short"), v0.mK0Short()); - if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) { - registry.fill(HIST("V0/hTPCdEdx_P_Pi"), neg.tpcInnerParam(), neg.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_Pi"), neg.tpcInnerParam(), neg.beta()); - fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)); + if (v0cuts.cfg_min_qt_k0s < v0.qtarm()) { + if (!(v0cuts.cfg_min_mass_lambda_veto < v0.mLambda() && v0.mLambda() < v0cuts.cfg_max_mass_lambda_veto) && !(v0cuts.cfg_min_mass_lambda_veto < v0.mAntiLambda() && v0.mAntiLambda() < v0cuts.cfg_max_mass_lambda_veto)) { + if ((isPionTight(pos) && isSelectedV0LegTight(collision, pos)) && (isPion(neg) && isSelectedV0Leg(collision, neg))) { + if (!tightv0cuts.requireTOF_for_tagging || pos.hasTOF()) { + registry.fill(HIST("V0/hMassK0Short"), v0.mK0Short()); + if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) { + registry.fill(HIST("V0/hTPCdEdx_P_Pi"), neg.tpcInnerParam(), neg.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_Pi"), neg.tpcInnerParam(), neg.beta()); + fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)); + } } } - } - if (isPion(pos) && isSelectedV0Leg(collision, pos) && isPionTight(neg) && isSelectedV0LegTight(collision, neg)) { - if (!tightv0cuts.requireTOF_for_tagging || neg.hasTOF()) { - registry.fill(HIST("V0/hMassK0Short"), v0.mK0Short()); - if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) { - registry.fill(HIST("V0/hTPCdEdx_P_Pi"), pos.tpcInnerParam(), pos.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_Pi"), pos.tpcInnerParam(), pos.beta()); - fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)); + if (isPion(pos) && isSelectedV0Leg(collision, pos) && isPionTight(neg) && isSelectedV0LegTight(collision, neg)) { + if (!tightv0cuts.requireTOF_for_tagging || neg.hasTOF()) { + registry.fill(HIST("V0/hMassK0Short"), v0.mK0Short()); + if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) { + registry.fill(HIST("V0/hTPCdEdx_P_Pi"), pos.tpcInnerParam(), pos.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_Pi"), pos.tpcInnerParam(), pos.beta()); + fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)); + } } } - } - } // end of K0S + } // end of K0S + } if (!(v0cuts.cfg_min_mass_k0s_veto < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s_veto)) { if (isProton(pos) && isSelectedV0Leg(collision, pos) && isPionTight(neg) && isSelectedV0LegTight(collision, neg)) { @@ -842,6 +845,7 @@ struct TreeCreatorElectronMLDDA { } } // end of AntiLambda } + } // end of stangeness if (isElectronTight(pos) && isSelectedV0LegTight(collision, pos) && isElectron(neg) && isSelectedV0Leg(collision, neg)) { From 28dad10cf2743bd9c798d20eb73fe60450455371 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sat, 23 Aug 2025 23:30:23 +0200 Subject: [PATCH 171/986] [PWGEM/Dilepton] add pair rapidity (#12713) --- PWGEM/Dilepton/Core/Dilepton.h | 93 +++++++++---------------- PWGEM/Dilepton/Core/DileptonHadronMPC.h | 4 +- PWGEM/Dilepton/Core/DileptonMC.h | 7 +- PWGEM/Dilepton/Utils/PairUtilities.h | 3 +- 4 files changed, 40 insertions(+), 67 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index f3c38af643d..569cf2950c3 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -101,7 +101,7 @@ struct Dilepton { Configurable spresoPath{"spresoPath", "Users/d/dsekihat/PWGEM/dilepton/Qvector/resolution/LHC23zzh/pass3/test", "Path to SP resolution file"}; Configurable spresoHistName{"spresoHistName", "h1_R2_FT0M_BPos_BNeg", "histogram name of SP resolution file"}; - Configurable cfgAnalysisType{"cfgAnalysisType", static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kQC), "kQC:0, kUPC:1, kFlowV2:2, kFlowV3:3, kPolarization:4, kVM:5, kHFll:6"}; + Configurable cfgAnalysisType{"cfgAnalysisType", static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kQC), "kQC:0, kUPC:1, kFlowV2:2, kFlowV3:3, kPolarization:4, kHFll:5"}; Configurable cfgEP2Estimator_for_Mix{"cfgEP2Estimator_for_Mix", 3, "FT0M:0, FT0A:1, FT0C:2, BTot:3, BPos:4, BNeg:5"}; Configurable cfgQvecEstimator{"cfgQvecEstimator", 0, "FT0M:0, FT0A:1, FT0C:2, BTot:3, BPos:4, BNeg:5"}; Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; @@ -125,6 +125,7 @@ struct Dilepton { ConfigurableAxis ConfMllBins{"ConfMllBins", {VARIABLE_WIDTH, 0.00, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.50, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.70, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.80, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.00, 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.10, 2.20, 2.30, 2.40, 2.50, 2.60, 2.70, 2.75, 2.80, 2.85, 2.90, 2.95, 3.00, 3.05, 3.10, 3.15, 3.20, 3.25, 3.30, 3.35, 3.40, 3.45, 3.50, 3.55, 3.60, 3.65, 3.70, 3.75, 3.80, 3.85, 3.90, 3.95, 4.00}, "mll bins for output histograms"}; ConfigurableAxis ConfPtllBins{"ConfPtllBins", {VARIABLE_WIDTH, 0.00, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.50, 3.00, 3.50, 4.00, 4.50, 5.00, 6.00, 7.00, 8.00, 9.00, 10.00}, "pTll bins for output histograms"}; ConfigurableAxis ConfDCAllBins{"ConfDCAllBins", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, "DCAll bins for output histograms"}; + ConfigurableAxis ConfYllBins{"ConYllBins", {1, -1.f, 1.f}, "yll bins for output histograms"}; // pair rapidity // ConfigurableAxis ConfMmumuBins{"ConfMmumuBins", {VARIABLE_WIDTH, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.50, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.70, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.80, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.00, 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.10, 1.11,1.12,1.13,1.14,1.15,1.16,1.17,1.18,1.19, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.10, 2.20, 2.30, 2.40, 2.50, 2.60, 2.70, 2.75, 2.80, 2.85, 2.90, 2.95, 3.00, 3.05, 3.10, 3.15, 3.20, 3.25, 3.30, 3.35, 3.40, 3.45, 3.50, 3.55, 3.60, 3.65, 3.70, 3.75, 3.80, 3.85, 3.90, 3.95, 4.00, 4.10, 4.20, 4.30, 4.40, 4.50, 4.60, 4.70, 4.80, 4.90, 5.00, 5.10, 5.20, 5.30, 5.40, 5.50, 5.60, 5.70, 5.80, 5.90, 6.00, 6.10, 6.20, 6.30, 6.40, 6.50, 6.60, 6.70, 6.80, 6.90, 7.00, 7.10, 7.20, 7.30, 7.40, 7.50, 7.60, 7.70, 7.80, 7.90, 8.00, 8.10, 8.20, 8.30, 8.40, 8.50, 8.60, 8.70, 8.80, 8.90, 9.00, 9.10, 9.20, 9.30, 9.40, 9.50, 9.60, 9.70, 9.80, 9.90, 10.00, 10.10, 10.20, 10.30, 10.40, 10.50, 10.60, 10.70, 10.80, 10.90, 11.00, 11.50, 12.00}, "mmumu bins for output histograms"}; // for dimuon. one can copy bins here to hyperloop page. @@ -524,9 +525,11 @@ struct Dilepton { std::string mass_axis_title = "m_{ll} (GeV/c^{2})"; std::string pair_pt_axis_title = "p_{T,ll} (GeV/c)"; std::string pair_dca_axis_title = "DCA_{ll} (#sigma)"; + std::string pair_y_axis_title = "y_{ll}"; if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { mass_axis_title = "m_{ee} (GeV/c^{2})"; pair_pt_axis_title = "p_{T,ee} (GeV/c)"; + pair_y_axis_title = "y_{ee}"; pair_dca_axis_title = "DCA_{ee}^{3D} (#sigma)"; if (cfgDCAType == 1) { pair_dca_axis_title = "DCA_{ee}^{XY} (#sigma)"; @@ -540,15 +543,17 @@ struct Dilepton { mass_axis_title = "m_{#mu#mu} (GeV/c^{2})"; pair_pt_axis_title = "p_{T,#mu#mu} (GeV/c)"; pair_dca_axis_title = "DCA_{#mu#mu}^{XY} (#sigma)"; + pair_y_axis_title = "y_{#mu#mu}"; } // pair info const AxisSpec axis_mass{ConfMllBins, mass_axis_title}; const AxisSpec axis_pt{ConfPtllBins, pair_pt_axis_title}; const AxisSpec axis_dca{ConfDCAllBins, pair_dca_axis_title}; + const AxisSpec axis_y{ConfYllBins, pair_y_axis_title}; if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kQC)) { - fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca}, true); + fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y}, true); fRegistry.add("Pair/same/uls/hDeltaEtaDeltaPhi", "#Delta#eta-#Delta#varphi between 2 tracks;#Delta#varphi (rad.);#Delta#eta;", kTH2D, {{180, -M_PI, M_PI}, {400, -2, +2}}, true); fRegistry.add("Pair/same/uls/hDeltaEtaDeltaPhiPosition", "#Delta#eta-#Delta#varphi^{*} between 2 tracks;#Delta#varphi^{*} (rad.);#Delta#eta;", kTH2D, {{180, -M_PI, M_PI}, {400, -2, +2}}, true); @@ -565,7 +570,7 @@ struct Dilepton { const AxisSpec axis_asym_pt{10, 0, 1.f, "A = #frac{|p_{T,l^{+}} - p_{T,l^{-}}|}{|p_{T,l^{+}} + p_{T,l^{-}}|}"}; const AxisSpec axis_dphi_e_ee{18, 0, M_PI, "#Delta#varphi = #varphi_{l} - #varphi_{ll} (rad.)"}; const AxisSpec axis_cos_theta_cs{10, 0.f, 1.f, "|cos(#theta_{CS})|"}; - fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_cos_theta_cs}, true); + fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_cos_theta_cs}, true); fRegistry.addClone("Pair/same/uls/", "Pair/same/lspp/"); fRegistry.addClone("Pair/same/uls/", "Pair/same/lsmm/"); fRegistry.addClone("Pair/same/", "Pair/mix/"); @@ -578,51 +583,30 @@ struct Dilepton { const AxisSpec axis_sp{ConfSPBins, Form("#vec{u}_{%d,ll} #upoint #vec{Q}_{%d}^{%s}", nmod, nmod, qvec_det_names[cfgQvecEstimator].data())}; - fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_sp}, true); + fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y, axis_sp}, true); fRegistry.addClone("Pair/same/uls/", "Pair/same/lspp/"); fRegistry.addClone("Pair/same/uls/", "Pair/same/lsmm/"); - fRegistry.add("Pair/mix/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca}, true); + fRegistry.add("Pair/mix/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y}, true); fRegistry.addClone("Pair/mix/uls/", "Pair/mix/lspp/"); fRegistry.addClone("Pair/mix/uls/", "Pair/mix/lsmm/"); } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kPolarization)) { const AxisSpec axis_cos_theta_cs{10, 0.f, 1.f, "|cos(#theta_{CS})|"}; const AxisSpec axis_phi_cs{10, 0.f, M_PI, "|#varphi_{CS}| (rad.)"}; - fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_cos_theta_cs, axis_phi_cs}, true); - fRegistry.addClone("Pair/same/uls/", "Pair/same/lspp/"); - fRegistry.addClone("Pair/same/uls/", "Pair/same/lsmm/"); - fRegistry.addClone("Pair/same/", "Pair/mix/"); - } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kVM)) { - std::string pair_y_axis_title = "y_{ll}"; - int nbin_y = 20; - float min_y = -1.0; - float max_y = +1.0; - if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - pair_y_axis_title = "y_{ee}"; - nbin_y = 20; - min_y = -1.0; - max_y = +1.0; - } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - pair_y_axis_title = "y_{#mu#mu}"; - nbin_y = 25; - min_y = -4.5; - max_y = -2.0; - } - const AxisSpec axis_y{nbin_y, min_y, max_y, pair_y_axis_title}; - fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y}, true); + fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y, axis_cos_theta_cs, axis_phi_cs}, true); fRegistry.addClone("Pair/same/uls/", "Pair/same/lspp/"); fRegistry.addClone("Pair/same/uls/", "Pair/same/lsmm/"); fRegistry.addClone("Pair/same/", "Pair/mix/"); } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kHFll)) { const AxisSpec axis_dphi_ee{36, -M_PI / 2., 3. / 2. * M_PI, "#Delta#varphi = #varphi_{l1} - #varphi_{l2} (rad.)"}; // for kHFll const AxisSpec axis_deta_ee{40, -2., 2., "#Delta#eta = #eta_{l1} - #eta_{l2}"}; - fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_dphi_ee, axis_deta_ee}, true); + fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y, axis_dphi_ee, axis_deta_ee}, true); fRegistry.addClone("Pair/same/uls/", "Pair/same/lspp/"); fRegistry.addClone("Pair/same/uls/", "Pair/same/lsmm/"); fRegistry.addClone("Pair/same/", "Pair/mix/"); } else { // same as kQC to avoid seg. fault - fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca}, true); + fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y}, true); fRegistry.addClone("Pair/same/uls/", "Pair/same/lspp/"); fRegistry.addClone("Pair/same/uls/", "Pair/same/lsmm/"); fRegistry.addClone("Pair/same/", "Pair/mix/"); @@ -935,7 +919,7 @@ struct Dilepton { float opAng = o2::aod::pwgem::dilepton::utils::pairutil::getOpeningAngle(t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz()); if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hDeltaEtaDeltaPhi"), dphi, deta, weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hDeltaEtaDeltaPhiPosition"), dphiPosition, deta, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { @@ -948,7 +932,7 @@ struct Dilepton { } } } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hDeltaEtaDeltaPhi"), dphi, deta, weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hDeltaEtaDeltaPhiPosition"), dphiPosition, deta, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { @@ -961,7 +945,7 @@ struct Dilepton { } } } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hDeltaEtaDeltaPhi"), dphi, deta, weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hDeltaEtaDeltaPhiPosition"), dphiPosition, deta, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { @@ -986,11 +970,11 @@ struct Dilepton { o2::aod::pwgem::dilepton::utils::pairutil::getAngleCS(t1, t2, leptonM1, leptonM2, beamE1, beamE2, beamP1, beamP2, cos_thetaCS, phiCS); if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, aco, asym, std::fabs(dphi_e_ee), std::fabs(cos_thetaCS), weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), aco, asym, std::fabs(dphi_e_ee), std::fabs(cos_thetaCS), weight); } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, aco, asym, std::fabs(dphi_e_ee), std::fabs(cos_thetaCS), weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), aco, asym, std::fabs(dphi_e_ee), std::fabs(cos_thetaCS), weight); } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, aco, asym, std::fabs(dphi_e_ee), std::fabs(cos_thetaCS), weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), aco, asym, std::fabs(dphi_e_ee), std::fabs(cos_thetaCS), weight); } } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kFlowV2) || cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kFlowV3)) { std::array q2ft0m = {collision.q2xft0m(), collision.q2yft0m()}; @@ -1018,19 +1002,19 @@ struct Dilepton { float sp = RecoDecay::dotProd(std::array{static_cast(std::cos(nmod * v12.Phi())), static_cast(std::sin(nmod * v12.Phi()))}, qvectors[nmod][cfgQvecEstimator]) / getSPresolution(collision.centFT0C(), collision.trackOccupancyInTimeRange()); if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, sp, weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), sp, weight); } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, sp, weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), sp, weight); } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, sp, weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), sp, weight); } } else if constexpr (ev_id == 1) { if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); } } } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kPolarization)) { @@ -1039,20 +1023,11 @@ struct Dilepton { o2::math_utils::bringToPMPi(phiCS); if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, std::fabs(cos_thetaCS), std::fabs(phiCS), weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), std::fabs(cos_thetaCS), std::fabs(phiCS), weight); } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, std::fabs(cos_thetaCS), std::fabs(phiCS), weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), std::fabs(cos_thetaCS), std::fabs(phiCS), weight); } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, std::fabs(cos_thetaCS), std::fabs(phiCS), weight); - } - - } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kVM)) { - if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); - } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); - } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), std::fabs(cos_thetaCS), std::fabs(phiCS), weight); } } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kHFll)) { float dphi = v1.Phi() - v2.Phi(); @@ -1060,20 +1035,20 @@ struct Dilepton { float deta = v1.Eta() - v2.Eta(); if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, dphi, deta, weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), dphi, deta, weight); } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, dphi, deta, weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), dphi, deta, weight); } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, dphi, deta, weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), dphi, deta, weight); } } else { // same as kQC to avoid seg. fault if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); } } diff --git a/PWGEM/Dilepton/Core/DileptonHadronMPC.h b/PWGEM/Dilepton/Core/DileptonHadronMPC.h index ea6c7f43a82..28df971c52c 100644 --- a/PWGEM/Dilepton/Core/DileptonHadronMPC.h +++ b/PWGEM/Dilepton/Core/DileptonHadronMPC.h @@ -126,7 +126,7 @@ struct DileptonHadronMPC { // ConfigurableAxis ConfMmumuBins{"ConfMmumuBins", {VARIABLE_WIDTH, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.50, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.70, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.80, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.00, 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.10, 1.11,1.12,1.13,1.14,1.15,1.16,1.17,1.18,1.19, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.10, 2.20, 2.30, 2.40, 2.50, 2.60, 2.70, 2.75, 2.80, 2.85, 2.90, 2.95, 3.00, 3.05, 3.10, 3.15, 3.20, 3.25, 3.30, 3.35, 3.40, 3.45, 3.50, 3.55, 3.60, 3.65, 3.70, 3.75, 3.80, 3.85, 3.90, 3.95, 4.00, 4.10, 4.20, 4.30, 4.40, 4.50, 4.60, 4.70, 4.80, 4.90, 5.00, 5.10, 5.20, 5.30, 5.40, 5.50, 5.60, 5.70, 5.80, 5.90, 6.00, 6.10, 6.20, 6.30, 6.40, 6.50, 6.60, 6.70, 6.80, 6.90, 7.00, 7.10, 7.20, 7.30, 7.40, 7.50, 7.60, 7.70, 7.80, 7.90, 8.00, 8.10, 8.20, 8.30, 8.40, 8.50, 8.60, 8.70, 8.80, 8.90, 9.00, 9.10, 9.20, 9.30, 9.40, 9.50, 9.60, 9.70, 9.80, 9.90, 10.00, 10.10, 10.20, 10.30, 10.40, 10.50, 10.60, 10.70, 10.80, 10.90, 11.00, 11.50, 12.00}, "mmumu bins for output histograms"}; // for dimuon. one can copy bins here to hyperloop page. ConfigurableAxis ConfPtHadronBins{"ConfPtHadronBins", {VARIABLE_WIDTH, 0.00, 0.15, 0.2, 0.3, 0.4, 0.50, 1.00, 2.00, 3.00, 4.00, 5.00}, "pT,h bins for output histograms"}; - ConfigurableAxis ConfRapidityBins{"ConfRapidityBins", {20, -1, 1}, "rapidity bins for output histograms"}; + ConfigurableAxis ConfYllBins{"ConfYllBins", {1, -1.f, 1.f}, "yll bins for output histograms"}; // pair rapidity ConfigurableAxis ConfDEtaBins{"ConfDEtaBins", {120, -6, 6}, "deta bins for output histograms"}; Configurable cfgNbinsDPhi{"cfgNbinsDPhi", 36, "nbins in dphi for output histograms"}; Configurable cfgNbinsCosNDPhi{"cfgNbinsCosNDPhi", 200, "nbins in cos(n(dphi)) for output histograms"}; @@ -495,7 +495,7 @@ struct DileptonHadronMPC { const AxisSpec axis_mass{ConfMllBins, mass_axis_title}; const AxisSpec axis_pt{ConfPtllBins, pair_pt_axis_title}; const AxisSpec axis_dca{ConfDCAllBins, pair_dca_axis_title}; - const AxisSpec axis_y{ConfRapidityBins, pair_rapidity_axis_title}; + const AxisSpec axis_y{ConfYllBins, pair_rapidity_axis_title}; // dilepton-hadron info const AxisSpec axis_deta{ConfDEtaBins, deta_axis_title}; diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index 5962ea22f0c..4536d03cb88 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -113,7 +113,7 @@ struct DileptonMC { ConfigurableAxis ConfDCAllNarrowBins{"ConfDCAllNarrowBins", {200, 0.0, 10.0}, "narrow DCAll bins for output histograms"}; ConfigurableAxis ConfTrackDCA{"ConfTrackDCA", {VARIABLE_WIDTH, -10, -9, -8, -7, -6, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.9, -1.8, -1.7, -1.6, -1.5, -1.4, -1.3, -1.2, -1.1, -1, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.5, 3, 3.5, 4, 4.5, 5, 6, 7, 8, 9, 10}, "DCA binning for single tacks"}; - ConfigurableAxis ConfYllBins{"ConfYllBins", {VARIABLE_WIDTH, -10.f, +10.f}, "yll bins for output histograms"}; + ConfigurableAxis ConfYllBins{"ConfYllBins", {1, -1.f, +1.f}, "yll bins for output histograms"}; // ConfigurableAxis ConfMmumuBins{"ConfMmumuBins", {VARIABLE_WIDTH, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.50, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.70, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.80, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.00, 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.10, 1.11,1.12,1.13,1.14,1.15,1.16,1.17,1.18,1.19, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.10, 2.20, 2.30, 2.40, 2.50, 2.60, 2.70, 2.75, 2.80, 2.85, 2.90, 2.95, 3.00, 3.05, 3.10, 3.15, 3.20, 3.25, 3.30, 3.35, 3.40, 3.45, 3.50, 3.55, 3.60, 3.65, 3.70, 3.75, 3.80, 3.85, 3.90, 3.95, 4.00, 4.10, 4.20, 4.30, 4.40, 4.50, 4.60, 4.70, 4.80, 4.90, 5.00, 5.10, 5.20, 5.30, 5.40, 5.50, 5.60, 5.70, 5.80, 5.90, 6.00, 6.10, 6.20, 6.30, 6.40, 6.50, 6.60, 6.70, 6.80, 6.90, 7.00, 7.10, 7.20, 7.30, 7.40, 7.50, 7.60, 7.70, 7.80, 7.90, 8.00, 8.10, 8.20, 8.30, 8.40, 8.50, 8.60, 8.70, 8.80, 8.90, 9.00, 9.10, 9.20, 9.30, 9.40, 9.50, 9.60, 9.70, 9.80, 9.90, 10.00, 10.10, 10.20, 10.30, 10.40, 10.50, 10.60, 10.70, 10.80, 10.90, 11.00, 11.50, 12.00}, "mmumu bins for output histograms"}; // for dimuon. one can copy bins here to hyperloop page. @@ -345,7 +345,6 @@ struct DileptonMC { const AxisSpec axis_y{ConfYllBins, pair_y_axis_title}; const AxisSpec axis_dca{ConfDCAllBins, pair_dca_axis_title}; const AxisSpec axis_pt_meson{ConfPtllBins, "p_{T} (GeV/c)"}; // for omega, phi meson pT spectra - const AxisSpec axis_y_meson{ConfYllBins, "y"}; // rapidity of meson const AxisSpec axis_dca_narrow{ConfDCAllNarrowBins, pair_dca_axis_title}; const AxisSpec axis_dpt{ConfDPtBins, "#Delta p_{T,1}^{gen-rec} + #Delta p_{T,2}^{gen-rec} (GeV/c)"}; @@ -374,8 +373,8 @@ struct DileptonMC { fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/NonPromptJPsi/"); fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/PromptPsi2S/"); fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/NonPromptPsi2S/"); - fRegistry.add("Generated/sm/Omega2ll/hPtY", "pT of #omega meson", kTH2F, {axis_y_meson, axis_pt_meson}, true); - fRegistry.add("Generated/sm/Phi2ll/hPtY", "pT of #phi meson", kTH2F, {axis_y_meson, axis_pt_meson}, true); + fRegistry.add("Generated/sm/Omega2ll/hPtY", "pT of #omega meson", kTH2F, {axis_y, axis_pt_meson}, true); + fRegistry.add("Generated/sm/Phi2ll/hPtY", "pT of #phi meson", kTH2F, {axis_y, axis_pt_meson}, true); fRegistry.add("Generated/ccbar/c2l_c2l/hadron_hadron/hs", "generated dilepton signal", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_cs, axis_phi_cs, axis_aco, axis_asym_pt, axis_dphi_e_ee}, true); fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", "Generated/ccbar/c2l_c2l/meson_meson/"); diff --git a/PWGEM/Dilepton/Utils/PairUtilities.h b/PWGEM/Dilepton/Utils/PairUtilities.h index 1fcede0e14d..6a574c3fb7e 100644 --- a/PWGEM/Dilepton/Utils/PairUtilities.h +++ b/PWGEM/Dilepton/Utils/PairUtilities.h @@ -42,8 +42,7 @@ enum class DileptonAnalysisType : int { kFlowV2 = 2, kFlowV3 = 3, kPolarization = 4, - kVM = 5, - kHFll = 6, + kHFll = 5, }; enum class DileptonHadronAnalysisType : int { From b97bc8ecc17b4c7dfe8e353a41c5ac448638edf3 Mon Sep 17 00:00:00 2001 From: Victor Gonzalez Date: Sun, 24 Aug 2025 00:38:57 +0200 Subject: [PATCH 172/986] [PWGCF] DptDpt -- Configurable rationalization (#12711) Co-authored-by: Victor --- PWGCF/TableProducer/dptDptFilter.cxx | 143 ++++++++++++++--- PWGCF/TableProducer/dptDptFilter.h | 231 +++++++++++++++++++++------ 2 files changed, 301 insertions(+), 73 deletions(-) diff --git a/PWGCF/TableProducer/dptDptFilter.cxx b/PWGCF/TableProducer/dptDptFilter.cxx index 2fe925102b8..0aab214d083 100644 --- a/PWGCF/TableProducer/dptDptFilter.cxx +++ b/PWGCF/TableProducer/dptDptFilter.cxx @@ -49,6 +49,7 @@ #include #include #include +#include #include using namespace o2; @@ -112,18 +113,32 @@ static const std::vector beforeAfterSufix = {"B", "A"}; static constexpr float MultiplicityUpperLimitBase[11][8] = { /* T0A, T0C, T0M, V0A, V0C, V0M, tracks, PV contr. tracks */ {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 100e3f, 10e3f, 400.0f}, /* no system */ - {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 100e3f, 10e3f, 400.0f}, /* pp Run2 */ + {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 50e3f, 5e3f, 400.0f}, /* pp Run2 */ {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 100e3f, 10e3f, 400.0f}, /* pPb Run2 */ {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 100e3f, 10e3f, 400.0f}, /* Pbp Run2 */ {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 100e3f, 10e3f, 400.0f}, /* PbPb Run2 */ {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 100e3f, 10e3f, 400.0f}, /* XeXe Run2 */ - {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 100e3f, 10e3f, 400.0f}, /* pp Run3 */ + {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 50e3f, 5e3f, 400.0f}, /* pp Run3 */ {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 100e3f, 10e3f, 400.0f}, /* PbPb Run3 */ - {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 100e3f, 10e3f, 400.0f}, /* NeNe Run3 */ - {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 100e3f, 10e3f, 400.0f}, /* OO Run3 */ - {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 100e3f, 10e3f, 400.0f} /* pO Run3 */ + {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 50e3f, 5e3f, 400.0f}, /* NeNe Run3 */ + {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 50e3f, 5e3f, 400.0f}, /* OO Run3 */ + {30e3f, 10e3f, 40e3f, 50e3f, 70e3f, 50e3f, 5e3f, 400.0f} /* pO Run3 */ }; +/* helpers for the multiplicity/centrality correlations exclusion formulae */ +static const std::string multiplicityCentralityCorrelationsFormulaBase[11][1] = { + /* no system */ {""}, + /* pp Run2 */ {""}, + /* pPb Run2 */ {""}, + /* Pbp Run2 */ {""}, + /* PbPb Run2 */ {""}, + /* XeXe Run2 */ {""}, + /* pp Run3 */ {""}, + /* PbPb Run3 */ {""}, + /* NeNe Run3 */ {"((221.987-0.706581*[CT0C]+0.00906828*[CT0C]*[CT0C]-23.5275*sqrt([CT0C])-2.5*(38.5823+2.00054*[CT0C]+0.0125088*[CT0C]*[CT0C]-8.47825*sqrt([CT0C])-0.273493*[CT0C]*sqrt([CT0C])))<=[MNGLTRK])&&((-0.0729502+0.79403*[MNPVC]+5.0*(0.032005+0.00372503*[MNPVC]-7.18977e-06*[MNPVC]*[MNPVC]+0.412714*sqrt([MNPVC])))>[MNGLTRK])&&((-0.0729502+0.79403*[MNPVC]-5.0*(0.032005+0.00372503*[MNPVC]-7.18977e-06*[MNPVC]*[MNPVC]+0.412714*sqrt([MNPVC])))<=[MNGLTRK])"}, + /* OO Run3 */ {"((180.584-0.211625*[CT0C]+0.00568101*[CT0C]*[CT0C]-20.9838*sqrt([CT0C])-2.5*(32.665+1.67341*[CT0C]+0.0113878*[CT0C]*[CT0C]-6.83271*sqrt([CT0C])-0.239428*[CT0C]*sqrt([CT0C])))<=[MNGLTRK])&&((-0.0533229+0.79235*[MNPVC]+5.0*(0.031512+0.0045874*[MNPVC]-1.06374e-05*[MNPVC]*[MNPVC]+0.407526*sqrt([MNPVC])))>[MNGLTRK])&&((-0.0533229+0.79235*[MNPVC]-5.0*(0.031512+0.0045874*[MNPVC]-1.06374e-05*[MNPVC]*[MNPVC]+0.407526*sqrt([MNPVC])))<=[MNGLTRK])"}, + /* pO Run3 */ {""}}; + //============================================================================================ // The DptDptFilter histogram objects // TODO: consider registering in the histogram registry @@ -393,6 +408,79 @@ struct Multiplicity { } }; +////////////////////////////////////////////////////////////////////////////////// +/// Centrality/multiplicity correlations exclusion +/// TODO: adaptation to Run 1/Run 2 +////////////////////////////////////////////////////////////////////////////////// +template +inline void storeMultiplicitiesAndCentralities(CollisionObject const& collision, TrackListObject const& tracks) +{ + /* only do it if we are tracking the centrality / multiplicity correlations */ + if (useCentralityMultiplicityCorrelationsExclusion) { + int nGlobalTracks = 0; + for (auto const& track : tracks) { + if (track.isGlobalTrack()) { + nGlobalTracks++; + } + } + for (CentMultCorrelationsParams ipar = CentMultCorrelationsMT0A; ipar < CentMultCorrelationsNOOFPARAMS; ++ipar) { + switch (ipar) { + case CentMultCorrelationsMT0A: + collisionMultiplicityCentralityObservables[ipar] = collision.multFT0A(); + break; + case CentMultCorrelationsMT0C: + collisionMultiplicityCentralityObservables[ipar] = collision.multFT0C(); + break; + case CentMultCorrelationsMT0M: + collisionMultiplicityCentralityObservables[ipar] = collision.multFT0M(); + break; + case CentMultCorrelationsMV0A: + collisionMultiplicityCentralityObservables[ipar] = collision.multFV0A(); + break; + case CentMultCorrelationsMV0C: + collisionMultiplicityCentralityObservables[ipar] = collision.multFV0C(); + break; + case CentMultCorrelationsMV0M: + collisionMultiplicityCentralityObservables[ipar] = collision.multFV0M(); + break; + case CentMultCorrelationsMNGLTRK: + collisionMultiplicityCentralityObservables[ipar] = nGlobalTracks; + break; + case CentMultCorrelationsMNPVC: + collisionMultiplicityCentralityObservables[ipar] = collision.multNTracksPV(); + break; + case CentMultCorrelationsCT0A: + if constexpr (framework::has_type_v) { + collisionMultiplicityCentralityObservables[ipar] = collision.centFT0A(); + } + break; + case CentMultCorrelationsCT0C: + if constexpr (framework::has_type_v) { + collisionMultiplicityCentralityObservables[ipar] = collision.centFT0C(); + } + break; + case CentMultCorrelationsCT0M: + if constexpr (framework::has_type_v) { + collisionMultiplicityCentralityObservables[ipar] = collision.centFT0M(); + } + break; + case CentMultCorrelationsCV0A: + if constexpr (framework::has_type_v) { + collisionMultiplicityCentralityObservables[ipar] = collision.centFV0A(); + } + break; + case CentMultCorrelationsCNTPV: + if constexpr (framework::has_type_v) { + collisionMultiplicityCentralityObservables[ipar] = collision.centNTPV(); + } + break; + default: + break; + } + } + } +} + ////////////////////////////////////////////////////////////////////////////// // The filter class ////////////////////////////////////////////////////////////////////////////// @@ -414,7 +502,10 @@ struct DptDptFilter { Configurable minOrbit{"minOrbit", -1, "Lowest orbit to track"}; Configurable maxOrbit{"maxOrbit", INT64_MAX, "Highest orbit to track"}; Configurable rctSource{"rctSource", "None", "RCT selection source: None,CBT,CBT_hadronPID,CBT_electronPID,CBT_calo,CBT_muon,CBT_muon_glo. Default: None"}; - Configurable> multiplicityUpperLimit{"multiplicityUpperLimit", {&MultiplicityUpperLimitBase[0][0], 11, 8, {systemExternalNamesMap.at(0), systemExternalNamesMap.at(1), systemExternalNamesMap.at(2), systemExternalNamesMap.at(3), systemExternalNamesMap.at(4), systemExternalNamesMap.at(5), systemExternalNamesMap.at(6), systemExternalNamesMap.at(7), systemExternalNamesMap.at(8), systemExternalNamesMap.at(9), systemExternalNamesMap.at(10)}, {multiplicitySourceConfigNamesMap.at(0), multiplicitySourceConfigNamesMap.at(1), multiplicitySourceConfigNamesMap.at(2), multiplicitySourceConfigNamesMap.at(3), multiplicitySourceConfigNamesMap.at(4), multiplicitySourceConfigNamesMap.at(5), multiplicitySourceConfigNamesMap.at(6), multiplicitySourceConfigNamesMap.at(7)}}, "Upper limits for the multiplicity observables"}; +#define SYSTEMNAME(sysid) systemExternalNamesMap.at(sysid).data() +#define MULTSRCNAME(msrcid) multiplicitySourceConfigNamesMap.at(msrcid).data() + Configurable> multiplicityUpperLimit{"multiplicityUpperLimit", {MultiplicityUpperLimitBase[0], 11, 8, {SYSTEMNAME(0), SYSTEMNAME(1), SYSTEMNAME(2), SYSTEMNAME(3), SYSTEMNAME(4), SYSTEMNAME(5), SYSTEMNAME(6), SYSTEMNAME(7), SYSTEMNAME(8), SYSTEMNAME(9), SYSTEMNAME(10)}, {MULTSRCNAME(0), MULTSRCNAME(1), MULTSRCNAME(2), MULTSRCNAME(3), MULTSRCNAME(4), MULTSRCNAME(5), MULTSRCNAME(6), MULTSRCNAME(7)}}, "Upper limits for the multiplicity observables"}; + Configurable> multiplicitiesExclusionFormula{"multiplicitiesExclusionFormula", {multiplicityCentralityCorrelationsFormulaBase[0], 11, 1, {SYSTEMNAME(0), SYSTEMNAME(1), SYSTEMNAME(2), SYSTEMNAME(3), SYSTEMNAME(4), SYSTEMNAME(5), SYSTEMNAME(6), SYSTEMNAME(7), SYSTEMNAME(8), SYSTEMNAME(9), SYSTEMNAME(10)}, {"Exclusion formula"}}, "Formula for excluding outliers of the multiplicities correlations. Use any parameter from centMultCorrelationsParamsMap"}; struct : ConfigurableGroup { std::string prefix = "cfgEventSelection.occupancySelection"; Configurable occupancyEstimation{"occupancyEstimation", "None", "Occupancy estimation: None, Tracks, FT0C. Default None"}; @@ -475,7 +566,7 @@ struct DptDptFilter { } else if (doprocessOnTheFlyGeneratorLevel) { fCentMultEstimator = CentMultFV0A; } else { - fCentMultEstimator = getCentMultEstimator(cfgCentMultEstimator); + fCentMultEstimator = getCentMultEstimator(cfgCentMultEstimator.value.c_str()); } /* RCT information usage */ if (cfgEventSelection.rctSource.value == "None") { @@ -487,19 +578,22 @@ struct DptDptFilter { } /* the occupancy selection */ - fOccupancyEstimation = getOccupancyEstimator(cfgEventSelection.occupancySelection.occupancyEstimation); + fOccupancyEstimation = getOccupancyEstimator(cfgEventSelection.occupancySelection.occupancyEstimation.value.c_str()); fMinOccupancy = cfgEventSelection.occupancySelection.minOccupancy; fMaxOccupancy = cfgEventSelection.occupancySelection.maxOccupancy; /* the trigger selection */ - triggerSelectionFlags = getTriggerSelection(cfgTriggSel); + triggerSelectionFlags = getTriggerSelection(cfgTriggSel.value.c_str()); traceCollId0 = cfgTraceCollId0; /* if the system type is not known at this time, we have to put the initialization somewhere else */ - fSystem = getSystemType(cfgSystem); + fSystem = getSystemType(cfgSystem.value.c_str()); fLhcRun = multRunForSystemMap.at(fSystem); fDataType = getDataType(cfgDataType); + /* the multiplicities outliers exclusion */ + multiplicityCentralityCorrelationsExclusion = getExclusionFormula(cfgEventSelection.multiplicitiesExclusionFormula->getData()[fSystem][0].c_str()); + /* create the output list which will own the task histograms */ TList* fOutputList = new TList(); fOutputList->SetOwner(true); @@ -509,18 +603,18 @@ struct DptDptFilter { /* create the reconstructed data histograms */ fhEventSelection = new TH1D("EventSelection", ";;counts", CollSelNOOFFLAGS, -0.5f, static_cast(CollSelNOOFFLAGS) - 0.5f); for (int ix = 0; ix < CollSelNOOFFLAGS; ++ix) { - fhEventSelection->GetXaxis()->SetBinLabel(ix + 1, collisionSelectionExternalNamesMap.at(ix).c_str()); + fhEventSelection->GetXaxis()->SetBinLabel(ix + 1, collisionSelectionExternalNamesMap.at(ix).data()); } fhTriggerSelection = new TH1D("TriggerSelection", ";;counts", TriggSelNOOFTRIGGERS, -0.5f, static_cast(TriggSelNOOFTRIGGERS) - 0.5f); for (int ix = 0; ix < TriggSelNOOFTRIGGERS; ++ix) { - fhTriggerSelection->GetXaxis()->SetBinLabel(ix + 1, TString::Format("#color[%d]{%s}", triggerSelectionFlags.test(ix) ? 2 : 1, triggerSelectionExternalNamesMap.at(ix).c_str()).Data()); + fhTriggerSelection->GetXaxis()->SetBinLabel(ix + 1, TString::Format("#color[%d]{%s}", triggerSelectionFlags.test(ix) ? 2 : 1, triggerSelectionExternalNamesMap.at(ix).data()).Data()); } fhTriggerSelectionCorrelations = new TH2D("TriggerSelectionCorrelations", ";;;counts", TriggSelNOOFTRIGGERS, -0.5f, static_cast(TriggSelNOOFTRIGGERS) - 0.5f, TriggSelNOOFTRIGGERS, -0.5f, static_cast(TriggSelNOOFTRIGGERS) - 0.5f); for (int ixy = 0; ixy < TriggSelNOOFTRIGGERS; ++ixy) { - fhTriggerSelectionCorrelations->GetXaxis()->SetBinLabel(ixy + 1, TString::Format("#color[%d]{%s}", triggerSelectionFlags.test(ixy) ? 2 : 1, triggerSelectionExternalNamesMap.at(ixy).c_str()).Data()); - fhTriggerSelectionCorrelations->GetYaxis()->SetBinLabel(ixy + 1, TString::Format("#color[%d]{%s}", triggerSelectionFlags.test(ixy) ? 2 : 1, triggerSelectionExternalNamesMap.at(ixy).c_str()).Data()); + fhTriggerSelectionCorrelations->GetXaxis()->SetBinLabel(ixy + 1, TString::Format("#color[%d]{%s}", triggerSelectionFlags.test(ixy) ? 2 : 1, triggerSelectionExternalNamesMap.at(ixy).data()).Data()); + fhTriggerSelectionCorrelations->GetYaxis()->SetBinLabel(ixy + 1, TString::Format("#color[%d]{%s}", triggerSelectionFlags.test(ixy) ? 2 : 1, triggerSelectionExternalNamesMap.at(ixy).data()).Data()); } fhVertexZB = new TH1F("VertexZB", "Vertex Z; z_{vtx}", 60, -15, 15); @@ -530,32 +624,32 @@ struct DptDptFilter { #define DPTDPTCENTRALITYAXIS 105, -0.5f, 104.5f #define DPTDPTMULTIPLICITYAXIS(est) 1001, -0.5f, cfgEventSelection.multiplicityUpperLimit->getData()[fSystem][est] - 0.5f - std::string multestimator = getCentMultEstimatorName(fCentMultEstimator); + std::string_view multestimator = getCentMultEstimatorName(fCentMultEstimator); fhCentMultB = new TH1F("CentralityB", "Centrality before cut; centrality (%)", DPTDPTCENTRALITYAXIS); fhCentMultA = new TH1F("CentralityA", "Centrality; centrality (%)", DPTDPTCENTRALITYAXIS); - fhMultB = new TH1F("MultB", TString::Format("%s Multiplicity before cut;%s Multiplicity;Collisions", multestimator.c_str(), multestimator.c_str()), DPTDPTMULTIPLICITYAXIS(estimatorMultiplicitySourceMap.at(fCentMultEstimator))); - fhMultA = new TH1F("MultA", TString::Format("%s Multiplicity;%s Multiplicity;Collisions", multestimator.c_str(), multestimator.c_str()), DPTDPTMULTIPLICITYAXIS(estimatorMultiplicitySourceMap.at(fCentMultEstimator))); + fhMultB = new TH1F("MultB", TString::Format("%s Multiplicity before cut;%s Multiplicity;Collisions", multestimator.data(), multestimator.data()), DPTDPTMULTIPLICITYAXIS(estimatorMultiplicitySourceMap.at(fCentMultEstimator))); + fhMultA = new TH1F("MultA", TString::Format("%s Multiplicity;%s Multiplicity;Collisions", multestimator.data(), multestimator.data()), DPTDPTMULTIPLICITYAXIS(estimatorMultiplicitySourceMap.at(fCentMultEstimator))); if (cfgEventSelection.fillQc) { /* the quality control histograms */ for (int i = 0; i < BeforeAfterNOOFTIMES; ++i) { - fhMultiplicityVsCentrality[i] = new TH2F(TString::Format("MultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);Number of tracks", beforeAfterName[i].c_str(), multestimator.c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); + fhMultiplicityVsCentrality[i] = new TH2F(TString::Format("MultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);Number of tracks", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); fhMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsT0cMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0C Multiplicity;Number of tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0C), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); fhMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsT0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0A Multiplicity;Number of tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0A), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); fhMultiplicityVsV0aMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsV0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;V0A Multiplicity;Number of tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceV0A), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); fhMultiplicityVsPvMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsPvMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;PV contributors;Number of tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); - fhPvMultiplicityVsCentrality[i] = new TH2F(TString::Format("PvMultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);PV contributors", beforeAfterName[i].c_str(), multestimator.c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); + fhPvMultiplicityVsCentrality[i] = new TH2F(TString::Format("PvMultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);PV contributors", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); fhPvMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("PvMultiplicityVsT0cMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0C multiplicity;PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0C), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); fhPvMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("PvMultiplicityVsT0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0A multiplicity;PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0A), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); fhPvMultiplicityVsV0aMultiplicity[i] = new TH2F(TString::Format("PvMultiplicityVsV0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;V0A multiplicity;PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceV0A), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); - fhV0aMultiplicityVsCentrality[i] = new TH2F(TString::Format("V0aMultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);V0A multiplicity", beforeAfterName[i].c_str(), multestimator.c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourceV0A)); + fhV0aMultiplicityVsCentrality[i] = new TH2F(TString::Format("V0aMultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);V0A multiplicity", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourceV0A)); fhV0aMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("V0aMultiplicityVsT0cMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0C multiplicity;V0A multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0C), DPTDPTMULTIPLICITYAXIS(MultSourceV0A)); fhV0aMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("V0aMultiplicityVsT0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0A multiplicity;V0A multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0A), DPTDPTMULTIPLICITYAXIS(MultSourceV0A)); - fhT0cMultiplicityVsCentrality[i] = new TH2F(TString::Format("T0cMultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);T0C multiplicity", beforeAfterName[i].c_str(), multestimator.c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourceT0C)); + fhT0cMultiplicityVsCentrality[i] = new TH2F(TString::Format("T0cMultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);T0C multiplicity", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourceT0C)); fhT0cMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("T0cMultiplicityVsT0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0A multiplicity;T0C multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0A), DPTDPTMULTIPLICITYAXIS(MultSourceT0C)); - fhT0CentralityVsCentrality[i] = new TH2F(TString::Format("T0CentralityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);T0 centrality(%%)", beforeAfterName[i].c_str(), multestimator.c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTCENTRALITYAXIS); - fhV0aCentralityVsCentrality[i] = new TH2F(TString::Format("V0aCentralityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);V0A centrality (%%)", beforeAfterName[i].c_str(), multestimator.c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTCENTRALITYAXIS); - fhNtpvCentralityVsCentrality[i] = new TH2F(TString::Format("NtpvCentralityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);NTPV centrality (%%)", beforeAfterName[i].c_str(), multestimator.c_str()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTCENTRALITYAXIS); + fhT0CentralityVsCentrality[i] = new TH2F(TString::Format("T0CentralityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);T0 centrality(%%)", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTCENTRALITYAXIS); + fhV0aCentralityVsCentrality[i] = new TH2F(TString::Format("V0aCentralityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);V0A centrality (%%)", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTCENTRALITYAXIS); + fhNtpvCentralityVsCentrality[i] = new TH2F(TString::Format("NtpvCentralityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);NTPV centrality (%%)", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTCENTRALITYAXIS); } } @@ -693,6 +787,7 @@ void DptDptFilter::processReconstructed(CollisionObject const& collision, Tracks float centormult = tentativecentmult; int64_t orbit = collision.template bc_as().globalBC() / nBCsPerOrbit; bool withinOrbitOfInterest = (cfgEventSelection.minOrbit <= orbit) && (orbit < cfgEventSelection.maxOrbit); + storeMultiplicitiesAndCentralities(collision, ftracks); if (withinOrbitOfInterest && isEventSelected(collision, centormult)) { acceptedevent = true; fhCentMultA->Fill(centormult); diff --git a/PWGCF/TableProducer/dptDptFilter.h b/PWGCF/TableProducer/dptDptFilter.h index d99ae8951d8..d79924724f2 100644 --- a/PWGCF/TableProducer/dptDptFilter.h +++ b/PWGCF/TableProducer/dptDptFilter.h @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -47,6 +48,7 @@ #include #include #include +#include #include namespace o2 @@ -84,7 +86,7 @@ enum SystemType { /// \std::map systemInternalCodesMap /// \brief maps system names to internal system codes -static const std::map systemInternalCodesMap{ +static const std::map systemInternalCodesMap{ {"", SystemNoSystem}, {"pp", SystemPp}, {"pPb", SystemPPb}, @@ -99,7 +101,7 @@ static const std::map systemInternalCodesMap{ /// \std::map systemExternalNamesMap /// \brief maps system internal codes to system external names -static const std::map systemExternalNamesMap{ +static const std::map systemExternalNamesMap{ {SystemNoSystem, ""}, {SystemPp, "pp"}, {SystemPPb, "pPb"}, @@ -140,7 +142,7 @@ enum CentMultEstimatorType { /// \std::map estimatorInternalCodesMap /// \brief maps centrality/multiplicity estimator names to internal estimator codes -static const std::map estimatorInternalCodesMap{ +static const std::map estimatorInternalCodesMap{ {"NOCM", CentMultNOCM}, {"V0M", CentMultV0M}, {"CL0", CentMultCL0}, @@ -153,7 +155,7 @@ static const std::map estimatorInternalCodesMap{ /// \std::map estimatorExternalNamesMap /// \brief maps internal estimator codes to centrality/multiplicity estimator external names -static const std::map estimatorExternalNamesMap{ +static const std::map estimatorExternalNamesMap{ {CentMultNOCM, "NOCM"}, {CentMultV0M, "V0M"}, {CentMultCL0, "CL0"}, @@ -216,7 +218,7 @@ static const std::map estimatorMultiplicitySourceMap{ /// \std::vector multiplicitySourceExternalNamesMap /// \brief maps internal multiplicity source to external names for the LHC runs -static const std::vector> multiplicitySourceExternalNamesMap{ +static const std::vector> multiplicitySourceExternalNamesMap{ /* Run 1 and Run 2 */ { {MultSourceT0A, "T0A multiplicity"}, @@ -225,7 +227,7 @@ static const std::vector> multiplicitySourceExternalN {MultSourceV0A, "V0A multiplicity"}, {MultSourceV0C, "V0C multiplicity"}, {MultSourceV0M, "V0M multiplicity"}, - {MultSourceNtracks, "Number of tracks"}, + {MultSourceNtracks, "Global tracks"}, {MultSourcePvContributors, "PV contributors"}}, /* Run 3 */ { @@ -235,22 +237,94 @@ static const std::vector> multiplicitySourceExternalN {MultSourceV0A, "FV0A multiplicity"}, {MultSourceV0C, "WRONG SOURCE"}, {MultSourceV0M, "FV0M multiplicity"}, - {MultSourceNtracks, "Number of tracks"}, + {MultSourceNtracks, "Global tracks"}, {MultSourcePvContributors, "PV contributors"}}}; /// \std::map multiplicitySourceConfigNamesMap /// \brief maps internal multiplicity source to external configuration names /// At configuration time neither the system nor the lhc run is known -static const std::map multiplicitySourceConfigNamesMap{ - {MultSourceT0A, "FT0A"}, - {MultSourceT0C, "FT0C"}, - {MultSourceT0M, "FT0M"}, - {MultSourceV0A, "FV0A"}, - {MultSourceV0C, "V0C"}, - {MultSourceV0M, "FV0M"}, - {MultSourceNtracks, "Number of tracks"}, +static const std::map multiplicitySourceConfigNamesMap{ + {MultSourceT0A, "FT0A (T0A)"}, + {MultSourceT0C, "FT0C (T0C)"}, + {MultSourceT0M, "FT0M (T0M)"}, + {MultSourceV0A, "FV0A (V0A)"}, + {MultSourceV0C, "WRONG (V0C)"}, + {MultSourceV0M, "FV0M (V0M)"}, + {MultSourceNtracks, "Global tracks"}, {MultSourcePvContributors, "PV contributors"}}; +/// \enum CentMultCorrelationsParams +/// \brief internal codes for the supported parameters for centrality/multiplicity correlations exclusion cuts +enum CentMultCorrelationsParams { + CentMultCorrelationsMT0A = 0, ///< multiplicity from T0A + CentMultCorrelationsMT0C, ///< multiplicity from T0C + CentMultCorrelationsMT0M, ///< multiplicity from T0M + CentMultCorrelationsMV0A, ///< multiplicity from V0A + CentMultCorrelationsMV0C, ///< multiplicity from V0C (only Run 1 & Run 2) + CentMultCorrelationsMV0M, ///< multiplicity from V0M + CentMultCorrelationsMNGLTRK, ///< multiplicity from number of global tracks + CentMultCorrelationsMNPVC, ///< multiplicity from number of PV contributors + CentMultCorrelationsCT0A, ///< centrality from T0A + CentMultCorrelationsCT0C, ///< centrality from T0C + CentMultCorrelationsCT0M, ///< centrality from T0M + CentMultCorrelationsCV0A, ///< centrality from V0A + CentMultCorrelationsCNTPV, ///< centrality from number of PV contributors + CentMultCorrelationsNOOFPARAMS ///< the number of parameters supported +}; + +/// @brief prefix increment operator +/// @param ipar value +/// @return the incremented value +inline CentMultCorrelationsParams& operator++(CentMultCorrelationsParams& ipar) +{ + return ipar = static_cast(static_cast(ipar) + 1); +} + +/// @brief postfix increment operator +/// @param ipar the value +/// @param empty +/// @return the same value +inline CentMultCorrelationsParams operator++(CentMultCorrelationsParams& ipar, int) +{ + CentMultCorrelationsParams iparTmp(ipar); + ++ipar; + return iparTmp; +} + +/// \std::map centMultCorrelationsParamsMap +/// \brief maps centrality/multiplicity correlations parameters names to internal codes +static const std::map centMultCorrelationsParamsMap{ + {"MT0A", CentMultCorrelationsMT0A}, + {"MT0C", CentMultCorrelationsMT0C}, + {"MT0M", CentMultCorrelationsMT0M}, + {"MV0A", CentMultCorrelationsMV0A}, + {"MV0C", CentMultCorrelationsMV0C}, + {"MV0M", CentMultCorrelationsMV0M}, + {"MNGLTRK", CentMultCorrelationsMNGLTRK}, + {"MNPVC", CentMultCorrelationsMNPVC}, + {"CT0A", CentMultCorrelationsCT0A}, + {"CT0C", CentMultCorrelationsCT0C}, + {"CT0M", CentMultCorrelationsCT0M}, + {"CV0A", CentMultCorrelationsCV0A}, + {"CNTPV", CentMultCorrelationsCNTPV}}; + +/// \std::map centMultCorrelationsParamsNamesMap +/// \brief maps centrality/multiplicity correlations parameters internal codes to their external names +static const std::map centMultCorrelationsParamsNamesMap{ + {CentMultCorrelationsMT0A, "MT0A"}, + {CentMultCorrelationsMT0C, "MT0C"}, + {CentMultCorrelationsMT0M, "MT0M"}, + {CentMultCorrelationsMV0A, "MV0A"}, + {CentMultCorrelationsMV0C, "MV0C"}, + {CentMultCorrelationsMV0M, "MV0M"}, + {CentMultCorrelationsMNGLTRK, "MNGLTRK"}, + {CentMultCorrelationsMNPVC, "MNPVC"}, + {CentMultCorrelationsCT0A, "CT0A"}, + {CentMultCorrelationsCT0C, "CT0C"}, + {CentMultCorrelationsCT0M, "CT0M"}, + {CentMultCorrelationsCV0A, "CV0A"}, + {CentMultCorrelationsCNTPV, "CNTPV"}}; + /// \enum TriggerSelectionTags /// \brief The potential trigger tags to apply for event selection enum TriggerSelectionTags { @@ -275,7 +349,7 @@ enum TriggerSelectionTags { /// \std::map triggerSelectionBitsMap /// \brief maps trigger selection tags to internal trigger selection bits -static const std::map triggerSelectionBitsMap{ +static const std::map triggerSelectionBitsMap{ {"none", TriggSelNONE}, {"mb", TriggSelMB}, {"nosamebunchpup", TriggSelNOSAMEBUNCHPUP}, @@ -295,7 +369,7 @@ static const std::map triggerSelectionBitsMap{ /// \std::map triggerSelectionExternalNamesMap /// \brief maps trigger selection bits to external names -static const std::map triggerSelectionExternalNamesMap{ +static const std::map triggerSelectionExternalNamesMap{ {TriggSelNONE, "none"}, {TriggSelMB, "Sel8"}, ///< Sel8 includes kIsTriggerTVX, kNoTimeFrameBorder, and kNoITSROFrameBorder {TriggSelNOSAMEBUNCHPUP, "No same bunch pileup"}, @@ -325,22 +399,23 @@ enum OccupancyEstimationType { /// \enum CollisionSelectionFlags /// \brief The different criteria for selecting/rejecting collisions enum CollisionSelectionFlags { - CollSelIN = 0, ///< new unhandled, yet, event - CollSelMBBIT, ///< minimum bias - CollSelINT7BIT, ///< INT7 Run 1/2 - CollSelSEL7BIT, ///< Sel7 Run 1/2 - CollSelTRIGGSELBIT, ///< Accepted by trigger selection - CollSelRCTBIT, ///< Accetped by the RCT information - CollSelOCCUPANCYBIT, ///< occupancy within limits - CollSelCENTRALITYBIT, ///< centrality cut passed - CollSelZVERTEXBIT, ///< zvtx cut passed - CollSelSELECTED, ///< the event has passed all selections - CollSelNOOFFLAGS ///< number of flags + CollSelIN = 0, ///< new unhandled, yet, event + CollSelMBBIT, ///< minimum bias + CollSelINT7BIT, ///< INT7 Run 1/2 + CollSelSEL7BIT, ///< Sel7 Run 1/2 + CollSelTRIGGSELBIT, ///< Accepted by trigger selection + CollSelRCTBIT, ///< Accetped by the RCT information + CollSelOCCUPANCYBIT, ///< occupancy within limits + CollSelCENTRALITYBIT, ///< centrality cut passed + CollSelZVERTEXBIT, ///< zvtx cut passed + CollSelMULTCORRELATIONS, ///< multiplicities correlations passed + CollSelSELECTED, ///< the event has passed all selections + CollSelNOOFFLAGS ///< number of flags }; /// \std::mag collisionSelectionExternalNamesMap /// \brief maps collision selection bits to external names -static const std::map collisionSelectionExternalNamesMap{ +static const std::map collisionSelectionExternalNamesMap{ {CollSelIN, "In"}, {CollSelMBBIT, "MB"}, {CollSelINT7BIT, "INT7"}, @@ -350,6 +425,7 @@ static const std::map collisionSelectionExternalNamesMap{ {CollSelOCCUPANCYBIT, "Occupancy"}, {CollSelCENTRALITYBIT, "Centrality"}, {CollSelZVERTEXBIT, "z vertex"}, + {CollSelMULTCORRELATIONS, "Multiplicities correlations"}, {CollSelSELECTED, "Selected"}}; /// \enum StrongDebugging @@ -385,6 +461,14 @@ std::bitset<32> collisionSelectionFlags; std::bitset<32> triggerFlags; std::bitset<32> triggerSelectionFlags; +//============================================================================================ +// The collision exclusion using correlations between multiplicity/centrality observables +//============================================================================================ +bool useCentralityMultiplicityCorrelationsExclusion = false; +std::vector collisionMultiplicityCentralityObservables = {}; +std::vector observableIndexForCentralityMultiplicityParameter = {}; +TFormula* multiplicityCentralityCorrelationsExclusion = nullptr; + //============================================================================================ // The input data metadata access helper //============================================================================================ @@ -736,17 +820,17 @@ float particleMaxDCAxy = 999.9f; float particleMaxDCAZ = 999.9f; bool traceCollId0 = false; -inline std::bitset<32> getTriggerSelection(std::string const& triggstr) +inline std::bitset<32> getTriggerSelection(std::string_view const& triggstr) { std::bitset<32> flags; auto split = [](const auto s) { - std::vector tokens; - std::string token; + std::vector tokens; + std::string_view token; size_t posStart = 0; size_t posEnd; - while ((posEnd = s.find("+", posStart)) != std::string::npos) { + while ((posEnd = s.find("+", posStart)) != std::string_view::npos) { token = s.substr(posStart, posEnd - posStart); posStart = posEnd + 1; tokens.push_back(token); @@ -755,13 +839,13 @@ inline std::bitset<32> getTriggerSelection(std::string const& triggstr) return tokens; }; - std::vector tags = split(triggstr); + std::vector tags = split(triggstr); for (const auto& tag : tags) { if (triggerSelectionBitsMap.contains(tag)) { flags.set(triggerSelectionBitsMap.at(tag), true); } else { - LOGF(fatal, "Wrong trigger selection tag: %s", tag.c_str()); + LOGF(fatal, "Wrong trigger selection tag: %s", tag.data()); } } return flags; @@ -770,15 +854,16 @@ inline std::bitset<32> getTriggerSelection(std::string const& triggstr) inline SystemType getSytemTypeFromMetaData() { auto period = metadataInfo.get("LPMProductionTag"); + auto anchoredPeriod = metadataInfo.get("AnchorProduction"); - if (period == "LHC25ad" || period == "LHC25g5") { - LOGF(info, "Configuring for p-O LHC25ad period"); + if (period == "LHC25ad" || anchoredPeriod == "LHC25ad") { + LOGF(info, "Configuring for p-O (anchored to) LHC25ad period"); return SystemPORun3; - } else if (period == "LHC25ae" || period == "LHC25g6") { - LOGF(info, "Configuring for O-O LHC25ae period"); + } else if (period == "LHC25ae" || anchoredPeriod == "LHC25ae") { + LOGF(info, "Configuring for O-O (anchored to) LHC25ae period"); return SystemOORun3; - } else if (period == "LHC25af" || period == "LHC25g7") { - LOGF(info, "Configuring for Ne-Ne LHC25af period"); + } else if (period == "LHC25af" || anchoredPeriod == "LHC25af") { + LOGF(info, "Configuring for Ne-Ne (anchored to) LHC25af period"); return SystemNeNeRun3; } else { LOGF(fatal, "DptDptCorrelations::getSystemTypeFromMetadata(). No automatic system type configuration for %s period", period.c_str()); @@ -786,7 +871,7 @@ inline SystemType getSytemTypeFromMetaData() return SystemPbPb; } -inline SystemType getSystemType(std::string const& sysstr) +inline SystemType getSystemType(std::string_view const& sysstr) { /* we have to figure out how extract the system type */ if (sysstr == "Auto") { @@ -797,7 +882,7 @@ inline SystemType getSystemType(std::string const& sysstr) if (systemInternalCodesMap.contains(sysstr)) { return static_cast(systemInternalCodesMap.at(sysstr)); } else { - LOGF(fatal, "DptDptCorrelations::getSystemType(). Wrong system type: %s", sysstr.c_str()); + LOGF(fatal, "DptDptCorrelations::getSystemType(). Wrong system type: %s", sysstr.data()); } } return SystemPbPb; @@ -825,17 +910,17 @@ inline DataType getDataType(std::string const& datastr) return kData; } -inline CentMultEstimatorType getCentMultEstimator(std::string const& datastr) +inline CentMultEstimatorType getCentMultEstimator(std::string_view const& datastr) { if (estimatorInternalCodesMap.contains(datastr)) { return static_cast(estimatorInternalCodesMap.at(datastr)); } else { - LOGF(fatal, "Centrality/Multiplicity estimator %s not supported yet", datastr.c_str()); + LOGF(fatal, "Centrality/Multiplicity estimator %s not supported yet", datastr.data()); } return CentMultNOCM; } -inline std::string getCentMultEstimatorName(CentMultEstimatorType est) +inline std::string_view getCentMultEstimatorName(CentMultEstimatorType est) { if (estimatorExternalNamesMap.contains(est)) { return estimatorExternalNamesMap.at(est); @@ -845,7 +930,7 @@ inline std::string getCentMultEstimatorName(CentMultEstimatorType est) return "WRONG"; } -inline OccupancyEstimationType getOccupancyEstimator(const std::string& estimator) +inline OccupancyEstimationType getOccupancyEstimator(const std::string_view& estimator) { if (estimator == "None") { return OccupancyNOOCC; @@ -854,11 +939,38 @@ inline OccupancyEstimationType getOccupancyEstimator(const std::string& estimato } else if (estimator == "FT0C") { return OccupancyFT0COCC; } else { - LOGF(fatal, "Occupancy estimator %s not supported yet", estimator.c_str()); + LOGF(fatal, "Occupancy estimator %s not supported yet", estimator.data()); return OccupancyNOOCC; } } +/// @brief gets the exclusion formula from the corresponding expression and initializes the exclusion machinery +/// @param std::string_view with the formula expression +/// @return the expression TFormula +inline TFormula* getExclusionFormula(std::string_view formula) +{ + if (formula.length() != 0) { + useCentralityMultiplicityCorrelationsExclusion = true; + TFormula* f = new TFormula("Exclussion expression", formula.data()); + int nParameters = f->GetNpar(); + collisionMultiplicityCentralityObservables.resize(CentMultCorrelationsNOOFPARAMS); + observableIndexForCentralityMultiplicityParameter.resize(nParameters); + LOGF(info, "Configuring outliers exclusion with the formula %s which has %d parameters", formula.data(), nParameters); + for (int iPar = 0; iPar < nParameters; ++iPar) { + if (centMultCorrelationsParamsMap.contains(std::string(f->GetParName(iPar)))) { + observableIndexForCentralityMultiplicityParameter[iPar] = centMultCorrelationsParamsMap.at(std::string(f->GetParName(iPar))); + LOGF(info, "\tAssigned observable %s with index %d to the parameter %s with parameter index %d", centMultCorrelationsParamsNamesMap.at(centMultCorrelationsParamsMap.at(std::string(f->GetParName(iPar)))).data(), static_cast(centMultCorrelationsParamsMap.at(std::string(f->GetParName(iPar)))), f->GetParName(iPar), iPar); + } else { + LOGF(fatal, "Exclusion expression contains parameter %s which is still not supported. Please, fix it!", f->GetParName(iPar)); + } + } + return f; + } else { + useCentralityMultiplicityCorrelationsExclusion = false; + return nullptr; + } +} + ////////////////////////////////////////////////////////////////////////////////// /// Trigger selection ////////////////////////////////////////////////////////////////////////////////// @@ -1172,6 +1284,25 @@ inline bool centralitySelection(aod::McCollision const&, float } } +/// @brief evalues the exclusion formula for the current multiplicity / centrality parameters +/// @return true if the collision is not excluded according to the formula false otherwise +/// WARNING: it has always to be called after filling the multiplicity / centrality observables +inline bool isCollisionNotExcluded() +{ + bool notExcluded = true; + if (useCentralityMultiplicityCorrelationsExclusion) { + [&]() { + /* set the formula parameter values */ + for (size_t iPar = 0; iPar < observableIndexForCentralityMultiplicityParameter.size(); ++iPar) { + multiplicityCentralityCorrelationsExclusion->SetParameter(iPar, collisionMultiplicityCentralityObservables[observableIndexForCentralityMultiplicityParameter[iPar]]); + } + }(); + notExcluded = multiplicityCentralityCorrelationsExclusion->Eval() != 0; + } + collisionFlags.set(CollSelMULTCORRELATIONS, notExcluded); + return notExcluded; +} + ////////////////////////////////////////////////////////////////////////////////// /// Occupancy selection ////////////////////////////////////////////////////////////////////////////////// @@ -1308,7 +1439,9 @@ inline bool isEventSelected(CollisionObject const& collision, float& centormult) bool centmultsel = centralitySelection(collision, centormult); - bool accepted = trigsel && rctsel && occupancysel && zvtxsel && centmultsel; + bool centmultexclusion = isCollisionNotExcluded(); + + bool accepted = trigsel && rctsel && occupancysel && zvtxsel && centmultsel && centmultexclusion; if (accepted) { collisionFlags.set(CollSelSELECTED); From 9c6e79da6e0b857368419d7d99402a6479dfdd7a Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Sun, 24 Aug 2025 00:41:56 +0200 Subject: [PATCH 173/986] [PWGLF] Store mass difference with respect to the PDG (#12710) --- .../Strangeness/strangenessderivedbinnedinfo.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx b/PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx index 728d8c6675b..55962630818 100644 --- a/PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx +++ b/PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx @@ -246,7 +246,7 @@ struct strangenessderivedbinnedinfo { ConfigurableAxis axisOccupancy{"axisOccupancy", {VARIABLE_WIDTH, 0.0f, 1000.0f, 3000.0f, 10000.0f, 30000.0f}, "Occupancy"}; // topological variable QA axes - ConfigurableAxis axisMass{"axisV0Mass", {25, 0.45, 0.55f}, "Invariant mass (GeV/#it{c}^{2})"}; + ConfigurableAxis axisMass{"axisV0Mass", {25, -0.05f, 0.05f}, "Invariant mass (GeV/#it{c}^{2})"}; ConfigurableAxis axisPhi{"axisPhi", {36, 0.0f, constants::math::TwoPI}, "#varphi (rad)"}; ConfigurableAxis axisEta{"axisEta", {10, -1.0f, 1.0f}, "Pseudo-rapidity #eta"}; ConfigurableAxis axisRadius{"axisRadius", {10, 0.0f, 250.0f}, "Decay radius (cm)"}; @@ -805,13 +805,13 @@ struct strangenessderivedbinnedinfo { float decayRadius = encodingOpts.useSqrtEncodingForRadius ? std::sqrt(v0.v0radius()) : v0.v0radius(); if (analyseK0Short && isV0Selected(v0, collision, v0.yK0Short())) { - histos.fill(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"), v0.mK0Short(), pT, v0.phi(), v0.eta(), v0.qtarm(), v0.alpha(), decayRadius, centrality, occupancy); + histos.fill(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"), v0.mK0Short() - o2::constants::physics::MassK0Short, pT, v0.phi(), v0.eta(), v0.qtarm(), v0.alpha(), decayRadius, centrality, occupancy); } if (analyseLambda && isV0Selected(v0, collision, v0.yLambda())) { - histos.fill(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"), v0.mLambda(), pT, v0.phi(), v0.eta(), v0.qtarm(), v0.alpha(), decayRadius, centrality, occupancy); + histos.fill(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"), v0.mLambda() - o2::constants::physics::MassLambda0, pT, v0.phi(), v0.eta(), v0.qtarm(), v0.alpha(), decayRadius, centrality, occupancy); } if (analyseAntiLambda && isV0Selected(v0, collision, v0.yLambda())) { - histos.fill(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"), v0.mAntiLambda(), pT, v0.phi(), v0.eta(), v0.qtarm(), v0.alpha(), decayRadius, centrality, occupancy); + histos.fill(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"), v0.mAntiLambda() - o2::constants::physics::MassLambda0, pT, v0.phi(), v0.eta(), v0.qtarm(), v0.alpha(), decayRadius, centrality, occupancy); } } // end v0 loop } @@ -827,10 +827,10 @@ struct strangenessderivedbinnedinfo { float decayRadius = encodingOpts.useSqrtEncodingForRadius ? std::sqrt(cascade.cascradius()) : cascade.cascradius(); if (analyseXi && isCascadeSelected(cascade, collision, cascade.yXi())) { - histos.fill(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"), cascade.m(1), pT, cascade.phi(), cascade.eta(), 0., 0., decayRadius, centrality, occupancy); + histos.fill(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"), cascade.m(1) - o2::constants::physics::MassXiMinus, pT, cascade.phi(), cascade.eta(), 0., 0., decayRadius, centrality, occupancy); } if (analyseOmega && isCascadeSelected(cascade, collision, cascade.yOmega())) { - histos.fill(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"), cascade.m(2), pT, cascade.phi(), cascade.eta(), 0., 0., decayRadius, centrality, occupancy); + histos.fill(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"), cascade.m(2) - o2::constants::physics::MassOmegaMinus, pT, cascade.phi(), cascade.eta(), 0., 0., decayRadius, centrality, occupancy); } } // end cascade loop } From c7ebcf6fc771c19f5b239cf592db1a6d326a3e59 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sun, 24 Aug 2025 02:08:49 +0200 Subject: [PATCH 174/986] [PWGEM/Dilepton] make axes configurable (#12715) --- PWGEM/Dilepton/Core/Dilepton.h | 8 +++++--- PWGEM/Dilepton/Core/DileptonMC.h | 20 +++++++++++--------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 569cf2950c3..8fd18e97c56 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -130,6 +130,8 @@ struct Dilepton { // ConfigurableAxis ConfMmumuBins{"ConfMmumuBins", {VARIABLE_WIDTH, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.50, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.70, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.80, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.00, 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.10, 1.11,1.12,1.13,1.14,1.15,1.16,1.17,1.18,1.19, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.10, 2.20, 2.30, 2.40, 2.50, 2.60, 2.70, 2.75, 2.80, 2.85, 2.90, 2.95, 3.00, 3.05, 3.10, 3.15, 3.20, 3.25, 3.30, 3.35, 3.40, 3.45, 3.50, 3.55, 3.60, 3.65, 3.70, 3.75, 3.80, 3.85, 3.90, 3.95, 4.00, 4.10, 4.20, 4.30, 4.40, 4.50, 4.60, 4.70, 4.80, 4.90, 5.00, 5.10, 5.20, 5.30, 5.40, 5.50, 5.60, 5.70, 5.80, 5.90, 6.00, 6.10, 6.20, 6.30, 6.40, 6.50, 6.60, 6.70, 6.80, 6.90, 7.00, 7.10, 7.20, 7.30, 7.40, 7.50, 7.60, 7.70, 7.80, 7.90, 8.00, 8.10, 8.20, 8.30, 8.40, 8.50, 8.60, 8.70, 8.80, 8.90, 9.00, 9.10, 9.20, 9.30, 9.40, 9.50, 9.60, 9.70, 9.80, 9.90, 10.00, 10.10, 10.20, 10.30, 10.40, 10.50, 10.60, 10.70, 10.80, 10.90, 11.00, 11.50, 12.00}, "mmumu bins for output histograms"}; // for dimuon. one can copy bins here to hyperloop page. ConfigurableAxis ConfSPBins{"ConfSPBins", {200, -5, 5}, "SP bins for flow analysis"}; + ConfigurableAxis ConfPolarizationPhiBins{"ConfPolarizationPhiBins", {6, 0.f, M_PI}, "phi bins for polarization analysis"}; + ConfigurableAxis ConfPolarizationCosThetaBins{"ConfPolarizationCosThetaBins", {5, 0.f, 1.f}, "phi bins for polarization analysis"}; EMEventCut fEMEventCut; struct : ConfigurableGroup { @@ -569,7 +571,7 @@ struct Dilepton { const AxisSpec axis_aco{10, 0, 1.f, "#alpha = 1 - #frac{|#varphi_{l^{+}} - #varphi_{l^{-}}|}{#pi}"}; const AxisSpec axis_asym_pt{10, 0, 1.f, "A = #frac{|p_{T,l^{+}} - p_{T,l^{-}}|}{|p_{T,l^{+}} + p_{T,l^{-}}|}"}; const AxisSpec axis_dphi_e_ee{18, 0, M_PI, "#Delta#varphi = #varphi_{l} - #varphi_{ll} (rad.)"}; - const AxisSpec axis_cos_theta_cs{10, 0.f, 1.f, "|cos(#theta_{CS})|"}; + const AxisSpec axis_cos_theta_cs{ConfPolarizationCosThetaBins, "|cos(#theta^{CS})|"}; fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_cos_theta_cs}, true); fRegistry.addClone("Pair/same/uls/", "Pair/same/lspp/"); fRegistry.addClone("Pair/same/uls/", "Pair/same/lsmm/"); @@ -592,8 +594,8 @@ struct Dilepton { fRegistry.addClone("Pair/mix/uls/", "Pair/mix/lsmm/"); } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kPolarization)) { - const AxisSpec axis_cos_theta_cs{10, 0.f, 1.f, "|cos(#theta_{CS})|"}; - const AxisSpec axis_phi_cs{10, 0.f, M_PI, "|#varphi_{CS}| (rad.)"}; + const AxisSpec axis_cos_theta_cs{ConfPolarizationCosThetaBins, "|cos(#theta^{CS})|"}; + const AxisSpec axis_phi_cs{ConfPolarizationPhiBins, "|#varphi^{CS}| (rad.)"}; fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y, axis_cos_theta_cs, axis_phi_cs}, true); fRegistry.addClone("Pair/same/uls/", "Pair/same/lspp/"); fRegistry.addClone("Pair/same/uls/", "Pair/same/lsmm/"); diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index 4536d03cb88..c7c073516ec 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -117,13 +117,15 @@ struct DileptonMC { // ConfigurableAxis ConfMmumuBins{"ConfMmumuBins", {VARIABLE_WIDTH, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.50, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.70, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.80, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.00, 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.10, 1.11,1.12,1.13,1.14,1.15,1.16,1.17,1.18,1.19, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.10, 2.20, 2.30, 2.40, 2.50, 2.60, 2.70, 2.75, 2.80, 2.85, 2.90, 2.95, 3.00, 3.05, 3.10, 3.15, 3.20, 3.25, 3.30, 3.35, 3.40, 3.45, 3.50, 3.55, 3.60, 3.65, 3.70, 3.75, 3.80, 3.85, 3.90, 3.95, 4.00, 4.10, 4.20, 4.30, 4.40, 4.50, 4.60, 4.70, 4.80, 4.90, 5.00, 5.10, 5.20, 5.30, 5.40, 5.50, 5.60, 5.70, 5.80, 5.90, 6.00, 6.10, 6.20, 6.30, 6.40, 6.50, 6.60, 6.70, 6.80, 6.90, 7.00, 7.10, 7.20, 7.30, 7.40, 7.50, 7.60, 7.70, 7.80, 7.90, 8.00, 8.10, 8.20, 8.30, 8.40, 8.50, 8.60, 8.70, 8.80, 8.90, 9.00, 9.10, 9.20, 9.30, 9.40, 9.50, 9.60, 9.70, 9.80, 9.90, 10.00, 10.10, 10.20, 10.30, 10.40, 10.50, 10.60, 10.70, 10.80, 10.90, 11.00, 11.50, 12.00}, "mmumu bins for output histograms"}; // for dimuon. one can copy bins here to hyperloop page. - Configurable cfg_nbin_dphi_ee{"cfg_nbin_dphi_ee", 1, "number of bins for dphi_ee"}; // 36 - Configurable cfg_nbin_deta_ee{"cfg_nbin_deta_ee", 1, "number of bins for deta_ee"}; // 40 - Configurable cfg_nbin_cos_theta_cs{"cfg_nbin_cos_theta_cs", 1, "number of bins for cos theta cs"}; // 10 - Configurable cfg_nbin_phi_cs{"cfg_nbin_phi_cs", 1, "number of bins for phi cs"}; // 10 - Configurable cfg_nbin_aco{"cfg_nbin_aco", 1, "number of bins for acoplanarity"}; // 10 - Configurable cfg_nbin_asym_pt{"cfg_nbin_asym_pt", 1, "number of bins for pt asymmetry"}; // 10 - Configurable cfg_nbin_dphi_e_ee{"cfg_nbin_dphi_e_ee", 1, "number of bins for dphi_ee_e"}; // 18 + Configurable cfg_nbin_dphi_ee{"cfg_nbin_dphi_ee", 1, "number of bins for dphi_ee"}; // 36 + Configurable cfg_nbin_deta_ee{"cfg_nbin_deta_ee", 1, "number of bins for deta_ee"}; // 40 + // Configurable cfg_nbin_cos_theta_cs{"cfg_nbin_cos_theta_cs", 1, "number of bins for cos theta cs"}; // 10 + // Configurable cfg_nbin_phi_cs{"cfg_nbin_phi_cs", 1, "number of bins for phi cs"}; // 10 + Configurable cfg_nbin_aco{"cfg_nbin_aco", 1, "number of bins for acoplanarity"}; // 10 + Configurable cfg_nbin_asym_pt{"cfg_nbin_asym_pt", 1, "number of bins for pt asymmetry"}; // 10 + Configurable cfg_nbin_dphi_e_ee{"cfg_nbin_dphi_e_ee", 1, "number of bins for dphi_ee_e"}; // 18 + ConfigurableAxis ConfPolarizationPhiBins{"ConfPolarizationPhiBins", {6, 0.f, M_PI}, "phi bins for polarization analysis"}; + ConfigurableAxis ConfPolarizationCosThetaBins{"ConfPolarizationCosThetaBins", {5, 0.f, 1.f}, "phi bins for polarization analysis"}; EMEventCut fEMEventCut; struct : ConfigurableGroup { @@ -353,8 +355,8 @@ struct DileptonMC { const AxisSpec axis_dphi_ee{cfg_nbin_dphi_ee, -M_PI / 2., 3. / 2. * M_PI, "#Delta#varphi = #varphi_{l1} - #varphi_{l2} (rad.)"}; // for kHFll const AxisSpec axis_deta_ee{cfg_nbin_deta_ee, -2., 2., "#Delta#eta = #eta_{l1} - #eta_{l2}"}; // for kHFll - const AxisSpec axis_cos_theta_cs{cfg_nbin_cos_theta_cs, 0.f, 1.f, "|cos(#theta_{CS})|"}; // for kPolarization, kUPC - const AxisSpec axis_phi_cs{cfg_nbin_phi_cs, 0.f, M_PI, "|#varphi_{CS}| (rad.)"}; // for kPolarization + const AxisSpec axis_cos_theta_cs{ConfPolarizationCosThetaBins, "|cos(#theta^{CS})|"}; // for kPolarization, kUPC + const AxisSpec axis_phi_cs{ConfPolarizationPhiBins, "|#varphi^{CS}| (rad.)"}; // for kPolarization const AxisSpec axis_aco{cfg_nbin_aco, 0, 1.f, "#alpha = 1 - #frac{|#varphi_{l^{+}} - #varphi_{l^{-}}|}{#pi}"}; // for kUPC const AxisSpec axis_asym_pt{cfg_nbin_asym_pt, 0, 1.f, "A = #frac{|p_{T,l^{+}} - p_{T,l^{-}}|}{|p_{T,l^{+}} + p_{T,l^{-}}|}"}; // for kUPC const AxisSpec axis_dphi_e_ee{cfg_nbin_dphi_e_ee, 0, M_PI, "#Delta#varphi = #varphi_{l} - #varphi_{ll} (rad.)"}; // for kUPC From d509f338034834a2baef8d7e6a78e7aea453feaa Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Sun, 24 Aug 2025 10:03:08 +0530 Subject: [PATCH 175/986] [PWGLF] Optimised code (#12712) Co-authored-by: Sawan Sawan --- PWGLF/Tasks/Resonances/kstarqa.cxx | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarqa.cxx b/PWGLF/Tasks/Resonances/kstarqa.cxx index 176cfc117c4..d79acff1261 100644 --- a/PWGLF/Tasks/Resonances/kstarqa.cxx +++ b/PWGLF/Tasks/Resonances/kstarqa.cxx @@ -85,6 +85,7 @@ struct Kstarqa { Configurable isNoTimeFrameBorder{"isNoTimeFrameBorder", true, "kNoTimeFrameBorder"}; Configurable isNoITSROFrameBorder{"isNoITSROFrameBorder", true, "kNoITSROFrameBorder"}; Configurable isApplyParticleMID{"isApplyParticleMID", true, "Apply particle misidentification"}; + Configurable checkVzEvSigLoss{"checkVzEvSigLoss", false, "Check Vz event signal loss"}; Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; Configurable configOccCut{"configOccCut", 1000., "Occupancy cut"}; @@ -328,7 +329,8 @@ struct Kstarqa { hInvMass.add("hAllRecCollisions", "All reconstructed events", kTH1F, {multiplicityAxis}); hInvMass.add("hAllRecCollisionsCalib", "All reconstructed events", kTH1F, {multiplicityAxis}); hInvMass.add("MCcorrections/hImpactParameterRec", "Impact parameter in reconstructed MC", kTH1F, {impactParAxis}); - hInvMass.add("MCcorrections/MultiplicityRec", "Multiplicity in reconstructed MC", kTH1F, {multiplicityAxis}); + hInvMass.add("MCcorrections/MultiplicityRec", "Multiplicity in generated MC with at least 1 reconstruction", kTH1F, {multiplicityAxis}); + hInvMass.add("MCcorrections/MultiplicityRec2", "Multiplicity in reconstructed MC", kTH1F, {multiplicityAxis}); hInvMass.add("MCcorrections/hImpactParameterGen", "Impact parameter in generated MC", kTH1F, {impactParAxis}); hInvMass.add("MCcorrections/MultiplicityGen", "Multiplicity in generated MC", kTH1F, {multiplicityAxis}); hInvMass.add("MCcorrections/hImpactParametervsMultiplicity", "Impact parameter vs multiplicity in reconstructed MC", kTH2F, {{impactParAxis}, {multiplicityAxis}}); @@ -1639,18 +1641,27 @@ struct Kstarqa { return; } + if (selectionConfig.checkVzEvSigLoss && (std::abs(mcCollision.posZ()) >= selectionConfig.cutzvertex)) { + return; + } + auto impactPar = mcCollision.impactParameter(); - multiplicity = -1; - multiplicity = mcCollision.centFT0M(); + auto multiplicityRec = -1; + auto multiplicityGen = -1; + multiplicityGen = mcCollision.centFT0M(); hInvMass.fill(HIST("MCcorrections/hImpactParameterGen"), impactPar); - hInvMass.fill(HIST("MCcorrections/MultiplicityGen"), multiplicity); + hInvMass.fill(HIST("MCcorrections/MultiplicityGen"), multiplicityGen); bool isSelectedEvent = false; auto multiplicity1 = -999.; for (const auto& RecCollision : recCollisions) { + if (!RecCollision.has_mcCollision()) + continue; if (!selectionEvent(RecCollision, false)) continue; // multiplicity1 = RecCollision.centFT0M(); + const auto& mcCollisionRec = RecCollision.mcCollision_as(); + multiplicityRec = mcCollisionRec.centFT0M(); if (cSelectMultEstimator == kFT0M) { multiplicity1 = RecCollision.centFT0M(); @@ -1670,7 +1681,8 @@ struct Kstarqa { // Event loss if (isSelectedEvent) { hInvMass.fill(HIST("MCcorrections/hImpactParameterRec"), impactPar); - hInvMass.fill(HIST("MCcorrections/MultiplicityRec"), multiplicity); + hInvMass.fill(HIST("MCcorrections/MultiplicityRec"), multiplicityGen); + hInvMass.fill(HIST("MCcorrections/MultiplicityRec2"), multiplicityRec); hInvMass.fill(HIST("MCcorrections/hImpactParametervsMultiplicity"), impactPar, multiplicity1); } @@ -1680,9 +1692,9 @@ struct Kstarqa { continue; // signal loss estimation - hInvMass.fill(HIST("MCcorrections/hSignalLossDenominator"), mcPart.pt(), multiplicity); + hInvMass.fill(HIST("MCcorrections/hSignalLossDenominator"), mcPart.pt(), multiplicityGen); if (isSelectedEvent) { - hInvMass.fill(HIST("MCcorrections/hSignalLossNumerator"), mcPart.pt(), multiplicity); + hInvMass.fill(HIST("MCcorrections/hSignalLossNumerator"), mcPart.pt(), multiplicityGen); } } // end loop on gen particles } From e0dcdfa08fc5ac1668ff2bb8ca7c7fb9e74e25e5 Mon Sep 17 00:00:00 2001 From: omvazque Date: Sun, 24 Aug 2025 04:44:12 -0500 Subject: [PATCH 176/986] [PWGLF] RAA light ions (#12717) --- PWGLF/Tasks/Nuspex/CMakeLists.txt | 5 + PWGLF/Tasks/Nuspex/piKpRAA.cxx | 781 ++++++++++++++++++++++++++++++ 2 files changed, 786 insertions(+) create mode 100644 PWGLF/Tasks/Nuspex/piKpRAA.cxx diff --git a/PWGLF/Tasks/Nuspex/CMakeLists.txt b/PWGLF/Tasks/Nuspex/CMakeLists.txt index cc23b8d0544..8f134d60175 100644 --- a/PWGLF/Tasks/Nuspex/CMakeLists.txt +++ b/PWGLF/Tasks/Nuspex/CMakeLists.txt @@ -155,4 +155,9 @@ o2physics_add_dpl_workflow(dedx-pid-analysis PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(pikp-raa-analysis + SOURCES piKpRAA.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + endif() diff --git a/PWGLF/Tasks/Nuspex/piKpRAA.cxx b/PWGLF/Tasks/Nuspex/piKpRAA.cxx new file mode 100644 index 00000000000..9df38d8eb36 --- /dev/null +++ b/PWGLF/Tasks/Nuspex/piKpRAA.cxx @@ -0,0 +1,781 @@ +// 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 piKpRAA.cxx + +#include "PWGLF/DataModel/LFStrangenessTables.h" + +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/CCDB/TriggerAliases.h" +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/TrackSelectionDefaults.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CommonConstants/MathConstants.h" +#include "CommonConstants/ZDCConstants.h" +#include "DataFormatsParameters/GRPLHCIFData.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "Framework/ASoAHelpers.h" // required for Filter op. +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/GlobalTrackID.h" +#include "ReconstructionDataFormats/Track.h" +#include + +#include "TPDGCode.h" +#include "TVector3.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::aod::evsel; +using namespace o2::constants::math; +using namespace o2::framework::expressions; + +using ColEvSels = soa::Join; +using BCsRun3 = soa::Join; +using TracksFull = soa::Join; + +struct piKpRAA { + + static constexpr float kZero{0.}; + static constexpr float kOne{1.}; + static constexpr float kMinCharge{3.f}; + + static constexpr float DefaultLifetimeCuts[1][2] = {{30., 20.}}; + Configurable> lifetimecut{"lifetimecut", {DefaultLifetimeCuts[0], 2, {"lifetimecutLambda", "lifetimecutK0S"}}, "lifetimecut"}; + + struct : ConfigurableGroup { + Configurable v0TypeSelection{"v0TypeSelection", 1, "select on a certain V0 type (leave negative if no selection desired)"}; + + // Selection criteria: acceptance + Configurable rapidityCut{"rapidityCut", 0.5, "rapidity"}; + Configurable minEtaDaughter{"minEtaDaughter", -0.8, "Daughter minimum-eta selection"}; + Configurable maxEtaDaughter{"maxEtaDaughter", +0.8, "Daughter maximum-eta selection"}; + Configurable minPt{"minPt", 0.15, "minimum pt of the tracks"}; + Configurable maxPt{"maxPt", 20.0, "maximum pt of the tracks"}; + + // Standard 5 topological criteria + Configurable v0cospa{"v0cospa", 0.995, "min V0 CosPA"}; + Configurable dcav0dau{"dcav0dau", 1.0, "max DCA V0 Daughters (cm)"}; + Configurable dcanegtopv{"dcanegtopv", .1, "min DCA Neg To PV (cm)"}; + Configurable dcapostopv{"dcapostopv", .1, "min DCA Pos To PV (cm)"}; + Configurable v0radius{"v0radius", 1.2, "minimum V0 radius (cm)"}; + Configurable v0radiusMax{"v0radiusMax", 1E5, "maximum V0 radius (cm)"}; + + // Additional selection on the AP plot (exclusive for K0Short) + // original equation: lArmPt*5>TMath::Abs(lArmAlpha) + Configurable armPodCut{"armPodCut", 5.0f, "pT * (cut) > |alpha|, AP cut. Negative: no cut"}; + + // Selection + Configurable applyInvMassSel{"applyInvMassSel", true, "Select V0s close to the Inv. mass value"}; + Configurable minMassK0s{"minMassK0", 0.4f, "Min. Inv. Mass K0"}; + Configurable maxMassK0s{"maxMassK0", 0.6f, "Max. Inv. Mass K0"}; + Configurable minMassLambda{"minMassLambda", 1.1f, "Min. Inv. Mass Lambda"}; + Configurable maxMassLambda{"maxMassLambda", 1.2f, "Max. Inv. Mass Lambda"}; + Configurable minMassGamma{"minMassGamma", 0.000922f, "Min. Inv. Mass Gamma"}; + Configurable maxMassGamma{"maxMassGamma", 0.002022f, "Max. Inv. Mass Gamma"}; + + // PID (TPC/TOF) + Configurable tpcPidNsigmaCut{"tpcPidNsigmaCut", 5, "tpcPidNsigmaCut"}; + + } v0Selections; + + // Configurables Event Selection + Configurable isNoCollInTimeRangeStrict{"isNoCollInTimeRangeStrict", true, "use isNoCollInTimeRangeStrict?"}; + Configurable isNoCollInTimeRangeStandard{"isNoCollInTimeRangeStandard", false, "use isNoCollInTimeRangeStandard?"}; + Configurable isNoCollInRofStrict{"isNoCollInRofStrict", true, "use isNoCollInRofStrict?"}; + Configurable isNoCollInRofStandard{"isNoCollInRofStandard", false, "use isNoCollInRofStandard?"}; + Configurable isNoHighMultCollInPrevRof{"isNoHighMultCollInPrevRof", true, "use isNoHighMultCollInPrevRof?"}; + Configurable isNoCollInTimeRangeNarrow{"isNoCollInTimeRangeNarrow", false, "use isNoCollInTimeRangeNarrow?"}; + Configurable isOccupancyCut{"isOccupancyCut", true, "Occupancy cut?"}; + Configurable isApplyFT0CbasedOccupancy{"isApplyFT0CbasedOccupancy", false, "T0C Occu cut"}; + Configurable useMidRapNchSel{"useMidRapNchSel", true, "Use mid-rapidit Nch selection"}; + Configurable skipRecoColGTOne{"skipRecoColGTOne", true, "Remove collisions if reconstructed more than once"}; + Configurable detector4Calibration{"detector4Calibration", "T0M", "Detector for nSigma-Nch rejection"}; + + // Event selection + Configurable posZcut{"posZcut", +10.0, "z-vertex position cut"}; + Configurable minT0CcentCut{"minT0CcentCut", 0.0, "Min T0C Cent. cut"}; + Configurable maxT0CcentCut{"maxT0CcentCut", 100.0, "Max T0C Cent. cut"}; + Configurable minOccCut{"minOccCut", 0., "min Occu cut"}; + Configurable maxOccCut{"maxOccCut", 500., "max Occu cut"}; + + ConfigurableAxis binsPtPhiCut{"binsPtPhiCut", {VARIABLE_WIDTH, 0.0, 0.6, 0.8, 1.0, 1.4, 1.8, 2.2, 2.6, 3.0, 3.5, 4.0, 5.0, 7.0, 10.0, 15.0, 20.0, 25.0, 30.0, 40.0, 45.0, 50.0}, "pT"}; + ConfigurableAxis binsPtV0s{"binsPtV0s", {VARIABLE_WIDTH, 0.0, 0.15, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.5, 3.0, 3.5, 4.0, 5.0, 7.0, 9.0, 12.0, 15.0, 20.0, 25.0, 30.0, 35.0, 40.0, 45.0, 50.0}, "pT"}; + ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.12}, "pT binning"}; + ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0., 10., 20., 30., 40., 50., 60., 70., 80., 90., 100.}, "T0C binning"}; + ConfigurableAxis axisArmAlpha{"axisArmAlpha", {200, -1.0, 1.0}, "Armenteros alpha"}; + ConfigurableAxis axisArmqT{"axisArmqT", {200, 0.0f, 0.3f}, "Armenteros qT"}; + ConfigurableAxis axisK0Mass{"axisK0Mass", {200, 0.4f, 0.6f}, "Mass K0Short"}; + ConfigurableAxis axisLambdaMass{"axisLambdaMass", {200, 1.101f, 1.131f}, "Mass Lambda"}; + ConfigurableAxis axisGammaMass{"axisGammaMass", {200, 0.0f, 0.5f}, "Mass Gamma"}; + ConfigurableAxis axisNsigmaTPC{"axisNsigmaTPC", {200, -10.0f, 10.0f}, "N sigma TPC"}; + ConfigurableAxis axisdEdx{"axisdEdx", {140, 20.0, 160.0}, "dEdx binning"}; + + // CCDB paths + Configurable paTHEff{"paTHEff", "Users/o/omvazque/MCcorrection/perTimeStamp/TrackingEff", "base path to the ccdb object"}; + Configurable paTHFD{"paTHFD", "Users/o/omvazque/MCcorrection/perTimeStamp/FeedDown", "base path to the ccdb object"}; + Configurable paTHmeanNch{"paTHmeanNch", "Users/o/omvazque/FitMeanNch_9May2025", "base path to the ccdb object"}; + Configurable paTHsigmaNch{"paTHsigmaNch", "Users/o/omvazque/FitSigmaNch_9May2025", "base path to the ccdb object"}; + Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; + + enum EvCutLabel { + All = 1, + SelEigth, + NoSameBunchPileup, + IsGoodZvtxFT0vsPV, + NoCollInTimeRangeStrict, + NoCollInTimeRangeStandard, + NoCollInRofStrict, + NoCollInRofStandard, + NoHighMultCollInPrevRof, + NoCollInTimeRangeNarrow, + OccuCut, + Centrality, + VtxZ, + Zdc, + TZero, + Tdc, + Zem + }; + + HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + Service ccdb; + + struct Config { + TH2F* hEfficiency = nullptr; + TH2F* hFeedDown = nullptr; + bool correctionsLoaded = false; + } cfg; + + struct NchConfig { + TH1F* hMeanNch = nullptr; + TH1F* hSigmaNch = nullptr; + bool calibrationsLoaded = false; + } cfgNch; + + TrackSelection trkSelDaugthers; + TrackSelection trkSelGlobal; + TrackSelection trkSelDaugthersV0s() + { + TrackSelection selectedTracks; + selectedTracks.SetEtaRange(-0.8f, 0.8f); + selectedTracks.SetMinNCrossedRowsTPC(70); + return selectedTracks; + } + + void + init(InitContext const&) + { + + trkSelDaugthers = trkSelDaugthersV0s(); + trkSelGlobal = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSibAny, TrackSelection::GlobalTrackRun3DCAxyCut::Default); + + // define axes you want to use + const AxisSpec axisZpos{48, -12., 12., "Vtx_{z} (cm)"}; + const AxisSpec axisEvent{14, 0.5, 14.5, ""}; + const AxisSpec axisEta{40, -1., +1., "#eta"}; + const AxisSpec axisPt{binsPt, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec axisPtPhiCut{binsPtPhiCut, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec axisPtV0s{binsPtV0s, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec axisCent{binsCent, "T0C centrality"}; + + registry.add("EventCounter", ";;Events", kTH1F, {axisEvent}); + + auto hstat = registry.get(HIST("EventCounter")); + auto* x = hstat->GetXaxis(); + x->SetBinLabel(1, "All"); + x->SetBinLabel(2, "SelEigth"); + x->SetBinLabel(3, "NoSameBunchPileup"); + x->SetBinLabel(4, "GoodZvtxFT0vsPV"); + x->SetBinLabel(5, "NoCollInTimeRangeStrict"); + x->SetBinLabel(6, "NoCollInTimeRangeStandard"); + x->SetBinLabel(7, "NoCollInRofStrict"); + x->SetBinLabel(8, "NoCollInRofStandard"); + x->SetBinLabel(9, "NoHighMultCollInPrevRof"); + x->SetBinLabel(10, "NoCollInTimeRangeNarrow"); + x->SetBinLabel(11, "Occupancy Cut"); + x->SetBinLabel(12, "Cent. Sel."); + x->SetBinLabel(13, "VtxZ cut"); + + if (doprocessCalibrationAndV0s) { + registry.add("zPos", ";;Entries;", kTH1F, {axisZpos}); + registry.add("T0Ccent", ";;Entries", kTH1F, {axisCent}); + + registry.add("dcaDauVsPt", ";V0 #it{p}_{T} (GeV/#it{c});DCA_{xy} (cm) daughters;", kTH2F, {{{axisPtV0s}, {200, -10., 10.}}}); + registry.add("nSigmaPiFromK0", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); + registry.add("nSigmaPiFromLambda", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); + registry.add("nSigmaPrFromLambda", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); + registry.add("nSigmaPiFromAntiLambda", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); + registry.add("nSigmaPrFromAntiLambda", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); + registry.add("nSigmaElFromGammaConv", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); + registry.add("ArmAll", "Armenteros-Podolanski;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); + registry.add("ArmAfterTopoSel", "Armenteros-Podolanski anfter topological selection;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); + registry.add("ArmK0NOSel", "Armenteros-Podolanski WITH OUT 5 #times q_{T} > #alpha selection;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); + registry.add("ArmK0", "Armenteros-Podolanski WITH 5 #times q_{T} > #alpha selection;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); + registry.add("ArmLambda", "Armenteros-Podolanski;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); + registry.add("ArmAntiLambda", "Armenteros-Podolanski;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); + registry.add("ArmGamma", "Armenteros-Podolanski;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); + registry.add("MassK0ShortVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {axisPtV0s, axisK0Mass}); + registry.add("MassLambdaVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {axisPtV0s, axisLambdaMass}); + registry.add("MassAntiLambdaVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {axisPtV0s, axisLambdaMass}); + registry.add("MassGammaVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {axisPtV0s, axisGammaMass}); + registry.add("dEdxPiPos", ";Momentum (GeV/#it{c}); dE/dx", kTH2F, {axisPtV0s, axisdEdx}); + registry.add("dEdxPiNeg", ";Momentum (GeV/#it{c}); dE/dx", kTH2F, {axisPtV0s, axisdEdx}); + registry.add("dEdxPrPos", ";Momentum (GeV/#it{c}); dE/dx", kTH2F, {axisPtV0s, axisdEdx}); + registry.add("dEdxPrNeg", ";Momentum (GeV/#it{c}); dE/dx", kTH2F, {axisPtV0s, axisdEdx}); + registry.add("dEdxEl", ";Momentum (GeV/#it{c}); dE/dx", kTH2F, {axisPtV0s, axisdEdx}); + + registry.add("NclFindableVsPt", ";#it{p}_{T} (GeV/#it{c}); Ncl TPC", kTH2F, {{{axisPtV0s}, {160, 0, 160}}}); + registry.add("NclFindableVsPtp", ";#it{p}_{T} (GeV/#it{c}); #LTNcl#GT TPC", kTProfile, {axisPtV0s}); + registry.add("NclFoundVsPt", ";#it{p}_{T} (GeV/#it{c}); Ncl TPC", kTH2F, {{{axisPtV0s}, {160, 0, 160}}}); + registry.add("NclFoundVsPtp", ";#it{p}_{T} (GeV/#it{c}); #LTNcl#GT TPC", kTProfile, {axisPtV0s}); + registry.add("NclFindableMinusFoundVsPt", ";#it{p}_{T} (GeV/#it{c}); Ncl TPC", kTH2F, {{{axisPtV0s}, {21, -0.5, 20.5}}}); + registry.add("NclFindableMinusFoundVsPtp", ";#it{p}_{T} (GeV/#it{c}); #LTNcl#GT TPC", kTProfile, {axisPtV0s}); + registry.add("NclFoundVsPtVsPhip", "", kTProfile2D, {{{axisPtPhiCut}, {350, 0.0, 0.35}}}); + registry.add("NclVsEta", ";#eta; Ncl TPC", kTH2F, {{{axisEta}, {160, 0, 160}}}); + registry.add("dEdxVsMomentum", ";Momentum (GeV/#it{c}); dE/dx", kTH2F, {axisPtV0s, axisdEdx}); + registry.add("dEdxVsEtaPiMIP", ";#eta; dE/dx MIP Pions (0.4 < #it{p} < 0.6 GeV/#it{c})", kTH2F, {{{axisEta}, {50, 20, 70}}}); + registry.add("dEdxVsEtaPiMIPp", ";#eta; #LTdE/dx#GT MIP Pions", kTProfile, {axisEta}); + } + + LOG(info) << "\tccdbNoLaterThan=" << ccdbNoLaterThan.value; + LOG(info) << "\tpaTHEff=" << paTHEff.value; + LOG(info) << "\tpaTHFD=" << paTHFD.value; + LOG(info) << "\tuseMidRapNchSel=" << useMidRapNchSel.value; + LOG(info) << "\tdetector4Calibration=" << detector4Calibration.value; + LOG(info) << "\tpaTHmeanNch=" << paTHmeanNch.value; + LOG(info) << "\tpaTHsigmaNch=" << paTHsigmaNch.value; + LOG(info) << "\tminPt=" << v0Selections.minPt; + LOG(info) << "\tmaxPt=" << v0Selections.maxPt; + + ccdb->setURL("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setFatalWhenNull(false); + ccdb->setCreatedNotAfter(ccdbNoLaterThan.value); + } + + void processCalibrationAndV0s(ColEvSels::iterator const& collision, BCsRun3 const& /**/, aod::V0Datas const& v0s, aod::FV0As const& /**/, aod::FT0s const& /**/, TracksFull const& tracks) + { + // LOG(info) << " Collisions size: " << collisions.size() << " + // Table's size: " << collisions.tableSize() << "\n"; + // LOG(info) << "Run number: " << foundBC.runNumber() << "\n"; + if (!isEventSelected(collision)) { + return; + } + + const auto& foundBC = collision.foundBC_as(); + uint64_t timeStamp{foundBC.timestamp()}; + const int magField{getMagneticField(timeStamp)}; + + registry.fill(HIST("zPos"), collision.posZ()); + registry.fill(HIST("T0Ccent"), collision.centFT0C()); + + for (const auto& track : tracks) { + + if (!trkSelGlobal.IsSelected(track)) + continue; + + if (track.pt() < v0Selections.minPt || track.pt() > v0Selections.maxPt) + continue; + + const float momentum{track.p()}; + const float pt{track.pt()}; + const float phi{track.phi()}; + const float eta{track.eta()}; + const float dedx{track.tpcSignal()}; + + if (momentum > 0.4 && momentum < 0.6 && dedx < 65.0) { + registry.fill(HIST("dEdxVsEtaPiMIP"), eta, dedx); + registry.fill(HIST("dEdxVsEtaPiMIPp"), eta, dedx); + } + + registry.fill(HIST("NclFindableVsPt"), pt, track.tpcNClsFindable()); + registry.fill(HIST("NclFindableVsPtp"), pt, track.tpcNClsFindable()); + registry.fill(HIST("NclFoundVsPt"), pt, track.tpcNClsFound()); + registry.fill(HIST("NclFoundVsPtp"), pt, track.tpcNClsFound()); + registry.fill(HIST("NclFindableMinusFoundVsPt"), pt, track.tpcNClsFindableMinusFound()); + registry.fill(HIST("NclFindableMinusFoundVsPtp"), pt, track.tpcNClsFindableMinusFound()); + registry.fill(HIST("NclVsEta"), eta, track.tpcNClsFound()); + + float phiPrime{phi}; + const int charge{track.sign()}; + PhiPrime(phiPrime, magField, charge); + registry.fill(HIST("NclFoundVsPtVsPhip"), pt, phiPrime, track.tpcNClsFound()); + + registry.fill(HIST("dEdxVsMomentum"), momentum, dedx); + } + + for (const auto& v0 : v0s) { + + // Select V0 type + if (v0.v0Type() != v0Selections.v0TypeSelection) + continue; + + // Positive-(negative-)charged tracks (daughters) + const auto& posTrack = v0.posTrack_as(); + const auto& negTrack = v0.negTrack_as(); + + if (posTrack.sign() == negTrack.sign()) + continue; + + if (!(passesTrackSelectionDaughters(posTrack) && passesTrackSelectionDaughters(negTrack))) + continue; + + const TVector3 ppos(posTrack.px(), posTrack.py(), posTrack.pz()); + const TVector3 pneg(negTrack.px(), negTrack.py(), negTrack.pz()); + double alpha, qT; + + GetArmeterosVariables(ppos, pneg, alpha, qT); + registry.fill(HIST("ArmAll"), alpha, qT); + + if (!passesV0TopologicalSelection(v0)) + continue; + + registry.fill(HIST("ArmAfterTopoSel"), alpha, qT); + registry.fill(HIST("dcaDauVsPt"), v0.pt(), v0.dcapostopv()); + registry.fill(HIST("dcaDauVsPt"), v0.pt(), v0.dcanegtopv()); + + if (passesK0Selection(collision, v0)) { + registry.fill(HIST("nSigmaPiFromK0"), posTrack.pt(), posTrack.tpcNSigmaPi()); + registry.fill(HIST("nSigmaPiFromK0"), negTrack.pt(), negTrack.tpcNSigmaPi()); + registry.fill(HIST("ArmK0NOSel"), alpha, qT); + if (v0Selections.armPodCut * qT > std::abs(alpha)) { + if (v0Selections.applyInvMassSel) { + if (!(v0.mK0Short() > v0Selections.minMassK0s && v0.mK0Short() < v0Selections.maxMassK0s)) + continue; + } + registry.fill(HIST("ArmK0"), alpha, qT); + registry.fill(HIST("MassK0ShortVsPt"), v0.pt(), v0.mK0Short()); + + registry.fill(HIST("dEdxPiPos"), posTrack.p(), posTrack.tpcSignal()); + registry.fill(HIST("dEdxPiNeg"), negTrack.p(), negTrack.tpcSignal()); + } + } + + if (passesLambdaSelection(collision, v0)) { + if (v0Selections.applyInvMassSel) { + if (!(v0.mLambda() > v0Selections.minMassLambda && v0.mLambda() < v0Selections.maxMassLambda)) + continue; + } + registry.fill(HIST("nSigmaPrFromLambda"), posTrack.pt(), posTrack.tpcNSigmaPr()); + registry.fill(HIST("nSigmaPiFromLambda"), negTrack.pt(), negTrack.tpcNSigmaPi()); + registry.fill(HIST("ArmLambda"), alpha, qT); + registry.fill(HIST("MassLambdaVsPt"), v0.pt(), v0.mLambda()); + registry.fill(HIST("dEdxPiNeg"), negTrack.p(), negTrack.tpcSignal()); + registry.fill(HIST("dEdxPrPos"), posTrack.p(), posTrack.tpcSignal()); + // std::cout << "pos charge = " << posTrack.sign() << " | neg charge = " << negTrack.sign() << '\n'; + } + + if (passesAntiLambdaSelection(collision, v0)) { + if (v0Selections.applyInvMassSel) { + if (!(v0.mAntiLambda() > v0Selections.minMassLambda && v0.mAntiLambda() < v0Selections.maxMassLambda)) + continue; + } + registry.fill(HIST("nSigmaPrFromAntiLambda"), posTrack.pt(), posTrack.tpcNSigmaPi()); + registry.fill(HIST("nSigmaPiFromAntiLambda"), negTrack.pt(), negTrack.tpcNSigmaPr()); + registry.fill(HIST("ArmAntiLambda"), alpha, qT); + registry.fill(HIST("MassAntiLambdaVsPt"), v0.pt(), v0.mAntiLambda()); + + registry.fill(HIST("dEdxPiPos"), posTrack.p(), posTrack.tpcSignal()); + registry.fill(HIST("dEdxPrNeg"), negTrack.p(), negTrack.tpcSignal()); + } + if (passesGammaSelection(collision, v0)) { + + // const double ePos{static_cast(posTrack.energy(o2::constants::physics::MassElectron))}; + // const double eEle{static_cast(negTrack.energy(o2::constants::physics::MassElectron))}; + // const float px[2] = {posTrack.px(), negTrack.px()}; + // const float py[2] = {posTrack.py(), negTrack.py()}; + // const float pz[2] = {posTrack.pz(), negTrack.pz()}; + // const double invMass = std::sqrt(std::pow(ePos + eEle, 2.0) - (std::pow(px[0] + px[1], 2.0) + std::pow(py[0] + py[1], 2.0) + std::pow(pz[0] + pz[1], 2.0))); + + if (v0Selections.applyInvMassSel) { + if (!(v0.mGamma() > v0Selections.minMassGamma && v0.mGamma() < v0Selections.maxMassGamma)) + continue; + } + + registry.fill(HIST("MassGammaVsPt"), v0.pt(), v0.mGamma()); + registry.fill(HIST("dEdxEl"), posTrack.p(), posTrack.tpcSignal()); + registry.fill(HIST("dEdxEl"), negTrack.p(), negTrack.tpcSignal()); + + registry.fill(HIST("nSigmaElFromGammaConv"), negTrack.pt(), negTrack.tpcNSigmaEl()); + registry.fill(HIST("nSigmaElFromGammaConv"), posTrack.pt(), posTrack.tpcNSigmaEl()); + registry.fill(HIST("ArmGamma"), alpha, qT); + } + } + } + PROCESS_SWITCH(piKpRAA, processCalibrationAndV0s, "Process QA", true); + + template + void GetArmeterosVariables(const T& ppos, const T& pneg, U& alpha, U& qT) + { + + alpha = 0., qT = 0.; + TVector3 pV0 = ppos + pneg; + double pV0mag = pV0.Mag(); + if (pV0mag < 1e-9) + return; // protect against zero momentum + + const TVector3 u = pV0 * (1.0 / pV0mag); + + double pLpos = ppos.Dot(u); + double pLneg = pneg.Dot(u); + + // qT: transverse momentum of the + track w.r.t. V0 direction + TVector3 pTpos = ppos - pLpos * u; + qT = pTpos.Mag(); + + // α: longitudinal asymmetry (uses + and − labels by charge) + double denom = pLpos + pLneg; + if (std::abs(denom) < 1e-9) + return; // avoid 0 division (unphysical for V0s) + + alpha = (pLpos - pLneg) / denom; // equivalently / pV0mag + } + + // Daughters DCA selection + template + bool passesDCASelectionDaughters(const T& v0) + { + + bool isSelected{false}; + // const double ptPos{std::sqrt(std::pow(v0.pxpos(), 2.0) + std::pow(v0.pypos(), 2.0))}; + // const double ptNeg{std::sqrt(std::pow(v0.pxneg(), 2.0) + std::pow(v0.pyneg(), 2.0))}; + // const double dcaPtDepPos{0.0105 + 0.035 * std::pow(ptPos, -1.1)}; + // const double dcaPtDepNeg{0.0105 + 0.035 * std::pow(ptNeg, -1.1)}; + // const double dcaSelPos = std::max(0.1, dcaPtDepPos); + // const double dcaSelNeg = std::max(0.1, dcaPtDepNeg); + + const double dcaPos{std::fabs(v0.dcapostopv())}; + const double dcaNeg{std::fabs(v0.dcanegtopv())}; + + isSelected = dcaPos > v0Selections.dcapostopv && dcaNeg > v0Selections.dcanegtopv ? true : false; + return isSelected; + } + + template + bool passesTrackSelectionDaughters(const T& track) + { + + bool isSelected = trkSelDaugthers.IsSelected(track) ? true : false; + return isSelected; + } + + // V0 topological selection + template + bool passesV0TopologicalSelection(const T& v0) + { + + bool isSelected = v0.v0radius() > v0Selections.v0radius && v0.v0radius() < v0Selections.v0radiusMax && passesDCASelectionDaughters(v0) && v0.v0cosPA() > v0Selections.v0cospa && v0.dcaV0daughters() < v0Selections.dcav0dau ? true : false; + + return isSelected; + } + + template + bool passesK0Selection(const C& collision, const T& v0) + { + // Selection on rapiditty, proper lifetime, and Nsigma Pion + + const auto& posTrack = v0.template posTrack_as(); + const auto& negTrack = v0.template negTrack_as(); + + const float posTPCNsigma{std::fabs(posTrack.tpcNSigmaPi())}; + const float negTPCNsigma{std::fabs(negTrack.tpcNSigmaPi())}; + const float posTOFNsigma{std::fabs(posTrack.tofNSigmaPi())}; + const float negTOFNsigma{std::fabs(negTrack.tofNSigmaPi())}; + const double posRadiusNsigma{std::sqrt(std::pow(posTPCNsigma, 2.) + std::pow(posTOFNsigma, 2.))}; + const double negRadiusNsigma{std::sqrt(std::pow(negTPCNsigma, 2.) + std::pow(negTOFNsigma, 2.))}; + + // bool isSelected = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecut->get("lifetimecutK0S") && std::abs(v0.yK0Short()) < v0Selections.rapidityCut && posTPCNsigma < v0Selections.tpcPidNsigmaCut && negTPCNsigma < v0Selections.tpcPidNsigmaCut ? true : false; + bool isSelected = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecut->get("lifetimecutK0S") && std::abs(v0.yK0Short()) < v0Selections.rapidityCut && posTrack.hasTOF() && negTrack.hasTOF() && posRadiusNsigma < v0Selections.tpcPidNsigmaCut && negRadiusNsigma < v0Selections.tpcPidNsigmaCut ? true : false; + + return isSelected; + } + + template + bool passesLambdaSelection(const C& collision, const T& v0) + { + // Selection on rapiditty, proper lifetime, and Nsigma Pion + + const auto& posTrack = v0.template posTrack_as(); + const auto& negTrack = v0.template negTrack_as(); + + const float posTPCNsigma{std::fabs(posTrack.tpcNSigmaPr())}; + const float negTPCNsigma{std::fabs(negTrack.tpcNSigmaPi())}; + const float posTOFNsigma{std::fabs(posTrack.tofNSigmaPr())}; + const float negTOFNsigma{std::fabs(negTrack.tofNSigmaPi())}; + const double posRadiusNsigma{std::sqrt(std::pow(posTPCNsigma, 2.) + std::pow(posTOFNsigma, 2.))}; + const double negRadiusNsigma{std::sqrt(std::pow(negTPCNsigma, 2.) + std::pow(negTOFNsigma, 2.))}; + + bool isSelected = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 < lifetimecut->get("lifetimecutLambda") && std::abs(v0.yLambda()) < v0Selections.rapidityCut && posTrack.hasTOF() && negTrack.hasTOF() && posRadiusNsigma < v0Selections.tpcPidNsigmaCut && negRadiusNsigma < v0Selections.tpcPidNsigmaCut ? true : false; + + return isSelected; + } + + template + bool passesAntiLambdaSelection(const C& collision, const T& v0) + { + // Selection on rapiditty, proper lifetime, and Nsigma Pion + + const auto& posTrack = v0.template posTrack_as(); + const auto& negTrack = v0.template negTrack_as(); + + const float posTPCNsigma{std::fabs(posTrack.tpcNSigmaPi())}; + const float negTPCNsigma{std::fabs(negTrack.tpcNSigmaPr())}; + const float posTOFNsigma{std::fabs(posTrack.tofNSigmaPi())}; + const float negTOFNsigma{std::fabs(negTrack.tofNSigmaPr())}; + const double posRadiusNsigma{std::sqrt(std::pow(posTPCNsigma, 2.) + std::pow(posTOFNsigma, 2.))}; + const double negRadiusNsigma{std::sqrt(std::pow(negTPCNsigma, 2.) + std::pow(negTOFNsigma, 2.))}; + + bool isSelected = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 < lifetimecut->get("lifetimecutLambda") && std::abs(v0.yLambda()) < v0Selections.rapidityCut && posTrack.hasTOF() && negTrack.hasTOF() && posRadiusNsigma < v0Selections.tpcPidNsigmaCut && negRadiusNsigma < v0Selections.tpcPidNsigmaCut ? true : false; + + return isSelected; + } + + template + bool passesGammaSelection(const C& /*collision*/, const T& v0) + { + const auto& posTrack = v0.template posTrack_as(); + const auto& negTrack = v0.template negTrack_as(); + + const float posTPCNsigma{std::fabs(posTrack.tpcNSigmaEl())}; + const float negTPCNsigma{std::fabs(negTrack.tpcNSigmaEl())}; + const float posTOFNsigma{std::fabs(posTrack.tofNSigmaEl())}; + const float negTOFNsigma{std::fabs(negTrack.tofNSigmaEl())}; + const double posRadiusNsigma{std::sqrt(std::pow(posTPCNsigma, 2.) + std::pow(posTOFNsigma, 2.))}; + const double negRadiusNsigma{std::sqrt(std::pow(negTPCNsigma, 2.) + std::pow(negTOFNsigma, 2.))}; + const float yGamma = RecoDecay::y(std::array{v0.px(), v0.py(), v0.pz()}, o2::constants::physics::MassGamma); + + if (!(std::abs(yGamma) < v0Selections.rapidityCut)) + return false; + + if (!(posTrack.hasTOF() && negTrack.hasTOF())) + return false; + + bool isSelected = posRadiusNsigma < v0Selections.tpcPidNsigmaCut && negRadiusNsigma < v0Selections.tpcPidNsigmaCut ? true : false; + // bool isSelected = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 < lifetimecut->get("lifetimecutLambda") && std::abs(v0.yLambda()) < v0Selections.rapidityCut && posTrack.hasTOF() && negTrack.hasTOF() && posRadiusNsigma < v0Selections.tpcPidNsigmaCut && negRadiusNsigma < v0Selections.tpcPidNsigmaCut ? true : false; + + return isSelected; + } + + int getMagneticField(uint64_t timestamp) + { + // TODO done only once (and not per run). Will be replaced by CCDBConfigurable + static o2::parameters::GRPMagField* grpo = nullptr; + if (grpo == nullptr) { + grpo = ccdb->getForTimeStamp("GLO/Config/GRPMagField", timestamp); + if (grpo == nullptr) { + LOGF(fatal, "GRP object not found for timestamp %llu", timestamp); + return 0; + } + LOGF(info, "Retrieved GRP for timestamp %llu with magnetic field of %d kG", timestamp, grpo->getNominalL3Field()); + } + return grpo->getNominalL3Field(); + } + + bool passesGeometricalCut() + { + return true; + } + + void PhiPrime(float& phi, const int& magField, const int& charge) + { + + if (magField < 0) // for negatve polarity field + phi = o2::constants::math::TwoPI - phi; + if (charge < 0) // for negatve charge + phi = o2::constants::math::TwoPI - phi; + + phi += o2::constants::math::PI / 18.0f; + phi = std::fmod(phi, o2::constants::math::PI / 9.0f); + } + + template + bool isEventSelected(CheckCol const& col) + { + registry.fill(HIST("EventCounter"), EvCutLabel::All); + if (!col.sel8()) { + return false; + } + registry.fill(HIST("EventCounter"), EvCutLabel::SelEigth); + + if (!col.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + return false; + } + registry.fill(HIST("EventCounter"), EvCutLabel::NoSameBunchPileup); + + if (!col.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + return false; + } + registry.fill(HIST("EventCounter"), EvCutLabel::IsGoodZvtxFT0vsPV); + + if (isNoCollInTimeRangeStrict) { + if (!col.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStrict)) { + return false; + } + registry.fill(HIST("EventCounter"), EvCutLabel::NoCollInTimeRangeStrict); + } + + if (isNoCollInTimeRangeStandard) { + if (!col.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return false; + } + registry.fill(HIST("EventCounter"), EvCutLabel::NoCollInTimeRangeStandard); + } + + if (isNoCollInRofStrict) { + if (!col.selection_bit(o2::aod::evsel::kNoCollInRofStrict)) { + return false; + } + registry.fill(HIST("EventCounter"), EvCutLabel::NoCollInRofStrict); + } + + if (isNoCollInRofStandard) { + if (!col.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { + return false; + } + registry.fill(HIST("EventCounter"), EvCutLabel::NoCollInRofStandard); + } + + if (isNoHighMultCollInPrevRof) { + if (!col.selection_bit( + o2::aod::evsel::kNoHighMultCollInPrevRof)) { + return false; + } + registry.fill(HIST("EventCounter"), EvCutLabel::NoHighMultCollInPrevRof); + } + + // To be used in combination with FT0C-based occupancy + if (isNoCollInTimeRangeNarrow) { + if (!col.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) { + return false; + } + registry.fill(HIST("EventCounter"), EvCutLabel::NoCollInTimeRangeNarrow); + } + + if (isOccupancyCut) { + auto occuValue{isApplyFT0CbasedOccupancy ? col.ft0cOccupancyInTimeRange() : col.trackOccupancyInTimeRange()}; + if (occuValue < minOccCut || occuValue > maxOccCut) { + return false; + } + } + registry.fill(HIST("EventCounter"), EvCutLabel::OccuCut); + + if (col.centFT0C() < minT0CcentCut || col.centFT0C() > maxT0CcentCut) { + return false; + } + registry.fill(HIST("EventCounter"), EvCutLabel::Centrality); + + // Z-vertex position cut + if (std::fabs(col.posZ()) > posZcut) { + return false; + } + registry.fill(HIST("EventCounter"), EvCutLabel::VtxZ); + + return true; + } + + template + void getPTpowers(const T& pTs, const T& vecEff, const T& vecFD, U& pOne, + U& wOne, U& pTwo, U& wTwo, U& pThree, U& wThree, + U& pFour, U& wFour) + { + pOne = wOne = pTwo = wTwo = pThree = wThree = pFour = wFour = 0.; + for (std::size_t i = 0; i < pTs.size(); ++i) { + const double pTi{pTs.at(i)}; + const double eFFi{vecEff.at(i)}; + const double fDi{vecFD.at(i)}; + const double wEighti{std::pow(eFFi, -1.) * fDi}; + pOne += wEighti * pTi; + wOne += wEighti; + pTwo += std::pow(wEighti * pTi, 2.); + wTwo += std::pow(wEighti, 2.); + pThree += std::pow(wEighti * pTi, 3.); + wThree += std::pow(wEighti, 3.); + pFour += std::pow(wEighti * pTi, 4.); + wFour += std::pow(wEighti, 4.); + } + } + + void loadCorrections(uint64_t timeStamp) + { + // if (cfg.correctionsLoaded) return; + + if (paTHEff.value.empty() == false) { + cfg.hEfficiency = + ccdb->getForTimeStamp(paTHEff, timeStamp); + if (cfg.hEfficiency == nullptr) { + LOGF(fatal, "Could not load efficiency histogram from %s", + paTHEff.value.c_str()); + } + } + + if (paTHFD.value.empty() == false) { + cfg.hFeedDown = ccdb->getForTimeStamp(paTHFD, timeStamp); + if (cfg.hFeedDown == nullptr) { + LOGF(fatal, "Could not load feed down histogram from %s", + paTHFD.value.c_str()); + } + } + cfg.correctionsLoaded = true; + } + + void loadNchCalibrations(uint64_t timeStamp) + { + if (paTHmeanNch.value.empty() == false) { + cfgNch.hMeanNch = + ccdb->getForTimeStamp(paTHmeanNch, timeStamp); + if (cfgNch.hMeanNch == nullptr) { + LOGF(fatal, "Could not load hMeanNch histogram from %s", + paTHmeanNch.value.c_str()); + } + } + + if (paTHsigmaNch.value.empty() == false) { + cfgNch.hSigmaNch = + ccdb->getForTimeStamp(paTHsigmaNch, timeStamp); + if (cfgNch.hSigmaNch == nullptr) { + LOGF(fatal, "Could not load hSigmaNch histogram from %s", + paTHsigmaNch.value.c_str()); + } + } + cfgNch.calibrationsLoaded = true; + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From a7e98b9d59a72cde4a9c70e2fc12131d2838a85c Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Sun, 24 Aug 2025 13:50:06 +0200 Subject: [PATCH 177/986] [PWGLF] Add RCT flag for event selection (#12718) --- PWGLF/Tasks/Resonances/phispectrapbpbqa.cxx | 29 ++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/PWGLF/Tasks/Resonances/phispectrapbpbqa.cxx b/PWGLF/Tasks/Resonances/phispectrapbpbqa.cxx index 2abaf1fff47..981365eefb1 100644 --- a/PWGLF/Tasks/Resonances/phispectrapbpbqa.cxx +++ b/PWGLF/Tasks/Resonances/phispectrapbpbqa.cxx @@ -64,6 +64,7 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; using std::array; +using namespace o2::aod::rctsel; struct phispectrapbpbqa { double bz = 0.; @@ -75,6 +76,13 @@ struct phispectrapbpbqa { Configurable cfgURL{"cfgURL", "http://alice-ccdb.cern.ch", "Address of the CCDB to browse"}; Configurable nolaterthan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "Latest acceptable timestamp of creation for the object"}; } cfgCcdbParam; + + struct : ConfigurableGroup { + Configurable requireRCTFlagChecker{"requireRCTFlagChecker", true, "Check event quality in run condition table"}; + Configurable cfgEvtRCTFlagCheckerLabel{"cfgEvtRCTFlagCheckerLabel", "CBT_hadronPID", "Evt sel: RCT flag checker label"}; + Configurable cfgEvtRCTFlagCheckerLimitAcceptAsBad{"cfgEvtRCTFlagCheckerLimitAcceptAsBad", true, "Evt sel: RCT flag checker treat Limited Acceptance As Bad"}; + } rctCut; + TH3D* hTPCCallib; TH3D* hTOFCallib; @@ -141,13 +149,13 @@ struct phispectrapbpbqa { Partition negTracks = aod::track::signed1Pt < cfgCutCharge; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - + RCTFlagsChecker rctChecker; // Event selection cuts - Alex // TF1* fMultPVCutLow = nullptr; void init(o2::framework::InitContext&) { - + rctChecker.init(rctCut.cfgEvtRCTFlagCheckerLabel, rctCut.cfgEvtRCTFlagCheckerLimitAcceptAsBad); histos.add("hphiSE", "hphiSE", HistType::kTHnSparseF, {cnfgaxis.configThnAxisInvMass, cnfgaxis.configThnAxisPt, cnfgaxis.configThnAxisCentrality, axisOccupancy, cnfgaxis.configThnAxisSector}, true); histos.add("hphiME", "hphiME", HistType::kTHnSparseF, {cnfgaxis.configThnAxisInvMass, cnfgaxis.configThnAxisPt, cnfgaxis.configThnAxisCentrality, axisOccupancy, cnfgaxis.configThnAxisSector}, true); histos.add("hphiGen", "hphiGen", HistType::kTHnSparseF, {cnfgaxis.configThnAxisInvMass, cnfgaxis.configThnAxisPt, cnfgaxis.configThnAxisCentrality, axisOccupancy}, true); @@ -325,6 +333,11 @@ struct phispectrapbpbqa { if (!collision.sel8() || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) || !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { return; } + if (rctCut.requireRCTFlagChecker) { + if (!rctChecker(collision)) { + return; + } + } auto centrality = collision.centFT0C(); int occupancy = collision.trackOccupancyInTimeRange(); histos.fill(HIST("hCentrality"), centrality); @@ -481,6 +494,11 @@ struct phispectrapbpbqa { if (!collision2.sel8() || !collision2.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision2.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision2.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !collision2.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) || !collision2.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { continue; } + if (rctCut.requireRCTFlagChecker) { + if (!rctChecker(collision1) || !rctChecker(collision2)) { + continue; + } + } int occupancy = collision1.trackOccupancyInTimeRange(); auto centrality = collision1.centFT0C(); for (auto& [track1, track2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { @@ -587,8 +605,13 @@ struct phispectrapbpbqa { histos.fill(HIST("hMC"), 8); continue; } - histos.fill(HIST("hMC"), 9); + if (rctCut.requireRCTFlagChecker) { + if (!rctChecker(RecCollision)) { + continue; + } + } + histos.fill(HIST("hMC"), 10); auto centrality = RecCollision.centFT0C(); int occupancy = RecCollision.trackOccupancyInTimeRange(); histos.fill(HIST("hOccupancy"), occupancy, centrality); From 5c48fd0186e369ed2b677d3d0efda6ec063a736b Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sun, 24 Aug 2025 21:13:05 +0200 Subject: [PATCH 178/986] [PWGEM/Dilepton] update eventQC (#12720) --- .../TableProducer/createEMEventDilepton.cxx | 20 ++--- PWGEM/Dilepton/Tasks/eventQC.cxx | 81 +++++++++++++------ .../TableProducer/createEMEventPhoton.cxx | 21 ++--- 3 files changed, 79 insertions(+), 43 deletions(-) diff --git a/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx b/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx index b8575494195..fb1bf5da2a0 100644 --- a/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx +++ b/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx @@ -136,7 +136,7 @@ struct CreateEMEventDilepton { mRunNumber = bc.runNumber(); } - Preslice perBC = aod::collision::bcId; + // Preslice perBC = aod::collision::bcId; // Preslice perCollision_pcm = aod::v0photonkf::collisionId; // PresliceUnsorted perCollision_el = aod::emprimaryelectron::collisionId; // PresliceUnsorted perCollision_mu = aod::emprimarymuon::collisionId; @@ -163,16 +163,18 @@ struct CreateEMEventDilepton { auto bc = collision.template foundBC_as(); initCCDB(bc); - if (!collision.isSelected()) { // minimal cut for MB - continue; + if (collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { + if constexpr (eventtype == EMEventType::kEvent) { + event_norm_info(collision.alias_raw(), collision.selection_raw(), collision.rct_raw(), static_cast(10.f * collision.posZ()), 105.f); + } else if constexpr (eventtype == EMEventType::kEvent_Cent || eventtype == EMEventType::kEvent_Cent_Qvec) { + event_norm_info(collision.alias_raw(), collision.selection_raw(), collision.rct_raw(), static_cast(10.f * collision.posZ()), collision.centFT0C()); + } else { + event_norm_info(collision.alias_raw(), collision.selection_raw(), collision.rct_raw(), static_cast(10.f * collision.posZ()), 105.f); + } } - if constexpr (eventtype == EMEventType::kEvent) { - event_norm_info(collision.alias_raw(), collision.selection_raw(), collision.rct_raw(), static_cast(10.f * collision.posZ()), 105.f); - } else if constexpr (eventtype == EMEventType::kEvent_Cent || eventtype == EMEventType::kEvent_Cent_Qvec) { - event_norm_info(collision.alias_raw(), collision.selection_raw(), collision.rct_raw(), static_cast(10.f * collision.posZ()), collision.centFT0C()); - } else { - event_norm_info(collision.alias_raw(), collision.selection_raw(), collision.rct_raw(), static_cast(10.f * collision.posZ()), 105.f); + if (!collision.isSelected()) { // minimal cut for MB + continue; } if (!collision.isEoI()) { // events with at least 1 lepton for data reduction. diff --git a/PWGEM/Dilepton/Tasks/eventQC.cxx b/PWGEM/Dilepton/Tasks/eventQC.cxx index eb46e057ace..ee30bdd0e70 100644 --- a/PWGEM/Dilepton/Tasks/eventQC.cxx +++ b/PWGEM/Dilepton/Tasks/eventQC.cxx @@ -85,12 +85,12 @@ struct eventQC { struct : ConfigurableGroup { std::string prefix = "eventcut_group"; - Configurable cfgZvtxMin{"cfgZvtxMin", -10.f, "min. Zvtx"}; - Configurable cfgZvtxMax{"cfgZvtxMax", 10.f, "max. Zvtx"}; - Configurable cfgRequireSel8{"cfgRequireSel8", true, "require sel8 in event cut"}; - Configurable cfgRequireFT0AND{"cfgRequireFT0AND", true, "require FT0AND in event cut"}; - Configurable cfgRequireNoTFB{"cfgRequireNoTFB", true, "require No time frame border in event cut"}; - Configurable cfgRequireNoITSROFB{"cfgRequireNoITSROFB", true, "require no ITS readout frame border in event cut"}; + Configurable cfgZvtxMin{"cfgZvtxMin", -1e+10, "min. Zvtx"}; + Configurable cfgZvtxMax{"cfgZvtxMax", 1e+10, "max. Zvtx"}; + Configurable cfgRequireSel8{"cfgRequireSel8", false, "require sel8 in event cut"}; + Configurable cfgRequireFT0AND{"cfgRequireFT0AND", false, "require FT0AND in event cut"}; + Configurable cfgRequireNoTFB{"cfgRequireNoTFB", false, "require No time frame border in event cut"}; + Configurable cfgRequireNoITSROFB{"cfgRequireNoITSROFB", false, "require no ITS readout frame border in event cut"}; Configurable cfgRequireVertexITSTPC{"cfgRequireVertexITSTPC", false, "require Vertex ITSTPC in event cut"}; // ITS-TPC matched track contributes PV. Configurable cfgRequireVertexTOFmatched{"cfgRequireVertexTOFmatched", false, "require Vertex TOFmatched in event cut"}; // ITS-TPC-TOF matched track contributes PV. Configurable cfgRequireNoSameBunchPileup{"cfgRequireNoSameBunchPileup", false, "require no same bunch pileup in event cut"}; @@ -201,13 +201,14 @@ struct eventQC { if (doprocessEventQC_SWT) { fRegistry.add("BC/hNcoll", "Number of collisions per triggered BC;N_{collision} per triggered BC", kTH1F, {{11, -0.5, +10.5}}, false); - fRegistry.add("BC/hDeltaT", "diff. in collision time per BC;#DeltaT_{coll} (ns)", kTH1F, {{500, -25, +25}}, false); - fRegistry.add("BC/hDeltaZ", "diff. in collision Z_{vtx} per BC;#DeltaZ_{vtx} (cm)", kTH1F, {{1000, -5, +5}}, false); - fRegistry.add("BC/hCorrNcontrib", "hMultNTracksPV;", kTH2F, {{axis_mult_ncontrib}, {axis_mult_ncontrib}}, false); - fRegistry.add("BC/Collision/hMultNTracksPV", "hMultNTracksPV;N_{track} to PV in |#eta| < 0.8", kTH1F, {{axis_mult_ncontrib08}}, false); + fRegistry.add("BC/Collision/hMultNTracksPV", "hMultNTracksPV;N_{track} to PV", kTH1F, {{axis_mult_ncontrib}}, false); fRegistry.add("BC/Collision/hMultFT0AFT0C", "hMultFT0AFT0C;mult. FT0A;mult. FT0C", kTH2F, {{axis_mult_ft0a}, {axis_mult_ft0c}}, false); fRegistry.add("BC/Collision/hMultFT0AFV0A", "hMultFT0AFV0A;mult. FT0A;mult. FV0A", kTH2F, {{axis_mult_ft0a}, {axis_mult_fv0a}}, false); fRegistry.add("BC/Collision/hMultFT0CFV0A", "hMultFT0CFV0A;mult. FT0C;mult. FV0A", kTH2F, {{axis_mult_ft0c}, {axis_mult_fv0a}}, false); + + fRegistry.add("perBC/hDeltaTZ", "#DeltaZ_{vtx} vs. #DeltaT of collisions per BC;#DeltaZ_{vtx} (cm);#DeltaT (ns)", kTH2F, {{100, -5, +5}, {50, -25, +25}}, false); + fRegistry.add("perBC/hCorrNcontrib", "hMultNTracksPV;", kTH2F, {{axis_mult_ncontrib}, {axis_mult_ncontrib}}, false); + // fRegistry.addClone("perBC/", "beyondBC/"); } // event info @@ -238,7 +239,8 @@ struct eventQC { if (cfgFillEvent) { fRegistry.add("Event/before/hZvtx", "vertex z; Z_{vtx} (cm)", kTH1F, {{100, -50, +50}}, false); - fRegistry.add("Event/before/hMultNTracksPV", "hMultNTracksPV; N_{track} to PV in |#eta| < 0.8", kTH1F, {{axis_mult_ncontrib08}}, false); + fRegistry.add("Event/before/hMultNTracksPV", "hMultNTracksPV; N_{track} to PV", kTH1F, {{axis_mult_ncontrib}}, false); + fRegistry.add("Event/before/hMultNTracksPV08", "hMultNTracksPV08; N_{track} to PV in |#eta| < 0.8", kTH1F, {{axis_mult_ncontrib08}}, false); fRegistry.add("Event/before/hMultFT0AFT0C", "hMultFT0AFT0C;mult. FT0A;mult. FT0C", kTH2F, {{axis_mult_ft0a}, {axis_mult_ft0c}}, false); fRegistry.add("Event/before/hMultFT0AFV0A", "hMultFT0AFV0A;mult. FT0A;mult. FV0A", kTH2F, {{axis_mult_ft0a}, {axis_mult_fv0a}}, false); fRegistry.add("Event/before/hMultFT0CFV0A", "hMultFT0CFV0A;mult. FT0C;mult. FV0A", kTH2F, {{axis_mult_ft0c}, {axis_mult_fv0a}}, false); @@ -479,7 +481,8 @@ struct eventQC { } fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hZvtx"), collision.posZ()); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultNTracksPV"), collision.multNTracksPV()); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultNTracksPV"), collision.numContrib()); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultNTracksPV08"), collision.multNTracksPV()); fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultFT0AFT0C"), collision.multFT0A(), collision.multFT0C()); fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultFT0AFV0A"), collision.multFT0A(), collision.multFV0A()); fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultFT0CFV0A"), collision.multFT0C(), collision.multFV0A()); @@ -740,7 +743,7 @@ struct eventQC { } template - bool isSelectedEvent(TCollision const& collision) + bool isSelectedCollision(TCollision const& collision) { if (eventcuts.cfgRequireSel8 && !collision.sel8()) { return false; @@ -838,38 +841,66 @@ struct eventQC { SliceCache cache; Preslice perCol = o2::aod::track::collisionId; - Preslice perBC = o2::aod::collision::bcId; + // Preslice perBC = o2::aod::collision::bcId; + PresliceUnsorted perFoundBC = aod::evsel::foundBCId; template void runQC(TBCs const& bcs, TCollisions const& collisions, TTracks const& tracks) { if constexpr (isTriggerAnalysis) { + // std::vector selectedCollisionIds; + // selectedCollisionIds.reserve(collisions.size()); + for (const auto& bc : bcs) { initCCDB(bc); if (!zorro.isSelected(bc.globalBC())) { // triggered BC continue; } - // if (!bc.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { - // continue; - // } - - const auto& collisions_per_bc = collisions.sliceBy(perBC, bc.globalIndex()); + // const auto& collisions_per_bc = collisions.sliceBy(perBC, bc.globalIndex()); + const auto& collisions_per_bc = collisions.sliceBy(perFoundBC, bc.globalIndex()); fRegistry.fill(HIST("BC/hNcoll"), collisions_per_bc.size()); for (const auto& collision : collisions_per_bc) { - fRegistry.fill(HIST("BC/Collision/hMultNTracksPV"), collision.multNTracksPV()); + if (!isSelectedCollision(collision)) { + continue; + } + + fRegistry.fill(HIST("BC/Collision/hMultNTracksPV"), collision.numContrib()); fRegistry.fill(HIST("BC/Collision/hMultFT0AFT0C"), collision.multFT0A(), collision.multFT0C()); fRegistry.fill(HIST("BC/Collision/hMultFT0AFV0A"), collision.multFT0A(), collision.multFV0A()); fRegistry.fill(HIST("BC/Collision/hMultFT0CFV0A"), collision.multFT0C(), collision.multFV0A()); + // selectedCollisionIds.emplace_back(collision.globalIndex()); } for (const auto& [col1, col2] : combinations(CombinationsStrictlyUpperIndexPolicy(collisions_per_bc, collisions_per_bc))) { - fRegistry.fill(HIST("BC/hDeltaZ"), col1.posZ() - col2.posZ()); - fRegistry.fill(HIST("BC/hDeltaT"), col1.collisionTime() - col2.collisionTime()); - fRegistry.fill(HIST("BC/hCorrNcontrib"), col1.numContrib(), col2.numContrib()); + if (!isSelectedCollision(col1) || !isSelectedCollision(col2)) { + continue; + } + fRegistry.fill(HIST("perBC/hDeltaTZ"), col1.posZ() - col2.posZ(), col1.collisionTime() - col2.collisionTime()); + fRegistry.fill(HIST("perBC/hCorrNcontrib"), col1.numContrib(), col2.numContrib()); } // end of pairing } // end of bc loop - } + + // for (const auto& collisionId1 : selectedCollisionIds) { + // const auto& col1 = collisions.rawIteratorAt(collisionId1); + // for (const auto& col2 : collisions) { + // if (!isSelectedCollision(col2)) { + // continue; + // } + + // const auto& bc1 = col1.template bc_as(); // don't use foundBC for CEFP. + // const auto& bc2 = col2.template bc_as(); // don't use foundBC for CEFP. + // if (bc1.globalBC() == bc2.globalBC()) { + // continue; + // } + // fRegistry.fill(HIST("beyondBC/hDeltaTZ"), col1.posZ() - col2.posZ(), col1.collisionTime() - col2.collisionTime()); + // fRegistry.fill(HIST("beyondBC/hCorrNcontrib"), col1.numContrib(), col2.numContrib()); + // } // end of all collision loop + // } // end of selected collision loop + + // selectedCollisionIds.clear(); + // selectedCollisionIds.shrink_to_fit(); + } // end of trigger QC for (const auto& collision : collisions) { if constexpr (isTriggerAnalysis) { @@ -892,7 +923,7 @@ struct eventQC { if (cfgFillEvent) { fillEventInfo<0>(collision); } - if (!isSelectedEvent(collision)) { + if (!isSelectedCollision(collision)) { continue; } if (cfgFillEvent) { diff --git a/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx b/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx index 724b6347fa6..a4c42e37003 100644 --- a/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx +++ b/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx @@ -154,9 +154,6 @@ struct CreateEMEventPhoton { auto bc = collision.template foundBC_as(); initCCDB(bc); - if (!collision.isSelected()) { - continue; - } if (needEMCTrigger && !collision.alias_bit(kTVXinEMC)) { continue; } @@ -164,12 +161,18 @@ struct CreateEMEventPhoton { continue; } - if constexpr (eventtype == EMEventType::kEvent) { - event_norm_info(collision.alias_raw(), collision.selection_raw(), collision.rct_raw(), static_cast(10.f * collision.posZ()), 105.f); - } else if constexpr (eventtype == EMEventType::kEvent_Cent || eventtype == EMEventType::kEvent_Cent_Qvec) { - event_norm_info(collision.alias_raw(), collision.selection_raw(), collision.rct_raw(), static_cast(10.f * collision.posZ()), collision.centFT0C()); - } else { - event_norm_info(collision.alias_raw(), collision.selection_raw(), collision.rct_raw(), static_cast(10.f * collision.posZ()), 105.f); + if (collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { + if constexpr (eventtype == EMEventType::kEvent) { + event_norm_info(collision.alias_raw(), collision.selection_raw(), collision.rct_raw(), static_cast(10.f * collision.posZ()), 105.f); + } else if constexpr (eventtype == EMEventType::kEvent_Cent || eventtype == EMEventType::kEvent_Cent_Qvec) { + event_norm_info(collision.alias_raw(), collision.selection_raw(), collision.rct_raw(), static_cast(10.f * collision.posZ()), collision.centFT0C()); + } else { + event_norm_info(collision.alias_raw(), collision.selection_raw(), collision.rct_raw(), static_cast(10.f * collision.posZ()), 105.f); + } + } + + if (!collision.isSelected()) { + continue; } if (!collision.isEoI()) { // events with at least 1 photon for data reduction. From d02008dec57d4cf0025d705aa8695da971ef59fd Mon Sep 17 00:00:00 2001 From: alcaliva <32872606+alcaliva@users.noreply.github.com> Date: Mon, 25 Aug 2025 08:45:22 +0200 Subject: [PATCH 179/986] [PWGLF] added histogram for spectra normalization (#12719) --- PWGLF/Tasks/Nuspex/antinucleiInJets.cxx | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx index c710fce3735..3cb75e35c62 100644 --- a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx +++ b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx @@ -256,6 +256,10 @@ struct AntinucleiInJets { // Generated spectra of antiprotons registryMC.add("antiproton_gen_jet", "antiproton_gen_jet", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); registryMC.add("antiproton_gen_ue", "antiproton_gen_ue", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); + + // Normalization histogram + registryMC.add("antiproton_y_phi_jet", "antiproton_y_phi_jet", HistType::kTH2F, {{2000, -1.0, 1.0, "#it{y}"}, {2000, 0.0, TwoPI, "#Delta#phi"}}); + registryMC.add("antiproton_y_phi_ue", "antiproton_y_phi_ue", HistType::kTH2F, {{2000, -1.0, 1.0, "#it{y}"}, {2000, 0.0, TwoPI, "#Delta#phi"}}); } // Reconstructed antiproton spectra in jets and UE (MC-matched) with TPC/TOF PID @@ -1459,6 +1463,14 @@ struct AntinucleiInJets { if (particle.eta() < minEta || particle.eta() > maxEta) continue; + // Fill normalization histogram + double px = particle.px(); + double py = particle.py(); + double pz = particle.pz(); + double energy = std::sqrt(MassProton * MassProton + px * px + py * py + pz * pz); + double y = 0.5 * std::log((energy + pz) / (energy - pz)); + registryMC.fill(HIST("antiproton_y_phi_jet"), y, getDeltaPhi(particle.phi(), jet.phi())); + // Fill histogram for generated antiprotons registryMC.fill(HIST("antiproton_gen_jet"), particle.pt()); } @@ -1491,6 +1503,20 @@ struct AntinucleiInJets { if (deltaRUe1 > maxConeRadius && deltaRUe2 > maxConeRadius) continue; + // Fill normalization histogram + double px = protonVec.Px(); + double py = protonVec.Py(); + double pz = protonVec.Pz(); + double energy = std::sqrt(MassProton * MassProton + px * px + py * py + pz * pz); + double y = 0.5 * std::log((energy + pz) / (energy - pz)); + + if (deltaRUe1 < maxConeRadius) { + registryMC.fill(HIST("antiproton_y_phi_ue"), y, getDeltaPhi(protonVec.Phi(), ueAxis1.Phi())); + } + if (deltaRUe2 < maxConeRadius) { + registryMC.fill(HIST("antiproton_y_phi_ue"), y, getDeltaPhi(protonVec.Phi(), ueAxis2.Phi())); + } + // Fill histogram for antiprotons in the UE registryMC.fill(HIST("antiproton_gen_ue"), protonVec.Pt()); } From 82ab24a885991e2b557ae475da25e62868ba13fe Mon Sep 17 00:00:00 2001 From: Deependra Sharma <38365215+deependra170598@users.noreply.github.com> Date: Mon, 25 Aug 2025 13:37:00 +0530 Subject: [PATCH 180/986] [PWGHF/HFC] adding a new QA histogram for multiplicity (#12654) --- PWGHF/HFC/TableProducer/correlatorDstarHadrons.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PWGHF/HFC/TableProducer/correlatorDstarHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorDstarHadrons.cxx index 1a4cafe02ac..6f763420bcd 100644 --- a/PWGHF/HFC/TableProducer/correlatorDstarHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDstarHadrons.cxx @@ -196,12 +196,15 @@ struct HfCorrelatorDstarHadrons { LOGP(fatal, "One and only one process function must be enabled at a time."); } + AxisSpec axisSpecMultFT0M{binsMultiplicity, "Multiplicity in FT0M", "multFT0M"}; + invMassDstarParticle = -999.0; invMassD0Particle = -999.0; binNumber = -2; binningScheme = {{binsZVtx, binsMultiplicity}, true}; + registry.add("QA/hMultFT0M", "Multiplicity distribution in FT0M", {HistType::kTH1D, {axisSpecMultFT0M}}); registry.add("QA/hCandsPerCol", "Candidates per Collision", {HistType::kTH1D, {{100, 0.0, 100.0}}}); registry.add("QA/hAssoTracksPerCol", "Tracks per Collision", {HistType::kTH1D, {{1000, 0.0, 1000.0}}}); registry.add("QA/hCandsVsTracksPerCol", "Candidates vs Tracks per Collision", {HistType::kTHnSparseF, {{100, 0.0, 100.0}, {1000, 0.0, 1000.0}}}); @@ -239,6 +242,7 @@ struct HfCorrelatorDstarHadrons { } // endif registry.fill(HIST("hTriggerColCandPairCounts"), 1); // counting number of trigger particle + registry.fill(HIST("QA/hMultFT0M"), collision.multFT0M()); registry.fill(HIST("QA/hCandsPerCol"), candidatesPerCol.size()); registry.fill(HIST("QA/hAssoTracksPerCol"), tracksPerCol.size()); registry.fill(HIST("QA/hCandsVsTracksPerCol"), candidatesPerCol.size(), tracksPerCol.size()); From 63e723c49e267a1aba88e07401ace716000cb837 Mon Sep 17 00:00:00 2001 From: Marcello Di Costanzo <96481191+Marcellocosti@users.noreply.github.com> Date: Mon, 25 Aug 2025 10:28:04 +0200 Subject: [PATCH 181/986] [PWGHF] Add single track vars and MC validation for Bs meson (#12598) Co-authored-by: ALICE Action Bot --- PWGHF/D2H/Tasks/taskB0Reduced.cxx | 2 +- PWGHF/D2H/Tasks/taskBsReduced.cxx | 187 +++++++++++++++++++++--------- PWGHF/Tasks/taskMcValidation.cxx | 29 +++-- 3 files changed, 152 insertions(+), 66 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskB0Reduced.cxx b/PWGHF/D2H/Tasks/taskB0Reduced.cxx index 169e4fcd834..e79e77278fb 100644 --- a/PWGHF/D2H/Tasks/taskB0Reduced.cxx +++ b/PWGHF/D2H/Tasks/taskB0Reduced.cxx @@ -101,7 +101,7 @@ DECLARE_SOA_COLUMN(FlagWrongCollision, flagWrongCollision, int8_t); } // namespace hf_cand_b0_lite DECLARE_SOA_TABLE(HfRedCandB0Lites, "AOD", "HFREDCANDB0LITE", //! Table with some B0 properties - // B meson features hf_cand_b0_lite::M, + // B meson features hf_cand_b0_lite::M, hf_cand_b0_lite::Pt, hf_cand_b0_lite::Eta, diff --git a/PWGHF/D2H/Tasks/taskBsReduced.cxx b/PWGHF/D2H/Tasks/taskBsReduced.cxx index a5a89e241cf..098814b8e37 100644 --- a/PWGHF/D2H/Tasks/taskBsReduced.cxx +++ b/PWGHF/D2H/Tasks/taskBsReduced.cxx @@ -50,58 +50,111 @@ namespace o2::aod { namespace hf_cand_bs_lite { -DECLARE_SOA_COLUMN(PtProng0, ptProng0, float); //! Transverse momentum of prong0 (GeV/c) -DECLARE_SOA_COLUMN(PtProng1, ptProng1, float); //! Transverse momentum of prong1 (GeV/c) -DECLARE_SOA_COLUMN(MProng0, mProng0, float); //! Invariant mass of prong0 (GeV/c) +// B meson features DECLARE_SOA_COLUMN(M, m, float); //! Invariant mass of candidate (GeV/c2) DECLARE_SOA_COLUMN(Pt, pt, float); //! Transverse momentum of candidate (GeV/c) -DECLARE_SOA_COLUMN(PtGen, ptGen, float); //! Transverse momentum of candidate (GeV/c) -DECLARE_SOA_COLUMN(P, p, float); //! Momentum of candidate (GeV/c) -DECLARE_SOA_COLUMN(Y, y, float); //! Rapidity of candidate DECLARE_SOA_COLUMN(Eta, eta, float); //! Pseudorapidity of candidate DECLARE_SOA_COLUMN(Phi, phi, float); //! Azimuth angle of candidate -DECLARE_SOA_COLUMN(E, e, float); //! Energy of candidate (GeV) -DECLARE_SOA_COLUMN(NSigTpcPi1, nSigTpcPi1, float); //! TPC Nsigma separation for prong1 with pion mass hypothesis -DECLARE_SOA_COLUMN(NSigTofPi1, nSigTofPi1, float); //! TOF Nsigma separation for prong1 with pion mass hypothesis +DECLARE_SOA_COLUMN(Y, y, float); //! Rapidity of candidate +DECLARE_SOA_COLUMN(Cpa, cpa, float); //! Cosine pointing angle of candidate +DECLARE_SOA_COLUMN(CpaXY, cpaXY, float); //! Cosine pointing angle of candidate in transverse plane DECLARE_SOA_COLUMN(DecayLength, decayLength, float); //! Decay length of candidate (cm) DECLARE_SOA_COLUMN(DecayLengthXY, decayLengthXY, float); //! Transverse decay length of candidate (cm) DECLARE_SOA_COLUMN(DecayLengthNormalised, decayLengthNormalised, float); //! Normalised decay length of candidate DECLARE_SOA_COLUMN(DecayLengthXYNormalised, decayLengthXYNormalised, float); //! Normalised transverse decay length of candidate DECLARE_SOA_COLUMN(ImpactParameterProduct, impactParameterProduct, float); //! Impact parameter product of candidate -DECLARE_SOA_COLUMN(Cpa, cpa, float); //! Cosine pointing angle of candidate -DECLARE_SOA_COLUMN(CpaXY, cpaXY, float); //! Cosine pointing angle of candidate in transverse plane DECLARE_SOA_COLUMN(MaxNormalisedDeltaIP, maxNormalisedDeltaIP, float); //! Maximum normalized difference between measured and expected impact parameter of candidate prongs DECLARE_SOA_COLUMN(MlScoreSig, mlScoreSig, float); //! ML score for signal class +// D meson features +DECLARE_SOA_COLUMN(MProng0, mProng0, float); //! Invariant mass of prong0 (GeV/c) +DECLARE_SOA_COLUMN(PtProng0, ptProng0, float); //! Transverse momentum of prong0 (GeV/c) +DECLARE_SOA_COLUMN(DecayLength0, decayLength0, float); //! Decay length of D-meson daughter candidate (cm) +DECLARE_SOA_COLUMN(DecayLengthXY0, decayLengthXY0, float); //! Transverse decay length of D-meson daughter candidate (cm) +DECLARE_SOA_COLUMN(ImpactParameter0, impactParameter0, float); //! Impact parameter product of D-meson daughter candidate +DECLARE_SOA_COLUMN(PtDmesProngMin, ptDmesProngMin, float); //! Minimum pT of prongs of D-meson daughter candidate (GeV/c) +DECLARE_SOA_COLUMN(AbsEtaDmesProngMin, absEtaDmesProngMin, float); //! Minimum absolute pseudorapidity of prongs of D-meson daughter candidate +DECLARE_SOA_COLUMN(ItsNClsDmesProngMin, itsNClsDmesProngMin, int); //! Minimum number of ITS clusters of prongs of D-meson daughter candidate +DECLARE_SOA_COLUMN(TpcNClsCrossedRowsDmesProngMin, tpcNClsCrossedRowsDmesProngMin, int); //! Minimum number of TPC crossed rows of prongs of D-meson daughter candidate +DECLARE_SOA_COLUMN(TpcChi2NClDmesProngMax, tpcChi2NClDmesProngMax, float); //! Maximum TPC chi2 of prongs of D-meson daughter candidate +DECLARE_SOA_COLUMN(NSigTpcPiDmesProng0, nSigTpcPiDmesProng0, float); //! TPC Nsigma separation for D-meson prong0 with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTofPiDmesProng0, nSigTofPiDmesProng0, float); //! TOF Nsigma separation for D-meson prong0 with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofPiDmesProng0, nSigTpcTofPiDmesProng0, float); //! Combined TPC and TOF Nsigma separation for D-meson prong0 with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcKaDmesProng1, nSigTpcKaDmesProng1, float); //! TPC Nsigma separation for D-meson prong1 with kaon mass hypothesis +DECLARE_SOA_COLUMN(NSigTofKaDmesProng1, nSigTofKaDmesProng1, float); //! TOF Nsigma separation for D-meson prong1 with kaon mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofKaDmesProng1, nSigTpcTofKaDmesProng1, float); //! Combined TPC and TOF Nsigma separation for D-meson prong1 with kaon mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcPiDmesProng2, nSigTpcPiDmesProng2, float); //! TPC Nsigma separation for D-meson prong2 with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTofPiDmesProng2, nSigTofPiDmesProng2, float); //! TOF Nsigma separation for D-meson prong2 with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofPiDmesProng2, nSigTpcTofPiDmesProng2, float); //! Combined TPC and TOF Nsigma separation for D-meson prong0 with pion mass hypothesis +// pion features +DECLARE_SOA_COLUMN(PtProng1, ptProng1, float); //! Transverse momentum of prong1 (GeV/c) +DECLARE_SOA_COLUMN(AbsEtaProng1, absEtaProng1, float); //! Absolute pseudorapidity of Prong1 +DECLARE_SOA_COLUMN(ItsNClsProng1, itsNClsProng1, int); //! Number of ITS clusters of Prong1 +DECLARE_SOA_COLUMN(TpcNClsCrossedRowsProng1, tpcNClsCrossedRowsProng1, int); //! Number of TPC crossed rows of prongs of Prong1 +DECLARE_SOA_COLUMN(TpcChi2NClProng1, tpcChi2NClProng1, float); //! Maximum TPC chi2 of prongs of D-meson daughter candidate +DECLARE_SOA_COLUMN(ImpactParameterProng1, impactParameterProng1, float); //! Impact parameter product of bachelor pion +DECLARE_SOA_COLUMN(NSigTpcPiProng1, nSigTpcPiProng1, float); //! TPC Nsigma separation for prong1 with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTofPiProng1, nSigTofPiProng1, float); //! TOF Nsigma separation for prong1 with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofPiProng1, nSigTpcTofPiProng1, float); //! Combined TPC and TOF Nsigma separation for prong1 with pion mass hypothesis +// MC truth DECLARE_SOA_COLUMN(FlagWrongCollision, flagWrongCollision, int8_t); //! Flag for association with wrong collision +DECLARE_SOA_COLUMN(PtGen, ptGen, float); //! Transverse momentum of candidate (GeV/c) +// General vars (unused for now) +DECLARE_SOA_COLUMN(P, p, float); //! Momentum of candidate (GeV/c) +DECLARE_SOA_COLUMN(E, e, float); //! Energy of candidate (GeV) } // namespace hf_cand_bs_lite DECLARE_SOA_TABLE(HfRedCandBsLites, "AOD", "HFREDCANDBSLITE", //! Table with some Bs properties + // B meson features + hf_cand_bs_lite::M, + hf_cand_bs_lite::Pt, + hf_cand_bs_lite::Eta, + hf_cand_bs_lite::Phi, + hf_cand_bs_lite::Y, + hf_cand_bs_lite::Cpa, + hf_cand_bs_lite::CpaXY, hf_cand::Chi2PCA, hf_cand_bs_lite::DecayLength, hf_cand_bs_lite::DecayLengthXY, hf_cand_bs_lite::DecayLengthNormalised, hf_cand_bs_lite::DecayLengthXYNormalised, + hf_cand_bs_lite::ImpactParameterProduct, + hf_cand_bs_lite::MaxNormalisedDeltaIP, + hf_cand_bs_lite::MlScoreSig, + hf_sel_candidate_bs::IsSelBsToDsPi, + // D meson features hf_cand_bs_lite::MProng0, hf_cand_bs_lite::PtProng0, - hf_cand_bs_lite::PtProng1, - hf_cand::ImpactParameter0, - hf_cand::ImpactParameter1, - hf_cand_bs_lite::ImpactParameterProduct, - hf_cand_bs_lite::NSigTpcPi1, - hf_cand_bs_lite::NSigTofPi1, + hf_cand_bs_lite::DecayLength0, + hf_cand_bs_lite::DecayLengthXY0, + hf_cand_bs_lite::ImpactParameter0, + hf_cand_bs_lite::PtDmesProngMin, + hf_cand_bs_lite::AbsEtaDmesProngMin, + hf_cand_bs_lite::ItsNClsDmesProngMin, + hf_cand_bs_lite::TpcNClsCrossedRowsDmesProngMin, + hf_cand_bs_lite::TpcChi2NClDmesProngMax, + hf_cand_bs_lite::NSigTpcPiDmesProng0, + hf_cand_bs_lite::NSigTofPiDmesProng0, + hf_cand_bs_lite::NSigTpcTofPiDmesProng0, + hf_cand_bs_lite::NSigTpcKaDmesProng1, + hf_cand_bs_lite::NSigTofKaDmesProng1, + hf_cand_bs_lite::NSigTpcTofKaDmesProng1, + hf_cand_bs_lite::NSigTpcPiDmesProng2, + hf_cand_bs_lite::NSigTofPiDmesProng2, + hf_cand_bs_lite::NSigTpcTofPiDmesProng2, hf_cand_bs_reduced::Prong0MlScoreBkg, hf_cand_bs_reduced::Prong0MlScorePrompt, hf_cand_bs_reduced::Prong0MlScoreNonprompt, - hf_cand_bs_lite::MlScoreSig, - hf_sel_candidate_bs::IsSelBsToDsPi, - hf_cand_bs_lite::M, - hf_cand_bs_lite::Pt, - hf_cand_bs_lite::Cpa, - hf_cand_bs_lite::CpaXY, - hf_cand_bs_lite::MaxNormalisedDeltaIP, - hf_cand_bs_lite::Eta, - hf_cand_bs_lite::Phi, - hf_cand_bs_lite::Y, + // pion features + hf_cand_bs_lite::PtProng1, + hf_cand_bs_lite::AbsEtaProng1, + hf_cand_bs_lite::ItsNClsProng1, + hf_cand_bs_lite::TpcNClsCrossedRowsProng1, + hf_cand_bs_lite::TpcChi2NClProng1, + hf_cand_bs_lite::ImpactParameterProng1, + hf_cand_bs_lite::NSigTpcPiProng1, + hf_cand_bs_lite::NSigTofPiProng1, + hf_cand_bs_lite::NSigTpcTofPiProng1, + // MC truth hf_cand_3prong::FlagMcMatchRec, hf_cand_3prong::OriginMcRec, hf_cand_bs_lite::FlagWrongCollision, @@ -143,6 +196,7 @@ struct HfTaskBsReduced { HfHelper hfHelper; using TracksPion = soa::Join; + using CandsDS = soa::Join; Filter filterSelectCandidates = (aod::hf_sel_candidate_bs::isSelBsToDsPi >= selectionFlagBs); @@ -344,13 +398,13 @@ struct HfTaskBsReduced { /// \param withBsMl is the flag to enable the filling with ML scores for the Bs candidate /// \param candidate is the Bs candidate /// \param candidatesD is the table with Ds- candidates - template + template void fillCand(Cand const& candidate, - aod::HfRed3Prongs const&) + CandsDmes const&) { auto ptCandBs = candidate.pt(); auto invMassBs = hfHelper.invMassBsToDsPi(candidate); - auto candDs = candidate.template prong0_as(); + auto candDs = candidate.template prong0_as(); auto ptDs = candidate.ptProng0(); auto invMassDs = candDs.invMassHypo0() > 0 ? candDs.invMassHypo0() : candDs.invMassHypo1(); // TODO: here we are assuming that only one of the two hypotheses is filled, to be checked @@ -513,32 +567,57 @@ struct HfTaskBsReduced { } hfRedCandBsLite( + // B meson features + invMassBs, + ptCandBs, + candidate.eta(), + candidate.phi(), + hfHelper.yBs(candidate), + candidate.cpa(), + candidate.cpaXY(), candidate.chi2PCA(), candidate.decayLength(), candidate.decayLengthXY(), candidate.decayLengthNormalised(), candidate.decayLengthXYNormalised(), + candidate.impactParameterProduct(), + candidate.maxNormalisedDeltaIP(), + candidateMlScoreSig, + candidate.isSelBsToDsPi(), + // D meson features invMassDs, ptDs, - candidate.ptProng1(), + decLenDs, + decLenXyDs, candidate.impactParameter0(), - candidate.impactParameter1(), - candidate.impactParameterProduct(), - prong1.tpcNSigmaPi(), - prong1.tofNSigmaPi(), + candDs.ptProngMin(), + candDs.absEtaProngMin(), + candDs.itsNClsProngMin(), + candDs.tpcNClsCrossedRowsProngMin(), + candDs.tpcChi2NClProngMax(), + candDs.tpcNSigmaPiProng0(), + candDs.tofNSigmaPiProng0(), + candDs.tpcTofNSigmaPiProng0(), + candDs.tpcNSigmaKaProng1(), + candDs.tofNSigmaKaProng1(), + candDs.tpcTofNSigmaKaProng1(), + candDs.tpcNSigmaKaProng2(), + candDs.tofNSigmaKaProng2(), + candDs.tpcTofNSigmaKaProng2(), prong0MlScoreBkg, prong0MlScorePrompt, prong0MlScoreNonprompt, - candidateMlScoreSig, - candidate.isSelBsToDsPi(), - invMassBs, - ptCandBs, - candidate.cpa(), - candidate.cpaXY(), - candidate.maxNormalisedDeltaIP(), - candidate.eta(), - candidate.phi(), - hfHelper.yBs(candidate), + // pion features + candidate.ptProng1(), + std::abs(RecoDecay::eta(prong1.pVector())), + prong1.itsNCls(), + prong1.tpcNClsCrossedRows(), + prong1.tpcChi2NCl(), + candidate.impactParameter1(), + prong1.tpcNSigmaPi(), + prong1.tofNSigmaPi(), + prong1.tpcTofNSigmaPi(), + // MC truth flagMcMatchRec, isSignal, flagWrongCollision, @@ -612,7 +691,7 @@ struct HfTaskBsReduced { // Process functions void processData(soa::Filtered> const& candidates, - aod::HfRed3Prongs const& candidatesD, + CandsDS const& candidatesD, TracksPion const&) { for (const auto& candidate : candidates) { @@ -625,7 +704,7 @@ struct HfTaskBsReduced { PROCESS_SWITCH(HfTaskBsReduced, processData, "Process data without ML scores for Bs and D daughter", true); void processDataWithDmesMl(soa::Filtered> const& candidates, - aod::HfRed3Prongs const& candidatesD, + CandsDS const& candidatesD, TracksPion const&) { for (const auto& candidate : candidates) { @@ -638,7 +717,7 @@ struct HfTaskBsReduced { PROCESS_SWITCH(HfTaskBsReduced, processDataWithDmesMl, "Process data with(out) ML scores for D daughter (Bs)", false); void processDataWithBsMl(soa::Filtered> const& candidates, - aod::HfRed3Prongs const& candidatesD, + CandsDS const& candidatesD, TracksPion const&) { for (const auto& candidate : candidates) { @@ -652,7 +731,7 @@ struct HfTaskBsReduced { void processMc(soa::Filtered> const& candidates, aod::HfMcGenRedBss const& mcParticles, - aod::HfRed3Prongs const& candidatesD, + CandsDS const& candidatesD, TracksPion const&) { // MC rec @@ -672,7 +751,7 @@ struct HfTaskBsReduced { void processMcWithDecayTypeCheck(soa::Filtered> const& candidates, aod::HfMcGenRedBss const& mcParticles, - aod::HfRed3Prongs const& candidatesD, + CandsDS const& candidatesD, TracksPion const&) { // MC rec @@ -692,7 +771,7 @@ struct HfTaskBsReduced { void processMcWithDmesMl(soa::Filtered> const& candidates, aod::HfMcGenRedBss const& mcParticles, - aod::HfRed3Prongs const& candidatesD, + CandsDS const& candidatesD, TracksPion const&) { // MC rec @@ -712,7 +791,7 @@ struct HfTaskBsReduced { void processMcWithDmesMlAndDecayTypeCheck(soa::Filtered> const& candidates, aod::HfMcGenRedBss const& mcParticles, - aod::HfRed3Prongs const& candidatesD, + CandsDS const& candidatesD, TracksPion const&) { // MC rec @@ -732,7 +811,7 @@ struct HfTaskBsReduced { void processMcWithBsMl(soa::Filtered> const& candidates, aod::HfMcGenRedBss const& mcParticles, - aod::HfRed3Prongs const& candidatesD, + CandsDS const& candidatesD, TracksPion const&) { // MC rec @@ -752,7 +831,7 @@ struct HfTaskBsReduced { void processMcWithBsMlAndDecayTypeCheck(soa::Filtered> const& candidates, aod::HfMcGenRedBss const& mcParticles, - aod::HfRed3Prongs const& candidatesD, + CandsDS const& candidatesD, TracksPion const&) { // MC rec diff --git a/PWGHF/Tasks/taskMcValidation.cxx b/PWGHF/Tasks/taskMcValidation.cxx index 8cf7ea7d0ce..083b85d6255 100644 --- a/PWGHF/Tasks/taskMcValidation.cxx +++ b/PWGHF/Tasks/taskMcValidation.cxx @@ -89,6 +89,7 @@ enum DecayChannels { DzeroToKPi = 0, D2Star0ToDPlusPi, B0ToDminusPi, BplusToD0Pi, + BsToDsPi, LcToPKPi, LcToPiK0s, XiCplusToPKPi, @@ -100,31 +101,33 @@ enum DecayChannels { DzeroToKPi = 0, }; // always keep nChannels at the end static constexpr int nCharmMesonChannels = 10; // number of charm meson channels -static constexpr int nBeautyChannels = 2; // number of beauty hadron channels +static constexpr int nBeautyChannels = 3; // number of beauty hadron channels static constexpr int nCharmBaryonChannels = nChannels - nCharmMesonChannels - nBeautyChannels; // number of charm baryon channels static constexpr int nOriginTypes = 2; // number of origin types (prompt, non-prompt; only for charm hadrons) static constexpr std::array PDGArrayParticle = {o2::constants::physics::Pdg::kD0, o2::constants::physics::Pdg::kDStar, o2::constants::physics::Pdg::kDPlus, o2::constants::physics::Pdg::kDPlus, o2::constants::physics::Pdg::kDS, o2::constants::physics::Pdg::kDS, o2::constants::physics::Pdg::kDS1, o2::constants::physics::Pdg::kDS2Star, - o2::constants::physics::Pdg::kD10, o2::constants::physics::Pdg::kD2Star0, o2::constants::physics::Pdg::kB0, o2::constants::physics::Pdg::kBPlus, o2::constants::physics::Pdg::kLambdaCPlus, - o2::constants::physics::Pdg::kLambdaCPlus, o2::constants::physics::Pdg::kXiCPlus, o2::constants::physics::Pdg::kXiCPlus, o2::constants::physics::Pdg::kXiC0, + o2::constants::physics::Pdg::kD10, o2::constants::physics::Pdg::kD2Star0, + o2::constants::physics::Pdg::kB0, o2::constants::physics::Pdg::kBPlus, o2::constants::physics::Pdg::kBS, + o2::constants::physics::Pdg::kLambdaCPlus, o2::constants::physics::Pdg::kLambdaCPlus, + o2::constants::physics::Pdg::kXiCPlus, o2::constants::physics::Pdg::kXiCPlus, o2::constants::physics::Pdg::kXiC0, o2::constants::physics::Pdg::kOmegaC0, o2::constants::physics::Pdg::kOmegaC0}; -static constexpr std::array nDaughters = {2, 3, 3, 3, 3, 3, 5, 5, 4, 4, 4, 3, 3, 3, 3, 5, 4, 4, 4}; -static constexpr std::array maxDepthForSearch = {1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 2, 2, 3, 2, 4, 3, 3, 3}; +static constexpr std::array nDaughters = {2, 3, 3, 3, 3, 3, 5, 5, 4, 4, 4, 3, 4, 3, 3, 3, 5, 4, 4, 4}; +static constexpr std::array maxDepthForSearch = {1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 2, 3, 2, 3, 2, 4, 3, 3, 3}; // keep coherent indexing with PDGArrayParticle // FIXME: look for a better solution -static constexpr std::array, nChannels> arrPDGFinal2Prong = {{{+kPiPlus, -kKPlus}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}}}; -static constexpr std::array, nChannels> arrPDGFinal3Prong = {{{}, {+kPiPlus, -kKPlus, +kPiPlus}, {+kPiPlus, -kKPlus, +kPiPlus}, {+kKPlus, -kKPlus, +kPiPlus}, {+kKPlus, -kKPlus, +kPiPlus}, {+kKPlus, -kKPlus, +kPiPlus}, {}, {}, {}, {}, {}, {-kPiPlus, +kKPlus, +kPiPlus}, {+kProton, -kKPlus, +kPiPlus}, {+kProton, -kPiPlus, +kPiPlus}, {+kProton, -kKPlus, +kPiPlus}, {}, {}, {}, {}}}; -static constexpr std::array, nChannels> arrPDGFinal4Prong = {{{}, {}, {}, {}, {}, {}, {}, {}, {+kPiPlus, -kKPlus, +kPiPlus, -kPiPlus}, {+kPiPlus, -kKPlus, +kPiPlus, -kPiPlus}, {-kPiPlus, +kKPlus, -kPiPlus, +kPiPlus}, {}, {}, {}, {}, {}, {+kPiPlus, -kPiPlus, -kPiPlus, +kProton}, {+kPiPlus, -kKPlus, -kPiPlus, +kProton}, {+kPiPlus, -kPiPlus, -kPiPlus, +kProton}}}; -static constexpr std::array, nChannels> arrPDGFinal5Prong = {{{}, {}, {}, {}, {}, {}, {+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, {+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, {}, {}, {}, {}, {}, {}, {}, {+kPiPlus, +kPiPlus, -kPiPlus, -kPiPlus, +kProton}, {}, {}, {}}}; +static constexpr std::array, nChannels> arrPDGFinal2Prong = {{{+kPiPlus, -kKPlus}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}}}; +static constexpr std::array, nChannels> arrPDGFinal3Prong = {{{}, {+kPiPlus, -kKPlus, +kPiPlus}, {+kPiPlus, -kKPlus, +kPiPlus}, {+kKPlus, -kKPlus, +kPiPlus}, {+kKPlus, -kKPlus, +kPiPlus}, {+kKPlus, -kKPlus, +kPiPlus}, {}, {}, {}, {}, {}, {-kPiPlus, +kKPlus, +kPiPlus}, {}, {+kProton, -kKPlus, +kPiPlus}, {+kProton, -kPiPlus, +kPiPlus}, {+kProton, -kKPlus, +kPiPlus}, {}, {}, {}, {}}}; +static constexpr std::array, nChannels> arrPDGFinal4Prong = {{{}, {}, {}, {}, {}, {}, {}, {}, {+kPiPlus, -kKPlus, +kPiPlus, -kPiPlus}, {+kPiPlus, -kKPlus, +kPiPlus, -kPiPlus}, {-kPiPlus, +kKPlus, -kPiPlus, +kPiPlus}, {}, {-kKPlus, +kKPlus, -kPiPlus, +kPiPlus}, {}, {}, {}, {}, {+kPiPlus, -kPiPlus, -kPiPlus, +kProton}, {+kPiPlus, -kKPlus, -kPiPlus, +kProton}, {+kPiPlus, -kPiPlus, -kPiPlus, +kProton}}}; +static constexpr std::array, nChannels> arrPDGFinal5Prong = {{{}, {}, {}, {}, {}, {}, {+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, {+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, {}, {}, {}, {}, {}, {}, {}, {}, {+kPiPlus, +kPiPlus, -kPiPlus, -kPiPlus, +kProton}, {}, {}, {}}}; static constexpr std::string_view labels[nChannels] = {"D^{0} #rightarrow K#pi", "D*^{+} #rightarrow D^{0}#pi", "D^{+} #rightarrow K#pi#pi", "D^{+} #rightarrow KK#pi", "D_{s}^{+} #rightarrow #Phi#pi #rightarrow KK#pi", "D_{s}^{+} #rightarrow #bar{K}^{*0}K #rightarrow KK#pi", "D_{s}1 #rightarrow D*^{+}K^{0}_{s}", "D_{s}2* #rightarrow D^{+}K^{0}_{s}", "D1^{0} #rightarrow D*^{+}#pi", "D2^{*} #rightarrow D^{+}#pi", - "B^{0} #rightarrow D^{-}#pi", "B^{+} #rightarrow D^{0}#pi", + "B^{0} #rightarrow D^{-}#pi", "B^{+} #rightarrow D^{0}#pi", "B_{s}^{+} #rightarrow D_{s}^{-}#pi", "#Lambda_{c}^{+} #rightarrow pK#pi", "#Lambda_{c}^{+} #rightarrow pK^{0}_{s}", "#Xi_{c}^{+} #rightarrow pK#pi", "#Xi_{c}^{+} #rightarrow #Xi#pi#pi", "#Xi_{c}^{0} #rightarrow #Xi#pi", "#Omega_{c}^{0} #rightarrow #Omega#pi", "#Omega_{c}^{0} #rightarrow #Xi#pi"}; -static constexpr std::string_view particleNames[nChannels] = {"DzeroToKPi", "DstarToDzeroPi", "DplusToPiKPi", "DplusToPhiPiToKKPi", "DsToPhiPiToKKPi", "DsToK0starKToKKPi", "Ds1ToDStarK0s", "Ds2StarToDPlusK0s", "D10ToDStarPi", "D2Star0ToDPlusPi", "B0ToDminusPi", "BplusToD0Pi", +static constexpr std::string_view particleNames[nChannels] = {"DzeroToKPi", "DstarToDzeroPi", "DplusToPiKPi", "DplusToPhiPiToKKPi", "DsToPhiPiToKKPi", "DsToK0starKToKKPi", "Ds1ToDStarK0s", "Ds2StarToDPlusK0s", "D10ToDStarPi", "D2Star0ToDPlusPi", "B0ToDminusPi", "BplusToD0Pi", "BsToDsPi", "LcToPKPi", "LcToPiK0s", "XiCplusToPKPi", "XiCplusToXiPiPi", "XiCzeroToXiPi", "OmegaCToOmegaPi", "OmegaCToXiPi"}; static constexpr std::string_view originNames[nOriginTypes] = {"Prompt", "NonPrompt"}; } // namespace @@ -417,6 +420,10 @@ struct HfTaskMcValidationGen { !RecoDecay::isMatchedMCGen(mcParticles, particle, PDGArrayParticle[iD], std::array{-o2::constants::physics::Pdg::kDPlus, +kPiPlus}, true)) { continue; } + if (iD == BsToDsPi && + !RecoDecay::isMatchedMCGen(mcParticles, particle, PDGArrayParticle[iD], std::array{-o2::constants::physics::Pdg::kDS, +kPiPlus}, true)) { + continue; + } } if (nDaughters[iD] == 5) { From 0de6a247c8b4a9b191c534330984f08b305f9589 Mon Sep 17 00:00:00 2001 From: Mattia Faggin Date: Mon, 25 Aug 2025 13:55:34 +0200 Subject: [PATCH 182/986] [Infrastructure] Add Stefano as codeowner for HF. (#12722) Co-authored-by: Mattia Faggin --- CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CODEOWNERS b/CODEOWNERS index 57766839579..ec7e9f11b77 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -38,7 +38,7 @@ /PWGEM @alibuild @feisenhu @dsekihat @ivorobye /PWGEM/Dilepton @alibuild @mikesas @rbailhac @dsekihat @ivorobye @feisenhu @hscheid /PWGEM/PhotonMeson @alibuild @mikesas @rbailhac @m-c-danisch @novitzky @mhemmer-cern @dsekihat -/PWGHF @alibuild @vkucera @fcolamar @fgrosa @fcatalan92 @mfaggin @mmazzilli @deepathoms @NicoleBastid @hahassan7 @jpxrk @apalasciano @zhangbiao-phy @gluparel +/PWGHF @alibuild @vkucera @fcolamar @fgrosa @fcatalan92 @mfaggin @mmazzilli @deepathoms @NicoleBastid @hahassan7 @jpxrk @apalasciano @zhangbiao-phy @gluparel @stefanopolitano # PWG-LF /PWGLF @alibuild @sustripathy @skundu692 /PWGLF/DataModel @alibuild @sustripathy @skundu692 @gbencedi @abmodak @fmazzasc @maciacco @dmallick2 @smaff92 @ercolessi @romainschotter From 93be4fbcbc96acb00a4f4e1277c2c649d0a5f31e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Mart=C3=ADnez=20Garc=C3=ADa?= Date: Mon, 25 Aug 2025 06:03:00 -0600 Subject: [PATCH 183/986] [PWGUD] Correlation for both sides and NUA correction (#12596) --- PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx | 692 ++++++++++++++------- 1 file changed, 468 insertions(+), 224 deletions(-) diff --git a/PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx b/PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx index d20a78429dd..d0b69e05aaf 100644 --- a/PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx +++ b/PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx @@ -8,33 +8,36 @@ // 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. -/// -/// \brief -/// \author Josué Martínez García, josuem@cern.ch -/// \file upcPhotonuclearAnalysisJMG.cxx -#include +/// \file upcPhotonuclearAnalysisJMG.cxx +/// \brief Task for photonuclear UPC analysis for azimuthal correlation: selection, histograms and observables. +/// \author Josué Martínez García -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "CCDB/BasicCCDBManager.h" -#include "Framework/StepTHn.h" -#include "CommonConstants/MathConstants.h" -#include +#include "PWGCF/Core/CorrelationContainer.h" +#include "PWGUD/Core/UPCPairCuts.h" +#include "PWGUD/Core/UPCTauCentralBarrelHelperRL.h" +#include "PWGUD/DataModel/UDTables.h" #include "Common/CCDB/EventSelectionParams.h" +#include "Common/Core/RecoDecay.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectionDefaults.h" #include "Common/Core/trackUtilities.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "PWGCF/Core/CorrelationContainer.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/MathConstants.h" #include "DataFormatsParameters/GRPObject.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" -#include "PWGUD/DataModel/UDTables.h" -#include "PWGUD/Core/UPCPairCuts.h" -#include "PWGUD/Core/UPCTauCentralBarrelHelperRL.h" +#include + +#include +#include using namespace o2; using namespace o2::framework; @@ -47,21 +50,21 @@ namespace tree DECLARE_SOA_COLUMN(PtSideA, ptSideA, std::vector); DECLARE_SOA_COLUMN(RapSideA, rapSideA, std::vector); DECLARE_SOA_COLUMN(PhiSideA, phiSideA, std::vector); -DECLARE_SOA_COLUMN(TPCSignalSideA, tpcSignalSideA, std::vector); -DECLARE_SOA_COLUMN(TOFSignalSideA, tofSignalSideA, std::vector); -DECLARE_SOA_COLUMN(TPCNSigmaPiSideA, tpcNSigmaPiSideA, std::vector); -DECLARE_SOA_COLUMN(TOFNSigmaPiSideA, tofNSigmaPiSideA, std::vector); -DECLARE_SOA_COLUMN(TPCNSigmaKaSideA, tpcNSigmaKaSideA, std::vector); -DECLARE_SOA_COLUMN(TOFNSigmaKaSideA, tofNSigmaKaSideA, std::vector); +DECLARE_SOA_COLUMN(TpcSignalSideA, tpcSignalSideA, std::vector); +DECLARE_SOA_COLUMN(TofSignalSideA, tofSignalSideA, std::vector); +DECLARE_SOA_COLUMN(TpcNSigmaPiSideA, tpcNSigmaPiSideA, std::vector); +DECLARE_SOA_COLUMN(TofNSigmaPiSideA, tofNSigmaPiSideA, std::vector); +DECLARE_SOA_COLUMN(TpcNSigmaKaSideA, tpcNSigmaKaSideA, std::vector); +DECLARE_SOA_COLUMN(TofNSigmaKaSideA, tofNSigmaKaSideA, std::vector); DECLARE_SOA_COLUMN(PtSideC, ptSideC, std::vector); DECLARE_SOA_COLUMN(RapSideC, rapSideC, std::vector); DECLARE_SOA_COLUMN(PhiSideC, phiSideC, std::vector); -DECLARE_SOA_COLUMN(TPCSignalSideC, tpcSignalSideC, std::vector); -DECLARE_SOA_COLUMN(TOFSignalSideC, tofSignalSideC, std::vector); -DECLARE_SOA_COLUMN(TPCNSigmaPiSideC, tpcNSigmaPiSideC, std::vector); -DECLARE_SOA_COLUMN(TOFNSigmaPiSideC, tofNSigmaPiSideC, std::vector); -DECLARE_SOA_COLUMN(TPCNSigmaKaSideC, tpcNSigmaKaSideC, std::vector); -DECLARE_SOA_COLUMN(TOFNSigmaKaSideC, tofNSigmaKaSideC, std::vector); +DECLARE_SOA_COLUMN(TpcSignalSideC, tpcSignalSideC, std::vector); +DECLARE_SOA_COLUMN(TofSignalSideC, tofSignalSideC, std::vector); +DECLARE_SOA_COLUMN(TpcNSigmaPiSideC, tpcNSigmaPiSideC, std::vector); +DECLARE_SOA_COLUMN(TofNSigmaPiSideC, tofNSigmaPiSideC, std::vector); +DECLARE_SOA_COLUMN(TpcNSigmaKaSideC, tpcNSigmaKaSideC, std::vector); +DECLARE_SOA_COLUMN(TofNSigmaKaSideC, tofNSigmaKaSideC, std::vector); DECLARE_SOA_COLUMN(NchSideA, nchSideA, int); DECLARE_SOA_COLUMN(MultiplicitySideA, multiplicitySideA, int); DECLARE_SOA_COLUMN(NchSideC, nchSideC, int); @@ -71,21 +74,21 @@ DECLARE_SOA_TABLE(TREE, "AOD", "Tree", tree::PtSideA, tree::RapSideA, tree::PhiSideA, - tree::TPCSignalSideA, - tree::TOFSignalSideA, - tree::TPCNSigmaPiSideA, - tree::TOFNSigmaPiSideA, - tree::TPCNSigmaKaSideA, - tree::TOFNSigmaKaSideA, + tree::TpcSignalSideA, + tree::TofSignalSideA, + tree::TpcNSigmaPiSideA, + tree::TofNSigmaPiSideA, + tree::TpcNSigmaKaSideA, + tree::TofNSigmaKaSideA, tree::PtSideC, tree::RapSideC, tree::PhiSideC, - tree::TPCSignalSideC, - tree::TOFSignalSideC, - tree::TPCNSigmaPiSideC, - tree::TOFNSigmaPiSideC, - tree::TPCNSigmaKaSideC, - tree::TOFNSigmaKaSideC, + tree::TpcSignalSideC, + tree::TofSignalSideC, + tree::TpcNSigmaPiSideC, + tree::TofNSigmaPiSideC, + tree::TpcNSigmaKaSideC, + tree::TofNSigmaKaSideC, tree::NchSideA, tree::MultiplicitySideA, tree::NchSideC, @@ -93,8 +96,9 @@ DECLARE_SOA_TABLE(TREE, "AOD", "Tree", } // namespace o2::aod static constexpr float CFGPairCutDefaults[1][5] = {{-1, -1, -1, -1, -1}}; +constexpr float kThreeHalfPi = 1.5f * PI; -struct upcPhotonuclearAnalysisJMG { +struct UpcPhotonuclearAnalysisJMG { Produces tree; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -106,20 +110,20 @@ struct upcPhotonuclearAnalysisJMG { Configurable myTimeZNACut{"myTimeZNACut", 2., {"My collision cut"}}; Configurable myTimeZNCCut{"myTimeZNCCut", 2., {"My collision cut"}}; // Declare configurables on side A gap - Configurable cutAGapMyEnergyZNAMax{"cutAGapMyEnergyZNAMax", 0., {"My collision cut. A Gap"}}; + Configurable cutGapAMyEnergyZNA{"cutGapAMyEnergyZNA", 0., {"My collision cut. A Gap"}}; // Configurable cutAGapMyAmplitudeFT0AMax{"cutAGapMyAmplitudeFT0AMax", 200., {"My collision cut. A Gap"}}; - Configurable cutAGapMyEnergyZNCMin{"cutAGapMyEnergyZNCMin", 1., {"My collision cut. A Gap"}}; + Configurable cutGapAMyEnergyZNC{"cutGapAMyEnergyZNC", 1., {"My collision cut. A Gap"}}; // Configurable cutAGapMyAmplitudeFT0CMin{"cutAGapMyAmplitudeFT0CMin", 0., {"My collision cut. A Gap"}}; // Declare configurables on side C gap - Configurable cutCGapMyEnergyZNAMin{"cutCGapMyEnergyZNAMin", 1., {"My collision cut. C Gap"}}; + Configurable cutGapCMyEnergyZNA{"cutGapCMyEnergyZNA", 1., {"My collision cut. C Gap"}}; // Configurable cutCGapMyAmplitudeFT0AMin{"cutCGapMyAmplitudeFT0AMin", 0., {"My collision cut. A Gap"}}; - Configurable cutCGapMyEnergyZNCMax{"cutCGapMyEnergyZNCMax", 0., {"My collision cut. C Gap"}}; + Configurable cutGapCMyEnergyZNC{"cutGapCMyEnergyZNC", 0., {"My collision cut. C Gap"}}; // Configurable cutCGapMyAmplitudeFT0CMax{"cutCGapMyAmplitudeFT0CMax", 200., {"My collision cut. A Gap"}}; // Declare configurables on tracks - Configurable cutMyptMin{"cutMyptMin", 0.15, {"My Track cut"}}; - Configurable cutMyptMax{"cutMyptMax", 10., {"My Track cut"}}; - Configurable cutMyetaMin{"cutMyetaMin", -0.9, {"My Track cut"}}; - Configurable cutMyetaMax{"cutMyetaMax", 0.9, {"My Track cut"}}; + Configurable cutMyptMin{"cutMyptMin", 0.2, {"My Track cut"}}; + Configurable cutMyptMax{"cutMyptMax", 3., {"My Track cut"}}; + Configurable cutMyetaMin{"cutMyetaMin", -0.8, {"My Track cut"}}; + Configurable cutMyetaMax{"cutMyetaMax", 0.8, {"My Track cut"}}; Configurable cutMydcaZmax{"cutMydcaZmax", 2.f, {"My Track cut"}}; Configurable cutMydcaXYmax{"cutMydcaXYmax", 1e0f, {"My Track cut"}}; Configurable cutMydcaXYusePt{"cutMydcaXYusePt", false, {"My Track cut"}}; @@ -133,6 +137,10 @@ struct upcPhotonuclearAnalysisJMG { Configurable cutMyTPCNClsCrossedRowsOverNClsFindableMin{"cutMyTPCNClsCrossedRowsOverNClsFindableMin", 0.8f, {"My Track cut"}}; Configurable cutMyTPCNClsOverFindableNClsMin{"cutMyTPCNClsOverFindableNClsMin", 0.5f, {"My Track cut"}}; Configurable cutMyTPCChi2NclMax{"cutMyTPCChi2NclMax", 4.f, {"My Track cut"}}; + Configurable myWeightMin{"myWeightMin", 0.2f, {"My Track cut"}}; + Configurable myWeightMax{"myWeightMax", 5.f, {"My Track cut"}}; + Configurable myEpsilonToWeight{"myEpsilonToWeight", 1e-6f, {"My Track cut"}}; + Configurable useEpsilon{"useEpsilon", false, {"My Track cut"}}; Configurable> cfgPairCut{"cfgPairCut", {CFGPairCutDefaults[0], 5, @@ -144,22 +152,26 @@ struct upcPhotonuclearAnalysisJMG { ConfigurableAxis axisDeltaEta{"axisDeltaEta", {40, -2, 2}, "delta eta axis for histograms"}; ConfigurableAxis axisPtTrigger{"axisPtTrigger", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 10.0}, "pt trigger axis for histograms"}; ConfigurableAxis axisPtAssoc{"axisPtAssoc", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0}, "pt associated axis for histograms"}; - ConfigurableAxis axisMultiplicity{"axisMultiplicity", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110.1}, "multiplicity / multiplicity axis for histograms"}; + ConfigurableAxis axisMultiplicity{"axisMultiplicity", {VARIABLE_WIDTH, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100, 110.1}, "multiplicity / multiplicity axis for histograms"}; ConfigurableAxis axisVertexEfficiency{"axisVertexEfficiency", {10, -10, 10}, "vertex axis for efficiency histograms"}; ConfigurableAxis axisEtaEfficiency{"axisEtaEfficiency", {20, -1.0, 1.0}, "eta axis for efficiency histograms"}; ConfigurableAxis axisPtEfficiency{"axisPtEfficiency", {VARIABLE_WIDTH, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 2.75, 3.0, 3.25, 3.5, 3.75, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0}, "pt axis for efficiency histograms"}; Filter collisionZVtxFilter = nabs(aod::collision::posZ) < myZVtxCut; Filter collisionZNTimeFilter = nabs(aod::udzdc::timeZNA) < myTimeZNACut && nabs(aod::udzdc::timeZNC) < myTimeZNCCut; + Filter collisionZNeEnergyFilter = (aod::udzdc::energyCommonZNA < cutGapAMyEnergyZNA && aod::udzdc::energyCommonZNC >= cutGapAMyEnergyZNC) || (aod::udzdc::energyCommonZNA >= cutGapCMyEnergyZNA && aod::udzdc::energyCommonZNC < cutGapCMyEnergyZNC); + Filter collisioSGFilter = aod::udcollision::gapSide == uint8_t(0) || aod::udcollision::gapSide == uint8_t(1); using FullSGUDCollision = soa::Filtered>; using FullUDTracks = soa::Join; // Output definitions - OutputObj sameGapSideA{"sameEventGapSideA"}; - OutputObj mixedGapSideA{"mixedEventGapSideA"}; - OutputObj sameGapSideC{"sameEventGapSideC"}; - OutputObj mixedGapSideC{"mixedEventGapSideC"}; + OutputObj same{"sameEvent"}; + OutputObj mixed{"mixedEvent"}; + // OutputObj sameGapSideA{"sameEventGapSideA"}; + // OutputObj mixedGapSideA{"mixedEventGapSideA"}; + // OutputObj sameGapSideC{"sameEventGapSideC"}; + // OutputObj mixedGapSideC{"mixedEventGapSideC"}; UPCPairCuts mPairCuts; bool doPairCuts = false; @@ -167,22 +179,25 @@ struct upcPhotonuclearAnalysisJMG { void init(InitContext const&) { const AxisSpec axisCollision{4, -0.5, 3.5}; - const AxisSpec axisZvtx{40, -20., 20.}; + const AxisSpec axisZvtx{20, -10., 10.}; const AxisSpec axisPt{402, -0.05, 20.05}; const AxisSpec axisP{402, -10.05, 10.05}; const AxisSpec axisTPCSignal{802, -0.05, 400.05}; - const AxisSpec axisPhi{64, -2 * PI, 2 * PI}; - const AxisSpec axisEta{50, -1.2, 1.2}; - const AxisSpec axisNch{201, -0.5, 200.5}; + const AxisSpec axisPhi{64, 0., TwoPI}; + const AxisSpec axisEta{32, -0.8, 0.8}; + const AxisSpec axisNch{601, -0.5, 600.5}; const AxisSpec axisZNEnergy{1002, -0.5, 500.5}; const AxisSpec axisZNTime{21, -10.5, 10.5}; const AxisSpec axisFT0Amplitud{201, -0.5, 200.5}; const AxisSpec axisNCls{201, -0.5, 200.5}; const AxisSpec axisChi2NCls{100, 0, 50}; const AxisSpec axisTPCNClsCrossedRowsMin{100, -0.05, 2.05}; + const AxisSpec axisCountTracks{17, -0.5, 16.5}; histos.add("yields", "multiplicity vs pT vs eta", {HistType::kTH3F, {{100, 0, 100, "multiplicity"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}}); - histos.add("etaphi", "multiplicity vs eta vs phi", {HistType::kTH3F, {{100, 0, 100, "multiplicity"}, {100, -2, 2, "#eta"}, {200, 0, 2 * PI, "#varphi"}}}); + histos.add("etaphi", "multiplicity vs eta vs phi", {HistType::kTH3F, {{100, 0, 100, "multiplicity"}, {100, -2, 2, "#eta"}, {64, 0., TwoPI, "#varphi"}}}); + histos.add("etaphiVtx", "vertex Z vs eta vs phi", {HistType::kTH3F, {{20, -10., 10., "vertex Z"}, {32, -0.8, 0.8, "#eta"}, {64, 0., TwoPI, "#varphi"}}}); + histos.add("weightNUA", "weight per bin", {HistType::kTH3F, {{20, -10., 10., "vertex Z"}, {32, -0.8, 0.8, "#eta"}, {64, 0., TwoPI, "#varphi"}}}); const int maxMixBin = axisMultiplicity->size() * axisVertex->size(); histos.add("eventcount", "bin", {HistType::kTH1F, {{maxMixBin + 2, -2.5, -0.5 + maxMixBin, "bin"}}}); @@ -197,6 +212,10 @@ struct upcPhotonuclearAnalysisJMG { doPairCuts = true; } histos.add("Events/hCountCollisions", "0 total - 1 side A - 2 side C - 3 both side; Number of analysed collision; counts", kTH1F, {axisCollision}); + histos.add("Events/hCountCollisionsMixed", "0 total - 1 side A - 2 side C - 3 both side; Number of analysed collision; counts", kTH1F, {axisCollision}); + histos.add("Tracks/hTracksAfterCuts", " ; ; counts", kTH1F, {axisCountTracks}); + histos.add("Tracks/hTrackPhiBeforeCorr", "#it{#phi} distribution before NUA correction; #it{#phi}; counts", kTH1F, {axisPhi}); + histos.add("Tracks/hTrackPhiAfterCorr", "#it{#phi} distribution after NUA correction; #it{#phi}; counts", kTH1F, {axisPhi}); // histos to selection gap in side A histos.add("Tracks/SGsideA/hTrackPt", "#it{p_{T}} distribution; #it{p_{T}}; counts", kTH1F, {axisPt}); @@ -228,6 +247,7 @@ struct upcPhotonuclearAnalysisJMG { histos.add("Events/SGsideA/hTimeRelationSides", "Time in side A vs time in side C; Time in side A; Time in side C", kTH2F, {axisZNTime, axisZNTime}); histos.add("Events/SGsideA/hAmplitudFT0A", "Amplitud in side A distribution; Amplitud in side A; counts", kTH1F, {axisFT0Amplitud}); histos.add("Events/SGsideA/hAmplitudFT0C", "Amplitud in side C distribution; Amplitud in side C; counts", kTH1F, {axisFT0Amplitud}); + histos.add("Events/SGsideA/hTrackPV", "#it{Nch vs Nch(PV)}; #it{N_{ch}(PV)}; #it{N_{ch}}", kTH2F, {axisNch, axisNch}); // histos to selection gap in side C histos.add("Tracks/SGsideC/hTrackPt", "#it{p_{T}} distribution; #it{p_{T}}; counts", kTH1F, {axisPt}); @@ -259,6 +279,7 @@ struct upcPhotonuclearAnalysisJMG { histos.add("Events/SGsideC/hTimeRelationSides", "Time in side A vs time in side C; Time in side A; Time in side C", kTH2F, {axisZNTime, axisZNTime}); histos.add("Events/SGsideC/hAmplitudFT0A", "Amplitud in side A distribution; Amplitud in side A; counts", kTH1F, {axisFT0Amplitud}); histos.add("Events/SGsideC/hAmplitudFT0C", "Amplitud in side C distribution; Amplitud in side C; counts", kTH1F, {axisFT0Amplitud}); + histos.add("Events/SGsideC/hTrackPV", "#it{Nch vs Nch(PV)}; #it{N_{ch}(PV)}; #it{N_{ch}}", kTH2F, {axisNch, axisNch}); std::vector corrAxis = {{axisDeltaEta, "#Delta#eta"}, {axisPtAssoc, "p_{T} (GeV/c)"}, @@ -270,52 +291,66 @@ struct upcPhotonuclearAnalysisJMG { {axisEtaEfficiency, "#eta"}, {axisPtEfficiency, "p_{T} (GeV/c)"}, {axisVertexEfficiency, "z-vtx (cm)"}}; - sameGapSideA.setObject(new CorrelationContainer("sameEventGapSideA", "sameEventGapSideA", corrAxis, effAxis, {})); - mixedGapSideA.setObject(new CorrelationContainer("mixedEventGapSideA", "mixedEventGapSideA", corrAxis, effAxis, {})); - sameGapSideC.setObject(new CorrelationContainer("sameEventGapSideC", "sameEventGapSideC", corrAxis, effAxis, {})); - mixedGapSideC.setObject(new CorrelationContainer("mixedEventGapSideC", "mixedEventGapSideC", corrAxis, effAxis, {})); + same.setObject(new CorrelationContainer("sameEvent", "sameEvent", corrAxis, effAxis, {})); + mixed.setObject(new CorrelationContainer("mixedEvent", "mixedEvent", corrAxis, effAxis, {})); + // sameGapSideA.setObject(new CorrelationContainer("sameEventGapSideA", "sameEventGapSideA", corrAxis, effAxis, {})); + // mixedGapSideA.setObject(new CorrelationContainer("mixedEventGapSideA", "mixedEventGapSideA", corrAxis, effAxis, {})); + // sameGapSideC.setObject(new CorrelationContainer("sameEventGapSideC", "sameEventGapSideC", corrAxis, effAxis, {})); + // mixedGapSideC.setObject(new CorrelationContainer("mixedEventGapSideC", "mixedEventGapSideC", corrAxis, effAxis, {})); } std::vector vtxBinsEdges{VARIABLE_WIDTH, -10.0f, -7.0f, -5.0f, -2.5f, 0.0f, 2.5f, 5.0f, 7.0f, 10.0f}; std::vector gapSideBinsEdges{VARIABLE_WIDTH, -0.5, 0.5, 1.5}; SliceCache cache; - int countGapA = 0; - int countGapC = 0; + // int countEvents = 0; + // int countGapA = 0; + // int countGapC = 0; // Binning only on PosZ without multiplicity - // using BinningType = ColumnBinningPolicy; using BinningType = ColumnBinningPolicy; - BinningType bindingOnVtx{{vtxBinsEdges, gapSideBinsEdges}, true}; - SameKindPair pairs{bindingOnVtx, nEventsMixed, -1, &cache}; + // BinningType bindingOnVtx{{vtxBinsEdges, gapSideBinsEdges}, true}; + // using BinningType = ColumnBinningPolicy; + // BinningType bindingOnVtx{{vtxBinsEdges}, true}; + // SameKindPair pairs{bindingOnVtx, nEventsMixed, -1, &cache}; template bool isCollisionCutSG(CSG const& collision, int SideGap) { + bool gapSideA = (collision.energyCommonZNA() < cutGapAMyEnergyZNA) && (collision.energyCommonZNC() >= cutGapAMyEnergyZNC); + bool gapSideC = (collision.energyCommonZNA() >= cutGapCMyEnergyZNA) && (collision.energyCommonZNC() < cutGapCMyEnergyZNC); + switch (SideGap) { - case 0: // Gap in A side - if ((collision.energyCommonZNA() < cutAGapMyEnergyZNAMax && collision.energyCommonZNC() >= cutAGapMyEnergyZNCMin) == false) { // 0n - A side && Xn - C Side - return false; - } + case 0: // Gap in A side + return gapSideA; // 0n - A side && Xn - C Side // if ((collision.totalFT0AmplitudeA() < cutAGapMyAmplitudeFT0AMax && collision.totalFT0AmplitudeC() >= cutAGapMyAmplitudeFT0CMin) == false) { // return false; // } break; - case 1: // Gap in C side - if ((collision.energyCommonZNA() >= cutCGapMyEnergyZNAMin && collision.energyCommonZNC() < cutCGapMyEnergyZNCMax) == false) { // Xn - A side && 0n - C Side - return false; - } + case 1: // Gap in C side + return gapSideC; // Xn - A side && 0n - C Side // if ((collision.totalFT0AmplitudeA() >= cutCGapMyAmplitudeFT0AMin && collision.totalFT0AmplitudeC() < cutCGapMyAmplitudeFT0CMax) == false) { // return false; // } break; + default: + return false; + break; } - return true; + } + + template + bool isCollisionCutSG(CSG const& collision) + { + return isCollisionCutSG(collision, 0) || isCollisionCutSG(collision, 1); } template bool isTrackCut(T const& track) { + if (track.sign() != 1 && track.sign() != -1) { + return false; + } if (track.pt() < cutMyptMin || track.pt() > cutMyptMax) { return false; } @@ -335,6 +370,9 @@ struct upcPhotonuclearAnalysisJMG { return false; } } + if (track.isPVContributor() == false) { + return false; + } // Quality Track // ITS if (cutMyHasITS && !track.hasITS()) { @@ -372,11 +410,14 @@ struct upcPhotonuclearAnalysisJMG { } template - void fillQAUD(const TTracks tracks) + void fillQAUD(const TTracks tracks, float multiplicity) { for (const auto& track : tracks) { - histos.fill(HIST("yields"), tracks.size(), track.pt(), eta(track.px(), track.py(), track.pz())); - histos.fill(HIST("etaphi"), tracks.size(), eta(track.px(), track.py(), track.pz()), phi(track.px(), track.py())); + if (isTrackCut(track) == false) { + continue; + } + histos.fill(HIST("yields"), multiplicity, track.pt(), eta(track.px(), track.py(), track.pz())); + histos.fill(HIST("etaphi"), multiplicity, eta(track.px(), track.py(), track.pz()), phi(track.px(), track.py())); } } @@ -394,7 +435,7 @@ struct upcPhotonuclearAnalysisJMG { multiplicity = tracks1.size(); for (const auto& track1 : tracks1) { if (isTrackCut(track1) == false) { - continue; + return; } target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, track1.pt(), multiplicity, posZ, 1.0); for (const auto& track2 : tracks2) { @@ -402,35 +443,96 @@ struct upcPhotonuclearAnalysisJMG { continue; } if (isTrackCut(track2) == false) { - continue; + return; } - if (doPairCuts && mPairCuts.conversionCuts(track1, track2)) { + /*if (doPairCuts && mPairCuts.conversionCuts(track1, track2)) { continue; - } + }*/ float deltaPhi = phi(track1.px(), track1.py()) - phi(track2.px(), track2.py()); - if (deltaPhi > 1.5f * PI) { - deltaPhi -= TwoPI; + deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf, kThreeHalfPi); + target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, eta(track1.px(), track1.py(), track1.pz()) - eta(track2.px(), track2.py(), track2.pz()), track2.pt(), track1.pt(), multiplicity, deltaPhi, posZ, 1.0); + } + } + } + + void makeNUAWeights(std::shared_ptr histoRaw3D) + { + const int nPhi = histoRaw3D->GetZaxis()->GetNbins(); + const int nEta = histoRaw3D->GetYaxis()->GetNbins(); + const int nVz = histoRaw3D->GetXaxis()->GetNbins(); + + for (int jEtha = 1; jEtha <= nEta; ++jEtha) { + for (int iVtxZ = 1; iVtxZ <= nVz; ++iVtxZ) { + // average on phi to (eta_jEtha, vz_iVtxZ) + double sum = 0, count = 0; + for (int kPhi = 1; kPhi <= nPhi; ++kPhi) { + sum += histoRaw3D->GetBinContent(iVtxZ, jEtha, kPhi); + count += 1.0; } - if (deltaPhi < -PIHalf) { - deltaPhi += TwoPI; + const double nMean = (count > 0) ? sum / count : 0.0; + + for (int kPhi = 1; kPhi <= nPhi; ++kPhi) { + double nEntry = histoRaw3D->GetBinContent(iVtxZ, jEtha, kPhi); + double w; + if (useEpsilon) { + if (nMean > 0) { + w = nMean / std::max(nEntry, static_cast(myEpsilonToWeight)); + } else { + w = 1.0; + } + } else { + if (nMean > 0) { + w = nMean / nEntry; + } else { + w = 1.0; + } + } + if (w < myWeightMin) + w = myWeightMin; + if (w > myWeightMax) + w = myWeightMax; + if (auto histoWeightNUA = histos.get(HIST("weightNUA"))) { + histoWeightNUA->SetBinContent(iVtxZ, jEtha, kPhi, w); + } } - target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, eta(track1.px(), track1.py(), track1.pz()) - eta(track2.px(), track2.py(), track2.pz()), track2.pt(), track1.pt(), multiplicity, deltaPhi, posZ, 1.0); } } } + float getNUAWeight(float vz, float eta, float phi) + { + auto hWeight = histos.get(HIST("weightNUA")); + phi = RecoDecay::constrainAngle(phi, 0.f, TwoPI); + int iPhi = hWeight->GetZaxis()->FindBin(phi); + int iEta = hWeight->GetYaxis()->FindBin(eta); + int iVz = hWeight->GetXaxis()->FindBin(vz); + return hWeight->GetBinContent(iVz, iEta, iPhi); + } + void processSG(FullSGUDCollision::iterator const& reconstructedCollision, FullUDTracks const& reconstructedTracks) { histos.fill(HIST("Events/hCountCollisions"), 0); int sgSide = reconstructedCollision.gapSide(); int nTracksCharged = 0; float sumPt = 0; + int nchPVGapSideA = 0; + int nchPVGapSideC = 0; + int nchGapSideA = 0; + int nchGapSideC = 0; std::vector vTrackPtSideA, vTrackEtaSideA, vTrackPhiSideA, vTrackTPCSignalSideA, vTrackTOFSignalSideA, vTrackTPCNSigmaPiSideA, vTrackTOFNSigmaPiSideA, vTrackTPCNSigmaKaSideA, vTrackTOFNSigmaKaSideA; std::vector vTrackPtSideC, vTrackEtaSideC, vTrackPhiSideC, vTrackTPCSignalSideC, vTrackTOFSignalSideC, vTrackTPCNSigmaPiSideC, vTrackTOFNSigmaPiSideC, vTrackTPCNSigmaKaSideC, vTrackTOFNSigmaKaSideC; int nTracksChargedSideA(-222), nTracksChargedSideC(-222); int multiplicitySideA(-222), multiplicitySideC(-222); + for (const auto& track : reconstructedTracks) { + if (isTrackCut(track) == false) { + continue; + } + histos.fill(HIST("etaphiVtx"), reconstructedCollision.posZ(), eta(track.px(), track.py(), track.pz()), phi(track.px(), track.py())); + histos.fill(HIST("Tracks/hTrackPhiBeforeCorr"), phi(track.px(), track.py())); + } + switch (sgSide) { case 0: // gap for side A if (isCollisionCutSG(reconstructedCollision, 0) == false) { @@ -447,43 +549,47 @@ struct upcPhotonuclearAnalysisJMG { histos.fill(HIST("Events/SGsideA/hAmplitudFT0A"), reconstructedCollision.totalFT0AmplitudeA()); histos.fill(HIST("Events/SGsideA/hAmplitudFT0C"), reconstructedCollision.totalFT0AmplitudeC()); for (const auto& track : reconstructedTracks) { - if (track.sign() == 1 || track.sign() == -1) { - if (isTrackCut(track) == false) { - continue; - } - nTracksCharged++; - sumPt += track.pt(); - histos.fill(HIST("Tracks/SGsideA/hTrackPt"), track.pt()); - histos.fill(HIST("Tracks/SGsideA/hTrackPhi"), phi(track.px(), track.py())); - histos.fill(HIST("Tracks/SGsideA/hTrackEta"), eta(track.px(), track.py(), track.pz())); - histos.fill(HIST("Tracks/SGsideA/hTrackTPCSignnalP"), momentum(track.px(), track.py(), track.pz()) * track.sign(), track.tpcSignal()); - histos.fill(HIST("Tracks/SGsideA/hTrackTOFSignnalP"), momentum(track.px(), track.py(), track.pz()) * track.sign(), track.tofSignal()); - vTrackPtSideA.push_back(track.pt()); - vTrackEtaSideA.push_back(eta(track.px(), track.py(), track.pz())); - vTrackPhiSideA.push_back(phi(track.px(), track.py())); - vTrackTPCSignalSideA.push_back(track.tpcSignal()); - vTrackTOFSignalSideA.push_back(track.tofSignal()); - vTrackTPCNSigmaPiSideA.push_back(track.tpcNSigmaPi()); - vTrackTOFNSigmaPiSideA.push_back(track.tofNSigmaPi()); - vTrackTPCNSigmaKaSideA.push_back(track.tpcNSigmaKa()); - vTrackTOFNSigmaKaSideA.push_back(track.tofNSigmaKa()); - - histos.fill(HIST("Tracks/SGsideA/hTrackITSNCls"), track.itsNCls()); - histos.fill(HIST("Tracks/SGsideA/hTrackITSChi2NCls"), track.itsChi2NCl()); - histos.fill(HIST("Tracks/SGsideA/hTrackNClsCrossedRowsOverNClsFindable"), (static_cast(track.tpcNClsCrossedRows()) / static_cast(track.tpcNClsFindable()))); - histos.fill(HIST("Tracks/SGsideA/hTrackNClsCrossedRowsOverNCls"), (static_cast(track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()) / static_cast(track.tpcNClsFindable()))); - histos.fill(HIST("Tracks/SGsideA/hTrackTPCNClsCrossedRows"), track.tpcNClsCrossedRows()); - histos.fill(HIST("Tracks/SGsideA/hTrackTPCNClsFindable"), track.tpcNClsFindable()); - histos.fill(HIST("Tracks/SGsideA/hTrackTPCNClsFound"), track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()); - histos.fill(HIST("Tracks/SGsideA/hTrackTPCNClsFindableMinusFound"), track.tpcNClsFindableMinusFound()); - histos.fill(HIST("Tracks/SGsideA/hTrackTPCNClsFindableMinusCrossedRows"), track.tpcNClsFindableMinusCrossedRows()); - histos.fill(HIST("Tracks/SGsideA/hTrackTPCChi2NCls"), track.tpcChi2NCl()); - histos.fill(HIST("Tracks/SGsideA/hTrackITSNClsTPCCls"), track.tpcNClsFindable() - track.tpcNClsFindableMinusFound(), track.itsNCls()); + // LOGF(debug, "Filling tracks. Gap Side A"); + ++nchGapSideA; + if (track.isPVContributor() == true) { + ++nchPVGapSideA; + } + if (isTrackCut(track) == false) { + continue; } + nTracksCharged++; + sumPt += track.pt(); + histos.fill(HIST("Tracks/SGsideA/hTrackPt"), track.pt()); + histos.fill(HIST("Tracks/SGsideA/hTrackPhi"), phi(track.px(), track.py())); + histos.fill(HIST("Tracks/SGsideA/hTrackEta"), eta(track.px(), track.py(), track.pz())); + histos.fill(HIST("Tracks/SGsideA/hTrackTPCSignnalP"), momentum(track.px(), track.py(), track.pz()) * track.sign(), track.tpcSignal()); + histos.fill(HIST("Tracks/SGsideA/hTrackTOFSignnalP"), momentum(track.px(), track.py(), track.pz()) * track.sign(), track.tofSignal()); + vTrackPtSideA.push_back(track.pt()); + vTrackEtaSideA.push_back(eta(track.px(), track.py(), track.pz())); + vTrackPhiSideA.push_back(phi(track.px(), track.py())); + vTrackTPCSignalSideA.push_back(track.tpcSignal()); + vTrackTOFSignalSideA.push_back(track.tofSignal()); + vTrackTPCNSigmaPiSideA.push_back(track.tpcNSigmaPi()); + vTrackTOFNSigmaPiSideA.push_back(track.tofNSigmaPi()); + vTrackTPCNSigmaKaSideA.push_back(track.tpcNSigmaKa()); + vTrackTOFNSigmaKaSideA.push_back(track.tofNSigmaKa()); + + histos.fill(HIST("Tracks/SGsideA/hTrackITSNCls"), track.itsNCls()); + histos.fill(HIST("Tracks/SGsideA/hTrackITSChi2NCls"), track.itsChi2NCl()); + histos.fill(HIST("Tracks/SGsideA/hTrackNClsCrossedRowsOverNClsFindable"), (static_cast(track.tpcNClsCrossedRows()) / static_cast(track.tpcNClsFindable()))); + histos.fill(HIST("Tracks/SGsideA/hTrackNClsCrossedRowsOverNCls"), (static_cast(track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()) / static_cast(track.tpcNClsFindable()))); + histos.fill(HIST("Tracks/SGsideA/hTrackTPCNClsCrossedRows"), track.tpcNClsCrossedRows()); + histos.fill(HIST("Tracks/SGsideA/hTrackTPCNClsFindable"), track.tpcNClsFindable()); + histos.fill(HIST("Tracks/SGsideA/hTrackTPCNClsFound"), track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()); + histos.fill(HIST("Tracks/SGsideA/hTrackTPCNClsFindableMinusFound"), track.tpcNClsFindableMinusFound()); + histos.fill(HIST("Tracks/SGsideA/hTrackTPCNClsFindableMinusCrossedRows"), track.tpcNClsFindableMinusCrossedRows()); + histos.fill(HIST("Tracks/SGsideA/hTrackTPCChi2NCls"), track.tpcChi2NCl()); + histos.fill(HIST("Tracks/SGsideA/hTrackITSNClsTPCCls"), track.tpcNClsFindable() - track.tpcNClsFindableMinusFound(), track.itsNCls()); } histos.fill(HIST("Events/SGsideA/hNch"), nTracksCharged); histos.fill(HIST("Events/SGsideA/hMultiplicity"), reconstructedTracks.size()); histos.fill(HIST("Events/SGsideA/hPtVSNch"), nTracksCharged, (sumPt / nTracksCharged)); + histos.fill(HIST("Events/SGsideA/hTrackPV"), nchPVGapSideA, nchGapSideA); nTracksChargedSideA = nTracksCharged; multiplicitySideA = reconstructedTracks.size(); nTracksCharged = sumPt = 0; @@ -503,43 +609,46 @@ struct upcPhotonuclearAnalysisJMG { histos.fill(HIST("Events/SGsideC/hAmplitudFT0A"), reconstructedCollision.totalFT0AmplitudeA()); histos.fill(HIST("Events/SGsideC/hAmplitudFT0C"), reconstructedCollision.totalFT0AmplitudeC()); for (const auto& track : reconstructedTracks) { - if (track.sign() == 1 || track.sign() == -1) { - if (isTrackCut(track) == false) { - continue; - } - nTracksCharged++; - sumPt += track.pt(); - histos.fill(HIST("Tracks/SGsideC/hTrackPt"), track.pt()); - histos.fill(HIST("Tracks/SGsideC/hTrackPhi"), phi(track.px(), track.py())); - histos.fill(HIST("Tracks/SGsideC/hTrackEta"), eta(track.px(), track.py(), track.pz())); - histos.fill(HIST("Tracks/SGsideC/hTrackTPCSignnalP"), momentum(track.px(), track.py(), track.pz()) * track.sign(), track.tpcSignal()); - histos.fill(HIST("Tracks/SGsideC/hTrackTOFSignnalP"), momentum(track.px(), track.py(), track.pz()) * track.sign(), track.tofSignal()); - vTrackPtSideC.push_back(track.pt()); - vTrackEtaSideC.push_back(eta(track.px(), track.py(), track.pz())); - vTrackPhiSideC.push_back(phi(track.px(), track.py())); - vTrackTPCSignalSideC.push_back(track.tpcSignal()); - vTrackTOFSignalSideC.push_back(track.tofSignal()); - vTrackTPCNSigmaPiSideC.push_back(track.tpcNSigmaPi()); - vTrackTOFNSigmaPiSideC.push_back(track.tofNSigmaPi()); - vTrackTPCNSigmaKaSideC.push_back(track.tpcNSigmaKa()); - vTrackTOFNSigmaKaSideC.push_back(track.tofNSigmaKa()); - - histos.fill(HIST("Tracks/SGsideC/hTrackITSNCls"), track.itsNCls()); - histos.fill(HIST("Tracks/SGsideC/hTrackITSChi2NCls"), track.itsChi2NCl()); - histos.fill(HIST("Tracks/SGsideC/hTrackNClsCrossedRowsOverNClsFindable"), (static_cast(track.tpcNClsCrossedRows()) / static_cast(track.tpcNClsFindable()))); - histos.fill(HIST("Tracks/SGsideC/hTrackNClsCrossedRowsOverNCls"), (static_cast(track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()) / static_cast(track.tpcNClsFindable()))); - histos.fill(HIST("Tracks/SGsideC/hTrackTPCNClsCrossedRows"), track.tpcNClsCrossedRows()); - histos.fill(HIST("Tracks/SGsideC/hTrackTPCNClsFindable"), track.tpcNClsFindable()); - histos.fill(HIST("Tracks/SGsideC/hTrackTPCNClsFound"), track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()); - histos.fill(HIST("Tracks/SGsideC/hTrackTPCNClsFindableMinusFound"), track.tpcNClsFindableMinusFound()); - histos.fill(HIST("Tracks/SGsideC/hTrackTPCNClsFindableMinusCrossedRows"), track.tpcNClsFindableMinusCrossedRows()); - histos.fill(HIST("Tracks/SGsideC/hTrackTPCChi2NCls"), track.tpcChi2NCl()); - histos.fill(HIST("Tracks/SGsideC/hTrackITSNClsTPCCls"), track.tpcNClsFindable() - track.tpcNClsFindableMinusFound(), track.itsNCls()); + ++nchGapSideC; + if (track.isPVContributor() == true) { + ++nchPVGapSideC; + } + if (isTrackCut(track) == false) { + continue; } + nTracksCharged++; + sumPt += track.pt(); + histos.fill(HIST("Tracks/SGsideC/hTrackPt"), track.pt()); + histos.fill(HIST("Tracks/SGsideC/hTrackPhi"), phi(track.px(), track.py())); + histos.fill(HIST("Tracks/SGsideC/hTrackEta"), eta(track.px(), track.py(), track.pz())); + histos.fill(HIST("Tracks/SGsideC/hTrackTPCSignnalP"), momentum(track.px(), track.py(), track.pz()) * track.sign(), track.tpcSignal()); + histos.fill(HIST("Tracks/SGsideC/hTrackTOFSignnalP"), momentum(track.px(), track.py(), track.pz()) * track.sign(), track.tofSignal()); + vTrackPtSideC.push_back(track.pt()); + vTrackEtaSideC.push_back(eta(track.px(), track.py(), track.pz())); + vTrackPhiSideC.push_back(phi(track.px(), track.py())); + vTrackTPCSignalSideC.push_back(track.tpcSignal()); + vTrackTOFSignalSideC.push_back(track.tofSignal()); + vTrackTPCNSigmaPiSideC.push_back(track.tpcNSigmaPi()); + vTrackTOFNSigmaPiSideC.push_back(track.tofNSigmaPi()); + vTrackTPCNSigmaKaSideC.push_back(track.tpcNSigmaKa()); + vTrackTOFNSigmaKaSideC.push_back(track.tofNSigmaKa()); + + histos.fill(HIST("Tracks/SGsideC/hTrackITSNCls"), track.itsNCls()); + histos.fill(HIST("Tracks/SGsideC/hTrackITSChi2NCls"), track.itsChi2NCl()); + histos.fill(HIST("Tracks/SGsideC/hTrackNClsCrossedRowsOverNClsFindable"), (static_cast(track.tpcNClsCrossedRows()) / static_cast(track.tpcNClsFindable()))); + histos.fill(HIST("Tracks/SGsideC/hTrackNClsCrossedRowsOverNCls"), (static_cast(track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()) / static_cast(track.tpcNClsFindable()))); + histos.fill(HIST("Tracks/SGsideC/hTrackTPCNClsCrossedRows"), track.tpcNClsCrossedRows()); + histos.fill(HIST("Tracks/SGsideC/hTrackTPCNClsFindable"), track.tpcNClsFindable()); + histos.fill(HIST("Tracks/SGsideC/hTrackTPCNClsFound"), track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()); + histos.fill(HIST("Tracks/SGsideC/hTrackTPCNClsFindableMinusFound"), track.tpcNClsFindableMinusFound()); + histos.fill(HIST("Tracks/SGsideC/hTrackTPCNClsFindableMinusCrossedRows"), track.tpcNClsFindableMinusCrossedRows()); + histos.fill(HIST("Tracks/SGsideC/hTrackTPCChi2NCls"), track.tpcChi2NCl()); + histos.fill(HIST("Tracks/SGsideC/hTrackITSNClsTPCCls"), track.tpcNClsFindable() - track.tpcNClsFindableMinusFound(), track.itsNCls()); } histos.fill(HIST("Events/SGsideC/hNch"), nTracksCharged); histos.fill(HIST("Events/SGsideC/hMultiplicity"), reconstructedTracks.size()); histos.fill(HIST("Events/SGsideC/hPtVSNch"), nTracksCharged, (sumPt / nTracksCharged)); + histos.fill(HIST("Events/SGsideC/hTrackPV"), nchPVGapSideC, nchGapSideC); nTracksChargedSideC = nTracksCharged; multiplicitySideC = reconstructedTracks.size(); nTracksCharged = sumPt = 0; @@ -551,14 +660,214 @@ struct upcPhotonuclearAnalysisJMG { tree(vTrackPtSideA, vTrackEtaSideA, vTrackPhiSideA, vTrackTPCSignalSideA, vTrackTOFSignalSideA, vTrackTPCNSigmaPiSideA, vTrackTOFNSigmaPiSideA, vTrackTPCNSigmaKaSideA, vTrackTOFNSigmaKaSideA, vTrackPtSideC, vTrackEtaSideC, vTrackPhiSideC, vTrackTPCSignalSideA, vTrackTOFSignalSideA, vTrackTPCNSigmaPiSideA, vTrackTOFNSigmaPiSideA, vTrackTPCNSigmaKaSideA, vTrackTOFNSigmaKaSideA, nTracksChargedSideA, multiplicitySideA, nTracksChargedSideC, multiplicitySideC); // nTracksChargedSideA = nTracksChargedSideC = multiplicitySideA = multiplicitySideC = 0; } - PROCESS_SWITCH(upcPhotonuclearAnalysisJMG, processSG, "Process in UD tables", true); + + PROCESS_SWITCH(UpcPhotonuclearAnalysisJMG, processSG, "Process in UD tables", true); + + void processMixed(FullSGUDCollision const& reconstructedCollision, FullUDTracks const& reconstructedTracks) + { + // (void)reconstructedCollision; + // int sgSide = reconstructedCollision.gapSide(); + // int sgSide = 0; + + // int maxCount = 0; + // int maxCountGapA = 0; + // int maxCountGapC = 0; + + // if (auto histEventCount = histos.get(HIST("eventcount"))) { + // int binA = histEventCount->GetXaxis()->FindBin(-2); Gap A + // int binC = histEventCount->GetXaxis()->FindBin(-1); Gap C + + // maxCount = histEventCount->GetBinContent(binA) * factorEventsMixed; + // maxCountGapA = histEventCount->GetBinContent(binA) * factorEventsMixed; + // maxCountGapC = histEventCount->GetBinContent(binC) * factorEventsMixed; + // } + + auto histoEthaPhiVtxZ = histos.get(HIST("etaphiVtx")); + makeNUAWeights(histoEthaPhiVtxZ); + + BinningType bindingOnVtx{{vtxBinsEdges, gapSideBinsEdges}, true}; + // BinningType bindingOnVtx{{vtxBinsEdges}, true}; + auto tracksTuple = std::make_tuple(reconstructedTracks); + SameKindPair pairs{bindingOnVtx, nEventsMixed, -1, reconstructedCollision, tracksTuple, &cache}; + + for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { + if (collision1.size() == 0 || collision2.size() == 0) { + // LOGF(info, "One or both collisions are empty."); + continue; + } + + // if (countGapA >= maxCountGapA && countGapC >= maxCountGapC) { + // break; + // } + + float multiplicity = 0; + + histos.fill(HIST("Events/hCountCollisionsMixed"), 0); + + if (isCollisionCutSG(collision1) == false || isCollisionCutSG(collision2) == false) { + continue; + } + histos.fill(HIST("Events/hCountCollisionsMixed"), 1); + // ++countEvents; + // LOGF(info, "In the pairs loop"); + for (const auto& track : tracks1) { + if (isTrackCut(track) == false) { + continue; + } + ++multiplicity; + } + // multiplicity = tracks1.size(); + if (fillCollisionUD(mixed, multiplicity) == false) { + return; + } + histos.fill(HIST("Events/hCountCollisionsMixed"), 2); + // histos.fill(HIST("eventcount"), bindingOnVtx.getBin({collision1.posZ()})); + histos.fill(HIST("eventcount"), bindingOnVtx.getBin({collision1.posZ(), collision1.gapSide()})); + fillCorrelationsUD(mixed, tracks1, tracks2, multiplicity, collision1.posZ()); + // LOGF(info, "Filling mixed events"); + + // if (collision1.gapSide() == 0 && collision2.gapSide() == 0) { gap on side A + // if (isCollisionCutSG(collision1, 0) == false && isCollisionCutSG(collision2, 0) == false) { + // continue; + // } + // std::cout << "Counts for Gap A: " << countGapA << " Maximum Count for Gap A " << maxCountGapA << std::endl; + // ++countGapA; + // LOGF(info, "In the pairs loop, gap side A"); + // multiplicity = tracks1.size(); + // if (fillCollisionUD(mixedGapSideA, multiplicity) == false) { + // return; + // } + // histos.fill(HIST("eventcount"), bindingOnVtx.getBin({collision1.posZ()})); + // histos.fill(HIST("eventcount"), bindingOnVtx.getBin({collision1.posZ(), collision1.gapSide()})); + // fillCorrelationsUD(mixedGapSideA, tracks1, tracks2, multiplicity, collision1.posZ()); + // LOGF(info, "Filling mixedGapSideA events, Gap for side A"); + // } + + // if (collision1.gapSide() == 1 && collision2.gapSide() == 1) { gap on side C + // if (isCollisionCutSG(collision1, 1) == false && isCollisionCutSG(collision2, 1) == false) { + // continue; + // } + // std::cout << "Counts for Gap C: " << countGapC << " Maximum Count for Gap C" << maxCountGapC << std::endl; + // ++countGapC; + // LOGF(info, "In the pairs loop, gap side C"); + // multiplicity = tracks1.size(); + // if (fillCollisionUD(mixedGapSideC, multiplicity) == false) { + // return; + // } + // fillCorrelationsUD(mixedGapSideC, tracks1, tracks2, multiplicity, collision1.posZ()); + // LOGF(info, "Filling mixedGapSideC events, Gap for side C"); + // } else { + // continue; + // } + } + } + + PROCESS_SWITCH(UpcPhotonuclearAnalysisJMG, processMixed, "Process mixed events", true); void processSame(FullSGUDCollision::iterator const& reconstructedCollision, FullUDTracks const& reconstructedTracks) { - int sgSide = reconstructedCollision.gapSide(); + // int sgSide = reconstructedCollision.gapSide(); float multiplicity = 0; - switch (sgSide) { + if (isCollisionCutSG(reconstructedCollision) == false) { + return; + } + for (const auto& track : reconstructedTracks) { + histos.fill(HIST("Tracks/hTracksAfterCuts"), 0); + if (track.sign() != 1 && track.sign() != -1) { + continue; + } + histos.fill(HIST("Tracks/hTracksAfterCuts"), 1); + if (track.pt() < cutMyptMin || track.pt() > cutMyptMax) { + continue; + } + histos.fill(HIST("Tracks/hTracksAfterCuts"), 2); + if (eta(track.px(), track.py(), track.pz()) < cutMyetaMin || eta(track.px(), track.py(), track.pz()) > cutMyetaMax) { + continue; + } + histos.fill(HIST("Tracks/hTracksAfterCuts"), 3); + if (std::abs(track.dcaZ()) > cutMydcaZmax) { + continue; + } + histos.fill(HIST("Tracks/hTracksAfterCuts"), 4); + if (cutMydcaXYusePt) { + float maxDCA = 0.0105f + 0.0350f / std::pow(track.pt(), 1.1f); + if (std::abs(track.dcaXY()) > maxDCA) { + continue; + } + } else { + if (std::abs(track.dcaXY()) > cutMydcaXYmax) { + continue; + } + } + histos.fill(HIST("Tracks/hTracksAfterCuts"), 5); + if (track.isPVContributor() == false) { + continue; + } + histos.fill(HIST("Tracks/hTracksAfterCuts"), 6); + // Quality Track + // ITS + if (cutMyHasITS && !track.hasITS()) { + continue; // ITS refit + } + histos.fill(HIST("Tracks/hTracksAfterCuts"), 7); + if (track.itsNCls() < cutMyITSNClsMin) { + continue; + } + histos.fill(HIST("Tracks/hTracksAfterCuts"), 8); + if (track.itsChi2NCl() > cutMyITSChi2NClMax) { + continue; + } + histos.fill(HIST("Tracks/hTracksAfterCuts"), 9); + // TPC + if (cutMyHasTPC && !track.hasTPC()) { + continue; // TPC refit + } + histos.fill(HIST("Tracks/hTracksAfterCuts"), 10); + if (track.tpcNClsCrossedRows() < cutMyTPCNClsCrossedRowsMin) { + continue; + } + histos.fill(HIST("Tracks/hTracksAfterCuts"), 11); + if ((track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()) < cutMyTPCNClsMin) { + continue; // tpcNClsFound() + } + histos.fill(HIST("Tracks/hTracksAfterCuts"), 12); + if (track.tpcNClsFindable() < cutMyTPCNClsFindableMin) { + continue; + } + histos.fill(HIST("Tracks/hTracksAfterCuts"), 13); + if ((static_cast(track.tpcNClsCrossedRows()) / static_cast(track.tpcNClsFindable())) < cutMyTPCNClsCrossedRowsOverNClsFindableMin) { + continue; // + } + histos.fill(HIST("Tracks/hTracksAfterCuts"), 14); + if ((static_cast(track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()) / static_cast(track.tpcNClsFindable())) < cutMyTPCNClsCrossedRowsOverNClsFindableMin) { + continue; // + } + histos.fill(HIST("Tracks/hTracksAfterCuts"), 15); + if (track.tpcChi2NCl() > cutMyTPCChi2NclMax) { + continue; // TPC chi2 + } + histos.fill(HIST("Tracks/hTracksAfterCuts"), 16); + + if (isTrackCut(track) == false) { + continue; + } + ++multiplicity; + + float weightNUA = getNUAWeight(reconstructedCollision.posZ(), eta(track.px(), track.py(), track.pz()), phi(track.px(), track.py())); + + histos.fill(HIST("Tracks/hTrackPhiAfterCorr"), phi(track.px(), track.py()), weightNUA); + } + // multiplicity = reconstructedTracks.size(); + if (fillCollisionUD(same, multiplicity) == false) { + return; + } + // LOGF(debug, "Filling same events"); + histos.fill(HIST("eventcount"), -2); + fillQAUD(reconstructedTracks, multiplicity); + fillCorrelationsUD(same, reconstructedTracks, reconstructedTracks, multiplicity, reconstructedCollision.posZ()); + + /*switch (sgSide) { case 0: // gap for side A if (isCollisionCutSG(reconstructedCollision, 0) == false) { return; @@ -587,78 +896,13 @@ struct upcPhotonuclearAnalysisJMG { default: return; break; - } - } - - PROCESS_SWITCH(upcPhotonuclearAnalysisJMG, processSame, "Process same event", true); - - void processMixed(FullSGUDCollision::iterator const& reconstructedCollision) - { - (void)reconstructedCollision; - // int sgSide = reconstructedCollision.gapSide(); - // int sgSide = 0; - - int maxCountGapA = 0; - int maxCountGapC = 0; - - if (auto histEventCount = histos.get(HIST("eventcount"))) { - int binA = histEventCount->GetXaxis()->FindBin(-2); // Gap A - int binC = histEventCount->GetXaxis()->FindBin(-1); // Gap C - - maxCountGapA = histEventCount->GetBinContent(binA) * factorEventsMixed; - maxCountGapC = histEventCount->GetBinContent(binC) * factorEventsMixed; - } - - for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { - if (collision1.size() == 0 || collision2.size() == 0) { - // LOGF(info, "One or both collisions are empty."); - continue; - } - - if (countGapA >= maxCountGapA && countGapC >= maxCountGapC) { - break; - } - float multiplicity = 0; - if (collision1.gapSide() == 0 && collision2.gapSide() == 0) { // gap on side A - if (isCollisionCutSG(collision1, 0) == false && isCollisionCutSG(collision2, 0) == false) { - continue; - } - // std::cout << "Counts for Gap A: " << countGapA << " Maximum Count for Gap A " << maxCountGapA << std::endl; - ++countGapA; - // LOGF(info, "In the pairs loop, gap side A"); - multiplicity = tracks1.size(); - if (fillCollisionUD(mixedGapSideA, multiplicity) == false) { - return; - } - // histos.fill(HIST("eventcount"), bindingOnVtx.getBin({collision1.posZ()})); - histos.fill(HIST("eventcount"), bindingOnVtx.getBin({collision1.posZ(), collision1.gapSide()})); - fillCorrelationsUD(mixedGapSideA, tracks1, tracks2, multiplicity, collision1.posZ()); - // LOGF(info, "Filling mixedGapSideA events, Gap for side A"); - } - - if (collision1.gapSide() == 1 && collision2.gapSide() == 1) { // gap on side C - if (isCollisionCutSG(collision1, 1) == false && isCollisionCutSG(collision2, 1) == false) { - continue; - } - // std::cout << "Counts for Gap C: " << countGapC << " Maximum Count for Gap C" << maxCountGapC << std::endl; - ++countGapC; - // LOGF(info, "In the pairs loop, gap side C"); - multiplicity = tracks1.size(); - if (fillCollisionUD(mixedGapSideC, multiplicity) == false) { - return; - } - fillCorrelationsUD(mixedGapSideC, tracks1, tracks2, multiplicity, collision1.posZ()); - // LOGF(info, "Filling mixedGapSideC events, Gap for side C"); - } else { - continue; - } - } + }*/ } - PROCESS_SWITCH(upcPhotonuclearAnalysisJMG, processMixed, "Process mixed events", true); + PROCESS_SWITCH(UpcPhotonuclearAnalysisJMG, processSame, "Process same event", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"upcphotonuclear"})}; + return WorkflowSpec{adaptAnalysisTask(cfgc)}; } From 8d77db9c2c5e1a8cc22cf1842fbf4064ce0fda93 Mon Sep 17 00:00:00 2001 From: Anton Alkin Date: Mon, 25 Aug 2025 16:53:43 +0200 Subject: [PATCH 184/986] [Tutorial] Tutorials: simplify and update filters tutorial (#12649) --- Tutorials/src/filters.cxx | 113 ++++++++++++-------------------------- 1 file changed, 34 insertions(+), 79 deletions(-) diff --git a/Tutorials/src/filters.cxx b/Tutorials/src/filters.cxx index a3c590b8bfd..7411db8b7ab 100644 --- a/Tutorials/src/filters.cxx +++ b/Tutorials/src/filters.cxx @@ -10,110 +10,65 @@ // or submit itself to any jurisdiction. /// /// \brief Filters are used to select specific rows of a table. -/// \author -/// \since +/// \author Anton Alkin (anton.alkin@cern.ch) +/// \file filters.cxx -#include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" -namespace o2::aod -{ -namespace etaphi -{ -DECLARE_SOA_COLUMN(NPhi, nphi, float); -DECLARE_SOA_EXPRESSION_COLUMN(CosPhi, cosphi, float, - ncos(aod::etaphi::nphi)); -} // namespace etaphi -namespace track -{ -DECLARE_SOA_EXPRESSION_COLUMN(SPt, spt, float, - nabs(aod::track::sigma1Pt / aod::track::signed1Pt)); -} -DECLARE_SOA_TABLE(TPhi, "AOD", "TPHI", - etaphi::NPhi); -DECLARE_SOA_EXTENDED_TABLE_USER(EPhi, TPhi, "EPHI", - aod::etaphi::CosPhi); -using etracks = soa::Join; -DECLARE_SOA_EXTENDED_TABLE_USER(MTracks, etracks, "MTRACK", - aod::track::SPt); -} // namespace o2::aod +#include using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -// production of table o2::aod::TPhi -struct ProduceTPhi { - Produces tphi; - void process(aod::Tracks const& tracks) - { - for (auto& track : tracks) { - tphi(track.phi()); - } - } -}; - // Apply filters on Collisions, Tracks, and TPhi -struct SpawnExtendedTables { - // spawn the extended tables - Spawns ephi; - Spawns mtrk; - - Configurable ptlow{"ptlow", 0.5f, ""}; - Configurable ptup{"ptup", 2.0f, ""}; - Filter ptFilter_a = aod::track::pt > ptlow; - Filter ptFilter_b = aod::track::pt < ptup; +struct Filters { + Configurable ptLow{"ptLow", 0.5f, ""}; + Configurable ptUp{"ptUp", 2.0f, ""}; + Filter ptFilterA = aod::track::pt > ptLow; + Filter ptFilterB = aod::track::pt < ptUp; - Configurable etalow{"etalow", -1.0f, ""}; - Configurable etaup{"etaup", 1.0f, ""}; - Filter etafilter = (aod::track::eta < etaup) && (aod::track::eta > etalow); + Configurable etaLow{"etaLow", -1.0f, ""}; + Configurable etaUp{"etaUp", 1.0f, ""}; + Filter etafilter = (aod::track::eta < etaUp) && (aod::track::eta > etaLow); - float philow = 1.0f; - float phiup = 2.0f; - Filter phifilter = (aod::etaphi::nphi < phiup) && (aod::etaphi::nphi > philow); + Configurable phiLow{"phiLow", 1.0f, "Phi lower limit"}; + Configurable phiUp{"phiUp", 2.0f, "Phi upper limit"}; Configurable vtxZ{"vtxZ", 10.f, ""}; Filter posZfilter = nabs(aod::collision::posZ) < vtxZ; - Filter bitwiseFilter = (o2::aod::track::flags & static_cast(o2::aod::track::TPCrefit)) != 0u; + Filter bitwiseFilter = (aod::track::flags & static_cast(o2::aod::track::PVContributor)) == static_cast(o2::aod::track::PVContributor); - // process only collisions and tracks which pass all defined filter criteria - void process(soa::Filtered::iterator const& collision, soa::Filtered> const& tracks) - { - LOGF(info, "Collision: %d [N = %d out of %d], -%.1f < %.3f < %.1f", - collision.globalIndex(), tracks.size(), tracks.tableSize(), (float)vtxZ, collision.posZ(), (float)vtxZ); - for (auto& track : tracks) { - LOGF(info, "id = %d; eta: %.3f < %.3f < %.3f; phi: %.3f < %.3f < %.3f; pt: %.3f < %.3f < %.3f", - track.collisionId(), (float)etalow, track.eta(), (float)etaup, philow, track.nphi(), phiup, (float)ptlow, track.pt(), (float)ptup); - } - } -}; + // it is now possible to set filters as strings + // note that column designators need the full prefix, i.e. o2::aod:: + // configurables can be used with ncfg(type, value, name) + // where value is the default value + // name is the full name in JSON, with prefix if there is any + Configurable extraFilter{"extraFilter", "(o2::aod::track::phi < ncfg(float,2.0,phiUp)) && (o2::aod::track::phi > ncfg(float,1.0,phiLow))", "extra filter string"}; + Filter extraF; -struct ConsumeExtendedTables { - void process(aod::Collision const&, soa::Join const& tracks) + void init(InitContext&) { - for (auto& track : tracks) { - LOGF(info, "%.3f == %.3f", track.cosphi(), std::cos(track.phi())); + if (!extraFilter->empty()) { + // string-based filters need to be assigned in init() + extraF = Parser::parse(extraFilter); } } -}; -// tracks which are not tracklets -struct FilterTracks { - Filter notTracklet = aod::track::trackType != static_cast(aod::track::TrackTypeEnum::Run2Tracklet); - void process(aod::Collision const&, soa::Filtered const& tracks) + // process only collisions and tracks which pass all defined filter criteria + void process(soa::Filtered::iterator const& collision, soa::Filtered> const& tracks) { - for (auto& track : tracks) { - LOGF(info, "%.3f == %.3f", track.spt(), std::abs(track.sigma1Pt() / track.signed1Pt())); + LOGF(info, "Collision: %d [N = %d out of %d], -%.1f < %.3f < %.1f", + collision.globalIndex(), tracks.size(), tracks.tableSize(), (float)vtxZ, collision.posZ(), (float)vtxZ); + for (auto const& track : tracks) { + LOGP(info, "id = {}; eta: {} < {} < {}; phi: {} < {} < {}; pt: {} < {} < {}", + track.collisionId(), (float)etaLow, track.eta(), (float)etaUp, (float)phiLow, track.phi(), (float)phiUp, (float)ptLow, track.pt(), (float)ptUp); } } }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{ - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc), - }; + return {adaptAnalysisTask(cfgc)}; } From 9a5efc5292a6e77a517d20b0e4906a09a7b85672 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Mon, 25 Aug 2025 17:09:18 +0200 Subject: [PATCH 185/986] [Common] Further centrality resolution study histograms added (#12727) Co-authored-by: ALICE Builder --- Common/Tasks/centralityStudy.cxx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Common/Tasks/centralityStudy.cxx b/Common/Tasks/centralityStudy.cxx index 1f9643dc0e3..46166ddc0d7 100644 --- a/Common/Tasks/centralityStudy.cxx +++ b/Common/Tasks/centralityStudy.cxx @@ -132,6 +132,7 @@ struct centralityStudy { ConfigurableAxis axisMultPVContributors{"axisMultPVContributors", {200, 0, 6000}, "Number of PV Contributors"}; ConfigurableAxis axisMultGlobalTracks{"axisMultGlobalTracks", {500, 0, 5000}, "Number of global tracks"}; ConfigurableAxis axisMultMFTTracks{"axisMultMFTTracks", {500, 0, 5000}, "Number of MFT tracks"}; + ConfigurableAxis axisMultMCCounts{"axisMultMCCounts", {1000, 0, 5000}, "N_{ch}"}; ConfigurableAxis axisTrackOccupancy{"axisTrackOccupancy", {50, 0, 5000}, "Track occupancy"}; ConfigurableAxis axisFT0COccupancy{"axisFT0COccupancy", {50, 0, 80000}, "FT0C occupancy"}; @@ -242,12 +243,19 @@ struct centralityStudy { } if (doprocessCollisionsWithResolutionStudy) { + // histograms with detector signals histos.add("hImpactParameterVsFT0A", "hImpactParameterVsFT0A", kTH2F, {axisMultFT0A, axisImpactParameter}); histos.add("hImpactParameterVsFT0C", "hImpactParameterVsFT0C", kTH2F, {axisMultFT0C, axisImpactParameter}); histos.add("hImpactParameterVsFT0M", "hImpactParameterVsFT0M", kTH2F, {axisMultFT0M, axisImpactParameter}); histos.add("hImpactParameterVsFV0A", "hImpactParameterVsFV0A", kTH2F, {axisMultFV0A, axisImpactParameter}); histos.add("hImpactParameterVsNMFTTracks", "hImpactParameterVsNMFTTracks", kTH2F, {axisMultMFTTracks, axisImpactParameter}); histos.add("hImpactParameterVsNTPV", "hImpactParameterVsNTPV", kTH2F, {axisMultPVContributors, axisImpactParameter}); + + // histograms with actual MC counts in each region + histos.add("hImpactParameterVsMCFT0A", "hImpactParameterVsMCFT0A", kTH2F, {axisMultMCCounts, axisImpactParameter}); + histos.add("hImpactParameterVsMCFT0C", "hImpactParameterVsMCFT0C", kTH2F, {axisMultMCCounts, axisImpactParameter}); + histos.add("hImpactParameterVsMCFT0M", "hImpactParameterVsMCFT0M", kTH2F, {axisMultMCCounts, axisImpactParameter}); + histos.add("hImpactParameterVsMCFV0A", "hImpactParameterVsMCFV0A", kTH2F, {axisMultMCCounts, axisImpactParameter}); } if (doOccupancyStudyVsRawValues2d) { @@ -696,6 +704,11 @@ struct centralityStudy { histos.fill(HIST("hImpactParameterVsFV0A"), multFV0A, mcCollision.impactParameter()); histos.fill(HIST("hImpactParameterVsNMFTTracks"), mftNtracks, mcCollision.impactParameter()); histos.fill(HIST("hImpactParameterVsNTPV"), multNTracksPV, mcCollision.impactParameter()); + + histos.fill(HIST("hImpactParameterVsMCFT0A"), mcCollision.multMCFT0A(), mcCollision.impactParameter()); + histos.fill(HIST("hImpactParameterVsMCFT0C"), mcCollision.multMCFT0C(), mcCollision.impactParameter()); + histos.fill(HIST("hImpactParameterVsMCFT0M"), (mcCollision.multMCFT0A() + mcCollision.multMCFT0C()), mcCollision.impactParameter()); + histos.fill(HIST("hImpactParameterVsMCFV0A"), mcCollision.multMCFV0A(), mcCollision.impactParameter()); } } From 81cd685e61ebe87b494473cfb78fc3117aacbd47 Mon Sep 17 00:00:00 2001 From: mcoquet642 <74600025+mcoquet642@users.noreply.github.com> Date: Mon, 25 Aug 2025 17:12:26 +0200 Subject: [PATCH 186/986] [Common] Fwdtrack method to refit global muon covariances (#12162) Co-authored-by: Maurice Coquet Co-authored-by: Maurice Coquet Co-authored-by: Maurice Coquet Co-authored-by: Maurice Coquet --- Common/Core/fwdtrackUtilities.h | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/Common/Core/fwdtrackUtilities.h b/Common/Core/fwdtrackUtilities.h index 74fe125c2f0..0533bfea89c 100644 --- a/Common/Core/fwdtrackUtilities.h +++ b/Common/Core/fwdtrackUtilities.h @@ -42,6 +42,7 @@ enum class propagationPoint : int { kToRabs = 2, }; using SMatrix55 = ROOT::Math::SMatrix>; +using SMatrix55Std = ROOT::Math::SMatrix; using SMatrix5 = ROOT::Math::SVector; /// propagate fwdtrack to a certain point. @@ -98,6 +99,48 @@ o2::dataformats::GlobalFwdTrack propagateMuon(TFwdTrack const& muon, TCollision return propmuon; } + +template +o2::dataformats::GlobalFwdTrack refitGlobalMuonCov(TFwdTrack const& muon, TMFTTrack const& mft) +{ + auto muonCov = muon.getCovariances(); + auto mftCov = mft.getCovariances(); + + SMatrix55Std jacob = ROOT::Math::SMatrixIdentity(); + auto tl = muon.getTgl(); + auto invQPt = muon.getInvQPt(); + jacob(4, 3) = tl / (invQPt * std::sqrt(1 + tl * tl)); + jacob(4, 4) = -std::sqrt(1 + tl * tl) / (invQPt * invQPt); + + auto covQP = ROOT::Math::Similarity(jacob, muonCov); + mftCov(4, 0) = 0; + mftCov(4, 1) = 0; + mftCov(4, 2) = 0; + mftCov(4, 3) = 0; + + mftCov(0, 4) = 0; + mftCov(1, 4) = 0; + mftCov(2, 4) = 0; + mftCov(3, 4) = 0; + mftCov(4, 4) = covQP(4, 4); + + SMatrix55Std jacobInv = ROOT::Math::SMatrixIdentity(); + auto qp = std::sqrt(1 + tl * tl) / invQPt; + auto tlMFT = mft.getTgl(); + jacobInv(4, 3) = tlMFT / (qp * std::sqrt(1 + tlMFT * tlMFT)); + jacobInv(4, 4) = -std::sqrt(1 + tlMFT * tlMFT) / (qp * qp); + auto globalCov = ROOT::Math::Similarity(jacobInv, mftCov); + + auto invQPtGlob = std::sqrt(1 + tlMFT * tlMFT) / qp; + + o2::dataformats::GlobalFwdTrack globalTrack; + globalTrack.setParameters(mft.getParameters()); + globalTrack.setInvQPt(invQPtGlob); + globalTrack.setCovariances(globalCov); + + return globalTrack; +} + } // namespace fwdtrackutils } // namespace o2::aod From 5869aee2864d79cc13194e595914b177537a24d3 Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Mon, 25 Aug 2025 18:57:01 +0200 Subject: [PATCH 187/986] [PWGLF] Add new event selection PID cluster cut (#12724) --- PWGLF/Tasks/Resonances/phispectrapbpbqa.cxx | 49 +++++++++++++++++---- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/PWGLF/Tasks/Resonances/phispectrapbpbqa.cxx b/PWGLF/Tasks/Resonances/phispectrapbpbqa.cxx index 981365eefb1..40d04a9986b 100644 --- a/PWGLF/Tasks/Resonances/phispectrapbpbqa.cxx +++ b/PWGLF/Tasks/Resonances/phispectrapbpbqa.cxx @@ -90,6 +90,8 @@ struct phispectrapbpbqa { Configurable ConfPathTOF{"ConfPathTOF", "Users/s/skundu/My/Object/PIDcallib/TOF", "Weight path TOF"}; // events + Configurable applyStrictEvSel{"applyStrictEvSel", true, "Apply strict event selection"}; + Configurable applyMCsel8{"applyMCsel8", false, "Apply sel8 in MC"}; Configurable cfgNoMixedEvents{"cfgNoMixedEvents", 10, "Number of event mixing"}; ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for bin"}; // ConfigurableAxis axisMultiplicityClass{"axisMultiplicityClass", {8, 0, 80}, "multiplicity percentile for bin"}; @@ -104,10 +106,12 @@ struct phispectrapbpbqa { Configurable cfgITScluster{"cfgITScluster", 4, "Number of ITS cluster"}; Configurable cfgTPCcluster{"cfgTPCcluster", 80, "Number of TPC cluster"}; + Configurable cfgTPCPIDcluster{"cfgTPCPIDcluster", 80, "Number of TPC PID cluster"}; Configurable cfgTPCcrossedRows{"cfgTPCcrossedRows", 90, "Number of TPC crossed Rows"}; Configurable cfgUpdatePID{"cfgUpdatePID", false, "Update PID callibration"}; Configurable applyPID{"applyPID", true, "Apply PID"}; + Configurable applyPIDCluster{"applyPIDCluster", true, "Apply PID cluster"}; Configurable isDeepAngle{"isDeepAngle", false, "Deep Angle cut"}; Configurable cfgDeepAngle{"cfgDeepAngle", 0.04, "Deep Angle cut value"}; Configurable timeFrameMC{"timeFrameMC", false, "time frame cut in MC"}; @@ -130,7 +134,7 @@ struct phispectrapbpbqa { Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; Filter centralityFilter = nabs(aod::cent::centFT0C) < cfgCutCentrality; Filter acceptanceFilter = (nabs(aod::track::eta) < cfgCutEta && nabs(aod::track::pt) > cfgCutPT); - // Filter PIDcutFilter = nabs(aod::pidtpc::tpcNSigmaKa) < nsigmaCutTPC; + Filter PIDcutFilter = nabs(aod::pidtpc::tpcNSigmaKa) < nsigmaCutTPC; // Filter DCAcutFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz); using EventCandidates = soa::Filtered>; @@ -180,7 +184,7 @@ struct phispectrapbpbqa { histos.add("hOccupancy", "hOccupancy", kTH2F, {axisOccupancy, cnfgaxis.configThnAxisCentrality}); histos.add("hMC", "hMC", kTH1F, {{20, 0.0f, 20.0f}}); histos.add("h1PhiRecsplit", "h1PhiRecsplit", kTH1F, {{100, 0.0f, 10.0f}}); - + histos.add("hData", "hData", kTH1F, {{20, 0.0f, 20.0f}}); ccdb->setURL(cfgCcdbParam.cfgURL); ccdbApi.init("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); @@ -215,6 +219,9 @@ struct phispectrapbpbqa { if (!(candidate.isGlobalTrack() && candidate.isPVContributor() && candidate.itsNCls() > cfgITScluster && candidate.tpcNClsFound() > cfgTPCcluster && candidate.tpcNClsCrossedRows() > cfgTPCcrossedRows)) { return false; } + if (applyPIDCluster && candidate.tpcNClsPID() < cfgTPCPIDcluster) { + return false; + } return true; } @@ -330,24 +337,34 @@ struct phispectrapbpbqa { int lastRunNumber = -999; void processSameEvent(EventCandidates::iterator const& collision, TrackCandidates const&, aod::BCsWithTimestamps const&) { - if (!collision.sel8() || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) || !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + histos.fill(HIST("hData"), 1); + if (!collision.sel8() || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { return; } + histos.fill(HIST("hData"), 2); if (rctCut.requireRCTFlagChecker) { if (!rctChecker(collision)) { return; } } + histos.fill(HIST("hData"), 3); + if (applyStrictEvSel && (!collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll) || !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow))) { + return; + } + histos.fill(HIST("hData"), 4); auto centrality = collision.centFT0C(); int occupancy = collision.trackOccupancyInTimeRange(); histos.fill(HIST("hCentrality"), centrality); histos.fill(HIST("hVtxZ"), collision.posZ()); - auto bc = collision.template bc_as(); + + /*auto bc = collision.template bc_as(); currentRunNumber = collision.bc_as().runNumber(); if (currentRunNumber != lastRunNumber) { bz = getMagneticField(bc.timestamp()); } lastRunNumber = currentRunNumber; + */ + auto posThisColl = posTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); auto negThisColl = negTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); @@ -488,10 +505,10 @@ struct phispectrapbpbqa { BinningTypeVertexContributor binningOnPositions{{axisVertex, cnfgaxis.configThnAxisCentrality, axisOccupancy}, true}; SameKindPair pair{binningOnPositions, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; for (auto& [collision1, tracks1, collision2, tracks2] : pair) { - if (!collision1.sel8() || !collision1.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision1.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision1.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !collision1.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) || !collision1.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + if (!collision1.sel8() || !collision1.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision1.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision1.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !collision1.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { continue; } - if (!collision2.sel8() || !collision2.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision2.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision2.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !collision2.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) || !collision2.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + if (!collision2.sel8() || !collision2.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision2.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision2.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !collision2.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { continue; } if (rctCut.requireRCTFlagChecker) { @@ -499,6 +516,12 @@ struct phispectrapbpbqa { continue; } } + if (applyStrictEvSel && (!collision1.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll) || !collision1.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow))) { + return; + } + if (applyStrictEvSel && (!collision2.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll) || !collision2.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow))) { + return; + } int occupancy = collision1.trackOccupancyInTimeRange(); auto centrality = collision1.centFT0C(); for (auto& [track1, track2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { @@ -584,11 +607,15 @@ struct phispectrapbpbqa { return; } for (auto& RecCollision : RecCollisions) { - if (!RecCollision.sel8()) { + if (applyMCsel8 && !RecCollision.sel8()) { + histos.fill(HIST("hMC"), 3); + continue; + } + if (!applyMCsel8 && !RecCollision.selection_bit(aod::evsel::kIsTriggerTVX)) { histos.fill(HIST("hMC"), 3); continue; } - if (!RecCollision.selection_bit(aod::evsel::kNoSameBunchPileup) || !RecCollision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !RecCollision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) || !RecCollision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + if (!RecCollision.selection_bit(aod::evsel::kNoSameBunchPileup) || !RecCollision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !RecCollision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { histos.fill(HIST("hMC"), 4); continue; } @@ -601,7 +628,7 @@ struct phispectrapbpbqa { histos.fill(HIST("hMC"), 7); continue; } - if (readOutFrameMC && RecCollision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + if (readOutFrameMC && !RecCollision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { histos.fill(HIST("hMC"), 8); continue; } @@ -612,6 +639,10 @@ struct phispectrapbpbqa { } } histos.fill(HIST("hMC"), 10); + if (applyStrictEvSel && (!RecCollision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll) || !RecCollision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow))) { + return; + } + histos.fill(HIST("hMC"), 11); auto centrality = RecCollision.centFT0C(); int occupancy = RecCollision.trackOccupancyInTimeRange(); histos.fill(HIST("hOccupancy"), occupancy, centrality); From d5e03a5851e81054ee04826bcefb8f5c4bc098ee Mon Sep 17 00:00:00 2001 From: alcaliva <32872606+alcaliva@users.noreply.github.com> Date: Mon, 25 Aug 2025 20:33:53 +0200 Subject: [PATCH 188/986] [PWGLF] using deltay instead of y in normalization histo (#12726) --- PWGLF/Tasks/Nuspex/antinucleiInJets.cxx | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx index 3cb75e35c62..13d063d2d82 100644 --- a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx +++ b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx @@ -258,8 +258,8 @@ struct AntinucleiInJets { registryMC.add("antiproton_gen_ue", "antiproton_gen_ue", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); // Normalization histogram - registryMC.add("antiproton_y_phi_jet", "antiproton_y_phi_jet", HistType::kTH2F, {{2000, -1.0, 1.0, "#it{y}"}, {2000, 0.0, TwoPI, "#Delta#phi"}}); - registryMC.add("antiproton_y_phi_ue", "antiproton_y_phi_ue", HistType::kTH2F, {{2000, -1.0, 1.0, "#it{y}"}, {2000, 0.0, TwoPI, "#Delta#phi"}}); + registryMC.add("antiproton_deltay_deltaphi_jet", "antiproton_deltay_deltaphi_jet", HistType::kTH2F, {{2000, -1.0, 1.0, "#Delta#it{y}"}, {2000, 0.0, 2.0, "#Delta#phi"}}); + registryMC.add("antiproton_deltay_deltaphi_ue", "antiproton_deltay_deltaphi_ue", HistType::kTH2F, {{2000, -1.0, 1.0, "#Delta#it{y}"}, {2000, 0.0, 2.0, "#Delta#phi"}}); } // Reconstructed antiproton spectra in jets and UE (MC-matched) with TPC/TOF PID @@ -1464,12 +1464,7 @@ struct AntinucleiInJets { continue; // Fill normalization histogram - double px = particle.px(); - double py = particle.py(); - double pz = particle.pz(); - double energy = std::sqrt(MassProton * MassProton + px * px + py * py + pz * pz); - double y = 0.5 * std::log((energy + pz) / (energy - pz)); - registryMC.fill(HIST("antiproton_y_phi_jet"), y, getDeltaPhi(particle.phi(), jet.phi())); + registryMC.fill(HIST("antiproton_deltay_deltaphi_jet"), particle.eta() - jet.eta(), getDeltaPhi(particle.phi(), jet.phi())); // Fill histogram for generated antiprotons registryMC.fill(HIST("antiproton_gen_jet"), particle.pt()); @@ -1504,17 +1499,11 @@ struct AntinucleiInJets { continue; // Fill normalization histogram - double px = protonVec.Px(); - double py = protonVec.Py(); - double pz = protonVec.Pz(); - double energy = std::sqrt(MassProton * MassProton + px * px + py * py + pz * pz); - double y = 0.5 * std::log((energy + pz) / (energy - pz)); - if (deltaRUe1 < maxConeRadius) { - registryMC.fill(HIST("antiproton_y_phi_ue"), y, getDeltaPhi(protonVec.Phi(), ueAxis1.Phi())); + registryMC.fill(HIST("antiproton_deltay_deltaphi_ue"), protonVec.Eta() - ueAxis1.Eta(), getDeltaPhi(protonVec.Phi(), ueAxis1.Phi())); } if (deltaRUe2 < maxConeRadius) { - registryMC.fill(HIST("antiproton_y_phi_ue"), y, getDeltaPhi(protonVec.Phi(), ueAxis2.Phi())); + registryMC.fill(HIST("antiproton_deltay_deltaphi_ue"), protonVec.Eta() - ueAxis2.Eta(), getDeltaPhi(protonVec.Phi(), ueAxis2.Phi())); } // Fill histogram for antiprotons in the UE From 8667058d07b10ed1747cb77b90d2912cba6f9c53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Mon, 25 Aug 2025 21:30:01 +0200 Subject: [PATCH 189/986] [ALICE3] Change default LUT inputs to zero for particles (#12731) --- ALICE3/Tasks/alice3-lutmaker.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ALICE3/Tasks/alice3-lutmaker.cxx b/ALICE3/Tasks/alice3-lutmaker.cxx index 50c03099468..4b57e462a8e 100644 --- a/ALICE3/Tasks/alice3-lutmaker.cxx +++ b/ALICE3/Tasks/alice3-lutmaker.cxx @@ -25,11 +25,11 @@ using namespace framework::expressions; void customize(std::vector& workflowOptions) { std::vector options{ - {"lut-el", VariantType::Int, 1, {"LUT input for the Electron PDG code"}}, - {"lut-mu", VariantType::Int, 1, {"LUT input for the Muon PDG code"}}, + {"lut-el", VariantType::Int, 0, {"LUT input for the Electron PDG code"}}, + {"lut-mu", VariantType::Int, 0, {"LUT input for the Muon PDG code"}}, {"lut-pi", VariantType::Int, 1, {"LUT input for the Pion PDG code"}}, - {"lut-ka", VariantType::Int, 1, {"LUT input for the Kaon PDG code"}}, - {"lut-pr", VariantType::Int, 1, {"LUT input for the Proton PDG code"}}, + {"lut-ka", VariantType::Int, 0, {"LUT input for the Kaon PDG code"}}, + {"lut-pr", VariantType::Int, 0, {"LUT input for the Proton PDG code"}}, {"lut-tr", VariantType::Int, 0, {"LUT input for the Triton PDG code"}}, {"lut-de", VariantType::Int, 0, {"LUT input for the Deuteron PDG code"}}, {"lut-he", VariantType::Int, 0, {"LUT input for the Helium3 PDG code"}}}; @@ -153,6 +153,7 @@ struct Alice3LutMaker { histos.add("QA/CovMat_sigmaSnp", "sigmaSnp" + commonTitle, kTH3F, {axisPt, axisEta, axissigmaSnp}); histos.add("QA/CovMat_sigmaTgl", "sigmaTgl" + commonTitle, kTH3F, {axisPt, axisEta, axissigmaTgl}); histos.add("QA/CovMat_sigma1Pt", "sigma1Pt" + commonTitle, kTH3F, {axisPt, axisEta, axissigma1Pt}); + histos.add("QA/sigma1Pt", "sigma1Pt" + commonTitle, kTH3F, {axisPt, axisEta, axissigma1Pt}); histos.add("QA/CovMat_rhoZY", "rhoZY" + commonTitle, kTH3F, {axisPt, axisEta, axisrhoZY}); histos.add("QA/CovMat_rhoSnpY", "rhoSnpY" + commonTitle, kTH3F, {axisPt, axisEta, axisrhoSnpY}); histos.add("QA/CovMat_rhoSnpZ", "rhoSnpZ" + commonTitle, kTH3F, {axisPt, axisEta, axisrhoSnpZ}); @@ -262,6 +263,7 @@ struct Alice3LutMaker { histos.fill(HIST("QA/CovMat_sigmaSnp"), mcParticle.pt(), mcParticle.eta(), track.sigmaSnp()); histos.fill(HIST("QA/CovMat_sigmaTgl"), mcParticle.pt(), mcParticle.eta(), track.sigmaTgl()); histos.fill(HIST("QA/CovMat_sigma1Pt"), mcParticle.pt(), mcParticle.eta(), track.sigma1Pt()); + histos.fill(HIST("QA/sigma1Pt"), mcParticle.pt(), mcParticle.eta(), std::abs(track.signed1Pt()) - 1. / mcParticle.pt()); histos.fill(HIST("QA/CovMat_rhoZY"), mcParticle.pt(), mcParticle.eta(), track.rhoZY()); histos.fill(HIST("QA/CovMat_rhoSnpY"), mcParticle.pt(), mcParticle.eta(), track.rhoSnpY()); histos.fill(HIST("QA/CovMat_rhoSnpZ"), mcParticle.pt(), mcParticle.eta(), track.rhoSnpZ()); From 9cd22f17555c00f08179375f987851ab314ab0c7 Mon Sep 17 00:00:00 2001 From: Marcello Di Costanzo <96481191+Marcellocosti@users.noreply.github.com> Date: Mon, 25 Aug 2025 22:35:13 +0200 Subject: [PATCH 190/986] [PWGHF] Fixes to B0 to D* workflow (#12734) Co-authored-by: ALICE Action Bot --- PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx | 8 ++++++-- PWGHF/D2H/Tasks/taskB0Reduced.cxx | 6 +++--- PWGHF/DataModel/CandidateReconstructionTables.h | 4 +++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx index 8b38982c477..9734cf40148 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx @@ -1241,7 +1241,7 @@ struct HfDataCreatorCharmHadPiReduced { trackParCov1.propagateTo(secondaryVertexCharm[0], bz); df2.getTrack(0).getPxPyPzGlo(pVec0); df2.getTrack(1).getPxPyPzGlo(pVec1); - pVecCharm = RecoDecay::pVec(pVec0, pVec1); + pVecCharm = RecoDecay::pVec(pVec0, pVec1, pVec2); trackParCovCharmHad = df2.createParentTrackParCov(); trackParCovCharmHad.setAbsCharge(0); // to be sure } @@ -1279,7 +1279,7 @@ struct HfDataCreatorCharmHadPiReduced { } // reject pi D with same sign as D - if constexpr (decChannel == DecayChannel::B0ToDminusPi || decChannel == DecayChannel::BsToDsminusPi || decChannel == DecayChannel::LbToLcplusPi || decChannel == DecayChannel::B0ToDstarPi) { // D∓ → π∓ K± π∓ and Ds∓ → K∓ K± π∓ and Lc∓ → p∓ K± π∓ and D*+ → D0 π+ + if constexpr (decChannel == DecayChannel::B0ToDminusPi || decChannel == DecayChannel::BsToDsminusPi || decChannel == DecayChannel::LbToLcplusPi) { // D∓ → π∓ K± π∓ and Ds∓ → K∓ K± π∓ and Lc∓ → p∓ K± π∓ if (trackPion.sign() * charmHadDauTracks[0].sign() > 0) { continue; } @@ -1287,6 +1287,10 @@ struct HfDataCreatorCharmHadPiReduced { if (!((candC.isSelD0() >= hfflagConfigurations.selectionFlagD0 && trackPion.sign() < 0) || (candC.isSelD0bar() >= hfflagConfigurations.selectionFlagD0bar && trackPion.sign() > 0))) { continue; } + } else if constexpr (decChannel == DecayChannel::B0ToDstarPi) { // D*+ → D0 π+ + if (trackPion.sign() * charmHadDauTracks.back().sign() > 0) { + continue; + } } // apply selections on pion tracks diff --git a/PWGHF/D2H/Tasks/taskB0Reduced.cxx b/PWGHF/D2H/Tasks/taskB0Reduced.cxx index e79e77278fb..fefbd739f11 100644 --- a/PWGHF/D2H/Tasks/taskB0Reduced.cxx +++ b/PWGHF/D2H/Tasks/taskB0Reduced.cxx @@ -616,7 +616,7 @@ struct HfTaskB0Reduced { candidate.decayLengthXY(), candidate.decayLengthNormalised(), candidate.decayLengthXYNormalised(), - candidate.impactParameterProngSqSum(), + candidate.impactParameterProduct(), candidate.maxNormalisedDeltaIP(), candidateMlScoreSig, candidate.isSelB0ToDPi(), @@ -644,12 +644,12 @@ struct HfTaskB0Reduced { prong0MlScorePrompt, prong0MlScoreNonprompt, // pion features - candidate.ptProng1(), + candidate.ptProng2(), std::abs(RecoDecay::eta(prongBachPi.pVector())), prongBachPi.itsNCls(), prongBachPi.tpcNClsCrossedRows(), prongBachPi.tpcChi2NCl(), - candidate.impactParameter1(), + candidate.impactParameter2(), prongBachPi.tpcNSigmaPi(), prongBachPi.tofNSigmaPi(), prongBachPi.tpcTofNSigmaPi(), diff --git a/PWGHF/DataModel/CandidateReconstructionTables.h b/PWGHF/DataModel/CandidateReconstructionTables.h index 9fddeb3551d..c24c9badbc3 100644 --- a/PWGHF/DataModel/CandidateReconstructionTables.h +++ b/PWGHF/DataModel/CandidateReconstructionTables.h @@ -2257,7 +2257,8 @@ DECLARE_SOA_TABLE(HfCandB0Base, "AOD", "HFCANDB0BASE", DECLARE_SOA_TABLE(HfCandB0DStar, "AOD", "HFCANDB0DSTAR", // general columns HFCAND_COLUMNS, - /* prong 2 */ hf_cand::ImpactParameterNormalised2, + /* prong 2 */ + hf_cand::ImpactParameterNormalised2, hf_cand::PtProng2, hf_cand::Pt2Prong2, hf_cand::PVectorProng2, @@ -2270,6 +2271,7 @@ DECLARE_SOA_TABLE(HfCandB0DStar, "AOD", "HFCANDB0DSTAR", /* dynamic columns */ hf_cand_3prong::M, hf_cand_3prong::M2, + hf_cand_2prong::ImpactParameterProduct, hf_cand_3prong::ImpactParameterProngSqSum, /* dynamic columns that use candidate momentum components */ hf_cand::Pt, From b454fe9e69a317b4f53ab8594fd176a91fdcb5a0 Mon Sep 17 00:00:00 2001 From: Marta Urioni <78807256+murioni@users.noreply.github.com> Date: Mon, 25 Aug 2025 23:39:24 +0200 Subject: [PATCH 191/986] [PWGLF] Lightions dN/deta at midrapidity -- correlation histograms (#12737) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx b/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx index 40a0ebbffd4..1de0773fa0b 100644 --- a/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx @@ -233,8 +233,11 @@ struct HeavyionMultiplicity { if (doprocessCorrelation) { histos.add("GlobalMult_vs_FT0A", "GlobalMult_vs_FT0A", kTH2F, {axisMult, axisFt0aMult}, true); histos.add("GlobalMult_vs_FT0C", "GlobalMult_vs_FT0C", kTH2F, {axisMult, axisFt0cMult}, true); + histos.add("Centrality_vs_FT0C", "Centrality_vs_FT0C", kTH2F, {centAxis, axisFt0cMult}, true); histos.add("NPVtracks_vs_FT0C", "NPVtracks_vs_FT0C", kTH2F, {axisPV, axisFt0cMult}, true); histos.add("GlobalMult_vs_FV0A", "GlobalMult_vs_FV0A", kTH2F, {axisMult, axisFv0aMult}, true); + histos.add("Centrality_vs_FV0A", "Centrality_vs_FV0A", kTH2F, {centAxis, axisFv0aMult}, true); + histos.add("CentFT0Ccentrality_vs_GlobalMult", "CentFT0Ccentrality_vs_GlobalMult", kTH2F, {centAxis, axisMult}, true); histos.add("NPVtracks_vs_GlobalMult", "NPVtracks_vs_GlobalMult", kTH2F, {axisPV, axisMult}, true); } @@ -451,10 +454,14 @@ struct HeavyionMultiplicity { } nchTracks++; } + histos.fill(HIST("GlobalMult_vs_FT0A"), nchTracks, cols.multFT0A()); histos.fill(HIST("GlobalMult_vs_FT0C"), nchTracks, cols.multFT0C()); + histos.fill(HIST("Centrality_vs_FT0C"), cols.centFT0C(), cols.multFT0C()); histos.fill(HIST("NPVtracks_vs_FT0C"), cols.multNTracksPV(), cols.multFT0C()); histos.fill(HIST("GlobalMult_vs_FV0A"), nchTracks, cols.multFV0A()); + histos.fill(HIST("Centrality_vs_FV0A"), cols.centFV0A(), cols.multFV0A()); + histos.fill(HIST("CentFT0Ccentrality_vs_GlobalMult"), cols.centFT0C(), nchTracks); histos.fill(HIST("NPVtracks_vs_GlobalMult"), cols.multNTracksPV(), nchTracks); } From 3f0f1ec0ac508da41d30a2a846eff12f43f943cc Mon Sep 17 00:00:00 2001 From: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Date: Tue, 26 Aug 2025 00:51:46 +0200 Subject: [PATCH 192/986] [PWGCF] add TPCsectorOverlap check on request (#12735) --- PWGCF/Flow/Tasks/flowTask.cxx | 59 +++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/PWGCF/Flow/Tasks/flowTask.cxx b/PWGCF/Flow/Tasks/flowTask.cxx index 9f27ffa0005..a7691188f19 100644 --- a/PWGCF/Flow/Tasks/flowTask.cxx +++ b/PWGCF/Flow/Tasks/flowTask.cxx @@ -36,6 +36,7 @@ #include "Framework/RunningWorkflowInfo.h" #include "Framework/runDataProcessing.h" #include +#include #include "TList.h" #include @@ -141,6 +142,13 @@ struct FlowTask { TF1* fMultMultV0ACutHigh = nullptr; TF1* fT0AV0AMean = nullptr; TF1* fT0AV0ASigma = nullptr; + // for TPC sector boundary + O2_DEFINE_CONFIGURABLE(cfgShowTPCsectorOverlap, bool, true, "Draw TPC sector overlap") + O2_DEFINE_CONFIGURABLE(cfgRejectionTPCsectorOverlap, bool, false, "rejection for TPC sector overlap") + O2_DEFINE_CONFIGURABLE(cfgMagnetField, std::string, "GLO/Config/GRPMagField", "CCDB path to Magnet field object") + ConfigurableAxis axisPhiMod{"axisPhiMod", {100, 0, constants::math::PI / 9}, "fmod(#varphi,#pi/9)"}; + TF1* fPhiCutLow = nullptr; + TF1* fPhiCutHigh = nullptr; } cfgFuncParas; ConfigurableAxis axisPtHist{"axisPtHist", {100, 0., 10.}, "pt axis for histograms"}; @@ -283,6 +291,8 @@ struct FlowTask { registry.add("hEta", "#eta distribution", {HistType::kTH1D, {axisEta}}); registry.add("hPt", "p_{T} distribution before cut", {HistType::kTH1D, {axisPtHist}}); registry.add("hPtRef", "p_{T} distribution after cut", {HistType::kTH1D, {axisPtHist}}); + registry.add("pt_phi_bef", "before cut;p_{T};#phi_{modn}", {HistType::kTH2D, {axisPt, cfgFuncParas.axisPhiMod}}); + registry.add("pt_phi_aft", "after cut;p_{T};#phi_{modn}", {HistType::kTH2D, {axisPt, cfgFuncParas.axisPhiMod}}); registry.add("hChi2prTPCcls", "#chi^{2}/cluster for the TPC track segment", {HistType::kTH1D, {{100, 0., 5.}}}); registry.add("hChi2prITScls", "#chi^{2}/cluster for the ITS track", {HistType::kTH1D, {{100, 0., 50.}}}); registry.add("hnTPCClu", "Number of found TPC clusters", {HistType::kTH1D, {{100, 40, 180}}}); @@ -501,6 +511,11 @@ struct FlowTask { cfgFuncParas.fT0AV0ASigma->SetParameters(463.4144, 6.796509e-02, -9.097136e-07, 7.971088e-12, -2.600581e-17); } + if (cfgFuncParas.cfgShowTPCsectorOverlap) { + cfgFuncParas.fPhiCutLow = new TF1("fPhiCutLow", "0.06/x+pi/18.0-0.06", 0, 100); + cfgFuncParas.fPhiCutHigh = new TF1("fPhiCutHigh", "0.1/x+pi/18.0+0.06", 0, 100); + } + if (cfgTrackDensityCorrUse) { std::vector pTEffBins = {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.4, 1.8, 2.2, 2.6, 3.0}; hFindPtBin = new TH1D("hFindPtBin", "hFindPtBin", pTEffBins.size() - 1, &pTEffBins[0]); @@ -730,12 +745,49 @@ struct FlowTask { return 1; } + int getMagneticField(uint64_t timestamp) + { + static o2::parameters::GRPMagField* grpo = nullptr; + if (grpo == nullptr) { + grpo = ccdb->getForTimeStamp(cfgFuncParas.cfgMagnetField, timestamp); + if (grpo == nullptr) { + LOGF(fatal, "GRP object not found in %s for timestamp %llu", cfgFuncParas.cfgMagnetField.value.c_str(), timestamp); + return 0; + } + LOGF(info, "Retrieved GRP from %s for timestamp %llu with magnetic field of %d kG", cfgFuncParas.cfgMagnetField.value.c_str(), timestamp, grpo->getNominalL3Field()); + } + return grpo->getNominalL3Field(); + } + template bool trackSelected(TTrack track) { return ((track.tpcNClsFound() >= cfgCutTPCclu) && (track.tpcNClsCrossedRows() >= cfgCutTPCCrossedRows) && (track.itsNCls() >= cfgCutITSclu)); } + template + bool rejectionTPCoverlap(TTrack track, const int field) + { + double phimodn = track.phi(); + if (field < 0) // for negative polarity field + phimodn = o2::constants::math::TwoPI - phimodn; + if (track.sign() < 0) // for negative charge + phimodn = o2::constants::math::TwoPI - phimodn; + if (phimodn < 0) + LOGF(warning, "phi < 0: %g", phimodn); + + float middle = o2::constants::math::TwoPI / 18.0; + phimodn += middle; // to center gap in the middle + phimodn = fmod(phimodn, o2::constants::math::TwoPI / 9.0); + registry.fill(HIST("pt_phi_bef"), track.pt(), phimodn); + if (cfgFuncParas.cfgRejectionTPCsectorOverlap) { + if (phimodn < cfgFuncParas.fPhiCutHigh->Eval(track.pt()) && phimodn > cfgFuncParas.fPhiCutLow->Eval(track.pt())) + return false; // reject track + } + registry.fill(HIST("pt_phi_aft"), track.pt(), phimodn); + return true; + } + void initHadronicRate(aod::BCsWithTimestamps::iterator const& bc) { if (mRunNumber == bc.runNumber()) { @@ -844,9 +896,14 @@ struct FlowTask { // track weights float weff = 1, wacc = 1; double nTracksCorrected = 0; + int magnetfield = 0; float independent = cent; if (cfgUseNch) independent = static_cast(tracks.size()); + if (cfgFuncParas.cfgShowTPCsectorOverlap) { + // magnet field dependence cut + magnetfield = getMagneticField(bc.timestamp()); + } double psi2Est = 0, psi3Est = 0, psi4Est = 0; float wEPeff = 1; @@ -879,6 +936,8 @@ struct FlowTask { for (const auto& track : tracks) { if (!trackSelected(track)) continue; + if (cfgFuncParas.cfgShowTPCsectorOverlap && !rejectionTPCoverlap(track, magnetfield)) + continue; bool withinPtPOI = (cfgCutPtPOIMin < track.pt()) && (track.pt() < cfgCutPtPOIMax); // within POI pT range bool withinPtRef = (cfgCutPtRefMin < track.pt()) && (track.pt() < cfgCutPtRefMax); // within RF pT range if (cfgOutputNUAWeights) { From 6e272c5d24c6a31540eff80356fd4097da18ee5e Mon Sep 17 00:00:00 2001 From: Stefano Cannito <143754257+scannito@users.noreply.github.com> Date: Tue, 26 Aug 2025 01:23:11 +0200 Subject: [PATCH 193/986] [PWGLF] Different implementations of MC filter (#12739) --- .../Tasks/Strangeness/phik0shortanalysis.cxx | 73 +++++++++++++++++-- 1 file changed, 65 insertions(+), 8 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx b/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx index b085b4e6ae0..076609b91b9 100644 --- a/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx @@ -17,7 +17,9 @@ #include "PWGLF/DataModel/mcCentrality.h" #include "PWGLF/Utils/inelGt.h" +#include "Common/Core/TableHelper.h" #include "Common/Core/TrackSelection.h" +#include "Common/Core/TrackSelectionDefaults.h" #include "Common/Core/trackUtilities.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" @@ -224,8 +226,8 @@ struct Phik0shortanalysis { // Configurables for dN/deta with phi computation Configurable furtherCheckonMcCollision{"furtherCheckonMcCollision", true, "Further check on MC collisions"}; - Configurable filterOnGenPhi{"filterOnGenPhi", true, "Filter on MC Phi"}; - Configurable filterOnRecoPhiWPDG{"filterOnRecoPhiWPDG", true, "Filter on Reco Phi with WPDG"}; + Configurable filterOnGenPhi{"filterOnGenPhi", 1, "Filter on Gen Phi (0: K+K- pair like Phi, 1: proper Phi)"}; + Configurable filterOnRecoPhi{"filterOnRecoPhi", 1, "Filter on Reco Phi (0: without PDG, 1: with PDG)"}; Configurable fillMcPartsForAllReco{"fillMcPartsForAllReco", false, "Fill MC particles for all associated reco collisions"}; // Configurable for event mixing @@ -307,6 +309,9 @@ struct Phik0shortanalysis { Partition posMCTracks = aod::track::signed1Pt > trackConfigs.cfgCutCharge; Partition negMCTracks = aod::track::signed1Pt < trackConfigs.cfgCutCharge; + Partition posFiltMCTracks = aod::track::signed1Pt > trackConfigs.cfgCutCharge; + Partition negFiltMCTracks = aod::track::signed1Pt < trackConfigs.cfgCutCharge; + // Necessary to flag INEL>0 events in GenMC Service pdgDB; @@ -1046,6 +1051,40 @@ struct Phik0shortanalysis { return false; } + template + bool eventHasGenKPair(const T& mcParticles) + { + int nKPair = 0; + + for (const auto& mcParticle1 : mcParticles) { + if (!mcParticle1.isPhysicalPrimary() || std::abs(mcParticle1.eta()) > trackConfigs.etaMax) + continue; + + for (const auto& mcParticle2 : mcParticles) { + if (!mcParticle2.isPhysicalPrimary() || std::abs(mcParticle2.eta()) > trackConfigs.etaMax) + continue; + + if ((mcParticle1.pdgCode() != PDG_t::kKPlus || mcParticle2.pdgCode() != PDG_t::kKMinus) && + (mcParticle1.pdgCode() != PDG_t::kKMinus || mcParticle2.pdgCode() != PDG_t::kKPlus)) + continue; + + ROOT::Math::PxPyPzMVector genKPair = recMother(mcParticle1, mcParticle2, massKa, massKa); + if (genKPair.Pt() < phiConfigs.minPhiPt) + continue; + if (genKPair.M() < phiConfigs.lowMPhi || genKPair.M() > phiConfigs.upMPhi) + continue; + if (std::abs(genKPair.Rapidity()) > deltaYConfigs.cfgYAcceptance) + continue; + + nKPair++; + } + } + + if (nKPair > 0) + return true; + return false; + } + template bool eventHasGenPhi(const T& mcParticles) { @@ -2673,8 +2712,18 @@ struct Phik0shortanalysis { if (!pwglf::isINELgtNmc(mcParticlesThisMcColl, 0, pdgDB)) continue; - if (filterOnGenPhi && !eventHasGenPhi(mcParticlesThisMcColl)) - continue; + switch (filterOnGenPhi) { + case 0: + if (!eventHasGenKPair(mcParticlesThisMcColl)) + continue; + break; + case 1: + if (!eventHasGenPhi(mcParticlesThisMcColl)) + continue; + break; + default: + break; + } uint64_t numberAssocColl = 0; std::vector zVtxs; @@ -2687,13 +2736,21 @@ struct Phik0shortanalysis { if (acceptEventQA(collision, false)) { auto filteredMCTracksThisColl = filteredMCTracks.sliceBy(preslices.perColl, collision.globalIndex()); - Partition posFiltMCTracks = aod::track::signed1Pt > trackConfigs.cfgCutCharge; posFiltMCTracks.bindTable(filteredMCTracksThisColl); - Partition negFiltMCTracks = aod::track::signed1Pt < trackConfigs.cfgCutCharge; negFiltMCTracks.bindTable(filteredMCTracksThisColl); - if (filterOnRecoPhiWPDG && !eventHasRecoPhiWPDG(posFiltMCTracks, negFiltMCTracks, mcParticles)) - continue; + switch (filterOnRecoPhi) { + case 0: + if (!eventHasRecoPhi(posFiltMCTracks, negFiltMCTracks)) + continue; + break; + case 1: + if (!eventHasRecoPhiWPDG(posFiltMCTracks, negFiltMCTracks, mcParticles)) + continue; + break; + default: + break; + } mcEventHist.fill(HIST("hGenMCRecoMultiplicityPercent"), mcCollision.centFT0M()); mcEventHist.fill(HIST("h2GenMCRecoVertexZvsMult"), collision.posZ(), mcCollision.centFT0M()); From 788c0d67b0c625bd96e3332b17c1441fef40cf71 Mon Sep 17 00:00:00 2001 From: choich08365 <157435123+choich08365@users.noreply.github.com> Date: Tue, 26 Aug 2025 16:50:39 +0900 Subject: [PATCH 194/986] [PWGJE] Replaced IP3D/sigmaIP3D to IPz/sigmaIPz for GNN input features (#12730) Co-authored-by: Changhwan Choi --- PWGJE/Core/JetTaggingUtilities.h | 4 ++-- PWGJE/Tasks/bjetTreeCreator.cxx | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/PWGJE/Core/JetTaggingUtilities.h b/PWGJE/Core/JetTaggingUtilities.h index 616929ac1ed..849580fb1c8 100644 --- a/PWGJE/Core/JetTaggingUtilities.h +++ b/PWGJE/Core/JetTaggingUtilities.h @@ -1070,7 +1070,7 @@ void analyzeJetTrackInfo4GNN(AnalysisJet const& analysisJet, AnyTracks const& /* auto origConstit = constituent.template track_as(); if (static_cast(tracksParams.size()) < nMaxConstit) { - tracksParams.emplace_back(std::vector{constituent.pt(), origConstit.phi(), constituent.eta(), static_cast(constituent.sign()), std::abs(constituent.dcaXY()) * sign, constituent.sigmadcaXY(), std::abs(constituent.dcaXYZ()) * sign, constituent.sigmadcaXYZ(), static_cast(origConstit.itsNCls()), static_cast(origConstit.tpcNClsFound()), static_cast(origConstit.tpcNClsCrossedRows()), origConstit.itsChi2NCl(), origConstit.tpcChi2NCl()}); + tracksParams.emplace_back(std::vector{constituent.pt(), origConstit.phi(), constituent.eta(), static_cast(constituent.sign()), std::abs(constituent.dcaXY()) * sign, constituent.sigmadcaXY(), std::abs(constituent.dcaZ()) * sign, constituent.sigmadcaZ(), static_cast(origConstit.itsNCls()), static_cast(origConstit.tpcNClsFound()), static_cast(origConstit.tpcNClsCrossedRows()), origConstit.itsChi2NCl(), origConstit.tpcChi2NCl()}); } else { // If there are more than nMaxConstit constituents in the jet, select only nMaxConstit constituents with the highest DCA_XY significance. size_t minIdx = 0; @@ -1079,7 +1079,7 @@ void analyzeJetTrackInfo4GNN(AnalysisJet const& analysisJet, AnyTracks const& /* minIdx = i; } if (std::abs(constituent.dcaXY()) * sign / constituent.sigmadcaXY() > tracksParams[minIdx][4] / tracksParams[minIdx][5]) - tracksParams[minIdx] = std::vector{constituent.pt(), origConstit.phi(), constituent.eta(), static_cast(constituent.sign()), std::abs(constituent.dcaXY()) * sign, constituent.sigmadcaXY(), std::abs(constituent.dcaXYZ()) * sign, constituent.sigmadcaXYZ(), static_cast(origConstit.itsNCls()), static_cast(origConstit.tpcNClsFound()), static_cast(origConstit.tpcNClsCrossedRows()), origConstit.itsChi2NCl(), origConstit.tpcChi2NCl()}; + tracksParams[minIdx] = std::vector{constituent.pt(), origConstit.phi(), constituent.eta(), static_cast(constituent.sign()), std::abs(constituent.dcaXY()) * sign, constituent.sigmadcaXY(), std::abs(constituent.dcaZ()) * sign, constituent.sigmadcaZ(), static_cast(origConstit.itsNCls()), static_cast(origConstit.tpcNClsFound()), static_cast(origConstit.tpcNClsCrossedRows()), origConstit.itsChi2NCl(), origConstit.tpcChi2NCl()}; } } } diff --git a/PWGJE/Tasks/bjetTreeCreator.cxx b/PWGJE/Tasks/bjetTreeCreator.cxx index a3ea1f8611f..5ffa3d103e2 100644 --- a/PWGJE/Tasks/bjetTreeCreator.cxx +++ b/PWGJE/Tasks/bjetTreeCreator.cxx @@ -327,9 +327,9 @@ struct BJetTreeCreator { registry.add("h_trk_phi", "trk_phi;#it{#phi};Entries", {HistType::kTH1F, {{200, 0., o2::constants::math::TwoPI}}}); registry.add("h_trk_charge", "trk_charge;#it{q};Entries", {HistType::kTH1F, {{3, -1.5, 1.5}}}); registry.add("h_trk_dcaxy", "trk_dcaxy;#it{DCA}_{xy} (cm);Entries", {HistType::kTH1F, {{200, -0.1, 0.1}}}); - registry.add("h_trk_dcaxyz", "trk_dcaxyz;#it{DCA}_{xyz} (cm);Entries", {HistType::kTH1F, {{200, -0.1, 0.1}}}); + registry.add("h_trk_dcaz", "trk_dcaxyz;#it{DCA}_{z} (cm);Entries", {HistType::kTH1F, {{200, -0.1, 0.1}}}); registry.add("h_trk_sigmadcaxy", "trk_sigmadcaxy;#it{#sigma}_{#it{DCA}_{xy}} (cm);Entries", {HistType::kTH1F, {{200, 0., 0.1}}}); - registry.add("h_trk_sigmadcaxyz", "trk_sigmadcaxyz;#it{#sigma}_{#it{DCA}_{xyz}} (cm);Entries", {HistType::kTH1F, {{200, 0., 0.1}}}); + registry.add("h_trk_sigmadcaz", "trk_sigmadcaxyz;#it{#sigma}_{#it{DCA}_{z}} (cm);Entries", {HistType::kTH1F, {{200, 0., 0.1}}}); registry.add("h_trk_itsncls", "trk_itsncls;ITS NCls;Entries", {HistType::kTH1F, {{10, 0., 10.}}}); registry.add("h_trk_tpcncls", "trk_tpcncls;TPC NCls (Found);Entries", {HistType::kTH1F, {{200, 0., 200.}}}); registry.add("h_trk_tpcncrs", "trk_tpcncrs;TPC NCrossedRows;Entries", {HistType::kTH1F, {{200, 0., 200.}}}); @@ -529,9 +529,9 @@ struct BJetTreeCreator { registry.fill(HIST("h_trk_phi"), origConstit.phi(), eventweight); registry.fill(HIST("h_trk_charge"), constituent.sign(), eventweight); registry.fill(HIST("h_trk_dcaxy"), std::abs(constituent.dcaXY()) * sign, eventweight); - registry.fill(HIST("h_trk_dcaxyz"), std::abs(constituent.dcaXYZ()) * sign, eventweight); + registry.fill(HIST("h_trk_dcaz"), std::abs(constituent.dcaZ()) * sign, eventweight); registry.fill(HIST("h_trk_sigmadcaxy"), constituent.sigmadcaXY(), eventweight); - registry.fill(HIST("h_trk_sigmadcaxyz"), constituent.sigmadcaXYZ(), eventweight); + registry.fill(HIST("h_trk_sigmadcaz"), constituent.sigmadcaZ(), eventweight); registry.fill(HIST("h_trk_itsncls"), origConstit.itsNCls(), eventweight); registry.fill(HIST("h_trk_tpcncls"), origConstit.tpcNClsFound(), eventweight); registry.fill(HIST("h_trk_tpcncrs"), origConstit.tpcNClsCrossedRows(), eventweight); From f4f1a9daf15780504d285e78b5372a2ac8336308 Mon Sep 17 00:00:00 2001 From: Artem Kotliarov <71133985+KotliarovAr@users.noreply.github.com> Date: Tue, 26 Aug 2025 09:51:28 +0200 Subject: [PATCH 195/986] [PWGJE] add event selection based on multiplicity (#12725) --- PWGJE/Tasks/recoilJets.cxx | 622 +++++++++++++++++-------------------- 1 file changed, 280 insertions(+), 342 deletions(-) diff --git a/PWGJE/Tasks/recoilJets.cxx b/PWGJE/Tasks/recoilJets.cxx index 286b0b5004c..04600097baa 100644 --- a/PWGJE/Tasks/recoilJets.cxx +++ b/PWGJE/Tasks/recoilJets.cxx @@ -105,11 +105,8 @@ struct RecoilJets { "collision and track process functions"}; Configurable meanFT0A{"meanFT0A", -1.0, "Mean value of FT0A"}; - Configurable meanFT0C{"meanFT0C", -1.0, "Mean value of FT0C"}; - Configurable meanFT0M{"meanFT0M", -1.0, "Mean value of FT0M"}; - // List of configurable parameters for MC Configurable pTHatExponent{"pTHatExponent", 4.0, "Exponent of the event weight for the calculation of pTHat"}; @@ -133,6 +130,9 @@ struct RecoilJets { Configurable histJetPt{"histJetPt", 100, "Maximum value of jet pT shown in histograms"}; + Configurable histMultBins{"histMultBins", 1000, + "Number of bins for scaled FT0M multiplicity"}; + // Axes specification AxisSpec pT{histJetPt, 0.0, histJetPt * 1.0, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec jetPTcorr{histJetPt + 20, -20., histJetPt * 1.0, @@ -145,9 +145,12 @@ struct RecoilJets { AxisSpec jetArea{50, 0.0, 5., "Area_{jet}"}; AxisSpec rhoArea{60, 0.0, 60., "#it{#rho} #times Area_{jet}"}; AxisSpec rho{50, 0.0, 50., "#it{#rho}"}; + AxisSpec scaledFT0C{histMultBins, 0.0, 20., "FT0C / #LT FT0C #GT"}; + AxisSpec scaledFT0M{histMultBins, 0.0, 20., "FT0M^{*}"}; + ConfigurableAxis multFT0CPercentile{"multFT0CPercentile", {VARIABLE_WIDTH, 0, 0.2, 0.3, 0.4, 0.6, 0.8, 1., 1.4, 1.8, 2.4, 3.6, 5.0}, "Percentiles of scaled FT0C: 100-90%, 90-80%, 80-70%, 70-60%, 60-50%, 50-40%, 40-30%, 30-20%, 20-10%, 10-1%, 1-0.1%"}; // to adjust the boarders + ConfigurableAxis multFT0MPercentile{"multFT0MPercentile", {VARIABLE_WIDTH, 0, 0.2, 0.3, 0.4, 0.6, 0.8, 1., 1.4, 1.8, 2.4, 3.6, 5.0}, "Percentiles of scaled FT0M: 100-90%, 90-80%, 80-70%, 70-60%, 60-50%, 50-40%, 40-30%, 30-20%, 20-10%, 10-1%, 1-0.1%"}; - Preslice partJetsPerCollision = - aod::jet::mcCollisionId; + Preslice partJetsPerCollision = aod::jet::mcCollisionId; TRandom3* rand = new TRandom3(0); @@ -186,265 +189,170 @@ struct RecoilJets { // List of raw and MC det. distributions if (doprocessData || doprocessMCDetLevel || doprocessMCDetLevelWeighted) { - spectra.add("hEventSelectionCount", "Count # of events in the analysis", - kTH1F, {{3, 0.0, 3.}}); - spectra.get(HIST("hEventSelectionCount")) - ->GetXaxis() - ->SetBinLabel(1, "Total # of events"); - spectra.get(HIST("hEventSelectionCount")) - ->GetXaxis() - ->SetBinLabel( - 2, Form("# of events after sel. %s", evSelToString.data())); - spectra.get(HIST("hEventSelectionCount")) - ->GetXaxis() - ->SetBinLabel(3, "# of events w. outlier"); - - spectra.add("vertexZ", "Z vertex of collisions", kTH1F, - {{60, -12., 12.}}); - spectra.add("hHasAssocMcCollision", - "Has det. level coll. associat. MC coll.", kTH1F, - {{2, 0.0, 2.}}); - spectra.get(HIST("hHasAssocMcCollision")) - ->GetXaxis() - ->SetBinLabel(1, "Yes"); - spectra.get(HIST("hHasAssocMcCollision")) - ->GetXaxis() - ->SetBinLabel(2, "No"); - - spectra.add("hTrackSelectionCount", "Count # of tracks in the analysis", - kTH1F, {{2, 0.0, 2.}}); - spectra.get(HIST("hTrackSelectionCount")) - ->GetXaxis() - ->SetBinLabel(1, "Total # of tracks"); - spectra.get(HIST("hTrackSelectionCount")) - ->GetXaxis() - ->SetBinLabel( - 2, Form("# of tracks after sel. %s", trkSelToString.data())); - - spectra.add("hTrackPtEtaPhi", "Charact. of tracks", kTH3F, - {pT, pseudorap, phiAngle}); - - spectra.add( - "hTTSig_pT", "pT spectrum of all found TT_{Sig} cand.", kTH1F, - {{40, 10., - 50.}}); // needed to distinguish merged data from diff. wagons - - spectra.add("hNtrig", "Total number of selected triggers per class", - kTH1F, {{2, 0.0, 2.}}); - spectra.get(HIST("hNtrig"))->GetXaxis()->SetBinLabel(1, "TT_{ref}"); - spectra.get(HIST("hNtrig"))->GetXaxis()->SetBinLabel(2, "TT_{sig}"); - - spectra.add("hTTRef_per_event", "Number of TT_{Ref} per event", kTH1F, - {{15, 0.5, 15.5}}); - spectra.add("hTTSig_per_event", "Number of TT_{Sig} per event", kTH1F, - {{10, 0.5, 10.5}}); - - spectra.add("hJetPtEtaPhiRhoArea", "Charact. of inclusive jets", - kTHnSparseF, {pT, pseudorapJets, phiAngle, rho, jetArea}); - - spectra.add("hDPhi_JetPt_Corr_TTRef", - "Events w. TT_{Ref}: #Delta#varphi & #it{p}_{T, jet}^{ch}", - kTH2F, {deltaPhiAngle, jetPTcorr}); - spectra.add("hDPhi_JetPt_Corr_TTSig", - "Events w. TT_{Sig}: #Delta#varphi & #it{p}_{T, jet}^{ch}", - kTH2F, {deltaPhiAngle, jetPTcorr}); - spectra.add("hDPhi_JetPt_TTRef", - "Events w. TT_{Ref}: #Delta#varphi & #it{p}_{T, jet}^{ch}", - kTH2F, {deltaPhiAngle, pT}); - spectra.add("hDPhi_JetPt_TTSig", - "Events w. TT_{Sig}: #Delta#varphi & #it{p}_{T, jet}^{ch}", - kTH2F, {deltaPhiAngle, pT}); - - spectra.add("hRecoil_JetPt_Corr_TTRef", - "Events w. TT_{Ref}: #it{p}_{T} of recoil jets", kTH1F, - {jetPTcorr}); - spectra.add("hRecoil_JetPt_Corr_TTSig", - "Events w. TT_{Sig}: #it{p}_{T} of recoil jets", kTH1F, - {jetPTcorr}); - spectra.add("hRecoil_JetPt_TTRef", - "Events w. TT_{Ref}: #it{p}_{T} of recoil jets", kTH1F, {pT}); - spectra.add("hRecoil_JetPt_TTSig", - "Events w. TT_{Sig}: #it{p}_{T} of recoil jets", kTH1F, {pT}); - - spectra.add("hJetArea_JetPt_Rho_TTRef", - "Events w. TT_{Ref}: A_{jet} & jet pT & #rho", kTH3F, - {jetArea, pT, rho}); - spectra.add("hJetArea_JetPt_Rho_TTSig", - "Events w. TT_{Sig}: A_{jet} & jet pT & #rho", kTH3F, - {jetArea, pT, rho}); + spectra.add("hEventSelectionCount", "Count # of events in the analysis", kTH1F, {{3, 0.0, 3.}}); + spectra.get(HIST("hEventSelectionCount"))->GetXaxis()->SetBinLabel(1, "Total # of events"); + spectra.get(HIST("hEventSelectionCount"))->GetXaxis()->SetBinLabel(2, Form("# of events after sel. %s", evSelToString.data())); + spectra.get(HIST("hEventSelectionCount"))->GetXaxis()->SetBinLabel(3, "# of events w. outlier"); + + spectra.add("vertexZ", "Z vertex of collisions", kTH1F, {{60, -12., 12.}}); + spectra.add("hHasAssocMcCollision", "Has det. level coll. associat. MC coll.", kTH1F, {{2, 0.0, 2.}}); + spectra.get(HIST("hHasAssocMcCollision"))->GetXaxis()->SetBinLabel(1, "Yes"); + spectra.get(HIST("hHasAssocMcCollision"))->GetXaxis()->SetBinLabel(2, "No"); + + spectra.add("hTrackSelectionCount", "Count # of tracks in the analysis", kTH1F, {{2, 0.0, 2.}}); + spectra.get(HIST("hTrackSelectionCount"))->GetXaxis()->SetBinLabel(1, "Total # of tracks"); + spectra.get(HIST("hTrackSelectionCount"))->GetXaxis()->SetBinLabel(2, Form("# of tracks after sel. %s", trkSelToString.data())); + + spectra.add("hTrackPtEtaPhi", "Charact. of tracks", kTH3F, {pT, pseudorap, phiAngle}); + spectra.add("hTTSig_pT", "pT spectrum of all found TT_{Sig} cand.", kTH1F, {{40, 10., 50.}}); // needed to distinguish merged data from diff. wagons + + spectra.add("hScaledFT0C_vs_Ntrig", "Total number of selected triggers per class vs scaled FT0C", kTH2F, {{multFT0CPercentile}, {2, 0.0, 2.}}); + spectra.get(HIST("hScaledFT0C_vs_Ntrig"))->GetYaxis()->SetBinLabel(1, "TT_{ref}"); + spectra.get(HIST("hScaledFT0C_vs_Ntrig"))->GetYaxis()->SetBinLabel(2, "TT_{sig}"); + + spectra.add("hScaledFT0M_vs_Ntrig", "Total number of selected triggers per class vs scaled FT0M", kTH2F, {{multFT0MPercentile}, {2, 0.0, 2.}}); + spectra.get(HIST("hScaledFT0M_vs_Ntrig"))->GetYaxis()->SetBinLabel(1, "TT_{ref}"); + spectra.get(HIST("hScaledFT0M_vs_Ntrig"))->GetYaxis()->SetBinLabel(2, "TT_{sig}"); + + spectra.add("hScaledFT0C_vs_TTRef_per_event", "Number of TT_{Ref} per event vs scaled FT0C", kTH2F, {{multFT0CPercentile}, {15, 0.5, 15.5}}); + spectra.add("hScaledFT0M_vs_TTRef_per_event", "Number of TT_{Ref} per event vs scaled FT0M", kTH2F, {{multFT0MPercentile}, {15, 0.5, 15.5}}); + + spectra.add("hScaledFT0C_vs_TTSig_per_event", "Number of TT_{Sig} per event vs scaled FT0C", kTH2F, {{multFT0CPercentile}, {10, 0.5, 10.5}}); + spectra.add("hScaledFT0M_vs_TTSig_per_event", "Number of TT_{Sig} per event vs scaled FT0M", kTH2F, {{multFT0MPercentile}, {10, 0.5, 10.5}}); + + spectra.add("hJetPtEtaPhiRhoArea", "Charact. of inclusive jets", kTHnSparseF, {pT, pseudorapJets, phiAngle, rho, jetArea}); + + spectra.add("hScaledFT0C_DPhi_JetPt_Corr_TTRef", "Events w. TT_{Ref}: scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0CPercentile, deltaPhiAngle, jetPTcorr}); + spectra.add("hScaledFT0M_DPhi_JetPt_Corr_TTRef", "Events w. TT_{Ref}: scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0MPercentile, deltaPhiAngle, jetPTcorr}); + + spectra.add("hScaledFT0C_DPhi_JetPt_Corr_TTSig", "Events w. TT_{Sig}: scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0CPercentile, deltaPhiAngle, jetPTcorr}); + spectra.add("hScaledFT0M_DPhi_JetPt_Corr_TTSig", "Events w. TT_{Sig}: scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0MPercentile, deltaPhiAngle, jetPTcorr}); + + spectra.add("hScaledFT0C_DPhi_JetPt_TTRef", "Events w. TT_{Ref}: scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0CPercentile, deltaPhiAngle, pT}); + spectra.add("hScaledFT0M_DPhi_JetPt_TTRef", "Events w. TT_{Ref}: scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0MPercentile, deltaPhiAngle, pT}); + + spectra.add("hScaledFT0C_DPhi_JetPt_TTSig", "Events w. TT_{Sig}: scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0CPercentile, deltaPhiAngle, pT}); + spectra.add("hScaledFT0M_DPhi_JetPt_TTSig", "Events w. TT_{Sig}: scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0MPercentile, deltaPhiAngle, pT}); + + spectra.add("hScaledFT0C_Recoil_JetPt_Corr_TTRef", "Events w. TT_{Ref}: scaled FT0C & #it{p}_{T} of recoil jets", kTH2F, {multFT0CPercentile, jetPTcorr}); + spectra.add("hScaledFT0M_Recoil_JetPt_Corr_TTRef", "Events w. TT_{Ref}: scaled FT0M & #it{p}_{T} of recoil jets", kTH2F, {multFT0MPercentile, jetPTcorr}); + + spectra.add("hScaledFT0C_Recoil_JetPt_Corr_TTSig", "Events w. TT_{Sig}: scaled FT0C & #it{p}_{T} of recoil jets", kTH2F, {multFT0CPercentile, jetPTcorr}); + spectra.add("hScaledFT0M_Recoil_JetPt_Corr_TTSig", "Events w. TT_{Sig}: scaled FT0M & #it{p}_{T} of recoil jets", kTH2F, {multFT0MPercentile, jetPTcorr}); + + spectra.add("hScaledFT0C_Recoil_JetPt_TTRef", "Events w. TT_{Ref}: scaled FT0C & #it{p}_{T} of recoil jets", kTH2F, {multFT0CPercentile, pT}); + spectra.add("hScaledFT0M_Recoil_JetPt_TTRef", "Events w. TT_{Ref}: scaled FT0M & #it{p}_{T} of recoil jets", kTH2F, {multFT0MPercentile, pT}); + + spectra.add("hScaledFT0C_Recoil_JetPt_TTSig", "Events w. TT_{Sig}: scaled FT0C & #it{p}_{T} of recoil jets", kTH2F, {multFT0CPercentile, pT}); + spectra.add("hScaledFT0M_Recoil_JetPt_TTSig", "Events w. TT_{Sig}: scaled FT0M & #it{p}_{T} of recoil jets", kTH2F, {multFT0MPercentile, pT}); + + spectra.add("hJetArea_JetPt_Rho_TTRef", "Events w. TT_{Ref}: A_{jet} & jet pT & #rho", kTH3F, {jetArea, pT, rho}); + spectra.add("hJetArea_JetPt_Rho_TTSig", "Events w. TT_{Sig}: A_{jet} & jet pT & #rho", kTH3F, {jetArea, pT, rho}); + + spectra.add("hScaledFT0C_Rho_TTRef", "Events w. TT_{Ref}: scaled FT0C & #rho", kTH2F, {multFT0CPercentile, rho}); + spectra.add("hScaledFT0M_Rho_TTRef", "Events w. TT_{Ref}: scaled FT0M & #rho", kTH2F, {multFT0MPercentile, rho}); + + spectra.add("hScaledFT0C_Rho_TTSig", "Events w. TT_{Sig}: scaled FT0C & #rho", kTH2F, {multFT0CPercentile, rho}); + spectra.add("hScaledFT0M_Rho_TTSig", "Events w. TT_{Sig}: scaled FT0M & #rho", kTH2F, {multFT0MPercentile, rho}); + + spectra.add("hScaledFT0C_TTRef", "Events w. TT_{Ref}: scaled FT0C", kTH1F, {scaledFT0C}); + spectra.add("hScaledFT0M_TTRef", "Events w. TT_{Ref}: scaled FT0M", kTH1F, {scaledFT0M}); + + spectra.add("hScaledFT0C_TTSig", "Events w. TT_{Sig}: scaled FT0C", kTH1F, {scaledFT0C}); + spectra.add("hScaledFT0M_TTSig", "Events w. TT_{Sig}: scaled FT0M", kTH1F, {scaledFT0M}); } // List of MC particle level distributions if (doprocessMCPartLevel || doprocessMCPartLevelWeighted) { - spectra.add("vertexZMC", "Z vertex of jmccollision", kTH1F, - {{60, -12., 12.}}); + spectra.add("vertexZMC", "Z vertex of jmccollision", kTH1F, {{60, -12., 12.}}); spectra.add("ptHat", "Distribution of pT hat", kTH1F, {{500, 0.0, 100.}}); - spectra.add("hEventSelectionCountPartLevel", - "Count # of events in the part. level analysis", kTH1F, - {{2, 0.0, 2.}}); - spectra.get(HIST("hEventSelectionCountPartLevel")) - ->GetXaxis() - ->SetBinLabel(1, "Total # of events"); - spectra.get(HIST("hEventSelectionCountPartLevel")) - ->GetXaxis() - ->SetBinLabel(2, "# of events w. outlier"); - - spectra.add("hCountNumberOutliersFrameWork", - "Count # of outlier events based on flag from JE fw", kTH1F, - {{1, 0.0, 1.}}); - spectra.get(HIST("hCountNumberOutliersFrameWork")) - ->GetXaxis() - ->SetBinLabel(1, "Oulier flag true"); - - spectra.add("hPartPtEtaPhi", "Charact. of particles", kTH3F, - {pT, pseudorap, phiAngle}); - spectra.add("hNtrig_Part", "Total number of selected triggers per class", - kTH1F, {{2, 0.0, 2.}}); - spectra.get(HIST("hNtrig_Part")) - ->GetXaxis() - ->SetBinLabel(1, "TT_{ref}"); - spectra.get(HIST("hNtrig_Part")) - ->GetXaxis() - ->SetBinLabel(2, "TT_{sig}"); - - spectra.add("hTTRef_per_event_Part", "Number of TT_{Ref} per event", - kTH1F, {{15, 0.5, 15.5}}); - spectra.add("hTTSig_per_event_Part", "Number of TT_{Sig} per event", - kTH1F, {{10, 0.5, 10.5}}); - - spectra.add("hJetPtEtaPhiRhoArea_Part", - "Charact. of inclusive part. level jets", kTHnSparseF, - {pT, pseudorapJets, phiAngle, rho, jetArea}); - - spectra.add("hDPhi_JetPt_Corr_TTRef_Part", - "Events w. TT_{Ref}: #Delta#varphi & #it{p}_{T, jet}^{ch}", - kTH2F, {deltaPhiAngle, jetPTcorr}); - spectra.add("hDPhi_JetPt_Corr_TTSig_Part", - "Events w. TT_{Sig}: #Delta#varphi & #it{p}_{T, jet}^{ch}", - kTH2F, {deltaPhiAngle, jetPTcorr}); - spectra.add("hDPhi_JetPt_TTRef_Part", - "Events w. TT_{Ref}: #Delta#varphi & #it{p}_{T, jet}^{ch}", - kTH2F, {deltaPhiAngle, pT}); - spectra.add("hDPhi_JetPt_TTSig_Part", - "Events w. TT_{Sig}: #Delta#varphi & #it{p}_{T, jet}^{ch}", - kTH2F, {deltaPhiAngle, pT}); - - spectra.add("hRecoil_JetPt_Corr_TTRef_Part", - "Events w. TT_{Ref}: #it{p}_{T} of recoil jets", kTH1F, - {jetPTcorr}); - spectra.add("hRecoil_JetPt_Corr_TTSig_Part", - "Events w. TT_{Sig}: #it{p}_{T} of recoil jets", kTH1F, - {jetPTcorr}); - spectra.add("hRecoil_JetPt_TTRef_Part", - "Events w. TT_{Ref}: #it{p}_{T} of recoil jets", kTH1F, {pT}); - spectra.add("hRecoil_JetPt_TTSig_Part", - "Events w. TT_{Sig}: #it{p}_{T} of recoil jets", kTH1F, {pT}); - - spectra.add("hJetArea_JetPt_Rho_TTRef_Part", - "Events w. TT_{Ref}: A_{jet} & jet pT & #rho", kTH3F, - {jetArea, pT, rho}); - spectra.add("hJetArea_JetPt_Rho_TTSig_Part", - "Events w. TT_{Sig}: A_{jet} & jet pT & #rho", kTH3F, - {jetArea, pT, rho}); - - spectra.add("hDiffInOutlierRemove", - "Difference between pT hat from code and fw", kTH1F, - {{502, -0.2, 50.}}); + spectra.add("hEventSelectionCountPartLevel", "Count # of events in the part. level analysis", kTH1F, {{2, 0.0, 2.}}); + spectra.get(HIST("hEventSelectionCountPartLevel"))->GetXaxis()->SetBinLabel(1, "Total # of events"); + spectra.get(HIST("hEventSelectionCountPartLevel"))->GetXaxis()->SetBinLabel(2, "# of events w. outlier"); + + spectra.add("hCountNumberOutliersFrameWork", "Count # of outlier events based on flag from JE fw", kTH1F, {{1, 0.0, 1.}}); + spectra.get(HIST("hCountNumberOutliersFrameWork"))->GetXaxis()->SetBinLabel(1, "Outlier flag true"); + + spectra.add("hPartPtEtaPhi", "Charact. of particles", kTH3F, {pT, pseudorap, phiAngle}); + spectra.add("hNtrig_Part", "Total number of selected triggers per class", kTH1F, {{2, 0.0, 2.}}); + spectra.get(HIST("hNtrig_Part"))->GetXaxis()->SetBinLabel(1, "TT_{ref}"); + spectra.get(HIST("hNtrig_Part"))->GetXaxis()->SetBinLabel(2, "TT_{sig}"); + + spectra.add("hTTRef_per_event_Part", "Number of TT_{Ref} per event", kTH1F, {{15, 0.5, 15.5}}); + spectra.add("hTTSig_per_event_Part", "Number of TT_{Sig} per event", kTH1F, {{10, 0.5, 10.5}}); + + spectra.add("hJetPtEtaPhiRhoArea_Part", "Charact. of inclusive part. level jets", kTHnSparseF, {pT, pseudorapJets, phiAngle, rho, jetArea}); + + spectra.add("hDPhi_JetPt_Corr_TTRef_Part", "Events w. TT_{Ref}: #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH2F, {deltaPhiAngle, jetPTcorr}); + spectra.add("hDPhi_JetPt_Corr_TTSig_Part", "Events w. TT_{Sig}: #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH2F, {deltaPhiAngle, jetPTcorr}); + spectra.add("hDPhi_JetPt_TTRef_Part", "Events w. TT_{Ref}: #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH2F, {deltaPhiAngle, pT}); + spectra.add("hDPhi_JetPt_TTSig_Part", "Events w. TT_{Sig}: #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH2F, {deltaPhiAngle, pT}); + + spectra.add("hRecoil_JetPt_Corr_TTRef_Part", "Events w. TT_{Ref}: #it{p}_{T} of recoil jets", kTH1F, {jetPTcorr}); + spectra.add("hRecoil_JetPt_Corr_TTSig_Part", "Events w. TT_{Sig}: #it{p}_{T} of recoil jets", kTH1F, {jetPTcorr}); + spectra.add("hRecoil_JetPt_TTRef_Part", "Events w. TT_{Ref}: #it{p}_{T} of recoil jets", kTH1F, {pT}); + spectra.add("hRecoil_JetPt_TTSig_Part", "Events w. TT_{Sig}: #it{p}_{T} of recoil jets", kTH1F, {pT}); + + spectra.add("hJetArea_JetPt_Rho_TTRef_Part", "Events w. TT_{Ref}: A_{jet} & jet pT & #rho", kTH3F, {jetArea, pT, rho}); + spectra.add("hJetArea_JetPt_Rho_TTSig_Part", "Events w. TT_{Sig}: A_{jet} & jet pT & #rho", kTH3F, {jetArea, pT, rho}); + + spectra.add("hDiffInOutlierRemove", "Difference between pT hat from code and fw", kTH1F, {{502, -0.2, 50.}}); } // Jet matching: part. vs. det. if (doprocessJetsMatched || doprocessJetsMatchedWeighted) { - spectra.add("hJetPt_DetLevel_vs_PartLevel", - "Correlation jet pT at det. vs. part. levels", kTH2F, - {{200, 0.0, 200.}, {200, 0.0, 200.}}); + spectra.add("hJetPt_DetLevel_vs_PartLevel", "Correlation jet pT at det. vs. part. levels", kTH2F, {{200, 0.0, 200.}, {200, 0.0, 200.}}); // spectra.add("hJetPt_Corr_PartLevel_vs_DetLevel", "Correlation jet pT at // part. vs. det. levels", kTH2F, {jetPTcorr, jetPTcorr}); - spectra.add("hJetPt_DetLevel_vs_PartLevel_RecoilJets", - "Correlation recoil jet pT at part. vs. det. levels", kTH2F, - {{200, 0.0, 200.}, {200, 0.0, 200.}}); + spectra.add("hJetPt_DetLevel_vs_PartLevel_RecoilJets", "Correlation recoil jet pT at part. vs. det. levels", kTH2F, {{200, 0.0, 200.}, {200, 0.0, 200.}}); // spectra.add("hJetPt_Corr_PartLevel_vs_DetLevel_RecoilJets", // "Correlation recoil jet pT at part. vs. det. levels", kTH2F, // {jetPTcorr, jetPTcorr}); - spectra.add("hMissedJets_pT", "Part. level jets w/o matched pair", kTH1F, - {{200, 0.0, 200.}}); + spectra.add("hMissedJets_pT", "Part. level jets w/o matched pair", kTH1F, {{200, 0.0, 200.}}); // spectra.add("hMissedJets_Corr_pT", "Part. level jets w/o matched pair", // kTH1F, {jetPTcorr}); - spectra.add("hMissedJets_pT_RecoilJets", - "Part. level jets w/o matched pair", kTH1F, - {{200, 0.0, 200.}}); + spectra.add("hMissedJets_pT_RecoilJets", "Part. level jets w/o matched pair", kTH1F, {{200, 0.0, 200.}}); // spectra.add("hMissedJets_Corr_pT_RecoilJets", "Part. level jets w/o // matched pair", kTH1F, {jetPTcorr}); - spectra.add("hFakeJets_pT", "Det. level jets w/o matched pair", kTH1F, - {{200, 0.0, 200.}}); + spectra.add("hFakeJets_pT", "Det. level jets w/o matched pair", kTH1F, {{200, 0.0, 200.}}); // spectra.add("hFakeJets_Corr_pT", "Det. level jets w/o matched pair", // kTH1F, {jetPTcorr}); - spectra.add("hFakeJets_pT_RecoilJets", "Det. level jets w/o matched pair", - kTH1F, {{200, 0.0, 200.}}); + spectra.add("hFakeJets_pT_RecoilJets", "Det. level jets w/o matched pair", kTH1F, {{200, 0.0, 200.}}); // spectra.add("hFakeJets_Corr_pT_RecoilJets", "Det. level jets w/o // matched pair", kTH1F, {jetPTcorr}); - spectra.add( - "hJetPt_resolution", - "Jet p_{T} relative resolution as a func. of jet #it{p}_{T, part}", - kTH2F, {{100, -5., 5.}, pT}); - spectra.add( - "hJetPt_resolution_RecoilJets", - "Jet p_{T} relative resolution as a func. of jet #it{p}_{T, part}", - kTH2F, {{100, -5., 5.}, pT}); - - spectra.add("hJetPhi_resolution", - "#varphi resolution as a func. of jet #it{p}_{T, part}", - kTH2F, {{40, -1., 1.}, pT}); - spectra.add("hJetPhi_resolution_RecoilJets", - "#varphi resolution as a func. of jet #it{p}_{T, part}", - kTH2F, {{40, -1., 1.}, pT}); - - spectra.add("hNumberMatchedJetsPerOneBaseJet", - "# of taged jets per 1 base jet vs. jet pT", kTH2F, - {{10, 0.5, 10.5}, {100, 0.0, 100.}}); + spectra.add("hJetPt_resolution", "Jet p_{T} relative resolution as a func. of jet #it{p}_{T, part}", kTH2F, {{100, -5., 5.}, pT}); + spectra.add("hJetPt_resolution_RecoilJets", "Jet p_{T} relative resolution as a func. of jet #it{p}_{T, part}", kTH2F, {{100, -5., 5.}, pT}); + + spectra.add("hJetPhi_resolution", "#varphi resolution as a func. of jet #it{p}_{T, part}", kTH2F, {{40, -1., 1.}, pT}); + spectra.add("hJetPhi_resolution_RecoilJets", "#varphi resolution as a func. of jet #it{p}_{T, part}", kTH2F, {{40, -1., 1.}, pT}); + + spectra.add("hNumberMatchedJetsPerOneBaseJet", "# of tagged jets per 1 base jet vs. jet pT", kTH2F, {{10, 0.5, 10.5}, {100, 0.0, 100.}}); } if (doprocessMultiplicity) { - spectra.add("hMultFT0A", "Mult. signal from FTOA", kTH1F, - {{1500, 0.0, 30000.}}); - spectra.add("hMultFT0C", "Mult. signal from FTOC", kTH1F, - {{1500, 0.0, 30000.}}); - spectra.add("hMultFT0M", "Total mult. signal from FT0A & FTOC", kTH1F, - {{3000, 0.0, 60000.}}); - - spectra.add("hScaleMultFT0A", "Scaled mult. signal from FTOA", kTH1F, - {{200, 0.0, 20.}}); - spectra.add("hScaleMultFT0C", "Scaled mult. signal from FTOC", kTH1F, - {{200, 0.0, 20.}}); - spectra.add("hScaleMultFT0M", "Scaled total mult. signal from FT0A & FTOC", kTH1F, - {{2000, 0.0, 20.}}); - spectra.add("hScaleMultFT0M_v2", "Scaled total mult. signal from FT0A & FTOC", kTH1F, - {{2000, 0.0, 20.}}); - - spectra.add("hMultZNA", "Mult. signal from ZDC A-side", kTH1F, - {{500, 0.0, 10000.}}); - spectra.add("hMultZNC", "Mult. signal from ZDC C-side", kTH1F, - {{500, 0.0, 10000.}}); - spectra.add("hMultZNM", "Total mult. signal from ZDCs", kTH1F, - {{1000, 0.0, 20000.}}); + spectra.add("hMultFT0A", "Mult. signal from FTOA", kTH1F, {{2000, 0.0, 40000.}}); + spectra.add("hMultFT0C", "Mult. signal from FTOC", kTH1F, {{2000, 0.0, 40000.}}); + spectra.add("hMultFT0M", "Total mult. signal from FT0A & FTOC", kTH1F, {{3000, 0.0, 60000.}}); + + spectra.add("hScaleMultFT0A", "Scaled mult. signal from FTOA", kTH1F, {{200, 0.0, 20., "FT0A / #LT FT0A #GT"}}); + spectra.add("hScaleMultFT0C", "Scaled mult. signal from FTOC", kTH1F, {scaledFT0C}); + spectra.add("hScaleMultFT0M", "Scaled total mult. signal from FT0A & FTOC", kTH1F, {scaledFT0M}); + + spectra.add("hMultZNA", "Mult. signal from ZDC A-side", kTH1F, {{1000, 0.0, 5000.}}); + spectra.add("hMultZNC", "Mult. signal from ZDC C-side", kTH1F, {{1000, 0.0, 5000.}}); + spectra.add("hMultZNM", "Total mult. signal from ZDCs", kTH1F, {{4000, 0.0, 8000.}}); // Correlations - spectra.add("hMultFT0A_vs_ZNA", "Correlation of signals FTOA vs ZNA", - kTH2F, {{1500, 0.0, 30000.}, {500, 0.0, 10000.}}); - spectra.add("hMultFT0C_vs_ZNC", "Correlation of signals FTOC vs ZNC", - kTH2F, {{1500, 0.0, 30000.}, {500, 0.0, 10000.}}); - spectra.add("hMultFT0M_vs_ZNM", "Correlation of signals FTOM vs ZNM", - kTH2F, {{3000, 0.0, 60000.}, {1000, 0.0, 20000.}}); - spectra.add("hScaleMultFT0A_vs_ZNA", "Correlation of signals FT0A/meanFT0A vs ZNA", - kTH2F, {{200, 0.0, 20.}, {500, 0.0, 10000.}}); - spectra.add("hScaleMultFT0C_vs_ZNC", "Correlation of signals FT0C/meanFT0C vs ZNC", - kTH2F, {{200, 0.0, 20.}, {500, 0.0, 10000.}}); - spectra.add("hScaleMultFT0M_vs_ZNM", "Correlation of signals FT0M/meanTF0M vs ZNM", - kTH2F, {{200, 0.0, 20.}, {1000, 0.0, 20000.}}); - spectra.add("hScaleMultFT0Mv2_vs_ZNM", "Correlation of signals FT0M/meanTF0M v2 vs ZNM", - kTH2F, {{200, 0.0, 20.}, {1000, 0.0, 20000.}}); + spectra.add("hMultFT0A_vs_ZNA", "Correlation of signals FTOA vs ZNA", kTH2F, {{2000, 0.0, 40000.}, {1000, 0.0, 5000.}}); + spectra.add("hMultFT0C_vs_ZNC", "Correlation of signals FTOC vs ZNC", kTH2F, {{2000, 0.0, 40000.}, {1000, 0.0, 5000.}}); + spectra.add("hMultFT0M_vs_ZNM", "Correlation of signals FTOM vs ZNM", kTH2F, {{3000, 0.0, 60000.}, {4000, 0.0, 8000.}}); + + spectra.add("hScaleMultFT0A_vs_ZNA", "Correlation of signals FT0A/meanFT0A vs ZNA", kTH2F, {{200, 0.0, 20., "FT0A / #LT FT0A #GT"}, {1000, 0.0, 5000.}}); + spectra.add("hScaleMultFT0C_vs_ZNC", "Correlation of signals FT0C/meanFT0C vs ZNC", kTH2F, {{scaledFT0C}, {1000, 0.0, 5000.}}); + spectra.add("hScaleMultFT0M_vs_ZNM", "Correlation of signals FT0M^{*} vs ZNM", kTH2F, {{scaledFT0M}, {4000, 0.0, 8000.}}); } } @@ -458,6 +366,11 @@ struct RecoilJets { double phiTT = 0.; int nTT = 0; float pTHat = getPtHat(weight); + float rho = collision.rho(); + float multFT0A = collision.multFT0A(); + float multFT0C = collision.multFT0C(); + float scaledFT0C = getScaledFT0C(multFT0C); + float scaledFT0M = getScaledFT0M(multFT0A, multFT0C); auto dice = rand->Rndm(); if (dice < fracSig) @@ -477,18 +390,19 @@ struct RecoilJets { if (skipTrack(track)) continue; + float trackPt = track.pt(); + spectra.fill(HIST("hTrackSelectionCount"), 1.5); - spectra.fill(HIST("hTrackPtEtaPhi"), track.pt(), track.eta(), track.phi(), - weight); + spectra.fill(HIST("hTrackPtEtaPhi"), trackPt, track.eta(), track.phi(), weight); // Search for TT candidate - if (bSigEv && (track.pt() > ptTTsigMin && track.pt() < ptTTsigMax)) { + if (bSigEv && (trackPt > ptTTsigMin && trackPt < ptTTsigMax)) { vPhiOfTT.push_back(track.phi()); - spectra.fill(HIST("hTTSig_pT"), track.pt(), weight); + spectra.fill(HIST("hTTSig_pT"), trackPt, weight); ++nTT; } - if (!bSigEv && (track.pt() > ptTTrefMin && track.pt() < ptTTrefMax)) { + if (!bSigEv && (trackPt > ptTTrefMin && trackPt < ptTTrefMax)) { vPhiOfTT.push_back(track.phi()); ++nTT; } @@ -499,11 +413,21 @@ struct RecoilJets { phiTT = getPhiTT(vPhiOfTT); if (bSigEv) { - spectra.fill(HIST("hNtrig"), 1.5, weight); - spectra.fill(HIST("hTTSig_per_event"), nTT, weight); + spectra.fill(HIST("hScaledFT0C_vs_Ntrig"), scaledFT0C, 1.5, weight); + spectra.fill(HIST("hScaledFT0M_vs_Ntrig"), scaledFT0M, 1.5, weight); + spectra.fill(HIST("hScaledFT0C_vs_TTSig_per_event"), scaledFT0C, nTT, weight); + spectra.fill(HIST("hScaledFT0M_vs_TTSig_per_event"), scaledFT0M, nTT, weight); + + spectra.fill(HIST("hScaledFT0C_TTSig"), scaledFT0C, weight); + spectra.fill(HIST("hScaledFT0M_TTSig"), scaledFT0M, weight); } else { - spectra.fill(HIST("hNtrig"), 0.5, weight); - spectra.fill(HIST("hTTRef_per_event"), nTT, weight); + spectra.fill(HIST("hScaledFT0C_vs_Ntrig"), scaledFT0C, 0.5, weight); + spectra.fill(HIST("hScaledFT0M_vs_Ntrig"), scaledFT0M, 0.5, weight); + spectra.fill(HIST("hScaledFT0C_vs_TTRef_per_event"), scaledFT0C, nTT, weight); + spectra.fill(HIST("hScaledFT0M_vs_TTRef_per_event"), scaledFT0M, nTT, weight); + + spectra.fill(HIST("hScaledFT0C_TTRef"), scaledFT0C, weight); + spectra.fill(HIST("hScaledFT0M_TTRef"), scaledFT0M, weight); } } @@ -512,37 +436,51 @@ struct RecoilJets { if (isJetWithHighPtConstituent(jet, tracks)) continue; - spectra.fill(HIST("hJetPtEtaPhiRhoArea"), jet.pt(), jet.eta(), jet.phi(), - collision.rho(), jet.area(), weight); + float jetPt = jet.pt(); + float jetArea = jet.area(); + float jetPtCorr = jetPt - rho * jetArea; + + spectra.fill(HIST("hJetPtEtaPhiRhoArea"), jetPt, jet.eta(), jet.phi(), rho, jetArea, weight); if (nTT > 0) { auto [dphi, bRecoilJet] = isRecoilJet(jet, phiTT); if (bSigEv) { + spectra.fill(HIST("hScaledFT0C_Rho_TTSig"), scaledFT0C, rho, weight); + spectra.fill(HIST("hScaledFT0M_Rho_TTSig"), scaledFT0M, rho, weight); + + spectra.fill(HIST("hScaledFT0C_DPhi_JetPt_Corr_TTSig"), scaledFT0C, dphi, jetPtCorr, weight); + spectra.fill(HIST("hScaledFT0M_DPhi_JetPt_Corr_TTSig"), scaledFT0M, dphi, jetPtCorr, weight); - spectra.fill(HIST("hDPhi_JetPt_Corr_TTSig"), dphi, - jet.pt() - collision.rho() * jet.area(), weight); - spectra.fill(HIST("hDPhi_JetPt_TTSig"), dphi, jet.pt(), weight); - spectra.fill(HIST("hJetArea_JetPt_Rho_TTSig"), jet.area(), jet.pt(), - collision.rho(), weight); + spectra.fill(HIST("hScaledFT0C_DPhi_JetPt_TTSig"), scaledFT0C, dphi, jetPt, weight); + spectra.fill(HIST("hScaledFT0M_DPhi_JetPt_TTSig"), scaledFT0M, dphi, jetPt, weight); + spectra.fill(HIST("hJetArea_JetPt_Rho_TTSig"), jetArea, jetPt, rho, weight); if (bRecoilJet) { - spectra.fill(HIST("hRecoil_JetPt_Corr_TTSig"), - jet.pt() - collision.rho() * jet.area(), weight); - spectra.fill(HIST("hRecoil_JetPt_TTSig"), jet.pt(), weight); + spectra.fill(HIST("hScaledFT0C_Recoil_JetPt_Corr_TTSig"), scaledFT0C, jetPtCorr, weight); + spectra.fill(HIST("hScaledFT0M_Recoil_JetPt_Corr_TTSig"), scaledFT0M, jetPtCorr, weight); + + spectra.fill(HIST("hScaledFT0C_Recoil_JetPt_TTSig"), scaledFT0C, jetPt, weight); + spectra.fill(HIST("hScaledFT0M_Recoil_JetPt_TTSig"), scaledFT0M, jetPt, weight); } } else { - spectra.fill(HIST("hDPhi_JetPt_Corr_TTRef"), dphi, - jet.pt() - collision.rho() * jet.area(), weight); - spectra.fill(HIST("hDPhi_JetPt_TTRef"), dphi, jet.pt(), weight); - spectra.fill(HIST("hJetArea_JetPt_Rho_TTRef"), jet.area(), jet.pt(), - collision.rho(), weight); + spectra.fill(HIST("hScaledFT0C_Rho_TTRef"), scaledFT0C, rho, weight); + spectra.fill(HIST("hScaledFT0M_Rho_TTRef"), scaledFT0M, rho, weight); + + spectra.fill(HIST("hScaledFT0C_DPhi_JetPt_Corr_TTRef"), scaledFT0C, dphi, jetPtCorr, weight); + spectra.fill(HIST("hScaledFT0M_DPhi_JetPt_Corr_TTRef"), scaledFT0M, dphi, jetPtCorr, weight); + + spectra.fill(HIST("hScaledFT0C_DPhi_JetPt_TTRef"), scaledFT0C, dphi, jetPt, weight); + spectra.fill(HIST("hScaledFT0M_DPhi_JetPt_TTRef"), scaledFT0M, dphi, jetPt, weight); + spectra.fill(HIST("hJetArea_JetPt_Rho_TTRef"), jetArea, jetPt, rho, weight); if (bRecoilJet) { - spectra.fill(HIST("hRecoil_JetPt_Corr_TTRef"), - jet.pt() - collision.rho() * jet.area(), weight); - spectra.fill(HIST("hRecoil_JetPt_TTRef"), jet.pt(), weight); + spectra.fill(HIST("hScaledFT0C_Recoil_JetPt_Corr_TTRef"), scaledFT0C, jetPtCorr, weight); + spectra.fill(HIST("hScaledFT0M_Recoil_JetPt_Corr_TTRef"), scaledFT0M, jetPtCorr, weight); + + spectra.fill(HIST("hScaledFT0C_Recoil_JetPt_TTRef"), scaledFT0C, jetPt, weight); + spectra.fill(HIST("hScaledFT0M_Recoil_JetPt_TTRef"), scaledFT0M, jetPt, weight); } } } @@ -558,6 +496,8 @@ struct RecoilJets { double phiTT = 0.; int nTT = 0; float pTHat = getPtHat(weight); + float rho = collision.rho(); + spectra.fill(HIST("ptHat"), pTHat, weight); auto dice = rand->Rndm(); @@ -611,8 +551,11 @@ struct RecoilJets { } for (const auto& jet : jets) { - spectra.fill(HIST("hJetPtEtaPhiRhoArea_Part"), jet.pt(), jet.eta(), - jet.phi(), collision.rho(), jet.area(), weight); + float jetPt = jet.pt(); + float jetArea = jet.area(); + float jetPtCorr = jetPt - rho * jetArea; + + spectra.fill(HIST("hJetPtEtaPhiRhoArea_Part"), jetPt, jet.eta(), jet.phi(), rho, jetArea, weight); if (nTT > 0) { @@ -620,30 +563,24 @@ struct RecoilJets { if (bSigEv) { - spectra.fill(HIST("hDPhi_JetPt_Corr_TTSig_Part"), dphi, - jet.pt() - collision.rho() * jet.area(), weight); - spectra.fill(HIST("hDPhi_JetPt_TTSig_Part"), dphi, jet.pt(), weight); - spectra.fill(HIST("hJetArea_JetPt_Rho_TTSig_Part"), jet.area(), - jet.pt(), collision.rho(), weight); + spectra.fill(HIST("hDPhi_JetPt_Corr_TTSig_Part"), dphi, jetPtCorr, weight); + spectra.fill(HIST("hDPhi_JetPt_TTSig_Part"), dphi, jetPt, weight); + spectra.fill(HIST("hJetArea_JetPt_Rho_TTSig_Part"), jetArea, jetPt, rho, weight); if (bRecoilJet) { - spectra.fill(HIST("hRecoil_JetPt_Corr_TTSig_Part"), - jet.pt() - collision.rho() * jet.area(), weight); - spectra.fill(HIST("hRecoil_JetPt_TTSig_Part"), jet.pt(), weight); + spectra.fill(HIST("hRecoil_JetPt_Corr_TTSig_Part"), jetPtCorr, weight); + spectra.fill(HIST("hRecoil_JetPt_TTSig_Part"), jetPt, weight); } } else { - spectra.fill(HIST("hDPhi_JetPt_Corr_TTRef_Part"), dphi, - jet.pt() - collision.rho() * jet.area(), weight); - spectra.fill(HIST("hDPhi_JetPt_TTRef_Part"), dphi, jet.pt(), weight); - spectra.fill(HIST("hJetArea_JetPt_Rho_TTRef_Part"), jet.area(), - jet.pt(), collision.rho(), weight); + spectra.fill(HIST("hDPhi_JetPt_Corr_TTRef_Part"), dphi, jetPtCorr, weight); + spectra.fill(HIST("hDPhi_JetPt_TTRef_Part"), dphi, jetPt, weight); + spectra.fill(HIST("hJetArea_JetPt_Rho_TTRef_Part"), jetArea, jetPt, rho, weight); if (bRecoilJet) { - spectra.fill(HIST("hRecoil_JetPt_Corr_TTRef_Part"), - jet.pt() - collision.rho() * jet.area(), weight); - spectra.fill(HIST("hRecoil_JetPt_TTRef_Part"), jet.pt(), weight); + spectra.fill(HIST("hRecoil_JetPt_Corr_TTRef_Part"), jetPtCorr, weight); + spectra.fill(HIST("hRecoil_JetPt_TTRef_Part"), jetPt, weight); } } } @@ -689,39 +626,38 @@ struct RecoilJets { void fillMultiplicityHistograms(Collision const& collision, float weight = 1.) { - - spectra.fill(HIST("hMultFT0A"), collision.multFT0A(), weight); - spectra.fill(HIST("hMultFT0C"), collision.multFT0C(), weight); - spectra.fill(HIST("hMultFT0M"), collision.multFT0M(), weight); - - float scaledFT0Mv2 = 0.5 * (collision.multFT0A() / meanFT0A + collision.multFT0C() / meanFT0C); - - spectra.fill(HIST("hScaleMultFT0A"), collision.multFT0A() / meanFT0A, weight); - spectra.fill(HIST("hScaleMultFT0C"), collision.multFT0C() / meanFT0C, weight); - spectra.fill(HIST("hScaleMultFT0M"), collision.multFT0M() / meanFT0M, weight); - spectra.fill(HIST("hScaleMultFT0M_v2"), scaledFT0Mv2, - weight); - - spectra.fill(HIST("hMultZNA"), collision.multZNA(), weight); - spectra.fill(HIST("hMultZNC"), collision.multZNC(), weight); - spectra.fill(HIST("hMultZNM"), collision.multZNA() + collision.multZNC(), - weight); + float multFT0A = collision.multFT0A(); + float multFT0C = collision.multFT0C(); + float multFT0M = collision.multFT0M(); + float scaledFT0A = getScaledFT0A(multFT0A); + float scaledFT0C = getScaledFT0C(multFT0C); + float scaledFT0M = getScaledFT0M(multFT0A, multFT0C); + + float multZNA = collision.multZNA(); + float multZNC = collision.multZNC(); + float multZNM = collision.multZNA() + collision.multZNC(); + + // Individual distributions + spectra.fill(HIST("hMultFT0A"), multFT0A, weight); + spectra.fill(HIST("hMultFT0C"), multFT0C, weight); + spectra.fill(HIST("hMultFT0M"), multFT0M, weight); + + spectra.fill(HIST("hScaleMultFT0A"), scaledFT0A, weight); + spectra.fill(HIST("hScaleMultFT0C"), scaledFT0C, weight); + spectra.fill(HIST("hScaleMultFT0M"), scaledFT0M, weight); + + spectra.fill(HIST("hMultZNA"), multZNA, weight); + spectra.fill(HIST("hMultZNC"), multZNC, weight); + spectra.fill(HIST("hMultZNM"), multZNM, weight); // Correlations - spectra.fill(HIST("hMultFT0A_vs_ZNA"), collision.multFT0A(), - collision.multZNA(), weight); - spectra.fill(HIST("hMultFT0C_vs_ZNC"), collision.multFT0C(), - collision.multZNC(), weight); - spectra.fill(HIST("hMultFT0M_vs_ZNM"), collision.multFT0M(), - collision.multZNA() + collision.multZNC(), weight); - spectra.fill(HIST("hScaleMultFT0A_vs_ZNA"), collision.multFT0A() / meanFT0A, - collision.multZNA(), weight); - spectra.fill(HIST("hScaleMultFT0C_vs_ZNC"), collision.multFT0C() / meanFT0C, - collision.multZNC(), weight); - spectra.fill(HIST("hScaleMultFT0M_vs_ZNM"), collision.multFT0M() / meanFT0M, - collision.multZNA() + collision.multZNC(), weight); - spectra.fill(HIST("hScaleMultFT0Mv2_vs_ZNM"), scaledFT0Mv2, - collision.multZNA() + collision.multZNC(), weight); + spectra.fill(HIST("hMultFT0A_vs_ZNA"), multFT0A, multZNA, weight); + spectra.fill(HIST("hMultFT0C_vs_ZNC"), multFT0C, multZNC, weight); + spectra.fill(HIST("hMultFT0M_vs_ZNM"), multFT0M, multZNM, weight); + + spectra.fill(HIST("hScaleMultFT0A_vs_ZNA"), scaledFT0A, multZNA, weight); + spectra.fill(HIST("hScaleMultFT0C_vs_ZNC"), scaledFT0C, multZNC, weight); + spectra.fill(HIST("hScaleMultFT0M_vs_ZNM"), scaledFT0M, multZNM, weight); } //------------------------------------------------------------------------------ @@ -862,8 +798,7 @@ struct RecoilJets { fillMultiplicityHistograms(collision); } - PROCESS_SWITCH(RecoilJets, processMultiplicity, "process multiplicity", - false); + PROCESS_SWITCH(RecoilJets, processMultiplicity, "process multiplicity", false); //------------------------------------------------------------------------------ // Auxiliary functions @@ -871,17 +806,13 @@ struct RecoilJets { bool skipEvent(const Collision& coll) { /// \brief: trigger cut is needed for pp data - return !jetderiveddatautilities::selectCollision(coll, - eventSelectionBits) || - !jetderiveddatautilities::selectTrigger(coll, triggerMaskBits); + return !jetderiveddatautilities::selectCollision(coll, eventSelectionBits) || !jetderiveddatautilities::selectTrigger(coll, triggerMaskBits); } template bool skipMBGapEvent(const Collision& coll) { - return skipMBGapEvents && - coll.subGeneratorId() == - jetderiveddatautilities::JCollisionSubGeneratorId::mbGap; + return skipMBGapEvents && coll.subGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap; } template @@ -893,8 +824,7 @@ struct RecoilJets { template std::tuple isRecoilJet(const Jet& jet, double phiTT) { - double dphi = std::fabs( - RecoDecay::constrainAngle(jet.phi() - phiTT, -constants::math::PI)); + double dphi = std::fabs(RecoDecay::constrainAngle(jet.phi() - phiTT, -constants::math::PI)); return {dphi, (constants::math::PI - recoilRegion) < dphi}; } @@ -909,6 +839,21 @@ struct RecoilJets { return 10. / (std::pow(weight, 1.0 / pTHatExponent)); } + float getScaledFT0A(const float multFT0A) + { + return multFT0A / meanFT0A; + } + + float getScaledFT0C(const float multFT0C) + { + return multFT0C / meanFT0C; + } + + float getScaledFT0M(const float multFT0A, const float multFT0C) + { + return 0.5 * (getScaledFT0A(multFT0A) + getScaledFT0C(multFT0C)); + } + template bool isJetWithHighPtConstituent(Jet const& jet, Tracks const&) { @@ -927,11 +872,11 @@ struct RecoilJets { bool bIsBaseJetRecoil, TracksTable const& tracks, float weight = 1.) { + float partJetPt = partJet.pt(); bool bIsThereMatchedJet = partJet.has_matchedJetGeo(); if (bIsThereMatchedJet) { - const auto& jetsMatched = - partJet.template matchedJetGeo_as>(); + const auto& jetsMatched = partJet.template matchedJetGeo_as>(); for (const auto& jetMatched : jetsMatched) { @@ -940,36 +885,29 @@ struct RecoilJets { if (skipMatchedDetJet) { // Miss jets - spectra.fill(HIST("hMissedJets_pT"), partJet.pt(), weight); + spectra.fill(HIST("hMissedJets_pT"), partJetPt, weight); if (bIsBaseJetRecoil) - spectra.fill(HIST("hMissedJets_pT_RecoilJets"), partJet.pt(), weight); + spectra.fill(HIST("hMissedJets_pT_RecoilJets"), partJetPt, weight); } else { - spectra.fill(HIST("hNumberMatchedJetsPerOneBaseJet"), - jetsMatched.size(), jetMatched.pt(), weight); - spectra.fill(HIST("hJetPt_DetLevel_vs_PartLevel"), jetMatched.pt(), - partJet.pt(), weight); - spectra.fill(HIST("hJetPt_resolution"), - (partJet.pt() - jetMatched.pt()) / partJet.pt(), - partJet.pt(), weight); - spectra.fill(HIST("hJetPhi_resolution"), - partJet.phi() - jetMatched.phi(), partJet.pt(), weight); + float detJetPt = jetMatched.pt(); + + spectra.fill(HIST("hNumberMatchedJetsPerOneBaseJet"), jetsMatched.size(), detJetPt, weight); + spectra.fill(HIST("hJetPt_DetLevel_vs_PartLevel"), detJetPt, partJetPt, weight); + spectra.fill(HIST("hJetPt_resolution"), (partJetPt - detJetPt) / partJetPt, partJetPt, weight); + spectra.fill(HIST("hJetPhi_resolution"), partJet.phi() - jetMatched.phi(), partJetPt, weight); if (bIsBaseJetRecoil) { - spectra.fill(HIST("hJetPt_DetLevel_vs_PartLevel_RecoilJets"), - jetMatched.pt(), partJet.pt(), weight); - spectra.fill(HIST("hJetPt_resolution_RecoilJets"), - (partJet.pt() - jetMatched.pt()) / partJet.pt(), - partJet.pt(), weight); - spectra.fill(HIST("hJetPhi_resolution_RecoilJets"), - partJet.phi() - jetMatched.phi(), partJet.pt(), weight); + spectra.fill(HIST("hJetPt_DetLevel_vs_PartLevel_RecoilJets"), detJetPt, partJetPt, weight); + spectra.fill(HIST("hJetPt_resolution_RecoilJets"), (partJetPt - detJetPt) / partJetPt, partJetPt, weight); + spectra.fill(HIST("hJetPhi_resolution_RecoilJets"), partJet.phi() - jetMatched.phi(), partJetPt, weight); } } } } else { // Miss jets - spectra.fill(HIST("hMissedJets_pT"), partJet.pt(), weight); + spectra.fill(HIST("hMissedJets_pT"), partJetPt, weight); if (bIsBaseJetRecoil) - spectra.fill(HIST("hMissedJets_pT_RecoilJets"), partJet.pt(), weight); + spectra.fill(HIST("hMissedJets_pT_RecoilJets"), partJetPt, weight); } // Fake jets From ba53ebe98cd3e5271711043a381614e4d11b380f Mon Sep 17 00:00:00 2001 From: Archita-Dash <91664849+Archita-Dash@users.noreply.github.com> Date: Tue, 26 Aug 2025 09:51:53 +0200 Subject: [PATCH 196/986] [PWGJE] added sumw2 in histograms+ added BC process funtion (#12721) Co-authored-by: ALICE Action Bot --- PWGJE/Tasks/fullJetSpectra.cxx | 408 +++++++++++++++++++-------------- 1 file changed, 235 insertions(+), 173 deletions(-) diff --git a/PWGJE/Tasks/fullJetSpectra.cxx b/PWGJE/Tasks/fullJetSpectra.cxx index cdb14a1aa1c..80450cc1fa1 100644 --- a/PWGJE/Tasks/fullJetSpectra.cxx +++ b/PWGJE/Tasks/fullJetSpectra.cxx @@ -66,7 +66,7 @@ struct FullJetSpectra { Configurable centralityMin{"centralityMin", -999.0, "minimum centrality"}; Configurable centralityMax{"centralityMax", 999.0, "maximum centrality"}; Configurable doEMCALEventWorkaround{"doEMCALEventWorkaround", false, "apply the workaround to read the EMC trigger bit by requiring a cell content in the EMCAL"}; - Configurable doMBGapTrigger{"doMBGapTrigger", true, "set to true only when using MB-Gap Trigger JJ MC to reject MB events at the collision and track level"}; + Configurable doMBGapTrigger{"doMBGapTrigger", false, "set to true only when using MB-Gap Trigger JJ MC to reject MB events at the collision and track level"}; // Software Trigger configurables Configurable doSoftwareTriggerSelection{"doSoftwareTriggerSelection", false, "set to true when using triggered datasets"}; @@ -135,6 +135,7 @@ struct FullJetSpectra { // Instantiate the Zorro processor for skimmed data and define an output object Zorro zorro; OutputObj zorroSummary{"zorroSummary"}; + const bool doSumw2 = doMBGapTrigger; // Multiplicity Utilities // struct CentClass { @@ -175,6 +176,19 @@ struct FullJetSpectra { // Add Collision Histograms' Bin Labels for clarity void labelCollisionHistograms(HistogramRegistry& registry) { + if (doprocessBCs) { + auto hBCCounter = registry.get(HIST("hBCCounter")); + hBCCounter->GetXaxis()->SetBinLabel(1, "AllBC"); + hBCCounter->GetXaxis()->SetBinLabel(2, "BC+TVX"); + hBCCounter->GetXaxis()->SetBinLabel(3, "BC+TVX+NoTFB"); + hBCCounter->GetXaxis()->SetBinLabel(4, "BC+TVX+NoTFB+NoITSROFB"); + hBCCounter->GetXaxis()->SetBinLabel(5, "CollinBC"); + hBCCounter->GetXaxis()->SetBinLabel(6, "CollinBC+Sel8"); + hBCCounter->GetXaxis()->SetBinLabel(7, "CollinBC+Sel8Full"); + hBCCounter->GetXaxis()->SetBinLabel(8, "CollinBC+Sel8Full+GoodZvtx"); + hBCCounter->GetXaxis()->SetBinLabel(9, "CollinBC+Sel8Full+VtxZ+GoodZvtx"); + } + if (doprocessDataTracks || doprocessMCTracks) { auto hCollisionsUnweighted = registry.get(HIST("hCollisionsUnweighted")); hCollisionsUnweighted->GetXaxis()->SetBinLabel(1, "allDetColl"); @@ -358,208 +372,219 @@ struct FullJetSpectra { jetRadiiBins.push_back(jetRadiiBins[jetRadiiBins.size() - 1] + 0.1); } + // Sanity Log check + if (doSumw2) { + LOGF(info, "HistogramRegistry initialized with Sumw2 = ON (weighted JJ MC mode)."); + } else { + LOGF(info, "HistogramRegistry initialized with Sumw2 = OFF (unweighted mode)."); + } + + if (doprocessBCs) { + registry.add("hBCCounter", "", {HistType::kTH1F, {{10, 0.0, 10.}}}, doSumw2); + } + // Track QA histograms if (doprocessDataTracks || doprocessMCTracks || doprocessTracksWeighted) { - registry.add("hCollisionsUnweighted", "event status; event status;entries", {HistType::kTH1F, {{12, 0., 12.0}}}); + registry.add("hCollisionsUnweighted", "event status; event status;entries", {HistType::kTH1F, {{12, 0., 12.0}}}, doSumw2); - registry.add("h_track_pt", "track pT;#it{p}_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); - registry.add("h_track_eta", "track #eta;#eta_{track};entries", {HistType::kTH1F, {{100, -1., 1.}}}); - registry.add("h_track_phi", "track #varphi;#varphi_{track};entries", {HistType::kTH1F, {{160, 0., 7.}}}); - registry.add("h_track_energy", "track energy;Energy of tracks;entries", {HistType::kTH1F, {{400, 0., 400.}}}); - registry.add("h_track_energysum", "track energy sum;Sum of track energy per event;entries", {HistType::kTH1F, {{400, 0., 400.}}}); + registry.add("h_track_pt", "track pT;#it{p}_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}, doSumw2); + registry.add("h_track_eta", "track #eta;#eta_{track};entries", {HistType::kTH1F, {{100, -1., 1.}}}, doSumw2); + registry.add("h_track_phi", "track #varphi;#varphi_{track};entries", {HistType::kTH1F, {{160, 0., 7.}}}, doSumw2); + registry.add("h_track_energy", "track energy;Energy of tracks;entries", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); + registry.add("h_track_energysum", "track energy sum;Sum of track energy per event;entries", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); // Cluster QA histograms - registry.add("h_clusterTime", "Time of cluster", HistType::kTH1F, {{500, -250, 250, "#it{t}_{cls} (ns)"}}); - registry.add("h_cluster_pt", "cluster pT;#it{p}_{T_cluster} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}); - registry.add("h_cluster_eta", "cluster #eta;#eta_{cluster};entries", {HistType::kTH1F, {{100, -1., 1.}}}); - registry.add("h_cluster_phi", "cluster #varphi;#varphi_{cluster};entries", {HistType::kTH1F, {{160, 0., 7.}}}); - registry.add("h_cluster_energy", "cluster energy;Energy of cluster;entries", {HistType::kTH1F, {{400, 0., 400.}}}); - registry.add("h_cluster_energysum", "cluster energy sum;Sum of cluster energy per event;entries", {HistType::kTH1F, {{400, 0., 400.}}}); + registry.add("h_clusterTime", "Time of cluster", HistType::kTH1F, {{500, -250, 250, "#it{t}_{cls} (ns)"}}, doSumw2); + registry.add("h_cluster_pt", "cluster pT;#it{p}_{T_cluster} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}, doSumw2); + registry.add("h_cluster_eta", "cluster #eta;#eta_{cluster};entries", {HistType::kTH1F, {{100, -1., 1.}}}, doSumw2); + registry.add("h_cluster_phi", "cluster #varphi;#varphi_{cluster};entries", {HistType::kTH1F, {{160, 0., 7.}}}, doSumw2); + registry.add("h_cluster_energy", "cluster energy;Energy of cluster;entries", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); + registry.add("h_cluster_energysum", "cluster energy sum;Sum of cluster energy per event;entries", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); if (doprocessTracksWeighted) { - registry.add("hCollisionsWeighted", "event status;event status;entries", {HistType::kTH1F, {{12, 0.0, 12.0}}}); + registry.add("hCollisionsWeighted", "event status;event status;entries", {HistType::kTH1F, {{12, 0.0, 12.0}}}, doSumw2); } } // Jet QA histograms if (doprocessJetsData || doprocessJetsMCD || doprocessJetsMCDWeighted) { - registry.add("hDetcollisionCounter", "event status;event status;entries", {HistType::kTH1F, {{10, 0.0, 10.}}}); - - registry.add("h_full_jet_pt", "#it{p}_{T,jet};#it{p}_{T_jet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); - registry.add("h_full_jet_pt_pTHatcut", "#it{p}_{T,jet};#it{p}_{T_jet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); - registry.add("h_full_jet_eta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1., 1.}}}); - registry.add("h_full_jet_phi", "jet #varphi;#varphi_{jet};entries", {HistType::kTH1F, {{160, 0., 7.}}}); - registry.add("h_full_jet_clusterTime", "Time of cluster", HistType::kTH1F, {{500, -250, 250, "#it{t}_{cls} (ns)"}}); - registry.add("h2_full_jet_nef", "#it{p}_{T,jet} vs nef at Det Level; #it{p}_{T,jet} (GeV/#it{c});nef", {HistType::kTH2F, {{350, 0., 350.}, {105, 0., 1.05}}}); - registry.add("h2_full_jet_nef_rejected", "#it{p}_{T,jet} vs nef at Det Level for rejected events; #it{p}_{T,jet} (GeV/#it{c});nef", {HistType::kTH2F, {{350, 0., 350.}, {105, 0., 1.05}}}); - - registry.add("h_Detjet_ntracks", "#it{p}_{T,track};#it{p}_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); - registry.add("h2_full_jet_chargedconstituents", "Number of charged constituents at Det Level;#it{p}_{T,jet} (GeV/#it{c});N_{ch}", {HistType::kTH2F, {{350, 0., 350.}, {100, 0., 100.}}}); - registry.add("h2_full_jet_neutralconstituents", "Number of neutral constituents at Det Level;#it{p}_{T,jet} (GeV/#it{c});N_{ne}", {HistType::kTH2F, {{350, 0., 350.}, {100, 0., 100.}}}); - registry.add("h_full_jet_chargedconstituents_pt", "track pT;#it{p}^{T,jet}_{track} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); - registry.add("h_full_jet_chargedconstituents_eta", "track #eta;#eta^{jet}_{track};entries", {HistType::kTH1F, {{100, -1., 1.}}}); - registry.add("h_full_jet_chargedconstituents_phi", "track #varphi;#varphi^{jet}_{track};entries", {HistType::kTH1F, {{160, 0., 7.}}}); - registry.add("h_full_jet_chargedconstituents_energy", "track energy;Energy of tracks;entries", {HistType::kTH1F, {{400, 0., 400.}}}); - registry.add("h_full_jet_chargedconstituents_energysum", "track energy sum;Sum of track energy per event;entries", {HistType::kTH1F, {{400, 0., 400.}}}); - registry.add("h_full_jet_neutralconstituents_pt", "cluster pT;#it{p}^{T,jet}_{cluster} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}); - registry.add("h_full_jet_neutralconstituents_eta", "cluster #eta;#eta^{jet}_{cluster};entries", {HistType::kTH1F, {{100, -1., 1.}}}); - registry.add("h_full_jet_neutralconstituents_phi", "cluster #varphi;#varphi^{jet}_{cluster};entries", {HistType::kTH1F, {{160, 0., 7.}}}); - registry.add("h_full_jet_neutralconstituents_energy", "cluster energy;Energy of cluster;entries", {HistType::kTH1F, {{400, 0., 400.}}}); - registry.add("h_full_jet_neutralconstituents_energysum", "cluster energy sum;Sum of cluster energy per event;entries", {HistType::kTH1F, {{400, 0., 400.}}}); - registry.add("h2_full_jettrack_pt", "#it{p}_{T,jet} vs #it{p}_{T,track}; #it{p}_{T,jet} (GeV/#it{c});#it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{350, 0., 350.}, {200, 0., 200.}}}); - registry.add("h2_full_jettrack_eta", "jet #eta vs jet_track #eta; #eta_{jet};#eta_{track}", {HistType::kTH2F, {{100, -1., 1.}, {500, -5., 5.}}}); - registry.add("h2_full_jettrack_phi", "jet #varphi vs jet_track #varphi; #varphi_{jet}; #varphi_{track}", {HistType::kTH2F, {{160, 0., 7.}, {160, -1., 7.}}}); - - registry.add("h2_track_etaphi", "jet_track #eta vs jet_track #varphi; #eta_{track};#varphi_{track}", {HistType::kTH2F, {{500, -5., 5.}, {160, -1., 7.}}}); - registry.add("h2_jet_etaphi", "jet #eta vs jet #varphi; #eta_{jet};#varphi_{jet}", {HistType::kTH2F, {{100, -1., 1.}, {160, -1., 7.}}}); + registry.add("hDetcollisionCounter", "event status;event status;entries", {HistType::kTH1F, {{10, 0.0, 10.}}}, doSumw2); + + registry.add("h_full_jet_pt", "#it{p}_{T,jet};#it{p}_{T_jet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}, doSumw2); + registry.add("h_full_jet_pt_pTHatcut", "#it{p}_{T,jet};#it{p}_{T_jet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}, doSumw2); + registry.add("h_full_jet_eta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1., 1.}}}, doSumw2); + registry.add("h_full_jet_phi", "jet #varphi;#varphi_{jet};entries", {HistType::kTH1F, {{160, 0., 7.}}}, doSumw2); + registry.add("h_full_jet_clusterTime", "Time of cluster", HistType::kTH1F, {{500, -250, 250, "#it{t}_{cls} (ns)"}}, doSumw2); + registry.add("h2_full_jet_nef", "#it{p}_{T,jet} vs nef at Det Level; #it{p}_{T,jet} (GeV/#it{c});nef", {HistType::kTH2F, {{350, 0., 350.}, {105, 0., 1.05}}}, doSumw2); + registry.add("h2_full_jet_nef_rejected", "#it{p}_{T,jet} vs nef at Det Level for rejected events; #it{p}_{T,jet} (GeV/#it{c});nef", {HistType::kTH2F, {{350, 0., 350.}, {105, 0., 1.05}}}, doSumw2); + + registry.add("h_Detjet_ntracks", "#it{p}_{T,track};#it{p}_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}, doSumw2); + registry.add("h2_full_jet_chargedconstituents", "Number of charged constituents at Det Level;#it{p}_{T,jet} (GeV/#it{c});N_{ch}", {HistType::kTH2F, {{350, 0., 350.}, {100, 0., 100.}}}, doSumw2); + registry.add("h2_full_jet_neutralconstituents", "Number of neutral constituents at Det Level;#it{p}_{T,jet} (GeV/#it{c});N_{ne}", {HistType::kTH2F, {{350, 0., 350.}, {100, 0., 100.}}}, doSumw2); + registry.add("h_full_jet_chargedconstituents_pt", "track pT;#it{p}^{T,jet}_{track} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}, doSumw2); + registry.add("h_full_jet_chargedconstituents_eta", "track #eta;#eta^{jet}_{track};entries", {HistType::kTH1F, {{100, -1., 1.}}}, doSumw2); + registry.add("h_full_jet_chargedconstituents_phi", "track #varphi;#varphi^{jet}_{track};entries", {HistType::kTH1F, {{160, 0., 7.}}}, doSumw2); + registry.add("h_full_jet_chargedconstituents_energy", "track energy;Energy of tracks;entries", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); + registry.add("h_full_jet_chargedconstituents_energysum", "track energy sum;Sum of track energy per event;entries", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); + registry.add("h_full_jet_neutralconstituents_pt", "cluster pT;#it{p}^{T,jet}_{cluster} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}, doSumw2); + registry.add("h_full_jet_neutralconstituents_eta", "cluster #eta;#eta^{jet}_{cluster};entries", {HistType::kTH1F, {{100, -1., 1.}}}, doSumw2); + registry.add("h_full_jet_neutralconstituents_phi", "cluster #varphi;#varphi^{jet}_{cluster};entries", {HistType::kTH1F, {{160, 0., 7.}}}, doSumw2); + registry.add("h_full_jet_neutralconstituents_energy", "cluster energy;Energy of cluster;entries", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); + registry.add("h_full_jet_neutralconstituents_energysum", "cluster energy sum;Sum of cluster energy per event;entries", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); + registry.add("h2_full_jettrack_pt", "#it{p}_{T,jet} vs #it{p}_{T,track}; #it{p}_{T,jet} (GeV/#it{c});#it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{350, 0., 350.}, {200, 0., 200.}}}, doSumw2); + registry.add("h2_full_jettrack_eta", "jet #eta vs jet_track #eta; #eta_{jet};#eta_{track}", {HistType::kTH2F, {{100, -1., 1.}, {500, -5., 5.}}}, doSumw2); + registry.add("h2_full_jettrack_phi", "jet #varphi vs jet_track #varphi; #varphi_{jet}; #varphi_{track}", {HistType::kTH2F, {{160, 0., 7.}, {160, -1., 7.}}}, doSumw2); + + registry.add("h2_track_etaphi", "jet_track #eta vs jet_track #varphi; #eta_{track};#varphi_{track}", {HistType::kTH2F, {{500, -5., 5.}, {160, -1., 7.}}}, doSumw2); + registry.add("h2_jet_etaphi", "jet #eta vs jet #varphi; #eta_{jet};#varphi_{jet}", {HistType::kTH2F, {{100, -1., 1.}, {160, -1., 7.}}}, doSumw2); } if (doprocessJetsTriggeredData) { - registry.add("hDetTrigcollisionCounter", "event status;;entries", {HistType::kTH1F, {{14, 0.0, 14.}}}); + registry.add("hDetTrigcollisionCounter", "event status;;entries", {HistType::kTH1F, {{14, 0.0, 14.}}}, doSumw2); } if (doprocessJetsMCP || doprocessJetsMCPWeighted) { - registry.add("hPartcollisionCounter", "event status;event status;entries", {HistType::kTH1F, {{10, 0.0, 10.0}}}); - registry.add("hRecoMatchesPerMcCollision", "split vertices QA;;entries", {HistType::kTH1F, {{5, 0.0, 5.0}}}); - - registry.add("h_full_mcpjet_tablesize", "", {HistType::kTH1F, {{4, 0., 5.}}}); - registry.add("h_full_mcpjet_ntracks", "", {HistType::kTH1F, {{200, -0.5, 200.}}}); - registry.add("h_full_jet_pt_part", "jet pT;#it{p}_{T_jet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); - registry.add("h_full_jet_eta_part", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1., 1.}}}); - registry.add("h_full_jet_phi_part", "jet #varphi;#varphi_{jet};entries", {HistType::kTH1F, {{160, 0., 7.}}}); - registry.add("h2_full_jet_nef_part", "#it{p}_{T,jet} vs nef at Part Level;#it{p}_{T,jet} (GeV/#it{c});nef", {HistType::kTH2F, {{350, 0., 350.}, {105, 0., 1.05}}}); - - registry.add("h_Partjet_ntracks", "#it{p}_{T,constituent};#it{p}_{T_constituent} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); - registry.add("h2_full_jet_chargedconstituents_part", "Number of charged constituents at Part Level;#it{p}_{T,jet} (GeV/#it{c});N_{ch}", {HistType::kTH2F, {{350, 0., 350.}, {100, 0., 100.}}}); - registry.add("h2_full_jet_neutralconstituents_part", "Number of neutral constituents at Part Level;#it{p}_{T,jet} (GeV/#it{c});N_{ne}", {HistType::kTH2F, {{350, 0., 350.}, {100, 0., 100.}}}); - registry.add("h_full_jet_neutralconstituents_pt_part", "#it{p}_{T} of neutral constituents at Part Level;#it{p}_{T,ne} (GeV/#it{c}); entries", {HistType::kTH1F, {{350, 0., 350.}}}); - registry.add("h_full_jet_neutralconstituents_eta_part", "#eta of neutral constituents at Part Level;#eta_{ne};entries", {HistType::kTH1F, {{350, 0., 350.}}}); - registry.add("h_full_jet_neutralconstituents_phi_part", "#varphi of neutral constituents at Part Level;#varphi_{ne};entries", {HistType::kTH1F, {{350, 0., 350.}}}); - registry.add("h_full_jet_neutralconstituents_energy_part", "neutral constituents' energy;Energy of neutral constituents;entries", {HistType::kTH1F, {{400, 0., 400.}}}); - registry.add("h_full_jet_neutralconstituents_energysum_part", "neutral constituents' energy sum;Sum of neutral constituents' energy per event;entries", {HistType::kTH1F, {{400, 0., 400.}}}); - - registry.add("h2_jettrack_pt_part", "#it{p}_{T,jet} vs #it{p}_{T_track}; #it{p}_{T_jet} (GeV/#it{c});#it{p}_{T_track} (GeV/#it{c})", {HistType::kTH2F, {{350, 0., 350.}, {200, 0., 200.}}}); - registry.add("h2_jettrack_eta_part", "jet #eta vs jet_track #eta; #eta_{jet};#eta_{track}", {HistType::kTH2F, {{100, -1., 1.}, {500, -5., 5.}}}); - registry.add("h2_jettrack_phi_part", "jet #varphi vs jet_track #varphi; #varphi_{jet}; #varphi_{track}", {HistType::kTH2F, {{160, 0., 7.}, {160, -1., 7.}}}); - - registry.add("h2_track_etaphi_part", "jet_track #eta vs jet_track #varphi; #eta_{track};#varphi_{track}", {HistType::kTH2F, {{500, -5., 5.}, {160, -1., 7.}}}); - registry.add("h2_jet_etaphi_part", "jet #eta vs jet #varphi; #eta_{jet};#varphi_{jet}", {HistType::kTH2F, {{100, -1., 1.}, {160, -1., 7.}}}); + registry.add("hPartcollisionCounter", "event status;event status;entries", {HistType::kTH1F, {{10, 0.0, 10.0}}}, doSumw2); + registry.add("hRecoMatchesPerMcCollision", "split vertices QA;;entries", {HistType::kTH1F, {{5, 0.0, 5.0}}}, doSumw2); + + registry.add("h_full_mcpjet_tablesize", "", {HistType::kTH1F, {{4, 0., 5.}}}, doSumw2); + registry.add("h_full_mcpjet_ntracks", "", {HistType::kTH1F, {{200, -0.5, 200.}}}, doSumw2); + registry.add("h_full_jet_pt_part", "jet pT;#it{p}_{T_jet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}, doSumw2); + registry.add("h_full_jet_eta_part", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1., 1.}}}, doSumw2); + registry.add("h_full_jet_phi_part", "jet #varphi;#varphi_{jet};entries", {HistType::kTH1F, {{160, 0., 7.}}}, doSumw2); + registry.add("h2_full_jet_nef_part", "#it{p}_{T,jet} vs nef at Part Level;#it{p}_{T,jet} (GeV/#it{c});nef", {HistType::kTH2F, {{350, 0., 350.}, {105, 0., 1.05}}}, doSumw2); + + registry.add("h_Partjet_ntracks", "#it{p}_{T,constituent};#it{p}_{T_constituent} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}, doSumw2); + registry.add("h2_full_jet_chargedconstituents_part", "Number of charged constituents at Part Level;#it{p}_{T,jet} (GeV/#it{c});N_{ch}", {HistType::kTH2F, {{350, 0., 350.}, {100, 0., 100.}}}, doSumw2); + registry.add("h2_full_jet_neutralconstituents_part", "Number of neutral constituents at Part Level;#it{p}_{T,jet} (GeV/#it{c});N_{ne}", {HistType::kTH2F, {{350, 0., 350.}, {100, 0., 100.}}}, doSumw2); + registry.add("h_full_jet_neutralconstituents_pt_part", "#it{p}_{T} of neutral constituents at Part Level;#it{p}_{T,ne} (GeV/#it{c}); entries", {HistType::kTH1F, {{350, 0., 350.}}}, doSumw2); + registry.add("h_full_jet_neutralconstituents_eta_part", "#eta of neutral constituents at Part Level;#eta_{ne};entries", {HistType::kTH1F, {{350, 0., 350.}}}, doSumw2); + registry.add("h_full_jet_neutralconstituents_phi_part", "#varphi of neutral constituents at Part Level;#varphi_{ne};entries", {HistType::kTH1F, {{350, 0., 350.}}}, doSumw2); + registry.add("h_full_jet_neutralconstituents_energy_part", "neutral constituents' energy;Energy of neutral constituents;entries", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); + registry.add("h_full_jet_neutralconstituents_energysum_part", "neutral constituents' energy sum;Sum of neutral constituents' energy per event;entries", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); + + registry.add("h2_jettrack_pt_part", "#it{p}_{T,jet} vs #it{p}_{T_track}; #it{p}_{T_jet} (GeV/#it{c});#it{p}_{T_track} (GeV/#it{c})", {HistType::kTH2F, {{350, 0., 350.}, {200, 0., 200.}}}, doSumw2); + registry.add("h2_jettrack_eta_part", "jet #eta vs jet_track #eta; #eta_{jet};#eta_{track}", {HistType::kTH2F, {{100, -1., 1.}, {500, -5., 5.}}}, doSumw2); + registry.add("h2_jettrack_phi_part", "jet #varphi vs jet_track #varphi; #varphi_{jet}; #varphi_{track}", {HistType::kTH2F, {{160, 0., 7.}, {160, -1., 7.}}}, doSumw2); + + registry.add("h2_track_etaphi_part", "jet_track #eta vs jet_track #varphi; #eta_{track};#varphi_{track}", {HistType::kTH2F, {{500, -5., 5.}, {160, -1., 7.}}}, doSumw2); + registry.add("h2_jet_etaphi_part", "jet #eta vs jet #varphi; #eta_{jet};#varphi_{jet}", {HistType::kTH2F, {{100, -1., 1.}, {160, -1., 7.}}}, doSumw2); // registry.add("h_NOmcpemcalcollisions", "event status;entries", {HistType::kTH1F, {{100, 0., 100.}}}); // registry.add("h_mcpemcalcollisions", "event status;entries", {HistType::kTH1F, {{100, 0., 100.}}}); - registry.add("h2_full_mcpjetOutsideFiducial_pt", "MCP jet outside EMC Fiducial Acceptance #it{p}_{T,part};#it{p}_{T,part} (GeV/c); Ncounts", {HistType::kTH2F, {{350, 0., 350.}, {10000, 0., 10000.}}}); - registry.add("h_full_mcpjetOutside_eta_part", "MCP jet #eta outside EMC Fiducial Acceptance;#eta_{jet};entries", {HistType::kTH1F, {{100, -1., 1.}}}); - registry.add("h_full_mcpjetOutside_phi_part", "MCP jet #varphi outside EMC Fiducial Acceptance;#varphi_{jet};entries", {HistType::kTH1F, {{160, 0., 7.}}}); - registry.add("h2_full_mcpjetInsideFiducial_pt", "MCP jet #it{p}_{T,part} inside EMC Fiducial Acceptance;#it{p}_{T,part} (GeV/c); Ncounts", {HistType::kTH2F, {{350, 0., 350.}, {10000, 0., 10000.}}}); - registry.add("h_full_mcpjetInside_eta_part", "MCP jet #eta inside EMC Fiducial Acceptance;#eta_{jet};entries", {HistType::kTH1F, {{100, -1., 1.}}}); - registry.add("h_full_mcpjetInside_phi_part", "MCP jet #varphi inside EMC Fiducial Acceptance;#varphi_{jet};entries", {HistType::kTH1F, {{160, 0., 7.}}}); + registry.add("h2_full_mcpjetOutsideFiducial_pt", "MCP jet outside EMC Fiducial Acceptance #it{p}_{T,part};#it{p}_{T,part} (GeV/c); Ncounts", {HistType::kTH2F, {{350, 0., 350.}, {10000, 0., 10000.}}}, doSumw2); + registry.add("h_full_mcpjetOutside_eta_part", "MCP jet #eta outside EMC Fiducial Acceptance;#eta_{jet};entries", {HistType::kTH1F, {{100, -1., 1.}}}, doSumw2); + registry.add("h_full_mcpjetOutside_phi_part", "MCP jet #varphi outside EMC Fiducial Acceptance;#varphi_{jet};entries", {HistType::kTH1F, {{160, 0., 7.}}}, doSumw2); + registry.add("h2_full_mcpjetInsideFiducial_pt", "MCP jet #it{p}_{T,part} inside EMC Fiducial Acceptance;#it{p}_{T,part} (GeV/c); Ncounts", {HistType::kTH2F, {{350, 0., 350.}, {10000, 0., 10000.}}}, doSumw2); + registry.add("h_full_mcpjetInside_eta_part", "MCP jet #eta inside EMC Fiducial Acceptance;#eta_{jet};entries", {HistType::kTH1F, {{100, -1., 1.}}}, doSumw2); + registry.add("h_full_mcpjetInside_phi_part", "MCP jet #varphi inside EMC Fiducial Acceptance;#varphi_{jet};entries", {HistType::kTH1F, {{160, 0., 7.}}}, doSumw2); } if (doprocessJetsMCPMCDMatched || doprocessJetsMCPMCDMatchedWeighted) { - registry.add("hMatchedcollisionCounter", "event status;event status;entries", {HistType::kTH1F, {{10, 0.0, 10.0}}}); - - registry.add("h_full_matchedmcdjet_tablesize", "", {HistType::kTH1F, {{350, 0., 350.}}}); - registry.add("h_full_matchedmcpjet_tablesize", "", {HistType::kTH1F, {{350, 0., 350.}}}); - registry.add("h_full_matchedmcdjet_ntracks", "", {HistType::kTH1F, {{200, -0.5, 200.}}}); - registry.add("h_full_matchedmcpjet_ntracks", "", {HistType::kTH1F, {{200, -0.5, 200.}}}); - registry.add("h_full_matchedmcdjet_eta", "Matched MCD jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1., 1.}}}); - registry.add("h_full_matchedmcdjet_phi", "Matched MCD jet #varphi;#varphi_{jet};entries", {HistType::kTH1F, {{160, 0., 7.}}}); - registry.add("h_full_matchedmcpjet_eta", "Matched MCP jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1., 1.}}}); - registry.add("h_full_matchedmcpjet_phi", "Matched MCP jet #varphi;#varphi_{jet};entries", {HistType::kTH1F, {{160, 0., 7.}}}); - registry.add("h_full_jet_deltaR", "Distance between matched Det Jet and Part Jet; #Delta R; entries", {HistType::kTH1F, {{100, 0., 1.}}}); - - registry.add("h2_full_jet_energyscaleDet", "Jet Energy Scale (det); p_{T,det} (GeV/c); (p_{T,det} - p_{T,part})/p_{T,part}", {HistType::kTH2F, {{400, 0., 400.}, {200, -1., 1.}}}); - - registry.add("h2_matchedjet_etaphiDet", "Det jet #eta vs jet #varphi; #eta_{jet};#varphi_{jet}", {HistType::kTH2F, {{100, -1., 1.}, {160, -1., 7.}}}); - registry.add("h2_matchedjet_etaphiPart", "Part jet #eta vs jet #varphi; #eta_{jet};#varphi_{jet}", {HistType::kTH2F, {{100, -1., 1.}, {160, -1., 7.}}}); - registry.add("h2_matchedjet_deltaEtaCorr", "Correlation between Det Eta and Part Eta; #eta_{jet,det}; #eta_{jet,part}", {HistType::kTH2F, {{100, -1., 1.}, {100, -1., 1.}}}); - registry.add("h2_matchedjet_deltaPhiCorr", "Correlation between Det Phi and Part Phi; #varphi_{jet,det}; #varphi_{jet,part}", {HistType::kTH2F, {{160, 0., 7.}, {160, 0., 7.}}}); - - registry.add("h2_full_jet_energyscalePart", "Jet Energy Scale (part); p_{T,part} (GeV/c); (p_{T,det} - p_{T,part})/p_{T,part}", {HistType::kTH2F, {{400, 0., 400.}, {200, -1., 1.}}}); - registry.add("h3_full_jet_energyscalePart", "R dependence of Jet Energy Scale (Part); #it{R}_{jet};p_{T,det} (GeV/c); (p_{T,det} - p_{T,part})/p_{T,part}", {HistType::kTH3F, {{jetRadiiBins, ""}, {400, 0., 400.}, {200, -1., 1.}}}); - registry.add("h2_full_jet_etaresolutionPart", ";p_{T,part} (GeV/c); (#eta_{jet,det} - #eta_{jet,part})/#eta_{jet,part}", {HistType::kTH2F, {{400, 0., 400.}, {100, -1., 1.}}}); - registry.add("h2_full_jet_phiresolutionPart", ";p_{T,part} (GeV/c); (#varphi_{jet,det} - #varphi_{jet,part})/#varphi_{jet,part}", {HistType::kTH2F, {{400, 0., 400.}, {160, -1., 7.}}}); - registry.add("h2_full_jet_energyscaleChargedPart", "Jet Energy Scale (charged part); p_{T,part} (GeV/c); (p_{T,det} - p_{T,part})/p_{T,part}", {HistType::kTH2F, {{400, 0., 400.}, {200, -1., 1.}}}); - registry.add("h2_full_jet_energyscaleNeutralPart", "Jet Energy Scale (neutral part); p_{T,part} (GeV/c); (p_{T,det} - p_{T,part})/p_{T,part}", {HistType::kTH2F, {{400, 0., 400.}, {200, -1., 1.}}}); - registry.add("h2_full_jet_energyscaleChargedVsFullPart", "Jet Energy Scale (charged part, vs. full jet pt); p_{T,part} (GeV/c); (p_{T,det} - p_{T,part})/p_{T,part}", {HistType::kTH2F, {{400, 0., 400.}, {200, -1., 1.}}}); - registry.add("h2_full_jet_energyscaleNeutralVsFullPart", "Jet Energy Scale (neutral part, vs. full jet pt); p_{T,part} (GeV/c); (p_{T,det} - p_{T,part})/p_{T,part}", {HistType::kTH2F, {{400, 0., 400.}, {200, -1., 1.}}}); - registry.add("h2_full_fakemcdjets", "Fake MCD Jets; p_{T,det} (GeV/c); NCounts", {HistType::kTH2F, {{350, 0., 350.}, {100, 0., 100.}}}); - registry.add("h2FullfakeMcpJets", "Fake MCP Jets; p_{T,part} (GeV/c); NCounts", {HistType::kTH2F, {{350, 0., 350.}, {100, 0., 100.}}}); - registry.add("h2_full_matchedmcpjet_pt", "Matched MCP jet in EMC Fiducial Acceptance #it{p}_{T,part};#it{p}_{T,part} (GeV/c); Ncounts", {HistType::kTH2F, {{350, 0., 350.}, {10000, 0., 10000.}}}); + registry.add("hMatchedcollisionCounter", "event status;event status;entries", {HistType::kTH1F, {{10, 0.0, 10.0}}}, doSumw2); + + registry.add("h_full_matchedmcdjet_tablesize", "", {HistType::kTH1F, {{350, 0., 350.}}}, doSumw2); + registry.add("h_full_matchedmcpjet_tablesize", "", {HistType::kTH1F, {{350, 0., 350.}}}, doSumw2); + registry.add("h_full_matchedmcdjet_ntracks", "", {HistType::kTH1F, {{200, -0.5, 200.}}}, doSumw2); + registry.add("h_full_matchedmcpjet_ntracks", "", {HistType::kTH1F, {{200, -0.5, 200.}}}, doSumw2); + registry.add("h_full_matchedmcdjet_eta", "Matched MCD jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1., 1.}}}, doSumw2); + registry.add("h_full_matchedmcdjet_phi", "Matched MCD jet #varphi;#varphi_{jet};entries", {HistType::kTH1F, {{160, 0., 7.}}}, doSumw2); + registry.add("h_full_matchedmcpjet_eta", "Matched MCP jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1., 1.}}}, doSumw2); + registry.add("h_full_matchedmcpjet_phi", "Matched MCP jet #varphi;#varphi_{jet};entries", {HistType::kTH1F, {{160, 0., 7.}}}, doSumw2); + registry.add("h_full_jet_deltaR", "Distance between matched Det Jet and Part Jet; #Delta R; entries", {HistType::kTH1F, {{100, 0., 1.}}}, doSumw2); + + registry.add("h2_full_jet_energyscaleDet", "Jet Energy Scale (det); p_{T,det} (GeV/c); (p_{T,det} - p_{T,part})/p_{T,part}", {HistType::kTH2F, {{400, 0., 400.}, {200, -1., 1.}}}, doSumw2); + + registry.add("h2_matchedjet_etaphiDet", "Det jet #eta vs jet #varphi; #eta_{jet};#varphi_{jet}", {HistType::kTH2F, {{100, -1., 1.}, {160, -1., 7.}}}, doSumw2); + registry.add("h2_matchedjet_etaphiPart", "Part jet #eta vs jet #varphi; #eta_{jet};#varphi_{jet}", {HistType::kTH2F, {{100, -1., 1.}, {160, -1., 7.}}}, doSumw2); + registry.add("h2_matchedjet_deltaEtaCorr", "Correlation between Det Eta and Part Eta; #eta_{jet,det}; #eta_{jet,part}", {HistType::kTH2F, {{100, -1., 1.}, {100, -1., 1.}}}, doSumw2); + registry.add("h2_matchedjet_deltaPhiCorr", "Correlation between Det Phi and Part Phi; #varphi_{jet,det}; #varphi_{jet,part}", {HistType::kTH2F, {{160, 0., 7.}, {160, 0., 7.}}}, doSumw2); + + registry.add("h2_full_jet_energyscalePart", "Jet Energy Scale (part); p_{T,part} (GeV/c); (p_{T,det} - p_{T,part})/p_{T,part}", {HistType::kTH2F, {{400, 0., 400.}, {200, -1., 1.}}}, doSumw2); + registry.add("h3_full_jet_energyscalePart", "R dependence of Jet Energy Scale (Part); #it{R}_{jet};p_{T,det} (GeV/c); (p_{T,det} - p_{T,part})/p_{T,part}", {HistType::kTH3F, {{jetRadiiBins, ""}, {400, 0., 400.}, {200, -1., 1.}}}, doSumw2); + registry.add("h2_full_jet_etaresolutionPart", ";p_{T,part} (GeV/c); (#eta_{jet,det} - #eta_{jet,part})/#eta_{jet,part}", {HistType::kTH2F, {{400, 0., 400.}, {100, -1., 1.}}}, doSumw2); + registry.add("h2_full_jet_phiresolutionPart", ";p_{T,part} (GeV/c); (#varphi_{jet,det} - #varphi_{jet,part})/#varphi_{jet,part}", {HistType::kTH2F, {{400, 0., 400.}, {160, -1., 7.}}}, doSumw2); + registry.add("h2_full_jet_energyscaleChargedPart", "Jet Energy Scale (charged part); p_{T,part} (GeV/c); (p_{T,det} - p_{T,part})/p_{T,part}", {HistType::kTH2F, {{400, 0., 400.}, {200, -1., 1.}}}, doSumw2); + registry.add("h2_full_jet_energyscaleNeutralPart", "Jet Energy Scale (neutral part); p_{T,part} (GeV/c); (p_{T,det} - p_{T,part})/p_{T,part}", {HistType::kTH2F, {{400, 0., 400.}, {200, -1., 1.}}}, doSumw2); + registry.add("h2_full_jet_energyscaleChargedVsFullPart", "Jet Energy Scale (charged part, vs. full jet pt); p_{T,part} (GeV/c); (p_{T,det} - p_{T,part})/p_{T,part}", {HistType::kTH2F, {{400, 0., 400.}, {200, -1., 1.}}}, doSumw2); + registry.add("h2_full_jet_energyscaleNeutralVsFullPart", "Jet Energy Scale (neutral part, vs. full jet pt); p_{T,part} (GeV/c); (p_{T,det} - p_{T,part})/p_{T,part}", {HistType::kTH2F, {{400, 0., 400.}, {200, -1., 1.}}}, doSumw2); + registry.add("h2_full_fakemcdjets", "Fake MCD Jets; p_{T,det} (GeV/c); NCounts", {HistType::kTH2F, {{350, 0., 350.}, {100, 0., 100.}}}, doSumw2); + registry.add("h2FullfakeMcpJets", "Fake MCP Jets; p_{T,part} (GeV/c); NCounts", {HistType::kTH2F, {{350, 0., 350.}, {100, 0., 100.}}}, doSumw2); + registry.add("h2_full_matchedmcpjet_pt", "Matched MCP jet in EMC Fiducial Acceptance #it{p}_{T,part};#it{p}_{T,part} (GeV/c); Ncounts", {HistType::kTH2F, {{350, 0., 350.}, {10000, 0., 10000.}}}, doSumw2); // Response Matrix - registry.add("h_full_jet_ResponseMatrix", "Full Jets Response Matrix; p_{T,det} (GeV/c); p_{T,part} (GeV/c)", {HistType::kTH2F, {{500, 0., 500.}, {500, 0., 500.}}}); + registry.add("h_full_jet_ResponseMatrix", "Full Jets Response Matrix; p_{T,det} (GeV/c); p_{T,part} (GeV/c)", {HistType::kTH2F, {{500, 0., 500.}, {500, 0., 500.}}}, doSumw2); } if (doprocessMBCollisionsDATAWithMultiplicity || doprocessMBMCDCollisionsWithMultiplicity || doprocessMCDCollisionsWeightedWithMultiplicity) { - registry.add("hEventmultiplicityCounter", "event status;event status;entries", {HistType::kTH1F, {{10, 0.0, 10.0}}}); - registry.add("h_FT0Mults_occupancy", "", {HistType::kTH1F, {{3500, 0., 3500.}}}); - - registry.add("h_all_fulljet_Njets", "Full Jet Multiplicity (per Event)", {HistType::kTH1F, {{20, 0., 20.}}}); - registry.add("h_Leading_full_jet_pt", "#it{p}_{T,leading jet};#it{p}_{T_leading jet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); - registry.add("h2_full_jet_leadingJetPt_vs_counts", ";#it{p}_{T_leading jet} (GeV/#it{c}); Counts", {HistType::kTH2F, {{350, 0., 350.}, {20, 0., 20.}}}); - registry.add("h_SubLeading_full_jet_pt", "#it{p}_{T,leading jet};#it{p}_{T_leading jet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); - registry.add("h2_full_jet_subLeadingJetPt_vs_counts", ";#it{p}_{T_leading jet} (GeV/#it{c}); Counts", {HistType::kTH2F, {{350, 0., 350.}, {20, 0., 20.}}}); + registry.add("hEventmultiplicityCounter", "event status;event status;entries", {HistType::kTH1F, {{10, 0.0, 10.0}}}, doSumw2); + registry.add("h_FT0Mults_occupancy", "", {HistType::kTH1F, {{3500, 0., 3500.}}}, doSumw2); + + registry.add("h_all_fulljet_Njets", "Full Jet Multiplicity (per Event)", {HistType::kTH1F, {{20, 0., 20.}}}, doSumw2); + registry.add("h_Leading_full_jet_pt", "#it{p}_{T,leading jet};#it{p}_{T_leading jet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}, doSumw2); + registry.add("h2_full_jet_leadingJetPt_vs_counts", ";#it{p}_{T_leading jet} (GeV/#it{c}); Counts", {HistType::kTH2F, {{350, 0., 350.}, {20, 0., 20.}}}, doSumw2); + registry.add("h_SubLeading_full_jet_pt", "#it{p}_{T,leading jet};#it{p}_{T_leading jet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}, doSumw2); + registry.add("h2_full_jet_subLeadingJetPt_vs_counts", ";#it{p}_{T_leading jet} (GeV/#it{c}); Counts", {HistType::kTH2F, {{350, 0., 350.}, {20, 0., 20.}}}, doSumw2); // Inside Jet Loop: // CASE 1: - registry.add("h_all_fulljet_pt", "#it{p}_{T,fulljet};#it{p}_{T_fulljet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); - registry.add("h_all_fulljet_Nch", ";N_{ch};", {HistType::kTH1F, {{50, 0., 50.}}}); - registry.add("h_all_fulljet_NEF", ";NEF;", {HistType::kTH1F, {{105, 0., 1.05}}}); - registry.add("h2_all_fulljet_jetpTDet_vs_FT0Mults", "; p_{T,det} (GeV/c); FT0M Multiplicity", {HistType::kTH2F, {{350, 0., 350.}, {3500, 0., 3500.}}}); - registry.add("h2_all_fulljet_jetpTDet_vs_Nch", ";#it{p}_{T_fulljet} (GeV/#it{c}); N_{ch}", {HistType::kTH2F, {{350, 0., 350.}, {50, 0., 50.}}}); - registry.add("h3_full_jet_jetpTDet_FT0Mults_nef", "; p_{T,det} (GeV/c); FT0M Multiplicity, nef", {HistType::kTH3F, {{350, 0., 350.}, {50, 0., 50.}, {105, 0.0, 1.05}}}); + registry.add("h_all_fulljet_pt", "#it{p}_{T,fulljet};#it{p}_{T_fulljet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}, doSumw2); + registry.add("h_all_fulljet_Nch", ";N_{ch};", {HistType::kTH1F, {{50, 0., 50.}}}, doSumw2); + registry.add("h_all_fulljet_NEF", ";NEF;", {HistType::kTH1F, {{105, 0., 1.05}}}, doSumw2); + registry.add("h2_all_fulljet_jetpTDet_vs_FT0Mults", "; p_{T,det} (GeV/c); FT0M Multiplicity", {HistType::kTH2F, {{350, 0., 350.}, {3500, 0., 3500.}}}, doSumw2); + registry.add("h2_all_fulljet_jetpTDet_vs_Nch", ";#it{p}_{T_fulljet} (GeV/#it{c}); N_{ch}", {HistType::kTH2F, {{350, 0., 350.}, {50, 0., 50.}}}, doSumw2); + registry.add("h3_full_jet_jetpTDet_FT0Mults_nef", "; p_{T,det} (GeV/c); FT0M Multiplicity, nef", {HistType::kTH3F, {{350, 0., 350.}, {50, 0., 50.}, {105, 0.0, 1.05}}}, doSumw2); // CASE 2: - registry.add("h_leading_fulljet_pt", "#it{p}_{T,Leading fulljet};#it{p}_{T_Leadingfulljet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); - registry.add("h_leading_fulljet_Nch", ";N_{ch};", {HistType::kTH1F, {{50, 0., 50.}}}); - registry.add("h_leading_fulljet_NEF", ";NEF;", {HistType::kTH1F, {{105, 0., 1.05}}}); - registry.add("h2_leading_fulljet_jetpTDet_vs_FT0Mults", ";Leading p_{T,det} (GeV/c); FT0M Multiplicity", {HistType::kTH2F, {{350, 0., 350.}, {3500, 0., 3500.}}}); - registry.add("h2_leading_fulljet_jetpTDet_vs_Nch", ";#it{p}_{T_Leadingfulljet} (GeV/#it{c}); N_{ch}", {HistType::kTH2F, {{350, 0., 350.}, {50, 0., 50.}}}); - registry.add("h3_leading_fulljet_jetpTDet_FT0Mults_nef", "; Leading p_{T,det} (GeV/c); FT0M Multiplicity, nef", {HistType::kTH3F, {{350, 0., 350.}, {50, 0., 50.}, {105, 0.0, 1.05}}}); + registry.add("h_leading_fulljet_pt", "#it{p}_{T,Leading fulljet};#it{p}_{T_Leadingfulljet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}, doSumw2); + registry.add("h_leading_fulljet_Nch", ";N_{ch};", {HistType::kTH1F, {{50, 0., 50.}}}, doSumw2); + registry.add("h_leading_fulljet_NEF", ";NEF;", {HistType::kTH1F, {{105, 0., 1.05}}}, doSumw2); + registry.add("h2_leading_fulljet_jetpTDet_vs_FT0Mults", ";Leading p_{T,det} (GeV/c); FT0M Multiplicity", {HistType::kTH2F, {{350, 0., 350.}, {3500, 0., 3500.}}}, doSumw2); + registry.add("h2_leading_fulljet_jetpTDet_vs_Nch", ";#it{p}_{T_Leadingfulljet} (GeV/#it{c}); N_{ch}", {HistType::kTH2F, {{350, 0., 350.}, {50, 0., 50.}}}, doSumw2); + registry.add("h3_leading_fulljet_jetpTDet_FT0Mults_nef", "; Leading p_{T,det} (GeV/c); FT0M Multiplicity, nef", {HistType::kTH3F, {{350, 0., 350.}, {50, 0., 50.}, {105, 0.0, 1.05}}}, doSumw2); // CASE 3: - registry.add("h_subleading_fulljet_pt", "#it{p}_{T,SubLeading fulljet};#it{p}_{T_SubLeadingfulljet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); - registry.add("h_subleading_fulljet_Nch", ";N_{ch};", {HistType::kTH1F, {{50, 0., 50.}}}); - registry.add("h_subleading_fulljet_NEF", ";NEF;", {HistType::kTH1F, {{105, 0., 1.05}}}); - registry.add("h2_subleading_fulljet_jetpTDet_vs_FT0Mults", ";SubLeading p_{T,det} (GeV/c); FT0M Multiplicity", {HistType::kTH2F, {{350, 0., 350.}, {3500, 0., 3500.}}}); - registry.add("h2_subleading_fulljet_jetpTDet_vs_Nch", ";#it{p}_{T_SubLeadingfulljet} (GeV/#it{c}); N_{ch}", {HistType::kTH2F, {{350, 0., 350.}, {50, 0., 50.}}}); - registry.add("h3_subleading_fulljet_jetpTDet_FT0Mults_nef", "; SubLeading p_{T,det} (GeV/c); FT0M Multiplicity, nef", {HistType::kTH3F, {{350, 0., 350.}, {50, 0., 50.}, {105, 0.0, 1.05}}}); + registry.add("h_subleading_fulljet_pt", "#it{p}_{T,SubLeading fulljet};#it{p}_{T_SubLeadingfulljet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}, doSumw2); + registry.add("h_subleading_fulljet_Nch", ";N_{ch};", {HistType::kTH1F, {{50, 0., 50.}}}, doSumw2); + registry.add("h_subleading_fulljet_NEF", ";NEF;", {HistType::kTH1F, {{105, 0., 1.05}}}, doSumw2); + registry.add("h2_subleading_fulljet_jetpTDet_vs_FT0Mults", ";SubLeading p_{T,det} (GeV/c); FT0M Multiplicity", {HistType::kTH2F, {{350, 0., 350.}, {3500, 0., 3500.}}}, doSumw2); + registry.add("h2_subleading_fulljet_jetpTDet_vs_Nch", ";#it{p}_{T_SubLeadingfulljet} (GeV/#it{c}); N_{ch}", {HistType::kTH2F, {{350, 0., 350.}, {50, 0., 50.}}}, doSumw2); + registry.add("h3_subleading_fulljet_jetpTDet_FT0Mults_nef", "; SubLeading p_{T,det} (GeV/c); FT0M Multiplicity, nef", {HistType::kTH3F, {{350, 0., 350.}, {50, 0., 50.}, {105, 0.0, 1.05}}}, doSumw2); } if (doprocessMBMCPCollisionsWithMultiplicity || doprocessMBMCPCollisionsWeightedWithMultiplicity) { - registry.add("hPartEventmultiplicityCounter", "event status;event status;entries", {HistType::kTH1F, {{11, 0.0, 11.0}}}); - registry.add("hRecoMatchesPerMcCollisionMult", "split vertices QA;;entries", {HistType::kTH1F, {{5, 0.0, 5.0}}}); - registry.add("hMCCollMatchedFT0Mult", "", {HistType::kTH1F, {{3500, 0., 3500.}}}); - registry.add("hMCCollMatchedFT0Cent", "", {HistType::kTH1F, {{105, 0., 105.}}}); + registry.add("hPartEventmultiplicityCounter", "event status;event status;entries", {HistType::kTH1F, {{11, 0.0, 11.0}}}, doSumw2); + registry.add("hRecoMatchesPerMcCollisionMult", "split vertices QA;;entries", {HistType::kTH1F, {{5, 0.0, 5.0}}}, doSumw2); + registry.add("hMCCollMatchedFT0Mult", "", {HistType::kTH1F, {{3500, 0., 3500.}}}, doSumw2); + registry.add("hMCCollMatchedFT0Cent", "", {HistType::kTH1F, {{105, 0., 105.}}}, doSumw2); - registry.add("h_all_fulljet_Njets_part", "Full Jet Multiplicity (per Event)", {HistType::kTH1F, {{20, 0., 20.}}}); - registry.add("h_Leading_full_jet_pt_part", "#it{p}_{T,leading jet};#it{p}_{T_leading jet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); - registry.add("h2_full_jet_leadingJetPt_vs_counts_part", ";#it{p}_{T_leading jet} (GeV/#it{c}); Counts", {HistType::kTH2F, {{350, 0., 350.}, {20, 0., 20.}}}); - registry.add("h_SubLeading_full_jet_pt_part", "#it{p}_{T,leading jet};#it{p}_{T_leading jet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); - registry.add("h2_full_jet_subLeadingJetPt_vs_counts_part", ";#it{p}_{T_leading jet} (GeV/#it{c}); Counts", {HistType::kTH2F, {{350, 0., 350.}, {20, 0., 20.}}}); + registry.add("h_all_fulljet_Njets_part", "Full Jet Multiplicity (per Event)", {HistType::kTH1F, {{20, 0., 20.}}}, doSumw2); + registry.add("h_Leading_full_jet_pt_part", "#it{p}_{T,leading jet};#it{p}_{T_leading jet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}, doSumw2); + registry.add("h2_full_jet_leadingJetPt_vs_counts_part", ";#it{p}_{T_leading jet} (GeV/#it{c}); Counts", {HistType::kTH2F, {{350, 0., 350.}, {20, 0., 20.}}}, doSumw2); + registry.add("h_SubLeading_full_jet_pt_part", "#it{p}_{T,leading jet};#it{p}_{T_leading jet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}, doSumw2); + registry.add("h2_full_jet_subLeadingJetPt_vs_counts_part", ";#it{p}_{T_leading jet} (GeV/#it{c}); Counts", {HistType::kTH2F, {{350, 0., 350.}, {20, 0., 20.}}}, doSumw2); // Inside Jet Loop: // CASE 1: - registry.add("h_all_fulljet_pt_part", "#it{p}_{T,fulljet};#it{p}_{T_fulljet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); - registry.add("h_all_fulljet_Nch_part", ";N_{ch};", {HistType::kTH1F, {{50, 0., 50.}}}); - registry.add("h_all_fulljet_Nne_part", ";N_{ne};", {HistType::kTH1F, {{100, 0., 100.}}}); - registry.add("h_all_fulljet_NEF_part", ";NEF;", {HistType::kTH1F, {{105, 0., 1.05}}}); - registry.add("h2_all_fulljet_jetpT_vs_FT0Mults_part", "; p_{T,part} (GeV/c); FT0M Multiplicity", {HistType::kTH2F, {{350, 0., 350.}, {3500, 0., 3500.}}}); - registry.add("h2_all_fulljet_jetpT_vs_Nch_part", ";#it{p}_{T_fulljet} (GeV/#it{c}); N_{ch}", {HistType::kTH2F, {{350, 0., 350.}, {50, 0., 50.}}}); - registry.add("h3_full_jet_jetpT_FT0Mults_nef_part", "; p_{T,part} (GeV/c); FT0M Multiplicity, nef", {HistType::kTH3F, {{350, 0., 350.}, {50, 0., 50.}, {105, 0.0, 1.05}}}); + registry.add("h_all_fulljet_pt_part", "#it{p}_{T,fulljet};#it{p}_{T_fulljet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}, doSumw2); + registry.add("h_all_fulljet_Nch_part", ";N_{ch};", {HistType::kTH1F, {{50, 0., 50.}}}, doSumw2); + registry.add("h_all_fulljet_Nne_part", ";N_{ne};", {HistType::kTH1F, {{100, 0., 100.}}}, doSumw2); + registry.add("h_all_fulljet_NEF_part", ";NEF;", {HistType::kTH1F, {{105, 0., 1.05}}}, doSumw2); + registry.add("h2_all_fulljet_jetpT_vs_FT0Mults_part", "; p_{T,part} (GeV/c); FT0M Multiplicity", {HistType::kTH2F, {{350, 0., 350.}, {3500, 0., 3500.}}}, doSumw2); + registry.add("h2_all_fulljet_jetpT_vs_Nch_part", ";#it{p}_{T_fulljet} (GeV/#it{c}); N_{ch}", {HistType::kTH2F, {{350, 0., 350.}, {50, 0., 50.}}}, doSumw2); + registry.add("h3_full_jet_jetpT_FT0Mults_nef_part", "; p_{T,part} (GeV/c); FT0M Multiplicity, nef", {HistType::kTH3F, {{350, 0., 350.}, {50, 0., 50.}, {105, 0.0, 1.05}}}, doSumw2); // CASE 2: - registry.add("h_leading_fulljet_pt_part", "#it{p}_{T,Leading fulljet};#it{p}_{T_Leadingfulljet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); - registry.add("h_leading_fulljet_Nch_part", ";N_{ch};", {HistType::kTH1F, {{50, 0., 50.}}}); - registry.add("h_leading_fulljet_Nne_part", ";N_{ne};", {HistType::kTH1F, {{100, 0., 100.}}}); - registry.add("h_leading_fulljet_NEF_part", ";NEF;", {HistType::kTH1F, {{105, 0., 1.05}}}); - registry.add("h2_leading_fulljet_jetpT_vs_FT0Mults_part", ";Leading p_{T,part} (GeV/c); FT0M Multiplicity", {HistType::kTH2F, {{350, 0., 350.}, {3500, 0., 3500.}}}); - registry.add("h2_leading_fulljet_jetpT_vs_Nch_part", ";#it{p}_{T_Leadingfulljet} (GeV/#it{c}); N_{ch}", {HistType::kTH2F, {{350, 0., 350.}, {50, 0., 50.}}}); - registry.add("h3_leading_fulljet_jetpT_FT0Mults_nef_part", "; Leading p_{T,part} (GeV/c); FT0M Multiplicity, nef", {HistType::kTH3F, {{350, 0., 350.}, {50, 0., 50.}, {105, 0.0, 1.05}}}); + registry.add("h_leading_fulljet_pt_part", "#it{p}_{T,Leading fulljet};#it{p}_{T_Leadingfulljet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}, doSumw2); + registry.add("h_leading_fulljet_Nch_part", ";N_{ch};", {HistType::kTH1F, {{50, 0., 50.}}}, doSumw2); + registry.add("h_leading_fulljet_Nne_part", ";N_{ne};", {HistType::kTH1F, {{100, 0., 100.}}}, doSumw2); + registry.add("h_leading_fulljet_NEF_part", ";NEF;", {HistType::kTH1F, {{105, 0., 1.05}}}, doSumw2); + registry.add("h2_leading_fulljet_jetpT_vs_FT0Mults_part", ";Leading p_{T,part} (GeV/c); FT0M Multiplicity", {HistType::kTH2F, {{350, 0., 350.}, {3500, 0., 3500.}}}, doSumw2); + registry.add("h2_leading_fulljet_jetpT_vs_Nch_part", ";#it{p}_{T_Leadingfulljet} (GeV/#it{c}); N_{ch}", {HistType::kTH2F, {{350, 0., 350.}, {50, 0., 50.}}}, doSumw2); + registry.add("h3_leading_fulljet_jetpT_FT0Mults_nef_part", "; Leading p_{T,part} (GeV/c); FT0M Multiplicity, nef", {HistType::kTH3F, {{350, 0., 350.}, {50, 0., 50.}, {105, 0.0, 1.05}}}, doSumw2); // CASE 3: - registry.add("h_subleading_fulljet_pt_part", "#it{p}_{T,SubLeading fulljet};#it{p}_{T_SubLeadingfulljet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); - registry.add("h_subleading_fulljet_Nch_part", ";N_{ch};", {HistType::kTH1F, {{50, 0., 50.}}}); - registry.add("h_subleading_fulljet_Nne_part", ";N_{ne};", {HistType::kTH1F, {{100, 0., 100.}}}); - registry.add("h_subleading_fulljet_NEF_part", ";NEF;", {HistType::kTH1F, {{105, 0., 1.05}}}); - registry.add("h2_subleading_fulljet_jetpT_vs_FT0Mults_part", ";SubLeading p_{T,part} (GeV/c); FT0M Multiplicity", {HistType::kTH2F, {{350, 0., 350.}, {3500, 0., 3500.}}}); - registry.add("h2_subleading_fulljet_jetpT_vs_Nch_part", ";#it{p}_{T_SubLeadingfulljet} (GeV/#it{c}); N_{ch}", {HistType::kTH2F, {{350, 0., 350.}, {50, 0., 50.}}}); - registry.add("h3_subleading_fulljet_jetpT_FT0Mults_nef_part", "; SubLeading p_{T,part} (GeV/c); FT0M Multiplicity, nef", {HistType::kTH3F, {{350, 0., 350.}, {50, 0., 50.}, {105, 0.0, 1.05}}}); + registry.add("h_subleading_fulljet_pt_part", "#it{p}_{T,SubLeading fulljet};#it{p}_{T_SubLeadingfulljet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}, doSumw2); + registry.add("h_subleading_fulljet_Nch_part", ";N_{ch};", {HistType::kTH1F, {{50, 0., 50.}}}, doSumw2); + registry.add("h_subleading_fulljet_Nne_part", ";N_{ne};", {HistType::kTH1F, {{100, 0., 100.}}}, doSumw2); + registry.add("h_subleading_fulljet_NEF_part", ";NEF;", {HistType::kTH1F, {{105, 0., 1.05}}}, doSumw2); + registry.add("h2_subleading_fulljet_jetpT_vs_FT0Mults_part", ";SubLeading p_{T,part} (GeV/c); FT0M Multiplicity", {HistType::kTH2F, {{350, 0., 350.}, {3500, 0., 3500.}}}, doSumw2); + registry.add("h2_subleading_fulljet_jetpT_vs_Nch_part", ";#it{p}_{T_SubLeadingfulljet} (GeV/#it{c}); N_{ch}", {HistType::kTH2F, {{350, 0., 350.}, {50, 0., 50.}}}, doSumw2); + registry.add("h3_subleading_fulljet_jetpT_FT0Mults_nef_part", "; SubLeading p_{T,part} (GeV/c); FT0M Multiplicity, nef", {HistType::kTH3F, {{350, 0., 350.}, {50, 0., 50.}, {105, 0.0, 1.05}}}, doSumw2); } // Label the histograms @@ -625,6 +650,7 @@ struct FullJetSpectra { Filter clusterFilter = (aod::jcluster::definition == static_cast(clusterDefinition) && aod::jcluster::eta > clusterEtaMin && aod::jcluster::eta < clusterEtaMax && aod::jcluster::phi >= clusterPhiMin && aod::jcluster::phi <= clusterPhiMax && aod::jcluster::energy >= clusterEnergyMin && aod::jcluster::time > clusterTimeMin && aod::jcluster::time < clusterTimeMax && (clusterRejectExotics && aod::jcluster::isExotic != true)); Preslice JetMCPPerMcCollision = aod::jet::mcCollisionId; PresliceUnsorted> CollisionsPerMCPCollision = aod::jmccollisionlb::mcCollisionId; + PresliceUnsorted> perFoundBC = aod::evsel::foundBCId; template bool isAcceptedRecoJet(U const& jet) @@ -890,6 +916,42 @@ struct FullJetSpectra { } PROCESS_SWITCH(FullJetSpectra, processDummy, "dummy task", true); + void processBCs(o2::soa::Join const& bcs, o2::soa::Join const& collisions) + { + if (bcs.size() == 0) { + return; + } + for (auto bc : bcs) { + registry.fill(HIST("hBCCounter"), 0.5); // All BC + if (bc.selection_bit(aod::evsel::kIsTriggerTVX)) { + registry.fill(HIST("hBCCounter"), 1.5); // BC+TVX + if (bc.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + registry.fill(HIST("hBCCounter"), 2.5); // BC+TVX+NoTFB + if (bc.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + registry.fill(HIST("hBCCounter"), 3.5); // BC+TVX+NoTFB+NoITSROFB ----> this goes to Lumi i.e. hLumiAfterBCcuts in eventSelection task + } + } + } + auto collisionsInBC = collisions.sliceBy(perFoundBC, bc.globalIndex()); + for (auto collision : collisionsInBC) { + registry.fill(HIST("hBCCounter"), 4.5); // CollinBC + if (collision.sel8()) { + registry.fill(HIST("hBCCounter"), 5.5); // CollinBC+sel8 + if (collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + registry.fill(HIST("hBCCounter"), 6.5); // CollinBC+sel8Full + if (collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + registry.fill(HIST("hBCCounter"), 7.5); // CollinBC+sel8Full+GoodZvtx + if (std::fabs(collision.posZ()) < vertexZCut) { + registry.fill(HIST("hBCCounter"), 8.5); // CollinBC+sel8Full+VtxZ+GoodZvtx ----> this goes to my analysis task for jet events selection + } + } + } + } + } // collision loop + } // bc loop + } + PROCESS_SWITCH(FullJetSpectra, processBCs, "BCs for 0 vertex QA", false); + void processJetsData(soa::Filtered::iterator const& collision, FullJetTableDataJoined const& jets, aod::JetTracks const&, aod::JetClusters const&) { bool eventAccepted = false; @@ -1092,8 +1154,8 @@ struct FullJetSpectra { registry.fill(HIST("hSpliteventSelector"), 0.5); // 20% Closure input for the measured spectra (reco) registry.fill(HIST("h_MCD_splitevent_counter"), 0.5); - } - */ +} +*/ registry.fill(HIST("hDetcollisionCounter"), 0.5); // allDetColl if (std::fabs(collision.posZ()) > vertexZCut) { return; @@ -1944,8 +2006,7 @@ struct FullJetSpectra { // Verify jet-collision association for (auto const& jet : jets) { if (jet.collisionId() != collision.globalIndex()) { - std::cout << "WARNING: Jet with pT " << jet.pt() << " belongs to collision " << jet.collisionId() - << " but processing collision " << collision.globalIndex() << std::endl; + LOGF(warn, "Jet with pT %.2f belongs to collision %d but processing collision %d", jet.pt(), jet.collisionId(), collision.globalIndex()); continue; } @@ -2013,8 +2074,9 @@ struct FullJetSpectra { for (const auto& jettrack : jet.tracks_as()) { if (jetderiveddatautilities::selectTrack(jettrack, trackSelection)) { numberOfChargedParticles++; - } else + } else { continue; + } } // Calculate neutral energy fraction for this jet @@ -2103,8 +2165,7 @@ struct FullJetSpectra { // Verify jet-collision association for (auto const& mcdjet : mcdjets) { if (mcdjet.collisionId() != collision.globalIndex()) { - std::cout << "WARNING: Jet with pT " << mcdjet.pt() << " belongs to collision " << mcdjet.collisionId() - << " but processing collision " << collision.globalIndex() << std::endl; + LOGF(warn, "Jet with pT %.2f belongs to collision %d but processing collision %d", mcdjet.pt(), mcdjet.collisionId(), collision.globalIndex()); continue; } @@ -2157,8 +2218,9 @@ struct FullJetSpectra { for (const auto& jettrack : jet.tracks_as()) { if (jetderiveddatautilities::selectTrack(jettrack, trackSelection)) { numberOfChargedParticles++; - } else + } else { continue; + } } // Calculate neutral energy fraction for this jet @@ -2259,8 +2321,7 @@ struct FullJetSpectra { float pTHat = 10. / (std::pow(eventWeight, 1.0 / pTHatExponent)); if (mcdjet.collisionId() != collision.globalIndex()) { - std::cout << "WARNING: Jet with pT " << mcdjet.pt() << " belongs to collision " << mcdjet.collisionId() - << " but processing collision " << collision.globalIndex() << std::endl; + LOGF(warn, "Jet with pT %.2f belongs to collision %d but processing collision %d", mcdjet.pt(), mcdjet.collisionId(), collision.globalIndex()); continue; } @@ -2316,8 +2377,9 @@ struct FullJetSpectra { for (const auto& jettrack : jet.tracks_as()) { if (jetderiveddatautilities::selectTrack(jettrack, trackSelection)) { numberOfChargedParticles++; - } else + } else { continue; + } } // Calculate neutral energy fraction for this jet From 59aaf39c299e60ec0191cb2760b94d1e8c6630e9 Mon Sep 17 00:00:00 2001 From: ynishida-style Date: Tue, 26 Aug 2025 16:54:30 +0900 Subject: [PATCH 197/986] [PWGJE] Change to a more efficient way of selecting particle tracks (#12686) --- PWGJE/Tasks/jetShape.cxx | 57 +++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/PWGJE/Tasks/jetShape.cxx b/PWGJE/Tasks/jetShape.cxx index 9a7c857e256..55782d2c3b5 100644 --- a/PWGJE/Tasks/jetShape.cxx +++ b/PWGJE/Tasks/jetShape.cxx @@ -268,37 +268,46 @@ struct JetShapeTask { registry.fill(HIST("event/vertexz"), collision.posZ()); + std::vector::iterator> goodTracks; + for (auto it = tracks.begin(); it != tracks.end(); ++it) { + const auto& track = *it; + + registry.fill(HIST("trackTpcNClsCrossedRows"), track.tpcNClsCrossedRows()); + registry.fill(HIST("trackDcaXY"), track.dcaXY()); + registry.fill(HIST("trackItsChi2NCl"), track.itsChi2NCl()); + registry.fill(HIST("trackTpcChi2NCl"), track.tpcChi2NCl()); + registry.fill(HIST("trackTpcNClsFound"), track.tpcNClsFound()); + registry.fill(HIST("trackItsNCls"), track.itsNCls()); + registry.fill(HIST("trackEta"), track.eta()); + registry.fill(HIST("trackPhi"), track.phi()); + + if (std::abs(track.eta()) > etaTrUp) + continue; + if (track.tpcNClsCrossedRows() < nclcrossTpcMin) + continue; + if (std::abs(track.dcaXY()) > dcaxyMax) + continue; + if (track.itsChi2NCl() > chi2ItsMax) + continue; + if (track.tpcChi2NCl() > chi2TpcMax) + continue; + if (track.tpcNClsFound() < nclTpcMin) + continue; + if (track.itsNCls() < nclItsMin) + continue; + + goodTracks.push_back(it); + } + for (auto const& jet : jets) { if (!isAcceptedJet(jet)) { continue; } // tracks conditions - for (const auto& track : tracks) { + for (const auto& track_it : goodTracks) { - registry.fill(HIST("trackTpcNClsCrossedRows"), track.tpcNClsCrossedRows()); - registry.fill(HIST("trackDcaXY"), track.dcaXY()); - registry.fill(HIST("trackItsChi2NCl"), track.itsChi2NCl()); - registry.fill(HIST("trackTpcChi2NCl"), track.tpcChi2NCl()); - registry.fill(HIST("trackTpcNClsFound"), track.tpcNClsFound()); - registry.fill(HIST("trackItsNCls"), track.itsNCls()); - registry.fill(HIST("trackEta"), track.eta()); - registry.fill(HIST("trackPhi"), track.phi()); - - if (std::abs(track.eta()) > etaTrUp) - continue; - if (track.tpcNClsCrossedRows() < nclcrossTpcMin) - continue; - if (std::abs(track.dcaXY()) > dcaxyMax) - continue; - if (track.itsChi2NCl() > chi2ItsMax) - continue; - if (track.tpcChi2NCl() > chi2TpcMax) - continue; - if (track.tpcNClsFound() < nclTpcMin) - continue; - if (track.itsNCls() < nclItsMin) - continue; + const auto& track = *track_it; // PID check registry.fill(HIST("tofMass"), track.mass()); From 1d1062fc3506c45e16bf8a75447db0986d6a15c2 Mon Sep 17 00:00:00 2001 From: YubiaoWang Date: Tue, 26 Aug 2025 15:55:01 +0800 Subject: [PATCH 198/986] [PWGJE] Add jet-jet MC process in ChargedJetV2 task, fix processSigmaPtMCP plots createAdd files via upload (#12681) --- PWGJE/Tasks/jetChargedV2.cxx | 324 ++++++++++++++++++++++++----------- 1 file changed, 224 insertions(+), 100 deletions(-) diff --git a/PWGJE/Tasks/jetChargedV2.cxx b/PWGJE/Tasks/jetChargedV2.cxx index 4c5cd82ed25..008cd65ca02 100644 --- a/PWGJE/Tasks/jetChargedV2.cxx +++ b/PWGJE/Tasks/jetChargedV2.cxx @@ -58,7 +58,7 @@ using namespace o2::framework; using namespace o2::framework::expressions; struct JetChargedV2 { - using McParticleCollision = soa::Join; + using McParticleCollision = soa::Join; using ChargedMCDMatchedJets = soa::Join; using ChargedMCPMatchedJets = soa::Join; @@ -126,6 +126,7 @@ struct JetChargedV2 { Configurable pTHatMaxMCP{"pTHatMaxMCP", 999.0, "maximum fraction of hard scattering for jet acceptance in particle MC"}; Configurable checkLeadConstituentPtForMcpJets{"checkLeadConstituentPtForMcpJets", false, "flag to choose whether particle level jets should have their lead track pt above leadingConstituentPtMin to be accepted; off by default, as leadingConstituentPtMin cut is only applied on MCD jets for the Pb-Pb analysis using pp MC anchored to Pb-Pb for the response matrix"}; Configurable cfgChkFitQuality{"cfgChkFitQuality", false, "check fit quality"}; + Configurable subtractMCPBackground{"subtractMCPBackground", true, "subtract MCP Background with General Purpose anchored MC"}; template int getDetId(const T& name) @@ -259,6 +260,7 @@ struct JetChargedV2 { histosQA.add("histCent", "Centrality TrkProcess", HistType::kTH1F, {axisCent}); //< Track efficiency plots >// registry.add("h_collisions", "event status;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}); + registry.add("h_collisions_Zvertex", "position of collision ;#it{Z} (cm)", {HistType::kTH1F, {{300, -15.0, 15.0}}}); //< fit quality >// registry.add("h_PvalueCDF_CombinFit", "cDF #chi^{2}; entries", {HistType::kTH1F, {{50, 0, 1}}}); registry.add("h2_PvalueCDFCent_CombinFit", "p-value cDF vs centrality; centrality; p-value", {HistType::kTH2F, {{100, 0, 100}, {40, 0, 1}}}); @@ -317,7 +319,11 @@ struct JetChargedV2 { registry.add("h2_jet_pt_track_pt_rhoareasubtracted", "jet #it{p}_{T,jet} vs. #it{p}_{T,track}; #it{p}_{T,jet} (GeV/#it{c}); #it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, trackPtAxis}}); } - if (doprocessSigmaPtMCP) { + if (doprocessSigmaPtMCP || doprocessSigmaPtAreaSubMCP) { + registry.add("h_jet_pt_part", "partvjet pT;#it{p}_{T,jet}^{part} (GeV/#it{c}); counts", {HistType::kTH1F, {jetPtAxis}}); + registry.add("h_jet_eta_part", "part jet #eta;#eta^{part}; counts", {HistType::kTH1F, {jetEtaAxis}}); + registry.add("h_jet_phi_part", "part jet #varphi;#phi^{part}; counts", {HistType::kTH1F, {phiAxis}}); + registry.add("h_jet_pt_part_rhoareasubtracted", "part jet corr pT;#it{p}_{T,jet}^{part} (GeV/#it{c}); counts", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); registry.add("h_jet_eta_part_rhoareasubtracted", "part jet #eta;#eta^{part}; counts", {HistType::kTH1F, {jetEtaAxis}}); registry.add("h_jet_phi_part_rhoareasubtracted", "part jet #varphi;#varphi^{part}; counts", {HistType::kTH1F, {phiAxis}}); @@ -326,17 +332,21 @@ struct JetChargedV2 { registry.add("leadJetPhiMCP", "MCP leadJet constituent #phi ", {HistType::kTH1F, {{80, -1.0, 7.}}}); registry.add("leadJetEtaMCP", "MCP leadJet constituent #eta ", {HistType::kTH1F, {{100, -1.0, 1.0}}}); - registry.add("h2_mcp_phi_rholocal", "#varphi vs #rho(#varphi); #varphi - #Psi_{EP,2}; #rho(#varphi) ", {HistType::kTH2F, {{40, 0., o2::constants::math::TwoPI}, {210, -10.0, 200.0}}}); - registry.add("h2_mcp_centrality_rholocal", "#varphi vs #rho(#varphi); #varphi - #Psi_{EP,2}; #rho(#varphi) ", {HistType::kTH2F, {{120, -10.0, 110.0}, {210, -10.0, 200.0}}}); - registry.add("h_mcp_jet_pt_rholocal", "jet pT rholocal;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); - //< MCP fit test >// - registry.add("h_mcp_evtnum_centrlity", "eventNumber vs centrality ; #eventNumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); registry.add("h_mcp_v2obs_centrality", "fitparameter v2obs vs centrality ; #centrality", {HistType::kTProfile, {cfgAxisVnCent}}); registry.add("h_mcp_v3obs_centrality", "fitparameter v3obs vs centrality ; #centrality", {HistType::kTProfile, {cfgAxisVnCent}}); registry.add("h_mcp_fitparaRho_evtnum", "fitparameter #rho_{0} vs evtnum ; #eventnumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); registry.add("h_mcp_fitparaPsi2_evtnum", "fitparameter #Psi_{2} vs evtnum ; #eventnumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); registry.add("h_mcp_fitparaPsi3_evtnum", "fitparameter #Psi_{3} vs evtnum ; #eventnumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); + registry.add("h2_mcp_phi_rholocal", "#varphi vs #rho(#varphi); #varphi - #Psi_{EP,2}; #rho(#varphi) ", {HistType::kTH2F, {{40, 0., o2::constants::math::TwoPI}, {210, -10.0, 200.0}}}); + registry.add("h2_mcp_centrality_rholocal", "#varphi vs #rho(#varphi); #varphi - #Psi_{EP,2}; #rho(#varphi) ", {HistType::kTH2F, {{120, -10.0, 110.0}, {210, -10.0, 200.0}}}); + registry.add("h_mcp_jet_pt_rhoareasubtracted", "jet pT rholocal;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); + registry.add("h_mcp_jet_pt_rholocal", "jet pT rholocal;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); + //< MCP fit test >// + registry.add("h_mcp_evtnum_centrlity", "eventNumber vs centrality ; #eventNumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); + registry.add("h_ep2_evtnum", "fitparameter #rho_{0} vs evtnum ; #eventnumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); + registry.add("h_ep3_evtnum", "fitparameter #Psi_{2} vs evtnum ; #eventnumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); + registry.add("h_mcp_jet_pt_in_plane_v2_rho", "jet pT;#it{p}^{in-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); registry.add("h_mcp_jet_pt_out_of_plane_v2_rho", "jet pT;#it{p}^{out-of-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); registry.add("h_mcp_jet_pt_in_plane_v3_rho", "jet pT;#it{p}^{in-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); @@ -348,30 +358,20 @@ struct JetChargedV2 { registry.add("h2_mcp_centrality_jet_pt_out_of_plane_v3_rho", "centrality vs #it{p}^{out-of-plane}_{T,jet}; centrality; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH2F, {{120, -10.0, 110.0}, jetPtAxisRhoAreaSub}}); registry.add("h3_mcp_centrality_deltapT_RandomCornPhi_localrhovsphi", "centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho}; #Delta#varphi_{jet}", {HistType::kTH3F, {{100, 0.0, 100.0}, {400, -200.0, 200.0}, {100, 0., o2::constants::math::TwoPI}}}); - registry.add("h3_mcp_centrality_deltapT_RandomCornPhi_rhorandomconewithoutleadingjet", "centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho}; #Delta#varphi_{jet}", {HistType::kTH3F, {{100, 0.0, 100.0}, {400, -200.0, 200.0}, {100, 0., o2::constants::math::TwoPI}}}); - registry.add("h3_mcp_centrality_deltapT_RandomCornPhi_localrhovsphiwithoutleadingjet", "centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho}(#varphi); #Delta#varphi_{jet}", {HistType::kTH3F, {{100, 0.0, 100.0}, {400, -200.0, 200.0}, {100, 0., o2::constants::math::TwoPI}}}); - - registry.add("h_mcColl_counts_areasub", " number of mc events; event status; entries", {HistType::kTH1F, {{10, 0, 10}}}); - registry.get(HIST("h_mcColl_counts_areasub"))->GetXaxis()->SetBinLabel(1, "allMcColl"); - registry.get(HIST("h_mcColl_counts_areasub"))->GetXaxis()->SetBinLabel(2, "vertexZ"); - registry.get(HIST("h_mcColl_counts_areasub"))->GetXaxis()->SetBinLabel(3, "noRecoColl"); - registry.get(HIST("h_mcColl_counts_areasub"))->GetXaxis()->SetBinLabel(4, "splitColl"); - registry.get(HIST("h_mcColl_counts_areasub"))->GetXaxis()->SetBinLabel(5, "recoEvtSel"); - registry.get(HIST("h_mcColl_counts_areasub"))->GetXaxis()->SetBinLabel(6, "centralitycut"); - registry.get(HIST("h_mcColl_counts_areasub"))->GetXaxis()->SetBinLabel(7, "occupancycut"); - registry.add("h_mcColl_rho", "mc collision rho;#rho (GeV/#it{c}); counts", {HistType::kTH1F, {{500, 0.0, 500.0}}}); - //< \sigma p_T at local rho test plot > - registry.add("h_accept_Track", "all and accept track;Track;entries", {HistType::kTH1F, {{10, 0.0, 10.0}}}); - registry.get(HIST("h_accept_Track"))->GetXaxis()->SetBinLabel(1, "acceptTrk"); - registry.get(HIST("h_accept_Track"))->GetXaxis()->SetBinLabel(2, "acceptTrkInFit"); - registry.get(HIST("h_accept_Track"))->GetXaxis()->SetBinLabel(3, "beforeSumptFit"); - registry.get(HIST("h_accept_Track"))->GetXaxis()->SetBinLabel(4, "afterSumptFit"); - registry.get(HIST("h_accept_Track"))->GetXaxis()->SetBinLabel(5, "getNtrk"); - registry.get(HIST("h_accept_Track"))->GetXaxis()->SetBinLabel(6, "getNtrkMCP"); + registry.add("h_mcColl_counts", " number of mc events; event status; entries", {HistType::kTH1F, {{10, 0, 10}}}); + registry.get(HIST("h_mcColl_counts"))->GetXaxis()->SetBinLabel(1, "allMcColl"); + registry.get(HIST("h_mcColl_counts"))->GetXaxis()->SetBinLabel(2, "vertexZ"); + registry.get(HIST("h_mcColl_counts"))->GetXaxis()->SetBinLabel(3, "noRecoColl"); + registry.get(HIST("h_mcColl_counts"))->GetXaxis()->SetBinLabel(4, "splitColl"); + registry.get(HIST("h_mcColl_counts"))->GetXaxis()->SetBinLabel(5, "recoEvtSel"); + registry.get(HIST("h_mcColl_counts"))->GetXaxis()->SetBinLabel(6, "centralitycut"); + registry.get(HIST("h_mcColl_counts"))->GetXaxis()->SetBinLabel(7, "occupancycut"); + registry.add("h_mcColl_rho", "mc collision rho;#rho (GeV/#it{c}); counts", {HistType::kTH1F, {{500, 0.0, 500.0}}}); + registry.add("h_mc_zvertex", "position of collision ;#it{Z} (cm)", {HistType::kTH1F, {{300, -15.0, 15.0}}}); } - if (doprocessJetsMatchedSubtracted) { + if (doprocessJetsMatched) { registry.add("h_mc_collisions_matched", "mc collisions status;event status;entries", {HistType::kTH1F, {{5, 0.0, 5.0}}}); registry.add("h_mcd_events_matched", "mcd event status;event status;entries", {HistType::kTH1F, {{6, 0.0, 6.0}}}); registry.add("h_mc_rho_matched", "mc collision rho;#rho (GeV/#it{c}); counts", {HistType::kTH1F, {{500, -100.0, 500.0}}}); @@ -522,8 +522,9 @@ struct JetChargedV2 { registry.fill(HIST("leadJetEtaMCP"), leadingJetEta); } - template - void fitFncMCP(U const& collision, T const& tracks, J const& jets, TH1F* hPtsumSumptFitMCP, double leadingJetEta, bool mcLevelIsParticleLevel, float weight = 1.0) + // Run General_Purpose MC MCP + template + void fitFncAreaSubMCP(U const& collision, J const& jets, TH1F* hPtsumSumptFitMCP, bool mcLevelIsParticleLevel, float weight = 1.0) { double ep2 = 0.; double ep3 = 0.; @@ -571,7 +572,6 @@ struct JetChargedV2 { hPtsumSumptFitMCP->Fit(fFitModulationV2v3P, "Q", "ep", 0, o2::constants::math::TwoPI); - // int paraNum = 5; double temppara[5]; temppara[0] = fFitModulationV2v3P->GetParameter(0); temppara[1] = fFitModulationV2v3P->GetParameter(1); @@ -640,65 +640,87 @@ struct JetChargedV2 { } } } - // RCpT - for (uint i = 0; i < cfgnMods->size(); i++) { - TRandom3 randomNumber(0); - float randomConeEta = randomNumber.Uniform(trackEtaMin + randomConeR, trackEtaMax - randomConeR); - float randomConePhi = randomNumber.Uniform(0.0, o2::constants::math::TwoPI); - float randomConePt = 0; - double integralValueRC = fFitModulationV2v3P->Integral(randomConePhi - randomConeR, randomConePhi + randomConeR); - double rholocalRC = collision.rho() / (2 * randomConeR * temppara[0]) * integralValueRC; + } + // Run jet-jet MC MCP leading jet fill + template + void fitFncMCP(U const& collision, J const& jets, bool mcLevelIsParticleLevel, float weight = 1.0) + { + double ep2 = 0.; + double ep3 = 0.; + int cfgNmodA = 2; + int cfgNmodB = 3; + int evtPlnAngleA = 7; + int evtPlnAngleB = 3; + int evtPlnAngleC = 5; + for (uint i = 0; i < cfgnMods->size(); i++) { int nmode = cfgnMods->at(i); + int detInd = detId * 4 + cfgnTotalSystem * 4 * (nmode - 2); if (nmode == cfgNmodA) { - double rcPhiPsi2; - rcPhiPsi2 = randomConePhi - ep2; + if (collision.qvecAmp()[detId] > collQvecAmpDetId) { + ep2 = helperEP.GetEventPlane(collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], nmode); + } + } else if (nmode == cfgNmodB) { + if (collision.qvecAmp()[detId] > collQvecAmpDetId) { + ep3 = helperEP.GetEventPlane(collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], nmode); + } + } + } + registry.fill(HIST("h_mcp_evtnum_centrlity"), evtnum, collision.centFT0M()); + registry.fill(HIST("h_ep2_evtnum"), evtnum, ep2); + registry.fill(HIST("h_ep3_evtnum"), evtnum, ep3); - for (auto const& track : tracks) { - if (jetderiveddatautilities::selectTrack(track, trackSelection)) { - float dPhi = RecoDecay::constrainAngle(track.phi() - randomConePhi, static_cast(-o2::constants::math::PI)); - float dEta = track.eta() - randomConeEta; - if (std::sqrt(dEta * dEta + dPhi * dPhi) < randomConeR) { - randomConePt += track.pt(); - } - } + for (uint i = 0; i < cfgnMods->size(); i++) { + int nmode = cfgnMods->at(i); + int detInd = detId * 4 + cfgnTotalSystem * 4 * (nmode - 2); + + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(jet, mcLevelIsParticleLevel)) { + continue; + } + if (jet.r() != round(selectedJetsRadius * 100.0f)) { + continue; } - registry.fill(HIST("h3_mcp_centrality_deltapT_RandomCornPhi_localrhovsphi"), collision.centFT0M(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * rholocalRC, rcPhiPsi2, weight); - // removing the leading jet from the random cone - if (jets.size() > 0) { // if there are no jets in the acceptance (from the jetfinder cuts) then there can be no leading jet - float dPhiLeadingJet = RecoDecay::constrainAngle(jets.iteratorAt(0).phi() - randomConePhi, static_cast(-o2::constants::math::PI)); - float dEtaLeadingJet = jets.iteratorAt(0).eta() - randomConeEta; + if (nmode == cfgNmodA) { + registry.fill(HIST("h_mcp_jet_pt_rhoareasubtracted"), jet.pt(), weight); - bool jetWasInCone = false; - while ((randomConeLeadJetDeltaR <= 0 && (std::sqrt(dEtaLeadingJet * dEtaLeadingJet + dPhiLeadingJet * dPhiLeadingJet) < jets.iteratorAt(0).r() / 100.0 + randomConeR)) || (randomConeLeadJetDeltaR > 0 && (std::sqrt(dEtaLeadingJet * dEtaLeadingJet + dPhiLeadingJet * dPhiLeadingJet) < randomConeLeadJetDeltaR))) { - jetWasInCone = true; - randomConeEta = randomNumber.Uniform(trackEtaMin + randomConeR, trackEtaMax - randomConeR); - randomConePhi = randomNumber.Uniform(0.0, o2::constants::math::TwoPI); - dPhiLeadingJet = RecoDecay::constrainAngle(jets.iteratorAt(0).phi() - randomConePhi, static_cast(-o2::constants::math::PI)); - dEtaLeadingJet = jets.iteratorAt(0).eta() - randomConeEta; + double phiMinusPsi2; + if (collision.qvecAmp()[detId] < collQvecAmpDetId) { + continue; } - if (jetWasInCone) { - randomConePt = 0.0; - for (auto const& track : tracks) { - if (jetderiveddatautilities::selectTrack(track, trackSelection) && (std::fabs(track.eta() - leadingJetEta) > randomConeR)) { // if track selection is uniformTrack, dcaXY and dcaZ cuts need to be added as they aren't in the selection so that they can be studied here - float dPhi = RecoDecay::constrainAngle(track.phi() - randomConePhi, static_cast(-o2::constants::math::PI)); - float dEta = track.eta() - randomConeEta; - if (std::sqrt(dEta * dEta + dPhi * dPhi) < randomConeR) { - randomConePt += track.pt(); - } - } - } + phiMinusPsi2 = jet.phi() - ep2; + if ((phiMinusPsi2 < o2::constants::math::PIQuarter) || (phiMinusPsi2 >= evtPlnAngleA * o2::constants::math::PIQuarter) || (phiMinusPsi2 >= evtPlnAngleB * o2::constants::math::PIQuarter && phiMinusPsi2 < evtPlnAngleC * o2::constants::math::PIQuarter)) { + registry.fill(HIST("h_mcp_jet_pt_in_plane_v2_rho"), jet.pt(), weight); + registry.fill(HIST("h2_mcp_centrality_jet_pt_in_plane_v2_rho"), collision.centFT0M(), jet.pt(), weight); + } else { + registry.fill(HIST("h_mcp_jet_pt_out_of_plane_v2_rho"), jet.pt(), weight); + registry.fill(HIST("h2_mcp_centrality_jet_pt_out_of_plane_v2_rho"), collision.centFT0M(), jet.pt(), weight); + } + } else if (nmode == cfgNmodB) { + double phiMinusPsi3; + if (collision.qvecAmp()[detId] < collQvecAmpDetId) { + continue; + } + ep3 = helperEP.GetEventPlane(collision.qvecRe()[detInd], collision.qvecIm()[detInd], nmode); + phiMinusPsi3 = jet.phi() - ep3; + + if ((phiMinusPsi3 < o2::constants::math::PIQuarter) || (phiMinusPsi3 >= evtPlnAngleA * o2::constants::math::PIQuarter) || (phiMinusPsi3 >= evtPlnAngleB * o2::constants::math::PIQuarter && phiMinusPsi3 < evtPlnAngleC * o2::constants::math::PIQuarter)) { + registry.fill(HIST("h_mcp_jet_pt_in_plane_v3_rho"), jet.pt(), weight); + registry.fill(HIST("h2_mcp_centrality_jet_pt_in_plane_v3_rho"), collision.centFT0M(), jet.pt(), weight); + } else { + registry.fill(HIST("h_mcp_jet_pt_out_of_plane_v3_rho"), jet.pt(), weight); + registry.fill(HIST("h2_mcp_centrality_jet_pt_out_of_plane_v3_rho"), collision.centFT0M(), jet.pt(), weight); } } - registry.fill(HIST("h3_mcp_centrality_deltapT_RandomCornPhi_localrhovsphiwithoutleadingjet"), collision.centFT0M(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * rholocalRC, rcPhiPsi2, weight); - registry.fill(HIST("h3_mcp_centrality_deltapT_RandomCornPhi_rhorandomconewithoutleadingjet"), collision.centFT0M(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * collision.rho(), rcPhiPsi2, weight); - } else if (nmode == cfgNmodB) { - continue; } } } + // Run General_Purpose MC MCP template void fillMCPAreaSubHistograms(TJets const& jet, float rho = 0.0, float weight = 1.0) { @@ -717,6 +739,22 @@ struct JetChargedV2 { } } + // Run jet-jet MC MCP + template + void fillMCPHistograms(TJets const& jet, float weight = 1.0) + { + float pTHat = 10. / (std::pow(weight, 1.0 / pTHatExponent)); + if (jet.pt() > pTHatMaxMCP * pTHat || pTHat < pTHatAbsoluteMin) { + return; + } + if (jet.r() == round(selectedJetsRadius * 100.0f)) { + // fill mcp jet histograms + registry.fill(HIST("h_jet_pt_part"), jet.pt(), weight); + registry.fill(HIST("h_jet_eta_part"), jet.eta(), weight); + registry.fill(HIST("h_jet_phi_part"), jet.phi(), weight); + } + } + template void fillTrackHistograms(TTracks const& track, float weight = 1.0) { @@ -725,7 +763,7 @@ struct JetChargedV2 { } template - void fillGeoMatchedCorrHistograms(TBase const& jetMCD, TF1* fFitModulationRM, float tempparaA, double ep2, float rho, float mcrho = 0.0, float weight = 1.0) + void fillGeoMatchedCorrHistograms(TBase const& jetMCD, TF1* fFitModulationRM, float tempparaA, double ep2, float rho, bool subtractMCPBackground, float mcrho, float weight = 1.0) { float pTHat = 10. / (std::pow(weight, 1.0 / pTHatExponent)); if (jetMCD.pt() > pTHatMaxMCD * pTHat) { @@ -742,8 +780,15 @@ struct JetChargedV2 { int evtPlnAngleC = 5; double integralValue = fFitModulationRM->Integral(jetMCD.phi() - jetRadius, jetMCD.phi() + jetRadius); double rholocal = rho / (2 * jetRadius * tempparaA) * integralValue; - double corrTagjetpt = jetMCP.pt() - (mcrho * jetMCP.area()); double corrBasejetpt = jetMCD.pt() - (rholocal * jetMCD.area()); + double corrTagjetpt; + if (subtractMCPBackground) { + double integralValueMCP = fFitModulationRM->Integral(jetMCP.phi() - jetRadius, jetMCP.phi() + jetRadius); + double rholocalMCP = mcrho / (2 * jetRadius * tempparaA) * integralValueMCP; + corrTagjetpt = jetMCP.pt() - (rholocalMCP * jetMCP.area()); + } else { + corrTagjetpt = jetMCP.pt(); + } double dcorrpt = corrTagjetpt - corrBasejetpt; double phiMinusPsi2 = jetMCD.phi() - ep2; if (jetfindingutilities::isInEtaAcceptance(jetMCD, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { @@ -1014,7 +1059,7 @@ struct JetChargedV2 { return; } registry.fill(HIST("h_collisions"), 2.5); - + registry.fill(HIST("h_collisions_Zvertex"), collision.posZ()); double leadingJetPt = -1; double leadingJetPhi = -1; double leadingJetEta = -1; @@ -1501,28 +1546,28 @@ struct JetChargedV2 { } PROCESS_SWITCH(JetChargedV2, processSigmaPtMCD, "jet spectra with rho-area subtraction for MCD", false); - void processSigmaPtMCP(McParticleCollision::iterator const& mccollision, - soa::SmallGroups> const& collisions, - soa::Join const& jets, - aod::JetTracks const& tracks, - aod::JetParticles const&) + void processSigmaPtAreaSubMCP(McParticleCollision::iterator const& mccollision, + soa::SmallGroups> const& collisions, + soa::Join const& jets, + aod::JetTracks const& tracks, + aod::JetParticles const&) { bool mcLevelIsParticleLevel = true; int acceptSplitCollInMCP = 2; - registry.fill(HIST("h_mcColl_counts_areasub"), 0.5); + registry.fill(HIST("h_mcColl_counts"), 0.5); if (std::abs(mccollision.posZ()) > vertexZCut) { return; } - registry.fill(HIST("h_mcColl_counts_areasub"), 1.5); + registry.fill(HIST("h_mcColl_counts"), 1.5); if (collisions.size() < 1) { return; } - registry.fill(HIST("h_mcColl_counts_areasub"), 2.5); + registry.fill(HIST("h_mcColl_counts"), 2.5); if (acceptSplitCollisions == 0 && collisions.size() > 1) { return; } - registry.fill(HIST("h_mcColl_counts_areasub"), 3.5); + registry.fill(HIST("h_mcColl_counts"), 3.5); bool hasSel8Coll = false; bool centralityIsGood = false; @@ -1553,19 +1598,19 @@ struct JetChargedV2 { if (!hasSel8Coll) { return; } - registry.fill(HIST("h_mcColl_counts_areasub"), 4.5); + registry.fill(HIST("h_mcColl_counts"), 4.5); if (!centralityIsGood) { return; } - registry.fill(HIST("h_mcColl_counts_areasub"), 5.5); + registry.fill(HIST("h_mcColl_counts"), 5.5); if (!occupancyIsGood) { return; } - registry.fill(HIST("h_mcColl_counts_areasub"), 6.5); + registry.fill(HIST("h_mcColl_counts"), 6.5); registry.fill(HIST("h_mcColl_rho"), mccollision.rho()); - + registry.fill(HIST("h_mc_zvertex"), mccollision.posZ()); for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; @@ -1603,20 +1648,99 @@ struct JetChargedV2 { } } } - fitFncMCP(collision, tracks, jets, hPtsumSumptFitMCP, leadingJetEta, mcLevelIsParticleLevel); + fitFncAreaSubMCP(collision, jets, hPtsumSumptFitMCP, mcLevelIsParticleLevel); } delete hPtsumSumptFitMCP; delete fFitModulationV2v3P; evtnum += 1; } + PROCESS_SWITCH(JetChargedV2, processSigmaPtAreaSubMCP, "jet spectra with area-based subtraction for MC particle level", false); + + void processSigmaPtMCP(aod::JMcCollisions::iterator const& mccollision, + soa::SmallGroups> const& collisions, + soa::Join const& jets, + aod::JetParticles const&) + { + bool mcLevelIsParticleLevel = true; + int acceptSplitCollInMCP = 2; + + registry.fill(HIST("h_mcColl_counts"), 0.5); + if (std::abs(mccollision.posZ()) > vertexZCut) { + return; + } + registry.fill(HIST("h_mcColl_counts"), 1.5); + if (collisions.size() < 1) { + return; + } + registry.fill(HIST("h_mcColl_counts"), 2.5); + if (acceptSplitCollisions == 0 && collisions.size() > 1) { + return; + } + registry.fill(HIST("h_mcColl_counts"), 3.5); + + bool hasSel8Coll = false; + bool centralityIsGood = false; + bool occupancyIsGood = false; + if (acceptSplitCollisions == acceptSplitCollInMCP) { + if (jetderiveddatautilities::selectCollision(collisions.begin(), eventSelectionBits, skipMBGapEvents)) { + hasSel8Coll = true; + } + if ((centralityMin < collisions.begin().centFT0M()) && (collisions.begin().centFT0M() < centralityMax)) { + centralityIsGood = true; + } + if ((trackOccupancyInTimeRangeMin < collisions.begin().trackOccupancyInTimeRange()) && (collisions.begin().trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMax)) { + occupancyIsGood = true; + } + } else { + for (auto const& collision : collisions) { + if (jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { + hasSel8Coll = true; + } + if ((centralityMin < collision.centFT0M()) && (collision.centFT0M() < centralityMax)) { + centralityIsGood = true; + } + if ((trackOccupancyInTimeRangeMin < collision.trackOccupancyInTimeRange()) && (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMax)) { + occupancyIsGood = true; + } + } + } + if (!hasSel8Coll) { + return; + } + registry.fill(HIST("h_mcColl_counts"), 4.5); + + if (!centralityIsGood) { + return; + } + registry.fill(HIST("h_mcColl_counts"), 5.5); + + if (!occupancyIsGood) { + return; + } + registry.fill(HIST("h_mcColl_counts"), 6.5); + registry.fill(HIST("h_mc_zvertex"), mccollision.posZ()); + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(jet, mcLevelIsParticleLevel)) { + continue; + } + fillMCPHistograms(jet); + } + for (auto const& collision : collisions) { + fitFncMCP(collision, jets, mcLevelIsParticleLevel); + } + evtnum += 1; + } PROCESS_SWITCH(JetChargedV2, processSigmaPtMCP, "jet spectra with area-based subtraction for MC particle level", false); - void processJetsMatchedSubtracted(McParticleCollision::iterator const& mccollision, - soa::SmallGroups> const& collisions, - ChargedMCDMatchedJets const& mcdjets, - ChargedMCPMatchedJets const&, - aod::JetTracks const& tracks, aod::JetParticles const&) + void processJetsMatched(McParticleCollision::iterator const& mccollision, + soa::SmallGroups> const& collisions, + ChargedMCDMatchedJets const& mcdjets, + ChargedMCPMatchedJets const&, + aod::JetTracks const& tracks, aod::JetParticles const&) { registry.fill(HIST("h_mc_collisions_matched"), 0.5); if (mccollision.size() < 1) { @@ -1728,14 +1852,14 @@ struct JetChargedV2 { return; } - fillGeoMatchedCorrHistograms(mcdjet, fFitModulationRM, tempparaA, ep2, collision.rho(), mcrho); + fillGeoMatchedCorrHistograms(mcdjet, fFitModulationRM, tempparaA, ep2, collision.rho(), subtractMCPBackground, collision.rho()); delete hPtsumSumptFitRM; delete fFitModulationRM; evtnum += 1; } } } - PROCESS_SWITCH(JetChargedV2, processJetsMatchedSubtracted, "matched mcp and mcd jets after subtraction", false); + PROCESS_SWITCH(JetChargedV2, processJetsMatched, "matched mcp and mcd jets", false); void processTracksQA(soa::Filtered>::iterator const& collision, soa::Filtered> const& tracks) From 9f0027ba98dbb03392b2fdd131553c08231a18e6 Mon Sep 17 00:00:00 2001 From: dajones2 <140733426+dajones2@users.noreply.github.com> Date: Tue, 26 Aug 2025 08:56:08 +0100 Subject: [PATCH 199/986] [PWGJE] PWGJE Addressing memory consumption issues (#12674) --- PWGJE/Tasks/jetHadronRecoil.cxx | 162 ++++++++++++++++---------------- 1 file changed, 82 insertions(+), 80 deletions(-) diff --git a/PWGJE/Tasks/jetHadronRecoil.cxx b/PWGJE/Tasks/jetHadronRecoil.cxx index d327fa277b6..becdfafb2bc 100644 --- a/PWGJE/Tasks/jetHadronRecoil.cxx +++ b/PWGJE/Tasks/jetHadronRecoil.cxx @@ -82,8 +82,6 @@ struct JetHadronRecoil { Configurable skipMBGapEvents{"skipMBGapEvents", false, "flag to choose to reject min. bias gap events; jet-level rejection applied at the jet finder level, here rejection is applied for collision and track process functions"}; Configurable outlierRejectEvent{"outlierRejectEvent", true, "where outliers are found, reject event (true) or just reject the single track/jet (false)"}; - Preslice> partJetsPerCollision = aod::jet::mcCollisionId; - TRandom3* rand = new TRandom3(0); Filter jetCuts = aod::jet::r == nround(jetR.node() * 100.0f); @@ -119,68 +117,7 @@ struct JetHadronRecoil { AxisSpec dRAxisDet = {dRBinning, "#Delta R_{det}"}; AxisSpec dRAxisPart = {dRBinning, "#Delta R_{part}"}; - HistogramRegistry registry{"registry", - {{"hNtrig", "number of triggers;trigger type;entries", {HistType::kTH1F, {{2, 0, 2}}}}, - {"hSignalTriggersPtHard", "Signal triggers vs PtHard", {HistType::kTH1F, {{20, 0, 5}}}}, - {"hReferenceTriggersPtHard", "Reference triggers vs PtHard", {HistType::kTH1F, {{20, 0, 5}}}}, - {"hZvtxSelected", "Z vertex position;Z_{vtx};entries", {HistType::kTH1F, {{80, -20, 20}}}}, - {"hPtTrack", "Track p_{T};p_{T};entries", {HistType::kTH1F, {{200, 0, 200}}}}, - {"hEtaTrack", "Track #eta;#eta;entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, - {"hPhiTrack", "Track #phi;#phi;entries", {HistType::kTH1F, {{100, 0.0, o2::constants::math::TwoPI}}}}, - {"hTrack3D", "3D tracks histogram;p_{T};#eta;#phi", {HistType::kTH3F, {{200, 0, 200}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}}, - {"hPtTrackPtHard", "Tracks vs pThard;#frac{p_{T}}{#hat{p}};p_{T}", {HistType::kTH2F, {{20, 0, 5}, {200, 0, 200}}}}, - {"hConstituents3D", "3D constituents histogram;p_{T};#eta;#phi", {HistType::kTH3F, {{200, 0, 200}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}}, - {"hReferencePtDPhi", "jet p_{T} vs DPhi;#Delta#phi;p_{T,jet}", {HistType::kTH2F, {{100, 0, o2::constants::math::TwoPI}, {500, -100, 400}}}}, - {"hReferencePtDPhiShifts", "rho shifts;#Delta#phi;p_{T,jet};shifts", {HistType::kTH3F, {{100, 0, o2::constants::math::TwoPI}, {500, -100, 400}, {20, 0.0, 2.0}}}}, - {"hSignalPtDPhi", "jet p_{T} vs DPhi;#Delta#phi;p_{T,jet}", {HistType::kTH2F, {{100, 0, o2::constants::math::TwoPI}, {500, -100, 400}}}}, - {"hReferencePt", "jet p_{T};p_{T,jet};entries", {HistType::kTH1F, {{500, -100, 400}}}}, - {"hSignalPt", "jet p_{T};p_{T,jet};entries", {HistType::kTH1F, {{500, -100, 400}}}}, - {"hSignalTriggers", "trigger p_{T};p_{T,trig};entries", {HistType::kTH1F, {{150, 0, 150}}}}, - {"hSignalPtHard", "jet p_{T} vs #hat{p};p_{T,jet};#frac{p_{T,trig}}{#hat{p}}", {HistType::kTH2F, {{500, -100, 400}, {20, 0, 5}}}}, - {"hReferenceTriggers", "trigger p_{T};p_{T,trig};entries", {HistType::kTH1F, {{150, 0, 150}}}}, - {"hReferencePtHard", "jet p_{T} vs #hat{p};p_{T,jet};#frac{p_{T,trig}}{#hat{p}}", {HistType::kTH2F, {{500, -100, 400}, {20, 0, 5}}}}, - {"hSigEventTriggers", "N_{triggers};events", {HistType::kTH1F, {{10, 0, 10}}}}, - {"hRefEventTriggers", "N_{triggers};events", {HistType::kTH1F, {{10, 0, 10}}}}, - {"hJetPt", "jet p_{T};p_{T,jet};entries", {HistType::kTH1F, {{500, -100, 400}}}}, - {"hJetEta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, - {"hJetPhi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{100, 0.0, o2::constants::math::TwoPI}}}}, - {"hJet3D", "3D jet distribution;p_{T};#eta;#phi", {HistType::kTH3F, {{500, -100, 400}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}}, - {"hTracksvsJets", "comparing leading tracks and jets;p_{T,track};p_{T,jet};#hat{p}", {HistType::kTH3F, {{200, 0, 200}, {500, -100, 400}, {195, 5, 200}}}}, - {"hPartvsJets", "comparing leading particles and jets;p_{T,part};p_{T,jet};#hat{p}", {HistType::kTH3F, {{200, 0, 200}, {500, -100, 400}, {195, 5, 200}}}}, - {"hPtPart", "Particle p_{T};p_{T};entries", {HistType::kTH1F, {{200, 0, 200}}}}, - {"hEtaPart", "Particle #eta;#eta;entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, - {"hPhiPart", "Particle #phi;#phi;entries", {HistType::kTH1F, {{100, 0.0, o2::constants::math::TwoPI}}}}, - {"hPart3D", "3D tracks histogram;p_{T};#eta;#phi", {HistType::kTH3F, {{200, 0, 200}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}}, - {"hPtPartPtHard", "Track p_{T} vs #hat{p};p_{T};#frac{p_{T}}{#hat{p}}", {HistType::kTH2F, {{200, 0, 200}, {20, 0, 5}}}}, - {"hDeltaR", "#DeltaR;#DeltaR;#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}}, - {"hDeltaRPart", "Particle #DeltaR;#DeltaR;#frac{1}{N_{jets}}#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}}, - {"hDeltaRpT", "jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{500, -100, 400}, dRAxis}}}, - {"hDeltaRpTPart", "Particle jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{400, 0, 400}, dRAxis}}}, - {"hRhoSignal", "Signal Rho bkg;#rho;entries", {HistType::kTH1F, {{220, 0, 220}}}}, - {"hRhoReference", "Reference Rho bkg;#rho;entries", {HistType::kTH1F, {{220, 0, 220}}}}, - {"hRhoReferenceShift", "Testing reference shifts;#rho;shift", {HistType::kTH2F, {{220, 0, 220}, {20, 0.0, 2.0}}}}, - {"hDeltaRSignal", "#DeltaR;#DeltaR;#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}}, - {"hDeltaRSignalPart", "Particle #DeltaR;#DeltaR;#frac{1}{N_{jets}}#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}}, - {"hDeltaRpTSignal", "jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{500, -100, 400}, dRAxis}}}, - {"hDeltaRpTSignalPart", "Particle jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{400, 0, 400}, dRAxis}}}, - {"hDeltaRpTDPhiSignal", "jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{500, -100, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis}}}, - {"hDeltaRpTDPhiSignalPart", "Particle jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{400, 0, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis}}}, - {"hDeltaRReference", "#DeltaR;#DeltaR;#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}}, - {"hDeltaRPartReference", "Particle #DeltaR;#DeltaR;#frac{1}{N_{jets}}#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}}, - {"hDeltaRpTReference", "jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{500, -100, 400}, dRAxis}}}, - {"hDeltaRpTPartReference", "Particle jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{400, 0, 400}, dRAxis}}}, - {"hDeltaRpTDPhiReference", "jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{500, -100, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis}}}, - {"hDeltaRpTDPhiReferenceShifts", "testing shifts;p_{T,jet};#Delta#phi;#DeltaR;shifts", {HistType::kTHnSparseD, {{500, -100, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis, {20, 0.0, 2.0}}}}, - {"hDeltaRpTDPhiReferencePart", "jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{400, 0, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis}}}, - {"hPtMatched", "p_{T} matching;p_{T,det};p_{T,part}", {HistType::kTH2F, {{500, -100, 400}, {400, 0, 400}}}}, - {"hPhiMatched", "#phi matching;#phi_{det};#phi_{part}", {HistType::kTH2F, {{100, 0.0, o2::constants::math::TwoPI}, {100, 0.0, o2::constants::math::TwoPI}}}}, - {"hDeltaRMatched", "#DeltaR matching;#DeltaR_{det};#DeltaR_{part}", {HistType::kTH2F, {dRAxisDet, dRAxisPart}}}, - {"hPtMatched1d", "p_{T} matching 1d;p_{T,part}", {HistType::kTH1F, {{400, 0, 400}}}}, - {"hDeltaRMatched1d", "#DeltaR matching 1d;#DeltaR_{part}", {HistType::kTH1F, {dRAxisPart}}}, - {"hPtResolution", "p_{T} resolution;p_{T,part};Relative Resolution", {HistType::kTH2F, {{400, 0, 400}, {1000, -5.0, 5.0}}}}, - {"hPhiResolution", "#phi resolution;#p_{T,part};Resolution", {HistType::kTH2F, {{400, 0, 400}, {1000, -7.0, 7.0}}}}, - {"hDeltaRResolution", "#DeltaR Resolution;p_{T,part};Resolution", {HistType::kTH2F, {{400, 0, 400}, {1000, -0.15, 0.15}}}}, - {"hFullMatching", "Full 6D matching;p_{T,det};p_{T,part};#phi_{det};#phi_{part};#DeltaR_{det};#DeltaR_{part}", {HistType::kTHnSparseD, {ptAxisDet, ptAxisPart, phiAxisDet, phiAxisPart, dRAxisDet, dRAxisPart}}}}}; + HistogramRegistry registry; std::vector eventSelectionBits; int trackSelection = -1; @@ -194,15 +131,83 @@ struct JetHadronRecoil { trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); triggerMaskBits = jetderiveddatautilities::initialiseTriggerMaskBits(triggerMasks); - Filter jetCuts = aod::jet::r == nround(jetR.node() * 100.0f); - Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax); - Filter particleCuts = (aod::jmcparticle::pt >= trackPtMin && aod::jmcparticle::pt < trackPtMax && aod::jmcparticle::eta > trackEtaMin && aod::jmcparticle::eta < trackEtaMax); - Filter eventTrackLevelCuts = nabs(aod::jcollision::posZ) < vertexZCut; - jetReclusterer.isReclustering = true; jetReclusterer.algorithm = fastjet::JetAlgorithm::cambridge_algorithm; jetReclusterer.jetR = 2 * jetR; jetReclusterer.recombScheme = fastjet::WTA_pt_scheme; + + if (doprocessData || doprocessDataWithRhoSubtraction || doprocessMCD || doprocessMCDWithRhoSubtraction || doprocessMCDWeighted || doprocessMCDWeightedWithRhoSubtraction || doprocessMCP || doprocessMCPWeighted) { + registry.add("hNtrig", "number of triggers;trigger type;entries", {HistType::kTH1F, {{2, 0, 2}}}); + registry.add("hSignalTriggersPtHard", "Signal triggers vs PtHard", {HistType::kTH1F, {{20, 0, 5}}}); + registry.add("hReferenceTriggersPtHard", "Reference triggers vs PtHard", {HistType::kTH1F, {{20, 0, 5}}}); + registry.add("hZvtxSelected", "Z vertex position;Z_{vtx};entries", {HistType::kTH1F, {{80, -20, 20}}}); + registry.add("hConstituents3D", "3D constituents histogram;p_{T};#eta;#phi", {HistType::kTH3F, {{200, 0, 200}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}); + registry.add("hReferencePtDPhi", "jet p_{T} vs DPhi;#Delta#phi;p_{T,jet}", {HistType::kTH2F, {{100, 0, o2::constants::math::TwoPI}, {500, -100, 400}}}); + registry.add("hReferencePtDPhiShifts", "rho shifts;#Delta#phi;p_{T,jet};shifts", {HistType::kTH3F, {{100, 0, o2::constants::math::TwoPI}, {500, -100, 400}, {20, 0.0, 2.0}}}); + registry.add("hSignalPtDPhi", "jet p_{T} vs DPhi;#Delta#phi;p_{T,jet}", {HistType::kTH2F, {{100, 0, o2::constants::math::TwoPI}, {500, -100, 400}}}); + registry.add("hReferencePt", "jet p_{T};p_{T,jet};entries", {HistType::kTH1F, {{500, -100, 400}}}); + registry.add("hSignalPt", "jet p_{T};p_{T,jet};entries", {HistType::kTH1F, {{500, -100, 400}}}); + registry.add("hSignalTriggers", "trigger p_{T};p_{T,trig};entries", {HistType::kTH1F, {{150, 0, 150}}}); + registry.add("hSignalPtHard", "jet p_{T} vs #hat{p};p_{T,jet};#frac{p_{T,trig}}{#hat{p}}", {HistType::kTH2F, {{500, -100, 400}, {20, 0, 5}}}); + registry.add("hReferenceTriggers", "trigger p_{T};p_{T,trig};entries", {HistType::kTH1F, {{150, 0, 150}}}); + registry.add("hReferencePtHard", "jet p_{T} vs #hat{p};p_{T,jet};#frac{p_{T,trig}}{#hat{p}}", {HistType::kTH2F, {{500, -100, 400}, {20, 0, 5}}}); + registry.add("hSigEventTriggers", "N_{triggers};events", {HistType::kTH1F, {{10, 0, 10}}}); + registry.add("hRefEventTriggers", "N_{triggers};events", {HistType::kTH1F, {{10, 0, 10}}}); + registry.add("hJetPt", "jet p_{T};p_{T,jet};entries", {HistType::kTH1F, {{500, -100, 400}}}); + registry.add("hJetEta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}); + registry.add("hJetPhi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{100, 0.0, o2::constants::math::TwoPI}}}); + registry.add("hJet3D", "3D jet distribution;p_{T};#eta;#phi", {HistType::kTH3F, {{500, -100, 400}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}); + } + + if (doprocessData || doprocessDataWithRhoSubtraction || doprocessMCD || doprocessMCDWithRhoSubtraction || doprocessMCDWeighted || doprocessMCDWeightedWithRhoSubtraction) { + registry.add("hPtTrack", "Track p_{T};p_{T};entries", {HistType::kTH1F, {{200, 0, 200}}}); + registry.add("hEtaTrack", "Track #eta;#eta;entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}); + registry.add("hPhiTrack", "Track #phi;#phi;entries", {HistType::kTH1F, {{100, 0.0, o2::constants::math::TwoPI}}}); + registry.add("hTrack3D", "3D tracks histogram;p_{T};#eta;#phi", {HistType::kTH3F, {{200, 0, 200}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}); + registry.add("hPtTrackPtHard", "Tracks vs pThard;#frac{p_{T}}{#hat{p}};p_{T}", {HistType::kTH2F, {{20, 0, 5}, {200, 0, 200}}}); + registry.add("hTracksvsJets", "comparing leading tracks and jets;p_{T,track};p_{T,jet};#hat{p}", {HistType::kTH3F, {{200, 0, 200}, {500, -100, 400}, {195, 5, 200}}}); + registry.add("hDeltaR", "#DeltaR;#DeltaR;#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}); + registry.add("hDeltaRpT", "jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{500, -100, 400}, dRAxis}}); + registry.add("hRhoSignal", "Signal Rho bkg;#rho;entries", {HistType::kTH1F, {{220, 0, 220}}}); + registry.add("hRhoReference", "Reference Rho bkg;#rho;entries", {HistType::kTH1F, {{220, 0, 220}}}); + registry.add("hRhoReferenceShift", "Testing reference shifts;#rho;shift", {HistType::kTH2F, {{220, 0, 220}, {20, 0.0, 2.0}}}); + registry.add("hDeltaRSignal", "#DeltaR;#DeltaR;#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}); + registry.add("hDeltaRpTSignal", "jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{500, -100, 400}, dRAxis}}); + registry.add("hDeltaRpTDPhiSignal", "jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{500, -100, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis}}); + registry.add("hDeltaRReference", "#DeltaR;#DeltaR;#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}); + registry.add("hDeltaRpTReference", "jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{500, -100, 400}, dRAxis}}); + registry.add("hDeltaRpTDPhiReference", "jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{500, -100, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis}}); + registry.add("hDeltaRpTDPhiReferenceShifts", "testing shifts;p_{T,jet};#Delta#phi;#DeltaR;shifts", {HistType::kTHnSparseD, {{500, -100, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis, {20, 0.0, 2.0}}}); + } + + if (doprocessMCP || doprocessMCPWeighted) { + registry.add("hPartvsJets", "comparing leading particles and jets;p_{T,part};p_{T,jet};#hat{p}", {HistType::kTH3F, {{200, 0, 200}, {500, -100, 400}, {195, 5, 200}}}); + registry.add("hPtPart", "Particle p_{T};p_{T};entries", {HistType::kTH1F, {{200, 0, 200}}}); + registry.add("hEtaPart", "Particle #eta;#eta;entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}); + registry.add("hPhiPart", "Particle #phi;#phi;entries", {HistType::kTH1F, {{100, 0.0, o2::constants::math::TwoPI}}}); + registry.add("hPart3D", "3D tracks histogram;p_{T};#eta;#phi", {HistType::kTH3F, {{200, 0, 200}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}); + registry.add("hPtPartPtHard", "Track p_{T} vs #hat{p};p_{T};#frac{p_{T}}{#hat{p}}", {HistType::kTH2F, {{200, 0, 200}, {20, 0, 5}}}); + registry.add("hDeltaRPart", "Particle #DeltaR;#DeltaR;#frac{1}{N_{jets}}#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}); + registry.add("hDeltaRpTPart", "Particle jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{400, 0, 400}, dRAxis}}); + registry.add("hDeltaRSignalPart", "Particle #DeltaR;#DeltaR;#frac{1}{N_{jets}}#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}); + registry.add("hDeltaRpTSignalPart", "Particle jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{400, 0, 400}, dRAxis}}); + registry.add("hDeltaRpTDPhiSignalPart", "Particle jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{400, 0, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis}}); + registry.add("hDeltaRPartReference", "Particle #DeltaR;#DeltaR;#frac{1}{N_{jets}}#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}); + registry.add("hDeltaRpTPartReference", "Particle jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{400, 0, 400}, dRAxis}}); + registry.add("hDeltaRpTDPhiReferencePart", "jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{400, 0, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis}}); + } + + if (doprocessJetsMCPMCDMatched || doprocessJetsMCPMCDMatchedWithRhoSubtraction || doprocessJetsMCPMCDMatchedWeighted || doprocessJetsMCPMCDMatchedWeightedWithRhoSubtraction || doprocessRecoilJetsMCPMCDMatched || doprocessRecoilJetsMCPMCDMatchedWeighted) { + registry.add("hPtMatched", "p_{T} matching;p_{T,det};p_{T,part}", {HistType::kTH2F, {{500, -100, 400}, {400, 0, 400}}}); + registry.add("hPhiMatched", "#phi matching;#phi_{det};#phi_{part}", {HistType::kTH2F, {{100, 0.0, o2::constants::math::TwoPI}, {100, 0.0, o2::constants::math::TwoPI}}}); + registry.add("hDeltaRMatched", "#DeltaR matching;#DeltaR_{det};#DeltaR_{part}", {HistType::kTH2F, {dRAxisDet, dRAxisPart}}); + registry.add("hPtMatched1d", "p_{T} matching 1d;p_{T,part}", {HistType::kTH1F, {{400, 0, 400}}}); + registry.add("hDeltaRMatched1d", "#DeltaR matching 1d;#DeltaR_{part}", {HistType::kTH1F, {dRAxisPart}}); + registry.add("hPtResolution", "p_{T} resolution;p_{T,part};Relative Resolution", {HistType::kTH2F, {{400, 0, 400}, {1000, -5.0, 5.0}}}); + registry.add("hPhiResolution", "#phi resolution;#p_{T,part};Resolution", {HistType::kTH2F, {{400, 0, 400}, {1000, -7.0, 7.0}}}); + registry.add("hDeltaRResolution", "#DeltaR Resolution;p_{T,part};Resolution", {HistType::kTH2F, {{400, 0, 400}, {1000, -0.15, 0.15}}}); + registry.add("hFullMatching", "Full 6D matching;p_{T,det};p_{T,part};#phi_{det};#phi_{part};#DeltaR_{det};#DeltaR_{part}", {HistType::kTHnSparseD, {ptAxisDet, ptAxisPart, phiAxisDet, phiAxisPart, dRAxisDet, dRAxisPart}}); + } } template @@ -597,7 +602,7 @@ struct JetHadronRecoil { } void processData(soa::Filtered::iterator const& collision, - soa::Filtered> const& jets, + soa::Filtered> const& jets, soa::Filtered const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { @@ -612,7 +617,7 @@ struct JetHadronRecoil { PROCESS_SWITCH(JetHadronRecoil, processData, "process data", true); void processDataWithRhoSubtraction(soa::Filtered>::iterator const& collision, - soa::Filtered> const& jets, + soa::Filtered> const& jets, soa::Filtered const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { @@ -628,7 +633,7 @@ struct JetHadronRecoil { void processMCD(soa::Filtered>::iterator const& collision, aod::JMcCollisions const&, - soa::Filtered> const& jets, + soa::Filtered> const& jets, soa::Filtered const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { @@ -650,7 +655,7 @@ struct JetHadronRecoil { void processMCDWithRhoSubtraction(soa::Filtered>::iterator const& collision, aod::JMcCollisions const&, - soa::Filtered> const& jets, + soa::Filtered> const& jets, soa::Filtered const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { @@ -672,7 +677,7 @@ struct JetHadronRecoil { void processMCDWeighted(soa::Filtered>::iterator const& collision, aod::JMcCollisions const&, - soa::Filtered> const& jets, + soa::Filtered> const& jets, soa::Filtered const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { @@ -694,7 +699,7 @@ struct JetHadronRecoil { void processMCDWeightedWithRhoSubtraction(soa::Filtered>::iterator const& collision, aod::JMcCollisions const&, - soa::Filtered> const& jets, + soa::Filtered> const& jets, soa::Filtered const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { @@ -715,7 +720,7 @@ struct JetHadronRecoil { PROCESS_SWITCH(JetHadronRecoil, processMCDWeightedWithRhoSubtraction, "process MC detector level with event weights and rho subtraction", false); void processMCP(aod::JetMcCollision const& collision, - soa::Filtered> const& jets, + soa::Filtered> const& jets, soa::Filtered const& particles) { if (std::abs(collision.posZ()) > vertexZCut) { @@ -733,7 +738,7 @@ struct JetHadronRecoil { PROCESS_SWITCH(JetHadronRecoil, processMCP, "process MC particle level", false); void processMCPWeighted(aod::JetMcCollision const& collision, - soa::Filtered> const& jets, + soa::Filtered> const& jets, soa::Filtered const& particles) { if (std::abs(collision.posZ()) > vertexZCut) { @@ -893,9 +898,6 @@ struct JetHadronRecoil { deltaPhi = RecoDecay::constrainAngle(jet.phi() - jetReclustered[0].phi(), -o2::constants::math::PI); deltaY = jet.y() - jetReclustered[0].rap(); dR = RecoDecay::sqrtSumOfSquares(deltaPhi, deltaY); - LOG(debug) << "orig. jet n const = " << jet.tracksIds().size() << " pt = " << jet.pt() << " eta = " << jet.eta() << " phi = " << jet.phi(); - LOG(debug) << "recl. jet n const = " << clusterSeq.constituents(jetReclustered[0]).size() << " pt = " << jetReclustered[0].pt() << " eta = " << jetReclustered[0].eta() << " phi = " << jetReclustered[0].phi(); - LOG(debug) << "distance = " << dR; return dR; } }; From 30fcc3ba389ce1a91424665fcd1b449215cbedf5 Mon Sep 17 00:00:00 2001 From: Kaare Endrup Iversen <69893472+kaareendrup@users.noreply.github.com> Date: Tue, 26 Aug 2025 10:17:46 +0200 Subject: [PATCH 200/986] [PWGDQ] Add check for reducedMCTrack for muon triplets in dilepton-track task (#12723) --- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index f0b7965ccc4..b3ef5cf769a 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -3788,6 +3788,9 @@ struct AnalysisDileptonTrack { VarManager::FillDileptonHadron(dilepton, track, fValuesHadron); VarManager::FillDileptonTrackVertexing(event, lepton1, lepton2, track, fValuesHadron); + if (!track.has_reducedMCTrack()) { + continue; + } auto trackMC = track.reducedMCTrack(); mcDecision = 0; isig = 0; From 5589eaba8c3a813861cb5f02541b128850d2dcb2 Mon Sep 17 00:00:00 2001 From: Mingze Li Date: Tue, 26 Aug 2025 17:22:33 +0800 Subject: [PATCH 201/986] [PWGHF] Fix the issue of incorrect use of `return` (#12743) --- PWGHF/D2H/Tasks/taskCharmPolarisation.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx b/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx index 16da492051f..f938e7497fc 100644 --- a/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx +++ b/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx @@ -2315,7 +2315,7 @@ struct HfTaskCharmPolarisation { float centrality = {-1.f}; centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); if (centrality < centralityMin || centrality > centralityMax) { - return; // skip this collision if outside of the centrality range + continue; // skip this collision if outside of the centrality range } registry.fill(HIST("hCentrality"), centrality); @@ -2345,7 +2345,7 @@ struct HfTaskCharmPolarisation { float centrality = {-1.f}; centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); if (centrality < centralityMin || centrality > centralityMax) { - return; // skip this collision if outside of the centrality range + continue; // skip this collision if outside of the centrality range } registry.fill(HIST("hCentrality"), centrality); @@ -2379,7 +2379,7 @@ struct HfTaskCharmPolarisation { for (const auto& collision : collisions) { // loop over reco collisions associated to this gen collision centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); if (centrality < centralityMin || centrality > centralityMax) { - return; // skip this collision if outside of the centrality range + continue; // skip this collision if outside of the centrality range } registry.fill(HIST("hCentrality"), centrality); @@ -2420,7 +2420,7 @@ struct HfTaskCharmPolarisation { for (const auto& collision : collisions) { // loop over reco collisions associated to this gen collision centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); if (centrality < centralityMin || centrality > centralityMax) { - return; // skip this collision if outside of the centrality range + continue; // skip this collision if outside of the centrality range } registry.fill(HIST("hCentrality"), centrality); From e5d1eb694b836b9b96bc4d06cb3853507d096bb7 Mon Sep 17 00:00:00 2001 From: CyF1rmiana <3326561594@qq.com> Date: Tue, 26 Aug 2025 17:42:29 +0800 Subject: [PATCH 202/986] [PWGCF] Modify the file to select polarization (#12744) --- PWGCF/Flow/Tasks/flowEseTask.cxx | 58 +++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 5 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowEseTask.cxx b/PWGCF/Flow/Tasks/flowEseTask.cxx index 6ab2155788a..74dc98bd528 100644 --- a/PWGCF/Flow/Tasks/flowEseTask.cxx +++ b/PWGCF/Flow/Tasks/flowEseTask.cxx @@ -125,7 +125,7 @@ struct FlowEseTask { Configurable cfgUSESP{"cfgUSESP", false, "cfg for sp"}; Configurable cfgPhiDepSig{"cfgPhiDepSig", 0.2, "cfg for significance on phi dependent study"}; - Configurable cfgShiftCorr{"cfgShiftCorr", false, "additional shift correction"}; + Configurable cfgShiftCorr{"cfgShiftCorr", true, "additional shift correction"}; Configurable cfgShiftCorrDef{"cfgShiftCorrDef", false, "additional shift correction definition"}; Configurable cfgShiftPath{"cfgShiftPath", "Users/j/junlee/Qvector/QvecCalib/Shift", "Path for Shift"}; @@ -150,6 +150,7 @@ struct FlowEseTask { ConfigurableAxis lowerQAxis{"lowerQAxis", {800, 0, 800}, "result of q2"}; ConfigurableAxis multNumAxis{"multNumAxis", {300, 0, 2700}, "mult num"}; ConfigurableAxis qvecAxis{"qvecAxis", {300, -1, 1}, "range of Qvector"}; + ConfigurableAxis qvec2Axis{"qvec2Axis", {600, 0, 600}, "range of Qvector Module"}; static constexpr float kMinAmplitudeThreshold = 1e-5f; static constexpr int kShiftLevel = 10; @@ -157,8 +158,11 @@ struct FlowEseTask { static constexpr std::array kCorrLevel = {2, 3, 4, 1}; static constexpr std::array kCentBoundaries = {0.0f, 3.49f, 4.93f, 6.98f, 8.55f, 9.87f, 11.0f, 12.1f, 13.1f, 14.0f}; static constexpr std::array kCentValues = {2.5f, 7.5f, 15.0f, 25.0f, 35.0f, 45.0f, 55.0f, 65.0f, 75.0f}; + static constexpr std::array kCentrality = {0, 10, 20, 30, 40, 50, 60, 70, 80}; + static constexpr std::array, 8> kLowQvec = {{{121, 196}, {110, 172}, {93, 143}, {74, 117}, {58, 92}, {43, 70}, {31, 50}, {21, 34}}}; static constexpr float kEtaAcceptance = 0.8f; static constexpr float kCentUpperLimit = 80.0f; + static constexpr int kCentNum = 8; TF1* fMultPVCutLow = nullptr; TF1* fMultPVCutHigh = nullptr; @@ -228,6 +232,12 @@ struct FlowEseTask { histos.add(Form("psi%d/h_alambda_cos", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis, epAxis}}); histos.add(Form("psi%d/h_lambda_cos2", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis, epAxis}}); histos.add(Form("psi%d/h_alambda_cos2", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis, epAxis}}); + histos.add(Form("psi%d/h_lambda_cos2_q2", i), "", {HistType::kTH3F, {centAxis, qvec2Axis, cosAxis}}); + histos.add(Form("psi%d/h_alambda_cos2_q2", i), "", {HistType::kTH3F, {centAxis, qvec2Axis, cosAxis}}); + + histos.add(Form("psi%d/h_lambda_cos2_left", i), "", {HistType::kTH2F, {centAxis, cosAxis}}); + histos.add(Form("psi%d/h_lambda_cos2_mid", i), "", {HistType::kTH2F, {centAxis, cosAxis}}); + histos.add(Form("psi%d/h_lambda_cos2_right", i), "", {HistType::kTH2F, {centAxis, cosAxis}}); if (cfgRapidityDep) { histos.add(Form("psi%d/h_lambda_cos2_rap", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis, rapAxis}}); @@ -236,6 +246,14 @@ struct FlowEseTask { histos.add(Form("psi%d/h_lambda_cossin", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); histos.add(Form("psi%d/h_alambda_cossin", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add(Form("psi%d/h_lambda_cossin_left", i), "", {HistType::kTH2F, {centAxis, cosAxis}}); + histos.add(Form("psi%d/h_lambda_cossin_mid", i), "", {HistType::kTH2F, {centAxis, cosAxis}}); + histos.add(Form("psi%d/h_lambda_cossin_right", i), "", {HistType::kTH2F, {centAxis, cosAxis}}); + + histos.add(Form("psi%d/h_lambda_cossin_q2", i), "", {HistType::kTH3F, {centAxis, qvec2Axis, cosAxis}}); + histos.add(Form("psi%d/h_alambda_cossin_q2", i), "", {HistType::kTH3F, {centAxis, qvec2Axis, cosAxis}}); + histos.add(Form("psi%d/h_lambda_cossin_cov", i), "", {HistType::kTHnSparseF, {ptAxis, cosAxis, centAxis}}); + histos.add(Form("psi%d/h_alambda_cossin_cov", i), "", {HistType::kTHnSparseF, {ptAxis, cosAxis, centAxis}}); if (cfgAccAzimuth) { histos.add(Form("psi%d/h_lambda_coscos", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); @@ -351,6 +369,9 @@ struct FlowEseTask { histos.add(Form("psi%d/QA/EPRes_FT0C_FT0A_shifted", i), "", {HistType::kTH2F, {centQaAxis, cosAxis}}); histos.add(Form("psi%d/QA/EPRes_FT0C_FV0A_shifted", i), "", {HistType::kTH2F, {centQaAxis, cosAxis}}); histos.add(Form("psi%d/QA/EPRes_FT0A_FV0A_shifted", i), "", {HistType::kTH2F, {centQaAxis, cosAxis}}); + + histos.add(Form("psi%d/QA/EPRes_RefARefB_cov", i), "", {HistType::kTH2F, {centQaAxis, cosAxis}}); + histos.add(Form("psi%d/QA/EPRes_RefARefBRefC_cov", i), "", {HistType::kTH2F, {centQaAxis, cosAxis}}); } } @@ -617,6 +638,9 @@ struct FlowEseTask { histos.fill(HIST("psi2/QA/EPRes_FT0C_FT0A_shifted"), centrality, std::cos(static_cast(nmode) * (psidefFT0C + deltapsiFT0C - psidefFT0A - deltapsiFT0A))); histos.fill(HIST("psi2/QA/EPRes_FT0C_FV0A_shifted"), centrality, std::cos(static_cast(nmode) * (psidefFT0C + deltapsiFT0C - psidefFV0A - deltapsiFV0A))); histos.fill(HIST("psi2/QA/EPRes_FT0A_FV0A_shifted"), centrality, std::cos(static_cast(nmode) * (psidefFT0A + deltapsiFT0A - psidefFV0A - deltapsiFV0A))); + + histos.fill(HIST("psi2/QA/EPRes_RefARefB_cov"), centrality, std::cos(static_cast(nmode) * (psidefFT0C + deltapsiFT0C - psidefFT0A - deltapsiFT0A)) * std::cos(static_cast(nmode) * (psidefFT0C + deltapsiFT0C - psidefFV0A - deltapsiFV0A))); + histos.fill(HIST("psi2/QA/EPRes_RefARefBRefC_cov"), centrality, std::cos(static_cast(nmode) * (psidefFT0C + deltapsiFT0C - psidefFT0A - deltapsiFT0A)) * std::cos(static_cast(nmode) * (psidefFT0C + deltapsiFT0C - psidefFV0A - deltapsiFV0A)) * std::cos(static_cast(nmode) * (psidefFT0A + deltapsiFT0A - psidefFV0A - deltapsiFV0A))); } else if (nmode == kCorrLevel[1]) { histos.fill(HIST("psi3/QA/EP_FT0C_shifted"), centrality, psidefFT0C + deltapsiFT0C); histos.fill(HIST("psi3/QA/EP_FT0A_shifted"), centrality, psidefFT0A + deltapsiFT0A); @@ -644,10 +668,6 @@ struct FlowEseTask { qvecRefAInd = refAId * 4 + 3 + (nmode - 2) * cfgNQvec * 4; qvecRefBInd = refBId * 4 + 3 + (nmode - 2) * cfgNQvec * 4; - histos.fill(HIST("histQvecCent"), std::sqrt(collision.qvecFT0CReVec()[0] * collision.qvecFT0CReVec()[0] + collision.qvecFT0CImVec()[0] * collision.qvecFT0CImVec()[0]) * std::sqrt(collision.sumAmplFT0C()), collision.centFT0C()); - histos.fill(HIST("histQvecV2"), collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], collision.centFT0C()); - histos.fill(HIST("histMult_Cent"), collision.sumAmplFT0C(), collision.centFT0C()); - for (const auto& v0 : V0s) { auto postrack = v0.template posTrack_as(); auto negtrack = v0.template negTrack_as(); @@ -752,12 +772,36 @@ struct FlowEseTask { if (nmode == kCorrLevel[0]) { //////////// if (lambdaTag) { + double q2 = std::sqrt(collision.qvecFT0CReVec()[0] * collision.qvecFT0CReVec()[0] + collision.qvecFT0CImVec()[0] * collision.qvecFT0CImVec()[0]) * std::sqrt(collision.sumAmplFT0C()); histos.fill(HIST("psi2/h_lambda_cos"), v0.mLambda(), v0.pt(), angle * weight, centrality, relphi); histos.fill(HIST("psi2/h_lambda_cos2"), v0.mLambda(), v0.pt(), angle * angle, centrality, relphi); histos.fill(HIST("psi2/h_lambda_cossin"), v0.mLambda(), v0.pt(), angle * std::sin(relphi) * weight, centrality); histos.fill(HIST("psi2/h_lambda_vncos"), v0.mLambda(), v0.pt(), qvecMag * std::cos(relphi) * weight, centrality); histos.fill(HIST("psi2/h_lambda_vnsin"), v0.mLambda(), v0.pt(), std::sin(relphi), centrality); + histos.fill(HIST("psi2/h_lambda_cos2_q2"), centrality, std::sqrt(collision.qvecFT0CReVec()[0] * collision.qvecFT0CReVec()[0] + collision.qvecFT0CImVec()[0] * collision.qvecFT0CImVec()[0]) * std::sqrt(collision.sumAmplFT0C()), angle * angle); + histos.fill(HIST("psi2/h_lambda_cossin_q2"), centrality, std::sqrt(collision.qvecFT0CReVec()[0] * collision.qvecFT0CReVec()[0] + collision.qvecFT0CImVec()[0] * collision.qvecFT0CImVec()[0]) * std::sqrt(collision.sumAmplFT0C()), angle * std::sin(relphi) * weight); + + histos.fill(HIST("psi2/h_lambda_cossin_cov"), v0.pt(), angle * angle * angle * std::sin(relphi) * weight, centrality); + + histos.fill(HIST("histQvecCent"), std::sqrt(collision.qvecFT0CReVec()[0] * collision.qvecFT0CReVec()[0] + collision.qvecFT0CImVec()[0] * collision.qvecFT0CImVec()[0]) * std::sqrt(collision.sumAmplFT0C()), centrality); + histos.fill(HIST("histQvecV2"), collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], collision.centFT0C()); + histos.fill(HIST("histMult_Cent"), collision.sumAmplFT0C(), collision.centFT0C()); + + for (int i = 0; i < kCentNum; i++) { + if (centrality >= kCentrality[i] && centrality < kCentrality[i + 1]) { + if (q2 < kLowQvec[i][0]) { + histos.fill(HIST("psi2/h_lambda_cos2_left"), centrality, angle * angle); + histos.fill(HIST("psi2/h_lambda_cossin_left"), centrality, angle * std::sin(relphi) * weight); + } else if (q2 >= kLowQvec[i][1]) { + histos.fill(HIST("psi2/h_lambda_cos2_right"), centrality, angle * angle); + histos.fill(HIST("psi2/h_lambda_cossin_right"), centrality, angle * std::sin(relphi) * weight); + } else { + histos.fill(HIST("psi2/h_lambda_cos2_mid"), centrality, angle * angle); + histos.fill(HIST("psi2/h_lambda_cossin_mid"), centrality, angle * std::sin(relphi) * weight); + } + } + } if (cfgRapidityDep) { histos.fill(HIST("psi2/h_lambda_cos2_rap"), v0.mLambda(), v0.pt(), angle * angle, centrality, v0.yLambda(), weight); } @@ -807,6 +851,10 @@ struct FlowEseTask { histos.fill(HIST("psi2/h_alambda_vncos"), v0.mAntiLambda(), v0.pt(), qvecMag * std::cos(relphi) * weight, centrality); histos.fill(HIST("psi2/h_alambda_vnsin"), v0.mAntiLambda(), v0.pt(), std::sin(relphi), centrality); + histos.fill(HIST("psi2/h_alambda_cos2_q2"), centrality, std::sqrt(collision.qvecFT0CReVec()[0] * collision.qvecFT0CReVec()[0] + collision.qvecFT0CImVec()[0] * collision.qvecFT0CImVec()[0]) * std::sqrt(collision.sumAmplFT0C()), angle * angle); + histos.fill(HIST("psi2/h_alambda_cossin_q2"), centrality, std::sqrt(collision.qvecFT0CReVec()[0] * collision.qvecFT0CReVec()[0] + collision.qvecFT0CImVec()[0] * collision.qvecFT0CImVec()[0]) * std::sqrt(collision.sumAmplFT0C()), angle * std::sin(relphi) * weight); + + histos.fill(HIST("psi2/h_alambda_cossin_cov"), v0.pt(), angle * angle * angle * std::sin(relphi) * weight, centrality); if (cfgRapidityDep) { histos.fill(HIST("psi2/h_alambda_cos2_rap"), v0.mAntiLambda(), v0.pt(), angle * angle, centrality, v0.yLambda(), weight); } From a343f5ef6563a1d2176a7b15f80c1124ae80d1d5 Mon Sep 17 00:00:00 2001 From: Anantha Padmanabhan M Nair <82643666+ananthapadmanabhan18@users.noreply.github.com> Date: Tue, 26 Aug 2025 08:36:53 -0400 Subject: [PATCH 203/986] [PWGUD] Added isCBTHadronOk cut (#12742) --- PWGUD/Tasks/exclusiveRhoTo4Pi.cxx | 129 ++++++++++++++++++++---------- 1 file changed, 85 insertions(+), 44 deletions(-) diff --git a/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx b/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx index 0f4cbd0be70..7d875f0e1b9 100644 --- a/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx +++ b/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx @@ -402,7 +402,7 @@ struct ExclusiveRhoTo4Pi { HistogramRegistry histosData{"Data", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry histosCounter{"counters", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; // Configurable Event parameters - Configurable ifCheckUPCmode{"ifCheckUPCmode", false, "Enable UPC reconstruction only"}; + Configurable ifUPC{"ifUPC", 1, "Enable UPC reconstruction only"}; Configurable vZCut{"vZCut", 10., "Vertex Cut"}; Configurable fv0Cut{"fv0Cut", 50., "FV0A threshold"}; Configurable ft0aCut{"ft0aCut", 50., "FT0A threshold"}; @@ -444,8 +444,8 @@ struct ExclusiveRhoTo4Pi { void init(InitContext const&) { // QA plots: Event and Track Counter - histosCounter.add("EventsCounts_vs_runNo", "Number of Selected 4-Pion Events per Run; Run Number; Number of Events", kTH2F, {{113, 0, 113}, {12, 0, 12}}); - histosCounter.add("TracksCounts_vs_runNo", "Number of Selected Tracks per Run; Run Number; Number of Tracks", kTH2F, {{113, 0, 113}, {14, 0, 14}}); + histosCounter.add("EventsCounts_vs_runNo", "Event Counter Run by Run; Run Number; Number of Events", kTH2F, {{113, 0, 113}, {14, 0, 14}}); + histosCounter.add("TracksCounts_vs_runNo", "Track Counter Run by Run; Run Number; Number of Tracks", kTH2F, {{113, 0, 113}, {14, 0, 14}}); histosCounter.add("fourPionCounts_0c", "Four Pion Counts; Run Number; Events", kTH1F, {{113, 0, 113}}); histosCounter.add("fourPionCounts_0c_within_mass", "Four Pion Counts within mass range; Run Number; Events", kTH1F, {{113, 0, 113}}); histosCounter.add("fourPionCounts_0c_within_rap", "Four Pion Counts; Run Number; Events", kTH1F, {{113, 0, 113}}); @@ -456,18 +456,22 @@ struct ExclusiveRhoTo4Pi { histosCounter.add("fourPionCounts_n0c_selected", "Four Pion Counts; Run Number; Events", kTH1F, {{113, 0, 113}}); // QA plots: event selection histosData.add("UPCmode", "UPC mode; Events", kTH1F, {{5, 0, 5}}); + histosData.add("GapSide", "Gap Side;Gap Side; Events", kTH1F, {{4, 0, 4}}); + histosData.add("TrueGapSide", "True Gap Side; True Gap Side; Events", kTH1F, {{4, 0, 4}}); + histosData.add("isCBTOk", "isCBTOk; bool; Events", kTH1F, {{4, 0, 4}}); + histosData.add("isCBTHadronOk", "isCBTHadronOk; bool; Events", kTH1F, {{4, 0, 4}}); + histosData.add("isCBTZdcOk", "isCBTZdcOk; bool; Events", kTH1F, {{4, 0, 4}}); + histosData.add("isCBTHadronZdcOk", "isCBTHadronZdcOk; bool; Events", kTH1F, {{4, 0, 4}}); histosData.add("FT0A", "T0A amplitude", kTH1F, {{500, 0.0, 500.0}}); histosData.add("FT0C", "T0C amplitude", kTH1F, {{500, 0.0, 500.0}}); histosData.add("FV0A", "V0A amplitude", kTH1F, {{100, 0.0, 100}}); - histosData.add("ZDC_A", "ZDC amplitude", kTH1F, {{1000, 0.0, 15}}); - histosData.add("ZDC_C", "ZDC amplitude", kTH1F, {{1000, 0.0, 15}}); - histosData.add("FDDA", "FDD A signal; FDD A signal; Counts", kTH1F, {{500, 0.0, 500}}); - histosData.add("FDDC", "FDD C signal; FDD C signal; Counts", kTH1F, {{500, 0.0, 500}}); + histosData.add("ZDC_A", "ZDC amplitude", kTH1F, {{10000, 0.0, 10000}}); + histosData.add("ZDC_C", "ZDC amplitude", kTH1F, {{10000, 0.0, 10000}}); + histosData.add("FDDA", "FDD A signal; FDD A signal; Counts", kTH1F, {{500, 0.0, 2000}}); + histosData.add("FDDC", "FDD C signal; FDD C signal; Counts", kTH1F, {{500, 0.0, 2000}}); histosData.add("vertexX", "Vertex X; Vertex X [cm]; Counts", kTH1F, {{2000, -0.05, 0.05}}); histosData.add("vertexY", "Vertex Y; Vertex Y [cm]; Counts", kTH1F, {{2000, -0.05, 0.05}}); histosData.add("vertexZ", "Vertex Z; Vertex Z [cm]; Counts", kTH1F, {{2000, -15, 15}}); - histosData.add("GapSide", "Gap Side;Gap Side; Events", kTH1F, {{4, 0, 4}}); - histosData.add("TrueGapSide", "True Gap Side; True Gap Side; Events", kTH1F, {{4, 0, 4}}); histosData.add("occupancy", "Occupancy; Occupancy; Counts", kTH1F, {{20000, 0, 20000}}); // QA plots: tracks histosData.add("dcaXY_all", "dcaXY; dcaXY [cm]; Counts", kTH1F, {{2000, -0.1, 0.1}}); @@ -573,15 +577,24 @@ struct ExclusiveRhoTo4Pi { void processData(soa::Filtered::iterator const& collision, soa::Filtered const& tracks) { - int runIndex = getRunNumberIndex(collision.runNumber()); - // Check if the Event is reconstructed in UPC mode - if (ifCheckUPCmode && (collision.flags() != 1)) { + if (collision.flags() != ifUPC) { return; } + // RCT flag + if (!sgSelector.isCBTHadronZdcOk(collision)) { + return; + } + + int runIndex = getRunNumberIndex(collision.runNumber()); + histosData.fill(HIST("GapSide"), collision.gapSide()); histosData.fill(HIST("TrueGapSide"), sgSelector.trueGap(collision, fv0Cut, ft0aCut, ft0cCut, zdcCut)); + histosData.fill(HIST("isCBTOk"), sgSelector.isCBTOk(collision)); + histosData.fill(HIST("isCBTHadronOk"), sgSelector.isCBTHadronOk(collision)); + histosData.fill(HIST("isCBTZdcOk"), sgSelector.isCBTZdcOk(collision)); + histosData.fill(HIST("isCBTHadronZdcOk"), sgSelector.isCBTHadronZdcOk(collision)); histosData.fill(HIST("vertexX"), collision.posX()); histosData.fill(HIST("vertexY"), collision.posY()); histosData.fill(HIST("vertexZ"), collision.posZ()); @@ -940,79 +953,74 @@ struct ExclusiveRhoTo4Pi { void processEventCounter(UDCollisions::iterator const& collision) { - histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 0); - - // UPC mode - if (ifCheckUPCmode && collision.flags() != 1) { + // RCT flag + if (!sgSelector.isCBTHadronZdcOk(collision)) { return; } histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 1); - + // UPC mode + if (collision.flags() != ifUPC) { + return; + } + histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 2); // vtxITSTPC if (collision.vtxITSTPC() != vtxITSTPCcut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 2); - + histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 3); // sbp if (collision.sbp() != sbpCut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 3); - + histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 4); // itsROFb if (collision.itsROFb() != itsROFbCut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 4); - + histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 5); // tfb if (collision.tfb() != tfbCut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 5); - + histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 6); // FT0A if (collision.totalFT0AmplitudeA() > ft0aCut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 6); + histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 7); // FT0C if (collision.totalFT0AmplitudeC() > ft0cCut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 7); + histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 8); // FV0A if (collision.totalFV0AmplitudeA() > fv0Cut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 8); - + histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 9); // ZDC if (collision.energyCommonZNA() > zdcCut || collision.energyCommonZNC() > zdcCut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 9); - + histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 10); // numContributors if (collision.numContrib() != numPVContrib) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 10); - + histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 11); // vertexZ if (std::abs(collision.posZ()) > vZCut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 11); + histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 12); } // End of processCounter function void processTrackCounter(soa::Filtered::iterator const& collision, UDtracks const& tracks) { int runIndex = getRunNumberIndex(collision.runNumber()); // Check if the Event is reconstructed in UPC mode - if (ifCheckUPCmode && (collision.flags() != 1)) { + if (collision.flags() != ifUPC) { return; } for (const auto& track : tracks) { @@ -1194,20 +1202,49 @@ struct ExclusiveRhoTo4Pi { return -1; // Not found } // End of getRunNumberIndex function - void setHistBinLabels() + std::string strFormat(double value, int precision = 2) { + std::ostringstream oss; + oss << std::fixed << std::setprecision(precision) << value; + return oss.str(); + } - std::string eventLabels[12] = { - "No Cuts", "UPC mode", "vtxITSTPC=1", "sbp=1", "itsROFb=1", "tfb=1", - "FT0A <= 50", "FT0C <= 50", "FV0A <= 50", "ZDC <= 0", - "n PV Contrib = 4", "V_{z} < 10cm"}; + void setHistBinLabels() + { - int numEventCuts = 12; + std::string eventLabels[13] = { + "No Cuts", + "isCBTHadronOk", + "UPC or STD", + "vtxITSTPC=" + strFormat(vtxITSTPCcut, 0), + "sbp=" + strFormat(sbpCut, 0), + "itsROFb=" + strFormat(itsROFbCut, 0), + "tfb=" + strFormat(tfbCut, 0), + "FT0A<=" + strFormat(fv0Cut), + "FT0C<=" + strFormat(ft0cCut), + "FV0A<=" + strFormat(ft0aCut), + "ZDC", + "n PV Contrib = 4", + "V_{z} < " + strFormat(vZCut) + " cm"}; + + int numEventCuts = 13; std::string trackLabels[14] = { - "No Cuts", "isPVContributor", "pT > 0.15 GeV/c", "|#eta| < 0.9", "DCA Z < 2 cm", - "DCA XY cut", "hasITS", "hasTPC", "itsChi2NCl < 36", "tpcChi2NCl < 4", - "tpcNClsFindable < 70", "#pi tracks", "#pi^{+} tracks", "#pi^{-} tracks"}; + "No Cuts", + "isPVContributor", + "pT>" + strFormat(pTcut) + " GeV/c", + "|#eta|<" + strFormat(etaCut), + "DCA Z<" + strFormat(dcaZcut) + " cm", + "DCA XY cut", + "hasITS", + "hasTPC", + "itsChi2NCl<" + strFormat(itsChi2NClsCut), + "tpcChi2NCl<" + strFormat(tpcChi2NClsCut), + "tpcNClsFindable>" + strFormat(tpcNClsFindableCut), + "#pi tracks", + "#pi^{+} tracks", + "#pi^{-} tracks"}; + int numTrackCuts = 14; auto h1 = histosCounter.get(HIST("EventsCounts_vs_runNo")); @@ -1218,6 +1255,8 @@ struct ExclusiveRhoTo4Pi { auto h6 = histosCounter.get(HIST("fourPionCounts_n0c")); auto h7 = histosCounter.get(HIST("fourPionCounts_n0c_within_rap")); auto h8 = histosCounter.get(HIST("fourPionCounts_n0c_selected")); + auto h9 = histosCounter.get(HIST("fourPionCounts_0c_within_mass")); + auto h10 = histosCounter.get(HIST("fourPionCounts_n0c_within_mass")); for (int i = 0; i < numRunNums; ++i) { h1->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); @@ -1228,6 +1267,8 @@ struct ExclusiveRhoTo4Pi { h6->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); h7->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); h8->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); + h9->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); + h10->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); } for (int i = 0; i < numEventCuts; ++i) { h1->GetYaxis()->SetBinLabel(i + 1, eventLabels[i].c_str()); From 27fde203b329ed62606288b0c1e80fcfaf2941bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Tue, 26 Aug 2025 15:24:33 +0200 Subject: [PATCH 204/986] [Common] Include TMath header in multCalibrator.cxx (#12728) --- Common/Tools/Multiplicity/multCalibrator.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/Common/Tools/Multiplicity/multCalibrator.cxx b/Common/Tools/Multiplicity/multCalibrator.cxx index 493a3d5feac..7d3f4e51019 100644 --- a/Common/Tools/Multiplicity/multCalibrator.cxx +++ b/Common/Tools/Multiplicity/multCalibrator.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include From df88af482927138cab774903c1b64ea56fbac4da Mon Sep 17 00:00:00 2001 From: ldellost <47105254+DelloStritto@users.noreply.github.com> Date: Tue, 26 Aug 2025 16:02:00 +0200 Subject: [PATCH 205/986] [PWGHF] Save ML scores in LcToK0sP tree creator (#12331) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Luigi Dello Stritto Co-authored-by: Vít Kučera --- PWGHF/DataModel/CandidateSelectionTables.h | 4 +- .../candidateSelectorLcToK0sP.cxx | 43 +++-- PWGHF/TableProducer/treeCreatorLcToK0sP.cxx | 149 ++++++++++++------ 3 files changed, 135 insertions(+), 61 deletions(-) diff --git a/PWGHF/DataModel/CandidateSelectionTables.h b/PWGHF/DataModel/CandidateSelectionTables.h index 7f5786ee1f6..125b0fb7286 100644 --- a/PWGHF/DataModel/CandidateSelectionTables.h +++ b/PWGHF/DataModel/CandidateSelectionTables.h @@ -231,10 +231,12 @@ DECLARE_SOA_TABLE(HfSelJpsi, "AOD", "HFSELJPSI", //! namespace hf_sel_candidate_lc_to_k0s_p { DECLARE_SOA_COLUMN(IsSelLcToK0sP, isSelLcToK0sP, int); +DECLARE_SOA_COLUMN(MlProbLcToK0sP, mlProbLcToK0sP, std::vector); //! } // namespace hf_sel_candidate_lc_to_k0s_p - DECLARE_SOA_TABLE(HfSelLcToK0sP, "AOD", "HFSELLCK0SP", //! hf_sel_candidate_lc_to_k0s_p::IsSelLcToK0sP); +DECLARE_SOA_TABLE(HfMlLcToK0sP, "AOD", "HFMLLcK0sP", //! + hf_sel_candidate_lc_to_k0s_p::MlProbLcToK0sP); namespace hf_sel_candidate_b0 { diff --git a/PWGHF/TableProducer/candidateSelectorLcToK0sP.cxx b/PWGHF/TableProducer/candidateSelectorLcToK0sP.cxx index a4a026a005b..d91ab2f718e 100644 --- a/PWGHF/TableProducer/candidateSelectorLcToK0sP.cxx +++ b/PWGHF/TableProducer/candidateSelectorLcToK0sP.cxx @@ -54,6 +54,7 @@ using namespace o2::framework; struct HfCandidateSelectorLcToK0sP { Produces hfSelLcToK0sPCandidate; + Produces hfMlLcToK0sPCandidate; Configurable ptCandMin{"ptCandMin", 0., "Lower bound of candidate pT"}; Configurable ptCandMax{"ptCandMax", 50., "Upper bound of candidate pT"}; @@ -95,6 +96,7 @@ struct HfCandidateSelectorLcToK0sP { TrackSelectorPr selectorProtonHighP; o2::analysis::HfMlResponseLcToK0sP hfMlResponse; + std::vector outputMl = {}; o2::ccdb::CcdbApi ccdbApi; @@ -239,12 +241,11 @@ struct HfCandidateSelectorLcToK0sP { } template - bool selectionMl(const T& hfCandCascade, const U& bach) + bool selectionMl(const T& hfCandCascade, const U& bach, std::vector& outputMl) { auto ptCand = hfCandCascade.pt(); std::vector inputFeatures = hfMlResponse.getInputFeatures(hfCandCascade, bach); - std::vector outputMl = {}; bool isSelectedMl = hfMlResponse.isSelectedMl(inputFeatures, ptCand, outputMl); @@ -265,26 +266,37 @@ struct HfCandidateSelectorLcToK0sP { const auto& bach = candidate.prong0_as(); // bachelor track statusLc = 0; + outputMl.clear(); // implement filter bit 4 cut - should be done before this task at the track selection level // need to add special cuts (additional cuts on decay length and d0 norm) if (!selectionTopol(candidate)) { hfSelLcToK0sPCandidate(statusLc); + if (applyMl) { + hfMlLcToK0sPCandidate(outputMl); + } continue; } if (!selectionStandardPID(bach)) { hfSelLcToK0sPCandidate(statusLc); + if (applyMl) { + hfMlLcToK0sPCandidate(outputMl); + } continue; } - if (applyMl && !selectionMl(candidate, bach)) { - hfSelLcToK0sPCandidate(statusLc); - continue; + if (applyMl) { + bool isSelectedMlLcToK0sP = selectionMl(candidate, bach, outputMl); + hfMlLcToK0sPCandidate(outputMl); + + if (!isSelectedMlLcToK0sP) { + hfSelLcToK0sPCandidate(statusLc); + continue; + } } statusLc = 1; - hfSelLcToK0sPCandidate(statusLc); } } @@ -299,24 +311,35 @@ struct HfCandidateSelectorLcToK0sP { const auto& bach = candidate.prong0_as(); // bachelor track statusLc = 0; + outputMl.clear(); if (!selectionTopol(candidate)) { hfSelLcToK0sPCandidate(statusLc); + if (applyMl) { + hfMlLcToK0sPCandidate(outputMl); + } continue; } if (!selectionBayesPID(bach)) { hfSelLcToK0sPCandidate(statusLc); + if (applyMl) { + hfMlLcToK0sPCandidate(outputMl); + } continue; } - if (applyMl && !selectionMl(candidate, bach)) { - hfSelLcToK0sPCandidate(statusLc); - continue; + if (applyMl) { + bool isSelectedMlLcToK0sP = selectionMl(candidate, bach, outputMl); + hfMlLcToK0sPCandidate(outputMl); + + if (!isSelectedMlLcToK0sP) { + hfSelLcToK0sPCandidate(statusLc); + continue; + } } statusLc = 1; - hfSelLcToK0sPCandidate(statusLc); } } diff --git a/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx b/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx index 0012108a45c..1e2b2484c13 100644 --- a/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx +++ b/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx @@ -33,8 +33,10 @@ #include #include +#include #include #include +#include using namespace o2; using namespace o2::framework; @@ -68,8 +70,8 @@ DECLARE_SOA_COLUMN(DecayLength, decayLength, float); DECLARE_SOA_COLUMN(DecayLengthXY, decayLengthXY, float); DECLARE_SOA_COLUMN(DecayLengthNormalised, decayLengthNormalised, float); DECLARE_SOA_COLUMN(DecayLengthXYNormalised, decayLengthXYNormalised, float); -DECLARE_SOA_COLUMN(CPA, cpa, float); -DECLARE_SOA_COLUMN(CPAXY, cpaXY, float); +DECLARE_SOA_COLUMN(Cpa, cpa, float); +DECLARE_SOA_COLUMN(CpaXY, cpaXY, float); DECLARE_SOA_COLUMN(Ct, ct, float); DECLARE_SOA_COLUMN(PtV0Pos, ptV0Pos, float); DECLARE_SOA_COLUMN(PtV0Neg, ptV0Neg, float); @@ -84,6 +86,9 @@ DECLARE_SOA_COLUMN(V0CtLambda, v0CtLambda, float); DECLARE_SOA_COLUMN(FlagMc, flagMc, int8_t); DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t); DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); +DECLARE_SOA_COLUMN(MlScoreFirstClass, mlScoreFirstClass, float); +DECLARE_SOA_COLUMN(MlScoreSecondClass, mlScoreSecondClass, float); +DECLARE_SOA_COLUMN(MlScoreThirdClass, mlScoreThirdClass, float); // Events DECLARE_SOA_COLUMN(IsEventReject, isEventReject, int); DECLARE_SOA_COLUMN(RunNumber, runNumber, int); @@ -118,15 +123,18 @@ DECLARE_SOA_TABLE(HfCandCascLites, "AOD", "HFCANDCASCLITE", full::NSigmaTOFPr0, full::M, full::Pt, - full::CPA, - full::CPAXY, + full::Cpa, + full::CpaXY, full::Ct, full::Eta, full::Phi, full::Y, full::E, full::FlagMc, - full::OriginMcRec); + full::OriginMcRec, + full::MlScoreFirstClass, + full::MlScoreSecondClass, + full::MlScoreThirdClass); DECLARE_SOA_TABLE(HfCandCascFulls, "AOD", "HFCANDCASCFULL", collision::BCId, @@ -188,15 +196,18 @@ DECLARE_SOA_TABLE(HfCandCascFulls, "AOD", "HFCANDCASCFULL", full::M, full::Pt, full::P, - full::CPA, - full::CPAXY, + full::Cpa, + full::CpaXY, full::Ct, full::Eta, full::Phi, full::Y, full::E, full::FlagMc, - full::OriginMcRec); + full::OriginMcRec, + full::MlScoreFirstClass, + full::MlScoreSecondClass, + full::MlScoreThirdClass); DECLARE_SOA_TABLE(HfCandCascFullEs, "AOD", "HFCANDCASCFULLE", collision::BCId, @@ -228,23 +239,56 @@ struct HfTreeCreatorLcToK0sP { Configurable ptMaxForDownSample{"ptMaxForDownSample", 24., "Maximum pt for the application of the downsampling factor"}; Configurable fillOnlySignal{"fillOnlySignal", false, "Flag to fill derived tables with signal for ML trainings"}; Configurable fillOnlyBackground{"fillOnlyBackground", false, "Flag to fill derived tables with background for ML trainings"}; + Configurable applyMl{"applyMl", false, "Whether ML was used in candidateSelectorLc"}; + + constexpr static float UndefValueFloat = -999.f; HfHelper hfHelper; - Filter filterSelectCandidates = aod::hf_sel_candidate_lc_to_k0s_p::isSelLcToK0sP >= 1; using TracksWPid = soa::Join; using SelectedCandidatesMc = soa::Filtered>; - - Partition recSig = nabs(aod::hf_cand_casc::flagMcMatchRec) != int8_t(0); - Partition recBkg = nabs(aod::hf_cand_casc::flagMcMatchRec) == int8_t(0); + Filter filterSelectCandidates = aod::hf_sel_candidate_lc_to_k0s_p::isSelLcToK0sP >= 1; void init(InitContext const&) { } + /// \brief function to get ML score values for the current candidate and assign them to input parameters + /// \param candidate candidate instance + /// \param candidateMlScore instance of handler of vectors with ML scores associated with the current candidate + /// \param mlScoreFirstClass ML score for belonging to the first class + /// \param mlScoreSecondClass ML score for belonging to the second class + /// \param mlScoreThirdClass ML score for belonging to the third class + void assignMlScores(aod::HfMlLcToK0sP::iterator const& candidateMlScore, float& mlScoreFirstClass, float& mlScoreSecondClass, float& mlScoreThirdClass) + { + std::vector mlScores; + std::copy(candidateMlScore.mlProbLcToK0sP().begin(), candidateMlScore.mlProbLcToK0sP().end(), std::back_inserter(mlScores)); + + constexpr int IndexFirstClass{0}; + constexpr int IndexSecondClass{1}; + constexpr int IndexThirdClass{2}; + if (mlScores.size() == 0) { + return; // when candidateSelectorLcK0sP rejects a candidate by "usual", non-ML cut, the ml score vector remains empty + } + mlScoreFirstClass = mlScores.at(IndexFirstClass); + mlScoreSecondClass = mlScores.at(IndexSecondClass); + if (mlScores.size() > IndexThirdClass) { + mlScoreThirdClass = mlScores.at(IndexThirdClass); + } + } + template - void fillCandidate(const T& candidate, const U& bach, int8_t flagMc, int8_t originMcRec) + void fillCandidate(const T& candidate, const U& bach, int8_t flagMc, int8_t originMcRec, aod::HfMlLcToK0sP::iterator const& candidateMlScore) { + + float mlScoreFirstClass{UndefValueFloat}; + float mlScoreSecondClass{UndefValueFloat}; + float mlScoreThirdClass{UndefValueFloat}; + + if (applyMl) { + assignMlScores(candidateMlScore, mlScoreFirstClass, mlScoreSecondClass, mlScoreThirdClass); + } + if (fillCandidateLiteTable) { rowCandidateLite( candidate.chi2PCA(), @@ -283,7 +327,10 @@ struct HfTreeCreatorLcToK0sP { hfHelper.yLc(candidate), hfHelper.eLc(candidate), flagMc, - originMcRec); + originMcRec, + mlScoreFirstClass, + mlScoreSecondClass, + mlScoreThirdClass); } else { rowCandidateFull( bach.collision().bcId(), @@ -353,7 +400,10 @@ struct HfTreeCreatorLcToK0sP { hfHelper.yLc(candidate), hfHelper.eLc(candidate), flagMc, - originMcRec); + originMcRec, + mlScoreFirstClass, + mlScoreSecondClass, + mlScoreThirdClass); } } template @@ -370,52 +420,41 @@ struct HfTreeCreatorLcToK0sP { void processMc(aod::Collisions const& collisions, aod::McCollisions const&, SelectedCandidatesMc const& candidates, + aod::HfMlLcToK0sP const& candidateMlScores, soa::Join const& particles, TracksWPid const&) { + if (applyMl && candidateMlScores.size() == 0) { + LOG(fatal) << "ML enabled but table with the ML scores is empty! Please check your configurables."; + return; + } + // Filling event properties rowCandidateFullEvents.reserve(collisions.size()); for (const auto& collision : collisions) { fillEvent(collision); } - if (fillOnlySignal) { - if (fillCandidateLiteTable) { - rowCandidateLite.reserve(recSig.size()); - } else { - rowCandidateFull.reserve(recSig.size()); - } - for (const auto& candidate : recSig) { - auto bach = candidate.prong0_as(); // bachelor - fillCandidate(candidate, bach, candidate.flagMcMatchRec(), candidate.originMcRec()); - } - } else if (fillOnlyBackground) { - if (fillCandidateLiteTable) { - rowCandidateLite.reserve(recBkg.size()); - } else { - rowCandidateFull.reserve(recBkg.size()); - } - for (const auto& candidate : recBkg) { - if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); - if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { - continue; - } - } - auto bach = candidate.prong0_as(); // bachelor - fillCandidate(candidate, bach, candidate.flagMcMatchRec(), candidate.originMcRec()); - } + if (fillCandidateLiteTable) { + rowCandidateLite.reserve(candidates.size()); } else { - // Filling candidate properties - if (fillCandidateLiteTable) { - rowCandidateLite.reserve(candidates.size()); + rowCandidateFull.reserve(candidates.size()); + } + + int iCand{0}; + for (const auto& candidate : candidates) { + auto candidateMlScore = candidateMlScores.rawIteratorAt(iCand); + ++iCand; + auto bach = candidate.prong0_as(); // bachelor + const int flag = candidate.flagMcMatchRec(); + + if (fillOnlySignal && flag != 0) { + fillCandidate(candidate, bach, candidate.flagMcMatchRec(), candidate.originMcRec(), candidateMlScore); + } else if (fillOnlyBackground && flag == 0) { + fillCandidate(candidate, bach, candidate.flagMcMatchRec(), candidate.originMcRec(), candidateMlScore); } else { - rowCandidateFull.reserve(candidates.size()); - } - for (const auto& candidate : candidates) { - auto bach = candidate.prong0_as(); // bachelor - fillCandidate(candidate, bach, candidate.flagMcMatchRec(), candidate.originMcRec()); + fillCandidate(candidate, bach, candidate.flagMcMatchRec(), candidate.originMcRec(), candidateMlScore); } } @@ -439,9 +478,15 @@ struct HfTreeCreatorLcToK0sP { void processData(aod::Collisions const& collisions, soa::Join const& candidates, + aod::HfMlLcToK0sP const& candidateMlScores, TracksWPid const&) { + if (applyMl && candidateMlScores.size() == 0) { + LOG(fatal) << "ML enabled but table with the ML scores is empty! Please check your configurables."; + return; + } + // Filling event properties rowCandidateFullEvents.reserve(collisions.size()); for (const auto& collision : collisions) { @@ -454,11 +499,15 @@ struct HfTreeCreatorLcToK0sP { } else { rowCandidateFull.reserve(candidates.size()); } + + int iCand{0}; for (const auto& candidate : candidates) { + auto candidateMlScore = candidateMlScores.rawIteratorAt(iCand); + ++iCand; auto bach = candidate.prong0_as(); // bachelor double pseudoRndm = bach.pt() * 1000. - static_cast(bach.pt() * 1000); if (candidate.isSelLcToK0sP() >= 1 && pseudoRndm < downSampleBkgFactor) { - fillCandidate(candidate, bach, 0, 0); + fillCandidate(candidate, bach, 0, 0, candidateMlScore); } } } From 94c80204774efee5ed47cda14ae3f7a72d6f9a40 Mon Sep 17 00:00:00 2001 From: Junlee Kim Date: Wed, 27 Aug 2025 03:45:25 +0900 Subject: [PATCH 206/986] [PWGLF] adding event mixing (#12747) Co-authored-by: ALICE Action Bot --- .../Strangeness/lambdaTwoPartPolarization.cxx | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx b/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx index 43e10b719b8..af0c57fbeea 100644 --- a/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx @@ -130,6 +130,8 @@ struct lambdaTwoPartPolarization { ConfigurableAxis cosSigAxis{"cosSigAxis", {110, -1.05, 1.05}, "Signal cosine axis"}; ConfigurableAxis cosAccAxis{"cosAccAxis", {110, -7.05, 7.05}, "Accepatance cosine axis"}; + ConfigurableAxis vertexAxis{"vertexAxis", {5, -10, 10}, "vertex axis for mixing"}; + TF1* fMultPVCutLow = nullptr; TF1* fMultPVCutHigh = nullptr; @@ -403,6 +405,57 @@ struct lambdaTwoPartPolarization { FillHistograms(collision, collision, V0s, V0s); } PROCESS_SWITCH(lambdaTwoPartPolarization, processDataSame, "Process Event for same data", true); + + SliceCache cache; + using BinningTypeVertexContributorFT0M = ColumnBinningPolicy; + using BinningTypeVertexContributorFT0C = ColumnBinningPolicy; + void processDataMixedT0C(EventCandidates const& collisions, + TrackCandidates const& /*tracks*/, aod::V0Datas const& V0s, aod::BCsWithTimestamps const&) + { + auto tracksTuple = std::make_tuple(V0s); + BinningTypeVertexContributorFT0C binningOnPositions{{vertexAxis, centAxis}, true}; + SameKindPair pair{binningOnPositions, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; + for (auto& [c1, tracks1, c2, tracks2] : pair) { + centrality = c1.centFT0C(); + auto bc = c1.bc_as(); + if (cfgAccCor) { + AccMap = ccdb->getForTimeStamp(cfgAccCorPath.value, bc.timestamp()); + } + if (!eventSelected(c1)) + continue; + if (!eventSelected(c2)) + continue; + if (c1.bcId() == c2.bcId()) + continue; + + FillHistograms(c1, c2, tracks1, tracks2); + } + } + PROCESS_SWITCH(lambdaTwoPartPolarization, processDataMixedT0C, "Process Event for mixed data in PbPb", false); + + void processDataMixedT0M(EventCandidates const& collisions, + TrackCandidates const& /*tracks*/, aod::V0Datas const& V0s, aod::BCsWithTimestamps const&) + { + auto tracksTuple = std::make_tuple(V0s); + BinningTypeVertexContributorFT0M binningOnPositions{{vertexAxis, centAxis}, true}; + SameKindPair pair{binningOnPositions, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; + for (auto& [c1, tracks1, c2, tracks2] : pair) { + centrality = c1.centFT0M(); + auto bc = c1.bc_as(); + if (cfgAccCor) { + AccMap = ccdb->getForTimeStamp(cfgAccCorPath.value, bc.timestamp()); + } + if (!eventSelected(c1)) + continue; + if (!eventSelected(c2)) + continue; + if (c1.bcId() == c2.bcId()) + continue; + + FillHistograms(c1, c2, tracks1, tracks2); + } + } + PROCESS_SWITCH(lambdaTwoPartPolarization, processDataMixedT0M, "Process Event for mixed data in pp", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 16e01d8dd6fb725e4112537cdf99cbecd85ae83e Mon Sep 17 00:00:00 2001 From: Noor Koster <82090643+cnkoster@users.noreply.github.com> Date: Tue, 26 Aug 2025 21:10:36 +0200 Subject: [PATCH 207/986] [PWGCF] Add extra QA plots and add them to QAResults + more PID (#12745) Co-authored-by: ALICE Action Bot --- PWGCF/Flow/TableProducer/zdcQVectors.cxx | 18 +- PWGCF/Flow/Tasks/flowSP.cxx | 732 ++++++++++++----------- 2 files changed, 394 insertions(+), 356 deletions(-) diff --git a/PWGCF/Flow/TableProducer/zdcQVectors.cxx b/PWGCF/Flow/TableProducer/zdcQVectors.cxx index c748b1f51ec..bf6dc06422c 100644 --- a/PWGCF/Flow/TableProducer/zdcQVectors.cxx +++ b/PWGCF/Flow/TableProducer/zdcQVectors.cxx @@ -220,6 +220,7 @@ struct ZdcQVectors { registry.add(Form("QA/before/hQ%s%s_vs_vx", coord, side), Form("hQ%s%s_vs_vx", coord, side), {HistType::kTProfile, {axisVx}}); registry.add(Form("QA/before/hQ%s%s_vs_vy", coord, side), Form("hQ%s%s_vs_vy", coord, side), {HistType::kTProfile, {axisVy}}); registry.add(Form("QA/before/hQ%s%s_vs_vz", coord, side), Form("hQ%s%s_vs_vz", coord, side), {HistType::kTProfile, {axisVz}}); + registry.add(Form("QA/Q%s%s_vs_iteration", coord, side), Form("hQ%s%s_vs_iteration", coord, side), {HistType::kTH2D, {{25, 0, 25}, axisQ}}); names[0].push_back(TString::Format("hQ%s%s_mean_Cent_V_run", coord, side)); names[1].push_back(TString::Format("hQ%s%s_mean_cent_run", coord, side)); @@ -444,8 +445,9 @@ struct ZdcQVectors { // iteration = 0 (Energy calibration) -> step 0 only // iteration 1,2,3,4,5 = recentering -> 5 steps per iteration (1x 4D + 4x 1D) - if (cal.calibfilesLoaded[cm]) + if (cal.calibfilesLoaded[cm]) { return; + } if (ccdb_dir.empty() == false) { cal.calibList[cm] = ccdb->getForTimeStamp(ccdb_dir, timestamp); @@ -548,7 +550,6 @@ struct ZdcQVectors { isSelected = true; - // TODO Implement other ZDC estimators auto cent = collision.centFT0C(); if (cfgFT0Cvariant1) cent = collision.centFT0CVariant1(); @@ -588,10 +589,16 @@ struct ZdcQVectors { runnumber = foundBC.runNumber(); // load new calibrations for new runs only - // UPLOAD Energy calibration and vmean in 1 histogram! if (runnumber != lastRunNumber) { + cal.calibfilesLoaded[0] = false; + cal.calibList[0] = nullptr; + + cal.calibfilesLoaded[1] = false; + cal.calibList[1] = nullptr; + cal.calibfilesLoaded[2] = false; cal.calibList[2] = nullptr; + lastRunNumber = runnumber; } @@ -844,6 +851,11 @@ struct ZdcQVectors { qRec[1] -= corrQyA[cor]; qRec[2] -= corrQxC[cor]; qRec[3] -= corrQyC[cor]; + + registry.get(HIST("QA/QXA_vs_iteration"))->Fill(cor, qRec[0]); + registry.get(HIST("QA/QYA_vs_iteration"))->Fill(cor, qRec[1]); + registry.get(HIST("QA/QXC_vs_iteration"))->Fill(cor, qRec[2]); + registry.get(HIST("QA/QYC_vs_iteration"))->Fill(cor, qRec[3]); } if (isSelected && cfgFillCommonRegistry) { diff --git a/PWGCF/Flow/Tasks/flowSP.cxx b/PWGCF/Flow/Tasks/flowSP.cxx index 1442509bba0..9c29f63c75d 100644 --- a/PWGCF/Flow/Tasks/flowSP.cxx +++ b/PWGCF/Flow/Tasks/flowSP.cxx @@ -113,30 +113,33 @@ struct FlowSP { O2_DEFINE_CONFIGURABLE(cfgHarmMixed1, int, 2, "Flow harmonic n for ux and uy in mixed harmonics (MH): (Cos(n*phi), Sin(n*phi))"); O2_DEFINE_CONFIGURABLE(cfgHarmMixed2, int, 3, "Flow harmonic n for ux and uy in mixed harmonics (MH): (Cos(n*phi), Sin(n*phi))"); // settings for CCDB data - O2_DEFINE_CONFIGURABLE(cfgCCDBdir_QQ, std::string, "Users/c/ckoster/ZDC/LHC23_PbPb_pass4/meanQQ/Default", "ccdb dir for average QQ values in 1% centrality bins"); + O2_DEFINE_CONFIGURABLE(cfgCCDBdir_QQ, std::string, "Users/c/ckoster/ZDC/LHC23_PbPb_pass5/meanQQ/Default", "ccdb dir for average QQ values in 1% centrality bins"); O2_DEFINE_CONFIGURABLE(cfgCCDBdir_SP, std::string, "", "ccdb dir for average event plane resolution in 1% centrality bins"); - O2_DEFINE_CONFIGURABLE(cfgCCDB_NUA, std::string, "Users/c/ckoster/flowSP/LHC23_PbPb_pass4/Default", "ccdb dir for NUA corrections"); - O2_DEFINE_CONFIGURABLE(cfgCCDB_NUE, std::string, "Users/c/ckoster/flowSP/LHC23_PbPb_pass4/NUE/Default", "ccdb dir for NUE corrections"); + O2_DEFINE_CONFIGURABLE(cfgCCDB_NUA, std::string, "Users/c/ckoster/flowSP/LHC23_PbPb_pass5/Default", "ccdb dir for NUA corrections"); + O2_DEFINE_CONFIGURABLE(cfgCCDB_NUE, std::string, "Users/c/ckoster/flowSP/LHC23_PbPb_pass5/NUE/Default", "ccdb dir for NUE corrections"); O2_DEFINE_CONFIGURABLE(cfgCCDBdir_centrality, std::string, "", "ccdb dir for Centrality corrections"); // Confogirable axis - ConfigurableAxis axisCentrality{"axisCentrality", {10, 0, 100}, "Centrality bins for vn "}; + ConfigurableAxis axisCentrality{"axisCentrality", {20, 0, 100}, "Centrality bins for vn "}; ConfigurableAxis axisNch = {"axisNch", {400, 0, 4000}, "Global N_{ch}"}; ConfigurableAxis axisMultpv = {"axisMultpv", {400, 0, 4000}, "N_{ch} (PV)"}; // Configurables containing vector - Configurable> cfgEvSelsMultPv{"cfgEvSelsMultPv", std::vector{2389.99, -83.8483, 1.11062, -0.00672263, 1.54725e-05, 4067.4, -145.485, 2.27273, -0.0186308, 6.5501e-05}, "Multiplicity cuts (PV) first 5 parameters cutLOW last 5 cutHIGH (Default is +-3sigma pass4) "}; - Configurable> cfgEvSelsMult{"cfgEvSelsMult", std::vector{1048.48, -31.4568, 0.287794, -0.00046847, -3.5909e-06, 2610.98, -83.3983, 1.0893, -0.00735094, 2.26929e-05}, "Multiplicity cuts (Global) first 5 parameters cutLOW last 5 cutHIGH (Default is +-3sigma pass4) "}; + Configurable> cfgEvSelsMultPv{"cfgEvSelsMultPv", std::vector{2228.05, -75.5988, 0.976695, -0.00585275, 1.40738e-05, 3795.65, -136.988, 2.12393, -0.017028, 5.78679e-05}, "Multiplicity cuts (PV) first 5 parameters cutLOW last 5 cutHIGH (Default is +-2sigma pass5) "}; + Configurable> cfgEvSelsMult{"cfgEvSelsMult", std::vector{1308.86, -41.9314, 0.488423, -0.00248178, 4.71554e-06, 2973.55, -103.092, 1.47673, -0.0106685, 3.29348e-05}, "Multiplicity cuts (Global) first 5 parameters cutLOW last 5 cutHIGH (Default is +-2sigma pass5) "}; Filter collisionFilter = nabs(aod::collision::posZ) < cfgEvSelsVtxZ; Filter trackFilter = nabs(aod::track::eta) < cfgTrackSelsEta && aod::track::pt > cfgTrackSelsPtmin&& aod::track::pt < cfgTrackSelsPtmax && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && nabs(aod::track::dcaXY) < cfgTrackSelsDCAxy&& nabs(aod::track::dcaZ) < cfgTrackSelsDCAz; Filter trackFilterMC = nabs(aod::mcparticle::eta) < cfgTrackSelsEta && aod::mcparticle::pt > cfgTrackSelsPtmin&& aod::mcparticle::pt < cfgTrackSelsPtmax; - using UsedCollisions = soa::Filtered>; - using UsedTracks = soa::Filtered>; + using GeneralCollisions = soa::Join; + using UnfilteredTracks = soa::Join; + + using UsedTracks = soa::Filtered; + using ZDCCollisions = soa::Filtered>; // For MC Reco and Gen - using CCs = soa::Filtered>; + using CCs = soa::Filtered>; // without SPTableZDC using CC = CCs::iterator; - using TCs = soa::Join; - using FilteredTCs = soa::Filtered>; + using TCs = soa::Join; + using FilteredTCs = soa::Filtered; using TC = TCs::iterator; using MCs = soa::Filtered; @@ -174,8 +177,9 @@ struct FlowSP { OutputObj fWeightsNEG{GFWWeights("weights_negative")}; HistogramRegistry registry{"registry"}; + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::QAObject}; - // Event selection cuts - Alex + // Event selection cuts TF1* fPhiCutLow = nullptr; TF1* fPhiCutHigh = nullptr; TF1* fMultPVCutLow = nullptr; @@ -232,9 +236,9 @@ struct FlowSP { enum ParticleType { kUnidentified, - kPion, - kKaon, - kProton + kPions, + kKaons, + kProtons }; static constexpr std::string_view Charge[] = {"incl/", "pos/", "neg/"}; @@ -276,150 +280,167 @@ struct FlowSP { int ptbins = ptbinning.size() - 1; - registry.add("hEventCount", "Number of Event; Cut; #Events Passed Cut", {HistType::kTH1D, {{nEventSelections, 0, nEventSelections}}}); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_FilteredEvent + 1, "Filtered event"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_sel8 + 1, "Sel8"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_occupancy + 1, "kOccupancy"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kTVXinTRD + 1, "kTVXinTRD"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kNoSameBunchPileup + 1, "kNoSameBunchPileup"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodZvtxFT0vsPV + 1, "kIsGoodZvtxFT0vsPV"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kNoCollInTimeRangeStandard + 1, "kNoCollInTimeRangeStandard"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsVertexITSTPC + 1, "kIsVertexITSTPC"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_MultCuts + 1, "Multiplicity cuts"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodITSLayersAll + 1, "kkIsGoodITSLayersAll"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_isSelectedZDC + 1, "isSelected"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_CentCuts + 1, "Cenrality range"); - - registry.add("hTrackCount", "Number of Tracks; Cut; #Tracks Passed Cut", {HistType::kTH1D, {{nTrackSelections, 0, nTrackSelections}}}); - registry.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_Eta + 1, "Eta"); - registry.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_Pt + 1, "Pt"); - registry.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_DCAxy + 1, "DCAxy"); - registry.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_DCAz + 1, "DCAz"); - registry.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_GlobalTracks + 1, "GlobalTracks"); - registry.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_NCls + 1, "nClusters TPC"); - registry.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_FshCls + 1, "Frac. sh. Cls TPC"); - registry.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_TPCBoundary + 1, "TPC Boundary"); - registry.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_ZeroCharge + 1, "Only charged"); - registry.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_ParticleWeights + 1, "Apply weights"); + histos.add("hEventCount", "Number of Event; Cut; #Events Passed Cut", {HistType::kTH1D, {{nEventSelections, 0, nEventSelections}}}); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_FilteredEvent + 1, "Filtered event"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_sel8 + 1, "Sel8"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_occupancy + 1, "kOccupancy"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kTVXinTRD + 1, "kTVXinTRD"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kNoSameBunchPileup + 1, "kNoSameBunchPileup"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodZvtxFT0vsPV + 1, "kIsGoodZvtxFT0vsPV"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kNoCollInTimeRangeStandard + 1, "kNoCollInTimeRangeStandard"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsVertexITSTPC + 1, "kIsVertexITSTPC"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_MultCuts + 1, "Multiplicity cuts"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodITSLayersAll + 1, "kkIsGoodITSLayersAll"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_isSelectedZDC + 1, "isSelected"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_CentCuts + 1, "Cenrality range"); + + histos.add("hTrackCount", "Number of Tracks; Cut; #Tracks Passed Cut", {HistType::kTH1D, {{nTrackSelections, 0, nTrackSelections}}}); + histos.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_Eta + 1, "Eta"); + histos.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_Pt + 1, "Pt"); + histos.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_DCAxy + 1, "DCAxy"); + histos.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_DCAz + 1, "DCAz"); + histos.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_GlobalTracks + 1, "GlobalTracks"); + histos.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_NCls + 1, "nClusters TPC"); + histos.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_FshCls + 1, "Frac. sh. Cls TPC"); + histos.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_TPCBoundary + 1, "TPC Boundary"); + histos.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_ZeroCharge + 1, "Only charged"); + histos.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(trackSel_ParticleWeights + 1, "Apply weights"); if (cfgFillWeights) { - if (cfguseNUA2D) { - registry.add("weights/hPhi_Eta_vz", "", kTH3D, {axisPhi, axisEta, axisVz}); - registry.add("weights/hPhi_Eta_vz_positive", "", kTH3D, {axisPhi, axisEta, axisVz}); - registry.add("weights/hPhi_Eta_vz_negative", "", kTH3D, {axisPhi, axisEta, axisVz}); - } else { - // define output objects - fWeights->setPtBins(ptbins, &ptbinning[0]); - fWeights->init(true, false); + registry.add("weights2D/hPhi_Eta_vz", "", kTH3D, {axisPhi, axisEta, axisVz}); + registry.add("weights2D/hPhi_Eta_vz_positive", "", kTH3D, {axisPhi, axisEta, axisVz}); + registry.add("weights2D/hPhi_Eta_vz_negative", "", kTH3D, {axisPhi, axisEta, axisVz}); - fWeightsPOS->setPtBins(ptbins, &ptbinning[0]); - fWeightsPOS->init(true, false); + // define output objects + fWeights->setPtBins(ptbins, &ptbinning[0]); + fWeights->init(true, false); - fWeightsNEG->setPtBins(ptbins, &ptbinning[0]); - fWeightsNEG->init(true, false); - } + fWeightsPOS->setPtBins(ptbins, &ptbinning[0]); + fWeightsPOS->init(true, false); + + fWeightsNEG->setPtBins(ptbins, &ptbinning[0]); + fWeightsNEG->init(true, false); } if (cfgFillEventQA) { - registry.add("QA/after/hCentFT0C", " ; Cent FT0C (%); ", {HistType::kTH1D, {axisCent}}); - registry.add("QA/after/hCentFT0M", "; Cent FT0M (%); ", {HistType::kTH1D, {axisCent}}); - registry.add("QA/after/hCentFV0A", "; Cent FV0A (%); ", {HistType::kTH1D, {axisCent}}); - registry.add("QA/after/hCentNGlobal", "; Cent NGlobal (%); ", {HistType::kTH1D, {axisCent}}); - registry.add("QA/after/globalTracks_centT0C", "", {HistType::kTH2D, {axisCent, axisNch}}); - registry.add("QA/after/PVTracks_centT0C", "", {HistType::kTH2D, {axisCent, axisMultpv}}); - registry.add("QA/after/globalTracks_PVTracks", "", {HistType::kTH2D, {axisMultpv, axisNch}}); - registry.add("QA/after/globalTracks_multT0A", "", {HistType::kTH2D, {axisT0a, axisNch}}); - registry.add("QA/after/globalTracks_multV0A", "", {HistType::kTH2D, {axisV0a, axisNch}}); - registry.add("QA/after/multV0A_multT0A", "", {HistType::kTH2D, {axisT0a, axisV0a}}); - registry.add("QA/after/multT0C_centT0C", "", {HistType::kTH2D, {axisCent, axisT0c}}); - registry.add("QA/after/CentFT0C_vs_CentFT0Cvariant1", " ; Cent FT0C (%); Cent FT0Cvariant1 (%) ", {HistType::kTH2D, {axisCent, axisCent}}); - registry.add("QA/after/CentFT0C_vs_CentFT0M", " ; Cent FT0C (%); Cent FT0M (%) ", {HistType::kTH2D, {axisCent, axisCent}}); - registry.add("QA/after/CentFT0C_vs_CentFV0A", " ; Cent FT0C (%); Cent FV0A (%) ", {HistType::kTH2D, {axisCent, axisCent}}); - registry.add("QA/after/CentFT0C_vs_CentNGlobal", " ; Cent FT0C (%); Cent NGlobal (%) ", {HistType::kTH2D, {axisCent, axisCent}}); + histos.add("QA/after/hCentFT0C", " ; Cent FT0C (%); ", {HistType::kTH1D, {axisCent}}); + histos.add("QA/after/hCentFT0M", "; Cent FT0M (%); ", {HistType::kTH1D, {axisCent}}); + histos.add("QA/after/hCentFV0A", "; Cent FV0A (%); ", {HistType::kTH1D, {axisCent}}); + histos.add("QA/after/hCentNGlobal", "; Cent NGlobal (%); ", {HistType::kTH1D, {axisCent}}); + histos.add("QA/after/globalTracks_centT0C", "", {HistType::kTH2D, {axisCent, axisNch}}); + histos.add("QA/after/PVTracks_centT0C", "", {HistType::kTH2D, {axisCent, axisMultpv}}); + histos.add("QA/after/globalTracks_PVTracks", "", {HistType::kTH2D, {axisMultpv, axisNch}}); + histos.add("QA/after/globalTracks_multT0A", "", {HistType::kTH2D, {axisT0a, axisNch}}); + histos.add("QA/after/globalTracks_multV0A", "", {HistType::kTH2D, {axisV0a, axisNch}}); + histos.add("QA/after/multV0A_multT0A", "", {HistType::kTH2D, {axisT0a, axisV0a}}); + histos.add("QA/after/multT0C_centT0C", "", {HistType::kTH2D, {axisCent, axisT0c}}); + histos.add("QA/after/CentFT0C_vs_CentFT0Cvariant1", " ; Cent FT0C (%); Cent FT0Cvariant1 (%) ", {HistType::kTH2D, {axisCent, axisCent}}); + histos.add("QA/after/CentFT0C_vs_CentFT0M", " ; Cent FT0C (%); Cent FT0M (%) ", {HistType::kTH2D, {axisCent, axisCent}}); + histos.add("QA/after/CentFT0C_vs_CentFV0A", " ; Cent FT0C (%); Cent FV0A (%) ", {HistType::kTH2D, {axisCent, axisCent}}); + histos.add("QA/after/CentFT0C_vs_CentNGlobal", " ; Cent FT0C (%); Cent NGlobal (%) ", {HistType::kTH2D, {axisCent, axisCent}}); + + if (cfgFillEventPlaneQA && doprocessData) { + histos.add("QA/after/PsiA_vs_Cent", "", {HistType::kTH2D, {axisPhiPlane, axisCent}}); + histos.add("QA/after/PsiC_vs_Cent", "", {HistType::kTH2D, {axisPhiPlane, axisCent}}); + histos.add("QA/after/PsiFull_vs_Cent", "", {HistType::kTH2D, {axisPhiPlane, axisCent}}); + histos.add("QA/after/PsiA_vs_Vx", "", {HistType::kTH2D, {axisPhiPlane, axisVx}}); + histos.add("QA/after/PsiC_vs_Vx", "", {HistType::kTH2D, {axisPhiPlane, axisVx}}); + histos.add("QA/after/PsiFull_vs_Vx", "", {HistType::kTH2D, {axisPhiPlane, axisVx}}); + histos.add("QA/after/PsiA_vs_Vy", "", {HistType::kTH2D, {axisPhiPlane, axisVy}}); + histos.add("QA/after/PsiC_vs_Vy", "", {HistType::kTH2D, {axisPhiPlane, axisVy}}); + histos.add("QA/after/PsiFull_vs_Vy", "", {HistType::kTH2D, {axisPhiPlane, axisVy}}); + histos.add("QA/after/PsiA_vs_Vz", "", {HistType::kTH2D, {axisPhiPlane, axisVz}}); + histos.add("QA/after/PsiC_vs_Vz", "", {HistType::kTH2D, {axisPhiPlane, axisVz}}); + histos.add("QA/after/PsiFull_vs_Vz", "", {HistType::kTH2D, {axisPhiPlane, axisVz}}); + } + + if (cfgFillQABefore) { + histos.addClone("QA/after/", "QA/before/"); + } } if (doprocessData || doprocessMCReco) { - // track QA for pos, neg, incl - if (cfgFillPIDQA) { - registry.add("hPIDcounts", "", kTH2D, {{{4, 0, 4}, axisPt}}); - registry.get(HIST("hPIDcounts"))->GetXaxis()->SetBinLabel(1, "UFO"); - registry.get(HIST("hPIDcounts"))->GetXaxis()->SetBinLabel(2, "Pion"); - registry.get(HIST("hPIDcounts"))->GetXaxis()->SetBinLabel(3, "Kaon"); - registry.get(HIST("hPIDcounts"))->GetXaxis()->SetBinLabel(4, "Proton"); - - registry.add("incl/QA/after/hdEdxTPC_pt", "", {HistType::kTH2D, {axisPt, axisdEdx}}); - registry.add("incl/QA/after/hBetaTOF_pt", "", {HistType::kTH2D, {axisPt, axisBeta}}); - registry.add("incl/pion/QA/after/hNsigmaTPC_pt", "", {HistType::kTH2D, {axisPt, axisNsigma}}); - registry.add("incl/pion/QA/after/hNsigmaTOF_pt", "", {HistType::kTH2D, {axisPt, axisNsigma}}); - - if (cfgFillTrackQA) { - registry.add("incl/pion/QA/after/hPt", "", kTH1D, {axisPt}); - registry.add("incl/pion/QA/after/hPhi", "", kTH1D, {axisPhi}); - registry.add("incl/pion/QA/after/hPhi_uncorrected", "", kTH1D, {axisPhi}); - registry.add("incl/pion/QA/after/hEta", "", kTH1D, {axisEta}); - registry.add("incl/pion/QA/after/hPhi_Eta_vz", "", kTH3D, {axisPhi, axisEta, axisVz}); - registry.add("incl/pion/QA/after/hPhi_Eta_vz_corrected", "", kTH3D, {axisPhi, axisEta, axisVz}); - registry.add("incl/pion/QA/after/hDCAxy_pt", "", kTH2D, {axisPt, axisDCAxy}); - registry.add("incl/pion/QA/after/hDCAz_pt", "", kTH2D, {axisPt, axisDCAz}); - registry.add("incl/pion/QA/after/hSharedClusters_pt", "", {HistType::kTH2D, {axisPt, axisShCl}}); - registry.add("incl/pion/QA/after/hCrossedRows_pt", "", {HistType::kTH2D, {axisPt, axisCl}}); - registry.add("incl/pion/QA/after/hCrossedRows_vs_SharedClusters", "", {HistType::kTH2D, {axisCl, axisShCl}}); - } - if (cfgFillQABefore) - registry.addClone("incl/pion/QA/after/", "incl/pion/QA/before/"); - } if (cfgFillTrackQA) { - registry.add("QA/after/pt_phi", "", {HistType::kTH2D, {axisPt, axisPhiMod}}); - registry.add("incl/QA/after/hPhi_Eta_vz", "", kTH3D, {axisPhi, axisEta, axisVz}); - registry.add("incl/QA/after/hPhi_Eta_vz_corrected", "", kTH3D, {axisPhi, axisEta, axisVz}); - registry.add("incl/QA/after/hDCAxy_pt", "", kTH2D, {axisPt, axisDCAxy}); - registry.add("incl/QA/after/hDCAz_pt", "", kTH2D, {axisPt, axisDCAz}); - registry.add("incl/QA/after/hSharedClusters_pt", "", {HistType::kTH2D, {axisPt, axisShCl}}); - registry.add("incl/QA/after/hCrossedRows_pt", "", {HistType::kTH2D, {axisPt, axisCl}}); - registry.add("incl/QA/after/hCrossedRows_vs_SharedClusters", "", {HistType::kTH2D, {axisCl, axisShCl}}); + histos.add("incl/QA/after/pt_phi", "", {HistType::kTH2D, {axisPt, axisPhiMod}}); + histos.add("incl/QA/after/hPhi_Eta_vz", "", kTH3D, {axisPhi, axisEta, axisVz}); + histos.add("incl/QA/after/hPhi_Eta_vz_corrected", "", kTH3D, {axisPhi, axisEta, axisVz}); + histos.add("incl/QA/after/hDCAxy_pt", "", kTH2D, {axisPt, axisDCAxy}); + histos.add("incl/QA/after/hDCAz_pt", "", kTH2D, {axisPt, axisDCAz}); + histos.add("incl/QA/after/hSharedClusters_pt", "", {HistType::kTH2D, {axisPt, axisShCl}}); + histos.add("incl/QA/after/hCrossedRows_pt", "", {HistType::kTH2D, {axisPt, axisCl}}); + histos.add("incl/QA/after/hCrossedRows_vs_SharedClusters", "", {HistType::kTH2D, {axisCl, axisShCl}}); if (cfgTrackSelDoTrackQAvsCent) { - registry.add("incl/QA/after/hPt", "", kTH2D, {axisPt, axisCent}); - registry.add("incl/QA/after/hPt_forward", "", kTH2D, {axisPt, axisCent}); - registry.add("incl/QA/after/hPt_forward_uncorrected", "", kTH2D, {axisPt, axisCent}); - registry.add("incl/QA/after/hPt_backward", "", kTH2D, {axisPt, axisCent}); - registry.add("incl/QA/after/hPt_backward_uncorrected", "", kTH2D, {axisPt, axisCent}); - registry.add("incl/QA/after/hPhi", "", kTH2D, {axisPhi, axisCent}); - registry.add("incl/QA/after/hPhi_uncorrected", "", kTH2D, {axisPhi, axisCent}); - registry.add("incl/QA/after/hEta", "", kTH2D, {axisEta, axisCent}); - registry.add("incl/QA/after/hEta_uncorrected", "", kTH2D, {axisEta, axisCent}); + histos.add("incl/QA/after/hPt_Eta", "", kTH3D, {axisPt, axisEta, axisCent}); + histos.add("incl/QA/after/hPt_Eta_uncorrected", "", kTH3D, {axisPt, axisEta, axisCent}); + histos.add("incl/QA/after/hPhi_Eta", "", kTH3D, {axisPhi, axisEta, axisCent}); + histos.add("incl/QA/after/hPhi_Eta_uncorrected", "", kTH3D, {axisPhi, axisEta, axisCent}); } else { - registry.add("incl/QA/after/hPt", "", kTH1D, {axisPt}); - registry.add("incl/QA/after/hPt_forward", "", kTH1D, {axisPt}); - registry.add("incl/QA/after/hPt_forward_uncorrected", "", kTH1D, {axisPt}); - registry.add("incl/QA/after/hPt_backward", "", kTH1D, {axisPt}); - registry.add("incl/QA/after/hPt_backward_uncorrected", "", kTH1D, {axisPt}); - registry.add("incl/QA/after/hPhi", "", kTH1D, {axisPhi}); - registry.add("incl/QA/after/hPhi_uncorrected", "", kTH1D, {axisPhi}); - registry.add("incl/QA/after/hEta", "", kTH1D, {axisEta}); - registry.add("incl/QA/after/hEta_uncorrected", "", kTH1D, {axisEta}); + histos.add("incl/QA/after/hPhi_Eta_Pt", "", kTH3D, {axisPhi, axisEta, axisPt}); + histos.add("incl/QA/after/hPhi_Eta_Pt_corrected", "", kTH3D, {axisPhi, axisEta, axisPt}); } if (cfgFillQABefore) - registry.addClone("incl/QA/after/", "incl/QA/before/"); + histos.addClone("incl/QA/after/", "incl/QA/before/"); + } + + if (cfgFillPIDQA) { + histos.add("hPIDcounts", "", kTH2D, {{{4, 0, 4}, axisPt}}); + histos.get(HIST("hPIDcounts"))->GetXaxis()->SetBinLabel(1, "UFO"); + histos.get(HIST("hPIDcounts"))->GetXaxis()->SetBinLabel(2, "Pion"); + histos.get(HIST("hPIDcounts"))->GetXaxis()->SetBinLabel(3, "Kaon"); + histos.get(HIST("hPIDcounts"))->GetXaxis()->SetBinLabel(4, "Proton"); + + histos.add("incl/QA/after/hdEdxTPC_pt", "", {HistType::kTH2D, {axisPt, axisdEdx}}); + histos.add("incl/QA/after/hBetaTOF_pt", "", {HistType::kTH2D, {axisPt, axisBeta}}); + histos.add("incl/QA/before/hdEdxTPC_pt", "", {HistType::kTH2D, {axisPt, axisdEdx}}); + histos.add("incl/QA/before/hBetaTOF_pt", "", {HistType::kTH2D, {axisPt, axisBeta}}); + + histos.add("incl/pion/QA/after/hNsigmaTPC_pt", "", {HistType::kTH2D, {axisPt, axisNsigma}}); + histos.add("incl/pion/QA/after/hNsigmaTOF_pt", "", {HistType::kTH2D, {axisPt, axisNsigma}}); + + histos.add("incl/pion/QA/after/hPhi_Eta_vz", "", kTH3D, {axisPhi, axisEta, axisVz}); + histos.add("incl/pion/QA/after/hPhi_Eta_vz_corrected", "", kTH3D, {axisPhi, axisEta, axisVz}); + histos.add("incl/pion/QA/after/hPhi_Eta_Pt", "", kTH3D, {axisPhi, axisEta, axisPt}); + histos.add("incl/pion/QA/after/hPhi_Eta_Pt_corrected", "", kTH3D, {axisPhi, axisEta, axisPt}); + histos.add("incl/pion/QA/after/hDCAxy_pt", "", kTH2D, {axisPt, axisDCAxy}); + histos.add("incl/pion/QA/after/hDCAz_pt", "", kTH2D, {axisPt, axisDCAz}); + histos.add("incl/pion/QA/after/hSharedClusters_pt", "", {HistType::kTH2D, {axisPt, axisShCl}}); + histos.add("incl/pion/QA/after/hCrossedRows_pt", "", {HistType::kTH2D, {axisPt, axisCl}}); + histos.add("incl/pion/QA/after/hCrossedRows_vs_SharedClusters", "", {HistType::kTH2D, {axisCl, axisShCl}}); + + if (cfgFillQABefore) { + histos.addClone("incl/pion/QA/after/", "incl/pion/QA/before/"); + } + + histos.addClone("incl/pion/", "incl/kaon/"); + histos.addClone("incl/pion/", "incl/proton/"); } if (doprocessMCReco) { - registry.add("trackMCReco/after/hIsPhysicalPrimary", "", {HistType::kTH1D, {{2, 0, 2}}}); - registry.add("trackMCReco/hTrackSize_unFiltered", "", {HistType::kTH1D, {{100, 0, 200000}}}); - registry.add("trackMCReco/hTrackSize_Filtered", "", {HistType::kTH1D, {{100, 0, 20000}}}); - registry.get(HIST("trackMCReco/after/hIsPhysicalPrimary"))->GetXaxis()->SetBinLabel(1, "Secondary"); - registry.get(HIST("trackMCReco/after/hIsPhysicalPrimary"))->GetXaxis()->SetBinLabel(2, "Primary"); - registry.add("trackMCReco/after/incl/hPt_hadron", "", {HistType::kTH1D, {axisPt}}); - registry.add("trackMCReco/after/incl/hPt_proton", "", {HistType::kTH1D, {axisPt}}); - registry.add("trackMCReco/after/incl/hPt_pion", "", {HistType::kTH1D, {axisPt}}); - registry.add("trackMCReco/after/incl/hPt_kaon", "", {HistType::kTH1D, {axisPt}}); - registry.addClone("trackMCReco/after/incl/", "trackMCReco/before/pos/"); - registry.addClone("trackMCReco/after/incl/", "trackMCReco/before/neg/"); + registry.add("trackMCReco/after/hIsPhysicalPrimary", "", {HistType::kTH2D, {{2, 0, 2}, axisCentrality}}); + registry.add("trackMCReco/hTrackSize_unFiltered", "", {HistType::kTH2D, {{100, 0, 200000}, axisCentrality}}); + registry.add("trackMCReco/hTrackSize_Filtered", "", {HistType::kTH2D, {{100, 0, 20000}, axisCentrality}}); + registry.get(HIST("trackMCReco/after/hIsPhysicalPrimary"))->GetXaxis()->SetBinLabel(1, "Secondary"); + registry.get(HIST("trackMCReco/after/hIsPhysicalPrimary"))->GetXaxis()->SetBinLabel(2, "Primary"); + registry.add("trackMCReco/after/incl/hPt_hadron", "", {HistType::kTH3D, {axisPt, axisEta, axisCentrality}}); + registry.add("trackMCReco/after/incl/hPt_proton", "", {HistType::kTH3D, {axisPt, axisEta, axisCentrality}}); + registry.add("trackMCReco/after/incl/hPt_pion", "", {HistType::kTH3D, {axisPt, axisEta, axisCentrality}}); + registry.add("trackMCReco/after/incl/hPt_kaon", "", {HistType::kTH3D, {axisPt, axisEta, axisCentrality}}); + // Clone into particles and before/after + registry.addClone("trackMCReco/after/incl/", "trackMCReco/after/pos/"); + registry.addClone("trackMCReco/after/incl/", "trackMCReco/after/neg/"); registry.addClone("trackMCReco/after/", "trackMCReco/before/"); } if (doprocessData) { + registry.add("QQCorrelations/qAqCX", "", kTProfile, {axisCent}); + registry.add("QQCorrelations/qAqCY", "", kTProfile, {axisCent}); + registry.add("QQCorrelations/qAqCXY", "", kTProfile, {axisCent}); + registry.add("QQCorrelations/qAXqCY", "", kTProfile, {axisCent}); + registry.add("QQCorrelations/qAYqCX", "", kTProfile, {axisCent}); + registry.add("QQCorrelations/qAXYqCXY", "", kTProfile, {axisCent}); + if (cfgFillGeneralV1Histos) { // track properties per centrality and per eta, pt bin registry.add("incl/vnC_eta", "", kTProfile2D, {axisEtaVn, axisCentrality}); @@ -515,60 +536,40 @@ struct FlowSP { registry.add("incl/vnFull_eta_EP", "", kTProfile2D, {axisEtaVn, axisCentrality}); } if (cfgFillEventPlaneQA) { - registry.add("QA/hSPplaneA", "hSPplaneA", kTH1D, {axisPhiPlane}); - registry.add("QA/hSPplaneC", "hSPplaneC", kTH1D, {axisPhiPlane}); - registry.add("QA/hSPplaneFull", "hSPplaneFull", kTH1D, {axisPhiPlane}); - registry.add("QA/hCosPhiACosPhiC", "hCosPhiACosPhiC; Centrality(%); #LT Cos(#Psi^{A})Cos(#Psi^{C})#GT", kTProfile, {axisCent}); - registry.add("QA/hSinPhiASinPhiC", "hSinPhiASinPhiC; Centrality(%); #LT Sin(#Psi^{A})Sin(#Psi^{C})#GT", kTProfile, {axisCent}); - registry.add("QA/hSinPhiACosPhiC", "hSinPhiACosPhiC; Centrality(%); #LT Sin(#Psi^{A})Cos(#Psi^{C})#GT", kTProfile, {axisCent}); - registry.add("QA/hCosPhiASinsPhiC", "hCosPhiASinsPhiC; Centrality(%); #LT Cos(#Psi^{A})Sin(#Psi^{C})#GT", kTProfile, {axisCent}); - registry.add("QA/hFullEvPlaneRes", "hFullEvPlaneRes; Centrality(%); -#LT Cos(#Psi^{A} - #Psi^{C})#GT ", kTProfile, {axisCent}); - registry.add("QA/after/PsiA_vs_Cent", "", {HistType::kTH2D, {axisPhiPlane, axisCent}}); - registry.add("QA/after/PsiC_vs_Cent", "", {HistType::kTH2D, {axisPhiPlane, axisCent}}); - registry.add("QA/after/PsiFull_vs_Cent", "", {HistType::kTH2D, {axisPhiPlane, axisCent}}); - registry.add("QA/after/PsiA_vs_Vx", "", {HistType::kTH2D, {axisPhiPlane, axisVx}}); - registry.add("QA/after/PsiC_vs_Vx", "", {HistType::kTH2D, {axisPhiPlane, axisVx}}); - registry.add("QA/after/PsiFull_vs_Vx", "", {HistType::kTH2D, {axisPhiPlane, axisVx}}); - registry.add("QA/after/PsiA_vs_Vy", "", {HistType::kTH2D, {axisPhiPlane, axisVy}}); - registry.add("QA/after/PsiC_vs_Vy", "", {HistType::kTH2D, {axisPhiPlane, axisVy}}); - registry.add("QA/after/PsiFull_vs_Vy", "", {HistType::kTH2D, {axisPhiPlane, axisVy}}); - registry.add("QA/after/PsiA_vs_Vz", "", {HistType::kTH2D, {axisPhiPlane, axisVz}}); - registry.add("QA/after/PsiC_vs_Vz", "", {HistType::kTH2D, {axisPhiPlane, axisVz}}); - registry.add("QA/after/PsiFull_vs_Vz", "", {HistType::kTH2D, {axisPhiPlane, axisVz}}); + histos.add("QA/hSPplaneA", "hSPplaneA", kTH1D, {axisPhiPlane}); + histos.add("QA/hSPplaneC", "hSPplaneC", kTH1D, {axisPhiPlane}); + histos.add("QA/hSPplaneFull", "hSPplaneFull", kTH1D, {axisPhiPlane}); + histos.add("QA/hCosPhiACosPhiC", "hCosPhiACosPhiC; Centrality(%); #LT Cos(#Psi^{A})Cos(#Psi^{C})#GT", kTProfile, {axisCent}); + histos.add("QA/hSinPhiASinPhiC", "hSinPhiASinPhiC; Centrality(%); #LT Sin(#Psi^{A})Sin(#Psi^{C})#GT", kTProfile, {axisCent}); + histos.add("QA/hSinPhiACosPhiC", "hSinPhiACosPhiC; Centrality(%); #LT Sin(#Psi^{A})Cos(#Psi^{C})#GT", kTProfile, {axisCent}); + histos.add("QA/hCosPhiASinsPhiC", "hCosPhiASinsPhiC; Centrality(%); #LT Cos(#Psi^{A})Sin(#Psi^{C})#GT", kTProfile, {axisCent}); + histos.add("QA/hFullEvPlaneRes", "hFullEvPlaneRes; Centrality(%); -#LT Cos(#Psi^{A} - #Psi^{C})#GT ", kTProfile, {axisCent}); } if (cfgFillEventQA) { - registry.add("QA/qAqCX", "", kTProfile, {axisCent}); - registry.add("QA/qAqCY", "", kTProfile, {axisCent}); - registry.add("QA/qAqCXY", "", kTProfile, {axisCent}); - registry.add("QA/qAXqCY", "", kTProfile, {axisCent}); - registry.add("QA/qAYqCX", "", kTProfile, {axisCent}); - registry.add("QA/qAXYqCXY", "", kTProfile, {axisCent}); - registry.add("QA/hCentFull", " ; Centrality (%); ", {HistType::kTH1D, {axisCent}}); + histos.add("QA/hCentFull", " ; Centrality (%); ", {HistType::kTH1D, {axisCent}}); } } // end of doprocessData - if (cfgFillQABefore && (cfgFillEventQA || cfgFillPIDQA)) - registry.addClone("QA/after/", "QA/before/"); - - if (cfgFillPID || cfgFillPIDQA) { - registry.addClone("incl/pion/", "incl/kaon/"); + if (cfgFillChargeDependence || cfgFillPID) { registry.addClone("incl/pion/", "incl/proton/"); - registry.addClone("incl/pion/", "incl/unidentified/"); - } - if (cfgFillChargeDependence || cfgFillPIDQA) { + registry.addClone("incl/pion/", "incl/kaon/"); registry.addClone("incl/", "pos/"); registry.addClone("incl/", "neg/"); } + if (cfgFillPIDQA) { + histos.addClone("incl/", "pos/"); + histos.addClone("incl/", "neg/"); + } + } else if (doprocessMCGen) { registry.add("trackMCGen/nCollReconstructedPerMcCollision", "", {HistType::kTH1D, {{10, -5, 5}}}); - registry.add("trackMCGen/after/incl/hPt_hadron", "", {HistType::kTH1D, {axisPt}}); - registry.add("trackMCGen/after/incl/hPt_proton", "", {HistType::kTH1D, {axisPt}}); - registry.add("trackMCGen/after/incl/hPt_pion", "", {HistType::kTH1D, {axisPt}}); - registry.add("trackMCGen/after/incl/hPt_kaon", "", {HistType::kTH1D, {axisPt}}); + registry.add("trackMCGen/after/incl/hPt_hadron", "", {HistType::kTH3D, {axisPt, axisEta, axisCentrality}}); + registry.add("trackMCGen/after/incl/hPt_proton", "", {HistType::kTH3D, {axisPt, axisEta, axisCentrality}}); + registry.add("trackMCGen/after/incl/hPt_pion", "", {HistType::kTH3D, {axisPt, axisEta, axisCentrality}}); + registry.add("trackMCGen/after/incl/hPt_kaon", "", {HistType::kTH3D, {axisPt, axisEta, axisCentrality}}); registry.add("trackMCGen/after/incl/phi_eta_vtxZ_gen", "", {HistType::kTH3D, {axisPhi, axisEta, axisVz}}); - registry.addClone("trackMCGen/after/incl/", "trackMCGen/before/pos/"); - registry.addClone("trackMCGen/after/incl/", "trackMCGen/before/neg/"); - if (cfgFillQABefore) - registry.addClone("trackMCGen/after/", "trackMCGen/before/"); + registry.addClone("trackMCGen/after/incl/", "trackMCGen/after/pos/"); + registry.addClone("trackMCGen/after/incl/", "trackMCGen/after/neg/"); + registry.addClone("trackMCGen/after/", "trackMCGen/before/"); } if (cfgEvSelsUseAdditionalEventCut) { @@ -636,7 +637,7 @@ struct FlowSP { return kUnidentified; // No PID information available } - std::unordered_map usedNSigma = {{usedNSigmaPi, kPion}, {usedNSigmaKa, kKaon}, {usedNSigmaPr, kProton}}; + std::unordered_map usedNSigma = {{usedNSigmaPi, kPions}, {usedNSigmaKa, kKaons}, {usedNSigmaPr, kProtons}}; int nIdentified = 0; int valPID = 0; @@ -775,7 +776,7 @@ struct FlowSP { { if (!collision.sel8()) return 0; - registry.fill(HIST("hEventCount"), evSel_sel8); + histos.fill(HIST("hEventCount"), evSel_sel8); // Occupancy if (cfgEvSelsDoOccupancySel) { @@ -783,7 +784,7 @@ struct FlowSP { if (occupancy > cfgEvSelsMaxOccupancy) { return 0; } - registry.fill(HIST("hEventCount"), evSel_occupancy); + histos.fill(HIST("hEventCount"), evSel_occupancy); } if (cfgEvSelsTVXinTRD) { @@ -792,7 +793,7 @@ struct FlowSP { // "CMTVX-B-NOPF-TRD,minbias_TVX" return 0; } - registry.fill(HIST("hEventCount"), evSel_kTVXinTRD); + histos.fill(HIST("hEventCount"), evSel_kTVXinTRD); } if (cfgEvSelsNoSameBunchPileupCut) { @@ -801,7 +802,7 @@ struct FlowSP { // https://indico.cern.ch/event/1396220/#1-event-selection-with-its-rof return 0; } - registry.fill(HIST("hEventCount"), evSel_kNoSameBunchPileup); + histos.fill(HIST("hEventCount"), evSel_kNoSameBunchPileup); } if (cfgEvSelsIsGoodZvtxFT0vsPV) { if (!collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { @@ -809,14 +810,14 @@ struct FlowSP { // use this cut at low multiplicities with caution return 0; } - registry.fill(HIST("hEventCount"), evSel_kIsGoodZvtxFT0vsPV); + histos.fill(HIST("hEventCount"), evSel_kIsGoodZvtxFT0vsPV); } if (cfgEvSelsNoCollInTimeRangeStandard) { if (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { // Rejection of the collisions which have other events nearby return 0; } - registry.fill(HIST("hEventCount"), evSel_kNoCollInTimeRangeStandard); + histos.fill(HIST("hEventCount"), evSel_kNoCollInTimeRangeStandard); } if (cfgEvSelsIsVertexITSTPC) { @@ -824,7 +825,7 @@ struct FlowSP { // selects collisions with at least one ITS-TPC track, and thus rejects vertices built from ITS-only tracks return 0; } - registry.fill(HIST("hEventCount"), evSel_kIsVertexITSTPC); + histos.fill(HIST("hEventCount"), evSel_kIsVertexITSTPC); } if (cfgEvSelsUseAdditionalEventCut) { @@ -851,7 +852,7 @@ struct FlowSP { if (multTrk > fMultCutHigh->Eval(collision.centFT0C())) return 0; - registry.fill(HIST("hEventCount"), evSel_MultCuts); + histos.fill(HIST("hEventCount"), evSel_MultCuts); } if (cfgEvSelsIsGoodITSLayersAll) { @@ -860,7 +861,7 @@ struct FlowSP { // https://indico.cern.ch/event/1493023/ (09-01-2025) return 0; } - registry.fill(HIST("hEventCount"), evSel_kIsGoodITSLayersAll); + histos.fill(HIST("hEventCount"), evSel_kIsGoodITSLayersAll); } return 1; @@ -871,17 +872,17 @@ struct FlowSP { { if (std::fabs(track.eta()) > cfgTrackSelsEta) return false; - registry.fill(HIST("hTrackCount"), trackSel_Eta); + histos.fill(HIST("hTrackCount"), trackSel_Eta); if (track.pt() < cfgTrackSelsPtmin || track.pt() > cfgTrackSelsPtmax) return false; - registry.fill(HIST("hTrackCount"), trackSel_Pt); + histos.fill(HIST("hTrackCount"), trackSel_Pt); if (track.dcaXY() > cfgTrackSelsDCAxy) return false; - registry.fill(HIST("hTrackCount"), trackSel_DCAxy); + histos.fill(HIST("hTrackCount"), trackSel_DCAxy); if (track.dcaZ() > cfgTrackSelsDCAz) return false; @@ -889,15 +890,15 @@ struct FlowSP { if (cfgTrackSelsDoDCApt && std::fabs(track.dcaZ()) > (cfgTrackSelsDCApt1 * cfgTrackSelsDCApt2) / (std::pow(track.pt(), 1.1))) return false; - registry.fill(HIST("hTrackCount"), trackSel_DCAz); + histos.fill(HIST("hTrackCount"), trackSel_DCAz); if (track.tpcNClsFound() < cfgTrackSelsNcls) return false; - registry.fill(HIST("hTrackCount"), trackSel_NCls); + histos.fill(HIST("hTrackCount"), trackSel_NCls); if (track.tpcFractionSharedCls() > cfgTrackSelsFshcls) return false; - registry.fill(HIST("hTrackCount"), trackSel_FshCls); + histos.fill(HIST("hTrackCount"), trackSel_FshCls); double phimodn = track.phi(); if (field < 0) // for negative polarity field @@ -909,16 +910,16 @@ struct FlowSP { phimodn += o2::constants::math::PI / 18.0; // to center gap in the middle phimodn = fmod(phimodn, o2::constants::math::PI / 9.0); - if (cfgFillTrackQA) - registry.fill(HIST("QA/before/pt_phi"), track.pt(), phimodn); + if (cfgFillTrackQA && cfgFillQABefore) + histos.fill(HIST("incl/QA/before/pt_phi"), track.pt(), phimodn); if (cfgTrackSelsUseAdditionalTrackCut) { if (phimodn < fPhiCutHigh->Eval(track.pt()) && phimodn > fPhiCutLow->Eval(track.pt())) return false; // reject track } if (cfgFillTrackQA) - registry.fill(HIST("QA/after/pt_phi"), track.pt(), phimodn); - registry.fill(HIST("hTrackCount"), trackSel_TPCBoundary); + histos.fill(HIST("incl/QA/after/pt_phi"), track.pt(), phimodn); + histos.fill(HIST("hTrackCount"), trackSel_TPCBoundary); return true; } @@ -930,21 +931,21 @@ struct FlowSP { static constexpr std::string_view Time[] = {"before", "after"}; - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hCentFT0C"), collision.centFT0C(), centWeight); - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hCentNGlobal"), collision.centNGlobal(), centWeight); - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hCentFT0M"), collision.centFT0M(), centWeight); - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hCentFV0A"), collision.centFV0A(), centWeight); - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/globalTracks_centT0C"), collision.centFT0C(), tracks.size(), centWeight); - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PVTracks_centT0C"), collision.centFT0C(), collision.multNTracksPV(), centWeight); - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/globalTracks_PVTracks"), collision.multNTracksPV(), tracks.size(), centWeight); - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/globalTracks_multT0A"), collision.multFT0A(), tracks.size(), centWeight); - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/globalTracks_multV0A"), collision.multFV0A(), tracks.size(), centWeight); - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/multV0A_multT0A"), collision.multFT0A(), collision.multFV0A(), centWeight); - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/multT0C_centT0C"), collision.centFT0C(), collision.multFT0C(), centWeight); - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/CentFT0C_vs_CentFT0Cvariant1"), collision.centFT0C(), collision.centFT0CVariant1(), centWeight); - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/CentFT0C_vs_CentFT0M"), collision.centFT0C(), collision.centFT0M(), centWeight); - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/CentFT0C_vs_CentFV0A"), collision.centFT0C(), collision.centFV0A(), centWeight); - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/CentFT0C_vs_CentNGlobal"), collision.centFT0C(), collision.centNGlobal(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hCentFT0C"), collision.centFT0C(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hCentNGlobal"), collision.centNGlobal(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hCentFT0M"), collision.centFT0M(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hCentFV0A"), collision.centFV0A(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/globalTracks_centT0C"), collision.centFT0C(), tracks.size(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PVTracks_centT0C"), collision.centFT0C(), collision.multNTracksPV(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/globalTracks_PVTracks"), collision.multNTracksPV(), tracks.size(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/globalTracks_multT0A"), collision.multFT0A(), tracks.size(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/globalTracks_multV0A"), collision.multFV0A(), tracks.size(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/multV0A_multT0A"), collision.multFT0A(), collision.multFV0A(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/multT0C_centT0C"), collision.centFT0C(), collision.multFT0C(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/CentFT0C_vs_CentFT0Cvariant1"), collision.centFT0C(), collision.centFT0CVariant1(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/CentFT0C_vs_CentFT0M"), collision.centFT0C(), collision.centFT0M(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/CentFT0C_vs_CentFV0A"), collision.centFT0C(), collision.centFV0A(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/CentFT0C_vs_CentNGlobal"), collision.centFT0C(), collision.centNGlobal(), centWeight); if (cfgFillEventPlaneQA) { if constexpr (o2::framework::has_type_v) { @@ -952,18 +953,18 @@ struct FlowSP { double psiC = 1.0 * std::atan2(collision.qyC(), collision.qxC()); double psiFull = 1.0 * std::atan2(collision.qyA() + collision.qyC(), collision.qxA() + collision.qxC()); - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiA_vs_Cent"), psiA, collision.centFT0C(), centWeight); - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiC_vs_Cent"), psiC, collision.centFT0C(), centWeight); - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiFull_vs_Cent"), psiFull, collision.centFT0C(), centWeight); - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiA_vs_Vx"), psiA, collision.vx(), centWeight); - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiC_vs_Vx"), psiC, collision.vx(), centWeight); - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiFull_vs_Vx"), psiFull, collision.vx(), centWeight); - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiA_vs_Vy"), psiA, collision.vy(), centWeight); - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiC_vs_Vy"), psiC, collision.vy(), centWeight); - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiFull_vs_Vy"), psiFull, collision.vy(), centWeight); - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiA_vs_Vz"), psiA, collision.posZ(), centWeight); - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiC_vs_Vz"), psiC, collision.posZ(), centWeight); - registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiFull_vs_Vz"), psiFull, collision.posZ(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiA_vs_Cent"), psiA, collision.centFT0C(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiC_vs_Cent"), psiC, collision.centFT0C(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiFull_vs_Cent"), psiFull, collision.centFT0C(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiA_vs_Vx"), psiA, collision.vx(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiC_vs_Vx"), psiC, collision.vx(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiFull_vs_Vx"), psiFull, collision.vx(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiA_vs_Vy"), psiA, collision.vy(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiC_vs_Vy"), psiC, collision.vy(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiFull_vs_Vy"), psiFull, collision.vy(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiA_vs_Vz"), psiA, collision.posZ(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiC_vs_Vz"), psiC, collision.posZ(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiFull_vs_Vz"), psiFull, collision.posZ(), centWeight); } } return; @@ -1029,7 +1030,7 @@ struct FlowSP { registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnCy_pt"), track.pt(), centrality, (uy * qyC) / std::sqrt(std::fabs(corrQQy)), weight); } - if (cfgFillEventPlane) { + if (cfgFillEventPlane && pt == 0) { // only fill for inclusive! registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnA_eta_EP"), track.eta(), centrality, vnA, weight); registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnC_eta_EP"), track.eta(), centrality, vnC, weight); registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnFull_eta_EP"), track.eta(), centrality, vnFull, weight); @@ -1084,25 +1085,16 @@ struct FlowSP { static constexpr std::string_view Time[] = {"before/", "after/"}; // NOTE: species[kUnidentified] = "" (when no PID) - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPt"), track.pt(), wacc * weff); - if (track.eta() > 0) { - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPt_forward"), track.pt(), wacc * weff); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPt_forward_uncorrected"), track.pt()); - } else { - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPt_backward"), track.pt(), wacc * weff); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPt_backward_uncorrected"), track.pt()); - } - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi"), track.phi(), wacc); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_uncorrected"), track.phi()); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hEta"), track.eta(), wacc); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hEta_uncorrected"), track.eta()); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_vz"), track.phi(), track.eta(), vz); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_vz_corrected"), track.phi(), track.eta(), vz, wacc); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hDCAxy_pt"), track.pt(), track.dcaXY(), wacc * weff); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hDCAz_pt"), track.pt(), track.dcaZ(), wacc * weff); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hSharedClusters_pt"), track.pt(), track.tpcFractionSharedCls(), wacc * weff); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hCrossedRows_pt"), track.pt(), track.tpcNClsFound(), wacc * weff); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hCrossedRows_vs_SharedClusters"), track.tpcNClsFound(), track.tpcFractionSharedCls(), wacc * weff); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_Pt"), track.phi(), track.eta(), track.pt()); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_Pt_corrected"), track.phi(), track.eta(), track.pt(), wacc * weff); + + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_vz"), track.phi(), track.eta(), vz); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_vz_corrected"), track.phi(), track.eta(), vz, wacc * weff); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hDCAxy_pt"), track.pt(), track.dcaXY(), wacc * weff); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hDCAz_pt"), track.pt(), track.dcaZ(), wacc * weff); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hSharedClusters_pt"), track.pt(), track.tpcFractionSharedCls(), wacc * weff); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hCrossedRows_pt"), track.pt(), track.tpcNClsFound(), wacc * weff); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hCrossedRows_vs_SharedClusters"), track.tpcNClsFound(), track.tpcFractionSharedCls(), wacc * weff); } template @@ -1113,90 +1105,85 @@ struct FlowSP { static constexpr std::string_view Time[] = {"before/", "after/"}; // NOTE: species[kUnidentified] = "" (when no PID) - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPt"), track.pt(), centrality, wacc * weff); - if (track.eta() > 0) { - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPt_forward"), track.pt(), centrality, wacc * weff); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPt_forward_uncorrected"), track.pt(), centrality); - } else { - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPt_backward"), track.pt(), centrality, wacc * weff); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPt_backward_uncorrected"), track.pt(), centrality); - } - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi"), track.phi(), centrality, wacc); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_uncorrected"), track.phi(), centrality); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hEta"), track.eta(), centrality, wacc); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hEta_uncorrected"), track.eta(), centrality); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_vz"), track.phi(), track.eta(), vz); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_vz_corrected"), track.phi(), track.eta(), vz, wacc); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hDCAxy_pt"), track.pt(), track.dcaXY(), wacc * weff); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hDCAz_pt"), track.pt(), track.dcaZ(), wacc * weff); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hSharedClusters_pt"), track.pt(), track.tpcFractionSharedCls(), wacc * weff); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hCrossedRows_pt"), track.pt(), track.tpcNClsFound(), wacc * weff); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hCrossedRows_vs_SharedClusters"), track.tpcNClsFound(), track.tpcFractionSharedCls(), wacc * weff); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPt_Eta"), track.pt(), track.eta(), centrality, wacc * weff); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPt_Eta_uncorrected"), track.pt(), track.eta(), centrality); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta"), track.phi(), track.eta(), centrality, wacc * weff); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_uncorrected"), track.phi(), track.eta(), centrality); + + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_vz"), track.phi(), track.eta(), vz); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_vz_corrected"), track.phi(), track.eta(), vz, wacc); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hDCAxy_pt"), track.pt(), track.dcaXY(), wacc * weff); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hDCAz_pt"), track.pt(), track.dcaZ(), wacc * weff); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hSharedClusters_pt"), track.pt(), track.tpcFractionSharedCls(), wacc * weff); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hCrossedRows_pt"), track.pt(), track.tpcNClsFound(), wacc * weff); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hCrossedRows_vs_SharedClusters"), track.tpcNClsFound(), track.tpcFractionSharedCls(), wacc * weff); } template inline void fillPIDQA(TrackObject track) { - if (!cfgFillPIDQA) + if (!cfgFillPIDQA || !cfgFillTrackQA) return; - registry.fill(HIST(Charge[ct]) + HIST("pion/") + HIST("QA/") + HIST(Time[ft]) + HIST("hNsigmaTOF_pt"), track.pt(), track.tofNSigmaPi()); - registry.fill(HIST(Charge[ct]) + HIST("pion/") + HIST("QA/") + HIST(Time[ft]) + HIST("hNsigmaTPC_pt"), track.pt(), track.tpcNSigmaPi()); - registry.fill(HIST(Charge[ct]) + HIST("kaon/") + HIST("QA/") + HIST(Time[ft]) + HIST("hNsigmaTOF_pt"), track.pt(), track.tofNSigmaKa()); - registry.fill(HIST(Charge[ct]) + HIST("kaon/") + HIST("QA/") + HIST(Time[ft]) + HIST("hNsigmaTPC_pt"), track.pt(), track.tpcNSigmaKa()); - registry.fill(HIST(Charge[ct]) + HIST("proton/") + HIST("QA/") + HIST(Time[ft]) + HIST("hNsigmaTOF_pt"), track.pt(), track.tofNSigmaPr()); - registry.fill(HIST(Charge[ct]) + HIST("proton/") + HIST("QA/") + HIST(Time[ft]) + HIST("hNsigmaTPC_pt"), track.pt(), track.tpcNSigmaPr()); + histos.fill(HIST(Charge[ct]) + HIST("pion/") + HIST("QA/") + HIST(Time[ft]) + HIST("hNsigmaTOF_pt"), track.pt(), track.tofNSigmaPi()); + histos.fill(HIST(Charge[ct]) + HIST("pion/") + HIST("QA/") + HIST(Time[ft]) + HIST("hNsigmaTPC_pt"), track.pt(), track.tpcNSigmaPi()); + histos.fill(HIST(Charge[ct]) + HIST("kaon/") + HIST("QA/") + HIST(Time[ft]) + HIST("hNsigmaTOF_pt"), track.pt(), track.tofNSigmaKa()); + histos.fill(HIST(Charge[ct]) + HIST("kaon/") + HIST("QA/") + HIST(Time[ft]) + HIST("hNsigmaTPC_pt"), track.pt(), track.tpcNSigmaKa()); + histos.fill(HIST(Charge[ct]) + HIST("proton/") + HIST("QA/") + HIST(Time[ft]) + HIST("hNsigmaTOF_pt"), track.pt(), track.tofNSigmaPr()); + histos.fill(HIST(Charge[ct]) + HIST("proton/") + HIST("QA/") + HIST(Time[ft]) + HIST("hNsigmaTPC_pt"), track.pt(), track.tpcNSigmaPr()); + + histos.fill(HIST(Charge[ct]) + HIST("proton/") + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_Pt"), track.phi(), track.eta(), track.pt()); - registry.fill(HIST(Charge[ct]) + HIST("QA/") + HIST(Time[ft]) + HIST("hdEdxTPC_pt"), track.pt(), track.tpcSignal()); - registry.fill(HIST(Charge[ct]) + HIST("QA/") + HIST(Time[ft]) + HIST("hBetaTOF_pt"), track.pt(), track.beta()); + histos.fill(HIST(Charge[ct]) + HIST("QA/") + HIST(Time[ft]) + HIST("hdEdxTPC_pt"), track.pt(), track.tpcSignal()); + histos.fill(HIST(Charge[ct]) + HIST("QA/") + HIST(Time[ft]) + HIST("hBetaTOF_pt"), track.pt(), track.beta()); } template - inline void fillMCPtHistos(TrackObject track, int pdgCode) + inline void fillMCPtHistos(TrackObject track, int pdgCode, float centrality) { static constexpr std::string_view Time[] = {"before/", "after/"}; static constexpr std::string_view Mode[] = {"Gen/", "Reco/"}; - registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("incl/hPt_hadron"), track.pt()); + registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("incl/hPt_hadron"), track.pt(), track.eta(), centrality); if (pdgCode > 0) { - registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("pos/hPt_hadron"), track.pt()); + registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("pos/hPt_hadron"), track.pt(), track.eta(), centrality); } else { - registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("neg/hPt_hadron"), track.pt()); + registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("neg/hPt_hadron"), track.pt(), track.eta(), centrality); } if (pdgCode == kPiPlus || pdgCode == kPiMinus) { - registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("incl/hPt_pion"), track.pt()); + registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("incl/hPt_pion"), track.pt(), track.eta(), centrality); if (pdgCode == kPiPlus) { - registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("pos/hPt_pion"), track.pt()); + registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("pos/hPt_pion"), track.pt(), track.eta(), centrality); } else { - registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("neg/hPt_pion"), track.pt()); + registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("neg/hPt_pion"), track.pt(), track.eta(), centrality); } } else if (pdgCode == kKPlus || pdgCode == kKMinus) { - registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("incl/hPt_kaon"), track.pt()); + registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("incl/hPt_kaon"), track.pt(), track.eta(), centrality); if (pdgCode == kKPlus) { - registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("pos/hPt_kaon"), track.pt()); + registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("pos/hPt_kaon"), track.pt(), track.eta(), centrality); } else { - registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("neg/hPt_kaon"), track.pt()); + registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("neg/hPt_kaon"), track.pt(), track.eta(), centrality); } } else if (pdgCode == kProton || pdgCode == kProtonBar) { - registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("incl/hPt_proton"), track.pt()); + registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("incl/hPt_proton"), track.pt(), track.eta(), centrality); if (pdgCode == kProton) { - registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("pos/hPt_proton"), track.pt()); + registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("pos/hPt_proton"), track.pt(), track.eta(), centrality); } else { - registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("neg/hPt_proton"), track.pt()); + registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("neg/hPt_proton"), track.pt(), track.eta(), centrality); } } } - template - inline void fillPrimaryHistos(McParticleObject mcparticle) + template + inline void fillPrimaryHistos(McParticleObject mcparticle, float centrality) { static constexpr std::string_view Time[] = {"/before", "/after"}; if (!mcparticle.isPhysicalPrimary()) { - registry.fill(HIST("trackMCReco") + HIST(Time[md]) + HIST("/hIsPhysicalPrimary"), 0); + registry.fill(HIST("trackMCReco") + HIST(Time[ft]) + HIST("/hIsPhysicalPrimary"), 0, centrality); } else { - registry.fill(HIST("trackMCReco") + HIST(Time[md]) + HIST("/hIsPhysicalPrimary"), 1); + registry.fill(HIST("trackMCReco") + HIST(Time[ft]) + HIST("/hIsPhysicalPrimary"), 1, centrality); } } @@ -1226,9 +1213,9 @@ struct FlowSP { } } - void processData(UsedCollisions::iterator const& collision, aod::BCsWithTimestamps const&, UsedTracks const& tracks) + void processData(ZDCCollisions::iterator const& collision, aod::BCsWithTimestamps const&, UsedTracks const& tracks) { - registry.fill(HIST("hEventCount"), evSel_FilteredEvent); + histos.fill(HIST("hEventCount"), evSel_FilteredEvent); auto bc = collision.bc_as(); int standardMagField = 99999; auto field = (cfgMagField == standardMagField) ? getMagneticField(bc.timestamp()) : cfgMagField; @@ -1262,7 +1249,7 @@ struct FlowSP { if (collision.isSelected()) { - registry.fill(HIST("hEventCount"), evSel_isSelectedZDC); + histos.fill(HIST("hEventCount"), evSel_isSelectedZDC); double qxA = collision.qxA(); double qyA = collision.qyA(); @@ -1276,30 +1263,32 @@ struct FlowSP { // https://twiki.cern.ch/twiki/pub/ALICE/DirectedFlowAnalysisNote/vn_ZDC_ALICE_INT_NOTE_version02.pdf double psiFull = 1.0 * std::atan2(qyA + qyC, qxA + qxC); + // always fill these histograms! + registry.fill(HIST("QQCorrelations/qAqCXY"), centrality, qxA * qxC + qyA * qyC); + registry.fill(HIST("QQCorrelations/qAXqCY"), centrality, qxA * qyC); + registry.fill(HIST("QQCorrelations/qAYqCX"), centrality, qyA * qxC); + registry.fill(HIST("QQCorrelations/qAXYqCXY"), centrality, qyA * qxC + qxA * qyC); + registry.fill(HIST("QQCorrelations/qAqCX"), centrality, qxA * qxC); + registry.fill(HIST("QQCorrelations/qAqCY"), centrality, qyA * qyC); + if (cfgFillEventQA) { - registry.fill(HIST("QA/hCentFull"), centrality, 1); - registry.fill(HIST("QA/qAqCXY"), centrality, qxA * qxC + qyA * qyC); - registry.fill(HIST("QA/qAXqCY"), centrality, qxA * qyC); - registry.fill(HIST("QA/qAYqCX"), centrality, qyA * qxC); - registry.fill(HIST("QA/qAXYqCXY"), centrality, qyA * qxC + qxA * qyC); - registry.fill(HIST("QA/qAqCX"), centrality, qxA * qxC); - registry.fill(HIST("QA/qAqCY"), centrality, qyA * qyC); + histos.fill(HIST("QA/hCentFull"), centrality, 1); } if (cfgFillEventPlaneQA) { - registry.fill(HIST("QA/hSPplaneA"), psiA, 1); - registry.fill(HIST("QA/hSPplaneC"), psiC, 1); - registry.fill(HIST("QA/hSPplaneFull"), psiFull, 1); - registry.fill(HIST("QA/hCosPhiACosPhiC"), centrality, std::cos(psiA) * std::cos(psiC)); - registry.fill(HIST("QA/hSinPhiASinPhiC"), centrality, std::sin(psiA) * std::sin(psiC)); - registry.fill(HIST("QA/hSinPhiACosPhiC"), centrality, std::sin(psiA) * std::cos(psiC)); - registry.fill(HIST("QA/hCosPhiASinsPhiC"), centrality, std::cos(psiA) * std::sin(psiC)); - registry.fill(HIST("QA/hFullEvPlaneRes"), centrality, -1 * std::cos(psiA - psiC)); + histos.fill(HIST("QA/hSPplaneA"), psiA, 1); + histos.fill(HIST("QA/hSPplaneC"), psiC, 1); + histos.fill(HIST("QA/hSPplaneFull"), psiFull, 1); + histos.fill(HIST("QA/hCosPhiACosPhiC"), centrality, std::cos(psiA) * std::cos(psiC)); + histos.fill(HIST("QA/hSinPhiASinPhiC"), centrality, std::sin(psiA) * std::sin(psiC)); + histos.fill(HIST("QA/hSinPhiACosPhiC"), centrality, std::sin(psiA) * std::cos(psiC)); + histos.fill(HIST("QA/hCosPhiASinsPhiC"), centrality, std::cos(psiA) * std::sin(psiC)); + histos.fill(HIST("QA/hFullEvPlaneRes"), centrality, -1 * std::cos(psiA - psiC)); } if (centrality > cfgCentMax || centrality < cfgCentMin) return; - registry.fill(HIST("hEventCount"), evSel_CentCuts); + histos.fill(HIST("hEventCount"), evSel_CentCuts); // Load correlations and SP resolution needed for Scalar Product and event plane methods. // Only load once! @@ -1348,7 +1337,7 @@ struct FlowSP { int trackPID = (cfgFillPID || cfgFillPIDQA) ? getTrackPID(track) : kUnidentified; if (cfgFillPIDQA) - registry.fill(HIST("hPIDcounts"), trackPID, track.pt()); + histos.fill(HIST("hPIDcounts"), trackPID, track.pt()); float weff = 1., wacc = 1.; float weffP = 1., waccP = 1.; @@ -1357,7 +1346,7 @@ struct FlowSP { if (track.sign() == 0.0) continue; - registry.fill(HIST("hTrackCount"), trackSel_ZeroCharge); + histos.fill(HIST("hTrackCount"), trackSel_ZeroCharge); bool pos = (track.sign() > 0) ? true : false; if (cfgFillQABefore) { @@ -1365,14 +1354,14 @@ struct FlowSP { case kUnidentified: fillAllQA(track, vtxz, centrality, pos); break; - case kPion: - fillAllQA(track, vtxz, centrality, pos); + case kPions: + fillAllQA(track, vtxz, centrality, pos); break; - case kKaon: - fillAllQA(track, vtxz, centrality, pos); + case kKaons: + fillAllQA(track, vtxz, centrality, pos); break; - case kProton: - fillAllQA(track, vtxz, centrality, pos); + case kProtons: + fillAllQA(track, vtxz, centrality, pos); break; } } @@ -1383,26 +1372,19 @@ struct FlowSP { // constrain angle to 0 -> [0,0+2pi] auto phi = RecoDecay::constrainAngle(track.phi(), 0); - if (cfguseNUA2D && cfgFillWeights) { - registry.fill(HIST("weights/hPhi_Eta_vz"), phi, track.eta(), vtxz, 1); - if (pos) { - registry.fill(HIST("weights/hPhi_Eta_vz_positive"), phi, track.eta(), vtxz, 1); - } else { - registry.fill(HIST("weights/hPhi_Eta_vz_negative"), phi, track.eta(), vtxz, 1); - } - } - // Fill NUA weights (last 0 is for Data see GFWWeights class (not a weight)) + // ToDo: Add pi, ka, proton here! if (cfgFillWeights) { fWeights->fill(phi, track.eta(), vtxz, track.pt(), centrality, 0); + registry.fill(HIST("weights2D/hPhi_Eta_vz"), phi, track.eta(), vtxz, 1); } - if (cfgFillWeightsPOS) { - if (pos) - fWeightsPOS->fill(phi, track.eta(), vtxz, track.pt(), centrality, 0); + if (cfgFillWeightsPOS && pos) { + fWeightsPOS->fill(phi, track.eta(), vtxz, track.pt(), centrality, 0); + registry.fill(HIST("weights2D/hPhi_Eta_vz_positive"), phi, track.eta(), vtxz, 1); } - if (cfgFillWeightsNEG) { - if (!pos) - fWeightsNEG->fill(phi, track.eta(), vtxz, track.pt(), centrality, 0); + if (cfgFillWeightsNEG && !pos) { + fWeightsNEG->fill(phi, track.eta(), vtxz, track.pt(), centrality, 0); + registry.fill(HIST("weights2D/hPhi_Eta_vz_negative"), phi, track.eta(), vtxz, 1); } // Set weff and wacc for inclusive, negative and positive hadrons @@ -1413,20 +1395,20 @@ struct FlowSP { if (!pos && !setCurrentParticleWeights(kNegative, weffN, waccN, phi, track.eta(), track.pt(), vtxz)) continue; - registry.fill(HIST("hTrackCount"), trackSel_ParticleWeights); + histos.fill(HIST("hTrackCount"), trackSel_ParticleWeights); switch (trackPID) { case kUnidentified: fillAllQA(track, vtxz, centrality, pos, wacc, weff, waccP, weffP, waccN, weffN); break; - case kPion: - fillAllQA(track, vtxz, centrality, pos, wacc, weff, waccP, weffP, waccN, weffN); + case kPions: + fillAllQA(track, vtxz, centrality, pos, wacc, weff, waccP, weffP, waccN, weffN); break; - case kKaon: - fillAllQA(track, vtxz, centrality, pos, wacc, weff, waccP, weffP, waccN, weffN); + case kKaons: + fillAllQA(track, vtxz, centrality, pos, wacc, weff, waccP, weffP, waccN, weffN); break; - case kProton: - fillAllQA(track, vtxz, centrality, pos, wacc, weff, waccP, weffP, waccN, weffN); + case kProtons: + fillAllQA(track, vtxz, centrality, pos, wacc, weff, waccP, weffP, waccN, weffN); break; } @@ -1446,6 +1428,30 @@ struct FlowSP { double vnFull = std::cos(cfgHarm * (phi - psiFull)) / evPlaneRes; fillHistograms(track, wacc, weff, centWeight, ux, uy, uxMH, uyMH, uxMH2, uyMH2, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); + + // NOTE: these are not the right wacc and weff!! Need to do for each particle species! This is just to test for now. + if (cfgFillPID) { + if (trackPID == kPions) { + fillHistograms(track, wacc, weff, centWeight, ux, uy, uxMH, uyMH, uxMH2, uyMH2, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); + if (pos) + fillHistograms(track, waccP, weffP, centWeight, ux, uy, uxMH, uyMH, uxMH2, uyMH2, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); + else + fillHistograms(track, waccN, weffN, centWeight, ux, uy, uxMH, uyMH, uxMH2, uyMH2, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); + } else if (trackPID == kKaons) { + fillHistograms(track, wacc, weff, centWeight, ux, uy, uxMH, uyMH, uxMH2, uyMH2, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); + if (pos) + fillHistograms(track, waccP, weffP, centWeight, ux, uy, uxMH, uyMH, uxMH2, uyMH2, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); + else + fillHistograms(track, waccN, weffN, centWeight, ux, uy, uxMH, uyMH, uxMH2, uyMH2, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); + } else if (trackPID == kProtons) { + fillHistograms(track, wacc, weff, centWeight, ux, uy, uxMH, uyMH, uxMH2, uyMH2, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); + if (pos) + fillHistograms(track, waccP, weffP, centWeight, ux, uy, uxMH, uyMH, uxMH2, uyMH2, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); + else + fillHistograms(track, waccN, weffN, centWeight, ux, uy, uxMH, uyMH, uxMH2, uyMH2, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); + } + } + if (cfgFillChargeDependence) { if (pos) { fillHistograms(track, waccP, weffP, centWeight, ux, uy, uxMH, uyMH, uxMH2, uyMH2, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); @@ -1477,7 +1483,7 @@ struct FlowSP { centrality = collision.centNGlobal(); if (cfgFillQABefore) - fillEventQA(collision, tracks); + fillEventQA(collision, filteredTracks); if (!eventSelected(collision, filteredTracks.size())) return; @@ -1485,34 +1491,53 @@ struct FlowSP { if (centrality > cfgCentMax || centrality < cfgCentMin) return; - registry.fill(HIST("hEventCount"), evSel_CentCuts); + histos.fill(HIST("hEventCount"), evSel_CentCuts); if (!collision.has_mcCollision()) { LOGF(info, "No mccollision found for this collision"); return; } - fillEventQA(collision, tracks); + fillEventQA(collision, filteredTracks); - registry.fill(HIST("trackMCReco/hTrackSize_unFiltered"), tracks.size()); - registry.fill(HIST("trackMCReco/hTrackSize_Filtered"), filteredTracks.size()); + registry.fill(HIST("trackMCReco/hTrackSize_unFiltered"), tracks.size(), centrality); + registry.fill(HIST("trackMCReco/hTrackSize_Filtered"), filteredTracks.size(), centrality); for (const auto& track : filteredTracks) { auto mcParticle = track.mcParticle(); if (track.sign() == 0.0) continue; - registry.fill(HIST("hTrackCount"), trackSel_ZeroCharge); + histos.fill(HIST("hTrackCount"), trackSel_ZeroCharge); + + fillMCPtHistos(track, mcParticle.pdgCode(), centrality); + bool pos = (track.sign() > 0) ? true : false; - fillMCPtHistos(track, mcParticle.pdgCode()); + fillPrimaryHistos(mcParticle, centrality); - fillTrackQA(track, vtxz); + // This neglects PID (for now) later use getPID like in data. + if (cfgFillQABefore) { + switch (std::abs(mcParticle.pdgCode())) { + case kPions: + fillAllQA(track, vtxz, centrality, pos); + break; + case kKaons: + fillAllQA(track, vtxz, centrality, pos); + break; + case kProtons: + fillAllQA(track, vtxz, centrality, pos); + break; + default: + fillAllQA(track, vtxz, centrality, pos); + } + } if (!trackSelected(track, field)) continue; - fillMCPtHistos(track, mcParticle.pdgCode()); + fillMCPtHistos(track, mcParticle.pdgCode(), centrality); fillTrackQA(track, vtxz); + fillPrimaryHistos(mcParticle, centrality); } // end of track loop } @@ -1551,7 +1576,8 @@ struct FlowSP { if (cfgCentNGlobal) centrality = col.centNGlobal(); - fillEventQA(col, trackSlice); + if (cfgFillQABefore) + fillEventQA(col, filteredTrackSlice); if (trackSlice.size() < 1) { colSelected = false; @@ -1566,9 +1592,9 @@ struct FlowSP { colSelected = false; continue; } - registry.fill(HIST("hEventCount"), evSel_CentCuts); + histos.fill(HIST("hEventCount"), evSel_CentCuts); - fillEventQA(col, trackSlice); + fillEventQA(col, filteredTrackSlice); } // leave reconstructed collision loop @@ -1594,7 +1620,7 @@ struct FlowSP { bool pos = (charge > 0) ? true : false; - fillMCPtHistos(particle, pdgCode); + fillMCPtHistos(particle, pdgCode, centrality); registry.fill(HIST("trackMCGen/before/incl/phi_eta_vtxZ_gen"), particle.phi(), particle.eta(), vtxz); @@ -1607,7 +1633,7 @@ struct FlowSP { if (particle.eta() < -cfgTrackSelsEta || particle.eta() > cfgTrackSelsEta || particle.pt() < cfgTrackSelsPtmin || particle.pt() > cfgTrackSelsPtmax) continue; - fillMCPtHistos(particle, pdgCode); + fillMCPtHistos(particle, pdgCode, centrality); registry.fill(HIST("trackMCGen/after/incl/phi_eta_vtxZ_gen"), particle.phi(), particle.eta(), vtxz); From 9e7df810ddd6b7a586c7ca639ee2cf8facfb2592 Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Tue, 26 Aug 2025 22:29:45 +0200 Subject: [PATCH 208/986] [PWGLF] Add charge information in derived data and QA histogram in analysis task (#12756) --- .../Resonances/f1protonreducedtable.cxx | 9 +- .../Tasks/Resonances/f1protoncorrelation.cxx | 208 ++++++++++++++---- 2 files changed, 169 insertions(+), 48 deletions(-) diff --git a/PWGLF/TableProducer/Resonances/f1protonreducedtable.cxx b/PWGLF/TableProducer/Resonances/f1protonreducedtable.cxx index 842c0e46c82..0f1ea4cdbe7 100644 --- a/PWGLF/TableProducer/Resonances/f1protonreducedtable.cxx +++ b/PWGLF/TableProducer/Resonances/f1protonreducedtable.cxx @@ -751,10 +751,17 @@ struct f1protonreducedtable { continue; // check if the pair is unlike or wrongsign - auto pairsign = 1; + auto pairsign = 100; if (PionCharge.at(i1) * KaonCharge.at(i2) > 0) { qaRegistry.fill(HIST("hInvMassf1Like"), F1Vector.M(), F1Vector.Pt()); pairsign = -1; + } else if (PionCharge.at(i1) * KaonCharge.at(i2) < 0) { + if (KaonCharge.at(i2) > 0) { + pairsign = 1; + } + if (KaonCharge.at(i2) < 0) { + pairsign = 2; + } } ROOT::Math::PtEtaPhiMVector temp(F1Vector.Pt(), F1Vector.Eta(), F1Vector.Phi(), F1Vector.M()); f1resonance.push_back(temp); diff --git a/PWGLF/Tasks/Resonances/f1protoncorrelation.cxx b/PWGLF/Tasks/Resonances/f1protoncorrelation.cxx index af45b89b8da..41a21b66358 100644 --- a/PWGLF/Tasks/Resonances/f1protoncorrelation.cxx +++ b/PWGLF/Tasks/Resonances/f1protoncorrelation.cxx @@ -13,31 +13,51 @@ /// \author sourav kundu /// \since 02/11/2023 +#include "PWGLF/DataModel/ReducedF1ProtonTables.h" + +#include "Common/Core/trackUtilities.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CcdbApi.h" +#include "CommonConstants/PhysicsConstants.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" #include -#include + #include #include +#include #include + #include + #include #include #include -#include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/StepTHn.h" -#include "Common/Core/trackUtilities.h" -#include "PWGLF/DataModel/ReducedF1ProtonTables.h" -#include "CommonConstants/PhysicsConstants.h" - using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::soa; struct f1protoncorrelation { + + double bz = 0.; + double bz2 = 0.; + + // Enable access to the CCDB for the offset and correction constants and save them in dedicated variables. + Service ccdb; + o2::ccdb::CcdbApi ccdbApi; + struct : ConfigurableGroup { + Configurable cfgURL{"cfgURL", "http://alice-ccdb.cern.ch", "Address of the CCDB to browse"}; + Configurable nolaterthan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "Latest acceptable timestamp of creation for the object"}; + } cfgCcdbParam; + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; // PID selection Configurable nsigmaCutTPC{"nsigmacutTPC", 3.0, "Value of the TPC Nsigma cut"}; @@ -70,6 +90,7 @@ struct f1protoncorrelation { ConfigurableAxis configThnAxisKstar{"configThnAxisKstar", {100, 0.0, 1.0}, "#it{k}^{*} (GeV/#it{c})"}; ConfigurableAxis configThnAxisPtProton{"configThnAxisPtProton", {20, 0.0, 4.}, "#it{p}_{T} (GeV/#it{c})"}; ConfigurableAxis configThnAxisNsigma{"configThnAxisNsigma", {90, -9.0, 9.0}, "NsigmaCombined"}; + ConfigurableAxis configThnAxisCharge{"configThnAxisCharge", {5, -2.5, 2.5}, "Charge"}; // mix event bining policy ColumnBinningPolicy colBinningFemto{{CfgVtxBins, CfgMultBins}, true}; @@ -83,31 +104,89 @@ struct f1protoncorrelation { const AxisSpec thnAxisPtProton{configThnAxisPtProton, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec thnAxisKstar{configThnAxisKstar, "#it{k}^{*} (GeV/#it{c})"}; const AxisSpec thnAxisNsigma{configThnAxisNsigma, "NsigmaCombined"}; + const AxisSpec thnAxisCharge{configThnAxisCharge, "Charge"}; // register histograms + histos.add("hPhaseSpaceProtonKaonSame", "hPhaseSpaceProtonKaonSame", kTH2F, {{200, -2.0f, 2.0f}, {360, -4.0 * TMath::Pi(), 4.0 * TMath::Pi()}}); + histos.add("hPhaseSpaceProtonPionSame", "hPhaseSpaceProtonPionSame", kTH2F, {{200, -2.0f, 2.0f}, {360, -4.0 * TMath::Pi(), 4.0 * TMath::Pi()}}); + histos.add("hPhaseSpaceProtonKaonMix", "hPhaseSpaceProtonKaonMix", kTH2F, {{200, -2.0f, 2.0f}, {360, -4.0 * TMath::Pi(), 4.0 * TMath::Pi()}}); + histos.add("hPhaseSpaceProtonPionMix", "hPhaseSpaceProtonPionMix", kTH2F, {{200, -2.0f, 2.0f}, {360, -4.0 * TMath::Pi(), 4.0 * TMath::Pi()}}); histos.add("hNsigmaProtonTPC", "Nsigma Proton TPC distribution", kTH2F, {{100, -5.0f, 5.0f}, {100, 0.0f, 10.0f}}); histos.add("hNsigmaKaonTPC", "Nsigma Kaon TPC distribution", kTH2F, {{100, -5.0f, 5.0f}, {100, 0.0f, 10.0f}}); histos.add("hNsigmaPionTPC", "Nsigma Pion TPC distribution", kTH2F, {{100, -5.0f, 5.0f}, {100, 0.0f, 10.0f}}); histos.add("hNsigmaPionKaonTPC", "Nsigma Pion Kaon TPC correlation", kTH2F, {{100, -5.0f, 5.0f}, {100, -5.0f, 5.0f}}); histos.add("h2SameEventPtCorrelation", "Pt correlation of F1 and proton", kTH3F, {{100, 0.0f, 1.0f}, {100, 0.0, 10.0}, {100, 0.0, 10.0}}); - histos.add("h2SameEventInvariantMassUnlike_mass", "Unlike Sign Invariant mass of f1 same event", kTH3F, {thnAxisKstar, thnAxisPt, thnAxisInvMass}); - histos.add("h2SameEventInvariantMassLike_mass", "Like Sign Invariant mass of f1 same event", kTH3F, {thnAxisKstar, thnAxisPt, thnAxisInvMass}); - histos.add("h2SameEventInvariantMassRot_mass", "Rotational Invariant mass of f1 same event", kTH3F, {thnAxisKstar, thnAxisPt, thnAxisInvMass}); + histos.add("h2SameEventInvariantMassUnlike_mass", "Unlike Sign Invariant mass of f1 same event", kTHnSparseF, {thnAxisKstar, thnAxisPt, thnAxisInvMass, thnAxisCharge}); + histos.add("h2SameEventInvariantMassLike_mass", "Like Sign Invariant mass of f1 same event", kTHnSparseF, {thnAxisKstar, thnAxisPt, thnAxisInvMass, thnAxisCharge}); + histos.add("h2SameEventInvariantMassRot_mass", "Rotational Invariant mass of f1 same event", kTHnSparseF, {thnAxisKstar, thnAxisPt, thnAxisInvMass, thnAxisCharge}); - histos.add("h2MixEventInvariantMassUnlike_mass", "Unlike Sign Invariant mass of f1 mix event", kTH3F, {thnAxisKstar, thnAxisPt, thnAxisInvMass}); - histos.add("h2MixEventInvariantMassLike_mass", "Like Sign Invariant mass of f1 mix event", kTH3F, {thnAxisKstar, thnAxisPt, thnAxisInvMass}); - histos.add("h2MixEventInvariantMassRot_mass", "Rotational Sign Invariant mass of f1 mix event", kTH3F, {thnAxisKstar, thnAxisPt, thnAxisInvMass}); + histos.add("h2MixEventInvariantMassUnlike_mass", "Unlike Sign Invariant mass of f1 mix event", kTHnSparseF, {thnAxisKstar, thnAxisPt, thnAxisInvMass, thnAxisCharge}); + histos.add("h2MixEventInvariantMassLike_mass", "Like Sign Invariant mass of f1 mix event", kTHnSparseF, {thnAxisKstar, thnAxisPt, thnAxisInvMass, thnAxisCharge}); + histos.add("h2MixEventInvariantMassRot_mass", "Rotational Sign Invariant mass of f1 mix event", kTHnSparseF, {thnAxisKstar, thnAxisPt, thnAxisInvMass, thnAxisCharge}); if (fillSparse) { - histos.add("SEMassUnlike", "SEMassUnlike", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisPtProton, thnAxisKstar, thnAxisNsigma}); - histos.add("SEMassLike", "SEMassLike", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisPtProton, thnAxisKstar, thnAxisNsigma}); - histos.add("SEMassRot", "SEMassRot", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisPtProton, thnAxisKstar, thnAxisNsigma}); + histos.add("SEMassUnlike", "SEMassUnlike", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisPtProton, thnAxisKstar, thnAxisNsigma, thnAxisCharge}); + histos.add("SEMassLike", "SEMassLike", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisPtProton, thnAxisKstar, thnAxisNsigma, thnAxisCharge}); + histos.add("SEMassRot", "SEMassRot", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisPtProton, thnAxisKstar, thnAxisNsigma, thnAxisCharge}); + + histos.add("MEMassUnlike", "MEMassUnlike", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisPtProton, thnAxisKstar, thnAxisNsigma, thnAxisCharge}); + histos.add("MEMassLike", "MEMassLike", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisPtProton, thnAxisKstar, thnAxisNsigma, thnAxisCharge}); + histos.add("MEMassRot", "MEMassRot", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisPtProton, thnAxisKstar, thnAxisNsigma, thnAxisCharge}); + } + + ccdb->setURL(cfgCcdbParam.cfgURL); + ccdbApi.init("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + } + + int getMagneticField(uint64_t timestamp) + { + // Get the magnetic field + static o2::parameters::GRPMagField* grpo = nullptr; + if (grpo == nullptr) { + grpo = ccdb->getForTimeStamp("/GLO/Config/GRPMagField", timestamp); + if (grpo == nullptr) { + LOGF(fatal, "GRP object not found for timestamp %llu", timestamp); + return 0; + } + LOGF(info, "Retrieved GRP for timestamp %llu with magnetic field of %2.2f kG", timestamp, 0.1 * grpo->getNominalL3Field()); + } + return 0.1 * grpo->getNominalL3Field(); + } + + /// Magnetic field to be provided in Tesla + static constexpr float tmpRadiiTPC[9] = {85., 105., 125., 145., 165., 185., 205., 225., 245.}; + float PhiAtSpecificRadiiTPC(const TLorentzVector part1, const TLorentzVector part2, float charge1 = 0, int charge2 = 0, float magfield1 = 0.0, float magfield2 = 0.0) + { + float pt1 = part1.Pt(); + float phi1 = part1.Phi(); + float value1 = 0.0; + float count1 = 0.0; + for (size_t i = 0; i < 9; i++) { + auto arg1 = 0.3 * charge1 * magfield1 * tmpRadiiTPC[i] * 0.01 / (2. * pt1); + if (std::fabs(arg1) < 1) { + value1 = value1 + (phi1 - std::asin(arg1)); + count1 = count1 + 1.0; + } + } + value1 = value1 / count1; - histos.add("MEMassUnlike", "MEMassUnlike", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisPtProton, thnAxisKstar, thnAxisNsigma}); - histos.add("MEMassLike", "MEMassLike", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisPtProton, thnAxisKstar, thnAxisNsigma}); - histos.add("MEMassRot", "MEMassRot", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisPtProton, thnAxisKstar, thnAxisNsigma}); + float pt2 = part2.Pt(); + float phi2 = part2.Phi(); + float value2 = 0.0; + float count2 = 0.0; + for (size_t i = 0; i < 9; i++) { + auto arg2 = 0.3 * charge2 * magfield2 * tmpRadiiTPC[i] * 0.01 / (2. * pt2); + if (std::fabs(arg2) < 1) { + value2 = value2 + (phi2 - std::asin(arg2)); + count2 = count2 + 1.0; + } } + value2 = value2 / count2; + return value1 - value2; } // get kstar @@ -136,8 +215,21 @@ struct f1protoncorrelation { TLorentzVector F1, Proton, F1ProtonPair, Pion, Kaon, Kshort; TLorentzVector F1Rot, PionRot, KaonKshortPair, KaonKshortPairRot; // Process the data in same event - void process(aod::RedF1PEvents::iterator const& /*collision*/, aod::F1Tracks const& f1tracks, aod::ProtonTracks const& protontracks) + + int currentRunNumber = -999; + int lastRunNumber = -999; + + void process(aod::RedF1PEvents::iterator const& collision, aod::F1Tracks const& f1tracks, aod::ProtonTracks const& protontracks) { + + // auto bc = collision.template bc_as(); + // currentRunNumber = collision.bc_as().runNumber(); + currentRunNumber = collision.runNumber(); + if (currentRunNumber != lastRunNumber) { + bz = getMagneticField(collision.timestamp()); + } + lastRunNumber = currentRunNumber; + for (auto f1track : f1tracks) { if (f1track.f1MassKaonKshort() > maxKKS0Mass) { continue; @@ -207,16 +299,24 @@ struct f1protoncorrelation { histos.fill(HIST("hNsigmaProtonTPC"), protontrack.protonNsigmaTPC(), Proton.Pt()); } histos.fill(HIST("h2SameEventPtCorrelation"), relative_momentum, F1.Pt(), Proton.Pt()); - if (f1track.f1SignalStat() == 1) { - histos.fill(HIST("h2SameEventInvariantMassUnlike_mass"), relative_momentum, F1.Pt(), F1.M()); // F1 sign = 1 unlike, F1 sign = -1 like + if (f1track.f1SignalStat() > 0) { + int f1Charge = f1track.f1SignalStat(); + if (f1Charge == 2) { + f1Charge = -1; + } + int pionCharge = -1.0 * f1Charge; + float pairCharge = f1Charge * protontrack.protonCharge(); + histos.fill(HIST("hPhaseSpaceProtonKaonSame"), Proton.Eta() - Kaon.Eta(), PhiAtSpecificRadiiTPC(Proton, Kaon, protontrack.protonCharge(), f1Charge, bz, bz)); // Phase Space Proton kaon + histos.fill(HIST("hPhaseSpaceProtonPionSame"), Proton.Eta() - Kaon.Eta(), PhiAtSpecificRadiiTPC(Proton, Pion, protontrack.protonCharge(), pionCharge, bz, bz)); // Phase Space Proton Pion + histos.fill(HIST("h2SameEventInvariantMassUnlike_mass"), relative_momentum, F1.Pt(), F1.M(), pairCharge); // F1 sign = 1 unlike, F1 sign = -1 like if (fillSparse) { - histos.fill(HIST("SEMassUnlike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC); + histos.fill(HIST("SEMassUnlike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC, pairCharge); } } if (f1track.f1SignalStat() == -1) { - histos.fill(HIST("h2SameEventInvariantMassLike_mass"), relative_momentum, F1.Pt(), F1.M()); + histos.fill(HIST("h2SameEventInvariantMassLike_mass"), relative_momentum, F1.Pt(), F1.M(), protontrack.protonCharge()); if (fillSparse) { - histos.fill(HIST("SEMassLike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC); + histos.fill(HIST("SEMassLike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC, protontrack.protonCharge()); } } if (fillRotation) { @@ -230,10 +330,10 @@ struct f1protoncorrelation { KaonKshortPairRot.SetXYZM(rotKKPx, rotKKPy, KaonKshortPair.Pz(), KaonKshortPair.M()); F1Rot = Pion + KaonKshortPairRot; auto relative_momentum_rot = getkstar(F1Rot, Proton); - if (f1track.f1SignalStat() == 1) { - histos.fill(HIST("h2SameEventInvariantMassRot_mass"), relative_momentum_rot, F1Rot.Pt(), F1Rot.M()); + if (f1track.f1SignalStat() > 0) { + histos.fill(HIST("h2SameEventInvariantMassRot_mass"), relative_momentum_rot, F1Rot.Pt(), F1Rot.M(), protontrack.protonCharge()); if (fillSparse) { - histos.fill(HIST("SEMassRot"), F1Rot.M(), F1Rot.Pt(), Proton.Pt(), relative_momentum_rot, combinedTPC); + histos.fill(HIST("SEMassRot"), F1Rot.M(), F1Rot.Pt(), Proton.Pt(), relative_momentum_rot, combinedTPC, protontrack.protonCharge()); } } } @@ -317,16 +417,16 @@ struct f1protoncorrelation { continue; } auto relative_momentum = getkstar(F1, Proton); - if (t1.f1SignalStat() == 1) { - histos.fill(HIST("h2MixEventInvariantMassUnlike_mass"), relative_momentum, F1.Pt(), F1.M()); // F1 sign = 1 unlike, F1 sign = -1 like + if (t1.f1SignalStat() > 0) { + histos.fill(HIST("h2MixEventInvariantMassUnlike_mass"), relative_momentum, F1.Pt(), F1.M(), 1.0); // F1 sign = 1 unlike, F1 sign = -1 like if (fillSparse) { - histos.fill(HIST("MEMassUnlike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC); + histos.fill(HIST("MEMassUnlike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC, 1.0); } } if (t1.f1SignalStat() == -1) { - histos.fill(HIST("h2MixEventInvariantMassLike_mass"), relative_momentum, F1.Pt(), F1.M()); + histos.fill(HIST("h2MixEventInvariantMassLike_mass"), relative_momentum, F1.Pt(), F1.M(), 1.0); if (fillSparse) { - histos.fill(HIST("MEMassLike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC); + histos.fill(HIST("MEMassLike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC, 1.0); } } if (fillRotation) { @@ -340,10 +440,10 @@ struct f1protoncorrelation { KaonKshortPairRot.SetXYZM(rotKKPx, rotKKPy, KaonKshortPair.Pz(), KaonKshortPair.M()); F1Rot = Pion + KaonKshortPairRot; auto relative_momentum_rot = getkstar(F1Rot, Proton); - if (t1.f1SignalStat() == 1) { - histos.fill(HIST("h2MixEventInvariantMassRot_mass"), relative_momentum_rot, F1Rot.Pt(), F1Rot.M()); + if (t1.f1SignalStat() > 0) { + histos.fill(HIST("h2MixEventInvariantMassRot_mass"), relative_momentum_rot, F1Rot.Pt(), F1Rot.M(), 1.0); if (fillSparse) { - histos.fill(HIST("MEMassRot"), F1Rot.M(), F1Rot.Pt(), Proton.Pt(), relative_momentum_rot, combinedTPC); + histos.fill(HIST("MEMassRot"), F1Rot.M(), F1Rot.Pt(), Proton.Pt(), relative_momentum_rot, combinedTPC, 1.0); } } } @@ -360,6 +460,12 @@ struct f1protoncorrelation { if (collision1.index() == collision2.index()) { continue; } + currentRunNumber = collision1.runNumber(); + if (currentRunNumber != lastRunNumber) { + bz = getMagneticField(collision1.timestamp()); + bz2 = getMagneticField(collision2.timestamp()); + } + lastRunNumber = currentRunNumber; auto groupF1 = f1tracks.sliceBy(tracksPerCollisionPresliceF1, collision1.globalIndex()); auto groupProton = protontracks.sliceBy(tracksPerCollisionPresliceP, collision2.globalIndex()); // auto groupF1 = f1tracks.sliceByCached(aod::f1protondaughter::redF1PEventId, collision1.globalIndex(), cache); @@ -419,16 +525,24 @@ struct f1protoncorrelation { continue; } auto relative_momentum = getkstar(F1, Proton); - if (t1.f1SignalStat() == 1) { - histos.fill(HIST("h2MixEventInvariantMassUnlike_mass"), relative_momentum, F1.Pt(), F1.M()); // F1 sign = 1 unlike, F1 sign = -1 like + if (t1.f1SignalStat() > 0) { + int f1Charge = t1.f1SignalStat(); + if (f1Charge == 2) { + f1Charge = -1; + } + int pionCharge = -1.0 * f1Charge; + float pairCharge = f1Charge * t2.protonCharge(); + histos.fill(HIST("h2MixEventInvariantMassUnlike_mass"), relative_momentum, F1.Pt(), F1.M(), pairCharge); // F1 sign = 1 unlike, F1 sign = -1 like + histos.fill(HIST("hPhaseSpaceProtonKaonMix"), Proton.Eta() - Kaon.Eta(), PhiAtSpecificRadiiTPC(Proton, Kaon, t2.protonCharge(), f1Charge, bz, bz2)); // Phase Space Proton kaon + histos.fill(HIST("hPhaseSpaceProtonPionMix"), Proton.Eta() - Kaon.Eta(), PhiAtSpecificRadiiTPC(Proton, Pion, t2.protonCharge(), pionCharge, bz, bz2)); // Phase Space Proton Pion if (fillSparse) { - histos.fill(HIST("MEMassUnlike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC); + histos.fill(HIST("MEMassUnlike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC, pairCharge); } } if (t1.f1SignalStat() == -1) { - histos.fill(HIST("h2MixEventInvariantMassLike_mass"), relative_momentum, F1.Pt(), F1.M()); + histos.fill(HIST("h2MixEventInvariantMassLike_mass"), relative_momentum, F1.Pt(), F1.M(), t2.protonCharge()); if (fillSparse) { - histos.fill(HIST("MEMassLike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC); + histos.fill(HIST("MEMassLike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC, t2.protonCharge()); } } if (fillRotation) { @@ -442,10 +556,10 @@ struct f1protoncorrelation { KaonKshortPairRot.SetXYZM(rotKKPx, rotKKPy, KaonKshortPair.Pz(), KaonKshortPair.M()); F1Rot = Pion + KaonKshortPairRot; auto relative_momentum_rot = getkstar(F1Rot, Proton); - if (t1.f1SignalStat() == 1) { - histos.fill(HIST("h2MixEventInvariantMassRot_mass"), relative_momentum_rot, F1Rot.Pt(), F1Rot.M()); + if (t1.f1SignalStat() > 0) { + histos.fill(HIST("h2MixEventInvariantMassRot_mass"), relative_momentum_rot, F1Rot.Pt(), F1Rot.M(), t2.protonCharge()); if (fillSparse) { - histos.fill(HIST("MEMassRot"), F1Rot.M(), F1Rot.Pt(), Proton.Pt(), relative_momentum_rot, combinedTPC); + histos.fill(HIST("MEMassRot"), F1Rot.M(), F1Rot.Pt(), Proton.Pt(), relative_momentum_rot, combinedTPC, t2.protonCharge()); } } } From ff658d95f5db24ec512e94d4ce6ed628919d4657 Mon Sep 17 00:00:00 2001 From: Mario Ciacco Date: Tue, 26 Aug 2025 23:33:38 +0200 Subject: [PATCH 209/986] [PWGLF] add switch to count only negative tracks (#12754) --- PWGLF/TableProducer/Nuspex/ebyeMaker.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/ebyeMaker.cxx b/PWGLF/TableProducer/Nuspex/ebyeMaker.cxx index bdb0c4a2058..9f01ecdb1a5 100644 --- a/PWGLF/TableProducer/Nuspex/ebyeMaker.cxx +++ b/PWGLF/TableProducer/Nuspex/ebyeMaker.cxx @@ -201,6 +201,7 @@ struct EbyeMaker { Configurable etaMaxV0dau{"etaMaxV0dau", 0.8f, "maximum eta V0 daughters"}; Configurable outerPIDMin{"outerPIDMin", -4.f, "minimum outer PID"}; + Configurable countOnlyNegTrk{"countOnlyNegTrk", false, "count only negative tracks in Ntracks"}; Configurable useAllEvSel{"useAllEvSel", false, "use additional event selections fo run 3 analyses"}; Configurable triggerCut{"triggerCut", 0x0, "trigger cut to select"}; Configurable kINT7Intervals{"kINT7Intervals", false, "toggle kINT7 trigger selection in the 10-30% and 50-90% centrality intervals (2018 Pb-Pb)"}; @@ -256,7 +257,6 @@ struct EbyeMaker { Configurable antidItsClsSizeCut{"antidItsClsSizeCut", 1.e-10f, "cluster size cut for antideuterons"}; Configurable antidPtItsClsSizeCut{"antidPtItsClsSizeCut", 10.f, "pt for cluster size cut for antideuterons"}; - Configurable trklEtaMax{"trklEtaMax", 0.8f, "maximum eta for run 2 tracklets"}; Configurable> cfgTrackSels{"cfgTrackSels", {kTrackSels, 1, 12, particleName, trackSelsNames}, "Track selections"}; std::array ptMin; @@ -553,9 +553,9 @@ struct EbyeMaker { std::array dcaInfo; for (const auto& track : tracks) { - if (track.trackType() == o2::aod::track::TrackTypeEnum::Run2Tracklet && std::abs(track.eta()) < trklEtaMax && !(doprocessRun3 || doprocessMcRun3)) { // tracklet + if (track.trackType() == o2::aod::track::TrackTypeEnum::Run2Tracklet && std::abs(track.eta()) < etaMax && !(doprocessRun3 || doprocessMcRun3)) { // tracklet nTrackletsColl++; - } else if (std::abs(track.eta()) < trklEtaMax && track.itsNCls() > 3 && (doprocessRun3 || doprocessMcRun3)) { // ITS only + global tracks + } else if (std::abs(track.eta()) < etaMax && track.itsNCls() > 3 && (doprocessRun3 || doprocessMcRun3)) { // ITS only + global tracks nTrackletsColl++; } if (!selectTrack(track)) { @@ -571,7 +571,7 @@ struct EbyeMaker { continue; } histos.fill(HIST("QA/tpcSignal"), track.tpcInnerParam(), track.tpcSignal()); - if (trackPt > ptMin[0] && trackPt < ptMax[0]) + if (trackPt > ptMin[0] && trackPt < ptMax[0] && ((track.sign() < 0 && countOnlyNegTrk) || !countOnlyNegTrk)) nTracksColl++; for (int iP{0}; iP < kNpart; ++iP) { From d7f1beffccd22202f10512fc4aff21159a72348e Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Wed, 27 Aug 2025 00:38:33 +0200 Subject: [PATCH 210/986] [PWGEM/Dilepton] fix in taggingHFE.cxx (#12757) --- PWGEM/Dilepton/Tasks/taggingHFE.cxx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/PWGEM/Dilepton/Tasks/taggingHFE.cxx b/PWGEM/Dilepton/Tasks/taggingHFE.cxx index 82df9228503..4ff5224cde5 100644 --- a/PWGEM/Dilepton/Tasks/taggingHFE.cxx +++ b/PWGEM/Dilepton/Tasks/taggingHFE.cxx @@ -818,8 +818,9 @@ struct taggingHFE { eLpair.ptepv = trackParCov.getPt(); eLpair.dca3dinsigma = dca3DinSigma; - const std::array vertex = {v0.x(), v0.y(), v0.z()}; - const std::array momentum = {v0.px(), v0.py(), v0.pz()}; + const std::array vertex = {collision.posX(), collision.posY(), collision.posZ()}; + const std::array vertexV0 = {v0.x(), v0.y(), v0.z()}; + const std::array momV0 = {v0.px(), v0.py(), v0.pz()}; std::array covV0 = {0.f}; constexpr int MomInd[6] = {9, 13, 14, 18, 19, 20}; // cov matrix elements for momentum component @@ -828,7 +829,7 @@ struct taggingHFE { covV0[i] = v0.positionCovMat()[i]; } - auto v0ParCov = o2::track::TrackParCov(vertex, momentum, covV0, 0, true); + auto v0ParCov = o2::track::TrackParCov(vertexV0, momV0, covV0, 0, true); v0ParCov.setAbsCharge(0); v0ParCov.setPID(o2::track::PID::Lambda); @@ -887,8 +888,9 @@ struct taggingHFE { eCascPair.ptepv = trackParCov.getPt(); eCascPair.dca3dinsigma = dca3DinSigma; - const std::array vertex = {cascade.x(), cascade.y(), cascade.z()}; - const std::array momentum = {cascade.px(), cascade.py(), cascade.pz()}; + const std::array vertex = {collision.posX(), collision.posY(), collision.posZ()}; + const std::array vertexCasc = {cascade.x(), cascade.y(), cascade.z()}; + const std::array momCasc = {cascade.px(), cascade.py(), cascade.pz()}; std::array covCasc = {0.}; constexpr int MomInd[6] = {9, 13, 14, 18, 19, 20}; // cov matrix elements for momentum component @@ -897,7 +899,7 @@ struct taggingHFE { covCasc[i] = cascade.positionCovMat()[i]; } - auto cascParCov = o2::track::TrackParCov(vertex, momentum, covCasc, cascade.sign(), true); + auto cascParCov = o2::track::TrackParCov(vertexCasc, momCasc, covCasc, cascade.sign(), true); cascParCov.setAbsCharge(1); if constexpr (cascType == 0) { cascParCov.setPID(o2::track::PID::XiMinus); From bf1dbbbe5e503eea3aa63a46265b0c9ade14a0ec Mon Sep 17 00:00:00 2001 From: yuanzhe <90246048+wang-yuanzhe@users.noreply.github.com> Date: Wed, 27 Aug 2025 01:34:25 +0200 Subject: [PATCH 211/986] [PWGLF] Update datamodel for hypertriton kink analysis (#12751) --- PWGLF/DataModel/LFHyperNucleiKinkTables.h | 5 +++++ .../TableProducer/Nuspex/hyperkinkRecoTask.cxx | 18 ++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/PWGLF/DataModel/LFHyperNucleiKinkTables.h b/PWGLF/DataModel/LFHyperNucleiKinkTables.h index bf69266a484..f36cc896ed8 100644 --- a/PWGLF/DataModel/LFHyperNucleiKinkTables.h +++ b/PWGLF/DataModel/LFHyperNucleiKinkTables.h @@ -47,6 +47,9 @@ DECLARE_SOA_COLUMN(DcaKinkTopo, dcaKinkTopo, float); //! DCA DECLARE_SOA_COLUMN(ItsChi2Moth, itsChi2Moth, float); //! ITS chi2 of the mother track DECLARE_SOA_COLUMN(ItsClusterSizesMoth, itsClusterSizesMoth, uint32_t); //! ITS cluster size of the mother track DECLARE_SOA_COLUMN(ItsClusterSizesDaug, itsClusterSizesDaug, uint32_t); //! ITS cluster size of the daughter track +DECLARE_SOA_COLUMN(TpcMomDaug, tpcMomDaug, float); //! TPC momentum of the daughter track +DECLARE_SOA_COLUMN(TpcSignalDaug, tpcSignalDaug, float); //! TPC signal of the daughter track +DECLARE_SOA_COLUMN(TpcNClsPIDDaug, tpcNClsPIDDaug, int16_t); //! Number of TPC clusters used for PID of the daughter track DECLARE_SOA_COLUMN(NSigmaTPCDaug, nSigmaTPCDaug, float); //! Number of tpc sigmas of the daughter track DECLARE_SOA_COLUMN(NSigmaITSDaug, nSigmaITSDaug, float); //! Number of ITS sigmas of the daughter track DECLARE_SOA_COLUMN(NSigmaTOFDaug, nSigmaTOFDaug, float); //! Number of TOF sigmas of the daughter track @@ -87,6 +90,7 @@ DECLARE_SOA_TABLE(HypKinkCand, "AOD", "HYPKINKCANDS", hyperkink::PxDaugSV, hyperkink::PyDaugSV, hyperkink::PzDaugSV, hyperkink::DcaMothPv, hyperkink::DcaDaugPv, hyperkink::DcaKinkTopo, hyperkink::ItsChi2Moth, hyperkink::ItsClusterSizesMoth, hyperkink::ItsClusterSizesDaug, + hyperkink::TpcMomDaug, hyperkink::TpcSignalDaug, hyperkink::TpcNClsPIDDaug, hyperkink::NSigmaTPCDaug, hyperkink::NSigmaITSDaug, hyperkink::NSigmaTOFDaug, hyperkink::PxMothPV, hyperkink::PyMothPV, hyperkink::PzMothPV, hyperkink::UpdatePxMothPV, hyperkink::UpdatePyMothPV, hyperkink::UpdatePzMothPV); @@ -102,6 +106,7 @@ DECLARE_SOA_TABLE(MCHypKinkCand, "AOD", "MCHYPKINKCANDS", hyperkink::PxDaugSV, hyperkink::PyDaugSV, hyperkink::PzDaugSV, hyperkink::DcaMothPv, hyperkink::DcaDaugPv, hyperkink::DcaKinkTopo, hyperkink::ItsChi2Moth, hyperkink::ItsClusterSizesMoth, hyperkink::ItsClusterSizesDaug, + hyperkink::TpcMomDaug, hyperkink::TpcSignalDaug, hyperkink::TpcNClsPIDDaug, hyperkink::NSigmaTPCDaug, hyperkink::NSigmaITSDaug, hyperkink::NSigmaTOFDaug, hyperkink::IsSignal, hyperkink::IsSignalReco, hyperkink::IsCollReco, hyperkink::IsSurvEvSelection, hyperkink::TrueXSV, hyperkink::TrueYSV, hyperkink::TrueZSV, diff --git a/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx b/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx index 91245203c71..ef26c0f7b06 100644 --- a/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx @@ -336,6 +336,9 @@ struct HypKinkCandidate { float chi2ITSMoth = 0.0f; uint32_t itsClusterSizeMoth = 0u; uint32_t itsClusterSizeDaug = 0u; + float tpcMomDaug = -999.f; + float tpcSignalDaug = -999.f; + int16_t tpcNClsPIDDaug = 0u; float nSigmaTPCDaug = -999.f; float nSigmaITSDaug = -999.f; float nSigmaTOFDaug = -999.f; // recalculated TOF NSigma @@ -555,6 +558,9 @@ struct HyperkinkRecoTask { fillCandidateRecoMoth(hypkinkCand, collision, trackMoth); hypkinkCand.itsClusterSizeDaug = trackDaug.itsClusterSizes(); + hypkinkCand.tpcMomDaug = trackDaug.tpcInnerParam() * trackDaug.sign(); + hypkinkCand.tpcSignalDaug = trackDaug.tpcSignal(); + hypkinkCand.tpcNClsPIDDaug = trackDaug.tpcNClsPID(); hypkinkCand.nSigmaTPCDaug = getTPCNSigma(trackDaug, pidTypeDaug); hypkinkCand.nSigmaITSDaug = getITSNSigma(trackDaug, itsResponse, pidTypeDaug); @@ -641,10 +647,7 @@ struct HyperkinkRecoTask { if (std::abs(tpcNSigmaDaug) > cutTPCNSigmaDaug) { continue; } - float invMass = RecoDecay::m(std::array{std::array{kinkCand.pxDaug(), kinkCand.pyDaug(), kinkCand.pzDaug()}, std::array{kinkCand.pxDaugNeut(), kinkCand.pyDaugNeut(), kinkCand.pzDaugNeut()}}, std::array{massChargedDaug, massNeutralDaug}); registry.fill(HIST("hCandidateCounter"), 2); - registry.fill(HIST("h2MothMassPt"), kinkCand.mothSign() * kinkCand.ptMoth(), invMass); - registry.fill(HIST("h2DaugTPCNSigmaPt"), kinkCand.mothSign() * kinkCand.ptDaug(), tpcNSigmaDaug); auto bc = collision.bc_as(); initCCDB(bc); @@ -683,6 +686,10 @@ struct HyperkinkRecoTask { } registry.fill(HIST("hCandidateCounter"), 7); + float invMass = RecoDecay::m(std::array{std::array{kinkCand.pxDaug(), kinkCand.pyDaug(), kinkCand.pzDaug()}, std::array{kinkCand.pxDaugNeut(), kinkCand.pyDaugNeut(), kinkCand.pzDaugNeut()}}, std::array{massChargedDaug, massNeutralDaug}); + registry.fill(HIST("h2MothMassPt"), kinkCand.mothSign() * kinkCand.ptMoth(), invMass); + registry.fill(HIST("h2DaugTPCNSigmaPt"), kinkCand.mothSign() * kinkCand.ptDaug(), tpcNSigmaDaug); + HypKinkCandidate hypkinkCand; fillCandidate(hypkinkCand, collision, kinkCand, motherTrack, daugTrack); hypkinkCand.nSigmaTOFDaug = nSigmaTOF; @@ -697,6 +704,7 @@ struct HyperkinkRecoTask { hypkinkCand.momDaugSV[0], hypkinkCand.momDaugSV[1], hypkinkCand.momDaugSV[2], hypkinkCand.dcaXYMothPv, hypkinkCand.dcaXYDaugPv, hypkinkCand.dcaKinkTopo, hypkinkCand.chi2ITSMoth, hypkinkCand.itsClusterSizeMoth, hypkinkCand.itsClusterSizeDaug, + hypkinkCand.tpcMomDaug, hypkinkCand.tpcSignalDaug, hypkinkCand.tpcNClsPIDDaug, hypkinkCand.nSigmaTPCDaug, hypkinkCand.nSigmaITSDaug, hypkinkCand.nSigmaTOFDaug, hypkinkCand.momMothPV[0], hypkinkCand.momMothPV[1], hypkinkCand.momMothPV[2], hypkinkCand.updateMomMothPV[0], hypkinkCand.updateMomMothPV[1], hypkinkCand.updateMomMothPV[2]); @@ -766,7 +774,6 @@ struct HyperkinkRecoTask { if (std::abs(tpcNSigmaDaug) > cutTPCNSigmaDaug) { continue; } - float invMass = RecoDecay::m(std::array{std::array{kinkCand.pxDaug(), kinkCand.pyDaug(), kinkCand.pzDaug()}, std::array{kinkCand.pxDaugNeut(), kinkCand.pyDaugNeut(), kinkCand.pzDaugNeut()}}, std::array{massChargedDaug, massNeutralDaug}); registry.fill(HIST("hCandidateCounter"), 2); if (isKinkSignal) { registry.fill(HIST("hTrueCandidateCounter"), 2); @@ -831,6 +838,7 @@ struct HyperkinkRecoTask { registry.fill(HIST("hTrueCandidateCounter"), 7); } + float invMass = RecoDecay::m(std::array{std::array{kinkCand.pxDaug(), kinkCand.pyDaug(), kinkCand.pzDaug()}, std::array{kinkCand.pxDaugNeut(), kinkCand.pyDaugNeut(), kinkCand.pzDaugNeut()}}, std::array{massChargedDaug, massNeutralDaug}); registry.fill(HIST("h2MothMassPt"), kinkCand.mothSign() * kinkCand.ptMoth(), invMass); registry.fill(HIST("h2DaugTPCNSigmaPt"), kinkCand.mothSign() * kinkCand.ptDaug(), tpcNSigmaDaug); @@ -897,6 +905,7 @@ struct HyperkinkRecoTask { hypkinkCand.momDaugSV[0], hypkinkCand.momDaugSV[1], hypkinkCand.momDaugSV[2], hypkinkCand.dcaXYMothPv, hypkinkCand.dcaXYDaugPv, hypkinkCand.dcaKinkTopo, hypkinkCand.chi2ITSMoth, hypkinkCand.itsClusterSizeMoth, hypkinkCand.itsClusterSizeDaug, + hypkinkCand.tpcMomDaug, hypkinkCand.tpcSignalDaug, hypkinkCand.tpcNClsPIDDaug, hypkinkCand.nSigmaTPCDaug, hypkinkCand.nSigmaITSDaug, hypkinkCand.nSigmaTOFDaug, hypkinkCand.isSignal, hypkinkCand.isSignalReco, hypkinkCand.isCollReco, hypkinkCand.isSurvEvSelection, hypkinkCand.truePosSV[0], hypkinkCand.truePosSV[1], hypkinkCand.truePosSV[2], @@ -955,6 +964,7 @@ struct HyperkinkRecoTask { -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, true, false, isReconstructedMCCollisions[mcparticle.mcCollisionId()], isSelectedMCCollisions[mcparticle.mcCollisionId()], hypkinkCand.truePosSV[0], hypkinkCand.truePosSV[1], hypkinkCand.truePosSV[2], hypkinkCand.trueMomMothPV[0], hypkinkCand.trueMomMothPV[1], hypkinkCand.trueMomMothPV[2], From cbd9ed81f767bf445adc0bb61d107e3eefad2a7b Mon Sep 17 00:00:00 2001 From: JimunLee Date: Wed, 27 Aug 2025 16:22:43 +0900 Subject: [PATCH 212/986] [PWGLF] Fixed code issues about Reconstruction of KstarInOO.cxx (#12693) Co-authored-by: jimun_lee --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 228 +++++++++++++++++---------- 1 file changed, 144 insertions(+), 84 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index d17c9e87110..e91bfb19251 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -80,7 +80,7 @@ struct kstarInOO { Configurable cfgTrackMaxDCAzToPVcut{"cfgTrackMaxDCAzToPVcut", 2.0, "Track DCAz cut to PV Maximum"}; Configurable cfgTrackPrimaryTrack{"cfgTrackPrimaryTrack", true, "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz Configurable cfgTrackConnectedToPV{"cfgTrackConnectedToPV", true, "PV contributor track selection"}; // PV Contriuibutor - Configurable cfgGlobalTrack{"cfgGlobalTrack", false, "Global track selection"}; // kGoldenChi2 | kDCAxy | kDCAz + Configurable cfgGlobalTrack{"cfgGlobalTrack", true, "Global track selection"}; // kGoldenChi2 | kDCAxy | kDCAz Configurable cfgTrackGlobalWoDCATrack{"cfgTrackGlobalWoDCATrack", true, "Global track selection without DCA"}; // kQualityTracks (kTrackType | kTPCNCls | kTPCCrossedRows | kTPCCrossedRowsOverNCls | kTPCChi2NDF | kTPCRefit | kITSNCls | kITSChi2NDF | kITSRefit | kITSHits) | kInAcceptanceTracks (kPtRange | kEtaRange) // TPC Configurable cfgTracknFindableTPCClusters{"cfgTrackFindableTPCClusters", 50, "nFindable TPC Clusters"}; @@ -114,6 +114,9 @@ struct kstarInOO { Configurable cfgMinvMin{"cfgMinvMin", 0.60, "Minimum Minv value"}; Configurable cfgMinvMax{"cfgMinvMax", 1.20, "Maximum Minv value"}; + ConfigurableAxis binsDCAz{"binsDCAz", {40, -0.2, 0.2}, ""}; + ConfigurableAxis binsDCAxy{"binsDCAxy", {40, -0.2, 0.2}, ""}; + // Histogram Configurable cfgEventCutQA{"cfgEventCutsQA", false, "Enable Event QA Hists"}; Configurable cfgTrackCutQA{"cfgTrackCutQA", false, "Enable Track QA Hists"}; @@ -128,37 +131,54 @@ struct kstarInOO { const AxisSpec ptAxis = {200, 0, 20.0}; const AxisSpec pidAxis = {120, -6, 6}; const AxisSpec minvAxis = {cfgMinvNBins, cfgMinvMin, cfgMinvMax}; + const AxisSpec axisDCAz{binsDCAz, "DCA_{z}"}; + const AxisSpec axisDCAxy{binsDCAxy, "DCA_{XY}"}; if (cfgEventCutQA) { - histos.add("hPosZ_BC", "hPosZ_Bc", kTH1F, {{100, 0.0, 15.0}}); - histos.add("hPosZ_AC", "hPosZ_AC", kTH1F, {{100, 0.0, 15.0}}); + histos.add("hPosZ_BC", "hPosZ_Bc", kTH1F, {{300, -15.0, 15.0}}); + histos.add("hPosZ_AC", "hPosZ_AC", kTH1F, {{300, -15.0, 15.0}}); + histos.add("hcentFT0C_BC", "centFT0C_BC", kTH1F, {{110, 0.0, 110.0}}); + histos.add("hcentFT0C_AC", "centFT0C_AC", kTH1F, {{110, 0.0, 110.0}}); } if (cfgTrackCutQA) { - // histos.add("h_eta", "h_eta", kTH1F, {axisEta}); - // histos.add("h_phi", "h_phi", kTH1F, {axisPhi}); - + histos.add("hDCArToPv_BC", "DCArToPv_BC", kTH1F, {axisDCAxy}); + histos.add("hDCAzToPv_BC", "DCAzToPv_BC", kTH1F, {axisDCAz}); + histos.add("hIsPrim_BC", "hIsPrim_BC", kTH1F, {{2, -0.5, 1.5}}); + histos.add("hIsGood_BC", "hIsGood_BC", kTH1F, {{2, -0.5, 1.5}}); + histos.add("hIsPrimCont_BC", "hIsPrimCont_BC", kTH1F, {{2, -0.5, 1.5}}); + histos.add("hFindableTPCClusters_BC", "hFindableTPCClusters_BC", kTH1F, {{200, 0, 200}}); + histos.add("hFindableTPCRows_BC", "hFindableTPCRows_BC", kTH1F, {{200, 0, 200}}); + histos.add("hClustersVsRows_BC", "hClustersVsRows_BC", kTH1F, {{200, 0, 2}}); + histos.add("hTPCChi2_BC", "hTPCChi2_BC", kTH1F, {{200, 0, 100}}); histos.add("QA_nSigma_pion_TPC_BC", "QA_nSigma_pion_TPC_BC", {HistType::kTH2F, {ptAxis, pidAxis}}); histos.add("QA_nSigma_pion_TOF_BC", "QA_nSigma_pion_TOF_BC", {HistType::kTH2F, {ptAxis, pidAxis}}); histos.add("QA_pion_TPC_TOF_BC", "QA_pion_TPC_TOF_BC", {HistType::kTH2F, {pidAxis, pidAxis}}); - - histos.add("QA_nSigma_pion_TPC_AC", "QA_nSigma_pion_TPC_AC", {HistType::kTH2F, {ptAxis, pidAxis}}); - histos.add("QA_nSigma_pion_TOF_AC", "QA_nSigma_pion_TOF_AC", {HistType::kTH2F, {ptAxis, pidAxis}}); - histos.add("QA_pion_TPC_TOF_AC", "QA_pion_TPC_TOF_AC", {HistType::kTH2F, {pidAxis, pidAxis}}); - histos.add("QA_nSigma_kaon_TPC_BC", "QA_nSigma_kaon_TPC_BC", {HistType::kTH2F, {ptAxis, pidAxis}}); histos.add("QA_nSigma_kaon_TOF_BC", "QA_nSigma_kaon_TOF_BC", {HistType::kTH2F, {ptAxis, pidAxis}}); histos.add("QA_kaon_TPC_TOF_BC", "QA_kaon_TPC_TOF_BC", {HistType::kTH2F, {pidAxis, pidAxis}}); - + histos.add("QA_track_pT_BC", "QA_track_pT_BC", kTH1F, {{13, 0.0, 13.0}}); + + histos.add("hDCArToPv_AC", "DCArToPv_AC", kTH1F, {axisDCAxy}); + histos.add("hDCAzToPv_AC", "DCAzToPv_AC", kTH1F, {axisDCAz}); + histos.add("hIsPrim_AC", "hIsPrim_AC", kTH1F, {{2, -0.5, 1.5}}); + histos.add("hIsGood_AC", "hIsGood_AC", kTH1F, {{2, -0.5, 1.5}}); + histos.add("hIsPrimCont_AC", "hIsPrimCont_AC", kTH1F, {{2, -0.5, 1.5}}); + histos.add("hFindableTPCClusters_AC", "hFindableTPCClusters_AC", kTH1F, {{200, 0, 200}}); + histos.add("hFindableTPCRows_AC", "hFindableTPCRows_AC", kTH1F, {{200, 0, 200}}); + histos.add("hClustersVsRows_AC", "hClustersVsRows_AC", kTH1F, {{200, 0, 2}}); + histos.add("hTPCChi2_AC", "hTPCChi2_AC", kTH1F, {{200, 0, 100}}); + histos.add("QA_nSigma_pion_TPC_AC", "QA_nSigma_pion_TPC_AC", {HistType::kTH2F, {ptAxis, pidAxis}}); + histos.add("QA_nSigma_pion_TOF_AC", "QA_nSigma_pion_TOF_AC", {HistType::kTH2F, {ptAxis, pidAxis}}); + histos.add("QA_pion_TPC_TOF_AC", "QA_pion_TPC_TOF_AC", {HistType::kTH2F, {pidAxis, pidAxis}}); histos.add("QA_nSigma_kaon_TPC_AC", "QA_nSigma_kaon_TPC_AC", {HistType::kTH2F, {ptAxis, pidAxis}}); histos.add("QA_nSigma_kaon_TOF_AC", "QA_nSigma_kaon_TOF_AC", {HistType::kTH2F, {ptAxis, pidAxis}}); histos.add("QA_kaon_TPC_TOF_AC", "QA_kaon_TPC_TOF_AC", {HistType::kTH2F, {pidAxis, pidAxis}}); + histos.add("QA_track_pT_AC", "QA_track_pT_AC", kTH1F, {{13, 0.0, 13.0}}); } if (cfgDataHistos) { histos.add("nEvents", "nEvents", kTH1F, {{4, 0.0, 4.0}}); - histos.add("nEvents_Mix", "nEvents_Mix", kTH1F, {{4, 0.0, 4.0}}); - histos.add("hUSS", "hUSS", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); histos.add("hLSS", "hLSS", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); histos.add("hUSS_Mix", "hUSS_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); @@ -167,7 +187,6 @@ struct kstarInOO { if (cfgMcHistos) { histos.add("nEvents_MC", "nEvents_MC", kTH1F, {{4, 0.0, 4.0}}); - histos.add("nEvents_MC_Mix", "nEvents_MC_Mix", kTH1F, {{4, 0.0, 4.0}}); histos.add("nEvents_MC_True", "nEvents_MC_True", kTH1F, {{4, 0.0, 4.0}}); histos.add("hMC_USS", "hMC_USS", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); @@ -177,7 +196,6 @@ struct kstarInOO { histos.add("hMC_USS_True", "hMC_USS_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); histos.add("hMC_kstar_True", "hMC_kstar_True", kTHnSparseF, {cfgCentAxis, ptAxis}); } - } // end of init using EventCandidates = soa::Join; //, aod::CentFT0Ms, aod::CentFT0As @@ -206,11 +224,12 @@ struct kstarInOO { //|| //================================== template - bool eventSelection(const EventType event) + bool eventSelection(const EventType event, const bool QA) { - if (cfgEventCutQA) + if (cfgEventCutQA && QA) { histos.fill(HIST("hPosZ_BC"), event.posZ()); - + histos.fill(HIST("hcentFT0C_BC"), event.centFT0C()); + } if (!event.sel8()) return false; if (std::abs(event.posZ()) > cfgEventVtxCut) @@ -226,67 +245,133 @@ struct kstarInOO { if (!event.selection_bit(aod::evsel::kNoCollInTimeRangeStandard)) return false; - if (cfgEventCutQA) + if (cfgEventCutQA && QA) { histos.fill(HIST("hPosZ_AC"), event.posZ()); - + histos.fill(HIST("hcentFT0C_AC"), event.centFT0C()); + } return true; }; template - bool trackSelection(const TracksType track) + bool trackSelection(const TracksType track, bool QA) { + if (cfgTrackCutQA && QA) { + histos.fill(HIST("hDCArToPv_BC"), track.dcaXY()); + histos.fill(HIST("hDCAzToPv_BC"), track.dcaZ()); + histos.fill(HIST("hIsPrim_BC"), track.isPrimaryTrack()); + histos.fill(HIST("hIsGood_BC"), track.isGlobalTrackWoDCA()); + histos.fill(HIST("hIsPrimCont_BC"), track.isPVContributor()); + histos.fill(HIST("hFindableTPCClusters_BC"), track.tpcNClsFindable()); + histos.fill(HIST("hFindableTPCRows_BC"), track.tpcNClsCrossedRows()); + histos.fill(HIST("hClustersVsRows_BC"), track.tpcCrossedRowsOverFindableCls()); + histos.fill(HIST("hTPCChi2_BC"), track.tpcChi2NCl()); + histos.fill(HIST("QA_track_pT_BC"), track.pt()); + } + if (track.pt() < cfgTrackMinPt) return false; + if (cfgTrackCutQA && QA) { + histos.fill(HIST("QA_track_pT_BC"), track.pt()); + } if (std::abs(track.eta()) > cfgTrackMaxEta) return false; + if (cfgTrackCutQA && QA) { + histos.fill(HIST("QA_track_pT_BC"), track.pt()); + } - if (cfgGlobalTrack && !track.isGlobalTrack()) + if (!cfgGlobalTrack && !track.isGlobalTrack()) return false; + if (cfgTrackCutQA && QA) { + histos.fill(HIST("QA_track_pT_BC"), track.pt()); + } if (std::abs(track.dcaXY()) > cfgTrackMaxDCArToPVcut) return false; + if (cfgTrackCutQA && QA) { + histos.fill(HIST("QA_track_pT_BC"), track.pt()); + } if (std::abs(track.dcaZ()) > cfgTrackMaxDCAzToPVcut) return false; + if (cfgTrackCutQA && QA) { + histos.fill(HIST("QA_track_pT_BC"), track.pt()); + } if (cfgTrackPrimaryTrack && !track.isPrimaryTrack()) return false; + if (cfgTrackCutQA && QA) { + histos.fill(HIST("QA_track_pT_BC"), track.pt()); + } if (cfgTrackGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) return false; + if (cfgTrackCutQA && QA) { + histos.fill(HIST("QA_track_pT_BC"), track.pt()); + } if (track.tpcNClsFindable() < cfgTracknFindableTPCClusters) return false; + if (cfgTrackCutQA && QA) { + histos.fill(HIST("QA_track_pT_BC"), track.pt()); + } if (track.tpcNClsCrossedRows() < cfgTracknTPCCrossedRows) return false; + if (cfgTrackCutQA && QA) { + histos.fill(HIST("QA_track_pT_BC"), track.pt()); + } if (track.tpcCrossedRowsOverFindableCls() > cfgTracknRowsOverFindable) return false; + if (cfgTrackCutQA && QA) { + histos.fill(HIST("QA_track_pT_BC"), track.pt()); + } if (track.tpcChi2NCl() > cfgTracknTPCChi2) return false; + if (cfgTrackCutQA && QA) { + histos.fill(HIST("QA_track_pT_BC"), track.pt()); + } if (track.itsChi2NCl() > cfgTracknITSChi2) return false; + if (cfgTrackCutQA && QA) { + histos.fill(HIST("QA_track_pT_BC"), track.pt()); + } if (cfgTrackConnectedToPV && !track.isPVContributor()) return false; + if (cfgTrackCutQA && QA) { + histos.fill(HIST("QA_track_pT_BC"), track.pt()); + } + if (cfgTrackCutQA && QA) { + histos.fill(HIST("hDCArToPv_AC"), track.dcaXY()); + histos.fill(HIST("hDCAzToPv_AC"), track.dcaZ()); + histos.fill(HIST("hIsPrim_AC"), track.isPrimaryTrack()); + histos.fill(HIST("hIsGood_AC"), track.isGlobalTrackWoDCA()); + histos.fill(HIST("hIsPrimCont_AC"), track.isPVContributor()); + histos.fill(HIST("hFindableTPCClusters_AC"), track.tpcNClsFindable()); + histos.fill(HIST("hFindableTPCRows_AC"), track.tpcNClsCrossedRows()); + histos.fill(HIST("hClustersVsRows_AC"), track.tpcCrossedRowsOverFindableCls()); + histos.fill(HIST("hTPCChi2_AC"), track.tpcChi2NCl()); + histos.fill(HIST("QA_track_pT_AC"), track.pt()); + } return true; }; template - bool trackPIDKaon(const TrackPID& candidate) + bool trackPIDKaon(const TrackPID& candidate, const bool QA) { bool tpcPIDPassed{false}, tofPIDPassed{false}; - // TPC - if (cfgTrackCutQA) { + if (cfgTrackCutQA && QA) { + // kaon histos.fill(HIST("QA_nSigma_kaon_TPC_BC"), candidate.pt(), candidate.tpcNSigmaKa()); histos.fill(HIST("QA_nSigma_kaon_TOF_BC"), candidate.pt(), candidate.tofNSigmaKa()); histos.fill(HIST("QA_kaon_TPC_TOF_BC"), candidate.tpcNSigmaKa(), candidate.tofNSigmaKa()); } + // TPC if (std::abs(candidate.tpcNSigmaKa()) < cfgTrackTPCPIDnSig) tpcPIDPassed = true; @@ -301,7 +386,8 @@ struct kstarInOO { // TPC & TOF if (tpcPIDPassed && tofPIDPassed) { - if (cfgTrackCutQA) { + if (cfgTrackCutQA && QA) { + // kaon histos.fill(HIST("QA_nSigma_kaon_TPC_AC"), candidate.pt(), candidate.tpcNSigmaKa()); histos.fill(HIST("QA_nSigma_kaon_TOF_AC"), candidate.pt(), candidate.tofNSigmaKa()); histos.fill(HIST("QA_kaon_TPC_TOF_AC"), candidate.tpcNSigmaKa(), candidate.tofNSigmaKa()); @@ -312,18 +398,20 @@ struct kstarInOO { } template - bool trackPIDPion(const TrackPID& candidate) + bool trackPIDPion(const TrackPID& candidate, const bool QA) { bool tpcPIDPassed{false}, tofPIDPassed{false}; - // TPC - if (cfgTrackCutQA) { + if (cfgTrackCutQA && QA) { + // pion histos.fill(HIST("QA_nSigma_pion_TPC_BC"), candidate.pt(), candidate.tpcNSigmaPi()); histos.fill(HIST("QA_nSigma_pion_TOF_BC"), candidate.pt(), candidate.tofNSigmaPi()); histos.fill(HIST("QA_pion_TPC_TOF_BC"), candidate.tpcNSigmaPi(), candidate.tofNSigmaPi()); } + + // TPC if (std::abs(candidate.tpcNSigmaPi()) < cfgTrackTPCPIDnSig) tpcPIDPassed = true; - + // TOF if (candidate.hasTOF()) { if (std::abs(candidate.tofNSigmaPi()) < cfgTrackTOFPIDnSig) { tofPIDPassed = true; @@ -334,7 +422,8 @@ struct kstarInOO { // TPC & TOF if (tpcPIDPassed && tofPIDPassed) { - if (cfgTrackCutQA) { + if (cfgTrackCutQA && QA) { + // pion histos.fill(HIST("QA_nSigma_pion_TPC_AC"), candidate.pt(), candidate.tpcNSigmaPi()); histos.fill(HIST("QA_nSigma_pion_TOF_AC"), candidate.pt(), candidate.tofNSigmaPi()); histos.fill(HIST("QA_pion_TPC_TOF_AC"), candidate.tpcNSigmaPi(), candidate.tofNSigmaPi()); @@ -345,20 +434,14 @@ struct kstarInOO { } template - void TrackSlicing(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool IsMix) + void TrackSlicing(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool QA, const bool IsMix) { auto tracks1 = kaon->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); auto tracks2 = pion->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); auto centrality = collision1.centFT0C(); for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - - if (!trackSelection(trk1) || !trackSelection(trk2)) - continue; - if (!trackPIDKaon(trk1) || !trackPIDPion(trk2)) - continue; - - auto [KstarPt, Minv] = minvReconstruction(trk1, trk2); + auto [KstarPt, Minv] = minvReconstruction(trk1, trk2, QA); if (Minv < 0) continue; @@ -382,20 +465,14 @@ struct kstarInOO { } // TrackSlicing template - void TrackSlicingMC(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool IsMix) + void TrackSlicingMC(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool QA, const bool IsMix) { auto tracks1 = kaonMC->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); auto tracks2 = pionMC->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); auto centrality = collision1.centFT0C(); for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - - if (!trackSelection(trk1) || !trackSelection(trk2)) - continue; - if (!trackPIDKaon(trk1) || !trackPIDPion(trk2)) - continue; - - auto [KstarPt, Minv] = minvReconstruction(trk1, trk2); + auto [KstarPt, Minv] = minvReconstruction(trk1, trk2, QA); if (Minv < 0) continue; @@ -420,6 +497,7 @@ struct kstarInOO { // Gen MC if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) continue; + auto particle1 = trk1.mcParticle(); auto particle2 = trk2.mcParticle(); if (std::fabs(particle1.pdgCode()) != 321) @@ -462,14 +540,13 @@ struct kstarInOO { } // TrackSlicingMC template - std::pair minvReconstruction(const TracksType& trk1, const TracksType& trk2) + std::pair minvReconstruction(const TracksType& trk1, const TracksType& trk2, const bool QA) { TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; - if (!trackSelection(trk1) || !trackSelection(trk2)) + if (!trackSelection(trk1, QA) || !trackSelection(trk2, QA)) return {-1.0, -1.0}; - - if (!trackPIDKaon(trk1) || !trackPIDPion(trk2)) + if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA)) return {-1.0, -1.0}; if (trk1.globalIndex() == trk2.globalIndex()) { @@ -502,7 +579,7 @@ struct kstarInOO { } } - auto goodEv = eventSelection(collision); + auto goodEv = eventSelection(collision, true); if (cfgDataHistos) { histos.fill(HIST("nEvents"), 0.5); } @@ -511,17 +588,19 @@ struct kstarInOO { bool INELgt0 = false; for (const auto& track : tracks) { + if (!trackSelection(track, true)) + continue; if (std::fabs(track.eta()) < cfgTrackMaxEta) { INELgt0 = true; - break; } } if (!INELgt0) return; + if (cfgDataHistos) { histos.fill(HIST("nEvents"), 1.5); } - TrackSlicing(collision, tracks, collision, tracks, false); + TrackSlicing(collision, tracks, collision, tracks, true, false); } // processSameEvents PROCESS_SWITCH(kstarInOO, processDataSameEvent, "process Data Same Event", false); @@ -545,19 +624,13 @@ struct kstarInOO { std::cout << "Processed DATA Mixed Events : " << nEventsMix << std::endl; } } - auto goodEv1 = eventSelection(collision1); - auto goodEv2 = eventSelection(collision2); - if (cfgDataHistos) { - histos.fill(HIST("nEvents_Mix"), 0.5); - } + auto goodEv1 = eventSelection(collision1, false); + auto goodEv2 = eventSelection(collision2, false); if (!goodEv1 || !goodEv2) continue; - if (cfgDataHistos) { - histos.fill(HIST("nEvents_Mix"), 1.5); - } - TrackSlicing(collision1, tracks1, collision2, tracks2, true); + TrackSlicing(collision1, tracks1, collision2, tracks2, false, true); } } PROCESS_SWITCH(kstarInOO, processDataMixedEvent, "process DATA Mixed Event", false); @@ -580,7 +653,7 @@ struct kstarInOO { } } - auto goodEv = eventSelection(collision); + auto goodEv = eventSelection(collision, true); if (cfgMcHistos) { histos.fill(HIST("nEvents_MC"), 0.5); } @@ -591,7 +664,6 @@ struct kstarInOO { for (const auto& track : tracks) { if (std::fabs(track.eta()) < cfgTrackMaxEta) { INELgt0 = true; - break; } } if (!INELgt0) @@ -600,10 +672,10 @@ struct kstarInOO { if (cfgMcHistos) { histos.fill(HIST("nEvents_MC"), 1.5); } - TrackSlicingMC(collision, tracks, collision, tracks, false); + TrackSlicingMC(collision, tracks, collision, tracks, true, false); } // processSameEvents_MC - PROCESS_SWITCH(kstarInOO, processMCSameEvent, "process MC Same Event", false); + PROCESS_SWITCH(kstarInOO, processMCSameEvent, "process MC Same Event", true); //======================================================= //| @@ -624,19 +696,11 @@ struct kstarInOO { std::cout << "Processed MC Mixed Events : " << nEventsMCMix << std::endl; } } - auto goodEv1 = eventSelection(collision1); - auto goodEv2 = eventSelection(collision2); - if (cfgMcHistos) { - histos.fill(HIST("nEvents_MC_Mix"), 0.5); - } - + auto goodEv1 = eventSelection(collision1, false); + auto goodEv2 = eventSelection(collision2, false); if (!goodEv1 || !goodEv2) continue; - - if (cfgMcHistos) { - histos.fill(HIST("nEvents_MC_Mix"), 1.5); - } - TrackSlicingMC(collision1, tracks1, collision2, tracks2, true); + TrackSlicingMC(collision1, tracks1, collision2, tracks2, false, true); } // mixing } // processMixedEvent_MC PROCESS_SWITCH(kstarInOO, processMCMixedEvent, "process MC Mixed Event", false); @@ -652,14 +716,10 @@ struct kstarInOO { { if (cDebugLevel > 0) { ++nEventsTrue; - if ((nEventsTrue & 10000) == 0) { - std::cout << "Processed MC True Events : " << nEventsTrue << std::endl; - } } if (fabs(collision.posZ()) > cfgEventVtxCut) return; - if (recocolls.size() <= 0) { // not reconstructed if (cfgForceGenReco) { return; @@ -669,7 +729,7 @@ struct kstarInOO { double centrality = -1; for (auto& recocoll : recocolls) { centrality = recocoll.centFT0C(); - auto goodEv = eventSelection(recocoll); + auto goodEv = eventSelection(recocoll, false); if (cfgMcHistos) { histos.fill(HIST("nEvents_MC_True"), 0.5); From 552ad72c3924d8bb971826a5f2efdbedb81a1cb4 Mon Sep 17 00:00:00 2001 From: sashingo Date: Wed, 27 Aug 2025 17:03:25 +0900 Subject: [PATCH 213/986] [PWGHF] updated to QA for Z->ee for Z0 trigger study modify to set non-linear centrality bins in histograms (#12741) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Vít Kučera --- PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx | 178 +++++++++++++++------- 1 file changed, 120 insertions(+), 58 deletions(-) diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx index 3f10c0462fa..baca2b26b99 100644 --- a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -56,6 +56,7 @@ #include #include #include +#include #include using namespace o2; @@ -113,9 +114,10 @@ struct HfTaskElectronWeakBoson { Configurable isTHnElectron{"isTHnElectron", true, "Enables THn for electrons"}; Configurable ptTHnThresh{"ptTHnThresh", 5.0, "Threshold for THn make"}; - // Skimmed dataset processing configurations + // Skimmed (trigger) dataset processing configurations Configurable cfgSkimmedProcessing{"cfgSkimmedProcessing", true, "Enables processing of skimmed datasets"}; Configurable cfgTriggerName{"cfgTriggerName", "fGammaHighPtEMCAL", "Trigger of interest (comma separated for multiple)"}; + Configurable applySel8{"applySel8", true, "Apply sel8 filter or not"}; // CCDB service configurations Configurable cfgCCDBPath{"cfgCCDBPath", "Users/m/mpuccio/EventFiltering/OTS/", "Path to CCDB for trigger data"}; @@ -130,19 +132,20 @@ struct HfTaskElectronWeakBoson { Configurable enableCentralityAnalysis{"enableCentralityAnalysis", true, "Enable centrality-dependent analysis"}; Configurable centralityMin{"centralityMin", -1, "minimum cut on centrality selection"}; Configurable centralityMax{"centralityMax", 101, "maximum cut on centrality selection"}; + Configurable> centralityBins{"centralityBins", {0, 20, 60, 100}, "centrality bins"}; + // QA for Z->ee + Configurable enableZeeRecoQA{"enableZeeRecoQA", false, "Enable QA for Z->ee reconstruction"}; // CCDB service object Service ccdb; struct HfElectronCandidate { - float pt, eta, phi, energy; - int charge; - HfElectronCandidate(float ptr, float e, float ph, float en, int ch) - : pt(ptr), eta(e), phi(ph), energy(en), charge(ch) {} - - int sign() const { return charge; } + float pt, eta, phi, eop, energyIso, momIso, ntrackIso; + HfElectronCandidate(float ptr, float e, float ph, float ep, float eiso, float piso, int ntrkiso) + : pt(ptr), eta(e), phi(ph), eop(ep), energyIso(eiso), momIso(piso), ntrackIso(ntrkiso) {} }; std::vector selectedElectronsIso; + std::vector selectedPositronsIso; std::vector selectedElectronsAss; struct HfZeeCandidate { @@ -161,8 +164,7 @@ struct HfTaskElectronWeakBoson { // pp // using TrackEle = o2::soa::Filtered>; - // Filter - Filter eventFilter = (o2::aod::evsel::sel8 == true); + Filter eventFilter = (applySel8 ? (o2::aod::evsel::sel8 == true) : (o2::aod::evsel::sel8 == o2::aod::evsel::sel8)); Filter posZFilter = (nabs(o2::aod::collision::posZ) < vtxZ); Filter etafilter = (aod::track::eta < etaTrMax) && (aod::track::eta > etaTrMin); @@ -209,6 +211,9 @@ struct HfTaskElectronWeakBoson { const AxisSpec axisCounter{1, 0, 1, "events"}; const AxisSpec axisEta{20, -1.0, 1.0, "#eta"}; const AxisSpec axisPt{nBinsPt, 0, binPtmax, "p_{T}"}; + const AxisSpec axisPtZee{60, 20, 80, "p_{T}"}; + const AxisSpec axisPtZele{60, 20, 80, "p_{T,ele} (GeV/c)"}; + const AxisSpec axisPtZpos{60, 20, 80, "p_{T,pos} (GeV/c)"}; const AxisSpec axisNsigma{100, -5, 5, "N#sigma"}; const AxisSpec axisDedx{150, 0, 150, "dEdx"}; const AxisSpec axisE{nBinsE, 0, binEmax, "Energy"}; @@ -218,20 +223,30 @@ struct HfTaskElectronWeakBoson { const AxisSpec axisdR{20, 0.0, 0.2, "dR"}; const AxisSpec axisNcell{50, 0.0, 50.0, "Ncell"}; const AxisSpec axisPhi{350, 0, 7, "Phi"}; - const AxisSpec axisEop{200, 0, 2, "Eop"}; + const AxisSpec axisEop{200, 0, 2, "E/p"}; + const AxisSpec axisEopZele{200, 0, 2, "E/p electon"}; + const AxisSpec axisEopZpos{200, 0, 2, "E/p positron"}; const AxisSpec axisChi2{250, 0.0, 25.0, "#chi^{2}"}; const AxisSpec axisCluster{100, 0.0, 200.0, "counts"}; const AxisSpec axisITSNCls{10, 0.0, 10, "counts"}; const AxisSpec axisEMCtime{100, -50.0, 50, "EMC time"}; - const AxisSpec axisIsoEnergy{100, 0, 1.0, "Isolation energy(GeV/C)"}; - const AxisSpec axisIsoTrack{15, -0.5, 14.5, "Isolation Track"}; - const AxisSpec axisInvMassZ{150, 0, 150, "M_{ee} (GeV/c^{2})"}; + const AxisSpec axisIsoEnergy{100, 0, 1.0, "E_{iso}"}; + const AxisSpec axisIsoEnergyZele{100, 0, 1.0, "E_{iso,ele}"}; + const AxisSpec axisIsoEnergyZpos{100, 0, 1.0, "E_{iso,pos}"}; + const AxisSpec axisIsoMomentum{100, 0, 10.0, "Isolation momentum(GeV/C)"}; + const AxisSpec axisIsoMomentumZele{100, 0, 10.0, "p_{iso,ele}"}; + const AxisSpec axisIsoMomentumZpos{100, 0, 10.0, "p_{iso,pos}"}; + const AxisSpec axisIsoTrack{25, -0.5, 24.5, "Isolation Track"}; + const AxisSpec axisIsoTrackZele{25, -0.5, 24.5, "N_{isotrk,ele}"}; + const AxisSpec axisIsoTrackZpos{25, -0.5, 24.5, "N_{isotrk,pos}"}; + const AxisSpec axisInvMassZgamma{150, 0, 150, "M_{ee} (GeV/c^{2})"}; + const AxisSpec axisInvMassZ{130, 20, 150, "M_{ee} (GeV/c^{2})"}; const AxisSpec axisTrigger{3, -0.5, 2.5, "Trigger status of zorro"}; const AxisSpec axisDPhiZh{64, -o2::constants::math::PIHalf, 3 * o2::constants::math::PIHalf, "#Delta#phi(Z-h)"}; const AxisSpec axisPtHadron{50, 0, 50, "p_{T,hadron} (GeV/c)"}; const AxisSpec axisPtZ{150, 0, 150, "p_{T,Z} (GeV/c)"}; const AxisSpec axisSign{2, -2, 2, "charge sign"}; - const AxisSpec axisCentrality{10, 0, 100, "Centrality (%)"}; + const AxisSpec axisCentrality{centralityBins}; const AxisSpec axisPtRatio{200, 0, 2.0, "pt ratio for h and Z"}; // create registrygrams @@ -259,14 +274,14 @@ struct HfTaskElectronWeakBoson { registry.add("hEopNsigTPC", "Eop vs. Nsigma", kTH2F, {{axisNsigma}, {axisEop}}); registry.add("hEMCtime", "EMC timing", kTH1F, {axisEMCtime}); registry.add("hIsolationEnergy", "Isolation Energy", kTH2F, {{axisE}, {axisIsoEnergy}}); - registry.add("hIsolationTrack", "Isolation Track", kTH2F, {{axisE}, {axisIsoTrack}}); - registry.add("hInvMassZee", "invariant mass for Z ULS pair", HistType::kTHnSparseF, {axisSign, axisPt, axisInvMassZ}); - registry.add("hKfInvMassZee", "invariant mass for Z ULS pair KFp", HistType::kTHnSparseF, {axisSign, axisPt, axisInvMassZ}); + registry.add("hInvMassZee", "invariant mass for Z ULS pair", HistType::kTHnSparseF, {axisCentrality, axisSign, axisPt, axisInvMassZgamma}); + registry.add("hKfInvMassZee", "invariant mass for Z ULS pair KFp", HistType::kTHnSparseF, {axisCentrality, axisSign, axisPt, axisInvMassZgamma}); + registry.add("hInvMassZeeQA", "QA for invariant mass for Z", HistType::kTHnSparseF, {axisInvMassZ, axisPtZele, axisPtZpos, axisEopZele, axisEopZpos, axisIsoEnergyZele, axisIsoEnergyZpos, axisIsoMomentumZele, axisIsoMomentumZpos, axisIsoTrackZele, axisIsoTrackZpos}); registry.add("hTHnElectrons", "electron info", HistType::kTHnSparseF, {axisPt, axisNsigma, axisM02, axisEop, axisIsoEnergy, axisIsoTrack, axisEta, axisDedx}); registry.add("hTHnTrMatch", "Track EMC Match", HistType::kTHnSparseF, {axisPt, axisdPhi, axisdEta}); // Z-hadron correlation histograms - registry.add("hZHadronDphi", "Z-hadron #Delta#phi correlation", HistType::kTHnSparseF, {axisSign, axisPtZ, axisDPhiZh, axisPtRatio, axisPtHadron}); + registry.add("hZHadronDphi", "Z-hadron #Delta#phi correlation", HistType::kTHnSparseF, {axisCentrality, axisSign, axisPtZ, axisDPhiZh, axisPtRatio, axisPtHadron}); registry.add("hZptSpectrum", "Z boson p_{T} spectrum", kTH2F, {{axisSign}, {axisPtZ}}); // hisotgram for EMCal trigger @@ -306,12 +321,15 @@ struct HfTaskElectronWeakBoson { return (isoEnergy); } - int getIsolatedTrack(double etaEle, - double phiEle, - float ptEle, - TrackEle const& tracks) + std::pair getIsolatedTrack(double etaEle, + double phiEle, + float pEle, + TrackEle const& tracks) { int trackCount = 0; + double isoMomentum = 10; + double pSum = 0.0; + // LOG(info) << "track p = " << pEle; for (const auto& track : tracks) { @@ -323,16 +341,22 @@ struct HfTaskElectronWeakBoson { if (deltaR < rIsolation) { trackCount++; + pSum += track.p(); } } - registry.fill(HIST("hIsolationTrack"), ptEle, trackCount); + // LOG(info) << "momSun = " << pSum; + if (pSum > 0) { + isoMomentum = pSum / pEle - 1.0; + } - return (trackCount); + // LOG(info) << "isop = " << isoMomentum; + return std::make_pair(trackCount - 1, isoMomentum); } void recoMassZee(KFParticle kfpIsoEle, int charge, + float centrality, TrackEle const& tracks) { // LOG(info) << "Invarimass cal by KF particle "; @@ -362,7 +386,7 @@ struct HfTaskElectronWeakBoson { auto child2 = RecoDecayPtEtaPhi::pVector(kfpAssEle.GetPt() * correctionPtElectron, kfpAssEle.GetEta(), kfpAssEle.GetPhi()); double invMassEE = RecoDecay::m(std::array{child1, child2}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}); - registry.fill(HIST("hInvMassZee"), track.sign() * charge, kfpIsoEle.GetPt(), invMassEE); + registry.fill(HIST("hInvMassZee"), centrality, track.sign() * charge, kfpIsoEle.GetPt(), invMassEE); // reco by KFparticle const KFParticle* electronPairs[2] = {&kfpIsoEle, &kfpAssEle}; @@ -382,7 +406,7 @@ struct HfTaskElectronWeakBoson { } float massZee, massZeeErr; zeeKF.GetMass(massZee, massZeeErr); - registry.fill(HIST("hKfInvMassZee"), track.sign() * charge, kfpIsoEle.GetPt(), massZee); + registry.fill(HIST("hKfInvMassZee"), centrality, track.sign() * charge, kfpIsoEle.GetPt(), massZee); // LOG(info) << "Invarimass cal by KF particle mass = " << massZee; // LOG(info) << "Invarimass cal by RecoDecay = " << invMassEE; reconstructedZ.emplace_back( @@ -448,6 +472,7 @@ struct HfTaskElectronWeakBoson { } // initialze for inclusive-electron selectedElectronsIso.clear(); + selectedPositronsIso.clear(); selectedElectronsAss.clear(); reconstructedZ.clear(); @@ -460,8 +485,9 @@ struct HfTaskElectronWeakBoson { registry.fill(HIST("hZvtx"), collision.posZ()); // Calculate centrality + float centrality = 1.0; if (enableCentralityAnalysis) { - float centrality = o2::hf_centrality::getCentralityColl(collision, centralityEstimator); + centrality = o2::hf_centrality::getCentralityColl(collision, centralityEstimator); // LOG(info) << centrality; if (centrality < centralityMin || centrality > centralityMax) { return; @@ -502,38 +528,46 @@ struct HfTaskElectronWeakBoson { registry.fill(HIST("hPt"), track.pt()); registry.fill(HIST("hTPCNsigma"), track.p(), track.tpcNSigmaEl()); - float energyTrk = 0.0; + float eop = 0.0; + float isoEnergy = 1.0; + // track isolation + auto [trackCount, isoMomentum] = getIsolatedTrack(track.eta(), track.phi(), track.p(), tracks); + // LOG(info) << "isoMomentum = " << isoMomentum; if (track.pt() > ptAssMin) { selectedElectronsAss.emplace_back( track.pt(), track.eta(), track.phi(), - energyTrk, - track.sign()); + eop, + isoEnergy, + isoMomentum, + trackCount); } if (track.pt() < ptMin) { continue; } - // track - match - // continue; - if (track.phi() < phiEmcMin || track.phi() > phiEmcMax) - continue; - if (std::abs(track.eta()) > etaEmcMax) - continue; + // LOG(info) << "tr phi, eta = " << track.phi() << " ; " << track.eta(); + // EMC acc + bool isEMCacceptance = true; + if (track.phi() < phiEmcMin || track.phi() > phiEmcMax) { + isEMCacceptance = false; + } + if (std::abs(track.eta()) > etaEmcMax) { + isEMCacceptance = false; + } + // LOG(info) << "EMC acc = " << isEMCacceptance; auto tracksofcluster = matchedtracks.sliceBy(perClusterMatchedTracks, track.globalIndex()); - // LOGF(info, "Number of matched track: %d", tracksofcluster.size()); - double rMin = 999.9; double dPhiMin = 999.9; double dEtaMin = 999.9; bool isIsolated = false; bool isIsolatedTr = false; - if (tracksofcluster.size()) { + if (tracksofcluster.size() && isEMCacceptance) { int nMatch = 0; for (const auto& match : tracksofcluster) { if (match.emcalcluster_as().time() < timeEmcMin || match.emcalcluster_as().time() > timeEmcMax) @@ -557,6 +591,7 @@ struct HfTaskElectronWeakBoson { registry.fill(HIST("hMatchEta"), etaEmc, match.track_as().trackEtaEmcal()); double r = RecoDecay::sqrtSumOfSquares(dPhi, dEta); + // LOG(info) << "r match = " << r; if (r < rMin) { rMin = r; dPhiMin = dPhi; @@ -574,11 +609,10 @@ struct HfTaskElectronWeakBoson { const auto& cluster = match.emcalcluster_as(); - double eop = energyEmc / match.track_as().p(); + eop = energyEmc / match.track_as().p(); + // LOG(info) << "eop = " << eop; - double isoEnergy = getIsolatedCluster(cluster, emcClusters); - - int trackCount = getIsolatedTrack(track.eta(), track.phi(), track.pt(), tracks) - 1; + isoEnergy = getIsolatedCluster(cluster, emcClusters); if (match.track_as().pt() > ptTHnThresh && isTHnElectron) { registry.fill(HIST("hTHnElectrons"), match.track_as().pt(), match.track_as().tpcNSigmaEl(), m02Emc, eop, isoEnergy, trackCount, track.eta(), track.tpcSignal()); @@ -606,29 +640,44 @@ struct HfTaskElectronWeakBoson { } KFPTrack kfpTrackIsoEle = createKFPTrackFromTrack(match.track_as()); KFParticle kfpIsoEle(kfpTrackIsoEle, pdgIso); - recoMassZee(kfpIsoEle, match.track_as().sign(), tracks); - - selectedElectronsIso.emplace_back( - match.track_as().pt(), - match.track_as().eta(), - match.track_as().phi(), - energyEmc, - match.track_as().sign()); - } - } + recoMassZee(kfpIsoEle, match.track_as().sign(), centrality, tracks); + + } // end of pt cut for e from Z + } // end if isolation cut if (isIsolatedTr) { registry.fill(HIST("hEopIsolationTr"), match.track_as().pt(), eop); } - } - } + } // end of PID cut + } // end of nmatch == 0 nMatch++; - } - } + } // end of cluster match + } // end of cluster if (rMin < rMatchMax) { // LOG(info) << "R mim = " << rMin; registry.fill(HIST("hTrMatch_mim"), dPhiMin, dEtaMin); } + if (enableZeeRecoQA && track.pt() > ptZeeMin) { + if (track.sign() < 0) { + selectedElectronsIso.emplace_back( + track.pt(), + track.eta(), + track.phi(), + eop, + isoEnergy, + isoMomentum, + trackCount); + } else { + selectedPositronsIso.emplace_back( + track.pt(), + track.eta(), + track.phi(), + eop, + isoEnergy, + isoMomentum, + trackCount); + } + } } // end of track loop // Z-hadron @@ -649,10 +698,23 @@ struct HfTaskElectronWeakBoson { // calculate Z-h correlation double deltaPhi = RecoDecay::constrainAngle(trackAss.phi - zBoson.phi, -o2::constants::math::PIHalf); double ptRatio = trackAss.pt / zBoson.pt; - registry.fill(HIST("hZHadronDphi"), zBoson.charge, zBoson.pt, deltaPhi, ptRatio, trackAss.pt); + registry.fill(HIST("hZHadronDphi"), centrality, zBoson.charge, zBoson.pt, deltaPhi, ptRatio, trackAss.pt); } } } // end of Z-hadron correlation + // Z->ee QA + if (enableZeeRecoQA) { + if (selectedElectronsIso.size() > 0 && selectedPositronsIso.size() > 0) { + for (const auto& trackEle : selectedElectronsIso) { + for (const auto& trackPos : selectedPositronsIso) { + auto child1 = RecoDecayPtEtaPhi::pVector(trackEle.pt, trackEle.eta, trackEle.phi); + auto child2 = RecoDecayPtEtaPhi::pVector(trackPos.pt, trackPos.eta, trackPos.phi); + double invMass = RecoDecay::m(std::array{child1, child2}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}); + registry.fill(HIST("hInvMassZeeQA"), invMass, trackEle.pt, trackPos.pt, trackEle.eop, trackPos.eop, trackEle.energyIso, trackPos.energyIso, trackEle.momIso, trackPos.momIso, trackEle.ntrackIso, trackPos.ntrackIso); + } + } + } + } // end of Z->ee QA } }; From 2f61fbfaccd4103fc331e28f9e8154fcd1b9701e Mon Sep 17 00:00:00 2001 From: Subhadeep Mandal <147193283+5ub-Man@users.noreply.github.com> Date: Wed, 27 Aug 2025 16:47:00 +0530 Subject: [PATCH 214/986] [PWGLF] Minor changes (#12760) --- PWGLF/Tasks/Resonances/kstarqa.cxx | 48 +++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarqa.cxx b/PWGLF/Tasks/Resonances/kstarqa.cxx index d79acff1261..9c829f03508 100644 --- a/PWGLF/Tasks/Resonances/kstarqa.cxx +++ b/PWGLF/Tasks/Resonances/kstarqa.cxx @@ -251,8 +251,8 @@ struct Kstarqa { hOthers.add("hCRFC_after", "CRFC after distribution", kTH1F, {{100, 0.0f, 10.0f}}); hOthers.add("hCRFC_before", "CRFC before distribution", kTH1F, {{100, 0.0f, 10.0f}}); - hOthers.add("hKstar_Rap", "Pair rapidity distribution; y; Counts", kTH1F, {{1000, -5.0f, 5.0f}}); - hOthers.add("hKstar_Eta", "Pair eta distribution; #eta; Counts", kTH1F, {{1000, -5.0f, 5.0f}}); + hOthers.add("hKstar_rap_pt", "Pair rapidity distribution; y; p_{T}; Counts", kTH2F, {{400, -2.0f, 2.0f}, ptAxis}); + hOthers.add("hKstar_eta_pt", "Pair eta distribution; #eta; p_{T}; Counts", kTH2F, {{400, -2.0f, 2.0f}, ptAxis}); hPID.add("Before/hNsigmaTPC_Ka_before", "N #sigma Kaon TPC before", kTH2F, {{50, 0.0f, 10.0f}, {100, -10.0f, 10.0f}}); hPID.add("Before/hNsigmaTOF_Ka_before", "N #sigma Kaon TOF before", kTH2F, {{50, 0.0f, 10.0f}, {100, -10.0f, 10.0f}}); @@ -387,7 +387,7 @@ struct Kstarqa { double massKa = o2::constants::physics::MassKPlus; template - bool selectionEvent(const Coll& collision, bool fillHist = true) + bool selectionEvent(const Coll& collision, bool fillHist = false) // default to false { if (fillHist) rEventSelection.fill(HIST("hEventCut"), 0); @@ -937,7 +937,7 @@ struct Kstarqa { int occupancy = collision.trackOccupancyInTimeRange(); rEventSelection.fill(HIST("hOccupancy"), occupancy); - if (!selectionEvent(collision, true)) { + if (!selectionEvent(collision, true)) { // fill event cut histogram return; } @@ -1095,8 +1095,8 @@ struct Kstarqa { continue; } - hOthers.fill(HIST("hKstar_Rap"), mother.Rapidity()); - hOthers.fill(HIST("hKstar_Eta"), mother.Eta()); + hOthers.fill(HIST("hKstar_rap_pt"), mother.Rapidity(), mother.Pt()); + hOthers.fill(HIST("hKstar_eta_pt"), mother.Eta(), mother.Pt()); isMix = false; fillInvMass(daughter1, daughter2, mother, multiplicity, isMix, track1, track2); @@ -1148,7 +1148,7 @@ struct Kstarqa { // if (!c1.sel8() || !c2.sel8()) // continue; - if (!selectionEvent(c1, false) || !selectionEvent(c2, false)) { + if (!selectionEvent(c1, false) || !selectionEvent(c2, false)) { // don't fill event cut histogram continue; } @@ -1214,7 +1214,7 @@ struct Kstarqa { auto runMixing = [&](auto& pair, auto multiplicityGetter) { for (const auto& [c1, tracks1, c2, tracks2] : pair) { - if (!selectionEvent(c1, false) || !selectionEvent(c2, false)) { + if (!selectionEvent(c1, false) || !selectionEvent(c2, false)) { // don't fill event cut histogram continue; } @@ -1297,7 +1297,7 @@ struct Kstarqa { int occupancy = collision.trackOccupancyInTimeRange(); rEventSelection.fill(HIST("hOccupancy"), occupancy); - if (!selectionEvent(collision, false)) { + if (!selectionEvent(collision, false)) { // don't fill event cut histogram return; } @@ -1533,7 +1533,7 @@ struct Kstarqa { rEventSelection.fill(HIST("eventsCheckGen"), 2.5); for (const auto& collision : collisions) { - if (!selectionEvent(collision, true)) { + if (!selectionEvent(collision, false)) { // don't fill event cut histogram continue; } multiplicity = collision.centFT0M(); @@ -1657,7 +1657,7 @@ struct Kstarqa { for (const auto& RecCollision : recCollisions) { if (!RecCollision.has_mcCollision()) continue; - if (!selectionEvent(RecCollision, false)) + if (!selectionEvent(RecCollision, false)) // don't fill event cut histogram continue; // multiplicity1 = RecCollision.centFT0M(); const auto& mcCollisionRec = RecCollision.mcCollision_as(); @@ -1732,13 +1732,17 @@ struct Kstarqa { hInvMass.fill(HIST("hAllRecCollisions"), multiplicity); hInvMass.fill(HIST("hAllRecCollisionsCalib"), multiplicityRec); - if (!selectionEvent(collision, false)) { + if (!selectionEvent(collision, false)) { // don't fill event cut histogram return; } hInvMass.fill(HIST("h1RecMult"), multiplicity); hInvMass.fill(HIST("h1RecMult2"), multiplicityRec); + if (cQAevents) { + rEventSelection.fill(HIST("hVertexZRec"), collision.posZ()); + } + auto oldindex = -999; for (const auto& track1 : tracks) { if (!selectionTrack(track1)) { @@ -1749,6 +1753,11 @@ struct Kstarqa { continue; } + if (cQAevents) { + rEventSelection.fill(HIST("hDcaxy"), track1.dcaXY()); + rEventSelection.fill(HIST("hDcaz"), track1.dcaZ()); + } + auto track1ID = track1.index(); for (const auto& track2 : tracks) { rEventSelection.fill(HIST("recMCparticles"), 0.5); @@ -1777,7 +1786,12 @@ struct Kstarqa { const auto mctrack2 = track2.mcParticle(); int track1PDG = std::abs(mctrack1.pdgCode()); int track2PDG = std::abs(mctrack2.pdgCode()); - + if (cQAplots) { + hPID.fill(HIST("Before/hTPCnsigKa_mult_pt"), track1.tpcNSigmaKa(), multiplicity, track1.pt()); + hPID.fill(HIST("Before/hTPCnsigPi_mult_pt"), track2.tpcNSigmaPi(), multiplicity, track2.pt()); + hPID.fill(HIST("Before/hTOFnsigKa_mult_pt"), track1.tofNSigmaKa(), multiplicity, track1.pt()); + hPID.fill(HIST("Before/hTOFnsigPi_mult_pt"), track2.tofNSigmaKa(), multiplicity, track2.pt()); + } if (cQAplots && (mctrack2.pdgCode() == PDG_t::kPiPlus)) { // pion hPID.fill(HIST("Before/h1PID_TPC_pos_pion"), track2.tpcNSigmaPi()); hPID.fill(HIST("Before/h1PID_TOF_pos_pion"), track2.tofNSigmaPi()); @@ -1906,6 +1920,12 @@ struct Kstarqa { continue; rEventSelection.fill(HIST("recMCparticles"), 13.5); } + if (cQAplots) { + hPID.fill(HIST("After/hTPCnsigKa_mult_pt"), track1.tpcNSigmaKa(), multiplicity, track1.pt()); + hPID.fill(HIST("After/hTPCnsigPi_mult_pt"), track2.tpcNSigmaPi(), multiplicity, track2.pt()); + hPID.fill(HIST("After/hTOFnsigKa_mult_pt"), track1.tofNSigmaKa(), multiplicity, track1.pt()); + hPID.fill(HIST("After/hTOFnsigPi_mult_pt"), track2.tofNSigmaKa(), multiplicity, track2.pt()); + } if (selectionConfig.isApplyCutsOnMother) { if (mothertrack1.pt() >= selectionConfig.cMaxPtMotherCut) // excluding candidates in overflow @@ -1975,7 +1995,7 @@ struct Kstarqa { hInvMass.fill(HIST("hAllRecCollisions"), multiplicity); hInvMass.fill(HIST("hAllRecCollisionsCalib"), multiplicityRec); - if (!selectionEvent(collision, false)) { + if (!selectionEvent(collision, false)) { // don't fill event cut histogram return; } From 107ae2e2de014dffe9441b3b62fa60309b91054a Mon Sep 17 00:00:00 2001 From: Fabio Catalano Date: Wed, 27 Aug 2025 16:34:44 +0200 Subject: [PATCH 215/986] [PWGHF] OmegaC task, rework output structure + add info for vs mult. analysis (#12753) --- PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx | 315 +++++++++++++---------- 1 file changed, 172 insertions(+), 143 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx b/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx index a611d7e166a..e04ca9f6b04 100644 --- a/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx +++ b/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx @@ -18,6 +18,7 @@ #include "PWGHF/Core/HfHelper.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGLF/DataModel/mcCentrality.h" #include "Common/Core/RecoDecay.h" #include "Common/DataModel/Centrality.h" @@ -52,10 +53,9 @@ namespace o2::aod { namespace ml { -// collision info -DECLARE_SOA_COLUMN(KfptPiFromOmegac, kfptPiFromOmegac, float); -DECLARE_SOA_COLUMN(KfptOmegac, kfptOmegac, float); DECLARE_SOA_COLUMN(InvMassCharmBaryon, invMassCharmBaryon, float); +DECLARE_SOA_COLUMN(KfptOmegac, kfptOmegac, float); +DECLARE_SOA_COLUMN(KfptPiFromOmegac, kfptPiFromOmegac, float); DECLARE_SOA_COLUMN(MlProbOmegac, mlProbOmegac, float); DECLARE_SOA_COLUMN(Cent, cent, float); } // namespace ml @@ -64,27 +64,20 @@ DECLARE_SOA_TABLE(HfKfOmegacML, "AOD", "HFKFOMEGACML", } // namespace o2::aod /// Omegac0 analysis task - struct HfTaskOmegac0ToOmegapi { - Produces kfCandMl; - // ML inference - Configurable applyMl{"applyMl", false, "Flag to apply ML selections"}; - Configurable fillCent{"fillCent", false, "Flag to fill centrality information"}; - Configurable fillTree{"fillTree", false, "Fill TTree for local analysis.(Enabled only with ML)"}; + Configurable selectionFlagOmegac0{"selectionFlagOmegac0", true, "Select Omegac0 candidates"}; - Configurable yCandGenMax{"yCandGenMax", 0.5, "max. gen particle rapidity"}; - Configurable yCandRecoMax{"yCandRecoMax", 0.8, "max. cand. rapidity"}; + Configurable yCandGenMax{"yCandGenMax", 0.5, "Max. gen particle rapidity"}; + Configurable yCandRecoMax{"yCandRecoMax", 0.8, "Max. cand. rapidity"}; + Configurable fillTree{"fillTree", false, "Fill tree for local analysis (enabled only with ML)"}; HfHelper hfHelper; SliceCache cache; - using TracksMc = soa::Join; - using Omegac0Cands = soa::Filtered>; using Omegac0CandsKF = soa::Filtered>; using OmegaC0CandsMcKF = soa::Filtered>; - using Omegac0CandsMl = soa::Filtered>; using Omegac0CandsMlKF = soa::Filtered>; using Omegac0CandsMlMcKF = soa::Filtered>; @@ -96,43 +89,34 @@ struct HfTaskOmegac0ToOmegapi { using CollisionsWithFT0M = soa::Join; using CollisionsWithMcLabels = soa::Join; + using McCollisionsWithFT0M = soa::Join; + Filter filterOmegaCToOmegaPiFlag = (aod::hf_track_index::hfflag & static_cast(BIT(aod::hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi))) != static_cast(0); Filter filterOmegaCMatchedRec = nabs(aod::hf_cand_xic0_omegac0::flagMcMatchRec) == static_cast(BIT(aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaPi)); Filter filterOmegaCMatchedGen = nabs(aod::hf_cand_xic0_omegac0::flagMcMatchGen) == static_cast(BIT(aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaPi)); + Preslice candOmegacKFPerCollision = aod::hf_cand_xic0_omegac0::collisionId; Preslice candOmegacKFMlPerCollision = aod::hf_cand_xic0_omegac0::collisionId; - PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; - // ThnSparse for ML outputScores and Vars - ConfigurableAxis thnConfigAxisPromptScore{"thnConfigAxisPromptScore", {100, 0, 1}, "Prompt score bins"}; - ConfigurableAxis thnConfigAxisMass{"thnConfigAxisMass", {120, 2.4, 3.1}, "Cand. inv-mass bins"}; - ConfigurableAxis thnConfigAxisPtB{"thnConfigAxisPtB", {1000, 0, 100}, "Cand. beauty mother pTB bins"}; - ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {100, 0, 20}, "Cand. pT bins"}; - ConfigurableAxis thnConfigAxisY{"thnConfigAxisY", {20, -1, 1}, "Cand. rapidity bins"}; - ConfigurableAxis thnConfigAxisCent{"thnConfigAxisCent", {100, 0, 100}, "Centrality bins"}; - ConfigurableAxis thnConfigAxisPtPion{"thnConfigAxisPtPion", {100, 0, 10}, "PtPion from Omegac0 bins"}; - ConfigurableAxis thnConfigAxisOrigin{"thnConfigAxisOrigin", {3, -0.5, 2.5}, "Cand. origin type"}; - ConfigurableAxis thnConfigAxisMatchFlag{"thnConfigAxisMatchFlag", {15, -7.5, 7.5}, "Cand. MC Match Flag type"}; - ConfigurableAxis thnConfigAxisGenPtD{"thnConfigAxisGenPtD", {500, 0, 50}, "Gen Pt D"}; - ConfigurableAxis thnConfigAxisGenPtB{"thnConfigAxisGenPtB", {1000, 0, 100}, "Gen Pt B"}; - ConfigurableAxis thnConfigAxisNumPvContr{"thnConfigAxisNumPvContr", {200, -0.5, 199.5}, "Number of PV contributors"}; + ConfigurableAxis thnConfigAxisPromptScore{"thnConfigAxisPromptScore", {100, 0, 1}, "Prompt score"}; + ConfigurableAxis thnConfigAxisMass{"thnConfigAxisMass", {700, 2.4, 3.1}, "Cand. inv. mass"}; + ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {500, 0, 50}, "Cand. pT"}; + ConfigurableAxis thnConfigAxisPtB{"thnConfigAxisPtB", {500, 0, 50}, "Cand. beauty mother pT"}; + ConfigurableAxis thnConfigAxisY{"thnConfigAxisY", {20, -1, 1}, "Cand. rapidity"}; + ConfigurableAxis thnConfigAxisCent{"thnConfigAxisCent", {100, 0, 100}, "Centrality"}; + ConfigurableAxis thnConfigAxisOrigin{"thnConfigAxisOrigin", {3, -0.5, 2.5}, "Cand. origin"}; + ConfigurableAxis thnConfigAxisMatchFlag{"thnConfigAxisMatchFlag", {15, -7.5, 7.5}, "Cand. MC match flag"}; + ConfigurableAxis thnConfigAxisNumPvContr{"thnConfigAxisNumPvContr", {200, -0.5, 199.5}, "PV contributors"}; HistogramRegistry registry{"registry", {}}; void init(InitContext&) { - std::array doprocess{doprocessDataWithKFParticle, doprocessDataWithKFParticleMl, doprocessDataWithKFParticleFT0C, doprocessDataWithKFParticleMlFT0C, doprocessDataWithKFParticleFT0M, doprocessDataWithKFParticleMlFT0M}; - if (std::accumulate(doprocess.begin(), doprocess.end(), 0) > 1) { - LOGP(fatal, "At most one data process function should be enabled at a time."); - } - - std::array doprocessMc{doprocessMcWithKFParticle, doprocessMcWithKFParticleMl}; - if (std::accumulate(doprocessMc.begin(), doprocessMc.end(), 0) > 1) { - LOGP(fatal, "At most one MC process function should be enabled at a time."); - } - - if ((std::accumulate(doprocess.begin(), doprocess.end(), 0) + std::accumulate(doprocessMc.begin(), doprocessMc.end(), 0)) == 0) { - LOGP(fatal, "At least one process function should be enabled."); + std::array doprocess{doprocessDataKFParticle, doprocessDataKFParticleMl, doprocessDataKFParticleFT0C, doprocessDataKFParticleMlFT0C, + doprocessDataKFParticleFT0M, doprocessDataKFParticleMlFT0M, doprocessMcKFParticle, doprocessMcKFParticleMl, + doprocessMcKFParticleFT0M, doprocessMcKFParticleMlFT0M}; + if ((std::accumulate(doprocess.begin(), doprocess.end(), 0)) != 1) { + LOGP(fatal, "One and only one process function should be enabled at a time."); } const AxisSpec thnAxisMass{thnConfigAxisMass, "inv. mass (#Omega#pi) (GeV/#it{c}^{2})"}; @@ -140,44 +124,42 @@ struct HfTaskOmegac0ToOmegapi { const AxisSpec thnAxisPtB{thnConfigAxisPtB, "#it{p}_{T}^{B} (GeV/#it{c})"}; const AxisSpec thnAxisY{thnConfigAxisY, "y"}; const AxisSpec thnAxisOrigin{thnConfigAxisOrigin, "Origin"}; - const AxisSpec thnAxisMatchFlag{thnConfigAxisMatchFlag, "MatchFlag"}; - const AxisSpec thnAxisGenPtD{thnConfigAxisGenPtD, "#it{p}_{T} (GeV/#it{c})"}; - const AxisSpec thnAxisGenPtB{thnConfigAxisGenPtB, "#it{p}_{T}^{B} (GeV/#it{c})"}; - const AxisSpec thnAxisNumPvContr{thnConfigAxisNumPvContr, "Number of PV contributors"}; - - if (doprocessMcWithKFParticle || doprocessMcWithKFParticleMl) { - std::vector axesAcc = {thnAxisGenPtD, thnAxisGenPtB, thnAxisY, thnAxisOrigin, thnAxisNumPvContr}; - registry.add("hSparseAcc", "Thn for generated Omega0 from charm and beauty", HistType::kTHnSparseD, axesAcc); - registry.get(HIST("hSparseAcc"))->Sumw2(); - } + const AxisSpec thnAxisMatchFlag{thnConfigAxisMatchFlag, "MC match flag"}; + const AxisSpec thnAxisNumPvContr{thnConfigAxisNumPvContr, "PV contributors"}; + const AxisSpec thnAxisPromptScore{thnConfigAxisPromptScore, "BDT score prompt"}; + const AxisSpec thnAxisCent{thnConfigAxisCent, "Centrality"}; std::vector axes = {thnAxisMass, thnAxisPt, thnAxisY}; - if (doprocessMcWithKFParticle || doprocessMcWithKFParticleMl) { + std::vector axesMcGen = {thnAxisPt, thnAxisPtB, thnAxisY, thnAxisOrigin}; + + if (doprocessDataKFParticleFT0C || doprocessDataKFParticleMlFT0C || doprocessDataKFParticleFT0M || doprocessDataKFParticleMlFT0M || doprocessMcKFParticleFT0M || doprocessMcKFParticleMlFT0M) { + axes.push_back(thnAxisCent); + axes.push_back(thnConfigAxisNumPvContr); + axesMcGen.push_back(thnAxisCent); + axesMcGen.push_back(thnConfigAxisNumPvContr); + } + + if (doprocessMcKFParticle || doprocessMcKFParticleMl || doprocessMcKFParticleFT0M || doprocessMcKFParticleMlFT0M) { + registry.add("hMcGen", "Gen. #Omega_{c}^{0} from charm and beauty", HistType::kTHnSparseD, axesMcGen); + registry.get(HIST("hMcGen"))->Sumw2(); + + if (doprocessMcKFParticleFT0M || doprocessMcKFParticleMlFT0M) { + registry.add("hMcGenWithRecoColl", "Gen. #Omega_{c}^{0} from charm and beauty (associated to a reco collision)", HistType::kTHnSparseD, axesMcGen); + registry.add("hNumRecoCollPerMcColl", "Number of reco collisions associated to a mc collision;Num. reco. coll. per Mc coll.;", {HistType::kTH1D, {{10, -1.5, 8.5}}}); + registry.get(HIST("hMcGenWithRecoColl"))->Sumw2(); + } + axes.push_back(thnAxisPtB); axes.push_back(thnAxisOrigin); axes.push_back(thnAxisMatchFlag); - axes.push_back(thnAxisNumPvContr); } - if (applyMl) { - const AxisSpec thnAxisPromptScore{thnConfigAxisPromptScore, "BDT score prompt."}; - axes.insert(axes.begin(), thnAxisPromptScore); - registry.add("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsOmegac0Type", "Thn for Omegac0 candidates", HistType::kTHnSparseD, axes); - registry.get(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsOmegac0Type"))->Sumw2(); - } else { - registry.add("hMassVsPtVsPtBVsYVsOriginVsOmegac0Type", "Thn for Omegac0 candidates", HistType::kTHnSparseF, axes); - registry.get(HIST("hMassVsPtVsPtBVsYVsOriginVsOmegac0Type"))->Sumw2(); - } - if (fillCent) { - const AxisSpec thnAxisPromptScore{thnConfigAxisPromptScore, "BDT score prompt."}; - const AxisSpec thnAxisCent{thnConfigAxisCent, "Centrality."}; - const AxisSpec thnAxisPtPion{thnConfigAxisPtPion, "Pt of Pion from Omegac0."}; - std::vector axesWithBdtCent = {thnAxisPromptScore, thnAxisMass, thnAxisPt, thnAxisY, thnAxisCent, thnAxisPtPion, thnConfigAxisNumPvContr}; - std::vector axesWithCent = {thnAxisMass, thnAxisPt, thnAxisY, thnAxisCent, thnAxisPtPion, thnConfigAxisNumPvContr}; - registry.add("hBdtScoreVsMassVsPtVsYVsCentVsPtPion", "Thn for Omegac0 candidates with BDT&Cent&pTpi", HistType::kTHnSparseD, axesWithBdtCent); - registry.add("hMassVsPtVsYVsCentVsPtPion", "Thn for Omegac0 candidates with Cent&pTpi", HistType::kTHnSparseD, axesWithCent); - registry.get(HIST("hBdtScoreVsMassVsPtVsYVsCentVsPtPion"))->Sumw2(); - registry.get(HIST("hMassVsPtVsYVsCentVsPtPion"))->Sumw2(); + + if (doprocessDataKFParticleMl || doprocessDataKFParticleMlFT0C || doprocessDataKFParticleMlFT0M || doprocessMcKFParticleMl || doprocessMcKFParticleMlFT0M) { + axes.push_back(thnAxisPromptScore); } + + registry.add("hReco", "Reco. #Omega_{c}^{0} candidates", HistType::kTHnSparseD, axes); + registry.get(HIST("hReco"))->Sumw2(); } /// Evaluate centrality/multiplicity percentile (centrality estimator is automatically selected based on the used table) @@ -189,21 +171,22 @@ struct HfTaskOmegac0ToOmegapi { return o2::hf_centrality::getCentralityColl(collision); } - template - void processData(const CandType& candidates, CollType const&) + template + void processData(const CandType& candidates) { for (const auto& candidate : candidates) { if (!(candidate.resultSelections() == true || (candidate.resultSelections() == false && !selectionFlagOmegac0))) { continue; } + if (yCandRecoMax >= 0. && std::abs(candidate.kfRapOmegac()) > yCandRecoMax) { continue; } if constexpr (applyMl) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsOmegac0Type"), candidate.mlProbOmegac()[0], candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac()); + registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), candidate.mlProbOmegac()[0]); } else { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsOmegac0Type"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac()); + registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac()); } } } @@ -212,57 +195,37 @@ struct HfTaskOmegac0ToOmegapi { void processDataCent(const CandType& candidates, CollType const& collisions) { for (const auto& collision : collisions) { - auto thisCollId = collision.globalIndex(); - auto groupedOmegacCandidates = applyMl - ? candidates.sliceBy(candOmegacKFMlPerCollision, thisCollId) - : candidates.sliceBy(candOmegacKFPerCollision, thisCollId); + auto groupedOmegacCandidates = applyMl ? candidates.sliceBy(candOmegacKFMlPerCollision, thisCollId) : candidates.sliceBy(candOmegacKFPerCollision, thisCollId); auto numPvContributors = collision.numContrib(); for (const auto& candidate : groupedOmegacCandidates) { if (!(candidate.resultSelections() == true || (candidate.resultSelections() == false && !selectionFlagOmegac0))) { continue; } + if (yCandRecoMax >= 0. && std::abs(candidate.kfRapOmegac()) > yCandRecoMax) { continue; } + float cent = evaluateCentralityColl(collision); + if constexpr (applyMl) { + registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), + cent, numPvContributors, candidate.mlProbOmegac()[0]); if (fillTree) { - kfCandMl(candidate.invMassCharmBaryon(), - candidate.ptCharmBaryon(), - candidate.kfptPiFromOmegac(), - candidate.mlProbOmegac()[0], - cent); - } else { - registry.fill(HIST("hBdtScoreVsMassVsPtVsYVsCentVsPtPion"), - candidate.mlProbOmegac()[0], - candidate.invMassCharmBaryon(), - candidate.ptCharmBaryon(), - candidate.kfRapOmegac(), - cent, - candidate.kfptPiFromOmegac(), - numPvContributors); + kfCandMl(candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfptPiFromOmegac(), candidate.mlProbOmegac()[0], cent); } } else { - registry.fill(HIST("hMassVsPtVsYVsCentVsPtPion"), - candidate.invMassCharmBaryon(), - candidate.ptCharmBaryon(), - candidate.kfRapOmegac(), - cent, - candidate.kfptPiFromOmegac(), - numPvContributors); + registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), + cent, numPvContributors); } } } } - template - void processMc(const CandType& candidates, - Omegac0Gen const& mcParticles, - TracksMc const&, - CollType const& collisions, - aod::McCollisions const&) + template + void processMc(const CandType& candidates, Omegac0Gen const& mcParticles) { // MC rec. for (const auto& candidate : candidates) { @@ -273,13 +236,54 @@ struct HfTaskOmegac0ToOmegapi { continue; } - auto numPvContributors = candidate.template collision_as().numContrib(); + if constexpr (applyMl) { + registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec(), candidate.mlProbOmegac()[0]); + + } else { + registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec()); + } + } + + // MC gen. + for (const auto& particle : mcParticles) { + if (yCandGenMax >= 0. && std::abs(particle.rapidityCharmBaryonGen()) > yCandGenMax) { + continue; + } + + auto ptGen = particle.pt(); + auto yGen = particle.rapidityCharmBaryonGen(); + + if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { + registry.fill(HIST("hMcGen"), ptGen, -1., yGen, RecoDecay::OriginType::Prompt); + } else { + float ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt(); + registry.fill(HIST("hMcGen"), ptGen, ptGenB, yGen, RecoDecay::OriginType::NonPrompt); + } + } + } + + template + void processMcCent(const CandType& candidates, Omegac0Gen const& mcParticles, + CollisionsWithMcLabels const& collisions, McCollisionWithCents const&) + { + // MC rec. + for (const auto& candidate : candidates) { + if (!(candidate.resultSelections() == true || (candidate.resultSelections() == false && !selectionFlagOmegac0))) { + continue; + } + if (yCandRecoMax >= 0. && std::abs(candidate.kfRapOmegac()) > yCandRecoMax) { + continue; + } + + auto collision = candidate.template collision_as(); + uint16_t numPvContributors = collision.numContrib(); + float mcCent = evaluateCentralityColl(collision.template mcCollision_as()); if constexpr (applyMl) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsOmegac0Type"), candidate.mlProbOmegac()[0], candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec(), numPvContributors); + registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), mcCent, numPvContributors, candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec(), candidate.mlProbOmegac()[0]); } else { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsOmegac0Type"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec(), numPvContributors); + registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), mcCent, numPvContributors, candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec()); } } @@ -291,83 +295,108 @@ struct HfTaskOmegac0ToOmegapi { auto ptGen = particle.pt(); auto yGen = particle.rapidityCharmBaryonGen(); + auto mcCollision = particle.template mcCollision_as(); - unsigned maxNumContrib = 0; - const auto& recoCollsPerMcColl = collisions.sliceBy(colPerMcCollision, particle.mcCollision().globalIndex()); + int maxNumContrib = 0; + const auto& recoCollsPerMcColl = collisions.sliceBy(colPerMcCollision, mcCollision.globalIndex()); for (const auto& recCol : recoCollsPerMcColl) { maxNumContrib = recCol.numContrib() > maxNumContrib ? recCol.numContrib() : maxNumContrib; } + float mcCent = evaluateCentralityColl(mcCollision); + if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { - registry.fill(HIST("hSparseAcc"), ptGen, -1., yGen, RecoDecay::OriginType::Prompt, maxNumContrib); + registry.fill(HIST("hMcGen"), ptGen, -1., yGen, RecoDecay::OriginType::Prompt, mcCent, maxNumContrib); } else { float ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt(); - registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, RecoDecay::OriginType::NonPrompt, maxNumContrib); + registry.fill(HIST("hMcGen"), ptGen, ptGenB, yGen, RecoDecay::OriginType::NonPrompt, mcCent, maxNumContrib); + } + + registry.fill(HIST("hNumRecoCollPerMcColl"), recoCollsPerMcColl.size()); + + // fill sparse only for gen particles associated to a reconstructed collision + if (recoCollsPerMcColl.size() >= 1) { + if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { + registry.fill(HIST("hMcGenWithRecoColl"), ptGen, -1., yGen, RecoDecay::OriginType::Prompt, mcCent, maxNumContrib); + } else { + float ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt(); + registry.fill(HIST("hMcGenWithRecoColl"), ptGen, ptGenB, yGen, RecoDecay::OriginType::NonPrompt, mcCent, maxNumContrib); + } } } } - void processDataWithKFParticle(Omegac0CandsKF const& candidates, - Collisions const& collisions) + void processDataKFParticle(Omegac0CandsKF const& candidates) { - processData(candidates, collisions); + processData(candidates); } - PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataWithKFParticle, "process HfTaskOmegac0ToOmegapi with KFParticle", false); + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataKFParticle, "process data with KFParticle", false); - void processDataWithKFParticleMl(Omegac0CandsMlKF const& candidates, - Collisions const& collisions) + void processDataKFParticleMl(Omegac0CandsMlKF const& candidates) { - processData(candidates, collisions); + processData(candidates); } - PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataWithKFParticleMl, "process HfTaskOmegac0ToOmegapi with KFParticle and ML selections", false); + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataKFParticleMl, "process data with KFParticle, ML selections", false); - void processDataWithKFParticleFT0C(Omegac0CandsKF const& candidates, - CollisionsWithFT0C const& collisions) + void processDataKFParticleFT0C(Omegac0CandsKF const& candidates, + CollisionsWithFT0C const& collisions) { processDataCent(candidates, collisions); } - PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataWithKFParticleFT0C, "process HfTaskOmegac0ToOmegapi with KFParticle and with FT0C centrality", false); + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataKFParticleFT0C, "process data with KFParticle, FT0C centrality", false); - void processDataWithKFParticleMlFT0C(Omegac0CandsMlKF const& candidates, - CollisionsWithFT0C const& collisions) + void processDataKFParticleMlFT0C(Omegac0CandsMlKF const& candidates, + CollisionsWithFT0C const& collisions) { processDataCent(candidates, collisions); } - PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataWithKFParticleMlFT0C, "process HfTaskOmegac0ToOmegapi with KFParticle and ML selections and with FT0C centrality", false); + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataKFParticleMlFT0C, "process data with KFParticle, ML selections, FT0C centrality", false); - void processDataWithKFParticleFT0M(Omegac0CandsKF const& candidates, - CollisionsWithFT0M const& collisions) + void processDataKFParticleFT0M(Omegac0CandsKF const& candidates, + CollisionsWithFT0M const& collisions) { processDataCent(candidates, collisions); } - PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataWithKFParticleFT0M, "process HfTaskOmegac0ToOmegapi with KFParticle and with FT0M centrality", false); + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataKFParticleFT0M, "process data with KFParticle, FT0M centrality", false); - void processDataWithKFParticleMlFT0M(Omegac0CandsMlKF const& candidates, - CollisionsWithFT0M const& collisions) + void processDataKFParticleMlFT0M(Omegac0CandsMlKF const& candidates, + CollisionsWithFT0M const& collisions) { processDataCent(candidates, collisions); } - PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataWithKFParticleMlFT0M, "process HfTaskOmegac0ToOmegapi with KFParticle and ML selections and with FT0M centrality", false); + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataKFParticleMlFT0M, "process data with KFParticle, ML selections, FT0M centrality", false); + + void processMcKFParticle(OmegaC0CandsMcKF const& omegaC0CandidatesMcKF, + Omegac0Gen const& mcParticles) + { + processMc(omegaC0CandidatesMcKF, mcParticles); + } + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processMcKFParticle, "Process MC with KFParticle", false); + + void processMcKFParticleMl(Omegac0CandsMlMcKF const& omegac0CandidatesMlMcKF, + Omegac0Gen const& mcParticles) + { + processMc(omegac0CandidatesMlMcKF, mcParticles); + } + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processMcKFParticleMl, "Process MC with KFParticle, ML selections", false); - void processMcWithKFParticle(OmegaC0CandsMcKF const& omegaC0CandidatesMcKF, + void processMcKFParticleFT0M(OmegaC0CandsMcKF const& omegaC0CandidatesMcKF, Omegac0Gen const& mcParticles, - TracksMc const& tracks, CollisionsWithMcLabels const& collisions, - aod::McCollisions const& mcCollisions) + McCollisionsWithFT0M const& mcCollisions) { - processMc(omegaC0CandidatesMcKF, mcParticles, tracks, collisions, mcCollisions); + processMcCent(omegaC0CandidatesMcKF, mcParticles, collisions, mcCollisions); } - PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processMcWithKFParticle, "Process MC with KFParticle", false); + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processMcKFParticleFT0M, "Process MC with KFParticle, FT0M centrality (from MC)", false); - void processMcWithKFParticleMl(Omegac0CandsMlMcKF const& omegac0CandidatesMlMcKF, + void processMcKFParticleMlFT0M(Omegac0CandsMlMcKF const& omegac0CandidatesMlMcKF, Omegac0Gen const& mcParticles, - TracksMc const& tracks, CollisionsWithMcLabels const& collisions, - aod::McCollisions const& mcCollisions) + McCollisionsWithFT0M const& mcCollisions) { - processMc(omegac0CandidatesMlMcKF, mcParticles, tracks, collisions, mcCollisions); + processMcCent(omegac0CandidatesMlMcKF, mcParticles, collisions, mcCollisions); } - PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processMcWithKFParticleMl, "Process MC with KFParticle and ML selections", false); + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processMcKFParticleMlFT0M, "Process MC with KFParticle, ML selections, FT0M centrality (from MC)", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 3871b78b4e7a684df48e1481a470fc88da85ce96 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 27 Aug 2025 16:42:43 +0200 Subject: [PATCH 216/986] [Infrastructure] Bump oxsecurity/megalinter from 8.7.0 to 8.8.0 (#11628) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/mega-linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mega-linter.yml b/.github/workflows/mega-linter.yml index b1bccfc61ca..1ee6a4d9fce 100644 --- a/.github/workflows/mega-linter.yml +++ b/.github/workflows/mega-linter.yml @@ -38,7 +38,7 @@ jobs: id: ml # You can override MegaLinter flavor used to have faster performances # More info at https://megalinter.io/flavors/ - uses: oxsecurity/megalinter@v8.7.0 + uses: oxsecurity/megalinter@v8.8.0 env: # All available variables are described in documentation: # https://megalinter.io/configuration/ From 7470fad229d8747624e1b1ecc000bd7a5eb9c4e4 Mon Sep 17 00:00:00 2001 From: Sergio Garcia <47090312+singiamtel@users.noreply.github.com> Date: Wed, 27 Aug 2025 16:44:46 +0200 Subject: [PATCH 217/986] [Infrastructure] Fix stale action permissions (#12559) --- .github/workflows/stale.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 24b650f65b5..d96f541d14a 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -5,6 +5,7 @@ on: - cron: "0 0 * * *" permissions: + actions: write issues: write pull-requests: write From 3f270dc621ac019f16bb45abd4ceed135d4d6e02 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 27 Aug 2025 16:45:36 +0200 Subject: [PATCH 218/986] [Infrastructure] Bump actions/checkout from 4 to 5 (#12611) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/mega-linter.yml | 2 +- .github/workflows/o2-linter.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mega-linter.yml b/.github/workflows/mega-linter.yml index 1ee6a4d9fce..f517255f99e 100644 --- a/.github/workflows/mega-linter.yml +++ b/.github/workflows/mega-linter.yml @@ -23,7 +23,7 @@ jobs: steps: # Git Checkout - name: Checkout Code - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: # Checkout the HEAD of the PR instead of the merge commit. ref: ${{ github.event.pull_request.head.sha }} diff --git a/.github/workflows/o2-linter.yml b/.github/workflows/o2-linter.yml index 099209da6e6..ebc4c4d48bf 100644 --- a/.github/workflows/o2-linter.yml +++ b/.github/workflows/o2-linter.yml @@ -30,7 +30,7 @@ jobs: echo BRANCH_HEAD="$branch_head" >> "$GITHUB_ENV" echo BRANCH_BASE="$branch_base" >> "$GITHUB_ENV" - name: Checkout Code - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: ref: ${{ env.BRANCH_HEAD }} fetch-depth: 0 # needed to get the full history From 2bb9e3289e5f3b5abf2a5c87ccb2ea5b8d01c7e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Wed, 27 Aug 2025 16:47:08 +0200 Subject: [PATCH 219/986] [Common] RecoDecay: Fix linter errors. Fix includes. Improve documentation. (#12341) --- Common/Core/RecoDecay.h | 119 +++++++++++++++++++++------------------- 1 file changed, 64 insertions(+), 55 deletions(-) diff --git a/Common/Core/RecoDecay.h b/Common/Core/RecoDecay.h index 5b4464e112a..fcc50d23bf8 100644 --- a/Common/Core/RecoDecay.h +++ b/Common/Core/RecoDecay.h @@ -17,21 +17,20 @@ #ifndef COMMON_CORE_RECODECAY_H_ #define COMMON_CORE_RECODECAY_H_ -// C++ includes -#include // std::find -#include // std::array -#include // std::abs, std::sqrt -#include -#include // std::apply -#include // std::move -#include // std::vector - -// ROOT includes +#include + #include // for VMC Particle Production Process #include // for PDG codes -// O2 includes -#include "CommonConstants/MathConstants.h" +#include // std::find +#include // std::array +#include // std::abs, std::sqrt +#include // std::size_t +#include // intX_t +#include // std::apply +#include // std::decay_t +#include // std::move +#include // std::vector /// Base class for calculating properties of reconstructed decays /// @@ -43,11 +42,18 @@ struct RecoDecay { // mapping of charm-hadron origin type - enum OriginType { None = 0, - Prompt, - NonPrompt }; - - static constexpr int8_t StatusCodeAfterFlavourOscillation = 92; // decay products after B0(s) flavour oscillation + enum OriginType { + None = 0, + Prompt, + NonPrompt + }; + + static constexpr int8_t StatusCodeAfterFlavourOscillation{92}; // decay products after B0(s) flavour oscillation + static constexpr int PdgQuarkMax{8}; // largest quark PDG code; o2-linter: disable=pdg/explicit-code (t' does not have a named constant.) + static constexpr int PdgBosonMin{PDG_t::kGluon}; // smallest boson (gauge or H) PDG code + static constexpr int PdgBosonMax{37}; // largest boson (gauge or H) PDG code; o2-linter: disable=pdg/explicit-code (H+ does not have a named constant.) + static constexpr int PdgDivisorMeson{100}; // order of magnitude of the meson PDG codes + static constexpr int PdgDivisorBaryon{1000}; // order of magnitude of the baryon PDG codes // Auxiliary functions @@ -110,7 +116,7 @@ struct RecoDecay { /// Calculates scalar product of vectors. /// \note Promotes numbers to double to avoid precision loss in float multiplication. - /// \param N dimension + /// \tparam N dimension /// \param vec1,vec2 vectors /// \return scalar product template @@ -137,7 +143,7 @@ struct RecoDecay { } /// Calculates magnitude squared of a vector. - /// \param N dimension + /// \tparam N dimension /// \param vec vector /// \return magnitude squared template @@ -435,7 +441,7 @@ struct RecoDecay { } /// Calculates invariant mass squared from momenta and masses of several particles (prongs). - /// \param N number of prongs + /// \tparam N number of prongs /// \param arrMom array of N 3-momentum arrays /// \param arrMass array of N masses (in the same order as arrMom) /// \return invariant mass squared @@ -445,7 +451,7 @@ struct RecoDecay { std::array momTotal{0., 0., 0.}; // candidate momentum vector double energyTot{0.}; // candidate energy for (std::size_t iProng = 0; iProng < N; ++iProng) { - for (std::size_t iMom = 0; iMom < 3; ++iMom) { + for (std::size_t iMom = 0; iMom < 3; ++iMom) { // o2-linter: disable=magic-number ({x, y, z} coordinates) momTotal[iMom] += arrMom[iProng][iMom]; } // loop over momentum components energyTot += e(arrMom[iProng], arrMass[iProng]); @@ -535,6 +541,7 @@ struct RecoDecay { } /// Finds the mother of an MC particle by looking for the expected PDG code in the mother chain. + /// \tparam acceptFlavourOscillation switch to accept decays where the mother oscillated (e.g. B0 -> B0bar) /// \param particlesMC table with MC particles /// \param particle MC particle /// \param pdgMother expected mother PDG code @@ -613,7 +620,7 @@ struct RecoDecay { } /// Gets the complete list of indices of final-state daughters of an MC particle. - /// \param checkProcess switch to accept only decay daughters by checking the production process of MC particles + /// \tparam checkProcess switch to accept only decay daughters by checking the production process of MC particles /// \param particle MC particle /// \param list vector where the indices of final-state daughters will be added /// \param arrPdgFinal array of PDG codes of particles to be considered final if found @@ -686,7 +693,7 @@ struct RecoDecay { } /// Checks whether the reconstructed decay candidate is the expected decay. - /// \tparam acceptFlavourOscillation switch to accept flavour oscillastion (i.e. B0 -> B0bar -> D+pi-) + /// \tparam acceptFlavourOscillation switch to accept decays where the mother oscillated (e.g. B0 -> B0bar) /// \tparam checkProcess switch to accept only decay daughters by checking the production process of MC particles /// \tparam acceptIncompleteReco switch to accept candidates with only part of the daughters reconstructed /// \tparam acceptTrackDecay switch to accept candidates with daughter tracks of pions and kaons which decayed @@ -750,11 +757,11 @@ struct RecoDecay { auto motherI = particleI.template mothers_first_as(); auto pdgI = std::abs(particleI.pdgCode()); auto pdgMotherI = std::abs(motherI.pdgCode()); - if (pdgI == kMuonMinus && pdgMotherI == kPiPlus) { + if (pdgI == PDG_t::kMuonMinus && pdgMotherI == PDG_t::kPiPlus) { // π → μ nPiToMuLocal++; particleI = motherI; - } else if (pdgI == kPiPlus && pdgMotherI == kKPlus) { + } else if (pdgI == PDG_t::kPiPlus && pdgMotherI == PDG_t::kKPlus) { // K → π nKaToPiLocal++; particleI = motherI; @@ -871,7 +878,8 @@ struct RecoDecay { } /// Checks whether the MC particle is the expected one. - /// \param checkProcess switch to accept only decay daughters by checking the production process of MC particles + /// \tparam acceptFlavourOscillation switch to accept decays where the mother oscillated (e.g. B0 -> B0bar) + /// \tparam checkProcess switch to accept only decay daughters by checking the production process of MC particles /// \param particlesMC table with MC particles /// \param candidate candidate MC particle /// \param pdgParticle expected particle PDG code @@ -890,7 +898,8 @@ struct RecoDecay { } /// Check whether the MC particle is the expected one and whether it decayed via the expected decay channel. - /// \param checkProcess switch to accept only decay daughters by checking the production process of MC particles + /// \tparam acceptFlavourOscillation switch to accept decays where the mother oscillated (e.g. B0 -> B0bar) + /// \tparam checkProcess switch to accept only decay daughters by checking the production process of MC particles /// \param particlesMC table with MC particles /// \param candidate candidate MC particle /// \param pdgParticle expected particle PDG code @@ -1014,7 +1023,7 @@ struct RecoDecay { arrayIds.push_back(initVec); // the first vector contains the index of the original particle auto pdgParticle = std::abs(particle.pdgCode()); bool couldBePrompt = false; - if (pdgParticle / 100 == kCharm || pdgParticle / 1000 == kCharm) { + if (pdgParticle / PdgDivisorMeson == PDG_t::kCharm || pdgParticle / PdgDivisorBaryon == PDG_t::kCharm) { couldBePrompt = true; } while (arrayIds[-stage].size() > 0) { @@ -1024,11 +1033,11 @@ struct RecoDecay { auto particleMother = particlesMC.rawIteratorAt(iPart - particlesMC.offset()); if (particleMother.has_mothers()) { - // we exit immediately if searchUpToQuark is false and the first mother is a parton (an hadron should never be the mother of a parton) + // we exit immediately if searchUpToQuark is false and the first mother is a quark or a boson (a hadron should never be the mother of a parton) if (!searchUpToQuark) { auto mother = particlesMC.rawIteratorAt(particleMother.mothersIds().front() - particlesMC.offset()); auto pdgParticleIMother = std::abs(mother.pdgCode()); // PDG code of the mother - if (pdgParticleIMother < 9 || (pdgParticleIMother > 20 && pdgParticleIMother < 38)) { + if (pdgParticleIMother <= PdgQuarkMax || (pdgParticleIMother >= PdgBosonMin && pdgParticleIMother <= PdgBosonMax)) { return OriginType::Prompt; } } @@ -1047,22 +1056,22 @@ struct RecoDecay { if (searchUpToQuark) { if (idxBhadMothers) { - if (pdgParticleIMother / 100 == kBottom || // b mesons - pdgParticleIMother / 1000 == kBottom) // b baryons + if (pdgParticleIMother / PdgDivisorMeson == PDG_t::kBottom || // b mesons + pdgParticleIMother / PdgDivisorBaryon == PDG_t::kBottom) // b baryons { idxBhadMothers->push_back(iMother); } } - if (pdgParticleIMother == kBottom) { // b quark + if (pdgParticleIMother == PDG_t::kBottom) { // b quark return OriginType::NonPrompt; } - if (pdgParticleIMother == kCharm) { // c quark + if (pdgParticleIMother == PDG_t::kCharm) { // c quark return OriginType::Prompt; } } else { if ( - (pdgParticleIMother / 100 == kBottom || // b mesons - pdgParticleIMother / 1000 == kBottom) // b baryons + (pdgParticleIMother / PdgDivisorMeson == PDG_t::kBottom || // b mesons + pdgParticleIMother / PdgDivisorBaryon == PDG_t::kBottom) // b baryons ) { if (idxBhadMothers) { idxBhadMothers->push_back(iMother); @@ -1070,8 +1079,8 @@ struct RecoDecay { return OriginType::NonPrompt; } if ( - (pdgParticleIMother / 100 == kCharm || // c mesons - pdgParticleIMother / 1000 == kCharm) // c baryons + (pdgParticleIMother / PdgDivisorMeson == PDG_t::kCharm || // c mesons + pdgParticleIMother / PdgDivisorBaryon == PDG_t::kCharm) // c baryons ) { couldBePrompt = true; } @@ -1112,7 +1121,7 @@ struct RecoDecay { arrayIds.push_back(initVec); // the first vector contains the index of the original particle auto pdgParticle = std::abs(particle.pdgCode()); bool couldBeCharm = false; - if (pdgParticle / 100 == kCharm || pdgParticle / 1000 == kCharm) { + if (pdgParticle / PdgDivisorMeson == PDG_t::kCharm || pdgParticle / PdgDivisorBaryon == PDG_t::kCharm) { couldBeCharm = true; } while (arrayIds[-stage].size() > 0) { @@ -1122,21 +1131,21 @@ struct RecoDecay { auto particleMother = particlesMC.rawIteratorAt(iPart - particlesMC.offset()); if (particleMother.has_mothers()) { - // we break immediately if searchUpToQuark is false and the first mother is a parton (an hadron should never be the mother of a parton) + // we break immediately if searchUpToQuark is false and the first mother is a quark or a boson (a hadron should never be the mother of a parton) if (!searchUpToQuark) { auto mother = particlesMC.rawIteratorAt(particleMother.mothersIds().front() - particlesMC.offset()); auto pdgParticleIMother = std::abs(mother.pdgCode()); // PDG code of the mother - if (pdgParticleIMother < 9 || (pdgParticleIMother > 20 && pdgParticleIMother < 38)) { + if (pdgParticleIMother <= PdgQuarkMax || (pdgParticleIMother >= PdgBosonMin && pdgParticleIMother <= PdgBosonMax)) { // auto PDGPaticle = std::abs(particleMother.pdgCode()); if ( - (pdgParticle / 100 == kBottom || // b mesons - pdgParticle / 1000 == kBottom) // b baryons + (pdgParticle / PdgDivisorMeson == PDG_t::kBottom || // b mesons + pdgParticle / PdgDivisorBaryon == PDG_t::kBottom) // b baryons ) { return OriginType::NonPrompt; // beauty } if ( - (pdgParticle / 100 == kCharm || // c mesons - pdgParticle / 1000 == kCharm) // c baryons + (pdgParticle / PdgDivisorMeson == PDG_t::kCharm || // c mesons + pdgParticle / PdgDivisorBaryon == PDG_t::kCharm) // c baryons ) { return OriginType::Prompt; // charm } @@ -1160,22 +1169,22 @@ struct RecoDecay { if (searchUpToQuark) { if (idxBhadMothers) { - if (pdgParticleIMother / 100 == kBottom || // b mesons - pdgParticleIMother / 1000 == kBottom) // b baryons + if (pdgParticleIMother / PdgDivisorMeson == PDG_t::kBottom || // b mesons + pdgParticleIMother / PdgDivisorBaryon == PDG_t::kBottom) // b baryons { idxBhadMothers->push_back(iMother); } } - if (pdgParticleIMother == kBottom) { // b quark - return OriginType::NonPrompt; // beauty + if (pdgParticleIMother == PDG_t::kBottom) { // b quark + return OriginType::NonPrompt; // beauty } - if (pdgParticleIMother == kCharm) { // c quark - return OriginType::Prompt; // charm + if (pdgParticleIMother == PDG_t::kCharm) { // c quark + return OriginType::Prompt; // charm } } else { if ( - (pdgParticleIMother / 100 == kBottom || // b mesons - pdgParticleIMother / 1000 == kBottom) // b baryons + (pdgParticleIMother / PdgDivisorMeson == PDG_t::kBottom || // b mesons + pdgParticleIMother / PdgDivisorBaryon == PDG_t::kBottom) // b baryons ) { if (idxBhadMothers) { idxBhadMothers->push_back(iMother); @@ -1183,8 +1192,8 @@ struct RecoDecay { return OriginType::NonPrompt; // beauty } if ( - (pdgParticleIMother / 100 == kCharm || // c mesons - pdgParticleIMother / 1000 == kCharm) // c baryons + (pdgParticleIMother / PdgDivisorMeson == PDG_t::kCharm || // c mesons + pdgParticleIMother / PdgDivisorBaryon == PDG_t::kCharm) // c baryons ) { couldBeCharm = true; } From c806cad585e7e2b3ce6e48e9a585f6e2da15ff28 Mon Sep 17 00:00:00 2001 From: Mario Ciacco Date: Wed, 27 Aug 2025 18:04:19 +0200 Subject: [PATCH 220/986] [PWGLF] add switch to select only negative charges also in MC (#12759) --- PWGLF/TableProducer/Nuspex/ebyeMaker.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/ebyeMaker.cxx b/PWGLF/TableProducer/Nuspex/ebyeMaker.cxx index 9f01ecdb1a5..8c1c58e272a 100644 --- a/PWGLF/TableProducer/Nuspex/ebyeMaker.cxx +++ b/PWGLF/TableProducer/Nuspex/ebyeMaker.cxx @@ -854,8 +854,11 @@ struct EbyeMaker { continue; auto pdgCode = mcPart.pdgCode(); auto genPt = std::hypot(mcPart.px(), mcPart.py()); - if ((std::abs(pdgCode) == PDG_t::kPiPlus || std::abs(pdgCode) == PDG_t::kElectron || std::abs(pdgCode) == PDG_t::kMuonMinus || std::abs(pdgCode) == PDG_t::kKPlus || std::abs(pdgCode) == PDG_t::kProton) && mcPart.isPhysicalPrimary() && genPt > ptMin[0] && genPt < ptMax[0]) - nChPartGen++; + if ((std::abs(pdgCode) == PDG_t::kPiPlus || std::abs(pdgCode) == PDG_t::kElectron || std::abs(pdgCode) == PDG_t::kMuonMinus || std::abs(pdgCode) == PDG_t::kKPlus || std::abs(pdgCode) == PDG_t::kProton) && mcPart.isPhysicalPrimary() && genPt > ptMin[0] && genPt < ptMax[0]) { + int ch = (pdgCode == PDG_t::kPiPlus || pdgCode == -PDG_t::kElectron || pdgCode == -PDG_t::kMuonMinus || pdgCode == PDG_t::kKPlus || pdgCode == PDG_t::kProton) ? 1 : -1; + if ((ch < 0 && countOnlyNegTrk) || !countOnlyNegTrk) + nChPartGen++; + } if (std::abs(pdgCode) == PDG_t::kLambda0) { if (!mcPart.isPhysicalPrimary() && !mcPart.has_mothers()) continue; From 2ab1d97c3b314ececc1edf5441b6bd898ef481b7 Mon Sep 17 00:00:00 2001 From: Marcello Di Costanzo <96481191+Marcellocosti@users.noreply.github.com> Date: Wed, 27 Aug 2025 18:31:29 +0200 Subject: [PATCH 221/986] [PWGHF] Remove redundant D0 ML selection in D* selector (#12746) --- PWGHF/Core/HfMlResponseDstarToD0Pi.h | 22 -------- .../DataModel/CandidateReconstructionTables.h | 2 - .../candidateSelectorDstarToD0Pi.cxx | 51 +++---------------- 3 files changed, 6 insertions(+), 69 deletions(-) diff --git a/PWGHF/Core/HfMlResponseDstarToD0Pi.h b/PWGHF/Core/HfMlResponseDstarToD0Pi.h index af0351b2a73..c7e43065495 100644 --- a/PWGHF/Core/HfMlResponseDstarToD0Pi.h +++ b/PWGHF/Core/HfMlResponseDstarToD0Pi.h @@ -221,28 +221,6 @@ class HfMlResponseDstarToD0Pi : public HfMlResponse return inputFeatures; } - /// Method to get the input features used for D0 in HF triggers - /// \param candidate is the D* candidate - /// \return inputFeatures vector - template - std::vector getInputFeaturesTrigger(T1 const& candidate) - { - std::vector inputFeatures; - - for (const auto& idx : MlResponse::mCachedIndices) { - switch (idx) { - CHECK_AND_FILL_VEC_DSTAR(ptProng0); - CHECK_AND_FILL_VEC_DSTAR_GETTER(impactParameterXY0, impactParameter0); - CHECK_AND_FILL_VEC_DSTAR(impactParameterZ0); - CHECK_AND_FILL_VEC_DSTAR(ptProng1); - CHECK_AND_FILL_VEC_DSTAR_GETTER(impactParameterXY1, impactParameter1); - CHECK_AND_FILL_VEC_DSTAR(impactParameterZ1); - } - } - - return inputFeatures; - } - protected: /// Method to fill the map of available input features void setAvailableInputFeatures() diff --git a/PWGHF/DataModel/CandidateReconstructionTables.h b/PWGHF/DataModel/CandidateReconstructionTables.h index c24c9badbc3..37c96d5627a 100644 --- a/PWGHF/DataModel/CandidateReconstructionTables.h +++ b/PWGHF/DataModel/CandidateReconstructionTables.h @@ -982,8 +982,6 @@ enum DecayType { DplusToPiKPi = 0, XicToPKPi, N3ProngDecays }; // always keep N3ProngDecays at the end -static constexpr int DstarToPiKPiBkg = DecayType::N3ProngDecays; - // Ds± → K± K∓ π± or D± → K± K∓ π± enum DecayChannelDToKKPi { diff --git a/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx b/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx index bd3cb47b28f..c0c02b6eed6 100644 --- a/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx @@ -97,38 +97,23 @@ struct HfCandidateSelectorDstarToD0Pi { Configurable> cutsMl{"cutsMl", {hf_cuts_ml::Cuts[0], hf_cuts_ml::NBinsPt, hf_cuts_ml::NCutScores, hf_cuts_ml::labelsPt, hf_cuts_ml::labelsCutScore}, "ML selections per pT bin"}; Configurable nClassesMl{"nClassesMl", static_cast(hf_cuts_ml::NCutScores), "Number of classes in ML model"}; Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature1", "feature2"}, "Names of ML model input features"}; - // ML inference D0 - Configurable applyMlD0Daug{"applyMlD0Daug", false, "Flag to apply ML selections on D0 daughter"}; - Configurable> binsPtMlD0Daug{"binsPtMlD0Daug", std::vector{hf_cuts_ml::vecBinsPt}, "pT bin limits for ML application on D0 daughter"}; - Configurable> cutDirMlD0Daug{"cutDirMlD0Daug", std::vector{hf_cuts_ml::vecCutDir}, "Whether to reject score values greater or smaller than the threshold on D0 daughter"}; - Configurable> cutsMlD0Daug{"cutsMlD0Daug", {hf_cuts_ml::Cuts[0], hf_cuts_ml::NBinsPt, hf_cuts_ml::NCutScores, hf_cuts_ml::labelsPt, hf_cuts_ml::labelsCutScore}, "ML selections per pT bin on D0 daughter"}; - Configurable nClassesMlD0Daug{"nClassesMlD0Daug", static_cast(hf_cuts_ml::NCutScores), "Number of classes in ML model on D0 daughter"}; - Configurable> namesInputFeaturesD0Daug{"namesInputFeaturesD0Daug", std::vector{"feature1", "feature2"}, "Names of ML model input features on D0 daughter"}; // CCDB configuration Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable> modelPathsCCDB{"modelPathsCCDB", std::vector{""}, "Paths of models on CCDB"}; - Configurable> modelPathsCCDBD0Daug{"modelPathsCCDBD0Daug", std::vector{""}, "Paths of models on CCDB for D0 daughter"}; Configurable> onnxFileNames{"onnxFileNames", std::vector{"Model.onnx"}, "ONNX file names for each pT bin (if not from CCDB full path)"}; - Configurable> onnxFileNamesD0Daug{"onnxFileNamesD0Daug", std::vector{"Model.onnx"}, "ONNX file names for each pT bin (if not from CCDB full path) for D0 daughter"}; Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"}; Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; - // PDG mass for kaon, pion and D0 - double massD0, massPi, massK; - HfHelper hfHelper; o2::analysis::HfMlResponseDstarToD0Pi hfMlResponse; - o2::analysis::HfMlResponseDstarToD0Pi hfMlResponseD0Daughter; std::vector outputMlDstarToD0Pi = {}; - std::vector outputMlD0ToKPi = {}; o2::ccdb::CcdbApi ccdbApi; TrackSelectorPi selectorPion; TrackSelectorKa selectorKaon; using TracksSel = soa::Join; - // using TracksSel = soa::Join; using HfFullDstarCandidate = soa::Join; AxisSpec axisBdtScore{100, 0.f, 1.f}; @@ -139,9 +124,6 @@ struct HfCandidateSelectorDstarToD0Pi { void init(InitContext&) { - massPi = MassPiPlus; - massK = MassKPlus; - massD0 = MassD0; selectorPion.setRangePtTpc(ptPidTpcMin, ptPidTpcMax); selectorPion.setRangeNSigmaTpc(-nSigmaTpcMax, nSigmaTpcMax); @@ -183,18 +165,6 @@ struct HfCandidateSelectorDstarToD0Pi { hfMlResponse.cacheInputFeaturesIndices(namesInputFeatures); hfMlResponse.init(); } - - if (applyMlD0Daug) { - hfMlResponseD0Daughter.configure(binsPtMlD0Daug, cutsMlD0Daug, cutDirMlD0Daug, nClassesMlD0Daug); - if (loadModelsFromCCDB) { - ccdbApi.init(ccdbUrl); - hfMlResponseD0Daughter.setModelPathsCCDB(onnxFileNamesD0Daug, ccdbApi, modelPathsCCDBD0Daug, timestampCCDB); - } else { - hfMlResponseD0Daughter.setModelPathsLocal(onnxFileNamesD0Daug); - } - hfMlResponseD0Daughter.cacheInputFeaturesIndices(namesInputFeaturesD0Daug); - hfMlResponseD0Daughter.init(); - } } /// Conjugate-independent topological cuts on D0 @@ -258,14 +228,6 @@ struct HfCandidateSelectorDstarToD0Pi { return false; } - if (applyMlD0Daug) { - outputMlD0ToKPi.clear(); - std::vector inputFeaturesD0 = hfMlResponseD0Daughter.getInputFeaturesTrigger(candidate); - bool isSelectedMlD0 = hfMlResponseD0Daughter.isSelectedMl(inputFeaturesD0, candpT, outputMlD0ToKPi); - if (!isSelectedMlD0) { - return false; - } - } return true; } @@ -323,10 +285,10 @@ struct HfCandidateSelectorDstarToD0Pi { if (prongSoftPi.sign() > 0.) { // Selection of D*+ mInvDstar = candidate.invMassDstar(); mInvD0 = candidate.invMassD0(); - if (std::abs(mInvD0 - massD0) > cutsD0->get(binPt, "m")) { + if (std::abs(mInvD0 - MassD0) > cutsD0->get(binPt, "m")) { return false; } - if (useTriggerMassCut && !isCandidateInMassRange(mInvD0, massD0, candidate.ptD0(), hfTriggerCuts)) { + if (useTriggerMassCut && !isCandidateInMassRange(mInvD0, MassD0, candidate.ptD0(), hfTriggerCuts)) { return false; } // cut on daughter pT @@ -351,10 +313,10 @@ struct HfCandidateSelectorDstarToD0Pi { } else if (prongSoftPi.sign() < 0.) { // Selection of D*- mInvAntiDstar = candidate.invMassAntiDstar(); mInvD0Bar = candidate.invMassD0Bar(); - if (std::abs(mInvD0Bar - massD0) > cutsD0->get(binPt, "m")) { + if (std::abs(mInvD0Bar - MassD0) > cutsD0->get(binPt, "m")) { return false; } - if (useTriggerMassCut && !isCandidateInMassRange(mInvD0Bar, massD0, candidate.ptD0(), hfTriggerCuts)) { + if (useTriggerMassCut && !isCandidateInMassRange(mInvD0Bar, MassD0, candidate.ptD0(), hfTriggerCuts)) { return false; } // cut on daughter pT @@ -379,11 +341,11 @@ struct HfCandidateSelectorDstarToD0Pi { // in case only sideband candidates have to be stored, additional invariant-mass cut if (keepOnlySidebandCandidates && prongSoftPi.sign() > 0.) { - if (std::abs((mInvDstar - mInvD0) - massPi) < distanceFromDeltaMassForSidebands) { + if (std::abs((mInvDstar - mInvD0) - MassPiPlus) < distanceFromDeltaMassForSidebands) { return false; } } else if (keepOnlySidebandCandidates && prongSoftPi.sign() < 0.) { - if (std::abs((mInvAntiDstar - mInvD0Bar) - massPi) < distanceFromDeltaMassForSidebands) { + if (std::abs((mInvAntiDstar - mInvD0Bar) - MassPiPlus) < distanceFromDeltaMassForSidebands) { return false; } } @@ -499,7 +461,6 @@ struct HfCandidateSelectorDstarToD0Pi { if (applyMl) { // ML selections bool isSelectedMlDstar = false; - std::vector inputFeatures = hfMlResponse.getInputFeatures(candDstar); isSelectedMlDstar = hfMlResponse.isSelectedMl(inputFeatures, ptCand, outputMlDstarToD0Pi); From 7a104fef0fccd097089db4bd851e5c86000c6306 Mon Sep 17 00:00:00 2001 From: Samuele Cattaruzzi <124249902+scattaru@users.noreply.github.com> Date: Wed, 27 Aug 2025 19:02:33 +0200 Subject: [PATCH 222/986] [DPG] Fix bug with physical primary (#12621) --- DPG/Tasks/ITS/itsImpParStudies.cxx | 37 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/DPG/Tasks/ITS/itsImpParStudies.cxx b/DPG/Tasks/ITS/itsImpParStudies.cxx index 67fba3b4989..7635ed3290a 100644 --- a/DPG/Tasks/ITS/itsImpParStudies.cxx +++ b/DPG/Tasks/ITS/itsImpParStudies.cxx @@ -10,33 +10,32 @@ // or submit itself to any jurisdiction. /// \author Samuele Cattaruzzi -#include - -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "ReconstructionDataFormats/DCA.h" +#include "Common/Core/TrackSelection.h" #include "Common/Core/trackUtilities.h" // for propagation to primary vertex - #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/PIDResponse.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "CommonUtils/NameConf.h" -#include "Framework/AnalysisDataModel.h" -#include "Common/Core/TrackSelection.h" -#include "DetectorsVertexing/PVertexer.h" -#include "ReconstructionDataFormats/Vertex.h" +#include "Common/DataModel/TrackSelectionTables.h" + #include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "Framework/RunningWorkflowInfo.h" #include "CCDB/CcdbApi.h" -#include "DataFormatsCalibration/MeanVertexObject.h" #include "CommonConstants/GeomConstants.h" +#include "CommonUtils/NameConf.h" +#include "DataFormatsCalibration/MeanVertexObject.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "DetectorsVertexing/PVertexer.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/RunningWorkflowInfo.h" +#include "ReconstructionDataFormats/DCA.h" +#include "ReconstructionDataFormats/Vertex.h" #include "iostream" -#include "vector" #include "set" +#include "vector" +#include using namespace o2::framework; using namespace o2::framework::expressions; @@ -490,7 +489,7 @@ struct ItsImpactParStudies { continue; } auto particle = track.mcParticle(); - if (keepOnlyPhysPrimary && particle.isPhysicalPrimary()) { + if (keepOnlyPhysPrimary && !(particle.isPhysicalPrimary())) { continue; } histograms.fill(HIST("MC/ptMC"), particle.pt()); From 59344719eb927fc10f3140e1827e7c05d94e618d Mon Sep 17 00:00:00 2001 From: sarjeetagami <162087855+sarjeetagami@users.noreply.github.com> Date: Thu, 28 Aug 2025 00:27:02 +0530 Subject: [PATCH 223/986] [PWGLF] optimized phi analysis code (#12767) Co-authored-by: sarjeeta gami --- .../Tasks/Resonances/phianalysisrun3_PbPb.cxx | 265 ++++++++++-------- 1 file changed, 145 insertions(+), 120 deletions(-) diff --git a/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx b/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx index b1d5e088685..8afb4e0ab5a 100644 --- a/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx +++ b/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx @@ -101,8 +101,8 @@ struct phianalysisrun3_PbPb { Configurable ispTdepPID{"ispTdepPID", true, "pT dependent PID"}; Configurable cfgITScluster{"cfgITScluster", 0, "Number of ITS cluster"}; Configurable confRapidity{"confRapidity", 0.5, "Rapidity cut"}; - Configurable rapiditycut1{"rapiditycut1", -1.0f, "Rapidity cut lower"}; - Configurable rapiditycut2{"rapiditycut2", 1.0f, "Rapidity cut upper"}; + Configurable rapiditycut1{"rapiditycut1", -0.5f, "Rapidity cut lower"}; + Configurable rapiditycut2{"rapiditycut2", 0.5f, "Rapidity cut upper"}; Configurable timFrameEvsel{"timFrameEvsel", false, "TPC Time frame boundary cut"}; Configurable isDeepAngle{"isDeepAngle", false, "Deep Angle cut"}; Configurable cfgDeepAngle{"cfgDeepAngle", 0.04, "Deep Angle cut value"}; @@ -112,6 +112,9 @@ struct phianalysisrun3_PbPb { Configurable confMaxRot{"confMaxRot", 7.0f * TMath::Pi() / 6.0f, "Maximum of rotation"}; Configurable pdgcheck{"pdgcheck", true, "pdgcheck"}; Configurable reco{"reco", true, "reco"}; + ConfigurableAxis ptAxiphi{"ptAxisphi", {200, 0.0f, 30.0f}, "phi pT axis"}; + ConfigurableAxis centAxiphi{"centAxisphi", {200, 0.0, 200.0}, "phi pT axis"}; + ConfigurableAxis massAxiphi{"massAxisphi", {200, 0.9, 1.1}, "phi pT axis"}; ConfigurableAxis binsImpactPar{"binsImpactPar", {VARIABLE_WIDTH, 0, 3.5, 5.67, 7.45, 8.85, 10.0, 11.21, 12.26, 13.28, 14.23, 15.27}, "Binning of the impact parameter axis"}; ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 10.0, 12.0}, "Binning of the pT axis"}; ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"}; @@ -128,68 +131,113 @@ struct phianalysisrun3_PbPb { AxisSpec impactParAxis = {binsImpactPar, "Impact Parameter"}; AxisSpec ptAxis = {binsPt, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec centAxis = {binsCent, "V0M (%)"}; - histos.add("hCentrality", "Centrality distribution", kTH1F, {{200, 0.0, 200.0}}); - histos.add("hVtxZ", "Vertex distribution in Z;Z (cm)", kTH1F, {{400, -20.0, 20.0}}); - histos.add("hOccupancy", "Occupancy distribution", kTH1F, {{500, 0, 50000}}); - histos.add("hEvtSelInfo", "hEvtSelInfo", kTH1F, {{10, 0, 10.0}}); if (!isMC) { - histos.add("h3PhiInvMassUnlikeSign", "Invariant mass of Phi meson Unlike Sign", kTH3F, {{200, 0.0, 200.0}, {200, 0.0f, 20.0f}, {200, 0.9, 1.1}}); - histos.add("h3PhiInvMassMixed", "Invariant mass of Phi meson Mixed", kTH3F, {{200, 0.0, 200.0}, {200, 0.0f, 20.0f}, {200, 0.9, 1.1}}); - histos.add("h3PhiInvMassRot", "Invariant mass of Phi meson Rotation", kTH3F, {{200, 0.0, 200.0}, {200, 0.0f, 20.0f}, {200, 0.9, 1.1}}); - histos.add("h3PhiInvMassSame", "Invariant mass of Phi meson same", kTH3F, {{200, 0.0, 200.0}, {200, 0.0f, 20.0f}, {200, 0.9, 1.1}}); - histos.add("h2PhiRapidity", "phi meson Rapidity", kTH2F, {{200, 0.0f, 20.0f}, {200, -4, 4}}); + histos.add("hCentrality", "Centrality distribution", kTH1F, {centAxiphi}); + histos.add("hVtxZ", "Vertex distribution in Z;Z (cm)", kTH1F, {{400, -20.0, 20.0}}); + histos.add("hOccupancy", "Occupancy distribution", kTH1F, {{500, 0, 50000}}); + histos.add("hEvtSelInfo", "hEvtSelInfo", kTH1F, {{10, 0, 10.0}}); + histos.add("h3PhiInvMassUnlikeSign", "Invariant mass of Phi meson Unlike Sign", kTH3F, {centAxiphi, ptAxiphi, massAxiphi}); + histos.add("h3PhiInvMassMixed", "Invariant mass of Phi meson Mixed", kTH3F, {centAxiphi, ptAxiphi, massAxiphi}); + histos.add("h3PhiInvMassRot", "Invariant mass of Phi meson Rotation", kTH3F, {centAxiphi, ptAxiphi, massAxiphi}); + histos.add("h3PhiInvMassSame", "Invariant mass of Phi meson same", kTH3F, {centAxiphi, ptAxiphi, massAxiphi}); + histos.add("h2PhiRapidity", "phi meson Rapidity", kTH2F, {ptAxiphi, {200, -4, 4}}); + histos.add("hEta", "eta of kaon track candidates", HistType::kTH2F, {{200, -1.0f, 1.0f}, ptAxiphi}); + histos.add("hPhi", "phi of kaon track candidates", HistType::kTH2F, {{65, 0, 6.5}, ptAxiphi}); + + // DCA QA + // DCA histograms: separate for positive and negative kaons, range [-1.0, 1.0] + histos.add("QAbefore/trkDCAxy_pos", "DCAxy distribution of positive kaon track candidates", HistType::kTH1F, {{150, -1.0f, 1.0f}}); + histos.add("QAbefore/trkDCAxy_neg", "DCAxy distribution of negative kaon track candidates", HistType::kTH1F, {{150, -1.0f, 1.0f}}); + histos.add("QAbefore/trkDCAz_pos", "DCAz distribution of positive kaon track candidates", HistType::kTH1F, {{150, -1.0f, 1.0f}}); + histos.add("QAbefore/trkDCAz_neg", "DCAz distribution of negative kaon track candidates", HistType::kTH1F, {{150, -1.0f, 1.0f}}); + + histos.add("QAbefore/trkDCAxypt_pos", "DCAxy distribution of positive kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, ptAxiphi}); + histos.add("QAbefore/trkDCAxypt_neg", "DCAxy distribution of negative kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, ptAxiphi}); + histos.add("QAbefore/trkDCAzpt_pos", "DCAz distribution of positive kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, ptAxiphi}); + histos.add("QAbefore/trkDCAzpt_neg", "DCAz distribution of negative kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, ptAxiphi}); + + histos.add("QAafter/trkDCAxy_pos", "DCAxy distribution of positive kaon track candidates", HistType::kTH1F, {{150, -1.0f, 1.0f}}); + histos.add("QAafter/trkDCAxy_neg", "DCAxy distribution of negative kaon track candidates", HistType::kTH1F, {{150, -1.0f, 1.0f}}); + histos.add("QAafter/trkDCAz_pos", "DCAz distribution of positive kaon track candidates", HistType::kTH1F, {{150, -1.0f, 1.0f}}); + histos.add("QAafter/trkDCAz_neg", "DCAz distribution of negative kaon track candidates", HistType::kTH1F, {{150, -1.0f, 1.0f}}); + + histos.add("QAafter/trkDCAxypt_pos", "DCAxy distribution of positive kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, ptAxiphi}); + histos.add("QAafter/trkDCAxypt_neg", "DCAxy distribution of negative kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, ptAxiphi}); + histos.add("QAafter/trkDCAzpt_pos", "DCAz distribution of positive kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, ptAxiphi}); + histos.add("QAafter/trkDCAzpt_neg", "DCAz distribution of negative kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, ptAxiphi}); + // PID QA before cuts + histos.add("QAbefore/TOF_TPC_Mapka_all_pos", "TOF + TPC Combined PID for positive Kaon;#sigma_{TOF}^{K^{+}};#sigma_{TPC}^{K^{+}}", {HistType::kTH2D, {{100, -6, 6}, {100, -6, 6}}}); + histos.add("QAbefore/TOF_TPC_Mapka_all_neg", "TOF + TPC Combined PID for negative Kaon;#sigma_{TOF}^{K^{-}};#sigma_{TPC}^{K^{-}}", {HistType::kTH2D, {{100, -6, 6}, {100, -6, 6}}}); + + histos.add("QAbefore/TOF_Nsigma_all_pos", "TOF NSigma for positive Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{K^{+}}", {HistType::kTH3D, {{200, -12, 12}, centAxiphi, ptAxiphi}}); + histos.add("QAbefore/TOF_Nsigma_all_neg", "TOF NSigma for negative Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{K^{-}}", {HistType::kTH3D, {{200, -12, 12}, centAxiphi, ptAxiphi}}); + + histos.add("QAbefore/TPC_Nsigma_all_pos", "TPC NSigma for positive Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{K^{+}}", {HistType::kTH3D, {{200, -12, 12}, centAxiphi, ptAxiphi}}); + histos.add("QAbefore/TPC_Nsigma_all_neg", "TPC NSigma for negative Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{K^{-}}", {HistType::kTH3D, {{200, -12, 12}, centAxiphi, ptAxiphi}}); + + // PID QA after cuts + histos.add("QAafter/TOF_TPC_Mapka_all_pos", "TOF + TPC Combined PID for positive Kaon;#sigma_{TOF}^{K^{+}};#sigma_{TPC}^{K^{+}}", {HistType::kTH2D, {{100, -6, 6}, {100, -6, 6}}}); + histos.add("QAafter/TOF_TPC_Mapka_all_neg", "TOF + TPC Combined PID for negative Kaon;#sigma_{TOF}^{K^{-}};#sigma_{TPC}^{K^{-}}", {HistType::kTH2D, {{100, -6, 6}, {100, -6, 6}}}); + + histos.add("QAafter/TOF_Nsigma_all_pos", "TOF NSigma for positive Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{K^{+}}", {HistType::kTH3D, {{200, -12, 12}, centAxiphi, ptAxiphi}}); + histos.add("QAafter/TOF_Nsigma_all_neg", "TOF NSigma for negative Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{K^{-}}", {HistType::kTH3D, {{200, -12, 12}, centAxiphi, ptAxiphi}}); + + histos.add("QAafter/TPC_Nsigma_all_pos", "TPC NSigma for positive Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{K^{+}}", {HistType::kTH3D, {{200, -12, 12}, centAxiphi, ptAxiphi}}); + histos.add("QAafter/TPC_Nsigma_all_neg", "TPC NSigma for negative Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{K^{-}}", {HistType::kTH3D, {{200, -12, 12}, centAxiphi, ptAxiphi}}); } else if (isMC) { - histos.add("hMC", "MC Event statistics", kTH1F, {{10, 0.0f, 10.0f}}); + histos.add("hMC", "MC Event statistics", kTH1F, {{15, 0.0f, 15.0f}}); histos.add("EL1", "MC Event statistics", kTH1F, {impactParAxis}); histos.add("EL2", "MC Event statistics", kTH1F, {centAxis}); histos.add("ES1", "MC Event statistics", kTH1F, {impactParAxis}); histos.add("ES3", "MC Event statistics", kTH1F, {impactParAxis}); histos.add("ES2", "MC Event statistics", kTH1F, {centAxis}); histos.add("ES4", "MC Event statistics", kTH1F, {centAxis}); - histos.add("h1PhiGen", "Phi meson Gen", kTH1F, {{200, 0.0f, 20.0f}}); - histos.add("h1PhiGen1", "Phi meson Gen", kTH1F, {{200, 0.0f, 20.0f}}); - histos.add("h1PhiRecsplit", "Phi meson Rec split", kTH1F, {{200, 0.0f, 20.0f}}); - histos.add("Centrec", "MC Centrality", kTH1F, {{200, 0.0, 200.0}}); - histos.add("Centgen", "MC Centrality", kTH1F, {{200, 0.0, 200.0}}); + histos.add("h1PhiGen", "Phi meson Gen", kTH1F, {ptAxiphi}); + histos.add("h1PhiGen1", "Phi meson Gen", kTH1F, {ptAxiphi}); + histos.add("h1PhiRecsplit", "Phi meson Rec split", kTH1F, {ptAxiphi}); + histos.add("Centrec", "MC Centrality", kTH1F, {centAxiphi}); + histos.add("Centgen", "MC Centrality", kTH1F, {centAxiphi}); histos.add("hVtxZgen", "Vertex distribution in Z;Z (cm)", kTH1F, {{400, -20.0, 20.0}}); histos.add("hVtxZrec", "Vertex distribution in Z;Z (cm)", kTH1F, {{400, -20.0, 20.0}}); - histos.add("h2PhiRec2", "Phi meson Rec", kTH2F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}}); - histos.add("h3PhiRec3", "Phi meson Rec", kTH3F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}, {200, 0.9, 1.1}}); - histos.add("h3Phi1Rec3", "Phi meson Rec", kTH3F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}, {200, 0.9, 1.1}}); - histos.add("h3PhiGen3", "Phi meson Gen", kTH3F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}, {200, 0.9, 1.1}}); - histos.add("h3PhiInvMassMixedMC", "Invariant mass of Phi meson Mixed", kTH3F, {{200, 0.0, 200.0}, {200, 0.0f, 20.0f}, {200, 0.9, 1.1}}); - histos.add("h3PhiInvMassSameMC", "Invariant mass of Phi meson same", kTH3F, {{200, 0.0, 200.0}, {200, 0.0f, 20.0f}, {200, 0.9, 1.1}}); - histos.add("h3PhiInvMassRotMC", "Invariant mass of Phi meson Rotation", kTH3F, {{200, 0.0, 200.0}, {200, 0.0f, 20.0f}, {200, 0.9, 1.1}}); - histos.add("h2PhiGen2", "Phi meson gen", kTH2F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}}); + histos.add("h2PhiRec2", "Phi meson Rec", kTH2F, {ptAxiphi, centAxiphi}); + histos.add("h3PhiRec3", "Phi meson Rec", kTH3F, {ptAxiphi, centAxiphi, massAxiphi}); + histos.add("h3Phi1Rec3", "Phi meson Rec", kTH3F, {ptAxiphi, centAxiphi, massAxiphi}); + histos.add("h3PhiGen3", "Phi meson Gen", kTH3F, {ptAxiphi, centAxiphi, massAxiphi}); + histos.add("h3PhiInvMassMixedMC", "Invariant mass of Phi meson Mixed", kTH3F, {centAxiphi, ptAxiphi, massAxiphi}); + histos.add("h3PhiInvMassSameMC", "Invariant mass of Phi meson same", kTH3F, {centAxiphi, ptAxiphi, massAxiphi}); + histos.add("h3PhiInvMassRotMC", "Invariant mass of Phi meson Rotation", kTH3F, {centAxiphi, ptAxiphi, massAxiphi}); + histos.add("h2PhiGen2", "Phi meson gen", kTH2F, {ptAxiphi, centAxiphi}); histos.add("h2PhiGen1", "Phi meson gen", kTH2F, {ptAxis, impactParAxis}); - histos.add("h1PhiRec1", "Phi meson Rec", kTH1F, {{200, 0.0f, 20.0f}}); - histos.add("h1Phimassgen", "Phi meson gen", kTH1F, {{200, 0.9, 1.1}}); - histos.add("h1Phimassrec", "Phi meson Rec", kTH1F, {{200, 0.9, 1.1}}); - histos.add("h1Phimasssame", "Phi meson Rec", kTH1F, {{200, 0.9, 1.1}}); - histos.add("h1Phimassmix", "Phi meson Rec", kTH1F, {{200, 0.9, 1.1}}); - histos.add("h1Phimassrot", "Phi meson Rec", kTH1F, {{200, 0.9, 1.1}}); - histos.add("h1Phi1massrec", "Phi meson Rec", kTH1F, {{200, 0.9, 1.1}}); - histos.add("h1Phipt", "Phi meson Rec", kTH1F, {{200, 0.0f, 20.0f}}); + histos.add("h1PhiRec1", "Phi meson Rec", kTH1F, {ptAxiphi}); + histos.add("h1Phimassgen", "Phi meson gen", kTH1F, {massAxiphi}); + histos.add("h1Phimassrec", "Phi meson Rec", kTH1F, {massAxiphi}); + histos.add("h1Phimasssame", "Phi meson Rec", kTH1F, {massAxiphi}); + histos.add("h1Phimassmix", "Phi meson Rec", kTH1F, {massAxiphi}); + histos.add("h1Phimassrot", "Phi meson Rec", kTH1F, {massAxiphi}); + histos.add("h1Phi1massrec", "Phi meson Rec", kTH1F, {massAxiphi}); + histos.add("h1Phipt", "Phi meson Rec", kTH1F, {ptAxiphi}); histos.add("hOccupancy1", "Occupancy distribution", kTH1F, {{500, 0, 50000}}); - histos.add("h1PhifinalRec", "Phi meson Rec", kTH1F, {{200, 0.0f, 20.0f}}); - histos.add("h1Phifinalgenmass", "Phi meson gen mass", kTH1F, {{200, 0.9, 1.1}}); - histos.add("h3PhifinalRec", "Phi meson Rec", kTH3F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}, {200, 0.9, 1.1}}); - histos.add("h1PhifinalGen", "Phi meson Gen", kTH1F, {{200, 0.0f, 20.0f}}); - histos.add("h2PhifinalGen", "Phi meson Gen", kTH2F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}}); + histos.add("h1PhifinalRec", "Phi meson Rec", kTH1F, {ptAxiphi}); + histos.add("h1Phifinalgenmass", "Phi meson gen mass", kTH1F, {massAxiphi}); + histos.add("h3PhifinalRec", "Phi meson Rec", kTH3F, {ptAxiphi, centAxiphi, massAxiphi}); + histos.add("h1PhifinalGen", "Phi meson Gen", kTH1F, {ptAxiphi}); + histos.add("h2PhifinalGen", "Phi meson Gen", kTH2F, {ptAxiphi, centAxiphi}); histos.add("hMC1", "MC Event statistics", kTH1F, {{15, 0.0f, 15.0f}}); - histos.add("Centrec1", "MC Centrality", kTH1F, {{200, 0.0, 200.0}}); - histos.add("Centgen1", "MC Centrality", kTH1F, {{200, 0.0, 200.0}}); - histos.add("h1PhiRecsplit1", "Phi meson Rec split", kTH1F, {{200, 0.0f, 20.0f}}); + histos.add("Centrec1", "MC Centrality", kTH1F, {centAxiphi}); + histos.add("Centsame", "MC Centrality", kTH1F, {centAxiphi}); + histos.add("Centmix", "MC Centrality", kTH1F, {centAxiphi}); + histos.add("Centgen1", "MC Centrality", kTH1F, {centAxiphi}); + histos.add("h1PhiRecsplit1", "Phi meson Rec split", kTH1F, {ptAxiphi}); histos.add("hImpactParameterGen", "Impact parameter of generated MC events", kTH1F, {impactParAxis}); histos.add("hImpactParameterRec", "Impact parameter of generated MC events", kTH1F, {impactParAxis}); histos.add("hImpactParameterGenCen", "Impact parameter of generated MC events", kTH2F, {impactParAxis, centAxis}); histos.add("hImpactParameterRecCen", "Impact parameter of generated MC events", kTH2F, {impactParAxis, centAxis}); - histos.add("TOF_Nsigma_MC", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, {200, 0.0, 200.0}, {200, 0.0f, 20.0f}}}); - histos.add("TPC_Nsigma_MC", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, {200, 0.0, 200.0}, {200, 0.0f, 20.0f}}}); - histos.add("TOF_Nsigma1_MC", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, {200, 0.0, 200.0}, {200, 0.0f, 20.0f}}}); - histos.add("TPC_Nsigma1_MC", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, {200, 0.0, 200.0}, {200, 0.0f, 20.0f}}}); - histos.add("trkDCAxy", "DCAxy distribution of positive kaon track candidates", HistType::kTH1F, {{150, -1.0f, 1.0f}}); - histos.add("trkDCAz", "DCAxy distribution of negative kaon track candidates", HistType::kTH1F, {{150, -1.0f, 1.0f}}); + histos.add("TOF_Nsigma_MC", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, centAxiphi, ptAxiphi}}); + histos.add("TPC_Nsigma_MC", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, centAxiphi, ptAxiphi}}); + histos.add("TOF_Nsigma1_MC", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, centAxiphi, ptAxiphi}}); + histos.add("TPC_Nsigma1_MC", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, centAxiphi, ptAxiphi}}); + histos.add("trkDCAxy", "DCAxy distribution of positive kaon track candidates", HistType::kTH3F, {{150, -1.0f, 1.0f}, centAxiphi, ptAxiphi}); + histos.add("trkDCAz", "DCAxy distribution of negative kaon track candidates", HistType::kTH3F, {{150, -1.0f, 1.0f}, centAxiphi, ptAxiphi}); if (doprocessEvtLossSigLossMC) { histos.add("QAevent/hImpactParameterGen", "Impact parameter of generated MC events", kTH1F, {impactParAxis}); histos.add("QAevent/hImpactParameterRec", "Impact parameter of selected MC events", kTH1F, {impactParAxis}); @@ -198,50 +246,6 @@ struct phianalysisrun3_PbPb { histos.add("QAevent/phigenAfterEvtSel", "phi after event selections", kTH2F, {ptAxis, impactParAxis}); } } - - histos.add("hEta", "eta of kaon track candidates", HistType::kTH2F, {{200, -1.0f, 1.0f}, {200, 0.0f, 20.0f}}); - histos.add("hPhi", "phi of kaon track candidates", HistType::kTH2F, {{65, 0, 6.5}, {200, 0.0f, 20.0f}}); - - // DCA QA - // DCA histograms: separate for positive and negative kaons, range [-1.0, 1.0] - histos.add("QAbefore/trkDCAxy_pos", "DCAxy distribution of positive kaon track candidates", HistType::kTH1F, {{150, -1.0f, 1.0f}}); - histos.add("QAbefore/trkDCAxy_neg", "DCAxy distribution of negative kaon track candidates", HistType::kTH1F, {{150, -1.0f, 1.0f}}); - histos.add("QAbefore/trkDCAz_pos", "DCAz distribution of positive kaon track candidates", HistType::kTH1F, {{150, -1.0f, 1.0f}}); - histos.add("QAbefore/trkDCAz_neg", "DCAz distribution of negative kaon track candidates", HistType::kTH1F, {{150, -1.0f, 1.0f}}); - - histos.add("QAbefore/trkDCAxypt_pos", "DCAxy distribution of positive kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, {200, 0.0f, 20.0f}}); - histos.add("QAbefore/trkDCAxypt_neg", "DCAxy distribution of negative kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, {200, 0.0f, 20.0f}}); - histos.add("QAbefore/trkDCAzpt_pos", "DCAz distribution of positive kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, {200, 0.0f, 20.0f}}); - histos.add("QAbefore/trkDCAzpt_neg", "DCAz distribution of negative kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, {200, 0.0f, 20.0f}}); - - histos.add("QAafter/trkDCAxy_pos", "DCAxy distribution of positive kaon track candidates", HistType::kTH1F, {{150, -1.0f, 1.0f}}); - histos.add("QAafter/trkDCAxy_neg", "DCAxy distribution of negative kaon track candidates", HistType::kTH1F, {{150, -1.0f, 1.0f}}); - histos.add("QAafter/trkDCAz_pos", "DCAz distribution of positive kaon track candidates", HistType::kTH1F, {{150, -1.0f, 1.0f}}); - histos.add("QAafter/trkDCAz_neg", "DCAz distribution of negative kaon track candidates", HistType::kTH1F, {{150, -1.0f, 1.0f}}); - - histos.add("QAafter/trkDCAxypt_pos", "DCAxy distribution of positive kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, {200, 0.0f, 20.0f}}); - histos.add("QAafter/trkDCAxypt_neg", "DCAxy distribution of negative kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, {200, 0.0f, 20.0f}}); - histos.add("QAafter/trkDCAzpt_pos", "DCAz distribution of positive kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, {200, 0.0f, 20.0f}}); - histos.add("QAafter/trkDCAzpt_neg", "DCAz distribution of negative kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, {200, 0.0f, 20.0f}}); - // PID QA before cuts - histos.add("QAbefore/TOF_TPC_Mapka_all_pos", "TOF + TPC Combined PID for positive Kaon;#sigma_{TOF}^{K^{+}};#sigma_{TPC}^{K^{+}}", {HistType::kTH2D, {{100, -6, 6}, {100, -6, 6}}}); - histos.add("QAbefore/TOF_TPC_Mapka_all_neg", "TOF + TPC Combined PID for negative Kaon;#sigma_{TOF}^{K^{-}};#sigma_{TPC}^{K^{-}}", {HistType::kTH2D, {{100, -6, 6}, {100, -6, 6}}}); - - histos.add("QAbefore/TOF_Nsigma_all_pos", "TOF NSigma for positive Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{K^{+}}", {HistType::kTH3D, {{200, -12, 12}, {200, 0.0, 200.0}, {200, 0.0f, 20.0f}}}); - histos.add("QAbefore/TOF_Nsigma_all_neg", "TOF NSigma for negative Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{K^{-}}", {HistType::kTH3D, {{200, -12, 12}, {200, 0.0, 200.0}, {200, 0.0f, 20.0f}}}); - - histos.add("QAbefore/TPC_Nsigma_all_pos", "TPC NSigma for positive Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{K^{+}}", {HistType::kTH3D, {{200, -12, 12}, {200, 0.0, 200.0}, {200, 0.0f, 20.0f}}}); - histos.add("QAbefore/TPC_Nsigma_all_neg", "TPC NSigma for negative Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{K^{-}}", {HistType::kTH3D, {{200, -12, 12}, {200, 0.0, 200.0}, {200, 0.0f, 20.0f}}}); - - // PID QA after cuts - histos.add("QAafter/TOF_TPC_Mapka_all_pos", "TOF + TPC Combined PID for positive Kaon;#sigma_{TOF}^{K^{+}};#sigma_{TPC}^{K^{+}}", {HistType::kTH2D, {{100, -6, 6}, {100, -6, 6}}}); - histos.add("QAafter/TOF_TPC_Mapka_all_neg", "TOF + TPC Combined PID for negative Kaon;#sigma_{TOF}^{K^{-}};#sigma_{TPC}^{K^{-}}", {HistType::kTH2D, {{100, -6, 6}, {100, -6, 6}}}); - - histos.add("QAafter/TOF_Nsigma_all_pos", "TOF NSigma for positive Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{K^{+}}", {HistType::kTH3D, {{200, -12, 12}, {200, 0.0, 200.0}, {200, 0.0f, 20.0f}}}); - histos.add("QAafter/TOF_Nsigma_all_neg", "TOF NSigma for negative Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{K^{-}}", {HistType::kTH3D, {{200, -12, 12}, {200, 0.0, 200.0}, {200, 0.0f, 20.0f}}}); - - histos.add("QAafter/TPC_Nsigma_all_pos", "TPC NSigma for positive Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{K^{+}}", {HistType::kTH3D, {{200, -12, 12}, {200, 0.0, 200.0}, {200, 0.0f, 20.0f}}}); - histos.add("QAafter/TPC_Nsigma_all_neg", "TPC NSigma for negative Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{K^{-}}", {HistType::kTH3D, {{200, -12, 12}, {200, 0.0, 200.0}, {200, 0.0f, 20.0f}}}); } double massKa = o2::constants::physics::MassKPlus; @@ -387,7 +391,7 @@ struct phianalysisrun3_PbPb { aod::McTrackLabels>>; using CollisionMCTrueTable = aod::McCollisions; using TrackMCTrueTable = aod::McParticles; - using CollisionMCRecTableCentFT0C = soa::SmallGroups>; + using CollisionMCRecTableCentFT0C = soa::SmallGroups>; using TrackMCRecTable = soa::Join; using FilTrackMCRecTable = soa::Filtered; @@ -919,33 +923,61 @@ struct phianalysisrun3_PbPb { histos.fill(HIST("hMC"), 2); return; } - for (const auto& RecCollision : RecCollisions) { + for (auto& RecCollision : RecCollisions) { histos.fill(HIST("hMC"), 3); - if (!RecCollision.sel8()) { - histos.fill(HIST("hMC"), 4); + if (!RecCollision.sel8() || std::abs(RecCollision.posZ()) > cfgCutVertex) { continue; } - if (timFrameEvsel && (!RecCollision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !RecCollision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { - histos.fill(HIST("hMC"), 5); + histos.fill(HIST("hMC"), 4); + if (additionalEvSel1 && !RecCollision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { continue; } - if (additionalEvSel2 && (!RecCollision.selection_bit(aod::evsel::kNoSameBunchPileup) || !RecCollision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { + histos.fill(HIST("hMC"), 5); + if (additionalEvSel2 && !RecCollision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { continue; } + histos.fill(HIST("hMC"), 6); + if (additionalEvSel3 && !RecCollision.selection_bit(aod::evsel::kNoSameBunchPileup)) { + continue; + } + histos.fill(HIST("hMC"), 7); + if (additionalEvSel4 && !RecCollision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + continue; + } + histos.fill(HIST("hMC"), 8); + if (additionalEvSel5 && !RecCollision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + continue; + } + histos.fill(HIST("hMC"), 9); + if (additionalEvSel6 && !RecCollision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + continue; + } + histos.fill(HIST("hMC"), 10); int occupancy = RecCollision.trackOccupancyInTimeRange(); if (fillOccupancy && (occupancy > cfgCutOccupancy)) { continue; } - if (std::abs(RecCollision.posZ()) > cfgCutVertex) { - histos.fill(HIST("hMC"), 6); - continue; + histos.fill(HIST("hMC"), 11); + const int kCentFT0C = 0; + const int kCentFT0A = 1; + const int kCentFT0M = 2; + const int kCentFV0A = 3; + auto centrality = -1.0; + if (centestimator == kCentFT0C) { + centrality = RecCollision.centFT0C(); + } else if (centestimator == kCentFT0A) { + centrality = RecCollision.centFT0A(); + } else if (centestimator == kCentFT0M) { + centrality = RecCollision.centFT0M(); + } else if (centestimator == kCentFV0A) { + centrality = RecCollision.centFV0A(); } - histos.fill(HIST("hMC"), 7); - auto centrality = RecCollision.centFT0C(); + auto oldindex = -999; auto rectrackspart = RecTracks.sliceBy(perCollision, RecCollision.globalIndex()); // loop over reconstructed particle - for (const auto& track1 : rectrackspart) { + int ntrack1 = 0; + for (auto& track1 : rectrackspart) { if (!selectionTrack(track1)) { continue; } @@ -959,7 +991,8 @@ struct phianalysisrun3_PbPb { continue; } auto track1ID = track1.index(); - for (const auto& track2 : rectrackspart) { + ntrack1 = ntrack1 + 1; + for (auto& track2 : rectrackspart) { auto track2ID = track2.index(); if (track2ID <= track1ID) { continue; @@ -1003,27 +1036,16 @@ struct phianalysisrun3_PbPb { if (mothertrack1 != mothertrack2) { continue; } - if (std::abs(mothertrack1.y()) > confRapidity) { - continue; - } if (pdgcheck && std::abs(mothertrack1.pdgCode()) != o2::constants::physics::kPhi) { continue; } - if (!ispTdepPID && (!selectionPID(track1) || !selectionPID(track2))) { - continue; - } - if (ispTdepPID && (!selectionPIDpTdependent(track1) || !selectionPIDpTdependent(track2))) { - continue; - } if (avoidsplitrackMC && oldindex == mothertrack1.globalIndex()) { histos.fill(HIST("h1PhiRecsplit"), mothertrack1.pt()); continue; } oldindex = mothertrack1.globalIndex(); - if (track1.sign() * track2.sign() < 0) { - kaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); - kaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); - } + kaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); + kaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); phiMesonMother = kaonPlus + kaonMinus; if (std::abs(phiMesonMother.Rapidity()) > confRapidity) { @@ -1034,6 +1056,7 @@ struct phianalysisrun3_PbPb { histos.fill(HIST("h1Phimassrec"), phiMesonMother.M()); histos.fill(HIST("h3PhiRec3"), phiMesonMother.pt(), centrality, phiMesonMother.M()); histos.fill(HIST("Centrec"), centrality); + histos.fill(HIST("hVtxZrec"), RecCollision.posZ()); } } } @@ -1324,6 +1347,7 @@ struct phianalysisrun3_PbPb { } float multiplicity{-1}; multiplicity = collision.centFT0C(); + histos.fill(HIST("Centsame"), multiplicity); for (const auto& track1 : tracks) { if (!selectionTrack(track1)) { continue; @@ -1422,6 +1446,7 @@ struct phianalysisrun3_PbPb { continue; } auto multiplicity = c1.centFT0C(); + histos.fill(HIST("Centmix"), multiplicity); for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { histos.fill(HIST("hMC"), 6.5); if (!selectionTrack(t1)) { @@ -1667,8 +1692,8 @@ struct phianalysisrun3_PbPb { } histos.fill(HIST("TPC_Nsigma1_MC"), track1.tpcNSigmaKa(), multiplicity, track1.pt()); histos.fill(HIST("TOF_Nsigma1_MC"), track1.tofNSigmaKa(), multiplicity, track1.pt()); - histos.fill(HIST("trkDCAxy"), track1.dcaXY()); - histos.fill(HIST("trkDCAz"), track1.dcaZ()); + histos.fill(HIST("trkDCAxy"), track1.dcaXY(), multiplicity, track1.pt()); + histos.fill(HIST("trkDCAz"), track1.dcaZ(), multiplicity, track1.pt()); if (avoidsplitrackMC && oldindex == mothertrack1.globalIndex()) { histos.fill(HIST("h1PhiRecsplit1"), mothertrack1.pt()); continue; From 4202972ab25d2a0e35289447eb773aa10492fca6 Mon Sep 17 00:00:00 2001 From: Mattia Faggin Date: Thu, 28 Aug 2025 01:36:34 +0200 Subject: [PATCH 224/986] [Common] move from retrieveBlob to getFromtimeStamp for TrackTuner inputs (#12748) Co-authored-by: Mattia Faggin --- Common/Tools/TrackTuner.h | 72 +++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/Common/Tools/TrackTuner.h b/Common/Tools/TrackTuner.h index 60cf377a410..ca7ae6c5eb5 100644 --- a/Common/Tools/TrackTuner.h +++ b/Common/Tools/TrackTuner.h @@ -39,6 +39,7 @@ #include #include +#include #include @@ -104,7 +105,6 @@ struct TrackTuner : o2::framework::ConfigurableGroup { bool isConfigFromConfigurables = false; int nPhiBins = 1; - o2::ccdb::CcdbApi ccdbApi; std::map metadata; std::vector> grDcaXYResVsPtPionMC; @@ -449,51 +449,52 @@ struct TrackTuner : o2::framework::ConfigurableGroup { void getDcaGraphs() { - std::string fullNameInputFile = ""; - std::string fullNameFileQoverPt = ""; + std::string fullNameInputFile = pathInputFile + std::string("/") + nameInputFile; + std::string fullNameFileQoverPt = pathFileQoverPt + std::string("/") + nameFileQoverPt; + TList* ccdb_object_dca = nullptr; + TList* ccdb_object_qoverpt = nullptr; + + std::string grOneOverPtPionNameMC = "sigmaVsPtMc"; + std::string grOneOverPtPionNameData = "sigmaVsPtData"; if (isInputFileFromCCDB) { /// use input correction file from CCDB - // properly init the ccdb - std::string tmpDir = "."; - ccdbApi.init("http://alice-ccdb.cern.ch"); + // get the TList from the DCA correction file present in CCDB + ccdb_object_dca = o2::ccdb::BasicCCDBManager::instance().get(pathInputFile); + LOG(info) << " [TrackTuner] ccdb_object_dca " << ccdb_object_dca; - // get the DCA correction file from CCDB - if (!ccdbApi.retrieveBlob(pathInputFile.data(), tmpDir, metadata, 0, false, nameInputFile.data())) { - LOG(fatal) << "[TrackTuner] input file for DCA corrections not found on CCDB, please check the pathInputFile and nameInputFile!"; + // get the TList from the Q/Pt correction file from CCDB + if (updateCurvature || updateCurvatureIU) { + ccdb_object_qoverpt = o2::ccdb::BasicCCDBManager::instance().get(pathFileQoverPt); + LOG(info) << " [TrackTuner] ccdb_object_qoverpt " << ccdb_object_qoverpt; } - - // get the Q/Pt correction file from CCDB - if (!ccdbApi.retrieveBlob(pathFileQoverPt.data(), tmpDir, metadata, 0, false, nameFileQoverPt.data())) { - LOG(fatal) << "[TrackTuner] input file for Q/Pt corrections not found on CCDB, please check the pathFileQoverPt and nameFileQoverPt!"; - } - // point to the file in the tmp local folder - fullNameInputFile = tmpDir + std::string("/") + nameInputFile; - fullNameFileQoverPt = tmpDir + std::string("/") + nameFileQoverPt; } else { /// use input correction file from local filesystem - fullNameInputFile = pathInputFile + std::string("/") + nameInputFile; - fullNameFileQoverPt = pathFileQoverPt + std::string("/") + nameFileQoverPt; - } - /// open the input correction file - std::unique_ptr inputFile(TFile::Open(fullNameInputFile.c_str(), "READ")); - if (!inputFile.get()) { - LOG(fatal) << "Something wrong with the input file" << fullNameInputFile << " for dca correction. Fix it!"; - } - std::unique_ptr inputFileQoverPt(TFile::Open(fullNameFileQoverPt.c_str(), "READ")); - if (!inputFileQoverPt.get() && (updateCurvature || updateCurvatureIU)) { - LOG(fatal) << "Something wrong with the Q/Pt input file" << fullNameFileQoverPt << " for Q/Pt correction. Fix it!"; + + /// open the input correction file - dca correction + TFile* inputFile = TFile::Open(fullNameInputFile.c_str(), "READ"); + if (!inputFile) { + LOG(fatal) << "[TrackTuner] Something wrong with the local input file" << fullNameInputFile << " for dca correction. Fix it!"; + } + ccdb_object_dca = dynamic_cast(inputFile->Get("ccdb_object")); + + /// open the input correction file - q/pt correction + TFile* inputFileQoverPt = TFile::Open(fullNameFileQoverPt.c_str(), "READ"); + if (!inputFileQoverPt && (updateCurvature || updateCurvatureIU)) { + LOG(fatal) << "Something wrong with the Q/Pt input file" << fullNameFileQoverPt << " for Q/Pt correction. Fix it!"; + } + ccdb_object_qoverpt = dynamic_cast(inputFileQoverPt->Get("ccdb_object")); } - // choose wheter to use corrections w/ PV refit or w/o it, and retrieve the proper TDirectory + // choose wheter to use corrections w/ PV refit or w/o it, and retrieve the proper TList std::string dir = "woPvRefit"; if (usePvRefitCorrections) { dir = "withPvRefit"; } - TDirectory* td = dynamic_cast(inputFile->Get(dir.c_str())); + TList* td = dynamic_cast(ccdb_object_dca->FindObject(dir.c_str())); if (!td) { - LOG(fatal) << "TDirectory " << td << " not found in input file" << inputFile->GetName() << ". Fix it!"; + LOG(fatal) << "[TrackTuner] TList " << td << " not found in ccdb_object_dca. Fix it!"; } int inputNphiBins = nPhiBins; @@ -522,7 +523,7 @@ struct TrackTuner : o2::framework::ConfigurableGroup { /// Lambda expression to get the TGraphErrors from file auto loadGraph = [&](int phiBin, const std::string& strBaseName) -> TGraphErrors* { std::string strGraphName = inputNphiBins != 0 ? fmt::format("{}_{}", strBaseName, phiBin) : strBaseName; - TObject* obj = td->Get(strGraphName.c_str()); + TObject* obj = td->FindObject(strGraphName.c_str()); if (!obj) { LOG(fatal) << "[TrackTuner] TGraphErrors not found in the Input Root file: " << strGraphName; td->ls(); @@ -564,12 +565,9 @@ struct TrackTuner : o2::framework::ConfigurableGroup { } } - std::string grOneOverPtPionNameMC = "sigmaVsPtMc"; - std::string grOneOverPtPionNameData = "sigmaVsPtData"; - if (updateCurvature || updateCurvatureIU) { - grOneOverPtPionMC.reset(dynamic_cast(inputFileQoverPt->Get(grOneOverPtPionNameMC.c_str()))); - grOneOverPtPionData.reset(dynamic_cast(inputFileQoverPt->Get(grOneOverPtPionNameData.c_str()))); + grOneOverPtPionMC.reset(dynamic_cast(ccdb_object_qoverpt->FindObject(grOneOverPtPionNameMC.c_str()))); + grOneOverPtPionData.reset(dynamic_cast(ccdb_object_qoverpt->FindObject(grOneOverPtPionNameData.c_str()))); } } // getDcaGraphs() ends here From 8ecc72a3ca64ebb0f877d79daa68ec058bbc8070 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Thu, 28 Aug 2025 06:33:09 +0200 Subject: [PATCH 225/986] [PWGEM/Dilepton] update in QC histograms (#12764) --- PWGEM/Dilepton/Core/DielectronCut.h | 2 +- PWGEM/Dilepton/Core/SingleTrackQC.h | 10 +++++++--- PWGEM/Dilepton/Core/SingleTrackQCMC.h | 10 +++++++--- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/PWGEM/Dilepton/Core/DielectronCut.h b/PWGEM/Dilepton/Core/DielectronCut.h index 20fc738b146..50e6b518693 100644 --- a/PWGEM/Dilepton/Core/DielectronCut.h +++ b/PWGEM/Dilepton/Core/DielectronCut.h @@ -418,7 +418,7 @@ class DielectronCut : public TNamed return track.tpcFractionSharedCls() < mMaxFracSharedClustersTPC; case DielectronCuts::kRelDiffPin: - return mMinRelDiffPin < (track.tpcInnerParam() - track.p()) / track.p() && (track.tpcInnerParam() - track.p()) / track.p() < mMaxRelDiffPin; + return mMinRelDiffPin < (track.p() - track.tpcInnerParam()) / track.tpcInnerParam() && (track.p() - track.tpcInnerParam()) / track.tpcInnerParam() < mMaxRelDiffPin; case DielectronCuts::kTPCChi2NDF: return mMinChi2PerClusterTPC < track.tpcChi2NCl() && track.tpcChi2NCl() < mMaxChi2PerClusterTPC; diff --git a/PWGEM/Dilepton/Core/SingleTrackQC.h b/PWGEM/Dilepton/Core/SingleTrackQC.h index 3ecc36ab7b9..186efbd0e87 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQC.h @@ -246,7 +246,7 @@ struct SingleTrackQC { fRegistry.add("Track/positive/hNclsTPC_Pt", "number of TPC clusters;p_{T,e} (GeV/c);TPC N_{cls}", kTH2F, {axis_pt, {161, -0.5, 160.5}}, false); fRegistry.add("Track/positive/hNcrTPC_Pt", "number of TPC crossed rows;p_{T,e} (GeV/c);TPC N_{CR}", kTH2F, {axis_pt, {161, -0.5, 160.5}}, false); fRegistry.add("Track/positive/hChi2TPC", "chi2/number of TPC clusters;TPC #chi^{2}/N_{CR}", kTH1F, {{100, 0, 10}}, false); - fRegistry.add("Track/positive/hDeltaPin", "p_{in} vs. p_{pv};p_{pv} (GeV/c);(p_{in} - p_{pv})/p_{pv}", kTH2F, {{1000, 0, 10}, {200, -1, +1}}, false); + fRegistry.add("Track/positive/hDeltaPin", "p_{in} vs. p_{pv};p_{in} (GeV/c);(p_{pv} - p_{in})/p_{in}", kTH2F, {{1000, 0, 10}, {200, -1, +1}}, false); fRegistry.add("Track/positive/hTPCNcr2Nf", "TPC Ncr/Nfindable;TPC N_{CR}/N_{cls}^{findable}", kTH1F, {{200, 0, 2}}, false); fRegistry.add("Track/positive/hTPCNcls2Nf", "TPC Ncls/Nfindable;TPC N_{cls}/N_{cls}^{findable}", kTH1F, {{200, 0, 2}}, false); fRegistry.add("Track/positive/hTPCNclsShared", "TPC Ncls shared/Ncls;p_{T} (GeV/c);N_{cls}^{shared}/N_{cls} in TPC", kTH2F, {{1000, 0, 10}, {100, 0, 1}}, false); @@ -504,7 +504,9 @@ struct SingleTrackQC { fRegistry.fill(HIST("Track/positive/hTPCNcr2Nf"), track.tpcCrossedRowsOverFindableCls()); fRegistry.fill(HIST("Track/positive/hTPCNcls2Nf"), track.tpcFoundOverFindableCls()); fRegistry.fill(HIST("Track/positive/hTPCNclsShared"), track.pt(), track.tpcFractionSharedCls()); - fRegistry.fill(HIST("Track/positive/hDeltaPin"), track.p(), (track.tpcInnerParam() - track.p()) / track.p()); + if (track.hasTPC()) { + fRegistry.fill(HIST("Track/positive/hDeltaPin"), track.tpcInnerParam(), (track.p() - track.tpcInnerParam()) / track.tpcInnerParam()); + } fRegistry.fill(HIST("Track/positive/hChi2TPC"), track.tpcChi2NCl()); fRegistry.fill(HIST("Track/positive/hChi2ITS"), track.itsChi2NCl()); fRegistry.fill(HIST("Track/positive/hITSClusterMap"), track.itsClusterMap()); @@ -545,7 +547,9 @@ struct SingleTrackQC { fRegistry.fill(HIST("Track/negative/hTPCNcr2Nf"), track.tpcCrossedRowsOverFindableCls()); fRegistry.fill(HIST("Track/negative/hTPCNcls2Nf"), track.tpcFoundOverFindableCls()); fRegistry.fill(HIST("Track/negative/hTPCNclsShared"), track.pt(), track.tpcFractionSharedCls()); - fRegistry.fill(HIST("Track/negative/hDeltaPin"), track.p(), (track.tpcInnerParam() - track.p()) / track.p()); + if (track.hasTPC()) { + fRegistry.fill(HIST("Track/negative/hDeltaPin"), track.tpcInnerParam(), (track.p() - track.tpcInnerParam()) / track.tpcInnerParam()); + } fRegistry.fill(HIST("Track/negative/hChi2TPC"), track.tpcChi2NCl()); fRegistry.fill(HIST("Track/negative/hChi2ITS"), track.itsChi2NCl()); fRegistry.fill(HIST("Track/negative/hITSClusterMap"), track.itsClusterMap()); diff --git a/PWGEM/Dilepton/Core/SingleTrackQCMC.h b/PWGEM/Dilepton/Core/SingleTrackQCMC.h index 16025e245af..02eb4035160 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQCMC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQCMC.h @@ -286,7 +286,7 @@ struct SingleTrackQCMC { fRegistry.add("Track/lf/positive/hTPCNclsShared", "TPC Ncls shared/Ncls;p_{T} (GeV/c);N_{cls}^{shared}/N_{cls} in TPC", kTH2F, {{1000, 0, 10}, {100, 0, 1}}, false); fRegistry.add("Track/lf/positive/hNclsITS", "number of ITS clusters", kTH1F, {{8, -0.5, 7.5}}, false); fRegistry.add("Track/lf/positive/hChi2ITS", "chi2/number of ITS clusters", kTH1F, {{100, 0, 10}}, false); - fRegistry.add("Track/lf/positive/hDeltaPin", "p_{in} vs. p_{pv};p_{pv} (GeV/c);(p_{in} - p_{pv})/p_{pv}", kTH2F, {{1000, 0, 10}, {200, -1, +1}}, false); + fRegistry.add("Track/lf/positive/hDeltaPin", "p_{in} vs. p_{pv};p_{in} (GeV/c);(p_{pv} - p_{in})/p_{in}", kTH2F, {{1000, 0, 10}, {200, -1, +1}}, false); fRegistry.add("Track/lf/positive/hChi2TOF", "TOF Chi2;p_{pv} (GeV/c);chi2", kTH2F, {{1000, 0, 10}, {100, 0, 10}}, false); fRegistry.add("Track/lf/positive/hITSClusterMap", "ITS cluster map", kTH1F, {{128, -0.5, 127.5}}, false); fRegistry.add("Track/lf/positive/hPtGen_DeltaPtOverPtGen", "electron p_{T} resolution;p_{T}^{gen} (GeV/c);(p_{T}^{rec} - p_{T}^{gen})/p_{T}^{gen}", kTH2F, {{200, 0, 10}, {200, -1.0f, 1.0f}}, true); @@ -624,7 +624,9 @@ struct SingleTrackQCMC { fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hChi2TPC"), track.tpcChi2NCl()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hChi2ITS"), track.itsChi2NCl()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hChi2TOF"), track.p(), track.tofChi2()); - fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hDeltaPin"), track.p(), (track.tpcInnerParam() - track.p()) / track.p()); + if (track.hasTPC()) { + fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hDeltaPin"), track.tpcInnerParam(), (track.p() - track.tpcInnerParam()) / track.tpcInnerParam()); + } fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hITSClusterMap"), track.itsClusterMap()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hPtGen_DeltaPtOverPtGen"), mctrack.pt(), (track.pt() - mctrack.pt()) / mctrack.pt()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hPtGen_DeltaEta"), mctrack.pt(), track.eta() - mctrack.eta()); @@ -672,7 +674,9 @@ struct SingleTrackQCMC { fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hChi2TPC"), track.tpcChi2NCl()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hChi2ITS"), track.itsChi2NCl()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hChi2TOF"), track.p(), track.tofChi2()); - fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hDeltaPin"), track.p(), (track.tpcInnerParam() - track.p()) / track.p()); + if (track.hasTPC()) { + fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hDeltaPin"), track.tpcInnerParam(), (track.p() - track.tpcInnerParam()) / track.tpcInnerParam()); + } fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hITSClusterMap"), track.itsClusterMap()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hPtGen_DeltaPtOverPtGen"), mctrack.pt(), (track.pt() - mctrack.pt()) / mctrack.pt()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hPtGen_DeltaEta"), mctrack.pt(), track.eta() - mctrack.eta()); From 32bb261f2b17b2e5064c2b16cec82de8b439975d Mon Sep 17 00:00:00 2001 From: Junlee Kim Date: Thu, 28 Aug 2025 18:31:28 +0900 Subject: [PATCH 226/986] [PWGLF] adding pp trigger analysis (#12768) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Strangeness/CMakeLists.txt | 2 +- PWGLF/Tasks/Strangeness/lambdalambda.cxx | 137 ++++++++++++++--------- 2 files changed, 88 insertions(+), 51 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/CMakeLists.txt b/PWGLF/Tasks/Strangeness/CMakeLists.txt index 100b8667aab..db4a211e4fa 100644 --- a/PWGLF/Tasks/Strangeness/CMakeLists.txt +++ b/PWGLF/Tasks/Strangeness/CMakeLists.txt @@ -133,7 +133,7 @@ o2physics_add_dpl_workflow(lambdak0sflattenicity o2physics_add_dpl_workflow(lambdalambda SOURCES lambdalambda.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(lambdajetpolarization diff --git a/PWGLF/Tasks/Strangeness/lambdalambda.cxx b/PWGLF/Tasks/Strangeness/lambdalambda.cxx index bf8579f105d..4c6b7bc4d84 100644 --- a/PWGLF/Tasks/Strangeness/lambdalambda.cxx +++ b/PWGLF/Tasks/Strangeness/lambdalambda.cxx @@ -11,51 +11,48 @@ /// \author Junlee Kim (jikim1290@gmail.com) -#include -#include -#include -#include -#include -#include +#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "TLorentzVector.h" -#include "TRandom3.h" -#include "TF1.h" -#include "TVector3.h" -#include "Math/Vector3D.h" -#include "Math/Vector4D.h" -#include "Math/GenVector/Boost.h" -#include +#include "Common/Core/TrackSelection.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "EventFiltering/Zorro.h" +#include "EventFiltering/ZorroSummary.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CcdbApi.h" +#include "CommonConstants/PhysicsConstants.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" -#include "Framework/StepTHn.h" #include "Framework/O2DatabasePDGPlugin.h" -#include "Framework/ASoAHelpers.h" #include "Framework/StaticFor.h" - -#include "Common/DataModel/PIDResponse.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/EventSelection.h" - -#include "Common/Core/trackUtilities.h" -#include "Common/Core/TrackSelection.h" - -#include "CommonConstants/PhysicsConstants.h" - +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/Track.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" - -#include "CCDB/CcdbApi.h" -#include "CCDB/BasicCCDBManager.h" +#include "Math/GenVector/Boost.h" +#include "Math/Vector3D.h" +#include "Math/Vector4D.h" +#include "TF1.h" +#include "TLorentzVector.h" +#include "TRandom3.h" +#include "TVector3.h" +#include -#include "PWGLF/DataModel/LFStrangenessTables.h" +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -68,6 +65,9 @@ struct lambdalambda { using TrackCandidates = soa::Join; using V0TrackCandidate = aod::V0Datas; + Zorro zorro; + OutputObj zorroSummary{"zorroSummary"}; + HistogramRegistry histos{ "histos", {}, @@ -136,6 +136,9 @@ struct lambdalambda { Configurable cfgNRotBkg{"cfgNRotBkg", 10, "the number of rotational backgrounds"}; Configurable cfgNoMixedEvents{"cfgNoMixedEvents", 10, "Number of mixed events per event"}; + Configurable cfgSkimmedProcessing{"cfgSkimmedProcessing", false, "Enable processing of skimmed data"}; + Configurable cfgTriggerName{"cfgTriggerName", "fLambdaLambda", "Software trigger name"}; + ConfigurableAxis massAxis{"massAxis", {110, 2.22, 2.33}, "Invariant mass axis"}; ConfigurableAxis ptAxis{"ptAxis", {VARIABLE_WIDTH, 0.2, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 6.5, 8.0, 10.0, 100.0}, "Transverse momentum bins"}; ConfigurableAxis centAxis{"centAxis", {VARIABLE_WIDTH, 0, 10, 20, 50, 100}, "Centrality interval"}; @@ -157,8 +160,20 @@ struct lambdalambda { bool IsTriggered; bool IsSelected; + void initCCDB(aod::BCsWithTimestamps::iterator const& bc) + { + if (cfgSkimmedProcessing) { + zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), cfgTriggerName.value); + zorro.populateHistRegistry(histos, bc.runNumber()); + } + } + void init(o2::framework::InitContext&) { + if (cfgSkimmedProcessing) { + zorroSummary.setObject(zorro.getZorroSummary()); + } + AxisSpec centQaAxis = {80, 0.0, 80.0}; AxisSpec PVzQaAxis = {300, -15.0, 15.0}; AxisSpec combAxis = {3, -0.5, 2.5}; @@ -506,8 +521,15 @@ struct lambdalambda { histos.fill(HIST("QA/CentDist"), centrality, 1.0); histos.fill(HIST("QA/PVzDist"), collision.posZ(), 1.0); + auto bc = collision.bc_as(); + if (cfgSkimmedProcessing) { + initCCDB(bc); + if (!zorro.isSelected(collision.template bc_as().globalBC())) { + return; + } + } + if (cfgEffCor) { - auto bc = collision.bc_as(); EffMap = ccdb->getForTimeStamp(cfgEffCorPath.value, bc.timestamp()); } FillHistograms(collision, collision, V0s, V0s); @@ -520,31 +542,46 @@ struct lambdalambda { PROCESS_SWITCH(lambdalambda, processDataSame, "Process Event for same data", true); SliceCache cache; - using BinningTypeVertexContributor = ColumnBinningPolicy; + using BinningType = ColumnBinningPolicy; + BinningType colBinning{{vertexAxis, centAxis}, true}; + Preslice tracksPerCollisionV0 = aod::v0data::collisionId; void processDataMixed(EventCandidates const& collisions, - TrackCandidates const& /*tracks*/, aod::V0Datas const& V0s) + TrackCandidates const& /*tracks*/, aod::V0Datas const& V0s, aod::BCsWithTimestamps const&) { - auto tracksTuple = std::make_tuple(V0s); - BinningTypeVertexContributor binningOnPositions{{vertexAxis, centAxis}, true}; - SameKindPair pair{binningOnPositions, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; - for (auto& [c1, tracks1, c2, tracks2] : pair) { - if (cfgCentEst == 1) { - centrality = c1.centFT0C(); - } else if (cfgCentEst == 2) { - centrality = c1.centFT0M(); + int currentRun = -1; + for (auto& [c1, c2] : selfCombinations(colBinning, cfgNoMixedEvents, -1, collisions, collisions)) { + if (c1.index() == c2.index()) + continue; + + auto bc1 = c1.bc_as(); + auto bc2 = c2.bc_as(); + + if (bc1.runNumber() != bc2.runNumber()) + continue; + + if (bc1.runNumber() != currentRun) { + if (cfgSkimmedProcessing) { + initCCDB(bc1); + if (!zorro.isSelected(bc1.globalBC()) || !zorro.isSelected(bc2.globalBC())) { + continue; + } + } } + + centrality = c1.centFT0M(); if (!eventSelected(c1)) continue; if (!eventSelected(c2)) continue; - if (c1.bcId() == c2.bcId()) - continue; + + auto tracks1 = V0s.sliceBy(tracksPerCollisionV0, c1.globalIndex()); + auto tracks2 = V0s.sliceBy(tracksPerCollisionV0, c2.globalIndex()); FillHistograms(c1, c2, tracks1, tracks2); } } - PROCESS_SWITCH(lambdalambda, processDataMixed, "Process Event for mixed data", true); + PROCESS_SWITCH(lambdalambda, processDataMixed, "Process Event for mixed data", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 049437fa41b8e672f927811d80af62dc398364d4 Mon Sep 17 00:00:00 2001 From: omvazque Date: Thu, 28 Aug 2025 08:19:30 -0500 Subject: [PATCH 227/986] [PWGLF] Adds V0 process method (#12770) --- PWGLF/Tasks/Nuspex/piKpRAA.cxx | 603 +++++++++++++++++++++++---------- 1 file changed, 432 insertions(+), 171 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/piKpRAA.cxx b/PWGLF/Tasks/Nuspex/piKpRAA.cxx index 9df38d8eb36..2006c19f7fe 100644 --- a/PWGLF/Tasks/Nuspex/piKpRAA.cxx +++ b/PWGLF/Tasks/Nuspex/piKpRAA.cxx @@ -10,6 +10,10 @@ // or submit itself to any jurisdiction. /// \file piKpRAA.cxx +/// +/// \brief task for analysis of piKp RAA +/// \author Omar Vazquez (omar.vazquez.rueda@cern.ch) +/// \since August 10, 2025 #include "PWGLF/DataModel/LFStrangenessTables.h" @@ -49,7 +53,6 @@ #include #include #include -#include #include #include #include @@ -64,13 +67,33 @@ using namespace o2::framework::expressions; using ColEvSels = soa::Join; using BCsRun3 = soa::Join; -using TracksFull = soa::Join; +// using TracksFull = soa::Join; -struct piKpRAA { +using TracksFull = soa::Join; - static constexpr float kZero{0.}; - static constexpr float kOne{1.}; +static constexpr int kNEtaHists{9}; + +std::array, kNEtaHists> dEdxPiV0{}; +std::array, kNEtaHists> dEdxPrV0{}; +std::array, kNEtaHists> dEdxElV0{}; +std::array, kNEtaHists> dEdxPiTOF{}; +std::array, kNEtaHists> dEdxElTOF{}; + +struct PiKpRAA { + + static constexpr float kZero{0.0f}; + static constexpr float kOne{1.0f}; + static constexpr float kTenToMinusNine{1e-9}; static constexpr float kMinCharge{3.f}; + static constexpr float kMinPMIP{0.4f}; + static constexpr float kMaxPMIP{0.6f}; + static constexpr float kMindEdxMIP{40.0f}; + static constexpr float kMaxdEdxMIP{60.0f}; + static constexpr float kMindEdxMIPPlateau{65.0f}; + static constexpr float kMaxdEdxMIPPlateau{95.0f}; + + static constexpr float kLowEta[kNEtaHists] = {-0.8, -0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6}; + static constexpr float kHighEta[kNEtaHists] = {0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6, 0.8}; static constexpr float DefaultLifetimeCuts[1][2] = {{30., 20.}}; Configurable> lifetimecut{"lifetimecut", {DefaultLifetimeCuts[0], 2, {"lifetimecutLambda", "lifetimecutK0S"}}, "lifetimecut"}; @@ -98,17 +121,21 @@ struct piKpRAA { Configurable armPodCut{"armPodCut", 5.0f, "pT * (cut) > |alpha|, AP cut. Negative: no cut"}; // Selection - Configurable applyInvMassSel{"applyInvMassSel", true, "Select V0s close to the Inv. mass value"}; - Configurable minMassK0s{"minMassK0", 0.4f, "Min. Inv. Mass K0"}; - Configurable maxMassK0s{"maxMassK0", 0.6f, "Max. Inv. Mass K0"}; - Configurable minMassLambda{"minMassLambda", 1.1f, "Min. Inv. Mass Lambda"}; - Configurable maxMassLambda{"maxMassLambda", 1.2f, "Max. Inv. Mass Lambda"}; - Configurable minMassGamma{"minMassGamma", 0.000922f, "Min. Inv. Mass Gamma"}; - Configurable maxMassGamma{"maxMassGamma", 0.002022f, "Max. Inv. Mass Gamma"}; + Configurable applyInvMassSel{"applyInvMassSel", false, "Select V0s close to the Inv. mass value"}; + Configurable applyqTSel{"applyqTSel", true, "Select Gammas based on Armenters distribution"}; + Configurable dMassSel{"dMassSel", 0.01f, "Invariant mass selection"}; + Configurable dMassSelG{"dMassSelG", 0.1f, "Inv mass selection gammas"}; // PID (TPC/TOF) Configurable tpcPidNsigmaCut{"tpcPidNsigmaCut", 5, "tpcPidNsigmaCut"}; - + Configurable maxPiTOFBeta{"maxPiTOFBeta", 0.00005, "Maximum beta TOF selection"}; + Configurable maxElTOFBeta{"maxElTOFBeta", 0.1, "Maximum beta TOF selection"}; + Configurable applyTPCTOFCombinedCut{"applyTPCTOFCombinedCut", false, " Apply geometrical cut ? "}; + + // Phi cut + Configurable applyPhiCut{"applyPhiCut", true, "Apply geometrical cut?"}; + Configurable applyEtaCal{"applyEtaCal", false, "Apply eta calibration?"}; + Configurable usePinPhiSelection{"usePinPhiSelection", true, "Uses Phi selection as a function of P or Pt?"}; } v0Selections; // Configurables Event Selection @@ -144,10 +171,9 @@ struct piKpRAA { ConfigurableAxis axisdEdx{"axisdEdx", {140, 20.0, 160.0}, "dEdx binning"}; // CCDB paths - Configurable paTHEff{"paTHEff", "Users/o/omvazque/MCcorrection/perTimeStamp/TrackingEff", "base path to the ccdb object"}; - Configurable paTHFD{"paTHFD", "Users/o/omvazque/MCcorrection/perTimeStamp/FeedDown", "base path to the ccdb object"}; - Configurable paTHmeanNch{"paTHmeanNch", "Users/o/omvazque/FitMeanNch_9May2025", "base path to the ccdb object"}; - Configurable paTHsigmaNch{"paTHsigmaNch", "Users/o/omvazque/FitSigmaNch_9May2025", "base path to the ccdb object"}; + Configurable pathEtaCal{"pathEtaCal", "Users/o/omvazque/EtaCal/OO/Global", "base path to the ccdb object"}; + Configurable pathPhiCutHigh{"pathPhiCutHigh", "Users/o/omvazque/PhiCut/OO/Global/High", "base path to the ccdb object"}; + Configurable pathPhiCutLow{"pathPhiCutLow", "Users/o/omvazque/PhiCut/OO/Global/Low", "base path to the ccdb object"}; Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; enum EvCutLabel { @@ -173,17 +199,16 @@ struct piKpRAA { HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; Service ccdb; - struct Config { - TH2F* hEfficiency = nullptr; - TH2F* hFeedDown = nullptr; - bool correctionsLoaded = false; - } cfg; + struct ConfigPhiCut { + TH1F* hPhiCutHigh = nullptr; + TH1F* hPhiCutLow = nullptr; + bool isPhiCutLoaded = false; + } phiCut; - struct NchConfig { - TH1F* hMeanNch = nullptr; - TH1F* hSigmaNch = nullptr; - bool calibrationsLoaded = false; - } cfgNch; + struct ConfigEtaCalib { + TProfile* pEtaCal = nullptr; + bool isCalLoaded = false; + } etaCal; TrackSelection trkSelDaugthers; TrackSelection trkSelGlobal; @@ -205,11 +230,13 @@ struct piKpRAA { // define axes you want to use const AxisSpec axisZpos{48, -12., 12., "Vtx_{z} (cm)"}; const AxisSpec axisEvent{14, 0.5, 14.5, ""}; - const AxisSpec axisEta{40, -1., +1., "#eta"}; + const AxisSpec axisEta{100, -1., +1., "#eta"}; const AxisSpec axisPt{binsPt, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec axisPtPhiCut{binsPtPhiCut, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec axisPtV0s{binsPtV0s, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec axisCent{binsCent, "T0C centrality"}; + const char* endingEta[kNEtaHists] = {"88", "86", "64", "42", "20", "02", "24", "46", "68"}; + const char* latexEta[kNEtaHists] = {"|#eta|<0.8", "-0.8<#eta<-0.6", "-0.6<#eta<-0.4", "-0.4<#eta<-0.2", "-0.2<#eta<0", "0<#eta<0.2", "0.2<#eta<0.4", "0.4<#eta<0.6", "0.6<#eta<0.8"}; registry.add("EventCounter", ";;Events", kTH1F, {axisEvent}); @@ -234,57 +261,98 @@ struct piKpRAA { registry.add("T0Ccent", ";;Entries", kTH1F, {axisCent}); registry.add("dcaDauVsPt", ";V0 #it{p}_{T} (GeV/#it{c});DCA_{xy} (cm) daughters;", kTH2F, {{{axisPtV0s}, {200, -10., 10.}}}); - registry.add("nSigmaPiFromK0", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); - registry.add("nSigmaPiFromLambda", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); - registry.add("nSigmaPrFromLambda", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); - registry.add("nSigmaPiFromAntiLambda", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); - registry.add("nSigmaPrFromAntiLambda", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); - registry.add("nSigmaElFromGammaConv", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); + registry.add("nSigPiFromK0s", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); + registry.add("nSigPiFromL", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); + registry.add("nSigPrFromL", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); + registry.add("nSigPiFromAL", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); + registry.add("nSigPrFromAL", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); + registry.add("nSigElFromG", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); registry.add("ArmAll", "Armenteros-Podolanski;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); registry.add("ArmAfterTopoSel", "Armenteros-Podolanski anfter topological selection;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); registry.add("ArmK0NOSel", "Armenteros-Podolanski WITH OUT 5 #times q_{T} > #alpha selection;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); registry.add("ArmK0", "Armenteros-Podolanski WITH 5 #times q_{T} > #alpha selection;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); - registry.add("ArmLambda", "Armenteros-Podolanski;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); - registry.add("ArmAntiLambda", "Armenteros-Podolanski;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); - registry.add("ArmGamma", "Armenteros-Podolanski;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); - registry.add("MassK0ShortVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {axisPtV0s, axisK0Mass}); - registry.add("MassLambdaVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {axisPtV0s, axisLambdaMass}); - registry.add("MassAntiLambdaVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {axisPtV0s, axisLambdaMass}); - registry.add("MassGammaVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {axisPtV0s, axisGammaMass}); - registry.add("dEdxPiPos", ";Momentum (GeV/#it{c}); dE/dx", kTH2F, {axisPtV0s, axisdEdx}); - registry.add("dEdxPiNeg", ";Momentum (GeV/#it{c}); dE/dx", kTH2F, {axisPtV0s, axisdEdx}); - registry.add("dEdxPrPos", ";Momentum (GeV/#it{c}); dE/dx", kTH2F, {axisPtV0s, axisdEdx}); - registry.add("dEdxPrNeg", ";Momentum (GeV/#it{c}); dE/dx", kTH2F, {axisPtV0s, axisdEdx}); - registry.add("dEdxEl", ";Momentum (GeV/#it{c}); dE/dx", kTH2F, {axisPtV0s, axisdEdx}); + registry.add("ArmL", "Armenteros-Podolanski;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); + registry.add("ArmAL", "Armenteros-Podolanski;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); + registry.add("ArmG", "Armenteros-Podolanski;#alpha;q_{T} (GeV/c)", kTH2F, {axisArmAlpha, axisArmqT}); + registry.add("MassK0sVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {axisPtV0s, axisK0Mass}); + registry.add("MassLVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {axisPtV0s, axisLambdaMass}); + registry.add("MassALVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {axisPtV0s, axisLambdaMass}); + registry.add("MassGVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {axisPtV0s, axisGammaMass}); registry.add("NclFindableVsPt", ";#it{p}_{T} (GeV/#it{c}); Ncl TPC", kTH2F, {{{axisPtV0s}, {160, 0, 160}}}); registry.add("NclFindableVsPtp", ";#it{p}_{T} (GeV/#it{c}); #LTNcl#GT TPC", kTProfile, {axisPtV0s}); registry.add("NclFoundVsPt", ";#it{p}_{T} (GeV/#it{c}); Ncl TPC", kTH2F, {{{axisPtV0s}, {160, 0, 160}}}); registry.add("NclFoundVsPtp", ";#it{p}_{T} (GeV/#it{c}); #LTNcl#GT TPC", kTProfile, {axisPtV0s}); - registry.add("NclFindableMinusFoundVsPt", ";#it{p}_{T} (GeV/#it{c}); Ncl TPC", kTH2F, {{{axisPtV0s}, {21, -0.5, 20.5}}}); - registry.add("NclFindableMinusFoundVsPtp", ";#it{p}_{T} (GeV/#it{c}); #LTNcl#GT TPC", kTProfile, {axisPtV0s}); - registry.add("NclFoundVsPtVsPhip", "", kTProfile2D, {{{axisPtPhiCut}, {350, 0.0, 0.35}}}); + registry.add("NclFoundVsPVsPhipBeforeCut", "", kTProfile2D, {{{axisPtPhiCut}, {350, 0.0, 0.35}}}); + registry.add("NclFoundVsPtVsPhipBeforeCut", "", kTProfile2D, {{{axisPtPhiCut}, {350, 0.0, 0.35}}}); + registry.add("NclFoundVsPVsPhipAfterCut", "", kTProfile2D, {{{axisPtPhiCut}, {350, 0.0, 0.35}}}); + registry.add("NclFoundVsPtVsPhipAfterCut", "", kTProfile2D, {{{axisPtPhiCut}, {350, 0.0, 0.35}}}); registry.add("NclVsEta", ";#eta; Ncl TPC", kTH2F, {{{axisEta}, {160, 0, 160}}}); + + registry.add("NclVsEtaPiMIP", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c}, 40 < dE/dx < 60);#eta; Found Ncl TPC", kTH2F, {{{axisEta}, {160, 0, 160}}}); + registry.add("NclVsEtaPiMIPp", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c}, 40 < dE/dx < 60);#eta; Found #LTNcl#GT TPC", kTProfile, {axisEta}); + registry.add("NclVsEtaPiV0", ";#eta; Found Ncl TPC", kTH2F, {{{axisEta}, {160, 0, 160}}}); + registry.add("NclVsEtaPiV0p", ";#eta; Found #LTNcl#GT TPC", kTProfile, {axisEta}); + registry.add("NclVsPPiV0", ";Momentum (GeV/#it{c}); Found Ncl TPC", kTH2F, {{{axisPtV0s}, {160, 0, 160}}}); + registry.add("NclVsPPiV0p", ";Momentum (GeV/#it{c}); Found #LTNcl#GT TPC", kTProfile, {axisPtV0s}); + registry.add("NclVsEtaPrV0", ";#eta; Found Ncl TPC", kTH2F, {{{axisEta}, {160, 0, 160}}}); + registry.add("NclVsEtaPrV0p", ";#eta; Found #LTNcl#GT TPC", kTProfile, {axisEta}); + registry.add("NclVsPPrV0", ";Momentum (GeV/#it{c}); Found Ncl TPC", kTH2F, {{{axisPtV0s}, {160, 0, 160}}}); + registry.add("NclVsPPrV0p", ";Momentum (GeV/#it{c}); Found #LTNcl#GT TPC", kTProfile, {axisPtV0s}); + registry.add("NclVsEtaElV0", ";#eta; Found Ncl TPC", kTH2F, {{{axisEta}, {160, 0, 160}}}); + registry.add("NclVsEtaElV0p", ";#eta; Found #LTNcl#GT TPC", kTProfile, {axisEta}); + registry.add("NclVsPElV0", ";Momentum (GeV/#it{c}); Found Ncl TPC", kTH2F, {{{axisPtV0s}, {160, 0, 160}}}); + registry.add("NclVsPElV0p", ";Momentum (GeV/#it{c}); Found #LTNcl#GT TPC", kTProfile, {axisPtV0s}); + + registry.add("TOFExpPi2TOF", ";Momentum (GeV/#it{c});t^{e}_{Exp}/t_{TOF}", kTH2F, {{{axisPtV0s}, {100, 0.2, 1.2}}}); + registry.add("TOFExpEl2TOF", ";Momentum (GeV/#it{c});t^{#pi}_{Exp}/t_{TOF}", kTH2F, {{{axisPtV0s}, {100, 0.2, 1.2}}}); + + registry.add("betaVsMomentum", ";Momentum (GeV/#it{c}); #beta", kTH2F, {{{axisPtV0s}, {500, 0, 1.2}}}); registry.add("dEdxVsMomentum", ";Momentum (GeV/#it{c}); dE/dx", kTH2F, {axisPtV0s, axisdEdx}); - registry.add("dEdxVsEtaPiMIP", ";#eta; dE/dx MIP Pions (0.4 < #it{p} < 0.6 GeV/#it{c})", kTH2F, {{{axisEta}, {50, 20, 70}}}); - registry.add("dEdxVsEtaPiMIPp", ";#eta; #LTdE/dx#GT MIP Pions", kTProfile, {axisEta}); + registry.add("dEdxVsEtaPiMIP", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; dE/dx;", kTH2F, {{{axisEta}, {100, 0, 100}}}); + registry.add("dEdxVsEtaPiMIPp", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; #LTdE/dx#GT", kTProfile, {axisEta}); + registry.add("dEdxVsEtaElMIP", "MIP e^{+} + e^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; dE/dx;", kTH2F, {{{axisEta}, {100, 0, 100}}}); + registry.add("dEdxVsEtaElMIPp", "MIP e^{+} + e^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; #LTdE/dx#GT", kTProfile, {axisEta}); + registry.add("dEdxVsEtaPiMIPV0", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; dE/dx", kTH2F, {{{axisEta}, {100, 0, 100}}}); + registry.add("dEdxVsEtaPiMIPV0p", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; #LTdE/dx#GT", kTProfile, {axisEta}); + registry.add("dEdxVsEtaElMIPV0", "e^{+} + e^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; dE/dx", kTH2F, {{{axisEta}, {100, 0, 100}}}); + registry.add("dEdxVsEtaElMIPV0p", "e^{+} + e^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; #LTdE/dx#GT", kTProfile, {axisEta}); + + for (int i = 0; i < kNEtaHists; ++i) { + dEdxPiV0[i] = registry.add(Form("dEdxPiV0_%s", endingEta[i]), Form("#pi^{+} + #pi^{-}, %s;Momentum (GeV/#it{c}); dE/dx", latexEta[i]), kTH2F, {axisPtV0s, axisdEdx}); + dEdxPrV0[i] = registry.add(Form("dEdxPrV0_%s", endingEta[i]), Form("p + #bar{p}, %s;Momentum (GeV/#it{c}); dE/dx", latexEta[i]), kTH2F, {axisPtV0s, axisdEdx}); + dEdxElV0[i] = registry.add(Form("dEdxElV0_%s", endingEta[i]), Form("e^{+} + e^{-}, %s;Momentum (GeV/#it{c}); dE/dx", latexEta[i]), kTH2F, {axisPtV0s, axisdEdx}); + dEdxPiTOF[i] = registry.add(Form("dEdxPiTOF_%s", endingEta[i]), Form("#pi^{+} + #pi^{-}, %s;Momentum (GeV/#it{c}); dE/dx", latexEta[i]), kTH2F, {axisPtV0s, axisdEdx}); + dEdxElTOF[i] = registry.add(Form("dEdxElTOF_%s", endingEta[i]), Form("e^{+} + e^{-}, %s;Momentum (GeV/#it{c}); dE/dx", latexEta[i]), kTH2F, {axisPtV0s, axisdEdx}); + } } LOG(info) << "\tccdbNoLaterThan=" << ccdbNoLaterThan.value; - LOG(info) << "\tpaTHEff=" << paTHEff.value; - LOG(info) << "\tpaTHFD=" << paTHFD.value; LOG(info) << "\tuseMidRapNchSel=" << useMidRapNchSel.value; LOG(info) << "\tdetector4Calibration=" << detector4Calibration.value; - LOG(info) << "\tpaTHmeanNch=" << paTHmeanNch.value; - LOG(info) << "\tpaTHsigmaNch=" << paTHsigmaNch.value; LOG(info) << "\tminPt=" << v0Selections.minPt; LOG(info) << "\tmaxPt=" << v0Selections.maxPt; + LOG(info) << "\tapplyTPCTOFCombinedCut=" << v0Selections.applyTPCTOFCombinedCut; + LOG(info) << "\tapplyInvMassSel=" << v0Selections.applyInvMassSel; ccdb->setURL("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); ccdb->setFatalWhenNull(false); ccdb->setCreatedNotAfter(ccdbNoLaterThan.value); + + if (v0Selections.applyPhiCut) { + LOG(info) << "\tLoading Phi cut!"; + LOG(info) << "\t pathPhiCutLow=" << pathPhiCutLow.value; + LOG(info) << "\t pathPhiCutHigh=" << pathPhiCutHigh.value; + loadPhiCutSelections(); + } + + if (v0Selections.applyEtaCal) { + LOG(info) << "\tLoading Eta Cal!"; + LOG(info) << "\t pathEtaCal=" << pathEtaCal.value; + loadEtaCalibration(); + } } void processCalibrationAndV0s(ColEvSels::iterator const& collision, BCsRun3 const& /**/, aod::V0Datas const& v0s, aod::FV0As const& /**/, aod::FT0s const& /**/, TracksFull const& tracks) @@ -303,6 +371,15 @@ struct piKpRAA { registry.fill(HIST("zPos"), collision.posZ()); registry.fill(HIST("T0Ccent"), collision.centFT0C()); + // bool hasT0{false}; + // float colTime{0.0}; + // if (foundBC.has_ft0()) { + // if (foundBC.ft0().isValidTimeA() && foundBC.ft0().isValidTimeC()) { + // colTime = foundBC.ft0().collTime(); + // hasT0 = true; + // } + // } + for (const auto& track : tracks) { if (!trkSelGlobal.IsSelected(track)) @@ -315,27 +392,78 @@ struct piKpRAA { const float pt{track.pt()}; const float phi{track.phi()}; const float eta{track.eta()}; - const float dedx{track.tpcSignal()}; + float dedx{track.tpcSignal()}; + const int charge{track.sign()}; + + float phiPrime{phi}; + phiPrimeFunc(phiPrime, magField, charge); + registry.fill(HIST("NclFoundVsPVsPhipBeforeCut"), momentum, phiPrime, track.tpcNClsFound()); + registry.fill(HIST("NclFoundVsPtVsPhipBeforeCut"), pt, phiPrime, track.tpcNClsFound()); + + float pOrPt{v0Selections.usePinPhiSelection ? momentum : pt}; + if (!passesPhiSelection(pOrPt, phiPrime)) + continue; + + if (v0Selections.applyEtaCal) { + const double dedxCal{etaCal.pEtaCal->GetBinContent(etaCal.pEtaCal->FindBin(eta))}; + if (dedxCal > kMindEdxMIP && dedxCal < kMaxdEdxMIP) + dedx *= (50.0 / dedxCal); + else + continue; + } - if (momentum > 0.4 && momentum < 0.6 && dedx < 65.0) { + if (momentum > kMinPMIP && momentum < kMaxPMIP && dedx > kMindEdxMIP && dedx < kMaxdEdxMIP) { registry.fill(HIST("dEdxVsEtaPiMIP"), eta, dedx); registry.fill(HIST("dEdxVsEtaPiMIPp"), eta, dedx); + registry.fill(HIST("NclVsEtaPiMIP"), eta, track.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPiMIPp"), eta, track.tpcNClsFound()); } registry.fill(HIST("NclFindableVsPt"), pt, track.tpcNClsFindable()); registry.fill(HIST("NclFindableVsPtp"), pt, track.tpcNClsFindable()); registry.fill(HIST("NclFoundVsPt"), pt, track.tpcNClsFound()); registry.fill(HIST("NclFoundVsPtp"), pt, track.tpcNClsFound()); - registry.fill(HIST("NclFindableMinusFoundVsPt"), pt, track.tpcNClsFindableMinusFound()); - registry.fill(HIST("NclFindableMinusFoundVsPtp"), pt, track.tpcNClsFindableMinusFound()); registry.fill(HIST("NclVsEta"), eta, track.tpcNClsFound()); + registry.fill(HIST("NclFoundVsPVsPhipAfterCut"), momentum, phiPrime, track.tpcNClsFound()); + registry.fill(HIST("NclFoundVsPtVsPhipAfterCut"), pt, phiPrime, track.tpcNClsFound()); + registry.fill(HIST("dEdxVsMomentum"), momentum, dedx); - float phiPrime{phi}; - const int charge{track.sign()}; - PhiPrime(phiPrime, magField, charge); - registry.fill(HIST("NclFoundVsPtVsPhip"), pt, phiPrime, track.tpcNClsFound()); + int indexEta{0}; + for (int i = 1; i < kNEtaHists; ++i) { + if (eta >= kLowEta[i] && eta < kHighEta[i]) { + indexEta = i; + break; + } + } - registry.fill(HIST("dEdxVsMomentum"), momentum, dedx); + if (track.hasTOF() && track.goodTOFMatch()) { + const float tTOF{track.tofSignal()}; + const float trkLength{track.length()}; + const float tExpPiTOF{track.tofExpSignalPi(tTOF)}; + const float tExpElTOF{track.tofExpSignalEl(tTOF)}; + // const float dTOFPi{tTOF - tExpPiTOF - colTime}; + // const float dTOFEl{tTOF - tExpElTOF - colTime}; + + if (trkLength > kZero && tTOF > kZero) { + registry.fill(HIST("betaVsMomentum"), momentum, track.beta()); + registry.fill(HIST("TOFExpPi2TOF"), momentum, tExpPiTOF / tTOF); + registry.fill(HIST("TOFExpEl2TOF"), momentum, tExpElTOF / tTOF); + if (std::abs((tExpElTOF / tTOF) - kOne) < v0Selections.maxElTOFBeta) { + dEdxElTOF[0]->Fill(momentum, dedx); + dEdxElTOF[indexEta]->Fill(momentum, dedx); + } + + if (momentum > kMinPMIP && momentum < kMaxPMIP && dedx > kMindEdxMIPPlateau && dedx < kMaxdEdxMIPPlateau && std::abs((tExpElTOF / tTOF) - kOne) < v0Selections.maxElTOFBeta) { + registry.fill(HIST("dEdxVsEtaElMIP"), eta, dedx); + registry.fill(HIST("dEdxVsEtaElMIPp"), eta, dedx); + } + + if (std::abs((tExpPiTOF / tTOF) - kOne) < v0Selections.maxPiTOFBeta) { + dEdxPiTOF[0]->Fill(momentum, dedx); + dEdxPiTOF[indexEta]->Fill(momentum, dedx); + } + } + } } for (const auto& v0 : v0s) { @@ -347,105 +475,227 @@ struct piKpRAA { // Positive-(negative-)charged tracks (daughters) const auto& posTrack = v0.posTrack_as(); const auto& negTrack = v0.negTrack_as(); - + const int posTrackCharge{posTrack.sign()}; + const int negTrackCharge{negTrack.sign()}; + const float posTrkP{posTrack.p()}; + const float negTrkP{negTrack.p()}; + const float posTrkPt{posTrack.pt()}; + const float negTrkPt{negTrack.pt()}; + const float posTrkEta{posTrack.eta()}; + const float negTrkEta{negTrack.eta()}; + float posTrkdEdx{posTrack.tpcSignal()}; + float negTrkdEdx{negTrack.tpcSignal()}; + float posTrackPhiPrime{posTrack.phi()}; + float negTrackPhiPrime{negTrack.phi()}; + phiPrimeFunc(posTrackPhiPrime, magField, posTrackCharge); + phiPrimeFunc(negTrackPhiPrime, magField, negTrackCharge); + + // Skip v0s with like-sig daughters if (posTrack.sign() == negTrack.sign()) continue; + float pOrPtPos{v0Selections.usePinPhiSelection ? posTrkP : posTrkPt}; + float pOrPtNeg{v0Selections.usePinPhiSelection ? negTrkP : negTrkPt}; + + // Passes Geometrical (Phi) cut? + if (!(passesPhiSelection(pOrPtPos, posTrackPhiPrime) && passesPhiSelection(pOrPtNeg, negTrackPhiPrime))) + continue; + + // Passes daughters track-selection? if (!(passesTrackSelectionDaughters(posTrack) && passesTrackSelectionDaughters(negTrack))) continue; + if (v0Selections.applyEtaCal) { + const double dedxCal{etaCal.pEtaCal->GetBinContent(etaCal.pEtaCal->FindBin(posTrkEta))}; + if (dedxCal > kMindEdxMIP && dedxCal < kMaxdEdxMIP) + posTrkdEdx *= (50.0 / dedxCal); + else + continue; + } + + if (v0Selections.applyEtaCal) { + const double dedxCal{etaCal.pEtaCal->GetBinContent(etaCal.pEtaCal->FindBin(negTrkEta))}; + if (dedxCal > kMindEdxMIP && dedxCal < kMaxdEdxMIP) + negTrkdEdx *= (50.0 / dedxCal); + else + continue; + } + const TVector3 ppos(posTrack.px(), posTrack.py(), posTrack.pz()); const TVector3 pneg(negTrack.px(), negTrack.py(), negTrack.pz()); double alpha, qT; - GetArmeterosVariables(ppos, pneg, alpha, qT); + getArmeterosVariables(ppos, pneg, alpha, qT); registry.fill(HIST("ArmAll"), alpha, qT); + // Passes V0 topological cuts? if (!passesV0TopologicalSelection(v0)) continue; + // const float px[2] = {posTrack.px(), negTrack.px()}; + // const float py[2] = {posTrack.py(), negTrack.py()}; + // const float pz[2] = {posTrack.pz(), negTrack.pz()}; + // const double ePos{static_cast(posTrack.energy(o2::constants::physics::MassPositron))}; + // const double eEle{static_cast(negTrack.energy(o2::constants::physics::MassElectron))}; + // const double massG = std::sqrt(std::pow(ePos + eEle, 2.0) - (std::pow(px[0] + px[1], 2.0) + std::pow(py[0] + py[1], 2.0) + std::pow(pz[0] + pz[1], 2.0))); + + const double dMassK0s{std::abs(v0.mK0Short() - o2::constants::physics::MassK0Short)}; + const double dMassL{std::abs(v0.mLambda() - o2::constants::physics::MassLambda0)}; + const double dMassAL{std::abs(v0.mAntiLambda() - o2::constants::physics::MassLambda0)}; + const double dMassG{std::abs(v0.mGamma() - o2::constants::physics::MassGamma)}; + registry.fill(HIST("ArmAfterTopoSel"), alpha, qT); registry.fill(HIST("dcaDauVsPt"), v0.pt(), v0.dcapostopv()); registry.fill(HIST("dcaDauVsPt"), v0.pt(), v0.dcanegtopv()); - if (passesK0Selection(collision, v0)) { - registry.fill(HIST("nSigmaPiFromK0"), posTrack.pt(), posTrack.tpcNSigmaPi()); - registry.fill(HIST("nSigmaPiFromK0"), negTrack.pt(), negTrack.tpcNSigmaPi()); - registry.fill(HIST("ArmK0NOSel"), alpha, qT); - if (v0Selections.armPodCut * qT > std::abs(alpha)) { - if (v0Selections.applyInvMassSel) { - if (!(v0.mK0Short() > v0Selections.minMassK0s && v0.mK0Short() < v0Selections.maxMassK0s)) - continue; - } - registry.fill(HIST("ArmK0"), alpha, qT); - registry.fill(HIST("MassK0ShortVsPt"), v0.pt(), v0.mK0Short()); - - registry.fill(HIST("dEdxPiPos"), posTrack.p(), posTrack.tpcSignal()); - registry.fill(HIST("dEdxPiNeg"), negTrack.p(), negTrack.tpcSignal()); + int posIndexEta{0}; + int negIndexEta{0}; + for (int i = 1; i < kNEtaHists; ++i) { + if (posTrkEta >= kLowEta[i] && posTrkEta < kHighEta[i]) { + posIndexEta = i; + break; } } - if (passesLambdaSelection(collision, v0)) { - if (v0Selections.applyInvMassSel) { - if (!(v0.mLambda() > v0Selections.minMassLambda && v0.mLambda() < v0Selections.maxMassLambda)) - continue; + for (int i = 1; i < kNEtaHists; ++i) { + if (negTrkEta >= kLowEta[i] && negTrkEta < kHighEta[i]) { + negIndexEta = i; + break; } - registry.fill(HIST("nSigmaPrFromLambda"), posTrack.pt(), posTrack.tpcNSigmaPr()); - registry.fill(HIST("nSigmaPiFromLambda"), negTrack.pt(), negTrack.tpcNSigmaPi()); - registry.fill(HIST("ArmLambda"), alpha, qT); - registry.fill(HIST("MassLambdaVsPt"), v0.pt(), v0.mLambda()); - registry.fill(HIST("dEdxPiNeg"), negTrack.p(), negTrack.tpcSignal()); - registry.fill(HIST("dEdxPrPos"), posTrack.p(), posTrack.tpcSignal()); - // std::cout << "pos charge = " << posTrack.sign() << " | neg charge = " << negTrack.sign() << '\n'; } - if (passesAntiLambdaSelection(collision, v0)) { - if (v0Selections.applyInvMassSel) { - if (!(v0.mAntiLambda() > v0Selections.minMassLambda && v0.mAntiLambda() < v0Selections.maxMassLambda)) - continue; + if (v0Selections.applyInvMassSel) { // apply Inv. Mass selection? + if (dMassK0s < v0Selections.dMassSel && dMassL > v0Selections.dMassSel && dMassAL > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG) { // Mass cut + if (passesK0Selection(collision, v0)) { // nSigma TPC and y cuts + registry.fill(HIST("ArmK0NOSel"), alpha, qT); + if (v0Selections.armPodCut * qT > std::abs(alpha)) { // Armenters selection + registry.fill(HIST("ArmK0"), alpha, qT); + registry.fill(HIST("MassK0sVsPt"), v0.pt(), v0.mK0Short()); + registry.fill(HIST("nSigPiFromK0s"), posTrkPt, posTrack.tpcNSigmaPi()); + registry.fill(HIST("nSigPiFromK0s"), negTrkPt, negTrack.tpcNSigmaPi()); + + registry.fill(HIST("NclVsEtaPiV0"), posTrkEta, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPiV0p"), posTrkEta, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPiV0"), negTrkEta, negTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPiV0p"), negTrkEta, negTrack.tpcNClsFound()); + + registry.fill(HIST("NclVsPPiV0"), posTrkP, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsPPiV0p"), posTrkP, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsPPiV0"), negTrkP, negTrack.tpcNClsFound()); + registry.fill(HIST("NclVsPPiV0p"), negTrkP, negTrack.tpcNClsFound()); + + dEdxPiV0[0]->Fill(posTrkP, posTrkdEdx); + dEdxPiV0[0]->Fill(negTrkP, negTrkdEdx); + dEdxPiV0[posIndexEta]->Fill(posTrkP, posTrkdEdx); + dEdxPiV0[negIndexEta]->Fill(negTrkP, negTrkdEdx); + + if (posTrkP > kMinPMIP && posTrkP < kMaxPMIP && posTrkdEdx > kMindEdxMIP && posTrkdEdx < kMaxdEdxMIP) { + registry.fill(HIST("dEdxVsEtaPiMIPV0"), posTrkEta, posTrkdEdx); + registry.fill(HIST("dEdxVsEtaPiMIPV0p"), posTrkEta, posTrkdEdx); + } + if (negTrkP > kMinPMIP && negTrkP < kMaxPMIP && negTrkdEdx > kMindEdxMIP && negTrkdEdx < kMaxdEdxMIP) { + registry.fill(HIST("dEdxVsEtaPiMIPV0"), negTrkEta, negTrkdEdx); + registry.fill(HIST("dEdxVsEtaPiMIPV0p"), negTrkEta, negTrkdEdx); + } + } + } } - registry.fill(HIST("nSigmaPrFromAntiLambda"), posTrack.pt(), posTrack.tpcNSigmaPi()); - registry.fill(HIST("nSigmaPiFromAntiLambda"), negTrack.pt(), negTrack.tpcNSigmaPr()); - registry.fill(HIST("ArmAntiLambda"), alpha, qT); - registry.fill(HIST("MassAntiLambdaVsPt"), v0.pt(), v0.mAntiLambda()); - - registry.fill(HIST("dEdxPiPos"), posTrack.p(), posTrack.tpcSignal()); - registry.fill(HIST("dEdxPrNeg"), negTrack.p(), negTrack.tpcSignal()); } - if (passesGammaSelection(collision, v0)) { - - // const double ePos{static_cast(posTrack.energy(o2::constants::physics::MassElectron))}; - // const double eEle{static_cast(negTrack.energy(o2::constants::physics::MassElectron))}; - // const float px[2] = {posTrack.px(), negTrack.px()}; - // const float py[2] = {posTrack.py(), negTrack.py()}; - // const float pz[2] = {posTrack.pz(), negTrack.pz()}; - // const double invMass = std::sqrt(std::pow(ePos + eEle, 2.0) - (std::pow(px[0] + px[1], 2.0) + std::pow(py[0] + py[1], 2.0) + std::pow(pz[0] + pz[1], 2.0))); - - if (v0Selections.applyInvMassSel) { - if (!(v0.mGamma() > v0Selections.minMassGamma && v0.mGamma() < v0Selections.maxMassGamma)) - continue; + + if (v0Selections.applyInvMassSel) { + if (dMassL < v0Selections.dMassSel && dMassK0s > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG) { + if (passesLambdaSelection(collision, v0)) { + registry.fill(HIST("ArmL"), alpha, qT); + registry.fill(HIST("MassLVsPt"), v0.pt(), v0.mLambda()); + registry.fill(HIST("nSigPrFromL"), posTrkPt, posTrack.tpcNSigmaPr()); + registry.fill(HIST("nSigPiFromL"), negTrkPt, negTrack.tpcNSigmaPi()); + + registry.fill(HIST("NclVsEtaPrV0"), posTrkEta, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPrV0p"), posTrkEta, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPiV0"), negTrkEta, negTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPiV0p"), negTrkEta, negTrack.tpcNClsFound()); + + registry.fill(HIST("NclVsPPrV0"), posTrkP, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsPPrV0p"), posTrkP, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsPPiV0"), negTrkP, negTrack.tpcNClsFound()); + registry.fill(HIST("NclVsPPiV0p"), negTrkP, negTrack.tpcNClsFound()); + + dEdxPrV0[0]->Fill(posTrkP, posTrkdEdx); + dEdxPiV0[0]->Fill(negTrkP, negTrkdEdx); + dEdxPrV0[posIndexEta]->Fill(posTrkP, posTrkdEdx); + dEdxPiV0[negIndexEta]->Fill(negTrkP, negTrkdEdx); + } } + } - registry.fill(HIST("MassGammaVsPt"), v0.pt(), v0.mGamma()); - registry.fill(HIST("dEdxEl"), posTrack.p(), posTrack.tpcSignal()); - registry.fill(HIST("dEdxEl"), negTrack.p(), negTrack.tpcSignal()); + if (v0Selections.applyInvMassSel && dMassAL < v0Selections.dMassSel && dMassK0s > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG) { + if (passesAntiLambdaSelection(collision, v0)) { + registry.fill(HIST("ArmAL"), alpha, qT); + registry.fill(HIST("MassALVsPt"), v0.pt(), v0.mAntiLambda()); + registry.fill(HIST("nSigPrFromAL"), negTrkPt, negTrack.tpcNSigmaPr()); + registry.fill(HIST("nSigPiFromAL"), posTrkPt, posTrack.tpcNSigmaPi()); + + registry.fill(HIST("NclVsEtaPiV0"), posTrkEta, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPiV0p"), posTrkEta, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPrV0"), negTrkEta, negTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPrV0p"), negTrkEta, negTrack.tpcNClsFound()); + + registry.fill(HIST("NclVsPPiV0"), posTrkP, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsPPiV0p"), posTrkP, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsPPrV0"), negTrkP, negTrack.tpcNClsFound()); + registry.fill(HIST("NclVsPPrV0p"), negTrkP, negTrack.tpcNClsFound()); + + dEdxPiV0[0]->Fill(posTrkP, posTrkdEdx); + dEdxPrV0[0]->Fill(negTrkP, negTrkdEdx); + dEdxPiV0[posIndexEta]->Fill(posTrkP, posTrkdEdx); + dEdxPrV0[negIndexEta]->Fill(negTrkP, negTrkdEdx); + } + } - registry.fill(HIST("nSigmaElFromGammaConv"), negTrack.pt(), negTrack.tpcNSigmaEl()); - registry.fill(HIST("nSigmaElFromGammaConv"), posTrack.pt(), posTrack.tpcNSigmaEl()); - registry.fill(HIST("ArmGamma"), alpha, qT); + if (v0Selections.applyInvMassSel && dMassK0s > v0Selections.dMassSel && dMassL > v0Selections.dMassSel && dMassAL > v0Selections.dMassSel && dMassG < v0Selections.dMassSel) { + if (passesGammaSelection(collision, v0)) { + registry.fill(HIST("ArmG"), alpha, qT); + registry.fill(HIST("MassGVsPt"), v0.pt(), v0.mGamma()); + registry.fill(HIST("nSigElFromG"), negTrkPt, negTrack.tpcNSigmaEl()); + registry.fill(HIST("nSigElFromG"), posTrkPt, posTrack.tpcNSigmaEl()); + + registry.fill(HIST("NclVsEtaElV0"), posTrkEta, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaElV0p"), posTrkEta, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaElV0"), negTrkEta, negTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaElV0p"), negTrkEta, negTrack.tpcNClsFound()); + + registry.fill(HIST("NclVsPElV0"), posTrkP, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsPElV0p"), posTrkP, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsPElV0"), negTrkP, negTrack.tpcNClsFound()); + registry.fill(HIST("NclVsPElV0p"), negTrkP, negTrack.tpcNClsFound()); + + dEdxElV0[0]->Fill(posTrkP, posTrkdEdx); + dEdxElV0[0]->Fill(negTrkP, negTrkdEdx); + dEdxElV0[posIndexEta]->Fill(posTrkP, posTrkdEdx); + dEdxElV0[negIndexEta]->Fill(negTrkP, negTrkdEdx); + + if (posTrkP > kMinPMIP && posTrkP < kMaxPMIP) { + registry.fill(HIST("dEdxVsEtaElMIPV0"), posTrkEta, posTrkdEdx); + registry.fill(HIST("dEdxVsEtaElMIPV0p"), posTrkEta, posTrkdEdx); + } + if (negTrkP > kMinPMIP && negTrkP < kMaxPMIP) { + registry.fill(HIST("dEdxVsEtaElMIPV0"), negTrkEta, negTrkdEdx); + registry.fill(HIST("dEdxVsEtaElMIPV0p"), negTrkEta, negTrkdEdx); + } + } } } } - PROCESS_SWITCH(piKpRAA, processCalibrationAndV0s, "Process QA", true); + PROCESS_SWITCH(PiKpRAA, processCalibrationAndV0s, "Process QA", true); template - void GetArmeterosVariables(const T& ppos, const T& pneg, U& alpha, U& qT) + void getArmeterosVariables(const T& ppos, const T& pneg, U& alpha, U& qT) { alpha = 0., qT = 0.; TVector3 pV0 = ppos + pneg; double pV0mag = pV0.Mag(); - if (pV0mag < 1e-9) + if (pV0mag < kTenToMinusNine) return; // protect against zero momentum const TVector3 u = pV0 * (1.0 / pV0mag); @@ -459,7 +709,7 @@ struct piKpRAA { // α: longitudinal asymmetry (uses + and − labels by charge) double denom = pLpos + pLneg; - if (std::abs(denom) < 1e-9) + if (std::abs(denom) < kTenToMinusNine) return; // avoid 0 division (unphysical for V0s) alpha = (pLpos - pLneg) / denom; // equivalently / pV0mag @@ -490,6 +740,7 @@ struct piKpRAA { { bool isSelected = trkSelDaugthers.IsSelected(track) ? true : false; + return isSelected; } @@ -518,8 +769,11 @@ struct piKpRAA { const double posRadiusNsigma{std::sqrt(std::pow(posTPCNsigma, 2.) + std::pow(posTOFNsigma, 2.))}; const double negRadiusNsigma{std::sqrt(std::pow(negTPCNsigma, 2.) + std::pow(negTOFNsigma, 2.))}; - // bool isSelected = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecut->get("lifetimecutK0S") && std::abs(v0.yK0Short()) < v0Selections.rapidityCut && posTPCNsigma < v0Selections.tpcPidNsigmaCut && negTPCNsigma < v0Selections.tpcPidNsigmaCut ? true : false; - bool isSelected = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecut->get("lifetimecutK0S") && std::abs(v0.yK0Short()) < v0Selections.rapidityCut && posTrack.hasTOF() && negTrack.hasTOF() && posRadiusNsigma < v0Selections.tpcPidNsigmaCut && negRadiusNsigma < v0Selections.tpcPidNsigmaCut ? true : false; + bool isSelected{false}; + if (v0Selections.applyTPCTOFCombinedCut) + isSelected = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecut->get("lifetimecutK0S") && std::abs(v0.yK0Short()) < v0Selections.rapidityCut && posTrack.hasTOF() && negTrack.hasTOF() && posRadiusNsigma < v0Selections.tpcPidNsigmaCut && negRadiusNsigma < v0Selections.tpcPidNsigmaCut ? true : false; + else + isSelected = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecut->get("lifetimecutK0S") && std::abs(v0.yK0Short()) < v0Selections.rapidityCut && posTPCNsigma < v0Selections.tpcPidNsigmaCut && negTPCNsigma < v0Selections.tpcPidNsigmaCut ? true : false; return isSelected; } @@ -539,7 +793,11 @@ struct piKpRAA { const double posRadiusNsigma{std::sqrt(std::pow(posTPCNsigma, 2.) + std::pow(posTOFNsigma, 2.))}; const double negRadiusNsigma{std::sqrt(std::pow(negTPCNsigma, 2.) + std::pow(negTOFNsigma, 2.))}; - bool isSelected = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 < lifetimecut->get("lifetimecutLambda") && std::abs(v0.yLambda()) < v0Selections.rapidityCut && posTrack.hasTOF() && negTrack.hasTOF() && posRadiusNsigma < v0Selections.tpcPidNsigmaCut && negRadiusNsigma < v0Selections.tpcPidNsigmaCut ? true : false; + bool isSelected{false}; + if (v0Selections.applyTPCTOFCombinedCut) + isSelected = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 < lifetimecut->get("lifetimecutLambda") && std::abs(v0.yLambda()) < v0Selections.rapidityCut && posTrack.hasTOF() && negTrack.hasTOF() && posRadiusNsigma < v0Selections.tpcPidNsigmaCut && negRadiusNsigma < v0Selections.tpcPidNsigmaCut ? true : false; + else + isSelected = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 < lifetimecut->get("lifetimecutLambda") && std::abs(v0.yLambda()) < v0Selections.rapidityCut && posTPCNsigma < v0Selections.tpcPidNsigmaCut && negTPCNsigma < v0Selections.tpcPidNsigmaCut ? true : false; return isSelected; } @@ -559,7 +817,11 @@ struct piKpRAA { const double posRadiusNsigma{std::sqrt(std::pow(posTPCNsigma, 2.) + std::pow(posTOFNsigma, 2.))}; const double negRadiusNsigma{std::sqrt(std::pow(negTPCNsigma, 2.) + std::pow(negTOFNsigma, 2.))}; - bool isSelected = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 < lifetimecut->get("lifetimecutLambda") && std::abs(v0.yLambda()) < v0Selections.rapidityCut && posTrack.hasTOF() && negTrack.hasTOF() && posRadiusNsigma < v0Selections.tpcPidNsigmaCut && negRadiusNsigma < v0Selections.tpcPidNsigmaCut ? true : false; + bool isSelected{false}; + if (v0Selections.applyTPCTOFCombinedCut) + isSelected = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 < lifetimecut->get("lifetimecutLambda") && std::abs(v0.yLambda()) < v0Selections.rapidityCut && posTrack.hasTOF() && negTrack.hasTOF() && posRadiusNsigma < v0Selections.tpcPidNsigmaCut && negRadiusNsigma < v0Selections.tpcPidNsigmaCut ? true : false; + else + isSelected = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 < lifetimecut->get("lifetimecutLambda") && std::abs(v0.yLambda()) < v0Selections.rapidityCut && posTPCNsigma < v0Selections.tpcPidNsigmaCut && negTPCNsigma < v0Selections.tpcPidNsigmaCut ? true : false; return isSelected; } @@ -581,11 +843,11 @@ struct piKpRAA { if (!(std::abs(yGamma) < v0Selections.rapidityCut)) return false; - if (!(posTrack.hasTOF() && negTrack.hasTOF())) - return false; - - bool isSelected = posRadiusNsigma < v0Selections.tpcPidNsigmaCut && negRadiusNsigma < v0Selections.tpcPidNsigmaCut ? true : false; - // bool isSelected = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 < lifetimecut->get("lifetimecutLambda") && std::abs(v0.yLambda()) < v0Selections.rapidityCut && posTrack.hasTOF() && negTrack.hasTOF() && posRadiusNsigma < v0Selections.tpcPidNsigmaCut && negRadiusNsigma < v0Selections.tpcPidNsigmaCut ? true : false; + bool isSelected{false}; + if (v0Selections.applyTPCTOFCombinedCut) + isSelected = posTrack.hasTOF() && negTrack.hasTOF() && posRadiusNsigma < v0Selections.tpcPidNsigmaCut && negRadiusNsigma < v0Selections.tpcPidNsigmaCut ? true : false; + else + isSelected = posTPCNsigma < v0Selections.tpcPidNsigmaCut && negTPCNsigma < v0Selections.tpcPidNsigmaCut ? true : false; return isSelected; } @@ -605,12 +867,7 @@ struct piKpRAA { return grpo->getNominalL3Field(); } - bool passesGeometricalCut() - { - return true; - } - - void PhiPrime(float& phi, const int& magField, const int& charge) + void phiPrimeFunc(float& phi, const int& magField, const int& charge) { if (magField < 0) // for negatve polarity field @@ -622,6 +879,21 @@ struct piKpRAA { phi = std::fmod(phi, o2::constants::math::PI / 9.0f); } + bool passesPhiSelection(const float& pt, const float& phi) + { + + bool isSelected{false}; + if (v0Selections.applyPhiCut && phiCut.isPhiCutLoaded) { + const int binLow{phiCut.hPhiCutLow->FindBin(pt)}; + const int binHigh{phiCut.hPhiCutHigh->FindBin(pt)}; + const double phiCutLow{phiCut.hPhiCutLow->GetBinContent(binLow)}; + const double phiCutHigh{phiCut.hPhiCutHigh->GetBinContent(binHigh)}; + if (phi < phiCutLow || phi > phiCutHigh) + isSelected = true; + } + return isSelected; + } + template bool isEventSelected(CheckCol const& col) { @@ -729,53 +1001,42 @@ struct piKpRAA { } } - void loadCorrections(uint64_t timeStamp) + void loadPhiCutSelections() { - // if (cfg.correctionsLoaded) return; - - if (paTHEff.value.empty() == false) { - cfg.hEfficiency = - ccdb->getForTimeStamp(paTHEff, timeStamp); - if (cfg.hEfficiency == nullptr) { - LOGF(fatal, "Could not load efficiency histogram from %s", - paTHEff.value.c_str()); + + if (pathPhiCutHigh.value.empty() == false) { + phiCut.hPhiCutHigh = ccdb->getForTimeStamp(pathPhiCutHigh, ccdbNoLaterThan.value); + if (phiCut.hPhiCutHigh == nullptr) { + LOGF(fatal, "Could not load efficiency histogram from %s", pathPhiCutHigh.value.c_str()); } } - if (paTHFD.value.empty() == false) { - cfg.hFeedDown = ccdb->getForTimeStamp(paTHFD, timeStamp); - if (cfg.hFeedDown == nullptr) { - LOGF(fatal, "Could not load feed down histogram from %s", - paTHFD.value.c_str()); + if (pathPhiCutLow.value.empty() == false) { + phiCut.hPhiCutLow = ccdb->getForTimeStamp(pathPhiCutLow, ccdbNoLaterThan.value); + if (phiCut.hPhiCutLow == nullptr) { + LOGF(fatal, "Could not load efficiency histogram from %s", pathPhiCutLow.value.c_str()); } } - cfg.correctionsLoaded = true; + + if (phiCut.hPhiCutHigh && phiCut.hPhiCutLow) + phiCut.isPhiCutLoaded = true; } - void loadNchCalibrations(uint64_t timeStamp) + void loadEtaCalibration() { - if (paTHmeanNch.value.empty() == false) { - cfgNch.hMeanNch = - ccdb->getForTimeStamp(paTHmeanNch, timeStamp); - if (cfgNch.hMeanNch == nullptr) { - LOGF(fatal, "Could not load hMeanNch histogram from %s", - paTHmeanNch.value.c_str()); + if (pathEtaCal.value.empty() == false) { + etaCal.pEtaCal = ccdb->getForTimeStamp(pathEtaCal, ccdbNoLaterThan.value); + if (etaCal.pEtaCal == nullptr) { + LOGF(fatal, "Could not load pEtaCal from %s", pathEtaCal.value.c_str()); } } - if (paTHsigmaNch.value.empty() == false) { - cfgNch.hSigmaNch = - ccdb->getForTimeStamp(paTHsigmaNch, timeStamp); - if (cfgNch.hSigmaNch == nullptr) { - LOGF(fatal, "Could not load hSigmaNch histogram from %s", - paTHsigmaNch.value.c_str()); - } - } - cfgNch.calibrationsLoaded = true; + if (etaCal.pEtaCal) + etaCal.isCalLoaded = true; } }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{adaptAnalysisTask(cfgc)}; + return WorkflowSpec{adaptAnalysisTask(cfgc)}; } From e807d543f6eca39c16993ba4c68ee33ebeb9a31e Mon Sep 17 00:00:00 2001 From: Maximiliano Puccio Date: Thu, 28 Aug 2025 16:12:37 +0200 Subject: [PATCH 228/986] [PWGLF] Make sure that B field is updated when necessary (#12777) --- PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx b/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx index bcd914b3df3..633dd9dbb96 100644 --- a/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx +++ b/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx @@ -501,7 +501,8 @@ struct decay3bodyBuilder { auto timestamp = bc.timestamp(); o2::parameters::GRPMagField* grpmag = 0x0; - grpmag = ccdb->getForTimeStamp(ccdbConfigurations.grpmagPath, timestamp); + ccdb->clearCache(ccdbConfigurations.grpmagPath); + grpmag = ccdb->getSpecific(ccdbConfigurations.grpmagPath, timestamp); if (!grpmag) { LOG(fatal) << "Got nullptr from CCDB for path " << ccdbConfigurations.grpmagPath << " of object GRPMagField for timestamp " << timestamp; } From fd83fb58ea2d8a49e291842d2d534e163dd42e40 Mon Sep 17 00:00:00 2001 From: Maximiliano Puccio Date: Thu, 28 Aug 2025 17:44:54 +0200 Subject: [PATCH 229/986] [PWGLF] Make sure that B field is updated in reduced 3 body creator (#12778) --- PWGLF/TableProducer/Nuspex/reduced3bodyCreator.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PWGLF/TableProducer/Nuspex/reduced3bodyCreator.cxx b/PWGLF/TableProducer/Nuspex/reduced3bodyCreator.cxx index e164dc2794c..51693e178b1 100644 --- a/PWGLF/TableProducer/Nuspex/reduced3bodyCreator.cxx +++ b/PWGLF/TableProducer/Nuspex/reduced3bodyCreator.cxx @@ -182,7 +182,8 @@ struct reduced3bodyCreator { // In case override, don't proceed, please - no CCDB access required auto run3grp_timestamp = bc.timestamp(); - o2::parameters::GRPMagField* grpmag = ccdb->getForTimeStamp(grpmagPath, run3grp_timestamp); + ccdb->clearCache(grpmagPath); + o2::parameters::GRPMagField* grpmag = ccdb->getSpecific(grpmagPath, run3grp_timestamp); if (!grpmag) { LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp; } From b3ccba69c6030d25b3c9d1ace4e7bb4e9b8576a7 Mon Sep 17 00:00:00 2001 From: Marcello Di Costanzo <96481191+Marcellocosti@users.noreply.github.com> Date: Thu, 28 Aug 2025 19:16:44 +0200 Subject: [PATCH 230/986] [PWGHF] Task for D+ and Ds correlations in small systems (#12776) Co-authored-by: ALICE Action Bot --- .../DataModel/DerivedDataCorrelationTables.h | 66 ++++- PWGHF/HFC/TableProducer/CMakeLists.txt | 5 + .../correlatorFlowCharmHadrons.cxx | 272 ++++++++++++++++++ 3 files changed, 333 insertions(+), 10 deletions(-) create mode 100644 PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx diff --git a/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h b/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h index 39a3231977c..d48cd0f9d10 100644 --- a/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h +++ b/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h @@ -24,6 +24,7 @@ namespace hf_collisions_reduced { DECLARE_SOA_COLUMN(NumPvContrib, numPvContrib, int); //! Event multiplicity from PV contributors DECLARE_SOA_COLUMN(Multiplicity, multiplicity, float); //! Event multiplicity +DECLARE_SOA_COLUMN(Centrality, centrality, float); //! Event centrality DECLARE_SOA_COLUMN(PosZ, posZ, float); //! Primary vertex z position } // namespace hf_collisions_reduced @@ -34,6 +35,13 @@ DECLARE_SOA_TABLE(HfcRedCollisions, "AOD", "HFCREDCOLLISION", //! Table with col aod::hf_collisions_reduced::NumPvContrib, aod::hf_collisions_reduced::PosZ); +DECLARE_SOA_TABLE(HfcRedFlowColls, "AOD", "HFCREDFLOWCOLL", //! Table with collision info + soa::Index<>, + aod::hf_collisions_reduced::Multiplicity, + aod::hf_collisions_reduced::NumPvContrib, + aod::hf_collisions_reduced::Centrality, + aod::hf_collisions_reduced::PosZ); + using HfcRedCollision = HfcRedCollisions::iterator; // DECLARE_SOA_TABLE(HfCandColCounts, "AOD", "HFCANDCOLCOUNT", //! Table with number of collisions which contain at least one candidate @@ -41,16 +49,20 @@ using HfcRedCollision = HfcRedCollisions::iterator; namespace hf_candidate_reduced { -DECLARE_SOA_INDEX_COLUMN(HfcRedCollision, hfcRedCollision); //! ReducedCollision index -DECLARE_SOA_COLUMN(Prong0Id, prong0Id, int); //! Prong 0 index -DECLARE_SOA_COLUMN(Prong1Id, prong1Id, int); //! Prong 1 index -DECLARE_SOA_COLUMN(Prong2Id, prong2Id, int); //! Prong2 index -DECLARE_SOA_COLUMN(PhiCand, phiCand, float); //! Phi of the candidate -DECLARE_SOA_COLUMN(EtaCand, etaCand, float); //! Eta of the candidate -DECLARE_SOA_COLUMN(PtCand, ptCand, float); //! Pt of the candidate -DECLARE_SOA_COLUMN(InvMassDs, invMassDs, float); //! Invariant mass of Ds candidate -DECLARE_SOA_COLUMN(BdtScorePrompt, bdtScorePrompt, float); //! BDT output score for prompt hypothesis -DECLARE_SOA_COLUMN(BdtScoreBkg, bdtScoreBkg, float); //! BDT output score for backgronud hypothesis +DECLARE_SOA_INDEX_COLUMN(HfcRedCollision, hfcRedCollision); //! ReducedCollision index +DECLARE_SOA_INDEX_COLUMN(HfcRedFlowColl, hfcRedFlowColl); //! ReducedCollision index +DECLARE_SOA_COLUMN(Prong0Id, prong0Id, int); //! Prong 0 index +DECLARE_SOA_COLUMN(Prong1Id, prong1Id, int); //! Prong 1 index +DECLARE_SOA_COLUMN(Prong2Id, prong2Id, int); //! Prong2 index +DECLARE_SOA_COLUMN(PhiCand, phiCand, float); //! Phi of the candidate +DECLARE_SOA_COLUMN(EtaCand, etaCand, float); //! Eta of the candidate +DECLARE_SOA_COLUMN(PtCand, ptCand, float); //! Pt of the candidate +DECLARE_SOA_COLUMN(InvMassDs, invMassDs, float); //! Invariant mass of Ds candidate +DECLARE_SOA_COLUMN(InvMassCharmHad, invMassCharmHad, float); //! Invariant mass of CharmHad candidate +DECLARE_SOA_COLUMN(BdtScorePrompt, bdtScorePrompt, float); //! BDT output score for prompt hypothesis +DECLARE_SOA_COLUMN(BdtScoreBkg, bdtScoreBkg, float); //! BDT output score for backgronud hypothesis +DECLARE_SOA_COLUMN(BdtScore0, bdtScore0, float); //! First BDT output score +DECLARE_SOA_COLUMN(BdtScore1, bdtScore1, float); //! Second BDT output score } // namespace hf_candidate_reduced DECLARE_SOA_TABLE(DsCandReduceds, "AOD", "DSCANDREDUCED", //! Table with Ds candidate info soa::Index<>, @@ -69,6 +81,23 @@ DECLARE_SOA_TABLE(DsCandSelInfos, "AOD", "DSCANDSELINFO", //! Table with Ds cand aod::hf_candidate_reduced::BdtScorePrompt, aod::hf_candidate_reduced::BdtScoreBkg); +DECLARE_SOA_TABLE(HfcRedCharmHads, "AOD", "HFCREDCHARMHAD", //! Table with charm hadron candidate info + soa::Index<>, + aod::hf_candidate_reduced::HfcRedFlowCollId, + aod::hf_candidate_reduced::PhiCand, + aod::hf_candidate_reduced::EtaCand, + aod::hf_candidate_reduced::PtCand, + aod::hf_candidate_reduced::InvMassCharmHad, + aod::hf_candidate_reduced::Prong0Id, + aod::hf_candidate_reduced::Prong1Id, + aod::hf_candidate_reduced::Prong2Id); + +DECLARE_SOA_TABLE(HfcRedCharmMls, "AOD", "HFCREDCHARMML", //! Table with charm hadron candidate selection info + soa::Index<>, + aod::hf_candidate_reduced::HfcRedFlowCollId, + aod::hf_candidate_reduced::BdtScore0, + aod::hf_candidate_reduced::BdtScore1); + namespace hf_assoc_track_reduced { DECLARE_SOA_COLUMN(OriginTrackId, originTrackId, int); //! Original track index @@ -97,6 +126,23 @@ DECLARE_SOA_TABLE(AssocTrackSels, "AOD", "ASSOCTRACKSEL", //! Table with associa aod::hf_assoc_track_reduced::ItsNCls, aod::hf_assoc_track_reduced::DcaXY, aod::hf_assoc_track_reduced::DcaZ) + +DECLARE_SOA_TABLE(HfcRedTrkAssoc, "AOD", "HFCREDTRKASSOC", //! Table with associated track info + soa::Index<>, + aod::hf_candidate_reduced::HfcRedFlowCollId, + aod::hf_assoc_track_reduced::OriginTrackId, + aod::hf_assoc_track_reduced::PhiAssocTrack, + aod::hf_assoc_track_reduced::EtaAssocTrack, + aod::hf_assoc_track_reduced::PtAssocTrack); + +DECLARE_SOA_TABLE(HfcRedTrkSels, "AOD", "HFCREDTRKSELS", //! Table with associated track info + soa::Index<>, + aod::hf_candidate_reduced::HfcRedFlowCollId, + aod::hf_assoc_track_reduced::NTpcCrossedRows, + aod::hf_assoc_track_reduced::ItsClusterMap, + aod::hf_assoc_track_reduced::ItsNCls, + aod::hf_assoc_track_reduced::DcaXY, + aod::hf_assoc_track_reduced::DcaZ) } // namespace o2::aod #endif // PWGHF_HFC_DATAMODEL_DERIVEDDATACORRELATIONTABLES_H_ diff --git a/PWGHF/HFC/TableProducer/CMakeLists.txt b/PWGHF/HFC/TableProducer/CMakeLists.txt index 99f2c4fb152..eff0f6557b3 100644 --- a/PWGHF/HFC/TableProducer/CMakeLists.txt +++ b/PWGHF/HFC/TableProducer/CMakeLists.txt @@ -44,6 +44,11 @@ o2physics_add_dpl_workflow(correlator-ds-hadrons PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(correlator-flow-charm-hadrons + SOURCES correlatorFlowCharmHadrons.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(correlator-ds-hadrons-reduced SOURCES correlatorDsHadronsReduced.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore diff --git a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx new file mode 100644 index 00000000000..ec5f2a40c19 --- /dev/null +++ b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx @@ -0,0 +1,272 @@ +// 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 correlatorFlowCharmHadrons.cxx +/// \brief CharmHadrons-Hadrons correlator tree creator for data and MC-reco analyses +/// \author Marcello Di Costanzo , Politecnico and INFN Torino +/// \author Stefano Politanò , CERN + +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h" +#include "PWGHF/Utils/utilsEvSelHf.h" + +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +using namespace o2; +using namespace o2::hf_centrality; +using namespace o2::hf_evsel; + +enum DecayChannel { + DplusToPiKPi = 0, + DsToKKPi, + DsToPiKK +}; + +/// Code to select collisions with at least one Ds meson +struct HfCorrelatorFlowCharmHadrons { + Produces rowCollisions; + Produces rowCharmCandidates; + Produces rowCharmCandidatesMl; + Produces rowAssocTrackReduced; + Produces rowAssocTrackSelInfo; + + Configurable centEstimator{"centEstimator", 2, "Centrality estimation (FT0A: 1, FT0C: 2, FT0M: 3, FV0A: 4)"}; + Configurable selectionFlag{"selectionFlag", 1, "Selection Flag for hadron (e.g. 1 for skimming, 3 for topo. and kine., 7 for PID)"}; + Configurable forceCharmInCollision{"forceCharmInCollision", false, "Flag to force charm in collision"}; + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable> classMl{"classMl", {0, 2}, "Indexes of BDT scores to be stored. Two indexes max."}; + Configurable yCandMax{"yCandMax", 0.8, "max. cand. rapidity"}; + Configurable ptCandMin{"ptCandMin", 1., "min. cand. pT"}; + Configurable ptCandMax{"ptCandMax", 24., "max. cand. pT"}; + Configurable etaTrackMax{"etaTrackMax", 1., "max. track eta"}; + Configurable ptTrackMin{"ptTrackMin", 0.15, "min. track pT"}; + Configurable ptTrackMax{"ptTrackMax", 5., "max. track pT"}; + Configurable dcaXYTrackMax{"dcaXYTrackMax", 1., "max. track DCA XY"}; + Configurable dcaZTrackMax{"dcaZTrackMax", 1., "max. track DCA Z"}; + + HfHelper hfHelper; + HfEventSelection hfEvSel; // event selection and monitoring + o2::framework::Service ccdb; + SliceCache cache; + + double massCharm{0.}; + + using CollsWithCentMult = soa::Join; + using CandDsDataWMl = soa::Filtered>; + using CandDplusDataWMl = soa::Filtered>; + using TracksData = soa::Filtered>; + + Filter filterSelectDsCandidates = aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlag || aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlag; + Filter filterSelectDplusCandidates = aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= selectionFlag; + Filter filterSelectTrackData = (nabs(aod::track::eta) < etaTrackMax) && (aod::track::pt > ptTrackMin) && (aod::track::pt < ptTrackMax) && (nabs(aod::track::dcaXY) < dcaXYTrackMax) && (nabs(aod::track::dcaZ) < dcaZTrackMax); + + Preslice candsDsPerCollWMl = aod::hf_cand::collisionId; + Preslice candsDplusPerCollWMl = aod::hf_cand::collisionId; + Preslice trackIndicesPerColl = aod::track::collisionId; + + Partition selectedDsToKKPiWMl = aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlag; + Partition selectedDsToPiKKWMl = aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlag; + + HistogramRegistry registry{"registry", {}}; + + void init(InitContext&) + { + if (doprocessDplusWithMl) { + massCharm = o2::constants::physics::MassDPlus; + } else if (doprocessDsWithMl) { + massCharm = o2::constants::physics::MassDS; + } + + hfEvSel.addHistograms(registry); // collision monitoring + ccdb->setURL(ccdbUrl); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + }; // end init + + /// Check event selections for collision and fill the collision table + /// \param collision is the collision + template + bool checkAndFillCollision(Coll const& collision) + { + float cent{-1.f}; + float mult{-1.f}; + o2::hf_evsel::HfCollisionRejectionMask collRejMask{}; + if (centEstimator == CentralityEstimator::FT0A) { + collRejMask = hfEvSel.getHfCollisionRejectionMask(collision, cent, ccdb, registry); + mult = collision.multFT0A(); + } else if (centEstimator == CentralityEstimator::FT0C) { + collRejMask = hfEvSel.getHfCollisionRejectionMask(collision, cent, ccdb, registry); + mult = collision.multFT0C(); + } else if (centEstimator == CentralityEstimator::FT0M) { + collRejMask = hfEvSel.getHfCollisionRejectionMask(collision, cent, ccdb, registry); + mult = collision.multFT0M(); + } else if (centEstimator == CentralityEstimator::FV0A) { + collRejMask = hfEvSel.getHfCollisionRejectionMask(collision, cent, ccdb, registry); + mult = collision.multFV0A(); + } else { + LOG(fatal) << "Centrality estimator not recognized for collision selection"; + std::abort(); + } + hfEvSel.fillHistograms(collision, collRejMask, cent); + if (collRejMask != 0) { + return false; + } + rowCollisions(mult, collision.numContrib(), cent, collision.posZ()); + return true; + } + + /// Get charm hadron candidate mass + /// \param candidate is the charm hadron candidate + template + double getCandMass(const TCand& candidate) + { + if constexpr (channel == DecayChannel::DsToKKPi) { + return hfHelper.invMassDsToKKPi(candidate); + } + if constexpr (channel == DecayChannel::DsToPiKK) { + return hfHelper.invMassDsToPiKK(candidate); + } + if constexpr (channel == DecayChannel::DplusToPiKPi) { + return hfHelper.invMassDplusToPiKPi(candidate); + } + return -1.; + } + + /// Get charm hadron bdt scores + /// \param candidate is the charm hadron candidate + template + std::vector getCandMlScores(const TCand& candidate) + { + std::vector outputMl{-999., -999.}; + if constexpr (channel == DecayChannel::DsToKKPi) { + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { + outputMl[iclass] = candidate.mlProbDsToKKPi()[classMl->at(iclass)]; + } + } + if constexpr (channel == DecayChannel::DsToPiKK) { + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { + outputMl[iclass] = candidate.mlProbDsToPiKK()[classMl->at(iclass)]; + } + } + if constexpr (channel == DecayChannel::DplusToPiKPi) { + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { + outputMl[iclass] = candidate.mlProbDplusToPiKPi()[classMl->at(iclass)]; + } + } + return outputMl; + } + + /// Fill charm hadron tables + /// \param candidates are the selected charm hadron candidates + template + void fillCharmHadronTables(TCand const& candidates) + { + int indexRedColl = rowCollisions.lastIndex(); + for (const auto& candidate : candidates) { + if (std::abs(candidate.y(massCharm)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { + continue; + } + double massCand = getCandMass(candidate); + rowCharmCandidates(indexRedColl, candidate.phi(), candidate.eta(), candidate.pt(), massCand, candidate.prong0Id(), candidate.prong1Id(), candidate.prong2Id()); + + std::vector outputMl = getCandMlScores(candidate); + rowCharmCandidatesMl(indexRedColl, outputMl[0], outputMl[1]); + } + } + + /// Fill tracks tables + /// \param tracks are the selected tracks + template + void fillTracksTables(TTrack const& tracks) + { + int indexRedColl = rowCollisions.lastIndex(); + for (const auto& track : tracks) { + if (!track.isGlobalTrackWoDCA()) { + continue; + } + rowAssocTrackReduced(indexRedColl, track.globalIndex(), track.phi(), track.eta(), track.pt()); + rowAssocTrackSelInfo(indexRedColl, track.tpcNClsCrossedRows(), track.itsClusterMap(), track.itsNCls(), track.dcaXY(), track.dcaZ()); + } + } + + // Dplus with ML selections + void processDplusWithMl(CollsWithCentMult const& colls, + CandDplusDataWMl const& candsDplus, + TracksData const& tracks) + { + for (const auto& coll : colls) { + auto thisCollId = coll.globalIndex(); + auto candsCThisColl = candsDplus.sliceBy(candsDplusPerCollWMl, thisCollId); + if (forceCharmInCollision && candsCThisColl.size() < 1) { + continue; + } + if (!checkAndFillCollision(coll)) { + continue; + } + auto trackIdsThisColl = tracks.sliceBy(trackIndicesPerColl, thisCollId); + fillCharmHadronTables(candsCThisColl); + fillTracksTables(trackIdsThisColl); + } + } + PROCESS_SWITCH(HfCorrelatorFlowCharmHadrons, processDplusWithMl, "Process Dplus candidates with ML info", false); + + // Ds with ML selections + void processDsWithMl(CollsWithCentMult const& colls, + TracksData const& tracks, + CandDsDataWMl const&) + { + for (const auto& coll : colls) { + auto thisCollId = coll.globalIndex(); + auto candsDsToKKPiWMl = selectedDsToKKPiWMl->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); + auto candsDsToPiKKWMl = selectedDsToPiKKWMl->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); + if (forceCharmInCollision && candsDsToKKPiWMl.size() < 1 && candsDsToPiKKWMl.size() < 1) { + continue; + } + if (!checkAndFillCollision(coll)) { + continue; + } + auto trackIdsThisColl = tracks.sliceBy(trackIndicesPerColl, thisCollId); + fillCharmHadronTables(candsDsToPiKKWMl); + fillCharmHadronTables(candsDsToKKPiWMl); + fillTracksTables(trackIdsThisColl); + } + } + PROCESS_SWITCH(HfCorrelatorFlowCharmHadrons, processDsWithMl, "Process Ds candidates with ML info", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From 2e2ed3a642d404679e3f0209a23316106dce9b5d Mon Sep 17 00:00:00 2001 From: Noor Koster <82090643+cnkoster@users.noreply.github.com> Date: Fri, 29 Aug 2025 01:17:29 +0200 Subject: [PATCH 231/986] [PWGCF] Add QA plots to separate dir in AnalysisResults (#12774) Co-authored-by: ALICE Action Bot --- PWGCF/Flow/Tasks/flowSP.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGCF/Flow/Tasks/flowSP.cxx b/PWGCF/Flow/Tasks/flowSP.cxx index 9c29f63c75d..8727a7f9e8f 100644 --- a/PWGCF/Flow/Tasks/flowSP.cxx +++ b/PWGCF/Flow/Tasks/flowSP.cxx @@ -177,7 +177,7 @@ struct FlowSP { OutputObj fWeightsNEG{GFWWeights("weights_negative")}; HistogramRegistry registry{"registry"}; - HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::QAObject}; + HistogramRegistry histos{"QAhistos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; // Event selection cuts TF1* fPhiCutLow = nullptr; From 9b481bd6369f1f779efba1fe6ced8e568a5dfcd6 Mon Sep 17 00:00:00 2001 From: Chiara De Martin <39315597+ChiaraDeMartin95@users.noreply.github.com> Date: Fri, 29 Aug 2025 03:26:53 +0200 Subject: [PATCH 232/986] [PWGLF] add histos for shift correction (#12775) Co-authored-by: Chiara De Martin Co-authored-by: ALICE Action Bot --- .../TableProducer/Strangeness/cascadeflow.cxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx index dc38426e90e..9974831a520 100644 --- a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx @@ -174,6 +174,7 @@ struct cascadeFlow { Configurable cfgShiftCorr{"cfgShiftCorr", 0, ""}; Configurable cfgShiftPath{"cfgShiftPath", "Users/j/junlee/Qvector/QvecCalib/Shift", "Path for Shift"}; Configurable cfgnMods{"cfgnMods", 1, "The number of modulations of interest starting from 2"}; + // Configurable cfgHarmonic{"cfgHarmonic", 2, "Harmonic for event plane calculation"}; // THN axes ConfigurableAxis thnConfigAxisFT0C{"thnConfigAxisFT0C", {8, 0, 80}, "FT0C centrality (%)"}; @@ -703,6 +704,8 @@ struct cascadeFlow { float maxMass[2]{1.36, 1.73}; float minMassLambda[2]{1.09, 1.09}; float maxMassLambda[2]{1.14, 1.14}; + const AxisSpec shiftAxis = {10, 0, 10, "shift"}; + const AxisSpec basisAxis = {2, 0, 2, "basis"}; const AxisSpec massCascAxis[2]{{static_cast((maxMass[0] - minMass[0]) / 0.001f), minMass[0], maxMass[0], "#Xi candidate mass (GeV/c^{2})"}, {static_cast((maxMass[1] - minMass[1]) / 0.001f), minMass[1], maxMass[1], "#Omega candidate mass (GeV/c^{2})"}}; const AxisSpec massLambdaAxis[2]{{static_cast((maxMassLambda[0] - minMassLambda[0]) / 0.001f), minMassLambda[0], maxMassLambda[0], "#Lambda candidate mass (GeV/c^{2})"}, @@ -726,6 +729,10 @@ struct cascadeFlow { resolution.add("QVectorsT0CTPCC_Shifted", "QVectorsT0CTPCC_Shifted", HistType::kTH2F, {axisQVs, CentAxis}); resolution.add("QVectorsTPCAC_Shifted", "QVectorsTPCAC_Shifted", HistType::kTH2F, {axisQVs, CentAxis}); + histos.add("ShiftFT0C", "ShiftFT0C", kTProfile3D, {CentAxis, basisAxis, shiftAxis}); + histos.add("ShiftTPCL", "ShiftTPCL", kTProfile3D, {CentAxis, basisAxis, shiftAxis}); + histos.add("ShiftTPCR", "ShiftTPCR", kTProfile3D, {CentAxis, basisAxis, shiftAxis}); + histos.add("hNEvents", "hNEvents", {HistType::kTH1F, {{10, 0.f, 10.f}}}); for (Int_t n = 1; n <= histos.get(HIST("hNEvents"))->GetNbinsX(); n++) { histos.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(n, hNEventsLabels[n - 1]); @@ -1041,6 +1048,17 @@ struct cascadeFlow { const float psiTPCC = std::atan2(coll.qvecBNegIm(), coll.qvecBNegRe()) * 0.5f; float psiT0CCorr = psiT0C; + for (int ishift = 1; ishift <= 10; ishift++) { + histos.fill(HIST("ShiftFT0C"), coll.centFT0C(), 0.5, ishift - 0.5, std::sin(ishift * 2 * psiT0C)); + histos.fill(HIST("ShiftFT0C"), coll.centFT0C(), 1.5, ishift - 0.5, std::cos(ishift * 2 * psiT0C)); + + histos.fill(HIST("ShiftTPCL"), coll.centFT0C(), 0.5, ishift - 0.5, std::sin(ishift * 2 * psiTPCA)); + histos.fill(HIST("ShiftTPCL"), coll.centFT0C(), 1.5, ishift - 0.5, std::cos(ishift * 2 * psiTPCA)); + + histos.fill(HIST("ShiftTPCR"), coll.centFT0C(), 0.5, ishift - 0.5, std::sin(ishift * 2 * psiTPCC)); + histos.fill(HIST("ShiftTPCR"), coll.centFT0C(), 1.5, ishift - 0.5, std::cos(ishift * 2 * psiTPCC)); + } + if (cfgShiftCorr) { currentRunNumber = coll.runNumber(); if (currentRunNumber != lastRunNumber) { From bc86eab4ba8b85fad287b0c106cd54502838f353 Mon Sep 17 00:00:00 2001 From: Junlee Kim Date: Fri, 29 Aug 2025 16:01:09 +0900 Subject: [PATCH 233/986] [PWGLF] updating the mixing for V0s (#12766) Co-authored-by: ALICE Action Bot --- .../Strangeness/lambdaTwoPartPolarization.cxx | 48 +++++++++++-------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx b/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx index af0c57fbeea..a4b321f8d82 100644 --- a/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx @@ -404,58 +404,68 @@ struct lambdaTwoPartPolarization { FillHistograms(collision, collision, V0s, V0s); } - PROCESS_SWITCH(lambdaTwoPartPolarization, processDataSame, "Process Event for same data", true); + PROCESS_SWITCH(lambdaTwoPartPolarization, processDataSame, "Process event for same data", true); SliceCache cache; - using BinningTypeVertexContributorFT0M = ColumnBinningPolicy; - using BinningTypeVertexContributorFT0C = ColumnBinningPolicy; + Preslice tracksPerCollisionV0 = aod::v0data::collisionId; + + using BinningTypeT0C = ColumnBinningPolicy; + BinningTypeT0C colBinningT0C{{vertexAxis, centAxis}, true}; + void processDataMixedT0C(EventCandidates const& collisions, TrackCandidates const& /*tracks*/, aod::V0Datas const& V0s, aod::BCsWithTimestamps const&) { - auto tracksTuple = std::make_tuple(V0s); - BinningTypeVertexContributorFT0C binningOnPositions{{vertexAxis, centAxis}, true}; - SameKindPair pair{binningOnPositions, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; - for (auto& [c1, tracks1, c2, tracks2] : pair) { + for (auto& [c1, c2] : selfCombinations(colBinningT0C, cfgNoMixedEvents, -1, collisions, collisions)) { + + if (c1.index() == c2.index()) + continue; + centrality = c1.centFT0C(); - auto bc = c1.bc_as(); if (cfgAccCor) { + auto bc = c1.bc_as(); AccMap = ccdb->getForTimeStamp(cfgAccCorPath.value, bc.timestamp()); } if (!eventSelected(c1)) continue; if (!eventSelected(c2)) continue; - if (c1.bcId() == c2.bcId()) - continue; + + auto tracks1 = V0s.sliceBy(tracksPerCollisionV0, c1.globalIndex()); + auto tracks2 = V0s.sliceBy(tracksPerCollisionV0, c2.globalIndex()); FillHistograms(c1, c2, tracks1, tracks2); } } - PROCESS_SWITCH(lambdaTwoPartPolarization, processDataMixedT0C, "Process Event for mixed data in PbPb", false); + PROCESS_SWITCH(lambdaTwoPartPolarization, processDataMixedT0C, "Process event for mixed data in PbPb", false); + + using BinningTypeT0M = ColumnBinningPolicy; + BinningTypeT0M colBinningT0M{{vertexAxis, centAxis}, true}; void processDataMixedT0M(EventCandidates const& collisions, TrackCandidates const& /*tracks*/, aod::V0Datas const& V0s, aod::BCsWithTimestamps const&) { - auto tracksTuple = std::make_tuple(V0s); - BinningTypeVertexContributorFT0M binningOnPositions{{vertexAxis, centAxis}, true}; - SameKindPair pair{binningOnPositions, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; - for (auto& [c1, tracks1, c2, tracks2] : pair) { + for (auto& [c1, c2] : selfCombinations(colBinningT0M, cfgNoMixedEvents, -1, collisions, collisions)) { + + if (c1.index() == c2.index()) + continue; + centrality = c1.centFT0M(); - auto bc = c1.bc_as(); if (cfgAccCor) { + auto bc = c1.bc_as(); AccMap = ccdb->getForTimeStamp(cfgAccCorPath.value, bc.timestamp()); } if (!eventSelected(c1)) continue; if (!eventSelected(c2)) continue; - if (c1.bcId() == c2.bcId()) - continue; + + auto tracks1 = V0s.sliceBy(tracksPerCollisionV0, c1.globalIndex()); + auto tracks2 = V0s.sliceBy(tracksPerCollisionV0, c2.globalIndex()); FillHistograms(c1, c2, tracks1, tracks2); } } - PROCESS_SWITCH(lambdaTwoPartPolarization, processDataMixedT0M, "Process Event for mixed data in pp", false); + PROCESS_SWITCH(lambdaTwoPartPolarization, processDataMixedT0M, "Process event for mixed data in pp", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 3f8baf672ed97cd0490c7e95c01836ea63628b63 Mon Sep 17 00:00:00 2001 From: omvazque Date: Fri, 29 Aug 2025 03:31:04 -0500 Subject: [PATCH 234/986] [PWGLF] Added centrality-dependent histograms (#12779) --- PWGLF/Tasks/Nuspex/piKpRAA.cxx | 393 +++++++++++++++++++-------------- 1 file changed, 232 insertions(+), 161 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/piKpRAA.cxx b/PWGLF/Tasks/Nuspex/piKpRAA.cxx index 2006c19f7fe..7506677e038 100644 --- a/PWGLF/Tasks/Nuspex/piKpRAA.cxx +++ b/PWGLF/Tasks/Nuspex/piKpRAA.cxx @@ -71,29 +71,34 @@ using BCsRun3 = soa::Join; -static constexpr int kNEtaHists{9}; +static constexpr int kNEtaHists{4}; -std::array, kNEtaHists> dEdxPiV0{}; -std::array, kNEtaHists> dEdxPrV0{}; -std::array, kNEtaHists> dEdxElV0{}; -std::array, kNEtaHists> dEdxPiTOF{}; -std::array, kNEtaHists> dEdxElTOF{}; +std::array, kNEtaHists> dEdxPiV0{}; +std::array, kNEtaHists> dEdxPrV0{}; +std::array, kNEtaHists> dEdxElV0{}; +std::array, kNEtaHists> dEdxPiTOF{}; struct PiKpRAA { static constexpr float kZero{0.0f}; static constexpr float kOne{1.0f}; static constexpr float kTenToMinusNine{1e-9}; + static constexpr float kMinPtNchSel{0.1f}; + static constexpr float kMaxPtNchSel{3.0f}; static constexpr float kMinCharge{3.f}; + static constexpr float kMinPElMIP{0.3f}; + static constexpr float kMaxPElMIP{0.4f}; static constexpr float kMinPMIP{0.4f}; static constexpr float kMaxPMIP{0.6f}; static constexpr float kMindEdxMIP{40.0f}; static constexpr float kMaxdEdxMIP{60.0f}; - static constexpr float kMindEdxMIPPlateau{65.0f}; - static constexpr float kMaxdEdxMIPPlateau{95.0f}; + static constexpr float kMindEdxMIPPlateau{70.0f}; + static constexpr float kMaxdEdxMIPPlateau{90.0f}; - static constexpr float kLowEta[kNEtaHists] = {-0.8, -0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6}; - static constexpr float kHighEta[kNEtaHists] = {0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6, 0.8}; + // static constexpr float kLowEta[kNEtaHists] = {-0.8, -0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6}; + // static constexpr float kHighEta[kNEtaHists] = {0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6, 0.8}; + static constexpr float kLowEta[kNEtaHists] = {0.0, 0.2, 0.4, 0.6}; + static constexpr float kHighEta[kNEtaHists] = {0.2, 0.4, 0.6, 0.8}; static constexpr float DefaultLifetimeCuts[1][2] = {{30., 20.}}; Configurable> lifetimecut{"lifetimecut", {DefaultLifetimeCuts[0], 2, {"lifetimecutLambda", "lifetimecutK0S"}}, "lifetimecut"}; @@ -107,6 +112,7 @@ struct PiKpRAA { Configurable maxEtaDaughter{"maxEtaDaughter", +0.8, "Daughter maximum-eta selection"}; Configurable minPt{"minPt", 0.15, "minimum pt of the tracks"}; Configurable maxPt{"maxPt", 20.0, "maximum pt of the tracks"}; + Configurable minNclFound{"minNclFound", 135, "minimum found Ncl in TPC"}; // Standard 5 topological criteria Configurable v0cospa{"v0cospa", 0.995, "min V0 CosPA"}; @@ -119,10 +125,11 @@ struct PiKpRAA { // Additional selection on the AP plot (exclusive for K0Short) // original equation: lArmPt*5>TMath::Abs(lArmAlpha) Configurable armPodCut{"armPodCut", 5.0f, "pT * (cut) > |alpha|, AP cut. Negative: no cut"}; + Configurable armAlphaSel{"armAlphaSel", 0.45f, "Armenteros alpha selection (Gammas)"}; + Configurable qTSel{"qTSel", 0.1f, "Armenteros qT select (Gammas)"}; // Selection Configurable applyInvMassSel{"applyInvMassSel", false, "Select V0s close to the Inv. mass value"}; - Configurable applyqTSel{"applyqTSel", true, "Select Gammas based on Armenters distribution"}; Configurable dMassSel{"dMassSel", 0.01f, "Invariant mass selection"}; Configurable dMassSelG{"dMassSelG", 0.1f, "Inv mass selection gammas"}; @@ -133,9 +140,10 @@ struct PiKpRAA { Configurable applyTPCTOFCombinedCut{"applyTPCTOFCombinedCut", false, " Apply geometrical cut ? "}; // Phi cut - Configurable applyPhiCut{"applyPhiCut", true, "Apply geometrical cut?"}; + Configurable applyPhiCut{"applyPhiCut", false, "Apply geometrical cut?"}; Configurable applyEtaCal{"applyEtaCal", false, "Apply eta calibration?"}; Configurable usePinPhiSelection{"usePinPhiSelection", true, "Uses Phi selection as a function of P or Pt?"}; + Configurable applyNclSel{"applyNclSel", false, "Apply Min. found Ncl in TPC?"}; } v0Selections; // Configurables Event Selection @@ -147,7 +155,7 @@ struct PiKpRAA { Configurable isNoCollInTimeRangeNarrow{"isNoCollInTimeRangeNarrow", false, "use isNoCollInTimeRangeNarrow?"}; Configurable isOccupancyCut{"isOccupancyCut", true, "Occupancy cut?"}; Configurable isApplyFT0CbasedOccupancy{"isApplyFT0CbasedOccupancy", false, "T0C Occu cut"}; - Configurable useMidRapNchSel{"useMidRapNchSel", true, "Use mid-rapidit Nch selection"}; + Configurable applyNchSel{"applyNchSel", false, "Use mid-rapidity-based Nch selection"}; Configurable skipRecoColGTOne{"skipRecoColGTOne", true, "Remove collisions if reconstructed more than once"}; Configurable detector4Calibration{"detector4Calibration", "T0M", "Detector for nSigma-Nch rejection"}; @@ -157,11 +165,13 @@ struct PiKpRAA { Configurable maxT0CcentCut{"maxT0CcentCut", 100.0, "Max T0C Cent. cut"}; Configurable minOccCut{"minOccCut", 0., "min Occu cut"}; Configurable maxOccCut{"maxOccCut", 500., "max Occu cut"}; + Configurable nSigmaNchCut{"nSigmaNchCut", 3., "nSigma Nch selection"}; ConfigurableAxis binsPtPhiCut{"binsPtPhiCut", {VARIABLE_WIDTH, 0.0, 0.6, 0.8, 1.0, 1.4, 1.8, 2.2, 2.6, 3.0, 3.5, 4.0, 5.0, 7.0, 10.0, 15.0, 20.0, 25.0, 30.0, 40.0, 45.0, 50.0}, "pT"}; - ConfigurableAxis binsPtV0s{"binsPtV0s", {VARIABLE_WIDTH, 0.0, 0.15, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.5, 3.0, 3.5, 4.0, 5.0, 7.0, 9.0, 12.0, 15.0, 20.0, 25.0, 30.0, 35.0, 40.0, 45.0, 50.0}, "pT"}; + ConfigurableAxis binsPtV0s{"binsPtV0s", {VARIABLE_WIDTH, 0, 0.15, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.2, 1.4, 1.6, 1.8, 2, 2.5, 3.0, 3.5, 4, 5, 7, 9, 12, 15, 20}, "pT"}; + ConfigurableAxis binsPtNcl{"binsPtNcl", {VARIABLE_WIDTH, 0.0, 0.15, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.5, 3.0, 3.5, 4.0, 5.0, 7.0, 9.0, 12.0, 15.0, 20.0, 25.0, 30.0, 35.0, 40.0, 45.0, 50.0}, "pT"}; ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.12}, "pT binning"}; - ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0., 10., 20., 30., 40., 50., 60., 70., 80., 90., 100.}, "T0C binning"}; + ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0., 5., 10., 20., 30., 40., 50., 60., 70., 80., 90., 100.}, "T0C binning"}; ConfigurableAxis axisArmAlpha{"axisArmAlpha", {200, -1.0, 1.0}, "Armenteros alpha"}; ConfigurableAxis axisArmqT{"axisArmqT", {200, 0.0f, 0.3f}, "Armenteros qT"}; ConfigurableAxis axisK0Mass{"axisK0Mass", {200, 0.4f, 0.6f}, "Mass K0Short"}; @@ -169,8 +179,16 @@ struct PiKpRAA { ConfigurableAxis axisGammaMass{"axisGammaMass", {200, 0.0f, 0.5f}, "Mass Gamma"}; ConfigurableAxis axisNsigmaTPC{"axisNsigmaTPC", {200, -10.0f, 10.0f}, "N sigma TPC"}; ConfigurableAxis axisdEdx{"axisdEdx", {140, 20.0, 160.0}, "dEdx binning"}; + Configurable nBinsNch{"nBinsNch", 400, "N bins Nch (|eta|<0.8)"}; + Configurable nBinsNPV{"nBinsNPV", 600, "N bins ITS tracks"}; + Configurable minNch{"minNch", 0, "Min Nch (|eta|<0.8)"}; + Configurable maxNch{"maxNch", 400, "Max Nch (|eta|<0.8)"}; + Configurable minNpv{"minNpv", 0, "Min NPV"}; + Configurable maxNpv{"maxNpv", 600, "Max NPV"}; // CCDB paths + Configurable pathMeanNch{"pathMeanNch", "Users/o/omvazque/MeanNch/OO/Pass2/PerTimeStamp/Aug20", "base path to the ccdb object"}; + Configurable pathSigmaNch{"pathSigmaNch", "Users/o/omvazque/SigmaNch/OO/Pass2/PerTimeStamp/Aug20", "base path to the ccdb object"}; Configurable pathEtaCal{"pathEtaCal", "Users/o/omvazque/EtaCal/OO/Global", "base path to the ccdb object"}; Configurable pathPhiCutHigh{"pathPhiCutHigh", "Users/o/omvazque/PhiCut/OO/Global/High", "base path to the ccdb object"}; Configurable pathPhiCutLow{"pathPhiCutLow", "Users/o/omvazque/PhiCut/OO/Global/Low", "base path to the ccdb object"}; @@ -190,15 +208,18 @@ struct PiKpRAA { OccuCut, Centrality, VtxZ, - Zdc, - TZero, - Tdc, - Zem + NchSel }; HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; Service ccdb; + struct ConfigNch { + TH1F* hMeanNch = nullptr; + TH1F* hSigmaNch = nullptr; + bool calibrationsLoaded = false; + } cfgNch; + struct ConfigPhiCut { TH1F* hPhiCutHigh = nullptr; TH1F* hPhiCutLow = nullptr; @@ -228,15 +249,17 @@ struct PiKpRAA { trkSelGlobal = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSibAny, TrackSelection::GlobalTrackRun3DCAxyCut::Default); // define axes you want to use + const std::string titlePorPt{v0Selections.usePinPhiSelection ? "#it{p} (GeV/#it{c})" : "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec axisZpos{48, -12., 12., "Vtx_{z} (cm)"}; - const AxisSpec axisEvent{14, 0.5, 14.5, ""}; + const AxisSpec axisEvent{15, 0.5, 15.5, ""}; const AxisSpec axisEta{100, -1., +1., "#eta"}; const AxisSpec axisPt{binsPt, "#it{p}_{T} (GeV/#it{c})"}; - const AxisSpec axisPtPhiCut{binsPtPhiCut, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec axisPtV0s{binsPtV0s, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec axisXNcl{binsPtNcl, Form("%s", titlePorPt.data())}; + const AxisSpec axisXPhiCut{binsPtPhiCut, Form("%s", titlePorPt.data())}; const AxisSpec axisCent{binsCent, "T0C centrality"}; - const char* endingEta[kNEtaHists] = {"88", "86", "64", "42", "20", "02", "24", "46", "68"}; - const char* latexEta[kNEtaHists] = {"|#eta|<0.8", "-0.8<#eta<-0.6", "-0.6<#eta<-0.4", "-0.4<#eta<-0.2", "-0.2<#eta<0", "0<#eta<0.2", "0.2<#eta<0.4", "0.4<#eta<0.6", "0.6<#eta<0.8"}; + const char* endingEta[kNEtaHists] = {"02", "24", "46", "68"}; + const char* latexEta[kNEtaHists] = {"0<|#eta|<0.2", "0.2<#eta<0.4", "0.4<#eta<0.6", "0.6<#eta<0.8"}; registry.add("EventCounter", ";;Events", kTH1F, {axisEvent}); @@ -254,11 +277,15 @@ struct PiKpRAA { x->SetBinLabel(10, "NoCollInTimeRangeNarrow"); x->SetBinLabel(11, "Occupancy Cut"); x->SetBinLabel(12, "Cent. Sel."); - x->SetBinLabel(13, "VtxZ cut"); + x->SetBinLabel(13, "VtxZ Sel."); + x->SetBinLabel(14, "Nch Sel."); if (doprocessCalibrationAndV0s) { registry.add("zPos", ";;Entries;", kTH1F, {axisZpos}); registry.add("T0Ccent", ";;Entries", kTH1F, {axisCent}); + registry.add("NchVsNPV", ";Nch; NPV;", kTH2F, {{{nBinsNPV, minNpv, maxNpv}, {nBinsNch, minNch, maxNch}}}); + registry.add("ExcludedEvtVsNch", ";Nch;Entries;", kTH1F, {{nBinsNch, minNch, maxNch}}); + registry.add("ExcludedEvtVsNPV", ";NPV;Entries;", kTH1F, {{nBinsNPV, minNpv, maxNpv}}); registry.add("dcaDauVsPt", ";V0 #it{p}_{T} (GeV/#it{c});DCA_{xy} (cm) daughters;", kTH2F, {{{axisPtV0s}, {200, -10., 10.}}}); registry.add("nSigPiFromK0s", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); @@ -279,30 +306,28 @@ struct PiKpRAA { registry.add("MassALVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {axisPtV0s, axisLambdaMass}); registry.add("MassGVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {axisPtV0s, axisGammaMass}); - registry.add("NclFindableVsPt", ";#it{p}_{T} (GeV/#it{c}); Ncl TPC", kTH2F, {{{axisPtV0s}, {160, 0, 160}}}); - registry.add("NclFindableVsPtp", ";#it{p}_{T} (GeV/#it{c}); #LTNcl#GT TPC", kTProfile, {axisPtV0s}); - registry.add("NclFoundVsPt", ";#it{p}_{T} (GeV/#it{c}); Ncl TPC", kTH2F, {{{axisPtV0s}, {160, 0, 160}}}); - registry.add("NclFoundVsPtp", ";#it{p}_{T} (GeV/#it{c}); #LTNcl#GT TPC", kTProfile, {axisPtV0s}); - registry.add("NclFoundVsPVsPhipBeforeCut", "", kTProfile2D, {{{axisPtPhiCut}, {350, 0.0, 0.35}}}); - registry.add("NclFoundVsPtVsPhipBeforeCut", "", kTProfile2D, {{{axisPtPhiCut}, {350, 0.0, 0.35}}}); - registry.add("NclFoundVsPVsPhipAfterCut", "", kTProfile2D, {{{axisPtPhiCut}, {350, 0.0, 0.35}}}); - registry.add("NclFoundVsPtVsPhipAfterCut", "", kTProfile2D, {{{axisPtPhiCut}, {350, 0.0, 0.35}}}); - registry.add("NclVsEta", ";#eta; Ncl TPC", kTH2F, {{{axisEta}, {160, 0, 160}}}); - - registry.add("NclVsEtaPiMIP", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c}, 40 < dE/dx < 60);#eta; Found Ncl TPC", kTH2F, {{{axisEta}, {160, 0, 160}}}); + registry.add("NclFindable", ";;Findable Ncl TPC", kTH2F, {{{axisXNcl}, {161, -0.5, 160.5}}}); + registry.add("NclFindablep", ";;Findable #LTNcl#GT TPC", kTProfile, {axisXNcl}); + registry.add("NclFound", ";;Found Ncl TPC", kTH2F, {{{axisXNcl}, {161, -0.5, 160.5}}}); + registry.add("NclFoundp", ";;Found #LTNcl#GT TPC", kTProfile, {axisXNcl}); + registry.add("NclFoundVsPhipBeforeCut", Form("Found #LTNcl#GT TPC;%s (GeV/#it{c});#varphi", titlePorPt.data()), kTProfile2D, {{{axisXPhiCut}, {350, 0.0, 0.35}}}); + registry.add("NclFoundVsPhipAfterCut", Form("Found #LTNcl#GT TPC;%s (GeV/#it{c});#varphi", titlePorPt.data()), kTProfile2D, {{{axisXPhiCut}, {350, 0.0, 0.35}}}); + registry.add("NclVsEta", ";#eta; Ncl TPC", kTH2F, {{{axisEta}, {161, -0.5, 160.5}}}); + + registry.add("NclVsEtaPiMIP", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c}, 40 < dE/dx < 60);#eta; Found Ncl TPC", kTH2F, {{{axisEta}, {161, -0.5, 160.5}}}); registry.add("NclVsEtaPiMIPp", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c}, 40 < dE/dx < 60);#eta; Found #LTNcl#GT TPC", kTProfile, {axisEta}); - registry.add("NclVsEtaPiV0", ";#eta; Found Ncl TPC", kTH2F, {{{axisEta}, {160, 0, 160}}}); + registry.add("NclVsEtaPiV0", ";#eta; Found Ncl TPC", kTH2F, {{{axisEta}, {161, -0.5, 160.5}}}); registry.add("NclVsEtaPiV0p", ";#eta; Found #LTNcl#GT TPC", kTProfile, {axisEta}); - registry.add("NclVsPPiV0", ";Momentum (GeV/#it{c}); Found Ncl TPC", kTH2F, {{{axisPtV0s}, {160, 0, 160}}}); - registry.add("NclVsPPiV0p", ";Momentum (GeV/#it{c}); Found #LTNcl#GT TPC", kTProfile, {axisPtV0s}); - registry.add("NclVsEtaPrV0", ";#eta; Found Ncl TPC", kTH2F, {{{axisEta}, {160, 0, 160}}}); + registry.add("NclPiV0", ";;Found Ncl TPC", kTH2F, {{{axisXNcl}, {161, -0.5, 160.5}}}); + registry.add("NclPiV0p", ";;Found #LTNcl#GT TPC", kTProfile, {axisXNcl}); + registry.add("NclVsEtaPrV0", ";#eta; Found Ncl TPC", kTH2F, {{{axisEta}, {161, -0.5, 160.5}}}); registry.add("NclVsEtaPrV0p", ";#eta; Found #LTNcl#GT TPC", kTProfile, {axisEta}); - registry.add("NclVsPPrV0", ";Momentum (GeV/#it{c}); Found Ncl TPC", kTH2F, {{{axisPtV0s}, {160, 0, 160}}}); - registry.add("NclVsPPrV0p", ";Momentum (GeV/#it{c}); Found #LTNcl#GT TPC", kTProfile, {axisPtV0s}); - registry.add("NclVsEtaElV0", ";#eta; Found Ncl TPC", kTH2F, {{{axisEta}, {160, 0, 160}}}); + registry.add("NclPrV0", ";;Found Ncl TPC", kTH2F, {{{axisXNcl}, {161, -0.5, 160.5}}}); + registry.add("NclPrV0p", ";;Found #LTNcl#GT TPC", kTProfile, {axisXNcl}); + registry.add("NclVsEtaElV0", ";#eta; Found Ncl TPC", kTH2F, {{{axisEta}, {161, -0.5, 160.5}}}); registry.add("NclVsEtaElV0p", ";#eta; Found #LTNcl#GT TPC", kTProfile, {axisEta}); - registry.add("NclVsPElV0", ";Momentum (GeV/#it{c}); Found Ncl TPC", kTH2F, {{{axisPtV0s}, {160, 0, 160}}}); - registry.add("NclVsPElV0p", ";Momentum (GeV/#it{c}); Found #LTNcl#GT TPC", kTProfile, {axisPtV0s}); + registry.add("NclElV0", ";;Found Ncl TPC", kTH2F, {{{axisXNcl}, {161, -0.5, 160.5}}}); + registry.add("NclElV0p", ";;Found #LTNcl#GT TPC", kTProfile, {axisXNcl}); registry.add("TOFExpPi2TOF", ";Momentum (GeV/#it{c});t^{e}_{Exp}/t_{TOF}", kTH2F, {{{axisPtV0s}, {100, 0.2, 1.2}}}); registry.add("TOFExpEl2TOF", ";Momentum (GeV/#it{c});t^{#pi}_{Exp}/t_{TOF}", kTH2F, {{{axisPtV0s}, {100, 0.2, 1.2}}}); @@ -311,29 +336,32 @@ struct PiKpRAA { registry.add("dEdxVsMomentum", ";Momentum (GeV/#it{c}); dE/dx", kTH2F, {axisPtV0s, axisdEdx}); registry.add("dEdxVsEtaPiMIP", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; dE/dx;", kTH2F, {{{axisEta}, {100, 0, 100}}}); registry.add("dEdxVsEtaPiMIPp", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; #LTdE/dx#GT", kTProfile, {axisEta}); - registry.add("dEdxVsEtaElMIP", "MIP e^{+} + e^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; dE/dx;", kTH2F, {{{axisEta}, {100, 0, 100}}}); - registry.add("dEdxVsEtaElMIPp", "MIP e^{+} + e^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; #LTdE/dx#GT", kTProfile, {axisEta}); + registry.add("dEdxVsEtaElMIP", "MIP e^{+} + e^{-} (0.3 < #it{p} < 0.4 GeV/#it{c});#eta; dE/dx;", kTH2F, {{{axisEta}, {100, 0, 100}}}); + registry.add("dEdxVsEtaElMIPp", "MIP e^{+} + e^{-} (0.3 < #it{p} < 0.4 GeV/#it{c});#eta; #LTdE/dx#GT", kTProfile, {axisEta}); registry.add("dEdxVsEtaPiMIPV0", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; dE/dx", kTH2F, {{{axisEta}, {100, 0, 100}}}); registry.add("dEdxVsEtaPiMIPV0p", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; #LTdE/dx#GT", kTProfile, {axisEta}); registry.add("dEdxVsEtaElMIPV0", "e^{+} + e^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; dE/dx", kTH2F, {{{axisEta}, {100, 0, 100}}}); registry.add("dEdxVsEtaElMIPV0p", "e^{+} + e^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; #LTdE/dx#GT", kTProfile, {axisEta}); for (int i = 0; i < kNEtaHists; ++i) { - dEdxPiV0[i] = registry.add(Form("dEdxPiV0_%s", endingEta[i]), Form("#pi^{+} + #pi^{-}, %s;Momentum (GeV/#it{c}); dE/dx", latexEta[i]), kTH2F, {axisPtV0s, axisdEdx}); - dEdxPrV0[i] = registry.add(Form("dEdxPrV0_%s", endingEta[i]), Form("p + #bar{p}, %s;Momentum (GeV/#it{c}); dE/dx", latexEta[i]), kTH2F, {axisPtV0s, axisdEdx}); - dEdxElV0[i] = registry.add(Form("dEdxElV0_%s", endingEta[i]), Form("e^{+} + e^{-}, %s;Momentum (GeV/#it{c}); dE/dx", latexEta[i]), kTH2F, {axisPtV0s, axisdEdx}); - dEdxPiTOF[i] = registry.add(Form("dEdxPiTOF_%s", endingEta[i]), Form("#pi^{+} + #pi^{-}, %s;Momentum (GeV/#it{c}); dE/dx", latexEta[i]), kTH2F, {axisPtV0s, axisdEdx}); - dEdxElTOF[i] = registry.add(Form("dEdxElTOF_%s", endingEta[i]), Form("e^{+} + e^{-}, %s;Momentum (GeV/#it{c}); dE/dx", latexEta[i]), kTH2F, {axisPtV0s, axisdEdx}); + dEdxPiV0[i] = registry.add(Form("dEdxPiV0_%s", endingEta[i]), Form("#pi^{+} + #pi^{-}, %s;Momentum (GeV/#it{c});dE/dx;", latexEta[i]), kTH3F, {axisPtV0s, axisdEdx, axisCent}); + dEdxPrV0[i] = registry.add(Form("dEdxPrV0_%s", endingEta[i]), Form("p + #bar{p}, %s;Momentum (GeV/#it{c});dE/dx;", latexEta[i]), kTH3F, {axisPtV0s, axisdEdx, axisCent}); + dEdxElV0[i] = registry.add(Form("dEdxElV0_%s", endingEta[i]), Form("e^{+} + e^{-}, %s;Momentum (GeV/#it{c});dE/dx;", latexEta[i]), kTH3F, {axisPtV0s, axisdEdx, axisCent}); + dEdxPiTOF[i] = registry.add(Form("dEdxPiTOF_%s", endingEta[i]), Form("#pi^{+} + #pi^{-}, %s;Momentum (GeV/#it{c});dE/dx;", latexEta[i]), kTH3F, {axisPtV0s, axisdEdx, axisCent}); } } LOG(info) << "\tccdbNoLaterThan=" << ccdbNoLaterThan.value; - LOG(info) << "\tuseMidRapNchSel=" << useMidRapNchSel.value; + LOG(info) << "\tapplyNchSel=" << applyNchSel.value; LOG(info) << "\tdetector4Calibration=" << detector4Calibration.value; LOG(info) << "\tminPt=" << v0Selections.minPt; LOG(info) << "\tmaxPt=" << v0Selections.maxPt; LOG(info) << "\tapplyTPCTOFCombinedCut=" << v0Selections.applyTPCTOFCombinedCut; LOG(info) << "\tapplyInvMassSel=" << v0Selections.applyInvMassSel; + LOG(info) << "\tapplyNclSel=" << v0Selections.applyNclSel; + LOG(info) << "\tapplyPhiCut=" << v0Selections.applyPhiCut; + LOG(info) << "\tusePinPhiSelection=" << v0Selections.usePinPhiSelection; + LOG(info) << "\ttitlePorPt=" << titlePorPt; ccdb->setURL("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); @@ -341,11 +369,16 @@ struct PiKpRAA { ccdb->setFatalWhenNull(false); ccdb->setCreatedNotAfter(ccdbNoLaterThan.value); + if (applyNchSel.value) { + LOG(info) << "\tLoading Nch-based selections!"; + LOG(info) << "\t pathMeanNch=" << pathMeanNch.value; + LOG(info) << "\t pathSigmaNch=" << pathSigmaNch.value; + } + if (v0Selections.applyPhiCut) { LOG(info) << "\tLoading Phi cut!"; LOG(info) << "\t pathPhiCutLow=" << pathPhiCutLow.value; LOG(info) << "\t pathPhiCutHigh=" << pathPhiCutHigh.value; - loadPhiCutSelections(); } if (v0Selections.applyEtaCal) { @@ -353,6 +386,9 @@ struct PiKpRAA { LOG(info) << "\t pathEtaCal=" << pathEtaCal.value; loadEtaCalibration(); } + + if (v0Selections.applyNclSel) + LOG(info) << "\t minNclFound=" << v0Selections.minNclFound; } void processCalibrationAndV0s(ColEvSels::iterator const& collision, BCsRun3 const& /**/, aod::V0Datas const& v0s, aod::FV0As const& /**/, aod::FT0s const& /**/, TracksFull const& tracks) @@ -365,20 +401,61 @@ struct PiKpRAA { } const auto& foundBC = collision.foundBC_as(); - uint64_t timeStamp{foundBC.timestamp()}; + const uint64_t timeStamp{foundBC.timestamp()}; const int magField{getMagneticField(timeStamp)}; + const double nPV{collision.multNTracksPVeta1() / 1.}; + + if (applyNchSel) { + loadNchCalibrations(timeStamp); + if (!(cfgNch.hMeanNch && cfgNch.hSigmaNch)) + return; + } + int nch{0}; + for (const auto& track : tracks) { + // Track Selection + if (!trkSelGlobal.IsSelected(track)) { + continue; + } + if (track.pt() < kMinPtNchSel || track.pt() > kMaxPtNchSel) { + continue; + } + nch++; + } + + bool skipEvent{false}; + if (applyNchSel) { + if (!cfgNch.calibrationsLoaded) + return; + + const double xEval{nPV}; + const int bin4Calibration{cfgNch.hMeanNch->FindBin(xEval)}; + const double meanNch{cfgNch.hMeanNch->GetBinContent(bin4Calibration)}; + const double sigmaNch{cfgNch.hSigmaNch->GetBinContent(bin4Calibration)}; + const double nSigmaSelection{nSigmaNchCut * sigmaNch}; + const double diffMeanNch{meanNch - nch}; + + if (std::abs(diffMeanNch) > nSigmaSelection) { + registry.fill(HIST("ExcludedEvtVsNch"), nch); + registry.fill(HIST("ExcludedEvtVsNPV"), nPV); + skipEvent = true; + } + } + + if (applyNchSel && skipEvent) { + return; + } + + if (applyNchSel) + registry.fill(HIST("EventCounter"), EvCutLabel::NchSel); + + registry.fill(HIST("NchVsNPV"), nPV, nch); registry.fill(HIST("zPos"), collision.posZ()); registry.fill(HIST("T0Ccent"), collision.centFT0C()); + const float centrality{collision.centFT0C()}; - // bool hasT0{false}; - // float colTime{0.0}; - // if (foundBC.has_ft0()) { - // if (foundBC.ft0().isValidTimeA() && foundBC.ft0().isValidTimeC()) { - // colTime = foundBC.ft0().collTime(); - // hasT0 = true; - // } - // } + if (v0Selections.applyPhiCut) + loadPhiCutSelections(timeStamp); for (const auto& track : tracks) { @@ -394,15 +471,20 @@ struct PiKpRAA { const float eta{track.eta()}; float dedx{track.tpcSignal()}; const int charge{track.sign()}; + const float pOrPt{v0Selections.usePinPhiSelection ? momentum : pt}; + const int16_t nclFound{track.tpcNClsFound()}; + + if (v0Selections.applyNclSel && nclFound < v0Selections.minNclFound) + continue; float phiPrime{phi}; phiPrimeFunc(phiPrime, magField, charge); - registry.fill(HIST("NclFoundVsPVsPhipBeforeCut"), momentum, phiPrime, track.tpcNClsFound()); - registry.fill(HIST("NclFoundVsPtVsPhipBeforeCut"), pt, phiPrime, track.tpcNClsFound()); + registry.fill(HIST("NclFoundVsPhipBeforeCut"), pOrPt, phiPrime, track.tpcNClsFound()); - float pOrPt{v0Selections.usePinPhiSelection ? momentum : pt}; - if (!passesPhiSelection(pOrPt, phiPrime)) - continue; + if (v0Selections.applyPhiCut) { + if (!passesPhiSelection(pOrPt, phiPrime)) + continue; + } if (v0Selections.applyEtaCal) { const double dedxCal{etaCal.pEtaCal->GetBinContent(etaCal.pEtaCal->FindBin(eta))}; @@ -419,18 +501,22 @@ struct PiKpRAA { registry.fill(HIST("NclVsEtaPiMIPp"), eta, track.tpcNClsFound()); } - registry.fill(HIST("NclFindableVsPt"), pt, track.tpcNClsFindable()); - registry.fill(HIST("NclFindableVsPtp"), pt, track.tpcNClsFindable()); - registry.fill(HIST("NclFoundVsPt"), pt, track.tpcNClsFound()); - registry.fill(HIST("NclFoundVsPtp"), pt, track.tpcNClsFound()); - registry.fill(HIST("NclVsEta"), eta, track.tpcNClsFound()); - registry.fill(HIST("NclFoundVsPVsPhipAfterCut"), momentum, phiPrime, track.tpcNClsFound()); - registry.fill(HIST("NclFoundVsPtVsPhipAfterCut"), pt, phiPrime, track.tpcNClsFound()); + if (momentum > kMinPElMIP && momentum < kMaxPElMIP && dedx > kMindEdxMIPPlateau && dedx < kMaxdEdxMIPPlateau) { + registry.fill(HIST("dEdxVsEtaElMIP"), eta, dedx); + registry.fill(HIST("dEdxVsEtaElMIPp"), eta, dedx); + } + registry.fill(HIST("dEdxVsMomentum"), momentum, dedx); + registry.fill(HIST("NclVsEta"), eta, track.tpcNClsFound()); + registry.fill(HIST("NclFound"), pOrPt, track.tpcNClsFound()); + registry.fill(HIST("NclFoundp"), pOrPt, track.tpcNClsFound()); + registry.fill(HIST("NclFindable"), pOrPt, track.tpcNClsFindable()); + registry.fill(HIST("NclFindablep"), pOrPt, track.tpcNClsFindable()); + registry.fill(HIST("NclFoundVsPhipAfterCut"), pOrPt, phiPrime, track.tpcNClsFound()); int indexEta{0}; for (int i = 1; i < kNEtaHists; ++i) { - if (eta >= kLowEta[i] && eta < kHighEta[i]) { + if (std::abs(eta) >= kLowEta[i] && std::abs(eta) < kHighEta[i]) { indexEta = i; break; } @@ -448,19 +534,9 @@ struct PiKpRAA { registry.fill(HIST("betaVsMomentum"), momentum, track.beta()); registry.fill(HIST("TOFExpPi2TOF"), momentum, tExpPiTOF / tTOF); registry.fill(HIST("TOFExpEl2TOF"), momentum, tExpElTOF / tTOF); - if (std::abs((tExpElTOF / tTOF) - kOne) < v0Selections.maxElTOFBeta) { - dEdxElTOF[0]->Fill(momentum, dedx); - dEdxElTOF[indexEta]->Fill(momentum, dedx); - } - - if (momentum > kMinPMIP && momentum < kMaxPMIP && dedx > kMindEdxMIPPlateau && dedx < kMaxdEdxMIPPlateau && std::abs((tExpElTOF / tTOF) - kOne) < v0Selections.maxElTOFBeta) { - registry.fill(HIST("dEdxVsEtaElMIP"), eta, dedx); - registry.fill(HIST("dEdxVsEtaElMIPp"), eta, dedx); - } if (std::abs((tExpPiTOF / tTOF) - kOne) < v0Selections.maxPiTOFBeta) { - dEdxPiTOF[0]->Fill(momentum, dedx); - dEdxPiTOF[indexEta]->Fill(momentum, dedx); + dEdxPiTOF[indexEta]->Fill(momentum, dedx, centrality); } } } @@ -487,24 +563,30 @@ struct PiKpRAA { float negTrkdEdx{negTrack.tpcSignal()}; float posTrackPhiPrime{posTrack.phi()}; float negTrackPhiPrime{negTrack.phi()}; + const int16_t posNclFound{posTrack.tpcNClsFound()}; + const int16_t negNclFound{negTrack.tpcNClsFound()}; phiPrimeFunc(posTrackPhiPrime, magField, posTrackCharge); phiPrimeFunc(negTrackPhiPrime, magField, negTrackCharge); + const float posPorPt{v0Selections.usePinPhiSelection ? posTrkP : posTrkPt}; + const float negPorPt{v0Selections.usePinPhiSelection ? negTrkP : negTrkPt}; // Skip v0s with like-sig daughters if (posTrack.sign() == negTrack.sign()) continue; - float pOrPtPos{v0Selections.usePinPhiSelection ? posTrkP : posTrkPt}; - float pOrPtNeg{v0Selections.usePinPhiSelection ? negTrkP : negTrkPt}; - // Passes Geometrical (Phi) cut? - if (!(passesPhiSelection(pOrPtPos, posTrackPhiPrime) && passesPhiSelection(pOrPtNeg, negTrackPhiPrime))) - continue; + if (v0Selections.applyPhiCut) { + if (!(passesPhiSelection(posPorPt, posTrackPhiPrime) && passesPhiSelection(negPorPt, negTrackPhiPrime))) + continue; + } // Passes daughters track-selection? if (!(passesTrackSelectionDaughters(posTrack) && passesTrackSelectionDaughters(negTrack))) continue; + if (v0Selections.applyNclSel && (posNclFound < v0Selections.minNclFound || negNclFound < v0Selections.minNclFound)) + continue; + if (v0Selections.applyEtaCal) { const double dedxCal{etaCal.pEtaCal->GetBinContent(etaCal.pEtaCal->FindBin(posTrkEta))}; if (dedxCal > kMindEdxMIP && dedxCal < kMaxdEdxMIP) @@ -532,13 +614,6 @@ struct PiKpRAA { if (!passesV0TopologicalSelection(v0)) continue; - // const float px[2] = {posTrack.px(), negTrack.px()}; - // const float py[2] = {posTrack.py(), negTrack.py()}; - // const float pz[2] = {posTrack.pz(), negTrack.pz()}; - // const double ePos{static_cast(posTrack.energy(o2::constants::physics::MassPositron))}; - // const double eEle{static_cast(negTrack.energy(o2::constants::physics::MassElectron))}; - // const double massG = std::sqrt(std::pow(ePos + eEle, 2.0) - (std::pow(px[0] + px[1], 2.0) + std::pow(py[0] + py[1], 2.0) + std::pow(pz[0] + pz[1], 2.0))); - const double dMassK0s{std::abs(v0.mK0Short() - o2::constants::physics::MassK0Short)}; const double dMassL{std::abs(v0.mLambda() - o2::constants::physics::MassLambda0)}; const double dMassAL{std::abs(v0.mAntiLambda() - o2::constants::physics::MassLambda0)}; @@ -551,14 +626,14 @@ struct PiKpRAA { int posIndexEta{0}; int negIndexEta{0}; for (int i = 1; i < kNEtaHists; ++i) { - if (posTrkEta >= kLowEta[i] && posTrkEta < kHighEta[i]) { + if (std::abs(posTrkEta) >= kLowEta[i] && std::abs(posTrkEta) < kHighEta[i]) { posIndexEta = i; break; } } for (int i = 1; i < kNEtaHists; ++i) { - if (negTrkEta >= kLowEta[i] && negTrkEta < kHighEta[i]) { + if (std::abs(negTrkEta) >= kLowEta[i] && std::abs(negTrkEta) < kHighEta[i]) { negIndexEta = i; break; } @@ -573,21 +648,17 @@ struct PiKpRAA { registry.fill(HIST("MassK0sVsPt"), v0.pt(), v0.mK0Short()); registry.fill(HIST("nSigPiFromK0s"), posTrkPt, posTrack.tpcNSigmaPi()); registry.fill(HIST("nSigPiFromK0s"), negTrkPt, negTrack.tpcNSigmaPi()); - registry.fill(HIST("NclVsEtaPiV0"), posTrkEta, posTrack.tpcNClsFound()); registry.fill(HIST("NclVsEtaPiV0p"), posTrkEta, posTrack.tpcNClsFound()); registry.fill(HIST("NclVsEtaPiV0"), negTrkEta, negTrack.tpcNClsFound()); registry.fill(HIST("NclVsEtaPiV0p"), negTrkEta, negTrack.tpcNClsFound()); + registry.fill(HIST("NclPiV0"), posPorPt, posTrack.tpcNClsFound()); + registry.fill(HIST("NclPiV0p"), posPorPt, posTrack.tpcNClsFound()); + registry.fill(HIST("NclPiV0"), negPorPt, negTrack.tpcNClsFound()); + registry.fill(HIST("NclPiV0p"), negPorPt, negTrack.tpcNClsFound()); - registry.fill(HIST("NclVsPPiV0"), posTrkP, posTrack.tpcNClsFound()); - registry.fill(HIST("NclVsPPiV0p"), posTrkP, posTrack.tpcNClsFound()); - registry.fill(HIST("NclVsPPiV0"), negTrkP, negTrack.tpcNClsFound()); - registry.fill(HIST("NclVsPPiV0p"), negTrkP, negTrack.tpcNClsFound()); - - dEdxPiV0[0]->Fill(posTrkP, posTrkdEdx); - dEdxPiV0[0]->Fill(negTrkP, negTrkdEdx); - dEdxPiV0[posIndexEta]->Fill(posTrkP, posTrkdEdx); - dEdxPiV0[negIndexEta]->Fill(negTrkP, negTrkdEdx); + dEdxPiV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); + dEdxPiV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); if (posTrkP > kMinPMIP && posTrkP < kMaxPMIP && posTrkdEdx > kMindEdxMIP && posTrkdEdx < kMaxdEdxMIP) { registry.fill(HIST("dEdxVsEtaPiMIPV0"), posTrkEta, posTrkdEdx); @@ -609,21 +680,16 @@ struct PiKpRAA { registry.fill(HIST("MassLVsPt"), v0.pt(), v0.mLambda()); registry.fill(HIST("nSigPrFromL"), posTrkPt, posTrack.tpcNSigmaPr()); registry.fill(HIST("nSigPiFromL"), negTrkPt, negTrack.tpcNSigmaPi()); - registry.fill(HIST("NclVsEtaPrV0"), posTrkEta, posTrack.tpcNClsFound()); registry.fill(HIST("NclVsEtaPrV0p"), posTrkEta, posTrack.tpcNClsFound()); registry.fill(HIST("NclVsEtaPiV0"), negTrkEta, negTrack.tpcNClsFound()); registry.fill(HIST("NclVsEtaPiV0p"), negTrkEta, negTrack.tpcNClsFound()); - - registry.fill(HIST("NclVsPPrV0"), posTrkP, posTrack.tpcNClsFound()); - registry.fill(HIST("NclVsPPrV0p"), posTrkP, posTrack.tpcNClsFound()); - registry.fill(HIST("NclVsPPiV0"), negTrkP, negTrack.tpcNClsFound()); - registry.fill(HIST("NclVsPPiV0p"), negTrkP, negTrack.tpcNClsFound()); - - dEdxPrV0[0]->Fill(posTrkP, posTrkdEdx); - dEdxPiV0[0]->Fill(negTrkP, negTrkdEdx); - dEdxPrV0[posIndexEta]->Fill(posTrkP, posTrkdEdx); - dEdxPiV0[negIndexEta]->Fill(negTrkP, negTrkdEdx); + registry.fill(HIST("NclPrV0"), posPorPt, posTrack.tpcNClsFound()); + registry.fill(HIST("NclPrV0p"), posPorPt, posTrack.tpcNClsFound()); + registry.fill(HIST("NclPiV0"), negPorPt, negTrack.tpcNClsFound()); + registry.fill(HIST("NclPiV0p"), negPorPt, negTrack.tpcNClsFound()); + dEdxPrV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); + dEdxPiV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); } } } @@ -634,53 +700,40 @@ struct PiKpRAA { registry.fill(HIST("MassALVsPt"), v0.pt(), v0.mAntiLambda()); registry.fill(HIST("nSigPrFromAL"), negTrkPt, negTrack.tpcNSigmaPr()); registry.fill(HIST("nSigPiFromAL"), posTrkPt, posTrack.tpcNSigmaPi()); - registry.fill(HIST("NclVsEtaPiV0"), posTrkEta, posTrack.tpcNClsFound()); registry.fill(HIST("NclVsEtaPiV0p"), posTrkEta, posTrack.tpcNClsFound()); registry.fill(HIST("NclVsEtaPrV0"), negTrkEta, negTrack.tpcNClsFound()); registry.fill(HIST("NclVsEtaPrV0p"), negTrkEta, negTrack.tpcNClsFound()); - - registry.fill(HIST("NclVsPPiV0"), posTrkP, posTrack.tpcNClsFound()); - registry.fill(HIST("NclVsPPiV0p"), posTrkP, posTrack.tpcNClsFound()); - registry.fill(HIST("NclVsPPrV0"), negTrkP, negTrack.tpcNClsFound()); - registry.fill(HIST("NclVsPPrV0p"), negTrkP, negTrack.tpcNClsFound()); - - dEdxPiV0[0]->Fill(posTrkP, posTrkdEdx); - dEdxPrV0[0]->Fill(negTrkP, negTrkdEdx); - dEdxPiV0[posIndexEta]->Fill(posTrkP, posTrkdEdx); - dEdxPrV0[negIndexEta]->Fill(negTrkP, negTrkdEdx); + registry.fill(HIST("NclPiV0"), posPorPt, posTrack.tpcNClsFound()); + registry.fill(HIST("NclPiV0p"), posPorPt, posTrack.tpcNClsFound()); + registry.fill(HIST("NclPrV0"), negPorPt, negTrack.tpcNClsFound()); + registry.fill(HIST("NclPrV0p"), negPorPt, negTrack.tpcNClsFound()); + dEdxPrV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); + dEdxPiV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); } } if (v0Selections.applyInvMassSel && dMassK0s > v0Selections.dMassSel && dMassL > v0Selections.dMassSel && dMassAL > v0Selections.dMassSel && dMassG < v0Selections.dMassSel) { if (passesGammaSelection(collision, v0)) { - registry.fill(HIST("ArmG"), alpha, qT); - registry.fill(HIST("MassGVsPt"), v0.pt(), v0.mGamma()); - registry.fill(HIST("nSigElFromG"), negTrkPt, negTrack.tpcNSigmaEl()); - registry.fill(HIST("nSigElFromG"), posTrkPt, posTrack.tpcNSigmaEl()); - - registry.fill(HIST("NclVsEtaElV0"), posTrkEta, posTrack.tpcNClsFound()); - registry.fill(HIST("NclVsEtaElV0p"), posTrkEta, posTrack.tpcNClsFound()); - registry.fill(HIST("NclVsEtaElV0"), negTrkEta, negTrack.tpcNClsFound()); - registry.fill(HIST("NclVsEtaElV0p"), negTrkEta, negTrack.tpcNClsFound()); - - registry.fill(HIST("NclVsPElV0"), posTrkP, posTrack.tpcNClsFound()); - registry.fill(HIST("NclVsPElV0p"), posTrkP, posTrack.tpcNClsFound()); - registry.fill(HIST("NclVsPElV0"), negTrkP, negTrack.tpcNClsFound()); - registry.fill(HIST("NclVsPElV0p"), negTrkP, negTrack.tpcNClsFound()); - - dEdxElV0[0]->Fill(posTrkP, posTrkdEdx); - dEdxElV0[0]->Fill(negTrkP, negTrkdEdx); - dEdxElV0[posIndexEta]->Fill(posTrkP, posTrkdEdx); - dEdxElV0[negIndexEta]->Fill(negTrkP, negTrkdEdx); - - if (posTrkP > kMinPMIP && posTrkP < kMaxPMIP) { + if (std::abs(alpha) < v0Selections.armAlphaSel && qT < v0Selections.qTSel) { + registry.fill(HIST("ArmG"), alpha, qT); + registry.fill(HIST("MassGVsPt"), v0.pt(), v0.mGamma()); + registry.fill(HIST("nSigElFromG"), negTrkPt, negTrack.tpcNSigmaEl()); + registry.fill(HIST("nSigElFromG"), posTrkPt, posTrack.tpcNSigmaEl()); + registry.fill(HIST("NclVsEtaElV0"), posTrkEta, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaElV0p"), posTrkEta, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaElV0"), negTrkEta, negTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaElV0p"), negTrkEta, negTrack.tpcNClsFound()); + registry.fill(HIST("NclElV0"), posPorPt, posTrack.tpcNClsFound()); + registry.fill(HIST("NclElV0p"), posPorPt, posTrack.tpcNClsFound()); + registry.fill(HIST("NclElV0"), negPorPt, negTrack.tpcNClsFound()); + registry.fill(HIST("NclElV0p"), negPorPt, negTrack.tpcNClsFound()); registry.fill(HIST("dEdxVsEtaElMIPV0"), posTrkEta, posTrkdEdx); registry.fill(HIST("dEdxVsEtaElMIPV0p"), posTrkEta, posTrkdEdx); - } - if (negTrkP > kMinPMIP && negTrkP < kMaxPMIP) { registry.fill(HIST("dEdxVsEtaElMIPV0"), negTrkEta, negTrkdEdx); registry.fill(HIST("dEdxVsEtaElMIPV0p"), negTrkEta, negTrkdEdx); + dEdxElV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); + dEdxElV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); } } } @@ -870,9 +923,9 @@ struct PiKpRAA { void phiPrimeFunc(float& phi, const int& magField, const int& charge) { - if (magField < 0) // for negatve polarity field + if (magField < 0) phi = o2::constants::math::TwoPI - phi; - if (charge < 0) // for negatve charge + if (charge < 0) phi = o2::constants::math::TwoPI - phi; phi += o2::constants::math::PI / 18.0f; @@ -883,7 +936,7 @@ struct PiKpRAA { { bool isSelected{false}; - if (v0Selections.applyPhiCut && phiCut.isPhiCutLoaded) { + if (phiCut.isPhiCutLoaded) { const int binLow{phiCut.hPhiCutLow->FindBin(pt)}; const int binHigh{phiCut.hPhiCutHigh->FindBin(pt)}; const double phiCutLow{phiCut.hPhiCutLow->GetBinContent(binLow)}; @@ -1001,18 +1054,36 @@ struct PiKpRAA { } } - void loadPhiCutSelections() + void loadNchCalibrations(uint64_t timeStamp) + { + if (pathMeanNch.value.empty() == false) { + cfgNch.hMeanNch = ccdb->getForTimeStamp(pathMeanNch, timeStamp); + if (cfgNch.hMeanNch == nullptr) { + LOGF(fatal, "Could not load hMeanNch histogram from %s", pathMeanNch.value.c_str()); + } + } + + if (pathSigmaNch.value.empty() == false) { + cfgNch.hSigmaNch = ccdb->getForTimeStamp(pathSigmaNch, timeStamp); + if (cfgNch.hSigmaNch == nullptr) { + LOGF(fatal, "Could not load hSigmaNch histogram from %s", pathSigmaNch.value.c_str()); + } + } + cfgNch.calibrationsLoaded = true; + } + + void loadPhiCutSelections(const uint64_t& timeStamp) { if (pathPhiCutHigh.value.empty() == false) { - phiCut.hPhiCutHigh = ccdb->getForTimeStamp(pathPhiCutHigh, ccdbNoLaterThan.value); + phiCut.hPhiCutHigh = ccdb->getForTimeStamp(pathPhiCutHigh, timeStamp); if (phiCut.hPhiCutHigh == nullptr) { LOGF(fatal, "Could not load efficiency histogram from %s", pathPhiCutHigh.value.c_str()); } } if (pathPhiCutLow.value.empty() == false) { - phiCut.hPhiCutLow = ccdb->getForTimeStamp(pathPhiCutLow, ccdbNoLaterThan.value); + phiCut.hPhiCutLow = ccdb->getForTimeStamp(pathPhiCutLow, timeStamp); if (phiCut.hPhiCutLow == nullptr) { LOGF(fatal, "Could not load efficiency histogram from %s", pathPhiCutLow.value.c_str()); } From 0291c811eb4295f4a87c73e4da85c19947885e5a Mon Sep 17 00:00:00 2001 From: Yuanjing Ji Date: Fri, 29 Aug 2025 10:53:43 +0200 Subject: [PATCH 235/986] [PWGDQ] [PWGDQ]Add multiplicity in mixing variables (#12773) Co-authored-by: Yuanjing Ji Co-authored-by: Yuanjing Ji --- PWGDQ/Core/MixingLibrary.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/PWGDQ/Core/MixingLibrary.cxx b/PWGDQ/Core/MixingLibrary.cxx index 0682a224ad3..2f2f755269d 100644 --- a/PWGDQ/Core/MixingLibrary.cxx +++ b/PWGDQ/Core/MixingLibrary.cxx @@ -64,6 +64,18 @@ void o2::aod::dqmixing::SetUpMixing(MixingHandler* mh, const char* mixingVarible std::vector fCentFT0CLimsHashing = {0.0f, 2.5f, 5.0f, 7.5f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f}; mh->AddMixingVariable(VarManager::kCentFT0C, fCentFT0CLimsHashing.size(), fCentFT0CLimsHashing); } + if (!nameStr.compare("Mult1")) { + std::vector fMultLimsHashing = {0.0f, 10.0f, 20.0f, 40.0f, 60.0f, 80.0f, 100.0f, 120.0f, 160.0f, 350.0f}; + mh->AddMixingVariable(VarManager::kVtxNcontrib, fMultLimsHashing.size(), fMultLimsHashing); + } + if (!nameStr.compare("Mult2")) { + std::vector fMultLimsHashing = {0.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.0f, 120.0f, 140.0f, 180.0f, 350.0f}; + mh->AddMixingVariable(VarManager::kVtxNcontrib, fMultLimsHashing.size(), fMultLimsHashing); + } + if (!nameStr.compare("Mult3")) { + std::vector fMultLimsHashing = {0.0f, 5.0f, 10.0f, 15.0f, 20.0f, 25.0f, 30.0f, 35.0f, 40.0f, 45.0f, 50.0f, 55.0f, 60.0f, 65.0f, 70.0f, 75.0f, 80.0f, 85.0f, 90.0f, 100.0f, 120.0f, 140.0f, 165.0f, 200.0f, 350.0f}; + mh->AddMixingVariable(VarManager::kVtxNcontrib, fMultLimsHashing.size(), fMultLimsHashing); + } if (!nameStr.compare("Vtx1")) { std::vector fZLimsHashing = {-10.0f, 0.0f, 10.0f}; mh->AddMixingVariable(VarManager::kVtxZ, fZLimsHashing.size(), fZLimsHashing); From f3be3963e331233f77b7fbcf84df070c02dbadeb Mon Sep 17 00:00:00 2001 From: Jonghan Park <40240384+jpxrk@users.noreply.github.com> Date: Fri, 29 Aug 2025 19:47:38 +0900 Subject: [PATCH 236/986] [PWGHF] Add TPC nSigma vs P (#12780) --- PWGHF/HFL/Tasks/taskSingleElectron.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PWGHF/HFL/Tasks/taskSingleElectron.cxx b/PWGHF/HFL/Tasks/taskSingleElectron.cxx index 12bf351c84d..a19b8c79cb8 100644 --- a/PWGHF/HFL/Tasks/taskSingleElectron.cxx +++ b/PWGHF/HFL/Tasks/taskSingleElectron.cxx @@ -89,6 +89,7 @@ struct HfTaskSingleElectron { Configurable tpcNSigmaMin{"tpcNSigmaMin", -1., "min of tpc nsigma"}; Configurable tpcNSigmaMax{"tpcNSigmaMax", 3., "max of tpc nsigma"}; + Configurable nBinsP{"nBinsP", 1500, "number of bins of particle momentum"}; Configurable nBinsPt{"nBinsPt", 100, "N bins in pT histo"}; // SliceCache @@ -112,6 +113,7 @@ struct HfTaskSingleElectron { const AxisSpec axisNCont{100, 0., 100., "nCont"}; const AxisSpec axisPosZ{600, -30., 30., "Z_{pos}"}; const AxisSpec axisEta{30, -1.5, +1.5, "#eta"}; + const AxisSpec axisP{nBinsP, 0., 15., "p_{T}"}; const AxisSpec axisPt{nBinsPt, 0., 15., "p_{T}"}; const AxisSpec axisNsig{800, -20., 20.}; const AxisSpec axisTrackIp{4000, -0.2, 0.2, "dca"}; @@ -139,7 +141,9 @@ struct HfTaskSingleElectron { // pid histos.add("tofNSigPt", "", kTH2D, {{axisPtEl}, {axisNsig}}); histos.add("tofNSigPtQA", "", kTH2D, {{axisPtEl}, {axisNsig}}); + histos.add("tpcNSigP", "", kTH2D, {{axisP}, {axisNsig}}); histos.add("tpcNSigPt", "", kTH2D, {{axisPtEl}, {axisNsig}}); + histos.add("tpcNSigPAfterTofCut", "", kTH2D, {{axisP}, {axisNsig}}); histos.add("tpcNSigPtAfterTofCut", "", kTH2D, {{axisPtEl}, {axisNsig}}); histos.add("tpcNSigPtQA", "", kTH2D, {{axisPtEl}, {axisNsig}}); @@ -430,12 +434,14 @@ struct HfTaskSingleElectron { histos.fill(HIST("dcaZTrack"), track.dcaZ()); histos.fill(HIST("tofNSigPt"), track.pt(), track.tofNSigmaEl()); + histos.fill(HIST("tpcNSigP"), track.p(), track.tpcNSigmaEl()); histos.fill(HIST("tpcNSigPt"), track.pt(), track.tpcNSigmaEl()); if (std::abs(track.tofNSigmaEl()) > tofNSigmaMax) { continue; } histos.fill(HIST("tofNSigPtQA"), track.pt(), track.tofNSigmaEl()); + histos.fill(HIST("tpcNSigPAfterTofCut"), track.p(), track.tpcNSigmaEl()); histos.fill(HIST("tpcNSigPtAfterTofCut"), track.pt(), track.tpcNSigmaEl()); if (track.tpcNSigmaEl() < tpcNSigmaMin || track.tpcNSigmaEl() > tpcNSigmaMax) { From b21b55e1e095b81759cdcfba5eca9f2cbdd94aae Mon Sep 17 00:00:00 2001 From: dyx-11 <1260971129@qq.com> Date: Fri, 29 Aug 2025 19:48:55 +0800 Subject: [PATCH 237/986] [PWGUD] add MC codes (#12484) --- PWGUD/Tasks/flowCumulantsUpc.cxx | 396 ++++++++++++++++++++----------- 1 file changed, 259 insertions(+), 137 deletions(-) diff --git a/PWGUD/Tasks/flowCumulantsUpc.cxx b/PWGUD/Tasks/flowCumulantsUpc.cxx index 155a398cd44..5e2d64b6d94 100644 --- a/PWGUD/Tasks/flowCumulantsUpc.cxx +++ b/PWGUD/Tasks/flowCumulantsUpc.cxx @@ -14,42 +14,44 @@ /// \since Mar/2025 /// \brief jira: , task to measure flow observables with cumulant method -#include -#include -#include -#include -#include -#include -#include -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/HistogramRegistry.h" +#include "FlowContainer.h" +#include "GFW.h" +#include "GFWCumulant.h" +#include "GFWPowerArray.h" +#include "GFWWeights.h" -#include "Common/DataModel/EventSelection.h" +#include "PWGUD/Core/SGSelector.h" +#include "PWGUD/DataModel/UDTables.h" + +#include "Common/CCDB/ctpRateFetcher.h" +#include "Common/Core/RecoDecay.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectionDefaults.h" -#include "Common/Core/RecoDecay.h" -#include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" -#include "Common/CCDB/ctpRateFetcher.h" +#include "Common/DataModel/TrackSelectionTables.h" -#include "PWGUD/DataModel/UDTables.h" -#include "PWGUD/Core/SGSelector.h" -#include "TVector3.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" +#include -#include "GFWPowerArray.h" -#include "GFW.h" -#include "GFWCumulant.h" -#include "GFWWeights.h" -#include "FlowContainer.h" #include "TList.h" +#include "TVector3.h" +#include +#include #include #include -#include -#include + +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -122,9 +124,6 @@ struct FlowCumulantsUpc { Configurable cfgCutZDC{"cfgCutZDC", 10., "ZDC threshold"}; Configurable cfgGapSideSelection{"cfgGapSideSelection", 2, "gap selection"}; - // Filter collisionFilter = (nabs(aod::collision::posZ) < cfgCutVertex) && (aod::cent::centFT0C > cfgCentFT0CMin) && (aod::cent::centFT0C < cfgCentFT0CMax); - // Filter trackFilter = ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls) && (nabs(aod::track::dcaZ) < cfgCutDCAz); - // Corrections TH1D* mEfficiency = nullptr; GFWWeights* mAcceptance = nullptr; @@ -140,12 +139,17 @@ struct FlowCumulantsUpc { OutputObj fFC{FlowContainer("FlowContainer")}; OutputObj fWeights{GFWWeights("weights")}; HistogramRegistry registry{"registry"}; + OutputObj fFCMc{FlowContainer("FlowContainerMC")}; + OutputObj fWeightsMc{GFWWeights("weightsMC")}; // define global variables GFW* fGFW = new GFW(); + GFW* fGFWMC = new GFW(); std::vector corrconfigs; + std::vector corrconfigsmc; TAxis* fPtAxis; TRandom3* fRndm = new TRandom3(0); + TRandom3* fRndmMc = new TRandom3(0); enum CentEstimators { kCentFT0C = 0, kCentFT0CVariant1, @@ -161,8 +165,6 @@ struct FlowCumulantsUpc { ctpRateFetcher mRateFetcher; TH2* gCurrentHadronicRate; - // using AodCollisions = soa::Filtered>; - // using AodTracks = soa::Filtered>; // using UdTracks = soa::Join; using UdTracksFull = soa::Join; @@ -265,6 +267,20 @@ struct FlowCumulantsUpc { registry.add("hDCAxy", "DCAxy after cuts; DCAxy (cm); Pt", {HistType::kTH2D, {{200, -0.5, 0.5}, {200, 0, 5}}}); registry.add("hTrackCorrection2d", "Correlation table for number of tracks table; uncorrected track; corrected track", {HistType::kTH2D, {axisNch, axisNch}}); + registry.add("hPhiMC", "#phi distribution", {HistType::kTH1D, {axisPhi}}); + registry.add("hPhiWeightedMC", "corrected #phi distribution", {HistType::kTH1D, {axisPhi}}); + registry.add("hEtaMC", "#eta distribution", {HistType::kTH1D, {axisEta}}); + registry.add("hPtMC", "p_{T} distribution before cut", {HistType::kTH1D, {axisPtHist}}); + registry.add("hPtRefMC", "p_{T} distribution after cut", {HistType::kTH1D, {axisPtHist}}); + registry.add("hChi2prTPCclsMC", "#chi^{2}/cluster for the TPC track segment", {HistType::kTH1D, {{100, 0., 5.}}}); + registry.add("hChi2prITSclsMC", "#chi^{2}/cluster for the ITS track", {HistType::kTH1D, {{100, 0., 50.}}}); + registry.add("hnTPCCluMC", "Number of found TPC clusters", {HistType::kTH1D, {{100, 40, 180}}}); + registry.add("hnITSCluMC", "Number of found ITS clusters", {HistType::kTH1D, {{100, 0, 20}}}); + registry.add("hnTPCCrossedRowMC", "Number of crossed TPC Rows", {HistType::kTH1D, {{100, 40, 180}}}); + registry.add("hDCAzMC", "DCAz after cuts; DCAz (cm); Pt", {HistType::kTH2D, {{200, -0.5, 0.5}, {200, 0, 5}}}); + registry.add("hDCAxyMC", "DCAxy after cuts; DCAxy (cm); Pt", {HistType::kTH2D, {{200, -0.5, 0.5}, {200, 0, 5}}}); + registry.add("hTrackCorrection2dMC", "Correlation table for number of tracks table; uncorrected track; corrected track", {HistType::kTH2D, {axisNch, axisNch}}); + o2::framework::AxisSpec axis = axisPt; int nPtBins = axis.binEdges.size() - 1; double* ptBins = &(axis.binEdges)[0]; @@ -273,6 +289,8 @@ struct FlowCumulantsUpc { if (cfgOutputNUAWeights) { fWeights->setPtBins(nPtBins, ptBins); fWeights->init(true, false); + fWeightsMc->setPtBins(nPtBins, ptBins); + fWeightsMc->init(true, false); } // add in FlowContainer to Get boostrap sample automatically @@ -335,6 +353,9 @@ struct FlowCumulantsUpc { fFC->SetName("FlowContainer"); fFC->SetXAxis(fPtAxis); fFC->Initialize(oba, axisIndependent, cfgNbootstrap); + fFCMc->SetName("FlowContainerMC"); + fFCMc->SetXAxis(fPtAxis); + fFCMc->Initialize(oba, axisIndependent, cfgNbootstrap); delete oba; // eta region @@ -365,6 +386,33 @@ struct FlowCumulantsUpc { fGFW->AddRegion("olN10", -0.8, -0.5, 1 + fPtAxis->GetNbins(), 4); fGFW->AddRegion("olfull", -0.8, 0.8, 1 + fPtAxis->GetNbins(), 4); + fGFWMC->AddRegion("full", -0.8, 0.8, 1, 1); + fGFWMC->AddRegion("refN00", -0.8, 0., 1, 1); // gap0 negative region + fGFWMC->AddRegion("refP00", 0., 0.8, 1, 1); // gap0 positve region + fGFWMC->AddRegion("refN02", -0.8, -0.1, 1, 1); // gap2 negative region + fGFWMC->AddRegion("refP02", 0.1, 0.8, 1, 1); // gap2 positve region + fGFWMC->AddRegion("refN04", -0.8, -0.2, 1, 1); // gap4 negative region + fGFWMC->AddRegion("refP04", 0.2, 0.8, 1, 1); // gap4 positve region + fGFWMC->AddRegion("refN06", -0.8, -0.3, 1, 1); // gap6 negative region + fGFWMC->AddRegion("refP06", 0.3, 0.8, 1, 1); // gap6 positve region + fGFWMC->AddRegion("refN08", -0.8, -0.4, 1, 1); + fGFWMC->AddRegion("refP08", 0.4, 0.8, 1, 1); + fGFWMC->AddRegion("refN10", -0.8, -0.5, 1, 1); + fGFWMC->AddRegion("refP10", 0.5, 0.8, 1, 1); + fGFWMC->AddRegion("refN12", -0.8, -0.6, 1, 1); + fGFWMC->AddRegion("refP12", 0.6, 0.8, 1, 1); + fGFWMC->AddRegion("refN14", -0.8, -0.7, 1, 1); + fGFWMC->AddRegion("refP14", 0.7, 0.8, 1, 1); + fGFWMC->AddRegion("refN", -0.8, -0.4, 1, 1); + fGFWMC->AddRegion("refP", 0.4, 0.8, 1, 1); + fGFWMC->AddRegion("refM", -0.4, 0.4, 1, 1); + fGFWMC->AddRegion("poiN", -0.8, -0.4, 1 + fPtAxis->GetNbins(), 2); + fGFWMC->AddRegion("poiN10", -0.8, -0.5, 1 + fPtAxis->GetNbins(), 2); + fGFWMC->AddRegion("poifull", -0.8, 0.8, 1 + fPtAxis->GetNbins(), 2); + fGFWMC->AddRegion("olN", -0.8, -0.4, 1 + fPtAxis->GetNbins(), 4); + fGFWMC->AddRegion("olN10", -0.8, -0.5, 1 + fPtAxis->GetNbins(), 4); + fGFWMC->AddRegion("olfull", -0.8, 0.8, 1 + fPtAxis->GetNbins(), 4); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("full {2 -2}", "ChFull22", kFALSE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("full {3 -3}", "ChFull32", kFALSE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("full {4 -4}", "ChFull42", kFALSE)); @@ -406,6 +454,47 @@ struct FlowCumulantsUpc { corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN10 {4 2} refP10 {-4 -2}", "Ch10Gap4242", kFALSE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN10 {2 2} refP10 {-2 -2}", "Ch10Gap24", kFALSE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiN10 refN10 | olN10 {2 2} refP10 {-2 -2}", "Ch10Gap24", kTRUE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("full {2 -2}", "ChFull22", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("full {3 -3}", "ChFull32", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("full {4 -4}", "ChFull42", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("full {2 2 -2 -2}", "ChFull24", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("full {2 2 2 -2 -2 -2}", "ChFull26", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("refN04 {2} refP04 {-2}", "Ch04Gap22", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("refN06 {2} refP06 {-2}", "Ch06Gap22", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("refN08 {2} refP08 {-2}", "Ch08Gap22", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("refN10 {2} refP10 {-2}", "Ch10Gap22", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("refN12 {2} refP12 {-2}", "Ch12Gap22", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("refN04 {3} refP04 {-3}", "Ch04Gap32", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("refN06 {3} refP06 {-3}", "Ch06Gap32", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("refN08 {3} refP08 {-3}", "Ch08Gap32", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("refN10 {3} refP10 {-3}", "Ch10Gap32", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("refN12 {3} refP12 {-3}", "Ch12Gap32", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("refN04 {4} refP04 {-4}", "Ch04Gap42", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("refN06 {4} refP06 {-4}", "Ch06Gap42", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("refN08 {4} refP08 {-4}", "Ch08Gap42", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("refN10 {4} refP10 {-4}", "Ch10Gap42", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("refN12 {4} refP12 {-4}", "Ch12Gap42", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("refN {2} refP {-2}", "ChGap22", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("poifull full | olfull {2 -2}", "ChFull22", kTRUE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("poifull full | olfull {2 2 -2 -2}", "ChFull24", kTRUE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("poifull full | olfull {2 2 2 -2 -2 -2}", "ChFull26", kTRUE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("poiN10 refN10 | olN10 {2} refP10 {-2}", "Ch10Gap22", kTRUE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("poiN10 refN10 | olN10 {3} refP10 {-3}", "Ch10Gap32", kTRUE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("poiN10 refN10 | olN10 {4} refP10 {-4}", "Ch10Gap42", kTRUE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("full {4 -2 -2}", "ChFull422", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("refN04 {-2 -2} refP04 {4}", "Ch04GapA422", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("refN04 {4} refP04 {-2 -2}", "Ch04GapB422", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("refN10 {-2 -2} refP10 {4}", "Ch10GapA422", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("refN10 {4} refP10 {-2 -2}", "Ch10GapB422", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("full {3 2 -3 -2}", "ChFull3232", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("full {4 2 -4 -2}", "ChFull4242", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("refN04 {3 2} refP04 {-3 -2}", "Ch04Gap3232", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("refN04 {4 2} refP04 {-4 -2}", "Ch04Gap4242", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("refN04 {2 2} refP04 {-2 -2}", "Ch04Gap24", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("refN10 {3 2} refP10 {-3 -2}", "Ch10Gap3232", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("refN10 {4 2} refP10 {-4 -2}", "Ch10Gap4242", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("refN10 {2 2} refP10 {-2 -2}", "Ch10Gap24", kFALSE)); + corrconfigsmc.push_back(fGFWMC->GetCorrelatorConfig("poiN10 refN10 | olN10 {2 2} refP10 {-2 -2}", "Ch10Gap24", kTRUE)); if (!userDefineGFWCorr.empty() && !userDefineGFWName.empty()) { LOGF(info, "User adding GFW CorrelatorConfig:"); // attentaion: here we follow the index of cfgUserDefineGFWCorr @@ -489,6 +578,51 @@ struct FlowCumulantsUpc { return; } + template + void fillProfileMC(const GFW::CorrConfig& corrconf, const ConstStr& tarName, const double& cent) + { + double dnx, val; + dnx = fGFWMC->Calculate(corrconf, 0, kTRUE).real(); + if (dnx == 0) { + return; + } + if (!corrconf.pTDif) { + val = fGFWMC->Calculate(corrconf, 0, kFALSE).real() / dnx; + if (std::fabs(val) < 1) { + registry.fill(tarName, cent, val, dnx); + } + return; + } + return; + } + + void fillFCMC(const GFW::CorrConfig& corrconf, const double& cent, const double& rndm) + { + double dnx, val; + dnx = fGFWMC->Calculate(corrconf, 0, kTRUE).real(); + if (!corrconf.pTDif) { + if (dnx == 0) { + return; + } + val = fGFWMC->Calculate(corrconf, 0, kFALSE).real() / dnx; + if (std::fabs(val) < 1) { + fFCMc->FillProfile(corrconf.Head.c_str(), cent, val, dnx, rndm); + } + return; + } + for (auto i = 1; i <= fPtAxis->GetNbins(); i++) { + dnx = fGFWMC->Calculate(corrconf, i - 1, kTRUE).real(); + if (dnx == 0) { + continue; + } + val = fGFWMC->Calculate(corrconf, i - 1, kFALSE).real() / dnx; + if (std::fabs(val) < 1) { + fFCMc->FillProfile(Form("%s_pt_%i", corrconf.Head.c_str(), i), cent, val, dnx, rndm); + } + } + return; + } + void loadCorrections(uint64_t timestamp, int runNumber) { if (correctionsLoaded) { @@ -616,7 +750,8 @@ struct FlowCumulantsUpc { } // V0A T0A 5 sigma cut - if (cfgEvSelV0AT0ACut && (std::fabs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > 5 * fT0AV0ASigma->Eval(collision.multFT0A()))) { + constexpr int kSigmaCut = 5; + if (cfgEvSelV0AT0ACut && (std::fabs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > kSigmaCut * fT0AV0ASigma->Eval(collision.multFT0A()))) { return 0; } if (cfgEvSelV0AT0ACut) { @@ -657,7 +792,8 @@ struct FlowCumulantsUpc { if (!((multNTracksPV < fMultPVCutLow->Eval(centrality)) || (multNTracksPV > fMultPVCutHigh->Eval(centrality)) || (multTrk < fMultCutLow->Eval(centrality)) || (multTrk > fMultCutHigh->Eval(centrality)))) { registry.fill(HIST("hEventCountTentative"), 8.5); } - if (!(std::fabs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > 5 * fT0AV0ASigma->Eval(collision.multFT0A()))) { + constexpr int kSigmaCut = 5; + if (!(std::fabs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > kSigmaCut * fT0AV0ASigma->Eval(collision.multFT0A()))) { registry.fill(HIST("hEventCountTentative"), 9.5); } } @@ -669,7 +805,8 @@ struct FlowCumulantsUpc { if (!track.isPVContributor()) { return false; } - if (!(std::fabs(track.dcaZ()) < 2.)) { + constexpr float kDcazCut = 2.0; + if (!(std::fabs(track.dcaZ()) < kDcazCut)) { return false; } double dcaLimit = 0.0105 + 0.035 / std::pow(track.pt(), 1.1); @@ -677,15 +814,6 @@ struct FlowCumulantsUpc { return false; } return true; - - // if (cfgCutDCAzPtDepEnabled && (std::fabs(track.dcaZ()) > (0.004f + 0.013f / track.pt()))) - // return false; - - // if (cfgTrkSelSwitch) { - // return myTrackSel.IsSelected(track); - // } else { - // return ((track.tpcNClsFound() >= cfgCutTPCclu) && (track.itsNCls() >= cfgCutITSclu)); - // } } void initHadronicRate(aod::BCsWithTimestamps::iterator const& bc) @@ -705,29 +833,13 @@ struct FlowCumulantsUpc { gCurrentHadronicRate = gHadronicRate[mRunNumber]; } - // void process(AodCollisions::iterator const& collision, aod::BCsWithTimestamps const&, AodTracks const& tracks) void process(UDCollisionsFull::iterator const& collision, UdTracksFull const& tracks) { - - // Runnumber loading test - // accept only selected run numbers - // int run = collision.runNumber(); - - // extract bc pattern from CCDB for data or anchored MC only - // if (run != lastRun && run >= 500000) { - // LOGF(info, "Updating bcPattern %d ...", run); - // auto tss = ccdb->getRunDuration(run); - // auto grplhcif = ccdb->getForTimeStamp("GLO/Config/GRPLHCIF", tss.first); - // bcPatternB = grplhcif->getBunchFilling().getBCPattern(); - // lastRun = run; - // LOGF(info, "done!"); - // } - - // auto bcnum = collision.globalBC(); - registry.fill(HIST("hEventCount"), 0.5); int gapSide = collision.gapSide(); - if (gapSide < 0 || gapSide > 2) { + constexpr int kGapSideSelection = 0; + constexpr int kGapSideOppositeSelection = 2; + if (gapSide < kGapSideSelection || gapSide > kGapSideOppositeSelection) { return; } @@ -736,84 +848,14 @@ struct FlowCumulantsUpc { if (gapSide == cfgGapSideSelection) { return; } - - // if (!cfgUseSmallMemory && tracks.size() >= 1) { - // registry.fill(HIST("BeforeSel8_globalTracks_centT0C"), collision.centFT0C(), tracks.size()); - // } - // if (!collision.sel8()) - // return; - // if (tracks.size() < 1) - // return; registry.fill(HIST("hEventCount"), 1.5); - // auto bc = collision.bc_as(); - // int currentRunNumber = bc.runNumber(); - // for (const auto& ExcludedRun : cfgRunRemoveList.value) { - // if (currentRunNumber == ExcludedRun) { - // return; - // } - // } - // registry.fill(HIST("hEventCount"), 2.5); - // if (!cfgUseSmallMemory) { - // registry.fill(HIST("BeforeCut_globalTracks_centT0C"), collision.centFT0C(), tracks.size()); - // registry.fill(HIST("BeforeCut_PVTracks_centT0C"), collision.centFT0C(), collision.multNTracksPV()); - // registry.fill(HIST("BeforeCut_globalTracks_PVTracks"), collision.multNTracksPV(), tracks.size()); - // registry.fill(HIST("BeforeCut_globalTracks_multT0A"), collision.multFT0A(), tracks.size()); - // registry.fill(HIST("BeforeCut_globalTracks_multV0A"), collision.multFV0A(), tracks.size()); - // registry.fill(HIST("BeforeCut_multV0A_multT0A"), collision.multFT0A(), collision.multFV0A()); - // registry.fill(HIST("BeforeCut_multT0C_centT0C"), collision.centFT0C(), collision.multFT0C()); - // } float cent = 100; - // switch (cfgCentEstimator) { - // case kCentFT0C: - // cent = collision.centFT0C(); - // break; - // case kCentFT0CVariant1: - // cent = collision.centFT0CVariant1(); - // break; - // case kCentFT0M: - // cent = collision.centFT0M(); - // break; - // case kCentFV0A: - // cent = collision.centFV0A(); - // break; - // default: - // cent = collision.centFT0C(); - // } - // if (cfgUseTentativeEventCounter) - // eventCounterQA(collision, tracks.size(), cent); - // if (cfgUseAdditionalEventCut && !eventSelected(collision, tracks.size(), cent)) - // return; - // registry.fill(HIST("hEventCount"), 3.5); float lRandom = fRndm->Rndm(); float vtxz = collision.posZ(); registry.fill(HIST("hVtxZ"), vtxz); registry.fill(HIST("hMult"), tracks.size()); registry.fill(HIST("hCent"), cent); fGFW->Clear(); - // if (cfgGetInteractionRate) { - // initHadronicRate(bc); - // double hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), mRunNumber, "ZNC hadronic") * 1.e-3; // - // double seconds = bc.timestamp() * 1.e-3 - mMinSeconds; - // if (cfgUseInteractionRateCut && (hadronicRate < cfgCutMinIR || hadronicRate > cfgCutMaxIR)) // cut on hadronic rate - // return; - // gCurrentHadronicRate->Fill(seconds, hadronicRate); - // } - // loadCorrections(bc.timestamp(), currentRunNumber); - // registry.fill(HIST("hEventCount"), 4.5); - - // // fill event QA - // if (!cfgUseSmallMemory) { - // registry.fill(HIST("globalTracks_centT0C"), collision.centFT0C(), tracks.size()); - // registry.fill(HIST("PVTracks_centT0C"), collision.centFT0C(), collision.multNTracksPV()); - // registry.fill(HIST("globalTracks_PVTracks"), collision.multNTracksPV(), tracks.size()); - // registry.fill(HIST("globalTracks_multT0A"), collision.multFT0A(), tracks.size()); - // registry.fill(HIST("globalTracks_multV0A"), collision.multFV0A(), tracks.size()); - // registry.fill(HIST("multV0A_multT0A"), collision.multFT0A(), collision.multFV0A()); - // registry.fill(HIST("multT0C_centT0C"), collision.centFT0C(), collision.multFT0C()); - // registry.fill(HIST("centFT0CVar_centFT0C"), collision.centFT0C(), collision.centFT0CVariant1()); - // registry.fill(HIST("centFT0M_centFT0C"), collision.centFT0C(), collision.centFT0M()); - // registry.fill(HIST("centFV0A_centFT0C"), collision.centFT0C(), collision.centFV0A()); - // } // // track weights float weff = 1, wacc = 1; @@ -850,11 +892,6 @@ struct FlowCumulantsUpc { registry.fill(HIST("hPhiWeighted"), phi, wacc); registry.fill(HIST("hEta"), eta); registry.fill(HIST("hPtRef"), pt); - // registry.fill(HIST("hChi2prTPCcls"), track.tpcChi2NCl()); - // registry.fill(HIST("hChi2prITScls"), track.itsChi2NCl()); - // registry.fill(HIST("hnTPCClu"), track.tpcNClsFound()); - // registry.fill(HIST("hnITSClu"), track.itsNCls()); - // registry.fill(HIST("hnTPCCrossedRow"), track.tpcNClsCrossedRows()); registry.fill(HIST("hDCAz"), track.dcaZ(), track.pt()); registry.fill(HIST("hDCAxy"), track.dcaXY(), track.pt()); nTracksCorrected += weff; @@ -876,6 +913,91 @@ struct FlowCumulantsUpc { fillFC(corrconfigs.at(l_ind), independent, lRandom); } } + PROCESS_SWITCH(FlowCumulantsUpc, process, "process", true); + + //----------------------------------------------------------------------------------------------------------------------- + void processSim(aod::UDMcCollision const& mcCollision, aod::UDMcParticles const& mcParticles) + { + registry.fill(HIST("eventCounterMC"), 0.5); + + registry.fill(HIST("hEventCount"), 1.5); + float cent = 100; + float vtxz = mcCollision.posZ(); + registry.fill(HIST("hVtxZMC"), vtxz); + registry.fill(HIST("hMultMC"), mcParticles.size()); + registry.fill(HIST("hCentMC"), cent); + + auto massPion = o2::constants::physics::MassPionCharged; + registry.fill(HIST("numberOfTracksMC"), mcParticles.size()); + // LOGF(info, "New event! mcParticles.size() = %d", mcParticles.size()); + + float lRandomMc = fRndmMc->Rndm(); + fGFWMC->Clear(); + + // // track weights + float weff = 1, wacc = 1; + double nTracksCorrected = 0; + float independent = cent; + if (cfgUseNch) { + independent = static_cast(mcParticles.size()); + } + + for (const auto& mcParticle : mcParticles) { + if (!mcParticle.isPhysicalPrimary()) + continue; + std::array momentum = {mcParticle.px(), mcParticle.py(), mcParticle.pz()}; + double energy = std::sqrt(momentum[0] * momentum[0] + momentum[1] * momentum[1] + momentum[2] * momentum[2] + massPion * massPion); + ROOT::Math::LorentzVector> protoMC(momentum[0], momentum[1], momentum[2], energy); + constexpr double kEtaCut = 0.8; + constexpr double kPtCut = 0.1; + if (!(std::fabs(protoMC.Eta()) < kEtaCut && protoMC.Pt() > kPtCut)) { + continue; + } + // auto momentum = std::array{mcParticle.px(), mcParticle.py(), mcParticle.pz()}; + double pt = RecoDecay::pt(momentum); + double phi = RecoDecay::phi(momentum); + double eta = RecoDecay::eta(momentum); + bool withinPtPOI = (cfgCutPtPOIMin < pt) && (pt < cfgCutPtPOIMax); // within POI pT range + bool withinPtRef = (cfgCutPtRefMin < pt) && (pt < cfgCutPtRefMax); // within RF pT range + if (cfgOutputNUAWeights) { + if (cfgOutputNUAWeightsRefPt) { + if (withinPtRef) { + fWeightsMc->fill(phi, eta, vtxz, pt, cent, 0); + } + } else { + fWeightsMc->fill(phi, eta, vtxz, pt, cent, 0); + } + } + if (!setCurrentParticleWeights(weff, wacc, phi, eta, pt, vtxz)) { + continue; + } + if (withinPtRef) { + registry.fill(HIST("hPhiMC"), phi); + registry.fill(HIST("hPhiWeightedMC"), phi, wacc); + registry.fill(HIST("hEtaMC"), eta); + registry.fill(HIST("hPtRefMC"), pt); + // registry.fill(HIST("hDCAzMC"), track.dcaZ(), track.pt()); + // registry.fill(HIST("hDCAxyMC"), track.dcaXY(), track.pt()); + nTracksCorrected += weff; + } + if (withinPtRef) { + fGFWMC->Fill(eta, fPtAxis->FindBin(pt) - 1, phi, wacc * weff, 1); + } + if (withinPtPOI) { + fGFWMC->Fill(eta, fPtAxis->FindBin(pt) - 1, phi, wacc * weff, 2); + } + if (withinPtPOI && withinPtRef) { + fGFWMC->Fill(eta, fPtAxis->FindBin(pt) - 1, phi, wacc * weff, 4); + } + } + registry.fill(HIST("hTrackCorrection2dMC"), mcParticles.size(), nTracksCorrected); + + // Filling Flow Container + for (uint l_ind = 0; l_ind < corrconfigs.size(); l_ind++) { + fillFCMC(corrconfigs.at(l_ind), independent, lRandomMc); + } + PROCESS_SWITCH(FlowCumulantsUpc, processSim, "processSim", false); + } }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 7a7f4855afe3c63abd943d218fb17f38bf1a6b74 Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Fri, 29 Aug 2025 19:58:42 +0200 Subject: [PATCH 238/986] [PWGCF] FemtoUniverse: Add electron TPCNsigma rejection in pion selection (#12792) Co-authored-by: ALICE Action Bot --- ...irTaskTrackTrackSpherHarMultKtExtended.cxx | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx index 3dfb7d7f4ed..8e978e81cf4 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx @@ -68,6 +68,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { struct : o2::framework::ConfigurableGroup { Configurable ConfNsigmaCombined{"ConfNsigmaCombined", 3.0f, "TPC and TOF Pion Sigma (combined) for momentum > ConfTOFPtMin"}; Configurable ConfNsigmaTPC{"ConfNsigmaTPC", 3.0f, "TPC Pion Sigma for momentum < ConfTOFPtMin"}; + Configurable ConfNsigmaTPCElReject{"ConfNsigmaTPCElReject", 2.0f, "TPC Electron Sigma for momentum < ConfTOFPtMin"}; Configurable ConfTOFPtMin{"ConfTOFPtMin", 0.5f, "Min. Pt for which TOF is required for PID."}; Configurable ConfEtaMax{"ConfEtaMax", 0.8f, "Higher limit for |Eta| (the same for both particles)"}; @@ -306,7 +307,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { } } - bool IsPionNSigma(float mom, float nsigmaTPCPi, float nsigmaTOFPi) + bool IsPionNSigma(float mom, float nsigmaTPCPi, float nsigmaTOFPi, float nsigmaTPCElReject) { //|nsigma_TPC| < 3 for p < 0.5 GeV/c //|nsigma_combined| < 3 for p > 0.5 @@ -317,7 +318,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { // ConfNsigmaCombined -> TPC and TOF Pion Sigma (combined) for momentum > 0.5 if (true) { if (mom < twotracksconfigs.ConfTOFPtMin) { - if (std::abs(nsigmaTPCPi) < twotracksconfigs.ConfNsigmaTPC) { + if ((std::abs(nsigmaTPCPi) < twotracksconfigs.ConfNsigmaTPC) && (std::abs(nsigmaTPCElReject) > twotracksconfigs.ConfNsigmaTPCElReject)) { return true; } else { return false; @@ -333,7 +334,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { return false; } - bool IsParticleNSigma(int8_t particle_number, float mom, float nsigmaTPCPr, float nsigmaTOFPr, float nsigmaTPCPi, float nsigmaTOFPi, float nsigmaTPCK, float nsigmaTOFK) + bool IsParticleNSigma(int8_t particle_number, float mom, float nsigmaTPCPr, float nsigmaTOFPr, float nsigmaTPCPi, float nsigmaTOFPi, float nsigmaTPCK, float nsigmaTOFK, float nsigmaTPCElReject) { if (particle_number == 1) { switch (trackonefilter.ConfPDGCodePartOne) { @@ -343,7 +344,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { break; case 211: // Pion+ case -211: // Pion- - return IsPionNSigma(mom, nsigmaTPCPi, nsigmaTOFPi); + return IsPionNSigma(mom, nsigmaTPCPi, nsigmaTOFPi, nsigmaTPCElReject); break; case 321: // Kaon+ case -321: // Kaon- @@ -361,7 +362,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { break; case 211: // Pion+ case -211: // Pion- - return IsPionNSigma(mom, nsigmaTPCPi, nsigmaTOFPi); + return IsPionNSigma(mom, nsigmaTPCPi, nsigmaTOFPi, nsigmaTPCElReject); break; case 321: // Kaon+ case -321: // Kaon- @@ -468,7 +469,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { /// Histogramming same event if ((ContType == 1 || ContType == 2) && fillQA) { for (const auto& part : groupPartsOne) { - if (!IsParticleNSigma((int8_t)1, part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon))) { + if (!IsParticleNSigma((int8_t)1, part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(part, o2::track::PID::Electron))) { continue; } trackHistoPartOne.fillQA(part); @@ -478,7 +479,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { if ((ContType == 1 || ContType == 3) && fillQA) { for (const auto& part : groupPartsTwo) { - if (!IsParticleNSigma((int8_t)2, part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon))) { + if (!IsParticleNSigma((int8_t)2, part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(part, o2::track::PID::Electron))) { continue; } trackHistoPartTwo.fillQA(part); @@ -490,11 +491,11 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { /// Now build the combinations for non-identical particle pairs for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { - if (!IsParticleNSigma((int8_t)1, p1.p(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p1, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p1, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p1, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon))) { + if (!IsParticleNSigma((int8_t)1, p1.p(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p1, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p1, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p1, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(p1, o2::track::PID::Electron))) { continue; } - if (!IsParticleNSigma((int8_t)2, p2.p(), trackCuts.getNsigmaTPC(p2, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p2, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p2, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p2, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p2, o2::track::PID::Kaon))) { + if (!IsParticleNSigma((int8_t)2, p2.p(), trackCuts.getNsigmaTPC(p2, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p2, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p2, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p2, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(p2, o2::track::PID::Electron))) { continue; } @@ -520,11 +521,11 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { } else { for (const auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsOne, groupPartsOne))) { - if (!IsParticleNSigma((int8_t)2, p1.p(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p1, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p1, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p1, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon))) { + if (!IsParticleNSigma((int8_t)2, p1.p(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p1, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p1, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p1, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(p1, o2::track::PID::Electron))) { continue; } - if (!IsParticleNSigma((int8_t)2, p2.p(), trackCuts.getNsigmaTPC(p2, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p2, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p2, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p2, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p2, o2::track::PID::Kaon))) { + if (!IsParticleNSigma((int8_t)2, p2.p(), trackCuts.getNsigmaTPC(p2, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p2, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p2, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p2, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(p2, o2::track::PID::Electron))) { continue; } @@ -700,11 +701,11 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { - if (!IsParticleNSigma((int8_t)2, p1.p(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p1, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p1, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p1, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon))) { + if (!IsParticleNSigma((int8_t)2, p1.p(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p1, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p1, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p1, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(p1, o2::track::PID::Electron))) { continue; } - if (!IsParticleNSigma((int8_t)2, p2.p(), trackCuts.getNsigmaTPC(p2, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p2, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p2, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p2, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p2, o2::track::PID::Kaon))) { + if (!IsParticleNSigma((int8_t)2, p2.p(), trackCuts.getNsigmaTPC(p2, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p2, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p2, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p2, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(p2, o2::track::PID::Electron))) { continue; } From a3e0dc5415e719e6069dfd65a04744e246f88cc1 Mon Sep 17 00:00:00 2001 From: Jaideep Tanwar <141036812+jtanwar2212@users.noreply.github.com> Date: Fri, 29 Aug 2025 23:30:42 +0530 Subject: [PATCH 239/986] [PWGLF] Update nucleitpcpbpb.cxx (#12782) --- PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx | 128 ++++++++++++++++++--------- 1 file changed, 84 insertions(+), 44 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx b/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx index 78edc84586b..fc99ebcd30b 100644 --- a/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx +++ b/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx @@ -67,25 +67,25 @@ constexpr double kBetheBlochDefault[nParticles][nBetheParams]{ {5.393020, 7.859534, 0.004048, 2.323197, 1.609307, 0.09}, // triton {-126.557359, -0.858569, 1.111643, 1.210323, 2.656374, 0.09}, // helion {-126.557359, -0.858569, 1.111643, 1.210323, 2.656374, 0.09}}; // alpha -const int nTrkSettings = 14; -static const std::vector trackPIDsettingsNames{"useBBparams", "minITSnCls", "minITSnClscos", "minTPCnCls", "maxTPCchi2", "minTPCchi2", "maxITSchi2", "maxTPCnSigma", "maxDcaXY", "maxDcaZ", "minITSclsSize", "maxITSclsSize", "minTPCnClsCrossedRows", "minReqClusterITSib"}; +const int nTrkSettings = 13; +static const std::vector trackPIDsettingsNames{"useBBparams", "minITSnCls", "minITSnClscos", "minTPCnCls", "maxTPCchi2", "minTPCchi2", "maxITSchi2", "maxTPCnSigma", "maxDcaXY", "maxDcaZ", "minITSclsSize", "minTPCnClsCrossedRows", "minReqClusterITSib"}; constexpr double kTrackPIDSettings[nParticles][nTrkSettings]{ - {0, 0, 4, 60, 4.0, 0.5, 100, 2.5, 2., 2., 0., 1000, 70, 1}, - {1, 0, 4, 70, 4.0, 0.5, 100, 3.0, 2., 2., 0., 1000, 70, 1}, - {1, 0, 4, 70, 4.0, 0.5, 100, 3.0, 2., 2., 0., 1000, 70, 1}, - {1, 0, 4, 70, 4.0, 0.5, 100, 3.0, 2., 2., 0., 1000, 70, 1}, - {1, 0, 4, 75, 4.0, 0.5, 100, 5.0, 2., 2., 0., 1000, 70, 1}, - {1, 0, 4, 70, 4.0, 0.5, 100, 5.0, 2., 2., 0., 1000, 70, 1}}; + {0, 0, 4, 60, 4.0, 0.5, 100, 2.5, 2., 2., 0., 70, 1}, + {1, 0, 4, 70, 4.0, 0.5, 100, 3.0, 2., 2., 0., 70, 1}, + {1, 0, 4, 70, 4.0, 0.5, 100, 3.0, 2., 2., 0., 70, 1}, + {1, 0, 4, 70, 4.0, 0.5, 100, 3.0, 2., 2., 0., 70, 1}, + {1, 0, 4, 75, 4.0, 0.5, 100, 5.0, 2., 2., 0., 70, 1}, + {1, 0, 4, 70, 4.0, 0.5, 100, 5.0, 2., 2., 0., 70, 1}}; -const int nTrkSettings2 = 4; -static const std::vector trackPIDsettingsNames2{"useITSnsigma", "minITSnsigma", "maxITSnsigma", "fillsparsh"}; +const int nTrkSettings2 = 6; +static const std::vector trackPIDsettingsNames2{"useITSnsigma", "minITSnsigma", "maxITSnsigma", "fillsparsh", "useTPCnsigmaTOF", "maxTPCnsigmaTOF"}; constexpr double kTrackPIDSettings2[nParticles][nTrkSettings2]{ - {1, -5, 4, 0}, - {1, -5, 4, 0}, - {1, -5, 4, 0}, - {1, -5, 4, 1}, - {1, -5, 4, 1}, - {1, -5, 4, 1}}; + {1, -5, 4, 0, 1, 2}, + {1, -5, 4, 0, 1, 2}, + {1, -5, 4, 0, 1, 2}, + {1, -5, 4, 1, 1, 2}, + {1, -5, 4, 1, 1, 2}, + {1, -5, 4, 1, 1, 2}}; struct PrimParticles { TString name; @@ -104,6 +104,7 @@ struct PrimParticles { }; // struct PrimParticles //---------------------------------------------------------------------------------------------------------------- std::vector> hmass; +std::vector> hmassnsigma; } // namespace //---------------------------------------------------------------------------------------------------------------- struct NucleitpcPbPb { @@ -142,7 +143,6 @@ struct NucleitpcPbPb { Configurable cfgminGetMeanItsClsSizeRequire{"cfgminGetMeanItsClsSizeRequire", true, "Require minGetMeanItsClsSize Cut"}; Configurable cfgmaxGetMeanItsClsSizeRequire{"cfgmaxGetMeanItsClsSizeRequire", true, "Require maxGetMeanItsClsSize Cut"}; Configurable cfgDCAwithptRequire{"cfgDCAwithptRequire", true, "Require DCA cuts with pt dependance"}; - Configurable cfgDCAnopt{"cfgDCAnopt", true, "Require DCA cuts without pt dependance"}; Configurable cfgRequirebetaplot{"cfgRequirebetaplot", true, "Require beta plot"}; Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {kBetheBlochDefault[0], nParticles, nBetheParams, particleNames, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for light nuclei"}; @@ -150,18 +150,17 @@ struct NucleitpcPbPb { Configurable> cfgTrackPIDsettings2{"cfgTrackPIDsettings2", {kTrackPIDSettings2[0], nParticles, nTrkSettings2, particleNames, trackPIDsettingsNames2}, "track selection and PID criteria"}; Configurable cfgFillhspectra{"cfgFillhspectra", true, "fill data sparsh"}; Configurable cfgFillmass{"cfgFillmass", false, "Fill mass histograms"}; + Configurable cfgFillmassnsigma{"cfgFillmassnsigma", true, "Fill mass vs nsigma histograms"}; Configurable centcut{"centcut", 80.0f, "centrality cut"}; Configurable cfgCutRapidity{"cfgCutRapidity", 0.5f, "Rapidity range"}; Configurable cfgZvertex{"cfgZvertex", 10, "Min Z Vertex"}; Configurable cfgZvertexRequire{"cfgZvertexRequire", true, "Pos Z cut require"}; Configurable cfgZvertexRequireMC{"cfgZvertexRequireMC", true, "Pos Z cut require for generated particles"}; Configurable cfgsel8Require{"cfgsel8Require", true, "sel8 cut require"}; - Configurable cfgtpcNClsFound{"cfgtpcNClsFound", 100.0f, "min. no. of tpcNClsFound"}; - Configurable cfgitsNCls{"cfgitsNCls", 2.0f, "min. no. of itsNCls"}; o2::track::TrackParametrizationWithError mTrackParCov; // Binning configuration ConfigurableAxis axisMagField{"axisMagField", {10, -10., 10.}, "magnetic field"}; - ConfigurableAxis axisNev{"axisNev", {3, 0., 3.}, "Number of events"}; + ConfigurableAxis axisNev{"axisNev", {5, 0., 5.}, "Number of events"}; ConfigurableAxis axisRigidity{"axisRigidity", {4000, -10., 10.}, "#it{p}^{TPC}/#it{z}"}; ConfigurableAxis axisdEdx{"axisdEdx", {4000, 0, 4000}, "d#it{E}/d#it{x}"}; ConfigurableAxis axisCent{"axisCent", {100, 0, 100}, "centrality"}; @@ -171,13 +170,9 @@ struct NucleitpcPbPb { ConfigurableAxis axiseta{"axiseta", {100, -1, 1}, "eta"}; ConfigurableAxis axisrapidity{"axisrapidity", {100, -2, 2}, "rapidity"}; ConfigurableAxis axismass{"axismass", {100, -10, 10}, "mass^{2}"}; - ConfigurableAxis nsigmaAxis{"nsigmaAxis", {160, -20, 20}, "n#sigma_{#pi^{+}}"}; + ConfigurableAxis nsigmaAxis{"nsigmaAxis", {160, -10, 10}, "n#sigma_{#pi^{+}}"}; ConfigurableAxis speciesBitAxis{"speciesBitAxis", {8, -0.5, 7.5}, "particle type 0: pion, 1: proton, 2: deuteron, 3: triton, 4:He3, 5:He4"}; ConfigurableAxis axisDCA{"axisDCA", {400, -10., 10.}, "DCA axis"}; - ConfigurableAxis axisTPCcls{"axisTPCcls", {400, 0., 200.}, "TPCcls axis"}; - ConfigurableAxis axisITScls{"axisITScls", {400, 0., 200.}, "ITScls axis"}; - ConfigurableAxis axisITSchi2{"axisITSchi2", {400, 0., 100.}, "ITSchi2 axis"}; - ConfigurableAxis axisTPCchi2{"axisTPCchi2", {400, 0., 100.}, "TPCchi2 axis"}; // CCDB Service ccdb; @@ -224,6 +219,7 @@ struct NucleitpcPbPb { histos.add("Tpcsignal", "Tpcsignal", kTH2F, {axisRigidity, axisdEdx}); hmass.resize(2 * nParticles + 2); + hmassnsigma.resize(2 * nParticles + 2); for (int i = 0; i < nParticles; i++) { TString histName = primaryParticles[i].name; @@ -232,8 +228,15 @@ struct NucleitpcPbPb { hmass[2 * i + 1] = histos.add(Form("histmass_ptanti/histmass_%s", histName.Data()), ";p_T{TPC} (GeV/#it{c}); mass^{2}", HistType::kTH2F, {ptAxis, axismass}); } } + for (int i = 0; i < nParticles; i++) { + TString histName = primaryParticles[i].name; + if (cfgFillmassnsigma) { + hmassnsigma[2 * i] = histos.add(Form("histmass_nsigma/histmass_%s", histName.Data()), ";nsigma; mass^{2}", HistType::kTH2F, {nsigmaAxis, axismass}); + hmassnsigma[2 * i + 1] = histos.add(Form("histmass_nsigmaanti/histmass_%s", histName.Data()), ";p_T{TPC} (GeV/#it{c}); mass^{2}", HistType::kTH2F, {nsigmaAxis, axismass}); + } + } - histos.add("hSpectra", " ", HistType::kTHnSparseF, {speciesBitAxis, ptAxis, nsigmaAxis, {5, -2.5, 2.5}, axisCent, axisRigidity, axisdEdx, axisDCA, axisDCA, nsigmaAxis}); + histos.add("hSpectra", " ", HistType::kTHnSparseF, {speciesBitAxis, ptAxis, nsigmaAxis, {5, -2.5, 2.5}, axisCent, axisDCA, axisDCA, axisrapidity, axiseta}); if (doprocessMC) { histomc.add("histVtxZgen", "histVtxZgen", kTH1F, {axisVtxZ}); @@ -253,8 +256,11 @@ struct NucleitpcPbPb { histomc.add("histPtRecoHe4", "histPtgenHe4", kTH1F, {ptAxis}); histomc.add("histPtRecoAntiHe4", "histPtgenAntiHe4", kTH1F, {ptAxis}); histomc.add("histDeltaPtVsPtGen", " delta pt vs pt rec", HistType::kTH2F, {{1000, 0, 10}, {1000, -0.5, 0.5, "p_{T}(reco) - p_{T}(gen);p_{T}(reco)"}}); + histomc.add("histDeltaPtVsPtGenanti", " delta pt vs pt rec", HistType::kTH2F, {{1000, 0, 10}, {1000, -0.5, 0.5, "p_{T}(reco) - p_{T}(gen);p_{T}(reco)"}}); histomc.add("histPIDtrack", " delta pt vs pt rec", HistType::kTH2F, {{1000, 0, 10, "p_{T}(reco)"}, {9, -0.5, 8.5, "p_{T}(reco) - p_{T}(gen)"}}); + histomc.add("histPIDtrackanti", " delta pt vs pt rec", HistType::kTH2F, {{1000, 0, 10, "p_{T}(reco)"}, {9, -0.5, 8.5, "p_{T}(reco) - p_{T}(gen)"}}); histomc.add("histDeltaPtVsPtGenHe4", " delta pt vs pt rec", HistType::kTH2F, {{1000, 0, 10}, {1000, -0.5, 0.5, "p_{T}(reco) - p_{T}(gen);p_{T}(reco)"}}); + histomc.add("histDeltaPtVsPtGenHe4anti", " delta pt vs pt rec", HistType::kTH2F, {{1000, 0, 10}, {1000, -0.5, 0.5, "p_{T}(reco) - p_{T}(gen);p_{T}(reco)"}}); } } //---------------------------------------------------------------------------------------------------------------- @@ -309,7 +315,7 @@ struct NucleitpcPbPb { } if (track.sign() < 0) { sign = -1; - } // <- This redeclares a new local variable! + } if (std::abs(getRapidity(track, i)) > cfgCutRapidity && cfgRapidityRequire) continue; if (track.tpcNClsFound() < cfgTrackPIDsettings->get(i, "minTPCnCls") && cfgTPCNClsfoundRequire) @@ -331,8 +337,6 @@ struct NucleitpcPbPb { continue; if (getMeanItsClsSize(track) < cfgTrackPIDsettings->get(i, "minITSclsSize") && cfgminGetMeanItsClsSizeRequire) continue; - if (getMeanItsClsSize(track) > cfgTrackPIDsettings->get(i, "maxITSclsSize") && cfgmaxGetMeanItsClsSizeRequire) - continue; bool insideDCAxy = (std::abs(track.dcaXY()) <= (cfgTrackPIDsettings->get(i, "maxDcaXY") * (0.0105f + 0.0350f / std::pow(ptMomn, 1.1f)))); // o2-linter: disable=magic-number (To be checked) if ((!(insideDCAxy) || std::abs(track.dcaZ()) > dcazSigma(ptMomn, cfgTrackPIDsettings->get(i, "maxDcaZ"))) && cfgDCAwithptRequire) @@ -342,23 +346,24 @@ struct NucleitpcPbPb { if ((std::abs(tpcNsigma) > cfgTrackPIDsettings->get(i, "maxTPCnSigma")) && cfgmaxTPCnSigmaRequire) continue; float itsSigma = getITSnSigma(track, primaryParticles.at(i)); - if (itsSigma < cfgTrackPIDsettings2->get(i, "minITSnsigma") && cfgTrackPIDsettings2->get(i, "useITSnsigma") < 1) continue; if (itsSigma > cfgTrackPIDsettings2->get(i, "maxITSnsigma") && cfgTrackPIDsettings2->get(i, "useITSnsigma") < 1) continue; + histos.fill(HIST("Tpcsignal"), getRigidity(track) * track.sign(), track.tpcSignal()); - fillhmass(track, i); if (cfgFillhspectra && cfgTrackPIDsettings2->get(i, "fillsparsh") == 1) { - histos.fill(HIST("hSpectra"), i, ptMomn, tpcNsigma, sign, collision.centFT0C(), getRigidity(track) * track.sign(), track.tpcSignal(), track.dcaZ(), track.dcaXY(), itsSigma); + histos.fill(HIST("hSpectra"), i, ptMomn, tpcNsigma, sign, collision.centFT0C(), track.dcaZ(), track.dcaXY(), getRapidity(track, i), track.eta()); } + fillhmassnsigma(track, i, tpcNsigma); + if ((std::abs(tpcNsigma) > cfgTrackPIDsettings2->get(i, "maxTPCnsigmaTOF")) && cfgTrackPIDsettings2->get(i, "useTPCnsigmaTOF") < 1) + continue; + fillhmass(track, i); + if (cfgRequirebetaplot) { histos.fill(HIST("Tofsignal"), getRigidity(track) * track.sign(), o2::pid::tof::Beta::GetBeta(track)); } } - if (track.tpcNClsFound() > cfgtpcNClsFound || track.itsNCls() > cfgitsNCls) { - histos.fill(HIST("Tpcsignal"), getRigidity(track) * track.sign(), track.tpcSignal()); - } histos.fill(HIST("histeta"), track.eta()); } // track loop /////////////////////////////////////////////// @@ -420,7 +425,6 @@ struct NucleitpcPbPb { if (std::abs(collision.posZ()) > cfgZvertex && cfgZvertexRequire) continue; collPassedEvSel = collision.sel8(); - occupancy = collision.trackOccupancyInTimeRange(); if (!collPassedEvSel && cfgsel8Require) continue; histomc.fill(HIST("histNevReco"), 1.5); @@ -429,6 +433,7 @@ struct NucleitpcPbPb { histomc.fill(HIST("histCentFT0MReco"), collision.centFT0M()); if (collision.centFT0C() > centcut) continue; + histomc.fill(HIST("histNevReco"), 2.5); if (removeITSROFrameBorder && !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) continue; if (removeNoSameBunchPileup && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) @@ -478,7 +483,7 @@ struct NucleitpcPbPb { } if (track.sign() < 0) { sign = -1; - } // <- This redeclares a new local variable! + } if (std::abs(getRapidity(track, i)) > cfgCutRapidity && cfgRapidityRequire) continue; if (track.tpcNClsFound() < cfgTrackPIDsettings->get(i, "minTPCnCls") && cfgTPCNClsfoundRequire) @@ -500,8 +505,6 @@ struct NucleitpcPbPb { continue; if (getMeanItsClsSize(track) < cfgTrackPIDsettings->get(i, "minITSclsSize") && cfgminGetMeanItsClsSizeRequire) continue; - if (getMeanItsClsSize(track) > cfgTrackPIDsettings->get(i, "maxITSclsSize") && cfgmaxGetMeanItsClsSizeRequire) - continue; bool insideDCAxy = (std::abs(track.dcaXY()) <= (cfgTrackPIDsettings->get(i, "maxDcaXY") * (0.0105f + 0.0350f / std::pow(ptMomn, 1.1f)))); // o2-linter: disable=magic-number (To be checked) if ((!(insideDCAxy) || std::abs(track.dcaZ()) > dcazSigma(ptMomn, cfgTrackPIDsettings->get(i, "maxDcaZ"))) && cfgDCAwithptRequire) @@ -511,16 +514,20 @@ struct NucleitpcPbPb { if ((std::abs(tpcNsigma) > cfgTrackPIDsettings->get(i, "maxTPCnSigma")) && cfgmaxTPCnSigmaRequire) continue; float itsSigma = getITSnSigma(track, primaryParticles.at(i)); - if (itsSigma < cfgTrackPIDsettings2->get(i, "minITSnsigma") && cfgTrackPIDsettings2->get(i, "useITSnsigma") < 1) continue; if (itsSigma > cfgTrackPIDsettings2->get(i, "maxITSnsigma") && cfgTrackPIDsettings2->get(i, "useITSnsigma") < 1) continue; + histos.fill(HIST("Tpcsignal"), getRigidity(track) * track.sign(), track.tpcSignal()); - fillhmass(track, i); if (cfgFillhspectra && cfgTrackPIDsettings2->get(i, "fillsparsh") == 1) { - histos.fill(HIST("hSpectra"), i, ptMomn, tpcNsigma, sign, collision.centFT0C(), getRigidity(track) * track.sign(), track.tpcSignal(), track.dcaZ(), track.dcaXY(), itsSigma); + histos.fill(HIST("hSpectra"), i, ptMomn, tpcNsigma, sign, collision.centFT0C(), track.dcaZ(), track.dcaXY(), getRapidity(track, i), track.eta()); } + fillhmassnsigma(track, i, tpcNsigma); + if ((std::abs(tpcNsigma) > cfgTrackPIDsettings2->get(i, "maxTPCnsigmaTOF")) && cfgTrackPIDsettings2->get(i, "useTPCnsigmaTOF") < 1) + continue; + fillhmass(track, i); + if (cfgRequirebetaplot) { histos.fill(HIST("Tofsignal"), getRigidity(track) * track.sign(), o2::pid::tof::Beta::GetBeta(track)); } @@ -545,12 +552,21 @@ struct NucleitpcPbPb { float deltaPt = ptReco - ptGen; if (pdg == -particlePdgCodes.at(4)) { + histomc.fill(HIST("histDeltaPtVsPtGenanti"), ptReco, deltaPt); + histomc.fill(HIST("histPIDtrackanti"), ptReco, track.pidForTracking()); + } + if (pdg == particlePdgCodes.at(4)) { histomc.fill(HIST("histDeltaPtVsPtGen"), ptReco, deltaPt); histomc.fill(HIST("histPIDtrack"), ptReco, track.pidForTracking()); } + if (pdg == -particlePdgCodes.at(5)) { + histomc.fill(HIST("histDeltaPtVsPtGenHe4anti"), ptReco, deltaPt); + } + if (pdg == particlePdgCodes.at(5)) { histomc.fill(HIST("histDeltaPtVsPtGenHe4"), ptReco, deltaPt); } + if (pdg == particlePdgCodes.at(4)) { histomc.fill(HIST("histPtRecoHe3"), ptReco); } else if (pdg == -particlePdgCodes.at(4)) { @@ -628,14 +644,15 @@ struct NucleitpcPbPb { if (!track.hasTOF() || !cfgFillmass) return; float beta{o2::pid::tof::Beta::GetBeta(track)}; - if (beta <= 0.f || beta >= 1.f) + const float eps = 1e-6f; + if (beta < eps || beta > 1.0f - eps) return; float charge = (species == he3 || species == he4) ? 2.f : 1.f; float p = getRigidity(track); // assuming this is the momentum from inner TPC float massTOF = p * charge * std::sqrt(1.f / (beta * beta) - 1.f); // get PDG mass float pdgMass = particleMasses[species]; - float massDiff = massTOF - pdgMass; + float massDiff = massTOF * massTOF - pdgMass * pdgMass; float ptMomn; setTrackParCov(track, mTrackParCov); mTrackParCov.setPID(track.pidForTracking()); @@ -648,6 +665,29 @@ struct NucleitpcPbPb { } //---------------------------------------------------------------------------------------------------------------- template + void fillhmassnsigma(T const& track, int species, float sigma) + { + if (!track.hasTOF() || !cfgFillmassnsigma) + return; + float beta{o2::pid::tof::Beta::GetBeta(track)}; + const float eps = 1e-6f; + if (beta < eps || beta > 1.0f - eps) + return; + float charge = (species == he3 || species == he4) ? 2.f : 1.f; + float p = getRigidity(track); // assuming this is the momentum from inner TPC + float massTOF = p * charge * std::sqrt(1.f / (beta * beta) - 1.f); + // get PDG mass + float pdgMass = particleMasses[species]; + float massDiff = massTOF * massTOF - pdgMass * pdgMass; + + if (track.sign() > 0) { + hmassnsigma[2 * species]->Fill(sigma, massDiff); + } else if (track.sign() < 0) { + hmassnsigma[2 * species + 1]->Fill(sigma, massDiff); + } + } + //---------------------------------------------------------------------------------------------------------------- + template float getTPCnSigma(T const& track, PrimParticles& particle) { const float rigidity = getRigidity(track); From c70c42624ba2b1f9ad0149062278a41dc77f5d5d Mon Sep 17 00:00:00 2001 From: Junlee Kim Date: Sat, 30 Aug 2025 06:13:40 +0900 Subject: [PATCH 240/986] [PWGCF] add deta differential study (#12781) --- PWGCF/Tasks/correlations.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PWGCF/Tasks/correlations.cxx b/PWGCF/Tasks/correlations.cxx index 2a6101a5b9a..5122b9ebf64 100644 --- a/PWGCF/Tasks/correlations.cxx +++ b/PWGCF/Tasks/correlations.cxx @@ -182,6 +182,7 @@ struct CorrelationTask { if (doprocessSame2Prong2Prong || doprocessSame2Prong2ProngML) { registry.add("invMassTwoPart", "2D 2-prong invariant mass (GeV/c^2)", {HistType::kTHnSparseF, {axisSpecMass, axisSpecMass, axisPtTrigger, axisPtAssoc, axisMultiplicity}}); registry.add("invMassTwoPartDPhi", "2D 2-prong invariant mass (GeV/c^2)", {HistType::kTHnSparseF, {axisSpecMass, axisSpecMass, axisPtTrigger, axisPtAssoc, axisDeltaPhi}}); + registry.add("invMassTwoPartDEta", "2D 2-prong invariant mass (GeV/c^2)", {HistType::kTHnSparseF, {axisSpecMass, axisSpecMass, axisPtTrigger, axisPtAssoc, axisDeltaEta}}); } } if (doprocessSameDerivedMultSet) { @@ -394,6 +395,9 @@ struct CorrelationTask { continue; registry.fill(HIST("invMassTwoPart"), track1.invMass(), track2.invMass(), track1.pt(), track2.pt(), multiplicity); registry.fill(HIST("invMassTwoPartDPhi"), track1.invMass(), track2.invMass(), track1.pt(), track2.pt(), TVector2::Phi_0_2pi(track1.phi() - track2.phi() + TMath::Pi() / 2.0) - TMath::Pi() / 2.0); + if (std::abs(track1.phi() - track2.phi()) < constants::math::PI * 0.5) { + registry.fill(HIST("invMassTwoPartDEta"), track1.invMass(), track2.invMass(), track1.pt(), track2.pt(), track1.eta() - track2.eta()); + } } } } @@ -637,7 +641,7 @@ struct CorrelationTask { continue; // skip particles that do not match the decay mask } if (cfgV0RapidityMax > 0) { - auto [t, y] = getV0Rapidity(track1); + auto [t, y] = getV0Rapidity(track2); if (t && std::abs(y) > cfgV0RapidityMax) continue; // V0s are not allowed to be outside the rapidity range } From 9ca380893fa6a6248a8223cc83e3bc38a7c46eb4 Mon Sep 17 00:00:00 2001 From: Fabio Catalano Date: Sat, 30 Aug 2025 02:12:45 +0200 Subject: [PATCH 241/986] [PWGHF] Minor changes to histogram axes in OmegaC task (#12787) --- PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx b/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx index e04ca9f6b04..69c09d88d5f 100644 --- a/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx +++ b/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx @@ -99,15 +99,15 @@ struct HfTaskOmegac0ToOmegapi { Preslice candOmegacKFMlPerCollision = aod::hf_cand_xic0_omegac0::collisionId; PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; - ConfigurableAxis thnConfigAxisPromptScore{"thnConfigAxisPromptScore", {100, 0, 1}, "Prompt score"}; ConfigurableAxis thnConfigAxisMass{"thnConfigAxisMass", {700, 2.4, 3.1}, "Cand. inv. mass"}; ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {500, 0, 50}, "Cand. pT"}; ConfigurableAxis thnConfigAxisPtB{"thnConfigAxisPtB", {500, 0, 50}, "Cand. beauty mother pT"}; ConfigurableAxis thnConfigAxisY{"thnConfigAxisY", {20, -1, 1}, "Cand. rapidity"}; - ConfigurableAxis thnConfigAxisCent{"thnConfigAxisCent", {100, 0, 100}, "Centrality"}; ConfigurableAxis thnConfigAxisOrigin{"thnConfigAxisOrigin", {3, -0.5, 2.5}, "Cand. origin"}; ConfigurableAxis thnConfigAxisMatchFlag{"thnConfigAxisMatchFlag", {15, -7.5, 7.5}, "Cand. MC match flag"}; - ConfigurableAxis thnConfigAxisNumPvContr{"thnConfigAxisNumPvContr", {200, -0.5, 199.5}, "PV contributors"}; + ConfigurableAxis thnConfigAxisNumPvContr{"thnConfigAxisNumPvContr", {200, -0.5, 199.5}, "Coll. num. PV contributors"}; + ConfigurableAxis thnConfigAxisCent{"thnConfigAxisCent", {100, 0, 100}, "Coll. centrality precentile"}; + ConfigurableAxis thnConfigAxisPromptScore{"thnConfigAxisPromptScore", {100, 0, 1}, "Prompt score"}; HistogramRegistry registry{"registry", {}}; void init(InitContext&) @@ -119,23 +119,29 @@ struct HfTaskOmegac0ToOmegapi { LOGP(fatal, "One and only one process function should be enabled at a time."); } - const AxisSpec thnAxisMass{thnConfigAxisMass, "inv. mass (#Omega#pi) (GeV/#it{c}^{2})"}; + const AxisSpec thnAxisMass{thnConfigAxisMass, "Inv. mass (#Omega#pi) (GeV/#it{c}^{2})"}; const AxisSpec thnAxisPt{thnConfigAxisPt, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec thnAxisPtB{thnConfigAxisPtB, "#it{p}_{T}^{B} (GeV/#it{c})"}; const AxisSpec thnAxisY{thnConfigAxisY, "y"}; const AxisSpec thnAxisOrigin{thnConfigAxisOrigin, "Origin"}; const AxisSpec thnAxisMatchFlag{thnConfigAxisMatchFlag, "MC match flag"}; - const AxisSpec thnAxisNumPvContr{thnConfigAxisNumPvContr, "PV contributors"}; + const AxisSpec thnAxisNumPvContr{thnConfigAxisNumPvContr, "Number of primary vtx. contributors"}; + const AxisSpec thnAxisCent{thnConfigAxisCent, "Centrality percentile"}; + const AxisSpec thnAxisCentMc{thnConfigAxisCent, "Centrality percentile (from gen. MC info)"}; const AxisSpec thnAxisPromptScore{thnConfigAxisPromptScore, "BDT score prompt"}; - const AxisSpec thnAxisCent{thnConfigAxisCent, "Centrality"}; std::vector axes = {thnAxisMass, thnAxisPt, thnAxisY}; std::vector axesMcGen = {thnAxisPt, thnAxisPtB, thnAxisY, thnAxisOrigin}; - if (doprocessDataKFParticleFT0C || doprocessDataKFParticleMlFT0C || doprocessDataKFParticleFT0M || doprocessDataKFParticleMlFT0M || doprocessMcKFParticleFT0M || doprocessMcKFParticleMlFT0M) { + if (doprocessDataKFParticleFT0C || doprocessDataKFParticleMlFT0C || doprocessDataKFParticleFT0M || doprocessDataKFParticleMlFT0M) { axes.push_back(thnAxisCent); axes.push_back(thnConfigAxisNumPvContr); - axesMcGen.push_back(thnAxisCent); + } + + if (doprocessMcKFParticleFT0M || doprocessMcKFParticleMlFT0M) { + axes.push_back(thnAxisCentMc); + axes.push_back(thnConfigAxisNumPvContr); + axesMcGen.push_back(thnAxisCentMc); axesMcGen.push_back(thnConfigAxisNumPvContr); } @@ -145,7 +151,7 @@ struct HfTaskOmegac0ToOmegapi { if (doprocessMcKFParticleFT0M || doprocessMcKFParticleMlFT0M) { registry.add("hMcGenWithRecoColl", "Gen. #Omega_{c}^{0} from charm and beauty (associated to a reco collision)", HistType::kTHnSparseD, axesMcGen); - registry.add("hNumRecoCollPerMcColl", "Number of reco collisions associated to a mc collision;Num. reco. coll. per Mc coll.;", {HistType::kTH1D, {{10, -1.5, 8.5}}}); + registry.add("hNumRecoCollPerMcColl", "Number of reco collisions associated to a mc collision;Num. reco. coll. per Mc coll.;", {HistType::kTH1D, {{10, -0.5, 9.5}}}); registry.get(HIST("hMcGenWithRecoColl"))->Sumw2(); } From e154893ebd133d7f4b56f04b97555e92aac733ad Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Sat, 30 Aug 2025 04:22:15 +0200 Subject: [PATCH 242/986] [PWGHF] Implement track-rotation for bkg estimation of charm resonances (#12788) Co-authored-by: ALICE Action Bot --- .../candidateCreatorCharmResoReduced.cxx | 460 +++++++++--------- 1 file changed, 240 insertions(+), 220 deletions(-) diff --git a/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx index f5f8734c652..4df706619fe 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx @@ -128,6 +128,13 @@ struct HfCandidateCreatorCharmResoReduced { ConfigurableAxis multPoolBins{"multPoolBins", {VARIABLE_WIDTH, 0., 45., 60., 75., 95, 250}, "event multiplicity pools (PV contributors for now)"}; ConfigurableAxis zPoolBins{"zPoolBins", {VARIABLE_WIDTH, -10.0, -4, -1, 1, 4, 10.0}, "z vertex position pools"}; } cfgMixedEvent; + struct : ConfigurableGroup { + std::string prefix = "trackRotation"; + Configurable enable{"enable", false, "enable rotation of track/V0 for background estimation"}; + Configurable numRotations{"numRotations", 12, "number of track/V0 rotations"}; + 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"}; + } cfgTrackRotation; // Histogram axes configurables struct : ConfigurableGroup { std::string prefix = "histAxes"; @@ -151,6 +158,7 @@ struct HfCandidateCreatorCharmResoReduced { HistogramRegistry registry{"registry"}; + float bkgRotationAngleStep{0.f}; void init(InitContext const&) { // histograms @@ -169,6 +177,7 @@ struct HfCandidateCreatorCharmResoReduced { for (int iBin = 0; iBin < kNBinsSelections; ++iBin) { registry.get(HIST("hSelections"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data()); } + bkgRotationAngleStep = (cfgTrackRotation.numRotations > 1) ? (cfgTrackRotation.maxRotAngleMultByPi - cfgTrackRotation.minRotAngleMultByPi) * constants::math::PI / (cfgTrackRotation.numRotations - 1) : 0.; } bool isInMassInterval(float invMass, int ptBin) @@ -341,210 +350,46 @@ struct HfCandidateCreatorCharmResoReduced { { std::vector> pVectorCharmProngs = {candD.pVectorProng0(), candD.pVectorProng1()}; std::array pVecD = candD.pVector(); - std::array pVecV0Tr = candV0Tr.pVector(); - float invMassReso{-1}, invMassV0Tr{-1}, invMassD{-1}; - int8_t signReso{0}, isWrongSign{0}; - double ptReso = RecoDecay::pt(RecoDecay::sumOfVec(pVecV0Tr, pVecD)); - if constexpr (dType == DType::Dplus) { - invMassD = candD.invMassDplus(); - pVectorCharmProngs.push_back(candD.pVectorProng2()); - if constexpr (bachType == BachelorType::V0) { - if (cfgV0Cuts.v0Type == V0Type::K0s) { // K0s - invMassV0Tr = candV0Tr.invMassK0s(); - signReso = candD.sign(); - if (useDeltaMass) { - invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassK0Short}) - invMassD; - } else { - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassDPlus, MassK0Short}); - } - } else if (cfgV0Cuts.v0Type == V0Type::Lambda) { // Lambda - if (candV0Tr.v0Type() == V0Type::Lambda) { - invMassV0Tr = candV0Tr.invMassLambda(); - signReso = candD.sign(); - } else if (candV0Tr.v0Type() == V0Type::AntiLambda) { - invMassV0Tr = candV0Tr.invMassAntiLambda(); - signReso = candD.sign(); - isWrongSign = 1; - } - if (useDeltaMass) { - invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassLambda}) - invMassD; - } else { - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassDPlus, MassLambda}); - } - } - rowCandidateReso(pVecD[0], pVecD[1], pVecD[2], - pVecV0Tr[0], pVecV0Tr[1], pVecV0Tr[2], - invMassReso, - invMassD, - invMassV0Tr, - signReso, - isWrongSign); - rowCandidateResoIndices3PrV0s(collision.globalIndex(), candD.globalIndex(), candV0Tr.globalIndex()); - registry.fill(HIST("hMassResoVsPt"), invMassReso, ptReso); - registry.fill(HIST("hMassDmesDauVsPt"), invMassD, candD.pt()); - registry.fill(HIST("hMassV0DauVsPt"), invMassV0Tr, candV0Tr.pt()); - } else if constexpr (bachType == BachelorType::Track) { - signReso = candD.sign() + candV0Tr.sign(); - isWrongSign = candD.sign() * candV0Tr.sign() > 0 ? 1 : 0; - if (cfgTrackCuts.massHypo == TrackType::Pion) { // Pion - invMassV0Tr = MassPiPlus; - if (useDeltaMass) { - invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassPiPlus}) - invMassD; - } else { - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassDPlus, MassPiPlus}); - } - } else if (cfgTrackCuts.massHypo == TrackType::Kaon) { // Kaon - invMassV0Tr = MassKPlus; - if (useDeltaMass) { - invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassKPlus}) - invMassD; - } else { - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassDPlus, MassKPlus}); - } - } else if (cfgTrackCuts.massHypo == TrackType::Proton) { // Proton - invMassV0Tr = MassProton; - if (useDeltaMass) { - invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassProton}) - invMassD; - } else { - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassDPlus, MassProton}); - } - } - rowCandidateReso(pVecD[0], pVecD[1], pVecD[2], - pVecV0Tr[0], pVecV0Tr[1], pVecV0Tr[2], - invMassReso, - invMassD, - invMassV0Tr, - signReso, - isWrongSign); - rowCandidateResoIndices3PrTrks(collision.globalIndex(), candD.globalIndex(), candV0Tr.globalIndex()); - registry.fill(HIST("hMassResoVsPt"), invMassReso, ptReso); - registry.fill(HIST("hMassDmesDauVsPt"), invMassD, candD.pt()); - registry.fill(HIST("hMassV0DauVsPt"), invMassV0Tr, candV0Tr.pt()); - } - } else if constexpr (dType == DType::Dstar) { - float invMassD0; - if (candD.sign() > 0) { - invMassD = candD.invMassDstar(); - invMassD0 = candD.invMassD0(); - } else { - invMassD = candD.invMassAntiDstar(); - invMassD0 = candD.invMassD0Bar(); - } - pVectorCharmProngs.push_back(candD.pVectorProng2()); - if constexpr (bachType == BachelorType::V0) { - signReso = candD.sign(); - if (cfgV0Cuts.v0Type == V0Type::K0s) { // K0s - invMassV0Tr = candV0Tr.invMassK0s(); - if (useDeltaMass) { - if (candD.sign() > 0) { - invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassK0Short}) - invMassD; - } else { - invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[1], pVectorCharmProngs[0], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassK0Short}) - invMassD; - } - } else { - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassDStar, MassK0Short}); - } - } else if (cfgV0Cuts.v0Type == V0Type::Lambda) { // Lambda - if (candV0Tr.v0Type() == V0Type::Lambda) { - invMassV0Tr = candV0Tr.invMassLambda(); - } else if (candV0Tr.v0Type() == V0Type::AntiLambda) { - invMassV0Tr = candV0Tr.invMassAntiLambda(); - isWrongSign = 1; - } - if (useDeltaMass) { - if (candD.sign() > 0) { - invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassLambda}) - invMassD; - } else { - invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[1], pVectorCharmProngs[0], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassLambda}) - invMassD; - } - } else { - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassDStar, MassLambda}); - } - } - rowCandidateReso(pVecD[0], pVecD[1], pVecD[2], - pVecV0Tr[0], pVecV0Tr[1], pVecV0Tr[2], - invMassReso, - invMassD - invMassD0, - invMassV0Tr, - signReso, - isWrongSign); - rowCandidateResoIndicesDstarV0s(collision.globalIndex(), candD.globalIndex(), candV0Tr.globalIndex()); - registry.fill(HIST("hMassResoVsPt"), invMassReso, ptReso); - registry.fill(HIST("hMassDmesDauVsPt"), invMassD - invMassD0, candD.pt()); - registry.fill(HIST("hMassV0DauVsPt"), invMassV0Tr, candV0Tr.pt()); - } else if constexpr (bachType == BachelorType::Track) { - signReso = candD.sign() + candV0Tr.sign(); - isWrongSign = candD.sign() * candV0Tr.sign() > 0 ? 1 : 0; - if (cfgTrackCuts.massHypo == TrackType::Pion) { // Pion - invMassV0Tr = MassPiPlus; - if (useDeltaMass) { - if (candD.sign() > 0) { - invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassPiPlus}) - invMassD; - } else { - invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[1], pVectorCharmProngs[0], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassPiPlus}) - invMassD; - } - } else { - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassDStar, MassPiPlus}); - } - } else if (cfgTrackCuts.massHypo == TrackType::Kaon) { // Kaon - invMassV0Tr = MassKPlus; - if (useDeltaMass) { - if (candD.sign() > 0) { - invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassKPlus}) - invMassD; - } else { - invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[1], pVectorCharmProngs[0], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassKPlus}) - invMassD; - } - } else { - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassDStar, MassKPlus}); - } - } else if (cfgTrackCuts.massHypo == TrackType::Proton) { // Proton - invMassV0Tr = MassProton; - if (useDeltaMass) { - if (candD.sign() > 0) { - invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassProton}) - invMassD; - } else { - invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[1], pVectorCharmProngs[0], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassProton}) - invMassD; - } - } else { - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassDStar, MassProton}); - } - } - rowCandidateReso(pVecD[0], pVecD[1], pVecD[2], - pVecV0Tr[0], pVecV0Tr[1], pVecV0Tr[2], - invMassReso, - invMassD - invMassD0, - invMassV0Tr, - signReso, - isWrongSign); - rowCandidateResoIndicesDstarTrks(collision.globalIndex(), candD.globalIndex(), candV0Tr.globalIndex()); - registry.fill(HIST("hMassResoVsPt"), invMassReso, ptReso); - registry.fill(HIST("hMassDmesDauVsPt"), invMassD, candD.pt()); - registry.fill(HIST("hMassV0DauVsPt"), invMassV0Tr, candV0Tr.pt()); + int numFills = (cfgTrackRotation.enable) ? cfgTrackRotation.numRotations : 1; // number of times we fil the tables: default 1, but more in case of track rotation + + for (int iFill{0}; iFill < numFills; ++iFill) { + + std::array pVecV0Tr = candV0Tr.pVector(); + if (cfgTrackRotation.enable) { // let's rotate + float bkgRotAngle = cfgTrackRotation.minRotAngleMultByPi * constants::math::PI + bkgRotationAngleStep * iFill; + pVecV0Tr = std::array{candV0Tr.px() * std::cos(bkgRotAngle) - candV0Tr.py() * std::sin(bkgRotAngle), candV0Tr.px() * std::sin(bkgRotAngle) + candV0Tr.py() * std::cos(bkgRotAngle), candV0Tr.pz()}; } - } else if constexpr (dType == DType::D0) { - // D0 - if (TESTBIT(selectionFlag, D0Sel::selectedD0)) { - invMassD = candD.invMassD0(); + + float invMassReso{-1}, invMassV0Tr{-1}, invMassD{-1}; + int8_t signReso{0}, isWrongSign{0}; + double ptReso = RecoDecay::pt(RecoDecay::sumOfVec(pVecV0Tr, pVecD)); + + if constexpr (dType == DType::Dplus) { + invMassD = candD.invMassDplus(); + pVectorCharmProngs.push_back(candD.pVectorProng2()); if constexpr (bachType == BachelorType::V0) { - signReso = 0; if (cfgV0Cuts.v0Type == V0Type::K0s) { // K0s invMassV0Tr = candV0Tr.invMassK0s(); + signReso = candD.sign(); if (useDeltaMass) { - invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassK0Short}) - invMassD; + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassK0Short}) - invMassD; } else { - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassD0, MassK0Short}); + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassDPlus, MassK0Short}); } } else if (cfgV0Cuts.v0Type == V0Type::Lambda) { // Lambda if (candV0Tr.v0Type() == V0Type::Lambda) { invMassV0Tr = candV0Tr.invMassLambda(); + signReso = candD.sign(); } else if (candV0Tr.v0Type() == V0Type::AntiLambda) { invMassV0Tr = candV0Tr.invMassAntiLambda(); + signReso = candD.sign(); isWrongSign = 1; } if (useDeltaMass) { - invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassLambda}) - invMassD; + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassLambda}) - invMassD; } else { - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassD0, MassLambda}); + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassDPlus, MassLambda}); } } rowCandidateReso(pVecD[0], pVecD[1], pVecD[2], @@ -554,33 +399,33 @@ struct HfCandidateCreatorCharmResoReduced { invMassV0Tr, signReso, isWrongSign); - rowCandidateResoIndices2PrV0s(collision.globalIndex(), candD.globalIndex(), candV0Tr.globalIndex()); + rowCandidateResoIndices3PrV0s(collision.globalIndex(), candD.globalIndex(), candV0Tr.globalIndex()); registry.fill(HIST("hMassResoVsPt"), invMassReso, ptReso); registry.fill(HIST("hMassDmesDauVsPt"), invMassD, candD.pt()); registry.fill(HIST("hMassV0DauVsPt"), invMassV0Tr, candV0Tr.pt()); } else if constexpr (bachType == BachelorType::Track) { - signReso = candV0Tr.sign(); - isWrongSign = candV0Tr.sign() > 0 ? 0 : 1; + signReso = candD.sign() + candV0Tr.sign(); + isWrongSign = candD.sign() * candV0Tr.sign() > 0 ? 1 : 0; if (cfgTrackCuts.massHypo == TrackType::Pion) { // Pion invMassV0Tr = MassPiPlus; if (useDeltaMass) { - invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus}) - invMassD; + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassPiPlus}) - invMassD; } else { - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassD0, MassPiPlus}); + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassDPlus, MassPiPlus}); } } else if (cfgTrackCuts.massHypo == TrackType::Kaon) { // Kaon invMassV0Tr = MassKPlus; if (useDeltaMass) { - invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassKPlus}) - invMassD; + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassKPlus}) - invMassD; } else { - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassD0, MassKPlus}); + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassDPlus, MassKPlus}); } } else if (cfgTrackCuts.massHypo == TrackType::Proton) { // Proton invMassV0Tr = MassProton; if (useDeltaMass) { - invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassProton}) - invMassD; + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassProton}) - invMassD; } else { - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassD0, MassProton}); + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassDPlus, MassProton}); } } rowCandidateReso(pVecD[0], pVecD[1], pVecD[2], @@ -590,85 +435,260 @@ struct HfCandidateCreatorCharmResoReduced { invMassV0Tr, signReso, isWrongSign); - rowCandidateResoIndices2PrTrks(collision.globalIndex(), candD.globalIndex(), candV0Tr.globalIndex()); + rowCandidateResoIndices3PrTrks(collision.globalIndex(), candD.globalIndex(), candV0Tr.globalIndex()); registry.fill(HIST("hMassResoVsPt"), invMassReso, ptReso); registry.fill(HIST("hMassDmesDauVsPt"), invMassD, candD.pt()); registry.fill(HIST("hMassV0DauVsPt"), invMassV0Tr, candV0Tr.pt()); } - } - // D0bar - if (TESTBIT(selectionFlag, D0Sel::selectedD0Bar)) { - invMassD = candD.invMassD0Bar(); + } else if constexpr (dType == DType::Dstar) { + float invMassD0; + if (candD.sign() > 0) { + invMassD = candD.invMassDstar(); + invMassD0 = candD.invMassD0(); + } else { + invMassD = candD.invMassAntiDstar(); + invMassD0 = candD.invMassD0Bar(); + } + pVectorCharmProngs.push_back(candD.pVectorProng2()); if constexpr (bachType == BachelorType::V0) { - signReso = 0; + signReso = candD.sign(); if (cfgV0Cuts.v0Type == V0Type::K0s) { // K0s invMassV0Tr = candV0Tr.invMassK0s(); if (useDeltaMass) { - invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVecV0Tr}, std::array{MassKPlus, MassPiPlus, MassK0Short}) - invMassD; + if (candD.sign() > 0) { + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassK0Short}) - invMassD; + } else { + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[1], pVectorCharmProngs[0], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassK0Short}) - invMassD; + } } else { - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassD0Bar, MassK0Short}); + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassDStar, MassK0Short}); } } else if (cfgV0Cuts.v0Type == V0Type::Lambda) { // Lambda if (candV0Tr.v0Type() == V0Type::Lambda) { invMassV0Tr = candV0Tr.invMassLambda(); - isWrongSign = 1; } else if (candV0Tr.v0Type() == V0Type::AntiLambda) { invMassV0Tr = candV0Tr.invMassAntiLambda(); + isWrongSign = 1; } if (useDeltaMass) { - invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVecV0Tr}, std::array{MassKPlus, MassPiPlus, MassLambda}) - invMassD; + if (candD.sign() > 0) { + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassLambda}) - invMassD; + } else { + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[1], pVectorCharmProngs[0], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassLambda}) - invMassD; + } } else { - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassD0Bar, MassLambda}); + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassDStar, MassLambda}); } } rowCandidateReso(pVecD[0], pVecD[1], pVecD[2], pVecV0Tr[0], pVecV0Tr[1], pVecV0Tr[2], invMassReso, - invMassD, + invMassD - invMassD0, invMassV0Tr, signReso, isWrongSign); - rowCandidateResoIndices2PrV0s(collision.globalIndex(), candD.globalIndex(), candV0Tr.globalIndex()); + rowCandidateResoIndicesDstarV0s(collision.globalIndex(), candD.globalIndex(), candV0Tr.globalIndex()); registry.fill(HIST("hMassResoVsPt"), invMassReso, ptReso); - registry.fill(HIST("hMassDmesDauVsPt"), invMassD, candD.pt()); + registry.fill(HIST("hMassDmesDauVsPt"), invMassD - invMassD0, candD.pt()); registry.fill(HIST("hMassV0DauVsPt"), invMassV0Tr, candV0Tr.pt()); } else if constexpr (bachType == BachelorType::Track) { - signReso = candV0Tr.sign(); - isWrongSign = candV0Tr.sign() > 0 ? 1 : 0; + signReso = candD.sign() + candV0Tr.sign(); + isWrongSign = candD.sign() * candV0Tr.sign() > 0 ? 1 : 0; if (cfgTrackCuts.massHypo == TrackType::Pion) { // Pion invMassV0Tr = MassPiPlus; if (useDeltaMass) { - invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVecV0Tr}, std::array{MassKPlus, MassPiPlus, MassPiPlus}) - invMassD; + if (candD.sign() > 0) { + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassPiPlus}) - invMassD; + } else { + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[1], pVectorCharmProngs[0], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassPiPlus}) - invMassD; + } } else { - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassD0Bar, MassPiPlus}); + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassDStar, MassPiPlus}); } } else if (cfgTrackCuts.massHypo == TrackType::Kaon) { // Kaon invMassV0Tr = MassKPlus; if (useDeltaMass) { - invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVecV0Tr}, std::array{MassKPlus, MassPiPlus, MassKPlus}) - invMassD; + if (candD.sign() > 0) { + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassKPlus}) - invMassD; + } else { + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[1], pVectorCharmProngs[0], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassKPlus}) - invMassD; + } } else { - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassD0Bar, MassKPlus}); + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassDStar, MassKPlus}); } } else if (cfgTrackCuts.massHypo == TrackType::Proton) { // Proton invMassV0Tr = MassProton; if (useDeltaMass) { - invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVecV0Tr}, std::array{MassKPlus, MassPiPlus, MassProton}) - invMassD; + if (candD.sign() > 0) { + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassProton}) - invMassD; + } else { + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[1], pVectorCharmProngs[0], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassProton}) - invMassD; + } } else { - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassD0Bar, MassProton}); + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassDStar, MassProton}); } } rowCandidateReso(pVecD[0], pVecD[1], pVecD[2], pVecV0Tr[0], pVecV0Tr[1], pVecV0Tr[2], invMassReso, - invMassD, + invMassD - invMassD0, invMassV0Tr, signReso, isWrongSign); - rowCandidateResoIndices2PrTrks(collision.globalIndex(), candD.globalIndex(), candV0Tr.globalIndex()); + rowCandidateResoIndicesDstarTrks(collision.globalIndex(), candD.globalIndex(), candV0Tr.globalIndex()); registry.fill(HIST("hMassResoVsPt"), invMassReso, ptReso); registry.fill(HIST("hMassDmesDauVsPt"), invMassD, candD.pt()); registry.fill(HIST("hMassV0DauVsPt"), invMassV0Tr, candV0Tr.pt()); } + } else if constexpr (dType == DType::D0) { + // D0 + if (TESTBIT(selectionFlag, D0Sel::selectedD0)) { + invMassD = candD.invMassD0(); + if constexpr (bachType == BachelorType::V0) { + signReso = 0; + if (cfgV0Cuts.v0Type == V0Type::K0s) { // K0s + invMassV0Tr = candV0Tr.invMassK0s(); + if (useDeltaMass) { + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassK0Short}) - invMassD; + } else { + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassD0, MassK0Short}); + } + } else if (cfgV0Cuts.v0Type == V0Type::Lambda) { // Lambda + if (candV0Tr.v0Type() == V0Type::Lambda) { + invMassV0Tr = candV0Tr.invMassLambda(); + } else if (candV0Tr.v0Type() == V0Type::AntiLambda) { + invMassV0Tr = candV0Tr.invMassAntiLambda(); + isWrongSign = 1; + } + if (useDeltaMass) { + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassLambda}) - invMassD; + } else { + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassD0, MassLambda}); + } + } + rowCandidateReso(pVecD[0], pVecD[1], pVecD[2], + pVecV0Tr[0], pVecV0Tr[1], pVecV0Tr[2], + invMassReso, + invMassD, + invMassV0Tr, + signReso, + isWrongSign); + rowCandidateResoIndices2PrV0s(collision.globalIndex(), candD.globalIndex(), candV0Tr.globalIndex()); + registry.fill(HIST("hMassResoVsPt"), invMassReso, ptReso); + registry.fill(HIST("hMassDmesDauVsPt"), invMassD, candD.pt()); + registry.fill(HIST("hMassV0DauVsPt"), invMassV0Tr, candV0Tr.pt()); + } else if constexpr (bachType == BachelorType::Track) { + signReso = candV0Tr.sign(); + isWrongSign = candV0Tr.sign() > 0 ? 0 : 1; + if (cfgTrackCuts.massHypo == TrackType::Pion) { // Pion + invMassV0Tr = MassPiPlus; + if (useDeltaMass) { + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus}) - invMassD; + } else { + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassD0, MassPiPlus}); + } + } else if (cfgTrackCuts.massHypo == TrackType::Kaon) { // Kaon + invMassV0Tr = MassKPlus; + if (useDeltaMass) { + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassKPlus}) - invMassD; + } else { + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassD0, MassKPlus}); + } + } else if (cfgTrackCuts.massHypo == TrackType::Proton) { // Proton + invMassV0Tr = MassProton; + if (useDeltaMass) { + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassProton}) - invMassD; + } else { + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassD0, MassProton}); + } + } + rowCandidateReso(pVecD[0], pVecD[1], pVecD[2], + pVecV0Tr[0], pVecV0Tr[1], pVecV0Tr[2], + invMassReso, + invMassD, + invMassV0Tr, + signReso, + isWrongSign); + rowCandidateResoIndices2PrTrks(collision.globalIndex(), candD.globalIndex(), candV0Tr.globalIndex()); + registry.fill(HIST("hMassResoVsPt"), invMassReso, ptReso); + registry.fill(HIST("hMassDmesDauVsPt"), invMassD, candD.pt()); + registry.fill(HIST("hMassV0DauVsPt"), invMassV0Tr, candV0Tr.pt()); + } + } + // D0bar + if (TESTBIT(selectionFlag, D0Sel::selectedD0Bar)) { + invMassD = candD.invMassD0Bar(); + if constexpr (bachType == BachelorType::V0) { + signReso = 0; + if (cfgV0Cuts.v0Type == V0Type::K0s) { // K0s + invMassV0Tr = candV0Tr.invMassK0s(); + if (useDeltaMass) { + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVecV0Tr}, std::array{MassKPlus, MassPiPlus, MassK0Short}) - invMassD; + } else { + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassD0Bar, MassK0Short}); + } + } else if (cfgV0Cuts.v0Type == V0Type::Lambda) { // Lambda + if (candV0Tr.v0Type() == V0Type::Lambda) { + invMassV0Tr = candV0Tr.invMassLambda(); + isWrongSign = 1; + } else if (candV0Tr.v0Type() == V0Type::AntiLambda) { + invMassV0Tr = candV0Tr.invMassAntiLambda(); + } + if (useDeltaMass) { + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVecV0Tr}, std::array{MassKPlus, MassPiPlus, MassLambda}) - invMassD; + } else { + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassD0Bar, MassLambda}); + } + } + rowCandidateReso(pVecD[0], pVecD[1], pVecD[2], + pVecV0Tr[0], pVecV0Tr[1], pVecV0Tr[2], + invMassReso, + invMassD, + invMassV0Tr, + signReso, + isWrongSign); + rowCandidateResoIndices2PrV0s(collision.globalIndex(), candD.globalIndex(), candV0Tr.globalIndex()); + registry.fill(HIST("hMassResoVsPt"), invMassReso, ptReso); + registry.fill(HIST("hMassDmesDauVsPt"), invMassD, candD.pt()); + registry.fill(HIST("hMassV0DauVsPt"), invMassV0Tr, candV0Tr.pt()); + } else if constexpr (bachType == BachelorType::Track) { + signReso = candV0Tr.sign(); + isWrongSign = candV0Tr.sign() > 0 ? 1 : 0; + if (cfgTrackCuts.massHypo == TrackType::Pion) { // Pion + invMassV0Tr = MassPiPlus; + if (useDeltaMass) { + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVecV0Tr}, std::array{MassKPlus, MassPiPlus, MassPiPlus}) - invMassD; + } else { + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassD0Bar, MassPiPlus}); + } + } else if (cfgTrackCuts.massHypo == TrackType::Kaon) { // Kaon + invMassV0Tr = MassKPlus; + if (useDeltaMass) { + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVecV0Tr}, std::array{MassKPlus, MassPiPlus, MassKPlus}) - invMassD; + } else { + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassD0Bar, MassKPlus}); + } + } else if (cfgTrackCuts.massHypo == TrackType::Proton) { // Proton + invMassV0Tr = MassProton; + if (useDeltaMass) { + invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVecV0Tr}, std::array{MassKPlus, MassPiPlus, MassProton}) - invMassD; + } else { + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassD0Bar, MassProton}); + } + } + rowCandidateReso(pVecD[0], pVecD[1], pVecD[2], + pVecV0Tr[0], pVecV0Tr[1], pVecV0Tr[2], + invMassReso, + invMassD, + invMassV0Tr, + signReso, + isWrongSign); + rowCandidateResoIndices2PrTrks(collision.globalIndex(), candD.globalIndex(), candV0Tr.globalIndex()); + registry.fill(HIST("hMassResoVsPt"), invMassReso, ptReso); + registry.fill(HIST("hMassDmesDauVsPt"), invMassD, candD.pt()); + registry.fill(HIST("hMassV0DauVsPt"), invMassV0Tr, candV0Tr.pt()); + } + } } } } From e6b911e80c0c33b75d3b113b0449e750a9d4da7a Mon Sep 17 00:00:00 2001 From: GijsvWeelden <55794847+GijsvWeelden@users.noreply.github.com> Date: Sat, 30 Aug 2025 09:58:16 +0200 Subject: [PATCH 243/986] [PWGLF] V0 Selector (#12790) --- PWGLF/TableProducer/Strangeness/v0selector.cxx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/v0selector.cxx b/PWGLF/TableProducer/Strangeness/v0selector.cxx index 7d06871d78c..1d5d392b358 100644 --- a/PWGLF/TableProducer/Strangeness/v0selector.cxx +++ b/PWGLF/TableProducer/Strangeness/v0selector.cxx @@ -36,6 +36,10 @@ using namespace o2::framework::expressions; struct V0SelectorTask { Produces v0FlagTable; + Configurable selectK0S{"selectK0S", true, "Check V0s for K0S cuts"}; + Configurable selectLambda{"selectLambda", true, "Check V0s for Lambda cuts"}; + Configurable selectAntiLambda{"selectAntiLambda", true, "Check V0s for AntiLambda cuts"}; + Configurable> K0SPtBins{"K0SPtBins", {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 10.0, 15.0, 20.0, 25.0, 30.0}, "K0S pt Vals"}; Configurable> K0SRminVals{"K0SRminVals", {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}, "K0S min R values"}; Configurable> K0SRmaxVals{"K0SRmaxVals", {40.0, 40.0, 40.0, 40.0, 40.0, 40.0, 40.0, 40.0, 40.0, 40.0}, "K0S max R values"}; @@ -85,7 +89,7 @@ struct V0SelectorTask { Configurable> AntiLambdaMassLowVals{"AntiLambdaMassLowVals", {1.08, 1.08, 1.08, 1.08, 1.08, 1.08, 1.08, 1.08}, "AntiLambda mass cut lower values (MeV)"}; Configurable> AntiLambdaMassHighVals{"AntiLambdaMassHighVals", {1.125, 1.125, 1.125, 1.125, 1.125, 1.125, 1.125, 1.125}, "AntiLambda mass cut upper values (MeV)"}; - Configurable randomSelection{"randomSelection", true, "Randomly select V0s"}; + Configurable randomSelection{"randomSelection", false, "Randomly select V0s"}; Configurable> K0SFraction{"K0SFraction", {2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0}, "Fraction of K0S to randomly select"}; Configurable> LambdaFraction{"LambdaFraction", {2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0}, "Fraction of Lambda to randomly select"}; Configurable> AntiLambdaFraction{"AntiLambdaFraction", {2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0}, "Fraction of AntiLambda to randomly select"}; @@ -277,13 +281,16 @@ struct V0SelectorTask { { for (const auto& v0 : v0s) { uint8_t flag = 0; - flag += K0SCuts(collision, v0) * aod::v0flags::FK0S; - flag += LambdaCuts(collision, v0) * aod::v0flags::FLAMBDA; - flag += AntiLambdaCuts(collision, v0) * aod::v0flags::FANTILAMBDA; + if (selectK0S) + flag += K0SCuts(collision, v0) * aod::v0flags::FK0S; + if (selectLambda) + flag += LambdaCuts(collision, v0) * aod::v0flags::FLAMBDA; + if (selectAntiLambda) + flag += AntiLambdaCuts(collision, v0) * aod::v0flags::FANTILAMBDA; if (flag == 0) flag += aod::v0flags::FREJECTED; - else + else if (randomSelection) flag += RandomlyReject(v0, flag) * aod::v0flags::FREJECTED; v0FlagTable(flag); From 1af1f0f7e01f3461cca598f6f9fdae74e47cc9d7 Mon Sep 17 00:00:00 2001 From: nkaratze Date: Sat, 30 Aug 2025 14:16:55 +0200 Subject: [PATCH 244/986] [PWGLF] v0ptinmass plots task fixed faulty logic (#12791) Co-authored-by: nkaratze --- PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx | 26 +++++++++----------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx b/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx index d91e8ae5f49..367b4e2f9b3 100644 --- a/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx +++ b/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx @@ -91,7 +91,7 @@ struct V0PtInvMassPlots { // Configurables switches for v0 selection Configurable doRapidityCut{"doRapidityCut", true, "Enable rapidity v0 selection"}; Configurable doDaughterPseudorapidityCut{"doDaughterPseudorapidityCut", true, "Enable Daughter pseudorapidity v0 selection"}; - Configurable doisITSAfterburner{"doisITSAfterburner", true, "Enable ITS Afterburner"}; + Configurable doisNotITSAfterburner{"doisNotITSAfterburner", true, "Enable Tracks do not come from Afterburner"}; Configurable doitsMinHits{"doitsMinHits", true, "Enable ITS Minimum hits"}; // Configurables switches for K0sh selection @@ -228,7 +228,6 @@ struct V0PtInvMassPlots { rPtAnalysis.add("hNK0sh", "hNK0sh", {HistType::kTH1D, {{11, 0.f, 11.f}}}); rPtAnalysis.add("hNLambda", "hNLambda", {HistType::kTH1D, {{11, 0.f, 11.f}}}); rPtAnalysis.add("hNAntilambda", "hNAntilambda", {HistType::kTH1D, {{11, 0.f, 11.f}}}); - rPtAnalysis.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexZAxis}}); rPtAnalysis.add("hArmenterosPodolanskiPlot", "hArmenterosPodolanskiPlot", {HistType::kTH2F, {{armenterosasymAxis}, {armenterosQtAxis}}}); rPtAnalysis.add("hV0EtaDaughters", "hV0EtaDaughters", {HistType::kTH1F, {{nBins, -1.2f, 1.2f}}}); @@ -334,47 +333,47 @@ struct V0PtInvMassPlots { { rPtAnalysis.fill(HIST("hNEvents"), 0.5); rPtAnalysis.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(1, "All"); - if (!(collision.sel8() && dosel8)) { + if (dosel8 && !collision.sel8()) { return false; } rPtAnalysis.fill(HIST("hNEvents"), 1.5); rPtAnalysis.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(2, "sel 8"); - if (!(doNoTimeFrameBorder && collision.selection_bit(aod::evsel::kNoTimeFrameBorder))) { + if (doNoTimeFrameBorder && collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { return false; } rPtAnalysis.fill(HIST("hNEvents"), 2.5); rPtAnalysis.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(3, "NoTimeFrameBorder"); - if (!(doNoITSROFrameBorder && collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { + if (doNoITSROFrameBorder && collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { return false; } rPtAnalysis.fill(HIST("hNEvents"), 3.5); rPtAnalysis.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(4, "NoITSROFrameBorder"); - if (!(doIsTriggerTVX && collision.selection_bit(aod::evsel::kIsTriggerTVX))) { + if (doIsTriggerTVX && collision.selection_bit(aod::evsel::kIsTriggerTVX)) { return false; } rPtAnalysis.fill(HIST("hNEvents"), 4.5); rPtAnalysis.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(5, "IsTriggerTVX"); - if (!(docutZVertex && std::abs(collision.posZ()) < cutZVertex)) { + if (docutZVertex && std::abs(collision.posZ()) < cutZVertex) { return false; } rPtAnalysis.fill(HIST("hNEvents"), 5.5); rPtAnalysis.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(6, "cutZVertex"); - if (!(doIsVertexTOFmatched && collision.selection_bit(aod::evsel::kIsVertexTOFmatched))) { + if (doIsVertexTOFmatched && !collision.selection_bit(aod::evsel::kIsVertexTOFmatched)) { return false; } rPtAnalysis.fill(HIST("hNEvents"), 6.5); rPtAnalysis.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(7, "IsVertexTOFmatched"); - if (!(doNoSameBunchPileup && collision.selection_bit(aod::evsel::kNoSameBunchPileup))) { + if (doNoSameBunchPileup && collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { return false; } rPtAnalysis.fill(HIST("hNEvents"), 7.5); rPtAnalysis.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(8, "NoSameBunchPileup"); - if (!(doIsVertexITSTPC && collision.selection_bit(aod::evsel::kIsVertexITSTPC))) { + if (doIsVertexITSTPC && collision.selection_bit(aod::evsel::kIsVertexITSTPC)) { return false; } rPtAnalysis.fill(HIST("hNEvents"), 8.5); rPtAnalysis.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(9, "IsVertexITSTPC"); - if (!(doisInelGt0 && collision.isInelGt0())) { + if (doisInelGt0 && collision.isInelGt0()) { return false; } rPtAnalysis.fill(HIST("hNEvents"), 9.5); @@ -399,7 +398,7 @@ struct V0PtInvMassPlots { } rPtAnalysis.fill(HIST("hNV0s"), 1.5); rPtAnalysis.get(HIST("hNV0s"))->GetXaxis()->SetBinLabel(2, "Dau Pseudorapidity"); - if (!doisITSAfterburner && (posDaughterTrack.isITSAfterburner() || negDaughterTrack.isITSAfterburner())) { // ITS After Burner on daughter tracks + if (doisNotITSAfterburner && (posDaughterTrack.isITSAfterburner() || negDaughterTrack.isITSAfterburner())) { // ITS After Burner on daughter tracks return false; } rPtAnalysis.fill(HIST("hNV0s"), 2.5); @@ -411,6 +410,7 @@ struct V0PtInvMassPlots { // Cut Plots rPtAnalysis.fill(HIST("hV0EtaDaughters"), v0.template posTrack_as().eta()); rPtAnalysis.fill(HIST("hV0EtaDaughters"), v0.template negTrack_as().eta()); + rPtAnalysis.fill(HIST("hArmenterosPodolanskiPlot"), v0.alpha(), v0.qtarm()); } return true; } @@ -793,7 +793,6 @@ struct V0PtInvMassPlots { if (!acceptV0(v0)) { // V0 Selections continue; } - rPtAnalysis.fill(HIST("hArmenterosPodolanskiPlot"), v0.alpha(), v0.qtarm()); // kzero analysis if (kzeroAnalysis == true) { if (v0mcParticle.pdgCode() == kK0Short) { // kzero matched @@ -918,7 +917,6 @@ struct V0PtInvMassPlots { if (!acceptV0(v0)) { // V0 Selection continue; } - rPtAnalysis.fill(HIST("hArmenterosPodolanskiPlot"), v0.alpha(), v0.qtarm()); // kzero analysis if (kzeroAnalysis == true) { if (!acceptK0sh(v0)) { // K0sh Selection From 6c9e716b2565377b42140660da688f9b25ec0260 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sat, 30 Aug 2025 18:54:35 +0200 Subject: [PATCH 245/986] [Infrastructure] Update CODEOWNERS in MM/Lumi (#12795) --- CODEOWNERS | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index ec7e9f11b77..5569cdb9817 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -52,11 +52,11 @@ /PWGLF/TableProducer/Strangeness @alibuild @sustripathy @skundu692 @ercolessi @romainschotter /PWGLF/Utils @alibuild @sustripathy @skundu692 @gbencedi @abmodak @fmazzasc @maciacco @dmallick2 @smaff92 @ercolessi @romainschotter -# PWG-MM +# PWG-MM (fused with LF, LF conveners included. Directories to be merged in the future) /PWGMM @alibuild @sustripathy @skundu692 @aalkin @jgcn /PWGMM/Mult @alibuild @sustripathy @skundu692 @aalkin @aortizve @ddobrigk @gbencedi @jgcn -/PWGMM/Lumi @alibuild @aalkin @jgcn -/PWGMM/UE @alibuild @aalkin @aortizve @jgcn +/PWGMM/Lumi @alibuild @sustripathy @skundu692 @aalkin @jgcn @gbencedi @abmodak +/PWGMM/UE @alibuild @sustripathy @skundu692 @aalkin @aortizve @jgcn /PWGUD @alibuild @pbuehler @nystrand @rolavick /PWGJE @alibuild @lhavener @maoyx @nzardosh @fjonasALICE @mfasDa @mhemmer-cern From d97530214c9250fc2a8e5ccc1fea8188f2c7420d Mon Sep 17 00:00:00 2001 From: Victor Gonzalez Date: Sat, 30 Aug 2025 22:31:04 +0200 Subject: [PATCH 246/986] [PWGCF] DptDpt - Proper handling of new event selection at Gen level (#12796) Co-authored-by: Victor --- PWGCF/TableProducer/dptDptFilter.cxx | 34 +++++++++++++-------- PWGCF/TableProducer/dptDptFilter.h | 44 ++++++++++++++++------------ 2 files changed, 47 insertions(+), 31 deletions(-) diff --git a/PWGCF/TableProducer/dptDptFilter.cxx b/PWGCF/TableProducer/dptDptFilter.cxx index 0aab214d083..a07876a8edb 100644 --- a/PWGCF/TableProducer/dptDptFilter.cxx +++ b/PWGCF/TableProducer/dptDptFilter.cxx @@ -539,6 +539,7 @@ struct DptDptFilter { Produces gencollisionsinfo; Multiplicity multiplicity; + Preslice perCollision = aod::track::collisionId; void init(InitContext const&) { @@ -737,29 +738,33 @@ struct DptDptFilter { template bool processGenerated(CollisionObject const& mccollision, ParticlesList const& mcparticles, float centormult); - template + template void processGeneratorLevel(aod::McCollision const& mccollision, CollisionsGroup const& collisions, aod::McParticles const& mcparticles, AllCollisions const& allcollisions, + AllTracks const& alltracks, float defaultcent); void processWithCentGeneratorLevel(aod::McCollision const& mccollision, soa::SmallGroups> const& collisions, aod::McParticles const& mcparticles, - aod::CollisionsEvSelCent const& allcollisions); + aod::CollisionsEvSelCent const& allcollisions, + DptDptFullTracksDetLevel const& alltracks); PROCESS_SWITCH(DptDptFilter, processWithCentGeneratorLevel, "Process generated with centrality", false); void processWithRun2CentGeneratorLevel(aod::McCollision const& mccollision, soa::SmallGroups> const& collisions, aod::McParticles const& mcparticles, - aod::CollisionsEvSelRun2Cent const& allcollisions); + aod::CollisionsEvSelRun2Cent const& allcollisions, + DptDptFullTracksDetLevel const& alltracks); PROCESS_SWITCH(DptDptFilter, processWithRun2CentGeneratorLevel, "Process generated with centrality", false); void processWithoutCentGeneratorLevel(aod::McCollision const& mccollision, soa::SmallGroups> const& collisions, aod::McParticles const& mcparticles, - aod::CollisionsEvSel const& allcollisions); + aod::CollisionsEvSel const& allcollisions, + DptDptFullTracksDetLevel const& alltracks); PROCESS_SWITCH(DptDptFilter, processWithoutCentGeneratorLevel, "Process generated without centrality", false); void processOnTheFlyGeneratorLevel(aod::McCollision const& mccollision, @@ -908,11 +913,12 @@ bool DptDptFilter::processGenerated(CollisionObject const& mccollision, Particle return static_cast(acceptedevent); } -template +template void DptDptFilter::processGeneratorLevel(aod::McCollision const& mccollision, CollisionsGroup const& collisions, aod::McParticles const& mcparticles, AllCollisions const& allcollisions, + AllTracks const& alltracks, float defaultcent) { using namespace dptdptfilter; @@ -928,6 +934,8 @@ void DptDptFilter::processGeneratorLevel(aod::McCollision const& mccollision, if (tmpcollision.has_mcCollision()) { if (tmpcollision.mcCollisionId() == mccollision.globalIndex()) { typename AllCollisions::iterator const& collision = allcollisions.iteratorAt(tmpcollision.globalIndex()); + auto collisionTracks = alltracks.sliceBy(perCollision, collision.globalIndex()); + storeMultiplicitiesAndCentralities(collision, collisionTracks); if (isEventSelected(collision, defaultcent)) { if (processGenerated(mccollision, mcparticles, defaultcent)) { fhTrueVertexZAA->Fill((mccollision.posZ())); @@ -946,25 +954,28 @@ void DptDptFilter::processGeneratorLevel(aod::McCollision const& mccollision, void DptDptFilter::processWithCentGeneratorLevel(aod::McCollision const& mccollision, soa::SmallGroups> const& collisions, aod::McParticles const& mcparticles, - aod::CollisionsEvSelCent const& allcollisions) + aod::CollisionsEvSelCent const& allcollisions, + DptDptFullTracksDetLevel const& alltracks) { - processGeneratorLevel(mccollision, collisions, mcparticles, allcollisions, 50.0); + processGeneratorLevel(mccollision, collisions, mcparticles, allcollisions, alltracks, 50.0); } void DptDptFilter::processWithRun2CentGeneratorLevel(aod::McCollision const& mccollision, soa::SmallGroups> const& collisions, aod::McParticles const& mcparticles, - aod::CollisionsEvSelRun2Cent const& allcollisions) + aod::CollisionsEvSelRun2Cent const& allcollisions, + DptDptFullTracksDetLevel const& alltracks) { - processGeneratorLevel(mccollision, collisions, mcparticles, allcollisions, 50.0); + processGeneratorLevel(mccollision, collisions, mcparticles, allcollisions, alltracks, 50.0); } void DptDptFilter::processWithoutCentGeneratorLevel(aod::McCollision const& mccollision, soa::SmallGroups> const& collisions, aod::McParticles const& mcparticles, - aod::CollisionsEvSel const& allcollisions) + aod::CollisionsEvSel const& allcollisions, + DptDptFullTracksDetLevel const& alltracks) { - processGeneratorLevel(mccollision, collisions, mcparticles, allcollisions, 50.0); + processGeneratorLevel(mccollision, collisions, mcparticles, allcollisions, alltracks, 50.0); } void DptDptFilter::processOnTheFlyGeneratorLevel(aod::McCollision const& mccollision, @@ -1016,7 +1027,6 @@ T computeRMS(std::vector& vec) } struct DptDptFilterTracks { - Produces scannedtracks; Produces tracksinfo; Produces scannedgentracks; diff --git a/PWGCF/TableProducer/dptDptFilter.h b/PWGCF/TableProducer/dptDptFilter.h index d79924724f2..e883e6bfdfe 100644 --- a/PWGCF/TableProducer/dptDptFilter.h +++ b/PWGCF/TableProducer/dptDptFilter.h @@ -1287,17 +1287,21 @@ inline bool centralitySelection(aod::McCollision const&, float /// @brief evalues the exclusion formula for the current multiplicity / centrality parameters /// @return true if the collision is not excluded according to the formula false otherwise /// WARNING: it has always to be called after filling the multiplicity / centrality observables +/// NOTE: for MC generator level does nothing, as expected +template inline bool isCollisionNotExcluded() { bool notExcluded = true; - if (useCentralityMultiplicityCorrelationsExclusion) { - [&]() { - /* set the formula parameter values */ - for (size_t iPar = 0; iPar < observableIndexForCentralityMultiplicityParameter.size(); ++iPar) { - multiplicityCentralityCorrelationsExclusion->SetParameter(iPar, collisionMultiplicityCentralityObservables[observableIndexForCentralityMultiplicityParameter[iPar]]); - } - }(); - notExcluded = multiplicityCentralityCorrelationsExclusion->Eval() != 0; + if constexpr (!framework::has_type_v) { + if (useCentralityMultiplicityCorrelationsExclusion) { + [&]() { + /* set the formula parameter values */ + for (size_t iPar = 0; iPar < observableIndexForCentralityMultiplicityParameter.size(); ++iPar) { + multiplicityCentralityCorrelationsExclusion->SetParameter(iPar, collisionMultiplicityCentralityObservables[observableIndexForCentralityMultiplicityParameter[iPar]]); + } + }(); + notExcluded = multiplicityCentralityCorrelationsExclusion->Eval() != 0; + } } collisionFlags.set(CollSelMULTCORRELATIONS, notExcluded); return notExcluded; @@ -1405,20 +1409,22 @@ inline bool isEventSelected(CollisionObject const& collision, float& centormult) bool trigsel = triggerSelection(collision); - bool rctsel = false; + /* run condition table information */ + bool rctsel = true; if (useRctInformation) { - if constexpr (framework::has_type_v) { - if (rctChecker.checkTable(collision)) { - rctsel = true; - collisionFlags.set(CollSelRCTBIT); - } + if constexpr (framework::has_type_v) { + /* RCT condition not considered for generator level */ } else { - LOGF(fatal, "RCT check required but the dataset does not have RCT information associated. Please, fix it"); + if constexpr (framework::has_type_v) { + if (!rctChecker.checkTable(collision)) { + rctsel = false; + } + } else { + LOGF(fatal, "RCT check required but the dataset does not have RCT information associated. Please, fix it"); + } } - } else { - collisionFlags.set(CollSelRCTBIT); - rctsel = true; } + collisionFlags.set(CollSelRCTBIT, rctsel); bool occupancysel = occupancySelection(collision); @@ -1439,7 +1445,7 @@ inline bool isEventSelected(CollisionObject const& collision, float& centormult) bool centmultsel = centralitySelection(collision, centormult); - bool centmultexclusion = isCollisionNotExcluded(); + bool centmultexclusion = isCollisionNotExcluded(); bool accepted = trigsel && rctsel && occupancysel && zvtxsel && centmultsel && centmultexclusion; From 15c55ca039357490773de7288fbd12dd28812e90 Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Sat, 30 Aug 2025 23:35:35 +0200 Subject: [PATCH 247/986] [PWGCF] FemtoUniverse: Add flag to choose electron rejection (#12797) --- ...sePairTaskTrackTrackSpherHarMultKtExtended.cxx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx index 8e978e81cf4..2ea687a3ed6 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx @@ -68,6 +68,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { struct : o2::framework::ConfigurableGroup { Configurable ConfNsigmaCombined{"ConfNsigmaCombined", 3.0f, "TPC and TOF Pion Sigma (combined) for momentum > ConfTOFPtMin"}; Configurable ConfNsigmaTPC{"ConfNsigmaTPC", 3.0f, "TPC Pion Sigma for momentum < ConfTOFPtMin"}; + Configurable ConfIsElReject{"ConfIsElReject", false, "Is electron rejection activated"}; Configurable ConfNsigmaTPCElReject{"ConfNsigmaTPCElReject", 2.0f, "TPC Electron Sigma for momentum < ConfTOFPtMin"}; Configurable ConfTOFPtMin{"ConfTOFPtMin", 0.5f, "Min. Pt for which TOF is required for PID."}; Configurable ConfEtaMax{"ConfEtaMax", 0.8f, "Higher limit for |Eta| (the same for both particles)"}; @@ -318,10 +319,18 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { // ConfNsigmaCombined -> TPC and TOF Pion Sigma (combined) for momentum > 0.5 if (true) { if (mom < twotracksconfigs.ConfTOFPtMin) { - if ((std::abs(nsigmaTPCPi) < twotracksconfigs.ConfNsigmaTPC) && (std::abs(nsigmaTPCElReject) > twotracksconfigs.ConfNsigmaTPCElReject)) { - return true; + if (twotracksconfigs.ConfIsElReject) { + if ((std::abs(nsigmaTPCPi) < twotracksconfigs.ConfNsigmaTPC) && (std::abs(nsigmaTPCElReject) > twotracksconfigs.ConfNsigmaTPCElReject)) { + return true; + } else { + return false; + } } else { - return false; + if ((std::abs(nsigmaTPCPi) < twotracksconfigs.ConfNsigmaTPC)) { + return true; + } else { + return false; + } } } else { if (std::hypot(nsigmaTOFPi, nsigmaTPCPi) < twotracksconfigs.ConfNsigmaCombined) { From 1ade6072f7900c84379a2bcdad81e9337269d8ea Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sun, 31 Aug 2025 00:51:50 +0200 Subject: [PATCH 248/986] [PWGEM/Dilepton] add axis for acc in generated hs (#12799) --- PWGEM/Dilepton/Core/DileptonMC.h | 227 +++++++++++++++---------------- 1 file changed, 110 insertions(+), 117 deletions(-) diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index c7c073516ec..abd188b5712 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -360,9 +360,10 @@ struct DileptonMC { const AxisSpec axis_aco{cfg_nbin_aco, 0, 1.f, "#alpha = 1 - #frac{|#varphi_{l^{+}} - #varphi_{l^{-}}|}{#pi}"}; // for kUPC const AxisSpec axis_asym_pt{cfg_nbin_asym_pt, 0, 1.f, "A = #frac{|p_{T,l^{+}} - p_{T,l^{-}}|}{|p_{T,l^{+}} + p_{T,l^{-}}|}"}; // for kUPC const AxisSpec axis_dphi_e_ee{cfg_nbin_dphi_e_ee, 0, M_PI, "#Delta#varphi = #varphi_{l} - #varphi_{ll} (rad.)"}; // for kUPC + const AxisSpec axis_isInAcc{2, -0.5, 1.5, "is in acc"}; // in acc or not (bool) // generated info - fRegistry.add("Generated/sm/PromptPi0/hs", "gen. dilepton signal", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_cs, axis_phi_cs, axis_aco, axis_asym_pt, axis_dphi_e_ee}, true); + fRegistry.add("Generated/sm/PromptPi0/hs", "generated dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_cs, axis_phi_cs, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_isInAcc}, true); fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/NonPromptPi0/"); fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/Eta/"); fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/EtaPrime/"); @@ -375,10 +376,10 @@ struct DileptonMC { fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/NonPromptJPsi/"); fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/PromptPsi2S/"); fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/NonPromptPsi2S/"); - fRegistry.add("Generated/sm/Omega2ll/hPtY", "pT of #omega meson", kTH2F, {axis_y, axis_pt_meson}, true); - fRegistry.add("Generated/sm/Phi2ll/hPtY", "pT of #phi meson", kTH2F, {axis_y, axis_pt_meson}, true); + fRegistry.add("Generated/sm/Omega2ll/hPtY", "pT of #omega meson", kTH2D, {axis_y, axis_pt_meson}, true); + fRegistry.add("Generated/sm/Phi2ll/hPtY", "pT of #phi meson", kTH2D, {axis_y, axis_pt_meson}, true); - fRegistry.add("Generated/ccbar/c2l_c2l/hadron_hadron/hs", "generated dilepton signal", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_cs, axis_phi_cs, axis_aco, axis_asym_pt, axis_dphi_e_ee}, true); + fRegistry.add("Generated/ccbar/c2l_c2l/hadron_hadron/hs", "generated dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_cs, axis_phi_cs, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_isInAcc}, true); fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", "Generated/ccbar/c2l_c2l/meson_meson/"); fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", "Generated/ccbar/c2l_c2l/baryon_baryon/"); fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", "Generated/ccbar/c2l_c2l/meson_baryon/"); @@ -1344,10 +1345,6 @@ struct DileptonMC { for (const auto& [t1, t2] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { // ULS // LOGF(info, "pdg1 = %d, pdg2 = %d", t1.pdgCode(), t2.pdgCode()); - if (!isInAcceptance(t1) || !isInAcceptance(t2)) { - continue; - } - if (!t1.isPhysicalPrimary() && !t1.producedByGenerator()) { continue; } @@ -1415,16 +1412,16 @@ struct DileptonMC { if (v12.Rapidity() < dielectroncuts.cfg_min_pair_y || dielectroncuts.cfg_max_pair_y < v12.Rapidity()) { continue; } - if (dielectroncuts.cfg_apply_detadphi && std::pow(deta / dielectroncuts.cfg_min_deta, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi, 2) < 1.f) { - continue; - } + // if (dielectroncuts.cfg_apply_detadphi && std::pow(deta / dielectroncuts.cfg_min_deta, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi, 2) < 1.f) { + // continue; + // } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { if (v12.Rapidity() < dimuoncuts.cfg_min_pair_y || dimuoncuts.cfg_max_pair_y < v12.Rapidity()) { continue; } - if (dimuoncuts.cfg_apply_detadphi && std::pow(deta / dimuoncuts.cfg_min_deta, 2) + std::pow(dphi / dimuoncuts.cfg_min_dphi, 2) < 1.f) { - continue; - } + // if (dimuoncuts.cfg_apply_detadphi && std::pow(deta / dimuoncuts.cfg_min_deta, 2) + std::pow(dphi / dimuoncuts.cfg_min_dphi, 2) < 1.f) { + // continue; + // } } float aco = 1.f - std::fabs(dphi) / M_PI; @@ -1437,6 +1434,8 @@ struct DileptonMC { o2::aod::pwgem::dilepton::utils::pairutil::getAngleCS(t1, t2, leptonM1, leptonM2, beamE1, beamE2, beamP1, beamP2, cos_thetaCS, phiCS); o2::math_utils::bringToPMPi(phiCS); + bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); + if (mother_id > -1) { auto mcmother = mcparticles.iteratorAt(mother_id); if (mcmother.isPhysicalPrimary() || mcmother.producedByGenerator()) { @@ -1444,45 +1443,45 @@ struct DileptonMC { switch (std::abs(mcmother.pdgCode())) { case 111: if (IsFromCharm(mcmother, mcparticles) < 0 && IsFromBeauty(mcmother, mcparticles) < 0) { // prompt pi0 - fRegistry.fill(HIST("Generated/sm/PromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/PromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else { // non-prompt pi0 - fRegistry.fill(HIST("Generated/sm/NonPromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/NonPromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; case 221: - fRegistry.fill(HIST("Generated/sm/Eta/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/Eta/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); break; case 331: - fRegistry.fill(HIST("Generated/sm/EtaPrime/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/EtaPrime/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); break; case 113: - fRegistry.fill(HIST("Generated/sm/Rho/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/Rho/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); break; case 223: - fRegistry.fill(HIST("Generated/sm/Omega/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/Omega/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); if (mcmother.daughtersIds().size() == 2) { // omega->ee - fRegistry.fill(HIST("Generated/sm/Omega2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/Omega2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; case 333: - fRegistry.fill(HIST("Generated/sm/Phi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/Phi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); if (mcmother.daughtersIds().size() == 2) { // phi->ee - fRegistry.fill(HIST("Generated/sm/Phi2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/Phi2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; case 443: { if (IsFromBeauty(mcmother, mcparticles) > 0) { - fRegistry.fill(HIST("Generated/sm/NonPromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/NonPromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else { - fRegistry.fill(HIST("Generated/sm/PromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/PromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; } case 100443: { if (IsFromBeauty(mcmother, mcparticles) > 0) { - fRegistry.fill(HIST("Generated/sm/NonPromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/NonPromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else { - fRegistry.fill(HIST("Generated/sm/PromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/PromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; } @@ -1495,105 +1494,105 @@ struct DileptonMC { auto mp2 = mcparticles.iteratorAt(t2.mothersIds()[0]); switch (hfee_type) { case static_cast(EM_HFeeType::kCe_Ce): { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); if (isCharmMeson(mp1) && isCharmMeson(mp2)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); if (std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 411) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dplus_Dminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dplus_Dminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if (std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 421) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_D0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_D0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if (std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 431) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dsplus_Dsminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dsplus_Dsminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 421) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 421)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_D0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_D0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 431)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 431)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } } else if (isCharmBaryon(mp1) && isCharmBaryon(mp2)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); if (std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4122) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcplus_Lcminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcplus_Lcminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if (std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4232) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicplus_Xicminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicplus_Xicminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if (std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4132) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xic0_Xic0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xic0_Xic0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if (std::abs(mp1.pdgCode()) == 4332 && std::abs(mp2.pdgCode()) == 4332) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Omegac0_Omegac0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Omegac0_Omegac0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4132 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xic0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xic0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } } else { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } } break; } case static_cast(EM_HFeeType::kBe_Be): { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); if (isBeautyMeson(mp1) && isBeautyMeson(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if (isBeautyBaryon(mp1) && isBeautyBaryon(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; } case static_cast(EM_HFeeType::kBCe_BCe): { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); if (isCharmMeson(mp1) && isCharmMeson(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if (isCharmBaryon(mp1) && isCharmBaryon(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; } case static_cast(EM_HFeeType::kBCe_Be_SameB): { // ULS - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; } @@ -1609,10 +1608,6 @@ struct DileptonMC { for (const auto& [t1, t2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { // LOGF(info, "pdg1 = %d, pdg2 = %d", t1.pdgCode(), t2.pdgCode()); - if (!isInAcceptance(t1) || !isInAcceptance(t2)) { - continue; - } - if (!t1.isPhysicalPrimary() && !t1.producedByGenerator()) { continue; } @@ -1679,27 +1674,27 @@ struct DileptonMC { if (v12.Rapidity() < dielectroncuts.cfg_min_pair_y || dielectroncuts.cfg_max_pair_y < v12.Rapidity()) { continue; } - if (dielectroncuts.cfg_apply_detadphi && std::pow(deta / dielectroncuts.cfg_min_deta, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi, 2) < 1.f) { - continue; - } + // if (dielectroncuts.cfg_apply_detadphi && std::pow(deta / dielectroncuts.cfg_min_deta, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi, 2) < 1.f) { + // continue; + // } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { if (v12.Rapidity() < dimuoncuts.cfg_min_pair_y || dimuoncuts.cfg_max_pair_y < v12.Rapidity()) { continue; } - if (dimuoncuts.cfg_apply_detadphi && std::pow(deta / dimuoncuts.cfg_min_deta, 2) + std::pow(dphi / dimuoncuts.cfg_min_dphi, 2) < 1.f) { - continue; - } + // if (dimuoncuts.cfg_apply_detadphi && std::pow(deta / dimuoncuts.cfg_min_deta, 2) + std::pow(dphi / dimuoncuts.cfg_min_dphi, 2) < 1.f) { + // continue; + // } } - if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - if (v12.Rapidity() < dielectroncuts.cfg_min_pair_y || dielectroncuts.cfg_max_pair_y < v12.Rapidity()) { - continue; - } - } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - if (v12.Rapidity() < dimuoncuts.cfg_min_pair_y || dimuoncuts.cfg_max_pair_y < v12.Rapidity()) { - continue; - } - } + // if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { + // if (v12.Rapidity() < dielectroncuts.cfg_min_pair_y || dielectroncuts.cfg_max_pair_y < v12.Rapidity()) { + // continue; + // } + // } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { + // if (v12.Rapidity() < dimuoncuts.cfg_min_pair_y || dimuoncuts.cfg_max_pair_y < v12.Rapidity()) { + // continue; + // } + // } float aco = 1.f - std::fabs(dphi) / M_PI; float asym = std::fabs(v1.Pt() - v2.Pt()) / (v1.Pt() + v2.Pt()); @@ -1710,6 +1705,7 @@ struct DileptonMC { float cos_thetaCS = 999, phiCS = 999.f; o2::aod::pwgem::dilepton::utils::pairutil::getAngleCS(t1, t2, leptonM1, leptonM2, beamE1, beamE2, beamP1, beamP2, cos_thetaCS, phiCS); o2::math_utils::bringToPMPi(phiCS); + bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); if (hfee_type > -1) { auto mp1 = mcparticles.iteratorAt(t1.mothersIds()[0]); @@ -1728,13 +1724,13 @@ struct DileptonMC { LOGF(info, "You should not see kBCe_Be_SameB in LS++. Good luck."); break; case static_cast(EM_HFeeType::kBCe_Be_DiffB): { // LS - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; } @@ -1747,10 +1743,6 @@ struct DileptonMC { for (const auto& [t1, t2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { // LOGF(info, "pdg1 = %d, pdg2 = %d", t1.pdgCode(), t2.pdgCode()); - if (!isInAcceptance(t1) || !isInAcceptance(t2)) { - continue; - } - if (!t1.isPhysicalPrimary() && !t1.producedByGenerator()) { continue; } @@ -1817,27 +1809,27 @@ struct DileptonMC { if (v12.Rapidity() < dielectroncuts.cfg_min_pair_y || dielectroncuts.cfg_max_pair_y < v12.Rapidity()) { continue; } - if (dielectroncuts.cfg_apply_detadphi && std::pow(deta / dielectroncuts.cfg_min_deta, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi, 2) < 1.f) { - continue; - } + // if (dielectroncuts.cfg_apply_detadphi && std::pow(deta / dielectroncuts.cfg_min_deta, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi, 2) < 1.f) { + // continue; + // } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { if (v12.Rapidity() < dimuoncuts.cfg_min_pair_y || dimuoncuts.cfg_max_pair_y < v12.Rapidity()) { continue; } - if (dimuoncuts.cfg_apply_detadphi && std::pow(deta / dimuoncuts.cfg_min_deta, 2) + std::pow(dphi / dimuoncuts.cfg_min_dphi, 2) < 1.f) { - continue; - } + // if (dimuoncuts.cfg_apply_detadphi && std::pow(deta / dimuoncuts.cfg_min_deta, 2) + std::pow(dphi / dimuoncuts.cfg_min_dphi, 2) < 1.f) { + // continue; + // } } - if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - if (v12.Rapidity() < dielectroncuts.cfg_min_pair_y || dielectroncuts.cfg_max_pair_y < v12.Rapidity()) { - continue; - } - } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - if (v12.Rapidity() < dimuoncuts.cfg_min_pair_y || dimuoncuts.cfg_max_pair_y < v12.Rapidity()) { - continue; - } - } + // if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { + // if (v12.Rapidity() < dielectroncuts.cfg_min_pair_y || dielectroncuts.cfg_max_pair_y < v12.Rapidity()) { + // continue; + // } + // } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { + // if (v12.Rapidity() < dimuoncuts.cfg_min_pair_y || dimuoncuts.cfg_max_pair_y < v12.Rapidity()) { + // continue; + // } + // } float aco = 1.f - std::fabs(dphi) / M_PI; float asym = std::fabs(v1.Pt() - v2.Pt()) / (v1.Pt() + v2.Pt()); @@ -1848,6 +1840,7 @@ struct DileptonMC { float cos_thetaCS = 999, phiCS = 999.f; o2::aod::pwgem::dilepton::utils::pairutil::getAngleCS(t1, t2, leptonM1, leptonM2, beamE1, beamE2, beamP1, beamP2, cos_thetaCS, phiCS); o2::math_utils::bringToPMPi(phiCS); + bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); if (hfee_type > -1) { auto mp1 = mcparticles.iteratorAt(t1.mothersIds()[0]); @@ -1866,13 +1859,13 @@ struct DileptonMC { LOGF(info, "You should not see kBCe_Be_SameB in LS--. Good luck."); break; case static_cast(EM_HFeeType::kBCe_Be_DiffB): { // LS - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; } From 700811a220631ea6839aadaba8e01e761e2cbfe0 Mon Sep 17 00:00:00 2001 From: omvazque Date: Sat, 30 Aug 2025 20:28:06 -0500 Subject: [PATCH 249/986] [PWGLF] Conditioning the number of CCDB queries (#12793) --- PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx | 22 ++++++++++-- PWGLF/Tasks/Nuspex/piKpRAA.cxx | 36 ++++++++++++++++---- 2 files changed, 49 insertions(+), 9 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx index 465b0caa8a3..078d8aff97a 100644 --- a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx @@ -221,8 +221,11 @@ struct UccZdc { bool calibrationsLoaded = false; } cfgNch; + int currentRunNumber; + void init(InitContext const&) { + currentRunNumber = -1; const char* tiT0A{"T0A (#times 1/100, 3.5 < #eta < 4.9)"}; const char* tiT0C{"T0C (#times 1/100, -3.3 < #eta < -2.1)"}; const char* tiT0M{"T0A+T0C (#times 1/100, -3.3 < #eta < -2.1 and 3.5 < #eta < 4.9)"}; @@ -423,6 +426,7 @@ struct UccZdc { LOG(info) << "\tminPt=" << minPt.value; LOG(info) << "\tmaxPt=" << maxPt.value; LOG(info) << "\tmaxPtSpectra=" << maxPtSpectra.value; + LOG(info) << "\tcurrentRunNumber= " << currentRunNumber; ccdb->setURL("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); @@ -602,7 +606,14 @@ struct UccZdc { bool skipEvent{false}; if (useMidRapNchSel) { - loadNchCalibrations(foundBC.timestamp()); + + const int nextRunNumber{foundBC.runNumber()}; + if (currentRunNumber != nextRunNumber) { + loadNchCalibrations(foundBC.timestamp()); + currentRunNumber = nextRunNumber; + LOG(info) << "\tcurrentRunNumber= " << currentRunNumber << " timeStamp = " << foundBC.timestamp(); + } + if (!(cfgNch.hMeanNch && cfgNch.hSigmaNch)) return; @@ -787,7 +798,14 @@ struct UccZdc { bool skipEvent{false}; if (useMidRapNchSel) { - loadNchCalibrations(foundBC.timestamp()); + + const int nextRunNumber{foundBC.runNumber()}; + if (currentRunNumber != nextRunNumber) { + loadNchCalibrations(foundBC.timestamp()); + currentRunNumber = nextRunNumber; + LOG(info) << "\tcurrentRunNumber= " << currentRunNumber << " timeStamp = " << foundBC.timestamp(); + } + if (!(cfgNch.hMeanNch && cfgNch.hSigmaNch)) return; diff --git a/PWGLF/Tasks/Nuspex/piKpRAA.cxx b/PWGLF/Tasks/Nuspex/piKpRAA.cxx index 7506677e038..1fb44ccd448 100644 --- a/PWGLF/Tasks/Nuspex/piKpRAA.cxx +++ b/PWGLF/Tasks/Nuspex/piKpRAA.cxx @@ -241,10 +241,12 @@ struct PiKpRAA { return selectedTracks; } - void - init(InitContext const&) + int currentRunNumberNchSel; + int currentRunNumberPhiSel; + void init(InitContext const&) { - + currentRunNumberNchSel = -1; + currentRunNumberPhiSel = -1; trkSelDaugthers = trkSelDaugthersV0s(); trkSelGlobal = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSibAny, TrackSelection::GlobalTrackRun3DCAxyCut::Default); @@ -362,6 +364,8 @@ struct PiKpRAA { LOG(info) << "\tapplyPhiCut=" << v0Selections.applyPhiCut; LOG(info) << "\tusePinPhiSelection=" << v0Selections.usePinPhiSelection; LOG(info) << "\ttitlePorPt=" << titlePorPt; + LOG(info) << "\tcurrentRunNumberNchSel=" << currentRunNumberNchSel; + LOG(info) << "\tcurrentRunNumberPhiSel=" << currentRunNumberPhiSel; ccdb->setURL("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); @@ -406,7 +410,14 @@ struct PiKpRAA { const double nPV{collision.multNTracksPVeta1() / 1.}; if (applyNchSel) { - loadNchCalibrations(timeStamp); + const int nextRunNumber{foundBC.runNumber()}; + if (currentRunNumberNchSel != nextRunNumber) { + loadNchCalibrations(timeStamp); + currentRunNumberNchSel = nextRunNumber; + LOG(info) << "\tcurrentRunNumberNchSel= " << currentRunNumberNchSel << " timeStamp = " << timeStamp; + } + + // return if Nch selection objects are nullptr if (!(cfgNch.hMeanNch && cfgNch.hSigmaNch)) return; } @@ -454,8 +465,18 @@ struct PiKpRAA { registry.fill(HIST("T0Ccent"), collision.centFT0C()); const float centrality{collision.centFT0C()}; - if (v0Selections.applyPhiCut) - loadPhiCutSelections(timeStamp); + if (v0Selections.applyPhiCut) { + const int nextRunNumber{foundBC.runNumber()}; + if (currentRunNumberPhiSel != nextRunNumber) { + loadPhiCutSelections(timeStamp); + currentRunNumberPhiSel = nextRunNumber; + LOG(info) << "\tcurrentRunNumberPhiSel= " << currentRunNumberPhiSel << " timeStamp = " << timeStamp; + } + + // return if phi cut objects are nullptr + if (!(phiCut.hPhiCutHigh && phiCut.hPhiCutLow)) + return; + } for (const auto& track : tracks) { @@ -1069,7 +1090,8 @@ struct PiKpRAA { LOGF(fatal, "Could not load hSigmaNch histogram from %s", pathSigmaNch.value.c_str()); } } - cfgNch.calibrationsLoaded = true; + if (cfgNch.hMeanNch && cfgNch.hSigmaNch) + cfgNch.calibrationsLoaded = true; } void loadPhiCutSelections(const uint64_t& timeStamp) From 8030bff45a2e44f80630f5bf418c89b74199328a Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sun, 31 Aug 2025 04:47:49 +0200 Subject: [PATCH 250/986] [PWGEM/Dilepton] update DielectronCut (#12800) --- PWGEM/Dilepton/Core/DielectronCut.cxx | 5 ----- PWGEM/Dilepton/Core/DielectronCut.h | 28 +++++++++++---------------- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/PWGEM/Dilepton/Core/DielectronCut.cxx b/PWGEM/Dilepton/Core/DielectronCut.cxx index 7f86c7babbe..5d943b77651 100644 --- a/PWGEM/Dilepton/Core/DielectronCut.cxx +++ b/PWGEM/Dilepton/Core/DielectronCut.cxx @@ -324,11 +324,6 @@ void DielectronCut::SetTOFNsigmaPrRange(float min, float max) // LOG(info) << "Dielectron Cut, set p range for ITS n sigma Pr: " << mMinP_ITSNsigmaPr << " - " << mMaxP_ITSNsigmaPr; // } -void DielectronCut::SetMaxPinMuonTPConly(float max) -{ - mMaxPinMuonTPConly = max; - LOG(info) << "Dielectron Cut, set max pin for Muon ID with TPC only: " << mMaxPinMuonTPConly; -} void DielectronCut::SetPinRangeForPionRejectionTPC(float min, float max) { mMinPinForPionRejectionTPC = min; diff --git a/PWGEM/Dilepton/Core/DielectronCut.h b/PWGEM/Dilepton/Core/DielectronCut.h index 50e6b518693..6b4930a0db1 100644 --- a/PWGEM/Dilepton/Core/DielectronCut.h +++ b/PWGEM/Dilepton/Core/DielectronCut.h @@ -65,7 +65,7 @@ class DielectronCut : public TNamed kDCAz, kITSNCls, kITSChi2NDF, - // kITSClusterSize, + kITSClusterSize, kPrefilter, kNCuts }; @@ -199,9 +199,9 @@ class DielectronCut : public TNamed return false; } - // if (!IsSelectedTrack(track, DielectronCuts::kITSClusterSize)) { - // return false; - // } + if (!IsSelectedTrack(track, DielectronCuts::kITSClusterSize)) { + return false; + } if (mRequireITSibAny) { auto hits_ib = std::count_if(its_ib_any_Requirement.second.begin(), its_ib_any_Requirement.second.end(), [&](auto&& requiredLayer) { return track.itsClusterMap() & (1 << requiredLayer); }); @@ -252,15 +252,8 @@ class DielectronCut : public TNamed } // PID cuts - if (track.hasITS() && !track.hasTPC() && !track.hasTRD() && !track.hasTOF()) { // ITSsa - float meanClusterSizeITS = track.meanClusterSizeITS() * std::cos(std::atan(track.tgl())); - if (meanClusterSizeITS < mMinMeanClusterSizeITS || mMaxMeanClusterSizeITS < meanClusterSizeITS) { - return false; - } - } else { // not ITSsa - if (!PassPID(track)) { - return false; - } + if (!PassPID(track)) { + return false; } return true; @@ -399,8 +392,8 @@ class DielectronCut : public TNamed bool is_in_phi_range = track.phi() > mMinTrackPhi && track.phi() < mMaxTrackPhi; return mRejectTrackPhi ? !is_in_phi_range : is_in_phi_range; } else { - double minTrackPhiMirror = mMinTrackPhi + TMath::Pi(); - double maxTrackPhiMirror = mMaxTrackPhi + TMath::Pi(); + float minTrackPhiMirror = mMinTrackPhi + M_PI; + float maxTrackPhiMirror = mMaxTrackPhi + M_PI; bool is_in_phi_range = (track.phi() > mMinTrackPhi && track.phi() < mMaxTrackPhi) || (track.phi() > minTrackPhiMirror && track.phi() < maxTrackPhiMirror); return mRejectTrackPhi ? !is_in_phi_range : is_in_phi_range; } @@ -438,6 +431,9 @@ class DielectronCut : public TNamed case DielectronCuts::kITSChi2NDF: return mMinChi2PerClusterITS < track.itsChi2NCl() && track.itsChi2NCl() < mMaxChi2PerClusterITS; + case DielectronCuts::kITSClusterSize: + return mMinMeanClusterSizeITS < track.meanClusterSizeITS() * std::cos(std::atan(track.tgl())) && track.meanClusterSizeITS() * std::cos(std::atan(track.tgl())) < mMaxMeanClusterSizeITS; + case DielectronCuts::kPrefilter: return track.pfb() <= 0; @@ -494,7 +490,6 @@ class DielectronCut : public TNamed // void SetPRangeForITSNsigmaKa(float min, float max); // void SetPRangeForITSNsigmaPr(float min, float max); - void SetMaxPinMuonTPConly(float max); void SetPinRangeForPionRejectionTPC(float min, float max); void RequireITSibAny(bool flag); void RequireITSib1st(bool flag); @@ -560,7 +555,6 @@ class DielectronCut : public TNamed float mMinRelDiffPin{-1e10f}, mMaxRelDiffPin{1e10f}; // max relative difference between p at TPC inner wall and p at PV int mMinNClustersITS{0}, mMaxNClustersITS{7}; // range in number of ITS clusters float mMinChi2PerClusterITS{-1e10f}, mMaxChi2PerClusterITS{1e10f}; // max its fit chi2 per ITS cluster - float mMaxPinMuonTPConly{0.2f}; // max pin cut for muon ID with TPConly float mMinPinForPionRejectionTPC{0.f}, mMaxPinForPionRejectionTPC{1e10f}; // pin range for pion rejection in TPC bool mRequireITSibAny{true}; bool mRequireITSib1st{false}; From 7eb442a6b72df72e0b1ba21d1c53d5fccce0c80a Mon Sep 17 00:00:00 2001 From: Victor Gonzalez Date: Sun, 31 Aug 2025 17:21:44 +0200 Subject: [PATCH 251/986] [PWGCF] DptDpt - Fill multiplicity histograms before outliers exclusion (#12805) Co-authored-by: Victor --- PWGCF/TableProducer/dptDptFilter.cxx | 77 +++++++++++++++++----------- PWGCF/TableProducer/dptDptFilter.h | 5 ++ PWGCF/Tasks/dptDptCorrelations.cxx | 8 +-- 3 files changed, 55 insertions(+), 35 deletions(-) diff --git a/PWGCF/TableProducer/dptDptFilter.cxx b/PWGCF/TableProducer/dptDptFilter.cxx index a07876a8edb..8dc1e100970 100644 --- a/PWGCF/TableProducer/dptDptFilter.cxx +++ b/PWGCF/TableProducer/dptDptFilter.cxx @@ -101,13 +101,14 @@ const char* speciesTitle[kDptDptNoOfSpecies] = {"", "e", "#mu", "#pi", "K", "p"} /// \enum BeforeAfter /// \brief when filling the histograms enum BeforeAfter { - BeforeAfterBEFORE = 0, ///< filling the histograms before selections - BeforeAfterAFTER, ///< filling the histograms after selections - BeforeAfterNOOFTIMES ///< how many times fill the histograms + BeforeAfterBEFORE = 0, ///< filling the histograms before selections + BeforeAfterBEFOREMULTCORR, ///< filling the histograms before outliers exclusion + BeforeAfterAFTER, ///< filling the histograms after selections + BeforeAfterNOOFTIMES ///< how many times fill the histograms }; -static const std::vector beforeAfterName = {"before", ""}; -static const std::vector beforeAfterSufix = {"B", "A"}; +static const std::vector beforeAfterName = {"before", "before outliers exclusion", ""}; +static const std::vector beforeAfterSufix = {"B", "BO", "A"}; /* helpers for the multiplicity axes definition */ static constexpr float MultiplicityUpperLimitBase[11][8] = { @@ -506,6 +507,7 @@ struct DptDptFilter { #define MULTSRCNAME(msrcid) multiplicitySourceConfigNamesMap.at(msrcid).data() Configurable> multiplicityUpperLimit{"multiplicityUpperLimit", {MultiplicityUpperLimitBase[0], 11, 8, {SYSTEMNAME(0), SYSTEMNAME(1), SYSTEMNAME(2), SYSTEMNAME(3), SYSTEMNAME(4), SYSTEMNAME(5), SYSTEMNAME(6), SYSTEMNAME(7), SYSTEMNAME(8), SYSTEMNAME(9), SYSTEMNAME(10)}, {MULTSRCNAME(0), MULTSRCNAME(1), MULTSRCNAME(2), MULTSRCNAME(3), MULTSRCNAME(4), MULTSRCNAME(5), MULTSRCNAME(6), MULTSRCNAME(7)}}, "Upper limits for the multiplicity observables"}; Configurable> multiplicitiesExclusionFormula{"multiplicitiesExclusionFormula", {multiplicityCentralityCorrelationsFormulaBase[0], 11, 1, {SYSTEMNAME(0), SYSTEMNAME(1), SYSTEMNAME(2), SYSTEMNAME(3), SYSTEMNAME(4), SYSTEMNAME(5), SYSTEMNAME(6), SYSTEMNAME(7), SYSTEMNAME(8), SYSTEMNAME(9), SYSTEMNAME(10)}, {"Exclusion formula"}}, "Formula for excluding outliers of the multiplicities correlations. Use any parameter from centMultCorrelationsParamsMap"}; + Configurable triggSel{"triggSel", "mb+nocollintrstd+nocollinrofstd+nosamebunchpup+isvtxitstpc+gooditslayerall", "Trigger selection: check \'triggerSelectionBitsMap\' for options. Default: mb+nocollintrstd+nocollinrofstd+nosamebunchpup+isvtxitstpc+gooditslayerall"}; struct : ConfigurableGroup { std::string prefix = "cfgEventSelection.occupancySelection"; Configurable occupancyEstimation{"occupancyEstimation", "None", "Occupancy estimation: None, Tracks, FT0C. Default None"}; @@ -515,7 +517,6 @@ struct DptDptFilter { } cfgEventSelection; Configurable cfgSystem{"cfgSystem", "PbPb", "System: Auto, pp, PbPb, Pbp, pPb, XeXe, ppRun3, PbPbRun3. Default PbPb"}; Configurable cfgDataType{"cfgDataType", "data", "Data type: data, datanoevsel, MC, FastMC, OnTheFlyMC. Default data"}; - Configurable cfgTriggSel{"cfgTriggSel", "MB", "Trigger selection: MB,VTXTOFMATCHED,VTXTRDMATCHED,VTXTRDTOFMATCHED,None. Default MB"}; Configurable cfgCentSpec{"cfgCentSpec", "00-10,10-20,20-30,30-40,40-50,50-60,60-70,70-80", "Centrality/multiplicity ranges in min-max separated by commas"}; Configurable cfgOverallMinP{"cfgOverallMinP", 0.0f, "The overall minimum momentum for the analysis. Default: 0.0"}; struct : ConfigurableGroup { @@ -584,7 +585,7 @@ struct DptDptFilter { fMaxOccupancy = cfgEventSelection.occupancySelection.maxOccupancy; /* the trigger selection */ - triggerSelectionFlags = getTriggerSelection(cfgTriggSel.value.c_str()); + triggerSelectionFlags = getTriggerSelection(cfgEventSelection.triggSel.value.c_str()); traceCollId0 = cfgTraceCollId0; /* if the system type is not known at this time, we have to put the initialization somewhere else */ @@ -832,32 +833,46 @@ void DptDptFilter::processReconstructed(CollisionObject const& collision, Tracks } /* report QC information if required */ if (cfgEventSelection.fillQc) { - [&](bool accepted) { - for (int i = 0; i < BeforeAfterNOOFTIMES; ++i) { - fhMultiplicityVsCentrality[i]->Fill(centormult, ftracks.size()); - fhMultiplicityVsT0cMultiplicity[i]->Fill(collision.multFT0C(), ftracks.size()); - fhMultiplicityVsT0aMultiplicity[i]->Fill(collision.multFT0A(), ftracks.size()); - fhMultiplicityVsV0aMultiplicity[i]->Fill(collision.multFV0A(), ftracks.size()); - fhMultiplicityVsPvMultiplicity[i]->Fill(collision.multNTracksPV(), ftracks.size()); - fhPvMultiplicityVsCentrality[i]->Fill(centormult, collision.multNTracksPV()); - fhPvMultiplicityVsT0cMultiplicity[i]->Fill(collision.multFT0C(), collision.multNTracksPV()); - fhPvMultiplicityVsT0aMultiplicity[i]->Fill(collision.multFT0A(), collision.multNTracksPV()); - fhPvMultiplicityVsV0aMultiplicity[i]->Fill(collision.multFV0A(), collision.multNTracksPV()); - fhV0aMultiplicityVsCentrality[i]->Fill(centormult, collision.multFV0A()); - fhV0aMultiplicityVsT0cMultiplicity[i]->Fill(collision.multFT0C(), collision.multFV0A()); - fhV0aMultiplicityVsT0aMultiplicity[i]->Fill(collision.multFT0A(), collision.multFV0A()); - fhT0cMultiplicityVsCentrality[i]->Fill(centormult, collision.multFT0C()); - fhT0cMultiplicityVsT0aMultiplicity[i]->Fill(collision.multFT0A(), collision.multFT0C()); - if constexpr (framework::has_type_v) { - fhT0CentralityVsCentrality[i]->Fill(centormult, collision.centFT0M()); - fhV0aCentralityVsCentrality[i]->Fill(centormult, collision.centFV0A()); - fhNtpvCentralityVsCentrality[i]->Fill(centormult, collision.centNTPV()); - } - /* if not accepted only before is filled */ - if (!accepted) + auto fillHistograms = [&](int step) { + fhMultiplicityVsCentrality[step]->Fill(centormult, ftracks.size()); + fhMultiplicityVsT0cMultiplicity[step]->Fill(collision.multFT0C(), ftracks.size()); + fhMultiplicityVsT0aMultiplicity[step]->Fill(collision.multFT0A(), ftracks.size()); + fhMultiplicityVsV0aMultiplicity[step]->Fill(collision.multFV0A(), ftracks.size()); + fhMultiplicityVsPvMultiplicity[step]->Fill(collision.multNTracksPV(), ftracks.size()); + fhPvMultiplicityVsCentrality[step]->Fill(centormult, collision.multNTracksPV()); + fhPvMultiplicityVsT0cMultiplicity[step]->Fill(collision.multFT0C(), collision.multNTracksPV()); + fhPvMultiplicityVsT0aMultiplicity[step]->Fill(collision.multFT0A(), collision.multNTracksPV()); + fhPvMultiplicityVsV0aMultiplicity[step]->Fill(collision.multFV0A(), collision.multNTracksPV()); + fhV0aMultiplicityVsCentrality[step]->Fill(centormult, collision.multFV0A()); + fhV0aMultiplicityVsT0cMultiplicity[step]->Fill(collision.multFT0C(), collision.multFV0A()); + fhV0aMultiplicityVsT0aMultiplicity[step]->Fill(collision.multFT0A(), collision.multFV0A()); + fhT0cMultiplicityVsCentrality[step]->Fill(centormult, collision.multFT0C()); + fhT0cMultiplicityVsT0aMultiplicity[step]->Fill(collision.multFT0A(), collision.multFT0C()); + if constexpr (framework::has_type_v) { + fhT0CentralityVsCentrality[step]->Fill(centormult, collision.centFT0M()); + fhV0aCentralityVsCentrality[step]->Fill(centormult, collision.centFV0A()); + fhNtpvCentralityVsCentrality[step]->Fill(centormult, collision.centNTPV()); + } + }; + for (int i = 0; i < BeforeAfterNOOFTIMES; ++i) { + switch (static_cast(i)) { + case BeforeAfterBEFORE: + fillHistograms(i); + break; + case BeforeAfterBEFOREMULTCORR: + if ((collisionFlags & CollSelPREMULTACCEPTEDRUN3) == CollSelPREMULTACCEPTEDRUN3) { + fillHistograms(i); + } + break; + case BeforeAfterAFTER: + if (acceptedevent) { + fillHistograms(i); + } + break; + default: break; } - }(acceptedevent); + } } } diff --git a/PWGCF/TableProducer/dptDptFilter.h b/PWGCF/TableProducer/dptDptFilter.h index e883e6bfdfe..14a49c3bbf0 100644 --- a/PWGCF/TableProducer/dptDptFilter.h +++ b/PWGCF/TableProducer/dptDptFilter.h @@ -39,6 +39,8 @@ #include #include +#include + #include #include #include @@ -413,6 +415,9 @@ enum CollisionSelectionFlags { CollSelNOOFFLAGS ///< number of flags }; +constexpr std::bitset<32> CollSelACCEPTEDRUN3 = BIT(CollSelTRIGGSELBIT) | BIT(CollSelRCTBIT) | BIT(CollSelOCCUPANCYBIT) | BIT(CollSelCENTRALITYBIT) | BIT(CollSelZVERTEXBIT) | BIT(CollSelMULTCORRELATIONS); +constexpr std::bitset<32> CollSelPREMULTACCEPTEDRUN3 = BIT(CollSelTRIGGSELBIT) | BIT(CollSelRCTBIT) | BIT(CollSelOCCUPANCYBIT) | BIT(CollSelCENTRALITYBIT) | BIT(CollSelZVERTEXBIT); + /// \std::mag collisionSelectionExternalNamesMap /// \brief maps collision selection bits to external names static const std::map collisionSelectionExternalNamesMap{ diff --git a/PWGCF/Tasks/dptDptCorrelations.cxx b/PWGCF/Tasks/dptDptCorrelations.cxx index 07754ef5316..ffe62250ca9 100644 --- a/PWGCF/Tasks/dptDptCorrelations.cxx +++ b/PWGCF/Tasks/dptDptCorrelations.cxx @@ -971,10 +971,10 @@ struct DptDptCorrelations { nNoOfDimensions = static_cast(cfgNoOfDimensions.value); /* self configure the CCDB access to the input file */ - getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDBUrl", cfgCCDBUrl, false); - getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDBPathName", cfgCCDBPathName, false); - getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDBDate", cfgCCDBDate, false); - getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDBPeriod", cfgCCDBPeriod, false); + getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.url", cfgCCDBUrl, false); + getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.pathName", cfgCCDBPathName, false); + getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.date", cfgCCDBDate, false); + getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.period", cfgCCDBPeriod, false); loadfromccdb = cfgCCDBPathName.length() > 0; /* update the potential binning change */ From fffc5a356a2ed6c34990a4e8c53fc3e96339e0b7 Mon Sep 17 00:00:00 2001 From: "Maja Karwowska (Kabus)" Date: Sun, 31 Aug 2025 17:35:22 +0200 Subject: [PATCH 252/986] [Infrastructure] Remove me from CF-related codeowners (#12772) --- CODEOWNERS | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index 5569cdb9817..4f9a459285d 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -29,11 +29,11 @@ /EventFiltering/PWGCF @alibuild @lauraser @mpuccio @lietava /EventFiltering/PWGMM @alibuild @aortizve @mpuccio @lietava /EventFiltering/PWGJE @alibuild @fkrizek @nzardosh @mpuccio @lietava -/PWGCF @alibuild @saganatt @victor-gonzalez @zchochul @lgraczykCern @prchakra @lauraser @ariedel-cern @EmilGorm @otonvd @shouqiye @glromane -/PWGCF/Core @alibuild @jgrosseo @saganatt @victor-gonzalez @zchochul @lgraczykCern @prchakra @lauraser @ariedel-cern @EmilGorm @otonvd @shouqiye @glromane -/PWGCF/DataModel @alibuild @jgrosseo @saganatt @victor-gonzalez @zchochul @lgraczykCern @prchakra @lauraser @ariedel-cern @EmilGorm @otonvd @shouqiye @glromane -/PWGCF/TableProducer @alibuild @jgrosseo @saganatt @victor-gonzalez @zchochul @lgraczykCern @prchakra @lauraser @ariedel-cern @EmilGorm @otonvd @shouqiye @glromane -/PWGCF/Tasks @alibuild @jgrosseo @saganatt @victor-gonzalez @zchochul @lgraczykCern @prchakra @lauraser @ariedel-cern @EmilGorm @otonvd @shouqiye @glromane +/PWGCF @alibuild @victor-gonzalez @zchochul @lgraczykCern @prchakra @lauraser @ariedel-cern @EmilGorm @otonvd @shouqiye @glromane +/PWGCF/Core @alibuild @jgrosseo @victor-gonzalez @zchochul @lgraczykCern @prchakra @lauraser @ariedel-cern @EmilGorm @otonvd @shouqiye @glromane +/PWGCF/DataModel @alibuild @jgrosseo @victor-gonzalez @zchochul @lgraczykCern @prchakra @lauraser @ariedel-cern @EmilGorm @otonvd @shouqiye @glromane +/PWGCF/TableProducer @alibuild @jgrosseo @victor-gonzalez @zchochul @lgraczykCern @prchakra @lauraser @ariedel-cern @EmilGorm @otonvd @shouqiye @glromane +/PWGCF/Tasks @alibuild @jgrosseo @victor-gonzalez @zchochul @lgraczykCern @prchakra @lauraser @ariedel-cern @EmilGorm @otonvd @shouqiye @glromane /PWGDQ @alibuild @iarsene @mcoquet642 @lucamicheletti93 /PWGEM @alibuild @feisenhu @dsekihat @ivorobye /PWGEM/Dilepton @alibuild @mikesas @rbailhac @dsekihat @ivorobye @feisenhu @hscheid @@ -62,7 +62,7 @@ /PWGJE @alibuild @lhavener @maoyx @nzardosh @fjonasALICE @mfasDa @mhemmer-cern /Tools/PIDML @alibuild @saganatt /Tools/ML @alibuild @fcatalan92 @fmazzasc -/Tutorials/PWGCF @alibuild @jgrosseo @saganatt @victor-gonzalez @zchochul +/Tutorials/PWGCF @alibuild @jgrosseo @victor-gonzalez @zchochul /Tutorials/PWGDQ @alibuild @iarsene @mcoquet @lucamicheletti93 /Tutorials/PWGEM @alibuild @mikesas @rbailhac @dsekihat @ivorobye @feisenhu /Tutorials/PWGHF @alibuild @vkucera @fcolamar @fgrosa @gluparel From c680abd0c5c92eea2d2ba426d7bc1e4a28fb582a Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sun, 31 Aug 2025 19:24:43 +0200 Subject: [PATCH 253/986] [Common] Cleanup: remove test tasks (#12802) Co-authored-by: David Dobrigkeit Chinellato --- Common/TableProducer/CMakeLists.txt | 10 -- Common/TableProducer/timestampTester.cxx | 72 ----------- .../TableProducer/trackPropagationTester.cxx | 115 ------------------ 3 files changed, 197 deletions(-) delete mode 100644 Common/TableProducer/timestampTester.cxx delete mode 100644 Common/TableProducer/trackPropagationTester.cxx diff --git a/Common/TableProducer/CMakeLists.txt b/Common/TableProducer/CMakeLists.txt index cdd408d4bff..b1805257bb9 100644 --- a/Common/TableProducer/CMakeLists.txt +++ b/Common/TableProducer/CMakeLists.txt @@ -59,11 +59,6 @@ o2physics_add_dpl_workflow(timestamp PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(timestamptester - SOURCES timestampTester.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(weak-decay-indices SOURCES weakDecayIndices.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore @@ -84,11 +79,6 @@ o2physics_add_dpl_workflow(track-dca-cov-filler-run2 PUBLIC_LINK_LIBRARIES O2::DetectorsBase O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(track-propagation-tester - SOURCES trackPropagationTester.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::trackSelectionRequest - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(calo-clusters SOURCES caloClusterProducer.cxx PUBLIC_LINK_LIBRARIES O2::DataFormatsPHOS O2::PHOSBase O2::PHOSReconstruction O2Physics::DataModel diff --git a/Common/TableProducer/timestampTester.cxx b/Common/TableProducer/timestampTester.cxx deleted file mode 100644 index 037cd4e38f3..00000000000 --- a/Common/TableProducer/timestampTester.cxx +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// -/// \file timestamp.cxx -/// \author Nicolò Jacazio -/// \since 2020-06-22 -/// \brief A task to fill the timestamp table from run number. -/// Uses headers from CCDB -/// -#include "MetadataHelper.h" - -#include "Common/Tools/timestampModule.h" - -#include "CCDB/BasicCCDBManager.h" -#include "CommonDataFormat/InteractionRecord.h" -#include "DetectorsRaw/HBFUtils.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" - -#include -#include - -using namespace o2::framework; -using namespace o2::header; -using namespace o2; - -o2::common::core::MetadataHelper metadataInfo; // Metadata helper - -struct TimestampTask { - Produces timestampTable; /// Table with SOR timestamps produced by the task - Service ccdb; /// CCDB manager to access orbit-reset timestamp - o2::ccdb::CcdbApi ccdb_api; /// API to access CCDB headers - - Configurable ccdb_url{"ccdb-url", "http://alice-ccdb.cern.ch", "URL of the CCDB database"}; - - o2::common::timestamp::timestampConfigurables timestampConfigurables; - o2::common::timestamp::TimestampModule timestampMod; - - std::vector timestampBuffer; - - void init(o2::framework::InitContext&) - { - // CCDB initialization - ccdb->setURL(ccdb_url.value); - ccdb_api.init(ccdb_url.value); - - // timestamp configuration + init - timestampMod.init(timestampConfigurables, metadataInfo); - } - - void process(aod::BCs const& bcs) - { - timestampMod.process(bcs, ccdb, timestampBuffer, timestampTable); - } -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - // Parse the metadata - metadataInfo.initMetadata(cfgc); - - return WorkflowSpec{adaptAnalysisTask(cfgc)}; -} diff --git a/Common/TableProducer/trackPropagationTester.cxx b/Common/TableProducer/trackPropagationTester.cxx deleted file mode 100644 index 18543ee0994..00000000000 --- a/Common/TableProducer/trackPropagationTester.cxx +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file trackPropagationTester.cxx -/// \brief testing ground for track propagation -/// \author ALICE - -//=============================================================== -// -// Experimental version of the track propagation task -// this utilizes an analysis task module that can be employed elsewhere -// and allows for the re-utilization of a material LUT -// -// candidate approach for core service approach -// -//=============================================================== - -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/Tools/StandardCCDBLoader.h" -#include "Common/Tools/TrackPropagationModule.h" -#include "Common/Tools/TrackTuner.h" - -#include "CCDB/BasicCCDBManager.h" -#include "CCDB/CcdbApi.h" -#include "CommonConstants/GeomConstants.h" -#include "CommonUtils/NameConf.h" -#include "DataFormatsCalibration/MeanVertexObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DetectorsBase/GeometryManager.h" -#include "DetectorsBase/Propagator.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/DCA.h" - -#include - -// The Run 3 AO2D stores the tracks at the point of innermost update. For a track with ITS this is the innermost (or second innermost) -// ITS layer. For a track without ITS, this is the TPC inner wall or for loopers in the TPC even a radius beyond that. -// In order to use the track parameters, the tracks have to be propagated to the collision vertex which is done by this task. -// The task consumes the TracksIU and TracksCovIU tables and produces Tracks and TracksCov to which then the user analysis can subscribe. -// -// This task is not needed for Run 2 converted data. -// There are two versions of the task (see process flags), one producing also the covariance matrix and the other only the tracks table. - -using namespace o2; -using namespace o2::framework; -// using namespace o2::framework::expressions; - -struct TrackPropagationTester { - o2::common::StandardCCDBLoaderConfigurables standardCCDBLoaderConfigurables; - o2::common::TrackPropagationProducts trackPropagationProducts; - o2::common::TrackPropagationConfigurables trackPropagationConfigurables; - - // the track tuner object -> needs to be here as it inherits from ConfigurableGroup (+ has its own copy of ccdbApi) - TrackTuner trackTunerObj; - - // CCDB boilerplate declarations - o2::framework::Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Service ccdb; - - o2::common::StandardCCDBLoader ccdbLoader; - o2::common::TrackPropagationModule trackPropagation; - - HistogramRegistry registry{"registry"}; - - void init(o2::framework::InitContext& initContext) - { - // CCDB boilerplate init - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - ccdb->setURL(ccdburl.value); - - // task-specific - trackPropagation.init(trackPropagationConfigurables, trackTunerObj, registry, initContext); - } - - void processReal(aod::Collisions const& collisions, soa::Join const& tracks, aod::Collisions const&, aod::BCs const& bcs) - { - // task-specific - ccdbLoader.initCCDBfromBCs(standardCCDBLoaderConfigurables, ccdb, bcs); - trackPropagation.fillTrackTables(trackPropagationConfigurables, trackTunerObj, ccdbLoader, collisions, tracks, trackPropagationProducts, registry); - } - PROCESS_SWITCH(TrackPropagationTester, processReal, "Process Real Data", true); - - // ----------------------- - void processMc(aod::Collisions const& collisions, soa::Join const& tracks, aod::McParticles const&, aod::Collisions const&, aod::BCs const& bcs) - { - ccdbLoader.initCCDBfromBCs(standardCCDBLoaderConfigurables, ccdb, bcs); - trackPropagation.fillTrackTables(trackPropagationConfigurables, trackTunerObj, ccdbLoader, collisions, tracks, trackPropagationProducts, registry); - } - PROCESS_SWITCH(TrackPropagationTester, processMc, "Process Monte Carlo", false); -}; - -//**************************************************************************************** -/** - * Workflow definition. - */ -//**************************************************************************************** -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - WorkflowSpec workflow{adaptAnalysisTask(cfgc)}; - return workflow; -} From f9e35780ff0a31b2012ada914fb68f21603a38ab Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sun, 31 Aug 2025 19:57:05 +0200 Subject: [PATCH 254/986] [PWGEM/Dilepton] fix for global muon in createResolutionMap.cxx (#12803) --- PWGEM/Dilepton/Tasks/createResolutionMap.cxx | 34 ++++++++++++-------- PWGEM/Dilepton/Utils/MomentumSmearer.h | 21 ++++++------ 2 files changed, 33 insertions(+), 22 deletions(-) diff --git a/PWGEM/Dilepton/Tasks/createResolutionMap.cxx b/PWGEM/Dilepton/Tasks/createResolutionMap.cxx index 323d82e7728..e77aefc7ae9 100644 --- a/PWGEM/Dilepton/Tasks/createResolutionMap.cxx +++ b/PWGEM/Dilepton/Tasks/createResolutionMap.cxx @@ -82,8 +82,9 @@ struct CreateResolutionMap { ConfigurableAxis ConfPhiGenBins{"ConfPhiGenBins", {72, 0, 2.f * M_PI}, "gen. eta bins at forward rapidity for output histograms"}; ConfigurableAxis ConfRelDeltaPtBins{"ConfRelDeltaPtBins", {200, -1.f, +1.f}, "rel. dpt for output histograms"}; - ConfigurableAxis ConfDeltaEtaBins{"ConfDeltaEtaBins", {200, -0.2f, +0.2f}, "deta bins for output histograms"}; - ConfigurableAxis ConfDeltaPhiBins{"ConfDeltaPhiBins", {200, -0.2f, +0.2f}, "dphi bins for output histograms"}; + ConfigurableAxis ConfDeltaEtaCBBins{"ConfDeltaEtaCBBins", {200, -0.5f, +0.5f}, "deta bins for output histograms"}; + ConfigurableAxis ConfDeltaEtaFWDBins{"ConfDeltaEtaFWDBins", {200, -0.5f, +0.5f}, "deta bins for output histograms"}; + ConfigurableAxis ConfDeltaPhiBins{"ConfDeltaPhiBins", {200, -0.5f, +0.5f}, "dphi bins for output histograms"}; Configurable cfgFillTHnSparse{"cfgFillTHnSparse", true, "fill THnSparse for output"}; Configurable cfgFillTH2{"cfgFillTH2", false, "fill TH2 for output"}; @@ -212,7 +213,8 @@ struct CreateResolutionMap { const AxisSpec axis_eta_fwd_gen{ConfEtaFWDGenBins, "#eta_{l}^{gen}"}; const AxisSpec axis_phi_gen{ConfPhiGenBins, "#varphi_{l}^{gen} (rad.)"}; const AxisSpec axis_dpt{ConfRelDeltaPtBins, "(p_{T,l}^{gen} - p_{T,l}^{rec})/p_{T,l}^{gen}"}; - const AxisSpec axis_deta{ConfDeltaEtaBins, "#eta_{l}^{gen} - #eta_{l}^{rec}"}; + const AxisSpec axis_deta_cb{ConfDeltaEtaCBBins, "#eta_{l}^{gen} - #eta_{l}^{rec}"}; + const AxisSpec axis_deta_fwd{ConfDeltaEtaFWDBins, "#eta_{l}^{gen} - #eta_{l}^{rec}"}; const AxisSpec axis_dphi{ConfDeltaPhiBins, "#varphi_{l}^{gen} - #varphi_{l}^{rec} (rad.)"}; const AxisSpec axis_charge_gen{3, -1.5, +1.5, "true sign"}; @@ -222,20 +224,26 @@ struct CreateResolutionMap { registry.add("Event/hGenID", "generator ID;generator ID;Number of mc collisions", kTH1F, {{7, -1.5, 5.5}}, true); } if (cfgFillTH2) { - registry.add("Electron/hPt", "rec. p_{T,l};p_{T,l} (GeV/c)", kTH1F, {{1000, 0, 10}}, false); - registry.add("Electron/hEtaPhi", "rec. #eta vs. #varphi;#varphi_{l} (rad.);#eta_{l}", kTH2F, {{90, 0, 2 * M_PI}, {100, -5, +5}}, false); + registry.add("Electron/hPt", "rec. p_{T,e};p_{T,e} (GeV/c)", kTH1F, {{1000, 0, 10}}, false); + registry.add("Electron/hEtaPhi", "rec. #eta vs. #varphi;#varphi_{e} (rad.);#eta_{e}", kTH2F, {{90, 0, 2 * M_PI}, {100, -5, +5}}, false); registry.add("Electron/Ptgen_RelDeltaPt", "resolution", kTH2F, {{axis_pt_gen}, {axis_dpt}}, true); - registry.add("Electron/Ptgen_DeltaEta", "resolution", kTH2F, {{axis_pt_gen}, {axis_deta}}, true); + registry.add("Electron/Ptgen_DeltaEta", "resolution", kTH2F, {{axis_pt_gen}, {axis_deta_cb}}, true); registry.add("Electron/Ptgen_DeltaPhi_Pos", "resolution", kTH2F, {{axis_pt_gen}, {axis_dphi}}, true); registry.add("Electron/Ptgen_DeltaPhi_Neg", "resolution", kTH2F, {{axis_pt_gen}, {axis_dphi}}, true); - registry.addClone("Electron/", "StandaloneMuon/"); - registry.addClone("Electron/", "GlobalMuon/"); + + registry.add("StandaloneMuon/hPt", "rec. p_{T,#mu};p_{T,#mu} (GeV/c)", kTH1F, {{1000, 0, 10}}, false); + registry.add("StandaloneMuon/hEtaPhi", "rec. #eta vs. #varphi;#varphi_{#mu} (rad.);#eta_{#mu}", kTH2F, {{90, 0, 2 * M_PI}, {100, -5, +5}}, false); + registry.add("StandaloneMuon/Ptgen_RelDeltaPt", "resolution", kTH2F, {{axis_pt_gen}, {axis_dpt}}, true); + registry.add("StandaloneMuon/Ptgen_DeltaEta", "resolution", kTH2F, {{axis_pt_gen}, {axis_deta_fwd}}, true); + registry.add("StandaloneMuon/Ptgen_DeltaPhi_Pos", "resolution", kTH2F, {{axis_pt_gen}, {axis_dphi}}, true); + registry.add("StandaloneMuon/Ptgen_DeltaPhi_Neg", "resolution", kTH2F, {{axis_pt_gen}, {axis_dphi}}, true); + registry.addClone("StandaloneMuon/", "GlobalMuon/"); } if (cfgFillTHnSparse) { - registry.add("Electron/hs_reso", "8D resolution", kTHnSparseF, {axis_cent, axis_pt_gen, axis_eta_cb_gen, axis_phi_gen, axis_charge_gen, axis_dpt, axis_deta, axis_dphi}, true); - registry.add("StandaloneMuon/hs_reso", "8D resolution", kTHnSparseF, {axis_cent, axis_pt_gen, axis_eta_fwd_gen, axis_phi_gen, axis_charge_gen, axis_dpt, axis_deta, axis_dphi}, true); - registry.add("GlobalMuon/hs_reso", "8D resolution", kTHnSparseF, {axis_cent, axis_pt_gen, axis_eta_fwd_gen, axis_phi_gen, axis_charge_gen, axis_dpt, axis_deta, axis_dphi}, true); + registry.add("Electron/hs_reso", "8D resolution", kTHnSparseF, {axis_cent, axis_pt_gen, axis_eta_cb_gen, axis_phi_gen, axis_charge_gen, axis_dpt, axis_deta_cb, axis_dphi}, true); + registry.add("StandaloneMuon/hs_reso", "8D resolution", kTHnSparseF, {axis_cent, axis_pt_gen, axis_eta_fwd_gen, axis_phi_gen, axis_charge_gen, axis_dpt, axis_deta_fwd, axis_dphi}, true); + registry.add("GlobalMuon/hs_reso", "8D resolution", kTHnSparseF, {axis_cent, axis_pt_gen, axis_eta_fwd_gen, axis_phi_gen, axis_charge_gen, axis_dpt, axis_deta_fwd, axis_dphi}, true); } } @@ -592,7 +600,7 @@ struct CreateResolutionMap { return; } - if (!isSelectedMuon(pt, eta, rAtAbsorberEnd, pDCA, muon.chi2(), muon.trackType(), dcaXY)) { + if (!isSelectedMuon(pt, eta, rAtAbsorberEnd, pDCA, muon.chi2() / (2.f * (muon.nClusters() + nClustersMFT) - 5.f), muon.trackType(), dcaXY)) { return; } @@ -656,7 +664,7 @@ struct CreateResolutionMap { if (muoncuts.cfg_max_dcaxy_gl < dcaXY) { return false; } - if (chi2 < 0.f || muoncuts.cfg_max_chi2_gl < chi2) { + if (chi2 < 0.f || muoncuts.cfg_max_chi2_gl < chi2) { // chi2/ndf return false; } if (rAtAbsorberEnd < muoncuts.cfg_min_rabs_gl || muoncuts.cfg_max_rabs_gl < rAtAbsorberEnd) { diff --git a/PWGEM/Dilepton/Utils/MomentumSmearer.h b/PWGEM/Dilepton/Utils/MomentumSmearer.h index 10699e4c2a0..d0e73ee971f 100644 --- a/PWGEM/Dilepton/Utils/MomentumSmearer.h +++ b/PWGEM/Dilepton/Utils/MomentumSmearer.h @@ -133,12 +133,15 @@ class MomentumSmearer } } - void fillVecReso(TH2F* fReso, std::vector& fVecReso) + void fillVecReso(TH2F* fReso, std::vector& fVecReso, const char* suffix) { - TAxis* axisPt = fReso->GetXaxis(); + TAxis* axisPt = fReso->GetXaxis(); // be careful! This works only for variable bin width. int nBinsPt = axisPt->GetNbins(); - for (int i = 1; i <= nBinsPt; i++) { - fVecReso.push_back(reinterpret_cast(fReso->ProjectionY("", i, i))); + fVecReso.resize(nBinsPt); + for (int i = 0; i < nBinsPt; i++) { + auto h1 = reinterpret_cast(fReso->ProjectionY(Form("h1reso%s_pt%d", suffix, i), i + 1, i + 1)); + h1->Scale(1.f, "width"); // convert ntrack to probability density + fVecReso[i] = h1; } } @@ -257,10 +260,10 @@ class MomentumSmearer if (!fResoPhi_Neg) { LOGP(fatal, "Could not open {} from file {}", fResPhiNegHistName.Data(), fResFileName.Data()); } - fillVecReso(fResoPt, fVecResoPt); - fillVecReso(fResoEta, fVecResoEta); - fillVecReso(fResoPhi_Pos, fVecResoPhi_Pos); - fillVecReso(fResoPhi_Neg, fVecResoPhi_Neg); + fillVecReso(fResoPt, fVecResoPt, "_reldpt"); + fillVecReso(fResoEta, fVecResoEta, "_deta"); + fillVecReso(fResoPhi_Pos, fVecResoPhi_Pos, "_dphi_pos"); + fillVecReso(fResoPhi_Neg, fVecResoPhi_Neg, "_dphi_neg"); } } @@ -361,7 +364,7 @@ class MomentumSmearer if (!fDCA) { LOGP(fatal, "Could not open {} from file {}", fDCAHistName.Data(), fDCAFileName.Data()); } - fillVecReso(fDCA, fVecDCA); + fillVecReso(fDCA, fVecDCA, "_dca"); } if (!fFromCcdb) { From e91e1598049d810da4d38aebca859b032e2a3fb5 Mon Sep 17 00:00:00 2001 From: Maximiliano Puccio Date: Sun, 31 Aug 2025 21:33:28 +0200 Subject: [PATCH 255/986] [PWGLF] Avoid double counting when enabling two process functions (#12806) --- PWGLF/Tasks/Strangeness/nonPromptCascade.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx b/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx index 488e5815ce0..9672a65d4f8 100644 --- a/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx +++ b/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx @@ -209,6 +209,7 @@ struct NonPromptCascadeTask { int mRunNumber = 0; float mBz = 0.f; o2::vertexing::DCAFitterN<2> mDCAFitter; + std::array mProcessCounter = {0, 0}; // {Tracked, All} void initCCDB(aod::BCsWithTimestamps::iterator const& bc) { @@ -300,7 +301,7 @@ struct NonPromptCascadeTask { void zorroAccounting(const auto& collisions, auto& toiMap) { - if (cfgSkimmedProcessing) { + if (cfgSkimmedProcessing && mProcessCounter[0] != mProcessCounter[1]) { int runNumber{-1}; for (const auto& coll : collisions) { auto bc = coll.template bc_as(); @@ -691,6 +692,7 @@ struct NonPromptCascadeTask { aod::V0s const& /*v0s*/, TracksExtData const& tracks, aod::BCsWithTimestamps const&) { + mProcessCounter[0]++; fillMultHistos(collisions); std::map toiMap; zorroAccounting(collisions, toiMap); @@ -703,6 +705,7 @@ struct NonPromptCascadeTask { aod::V0s const& /*v0s*/, TracksExtData const& tracks, aod::BCsWithTimestamps const&) { + mProcessCounter[1]++; std::map toiMap; zorroAccounting(collisions, toiMap); fillCandidatesVector(collisions, tracks, cascades, gCandidatesNT, toiMap); From 238fe1feb9aaa9ed61c877e4979503433ea26fce Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sun, 31 Aug 2025 23:08:32 +0200 Subject: [PATCH 256/986] [Common] Further adjustments and cleanup to common services (#12809) Co-authored-by: David Dobrigkeit Chinellato Co-authored-by: ALICE Builder --- Common/TableProducer/PID/CMakeLists.txt | 10 ++ Common/TableProducer/PID/pidTPCService.cxx | 10 +- .../TableProducer/PID/pidTPCServiceRun2.cxx | 112 ++++++++++++++++++ .../TableProducer/PID/pidTPCServiceRun3.cxx | 108 +++++++++++++++++ .../TableProducer/eventSelectionService.cxx | 2 +- Common/TableProducer/multCentTable.cxx | 34 +++--- ...electionTools.h => EventSelectionModule.h} | 0 Common/Tools/{ => Multiplicity}/MultModule.h | 1 + .../PID/pidTPCModule.h | 2 +- 9 files changed, 259 insertions(+), 20 deletions(-) create mode 100644 Common/TableProducer/PID/pidTPCServiceRun2.cxx create mode 100644 Common/TableProducer/PID/pidTPCServiceRun3.cxx rename Common/Tools/{EventSelectionTools.h => EventSelectionModule.h} (100%) rename Common/Tools/{ => Multiplicity}/MultModule.h (99%) rename Common/{TableProducer => Tools}/PID/pidTPCModule.h (99%) diff --git a/Common/TableProducer/PID/CMakeLists.txt b/Common/TableProducer/PID/CMakeLists.txt index 86787fd13b7..ab502d138b0 100644 --- a/Common/TableProducer/PID/CMakeLists.txt +++ b/Common/TableProducer/PID/CMakeLists.txt @@ -48,6 +48,16 @@ o2physics_add_dpl_workflow(pid-tpc-service PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore O2Physics::AnalysisCCDB COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(pid-tpc-service-run2 + SOURCES pidTPCServiceRun2.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore O2Physics::AnalysisCCDB + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(pid-tpc-service-run3 + SOURCES pidTPCServiceRun3.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore O2Physics::AnalysisCCDB + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(pid-tpc-base SOURCES pidTPCBase.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::AnalysisCCDB diff --git a/Common/TableProducer/PID/pidTPCService.cxx b/Common/TableProducer/PID/pidTPCService.cxx index cff700fca1c..7350b9e9fa5 100644 --- a/Common/TableProducer/PID/pidTPCService.cxx +++ b/Common/TableProducer/PID/pidTPCService.cxx @@ -33,12 +33,12 @@ #include "MetadataHelper.h" #include "TableHelper.h" #include "pidTPCBase.h" -#include "pidTPCModule.h" #include "Common/Core/PID/TPCPIDResponse.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponseTPC.h" +#include "Common/Tools/PID/pidTPCModule.h" #include "Tools/ML/model.h" #include "CCDB/BasicCCDBManager.h" @@ -98,9 +98,15 @@ struct pidTpcService { pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast(nullptr), products); } + void processTracksMCIU(soa::Join const& collisions, soa::Join const& tracks, aod::BCsWithTimestamps const& bcs, aod::McParticles const&) + { + pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast(nullptr), products); + } + PROCESS_SWITCH(pidTpcService, processTracks, "Process Tracks", false); PROCESS_SWITCH(pidTpcService, processTracksMC, "Process Tracks in MC (enables tune-on-data)", false); - PROCESS_SWITCH(pidTpcService, processTracksIU, "Process TracksIU (experimental)", true); + PROCESS_SWITCH(pidTpcService, processTracksIU, "Process TracksIU (Run 3)", true); + PROCESS_SWITCH(pidTpcService, processTracksMCIU, "Process TracksIUMC (Run 3)", false); }; //**************************************************************************************** diff --git a/Common/TableProducer/PID/pidTPCServiceRun2.cxx b/Common/TableProducer/PID/pidTPCServiceRun2.cxx new file mode 100644 index 00000000000..e13908cd715 --- /dev/null +++ b/Common/TableProducer/PID/pidTPCServiceRun2.cxx @@ -0,0 +1,112 @@ +// 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 trackPropagationTester.cxx +/// \brief testing ground for track propagation +/// \author ALICE + +//=============================================================== +// +// Modularized version of TPC PID task +// +//=============================================================== + +#include +#include +#include +#include +#include +// ROOT includes +#include "TFile.h" +#include "TRandom.h" +#include "TSystem.h" + +// O2 includes +#include "MetadataHelper.h" +#include "TableHelper.h" +#include "pidTPCBase.h" + +#include "Common/Core/PID/TPCPIDResponse.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponseTPC.h" +#include "Common/Tools/PID/pidTPCModule.h" +#include "Tools/ML/model.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CcdbApi.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" + +using namespace o2; +using namespace o2::framework; + +o2::common::core::MetadataHelper metadataInfo; // Metadata helper + +struct pidTpcServiceRun2 { + + // CCDB boilerplate declarations + o2::framework::Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Service ccdb; + o2::ccdb::CcdbApi ccdbApi; + + o2::aod::pid::pidTPCProducts products; + o2::aod::pid::pidTPCConfigurables pidTPCopts; + o2::aod::pid::pidTPCModule pidTPC; + + void init(o2::framework::InitContext& initContext) + { + // CCDB boilerplate init + ccdb->setURL(ccdburl.value); + ccdb->setFatalWhenNull(false); // manual fallback in case ccdb entry empty + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + ccdbApi.init(ccdburl.value); + + // task-specific + pidTPC.init(ccdb, ccdbApi, initContext, pidTPCopts, metadataInfo); + } + + void processTracks(soa::Join const& collisions, soa::Join const& tracks, aod::BCsWithTimestamps const& bcs) + { + pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast(nullptr), products); + } + void processTracksWithTracksQA(soa::Join const& collisions, soa::Join const& tracks, aod::BCsWithTimestamps const& bcs, aod::TracksQA const& tracksQA) + { + pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, tracksQA, products); + } + + void processTracksMC(soa::Join const& collisions, soa::Join const& tracks, aod::BCsWithTimestamps const& bcs, aod::McParticles const&) + { + pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast(nullptr), products); + } + + PROCESS_SWITCH(pidTpcServiceRun2, processTracks, "Process Tracks", true); + PROCESS_SWITCH(pidTpcServiceRun2, processTracksMC, "Process Tracks in MC (enables tune-on-data)", false); +}; + +//**************************************************************************************** +/** + * Workflow definition. + */ +//**************************************************************************************** +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + // Parse the metadata for later too + metadataInfo.initMetadata(cfgc); + + WorkflowSpec workflow{adaptAnalysisTask(cfgc)}; + return workflow; +} diff --git a/Common/TableProducer/PID/pidTPCServiceRun3.cxx b/Common/TableProducer/PID/pidTPCServiceRun3.cxx new file mode 100644 index 00000000000..1415ecee6bf --- /dev/null +++ b/Common/TableProducer/PID/pidTPCServiceRun3.cxx @@ -0,0 +1,108 @@ +// 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 trackPropagationTester.cxx +/// \brief testing ground for track propagation +/// \author ALICE + +//=============================================================== +// +// Modularized version of TPC PID task +// +//=============================================================== + +#include +#include +#include +#include +#include +// ROOT includes +#include "TFile.h" +#include "TRandom.h" +#include "TSystem.h" + +// O2 includes +#include "MetadataHelper.h" +#include "TableHelper.h" +#include "pidTPCBase.h" + +#include "Common/Core/PID/TPCPIDResponse.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponseTPC.h" +#include "Common/Tools/PID/pidTPCModule.h" +#include "Tools/ML/model.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CcdbApi.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" + +using namespace o2; +using namespace o2::framework; + +o2::common::core::MetadataHelper metadataInfo; // Metadata helper + +struct pidTpcServiceRun3 { + + // CCDB boilerplate declarations + o2::framework::Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Service ccdb; + o2::ccdb::CcdbApi ccdbApi; + + o2::aod::pid::pidTPCProducts products; + o2::aod::pid::pidTPCConfigurables pidTPCopts; + o2::aod::pid::pidTPCModule pidTPC; + + void init(o2::framework::InitContext& initContext) + { + // CCDB boilerplate init + ccdb->setURL(ccdburl.value); + ccdb->setFatalWhenNull(false); // manual fallback in case ccdb entry empty + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + ccdbApi.init(ccdburl.value); + + // task-specific + pidTPC.init(ccdb, ccdbApi, initContext, pidTPCopts, metadataInfo); + } + + void processTracksIU(soa::Join const& collisions, soa::Join const& tracks, aod::BCsWithTimestamps const& bcs) + { + pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast(nullptr), products); + } + + void processTracksMCIU(soa::Join const& collisions, soa::Join const& tracks, aod::BCsWithTimestamps const& bcs, aod::McParticles const&) + { + pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast(nullptr), products); + } + + PROCESS_SWITCH(pidTpcServiceRun3, processTracksIU, "Process TracksIU (Run 3)", true); + PROCESS_SWITCH(pidTpcServiceRun3, processTracksMCIU, "Process TracksIUMC (Run 3)", false); +}; + +//**************************************************************************************** +/** + * Workflow definition. + */ +//**************************************************************************************** +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + // Parse the metadata for later too + metadataInfo.initMetadata(cfgc); + + WorkflowSpec workflow{adaptAnalysisTask(cfgc)}; + return workflow; +} diff --git a/Common/TableProducer/eventSelectionService.cxx b/Common/TableProducer/eventSelectionService.cxx index fd713773c86..58d529e5df4 100644 --- a/Common/TableProducer/eventSelectionService.cxx +++ b/Common/TableProducer/eventSelectionService.cxx @@ -23,7 +23,7 @@ #include "Common/Core/trackUtilities.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "Common/Tools/EventSelectionTools.h" +#include "Common/Tools/EventSelectionModule.h" #include "Common/Tools/timestampModule.h" #include "CCDB/BasicCCDBManager.h" diff --git a/Common/TableProducer/multCentTable.cxx b/Common/TableProducer/multCentTable.cxx index 5b0e2c16d55..1bbf3dcd48d 100644 --- a/Common/TableProducer/multCentTable.cxx +++ b/Common/TableProducer/multCentTable.cxx @@ -20,27 +20,29 @@ // //=============================================================== -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Common/DataModel/TrackSelectionTables.h" +#include "MetadataHelper.h" + #include "Common/Core/trackUtilities.h" -#include "ReconstructionDataFormats/DCA.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "CommonUtils/NameConf.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/Tools/Multiplicity/MultModule.h" +#include "Common/Tools/StandardCCDBLoader.h" +#include "Common/Tools/TrackPropagationModule.h" + +#include "CCDB/BasicCCDBManager.h" #include "CCDB/CcdbApi.h" +#include "CommonConstants/GeomConstants.h" +#include "CommonUtils/NameConf.h" +#include "DataFormatsCalibration/MeanVertexObject.h" #include "DataFormatsParameters/GRPMagField.h" -#include "CCDB/BasicCCDBManager.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" -#include "DataFormatsCalibration/MeanVertexObject.h" -#include "CommonConstants/GeomConstants.h" -#include "Common/Tools/TrackPropagationModule.h" -#include "Common/Tools/StandardCCDBLoader.h" #include "Framework/O2DatabasePDGPlugin.h" -#include "MetadataHelper.h" -#include "Common/Tools/MultModule.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/DCA.h" using namespace o2; using namespace o2::framework; diff --git a/Common/Tools/EventSelectionTools.h b/Common/Tools/EventSelectionModule.h similarity index 100% rename from Common/Tools/EventSelectionTools.h rename to Common/Tools/EventSelectionModule.h diff --git a/Common/Tools/MultModule.h b/Common/Tools/Multiplicity/MultModule.h similarity index 99% rename from Common/Tools/MultModule.h rename to Common/Tools/Multiplicity/MultModule.h index 3623543a54d..bed8817c124 100644 --- a/Common/Tools/MultModule.h +++ b/Common/Tools/Multiplicity/MultModule.h @@ -24,6 +24,7 @@ #include "Common/DataModel/Multiplicity.h" #include +#include #include #include diff --git a/Common/TableProducer/PID/pidTPCModule.h b/Common/Tools/PID/pidTPCModule.h similarity index 99% rename from Common/TableProducer/PID/pidTPCModule.h rename to Common/Tools/PID/pidTPCModule.h index 321b6e39329..47ad5d5a01c 100644 --- a/Common/TableProducer/PID/pidTPCModule.h +++ b/Common/Tools/PID/pidTPCModule.h @@ -34,7 +34,6 @@ // O2 includes #include "MetadataHelper.h" #include "TableHelper.h" -#include "pidTPCBase.h" #include "Common/CCDB/ctpRateFetcher.h" #include "Common/Core/PID/TPCPIDResponse.h" @@ -50,6 +49,7 @@ #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/Track.h" +#include namespace o2::aod { From efbdb8900aad319769b9c0caecb889850b0668a9 Mon Sep 17 00:00:00 2001 From: Subhadeep Mandal <147193283+5ub-Man@users.noreply.github.com> Date: Mon, 1 Sep 2025 12:29:35 +0530 Subject: [PATCH 257/986] [PWGLF] Code optimisations (#12810) --- PWGLF/Tasks/Resonances/kstarqa.cxx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarqa.cxx b/PWGLF/Tasks/Resonances/kstarqa.cxx index 9c829f03508..65cd50714d6 100644 --- a/PWGLF/Tasks/Resonances/kstarqa.cxx +++ b/PWGLF/Tasks/Resonances/kstarqa.cxx @@ -377,8 +377,8 @@ struct Kstarqa { // hInvMass.add("multdist_FT0A", "FT0A Multiplicity distribution", kTH1F, {axisMultdist}); // hInvMass.add("multdist_FT0C", "FT0C Multiplicity distribution", kTH1F, {axisMultdist}); // hInvMass.add("hNcontributor", "Number of primary vertex contributor", kTH1F, {{2000, 0.0f, 10000.0f}}); - rEventSelection.add("hDcaxy", "Dcaxy distribution", kTH1F, {{200, -1.0f, 1.0f}}); - rEventSelection.add("hDcaz", "Dcaz distribution", kTH1F, {{200, -1.0f, 1.0f}}); + rEventSelection.add("hDcaxy_cent_pt", "Dcaxy distribution", kTH3F, {{200, -1.0f, 1.0f}, multiplicityAxis, ptAxis}); + rEventSelection.add("hDcaz_cent_pt", "Dcaz distribution", kTH3F, {{200, -1.0f, 1.0f}, multiplicityAxis, ptAxis}); } } @@ -937,7 +937,7 @@ struct Kstarqa { int occupancy = collision.trackOccupancyInTimeRange(); rEventSelection.fill(HIST("hOccupancy"), occupancy); - if (!selectionEvent(collision, true)) { // fill event cut histogram + if (!selectionEvent(collision, true)) { // fill data event cut histogram return; } @@ -1019,8 +1019,8 @@ struct Kstarqa { } if (cQAevents) { - rEventSelection.fill(HIST("hDcaxy"), track1.dcaXY()); - rEventSelection.fill(HIST("hDcaz"), track1.dcaZ()); + rEventSelection.fill(HIST("hDcaxy_cent_pt"), track1.dcaXY(), multiplicity, track1.pt()); + rEventSelection.fill(HIST("hDcaz_cent_pt"), track1.dcaZ(), multiplicity, track1.pt()); } // since we are using combinations full index policy, so repeated pairs are allowed, so we can check one with Kaon and other with pion @@ -1381,8 +1381,8 @@ struct Kstarqa { } if (cQAevents) { - rEventSelection.fill(HIST("hDcaxy"), track1.dcaXY()); - rEventSelection.fill(HIST("hDcaz"), track1.dcaZ()); + rEventSelection.fill(HIST("hDcaxy_cent_pt"), track1.dcaXY(), multiplicity, track1.pt()); + rEventSelection.fill(HIST("hDcaz_cent_pt"), track1.dcaZ(), multiplicity, track1.pt()); } // since we are using combinations full index policy, so repeated pairs are allowed, so we can check one with Kaon and other with pion @@ -1483,8 +1483,8 @@ struct Kstarqa { continue; } - hOthers.fill(HIST("hKstar_Rap"), mother.Rapidity()); - hOthers.fill(HIST("hKstar_Eta"), mother.Eta()); + hOthers.fill(HIST("hKstar_rap_pt"), mother.Rapidity(), mother.Pt()); + hOthers.fill(HIST("hKstar_eta_pt"), mother.Eta(), mother.Pt()); isMix = false; fillInvMass(daughter1, daughter2, mother, multiplicity, isMix, track1, track2); @@ -1732,7 +1732,7 @@ struct Kstarqa { hInvMass.fill(HIST("hAllRecCollisions"), multiplicity); hInvMass.fill(HIST("hAllRecCollisionsCalib"), multiplicityRec); - if (!selectionEvent(collision, false)) { // don't fill event cut histogram + if (!selectionEvent(collision, true)) { // fill MC event cut histogram return; } @@ -1754,8 +1754,8 @@ struct Kstarqa { } if (cQAevents) { - rEventSelection.fill(HIST("hDcaxy"), track1.dcaXY()); - rEventSelection.fill(HIST("hDcaz"), track1.dcaZ()); + rEventSelection.fill(HIST("hDcaxy_cent_pt"), track1.dcaXY(), multiplicity, track1.pt()); + rEventSelection.fill(HIST("hDcaz_cent_pt"), track1.dcaZ(), multiplicity, track1.pt()); } auto track1ID = track1.index(); From 5855accd45143c3eb9a9eaf32c956314e0b93e4c Mon Sep 17 00:00:00 2001 From: Fabio Catalano Date: Mon, 1 Sep 2025 09:08:30 +0200 Subject: [PATCH 258/986] [PWGHF] Change default value of minimum centrality cut in HF event selection (#12789) --- PWGHF/Core/CentralityEstimation.h | 14 ++++++-------- PWGHF/Utils/utilsEvSelHf.h | 4 ++-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/PWGHF/Core/CentralityEstimation.h b/PWGHF/Core/CentralityEstimation.h index fbe18d28d89..916d183a289 100644 --- a/PWGHF/Core/CentralityEstimation.h +++ b/PWGHF/Core/CentralityEstimation.h @@ -107,7 +107,7 @@ float getCentralityColl(const TCollision& collision) template float getCentralityColl(const TCollision&) { - return 105.0f; + return -1.f; } /// Get the centrality @@ -146,7 +146,7 @@ float getCentralityColl(const TCollision& collision, const int centEstimator) LOG(fatal) << "Centrality estimator not valid. See CentralityEstimator for valid values."; break; } - return -999.f; + return -1.f; } /// \brief Function to get MC collision centrality @@ -155,11 +155,10 @@ float getCentralityColl(const TCollision& collision, const int centEstimator) template float getCentralityGenColl(TCollisions const& collSlice) { - using TMult = uint16_t; // type of numContrib + uint16_t multiplicity{}; // type of numContrib float centrality{-1.f}; - TMult multiplicity{}; for (const auto& collision : collSlice) { - const TMult collMult = collision.numContrib(); + const uint16_t collMult = collision.numContrib(); if (collMult > multiplicity) { centrality = getCentralityColl(collision); multiplicity = collMult; @@ -175,11 +174,10 @@ float getCentralityGenColl(TCollisions const& collSlice) template float getCentralityGenColl(TCollisions const& collSlice, const int centEstimator) { - using TMult = uint16_t; // type of numContrib + uint16_t multiplicity{}; // type of numContrib float centrality{-1.f}; - TMult multiplicity{}; for (const auto& collision : collSlice) { - const TMult collMult = collision.numContrib(); + const uint16_t collMult = collision.numContrib(); if (collMult > multiplicity) { centrality = getCentralityColl(collision, centEstimator); multiplicity = collMult; diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index 4af173070d5..f53b199d62a 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -150,7 +150,7 @@ void setEventRejectionLabels(Histo& hRejection, std::string const& softwareTrigg struct HfEventSelection : o2::framework::ConfigurableGroup { std::string prefix = "hfEvSel"; // JSON group name // event selection parameters (in chronological order of application) - o2::framework::Configurable centralityMin{"centralityMin", 0.f, "Minimum centrality"}; + o2::framework::Configurable centralityMin{"centralityMin", -10.f, "Minimum centrality (0 rejects gen. collisions with no reco. collision)"}; o2::framework::Configurable centralityMax{"centralityMax", 100.f, "Maximum centrality"}; o2::framework::Configurable useSel8Trigger{"useSel8Trigger", true, "Apply the sel8 event selection"}; o2::framework::Configurable triggerClass{"triggerClass", -1, "Trigger class different from sel8 (e.g. kINT7 for Run2) used only if useSel8Trigger is false"}; @@ -432,7 +432,7 @@ struct HfEventSelectionMc { bool useItsRofBorderCut{false}; // Apply the ITS RO frame border cut float zPvPosMin{-1000.f}; // Minimum PV posZ (cm) float zPvPosMax{1000.f}; // Maximum PV posZ (cm) - float centralityMin{0.f}; // Minimum centrality + float centralityMin{-10.f}; // Minimum centrality float centralityMax{100.f}; // Maximum centrality bool requireGoodRct{false}; // Apply RCT selection std::string rctLabel{""}; // RCT selection flag From d6eff3a50240626b01bfe94e9b4a7f84e6824e9a Mon Sep 17 00:00:00 2001 From: Artem Kotliarov <71133985+KotliarovAr@users.noreply.github.com> Date: Mon, 1 Sep 2025 11:07:29 +0200 Subject: [PATCH 259/986] [PWGJE] correlation scaled FT0M vs ZNA vs ZNC (#12761) --- PWGJE/Tasks/recoilJets.cxx | 175 ++++++++++++++++--------------------- 1 file changed, 74 insertions(+), 101 deletions(-) diff --git a/PWGJE/Tasks/recoilJets.cxx b/PWGJE/Tasks/recoilJets.cxx index 04600097baa..27c6bc38aca 100644 --- a/PWGJE/Tasks/recoilJets.cxx +++ b/PWGJE/Tasks/recoilJets.cxx @@ -52,22 +52,18 @@ using namespace o2::framework::expressions; using FilteredColl = soa::Filtered>::iterator; using FilteredCollPartLevel = - soa::Filtered>::iterator; + soa::Filtered>::iterator; using FilteredCollDetLevelGetWeight = - soa::Filtered>::iterator; + soa::Filtered>::iterator; using FilteredEventMultiplicity = soa::Filtered>::iterator; using FilteredJets = soa::Filtered>; using FilteredJetsDetLevel = - soa::Filtered>; + soa::Filtered>; using FilteredJetsPartLevel = - soa::Filtered>; + soa::Filtered>; using FilteredMatchedJetsDetLevel = soa::Filtered evSel{"evSel", "sel8", "Choose event selection"}; - Configurable trkSel{"trkSel", "globalTracks", - "Set track selection"}; + Configurable trkSel{"trkSel", "globalTracks", "Set track selection"}; Configurable vertexZCut{"vertexZCut", 10., "Accepted z-vertex range"}; - Configurable fracSig{"fracSig", 0.9, - "Fraction of events to use for signal TT"}; + Configurable fracSig{"fracSig", 0.9, "Fraction of events to use for signal TT"}; - Configurable trkPtMin{"trkPtMin", 0.15, - "Minimum pT of acceptanced tracks"}; - Configurable trkPtMax{"trkPtMax", 100., - "Maximum pT of acceptanced tracks"}; + Configurable trkPtMin{"trkPtMin", 0.15, "Minimum pT of acceptanced tracks"}; + Configurable trkPtMax{"trkPtMax", 100., "Maximum pT of acceptanced tracks"}; Configurable trkEtaCut{"trkEtaCut", 0.9, "Eta acceptance of TPC"}; Configurable jetR{"jetR", 0.4, "Jet cone radius"}; - Configurable triggerMasks{"triggerMasks", "", - "Relevant trigger masks: fTrackLowPt,fTrackHighPt"}; + Configurable triggerMasks{"triggerMasks", "", "Relevant trigger masks: fTrackLowPt,fTrackHighPt"}; Configurable skipMBGapEvents{"skipMBGapEvents", false, "flag to choose to reject min. bias gap events; jet-level rejection " "applied at the jet finder level, here rejection is applied for " "collision and track process functions"}; - Configurable meanFT0A{"meanFT0A", -1.0, "Mean value of FT0A"}; - Configurable meanFT0C{"meanFT0C", -1.0, "Mean value of FT0C"}; + Configurable meanFT0A{"meanFT0A", -1., "Mean value of FT0A signal"}; + Configurable meanFT0C{"meanFT0C", -1., "Mean value of FT0C signal"}; // List of configurable parameters for MC - Configurable pTHatExponent{"pTHatExponent", 4.0, - "Exponent of the event weight for the calculation of pTHat"}; - Configurable pTHatMax{"pTHatMax", 999.0, - "Maximum fraction of hard scattering for jet acceptance in MC"}; + Configurable pTHatExponent{"pTHatExponent", 4.0, "Exponent of the event weight for the calculation of pTHat"}; + Configurable pTHatMax{"pTHatMax", 999.0, "Maximum fraction of hard scattering for jet acceptance in MC"}; // Parameters for recoil jet selection - Configurable ptTTrefMin{"ptTTrefMin", 5., - "Minimum pT of reference TT"}; - Configurable ptTTrefMax{"ptTTrefMax", 7., - "Maximum pT of reference TT"}; + Configurable ptTTrefMin{"ptTTrefMin", 5., "Minimum pT of reference TT"}; + Configurable ptTTrefMax{"ptTTrefMax", 7., "Maximum pT of reference TT"}; Configurable ptTTsigMin{"ptTTsigMin", 20., "Minimum pT of signal TT"}; Configurable ptTTsigMax{"ptTTsigMax", 50., "Maximum pT of signal TT"}; - Configurable recoilRegion{"recoilRegion", 0.6, - "Width of recoil acceptance"}; + Configurable recoilRegion{"recoilRegion", 0.6, "Width of recoil acceptance"}; - Configurable maxJetConstituentPt{"maxJetConstituentPt", 100., - "Remove jets with constituent above this pt cut"}; + Configurable maxJetConstituentPt{"maxJetConstituentPt", 100., "Remove jets with constituent above this pT cut"}; // List of configurable parameters for histograms - Configurable histJetPt{"histJetPt", 100, - "Maximum value of jet pT shown in histograms"}; - - Configurable histMultBins{"histMultBins", 1000, - "Number of bins for scaled FT0M multiplicity"}; + Configurable histJetPt{"histJetPt", 100, "Maximum value of jet pT shown in histograms"}; + Configurable histMultBins{"histMultBins", 1000, "Number of bins for scaled FT0M multiplicity"}; // Axes specification - AxisSpec pT{histJetPt, 0.0, histJetPt * 1.0, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec jetPTcorr{histJetPt + 20, -20., histJetPt * 1.0, - "#it{p}_{T, jet}^{ch, corr} (GeV/#it{c})"}; + AxisSpec pT{histJetPt, 0.0, histJetPt * 1., "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec jetPTcorr{histJetPt + 20, -20., histJetPt * 1.0, "#it{p}_{T, jet}^{ch, corr} (GeV/#it{c})"}; AxisSpec phiAngle{40, 0.0, constants::math::TwoPI, "#it{#varphi} (rad)"}; - AxisSpec deltaPhiAngle{52, 0.0, constants::math::PI, - "#Delta#it{#varphi} (rad)"}; + AxisSpec deltaPhiAngle{52, 0.0, constants::math::PI, "#Delta#it{#varphi} (rad)"}; AxisSpec pseudorap{40, -1., 1., "#it{#eta}"}; AxisSpec pseudorapJets{20, -0.5, 0.5, "#it{#eta}_{jet}"}; AxisSpec jetArea{50, 0.0, 5., "Area_{jet}"}; @@ -147,21 +127,18 @@ struct RecoilJets { AxisSpec rho{50, 0.0, 50., "#it{#rho}"}; AxisSpec scaledFT0C{histMultBins, 0.0, 20., "FT0C / #LT FT0C #GT"}; AxisSpec scaledFT0M{histMultBins, 0.0, 20., "FT0M^{*}"}; - ConfigurableAxis multFT0CPercentile{"multFT0CPercentile", {VARIABLE_WIDTH, 0, 0.2, 0.3, 0.4, 0.6, 0.8, 1., 1.4, 1.8, 2.4, 3.6, 5.0}, "Percentiles of scaled FT0C: 100-90%, 90-80%, 80-70%, 70-60%, 60-50%, 50-40%, 40-30%, 30-20%, 20-10%, 10-1%, 1-0.1%"}; // to adjust the boarders - ConfigurableAxis multFT0MPercentile{"multFT0MPercentile", {VARIABLE_WIDTH, 0, 0.2, 0.3, 0.4, 0.6, 0.8, 1., 1.4, 1.8, 2.4, 3.6, 5.0}, "Percentiles of scaled FT0M: 100-90%, 90-80%, 80-70%, 70-60%, 60-50%, 50-40%, 40-30%, 30-20%, 20-10%, 10-1%, 1-0.1%"}; - - Preslice partJetsPerCollision = aod::jet::mcCollisionId; + ConfigurableAxis multFT0CThresh{"multFT0CThresh", {VARIABLE_WIDTH, 0, 0.2, 0.3, 0.4, 0.6, 0.8, 1., 1.4, 1.8, 2.4, 3.6, 5., 20.}, "Percentiles of scaled FT0C: 100-90%, 90-80%, 80-70%, 70-60%, 60-50%, 50-40%, 40-30%, 30-20%, 20-10%, 10-1%, 1-0.1%"}; // to adjust the boarders + ConfigurableAxis multFT0MThresh{"multFT0MThresh", {VARIABLE_WIDTH, 0, 0.2, 0.3, 0.4, 0.6, 0.8, 1., 1.4, 1.8, 2.4, 3.6, 5., 20.}, "Percentiles of scaled FT0M: 100-90%, 90-80%, 80-70%, 70-60%, 60-50%, 50-40%, 40-30%, 30-20%, 20-10%, 10-1%, 1-0.1%"}; + // Auxiliary variables TRandom3* rand = new TRandom3(0); // Declare filter on collision Z vertex Filter collisionFilter = nabs(aod::jcollision::posZ) < vertexZCut; Filter collisionFilterMC = nabs(aod::jmccollision::posZ) < vertexZCut; - // Declare filters on accepted tracks and MC particles (settings for jet reco - // are provided in the jet finder wagon) - Filter trackFilter = aod::jtrack::pt > trkPtMin&& aod::jtrack::pt < - trkPtMax&& nabs(aod::jtrack::eta) < trkEtaCut; + // Declare filters on accepted tracks and MC particles (settings for jet reco are provided in the jet finder wagon) + Filter trackFilter = aod::jtrack::pt > trkPtMin&& aod::jtrack::pt < trkPtMax&& nabs(aod::jtrack::eta) < trkEtaCut; Filter partFilter = nabs(aod::jmcparticle::eta) < trkEtaCut; // Declare filter on jets @@ -174,18 +151,16 @@ struct RecoilJets { std::vector triggerMaskBits; Service pdg; + Preslice partJetsPerCollision = aod::jet::mcCollisionId; void init(InitContext const&) { std::string evSelToString = static_cast(evSel); std::string trkSelToString = static_cast(trkSel); - eventSelectionBits = - jetderiveddatautilities::initialiseEventSelectionBits(evSelToString); - trackSelection = - jetderiveddatautilities::initialiseTrackSelection(trkSelToString); - triggerMaskBits = - jetderiveddatautilities::initialiseTriggerMaskBits(triggerMasks); + eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(evSelToString); + trackSelection = jetderiveddatautilities::initialiseTrackSelection(trkSelToString); + triggerMaskBits = jetderiveddatautilities::initialiseTriggerMaskBits(triggerMasks); // List of raw and MC det. distributions if (doprocessData || doprocessMCDetLevel || doprocessMCDetLevelWeighted) { @@ -206,54 +181,54 @@ struct RecoilJets { spectra.add("hTrackPtEtaPhi", "Charact. of tracks", kTH3F, {pT, pseudorap, phiAngle}); spectra.add("hTTSig_pT", "pT spectrum of all found TT_{Sig} cand.", kTH1F, {{40, 10., 50.}}); // needed to distinguish merged data from diff. wagons - spectra.add("hScaledFT0C_vs_Ntrig", "Total number of selected triggers per class vs scaled FT0C", kTH2F, {{multFT0CPercentile}, {2, 0.0, 2.}}); - spectra.get(HIST("hScaledFT0C_vs_Ntrig"))->GetYaxis()->SetBinLabel(1, "TT_{ref}"); - spectra.get(HIST("hScaledFT0C_vs_Ntrig"))->GetYaxis()->SetBinLabel(2, "TT_{sig}"); + spectra.add("hScaledFT0C_vs_Ntrig", "Total number of selected triggers per class vs scaled FT0C", kTH2F, {{multFT0CThresh}, {2, 0.0, 2.}}); + spectra.get(HIST("hScaledFT0C_vs_Ntrig"))->GetYaxis()->SetBinLabel(1, "TT_{ref}"); + spectra.get(HIST("hScaledFT0C_vs_Ntrig"))->GetYaxis()->SetBinLabel(2, "TT_{sig}"); - spectra.add("hScaledFT0M_vs_Ntrig", "Total number of selected triggers per class vs scaled FT0M", kTH2F, {{multFT0MPercentile}, {2, 0.0, 2.}}); - spectra.get(HIST("hScaledFT0M_vs_Ntrig"))->GetYaxis()->SetBinLabel(1, "TT_{ref}"); - spectra.get(HIST("hScaledFT0M_vs_Ntrig"))->GetYaxis()->SetBinLabel(2, "TT_{sig}"); + spectra.add("hScaledFT0M_vs_Ntrig", "Total number of selected triggers per class vs scaled FT0M", kTH2F, {{multFT0MThresh}, {2, 0.0, 2.}}); + spectra.get(HIST("hScaledFT0M_vs_Ntrig"))->GetYaxis()->SetBinLabel(1, "TT_{ref}"); + spectra.get(HIST("hScaledFT0M_vs_Ntrig"))->GetYaxis()->SetBinLabel(2, "TT_{sig}"); - spectra.add("hScaledFT0C_vs_TTRef_per_event", "Number of TT_{Ref} per event vs scaled FT0C", kTH2F, {{multFT0CPercentile}, {15, 0.5, 15.5}}); - spectra.add("hScaledFT0M_vs_TTRef_per_event", "Number of TT_{Ref} per event vs scaled FT0M", kTH2F, {{multFT0MPercentile}, {15, 0.5, 15.5}}); + spectra.add("hScaledFT0C_vs_TTRef_per_event", "Number of TT_{Ref} per event vs scaled FT0C", kTH2F, {{multFT0CThresh}, {15, 0.5, 15.5}}); + spectra.add("hScaledFT0M_vs_TTRef_per_event", "Number of TT_{Ref} per event vs scaled FT0M", kTH2F, {{multFT0MThresh}, {15, 0.5, 15.5}}); - spectra.add("hScaledFT0C_vs_TTSig_per_event", "Number of TT_{Sig} per event vs scaled FT0C", kTH2F, {{multFT0CPercentile}, {10, 0.5, 10.5}}); - spectra.add("hScaledFT0M_vs_TTSig_per_event", "Number of TT_{Sig} per event vs scaled FT0M", kTH2F, {{multFT0MPercentile}, {10, 0.5, 10.5}}); + spectra.add("hScaledFT0C_vs_TTSig_per_event", "Number of TT_{Sig} per event vs scaled FT0C", kTH2F, {{multFT0CThresh}, {10, 0.5, 10.5}}); + spectra.add("hScaledFT0M_vs_TTSig_per_event", "Number of TT_{Sig} per event vs scaled FT0M", kTH2F, {{multFT0MThresh}, {10, 0.5, 10.5}}); spectra.add("hJetPtEtaPhiRhoArea", "Charact. of inclusive jets", kTHnSparseF, {pT, pseudorapJets, phiAngle, rho, jetArea}); - spectra.add("hScaledFT0C_DPhi_JetPt_Corr_TTRef", "Events w. TT_{Ref}: scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0CPercentile, deltaPhiAngle, jetPTcorr}); - spectra.add("hScaledFT0M_DPhi_JetPt_Corr_TTRef", "Events w. TT_{Ref}: scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0MPercentile, deltaPhiAngle, jetPTcorr}); + spectra.add("hScaledFT0C_DPhi_JetPt_Corr_TTRef", "Events w. TT_{Ref}: scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0CThresh, deltaPhiAngle, jetPTcorr}); + spectra.add("hScaledFT0M_DPhi_JetPt_Corr_TTRef", "Events w. TT_{Ref}: scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0MThresh, deltaPhiAngle, jetPTcorr}); - spectra.add("hScaledFT0C_DPhi_JetPt_Corr_TTSig", "Events w. TT_{Sig}: scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0CPercentile, deltaPhiAngle, jetPTcorr}); - spectra.add("hScaledFT0M_DPhi_JetPt_Corr_TTSig", "Events w. TT_{Sig}: scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0MPercentile, deltaPhiAngle, jetPTcorr}); + spectra.add("hScaledFT0C_DPhi_JetPt_Corr_TTSig", "Events w. TT_{Sig}: scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0CThresh, deltaPhiAngle, jetPTcorr}); + spectra.add("hScaledFT0M_DPhi_JetPt_Corr_TTSig", "Events w. TT_{Sig}: scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0MThresh, deltaPhiAngle, jetPTcorr}); - spectra.add("hScaledFT0C_DPhi_JetPt_TTRef", "Events w. TT_{Ref}: scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0CPercentile, deltaPhiAngle, pT}); - spectra.add("hScaledFT0M_DPhi_JetPt_TTRef", "Events w. TT_{Ref}: scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0MPercentile, deltaPhiAngle, pT}); + spectra.add("hScaledFT0C_DPhi_JetPt_TTRef", "Events w. TT_{Ref}: scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0CThresh, deltaPhiAngle, pT}); + spectra.add("hScaledFT0M_DPhi_JetPt_TTRef", "Events w. TT_{Ref}: scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0MThresh, deltaPhiAngle, pT}); - spectra.add("hScaledFT0C_DPhi_JetPt_TTSig", "Events w. TT_{Sig}: scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0CPercentile, deltaPhiAngle, pT}); - spectra.add("hScaledFT0M_DPhi_JetPt_TTSig", "Events w. TT_{Sig}: scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0MPercentile, deltaPhiAngle, pT}); + spectra.add("hScaledFT0C_DPhi_JetPt_TTSig", "Events w. TT_{Sig}: scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0CThresh, deltaPhiAngle, pT}); + spectra.add("hScaledFT0M_DPhi_JetPt_TTSig", "Events w. TT_{Sig}: scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0MThresh, deltaPhiAngle, pT}); - spectra.add("hScaledFT0C_Recoil_JetPt_Corr_TTRef", "Events w. TT_{Ref}: scaled FT0C & #it{p}_{T} of recoil jets", kTH2F, {multFT0CPercentile, jetPTcorr}); - spectra.add("hScaledFT0M_Recoil_JetPt_Corr_TTRef", "Events w. TT_{Ref}: scaled FT0M & #it{p}_{T} of recoil jets", kTH2F, {multFT0MPercentile, jetPTcorr}); + spectra.add("hScaledFT0C_Recoil_JetPt_Corr_TTRef", "Events w. TT_{Ref}: scaled FT0C & #it{p}_{T} of recoil jets", kTH2F, {multFT0CThresh, jetPTcorr}); + spectra.add("hScaledFT0M_Recoil_JetPt_Corr_TTRef", "Events w. TT_{Ref}: scaled FT0M & #it{p}_{T} of recoil jets", kTH2F, {multFT0MThresh, jetPTcorr}); - spectra.add("hScaledFT0C_Recoil_JetPt_Corr_TTSig", "Events w. TT_{Sig}: scaled FT0C & #it{p}_{T} of recoil jets", kTH2F, {multFT0CPercentile, jetPTcorr}); - spectra.add("hScaledFT0M_Recoil_JetPt_Corr_TTSig", "Events w. TT_{Sig}: scaled FT0M & #it{p}_{T} of recoil jets", kTH2F, {multFT0MPercentile, jetPTcorr}); + spectra.add("hScaledFT0C_Recoil_JetPt_Corr_TTSig", "Events w. TT_{Sig}: scaled FT0C & #it{p}_{T} of recoil jets", kTH2F, {multFT0CThresh, jetPTcorr}); + spectra.add("hScaledFT0M_Recoil_JetPt_Corr_TTSig", "Events w. TT_{Sig}: scaled FT0M & #it{p}_{T} of recoil jets", kTH2F, {multFT0MThresh, jetPTcorr}); - spectra.add("hScaledFT0C_Recoil_JetPt_TTRef", "Events w. TT_{Ref}: scaled FT0C & #it{p}_{T} of recoil jets", kTH2F, {multFT0CPercentile, pT}); - spectra.add("hScaledFT0M_Recoil_JetPt_TTRef", "Events w. TT_{Ref}: scaled FT0M & #it{p}_{T} of recoil jets", kTH2F, {multFT0MPercentile, pT}); + spectra.add("hScaledFT0C_Recoil_JetPt_TTRef", "Events w. TT_{Ref}: scaled FT0C & #it{p}_{T} of recoil jets", kTH2F, {multFT0CThresh, pT}); + spectra.add("hScaledFT0M_Recoil_JetPt_TTRef", "Events w. TT_{Ref}: scaled FT0M & #it{p}_{T} of recoil jets", kTH2F, {multFT0MThresh, pT}); - spectra.add("hScaledFT0C_Recoil_JetPt_TTSig", "Events w. TT_{Sig}: scaled FT0C & #it{p}_{T} of recoil jets", kTH2F, {multFT0CPercentile, pT}); - spectra.add("hScaledFT0M_Recoil_JetPt_TTSig", "Events w. TT_{Sig}: scaled FT0M & #it{p}_{T} of recoil jets", kTH2F, {multFT0MPercentile, pT}); + spectra.add("hScaledFT0C_Recoil_JetPt_TTSig", "Events w. TT_{Sig}: scaled FT0C & #it{p}_{T} of recoil jets", kTH2F, {multFT0CThresh, pT}); + spectra.add("hScaledFT0M_Recoil_JetPt_TTSig", "Events w. TT_{Sig}: scaled FT0M & #it{p}_{T} of recoil jets", kTH2F, {multFT0MThresh, pT}); spectra.add("hJetArea_JetPt_Rho_TTRef", "Events w. TT_{Ref}: A_{jet} & jet pT & #rho", kTH3F, {jetArea, pT, rho}); spectra.add("hJetArea_JetPt_Rho_TTSig", "Events w. TT_{Sig}: A_{jet} & jet pT & #rho", kTH3F, {jetArea, pT, rho}); - spectra.add("hScaledFT0C_Rho_TTRef", "Events w. TT_{Ref}: scaled FT0C & #rho", kTH2F, {multFT0CPercentile, rho}); - spectra.add("hScaledFT0M_Rho_TTRef", "Events w. TT_{Ref}: scaled FT0M & #rho", kTH2F, {multFT0MPercentile, rho}); + spectra.add("hScaledFT0C_Rho_TTRef", "Events w. TT_{Ref}: scaled FT0C & #rho", kTH2F, {multFT0CThresh, rho}); + spectra.add("hScaledFT0M_Rho_TTRef", "Events w. TT_{Ref}: scaled FT0M & #rho", kTH2F, {multFT0MThresh, rho}); - spectra.add("hScaledFT0C_Rho_TTSig", "Events w. TT_{Sig}: scaled FT0C & #rho", kTH2F, {multFT0CPercentile, rho}); - spectra.add("hScaledFT0M_Rho_TTSig", "Events w. TT_{Sig}: scaled FT0M & #rho", kTH2F, {multFT0MPercentile, rho}); + spectra.add("hScaledFT0C_Rho_TTSig", "Events w. TT_{Sig}: scaled FT0C & #rho", kTH2F, {multFT0CThresh, rho}); + spectra.add("hScaledFT0M_Rho_TTSig", "Events w. TT_{Sig}: scaled FT0M & #rho", kTH2F, {multFT0MThresh, rho}); spectra.add("hScaledFT0C_TTRef", "Events w. TT_{Ref}: scaled FT0C", kTH1F, {scaledFT0C}); spectra.add("hScaledFT0M_TTRef", "Events w. TT_{Ref}: scaled FT0M", kTH1F, {scaledFT0M}); @@ -306,22 +281,17 @@ struct RecoilJets { // spectra.add("hJetPt_Corr_PartLevel_vs_DetLevel", "Correlation jet pT at // part. vs. det. levels", kTH2F, {jetPTcorr, jetPTcorr}); spectra.add("hJetPt_DetLevel_vs_PartLevel_RecoilJets", "Correlation recoil jet pT at part. vs. det. levels", kTH2F, {{200, 0.0, 200.}, {200, 0.0, 200.}}); - // spectra.add("hJetPt_Corr_PartLevel_vs_DetLevel_RecoilJets", - // "Correlation recoil jet pT at part. vs. det. levels", kTH2F, - // {jetPTcorr, jetPTcorr}); + // spectra.add("hJetPt_Corr_PartLevel_vs_DetLevel_RecoilJets", "Correlation recoil jet pT at part. vs. det. levels", kTH2F, {jetPTcorr, jetPTcorr}); spectra.add("hMissedJets_pT", "Part. level jets w/o matched pair", kTH1F, {{200, 0.0, 200.}}); - // spectra.add("hMissedJets_Corr_pT", "Part. level jets w/o matched pair", - // kTH1F, {jetPTcorr}); + // spectra.add("hMissedJets_Corr_pT", "Part. level jets w/o matched pair", kTH1F, {jetPTcorr}); spectra.add("hMissedJets_pT_RecoilJets", "Part. level jets w/o matched pair", kTH1F, {{200, 0.0, 200.}}); - // spectra.add("hMissedJets_Corr_pT_RecoilJets", "Part. level jets w/o - // matched pair", kTH1F, {jetPTcorr}); + // spectra.add("hMissedJets_Corr_pT_RecoilJets", "Part. level jets w/o matched pair", kTH1F, {jetPTcorr}); + spectra.add("hFakeJets_pT", "Det. level jets w/o matched pair", kTH1F, {{200, 0.0, 200.}}); - // spectra.add("hFakeJets_Corr_pT", "Det. level jets w/o matched pair", - // kTH1F, {jetPTcorr}); + // spectra.add("hFakeJets_Corr_pT", "Det. level jets w/o matched pair", kTH1F, {jetPTcorr}); spectra.add("hFakeJets_pT_RecoilJets", "Det. level jets w/o matched pair", kTH1F, {{200, 0.0, 200.}}); - // spectra.add("hFakeJets_Corr_pT_RecoilJets", "Det. level jets w/o - // matched pair", kTH1F, {jetPTcorr}); + // spectra.add("hFakeJets_Corr_pT_RecoilJets", "Det. level jets w/o matched pair", kTH1F, {jetPTcorr}); spectra.add("hJetPt_resolution", "Jet p_{T} relative resolution as a func. of jet #it{p}_{T, part}", kTH2F, {{100, -5., 5.}, pT}); spectra.add("hJetPt_resolution_RecoilJets", "Jet p_{T} relative resolution as a func. of jet #it{p}_{T, part}", kTH2F, {{100, -5., 5.}, pT}); @@ -353,6 +323,7 @@ struct RecoilJets { spectra.add("hScaleMultFT0A_vs_ZNA", "Correlation of signals FT0A/meanFT0A vs ZNA", kTH2F, {{200, 0.0, 20., "FT0A / #LT FT0A #GT"}, {1000, 0.0, 5000.}}); spectra.add("hScaleMultFT0C_vs_ZNC", "Correlation of signals FT0C/meanFT0C vs ZNC", kTH2F, {{scaledFT0C}, {1000, 0.0, 5000.}}); spectra.add("hScaleMultFT0M_vs_ZNM", "Correlation of signals FT0M^{*} vs ZNM", kTH2F, {{scaledFT0M}, {4000, 0.0, 8000.}}); + spectra.add("hScaleMultFT0M_vs_ZNA_vs_ZNC", "Correlation of signals FT0M^{*} vs ZNA vs ZNC", kTH3F, {{scaledFT0M}, {1000, 0.0, 5000.}, {1000, 0.0, 5000.}}); } } @@ -516,22 +487,23 @@ struct RecoilJets { if (!pdgParticle) continue; + float particlePt = particle.pt(); + // Need charge and physical primary particles bool bParticleNeutral = (static_cast(pdgParticle->Charge()) == 0); if (bParticleNeutral || !particle.isPhysicalPrimary()) continue; - spectra.fill(HIST("hPartPtEtaPhi"), particle.pt(), particle.eta(), - particle.phi(), weight); + spectra.fill(HIST("hPartPtEtaPhi"), particlePt, particle.eta(), particle.phi(), weight); if (bSigEv && - (particle.pt() > ptTTsigMin && particle.pt() < ptTTsigMax)) { + (particlePt > ptTTsigMin && particlePt < ptTTsigMax)) { vPhiOfTT.push_back(particle.phi()); ++nTT; } if (!bSigEv && - (particle.pt() > ptTTrefMin && particle.pt() < ptTTrefMax)) { + (particlePt > ptTTrefMin && particlePt < ptTTrefMax)) { vPhiOfTT.push_back(particle.phi()); ++nTT; } @@ -658,6 +630,7 @@ struct RecoilJets { spectra.fill(HIST("hScaleMultFT0A_vs_ZNA"), scaledFT0A, multZNA, weight); spectra.fill(HIST("hScaleMultFT0C_vs_ZNC"), scaledFT0C, multZNC, weight); spectra.fill(HIST("hScaleMultFT0M_vs_ZNM"), scaledFT0M, multZNM, weight); + spectra.fill(HIST("hScaleMultFT0M_vs_ZNA_vs_ZNC"), scaledFT0M, multZNA, multZNC, weight); } //------------------------------------------------------------------------------ From 69d75dfa2428a999b701b5a921875765fe7f64a3 Mon Sep 17 00:00:00 2001 From: dajones2 <140733426+dajones2@users.noreply.github.com> Date: Mon, 1 Sep 2025 10:07:42 +0100 Subject: [PATCH 260/986] [PWGJE] Adding Sumw2 option for filling with weights (#12762) --- PWGJE/Tasks/jetHadronRecoil.cxx | 124 ++++++++++++++++---------------- 1 file changed, 63 insertions(+), 61 deletions(-) diff --git a/PWGJE/Tasks/jetHadronRecoil.cxx b/PWGJE/Tasks/jetHadronRecoil.cxx index becdfafb2bc..81e2ae5893d 100644 --- a/PWGJE/Tasks/jetHadronRecoil.cxx +++ b/PWGJE/Tasks/jetHadronRecoil.cxx @@ -81,6 +81,7 @@ struct JetHadronRecoil { Configurable triggerMasks{"triggerMasks", "", "possible JE Trigger masks: fJetChLowPt,fJetChHighPt,fTrackLowPt,fTrackHighPt,fJetD0ChLowPt,fJetD0ChHighPt,fJetLcChLowPt,fJetLcChHighPt,fEMCALReadout,fJetFullHighPt,fJetFullLowPt,fJetNeutralHighPt,fJetNeutralLowPt,fGammaVeryHighPtEMCAL,fGammaVeryHighPtDCAL,fGammaHighPtEMCAL,fGammaHighPtDCAL,fGammaLowPtEMCAL,fGammaLowPtDCAL,fGammaVeryLowPtEMCAL,fGammaVeryLowPtDCAL"}; Configurable skipMBGapEvents{"skipMBGapEvents", false, "flag to choose to reject min. bias gap events; jet-level rejection applied at the jet finder level, here rejection is applied for collision and track process functions"}; Configurable outlierRejectEvent{"outlierRejectEvent", true, "where outliers are found, reject event (true) or just reject the single track/jet (false)"}; + Configurable doSumw{"doSumw", false, "enable sumw2 for weighted histograms"}; TRandom3* rand = new TRandom3(0); @@ -136,77 +137,78 @@ struct JetHadronRecoil { jetReclusterer.jetR = 2 * jetR; jetReclusterer.recombScheme = fastjet::WTA_pt_scheme; + registry.add("hZvtxSelected", "Z vertex position;Z_{vtx};entries", {HistType::kTH1F, {{80, -20, 20}}}, doSumw); + if (doprocessData || doprocessDataWithRhoSubtraction || doprocessMCD || doprocessMCDWithRhoSubtraction || doprocessMCDWeighted || doprocessMCDWeightedWithRhoSubtraction || doprocessMCP || doprocessMCPWeighted) { - registry.add("hNtrig", "number of triggers;trigger type;entries", {HistType::kTH1F, {{2, 0, 2}}}); - registry.add("hSignalTriggersPtHard", "Signal triggers vs PtHard", {HistType::kTH1F, {{20, 0, 5}}}); - registry.add("hReferenceTriggersPtHard", "Reference triggers vs PtHard", {HistType::kTH1F, {{20, 0, 5}}}); - registry.add("hZvtxSelected", "Z vertex position;Z_{vtx};entries", {HistType::kTH1F, {{80, -20, 20}}}); - registry.add("hConstituents3D", "3D constituents histogram;p_{T};#eta;#phi", {HistType::kTH3F, {{200, 0, 200}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}); - registry.add("hReferencePtDPhi", "jet p_{T} vs DPhi;#Delta#phi;p_{T,jet}", {HistType::kTH2F, {{100, 0, o2::constants::math::TwoPI}, {500, -100, 400}}}); - registry.add("hReferencePtDPhiShifts", "rho shifts;#Delta#phi;p_{T,jet};shifts", {HistType::kTH3F, {{100, 0, o2::constants::math::TwoPI}, {500, -100, 400}, {20, 0.0, 2.0}}}); - registry.add("hSignalPtDPhi", "jet p_{T} vs DPhi;#Delta#phi;p_{T,jet}", {HistType::kTH2F, {{100, 0, o2::constants::math::TwoPI}, {500, -100, 400}}}); - registry.add("hReferencePt", "jet p_{T};p_{T,jet};entries", {HistType::kTH1F, {{500, -100, 400}}}); - registry.add("hSignalPt", "jet p_{T};p_{T,jet};entries", {HistType::kTH1F, {{500, -100, 400}}}); - registry.add("hSignalTriggers", "trigger p_{T};p_{T,trig};entries", {HistType::kTH1F, {{150, 0, 150}}}); - registry.add("hSignalPtHard", "jet p_{T} vs #hat{p};p_{T,jet};#frac{p_{T,trig}}{#hat{p}}", {HistType::kTH2F, {{500, -100, 400}, {20, 0, 5}}}); - registry.add("hReferenceTriggers", "trigger p_{T};p_{T,trig};entries", {HistType::kTH1F, {{150, 0, 150}}}); - registry.add("hReferencePtHard", "jet p_{T} vs #hat{p};p_{T,jet};#frac{p_{T,trig}}{#hat{p}}", {HistType::kTH2F, {{500, -100, 400}, {20, 0, 5}}}); - registry.add("hSigEventTriggers", "N_{triggers};events", {HistType::kTH1F, {{10, 0, 10}}}); - registry.add("hRefEventTriggers", "N_{triggers};events", {HistType::kTH1F, {{10, 0, 10}}}); - registry.add("hJetPt", "jet p_{T};p_{T,jet};entries", {HistType::kTH1F, {{500, -100, 400}}}); - registry.add("hJetEta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}); - registry.add("hJetPhi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{100, 0.0, o2::constants::math::TwoPI}}}); - registry.add("hJet3D", "3D jet distribution;p_{T};#eta;#phi", {HistType::kTH3F, {{500, -100, 400}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}); + registry.add("hNtrig", "number of triggers;trigger type;entries", {HistType::kTH1F, {{2, 0, 2}}}, doSumw); + registry.add("hSignalTriggersPtHard", "Signal triggers vs PtHard", {HistType::kTH1F, {{20, 0, 5}}}, doSumw); + registry.add("hReferenceTriggersPtHard", "Reference triggers vs PtHard", {HistType::kTH1F, {{20, 0, 5}}}, doSumw); + registry.add("hConstituents3D", "3D constituents histogram;p_{T};#eta;#phi", {HistType::kTH3F, {{200, 0, 200}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}, doSumw); + registry.add("hReferencePtDPhi", "jet p_{T} vs DPhi;#Delta#phi;p_{T,jet}", {HistType::kTH2F, {{100, 0, o2::constants::math::TwoPI}, {500, -100, 400}}}, doSumw); + registry.add("hReferencePtDPhiShifts", "rho shifts;#Delta#phi;p_{T,jet};shifts", {HistType::kTH3F, {{100, 0, o2::constants::math::TwoPI}, {500, -100, 400}, {20, 0.0, 2.0}}}, doSumw); + registry.add("hSignalPtDPhi", "jet p_{T} vs DPhi;#Delta#phi;p_{T,jet}", {HistType::kTH2F, {{100, 0, o2::constants::math::TwoPI}, {500, -100, 400}}}, doSumw); + registry.add("hReferencePt", "jet p_{T};p_{T,jet};entries", {HistType::kTH1F, {{500, -100, 400}}}, doSumw); + registry.add("hSignalPt", "jet p_{T};p_{T,jet};entries", {HistType::kTH1F, {{500, -100, 400}}}, doSumw); + registry.add("hSignalTriggers", "trigger p_{T};p_{T,trig};entries", {HistType::kTH1F, {{150, 0, 150}}}, doSumw); + registry.add("hSignalPtHard", "jet p_{T} vs #hat{p};p_{T,jet};#frac{p_{T,trig}}{#hat{p}}", {HistType::kTH2F, {{500, -100, 400}, {20, 0, 5}}}, doSumw); + registry.add("hReferenceTriggers", "trigger p_{T};p_{T,trig};entries", {HistType::kTH1F, {{150, 0, 150}}}, doSumw); + registry.add("hReferencePtHard", "jet p_{T} vs #hat{p};p_{T,jet};#frac{p_{T,trig}}{#hat{p}}", {HistType::kTH2F, {{500, -100, 400}, {20, 0, 5}}}, doSumw); + registry.add("hSigEventTriggers", "N_{triggers};events", {HistType::kTH1F, {{10, 0, 10}}}, doSumw); + registry.add("hRefEventTriggers", "N_{triggers};events", {HistType::kTH1F, {{10, 0, 10}}}, doSumw); + registry.add("hJetPt", "jet p_{T};p_{T,jet};entries", {HistType::kTH1F, {{500, -100, 400}}}, doSumw); + registry.add("hJetEta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}, doSumw); + registry.add("hJetPhi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{100, 0.0, o2::constants::math::TwoPI}}}, doSumw); + registry.add("hJet3D", "3D jet distribution;p_{T};#eta;#phi", {HistType::kTH3F, {{500, -100, 400}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}, doSumw); } if (doprocessData || doprocessDataWithRhoSubtraction || doprocessMCD || doprocessMCDWithRhoSubtraction || doprocessMCDWeighted || doprocessMCDWeightedWithRhoSubtraction) { - registry.add("hPtTrack", "Track p_{T};p_{T};entries", {HistType::kTH1F, {{200, 0, 200}}}); - registry.add("hEtaTrack", "Track #eta;#eta;entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}); - registry.add("hPhiTrack", "Track #phi;#phi;entries", {HistType::kTH1F, {{100, 0.0, o2::constants::math::TwoPI}}}); - registry.add("hTrack3D", "3D tracks histogram;p_{T};#eta;#phi", {HistType::kTH3F, {{200, 0, 200}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}); - registry.add("hPtTrackPtHard", "Tracks vs pThard;#frac{p_{T}}{#hat{p}};p_{T}", {HistType::kTH2F, {{20, 0, 5}, {200, 0, 200}}}); - registry.add("hTracksvsJets", "comparing leading tracks and jets;p_{T,track};p_{T,jet};#hat{p}", {HistType::kTH3F, {{200, 0, 200}, {500, -100, 400}, {195, 5, 200}}}); - registry.add("hDeltaR", "#DeltaR;#DeltaR;#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}); - registry.add("hDeltaRpT", "jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{500, -100, 400}, dRAxis}}); - registry.add("hRhoSignal", "Signal Rho bkg;#rho;entries", {HistType::kTH1F, {{220, 0, 220}}}); - registry.add("hRhoReference", "Reference Rho bkg;#rho;entries", {HistType::kTH1F, {{220, 0, 220}}}); - registry.add("hRhoReferenceShift", "Testing reference shifts;#rho;shift", {HistType::kTH2F, {{220, 0, 220}, {20, 0.0, 2.0}}}); - registry.add("hDeltaRSignal", "#DeltaR;#DeltaR;#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}); - registry.add("hDeltaRpTSignal", "jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{500, -100, 400}, dRAxis}}); - registry.add("hDeltaRpTDPhiSignal", "jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{500, -100, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis}}); - registry.add("hDeltaRReference", "#DeltaR;#DeltaR;#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}); - registry.add("hDeltaRpTReference", "jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{500, -100, 400}, dRAxis}}); - registry.add("hDeltaRpTDPhiReference", "jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{500, -100, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis}}); - registry.add("hDeltaRpTDPhiReferenceShifts", "testing shifts;p_{T,jet};#Delta#phi;#DeltaR;shifts", {HistType::kTHnSparseD, {{500, -100, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis, {20, 0.0, 2.0}}}); + registry.add("hPtTrack", "Track p_{T};p_{T};entries", {HistType::kTH1F, {{200, 0, 200}}}, doSumw); + registry.add("hEtaTrack", "Track #eta;#eta;entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}, doSumw); + registry.add("hPhiTrack", "Track #phi;#phi;entries", {HistType::kTH1F, {{100, 0.0, o2::constants::math::TwoPI}}}, doSumw); + registry.add("hTrack3D", "3D tracks histogram;p_{T};#eta;#phi", {HistType::kTH3F, {{200, 0, 200}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}, doSumw); + registry.add("hPtTrackPtHard", "Tracks vs pThard;#frac{p_{T}}{#hat{p}};p_{T}", {HistType::kTH2F, {{20, 0, 5}, {200, 0, 200}}}, doSumw); + registry.add("hTracksvsJets", "comparing leading tracks and jets;p_{T,track};p_{T,jet};#hat{p}", {HistType::kTH3F, {{200, 0, 200}, {500, -100, 400}, {195, 5, 200}}}, doSumw); + registry.add("hDeltaR", "#DeltaR;#DeltaR;#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}, doSumw); + registry.add("hDeltaRpT", "jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{500, -100, 400}, dRAxis}}, doSumw); + registry.add("hRhoSignal", "Signal Rho bkg;#rho;entries", {HistType::kTH1F, {{220, 0, 220}}}, doSumw); + registry.add("hRhoReference", "Reference Rho bkg;#rho;entries", {HistType::kTH1F, {{220, 0, 220}}}, doSumw); + registry.add("hRhoReferenceShift", "Testing reference shifts;#rho;shift", {HistType::kTH2F, {{220, 0, 220}, {20, 0.0, 2.0}}}, doSumw); + registry.add("hDeltaRSignal", "#DeltaR;#DeltaR;#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}, doSumw); + registry.add("hDeltaRpTSignal", "jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{500, -100, 400}, dRAxis}}, doSumw); + registry.add("hDeltaRpTDPhiSignal", "jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{500, -100, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis}}, doSumw); + registry.add("hDeltaRReference", "#DeltaR;#DeltaR;#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}, doSumw); + registry.add("hDeltaRpTReference", "jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{500, -100, 400}, dRAxis}}, doSumw); + registry.add("hDeltaRpTDPhiReference", "jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{500, -100, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis}}, doSumw); + registry.add("hDeltaRpTDPhiReferenceShifts", "testing shifts;p_{T,jet};#Delta#phi;#DeltaR;shifts", {HistType::kTHnSparseD, {{500, -100, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis, {20, 0.0, 2.0}}}, doSumw); } if (doprocessMCP || doprocessMCPWeighted) { - registry.add("hPartvsJets", "comparing leading particles and jets;p_{T,part};p_{T,jet};#hat{p}", {HistType::kTH3F, {{200, 0, 200}, {500, -100, 400}, {195, 5, 200}}}); - registry.add("hPtPart", "Particle p_{T};p_{T};entries", {HistType::kTH1F, {{200, 0, 200}}}); - registry.add("hEtaPart", "Particle #eta;#eta;entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}); - registry.add("hPhiPart", "Particle #phi;#phi;entries", {HistType::kTH1F, {{100, 0.0, o2::constants::math::TwoPI}}}); - registry.add("hPart3D", "3D tracks histogram;p_{T};#eta;#phi", {HistType::kTH3F, {{200, 0, 200}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}); - registry.add("hPtPartPtHard", "Track p_{T} vs #hat{p};p_{T};#frac{p_{T}}{#hat{p}}", {HistType::kTH2F, {{200, 0, 200}, {20, 0, 5}}}); - registry.add("hDeltaRPart", "Particle #DeltaR;#DeltaR;#frac{1}{N_{jets}}#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}); - registry.add("hDeltaRpTPart", "Particle jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{400, 0, 400}, dRAxis}}); - registry.add("hDeltaRSignalPart", "Particle #DeltaR;#DeltaR;#frac{1}{N_{jets}}#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}); - registry.add("hDeltaRpTSignalPart", "Particle jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{400, 0, 400}, dRAxis}}); - registry.add("hDeltaRpTDPhiSignalPart", "Particle jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{400, 0, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis}}); - registry.add("hDeltaRPartReference", "Particle #DeltaR;#DeltaR;#frac{1}{N_{jets}}#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}); - registry.add("hDeltaRpTPartReference", "Particle jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{400, 0, 400}, dRAxis}}); - registry.add("hDeltaRpTDPhiReferencePart", "jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{400, 0, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis}}); + registry.add("hPartvsJets", "comparing leading particles and jets;p_{T,part};p_{T,jet};#hat{p}", {HistType::kTH3F, {{200, 0, 200}, {500, -100, 400}, {195, 5, 200}}}, doSumw); + registry.add("hPtPart", "Particle p_{T};p_{T};entries", {HistType::kTH1F, {{200, 0, 200}}}, doSumw); + registry.add("hEtaPart", "Particle #eta;#eta;entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}, doSumw); + registry.add("hPhiPart", "Particle #phi;#phi;entries", {HistType::kTH1F, {{100, 0.0, o2::constants::math::TwoPI}}}, doSumw); + registry.add("hPart3D", "3D tracks histogram;p_{T};#eta;#phi", {HistType::kTH3F, {{200, 0, 200}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}, doSumw); + registry.add("hPtPartPtHard", "Track p_{T} vs #hat{p};p_{T};#frac{p_{T}}{#hat{p}}", {HistType::kTH2F, {{200, 0, 200}, {20, 0, 5}}}, doSumw); + registry.add("hDeltaRPart", "Particle #DeltaR;#DeltaR;#frac{1}{N_{jets}}#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}, doSumw); + registry.add("hDeltaRpTPart", "Particle jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{400, 0, 400}, dRAxis}}, doSumw); + registry.add("hDeltaRSignalPart", "Particle #DeltaR;#DeltaR;#frac{1}{N_{jets}}#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}, doSumw); + registry.add("hDeltaRpTSignalPart", "Particle jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{400, 0, 400}, dRAxis}}, doSumw); + registry.add("hDeltaRpTDPhiSignalPart", "Particle jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{400, 0, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis}}, doSumw); + registry.add("hDeltaRPartReference", "Particle #DeltaR;#DeltaR;#frac{1}{N_{jets}}#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}, doSumw); + registry.add("hDeltaRpTPartReference", "Particle jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{400, 0, 400}, dRAxis}}, doSumw); + registry.add("hDeltaRpTDPhiReferencePart", "jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{400, 0, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis}}, doSumw); } if (doprocessJetsMCPMCDMatched || doprocessJetsMCPMCDMatchedWithRhoSubtraction || doprocessJetsMCPMCDMatchedWeighted || doprocessJetsMCPMCDMatchedWeightedWithRhoSubtraction || doprocessRecoilJetsMCPMCDMatched || doprocessRecoilJetsMCPMCDMatchedWeighted) { - registry.add("hPtMatched", "p_{T} matching;p_{T,det};p_{T,part}", {HistType::kTH2F, {{500, -100, 400}, {400, 0, 400}}}); - registry.add("hPhiMatched", "#phi matching;#phi_{det};#phi_{part}", {HistType::kTH2F, {{100, 0.0, o2::constants::math::TwoPI}, {100, 0.0, o2::constants::math::TwoPI}}}); - registry.add("hDeltaRMatched", "#DeltaR matching;#DeltaR_{det};#DeltaR_{part}", {HistType::kTH2F, {dRAxisDet, dRAxisPart}}); - registry.add("hPtMatched1d", "p_{T} matching 1d;p_{T,part}", {HistType::kTH1F, {{400, 0, 400}}}); - registry.add("hDeltaRMatched1d", "#DeltaR matching 1d;#DeltaR_{part}", {HistType::kTH1F, {dRAxisPart}}); - registry.add("hPtResolution", "p_{T} resolution;p_{T,part};Relative Resolution", {HistType::kTH2F, {{400, 0, 400}, {1000, -5.0, 5.0}}}); - registry.add("hPhiResolution", "#phi resolution;#p_{T,part};Resolution", {HistType::kTH2F, {{400, 0, 400}, {1000, -7.0, 7.0}}}); - registry.add("hDeltaRResolution", "#DeltaR Resolution;p_{T,part};Resolution", {HistType::kTH2F, {{400, 0, 400}, {1000, -0.15, 0.15}}}); - registry.add("hFullMatching", "Full 6D matching;p_{T,det};p_{T,part};#phi_{det};#phi_{part};#DeltaR_{det};#DeltaR_{part}", {HistType::kTHnSparseD, {ptAxisDet, ptAxisPart, phiAxisDet, phiAxisPart, dRAxisDet, dRAxisPart}}); + registry.add("hPtMatched", "p_{T} matching;p_{T,det};p_{T,part}", {HistType::kTH2F, {{500, -100, 400}, {400, 0, 400}}}, doSumw); + registry.add("hPhiMatched", "#phi matching;#phi_{det};#phi_{part}", {HistType::kTH2F, {{100, 0.0, o2::constants::math::TwoPI}, {100, 0.0, o2::constants::math::TwoPI}}}, doSumw); + registry.add("hDeltaRMatched", "#DeltaR matching;#DeltaR_{det};#DeltaR_{part}", {HistType::kTH2F, {dRAxisDet, dRAxisPart}}, doSumw); + registry.add("hPtMatched1d", "p_{T} matching 1d;p_{T,part}", {HistType::kTH1F, {{400, 0, 400}}}, doSumw); + registry.add("hDeltaRMatched1d", "#DeltaR matching 1d;#DeltaR_{part}", {HistType::kTH1F, {dRAxisPart}}, doSumw); + registry.add("hPtResolution", "p_{T} resolution;p_{T,part};Relative Resolution", {HistType::kTH2F, {{400, 0, 400}, {1000, -5.0, 5.0}}}, doSumw); + registry.add("hPhiResolution", "#phi resolution;#p_{T,part};Resolution", {HistType::kTH2F, {{400, 0, 400}, {1000, -7.0, 7.0}}}, doSumw); + registry.add("hDeltaRResolution", "#DeltaR Resolution;p_{T,part};Resolution", {HistType::kTH2F, {{400, 0, 400}, {1000, -0.15, 0.15}}}, doSumw); + registry.add("hFullMatching", "Full 6D matching;p_{T,det};p_{T,part};#phi_{det};#phi_{part};#DeltaR_{det};#DeltaR_{part}", {HistType::kTHnSparseD, {ptAxisDet, ptAxisPart, phiAxisDet, phiAxisPart, dRAxisDet, dRAxisPart}}, doSumw); } } From 1bce44065035509df40f092a06ce9e79333fb935 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Mon, 1 Sep 2025 11:07:46 +0200 Subject: [PATCH 261/986] [Infrastructure] Codeowners update due 1st September (#12808) --- CODEOWNERS | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index 4f9a459285d..5ad68945cbe 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -29,28 +29,29 @@ /EventFiltering/PWGCF @alibuild @lauraser @mpuccio @lietava /EventFiltering/PWGMM @alibuild @aortizve @mpuccio @lietava /EventFiltering/PWGJE @alibuild @fkrizek @nzardosh @mpuccio @lietava + /PWGCF @alibuild @victor-gonzalez @zchochul @lgraczykCern @prchakra @lauraser @ariedel-cern @EmilGorm @otonvd @shouqiye @glromane /PWGCF/Core @alibuild @jgrosseo @victor-gonzalez @zchochul @lgraczykCern @prchakra @lauraser @ariedel-cern @EmilGorm @otonvd @shouqiye @glromane /PWGCF/DataModel @alibuild @jgrosseo @victor-gonzalez @zchochul @lgraczykCern @prchakra @lauraser @ariedel-cern @EmilGorm @otonvd @shouqiye @glromane /PWGCF/TableProducer @alibuild @jgrosseo @victor-gonzalez @zchochul @lgraczykCern @prchakra @lauraser @ariedel-cern @EmilGorm @otonvd @shouqiye @glromane /PWGCF/Tasks @alibuild @jgrosseo @victor-gonzalez @zchochul @lgraczykCern @prchakra @lauraser @ariedel-cern @EmilGorm @otonvd @shouqiye @glromane -/PWGDQ @alibuild @iarsene @mcoquet642 @lucamicheletti93 +/PWGDQ @alibuild @iarsene @mcoquet642 @lucamicheletti93 @XiaozhiBai /PWGEM @alibuild @feisenhu @dsekihat @ivorobye /PWGEM/Dilepton @alibuild @mikesas @rbailhac @dsekihat @ivorobye @feisenhu @hscheid /PWGEM/PhotonMeson @alibuild @mikesas @rbailhac @m-c-danisch @novitzky @mhemmer-cern @dsekihat /PWGHF @alibuild @vkucera @fcolamar @fgrosa @fcatalan92 @mfaggin @mmazzilli @deepathoms @NicoleBastid @hahassan7 @jpxrk @apalasciano @zhangbiao-phy @gluparel @stefanopolitano # PWG-LF -/PWGLF @alibuild @sustripathy @skundu692 -/PWGLF/DataModel @alibuild @sustripathy @skundu692 @gbencedi @abmodak @fmazzasc @maciacco @dmallick2 @smaff92 @ercolessi @romainschotter -/PWGLF/Tasks/GlobalEventProperties @alibuild @sustripathy @skundu692 @gbencedi @abmodak @omvazque -/PWGLF/TableProducer/GlobalEventProperties @alibuild @sustripathy @skundu692 @gbencedi @abmodak @omvazque -/PWGLF/Tasks/Nuspex @alibuild @sustripathy @skundu692 @fmazzasc @maciacco -/PWGLF/TableProducer/Nuspex @alibuild @sustripathy @skundu692 @fmazzasc @maciacco -/PWGLF/Tasks/Resonances @alibuild @sustripathy @skundu692 @dmallick2 @smaff92 -/PWGLF/TableProducer/Resonances @alibuild @sustripathy @skundu692 @dmallick2 @smaff92 -/PWGLF/Tasks/Strangeness @alibuild @sustripathy @skundu692 @ercolessi @romainschotter -/PWGLF/TableProducer/Strangeness @alibuild @sustripathy @skundu692 @ercolessi @romainschotter -/PWGLF/Utils @alibuild @sustripathy @skundu692 @gbencedi @abmodak @fmazzasc @maciacco @dmallick2 @smaff92 @ercolessi @romainschotter +/PWGLF @alibuild @sustripathy @skundu692 @mpuccio +/PWGLF/DataModel @alibuild @sustripathy @skundu692 @mpuccio @gbencedi @abmodak @fmazzasc @maciacco @dmallick2 @smaff92 @ercolessi @romainschotter +/PWGLF/Tasks/GlobalEventProperties @alibuild @sustripathy @skundu692 @mpuccio @gbencedi @abmodak @omvazque +/PWGLF/TableProducer/GlobalEventProperties @alibuild @sustripathy @skundu692 @mpuccio @gbencedi @abmodak @omvazque +/PWGLF/Tasks/Nuspex @alibuild @sustripathy @skundu692 @mpuccio @fmazzasc @maciacco +/PWGLF/TableProducer/Nuspex @alibuild @sustripathy @skundu692 @mpuccio @fmazzasc @maciacco +/PWGLF/Tasks/Resonances @alibuild @sustripathy @skundu692 @mpuccio @dmallick2 @smaff92 +/PWGLF/TableProducer/Resonances @alibuild @sustripathy @skundu692 @mpuccio @dmallick2 @smaff92 +/PWGLF/Tasks/Strangeness @alibuild @sustripathy @skundu692 @mpuccio @ercolessi @romainschotter +/PWGLF/TableProducer/Strangeness @alibuild @sustripathy @mpuccio @skundu692 @ercolessi @romainschotter +/PWGLF/Utils @alibuild @sustripathy @skundu692 @mpuccio @gbencedi @abmodak @fmazzasc @maciacco @dmallick2 @smaff92 @ercolessi @romainschotter # PWG-MM (fused with LF, LF conveners included. Directories to be merged in the future) /PWGMM @alibuild @sustripathy @skundu692 @aalkin @jgcn From 81e64bb7f8ad5faad3d5100e335c7974c982d382 Mon Sep 17 00:00:00 2001 From: ynishida-style Date: Mon, 1 Sep 2025 18:08:04 +0900 Subject: [PATCH 262/986] [PWGJE] Stopped using the CPU-intensive rho_estimator in processProductionRatio (#12763) --- PWGJE/Tasks/jetShape.cxx | 60 +++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 35 deletions(-) diff --git a/PWGJE/Tasks/jetShape.cxx b/PWGJE/Tasks/jetShape.cxx index 55782d2c3b5..58741ddd769 100644 --- a/PWGJE/Tasks/jetShape.cxx +++ b/PWGJE/Tasks/jetShape.cxx @@ -260,7 +260,7 @@ struct JetShapeTask { } PROCESS_SWITCH(JetShapeTask, processJetShape, "JetShape", true); - void processProductionRatio(soa::Filtered>::iterator const& collision, soa::Join const& tracks, soa::Join const& jets) + void processProductionRatio(soa::Filtered::iterator const& collision, soa::Join const& tracks, soa::Join const& jets) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { return; @@ -268,46 +268,36 @@ struct JetShapeTask { registry.fill(HIST("event/vertexz"), collision.posZ()); - std::vector::iterator> goodTracks; - for (auto it = tracks.begin(); it != tracks.end(); ++it) { - const auto& track = *it; - - registry.fill(HIST("trackTpcNClsCrossedRows"), track.tpcNClsCrossedRows()); - registry.fill(HIST("trackDcaXY"), track.dcaXY()); - registry.fill(HIST("trackItsChi2NCl"), track.itsChi2NCl()); - registry.fill(HIST("trackTpcChi2NCl"), track.tpcChi2NCl()); - registry.fill(HIST("trackTpcNClsFound"), track.tpcNClsFound()); - registry.fill(HIST("trackItsNCls"), track.itsNCls()); - registry.fill(HIST("trackEta"), track.eta()); - registry.fill(HIST("trackPhi"), track.phi()); - - if (std::abs(track.eta()) > etaTrUp) - continue; - if (track.tpcNClsCrossedRows() < nclcrossTpcMin) - continue; - if (std::abs(track.dcaXY()) > dcaxyMax) - continue; - if (track.itsChi2NCl() > chi2ItsMax) - continue; - if (track.tpcChi2NCl() > chi2TpcMax) - continue; - if (track.tpcNClsFound() < nclTpcMin) - continue; - if (track.itsNCls() < nclItsMin) - continue; - - goodTracks.push_back(it); - } - for (auto const& jet : jets) { if (!isAcceptedJet(jet)) { continue; } // tracks conditions - for (const auto& track_it : goodTracks) { - - const auto& track = *track_it; + for (const auto& track : tracks) { + registry.fill(HIST("trackTpcNClsCrossedRows"), track.tpcNClsCrossedRows()); + registry.fill(HIST("trackDcaXY"), track.dcaXY()); + registry.fill(HIST("trackItsChi2NCl"), track.itsChi2NCl()); + registry.fill(HIST("trackTpcChi2NCl"), track.tpcChi2NCl()); + registry.fill(HIST("trackTpcNClsFound"), track.tpcNClsFound()); + registry.fill(HIST("trackItsNCls"), track.itsNCls()); + registry.fill(HIST("trackEta"), track.eta()); + registry.fill(HIST("trackPhi"), track.phi()); + + if (std::abs(track.eta()) > etaTrUp) + continue; + if (track.tpcNClsCrossedRows() < nclcrossTpcMin) + continue; + if (std::abs(track.dcaXY()) > dcaxyMax) + continue; + if (track.itsChi2NCl() > chi2ItsMax) + continue; + if (track.tpcChi2NCl() > chi2TpcMax) + continue; + if (track.tpcNClsFound() < nclTpcMin) + continue; + if (track.itsNCls() < nclItsMin) + continue; // PID check registry.fill(HIST("tofMass"), track.mass()); From 0527dac0b1650dde4672e2895f5303a6c4438fec Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Mon, 1 Sep 2025 12:20:39 +0200 Subject: [PATCH 263/986] [PWGHF] Add possibility to avoid D0 daus swapping in D* ML application (#12812) Co-authored-by: ALICE Action Bot --- PWGHF/Core/HfMlResponseDstarToD0Pi.h | 82 +++++++++---------- .../candidateSelectorDstarToD0Pi.cxx | 3 +- 2 files changed, 43 insertions(+), 42 deletions(-) diff --git a/PWGHF/Core/HfMlResponseDstarToD0Pi.h b/PWGHF/Core/HfMlResponseDstarToD0Pi.h index c7e43065495..f83c9114feb 100644 --- a/PWGHF/Core/HfMlResponseDstarToD0Pi.h +++ b/PWGHF/Core/HfMlResponseDstarToD0Pi.h @@ -61,26 +61,26 @@ // Very specific case of CHECK_AND_FILL_VEC_DSTAR_FULL(OBJECT, FEATURE, GETTER) // Use for push back different value for D*+ or D*- candidate -#define CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(POSGETTER, NEGGETTER, FEATURENAME) \ - case static_cast(InputFeaturesDstarToD0Pi::FEATURENAME): { \ - if (candidate.signSoftPi() > 0) { \ - inputFeatures.emplace_back(candidate.POSGETTER()); \ - } else { \ - inputFeatures.emplace_back(candidate.NEGGETTER()); \ - } \ - break; \ +#define CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(POSGETTER, NEGGETTER, FEATURENAME, SWAP) \ + case static_cast(InputFeaturesDstarToD0Pi::FEATURENAME): { \ + if (candidate.signSoftPi() > 0 || !SWAP) { \ + inputFeatures.emplace_back(candidate.POSGETTER()); \ + } else { \ + inputFeatures.emplace_back(candidate.NEGGETTER()); \ + } \ + break; \ } // Very specific case of CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(OBJECT, FEATURE, GETTER) // Use for push back different value for D*+ or D*- candidate getting the correct feature from two different objects (tracks) -#define CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE_FROMOBJECT(OBJECTPOS, OBJECTNEG, FEATURENAME, GETTER) \ - case static_cast(InputFeaturesDstarToD0Pi::FEATURENAME): { \ - if (candidate.signSoftPi() > 0) { \ - inputFeatures.emplace_back(OBJECTPOS.GETTER()); \ - } else { \ - inputFeatures.emplace_back(OBJECTNEG.GETTER()); \ - } \ - break; \ +#define CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE_FROMOBJECT(OBJECTPOS, OBJECTNEG, FEATURENAME, GETTER, SWAP) \ + case static_cast(InputFeaturesDstarToD0Pi::FEATURENAME): { \ + if (candidate.signSoftPi() > 0 || !SWAP) { \ + inputFeatures.emplace_back(OBJECTPOS.GETTER()); \ + } else { \ + inputFeatures.emplace_back(OBJECTNEG.GETTER()); \ + } \ + break; \ } // Very specific case of CHECK_AND_FILL_VEC_DSTAR_FULL(OBJECT, FEATURE, GETTER) @@ -164,7 +164,7 @@ class HfMlResponseDstarToD0Pi : public HfMlResponse /// \param prongSoftPi is the candidate's prongSoftPi /// \return inputFeatures vector template - std::vector getInputFeatures(T1 const& candidate) + std::vector getInputFeatures(T1 const& candidate, bool swapDzeroDaus = true) { std::vector inputFeatures; @@ -179,36 +179,36 @@ class HfMlResponseDstarToD0Pi : public HfMlResponse CHECK_AND_FILL_VEC_DSTAR(cpaXYD0); CHECK_AND_FILL_VEC_DSTAR(deltaIPNormalisedMaxD0); CHECK_AND_FILL_VEC_DSTAR(impactParameterProductD0); - CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(ptProng0, ptProng1, ptProng0); - CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(ptProng1, ptProng0, ptProng1); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(ptProng0, ptProng1, ptProng0, swapDzeroDaus); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(ptProng1, ptProng0, ptProng1, swapDzeroDaus); CHECK_AND_FILL_VEC_DSTAR(ptSoftPi); - CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(impactParameter0, impactParameter1, impactParameter0); - CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(impactParameter1, impactParameter0, impactParameter1); - CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(impactParameterZ0, impactParameterZ1, impactParameterZ0); - CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(impactParameterZ1, impactParameterZ0, impactParameterZ1); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(impactParameter0, impactParameter1, impactParameter0, swapDzeroDaus); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(impactParameter1, impactParameter0, impactParameter1, swapDzeroDaus); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(impactParameterZ0, impactParameterZ1, impactParameterZ0, swapDzeroDaus); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(impactParameterZ1, impactParameterZ0, impactParameterZ1, swapDzeroDaus); CHECK_AND_FILL_VEC_DSTAR(impParamSoftPi); CHECK_AND_FILL_VEC_DSTAR(impParamZSoftPi); - CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(impactParameterNormalised0, impactParameterNormalised1, impactParameterNormalised0); - CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(impactParameterNormalised1, impactParameterNormalised0, impactParameterNormalised1); - CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(impactParameterZNormalised0, impactParameterZNormalised1, impactParameterZNormalised0); - CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(impactParameterZNormalised1, impactParameterZNormalised0, impactParameterZNormalised1); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(impactParameterNormalised0, impactParameterNormalised1, impactParameterNormalised0, swapDzeroDaus); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(impactParameterNormalised1, impactParameterNormalised0, impactParameterNormalised1, swapDzeroDaus); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(impactParameterZNormalised0, impactParameterZNormalised1, impactParameterZNormalised0, swapDzeroDaus); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(impactParameterZNormalised1, impactParameterZNormalised0, impactParameterZNormalised1, swapDzeroDaus); CHECK_AND_FILL_VEC_DSTAR(normalisedImpParamSoftPi); CHECK_AND_FILL_VEC_DSTAR(normalisedImpParamZSoftPi); - CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(cosThetaStarD0, cosThetaStarD0Bar, cosThetaStarD0); - CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(invMassD0, invMassD0Bar, massD0); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(cosThetaStarD0, cosThetaStarD0Bar, cosThetaStarD0, true); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(invMassD0, invMassD0Bar, massD0, true); CHECK_AND_FILL_VEC_DSTAR_DELTA_MASS_D0(deltaMassD0); - CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(nSigTpcPi0, nSigTpcPi1, nSigmaTPCPiPr0); - CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(nSigTpcKa0, nSigTpcKa1, nSigmaTPCKaPr0); - CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(nSigTofPi0, nSigTofPi1, nSigmaTOFPiPr0); - CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(nSigTofKa0, nSigTofKa1, nSigmaTOFKaPr0); - CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(tpcTofNSigmaPi0, tpcTofNSigmaPi1, nSigmaTPCTOFPiPr0); - CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(tpcTofNSigmaKa0, tpcTofNSigmaKa1, nSigmaTPCTOFKaPr0); - CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(nSigTpcPi1, nSigTpcPi0, nSigmaTPCPiPr1); - CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(nSigTpcKa1, nSigTpcKa0, nSigmaTPCKaPr1); - CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(nSigTofPi1, nSigTofPi0, nSigmaTOFPiPr1); - CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(nSigTofKa1, nSigTofKa0, nSigmaTOFKaPr1); - CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(tpcTofNSigmaPi1, tpcTofNSigmaPi0, nSigmaTPCTOFPiPr1); - CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(tpcTofNSigmaKa1, tpcTofNSigmaKa0, nSigmaTPCTOFKaPr1); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(nSigTpcPi0, nSigTpcPi1, nSigmaTPCPiPr0, swapDzeroDaus); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(nSigTpcKa0, nSigTpcKa1, nSigmaTPCKaPr0, swapDzeroDaus); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(nSigTofPi0, nSigTofPi1, nSigmaTOFPiPr0, swapDzeroDaus); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(nSigTofKa0, nSigTofKa1, nSigmaTOFKaPr0, swapDzeroDaus); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(tpcTofNSigmaPi0, tpcTofNSigmaPi1, nSigmaTPCTOFPiPr0, swapDzeroDaus); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(tpcTofNSigmaKa0, tpcTofNSigmaKa1, nSigmaTPCTOFKaPr0, swapDzeroDaus); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(nSigTpcPi1, nSigTpcPi0, nSigmaTPCPiPr1, swapDzeroDaus); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(nSigTpcKa1, nSigTpcKa0, nSigmaTPCKaPr1, swapDzeroDaus); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(nSigTofPi1, nSigTofPi0, nSigmaTOFPiPr1, swapDzeroDaus); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(nSigTofKa1, nSigTofKa0, nSigmaTOFKaPr1, swapDzeroDaus); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(tpcTofNSigmaPi1, tpcTofNSigmaPi0, nSigmaTPCTOFPiPr1, swapDzeroDaus); + CHECK_AND_FILL_VEC_DSTAR_CHARGEBASE(tpcTofNSigmaKa1, tpcTofNSigmaKa0, nSigmaTPCTOFKaPr1, swapDzeroDaus); CHECK_AND_FILL_VEC_DSTAR_GETTER(nSigmaTPCPiPrSoftPi, nSigTpcPi2); CHECK_AND_FILL_VEC_DSTAR_GETTER(nSigmaTPCKaPrSoftPi, nSigTpcKa2); CHECK_AND_FILL_VEC_DSTAR_GETTER(nSigmaTOFPiPrSoftPi, nSigTofPi2); diff --git a/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx b/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx index c0c02b6eed6..b5d0c2258f9 100644 --- a/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx @@ -97,6 +97,7 @@ struct HfCandidateSelectorDstarToD0Pi { Configurable> cutsMl{"cutsMl", {hf_cuts_ml::Cuts[0], hf_cuts_ml::NBinsPt, hf_cuts_ml::NCutScores, hf_cuts_ml::labelsPt, hf_cuts_ml::labelsCutScore}, "ML selections per pT bin"}; Configurable nClassesMl{"nClassesMl", static_cast(hf_cuts_ml::NCutScores), "Number of classes in ML model"}; Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature1", "feature2"}, "Names of ML model input features"}; + Configurable isTriggerBDT{"isTriggerBDT", false, "Flag to enable / disable features for software trigger BDTs"}; // CCDB configuration Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; @@ -461,7 +462,7 @@ struct HfCandidateSelectorDstarToD0Pi { if (applyMl) { // ML selections bool isSelectedMlDstar = false; - std::vector inputFeatures = hfMlResponse.getInputFeatures(candDstar); + std::vector inputFeatures = hfMlResponse.getInputFeatures(candDstar, !isTriggerBDT); isSelectedMlDstar = hfMlResponse.isSelectedMl(inputFeatures, ptCand, outputMlDstarToD0Pi); hfMlDstarCandidate(outputMlDstarToD0Pi); From a10bc36975dfaaea60142873c7748db6f3cd8e67 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Mon, 1 Sep 2025 13:01:51 +0200 Subject: [PATCH 264/986] [PWGLF] Some small adjustments and tests for strangeness TOF PID (#12807) Co-authored-by: ALICE Builder --- .../Strangeness/strangenesstofpid.cxx | 487 +++++++++++++----- PWGLF/Tasks/QC/strangepidqa.cxx | 469 ++++++++--------- 2 files changed, 559 insertions(+), 397 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx index c9f4d76b726..f74a6d95d1d 100644 --- a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx @@ -99,14 +99,32 @@ struct strangenesstofpid { Configurable calculationMethod{"calculationMethod", 0, "algorithm for TOF calculation. 0: fast analytical withouot eloss, 1: O2 Propagator + trackLTIntegral (slow), 2: both methods and do comparison studies (slow)"}; Configurable calculateV0s{"calculateV0s", -1, "calculate V0-related TOF PID (0: no, 1: yes, -1: auto)"}; Configurable calculateCascades{"calculateCascades", -1, "calculate cascade-related TOF PID (0: no, 1: yes, -1: auto)"}; - Configurable correctELossInclination{"correctELossInclination", true, "factor out inclination when doing effective e-loss correction (0: no, 1: yes)"}; // Operation and minimisation criteria - Configurable d_bz_input{"d_bz", -999, "bz field, -999 is automatic"}; - Configurable tofPosition{"tofPosition", 377.934f, "TOF effective (inscribed) radius"}; - Configurable doQA{"doQA", true, "create QA histos"}; - Configurable doNSigmas{"doNSigmas", false, "calculate TOF N-sigma"}; - Configurable doQANSigma{"doQANSigma", true, "create QA of Nsigma histos"}; + struct : ConfigurableGroup { + Configurable d_bz_input{"d_bz", -999, "bz field, -999 is automatic"}; + Configurable tofPosition{"tofPosition", 377.934f, "TOF effective (inscribed) radius"}; + + Configurable correctELossInclination{"correctELossInclination", false, "factor out inclination when doing effective e-loss correction (0: no, 1: yes)"}; + Configurable numberOfStepsFirstStage{"numberOfStepsFirstStage", 500, "Max number of alpha rotations to attempt in first stage"}; + Configurable numberOfStepsSecondStage{"numberOfStepsSecondStage", 500, "Max number of steps rotations to attempt in second stage"}; + Configurable stepSizeFirstStage{"stepSizeFirstStage", 2.0f, "Max number of alpha rotations to attempt in first stage"}; + Configurable firstApproximationThreshold{"firstApproximationThreshold", 4.0f, "be satisfied if first approach to TOF radius is OK within this threshold (cm)"}; + + // regulate e-loss calculation to save CPU + Configurable maxPionMomentumForEloss{"maxPionMomentumForEloss", 1.5f, "above this momentum, do fast analytical TOF calculation for pions"}; + Configurable maxKaonMomentumForEloss{"maxKaonMomentumForEloss", 2.0f, "above this momentum, do fast analytical TOF calculation for kaons"}; + Configurable maxProtonMomentumForEloss{"maxProtonMomentumForEloss", 2.5f, "above this momentum, do fast analytical TOF calculation for protons"}; + + Configurable rejectKaonMomentumForEloss{"rejectKaonMomentumForEloss", 0.2f, "below this momentum, reject kaon hypothesis (won't reach TOF)"}; + Configurable rejectProtonMomentumForEloss{"rejectProtonMomentumForEloss", 0.2f, "below this momentum, reject proton hypothesis (won't reach TOF)"}; + + Configurable tpcNsigmaThreshold{"tpcNsigmaThreshold", 6.0f, "require TPC compatibility to attempt eloss propagation (otherwise, don't calculate)"}; + } propagationConfiguration; + + Configurable doQA{"doQA", false, "create QA histos"}; + Configurable doNSigmas{"doNSigmas", true, "calculate TOF N-sigma"}; + Configurable doQANSigma{"doQANSigma", false, "create QA of Nsigma histos"}; // configurables related to V0s struct : ConfigurableGroup { @@ -150,6 +168,7 @@ struct strangenesstofpid { ConfigurableAxis axisTime{"axisTime", {400, 10000.0f, +50000.0f}, "T (ps)"}; ConfigurableAxis axisNSigma{"axisNSigma", {200, -10.0f, +10.0f}, "N(#sigma)"}; ConfigurableAxis axisRatioMethods{"axisRatioMethods", {400, 0.9f, 1.9f}, "T_{method 1}/T_{method 0}"}; + ConfigurableAxis axisSnp{"axisSnp", {220, -1.1f, 1.1f}, "snp"}; // master p axis ConfigurableAxis axisP{"axisP", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "p_{T} (GeV/c)"}; @@ -301,14 +320,15 @@ struct strangenesstofpid { // Detector segmentation loop float segmentAngle = 20.0f / 180.0f * TMath::Pi(); float theta = static_cast(iSeg) * 20.0f / 180.0f * TMath::Pi(); - float halfWidth = tofPosition * TMath::Tan(0.5f * segmentAngle); - float x1 = TMath::Cos(theta) * (-halfWidth) + TMath::Sin(theta) * tofPosition; - float y1 = -TMath::Sin(theta) * (-halfWidth) + TMath::Cos(theta) * tofPosition; - float x2 = TMath::Cos(theta) * (+halfWidth) + TMath::Sin(theta) * tofPosition; - float y2 = -TMath::Sin(theta) * (+halfWidth) + TMath::Cos(theta) * tofPosition; + float halfWidth = propagationConfiguration.tofPosition * TMath::Tan(0.5f * segmentAngle); + float x1 = TMath::Cos(theta) * (-halfWidth) + TMath::Sin(theta) * propagationConfiguration.tofPosition; + float y1 = -TMath::Sin(theta) * (-halfWidth) + TMath::Cos(theta) * propagationConfiguration.tofPosition; + float x2 = TMath::Cos(theta) * (+halfWidth) + TMath::Sin(theta) * propagationConfiguration.tofPosition; + float y2 = -TMath::Sin(theta) * (+halfWidth) + TMath::Cos(theta) * propagationConfiguration.tofPosition; float thisLength = trackLengthToSegment(track, x1, y1, x2, y2, magneticField); - if (thisLength < length && thisLength > 0) + if (thisLength < length && thisLength > 0) { length = thisLength; + } } if (length > 1e+5) length = -100; // force negative to avoid misunderstandings @@ -335,59 +355,115 @@ struct strangenesstofpid { { time = -1e+6; + if (track.getPID() == o2::track::PID::Proton && track.getP() < propagationConfiguration.rejectProtonMomentumForEloss.value) { + return; // don't attempt to calculate below-threshold protons (will stop anyway) + } + if (track.getPID() == o2::track::PID::Kaon && track.getP() < propagationConfiguration.rejectKaonMomentumForEloss.value) { + return; // don't attempt to calculate below-threshold kaons (will stop anyway) + } + o2::track::TrackLTIntegral ltIntegral; - float trackX = -100; static constexpr float MAX_SIN_PHI = 0.85f; static constexpr float MAX_STEP = 2.0f; static constexpr float MAX_STEP_FINAL_STAGE = 0.5f; - static constexpr float MAX_FINAL_X = 390.0f; // maximum extra X on top of TOF X for correcting value - - bool trackOK = track.getXatLabR(tofPosition, trackX, d_bz); - if (trackOK) { - // propagate outwards to TOF: bulk of propagation - o2::base::Propagator::Instance()->propagateToX(track, trackX, d_bz, MAX_SIN_PHI, MAX_STEP, o2::base::Propagator::MatCorrType::USEMatCorrLUT, <Integral); + static constexpr float MAX_FINAL_X = 450.0f; // maximum extra X on top of TOF X for correcting value + + //____________________________________________________________ + // stage 1: propagate to TOF-inscribed circle at tofPosition + + // define standard variables + std::array xyz; + std::array pxpypz; + track.getXYZGlo(xyz); + float segmentedRstart = segmentedRadius(xyz[0], xyz[1]); + + bool firstPropag = true; + for (int iRot = 0; iRot < propagationConfiguration.numberOfStepsFirstStage.value; iRot++) { + track.rotateParam(track.getPhi()); // start rotated + float currentX = track.getX(); + float tofX = currentX; + track.getXatLabR(propagationConfiguration.tofPosition, tofX, d_bz, o2::track::DirOutward); + if (std::abs(tofX - currentX) < propagationConfiguration.firstApproximationThreshold.value) { + // signal conclusion + if (calculationMethod.value == 2) { + histos.fill(HIST("hInitialPropagationSteps"), iRot); // store number of steps + } + break; + } + float nextX = std::min(currentX + propagationConfiguration.stepSizeFirstStage.value, tofX); + firstPropag = o2::base::Propagator::Instance()->propagateToX(track, nextX, d_bz, MAX_SIN_PHI, MAX_STEP, o2::base::Propagator::MatCorrType::USEMatCorrLUT, <Integral); + } - // mark start position, define variables - std::array xyz; - track.getXYZGlo(xyz); - float segmentedR = segmentedRadius(xyz[0], xyz[1]); - float currentTime = ltIntegral.getTOF(track.getPID()); - if (calculationMethod.value == 2) { - histos.fill(HIST("hTOFPosition"), xyz[0], xyz[1]); // for debugging purposes + // mark start position of next step + track.getXYZGlo(xyz); + float snp = track.getSnp(); + float segmentedR = segmentedRadius(xyz[0], xyz[1]); + float segmentedRintermediate = segmentedR; + float currentTime = ltIntegral.getTOF(track.getPID()); + if (calculationMethod.value == 2) { + histos.fill(HIST("hSegRadiusFirstPropagVsStart"), segmentedRstart, segmentedR); // for debugging purposes + histos.fill(HIST("hSnp"), track.getSnp()); // for debugging purposes + histos.fill(HIST("hTOFPosition"), xyz[0], xyz[1]); // for debugging purposes + histos.fill(HIST("hSegRadius"), segmentedR); // for debugging purposes + if (!firstPropag) { + histos.fill(HIST("hTOFPositionFirstPropagFail"), xyz[0], xyz[1]); // for debugging purposes + histos.fill(HIST("hSegRadiusFirstPropagFail"), segmentedR); // for debugging purposes + histos.fill(HIST("hSnpFirstPropagFail"), track.getSnp()); // for debugging purposes } + } - // correct for TOF segmentation - float trackXextra = trackX; - bool trackOKextra = true; - while (trackXextra < MAX_FINAL_X) { - // propagate one step further - trackXextra += MAX_STEP_FINAL_STAGE; - trackOKextra = o2::base::Propagator::Instance()->propagateToX(track, trackXextra, d_bz, MAX_SIN_PHI, MAX_STEP, o2::base::Propagator::MatCorrType::USEMatCorrLUT, <Integral); - if (!trackOKextra) { - time = -1e+6; - return; // propagation failed, skip, won't look reasonable + // correct for TOF segmentation + bool trackOKextra = true; + float trackXextra = track.getX(); + int propagationSteps = 0; + int maxPropagationSteps = propagationConfiguration.numberOfStepsSecondStage.value; + while ((trackXextra < MAX_FINAL_X) && (propagationSteps < maxPropagationSteps)) { + // continue with alpha aligned with pT + track.getPxPyPzGlo(pxpypz); + track.rotateParam(std::atan2(pxpypz[1], pxpypz[0])); + trackXextra = track.getX() + MAX_STEP_FINAL_STAGE; + trackOKextra = o2::base::Propagator::Instance()->propagateToX(track, trackXextra, d_bz, MAX_SIN_PHI, MAX_STEP, o2::base::Propagator::MatCorrType::USEMatCorrLUT, <Integral); + if (!trackOKextra) { + if (calculationMethod.value == 2) { + track.getXYZGlo(xyz); + histos.fill(HIST("hTOFPositionStopped"), xyz[0], xyz[1]); // for debugging purposes + histos.fill(HIST("hSnpStopped"), snp); // for debugging purposes + histos.fill(HIST("hSegRadiusStopped"), segmentedRadius(xyz[0], xyz[1])); // for debugging purposes + histos.fill(HIST("hSegRadiusStoppedVsFirstPropag"), segmentedRintermediate, segmentedRadius(xyz[0], xyz[1])); // for debugging purposes } + time = -1e+6; + return; // propagation failed, skip, won't look reasonable + } - // re-evaluate - did we cross? if yes break - float previousX = xyz[0], previousY = xyz[1]; - track.getXYZGlo(xyz); - if (segmentedRadius(xyz[0], xyz[1]) > tofPosition) { - // crossed boundary -> do proportional scaling with how much we actually crossed the boundary - float segmentedRFinal = segmentedRadius(xyz[0], xyz[1]); - float timeFinal = ltIntegral.getTOF(track.getPID()); - float fraction = (tofPosition - segmentedR) / (segmentedRFinal - segmentedR + 1e-6); // proportional fraction - time = currentTime + (timeFinal - currentTime) * fraction; - if (calculationMethod.value == 2) { - histos.fill(HIST("hTOFPositionFinal"), previousX + fraction * (xyz[0] - previousX), previousY + fraction * (xyz[1] - previousY)); // for debugging purposes - } - return; // get out of the entire function and return (don't just break) + // re-evaluate - did we cross? if yes break + float previousX = xyz[0], previousY = xyz[1]; + track.getXYZGlo(xyz); + if (segmentedRadius(xyz[0], xyz[1]) > propagationConfiguration.tofPosition) { + // crossed boundary -> do proportional scaling with how much we actually crossed the boundary + float segmentedRFinal = segmentedRadius(xyz[0], xyz[1]); + float timeFinal = ltIntegral.getTOF(track.getPID()); + float fraction = (propagationConfiguration.tofPosition - segmentedR) / (segmentedRFinal - segmentedR + 1e-6); // proportional fraction + time = currentTime + (timeFinal - currentTime) * fraction; + if (calculationMethod.value == 2) { + histos.fill(HIST("hTOFPositionFinal"), previousX + fraction * (xyz[0] - previousX), previousY + fraction * (xyz[1] - previousY)); // for debugging purposes + histos.fill(HIST("hSegRadiusFinal"), segmentedRadius(previousX + fraction * (xyz[0] - previousX), previousY + fraction * (xyz[1] - previousY))); // for debugging purposes + histos.fill(HIST("hSnpFinal"), track.getSnp()); // for debugging purposes + histos.fill(HIST("hSegRadiusFinalVsFirstPropag"), segmentedRintermediate, segmentedRadius(previousX + fraction * (xyz[0] - previousX), previousY + fraction * (xyz[1] - previousY))); // for debugging purposes + histos.fill(HIST("hRefinedPropagationSteps"), propagationSteps, 1.0f); // for debugging purposes } - - // prepare for next step by setting current position and desired variables - segmentedR = segmentedRadius(xyz[0], xyz[1]); - currentTime = ltIntegral.getTOF(track.getPID()); + return; // get out of the entire function and return (don't just break) } + + // prepare for next step by setting current position and desired variables + segmentedR = segmentedRadius(xyz[0], xyz[1]); + currentTime = ltIntegral.getTOF(track.getPID()); + propagationSteps++; + } + if (calculationMethod.value == 2) { + histos.fill(HIST("hRefinedPropagationSteps"), propagationSteps, 0.0f); // for debugging purposes + track.getXYZGlo(xyz); + histos.fill(HIST("hSegRadiusGotLost"), segmentedRadius(xyz[0], xyz[1])); // for debugging purposes } } @@ -495,12 +571,43 @@ struct strangenesstofpid { //_____________________________________________________________________ // special mode in which comparison histograms are required + //_____________________________________________________________________ + // histograms for debugging modes 0 vs 1 + // encoded success rates in each hypothesis and method vs prong p + histos.add("h2dSucessRatePion", "h2dSucessRatePion", kTH2F, {axisSmallP, {4, -0.5f, 3.5f}}); + histos.add("h2dSucessRateKaon", "h2dSucessRateKaon", kTH2F, {axisSmallP, {4, -0.5f, 3.5f}}); + histos.add("h2dSucessRateProton", "h2dSucessRateProton", kTH2F, {axisSmallP, {4, -0.5f, 3.5f}}); + + histos.add("hInitialPropagationSteps", "hInitialPropagationSteps", kTH1F, {{500, -0.5f, 499.5f}}); + histos.add("hRefinedPropagationSteps", "hRefinedPropagationSteps", kTH2F, {{1000, -0.5f, 999.5f}, {2, -0.5f, 1.5f}}); + // base ArcDebug: comparison between times of arrival in different methods histos.add("hArcDebug", "hArcDebug", kTH2F, {axisTime, axisTime}); // Position of TrackLTIntegral method: intermediate (getXatLabR) and final (reach segmented detector) histos.add("hTOFPosition", "hTOFPosition", kTH2F, {axisPosition, axisPosition}); + histos.add("hTOFPositionFirstPropagFail", "hTOFPositionFirstPropagFail", kTH2F, {axisPosition, axisPosition}); histos.add("hTOFPositionFinal", "hTOFPositionFinal", kTH2F, {axisPosition, axisPosition}); + histos.add("hTOFPositionGetXAtLabFail", "hTOFPositionGetXAtLabFail", kTH2F, {axisPosition, axisPosition}); + histos.add("hTOFPositionStopped", "hTOFPositionStopped", kTH2F, {axisPosition, axisPosition}); + + // Snp cross-check + histos.add("hSnp", "hSnp", kTH1F, {axisSnp}); + histos.add("hSnpFirstPropagFail", "hSnpFirstPropagFail", kTH1F, {axisSnp}); + histos.add("hSnpFinal", "hSnpFinal", kTH1F, {axisSnp}); + histos.add("hSnpGetXAtLabFail", "hSnpGetXAtLabFail", kTH1F, {axisSnp}); + histos.add("hSnpStopped", "hSnpStopped", kTH1F, {axisSnp}); + + // segmented radius: positions + histos.add("hSegRadius", "hSegRadius", kTH1F, {{400, 0.0f, 400.0f}}); + histos.add("hSegRadiusFirstPropagFail", "hSegRadiusFirstPropagFail", kTH1F, {{400, 0.0f, 400.0f}}); + histos.add("hSegRadiusFinal", "hSegRadiusFinal", kTH1F, {{400, 0.0f, 400.0f}}); + histos.add("hSegRadiusStopped", "hSegRadiusStopped", kTH1F, {{400, 0.0f, 400.0f}}); + histos.add("hSegRadiusGotLost", "hSegRadiusGotLost", kTH1F, {{400, 0.0f, 400.0f}}); + + histos.add("hSegRadiusFirstPropagVsStart", "hSegRadiusFirstPropagVsStart", kTH2F, {{400, 0.0f, 400.0f}, {400, 0.0f, 400.0f}}); + histos.add("hSegRadiusStoppedVsFirstPropag", "hSegRadiusStoppedVsFirstPropag", kTH2F, {{400, 0.0f, 400.0f}, {400, 0.0f, 400.0f}}); + histos.add("hSegRadiusFinalVsFirstPropag", "hSegRadiusFinalVsFirstPropag", kTH2F, {{400, 0.0f, 400.0f}, {400, 0.0f, 400.0f}}); // Delta-times of each method for the various species histos.add("hDeltaTimeMethodsVsP_posLaPr", "hDeltaTimeMethodsVsP_posLaPr", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); @@ -555,8 +662,8 @@ struct strangenesstofpid { } // In case override, don't proceed, please - no CCDB access required - if (d_bz_input > -990) { - d_bz = d_bz_input; + if (propagationConfiguration.d_bz_input > -990) { + d_bz = propagationConfiguration.d_bz_input; o2::parameters::GRPMagField grpmag; if (fabs(d_bz) > 1e-5) { grpmag.setL3Current(30000.f / (d_bz / 5.0f)); @@ -666,6 +773,7 @@ struct strangenesstofpid { LOG(info) << "Loading full (all-radius) material look-up table for run number: " << runNumber; lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->getForRun(ccdbConfigurations.lutPath, runNumber)); o2::base::Propagator::Instance()->setMatLUT(lut); + o2::base::Propagator::Instance()->setTGeoFallBackAllowed(false); LOG(info) << "Material look-up table loaded!"; } mRunNumber = runNumber; @@ -691,8 +799,8 @@ struct strangenesstofpid { float timeLambda = lengthV0 / velocityLambda; // in picoseconds // initialize from V0 position and momenta - o2::track::TrackPar posTrack = o2::track::TrackPar({v0.x(), v0.y(), v0.z()}, {v0.pxpos(), v0.pypos(), v0.pzpos()}, +1); - o2::track::TrackPar negTrack = o2::track::TrackPar({v0.x(), v0.y(), v0.z()}, {v0.pxneg(), v0.pyneg(), v0.pzneg()}, -1); + o2::track::TrackPar posTrack = o2::track::TrackPar({v0.x(), v0.y(), v0.z()}, {v0.pxpos(), v0.pypos(), v0.pzpos()}, +1, false); + o2::track::TrackPar negTrack = o2::track::TrackPar({v0.x(), v0.y(), v0.z()}, {v0.pxneg(), v0.pyneg(), v0.pzneg()}, -1, false); // at minimum float positiveP = std::hypot(v0.pxpos(), v0.pypos(), v0.pzpos()); @@ -727,19 +835,20 @@ struct strangenesstofpid { float timeNegativePr_Method1 = o2::aod::v0data::kNoTOFValue; float timeNegativePi_Method1 = o2::aod::v0data::kNoTOFValue; - if (calculationMethod.value == 0 || calculationMethod.value == 2) { - float velocityPositivePr = velocity(posTrack.getP(), o2::constants::physics::MassProton); - float velocityPositivePi = velocity(posTrack.getP(), o2::constants::physics::MassPionCharged); - float velocityNegativePr = velocity(negTrack.getP(), o2::constants::physics::MassProton); - float velocityNegativePi = velocity(negTrack.getP(), o2::constants::physics::MassPionCharged); + float velocityPositivePr = velocity(posTrack.getP(), o2::constants::physics::MassProton); + float velocityPositivePi = velocity(posTrack.getP(), o2::constants::physics::MassPionCharged); + float velocityNegativePr = velocity(negTrack.getP(), o2::constants::physics::MassProton); + float velocityNegativePi = velocity(negTrack.getP(), o2::constants::physics::MassPionCharged); + if (pTra.hasTOF() && pTra.hasITS()) { float lengthPositive = findInterceptLength(posTrack, d_bz); // FIXME: tofPosition ok? adjust? - float lengthNegative = findInterceptLength(negTrack, d_bz); // FIXME: tofPosition ok? adjust? - if (lengthPositive > 0) { timePositivePr_Method0 = lengthPositive / velocityPositivePr; timePositivePi_Method0 = lengthPositive / velocityPositivePi; } + } + if (nTra.hasTOF() && nTra.hasITS()) { + float lengthNegative = findInterceptLength(negTrack, d_bz); // FIXME: tofPosition ok? adjust? if (lengthNegative > 0) { timeNegativePr_Method0 = lengthNegative / velocityNegativePr; timeNegativePi_Method0 = lengthNegative / velocityNegativePi; @@ -748,23 +857,38 @@ struct strangenesstofpid { if (calculationMethod.value > 0) { // method to calculate the time and length via Propagator TrackLTIntegral - if (pTra.hasTOF()) { // calculate if signal present, otherwise skip - o2::track::TrackPar posTrackAsProton(posTrack); - posTrackAsProton.setPID(o2::track::PID::Proton); - calculateTOF(posTrackAsProton, timePositivePr_Method1); - - o2::track::TrackPar posTrackAsPion(posTrack); - posTrackAsPion.setPID(o2::track::PID::Pion); - calculateTOF(posTrackAsPion, timePositivePi_Method1); + if (pTra.hasTOF() && pTra.hasITS()) { // calculate if signal present, otherwise skip + if (posTrack.getP() < propagationConfiguration.maxProtonMomentumForEloss.value && std::abs(pTra.tpcNSigmaPr()) < propagationConfiguration.tpcNsigmaThreshold) { + o2::track::TrackPar posTrackAsProton(posTrack); + posTrackAsProton.setPID(o2::track::PID::Proton); + calculateTOF(posTrackAsProton, timePositivePr_Method1); + } else { + timePositivePr_Method1 = timePositivePr_Method0; + } + if (posTrack.getP() < propagationConfiguration.maxPionMomentumForEloss.value && std::abs(pTra.tpcNSigmaPi()) < propagationConfiguration.tpcNsigmaThreshold) { + o2::track::TrackPar posTrackAsPion(posTrack); + posTrackAsPion.setPID(o2::track::PID::Pion); + calculateTOF(posTrackAsPion, timePositivePi_Method1); + } else { + timePositivePi_Method1 = timePositivePi_Method0; + } } - if (nTra.hasTOF()) { // calculate if signal present, otherwise skip - o2::track::TrackPar negTrackAsProton(negTrack); - negTrackAsProton.setPID(o2::track::PID::Proton); - calculateTOF(negTrackAsProton, timeNegativePr_Method1); - - o2::track::TrackPar negTrackAsPion(negTrack); - negTrackAsPion.setPID(o2::track::PID::Pion); - calculateTOF(negTrackAsPion, timeNegativePi_Method1); + if (nTra.hasTOF() && nTra.hasITS()) { // calculate if signal present, otherwise skip + if (negTrack.getP() < propagationConfiguration.maxProtonMomentumForEloss.value && std::abs(nTra.tpcNSigmaPr()) < propagationConfiguration.tpcNsigmaThreshold) { + o2::track::TrackPar negTrackAsProton(negTrack); + negTrackAsProton.setPID(o2::track::PID::Proton); + calculateTOF(negTrackAsProton, timeNegativePr_Method1); + } else { + timeNegativePr_Method1 = timeNegativePr_Method0; + } + + if (negTrack.getP() < propagationConfiguration.maxPionMomentumForEloss.value && std::abs(nTra.tpcNSigmaPi()) < propagationConfiguration.tpcNsigmaThreshold) { + o2::track::TrackPar negTrackAsPion(negTrack); + negTrackAsPion.setPID(o2::track::PID::Pion); + calculateTOF(negTrackAsPion, timeNegativePi_Method1); + } else { + timeNegativePi_Method1 = timeNegativePi_Method0; + } } } @@ -781,12 +905,38 @@ struct strangenesstofpid { timeNegativePi = timeNegativePi_Method1; } - if (pTra.hasTOF() && timePositivePr > 0) { + if (calculationMethod.value == 2) { + // do analysis of successes and failures + bool positiveSuccessMethod0Pr = std::abs(timePositivePr_Method0 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon; + bool negativeSuccessMethod0Pr = std::abs(timeNegativePr_Method0 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon; + bool positiveSuccessMethod1Pr = std::abs(timePositivePr_Method1 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon; + bool negativeSuccessMethod1Pr = std::abs(timeNegativePr_Method1 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon; + bool positiveSuccessMethod0Pi = std::abs(timePositivePi_Method0 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon; + bool negativeSuccessMethod0Pi = std::abs(timeNegativePi_Method0 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon; + bool positiveSuccessMethod1Pi = std::abs(timePositivePi_Method1 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon; + bool negativeSuccessMethod1Pi = std::abs(timeNegativePi_Method1 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon; + + int encodedPositiveSuccessPi = positiveSuccessMethod0Pi + 2 * positiveSuccessMethod1Pi; + int encodedPositiveSuccessPr = positiveSuccessMethod0Pr + 2 * positiveSuccessMethod1Pr; + int encodedNegativeSuccessPi = negativeSuccessMethod0Pi + 2 * negativeSuccessMethod1Pi; + int encodedNegativeSuccessPr = negativeSuccessMethod0Pr + 2 * negativeSuccessMethod1Pr; + + if (pTra.hasTOF()) { + histos.fill(HIST("h2dSucessRateProton"), positiveP, encodedPositiveSuccessPr); + histos.fill(HIST("h2dSucessRatePion"), positiveP, encodedPositiveSuccessPi); + } + if (nTra.hasTOF()) { + histos.fill(HIST("h2dSucessRateProton"), negativeP, encodedNegativeSuccessPr); + histos.fill(HIST("h2dSucessRatePion"), negativeP, encodedNegativeSuccessPi); + } + } + + if (pTra.hasTOF() && pTra.hasITS() && timePositivePr > 0) { deltaTimePositiveLambdaPr = (pTra.tofSignal() - pTra.tofEvTime()) - (timeLambda + timePositivePr); deltaTimePositiveLambdaPi = (pTra.tofSignal() - pTra.tofEvTime()) - (timeLambda + timePositivePi); deltaTimePositiveK0ShortPi = (pTra.tofSignal() - pTra.tofEvTime()) - (timeK0Short + timePositivePi); } - if (nTra.hasTOF() && timeNegativePr > 0) { + if (nTra.hasTOF() && nTra.hasITS() && timeNegativePr > 0) { deltaTimeNegativeLambdaPr = (nTra.tofSignal() - nTra.tofEvTime()) - (timeLambda + timeNegativePr); deltaTimeNegativeLambdaPi = (nTra.tofSignal() - nTra.tofEvTime()) - (timeLambda + timeNegativePi); deltaTimeNegativeK0ShortPi = (nTra.tofSignal() - nTra.tofEvTime()) - (timeK0Short + timeNegativePi); @@ -812,7 +962,7 @@ struct strangenesstofpid { float deltaDecayTimeLambda = -10e+4; float deltaDecayTimeAntiLambda = -10e+4; float deltaDecayTimeK0Short = -10e+4; - if (nTra.hasTOF() && pTra.hasTOF() > 0 && timePositivePr > 0 && timeNegativePr > 0) { // does not depend on event time + if (nTra.hasTOF() && pTra.hasTOF() && timePositivePr > 0 && timeNegativePr > 0) { // does not depend on event time deltaDecayTimeLambda = (pTra.tofSignal() - timePositivePr) - (nTra.tofSignal() - timeNegativePi); deltaDecayTimeAntiLambda = (pTra.tofSignal() - timePositivePi) - (nTra.tofSignal() - timeNegativePr); deltaDecayTimeK0Short = (pTra.tofSignal() - timePositivePi) - (nTra.tofSignal() - timeNegativePi); @@ -869,11 +1019,11 @@ struct strangenesstofpid { // length factor due to eta (to offset e-loss) float positiveCosine = 1.0f / sqrt(1.0f + posTrack.getTgl() * posTrack.getTgl()); float negativeCosine = 1.0f / sqrt(1.0f + negTrack.getTgl() * negTrack.getTgl()); - if (correctELossInclination.value == false) { + if (propagationConfiguration.correctELossInclination.value == false) { negativeCosine = positiveCosine = 1.0f; } - if (pTra.hasTOF()) { + if (pTra.hasTOF() && pTra.hasITS()) { if (v0.v0cosPA() > v0Group.qaCosPA && v0.dcaV0daughters() < v0Group.qaDCADau) { if (std::abs(v0.mLambda() - 1.115683) < v0Group.qaMassWindow && fabs(pTra.tpcNSigmaPr()) < v0Group.qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma && ((v0pdg == 0) || (v0pdg == 3122))) { histos.fill(HIST("h2dDeltaTimePositiveLambdaPr"), v0.p(), v0.eta(), deltaTimePositiveLambdaPr); @@ -905,14 +1055,16 @@ struct strangenesstofpid { } } - if (nTra.hasTOF()) { + if (nTra.hasTOF() && nTra.hasITS()) { if (v0.v0cosPA() > v0Group.qaCosPA && v0.dcaV0daughters() < v0Group.qaDCADau) { if (std::abs(v0.mLambda() - 1.115683) < v0Group.qaMassWindow && fabs(pTra.tpcNSigmaPr()) < v0Group.qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma && ((v0pdg == 0) || (v0pdg == 3122))) { histos.fill(HIST("h2dDeltaTimeNegativeLambdaPi"), v0.p(), v0.eta(), deltaTimeNegativeLambdaPi); if (calculationMethod.value == 2 && std::abs(timeNegativePi_Method0 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon && std::abs(timeNegativePi_Method1 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { histos.fill(HIST("hDeltaTimeMethodsVsP_negLaPi"), negativeP, v0.negativeeta(), (timeNegativePi_Method0 - timeNegativePi_Method1) * negativeCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_negLaPi"), negativeP, v0.negativeeta(), (timeNegativePi_Method1 / timeNegativePi_Method0) * negativeCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_negLaPi"), negativeP, v0.negativeeta(), (timeNegativePi_Method1 / timeNegativePi_Method0)); } + // delta lambda decay time + histos.fill(HIST("h2dLambdaDeltaDecayTime"), v0.p(), deltaDecayTimeLambda); if (doQANSigma) histos.fill(HIST("h2dNSigmaNegativeLambdaPi"), v0.p(), nSigmaNegativeLambdaPi); } @@ -920,7 +1072,7 @@ struct strangenesstofpid { histos.fill(HIST("h2dDeltaTimeNegativeLambdaPr"), v0.p(), v0.eta(), deltaTimeNegativeLambdaPr); if (calculationMethod.value == 2 && std::abs(timeNegativePr_Method0 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon && std::abs(timeNegativePr_Method1 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { histos.fill(HIST("hDeltaTimeMethodsVsP_negLaPr"), negativeP, v0.negativeeta(), (timeNegativePr_Method0 - timeNegativePr_Method1) * negativeCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_negLaPr"), negativeP, v0.negativeeta(), (timeNegativePr_Method1 / timeNegativePr_Method0) * negativeCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_negLaPr"), negativeP, v0.negativeeta(), (timeNegativePr_Method1 / timeNegativePr_Method0)); } if (doQANSigma) histos.fill(HIST("h2dNSigmaNegativeLambdaPr"), v0.p(), nSigmaNegativeLambdaPr); @@ -929,15 +1081,13 @@ struct strangenesstofpid { histos.fill(HIST("h2dDeltaTimeNegativeK0ShortPi"), v0.p(), v0.eta(), deltaTimeNegativeK0ShortPi); if (calculationMethod.value == 2 && std::abs(timeNegativePi_Method0 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon && std::abs(timeNegativePi_Method1 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { histos.fill(HIST("hDeltaTimeMethodsVsP_negK0Pi"), negativeP, v0.negativeeta(), (timeNegativePi_Method0 - timeNegativePi_Method1) * negativeCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_negK0Pi"), negativeP, v0.negativeeta(), (timeNegativePi_Method1 / timeNegativePi_Method0) * negativeCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_negK0Pi"), negativeP, v0.negativeeta(), (timeNegativePi_Method1 / timeNegativePi_Method0)); } if (doQANSigma) histos.fill(HIST("h2dNSigmaNegativeK0ShortPi"), v0.p(), nSigmaNegativeK0ShortPi); } } } - // delta lambda decay time - histos.fill(HIST("h2dLambdaDeltaDecayTime"), v0.p(), deltaDecayTimeLambda); } } @@ -945,10 +1095,10 @@ struct strangenesstofpid { void processCascadeCandidate(TCollision const& collision, TCascade const& cascade, TTrack const& pTra, TTrack const& nTra, TTrack const& bTra, int cascpdg) { // initialize from positions and momenta as needed - o2::track::TrackPar posTrack = o2::track::TrackPar({cascade.xlambda(), cascade.ylambda(), cascade.zlambda()}, {cascade.pxpos(), cascade.pypos(), cascade.pzpos()}, +1); - o2::track::TrackPar negTrack = o2::track::TrackPar({cascade.xlambda(), cascade.ylambda(), cascade.zlambda()}, {cascade.pxneg(), cascade.pyneg(), cascade.pzneg()}, -1); - o2::track::TrackPar bachTrack = o2::track::TrackPar({cascade.x(), cascade.y(), cascade.z()}, {cascade.pxbach(), cascade.pybach(), cascade.pzbach()}, cascade.sign()); - o2::track::TrackPar cascTrack = o2::track::TrackPar({cascade.x(), cascade.y(), cascade.z()}, {cascade.px(), cascade.py(), cascade.pz()}, cascade.sign()); + o2::track::TrackPar posTrack = o2::track::TrackPar({cascade.xlambda(), cascade.ylambda(), cascade.zlambda()}, {cascade.pxpos(), cascade.pypos(), cascade.pzpos()}, +1, false); + o2::track::TrackPar negTrack = o2::track::TrackPar({cascade.xlambda(), cascade.ylambda(), cascade.zlambda()}, {cascade.pxneg(), cascade.pyneg(), cascade.pzneg()}, -1, false); + o2::track::TrackPar bachTrack = o2::track::TrackPar({cascade.x(), cascade.y(), cascade.z()}, {cascade.pxbach(), cascade.pybach(), cascade.pzbach()}, cascade.sign(), false); + o2::track::TrackPar cascTrack = o2::track::TrackPar({cascade.x(), cascade.y(), cascade.z()}, {cascade.px(), cascade.py(), cascade.pz()}, cascade.sign(), false); float positiveP = std::hypot(cascade.pxpos(), cascade.pypos(), cascade.pzpos()); float negativeP = std::hypot(cascade.pxneg(), cascade.pyneg(), cascade.pzneg()); @@ -1024,47 +1174,71 @@ struct strangenesstofpid { float lengthNegative = findInterceptLength(negTrack, d_bz); // FIXME: tofPosition ok? adjust? float lengthBachelor = findInterceptLength(bachTrack, d_bz); // FIXME: tofPosition ok? adjust? - if (lengthPositive > 0) { + if (lengthPositive > 0 && pTra.hasTOF() && pTra.hasITS()) { posFlightPi_Method0 = lengthPositive / velocityPositivePi; posFlightPr_Method0 = lengthPositive / velocityPositivePr; } - if (lengthNegative > 0) { + if (lengthNegative > 0 && nTra.hasTOF() && nTra.hasITS()) { negFlightPi_Method0 = lengthNegative / velocityNegativePi; negFlightPr_Method0 = lengthNegative / velocityNegativePr; } - if (lengthBachelor > 0) { + if (lengthBachelor > 0 && bTra.hasTOF() && bTra.hasITS()) { bachFlightPi_Method0 = lengthBachelor / velocityBachelorPi; bachFlightKa_Method0 = lengthBachelor / velocityBachelorKa; } } if (calculationMethod.value > 0) { - if (pTra.hasTOF()) { // calculate if signal present, otherwise skip - o2::track::TrackPar posTrackAsProton(posTrack); - posTrackAsProton.setPID(o2::track::PID::Proton); - calculateTOF(posTrackAsProton, posFlightPr_Method1); - - o2::track::TrackPar posTrackAsPion(posTrack); - posTrackAsPion.setPID(o2::track::PID::Pion); - calculateTOF(posTrackAsPion, posFlightPi_Method1); + if (pTra.hasTOF() && pTra.hasITS()) { // calculate if signal present, otherwise skip + if (posTrack.getP() < propagationConfiguration.maxProtonMomentumForEloss.value && std::abs(pTra.tpcNSigmaPr()) < propagationConfiguration.tpcNsigmaThreshold) { + o2::track::TrackPar posTrackAsProton(posTrack); + posTrackAsProton.setPID(o2::track::PID::Proton); + calculateTOF(posTrackAsProton, posFlightPr_Method1); + } else { + posFlightPr_Method1 = posFlightPr_Method0; + } + + if (posTrack.getP() < propagationConfiguration.maxPionMomentumForEloss.value && std::abs(pTra.tpcNSigmaPi()) < propagationConfiguration.tpcNsigmaThreshold) { + o2::track::TrackPar posTrackAsPion(posTrack); + posTrackAsPion.setPID(o2::track::PID::Pion); + calculateTOF(posTrackAsPion, posFlightPi_Method1); + } else { + posFlightPi_Method1 = posFlightPi_Method0; + } } - if (nTra.hasTOF()) { // calculate if signal present, otherwise skip - o2::track::TrackPar negTrackAsProton(negTrack); - negTrackAsProton.setPID(o2::track::PID::Proton); - calculateTOF(negTrackAsProton, negFlightPr_Method1); - - o2::track::TrackPar negTrackAsPion(negTrack); - negTrackAsPion.setPID(o2::track::PID::Pion); - calculateTOF(negTrackAsPion, negFlightPi_Method1); + if (nTra.hasTOF() && nTra.hasITS()) { // calculate if signal present, otherwise skip + if (negTrack.getP() < propagationConfiguration.maxProtonMomentumForEloss.value && std::abs(nTra.tpcNSigmaPr()) < propagationConfiguration.tpcNsigmaThreshold) { + o2::track::TrackPar negTrackAsProton(negTrack); + negTrackAsProton.setPID(o2::track::PID::Proton); + calculateTOF(negTrackAsProton, negFlightPr_Method1); + } else { + negFlightPr_Method1 = negFlightPr_Method0; + } + + if (negTrack.getP() < propagationConfiguration.maxProtonMomentumForEloss.value && std::abs(nTra.tpcNSigmaPi()) < propagationConfiguration.tpcNsigmaThreshold) { + o2::track::TrackPar negTrackAsPion(negTrack); + negTrackAsPion.setPID(o2::track::PID::Pion); + calculateTOF(negTrackAsPion, negFlightPi_Method1); + } else { + negFlightPi_Method1 = negFlightPi_Method0; + } } - if (bTra.hasTOF()) { // calculate if signal present, otherwise skip - o2::track::TrackPar bachTrackAsPion(bachTrack); - bachTrackAsPion.setPID(o2::track::PID::Pion); - calculateTOF(bachTrackAsPion, bachFlightPi_Method1); - - o2::track::TrackPar bachTrackAsKaon(bachTrack); - bachTrackAsKaon.setPID(o2::track::PID::Kaon); - calculateTOF(bachTrackAsKaon, bachFlightKa_Method1); + if (bTra.hasTOF() && bTra.hasITS()) { // calculate if signal present, otherwise skip + if (bachTrack.getP() < propagationConfiguration.maxPionMomentumForEloss.value && std::abs(bTra.tpcNSigmaPi()) < propagationConfiguration.tpcNsigmaThreshold) { + o2::track::TrackPar bachTrackAsPion(bachTrack); + bachTrackAsPion.setPID(o2::track::PID::Pion); + calculateTOF(bachTrackAsPion, bachFlightPi_Method1); + } else { + bachFlightPi_Method1 = bachFlightPi_Method0; + } + + if (bachTrack.getP() < propagationConfiguration.maxKaonMomentumForEloss.value && std::abs(bTra.tpcNSigmaKa()) < propagationConfiguration.tpcNsigmaThreshold) { + o2::track::TrackPar bachTrackAsKaon(bachTrack); + bachTrackAsKaon.setPID(o2::track::PID::Kaon); + calculateTOF(bachTrackAsKaon, bachFlightKa_Method1); + } else { + bachFlightKa_Method1 = bachFlightKa_Method0; + } } } @@ -1085,6 +1259,43 @@ struct strangenesstofpid { bachFlightKa = bachFlightKa_Method1; } + if (calculationMethod.value == 2) { + // do analysis of successes and failures + bool positiveSuccessMethod0Pr = std::abs(posFlightPr_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon; + bool negativeSuccessMethod0Pr = std::abs(negFlightPr_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon; + bool positiveSuccessMethod1Pr = std::abs(posFlightPr_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon; + bool negativeSuccessMethod1Pr = std::abs(negFlightPr_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon; + bool positiveSuccessMethod0Pi = std::abs(posFlightPi_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon; + bool negativeSuccessMethod0Pi = std::abs(negFlightPi_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon; + bool positiveSuccessMethod1Pi = std::abs(posFlightPi_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon; + bool negativeSuccessMethod1Pi = std::abs(negFlightPi_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon; + + bool bachelorSuccessMethod0Pi = std::abs(bachFlightPi_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon; + bool bachelorSuccessMethod0Ka = std::abs(bachFlightKa_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon; + bool bachelorSuccessMethod1Pi = std::abs(bachFlightPi_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon; + bool bachelorSuccessMethod1Ka = std::abs(bachFlightKa_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon; + + int encodedPositiveSuccessPi = positiveSuccessMethod0Pi + 2 * positiveSuccessMethod1Pi; + int encodedPositiveSuccessPr = positiveSuccessMethod0Pr + 2 * positiveSuccessMethod1Pr; + int encodedNegativeSuccessPi = negativeSuccessMethod0Pi + 2 * negativeSuccessMethod1Pi; + int encodedNegativeSuccessPr = negativeSuccessMethod0Pr + 2 * negativeSuccessMethod1Pr; + int encodedBachelorSuccessPi = bachelorSuccessMethod0Pi + 2 * bachelorSuccessMethod1Pi; + int encodedBachelorSuccessKa = bachelorSuccessMethod0Ka + 2 * bachelorSuccessMethod1Ka; + + if (pTra.hasTOF()) { + histos.fill(HIST("h2dSucessRateProton"), positiveP, encodedPositiveSuccessPr); + histos.fill(HIST("h2dSucessRatePion"), positiveP, encodedPositiveSuccessPi); + } + if (nTra.hasTOF()) { + histos.fill(HIST("h2dSucessRateProton"), negativeP, encodedNegativeSuccessPr); + histos.fill(HIST("h2dSucessRatePion"), negativeP, encodedNegativeSuccessPi); + } + if (bTra.hasTOF()) { + histos.fill(HIST("h2dSucessRateKaon"), bachelorP, encodedBachelorSuccessKa); + histos.fill(HIST("h2dSucessRatePion"), bachelorP, encodedBachelorSuccessPi); + } + } + // initialize delta-times (actual PID variables) float posDeltaTimeAsXiPi = o2::aod::cascdata::kNoTOFValue, posDeltaTimeAsXiPr = o2::aod::cascdata::kNoTOFValue; float negDeltaTimeAsXiPi = o2::aod::cascdata::kNoTOFValue, negDeltaTimeAsXiPr = o2::aod::cascdata::kNoTOFValue; @@ -1093,19 +1304,19 @@ struct strangenesstofpid { float negDeltaTimeAsOmPi = o2::aod::cascdata::kNoTOFValue, negDeltaTimeAsOmPr = o2::aod::cascdata::kNoTOFValue; float bachDeltaTimeAsOmKa = o2::aod::cascdata::kNoTOFValue; - if (pTra.hasTOF()) { + if (pTra.hasTOF() && pTra.hasITS()) { posDeltaTimeAsXiPi = (pTra.tofSignal() - pTra.tofEvTime()) - (xiFlight + lambdaFlight + posFlightPi); posDeltaTimeAsXiPr = (pTra.tofSignal() - pTra.tofEvTime()) - (xiFlight + lambdaFlight + posFlightPr); posDeltaTimeAsOmPi = (pTra.tofSignal() - pTra.tofEvTime()) - (omFlight + lambdaFlight + posFlightPi); posDeltaTimeAsOmPr = (pTra.tofSignal() - pTra.tofEvTime()) - (omFlight + lambdaFlight + posFlightPr); } - if (nTra.hasTOF()) { + if (nTra.hasTOF() && nTra.hasITS()) { negDeltaTimeAsXiPi = (nTra.tofSignal() - nTra.tofEvTime()) - (xiFlight + lambdaFlight + negFlightPi); negDeltaTimeAsXiPr = (nTra.tofSignal() - nTra.tofEvTime()) - (xiFlight + lambdaFlight + negFlightPr); negDeltaTimeAsOmPi = (nTra.tofSignal() - nTra.tofEvTime()) - (omFlight + lambdaFlight + negFlightPi); negDeltaTimeAsOmPr = (nTra.tofSignal() - nTra.tofEvTime()) - (omFlight + lambdaFlight + negFlightPr); } - if (bTra.hasTOF()) { + if (bTra.hasTOF() && bTra.hasITS()) { bachDeltaTimeAsXiPi = (bTra.tofSignal() - bTra.tofEvTime()) - (xiFlight + bachFlightPi); bachDeltaTimeAsOmKa = (bTra.tofSignal() - bTra.tofEvTime()) - (omFlight + bachFlightKa); } @@ -1159,7 +1370,7 @@ struct strangenesstofpid { float positiveCosine = 1.0f / sqrt(1.0f + posTrack.getTgl() * posTrack.getTgl()); float negativeCosine = 1.0f / sqrt(1.0f + negTrack.getTgl() * negTrack.getTgl()); float bachelorCosine = 1.0f / sqrt(1.0f + bachTrack.getTgl() * bachTrack.getTgl()); - if (correctELossInclination.value == false) { + if (propagationConfiguration.correctELossInclination.value == false) { negativeCosine = positiveCosine = bachelorCosine = 1.0f; } @@ -1172,15 +1383,15 @@ struct strangenesstofpid { if (calculationMethod.value == 2) { if (std::abs(posFlightPr_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(posFlightPr_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { histos.fill(HIST("hDeltaTimeMethodsVsP_posXiPr"), positiveP, cascade.positiveeta(), (posFlightPr_Method0 - posFlightPr_Method1) * positiveCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_posXiPr"), positiveP, cascade.positiveeta(), (posFlightPr_Method1 / posFlightPr_Method0) * positiveCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_posXiPr"), positiveP, cascade.positiveeta(), (posFlightPr_Method1 / posFlightPr_Method0)); } if (std::abs(negFlightPi_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(negFlightPi_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { histos.fill(HIST("hDeltaTimeMethodsVsP_negXiPi"), negativeP, cascade.negativeeta(), (negFlightPi_Method0 - negFlightPi_Method1) * negativeCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_negXiPi"), negativeP, cascade.negativeeta(), (negFlightPi_Method1 / negFlightPi_Method0) * negativeCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_negXiPi"), negativeP, cascade.negativeeta(), (negFlightPi_Method1 / negFlightPi_Method0)); } if (std::abs(bachFlightPi_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(bachFlightPi_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { histos.fill(HIST("hDeltaTimeMethodsVsP_bachXiPi"), bachelorP, cascade.bacheloreta(), (bachFlightPi_Method0 - bachFlightPi_Method1) * bachelorCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_bachXiPi"), bachelorP, cascade.bacheloreta(), (bachFlightPi_Method1 / bachFlightPi_Method0) * bachelorCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_bachXiPi"), bachelorP, cascade.bacheloreta(), (bachFlightPi_Method1 / bachFlightPi_Method0)); } } if (doQANSigma) { @@ -1196,15 +1407,15 @@ struct strangenesstofpid { if (calculationMethod.value == 2) { if (std::abs(posFlightPr_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(posFlightPr_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { histos.fill(HIST("hDeltaTimeMethodsVsP_posOmPr"), positiveP, cascade.positiveeta(), (posFlightPr_Method0 - posFlightPr_Method1) * positiveCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_posOmPr"), positiveP, cascade.positiveeta(), (posFlightPr_Method1 / posFlightPr_Method0) * positiveCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_posOmPr"), positiveP, cascade.positiveeta(), (posFlightPr_Method1 / posFlightPr_Method0)); } if (std::abs(negFlightPi_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(negFlightPi_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { histos.fill(HIST("hDeltaTimeMethodsVsP_negOmPi"), negativeP, cascade.negativeeta(), (negFlightPi_Method0 - negFlightPi_Method1) * negativeCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_negOmPi"), negativeP, cascade.negativeeta(), (negFlightPi_Method1 / negFlightPi_Method0) * negativeCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_negOmPi"), negativeP, cascade.negativeeta(), (negFlightPi_Method1 / negFlightPi_Method0)); } if (std::abs(bachFlightKa_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(bachFlightKa_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { histos.fill(HIST("hDeltaTimeMethodsVsP_bachOmKa"), bachelorP, cascade.bacheloreta(), (bachFlightKa_Method0 - bachFlightKa_Method1) * bachelorCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_bachOmKa"), bachelorP, cascade.bacheloreta(), (bachFlightKa_Method1 / bachFlightKa_Method0) * bachelorCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_bachOmKa"), bachelorP, cascade.bacheloreta(), (bachFlightKa_Method1 / bachFlightKa_Method0)); } } if (doQANSigma) { @@ -1221,15 +1432,15 @@ struct strangenesstofpid { if (calculationMethod.value == 2) { if (std::abs(posFlightPi_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(posFlightPi_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { histos.fill(HIST("hDeltaTimeMethodsVsP_posXiPi"), positiveP, cascade.positiveeta(), (posFlightPi_Method0 - posFlightPi_Method1) * positiveCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_posXiPi"), positiveP, cascade.positiveeta(), (posFlightPi_Method1 / posFlightPi_Method1) * positiveCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_posXiPi"), positiveP, cascade.positiveeta(), (posFlightPi_Method1 / posFlightPi_Method1)); } if (std::abs(negFlightPr_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(negFlightPr_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { histos.fill(HIST("hDeltaTimeMethodsVsP_negXiPr"), negativeP, cascade.negativeeta(), (negFlightPr_Method0 - negFlightPr_Method1) * negativeCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_negXiPr"), negativeP, cascade.negativeeta(), (negFlightPr_Method1 / negFlightPr_Method0) * negativeCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_negXiPr"), negativeP, cascade.negativeeta(), (negFlightPr_Method1 / negFlightPr_Method0)); } if (std::abs(bachFlightPi_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(bachFlightPi_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { histos.fill(HIST("hDeltaTimeMethodsVsP_bachXiPi"), bachelorP, cascade.bacheloreta(), (bachFlightPi_Method0 - bachFlightPi_Method1) * bachelorCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_bachXiPi"), bachelorP, cascade.bacheloreta(), (bachFlightPi_Method1 / bachFlightPi_Method0) * bachelorCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_bachXiPi"), bachelorP, cascade.bacheloreta(), (bachFlightPi_Method1 / bachFlightPi_Method0)); } } if (doQANSigma) { @@ -1245,15 +1456,15 @@ struct strangenesstofpid { if (calculationMethod.value == 2) { if (std::abs(posFlightPi_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(posFlightPi_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { histos.fill(HIST("hDeltaTimeMethodsVsP_posOmPi"), positiveP, cascade.positiveeta(), (posFlightPi_Method0 - posFlightPi_Method1) * positiveCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_posOmPi"), positiveP, cascade.positiveeta(), (posFlightPi_Method1 / posFlightPi_Method1) * positiveCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_posOmPi"), positiveP, cascade.positiveeta(), (posFlightPi_Method1 / posFlightPi_Method1)); } if (std::abs(negFlightPr_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(negFlightPr_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { histos.fill(HIST("hDeltaTimeMethodsVsP_negOmPr"), negativeP, cascade.negativeeta(), (negFlightPr_Method0 - negFlightPr_Method1) * negativeCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_negOmPr"), negativeP, cascade.negativeeta(), (negFlightPr_Method1 / negFlightPr_Method0) * negativeCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_negOmPr"), negativeP, cascade.negativeeta(), (negFlightPr_Method1 / negFlightPr_Method0)); } if (std::abs(bachFlightKa_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(bachFlightKa_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { histos.fill(HIST("hDeltaTimeMethodsVsP_bachOmKa"), bachelorP, cascade.bacheloreta(), (bachFlightKa_Method0 - bachFlightKa_Method1) * bachelorCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_bachOmKa"), bachelorP, cascade.bacheloreta(), (bachFlightKa_Method1 / bachFlightKa_Method1) * bachelorCosine); + histos.fill(HIST("hRatioTimeMethodsVsP_bachOmKa"), bachelorP, cascade.bacheloreta(), (bachFlightKa_Method1 / bachFlightKa_Method1)); } } if (doQANSigma) { diff --git a/PWGLF/Tasks/QC/strangepidqa.cxx b/PWGLF/Tasks/QC/strangepidqa.cxx index 2dd9c58b4e7..08e502b87f5 100644 --- a/PWGLF/Tasks/QC/strangepidqa.cxx +++ b/PWGLF/Tasks/QC/strangepidqa.cxx @@ -51,22 +51,16 @@ struct strangepidqa { ConfigurableAxis vertexZ{"vertexZ", {30, -15.0f, 15.0f}, ""}; // base properties - ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "p_{T} (GeV/c)"}; + ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f}, "p_{T} (GeV/c)"}; ConfigurableAxis axisRadius{"axisRadius", {200, 0.0f, 100.0f}, "V0 radius (cm)"}; ConfigurableAxis centAxis{"centAxis", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 50.0f, 70.0f, 100.0f}, "FT0C centrality"}; - AxisSpec massAxisXi = {200, 1.222f, 1.422f, "Inv. Mass (GeV/c^{2})"}; - AxisSpec massAxisOmega = {200, 1.572f, 1.772f, "Inv. Mass (GeV/c^{2})"}; - // Invariant Mass ConfigurableAxis axisK0ShortMass{"axisK0ShortMass", {200, 0.497f - 0.050f, 0.497f + 0.050f}, "M_{K0s} (GeV/c^{2})"}; ConfigurableAxis axisLambdaMass{"axisLambdaMass", {200, 1.08f, 1.16f}, "M_{#Lambda} (GeV/c^{2})"}; - - // time axes - ConfigurableAxis axisDeltaTime{"axisDeltaTime", {200, -1000.0f, +1000.0f}, "#Delta time (ps)"}; - ConfigurableAxis axisTime{"axisTime", {200, 0.0f, +20000.0f}, "T (ps)"}; - ConfigurableAxis axisBeta{"axisBeta", {1200, 0.0f, +1.2f}, "#Beta"}; + AxisSpec massAxisXi = {200, 1.222f, 1.422f, "Inv. Mass (GeV/c^{2})"}; + AxisSpec massAxisOmega = {200, 1.572f, 1.772f, "Inv. Mass (GeV/c^{2})"}; // Length axis ConfigurableAxis axisLength{"axisLength", {600, 0.0f, +600.0f}, "track Length (cm)"}; @@ -74,24 +68,8 @@ struct strangepidqa { // TOF cut axis ConfigurableAxis axisTOFCut{"axisTOFCut", {100, 0.0f, +10000.0f}, "TOF compat. cut (ps)"}; - // TOF selection matters - Configurable requireTOFsignalPion{"requireTOFsignalPion", true, "require that pion prongs have TOF"}; - Configurable requireTOFsignalProton{"requireTOFsignalProton", true, "require that proton prongs have TOF"}; - Configurable requireTOFEventTimePion{"requireTOFEventTimePion", true, "require that pion prongs have TOF event time"}; - Configurable requireTOFEventTimeProton{"requireTOFEventTimeProton", true, "require that proton prongs have TOF event time"}; - - Configurable maxDeltaTimeProton{"maxDeltaTimeProton", 1e+9, "check maximum allowed time"}; - Configurable maxDeltaTimePion{"maxDeltaTimePion", 1e+9, "check maximum allowed time"}; - Configurable maxDeltaTimeDecay{"maxDeltaTimeDecay", 1e+9, "check maximum allowed delta-time-decay"}; - - Configurable minCentrality{"minCentrality", 60, "max value of centrality allowed"}; - Configurable maxCentrality{"maxCentrality", 100, "max value of centrality allowed"}; - - Configurable minV0Radius{"minV0Radius", 1.5, "min radius"}; - Configurable minCosPA{"minCosPA", .98, "min cosPA"}; - - Configurable minPtV0{"minPtV0", 1.0, "min pT for integrated mass histograms"}; - Configurable maxPtV0{"maxPtV0", 3.0, "max pT for integrated mass histograms"}; + // nsigma axis + ConfigurableAxis axisNSigma{"axisNSigma", {60, -3.0f, +3.0f}, "NSigma"}; //*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+* // Selection criteria for cascade analysis @@ -112,14 +90,9 @@ struct strangepidqa { Configurable tpcNsigmaBachelor{"tpcNsigmaBachelor", 4, "TPC NSigma bachelor (>10 is no cut)"}; Configurable tpcNsigmaProton{"tpcNsigmaProton", 4, "TPC NSigma proton <- lambda (>10 is no cut)"}; Configurable tpcNsigmaPion{"tpcNsigmaPion", 4, "TPC NSigma pion <- lambda (>10 is no cut)"}; - - Configurable tofNsigmaXiLaPr{"tpcNsigmaXiLaPr", 1e+5, "TOF NSigma proton <- lambda <- Xi (>10 is no cut)"}; - Configurable tofNsigmaXiLaPi{"tpcNsigmaXiLaPi", 1e+5, "TOF NSigma pion <- lambda <- Xi (>10 is no cut)"}; - Configurable tofNsigmaXiPi{"tpcNsigmaXiPi", 1e+5, "TOF NSigma pion <- Xi (>10 is no cut)"}; - Configurable tofNsigmaOmLaPr{"tpcNsigmaOmLaPr", 1e+5, "TOF NSigma proton <- lambda <- Omega (>10 is no cut)"}; - Configurable tofNsigmaOmLaPi{"tpcNsigmaOmLaPi", 1e+5, "TOF NSigma pion <- lambda <- Omega (>10 is no cut)"}; - Configurable tofNsigmaOmKa{"tpcNsigmaOmKa", 1e+5, "TOF NSigma Kaon <- Omega (>10 is no cut)"}; - + //*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+* + // Direct test configurables + Configurable massWindowForNSigmaPlots{"massWindowForNSigmaPlots", 0.005f, "mass window for Nsigma comparison plots"}; Configurable tofNsigmaCompatibility{"tofNsigmaCompatibility", 4, "compatibility check for V0s"}; Configurable tofNsigmaCompatibilityCascades{"tofNsigmaCompatibilityCascades", 4, "compatibility check for cascades"}; //*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+* @@ -129,97 +102,6 @@ struct strangepidqa { // Event counter histos.add("hEventCentrality", "hEventCentrality", kTH1F, {{100, 0.0f, 100.0f}}); - // Presence of negative and positive signals and event time - auto hPositiveStatus = histos.add("hPositiveStatus", "hPositiveStatus", kTH1F, {{4, -0.5f, 3.5f}}); - auto hNegativeStatus = histos.add("hNegativeStatus", "hNegativeStatus", kTH1F, {{4, -0.5f, 3.5f}}); - auto hPositiveStatusReachedTOF = histos.add("hPositiveStatusReachedTOF", "hPositiveStatusReachedTOF", kTH1F, {{4, -0.5f, 3.5f}}); - auto hNegativeStatusReachedTOF = histos.add("hNegativeStatusReachedTOF", "hNegativeStatusReachedTOF", kTH1F, {{4, -0.5f, 3.5f}}); - hPositiveStatus->GetXaxis()->SetBinLabel(1, "All positive"); - hPositiveStatus->GetXaxis()->SetBinLabel(2, "Has only TOF sig"); - hPositiveStatus->GetXaxis()->SetBinLabel(3, "Has only TOF ev time"); - hPositiveStatus->GetXaxis()->SetBinLabel(4, "Has full time info"); - hNegativeStatus->GetXaxis()->SetBinLabel(1, "All negative"); - hNegativeStatus->GetXaxis()->SetBinLabel(2, "Has only TOF sig"); - hNegativeStatus->GetXaxis()->SetBinLabel(3, "Has only TOF ev time"); - hNegativeStatus->GetXaxis()->SetBinLabel(4, "Has full time info"); - - hPositiveStatusReachedTOF->GetXaxis()->SetBinLabel(1, "All positive"); - hPositiveStatusReachedTOF->GetXaxis()->SetBinLabel(2, "Has only TOF sig"); - hPositiveStatusReachedTOF->GetXaxis()->SetBinLabel(3, "Has only TOF ev time"); - hPositiveStatusReachedTOF->GetXaxis()->SetBinLabel(4, "Has full time info"); - hNegativeStatusReachedTOF->GetXaxis()->SetBinLabel(1, "All negative"); - hNegativeStatusReachedTOF->GetXaxis()->SetBinLabel(2, "Has only TOF sig"); - hNegativeStatusReachedTOF->GetXaxis()->SetBinLabel(3, "Has only TOF ev time"); - hNegativeStatusReachedTOF->GetXaxis()->SetBinLabel(4, "Has full time info"); - - // V0 Radius - histos.add("hLambdaMass", "hLambdaMass", {HistType::kTH1F, {axisLambdaMass}}); - histos.add("hAssocLambdaMass", "hAssocLambdaMass", {HistType::kTH1F, {axisLambdaMass}}); - histos.add("hAssocLambdaMassGoodTime", "hAssocLambdaMassGoodTime", {HistType::kTH1F, {axisLambdaMass}}); - histos.add("hAssocLambdaMassBadTime", "hAssocLambdaMassBadTime", {HistType::kTH1F, {axisLambdaMass}}); - - // V0 Radius - histos.add("h2dLambdaRadiusVsPt", "hLambdaRadiusVsPt", {HistType::kTH2F, {axisPt, axisRadius}}); - - // Invariant Mass - histos.add("h2dLambdaMassVsPt", "hLambdaMassVsPt", {HistType::kTH2F, {axisPt, axisLambdaMass}}); - - // Invariant Mass - histos.add("h2dLambdaMassVsTOFCut", "h2dLambdaMassVsTOFCut", {HistType::kTH2F, {axisLambdaMass, axisTOFCut}}); - histos.add("h2dLambdaMassVsTOFCutWithSignals", "h2dLambdaMassVsTOFCutWithSignals", {HistType::kTH2F, {axisLambdaMass, axisTOFCut}}); - histos.add("h2dLambdaMassVsTOFCutMeson", "h2dLambdaMassVsTOFCutMeson", {HistType::kTH2F, {axisLambdaMass, axisTOFCut}}); - histos.add("h2dLambdaMassVsTOFCutMesonWithSignals", "h2dLambdaMassVsTOFCutMesonWithSignals", {HistType::kTH2F, {axisLambdaMass, axisTOFCut}}); - - // Invariant Mass with TOF selections - histos.add("hLambdaMass_ProtonTOF", "hLambdaMass_ProtonTOF", {HistType::kTH1F, {axisLambdaMass}}); - histos.add("hLambdaMass_PionTOF", "hLambdaMass_PionTOF", {HistType::kTH1F, {axisLambdaMass}}); - histos.add("hLambdaMass_AllTOF", "hLambdaMass_AllTOF", {HistType::kTH1F, {axisLambdaMass}}); - histos.add("hLambdaMass_DeltaDecayTime", "hLambdaMass_DeltaDecayTime", {HistType::kTH1F, {axisLambdaMass}}); - histos.add("h2dLambdaMassVsPt_ProtonTOF", "hLambdaMassVsPtProtonTOF", {HistType::kTH2F, {axisPt, axisLambdaMass}}); - histos.add("h2dLambdaMassVsPt_PionTOF", "hLambdaMassVsPtPionTOF", {HistType::kTH2F, {axisPt, axisLambdaMass}}); - histos.add("h2dLambdaMassVsPt_AllTOF", "hLambdaMassVsPtAllTOF", {HistType::kTH2F, {axisPt, axisLambdaMass}}); - histos.add("h2dLambdaMassVsPt_DeltaDecayTime", "hLambdaMassVsPtDeltaDecayTime", {HistType::kTH2F, {axisPt, axisLambdaMass}}); - - // Invariant Mass with TOF selections - histos.add("hLambdaMass_InvertProtonTOF", "hLambdaMass_InvertProtonTOF", {HistType::kTH1F, {axisLambdaMass}}); - histos.add("hLambdaMass_InvertPionTOF", "hLambdaMass_InvertPionTOF", {HistType::kTH1F, {axisLambdaMass}}); - histos.add("hLambdaMass_InvertAllTOF", "hLambdaMass_InvertAllTOF", {HistType::kTH1F, {axisLambdaMass}}); - histos.add("h2dLambdaMassVsPt_InvertProtonTOF", "hLambdaMassVsPtInvertProtonTOF", {HistType::kTH2F, {axisPt, axisLambdaMass}}); - histos.add("h2dLambdaMassVsPt_InvertPionTOF", "hLambdaMassVsPtInvertPionTOF", {HistType::kTH2F, {axisPt, axisLambdaMass}}); - histos.add("h2dLambdaMassVsPt_InvertAllTOF", "hLambdaMassVsPtInvertAllTOF", {HistType::kTH2F, {axisPt, axisLambdaMass}}); - - // radius vs prong length - histos.add("h2dProtonLengthVsRadius", "h2dProtonLengthVsRadius", {HistType::kTH2F, {axisRadius, axisLength}}); - histos.add("h2dPionLengthVsRadius", "h2dPionLengthVsRadius", {HistType::kTH2F, {axisRadius, axisLength}}); - - // recalculated vs topv lengths - histos.add("h2dProtonLengthVsLengthToPV", "h2dProtonLengthVsRadiusToPV", {HistType::kTH2F, {axisRadius, axisRadius}}); - histos.add("h2dPionLengthVsLengthToPV", "h2dPionLengthVsLengthToPV", {HistType::kTH2F, {axisRadius, axisRadius}}); - - // TOF PID testing for prongs - histos.add("h2dProtonDeltaTimeVsPt", "h2dProtonDeltaTimeVsPt", {HistType::kTH2F, {axisPt, axisDeltaTime}}); - histos.add("h2dProtonDeltaTimeVsRadius", "h2dProtonDeltaTimeVsRadius", {HistType::kTH2F, {axisRadius, axisDeltaTime}}); - histos.add("h2dPionDeltaTimeVsPt", "h2dPionDeltaTimeVsPt", {HistType::kTH2F, {axisPt, axisDeltaTime}}); - histos.add("h2dPionDeltaTimeVsRadius", "h2dPionDeltaTimeVsRadius", {HistType::kTH2F, {axisRadius, axisDeltaTime}}); - - // TOF PID testing for prongs - histos.add("h2dProtonDeltaTimeVsPt_MassSelected", "h2dProtonDeltaTimeVsPt_MassSelected", {HistType::kTH2F, {axisPt, axisDeltaTime}}); - histos.add("h2dProtonDeltaTimeVsRadius_MassSelected", "h2dProtonDeltaTimeVsRadius_MassSelected", {HistType::kTH2F, {axisRadius, axisDeltaTime}}); - histos.add("h2dPionDeltaTimeVsPt_MassSelected", "h2dPionDeltaTimeVsPt_MassSelected", {HistType::kTH2F, {axisPt, axisDeltaTime}}); - histos.add("h2dPionDeltaTimeVsRadius_MassSelected", "h2dPionDeltaTimeVsRadius_MassSelected", {HistType::kTH2F, {axisRadius, axisDeltaTime}}); - - // delta lambda decay time - histos.add("h2dLambdaDeltaDecayTime", "h2dLambdaDeltaDecayTime", {HistType::kTH2F, {axisPt, axisDeltaTime}}); - histos.add("h2dLambdaDeltaDecayTime_MassSelected", "h2dLambdaDeltaDecayTime_MassSelected", {HistType::kTH2F, {axisPt, axisDeltaTime}}); - - // beta plots - histos.add("h2dLambdaBeta", "h2dLambdaBeta", {HistType::kTH2F, {axisPt, axisBeta}}); - histos.add("h2dLambdaBeta_MassSelected", "h2dLambdaBeta_MassSelected", {HistType::kTH2F, {axisPt, axisBeta}}); - - // length vs time for prongs / debug - histos.add("h2dTimeVsLengthProtonProng", "h2dTimeVsLengthProtonProng", {HistType::kTH2F, {axisLength, axisTime}}); - histos.add("h2dTimeVsLengthPionProng", "h2dTimeVsLengthPionProng", {HistType::kTH2F, {axisLength, axisTime}}); - histos.add("h1dMassK0Short", "h1dMassK0Short", {HistType::kTH1F, {axisK0ShortMass}}); histos.add("h1dMassLambda", "h1dMassLambda", {HistType::kTH1F, {axisLambdaMass}}); histos.add("h1dMassAntiLambda", "h1dMassAntiLambda", {HistType::kTH1F, {axisLambdaMass}}); @@ -230,39 +112,21 @@ struct strangepidqa { histos.add("h3dMassK0Short", "h3dMassK0Short", {HistType::kTH3F, {centAxis, axisPt, axisK0ShortMass}}); histos.add("h3dMassLambda", "h3dMassLambda", {HistType::kTH3F, {centAxis, axisPt, axisLambdaMass}}); histos.add("h3dMassAntiLambda", "h3dMassAntiLambda", {HistType::kTH3F, {centAxis, axisPt, axisLambdaMass}}); - histos.add("h3dMassCompatibleK0Short", "h3dMassCompatibleK0Short", {HistType::kTH3F, {centAxis, axisPt, axisK0ShortMass}}); histos.add("h3dMassCompatibleLambda", "h3dMassCompatibleLambda", {HistType::kTH3F, {centAxis, axisPt, axisLambdaMass}}); histos.add("h3dMassCompatibleAntiLambda", "h3dMassCompatibleAntiLambda", {HistType::kTH3F, {centAxis, axisPt, axisLambdaMass}}); - // --- ASSOCIATED --- - // V0 Radius - if (doprocessSim) { - histos.add("h2dAssocLambdaRadiusVsPt", "hLambdaRadiusVsPt", {HistType::kTH2F, {axisPt, axisRadius}}); + // cross-check if compatibility requested with primary TOF instead (requires non-derived) + histos.add("h3dPrimaryTOFMassCompatibleK0Short", "h3dPrimaryTOFMassCompatibleK0Short", {HistType::kTH3F, {centAxis, axisPt, axisK0ShortMass}}); + histos.add("h3dPrimaryTOFMassCompatibleLambda", "h3dPrimaryTOFMassCompatibleLambda", {HistType::kTH3F, {centAxis, axisPt, axisLambdaMass}}); + histos.add("h3dPrimaryTOFMassCompatibleAntiLambda", "h3dPrimaryTOFMassCompatibleAntiLambda", {HistType::kTH3F, {centAxis, axisPt, axisLambdaMass}}); - // Invariant Mass - histos.add("h2dAssocLambdaMassVsPt", "hLambdaMassVsPt", {HistType::kTH2F, {axisPt, axisLambdaMass}}); - - // radius vs prong length - histos.add("h2dAssocProtonLengthVsRadius", "h2dAssocProtonLengthVsRadius", {HistType::kTH2F, {axisRadius, axisLength}}); - histos.add("h2dAssocPionLengthVsRadius", "h2dAssocPionLengthVsRadius", {HistType::kTH2F, {axisRadius, axisLength}}); - - // recalculated vs topv lengths - histos.add("h2dAssocProtonLengthVsLengthToPV", "h2dAssocProtonLengthVsRadiusToPV", {HistType::kTH2F, {axisRadius, axisRadius}}); - histos.add("h2dAssocPionLengthVsLengthToPV", "h2dAssocPionLengthVsLengthToPV", {HistType::kTH2F, {axisRadius, axisRadius}}); - - // TOF PID testing for prongs - histos.add("h2dAssocProtonDeltaTimeVsPt", "h2dAssocProtonDeltaTimeVsPt", {HistType::kTH2F, {axisPt, axisDeltaTime}}); - histos.add("h2dAssocProtonDeltaTimeVsRadius", "h2dAssocProtonDeltaTimeVsRadius", {HistType::kTH2F, {axisRadius, axisDeltaTime}}); - histos.add("h2dAssocPionDeltaTimeVsPt", "h2dAssocPionDeltaTimeVsPt", {HistType::kTH2F, {axisPt, axisDeltaTime}}); - histos.add("h2dAssocPionDeltaTimeVsRadius", "h2dAssocPionDeltaTimeVsRadius", {HistType::kTH2F, {axisRadius, axisDeltaTime}}); - - // delta lambda decay time - histos.add("h2dAssocLambdaDeltaDecayTime", "h2dAssocLambdaDeltaDecayTime", {HistType::kTH2F, {axisPt, axisDeltaTime}}); - histos.add("h2dAssocLambdaDeltaDecayTime_MassSelected", "h2dAssocLambdaDeltaDecayTime_MassSelected", {HistType::kTH2F, {axisPt, axisDeltaTime}}); - } + // plot Nsigma: primary vs secondary TOF vs pT (use narrow window around mass) + histos.add("h3dNSigmasLaPr", "h3dNSigmasLaPr", {HistType::kTH3F, {axisNSigma, axisNSigma, axisPt}}); + histos.add("h3dNSigmasLaPi", "h3dNSigmasLaPi", {HistType::kTH3F, {axisNSigma, axisNSigma, axisPt}}); + histos.add("h3dNSigmasK0Pi", "h3dNSigmasK0Pi", {HistType::kTH3F, {axisNSigma, axisNSigma, axisPt}}); - if (doprocessCascades) { + if (doprocessCascades || doprocessCascadesNonDerived) { histos.add("h1dMassXiMinus", "h1dMassXiMinus", {HistType::kTH1F, {massAxisXi}}); histos.add("h1dMassXiPlus", "h1dMassXiPlus", {HistType::kTH1F, {massAxisXi}}); histos.add("h1dMassOmegaMinus", "h1dMassOmegaMinus", {HistType::kTH1F, {massAxisOmega}}); @@ -276,19 +140,30 @@ struct strangepidqa { histos.add("h3dMassXiPlus", "h3dMassXiPlus", {HistType::kTH3F, {centAxis, axisPt, massAxisXi}}); histos.add("h3dMassOmegaMinus", "h3dMassOmegaMinus", {HistType::kTH3F, {centAxis, axisPt, massAxisOmega}}); histos.add("h3dMassOmegaPlus", "h3dMassOmegaPlus", {HistType::kTH3F, {centAxis, axisPt, massAxisOmega}}); - histos.add("h3dMassCompatibleXiMinus", "h3dMassCompatibleXiMinus", {HistType::kTH3F, {centAxis, axisPt, massAxisXi}}); histos.add("h3dMassCompatibleXiPlus", "h3dMassCompatibleXiPlus", {HistType::kTH3F, {centAxis, axisPt, massAxisXi}}); histos.add("h3dMassCompatibleOmegaMinus", "h3dMassCompatibleOmegaMinus", {HistType::kTH3F, {centAxis, axisPt, massAxisOmega}}); histos.add("h3dMassCompatibleOmegaPlus", "h3dMassCompatibleOmegaPlus", {HistType::kTH3F, {centAxis, axisPt, massAxisOmega}}); + + // cross-check if compatibility requested with primary TOF instead (requires non-derived) + histos.add("h3dPrimaryTOFMassCompatibleXiMinus", "h3dPrimaryTOFMassCompatibleXiMinus", {HistType::kTH3F, {centAxis, axisPt, massAxisXi}}); + histos.add("h3dPrimaryTOFMassCompatibleXiPlus", "h3dPrimaryTOFMassCompatibleXiPlus", {HistType::kTH3F, {centAxis, axisPt, massAxisXi}}); + histos.add("h3dPrimaryTOFMassCompatibleOmegaMinus", "h3dPrimaryTOFMassCompatibleOmegaMinus", {HistType::kTH3F, {centAxis, axisPt, massAxisOmega}}); + histos.add("h3dPrimaryTOFMassCompatibleOmegaPlus", "h3dPrimaryTOFMassCompatibleOmegaPlus", {HistType::kTH3F, {centAxis, axisPt, massAxisOmega}}); + + // plot Nsigma: primary vs secondary TOF vs pT (use narrow window around mass) + histos.add("h3dNSigmasXiLaPr", "h3dNSigmasXiLaPr", {HistType::kTH3F, {axisNSigma, axisNSigma, axisPt}}); + histos.add("h3dNSigmasXiLaPi", "h3dNSigmasXiLaPi", {HistType::kTH3F, {axisNSigma, axisNSigma, axisPt}}); + histos.add("h3dNSigmasXiPi", "h3dNSigmasXiPi", {HistType::kTH3F, {axisNSigma, axisNSigma, axisPt}}); + + histos.add("h3dNSigmasOmLaPr", "h3dNSigmasOmLaPr", {HistType::kTH3F, {axisNSigma, axisNSigma, axisPt}}); + histos.add("h3dNSigmasOmLaPi", "h3dNSigmasOmLaPi", {HistType::kTH3F, {axisNSigma, axisNSigma, axisPt}}); + histos.add("h3dNSigmasOmKa", "h3dNSigmasOmKa", {HistType::kTH3F, {axisNSigma, axisNSigma, axisPt}}); } } void processReal(soa::Join::iterator const& coll, soa::Join const& v0s, soa::Join const&) { - if (coll.centFT0C() > maxCentrality || coll.centFT0C() < minCentrality) - return; - for (auto& lambda : v0s) { // selecting photons from Sigma0 if (TMath::Abs(lambda.eta()) > 0.5) @@ -326,127 +201,157 @@ struct strangepidqa { histos.fill(HIST("h1dMassCompatibleK0Short"), lambda.mK0Short()); } } + } + } - histos.fill(HIST("h2dLambdaMassVsTOFCut"), lambda.mLambda(), TMath::Abs(lambda.posTOFDeltaTLaPr())); - histos.fill(HIST("h2dLambdaMassVsTOFCutMeson"), lambda.mLambda(), TMath::Abs(lambda.negTOFDeltaTLaPi())); - - if (lambda.v0radius() < minV0Radius) - continue; - - histos.fill(HIST("h2dLambdaDeltaDecayTime"), lambda.pt(), lambda.deltaDecayTimeLambda()); - if (TMath::Abs(lambda.mLambda() - 1.115683) < 0.01 && lambda.v0cosPA() > minCosPA) { - histos.fill(HIST("h2dLambdaDeltaDecayTime_MassSelected"), lambda.pt(), lambda.deltaDecayTimeLambda()); - } + // ____________________________________________________________________________ + // QA TOF NSigma quantities + Filter preFilter = + nabs(aod::cascdata::dcapostopv) > v0setting_dcapostopv&& nabs(aod::cascdata::dcanegtopv) > v0setting_dcanegtopv&& nabs(aod::cascdata::dcabachtopv) > cascadesetting_dcabachtopv&& aod::cascdata::dcaV0daughters < v0setting_dcav0dau&& aod::cascdata::dcacascdaughters < cascadesetting_dcacascdau; - if (lambda.pt() > minPtV0 && lambda.pt() < maxPtV0) - histos.fill(HIST("hLambdaMass"), lambda.mLambda()); + void processCascades(soa::Join const& collisions, soa::Filtered> const& Cascades, soa::Join const&) + { + for (auto& casc : Cascades) { + auto col = collisions.rawIteratorAt(casc.straCollisionId()); - histos.fill(HIST("h2dLambdaRadiusVsPt"), lambda.pt(), lambda.v0radius()); - histos.fill(HIST("h2dLambdaMassVsPt"), lambda.pt(), lambda.mLambda()); + // major selections here + if (casc.v0radius() > v0setting_radius && + casc.cascradius() > cascadesetting_cascradius && + casc.v0cosPA(col.posX(), col.posY(), col.posZ()) > v0setting_cospa && + casc.casccosPA(col.posX(), col.posY(), col.posZ()) > cascadesetting_cospa && + casc.dcav0topv(col.posX(), col.posY(), col.posZ()) > cascadesetting_mindcav0topv && + TMath::Abs(casc.mLambda() - 1.115683) < cascadesetting_v0masswindow) { - histos.fill(HIST("h2dProtonDeltaTimeVsPt"), lambda.pt(), lambda.posTOFDeltaTLaPr()); - histos.fill(HIST("h2dProtonDeltaTimeVsRadius"), lambda.v0radius(), lambda.posTOFDeltaTLaPr()); - histos.fill(HIST("h2dPionDeltaTimeVsPt"), lambda.pt(), lambda.negTOFDeltaTLaPi()); - histos.fill(HIST("h2dPionDeltaTimeVsRadius"), lambda.v0radius(), lambda.negTOFDeltaTLaPi()); - histos.fill(HIST("h2dLambdaBeta"), lambda.p(), lambda.tofBetaLambda()); + auto negExtra = casc.negTrackExtra_as>(); + auto posExtra = casc.posTrackExtra_as>(); + auto bachExtra = casc.bachTrackExtra_as>(); - if (TMath::Abs(lambda.mLambda() - 1.115683) < 0.01 && lambda.v0cosPA() > minCosPA) { - histos.fill(HIST("h2dProtonDeltaTimeVsPt_MassSelected"), lambda.pt(), lambda.posTOFDeltaTLaPr()); - histos.fill(HIST("h2dProtonDeltaTimeVsRadius_MassSelected"), lambda.v0radius(), lambda.posTOFDeltaTLaPr()); - histos.fill(HIST("h2dPionDeltaTimeVsPt_MassSelected"), lambda.pt(), lambda.negTOFDeltaTLaPi()); - histos.fill(HIST("h2dPionDeltaTimeVsRadius_MassSelected"), lambda.v0radius(), lambda.negTOFDeltaTLaPi()); - histos.fill(HIST("h2dLambdaBeta_MassSelected"), lambda.p(), lambda.tofBetaLambda()); - } + if (negExtra.tpcCrossedRows() < tpcCrossedRows || posExtra.tpcCrossedRows() < tpcCrossedRows || bachExtra.tpcCrossedRows() < tpcCrossedRows) + continue; - // Standard selection of time - if (TMath::Abs(lambda.deltaDecayTimeLambda()) < maxDeltaTimeDecay) { - histos.fill(HIST("h2dLambdaMassVsPt_DeltaDecayTime"), lambda.pt(), lambda.mLambda()); - if (lambda.pt() > minPtV0 && lambda.pt() < maxPtV0) - histos.fill(HIST("hLambdaMass_DeltaDecayTime"), lambda.mLambda()); - } + if (casc.sign() < 0) { + if (TMath::Abs(posExtra.tpcNSigmaPr()) < tpcNsigmaProton && TMath::Abs(negExtra.tpcNSigmaPi()) < tpcNsigmaPion && TMath::Abs(bachExtra.tpcNSigmaPi()) < tpcNsigmaBachelor) { + histos.fill(HIST("h3dMassXiMinus"), col.centFT0C(), casc.pt(), casc.mXi()); + histos.fill(HIST("h1dMassXiMinus"), casc.mXi()); + if (casc.tofXiCompatibility(tofNsigmaCompatibilityCascades.value)) { + histos.fill(HIST("h3dMassCompatibleXiMinus"), col.centFT0C(), casc.pt(), casc.mXi()); + histos.fill(HIST("h1dMassCompatibleXiMinus"), casc.mXi()); + } + } + if (TMath::Abs(posExtra.tpcNSigmaPr()) < tpcNsigmaProton && TMath::Abs(negExtra.tpcNSigmaPi()) < tpcNsigmaPion && TMath::Abs(bachExtra.tpcNSigmaKa()) < tpcNsigmaBachelor) { + histos.fill(HIST("h3dMassOmegaMinus"), col.centFT0C(), casc.pt(), casc.mOmega()); + histos.fill(HIST("h1dMassOmegaMinus"), casc.mOmega()); + if (casc.tofOmegaCompatibility(tofNsigmaCompatibilityCascades.value)) { + histos.fill(HIST("h3dMassCompatibleOmegaMinus"), col.centFT0C(), casc.pt(), casc.mOmega()); + histos.fill(HIST("h1dMassCompatibleOmegaMinus"), casc.mOmega()); + } + } + } else { + if (TMath::Abs(posExtra.tpcNSigmaPi()) < tpcNsigmaPion && TMath::Abs(negExtra.tpcNSigmaPr()) < tpcNsigmaProton && TMath::Abs(bachExtra.tpcNSigmaPi()) < tpcNsigmaBachelor) { + histos.fill(HIST("h3dMassXiPlus"), col.centFT0C(), casc.pt(), casc.mXi()); + histos.fill(HIST("h1dMassXiPlus"), casc.mXi()); + if (casc.tofXiCompatibility(tofNsigmaCompatibilityCascades.value)) { + histos.fill(HIST("h3dMassCompatibleXiPlus"), col.centFT0C(), casc.pt(), casc.mXi()); + histos.fill(HIST("h1dMassCompatibleXiPlus"), casc.mXi()); + } + } - if (TMath::Abs(lambda.posTOFDeltaTLaPr()) < maxDeltaTimeProton) { - histos.fill(HIST("h2dLambdaMassVsPt_ProtonTOF"), lambda.pt(), lambda.mLambda()); - if (lambda.pt() > minPtV0 && lambda.pt() < maxPtV0) - histos.fill(HIST("hLambdaMass_ProtonTOF"), lambda.mLambda()); - } - if (TMath::Abs(lambda.negTOFDeltaTLaPi()) < maxDeltaTimeProton) { - histos.fill(HIST("h2dLambdaMassVsPt_PionTOF"), lambda.pt(), lambda.mLambda()); - if (lambda.pt() > minPtV0 && lambda.pt() < maxPtV0) - histos.fill(HIST("hLambdaMass_PionTOF"), lambda.mLambda()); - if (TMath::Abs(lambda.posTOFDeltaTLaPr()) < maxDeltaTimeProton) { - histos.fill(HIST("h2dLambdaMassVsPt_AllTOF"), lambda.pt(), lambda.mLambda()); - if (lambda.pt() > minPtV0 && lambda.pt() < maxPtV0) - histos.fill(HIST("hLambdaMass_AllTOF"), lambda.mLambda()); - } - } - // Inversion of time selection for debug - // if(TMath::Abs(lambda.deltaDecayTimeLambda())>maxDeltaTimeDecay && TMath::Abs(lambda.deltaDecayTimeLambda()) < 5e+4){ - // histos.fill(HIST("h2dLambdaMassVsPt_DeltaDecayTime"), lambda.pt(), lambda.mLambda()); - // if(lambda.pt()>minPtV0 && lambda.pt() < maxPtV0) histos.fill(HIST("hLambdaMass_DeltaDecayTime"), lambda.mLambda()); - // } - - if (TMath::Abs(lambda.posTOFDeltaTLaPr()) > maxDeltaTimeProton && TMath::Abs(lambda.posTOFDeltaTLaPr()) < 5e+4) { - histos.fill(HIST("h2dLambdaMassVsPt_InvertProtonTOF"), lambda.pt(), lambda.mLambda()); - if (lambda.pt() > minPtV0 && lambda.pt() < maxPtV0) - histos.fill(HIST("hLambdaMass_InvertProtonTOF"), lambda.mLambda()); - } - if (TMath::Abs(lambda.negTOFDeltaTLaPi()) > maxDeltaTimeProton && TMath::Abs(lambda.negTOFDeltaTLaPi()) < 5e+4) { - histos.fill(HIST("h2dLambdaMassVsPt_InvertPionTOF"), lambda.pt(), lambda.mLambda()); - if (lambda.pt() > minPtV0 && lambda.pt() < maxPtV0) - histos.fill(HIST("hLambdaMass_InvertPionTOF"), lambda.mLambda()); - if (TMath::Abs(lambda.posTOFDeltaTLaPr()) > maxDeltaTimeProton && TMath::Abs(lambda.posTOFDeltaTLaPr()) < 5e+4) { - histos.fill(HIST("h2dLambdaMassVsPt_InvertAllTOF"), lambda.pt(), lambda.mLambda()); - if (lambda.pt() > minPtV0 && lambda.pt() < maxPtV0) - histos.fill(HIST("hLambdaMass_InvertAllTOF"), lambda.mLambda()); + if (TMath::Abs(posExtra.tpcNSigmaPi()) < tpcNsigmaPion && TMath::Abs(negExtra.tpcNSigmaPr()) < tpcNsigmaProton && TMath::Abs(bachExtra.tpcNSigmaKa()) < tpcNsigmaBachelor) { + histos.fill(HIST("h3dMassOmegaPlus"), col.centFT0C(), casc.pt(), casc.mOmega()); + histos.fill(HIST("h1dMassOmegaPlus"), casc.mOmega()); + if (casc.tofOmegaCompatibility(tofNsigmaCompatibilityCascades.value)) { + histos.fill(HIST("h3dMassCompatibleOmegaPlus"), col.centFT0C(), casc.pt(), casc.mOmega()); + histos.fill(HIST("h1dMassCompatibleOmegaPlus"), casc.mOmega()); + } + } } } } } - void processSim(aod::StraCollision const&, soa::Join const& v0s) + void processRealNonDerived(soa::Join const& collisions, soa::Join const& v0s, soa::Join const&) { - for (auto& lambda : v0s) { // selecting photons from Sigma0 - if (lambda.pdgCode() != 3122) - continue; - if (!lambda.isPhysicalPrimary()) - continue; - if (lambda.pdgCodePositive() != 2212) - continue; - if (lambda.pdgCodeNegative() != -211) + for (auto const& col : collisions) { + histos.fill(HIST("hEventCentrality"), col.centFT0C()); + } + + for (auto& lambda : v0s) { + auto coll = collisions.rawIteratorAt(lambda.collisionId()); + + if (TMath::Abs(lambda.eta()) > 0.5) continue; - histos.fill(HIST("hAssocLambdaMass"), lambda.mLambda()); + auto negExtra = lambda.negTrack_as>(); + auto posExtra = lambda.posTrack_as>(); - histos.fill(HIST("h2dAssocLambdaRadiusVsPt"), lambda.pt(), lambda.v0radius()); - histos.fill(HIST("h2dAssocLambdaMassVsPt"), lambda.pt(), lambda.mLambda()); + bool primaryTOFcompatible_Lambda = + (!posExtra.hasTOF() || (posExtra.tofNSigmaPr() < tofNsigmaCompatibilityCascades.value)) && + (!negExtra.hasTOF() || (negExtra.tofNSigmaPi() < tofNsigmaCompatibilityCascades.value)); - histos.fill(HIST("h2dAssocProtonDeltaTimeVsPt"), lambda.pt(), lambda.posTOFDeltaTLaPr()); - histos.fill(HIST("h2dAssocProtonDeltaTimeVsRadius"), lambda.v0radius(), lambda.posTOFDeltaTLaPr()); - histos.fill(HIST("h2dAssocPionDeltaTimeVsPt"), lambda.pt(), lambda.negTOFDeltaTLaPi()); - histos.fill(HIST("h2dAssocPionDeltaTimeVsRadius"), lambda.v0radius(), lambda.negTOFDeltaTLaPi()); + bool primaryTOFcompatible_AntiLambda = + (!posExtra.hasTOF() || (posExtra.tofNSigmaPi() < tofNsigmaCompatibilityCascades.value)) && + (!negExtra.hasTOF() || (negExtra.tofNSigmaPr() < tofNsigmaCompatibilityCascades.value)); - // delta lambda decay time - histos.fill(HIST("h2dAssocLambdaDeltaDecayTime"), lambda.pt(), lambda.deltaDecayTimeLambda()); - } - } + bool primaryTOFcompatible_K0Short = + (!posExtra.hasTOF() || (posExtra.tofNSigmaPi() < tofNsigmaCompatibilityCascades.value)) && + (!negExtra.hasTOF() || (negExtra.tofNSigmaPi() < tofNsigmaCompatibilityCascades.value)); - // ____________________________________________________________________________ - // QA TOF NSigma quantities + if (TMath::Abs(posExtra.tpcNSigmaPr()) < tpcNsigmaProton && TMath::Abs(negExtra.tpcNSigmaPi()) < tpcNsigmaPion) { + // lambda case + histos.fill(HIST("h3dMassLambda"), coll.centFT0C(), lambda.pt(), lambda.mLambda()); + histos.fill(HIST("h1dMassLambda"), lambda.mLambda()); + if (lambda.tofLambdaCompatibility(tofNsigmaCompatibility.value)) { + histos.fill(HIST("h3dMassCompatibleLambda"), coll.centFT0C(), lambda.pt(), lambda.mLambda()); + histos.fill(HIST("h1dMassCompatibleLambda"), lambda.mLambda()); + } + if (primaryTOFcompatible_Lambda) { + histos.fill(HIST("h3dPrimaryTOFMassCompatibleLambda"), coll.centFT0C(), lambda.pt(), lambda.mLambda()); + } + if (std::abs(lambda.mLambda() - o2::constants::physics::MassLambda) < massWindowForNSigmaPlots.value) { + histos.fill(HIST("h3dNSigmasLaPr"), lambda.tofNSigmaLaPr(), posExtra.tofNSigmaPr(), lambda.pt()); + histos.fill(HIST("h3dNSigmasLaPi"), lambda.tofNSigmaLaPi(), negExtra.tofNSigmaPi(), lambda.pt()); + } + } - Partition> negCasc = aod::cascdata::sign < 0; - Partition> posCasc = aod::cascdata::sign > 0; + if (TMath::Abs(posExtra.tpcNSigmaPi()) < tpcNsigmaProton && TMath::Abs(negExtra.tpcNSigmaPr()) < tpcNsigmaPion) { + // lambda case + histos.fill(HIST("h3dMassAntiLambda"), coll.centFT0C(), lambda.pt(), lambda.mAntiLambda()); + histos.fill(HIST("h1dMassAntiLambda"), lambda.mAntiLambda()); + if (lambda.tofAntiLambdaCompatibility(tofNsigmaCompatibility.value)) { + histos.fill(HIST("h3dMassCompatibleAntiLambda"), coll.centFT0C(), lambda.pt(), lambda.mAntiLambda()); + histos.fill(HIST("h1dMassCompatibleAntiLambda"), lambda.mAntiLambda()); + } + if (primaryTOFcompatible_AntiLambda) { + histos.fill(HIST("h3dPrimaryTOFMassCompatibleAntiLambda"), coll.centFT0C(), lambda.pt(), lambda.mAntiLambda()); + } + } - Filter preFilter = - nabs(aod::cascdata::dcapostopv) > v0setting_dcapostopv&& nabs(aod::cascdata::dcanegtopv) > v0setting_dcanegtopv&& nabs(aod::cascdata::dcabachtopv) > cascadesetting_dcabachtopv&& aod::cascdata::dcaV0daughters < v0setting_dcav0dau&& aod::cascdata::dcacascdaughters < cascadesetting_dcacascdau; + if (TMath::Abs(posExtra.tpcNSigmaPi()) < tpcNsigmaPion && TMath::Abs(negExtra.tpcNSigmaPr()) < tpcNsigmaPion) { + // lambda case + histos.fill(HIST("h3dMassK0Short"), coll.centFT0C(), lambda.pt(), lambda.mK0Short()); + histos.fill(HIST("h1dMassK0Short"), lambda.mK0Short()); + if (lambda.tofK0ShortCompatibility(tofNsigmaCompatibility.value)) { + histos.fill(HIST("h3dMassCompatibleK0Short"), coll.centFT0C(), lambda.pt(), lambda.mK0Short()); + histos.fill(HIST("h1dMassCompatibleK0Short"), lambda.mK0Short()); + } + if (primaryTOFcompatible_K0Short) { + histos.fill(HIST("h3dPrimaryTOFMassCompatibleK0Short"), coll.centFT0C(), lambda.pt(), lambda.mK0Short()); + } + if (std::abs(lambda.mK0Short() - o2::constants::physics::MassK0Short) < massWindowForNSigmaPlots.value) { + histos.fill(HIST("h3dNSigmasK0Pi"), lambda.tofNSigmaLaPi(), posExtra.tofNSigmaPi(), lambda.pt()); + histos.fill(HIST("h3dNSigmasK0Pi"), lambda.tofNSigmaLaPi(), negExtra.tofNSigmaPi(), lambda.pt()); + } + } + } + } - void processCascades(soa::Join::iterator const& col, soa::Filtered> const& Cascades, soa::Join const&) + // to test original data (not derived) as well, compare with primary TOF Nsigmas + // don't do grouping, faster to simply stream through + void processCascadesNonDerived(soa::Join const& collisions, soa::Filtered> const& Cascades, soa::Join const&) { - histos.fill(HIST("hEventCentrality"), col.centFT0C()); - if (col.centFT0C() > maxCentrality || col.centFT0C() < minCentrality) - return; - for (auto& casc : Cascades) { + auto col = collisions.rawIteratorAt(casc.collisionId()); + // major selections here if (casc.v0radius() > v0setting_radius && casc.cascradius() > cascadesetting_cascradius && @@ -455,12 +360,33 @@ struct strangepidqa { casc.dcav0topv(col.posX(), col.posY(), col.posZ()) > cascadesetting_mindcav0topv && TMath::Abs(casc.mLambda() - 1.115683) < cascadesetting_v0masswindow) { - auto negExtra = casc.negTrackExtra_as>(); - auto posExtra = casc.posTrackExtra_as>(); - auto bachExtra = casc.bachTrackExtra_as>(); + auto negExtra = casc.negTrack_as>(); + auto posExtra = casc.posTrack_as>(); + auto bachExtra = casc.bachelor_as>(); - if (negExtra.tpcCrossedRows() < tpcCrossedRows || posExtra.tpcCrossedRows() < tpcCrossedRows || bachExtra.tpcCrossedRows() < tpcCrossedRows) + if (negExtra.tpcNClsCrossedRows() < tpcCrossedRows || posExtra.tpcNClsCrossedRows() < tpcCrossedRows || bachExtra.tpcNClsCrossedRows() < tpcCrossedRows) { continue; + } + + bool primaryTOFcompatible_XiMinus = + (!posExtra.hasTOF() || (posExtra.tofNSigmaPr() < tofNsigmaCompatibilityCascades.value)) && + (!negExtra.hasTOF() || (negExtra.tofNSigmaPi() < tofNsigmaCompatibilityCascades.value)) && + (!bachExtra.hasTOF() || (bachExtra.tofNSigmaPi() < tofNsigmaCompatibilityCascades.value)); + + bool primaryTOFcompatible_XiPlus = + (!posExtra.hasTOF() || (posExtra.tofNSigmaPi() < tofNsigmaCompatibilityCascades.value)) && + (!negExtra.hasTOF() || (negExtra.tofNSigmaPr() < tofNsigmaCompatibilityCascades.value)) && + (!bachExtra.hasTOF() || (bachExtra.tofNSigmaPi() < tofNsigmaCompatibilityCascades.value)); + + bool primaryTOFcompatible_OmegaMinus = + (!posExtra.hasTOF() || (posExtra.tofNSigmaPr() < tofNsigmaCompatibilityCascades.value)) && + (!negExtra.hasTOF() || (negExtra.tofNSigmaPi() < tofNsigmaCompatibilityCascades.value)) && + (!bachExtra.hasTOF() || (bachExtra.tofNSigmaKa() < tofNsigmaCompatibilityCascades.value)); + + bool primaryTOFcompatible_OmegaPlus = + (!posExtra.hasTOF() || (posExtra.tofNSigmaPi() < tofNsigmaCompatibilityCascades.value)) && + (!negExtra.hasTOF() || (negExtra.tofNSigmaPr() < tofNsigmaCompatibilityCascades.value)) && + (!bachExtra.hasTOF() || (bachExtra.tofNSigmaKa() < tofNsigmaCompatibilityCascades.value)); if (casc.sign() < 0) { if (TMath::Abs(posExtra.tpcNSigmaPr()) < tpcNsigmaProton && TMath::Abs(negExtra.tpcNSigmaPi()) < tpcNsigmaPion && TMath::Abs(bachExtra.tpcNSigmaPi()) < tpcNsigmaBachelor) { @@ -470,6 +396,14 @@ struct strangepidqa { histos.fill(HIST("h3dMassCompatibleXiMinus"), col.centFT0C(), casc.pt(), casc.mXi()); histos.fill(HIST("h1dMassCompatibleXiMinus"), casc.mXi()); } + if (primaryTOFcompatible_XiMinus) { + histos.fill(HIST("h3dPrimaryTOFMassCompatibleXiMinus"), col.centFT0C(), casc.pt(), casc.mXi()); + } + if (std::abs(casc.mXi() - o2::constants::physics::MassXiMinus) < massWindowForNSigmaPlots.value) { + histos.fill(HIST("h3dNSigmasXiLaPr"), casc.tofNSigmaXiLaPr(), posExtra.tofNSigmaPr(), casc.pt()); + histos.fill(HIST("h3dNSigmasXiLaPi"), casc.tofNSigmaXiLaPi(), negExtra.tofNSigmaPi(), casc.pt()); + histos.fill(HIST("h3dNSigmasXiPi"), casc.tofNSigmaXiPi(), bachExtra.tofNSigmaPi(), casc.pt()); + } } if (TMath::Abs(posExtra.tpcNSigmaPr()) < tpcNsigmaProton && TMath::Abs(negExtra.tpcNSigmaPi()) < tpcNsigmaPion && TMath::Abs(bachExtra.tpcNSigmaKa()) < tpcNsigmaBachelor) { histos.fill(HIST("h3dMassOmegaMinus"), col.centFT0C(), casc.pt(), casc.mOmega()); @@ -478,6 +412,14 @@ struct strangepidqa { histos.fill(HIST("h3dMassCompatibleOmegaMinus"), col.centFT0C(), casc.pt(), casc.mOmega()); histos.fill(HIST("h1dMassCompatibleOmegaMinus"), casc.mOmega()); } + if (primaryTOFcompatible_OmegaMinus) { + histos.fill(HIST("h3dPrimaryTOFMassCompatibleOmegaMinus"), col.centFT0C(), casc.pt(), casc.mOmega()); + } + if (std::abs(casc.mOmega() - o2::constants::physics::MassOmegaMinus) < massWindowForNSigmaPlots.value) { + histos.fill(HIST("h3dNSigmasOmLaPr"), casc.tofNSigmaOmLaPr(), posExtra.tofNSigmaPr(), casc.pt()); + histos.fill(HIST("h3dNSigmasOmLaPi"), casc.tofNSigmaOmLaPi(), negExtra.tofNSigmaPi(), casc.pt()); + histos.fill(HIST("h3dNSigmasOmKa"), casc.tofNSigmaOmKa(), bachExtra.tofNSigmaKa(), casc.pt()); + } } } else { if (TMath::Abs(posExtra.tpcNSigmaPi()) < tpcNsigmaPion && TMath::Abs(negExtra.tpcNSigmaPr()) < tpcNsigmaProton && TMath::Abs(bachExtra.tpcNSigmaPi()) < tpcNsigmaBachelor) { @@ -487,6 +429,9 @@ struct strangepidqa { histos.fill(HIST("h3dMassCompatibleXiPlus"), col.centFT0C(), casc.pt(), casc.mXi()); histos.fill(HIST("h1dMassCompatibleXiPlus"), casc.mXi()); } + if (primaryTOFcompatible_XiPlus) { + histos.fill(HIST("h3dPrimaryTOFMassCompatibleXiPlus"), col.centFT0C(), casc.pt(), casc.mXi()); + } } if (TMath::Abs(posExtra.tpcNSigmaPi()) < tpcNsigmaPion && TMath::Abs(negExtra.tpcNSigmaPr()) < tpcNsigmaProton && TMath::Abs(bachExtra.tpcNSigmaKa()) < tpcNsigmaBachelor) { @@ -496,6 +441,9 @@ struct strangepidqa { histos.fill(HIST("h3dMassCompatibleOmegaPlus"), col.centFT0C(), casc.pt(), casc.mOmega()); histos.fill(HIST("h1dMassCompatibleOmegaPlus"), casc.mOmega()); } + if (primaryTOFcompatible_OmegaPlus) { + histos.fill(HIST("h3dPrimaryTOFMassCompatibleOmegaPlus"), col.centFT0C(), casc.pt(), casc.mOmega()); + } } } } @@ -503,8 +451,11 @@ struct strangepidqa { } PROCESS_SWITCH(strangepidqa, processReal, "Produce real information", true); - PROCESS_SWITCH(strangepidqa, processSim, "Produce simulated information", true); PROCESS_SWITCH(strangepidqa, processCascades, "Process real cascades", true); + + // non-derived options + PROCESS_SWITCH(strangepidqa, processRealNonDerived, "Process real cascades from non-derived data", true); + PROCESS_SWITCH(strangepidqa, processCascadesNonDerived, "Process real cascades from non-derived data", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 4eee3ed6faeace9f91ba959898d2a30939b62362 Mon Sep 17 00:00:00 2001 From: GijsvWeelden <55794847+GijsvWeelden@users.noreply.github.com> Date: Mon, 1 Sep 2025 13:38:50 +0200 Subject: [PATCH 265/986] [PWGJE] V0 QA (#12811) --- PWGJE/Tasks/v0QA.cxx | 372 ++++++++++++++++++++++++++++++------------- 1 file changed, 258 insertions(+), 114 deletions(-) diff --git a/PWGJE/Tasks/v0QA.cxx b/PWGJE/Tasks/v0QA.cxx index 8b79b780ae4..c66bf164def 100644 --- a/PWGJE/Tasks/v0QA.cxx +++ b/PWGJE/Tasks/v0QA.cxx @@ -254,6 +254,11 @@ struct V0QA { } if (doprocessTestWeightedJetFinder) { registry.add("tests/weighted/hEvents", "Events", {HistType::kTH1D, {{2, 0.0f, 2.0f}}}); + registry.add("tests/weighted/V0PtEtaPhi", "V0 Pt Eta Phi", HistType::kTH3D, {axisV0Pt, axisEta, axisPhi}); + registry.add("tests/weighted/K0SPtEtaPhi", "K0S Pt Eta Phi", HistType::kTH3D, {axisV0Pt, axisEta, axisPhi}); + registry.add("tests/weighted/LambdaPtEtaPhi", "Lambda Pt Eta Phi", HistType::kTH3D, {axisV0Pt, axisEta, axisPhi}); + registry.add("tests/weighted/AntiLambdaPtEtaPhi", "AntiLambda Pt Eta Phi", HistType::kTH3D, {axisV0Pt, axisEta, axisPhi}); + registry.add("tests/weighted/JetPtEtaPhi", "Jet Pt, Eta, Phi", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); registry.add("tests/weighted/JetPtEtaV0Pt", "Jet Pt, Eta, V0 Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); registry.add("tests/weighted/JetPtEtaV0Z", "Jet Pt, Eta, V0 Z", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); @@ -266,6 +271,15 @@ struct V0QA { } if (doprocessTestSubtractedJetFinder) { registry.add("tests/hEvents", "Events", {HistType::kTH1D, {{2, 0.0f, 2.0f}}}); + registry.add("tests/nosub/V0PtEtaPhi", "V0 Pt, Eta, Phi", HistType::kTH3D, {axisV0Pt, axisEta, axisPhi}); + registry.add("tests/nosub/K0SPtEtaPhi", "K0S Pt, Eta, Phi", HistType::kTH3D, {axisV0Pt, axisEta, axisPhi}); + registry.add("tests/nosub/LambdaPtEtaPhi", "Lambda Pt, Eta, Phi", HistType::kTH3D, {axisV0Pt, axisEta, axisPhi}); + registry.add("tests/nosub/AntiLambdaPtEtaPhi", "AntiLambda Pt, Eta, Phi", HistType::kTH3D, {axisV0Pt, axisEta, axisPhi}); + registry.add("tests/sub/V0PtEtaPhi", "V0 Pt, Eta, Phi", HistType::kTH3D, {axisV0Pt, axisEta, axisPhi}); + registry.add("tests/sub/K0SPtEtaPhi", "K0S Pt, Eta, Phi", HistType::kTH3D, {axisV0Pt, axisEta, axisPhi}); + registry.add("tests/sub/LambdaPtEtaPhi", "Lambda Pt, Eta, Phi", HistType::kTH3D, {axisV0Pt, axisEta, axisPhi}); + registry.add("tests/sub/AntiLambdaPtEtaPhi", "AntiLambda Pt, Eta, Phi", HistType::kTH3D, {axisV0Pt, axisEta, axisPhi}); + registry.add("tests/nosub/JetPtEtaPhi", "Jet Pt, Eta, Phi", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); registry.add("tests/nosub/JetPtEtaV0Pt", "Jet Pt, Eta, V0 Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); registry.add("tests/nosub/JetPtEtaV0Z", "Jet Pt, Eta, V0 Z", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); @@ -287,6 +301,7 @@ struct V0QA { registry.add("tests/sub/JetPtEtaAntiLambdaZ", "Jet Pt, Eta, AntiLambda Z", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); } if (doprocessV0TrackQA) { + registry.add("tracks/hEvents", "evts", {HistType::kTH1D, {{2, 0.0f, 2.0f}}}); registry.add("tracks/Pos", "pos", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisEta, axisPhi}); registry.add("tracks/Neg", "neg", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisEta, axisPhi}); registry.add("tracks/Pt", "pt", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff, axisPtRelDiff}); @@ -481,6 +496,24 @@ struct V0QA { auto daughters = particle.daughtersIds(); return ((negId == daughters[0] && posId == daughters[1]) || (posId == daughters[0] && negId == daughters[1])); } + template + bool genV0PassesEfficiencyCuts(T const& pv0) + { + if (!pv0.has_daughters() || !pv0.isPhysicalPrimary()) + return false; + if (std::abs(pv0.y()) > yPartMax) + return false; + + return true; + } + template + bool recV0PassesEfficiencyCuts(T const& v0) + { + if (!v0.has_mcParticle() || v0.isRejectedCandidate()) + return false; + + return true; + } template bool hasITSHit(T const& track, int layer) @@ -489,25 +522,34 @@ struct V0QA { return (track.itsClusterMap() & (1 << ibit)); } - template - void fillMcDV0(T const& v0, bool correctCollision, double weight) + bool isV0RandomlyRejected() { - int pdg = v0.mcParticle().pdgCode(); + return (gRandom->Uniform() > v0Fraction); + } + + template + void fillMcDV0(T const& v0, U const& pv0, bool correctCollision, double weight) + { + int pdg = pv0.pdgCode(); + double pt = pv0.pt(); + double eta = v0.eta(); + double radius = v0.v0radius(); + if (std::abs(pdg) == PDG_t::kK0Short) { - registry.fill(HIST("inclusive/K0SPtEtaMass"), v0.pt(), v0.eta(), v0.mK0Short(), weight); - registry.fill(HIST("inclusive/InvMassK0STrue"), v0.pt(), v0.v0radius(), v0.mK0Short(), weight); + registry.fill(HIST("inclusive/K0SPtEtaMass"), pt, eta, v0.mK0Short(), weight); + registry.fill(HIST("inclusive/InvMassK0STrue"), pt, radius, v0.mK0Short(), weight); if (!correctCollision) - registry.fill(HIST("inclusive/K0SPtEtaMassWrongCollision"), v0.pt(), v0.eta(), v0.mK0Short(), weight); + registry.fill(HIST("inclusive/K0SPtEtaMassWrongCollision"), pt, eta, v0.mK0Short(), weight); } else if (pdg == PDG_t::kLambda0) { - registry.fill(HIST("inclusive/LambdaPtEtaMass"), v0.pt(), v0.eta(), v0.mLambda(), weight); - registry.fill(HIST("inclusive/InvMassLambdaTrue"), v0.pt(), v0.v0radius(), v0.mLambda(), weight); + registry.fill(HIST("inclusive/LambdaPtEtaMass"), pt, eta, v0.mLambda(), weight); + registry.fill(HIST("inclusive/InvMassLambdaTrue"), pt, radius, v0.mLambda(), weight); if (!correctCollision) - registry.fill(HIST("inclusive/LambdaPtEtaMassWrongCollision"), v0.pt(), v0.eta(), v0.mLambda(), weight); + registry.fill(HIST("inclusive/LambdaPtEtaMassWrongCollision"), pt, eta, v0.mLambda(), weight); } else if (pdg == PDG_t::kLambda0Bar) { - registry.fill(HIST("inclusive/AntiLambdaPtEtaMass"), v0.pt(), v0.eta(), v0.mAntiLambda(), weight); - registry.fill(HIST("inclusive/InvMassAntiLambdaTrue"), v0.pt(), v0.v0radius(), v0.mAntiLambda(), weight); + registry.fill(HIST("inclusive/AntiLambdaPtEtaMass"), pt, eta, v0.mAntiLambda(), weight); + registry.fill(HIST("inclusive/InvMassAntiLambdaTrue"), pt, radius, v0.mAntiLambda(), weight); if (!correctCollision) - registry.fill(HIST("inclusive/AntiLambdaPtEtaMassWrongCollision"), v0.pt(), v0.eta(), v0.mAntiLambda(), weight); + registry.fill(HIST("inclusive/AntiLambdaPtEtaMassWrongCollision"), pt, eta, v0.mAntiLambda(), weight); } } @@ -519,60 +561,69 @@ struct V0QA { registry.fill(HIST("jets/JetsPtEta"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), weight); } } - template - void fillMcDV0InJets(T const& mcdjet, U const& v0, bool correctCollision, double weight) + template + void fillMcDV0InJets(T const& mcdjet, U const& v0, V const& pv0, bool correctCollision, double weight) { int pdg = v0.mcParticle().pdgCode(); - double z = v0.pt() / mcdjet.pt(); + double pt = pv0.pt(); + double ptjet = mcdjet.pt(); + double eta = mcdjet.eta(); + double z = pt / ptjet; + if (std::abs(pdg) == PDG_t::kK0Short) { - registry.fill(HIST("jets/JetPtEtaK0SPt"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); - registry.fill(HIST("jets/JetPtEtaK0SZ"), mcdjet.pt(), mcdjet.eta(), z, weight); + registry.fill(HIST("jets/JetPtEtaK0SPt"), ptjet, eta, pt, weight); + registry.fill(HIST("jets/JetPtEtaK0SZ"), ptjet, eta, z, weight); if (!correctCollision) { - registry.fill(HIST("jets/JetPtEtaK0SPtWrongCollision"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); - registry.fill(HIST("jets/JetPtEtaK0SZWrongCollision"), mcdjet.pt(), mcdjet.eta(), z, weight); + registry.fill(HIST("jets/JetPtEtaK0SPtWrongCollision"), ptjet, eta, pt, weight); + registry.fill(HIST("jets/JetPtEtaK0SZWrongCollision"), ptjet, eta, z, weight); } } else if (pdg == PDG_t::kLambda0) { - registry.fill(HIST("jets/JetPtEtaLambdaPt"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); - registry.fill(HIST("jets/JetPtEtaLambdaZ"), mcdjet.pt(), mcdjet.eta(), z, weight); + registry.fill(HIST("jets/JetPtEtaLambdaPt"), ptjet, eta, pt, weight); + registry.fill(HIST("jets/JetPtEtaLambdaZ"), ptjet, eta, z, weight); if (!correctCollision) { - registry.fill(HIST("jets/JetPtEtaLambdaPtWrongCollision"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); - registry.fill(HIST("jets/JetPtEtaLambdaZWrongCollision"), mcdjet.pt(), mcdjet.eta(), z, weight); + registry.fill(HIST("jets/JetPtEtaLambdaPtWrongCollision"), ptjet, eta, pt, weight); + registry.fill(HIST("jets/JetPtEtaLambdaZWrongCollision"), ptjet, eta, z, weight); } } else if (pdg == PDG_t::kLambda0Bar) { - registry.fill(HIST("jets/JetPtEtaAntiLambdaPt"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); - registry.fill(HIST("jets/JetPtEtaAntiLambdaZ"), mcdjet.pt(), mcdjet.eta(), z, weight); + registry.fill(HIST("jets/JetPtEtaAntiLambdaPt"), ptjet, eta, pt, weight); + registry.fill(HIST("jets/JetPtEtaAntiLambdaZ"), ptjet, eta, z, weight); if (!correctCollision) { - registry.fill(HIST("jets/JetPtEtaAntiLambdaPtWrongCollision"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); - registry.fill(HIST("jets/JetPtEtaAntiLambdaZWrongCollision"), mcdjet.pt(), mcdjet.eta(), z, weight); + registry.fill(HIST("jets/JetPtEtaAntiLambdaPtWrongCollision"), ptjet, eta, pt, weight); + registry.fill(HIST("jets/JetPtEtaAntiLambdaZWrongCollision"), ptjet, eta, z, weight); } } } - template - void fillMcDV0InMatchedJets(T const& mcpjet, U const& mcdjet, V const& v0, bool correctCollision, double weight) + template + void fillMcDV0InMatchedJets(T const& mcpjet, U const& mcdjet, V const& v0, W const& pv0, bool correctCollision, double weight) { int pdg = v0.mcParticle().pdgCode(); - double z = v0.pt() / mcdjet.pt(); + double ptjetmcp = mcpjet.pt(); + double ptjetmcd = mcdjet.pt(); + double eta = mcdjet.eta(); + double pt = pv0.pt(); + double z = pt / ptjetmcp; + if (std::abs(pdg) == PDG_t::kK0Short) { - registry.fill(HIST("jets/JetsPtEtaK0SPt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); - registry.fill(HIST("jets/JetsPtEtaK0SZ"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), z, weight); + registry.fill(HIST("jets/JetsPtEtaK0SPt"), ptjetmcp, ptjetmcd, eta, pt, weight); + registry.fill(HIST("jets/JetsPtEtaK0SZ"), ptjetmcp, ptjetmcd, eta, z, weight); if (!correctCollision) { - registry.fill(HIST("jets/JetsPtEtaK0SPtWrongCollision"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); - registry.fill(HIST("jets/JetsPtEtaK0SZWrongCollision"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), z, weight); + registry.fill(HIST("jets/JetsPtEtaK0SPtWrongCollision"), ptjetmcp, ptjetmcd, eta, pt, weight); + registry.fill(HIST("jets/JetsPtEtaK0SZWrongCollision"), ptjetmcp, ptjetmcd, eta, z, weight); } } else if (pdg == PDG_t::kLambda0) { - registry.fill(HIST("jets/JetsPtEtaLambdaPt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); - registry.fill(HIST("jets/JetsPtEtaLambdaZ"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), z, weight); + registry.fill(HIST("jets/JetsPtEtaLambdaPt"), ptjetmcp, ptjetmcd, eta, pt, weight); + registry.fill(HIST("jets/JetsPtEtaLambdaZ"), ptjetmcp, ptjetmcd, eta, z, weight); if (!correctCollision) { - registry.fill(HIST("jets/JetsPtEtaLambdaPtWrongCollision"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); - registry.fill(HIST("jets/JetsPtEtaLambdaZWrongCollision"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), z, weight); + registry.fill(HIST("jets/JetsPtEtaLambdaPtWrongCollision"), ptjetmcp, ptjetmcd, eta, pt, weight); + registry.fill(HIST("jets/JetsPtEtaLambdaZWrongCollision"), ptjetmcp, ptjetmcd, eta, z, weight); } } else if (pdg == PDG_t::kLambda0Bar) { - registry.fill(HIST("jets/JetsPtEtaAntiLambdaPt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); - registry.fill(HIST("jets/JetsPtEtaAntiLambdaZ"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), z, weight); + registry.fill(HIST("jets/JetsPtEtaAntiLambdaPt"), ptjetmcp, ptjetmcd, eta, pt, weight); + registry.fill(HIST("jets/JetsPtEtaAntiLambdaZ"), ptjetmcp, ptjetmcd, eta, z, weight); if (!correctCollision) { - registry.fill(HIST("jets/JetsPtEtaAntiLambdaPtWrongCollision"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); - registry.fill(HIST("jets/JetsPtEtaAntiLambdaZWrongCollision"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), z, weight); + registry.fill(HIST("jets/JetsPtEtaAntiLambdaPtWrongCollision"), ptjetmcp, ptjetmcd, eta, pt, weight); + registry.fill(HIST("jets/JetsPtEtaAntiLambdaZWrongCollision"), ptjetmcp, ptjetmcd, eta, z, weight); } } } @@ -618,6 +669,121 @@ struct V0QA { } } + template + void fillWeightedJetFinderInclusiveV0(T const& v0) + { + registry.fill(HIST("tests/weighted/V0PtEtaPhi"), v0.pt(), v0.eta(), v0.phi()); + if (v0.isK0SCandidate()) + registry.fill(HIST("tests/weighted/K0SPtEtaPhi"), v0.pt(), v0.eta(), v0.phi()); + if (v0.isLambdaCandidate()) + registry.fill(HIST("tests/weighted/LambdaPtEtaPhi"), v0.pt(), v0.eta(), v0.phi()); + if (v0.isAntiLambdaCandidate()) + registry.fill(HIST("tests/weighted/AntiLambdaPtEtaPhi"), v0.pt(), v0.eta(), v0.phi()); + } + + template + void fillWeightedJetFinderJet(T const& jet) + { + registry.fill(HIST("tests/weighted/JetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi()); + } + + template + void fillWeightedJetFinderV0InJet(T const& jet, U const& v0) + { + double z = v0.pt() / jet.pt(); + registry.fill(HIST("tests/weighted/JetPtEtaV0Pt"), jet.pt(), jet.eta(), v0.pt()); + registry.fill(HIST("tests/weighted/JetPtEtaV0Z"), jet.pt(), jet.eta(), z); + + if (v0.isK0SCandidate()) { + registry.fill(HIST("tests/weighted/JetPtEtaK0SPt"), jet.pt(), jet.eta(), v0.pt()); + registry.fill(HIST("tests/weighted/JetPtEtaK0SZ"), jet.pt(), jet.eta(), z); + } + if (v0.isLambdaCandidate()) { + registry.fill(HIST("tests/weighted/JetPtEtaLambdaPt"), jet.pt(), jet.eta(), v0.pt()); + registry.fill(HIST("tests/weighted/JetPtEtaLambdaZ"), jet.pt(), jet.eta(), z); + } + if (v0.isAntiLambdaCandidate()) { + registry.fill(HIST("tests/weighted/JetPtEtaAntiLambdaPt"), jet.pt(), jet.eta(), v0.pt()); + registry.fill(HIST("tests/weighted/JetPtEtaAntiLambdaZ"), jet.pt(), jet.eta(), z); + } + } + + template + void fillSubtractedJetFinderInclusiveV0(T const& v0) + { + bool randomlyRejected = isV0RandomlyRejected(); + + registry.fill(HIST("tests/nosub/V0PtEtaPhi"), v0.pt(), v0.eta(), v0.phi()); + if (!randomlyRejected) + registry.fill(HIST("tests/sub/V0PtEtaPhi"), v0.pt(), v0.eta(), v0.phi()); + + if (v0.isK0SCandidate()) { + registry.fill(HIST("tests/nosub/K0SPtEtaPhi"), v0.pt(), v0.eta(), v0.phi()); + if (!randomlyRejected) + registry.fill(HIST("tests/sub/K0SPtEtaPhi"), v0.pt(), v0.eta(), v0.phi()); + } + if (v0.isLambdaCandidate()) { + registry.fill(HIST("tests/nosub/LambdaPtEtaPhi"), v0.pt(), v0.eta(), v0.phi()); + if (!randomlyRejected) + registry.fill(HIST("tests/sub/LambdaPtEtaPhi"), v0.pt(), v0.eta(), v0.phi()); + } + if (v0.isAntiLambdaCandidate()) { + registry.fill(HIST("tests/nosub/AntiLambdaPtEtaPhi"), v0.pt(), v0.eta(), v0.phi()); + if (!randomlyRejected) + registry.fill(HIST("tests/sub/AntiLambdaPtEtaPhi"), v0.pt(), v0.eta(), v0.phi()); + } + } + + template + void fillSubtractedJetFinderJetNoSubtraction(T const& jet) + { + registry.fill(HIST("tests/nosub/JetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi()); + } + + template + void fillSubtractedJetFinderV0InJetNoSubtraction(T const& jet, U const& v0) + { + double z = v0.pt() / jet.pt(); + registry.fill(HIST("tests/nosub/JetPtEtaV0Pt"), jet.pt(), jet.eta(), v0.pt()); + registry.fill(HIST("tests/nosub/JetPtEtaV0Z"), jet.pt(), jet.eta(), z); + if (v0.isK0SCandidate()) { + registry.fill(HIST("tests/nosub/JetPtEtaK0SPt"), jet.pt(), jet.eta(), v0.pt()); + registry.fill(HIST("tests/nosub/JetPtEtaK0SZ"), jet.pt(), jet.eta(), z); + } + if (v0.isLambdaCandidate()) { + registry.fill(HIST("tests/nosub/JetPtEtaLambdaPt"), jet.pt(), jet.eta(), v0.pt()); + registry.fill(HIST("tests/nosub/JetPtEtaLambdaZ"), jet.pt(), jet.eta(), z); + } + if (v0.isAntiLambdaCandidate()) { + registry.fill(HIST("tests/nosub/JetPtEtaAntiLambdaPt"), jet.pt(), jet.eta(), v0.pt()); + registry.fill(HIST("tests/nosub/JetPtEtaAntiLambdaZ"), jet.pt(), jet.eta(), z); + } + } + + template + void fillSubtractedJetFinderJetSubtracted(T const& jet, double ptjetsub) + { + registry.fill(HIST("tests/sub/JetPtEtaPhi"), ptjetsub, jet.eta(), jet.phi()); + } + + void fillSubtractedJetFinderV0InJetSubtracted(const double ptjetsub, const double etajet, const double v0Pt, const int v0Type) + { + double z = v0Pt / ptjetsub; + registry.fill(HIST("tests/sub/JetPtEtaV0Pt"), ptjetsub, etajet, v0Pt); + registry.fill(HIST("tests/sub/JetPtEtaV0Z"), ptjetsub, etajet, z); + + if (v0Type == PDG_t::kK0Short) { + registry.fill(HIST("tests/sub/JetPtEtaK0SPt"), ptjetsub, etajet, v0Pt); + registry.fill(HIST("tests/sub/JetPtEtaK0SZ"), ptjetsub, etajet, z); + } else if (v0Type == PDG_t::kLambda0) { + registry.fill(HIST("tests/sub/JetPtEtaLambdaPt"), ptjetsub, etajet, v0Pt); + registry.fill(HIST("tests/sub/JetPtEtaLambdaZ"), ptjetsub, etajet, z); + } else if (v0Type == PDG_t::kLambda0Bar) { + registry.fill(HIST("tests/sub/JetPtEtaAntiLambdaPt"), ptjetsub, etajet, v0Pt); + registry.fill(HIST("tests/sub/JetPtEtaAntiLambdaZ"), ptjetsub, etajet, z); + } + } + template void fillTrackQa(V const& v0) { @@ -887,28 +1053,39 @@ struct V0QA { registry.fill(HIST("inclusive/hEvents"), 2.5, weight); for (const auto& v0 : v0s) { - if (!v0.has_mcParticle() || v0.isRejectedCandidate()) + if (!recV0PassesEfficiencyCuts(v0)) + continue; + + auto pv0 = v0.mcParticle(); + if (!genV0PassesEfficiencyCuts(pv0)) continue; bool correctCollision = (mcColl.mcCollisionId() == v0.mcParticle().mcCollisionId()); - fillMcDV0(v0, correctCollision, weight); + fillMcDV0(v0, pv0, correctCollision, weight); } // v0 loop for (const auto& mcdjet : mcdjets) { fillMcDJets(mcdjet, weight); + for (const auto& v0 : mcdjet.template candidates_as()) { - if (!v0.has_mcParticle() || v0.isRejectedCandidate()) + if (!recV0PassesEfficiencyCuts(v0)) + continue; + + auto pv0 = v0.mcParticle(); + if (!genV0PassesEfficiencyCuts(pv0)) continue; bool correctCollision = (mcColl.mcCollisionId() == v0.mcParticle().mcCollisionId()); - fillMcDV0InJets(mcdjet, v0, correctCollision, weight); + fillMcDV0InJets(mcdjet, v0, pv0, correctCollision, weight); for (const auto& mcpjet : mcdjet.template matchedJetGeo_as()) { - for (const auto& pv0 : mcpjet.template candidates_as()) { - if (!v0sAreMatched(v0, pv0, jTracks)) + for (const auto& pv0injet : mcpjet.template candidates_as()) { + if (!genV0PassesEfficiencyCuts(pv0injet)) + continue; + if (!v0sAreMatched(v0, pv0injet, jTracks)) continue; - fillMcDV0InMatchedJets(mcpjet, mcdjet, v0, correctCollision, weight); + fillMcDV0InMatchedJets(mcpjet, mcdjet, v0, pv0, correctCollision, weight); } // v0 particle loop } // mcpjet loop } // v0 loop @@ -939,9 +1116,7 @@ struct V0QA { registry.fill(HIST("inclusive/hMcEvents"), 2.5, weight); for (const auto& pv0 : pv0s) { - if (!pv0.has_daughters() || !pv0.isPhysicalPrimary()) - continue; - if (std::abs(pv0.y()) > yPartMax) + if (!genV0PassesEfficiencyCuts(pv0)) continue; fillMcPV0(pv0, weight); @@ -954,7 +1129,7 @@ struct V0QA { fillMcPJets(jet, weight); for (const auto& pv0 : jet.template candidates_as()) { - if (!pv0.has_daughters() || !pv0.isPhysicalPrimary()) + if (!genV0PassesEfficiencyCuts(pv0)) continue; fillMcPV0InJets(jet, pv0, weight); @@ -1302,7 +1477,7 @@ struct V0QA { PROCESS_SWITCH(V0QA, processFeeddownMatchedJets, "Jets feeddown", false); // Test the difference between excluding V0s from jet finding and subtracting V0s from jets afterwards - void processTestWeightedJetFinder(soa::Filtered::iterator const& jcoll, soa::Join const& jets, aod::CandidatesV0Data const&) + void processTestWeightedJetFinder(soa::Filtered::iterator const& jcoll, soa::Join const& jets, aod::CandidatesV0Data const& v0s) { registry.fill(HIST("tests/weighted/hEvents"), 0.5); if (!jetderiveddatautilities::selectCollision(jcoll, eventSelectionBits)) @@ -1310,36 +1485,27 @@ struct V0QA { registry.fill(HIST("tests/weighted/hEvents"), 1.5); + for (const auto& v0 : v0s) { + if (v0.isRejectedCandidate()) + continue; + + fillWeightedJetFinderInclusiveV0(v0); + } + for (const auto& jet : jets) { - registry.fill(HIST("tests/weighted/JetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi()); + fillWeightedJetFinderJet(jet); for (const auto& v0 : jet.template candidates_as()) { if (v0.isRejectedCandidate()) continue; - double z = v0.pt() / jet.pt(); - - registry.fill(HIST("tests/weighted/JetPtEtaV0Pt"), jet.pt(), jet.eta(), v0.pt()); - registry.fill(HIST("tests/weighted/JetPtEtaV0Z"), jet.pt(), jet.eta(), z); - - if (v0.isK0SCandidate()) { - registry.fill(HIST("tests/weighted/JetPtEtaK0SPt"), jet.pt(), jet.eta(), v0.pt()); - registry.fill(HIST("tests/weighted/JetPtEtaK0SZ"), jet.pt(), jet.eta(), z); - } - if (v0.isLambdaCandidate()) { - registry.fill(HIST("tests/weighted/JetPtEtaLambdaPt"), jet.pt(), jet.eta(), v0.pt()); - registry.fill(HIST("tests/weighted/JetPtEtaLambdaZ"), jet.pt(), jet.eta(), z); - } - if (v0.isAntiLambdaCandidate()) { - registry.fill(HIST("tests/weighted/JetPtEtaAntiLambdaPt"), jet.pt(), jet.eta(), v0.pt()); - registry.fill(HIST("tests/weighted/JetPtEtaAntiLambdaZ"), jet.pt(), jet.eta(), z); - } + fillWeightedJetFinderV0InJet(jet, v0); } } } PROCESS_SWITCH(V0QA, processTestWeightedJetFinder, "Test weighted jet finder", false); - void processTestSubtractedJetFinder(soa::Filtered::iterator const& jcoll, soa::Join const& jets, aod::CandidatesV0Data const&) + void processTestSubtractedJetFinder(soa::Filtered::iterator const& jcoll, soa::Join const& jets, aod::CandidatesV0Data const& v0s) { registry.fill(HIST("tests/hEvents"), 0.5); if (!jetderiveddatautilities::selectCollision(jcoll, eventSelectionBits)) @@ -1347,33 +1513,24 @@ struct V0QA { registry.fill(HIST("tests/hEvents"), 1.5); + for (const auto& v0 : v0s) { + if (v0.isRejectedCandidate()) + continue; + + fillSubtractedJetFinderInclusiveV0(v0); + } + for (const auto& jet : jets) { - registry.fill(HIST("tests/nosub/JetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi()); + fillSubtractedJetFinderJetNoSubtraction(jet); std::vector v0Pt; std::vector v0Type; double ptjetsub = jet.pt(); for (const auto& v0 : jet.template candidates_as()) { - double z = v0.pt() / jet.pt(); - - registry.fill(HIST("tests/nosub/JetPtEtaV0Pt"), jet.pt(), jet.eta(), v0.pt()); - registry.fill(HIST("tests/nosub/JetPtEtaV0Z"), jet.pt(), jet.eta(), z); + fillSubtractedJetFinderV0InJetNoSubtraction(jet, v0); - if (v0.isK0SCandidate()) { - registry.fill(HIST("tests/nosub/JetPtEtaK0SPt"), jet.pt(), jet.eta(), v0.pt()); - registry.fill(HIST("tests/nosub/JetPtEtaK0SZ"), jet.pt(), jet.eta(), z); - } - if (v0.isLambdaCandidate()) { - registry.fill(HIST("tests/nosub/JetPtEtaLambdaPt"), jet.pt(), jet.eta(), v0.pt()); - registry.fill(HIST("tests/nosub/JetPtEtaLambdaZ"), jet.pt(), jet.eta(), z); - } - if (v0.isAntiLambdaCandidate()) { - registry.fill(HIST("tests/nosub/JetPtEtaAntiLambdaPt"), jet.pt(), jet.eta(), v0.pt()); - registry.fill(HIST("tests/nosub/JetPtEtaAntiLambdaZ"), jet.pt(), jet.eta(), z); - } - - if (gRandom->Uniform() > v0Fraction) { // Rejected V0 + if (isV0RandomlyRejected()) { ptjetsub -= v0.pt(); } else { // Accepted V0 v0Pt.push_back(v0.pt()); @@ -1387,25 +1544,9 @@ struct V0QA { } } // V0s in jet loop - registry.fill(HIST("tests/sub/JetPtEtaPhi"), ptjetsub, jet.eta(), jet.phi()); + fillSubtractedJetFinderJetSubtracted(jet, ptjetsub); for (unsigned int i = 0; i < v0Pt.size(); ++i) { - int type = v0Type[i]; - double pt = v0Pt[i]; - double z = pt / ptjetsub; - - registry.fill(HIST("tests/sub/JetPtEtaV0Pt"), ptjetsub, jet.eta(), pt); - registry.fill(HIST("tests/sub/JetPtEtaV0Z"), ptjetsub, jet.eta(), z); - - if (type == PDG_t::kK0Short) { - registry.fill(HIST("tests/sub/JetPtEtaK0SPt"), ptjetsub, jet.eta(), pt); - registry.fill(HIST("tests/sub/JetPtEtaK0SZ"), ptjetsub, jet.eta(), z); - } else if (type == PDG_t::kLambda0) { - registry.fill(HIST("tests/sub/JetPtEtaLambdaPt"), ptjetsub, jet.eta(), pt); - registry.fill(HIST("tests/sub/JetPtEtaLambdaZ"), ptjetsub, jet.eta(), z); - } else if (type == PDG_t::kLambda0Bar) { - registry.fill(HIST("tests/sub/JetPtEtaAntiLambdaPt"), ptjetsub, jet.eta(), pt); - registry.fill(HIST("tests/sub/JetPtEtaAntiLambdaZ"), ptjetsub, jet.eta(), z); - } + fillSubtractedJetFinderV0InJetSubtracted(ptjetsub, jet.eta(), v0Pt[i], v0Type[i]); } // Accepted V0s in jet loop } // Jets loop } @@ -1413,11 +1554,14 @@ struct V0QA { using DaughterJTracks = soa::Join; using DaughterTracks = soa::Join; - void processV0TrackQA(aod::JetCollision const& /*jcoll*/, aod::CandidatesV0Data const& v0s, DaughterJTracks const&, DaughterTracks const&) + void processV0TrackQA(aod::JetCollision const& jcoll, aod::CandidatesV0Data const& v0s, DaughterJTracks const&, DaughterTracks const&) { - // if (!jetderiveddatautilities::selectCollision(jcoll, eventSelectionBits)) { - // return; - // } + registry.fill(HIST("tracks/hEvents"), 0.5); + if (!jetderiveddatautilities::selectCollision(jcoll, eventSelectionBits)) + return; + + registry.fill(HIST("tracks/hEvents"), 1.5); + for (const auto& v0 : v0s) { if (v0.isRejectedCandidate()) continue; From 00424037a6adf250a3943aa8690a068cac49325e Mon Sep 17 00:00:00 2001 From: Mattia Faggin Date: Mon, 1 Sep 2025 15:33:07 +0200 Subject: [PATCH 266/986] [PWGHF] Remove meaningless check for Sc matching to MC. (#12813) Co-authored-by: mattia --- PWGHF/D2H/Tasks/taskSigmac.cxx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskSigmac.cxx b/PWGHF/D2H/Tasks/taskSigmac.cxx index b14d0640c88..e3f0926fac8 100644 --- a/PWGHF/D2H/Tasks/taskSigmac.cxx +++ b/PWGHF/D2H/Tasks/taskSigmac.cxx @@ -805,11 +805,6 @@ struct HfTaskSigmac { /// reconstructed Σc0,++ matched to MC for (const auto& candSc : candidatesSc) { - /// Candidate selected as Σc0 and/or Σc++ - if (!(candSc.hfflag() & BIT(aod::hf_cand_sigmac::DecayType::Sc0ToPKPiPi)) && !(candSc.hfflag() & BIT(aod::hf_cand_sigmac::DecayType::ScplusplusToPKPiPi)) && // Σc0,++(2455) - !(candSc.hfflag() & BIT(aod::hf_cand_sigmac::DecayType::ScStar0ToPKPiPi)) && !(candSc.hfflag() & BIT(aod::hf_cand_sigmac::DecayType::ScStarPlusPlusToPKPiPi))) { // Σc0,++(2520) - continue; - } /// rapidity selection on Σc0,++ /// NB: since in data we cannot tag Sc(2455) and Sc(2520), then we use only Sc(2455) for y selection on reconstructed signal if (yCandRecoMax >= 0. && std::abs(hfHelper.ySc0(candSc)) > yCandRecoMax && std::abs(hfHelper.yScPlusPlus(candSc)) > yCandRecoMax) { From 3df07e7f2075603afb2a6c58f23c5a6698a64861 Mon Sep 17 00:00:00 2001 From: Zhenjun Xiong <108917659+zjxiongOvO@users.noreply.github.com> Date: Mon, 1 Sep 2025 17:27:42 +0200 Subject: [PATCH 267/986] [PWGDQ] add mixed event method for polarization (#12765) Co-authored-by: ALICE Action Bot --- PWGDQ/Core/VarManager.h | 119 ++++++++++++++++++++++++++ PWGDQ/Tasks/tableReader_withAssoc.cxx | 13 ++- 2 files changed, 131 insertions(+), 1 deletion(-) diff --git a/PWGDQ/Core/VarManager.h b/PWGDQ/Core/VarManager.h index 230a899d807..130634f60b9 100644 --- a/PWGDQ/Core/VarManager.h +++ b/PWGDQ/Core/VarManager.h @@ -3202,6 +3202,125 @@ void VarManager::FillPairME(T1 const& t1, T2 const& t2, float* values) values[kDeltaEtaPair2] = v1.Eta() - v2.Eta(); } + // polarization parameters + bool useHE = fgUsedVars[kCosThetaHE] || fgUsedVars[kPhiHE]; // helicity frame + bool useCS = fgUsedVars[kCosThetaCS] || fgUsedVars[kPhiCS]; // Collins-Soper frame + bool usePP = fgUsedVars[kCosThetaPP]; // production plane frame + bool useRM = fgUsedVars[kCosThetaRM]; // Random frame + + if (useHE || useCS || usePP || useRM) { + ROOT::Math::Boost boostv12{v12.BoostToCM()}; + ROOT::Math::XYZVectorF v1_CM{(boostv12(v1).Vect()).Unit()}; + ROOT::Math::XYZVectorF v2_CM{(boostv12(v2).Vect()).Unit()}; + ROOT::Math::XYZVectorF Beam1_CM{(boostv12(fgBeamA).Vect()).Unit()}; + ROOT::Math::XYZVectorF Beam2_CM{(boostv12(fgBeamC).Vect()).Unit()}; + + // using positive sign convention for the first track + ROOT::Math::XYZVectorF v_CM = (t1.sign() > 0 ? v1_CM : v2_CM); + + if (useHE) { + ROOT::Math::XYZVectorF zaxis_HE{(v12.Vect()).Unit()}; + ROOT::Math::XYZVectorF yaxis_HE{(Beam1_CM.Cross(Beam2_CM)).Unit()}; + ROOT::Math::XYZVectorF xaxis_HE{(yaxis_HE.Cross(zaxis_HE)).Unit()}; + if (fgUsedVars[kCosThetaHE]) + values[kCosThetaHE] = zaxis_HE.Dot(v_CM); + if (fgUsedVars[kPhiHE]) { + values[kPhiHE] = TMath::ATan2(yaxis_HE.Dot(v_CM), xaxis_HE.Dot(v_CM)); + if (values[kPhiHE] < 0) { + values[kPhiHE] += 2 * TMath::Pi(); // ensure phi is in [0, 2pi] + } + } + if (fgUsedVars[kPhiTildeHE]) { + if (fgUsedVars[kCosThetaHE] && fgUsedVars[kPhiHE]) { + if (values[kCosThetaHE] > 0) { + values[kPhiTildeHE] = values[kPhiHE] - 0.25 * TMath::Pi(); // phi_tilde = phi - pi/4 + if (values[kPhiTildeHE] < 0) { + values[kPhiTildeHE] += 2 * TMath::Pi(); // ensure phi_tilde is in [0, 2pi] + } + } else { + values[kPhiTildeHE] = values[kPhiHE] - 0.75 * TMath::Pi(); // phi_tilde = phi - 3pi/4 + if (values[kPhiTildeHE] < 0) { + values[kPhiTildeHE] += 2 * TMath::Pi(); // ensure phi_tilde is in [0, 2pi] + } + } + } else { + values[kPhiTildeHE] = -999; // not computable + } + } + } + + if (useCS) { + ROOT::Math::XYZVectorF zaxis_CS{(Beam1_CM - Beam2_CM).Unit()}; + ROOT::Math::XYZVectorF yaxis_CS{(Beam1_CM.Cross(Beam2_CM)).Unit()}; + ROOT::Math::XYZVectorF xaxis_CS{(yaxis_CS.Cross(zaxis_CS)).Unit()}; + if (fgUsedVars[kCosThetaCS]) + values[kCosThetaCS] = zaxis_CS.Dot(v_CM); + if (fgUsedVars[kPhiCS]) { + values[kPhiCS] = TMath::ATan2(yaxis_CS.Dot(v_CM), xaxis_CS.Dot(v_CM)); + if (values[kPhiCS] < 0) { + values[kPhiCS] += 2 * TMath::Pi(); // ensure phi is in [0, 2pi] + } + } + if (fgUsedVars[kPhiTildeCS]) { + if (fgUsedVars[kCosThetaCS] && fgUsedVars[kPhiCS]) { + if (values[kCosThetaCS] > 0) { + values[kPhiTildeCS] = values[kPhiCS] - 0.25 * TMath::Pi(); // phi_tilde = phi - pi/4 + if (values[kPhiTildeCS] < 0) { + values[kPhiTildeCS] += 2 * TMath::Pi(); // ensure phi_tilde is in [0, 2pi] + } + } else { + values[kPhiTildeCS] = values[kPhiCS] - 0.75 * TMath::Pi(); // phi_tilde = phi - 3pi/4 + if (values[kPhiTildeCS] < 0) { + values[kPhiTildeCS] += 2 * TMath::Pi(); // ensure phi_tilde is in [0, 2pi] + } + } + } else { + values[kPhiTildeCS] = -999; // not computable + } + } + } + + if (usePP) { + ROOT::Math::XYZVector zaxis_PP = ROOT::Math::XYZVector(v12.Py(), -v12.Px(), 0.f); + ROOT::Math::XYZVector yaxis_PP{(v12.Vect()).Unit()}; + ROOT::Math::XYZVector xaxis_PP{(yaxis_PP.Cross(zaxis_PP)).Unit()}; + if (fgUsedVars[kCosThetaPP]) { + values[kCosThetaPP] = zaxis_PP.Dot(v_CM) / std::sqrt(zaxis_PP.Mag2()); + } + if (fgUsedVars[kPhiPP]) { + values[kPhiPP] = TMath::ATan2(yaxis_PP.Dot(v_CM), xaxis_PP.Dot(v_CM)); + if (values[kPhiPP] < 0) { + values[kPhiPP] += 2 * TMath::Pi(); // ensure phi is in [0, 2pi] + } + } + if (fgUsedVars[kPhiTildePP]) { + if (fgUsedVars[kCosThetaPP] && fgUsedVars[kPhiPP]) { + if (values[kCosThetaPP] > 0) { + values[kPhiTildePP] = values[kPhiPP] - 0.25 * TMath::Pi(); // phi_tilde = phi - pi/4 + if (values[kPhiTildePP] < 0) { + values[kPhiTildePP] += 2 * TMath::Pi(); // ensure phi_tilde is in [0, 2pi] + } + } else { + values[kPhiTildePP] = values[kPhiPP] - 0.75 * TMath::Pi(); // phi_tilde = phi - 3pi/4 + if (values[kPhiTildePP] < 0) { + values[kPhiTildePP] += 2 * TMath::Pi(); // ensure phi_tilde is in [0, 2pi] + } + } + } else { + values[kPhiTildePP] = -999; // not computable + } + } + } + + if (useRM) { + double randomCostheta = gRandom->Uniform(-1., 1.); + double randomPhi = gRandom->Uniform(0., 2. * TMath::Pi()); + ROOT::Math::XYZVectorF zaxis_RM(randomCostheta, std::sqrt(1 - randomCostheta * randomCostheta) * std::cos(randomPhi), std::sqrt(1 - randomCostheta * randomCostheta) * std::sin(randomPhi)); + if (fgUsedVars[kCosThetaRM]) + values[kCosThetaRM] = zaxis_RM.Dot(v_CM); + } + } + if constexpr ((fillMap & ReducedEventQvector) > 0 || (fillMap & CollisionQvect) > 0) { // TODO: provide different computations for vn // Compute the scalar product UQ for two muon from different event using Q-vector from A, for second and third harmonic diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index 723a68e38bf..6cb6e8b3221 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -197,6 +197,7 @@ using MyEventsQvector = soa::Join; using MyEventsQvectorCentr = soa::Join; using MyEventsQvectorCentrSelected = soa::Join; +using MyEventsHashSelectedQvectorCentr = soa::Join; using MyBarrelTracks = soa::Join; using MyBarrelTracksWithAmbiguities = soa::Join; @@ -1307,7 +1308,7 @@ struct AnalysisSameEventPairing { { LOG(info) << "Starting initialization of AnalysisSameEventPairing (idstoreh)"; fEnableBarrelHistos = context.mOptions.get("processAllSkimmed") || context.mOptions.get("processBarrelOnlySkimmed") || context.mOptions.get("processBarrelOnlyWithCollSkimmed") || context.mOptions.get("processBarrelOnlySkimmedNoCov") || context.mOptions.get("processBarrelOnlySkimmedNoCovWithMultExtra") || context.mOptions.get("processBarrelOnlyWithQvectorCentrSkimmedNoCov"); - fEnableBarrelMixingHistos = context.mOptions.get("processMixingAllSkimmed") || context.mOptions.get("processMixingBarrelSkimmed") || context.mOptions.get("processMixingBarrelSkimmedFlow"); + fEnableBarrelMixingHistos = context.mOptions.get("processMixingAllSkimmed") || context.mOptions.get("processMixingBarrelSkimmed") || context.mOptions.get("processMixingBarrelSkimmedFlow") || context.mOptions.get("processMixingBarrelWithQvectorCentrSkimmedNoCov"); fEnableMuonHistos = context.mOptions.get("processAllSkimmed") || context.mOptions.get("processMuonOnlySkimmed") || context.mOptions.get("processMuonOnlySkimmedMultExtra") || context.mOptions.get("processMixingMuonSkimmed"); fEnableMuonMixingHistos = context.mOptions.get("processMixingAllSkimmed") || context.mOptions.get("processMixingMuonSkimmed"); @@ -2069,6 +2070,9 @@ struct AnalysisSameEventPairing { if constexpr ((TEventFillMap & VarManager::ObjTypes::ReducedEventQvector) > 0) { VarManager::FillPairVn(t1, t2); } + if constexpr ((TEventFillMap & VarManager::ObjTypes::CollisionQvect) > 0) { + VarManager::FillPairVn(t1, t2); + } pairSign = t1.sign() + t2.sign(); ncuts = fNCutsBarrel; } @@ -2307,6 +2311,12 @@ struct AnalysisSameEventPairing { runSameSideMixing(events, trackAssocs, tracks, trackAssocsPerCollision); } + void processMixingBarrelWithQvectorCentrSkimmedNoCov(soa::Filtered& events, + soa::Join const& trackAssocs, MyBarrelTracksWithAmbiguities const& tracks) + { + runSameSideMixing(events, trackAssocs, tracks, trackAssocsPerCollision); + } + void processMixingMuonSkimmed(soa::Filtered& events, soa::Join const& muonAssocs, MyMuonTracksWithCovWithAmbiguities const& muons) { @@ -2330,6 +2340,7 @@ struct AnalysisSameEventPairing { PROCESS_SWITCH(AnalysisSameEventPairing, processMixingAllSkimmed, "Run all types of mixed pairing, with skimmed tracks/muons", false); PROCESS_SWITCH(AnalysisSameEventPairing, processMixingBarrelSkimmed, "Run barrel type mixing pairing, with skimmed tracks", false); PROCESS_SWITCH(AnalysisSameEventPairing, processMixingBarrelSkimmedFlow, "Run barrel type mixing pairing, with flow, with skimmed tracks", false); + PROCESS_SWITCH(AnalysisSameEventPairing, processMixingBarrelWithQvectorCentrSkimmedNoCov, "Run barrel type mixing pairing, with skimmed tracks and with Qvector from central framework", false); PROCESS_SWITCH(AnalysisSameEventPairing, processMixingMuonSkimmed, "Run muon type mixing pairing, with skimmed muons", false); PROCESS_SWITCH(AnalysisSameEventPairing, processDummy, "Dummy function, enabled only if none of the others are enabled", false); }; From cba0dfa3519ab1c9cca184b4a4f3f28748ab0351 Mon Sep 17 00:00:00 2001 From: JStaa <39123272+JStaa@users.noreply.github.com> Date: Mon, 1 Sep 2025 18:28:10 +0200 Subject: [PATCH 268/986] [PWGCF] Added a switch for separating events by the magnetic field polarity (#12814) Co-authored-by: ALICE Action Bot --- .../Tasks/threeParticleCorrelations.cxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx b/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx index a64d25c6d67..534c88d2cda 100644 --- a/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx +++ b/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx @@ -132,6 +132,7 @@ struct ThreeParticleCorrelations { SameKindPair pairMC{collBinningMC, 5, -1, &cache}; // Process configurables + Configurable confBfieldSwitch{"confBfieldSwitch", 0, "Switch for the detector magnetic field (1 if Pos, -1 if Neg, 0 if both)"}; Configurable confFakeV0Switch{"confFakeV0Switch", false, "Switch for the fakeV0Filter function"}; Configurable confRDSwitch{"confRDSwitch", true, "Switch for the radialDistanceFilter function"}; @@ -174,6 +175,7 @@ struct ThreeParticleCorrelations { rQARegistry.add("hEventCentrality", "hEventCentrality", {HistType::kTH1D, {{centralityAxis}}}); rQARegistry.add("hEventCentrality_MC", "hEventCentrality_MC", {HistType::kTH1D, {{centralityAxis}}}); rQARegistry.add("hEventZvtx", "hEventZvtx", {HistType::kTH1D, {{zvtxAxis}}}); + rQARegistry.add("hEventBfield", "hEventBfield", {HistType::kTH1D, {{2, -1, 1}}}); rQARegistry.add("hTrackPt", "hTrackPt", {HistType::kTH1D, {{100, 0, 4}}}); rQARegistry.add("hTrackEta", "hTrackEta", {HistType::kTH1D, {{100, -1, 1}}}); rQARegistry.add("hTrackPhi", "hTrackPhi", {HistType::kTH1D, {{100, (-1. / 2) * constants::math::PI, (5. / 2) * constants::math::PI}}}); @@ -334,8 +336,15 @@ struct ThreeParticleCorrelations { auto bc = collision.bc_as(); auto bField = getMagneticField(bc.timestamp()); + if (confBfieldSwitch != 0) { + if (std::signbit(static_cast(confBfieldSwitch)) != std::signbit(bField)) { + return; + } + } + rQARegistry.fill(HIST("hEventCentrality"), collision.centFT0C()); rQARegistry.fill(HIST("hEventZvtx"), collision.posZ()); + rQARegistry.fill(HIST("hEventBfield"), bField); // Start of the Track QA for (const auto& track : tracks) { @@ -455,6 +464,12 @@ struct ThreeParticleCorrelations { auto bc = coll_1.bc_as(); auto bField = getMagneticField(bc.timestamp()); + if (confBfieldSwitch != 0) { + if (std::signbit(static_cast(confBfieldSwitch)) != std::signbit(bField)) { + return; + } + } + for (const auto& [trigger, associate] : soa::combinations(soa::CombinationsFullIndexPolicy(v0_1, track_2))) { if (v0Filters(coll_1, trigger, tracks) && trackFilters(associate)) { if (radialDistanceFilter(trigger, associate, bField, true) && fakeV0Filter(trigger, associate)) { From e28606c68a4d830958803b497684a45388c33bd6 Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Tue, 2 Sep 2025 00:35:37 +0530 Subject: [PATCH 269/986] [PWGLF] Added process function for KK for a cross-check with K* (#12816) --- PWGLF/Tasks/Resonances/kstarqa.cxx | 883 ++++++++++++++++++++++++++--- 1 file changed, 813 insertions(+), 70 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarqa.cxx b/PWGLF/Tasks/Resonances/kstarqa.cxx index 65cd50714d6..dcb7650f843 100644 --- a/PWGLF/Tasks/Resonances/kstarqa.cxx +++ b/PWGLF/Tasks/Resonances/kstarqa.cxx @@ -86,6 +86,8 @@ struct Kstarqa { Configurable isNoITSROFrameBorder{"isNoITSROFrameBorder", true, "kNoITSROFrameBorder"}; Configurable isApplyParticleMID{"isApplyParticleMID", true, "Apply particle misidentification"}; Configurable checkVzEvSigLoss{"checkVzEvSigLoss", false, "Check Vz event signal loss"}; + Configurable isApplyDeepAngle{"isApplyDeepAngle", false, "Deep Angle cut"}; + Configurable isApplyMCchecksClosure{"isApplyMCchecksClosure", true, "Apply MC checks for closure test"}; Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; Configurable configOccCut{"configOccCut", 1000., "Occupancy cut"}; @@ -116,6 +118,7 @@ struct Kstarqa { Configurable isNoCollInTimeRangeStandard{"isNoCollInTimeRangeStandard", false, "No collision in time range standard"}; Configurable isApplyPtDepDCAxyCut{"isApplyPtDepDCAxyCut", false, "Apply pT dependent DCAxy cut"}; Configurable isGoldenChi2{"isGoldenChi2", false, "Apply golden chi2 cut"}; + Configurable cfgDeepAngle{"cfgDeepAngle", 0.04, "Deep Angle cut value"}; // cuts on mother Configurable isApplyCutsOnMother{"isApplyCutsOnMother", false, "Enable additional cuts on Kstar mother"}; @@ -346,15 +349,17 @@ struct Kstarqa { hrecLabel->GetXaxis()->SetBinLabel(4, "StrictlyUpperIndex"); hrecLabel->GetXaxis()->SetBinLabel(5, "Unlike Sign"); hrecLabel->GetXaxis()->SetBinLabel(6, "Physical Primary"); - hrecLabel->GetXaxis()->SetBinLabel(7, "Track PDG"); - hrecLabel->GetXaxis()->SetBinLabel(8, "Global Index"); - hrecLabel->GetXaxis()->SetBinLabel(9, "Generator"); - hrecLabel->GetXaxis()->SetBinLabel(10, "Mother y"); - hrecLabel->GetXaxis()->SetBinLabel(11, "Mother PDG"); - hrecLabel->GetXaxis()->SetBinLabel(12, "Track PID"); - hrecLabel->GetXaxis()->SetBinLabel(13, "Track MID"); - hrecLabel->GetXaxis()->SetBinLabel(14, "Track y"); - hrecLabel->GetXaxis()->SetBinLabel(15, "Split tracks"); + hrecLabel->GetXaxis()->SetBinLabel(7, "TrackPDG Check1"); + hrecLabel->GetXaxis()->SetBinLabel(8, "TrackPDG Check2"); + hrecLabel->GetXaxis()->SetBinLabel(9, "Global Index"); + hrecLabel->GetXaxis()->SetBinLabel(10, "Generator"); + hrecLabel->GetXaxis()->SetBinLabel(11, "Mother y"); + hrecLabel->GetXaxis()->SetBinLabel(12, "Mother PDG"); + hrecLabel->GetXaxis()->SetBinLabel(13, "Track PID"); + hrecLabel->GetXaxis()->SetBinLabel(14, "Track MID"); + hrecLabel->GetXaxis()->SetBinLabel(15, "Track y"); + hrecLabel->GetXaxis()->SetBinLabel(16, "Split tracks"); + hrecLabel->GetXaxis()->SetBinLabel(17, "DeepAngle Cut"); std::shared_ptr hDataTracks = rEventSelection.get(HIST("tracksCheckData")); hDataTracks->GetXaxis()->SetBinLabel(1, "All tracks"); @@ -363,7 +368,7 @@ struct Kstarqa { hDataTracks->GetXaxis()->SetBinLabel(4, "Remove Fake Tracks"); hDataTracks->GetXaxis()->SetBinLabel(5, "Rapidity Cut"); hDataTracks->GetXaxis()->SetBinLabel(6, "MID"); - hDataTracks->GetXaxis()->SetBinLabel(7, "Global Index"); + hDataTracks->GetXaxis()->SetBinLabel(7, "DeepAngle Cut"); std::shared_ptr hGenTracks = rEventSelection.get(HIST("eventsCheckGen")); hGenTracks->GetXaxis()->SetBinLabel(1, "All events"); @@ -547,6 +552,24 @@ struct Kstarqa { return false; } + // deep angle cut on pair to remove photon conversion + template + bool selectionPair(const T1& candidate1, const T2& candidate2) + { + double pt1, pt2, pz1, pz2, p1, p2, angle; + pt1 = candidate1.pt(); + pt2 = candidate2.pt(); + pz1 = candidate1.pz(); + pz2 = candidate2.pz(); + p1 = candidate1.p(); + p2 = candidate2.p(); + angle = std::acos((pt1 * pt2 + pz1 * pz2) / (p1 * p2)); + if (selectionConfig.isApplyDeepAngle && angle < selectionConfig.cfgDeepAngle) { + return false; + } + return true; + } + template bool selectionPID(const T& candidate, int PID) { @@ -999,7 +1022,7 @@ struct Kstarqa { hPID.fill(HIST("Before/hTPCnsigKa_mult_pt"), track1.tpcNSigmaKa(), multiplicity, track1.pt()); hPID.fill(HIST("Before/hTPCnsigPi_mult_pt"), track2.tpcNSigmaPi(), multiplicity, track2.pt()); hPID.fill(HIST("Before/hTOFnsigKa_mult_pt"), track1.tofNSigmaKa(), multiplicity, track1.pt()); - hPID.fill(HIST("Before/hTOFnsigPi_mult_pt"), track2.tofNSigmaKa(), multiplicity, track2.pt()); + hPID.fill(HIST("Before/hTOFnsigPi_mult_pt"), track2.tofNSigmaPi(), multiplicity, track2.pt()); hOthers.fill(HIST("hCRFC_before"), track1.tpcCrossedRowsOverFindableCls()); hOthers.fill(HIST("dE_by_dx_TPC"), track1.p(), track1.tpcSignal()); @@ -1071,7 +1094,7 @@ struct Kstarqa { hPID.fill(HIST("After/hTPCnsigKa_mult_pt"), track1.tpcNSigmaKa(), multiplicity, track1.pt()); hPID.fill(HIST("After/hTPCnsigPi_mult_pt"), track2.tpcNSigmaPi(), multiplicity, track2.pt()); hPID.fill(HIST("After/hTOFnsigKa_mult_pt"), track1.tofNSigmaKa(), multiplicity, track1.pt()); - hPID.fill(HIST("After/hTOFnsigPi_mult_pt"), track2.tofNSigmaKa(), multiplicity, track2.pt()); + hPID.fill(HIST("After/hTOFnsigPi_mult_pt"), track2.tofNSigmaPi(), multiplicity, track2.pt()); hOthers.fill(HIST("hEta_after"), track1.eta()); hOthers.fill(HIST("hCRFC_after"), track1.tpcCrossedRowsOverFindableCls()); hPID.fill(HIST("After/hNsigmaKaonTPC_after"), track1.pt(), track1.tpcNSigmaKa()); @@ -1082,6 +1105,9 @@ struct Kstarqa { hPID.fill(HIST("After/hNsigma_TPC_TOF_Pi_after"), track2.tpcNSigmaPi(), track2.tofNSigmaPi()); } + if (!selectionPair(track1, track2)) { + continue; + } rEventSelection.fill(HIST("tracksCheckData"), 6.5); daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); @@ -1105,6 +1131,171 @@ struct Kstarqa { PROCESS_SWITCH(Kstarqa, processSE, "Process Same event", true); + void processSEPhi(EventCandidates::iterator const& collision, TrackCandidates const& tracks, aod::BCs const&) + + { + + int occupancy = collision.trackOccupancyInTimeRange(); + rEventSelection.fill(HIST("hOccupancy"), occupancy); + + if (!selectionEvent(collision, true)) { // fill data event cut histogram + return; + } + + multiplicity = -1; + + if (cSelectMultEstimator == kFT0M) { + multiplicity = collision.centFT0M(); + } else if (cSelectMultEstimator == kFT0A) { + multiplicity = collision.centFT0A(); + } else if (cSelectMultEstimator == kFT0C) { + multiplicity = collision.centFT0C(); + } else if (cSelectMultEstimator == kFV0A) { + multiplicity = collision.centFV0A(); + } else { + multiplicity = collision.centFT0M(); // default + } + + // Fill the event counter + if (cQAevents) { + rEventSelection.fill(HIST("hVertexZRec"), collision.posZ()); + rEventSelection.fill(HIST("hMultiplicity"), multiplicity); + rEventSelection.fill(HIST("multdist_FT0M"), collision.multFT0M()); + } + + for (const auto& [track1, track2] : combinations(CombinationsStrictlyUpperIndexPolicy(tracks, tracks))) { + rEventSelection.fill(HIST("tracksCheckData"), 0.5); + if (!selectionTrack(track1)) { + continue; + } + if (!selectionTrack(track2)) { + continue; + } + rEventSelection.fill(HIST("tracksCheckData"), 1.5); + + if (track1.globalIndex() == track2.globalIndex()) + continue; + + if (cQAplots) { + hPID.fill(HIST("Before/hNsigmaTPC_Ka_before"), track1.pt(), track1.tpcNSigmaKa()); + hPID.fill(HIST("Before/hNsigmaTOF_Ka_before"), track1.pt(), track1.tofNSigmaKa()); + // hPID.fill(HIST("Before/hNsigmaTPC_Pi_before"), track2.pt(), track2.tpcNSigmaPi()); + // hPID.fill(HIST("Before/hNsigmaTOF_Pi_before"), track2.pt(), track2.tofNSigmaPi()); + hPID.fill(HIST("Before/hNsigma_TPC_TOF_Ka_before"), track1.tpcNSigmaKa(), track1.tofNSigmaKa()); + // hPID.fill(HIST("Before/hNsigma_TPC_TOF_Pi_before"), track2.tpcNSigmaPi(), track2.tofNSigmaPi()); + + hPID.fill(HIST("Before/hTPCnsigKa_mult_pt"), track1.tpcNSigmaKa(), multiplicity, track1.pt()); + // hPID.fill(HIST("Before/hTPCnsigPi_mult_pt"), track2.tpcNSigmaPi(), multiplicity, track2.pt()); + hPID.fill(HIST("Before/hTOFnsigKa_mult_pt"), track1.tofNSigmaKa(), multiplicity, track1.pt()); + hPID.fill(HIST("Before/hTOFnsigPi_mult_pt"), track2.tofNSigmaPi(), multiplicity, track2.pt()); + + hOthers.fill(HIST("hCRFC_before"), track1.tpcCrossedRowsOverFindableCls()); + hOthers.fill(HIST("dE_by_dx_TPC"), track1.p(), track1.tpcSignal()); + hOthers.fill(HIST("hphi"), track1.phi()); + + if (track1.sign() < 0) { + hPID.fill(HIST("Before/h1PID_TPC_neg_kaon"), track1.tpcNSigmaKa()); + // hPID.fill(HIST("Before/h1PID_TPC_neg_pion"), track2.tpcNSigmaPi()); + hPID.fill(HIST("Before/h1PID_TOF_neg_kaon"), track1.tofNSigmaKa()); + // hPID.fill(HIST("Before/h1PID_TOF_neg_pion"), track2.tofNSigmaPi()); + } else { + hPID.fill(HIST("Before/h1PID_TPC_pos_kaon"), track1.tpcNSigmaKa()); + // hPID.fill(HIST("Before/h1PID_TPC_pos_pion"), track2.tpcNSigmaPi()); + hPID.fill(HIST("Before/h1PID_TOF_pos_kaon"), track1.tofNSigmaKa()); + // hPID.fill(HIST("Before/h1PID_TOF_pos_pion"), track2.tofNSigmaPi()); + } + } + + if (cQAevents) { + rEventSelection.fill(HIST("hDcaxy_cent_pt"), track1.dcaXY(), multiplicity, track1.pt()); + rEventSelection.fill(HIST("hDcaz_cent_pt"), track1.dcaZ(), multiplicity, track1.pt()); + } + + // since we are using combinations full index policy, so repeated pairs are allowed, so we can check one with Kaon and other with kaon + if (!applypTdepPID && !selectionPID(track1, 1)) // Track 1 is checked with Kaon + continue; + if (!applypTdepPID && !selectionPID(track2, 1)) // Track 2 is checked with kaon + continue; + + if (applypTdepPID && !selectionPIDNew(track1, 1)) // Track 1 is checked with Kaon + continue; + if (applypTdepPID && !selectionPIDNew(track2, 1)) // Track 2 is checked with kaon + continue; + + rEventSelection.fill(HIST("tracksCheckData"), 2.5); + + if (cFakeTrack && isFakeTrack(track1, 1)) // Kaon + continue; + if (cFakeTrack && isFakeTrack(track2, 1)) // Pion + continue; + rEventSelection.fill(HIST("tracksCheckData"), 3.5); + + if (std::abs(track1.rapidity(o2::track::PID::getMass(o2::track::PID::Kaon))) > selectionConfig.ctrackRapidity) + continue; + + if (std::abs(track2.rapidity(o2::track::PID::getMass(o2::track::PID::Kaon))) > selectionConfig.ctrackRapidity) + continue; + rEventSelection.fill(HIST("tracksCheckData"), 4.5); + + if (selectionConfig.isApplyParticleMID) { + if (selectionMID(track1, 0)) // Kaon misidentified as pion + continue; + if (selectionMID(track1, 2)) // Kaon misidentified as proton + continue; + if (selectionMID(track2, 0)) // Pion misidentified as pion + continue; + if (selectionMID(track2, 2)) // Pion misidentified as proton + continue; + } + + rEventSelection.fill(HIST("tracksCheckData"), 5.5); + + if (cQAplots) { + // hPID.fill(HIST("After/hDcaxyPi"), track2.dcaXY()); + hPID.fill(HIST("After/hDcaxyKa"), track1.dcaXY()); + // hPID.fill(HIST("After/hDcazPi"), track2.dcaZ()); + hPID.fill(HIST("After/hDcazKa"), track1.dcaZ()); + + hPID.fill(HIST("After/hTPCnsigKa_mult_pt"), track1.tpcNSigmaKa(), multiplicity, track1.pt()); + // hPID.fill(HIST("After/hTPCnsigPi_mult_pt"), track2.tpcNSigmaPi(), multiplicity, track2.pt()); + hPID.fill(HIST("After/hTOFnsigKa_mult_pt"), track1.tofNSigmaKa(), multiplicity, track1.pt()); + hPID.fill(HIST("After/hTOFnsigPi_mult_pt"), track2.tofNSigmaPi(), multiplicity, track2.pt()); + hOthers.fill(HIST("hEta_after"), track1.eta()); + hOthers.fill(HIST("hCRFC_after"), track1.tpcCrossedRowsOverFindableCls()); + hPID.fill(HIST("After/hNsigmaKaonTPC_after"), track1.pt(), track1.tpcNSigmaKa()); + hPID.fill(HIST("After/hNsigmaKaonTOF_after"), track1.pt(), track1.tofNSigmaKa()); + // hPID.fill(HIST("After/hNsigmaPionTPC_after"), track2.pt(), track2.tpcNSigmaPi()); + // hPID.fill(HIST("After/hNsigmaPionTOF_after"), track2.pt(), track2.tofNSigmaPi()); + hPID.fill(HIST("After/hNsigma_TPC_TOF_Ka_after"), track1.tpcNSigmaKa(), track1.tofNSigmaKa()); + // hPID.fill(HIST("After/hNsigma_TPC_TOF_Pi_after"), track2.tpcNSigmaPi(), track2.tofNSigmaPi()); + } + + if (!selectionPair(track1, track2)) { + continue; + } + rEventSelection.fill(HIST("tracksCheckData"), 6.5); + + daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); + daughter2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); + mother = daughter1 + daughter2; // Phi meson + + if (selectionConfig.isApplyCutsOnMother) { + if (mother.Pt() >= selectionConfig.cMaxPtMotherCut) // excluding candidates in overflow + continue; + if (mother.M() >= selectionConfig.cMaxMinvMotherCut) // excluding candidates in overflow + continue; + } + + hOthers.fill(HIST("hKstar_rap_pt"), mother.Rapidity(), mother.Pt()); + hOthers.fill(HIST("hKstar_eta_pt"), mother.Eta(), mother.Pt()); + + isMix = false; + fillInvMass(daughter1, daughter2, mother, multiplicity, isMix, track1, track2); + } + } + + PROCESS_SWITCH(Kstarqa, processSEPhi, "Process Same event for Phi", false); + ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for ME mixing"}; // ConfigurableAxis axisMultiplicityClass{"axisMultiplicityClass", {10, 0, 100}, "multiplicity percentile for ME mixing"}; ConfigurableAxis axisMultiplicity{"axisMultiplicity", {2000, 0, 10000}, "TPC multiplicity axis for ME mixing"}; @@ -1183,6 +1374,10 @@ struct Kstarqa { continue; } + if (!selectionPair(t1, t2)) { + continue; + } + daughter1 = ROOT::Math::PxPyPzMVector(t1.px(), t1.py(), t1.pz(), massKa); daughter2 = ROOT::Math::PxPyPzMVector(t2.px(), t2.py(), t2.pz(), massPi); mother = daughter1 + daughter2; @@ -1209,6 +1404,79 @@ struct Kstarqa { } PROCESS_SWITCH(Kstarqa, processME, "Process Mixed event", true); + void processMEPhi(EventCandidatesMix const&, TrackCandidates const&) + { + // Map estimator to pair and multiplicity accessor + auto runMixing = [&](auto& pair, auto multiplicityGetter) { + for (const auto& [c1, tracks1, c2, tracks2] : pair) { + // if (!c1.sel8() || !c2.sel8()) + // continue; + + if (!selectionEvent(c1, false) || !selectionEvent(c2, false)) { // don't fill event cut histogram + continue; + } + + multiplicity = multiplicityGetter(c1); + + for (const auto& [t1, t2] : o2::soa::combinations( + o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { + if (!selectionTrack(t1) || !selectionTrack(t2)) + continue; + if (!selectionPID(t1, 1) || !selectionPID(t2, 1)) + continue; + + if (std::abs(t1.rapidity(o2::track::PID::getMass(o2::track::PID::Kaon))) > selectionConfig.ctrackRapidity) + continue; + + if (std::abs(t2.rapidity(o2::track::PID::getMass(o2::track::PID::Kaon))) > selectionConfig.ctrackRapidity) + continue; + + if (cFakeTrack && isFakeTrack(t1, 1)) // Kaon + continue; + if (cFakeTrack && isFakeTrack(t2, 1)) // Kaon + continue; + + if (selectionConfig.isApplyParticleMID) { + if (selectionMID(t1, 0)) // Kaon misidentified as pion + continue; + if (selectionMID(t1, 2)) // Kaon misidentified as proton + continue; + if (selectionMID(t2, 0)) // Pion misidentified as pion + continue; + if (selectionMID(t2, 2)) // Pion misidentified as proton + continue; + } + + if (!selectionPair(t1, t2)) { + continue; + } + + daughter1 = ROOT::Math::PxPyPzMVector(t1.px(), t1.py(), t1.pz(), massKa); + daughter2 = ROOT::Math::PxPyPzMVector(t2.px(), t2.py(), t2.pz(), massKa); + mother = daughter1 + daughter2; + + isMix = true; + + if (std::abs(mother.Rapidity()) < selectionConfig.rapidityMotherData) { + fillInvMass(daughter1, daughter2, mother, multiplicity, isMix, t1, t2); + } + } + } + }; + + // Call mixing based on selected estimator + if (cSelectMultEstimator == kFT0M) { + runMixing(pair1, [](const auto& c) { return c.centFT0M(); }); + } else if (cSelectMultEstimator == kFT0A) { + runMixing(pair2, [](const auto& c) { return c.centFT0A(); }); + } else if (cSelectMultEstimator == kFT0C) { + runMixing(pair3, [](const auto& c) { return c.centFT0C(); }); + } else if (cSelectMultEstimator == kFV0A) { + runMixing(pair4, [](const auto& c) { return c.centFV0A(); }); + } + } + PROCESS_SWITCH(Kstarqa, processMEPhi, "Process Mixed event for Phi", false); + void processMEMC(EventCandidatesMC const&, TrackCandidatesMC const&, aod::McParticles const&, aod::McCollisions const&) { auto runMixing = [&](auto& pair, auto multiplicityGetter) { @@ -1218,7 +1486,7 @@ struct Kstarqa { continue; } - if (!c1.has_mcCollision() || !c2.has_mcCollision()) { + if (selectionConfig.isApplyMCchecksClosure && (!c1.has_mcCollision() || !c2.has_mcCollision())) { continue; // skip if no MC collision associated } @@ -1242,7 +1510,7 @@ struct Kstarqa { continue; } - if (!t1.has_mcParticle() || !t2.has_mcParticle()) { + if (selectionConfig.isApplyMCchecksClosure && (!t1.has_mcParticle() || !t2.has_mcParticle())) { continue; // skip if no MC particle associated } @@ -1255,11 +1523,11 @@ struct Kstarqa { const auto mctrack1 = t1.mcParticle(); const auto mctrack2 = t2.mcParticle(); - if (!mctrack1.isPhysicalPrimary()) { + if (selectionConfig.isApplyMCchecksClosure && !mctrack1.isPhysicalPrimary()) { continue; } - if (!mctrack2.isPhysicalPrimary()) { + if (selectionConfig.isApplyMCchecksClosure && !mctrack2.isPhysicalPrimary()) { continue; } @@ -1286,7 +1554,7 @@ struct Kstarqa { runMixing(pairmc4, [](const auto& c) { return c.centFV0A(); }); } } - PROCESS_SWITCH(Kstarqa, processMEMC, "Process mixed-event in MC", true); + PROCESS_SWITCH(Kstarqa, processMEMC, "Process mixed-event in MC", false); void processSEMC(EventCandidatesMC::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const&, aod::McCollisions const& /*mcCollisions*/) { @@ -1337,15 +1605,15 @@ struct Kstarqa { const auto mctrack1 = track1.mcParticle(); const auto mctrack2 = track2.mcParticle(); - if (!track1.has_mcParticle() || !track2.has_mcParticle()) { + if (selectionConfig.isApplyMCchecksClosure && (!track1.has_mcParticle() || !track2.has_mcParticle())) { continue; // skip if no MC particle associated } - if (!mctrack1.isPhysicalPrimary()) { + if (selectionConfig.isApplyMCchecksClosure && !mctrack1.isPhysicalPrimary()) { continue; } - if (!mctrack2.isPhysicalPrimary()) { + if (selectionConfig.isApplyMCchecksClosure && !mctrack2.isPhysicalPrimary()) { continue; } rEventSelection.fill(HIST("tracksCheckData"), 1.5); @@ -1361,7 +1629,7 @@ struct Kstarqa { hPID.fill(HIST("Before/hTPCnsigKa_mult_pt"), track1.tpcNSigmaKa(), multiplicity, track1.pt()); hPID.fill(HIST("Before/hTPCnsigPi_mult_pt"), track2.tpcNSigmaPi(), multiplicity, track2.pt()); hPID.fill(HIST("Before/hTOFnsigKa_mult_pt"), track1.tofNSigmaKa(), multiplicity, track1.pt()); - hPID.fill(HIST("Before/hTOFnsigPi_mult_pt"), track2.tofNSigmaKa(), multiplicity, track2.pt()); + hPID.fill(HIST("Before/hTOFnsigPi_mult_pt"), track2.tofNSigmaPi(), multiplicity, track2.pt()); hOthers.fill(HIST("hCRFC_before"), track1.tpcCrossedRowsOverFindableCls()); hOthers.fill(HIST("dE_by_dx_TPC"), track1.p(), track1.tpcSignal()); @@ -1431,7 +1699,7 @@ struct Kstarqa { hPID.fill(HIST("After/hTPCnsigKa_mult_pt"), track1.tpcNSigmaKa(), multiplicity, track1.pt()); hPID.fill(HIST("After/hTPCnsigPi_mult_pt"), track2.tpcNSigmaPi(), multiplicity, track2.pt()); hPID.fill(HIST("After/hTOFnsigKa_mult_pt"), track1.tofNSigmaKa(), multiplicity, track1.pt()); - hPID.fill(HIST("After/hTOFnsigPi_mult_pt"), track2.tofNSigmaKa(), multiplicity, track2.pt()); + hPID.fill(HIST("After/hTOFnsigPi_mult_pt"), track2.tofNSigmaPi(), multiplicity, track2.pt()); hOthers.fill(HIST("hEta_after"), track1.eta()); hOthers.fill(HIST("hCRFC_after"), track1.tpcCrossedRowsOverFindableCls()); hPID.fill(HIST("After/hNsigmaKaonTPC_after"), track1.pt(), track1.tpcNSigmaKa()); @@ -1446,53 +1714,71 @@ struct Kstarqa { continue; rEventSelection.fill(HIST("tracksCheckData"), 6.5); + if (selectionConfig.isApplyMCchecksClosure) { + for (const auto& mothertrack1 : mctrack1.mothers_as()) { + for (const auto& mothertrack2 : mctrack2.mothers_as()) { - for (const auto& mothertrack1 : mctrack1.mothers_as()) { - for (const auto& mothertrack2 : mctrack2.mothers_as()) { + if (mothertrack1.globalIndex() != mothertrack2.globalIndex()) { + continue; + } - if (mothertrack1.globalIndex() != mothertrack2.globalIndex()) { - continue; - } + if (selectionConfig.isApplyMCchecksClosure && !mothertrack1.producedByGenerator()) { + continue; + } - if (!mothertrack1.producedByGenerator()) { - continue; - } + if (selectionConfig.isApplyCutsOnMother) { + if (mothertrack1.pt() >= selectionConfig.cMaxPtMotherCut) // excluding candidates in overflow + continue; + if ((std::sqrt(mothertrack1.e() * mothertrack1.e() - mothertrack1.p() * mothertrack1.p())) >= selectionConfig.cMaxMinvMotherCut) // excluding candidates in overflow + continue; + } - if (selectionConfig.isApplyCutsOnMother) { - if (mothertrack1.pt() >= selectionConfig.cMaxPtMotherCut) // excluding candidates in overflow - continue; - if ((std::sqrt(mothertrack1.e() * mothertrack1.e() - mothertrack1.p() * mothertrack1.p())) >= selectionConfig.cMaxMinvMotherCut) // excluding candidates in overflow + if (selectionConfig.isApplyMCchecksClosure && avoidsplitrackMC && oldindex == mothertrack1.globalIndex()) { continue; - } + } + rEventSelection.fill(HIST("recMCparticles"), 11.5); - if (avoidsplitrackMC && oldindex == mothertrack1.globalIndex()) { - continue; - } - rEventSelection.fill(HIST("recMCparticles"), 11.5); + oldindex = mothertrack1.globalIndex(); - oldindex = mothertrack1.globalIndex(); + daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); + daughter2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massPi); + mother = daughter1 + daughter2; // Kstar meson + + if (selectionConfig.isApplyCutsOnMother) { + if (mother.Pt() >= selectionConfig.cMaxPtMotherCut) // excluding candidates in overflow + continue; + if (mother.M() >= selectionConfig.cMaxMinvMotherCut) // excluding candidates in overflow + continue; + } - daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); - daughter2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massPi); - mother = daughter1 + daughter2; // Kstar meson + hOthers.fill(HIST("hKstar_rap_pt"), mother.Rapidity(), mother.Pt()); + hOthers.fill(HIST("hKstar_eta_pt"), mother.Eta(), mother.Pt()); - if (selectionConfig.isApplyCutsOnMother) { - if (mother.Pt() >= selectionConfig.cMaxPtMotherCut) // excluding candidates in overflow - continue; - if (mother.M() >= selectionConfig.cMaxMinvMotherCut) // excluding candidates in overflow - continue; + isMix = false; + fillInvMass(daughter1, daughter2, mother, multiplicity, isMix, track1, track2); } + } + } else { + daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); + daughter2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massPi); + mother = daughter1 + daughter2; // Kstar meson - hOthers.fill(HIST("hKstar_rap_pt"), mother.Rapidity(), mother.Pt()); - hOthers.fill(HIST("hKstar_eta_pt"), mother.Eta(), mother.Pt()); - - isMix = false; - fillInvMass(daughter1, daughter2, mother, multiplicity, isMix, track1, track2); + if (selectionConfig.isApplyCutsOnMother) { + if (mother.Pt() >= selectionConfig.cMaxPtMotherCut) // excluding candidates in overflow + continue; + if (mother.M() >= selectionConfig.cMaxMinvMotherCut) // excluding candidates in overflow + continue; } + + hOthers.fill(HIST("hKstar_rap_pt"), mother.Rapidity(), mother.Pt()); + hOthers.fill(HIST("hKstar_eta_pt"), mother.Eta(), mother.Pt()); + + isMix = false; + fillInvMass(daughter1, daughter2, mother, multiplicity, isMix, track1, track2); } } } - PROCESS_SWITCH(Kstarqa, processSEMC, "Process same event in MC", true); + PROCESS_SWITCH(Kstarqa, processSEMC, "Process same event in MC", false); Service pdgDB; @@ -1625,10 +1911,139 @@ struct Kstarqa { } PROCESS_SWITCH(Kstarqa, processGen, "Process Generated", false); - void processEvtLossSigLossMC(EventMCGenerated::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions) - // void processEvtLossSigLossMC(aod::McCollisions::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions) + void processGenPhi(EventMCGenerated::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& collisions) + // void processGenPhi(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& collisions) { - // if (selectionConfig.isINELgt0 && !mcCollision.isInelGt0()) { + rEventSelection.fill(HIST("eventsCheckGen"), 0.5); + + int nChInel = 0; + for (const auto& mcParticle : mcParticles) { + auto pdgcode = std::abs(mcParticle.pdgCode()); + if (mcParticle.isPhysicalPrimary() && (pdgcode == PDG_t::kPiPlus || pdgcode == PDG_t::kKPlus || pdgcode == PDG_t::kProton || pdgcode == std::abs(PDG_t::kElectron) || pdgcode == std::abs(PDG_t::kMuonMinus))) { + if (std::abs(mcParticle.eta()) < 1.0) { + nChInel = nChInel + 1; + } + } + } + if (nChInel > 0 && std::abs(mcCollision.posZ()) < selectionConfig.cutzvertex) + rEventSelection.fill(HIST("eventsCheckGen"), 1.5); + + std::vector selectedEvents(collisions.size()); + int nevts = 0; + multiplicity = -1.0; + // float impactParameter = mcCollision.impactParameter(); + + bool isINELgt0true = false; + + if (pwglf::isINELgtNmc(mcParticles, 0, pdgDB)) { + isINELgt0true = true; + } + if (selectionConfig.isINELgt0 && !isINELgt0true) { + return; + } + + // if (selectionConfig.isINELgt0 && !mcCollision.isInelGt0()) { + // return; + // } + rEventSelection.fill(HIST("eventsCheckGen"), 2.5); + + for (const auto& collision : collisions) { + if (!selectionEvent(collision, false)) { // don't fill event cut histogram + continue; + } + multiplicity = collision.centFT0M(); + + if (cSelectMultEstimator == kFT0M) { + multiplicity = collision.centFT0M(); + } else if (cSelectMultEstimator == kFT0A) { + multiplicity = collision.centFT0A(); + } else if (cSelectMultEstimator == kFT0C) { + multiplicity = collision.centFT0C(); + } else if (cSelectMultEstimator == kFV0A) { + multiplicity = collision.centFV0A(); + } else { + multiplicity = collision.centFT0M(); // default + } + hInvMass.fill(HIST("h1GenMult"), multiplicity); + + int occupancy = collision.trackOccupancyInTimeRange(); + rEventSelection.fill(HIST("hOccupancy"), occupancy); + + selectedEvents[nevts++] = collision.mcCollision_as().globalIndex(); + } + selectedEvents.resize(nevts); + + for (const auto& mcParticle : mcParticles) { + if (std::abs(mcParticle.y()) < selectionConfig.rapidityMotherData && std::abs(mcParticle.pdgCode()) == o2::constants::physics::kPhi) { + hInvMass.fill(HIST("hAllKstarGenCollisisons"), multiplicity, mcParticle.pt()); + } + } + + const auto evtReconstructedAndSelected = std::find(selectedEvents.begin(), selectedEvents.end(), mcCollision.globalIndex()) != selectedEvents.end(); + hInvMass.fill(HIST("hAllGenCollisions"), multiplicity); + if (!cAllGenCollisions && !evtReconstructedAndSelected) { // Check that the event is reconstructed and that the reconstructed events pass the selection + return; + } + double genMultiplicity = mcCollision.centFT0M(); + hInvMass.fill(HIST("h1GenMult2"), genMultiplicity); + hInvMass.fill(HIST("hAllGenCollisions1Rec"), multiplicity); + rEventSelection.fill(HIST("eventsCheckGen"), 3.5); + + for (const auto& mcParticle : mcParticles) { + + if (std::abs(mcParticle.y()) >= selectionConfig.rapidityMotherData) { + continue; + } + + if (selectionConfig.isApplyCutsOnMother) { + if (mcParticle.pt() >= selectionConfig.cMaxPtMotherCut) // excluding candidates in overflow + continue; + if ((std::sqrt(mcParticle.e() * mcParticle.e() - mcParticle.p() * mcParticle.p())) >= selectionConfig.cMaxMinvMotherCut) // excluding candidates in overflow + continue; + } + + if (std::abs(mcParticle.pdgCode()) != o2::constants::physics::kPhi) { + continue; + } + hInvMass.fill(HIST("hAllKstarGenCollisisons1Rec"), multiplicity, mcParticle.pt()); + + auto kDaughters = mcParticle.daughters_as(); + if (kDaughters.size() != selectionConfig.noOfDaughters) { + continue; + } + + auto passPosKaon = false; + auto passNegKaon = false; + for (const auto& kCurrentDaughter : kDaughters) { + if (!kCurrentDaughter.isPhysicalPrimary()) { + continue; + } + + if (kCurrentDaughter.pdgCode() == PDG_t::kKPlus) { + passPosKaon = true; + daughter1 = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massKa); + + } else if (kCurrentDaughter.pdgCode() == PDG_t::kKMinus) { + passNegKaon = true; + daughter2 = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massKa); + } + } + if (passPosKaon && passNegKaon) { + mother = daughter1 + daughter2; // Phi meson + hInvMass.fill(HIST("hk892GenpT"), mcParticle.pt(), multiplicity); + hInvMass.fill(HIST("hk892GenpT2"), mother.Pt(), multiplicity); + hInvMass.fill(HIST("hk892GenpTCalib1"), mcParticle.pt(), genMultiplicity); + hInvMass.fill(HIST("hk892GenpTCalib2"), mother.Pt(), genMultiplicity); + hInvMass.fill(HIST("h1genmass"), mother.M()); + } + } + } + PROCESS_SWITCH(Kstarqa, processGenPhi, "Process Generated for Phi meson", false); + + void processEvtLossSigLossMC(EventMCGenerated::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions) + // void processEvtLossSigLossMC(aod::McCollisions::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions) + { + // if (selectionConfig.isINELgt0 && !mcCollision.isInelGt0()) { // return; // } @@ -1700,6 +2115,81 @@ struct Kstarqa { } PROCESS_SWITCH(Kstarqa, processEvtLossSigLossMC, "Process Signal Loss, Event Loss", false); + void processEvtLossSigLossMCPhi(EventMCGenerated::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions) + // void processEvtLossSigLossMCPhi(aod::McCollisions::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions) + { + // if (selectionConfig.isINELgt0 && !mcCollision.isInelGt0()) { + // return; + // } + + bool isINELgt0true = false; + + if (pwglf::isINELgtNmc(mcParticles, 0, pdgDB)) { + isINELgt0true = true; + } + if (selectionConfig.isINELgt0 && !isINELgt0true) { + return; + } + + if (selectionConfig.checkVzEvSigLoss && (std::abs(mcCollision.posZ()) >= selectionConfig.cutzvertex)) { + return; + } + + auto impactPar = mcCollision.impactParameter(); + auto multiplicityRec = -1; + auto multiplicityGen = -1; + multiplicityGen = mcCollision.centFT0M(); + hInvMass.fill(HIST("MCcorrections/hImpactParameterGen"), impactPar); + hInvMass.fill(HIST("MCcorrections/MultiplicityGen"), multiplicityGen); + + bool isSelectedEvent = false; + auto multiplicity1 = -999.; + for (const auto& RecCollision : recCollisions) { + if (!RecCollision.has_mcCollision()) + continue; + if (!selectionEvent(RecCollision, false)) // don't fill event cut histogram + continue; + // multiplicity1 = RecCollision.centFT0M(); + const auto& mcCollisionRec = RecCollision.mcCollision_as(); + multiplicityRec = mcCollisionRec.centFT0M(); + + if (cSelectMultEstimator == kFT0M) { + multiplicity1 = RecCollision.centFT0M(); + } else if (cSelectMultEstimator == kFT0A) { + multiplicity1 = RecCollision.centFT0A(); + } else if (cSelectMultEstimator == kFT0C) { + multiplicity1 = RecCollision.centFT0C(); + } else if (cSelectMultEstimator == kFV0A) { + multiplicity1 = RecCollision.centFV0A(); + } else { + multiplicity1 = RecCollision.centFT0M(); // default + } + + isSelectedEvent = true; + } + + // Event loss + if (isSelectedEvent) { + hInvMass.fill(HIST("MCcorrections/hImpactParameterRec"), impactPar); + hInvMass.fill(HIST("MCcorrections/MultiplicityRec"), multiplicityGen); + hInvMass.fill(HIST("MCcorrections/MultiplicityRec2"), multiplicityRec); + hInvMass.fill(HIST("MCcorrections/hImpactParametervsMultiplicity"), impactPar, multiplicity1); + } + + // Generated MC + for (const auto& mcPart : mcParticles) { + if (std::abs(mcPart.y()) >= selectionConfig.rapidityMotherData || std::abs(mcPart.pdgCode()) != o2::constants::physics::kPhi) + continue; + + // signal loss estimation + hInvMass.fill(HIST("MCcorrections/hSignalLossDenominator"), mcPart.pt(), multiplicityGen); + if (isSelectedEvent) { + hInvMass.fill(HIST("MCcorrections/hSignalLossNumerator"), mcPart.pt(), multiplicityGen); + } + } // end loop on gen particles + } + PROCESS_SWITCH(Kstarqa, processEvtLossSigLossMCPhi, "Process Signal Loss, Event Loss for Phi", false); + void processRec(EventCandidatesMC::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const&, EventMCGenerated const&) { @@ -1790,7 +2280,7 @@ struct Kstarqa { hPID.fill(HIST("Before/hTPCnsigKa_mult_pt"), track1.tpcNSigmaKa(), multiplicity, track1.pt()); hPID.fill(HIST("Before/hTPCnsigPi_mult_pt"), track2.tpcNSigmaPi(), multiplicity, track2.pt()); hPID.fill(HIST("Before/hTOFnsigKa_mult_pt"), track1.tofNSigmaKa(), multiplicity, track1.pt()); - hPID.fill(HIST("Before/hTOFnsigPi_mult_pt"), track2.tofNSigmaKa(), multiplicity, track2.pt()); + hPID.fill(HIST("Before/hTOFnsigPi_mult_pt"), track2.tofNSigmaPi(), multiplicity, track2.pt()); } if (cQAplots && (mctrack2.pdgCode() == PDG_t::kPiPlus)) { // pion hPID.fill(HIST("Before/h1PID_TPC_pos_pion"), track2.tpcNSigmaPi()); @@ -1841,6 +2331,14 @@ struct Kstarqa { } rEventSelection.fill(HIST("recMCparticles"), 6.5); + if (selectionConfig.isPDGCheckMC && (track1PDG == PDG_t::kKPlus) && (track2PDG == PDG_t::kKPlus)) { + continue; + } + if (selectionConfig.isPDGCheckMC && (track1PDG == PDG_t::kPiPlus) && (track2PDG == PDG_t::kPiPlus)) { + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 7.5); + for (const auto& mothertrack1 : mctrack1.mothers_as()) { for (const auto& mothertrack2 : mctrack2.mothers_as()) { if (selectionConfig.isPDGCheckMC && (mothertrack1.pdgCode() != mothertrack2.pdgCode())) { @@ -1850,22 +2348,22 @@ struct Kstarqa { if (mothertrack1.globalIndex() != mothertrack2.globalIndex()) { continue; } - rEventSelection.fill(HIST("recMCparticles"), 7.5); + rEventSelection.fill(HIST("recMCparticles"), 8.5); if (!mothertrack1.producedByGenerator()) { continue; } - rEventSelection.fill(HIST("recMCparticles"), 8.5); + rEventSelection.fill(HIST("recMCparticles"), 9.5); if (std::abs(mothertrack1.y()) >= selectionConfig.rapidityMotherData) { continue; } - rEventSelection.fill(HIST("recMCparticles"), 9.5); + rEventSelection.fill(HIST("recMCparticles"), 10.5); if (selectionConfig.isPDGCheckMC && (std::abs(mothertrack1.pdgCode()) != o2::constants::physics::kK0Star892)) { continue; } - rEventSelection.fill(HIST("recMCparticles"), 10.5); + rEventSelection.fill(HIST("recMCparticles"), 11.5); if (selectionConfig.isPDGCheckMC && (track1PDG == PDG_t::kPiPlus)) { if (!applypTdepPID && !(selectionPID(track1, 0) && selectionPID(track2, 1))) { // pion and kaon @@ -1873,7 +2371,7 @@ struct Kstarqa { } else if (applypTdepPID && !(selectionPIDNew(track1, 0) && selectionPIDNew(track2, 1))) { // pion and kaon continue; } - rEventSelection.fill(HIST("recMCparticles"), 11.5); + rEventSelection.fill(HIST("recMCparticles"), 12.5); if (selectionConfig.isApplyParticleMID) { if (selectionMID(track2, 0)) // Kaon misidentified as pion continue; @@ -1884,14 +2382,14 @@ struct Kstarqa { if (selectionMID(track1, 2)) // Pion misidentified as proton continue; } - rEventSelection.fill(HIST("recMCparticles"), 12.5); + rEventSelection.fill(HIST("recMCparticles"), 13.5); if (std::abs(track1.rapidity(o2::track::PID::getMass(o2::track::PID::Pion))) > selectionConfig.ctrackRapidity) continue; if (std::abs(track2.rapidity(o2::track::PID::getMass(o2::track::PID::Kaon))) > selectionConfig.ctrackRapidity) continue; - rEventSelection.fill(HIST("recMCparticles"), 13.5); + rEventSelection.fill(HIST("recMCparticles"), 14.5); } else if (selectionConfig.isPDGCheckMC && (track1PDG == PDG_t::kKPlus)) { if (!applypTdepPID && !(selectionPID(track1, 1) && selectionPID(track2, 0))) { // kaon and pion @@ -1899,7 +2397,7 @@ struct Kstarqa { } else if (applypTdepPID && !(selectionPIDNew(track1, 1) && selectionPIDNew(track2, 0))) { // kaon and pion continue; } - rEventSelection.fill(HIST("recMCparticles"), 11.5); + rEventSelection.fill(HIST("recMCparticles"), 12.5); if (selectionConfig.isApplyParticleMID) { if (selectionMID(track1, 0)) // Kaon misidentified as pion @@ -1911,20 +2409,20 @@ struct Kstarqa { if (selectionMID(track2, 2)) // Pion misidentified as proton continue; } - rEventSelection.fill(HIST("recMCparticles"), 12.5); + rEventSelection.fill(HIST("recMCparticles"), 13.5); if (std::abs(track1.rapidity(o2::track::PID::getMass(o2::track::PID::Kaon))) > selectionConfig.ctrackRapidity) continue; if (std::abs(track2.rapidity(o2::track::PID::getMass(o2::track::PID::Pion))) > selectionConfig.ctrackRapidity) continue; - rEventSelection.fill(HIST("recMCparticles"), 13.5); + rEventSelection.fill(HIST("recMCparticles"), 14.5); } if (cQAplots) { hPID.fill(HIST("After/hTPCnsigKa_mult_pt"), track1.tpcNSigmaKa(), multiplicity, track1.pt()); hPID.fill(HIST("After/hTPCnsigPi_mult_pt"), track2.tpcNSigmaPi(), multiplicity, track2.pt()); hPID.fill(HIST("After/hTOFnsigKa_mult_pt"), track1.tofNSigmaKa(), multiplicity, track1.pt()); - hPID.fill(HIST("After/hTOFnsigPi_mult_pt"), track2.tofNSigmaKa(), multiplicity, track2.pt()); + hPID.fill(HIST("After/hTOFnsigPi_mult_pt"), track2.tofNSigmaPi(), multiplicity, track2.pt()); } if (selectionConfig.isApplyCutsOnMother) { @@ -1938,7 +2436,12 @@ struct Kstarqa { hInvMass.fill(HIST("h1KSRecsplit"), mothertrack1.pt()); continue; } - rEventSelection.fill(HIST("recMCparticles"), 14.5); + rEventSelection.fill(HIST("recMCparticles"), 15.5); + + if (!selectionPair(track1, track2)) { + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 16.5); oldindex = mothertrack1.globalIndex(); if (track1.sign() * track2.sign() < 0) { @@ -1964,6 +2467,241 @@ struct Kstarqa { } PROCESS_SWITCH(Kstarqa, processRec, "Process Reconstructed", false); + void processRecPhi(EventCandidatesMC::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const&, EventMCGenerated const&) + { + + if (!collision.has_mcCollision()) { + return; + } + + double multiplicityRec = -1.0; + // multiplicityRec = collision.mcCollision_as().centFT0M(); + const auto& mcCollisionRec = collision.mcCollision_as(); + multiplicityRec = mcCollisionRec.centFT0M(); + + if (selectionConfig.isINELgt0 && !collision.isInelGt0()) { + return; + } + // multiplicity = collision.centFT0M(); + + if (cSelectMultEstimator == kFT0M) { + multiplicity = collision.centFT0M(); + } else if (cSelectMultEstimator == kFT0A) { + multiplicity = collision.centFT0A(); + } else if (cSelectMultEstimator == kFT0C) { + multiplicity = collision.centFT0C(); + } else if (cSelectMultEstimator == kFV0A) { + multiplicity = collision.centFV0A(); + } else { + multiplicity = collision.centFT0M(); // default + } + + hInvMass.fill(HIST("hAllRecCollisions"), multiplicity); + hInvMass.fill(HIST("hAllRecCollisionsCalib"), multiplicityRec); + + if (!selectionEvent(collision, true)) { // fill MC event cut histogram + return; + } + + hInvMass.fill(HIST("h1RecMult"), multiplicity); + hInvMass.fill(HIST("h1RecMult2"), multiplicityRec); + + if (cQAevents) { + rEventSelection.fill(HIST("hVertexZRec"), collision.posZ()); + } + + auto oldindex = -999; + for (const auto& track1 : tracks) { + if (!selectionTrack(track1)) { + continue; + } + + if (!track1.has_mcParticle()) { + continue; + } + + if (cQAevents) { + rEventSelection.fill(HIST("hDcaxy_cent_pt"), track1.dcaXY(), multiplicity, track1.pt()); + rEventSelection.fill(HIST("hDcaz_cent_pt"), track1.dcaZ(), multiplicity, track1.pt()); + } + + auto track1ID = track1.index(); + for (const auto& track2 : tracks) { + rEventSelection.fill(HIST("recMCparticles"), 0.5); + if (!track2.has_mcParticle()) { + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 1.5); + + if (!selectionTrack(track2)) { + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 2.5); + + auto track2ID = track2.index(); + if (track2ID <= track1ID) { + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 3.5); + + if (track1.sign() * track2.sign() >= 0) { + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 4.5); + + const auto mctrack1 = track1.mcParticle(); + const auto mctrack2 = track2.mcParticle(); + int track1PDG = std::abs(mctrack1.pdgCode()); + int track2PDG = std::abs(mctrack2.pdgCode()); + if (cQAplots) { + hPID.fill(HIST("Before/hTPCnsigKa_mult_pt"), track1.tpcNSigmaKa(), multiplicity, track1.pt()); + // hPID.fill(HIST("Before/hTPCnsigPi_mult_pt"), track2.tpcNSigmaPi(), multiplicity, track2.pt()); + hPID.fill(HIST("Before/hTOFnsigKa_mult_pt"), track1.tofNSigmaKa(), multiplicity, track1.pt()); + hPID.fill(HIST("Before/hTOFnsigPi_mult_pt"), track2.tofNSigmaPi(), multiplicity, track2.pt()); + } + // if (cQAplots && (mctrack2.pdgCode() == PDG_t::kPiPlus)) { // pion + // hPID.fill(HIST("Before/h1PID_TPC_pos_pion"), track2.tpcNSigmaPi()); + // hPID.fill(HIST("Before/h1PID_TOF_pos_pion"), track2.tofNSigmaPi()); + // hPID.fill(HIST("Before/hNsigmaTPC_Pi_before"), track2.pt(), track2.tpcNSigmaPi()); + // hPID.fill(HIST("Before/hNsigmaTOF_Pi_before"), track2.pt(), track2.tofNSigmaPi()); + // } + if (cQAplots && (mctrack2.pdgCode() == PDG_t::kKPlus)) { // kaon + hPID.fill(HIST("Before/h1PID_TPC_pos_kaon"), track2.tpcNSigmaKa()); + hPID.fill(HIST("Before/h1PID_TOF_pos_kaon"), track2.tofNSigmaKa()); + hPID.fill(HIST("Before/hNsigmaTPC_Ka_before"), track2.pt(), track2.tpcNSigmaKa()); + hPID.fill(HIST("Before/hNsigmaTOF_Ka_before"), track2.pt(), track2.tofNSigmaKa()); + } + // if (cQAplots && (mctrack2.pdgCode() == -PDG_t::kPiMinus)) { // negative track pion + // hPID.fill(HIST("Before/h1PID_TPC_neg_pion"), track2.tpcNSigmaPi()); + // hPID.fill(HIST("Before/h1PID_TOF_neg_pion"), track2.tofNSigmaPi()); + // hPID.fill(HIST("Before/hNsigmaTPC_Pi_before"), track2.pt(), track2.tpcNSigmaPi()); + // hPID.fill(HIST("Before/hNsigmaTOF_Pi_before"), track2.pt(), track2.tofNSigmaPi()); + // } + if (cQAplots && (mctrack2.pdgCode() == -PDG_t::kKMinus)) { // negative track kaon + hPID.fill(HIST("Before/h1PID_TPC_neg_kaon"), track2.tpcNSigmaKa()); + hPID.fill(HIST("Before/h1PID_TOF_neg_kaon"), track2.tofNSigmaKa()); + hPID.fill(HIST("Before/hNsigmaTPC_Ka_before"), track2.pt(), track2.tpcNSigmaKa()); + hPID.fill(HIST("Before/hNsigmaTOF_Ka_before"), track2.pt(), track2.tofNSigmaKa()); + } + if (cQAplots && (std::abs(mctrack1.pdgCode()) == PDG_t::kKPlus && std::abs(mctrack2.pdgCode()) == PDG_t::kKMinus)) { + hPID.fill(HIST("Before/hNsigma_TPC_TOF_Ka_before"), track1.tpcNSigmaKa(), track1.tofNSigmaKa()); + // hPID.fill(HIST("Before/hNsigma_TPC_TOF_Pi_before"), track2.tpcNSigmaPi(), track2.tofNSigmaPi()); + } + + if (!mctrack1.isPhysicalPrimary()) { + continue; + } + + if (!mctrack2.isPhysicalPrimary()) { + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 5.5); + + if (selectionConfig.isPDGCheckMC && ((track1PDG != PDG_t::kKPlus) || (track2PDG != PDG_t::kKPlus))) { + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 6.5); + + for (const auto& mothertrack1 : mctrack1.mothers_as()) { + for (const auto& mothertrack2 : mctrack2.mothers_as()) { + if (selectionConfig.isPDGCheckMC && (mothertrack1.pdgCode() != mothertrack2.pdgCode())) { + continue; + } + + if (mothertrack1.globalIndex() != mothertrack2.globalIndex()) { + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 7.5); + + if (!mothertrack1.producedByGenerator()) { + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 8.5); + + if (std::abs(mothertrack1.y()) >= selectionConfig.rapidityMotherData) { + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 9.5); + + if (selectionConfig.isPDGCheckMC && (std::abs(mothertrack1.pdgCode()) != o2::constants::physics::kPhi)) { + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 10.5); + + if (!applypTdepPID && !(selectionPID(track1, 1) && selectionPID(track2, 1))) { // kaon and kaon + continue; + } else if (applypTdepPID && !(selectionPIDNew(track1, 1) && selectionPIDNew(track2, 1))) { // kaon and kaon + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 11.5); + + if (selectionConfig.isApplyParticleMID) { + if (selectionMID(track1, 0)) // Kaon misidentified as pion + continue; + if (selectionMID(track1, 2)) // Kaon misidentified as proton + continue; + if (selectionMID(track2, 0)) // Kaon misidentified as pion + continue; + if (selectionMID(track2, 2)) // Kaon misidentified as proton + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 12.5); + + if (std::abs(track1.rapidity(o2::track::PID::getMass(o2::track::PID::Kaon))) > selectionConfig.ctrackRapidity) + continue; + + if (std::abs(track2.rapidity(o2::track::PID::getMass(o2::track::PID::Kaon))) > selectionConfig.ctrackRapidity) + continue; + rEventSelection.fill(HIST("recMCparticles"), 13.5); + if (cQAplots) { + hPID.fill(HIST("After/hTPCnsigKa_mult_pt"), track1.tpcNSigmaKa(), multiplicity, track1.pt()); + // hPID.fill(HIST("After/hTPCnsigPi_mult_pt"), track2.tpcNSigmaPi(), multiplicity, track2.pt()); + hPID.fill(HIST("After/hTOFnsigKa_mult_pt"), track1.tofNSigmaKa(), multiplicity, track1.pt()); + // hPID.fill(HIST("After/hTOFnsigPi_mult_pt"), track2.tofNSigmaPi(), multiplicity, track2.pt()); + } + + if (selectionConfig.isApplyCutsOnMother) { + if (mothertrack1.pt() >= selectionConfig.cMaxPtMotherCut) // excluding candidates in overflow + continue; + if ((std::sqrt(mothertrack1.e() * mothertrack1.e() - mothertrack1.p() * mothertrack1.p())) >= selectionConfig.cMaxMinvMotherCut) // excluding candidates in overflow + continue; + } + + if (avoidsplitrackMC && oldindex == mothertrack1.globalIndex()) { + hInvMass.fill(HIST("h1KSRecsplit"), mothertrack1.pt()); + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 14.5); + + if (!selectionPair(track1, track2)) { + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 15.5); + + oldindex = mothertrack1.globalIndex(); + if (track1.sign() * track2.sign() < 0) { + daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); + daughter2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); + mother = daughter1 + daughter2; // Phi meson + + hInvMass.fill(HIST("h2KstarRecpt2"), mothertrack1.pt(), multiplicity, std::sqrt(mothertrack1.e() * mothertrack1.e() - mothertrack1.p() * mothertrack1.p())); + hInvMass.fill(HIST("h2KstarRecptCalib2"), mothertrack1.pt(), multiplicityRec, std::sqrt(mothertrack1.e() * mothertrack1.e() - mothertrack1.p() * mothertrack1.p())); + + if (applyRecMotherRapidity && mother.Rapidity() >= selectionConfig.rapidityMotherData) { + continue; + } + + hInvMass.fill(HIST("h1KstarRecMass"), mother.M()); + hInvMass.fill(HIST("h2KstarRecpt1"), mother.Pt(), multiplicity, mother.M()); + hInvMass.fill(HIST("h2KstarRecptCalib1"), mother.Pt(), multiplicityRec, mother.M()); + } + } + } + } + } + } + PROCESS_SWITCH(Kstarqa, processRecPhi, "Process Reconstructed", false); + void processRec2(EventCandidatesMC::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const&, EventMCGenerated const&) { @@ -2158,6 +2896,11 @@ struct Kstarqa { } rEventSelection.fill(HIST("recMCparticles"), 14.5); + if (!selectionPair(track1, track2)) { + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 15.5); + oldindex = mothertrack1.globalIndex(); if (track1.sign() * track2.sign() < 0) { daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); From a1e030f2b063d8002f84231321cffe72b21d698c Mon Sep 17 00:00:00 2001 From: Samuele Cattaruzzi <124249902+scattaru@users.noreply.github.com> Date: Tue, 2 Sep 2025 09:08:49 +0200 Subject: [PATCH 270/986] [PWGHF] Update of post processing macros for hf correlation studies (#12815) --- PWGHF/HFC/Macros/DhCorrelationExtraction.cxx | 1066 ++++++++++++++++- PWGHF/HFC/Macros/DhCorrelationExtraction.h | 168 ++- PWGHF/HFC/Macros/DhCorrelationFitter.cxx | 697 ++++++++++- PWGHF/HFC/Macros/DhCorrelationFitter.h | 46 +- PWGHF/HFC/Macros/ExtractOutputCorrel.C | 182 ++- PWGHF/HFC/Macros/FitCorrel.C | 396 +++++- .../Macros/config_CorrAnalysis_DsToKKPi.json | 82 +- 7 files changed, 2404 insertions(+), 233 deletions(-) diff --git a/PWGHF/HFC/Macros/DhCorrelationExtraction.cxx b/PWGHF/HFC/Macros/DhCorrelationExtraction.cxx index c4faa289abb..5e6125d0bdb 100644 --- a/PWGHF/HFC/Macros/DhCorrelationExtraction.cxx +++ b/PWGHF/HFC/Macros/DhCorrelationExtraction.cxx @@ -10,7 +10,7 @@ // or submit itself to any jurisdiction. /// \file DhCorrelationExtraction.cxx -/// \brief Class for D-h correlation extraction +/// \brief class for D-h correlation extraction /// \author Samuele Cattaruzzi /// \author Swapnesh Santosh Khade @@ -18,9 +18,11 @@ #include #include +#include #include #include #include +#include #include #include @@ -33,10 +35,19 @@ DhCorrelationExtraction::DhCorrelationExtraction() : // default constructor fFileMass(0x0), fFileSE(0x0), fFileME(0x0), + fFileFDTemplate(0x0), + fFileFDPromptFrac(0x0), + fFileSecPart(0x0), fDirMass(0x0), fDirSE(0x0), fDirME(0x0), + fDirSecPart(0x0), + fFilePromptMc(0x0), + fFileNonPromptMc(0x0), fCorrectedCorrHisto(0x0), + fCorrectedCorrHisto_BaselineSubtr(0x0), + fCorrectedCorrHisto_Reflected(0x0), + fCorrectedCorrHisto_Reflected_BaselineSubtr(0x0), fDmesonSpecies(kDsToKKPi), fDmesonLabel("Ds"), fNpools(9), @@ -46,21 +57,47 @@ DhCorrelationExtraction::DhCorrelationExtraction() : // default constructor fSubtractSoftPiME(kFALSE), fFileNameSE(""), fFileNameME(""), + fFileSecPartName(""), + fFilePromptMcRecName(""), + fFileNonPromptMcRecName(""), fDirNameSE(""), fDirNameME(""), + fDirSecPartName(""), fMassHistoNameSgn(""), fMassHistoNameBkg(""), fMassHistoNameSBs(""), fSECorrelSignalRegionName(""), fSECorrelSidebandsName(""), + fSECorrelSidebandLeftName(""), + fSECorrelSidebandRightName(""), fMECorrelSignalRegionName(""), fMECorrelSidebandsName(""), + fMECorrelSidebandLeftName(""), + fMECorrelSidebandRightName(""), + fFileFDTemplateName(""), + fFileFDPromptFracName(""), + fHistoFDTemplatePromptName(""), + fHistoFDTemplateNonPromptName(""), + fHistoFDPromptFracName(""), + fHistoPrimaryPartName(""), + fHistoAllPartName(""), fBkgScaleFactor(1.), fSgnYieldNorm(1.), - fRebin2Dhisto(kFALSE), + fBkgYield(1.), + fRebinAngCorr(kFALSE), + fRebinFDCorr(kFALSE), + fRebinSecPart(kFALSE), + fSidebandDivided(kFALSE), + fUseSidebLeft(kFALSE), + fUseSidebRight(kFALSE), fRebinAxisDeltaEta(1), fRebinAxisDeltaPhi(1), - fDebug(0) + fBinPtCand(0), + fBinPtHad(0), + fDebug(0), + fFDsubtraction(0), + fSecPartContamination(0), + fCorrBiasBtoD(0) { } @@ -68,10 +105,17 @@ DhCorrelationExtraction::DhCorrelationExtraction(const DhCorrelationExtraction& fFileMass(source.fFileMass), fFileSE(source.fFileSE), fFileME(source.fFileME), + fFileFDTemplate(source.fFileFDTemplate), + fFileFDPromptFrac(source.fFileFDPromptFrac), + fFileSecPart(source.fFileSecPart), + fFilePromptMc(source.fFilePromptMc), + fFileNonPromptMc(source.fFileNonPromptMc), fDirMass(source.fDirMass), - fDirSE(source.fDirSE), - fDirME(source.fDirME), + fDirSecPart(source.fDirSecPart), fCorrectedCorrHisto(source.fCorrectedCorrHisto), + fCorrectedCorrHisto_BaselineSubtr(source.fCorrectedCorrHisto_BaselineSubtr), + fCorrectedCorrHisto_Reflected(source.fCorrectedCorrHisto_Reflected), + fCorrectedCorrHisto_Reflected_BaselineSubtr(source.fCorrectedCorrHisto_Reflected_BaselineSubtr), fDmesonSpecies(source.fDmesonSpecies), fDmesonLabel(source.fDmesonLabel), fNpools(source.fNpools), @@ -81,21 +125,47 @@ DhCorrelationExtraction::DhCorrelationExtraction(const DhCorrelationExtraction& fSubtractSoftPiME(source.fSubtractSoftPiME), fFileNameSE(source.fFileNameSE), fFileNameME(source.fFileNameME), + fFileSecPartName(source.fFileSecPartName), + fFilePromptMcRecName(source.fFilePromptMcRecName), + fFileNonPromptMcRecName(source.fFileNonPromptMcRecName), fDirNameSE(source.fDirNameSE), fDirNameME(source.fDirNameME), + fDirSecPartName(source.fDirSecPartName), fMassHistoNameSgn(source.fMassHistoNameSgn), fMassHistoNameBkg(source.fMassHistoNameBkg), fMassHistoNameSBs(source.fMassHistoNameSBs), fSECorrelSignalRegionName(source.fSECorrelSignalRegionName), fSECorrelSidebandsName(source.fSECorrelSidebandsName), + fSECorrelSidebandLeftName(source.fSECorrelSidebandLeftName), + fSECorrelSidebandRightName(source.fSECorrelSidebandRightName), fMECorrelSignalRegionName(source.fMECorrelSignalRegionName), fMECorrelSidebandsName(source.fMECorrelSidebandsName), + fMECorrelSidebandLeftName(source.fMECorrelSidebandLeftName), + fMECorrelSidebandRightName(source.fMECorrelSidebandRightName), + fFileFDTemplateName(source.fFileFDTemplateName), + fFileFDPromptFracName(source.fFileFDPromptFracName), + fHistoFDTemplatePromptName(source.fHistoFDTemplatePromptName), + fHistoFDTemplateNonPromptName(source.fHistoFDTemplateNonPromptName), + fHistoFDPromptFracName(source.fHistoFDPromptFracName), + fHistoPrimaryPartName(source.fHistoPrimaryPartName), + fHistoAllPartName(source.fHistoAllPartName), fBkgScaleFactor(source.fBkgScaleFactor), fSgnYieldNorm(source.fSgnYieldNorm), - fRebin2Dhisto(source.fRebin2Dhisto), + fBkgYield(source.fBkgYield), + fRebinAngCorr(source.fRebinAngCorr), + fRebinFDCorr(source.fRebinFDCorr), + fRebinSecPart(source.fRebinSecPart), + fSidebandDivided(source.fSidebandDivided), + fUseSidebLeft(source.fUseSidebLeft), + fUseSidebRight(source.fUseSidebRight), fRebinAxisDeltaEta(source.fRebinAxisDeltaEta), fRebinAxisDeltaPhi(source.fRebinAxisDeltaPhi), - fDebug(source.fDebug) + fBinPtCand(source.fBinPtCand), + fBinPtHad(source.fBinPtHad), + fDebug(source.fDebug), + fFDsubtraction(source.fFDsubtraction), + fSecPartContamination(source.fSecPartContamination), + fCorrBiasBtoD(source.fCorrBiasBtoD) { } @@ -119,7 +189,6 @@ Bool_t DhCorrelationExtraction::SetDmesonSpecie(DmesonSpecie k) } else { fDmesonLabel = "Dstar"; } - fDmesonSpecies = k; return kTRUE; } @@ -149,20 +218,43 @@ Bool_t DhCorrelationExtraction::ExtractCorrelations(Double_t PtCandMin, Double_t TH2D* h2D_Sideb; TH2D* h2D_Subtr; + TH2D* h2D_FDTemplatePrompt; + TH2D* h2D_FDTemplateNonPrompt; + TH1D* h1D_Sign; TH1D* h1D_Sideb; TH1D* h1D_Subtr; + TH1D* h1D_SignNorm; + TH1D* h1D_SidebNorm; TH1D* h1D_SubtrNorm; + TH1D* h1D_FDTemplatePrompt; + TH1D* h1D_FDTemplateNonPrompt; + TH1D* h1D_TemplateTotal; + TH1D* h1D_SubtrFDNorm; + TH1D* h1D_PrimaryPartCorr; + TH1D* h1D_AllPartCorr; + TH1D* h1D_SecPartFrac; + TH1D* h1D_SubtrNorm_SecPart; + TH1D* h1D_BaselineSubtr; + TH1D* h1D_ReflCorr; + TH1D* h1D_ReflCorr_BaselineSubtr; + TH1D* hModul; + TH1D* hBeforeModulCorr; + + Double_t FDPromptFrac; // if (fIntegratePtBins && iBinPtHad>0) continue; for (int iPool = 0; iPool < fNpools; iPool++) { - // Retrieve 2D plots for SE and ME, signal and bkg regions, for each pTbin and pool hSE_Sign[iPool] = GetCorrelHisto(kSE, kSign, iPool, PtCandMin, PtCandMax, PtHadMin, PtHadMax); + std::cout << "Got SE histogram signal region" << std::endl; hME_Sign[iPool] = GetCorrelHisto(kME, kSign, iPool, PtCandMin, PtCandMax, PtHadMin, PtHadMax); + std::cout << "Got ME histogram signal region" << std::endl; hSE_Sideb[iPool] = GetCorrelHisto(kSE, kSideb, iPool, PtCandMin, PtCandMax, PtHadMin, PtHadMax); + std::cout << "Got SE histogram sdeband region" << std::endl; hME_Sideb[iPool] = GetCorrelHisto(kME, kSideb, iPool, PtCandMin, PtCandMax, PtHadMin, PtHadMax); + std::cout << "Got ME histogram sdeband region" << std::endl; hSE_Sign[iPool]->Sumw2(); hME_Sign[iPool]->Sumw2(); @@ -170,7 +262,7 @@ Bool_t DhCorrelationExtraction::ExtractCorrelations(Double_t PtCandMin, Double_t hME_Sideb[iPool]->Sumw2(); // rebin axes deltaEta and deltaPhi - if (fRebin2Dhisto) { + if (fRebinAngCorr) { hSE_Sign[iPool]->Rebin2D(fRebinAxisDeltaEta, fRebinAxisDeltaPhi); // Xaxis: deltaEta, Yaxis: deltaPhi hSE_Sideb[iPool]->Rebin2D(fRebinAxisDeltaEta, fRebinAxisDeltaPhi); hME_Sign[iPool]->Rebin2D(fRebinAxisDeltaEta, fRebinAxisDeltaPhi); @@ -178,30 +270,39 @@ Bool_t DhCorrelationExtraction::ExtractCorrelations(Double_t PtCandMin, Double_t if (fSubtractSoftPiME) { hME_Sideb_SoftPi[iPool]->Rebin2D(fRebinAxisDeltaEta, fRebinAxisDeltaPhi); } + std::cout << "SE and ME histograms rebinned" << std::endl; } if (fDebug >= 1) { - TCanvas* c = new TCanvas(Form("cSEME_Original_%d_%1.1fto%1.1f", iPool, PtHadMin, PtHadMax), Form("cSEME_Original_%s_pool%d_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), iPool, PtCandMin, PtCandMax, PtHadMin, PtHadMax), 100, 100, 1600, 900); - c->Divide(2, 2); + TCanvas* c = new TCanvas(Form("cSE_Original_%d_%1.1fto%1.1f", iPool, PtHadMin, PtHadMax), Form("cSE_Original_%s_pool%d_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), iPool, PtCandMin, PtCandMax, PtHadMin, PtHadMax), 100, 100, 1600, 900); + c->Divide(2, 1); c->cd(1); hSE_Sign[iPool]->SetMinimum(0); hSE_Sign[iPool]->Draw("lego2"); c->cd(2); - hME_Sign[iPool]->SetMinimum(0); - hME_Sign[iPool]->Draw("lego2"); - c->cd(3); hSE_Sideb[iPool]->SetMinimum(0); hSE_Sideb[iPool]->Draw("lego2"); - c->cd(4); + c->SaveAs(Form("Output_CorrelationExtraction_%s_png/CorrSE_Original_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + c->SaveAs(Form("Output_CorrelationExtraction_%s_Root/CorrSE_Original_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + } + + if (fDebug >= 1) { + TCanvas* c = new TCanvas(Form("cME_Original_%d_%1.1fto%1.1f", iPool, PtHadMin, PtHadMax), Form("cME_Original_%s_pool%d_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), iPool, PtCandMin, PtCandMax, PtHadMin, PtHadMax), 100, 100, 1600, 900); + c->Divide(2, 1); + c->cd(1); + hME_Sign[iPool]->SetMinimum(0); + hME_Sign[iPool]->Draw("lego2"); + c->cd(2); hME_Sideb[iPool]->SetMinimum(0); hME_Sideb[iPool]->Draw("lego2"); - c->SaveAs(Form("Output_CorrelationExtraction_%s_png/CorrSEandME_Original_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); - c->SaveAs(Form("Output_CorrelationExtraction_%s_Root/CorrSEandME_Original_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + c->SaveAs(Form("Output_CorrelationExtraction_%s_png/CorrME_Original_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + c->SaveAs(Form("Output_CorrelationExtraction_%s_Root/CorrME_Original_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); } // Scale bkg plots by ratio of signal region/sidebands hSE_Sideb[iPool]->Scale(fBkgScaleFactor); - hME_Sideb[iPool]->Scale(fBkgScaleFactor); + hME_Sideb[iPool]->Scale(fBkgScaleFactor); // when normalised this factor should cancel out + std::cout << "[INFO] fBkgScaleFactor = " << fBkgScaleFactor << std::endl; hSE_Sideb[iPool]->SetEntries(hSE_Sideb[iPool]->GetEntries() * fBkgScaleFactor); hME_Sideb[iPool]->SetEntries(hME_Sideb[iPool]->GetEntries() * fBkgScaleFactor); @@ -258,8 +359,8 @@ Bool_t DhCorrelationExtraction::ExtractCorrelations(Double_t PtCandMin, Double_t c->cd(6); hCorr_Sideb[iPool]->SetMinimum(0); hCorr_Sideb[iPool]->Draw("lego2"); - c->SaveAs(Form("Output_CorrelationExtraction_%s_png/CorrSEandME_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); - c->SaveAs(Form("Output_CorrelationExtraction_%s_Root/CorrSEandME_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + c->SaveAs(Form("Output_CorrelationExtraction_%s_png/CorrSEandME_%s_Canvas_PtCand%.0fto%.0f_Pool%d_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, iPool, PtHadMin, PtHadMax)); + c->SaveAs(Form("Output_CorrelationExtraction_%s_Root/CorrSEandME_%s_Canvas_PtCand%.0fto%.0f_Pool%d_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, iPool, PtHadMin, PtHadMax)); } // Pools integration @@ -288,6 +389,31 @@ Bool_t DhCorrelationExtraction::ExtractCorrelations(Double_t PtCandMin, Double_t c2D->SaveAs(Form("Output_CorrelationExtraction_%s_png/h2D_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); c2D->SaveAs(Form("Output_CorrelationExtraction_%s_Root/h2D_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + // Get FD correlations for FD subtraction + if (fFDsubtraction) { + h2D_FDTemplatePrompt = GetFDTemplateHisto(kPrompt, PtCandMin, PtCandMax, PtHadMin, PtHadMax); + h2D_FDTemplateNonPrompt = GetFDTemplateHisto(kFD, PtCandMin, PtCandMax, PtHadMin, PtHadMax); + // h1D_BaselineSubtr + FDPromptFrac = GetFDPromptFrac(PtCandMin, PtCandMax, PtHadMin, PtHadMax); + + if (fRebinFDCorr) { + h2D_FDTemplatePrompt->Rebin2D(fRebinAxisDeltaEta, fRebinAxisDeltaPhi); + h2D_FDTemplateNonPrompt->Rebin2D(fRebinAxisDeltaEta, fRebinAxisDeltaPhi); + } + + if (fDebug >= 1) { + TCanvas* c = new TCanvas(Form("cFDTemplate_PtCand%.0fto%.0f_PtHad%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax), Form("cFDTemplate_%s_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + c->Divide(2, 1); + c->cd(1); + h2D_FDTemplatePrompt->SetMinimum(0); + h2D_FDTemplatePrompt->Draw("lego2"); + c->cd(2); + h2D_FDTemplateNonPrompt->SetMinimum(0); + h2D_FDTemplateNonPrompt->Draw("lego2"); + c->SaveAs(Form("Output_CorrelationExtraction_%s_png/CorrFDTemplate_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + } + } + // Bkg subtraction (2D plot) TCanvas* c2D_Sub = new TCanvas(Form("c2D_Subtr_IntPools_PtHAd%.0fto%.0f", PtHadMin, PtHadMax), Form("c2D_%s_Subtr_IntPools_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), PtHadMin, PtHadMax), 100, 100, 1500, 800); h2D_Subtr = reinterpret_cast(h2D_Sign->Clone("h2D_Subtr")); @@ -315,7 +441,7 @@ Bool_t DhCorrelationExtraction::ExtractCorrelations(Double_t PtCandMin, Double_t h1D_Subtr->SetTitle("Signal region after sideb. subt. corr."); // Draw 1D plots (Signal region, Sidebands, S-SB (subtr.)) - TCanvas* c1D = new TCanvas(Form("c1D_IntPools_%.0fto%.0f", PtHadMin, PtHadMax), Form("c1D_%s_IntPools_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), PtHadMin, PtHadMax), 100, 100, 1600, 500); + TCanvas* c1D = new TCanvas(Form("c1D_IntPools_PtCand%.0fto%.0f_PtHad%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax), Form("c1D_%s_IntPools_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), PtHadMin, PtHadMax), 100, 100, 1600, 500); c1D->Divide(3, 1); c1D->cd(1); h1D_Sign->Draw(); @@ -326,20 +452,378 @@ Bool_t DhCorrelationExtraction::ExtractCorrelations(Double_t PtCandMin, Double_t c1D->SaveAs(Form("Output_CorrelationExtraction_%s_png/h1D_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); c1D->SaveAs(Form("Output_CorrelationExtraction_%s_Root/h1D_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + if (fDebug >= 1) { + h1D_SignNorm = reinterpret_cast(h1D_Sign->Clone("h1D_Sign_Norm")); + h1D_SidebNorm = reinterpret_cast(h1D_Sideb->Clone("h1D_Sideb_Norm")); + h1D_SignNorm->Scale(1. / (fSgnYieldNorm + fBkgYield)); + // h1D_SidebNorm -> Scale(1./fBkgYield); + h1D_SidebNorm->Scale(1. / fBkgScaleFactor); + h1D_SidebNorm->Scale(1. / fSBYield); + h1D_SignNorm->SetMarkerStyle(kFullCircle); + h1D_SignNorm->SetMarkerSize(1.2); + h1D_SignNorm->SetLineColor(kRed); + h1D_SignNorm->SetMarkerColor(kRed); + h1D_SignNorm->SetLineWidth(2); + h1D_SidebNorm->SetMinimum(0); + h1D_SidebNorm->SetMarkerStyle(kFullSquare); + h1D_SidebNorm->SetMarkerSize(1.2); + h1D_SidebNorm->SetLineColor(kBlue); + h1D_SidebNorm->SetMarkerColor(kBlue); + h1D_SidebNorm->SetLineWidth(2); + h1D_SidebNorm->SetTitle(Form("%.0f < p_{T} < %.0f", PtCandMin, PtCandMax)); + TCanvas* c = new TCanvas(Form("c_IntPools_PtCand%.0fto%.0f_PtHad%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax), ""); + c->cd(); + h1D_SidebNorm->Draw(); + h1D_SignNorm->Draw("same"); + c->SaveAs(Form("Output_CorrelationExtraction_%s_png/ComparisonSignalSidebCorr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + c->SaveAs(Form("Output_CorrelationExtraction_%s_Root/ComparisonSignalSidebCorr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + } // Apply normalization to number of triggers h1D_SubtrNorm = reinterpret_cast(h1D_Subtr->Clone("h1D_SubtrNorm")); h1D_SubtrNorm->Sumw2(); h1D_SubtrNorm->Scale(1. / fSgnYieldNorm); h1D_SubtrNorm->SetTitle("Signal region after sideb. subt. corr. - Normalized to # of triggers"); - fCorrectedCorrHisto = reinterpret_cast(h1D_SubtrNorm->Clone(Form("hCorrectedCorr_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax))); + // Correction for bias B to D topologies + if (fCorrBiasBtoD) { + hModul = EvaluateMCClosModulations(PtCandMin, PtCandMax, PtHadMin, PtHadMax); + TCanvas* c1D_corrBbias = new TCanvas(Form("c1D_corrBbias_IntPools_PtCand%.0fto%.0f_PtHad%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax), Form("c1D_corrBbias_%s_IntPools_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), PtHadMin, PtHadMax), 100, 100, 1600, 500); + c1D_corrBbias->cd(); + hBeforeModulCorr = reinterpret_cast(h1D_SubtrNorm->Clone("hBeforeModulCorr")); + hBeforeModulCorr->SetLineColor(kViolet - 3); + hBeforeModulCorr->GetYaxis()->SetRangeUser(0., 5.); + hBeforeModulCorr->Draw(); + h1D_SubtrNorm->Multiply(hModul); + h1D_SubtrNorm->Draw("same"); + c1D_corrBbias->SaveAs(Form("Output_CorrelationExtraction_%s_png/ComparisonCorrBiasBtoD_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + c1D_corrBbias->SaveAs(Form("Output_CorrelationExtraction_%s_Root/ComparisonCorrBiasBtoD_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + + TFile* file = new TFile(Form("Output_CorrelationExtraction_%s_Root/SystematicCorrBiasBtoD_%s_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax), "RECREATE"); // Open file in write mode + TH1D* h1D_SubtrNorm_Clone = reinterpret_cast(h1D_SubtrNorm->Clone("h1D_SubtrNorm_Clone")); + h1D_SubtrNorm_Clone = ReflectCorrHistogram(h1D_SubtrNorm_Clone); + hBeforeModulCorr = ReflectCorrHistogram(hBeforeModulCorr); + TH1D* hSystematicCorrBiasBtoD = reinterpret_cast(h1D_SubtrNorm_Clone->Clone("hSystematicCorrBiasBtoD")); + hSystematicCorrBiasBtoD->Add(h1D_SubtrNorm_Clone, hBeforeModulCorr, 1, -1); + // Set bin contents to absolute values + for (int i = 1; i <= hSystematicCorrBiasBtoD->GetNbinsX(); ++i) { + hSystematicCorrBiasBtoD->SetBinContent(i, std::abs(hSystematicCorrBiasBtoD->GetBinContent(i)) / TMath::Sqrt(12)); + hSystematicCorrBiasBtoD->SetBinError(i, 0.); + } + hSystematicCorrBiasBtoD->Write(); + file->Close(); + } + + // Secondary particle contamination + if (fSecPartContamination) { + h1D_PrimaryPartCorr = GetCorrelHistoSecondaryPart(kPrimaryPart, PtCandMin, PtCandMax, PtHadMin, PtHadMax); + h1D_AllPartCorr = GetCorrelHistoSecondaryPart(kAllPart, PtCandMin, PtCandMax, PtHadMin, PtHadMax); + h1D_PrimaryPartCorr->Sumw2(); + h1D_AllPartCorr->Sumw2(); + if (fRebinSecPart) { + h1D_PrimaryPartCorr->RebinX(fRebinAxisDeltaPhi); // Xaxis: deltaPhi + h1D_AllPartCorr->RebinX(fRebinAxisDeltaPhi); + std::cout << "Secondary particle histogram rebinned" << std::endl; + } + h1D_SecPartFrac = reinterpret_cast(h1D_PrimaryPartCorr->Clone(Form("hCorrRatio_PtD%.0fto%.0f_PtHad%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax))); + h1D_SecPartFrac->Sumw2(); + h1D_SecPartFrac->Divide(h1D_PrimaryPartCorr, h1D_AllPartCorr, 1., 1., "B"); + + TCanvas* c1D = new TCanvas(Form("c1D_CorrPrimaryPart_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax), Form("c1D_%s_CorrPrimaryPart_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), PtHadMin, PtHadMax)); + c1D->cd(); + SetTH1HistoStyle(h1D_SecPartFrac, Form("%.0f < p_{T} < %.0f GeV/c", PtCandMin, PtCandMax), "#Delta#phi [rad]", "#frac{primary part.}{part. selected}"); + h1D_SecPartFrac->Draw(); + c1D->SaveAs(Form("Output_CorrelationExtraction_%s_png/CorrPrimaryPartRatio_%s_Canvas_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + c1D->SaveAs(Form("Output_CorrelationExtraction_%s_Root/CorrPrimaryPartRatio_%s_Canvas_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + + h1D_SubtrNorm_SecPart = reinterpret_cast(h1D_SubtrNorm->Clone("h1D_SubtrNorm_SecPart")); + h1D_SubtrNorm_SecPart->Sumw2(); + Int_t nBinsPhi = h1D_SubtrNorm_SecPart->GetNbinsX(); + if (nBinsPhi != h1D_SecPartFrac->GetNbinsX()) { + std::cout << "[ERROR]: nBinsPhi different between h1D_SubtrNorm and h1D_SecPartFrac" << std::endl; + return kFALSE; + } + h1D_SubtrNorm_SecPart->Multiply(h1D_SecPartFrac); + } + + // FD Subtraction + if (fFDsubtraction) { + h1D_FDTemplatePrompt = reinterpret_cast(h2D_FDTemplatePrompt->ProjectionY("h1D_FDTemplatePrompt")); + h1D_FDTemplateNonPrompt = reinterpret_cast(h2D_FDTemplateNonPrompt->ProjectionY("h1D_FDTemplateNonPrompt")); + + h1D_FDTemplatePrompt->Scale(1. / h1D_FDTemplatePrompt->GetXaxis()->GetBinWidth(1)); + h1D_FDTemplateNonPrompt->Scale(1. / h1D_FDTemplateNonPrompt->GetXaxis()->GetBinWidth(1)); + + h1D_TemplateTotal = reinterpret_cast(h1D_FDTemplatePrompt->Clone("h1D_TemplateTotal")); + h1D_TemplateTotal->Sumw2(); + h1D_TemplateTotal->Scale(FDPromptFrac); + h1D_TemplateTotal->Add(h1D_FDTemplateNonPrompt, 1 - FDPromptFrac); + + if (fDebug >= 1) { + TCanvas* c = new TCanvas(Form("cFDTemplate_1D_%1.1fto%1.1f", PtHadMin, PtHadMax), Form("cFDTemplate_%s_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + c->cd(); + h1D_TemplateTotal->SetMinimum(0); + h1D_FDTemplateNonPrompt->SetMinimum(0); + h1D_TemplateTotal->SetMarkerColor(kGreen); + h1D_TemplateTotal->SetLineColor(kGreen); + h1D_TemplateTotal->SetLineWidth(2); + h1D_TemplateTotal->SetMarkerStyle(kFullCircle); + h1D_FDTemplatePrompt->SetMarkerColor(kRed); + h1D_FDTemplatePrompt->SetLineColor(kRed); + h1D_FDTemplatePrompt->SetLineWidth(2); + h1D_FDTemplatePrompt->SetMarkerStyle(kFullCircle); + h1D_FDTemplateNonPrompt->SetMarkerColor(kBlue); + h1D_FDTemplateNonPrompt->SetLineColor(kBlue); + h1D_FDTemplateNonPrompt->SetLineWidth(2); + h1D_FDTemplateNonPrompt->SetMarkerStyle(kFullCircle); + h1D_FDTemplateNonPrompt->Draw(); + h1D_FDTemplatePrompt->Draw("same"); + h1D_TemplateTotal->Draw("same"); + TLegend* lFD = new TLegend(); + lFD->AddEntry(h1D_TemplateTotal, "Total template"); + lFD->AddEntry(h1D_FDTemplatePrompt, "Prompt Template"); + lFD->AddEntry(h1D_FDTemplateNonPrompt, "Non prompt template"); + lFD->Draw("same"); + c->SaveAs(Form("Output_CorrelationExtraction_%s_png/CorrFDTemplate_1D_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + c->SaveAs(Form("Output_CorrelationExtraction_%s_Root/CorrFDTemplate_1D_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + } + + Double_t BaselineFD = CalculateBaseline(h1D_TemplateTotal, kTRUE); + Double_t BaselineData; + if (fSecPartContamination) { + BaselineData = CalculateBaseline(h1D_SubtrNorm_SecPart, kTRUE); + } else { + BaselineData = CalculateBaseline(h1D_SubtrNorm, kTRUE); + } + + std::cout << "===================== " << std::endl; + std::cout << "Baseline FD: " << BaselineFD << std::endl; + std::cout << "Baseline Data: " << BaselineData << std::endl; + std::cout << "===================== " << std::endl; + std::cout << " " << std::endl; + + Double_t Baselinediff = BaselineData - BaselineFD; + TH1D* hBaselineDiff = reinterpret_cast(h1D_FDTemplateNonPrompt->Clone("hBaselineDiff")); + for (int iBin = 0; iBin < hBaselineDiff->GetNbinsX(); iBin++) { + hBaselineDiff->SetBinContent(iBin + 1, Baselinediff); + } + h1D_FDTemplateNonPrompt->Add(hBaselineDiff); + h1D_TemplateTotal->Add(hBaselineDiff); + if (fSecPartContamination) { + h1D_SubtrFDNorm = reinterpret_cast(h1D_SubtrNorm_SecPart->Clone("h1D_SubtrFDNorm")); + } else { + h1D_SubtrFDNorm = reinterpret_cast(h1D_SubtrNorm->Clone("h1D_SubtrFDNorm")); + } + h1D_FDTemplateNonPrompt->Scale(1 - FDPromptFrac); + h1D_SubtrFDNorm->Add(h1D_FDTemplateNonPrompt, -1); + h1D_SubtrFDNorm->Scale(1. / FDPromptFrac); + + if (fDebug >= 1) { + TCanvas* c1 = new TCanvas(Form("cFDTemplateSubtr_%1.1fto%1.1f", PtHadMin, PtHadMax), Form("cFDTemplateSubtr_%s_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax), 100, 100, 1600, 900); + c1->cd(); + h1D_SubtrNorm->SetLineColor(kRed); + h1D_SubtrNorm_SecPart->SetLineColor(kOrange); + h1D_FDTemplateNonPrompt->SetLineColor(kBlue); + h1D_SubtrFDNorm->SetLineColor(kGreen); + h1D_TemplateTotal->SetLineColor(kMagenta); + h1D_SubtrNorm->SetMinimum(0); + h1D_SubtrNorm_SecPart->SetMinimum(0); + h1D_FDTemplateNonPrompt->SetMinimum(0); + h1D_SubtrFDNorm->SetMinimum(0); + // h1D_SubtrNorm -> GetYaxis() -> SetRangeUser(0., 8.); + h1D_SubtrNorm->SetMarkerStyle(kFullCircle); + h1D_SubtrNorm->SetMarkerSize(1.2); + h1D_SubtrNorm->SetMarkerColor(kRed); + h1D_SubtrNorm->SetLineWidth(2); + h1D_SubtrNorm_SecPart->SetMarkerStyle(kFullCircle); + h1D_SubtrNorm_SecPart->SetMarkerSize(1.2); + h1D_SubtrNorm_SecPart->SetMarkerColor(kOrange); + h1D_SubtrNorm_SecPart->SetLineWidth(2); + h1D_SubtrFDNorm->SetMarkerStyle(kFullCircle); + h1D_SubtrFDNorm->SetMarkerSize(1.2); + h1D_SubtrFDNorm->SetMarkerColor(kGreen); + h1D_SubtrFDNorm->SetLineWidth(2); + h1D_SubtrNorm->GetYaxis()->SetTitle("#frac{1}{N_{D}} #frac{dN^{assoc. part}}{d#Delta#phi}"); + h1D_SubtrNorm_SecPart->GetYaxis()->SetTitle("#frac{1}{N_{D}} #frac{dN^{assoc. part}}{d#Delta#phi}"); + if (fSecPartContamination) { + h1D_SubtrNorm_SecPart->Draw(); + } else { + h1D_SubtrNorm->Draw(); + } + // h1D_FDTemplateNonPrompt -> Draw("same"); + h1D_SubtrFDNorm->Draw("same"); + h1D_TemplateTotal->Draw("same"); + c1->SaveAs(Form("Output_CorrelationExtraction_%s_png/CorrFDTemplateSubtr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + c1->SaveAs(Form("Output_CorrelationExtraction_%s_Root/CorrFDTemplateSubtr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + } + } + + if (fFDsubtraction) { + fCorrectedCorrHisto = reinterpret_cast(h1D_SubtrFDNorm->Clone(Form("hCorrectedCorr_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax))); + } else if (fSecPartContamination) { + fCorrectedCorrHisto = reinterpret_cast(h1D_SubtrNorm_SecPart->Clone(Form("hCorrectedCorr_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax))); + } else { + fCorrectedCorrHisto = reinterpret_cast(h1D_SubtrNorm->Clone(Form("hCorrectedCorr_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax))); + } + + std::cout << "Analysis steps completed - baseline subtraction missing" << std::endl; // Draw 1D plots (Signal region, normalized) TCanvas* cFinal = new TCanvas(Form("cFinal_%.0fto%.0f", PtHadMin, PtHadMax), Form("cFinal_%s_IntPools_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), PtHadMin, PtHadMax), 100, 100, 1200, 700); + h1D_SubtrNorm->SetLineColor(kBlue + 1); + h1D_SubtrNorm->SetMarkerColor(kBlue + 1); + h1D_SubtrNorm->SetMarkerStyle(kFullCircle); + h1D_SubtrNorm->SetMinimum(0); h1D_SubtrNorm->Draw(); + if (fSecPartContamination) { + h1D_SubtrNorm_SecPart->SetLineColor(kRed + 1); + h1D_SubtrNorm_SecPart->SetMarkerColor(kRed + 1); + h1D_SubtrNorm_SecPart->SetMarkerStyle(kFullCircle); + h1D_SubtrNorm_SecPart->Draw("same"); + } + if (fFDsubtraction) { + h1D_SubtrFDNorm->SetLineColor(kGreen + 2); + h1D_SubtrFDNorm->SetMarkerColor(kGreen + 2); + h1D_SubtrFDNorm->SetMarkerStyle(kFullCircle); + h1D_SubtrFDNorm->Draw("same"); + } + if (fFDsubtraction) + h1D_TemplateTotal->Draw("same"); + TLegend* lFinal = new TLegend(); + lFinal->AddEntry(h1D_SubtrNorm, "Corr. after bkg subtr."); + if (fFDsubtraction) + lFinal->AddEntry(h1D_TemplateTotal, "CR Mode 2 total template"); + if (fSecPartContamination) { + lFinal->AddEntry(h1D_SubtrNorm_SecPart, "Corr. after sec. part. correction"); + } + if (fFDsubtraction) { + lFinal->AddEntry(h1D_SubtrFDNorm, "Corr. FD subtr."); + } + lFinal->Draw("same"); cFinal->SaveAs(Form("Output_CorrelationExtraction_%s_png/AzimCorrDistr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); cFinal->SaveAs(Form("Output_CorrelationExtraction_%s_Root/AzimCorrDistr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + // Baseline subtraction + Double_t BaselineData, BaselineDataErr; + TH1D* hBaseline = reinterpret_cast(h1D_SubtrNorm->Clone("hBaseline")); + hBaseline->Sumw2(); + if (fFDsubtraction) { + BaselineData = CalculateBaseline(h1D_SubtrFDNorm, kTRUE, kFALSE); // introduced kFALSE + BaselineDataErr = CalculateBaselineError(h1D_SubtrFDNorm, kTRUE, kFALSE); + for (int iBin = 0; iBin < hBaseline->GetNbinsX(); iBin++) { + hBaseline->SetBinContent(iBin + 1, BaselineData); + hBaseline->SetBinError(iBin + 1, BaselineDataErr); + } + h1D_BaselineSubtr = reinterpret_cast(h1D_SubtrFDNorm->Clone("h1D_BaselineSubtr")); + h1D_BaselineSubtr->Add(hBaseline, -1.); + } else if (fSecPartContamination) { + BaselineData = CalculateBaseline(h1D_SubtrNorm_SecPart, kTRUE, kFALSE); + BaselineDataErr = CalculateBaselineError(h1D_SubtrNorm_SecPart, kTRUE, kFALSE); + for (int iBin = 0; iBin < hBaseline->GetNbinsX(); iBin++) { + hBaseline->SetBinContent(iBin + 1, BaselineData); + hBaseline->SetBinError(iBin + 1, BaselineDataErr); + } + h1D_BaselineSubtr = reinterpret_cast(h1D_SubtrNorm_SecPart->Clone("h1D_BaselineSubtr")); + h1D_BaselineSubtr->Add(hBaseline, -1.); + } else { + BaselineData = CalculateBaseline(h1D_SubtrNorm, kTRUE, kFALSE); + BaselineDataErr = CalculateBaselineError(h1D_SubtrNorm, kTRUE, kFALSE); + for (int iBin = 0; iBin < hBaseline->GetNbinsX(); iBin++) { + hBaseline->SetBinContent(iBin + 1, BaselineData); + hBaseline->SetBinError(iBin + 1, BaselineDataErr); + } + h1D_BaselineSubtr = reinterpret_cast(h1D_SubtrNorm->Clone("h1D_BaselineSubtr")); + h1D_BaselineSubtr->Add(hBaseline, -1.); + } + + fCorrectedCorrHisto_BaselineSubtr = reinterpret_cast(h1D_BaselineSubtr->Clone(Form("hCorrectedCorrBaselineSubtr_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax))); + + TCanvas* cFinal_BaselineSubtr = new TCanvas(Form("cFinal_BaselineSubtr_%.0fto%.0f", PtHadMin, PtHadMax), Form("cFinal_BaselineSubtr_%s_IntPools_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), PtHadMin, PtHadMax), 100, 100, 1200, 700); + h1D_BaselineSubtr->SetMarkerColor(kOrange + 8); + h1D_BaselineSubtr->SetLineColor(kOrange + 8); + h1D_BaselineSubtr->GetYaxis()->SetRangeUser(-0.2, 8.); + h1D_BaselineSubtr->Draw(); + if (fFDsubtraction) { + h1D_SubtrFDNorm->Draw("same"); + } else if (fSecPartContamination) { + h1D_SubtrNorm_SecPart->Draw("same"); + } else { + h1D_SubtrNorm->Draw("same"); + } + hBaseline->SetMarkerColor(kPink - 6); + hBaseline->SetMarkerStyle(kFullSquare); + hBaseline->SetLineColor(kPink - 6); + hBaseline->Draw("same"); + + cFinal_BaselineSubtr->SaveAs(Form("Output_CorrelationExtraction_%s_png/AzimCorrDistr_BaselineSubtr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + cFinal_BaselineSubtr->SaveAs(Form("Output_CorrelationExtraction_%s_Root/AzimCorrDistr_BaselineSubtr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + + // Reflected histograms + if (fFDsubtraction) { + h1D_ReflCorr = ReflectCorrHistogram(h1D_SubtrFDNorm); + } else if (fSecPartContamination) { + h1D_ReflCorr = ReflectCorrHistogram(h1D_SubtrNorm_SecPart); + } else { + h1D_ReflCorr = ReflectCorrHistogram(h1D_SubtrNorm); + } + + /* used as control using Run2 reflection function + if (fFDsubtraction) { + h1D_ReflCorr = ReflectHistoRun2(h1D_SubtrFDNorm, 0.5); + } else if (fSecPartContamination) { + h1D_ReflCorr = ReflectHistoRun2(h1D_SubtrNorm_SecPart, 0.5); + } else { + h1D_ReflCorr = ReflectHistoRun2(h1D_SubtrNorm, 0.5); + }*/ + + TCanvas* cFinal_Reflected = new TCanvas(Form("cFinal_Reflected_%.0fto%.0f", PtHadMin, PtHadMax), Form("cFinal_Reflected_%s_IntPools_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), PtHadMin, PtHadMax), 100, 100, 1200, 700); + cFinal_Reflected->cd(); + SetTH1HistoStyle(h1D_ReflCorr, Form("%.0f < p_{T} < %.0f GeV/c", PtCandMin, PtCandMax), "#Delta#phi [rad]", "#frac{1}{N_{D}}#frac{dN^{assoc}}{d#Delta#phi} [rad^{-1}]", kFullCircle, kOrange + 8, 1.6, kOrange + 8, 3); + h1D_ReflCorr->SetMinimum(0); + h1D_ReflCorr->Draw(); + cFinal_Reflected->SaveAs(Form("Output_CorrelationExtraction_%s_png/AzimCorrDistr_Reflected_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + cFinal_Reflected->SaveAs(Form("Output_CorrelationExtraction_%s_Root/AzimCorrDistr_Reflected_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + + // Reflected histograms baseline subtracted + TH1D* hBaseline_Refl = reinterpret_cast(h1D_ReflCorr->Clone("hBaseline_Refl")); + hBaseline_Refl->Sumw2(); + BaselineData = CalculateBaseline(h1D_ReflCorr, kFALSE, kTRUE); + BaselineDataErr = CalculateBaselineError(h1D_ReflCorr, kFALSE, kTRUE); + + for (int iBin = 0; iBin < hBaseline_Refl->GetNbinsX(); iBin++) { + hBaseline_Refl->SetBinContent(iBin + 1, BaselineData); + hBaseline_Refl->SetBinError(iBin + 1, BaselineDataErr); + } + h1D_ReflCorr_BaselineSubtr = reinterpret_cast(h1D_ReflCorr->Clone("h1D_ReflCorr_BaselineSubtr")); + h1D_ReflCorr_BaselineSubtr->Sumw2(); + h1D_ReflCorr_BaselineSubtr->Add(hBaseline_Refl, -1.); + + TF1* fConstZero = new TF1("fConstZero", "[0]", 0., TMath::Pi()); + fConstZero->SetParameter(0, 0.); + fConstZero->SetLineColor(kMagenta); + fConstZero->SetLineStyle(9); + fConstZero->SetLineWidth(4); + fConstZero->SetTitle(""); + + TCanvas* cFinal_Reflected_BaselineSubtr = new TCanvas(Form("cFinal_Reflected_BaselineSubtr_%.0fto%.0f", PtHadMin, PtHadMax), Form("cFinal_Reflected_BaselineSubtr_%s_IntPools_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), PtHadMin, PtHadMax), 100, 100, 1200, 700); + SetTH1HistoStyle(h1D_ReflCorr_BaselineSubtr, Form("%.0f < p_{T} < %.0f GeV/c", PtCandMin, PtCandMax), "#Delta#phi [rad]", "#frac{1}{N_{D}}#frac{dN^{assoc}}{d#Delta#phi} [rad^{-1}]", kFullCircle, kRed + 1, 1.6, kRed + 1, 3); + hBaseline_Refl->SetMarkerColor(kOrange); + hBaseline_Refl->SetMarkerStyle(kFullSquare); + hBaseline_Refl->SetLineColor(kOrange); + cFinal_Reflected_BaselineSubtr->cd(); + h1D_ReflCorr->SetMinimum(-0.8); + h1D_ReflCorr->SetStats(0); + hBaseline_Refl->SetStats(0); + h1D_ReflCorr->Draw(); + hBaseline_Refl->Draw("same"); + h1D_ReflCorr_BaselineSubtr->SetStats(0); + h1D_ReflCorr_BaselineSubtr->Draw("same"); // then keep just this + fConstZero->Draw("same"); + cFinal_Reflected_BaselineSubtr->SaveAs(Form("Output_CorrelationExtraction_%s_png/AzimCorrDistr_Reflected_BaselineSubtr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + cFinal_Reflected_BaselineSubtr->SaveAs(Form("Output_CorrelationExtraction_%s_Root/AzimCorrDistr_Reflected_BaselineSubtr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + + fCorrectedCorrHisto_Reflected = reinterpret_cast(h1D_ReflCorr->Clone(Form("hCorrectedCorrReflected_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax))); + fCorrectedCorrHisto_Reflected_BaselineSubtr = reinterpret_cast(h1D_ReflCorr_BaselineSubtr->Clone(Form("hCorrectedCorrReflected_BaselineSubtr_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax))); + return kTRUE; } @@ -394,26 +878,194 @@ Bool_t DhCorrelationExtraction::ReadInputInvMass() return kTRUE; } +Bool_t DhCorrelationExtraction::ReadInputFDSubtr() +{ + + fFileFDTemplate = TFile::Open(fFileFDTemplateName.Data()); + fFileFDPromptFrac = TFile::Open(fFileFDPromptFracName.Data()); + if (!fFileFDTemplate) { + std::cout << "[ERROR] File " << fFileFDTemplateName << " cannot be opened! check your file path!" << std::endl; + return kFALSE; + } + if (!fFileFDPromptFrac) { + std::cout << "[ERROR] File " << fFileFDPromptFracName << " cannot be opened! check your file path!" << std::endl; + return kFALSE; + } + + std::cout << "===================== " << std::endl; + std::cout << "Read inputs FD template" << std::endl; + std::cout << "TFile FD template = " << fFileFDTemplateName << std::endl; + std::cout << "TFile FD Prompt Frac = " << fFileFDPromptFracName << std::endl; + std::cout << "Histo FD template Prompt = " << fHistoFDTemplatePromptName << std::endl; + std::cout << "Histo FD template Non Prompt = " << fHistoFDTemplateNonPromptName << std::endl; + std::cout << "Histo FD Prompt Frac = " << fHistoFDPromptFracName << std::endl; + std::cout << "===================== " << std::endl; + std::cout << " " << std::endl; + + return kTRUE; +} + +Bool_t DhCorrelationExtraction::ReadInputSecondaryPartContamination() +{ + + fFileSecPart = TFile::Open(fFileSecPartName.Data()); + if (!fFileSecPart) { + std::cout << "[ERROR] File " << fFileSecPartName << " cannot be opened! check your file path!" << std::endl; + return kFALSE; + } + + fDirSecPart = reinterpret_cast(fFileSecPart->Get(fDirSecPartName.Data())); + + if (!fDirSecPart) { + std::cout << "[ERROR] Directory " << fDirSecPart << " cannot be opened! check your file path!" << std::endl; + return kFALSE; + } + + std::cout << "===================== " << std::endl; + std::cout << "Read inputs SE and ME" << std::endl; + std::cout << "TFile Sec. part. = " << fFileSecPartName << std::endl; + std::cout << "TDir Sec. part. = " << fDirSecPartName << std::endl; + std::cout << "===================== " << std::endl; + std::cout << " " << std::endl; + + return kTRUE; +} + +TH1D* DhCorrelationExtraction::EvaluateMCClosModulations(Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax) +{ + + TH1D* hModul = new TH1D(); + + fFilePromptMc = TFile::Open(fFilePromptMcRecName.Data()); + fFileNonPromptMc = TFile::Open(fFileNonPromptMcRecName.Data()); + + if (!fFilePromptMc) { + std::cout << "[ERROR] File prompt MC rec cannot be opened! check your file path!" << std::endl; + } + if (!fFileNonPromptMc) { + std::cout << "[ERROR] File non-prompt MC rec cannot be opened! check your file path!" << std::endl; + } + + // TODO: generalise this part + TH1D* hRecPrompt = reinterpret_cast(fFilePromptMc->Get(Form("h1D_Rec_iPtD%d_iPtAssoc%d", fBinPtCand, fBinPtHad))); + TH1D* hRecNonPrompt = reinterpret_cast(fFileNonPromptMc->Get(Form("h1D_Rec_iPtD%d_iPtAssoc%d", fBinPtCand, fBinPtHad))); + TH1D* hGenPrompt = reinterpret_cast(fFilePromptMc->Get(Form("h1D_Gen_iPtD%d_iPtAssoc%d", fBinPtCand, fBinPtHad))); + TH1D* hGenNonPrompt = reinterpret_cast(fFileNonPromptMc->Get(Form("h1D_Gen_iPtD%d_iPtAssoc%d", fBinPtCand, fBinPtHad))); + + printf("[INFO] Bin cand %d - Bin had %d \n", fBinPtCand, fBinPtHad); + + // hRecPrompt = ReflectCorrHistogram(hRecPrompt); + // hRecNonPrompt = ReflectCorrHistogram(hRecNonPrompt); + // hGenPrompt = ReflectCorrHistogram(hGenPrompt); + // hGenNonPrompt = ReflectCorrHistogram(hGenNonPrompt); + + hRecNonPrompt->Sumw2(); + hRecNonPrompt->Sumw2(); + hGenPrompt->Sumw2(); + hGenNonPrompt->Sumw2(); + + TH1D* hRatioNonPrompt = reinterpret_cast(hRecNonPrompt->Clone("hRatioNonPrompt")); + hRatioNonPrompt->Sumw2(); + hRatioNonPrompt->Divide(hRecNonPrompt, hGenNonPrompt, 1., 1., "B"); + hModul = reinterpret_cast(hRatioNonPrompt->Clone("hModul")); + + TF1* funFit = new TF1("funFit", "[0]", TMath::Pi() * 3. / 8., TMath::Pi() * 3 / 2); + hRatioNonPrompt->Fit(funFit, "R"); + Double_t fitVal = funFit->GetParameter(0); + + TCanvas* cRatio_MCClosure = new TCanvas(Form("cRatio_MCClosure_PtCand%.0fto%.0f_Pthad%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax), Form("cRatio_MCClosure_PtCand%.0fto%.0f_Pthad%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax), 100, 100, 1200, 700); + cRatio_MCClosure->cd(); + hRatioNonPrompt->GetYaxis()->SetRangeUser(0.2, 1.8); + hRatioNonPrompt->Draw(); + + Double_t FPrompt = GetFDPromptFrac(PtCandMin, PtCandMax, PtHadMin, PtHadMax); + Double_t relAmplC[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + Double_t relAmplB[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + Double_t recoKineVal[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + Double_t modul[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + + for (int iBin = 0; iBin < hRatioNonPrompt->GetNbinsX(); iBin++) { + if (iBin > 1 && iBin < 13) { + recoKineVal[iBin - 2] = hRatioNonPrompt->GetBinContent(iBin + 1) - (fitVal - 1); + relAmplC[iBin - 2] = hRecPrompt->GetBinContent(iBin + 1) / (hRecPrompt->GetBinContent(iBin + 1) * FPrompt + hRecNonPrompt->GetBinContent(iBin + 1) * (1 - FPrompt)); + relAmplB[iBin - 2] = hRecNonPrompt->GetBinContent(iBin + 1) / (hRecPrompt->GetBinContent(iBin + 1) * FPrompt + hRecNonPrompt->GetBinContent(iBin + 1) * (1 - FPrompt)); + modul[iBin - 2] = relAmplC[iBin - 2] * FPrompt + relAmplB[iBin - 2] * (1 - FPrompt) / recoKineVal[iBin - 2]; + hModul->SetBinContent(iBin + 1, modul[iBin - 2]); + hModul->SetBinError(iBin + 1, 0.); + + printf("[INFO] Bin%d MODUL = %1.5f\t (Reco/Kine-fitVal = %1.4f, FPrompt = %1.3f, Ampl_ratio C,B = %1.4f, %1.4f)\n", iBin + 1, modul[iBin - 2], recoKineVal[iBin - 2], FPrompt, relAmplC[iBin - 2], relAmplB[iBin - 2]); + } else { + hModul->SetBinContent(iBin + 1, 1.); + hModul->SetBinError(iBin + 1, 0.); + } + } + + hModul->SetLineColor(kMagenta); + hModul->Draw("same"); + + cRatio_MCClosure->SaveAs(Form("Output_CorrelationExtraction_Thin2023_FullAnalysis_CentralPoints_png/Ratio_MCClosure_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + + return hModul; +} + TH2D* DhCorrelationExtraction::GetCorrelHisto(Int_t SEorME, Int_t SorSB, Int_t pool, Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax) { // TODO: Subtraction of softpion TH2D* h2D = new TH2D(); // pointer to be returned THnSparseD* hSparse = 0x0; - if (SEorME == kSE) { // Same Event if (SorSB == kSign) { hSparse = reinterpret_cast(fDirSE->Get(fSECorrelSignalRegionName.Data())); - } else { + } else if (!fSidebandDivided) { hSparse = reinterpret_cast(fDirSE->Get(fSECorrelSidebandsName.Data())); + } else if (fSidebandDivided) { + if (fUseSidebLeft && !fUseSidebRight) { + hSparse = reinterpret_cast(fDirSE->Get(fSECorrelSidebandLeftName.Data())); + } else if (!fUseSidebLeft && fUseSidebRight) { + hSparse = reinterpret_cast(fDirSE->Get(fSECorrelSidebandRightName.Data())); + } else if (fUseSidebLeft && fUseSidebRight) { + hSparse = reinterpret_cast(fDirSE->Get(fSECorrelSidebandLeftName.Data())); + hSparse->SetName("hSparse"); + THnSparseD* hSparseRightSideb = reinterpret_cast(fDirSE->Get(fSECorrelSidebandRightName.Data())); + hSparse->Add(hSparseRightSideb, 1.); + } } } else { // Mixed Event if (SorSB == kSign) { hSparse = reinterpret_cast(fDirME->Get(fMECorrelSignalRegionName.Data())); - } else { + } else if (!fSidebandDivided) { hSparse = reinterpret_cast(fDirME->Get(fMECorrelSidebandsName.Data())); + } else if (fSidebandDivided) { + if (fUseSidebLeft && !fUseSidebRight) { + hSparse = reinterpret_cast(fDirME->Get(fMECorrelSidebandLeftName.Data())); + } else if (!fUseSidebLeft && fUseSidebRight) { + hSparse = reinterpret_cast(fDirME->Get(fMECorrelSidebandRightName.Data())); + } else if (fUseSidebLeft && fUseSidebRight) { + hSparse = reinterpret_cast(fDirME->Get(fMECorrelSidebandLeftName.Data())); + hSparse->SetName("hSparse"); + THnSparseD* hSparseRightSideb = reinterpret_cast(fDirME->Get(fMECorrelSidebandRightName.Data())); + hSparse->Add(hSparseRightSideb, 1.); + } } } + /*else if (fSidebandDivided) { // Mixed Event + if (SorSB == kSign) { hSparse = reinterpret_cast fDirME -> Get(fMECorrelSignalRegionName.Data()); + } else if (!fSidebandDivided) { hSparse = reinterpret_cast fDirME -> Get(fMECorrelSidebandsName.Data()); + } else { + if (fUseSidebLeft && !fUseSidebRight) { + hSparse = reinterpret_cast fDirME -> Get(fMECorrelSidebandLeftName.Data()); + } else if (!fUseSidebLeft && fUseSidebRight) { + hSparse = reinterpret_cast fDirME -> Get(fMECorrelSidebandRightName.Data()); + } else if (fUseSidebLeft && fUseSidebRight) { + hSparse = reinterpret_cast fDirME -> Get(fMECorrelSidebandLeftName.Data()); + hSparse -> SetName("hSparse"); + THnSparseD *hSparseRightSideb = reinterpret_cast fDirME -> Get(fMECorrelSidebandRightName.Data()); + hSparse -> Add(hSparseRightSideb, 1.); + } + } + }*/ + Int_t binExtPtCandMin = (Int_t)hSparse->GetAxis(2)->FindBin(PtCandMin + 0.01); // axis2: ptCand, the 0.01 to avoid bin edges! Int_t binExtPtCandMax = (Int_t)hSparse->GetAxis(2)->FindBin(PtCandMax - 0.01); Int_t binExtPtHadMin = (Int_t)hSparse->GetAxis(3)->FindBin(PtHadMin + 0.01); // axis3: ptHad @@ -421,12 +1073,11 @@ TH2D* DhCorrelationExtraction::GetCorrelHisto(Int_t SEorME, Int_t SorSB, Int_t p Int_t binExtPoolMin; Int_t binExtPoolMax; if (fCorrectPoolsSeparately) { - binExtPoolMin = (Int_t)hSparse->GetAxis(4)->FindBin(pool + 1.01); // axis4: pool bin - binExtPoolMax = (Int_t)hSparse->GetAxis(4)->FindBin(pool + 1.99); + binExtPoolMin = (Int_t)hSparse->GetAxis(4)->FindBin(pool + 0.01); // axis4: pool bin + binExtPoolMax = (Int_t)hSparse->GetAxis(4)->FindBin(pool + 0.99); } else { // merge all pools in one binExtPoolMin = 1; binExtPoolMax = (Int_t)hSparse->GetAxis(4)->GetNbins(); - // cout << "binExtPoolMax:" << binExtPoolMax <GetAxis(1)->FindBin(fDeltaEtaMin + 0.0001); @@ -435,24 +1086,38 @@ TH2D* DhCorrelationExtraction::GetCorrelHisto(Int_t SEorME, Int_t SorSB, Int_t p binExtEtaMax = hSparse->GetAxis(1)->GetNbins(); if (binExtEtaMin < 1) binExtEtaMin = 1; - hSparse->GetAxis(1)->SetRange(binExtEtaMin, binExtEtaMax); // axis1: deltaEta hSparse->GetAxis(2)->SetRange(binExtPtCandMin, binExtPtCandMax); // axis2: ptCand hSparse->GetAxis(3)->SetRange(binExtPtHadMin, binExtPtHadMax); // axis3: ptHad - // hSparse -> GetAxis(4) -> SetRange(binExtPoolMin, binExtPoolMax); // axis4: pool bin - - h2D = reinterpret_cast(hSparse->Projection(0, 1)); // axis0: deltaPhi, axis1: deltaEta - if (SEorME == kSE) { // Same Event + hSparse->GetAxis(4)->SetRange(binExtPoolMin, binExtPoolMax); // axis4: pool bin + h2D = reinterpret_cast(hSparse->Projection(0, 1)); // axis0: deltaPhi, axis1: deltaEta + if (SEorME == kSE) { // Same Event if (SorSB == kSign) { h2D->SetName(Form("hCorr_SE_Sig_2D_PtCandBin%d_PtHadBin%d_iPool%d", binExtPtCandMin, binExtPtHadMin, pool)); - } else { + } else if (!fSidebandDivided) { h2D->SetName(Form("hCorr_SE_Sideb_2D_PtCandBin%d_PtHadBin%d_iPool%d", binExtPtCandMin, binExtPtHadMin, pool)); + } else { + if (fUseSidebLeft && !fUseSidebRight) { + h2D->SetName(Form("hCorr_SE_Sideb_Left_2D_PtCandBin%d_PtHadBin%d_iPool%d", binExtPtCandMin, binExtPtHadMin, pool)); + } else if (!fUseSidebLeft && fUseSidebRight) { + h2D->SetName(Form("hCorr_SE_Sideb_Right_2D_PtCandBin%d_PtHadBin%d_iPool%d", binExtPtCandMin, binExtPtHadMin, pool)); + } else if (fUseSidebLeft && fUseSidebRight) { + h2D->SetName(Form("hCorr_SE_Sideb_LeftAndRight_2D_PtCandBin%d_PtHadBin%d_iPool%d", binExtPtCandMin, binExtPtHadMin, pool)); + } } } else { // Mixed Event if (SorSB == kSign) { h2D->SetName(Form("hCorr_ME_Sig_2D_PtCandBin%d_PtHadBin%d_iPool%d", binExtPtCandMin, binExtPtHadMin, pool)); + } else if (!fSidebandDivided) { + h2D->SetName(Form("hCorr_SE_Sideb_2D_PtCandBin%d_PtHadBin%d_iPool%d", binExtPtCandMin, binExtPtHadMin, pool)); } else { - h2D->SetName(Form("hCorr_ME_Sideb_2D_PtCandBin%d_PtHadBin%d_iPool%d", binExtPtCandMin, binExtPtHadMin, pool)); + if (fUseSidebLeft && !fUseSidebRight) { + h2D->SetName(Form("hCorr_ME_Sideb_Left_2D_PtCandBin%d_PtHadBin%d_iPool%d", binExtPtCandMin, binExtPtHadMin, pool)); + } else if (!fUseSidebLeft && fUseSidebRight) { + h2D->SetName(Form("hCorr_ME_Sideb_Right_2D_PtCandBin%d_PtHadBin%d_iPool%d", binExtPtCandMin, binExtPtHadMin, pool)); + } else if (fUseSidebLeft && fUseSidebRight) { + h2D->SetName(Form("hCorr_ME_Sideb_LeftAndRight_2D_PtCandBin%d_PtHadBin%d_iPool%d", binExtPtCandMin, binExtPtHadMin, pool)); + } } } @@ -466,6 +1131,8 @@ void DhCorrelationExtraction::GetSignalAndBackgroundForNorm(Double_t PtCandMin, TH1F* hMassFitSgnYield = reinterpret_cast(fFileMass->Get(fMassHistoNameSgn.Data())); TH1F* hMassFitBkgYield = reinterpret_cast(fFileMass->Get(fMassHistoNameBkg.Data())); TH1F* hMassFitSBsYield = reinterpret_cast(fFileMass->Get(fMassHistoNameSBs.Data())); + TH1F* hMassFitSBLYield = reinterpret_cast(fFileMass->Get("hBackgroundSidebandLeft")); + TH1F* hMassFitSBRYield = reinterpret_cast(fFileMass->Get("hBackgroundSidebandRight")); Int_t PtCandBin = hMassFitSgnYield->FindBin(PtCandMin + 0.01); if (PtCandBin != hMassFitSgnYield->FindBin(PtCandMax - 0.01)) @@ -474,6 +1141,8 @@ void DhCorrelationExtraction::GetSignalAndBackgroundForNorm(Double_t PtCandMin, Float_t SgnYield = hMassFitSgnYield->GetBinContent(PtCandBin); Float_t BkgYield = hMassFitBkgYield->GetBinContent(PtCandBin); Float_t SBsYield = hMassFitSBsYield->GetBinContent(PtCandBin); + Float_t SBLYield = hMassFitSBLYield->GetBinContent(PtCandBin); + Float_t SBRYield = hMassFitSBRYield->GetBinContent(PtCandBin); std::cout << "================================= " << std::endl; std::cout << "Getting invariant mass parameters " << std::endl; @@ -481,20 +1150,193 @@ void DhCorrelationExtraction::GetSignalAndBackgroundForNorm(Double_t PtCandMin, std::cout << "Signal yield = " << SgnYield << std::endl; std::cout << "Bkg yield = " << BkgYield << std::endl; std::cout << "Sideband yield = " << SBsYield << std::endl; + std::cout << "Sideband left yield = " << SBLYield << std::endl; + std::cout << "Sideband right yield = " << SBRYield << std::endl; std::cout << "================================= " << std::endl; std::cout << " " << std::endl; SetSignalYieldforNorm(SgnYield); - SetBkgScaleFactor(BkgYield / SBsYield); + SetBkgYield(BkgYield); + if (fUseSidebLeft && fUseSidebRight) { + SetBkgScaleFactor(BkgYield / SBsYield); + SetSBYield(SBsYield); + } else if (fUseSidebLeft && !fUseSidebRight) { + SetBkgScaleFactor(BkgYield / SBLYield); + SetSBYield(SBLYield); + } else if (!fUseSidebLeft && fUseSidebRight) { + SetBkgScaleFactor(BkgYield / SBRYield); + SetSBYield(SBRYield); + } return; } +TH2D* DhCorrelationExtraction::GetFDTemplateHisto(Int_t PromptOrFD, Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax) +{ + + TH2D* h2D = new TH2D(); // pointer to be returned + + if (PromptOrFD == kPrompt) { + h2D = reinterpret_cast(fFileFDTemplate->Get(Form("%s%.0f_%.0f_ptassoc%.0f_%.0f", fHistoFDTemplatePromptName.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax))); + } else { + h2D = reinterpret_cast(fFileFDTemplate->Get(Form("%s%.0f_%.0f_ptassoc%.0f_%.0f", fHistoFDTemplateNonPromptName.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax))); + } + + Int_t binExtEtaMin = (Int_t)h2D->GetXaxis()->FindBin(fDeltaEtaMin + 0.000001); + Int_t binExtEtaMax = (Int_t)h2D->GetXaxis()->FindBin(fDeltaEtaMax - 0.000001); + if (binExtEtaMax > h2D->GetXaxis()->GetNbins()) + binExtEtaMax = h2D->GetXaxis()->GetNbins(); + if (binExtEtaMin < 1) + binExtEtaMin = 1; + + h2D->GetXaxis()->SetRange(binExtEtaMin, binExtEtaMax); + if (PromptOrFD == kPrompt) { + h2D->SetName(Form("hFDTemplatePrompt_2D_PtCand%.0fto%.0f_PtHad%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + } else { + h2D->SetName(Form("hFDTemplateNonPrompt_2D_PtCand%.0fto%.0f_PtHad%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + } + h2D->GetYaxis()->SetTitle("#Delta#phi (rad)"); + h2D->GetXaxis()->SetTitle("#Delta#eta"); + + return h2D; +} + +TH1D* DhCorrelationExtraction::GetCorrelHistoSecondaryPart(Int_t PartType, Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax) +{ + + TH1D* h1D = new TH1D(); // pointer to be returned + + THnSparseD* hSparse = 0x0; + + if (PartType == kPrimaryPart) { // primary particles + hSparse = reinterpret_cast(fDirSecPart->Get(fHistoPrimaryPartName.Data())); + } else { // all selected particles + hSparse = reinterpret_cast(fDirSecPart->Get(fHistoAllPartName.Data())); + } + Int_t binExtPtCandMin = (Int_t)hSparse->GetAxis(2)->FindBin(PtCandMin + 0.01); // axis2: ptCand, the 0.01 to avoid bin edges! + Int_t binExtPtCandMax = (Int_t)hSparse->GetAxis(2)->FindBin(PtCandMax - 0.01); + Int_t binExtPtHadMin = (Int_t)hSparse->GetAxis(3)->FindBin(PtHadMin + 0.01); // axis3: ptHad + Int_t binExtPtHadMax = (Int_t)hSparse->GetAxis(3)->FindBin(PtHadMax - 0.01); + Int_t binExtPoolMin; + Int_t binExtPoolMax; + if (PartType == kAllPart) { + binExtPoolMin = 1; + binExtPoolMax = (Int_t)hSparse->GetAxis(4)->GetNbins(); + } + // possibility to select a certain eta region + Int_t binExtEtaMin = (Int_t)hSparse->GetAxis(1)->FindBin(fDeltaEtaMin + 0.0001); + Int_t binExtEtaMax = (Int_t)hSparse->GetAxis(1)->FindBin(fDeltaEtaMax - 0.0001); + if (binExtEtaMax > hSparse->GetAxis(1)->GetNbins()) + binExtEtaMax = hSparse->GetAxis(1)->GetNbins(); + if (binExtEtaMin < 1) + binExtEtaMin = 1; + + hSparse->GetAxis(1)->SetRange(binExtEtaMin, binExtEtaMax); // axis1: deltaEta + hSparse->GetAxis(2)->SetRange(binExtPtCandMin, binExtPtCandMax); // axis2: ptCand + hSparse->GetAxis(3)->SetRange(binExtPtHadMin, binExtPtHadMax); // axis3: ptHad + if (PartType == kAllPart) { + hSparse->GetAxis(4)->SetRange(binExtPoolMin, binExtPoolMax); // axis4: pool bin + } + + h1D = reinterpret_cast(hSparse->Projection(0)); // axis0: deltaPhi + if (PartType == kPrimaryPart) { // primary particles + h1D->SetName(Form("hPrimaryPartCorr_PtD%.0fto%.0f_PtHad%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + } else { // all selected particles + h1D->SetName(Form("hAllPartCorr_PtD%.0fto%.0f_PtHad%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + } + + return h1D; +} + +TH1D* DhCorrelationExtraction::ReflectCorrHistogram(TH1D*& histo) +{ + + // nBinsPhi must be a multple of 4 in order to reflect correcty the histogram + Int_t nBinsPhi = histo->GetNbinsX(); + Int_t nBinsPhiRefl = nBinsPhi / 2; + Int_t bin0Phi = nBinsPhi / 4 + 1; + Int_t binPiPhi = 3 * nBinsPhi / 4; + + TH1D* h1D = new TH1D("h1D_Reflected", "", nBinsPhiRefl, 0., TMath::Pi()); // pointer to be returned + h1D->Sumw2(); + // TH1D* h1D = reinterpret_cast histo -> Clone("h1D_Reflected"); + // h1D -> GetXaxis() -> SetRange(bin0Phi, binPiPhi); + + // reflection + Double_t reflectedContent, reflectedContentError; + for (int iBin = 0; iBin < nBinsPhiRefl / 2; iBin++) { + reflectedContent = (histo->GetBinContent(bin0Phi - iBin - 1) + histo->GetBinContent(bin0Phi + iBin)) / 2; + std::cout << "[INFO] Paired bins for reflection: " << bin0Phi - iBin - 1 << " - " << bin0Phi + iBin << std::endl; + std::cout << "[INFO] Bin filled: " << iBin + 1 << std::endl; + reflectedContentError = 0.5 * TMath::Sqrt(TMath::Power(histo->GetBinError(iBin + 1), 2) + TMath::Power(histo->GetBinError(bin0Phi + iBin), 2)); + h1D->SetBinContent(iBin + 1, reflectedContent); + h1D->SetBinError(iBin + 1, reflectedContentError); + } + for (int iBin = nBinsPhiRefl / 2; iBin < nBinsPhiRefl; iBin++) { + reflectedContent = (histo->GetBinContent(bin0Phi + iBin) + histo->GetBinContent(binPiPhi + 2 * bin0Phi - iBin - 2)) / 2; + reflectedContentError = 0.5 * TMath::Sqrt(TMath::Power(histo->GetBinError(bin0Phi + iBin), 2) + TMath::Power(histo->GetBinError(binPiPhi + 2 * bin0Phi - iBin - 2), 2)); + std::cout << "[INFO] Paired bins for reflection: " << bin0Phi + iBin << " - " << binPiPhi + 2 * bin0Phi - iBin - 2 << std::endl; + std::cout << "[INFO] Bin filled: " << iBin + 1 << std::endl; + h1D->SetBinContent(iBin + 1, reflectedContent); + h1D->SetBinError(iBin + 1, reflectedContentError); + } + + return h1D; +} + +TH1D* DhCorrelationExtraction::ReflectHistoRun2(TH1D* h, Double_t scale) +{ + + TH1D* h2 = new TH1D(Form("%sReflected", h->GetName()), Form("%sReflected", h->GetName()), h->GetNbinsX() / 2., 0., TMath::Pi()); + for (Int_t j = 1; j <= h->GetNbinsX(); j++) { + Double_t x = h->GetBinCenter(j); + Double_t y0 = h->GetBinContent(j); + Double_t ey0 = h->GetBinError(j); + Int_t j2; + if (x > 0 && x < TMath::Pi()) { + j2 = h2->FindBin(x); + } else if (x < 0) { + j2 = h2->FindBin(-1. * x); + } else if (x > TMath::Pi()) { + j2 = h2->FindBin(2. * TMath::Pi() - x); + } else { + printf("Point %d excluded \n", j); + continue; + } + Double_t y = h2->GetBinContent(j2); + Double_t ey = h2->GetBinError(j2); + h2->SetBinContent(j2, (y + y0)); + h2->SetBinError(j2, TMath::Sqrt(ey0 * ey0 + ey * ey)); + } + h2->Scale(scale); + + return h2; +} + +Double_t DhCorrelationExtraction::GetFDPromptFrac(Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax) +{ + + TH1D* h1D = new TH1D(); + h1D = reinterpret_cast(fFileFDPromptFrac->Get(fHistoFDPromptFracName.Data())); + + Int_t binPtCandMin = h1D->GetXaxis()->FindBin(PtCandMin + 0.01); + Int_t binPtCandMax = h1D->GetXaxis()->FindBin(PtCandMax - 0.01); + Double_t PromptFraction; + if (binPtCandMin == binPtCandMax) { + PromptFraction = h1D->GetBinContent(binPtCandMin); + } else { + std::cout << "[ERROR] Different bin obtained from PtCandMin and PtCandMax"; + return 0.; + } + + return PromptFraction; +} + void DhCorrelationExtraction::NormalizeMEplot(TH2D*& histoME, TH2D*& histoMEsoftPi) { - Double_t bin0phi = histoME->GetYaxis()->FindBin(0.); - Double_t bin0eta = histoME->GetXaxis()->FindBin(0.); + Int_t bin0phi = histoME->GetYaxis()->FindBin(0.); + Int_t bin0eta = histoME->GetXaxis()->FindBin(0.); // evaluate the normalization (from ALL tracks, including possible fake softpions) -> **histoME indeed includes bin1+bin2 of THnSparse, i.e. all the tracks** Double_t factorNorm = 0; @@ -506,9 +1348,13 @@ void DhCorrelationExtraction::NormalizeMEplot(TH2D*& histoME, TH2D*& histoMEsoft } factorNorm /= 4.; - if (fSubtractSoftPiME) { + std::cout << "bin 0 phi: " << bin0phi << std::endl; + std::cout << "bin 0 eta: " << bin0eta << std::endl; + std::cout << "Factor norm. ME: " << factorNorm << std::endl; + std::cout << "Bin content (0,0) ME: " << histoME->GetBinContent(bin0eta, bin0phi) << std::endl; + + if (fSubtractSoftPiME) histoME->Add(histoMEsoftPi, -1); // remove the tracks compatible with soft pion (if requested) - } // apply the normalization histoME->Scale(1. / factorNorm); @@ -516,6 +1362,144 @@ void DhCorrelationExtraction::NormalizeMEplot(TH2D*& histoME, TH2D*& histoMEsoft return; } +Double_t DhCorrelationExtraction::CalculateBaseline(TH1D*& histo, Bool_t totalRange, Bool_t reflected) +{ + + // total range = 2*Pi + // half range = Pi , for histogram reflected under symmetric assumption + + Double_t baseline, errBaseline; + Int_t nBinsPhi = histo->GetNbinsX(); + Int_t binPhiHalf = nBinsPhi / 2; + Int_t binPhiHalfMinus1 = nBinsPhi / 2 - 1; + Int_t binPhiHalfPlus1 = nBinsPhi / 2 + 1; + Int_t binPhiHalfPlus2 = nBinsPhi / 2 + 1; + + if (totalRange) { + // baseline evaluated considering: the two first points, the last two points and four points in the middle (corresponding to the outer points) + if (nBinsPhi >= 32) { + baseline = + ((histo->GetBinContent(1)) * (1. / TMath::Power(histo->GetBinError(1), 2)) + + (histo->GetBinContent(2)) * (1. / TMath::Power(histo->GetBinError(2), 2)) + + (histo->GetBinContent(binPhiHalfMinus1)) * (1. / TMath::Power(histo->GetBinError(binPhiHalfMinus1), 2)) + + (histo->GetBinContent(binPhiHalf)) * (1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (histo->GetBinContent(binPhiHalfPlus1)) * (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2)) + + (histo->GetBinContent(binPhiHalfPlus2)) * (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus2), 2)) + + (histo->GetBinContent(nBinsPhi - 1)) * (1. / TMath::Power(histo->GetBinError(nBinsPhi - 1), 2)) + + (histo->GetBinContent(nBinsPhi)) * (1. / TMath::Power(histo->GetBinError(nBinsPhi), 2))) / + ((1. / TMath::Power(histo->GetBinError(1), 2)) + + (1. / TMath::Power(histo->GetBinError(2), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfMinus1), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus2), 2)) + + (1. / TMath::Power(histo->GetBinError(nBinsPhi - 1), 2)) + + (1. / TMath::Power(histo->GetBinError(nBinsPhi), 2))); + } else { + baseline = + ((histo->GetBinContent(1)) * (1. / TMath::Power(histo->GetBinError(1), 2)) + + (histo->GetBinContent(binPhiHalf)) * (1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (histo->GetBinContent(binPhiHalfPlus1)) * (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2)) + + (histo->GetBinContent(nBinsPhi)) * (1. / TMath::Power(histo->GetBinError(nBinsPhi), 2))) / + ((1. / TMath::Power(histo->GetBinError(1), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2)) + + (1. / TMath::Power(histo->GetBinError(nBinsPhi), 2))); + } + } else { + if (reflected) { + baseline = + ((histo->GetBinContent(binPhiHalfMinus1)) * (1. / TMath::Power(histo->GetBinError(binPhiHalfMinus1), 2)) + + (histo->GetBinContent(binPhiHalf)) * (1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (histo->GetBinContent(binPhiHalfPlus1)) * (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2)) + + (histo->GetBinContent(binPhiHalfPlus2)) * (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus2), 2))) / + ((1. / TMath::Power(histo->GetBinError(binPhiHalfMinus1), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus2), 2))); + } else { + // baseline evaluated using the 4 middle points in the transverese region + if (nBinsPhi >= 32) { + baseline = + ((histo->GetBinContent(binPhiHalfMinus1)) * (1. / TMath::Power(histo->GetBinError(binPhiHalfMinus1), 2)) + + (histo->GetBinContent(binPhiHalf)) * (1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (histo->GetBinContent(binPhiHalfPlus1)) * (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2)) + + (histo->GetBinContent(binPhiHalfPlus2)) * (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus2), 2))) / + ((1. / TMath::Power(histo->GetBinError(binPhiHalfMinus1), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus2), 2))); + } else { + baseline = + ((histo->GetBinContent(binPhiHalf)) * (1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (histo->GetBinContent(binPhiHalfPlus1)) * (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2))) / + ((1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2))); + } + } + } + + return baseline; +} + +Double_t DhCorrelationExtraction::CalculateBaselineError(TH1D*& histo, Bool_t totalRange, Bool_t reflected) +{ + + // total range = 2*Pi + // half range = Pi , for histogram reflected under symmetric assumption + + Double_t errBaseline; + Int_t nBinsPhi = histo->GetNbinsX(); + Int_t binPhiHalf = nBinsPhi / 2; + Int_t binPhiHalfMinus1 = nBinsPhi / 2 - 1; + Int_t binPhiHalfPlus1 = nBinsPhi / 2 + 1; + Int_t binPhiHalfPlus2 = nBinsPhi / 2 + 1; + + if (totalRange) { + // baseline evaluated considering: the two first points, the last two points and four points in the middle (corresponding to the outer points) + if (nBinsPhi >= 32) { + errBaseline = 1. / + TMath::Sqrt((1. / TMath::Power(histo->GetBinError(1), 2)) + + (1. / TMath::Power(histo->GetBinError(2), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfMinus1), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus2), 2)) + + (1. / TMath::Power(histo->GetBinError(nBinsPhi - 1), 2)) + + (1. / TMath::Power(histo->GetBinError(nBinsPhi), 2))); + } else { // fon nBinsPhi = 16 (rebin 4) + errBaseline = 1. / + TMath::Sqrt((1. / TMath::Power(histo->GetBinError(1), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2)) + + (1. / TMath::Power(histo->GetBinError(nBinsPhi), 2))); + } + } else { + // baseline evaluated using the 4 middle points in the transverese region + if (reflected) { + errBaseline = 1. / + TMath::Sqrt((1. / TMath::Power(histo->GetBinError(binPhiHalfMinus1), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus2), 2))); + } else { + if (nBinsPhi >= 32) { + errBaseline = 1. / + TMath::Sqrt((1. / TMath::Power(histo->GetBinError(binPhiHalfMinus1), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus2), 2))); + } else { + errBaseline = 1. / + TMath::Sqrt((1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2))); + } + } + } + + return errBaseline; +} + void DhCorrelationExtraction::SetTH1HistoStyle(TH1D*& histo, TString hTitle, TString hXaxisTitle, TString hYaxisTitle, Style_t markerStyle, Color_t markerColor, Double_t markerSize, Color_t lineColor, Int_t lineWidth, Float_t hTitleXaxisOffset, Float_t hTitleYaxisOffset, diff --git a/PWGHF/HFC/Macros/DhCorrelationExtraction.h b/PWGHF/HFC/Macros/DhCorrelationExtraction.h index 73b07c61e83..52508ea3bb9 100644 --- a/PWGHF/HFC/Macros/DhCorrelationExtraction.h +++ b/PWGHF/HFC/Macros/DhCorrelationExtraction.h @@ -17,8 +17,6 @@ #ifndef PWGHF_HFC_MACROS_DHCORRELATIONEXTRACTION_H_ #define PWGHF_HFC_MACROS_DHCORRELATIONEXTRACTION_H_ -#include -#include #include #include #include @@ -28,6 +26,9 @@ #include #include +#include +#include + class DhCorrelationExtraction : public TObject { @@ -40,6 +41,10 @@ class DhCorrelationExtraction : public TObject kME }; enum selectInvMassRegion { kSign, kSideb }; + enum selectDmesonOrigin { kPrompt, + kFD }; + enum selectParticleType { kPrimaryPart, + kAllPart }; DhCorrelationExtraction(); // default constructor DhCorrelationExtraction(const DhCorrelationExtraction& source); @@ -51,15 +56,36 @@ class DhCorrelationExtraction : public TObject void SetInputFilenameMass(TString filenameMass) { fFileNameMass = filenameMass; } void SetInputFilenameSE(TString filenameSE) { fFileNameSE = filenameSE; } void SetInputFilenameME(TString filenameME) { fFileNameME = filenameME; } + void SetInputFilenameSecPart(TString filenameSecPart) { fFileSecPartName = filenameSecPart; } + void SetInputFilenameBiasBtoD(TString filenamePromptMcRec, TString filenameNonPromptMcRec) + { + fFilePromptMcRecName = filenamePromptMcRec; + fFileNonPromptMcRecName = filenameNonPromptMcRec; + } void SetDirNameSE(TString dirNameSE) { fDirNameSE = dirNameSE; } void SetDirNameME(TString dirNameME) { fDirNameME = dirNameME; } + void SetDirNameSecPart(TString dirNameSecPart) { fDirSecPartName = dirNameSecPart; } void SetMassHistoNameSgn(TString massHistoNameSgn) { fMassHistoNameSgn = massHistoNameSgn; } void SetMassHistoNameBkg(TString massHistoNameBkg) { fMassHistoNameBkg = massHistoNameBkg; } void SetMassHistoNameSBs(TString massHistoNameSBs) { fMassHistoNameSBs = massHistoNameSBs; } void SetSECorrelHistoSignalName(TString correlNameSigSE) { fSECorrelSignalRegionName = correlNameSigSE; } void SetSECorrelHistoSidebandName(TString correlNameSbSE) { fSECorrelSidebandsName = correlNameSbSE; } + void SetSECorrelHistoSidebandLeftName(TString correlNameSbSE) { fSECorrelSidebandLeftName = correlNameSbSE; } + void SetSECorrelHistoSidebandRightName(TString correlNameSbSE) { fSECorrelSidebandRightName = correlNameSbSE; } void SetMECorrelHistoSignalName(TString correlNameSigME) { fMECorrelSignalRegionName = correlNameSigME; } void SetMECorrelHistoSidebandName(TString correlNameSbME) { fMECorrelSidebandsName = correlNameSbME; } + void SetMECorrelHistoSidebandLeftName(TString correlNameSbME) { fMECorrelSidebandLeftName = correlNameSbME; } + void SetMECorrelHistoSidebandRightName(TString correlNameSbME) { fMECorrelSidebandRightName = correlNameSbME; } + void SetHistoSecPartName(TString histoPrimaryPartName, TString histoAllPartName) + { + fHistoPrimaryPartName = histoPrimaryPartName; + fHistoAllPartName = histoAllPartName; + } + void SetInputFilenameFDTemplate(TString filenameFDTemplate) { fFileFDTemplateName = filenameFDTemplate; } + void SetInputFilenameFDPromptFrac(TString filenameFDPromptFrac) { fFileFDPromptFracName = filenameFDPromptFrac; } + void SetInputHistoNameFDTemplatePrompt(TString hNameFDTemplatePrompt) { fHistoFDTemplatePromptName = hNameFDTemplatePrompt; } + void SetInputHistoNameFDTemplateNonPrompt(TString hNameFDTemplateNonPrompt) { fHistoFDTemplateNonPromptName = hNameFDTemplateNonPrompt; } + void SetInputHistoNameFDPromptFrac(TString hNameFDPromptFrac) { fHistoFDPromptFracName = hNameFDPromptFrac; } // Input conditions: PtCand, PtHad, PoolBins void SetNpools(Int_t npools) { fNpools = npools; } @@ -72,66 +98,136 @@ class DhCorrelationExtraction : public TObject void SetSubtractSoftPiInMEdistr(Bool_t subtractSoftPiME) { fSubtractSoftPiME = subtractSoftPiME; } void SetBkgScaleFactor(Double_t scaleFactor) { fBkgScaleFactor = scaleFactor; } void SetSignalYieldforNorm(Double_t sgnYield) { fSgnYieldNorm = sgnYield; } + void SetBkgYield(Double_t bkgYield) { fBkgYield = bkgYield; } + void SetSBYield(Double_t SBYield) { fSBYield = SBYield; } void SetRebin2DcorrelHisto(Int_t rebinDeltaEta, Int_t rebinDeltaPhi) { - fRebin2Dhisto = kTRUE; fRebinAxisDeltaEta = rebinDeltaEta; fRebinAxisDeltaPhi = rebinDeltaPhi; } + void SetRebinOptions(Bool_t rebinAngCorr, Bool_t rebinFDCorr, Bool_t rebinSecPart) + { + fRebinAngCorr = rebinAngCorr; + fRebinFDCorr = rebinFDCorr; + fRebinSecPart = rebinSecPart; + } void GetSignalAndBackgroundForNorm(Double_t PtCandMin, Double_t PtCandMax); void NormalizeMEplot(TH2D*& histoME, TH2D*& histoMEsoftPi); void SetDebugLevel(Int_t debug) { fDebug = debug; } + void SetDividedSidebands(Bool_t dividedSideb, Bool_t useSidebLeft, Bool_t useSidebRight) + { + fSidebandDivided = dividedSideb; + fUseSidebLeft = useSidebLeft; + fUseSidebRight = useSidebRight; + } + void SetFDSubtraction(Bool_t subtractFD) { fFDsubtraction = subtractFD; } + void SetSecPartContamination(Bool_t secPartContamination) { fSecPartContamination = secPartContamination; } + void SetCorrBiasBtoD(Bool_t corrbiasBtoD) { fCorrBiasBtoD = corrbiasBtoD; } + void SetBinCandAndHad(Int_t binCand, Int_t binHad) + { + fBinPtCand = binCand; + fBinPtHad = binHad; + } /// Analysis methods TH2D* GetCorrelHisto(Int_t SEorME, Int_t SorSB, Int_t pool, Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax); + TH2D* GetFDTemplateHisto(Int_t PromptOrFD, Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax); + TH1D* GetCorrelHistoSecondaryPart(Int_t PrimaryPart, Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax); + TH1D* ReflectCorrHistogram(TH1D*& histo); + TH1D* ReflectHistoRun2(TH1D* h, Double_t scale); + TH1D* EvaluateMCClosModulations(Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax); + Double_t GetFDPromptFrac(Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax); + Double_t CalculateBaseline(TH1D*& histo, Bool_t totalRange = kTRUE, Bool_t reflected = kFALSE); + Double_t CalculateBaselineError(TH1D*& histo, Bool_t totalRange = kTRUE, Bool_t reflected = kFALSE); Bool_t ReadInputSEandME(); Bool_t ReadInputInvMass(); + Bool_t ReadInputFDSubtr(); + Bool_t ReadInputSecondaryPartContamination(); Bool_t ExtractCorrelations(Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax, TString codeName); TH1D* GetCorrectedCorrHisto() { return fCorrectedCorrHisto; } + TH1D* GetCorrectedCorrHisto_BaselineSubtr() { return fCorrectedCorrHisto_BaselineSubtr; } + TH1D* GetCorrectedCorrHisto_Reflected() { return fCorrectedCorrHisto_Reflected; } + TH1D* GetCorrectedCorrHisto_Reflected_BaselineSubtr() { return fCorrectedCorrHisto_Reflected_BaselineSubtr; } /// Histogram style void SetTH1HistoStyle(TH1D*& histo, TString hTitle, TString hXaxisTitle, TString hYaxisTitle, Style_t markerStyle = kFullCircle, Color_t markerColor = kRed + 1, Double_t markerSize = 1.4, Color_t lineColor = kRed + 1, Int_t lineWidth = 3, Float_t hTitleXaxisOffset = 1.0, Float_t hTitleYaxisOffset = 1.0, Float_t hTitleXaxisSize = 0.060, Float_t hTitleYaxisSize = 0.060, Float_t hLabelXaxisSize = 0.060, Float_t hLabelYaxisSize = 0.060, Bool_t centerXaxisTitle = false, Bool_t centerYaxisTitle = false); void SetTH2HistoStyle(TH2D*& histo, TString hTitle, TString hXaxisTitle, TString hYaxisTitle, TString hZaxisTitle, Float_t hTitleXaxisOffset = 1.8, Float_t hTitleYaxisOffset = 1.8, Float_t hTitleZaxisOffset = 1.2, Float_t hTitleXaxisSize = 0.060, Float_t hTitleYaxisSize = 0.060, Float_t hTitleZaxisSize = 0.060, Float_t hLabelXaxisSize = 0.060, Float_t hLabelYaxisSize = 0.060, Float_t hLabelZaxisSize = 0.060, Bool_t centerXaxisTitle = true, Bool_t centerYaxisTitle = true); private: - TFile* fFileMass; // file containing the mass histograms - TFile* fFileSE; // file containing the Same Event (SE) output - TFile* fFileME; // file containing the Mixed Event (ME) output - - TDirectoryFile* fDirMass; // TDirectory for mass histos - TDirectoryFile* fDirSE; // TDirectory for SE info - TDirectoryFile* fDirME; // TDirectory for ME info - - TH1D* fCorrectedCorrHisto; // Corrected correlation histogram - - DmesonSpecie fDmesonSpecies; // D meson specie - TString fDmesonLabel; // D meson label - TString fFileNameMass; // File cntaining inv. mass histograms - TString fFileNameSE; // File contaning Same Event (SE) output - TString fFileNameME; // File contaning Mixed Event (ME) output - TString fDirNameSE; // Directory in the file containing SE output - TString fDirNameME; // Directory in the file containing ME output - TString fMassHistoNameSgn; // Inv. mass histo name signal yield - TString fMassHistoNameBkg; // Inv. mass histo name background yield - TString fMassHistoNameSBs; // Inv. mass histo name sideband yield - TString fSECorrelSignalRegionName; // THnSparse name containing SE output for signal region - TString fSECorrelSidebandsName; // THnSparse name containing SE output for sideband region - TString fMECorrelSignalRegionName; // THnSparse name containing ME output for signal region - TString fMECorrelSidebandsName; // THnSparse name containing ME output for sideband region - - Int_t fNpools; // number of pools used for the ME correction - Int_t fRebinAxisDeltaEta; // rebin deltaEta axis - Int_t fRebinAxisDeltaPhi; // rebin deltaPhi axis - Int_t fDebug; // debug level - - Double_t fDeltaEtaMin; // deltaEta min value - Double_t fDeltaEtaMax; // deltaEta max value + TFile* fFileMass; // File containing the mass histograms + TFile* fFileSE; // File containing the Same Event (SE) output + TFile* fFileME; // File containing the Mixed Event (ME) output + TFile* fFileFDTemplate; // File containing FD angular correlation templates + TFile* fFileFDPromptFrac; // File containing prompt fraction (used fo FD subtraction) + TFile* fFileSecPart; // File containing secondary particle contaminaion teplates + TFile* fFilePromptMc; // File containing prompt ratio taken from MC Closure test study (to use for B to D bias correction) + TFile* fFileNonPromptMc; // File containing non-prompt ratio taken from MC Closure test study (to use for B to D bias correction) + + TDirectoryFile* fDirMass; // TDirectory for mass histos + TDirectoryFile* fDirSE; // TDirectory for SE info + TDirectoryFile* fDirME; // TDirectory for ME info + TDirectoryFile* fDirSecPart; // TDirectory for seondary particle correction + + TH1D* fCorrectedCorrHisto; // Corrected correlation histogram + TH1D* fCorrectedCorrHisto_BaselineSubtr; // Corrected correlation histogram with baseline subtracion + TH1D* fCorrectedCorrHisto_Reflected; // Corrected correlation histogram relected in azimuth + TH1D* fCorrectedCorrHisto_Reflected_BaselineSubtr; // Corrected correlation histogram reflected in azimuth with baseline subtraction + + DmesonSpecie fDmesonSpecies; // D meson specie + TString fDmesonLabel; // D meson label + TString fFileNameMass; // File name containing inv. mass histograms + TString fFileNameSE; // File name contaning Same Event (SE) output + TString fFileNameME; // File name contaning Mixed Event (ME) output + TString fFileSecPartName; // File name contaning secondary particle correction output + TString fFileFDTemplateName; // File name contaning FD angular correlation templates + TString fFileFDPromptFracName; // File name contaning prompt fraction (used for FD subtraction) + TString fFilePromptMcRecName; // File name contaning prompt angular correlation (used for B to d bias correction) + TString fFileNonPromptMcRecName; // File name contaning non-prompt angular correlation (used for B to d bias correction) + TString fDirNameSE; // Directory in the file containing SE output + TString fDirNameME; // Directory in the file containing ME output + TString fDirSecPartName; // Directory in the file containing secondary particle correction output + TString fMassHistoNameSgn; // Inv. mass histo name signal yield + TString fMassHistoNameBkg; // Inv. mass histo name background yield + TString fMassHistoNameSBs; // Inv. mass histo name sideband yield + TString fSECorrelSignalRegionName; // THnSparse name containing SE output for signal region + TString fSECorrelSidebandsName; // THnSparse name containing SE output for sideband region + TString fSECorrelSidebandLeftName; // THnSparse name containing SE output for sideband left region + TString fSECorrelSidebandRightName; // THnSparse name containing SE output for sideband right region + TString fMECorrelSignalRegionName; // THnSparse name containing ME output for signal region + TString fMECorrelSidebandsName; // THnSparse name containing ME output for sideband regions + TString fMECorrelSidebandLeftName; // THnSparse name containing ME output for sideband left region + TString fMECorrelSidebandRightName; // THnSparse name containing ME output for sideband right region + TString fHistoFDTemplatePromptName; // Prompt angular correlation histogram name + TString fHistoFDTemplateNonPromptName; // FD angular correlation histogram name + TString fHistoFDPromptFracName; // Prompt fraction histogram name + TString fHistoPrimaryPartName; // Primary particle histogram (to be used for secondary particle contamination correction) + TString fHistoAllPartName; // All particle histogram (to be used for secondary particle contamination correction) + + Int_t fNpools; // Number of pools used for the ME correction + Int_t fRebinAxisDeltaEta; // Rebin deltaEta axis value + Int_t fRebinAxisDeltaPhi; // Rebin deltaPhi axis value + Int_t fDebug; // Debug level + Int_t fBinPtCand; // Pt bin of the candidate + Int_t fBinPtHad; // Pt bin of the hadron + + Double_t fDeltaEtaMin; // DeltaEta min value + Double_t fDeltaEtaMax; // DeltaEta max value Double_t fBkgScaleFactor; // Bkg/SB factor to scale correlation plots obtained in the sideband region Double_t fSgnYieldNorm; // Signal yield (used for normalize correlation plots after bkg subtraction) + Double_t fBkgYield; // Bkg yield under signal peak region + Double_t fSBYield; // Sideband yield Bool_t fCorrectPoolsSeparately; // Possibility to do the ME correction pool-by-pool (kTRUE) or merging all pools (kFALSE) Bool_t fSubtractSoftPiME; // Soft pion subtraction (for D0 case) - Bool_t fRebin2Dhisto; // Flag to rebin the 2D correlation plots + Bool_t fRebinAngCorr; // Rebin angular correlaion distributons (SE and ME) + Bool_t fRebinFDCorr; // Rebin angular correlaion distributon templates used for FD correction (theory driven) + Bool_t fRebinSecPart; // Rebin angular correlaion distributon templates used for secodary particle contamination correction + Bool_t fSidebandDivided; // To be set to TRUE if two sideband corrlaion histograms are passed inteh config file + Bool_t fUseSidebLeft; // To be set to TRUE if only sideband left is used for the bkg correction + Bool_t fUseSidebRight; // To be set to TRUE if only sideband right is used for the bkg correction + Bool_t fFDsubtraction; // Enable feed-down (FD) correction + Bool_t fSecPartContamination; // Enable seconday particle contamination correction + Bool_t fCorrBiasBtoD; // Enable bias B to D correction (perfrmed with angular correlaion templates taken from MC simulaions) }; #endif // PWGHF_HFC_MACROS_DHCORRELATIONEXTRACTION_H_ diff --git a/PWGHF/HFC/Macros/DhCorrelationFitter.cxx b/PWGHF/HFC/Macros/DhCorrelationFitter.cxx index 8882c567535..683ae0cc04a 100644 --- a/PWGHF/HFC/Macros/DhCorrelationFitter.cxx +++ b/PWGHF/HFC/Macros/DhCorrelationFitter.cxx @@ -10,7 +10,7 @@ // or submit itself to any jurisdiction. /// \file DhCorrelationFitter.cxx -/// \brief Class to perform the azimuthal correlation fit +/// \brief class for for performing the fit of azimuthal correlations /// \author Samuele Cattaruzzi /// \author Swapnesh Santosh Khade @@ -37,8 +37,6 @@ #include #include -using namespace std; - DhCorrelationFitter::DhCorrelationFitter() : // default constructor fIsReflected(kFALSE), fTypeOfFitFunc(kConstwoGaus), @@ -53,6 +51,9 @@ DhCorrelationFitter::DhCorrelationFitter() : // default constructor fExtParsLowBounds(0x0), fExtParsUppBounds(0x0), fUseExternalPars(kFALSE), + fShiftBaselineUp(kFALSE), + fShiftBaselineDown(kFALSE), + fIsTotal(kTRUE), fNbasleinePoints(0), fBinsBaseline(0x0), fHist(0x0), @@ -64,6 +65,8 @@ DhCorrelationFitter::DhCorrelationFitter() : // default constructor fGausNS(0x0), fGausAS(0x0), fPed(0x0), + fv2AssocPart(0.), + fv2Dmeson(0.), fNSyieldBinCount(0.), fErrNSyieldBinCount(0.), fASyieldBinCount(0.), @@ -85,6 +88,9 @@ DhCorrelationFitter::DhCorrelationFitter(TH1F* histoToFit, Double_t min, Double_ fExtParsLowBounds(0x0), fExtParsUppBounds(0x0), fUseExternalPars(kFALSE), + fShiftBaselineUp(kFALSE), + fShiftBaselineDown(kFALSE), + fIsTotal(kTRUE), fNbasleinePoints(0), fBinsBaseline(0x0), fHist(0x0), @@ -96,6 +102,9 @@ DhCorrelationFitter::DhCorrelationFitter(TH1F* histoToFit, Double_t min, Double_ fGausNS(0x0), fGausAS(0x0), fPed(0x0), + fBaseTransvReg(0x0), + fv2AssocPart(0.), + fv2Dmeson(0.), fNSyieldBinCount(0.), fErrNSyieldBinCount(0.), fASyieldBinCount(0.), @@ -120,6 +129,9 @@ DhCorrelationFitter::DhCorrelationFitter(const DhCorrelationFitter& source) : // fExtParsLowBounds(source.fExtParsLowBounds), fExtParsUppBounds(source.fExtParsUppBounds), fUseExternalPars(source.fUseExternalPars), + fShiftBaselineUp(source.fShiftBaselineUp), + fShiftBaselineDown(source.fShiftBaselineDown), + fIsTotal(source.fIsTotal), fNbasleinePoints(source.fNbasleinePoints), fBinsBaseline(source.fBinsBaseline), fHist(source.fHist), @@ -131,6 +143,9 @@ DhCorrelationFitter::DhCorrelationFitter(const DhCorrelationFitter& source) : // fGausNS(source.fGausNS), fGausAS(source.fGausAS), fPed(source.fPed), + fBaseTransvReg(source.fBaseTransvReg), + fv2AssocPart(source.fv2AssocPart), + fv2Dmeson(source.fv2Dmeson), fNSyieldBinCount(source.fNSyieldBinCount), fErrNSyieldBinCount(source.fErrNSyieldBinCount), fASyieldBinCount(source.fASyieldBinCount), @@ -225,6 +240,7 @@ void DhCorrelationFitter::Fitting(Bool_t drawSplitTerm, Bool_t useExternalPars) // < 0 : fix the baseline to the weighted average of the abs(fFixBaseline) lower points // = 2 : zyam at pi/2. Fix the baseline averaging the 2 points around +-pi/2 value // = 3 : fix the baseline to the weighted average of the points passed through the function SetPointsForBaseline() + // = 4 : fix the baseline to the weighted average of the points in the transverse region in default configuration (i.e. for 32 bins the first 2, the last 2 and the 4 middle ones) // // -> fFixMean = 0 : NS & AS mean free // = 1 : NS mean fixed to 0, AS mean free @@ -238,7 +254,15 @@ void DhCorrelationFitter::Fitting(Bool_t drawSplitTerm, Bool_t useExternalPars) Printf("[INFO] DhCorrelationFitter::Fitting, Finding baseline"); FindBaseline(); } + if (fFixBase == 0) { + // set initial value of the fBaseline + fBaseline = CalculateBaseline(fHist, fIsTotal); + } Printf("[INFO] DhCorrelationFitter::Fitting, Setting Function"); + if (fTypeOfFitFunc == 7) { // case for v2 modulation + FitBaselineWv2(); // to contrain the B parameter in the fit function for the pedestal + Printf("[INFO] B parameter for v2 fit: %.3f", fBaseline); + } SetFitFunction(); if (fFixBase != 0) { @@ -248,9 +272,12 @@ void DhCorrelationFitter::Fitting(Bool_t drawSplitTerm, Bool_t useExternalPars) fFit->FixParameter(2, 0.); } if (fFixMean == 2 || fFixMean == 3) { - if (fTypeOfFitFunc != 0) + if (fTypeOfFitFunc != 0 && fTypeOfFitFunc != 3) fFit->FixParameter(5, TMath::Pi()); + if (fTypeOfFitFunc == 3 || fTypeOfFitFunc == 6) + fFit->FixParameter(2, TMath::Pi()); } + Printf("[INFO] DhCorrelationFitter::Fitting, Fitting"); TVirtualFitter::SetMaxIterations(20000); TFitResultPtr fitptr = fHist->Fit(fFit, "RIMES", "", fMinCorr, fMaxCorr); @@ -270,19 +297,39 @@ void DhCorrelationFitter::Fitting(Bool_t drawSplitTerm, Bool_t useExternalPars) fHist->SetTitle(";#Delta#varphi (rad); #frac{1}{N_{D}}#frac{dN^{assoc}}{d#Delta#varphi} (rad^{-1})"); Printf("[INFO] DhCorrelationFitter::Fitting, Now drawing, if requested"); SetSingleTermsForDrawing(drawSplitTerm); + + // NS yield from bin counting + double fNSyield = 0.; + double fNSyieldErr = 0.; + double baselinBinCount = 0; + for (int iBin = 1; iBin <= 6; iBin++) { // first six bins + fNSyield += 2 * (fHist->GetBinContent(iBin) - fBaseline) * fHist->GetBinWidth(iBin); // x2 due to the fatct the histogram is reflected + fNSyieldErr += 4 * (TMath::Power(fHist->GetBinError(iBin), 2) + TMath::Power(fErrBaseline, 2)) * (fHist->GetBinWidth(iBin) * fHist->GetBinWidth(iBin)); + baselinBinCount += fBaseline * fHist->GetBinWidth(iBin); + } + fNSyieldErr = TMath::Sqrt(fNSyieldErr); + + // AS yield from bin counting + double fASyield = 0.; + double fASyieldErr = 0.; + for (int iBin = 11; iBin <= 16; iBin++) { // last six bins + fASyield += 2 * (fHist->GetBinContent(iBin) - fBaseline) * fHist->GetBinWidth(iBin); + fASyieldErr += 4 * (TMath::Power(fHist->GetBinError(iBin), 2) + TMath::Power(fErrBaseline, 2)) * (fHist->GetBinWidth(iBin) * fHist->GetBinWidth(iBin)); + } + fASyieldErr = TMath::Sqrt(fASyieldErr); + + printf("[RESULT MINE] Bin counting results: NS Yield = %.3f +- %.3f \n[RESULT MINE] Bin counting results: AS Yield: %.3f +- %.3f \n[RESULT MINE] baseline = %.3f \n", fNSyield, fNSyieldErr, fASyield, fASyieldErr, baselinBinCount); } void DhCorrelationFitter::SetFitFunction() { - // -> fitFunc = 1: const+ G NS + G AS (w/o periodicity) - // = 2: const+ G NS + G AS (w/ periodicity) - // = 3: const+ yieldNS*[fact*(G NS)+(1- fact)*(G2 NS)] + yieldAS*(G AS) (w/ periodicity) - // = 4: const +yieldNS*(G NS) + yieldAS*[fact*(G AS)+(1- fact)*(G2 AS)] (w/ periodicity) - // = 5: v2 modulation (no gaussian terms) - // = 6: v2 modulation + G NS + G AS (w/ periodicity) - // = 7: const+ GenG NS + G AS (w/ periodicity) - // = 8: const+ GenG fixBeta NS + G AS (w/ periodicity) - // = 9: const+ GenG constrBeta NS + G AS (w/ periodicity) + // -> fitFunc = 1: const + G NS + G AS (w/o periodicity) + // = 2: const + G NS + G AS (w/ periodicity) + // = 3: const + G AS + // = 4: const + GenG NS + G AS (w/ periodicity) + // = 5: const + VonMises NS + VonMises AS (w/periodicity) + // = 6: const + VonMises AS + // = 7: baseline w v2 modulation + G NS + G AS (w/ periodicity) if (fFit) { delete fFit; @@ -372,6 +419,180 @@ void DhCorrelationFitter::SetFitFunction() fFit->SetParName(6, "AS #sigma"); break; + + case 3: + fFit = new TF1("OneGausPeriodicity", "[0]+[1]/TMath::Sqrt(2.*TMath::Pi())/[3]*TMath::Exp(-(x-[2])*(x-[2])/2./([3]*[3]))+[1]/TMath::Sqrt(2.*TMath::Pi())/[3]*TMath::Exp(-(x+2.*TMath::Pi()-[2])*(x+2.*TMath::Pi()-[2])/2./([3]*[3]))+[1]/TMath::Sqrt(2.*TMath::Pi())/[3]*TMath::Exp(-(x-2.*TMath::Pi()-[2])*(x-2.*TMath::Pi()-[2])/2./([3]*[3]))", fMinCorr, fMaxCorr); + fGausAS = new TF1("fGausASper", "[0]/TMath::Sqrt(2.*TMath::Pi())/[2]*TMath::Exp(-(x-[1])*(x-[1])/2./([2]*[2]))+[0]/TMath::Sqrt(2.*TMath::Pi())/[2]*TMath::Exp(-(x-2.*TMath::Pi()-[1])*(x-2.*TMath::Pi()-[1])/2./([2]*[2]))+[0]/TMath::Sqrt(2.*TMath::Pi())/[2]*TMath::Exp(-(x+2.*TMath::Pi()-[1])*(x+2.*TMath::Pi()-[1])/2./([2]*[2]))", fMinCorr, fMaxCorr); + fPed = new TF1("fPed", "[0]", fMinCorr, fMaxCorr); + + // TODO: add possibility to use external parameters + // if(!fUseExternalPars) { + fFit->SetParLimits(0, 0, 9999.); + fFit->SetParLimits(1, 0, 999.); + fFit->SetParLimits(2, 2., 4.); + fFit->SetParLimits(3, 0, 3.14 / 2.); + + fFit->SetParameter(0, 3); + fFit->SetParameter(1, 2); + fFit->SetParameter(2, 3.14); + fFit->SetParameter(3, 0.3); + + /*} else { + for(int i=0; i SetParameter(i, fExtParsVals[i]); + fFit -> SetParLimits(i, fExtParsLowBounds[i], fExtParsUppBounds[i]); + } + } */ + + fFit->SetParName(0, "ped"); + fFit->SetParName(1, "AS Y"); + fFit->SetParName(2, "AS mean"); + fFit->SetParName(3, "AS #sigma"); + + break; + + case 4: + fFit = new TF1("kModifNSGausPeriodicity", "[0]+[1]*([7]*TMath::Sqrt(TMath::Gamma(3./[7]))/(2.*[3]*TMath::Power(TMath::Gamma(1./[7]),3./2.))*TMath::Exp(-TMath::Power(TMath::Abs(x-[2])*TMath::Sqrt(TMath::Gamma(3./[7]))/([3]*TMath::Sqrt(TMath::Gamma(1./[7]))),[7])))+[4]/TMath::Sqrt(2.*TMath::Pi())/[6]*TMath::Exp(-(x-[5])*(x-[5])/2./([6]*[6]))+[1]*([7]*TMath::Sqrt(TMath::Gamma(3./[7]))/(2.*[3]*TMath::Power(TMath::Gamma(1./[7]),3./2.))*TMath::Exp(-TMath::Power(TMath::Abs(x-2*TMath::Pi()-[2])*TMath::Sqrt(TMath::Gamma(3./[7]))/([3]*TMath::Sqrt(TMath::Gamma(1./[7]))),[7])))+[1]*([7]*TMath::Sqrt(TMath::Gamma(3./[7]))/(2.*[3]*TMath::Power(TMath::Gamma(1./[7]),3./2.))*TMath::Exp(-TMath::Power(TMath::Abs(x+2*TMath::Pi()-[2])*TMath::Sqrt(TMath::Gamma(3./[7]))/([3]*TMath::Sqrt(TMath::Gamma(1./[7]))),[7])))+[4]/TMath::Sqrt(2.*TMath::Pi())/[6]*TMath::Exp(-(x-2.*TMath::Pi()-[5])*(x-2.*TMath::Pi()-[5])/2./([6]*[6]))+[4]/TMath::Sqrt(2.*TMath::Pi())/[6]*TMath::Exp(-(x+2.*TMath::Pi()-[5])*(x+2.*TMath::Pi()-[5])/2./([6]*[6]))", fMinCorr, fMaxCorr); + fGausNS = new TF1("fModGausNSper", "[0]*([3]*TMath::Sqrt(TMath::Gamma(3./[3]))/(2.*[2]*TMath::Power(TMath::Gamma(1./[3]),3./2.))*TMath::Exp(-TMath::Power(TMath::Abs(x-[1])*TMath::Sqrt(TMath::Gamma(3./[3]))/([2]*TMath::Sqrt(TMath::Gamma(1./[3]))),[3])))+[0]*([3]*TMath::Sqrt(TMath::Gamma(3./[3]))/(2.*[2]*TMath::Power(TMath::Gamma(1./[3]),3./2.))*TMath::Exp(-TMath::Power(TMath::Abs(x-2*TMath::Pi()-[1])*TMath::Sqrt(TMath::Gamma(3./[3]))/([2]*TMath::Sqrt(TMath::Gamma(1./[3]))),[3])))+[0]*([3]*TMath::Sqrt(TMath::Gamma(3./[3]))/(2.*[2]*TMath::Power(TMath::Gamma(1./[3]),3./2.))*TMath::Exp(-TMath::Power(TMath::Abs(x+2*TMath::Pi()-[1])*TMath::Sqrt(TMath::Gamma(3./[3]))/([2]*TMath::Sqrt(TMath::Gamma(1./[3]))),[3])))", fMinCorr, fMaxCorr); + fGausAS = new TF1("fGausASper", "[0]/TMath::Sqrt(2.*TMath::Pi())/[2]*TMath::Exp(-(x-[1])*(x-[1])/2./([2]*[2]))+[0]/TMath::Sqrt(2.*TMath::Pi())/[2]*TMath::Exp(-(x-2.*TMath::Pi()-[1])*(x-2.*TMath::Pi()-[1])/2./([2]*[2]))+[0]/TMath::Sqrt(2.*TMath::Pi())/[2]*TMath::Exp(-(x+2.*TMath::Pi()-[1])*(x+2.*TMath::Pi()-[1])/2./([2]*[2]))", fMinCorr, fMaxCorr); + fPed = new TF1("fPed", "[0]", fMinCorr, fMaxCorr); + + fFit->SetParLimits(0, 0., 999.); + fFit->SetParLimits(1, 0.005, 25.); + fFit->SetParLimits(2, -0.55, 0.55); + fFit->SetParLimits(3, 0, 0.8); + fFit->SetParLimits(4, 0.005, 25.); + fFit->SetParLimits(5, 2.85, 3.55); + fFit->SetParLimits(6, 0.05, 3.14 / 2.); + fFit->SetParLimits(7, 0.5, 3.5); + + // default starting pars + fFit->SetParameter(0, 1.); + fFit->SetParameter(1, 1.); + fFit->SetParameter(2, 0.); + fFit->SetParameter(3, 0.3); + fFit->SetParameter(4, 0.25); + fFit->SetParameter(5, TMath::Pi()); + fFit->SetParameter(6, 0.3); + fFit->SetParameter(7, 2); + + fFit->SetParName(0, "ped"); + fFit->SetParName(1, "NS Y"); + fFit->SetParName(2, "NS mean"); + fFit->SetParName(3, "NS #sigma"); + fFit->SetParName(4, "AS Y"); + fFit->SetParName(5, "AS mean"); + fFit->SetParName(6, "AS #sigma"); + fFit->SetParName(7, "NS shape par"); // beta of the gen. gaussian + break; + + case 5: + fFit = new TF1("kVonMises", "[0] +[1]/(2*TMath::Pi()*TMath::BesselI0([3]))*TMath::Exp([3]*TMath::Cos(x- 2*TMath::Pi() - [2])) + [4]/(2*TMath::Pi()*TMath::BesselI0([6]))*TMath::Exp([6]*TMath::Cos(x- 2*TMath::Pi()-[5]))", fMinCorr, fMaxCorr); + fGausNS = new TF1("fVonMisesNS", "[0]/(2*TMath::Pi()*TMath::BesselI0([2]))*TMath::Exp([2]*TMath::Cos(x- 2*TMath::Pi() - [1]))", fMinCorr, fMaxCorr); + fGausAS = new TF1("fVonMisesAS", "[0]/(2*TMath::Pi()*TMath::BesselI0([2]))*TMath::Exp([2]*TMath::Cos(x- 2*TMath::Pi()-[1]))", fMinCorr, fMaxCorr); + fPed = new TF1("fPed", "[0]", fMinCorr, fMaxCorr); + + fFit->SetParLimits(0, 0., 999.); + fFit->SetParLimits(1, 0.005, 25.); + fFit->SetParLimits(2, -0.55, 0.55); + fFit->SetParLimits(3, 0, 15.); + fFit->SetParLimits(4, 0.005, 25.); + fFit->SetParLimits(5, 2.85, 3.55); + fFit->SetParLimits(6, 0., 15.); + + // default starting pars + fFit->SetParameter(0, 3.5); + fFit->SetParameter(1, 0.8); + fFit->SetParameter(2, 0.); + fFit->SetParameter(3, 1.); + fFit->SetParameter(4, 1.5); + fFit->SetParameter(5, TMath::Pi()); + fFit->SetParameter(6, 1.); + + fFit->SetParName(0, "ped"); + fFit->SetParName(1, "NS Y"); + fFit->SetParName(2, "NS mean"); + fFit->SetParName(3, "NS #sigma"); + fFit->SetParName(4, "AS Y"); + fFit->SetParName(5, "AS mean"); + fFit->SetParName(6, "AS #sigma"); + + break; + + case 6: + fFit = new TF1("kSingleVonMises", "[0] +[1]/(2*TMath::Pi()*TMath::BesselI0([3]))*TMath::Exp([3]*TMath::Cos(x- 2*TMath::Pi() - [2]))", fMinCorr, fMaxCorr); + fGausAS = new TF1("fVonMisesAS", "[0]/(2*TMath::Pi()*TMath::BesselI0([2]))*TMath::Exp([2]*TMath::Cos(x- 2*TMath::Pi()-[1]))", fMinCorr, fMaxCorr); + fPed = new TF1("fPed", "[0]", fMinCorr, fMaxCorr); + + fFit->SetParLimits(0, 0., 999.); + fFit->SetParLimits(1, 0.005, 25.); + fFit->SetParLimits(2, 2.85, 3.55); + fFit->SetParLimits(3, 0., 15.); + + // default starting pars + fFit->SetParameter(0, 3.5); + fFit->SetParameter(1, 1.5); + fFit->SetParameter(2, TMath::Pi()); + fFit->SetParameter(3, 1.); + + fFit->SetParName(0, "ped"); + fFit->SetParName(1, "AS Y"); + fFit->SetParName(2, "AS mean"); + fFit->SetParName(3, "AS #sigma"); + + break; + + case 7: // case 2 Gaus w periodicity + v2 modulation + + fFit = new TF1("kTwoGausPeriodicityPlusV2modulation", "[1]/TMath::Sqrt(2.*TMath::Pi())/[3]*TMath::Exp(-(x-[2])*(x-[2])/2./([3]*[3]))+[4]/TMath::Sqrt(2.*TMath::Pi())/[6]*TMath::Exp(-(x-[5])*(x-[5])/2./([6]*[6]))+[1]/TMath::Sqrt(2.*TMath::Pi())/[3]*TMath::Exp(-(x-2.*TMath::Pi()-[2])*(x-2.*TMath::Pi()-[2])/2./([3]*[3]))+[1]/TMath::Sqrt(2.*TMath::Pi())/[3]*TMath::Exp(-(x+2.*TMath::Pi()-[2])*(x+2.*TMath::Pi()-[2])/2./([3]*[3]))+[4]/TMath::Sqrt(2.*TMath::Pi())/[6]*TMath::Exp(-(x+2.*TMath::Pi()-[5])*(x+2.*TMath::Pi()-[5])/2./([6]*[6]))+[4]/TMath::Sqrt(2.*TMath::Pi())/[6]*TMath::Exp(-(x-2.*TMath::Pi()-[5])*(x-2.*TMath::Pi()-[5])/2./([6]*[6]))+[0]*(1+2*[7]*[8]*TMath::Cos(2*x))", fMinCorr, fMaxCorr); + fGausNS = new TF1("fGausNSper", "[0]/TMath::Sqrt(2.*TMath::Pi())/[2]*TMath::Exp(-(x-[1])*(x-[1])/2./([2]*[2]))+[0]/TMath::Sqrt(2.*TMath::Pi())/[2]*TMath::Exp(-(x-2.*TMath::Pi()-[1])*(x-2.*TMath::Pi()-[1])/2./([2]*[2]))+[0]/TMath::Sqrt(2.*TMath::Pi())/[2]*TMath::Exp(-(x+2.*TMath::Pi()-[1])*(x+2.*TMath::Pi()-[1])/2./([2]*[2]))", fMinCorr, fMaxCorr); + fGausAS = new TF1("fGausASper", "[0]/TMath::Sqrt(2.*TMath::Pi())/[2]*TMath::Exp(-(x-[1])*(x-[1])/2./([2]*[2]))+[0]/TMath::Sqrt(2.*TMath::Pi())/[2]*TMath::Exp(-(x-2.*TMath::Pi()-[1])*(x-2.*TMath::Pi()-[1])/2./([2]*[2]))+[0]/TMath::Sqrt(2.*TMath::Pi())/[2]*TMath::Exp(-(x+2.*TMath::Pi()-[1])*(x+2.*TMath::Pi()-[1])/2./([2]*[2]))", fMinCorr, fMaxCorr); + fPed = new TF1("fPedv2Mod", "[0]*(1+2*[1]*[2]*TMath::Cos(2*x))", fMinCorr, fMaxCorr); + + fFit->SetParLimits(0, 0., 999.); + fFit->SetParLimits(1, 0, 999.); + fFit->SetParLimits(2, -0.55, 0.55); + fFit->SetParLimits(3, 0, 3.14 / 3.); + fFit->SetParLimits(4, 0, 999.); + fFit->SetParLimits(5, 2.85, 3.55); + fFit->SetParLimits(6, 0, 3.14 / 2.); + fFit->SetParLimits(7, -1, 1); + fFit->SetParLimits(8, -1, 1); + + fFit->FixParameter(0, fBaseline); + fFit->SetParameter(1, 3); + fFit->SetParameter(2, 0.); + fFit->SetParameter(3, 0.3); + fFit->SetParameter(4, 2); + fFit->SetParameter(5, TMath::Pi()); + fFit->SetParameter(6, 0.3); + fFit->SetParameter(7, 0); + fFit->SetParameter(8, 0); + + if (fUseExternalPars) { // overwrites previous configuration + for (int i = 0; i < fNpars; i++) { + fFit->SetParameter(i, fExtParsVals[i]); + fFit->SetParLimits(i, fExtParsLowBounds[i], fExtParsUppBounds[i]); + } + } + + fFit->FixParameter(7, fv2AssocPart); + fFit->FixParameter(8, fv2Dmeson); + + fPed->FixParameter(0, fBaseline); + fPed->FixParameter(1, fv2AssocPart); + fPed->FixParameter(2, fv2Dmeson); + + fFit->SetParName(0, "ped"); + fFit->SetParName(1, "NS Y"); + fFit->SetParName(2, "NS mean"); + fFit->SetParName(3, "NS #sigma"); + fFit->SetParName(4, "AS Y"); + fFit->SetParName(5, "AS mean"); + fFit->SetParName(6, "AS #sigma"); + fFit->SetParName(7, "v_{2} hadron"); + fFit->SetParName(8, "v_{2} D meson"); + break; } } @@ -412,6 +633,16 @@ Double_t DhCorrelationFitter::FindBaseline() fBaseline = min; fErrBaseline = fHist->GetBinError(iBin); + if (fShiftBaselineUp) { + fBaseline += fErrBaseline; + printf("[INFO] Shift baseline up of its statistical uncertainty"); + } + + if (fShiftBaselineDown) { + fBaseline -= fErrBaseline; + printf("[INFO] Shift baseline down of its statistical uncertainty"); + } + return fBaseline; } @@ -441,6 +672,17 @@ Double_t DhCorrelationFitter::FindBaseline() printf("[RESULT] Average fBaseline: %.3f +- %.3f", Av, errAv); fBaseline = Av; fErrBaseline = errAv; + + if (fShiftBaselineUp) { + fBaseline += fErrBaseline; + printf("[INFO] Shift baseline up of its statistical uncertainty"); + } + + if (fShiftBaselineDown) { + fBaseline -= fErrBaseline; + printf("[INFO] Shift baseline down of its statistical uncertainty"); + } + return fBaseline; } @@ -465,6 +707,16 @@ Double_t DhCorrelationFitter::FindBaseline() fBaseline = Av; fErrBaseline = errAv; + if (fShiftBaselineUp) { + fBaseline += fErrBaseline; + printf("[INFO] Shift baseline up of its statistical uncertainty"); + } + + if (fShiftBaselineDown) { + fBaseline -= fErrBaseline; + printf("[INFO] Shift baseline down of its statistical uncertainty"); + } + return fBaseline; } @@ -485,6 +737,33 @@ Double_t DhCorrelationFitter::FindBaseline() fBaseline = Av; fErrBaseline = errAv; + if (fShiftBaselineUp) { + fBaseline += fErrBaseline; + printf("[INFO] Shift baseline up of its statistical uncertainty \n"); + } + + if (fShiftBaselineDown) { + fBaseline -= fErrBaseline; + printf("[INFO] Shift baseline down of its statistical uncertainty \n"); + } + + return fBaseline; + } + + if (fFixBase == 4) { + fBaseline = CalculateBaseline(fHist, fIsTotal); // TODO: add the option for total range/ reflected range to pass in input + fErrBaseline = CalculateBaselineError(fHist, fIsTotal); + + if (fShiftBaselineUp) { + fBaseline += fErrBaseline; + printf("[INFO] Shift baseline up of its statistical uncertainty \n"); + } + + if (fShiftBaselineDown) { + fBaseline -= fErrBaseline; + printf("[INFO] Shift baseline down of its statistical uncertainty \n"); + } + return fBaseline; } @@ -492,6 +771,26 @@ Double_t DhCorrelationFitter::FindBaseline() return -1.; } +void DhCorrelationFitter::FitBaselineWv2() +{ + + fBaseTransvReg = new TF1("fBaseTransvReg", [](double* x, double* p) { + double xx = x[0]; // x value + if ((xx >= -TMath::Pi()/2 && xx <= -3*TMath::Pi()/8) || (xx >= 3*TMath::Pi()/8 && xx <= 5*TMath::Pi()/8) || (xx >= 11*TMath::Pi()/8 && xx <= 3*TMath::Pi()/2)) { + // Gaussian example: p[0] = amplitude, p[1] = mean, p[2] = sigma + return p[0]*(1+2*p[1]*p[2]*TMath::Cos(2*xx)); + } + return 0.; }, -TMath::Pi() / 2, 3 * TMath::Pi() / 2, 3); // Function valid for [0,10], with 3 parameters + + fBaseTransvReg->FixParameter(1, fv2AssocPart); + fBaseTransvReg->FixParameter(2, fv2Dmeson); + + TFitResultPtr rFit = fHist->Fit(fBaseTransvReg, "RIMES", "", fMinCorr, fMaxCorr); + fBaseline = fBaseTransvReg->GetParameter(0); + + return; +} + void DhCorrelationFitter::CalculateYieldsAboveBaseline() { @@ -502,23 +801,28 @@ void DhCorrelationFitter::CalculateYieldsAboveBaseline() cout << "[RESULT] Baseline: " << fBaseline << " +- " << fErrBaseline << endl; Int_t binMinNS = fHist->FindBin(-1.5); // slightly more than -pi/2 if (binMinNS < 1) - binMinNS = 1; // with this, it is ok even in the case of a reflected fHist (range 0 - pi) - Int_t binMaxNS = fHist->FindBin(1.5); // slightly less than +pi/2 - Int_t binMinAS = fHist->FindBin(1.6); // slightly more than +pi/2 - Int_t binMaxAS = fHist->FindBin(3.14 + 1.5); // slightly less than +3pi/2 + binMinNS = 1; // with this, it is ok even in the case of a reflected fHist (range 0 - pi) + Int_t binMaxNS = 6; // fHist -> FindBin(1.5); // slightly less than +pi/2 + Int_t binMinAS = 11; // fHist -> FindBin(1.6); // slightly more than +pi/2 + Int_t binMaxAS = 16; // fHist -> FindBin(3.14+1.5); // slightly less than +3pi/2 if (binMaxAS > fHist->GetNbinsX()) - binMaxNS = fHist->GetNbinsX(); // with this, it is ok even in the case of a reflected fHist (range 0 - pi) TODO: maybe binMaxAS + binMaxAS = fHist->GetNbinsX(); // with this, it is ok even in the case of a reflected fHist (range 0 - pi) + cout << "N bins : " << fHist->GetNbinsX() << endl; + cout << "binMinNS : " << binMinNS << endl; + cout << "binMaxNS : " << binMaxNS << endl; + cout << "binMinAS : " << binMinAS << endl; + cout << "binMaxAS : " << binMaxAS << endl; // Near Side Yield from bin counting for (Int_t bmNS = binMinNS; bmNS <= binMaxNS; bmNS++) { - fNSyieldBinCount += (fHist->GetBinContent(bmNS) - fBaseline) * fHist->GetBinWidth(bmNS); - fErrNSyieldBinCount += (fHist->GetBinError(bmNS) * fHist->GetBinError(bmNS)) * fHist->GetBinWidth(bmNS) * fHist->GetBinWidth(bmNS); + fNSyieldBinCount += 2 * (fHist->GetBinContent(bmNS) - fBaseline) * fHist->GetBinWidth(bmNS); + fErrNSyieldBinCount += 4 * (fHist->GetBinError(bmNS) * fHist->GetBinError(bmNS)) * fHist->GetBinWidth(bmNS) * fHist->GetBinWidth(bmNS); } fErrNSyieldBinCount = TMath::Sqrt(fErrNSyieldBinCount); // Away Side Yield from bin counting for (Int_t bmAS = binMinAS; bmAS <= binMaxAS; bmAS++) { - fASyieldBinCount += (fHist->GetBinContent(bmAS) - fBaseline) * fHist->GetBinWidth(bmAS); - fErrASyieldBinCount += (fHist->GetBinError(bmAS) * fHist->GetBinError(bmAS)) * fHist->GetBinWidth(bmAS) * fHist->GetBinWidth(bmAS); + fASyieldBinCount += 2 * (fHist->GetBinContent(bmAS) - fBaseline) * fHist->GetBinWidth(bmAS); + fErrASyieldBinCount += 4 * (fHist->GetBinError(bmAS) * fHist->GetBinError(bmAS)) * fHist->GetBinWidth(bmAS) * fHist->GetBinWidth(bmAS); } fErrASyieldBinCount = TMath::Sqrt(fErrASyieldBinCount); @@ -527,55 +831,322 @@ void DhCorrelationFitter::CalculateYieldsAboveBaseline() return; } +Double_t DhCorrelationFitter::CalculateBaseline(TH1F*& histo, Bool_t totalRange) +{ + + // total range = 2*Pi + // half range = Pi , for histogram reflected under symmetric assumption + + Double_t baseline, errBaseline; + Int_t nBinsPhi = histo->GetNbinsX(); + Int_t binPhiHalf = nBinsPhi / 2; + Int_t binPhiHalfMinus1 = nBinsPhi / 2 - 1; + Int_t binPhiHalfPlus1 = nBinsPhi / 2 + 1; + Int_t binPhiHalfPlus2 = nBinsPhi / 2 + 1; + + if (totalRange) { + printf("[INFO] Using total deltaPhi range \n"); + // baseline evaluated considering: the two first points, the last two points and four points in the middle (corresponding to the outer points) + if (nBinsPhi >= 32) { + printf("[INFO] nBinsPhi >= 32 \n"); + baseline = + ((histo->GetBinContent(1)) * (1. / TMath::Power(histo->GetBinError(1), 2)) + + (histo->GetBinContent(2)) * (1. / TMath::Power(histo->GetBinError(2), 2)) + + (histo->GetBinContent(binPhiHalfMinus1)) * (1. / TMath::Power(histo->GetBinError(binPhiHalfMinus1), 2)) + + (histo->GetBinContent(binPhiHalf)) * (1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (histo->GetBinContent(binPhiHalfPlus1)) * (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2)) + + (histo->GetBinContent(binPhiHalfPlus2)) * (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus2), 2)) + + (histo->GetBinContent(nBinsPhi - 1)) * (1. / TMath::Power(histo->GetBinError(nBinsPhi - 1), 2)) + + (histo->GetBinContent(nBinsPhi)) * (1. / TMath::Power(histo->GetBinError(nBinsPhi), 2))) / + ((1. / TMath::Power(histo->GetBinError(1), 2)) + + (1. / TMath::Power(histo->GetBinError(2), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfMinus1), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus2), 2)) + + (1. / TMath::Power(histo->GetBinError(nBinsPhi - 1), 2)) + + (1. / TMath::Power(histo->GetBinError(nBinsPhi), 2))); + } else { + printf("[INFO] nBinsPhi < 32 \n"); + baseline = + ((histo->GetBinContent(1)) * (1. / TMath::Power(histo->GetBinError(1), 2)) + + (histo->GetBinContent(binPhiHalf)) * (1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (histo->GetBinContent(binPhiHalfPlus1)) * (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2)) + + (histo->GetBinContent(nBinsPhi)) * (1. / TMath::Power(histo->GetBinError(nBinsPhi), 2))) / + ((1. / TMath::Power(histo->GetBinError(1), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2)) + + (1. / TMath::Power(histo->GetBinError(nBinsPhi), 2))); + } + } else { + printf("[INFO] Using reflected deltaPhi range \n"); + // baseline evaluated using the 4 middle points in the transverese region + if (nBinsPhi >= 16) { + printf("[INFO] 4 central points in the transverse region for baseline \n"); + baseline = + ((histo->GetBinContent(binPhiHalfMinus1)) * (1. / TMath::Power(histo->GetBinError(binPhiHalfMinus1), 2)) + + (histo->GetBinContent(binPhiHalf)) * (1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (histo->GetBinContent(binPhiHalfPlus1)) * (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2)) + + (histo->GetBinContent(binPhiHalfPlus2)) * (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus2), 2))) / + ((1. / TMath::Power(histo->GetBinError(binPhiHalfMinus1), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus2), 2))); + } else { + baseline = + ((histo->GetBinContent(binPhiHalf)) * (1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (histo->GetBinContent(binPhiHalfPlus1)) * (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2))) / + ((1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2))); + } + } + + return baseline; +} + +Double_t DhCorrelationFitter::CalculateBaselineError(TH1F*& histo, Bool_t totalRange) +{ + + // total range = 2*Pi + // half range = Pi , for histogram reflected under symmetric assumption + + Double_t errBaseline; + Int_t nBinsPhi = histo->GetNbinsX(); + Int_t binPhiHalf = nBinsPhi / 2; + Int_t binPhiHalfMinus1 = nBinsPhi / 2 - 1; + Int_t binPhiHalfPlus1 = nBinsPhi / 2 + 1; + Int_t binPhiHalfPlus2 = nBinsPhi / 2 + 1; + + if (totalRange) { + // baseline evaluated considering: the two first points, the last two points and four points in the middle (corresponding to the outer points) + if (nBinsPhi >= 32) { + errBaseline = 1. / + TMath::Sqrt((1. / TMath::Power(histo->GetBinError(1), 2)) + + (1. / TMath::Power(histo->GetBinError(2), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfMinus1), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus2), 2)) + + (1. / TMath::Power(histo->GetBinError(nBinsPhi - 1), 2)) + + (1. / TMath::Power(histo->GetBinError(nBinsPhi), 2))); + } else { // fon nBinsPhi = 16 (rebin 4) + errBaseline = 1. / + TMath::Sqrt((1. / TMath::Power(histo->GetBinError(1), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2)) + + (1. / TMath::Power(histo->GetBinError(nBinsPhi), 2))); + } + } else { + // baseline evaluated using the 4 middle points in the transverese region + if (nBinsPhi >= 32) { + errBaseline = 1. / + TMath::Sqrt((1. / TMath::Power(histo->GetBinError(binPhiHalfMinus1), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus2), 2))); + } else { + errBaseline = 1. / + TMath::Sqrt((1. / TMath::Power(histo->GetBinError(binPhiHalf), 2)) + + (1. / TMath::Power(histo->GetBinError(binPhiHalfPlus1), 2))); + } + } + + return errBaseline; +} + void DhCorrelationFitter::SetSingleTermsForDrawing(Bool_t draw) { Double_t* par = 0; - if (fTypeOfFitFunc == 1 || fTypeOfFitFunc == 2) { + if (fTypeOfFitFunc == 1 || fTypeOfFitFunc == 2 || fTypeOfFitFunc == 5) { par = new Double_t[7]; + } else if (fTypeOfFitFunc == 3 || fTypeOfFitFunc == 6) { + par = new Double_t[4]; + } else if (fTypeOfFitFunc == 4) { + par = new Double_t[8]; + } else if (fTypeOfFitFunc == 7) { + par = new Double_t[9]; } else { Printf("[ERROR] DhCorrelationFitter::SetSingleTermsForDrawing, wrong type of function"); return; } - fFit->GetParameters(par); - fFit->SetLineWidth(4); - - fPed->SetParameter(0, par[0]); - fPed->SetLineColor(6); // pink - fPed->SetLineStyle(9); - fPed->SetLineWidth(4); - - fGausNS->SetParameter(0, par[1]); - fGausNS->SetParameter(1, par[2]); - fGausNS->SetParameter(2, par[3]); - fGausAS->SetParameter(0, par[4]); - fGausAS->SetParameter(1, par[5]); - fGausAS->SetParameter(2, par[6]); - - fGausNS->SetLineStyle(9); - fGausNS->SetLineColor(kBlue); - fGausAS->SetLineStyle(9); - fGausAS->SetLineColor(kGreen); - fGausNS->SetLineWidth(4); - fGausAS->SetLineWidth(4); - - TPaveText* pvStatTests1 = new TPaveText(0.51, 0.58, 0.85, 0.90, "NDC"); - pvStatTests1->SetFillStyle(0); - pvStatTests1->SetTextSize(0.035); - pvStatTests1->SetBorderSize(0); - TText *t0, *t1, *t2, *t3, *t4, *t5, *t6; - t0 = pvStatTests1->AddText(0., 1.00, Form("#chi^{2}/ndf = %.1f/%d ", fFit->GetChisquare(), fFit->GetNDF())); - t1 = pvStatTests1->AddText(0., 0.80, Form("Ped = %.3f#pm%.3f ", fBaseline, fErrBaseline)); - t2 = pvStatTests1->AddText(0., 0.65, Form("NS Y = %.3f#pm%.3f ", fFit->GetParameter("NS Y"), fFit->GetParError(fFit->GetParNumber("NS Y")))); - t3 = pvStatTests1->AddText(0., 0.50, Form("NS #sigma = %.3f#pm%.3f ", fFit->GetParameter("NS #sigma"), fFit->GetParError(fFit->GetParNumber("NS #sigma")))); - t4 = pvStatTests1->AddText(0., 0.35, Form("AS Y = %.3f#pm%.3f ", fFit->GetParameter("AS Y"), fFit->GetParError(fFit->GetParNumber("AS Y")))); - t5 = pvStatTests1->AddText(0., 0.20, Form("AS #sigma = %.3f#pm%.3f ", fFit->GetParameter("AS #sigma"), fFit->GetParError(fFit->GetParNumber("AS #sigma")))); - - if (draw) { - fFit->Draw("same"); - fPed->Draw("same"); - fGausAS->Draw("same"); - fGausNS->Draw("same"); - pvStatTests1->Draw("same"); + if (fTypeOfFitFunc == 3 || fTypeOfFitFunc == 6) { + fFit->GetParameters(par); + fFit->SetLineWidth(4); + + fPed->SetParameter(0, par[0]); + fPed->SetLineColor(6); // pink + fPed->SetLineStyle(9); + fPed->SetLineWidth(4); + + fGausAS->SetParameter(0, par[1]); + fGausAS->SetParameter(1, par[2]); + fGausAS->SetParameter(2, par[3]); + + fGausAS->SetLineStyle(9); + fGausAS->SetLineColor(kGreen); + fGausAS->SetLineWidth(4); + + TPaveText* pvStatTests1 = new TPaveText(0.51, 0.58, 0.85, 0.90, "NDC"); + pvStatTests1->SetFillStyle(0); + pvStatTests1->SetTextSize(0.045); + pvStatTests1->SetBorderSize(0); + TText *t0, *t1, *t2, *t3; + t0 = pvStatTests1->AddText(0., 1.00, Form("#chi^{2}/ndf = %.1f/%d ", fFit->GetChisquare(), fFit->GetNDF())); + t1 = pvStatTests1->AddText(0., 0.80, Form("Ped = %.3f#pm%.3f ", fBaseline, fErrBaseline)); + t2 = pvStatTests1->AddText(0., 0.65, Form("AS Y = %.3f#pm%.3f ", fFit->GetParameter("AS Y"), fFit->GetParError(fFit->GetParNumber("AS Y")))); + t3 = pvStatTests1->AddText(0., 0.50, Form("AS #sigma = %.3f#pm%.3f ", fFit->GetParameter("AS #sigma"), fFit->GetParError(fFit->GetParNumber("AS #sigma")))); + + if (draw) { + fFit->Draw("same"); + fPed->Draw("same"); + fGausAS->Draw("same"); + pvStatTests1->Draw("same"); + } + } else if (fTypeOfFitFunc == 4) { + fFit->GetParameters(par); + fFit->SetLineWidth(4); + + fPed->SetParameter(0, par[0]); + fPed->SetLineColor(6); // pink + fPed->SetLineStyle(9); + fPed->SetLineWidth(4); + + fGausNS->SetParameter(0, par[1]); + fGausNS->SetParameter(1, par[2]); + fGausNS->SetParameter(2, par[3]); + fGausNS->SetParameter(3, par[7]); + fGausAS->SetParameter(0, par[4]); + fGausAS->SetParameter(1, par[5]); + fGausAS->SetParameter(2, par[6]); + + fGausNS->SetLineStyle(9); + fGausNS->SetLineColor(kBlue); + fGausAS->SetLineStyle(9); + fGausAS->SetLineColor(kGreen); + fGausNS->SetLineWidth(4); + fGausAS->SetLineWidth(4); + + TPaveText* pvStatTests1 = new TPaveText(0.51, 0.58, 0.85, 0.90, "NDC"); + pvStatTests1->SetFillStyle(0); + pvStatTests1->SetTextSize(0.045); + pvStatTests1->SetBorderSize(0); + TText *t0, *t1, *t2, *t3, *t4, *t5, *t6; + t0 = pvStatTests1->AddText(0., 1.00, Form("#chi^{2}/ndf = %.1f/%d ", fFit->GetChisquare(), fFit->GetNDF())); + t1 = pvStatTests1->AddText(0., 0.80, Form("Ped = %.3f#pm%.3f ", fBaseline, fErrBaseline)); + t2 = pvStatTests1->AddText(0., 0.65, Form("NS Y = %.3f#pm%.3f ", fFit->GetParameter("NS Y"), fFit->GetParError(fFit->GetParNumber("NS Y")))); + t3 = pvStatTests1->AddText(0., 0.50, Form("NS #sigma = %.3f#pm%.3f ", fFit->GetParameter("NS #sigma"), fFit->GetParError(fFit->GetParNumber("NS #sigma")))); + t4 = pvStatTests1->AddText(0., 0.35, Form("AS Y = %.3f#pm%.3f ", fFit->GetParameter("AS Y"), fFit->GetParError(fFit->GetParNumber("AS Y")))); + t5 = pvStatTests1->AddText(0., 0.20, Form("AS #sigma = %.3f#pm%.3f ", fFit->GetParameter("AS #sigma"), fFit->GetParError(fFit->GetParNumber("AS #sigma")))); + t6 = pvStatTests1->AddText(0., 0.05, Form("#beta = %.3f#pm%.3f ", fFit->GetParameter("NS shape par"), fFit->GetParError(fFit->GetParNumber("NS shape par")))); + + if (draw) { + fFit->Draw("same"); + fPed->Draw("same"); + fGausAS->Draw("same"); + fGausNS->Draw("same"); + pvStatTests1->Draw("same"); + } + } else if (fTypeOfFitFunc == 7) { + fFit->GetParameters(par); + fFit->SetLineWidth(4); + + fBaseTransvReg->SetLineColor(15); + fBaseTransvReg->SetLineStyle(9); + fBaseTransvReg->SetLineWidth(4); + + fPed->SetParameter(0, par[0]); + fPed->SetParameter(1, par[7]); + fPed->SetParameter(2, par[8]); + fPed->SetLineColor(6); // pink + fPed->SetLineStyle(9); + fPed->SetLineWidth(4); + + fGausNS->SetParameter(0, par[1]); + fGausNS->SetParameter(1, par[2]); + fGausNS->SetParameter(2, par[3]); + // fGausNS -> SetParameter(3, par[7]); + fGausAS->SetParameter(0, par[4]); + fGausAS->SetParameter(1, par[5]); + fGausAS->SetParameter(2, par[6]); + + fGausNS->SetLineStyle(9); + fGausNS->SetLineColor(kBlue); + fGausAS->SetLineStyle(9); + fGausAS->SetLineColor(kGreen); + fGausNS->SetLineWidth(4); + fGausAS->SetLineWidth(4); + + TPaveText* pvStatTests1 = new TPaveText(0.51, 0.58, 0.85, 0.90, "NDC"); + pvStatTests1->SetFillStyle(0); + pvStatTests1->SetTextSize(0.045); + pvStatTests1->SetBorderSize(0); + TText *t0, *t1, *t2, *t3, *t4, *t5, *t6, *t7, *t8; + t0 = pvStatTests1->AddText(0., 1.00, Form("#chi^{2}/ndf = %.1f/%d ", fFit->GetChisquare(), fFit->GetNDF())); + t2 = pvStatTests1->AddText(0., 0.80, Form("NS Y = %.3f#pm%.3f ", fFit->GetParameter("NS Y"), fFit->GetParError(fFit->GetParNumber("NS Y")))); + t3 = pvStatTests1->AddText(0., 0.65, Form("NS #sigma = %.3f#pm%.3f ", fFit->GetParameter("NS #sigma"), fFit->GetParError(fFit->GetParNumber("NS #sigma")))); + t4 = pvStatTests1->AddText(0., 0.50, Form("AS Y = %.3f#pm%.3f ", fFit->GetParameter("AS Y"), fFit->GetParError(fFit->GetParNumber("AS Y")))); + t5 = pvStatTests1->AddText(0., 0.35, Form("AS #sigma = %.3f#pm%.3f ", fFit->GetParameter("AS #sigma"), fFit->GetParError(fFit->GetParNumber("AS #sigma")))); + // t6 = pvStatTests1 -> AddText(0., 0.20, Form("#beta = %.3f#pm%.3f ", fFit -> GetParameter("NS shape par"), fFit -> GetParError(fFit->GetParNumber("NS shape par")))); + + TPaveText* pvStatTests2 = new TPaveText(0.51, 0.28, 0.85, 0.60, "NDC"); + pvStatTests2->SetFillStyle(0); + pvStatTests2->SetTextSize(0.045); + pvStatTests2->SetBorderSize(0); + t1 = pvStatTests2->AddText(0., 1.00, Form("Ped = %.3f#pm%.3f ", fFit->GetParameter("ped"), fErrBaseline /*fFit -> GetParError(fFit->GetParNumber("ped")*/)); + t7 = pvStatTests2->AddText(0., 0.65, Form("v_{2}^{hadron} = %.3f#pm%.3f ", fFit->GetParameter("v_{2} hadron"), fFit->GetParError(fFit->GetParNumber("v_{2} hadron")))); + t8 = pvStatTests2->AddText(0., 0.35, Form("v_{2}^{D} = %.3f#pm%.3f ", fFit->GetParameter("v_{2} D meson"), fFit->GetParError(fFit->GetParNumber("v_{2} D meson")))); + + if (draw) { + fFit->Draw("same"); + fPed->Draw("same"); + fBaseTransvReg->Draw("same"); + fGausAS->Draw("same"); + fGausNS->Draw("same"); + pvStatTests1->Draw("same"); + pvStatTests2->Draw("same"); + } + } else { + fFit->GetParameters(par); + fFit->SetLineWidth(4); + + fPed->SetParameter(0, par[0]); + fPed->SetLineColor(6); // pink + fPed->SetLineStyle(9); + fPed->SetLineWidth(4); + + fGausNS->SetParameter(0, par[1]); + fGausNS->SetParameter(1, par[2]); + fGausNS->SetParameter(2, par[3]); + fGausAS->SetParameter(0, par[4]); + fGausAS->SetParameter(1, par[5]); + fGausAS->SetParameter(2, par[6]); + + fGausNS->SetLineStyle(9); + fGausNS->SetLineColor(kBlue); + fGausAS->SetLineStyle(9); + fGausAS->SetLineColor(kGreen); + fGausNS->SetLineWidth(4); + fGausAS->SetLineWidth(4); + + TPaveText* pvStatTests1 = new TPaveText(0.51, 0.58, 0.85, 0.90, "NDC"); + pvStatTests1->SetFillStyle(0); + pvStatTests1->SetTextSize(0.045); + pvStatTests1->SetBorderSize(0); + TText *t0, *t1, *t2, *t3, *t4, *t5, *t6; + t0 = pvStatTests1->AddText(0., 1.00, Form("#chi^{2}/ndf = %.1f/%d ", fFit->GetChisquare(), fFit->GetNDF())); + t1 = pvStatTests1->AddText(0., 0.80, Form("Ped = %.3f#pm%.3f ", fBaseline, fErrBaseline)); + t2 = pvStatTests1->AddText(0., 0.65, Form("NS Y = %.3f#pm%.3f ", fFit->GetParameter("NS Y"), fFit->GetParError(fFit->GetParNumber("NS Y")))); + t3 = pvStatTests1->AddText(0., 0.50, Form("NS #sigma = %.3f#pm%.3f ", fFit->GetParameter("NS #sigma"), fFit->GetParError(fFit->GetParNumber("NS #sigma")))); + t4 = pvStatTests1->AddText(0., 0.35, Form("AS Y = %.3f#pm%.3f ", fFit->GetParameter("AS Y"), fFit->GetParError(fFit->GetParNumber("AS Y")))); + t5 = pvStatTests1->AddText(0., 0.20, Form("AS #sigma = %.3f#pm%.3f ", fFit->GetParameter("AS #sigma"), fFit->GetParError(fFit->GetParNumber("AS #sigma")))); + + if (draw) { + fFit->Draw("same"); + fPed->Draw("same"); + fGausAS->Draw("same"); + fGausNS->Draw("same"); + pvStatTests1->Draw("same"); + } } } diff --git a/PWGHF/HFC/Macros/DhCorrelationFitter.h b/PWGHF/HFC/Macros/DhCorrelationFitter.h index a4bdf3c3bb1..8a9db7fe6e7 100644 --- a/PWGHF/HFC/Macros/DhCorrelationFitter.h +++ b/PWGHF/HFC/Macros/DhCorrelationFitter.h @@ -17,18 +17,24 @@ #ifndef PWGHF_HFC_MACROS_DHCORRELATIONFITTER_H_ #define PWGHF_HFC_MACROS_DHCORRELATIONFITTER_H_ -#include - -#include #include #include +#include + +#include + class DhCorrelationFitter { public: enum FunctionType { kConstwoGaus = 1, - kTwoGausPeriodicity = 2 }; + kTwoGausPeriodicity = 2, + kSingleGaus = 3, + kGenGaus = 4, + kVonMises = 5, + kSingleVonMises = 6, + kTwoGausPeriodicityPlusV2modulation = 7 }; /// Constructors DhCorrelationFitter(); @@ -51,11 +57,25 @@ class DhCorrelationFitter } void SetExternalValsAndBounds(Int_t nPars, Double_t* vals, Double_t* lowBounds, Double_t* uppBounds); void SetPointsForBaseline(Int_t nBaselinePoints, Int_t* binsBaseline); + void SetReflectedCorrHisto(Bool_t isReflected) { fIsTotal = !isReflected; } + void SetBaselineUpOrDown(Bool_t baseUp, Bool_t baseDown) + { + fShiftBaselineUp = baseUp; + fShiftBaselineDown = baseDown; + } + void Setv2(Double_t v2AssocPart, Double_t v2Dmeson) + { + fv2AssocPart = v2AssocPart; + fv2Dmeson = v2Dmeson; + } /// Functions for fitting void Fitting(Bool_t drawSplitTerm = kTRUE, Bool_t useExternalPars = kFALSE); void SetFitFunction(); void CalculateYieldsAboveBaseline(); + void FitBaselineWv2(); + Double_t CalculateBaseline(TH1F*& histo, Bool_t totalRange = kTRUE); + Double_t CalculateBaselineError(TH1F*& histo, Bool_t totalRange = kTRUE); void SetSingleTermsForDrawing(Bool_t draw); Double_t FindBaseline(); @@ -92,13 +112,17 @@ class DhCorrelationFitter private: TH1F* fHist; // 1D azimuthal correlation histogram - TF1* fFit; // Total fit function - TF1* fGausNS; // Near-Side (NS) Gaussian - TF1* fGausAS; // Away-Side (AS) Gaussian - TF1* fPed; // Baseline function + TF1* fFit; // Total fit function + TF1* fGausNS; // Near-Side (NS) Gaussian + TF1* fGausAS; // Away-Side (AS) Gaussian + TF1* fPed; // Baseline function + TF1* fBaseTransvReg; // Baseline function with v2 - Bool_t fIsReflected; - Bool_t fUseExternalPars; // To use external fit parameters initial values and bounds + Bool_t fIsReflected; // To use if reflected azimuthal correlation are given as input + Bool_t fUseExternalPars; // To use external fit parameters initial values and bounds + Bool_t fShiftBaselineUp; // To shift the baseline up of its statistical uncertainty + Bool_t fShiftBaselineDown; // To shift baseline down of its statistical uncertainty + Bool_t fIsTotal; // Total range of 2*pi in the azimuthal correlation distribution FunctionType fTypeOfFitFunc; // Type of fit function @@ -121,6 +145,8 @@ class DhCorrelationFitter Double_t fErrNSyieldBinCount; // NS Yield error from bin counting Double_t fASyieldBinCount; // AS Yield from bin counting Double_t fErrASyieldBinCount; // AS Yield error from bin counting + Double_t fv2AssocPart; // v2 associated particles + Double_t fv2Dmeson; // v2 of D mesons Double_t* fExtParsVals; // Fit parameters initial values Double_t* fExtParsLowBounds; // Fit parameters lower bounds diff --git a/PWGHF/HFC/Macros/ExtractOutputCorrel.C b/PWGHF/HFC/Macros/ExtractOutputCorrel.C index 301434f66e2..e263a810ff1 100644 --- a/PWGHF/HFC/Macros/ExtractOutputCorrel.C +++ b/PWGHF/HFC/Macros/ExtractOutputCorrel.C @@ -9,19 +9,26 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file ExtractOutputCorrel.C -/// \brief Macro to perform the correlation extraction +/// \file DhCorrelationExtraction.cxx +/// \brief class for D-h correlation extraction /// \usage .L DhCorrelationExtraction.cxx+ /// \usage .x ExtractOutputCorrel.C("config-file-name") /// \author Samuele Cattaruzzi /// \author Swapnesh Santosh Khade +#include "DhCorrelationExtraction.h" #include "Riostream.h" + #include #include + #include #include -#include "DhCorrelationExtraction.h" + +#include +#include +#include +#include using namespace rapidjson; @@ -34,7 +41,7 @@ void readArray(const Value& jsonArray, std::vector& output) } } -void parseStringArray(const Value& jsonArray, std::vector& output) +void parseStringArray(const Value& jsonArray, std::vector& output) { size_t arrayLength = jsonArray.Size(); for (size_t i = 0; i < arrayLength; i++) { @@ -44,10 +51,13 @@ void parseStringArray(const Value& jsonArray, std::vector& output) } } -void SetInputCorrelNames(DhCorrelationExtraction* plotter, TString pathFileMass, TString pathFileSE, TString pathFileME, TString dirSE, TString dirME, TString histoNameCorrSignal, TString histoNameCorrSideba); -void SetInputHistoInvMassNames(DhCorrelationExtraction* plotter, std::vector inputMassNames); +void SetInputCorrelNames(DhCorrelationExtraction* plotter, TString pathFileSE, TString pathFileME, TString dirSE, TString dirME, TString histoNameCorrSignal, TString histoNameCorrSideba, TString histoNameCorrSidebaLeft, TString histoNameCorrSidebaRight); +void SetInputHistoInvMassNames(DhCorrelationExtraction* plotter, TString pathFileMass, std::vector inputMassNames); +void SetInputHistoFDSubtraction(DhCorrelationExtraction* plotter, TString pathFileFDTemplate, TString pathFileFDPromptFrac, TString histoNameFDTemplatePrompt, TString histoNameFDTemplateNonPrompt, TString histoNameRawFracPrompt); +void SetInputHistoSecPart(DhCorrelationExtraction* plotter, TString pathFileSecPart, TString dirSecPartName, TString histoNamePrimaryPart, TString histoNameAllPart); +void SetInputHistoBiasBtoD(DhCorrelationExtraction* plotter, TString pathfFilePromptMcRec, TString pathfFileNonPromptMcRec); -void ExtractOutputCorrel(TString cfgFileName = "config_CorrAnalysis.json") +void ExtractOutputCorrel_Ds(const TString cfgFileName = "config_CorrAnalysis.json") { // gStyle -> SetOptStat(0); gStyle->SetPadLeftMargin(0.15); @@ -72,24 +82,37 @@ void ExtractOutputCorrel(TString cfgFileName = "config_CorrAnalysis.json") string pathFileSE = config["pathFileSE"].GetString(); string pathFileME = config["pathFileME"].GetString(); string pathFileMass = config["pathFileMass"].GetString(); + string pathFileFDTemplate = config["pathFileFDTemplate"].GetString(); + string pathFileFDPromptFrac = config["pathFileFDPromptFrac"].GetString(); + string pathFileSecPart = config["pathFileSecPart"].GetString(); + string pathfFilePromptMcRec = config["pathfFilePromptMcRec"].GetString(); + string pathfFileNonPromptMcRec = config["pathfFileNonPromptMcRec"].GetString(); string dirSE = config["InputDirSE"].GetString(); string dirME = config["InputDirME"].GetString(); + string dirSecPart = config["InputDirSecPart"].GetString(); string histoNameCorrSignal = config["InputHistoCorrSignalName"].GetString(); string histoNameCorrSideba = config["InputHistoCorrSidebaName"].GetString(); + string histoNameCorrSidebaLeft = config["InputHistoCorrSidebaLeftName"].GetString(); + string histoNameCorrSidebaRight = config["InputHistoCorrSidebaRightName"].GetString(); + string histoNameFDTemplatePrompt = config["InputHistoFDTemplatePrompt"].GetString(); + string histoNameFDTemplateNonPrompt = config["InputHistoFDTemplateNonPrompt"].GetString(); + string histoNameRawFracPrompt = config["InputHistoFDPromptFrac"].GetString(); + string histoNamePrimaryPart = config["InputHistoPrimaryPart"].GetString(); + string histoNameAllPart = config["InputHistoAllPart"].GetString(); - vector InputHistoMassName; + std::vector InputHistoMassName; const Value& inputMassNames = config["InputHistoMassName"]; parseStringArray(inputMassNames, InputHistoMassName); - cout << InputHistoMassName[0].data() << endl; - cout << InputHistoMassName[1].data() << endl; - cout << InputHistoMassName[2].data() << endl; + std::cout << InputHistoMassName[0].data() << std::endl; + std::cout << InputHistoMassName[1].data() << std::endl; + std::cout << InputHistoMassName[2].data() << std::endl; - vector binsPtCandIntervals; - vector binsPtHadIntervals; - vector deltaEtaInterval; + std::vector binsPtCandIntervals; + std::vector binsPtHadIntervals; + std::vector deltaEtaInterval; const Value& PtCandValue = config["binsPtCandIntervals"]; readArray(PtCandValue, binsPtCandIntervals); @@ -103,9 +126,24 @@ void ExtractOutputCorrel(TString cfgFileName = "config_CorrAnalysis.json") double deltaEtaMax = deltaEtaInterval[1]; int specie = config["DmesonSpecie"].GetInt(); + bool rebinAngCorr = config["RebinAngCorr"].GetBool(); + bool rebinFDCorr = config["RebinFDCorr"].GetBool(); + bool rebinSecPart = config["RebinSecPart"].GetBool(); + int rebinDeltaPhi = config["nRebinDeltaPhi"].GetInt(); + int rebinDeltaEta = config["nRebinDeltaEta"].GetInt(); int npools = config["NumberOfPools"].GetInt(); bool poolByPool = config["CorrectPoolsSeparately"].GetBool(); + bool applySecPartCorr = config["ApplySecPartCorr"].GetBool(); + bool applyBiasBtoDCorr = config["ApplyBiasBtoDCorr"].GetBool(); + bool applyFDCorr = config["ApplyFDCorr"].GetBool(); + bool isDividedSideb = config["IsDividedSideb"].GetBool(); + bool useSidebLeft = config["UseSidebLeft"].GetBool(); + bool useSidebRight = config["UseSidebRight"].GetBool(); + + if (useSidebLeft && useSidebLeft) { + std::cout << "Using left and right" << std::endl; + } std::cout << "=========================== " << std::endl; std::cout << "Input variables from config" << std::endl; @@ -121,6 +159,9 @@ void ExtractOutputCorrel(TString cfgFileName = "config_CorrAnalysis.json") const int nBinsPtHad = binsPtHadIntervals.size() - 1; TH1D* hCorrectedCorrel[nBinsPtCand][nBinsPtHad]; + TH1D* hCorrectedCorrel_BaselineSubtr[nBinsPtCand][nBinsPtHad]; + TH1D* hCorrectedCorrel_Reflected[nBinsPtCand][nBinsPtHad]; + TH1D* hCorrectedCorrel_Reflected_BaselineSubtr[nBinsPtCand][nBinsPtHad]; // Create and set the correlation plotter class DhCorrelationExtraction* plotter = new DhCorrelationExtraction(); @@ -128,30 +169,55 @@ void ExtractOutputCorrel(TString cfgFileName = "config_CorrAnalysis.json") Bool_t flagSpecie = plotter->SetDmesonSpecie(static_cast(specie)); plotter->SetNpools(npools); plotter->SetCorrectPoolsSeparately(poolByPool); // kTRUE = pool.by-pool extraction and correction; kFALSE = merged ME pools + plotter->SetFDSubtraction(applyFDCorr); + plotter->SetSecPartContamination(applySecPartCorr); plotter->SetDeltaEtaRange(deltaEtaMin, deltaEtaMax); plotter->SetSubtractSoftPiInMEdistr(kFALSE); - plotter->SetRebin2DcorrelHisto(2, 2); // Xaxis: deltaEta, Yaxis: deltaPhi + plotter->SetRebinOptions(rebinAngCorr, rebinFDCorr, rebinSecPart); + plotter->SetRebin2DcorrelHisto(rebinDeltaEta, rebinDeltaPhi); // Xaxis: deltaEta, Yaxis: deltaPhi + plotter->SetCorrBiasBtoD(applyBiasBtoDCorr); plotter->SetDebugLevel(1); if (!flagSpecie) - cout << "[ERROR] Wrong D meson flag" << endl; + std::cout << "[ERROR] Wrong D meson flag" << std::endl; // Set the input file config - SetInputCorrelNames(plotter, pathFileMass, pathFileSE, pathFileME, dirSE, dirME, histoNameCorrSignal, histoNameCorrSideba); - SetInputHistoInvMassNames(plotter, InputHistoMassName); + SetInputCorrelNames(plotter, pathFileSE, pathFileME, dirSE, dirME, histoNameCorrSignal, histoNameCorrSideba, histoNameCorrSidebaLeft, histoNameCorrSidebaRight); + SetInputHistoInvMassNames(plotter, pathFileMass, InputHistoMassName); + if (applyFDCorr) + SetInputHistoFDSubtraction(plotter, pathFileFDTemplate, pathFileFDPromptFrac, histoNameFDTemplatePrompt, histoNameFDTemplateNonPrompt, histoNameRawFracPrompt); + if (applySecPartCorr) + SetInputHistoSecPart(plotter, pathFileSecPart, dirSecPart, histoNamePrimaryPart, histoNameAllPart); + if (applyBiasBtoDCorr) + SetInputHistoBiasBtoD(plotter, pathfFilePromptMcRec, pathfFileNonPromptMcRec); Bool_t readSEandME = plotter->ReadInputSEandME(); - Bool_t readInvMass = plotter->ReadInputInvMass(); if (readSEandME) - cout << "Files SE and ME read correctly" << endl; + std::cout << "Files SE and ME read correctly" << std::endl; + Bool_t readInvMass = plotter->ReadInputInvMass(); if (readInvMass) - cout << "Files inv. mass read correctly" << endl; + std::cout << "Files inv. mass read correctly" << std::endl; + if (applyFDCorr) { + Bool_t readFDSubtr = plotter->ReadInputFDSubtr(); + if (readFDSubtr) + std::cout << "Files for FD subtr. read correctly" << std::endl; + } + if (applySecPartCorr) { + Bool_t readSecPart = plotter->ReadInputSecondaryPartContamination(); + if (readSecPart) + std::cout << "Files for secondary part. contamination read correctly" << std::endl; + } // Loop over candidate pt and assoc. particle pt for (int iBinPtCand = 0; iBinPtCand < nBinsPtCand; iBinPtCand++) { + plotter->SetDividedSidebands(isDividedSideb, useSidebLeft, useSidebRight); plotter->GetSignalAndBackgroundForNorm(binsPtCandIntervals[iBinPtCand], binsPtCandIntervals[iBinPtCand + 1]); for (int iBinPtHad = 0; iBinPtHad < nBinsPtHad; iBinPtHad++) { + plotter->SetBinCandAndHad(iBinPtCand + 1, iBinPtHad + 1); plotter->ExtractCorrelations(binsPtCandIntervals[iBinPtCand], binsPtCandIntervals[iBinPtCand + 1], binsPtHadIntervals[iBinPtHad], binsPtHadIntervals[iBinPtHad + 1], CodeNameAnalysis); - hCorrectedCorrel[iBinPtCand][iBinPtHad] = reinterpret_cast(plotter->GetCorrectedCorrHisto()); + hCorrectedCorrel[iBinPtCand][iBinPtHad] = (TH1D*)plotter->GetCorrectedCorrHisto(); + hCorrectedCorrel_BaselineSubtr[iBinPtCand][iBinPtHad] = (TH1D*)plotter->GetCorrectedCorrHisto_BaselineSubtr(); + hCorrectedCorrel_Reflected[iBinPtCand][iBinPtHad] = (TH1D*)plotter->GetCorrectedCorrHisto_Reflected(); + hCorrectedCorrel_Reflected_BaselineSubtr[iBinPtCand][iBinPtHad] = (TH1D*)plotter->GetCorrectedCorrHisto_Reflected_BaselineSubtr(); } } @@ -165,14 +231,43 @@ void ExtractOutputCorrel(TString cfgFileName = "config_CorrAnalysis.json") } outFile->Close(); + // output file baseline subtr. + TFile* outFile_BaselineSubtr = new TFile(Form("Output_CorrelationExtraction_%s_Root/ExtractCorrelationsResults_BaselineSubtr.root", CodeNameAnalysis.data()), "RECREATE"); + outFile_BaselineSubtr->cd(); + for (int iBinPtCand = 0; iBinPtCand < nBinsPtCand; iBinPtCand++) { + for (int iBinPtHad = 0; iBinPtHad < nBinsPtHad; iBinPtHad++) { + hCorrectedCorrel_BaselineSubtr[iBinPtCand][iBinPtHad]->Write(); + } + } + outFile_BaselineSubtr->Close(); + + // output file reflected + TFile* outFile_Reflected = new TFile(Form("Output_CorrelationExtraction_%s_Root/ExtractCorrelationsResults_Reflected.root", CodeNameAnalysis.data()), "RECREATE"); + outFile_Reflected->cd(); + for (int iBinPtCand = 0; iBinPtCand < nBinsPtCand; iBinPtCand++) { + for (int iBinPtHad = 0; iBinPtHad < nBinsPtHad; iBinPtHad++) { + hCorrectedCorrel_Reflected[iBinPtCand][iBinPtHad]->Write(); + } + } + outFile_Reflected->Close(); + + // output file reflected baseline subtr. + TFile* outFile_Reflected_BaselineSubtr = new TFile(Form("Output_CorrelationExtraction_%s_Root/ExtractCorrelationsResults_Reflected_BaselineSubtr.root", CodeNameAnalysis.data()), "RECREATE"); + outFile_Reflected_BaselineSubtr->cd(); + for (int iBinPtCand = 0; iBinPtCand < nBinsPtCand; iBinPtCand++) { + for (int iBinPtHad = 0; iBinPtHad < nBinsPtHad; iBinPtHad++) { + hCorrectedCorrel_Reflected_BaselineSubtr[iBinPtCand][iBinPtHad]->Write(); + } + } + outFile_Reflected_BaselineSubtr->Close(); + return; } -void SetInputCorrelNames(DhCorrelationExtraction* plotter, TString pathFileMass, TString pathFileSE, TString pathFileME, TString dirSE, TString dirME, TString histoNameCorrSignal, TString histoNameCorrSideba) +void SetInputCorrelNames(DhCorrelationExtraction* plotter, TString pathFileSE, TString pathFileME, TString dirSE, TString dirME, TString histoNameCorrSignal, TString histoNameCorrSideba, TString histoNameCorrSidebaLeft, TString histoNameCorrSidebaRight) { - // paths - plotter->SetInputFilenameMass(pathFileMass.Data()); + // Ds paths plotter->SetInputFilenameSE(pathFileSE.Data()); plotter->SetInputFilenameME(pathFileME.Data()); plotter->SetDirNameSE(dirSE.Data()); @@ -181,16 +276,51 @@ void SetInputCorrelNames(DhCorrelationExtraction* plotter, TString pathFileMass, plotter->SetSECorrelHistoSidebandName(histoNameCorrSideba.Data()); plotter->SetMECorrelHistoSignalName(histoNameCorrSignal.Data()); plotter->SetMECorrelHistoSidebandName(histoNameCorrSideba.Data()); + plotter->SetSECorrelHistoSidebandLeftName(histoNameCorrSidebaLeft.Data()); + plotter->SetMECorrelHistoSidebandLeftName(histoNameCorrSidebaLeft.Data()); + plotter->SetSECorrelHistoSidebandRightName(histoNameCorrSidebaRight.Data()); + plotter->SetMECorrelHistoSidebandRightName(histoNameCorrSidebaRight.Data()); return; } -void SetInputHistoInvMassNames(DhCorrelationExtraction* plotter, std::vector inputMassNames) +void SetInputHistoInvMassNames(DhCorrelationExtraction* plotter, TString pathFileMass, std::vector inputMassNames) { // to use if sgn and bkg extraction is done apart + plotter->SetInputFilenameMass(pathFileMass.Data()); plotter->SetMassHistoNameSgn(inputMassNames[0].data()); plotter->SetMassHistoNameBkg(inputMassNames[1].data()); plotter->SetMassHistoNameSBs(inputMassNames[2].data()); return; } + +void SetInputHistoFDSubtraction(DhCorrelationExtraction* plotter, TString pathFileFDTemplate, TString pathFileFDPromptFrac, TString histoNameFDTemplatePrompt, TString histoNameFDTemplateNonPrompt, TString histoNameRawFracPrompt) +{ + + plotter->SetInputFilenameFDTemplate(pathFileFDTemplate.Data()); + plotter->SetInputFilenameFDPromptFrac(pathFileFDPromptFrac.Data()); + plotter->SetInputHistoNameFDTemplatePrompt(histoNameFDTemplatePrompt.Data()); + plotter->SetInputHistoNameFDTemplateNonPrompt(histoNameFDTemplateNonPrompt.Data()); + plotter->SetInputHistoNameFDPromptFrac(histoNameRawFracPrompt.Data()); + + return; +} + +void SetInputHistoSecPart(DhCorrelationExtraction* plotter, TString pathFileSecPart, TString dirSecPartName, TString histoNamePrimaryPart, TString histoNameAllPart) +{ + + plotter->SetInputFilenameSecPart(pathFileSecPart.Data()); + plotter->SetDirNameSecPart(dirSecPartName.Data()); + plotter->SetHistoSecPartName(histoNamePrimaryPart.Data(), histoNameAllPart.Data()); + + return; +} + +void SetInputHistoBiasBtoD(DhCorrelationExtraction* plotter, TString pathfFilePromptMcRec, TString pathfFileNonPromptMcRec) +{ + + plotter->SetInputFilenameBiasBtoD(pathfFilePromptMcRec.Data(), pathfFileNonPromptMcRec.Data()); + + return; +} diff --git a/PWGHF/HFC/Macros/FitCorrel.C b/PWGHF/HFC/Macros/FitCorrel.C index 37b36a5e1b3..7c1d64ea823 100644 --- a/PWGHF/HFC/Macros/FitCorrel.C +++ b/PWGHF/HFC/Macros/FitCorrel.C @@ -9,29 +9,37 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file FitCorrel.C -/// \brief Macro to perform the azimuthal correlation fit -/// \usage .L DhCorrelationFitter.cxx+ -/// \usage .x FitCorrel.C("config-file-name") +/// \file DhCorrelationExtraction.cxx +/// \brief class for D-h correlation extraction /// \author Samuele Cattaruzzi /// \author Swapnesh Santosh Khade +#include "DhCorrelationFitter.h" #include "Riostream.h" -#include + #include #include #include #include -#include +#include #include +#include + #include #include -#include "DhCorrelationFitter.h" +#include +#include +#include +#include + +using namespace std; using namespace rapidjson; +bool removeNSPeakLowPt = false; + template -void readArray(const Value& jsonArray, std::vector& output) +void readArray(const Value& jsonArray, vector& output) { for (auto it = jsonArray.Begin(); it != jsonArray.End(); it++) { auto value = it->template Get(); @@ -41,15 +49,21 @@ void readArray(const Value& jsonArray, std::vector& output) void SetTH1HistoStyle(TH1D*& histo, TString hTitle, TString hXaxisTitle, TString hYaxisTitle, Style_t markerStyle, Color_t markerColor, Double_t markerSize, - Color_t lineColor, Int_t lineWidth, Float_t hTitleXaxisOffset = 1., Float_t hTitleYaxisOffset = 1., - Float_t hTitleXaxisSize = 0.060, Float_t hTitleYaxisSize = 0.060, Float_t hLabelXaxisSize = 0.060, Float_t hLabelYaxisSize = 0.060, + Color_t lineColor, Int_t lineWidth, Float_t hTitleXaxisOffset = 1.3, Float_t hTitleYaxisOffset = 1.3, + Float_t hTitleXaxisSize = 0.045, Float_t hTitleYaxisSize = 0.045, Float_t hLabelXaxisSize = 0.045, Float_t hLabelYaxisSize = 0.045, + Bool_t centerXaxisTitle = false, Bool_t centerYaxisTitle = false); +void SetTH1HistoStyle(TH1F*& histo, TString hTitle, TString hXaxisTitle, TString hYaxisTitle, + Style_t markerStyle, Color_t markerColor, Double_t markerSize, + Color_t lineColor, Int_t lineWidth, Float_t hTitleXaxisOffset = 1.3, Float_t hTitleYaxisOffset = 1.3, + Float_t hTitleXaxisSize = 0.045, Float_t hTitleYaxisSize = 0.045, Float_t hLabelXaxisSize = 0.045, Float_t hLabelYaxisSize = 0.045, Bool_t centerXaxisTitle = false, Bool_t centerYaxisTitle = false); -void FitCorrel(TString cfgFileName = "config_CorrAnalysis.json") +void FitCorrel_Ds(const TString cfgFileName = "config_CorrAnalysis.json") { gStyle->SetOptStat(0); - gStyle->SetPadLeftMargin(0.15); - gStyle->SetPadBottomMargin(0.15); + gStyle->SetPadLeftMargin(0.2); + gStyle->SetPadRightMargin(0.005); + gStyle->SetPadBottomMargin(0.2); gStyle->SetFrameLineWidth(2); gStyle->SetLineWidth(2); gStyle->SetCanvasDefH(1126); @@ -67,24 +81,57 @@ void FitCorrel(TString cfgFileName = "config_CorrAnalysis.json") gSystem->Exec(Form("rm -rf Output_CorrelationFitting_%s_Root/ Output_CorrelationFitting_%s_png/", CodeNameAnalysis.data(), CodeNameAnalysis.data())); gSystem->Exec(Form("mkdir Output_CorrelationFitting_%s_Root/ Output_CorrelationFitting_%s_png/", CodeNameAnalysis.data(), CodeNameAnalysis.data())); - const TString inFileName = Form("Output_CorrelationExtraction_%s_Root/ExtractCorrelationsResults.root", CodeNameAnalysis.data()); + string inputFileNameFit = config["InputFileNameFitCorr"].GetString(); + const TString inFileName = Form("Output_CorrelationExtraction_%s_Root/%s", CodeNameAnalysis.data(), inputFileNameFit.data()); - vector binsPtCandIntervals; - vector binsPtHadIntervals; + bool isReflected = config["IsRiflected"].GetBool(); + bool drawSystematicErrors = config["DrawSystematics"].GetBool(); + bool sameSystematics = config["SameSystematics"].GetBool(); + bool shiftBaseUp = config["ShiftBaseUp"].GetBool(); + bool shiftBaseDown = config["ShiftBaseDown"].GetBool(); + + std::vector binsPtCandIntervalsVec; + std::vector binsPtHadIntervals; + std::vector fitFunc; const Value& PtCandValue = config["binsPtCandIntervals"]; - readArray(PtCandValue, binsPtCandIntervals); + readArray(PtCandValue, binsPtCandIntervalsVec); const Value& PtHadValue = config["binsPtHadIntervals"]; readArray(PtHadValue, binsPtHadIntervals); - int fitFunc = config["FitFunction"].GetInt(); + const int nBinsPtCand = binsPtCandIntervalsVec.size() - 1; + const int nBinsPtHad = binsPtHadIntervals.size() - 1; + + double binsPtCandIntervals[nBinsPtCand + 1]; + for (int i = 0; i < nBinsPtCand + 1; i++) { + binsPtCandIntervals[i] = binsPtCandIntervalsVec[i]; + } + + const Value& FitFuncValue = config["FitFunction"]; + readArray(FitFuncValue, fitFunc); + int fixBase = config["FixBaseline"].GetInt(); int fixMean = config["FixMean"].GetInt(); + int nBaselinePoints = config["nBaselinePoints"].GetInt(); + vector pointsForBaselineVec; + const Value& pointsForBaselineValue = config["binsForBaseline"]; + readArray(pointsForBaselineValue, pointsForBaselineVec); + if (pointsForBaselineVec.size() != nBaselinePoints) { + cout << "ERROR: size of the vector pointsForBaseline is different from the number of nBaselinePoints" << endl; + return; + } + int pointsForBaseline[nBaselinePoints]; + for (int i = 0; i < nBaselinePoints; i++) { + pointsForBaseline[i] = pointsForBaselineVec[i]; + } + std::cout << "=========================== " << std::endl; std::cout << "Input variables from config" << std::endl; - std::cout << "FitFunction = " << fitFunc << std::endl; + for (int iBinPtCand = 0; iBinPtCand < nBinsPtCand; iBinPtCand++) { + std::cout << "iPt = " << iBinPtCand + 1 << " FitFunction = " << fitFunc[iBinPtCand] << std::endl; + } std::cout << "FixBaseline = " << fixBase << std::endl; std::cout << "FixMean = " << fixMean << std::endl; std::cout << "=========================== " << std::endl; @@ -93,44 +140,65 @@ void FitCorrel(TString cfgFileName = "config_CorrAnalysis.json") // TODO: reflections bool refl = false; - const int nBinsPtCand = binsPtCandIntervals.size() - 1; - const int nBinsPtHad = binsPtHadIntervals.size() - 1; - // Input file TFile* inFile = new TFile(inFileName.Data()); + TFile* inFileSystematicErrors = new TFile("OutputSystematicUncertainties/SystematicUncertaintesAngCorrMerged.root"); + TFile* inFileFitSystematicErrors = new TFile("OutputSystematicUncertainties/SystematicUncertaintesFitPhysObsMerged.root"); // Canvas TCanvas* CanvasCorrPhi[nBinsPtHad]; // Histograms TH1D* hCorrPhi[nBinsPtCand][nBinsPtHad]; + TH1F* hSystematicErrors[nBinsPtCand][nBinsPtHad]; + TH1D* hSystematicErrorsPlot[nBinsPtCand][nBinsPtHad]; - int nBinsPhi; - double baselineFromThreePoints[nBinsPtCand][nBinsPtHad], baselineFromThreePointsError[nBinsPtCand][nBinsPtHad]; + const int nBinsPtD = 5; + if (nBinsPtD != nBinsPtCand) { + std::cout << "[ERROR]: nBinsPtD != nBinsPtCand" << std::endl; + return; + } + double SystUncCorrelatedDs[nBinsPtD] = {20, 20, 20, 10}; // % (just the MC Closure uncertainty to put in the plot) // DhCorrelationFitter const double fMin{-0.5 * TMath::Pi()}, fMax{1.5 * TMath::Pi()}; // limits for the fitting function DhCorrelationFitter* corrFitter[nBinsPtHad][nBinsPtCand]; // Input parameters for fitting - const int npars{8}; // PED NSY NSM NSW ASY ASM ASW BETA - Double_t vals[npars] = {3., 2., 0., 0.5, 2., 3.14, 0.3, 2.}; - Double_t lowBounds[npars] = {0., 0., -1., 0., 0., 2., 0., 0.5}; - Double_t uppBounds[npars] = {9999., 999., 1., 3.14 / 3., 999., 4., 3.14 / 2., 3.5}; - - const int nBaselinePoints{8}; - Int_t pointsForBaseline[nBaselinePoints] = {1, 2, 13, 14, 15, 16, 31, 32}; + const int npars{10}; // PED NSY NSM NSW ASY ASM ASW BETA v2D v2h + Double_t vals[npars] = {3., 2., 0., 0.5, 2., 3.14, 0.3, 2., 0.1, 0.1}; + Double_t lowBounds[npars] = {0., 0., -1., 0., 0., 2., 0., 0.5, 0., 0.}; + Double_t uppBounds[npars] = {9999., 999., 1., 3.14 / 3., 999., 4., 3.14 / 2., 3.5, 0.5, 0.5}; + + Double_t v2AssocPart[nBinsPtD] = {0.15, 0.15, 0.15, 0.15}; + Double_t v2Dmeson[nBinsPtD] = {0.175, 0.09, 0.04, 0.04}; + + // Output histograms + TH1D* hBaselin[nBinsPtHad]; + TH1D* hNSYield[nBinsPtHad]; + TH1D* hNSSigma[nBinsPtHad]; + TH1D* hASYield[nBinsPtHad]; + TH1D* hASSigma[nBinsPtHad]; + TH1D* hBeta[nBinsPtHad]; + TH1D* hNSYieldBinCount[nBinsPtHad]; + TH1D* hASYieldBinCount[nBinsPtHad]; // extract TH1D and prepare fit for (int iBinPtCand = 0; iBinPtCand < nBinsPtCand; iBinPtCand++) { for (int iBinPtHad = 0; iBinPtHad < nBinsPtHad; iBinPtHad++) { - hCorrPhi[iBinPtCand][iBinPtHad] = reinterpret_cast(inFile->Get(Form("hCorrectedCorr_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", binsPtCandIntervals[iBinPtCand], binsPtCandIntervals[iBinPtCand + 1], binsPtHadIntervals[iBinPtHad], binsPtHadIntervals[iBinPtHad + 1]))); + if (isReflected) { + hCorrPhi[iBinPtCand][iBinPtHad] = reinterpret_cast(inFile->Get(Form("hCorrectedCorrReflected_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", binsPtCandIntervals[iBinPtCand], binsPtCandIntervals[iBinPtCand + 1], binsPtHadIntervals[iBinPtHad], binsPtHadIntervals[iBinPtHad + 1]))); + } else { + hCorrPhi[iBinPtCand][iBinPtHad] = reinterpret_cast(inFile->Get(Form("hCorrectedCorr_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", binsPtCandIntervals[iBinPtCand], binsPtCandIntervals[iBinPtCand + 1], binsPtHadIntervals[iBinPtHad], binsPtHadIntervals[iBinPtHad + 1]))); + } - corrFitter[iBinPtHad][iBinPtCand] = new DhCorrelationFitter(reinterpret_cast(hCorrPhi[iBinPtCand][iBinPtHad], fMin, fMax)); + corrFitter[iBinPtHad][iBinPtCand] = new DhCorrelationFitter(reinterpret_cast(hCorrPhi[iBinPtCand][iBinPtHad]), fMin, fMax); corrFitter[iBinPtHad][iBinPtCand]->SetHistoIsReflected(refl); - corrFitter[iBinPtHad][iBinPtCand]->SetFuncType(static_cast(fitFunc)); corrFitter[iBinPtHad][iBinPtCand]->SetFixBaseline(fixBase); + corrFitter[iBinPtHad][iBinPtCand]->SetBaselineUpOrDown(shiftBaseUp, shiftBaseDown); corrFitter[iBinPtHad][iBinPtCand]->SetPointsForBaseline(nBaselinePoints, pointsForBaseline); + corrFitter[iBinPtHad][iBinPtCand]->Setv2(v2AssocPart[iBinPtCand], v2Dmeson[iBinPtCand]); + corrFitter[iBinPtHad][iBinPtCand]->SetReflectedCorrHisto(isReflected); corrFitter[iBinPtHad][iBinPtCand]->SetFixMean(fixMean); corrFitter[iBinPtHad][iBinPtCand]->SetPtRanges(binsPtCandIntervals[iBinPtCand], binsPtCandIntervals[iBinPtCand + 1], binsPtHadIntervals[iBinPtHad], binsPtHadIntervals[iBinPtHad + 1]); @@ -145,15 +213,50 @@ void FitCorrel(TString cfgFileName = "config_CorrAnalysis.json") CanvasCorrPhi[iBinPtHad]->Divide(2, 2); } if (nBinsPtCand > 4 && nBinsPtCand <= 6) { - CanvasCorrPhi[iBinPtHad]->Divide(2, 3); + CanvasCorrPhi[iBinPtHad]->Divide(3, 2); } + // histograms with fir parameters + hBaselin[iBinPtHad] = new TH1D(Form("hBaselin_PtBinAssoc%d", iBinPtHad + 1), "", nBinsPtCand, binsPtCandIntervals); + hNSYield[iBinPtHad] = new TH1D(Form("hNSYield_PtBinAssoc%d", iBinPtHad + 1), "", nBinsPtCand, binsPtCandIntervals); + hNSSigma[iBinPtHad] = new TH1D(Form("hNSSigma_PtBinAssoc%d", iBinPtHad + 1), "", nBinsPtCand, binsPtCandIntervals); + hASYield[iBinPtHad] = new TH1D(Form("hASYield_PtBinAssoc%d", iBinPtHad + 1), "", nBinsPtCand, binsPtCandIntervals); + hASSigma[iBinPtHad] = new TH1D(Form("hASSigma_PtBinAssoc%d", iBinPtHad + 1), "", nBinsPtCand, binsPtCandIntervals); + hBeta[iBinPtHad] = new TH1D(Form("hBeta_PtBinAssoc%d", iBinPtHad + 1), "", nBinsPtCand, binsPtCandIntervals); + hNSYieldBinCount[iBinPtHad] = new TH1D(Form("hNSYieldBinCount_PtBinAssoc%d", iBinPtHad + 1), "", nBinsPtCand, binsPtCandIntervals); + hASYieldBinCount[iBinPtHad] = new TH1D(Form("hASYieldBinCount_PtBinAssoc%d", iBinPtHad + 1), "", nBinsPtCand, binsPtCandIntervals); + for (int iBinPtCand = 0; iBinPtCand < nBinsPtCand; iBinPtCand++) { SetTH1HistoStyle(hCorrPhi[iBinPtCand][iBinPtHad], "", "#Delta#phi [rad]", "#frac{1}{N_{D_{s}}}#frac{dN^{assoc}}{d#Delta#phi} [rad^{-1}]", kFullCircle, kRed + 1, 1.4, kRed + 1, 3); CanvasCorrPhi[iBinPtHad]->cd(iBinPtCand + 1); - hCorrPhi[iBinPtCand][iBinPtHad]->Draw(); + CanvasCorrPhi[iBinPtHad]->SetTickx(); + CanvasCorrPhi[iBinPtHad]->SetTicky(); + hCorrPhi[iBinPtCand][iBinPtHad]->SetStats(0); + hCorrPhi[iBinPtCand][iBinPtHad]->SetMinimum(0); + // hCorrPhi[iBinPtCand][iBinPtHad] -> Draw(); + + // draw systematic errors + int nBinsPhi = hCorrPhi[iBinPtCand][iBinPtHad]->GetNbinsX(); + if (drawSystematicErrors) { + hSystematicErrors[iBinPtCand][iBinPtHad] = reinterpret_cast(inFileSystematicErrors->Get(Form("hSystematicErrorsMerged_PtBin%d_PtBinAssoc%d", iBinPtCand + 1, iBinPtHad + 1))); + hSystematicErrorsPlot[iBinPtCand][iBinPtHad] = reinterpret_cast(hCorrPhi[iBinPtCand][iBinPtHad]->Clone(Form("hSystematicErrorsPlot_PtBin%d_PtBinAssoc%d", iBinPtCand + 1, iBinPtHad + 1))); + for (int iPhi = 0; iPhi < nBinsPhi; iPhi++) { + if (sameSystematics) { + hSystematicErrorsPlot[iBinPtCand][iBinPtHad]->SetBinError(iPhi + 1, hSystematicErrors[iBinPtCand][iBinPtHad]->GetBinContent(1) * hCorrPhi[iBinPtCand][iBinPtHad]->GetBinContent(iPhi + 1)); + } else { + hSystematicErrorsPlot[iBinPtCand][iBinPtHad]->SetBinError(iPhi + 1, hSystematicErrors[iBinPtCand][iBinPtHad]->GetBinContent(iPhi + 1) * hCorrPhi[iBinPtCand][iBinPtHad]->GetBinContent(iPhi + 1)); + } + hSystematicErrorsPlot[iBinPtCand][iBinPtHad]->SetBinContent(iPhi + 1, hCorrPhi[iBinPtCand][iBinPtHad]->GetBinContent(iPhi + 1)); + } + SetTH1HistoStyle(hSystematicErrorsPlot[iBinPtCand][iBinPtHad], "", "#Delta#phi [rad]", "#frac{1}{N_{D_{s}}}#frac{dN^{assoc}}{d#Delta#phi} [rad^{-1}]", kFullCircle, kRed + 1, 1.4, kRed + 1, 2); + hSystematicErrorsPlot[iBinPtCand][iBinPtHad]->SetLineColor(kRed - 4); + hSystematicErrorsPlot[iBinPtCand][iBinPtHad]->SetFillStyle(0); + // hSystematicErrorsPlot[iBinPtCand][iBinPtHad] -> Draw("E2same"); + } + // hCorrPhi[iBinPtCand][iBinPtHad] -> Draw("same"); // Fit + corrFitter[iBinPtHad][iBinPtCand]->SetFuncType(static_cast(fitFunc[iBinPtCand])); corrFitter[iBinPtHad][iBinPtCand]->Fitting(kTRUE, kTRUE); // the first term is for drawing the fit functions, the second argument is useExternalParams TF1* fFit = corrFitter[iBinPtHad][iBinPtCand]->GetFitFunction(); @@ -162,11 +265,193 @@ void FitCorrel(TString cfgFileName = "config_CorrAnalysis.json") TPaveText* pttext = new TPaveText(0.15, 0.9, 0.85, 0.95, "NDC"); pttext->SetFillStyle(0); pttext->SetBorderSize(0); - TText* tpT = pttext->AddText(0., 0.8, Form("%.0f < p_{T}^{D_{s}} < %.0f GeV/c, p_{T}^{assoc} > 0.3 GeV/c", binsPtCandIntervals[iBinPtCand], binsPtCandIntervals[iBinPtCand + 1])); + TText* tpT = pttext->AddText(0., 0.8, Form("%.0f < p_{T}^{D_{s}} < %.0f GeV/c, p_{T}^{assoc} > %.1f GeV/c", binsPtCandIntervals[iBinPtCand], binsPtCandIntervals[iBinPtCand + 1], binsPtHadIntervals[iBinPtHad])); + // pttext -> Draw("same"); + + // Fill the histograms with the fit parameters + hBaselin[iBinPtHad]->SetBinContent(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetPedestal()); + hBaselin[iBinPtHad]->SetBinError(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetPedestalError()); + if (iBinPtCand == 0 && removeNSPeakLowPt) { + hNSYield[iBinPtHad]->SetBinContent(iBinPtCand + 1, -1); + hNSYield[iBinPtHad]->SetBinError(iBinPtCand + 1, 0); + + hNSSigma[iBinPtHad]->SetBinContent(iBinPtCand + 1, -1); + hNSSigma[iBinPtHad]->SetBinError(iBinPtCand + 1, 0); + + hBeta[iBinPtHad]->SetBinContent(iBinPtCand + 1, -1); + hBeta[iBinPtHad]->SetBinError(iBinPtCand + 1, 0); + } else { + hNSYield[iBinPtHad]->SetBinContent(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetNSYield()); + hNSYield[iBinPtHad]->SetBinError(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetNSYieldError()); + + if (fitFunc[iBinPtCand] != 5 && fitFunc[iBinPtCand] != 6) { + hNSSigma[iBinPtHad]->SetBinContent(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetNSSigma()); + hNSSigma[iBinPtHad]->SetBinError(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetNSSigmaError()); + } else { + hNSSigma[iBinPtHad]->SetBinContent(iBinPtCand + 1, TMath::Sqrt(1. / corrFitter[iBinPtHad][iBinPtCand]->GetNSSigma())); + Double_t errrel = corrFitter[iBinPtHad][iBinPtCand]->GetNSSigmaError() / corrFitter[iBinPtHad][iBinPtCand]->GetNSSigma() / 2.; + hNSSigma[iBinPtHad]->SetBinError(iBinPtCand + 1, errrel * TMath::Sqrt(1. / corrFitter[iBinPtHad][iBinPtCand]->GetNSSigma())); + } + } + hNSYieldBinCount[iBinPtHad]->SetBinContent(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetBinCountingNSYield()); + hNSYieldBinCount[iBinPtHad]->SetBinError(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetBinCountingNSYieldErr()); + + hASYield[iBinPtHad]->SetBinContent(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetASYield()); + hASYield[iBinPtHad]->SetBinError(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetASYieldError()); + + hASYieldBinCount[iBinPtHad]->SetBinContent(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetBinCountingASYield()); + hASYieldBinCount[iBinPtHad]->SetBinError(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetBinCountingASYieldErr()); + if (fitFunc[iBinPtCand] != 5 && fitFunc[iBinPtCand] != 6) { + hASSigma[iBinPtHad]->SetBinContent(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetASSigma()); + hASSigma[iBinPtHad]->SetBinError(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetASSigmaError()); + } else { + hASSigma[iBinPtHad]->SetBinContent(iBinPtCand + 1, TMath::Sqrt(1. / corrFitter[iBinPtHad][iBinPtCand]->GetASSigma())); + Double_t errrel = corrFitter[iBinPtHad][iBinPtCand]->GetASSigmaError() / corrFitter[iBinPtHad][iBinPtCand]->GetASSigma() / 2.; + hASSigma[iBinPtHad]->SetBinError(iBinPtCand + 1, errrel * TMath::Sqrt(1. / corrFitter[iBinPtHad][iBinPtCand]->GetASSigma())); + } + if (fitFunc[iBinPtCand] == 4) { // param beta for gen. gauss + hBeta[iBinPtHad]->SetBinContent(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetBeta()); + hBeta[iBinPtHad]->SetBinError(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetBetaError()); + } + + // Draw + TPaveText* tCorrUncDs = new TPaveText(0.413, 0.311, 0.877, 0.392, "NDC"); + tCorrUncDs->SetFillStyle(0); + tCorrUncDs->SetBorderSize(0); + tCorrUncDs->SetTextSize(0.05); + tCorrUncDs->SetTextFont(42); + tCorrUncDs->SetTextAlign(13); + tCorrUncDs->SetTextColor(kRed + 1); + tCorrUncDs->AddText(0., 0., Form("#splitline{+%.0f%%}{#minus%.0f%%}", SystUncCorrelatedDs[iBinPtCand], SystUncCorrelatedDs[iBinPtCand])); + + TPaveText* tScaleUnc = new TPaveText(0.501, 0.292, 0.968, 0.372, "NDC"); + tScaleUnc->SetFillStyle(0); + tScaleUnc->SetBorderSize(0); + tScaleUnc->SetTextSize(0.05); + tScaleUnc->SetTextFont(42); + tScaleUnc->SetTextAlign(13); + tScaleUnc->SetTextColor(kBlack); + tScaleUnc->AddText(0., 0., "corr. unc."); + + if (drawSystematicErrors) + hSystematicErrorsPlot[iBinPtCand][iBinPtHad]->Draw("E2same"); + hCorrPhi[iBinPtCand][iBinPtHad]->Draw("same"); pttext->Draw("same"); + if (drawSystematicErrors) + tCorrUncDs->Draw("same"); + if (drawSystematicErrors) + tScaleUnc->Draw("same"); } - CanvasCorrPhi[iBinPtHad]->SaveAs(Form("Output_CorrelationFitting_%s_png/CorrPhi_PtBinAssoc%d.png", CodeNameAnalysis.data(), iBinPtHad + 1)); - CanvasCorrPhi[iBinPtHad]->SaveAs(Form("Output_CorrelationFitting_%s_Root/CorrPhi_PtBinAssoc%d.root", CodeNameAnalysis.data(), iBinPtHad + 1)); + CanvasCorrPhi[iBinPtHad]->SaveAs(Form("Output_CorrelationFitting_%s_png/CorrPhiDs_PtBinAssoc%d.png", CodeNameAnalysis.data(), iBinPtHad + 1)); + CanvasCorrPhi[iBinPtHad]->SaveAs(Form("Output_CorrelationFitting_%s_Root/CorrPhiDs_PtBinAssoc%d.root", CodeNameAnalysis.data(), iBinPtHad + 1)); + } + + // histogram with fit parameter and errors + TFile* outFile = new TFile(Form("Output_CorrelationFitting_%s_Root/CorrPhiDs_FinalPlots.root", CodeNameAnalysis.data()), "RECREATE"); + outFile->cd(); + for (int iBinPtHad = 0; iBinPtHad < nBinsPtHad; iBinPtHad++) { + hBaselin[iBinPtHad]->Write(); + hNSYield[iBinPtHad]->Write(); + hNSSigma[iBinPtHad]->Write(); + hASYield[iBinPtHad]->Write(); + hASSigma[iBinPtHad]->Write(); + hBeta[iBinPtHad]->Write(); + hNSYieldBinCount[iBinPtHad]->Write(); + hASYieldBinCount[iBinPtHad]->Write(); + } + outFile->Close(); + + // Draw plots + for (int iBinPtHad = 0; iBinPtHad < nBinsPtHad; iBinPtHad++) { + TCanvas* c1 = new TCanvas(Form("NS_yield_PtAssoc%d", iBinPtHad + 1), Form("NS_yield_PtAssoc%d", iBinPtHad + 1)); + TCanvas* c2 = new TCanvas(Form("AS_yield_PtAssoc%d", iBinPtHad + 1), Form("AS_yield_PtAssoc%d", iBinPtHad + 1)); + TCanvas* c3 = new TCanvas(Form("NS_sigma_PtAssoc%d", iBinPtHad + 1), Form("AS_sigma_PtAssoc%d", iBinPtHad + 1)); + TCanvas* c4 = new TCanvas(Form("AS_sigma_PtAssoc%d", iBinPtHad + 1), Form("AS_sigma_PtAssoc%d", iBinPtHad + 1)); + TCanvas* c5 = new TCanvas(Form("Baseline_PtAssoc%d", iBinPtHad + 1), Form("Baseline_PtAssoc%d", iBinPtHad + 1)); + SetTH1HistoStyle(hBaselin[iBinPtHad], Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "Baseline", kFullSquare, kBlue, 1.8, kBlue, 2); + SetTH1HistoStyle(hNSYield[iBinPtHad], Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "Y^{NS}", kFullSquare, kRed, 1.8, kRed, 2); + SetTH1HistoStyle(hASYield[iBinPtHad], Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "Y^{AS}", kFullSquare, kMagenta, 1.8, kMagenta, 2); + SetTH1HistoStyle(hNSSigma[iBinPtHad], Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "#sigma_{NS}", kFullSquare, kOrange + 8, 1.8, kOrange + 8, 2); + SetTH1HistoStyle(hASSigma[iBinPtHad], Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "#sigma_{AS}", kFullSquare, kViolet - 5, 1.8, kViolet - 5, 2); + c1->cd(); + hNSYield[iBinPtHad]->SetMinimum(0); + hNSYield[iBinPtHad]->Draw(); + c2->cd(); + hASYield[iBinPtHad]->SetMinimum(0); + hASYield[iBinPtHad]->Draw(); + c3->cd(); + hNSSigma[iBinPtHad]->SetMinimum(0); + hNSSigma[iBinPtHad]->Draw(); + c4->cd(); + hASSigma[iBinPtHad]->SetMinimum(0); + hASSigma[iBinPtHad]->Draw(); + c5->cd(); + hBaselin[iBinPtHad]->SetMinimum(0); + hBaselin[iBinPtHad]->Draw(); + + TH1F* hBaselinSyst; + TH1F* hNSYieldSyst; + TH1F* hNSSigmaSyst; + TH1F* hASYieldSyst; + TH1F* hASSigmaSyst; + + if (drawSystematicErrors) { + hBaselinSyst = reinterpret_cast(inFileFitSystematicErrors->Get(Form("hSystematicErrorsBaselinMerged_PtBinAssoc%d", iBinPtHad + 1))); + hNSYieldSyst = reinterpret_cast(inFileFitSystematicErrors->Get(Form("hSystematicErrorsNSYieldMerged_PtBinAssoc%d", iBinPtHad + 1))); + hNSSigmaSyst = reinterpret_cast(inFileFitSystematicErrors->Get(Form("hSystematicErrorsNSSigmaMerged_PtBinAssoc%d", iBinPtHad + 1))); + hASYieldSyst = reinterpret_cast(inFileFitSystematicErrors->Get(Form("hSystematicErrorsASYieldMerged_PtBinAssoc%d", iBinPtHad + 1))); + hASSigmaSyst = reinterpret_cast(inFileFitSystematicErrors->Get(Form("hSystematicErrorsASSigmaMerged_PtBinAssoc%d", iBinPtHad + 1))); + + for (int iBinPtCand = 0; iBinPtCand < nBinsPtCand; iBinPtCand++) { + hBaselinSyst->SetBinError(iBinPtCand + 1, hBaselinSyst->GetBinContent(iBinPtCand + 1) * hBaselin[iBinPtHad]->GetBinContent(iBinPtCand + 1)); + hNSYieldSyst->SetBinError(iBinPtCand + 1, hNSYieldSyst->GetBinContent(iBinPtCand + 1) * hNSYield[iBinPtHad]->GetBinContent(iBinPtCand + 1)); + hNSSigmaSyst->SetBinError(iBinPtCand + 1, hNSSigmaSyst->GetBinContent(iBinPtCand + 1) * hNSSigma[iBinPtHad]->GetBinContent(iBinPtCand + 1)); + hASYieldSyst->SetBinError(iBinPtCand + 1, hASYieldSyst->GetBinContent(iBinPtCand + 1) * hASYield[iBinPtHad]->GetBinContent(iBinPtCand + 1)); + hASSigmaSyst->SetBinError(iBinPtCand + 1, hASSigmaSyst->GetBinContent(iBinPtCand + 1) * hASSigma[iBinPtHad]->GetBinContent(iBinPtCand + 1)); + + hBaselinSyst->SetBinContent(iBinPtCand + 1, hBaselin[iBinPtHad]->GetBinContent(iBinPtCand + 1)); + hNSYieldSyst->SetBinContent(iBinPtCand + 1, hNSYield[iBinPtHad]->GetBinContent(iBinPtCand + 1)); + hNSSigmaSyst->SetBinContent(iBinPtCand + 1, hNSSigma[iBinPtHad]->GetBinContent(iBinPtCand + 1)); + hASYieldSyst->SetBinContent(iBinPtCand + 1, hASYield[iBinPtHad]->GetBinContent(iBinPtCand + 1)); + hASSigmaSyst->SetBinContent(iBinPtCand + 1, hASSigma[iBinPtHad]->GetBinContent(iBinPtCand + 1)); + } + + c1->cd(); + SetTH1HistoStyle(hNSYieldSyst, Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "Y^{NS}", kFullSquare, kRed, 1.8, kRed, 2); + hNSYieldSyst->SetFillStyle(0); + hNSYieldSyst->Draw("E2same"); + + c2->cd(); + SetTH1HistoStyle(hASYieldSyst, Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "Y^{AS}", kFullSquare, kMagenta, 1.8, kMagenta, 2); + hASYieldSyst->SetFillStyle(0); + hASYieldSyst->Draw("E2same"); + + c3->cd(); + SetTH1HistoStyle(hNSSigmaSyst, Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "#sigma_{NS}", kFullSquare, kOrange + 8, 1.8, kOrange + 8, 2); + hNSSigmaSyst->SetFillStyle(0); + hNSSigmaSyst->Draw("E2same"); + + c4->cd(); + SetTH1HistoStyle(hASSigmaSyst, Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "#sigma_{AS}", kFullSquare, kViolet - 5, 1.8, kViolet - 5, 2); + hASSigmaSyst->SetFillStyle(0); + hASSigmaSyst->Draw("E2same"); + + c5->cd(); + SetTH1HistoStyle(hBaselinSyst, Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "Baseline", kFullSquare, kBlue, 1.8, kBlue, 2); + hBaselinSyst->SetFillStyle(0); + hBaselinSyst->Draw("E2same"); + } + + c1->SaveAs(Form("Output_CorrelationFitting_%s_png/NearSideYield_PtAssoc%d.png", CodeNameAnalysis.data(), iBinPtHad + 1)); + c2->SaveAs(Form("Output_CorrelationFitting_%s_png/AwaySideYield_PtAssoc%d.png", CodeNameAnalysis.data(), iBinPtHad + 1)); + c3->SaveAs(Form("Output_CorrelationFitting_%s_png/NearSideSigma_PtAssoc%d.png", CodeNameAnalysis.data(), iBinPtHad + 1)); + c4->SaveAs(Form("Output_CorrelationFitting_%s_png/AwaySideSigma_PtAssoc%d.png", CodeNameAnalysis.data(), iBinPtHad + 1)); + c5->SaveAs(Form("Output_CorrelationFitting_%s_png/Baseline_PtAssoc%d.png", CodeNameAnalysis.data(), iBinPtHad + 1)); + c1->SaveAs(Form("Output_CorrelationFitting_%s_Root/NearSideYield_PtBinAssoc%d.root", CodeNameAnalysis.data(), iBinPtHad + 1)); + c2->SaveAs(Form("Output_CorrelationFitting_%s_Root/AwaySideYield_PtBinAssoc%d.root", CodeNameAnalysis.data(), iBinPtHad + 1)); + c3->SaveAs(Form("Output_CorrelationFitting_%s_Root/NearSideSigma_PtBinAssoc%d.root", CodeNameAnalysis.data(), iBinPtHad + 1)); + c4->SaveAs(Form("Output_CorrelationFitting_%s_Root/AwaySideSigma_PtBinAssoc%d.root", CodeNameAnalysis.data(), iBinPtHad + 1)); + c5->SaveAs(Form("Output_CorrelationFitting_%s_Root/Baseline_PtBinAssoc%d.root", CodeNameAnalysis.data(), iBinPtHad + 1)); } return; @@ -174,9 +459,36 @@ void FitCorrel(TString cfgFileName = "config_CorrAnalysis.json") void SetTH1HistoStyle(TH1D*& histo, TString hTitle, TString hXaxisTitle, TString hYaxisTitle, Style_t markerStyle, Color_t markerColor, Double_t markerSize, - Color_t lineColor, Int_t lineWidth, Float_t hTitleXaxisOffset, Float_t hTitleYaxisOffset, - Float_t hTitleXaxisSize, Float_t hTitleYaxisSize, Float_t hLabelXaxisSize, Float_t hLabelYaxisSize, - Bool_t centerXaxisTitle, Bool_t centerYaxisTitle) + Color_t lineColor, Int_t lineWidth, Float_t hTitleXaxisOffset = 1.3, Float_t hTitleYaxisOffset = 1.3, + Float_t hTitleXaxisSize = 0.045, Float_t hTitleYaxisSize = 0.045, Float_t hLabelXaxisSize = 0.045, Float_t hLabelYaxisSize = 0.045, + Bool_t centerXaxisTitle = false, Bool_t centerYaxisTitle = false) +{ + + histo->SetTitle(hTitle.Data()); + histo->GetXaxis()->SetTitle(hXaxisTitle.Data()); + histo->GetYaxis()->SetTitle(hYaxisTitle.Data()); + histo->SetMarkerStyle(markerStyle); + histo->SetMarkerColor(markerColor); + histo->SetMarkerSize(markerSize); + histo->SetLineColor(lineColor); + histo->SetLineWidth(lineWidth); + histo->GetXaxis()->SetTitleOffset(hTitleXaxisOffset); + histo->GetYaxis()->SetTitleOffset(hTitleYaxisOffset); + histo->GetXaxis()->SetTitleSize(hTitleXaxisSize); + histo->GetYaxis()->SetTitleSize(hTitleYaxisSize); + histo->GetXaxis()->SetLabelSize(hLabelXaxisSize); + histo->GetYaxis()->SetLabelSize(hLabelYaxisSize); + histo->GetXaxis()->CenterTitle(centerXaxisTitle); + histo->GetYaxis()->CenterTitle(centerYaxisTitle); + + return; +} + +void SetTH1HistoStyle(TH1F*& histo, TString hTitle, TString hXaxisTitle, TString hYaxisTitle, + Style_t markerStyle, Color_t markerColor, Double_t markerSize, + Color_t lineColor, Int_t lineWidth, Float_t hTitleXaxisOffset = 1.3, Float_t hTitleYaxisOffset = 1.3, + Float_t hTitleXaxisSize = 0.045, Float_t hTitleYaxisSize = 0.045, Float_t hLabelXaxisSize = 0.045, Float_t hLabelYaxisSize = 0.045, + Bool_t centerXaxisTitle = false, Bool_t centerYaxisTitle = false) { histo->SetTitle(hTitle.Data()); diff --git a/PWGHF/HFC/Macros/config_CorrAnalysis_DsToKKPi.json b/PWGHF/HFC/Macros/config_CorrAnalysis_DsToKKPi.json index 27e71b97514..5866d619f87 100644 --- a/PWGHF/HFC/Macros/config_CorrAnalysis_DsToKKPi.json +++ b/PWGHF/HFC/Macros/config_CorrAnalysis_DsToKKPi.json @@ -1,13 +1,23 @@ { - "CodeName": "Default", - "_CodeName": "Name to identify the analysis", - "pathFileSE": "~/cernbox/DsCorrelationAnalysis/MasterDegreeAnalysis/AnalysisResultsFinal.root", - "pathFileME": "~/cernbox/DsCorrelationAnalysis/MasterDegreeAnalysis/AnalysisResultsFinalME.root", - "pathFileMass": "/data/dataalice/scattar/RawYieldsDs.root", + "CodeName": "Test_example", + "_CodeName": "Name to identify the analysis: pass7_Full_ptAssoc0p3, Thin2023_Full_ptAssoc0p3", + "pathFileSE": "~/cernbox/AnalysisResults_SE_pp_Thin2023_FullAnalysis.root", + "_pathFileSE": "Name SE file", + "pathFileME": "~/cernbox/AnalysisResults_ME_derived_Thinned2023.root", + "_pathFileME": "Name ME file", + "pathFileMass": "~/cernbox/DsCorrelationAnalysis/ClassesForAnalysis/InvMassFitter/InvMass_pp_Thin2023_Final_Default.root", + "_pathFileMass": "Name mass file", + "pathFileFDTemplate": "~/cernbox/TemplatesCRMode2_ptAssocInt.root", + "pathFileFDPromptFrac": "~/cernbox/CutVarDs_FDVarDefaultBkg.root", + "pathFileSecPart": "~/cernbox/AnalysisResults_MC_Anchored_Thin2023_SecPart.root", + "_pathFileSecPart": "Path file for secondary particle contamination correction", "InputDirSE": "hf-task-correlation-ds-hadrons", "InputDirME": "hf-task-correlation-ds-hadrons", + "InputDirSecPart": "hf-task-correlation-ds-hadrons", "InputHistoCorrSignalName": "hCorrel2DVsPtSignalRegion", "InputHistoCorrSidebaName": "hCorrel2DVsPtSidebands", + "InputHistoCorrSidebaLeftName": "hCorrel2DVsPtSidebandLeft", + "InputHistoCorrSidebaRightName": "hCorrel2DVsPtSidebandRight", "InputHistoMassName": [ "hRawYieldsSignal", "hRawYieldsBkg", @@ -18,21 +28,34 @@ "Bkg yield vs pt", "SBs yield vs pt" ], + "InputHistoFDTemplatePrompt": "EtaPhiPromptNorm_pt", + "InputHistoFDTemplateNonPrompt": "EtaPhiNonPromptNorm_pt", + "InputHistoFDPromptFrac": "hRawFracPrompt", + "InputHistoPrimaryPart": "hCorrel2DVsPtPhysicalPrimaryMcRec", + "InputHistoAllPart": "hCorrel2DVsPtSignalRegionMcRec", + "IsDividedSideb": true, + "UseSidebLeft": true, + "UseSidebRight": false, + "ApplySecPartCorr": true, + "ApplyFDCorr": true, + "ApplyBiasBtoDCorr": true, + "pathfFilePromptMcRec": "~/cernbox/DsCorrelationAnalysis/ClassesForAnalysis/MonteCarloClosureTest/MonteCarloClosureTest_Prompt_All.root", + "pathfFileNonPromptMcRec": "~/cernbox/DsCorrelationAnalysis/ClassesForAnalysis/MonteCarloClosureTest/MonteCarloClosureTest_NonPrompt_All.root", "binsPtCandIntervals": [ - 2.0, + 1.0, 3.0, - 4.0, 5.0, 8.0, - 16.0 + 16.0, + 36.0 ], "binsPtHadIntervals": [ - 0.0, - 11.0 + 0.3, + 50.0 ], "deltaEtaInterval": [ - -0.8, - 0.8 + -1.0, + 1.0 ], "DmesonSpecie": 2, "_DmesonSpecie": [ @@ -45,7 +68,36 @@ "_NumberOfPools": "Number of pools for the event mixing", "CorrectPoolsSeparately": false, "_CorrectPoolsSeparately": "true = pool-by-pool ME correction; false = merged-pools ME correction", - "FitFunction": 1, - "FixBaseline": 0, - "FixMean": 3 + "RebinAngCorr": false, + "RebinFDCorr": true, + "RebinSecPart": false, + "nRebinDeltaPhi": 2, + "nRebinDeltaEta": 2, + "InputFileNameFitCorr": "ExtractCorrelationsResults_Reflected.root", + "_InputFileNameFitCorr": "ExtractCorrelationsResults_Reflected.root - ExtractCorrelationsResults.root", + "IsRiflected": true, + "DrawSystematics": false, + "SameSystematics": false, + "_SameSystematics": "true: systematic take from the first delta phi bin, false: systematic applied bin per bin", + "FitFunction": [ + 2, + 2, + 2, + 2, + 2 + ], + "_FitFunction": "1 : const + G NS + G AS (w/o periodicity), 2 : const + G NS + G AS (w/ periodicity), 3 : const + G AS, 4 : const + GenG NS + G AS (w/ periodicity), 5 : const + VonMises NS + VonMises AS (w/periodicity), 6 : const + VonMises AS", + "FixBaseline": 4, + "_FixBaseline": "0 : baseline free, = 1 : fix the baseline to the minimum of the histogram, < 0 : fix the baseline to the weighted average of the abs(fFixBaseline) lower points, = 3 : fix the baseline to the weighted average of the points passed through the function SetPointsForBaseline(), 4 : fix the baseline to the weighted average of default transverse region points", + "FixMean": 3, + "_FixMean": "= 0 : NS & AS mean free, = 1 : NS mean fixed to 0, AS mean free, = 2 : AS mean fixed to pi, NS mean free, = 3 : NS mean fixed to 0, AS mean to pi", + "ShiftBaseUp": false, + "ShiftBaseDown": false, + "nBaselinePoints": 4, + "binsForBaseline": [ + 6, + 7, + 8, + 9 + ] } From fb6f3733da6f499f3be53732b840f1339133d0f1 Mon Sep 17 00:00:00 2001 From: arvindkhuntia <31609955+arvindkhuntia@users.noreply.github.com> Date: Tue, 2 Sep 2025 15:32:11 +0530 Subject: [PATCH 271/986] [PWGLF] [PWGMM] FV0 info added to Lumi task (#12101) Co-authored-by: Arvind Khuntia Co-authored-by: ALICE Action Bot --- PWGMM/Lumi/Tasks/LumiFDDFT0.cxx | 149 ++++++++++++++++++++------------ 1 file changed, 96 insertions(+), 53 deletions(-) diff --git a/PWGMM/Lumi/Tasks/LumiFDDFT0.cxx b/PWGMM/Lumi/Tasks/LumiFDDFT0.cxx index 878e0482f7c..c67e36672b8 100644 --- a/PWGMM/Lumi/Tasks/LumiFDDFT0.cxx +++ b/PWGMM/Lumi/Tasks/LumiFDDFT0.cxx @@ -10,41 +10,39 @@ // or submit itself to any jurisdiction. // author: akhuntia@cern.ch -#include -#include -#include -#include - #include "Common/Core/TrackSelection.h" #include "Common/Core/trackUtilities.h" #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/Multiplicity.h" -#include "CommonUtils/NameConf.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CcdbApi.h" +#include "CommonConstants/GeomConstants.h" +#include "CommonUtils/NameConf.h" +#include "DataFormatsCalibration/MeanVertexObject.h" +#include "DataFormatsFDD/Digit.h" +#include "DataFormatsFIT/Triggers.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "DetectorsVertexing/PVertexer.h" #include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "Framework/RunningWorkflowInfo.h" #include "Framework/runDataProcessing.h" -#include "Framework/AnalysisDataModel.h" - -#include "DetectorsVertexing/PVertexer.h" #include "ReconstructionDataFormats/DCA.h" #include "ReconstructionDataFormats/PrimaryVertex.h" #include "ReconstructionDataFormats/Vertex.h" -#include "DataFormatsFDD/Digit.h" -#include "DataFormatsFIT/Triggers.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" - -#include "DetectorsBase/GeometryManager.h" -#include "DetectorsBase/Propagator.h" -#include "CommonConstants/GeomConstants.h" -#include "CCDB/BasicCCDBManager.h" -#include "CCDB/CcdbApi.h" -#include "DataFormatsCalibration/MeanVertexObject.h" +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -85,6 +83,12 @@ DECLARE_SOA_COLUMN(TimeCFT0, timeCft0, double); DECLARE_SOA_COLUMN(ChargeAFT0, chargeAft0, double); DECLARE_SOA_COLUMN(ChargeCFT0, chargeCft0, double); +// information for FV0 +DECLARE_SOA_COLUMN(isFV0, isfv0, bool); +DECLARE_SOA_COLUMN(TCMTriggerFV0, tcmTriggerfv0, uint8_t); +DECLARE_SOA_COLUMN(TimeAFV0, timeAfv0, double); // Only FV0-A time +DECLARE_SOA_COLUMN(ChargeAFV0, chargeAfv0, double); // Only FV0-A charge + } // namespace full DECLARE_SOA_TABLE(EventInfo, "AOD", "EventInfo", full::TimeStamp, full::VertexX, full::VertexY, full::VertexZ, full::GlobalBC, @@ -94,7 +98,8 @@ DECLARE_SOA_TABLE(EventInfo, "AOD", "EventInfo", full::TimeStamp, full::VertexX, full::ChargeAFDD, full::ChargeCFDD, full::isFT0, full::TCMTriggerFT0, full::TimeAFT0, full::TimeCFT0, - full::ChargeAFT0, full::ChargeCFT0); + full::ChargeAFT0, full::ChargeCFT0, full::isFV0, + full::TCMTriggerFV0, full::TimeAFV0, full::ChargeAFV0); DECLARE_SOA_TABLE(EventInfoFDD, "AOD", "EventInfoFDD", full::TimeStamp, full::GlobalBC, @@ -109,12 +114,18 @@ DECLARE_SOA_TABLE(EventInfoFT0, "AOD", "EventInfoFT0", full::TimeCFT0, full::ChargeAFT0, full::ChargeCFT0); +DECLARE_SOA_TABLE(EventInfoFV0, "AOD", "EventInfoFV0", + full::TimeStamp, full::GlobalBC, + full::TCMTriggerFV0, full::TimeAFV0, + full::ChargeAFV0); + } // namespace o2::aod struct LumiFDDFT0 { Produces rowEventInfo; Produces rowEventInfofdd; Produces rowEventInfoft0; + Produces rowEventInfofv0; Service ccdb; const char* ccdbpath_grp = "GLO/Config/GRPMagField"; const char* ccdburl = "http://alice-ccdb.cern.ch"; @@ -147,10 +158,10 @@ struct LumiFDDFT0 { { {"BCFDD", "", {HistType::kTH1F, {{nBCsPerOrbit + 1, -0.5f, nBCsPerOrbit + 0.5f, "x"}}}}, // {"BCFT0", "", {HistType::kTH1F, {{nBCsPerOrbit + 1, -0.5f, nBCsPerOrbit + 0.5f, "x"}}}}, // + {"BCFV0", "", {HistType::kTH1F, {{nBCsPerOrbit + 1, -0.5f, nBCsPerOrbit + 0.5f, "x"}}}}, // }}; bool doPVrefit = true; - void init(InitContext&) { if (doprocessLite == true && doprocessFull == true) { @@ -165,7 +176,7 @@ struct LumiFDDFT0 { mRunNumber = 0; } - void processFull(soa::Join::iterator const& collision, aod::FDDs const& /*fdds*/, aod::FT0s const& /*ft0s*/, aod::BCsWithTimestamps const&, + void processFull(soa::Join::iterator const& collision, aod::FDDs const& /*fdds*/, aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0s*/, aod::BCsWithTimestamps const&, o2::soa::Join const& unfiltered_tracks) { @@ -239,6 +250,10 @@ struct LumiFDDFT0 { double chargecFT0 = 0.; uint8_t mTriggerFT0 = 0; + double timeaFV0 = -999.; + double chargeaFV0 = 0.; + uint8_t mTriggerFV0 = 0; + if (doPVrefit && PVrefit_doable) { auto Pvtx_refitted = vertexer.refitVertex(vec_useTrk_PVrefit, Pvtx); chi2 = Pvtx_refitted.getChi2(); @@ -249,38 +264,49 @@ struct LumiFDDFT0 { // refitYY = Pvtx_refitted.getSigmaY2(); // refitXY = Pvtx_refitted.getSigmaXY(); - // now get information for FDD - if (collision.has_foundFDD()) { - auto fdd = collision.foundFDD(); - mTriggerFDD = fdd.triggerMask(); - timeaFDD = fdd.timeA(); - timecFDD = fdd.timeC(); - for (auto amplitude : fdd.chargeA()) { - chargeaFDD += amplitude; - } - for (auto amplitude : fdd.chargeC()) { - chargecFDD += amplitude; - } - } // fdd - - if (collision.has_foundFT0()) { - auto ft0 = collision.foundFT0(); - mTriggerFT0 = ft0.triggerMask(); - timeaFT0 = ft0.timeA(); - timecFT0 = ft0.timeC(); - for (auto amplitude : ft0.amplitudeA()) { - chargeaFT0 += amplitude; - } + } // pv refit - for (auto amplitude : ft0.amplitudeC()) { - chargecFT0 += amplitude; - } - } // ft0 + // now get information for FDD + if (collision.has_foundFDD()) { + auto fdd = collision.foundFDD(); + mTriggerFDD = fdd.triggerMask(); + timeaFDD = fdd.timeA(); + timecFDD = fdd.timeC(); + for (auto amplitude : fdd.chargeA()) { + chargeaFDD += amplitude; + } + for (auto amplitude : fdd.chargeC()) { + chargecFDD += amplitude; + } + } // fdd + + if (collision.has_foundFT0()) { + auto ft0 = collision.foundFT0(); + mTriggerFT0 = ft0.triggerMask(); + timeaFT0 = ft0.timeA(); + timecFT0 = ft0.timeC(); + for (auto amplitude : ft0.amplitudeA()) { + chargeaFT0 += amplitude; + } + + for (auto amplitude : ft0.amplitudeC()) { + chargecFT0 += amplitude; + } + } // ft0 + + // FV0 + if (collision.has_foundFV0()) { + auto fv0 = collision.foundFV0(); + mTriggerFV0 = fv0.triggerMask(); + timeaFV0 = fv0.time(); + for (auto amplitude : fv0.amplitude()) { + chargeaFV0 += amplitude; + } + } // fv0 - } // pv refit rowEventInfo(relTS, refitX, refitY, refitZ, globalBC, chi2, nContrib, collision.has_foundFDD(), mTriggerFDD, timeaFDD, timecFDD, chargeaFDD, chargecFDD, collision.has_foundFT0(), mTriggerFT0, timeaFT0, - timecFT0, chargeaFT0, chargecFT0); + timecFT0, chargeaFT0, chargecFT0, collision.has_foundFV0(), mTriggerFV0, timeaFV0, chargeaFV0); histos.fill(HIST("chisquare_Refitted"), chi2); if (nContrib > nContribMin && nContrib < nContribMax && @@ -313,7 +339,7 @@ struct LumiFDDFT0 { }; PROCESS_SWITCH(LumiFDDFT0, processFull, "Process FDD", true); - void processLite(aod::FDDs const& fdds, aod::FT0s const& ft0s, aod::BCsWithTimestamps const&) + void processLite(aod::FDDs const& fdds, aod::FT0s const& ft0s, aod::FV0As const& fv0s, aod::BCsWithTimestamps const&) { // Scan over the FDD table and store charge and time along with globalBC @@ -384,6 +410,23 @@ struct LumiFDDFT0 { } rowEventInfoft0(relTS, globalBC, ft0.triggerMask(), ft0.timeA(), ft0.timeC(), chargeaFT0, chargecFT0); } // end of ft0 table + + // Scan over the FV0 table and store charge and time along with globalBC + for (auto& fv0 : fv0s) { + auto bc = fv0.bc_as(); + if (!bc.timestamp()) + continue; + Long64_t relTS = bc.timestamp() - fttimestamp; + Long64_t globalBC = bc.globalBC(); + int localBC = globalBC % nBCsPerOrbit; + histoslite.fill(HIST("BCFV0"), localBC); + + double chargeaFV0 = 0.; + for (auto amplitude : fv0.amplitude()) { + chargeaFV0 += amplitude; + } + rowEventInfofv0(relTS, globalBC, fv0.triggerMask(), fv0.time(), chargeaFV0); + } // end of fv0 table }; PROCESS_SWITCH(LumiFDDFT0, processLite, "Process FDD and FT0 info", false); From 6740c4e96ad042f713fb849584b3f7589598f120 Mon Sep 17 00:00:00 2001 From: Chiara De Martin <39315597+ChiaraDeMartin95@users.noreply.github.com> Date: Tue, 2 Sep 2025 12:29:14 +0200 Subject: [PATCH 272/986] [PWGLF] Add additional histograms for shift correction (#12821) Co-authored-by: Chiara De Martin --- .../TableProducer/Strangeness/cascadeflow.cxx | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx index 9974831a520..2923a6da215 100644 --- a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx @@ -1362,6 +1362,17 @@ struct cascadeFlow { const float psiTPCA = std::atan2(coll.qvecBPosIm(), coll.qvecBPosRe()) * 0.5f; const float psiTPCC = std::atan2(coll.qvecBNegIm(), coll.qvecBNegRe()) * 0.5f; float psiT0CCorr = psiT0C; + for (int ishift = 1; ishift <= 10; ishift++) { + histos.fill(HIST("ShiftFT0C"), coll.centFT0C(), 0.5, ishift - 0.5, std::sin(ishift * 2 * psiT0C)); + histos.fill(HIST("ShiftFT0C"), coll.centFT0C(), 1.5, ishift - 0.5, std::cos(ishift * 2 * psiT0C)); + + histos.fill(HIST("ShiftTPCL"), coll.centFT0C(), 0.5, ishift - 0.5, std::sin(ishift * 2 * psiTPCA)); + histos.fill(HIST("ShiftTPCL"), coll.centFT0C(), 1.5, ishift - 0.5, std::cos(ishift * 2 * psiTPCA)); + + histos.fill(HIST("ShiftTPCR"), coll.centFT0C(), 0.5, ishift - 0.5, std::sin(ishift * 2 * psiTPCC)); + histos.fill(HIST("ShiftTPCR"), coll.centFT0C(), 1.5, ishift - 0.5, std::cos(ishift * 2 * psiTPCC)); + } + if (cfgShiftCorr) { currentRunNumber = coll.runNumber(); if (currentRunNumber != lastRunNumber) { @@ -1652,6 +1663,17 @@ struct cascadeFlow { const float psiTPCA = std::atan2(coll.qvecBPosIm(), coll.qvecBPosRe()) * 0.5f; const float psiTPCC = std::atan2(coll.qvecBNegIm(), coll.qvecBNegRe()) * 0.5f; float psiT0CCorr = psiT0C; + for (int ishift = 1; ishift <= 10; ishift++) { + histos.fill(HIST("ShiftFT0C"), coll.centFT0C(), 0.5, ishift - 0.5, std::sin(ishift * 2 * psiT0C)); + histos.fill(HIST("ShiftFT0C"), coll.centFT0C(), 1.5, ishift - 0.5, std::cos(ishift * 2 * psiT0C)); + + histos.fill(HIST("ShiftTPCL"), coll.centFT0C(), 0.5, ishift - 0.5, std::sin(ishift * 2 * psiTPCA)); + histos.fill(HIST("ShiftTPCL"), coll.centFT0C(), 1.5, ishift - 0.5, std::cos(ishift * 2 * psiTPCA)); + + histos.fill(HIST("ShiftTPCR"), coll.centFT0C(), 0.5, ishift - 0.5, std::sin(ishift * 2 * psiTPCC)); + histos.fill(HIST("ShiftTPCR"), coll.centFT0C(), 1.5, ishift - 0.5, std::cos(ishift * 2 * psiTPCC)); + } + if (cfgShiftCorr) { currentRunNumber = coll.runNumber(); if (currentRunNumber != lastRunNumber) { @@ -1869,6 +1891,17 @@ struct cascadeFlow { const float psiTPCA = std::atan2(coll.qvecBPosIm(), coll.qvecBPosRe()) * 0.5f; const float psiTPCC = std::atan2(coll.qvecBNegIm(), coll.qvecBNegRe()) * 0.5f; float psiT0CCorr = psiT0C; + for (int ishift = 1; ishift <= 10; ishift++) { + histos.fill(HIST("ShiftFT0C"), coll.centFT0C(), 0.5, ishift - 0.5, std::sin(ishift * 2 * psiT0C)); + histos.fill(HIST("ShiftFT0C"), coll.centFT0C(), 1.5, ishift - 0.5, std::cos(ishift * 2 * psiT0C)); + + histos.fill(HIST("ShiftTPCL"), coll.centFT0C(), 0.5, ishift - 0.5, std::sin(ishift * 2 * psiTPCA)); + histos.fill(HIST("ShiftTPCL"), coll.centFT0C(), 1.5, ishift - 0.5, std::cos(ishift * 2 * psiTPCA)); + + histos.fill(HIST("ShiftTPCR"), coll.centFT0C(), 0.5, ishift - 0.5, std::sin(ishift * 2 * psiTPCC)); + histos.fill(HIST("ShiftTPCR"), coll.centFT0C(), 1.5, ishift - 0.5, std::cos(ishift * 2 * psiTPCC)); + } + if (cfgShiftCorr) { currentRunNumber = coll.runNumber(); if (currentRunNumber != lastRunNumber) { From 4c1d6fb1f8f673ba786b5bdb1d791a4340c7936a Mon Sep 17 00:00:00 2001 From: lucamicheletti93 <38209984+lucamicheletti93@users.noreply.github.com> Date: Tue, 2 Sep 2025 14:38:57 +0200 Subject: [PATCH 273/986] [PWGDQ] Fixing minitree filling in dqEfficiencyWithAssoc (#12823) Co-authored-by: Lucamicheletti93 --- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index b3ef5cf769a..ceec3753c28 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -768,6 +768,7 @@ struct AnalysisMuonSelection { Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; + Configurable fConfigMagField{"cfgMagField", 5.0f, "Manually set magnetic field"}; Configurable fConfigGeoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; Configurable fConfigMCSignals{"cfgMuonMCSignals", "", "Comma separated list of MC signals"}; @@ -884,7 +885,9 @@ struct AnalysisMuonSelection { o2::base::Propagator::initFieldFromGRP(grpmag); VarManager::SetMagneticField(grpmag->getNominalL3Field()); } else { - LOGF(fatal, "GRP object is not available in CCDB at timestamp=%llu", events.begin().timestamp()); + // LOGF(fatal, "GRP object is not available in CCDB at timestamp=%llu", events.begin().timestamp()); + // If the magnetic field is not found it is configured by had by the user + VarManager::SetMagneticField(fConfigMagField.value); } fCurrentRun = events.begin().runNumber(); } @@ -2173,9 +2176,12 @@ struct AnalysisSameEventPairing { PresliceUnsorted perReducedMcGenEvent = aod::reducedtrackMC::reducedMCeventId; - void processMCGen(soa::Filtered const& events, ReducedMCEvents const& /*mcEvents*/, ReducedMCTracks const& mcTracks) + void processMCGen(soa::Filtered const& events, ReducedMCEvents const& mcEvents, ReducedMCTracks const& mcTracks) { // Fill Generated histograms taking into account all generated tracks + uint32_t mcDecision = 0; + int isig = 0; + for (auto& mctrack : mcTracks) { VarManager::FillTrackMC(mcTracks, mctrack); // NOTE: Signals are checked here mostly based on the skimmed MC stack, so depending on the requested signal, the stack could be incomplete. @@ -2209,9 +2215,15 @@ struct AnalysisSameEventPairing { // auto track_raw = groupedMCTracks.rawIteratorAt(track.globalIndex()); for (auto& sig : fGenMCSignals) { if (sig->CheckSignal(true, track_raw)) { + mcDecision |= (static_cast(1) << isig); fHistMan->FillHistClass(Form("MCTruthGenSel_%s", sig->GetName()), VarManager::fgValues); + if (useMiniTree.fConfigMiniTree) { + auto mcEvent = mcEvents.rawIteratorAt(track_raw.reducedMCeventId()); + dileptonMiniTreeGen(mcDecision, mcEvent.impactParameter(), track_raw.pt(), track_raw.eta(), track_raw.phi(), -999, -999, -999); + } } } + isig++; } } // end loop over reconstructed events if (fHasTwoProngGenMCsignals) { @@ -2224,12 +2236,17 @@ struct AnalysisSameEventPairing { continue; } if (sig->CheckSignal(true, t1_raw, t2_raw)) { - // mcDecision |= (static_cast(1) << isig); + mcDecision |= (static_cast(1) << isig); VarManager::FillPairMC(t1, t2); // NOTE: This feature will only work for muons fHistMan->FillHistClass(Form("MCTruthGenPair_%s", sig->GetName()), VarManager::fgValues); + if (useMiniTree.fConfigMiniTree) { + // WARNING! To be checked + dileptonMiniTreeGen(mcDecision, -999, t1.pt(), t1.eta(), t1.phi(), t2.pt(), t2.eta(), t2.phi()); + } } } } + isig++; } } } From 5c1113ab747f2dd26086af2a54732b71211a3d60 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Tue, 2 Sep 2025 15:14:59 +0200 Subject: [PATCH 274/986] [PWGEM/Dilepton,Trigger] update trigger analysis in LMEE (#12798) --- EventFiltering/Zorro.cxx | 8 +- EventFiltering/Zorro.h | 2 + PWGEM/Dilepton/Core/Dilepton.h | 43 ++++-- PWGEM/Dilepton/Core/DileptonHadronMPC.h | 35 ++++- PWGEM/Dilepton/Core/PhotonHBT.h | 33 ++++- PWGEM/Dilepton/Core/SingleTrackQC.h | 36 ++++- PWGEM/Dilepton/DataModel/dileptonTables.h | 28 +++- .../TableProducer/createEMEventDilepton.cxx | 128 +++++++++--------- PWGEM/Dilepton/TableProducer/skimmerOTS.cxx | 117 +++++++++++----- .../TableProducer/skimmerPrimaryElectron.cxx | 2 +- .../skimmerPrimaryElectronQC.cxx | 2 +- .../TableProducer/skimmerPrimaryMuon.cxx | 2 +- .../TableProducer/skimmerPrimaryTrack.cxx | 2 +- PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h | 10 +- .../TableProducer/createEMEventPhoton.cxx | 6 +- .../TableProducer/photonconversionbuilder.cxx | 2 +- .../skimmerPrimaryElectronFromDalitzEE.cxx | 2 +- 17 files changed, 304 insertions(+), 154 deletions(-) diff --git a/EventFiltering/Zorro.cxx b/EventFiltering/Zorro.cxx index 3f9ca800024..f10fbd66552 100644 --- a/EventFiltering/Zorro.cxx +++ b/EventFiltering/Zorro.cxx @@ -202,6 +202,7 @@ std::vector Zorro::initCCDB(o2::ccdb::BasicCCDBManager* ccdb, int runNumber mTOIidx.push_back(bin); } mTOIcounts.resize(mTOIs.size(), 0); + mATcounts.resize(mSelections->GetNbinsX() - 2, 0); LOGF(info, "Zorro initialized for run %d, triggers of interest:", runNumber); for (size_t i{0}; i < mTOIs.size(); ++i) { LOGF(info, ">>> %s : %i", mTOIs[i].data(), mTOIidx[i]); @@ -235,8 +236,11 @@ std::bitset<128> Zorro::fetch(uint64_t bcGlobalId, uint64_t tolerance) for (int iTOI{0}; iTOI < 64; ++iTOI) { if (mZorroHelpers->at(i).selMask[iMask] & (1ull << iTOI)) { mLastResult.set(iMask * 64 + iTOI, 1); - if (mAnalysedTriggers && !mAccountedBCranges[i]) { - mAnalysedTriggers->Fill(iMask * 64 + iTOI); + if (!mAccountedBCranges[i]) { + mATcounts[iMask * 64 + iTOI]++; + if (mAnalysedTriggers) { + mAnalysedTriggers->Fill(iMask * 64 + iTOI); + } } } } diff --git a/EventFiltering/Zorro.h b/EventFiltering/Zorro.h index 8cab70192c5..f5cb580061a 100644 --- a/EventFiltering/Zorro.h +++ b/EventFiltering/Zorro.h @@ -59,6 +59,7 @@ class Zorro TH1D* getInspectedTVX() const { return mInspectedTVX; } std::bitset<128> getLastResult() const { return mLastResult; } std::vector getTOIcounters() const { return mTOIcounts; } + std::vector getATcounters() const { return mATcounts; } std::vector getTriggerOfInterestResults(uint64_t bcGlobalId, uint64_t tolerance = 100); std::vector getTriggerOfInterestResults() const; int getNTOIs() const { return mTOIs.size(); } @@ -98,6 +99,7 @@ class Zorro std::vector mTOIs; std::vector mTOIidx; std::vector mTOIcounts; + std::vector mATcounts; o2::ccdb::BasicCCDBManager* mCCDB = nullptr; }; diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 8fd18e97c56..18815b73ee0 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -72,7 +72,7 @@ using namespace o2::aod::pwgem::dilepton::utils::pairutil; using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; -using MyCollisionsWithSWT = soa::Join; +using MyCollisionsWithSWT = soa::Join; using MyCollisionWithSWT = MyCollisionsWithSWT::iterator; using MyElectrons = soa::Join; @@ -427,7 +427,13 @@ struct Dilepton { fRegistry.addClone("Event/before/hCollisionCounter", "Event/norm/hCollisionCounter"); } if (doprocessTriggerAnalysis) { - fRegistry.add("Event/hNInspectedTVX", "N inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true); + LOGF(info, "Trigger analysis is enabled. Desired trigger name = %s", cfg_swt_name.value); + fRegistry.add("NormTrigger/hInspectedTVX", "inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true); + fRegistry.add("NormTrigger/hScalers", "trigger counter before DS;run number;counter", kTProfile, {{80000, 520000.5, 600000.5}}, true); + fRegistry.add("NormTrigger/hSelections", "trigger counter after DS;run number;counter", kTProfile, {{80000, 520000.5, 600000.5}}, true); + auto hTriggerCounter = fRegistry.add("NormTrigger/hTriggerCounter", Form("trigger counter of %s;run number;", cfg_swt_name.value.data()), kTH2D, {{80000, 520000.5, 600000.5}, {2, -0.5, 1.5}}, false); + hTriggerCounter->GetYaxis()->SetBinLabel(1, "Analyzed Trigger"); + hTriggerCounter->GetYaxis()->SetBinLabel(2, "Analyzed TOI"); } if (doprocessBC) { auto hTVXCounter = fRegistry.add("BC/hTVXCounter", "TVX counter", kTH1D, {{6, -0.5f, 5.5f}}); @@ -440,7 +446,7 @@ struct Dilepton { } } - template + template void initCCDB(TCollision const& collision) { if (mRunNumber == collision.runNumber()) { @@ -494,12 +500,6 @@ struct Dilepton { beamP2 = std::sqrt(std::pow(beamE2, 2) - std::pow(beamM2, 2)); LOGF(info, "beamZ1 = %d, beamZ2 = %d, beamA1 = %d, beamA2 = %d, beamE1 = %f (GeV), beamE2 = %f (GeV), beamM1 = %f (GeV), beamM2 = %f (GeV), beamP1 = %f (GeV), beamP2 = %f (GeV)", beamZ1, beamZ2, beamA1, beamA2, beamE1, beamE2, beamM1, beamM2, beamP1, beamP2); - if constexpr (isTriggerAnalysis) { - LOGF(info, "Trigger analysis is enabled. Desired trigger name = %s", cfg_swt_name.value); - LOGF(info, "total inspected TVX events = %d in run number %d", collision.nInspectedTVX(), collision.runNumber()); - fRegistry.fill(HIST("Event/hNInspectedTVX"), collision.runNumber(), collision.nInspectedTVX()); - } - if (cfgApplySPresolution) { auto list = ccdb->getForTimeStamp(spresoPath, collision.timestamp()); h2sp_resolution = reinterpret_cast(list->FindObject(spresoHistName.value.data())); @@ -1164,7 +1164,7 @@ struct Dilepton { void runPairing(TCollisions const& collisions, TLeptons const& posTracks, TLeptons const& negTracks, TPresilce const& perCollision, TCut const& cut, TAllTracks const& tracks) { for (const auto& collision : collisions) { - initCCDB(collision); + initCCDB(collision); const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; float centrality = centralities[cfgCentEstimator]; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { @@ -1412,7 +1412,7 @@ struct Dilepton { passed_pairIds.reserve(posTracks.size() * negTracks.size()); for (const auto& collision : collisions) { - initCCDB(collision); + initCCDB(collision); const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; @@ -1531,8 +1531,8 @@ struct Dilepton { } PROCESS_SWITCH(Dilepton, processAnalysis, "run dilepton analysis", true); - // using FilteredMyCollisionsWithSWT = soa::Filtered; - void processTriggerAnalysis(MyCollisionsWithSWT const& collisions, Types const&... args) + using FilteredMyCollisionsWithSWT = soa::Filtered; + void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, aod::EMSWTriggerInfos const& cefpinfos, aod::EMSWTriggerCounters const& counters, Types const&... args) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { auto electrons = std::get<0>(std::tie(args...)); @@ -1549,6 +1549,23 @@ struct Dilepton { } map_weight.clear(); ndf++; + + // for nomalization + int emswtId = o2::aod::pwgem::dilepton::swt::aliasLabels.at(cfg_swt_name.value); + for (const auto& counter : counters) { + if (counter.isAnalyzed_bit(emswtId)) { + fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 0); + } + if (counter.isAnalyzedToI_bit(emswtId)) { + fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 1); + } + } + + for (const auto& info : cefpinfos) { + fRegistry.fill(HIST("NormTrigger/hInspectedTVX"), info.runNumber(), info.nInspectedTVX()); + fRegistry.fill(HIST("NormTrigger/hScalers"), info.runNumber(), info.nScalers()[emswtId]); + fRegistry.fill(HIST("NormTrigger/hSelections"), info.runNumber(), info.nSelections()[emswtId]); + } } PROCESS_SWITCH(Dilepton, processTriggerAnalysis, "run dilepton analysis on triggered data", false); diff --git a/PWGEM/Dilepton/Core/DileptonHadronMPC.h b/PWGEM/Dilepton/Core/DileptonHadronMPC.h index 28df971c52c..ae423fd7a68 100644 --- a/PWGEM/Dilepton/Core/DileptonHadronMPC.h +++ b/PWGEM/Dilepton/Core/DileptonHadronMPC.h @@ -74,7 +74,7 @@ using namespace o2::aod::pwgem::dilepton::utils::pairutil; using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; -using MyCollisionsWithSWT = soa::Join; +using MyCollisionsWithSWT = soa::Join; using MyCollisionWithSWT = MyCollisionsWithSWT::iterator; using MyElectrons = soa::Join; @@ -390,7 +390,13 @@ struct DileptonHadronMPC { } if (doprocessTriggerAnalysis) { - fRegistry.add("Event/hNInspectedTVX", "N inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true); + LOGF(info, "Trigger analysis is enabled. Desired trigger name = %s", cfg_swt_name.value); + fRegistry.add("NormTrigger/hInspectedTVX", "inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true); + fRegistry.add("NormTrigger/hScalers", "trigger counter before DS;run number;counter", kTProfile, {{80000, 520000.5, 600000.5}}, true); + fRegistry.add("NormTrigger/hSelections", "trigger counter after DS;run number;counter", kTProfile, {{80000, 520000.5, 600000.5}}, true); + auto hTriggerCounter = fRegistry.add("NormTrigger/hTriggerCounter", Form("trigger counter of %s;run number;", cfg_swt_name.value.data()), kTH2D, {{80000, 520000.5, 600000.5}, {2, -0.5, 1.5}}, false); + hTriggerCounter->GetYaxis()->SetBinLabel(1, "Analyzed Trigger"); + hTriggerCounter->GetYaxis()->SetBinLabel(2, "Analyzed TOI"); } } @@ -437,8 +443,8 @@ struct DileptonHadronMPC { if constexpr (isTriggerAnalysis) { LOGF(info, "Trigger analysis is enabled. Desired trigger name = %s", cfg_swt_name.value); - LOGF(info, "total inspected TVX events = %d in run number %d", collision.nInspectedTVX(), collision.runNumber()); - fRegistry.fill(HIST("Event/hNInspectedTVX"), collision.runNumber(), collision.nInspectedTVX()); + // LOGF(info, "total inspected TVX events = %d in run number %d", collision.nInspectedTVX(), collision.runNumber()); + // fRegistry.fill(HIST("Event/hNInspectedTVX"), collision.runNumber(), collision.nInspectedTVX()); } } @@ -1431,8 +1437,8 @@ struct DileptonHadronMPC { } PROCESS_SWITCH(DileptonHadronMPC, processAnalysis, "run dilepton analysis", true); - // using FilteredMyCollisionsWithSWT = soa::Filtered; - void processTriggerAnalysis(MyCollisionsWithSWT const& collisions, FilteredRefTracks const& refTracks, Types const&... args) + using FilteredMyCollisionsWithSWT = soa::Filtered; + void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, FilteredRefTracks const& refTracks, aod::EMSWTriggerInfos const& cefpinfos, aod::EMSWTriggerCounters const& counters, Types const&... args) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { auto electrons = std::get<0>(std::tie(args...)); @@ -1449,6 +1455,23 @@ struct DileptonHadronMPC { } map_weight.clear(); ndf++; + + // for nomalization + int emswtId = o2::aod::pwgem::dilepton::swt::aliasLabels.at(cfg_swt_name.value); + for (const auto& counter : counters) { + if (counter.isAnalyzed_bit(emswtId)) { + fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 0); + } + if (counter.isAnalyzedToI_bit(emswtId)) { + fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 1); + } + } + + for (const auto& info : cefpinfos) { + fRegistry.fill(HIST("NormTrigger/hInspectedTVX"), info.runNumber(), info.nInspectedTVX()); + fRegistry.fill(HIST("NormTrigger/hScalers"), info.runNumber(), info.nScalers()[emswtId]); + fRegistry.fill(HIST("NormTrigger/hSelections"), info.runNumber(), info.nSelections()[emswtId]); + } } PROCESS_SWITCH(DileptonHadronMPC, processTriggerAnalysis, "run dilepton analysis on triggered data", false); diff --git a/PWGEM/Dilepton/Core/PhotonHBT.h b/PWGEM/Dilepton/Core/PhotonHBT.h index 796f0c5da2b..9948eac03a2 100644 --- a/PWGEM/Dilepton/Core/PhotonHBT.h +++ b/PWGEM/Dilepton/Core/PhotonHBT.h @@ -74,7 +74,7 @@ using namespace o2::aod::pwgem::dilepton::core::photonhbt; using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; -using MyCollisionsWithSWT = soa::Join; +using MyCollisionsWithSWT = soa::Join; using MyCollisionWithSWT = MyCollisionsWithSWT::iterator; using MyV0Photons = soa::Join; @@ -390,7 +390,13 @@ struct PhotonHBT { fRegistry.add("Pair/mix/hDiffBC", "diff. global BC in mixed event;|BC_{current} - BC_{mixed}|", kTH1D, {{10001, -0.5, 10000.5}}, true); if (doprocessTriggerAnalysis) { - fRegistry.add("Event/hNInspectedTVX", "N inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true); + LOGF(info, "Trigger analysis is enabled. Desired trigger name = %s", cfg_swt_name.value); + fRegistry.add("NormTrigger/hInspectedTVX", "inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true); + fRegistry.add("NormTrigger/hScalers", "trigger counter before DS;run number;counter", kTProfile, {{80000, 520000.5, 600000.5}}, true); + fRegistry.add("NormTrigger/hSelections", "trigger counter after DS;run number;counter", kTProfile, {{80000, 520000.5, 600000.5}}, true); + auto hTriggerCounter = fRegistry.add("NormTrigger/hTriggerCounter", Form("trigger counter of %s;run number;", cfg_swt_name.value.data()), kTH2D, {{80000, 520000.5, 600000.5}, {2, -0.5, 1.5}}, false); + hTriggerCounter->GetYaxis()->SetBinLabel(1, "Analyzed Trigger"); + hTriggerCounter->GetYaxis()->SetBinLabel(2, "Analyzed TOI"); } } @@ -434,8 +440,8 @@ struct PhotonHBT { if constexpr (isTriggerAnalysis) { LOGF(info, "Trigger analysis is enabled. Desired trigger name = %s", cfg_swt_name.value); - LOGF(info, "total inspected TVX events = %d in run number %d", collision.nInspectedTVX(), collision.runNumber()); - fRegistry.fill(HIST("Event/hNInspectedTVX"), collision.runNumber(), collision.nInspectedTVX()); + // LOGF(info, "total inspected TVX events = %d in run number %d", collision.nInspectedTVX(), collision.runNumber()); + // fRegistry.fill(HIST("Event/hNInspectedTVX"), collision.runNumber(), collision.nInspectedTVX()); } } @@ -1454,7 +1460,7 @@ struct PhotonHBT { PROCESS_SWITCH(PhotonHBT, processAnalysis, "pairing for analysis", false); using FilteredMyCollisionsWithSWT = soa::Filtered; - void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, Types const&... args) + void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, aod::EMSWTriggerInfos const& cefpinfos, aod::EMSWTriggerCounters const& counters, Types const&... args) { if constexpr (pairtype == ggHBTPairType::kPCMPCM) { auto v0photons = std::get<0>(std::tie(args...)); @@ -1476,6 +1482,23 @@ struct PhotonHBT { runPairing(collisions, nullptr, nullptr, emprimaryelectrons, emprimaryelectrons, perCollision_electron, perCollision_electron, fDielectronCut, fDielectronCut); } ndf++; + + // for nomalization + int emswtId = o2::aod::pwgem::dilepton::swt::aliasLabels.at(cfg_swt_name.value); + for (const auto& counter : counters) { + if (counter.isAnalyzed_bit(emswtId)) { + fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 0); + } + if (counter.isAnalyzedToI_bit(emswtId)) { + fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 1); + } + } + + for (const auto& info : cefpinfos) { + fRegistry.fill(HIST("NormTrigger/hInspectedTVX"), info.runNumber(), info.nInspectedTVX()); + fRegistry.fill(HIST("NormTrigger/hScalers"), info.runNumber(), info.nScalers()[emswtId]); + fRegistry.fill(HIST("NormTrigger/hSelections"), info.runNumber(), info.nSelections()[emswtId]); + } } PROCESS_SWITCH(PhotonHBT, processTriggerAnalysis, "pairing analysis on trigger data", false); diff --git a/PWGEM/Dilepton/Core/SingleTrackQC.h b/PWGEM/Dilepton/Core/SingleTrackQC.h index 186efbd0e87..1af8b9f48fa 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQC.h @@ -55,7 +55,7 @@ using namespace o2::aod::pwgem::dilepton::utils::emtrackutil; using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; -using MyCollisionsWithSWT = soa::Join; +using MyCollisionsWithSWT = soa::Join; using MyCollisionWithSWT = MyCollisionsWithSWT::iterator; using MyElectrons = soa::Join; @@ -327,7 +327,13 @@ struct SingleTrackQC { fRegistry.addClone("Event/before/hCollisionCounter", "Event/norm/hCollisionCounter"); } if (doprocessQC_TriggeredData) { - fRegistry.add("Event/hNInspectedTVX", "N inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true); + LOGF(info, "Trigger analysis is enabled. Desired trigger name = %s", cfg_swt_name.value); + fRegistry.add("NormTrigger/hInspectedTVX", "inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true); + fRegistry.add("NormTrigger/hScalers", "trigger counter before DS;run number;counter", kTProfile, {{80000, 520000.5, 600000.5}}, true); + fRegistry.add("NormTrigger/hSelections", "trigger counter after DS;run number;counter", kTProfile, {{80000, 520000.5, 600000.5}}, true); + auto hTriggerCounter = fRegistry.add("NormTrigger/hTriggerCounter", Form("trigger counter of %s;run number;", cfg_swt_name.value.data()), kTH2D, {{80000, 520000.5, 600000.5}, {2, -0.5, 1.5}}, false); + hTriggerCounter->GetYaxis()->SetBinLabel(1, "Analyzed Trigger"); + hTriggerCounter->GetYaxis()->SetBinLabel(2, "Analyzed TOI"); } if (doprocessBC) { auto hTVXCounter = fRegistry.add("BC/hTVXCounter", "TVX counter", kTH1D, {{6, -0.5f, 5.5f}}); @@ -351,8 +357,8 @@ struct SingleTrackQC { if constexpr (isTriggerAnalysis) { LOGF(info, "Trigger analysis is enabled. Desired trigger name = %s", cfg_swt_name.value); - LOGF(info, "total inspected TVX events = %d in run number %d", collision.nInspectedTVX(), collision.runNumber()); - fRegistry.fill(HIST("Event/hNInspectedTVX"), collision.runNumber(), collision.nInspectedTVX()); + // LOGF(info, "total inspected TVX events = %d in run number %d", collision.nInspectedTVX(), collision.runNumber()); + // fRegistry.fill(HIST("Event/hNInspectedTVX"), collision.runNumber(), collision.nInspectedTVX()); } } @@ -806,8 +812,8 @@ struct SingleTrackQC { } PROCESS_SWITCH(SingleTrackQC, processQC, "run single track QC", true); - // using FilteredMyCollisionsWithSWT = soa::Filtered; - void processQC_TriggeredData(MyCollisionsWithSWT const& collisions, Types const&... args) + using FilteredMyCollisionsWithSWT = soa::Filtered; + void processQC_TriggeredData(FilteredMyCollisionsWithSWT const& collisions, aod::EMSWTriggerInfos const& cefpinfos, aod::EMSWTriggerCounters const& counters, Types const&... args) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { auto electrons = std::get<0>(std::tie(args...)); @@ -822,8 +828,24 @@ struct SingleTrackQC { } runQC(collisions, muons, perCollision_muon, fDimuonCut); } - map_weight.clear(); + + // for nomalization + int emswtId = o2::aod::pwgem::dilepton::swt::aliasLabels.at(cfg_swt_name.value); + for (const auto& counter : counters) { + if (counter.isAnalyzed_bit(emswtId)) { + fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 0); + } + if (counter.isAnalyzedToI_bit(emswtId)) { + fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 1); + } + } + + for (const auto& info : cefpinfos) { + fRegistry.fill(HIST("NormTrigger/hInspectedTVX"), info.runNumber(), info.nInspectedTVX()); + fRegistry.fill(HIST("NormTrigger/hScalers"), info.runNumber(), info.nScalers()[emswtId]); + fRegistry.fill(HIST("NormTrigger/hSelections"), info.runNumber(), info.nSelections()[emswtId]); + } } PROCESS_SWITCH(SingleTrackQC, processQC_TriggeredData, "run single track QC on triggered data", false); diff --git a/PWGEM/Dilepton/DataModel/dileptonTables.h b/PWGEM/Dilepton/DataModel/dileptonTables.h index ae57b4cf69d..c19b5baa653 100644 --- a/PWGEM/Dilepton/DataModel/dileptonTables.h +++ b/PWGEM/Dilepton/DataModel/dileptonTables.h @@ -64,9 +64,13 @@ using EMBC = EMBCs::iterator; namespace emevent { DECLARE_SOA_COLUMN(CollisionId, collisionId, int); -DECLARE_SOA_BITMAP_COLUMN(SWTAliasTmp, swtaliastmp, 16); //! Bitmask of fired trigger aliases (see above for definitions) to be join to aod::Collisions for skimming -DECLARE_SOA_BITMAP_COLUMN(SWTAlias, swtalias, 16); //! Bitmask of fired trigger aliases (see above for definitions) to be join to aod::EMEvents for analysis -DECLARE_SOA_COLUMN(NInspectedTVX, nInspectedTVX, uint64_t); +DECLARE_SOA_BITMAP_COLUMN(SWTAliasTmp, swtaliastmp, 16); //! Bitmask of fired trigger aliases (see above for definitions) to be join to aod::Collisions for skimming +DECLARE_SOA_BITMAP_COLUMN(SWTAlias, swtalias, 16); //! Bitmask of fired trigger aliases (see above for definitions) to be join to aod::EMEvents for analysis +DECLARE_SOA_COLUMN(NInspectedTVX, nInspectedTVX, uint64_t); //! the number of inspected TVX bcs per run +DECLARE_SOA_COLUMN(NScalars, nScalers, std::vector); //! the number of triggered bcs before down scaling per run +DECLARE_SOA_COLUMN(NSelections, nSelections, std::vector); //! the number of triggered bcs after down scaling per run +DECLARE_SOA_BITMAP_COLUMN(IsAnalyzed, isAnalyzed, 16); +DECLARE_SOA_BITMAP_COLUMN(IsAnalyzedToI, isAnalyzedToI, 16); DECLARE_SOA_COLUMN(NeeULS, neeuls, int); DECLARE_SOA_COLUMN(NeeLSpp, neelspp, int); DECLARE_SOA_COLUMN(NeeLSmm, neelsmm, int); @@ -204,14 +208,24 @@ DECLARE_SOA_TABLE(EMEventsQvec, "AOD", "EMEVENTQVEC", //! event q vector table // emevent::EP4BTot using EMEventQvec = EMEventsQvec::iterator; -DECLARE_SOA_TABLE(EMSWTriggerInfos, "AOD", "EMSWTRIGGERINFO", //! joinable to EMEvents - emevent::SWTAlias, emevent::NInspectedTVX); +DECLARE_SOA_TABLE(EMSWTriggerBits, "AOD", "EMSWTBIT", emevent::SWTAlias, o2::soa::Marker<1>); //! joinable to EMEvents +using EMSWTriggerBit = EMSWTriggerBits::iterator; + +DECLARE_SOA_TABLE(EMSWTriggerInfos, "AOD", "EMSWTINFO", bc::RunNumber, emevent::NInspectedTVX, emevent::NScalars, emevent::NSelections, o2::soa::Marker<1>); //! independent table. Don't join anything. using EMSWTriggerInfo = EMSWTriggerInfos::iterator; -DECLARE_SOA_TABLE(EMSWTriggerInfosTMP, "AOD", "EMSWTTMP", //! joinable to aod::Collisions - emevent::SWTAliasTmp, emevent::NInspectedTVX); +DECLARE_SOA_TABLE(EMSWTriggerCounters, "AOD", "EMSWTCOUNTER", emevent::IsAnalyzed, emevent::IsAnalyzedToI, o2::soa::Marker<1>); //! independent table. Don't join anything. +using EMSWTriggerCounter = EMSWTriggerCounters::iterator; + +DECLARE_SOA_TABLE(EMSWTriggerBitsTMP, "AOD", "EMSWTBITTMP", emevent::SWTAliasTmp, o2::soa::Marker<2>); //! joinable to aod::Collisions +using EMSWTriggerBitTMP = EMSWTriggerBitsTMP::iterator; + +DECLARE_SOA_TABLE(EMSWTriggerInfosTMP, "AOD", "EMSWTINFOTMP", bc::RunNumber, emevent::NInspectedTVX, emevent::NScalars, emevent::NSelections, o2::soa::Marker<2>); using EMSWTriggerInfoTMP = EMSWTriggerInfosTMP::iterator; +DECLARE_SOA_TABLE(EMSWTriggerCountersTMP, "AOD", "EMSWTCOUNTERTMP", emevent::IsAnalyzed, emevent::IsAnalyzedToI, o2::soa::Marker<2>); //! independent table. Don't join anything. +using EMSWTriggerCounterTMP = EMSWTriggerCountersTMP::iterator; + DECLARE_SOA_TABLE(EMEventsProperty, "AOD", "EMEVENTPROP", //! joinable to EMEvents emevent::SpherocityPtWeighted, emevent::SpherocityPtUnWeighted, emevent::NtrackSpherocity); using EMEventProperty = EMEventsProperty::iterator; diff --git a/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx b/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx index fb1bf5da2a0..88de61009d3 100644 --- a/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx +++ b/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx @@ -29,7 +29,9 @@ #include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/Track.h" +#include #include +#include using namespace o2; using namespace o2::aod; @@ -44,7 +46,7 @@ using MyCollisions = soa::Join; // centrality table has dependency on multiplicity table. using MyCollisions_Cent_Qvec = soa::Join; -using MyCollisionsWithSWT = soa::Join; +using MyCollisionsWithSWT = soa::Join; using MyCollisionsWithSWT_Cent = soa::Join; // centrality table has dependency on multiplicity table. using MyCollisionsWithSWT_Cent_Qvec = soa::Join; @@ -60,7 +62,9 @@ struct CreateEMEventDilepton { Produces event_mult; Produces event_cent; Produces event_qvec; - Produces emswtbit; + Produces emswtbit; + Produces emswtinfo; + Produces emswtcounter; Produces event_norm_info; enum class EMEventType : int { @@ -69,77 +73,26 @@ struct CreateEMEventDilepton { kEvent_Cent_Qvec = 2, }; - // CCDB options - Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; - Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; - Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; - Configurable d_bz_input{"d_bz", -999, "bz field, -999 is automatic"}; + // // CCDB options + // Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; HistogramRegistry registry{"registry"}; void init(o2::framework::InitContext&) { - ccdb->setURL(ccdburl); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - ccdb->setFatalWhenNull(false); + // ccdb->setURL(ccdburl); + // ccdb->setCaching(true); + // ccdb->setLocalObjectValidityChecking(); + // ccdb->setFatalWhenNull(false); auto hEventCounter = registry.add("hEventCounter", "hEventCounter", kTH1I, {{7, 0.5f, 7.5f}}); hEventCounter->GetXaxis()->SetBinLabel(1, "all"); hEventCounter->GetXaxis()->SetBinLabel(2, "sel8"); - - registry.add("hNInspectedTVX", "N inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true); } ~CreateEMEventDilepton() {} - int mRunNumber; - float d_bz; - Service ccdb; - - template - void initCCDB(TBC const& bc) - { - if (mRunNumber == bc.runNumber()) { - return; - } - - // In case override, don't proceed, please - no CCDB access required - if (d_bz_input > -990) { - d_bz = d_bz_input; - o2::parameters::GRPMagField grpmag; - if (fabs(d_bz) > 1e-5) { - grpmag.setL3Current(30000.f / (d_bz / 5.0f)); - } - mRunNumber = bc.runNumber(); - return; - } - - auto run3grp_timestamp = bc.timestamp(); - o2::parameters::GRPObject* grpo = 0x0; - o2::parameters::GRPMagField* grpmag = 0x0; - if (!skipGRPOquery) - grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); - if (grpo) { - // Fetch magnetic field from ccdb for current collision - d_bz = grpo->getNominalL3Field(); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; - } else { - grpmag = ccdb->getForTimeStamp(grpmagPath, run3grp_timestamp); - if (!grpmag) { - LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp; - } - // Fetch magnetic field from ccdb for current collision - d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; - } - mRunNumber = bc.runNumber(); - } - - // Preslice perBC = aod::collision::bcId; - // Preslice perCollision_pcm = aod::v0photonkf::collisionId; - // PresliceUnsorted perCollision_el = aod::emprimaryelectron::collisionId; - // PresliceUnsorted perCollision_mu = aod::emprimarymuon::collisionId; + int mRunNumber{0}; + // Service ccdb; template void skimEvent(TCollisions const& collisions, TBCs const& bcs) @@ -161,7 +114,6 @@ struct CreateEMEventDilepton { registry.fill(HIST("hEventCounter"), 1); auto bc = collision.template foundBC_as(); - initCCDB(bc); if (collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { if constexpr (eventtype == EMEventType::kEvent) { @@ -185,7 +137,7 @@ struct CreateEMEventDilepton { if (collision.swtaliastmp_raw() == 0) { continue; } else { - emswtbit(collision.swtaliastmp_raw(), collision.nInspectedTVX()); + emswtbit(collision.swtaliastmp_raw()); } } @@ -257,23 +209,65 @@ struct CreateEMEventDilepton { } PROCESS_SWITCH(CreateEMEventDilepton, processEvent_Cent_Qvec, "process event info", false); - //---------- for data with swt---------- + //---------- for data with swt ---------- - void processEvent_SWT(MyCollisionsWithSWT const& collisions, MyBCs const& bcs) + void processEvent_SWT(MyCollisionsWithSWT const& collisions, MyBCs const& bcs, aod::EMSWTriggerInfosTMP const& emswtinfostmp, aod::EMSWTriggerCountersTMP const& emswtcounterstmp) { skimEvent(collisions, bcs); + + for (const auto& info : emswtinfostmp) { + if (mRunNumber != info.runNumber()) { + std::vector scalers; + std::vector selections; + std::copy(info.nScalers().begin(), info.nScalers().end(), std::back_inserter(scalers)); + std::copy(info.nSelections().begin(), info.nSelections().end(), std::back_inserter(selections)); + emswtinfo(info.runNumber(), info.nInspectedTVX(), scalers, selections); + mRunNumber = info.runNumber(); + } + } + for (const auto& counter : emswtcounterstmp) { + emswtcounter(counter.isAnalyzed_raw(), counter.isAnalyzedToI_raw()); + } } PROCESS_SWITCH(CreateEMEventDilepton, processEvent_SWT, "process event info", false); - void processEvent_SWT_Cent(MyCollisionsWithSWT_Cent const& collisions, MyBCs const& bcs) + void processEvent_SWT_Cent(MyCollisionsWithSWT_Cent const& collisions, MyBCs const& bcs, aod::EMSWTriggerInfosTMP const& emswtinfostmp, aod::EMSWTriggerCountersTMP const& emswtcounterstmp) { skimEvent(collisions, bcs); + + for (const auto& info : emswtinfostmp) { + if (mRunNumber != info.runNumber()) { + std::vector scalers; + std::vector selections; + std::copy(info.nScalers().begin(), info.nScalers().end(), std::back_inserter(scalers)); + std::copy(info.nSelections().begin(), info.nSelections().end(), std::back_inserter(selections)); + emswtinfo(info.runNumber(), info.nInspectedTVX(), scalers, selections); + mRunNumber = info.runNumber(); + } + } + for (const auto& counter : emswtcounterstmp) { + emswtcounter(counter.isAnalyzed_raw(), counter.isAnalyzedToI_raw()); + } } PROCESS_SWITCH(CreateEMEventDilepton, processEvent_SWT_Cent, "process event info", false); - void processEvent_SWT_Cent_Qvec(MyCollisionsWithSWT_Cent_Qvec const& collisions, MyBCs const& bcs) + void processEvent_SWT_Cent_Qvec(MyCollisionsWithSWT_Cent_Qvec const& collisions, MyBCs const& bcs, aod::EMSWTriggerInfosTMP const& emswtinfostmp, aod::EMSWTriggerCountersTMP const& emswtcounterstmp) { skimEvent(collisions, bcs); + + for (const auto& info : emswtinfostmp) { + if (mRunNumber != info.runNumber()) { + std::vector scalers; + std::vector selections; + std::copy(info.nScalers().begin(), info.nScalers().end(), std::back_inserter(scalers)); + std::copy(info.nSelections().begin(), info.nSelections().end(), std::back_inserter(selections)); + emswtinfo(info.runNumber(), info.nInspectedTVX(), scalers, selections); + mRunNumber = info.runNumber(); + } + } + for (const auto& counter : emswtcounterstmp) { + emswtcounter(counter.isAnalyzed_raw(), counter.isAnalyzedToI_raw()); + } } PROCESS_SWITCH(CreateEMEventDilepton, processEvent_SWT_Cent_Qvec, "process event info", false); diff --git a/PWGEM/Dilepton/TableProducer/skimmerOTS.cxx b/PWGEM/Dilepton/TableProducer/skimmerOTS.cxx index ece9aef306d..37a3af0215b 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerOTS.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerOTS.cxx @@ -34,15 +34,26 @@ using namespace o2::framework::expressions; using namespace o2::soa; struct skimmerOTS { - Produces swt_tmp; + Produces swtinfo_tmp; // Join aod::Collision later. + Produces swtbit_tmp; + Produces swtcounter_tmp; // CCDB options Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable cfg_swt_names{"cfg_swt_names", "fHighTrackMult,fHighFt0Mult", "comma-separated software trigger names"}; // !trigger names have to be pre-registered in dileptonTable.h for bit operation! + o2::framework::Configurable ccdbPathSoftwareTrigger{"ccdbPathSoftwareTrigger", "EventFiltering/Zorro/", "ccdb path for ZORRO objects"}; + Configurable bcMarginForSoftwareTrigger{"bcMarginForSoftwareTrigger", 100, "Number of BCs of margin for software triggers"}; std::vector swt_names; int mRunNumber; Service ccdb; + Zorro zorro; + std::vector mTOIidx; + uint64_t mNinspectedTVX{0}; + std::vector mScalers; + std::vector mSelections; + std::vector mTOICounters; + std::vector mATCounters; HistogramRegistry registry{"registry"}; void init(o2::framework::InitContext&) @@ -51,6 +62,7 @@ struct skimmerOTS { ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); ccdb->setFatalWhenNull(false); + mRunNumber = 0; LOGF(info, "enable software triggers : %s", cfg_swt_names.value.data()); std::stringstream tokenizer(cfg_swt_names.value); @@ -59,26 +71,37 @@ struct skimmerOTS { swt_names.emplace_back(token); } - const int nbin = swt_names.size(); - auto hEventCounter = registry.add("hEventCounter", "hEventCounter;;Number of Events", kTH1D, {{nbin + 1, 0.5f, nbin + 1 + 0.5f}}); - hEventCounter->GetXaxis()->SetBinLabel(1, "all"); - for (int idx = 0; idx < nbin; idx++) { - hEventCounter->GetXaxis()->SetBinLabel(idx + 2, swt_names[idx].data()); + int nbin = swt_names.size(); + auto hCollisionCounter = registry.add("hCollisionCounter", "hCollisionCounter;;Number of collisions", kTH1D, {{nbin + 1, 0.5f, nbin + 1 + 0.5f}}); + hCollisionCounter->GetXaxis()->SetBinLabel(1, "all"); + for (size_t idx = 0; idx < swt_names.size(); idx++) { + hCollisionCounter->GetXaxis()->SetBinLabel(idx + 2, swt_names[idx].data()); } - registry.add("hNInspectedTVX", "N inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true); + const int ntrg = static_cast(o2::aod::pwgem::dilepton::swt::swtAliases::kNaliases); + mNinspectedTVX = 0; + mScalers.resize(ntrg); + mSelections.resize(ntrg); + mTOICounters.resize(ntrg); + mATCounters.resize(ntrg); + for (int idx = 0; idx < ntrg; idx++) { + mTOICounters[idx] = 0; + mATCounters[idx] = 0; + mScalers[idx] = 0; + mSelections[idx] = 0; + } } ~skimmerOTS() { swt_names.clear(); swt_names.shrink_to_fit(); + mTOICounters.clear(); + mTOICounters.shrink_to_fit(); + mATCounters.clear(); + mATCounters.shrink_to_fit(); } - Zorro zorro; - std::vector mTOIidx; - uint64_t mNinspectedTVX{0}; - template void initCCDB(TBC const& bc) { @@ -86,46 +109,74 @@ struct skimmerOTS { return; } + zorro.setCCDBpath(ccdbPathSoftwareTrigger); + zorro.setBCtolerance(bcMarginForSoftwareTrigger); // this does nothing. mTOIidx = zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), cfg_swt_names.value); - for (auto& idx : mTOIidx) { - LOGF(info, "Trigger of Interest : index = %d", idx); - } - mNinspectedTVX = zorro.getInspectedTVX()->GetBinContent(1); - LOGF(info, "total inspected TVX events = %d in run number %d", mNinspectedTVX, bc.runNumber()); - registry.fill(HIST("hNInspectedTVX"), bc.runNumber(), mNinspectedTVX); + zorro.populateHistRegistry(registry, bc.runNumber()); + mNinspectedTVX = zorro.getInspectedTVX()->GetBinContent(1); + LOGF(info, "total inspected TVX events = %llu in run number %d", mNinspectedTVX, bc.runNumber()); + + for (size_t idx = 0; idx < mTOIidx.size(); idx++) { + auto swtname = swt_names[idx]; + int emswtId = o2::aod::pwgem::dilepton::swt::aliasLabels.at(swtname); + mScalers[emswtId] = zorro.getScalers()->GetBinContent(mTOIidx[idx] + 2); + mSelections[emswtId] = zorro.getSelections()->GetBinContent(mTOIidx[idx] + 2); + LOGF(info, "Trigger of Interest : index = %d in Zorro, %d in EM, scaler = %llu, selection = %llu", mTOIidx[idx], emswtId, mScalers[emswtId], mSelections[emswtId]); + } + swtinfo_tmp(bc.runNumber(), mNinspectedTVX, mScalers, mSelections); mRunNumber = bc.runNumber(); } - using MyBCs = soa::Join; - using MyCollisions = soa::Join; - - void process(MyCollisions const& collisions, MyBCs const&) + void process(aod::Collisions const& collisions, aod::BCsWithTimestamps const&) { - for (auto& collision : collisions) { - auto bc = collision.template bc_as(); // don't use foundBC. + + for (const auto& collision : collisions) { + auto bc = collision.template bc_as(); // don't use foundBC. initCCDB(bc); uint16_t trigger_bitmap = 0; - registry.fill(HIST("hEventCounter"), 1); // all - zorro.populateHistRegistry(registry, bc.runNumber()); + uint16_t analyzed_bitmap = 0; + uint16_t analyzedToI_bitmap = 0; + registry.fill(HIST("hCollisionCounter"), 1); // all + + if (zorro.isSelected(bc.globalBC(), bcMarginForSoftwareTrigger)) { // triggered event + auto swt_bitset = zorro.getLastResult(); // this has to be called after zorro::isSelected, or simply call zorro.fetch + auto TOIcounters = zorro.getTOIcounters(); // this has to be called after zorro::isSelected, or simply call zorro.fetch + auto ATcounters = zorro.getATcounters(); // this has to be called after zorro::isSelected, or simply call zorro.fetch - if (zorro.isSelected(bc.globalBC())) { // triggered event - auto swt_bitset = zorro.getLastResult(); // this has to be called after zorro::isSelected, or simply call zorro.fetch // LOGF(info, "swt_bitset.to_string().c_str() = %s", swt_bitset.to_string().c_str()); for (size_t idx = 0; idx < mTOIidx.size(); idx++) { if (swt_bitset.test(mTOIidx[idx])) { auto swtname = swt_names[idx]; - trigger_bitmap |= BIT(o2::aod::pwgem::dilepton::swt::aliasLabels.at(swtname)); + int emswtId = o2::aod::pwgem::dilepton::swt::aliasLabels.at(swtname); + trigger_bitmap |= BIT(emswtId); // LOGF(info, "swtname = %s is fired. swt index in original swt table = %d, swt index for EM table = %d", swtname.data(), mTOIidx[idx], o2::aod::pwgem::dilepton::swt::aliasLabels.at(swtname)); - registry.fill(HIST("hEventCounter"), idx + 2); // fired trigger + registry.fill(HIST("hCollisionCounter"), idx + 2); // fired trigger + + if (ATcounters[mTOIidx[idx]] > mATCounters[emswtId]) { + analyzed_bitmap |= BIT(emswtId); + mATCounters[emswtId]++; + // mATCounters[emswtId] = ATcounters[mTOIidx[idx]]; // Dont' use this line. NOT always incremented by 1 in zorro!! + } + + if (TOIcounters[idx] > mTOICounters[emswtId]) { + analyzedToI_bitmap |= BIT(emswtId); + mTOICounters[emswtId] = TOIcounters[idx]; // always incremented by 1 in zorro!! + } + + // LOGF(info, "collision.globalIndex() = %d, bc.globalBC() = %llu, mTOICounters[%d] = %d, mATcounters[%d] = %d", collision.globalIndex(), bc.globalBC(), emswtId, mTOICounters[emswtId], emswtId, mATCounters[emswtId]); } - } + } // end of TOI loop + } + swtbit_tmp(trigger_bitmap); + if (analyzed_bitmap > 0 || analyzedToI_bitmap > 0) { // storing 0 is useless. + swtcounter_tmp(analyzed_bitmap, analyzedToI_bitmap); } - // LOGF(info, "trigger_bitmap = %d, mNinspectedTVX = %d", trigger_bitmap, mNinspectedTVX); - swt_tmp(trigger_bitmap, mNinspectedTVX); + } // end of collision loop - } + + } // end of process }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx index 68324a6b40a..4e1706aac6f 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx @@ -48,7 +48,7 @@ using namespace o2::framework::expressions; using namespace o2::constants::physics; using MyCollisions = soa::Join; -using MyCollisionsWithSWT = soa::Join; +using MyCollisionsWithSWT = soa::Join; using MyTracks = soa::Join; -using MyCollisionsWithSWT = soa::Join; +using MyCollisionsWithSWT = soa::Join; using MyTracks = soa::Join; - using MyCollisionsWithSWT = soa::Join; + using MyCollisionsWithSWT = soa::Join; using MyFwdTracks = soa::Join; // muon tracks are repeated. i.e. not exclusive. using MyFwdTrack = MyFwdTracks::iterator; diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx index 094065b6256..14d965239fe 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx @@ -47,7 +47,7 @@ using namespace o2::constants::physics; using namespace o2::aod::pwgem::dilepton::utils::emtrackutil; using MyCollisions = soa::Join; -using MyCollisionsWithSWT = soa::Join; +using MyCollisionsWithSWT = soa::Join; using MyTracks = soa::Join; using MyTrack = MyTracks::iterator; diff --git a/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h index 7478a70a764..e189042abca 100644 --- a/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h +++ b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h @@ -69,7 +69,7 @@ using namespace o2::aod::pwgem::dilepton::utils; using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; -using MyCollisionsWithSWT = soa::Join; +using MyCollisionsWithSWT = soa::Join; using MyCollisionWithSWT = MyCollisionsWithSWT::iterator; using MyV0Photons = soa::Filtered>; @@ -305,8 +305,8 @@ struct DiphotonHadronMPC { if constexpr (isTriggerAnalysis) { LOGF(info, "Trigger analysis is enabled. Desired trigger name = %s", cfg_swt_name.value); - LOGF(info, "total inspected TVX events = %d in run number %d", collision.nInspectedTVX(), collision.runNumber()); - fRegistry.fill(HIST("Event/hNInspectedTVX"), collision.runNumber(), collision.nInspectedTVX()); + // LOGF(info, "total inspected TVX events = %d in run number %d", collision.nInspectedTVX(), collision.runNumber()); + // fRegistry.fill(HIST("Event/hNInspectedTVX"), collision.runNumber(), collision.nInspectedTVX()); } } @@ -955,8 +955,8 @@ struct DiphotonHadronMPC { } PROCESS_SWITCH(DiphotonHadronMPC, processAnalysis, "process pair analysis", true); - using FilteredMyCollisionsWithSWT = soa::Filtered; - void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, FilteredRefTracks const& refTracks, Types const&... args) + // using FilteredMyCollisionsWithSWT = soa::Filtered; + void processTriggerAnalysis(MyCollisionsWithSWT const& collisions, FilteredRefTracks const& refTracks, Types const&... args) { // LOGF(info, "ndf = %d", ndf); if constexpr (pairtype == PairType::kPCMPCM) { diff --git a/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx b/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx index a4c42e37003..827153ecb26 100644 --- a/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx +++ b/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx @@ -43,7 +43,7 @@ using MyCollisions = soa::Join; // centrality table has dependency on multiplicity table. using MyCollisionsCentQvec = soa::Join; -using MyCollisionsWithSWT = soa::Join; +using MyCollisionsWithSWT = soa::Join; using MyCollisionsWithSWT_Cent = soa::Join; // centrality table has dependency on multiplicity table. using MyCollisionsWithSWT_Cent_Qvec = soa::Join; @@ -58,7 +58,7 @@ struct CreateEMEventPhoton { Produces eventMult; Produces eventCent; Produces eventQvec; - Produces emswtbit; + Produces emswtbit; Produces event_norm_info; Produces eventWeights; @@ -183,7 +183,7 @@ struct CreateEMEventPhoton { if (collision.swtaliastmp_raw() == 0) { continue; } else { - emswtbit(collision.swtaliastmp_raw(), collision.nInspectedTVX()); + emswtbit(collision.swtaliastmp_raw()); } } diff --git a/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx b/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx index c0eeeba224f..a1d1eb3ee5e 100644 --- a/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx +++ b/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx @@ -62,7 +62,7 @@ using namespace o2::pwgem::photonmeson; using std::array; using MyCollisions = soa::Join; -using MyCollisionsWithSWT = soa::Join; +using MyCollisionsWithSWT = soa::Join; using MyCollisionsMC = soa::Join; using MyTracksIU = soa::Join; diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx index 435e9451a83..cb3452dc177 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx @@ -43,7 +43,7 @@ using namespace o2::constants::physics; using namespace o2::pwgem::photonmeson; using MyCollisions = soa::Join; -using MyCollisionsWithSWT = soa::Join; +using MyCollisionsWithSWT = soa::Join; using MyCollisionsMC = soa::Join; using MyTracks = soa::Join; From da00dac7cc13c096af1a469b720995d138c4f73f Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Tue, 2 Sep 2025 19:13:56 +0530 Subject: [PATCH 275/986] [PWGLF] Optimised code (#12825) --- PWGLF/Tasks/Resonances/kstarqa.cxx | 78 ++++++++++++------------------ 1 file changed, 31 insertions(+), 47 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarqa.cxx b/PWGLF/Tasks/Resonances/kstarqa.cxx index dcb7650f843..36a712c26d7 100644 --- a/PWGLF/Tasks/Resonances/kstarqa.cxx +++ b/PWGLF/Tasks/Resonances/kstarqa.cxx @@ -2043,30 +2043,7 @@ struct Kstarqa { void processEvtLossSigLossMC(EventMCGenerated::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions) // void processEvtLossSigLossMC(aod::McCollisions::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions) { - // if (selectionConfig.isINELgt0 && !mcCollision.isInelGt0()) { - // return; - // } - - bool isINELgt0true = false; - - if (pwglf::isINELgtNmc(mcParticles, 0, pdgDB)) { - isINELgt0true = true; - } - if (selectionConfig.isINELgt0 && !isINELgt0true) { - return; - } - - if (selectionConfig.checkVzEvSigLoss && (std::abs(mcCollision.posZ()) >= selectionConfig.cutzvertex)) { - return; - } - - auto impactPar = mcCollision.impactParameter(); auto multiplicityRec = -1; - auto multiplicityGen = -1; - multiplicityGen = mcCollision.centFT0M(); - hInvMass.fill(HIST("MCcorrections/hImpactParameterGen"), impactPar); - hInvMass.fill(HIST("MCcorrections/MultiplicityGen"), multiplicityGen); - bool isSelectedEvent = false; auto multiplicity1 = -999.; for (const auto& RecCollision : recCollisions) { @@ -2093,6 +2070,25 @@ struct Kstarqa { isSelectedEvent = true; } + bool isINELgt0true = false; + + if (pwglf::isINELgtNmc(mcParticles, 0, pdgDB)) { + isINELgt0true = true; + } + if (selectionConfig.isINELgt0 && !isINELgt0true) { + return; + } + + if (selectionConfig.checkVzEvSigLoss && (std::abs(mcCollision.posZ()) >= selectionConfig.cutzvertex)) { + return; + } + + auto impactPar = mcCollision.impactParameter(); + auto multiplicityGen = -1; + multiplicityGen = mcCollision.centFT0M(); + hInvMass.fill(HIST("MCcorrections/hImpactParameterGen"), impactPar); + hInvMass.fill(HIST("MCcorrections/MultiplicityGen"), multiplicityGen); + // Event loss if (isSelectedEvent) { hInvMass.fill(HIST("MCcorrections/hImpactParameterRec"), impactPar); @@ -2106,7 +2102,6 @@ struct Kstarqa { if (std::abs(mcPart.y()) >= selectionConfig.rapidityMotherData || std::abs(mcPart.pdgCode()) != o2::constants::physics::kK0Star892) continue; - // signal loss estimation hInvMass.fill(HIST("MCcorrections/hSignalLossDenominator"), mcPart.pt(), multiplicityGen); if (isSelectedEvent) { hInvMass.fill(HIST("MCcorrections/hSignalLossNumerator"), mcPart.pt(), multiplicityGen); @@ -2319,24 +2314,12 @@ struct Kstarqa { continue; } rEventSelection.fill(HIST("recMCparticles"), 5.5); - - // if (!(track1PDG == PDG_t::kKPlus && track2PDG == PDG_t::kPiPlus)) { - // continue; - // } - if (selectionConfig.isPDGCheckMC && (track1PDG != PDG_t::kKPlus) && (track1PDG != PDG_t::kPiPlus)) { - continue; - } - if (selectionConfig.isPDGCheckMC && (track2PDG != PDG_t::kKPlus) && (track2PDG != PDG_t::kPiPlus)) { - continue; - } rEventSelection.fill(HIST("recMCparticles"), 6.5); - if (selectionConfig.isPDGCheckMC && (track1PDG == PDG_t::kKPlus) && (track2PDG == PDG_t::kKPlus)) { - continue; - } - if (selectionConfig.isPDGCheckMC && (track1PDG == PDG_t::kPiPlus) && (track2PDG == PDG_t::kPiPlus)) { + if (selectionConfig.isPDGCheckMC && !(track1PDG == PDG_t::kPiPlus && track2PDG == PDG_t::kKPlus) && !(track1PDG == PDG_t::kKPlus && track2PDG == PDG_t::kPiPlus)) { continue; } + rEventSelection.fill(HIST("recMCparticles"), 7.5); for (const auto& mothertrack1 : mctrack1.mothers_as()) { @@ -2601,6 +2584,7 @@ struct Kstarqa { continue; } rEventSelection.fill(HIST("recMCparticles"), 6.5); + rEventSelection.fill(HIST("recMCparticles"), 7.5); for (const auto& mothertrack1 : mctrack1.mothers_as()) { for (const auto& mothertrack2 : mctrack2.mothers_as()) { @@ -2611,29 +2595,29 @@ struct Kstarqa { if (mothertrack1.globalIndex() != mothertrack2.globalIndex()) { continue; } - rEventSelection.fill(HIST("recMCparticles"), 7.5); + rEventSelection.fill(HIST("recMCparticles"), 8.5); if (!mothertrack1.producedByGenerator()) { continue; } - rEventSelection.fill(HIST("recMCparticles"), 8.5); + rEventSelection.fill(HIST("recMCparticles"), 9.5); if (std::abs(mothertrack1.y()) >= selectionConfig.rapidityMotherData) { continue; } - rEventSelection.fill(HIST("recMCparticles"), 9.5); + rEventSelection.fill(HIST("recMCparticles"), 10.5); if (selectionConfig.isPDGCheckMC && (std::abs(mothertrack1.pdgCode()) != o2::constants::physics::kPhi)) { continue; } - rEventSelection.fill(HIST("recMCparticles"), 10.5); + rEventSelection.fill(HIST("recMCparticles"), 11.5); if (!applypTdepPID && !(selectionPID(track1, 1) && selectionPID(track2, 1))) { // kaon and kaon continue; } else if (applypTdepPID && !(selectionPIDNew(track1, 1) && selectionPIDNew(track2, 1))) { // kaon and kaon continue; } - rEventSelection.fill(HIST("recMCparticles"), 11.5); + rEventSelection.fill(HIST("recMCparticles"), 12.5); if (selectionConfig.isApplyParticleMID) { if (selectionMID(track1, 0)) // Kaon misidentified as pion @@ -2645,14 +2629,14 @@ struct Kstarqa { if (selectionMID(track2, 2)) // Kaon misidentified as proton continue; } - rEventSelection.fill(HIST("recMCparticles"), 12.5); + rEventSelection.fill(HIST("recMCparticles"), 13.5); if (std::abs(track1.rapidity(o2::track::PID::getMass(o2::track::PID::Kaon))) > selectionConfig.ctrackRapidity) continue; if (std::abs(track2.rapidity(o2::track::PID::getMass(o2::track::PID::Kaon))) > selectionConfig.ctrackRapidity) continue; - rEventSelection.fill(HIST("recMCparticles"), 13.5); + rEventSelection.fill(HIST("recMCparticles"), 14.5); if (cQAplots) { hPID.fill(HIST("After/hTPCnsigKa_mult_pt"), track1.tpcNSigmaKa(), multiplicity, track1.pt()); // hPID.fill(HIST("After/hTPCnsigPi_mult_pt"), track2.tpcNSigmaPi(), multiplicity, track2.pt()); @@ -2671,12 +2655,12 @@ struct Kstarqa { hInvMass.fill(HIST("h1KSRecsplit"), mothertrack1.pt()); continue; } - rEventSelection.fill(HIST("recMCparticles"), 14.5); + rEventSelection.fill(HIST("recMCparticles"), 15.5); if (!selectionPair(track1, track2)) { continue; } - rEventSelection.fill(HIST("recMCparticles"), 15.5); + rEventSelection.fill(HIST("recMCparticles"), 16.5); oldindex = mothertrack1.globalIndex(); if (track1.sign() * track2.sign() < 0) { From c7b30b48b65fc2ab244130dea79efc96195d5eb4 Mon Sep 17 00:00:00 2001 From: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Date: Tue, 2 Sep 2025 17:24:07 +0200 Subject: [PATCH 276/986] [PWGCF] add configurable phimod cut function (#12822) --- PWGCF/Flow/Tasks/flowTask.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowTask.cxx b/PWGCF/Flow/Tasks/flowTask.cxx index a7691188f19..9ea88c465aa 100644 --- a/PWGCF/Flow/Tasks/flowTask.cxx +++ b/PWGCF/Flow/Tasks/flowTask.cxx @@ -147,6 +147,9 @@ struct FlowTask { O2_DEFINE_CONFIGURABLE(cfgRejectionTPCsectorOverlap, bool, false, "rejection for TPC sector overlap") O2_DEFINE_CONFIGURABLE(cfgMagnetField, std::string, "GLO/Config/GRPMagField", "CCDB path to Magnet field object") ConfigurableAxis axisPhiMod{"axisPhiMod", {100, 0, constants::math::PI / 9}, "fmod(#varphi,#pi/9)"}; + O2_DEFINE_CONFIGURABLE(cfgTPCPhiCutLowCutFunction, std::string, "0.1/x-0.005", "Function for TPC mod phi-pt cut"); + O2_DEFINE_CONFIGURABLE(cfgTPCPhiCutHighCutFunction, std::string, "0.1/x+0.01", "Function for TPC mod phi-pt cut"); + O2_DEFINE_CONFIGURABLE(cfgTPCPhiCutPtMin, float, 2.0f, "start point of phi-pt cut") TF1* fPhiCutLow = nullptr; TF1* fPhiCutHigh = nullptr; } cfgFuncParas; @@ -512,8 +515,8 @@ struct FlowTask { } if (cfgFuncParas.cfgShowTPCsectorOverlap) { - cfgFuncParas.fPhiCutLow = new TF1("fPhiCutLow", "0.06/x+pi/18.0-0.06", 0, 100); - cfgFuncParas.fPhiCutHigh = new TF1("fPhiCutHigh", "0.1/x+pi/18.0+0.06", 0, 100); + cfgFuncParas.fPhiCutLow = new TF1("fPhiCutLow", cfgFuncParas.cfgTPCPhiCutLowCutFunction->c_str(), 0, 100); + cfgFuncParas.fPhiCutHigh = new TF1("fPhiCutHigh", cfgFuncParas.cfgTPCPhiCutHighCutFunction->c_str(), 0, 100); } if (cfgTrackDensityCorrUse) { @@ -781,7 +784,7 @@ struct FlowTask { phimodn = fmod(phimodn, o2::constants::math::TwoPI / 9.0); registry.fill(HIST("pt_phi_bef"), track.pt(), phimodn); if (cfgFuncParas.cfgRejectionTPCsectorOverlap) { - if (phimodn < cfgFuncParas.fPhiCutHigh->Eval(track.pt()) && phimodn > cfgFuncParas.fPhiCutLow->Eval(track.pt())) + if (track.pt() >= cfgFuncParas.cfgTPCPhiCutPtMin && phimodn < cfgFuncParas.fPhiCutHigh->Eval(track.pt()) && phimodn > cfgFuncParas.fPhiCutLow->Eval(track.pt())) return false; // reject track } registry.fill(HIST("pt_phi_aft"), track.pt(), phimodn); From daf5b6045fd2be876311aa1c3a4a21cd0c022e39 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Tue, 2 Sep 2025 17:54:26 +0200 Subject: [PATCH 277/986] [Common] Sanitize power-law mapping in corner cases (#12827) --- Common/Tools/Multiplicity/MultModule.h | 33 ++++++++++++++++++-------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/Common/Tools/Multiplicity/MultModule.h b/Common/Tools/Multiplicity/MultModule.h index bed8817c124..f3122106de4 100644 --- a/Common/Tools/Multiplicity/MultModule.h +++ b/Common/Tools/Multiplicity/MultModule.h @@ -440,6 +440,7 @@ class MultModule internalOpts.mEnabledTables.resize(nTablesConst, 0); LOGF(info, "Configuring tables to generate"); + LOGF(info, "Metadata information: isMC? %i", metadataInfo.isMC()); const auto& workflows = context.services().template get(); TString listOfRequestors[nTablesConst]; @@ -505,16 +506,6 @@ class MultModule listOfRequestors[kPVMults].Append(Form("%s ", "dependency check")); } - // capture the need for PYTHIA calibration in Pb-Pb runs - if (metadataInfo.isMC() && mRunNumber >= 544013 && mRunNumber <= 545367) { - internalOpts.generatorName.value = "PYTHIA"; - } - - // capture the need for PYTHIA calibration in light ion runs automatically - if (metadataInfo.isMC() && mRunNumber >= 564250 && mRunNumber <= 564472) { - internalOpts.generatorName.value = "PYTHIA"; - } - // list enabled tables for (int i = 0; i < nTablesConst; i++) { // printout to be improved in the future @@ -1145,6 +1136,20 @@ class MultModule { if (bc.runNumber() != mRunNumberCentrality) { mRunNumberCentrality = bc.runNumber(); // mark that this run has been attempted already regardless of outcome + LOGF(info, "centrality loading procedure for timestamp=%llu, run number=%d", bc.timestamp(), bc.runNumber()); + + // capture the need for PYTHIA calibration in Pb-Pb runs + if (metadataInfo.isMC() && mRunNumber >= 544013 && mRunNumber <= 545367) { + LOGF(info, "This is MC for Pb-Pb. Setting generatorName automatically to PYTHIA"); + internalOpts.generatorName.value = "PYTHIA"; + } + + // capture the need for PYTHIA calibration in light ion runs automatically + if (metadataInfo.isMC() && mRunNumber >= 564250 && mRunNumber <= 564472) { + LOGF(info, "This is MC for light ion runs. Setting generatorName automatically to PYTHIA"); + internalOpts.generatorName.value = "PYTHIA"; + } + LOGF(info, "centrality loading procedure for timestamp=%llu, run number=%d", bc.timestamp(), bc.runNumber()); TList* callst = nullptr; // Check if the ccdb path is a root file @@ -1258,6 +1263,10 @@ class MultModule auto populateTable = [&](auto& table, struct CalibrationInfo& estimator, float multiplicity, bool isInelGt0) { const bool assignOutOfRange = internalOpts.embedINELgtZEROselection && !isInelGt0; auto scaleMC = [](float x, const float pars[6]) { + float core = ((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4]; + if (core < 0.0f) { + return 0.0f; // this should be marked as low multiplicity and not mapped, core^pars[5] would be NaN + } return std::pow(((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4], 1.0f / pars[5]); }; @@ -1343,6 +1352,10 @@ class MultModule ConfigureCentralityRun2(ccdb, metadataInfo, firstbc); auto scaleMC = [](float x, const float pars[6]) { + float core = ((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4]; + if (core < 0.0f) { + return 0.0f; // this should be marked as low multiplicity and not mapped, core^pars[5] would be NaN + } return std::pow(((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4], 1.0f / pars[5]); }; From 1f513da9abb847d4175141a84c2f7f946860ca50 Mon Sep 17 00:00:00 2001 From: Artem Kotliarov <71133985+KotliarovAr@users.noreply.github.com> Date: Tue, 2 Sep 2025 18:29:09 +0200 Subject: [PATCH 278/986] [PWGJE] Adjust buffer memory consumption (#12828) --- PWGJE/Tasks/recoilJets.cxx | 42 +++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/PWGJE/Tasks/recoilJets.cxx b/PWGJE/Tasks/recoilJets.cxx index 27c6bc38aca..8272b6ed539 100644 --- a/PWGJE/Tasks/recoilJets.cxx +++ b/PWGJE/Tasks/recoilJets.cxx @@ -116,8 +116,6 @@ struct RecoilJets { Configurable histMultBins{"histMultBins", 1000, "Number of bins for scaled FT0M multiplicity"}; // Axes specification - AxisSpec pT{histJetPt, 0.0, histJetPt * 1., "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec jetPTcorr{histJetPt + 20, -20., histJetPt * 1.0, "#it{p}_{T, jet}^{ch, corr} (GeV/#it{c})"}; AxisSpec phiAngle{40, 0.0, constants::math::TwoPI, "#it{#varphi} (rad)"}; AxisSpec deltaPhiAngle{52, 0.0, constants::math::PI, "#Delta#it{#varphi} (rad)"}; AxisSpec pseudorap{40, -1., 1., "#it{#eta}"}; @@ -125,8 +123,6 @@ struct RecoilJets { AxisSpec jetArea{50, 0.0, 5., "Area_{jet}"}; AxisSpec rhoArea{60, 0.0, 60., "#it{#rho} #times Area_{jet}"}; AxisSpec rho{50, 0.0, 50., "#it{#rho}"}; - AxisSpec scaledFT0C{histMultBins, 0.0, 20., "FT0C / #LT FT0C #GT"}; - AxisSpec scaledFT0M{histMultBins, 0.0, 20., "FT0M^{*}"}; ConfigurableAxis multFT0CThresh{"multFT0CThresh", {VARIABLE_WIDTH, 0, 0.2, 0.3, 0.4, 0.6, 0.8, 1., 1.4, 1.8, 2.4, 3.6, 5., 20.}, "Percentiles of scaled FT0C: 100-90%, 90-80%, 80-70%, 70-60%, 60-50%, 50-40%, 40-30%, 30-20%, 20-10%, 10-1%, 1-0.1%"}; // to adjust the boarders ConfigurableAxis multFT0MThresh{"multFT0MThresh", {VARIABLE_WIDTH, 0, 0.2, 0.3, 0.4, 0.6, 0.8, 1., 1.4, 1.8, 2.4, 3.6, 5., 20.}, "Percentiles of scaled FT0M: 100-90%, 90-80%, 80-70%, 70-60%, 60-50%, 50-40%, 40-30%, 30-20%, 20-10%, 10-1%, 1-0.1%"}; @@ -155,6 +151,14 @@ struct RecoilJets { void init(InitContext const&) { + // Initialize histogram axes + AxisSpec pT{histJetPt, 0.0, histJetPt * 1., "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec jetPTcorr{histJetPt + 20, -20., histJetPt * 1.0, "#it{p}_{T, jet}^{ch, corr} (GeV/#it{c})"}; + AxisSpec scaledFT0A{histMultBins, 0.0, 20., "FT0A / #LT FT0A #GT"}; + AxisSpec scaledFT0C{histMultBins, 0.0, 20., "FT0C / #LT FT0C #GT"}; + AxisSpec scaledFT0M{histMultBins, 0.0, 20., "FT0M^{*}"}; + + // Convert configurable strings to std::string std::string evSelToString = static_cast(evSel); std::string trkSelToString = static_cast(trkSel); @@ -303,27 +307,27 @@ struct RecoilJets { } if (doprocessMultiplicity) { - spectra.add("hMultFT0A", "Mult. signal from FTOA", kTH1F, {{2000, 0.0, 40000.}}); - spectra.add("hMultFT0C", "Mult. signal from FTOC", kTH1F, {{2000, 0.0, 40000.}}); - spectra.add("hMultFT0M", "Total mult. signal from FT0A & FTOC", kTH1F, {{3000, 0.0, 60000.}}); + spectra.add("hMultFT0A", "Mult. signal from FTOA", kTH1F, {{2000, 0.0, 40000., "FT0A"}}); + spectra.add("hMultFT0C", "Mult. signal from FTOC", kTH1F, {{2000, 0.0, 40000., "FT0C"}}); + spectra.add("hMultFT0M", "Total mult. signal from FT0A & FTOC", kTH1F, {{3000, 0.0, 60000., "FT0M"}}); - spectra.add("hScaleMultFT0A", "Scaled mult. signal from FTOA", kTH1F, {{200, 0.0, 20., "FT0A / #LT FT0A #GT"}}); + spectra.add("hScaleMultFT0A", "Scaled mult. signal from FTOA", kTH1F, {scaledFT0A}); spectra.add("hScaleMultFT0C", "Scaled mult. signal from FTOC", kTH1F, {scaledFT0C}); spectra.add("hScaleMultFT0M", "Scaled total mult. signal from FT0A & FTOC", kTH1F, {scaledFT0M}); - spectra.add("hMultZNA", "Mult. signal from ZDC A-side", kTH1F, {{1000, 0.0, 5000.}}); - spectra.add("hMultZNC", "Mult. signal from ZDC C-side", kTH1F, {{1000, 0.0, 5000.}}); - spectra.add("hMultZNM", "Total mult. signal from ZDCs", kTH1F, {{4000, 0.0, 8000.}}); + spectra.add("hMultZNA", "Mult. signal from ZDC A-side", kTH1F, {{1000, 0.0, 5000., "ZNA"}}); + spectra.add("hMultZNC", "Mult. signal from ZDC C-side", kTH1F, {{1000, 0.0, 5000., "ZNC"}}); + spectra.add("hMultZNM", "Total mult. signal from ZDCs", kTH1F, {{4000, 0.0, 8000., "ZNM"}}); // Correlations - spectra.add("hMultFT0A_vs_ZNA", "Correlation of signals FTOA vs ZNA", kTH2F, {{2000, 0.0, 40000.}, {1000, 0.0, 5000.}}); - spectra.add("hMultFT0C_vs_ZNC", "Correlation of signals FTOC vs ZNC", kTH2F, {{2000, 0.0, 40000.}, {1000, 0.0, 5000.}}); - spectra.add("hMultFT0M_vs_ZNM", "Correlation of signals FTOM vs ZNM", kTH2F, {{3000, 0.0, 60000.}, {4000, 0.0, 8000.}}); - - spectra.add("hScaleMultFT0A_vs_ZNA", "Correlation of signals FT0A/meanFT0A vs ZNA", kTH2F, {{200, 0.0, 20., "FT0A / #LT FT0A #GT"}, {1000, 0.0, 5000.}}); - spectra.add("hScaleMultFT0C_vs_ZNC", "Correlation of signals FT0C/meanFT0C vs ZNC", kTH2F, {{scaledFT0C}, {1000, 0.0, 5000.}}); - spectra.add("hScaleMultFT0M_vs_ZNM", "Correlation of signals FT0M^{*} vs ZNM", kTH2F, {{scaledFT0M}, {4000, 0.0, 8000.}}); - spectra.add("hScaleMultFT0M_vs_ZNA_vs_ZNC", "Correlation of signals FT0M^{*} vs ZNA vs ZNC", kTH3F, {{scaledFT0M}, {1000, 0.0, 5000.}, {1000, 0.0, 5000.}}); + spectra.add("hMultFT0A_vs_ZNA", "Correlation of signals FTOA vs ZNA", kTH2F, {{2000, 0.0, 40000., "FT0A"}, {1000, 0.0, 5000., "ZNA"}}); + spectra.add("hMultFT0C_vs_ZNC", "Correlation of signals FTOC vs ZNC", kTH2F, {{2000, 0.0, 40000., "FT0C"}, {1000, 0.0, 5000., "ZNC"}}); + spectra.add("hMultFT0M_vs_ZNM", "Correlation of signals FTOM vs ZNM", kTH2F, {{3000, 0.0, 60000., "FT0M"}, {4000, 0.0, 8000., "ZNM"}}); + + spectra.add("hScaleMultFT0A_vs_ZNA", "Correlation of signals FT0A/meanFT0A vs ZNA", kTH2F, {{scaledFT0A}, {1000, 0.0, 5000., "ZNA"}}); + spectra.add("hScaleMultFT0C_vs_ZNC", "Correlation of signals FT0C/meanFT0C vs ZNC", kTH2F, {{scaledFT0C}, {1000, 0.0, 5000., "ZNC"}}); + spectra.add("hScaleMultFT0M_vs_ZNM", "Correlation of signals FT0M^{*} vs ZNM", kTH2F, {{scaledFT0M}, {4000, 0.0, 8000., "ZNM"}}); + spectra.add("hScaleMultFT0M_vs_ZNA_vs_ZNC", "Correlation of signals FT0M^{*} vs ZNA vs ZNC", kTH3F, {{scaledFT0M}, {600, 0.0, 3000., "ZNA"}, {600, 0.0, 3000., "ZNC"}}); } } From 24310e6b7466caddcc5e80ac1f6dfc70d0bbf1c5 Mon Sep 17 00:00:00 2001 From: yuanzhe <90246048+wang-yuanzhe@users.noreply.github.com> Date: Tue, 2 Sep 2025 20:03:48 +0200 Subject: [PATCH 279/986] [PWGLF] Fix mc info matching bugs in hypertriton kink analysis (#12829) --- .../Nuspex/hyperkinkRecoTask.cxx | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx b/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx index ef26c0f7b06..7dbef51d646 100644 --- a/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx @@ -369,8 +369,6 @@ struct HyperkinkRecoTask { Service ccdb; o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; - std::vector mcPartIndices; - // Histograms are defined with HistogramRegistry HistogramRegistry registry{"registry", {}}; @@ -590,17 +588,17 @@ struct HyperkinkRecoTask { auto motherTrackPar = getTrackParCov(trackMoth); o2::dataformats::VertexBase primaryVtx = {{collision.posX(), collision.posY(), collision.posZ()}, {collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()}}; std::array pMotherPv = {-999.f}; + std::array updatePMotherPv = {-999.f}; if (o2::base::Propagator::Instance()->propagateToDCABxByBz(primaryVtx, motherTrackPar, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrLUT)) { motherTrackPar.getPxPyPzGlo(pMotherPv); + if (motherTrackPar.update(primaryVtx)) { + motherTrackPar.getPxPyPzGlo(updatePMotherPv); + } } + hypkinkCand.momMothPV[0] = pMotherPv[0]; hypkinkCand.momMothPV[1] = pMotherPv[1]; hypkinkCand.momMothPV[2] = pMotherPv[2]; - - std::array updatePMotherPv = {-999.f}; - if (motherTrackPar.update(primaryVtx)) { - motherTrackPar.getPxPyPzGlo(updatePMotherPv); - } hypkinkCand.updateMomMothPV[0] = updatePMotherPv[0]; hypkinkCand.updateMomMothPV[1] = updatePMotherPv[1]; hypkinkCand.updateMomMothPV[2] = updatePMotherPv[2]; @@ -714,23 +712,27 @@ struct HyperkinkRecoTask { void processMC(MCLabeledCollisionsFull const& collisions, aod::KinkCands const& KinkCands, MCLabeledTracksIU const& tracks, aod::McParticles const& particlesMC, aod::McCollisions const& mcCollisions, aod::BCsWithTimestamps const&) { - mcPartIndices.clear(); std::vector mcPartIndices; setTrackIDForMC(mcPartIndices, particlesMC, tracks); + std::vector signalIndicesPool; std::vector isReconstructedMCCollisions(mcCollisions.size(), false); std::vector isSelectedMCCollisions(mcCollisions.size(), false); std::vector isGoodCollisions(collisions.size(), false); std::vector dauIDList(2, -1); for (const auto& collision : collisions) { - isReconstructedMCCollisions[collision.mcCollisionId()] = true; + if (collision.has_mcCollision()) { + isReconstructedMCCollisions[collision.mcCollisionId()] = true; + } registry.fill(HIST("hEventCounter"), 0); if (doEventCut && (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || std::abs(collision.posZ()) > maxZVertex)) { continue; } registry.fill(HIST("hEventCounter"), 1); registry.fill(HIST("hVertexZCollision"), collision.posZ()); - isSelectedMCCollisions[collision.mcCollisionId()] = true; + if (collision.has_mcCollision()) { + isSelectedMCCollisions[collision.mcCollisionId()] = true; + } isGoodCollisions[collision.globalIndex()] = true; } @@ -883,7 +885,7 @@ struct HyperkinkRecoTask { hypkinkCand.isSignal = true; hypkinkCand.isSignalReco = true; fillCandidateMCInfo(hypkinkCand, mcMothTrack, mcDaugTrack, mcNeutTrack); - mcPartIndices.push_back(mcMothTrack.globalIndex()); + signalIndicesPool.push_back(mcMothTrack.globalIndex()); std::array dcaInfo; auto mcMothTrackPar = getTrackParFromMC(mcMothTrack, 2); @@ -934,7 +936,7 @@ struct HyperkinkRecoTask { continue; } - if (std::find(mcPartIndices.begin(), mcPartIndices.end(), mcparticle.globalIndex()) != mcPartIndices.end()) { + if (std::find(signalIndicesPool.begin(), signalIndicesPool.end(), mcparticle.globalIndex()) != signalIndicesPool.end()) { continue; } @@ -1243,13 +1245,16 @@ struct HyperkinkQa { setTrackIDForMC(mcPartIndices, particlesMC, tracks); std::vector isSelectedMCCollisions(mcCollisions.size(), false); std::vector dauIDList(2, -1); + for (const auto& collision : collisions) { genQAHist.fill(HIST("hCollCounter"), 0.5); if (doEventCut && (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || std::abs(collision.posZ()) > maxZVertex)) { continue; } genQAHist.fill(HIST("hCollCounter"), 1.5); - isSelectedMCCollisions[collision.mcCollisionId()] = true; + if (collision.has_mcCollision()) { + isSelectedMCCollisions[collision.mcCollisionId()] = true; + } } for (const auto& mcCollision : mcCollisions) { From 17131ce34074256319b86b90de76edd0c16e9618 Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Wed, 3 Sep 2025 00:32:51 +0530 Subject: [PATCH 280/986] [PWGLF] Added V0 daughter selection in derived data (#12831) --- .../Tasks/Resonances/higherMassResonances.cxx | 126 ++++++++---------- 1 file changed, 54 insertions(+), 72 deletions(-) diff --git a/PWGLF/Tasks/Resonances/higherMassResonances.cxx b/PWGLF/Tasks/Resonances/higherMassResonances.cxx index fbb552a9b29..8fbac8faf5c 100644 --- a/PWGLF/Tasks/Resonances/higherMassResonances.cxx +++ b/PWGLF/Tasks/Resonances/higherMassResonances.cxx @@ -120,7 +120,7 @@ struct HigherMassResonances { Configurable confV0DCADaughMax{"confV0DCADaughMax", 1.0f, "DCA b/w V0 daughters"}; Configurable v0settingDcapostopv{"v0settingDcapostopv", 0.06, "DCA Pos To PV"}; Configurable v0settingDcanegtopv{"v0settingDcanegtopv", 0.06, "DCA Neg To PV"}; - Configurable cMaxV0DCA{"cMaxV0DCA", 0.3, "DCA V0 to PV"}; + Configurable cMaxV0DCA{"cMaxV0DCA", 0.5, "DCA V0 to PV"}; Configurable confV0PtMin{"confV0PtMin", 0.f, "Minimum transverse momentum of V0"}; Configurable confV0CPAMin{"confV0CPAMin", 0.97f, "Minimum CPA of V0"}; Configurable confV0TranRadV0Min{"confV0TranRadV0Min", 0.5f, "Minimum transverse radius"}; @@ -581,6 +581,52 @@ struct HigherMassResonances { return true; } + using EventCandidatesDerivedData = soa::Join; + using V0CandidatesDerivedData = soa::Join; + using DauTracks = soa::Join; + + template + bool isSelectedK0sDaughtersDerived(TV0 const& v0) + { + // Fpr derived dataset + + // de-ref track extras + auto posTrackExtra = v0.template posTrackExtra_as(); + auto negTrackExtra = v0.template negTrackExtra_as(); + + if (std::abs(v0.positiveeta()) > config.confDaughEta || std::abs(v0.negativeeta()) > config.confDaughEta) { + return false; + } + + if (posTrackExtra.tpcNClsCrossedRows() < config.tpcCrossedrows || negTrackExtra.tpcNClsCrossedRows() < config.tpcCrossedrows) { + return false; + } + + if (posTrackExtra.tpcNClsFound() < config.confDaughTPCnclsMin || negTrackExtra.tpcNClsFound() < config.confDaughTPCnclsMin) { + return false; + } + if (posTrackExtra.tpcCrossedRowsOverFindableCls() < config.tpcCrossedrowsOverfcls || negTrackExtra.tpcCrossedRowsOverFindableCls() < config.tpcCrossedrowsOverfcls) { + return false; + } + + // check TPC PID + if (((std::abs(posTrackExtra.tpcNSigmaPi()) > config.confDaughPIDCutTPC) || (std::abs(negTrackExtra.tpcNSigmaPi()) > config.confDaughPIDCutTPC))) { + return false; + } + + if (config.isApplyDCAv0topv && (std::abs(v0.dcapostopv()) < config.cMaxV0DCA || std::abs(v0.dcanegtopv()) < config.cMaxV0DCA)) { + return false; + } + + // rKzeroShort.fill(HIST("negative_pt"), negTrackExtra.pt()); + // rKzeroShort.fill(HIST("positive_pt"), posTrackExtra.pt()); + // rKzeroShort.fill(HIST("negative_eta"), negTrackExtra.eta()); + // rKzeroShort.fill(HIST("positive_eta"), posTrackExtra.eta()); + // rKzeroShort.fill(HIST("negative_phi"), negTrackExtra.phi()); + // rKzeroShort.fill(HIST("positive_phi"), posTrackExtra.phi()); + return true; + } + // Angular separation cut on KsKs pairs template bool applyAngSep(const T1& candidate1, const T2& candidate2) @@ -887,14 +933,6 @@ struct HigherMassResonances { } PROCESS_SWITCH(HigherMassResonances, processSE, "same event process", true); - // using EventCandidates = soa::Filtered>; - // using TrackCandidates = soa::Filtered>; - // using V0TrackCandidate = aod::V0Datas; - - using EventCandidatesDerivedData = soa::Join; - using V0CandidatesDerivedData = soa::Join; - using DauTracks = soa::Join; - ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for ME mixing"}; // ConfigurableAxis axisMultiplicityClass{"axisMultiplicityClass", {10, 0, 100}, "multiplicity percentile for ME mixing"}; ConfigurableAxis axisMultiplicity{"axisMultiplicity", {2000, 0, 10000}, "TPC multiplicity axis for ME mixing"}; @@ -1284,8 +1322,9 @@ struct HigherMassResonances { } PROCESS_SWITCH(HigherMassResonances, processRec, "Process Reconstructed", false); - void processSEderived(EventCandidatesDerivedData::iterator const& collision, V0CandidatesDerivedData const& V0s) + void processSEderived(EventCandidatesDerivedData::iterator const& collision, V0CandidatesDerivedData const& V0s, DauTracks const&) { + multiplicity = 0.0; if (config.cSelectMultEstimator == kFT0M) { multiplicity = collision.centFT0M(); } else if (config.cSelectMultEstimator == kFT0A) { @@ -1323,50 +1362,18 @@ struct HigherMassResonances { continue; } - // auto postrack1 = v1.template posTrack_as(); - // auto negtrack1 = v1.template negTrack_as(); - // auto postrack2 = v2.template posTrack_as(); - // auto negtrack2 = v2.template negTrack_as(); - - // double nTPCSigmaPos1{postrack1.tpcNSigmaPi()}; - // double nTPCSigmaNeg1{negtrack1.tpcNSigmaPi()}; - // double nTPCSigmaPos2{postrack2.tpcNSigmaPi()}; - // double nTPCSigmaNeg2{negtrack2.tpcNSigmaPi()}; - - // if (!(isSelectedV0Daughter(negtrack1, -1, nTPCSigmaNeg1, v1) && isSelectedV0Daughter(postrack1, 1, nTPCSigmaPos1, v1))) { - // continue; - // } - // if (!(isSelectedV0Daughter(postrack2, 1, nTPCSigmaPos2, v2) && isSelectedV0Daughter(negtrack2, -1, nTPCSigmaNeg2, v2))) { - // continue; - // } + if (!isSelectedK0sDaughtersDerived(v1) || !isSelectedK0sDaughtersDerived(v2)) { + continue; + } if (std::find(v0indexes.begin(), v0indexes.end(), v1.globalIndex()) == v0indexes.end()) { v0indexes.push_back(v1.globalIndex()); } - // if (!(std::find(v0indexes.begin(), v0indexes.end(), v2.globalIndex()) != v0indexes.end())) { - // v0indexes.push_back(v2.globalIndex()); - // } if (v2.globalIndex() <= v1.globalIndex()) { continue; } - // if (config.qAv0Daughters) { - // rKzeroShort.fill(HIST("negative_pt"), negtrack1.pt()); - // rKzeroShort.fill(HIST("positive_pt"), postrack1.pt()); - // rKzeroShort.fill(HIST("negative_eta"), negtrack1.eta()); - // rKzeroShort.fill(HIST("positive_eta"), postrack1.eta()); - // rKzeroShort.fill(HIST("negative_phi"), negtrack1.phi()); - // rKzeroShort.fill(HIST("positive_phi"), postrack1.phi()); - // } - - // if (postrack1.globalIndex() == postrack2.globalIndex()) { - // continue; - // } - // if (negtrack1.globalIndex() == negtrack2.globalIndex()) { - // continue; - // } - if (!applyAngSep(v1, v2)) { continue; } @@ -1393,7 +1400,7 @@ struct HigherMassResonances { } PROCESS_SWITCH(HigherMassResonances, processSEderived, "same event process in strangeness derived data", false); - void processMEderived(EventCandidatesDerivedData const& collisions, TrackCandidates const& /*tracks*/, V0CandidatesDerivedData const& v0s) + void processMEderived(EventCandidatesDerivedData const& collisions, TrackCandidates const& /*tracks*/, V0CandidatesDerivedData const& v0s, DauTracks const&) { for (const auto& [c1, c2] : selfCombinations(colBinning, config.cfgNmixedEvents, -1, collisions, collisions)) // two different centrality c1 and c2 and tracks corresponding to them @@ -1419,32 +1426,7 @@ struct HigherMassResonances { if (!selectionV0(c2, t2, multiplicity)) continue; - auto postrack1 = t1.template posTrackExtra_as(); - auto negtrack1 = t1.template negTrackExtra_as(); - auto postrack2 = t2.template posTrackExtra_as(); - auto negtrack2 = t2.template negTrackExtra_as(); - - if (postrack1.globalIndex() == postrack2.globalIndex()) { - continue; - } - if (negtrack1.globalIndex() == negtrack2.globalIndex()) { - continue; - } - double nTPCSigmaPos1{postrack1.tpcNSigmaPi()}; - double nTPCSigmaNeg1{negtrack1.tpcNSigmaPi()}; - double nTPCSigmaPos2{postrack2.tpcNSigmaPi()}; - double nTPCSigmaNeg2{negtrack2.tpcNSigmaPi()}; - - if (!isSelectedV0Daughter(postrack1, 1, nTPCSigmaPos1, t1)) { - continue; - } - if (!isSelectedV0Daughter(postrack2, 1, nTPCSigmaPos2, t2)) { - continue; - } - if (!isSelectedV0Daughter(negtrack1, -1, nTPCSigmaNeg1, t1)) { - continue; - } - if (!isSelectedV0Daughter(negtrack2, -1, nTPCSigmaNeg2, t2)) { + if (!isSelectedK0sDaughtersDerived(t1) || !isSelectedK0sDaughtersDerived(t2)) { continue; } From e4f3f1ae07be066e858cc5eea284db5ed2708e4b Mon Sep 17 00:00:00 2001 From: fuchuncui <162277233+fuchuncui@users.noreply.github.com> Date: Wed, 3 Sep 2025 04:28:21 +0800 Subject: [PATCH 281/986] [PWGCF] add some QA histos in flowGfwOmegaXi.cxx (#12817) --- PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx | 319 +++++++++++++--------------- 1 file changed, 142 insertions(+), 177 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx b/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx index bf001b02df2..c0c3fd8e592 100644 --- a/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx +++ b/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx @@ -100,6 +100,8 @@ struct FlowGfwOmegaXi { O2_DEFINE_CONFIGURABLE(cfgv0_mk0swindow, float, 0.1f, "Invariant mass window of K0s") O2_DEFINE_CONFIGURABLE(cfgv0_mlambdawindow, float, 0.04f, "Invariant mass window of lambda") O2_DEFINE_CONFIGURABLE(cfgv0_ArmPodocut, float, 0.2f, "Armenteros Podolski cut for K0") + O2_DEFINE_CONFIGURABLE(cfgv0_compmassrejLambda, float, 0.01f, "competing mass rejection of lambda") + O2_DEFINE_CONFIGURABLE(cfgv0_compmassrejK0s, float, 0.005f, "competing mass rejection of K0s") } v0BuilderOpts; struct : ConfigurableGroup { @@ -113,7 +115,7 @@ struct FlowGfwOmegaXi { O2_DEFINE_CONFIGURABLE(cfgcasc_dcacascdau, float, 0.3f, "maximum DCA among cascade daughters") O2_DEFINE_CONFIGURABLE(cfgcasc_dcav0dau, float, 1.0f, "maximum DCA among V0 daughters") O2_DEFINE_CONFIGURABLE(cfgcasc_mlambdawindow, float, 0.04f, "Invariant mass window of lambda") - O2_DEFINE_CONFIGURABLE(cfgcasc_compmassrej, float, 0.008f, "Invariant mass window of lambda") + O2_DEFINE_CONFIGURABLE(cfgcasc_compmassrej, float, 0.008f, "competing mass rejection of cascades") } cascBuilderOpts; struct : ConfigurableGroup { @@ -302,6 +304,14 @@ struct FlowGfwOmegaXi { // Add some output objects to the histogram registry registry.add("hPhi", "", {HistType::kTH1D, {cfgaxisPhi}}); registry.add("hPhicorr", "", {HistType::kTH1D, {cfgaxisPhi}}); + registry.add("hPhiK0s", "", {HistType::kTH1D, {cfgaxisPhi}}); + registry.add("hPhiLambda", "", {HistType::kTH1D, {cfgaxisPhi}}); + registry.add("hPhiXi", "", {HistType::kTH1D, {cfgaxisPhi}}); + registry.add("hPhiOmega", "", {HistType::kTH1D, {cfgaxisPhi}}); + registry.add("hPhiK0scorr", "", {HistType::kTH1D, {cfgaxisPhi}}); + registry.add("hPhiLambdacorr", "", {HistType::kTH1D, {cfgaxisPhi}}); + registry.add("hPhiXicorr", "", {HistType::kTH1D, {cfgaxisPhi}}); + registry.add("hPhiOmegacorr", "", {HistType::kTH1D, {cfgaxisPhi}}); registry.add("hEta", "", {HistType::kTH1D, {cfgaxisEta}}); registry.add("hVtxZ", "", {HistType::kTH1D, {cfgaxisVertex}}); registry.add("hMult", "", {HistType::kTH1D, {cfgaxisNch}}); @@ -345,18 +355,31 @@ struct FlowGfwOmegaXi { registry.add("QAhisto/V0/hqadcanegtoPVbefore", "", {HistType::kTH1D, {{1000, -10, 10}}}); registry.add("QAhisto/V0/hqadcanegtoPVafter", "", {HistType::kTH1D, {{1000, -10, 10}}}); // Cascade QA - registry.add("QAhisto/Casc/hqaCasccosPAbefore", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); - registry.add("QAhisto/Casc/hqaCasccosPAafter", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); - registry.add("QAhisto/Casc/hqaCascV0cosPAbefore", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); - registry.add("QAhisto/Casc/hqaCascV0cosPAafter", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); - registry.add("QAhisto/Casc/hqadcaCascV0toPVbefore", "", {HistType::kTH1D, {{1000, -10, 10}}}); - registry.add("QAhisto/Casc/hqadcaCascV0toPVafter", "", {HistType::kTH1D, {{1000, -10, 10}}}); - registry.add("QAhisto/Casc/hqadcaCascBachtoPVbefore", "", {HistType::kTH1D, {{1000, -10, 10}}}); - registry.add("QAhisto/Casc/hqadcaCascBachtoPVafter", "", {HistType::kTH1D, {{1000, -10, 10}}}); - registry.add("QAhisto/Casc/hqadcaCascdaubefore", "", {HistType::kTH1D, {{100, 0, 1}}}); - registry.add("QAhisto/Casc/hqadcaCascdauafter", "", {HistType::kTH1D, {{100, 0, 1}}}); - registry.add("QAhisto/Casc/hqadcaCascV0daubefore", "", {HistType::kTH1D, {{100, 0, 1}}}); - registry.add("QAhisto/Casc/hqadcaCascV0dauafter", "", {HistType::kTH1D, {{100, 0, 1}}}); + registry.add("QAhisto/Xi/hqaCasccosPAbefore", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); + registry.add("QAhisto/Xi/hqaCasccosPAafter", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); + registry.add("QAhisto/Xi/hqaCascV0cosPAbefore", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); + registry.add("QAhisto/Xi/hqaCascV0cosPAafter", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); + registry.add("QAhisto/Xi/hqadcaCascV0toPVbefore", "", {HistType::kTH1D, {{1000, -10, 10}}}); + registry.add("QAhisto/Xi/hqadcaCascV0toPVafter", "", {HistType::kTH1D, {{1000, -10, 10}}}); + registry.add("QAhisto/Xi/hqadcaCascBachtoPVbefore", "", {HistType::kTH1D, {{1000, -10, 10}}}); + registry.add("QAhisto/Xi/hqadcaCascBachtoPVafter", "", {HistType::kTH1D, {{1000, -10, 10}}}); + registry.add("QAhisto/Xi/hqadcaCascdaubefore", "", {HistType::kTH1D, {{100, 0, 1}}}); + registry.add("QAhisto/Xi/hqadcaCascdauafter", "", {HistType::kTH1D, {{100, 0, 1}}}); + registry.add("QAhisto/Xi/hqadcaCascV0daubefore", "", {HistType::kTH1D, {{100, 0, 1}}}); + registry.add("QAhisto/Xi/hqadcaCascV0dauafter", "", {HistType::kTH1D, {{100, 0, 1}}}); + + registry.add("QAhisto/Omega/hqaCasccosPAbefore", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); + registry.add("QAhisto/Omega/hqaCasccosPAafter", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); + registry.add("QAhisto/Omega/hqaCascV0cosPAbefore", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); + registry.add("QAhisto/Omega/hqaCascV0cosPAafter", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); + registry.add("QAhisto/Omega/hqadcaCascV0toPVbefore", "", {HistType::kTH1D, {{1000, -10, 10}}}); + registry.add("QAhisto/Omega/hqadcaCascV0toPVafter", "", {HistType::kTH1D, {{1000, -10, 10}}}); + registry.add("QAhisto/Omega/hqadcaCascBachtoPVbefore", "", {HistType::kTH1D, {{1000, -10, 10}}}); + registry.add("QAhisto/Omega/hqadcaCascBachtoPVafter", "", {HistType::kTH1D, {{1000, -10, 10}}}); + registry.add("QAhisto/Omega/hqadcaCascdaubefore", "", {HistType::kTH1D, {{100, 0, 1}}}); + registry.add("QAhisto/Omega/hqadcaCascdauafter", "", {HistType::kTH1D, {{100, 0, 1}}}); + registry.add("QAhisto/Omega/hqadcaCascV0daubefore", "", {HistType::kTH1D, {{100, 0, 1}}}); + registry.add("QAhisto/Omega/hqadcaCascV0dauafter", "", {HistType::kTH1D, {{100, 0, 1}}}); } // cumulant of flow @@ -448,8 +471,6 @@ struct FlowGfwOmegaXi { fGFW->AddRegion("reffull", -0.8, 0.8, 1, 1); // ("name", etamin, etamax, ptbinnum, bitmask)eta region -0.8 to 0.8 fGFW->AddRegion("refN10", -0.8, -0.4, 1, 1); fGFW->AddRegion("refP10", 0.4, 0.8, 1, 1); - fGFW->AddRegion("olxidaudpt", -0.8, 0.8, 1, 2048); - fGFW->AddRegion("olomegadaudpt", -0.8, 0.8, 1, 4096); // POI fGFW->AddRegion("poiN10dpt", -0.8, -0.4, nPtBins, 32); fGFW->AddRegion("poiP10dpt", 0.4, 0.8, nPtBins, 32); @@ -460,14 +481,10 @@ struct FlowGfwOmegaXi { fGFW->AddRegion("poiXiPdpt", 0.4, 0.8, nXiptMassBins, 2); fGFW->AddRegion("poiXiNdpt", -0.8, -0.4, nXiptMassBins, 2); fGFW->AddRegion("poiXifulldpt", -0.8, 0.8, nXiptMassBins, 2); - fGFW->AddRegion("poiXiP", 0.4, 0.8, 1, 2); - fGFW->AddRegion("poiXiN", -0.8, -0.4, 1, 2); int nOmegaptMassBins = nXiPtBins * cfgmassbins[3]; fGFW->AddRegion("poiOmegaPdpt", 0.4, 0.8, nOmegaptMassBins, 4); fGFW->AddRegion("poiOmegaNdpt", -0.8, -0.4, nOmegaptMassBins, 4); fGFW->AddRegion("poiOmegafulldpt", -0.8, 0.8, nOmegaptMassBins, 4); - fGFW->AddRegion("poiOmegaP", 0.4, 0.8, 1, 4); - fGFW->AddRegion("poiOmegaN", -0.8, -0.4, 1, 4); int nK0sptMassBins = nK0sPtBins * cfgmassbins[0]; fGFW->AddRegion("poiK0sPdpt", 0.4, 0.8, nK0sptMassBins, 8); fGFW->AddRegion("poiK0sNdpt", -0.8, -0.4, nK0sptMassBins, 8); @@ -536,12 +553,8 @@ struct FlowGfwOmegaXi { corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiXiPdpt refN10 {2 2 -2 -2}", "Xi10Gap24a", kTRUE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiXiNdpt refP10 {2 2 -2 -2}", "Xi10Gap24b", kTRUE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiXifulldpt {2} olxidaudpt {-2}", "XiFullol22", kTRUE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiXifulldpt olxidaudpt {2 2 -2 -2}", "XiFullol24", kTRUE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegaPdpt refN10 {2 2 -2 -2}", "Omega10Gap24a", kTRUE)); // 45 corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegaNdpt refP10 {2 2 -2 -2}", "Omega10Gap24b", kTRUE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegafulldpt {2} olomegadaudpt {-2}", "OmegaFullol22", kTRUE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegafulldpt olomegadaudpt {2 2 -2 -2}", "OmegaFullol24", kTRUE)); fGFW->CreateRegions(); // finalize the initialization // used for event selection @@ -702,56 +715,6 @@ struct FlowGfwOmegaXi { return; } - // remove auto-corr - template - void fillProfilepTMass(const GFW::CorrConfig& corrconf, const GFW::CorrConfig& corrconfol, const ConstStr& tarName, const int& ptbin, const int& PDGCode, const float& cent) - { - int nMassBins = 0; - int nptbins = 0; - TAxis* fMass = nullptr; - TAxis* fpt = nullptr; - if (PDGCode == kXiMinus) { - nMassBins = cfgmassbins[2]; - nptbins = nXiPtBins; - fpt = fXiPtAxis; - fMass = fXiMass; - } else if (PDGCode == kOmegaMinus) { - nMassBins = cfgmassbins[3]; - nptbins = nOmegaPtBins; - fpt = fOmegaPtAxis; - fMass = fOmegaMass; - } else if (PDGCode == kK0Short) { - nMassBins = cfgmassbins[0]; - nptbins = nK0sPtBins; - fpt = fK0sPtAxis; - fMass = fK0sMass; - } else if (PDGCode == kLambda0) { - nMassBins = cfgmassbins[1]; - nptbins = nLambdaPtBins; - fpt = fLambdaPtAxis; - fMass = fLambdaMass; - } else { - LOGF(error, "Error, please put in correct PDGCode of K0s, Lambda, Xi or Omega"); - return; - } - for (int massbin = 1; massbin <= nMassBins; massbin++) { - float dnx = 0; - float val = 0; - float dnxol = 0; - dnx = fGFW->Calculate(corrconf, (ptbin - 1) + ((massbin - 1) * nptbins), kTRUE).real(); - dnxol = fGFW->Calculate(corrconfol, (ptbin - 1) + ((massbin - 1) * nptbins), kTRUE).real(); - dnx = dnx - dnxol; - if (dnx == 0) - continue; - val = (fGFW->Calculate(corrconf, (ptbin - 1) + ((massbin - 1) * nptbins), kFALSE).real() - fGFW->Calculate(corrconfol, (ptbin - 1) + ((massbin - 1) * nptbins), kFALSE).real()) / dnx; - - if (std::fabs(val) < 1) { - registry.fill(tarName, fpt->GetBinCenter(ptbin), fMass->GetBinCenter(massbin), cent, val, dnx); - } - } - return; - } - // input shared_ptr void fillProfilepTMass(const GFW::CorrConfig& corrconf, std::shared_ptr TProfile3D, const int& ptbin, const int& PDGCode, const float& cent) { @@ -797,54 +760,6 @@ struct FlowGfwOmegaXi { return; } - // remove auto-corr - void fillProfilepTMass(const GFW::CorrConfig& corrconf, const GFW::CorrConfig& corrconfol, std::shared_ptr TProfile3D, const int& ptbin, const int& PDGCode, const float& cent) - { - int nMassBins = 0; - int nptbins = 0; - TAxis* fMass = nullptr; - TAxis* fpt = nullptr; - if (PDGCode == kXiMinus) { - nMassBins = cfgmassbins[2]; - nptbins = nXiPtBins; - fpt = fXiPtAxis; - fMass = fXiMass; - } else if (PDGCode == kOmegaMinus) { - nMassBins = cfgmassbins[3]; - nptbins = nOmegaPtBins; - fpt = fOmegaPtAxis; - fMass = fOmegaMass; - } else if (PDGCode == kK0Short) { - nMassBins = cfgmassbins[0]; - nptbins = nK0sPtBins; - fpt = fK0sPtAxis; - fMass = fK0sMass; - } else if (PDGCode == kLambda0) { - nMassBins = cfgmassbins[1]; - nptbins = nLambdaPtBins; - fpt = fLambdaPtAxis; - fMass = fLambdaMass; - } else { - LOGF(error, "Error, please put in correct PDGCode of K0s, Lambda, Xi or Omega"); - return; - } - for (int massbin = 1; massbin <= nMassBins; massbin++) { - float dnx = 0; - float val = 0; - float dnxol = 0; - dnx = fGFW->Calculate(corrconf, (ptbin - 1) + ((massbin - 1) * nptbins), kTRUE).real(); - dnxol = fGFW->Calculate(corrconfol, (ptbin - 1) + ((massbin - 1) * nptbins), kTRUE).real(); - dnx = dnx - dnxol; - if (dnx == 0) - continue; - val = (fGFW->Calculate(corrconf, (ptbin - 1) + ((massbin - 1) * nptbins), kFALSE).real() - fGFW->Calculate(corrconfol, (ptbin - 1) + ((massbin - 1) * nptbins), kFALSE).real()) / dnx; - if (std::fabs(val) < 1) { - TProfile3D->Fill(fpt->GetBinCenter(ptbin), fMass->GetBinCenter(massbin), cent, val, dnx); - } - } - return; - } - void loadCorrections(uint64_t timestamp) { if (correctionsLoaded) @@ -1134,6 +1049,10 @@ struct FlowGfwOmegaXi { continue; if (std::fabs(v0.dcanegtopv()) < v0BuilderOpts.cfgv0_dcadautopv.value) continue; + if (isK0s && std::fabs(v0.mLambda() - o2::constants::physics::MassLambda0) < v0BuilderOpts.cfgv0_compmassrejLambda.value) + isK0s = false; + if (isLambda && std::fabs(v0.mK0Short() - o2::constants::physics::MassK0Short) < v0BuilderOpts.cfgv0_compmassrejK0s.value) + isLambda = false; // fill QA after cut if (cfgOutputQA) { @@ -1156,6 +1075,8 @@ struct FlowGfwOmegaXi { } registry.fill(HIST("InvMassK0s"), v0.pt(), v0.mK0Short(), v0.eta(), cent); registry.fill(HIST("hEtaPhiVtxzPOIK0s"), v0.phi(), v0.eta(), vtxz, wacc); + registry.fill(HIST("hPhiK0s"), v0.phi()); + registry.fill(HIST("hPhiK0scorr"), v0.phi(), wacc); fGFW->Fill(v0.eta(), fK0sPtAxis->FindBin(v0.pt()) - 1 + ((fK0sMass->FindBin(v0.mK0Short()) - 1) * nK0sPtBins), v0.phi(), wacc * weff * wloc, 8); if (cfgOutputNUAWeights) fWeightsK0s->fill(v0.phi(), v0.eta(), vtxz, v0.pt(), cent, 0); @@ -1173,6 +1094,8 @@ struct FlowGfwOmegaXi { } registry.fill(HIST("InvMassLambda"), v0.pt(), v0.mLambda(), v0.eta(), cent); registry.fill(HIST("hEtaPhiVtxzPOILambda"), v0.phi(), v0.eta(), vtxz, wacc); + registry.fill(HIST("hPhiLambda"), v0.phi()); + registry.fill(HIST("hPhiLambdacorr"), v0.phi(), wacc); fGFW->Fill(v0.eta(), fK0sPtAxis->FindBin(v0.pt()) - 1 + ((fLambdaMass->FindBin(v0.mLambda()) - 1) * nK0sPtBins), v0.phi(), wacc * weff * wloc, 16); if (cfgOutputNUAWeights) fWeightsLambda->fill(v0.phi(), v0.eta(), vtxz, v0.pt(), cent, 0); @@ -1231,12 +1154,22 @@ struct FlowGfwOmegaXi { } // fill QA if (cfgOutputQA) { - registry.fill(HIST("QAhisto/Casc/hqaCasccosPAbefore"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("QAhisto/Casc/hqaCascV0cosPAbefore"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("QAhisto/Casc/hqadcaCascV0toPVbefore"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("QAhisto/Casc/hqadcaCascBachtoPVbefore"), casc.dcabachtopv()); - registry.fill(HIST("QAhisto/Casc/hqadcaCascdaubefore"), casc.dcacascdaughters()); - registry.fill(HIST("QAhisto/Casc/hqadcaCascV0daubefore"), casc.dcaV0daughters()); + if (isXi) { + registry.fill(HIST("QAhisto/Xi/hqaCasccosPAbefore"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Xi/hqaCascV0cosPAbefore"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Xi/hqadcaCascV0toPVbefore"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Xi/hqadcaCascBachtoPVbefore"), casc.dcabachtopv()); + registry.fill(HIST("QAhisto/Xi/hqadcaCascdaubefore"), casc.dcacascdaughters()); + registry.fill(HIST("QAhisto/Xi/hqadcaCascV0daubefore"), casc.dcaV0daughters()); + } + if (isOmega) { + registry.fill(HIST("QAhisto/Omega/hqaCasccosPAbefore"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Omega/hqaCascV0cosPAbefore"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Omega/hqadcaCascV0toPVbefore"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Omega/hqadcaCascBachtoPVbefore"), casc.dcabachtopv()); + registry.fill(HIST("QAhisto/Omega/hqadcaCascdaubefore"), casc.dcacascdaughters()); + registry.fill(HIST("QAhisto/Omega/hqadcaCascV0daubefore"), casc.dcaV0daughters()); + } } if (!isXi && !isOmega) @@ -1293,26 +1226,27 @@ struct FlowGfwOmegaXi { } // fill QA if (cfgOutputQA) { - registry.fill(HIST("QAhisto/Casc/hqaCasccosPAafter"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("QAhisto/Casc/hqaCascV0cosPAafter"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("QAhisto/Casc/hqadcaCascV0toPVafter"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("QAhisto/Casc/hqadcaCascBachtoPVafter"), casc.dcabachtopv()); - registry.fill(HIST("QAhisto/Casc/hqadcaCascdauafter"), casc.dcacascdaughters()); - registry.fill(HIST("QAhisto/Casc/hqadcaCascV0dauafter"), casc.dcaV0daughters()); + if (isXi) { + registry.fill(HIST("QAhisto/Xi/hqaCasccosPAafter"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Xi/hqaCascV0cosPAafter"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Xi/hqadcaCascV0toPVafter"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Xi/hqadcaCascBachtoPVafter"), casc.dcabachtopv()); + registry.fill(HIST("QAhisto/Xi/hqadcaCascdauafter"), casc.dcacascdaughters()); + registry.fill(HIST("QAhisto/Xi/hqadcaCascV0dauafter"), casc.dcaV0daughters()); + } + if (isOmega) { + registry.fill(HIST("QAhisto/Omega/hqaCasccosPAafter"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Omega/hqaCascV0cosPAafter"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Omega/hqadcaCascV0toPVafter"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Omega/hqadcaCascBachtoPVafter"), casc.dcabachtopv()); + registry.fill(HIST("QAhisto/Omega/hqadcaCascdauafter"), casc.dcacascdaughters()); + registry.fill(HIST("QAhisto/Omega/hqadcaCascV0dauafter"), casc.dcaV0daughters()); + } } - float weffBac = 1; - float weffPos = 1; - float weffNeg = 1; - float waccBac = 1; - float waccPos = 1; - float waccNeg = 1; if (isOmega) { if (cfgDoAccEffCorr) { setCurrentParticleWeights(weff, wacc, casc, vtxz, 4); - setCurrentParticleWeights(weffBac, waccBac, bachelor, vtxz, 0); - setCurrentParticleWeights(weffPos, waccPos, posdau, vtxz, 0); - setCurrentParticleWeights(weffNeg, waccNeg, negdau, vtxz, 0); } if (cfgDoLocDenCorr) { int phibin = -999; @@ -1323,11 +1257,10 @@ struct FlowGfwOmegaXi { registry.fill(HIST("MC/densityMCRecOmega"), casc.pt(), nch, density, casc.mOmega()); } registry.fill(HIST("hEtaPhiVtxzPOIOmega"), casc.phi(), casc.eta(), vtxz, wacc); + registry.fill(HIST("hPhiOmega"), casc.phi()); + registry.fill(HIST("hPhiOmegacorr"), casc.phi(), wacc); registry.fill(HIST("InvMassOmega"), casc.pt(), casc.mOmega(), casc.eta(), cent); fGFW->Fill(casc.eta(), fOmegaPtAxis->FindBin(casc.pt()) - 1 + ((fOmegaMass->FindBin(casc.mOmega()) - 1) * nOmegaPtBins), casc.phi(), wacc * weff * wloc, 4); - fGFW->Fill(bachelor.eta(), 1, bachelor.phi(), waccBac * weffBac * wloc, 4096); - fGFW->Fill(posdau.eta(), 1, posdau.phi(), waccPos * weffPos * wloc, 4096); - fGFW->Fill(negdau.eta(), 1, negdau.phi(), waccNeg * weffNeg * wloc, 4096); if (cfgOutputNUAWeights) fWeightsOmega->fill(casc.phi(), casc.eta(), vtxz, casc.pt(), cent, 0); @@ -1335,9 +1268,6 @@ struct FlowGfwOmegaXi { if (isXi) { if (cfgDoAccEffCorr) { setCurrentParticleWeights(weff, wacc, casc, vtxz, 3); - setCurrentParticleWeights(weffBac, waccBac, bachelor, vtxz, 0); - setCurrentParticleWeights(weffPos, waccPos, posdau, vtxz, 0); - setCurrentParticleWeights(weffNeg, waccNeg, negdau, vtxz, 0); } if (cfgDoLocDenCorr) { int phibin = -999; @@ -1348,11 +1278,10 @@ struct FlowGfwOmegaXi { registry.fill(HIST("MC/densityMCRecXi"), casc.pt(), nch, density, casc.mXi()); } registry.fill(HIST("hEtaPhiVtxzPOIXi"), casc.phi(), casc.eta(), vtxz, wacc); + registry.fill(HIST("hPhiXi"), casc.phi()); + registry.fill(HIST("hPhiXicorr"), casc.phi(), wacc); registry.fill(HIST("InvMassXi"), casc.pt(), casc.mXi(), casc.eta(), cent); fGFW->Fill(casc.eta(), fXiPtAxis->FindBin(casc.pt()) - 1 + ((fXiMass->FindBin(casc.mXi()) - 1) * nXiPtBins), casc.phi(), wacc * weff * wloc, 2); - fGFW->Fill(bachelor.eta(), 1, bachelor.phi(), waccBac * weffBac * wloc, 2048); - fGFW->Fill(posdau.eta(), 1, posdau.phi(), waccPos * weffPos * wloc, 2048); - fGFW->Fill(negdau.eta(), 1, negdau.phi(), waccNeg * weffNeg * wloc, 2048); if (cfgOutputNUAWeights) fWeightsXi->fill(casc.phi(), casc.eta(), vtxz, casc.pt(), cent, 0); @@ -1394,8 +1323,8 @@ struct FlowGfwOmegaXi { for (int i = 1; i <= nXiPtBins; i++) { fillProfilepTMass(corrconfigs.at(4), HIST("Xic22dpt"), i, kXiMinus, cent); fillProfilepTMass(corrconfigs.at(5), HIST("Xic22dpt"), i, kXiMinus, cent); - fillProfilepTMass(corrconfigs.at(6), corrconfigs.at(44), HIST("Xic24dpt"), i, kXiMinus, cent); - fillProfilepTMass(corrconfigs.at(7), corrconfigs.at(43), HIST("Xic22Fulldpt"), i, kXiMinus, cent); + fillProfilepTMass(corrconfigs.at(6), HIST("Xic24dpt"), i, kXiMinus, cent); + fillProfilepTMass(corrconfigs.at(7), HIST("Xic22Fulldpt"), i, kXiMinus, cent); fillProfilepTMass(corrconfigs.at(23), HIST("Xic32dpt"), i, kXiMinus, cent); fillProfilepTMass(corrconfigs.at(24), HIST("Xic32dpt"), i, kXiMinus, cent); @@ -1405,13 +1334,13 @@ struct FlowGfwOmegaXi { for (int i = 1; i <= nOmegaPtBins; i++) { fillProfilepTMass(corrconfigs.at(8), HIST("Omegac22dpt"), i, kOmegaMinus, cent); fillProfilepTMass(corrconfigs.at(9), HIST("Omegac22dpt"), i, kOmegaMinus, cent); - fillProfilepTMass(corrconfigs.at(10), corrconfigs.at(48), HIST("Omegac24dpt"), i, kOmegaMinus, cent); - fillProfilepTMass(corrconfigs.at(11), corrconfigs.at(47), HIST("Omegac22Fulldpt"), i, kOmegaMinus, cent); + fillProfilepTMass(corrconfigs.at(10), HIST("Omegac24dpt"), i, kOmegaMinus, cent); + fillProfilepTMass(corrconfigs.at(11), HIST("Omegac22Fulldpt"), i, kOmegaMinus, cent); fillProfilepTMass(corrconfigs.at(25), HIST("Omegac32dpt"), i, kOmegaMinus, cent); fillProfilepTMass(corrconfigs.at(26), HIST("Omegac32dpt"), i, kOmegaMinus, cent); - fillProfilepTMass(corrconfigs.at(45), HIST("Omegac24_gapdpt"), i, kOmegaMinus, cent); - fillProfilepTMass(corrconfigs.at(46), HIST("Omegac24_gapdpt"), i, kOmegaMinus, cent); + fillProfilepTMass(corrconfigs.at(43), HIST("Omegac24_gapdpt"), i, kOmegaMinus, cent); + fillProfilepTMass(corrconfigs.at(44), HIST("Omegac24_gapdpt"), i, kOmegaMinus, cent); } } // Fill subevents flow @@ -1448,16 +1377,16 @@ struct FlowGfwOmegaXi { for (int i = 1; i <= nXiPtBins; i++) { fillProfilepTMass(corrconfigs.at(4), xic22[j - 1], i, kXiMinus, cent); fillProfilepTMass(corrconfigs.at(5), xic22[j - 1], i, kXiMinus, cent); - fillProfilepTMass(corrconfigs.at(6), corrconfigs.at(44), xic24[j - 1], i, kXiMinus, cent); - fillProfilepTMass(corrconfigs.at(7), corrconfigs.at(43), xic22Full[j - 1], i, kXiMinus, cent); + fillProfilepTMass(corrconfigs.at(6), xic24[j - 1], i, kXiMinus, cent); + fillProfilepTMass(corrconfigs.at(7), xic22Full[j - 1], i, kXiMinus, cent); fillProfilepTMass(corrconfigs.at(23), xic32[j - 1], i, kXiMinus, cent); fillProfilepTMass(corrconfigs.at(24), xic32[j - 1], i, kXiMinus, cent); } for (int i = 1; i <= nOmegaPtBins; i++) { fillProfilepTMass(corrconfigs.at(8), omegac22[j - 1], i, kOmegaMinus, cent); fillProfilepTMass(corrconfigs.at(9), omegac22[j - 1], i, kOmegaMinus, cent); - fillProfilepTMass(corrconfigs.at(10), corrconfigs.at(48), omegac24[j - 1], i, kOmegaMinus, cent); - fillProfilepTMass(corrconfigs.at(11), corrconfigs.at(47), omegac22Full[j - 1], i, kOmegaMinus, cent); + fillProfilepTMass(corrconfigs.at(10), omegac24[j - 1], i, kOmegaMinus, cent); + fillProfilepTMass(corrconfigs.at(11), omegac22Full[j - 1], i, kOmegaMinus, cent); fillProfilepTMass(corrconfigs.at(25), omegac32[j - 1], i, kOmegaMinus, cent); fillProfilepTMass(corrconfigs.at(26), omegac32[j - 1], i, kOmegaMinus, cent); } @@ -1640,6 +1569,7 @@ struct FlowGfwOmegaXi { auto negdau = casc.negTrack_as(); auto posdau = casc.posTrack_as(); auto bachelor = casc.bachelor_as(); + int pdgCode{cascMC.pdgCode()}; if (bachelor.pt() < trkQualityOpts.cfgCutPtDauMin.value || bachelor.pt() > trkQualityOpts.cfgCutPtDauMax.value) continue; if (posdau.pt() < trkQualityOpts.cfgCutPtDauMin.value || posdau.pt() > trkQualityOpts.cfgCutPtDauMax.value) @@ -1648,12 +1578,22 @@ struct FlowGfwOmegaXi { continue; // fill QA if (cfgOutputQA) { - registry.fill(HIST("QAhisto/Casc/hqaCasccosPAbefore"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("QAhisto/Casc/hqaCascV0cosPAbefore"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("QAhisto/Casc/hqadcaCascV0toPVbefore"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("QAhisto/Casc/hqadcaCascBachtoPVbefore"), casc.dcabachtopv()); - registry.fill(HIST("QAhisto/Casc/hqadcaCascdaubefore"), casc.dcacascdaughters()); - registry.fill(HIST("QAhisto/Casc/hqadcaCascV0daubefore"), casc.dcaV0daughters()); + if (std::abs(pdgCode) == kXiMinus) { + registry.fill(HIST("QAhisto/Xi/hqaCasccosPAbefore"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Xi/hqaCascV0cosPAbefore"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Xi/hqadcaCascV0toPVbefore"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Xi/hqadcaCascBachtoPVbefore"), casc.dcabachtopv()); + registry.fill(HIST("QAhisto/Xi/hqadcaCascdaubefore"), casc.dcacascdaughters()); + registry.fill(HIST("QAhisto/Xi/hqadcaCascV0daubefore"), casc.dcaV0daughters()); + } + if (std::abs(pdgCode) == kOmegaMinus) { + registry.fill(HIST("QAhisto/Omega/hqaCasccosPAbefore"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Omega/hqaCascV0cosPAbefore"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Omega/hqadcaCascV0toPVbefore"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Omega/hqadcaCascBachtoPVbefore"), casc.dcabachtopv()); + registry.fill(HIST("QAhisto/Omega/hqadcaCascdaubefore"), casc.dcacascdaughters()); + registry.fill(HIST("QAhisto/Omega/hqadcaCascV0daubefore"), casc.dcaV0daughters()); + } } // track quality check if (!bachelor.passedITSNCls() && trkQualityOpts.cfgCheckITSNCls.value) @@ -1699,17 +1639,7 @@ struct FlowGfwOmegaXi { continue; if (std::fabs(casc.mLambda() - o2::constants::physics::MassLambda0) > cascBuilderOpts.cfgcasc_mlambdawindow.value) continue; - // fill QA - if (cfgOutputQA) { - registry.fill(HIST("QAhisto/Casc/hqaCasccosPAafter"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("QAhisto/Casc/hqaCascV0cosPAafter"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("QAhisto/Casc/hqadcaCascV0toPVafter"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("QAhisto/Casc/hqadcaCascBachtoPVafter"), casc.dcabachtopv()); - registry.fill(HIST("QAhisto/Casc/hqadcaCascdauafter"), casc.dcacascdaughters()); - registry.fill(HIST("QAhisto/Casc/hqadcaCascV0dauafter"), casc.dcaV0daughters()); - } // Omega and antiOmega - int pdgCode{cascMC.pdgCode()}; double cascPt{cascMC.pt()}; double cascPhi{cascMC.phi()}; double cascEta{cascMC.eta()}; @@ -1726,6 +1656,15 @@ struct FlowGfwOmegaXi { if (cfgOutputLocDenWeights) registry.fill(HIST("MC/densityMCRecOmega"), cascPt, nch, density, casc.mOmega()); } + // fill QA + if (cfgOutputQA) { + registry.fill(HIST("QAhisto/Omega/hqaCasccosPAafter"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Omega/hqaCascV0cosPAafter"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Omega/hqadcaCascV0toPVafter"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Omega/hqadcaCascBachtoPVafter"), casc.dcabachtopv()); + registry.fill(HIST("QAhisto/Omega/hqadcaCascdauafter"), casc.dcacascdaughters()); + registry.fill(HIST("QAhisto/Omega/hqadcaCascV0dauafter"), casc.dcaV0daughters()); + } fGFW->Fill(cascEta, fOmegaPtAxis->FindBin(cascPt) - 1, cascPhi, wacc * weff * wloc, 4); } else if (casc.sign() > 0 && std::fabs(casc.yOmega()) < cfgCasc_rapidity && (std::fabs(bachelor.tpcNSigmaKa()) < cfgNSigma[2] && std::fabs(negdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(posdau.tpcNSigmaPi()) < cfgNSigma[0])) { @@ -1739,6 +1678,15 @@ struct FlowGfwOmegaXi { if (cfgOutputLocDenWeights) registry.fill(HIST("MC/densityMCRecOmega"), cascPt, nch, density, casc.mOmega()); } + // fill QA + if (cfgOutputQA) { + registry.fill(HIST("QAhisto/Omega/hqaCasccosPAafter"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Omega/hqaCascV0cosPAafter"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Omega/hqadcaCascV0toPVafter"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Omega/hqadcaCascBachtoPVafter"), casc.dcabachtopv()); + registry.fill(HIST("QAhisto/Omega/hqadcaCascdauafter"), casc.dcacascdaughters()); + registry.fill(HIST("QAhisto/Omega/hqadcaCascV0dauafter"), casc.dcaV0daughters()); + } fGFW->Fill(cascEta, fOmegaPtAxis->FindBin(cascPt) - 1, cascPhi, wacc * weff * wloc, 4); } } @@ -1756,6 +1704,15 @@ struct FlowGfwOmegaXi { if (cfgOutputLocDenWeights) registry.fill(HIST("MC/densityMCRecXi"), cascPt, nch, density, casc.mXi()); } + // fill QA + if (cfgOutputQA) { + registry.fill(HIST("QAhisto/Xi/hqaCasccosPAafter"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Xi/hqaCascV0cosPAafter"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Xi/hqadcaCascV0toPVafter"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Xi/hqadcaCascBachtoPVafter"), casc.dcabachtopv()); + registry.fill(HIST("QAhisto/Xi/hqadcaCascdauafter"), casc.dcacascdaughters()); + registry.fill(HIST("QAhisto/Xi/hqadcaCascV0dauafter"), casc.dcaV0daughters()); + } fGFW->Fill(cascEta, fXiPtAxis->FindBin(cascPt) - 1, cascPhi, wacc * weff * wloc, 2); } else if (casc.sign() > 0 && std::fabs(casc.yXi()) < cfgCasc_rapidity && (std::fabs(bachelor.tpcNSigmaPi()) < cfgNSigma[0] && std::fabs(negdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(posdau.tpcNSigmaPi()) < cfgNSigma[0])) { @@ -1769,6 +1726,14 @@ struct FlowGfwOmegaXi { if (cfgOutputLocDenWeights) registry.fill(HIST("MC/densityMCRecXi"), cascPt, nch, density, casc.mXi()); } + if (cfgOutputQA) { + registry.fill(HIST("QAhisto/Xi/hqaCasccosPAafter"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Xi/hqaCascV0cosPAafter"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Xi/hqadcaCascV0toPVafter"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Xi/hqadcaCascBachtoPVafter"), casc.dcabachtopv()); + registry.fill(HIST("QAhisto/Xi/hqadcaCascdauafter"), casc.dcacascdaughters()); + registry.fill(HIST("QAhisto/Xi/hqadcaCascV0dauafter"), casc.dcaV0daughters()); + } fGFW->Fill(cascEta, fXiPtAxis->FindBin(cascPt) - 1, cascPhi, wacc * weff * wloc, 2); } } From 5cc7517d0b39d7a5eb15eb797608919319b2176c Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Tue, 2 Sep 2025 23:30:35 +0200 Subject: [PATCH 282/986] [PWGEM/Dilepton] fix in DimuonCut.h (#12832) --- PWGEM/Dilepton/Core/DimuonCut.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGEM/Dilepton/Core/DimuonCut.h b/PWGEM/Dilepton/Core/DimuonCut.h index 1c2ce81010b..3582f5f519a 100644 --- a/PWGEM/Dilepton/Core/DimuonCut.h +++ b/PWGEM/Dilepton/Core/DimuonCut.h @@ -194,7 +194,7 @@ class DimuonCut : public TNamed return track.nClusters() >= mMinNClustersMCHMID; case DimuonCuts::kChi2: - return (track.trackType() == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) ? track.chi2() / (2.f * (track.nClusters() + track.nClustersMFT()) - 5.f) : track.chi2()) < mMaxChi2; + return track.trackType() == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) ? track.chi2() / (2.f * (track.nClusters() + track.nClustersMFT()) - 5.f) < mMaxChi2 : track.chi2() < mMaxChi2; case DimuonCuts::kMatchingChi2MCHMFT: return track.chi2MatchMCHMFT() < mMaxMatchingChi2MCHMFT; From 43f92e9727ee6d30d040f46e65f2e0aa330395cb Mon Sep 17 00:00:00 2001 From: SuJeong Ji <120470463+SuJeong-Ji@users.noreply.github.com> Date: Wed, 3 Sep 2025 16:06:36 +0900 Subject: [PATCH 283/986] [PWGLF] Added rapidity cut for K0s daughters (#12834) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Resonances/chk892Flow.cxx | 342 +++++++++++--------------- 1 file changed, 141 insertions(+), 201 deletions(-) diff --git a/PWGLF/Tasks/Resonances/chk892Flow.cxx b/PWGLF/Tasks/Resonances/chk892Flow.cxx index 2c616d81406..8b91c63188a 100644 --- a/PWGLF/Tasks/Resonances/chk892Flow.cxx +++ b/PWGLF/Tasks/Resonances/chk892Flow.cxx @@ -14,64 +14,61 @@ /// \author Su-Jeong Ji , Bong-Hwi Lim /// -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "TRandom3.h" -#include "TF1.h" -#include "TVector2.h" -#include "Math/Vector3D.h" -#include "Math/Vector4D.h" -#include "Math/GenVector/Boost.h" -#include - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/StepTHn.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/StaticFor.h" -#include "DCAFitter/DCAFitterN.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/Utils/collisionCuts.h" -#include "Common/DataModel/PIDResponse.h" -#include "Common/DataModel/Multiplicity.h" +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/trackUtilities.h" #include "Common/DataModel/Centrality.h" -#include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/Qvectors.h" +#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/Core/trackUtilities.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/RecoDecay.h" - -#include "CommonConstants/PhysicsConstants.h" +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CcdbApi.h" #include "CommonConstants/MathConstants.h" - -#include "ReconstructionDataFormats/Track.h" - -#include "DataFormatsParameters/GRPObject.h" +#include "CommonConstants/PhysicsConstants.h" +#include "DCAFitter/DCAFitterN.h" #include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/EndOfStreamContext.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/StaticFor.h" +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" -#include "CCDB/CcdbApi.h" -#include "CCDB/BasicCCDBManager.h" +#include "Math/GenVector/Boost.h" +#include "Math/RotationZ.h" +#include "Math/Vector3D.h" +#include "Math/Vector4D.h" +#include "TF1.h" +#include "TRandom3.h" +#include "TVector2.h" +#include +#include +#include +#include +#include +#include +#include +#include -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/Utils/collisionCuts.h" +#include +#include +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -91,21 +88,55 @@ struct Chk892Flow { kTYEnd }; + enum class K0sCut { + DauDCA, // lDauDCA <= cfgSecondaryDauDCAMax + PosDCAtoPVMin, // lDauPosDCAtoPV >= min + NegDCAtoPVMin, // lDauNegDCAtoPV >= min + RadiusWindow, // cfgSecondaryRadiusMin <= lRadius <= cfgSecondaryRadiusMax + DCAtoPVMax, // lDCAtoPV <= max + CPAMin, // lCPA >= min + ProperTauMax, // lPropTauK0s <= max + Armenteros, // qtarm >= param * |alpha| + MassWindow, // |mK0s - m0| <= window + LambdaMassHypo // NOT(lambda-window) + }; + + std::array, 10> hN1NoCut{}; + std::array, 10> hN1Pass{}; + + static constexpr const char* cutTag[] = { + "DauDCA", "PosDCA", "NegDCA", "Radius", "DCAtoPV", "CPA", "Tau", "Arm", "Mass", "LambdaHypo"}; + static constexpr K0sCut kCutsToTest[] = { + K0sCut::DauDCA, K0sCut::PosDCAtoPVMin, K0sCut::NegDCAtoPVMin, + K0sCut::RadiusWindow, K0sCut::DCAtoPVMax, K0sCut::CPAMin, + K0sCut::ProperTauMax, K0sCut::Armenteros, K0sCut::MassWindow, K0sCut::LambdaMassHypo}; + + static constexpr size_t NCuts = sizeof(kCutsToTest) / sizeof(kCutsToTest[0]); + SliceCache cache; Preslice perCollision = aod::track::collisionId; using EventCandidates = soa::Join; - using TrackCandidates = soa::Join; + // using TrackCandidates = soa::Join; + using TrackCandidates = soa::Join; using V0Candidates = aod::V0Datas; + // for MC reco using MCEventCandidates = soa::Join; - using MCTrackCandidates = soa::Join; + using MCTrackCandidates = soa::Join; //, aod::McParticles>; using MCV0Candidates = soa::Join; + // for MC truth + using MCTrueEventCandidates = aod::McCollisions; + using MCTrueTrackCandidates = aod::McParticles; + + using LorentzVectorSetXYZM = ROOT::Math::LorentzVector>; + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; Service ccdb; o2::ccdb::CcdbApi ccdbApi; + Service pdg; struct : ConfigurableGroup { Configurable cfgURL{"cfgURL", "http://alice-ccdb.cern.ch", "Address of the CCDB to browse"}; @@ -118,6 +149,7 @@ struct Chk892Flow { ConfigurableAxis cfgBinsPtQA{"cfgBinsPtQA", {VARIABLE_WIDTH, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8, 5.0, 5.2, 5.4, 5.6, 5.8, 6.0, 6.2, 6.4, 6.6, 6.8, 7.0, 7.2, 7.4, 7.6, 7.8, 8.0, 8.2, 8.4, 8.6, 8.8, 9.0, 9.2, 9.4, 9.6, 9.8, 10.0}, "Binning of the pT axis"}; ConfigurableAxis cfgBinsCent{"cfgBinsCent", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"}; ConfigurableAxis cfgBinsVtxZ{"cfgBinsVtxZ", {VARIABLE_WIDTH, -10.0, -9.0, -8.0, -7.0, -6.0, -5.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, "Binning of the z-vertex axis"}; + ConfigurableAxis binsImpactPar{"binsImpactPar", {VARIABLE_WIDTH, 0.0, 3.00065, 4.28798, 6.14552, 7.6196, 8.90942, 10.0897, 11.2002, 12.2709, 13.3167, 14.4173, 23.2518}, "Binning of the impact parameter axis"}; ConfigurableAxis cfgBinsOccu{"cfgBinsOccu", {VARIABLE_WIDTH, 0, 500, 1000, 2500, 9999}, "Binning of the occupancy axis"}; Configurable cNbinsDiv{"cNbinsDiv", 1, "Integer to divide the number of bins"}; Configurable cNbinsDivQA{"cNbinsDivQA", 1, "Integer to divide the number of bins for QA"}; @@ -137,6 +169,8 @@ struct Chk892Flow { o2::analysis::CollisonCuts colCuts; struct : ConfigurableGroup { Configurable cfgEvtZvtx{"cfgEvtZvtx", 10.f, "Evt sel: Max. z-Vertex (cm)"}; + Configurable cfgEvtZvtxMC{"cfgEvtZvtxMC", 10.f, "MC Evt sel: Max z-vertex (cm)"}; + Configurable cfgIsPhysicalPrimaryMC{"cfgIsPhysicalPrimaryMC", true, "Physical primary selection for MC parents"}; // Configurable cfgEvtOccupancyInTimeRangeMax{"cfgEvtOccupancyInTimeRangeMax", -1, "Evt sel: maximum track occupancy"}; // Configurable cfgEvtOccupancyInTimeRangeMin{"cfgEvtOccupancyInTimeRangeMin", -1, "Evt sel: minimum track occupancy"}; Configurable cfgEvtTriggerCheck{"cfgEvtTriggerCheck", false, "Evt sel: check for trigger"}; @@ -195,15 +229,17 @@ struct Chk892Flow { Configurable cfgReturnFlag{"cfgReturnFlag", false, "Return Flag for debugging"}; Configurable cfgSecondaryRequire{"cfgSecondaryRequire", true, "Secondary cuts on/off"}; Configurable cfgSecondaryArmenterosCut{"cfgSecondaryArmenterosCut", true, "cut on Armenteros-Podolanski graph"}; - Configurable cfgSecondaryCrossMassHypothesisCut{"cfgSecondaryCrossMassHypothesisCut", false, "Apply cut based on the lambda mass hypothesis"}; + Configurable cfgSecondaryCrossMassHypothesisCut{"cfgSecondaryCrossMassHypothesisCut", true, "Apply cut based on the lambda mass hypothesis"}; Configurable cfgByPassDauPIDSelection{"cfgByPassDauPIDSelection", true, "Bypass Daughters PID selection"}; + Configurable cfgByPassDauRapiditySelection{"cfgByPassDauRapiditySelection", false, "Bypass Daughters Rapidity selection"}; Configurable cfgSecondaryDauDCAMax{"cfgSecondaryDauDCAMax", 0.2, "Maximum DCA Secondary daughters to PV"}; Configurable cfgSecondaryDauPosDCAtoPVMin{"cfgSecondaryDauPosDCAtoPVMin", 0.1, "Minimum DCA Secondary positive daughters to PV"}; Configurable cfgSecondaryDauNegDCAtoPVMin{"cfgSecondaryDauNegDCAtoPVMin", 0.1, "Minimum DCA Secondary negative daughters to PV"}; Configurable cfgSecondaryPtMin{"cfgSecondaryPtMin", 0.f, "Minimum transverse momentum of Secondary"}; Configurable cfgSecondaryRapidityMax{"cfgSecondaryRapidityMax", 0.8, "Maximum rapidity of Secondary"}; + Configurable cfgSecondaryDauRapidityMax{"cfgSecondaryDauRapidityMax", 0.3, "Maximum rapidity of Secondary daughters"}; Configurable cfgSecondaryRadiusMin{"cfgSecondaryRadiusMin", 0.0, "Minimum transverse radius of Secondary"}; Configurable cfgSecondaryRadiusMax{"cfgSecondaryRadiusMax", 999.9, "Maximum transverse radius of Secondary"}; Configurable cfgSecondaryCosPAMin{"cfgSecondaryCosPAMin", 0.995, "Mininum cosine pointing angle of Secondary"}; @@ -394,54 +430,8 @@ struct Chk892Flow { histos.add("QA/after/kstarv2vsinvmass", "Invariant mass vs v2 of unlike-sign chK(892)", HistType::kTH2D, {invMassAxisReso, v2Axis}); histos.add("QA/after/kstarinvmass_Mix", "Invariant mass of unlike-sign chK(892) from mixed event", HistType::kTH1D, {invMassAxisReso}); - // MC - if (doprocessMC) { - // Bachelor pion - histos.add("QAMC/trkbpionDCAxy", "DCAxy distribution of bachelor pion candidates", HistType::kTH1D, {dcaxyAxis}); - histos.add("QAMC/trkbpionDCAz", "DCAz distribution of bachelor pion candidates", HistType::kTH1D, {dcazAxis}); - histos.add("QAMC/trkbpionpT", "pT distribution of bachelor pion candidates", HistType::kTH1D, {ptAxis}); - histos.add("QAMC/trkbpionTPCPID", "TPC PID of bachelor pion candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); - histos.add("QAMC/trkbpionTOFPID", "TOF PID of bachelor pion candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); - histos.add("QAMC/trkbpionTPCTOFPID", "TPC-TOF PID map of bachelor pion candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); - - // Secondary pion 1 - histos.add("QAMC/trkppionDCAxy", "DCAxy distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {dcaxyAxis}); - histos.add("QAMC/trkppionDCAz", "DCAz distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {dcazAxis}); - histos.add("QAMC/trkppionpT", "pT distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {ptAxis}); - histos.add("QAMC/trkppionTPCPID", "TPC PID of secondary pion 1 (positive) candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); - histos.add("QAMC/trkppionTOFPID", "TOF PID of secondary pion 1 (positive) candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); - histos.add("QAMC/trkppionTPCTOFPID", "TPC-TOF PID map of secondary pion 1 (positive) candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); - - // Secondary pion 2 - histos.add("QAMC/trknpionTPCPID", "TPC PID of secondary pion 2 (negative) candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); - histos.add("QAMC/trknpionTOFPID", "TOF PID of secondary pion 2 (negative) candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); - histos.add("QAMC/trknpionTPCTOFPID", "TPC-TOF PID map of secondary pion 2 (negative) candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); - histos.add("QAMC/trknpionpT", "pT distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {ptAxis}); - histos.add("QAMC/trknpionDCAxy", "DCAxy distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {dcaxyAxis}); - histos.add("QAMC/trknpionDCAz", "DCAz distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {dcazAxis}); - - // Secondary Resonance (K0s candidates) - histos.add("QAMC/hDauDCASecondary", "DCA of daughters of secondary resonance", HistType::kTH1D, {dcaAxis}); - histos.add("QAMC/hDauPosDCAtoPVSecondary", "Pos DCA to PV of daughters secondary resonance", HistType::kTH1D, {dcaAxis}); - histos.add("QAMC/hDauNegDCAtoPVSecondary", "Neg DCA to PV of daughters secondary resonance", HistType::kTH1D, {dcaAxis}); - - histos.add("QAMC/hy_Secondary", "Rapidity distribution of secondary resonance", HistType::kTH1D, {yAxis}); - histos.add("QAMC/hCPASecondary", "Cosine pointing angle distribution of secondary resonance", HistType::kTH1D, {cpaAxis}); - histos.add("QAMC/hDCAtoPVSecondary", "DCA to PV distribution of secondary resonance", HistType::kTH1D, {dcaAxis}); - histos.add("QAMC/hPropTauSecondary", "Proper Lifetime distribution of secondary resonance", HistType::kTH1D, {tauAxis}); - histos.add("QAMC/hInvmassSecondary", "Invariant mass of unlike-sign secondary resonance", HistType::kTH1D, {invMassAxisK0s}); - - // K892 - histos.add("QAMC/KstarOA", "Opening angle of chK(892)", HistType::kTH1D, {AxisSpec{100, 0, 3.14, "Opening angle"}}); - histos.add("QAMC/KstarPairAsym", "Pair asymmetry of chK(892)", HistType::kTH1D, {AxisSpec{100, -1, 1, "Pair asymmetry"}}); - histos.add("QAMC/KstarRapidity", "Rapidity distribution of chK(892)", HistType::kTH1D, {yAxis}); - - histos.add("QAMC/kstarinvmass", "Invariant mass of unlike-sign chK(892)", HistType::kTH1D, {invMassAxisReso}); - histos.add("QAMC/k0sv2vsinvmass", "Invariant mass vs v2 of unlike-sign K0s", HistType::kTH2D, {invMassAxisK0s, v2Axis}); - histos.add("QAMC/kstarv2vsinvmass", "Invariant mass vs v2 of unlike-sign chK(892)", HistType::kTH2D, {invMassAxisReso, v2Axis}); - histos.add("QAMC/kstarinvmass_noKstar", "Invariant mass of unlike-sign no chK(892)", HistType::kTH1D, {invMassAxisReso}); - histos.add("QAMC/kstarv2vsinvmass_noKstar", "Invariant mass vs v2 of unlike-sign no chK(892)", HistType::kTH2D, {invMassAxisReso, v2Axis}); - } + LOG(info) << "Size of the histograms in spectraTOF"; + histos.print(); } // Invariant mass nSparse @@ -450,12 +440,14 @@ struct Chk892Flow { histos.add("hInvmass_K0s", "Invariant mass of unlike-sign K0s", HistType::kTHnSparseD, {centAxis, ptAxis, invMassAxisK0s, v2Axis, phiAxis, occuAxis}); if (doprocessMC) { histos.add("hInvmass_Kstar_MC", "Invariant mass of unlike chK(892)", HistType::kTHnSparseD, {axisType, centAxis, ptAxis, invMassAxisReso, v2Axis, phiAxis, occuAxis}); + histos.add("hInvmass_K0s_MC", "Invariant mass of unlike K0s", HistType::kTHnSparseD, {centAxis, ptAxis, invMassAxisReso, v2Axis, phiAxis, occuAxis}); } } else { histos.add("hInvmass_Kstar", "Invariant mass of unlike-sign chK(892)", HistType::kTHnSparseD, {axisType, centAxis, ptAxis, invMassAxisReso, v2Axis, occuAxis}); histos.add("hInvmass_K0s", "Invariant mass of unlike-sign K0s", HistType::kTHnSparseD, {centAxis, ptAxis, invMassAxisK0s, v2Axis, occuAxis}); if (doprocessMC) { histos.add("hInvmass_Kstar_MC", "Invariant mass of unlike chK(892)", HistType::kTHnSparseD, {axisType, centAxis, ptAxis, invMassAxisReso, v2Axis, occuAxis}); + histos.add("hInvmass_K0s_MC", "Invariant mass of unlike K0s", HistType::kTHnSparseD, {centAxis, ptAxis, invMassAxisK0s, v2Axis, occuAxis}); } } @@ -469,66 +461,11 @@ struct Chk892Flow { lRefAId = 4; lRefBId = 5; } - if (EventPlaneConfig.cfgNQvec < 2) { + if (EventPlaneConfig.cfgNQvec < EventPlaneConfig.cfgnMods) { LOG(fatal) << "nMode must be larger than 1, current input (cfgNQvec): " << EventPlaneConfig.cfgNQvec; } LOGF(info, "lDetId: %d, lRefAId: %d, lRefBId: %d", lDetId, lRefAId, lRefBId); - // MC - if (doprocessMC) { - // Bachelor pion - histos.add("QAMC/trkbpionDCAxy", "DCAxy distribution of bachelor pion candidates", HistType::kTH1D, {dcaxyAxis}); - histos.add("QAMC/trkbpionDCAz", "DCAz distribution of bachelor pion candidates", HistType::kTH1D, {dcazAxis}); - histos.add("QAMC/trkbpionpT", "pT distribution of bachelor pion candidates", HistType::kTH1D, {ptAxis}); - histos.add("QAMC/trkbpionTPCPID", "TPC PID of bachelor pion candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); - histos.add("QAMC/trkbpionTOFPID", "TOF PID of bachelor pion candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); - histos.add("QAMC/trkbpionTPCTOFPID", "TPC-TOF PID map of bachelor pion candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); - - // Secondary pion 1 - histos.add("QAMC/trkppionDCAxy", "DCAxy distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {dcaxyAxis}); - histos.add("QAMC/trkppionDCAz", "DCAz distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {dcazAxis}); - histos.add("QAMC/trkppionpT", "pT distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {ptAxis}); - histos.add("QAMC/trkppionTPCPID", "TPC PID of secondary pion 1 (positive) candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); - histos.add("QAMC/trkppionTOFPID", "TOF PID of secondary pion 1 (positive) candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); - histos.add("QAMC/trkppionTPCTOFPID", "TPC-TOF PID map of secondary pion 1 (positive) candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); - - // Secondary pion 2 - histos.add("QAMC/trknpionTPCPID", "TPC PID of secondary pion 2 (negative) candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); - histos.add("QAMC/trknpionTOFPID", "TOF PID of secondary pion 2 (negative) candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); - histos.add("QAMC/trknpionTPCTOFPID", "TPC-TOF PID map of secondary pion 2 (negative) candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); - histos.add("QAMC/trknpionpT", "pT distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {ptAxis}); - histos.add("QAMC/trknpionDCAxy", "DCAxy distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {dcaxyAxis}); - histos.add("QAMC/trknpionDCAz", "DCAz distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {dcazAxis}); - - // Secondary Resonance (K0s candidates) - histos.add("QAMC/hDauDCASecondary", "DCA of daughters of secondary resonance", HistType::kTH1D, {dcaAxis}); - histos.add("QAMC/hDauPosDCAtoPVSecondary", "Pos DCA to PV of daughters secondary resonance", HistType::kTH1D, {dcaAxis}); - histos.add("QAMC/hDauNegDCAtoPVSecondary", "Neg DCA to PV of daughters secondary resonance", HistType::kTH1D, {dcaAxis}); - - histos.add("QAMC/hy_Secondary", "Rapidity distribution of secondary resonance", HistType::kTH1D, {yAxis}); - histos.add("QAMC/hCPASecondary", "Cosine pointing angle distribution of secondary resonance", HistType::kTH1D, {cpaAxis}); - histos.add("QAMC/hDCAtoPVSecondary", "DCA to PV distribution of secondary resonance", HistType::kTH1D, {dcaAxis}); - histos.add("QAMC/hPropTauSecondary", "Proper Lifetime distribution of secondary resonance", HistType::kTH1D, {tauAxis}); - histos.add("QAMC/hInvmassSecondary", "Invariant mass of unlike-sign secondary resonance", HistType::kTH1D, {invMassAxisK0s}); - - // K892 - histos.add("QAMC/KstarOA", "Opening angle of chK(892)", HistType::kTH1D, {AxisSpec{100, 0, 3.14, "Opening angle"}}); - histos.add("QAMC/KstarPairAsym", "Pair asymmetry of chK(892)", HistType::kTH1D, {AxisSpec{100, -1, 1, "Pair asymmetry"}}); - histos.add("QAMC/KstarRapidity", "Rapidity distribution of chK(892)", HistType::kTH1D, {yAxis}); - - histos.add("QAMC/kstarinvmass", "Invariant mass of unlike-sign chK(892)", HistType::kTH1D, {invMassAxisReso}); - histos.add("QAMC/k0sv2vsinvmass", "Invariant mass vs v2 of unlike-sign K0s", HistType::kTH2D, {invMassAxisK0s, v2Axis}); - histos.add("QAMC/kstarv2vsinvmass", "Invariant mass vs v2 of unlike-sign chK(892)", HistType::kTH2D, {invMassAxisReso, v2Axis}); - histos.add("QAMC/kstarinvmass_noKstar", "Invariant mass of unlike-sign no chK(892)", HistType::kTH1D, {invMassAxisReso}); - histos.add("QAMC/kstarv2vsinvmass_noKstar", "Invariant mass vs v2 of unlike-sign no chK(892)", HistType::kTH2D, {invMassAxisReso, v2Axis}); - - if (AnalysisConfig.cfgFillAdditionalAxis) { - histos.add("hInvmass_Kstar_MC", "Invariant mass of unlike chK(892)", HistType::kTHnSparseD, {axisType, centAxis, ptAxis, invMassAxisReso, v2Axis, phiAxis, occuAxis}); - } else { - histos.add("hInvmass_Kstar_MC", "Invariant mass of unlike chK(892)", HistType::kTHnSparseD, {axisType, centAxis, ptAxis, invMassAxisReso, v2Axis, occuAxis}); - } - } - ccdb->setURL(CCDBConfig.cfgURL); ccdbApi.init("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); @@ -538,24 +475,27 @@ struct Chk892Flow { // Print output histograms statistics LOG(info) << "Size of the histograms in chK(892) Analysis Task"; histos.print(); - } + } // init + + const int kCentFT0C = 1; + const int kCentFT0M = 2; + const float kInvalidCentrality = -999.f; template float getCentrality(CollisionType const& collision) { - if (AnalysisConfig.cfgCentEst == 1) { + if (AnalysisConfig.cfgCentEst == kCentFT0C) { return collision.centFT0C(); - } else if (AnalysisConfig.cfgCentEst == 2) { + } else if (AnalysisConfig.cfgCentEst == kCentFT0M) { return collision.centFT0M(); } else { - return -999; + return kInvalidCentrality; } } template int getlDetId(DetNameType const& name) { - LOGF(info, "GetlDetID running"); if (name.value == "FT0C") { return 0; } else if (name.value == "FT0A") { @@ -651,12 +591,12 @@ struct Chk892Flow { bool selectionK0s(CollisionType const& collision, K0sType const& candidate) { auto lDauDCA = candidate.dcaV0daughters(); - auto lDauPosDCAtoPV = std::abs(candidate.dcapostopv()); - auto lDauNegDCAtoPV = std::abs(candidate.dcanegtopv()); + auto lDauPosDCAtoPV = std::fabs(candidate.dcapostopv()); + auto lDauNegDCAtoPV = std::fabs(candidate.dcanegtopv()); auto lPt = candidate.pt(); auto lRapidity = candidate.yK0Short(); auto lRadius = candidate.v0radius(); - auto lDCAtoPV = candidate.dcav0topv(); + auto lDCAtoPV = std::fabs(candidate.dcav0topv()); auto lCPA = candidate.v0cosPA(); auto lPropTauK0s = candidate.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * MassK0Short; auto lMk0s = candidate.mK0Short(); @@ -682,7 +622,7 @@ struct Chk892Flow { return false; if (lPropTauK0s > SecondaryCuts.cfgSecondaryProperLifetimeMax) return false; - if (candidate.qtarm() < SecondaryCuts.cfgSecondaryparamArmenterosCut * std::abs(candidate.alpha())) + if (candidate.qtarm() < SecondaryCuts.cfgSecondaryparamArmenterosCut * std::fabs(candidate.alpha())) return false; if (std::fabs(lMk0s - MassK0Short) > SecondaryCuts.cfgSecondaryMassWindow) return false; @@ -757,9 +697,9 @@ struct Chk892Flow { template bool isTrueKstar(const TrackTemplate& bTrack, const V0Template& k0sCand) { - if (std::abs(bTrack.PDGCode()) != kPiPlus) // Are you pion? + if (std::abs(bTrack.pdgCode()) != kPiPlus) // Are you pion? return false; - if (std::abs(k0sCand.PDGCode()) != kPDGK0s) // Are you K0s? + if (std::abs(k0sCand.pdgCode()) != kPDGK0s) // Are you K0s? return false; auto motherbTrack = bTrack.template mothers_as(); @@ -769,16 +709,16 @@ struct Chk892Flow { if (std::abs(motherbTrack.pdgCode()) != kKstarPlus) // Are you charged Kstar's daughter? return false; // Apply first since it's more restrictive - if (std::abs(motherkV0.pdgCode()) != 310) // Is it K0s? + if (std::abs(motherkV0.pdgCode()) != kPDGK0s) // Is it K0s? return false; // Check if K0s's mother is K0 (311) auto motherK0 = motherkV0.template mothers_as(); - if (std::abs(motherK0.pdgCode()) != 311) + if (std::abs(motherK0.pdgCode()) != kPDGK0) return false; // Check if K0's mother is Kstar (323) auto motherKstar = motherK0.template mothers_as(); - if (std::abs(motherKstar.pdgCode()) != 323) + if (std::abs(motherKstar.pdgCode()) != kKstarPlus) return false; // Check if bTrack and K0 have the same mother (global index) @@ -790,7 +730,7 @@ struct Chk892Flow { int count = 0; - template + template void fillHistograms(const CollisionType& collision, const TracksType& dTracks1, const TracksTypeK0s& dTracks2, int nmode) { histos.fill(HIST("QA/before/CentDist"), lCentrality); @@ -825,7 +765,7 @@ struct Chk892Flow { histos.fill(HIST("QA/EP/hEPSPResBC"), lCentrality, lEPSPResBC); } - TLorentzVector lDecayDaughter1, lDecayDaughter2, lResoSecondary, lDecayDaughter_bach, lResoKstar, lDaughterRot, lResonanceRot; + LorentzVectorSetXYZM lDecayDaughter1, lDecayDaughter2, lResoSecondary, lDecayDaughter_bach, lResoKstar, lDaughterRot, lResonanceRot; std::vector trackIndicies = {}; std::vector k0sIndicies = {}; @@ -877,11 +817,13 @@ struct Chk892Flow { /// Daughters // Positve pion auto trkppt = posDauTrack.pt(); + auto trkpy = posDauTrack.y(); auto istrkphasTOF = posDauTrack.hasTOF(); auto trkpNSigmaPiTPC = posDauTrack.tpcNSigmaPi(); auto trkpNSigmaPiTOF = (istrkphasTOF) ? posDauTrack.tofNSigmaPi() : -999.; // Negative pion auto trknpt = negDauTrack.pt(); + auto trkny = negDauTrack.y(); auto istrknhasTOF = negDauTrack.hasTOF(); auto trknNSigmaPiTPC = negDauTrack.tpcNSigmaPi(); auto trknNSigmaPiTOF = (istrknhasTOF) ? negDauTrack.tofNSigmaPi() : -999.; @@ -894,15 +836,14 @@ struct Chk892Flow { auto trkkPropTau = k0sCand.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * MassK0Short; auto trkkMass = k0sCand.mK0Short(); - // lResoSecondary.SetXYZM(k0sCand.px(), k0sCand.py(), k0sCand.pz(), MassK0Short); - lResoSecondary.SetXYZM(k0sCand.px(), k0sCand.py(), k0sCand.pz(), trkkMass); + lResoSecondary = LorentzVectorSetXYZM(k0sCand.px(), k0sCand.py(), k0sCand.pz(), trkkMass); auto lPhiMinusPsiK0s = RecoDecay::constrainAngle(lResoSecondary.Phi() - lEPDet, 0.0, 2); // constrain angle to range 0, Pi - // auto v2K0s = std::cos(static_cast(nmode) * lPhiMinusPsiK0s); + // auto v2K0s = std::cos(static_cast(nmode) * lPhiMinusPsiK0s); - float cosNPhi_K0s = std::cos(static_cast(nmode) * lResoSecondary.Phi()); - float sinNPhi_K0s = std::sin(static_cast(nmode) * lResoSecondary.Phi()); + float cosNPhiK0s = std::cos(static_cast(nmode) * lResoSecondary.Phi()); + float sinNPhiK0s = std::sin(static_cast(nmode) * lResoSecondary.Phi()); - auto v2K0s = cosNPhi_K0s * collision.qvecRe()[lQvecDetInd] + sinNPhi_K0s * collision.qvecIm()[lQvecDetInd]; + auto v2K0s = cosNPhiK0s * collision.qvecRe()[lQvecDetInd] + sinNPhiK0s * collision.qvecIm()[lQvecDetInd]; if constexpr (!IsMix) { if (AnalysisConfig.cfgFillQAPlots) { // Seconddary QA plots @@ -938,6 +879,10 @@ struct Chk892Flow { continue; if (!SecondaryCuts.cfgByPassDauPIDSelection && !selectionPIDPion(negDauTrack)) continue; + if (!SecondaryCuts.cfgByPassDauRapiditySelection && std::fabs(trkpy) > SecondaryCuts.cfgSecondaryDauRapidityMax) + continue; + if (!SecondaryCuts.cfgByPassDauRapiditySelection && std::fabs(trkny) > SecondaryCuts.cfgSecondaryDauRapidityMax) + continue; if (!selectionK0s(collision, k0sCand)) continue; @@ -976,11 +921,6 @@ struct Chk892Flow { histos.fill(HIST("hInvmass_K0s"), lCentrality, lResoSecondary.Pt(), lResoSecondary.M(), v2K0s, collision.trackOccupancyInTimeRange()); } } - if (AnalysisConfig.cfgFillAdditionalAxis) { - histos.fill(HIST("hInvmass_K0s"), lCentrality, lResoSecondary.Pt(), lResoSecondary.M(), v2K0s, static_cast(nmode) * lPhiMinusPsiK0s, collision.trackOccupancyInTimeRange()); - } else { - histos.fill(HIST("hInvmass_K0s"), lCentrality, lResoSecondary.Pt(), lResoSecondary.M(), v2K0s, collision.trackOccupancyInTimeRange()); - } k0sIndicies.push_back(k0sCand.index()); } } @@ -991,9 +931,8 @@ struct Chk892Flow { auto k0sCand = dTracks2.rawIteratorAt(k0sIndex); auto trkkMass = k0sCand.mK0Short(); - lDecayDaughter_bach.SetXYZM(bTrack.px(), bTrack.py(), bTrack.pz(), MassPionCharged); - // lResoSecondary.SetXYZM(k0sCand.px(), k0sCand.py(), k0sCand.pz(), MassK0Short); - lResoSecondary.SetXYZM(k0sCand.px(), k0sCand.py(), k0sCand.pz(), trkkMass); + lDecayDaughter_bach = LorentzVectorSetXYZM(bTrack.px(), bTrack.py(), bTrack.pz(), MassPionCharged); + lResoSecondary = LorentzVectorSetXYZM(k0sCand.px(), k0sCand.py(), k0sCand.pz(), trkkMass); lResoKstar = lResoSecondary + lDecayDaughter_bach; auto resoPhi = lResoKstar.Phi(); // EP method @@ -1040,11 +979,15 @@ struct Chk892Flow { } if (BkgEstimationConfig.cfgRotPion) { lDaughterRot = lDecayDaughter_bach; - lDaughterRot.RotateZ(lRotAngle); + ROOT::Math::RotationZ rot(lRotAngle); + auto p3 = rot * lDaughterRot.Vect(); + lDaughterRot = LorentzVectorSetXYZM(p3.X(), p3.Y(), p3.Z(), lDaughterRot.M()); lResonanceRot = lDaughterRot + lResoSecondary; } else { lDaughterRot = lResoSecondary; - lDaughterRot.RotateZ(lRotAngle); + ROOT::Math::RotationZ rot(lRotAngle); + auto p3 = rot * lDaughterRot.Vect(); + lDaughterRot = LorentzVectorSetXYZM(p3.X(), p3.Y(), p3.Z(), lDaughterRot.M()); lResonanceRot = lDecayDaughter_bach + lDaughterRot; } resoPhi = lResonanceRot.Phi(); @@ -1064,6 +1007,7 @@ struct Chk892Flow { } } } // IsMix + } // k0sCand } // bTrack @@ -1075,7 +1019,7 @@ struct Chk892Flow { void processDummy(aod::Collisions const&) { } - PROCESS_SWITCH(Chk892Flow, processDummy, "process Dummy", true); + PROCESS_SWITCH(Chk892Flow, processDummy, "process Dummy", false); // process data void processData(EventCandidates::iterator const& collision, @@ -1088,29 +1032,25 @@ struct Chk892Flow { if (EventCuts.cfgEvtUseRCTFlagChecker && !rctChecker(collision)) { return; } - if (AnalysisConfig.cfgQvecSel && (collision.qvecAmp()[lDetId] < 1e-4 || collision.qvecAmp()[lRefAId] < 1e-4 || collision.qvecAmp()[lRefBId] < 1e-4)) + float qAmpThr = 1e-4f; + if (AnalysisConfig.cfgQvecSel && (collision.qvecAmp()[lDetId] < qAmpThr || collision.qvecAmp()[lRefAId] < qAmpThr || collision.qvecAmp()[lRefBId] < qAmpThr)) return; // If we don't have a Q-vector lCentrality = getCentrality(collision); + // lCentrality = collision.centFT0C(); if (lCentrality < EventCuts.cfgEventCentralityMin || lCentrality > EventCuts.cfgEventCentralityMax) return; colCuts.fillQA(collision); - fillHistograms(collision, tracks, v0s, EventPlaneConfig.cfgnMods); // second order + fillHistograms(collision, tracks, v0s, EventPlaneConfig.cfgnMods); // second order } - PROCESS_SWITCH(Chk892Flow, processData, "Process Event for data without Partitioning", false); + PROCESS_SWITCH(Chk892Flow, processData, "Process Event for data without Partitioning", true); - // process MC reconstructed level - void processMC(EventCandidates::iterator const& collision, - MCTrackCandidates const& tracks, - MCV0Candidates const& v0s) + void processMC(aod::McCollisions const&) { - if (EventCuts.cfgEvtUseRCTFlagChecker && !rctChecker(collision)) { - return; - } - fillHistograms(collision, tracks, v0s, EventPlaneConfig.cfgnMods); } - PROCESS_SWITCH(Chk892Flow, processMC, "Process Event for MC", false); + PROCESS_SWITCH(Chk892Flow, processMC, "Process MC for efficiency correction", false); }; + WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; From 248986aba9d3ae9992d1e279fe7536f33964467a Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Wed, 3 Sep 2025 12:37:59 +0530 Subject: [PATCH 284/986] [PWGLF] Removed unused table from derived data in ME (#12837) --- PWGLF/Tasks/Resonances/higherMassResonances.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Resonances/higherMassResonances.cxx b/PWGLF/Tasks/Resonances/higherMassResonances.cxx index 8fbac8faf5c..b1cd9d2ddf2 100644 --- a/PWGLF/Tasks/Resonances/higherMassResonances.cxx +++ b/PWGLF/Tasks/Resonances/higherMassResonances.cxx @@ -1400,7 +1400,7 @@ struct HigherMassResonances { } PROCESS_SWITCH(HigherMassResonances, processSEderived, "same event process in strangeness derived data", false); - void processMEderived(EventCandidatesDerivedData const& collisions, TrackCandidates const& /*tracks*/, V0CandidatesDerivedData const& v0s, DauTracks const&) + void processMEderived(EventCandidatesDerivedData const& collisions, V0CandidatesDerivedData const& v0s, DauTracks const&) { for (const auto& [c1, c2] : selfCombinations(colBinning, config.cfgNmixedEvents, -1, collisions, collisions)) // two different centrality c1 and c2 and tracks corresponding to them From 6a50fa4da3b274d109b1a912204e3012196ce6a4 Mon Sep 17 00:00:00 2001 From: JimunLee Date: Wed, 3 Sep 2025 16:10:08 +0900 Subject: [PATCH 285/986] [PWGLF] Fixed couple of options about KstarInOO.cxx (#12835) Co-authored-by: jimun_lee --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 174 +++++++-------------------- 1 file changed, 46 insertions(+), 128 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index e91bfb19251..bfd8bc8ee0b 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -8,7 +8,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. - /// \file kstarInOO.cxx /// \brief the pT spectra of k*0(892) resonance analysis in OO collisions /// \author Jimun Lee @@ -52,7 +51,6 @@ #include #include - using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -61,7 +59,6 @@ struct kstarInOO { SliceCache cache; Preslice perCollision = aod::track::collisionId; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - //================================== //|| //|| Selection @@ -80,7 +77,6 @@ struct kstarInOO { Configurable cfgTrackMaxDCAzToPVcut{"cfgTrackMaxDCAzToPVcut", 2.0, "Track DCAz cut to PV Maximum"}; Configurable cfgTrackPrimaryTrack{"cfgTrackPrimaryTrack", true, "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz Configurable cfgTrackConnectedToPV{"cfgTrackConnectedToPV", true, "PV contributor track selection"}; // PV Contriuibutor - Configurable cfgGlobalTrack{"cfgGlobalTrack", true, "Global track selection"}; // kGoldenChi2 | kDCAxy | kDCAz Configurable cfgTrackGlobalWoDCATrack{"cfgTrackGlobalWoDCATrack", true, "Global track selection without DCA"}; // kQualityTracks (kTrackType | kTPCNCls | kTPCCrossedRows | kTPCCrossedRowsOverNCls | kTPCChi2NDF | kTPCRefit | kITSNCls | kITSChi2NDF | kITSRefit | kITSHits) | kInAcceptanceTracks (kPtRange | kEtaRange) // TPC Configurable cfgTracknFindableTPCClusters{"cfgTrackFindableTPCClusters", 50, "nFindable TPC Clusters"}; @@ -105,24 +101,21 @@ struct kstarInOO { // MCGen Configurable cfgForceGenReco{"cfgForceGenReco", false, "Only consider events which are reconstructed (neglect event-loss)"}; - // Configurable cfgForceBR{"cfgForceBR", false, "Only consider K*0->K(pm)pi(mp)"}; - // Configurable cfgForceKaonAcceptence{"cfgForceKaonAcceptence", false, "Only consider K*0's whose daughters decay inside acceptence (no signal loss)"}; - // Configurable cfgForcePionAcceptence{"cfgForcePionAcceptence", false, "Only consider K*0's whose daughters decay inside acceptence (no signal loss)"}; // Pair Configurable cfgMinvNBins{"cfgMinvNBins", 300, "Number of bins for Minv axis"}; Configurable cfgMinvMin{"cfgMinvMin", 0.60, "Minimum Minv value"}; Configurable cfgMinvMax{"cfgMinvMax", 1.20, "Maximum Minv value"}; + // Histogram ConfigurableAxis binsDCAz{"binsDCAz", {40, -0.2, 0.2}, ""}; ConfigurableAxis binsDCAxy{"binsDCAxy", {40, -0.2, 0.2}, ""}; - - // Histogram Configurable cfgEventCutQA{"cfgEventCutsQA", false, "Enable Event QA Hists"}; Configurable cfgTrackCutQA{"cfgTrackCutQA", false, "Enable Track QA Hists"}; Configurable cfgDataHistos{"cfgDataHistos", false, "Enable Data Hists"}; Configurable cfgMcHistos{"cfgMcHistos", false, "Enable MC Hists"}; + // Main void init(o2::framework::InitContext&) { // HISTOGRAMS @@ -200,18 +193,15 @@ struct kstarInOO { using EventCandidates = soa::Join; //, aod::CentFT0Ms, aod::CentFT0As using EventCandidatesTrue = aod::McCollisions; - using TrackCandidates = soa::Join; using TrackCandidatesMC = soa::Join; - // For Mixed Event using BinningType = ColumnBinningPolicy; Partition kaon = !cfgTrackTPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfgTrackTPCPIDnSig); Partition pion = !cfgTrackTPCPID || (nabs(aod::pidtpc::tpcNSigmaPi) <= cfgTrackTPCPIDnSig); - Partition kaonMC = !cfgTrackTPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfgTrackTPCPIDnSig); Partition pionMC = !cfgTrackTPCPID || (nabs(aod::pidtpc::tpcNSigmaPi) <= cfgTrackTPCPIDnSig); @@ -224,12 +214,13 @@ struct kstarInOO { //|| //================================== template - bool eventSelection(const EventType event, const bool QA) + bool eventSelection(const EventType event) { - if (cfgEventCutQA && QA) { + if (cfgEventCutQA) { histos.fill(HIST("hPosZ_BC"), event.posZ()); histos.fill(HIST("hcentFT0C_BC"), event.centFT0C()); } + if (!event.sel8()) return false; if (std::abs(event.posZ()) > cfgEventVtxCut) @@ -245,7 +236,7 @@ struct kstarInOO { if (!event.selection_bit(aod::evsel::kNoCollInTimeRangeStandard)) return false; - if (cfgEventCutQA && QA) { + if (cfgEventCutQA) { histos.fill(HIST("hPosZ_AC"), event.posZ()); histos.fill(HIST("hcentFT0C_AC"), event.centFT0C()); } @@ -253,9 +244,9 @@ struct kstarInOO { }; template - bool trackSelection(const TracksType track, bool QA) + bool trackSelection(const TracksType track) { - if (cfgTrackCutQA && QA) { + if (cfgTrackCutQA) { histos.fill(HIST("hDCArToPv_BC"), track.dcaXY()); histos.fill(HIST("hDCAzToPv_BC"), track.dcaZ()); histos.fill(HIST("hIsPrim_BC"), track.isPrimaryTrack()); @@ -267,86 +258,34 @@ struct kstarInOO { histos.fill(HIST("hTPCChi2_BC"), track.tpcChi2NCl()); histos.fill(HIST("QA_track_pT_BC"), track.pt()); } - + if (!track.isGlobalTrack()) + return false; if (track.pt() < cfgTrackMinPt) return false; - if (cfgTrackCutQA && QA) { - histos.fill(HIST("QA_track_pT_BC"), track.pt()); - } - if (std::abs(track.eta()) > cfgTrackMaxEta) return false; - if (cfgTrackCutQA && QA) { - histos.fill(HIST("QA_track_pT_BC"), track.pt()); - } - - if (!cfgGlobalTrack && !track.isGlobalTrack()) - return false; - if (cfgTrackCutQA && QA) { - histos.fill(HIST("QA_track_pT_BC"), track.pt()); - } - if (std::abs(track.dcaXY()) > cfgTrackMaxDCArToPVcut) return false; - if (cfgTrackCutQA && QA) { - histos.fill(HIST("QA_track_pT_BC"), track.pt()); - } - if (std::abs(track.dcaZ()) > cfgTrackMaxDCAzToPVcut) return false; - if (cfgTrackCutQA && QA) { - histos.fill(HIST("QA_track_pT_BC"), track.pt()); - } - if (cfgTrackPrimaryTrack && !track.isPrimaryTrack()) return false; - if (cfgTrackCutQA && QA) { - histos.fill(HIST("QA_track_pT_BC"), track.pt()); - } - if (cfgTrackGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) return false; - if (cfgTrackCutQA && QA) { - histos.fill(HIST("QA_track_pT_BC"), track.pt()); - } - if (track.tpcNClsFindable() < cfgTracknFindableTPCClusters) return false; - if (cfgTrackCutQA && QA) { - histos.fill(HIST("QA_track_pT_BC"), track.pt()); - } - if (track.tpcNClsCrossedRows() < cfgTracknTPCCrossedRows) return false; - if (cfgTrackCutQA && QA) { - histos.fill(HIST("QA_track_pT_BC"), track.pt()); - } - if (track.tpcCrossedRowsOverFindableCls() > cfgTracknRowsOverFindable) return false; - if (cfgTrackCutQA && QA) { - histos.fill(HIST("QA_track_pT_BC"), track.pt()); - } - if (track.tpcChi2NCl() > cfgTracknTPCChi2) return false; - if (cfgTrackCutQA && QA) { - histos.fill(HIST("QA_track_pT_BC"), track.pt()); - } - if (track.itsChi2NCl() > cfgTracknITSChi2) return false; - if (cfgTrackCutQA && QA) { - histos.fill(HIST("QA_track_pT_BC"), track.pt()); - } - if (cfgTrackConnectedToPV && !track.isPVContributor()) return false; - if (cfgTrackCutQA && QA) { - histos.fill(HIST("QA_track_pT_BC"), track.pt()); - } - if (cfgTrackCutQA && QA) { + if (cfgTrackCutQA) { histos.fill(HIST("hDCArToPv_AC"), track.dcaXY()); histos.fill(HIST("hDCAzToPv_AC"), track.dcaZ()); histos.fill(HIST("hIsPrim_AC"), track.isPrimaryTrack()); @@ -362,19 +301,17 @@ struct kstarInOO { }; template - bool trackPIDKaon(const TrackPID& candidate, const bool QA) + bool trackPIDKaon(const TrackPID& candidate) { bool tpcPIDPassed{false}, tofPIDPassed{false}; - if (cfgTrackCutQA && QA) { - // kaon + // TPC + if (cfgTrackCutQA) { histos.fill(HIST("QA_nSigma_kaon_TPC_BC"), candidate.pt(), candidate.tpcNSigmaKa()); histos.fill(HIST("QA_nSigma_kaon_TOF_BC"), candidate.pt(), candidate.tofNSigmaKa()); histos.fill(HIST("QA_kaon_TPC_TOF_BC"), candidate.tpcNSigmaKa(), candidate.tofNSigmaKa()); } - // TPC if (std::abs(candidate.tpcNSigmaKa()) < cfgTrackTPCPIDnSig) tpcPIDPassed = true; - // TOF if (candidate.hasTOF()) { if (std::abs(candidate.tofNSigmaKa()) < cfgTrackTOFPIDnSig) { @@ -383,11 +320,9 @@ struct kstarInOO { } else { tofPIDPassed = true; } - // TPC & TOF if (tpcPIDPassed && tofPIDPassed) { - if (cfgTrackCutQA && QA) { - // kaon + if (cfgTrackCutQA) { histos.fill(HIST("QA_nSigma_kaon_TPC_AC"), candidate.pt(), candidate.tpcNSigmaKa()); histos.fill(HIST("QA_nSigma_kaon_TOF_AC"), candidate.pt(), candidate.tofNSigmaKa()); histos.fill(HIST("QA_kaon_TPC_TOF_AC"), candidate.tpcNSigmaKa(), candidate.tofNSigmaKa()); @@ -398,20 +333,17 @@ struct kstarInOO { } template - bool trackPIDPion(const TrackPID& candidate, const bool QA) + bool trackPIDPion(const TrackPID& candidate) { bool tpcPIDPassed{false}, tofPIDPassed{false}; - if (cfgTrackCutQA && QA) { - // pion + // TPC + if (cfgTrackCutQA) { histos.fill(HIST("QA_nSigma_pion_TPC_BC"), candidate.pt(), candidate.tpcNSigmaPi()); histos.fill(HIST("QA_nSigma_pion_TOF_BC"), candidate.pt(), candidate.tofNSigmaPi()); histos.fill(HIST("QA_pion_TPC_TOF_BC"), candidate.tpcNSigmaPi(), candidate.tofNSigmaPi()); } - - // TPC if (std::abs(candidate.tpcNSigmaPi()) < cfgTrackTPCPIDnSig) tpcPIDPassed = true; - // TOF if (candidate.hasTOF()) { if (std::abs(candidate.tofNSigmaPi()) < cfgTrackTOFPIDnSig) { tofPIDPassed = true; @@ -419,11 +351,9 @@ struct kstarInOO { } else { tofPIDPassed = true; } - // TPC & TOF if (tpcPIDPassed && tofPIDPassed) { - if (cfgTrackCutQA && QA) { - // pion + if (cfgTrackCutQA) { histos.fill(HIST("QA_nSigma_pion_TPC_AC"), candidate.pt(), candidate.tpcNSigmaPi()); histos.fill(HIST("QA_nSigma_pion_TOF_AC"), candidate.pt(), candidate.tofNSigmaPi()); histos.fill(HIST("QA_pion_TPC_TOF_AC"), candidate.tpcNSigmaPi(), candidate.tofNSigmaPi()); @@ -434,14 +364,14 @@ struct kstarInOO { } template - void TrackSlicing(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool QA, const bool IsMix) + void TrackSlicing(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool IsMix) { auto tracks1 = kaon->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); auto tracks2 = pion->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); auto centrality = collision1.centFT0C(); for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - auto [KstarPt, Minv] = minvReconstruction(trk1, trk2, QA); + auto [KstarPt, Minv] = minvReconstruction(trk1, trk2); if (Minv < 0) continue; @@ -465,14 +395,14 @@ struct kstarInOO { } // TrackSlicing template - void TrackSlicingMC(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool QA, const bool IsMix) + void TrackSlicingMC(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool IsMix) { auto tracks1 = kaonMC->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); auto tracks2 = pionMC->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); auto centrality = collision1.centFT0C(); for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - auto [KstarPt, Minv] = minvReconstruction(trk1, trk2, QA); + auto [KstarPt, Minv] = minvReconstruction(trk1, trk2); if (Minv < 0) continue; @@ -536,30 +466,28 @@ struct kstarInOO { if (cfgMcHistos) { histos.fill(HIST("hMC_USS_True"), centrality, KstarPt, Minv); } + //====================== } // for } // TrackSlicingMC template - std::pair minvReconstruction(const TracksType& trk1, const TracksType& trk2, const bool QA) + std::pair minvReconstruction(const TracksType& trk1, const TracksType& trk2) { TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; - if (!trackSelection(trk1, QA) || !trackSelection(trk2, QA)) + if (!trackSelection(trk1) || !trackSelection(trk2)) return {-1.0, -1.0}; - if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA)) + if (!trackPIDKaon(trk1) || !trackPIDPion(trk2)) return {-1.0, -1.0}; - if (trk1.globalIndex() == trk2.globalIndex()) { return {-1.0, -1.0}; // For Kstar, we need to run (0,1), (1,0) pairs as well. but same id pairs are not need. } - lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa); lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massPi); lResonance = lDecayDaughter1 + lDecayDaughter2; if (std::abs(lResonance.Eta()) > cfgTrackMaxEta) return {-1.0, -1.0}; - return {lResonance.Pt(), lResonance.M()}; } @@ -568,7 +496,6 @@ struct kstarInOO { //| DATA STUFF (SE) //| //======================================================= - int nEvents = 0; void processDataSameEvent(EventCandidates::iterator const& collision, TrackCandidates const& tracks) { @@ -579,7 +506,7 @@ struct kstarInOO { } } - auto goodEv = eventSelection(collision, true); + auto goodEv = eventSelection(collision); if (cfgDataHistos) { histos.fill(HIST("nEvents"), 0.5); } @@ -588,7 +515,7 @@ struct kstarInOO { bool INELgt0 = false; for (const auto& track : tracks) { - if (!trackSelection(track, true)) + if (!trackSelection(track)) continue; if (std::fabs(track.eta()) < cfgTrackMaxEta) { INELgt0 = true; @@ -600,7 +527,7 @@ struct kstarInOO { if (cfgDataHistos) { histos.fill(HIST("nEvents"), 1.5); } - TrackSlicing(collision, tracks, collision, tracks, true, false); + TrackSlicing(collision, tracks, collision, tracks, false); } // processSameEvents PROCESS_SWITCH(kstarInOO, processDataSameEvent, "process Data Same Event", false); @@ -610,7 +537,6 @@ struct kstarInOO { //| DATA STUFF (ME) //| //======================================================= - int nEventsMix = 0; void processDataMixedEvent(EventCandidates const& collisions, TrackCandidates const& tracks) { @@ -624,13 +550,13 @@ struct kstarInOO { std::cout << "Processed DATA Mixed Events : " << nEventsMix << std::endl; } } - auto goodEv1 = eventSelection(collision1, false); - auto goodEv2 = eventSelection(collision2, false); + auto goodEv1 = eventSelection(collision1); + auto goodEv2 = eventSelection(collision2); if (!goodEv1 || !goodEv2) continue; - TrackSlicing(collision1, tracks1, collision2, tracks2, false, true); + TrackSlicing(collision1, tracks1, collision2, tracks2, false); } } PROCESS_SWITCH(kstarInOO, processDataMixedEvent, "process DATA Mixed Event", false); @@ -640,20 +566,18 @@ struct kstarInOO { //| MC STUFF (SE) //| //======================================================= - int nEventsMC = 0; - void processMCSameEvent(EventCandidates::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const&) + void processSameEventMC(EventCandidates::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const&) { if (cDebugLevel > 0) { nEventsMC++; if ((nEventsMC + 1) % 10000 == 0) { double histmem = histos.getSize(); std::cout << histmem << std::endl; - std::cout << "process MC Same Event : " << nEventsMC << std::endl; + std::cout << "process_SameEvent_MC: " << nEventsMC << std::endl; } } - - auto goodEv = eventSelection(collision, true); + auto goodEv = eventSelection(collision); if (cfgMcHistos) { histos.fill(HIST("nEvents_MC"), 0.5); } @@ -672,19 +596,17 @@ struct kstarInOO { if (cfgMcHistos) { histos.fill(HIST("nEvents_MC"), 1.5); } - TrackSlicingMC(collision, tracks, collision, tracks, true, false); - + TrackSlicingMC(collision, tracks, collision, tracks, false); } // processSameEvents_MC - PROCESS_SWITCH(kstarInOO, processMCSameEvent, "process MC Same Event", true); + PROCESS_SWITCH(kstarInOO, processSameEventMC, "process Same Event MC", true); //======================================================= //| //| MC STUFF (ME) //| //======================================================= - int nEventsMCMix = 0; - void processMCMixedEvent(EventCandidates const& collisions, TrackCandidatesMC const& tracks, aod::McParticles const&) + void processMixedEventMC(EventCandidates const& collisions, TrackCandidatesMC const& tracks, aod::McParticles const&) { auto tracksTuple = std::make_tuple(tracks); BinningType colBinning{{cfgBinsMixVtx, cfgBinsMixMult}, true}; // true is for 'ignore overflows' (true by default) @@ -693,24 +615,24 @@ struct kstarInOO { if (cDebugLevel > 0) { nEventsMCMix++; if ((nEventsMCMix + 1) % 10000 == 0) { - std::cout << "Processed MC Mixed Events : " << nEventsMCMix << std::endl; + std::cout << "Processed Mixed Events: " << nEventsMCMix << std::endl; } } - auto goodEv1 = eventSelection(collision1, false); - auto goodEv2 = eventSelection(collision2, false); + auto goodEv1 = eventSelection(collision1); + auto goodEv2 = eventSelection(collision2); if (!goodEv1 || !goodEv2) continue; - TrackSlicingMC(collision1, tracks1, collision2, tracks2, false, true); + + TrackSlicingMC(collision1, tracks1, collision2, tracks2, true); } // mixing } // processMixedEvent_MC - PROCESS_SWITCH(kstarInOO, processMCMixedEvent, "process MC Mixed Event", false); + PROCESS_SWITCH(kstarInOO, processMixedEventMC, "process Mixed Event MC", false); //======================================================= //| //| GENERATED MC STUFF (TRUE) //| //======================================================= - int nEventsTrue = 0; void processMCTrue(EventCandidatesTrue::iterator const& collision, soa::SmallGroups> const& recocolls, aod::McParticles const& particles) { @@ -729,7 +651,7 @@ struct kstarInOO { double centrality = -1; for (auto& recocoll : recocolls) { centrality = recocoll.centFT0C(); - auto goodEv = eventSelection(recocoll, false); + auto goodEv = eventSelection(recocoll); if (cfgMcHistos) { histos.fill(HIST("nEvents_MC_True"), 0.5); @@ -747,9 +669,7 @@ struct kstarInOO { if (cfgMcHistos) { histos.fill(HIST("hMC_kstar_True"), centrality, particle.pt()); } - } // loop over particles - } // processMCTrue PROCESS_SWITCH(kstarInOO, processMCTrue, "process MC True", false); @@ -758,9 +678,7 @@ struct kstarInOO { return; } PROCESS_SWITCH(kstarInOO, processEventsDummy, "dummy", false); - }; // kstarInOO - WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; From c21d0ce7967ff0835327ffd13ce49b8fabf38bd8 Mon Sep 17 00:00:00 2001 From: Antonio Palasciano <52152842+apalasciano@users.noreply.github.com> Date: Wed, 3 Sep 2025 10:40:06 +0200 Subject: [PATCH 286/986] [PWGHF] Minor fix in taskDplus (#12818) --- PWGHF/D2H/Tasks/taskDplus.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/D2H/Tasks/taskDplus.cxx b/PWGHF/D2H/Tasks/taskDplus.cxx index 9740516e91c..aabd95d9283 100644 --- a/PWGHF/D2H/Tasks/taskDplus.cxx +++ b/PWGHF/D2H/Tasks/taskDplus.cxx @@ -317,7 +317,7 @@ struct HfTaskDplus { } else if (!storeCentrality && storeOccupancy) { registry.fill(HIST("hSparseMassFD"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], occupancy, ptbhad, flagBHad); } else if (!storeCentrality && !storeOccupancy && storePvContributors) { - registry.fill(HIST("hSparseMassFD"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], numPvContributors); + registry.fill(HIST("hSparseMassFD"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], numPvContributors, ptbhad, flagBHad); } else { registry.fill(HIST("hSparseMassFD"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], ptbhad, flagBHad); } From cd5a1c40a2df204b6a178c1f4faa23400ce2c8bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Wed, 3 Sep 2025 11:59:56 +0200 Subject: [PATCH 287/986] [PWGLF] Allow FT0A and FT0C in MCCentrality (#12785) --- PWGLF/DataModel/mcCentrality.h | 3 +- PWGLF/TableProducer/Common/mcCentrality.cxx | 103 +++++++++++++------- 2 files changed, 68 insertions(+), 38 deletions(-) diff --git a/PWGLF/DataModel/mcCentrality.h b/PWGLF/DataModel/mcCentrality.h index 86e97eb8c33..fdbe1426e52 100644 --- a/PWGLF/DataModel/mcCentrality.h +++ b/PWGLF/DataModel/mcCentrality.h @@ -21,9 +21,10 @@ #define PWGLF_DATAMODEL_MCCENTRALITY_H_ // O2 includes +#include "Common/DataModel/Centrality.h" + #include "Framework/ASoA.h" #include "Framework/AnalysisDataModel.h" -#include "Common/DataModel/Centrality.h" #include "Framework/Logger.h" namespace o2::aod diff --git a/PWGLF/TableProducer/Common/mcCentrality.cxx b/PWGLF/TableProducer/Common/mcCentrality.cxx index 690d049af4d..1dec9b7fb28 100644 --- a/PWGLF/TableProducer/Common/mcCentrality.cxx +++ b/PWGLF/TableProducer/Common/mcCentrality.cxx @@ -17,30 +17,35 @@ /// \brief Task to produce the table for the equalized multiplicity into centrality bins /// -// O2 includes -#include "CCDB/BasicCCDBManager.h" -#include "ReconstructionDataFormats/Track.h" -#include "CCDB/CcdbApi.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/runDataProcessing.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/StaticFor.h" -#include "TableHelper.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "Common/DataModel/Centrality.h" #include "PWGLF/DataModel/mcCentrality.h" + +#include "TableHelper.h" + #include "PWGLF/Utils/inelGt.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::track; /// Task to produce the response table -struct mcCentrality { +struct McCentrality { // Tables to produce Produces centFV0A; @@ -52,27 +57,30 @@ struct mcCentrality { // Input parameters Service ccdb; - Configurable url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable ccdbTimestamp{"ccdb-timestamp", -1, "timestamp of the object used to query in CCDB the detector response. If 0 the object corresponding to the run number is used, if < 0 the latest object is used"}; + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable ccdbTimestamp{"ccdbTimestamp", -1, "timestamp of the object used to query in CCDB the detector response. If 0 the object corresponding to the run number is used, if < 0 the latest object is used"}; Configurable path{"path", "/tmp/InputCalibMC.root", "path to calib file or ccdb path if begins with ccdb://"}; Configurable selectPrimaries{"selectPrimaries", true, "Select only primary particles"}; Service pdgDB; ConfigurableAxis binsPercentile{"binsPercentile", {VARIABLE_WIDTH, 0, 0.001, 0.01, 1.0, 5.0, 10.0, 15.0, 20.0, 25.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0}, "Binning of the percentile axis"}; + ConfigurableAxis binsMultiplicity{"binsMultiplicity", {1000, 0, 5000}, "Binning of the multiplicity axis"}; + Configurable fillFt0A{"fillFt0A", false, "Fills the FT0A histogram"}; + Configurable fillFt0C{"fillFt0C", false, "Fills the FT0C histogram"}; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; TH1F* h1dFT0M; - /*TH1F* h1dFT0A; + TH1F* h1dFT0A; TH1F* h1dFT0C; - TH1F* h1dFDD; - TH1F* h1dNTP;*/ + // TH1F* h1dFDD; + // TH1F* h1dNTP; o2::pwglf::ParticleCounter mCounter; void init(o2::framework::InitContext& /*initContext*/) { // Set up the CCDB - ccdb->setURL(url.value); + ccdb->setURL(ccdbUrl.value); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); @@ -81,7 +89,15 @@ struct mcCentrality { mCounter.mPdgDatabase = pdgDB.service; mCounter.mSelectPrimaries = selectPrimaries.value; histos.add("FT0M/percentile", "FT0M percentile.", HistType::kTH1D, {{binsPercentile, "FT0M percentile"}}); - histos.add("FT0M/percentilevsMult", "FT0M percentile.", HistType::kTH2D, {{binsPercentile, "FT0M percentile"}, {1000, 0, 5000, "FT0M mult."}}); + histos.add("FT0M/percentilevsMult", "FT0M percentile.", HistType::kTH2D, {{binsPercentile, "FT0M percentile"}, {binsMultiplicity, "FT0M mult."}}); + if (fillFt0A) { + histos.add("FT0A/percentile", "FT0A percentile.", HistType::kTH1D, {{binsPercentile, "FT0A percentile"}}); + histos.add("FT0A/percentilevsMult", "FT0A percentile.", HistType::kTH2D, {{binsPercentile, "FT0A percentile"}, {binsMultiplicity, "FT0A mult."}}); + } + if (fillFt0C) { + histos.add("FT0C/percentile", "FT0C percentile.", HistType::kTH1D, {{binsPercentile, "FT0C percentile"}}); + histos.add("FT0C/percentilevsMult", "FT0C percentile.", HistType::kTH2D, {{binsPercentile, "FT0C percentile"}, {binsMultiplicity, "FT0C mult."}}); + } TList* lOfInput; if (path.value.rfind("ccdb://", 0) == 0) { // Getting post calib. from CCDB @@ -105,11 +121,20 @@ struct mcCentrality { LOG(fatal) << "The input file " << path.value << " does not contain the TList ccdb_object"; } } - h1dFT0M = static_cast(lOfInput->FindObject("h1dFT0M")); - if (!h1dFT0M) { - lOfInput->ls(); - LOG(fatal) << "Could not open histogram h1dFT0M from TList"; - return; + auto getHist = [lOfInput](const char* name) -> TH1F* { + auto hist = static_cast(lOfInput->FindObject(name)); + if (!hist) { + lOfInput->ls(); + LOG(fatal) << "Could not open histogram " << name << " from TList"; + } + return hist; + }; + h1dFT0M = getHist("h1dFT0M"); + if (fillFt0A) { + h1dFT0A = getHist("h1dFT0A"); + } + if (fillFt0C) { + h1dFT0C = getHist("h1dFT0C"); } } @@ -117,23 +142,27 @@ struct mcCentrality { void process(aod::McCollision const& /*mcCollision*/, aod::McParticles const& mcParticles) { - const float nFT0M = mCounter.countFT0A(mcParticles) + mCounter.countFT0C(mcParticles); - /*const float nFT0A = mCounter.countFT0A(mcParticles); + const float nFT0A = mCounter.countFT0A(mcParticles); const float nFT0C = mCounter.countFT0C(mcParticles); - const float nFV0A = mCounter.countFV0A(mcParticles);*/ + const float nFT0M = nFT0A + nFT0C; + // const float nFV0A = mCounter.countFV0A(mcParticles); const float valueCentFT0M = h1dFT0M->GetBinContent(h1dFT0M->FindBin(nFT0M)); - /*const float valueCentFT0A = h1dFT0M->GetBinContent(h1dFT0M->FindBin(nFT0A)); - const float valueCentFT0C = h1dFT0M->GetBinContent(h1dFT0M->FindBin(nFT0C)); - const float valueCentFV0A = h1dFT0M->GetBinContent(h1dFT0M->FindBin(nFV0A));*/ + if (fillFt0A) { + const float valueCentFT0A = h1dFT0M->GetBinContent(h1dFT0M->FindBin(nFT0A)); + centFT0A(valueCentFT0A); + } + if (fillFt0C) { + const float valueCentFT0C = h1dFT0M->GetBinContent(h1dFT0M->FindBin(nFT0C)); + centFT0C(valueCentFT0C); + } + // const float valueCentFV0A = h1dFT0M->GetBinContent(h1dFT0M->FindBin(nFV0A)); centFT0M(valueCentFT0M); - /*centFT0A(valueCentFT0A); - centFT0C(valueCentFT0C); - centFV0A(valueCentFV0A);*/ + // centFV0A(valueCentFV0A); histos.fill(HIST("FT0M/percentile"), valueCentFT0M); histos.fill(HIST("FT0M/percentilevsMult"), valueCentFT0M, nFT0M); } }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } From 686c3db04bb087b1bb9974bad2a5a12407215bb7 Mon Sep 17 00:00:00 2001 From: omvazque Date: Wed, 3 Sep 2025 05:19:32 -0500 Subject: [PATCH 288/986] [PWGLF] Loosen the gamma conversions criteria + dEdx dist. (#12830) --- PWGLF/Tasks/Nuspex/piKpRAA.cxx | 176 ++++++++++++++++++--------------- 1 file changed, 95 insertions(+), 81 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/piKpRAA.cxx b/PWGLF/Tasks/Nuspex/piKpRAA.cxx index 1fb44ccd448..06682d9cbf7 100644 --- a/PWGLF/Tasks/Nuspex/piKpRAA.cxx +++ b/PWGLF/Tasks/Nuspex/piKpRAA.cxx @@ -77,6 +77,8 @@ std::array, kNEtaHists> dEdxPiV0{}; std::array, kNEtaHists> dEdxPrV0{}; std::array, kNEtaHists> dEdxElV0{}; std::array, kNEtaHists> dEdxPiTOF{}; +std::array, kNEtaHists> dEdx{}; +std::array, kNEtaHists> pTVsP{}; struct PiKpRAA { @@ -126,12 +128,13 @@ struct PiKpRAA { // original equation: lArmPt*5>TMath::Abs(lArmAlpha) Configurable armPodCut{"armPodCut", 5.0f, "pT * (cut) > |alpha|, AP cut. Negative: no cut"}; Configurable armAlphaSel{"armAlphaSel", 0.45f, "Armenteros alpha selection (Gammas)"}; - Configurable qTSel{"qTSel", 0.1f, "Armenteros qT select (Gammas)"}; + Configurable qTSel{"qTSel", 0.01f, "Armenteros qT select (Gammas)"}; // Selection Configurable applyInvMassSel{"applyInvMassSel", false, "Select V0s close to the Inv. mass value"}; Configurable dMassSel{"dMassSel", 0.01f, "Invariant mass selection"}; Configurable dMassSelG{"dMassSelG", 0.1f, "Inv mass selection gammas"}; + Configurable dMassGcut{"dMassGcut", 0.01f, "Inv mass selection gammas"}; // PID (TPC/TOF) Configurable tpcPidNsigmaCut{"tpcPidNsigmaCut", 5, "tpcPidNsigmaCut"}; @@ -173,7 +176,7 @@ struct PiKpRAA { ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.12}, "pT binning"}; ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0., 5., 10., 20., 30., 40., 50., 60., 70., 80., 90., 100.}, "T0C binning"}; ConfigurableAxis axisArmAlpha{"axisArmAlpha", {200, -1.0, 1.0}, "Armenteros alpha"}; - ConfigurableAxis axisArmqT{"axisArmqT", {200, 0.0f, 0.3f}, "Armenteros qT"}; + ConfigurableAxis axisArmqT{"axisArmqT", {600, 0.0f, 0.3f}, "Armenteros qT"}; ConfigurableAxis axisK0Mass{"axisK0Mass", {200, 0.4f, 0.6f}, "Mass K0Short"}; ConfigurableAxis axisLambdaMass{"axisLambdaMass", {200, 1.101f, 1.131f}, "Mass Lambda"}; ConfigurableAxis axisGammaMass{"axisGammaMass", {200, 0.0f, 0.5f}, "Mass Gamma"}; @@ -289,6 +292,7 @@ struct PiKpRAA { registry.add("ExcludedEvtVsNch", ";Nch;Entries;", kTH1F, {{nBinsNch, minNch, maxNch}}); registry.add("ExcludedEvtVsNPV", ";NPV;Entries;", kTH1F, {{nBinsNPV, minNpv, maxNpv}}); + registry.add("dcaVsPt", "Primary particles;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm);", kTH2F, {{{axisPt}, {40, -1.0, 1.0}}}); registry.add("dcaDauVsPt", ";V0 #it{p}_{T} (GeV/#it{c});DCA_{xy} (cm) daughters;", kTH2F, {{{axisPtV0s}, {200, -10., 10.}}}); registry.add("nSigPiFromK0s", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); registry.add("nSigPiFromL", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); @@ -314,7 +318,8 @@ struct PiKpRAA { registry.add("NclFoundp", ";;Found #LTNcl#GT TPC", kTProfile, {axisXNcl}); registry.add("NclFoundVsPhipBeforeCut", Form("Found #LTNcl#GT TPC;%s (GeV/#it{c});#varphi", titlePorPt.data()), kTProfile2D, {{{axisXPhiCut}, {350, 0.0, 0.35}}}); registry.add("NclFoundVsPhipAfterCut", Form("Found #LTNcl#GT TPC;%s (GeV/#it{c});#varphi", titlePorPt.data()), kTProfile2D, {{{axisXPhiCut}, {350, 0.0, 0.35}}}); - registry.add("NclVsEta", ";#eta; Ncl TPC", kTH2F, {{{axisEta}, {161, -0.5, 160.5}}}); + registry.add("NclVsEta", ";#eta;Found Ncl TPC", kTH2F, {{{axisEta}, {161, -0.5, 160.5}}}); + registry.add("NclVsEtap", ";#eta;Found #LTNcl#GT TPC", kTProfile, {axisEta}); registry.add("NclVsEtaPiMIP", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c}, 40 < dE/dx < 60);#eta; Found Ncl TPC", kTH2F, {{{axisEta}, {161, -0.5, 160.5}}}); registry.add("NclVsEtaPiMIPp", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c}, 40 < dE/dx < 60);#eta; Found #LTNcl#GT TPC", kTProfile, {axisEta}); @@ -335,7 +340,6 @@ struct PiKpRAA { registry.add("TOFExpEl2TOF", ";Momentum (GeV/#it{c});t^{#pi}_{Exp}/t_{TOF}", kTH2F, {{{axisPtV0s}, {100, 0.2, 1.2}}}); registry.add("betaVsMomentum", ";Momentum (GeV/#it{c}); #beta", kTH2F, {{{axisPtV0s}, {500, 0, 1.2}}}); - registry.add("dEdxVsMomentum", ";Momentum (GeV/#it{c}); dE/dx", kTH2F, {axisPtV0s, axisdEdx}); registry.add("dEdxVsEtaPiMIP", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; dE/dx;", kTH2F, {{{axisEta}, {100, 0, 100}}}); registry.add("dEdxVsEtaPiMIPp", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; #LTdE/dx#GT", kTProfile, {axisEta}); registry.add("dEdxVsEtaElMIP", "MIP e^{+} + e^{-} (0.3 < #it{p} < 0.4 GeV/#it{c});#eta; dE/dx;", kTH2F, {{{axisEta}, {100, 0, 100}}}); @@ -346,6 +350,8 @@ struct PiKpRAA { registry.add("dEdxVsEtaElMIPV0p", "e^{+} + e^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; #LTdE/dx#GT", kTProfile, {axisEta}); for (int i = 0; i < kNEtaHists; ++i) { + dEdx[i] = registry.add(Form("dEdx_%s", endingEta[i]), Form("%s;Momentum (GeV/#it{c});dE/dx;", latexEta[i]), kTH3F, {axisPt, axisdEdx, axisCent}); + pTVsP[i] = registry.add(Form("pTVsP_%s", endingEta[i]), Form("%s;Momentum (GeV/#it{c});#it{p}_{T} (GeV/#it{c});", latexEta[i]), kTH2F, {axisPt, axisPt}); dEdxPiV0[i] = registry.add(Form("dEdxPiV0_%s", endingEta[i]), Form("#pi^{+} + #pi^{-}, %s;Momentum (GeV/#it{c});dE/dx;", latexEta[i]), kTH3F, {axisPtV0s, axisdEdx, axisCent}); dEdxPrV0[i] = registry.add(Form("dEdxPrV0_%s", endingEta[i]), Form("p + #bar{p}, %s;Momentum (GeV/#it{c});dE/dx;", latexEta[i]), kTH3F, {axisPtV0s, axisdEdx, axisCent}); dEdxElV0[i] = registry.add(Form("dEdxElV0_%s", endingEta[i]), Form("e^{+} + e^{-}, %s;Momentum (GeV/#it{c});dE/dx;", latexEta[i]), kTH3F, {axisPtV0s, axisdEdx, axisCent}); @@ -358,6 +364,8 @@ struct PiKpRAA { LOG(info) << "\tdetector4Calibration=" << detector4Calibration.value; LOG(info) << "\tminPt=" << v0Selections.minPt; LOG(info) << "\tmaxPt=" << v0Selections.maxPt; + LOG(info) << "\tqTSel=" << v0Selections.qTSel; + LOG(info) << "\tarmAlphaSel=" << v0Selections.armAlphaSel; LOG(info) << "\tapplyTPCTOFCombinedCut=" << v0Selections.applyTPCTOFCombinedCut; LOG(info) << "\tapplyInvMassSel=" << v0Selections.applyInvMassSel; LOG(info) << "\tapplyNclSel=" << v0Selections.applyNclSel; @@ -515,6 +523,14 @@ struct PiKpRAA { continue; } + int indexEta{0}; + for (int i = 1; i < kNEtaHists; ++i) { + if (std::abs(eta) >= kLowEta[i] && std::abs(eta) < kHighEta[i]) { + indexEta = i; + break; + } + } + if (momentum > kMinPMIP && momentum < kMaxPMIP && dedx > kMindEdxMIP && dedx < kMaxdEdxMIP) { registry.fill(HIST("dEdxVsEtaPiMIP"), eta, dedx); registry.fill(HIST("dEdxVsEtaPiMIPp"), eta, dedx); @@ -527,22 +543,17 @@ struct PiKpRAA { registry.fill(HIST("dEdxVsEtaElMIPp"), eta, dedx); } - registry.fill(HIST("dEdxVsMomentum"), momentum, dedx); + dEdx[indexEta]->Fill(momentum, dedx, centrality); + pTVsP[indexEta]->Fill(momentum, pt); + registry.fill(HIST("dcaVsPt"), pt, track.dcaXY()); registry.fill(HIST("NclVsEta"), eta, track.tpcNClsFound()); + registry.fill(HIST("NclVsEtap"), eta, track.tpcNClsFound()); registry.fill(HIST("NclFound"), pOrPt, track.tpcNClsFound()); registry.fill(HIST("NclFoundp"), pOrPt, track.tpcNClsFound()); registry.fill(HIST("NclFindable"), pOrPt, track.tpcNClsFindable()); registry.fill(HIST("NclFindablep"), pOrPt, track.tpcNClsFindable()); registry.fill(HIST("NclFoundVsPhipAfterCut"), pOrPt, phiPrime, track.tpcNClsFound()); - int indexEta{0}; - for (int i = 1; i < kNEtaHists; ++i) { - if (std::abs(eta) >= kLowEta[i] && std::abs(eta) < kHighEta[i]) { - indexEta = i; - break; - } - } - if (track.hasTOF() && track.goodTOFMatch()) { const float tTOF{track.tofSignal()}; const float trkLength{track.length()}; @@ -631,19 +642,16 @@ struct PiKpRAA { getArmeterosVariables(ppos, pneg, alpha, qT); registry.fill(HIST("ArmAll"), alpha, qT); + bool passesTopoSel{false}; // Passes V0 topological cuts? - if (!passesV0TopologicalSelection(v0)) - continue; + if (passesV0TopologicalSelection(v0)) + passesTopoSel = true; const double dMassK0s{std::abs(v0.mK0Short() - o2::constants::physics::MassK0Short)}; const double dMassL{std::abs(v0.mLambda() - o2::constants::physics::MassLambda0)}; const double dMassAL{std::abs(v0.mAntiLambda() - o2::constants::physics::MassLambda0)}; const double dMassG{std::abs(v0.mGamma() - o2::constants::physics::MassGamma)}; - registry.fill(HIST("ArmAfterTopoSel"), alpha, qT); - registry.fill(HIST("dcaDauVsPt"), v0.pt(), v0.dcapostopv()); - registry.fill(HIST("dcaDauVsPt"), v0.pt(), v0.dcanegtopv()); - int posIndexEta{0}; int negIndexEta{0}; for (int i = 1; i < kNEtaHists; ++i) { @@ -660,81 +668,87 @@ struct PiKpRAA { } } - if (v0Selections.applyInvMassSel) { // apply Inv. Mass selection? - if (dMassK0s < v0Selections.dMassSel && dMassL > v0Selections.dMassSel && dMassAL > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG) { // Mass cut - if (passesK0Selection(collision, v0)) { // nSigma TPC and y cuts - registry.fill(HIST("ArmK0NOSel"), alpha, qT); - if (v0Selections.armPodCut * qT > std::abs(alpha)) { // Armenters selection - registry.fill(HIST("ArmK0"), alpha, qT); - registry.fill(HIST("MassK0sVsPt"), v0.pt(), v0.mK0Short()); - registry.fill(HIST("nSigPiFromK0s"), posTrkPt, posTrack.tpcNSigmaPi()); - registry.fill(HIST("nSigPiFromK0s"), negTrkPt, negTrack.tpcNSigmaPi()); - registry.fill(HIST("NclVsEtaPiV0"), posTrkEta, posTrack.tpcNClsFound()); - registry.fill(HIST("NclVsEtaPiV0p"), posTrkEta, posTrack.tpcNClsFound()); + if (passesTopoSel) { + registry.fill(HIST("ArmAfterTopoSel"), alpha, qT); + registry.fill(HIST("dcaDauVsPt"), v0.pt(), v0.dcapostopv()); + registry.fill(HIST("dcaDauVsPt"), v0.pt(), v0.dcanegtopv()); + + if (v0Selections.applyInvMassSel) { // apply Inv. Mass selection? + if (dMassK0s < v0Selections.dMassSel && dMassL > v0Selections.dMassSel && dMassAL > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG) { // Mass cut + if (passesK0Selection(collision, v0)) { // nSigma TPC and y cuts + registry.fill(HIST("ArmK0NOSel"), alpha, qT); + if (v0Selections.armPodCut * qT > std::abs(alpha)) { // Armenters selection + registry.fill(HIST("ArmK0"), alpha, qT); + registry.fill(HIST("MassK0sVsPt"), v0.pt(), v0.mK0Short()); + registry.fill(HIST("nSigPiFromK0s"), posTrkPt, posTrack.tpcNSigmaPi()); + registry.fill(HIST("nSigPiFromK0s"), negTrkPt, negTrack.tpcNSigmaPi()); + registry.fill(HIST("NclVsEtaPiV0"), posTrkEta, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPiV0p"), posTrkEta, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPiV0"), negTrkEta, negTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPiV0p"), negTrkEta, negTrack.tpcNClsFound()); + registry.fill(HIST("NclPiV0"), posPorPt, posTrack.tpcNClsFound()); + registry.fill(HIST("NclPiV0p"), posPorPt, posTrack.tpcNClsFound()); + registry.fill(HIST("NclPiV0"), negPorPt, negTrack.tpcNClsFound()); + registry.fill(HIST("NclPiV0p"), negPorPt, negTrack.tpcNClsFound()); + + dEdxPiV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); + dEdxPiV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); + + if (posTrkP > kMinPMIP && posTrkP < kMaxPMIP && posTrkdEdx > kMindEdxMIP && posTrkdEdx < kMaxdEdxMIP) { + registry.fill(HIST("dEdxVsEtaPiMIPV0"), posTrkEta, posTrkdEdx); + registry.fill(HIST("dEdxVsEtaPiMIPV0p"), posTrkEta, posTrkdEdx); + } + if (negTrkP > kMinPMIP && negTrkP < kMaxPMIP && negTrkdEdx > kMindEdxMIP && negTrkdEdx < kMaxdEdxMIP) { + registry.fill(HIST("dEdxVsEtaPiMIPV0"), negTrkEta, negTrkdEdx); + registry.fill(HIST("dEdxVsEtaPiMIPV0p"), negTrkEta, negTrkdEdx); + } + } + } + } + } + + if (v0Selections.applyInvMassSel) { + if (dMassL < v0Selections.dMassSel && dMassK0s > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG) { + if (passesLambdaSelection(collision, v0)) { + registry.fill(HIST("ArmL"), alpha, qT); + registry.fill(HIST("MassLVsPt"), v0.pt(), v0.mLambda()); + registry.fill(HIST("nSigPrFromL"), posTrkPt, posTrack.tpcNSigmaPr()); + registry.fill(HIST("nSigPiFromL"), negTrkPt, negTrack.tpcNSigmaPi()); + registry.fill(HIST("NclVsEtaPrV0"), posTrkEta, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPrV0p"), posTrkEta, posTrack.tpcNClsFound()); registry.fill(HIST("NclVsEtaPiV0"), negTrkEta, negTrack.tpcNClsFound()); registry.fill(HIST("NclVsEtaPiV0p"), negTrkEta, negTrack.tpcNClsFound()); - registry.fill(HIST("NclPiV0"), posPorPt, posTrack.tpcNClsFound()); - registry.fill(HIST("NclPiV0p"), posPorPt, posTrack.tpcNClsFound()); + registry.fill(HIST("NclPrV0"), posPorPt, posTrack.tpcNClsFound()); + registry.fill(HIST("NclPrV0p"), posPorPt, posTrack.tpcNClsFound()); registry.fill(HIST("NclPiV0"), negPorPt, negTrack.tpcNClsFound()); registry.fill(HIST("NclPiV0p"), negPorPt, negTrack.tpcNClsFound()); - - dEdxPiV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); + dEdxPrV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); dEdxPiV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); - - if (posTrkP > kMinPMIP && posTrkP < kMaxPMIP && posTrkdEdx > kMindEdxMIP && posTrkdEdx < kMaxdEdxMIP) { - registry.fill(HIST("dEdxVsEtaPiMIPV0"), posTrkEta, posTrkdEdx); - registry.fill(HIST("dEdxVsEtaPiMIPV0p"), posTrkEta, posTrkdEdx); - } - if (negTrkP > kMinPMIP && negTrkP < kMaxPMIP && negTrkdEdx > kMindEdxMIP && negTrkdEdx < kMaxdEdxMIP) { - registry.fill(HIST("dEdxVsEtaPiMIPV0"), negTrkEta, negTrkdEdx); - registry.fill(HIST("dEdxVsEtaPiMIPV0p"), negTrkEta, negTrkdEdx); - } } } } - } - if (v0Selections.applyInvMassSel) { - if (dMassL < v0Selections.dMassSel && dMassK0s > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG) { - if (passesLambdaSelection(collision, v0)) { - registry.fill(HIST("ArmL"), alpha, qT); - registry.fill(HIST("MassLVsPt"), v0.pt(), v0.mLambda()); - registry.fill(HIST("nSigPrFromL"), posTrkPt, posTrack.tpcNSigmaPr()); - registry.fill(HIST("nSigPiFromL"), negTrkPt, negTrack.tpcNSigmaPi()); - registry.fill(HIST("NclVsEtaPrV0"), posTrkEta, posTrack.tpcNClsFound()); - registry.fill(HIST("NclVsEtaPrV0p"), posTrkEta, posTrack.tpcNClsFound()); - registry.fill(HIST("NclVsEtaPiV0"), negTrkEta, negTrack.tpcNClsFound()); - registry.fill(HIST("NclVsEtaPiV0p"), negTrkEta, negTrack.tpcNClsFound()); - registry.fill(HIST("NclPrV0"), posPorPt, posTrack.tpcNClsFound()); - registry.fill(HIST("NclPrV0p"), posPorPt, posTrack.tpcNClsFound()); - registry.fill(HIST("NclPiV0"), negPorPt, negTrack.tpcNClsFound()); - registry.fill(HIST("NclPiV0p"), negPorPt, negTrack.tpcNClsFound()); - dEdxPrV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); - dEdxPiV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); + if (v0Selections.applyInvMassSel && dMassAL < v0Selections.dMassSel && dMassK0s > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG) { + if (passesAntiLambdaSelection(collision, v0)) { + registry.fill(HIST("ArmAL"), alpha, qT); + registry.fill(HIST("MassALVsPt"), v0.pt(), v0.mAntiLambda()); + registry.fill(HIST("nSigPrFromAL"), negTrkPt, negTrack.tpcNSigmaPr()); + registry.fill(HIST("nSigPiFromAL"), posTrkPt, posTrack.tpcNSigmaPi()); + registry.fill(HIST("NclVsEtaPiV0"), posTrkEta, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPiV0p"), posTrkEta, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPrV0"), negTrkEta, negTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPrV0p"), negTrkEta, negTrack.tpcNClsFound()); + registry.fill(HIST("NclPiV0"), posPorPt, posTrack.tpcNClsFound()); + registry.fill(HIST("NclPiV0p"), posPorPt, posTrack.tpcNClsFound()); + registry.fill(HIST("NclPrV0"), negPorPt, negTrack.tpcNClsFound()); + registry.fill(HIST("NclPrV0p"), negPorPt, negTrack.tpcNClsFound()); + dEdxPrV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); + dEdxPiV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); } } } - if (v0Selections.applyInvMassSel && dMassAL < v0Selections.dMassSel && dMassK0s > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG) { - if (passesAntiLambdaSelection(collision, v0)) { - registry.fill(HIST("ArmAL"), alpha, qT); - registry.fill(HIST("MassALVsPt"), v0.pt(), v0.mAntiLambda()); - registry.fill(HIST("nSigPrFromAL"), negTrkPt, negTrack.tpcNSigmaPr()); - registry.fill(HIST("nSigPiFromAL"), posTrkPt, posTrack.tpcNSigmaPi()); - registry.fill(HIST("NclVsEtaPiV0"), posTrkEta, posTrack.tpcNClsFound()); - registry.fill(HIST("NclVsEtaPiV0p"), posTrkEta, posTrack.tpcNClsFound()); - registry.fill(HIST("NclVsEtaPrV0"), negTrkEta, negTrack.tpcNClsFound()); - registry.fill(HIST("NclVsEtaPrV0p"), negTrkEta, negTrack.tpcNClsFound()); - registry.fill(HIST("NclPiV0"), posPorPt, posTrack.tpcNClsFound()); - registry.fill(HIST("NclPiV0p"), posPorPt, posTrack.tpcNClsFound()); - registry.fill(HIST("NclPrV0"), negPorPt, negTrack.tpcNClsFound()); - registry.fill(HIST("NclPrV0p"), negPorPt, negTrack.tpcNClsFound()); - dEdxPrV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); - dEdxPiV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); - } - } - - if (v0Selections.applyInvMassSel && dMassK0s > v0Selections.dMassSel && dMassL > v0Selections.dMassSel && dMassAL > v0Selections.dMassSel && dMassG < v0Selections.dMassSel) { + if (v0Selections.applyInvMassSel && dMassK0s > v0Selections.dMassSel && dMassL > v0Selections.dMassSel && dMassAL > v0Selections.dMassSel && dMassG < v0Selections.dMassGcut) { if (passesGammaSelection(collision, v0)) { if (std::abs(alpha) < v0Selections.armAlphaSel && qT < v0Selections.qTSel) { registry.fill(HIST("ArmG"), alpha, qT); From 35b03e6af4b8dea54e3f08c5d63d5c65cdb8c828 Mon Sep 17 00:00:00 2001 From: Lorenzo Bernardinis <95907752+lorber98@users.noreply.github.com> Date: Wed, 3 Sep 2025 17:13:36 +0200 Subject: [PATCH 289/986] [PWGJE,PWGLF] New task to prepare training data to tag s-jets (#12599) --- PWGJE/Core/JetTaggingUtilities.h | 43 +- PWGLF/Tasks/Strangeness/CMakeLists.txt | 5 + PWGLF/Tasks/Strangeness/sjetTreeCreator.cxx | 514 ++++++++++++++++++++ 3 files changed, 561 insertions(+), 1 deletion(-) create mode 100644 PWGLF/Tasks/Strangeness/sjetTreeCreator.cxx diff --git a/PWGJE/Core/JetTaggingUtilities.h b/PWGJE/Core/JetTaggingUtilities.h index 849580fb1c8..81141b036f4 100644 --- a/PWGJE/Core/JetTaggingUtilities.h +++ b/PWGJE/Core/JetTaggingUtilities.h @@ -50,7 +50,9 @@ enum JetTaggingSpecies { beauty = 2, lightflavour = 3, lightquark = 4, - gluon = 5 + gluon = 5, + udg = 6, + strange = 7, }; enum BJetTaggingMethod { @@ -413,6 +415,45 @@ int16_t getJetFlavor(AnyJet const& jet, AllMCParticles const& mcparticles) return JetTaggingSpecies::lightflavour; // Light flavor jet } +/** + * return also the s-jet flavor: 1 for c-jet, 2 for b-jet, 7 for s-jet + * 6 for u,d or g jets. + * + * @param AnyJet the jet that we need to study its flavor + * @param AllMCParticles a vector of all the mc particles stack + */ +template +int16_t getSJetFlavor(AnyJet const& jet, AllMCParticles const& mcparticles) +{ + bool charmQuark = false; + bool strangeQuark = false; + + for (auto const& mcpart : mcparticles) { + int pdgcode = mcpart.pdgCode(); + if (std::abs(pdgcode) == 21 || (std::abs(pdgcode) >= 1 && std::abs(pdgcode) <= 5)) { + double dR = jetutilities::deltaR(jet, mcpart); + + if (dR < jet.r() / 100.f) { + if (std::abs(pdgcode) == 5) { + return JetTaggingSpecies::beauty; // Beauty jet + } else if (std::abs(pdgcode) == 4) { + charmQuark = true; + } else if (std::abs(pdgcode) == 3) { + strangeQuark = true; + } + } + } + } + + if (charmQuark) { + return JetTaggingSpecies::charm; // Charm jet + } else if (strangeQuark) { + return JetTaggingSpecies::strange; // Strange jet + } + + return JetTaggingSpecies::udg; // Up, Down or Gluon jet +} + /** * return the jet flavor if it finds a HF hadron inside the jet: 0 for lf-jet, 1 for c-jet, 2 for b-jet * diff --git a/PWGLF/Tasks/Strangeness/CMakeLists.txt b/PWGLF/Tasks/Strangeness/CMakeLists.txt index db4a211e4fa..a3cf8efabc5 100644 --- a/PWGLF/Tasks/Strangeness/CMakeLists.txt +++ b/PWGLF/Tasks/Strangeness/CMakeLists.txt @@ -109,6 +109,11 @@ o2physics_add_dpl_workflow(strangeness-in-jets SOURCES strangenessInJets.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::PWGJECore FastJet::FastJet FastJet::Contrib O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(sjet-tree-creator + SOURCES sjetTreeCreator.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::PWGJECore FastJet::FastJet FastJet::Contrib + COMPONENT_NAME Analysis) endif() o2physics_add_dpl_workflow(v0topologicalcuts diff --git a/PWGLF/Tasks/Strangeness/sjetTreeCreator.cxx b/PWGLF/Tasks/Strangeness/sjetTreeCreator.cxx new file mode 100644 index 00000000000..08bb83a3c89 --- /dev/null +++ b/PWGLF/Tasks/Strangeness/sjetTreeCreator.cxx @@ -0,0 +1,514 @@ +// 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 sjetTreeCreator.cxx +/// \brief Task for building a TTree with information about the jet, its consistuents, +/// to be used as input for machine learning s-jet identification. +/// \author Lorenzo Bernardinis (lorenzo.bernardinis@cern.ch) +/// +/// Inspired by PWGJE/Tasks/bjetTreeCreator.cxx + +#include "PWGJE/Core/JetDerivedDataUtilities.h" +#include "PWGJE/Core/JetTaggingUtilities.h" +#include "PWGJE/Core/JetUtilities.h" +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/DataModel/JetReducedData.h" +#include "PWGJE/DataModel/JetTagging.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "Framework/ASoA.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +namespace o2::aod +{ +namespace jet_info +{ +// DECLARE_SOA_INDEX_COLUMN(JetIndex, jetindex); //! The jet index +DECLARE_SOA_COLUMN(JetpT, jetpT, float); //! jet pT +DECLARE_SOA_COLUMN(JetEta, jetEta, float); //! jet eta +DECLARE_SOA_COLUMN(JetPhi, jetPhi, float); //! jet phi +DECLARE_SOA_COLUMN(NTracks, nTracks, int16_t); //! number of charged tracks inside the jet +DECLARE_SOA_COLUMN(NSV, nSV, int16_t); //! Number of secondary vertices in the jet +DECLARE_SOA_COLUMN(JetMass, jetMass, float); //! The jet mass +DECLARE_SOA_COLUMN(JetFlavor, jetFlavor, int16_t); //! The jet flavor (b, c, s or udg) +DECLARE_SOA_COLUMN(JetR, jetR, int16_t); //! The jet radius +} // namespace jet_info + +DECLARE_SOA_TABLE(sjetParams, "AOD", "SJETPARAM", + o2::soa::Index<>, + jet_info::JetpT, + jet_info::JetEta, + jet_info::JetPhi, + jet_info::NTracks, + jet_info::JetMass, + jet_info::JetFlavor, + jet_info::JetR); + +using sjetParam = sjetParams::iterator; + +namespace track_info +{ +DECLARE_SOA_INDEX_COLUMN(sjetParam, jetindex); //! The jet index +DECLARE_SOA_COLUMN(TrackpT, trackpT, float); //! The track pT +DECLARE_SOA_COLUMN(TrackEta, trackEta, float); //! The track eta +DECLARE_SOA_COLUMN(DotProdTrackJet, dotProdTrackJet, float); //! The dot product between the track and the jet +DECLARE_SOA_COLUMN(DotProdTrackJetOverJet, dotProdTrackJetOverJet, float); //! The dot product between the track and the jet over the jet momentum +DECLARE_SOA_COLUMN(DeltaRJetTrack, deltaRJetTrack, float); //! The DR jet-track +DECLARE_SOA_COLUMN(SignedIP2D, signedIP2D, float); //! The track signed 2D IP +DECLARE_SOA_COLUMN(SignedIP2DSign, signedIP2DSign, float); //! The track signed 2D IP significance +DECLARE_SOA_COLUMN(SignedIPz, signedIPz, float); //! The track signed z IP +DECLARE_SOA_COLUMN(SignedIPzSign, signedIPzSign, float); //! The track signed z IP significance +DECLARE_SOA_COLUMN(SignedIP3DSign, signedIP3DSign, float); //! The track signed 3D IP significance +DECLARE_SOA_COLUMN(MomFraction, momFraction, float); //! The track momentum fraction of the jets +DECLARE_SOA_COLUMN(DeltaRTrackVertex, deltaRTrackVertex, float); //! DR between the track and the closest SV, to be decided whether to add to or not +DECLARE_SOA_COLUMN(TrackPhi, trackPhi, float); //! The track phi +DECLARE_SOA_COLUMN(TrackCharge, trackCharge, float); //! The track sign (charge) +DECLARE_SOA_COLUMN(TrackITSChi2NCl, trackITSChi2NCl, float); //! The track ITS Chi2NCl +DECLARE_SOA_COLUMN(TrackTPCChi2NCl, trackTPCChi2NCl, float); //! The track TPC Chi2NCl +DECLARE_SOA_COLUMN(TrackITSNCls, trackITSNCls, float); //! The track ITS NCls +DECLARE_SOA_COLUMN(TrackTPCNCls, trackTPCNCls, float); //! The track TPC NCls (Found) +DECLARE_SOA_COLUMN(TrackTPCNCrossedRows, trackTPCNCrossedRows, float); //! The track TPC NCrossedRows +DECLARE_SOA_COLUMN(TrackOrigin, trackOrigin, int); //! The track origin label for GNN track origin predictions +DECLARE_SOA_COLUMN(TrackVtxIndex, trackVtxIndex, int); //! The track vertex index for GNN vertex predictions +// DECLARE_SOA_COLUMN(DCATrackJet, dcaTrackJet, float); //! The distance between track and jet, unfortunately it cannot be calculated in O2 +} // namespace track_info + +DECLARE_SOA_TABLE(sjetTracksParams, "AOD", "SJETTRACKSPARAM", + o2::soa::Index<>, + track_info::sjetParamId, + track_info::TrackpT, + track_info::TrackEta, + track_info::DotProdTrackJet, + track_info::DotProdTrackJetOverJet, + track_info::DeltaRJetTrack, + track_info::SignedIP2D, + track_info::SignedIP2DSign, + track_info::SignedIPz, + track_info::SignedIPzSign, + track_info::SignedIP3DSign, + track_info::MomFraction, + track_info::DeltaRTrackVertex); + +using sjetTracksParam = sjetTracksParams::iterator; + +DECLARE_SOA_TABLE(sjetTracksParamsExtra, "AOD", "SJETTRACKSEXTRA", + // o2::soa::Index<>, + track_info::TrackPhi, + track_info::TrackCharge, + track_info::TrackITSChi2NCl, + track_info::TrackTPCChi2NCl, + track_info::TrackITSNCls, + track_info::TrackTPCNCls, + track_info::TrackTPCNCrossedRows); + +using sjetTracksParamExtra = sjetTracksParamsExtra::iterator; + +namespace constituents +{ +DECLARE_SOA_INDEX_COLUMN(sjetParam, jetindex); +DECLARE_SOA_ARRAY_INDEX_COLUMN(sjetTracksParam, tracks); +} // namespace constituents + +DECLARE_SOA_TABLE(sjetConstituents, "AOD", "SJETCONSTIT", + constituents::sjetParamId, + constituents::sjetTracksParamIds); + +} // namespace o2::aod + +struct SjetTreeCreator { + + Produces sjetParamsTable; + Produces sjetTracksParamsTable; + Produces sjetTracksExtraTable; + Produces sjetConstituentsTable; + + HistogramRegistry registry; + + // event level configurables + Configurable vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"}; + Configurable eventSelections{"eventSelections", "sel8", "choose event selection"}; + + Configurable> jetPtBins{"jetPtBins", std::vector{5, 1000}, "jet pT bins for reduction"}; + Configurable> jetReductionFactors{"jetReductionFactors", std::vector{0.0}, "jet reduction factors"}; + + Configurable pTHatMaxMCD{"pTHatMaxMCD", 999.0, "maximum fraction of hard scattering for jet acceptance in detector MC"}; + Configurable pTHatMaxMCP{"pTHatMaxMCP", 999.0, "maximum fraction of hard scattering for jet acceptance in particle MC"}; + Configurable pTHatExponent{"pTHatExponent", 6.0, "exponent of the event weight for the calculation of pTHat"}; + + // track level configurables + Configurable trackPtMin{"trackPtMin", 0.5, "minimum track pT"}; + Configurable trackPtMax{"trackPtMax", 1000.0, "maximum track pT"}; + Configurable trackEtaMin{"trackEtaMin", -0.9, "minimum track eta"}; + Configurable trackEtaMax{"trackEtaMax", 0.9, "maximum track eta"}; + + Configurable maxIPxy{"maxIPxy", 10, "maximum track DCA in xy plane"}; + Configurable maxIPz{"maxIPz", 10, "maximum track DCA in z direction"}; + + // jet level configurables + Configurable jetPtMin{"jetPtMin", 5.0, "minimum jet pT"}; + Configurable jetPtMax{"jetPtMax", 1000.0, "maximum jet pT"}; + Configurable jetEtaMin{"jetEtaMin", -99.0, "minimum jet pseudorapidity"}; + Configurable jetEtaMax{"jetEtaMax", 99.0, "maximum jet pseudorapidity"}; + + Configurable eventReductionFactor{"eventReductionFactor", 0.0, "Percentage of events to be removed"}; + + Configurable> jetRadii{"jetRadii", std::vector{0.4}, "jet resolution parameters"}; + + Configurable produceTree{"produceTree", true, "produce the jet TTree"}; + + Configurable vtxRes{"vtxRes", 0.01, "Vertex position resolution (cluster size) for GNN vertex predictions (cm)"}; + + std::vector eventSelectionBits; + + std::vector jetRadiiValues; + std::vector jetPtBinsReduction; + std::vector jetReductionFactorsPt; + + void init(InitContext const&) + { + // Seed the random number generator using current time + std::srand(static_cast(std::time(nullptr))); + + jetRadiiValues = (std::vector)jetRadii; + jetPtBinsReduction = (std::vector)jetPtBins; + jetReductionFactorsPt = (std::vector)jetReductionFactors; + + eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(static_cast(eventSelections)); + + registry.add("h_vertexZ", "Vertex Z;#it{Z} (cm)", {HistType::kTH1F, {{40, -20.0, 20.0}}}); + + registry.add("h2_nTracks_jetpT", "Number of tracks;#it{p}_{T,jet} (GeV/#it{c});nTracks", {HistType::kTH2F, {{200, 0., 200.}, {100, 0, 100.0}}}); + + registry.add("h2_SIPs2D_jetpT", "2D IP significance;#it{p}_{T,jet} (GeV/#it{c});IPs", {HistType::kTH2F, {{200, 0., 200.}, {100, -50.0, 50.0}}}); + registry.add("h2_SIPs3D_jetpT", "3D IP significance;#it{p}_{T,jet} (GeV/#it{c});IPs", {HistType::kTH2F, {{200, 0., 200.}, {100, -50.0, 50.0}}}); + registry.add("h2_jetMass_jetpT", "Jet mass;#it{p}_{T,jet} (GeV/#it{c});#it{m}_{jet} (GeV/#it{c}^{2})", {HistType::kTH2F, {{200, 0., 200.}, {50, 0, 50.0}}}); + + if (doprocessMCJets) { + registry.add("h2_SIPs2D_jetpT_hfjet", "2D IP significance hf-jets;#it{p}_{T,jet} (GeV/#it{c});IPs", {HistType::kTH2F, {{200, 0., 200.}, {100, -50.0, 50.0}}}); + registry.add("h2_SIPs3D_jetpT_hfjet", "3D IP significance hf-jets;#it{p}_{T,jet} (GeV/#it{c});IPs", {HistType::kTH2F, {{200, 0., 200.}, {100, -50.0, 50.0}}}); + registry.add("h2_jetMass_jetpT_hfjet", "Jet mass hf-jets;#it{p}_{T,jet} (GeV/#it{c});#it{m}_{jet} (GeV/#it{c}^{2})", {HistType::kTH2F, {{200, 0., 200.}, {50, 0, 50.0}}}); + registry.add("h_jetpT_detector_hfjet", "Jet transverse momentum hf-jets;#it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH1F, {{200, 0., 200.0}}}); + + registry.add("h2_SIPs2D_jetpT_sjet", "2D IP significance s-jets;#it{p}_{T,jet} (GeV/#it{c});IPs", {HistType::kTH2F, {{200, 0., 200.}, {100, -50.0, 50.0}}}); + registry.add("h2_SIPs3D_jetpT_sjet", "3D IP significance s-jets;#it{p}_{T,jet} (GeV/#it{c});IPs", {HistType::kTH2F, {{200, 0., 200.}, {100, -50.0, 50.0}}}); + registry.add("h2_jetMass_jetpT_sjet", "Jet mass s-jets;#it{p}_{T,jet} (GeV/#it{c});#it{m}_{jet} (GeV/#it{c}^{2})", {HistType::kTH2F, {{200, 0., 200.}, {50, 0, 50.0}}}); + registry.add("h_jetpT_detector_sjet", "Jet transverse momentum s-jets;#it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH1F, {{200, 0., 200.0}}}); + + registry.add("h2_SIPs2D_jetpT_udgjet", "2D IP significance udg-jets;#it{p}_{T,jet} (GeV/#it{c});IPs", {HistType::kTH2F, {{200, 0., 200.}, {100, -50.0, 50.0}}}); + registry.add("h2_SIPs3D_jetpT_udgjet", "3D IP significance udg-jets;#it{p}_{T,jet} (GeV/#it{c});IPs", {HistType::kTH2F, {{200, 0., 200.}, {100, -50.0, 50.0}}}); + registry.add("h2_jetMass_jetpT_udgjet", "Jet mass udg-jets;#it{p}_{T,jet} (GeV/#it{c});#it{m}_{jet} (GeV/#it{c}^{2})", {HistType::kTH2F, {{200, 0., 200.}, {50, 0, 50.0}}}); + registry.add("h_jetpT_detector_udgjet", "Jet transverse momentum udg-jets;#it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH1F, {{200, 0., 200.0}}}); + + // Jet information + registry.add("h_jet_pt", "jet_pt;#it{p}_{T}^{ch jet} (GeV/#it{c});Entries", {HistType::kTH1F, {{200, 0., 200.}}}); + registry.add("h_jet_eta", "jet_eta;#it{#eta}_{ch jet};Entries", {HistType::kTH1F, {{200, -2., 2.}}}); + registry.add("h_jet_phi", "jet_phi;#it{#phi}_{ch jet};Entries", {HistType::kTH1F, {{200, 0., o2::constants::math::TwoPI}}}); + registry.add("h_n_trks", "n_trks;#it{n}_{tracks};Entries", {HistType::kTH1F, {{50, 0., 50.}}}); + registry.add("h_jet_mass", "jet_mass;#it{m}_{jet} (GeV/#it{c}^2);Entries", {HistType::kTH1F, {{200, 0., 50.}}}); + + registry.add("h_jet_flav", "jet_flav;jet flavor;Entries", {HistType::kTH1F, {{4, -0.5, 3.5}}}); + auto hJetFlavor = registry.get(HIST("h_jet_flav")); + hJetFlavor->GetXaxis()->SetBinLabel(1, "no mcparticle"); // bin 1 + hJetFlavor->GetXaxis()->SetBinLabel(2, "hf-jet"); // bin 2 --> flavour number 1+2 + hJetFlavor->GetXaxis()->SetBinLabel(3, "s-jet"); // bin 3 --> flavour number 7 + hJetFlavor->GetXaxis()->SetBinLabel(4, "udg-jet"); // bin 4 --> flavour number 6 + + // Track information + registry.add("h_trk_pt", "trk_pt;#it{p}_{T} (GeV/#it{c});Entries", {HistType::kTH1F, {{200, 0., 100.}}}); + registry.add("h_trk_eta", "trk_eta;#it{#eta};Entries", {HistType::kTH1F, {{200, -2., 2.}}}); + registry.add("h_trk_phi", "trk_phi;#it{#phi};Entries", {HistType::kTH1F, {{200, 0., o2::constants::math::TwoPI}}}); + registry.add("h_trk_charge", "trk_charge;#it{q};Entries", {HistType::kTH1F, {{3, -1.5, 1.5}}}); + registry.add("h_trk_dcaxy", "trk_dcaxy;#it{DCA}_{xy} (cm);Entries", {HistType::kTH1F, {{200, -0.1, 0.1}}}); + registry.add("h_trk_dcaxyz", "trk_dcaxyz;#it{DCA}_{xyz} (cm);Entries", {HistType::kTH1F, {{200, -0.1, 0.1}}}); + registry.add("h_trk_sigmadcaxy", "trk_sigmadcaxy;#it{#sigma}_{#it{DCA}_{xy}} (cm);Entries", {HistType::kTH1F, {{200, 0., 0.1}}}); + registry.add("h_trk_sigmadcaxyz", "trk_sigmadcaxyz;#it{#sigma}_{#it{DCA}_{xyz}} (cm);Entries", {HistType::kTH1F, {{200, 0., 0.1}}}); + registry.add("h_trk_itsncls", "trk_itsncls;ITS NCls;Entries", {HistType::kTH1F, {{10, 0., 10.}}}); + registry.add("h_trk_tpcncls", "trk_tpcncls;TPC NCls (Found);Entries", {HistType::kTH1F, {{200, 0., 200.}}}); + registry.add("h_trk_tpcncrs", "trk_tpcncrs;TPC NCrossedRows;Entries", {HistType::kTH1F, {{200, 0., 200.}}}); + registry.add("h_trk_itschi2ncl", "trk_itschi2ncl;ITS #it{#chi}^{2}/ndf;Entries", {HistType::kTH1F, {{200, 0., 20.}}}); + registry.add("h_trk_tpcchi2ncl", "trk_tpcchi2ncl;TPC #it{#chi}^{2}/ndf;Entries", {HistType::kTH1F, {{200, 0., 10.}}}); + registry.add("h2_trk_jtrackpt_vs_origtrackpt", "JTracks::pt vs Tracks::pt", {HistType::kTH2F, {{200, 0., 100.}, {200, 0., 100.}}}); + } + } + + // FIXME filtering only works when you loop directly over the list, but if you loop over it as a constituent they will not be filtered + Filter collisionFilter = nabs(aod::jcollision::posZ) < vertexZCut; + Filter trackCuts = (aod::jtrack::pt > trackPtMin && aod::jtrack::pt < trackPtMax && + aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax); + Filter partCuts = (aod::jmcparticle::pt >= trackPtMin && aod::jmcparticle::pt < trackPtMax); + Filter jetFilter = (aod::jet::pt >= jetPtMin && aod::jet::pt <= jetPtMax && + aod::jet::eta < jetEtaMax - aod::jet::r / 100.f && aod::jet::eta > jetEtaMin + aod::jet::r / 100.f); + + using FilteredCollision = soa::Filtered>; + using JetTrackswID = soa::Filtered>; + using JetTracksMCDwID = soa::Filtered>; + using DataJets = soa::Filtered>; + + using OriginalTracks = soa::Join; + + // Function to get the reduction factor based on jet pT + double getReductionFactor(double jetPT) + { + // Loop through the jetPtBins vector + for (size_t ibin = 0; ibin < jetPtBinsReduction.size() - 1; ++ibin) { + if (jetPT >= jetPtBinsReduction[ibin] && jetPT < jetPtBinsReduction[ibin + 1]) { + return jetReductionFactorsPt[ibin]; + } + } + + // If jetPT is above the last bin, use the last reduction factor + if (jetPT >= jetPtBinsReduction.back()) { + return jetReductionFactorsPt.back(); + } + + // If jetPT is below the first bin, return the first reduction factor + return jetReductionFactorsPt.front(); + } + + template + void analyzeJetTrackInfo(AnyCollision const& /*collision*/, + AnalysisJet const& analysisJet, + AnyTracks const& /*allTracks*/, + AnyOriginalTracks const&, + std::vector& trackIndices, + int jetFlavor = 0, + double eventweight = 1.0) + { + for (const auto& constituent : analysisJet.template tracks_as()) { + + if (constituent.pt() < trackPtMin) { + continue; + } + + double deltaRJetTrack = jetutilities::deltaR(analysisJet, constituent); + double dotProduct = RecoDecay::dotProd(std::array{analysisJet.px(), analysisJet.py(), analysisJet.pz()}, + std::array{constituent.px(), constituent.py(), constituent.pz()}); + int sign = jettaggingutilities::getGeoSign(analysisJet, constituent); + + registry.fill(HIST("h2_SIPs2D_jetpT"), analysisJet.pt(), sign * std::abs(constituent.dcaXY()) / constituent.sigmadcaXY(), eventweight); + registry.fill(HIST("h2_SIPs3D_jetpT"), analysisJet.pt(), sign * std::abs(constituent.dcaXYZ()) / constituent.sigmadcaXYZ(), eventweight); + + if (doprocessMCJets) { + if (jetFlavor == JetTaggingSpecies::beauty || jetFlavor == JetTaggingSpecies::charm) { + registry.fill(HIST("h2_SIPs2D_jetpT_hfjet"), analysisJet.pt(), sign * std::abs(constituent.dcaXY()) / constituent.sigmadcaXY(), eventweight); + registry.fill(HIST("h2_SIPs3D_jetpT_hfjet"), analysisJet.pt(), sign * std::abs(constituent.dcaXYZ()) / constituent.sigmadcaXYZ(), eventweight); + } else if (jetFlavor == JetTaggingSpecies::strange) { + registry.fill(HIST("h2_SIPs2D_jetpT_sjet"), analysisJet.pt(), sign * std::abs(constituent.dcaXY()) / constituent.sigmadcaXY(), eventweight); + registry.fill(HIST("h2_SIPs3D_jetpT_sjet"), analysisJet.pt(), sign * std::abs(constituent.dcaXYZ()) / constituent.sigmadcaXYZ(), eventweight); + } else { + registry.fill(HIST("h2_SIPs2D_jetpT_udgjet"), analysisJet.pt(), sign * std::abs(constituent.dcaXY()) / constituent.sigmadcaXY(), eventweight); + registry.fill(HIST("h2_SIPs3D_jetpT_udgjet"), analysisJet.pt(), sign * std::abs(constituent.dcaXYZ()) / constituent.sigmadcaXYZ(), eventweight); + } + + auto origConstit = constituent.template track_as(); + + // Track information + registry.fill(HIST("h_trk_pt"), constituent.pt(), eventweight); + registry.fill(HIST("h_trk_eta"), constituent.eta(), eventweight); + registry.fill(HIST("h_trk_phi"), origConstit.phi(), eventweight); + registry.fill(HIST("h_trk_charge"), constituent.sign(), eventweight); + registry.fill(HIST("h_trk_dcaxy"), std::abs(constituent.dcaXY()) * sign, eventweight); + registry.fill(HIST("h_trk_dcaxyz"), std::abs(constituent.dcaXYZ()) * sign, eventweight); + registry.fill(HIST("h_trk_sigmadcaxy"), constituent.sigmadcaXY(), eventweight); + registry.fill(HIST("h_trk_sigmadcaxyz"), constituent.sigmadcaXYZ(), eventweight); + registry.fill(HIST("h_trk_itsncls"), origConstit.itsNCls(), eventweight); + registry.fill(HIST("h_trk_tpcncls"), origConstit.tpcNClsFound(), eventweight); + registry.fill(HIST("h_trk_tpcncrs"), origConstit.tpcNClsCrossedRows(), eventweight); + registry.fill(HIST("h_trk_itschi2ncl"), origConstit.itsChi2NCl(), eventweight); + registry.fill(HIST("h_trk_tpcchi2ncl"), origConstit.tpcChi2NCl(), eventweight); + registry.fill(HIST("h2_trk_jtrackpt_vs_origtrackpt"), constituent.pt(), origConstit.pt(), eventweight); + + if (produceTree) { + sjetTracksExtraTable(/*sjetParamsTable.lastIndex() + 1, */ + origConstit.phi(), + constituent.sign(), + origConstit.itsChi2NCl(), + origConstit.tpcChi2NCl(), + origConstit.itsNCls(), + origConstit.tpcNClsFound(), + origConstit.tpcNClsCrossedRows()); + + sjetTracksParamsTable(sjetParamsTable.lastIndex() + 1, + constituent.pt(), + constituent.eta(), + dotProduct, + dotProduct / analysisJet.p(), + deltaRJetTrack, + std::abs(constituent.dcaXY()) * sign, + constituent.sigmadcaXY(), + std::abs(constituent.dcaZ()) * sign, + constituent.sigmadcaZ(), + constituent.sigmadcaXYZ(), + constituent.p() / analysisJet.p(), + 0.); + } + trackIndices.push_back(sjetTracksParamsTable.lastIndex()); + } + } + } + + void processDummy(FilteredCollision::iterator const& /*collision*/) + { + } + PROCESS_SWITCH(SjetTreeCreator, processDummy, "Dummy process function turned on by default", true); + + using MCDJetTable = soa::Filtered>; + + using MCPJetTable = soa::Filtered>; + + using FilteredCollisionMCD = soa::Filtered>; + + Preslice mcParticlesPerCollision = aod::jmcparticle::mcCollisionId; + Preslice mcpJetsPerCollision = aod::jet::mcCollisionId; + + using MCDJetTableNoSV = soa::Filtered>; + + using JetParticleswID = soa::Join; + + void processMCJets(FilteredCollisionMCD::iterator const& collision, + aod::JMcCollisions const&, + MCDJetTableNoSV const& MCDjets, + MCPJetTable const& MCPjets, + JetTracksMCDwID const& allTracks, + JetParticleswID const& MCParticles, + OriginalTracks const& origTracks) + { + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || + (static_cast(std::rand()) / RAND_MAX < eventReductionFactor)) { + return; + } + + registry.fill(HIST("h_vertexZ"), collision.posZ()); + + auto const mcParticlesPerColl = MCParticles.sliceBy(mcParticlesPerCollision, collision.mcCollisionId()); + auto const mcPJetsPerColl = MCPjets.sliceBy(mcpJetsPerCollision, collision.mcCollisionId()); + + for (const auto& analysisJet : MCDjets) { + + bool jetIncluded = false; + for (const auto& jetR : jetRadiiValues) { + if (analysisJet.r() == static_cast(jetR * 100)) { + jetIncluded = true; + break; + } + } + + if (!jetIncluded) { + continue; + } + + std::vector indicesTracks; + + int16_t jetFlavorIdx = 0; + int16_t jetFlavor = 0; + + for (const auto& mcpjet : analysisJet.template matchedJetGeo_as()) { + jetFlavor = jettaggingutilities::getSJetFlavor(mcpjet, mcParticlesPerColl); + } + + if (jetFlavor == JetTaggingSpecies::strange) { + jetFlavorIdx = 2; + } else if (jetFlavor == JetTaggingSpecies::udg) { + jetFlavorIdx = 3; + } else if (jetFlavor == JetTaggingSpecies::charm || jetFlavor == JetTaggingSpecies::beauty) { + jetFlavorIdx = 1; + } else { + jetFlavorIdx = jetFlavor; + } + + if ((jetFlavor != JetTaggingSpecies::strange) && + (static_cast(std::rand()) / RAND_MAX < getReductionFactor(analysisJet.pt()))) { + continue; + } + + float eventWeight = analysisJet.eventWeight(); + + analyzeJetTrackInfo(collision, analysisJet, allTracks, origTracks, indicesTracks, jetFlavor, eventWeight); + + registry.fill(HIST("h2_jetMass_jetpT"), analysisJet.pt(), analysisJet.mass(), eventWeight); + registry.fill(HIST("h2_nTracks_jetpT"), analysisJet.pt(), indicesTracks.size()); + + // Jet info + registry.fill(HIST("h_jet_pt"), analysisJet.pt()); + registry.fill(HIST("h_jet_eta"), analysisJet.eta()); + registry.fill(HIST("h_jet_phi"), analysisJet.phi()); + + registry.fill(HIST("h_jet_flav"), jetFlavorIdx); + registry.fill(HIST("h_n_trks"), indicesTracks.size()); + registry.fill(HIST("h_jet_mass"), analysisJet.mass()); + + if (jetFlavor == JetTaggingSpecies::beauty || jetFlavor == JetTaggingSpecies::charm) { + registry.fill(HIST("h2_jetMass_jetpT_hfjet"), analysisJet.pt(), analysisJet.mass(), eventWeight); + registry.fill(HIST("h_jetpT_detector_hfjet"), analysisJet.pt(), eventWeight); + } else if (jetFlavor == JetTaggingSpecies::strange) { + registry.fill(HIST("h2_jetMass_jetpT_sjet"), analysisJet.pt(), analysisJet.mass(), eventWeight); + registry.fill(HIST("h_jetpT_detector_sjet"), analysisJet.pt(), eventWeight); + } else { + registry.fill(HIST("h2_jetMass_jetpT_udgjet"), analysisJet.pt(), analysisJet.mass(), eventWeight); + registry.fill(HIST("h_jetpT_detector_udgjet"), analysisJet.pt(), eventWeight); + } + + if (produceTree) { + sjetConstituentsTable(sjetParamsTable.lastIndex() + 1, indicesTracks); + sjetParamsTable(analysisJet.pt(), + analysisJet.eta(), + analysisJet.phi(), + indicesTracks.size(), + analysisJet.mass(), + jetFlavor, + analysisJet.r()); + } + } + } + PROCESS_SWITCH(SjetTreeCreator, processMCJets, "jet information in MC", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From faf46271eb9a1b4a9ad705e4274c75a5411b69f1 Mon Sep 17 00:00:00 2001 From: Matteo Morgante Date: Wed, 3 Sep 2025 17:43:03 +0200 Subject: [PATCH 290/986] [PWGLF] Added configurables to select pdg codes for specific kink decay configurations. (#12839) Co-authored-by: ALICE Action Bot --- PWGLF/DataModel/LFKinkDecayTables.h | 3 +- .../Strangeness/sigmaminustask.cxx | 283 +++++++++++------- 2 files changed, 181 insertions(+), 105 deletions(-) diff --git a/PWGLF/DataModel/LFKinkDecayTables.h b/PWGLF/DataModel/LFKinkDecayTables.h index d8df2eb865f..4337fe99f1c 100644 --- a/PWGLF/DataModel/LFKinkDecayTables.h +++ b/PWGLF/DataModel/LFKinkDecayTables.h @@ -58,6 +58,7 @@ DECLARE_SOA_COLUMN(NSigmaTOFKa, nSigmaTOFKa, float); //! Number of sigmas for th DECLARE_SOA_COLUMN(MothPdgCode, mothPdgCode, int); //! PDG code of the Sigma daughter DECLARE_SOA_COLUMN(DaugPdgCode, daugPdgCode, int); //! PDG code of the kink daughter DECLARE_SOA_COLUMN(PtMC, ptMC, float); //! pT of the candidate in MC +DECLARE_SOA_COLUMN(PzMC, pzMC, float); //! pZ of the candidate in MC DECLARE_SOA_COLUMN(MassMC, massMC, float); //! Invariant mass of the candidate in MC DECLARE_SOA_COLUMN(DecayRadiusMC, decayRadiusMC, float); //! Decay radius of the candidate in MC DECLARE_SOA_COLUMN(CollisionIdCheck, collisionIdCheck, bool); //! Check if mcDaughter collision ID matches the reconstructed collision ID @@ -153,7 +154,7 @@ DECLARE_SOA_TABLE(SlimKinkCandsMC, "AOD", "SLIMKINKCANDSMC", kinkcand::NSigmaTPCPi, kinkcand::NSigmaTPCPr, kinkcand::NSigmaTPCKa, kinkcand::NSigmaTOFPi, kinkcand::NSigmaTOFPr, kinkcand::NSigmaTOFKa, kinkcand::MothPdgCode, kinkcand::DaugPdgCode, - kinkcand::PtMC, kinkcand::MassMC, kinkcand::DecayRadiusMC, kinkcand::CollisionIdCheck); + kinkcand::PtMC, kinkcand::PzMC, kinkcand::MassMC, kinkcand::DecayRadiusMC, kinkcand::CollisionIdCheck); } // namespace o2::aod diff --git a/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx b/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx index e6441c413e0..b9172637b9b 100644 --- a/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx +++ b/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx @@ -58,6 +58,9 @@ struct sigmaminustask { Configurable cutMaxQtAP{"cutMaxQtAP", 0.20f, "Maximum Qt for Armenteros-Podolanski cut"}; Configurable cutPtGen{"cutPtGen", 0.5f, "Minimum pT for generated sigma particles"}; + Configurable> mothPdgCodes{"mothPdgCodes", std::vector{3112, 3222}, "PDG codes of the selected mother particles"}; + Configurable> daugPdgCodes{"daugPdgCodes", std::vector{211, 2212}, "PDG codes of the selected charged daughter particles"}; + Configurable fillOutputTree{"fillOutputTree", true, "If true, fill the output tree with Kink candidates"}; // Configurables for findable tracks (kinkBuilder.cxx efficiency) @@ -72,8 +75,9 @@ struct sigmaminustask { Preslice mPerCol = aod::track::collisionId; - // Constants + // Constants and castings float radToDeg = o2::constants::math::Rad2Deg; + std::vector cast_mothPdgCodes, cast_daugPdgCodes; // Services CCDB Service ccdb; @@ -106,12 +110,13 @@ struct sigmaminustask { const AxisSpec xiMassAxis{100, 1.2, 1.6, "m_{#Xi} (GeV/#it{c}^{2})"}; const AxisSpec pdgAxis{10001, -5000, 5000, "PDG code"}; const AxisSpec vertexZAxis{100, -15., 15., "vrtx_{Z} [cm]"}; - const AxisSpec dcaMothAxis{100, 0, 0.03, "DCA [cm]"}; + const AxisSpec dcaMothAxis{800, 0, 200, "DCA [#mu m]"}; const AxisSpec dcaDaugAxis{200, 0, 20, "DCA [cm]"}; const AxisSpec radiusAxis{100, -1, 40, "Decay radius [cm]"}; const AxisSpec alphaAPAxis{200, -1.0, 1.0, "#alpha_{AP}"}; const AxisSpec qtAPAxis{200, 0.0, 0.5, "q_{T,AP}"}; const AxisSpec cosPointingAngleAxis{100, -1.0, 1.0, "Cos#theta_{PA}"}; + const AxisSpec kinkAngleAxis{100, 0, 100, "Kink angle (deg)"}; const AxisSpec ptResolutionAxis{100, -1.0, 1.0, "(#it{p}_{T}^{rec} - #it{p}_{T}^{gen}) / #it{p}_{T}^{gen}"}; const AxisSpec massResolutionAxis{100, -0.5, 0.5, "(m_{rec} - m_{gen}) / m_{gen}"}; @@ -137,6 +142,7 @@ struct sigmaminustask { // Add MC histograms if needed rSigmaMinus.add("h2MassPtMCRec", "h2MassPtMCRec", {HistType::kTH2F, {ptAxis, sigmaMassAxis}}); rSigmaMinus.add("h2MassPtMCGen", "h2MassPtMCGen", {HistType::kTH2F, {ptAxis, sigmaMassAxis}}); + rSigmaMinus.add("h2KinkAngleVsPtMothMC", "h2KinkAngleVsPtMothMC", {HistType::kTH2F, {ptAxis, kinkAngleAxis}}); rSigmaMinus.add("h2MassResolution", "h2MassResolution", {HistType::kTH2F, {ptAxis, massResolutionAxis}}); rSigmaMinus.add("h2PtResolution", "h2PtResolution", {HistType::kTH2F, {ptAxis, ptResolutionAxis}}); @@ -169,23 +175,28 @@ struct sigmaminustask { h2RecRadiusFilterIndex->GetXaxis()->SetBinLabel(i + 1, filterLabels[i].c_str()); } - rFindable.add("h2MCRadiusFilter_plus_protonkink", "h2MCRadiusFilter_plus_protonkink", {HistType::kTH2F, {filtersAxis, radiusAxis}}); - rFindable.add("h2MCRadiusFilter_plus_pikink", "h2MCRadiusFilter_plus_pikink", {HistType::kTH2F, {filtersAxis, radiusAxis}}); - rFindable.add("h2MCRadiusFilter_minus_pikink", "h2MCRadiusFilter_minus_pikink", {HistType::kTH2F, {filtersAxis, radiusAxis}}); + // Sigma minus and plus specific histograms + rFindable.add("h2MCRadiusFilter_sigmaplus_protonkink", "h2MCRadiusFilter_sigmaplus_protonkink", {HistType::kTH2F, {filtersAxis, radiusAxis}}); + rFindable.add("h2MCRadiusFilter_sigmaplus_pikink", "h2MCRadiusFilter_sigmaplus_pikink", {HistType::kTH2F, {filtersAxis, radiusAxis}}); + rFindable.add("h2MCRadiusFilter_sigmaminus_pikink", "h2MCRadiusFilter_sigmaminus_pikink", {HistType::kTH2F, {filtersAxis, radiusAxis}}); - rFindable.add("h2PtFilter_plus_protonkink", "h2PtFilter_plus_protonkink", {HistType::kTH2F, {filtersAxis, ptUnsignedAxis}}); - rFindable.add("h2PtFilter_plus_pikink", "h2PtFilter_plus_pikink", {HistType::kTH2F, {filtersAxis, ptUnsignedAxis}}); - rFindable.add("h2PtFilter_minus_pikink", "h2PtFilter_minus_pikink", {HistType::kTH2F, {filtersAxis, ptUnsignedAxis}}); + rFindable.add("h2PtFilter_sigmaplus_protonkink", "h2PtFilter_sigmaplus_protonkink", {HistType::kTH2F, {filtersAxis, ptUnsignedAxis}}); + rFindable.add("h2PtFilter_sigmaplus_pikink", "h2PtFilter_sigmaplus_pikink", {HistType::kTH2F, {filtersAxis, ptUnsignedAxis}}); + rFindable.add("h2PtFilter_sigmaminus_pikink", "h2PtFilter_sigmaminus_pikink", {HistType::kTH2F, {filtersAxis, ptUnsignedAxis}}); - rFindable.add("h2PtDaugFilter_plus_protonkink", "h2PtDaugFilter_plus_protonkink", {HistType::kTH2F, {filtersAxis, ptUnsignedAxis}}); - rFindable.add("h2PtDaugFilter_plus_pikink", "h2PtDaugFilter_plus_pikink", {HistType::kTH2F, {filtersAxis, ptUnsignedAxis}}); - rFindable.add("h2PtDaugFilter_minus_pikink", "h2PtDaugFilter_minus_pikink", {HistType::kTH2F, {filtersAxis, ptUnsignedAxis}}); + rFindable.add("h2PtDaugFilter_sigmaplus_protonkink", "h2PtDaugFilter_sigmaplus_protonkink", {HistType::kTH2F, {filtersAxis, ptUnsignedAxis}}); + rFindable.add("h2PtDaugFilter_sigmaplus_pikink", "h2PtDaugFilter_sigmaplus_pikink", {HistType::kTH2F, {filtersAxis, ptUnsignedAxis}}); + rFindable.add("h2PtDaugFilter_sigmaminus_pikink", "h2PtDaugFilter_sigmaminus_pikink", {HistType::kTH2F, {filtersAxis, ptUnsignedAxis}}); rFindable.add("h2DCAMothPt_protonkink", "h2DCAMothPt_protonkink", {HistType::kTH2F, {ptUnsignedAxis, dcaMothAxis}}); rFindable.add("h2DCADaugPt_protonkink", "h2DCADaugPt_protonkink", {HistType::kTH2F, {ptUnsignedAxis, dcaDaugAxis}}); rFindable.add("h2DCAMothPt_pikink", "h2DCAMothPt_pikink", {HistType::kTH2F, {ptUnsignedAxis, dcaMothAxis}}); rFindable.add("h2DCADaugPt_pikink", "h2DCADaugPt_pikink", {HistType::kTH2F, {ptUnsignedAxis, dcaDaugAxis}}); } + + // Cast configurables to std::vector + cast_mothPdgCodes = (std::vector)mothPdgCodes; + cast_daugPdgCodes = (std::vector)daugPdgCodes; } void initCCDB(aod::BCs::iterator const& bc) @@ -229,6 +240,14 @@ struct sigmaminustask { return (std::inner_product(momMother.begin(), momMother.end(), vMother.begin(), 0.f)) / (pMother * vMotherNorm); } + float kinkAngle(std::array const& p_moth, std::array const& p_daug) + { + float dotProduct = std::inner_product(p_moth.begin(), p_moth.end(), p_daug.begin(), 0.0f); + float magMoth = std::hypot(p_moth[0], p_moth[1], p_moth[2]); + float magDaug = std::hypot(p_daug[0], p_daug[1], p_daug[2]); + return std::acos(dotProduct / (magMoth * magDaug)) * radToDeg; + } + void processData(CollisionsFull::iterator const& collision, aod::KinkCands const& KinkCands, TracksFull const&) { if (std::abs(collision.posZ()) > cutzvertex || !collision.sel8()) { @@ -305,29 +324,46 @@ struct sigmaminustask { rSigmaMinus.fill(HIST("h2NSigmaTPCPiPt"), kinkCand.mothSign() * kinkCand.ptMoth(), dauTrack.tpcNSigmaPi()); // do MC association - auto mcLabSigma = trackLabelsMC.rawIteratorAt(mothTrack.globalIndex()); - auto mcLabPiDau = trackLabelsMC.rawIteratorAt(dauTrack.globalIndex()); - if (mcLabSigma.has_mcParticle() && mcLabPiDau.has_mcParticle()) { - auto mcTrackSigma = mcLabSigma.mcParticle_as(); - auto mcTrackPiDau = mcLabPiDau.mcParticle_as(); - if (!mcTrackPiDau.has_mothers()) { + auto mcLabMoth = trackLabelsMC.rawIteratorAt(mothTrack.globalIndex()); + auto mcLabDaug = trackLabelsMC.rawIteratorAt(dauTrack.globalIndex()); + if (mcLabMoth.has_mcParticle() && mcLabDaug.has_mcParticle()) { + auto mcTrackMoth = mcLabMoth.mcParticle_as(); + auto mcTrackDaug = mcLabDaug.mcParticle_as(); + if (!mcTrackDaug.has_mothers()) { continue; } - for (auto& piMother : mcTrackPiDau.mothers_as()) { - if (piMother.globalIndex() != mcTrackSigma.globalIndex()) { + + for (const auto& mcMother : mcTrackDaug.mothers_as()) { + if (mcMother.globalIndex() != mcTrackMoth.globalIndex()) { continue; } - if (std::abs(mcTrackSigma.pdgCode()) != 3112 && std::abs(mcTrackSigma.pdgCode()) != 3222) { - continue; + + // Select only valid mother and daughter + bool isValidMother = false; + bool isValidDaughter = false; + for (const int pdgCode : cast_mothPdgCodes) { + if (std::abs(mcTrackMoth.pdgCode()) == pdgCode) { + isValidMother = true; + break; + } } - if (std::abs(mcTrackPiDau.pdgCode()) != 211 && std::abs(mcTrackPiDau.pdgCode()) != 2212) { + + for (const int pdgCode : cast_daugPdgCodes) { + if (std::abs(mcTrackDaug.pdgCode()) == pdgCode) { + isValidDaughter = true; + break; + } + } + + if (!isValidMother || !isValidDaughter) { continue; } - float MotherMassMC = std::sqrt(piMother.e() * piMother.e() - piMother.p() * piMother.p()); - float MotherpTMC = piMother.pt(); - float deltaXMother = mcTrackPiDau.vx() - piMother.vx(); - float deltaYMother = mcTrackPiDau.vy() - piMother.vy(); + float motherMassMC = std::sqrt(mcMother.e() * mcMother.e() - mcMother.p() * mcMother.p()); + float motherPtMC = mcMother.pt(); + float motherPzMC = mcMother.pz(); + float deltaXMother = mcTrackDaug.vx() - mcMother.vx(); + float deltaYMother = mcTrackDaug.vy() - mcMother.vy(); float decayRadiusMC = std::sqrt(deltaXMother * deltaXMother + deltaYMother * deltaYMother); float decayRadiusRec = std::sqrt(kinkCand.xDecVtx() * kinkCand.xDecVtx() + kinkCand.yDecVtx() * kinkCand.yDecVtx()); float cosPointingAngleRec = cosPAngle(std::array{kinkCand.pxMoth(), kinkCand.pyMoth(), kinkCand.pzMoth()}, @@ -337,31 +373,29 @@ struct sigmaminustask { // Check coherence of MCcollision Id for daughter MCparticle and reconstructed collision bool mcCollisionIdCheck = false; if (collision.has_mcCollision()) { - mcCollisionIdCheck = collision.mcCollision().globalIndex() == mcTrackPiDau.mcCollisionId(); + mcCollisionIdCheck = collision.mcCollision().globalIndex() == mcTrackDaug.mcCollisionId(); } + // Check bunch crossing ID coherence - auto mcCollision = mcTrackPiDau.template mcCollision_as(); - // bool BCId_vs_MCBCId = collision.bcId() == mcCollision.bcId(); - bool BCId_vs_EvSel = collision.bcId() == collision.foundBCId(); - bool EvSel_vs_MCBCId = collision.foundBCId() == mcCollision.bcId(); + auto mcCollision = mcTrackDaug.template mcCollision_as(); + bool bcIdVsEvSel = (collision.bcId() == collision.foundBCId()); + bool evSelVsMcbcId = (collision.foundBCId() == mcCollision.bcId()); rSigmaMinus.fill(HIST("hMcCollIdCoherence"), static_cast(mcCollisionIdCheck)); - rSigmaMinus.fill(HIST("h2CollId_BCId"), static_cast(mcCollisionIdCheck), static_cast(EvSel_vs_MCBCId)); - rSigmaMinus.fill(HIST("h2BCId_comp"), static_cast(EvSel_vs_MCBCId), static_cast(BCId_vs_EvSel)); + rSigmaMinus.fill(HIST("h2CollId_BCId"), static_cast(mcCollisionIdCheck), static_cast(evSelVsMcbcId)); + rSigmaMinus.fill(HIST("h2BCId_comp"), static_cast(evSelVsMcbcId), static_cast(bcIdVsEvSel)); rSigmaMinus.fill(HIST("h2MassPtMCRec"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus()); - rSigmaMinus.fill(HIST("h2MassResolution"), kinkCand.mothSign() * kinkCand.ptMoth(), (kinkCand.mSigmaMinus() - MotherMassMC) / MotherMassMC); - rSigmaMinus.fill(HIST("h2PtResolution"), kinkCand.mothSign() * kinkCand.ptMoth(), (kinkCand.ptMoth() - MotherpTMC) / MotherpTMC); + rSigmaMinus.fill(HIST("h2MassResolution"), kinkCand.mothSign() * kinkCand.ptMoth(), (kinkCand.mSigmaMinus() - motherMassMC) / motherMassMC); + rSigmaMinus.fill(HIST("h2PtResolution"), kinkCand.mothSign() * kinkCand.ptMoth(), (kinkCand.ptMoth() - motherPtMC) / motherPtMC); rSigmaMinus.fill(HIST("h2RadiusResolution"), kinkCand.mothSign() * kinkCand.ptMoth(), (decayRadiusRec - decayRadiusMC) / decayRadiusMC); rSigmaMinus.fill(HIST("h2DCAMothPt"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.dcaMothPv()); rSigmaMinus.fill(HIST("h2DCADaugPt"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.dcaDaugPv()); rSigmaMinus.fill(HIST("h2CosPointingAnglePt"), kinkCand.mothSign() * kinkCand.ptMoth(), cosPointingAngleRec); rSigmaMinus.fill(HIST("h2ArmenterosPostCuts"), alphaAPValue, qtValue); - if (std::abs(mcTrackPiDau.pdgCode()) == 211) { - rSigmaMinus.fill(HIST("h2NSigmaTOFPiPt"), kinkCand.mothSign() * kinkCand.ptMoth(), dauTrack.tofNSigmaPi()); - } else if (std::abs(mcTrackPiDau.pdgCode()) == 2212) { - rSigmaMinus.fill(HIST("h2NSigmaTOFPrPt"), kinkCand.mothSign() * kinkCand.ptMoth(), dauTrack.tofNSigmaPr()); - } + + rSigmaMinus.fill(HIST("h2NSigmaTOFPiPt"), kinkCand.mothSign() * kinkCand.ptMoth(), dauTrack.tofNSigmaPi()); + rSigmaMinus.fill(HIST("h2NSigmaTOFPrPt"), kinkCand.mothSign() * kinkCand.ptMoth(), dauTrack.tofNSigmaPr()); // fill the output table with Mc information if (fillOutputTree) { @@ -372,8 +406,8 @@ struct sigmaminustask { kinkCand.mothSign(), dauTrack.tpcNSigmaPi(), dauTrack.tpcNSigmaPr(), dauTrack.tpcNSigmaKa(), dauTrack.tofNSigmaPi(), dauTrack.tofNSigmaPr(), dauTrack.tofNSigmaKa(), - mcTrackSigma.pdgCode(), mcTrackPiDau.pdgCode(), - MotherpTMC, MotherMassMC, decayRadiusMC, mcCollisionIdCheck); + mcTrackMoth.pdgCode(), mcTrackDaug.pdgCode(), + motherPtMC, motherPzMC, motherMassMC, decayRadiusMC, mcCollisionIdCheck); } } } // MC association and selection @@ -382,10 +416,21 @@ struct sigmaminustask { // Loop over all generated particles to fill MC histograms for (const auto& mcPart : particlesMC) { - if ((std::abs(mcPart.pdgCode()) != 3112 && std::abs(mcPart.pdgCode()) != 3222) || std::abs(mcPart.y()) > cutRapMotherMC) { // only sigma mothers and rapidity cut + if (std::abs(mcPart.y()) > cutRapMotherMC) { // rapidity cut continue; } + bool isValidMother = false; + for (const int pdgCode : cast_mothPdgCodes) { + if (std::abs(mcPart.pdgCode()) == pdgCode) { + isValidMother = true; + break; + } + } + if (!isValidMother) { + continue; // Skip if not a valid mother + } + if (mcPart.pt() < cutPtGen) { continue; // Skip if pT is below threshold } @@ -393,26 +438,35 @@ struct sigmaminustask { if (!mcPart.has_daughters()) { continue; // Skip if no daughters } - bool hasSigmaDaughter = false; - int daug_pdg = 0; + + bool hasValidDaughter = false; + int daugPdg = 0; std::array secVtx; std::array momDaug; for (const auto& daughter : mcPart.daughters_as()) { - if (std::abs(daughter.pdgCode()) == 211 || std::abs(daughter.pdgCode()) == 2212) { // Pi or proton daughter - hasSigmaDaughter = true; - secVtx = {daughter.vx(), daughter.vy(), daughter.vz()}; - momDaug = {daughter.px(), daughter.py(), daughter.pz()}; - daug_pdg = daughter.pdgCode(); - break; // Found a daughter, exit loop + for (const int pdgCode : cast_daugPdgCodes) { + if (std::abs(daughter.pdgCode()) == pdgCode) { + hasValidDaughter = true; + secVtx = {daughter.vx(), daughter.vy(), daughter.vz()}; + momDaug = {daughter.px(), daughter.py(), daughter.pz()}; + daugPdg = daughter.pdgCode(); + break; // Found a daughter, exit loop + } + } + if (hasValidDaughter) { + break; // Exit outer loop if a valid daughter is found } } - if (!hasSigmaDaughter) { - continue; // Skip if no pi/proton daughter found + if (!hasValidDaughter) { + continue; // Skip if no good daughter found } + float mcMass = std::sqrt(mcPart.e() * mcPart.e() - mcPart.p() * mcPart.p()); float mcDecayRadius = std::sqrt((secVtx[0] - mcPart.vx()) * (secVtx[0] - mcPart.vx()) + (secVtx[1] - mcPart.vy()) * (secVtx[1] - mcPart.vy())); - int sigmaSign = mcPart.pdgCode() > 0 ? 1 : -1; // Determine the sign of the Sigma - rSigmaMinus.fill(HIST("h2MassPtMCGen"), sigmaSign * mcPart.pt(), mcMass); + int mothSign = mcPart.pdgCode() > 0 ? 1 : -1; // Determine the sign of the Sigma + float kinkAngleMC = kinkAngle({mcPart.px(), mcPart.py(), mcPart.pz()}, momDaug); + rSigmaMinus.fill(HIST("h2MassPtMCGen"), mothSign * mcPart.pt(), mcMass); + rSigmaMinus.fill(HIST("h2KinkAngleVsPtMothMC"), mothSign * mcPart.pt(), kinkAngleMC); // Fill output table with non reconstructed MC candidates if (fillOutputTree) { @@ -420,38 +474,34 @@ struct sigmaminustask { -999, -999, -999, -999, -999, -999, -999, -999, -999, - sigmaSign, + mothSign, -999, -999, -999, -999, -999, -999, - mcPart.pdgCode(), daug_pdg, - mcPart.pt(), mcMass, mcDecayRadius, false); + mcPart.pdgCode(), daugPdg, + mcPart.pt(), mcPart.pz(), mcMass, mcDecayRadius, false); } } } PROCESS_SWITCH(sigmaminustask, processMC, "MC processing", false); - void fillFindableHistograms(int filterIndex, float mcRadius, float recRadius, float ptMoth, float ptDaug, bool isSigmaMinus, bool isPiDaughter) + void fillFindableHistograms(int filterIndex, float mcRadius, float recRadius, float ptMoth, float ptDaug, int mothPdgCode, int daugPdgCode) { rFindable.fill(HIST("hFilterIndex"), filterIndex); rFindable.fill(HIST("h2MCRadiusFilterIndex"), filterIndex, mcRadius); rFindable.fill(HIST("h2RecRadiusFilterIndex"), filterIndex, recRadius); - if (isPiDaughter) { - if (isSigmaMinus) { - rFindable.fill(HIST("h2MCRadiusFilter_minus_pikink"), filterIndex, mcRadius); - rFindable.fill(HIST("h2PtFilter_minus_pikink"), filterIndex, ptMoth); - rFindable.fill(HIST("h2PtDaugFilter_minus_pikink"), filterIndex, ptDaug); - } else { - rFindable.fill(HIST("h2MCRadiusFilter_plus_pikink"), filterIndex, mcRadius); - rFindable.fill(HIST("h2PtFilter_plus_pikink"), filterIndex, ptMoth); - rFindable.fill(HIST("h2PtDaugFilter_plus_pikink"), filterIndex, ptDaug); - } - } else { - if (!isSigmaMinus) { - rFindable.fill(HIST("h2MCRadiusFilter_plus_protonkink"), filterIndex, mcRadius); - rFindable.fill(HIST("h2PtFilter_plus_protonkink"), filterIndex, ptMoth); - rFindable.fill(HIST("h2PtDaugFilter_plus_protonkink"), filterIndex, ptDaug); - } + if (std::abs(mothPdgCode) == PDG_t::kSigmaMinus && std::abs(daugPdgCode) == PDG_t::kPiMinus) { + rFindable.fill(HIST("h2MCRadiusFilter_sigmaminus_pikink"), filterIndex, mcRadius); + rFindable.fill(HIST("h2PtFilter_sigmaminus_pikink"), filterIndex, ptMoth); + rFindable.fill(HIST("h2PtDaugFilter_sigmaminus_pikink"), filterIndex, ptDaug); + } else if (std::abs(mothPdgCode) == PDG_t::kSigmaPlus && std::abs(daugPdgCode) == PDG_t::kPiPlus) { + rFindable.fill(HIST("h2MCRadiusFilter_sigmaplus_pikink"), filterIndex, mcRadius); + rFindable.fill(HIST("h2PtFilter_sigmaplus_pikink"), filterIndex, ptMoth); + rFindable.fill(HIST("h2PtDaugFilter_sigmaplus_pikink"), filterIndex, ptDaug); + } else if (std::abs(mothPdgCode) == PDG_t::kSigmaPlus && std::abs(daugPdgCode) == PDG_t::kProton) { + rFindable.fill(HIST("h2MCRadiusFilter_sigmaplus_protonkink"), filterIndex, mcRadius); + rFindable.fill(HIST("h2PtFilter_sigmaplus_protonkink"), filterIndex, ptMoth); + rFindable.fill(HIST("h2PtDaugFilter_sigmaplus_protonkink"), filterIndex, ptDaug); } } @@ -467,8 +517,14 @@ struct sigmaminustask { continue; } auto mcParticle = mcLabel.mcParticle_as(); - - if (mcParticle.has_daughters() && (std::abs(mcParticle.pdgCode()) == 3112 || std::abs(mcParticle.pdgCode()) == 3222)) { + bool isValidMother = false; + for (const int pdgCode : cast_mothPdgCodes) { + if (std::abs(mcParticle.pdgCode()) == pdgCode) { + isValidMother = true; + break; + } + } + if (mcParticle.has_daughters() && isValidMother) { allCandsIndices[mcParticle.globalIndex()] = {track.globalIndex(), -1}; } } @@ -479,8 +535,15 @@ struct sigmaminustask { continue; } auto mcParticle = mcLabel.mcParticle_as(); + bool isValidDaughter = false; + for (const int pdgCode : cast_daugPdgCodes) { + if (std::abs(mcParticle.pdgCode()) == pdgCode) { + isValidDaughter = true; + break; + } + } - if (mcParticle.has_mothers() && (std::abs(mcParticle.pdgCode()) == 211 || std::abs(mcParticle.pdgCode()) == 2212)) { + if (mcParticle.has_mothers() && isValidDaughter) { for (const auto& mother : mcParticle.mothers_as()) { auto it = allCandsIndices.find(mother.globalIndex()); if (it != allCandsIndices.end()) { @@ -505,10 +568,21 @@ struct sigmaminustask { auto mcMother = mcLabMoth.mcParticle_as(); auto mcDaughter = mcLabDaug.mcParticle_as(); - if (std::abs(mcMother.pdgCode()) != 3112 && std::abs(mcMother.pdgCode()) != 3222) { - continue; + bool isValidMother = false; + for (const int pdgCode : cast_mothPdgCodes) { + if (std::abs(mcMother.pdgCode()) == pdgCode) { + isValidMother = true; + break; + } } - if (std::abs(mcDaughter.pdgCode()) != 211 && std::abs(mcDaughter.pdgCode()) != 2212) { + bool isValidDaughter = false; + for (const int pdgCode : cast_daugPdgCodes) { + if (std::abs(mcDaughter.pdgCode()) == pdgCode) { + isValidDaughter = true; + break; + } + } + if (!isValidDaughter || !isValidMother) { continue; } @@ -536,8 +610,8 @@ struct sigmaminustask { auto mcDaughter = mcLabDaug.mcParticle_as(); // Compute useful quantities for histograms - bool isSigmaMinus = (std::abs(mcMother.pdgCode()) == 3112); - bool isPiDaughter = (std::abs(mcDaughter.pdgCode()) == 211); + int mothPdg = mcMother.pdgCode(); + int daugPdg = mcDaughter.pdgCode(); float recPtDaughter = daughterTrack.pt(); float recPtMother = motherTrack.pt(); @@ -549,26 +623,26 @@ struct sigmaminustask { } // Check for detector mismatches in ITS mother tracks - auto mask_value = mcLabMoth.mcMask(); - int mismatchITS_index = -1; + auto maskValue = mcLabMoth.mcMask(); + int mismatchITSIndex = -1; for (int i = 0; i < 7; ++i) { // ITS has layers 0-6, bit ON means mismatch - if ((mask_value & (1 << i)) != 0) { - mismatchITS_index = i; + if ((maskValue & (1 << i)) != 0) { + mismatchITSIndex = i; break; } } // Define filter index and progressively apply kinkbuilder cuts to track pairs int filterIndex = 0; - fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, isSigmaMinus, isPiDaughter); + fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, mothPdg, daugPdg); // 1 - tracks with right ITS, TPC, TOF signals if (motherTrack.has_collision() && motherTrack.hasITS() && !motherTrack.hasTPC() && !motherTrack.hasTOF() && daughterTrack.hasITS() && daughterTrack.hasTPC()) { filterIndex += 1; - fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, isSigmaMinus, isPiDaughter); - rFindable.fill(HIST("hfakeITSfindable"), mismatchITS_index); + fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, mothPdg, daugPdg); + rFindable.fill(HIST("hfakeITSfindable"), mismatchITSIndex); } else { continue; } @@ -579,7 +653,7 @@ struct sigmaminustask { daughterTrack.itsNCls() < 4 && daughterTrack.tpcNClsCrossedRows() > 0.8 * daughterTrack.tpcNClsFindable() && daughterTrack.tpcNClsFound() > nTPCClusMinDaugKB; if (motherGoodITS && daughterGoodITSTPC) { filterIndex += 1; - fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, isSigmaMinus, isPiDaughter); + fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, mothPdg, daugPdg); } else { continue; } @@ -587,7 +661,7 @@ struct sigmaminustask { // 3 - mother track min pT if (motherTrack.pt() > minPtMothKB) { filterIndex += 1; - fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, isSigmaMinus, isPiDaughter); + fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, mothPdg, daugPdg); } else { continue; } @@ -595,7 +669,7 @@ struct sigmaminustask { // 4 - geometric cuts: eta if (std::abs(motherTrack.eta()) < etaMaxKB && std::abs(daughterTrack.eta()) < etaMaxKB) { filterIndex += 1; - fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, isSigmaMinus, isPiDaughter); + fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, mothPdg, daugPdg); } else { continue; } @@ -603,7 +677,7 @@ struct sigmaminustask { // 5 - geometric cuts: phi difference if (std::abs(motherTrack.phi() - daughterTrack.phi()) * radToDeg < maxPhiDiffKB) { filterIndex += 1; - fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, isSigmaMinus, isPiDaughter); + fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, mothPdg, daugPdg); } else { continue; } @@ -623,18 +697,19 @@ struct sigmaminustask { o2::base::Propagator::Instance()->propagateToDCA(collVtx, trackParCovDaug, mBz, 2.f, static_cast(cfgMaterialCorrection.value), &dcaInfoDaug); float dcaXYMother = std::abs(dcaInfoMoth[0]); float dcaXYDaughter = std::abs(dcaInfoDaug[0]); - if (isPiDaughter) { - rFindable.fill(HIST("h2DCAMothPt_pikink"), recPtMother, dcaXYMother); + + if (std::abs(daugPdg) == PDG_t::kPiMinus) { + rFindable.fill(HIST("h2DCAMothPt_pikink"), recPtMother, dcaXYMother * 1.e4); rFindable.fill(HIST("h2DCADaugPt_pikink"), recPtDaughter, dcaXYDaughter); - } else { - rFindable.fill(HIST("h2DCAMothPt_protonkink"), recPtMother, dcaXYMother); + } else if (std::abs(daugPdg) == PDG_t::kProton) { + rFindable.fill(HIST("h2DCAMothPt_protonkink"), recPtMother, dcaXYMother * 1.e4); rFindable.fill(HIST("h2DCADaugPt_protonkink"), recPtDaughter, dcaXYDaughter); } // 6 - max Z difference if (std::abs(trackParCovMoth.getZ() - trackParCovDaug.getZ()) < maxZDiffKB) { filterIndex += 1; - fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, isSigmaMinus, isPiDaughter); + fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, mothPdg, daugPdg); } else { continue; } @@ -642,7 +717,7 @@ struct sigmaminustask { // 7 - DCA mother if (dcaXYMother < maxDcaMothPvKB) { filterIndex += 1; - fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, isSigmaMinus, isPiDaughter); + fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, mothPdg, daugPdg); } else { continue; } @@ -650,7 +725,7 @@ struct sigmaminustask { // 8 - DCA daughter if (dcaXYDaughter > minDcaDaugPvKB) { filterIndex += 1; - fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, isSigmaMinus, isPiDaughter); + fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, mothPdg, daugPdg); } else { continue; } @@ -658,7 +733,7 @@ struct sigmaminustask { // 9 - radius cut if (recRadius > radiusCutKB) { filterIndex += 1; - fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, isSigmaMinus, isPiDaughter); + fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, mothPdg, daugPdg); } else { continue; } @@ -666,7 +741,7 @@ struct sigmaminustask { // 10 - collision selection if (!(std::abs(collision.posZ()) > cutzvertex || !collision.sel8())) { filterIndex += 1; - fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, isSigmaMinus, isPiDaughter); + fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, mothPdg, daugPdg); } else { continue; } @@ -674,7 +749,7 @@ struct sigmaminustask { // 11 - TOF daughter presence if (daughterTrack.hasTOF()) { filterIndex += 1; - fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, isSigmaMinus, isPiDaughter); + fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, mothPdg, daugPdg); } } } From 5d14bdcc957ad6fd829219e5d77e30ba5b936153 Mon Sep 17 00:00:00 2001 From: Luca Aglietta <75362880+Luca610@users.noreply.github.com> Date: Wed, 3 Sep 2025 19:11:13 +0200 Subject: [PATCH 291/986] [PWGHF] Fix sign column in reduced workflow (#12838) --- PWGHF/D2H/DataModel/ReducedDataModel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/D2H/DataModel/ReducedDataModel.h b/PWGHF/D2H/DataModel/ReducedDataModel.h index 3473321a0a5..549fa45ecf9 100644 --- a/PWGHF/D2H/DataModel/ReducedDataModel.h +++ b/PWGHF/D2H/DataModel/ReducedDataModel.h @@ -177,7 +177,7 @@ namespace hf_track_vars_reduced DECLARE_SOA_COLUMN(Px, px, float); //! x-component of momentum DECLARE_SOA_COLUMN(Py, py, float); //! y-component of momentum DECLARE_SOA_COLUMN(Pz, pz, float); //! z-component of momentum -DECLARE_SOA_COLUMN(Sign, sign, uint8_t); //! charge sign +DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! charge sign DECLARE_SOA_COLUMN(HasTPC, hasTPC, bool); //! Flag to check if track has a TPC match DECLARE_SOA_COLUMN(HasTOF, hasTOF, bool); //! Flag to check if track has a TOF match DECLARE_SOA_COLUMN(HasTPCProng0, hasTPCProng0, bool); //! Flag to check if prong0 has a TPC match From db4ca4308ab4042d1f461e87ed5d8937dc221f72 Mon Sep 17 00:00:00 2001 From: Noor Koster <82090643+cnkoster@users.noreply.github.com> Date: Wed, 3 Sep 2025 19:36:47 +0200 Subject: [PATCH 292/986] [PWGCF] Clean up directories and fix some histogram registry issues (#12819) Co-authored-by: ALICE Action Bot --- PWGCF/Flow/Tasks/flowSP.cxx | 237 +++++++++++++++++++----------------- 1 file changed, 124 insertions(+), 113 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowSP.cxx b/PWGCF/Flow/Tasks/flowSP.cxx index 8727a7f9e8f..44cc6d7b027 100644 --- a/PWGCF/Flow/Tasks/flowSP.cxx +++ b/PWGCF/Flow/Tasks/flowSP.cxx @@ -67,6 +67,7 @@ struct FlowSP { O2_DEFINE_CONFIGURABLE(cfgFillEventPlane, bool, false, "Flag to make and fill histos with Event Plane"); O2_DEFINE_CONFIGURABLE(cfgFillXandYterms, bool, false, "Flag to make and fill histos for with separate x and y terms for SPM"); O2_DEFINE_CONFIGURABLE(cfgFillChargeDependence, bool, true, "Flag to make and fill histos for charge dependent flow"); + O2_DEFINE_CONFIGURABLE(cfgFillChargeDependenceQA, bool, true, "Flag to make and fill QA histos for charge dependent flow"); O2_DEFINE_CONFIGURABLE(cfgFillPID, bool, false, "Flag to make and fill histos for PID flow"); // Centrality Estimators -> standard is FT0C O2_DEFINE_CONFIGURABLE(cfgCentFT0Cvariant1, bool, false, "Set centrality estimator to cfgCentFT0Cvariant1"); @@ -85,6 +86,7 @@ struct FlowSP { O2_DEFINE_CONFIGURABLE(cfgMagField, float, 99999, "Configurable magnetic field;default CCDB will be queried"); O2_DEFINE_CONFIGURABLE(cfgCentMin, float, 0, "Minimum cenrality for selected events"); O2_DEFINE_CONFIGURABLE(cfgCentMax, float, 90, "Maximum cenrality for selected events"); + O2_DEFINE_CONFIGURABLE(cfgFilterLeptons, bool, true, "Filter out leptons from MCGenerated by requiring |pdgCode| > 100"); // NUA and NUE weights O2_DEFINE_CONFIGURABLE(cfgFillWeights, bool, true, "Fill NUA weights"); O2_DEFINE_CONFIGURABLE(cfgFillWeightsPOS, bool, true, "Fill NUA weights only for positive charges"); @@ -495,33 +497,31 @@ struct FlowSP { } } if (cfgFillMixedHarmonics) { - registry.add("incl/v2/vnAxCxUx_pt_MH", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/v2/vnAxCyUx_pt_MH", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/v2/vnAxCyUy_pt_MH", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/v2/vnAyCxUy_pt_MH", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/v2/vnAxCxUx_cent_MH", "", kTProfile, {axisCent}); - registry.add("incl/v2/vnAxCyUx_cent_MH", "", kTProfile, {axisCent}); - registry.add("incl/v2/vnAxCyUy_cent_MH", "", kTProfile, {axisCent}); - registry.add("incl/v2/vnAyCxUy_cent_MH", "", kTProfile, {axisCent}); - registry.add("incl/v2/vnAxCxUx_eta_MH", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.add("incl/v2/vnAxCyUx_eta_MH", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.add("incl/v2/vnAxCyUy_eta_MH", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.add("incl/v2/vnAyCxUy_eta_MH", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.addClone("incl/v2/", "incl/v3/"); + registry.add("incl/MH/vnAxCxUx_pt_MH", "", kTProfile2D, {axisPt, axisCentrality}); + registry.add("incl/MH/vnAxCyUx_pt_MH", "", kTProfile2D, {axisPt, axisCentrality}); + registry.add("incl/MH/vnAxCyUy_pt_MH", "", kTProfile2D, {axisPt, axisCentrality}); + registry.add("incl/MH/vnAyCxUy_pt_MH", "", kTProfile2D, {axisPt, axisCentrality}); + registry.add("incl/MH/vnAxCxUx_cent_MH", "", kTProfile, {axisCent}); + registry.add("incl/MH/vnAxCyUx_cent_MH", "", kTProfile, {axisCent}); + registry.add("incl/MH/vnAxCyUy_cent_MH", "", kTProfile, {axisCent}); + registry.add("incl/MH/vnAyCxUy_cent_MH", "", kTProfile, {axisCent}); + registry.add("incl/MH/vnAxCxUx_eta_MH", "", kTProfile2D, {axisEtaVn, axisCentrality}); + registry.add("incl/MH/vnAxCyUx_eta_MH", "", kTProfile2D, {axisEtaVn, axisCentrality}); + registry.add("incl/MH/vnAxCyUy_eta_MH", "", kTProfile2D, {axisEtaVn, axisCentrality}); + registry.add("incl/MH/vnAyCxUy_eta_MH", "", kTProfile2D, {axisEtaVn, axisCentrality}); if (cfgFillPID) { - registry.add("incl/pion/v2/vnAxCxUx_pt_MH", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/pion/v2/vnAxCyUx_pt_MH", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/pion/v2/vnAxCyUy_pt_MH", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/pion/v2/vnAyCxUy_pt_MH", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/pion/v2/vnAxCxUx_cent_MH", "", kTProfile, {axisCent}); - registry.add("incl/pion/v2/vnAxCyUx_cent_MH", "", kTProfile, {axisCent}); - registry.add("incl/pion/v2/vnAxCyUy_cent_MH", "", kTProfile, {axisCent}); - registry.add("incl/pion/v2/vnAyCxUy_cent_MH", "", kTProfile, {axisCent}); - registry.add("incl/pion/v2/vnAxCxUx_eta_MH", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.add("incl/pion/v2/vnAxCyUx_eta_MH", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.add("incl/pion/v2/vnAxCyUy_eta_MH", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.add("incl/pion/v2/vnAyCxUy_eta_MH", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.addClone("incl/pion/v2/", "incl/pion/v3/"); + registry.add("incl/pion/MH/vnAxCxUx_pt_MH", "", kTProfile2D, {axisPt, axisCentrality}); + registry.add("incl/pion/MH/vnAxCyUx_pt_MH", "", kTProfile2D, {axisPt, axisCentrality}); + registry.add("incl/pion/MH/vnAxCyUy_pt_MH", "", kTProfile2D, {axisPt, axisCentrality}); + registry.add("incl/pion/MH/vnAyCxUy_pt_MH", "", kTProfile2D, {axisPt, axisCentrality}); + registry.add("incl/pion/MH/vnAxCxUx_cent_MH", "", kTProfile, {axisCent}); + registry.add("incl/pion/MH/vnAxCyUx_cent_MH", "", kTProfile, {axisCent}); + registry.add("incl/pion/MH/vnAxCyUy_cent_MH", "", kTProfile, {axisCent}); + registry.add("incl/pion/MH/vnAyCxUy_cent_MH", "", kTProfile, {axisCent}); + registry.add("incl/pion/MH/vnAxCxUx_eta_MH", "", kTProfile2D, {axisEtaVn, axisCentrality}); + registry.add("incl/pion/MH/vnAxCyUx_eta_MH", "", kTProfile2D, {axisEtaVn, axisCentrality}); + registry.add("incl/pion/MH/vnAxCyUy_eta_MH", "", kTProfile2D, {axisEtaVn, axisCentrality}); + registry.add("incl/pion/MH/vnAyCxUy_eta_MH", "", kTProfile2D, {axisEtaVn, axisCentrality}); } } if (cfgFillEventPlane) { @@ -555,7 +555,7 @@ struct FlowSP { registry.addClone("incl/", "pos/"); registry.addClone("incl/", "neg/"); } - if (cfgFillPIDQA) { + if (cfgFillPIDQA || cfgFillChargeDependenceQA) { histos.addClone("incl/", "pos/"); histos.addClone("incl/", "neg/"); } @@ -971,7 +971,7 @@ struct FlowSP { } template - inline void fillHistograms(TrackObject track, float wacc, float weff, double centWeight, double ux, double uy, double uxMH, double uyMH, double uxMH2, double uyMH2, double qxA, double qyA, double qxC, double qyC, double corrQQx, double corrQQy, double corrQQ, double vnA, double vnC, double vnFull, double centrality) + inline void fillHistograms(TrackObject track, float wacc, float weff, double centWeight, double ux, double uy, double uxMH, double uyMH, double qxA, double qyA, double qxC, double qyC, double corrQQx, double corrQQy, double corrQQ, double vnA, double vnC, double vnFull, double centrality) { double weight = wacc * weff * centWeight; @@ -985,37 +985,20 @@ struct FlowSP { } if (cfgFillMixedHarmonics) { - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("v2/vnAxCxUx_eta_MH"), track.eta(), centrality, (uxMH * qxA * qxC) / corrQQx, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("v2/vnAxCyUx_eta_MH"), track.eta(), centrality, (uxMH * qyA * qyC) / corrQQy, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("v2/vnAxCyUy_eta_MH"), track.eta(), centrality, (uyMH * qxA * qyC) / corrQQx, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("v2/vnAyCxUy_eta_MH"), track.eta(), centrality, (uyMH * qyA * qxC) / corrQQy, weight); - - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("v2/vnAxCxUx_pt_MH"), track.pt(), centrality, (uxMH * qxA * qxC) / corrQQx, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("v2/vnAxCyUx_pt_MH"), track.pt(), centrality, (uxMH * qyA * qyC) / corrQQy, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("v2/vnAxCyUy_pt_MH"), track.pt(), centrality, (uyMH * qxA * qyC) / corrQQx, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("v2/vnAyCxUy_pt_MH"), track.pt(), centrality, (uyMH * qyA * qxC) / corrQQy, weight); - - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("v2/vnAxCxUx_cent_MH"), centrality, (uxMH * qxA * qxC) / corrQQx, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("v2/vnAxCyUx_cent_MH"), centrality, (uxMH * qyA * qyC) / corrQQy, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("v2/vnAxCyUy_cent_MH"), centrality, (uyMH * qxA * qyC) / corrQQx, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("v2/vnAyCxUy_cent_MH"), centrality, (uyMH * qyA * qxC) / corrQQy, weight); - - // -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("v3/vnAxCxUx_eta_MH"), track.eta(), centrality, (uxMH2 * qxA * qxC) / corrQQx, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("v3/vnAxCyUx_eta_MH"), track.eta(), centrality, (uxMH2 * qyA * qyC) / corrQQy, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("v3/vnAxCyUy_eta_MH"), track.eta(), centrality, (uyMH2 * qxA * qyC) / corrQQx, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("v3/vnAyCxUy_eta_MH"), track.eta(), centrality, (uyMH2 * qyA * qxC) / corrQQy, weight); - - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("v3/vnAxCxUx_pt_MH"), track.pt(), centrality, (uxMH2 * qxA * qxC) / corrQQx, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("v3/vnAxCyUx_pt_MH"), track.pt(), centrality, (uxMH2 * qyA * qyC) / corrQQy, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("v3/vnAxCyUy_pt_MH"), track.pt(), centrality, (uyMH2 * qxA * qyC) / corrQQx, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("v3/vnAyCxUy_pt_MH"), track.pt(), centrality, (uyMH2 * qyA * qxC) / corrQQy, weight); - - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("v3/vnAxCxUx_cent_MH"), centrality, (uxMH2 * qxA * qxC) / corrQQx, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("v3/vnAxCyUx_cent_MH"), centrality, (uxMH2 * qyA * qyC) / corrQQy, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("v3/vnAxCyUy_cent_MH"), centrality, (uyMH2 * qxA * qyC) / corrQQx, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("v3/vnAyCxUy_cent_MH"), centrality, (uyMH2 * qyA * qxC) / corrQQy, weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCxUx_eta_MH"), track.eta(), centrality, (uxMH * qxA * qxC) / corrQQx, weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCyUx_eta_MH"), track.eta(), centrality, (uxMH * qyA * qyC) / corrQQy, weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCyUy_eta_MH"), track.eta(), centrality, (uyMH * qxA * qyC) / corrQQx, weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAyCxUy_eta_MH"), track.eta(), centrality, (uyMH * qyA * qxC) / corrQQy, weight); + + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCxUx_pt_MH"), track.pt(), centrality, (uxMH * qxA * qxC) / corrQQx, weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCyUx_pt_MH"), track.pt(), centrality, (uxMH * qyA * qyC) / corrQQy, weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCyUy_pt_MH"), track.pt(), centrality, (uyMH * qxA * qyC) / corrQQx, weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAyCxUy_pt_MH"), track.pt(), centrality, (uyMH * qyA * qxC) / corrQQy, weight); + + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCxUx_cent_MH"), centrality, (uxMH * qxA * qxC) / corrQQx, weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCyUx_cent_MH"), centrality, (uxMH * qyA * qyC) / corrQQy, weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCyUy_cent_MH"), centrality, (uyMH * qxA * qyC) / corrQQx, weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAyCxUy_cent_MH"), centrality, (uyMH * qyA * qxC) / corrQQy, weight); } if (cfgFillXandYterms) { @@ -1196,6 +1179,10 @@ struct FlowSP { fillTrackQA(track, vtxz, centrality, wacc, weff); } fillPIDQA(track); + + if (!cfgFillChargeDependenceQA) + return; + if (pos) { if (!cfgTrackSelDoTrackQAvsCent) { fillTrackQA(track, vtxz, waccP, weffP); @@ -1350,19 +1337,20 @@ struct FlowSP { bool pos = (track.sign() > 0) ? true : false; if (cfgFillQABefore) { - switch (trackPID) { - case kUnidentified: - fillAllQA(track, vtxz, centrality, pos); - break; - case kPions: - fillAllQA(track, vtxz, centrality, pos); - break; - case kKaons: - fillAllQA(track, vtxz, centrality, pos); - break; - case kProtons: - fillAllQA(track, vtxz, centrality, pos); - break; + fillAllQA(track, vtxz, centrality, pos); + + if (cfgFillPIDQA) { + switch (trackPID) { + case kPions: + fillAllQA(track, vtxz, centrality, pos); + break; + case kKaons: + fillAllQA(track, vtxz, centrality, pos); + break; + case kProtons: + fillAllQA(track, vtxz, centrality, pos); + break; + } } } @@ -1397,19 +1385,20 @@ struct FlowSP { histos.fill(HIST("hTrackCount"), trackSel_ParticleWeights); - switch (trackPID) { - case kUnidentified: - fillAllQA(track, vtxz, centrality, pos, wacc, weff, waccP, weffP, waccN, weffN); - break; - case kPions: - fillAllQA(track, vtxz, centrality, pos, wacc, weff, waccP, weffP, waccN, weffN); - break; - case kKaons: - fillAllQA(track, vtxz, centrality, pos, wacc, weff, waccP, weffP, waccN, weffN); - break; - case kProtons: - fillAllQA(track, vtxz, centrality, pos, wacc, weff, waccP, weffP, waccN, weffN); - break; + fillAllQA(track, vtxz, centrality, pos, wacc, weff, waccP, weffP, waccN, weffN); + + if (cfgFillPIDQA) { + switch (trackPID) { + case kPions: + fillAllQA(track, vtxz, centrality, pos, wacc, weff, waccP, weffP, waccN, weffN); + break; + case kKaons: + fillAllQA(track, vtxz, centrality, pos, wacc, weff, waccP, weffP, waccN, weffN); + break; + case kProtons: + fillAllQA(track, vtxz, centrality, pos, wacc, weff, waccP, weffP, waccN, weffN); + break; + } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1418,45 +1407,42 @@ struct FlowSP { auto uxMH = std::cos(cfgHarmMixed1 * phi); auto uyMH = std::sin(cfgHarmMixed1 * phi); - - auto uxMH2 = std::cos(cfgHarmMixed2 * phi); - auto uyMH2 = std::sin(cfgHarmMixed2 * phi); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - double vnA = std::cos(cfgHarm * (phi - psiA)) / evPlaneRes; double vnC = std::cos(cfgHarm * (phi - psiC)) / evPlaneRes; double vnFull = std::cos(cfgHarm * (phi - psiFull)) / evPlaneRes; - fillHistograms(track, wacc, weff, centWeight, ux, uy, uxMH, uyMH, uxMH2, uyMH2, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); + fillHistograms(track, wacc, weff, centWeight, ux, uy, uxMH, uyMH, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); // NOTE: these are not the right wacc and weff!! Need to do for each particle species! This is just to test for now. if (cfgFillPID) { if (trackPID == kPions) { - fillHistograms(track, wacc, weff, centWeight, ux, uy, uxMH, uyMH, uxMH2, uyMH2, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); + fillHistograms(track, wacc, weff, centWeight, ux, uy, uxMH, uyMH, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); if (pos) - fillHistograms(track, waccP, weffP, centWeight, ux, uy, uxMH, uyMH, uxMH2, uyMH2, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); + fillHistograms(track, waccP, weffP, centWeight, ux, uy, uxMH, uyMH, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); else - fillHistograms(track, waccN, weffN, centWeight, ux, uy, uxMH, uyMH, uxMH2, uyMH2, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); + fillHistograms(track, waccN, weffN, centWeight, ux, uy, uxMH, uyMH, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); } else if (trackPID == kKaons) { - fillHistograms(track, wacc, weff, centWeight, ux, uy, uxMH, uyMH, uxMH2, uyMH2, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); + fillHistograms(track, wacc, weff, centWeight, ux, uy, uxMH, uyMH, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); if (pos) - fillHistograms(track, waccP, weffP, centWeight, ux, uy, uxMH, uyMH, uxMH2, uyMH2, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); + fillHistograms(track, waccP, weffP, centWeight, ux, uy, uxMH, uyMH, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); else - fillHistograms(track, waccN, weffN, centWeight, ux, uy, uxMH, uyMH, uxMH2, uyMH2, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); + fillHistograms(track, waccN, weffN, centWeight, ux, uy, uxMH, uyMH, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); } else if (trackPID == kProtons) { - fillHistograms(track, wacc, weff, centWeight, ux, uy, uxMH, uyMH, uxMH2, uyMH2, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); + fillHistograms(track, wacc, weff, centWeight, ux, uy, uxMH, uyMH, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); if (pos) - fillHistograms(track, waccP, weffP, centWeight, ux, uy, uxMH, uyMH, uxMH2, uyMH2, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); + fillHistograms(track, waccP, weffP, centWeight, ux, uy, uxMH, uyMH, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); else - fillHistograms(track, waccN, weffN, centWeight, ux, uy, uxMH, uyMH, uxMH2, uyMH2, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); + fillHistograms(track, waccN, weffN, centWeight, ux, uy, uxMH, uyMH, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); } } if (cfgFillChargeDependence) { if (pos) { - fillHistograms(track, waccP, weffP, centWeight, ux, uy, uxMH, uyMH, uxMH2, uyMH2, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); + fillHistograms(track, waccP, weffP, centWeight, ux, uy, uxMH, uyMH, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); } else { - fillHistograms(track, waccN, weffN, centWeight, ux, uy, uxMH, uyMH, uxMH2, uyMH2, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); + fillHistograms(track, waccN, weffN, centWeight, ux, uy, uxMH, uyMH, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); } } } // end of track loop @@ -1510,33 +1496,53 @@ struct FlowSP { histos.fill(HIST("hTrackCount"), trackSel_ZeroCharge); fillMCPtHistos(track, mcParticle.pdgCode(), centrality); - bool pos = (track.sign() > 0) ? true : false; - fillPrimaryHistos(mcParticle, centrality); + if (!mcParticle.isPhysicalPrimary()) + continue; + + bool pos = (track.sign() > 0) ? true : false; + // This neglects PID (for now) later use getPID like in data. if (cfgFillQABefore) { + fillAllQA(track, vtxz, centrality, pos); + + if (cfgFillPIDQA) { + switch (std::abs(mcParticle.pdgCode())) { + case kPions: + fillAllQA(track, vtxz, centrality, pos); + break; + case kKaons: + fillAllQA(track, vtxz, centrality, pos); + break; + case kProtons: + fillAllQA(track, vtxz, centrality, pos); + break; + } + } + } + + if (!trackSelected(track, field)) + continue; + + fillMCPtHistos(track, mcParticle.pdgCode(), centrality); + + fillAllQA(track, vtxz, centrality, pos); + + if (cfgFillPIDQA) { switch (std::abs(mcParticle.pdgCode())) { case kPions: - fillAllQA(track, vtxz, centrality, pos); + fillAllQA(track, vtxz, centrality, pos); break; case kKaons: - fillAllQA(track, vtxz, centrality, pos); + fillAllQA(track, vtxz, centrality, pos); break; case kProtons: - fillAllQA(track, vtxz, centrality, pos); + fillAllQA(track, vtxz, centrality, pos); break; - default: - fillAllQA(track, vtxz, centrality, pos); } } - if (!trackSelected(track, field)) - continue; - - fillMCPtHistos(track, mcParticle.pdgCode(), centrality); - - fillTrackQA(track, vtxz); fillPrimaryHistos(mcParticle, centrality); } // end of track loop @@ -1618,6 +1624,11 @@ struct FlowSP { if (std::fabs(charge) < 1) continue; + int minVal = 100; + if (cfgFilterLeptons && std::fabs(pdgCode) < minVal) { + continue; + } + bool pos = (charge > 0) ? true : false; fillMCPtHistos(particle, pdgCode, centrality); From a093eb1a33914cf1de780b2ea27e5abe49138d2f Mon Sep 17 00:00:00 2001 From: Marvin Hemmer <53471402+mhemmer-cern@users.noreply.github.com> Date: Wed, 3 Sep 2025 19:53:31 +0200 Subject: [PATCH 293/986] [Common,PWGHF] fix wrong CBT_Calo naming for rct flag (#12840) --- Common/CCDB/RCTSelectionFlags.h | 10 ++++++---- PWGHF/Utils/utilsEvSelHf.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Common/CCDB/RCTSelectionFlags.h b/Common/CCDB/RCTSelectionFlags.h index 1f396751c25..5f04cb42c90 100644 --- a/Common/CCDB/RCTSelectionFlags.h +++ b/Common/CCDB/RCTSelectionFlags.h @@ -18,11 +18,13 @@ #define COMMON_CCDB_RCTSELECTIONFLAGS_H_ #include -#include + #include -#include +#include + #include +#include #include #include @@ -98,7 +100,7 @@ class RCTFlagsChecker : public o2::utils::EnumFlags // - "CBT" // - "CBT_hadronPID" // - "CBT_electronPID" - // - "CCBT_calo" + // - "CBT_calo" // - "CBT_muon" // - "CBT_muon_glo" // The checkZDC boolean flag controls whether to iclude the ZDC quality in all the pre-defined selections (for Pb-Pb data) @@ -121,7 +123,7 @@ class RCTFlagsChecker : public o2::utils::EnumFlags // - "CBT" // - "CBT_hadronPID" // - "CBT_electronPID" - // - "CCBT_calo" + // - "CBT_calo" // - "CBT_muon" // - "CBT_muon_glo" // The checkZDC boolean flag controls whether to iclude the ZDC quality in all the pre-defined selections (for Pb-Pb data) diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index f53b199d62a..eac38fbfaf3 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -176,7 +176,7 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { o2::framework::ConfigurableAxis th2ConfigAxisCent{"th2ConfigAxisCent", {100, 0., 100.}, ""}; o2::framework::ConfigurableAxis th2ConfigAxisOccupancy{"th2ConfigAxisOccupancy", {100, 0, 100000}, ""}; o2::framework::Configurable requireGoodRct{"requireGoodRct", false, "Flag to require good RCT"}; - o2::framework::Configurable rctLabel{"rctLabel", "CBT_hadronPID", "RCT selection flag (CBT, CBT_hadronPID, CBT_electronPID, CCBT_calo, CBT_muon, CBT_muon_glo)"}; + o2::framework::Configurable rctLabel{"rctLabel", "CBT_hadronPID", "RCT selection flag (CBT, CBT_hadronPID, CBT_electronPID, CBT_calo, CBT_muon, CBT_muon_glo)"}; o2::framework::Configurable rctCheckZDC{"rctCheckZDC", false, "RCT flag to check whether the ZDC is present or not"}; o2::framework::Configurable rctTreatLimitedAcceptanceAsBad{"rctTreatLimitedAcceptanceAsBad", false, "RCT flag to reject events with limited acceptance for selected detectors"}; From 90a2ae831ffb5c3bdaded8f542bf1a395c3ba7d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Mart=C3=ADnez=20Garc=C3=ADa?= Date: Wed, 3 Sep 2025 12:01:17 -0600 Subject: [PATCH 294/986] [PWGUD] constraining phi range (#12836) --- PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx | 26 +++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx b/PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx index d0b69e05aaf..2f964f71a85 100644 --- a/PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx +++ b/PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx @@ -148,7 +148,7 @@ struct UpcPhotonuclearAnalysisJMG { "Pair cuts on various particles"}; Configurable cfgTwoTrackCut{"cfgTwoTrackCut", -1, {"Two track cut"}}; ConfigurableAxis axisVertex{"axisVertex", {10, -10, 10}, "vertex axis for histograms"}; - ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -constants::math::PIHalf, constants::math::PIHalf * 3}, "delta phi axis for histograms"}; + ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -PIHalf, kThreeHalfPi}, "delta phi axis for histograms"}; ConfigurableAxis axisDeltaEta{"axisDeltaEta", {40, -2, 2}, "delta eta axis for histograms"}; ConfigurableAxis axisPtTrigger{"axisPtTrigger", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 10.0}, "pt trigger axis for histograms"}; ConfigurableAxis axisPtAssoc{"axisPtAssoc", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0}, "pt associated axis for histograms"}; @@ -416,8 +416,9 @@ struct UpcPhotonuclearAnalysisJMG { if (isTrackCut(track) == false) { continue; } + float phiVal = RecoDecay::constrainAngle(phi(track.px(), track.py()), 0.f, TwoPI); histos.fill(HIST("yields"), multiplicity, track.pt(), eta(track.px(), track.py(), track.pz())); - histos.fill(HIST("etaphi"), multiplicity, eta(track.px(), track.py(), track.pz()), phi(track.px(), track.py())); + histos.fill(HIST("etaphi"), multiplicity, eta(track.px(), track.py(), track.pz()), phiVal); } } @@ -449,7 +450,7 @@ struct UpcPhotonuclearAnalysisJMG { continue; }*/ float deltaPhi = phi(track1.px(), track1.py()) - phi(track2.px(), track2.py()); - deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf, kThreeHalfPi); + deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, eta(track1.px(), track1.py(), track1.pz()) - eta(track2.px(), track2.py(), track2.pz()), track2.pt(), track1.pt(), multiplicity, deltaPhi, posZ, 1.0); } } @@ -529,8 +530,9 @@ struct UpcPhotonuclearAnalysisJMG { if (isTrackCut(track) == false) { continue; } - histos.fill(HIST("etaphiVtx"), reconstructedCollision.posZ(), eta(track.px(), track.py(), track.pz()), phi(track.px(), track.py())); - histos.fill(HIST("Tracks/hTrackPhiBeforeCorr"), phi(track.px(), track.py())); + float phiVal = RecoDecay::constrainAngle(phi(track.px(), track.py()), 0.f, TwoPI); + histos.fill(HIST("etaphiVtx"), reconstructedCollision.posZ(), eta(track.px(), track.py(), track.pz()), phiVal); + histos.fill(HIST("Tracks/hTrackPhiBeforeCorr"), phiVal); } switch (sgSide) { @@ -559,14 +561,15 @@ struct UpcPhotonuclearAnalysisJMG { } nTracksCharged++; sumPt += track.pt(); + float phiVal = RecoDecay::constrainAngle(phi(track.px(), track.py()), 0.f, TwoPI); histos.fill(HIST("Tracks/SGsideA/hTrackPt"), track.pt()); - histos.fill(HIST("Tracks/SGsideA/hTrackPhi"), phi(track.px(), track.py())); + histos.fill(HIST("Tracks/SGsideA/hTrackPhi"), phiVal); histos.fill(HIST("Tracks/SGsideA/hTrackEta"), eta(track.px(), track.py(), track.pz())); histos.fill(HIST("Tracks/SGsideA/hTrackTPCSignnalP"), momentum(track.px(), track.py(), track.pz()) * track.sign(), track.tpcSignal()); histos.fill(HIST("Tracks/SGsideA/hTrackTOFSignnalP"), momentum(track.px(), track.py(), track.pz()) * track.sign(), track.tofSignal()); vTrackPtSideA.push_back(track.pt()); vTrackEtaSideA.push_back(eta(track.px(), track.py(), track.pz())); - vTrackPhiSideA.push_back(phi(track.px(), track.py())); + vTrackPhiSideA.push_back(phiVal); vTrackTPCSignalSideA.push_back(track.tpcSignal()); vTrackTOFSignalSideA.push_back(track.tofSignal()); vTrackTPCNSigmaPiSideA.push_back(track.tpcNSigmaPi()); @@ -618,14 +621,15 @@ struct UpcPhotonuclearAnalysisJMG { } nTracksCharged++; sumPt += track.pt(); + float phiVal = RecoDecay::constrainAngle(phi(track.px(), track.py()), 0.f, TwoPI); histos.fill(HIST("Tracks/SGsideC/hTrackPt"), track.pt()); - histos.fill(HIST("Tracks/SGsideC/hTrackPhi"), phi(track.px(), track.py())); + histos.fill(HIST("Tracks/SGsideC/hTrackPhi"), phiVal); histos.fill(HIST("Tracks/SGsideC/hTrackEta"), eta(track.px(), track.py(), track.pz())); histos.fill(HIST("Tracks/SGsideC/hTrackTPCSignnalP"), momentum(track.px(), track.py(), track.pz()) * track.sign(), track.tpcSignal()); histos.fill(HIST("Tracks/SGsideC/hTrackTOFSignnalP"), momentum(track.px(), track.py(), track.pz()) * track.sign(), track.tofSignal()); vTrackPtSideC.push_back(track.pt()); vTrackEtaSideC.push_back(eta(track.px(), track.py(), track.pz())); - vTrackPhiSideC.push_back(phi(track.px(), track.py())); + vTrackPhiSideC.push_back(phiVal); vTrackTPCSignalSideC.push_back(track.tpcSignal()); vTrackTOFSignalSideC.push_back(track.tofSignal()); vTrackTPCNSigmaPiSideC.push_back(track.tpcNSigmaPi()); @@ -855,8 +859,8 @@ struct UpcPhotonuclearAnalysisJMG { ++multiplicity; float weightNUA = getNUAWeight(reconstructedCollision.posZ(), eta(track.px(), track.py(), track.pz()), phi(track.px(), track.py())); - - histos.fill(HIST("Tracks/hTrackPhiAfterCorr"), phi(track.px(), track.py()), weightNUA); + float phiVal = RecoDecay::constrainAngle(phi(track.px(), track.py()), 0.f, TwoPI); + histos.fill(HIST("Tracks/hTrackPhiAfterCorr"), phiVal, weightNUA); } // multiplicity = reconstructedTracks.size(); if (fillCollisionUD(same, multiplicity) == false) { From 65633140ae7fc9d2827a776e0da775d775bd838b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= <26327373+vkucera@users.noreply.github.com> Date: Wed, 3 Sep 2025 20:40:04 +0200 Subject: [PATCH 295/986] [PWGHF] correlatorFlowCharmHadrons: Fix missing using directives (#12847) --- PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx index ec5f2a40c19..dcf48645fe4 100644 --- a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx @@ -45,6 +45,8 @@ #include using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; using namespace o2::hf_centrality; using namespace o2::hf_evsel; From dbefb2e34cefa7ba9aad8e4941645a8e8340b678 Mon Sep 17 00:00:00 2001 From: Gyula Bencedi Date: Wed, 3 Sep 2025 21:59:14 +0200 Subject: [PATCH 296/986] [PWGLF] Updated with propagateToDCAhelix method (#12844) --- PWGMM/Mult/DataModel/bestCollisionTable.h | 23 +++ PWGMM/Mult/TableProducer/CMakeLists.txt | 2 +- ...tion.cxx => ambiguousTrackPropagation.cxx} | 172 ++++++++++++++---- 3 files changed, 159 insertions(+), 38 deletions(-) rename PWGMM/Mult/TableProducer/{trackPropagation.cxx => ambiguousTrackPropagation.cxx} (70%) diff --git a/PWGMM/Mult/DataModel/bestCollisionTable.h b/PWGMM/Mult/DataModel/bestCollisionTable.h index 0abde63f3cc..0b4ee5440bc 100644 --- a/PWGMM/Mult/DataModel/bestCollisionTable.h +++ b/PWGMM/Mult/DataModel/bestCollisionTable.h @@ -8,6 +8,13 @@ // 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 bestCollisionTable.h +/// \brief This code produces tables including central and MFT tracks based on smallest DCAxy/DCAz approach +/// \author Anton Alkin +/// \author Sarah Herrmann +/// \author Gyula Bencedi +/// \author Tulika Tripathy #ifndef PWGMM_MULT_DATAMODEL_BESTCOLLISIONTABLE_H_ #define PWGMM_MULT_DATAMODEL_BESTCOLLISIONTABLE_H_ @@ -33,6 +40,7 @@ DECLARE_SOA_COLUMN(AmbDegree, ambDegree, int); // degree of ambiguity of the tra DECLARE_SOA_COLUMN(BestDCAXY, bestDCAXY, float); DECLARE_SOA_COLUMN(BestDCAX, bestDCAX, float); DECLARE_SOA_COLUMN(BestDCAY, bestDCAY, float); +DECLARE_SOA_COLUMN(BestDCAZ, bestDCAZ, float); DECLARE_SOA_COLUMN(PtStatic, pts, float); DECLARE_SOA_COLUMN(PStatic, ps, float); DECLARE_SOA_COLUMN(EtaStatic, etas, float); @@ -49,12 +57,27 @@ DECLARE_SOA_TABLE(BestCollisionsFwd, "AOD", "BESTCOLLFWD", o2::soa::Index<>, pwg aod::fwdtrack::BestCollisionId, aod::fwdtrack::BestDCAXY, fwdtrack::BestDCAX, fwdtrack::BestDCAY); // beware: depending on which process produced this table, // it can be joined with either MFTAmbiguousTracks OR MFTTracks + DECLARE_SOA_TABLE(BestCollFwdExtra, "AOD", "BESTCOLLFWDE", fwdtrack::X, fwdtrack::Y, fwdtrack::Z, fwdtrack::Tgl, fwdtrack::Signed1Pt, fwdtrack::PtStatic, fwdtrack::PStatic, fwdtrack::EtaStatic, fwdtrack::PhiStatic); // Snp does not exist +DECLARE_SOA_TABLE(BestCollisionsFwd3d, "AOD", "BESTCOLLFWD3D", + o2::soa::Index<>, + pwgmm::indices::MFTTrackId, + aod::fwdtrack::AmbDegree, + aod::fwdtrack::BestCollisionId, + aod::fwdtrack::BestDCAXY, + aod::fwdtrack::BestDCAZ); + +DECLARE_SOA_TABLE(BestCollisionsFwd3dExtra, "AOD", "BESTCOLLFWD3DE", + fwdtrack::X, fwdtrack::Y, + fwdtrack::Z, fwdtrack::Tgl, fwdtrack::Signed1Pt, + fwdtrack::PtStatic, fwdtrack::PStatic, fwdtrack::EtaStatic, + fwdtrack::PhiStatic); // Snp does not exist + DECLARE_SOA_TABLE(ReassignedTracksCore, "AOD", "CRRETRACKS", aod::track::BestCollisionId, pwgmm::indices::TrackId, diff --git a/PWGMM/Mult/TableProducer/CMakeLists.txt b/PWGMM/Mult/TableProducer/CMakeLists.txt index 9b1ddb5e997..4d5bf59fe89 100644 --- a/PWGMM/Mult/TableProducer/CMakeLists.txt +++ b/PWGMM/Mult/TableProducer/CMakeLists.txt @@ -25,7 +25,7 @@ o2physics_add_dpl_workflow(reducer-post COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(track-propagation - SOURCES trackPropagation.cxx + SOURCES ambiguousTrackPropagation.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2::ReconstructionDataFormats O2::DetectorsCommonDataFormats COMPONENT_NAME Analysis) diff --git a/PWGMM/Mult/TableProducer/trackPropagation.cxx b/PWGMM/Mult/TableProducer/ambiguousTrackPropagation.cxx similarity index 70% rename from PWGMM/Mult/TableProducer/trackPropagation.cxx rename to PWGMM/Mult/TableProducer/ambiguousTrackPropagation.cxx index 8eaa59e850b..eebaa5595ef 100644 --- a/PWGMM/Mult/TableProducer/trackPropagation.cxx +++ b/PWGMM/Mult/TableProducer/ambiguousTrackPropagation.cxx @@ -8,33 +8,38 @@ // 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 ambiguousTrackPropagation.cxx +/// \brief This code loops over central and MFT tracks and among the compatible +/// collisions to this track, picks the one with the smallest DCAxy/DCAz and puts it +/// in a table +/// \author Anton Alkin +/// \author Sarah Herrmann +/// \author Gyula Bencedi +/// \author Tulika Tripathy -// \file trackPropagation.cxx -// \author Anton Alkin -// \author Sarah Herrmann -// -// \brief This code loops over central and MFT tracks and among the compatible -// collisions to this track, picks the one with the smallest DCAxy and puts it -// in a table +#include "bestCollisionTable.h" -#include "CCDB/BasicCCDBManager.h" #include "Common/Core/trackUtilities.h" +#include "Common/DataModel/CollisionAssociationTables.h" #include "Common/DataModel/TrackSelectionTables.h" + +#include "CCDB/BasicCCDBManager.h" #include "CommonConstants/GeomConstants.h" #include "DataFormatsParameters/GRPMagField.h" #include "DetectorsBase/Propagator.h" +#include "Field/MagneticField.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/TrackFwd.h" + #include "Math/MatrixFunctions.h" #include "Math/SMatrix.h" - -#include "Field/MagneticField.h" #include "TGeoGlobalMagField.h" -#include "Common/DataModel/CollisionAssociationTables.h" -#include "bestCollisionTable.h" +#include +#include using SMatrix55 = ROOT::Math::SMatrix>; using SMatrix5 = ROOT::Math::SVector; @@ -46,26 +51,25 @@ using namespace o2; using namespace o2::framework; using namespace o2::aod::track; -AxisSpec DCAxyAxis = {500, -1, 50}; - struct AmbiguousTrackPropagation { - // Produces tracksBestCollisions; Produces fwdtracksBestCollisions; + Produces fwdtracksBestCollisions3d; + Produces fwdtracksBestCollisions3dExtra; Produces fwdtracksBestCollExtra; Produces tracksReassignedCore; Produces tracksReassignedExtra; Service ccdb; int runNumber = -1; - float Bz = 0; // Magnetic field for MFT - static constexpr double centerMFT[3] = {0, 0, -61.4}; // Field at center of MFT + float bZ = 0; // Magnetic field for MFT + static constexpr double kCenterMFT[3] = {0, 0, -61.4}; // Field at center of MFT o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; o2::parameters::GRPMagField* grpmag = nullptr; - Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; Configurable mVtxPath{"mVtxPath", "GLO/Calib/MeanVertex", "Path of the mean vertex file"}; @@ -73,6 +77,9 @@ struct AmbiguousTrackPropagation { Configurable produceExtra{"produceExtra", false, "Produce table with refitted track parameters"}; Configurable produceHistos{"produceHistos", false, "Produce control histograms"}; + ConfigurableAxis binsDCAxy{"binsDCAxy", {200, -1., 1.}, ""}; + ConfigurableAxis binsDCAz{"binsDCAz", {200, -1., 1.}, ""}; + HistogramRegistry registry{ "registry", { @@ -84,18 +91,27 @@ struct AmbiguousTrackPropagation { void init(o2::framework::InitContext& /*initContext*/) { + + AxisSpec dcaXYAxis = {binsDCAxy, "dcaXYAxis", "dcaXYAxis"}; + AxisSpec dcaZAxis = {binsDCAz, "dcaZAxis", "dcaZAxis"}; + ccdb->setURL(ccdburl); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); if (produceHistos) { - if (doprocessMFT || doprocessMFTReassoc) { + if (doprocessMFT || doprocessMFTReassoc || doprocessMFTReassoc3D) { registry.add({"DeltaZ", " ; #Delta#it{z}", {HistType::kTH1F, {{201, -10.1, 10.1}}}}); - registry.add({"TracksDCAXY", " ; DCA_{XY} (cm)", {HistType::kTH1F, {DCAxyAxis}}}); - registry.add({"ReassignedDCAXY", " ; DCA_{XY} (cm)", {HistType::kTH1F, {DCAxyAxis}}}); - registry.add({"TracksOrigDCAXY", " ; DCA_{XY} (wrt orig coll) (cm)", {HistType::kTH1F, {DCAxyAxis}}}); + registry.add({"TracksDCAXY", " ; DCA_{XY} (cm)", {HistType::kTH1F, {dcaXYAxis}}}); + registry.add({"ReassignedDCAXY", " ; DCA_{XY} (cm)", {HistType::kTH1F, {dcaXYAxis}}}); + registry.add({"TracksOrigDCAXY", " ; DCA_{XY} (wrt orig coll) (cm)", {HistType::kTH1F, {dcaXYAxis}}}); registry.add({"TracksAmbDegree", " ; N_{coll}^{comp}", {HistType::kTH1D, {{41, -0.5, 40.5}}}}); registry.add({"TrackIsAmb", " ; isAmbiguous", {HistType::kTH1D, {{2, -0.5, 1.5}}}}); + if (doprocessMFTReassoc3D) { + registry.add({"TracksDCAZ", " ; DCA_{Z} (cm)", {HistType::kTH1F, {dcaZAxis}}}); + registry.add({"ReassignedDCAZ", " ; DCA_{Z} (cm)", {HistType::kTH1F, {dcaZAxis}}}); + registry.add({"TracksOrigDCAZ", " ; DCA_{Z} (wrt orig coll) (cm)", {HistType::kTH1F, {dcaZAxis}}}); + } } if (doprocessCentral) { registry.add({"PropagationFailures", "", {HistType::kTH1F, {{5, 0.5, 5.5}}}}); @@ -122,18 +138,18 @@ struct AmbiguousTrackPropagation { o2::base::Propagator::initFieldFromGRP(grpmag); runNumber = bc.runNumber(); - if (doprocessMFT || doprocessMFTReassoc) { + if (doprocessMFT || doprocessMFTReassoc || doprocessMFTReassoc3D) { o2::field::MagneticField* field = static_cast(TGeoGlobalMagField::Instance()->GetField()); - Bz = field->getBz(centerMFT); - LOG(info) << "The field at the center of the MFT is Bz = " << Bz; + bZ = field->getBz(kCenterMFT); + LOG(info) << "The field at the center of the MFT is bZ = " << bZ; } } - static constexpr TrackSelectionFlags::flagtype trackSelectionITS = + static constexpr TrackSelectionFlags::flagtype kTrackSelectionITS = TrackSelectionFlags::kITSNCls | TrackSelectionFlags::kITSChi2NDF | TrackSelectionFlags::kITSHits; - static constexpr TrackSelectionFlags::flagtype trackSelectionTPC = + static constexpr TrackSelectionFlags::flagtype kTrackSelectionTPC = TrackSelectionFlags::kTPCNCls | TrackSelectionFlags::kTPCCrossedRowsOverNCls | TrackSelectionFlags::kTPCChi2NDF; @@ -153,18 +169,18 @@ struct AmbiguousTrackPropagation { std::array dcaInfo; float bestDCA[2]; o2::track::TrackParametrization bestTrackPar; - for (auto& track : tracks) { + for (auto const& track : tracks) { dcaInfo[0] = track.dcaXY(); // DCAxy dcaInfo[1] = track.dcaZ(); // DCAz bestDCA[0] = dcaInfo[0]; bestDCA[1] = dcaInfo[1]; auto bestCol = track.has_collision() ? track.collisionId() : -1; - if ((track.trackCutFlag() & trackSelectionITS) != trackSelectionITS) { + if ((track.trackCutFlag() & kTrackSelectionITS) != kTrackSelectionITS) { continue; } if ((track.detectorMap() & (uint8_t)o2::aod::track::TPC) == (uint8_t)o2::aod::track::TPC) { - if ((track.trackCutFlag() & trackSelectionTPC) != trackSelectionTPC) { + if ((track.trackCutFlag() & kTrackSelectionTPC) != kTrackSelectionTPC) { continue; } } @@ -181,7 +197,7 @@ struct AmbiguousTrackPropagation { } auto compatibleColls = track.compatibleColl(); int failures = 0; - for (auto& collision : compatibleColls) { + for (auto const& collision : compatibleColls) { auto propagated = o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackPar, 2.f, matCorr, &dcaInfo); if (!propagated) { ++failures; @@ -239,7 +255,7 @@ struct AmbiguousTrackPropagation { float bestDCA = 0.f, bestDCAx = 0.f, bestDCAy = 0.f; o2::track::TrackParCovFwd bestTrackPar; - for (auto& atrack : atracks) { + for (auto const& atrack : atracks) { dcaInfo = 999; // DCAxy bestDCA = 999; @@ -254,14 +270,14 @@ struct AmbiguousTrackPropagation { int degree = 0; // degree of ambiguity of the track auto compatibleBCs = atrack.bc_as(); - for (auto& bc : compatibleBCs) { + for (auto const& bc : compatibleBCs) { if (!bc.has_collisions()) { continue; } auto collisions = bc.collisions(); for (auto const& collision : collisions) { degree++; - trackPar.propagateToZhelix(collision.posZ(), Bz); // track parameters propagation to the position of the z vertex + trackPar.propagateToZhelix(collision.posZ(), bZ); // track parameters propagation to the position of the z vertex const auto dcaX(trackPar.getX() - collision.posX()); const auto dcaY(trackPar.getY() - collision.posY()); @@ -325,7 +341,7 @@ struct AmbiguousTrackPropagation { float bestDCA = 0.f, bestDCAx = 0.f, bestDCAy = 0.f; o2::track::TrackParCovFwd bestTrackPar; - for (auto& track : tracks) { + for (auto const& track : tracks) { dcaInfo = 999; // DCAxy bestDCA = 999; @@ -345,9 +361,9 @@ struct AmbiguousTrackPropagation { SMatrix5 tpars(track.x(), track.y(), track.phi(), track.tgl(), track.signed1Pt()); o2::track::TrackParCovFwd trackPar{track.z(), tpars, tcovs, track.chi2()}; - for (auto& collision : compatibleColls) { + for (auto const& collision : compatibleColls) { - trackPar.propagateToZhelix(collision.posZ(), Bz); // track parameters propagation to the position of the z vertex + trackPar.propagateToZhelix(collision.posZ(), bZ); // track parameters propagation to the position of the z vertex const auto dcaX(trackPar.getX() - collision.posX()); const auto dcaY(trackPar.getY() - collision.posY()); @@ -394,6 +410,88 @@ struct AmbiguousTrackPropagation { } } PROCESS_SWITCH(AmbiguousTrackPropagation, processMFTReassoc, "Fill BestCollisionsFwd for MFT ambiguous tracks with the new data model", false); + + void processMFTReassoc3D(MFTTracksWColls const& tracks, aod::Collisions const&, ExtBCs const& bcs) + { + if (bcs.size() == 0) { + return; + } + if (tracks.size() == 0) { + return; + } + auto bc = bcs.begin(); + initCCDB(bc); + + std::array dcaInfOrig; + std::array dcaInfo; + double bestDCA[2]; + o2::track::TrackParCovFwd bestTrackPar; + + for (auto const& track : tracks) { + dcaInfOrig[0] = 999.f; // original DCAx from propagation + dcaInfOrig[1] = 999.f; // original DCAy from propagation + dcaInfOrig[2] = 999.f; // original DCAz from propagation + dcaInfo[0] = 999.f; // calcualted DCAxy + dcaInfo[1] = 999.f; // calculated DCAz - same as original + bestDCA[0] = 999.f; // minimal DCAxy + bestDCA[1] = 999.f; // minimal DCAz + + auto bestCol = track.has_collision() ? track.collisionId() : -1; + auto compatibleColls = track.compatibleColl(); + + std::vector v1; // Temporary null vector for the computation of the covariance matrix + SMatrix55 tcovs(v1.begin(), v1.end()); + SMatrix5 tpars(track.x(), track.y(), track.phi(), track.tgl(), track.signed1Pt()); + o2::track::TrackParCovFwd trackPar{track.z(), tpars, tcovs, track.chi2()}; + + for (auto const& collision : compatibleColls) { + + trackPar.propagateToDCAhelix(bZ, {collision.posX(), collision.posY(), collision.posZ()}, dcaInfOrig); + dcaInfo[0] = std::sqrt(dcaInfOrig[0] * dcaInfOrig[0] + dcaInfOrig[1] * dcaInfOrig[1]); + dcaInfo[1] = dcaInfOrig[2]; + + if ((std::abs(dcaInfo[0]) < std::abs(bestDCA[0])) && (std::abs(dcaInfo[1]) < std::abs(bestDCA[1]))) { + bestCol = collision.globalIndex(); + bestDCA[0] = dcaInfo[0]; + bestDCA[1] = dcaInfo[1]; + bestTrackPar = trackPar; + } + if ((track.collisionId() != collision.globalIndex()) && produceHistos) { + registry.fill(HIST("DeltaZ"), track.collision().posZ() - collision.posZ()); // deltaZ between the 1st coll zvtx and the other compatible ones + } + if (produceHistos) { + registry.fill(HIST("TracksDCAXY"), dcaInfo[0]); + registry.fill(HIST("TracksDCAZ"), dcaInfo[1]); + } + + if ((collision.globalIndex() == track.collisionId()) && produceHistos) { + registry.fill(HIST("TracksOrigDCAXY"), dcaInfo[0]); + registry.fill(HIST("TracksOrigDCAZ"), dcaInfo[1]); + } + } + if ((bestCol != track.collisionId()) && produceHistos) { + // reassigned + registry.fill(HIST("ReassignedDCAXY"), bestDCA[0]); + registry.fill(HIST("ReassignedDCAZ"), bestDCA[1]); + } + if (produceHistos) { + int isAmbiguous = 0; + registry.fill(HIST("TracksAmbDegree"), compatibleColls.size()); + if (compatibleColls.size() > 1) { + isAmbiguous = 1; + } + registry.fill(HIST("TrackIsAmb"), isAmbiguous); + } + + fwdtracksBestCollisions3d(track.globalIndex(), compatibleColls.size(), bestCol, bestDCA[0], bestDCA[1]); + if (produceExtra) { + fwdtracksBestCollisions3dExtra(bestTrackPar.getX(), bestTrackPar.getY(), bestTrackPar.getZ(), + bestTrackPar.getTgl(), bestTrackPar.getInvQPt(), bestTrackPar.getPt(), + bestTrackPar.getP(), bestTrackPar.getEta(), bestTrackPar.getPhi()); + } + } + } + PROCESS_SWITCH(AmbiguousTrackPropagation, processMFTReassoc3D, "Fill ReassignedTracks for MFT ambiguous tracks", false); }; //**************************************************************************************** From a30a91beb02fd8d4e409bffa261ae22b6c1b19c1 Mon Sep 17 00:00:00 2001 From: a-m-andrushko <96832230+a-m-andrushko@users.noreply.github.com> Date: Wed, 3 Sep 2025 22:03:39 +0200 Subject: [PATCH 297/986] [PWGCF] FemtoUniverse -- Add new MCTruth analysis to helicity study. (#12843) --- .../femtoUniverseProducerTask.cxx | 212 +++++++++++++----- .../femtoUniversePairTaskTrackV0Helicity.cxx | 176 ++++++++------- 2 files changed, 246 insertions(+), 142 deletions(-) diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx index 37a16abc46b..23d14062fee 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx @@ -74,24 +74,16 @@ using namespace o2::constants::physics; namespace o2::aod { -using FemtoFullCollision = - soa::Join::iterator; -using FemtoFullCollisionCentPP = - soa::Join::iterator; -using FemtoFullCollisionCentRun2 = - soa::Join::iterator; -using FemtoFullCollisionCentRun3 = - soa::Join::iterator; +using FemtoFullCollision = soa::Join::iterator; +using FemtoFullCollisionCentPP = soa::Join::iterator; +using FemtoFullCollisionCentRun2 = soa::Join::iterator; +using FemtoFullCollisionCentRun3 = soa::Join::iterator; using FemtoFullCollisionMC = soa::Join::iterator; -using FemtoFullCollisionCentRun3MCs = - soa::Join; -using FemtoFullCollisionCentRun3MC = - soa::Join::iterator; -using FemtoFullTracks = - soa::Join; +using FemtoFullCollisionCentRun3MCs = soa::Join; +using FemtoFullCollisionCentRun3MC = soa::Join::iterator; +using FemtoFullTracks = soa::Join; // using FilteredFullV0s = soa::Filtered; /// predefined Join // table for o2::aod::V0s = soa::Join @@ -232,6 +224,8 @@ struct FemtoUniverseProducerTask { Configurable confV0RejectKaons{"confV0RejectKaons", false, "Switch to reject kaons"}; Configurable confV0InvKaonMassLowLimit{"confV0InvKaonMassLowLimit", 0.48, "Lower limit of the V0 invariant mass for Kaon rejection"}; Configurable confV0InvKaonMassUpLimit{"confV0InvKaonMassUpLimit", 0.515, "Upper limit of the V0 invariant mass for Kaon rejection"}; + + Configurable> confV0PDGMCTruth{"confV0PDGMCTruth", std::vector{2212, -211, 3122}, "PDG codes of V0 daughters and mother, the order must be as follows -- positive daughter, negative daughter, mother"}; } ConfV0Selection; struct : o2::framework::ConfigurableGroup { @@ -875,6 +869,37 @@ struct FemtoUniverseProducerTask { } } + template + void fillMCTruthParticle(MCParticleType const& mcparticle, o2::aod::femtouniverseparticle::ParticleType fdparttype) + { + auto pdgCode = mcparticle.pdgCode(); + int particleOrigin = 99; + + // Determine particle origin + if (std::abs(pdgCode) == std::abs(confPDGCodePartOne.value) || std::abs(pdgCode) == std::abs(confPDGCodePartTwo.value)) { + if (mcparticle.isPhysicalPrimary()) { + particleOrigin = aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kPrimary; + } else { + auto mothers = mcparticle.template mothers_as(); + if (!mothers.empty()) { + auto mother = mothers.front(); + if (mother.producedByGenerator()) { + particleOrigin = checkDaughterType(fdparttype, mother.pdgCode()); + } else { + particleOrigin = aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kMaterial; + } + } + } + } else { + particleOrigin = aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kFake; + } + + // Fill MC companion tables + outputPartsMC(particleOrigin, pdgCode, mcparticle.pt(), mcparticle.eta(), mcparticle.phi()); + fillDebugParticleMC(mcparticle); + outputPartsMCLabels(outputPartsMC.lastIndex()); + } + template void fillMCParticlePhi(ParticleType const& kaon1, ParticleType const& kaon2) { @@ -1244,6 +1269,77 @@ struct FemtoUniverseProducerTask { } } + template + void fillV0MCTruth(MCParticlesType const& mcParticles) + { + for (const auto& mc : mcParticles) { // Loop over all MC Truth particles + if (mc.pdgCode() != ConfV0Selection.confV0PDGMCTruth.value[2]) + continue; // Artificially single out V0s + + auto daughters = mc.template daughters_as(); // Access daughters (no differentiation of signs, it needs to be checked separately) + + bool foundPos = false, foundNeg = false; + + std::vector childIDs = {0, 0}; + int rowPos = 0; + int rowNeg = 0; + + for (auto const& d : daughters) { // Loop over daughters + if (d.pdgCode() == ConfV0Selection.confV0PDGMCTruth.value[0]) { // Check for a positive child + foundPos = true; + + outputParts(outputCollision.lastIndex(), + d.pt(), + d.eta(), + d.phi(), + aod::femtouniverseparticle::ParticleType::kMCTruthTrack, + 0, + 0, + d.pdgCode(), + childIDs, // {0, 0} + 0, + 0); + rowPos = outputParts.lastIndex(); + fillMCTruthParticle(d, aod::femtouniverseparticle::ParticleType::kMCTruthTrack); + } else if (d.pdgCode() == ConfV0Selection.confV0PDGMCTruth.value[1]) { // Check for a negative child + foundNeg = true; + + outputParts(outputCollision.lastIndex(), + d.pt(), + d.eta(), + d.phi(), + aod::femtouniverseparticle::ParticleType::kMCTruthTrack, + 0, + 0, + d.pdgCode(), + childIDs, // {0, 0} + 0, + 0); + rowNeg = outputParts.lastIndex(); + fillMCTruthParticle(d, aod::femtouniverseparticle::ParticleType::kMCTruthTrack); + } + } + + if (!foundPos || !foundNeg) + continue; + + childIDs[0] = rowPos; + childIDs[1] = rowNeg; + outputParts(outputCollision.lastIndex(), + mc.pt(), + mc.eta(), + mc.phi(), + aod::femtouniverseparticle::ParticleType::kMCTruthTrack, + 0, + 0, + mc.pdgCode(), + childIDs, + 0, + 0); + fillMCTruthParticle(mc, aod::femtouniverseparticle::ParticleType::kMCTruthTrack); + } + } + template void fillCascade(CollisionType const& col, CascadeType const& fullCascades, TrackType const&) { @@ -2429,47 +2525,6 @@ struct FemtoUniverseProducerTask { } PROCESS_SWITCH(FemtoUniverseProducerTask, processTruthAndFullMCV0, "Provide both MC truth and reco for tracks and V0s", false); - void processTruthAndFullMCCentRun3V0( - aod::McCollisions const& mccols, - aod::McParticles const& mcParticles, - aod::FemtoFullCollisionCentRun3MCs const& collisions, - soa::Filtered> const& tracks, - soa::Join const& fullV0s, - aod::BCsWithTimestamps const&) - { - - // recos - std::set recoMcIds; - for (const auto& col : collisions) { - auto groupedTracks = tracks.sliceBy(perCollisionTracks, col.globalIndex()); - auto groupedV0Parts = fullV0s.sliceBy(perCollisionV0s, col.globalIndex()); - getMagneticFieldTesla(col.bc_as()); - const auto colcheck = fillCollisionsCentRun3(col); - if (colcheck) { - fillTracks(groupedTracks); - fillV0(col, groupedV0Parts, groupedTracks); - } - for (const auto& track : groupedTracks) { - if (trackCuts.isSelectedMinimal(track)) - recoMcIds.insert(track.mcParticleId()); - } - } - - // truth - for (const auto& mccol : mccols) { - auto groupedCollisions = collisions.sliceBy(recoCollsPerMCCollCentPbPb, mccol.globalIndex()); - for (const auto& col : groupedCollisions) { - const auto colcheck = fillMCTruthCollisionsCentRun3(col); // fills the reco collisions for mc collision - if (colcheck) { - auto groupedMCParticles = mcParticles.sliceBy(perMCCollision, mccol.globalIndex()); - outputCollExtra(1.0, 1.0); - fillParticles(groupedMCParticles, recoMcIds); // fills mc particles - } - } - } - } - PROCESS_SWITCH(FemtoUniverseProducerTask, processTruthAndFullMCCentRun3V0, "Provide both MC truth and reco for tracks and V0s with centrality", false); - Preslice> perCollisionCascs = aod::track::collisionId; void processTruthAndFullMCCasc( aod::McCollisions const& mccols, @@ -2673,6 +2728,47 @@ struct FemtoUniverseProducerTask { } PROCESS_SWITCH(FemtoUniverseProducerTask, processV0CentRun3Data, "Provide experimental data for Run 3 with centrality for track track", false); + void processTruthAndFullMCCentRun3V0( + aod::McCollisions const& mccols, + aod::McParticles const& mcParticles, + aod::FemtoFullCollisionCentRun3MCs const& collisions, + soa::Filtered> const& tracks, + soa::Join const& fullV0s, + aod::BCsWithTimestamps const&) + { + + // MCReco + std::set recoMcIds; + for (const auto& col : collisions) { // loop over collisions + auto groupedTracks = tracks.sliceBy(perCollisionTracks, col.globalIndex()); // slicing for tracks + auto groupedV0Parts = fullV0s.sliceBy(perCollisionV0s, col.globalIndex()); // slicing for V0 + getMagneticFieldTesla(col.bc_as()); + const auto colcheck = fillCollisionsCentRun3(col); + if (colcheck) { + fillTracks(groupedTracks); + fillV0(col, groupedV0Parts, groupedTracks); + } + for (const auto& track : groupedTracks) { + if (trackCuts.isSelectedMinimal(track)) + recoMcIds.insert(track.mcParticleId()); + } + } + + // MCTruth + for (const auto& mccol : mccols) { + auto groupedCollisions = collisions.sliceBy(recoCollsPerMCCollCentPbPb, mccol.globalIndex()); // slicing for MC collisions + auto groupedMCParticles = mcParticles.sliceBy(perMCCollision, mccol.globalIndex()); // slicing for MC particles + for (const auto& col : groupedCollisions) { + const auto colcheck = fillMCTruthCollisionsCentRun3(col); + if (colcheck) { + outputCollExtra(1.0, 1.0); + fillV0MCTruth(groupedMCParticles); // fills MC V0s and its daughters + } + } + } + } + PROCESS_SWITCH(FemtoUniverseProducerTask, processTruthAndFullMCCentRun3V0, "Provide both MC truth and reco for tracks and V0s with centrality", false); + void processCascadeCentRun3Data(aod::FemtoFullCollisionCentRun3 const& col, aod::BCsWithTimestamps const&, soa::Filtered const& tracks, diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Helicity.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Helicity.cxx index bd66de7dc37..0801d404a4a 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Helicity.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Helicity.cxx @@ -53,12 +53,16 @@ struct FemtoUniversePairTaskTrackV0Helicity { Service pdgMC; SliceCache cache; + using FemtoFullParticles = soa::Join; Preslice perCol = aod::femtouniverseparticle::fdCollisionId; using FemtoRecoParticles = soa::Join; Preslice perColMC = aod::femtouniverseparticle::fdCollisionId; + using FemtoTruthParticles = soa::Join; + Preslice perColMCTruth = aod::femtouniverseparticle::fdCollisionId; + /// To apply narrow cut Configurable confZVertexCut{"confZVertexCut", 10.f, "Event sel: Maximum z-Vertex (cm)"}; Configurable confEta{"confEta", 0.8, "Eta cut for the global track"}; @@ -89,25 +93,28 @@ struct FemtoUniversePairTaskTrackV0Helicity { FemtoUniverseParticleHisto trackHistoPartOneNeg; /// Particle 2 (V0) - Configurable confV0PDGCodePartTwo{"confV0PDGCodePartTwo", 3122, "Particle 2 (V0) - PDG code"}; - ConfigurableAxis confV0TempFitVarBins{"confV0TempFitVarBins", {300, 0.95, 1.}, "V0: binning of the TempFitVar in the pT vs. TempFitVar plot"}; - ConfigurableAxis confV0TempFitVarpTBins{"confV0TempFitVarpTBins", {20, 0.5, 4.05}, "V0: pT binning of the pT vs. TempFitVar plot"}; - Configurable confV0Type1{"confV0Type1", 0, "select one of the V0s (lambda = 0, anti-lambda = 1, k0 = 2) for v0-v0 and Track-v0 combination"}; - Configurable confV0Type2{"confV0Type2", 0, "select one of the V0s (lambda = 0, anti-lambda = 1, k0 = 2) for v0-v0 combination"}; - Configurable confV0InvMassLowLimit{"confV0InvMassLowLimit", 1.10, "Lower limit of the V0 invariant mass"}; - Configurable confV0InvMassUpLimit{"confV0InvMassUpLimit", 1.13, "Upper limit of the V0 invariant mass"}; - ConfigurableAxis confChildTempFitVarBins{"confChildTempFitVarBins", {300, -0.15, 0.15}, "V0 child: binning of the TempFitVar in the pT vs. TempFitVar plot"}; - ConfigurableAxis confChildTempFitVarpTBins{"confChildTempFitVarpTBins", {20, 0.5, 4.05}, "V0 child: pT binning of the pT vs. TempFitVar plot"}; - Configurable confHPtPart2{"confHPtPart2", 4.0f, "higher limit for pt of particle 2"}; - Configurable confLPtPart2{"confLPtPart2", 0.3f, "lower limit for pt of particle 2"}; - Configurable confPDGCodeV0{"confPDGCodeV0", 3122, "V0 -- PDG code"}; - Configurable confPDGCodePosChild{"confPDGCodePosChild", 2212, "Positive Child -- PDG code"}; - Configurable confPDGCodeNegChild{"confPDGCodeNegChild", 211, "Negative Child -- PDG code"}; + struct : o2::framework::ConfigurableGroup { + Configurable confV0PDGCodePartTwo{"confV0PDGCodePartTwo", 3122, "Particle 2 (V0) - PDG code"}; + ConfigurableAxis confV0TempFitVarBins{"confV0TempFitVarBins", {300, 0.95, 1.}, "V0: binning of the TempFitVar in the pT vs. TempFitVar plot"}; + ConfigurableAxis confV0TempFitVarpTBins{"confV0TempFitVarpTBins", {20, 0.5, 4.05}, "V0: pT binning of the pT vs. TempFitVar plot"}; + Configurable confV0Type1{"confV0Type1", 0, "select one of the V0s (lambda = 0, anti-lambda = 1, k0 = 2) for v0-v0 and Track-v0 combination"}; + Configurable confV0Type2{"confV0Type2", 0, "select one of the V0s (lambda = 0, anti-lambda = 1, k0 = 2) for v0-v0 combination"}; + Configurable confV0InvMassLowLimit{"confV0InvMassLowLimit", 1.10, "Lower limit of the V0 invariant mass"}; + Configurable confV0InvMassUpLimit{"confV0InvMassUpLimit", 1.13, "Upper limit of the V0 invariant mass"}; + ConfigurableAxis confChildTempFitVarBins{"confChildTempFitVarBins", {300, -0.15, 0.15}, "V0 child: binning of the TempFitVar in the pT vs. TempFitVar plot"}; + ConfigurableAxis confChildTempFitVarpTBins{"confChildTempFitVarpTBins", {20, 0.5, 4.05}, "V0 child: pT binning of the pT vs. TempFitVar plot"}; + Configurable confHPtPart2{"confHPtPart2", 4.0f, "higher limit for pt of particle 2"}; + Configurable confLPtPart2{"confLPtPart2", 0.3f, "lower limit for pt of particle 2"}; + Configurable confPDGCodeV0{"confPDGCodeV0", 3122, "V0 -- PDG code"}; + Configurable confPDGCodePosChild{"confPDGCodePosChild", 2212, "Positive Child -- PDG code"}; + Configurable confPDGCodeNegChild{"confPDGCodeNegChild", 211, "Negative Child -- PDG code"}; + } V0configs; /// Partition for particle 2 - Partition partsTwo = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kV0)) && (aod::femtouniverseparticle::pt < confHPtPart2) && (aod::femtouniverseparticle::pt > confLPtPart2); - Partition partsTwoMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && (aod::femtouniverseparticle::pt < confHPtPart2) && (aod::femtouniverseparticle::pt > confLPtPart2); - Partition partsTwoMCReco = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kV0)) && (aod::femtouniverseparticle::pt < confHPtPart2) && (aod::femtouniverseparticle::pt > confLPtPart2); + Partition partsTwo = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kV0)) && (aod::femtouniverseparticle::pt < V0configs.confHPtPart2) && (aod::femtouniverseparticle::pt > V0configs.confLPtPart2); + Partition partsTwoMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && (aod::femtouniverseparticle::pt < V0configs.confHPtPart2) && (aod::femtouniverseparticle::pt > V0configs.confLPtPart2); + Partition partsTwoMCReco = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kV0)) && (aod::femtouniverseparticle::pt < V0configs.confHPtPart2) && (aod::femtouniverseparticle::pt > V0configs.confLPtPart2); + Partition partsTwoMCTruth = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && (aod::femtouniverseparticle::pt < V0configs.confHPtPart2) && (aod::femtouniverseparticle::pt > V0configs.confLPtPart2); /// Histogramming for particle 2 FemtoUniverseParticleHisto trackHistoPartTwo; @@ -182,7 +189,7 @@ struct FemtoUniversePairTaskTrackV0Helicity { bool invMLambda(float invMassLambda, float invMassAntiLambda) { - if ((invMassLambda < confV0InvMassLowLimit || invMassLambda > confV0InvMassUpLimit) && (invMassAntiLambda < confV0InvMassLowLimit || invMassAntiLambda > confV0InvMassUpLimit)) { + if ((invMassLambda < V0configs.confV0InvMassLowLimit || invMassLambda > V0configs.confV0InvMassUpLimit) && (invMassAntiLambda < V0configs.confV0InvMassLowLimit || invMassAntiLambda > V0configs.confV0InvMassUpLimit)) { return false; } return true; @@ -224,16 +231,16 @@ struct FemtoUniversePairTaskTrackV0Helicity { qaRegistry.add("Tracks_neg/nSigmaTOF", "; #it{p} (GeV/#it{c}); n#sigma_{TOF}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); trackHistoPartOnePos.init(&qaRegistry, confTrkTempFitVarpTBins, confTrkTempFitVarBins, confIsMC, confTrkPDGCodePartOne); trackHistoPartOneNeg.init(&qaRegistry, confTrkTempFitVarpTBins, confTrkTempFitVarBins, confIsMC, confTrkPDGCodePartOne); - trackHistoPartTwo.init(&qaRegistry, confV0TempFitVarpTBins, confV0TempFitVarBins, confIsMC, confV0PDGCodePartTwo, true); - posChildHistos.init(&qaRegistry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, 0, true); - negChildHistos.init(&qaRegistry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, 0, true); + trackHistoPartTwo.init(&qaRegistry, V0configs.confV0TempFitVarpTBins, V0configs.confV0TempFitVarBins, confIsMC, V0configs.confV0PDGCodePartTwo, true); + posChildHistos.init(&qaRegistry, V0configs.confChildTempFitVarpTBins, V0configs.confChildTempFitVarBins, false, 0, true); + negChildHistos.init(&qaRegistry, V0configs.confChildTempFitVarpTBins, V0configs.confChildTempFitVarBins, false, 0, true); - trackHistoV0Type1.init(&qaRegistry, confV0TempFitVarpTBins, confV0TempFitVarBins, confIsMC, confV0PDGCodePartTwo, true, "V0Type1"); - posChildV0Type1.init(&qaRegistry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, 0, true, "posChildV0Type1"); - negChildV0Type1.init(&qaRegistry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, 0, true, "negChildV0Type1"); - trackHistoV0Type2.init(&qaRegistry, confV0TempFitVarpTBins, confV0TempFitVarBins, confIsMC, confV0PDGCodePartTwo, true, "V0Type2"); - posChildV0Type2.init(&qaRegistry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, 0, true, "posChildV0Type2"); - negChildV0Type2.init(&qaRegistry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, 0, true, "negChildV0Type2"); + trackHistoV0Type1.init(&qaRegistry, V0configs.confV0TempFitVarpTBins, V0configs.confV0TempFitVarBins, confIsMC, V0configs.confV0PDGCodePartTwo, true, "V0Type1"); + posChildV0Type1.init(&qaRegistry, V0configs.confChildTempFitVarpTBins, V0configs.confChildTempFitVarBins, false, 0, true, "posChildV0Type1"); + negChildV0Type1.init(&qaRegistry, V0configs.confChildTempFitVarpTBins, V0configs.confChildTempFitVarBins, false, 0, true, "negChildV0Type1"); + trackHistoV0Type2.init(&qaRegistry, V0configs.confV0TempFitVarpTBins, V0configs.confV0TempFitVarBins, confIsMC, V0configs.confV0PDGCodePartTwo, true, "V0Type2"); + posChildV0Type2.init(&qaRegistry, V0configs.confChildTempFitVarpTBins, V0configs.confChildTempFitVarBins, false, 0, true, "posChildV0Type2"); + negChildV0Type2.init(&qaRegistry, V0configs.confChildTempFitVarpTBins, V0configs.confChildTempFitVarBins, false, 0, true, "negChildV0Type2"); // Helicity angle thetaRegistry.add("Theta/hTheta", " ; p (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}}); @@ -310,9 +317,9 @@ struct FemtoUniversePairTaskTrackV0Helicity { registryMCreco.add("ThetaMCReco/NegativeChild/hThetaPhi", " ; #phi; cos(#theta)", kTH2F, {{100, -1, 7}, {110, -1.1, 1.1}}); sameEventCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, confIsMC, confUse3D); - sameEventCont.setPDGCodes(confTrkPDGCodePartOne, confV0PDGCodePartTwo); + sameEventCont.setPDGCodes(confTrkPDGCodePartOne, V0configs.confV0PDGCodePartTwo); mixedEventCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, confIsMC, confUse3D); - mixedEventCont.setPDGCodes(confTrkPDGCodePartOne, confV0PDGCodePartTwo); + mixedEventCont.setPDGCodes(confTrkPDGCodePartOne, V0configs.confV0PDGCodePartTwo); pairCleaner.init(&qaRegistry); pairCleanerV0.init(&qaRegistry); @@ -327,11 +334,11 @@ struct FemtoUniversePairTaskTrackV0Helicity { LOGF(fatal, "Could not load efficiency histogram from %s", confLocalEfficiency.value.c_str()); if (doprocessSameEvent || doprocessMixedEvent) { plocalEffp1 = (confChargePart1 > 0) ? std::unique_ptr(plocalEffFile.get()->Get("PrPlus")) : std::unique_ptr(plocalEffFile.get()->Get("PrMinus")); // note: works only for protons for now - plocalEffp2 = (confV0Type1 == 0) ? std::unique_ptr(plocalEffFile.get()->Get("Lambda")) : std::unique_ptr(plocalEffFile.get()->Get("AntiLambda")); + plocalEffp2 = (V0configs.confV0Type1 == 0) ? std::unique_ptr(plocalEffFile.get()->Get("Lambda")) : std::unique_ptr(plocalEffFile.get()->Get("AntiLambda")); LOGF(info, "Loaded efficiency histograms for track-V0."); } else if (doprocessSameEventV0 || doprocessMixedEventV0) { - plocalEffp1 = (confV0Type1 == 0) ? std::unique_ptr(plocalEffFile.get()->Get("Lambda")) : std::unique_ptr(plocalEffFile.get()->Get("AntiLambda")); - plocalEffp2 = (confV0Type2 == 0) ? std::unique_ptr(plocalEffFile.get()->Get("Lambda")) : std::unique_ptr(plocalEffFile.get()->Get("AntiLambda")); + plocalEffp1 = (V0configs.confV0Type1 == 0) ? std::unique_ptr(plocalEffFile.get()->Get("Lambda")) : std::unique_ptr(plocalEffFile.get()->Get("AntiLambda")); + plocalEffp2 = (V0configs.confV0Type2 == 0) ? std::unique_ptr(plocalEffFile.get()->Get("Lambda")) : std::unique_ptr(plocalEffFile.get()->Get("AntiLambda")); LOGF(info, "Loaded efficiency histograms for V0-V0."); } } @@ -353,11 +360,11 @@ struct FemtoUniversePairTaskTrackV0Helicity { const auto& posChild = parts.iteratorAt(part.index() - 2); const auto& negChild = parts.iteratorAt(part.index() - 1); /// Daughters that do not pass this condition are not selected - if (!isParticleTPC(posChild, V0ChildTable[confV0Type1][0]) || !isParticleTPC(negChild, V0ChildTable[confV0Type1][1])) + if (!isParticleTPC(posChild, V0ChildTable[V0configs.confV0Type1][0]) || !isParticleTPC(negChild, V0ChildTable[V0configs.confV0Type1][1])) continue; - auto posChildMass = pdg->Mass(confPDGCodePosChild); - auto negChildMass = pdg->Mass(confPDGCodeNegChild); + auto posChildMass = pdg->Mass(V0configs.confPDGCodePosChild); + auto negChildMass = pdg->Mass(V0configs.confPDGCodeNegChild); auto posChildBoosted = FemtoUniverseMath::boostPRF(posChild, posChildMass, negChild, negChildMass); auto cosineTheta = (posChildBoosted.Px() * part.px() + posChildBoosted.Py() * part.py() + posChildBoosted.Pz() * part.pz()) / (posChildBoosted.P() * part.p()); @@ -415,7 +422,7 @@ struct FemtoUniversePairTaskTrackV0Helicity { const auto& negChild = parts.iteratorAt(p2.index() - 1); /// Daughters that do not pass this condition are not selected - if (!isParticleTPC(posChild, V0ChildTable[confV0Type1][0]) || !isParticleTPC(negChild, V0ChildTable[confV0Type1][1])) + if (!isParticleTPC(posChild, V0ChildTable[V0configs.confV0Type1][0]) || !isParticleTPC(negChild, V0ChildTable[V0configs.confV0Type1][1])) continue; float weight = 1.0f; @@ -462,13 +469,13 @@ struct FemtoUniversePairTaskTrackV0Helicity { const auto& negChild = parts.iteratorAt(part.index() - 1); /// Check daughters of first V0 particle - if (isParticleTPC(posChild, V0ChildTable[confV0Type1][0]) && isParticleTPC(negChild, V0ChildTable[confV0Type1][1])) { + if (isParticleTPC(posChild, V0ChildTable[V0configs.confV0Type1][0]) && isParticleTPC(negChild, V0ChildTable[V0configs.confV0Type1][1])) { trackHistoV0Type1.fillQABase(part, HIST("V0Type1")); posChildV0Type1.fillQABase(posChild, HIST("posChildV0Type1")); negChildV0Type1.fillQABase(negChild, HIST("negChildV0Type1")); } /// Check daughters of second V0 particle - if (isParticleTPC(posChild, V0ChildTable[confV0Type2][0]) && isParticleTPC(negChild, V0ChildTable[confV0Type2][1])) { + if (isParticleTPC(posChild, V0ChildTable[V0configs.confV0Type2][0]) && isParticleTPC(negChild, V0ChildTable[V0configs.confV0Type2][1])) { trackHistoV0Type2.fillQABase(part, HIST("V0Type2")); posChildV0Type2.fillQABase(posChild, HIST("posChildV0Type2")); negChildV0Type2.fillQABase(negChild, HIST("negChildV0Type2")); @@ -494,18 +501,18 @@ struct FemtoUniversePairTaskTrackV0Helicity { const auto& posChild1 = parts.iteratorAt(p1.index() - 2); const auto& negChild1 = parts.iteratorAt(p1.index() - 1); /// Daughters that do not pass this condition are not selected - if (!isParticleTPC(posChild1, V0ChildTable[confV0Type1][0]) || !isParticleTPC(negChild1, V0ChildTable[confV0Type1][1])) + if (!isParticleTPC(posChild1, V0ChildTable[V0configs.confV0Type1][0]) || !isParticleTPC(negChild1, V0ChildTable[V0configs.confV0Type1][1])) return; const auto& posChild2 = parts.iteratorAt(p2.index() - 2); const auto& negChild2 = parts.iteratorAt(p2.index() - 1); /// Daughters that do not pass this condition are not selected - if (!isParticleTPC(posChild2, V0ChildTable[confV0Type2][0]) || !isParticleTPC(negChild2, V0ChildTable[confV0Type2][1])) + if (!isParticleTPC(posChild2, V0ChildTable[V0configs.confV0Type2][0]) || !isParticleTPC(negChild2, V0ChildTable[V0configs.confV0Type2][1])) return; sameEventCont.setPair(p1, p2, multCol, confUse3D); }; - if (confV0Type1 == confV0Type2) { + if (V0configs.confV0Type1 == V0configs.confV0Type2) { /// Now build the combinations for identical V0s for (const auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsTwo, groupPartsTwo))) { pairProcessFunc(p1, p2); @@ -534,7 +541,7 @@ struct FemtoUniversePairTaskTrackV0Helicity { /// Histogramming same event for (const auto& part : groupPartsTwo) { int pdgCode = static_cast(part.pidCut()); - if ((confV0Type1 == 0 && pdgCode != confPDGCodeV0) || (confV0Type1 == 1 && pdgCode != -confPDGCodeV0)) + if ((V0configs.confV0Type1 == 0 && pdgCode != V0configs.confPDGCodeV0) || (V0configs.confV0Type1 == 1 && pdgCode != -V0configs.confPDGCodeV0)) continue; trackHistoPartTwo.fillQA(part); } @@ -560,7 +567,7 @@ struct FemtoUniversePairTaskTrackV0Helicity { if (static_cast(p1.pidCut()) != confTrkPDGCodePartOne) continue; int pdgCode2 = static_cast(p2.pidCut()); - if ((confV0Type1 == 0 && pdgCode2 != confPDGCodeV0) || (confV0Type1 == 1 && pdgCode2 != -confPDGCodeV0)) + if ((V0configs.confV0Type1 == 0 && pdgCode2 != V0configs.confPDGCodeV0) || (V0configs.confV0Type1 == 1 && pdgCode2 != -V0configs.confPDGCodeV0)) continue; // track cleaning if (confIsCPR.value) { @@ -585,22 +592,22 @@ struct FemtoUniversePairTaskTrackV0Helicity { /// Histogramming same event for (const auto& part : groupPartsTwo) { int pdgCode = static_cast(part.pidCut()); - if ((confV0Type1 == 0 && pdgCode != confPDGCodeV0) || (confV0Type1 == 1 && pdgCode != -confPDGCodeV0)) + if ((V0configs.confV0Type1 == 0 && pdgCode != V0configs.confPDGCodeV0) || (V0configs.confV0Type1 == 1 && pdgCode != -V0configs.confPDGCodeV0)) continue; trackHistoPartTwo.fillQA(part); } auto pairProcessFunc = [&](auto& p1, auto& p2) -> void { int pdgCode1 = static_cast(p1.pidCut()); - if ((confV0Type1 == 0 && pdgCode1 != confPDGCodeV0) || (confV0Type1 == 1 && pdgCode1 != -confPDGCodeV0)) + if ((V0configs.confV0Type1 == 0 && pdgCode1 != V0configs.confPDGCodeV0) || (V0configs.confV0Type1 == 1 && pdgCode1 != -V0configs.confPDGCodeV0)) return; int pdgCode2 = static_cast(p2.pidCut()); - if ((confV0Type2 == 0 && pdgCode2 != confPDGCodeV0) || (confV0Type2 == 1 && pdgCode2 != -confPDGCodeV0)) + if ((V0configs.confV0Type2 == 0 && pdgCode2 != V0configs.confPDGCodeV0) || (V0configs.confV0Type2 == 1 && pdgCode2 != -V0configs.confPDGCodeV0)) return; sameEventCont.setPair(p1, p2, multCol, confUse3D); }; /// Now build the combinations - if (confV0Type1 == confV0Type2) { + if (V0configs.confV0Type1 == V0configs.confV0Type2) { /// Now build the combinations for identical V0s for (const auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsTwo, groupPartsTwo))) { pairProcessFunc(p1, p2); @@ -646,7 +653,7 @@ struct FemtoUniversePairTaskTrackV0Helicity { const auto& posChild = parts.iteratorAt(p2.globalIndex() - 2); const auto& negChild = parts.iteratorAt(p2.globalIndex() - 1); /// Daughters that do not pass this condition are not selected - if (!isParticleTPC(posChild, V0ChildTable[confV0Type1][0]) || !isParticleTPC(negChild, V0ChildTable[confV0Type1][1])) + if (!isParticleTPC(posChild, V0ChildTable[V0configs.confV0Type1][0]) || !isParticleTPC(negChild, V0ChildTable[V0configs.confV0Type1][1])) continue; // track cleaning @@ -726,13 +733,13 @@ struct FemtoUniversePairTaskTrackV0Helicity { const auto& posChild1 = parts.iteratorAt(p1.globalIndex() - 2); const auto& negChild1 = parts.iteratorAt(p1.globalIndex() - 1); /// Daughters that do not pass this condition are not selected - if (!isParticleTPC(posChild1, V0ChildTable[confV0Type1][0]) || !isParticleTPC(negChild1, V0ChildTable[confV0Type1][1])) + if (!isParticleTPC(posChild1, V0ChildTable[V0configs.confV0Type1][0]) || !isParticleTPC(negChild1, V0ChildTable[V0configs.confV0Type1][1])) continue; const auto& posChild2 = parts.iteratorAt(p2.globalIndex() - 2); const auto& negChild2 = parts.iteratorAt(p2.globalIndex() - 1); /// Daughters that do not pass this condition are not selected - if (!isParticleTPC(posChild2, V0ChildTable[confV0Type2][0]) || !isParticleTPC(negChild2, V0ChildTable[confV0Type2][1])) + if (!isParticleTPC(posChild2, V0ChildTable[V0configs.confV0Type2][0]) || !isParticleTPC(negChild2, V0ChildTable[V0configs.confV0Type2][1])) continue; // track cleaning @@ -784,7 +791,7 @@ struct FemtoUniversePairTaskTrackV0Helicity { if (static_cast(p1.pidCut()) != confTrkPDGCodePartOne) continue; int pdgCode2 = static_cast(p2.pidCut()); - if ((confV0Type1 == 0 && pdgCode2 != confPDGCodeV0) || (confV0Type1 == 1 && pdgCode2 != -confPDGCodeV0)) + if ((V0configs.confV0Type1 == 0 && pdgCode2 != V0configs.confPDGCodeV0) || (V0configs.confV0Type1 == 1 && pdgCode2 != -V0configs.confPDGCodeV0)) continue; if (confIsCPR.value) { if (pairCloseRejection.isClosePair(p1, p2, parts, magFieldTesla1, femto_universe_container::EventType::mixed)) { @@ -824,10 +831,10 @@ struct FemtoUniversePairTaskTrackV0Helicity { for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { int pdgCode1 = static_cast(p1.pidCut()); - if ((confV0Type1 == 0 && pdgCode1 != confPDGCodeV0) || (confV0Type1 == 1 && pdgCode1 != -confPDGCodeV0)) + if ((V0configs.confV0Type1 == 0 && pdgCode1 != V0configs.confPDGCodeV0) || (V0configs.confV0Type1 == 1 && pdgCode1 != -V0configs.confPDGCodeV0)) continue; int pdgCode2 = static_cast(p2.pidCut()); - if ((confV0Type2 == 0 && pdgCode2 != confPDGCodeV0) || (confV0Type2 == 1 && pdgCode2 != -confPDGCodeV0)) + if ((V0configs.confV0Type2 == 0 && pdgCode2 != V0configs.confPDGCodeV0) || (V0configs.confV0Type2 == 1 && pdgCode2 != -V0configs.confPDGCodeV0)) continue; mixedEventCont.setPair(p1, p2, multCol, confUse3D); } @@ -847,23 +854,48 @@ struct FemtoUniversePairTaskTrackV0Helicity { } PROCESS_SWITCH(FemtoUniversePairTaskTrackV0Helicity, processMCMixedEventV0, "Enable processing mixed events for MC truth V0 - V0", false); - ///--------------------------------------------MC-------------------------------------------------/// - /// This function fills MC truth particles from derived MC table - void processMCTruth(aod::FDParticles const& parts) + /// --------------------------------------------------------------- MC --------------------------------------------------------------- /// + + /// This function fills MC Truth particles from derived MC table + void processMCTruth(o2::aod::FdCollision const& col, FemtoTruthParticles const& parts) { - for (const auto& part : parts) { + eventHisto.fillQA(col); + auto groupPartsTwo = partsTwoMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + for (const auto& part : groupPartsTwo) { if (part.partType() != uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) continue; - int pdgCode = static_cast(part.pidCut()); + int pdgCode = static_cast(part.tempFitVar()); const auto& pdgParticle = pdgMC->GetParticle(pdgCode); - if (!pdgParticle) { + if (!pdgParticle) continue; - } if (pdgCode == 3122) { registryMCtruth.fill(HIST("plus/MCtruthLambda"), part.pt(), part.eta()); + + // Helicity angle + const auto& posChild = parts.iteratorAt(part.index() - 2); + const auto& negChild = parts.iteratorAt(part.index() - 1); + + registryMCtruth.fill(HIST("PosChildMCTruth/hPt"), posChild.pt()); + registryMCtruth.fill(HIST("NegChildMCTruth/hPt"), negChild.pt()); + + auto posChildMass = pdg->Mass(V0configs.confPDGCodePosChild); + auto negChildMass = pdg->Mass(V0configs.confPDGCodeNegChild); + auto posChildBoosted = FemtoUniverseMath::boostPRF(posChild, posChildMass, negChild, negChildMass); + auto cosineTheta = (posChildBoosted.Px() * part.px() + posChildBoosted.Py() * part.py() + posChildBoosted.Pz() * part.pz()) / (posChildBoosted.P() * part.p()); + + registryMCtruth.fill(HIST("ThetaMCTruth/hTheta"), part.p(), cosineTheta); + registryMCtruth.fill(HIST("ThetaMCTruth/hTheta3D_PosChild"), part.p(), cosineTheta, posChild.pt()); + registryMCtruth.fill(HIST("ThetaMCTruth/hTheta3D_NegChild"), part.p(), cosineTheta, negChild.pt()); + registryMCtruth.fill(HIST("ThetaMCTruth/PositiveChild/hThetaPt"), posChild.pt(), cosineTheta); + registryMCtruth.fill(HIST("ThetaMCTruth/PositiveChild/hThetaEta"), posChild.eta(), cosineTheta); + registryMCtruth.fill(HIST("ThetaMCTruth/PositiveChild/hThetaPhi"), posChild.phi(), cosineTheta); + registryMCtruth.fill(HIST("ThetaMCTruth/NegativeChild/hThetaPt"), negChild.pt(), cosineTheta); + registryMCtruth.fill(HIST("ThetaMCTruth/NegativeChild/hThetaEta"), negChild.eta(), cosineTheta); + registryMCtruth.fill(HIST("ThetaMCTruth/NegativeChild/hThetaPhi"), negChild.phi(), cosineTheta); + continue; } else if (pdgCode == -3122) { registryMCtruth.fill(HIST("minus/MCtruthLambda"), part.pt(), part.eta()); @@ -893,31 +925,8 @@ struct FemtoUniversePairTaskTrackV0Helicity { registryMCtruth.fill(HIST("minus/MCtruthPr"), part.pt(), part.eta()); registryMCtruth.fill(HIST("minus/MCtruthPrPt"), part.pt()); } - - // Helicity angle - const auto& posChild = parts.iteratorAt(part.index() - 2); - const auto& negChild = parts.iteratorAt(part.index() - 1); - - registryMCtruth.fill(HIST("PosChildMCTruth/hPt"), posChild.pt()); - registryMCtruth.fill(HIST("NegChildMCTruth/hPt"), negChild.pt()); - - auto posChildMass = pdg->Mass(confPDGCodePosChild); - auto negChildMass = pdg->Mass(confPDGCodeNegChild); - auto posChildBoosted = FemtoUniverseMath::boostPRF(posChild, posChildMass, negChild, negChildMass); - auto cosineTheta = (posChildBoosted.Px() * part.px() + posChildBoosted.Py() * part.py() + posChildBoosted.Pz() * part.pz()) / (posChildBoosted.P() * part.p()); - - registryMCtruth.fill(HIST("ThetaMCTruth/hTheta"), part.p(), cosineTheta); - registryMCtruth.fill(HIST("ThetaMCTruth/hTheta3D_PosChild"), part.p(), cosineTheta, posChild.p()); - registryMCtruth.fill(HIST("ThetaMCTruth/hTheta3D_NegChild"), part.p(), cosineTheta, negChild.p()); - registryMCtruth.fill(HIST("ThetaMCTruth/PositiveChild/hThetaPt"), posChild.pt(), cosineTheta); - registryMCtruth.fill(HIST("ThetaMCTruth/PositiveChild/hThetaEta"), posChild.eta(), cosineTheta); - registryMCtruth.fill(HIST("ThetaMCTruth/PositiveChild/hThetaPhi"), posChild.phi(), cosineTheta); - registryMCtruth.fill(HIST("ThetaMCTruth/NegativeChild/hThetaPt"), negChild.pt(), cosineTheta); - registryMCtruth.fill(HIST("ThetaMCTruth/NegativeChild/hThetaEta"), negChild.eta(), cosineTheta); - registryMCtruth.fill(HIST("ThetaMCTruth/NegativeChild/hThetaPhi"), negChild.phi(), cosineTheta); } } - PROCESS_SWITCH(FemtoUniversePairTaskTrackV0Helicity, processMCTruth, "Process MC truth data", false); void processMCReco(FemtoRecoParticles const& parts, aod::FdMCParticles const& mcparts) @@ -985,7 +994,6 @@ struct FemtoUniversePairTaskTrackV0Helicity { } // partType } } - PROCESS_SWITCH(FemtoUniversePairTaskTrackV0Helicity, processMCReco, "Process MC reco data", false); }; From 4f6932bf0e7ffb9bc0ca4d2d2cea5b9b1396548e Mon Sep 17 00:00:00 2001 From: Kaare Endrup Iversen <69893472+kaareendrup@users.noreply.github.com> Date: Wed, 3 Sep 2025 23:01:19 +0200 Subject: [PATCH 298/986] [PWGDQ] Add dileptron track muon table for MC (#12850) Co-authored-by: ALICE Action Bot --- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index ceec3753c28..012f0c25490 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -88,6 +88,7 @@ DECLARE_SOA_COLUMN(TauxyBcandidate, tauxyBcandidate, float); DECLARE_SOA_COLUMN(TauzBcandidate, tauzBcandidate, float); DECLARE_SOA_COLUMN(CosPBcandidate, cosPBcandidate, float); DECLARE_SOA_COLUMN(Chi2Bcandidate, chi2Bcandidate, float); +DECLARE_SOA_COLUMN(Ptassoc, ptassoc, float); DECLARE_SOA_COLUMN(PINassoc, pINassoc, float); DECLARE_SOA_COLUMN(Etaassoc, etaassoc, float); DECLARE_SOA_COLUMN(Ptpair, ptpair, float); @@ -135,6 +136,8 @@ DECLARE_SOA_COLUMN(Lzee, lzee, float); DECLARE_SOA_COLUMN(AmbiguousInBunchPairs, AmbiguousJpsiPairsInBunch, bool); DECLARE_SOA_COLUMN(AmbiguousOutOfBunchPairs, AmbiguousJpsiPairsOutOfBunch, bool); DECLARE_SOA_COLUMN(Corrassoc, corrassoc, bool); +DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); +DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); } // namespace dqanalysisflags DECLARE_SOA_TABLE(EventCuts, "AOD", "DQANAEVCUTS", dqanalysisflags::IsEventSelected); //! joinable to ReducedEvents @@ -158,6 +161,10 @@ DECLARE_SOA_TABLE(BmesonCandidates, "AOD", "DQBMESONS", dqanalysisflags::TPCNclsassoc, dqanalysisflags::TPCNclsleg1, dqanalysisflags::TPCNclsleg2, dqanalysisflags::TPCChi2assoc, dqanalysisflags::TPCChi2leg1, dqanalysisflags::TPCChi2leg2, dqanalysisflags::IsJpsiFromBSelected, dqanalysisflags::IsBarrelSelected, dqanalysisflags::McFlag); +DECLARE_SOA_TABLE(JPsiMuonCandidates, "AOD", "DQJPSIMUONA", + dqanalysisflags::DeltaEta, dqanalysisflags::DeltaPhi, + dqanalysisflags::MassDileptonCandidate, dqanalysisflags::Ptpair, dqanalysisflags::Etapair, dqanalysisflags::Ptassoc, dqanalysisflags::Etaassoc, + dqanalysisflags::McFlag); DECLARE_SOA_TABLE(JPsieeCandidates, "AOD", "DQPSEUDOPROPER", dqanalysisflags::Massee, dqanalysisflags::Ptee, dqanalysisflags::Lxyee, dqanalysisflags::LxyeePoleMass, dqanalysisflags::Lzee, dqanalysisflags::AmbiguousInBunchPairs, dqanalysisflags::AmbiguousOutOfBunchPairs, dqanalysisflags::Corrassoc); } // namespace o2::aod @@ -3274,6 +3281,7 @@ struct AnalysisAsymmetricPairing { // tracks passing the fConfigTrackCut cut. The dileptons cuts from the same-event pairing task are auto-detected struct AnalysisDileptonTrack { Produces BmesonsTable; + Produces DileptonTrackTable; OutputObj fOutputList{"output"}; Configurable fConfigTrackCuts{"cfgTrackCuts", "kaonPID", "Comma separated list of track cuts to be correlated with the dileptons"}; @@ -3789,6 +3797,8 @@ struct AnalysisDileptonTrack { mcDecision |= (static_cast(1) << isig); } } + // Fill table for correlation analysis + DileptonTrackTable(fValuesHadron[VarManager::kDeltaEta], fValuesHadron[VarManager::kDeltaPhi], dilepton.mass(), dilepton.pt(), dilepton.eta(), track.pt(), track.eta(), mcDecision); } if constexpr (TCandidateType == VarManager::kBcToThreeMuons) { From f3d9a87e177900cb08d349ad43ac218444a6ced4 Mon Sep 17 00:00:00 2001 From: omvazque Date: Wed, 3 Sep 2025 17:01:54 -0500 Subject: [PATCH 299/986] [PWGLF] Added more QA + finner eta bins (#12854) --- PWGLF/Tasks/Nuspex/piKpRAA.cxx | 161 ++++++++++++++++++++++----------- 1 file changed, 108 insertions(+), 53 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/piKpRAA.cxx b/PWGLF/Tasks/Nuspex/piKpRAA.cxx index 06682d9cbf7..d41dd1b4812 100644 --- a/PWGLF/Tasks/Nuspex/piKpRAA.cxx +++ b/PWGLF/Tasks/Nuspex/piKpRAA.cxx @@ -67,11 +67,10 @@ using namespace o2::framework::expressions; using ColEvSels = soa::Join; using BCsRun3 = soa::Join; -// using TracksFull = soa::Join; using TracksFull = soa::Join; -static constexpr int kNEtaHists{4}; +static constexpr int kNEtaHists{8}; std::array, kNEtaHists> dEdxPiV0{}; std::array, kNEtaHists> dEdxPrV0{}; @@ -79,9 +78,20 @@ std::array, kNEtaHists> dEdxElV0{}; std::array, kNEtaHists> dEdxPiTOF{}; std::array, kNEtaHists> dEdx{}; std::array, kNEtaHists> pTVsP{}; +std::array, kNEtaHists> nClVsP{}; +std::array, kNEtaHists> nClVsPElV0{}; +std::array, kNEtaHists> nClVsPPiV0{}; +std::array, kNEtaHists> nClVsPPrV0{}; +std::array, kNEtaHists> nClVsPp{}; +std::array, kNEtaHists> nClVsPpElV0{}; +std::array, kNEtaHists> nClVsPpPiV0{}; +std::array, kNEtaHists> nClVsPpPrV0{}; struct PiKpRAA { + static constexpr int kZeroInt{0}; + static constexpr int kSevenInt{7}; + static constexpr float kZero{0.0f}; static constexpr float kOne{1.0f}; static constexpr float kTenToMinusNine{1e-9}; @@ -97,16 +107,16 @@ struct PiKpRAA { static constexpr float kMindEdxMIPPlateau{70.0f}; static constexpr float kMaxdEdxMIPPlateau{90.0f}; - // static constexpr float kLowEta[kNEtaHists] = {-0.8, -0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6}; - // static constexpr float kHighEta[kNEtaHists] = {0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6, 0.8}; - static constexpr float kLowEta[kNEtaHists] = {0.0, 0.2, 0.4, 0.6}; - static constexpr float kHighEta[kNEtaHists] = {0.2, 0.4, 0.6, 0.8}; + static constexpr float kLowEta[kNEtaHists] = {-0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6}; + static constexpr float kHighEta[kNEtaHists] = {-0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6, 0.8}; + // static constexpr float kLowEta[kNEtaHists] = {0.0, 0.2, 0.4, 0.6}; + // static constexpr float kHighEta[kNEtaHists] = {0.2, 0.4, 0.6, 0.8}; static constexpr float DefaultLifetimeCuts[1][2] = {{30., 20.}}; Configurable> lifetimecut{"lifetimecut", {DefaultLifetimeCuts[0], 2, {"lifetimecutLambda", "lifetimecutK0S"}}, "lifetimecut"}; struct : ConfigurableGroup { - Configurable v0TypeSelection{"v0TypeSelection", 1, "select on a certain V0 type (leave negative if no selection desired)"}; + Configurable v0TypeSelection{"v0TypeSelection", 1, "select on a certain V0 type (leave negative if no selection desired)"}; // Selection criteria: acceptance Configurable rapidityCut{"rapidityCut", 0.5, "rapidity"}; @@ -134,7 +144,7 @@ struct PiKpRAA { Configurable applyInvMassSel{"applyInvMassSel", false, "Select V0s close to the Inv. mass value"}; Configurable dMassSel{"dMassSel", 0.01f, "Invariant mass selection"}; Configurable dMassSelG{"dMassSelG", 0.1f, "Inv mass selection gammas"}; - Configurable dMassGcut{"dMassGcut", 0.01f, "Inv mass selection gammas"}; + Configurable dMassGcut{"dMassGcut", 0.1f, "Inv mass selection gammas"}; // PID (TPC/TOF) Configurable tpcPidNsigmaCut{"tpcPidNsigmaCut", 5, "tpcPidNsigmaCut"}; @@ -175,6 +185,8 @@ struct PiKpRAA { ConfigurableAxis binsPtNcl{"binsPtNcl", {VARIABLE_WIDTH, 0.0, 0.15, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.5, 3.0, 3.5, 4.0, 5.0, 7.0, 9.0, 12.0, 15.0, 20.0, 25.0, 30.0, 35.0, 40.0, 45.0, 50.0}, "pT"}; ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.12}, "pT binning"}; ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0., 5., 10., 20., 30., 40., 50., 60., 70., 80., 90., 100.}, "T0C binning"}; + ConfigurableAxis axisEta{"axisEta", {50, -1.0, 1.0}, "Eta axix"}; + ConfigurableAxis axisY{"axisY", {50, -1.0, 1.0}, "rapidity axix"}; ConfigurableAxis axisArmAlpha{"axisArmAlpha", {200, -1.0, 1.0}, "Armenteros alpha"}; ConfigurableAxis axisArmqT{"axisArmqT", {600, 0.0f, 0.3f}, "Armenteros qT"}; ConfigurableAxis axisK0Mass{"axisK0Mass", {200, 0.4f, 0.6f}, "Mass K0Short"}; @@ -214,6 +226,13 @@ struct PiKpRAA { NchSel }; + enum V0sCounter { + K0s = 1, + Lambda, + AntiLambda, + Gamma + }; + HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; Service ccdb; @@ -257,14 +276,16 @@ struct PiKpRAA { const std::string titlePorPt{v0Selections.usePinPhiSelection ? "#it{p} (GeV/#it{c})" : "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec axisZpos{48, -12., 12., "Vtx_{z} (cm)"}; const AxisSpec axisEvent{15, 0.5, 15.5, ""}; - const AxisSpec axisEta{100, -1., +1., "#eta"}; + const AxisSpec axisNcl{161, -0.5, 160.5, "#it{N}_{cl} TPC"}; const AxisSpec axisPt{binsPt, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec axisPtV0s{binsPtV0s, "#it{p}_{T} (GeV/#it{c})"}; - const AxisSpec axisXNcl{binsPtNcl, Form("%s", titlePorPt.data())}; + const AxisSpec axisPtNcl{binsPtNcl, Form("%s", titlePorPt.data())}; const AxisSpec axisXPhiCut{binsPtPhiCut, Form("%s", titlePorPt.data())}; const AxisSpec axisCent{binsCent, "T0C centrality"}; - const char* endingEta[kNEtaHists] = {"02", "24", "46", "68"}; - const char* latexEta[kNEtaHists] = {"0<|#eta|<0.2", "0.2<#eta<0.4", "0.4<#eta<0.6", "0.6<#eta<0.8"}; + // const char* endingEta[kNEtaHists] = {"02", "24", "46", "68"}; + // const char* latexEta[kNEtaHists] = {"0<|#eta|<0.2", "0.2<#eta<0.4", "0.4<#eta<0.6", "0.6<#eta<0.8"}; + const char* endingEta[kNEtaHists] = {"86", "64", "42", "20", "02", "24", "46", "68"}; + const char* latexEta[kNEtaHists] = {"-0.8<#eta<-0.6", "-0.6<#eta<-0.4", "-0.4<#eta<-0.2", "-0.2<#eta<0", "0<#eta<0.2", "0.2<#eta<0.4", "0.4<#eta<0.6", "0.6<#eta<0.8"}; registry.add("EventCounter", ";;Events", kTH1F, {axisEvent}); @@ -292,6 +313,7 @@ struct PiKpRAA { registry.add("ExcludedEvtVsNch", ";Nch;Entries;", kTH1F, {{nBinsNch, minNch, maxNch}}); registry.add("ExcludedEvtVsNPV", ";NPV;Entries;", kTH1F, {{nBinsNPV, minNpv, maxNpv}}); + registry.add("V0sCounter", ";V0 type; Entries;", kTH1F, {{4, 0.5, 4.5}}); registry.add("dcaVsPt", "Primary particles;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm);", kTH2F, {{{axisPt}, {40, -1.0, 1.0}}}); registry.add("dcaDauVsPt", ";V0 #it{p}_{T} (GeV/#it{c});DCA_{xy} (cm) daughters;", kTH2F, {{{axisPtV0s}, {200, -10., 10.}}}); registry.add("nSigPiFromK0s", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); @@ -312,10 +334,8 @@ struct PiKpRAA { registry.add("MassALVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {axisPtV0s, axisLambdaMass}); registry.add("MassGVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {axisPtV0s, axisGammaMass}); - registry.add("NclFindable", ";;Findable Ncl TPC", kTH2F, {{{axisXNcl}, {161, -0.5, 160.5}}}); - registry.add("NclFindablep", ";;Findable #LTNcl#GT TPC", kTProfile, {axisXNcl}); - registry.add("NclFound", ";;Found Ncl TPC", kTH2F, {{{axisXNcl}, {161, -0.5, 160.5}}}); - registry.add("NclFoundp", ";;Found #LTNcl#GT TPC", kTProfile, {axisXNcl}); + registry.add("NclFindable", ";;Findable Ncl TPC", kTH2F, {axisPtNcl, axisNcl}); + registry.add("NclFindablep", ";;Findable #LTNcl#GT TPC", kTProfile, {axisPtNcl}); registry.add("NclFoundVsPhipBeforeCut", Form("Found #LTNcl#GT TPC;%s (GeV/#it{c});#varphi", titlePorPt.data()), kTProfile2D, {{{axisXPhiCut}, {350, 0.0, 0.35}}}); registry.add("NclFoundVsPhipAfterCut", Form("Found #LTNcl#GT TPC;%s (GeV/#it{c});#varphi", titlePorPt.data()), kTProfile2D, {{{axisXPhiCut}, {350, 0.0, 0.35}}}); registry.add("NclVsEta", ";#eta;Found Ncl TPC", kTH2F, {{{axisEta}, {161, -0.5, 160.5}}}); @@ -323,18 +343,19 @@ struct PiKpRAA { registry.add("NclVsEtaPiMIP", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c}, 40 < dE/dx < 60);#eta; Found Ncl TPC", kTH2F, {{{axisEta}, {161, -0.5, 160.5}}}); registry.add("NclVsEtaPiMIPp", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c}, 40 < dE/dx < 60);#eta; Found #LTNcl#GT TPC", kTProfile, {axisEta}); - registry.add("NclVsEtaPiV0", ";#eta; Found Ncl TPC", kTH2F, {{{axisEta}, {161, -0.5, 160.5}}}); + registry.add("NclVsEtaPiV0", ";#eta; Found Ncl TPC", kTH2F, {axisEta, axisNcl}); registry.add("NclVsEtaPiV0p", ";#eta; Found #LTNcl#GT TPC", kTProfile, {axisEta}); - registry.add("NclPiV0", ";;Found Ncl TPC", kTH2F, {{{axisXNcl}, {161, -0.5, 160.5}}}); - registry.add("NclPiV0p", ";;Found #LTNcl#GT TPC", kTProfile, {axisXNcl}); - registry.add("NclVsEtaPrV0", ";#eta; Found Ncl TPC", kTH2F, {{{axisEta}, {161, -0.5, 160.5}}}); + registry.add("NclVsEtaPrV0", ";#eta; Found Ncl TPC", kTH2F, {axisEta, axisNcl}); registry.add("NclVsEtaPrV0p", ";#eta; Found #LTNcl#GT TPC", kTProfile, {axisEta}); - registry.add("NclPrV0", ";;Found Ncl TPC", kTH2F, {{{axisXNcl}, {161, -0.5, 160.5}}}); - registry.add("NclPrV0p", ";;Found #LTNcl#GT TPC", kTProfile, {axisXNcl}); - registry.add("NclVsEtaElV0", ";#eta; Found Ncl TPC", kTH2F, {{{axisEta}, {161, -0.5, 160.5}}}); + registry.add("NclVsEtaElV0", ";#eta; Found Ncl TPC", kTH2F, {axisEta, axisNcl}); registry.add("NclVsEtaElV0p", ";#eta; Found #LTNcl#GT TPC", kTProfile, {axisEta}); - registry.add("NclElV0", ";;Found Ncl TPC", kTH2F, {{{axisXNcl}, {161, -0.5, 160.5}}}); - registry.add("NclElV0p", ";;Found #LTNcl#GT TPC", kTProfile, {axisXNcl}); + + registry.add("EtaVsYK0s", ";#eta;#it{y};", kTH2F, {axisEta, axisY}); + registry.add("EtaVsYPiL", ";#eta;#it{y};", kTH2F, {axisEta, axisY}); + registry.add("EtaVsYPrL", ";#eta;#it{y};", kTH2F, {axisEta, axisY}); + registry.add("EtaVsYPiAL", ";#eta;#it{y};", kTH2F, {axisEta, axisY}); + registry.add("EtaVsYPrAL", ";#eta;#it{y};", kTH2F, {axisEta, axisY}); + registry.add("EtaVsYG", ";#eta;#it{y};", kTH2F, {axisEta, axisY}); registry.add("TOFExpPi2TOF", ";Momentum (GeV/#it{c});t^{e}_{Exp}/t_{TOF}", kTH2F, {{{axisPtV0s}, {100, 0.2, 1.2}}}); registry.add("TOFExpEl2TOF", ";Momentum (GeV/#it{c});t^{#pi}_{Exp}/t_{TOF}", kTH2F, {{{axisPtV0s}, {100, 0.2, 1.2}}}); @@ -356,12 +377,21 @@ struct PiKpRAA { dEdxPrV0[i] = registry.add(Form("dEdxPrV0_%s", endingEta[i]), Form("p + #bar{p}, %s;Momentum (GeV/#it{c});dE/dx;", latexEta[i]), kTH3F, {axisPtV0s, axisdEdx, axisCent}); dEdxElV0[i] = registry.add(Form("dEdxElV0_%s", endingEta[i]), Form("e^{+} + e^{-}, %s;Momentum (GeV/#it{c});dE/dx;", latexEta[i]), kTH3F, {axisPtV0s, axisdEdx, axisCent}); dEdxPiTOF[i] = registry.add(Form("dEdxPiTOF_%s", endingEta[i]), Form("#pi^{+} + #pi^{-}, %s;Momentum (GeV/#it{c});dE/dx;", latexEta[i]), kTH3F, {axisPtV0s, axisdEdx, axisCent}); + nClVsP[i] = registry.add(Form("NclFound_%s", endingEta[i]), Form("%s;;Found Ncl TPC", latexEta[i]), kTH2F, {axisPtNcl, axisNcl}); + nClVsPElV0[i] = registry.add(Form("NclFoundElV0_%s", endingEta[i]), Form("%s;;Found Ncl TPC", latexEta[i]), kTH2F, {axisPtNcl, axisNcl}); + nClVsPPiV0[i] = registry.add(Form("NclFoundPiV0_%s", endingEta[i]), Form("%s;;Found Ncl TPC", latexEta[i]), kTH2F, {axisPtNcl, axisNcl}); + nClVsPPrV0[i] = registry.add(Form("NclFoundPrV0_%s", endingEta[i]), Form("%s;;Found Ncl TPC", latexEta[i]), kTH2F, {axisPtNcl, axisNcl}); + nClVsPp[i] = registry.add(Form("NclFoundp_%s", endingEta[i]), Form("%s;;Found #LT#it{N}_{cl}#GT TPC", latexEta[i]), kTProfile, {axisPtNcl}); + nClVsPpElV0[i] = registry.add(Form("NclFoundpElV0_%s", endingEta[i]), Form("%s;;Found #LT#it{N}_{cl}#GT TPC", latexEta[i]), kTProfile, {axisPtNcl}); + nClVsPpPiV0[i] = registry.add(Form("NclFoundpPiV0_%s", endingEta[i]), Form("%s;;Found #LT#it{N}_{cl}#GT TPC", latexEta[i]), kTProfile, {axisPtNcl}); + nClVsPpPrV0[i] = registry.add(Form("NclFoundpPrV0_%s", endingEta[i]), Form("%s;;Found #LT#it{N}_{cl}#GT TPC", latexEta[i]), kTProfile, {axisPtNcl}); } } LOG(info) << "\tccdbNoLaterThan=" << ccdbNoLaterThan.value; LOG(info) << "\tapplyNchSel=" << applyNchSel.value; LOG(info) << "\tdetector4Calibration=" << detector4Calibration.value; + LOG(info) << "\tv0TypeSelection=" << static_cast(v0Selections.v0TypeSelection); LOG(info) << "\tminPt=" << v0Selections.minPt; LOG(info) << "\tmaxPt=" << v0Selections.maxPt; LOG(info) << "\tqTSel=" << v0Selections.qTSel; @@ -523,14 +553,17 @@ struct PiKpRAA { continue; } - int indexEta{0}; - for (int i = 1; i < kNEtaHists; ++i) { - if (std::abs(eta) >= kLowEta[i] && std::abs(eta) < kHighEta[i]) { + int indexEta{-999}; + for (int i = 0; i < kNEtaHists; ++i) { + if (eta >= kLowEta[i] && eta < kHighEta[i]) { indexEta = i; break; } } + if (indexEta < kZeroInt || indexEta > kSevenInt) + continue; + if (momentum > kMinPMIP && momentum < kMaxPMIP && dedx > kMindEdxMIP && dedx < kMaxdEdxMIP) { registry.fill(HIST("dEdxVsEtaPiMIP"), eta, dedx); registry.fill(HIST("dEdxVsEtaPiMIPp"), eta, dedx); @@ -545,11 +578,12 @@ struct PiKpRAA { dEdx[indexEta]->Fill(momentum, dedx, centrality); pTVsP[indexEta]->Fill(momentum, pt); + nClVsP[indexEta]->Fill(pOrPt, track.tpcNClsFound()); + nClVsPp[indexEta]->Fill(pOrPt, track.tpcNClsFound()); registry.fill(HIST("dcaVsPt"), pt, track.dcaXY()); registry.fill(HIST("NclVsEta"), eta, track.tpcNClsFound()); registry.fill(HIST("NclVsEtap"), eta, track.tpcNClsFound()); - registry.fill(HIST("NclFound"), pOrPt, track.tpcNClsFound()); - registry.fill(HIST("NclFoundp"), pOrPt, track.tpcNClsFound()); + // registry.fill(HIST("NclFoundp"), pOrPt, track.tpcNClsFound()); registry.fill(HIST("NclFindable"), pOrPt, track.tpcNClsFindable()); registry.fill(HIST("NclFindablep"), pOrPt, track.tpcNClsFindable()); registry.fill(HIST("NclFoundVsPhipAfterCut"), pOrPt, phiPrime, track.tpcNClsFound()); @@ -652,22 +686,28 @@ struct PiKpRAA { const double dMassAL{std::abs(v0.mAntiLambda() - o2::constants::physics::MassLambda0)}; const double dMassG{std::abs(v0.mGamma() - o2::constants::physics::MassGamma)}; - int posIndexEta{0}; - int negIndexEta{0}; - for (int i = 1; i < kNEtaHists; ++i) { - if (std::abs(posTrkEta) >= kLowEta[i] && std::abs(posTrkEta) < kHighEta[i]) { + int posIndexEta{-999}; + int negIndexEta{-999}; + for (int i = 0; i < kNEtaHists; ++i) { + if (posTrkEta >= kLowEta[i] && posTrkEta < kHighEta[i]) { posIndexEta = i; break; } } - for (int i = 1; i < kNEtaHists; ++i) { - if (std::abs(negTrkEta) >= kLowEta[i] && std::abs(negTrkEta) < kHighEta[i]) { + for (int i = 0; i < kNEtaHists; ++i) { + if (negTrkEta >= kLowEta[i] && negTrkEta < kHighEta[i]) { negIndexEta = i; break; } } + if (posIndexEta < kZeroInt || posIndexEta > kSevenInt) + continue; + + if (negIndexEta < kZeroInt || negIndexEta > kSevenInt) + continue; + if (passesTopoSel) { registry.fill(HIST("ArmAfterTopoSel"), alpha, qT); registry.fill(HIST("dcaDauVsPt"), v0.pt(), v0.dcapostopv()); @@ -678,6 +718,7 @@ struct PiKpRAA { if (passesK0Selection(collision, v0)) { // nSigma TPC and y cuts registry.fill(HIST("ArmK0NOSel"), alpha, qT); if (v0Selections.armPodCut * qT > std::abs(alpha)) { // Armenters selection + registry.fill(HIST("V0sCounter"), V0sCounter::K0s); registry.fill(HIST("ArmK0"), alpha, qT); registry.fill(HIST("MassK0sVsPt"), v0.pt(), v0.mK0Short()); registry.fill(HIST("nSigPiFromK0s"), posTrkPt, posTrack.tpcNSigmaPi()); @@ -686,11 +727,10 @@ struct PiKpRAA { registry.fill(HIST("NclVsEtaPiV0p"), posTrkEta, posTrack.tpcNClsFound()); registry.fill(HIST("NclVsEtaPiV0"), negTrkEta, negTrack.tpcNClsFound()); registry.fill(HIST("NclVsEtaPiV0p"), negTrkEta, negTrack.tpcNClsFound()); - registry.fill(HIST("NclPiV0"), posPorPt, posTrack.tpcNClsFound()); - registry.fill(HIST("NclPiV0p"), posPorPt, posTrack.tpcNClsFound()); - registry.fill(HIST("NclPiV0"), negPorPt, negTrack.tpcNClsFound()); - registry.fill(HIST("NclPiV0p"), negPorPt, negTrack.tpcNClsFound()); - + nClVsPPiV0[posIndexEta]->Fill(posPorPt, posTrack.tpcNClsFound()); + nClVsPpPiV0[posIndexEta]->Fill(posPorPt, posTrack.tpcNClsFound()); + nClVsPPiV0[negIndexEta]->Fill(negPorPt, negTrack.tpcNClsFound()); + nClVsPpPiV0[negIndexEta]->Fill(negPorPt, negTrack.tpcNClsFound()); dEdxPiV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); dEdxPiV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); @@ -710,6 +750,7 @@ struct PiKpRAA { if (v0Selections.applyInvMassSel) { if (dMassL < v0Selections.dMassSel && dMassK0s > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG) { if (passesLambdaSelection(collision, v0)) { + registry.fill(HIST("V0sCounter"), V0sCounter::Lambda); registry.fill(HIST("ArmL"), alpha, qT); registry.fill(HIST("MassLVsPt"), v0.pt(), v0.mLambda()); registry.fill(HIST("nSigPrFromL"), posTrkPt, posTrack.tpcNSigmaPr()); @@ -718,10 +759,10 @@ struct PiKpRAA { registry.fill(HIST("NclVsEtaPrV0p"), posTrkEta, posTrack.tpcNClsFound()); registry.fill(HIST("NclVsEtaPiV0"), negTrkEta, negTrack.tpcNClsFound()); registry.fill(HIST("NclVsEtaPiV0p"), negTrkEta, negTrack.tpcNClsFound()); - registry.fill(HIST("NclPrV0"), posPorPt, posTrack.tpcNClsFound()); - registry.fill(HIST("NclPrV0p"), posPorPt, posTrack.tpcNClsFound()); - registry.fill(HIST("NclPiV0"), negPorPt, negTrack.tpcNClsFound()); - registry.fill(HIST("NclPiV0p"), negPorPt, negTrack.tpcNClsFound()); + nClVsPPrV0[posIndexEta]->Fill(posPorPt, posTrack.tpcNClsFound()); + nClVsPpPrV0[posIndexEta]->Fill(posPorPt, posTrack.tpcNClsFound()); + nClVsPPiV0[negIndexEta]->Fill(negPorPt, negTrack.tpcNClsFound()); + nClVsPpPiV0[negIndexEta]->Fill(negPorPt, negTrack.tpcNClsFound()); dEdxPrV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); dEdxPiV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); } @@ -730,6 +771,7 @@ struct PiKpRAA { if (v0Selections.applyInvMassSel && dMassAL < v0Selections.dMassSel && dMassK0s > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG) { if (passesAntiLambdaSelection(collision, v0)) { + registry.fill(HIST("V0sCounter"), V0sCounter::AntiLambda); registry.fill(HIST("ArmAL"), alpha, qT); registry.fill(HIST("MassALVsPt"), v0.pt(), v0.mAntiLambda()); registry.fill(HIST("nSigPrFromAL"), negTrkPt, negTrack.tpcNSigmaPr()); @@ -738,10 +780,10 @@ struct PiKpRAA { registry.fill(HIST("NclVsEtaPiV0p"), posTrkEta, posTrack.tpcNClsFound()); registry.fill(HIST("NclVsEtaPrV0"), negTrkEta, negTrack.tpcNClsFound()); registry.fill(HIST("NclVsEtaPrV0p"), negTrkEta, negTrack.tpcNClsFound()); - registry.fill(HIST("NclPiV0"), posPorPt, posTrack.tpcNClsFound()); - registry.fill(HIST("NclPiV0p"), posPorPt, posTrack.tpcNClsFound()); - registry.fill(HIST("NclPrV0"), negPorPt, negTrack.tpcNClsFound()); - registry.fill(HIST("NclPrV0p"), negPorPt, negTrack.tpcNClsFound()); + nClVsPPrV0[negIndexEta]->Fill(negPorPt, negTrack.tpcNClsFound()); + nClVsPpPrV0[negIndexEta]->Fill(negPorPt, negTrack.tpcNClsFound()); + nClVsPPiV0[posIndexEta]->Fill(posPorPt, posTrack.tpcNClsFound()); + nClVsPpPiV0[posIndexEta]->Fill(posPorPt, posTrack.tpcNClsFound()); dEdxPrV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); dEdxPiV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); } @@ -751,6 +793,7 @@ struct PiKpRAA { if (v0Selections.applyInvMassSel && dMassK0s > v0Selections.dMassSel && dMassL > v0Selections.dMassSel && dMassAL > v0Selections.dMassSel && dMassG < v0Selections.dMassGcut) { if (passesGammaSelection(collision, v0)) { if (std::abs(alpha) < v0Selections.armAlphaSel && qT < v0Selections.qTSel) { + registry.fill(HIST("V0sCounter"), V0sCounter::Gamma); registry.fill(HIST("ArmG"), alpha, qT); registry.fill(HIST("MassGVsPt"), v0.pt(), v0.mGamma()); registry.fill(HIST("nSigElFromG"), negTrkPt, negTrack.tpcNSigmaEl()); @@ -759,10 +802,10 @@ struct PiKpRAA { registry.fill(HIST("NclVsEtaElV0p"), posTrkEta, posTrack.tpcNClsFound()); registry.fill(HIST("NclVsEtaElV0"), negTrkEta, negTrack.tpcNClsFound()); registry.fill(HIST("NclVsEtaElV0p"), negTrkEta, negTrack.tpcNClsFound()); - registry.fill(HIST("NclElV0"), posPorPt, posTrack.tpcNClsFound()); - registry.fill(HIST("NclElV0p"), posPorPt, posTrack.tpcNClsFound()); - registry.fill(HIST("NclElV0"), negPorPt, negTrack.tpcNClsFound()); - registry.fill(HIST("NclElV0p"), negPorPt, negTrack.tpcNClsFound()); + nClVsPElV0[negIndexEta]->Fill(negPorPt, negTrack.tpcNClsFound()); + nClVsPpElV0[negIndexEta]->Fill(negPorPt, negTrack.tpcNClsFound()); + nClVsPElV0[posIndexEta]->Fill(posPorPt, posTrack.tpcNClsFound()); + nClVsPpElV0[posIndexEta]->Fill(posPorPt, posTrack.tpcNClsFound()); registry.fill(HIST("dEdxVsEtaElMIPV0"), posTrkEta, posTrkdEdx); registry.fill(HIST("dEdxVsEtaElMIPV0p"), posTrkEta, posTrkdEdx); registry.fill(HIST("dEdxVsEtaElMIPV0"), negTrkEta, negTrkdEdx); @@ -857,6 +900,9 @@ struct PiKpRAA { const double posRadiusNsigma{std::sqrt(std::pow(posTPCNsigma, 2.) + std::pow(posTOFNsigma, 2.))}; const double negRadiusNsigma{std::sqrt(std::pow(negTPCNsigma, 2.) + std::pow(negTOFNsigma, 2.))}; + registry.fill(HIST("EtaVsYK0s"), negTrack.eta(), v0.yK0Short()); + registry.fill(HIST("EtaVsYK0s"), posTrack.eta(), v0.yK0Short()); + bool isSelected{false}; if (v0Selections.applyTPCTOFCombinedCut) isSelected = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecut->get("lifetimecutK0S") && std::abs(v0.yK0Short()) < v0Selections.rapidityCut && posTrack.hasTOF() && negTrack.hasTOF() && posRadiusNsigma < v0Selections.tpcPidNsigmaCut && negRadiusNsigma < v0Selections.tpcPidNsigmaCut ? true : false; @@ -881,6 +927,9 @@ struct PiKpRAA { const double posRadiusNsigma{std::sqrt(std::pow(posTPCNsigma, 2.) + std::pow(posTOFNsigma, 2.))}; const double negRadiusNsigma{std::sqrt(std::pow(negTPCNsigma, 2.) + std::pow(negTOFNsigma, 2.))}; + registry.fill(HIST("EtaVsYPiL"), negTrack.eta(), v0.yLambda()); + registry.fill(HIST("EtaVsYPrL"), posTrack.eta(), v0.yLambda()); + bool isSelected{false}; if (v0Selections.applyTPCTOFCombinedCut) isSelected = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 < lifetimecut->get("lifetimecutLambda") && std::abs(v0.yLambda()) < v0Selections.rapidityCut && posTrack.hasTOF() && negTrack.hasTOF() && posRadiusNsigma < v0Selections.tpcPidNsigmaCut && negRadiusNsigma < v0Selections.tpcPidNsigmaCut ? true : false; @@ -905,6 +954,9 @@ struct PiKpRAA { const double posRadiusNsigma{std::sqrt(std::pow(posTPCNsigma, 2.) + std::pow(posTOFNsigma, 2.))}; const double negRadiusNsigma{std::sqrt(std::pow(negTPCNsigma, 2.) + std::pow(negTOFNsigma, 2.))}; + registry.fill(HIST("EtaVsYPiAL"), posTrack.eta(), v0.yLambda()); + registry.fill(HIST("EtaVsYPrAL"), negTrack.eta(), v0.yLambda()); + bool isSelected{false}; if (v0Selections.applyTPCTOFCombinedCut) isSelected = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 < lifetimecut->get("lifetimecutLambda") && std::abs(v0.yLambda()) < v0Selections.rapidityCut && posTrack.hasTOF() && negTrack.hasTOF() && posRadiusNsigma < v0Selections.tpcPidNsigmaCut && negRadiusNsigma < v0Selections.tpcPidNsigmaCut ? true : false; @@ -928,6 +980,9 @@ struct PiKpRAA { const double negRadiusNsigma{std::sqrt(std::pow(negTPCNsigma, 2.) + std::pow(negTOFNsigma, 2.))}; const float yGamma = RecoDecay::y(std::array{v0.px(), v0.py(), v0.pz()}, o2::constants::physics::MassGamma); + registry.fill(HIST("EtaVsYG"), negTrack.eta(), yGamma); + registry.fill(HIST("EtaVsYG"), posTrack.eta(), yGamma); + if (!(std::abs(yGamma) < v0Selections.rapidityCut)) return false; From 5ad70216dcb47cfe21971d1c992cb7c3dd768ab7 Mon Sep 17 00:00:00 2001 From: Victor Gonzalez Date: Thu, 4 Sep 2025 00:12:59 +0200 Subject: [PATCH 300/986] [PWGCF] DptDpt - Consistency between QC histo and exclusion formula (#12846) Co-authored-by: Victor --- PWGCF/TableProducer/dptDptFilter.cxx | 44 ++++++++++++++-------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/PWGCF/TableProducer/dptDptFilter.cxx b/PWGCF/TableProducer/dptDptFilter.cxx index 8dc1e100970..4f5d3644d75 100644 --- a/PWGCF/TableProducer/dptDptFilter.cxx +++ b/PWGCF/TableProducer/dptDptFilter.cxx @@ -635,11 +635,11 @@ struct DptDptFilter { if (cfgEventSelection.fillQc) { /* the quality control histograms */ for (int i = 0; i < BeforeAfterNOOFTIMES; ++i) { - fhMultiplicityVsCentrality[i] = new TH2F(TString::Format("MultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);Number of tracks", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); - fhMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsT0cMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0C Multiplicity;Number of tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0C), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); - fhMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsT0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0A Multiplicity;Number of tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0A), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); - fhMultiplicityVsV0aMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsV0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;V0A Multiplicity;Number of tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceV0A), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); - fhMultiplicityVsPvMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsPvMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;PV contributors;Number of tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); + fhMultiplicityVsCentrality[i] = new TH2F(TString::Format("MultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);Global tracks", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); + fhMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsT0cMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0C Multiplicity;Global tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0C), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); + fhMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsT0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0A Multiplicity;Global tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0A), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); + fhMultiplicityVsV0aMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsV0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;V0A Multiplicity;Global tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceV0A), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); + fhMultiplicityVsPvMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsPvMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;PV contributors;Global tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); fhPvMultiplicityVsCentrality[i] = new TH2F(TString::Format("PvMultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);PV contributors", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); fhPvMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("PvMultiplicityVsT0cMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0C multiplicity;PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0C), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); fhPvMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("PvMultiplicityVsT0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0A multiplicity;PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0A), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); @@ -834,24 +834,24 @@ void DptDptFilter::processReconstructed(CollisionObject const& collision, Tracks /* report QC information if required */ if (cfgEventSelection.fillQc) { auto fillHistograms = [&](int step) { - fhMultiplicityVsCentrality[step]->Fill(centormult, ftracks.size()); - fhMultiplicityVsT0cMultiplicity[step]->Fill(collision.multFT0C(), ftracks.size()); - fhMultiplicityVsT0aMultiplicity[step]->Fill(collision.multFT0A(), ftracks.size()); - fhMultiplicityVsV0aMultiplicity[step]->Fill(collision.multFV0A(), ftracks.size()); - fhMultiplicityVsPvMultiplicity[step]->Fill(collision.multNTracksPV(), ftracks.size()); - fhPvMultiplicityVsCentrality[step]->Fill(centormult, collision.multNTracksPV()); - fhPvMultiplicityVsT0cMultiplicity[step]->Fill(collision.multFT0C(), collision.multNTracksPV()); - fhPvMultiplicityVsT0aMultiplicity[step]->Fill(collision.multFT0A(), collision.multNTracksPV()); - fhPvMultiplicityVsV0aMultiplicity[step]->Fill(collision.multFV0A(), collision.multNTracksPV()); - fhV0aMultiplicityVsCentrality[step]->Fill(centormult, collision.multFV0A()); - fhV0aMultiplicityVsT0cMultiplicity[step]->Fill(collision.multFT0C(), collision.multFV0A()); - fhV0aMultiplicityVsT0aMultiplicity[step]->Fill(collision.multFT0A(), collision.multFV0A()); - fhT0cMultiplicityVsCentrality[step]->Fill(centormult, collision.multFT0C()); - fhT0cMultiplicityVsT0aMultiplicity[step]->Fill(collision.multFT0A(), collision.multFT0C()); + fhMultiplicityVsCentrality[step]->Fill(centormult, collisionMultiplicityCentralityObservables[CentMultCorrelationsMNGLTRK]); + fhMultiplicityVsT0cMultiplicity[step]->Fill(collisionMultiplicityCentralityObservables[CentMultCorrelationsMT0C], collisionMultiplicityCentralityObservables[CentMultCorrelationsMNGLTRK]); + fhMultiplicityVsT0aMultiplicity[step]->Fill(collisionMultiplicityCentralityObservables[CentMultCorrelationsMT0A], collisionMultiplicityCentralityObservables[CentMultCorrelationsMNGLTRK]); + fhMultiplicityVsV0aMultiplicity[step]->Fill(collisionMultiplicityCentralityObservables[CentMultCorrelationsMV0A], collisionMultiplicityCentralityObservables[CentMultCorrelationsMNGLTRK]); + fhMultiplicityVsPvMultiplicity[step]->Fill(collisionMultiplicityCentralityObservables[CentMultCorrelationsMNPVC], collisionMultiplicityCentralityObservables[CentMultCorrelationsMNGLTRK]); + fhPvMultiplicityVsCentrality[step]->Fill(centormult, collisionMultiplicityCentralityObservables[CentMultCorrelationsMNPVC]); + fhPvMultiplicityVsT0cMultiplicity[step]->Fill(collisionMultiplicityCentralityObservables[CentMultCorrelationsMT0C], collisionMultiplicityCentralityObservables[CentMultCorrelationsMNPVC]); + fhPvMultiplicityVsT0aMultiplicity[step]->Fill(collisionMultiplicityCentralityObservables[CentMultCorrelationsMT0A], collisionMultiplicityCentralityObservables[CentMultCorrelationsMNPVC]); + fhPvMultiplicityVsV0aMultiplicity[step]->Fill(collisionMultiplicityCentralityObservables[CentMultCorrelationsMV0A], collisionMultiplicityCentralityObservables[CentMultCorrelationsMNPVC]); + fhV0aMultiplicityVsCentrality[step]->Fill(centormult, collisionMultiplicityCentralityObservables[CentMultCorrelationsMV0A]); + fhV0aMultiplicityVsT0cMultiplicity[step]->Fill(collisionMultiplicityCentralityObservables[CentMultCorrelationsMT0C], collisionMultiplicityCentralityObservables[CentMultCorrelationsMV0A]); + fhV0aMultiplicityVsT0aMultiplicity[step]->Fill(collisionMultiplicityCentralityObservables[CentMultCorrelationsMT0A], collisionMultiplicityCentralityObservables[CentMultCorrelationsMV0A]); + fhT0cMultiplicityVsCentrality[step]->Fill(centormult, collisionMultiplicityCentralityObservables[CentMultCorrelationsMT0C]); + fhT0cMultiplicityVsT0aMultiplicity[step]->Fill(collisionMultiplicityCentralityObservables[CentMultCorrelationsMT0A], collisionMultiplicityCentralityObservables[CentMultCorrelationsMT0C]); if constexpr (framework::has_type_v) { - fhT0CentralityVsCentrality[step]->Fill(centormult, collision.centFT0M()); - fhV0aCentralityVsCentrality[step]->Fill(centormult, collision.centFV0A()); - fhNtpvCentralityVsCentrality[step]->Fill(centormult, collision.centNTPV()); + fhT0CentralityVsCentrality[step]->Fill(centormult, collisionMultiplicityCentralityObservables[CentMultCorrelationsCT0M]); + fhV0aCentralityVsCentrality[step]->Fill(centormult, collisionMultiplicityCentralityObservables[CentMultCorrelationsCV0A]); + fhNtpvCentralityVsCentrality[step]->Fill(centormult, collisionMultiplicityCentralityObservables[CentMultCorrelationsCNTPV]); } }; for (int i = 0; i < BeforeAfterNOOFTIMES; ++i) { From f6a1a57f4b6b97dc2341c6a81f37bc9c1d558b95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= <26327373+vkucera@users.noreply.github.com> Date: Thu, 4 Sep 2025 02:23:09 +0200 Subject: [PATCH 301/986] [PWGJE] taskEmcExtensiveMcQa: Fix missing namespace prefix (#12848) --- PWGJE/Tasks/taskEmcExtensiveMcQa.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGJE/Tasks/taskEmcExtensiveMcQa.cxx b/PWGJE/Tasks/taskEmcExtensiveMcQa.cxx index 9c2002c9a11..7bd1e5c53fd 100644 --- a/PWGJE/Tasks/taskEmcExtensiveMcQa.cxx +++ b/PWGJE/Tasks/taskEmcExtensiveMcQa.cxx @@ -84,7 +84,7 @@ struct TaskEmcExtensiveMcQa { o2::emcal::Geometry* mGeometry = nullptr; o2::framework::Service ccdb; - ctpRateFetcher rateFetcher; + o2::ctpRateFetcher rateFetcher; HfEventSelection hfEvSel; HfEventSelectionMc hfEvSelMc; @@ -148,7 +148,7 @@ struct TaskEmcExtensiveMcQa { template bool isCollSelected(const Coll& coll, float& cent) { - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(coll, cent, ccdb, mHistManager); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(coll, cent, ccdb, mHistManager); /// monitor the satisfied event selections hfEvSel.fillHistograms(coll, rejectionMask, cent); return rejectionMask == 0; From 29f4897cbb1fc004a336860744266137e3e7e2f3 Mon Sep 17 00:00:00 2001 From: spucillo <93769017+spucillo@users.noreply.github.com> Date: Thu, 4 Sep 2025 04:36:04 +0200 Subject: [PATCH 302/986] [PWGLF] Add correlation histograms (#12845) --- .../cascadeAnalysisLightIonsDerivedData.cxx | 119 +++++++++++------- 1 file changed, 71 insertions(+), 48 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx b/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx index 5d7178c60e5..2453c10309a 100644 --- a/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx +++ b/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx @@ -93,7 +93,7 @@ struct CascadeAnalysisLightIonsDerivedData { Configurable rejectITSROFBorder{"rejectITSROFBorder", true, "reject events at ITS ROF border"}; Configurable rejectTFBorder{"rejectTFBorder", true, "reject events at TF border"}; Configurable requireVertexITSTPC{"requireVertexITSTPC", false, "require events with at least one ITS-TPC track"}; - Configurable requireIsGoodZvtxFT0VsPV{"requireIsGoodZvtxFT0VsPV", false, "require is good Zvtx FT0 vs PV"}; + Configurable requireIsGoodZvtxFT0VsPV{"requireIsGoodZvtxFT0VsPV", true, "require is good Zvtx FT0 vs PV"}; Configurable requireIsVertexTOFmatched{"requireIsVertexTOFmatched", false, "require events with at least one of vertex contributors matched to TOF"}; Configurable requireIsVertexTRDmatched{"requireIsVertexTRDmatched", false, "require events with at least one of vertex contributors matched to TRD"}; Configurable rejectSameBunchPileup{"rejectSameBunchPileup", true, "reject collisions in case of pileup with another collision in the same foundBC"}; @@ -134,6 +134,7 @@ struct CascadeAnalysisLightIonsDerivedData { ConfigurableAxis centEstimatorHistBin{"centEstimatorHistBin", {501, -0.5, 500.5}, ""}; ConfigurableAxis centralityBinning{"centralityBinning", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, ""}; ConfigurableAxis axisNch{"axisNch", {500, 0.0f, +1000.0f}, "Number of charged particles"}; + ConfigurableAxis axisMult{"axisMult", {500, 0.0f, +1000.0f}, "Multiplicity"}; // Centrality estimator Configurable centralityEstimator{"centralityEstimator", 0, "0 = FT0C, 1 = FTOM, 2 = FV0A, 3 = NGlobal"}; @@ -200,6 +201,7 @@ struct CascadeAnalysisLightIonsDerivedData { // Multiplicity Histograms registryData.add("hCentEstimator", "hCentEstimator", HistType::kTH1D, {axisCentEstimator}); registryData.add("hCentralityVsNch", "hCentralityVsNch", HistType::kTH2D, {axisCentEstimator, axisNch}); + registryData.add("hCentralityVsMultiplicity", "hCentralityVsMultiplicity", HistType::kTH2D, {axisCentEstimator, axisMult}); // Histograms for xi (data) registryData.add("hMassXipos", "hMassXipos", HistType::kTH3F, {centAxis, ptAxis, invMassXiAxis}); @@ -244,6 +246,7 @@ struct CascadeAnalysisLightIonsDerivedData { // Multiplicity Histograms registryMC.add("hCentEstimator_truerec", "hCentEstimator_truerec", HistType::kTH1D, {axisCentEstimator}); registryMC.add("hCentralityVsNch_truerec", "hCentralityVsNch_truerec", HistType::kTH2D, {axisCentEstimator, axisNch}); + registryMC.add("hCentralityVsMultiplicity_truerec", "hCentralityVsMultiplicity_truerec", HistType::kTH2D, {axisCentEstimator, axisMult}); // Histograms for xi (mc) registryMC.add("hMassXipos_truerec", "hMassXipos_truerec", HistType::kTH3F, {centAxis, ptAxis, invMassXiAxis}); @@ -623,7 +626,7 @@ struct CascadeAnalysisLightIonsDerivedData { bool atLeastOne = false; int biggestNContribs = -1; int nCollisions = 0; - float multiplicitydata = -1.0f; + float centralitydata = -1.0f; for (auto const& collision : groupedCollisions) { // event selections if (applySel8 && !collision.sel8()) @@ -663,29 +666,29 @@ struct CascadeAnalysisLightIonsDerivedData { if (biggestNContribs < collision.multPVTotalContributors()) { biggestNContribs = collision.multPVTotalContributors(); if (centralityEstimator == Option::kFT0C) - multiplicitydata = collision.centFT0C(); + centralitydata = collision.centFT0C(); if (centralityEstimator == Option::kFT0M) - multiplicitydata = collision.centFT0M(); + centralitydata = collision.centFT0M(); if (centralityEstimator == Option::kFV0A) - multiplicitydata = collision.centFV0A(); + centralitydata = collision.centFV0A(); if (centralityEstimator == Option::kNGlobal) - multiplicitydata = collision.centNGlobal(); + centralitydata = collision.centNGlobal(); } nCollisions++; atLeastOne = true; } - registryMC.fill(HIST("hCentralityVsNcoll_beforeEvSel"), multiplicitydata, groupedCollisions.size()); - registryMC.fill(HIST("hCentralityVsNcoll_afterEvSel"), multiplicitydata, nCollisions); - registryMC.fill(HIST("hCentralityVsMultMC"), multiplicitydata, mcCollisions.multMCNParticlesEta05()); + registryMC.fill(HIST("hCentralityVsNcoll_beforeEvSel"), centralitydata, groupedCollisions.size()); + registryMC.fill(HIST("hCentralityVsNcoll_afterEvSel"), centralitydata, nCollisions); + registryMC.fill(HIST("hCentralityVsMultMC"), centralitydata, mcCollisions.multMCNParticlesEta05()); registryQC.fill(HIST("hVertexZGen"), mcCollisions.posZ()); if (atLeastOne) { registryMC.fill(HIST("hGenEvents"), mcCollisions.multMCNParticlesEta05(), 1 /* at least 1 rec. event*/); - registryMC.fill(HIST("hGenEventCentrality"), multiplicitydata); + registryMC.fill(HIST("hGenEventCentrality"), centralitydata); } } return; @@ -747,20 +750,30 @@ struct CascadeAnalysisLightIonsDerivedData { // Store the Zvtx registryQC.fill(HIST("hVertexZdata"), std::fabs(collision.posZ())); - // Store the event multiplicity using different estimators + // Store the event centrality using different estimators + float centrality = -1.0f; float multiplicity = -1.0f; - if (centralityEstimator == Option::kFT0C) - multiplicity = collision.centFT0C(); - if (centralityEstimator == Option::kFT0M) - multiplicity = collision.centFT0M(); - if (centralityEstimator == Option::kFV0A) - multiplicity = collision.centFV0A(); - if (centralityEstimator == Option::kNGlobal) - multiplicity = collision.centNGlobal(); + if (centralityEstimator == Option::kFT0C) { + centrality = collision.centFT0C(); + multiplicity = collision.multFT0C(); + } + if (centralityEstimator == Option::kFT0M) { + centrality = collision.centFT0M(); + multiplicity = collision.multFT0C() + collision.multFT0A(); + } + if (centralityEstimator == Option::kFV0A) { + centrality = collision.centFV0A(); + multiplicity = collision.multFV0A(); + } + if (centralityEstimator == Option::kNGlobal) { + centrality = collision.centNGlobal(); + multiplicity = collision.multNTracksGlobal(); + } - registryData.fill(HIST("hCentEstimator"), multiplicity); - registryData.fill(HIST("hCentralityVsNch"), multiplicity, collision.multNTracksPVeta1()); + registryData.fill(HIST("hCentEstimator"), centrality); + registryData.fill(HIST("hCentralityVsNch"), centrality, collision.multNTracksPVeta1()); + registryData.fill(HIST("hCentralityVsMultiplicity"), centrality, multiplicity); // Loop over cascades for (const auto& casc : fullCascades) { @@ -788,25 +801,25 @@ struct CascadeAnalysisLightIonsDerivedData { // ------------------------------------- Store selctions distribution for analysis if (casc.sign() < 0) { - registryData.fill(HIST("hMassXineg"), multiplicity, casc.pt(), casc.mXi()); - registryData.fill(HIST("hMassOmeganeg"), multiplicity, casc.pt(), casc.mOmega()); + registryData.fill(HIST("hMassXineg"), centrality, casc.pt(), casc.mXi()); + registryData.fill(HIST("hMassOmeganeg"), centrality, casc.pt(), casc.mOmega()); } if (casc.sign() > 0) { - registryData.fill(HIST("hMassXipos"), multiplicity, casc.pt(), casc.mXi()); - registryData.fill(HIST("hMassOmegapos"), multiplicity, casc.pt(), casc.mOmega()); + registryData.fill(HIST("hMassXipos"), centrality, casc.pt(), casc.mXi()); + registryData.fill(HIST("hMassOmegapos"), centrality, casc.pt(), casc.mOmega()); } if (casc.sign() < 0 && passedXiSelection(casc, pos, neg, bach, collision)) { - registryData.fill(HIST("hMassXinegSelected"), multiplicity, casc.pt(), casc.mXi()); + registryData.fill(HIST("hMassXinegSelected"), centrality, casc.pt(), casc.mXi()); } if (casc.sign() < 0 && passedOmegaSelection(casc, pos, neg, bach, collision)) { - registryData.fill(HIST("hMassOmeganegSelected"), multiplicity, casc.pt(), casc.mOmega()); + registryData.fill(HIST("hMassOmeganegSelected"), centrality, casc.pt(), casc.mOmega()); } if (casc.sign() > 0 && passedXiSelection(casc, pos, neg, bach, collision)) { - registryData.fill(HIST("hMassXiposSelected"), multiplicity, casc.pt(), casc.mXi()); + registryData.fill(HIST("hMassXiposSelected"), centrality, casc.pt(), casc.mXi()); } if (casc.sign() > 0 && passedOmegaSelection(casc, pos, neg, bach, collision)) { - registryData.fill(HIST("hMassOmegaposSelected"), multiplicity, casc.pt(), casc.mOmega()); + registryData.fill(HIST("hMassOmegaposSelected"), centrality, casc.pt(), casc.mOmega()); } } } @@ -869,20 +882,30 @@ struct CascadeAnalysisLightIonsDerivedData { // Store the Zvtx registryQC.fill(HIST("hVertexZRec"), RecCol.posZ()); - // Store the event multiplicity using different estimators + // Store the event centrality using different estimators + float centralityMcRec = -1.0f; float multiplicityMcRec = -1.0f; - if (centralityEstimator == Option::kFT0C) - multiplicityMcRec = RecCol.centFT0C(); - if (centralityEstimator == Option::kFT0M) - multiplicityMcRec = RecCol.centFT0M(); - if (centralityEstimator == Option::kFV0A) - multiplicityMcRec = RecCol.centFV0A(); - if (centralityEstimator == Option::kNGlobal) - multiplicityMcRec = RecCol.centNGlobal(); + if (centralityEstimator == Option::kFT0C) { + centralityMcRec = RecCol.centFT0C(); + multiplicityMcRec = RecCol.multFT0C(); + } + if (centralityEstimator == Option::kFT0M) { + centralityMcRec = RecCol.centFT0M(); + multiplicityMcRec = RecCol.multFT0C() + RecCol.multFT0A(); + } + if (centralityEstimator == Option::kFV0A) { + centralityMcRec = RecCol.centFV0A(); + multiplicityMcRec = RecCol.multFV0A(); + } + if (centralityEstimator == Option::kNGlobal) { + centralityMcRec = RecCol.centNGlobal(); + multiplicityMcRec = RecCol.multNTracksGlobal(); + } - registryMC.fill(HIST("hCentEstimator_truerec"), multiplicityMcRec); - registryMC.fill(HIST("hCentralityVsNch_truerec"), multiplicityMcRec, RecCol.multNTracksPVeta1()); + registryMC.fill(HIST("hCentEstimator_truerec"), centralityMcRec); + registryMC.fill(HIST("hCentralityVsNch_truerec"), centralityMcRec, RecCol.multNTracksPVeta1()); + registryMC.fill(HIST("hCentralityVsMultiplicity_truerec"), centralityMcRec, multiplicityMcRec); for (const auto& casc : fullCascades) { if (etaMin > casc.bacheloreta() || casc.bacheloreta() > etaMax || @@ -923,33 +946,33 @@ struct CascadeAnalysisLightIonsDerivedData { // ------------------------------------- Store selctions distribution for analysis if (casc.sign() < 0) { if (pdgParent == kXiMinus) { - registryMC.fill(HIST("hMassXineg_truerec"), multiplicityMcRec, ptmc, casc.mXi()); + registryMC.fill(HIST("hMassXineg_truerec"), centralityMcRec, ptmc, casc.mXi()); } if (pdgParent == kOmegaMinus) { - registryMC.fill(HIST("hMassOmeganeg_truerec"), multiplicityMcRec, ptmc, casc.mOmega()); + registryMC.fill(HIST("hMassOmeganeg_truerec"), centralityMcRec, ptmc, casc.mOmega()); } } if (casc.sign() > 0) { if (pdgParent == kXiPlusBar) { - registryMC.fill(HIST("hMassXipos_truerec"), multiplicityMcRec, ptmc, casc.mXi()); + registryMC.fill(HIST("hMassXipos_truerec"), centralityMcRec, ptmc, casc.mXi()); } if (pdgParent == kOmegaPlusBar) { - registryMC.fill(HIST("hMassOmegapos_truerec"), multiplicityMcRec, ptmc, casc.mOmega()); + registryMC.fill(HIST("hMassOmegapos_truerec"), centralityMcRec, ptmc, casc.mOmega()); } } if (casc.sign() < 0 && pdgParent == kXiMinus && passedXiSelection(casc, pos, neg, bach, RecCol)) { - registryMC.fill(HIST("hMassXinegSelected_truerec"), multiplicityMcRec, ptmc, casc.mXi()); + registryMC.fill(HIST("hMassXinegSelected_truerec"), centralityMcRec, ptmc, casc.mXi()); } if (casc.sign() < 0 && pdgParent == kOmegaMinus && passedOmegaSelection(casc, pos, neg, bach, RecCol)) { - registryMC.fill(HIST("hMassOmeganegSelected_truerec"), multiplicityMcRec, ptmc, casc.mOmega()); + registryMC.fill(HIST("hMassOmeganegSelected_truerec"), centralityMcRec, ptmc, casc.mOmega()); } if (casc.sign() > 0 && pdgParent == kXiPlusBar && passedXiSelection(casc, pos, neg, bach, RecCol)) { - registryMC.fill(HIST("hMassXiposSelected_truerec"), multiplicityMcRec, ptmc, casc.mXi()); + registryMC.fill(HIST("hMassXiposSelected_truerec"), centralityMcRec, ptmc, casc.mXi()); } if (casc.sign() > 0 && pdgParent == kOmegaPlusBar && passedOmegaSelection(casc, pos, neg, bach, RecCol)) { - registryMC.fill(HIST("hMassOmegaposSelected_truerec"), multiplicityMcRec, ptmc, casc.mOmega()); + registryMC.fill(HIST("hMassOmegaposSelected_truerec"), centralityMcRec, ptmc, casc.mOmega()); } } // casc loop } // rec.collision loop From 281b383592d821e076f7ae95d2c29801f0f280c0 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Thu, 4 Sep 2025 07:23:09 +0200 Subject: [PATCH 303/986] [PWGLF] Update V0 analysis task (#12842) Co-authored-by: ALICE Action Bot --- .../Strangeness/cascademlselection.cxx | 57 +- .../derivedlambdakzeroanalysis.cxx | 927 +++++++++++------- 2 files changed, 589 insertions(+), 395 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/cascademlselection.cxx b/PWGLF/TableProducer/Strangeness/cascademlselection.cxx index 6da4bc669e4..ab6952d1da3 100644 --- a/PWGLF/TableProducer/Strangeness/cascademlselection.cxx +++ b/PWGLF/TableProducer/Strangeness/cascademlselection.cxx @@ -73,6 +73,9 @@ struct cascademlselection { o2::ml::OnnxModel mlModelOmegaMinus; o2::ml::OnnxModel mlModelOmegaPlus; + // Custom grouping + std::vector> cascadesGrouped; + std::map metadata; Produces xiMLSelections; // optionally aggregate information from ML output for posterior analysis (derived data) @@ -261,30 +264,52 @@ struct cascademlselection { } } - void processDerivedData(soa::Join::iterator const& collision, CascDerivedDatas const& cascades) + void processDerivedData(soa::Join const& collisions, CascDerivedDatas const& cascades) { - initCCDB(collision); + // Custom grouping + cascadesGrouped.clear(); + cascadesGrouped.resize(collisions.size()); + + for (const auto& cascade : cascades) { + cascadesGrouped[cascade.straCollisionId()].push_back(cascade.globalIndex()); + } - histos.fill(HIST("hEventVertexZ"), collision.posZ()); - for (auto& casc : cascades) { - nCandidates++; - if (nCandidates % 50000 == 0) { - LOG(info) << "Candidates processed: " << nCandidates; + for (const auto& collision : collisions) { + initCCDB(collision); + + histos.fill(HIST("hEventVertexZ"), collision.posZ()); + for (std::size_t i = 0; i < cascadesGrouped[collision.globalIndex()].size(); i++) { + auto casc = cascades.rawIteratorAt(cascadesGrouped[collision.globalIndex()][i]); + nCandidates++; + if (nCandidates % 50000 == 0) { + LOG(info) << "Candidates processed: " << nCandidates; + } + processCandidate(casc); } - processCandidate(casc); } } - void processStandardData(aod::Collision const& collision, CascOriginalDatas const& cascades) + void processStandardData(aod::Collisions const& collisions, CascOriginalDatas const& cascades) { - initCCDB(collision); + // Custom grouping + cascadesGrouped.clear(); + cascadesGrouped.resize(collisions.size()); - histos.fill(HIST("hEventVertexZ"), collision.posZ()); - for (auto& casc : cascades) { - nCandidates++; - if (nCandidates % 50000 == 0) { - LOG(info) << "Candidates processed: " << nCandidates; + for (const auto& cascade : cascades) { + cascadesGrouped[cascade.collisionId()].push_back(cascade.globalIndex()); + } + + for (const auto& collision : collisions) { + initCCDB(collision); + + histos.fill(HIST("hEventVertexZ"), collision.posZ()); + for (std::size_t i = 0; i < cascadesGrouped[collision.globalIndex()].size(); i++) { + auto casc = cascades.rawIteratorAt(cascadesGrouped[collision.globalIndex()][i]); + nCandidates++; + if (nCandidates % 50000 == 0) { + LOG(info) << "Candidates processed: " << nCandidates; + } + processCandidate(casc); } - processCandidate(casc); } } diff --git a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx index fb3255fb412..0ec4fc8e3ca 100644 --- a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx @@ -28,44 +28,46 @@ // david.dobrigkeit.chinellato@cern.ch // -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "ReconstructionDataFormats/Track.h" -#include "CommonConstants/MathConstants.h" -#include "CommonConstants/PhysicsConstants.h" -#include "Common/Core/trackUtilities.h" -#include "Common/CCDB/ctpRateFetcher.h" -#include "Common/DataModel/EventSelection.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" #include "PWGLF/DataModel/LFStrangenessMLTables.h" #include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGUD/Core/SGSelector.h" + +#include "Common/CCDB/ctpRateFetcher.h" #include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" #include "Common/DataModel/PIDResponse.h" -#include "PWGUD/Core/SGSelector.h" +#include "Common/DataModel/TrackSelectionTables.h" #include "Tools/ML/MlResponse.h" #include "Tools/ML/model.h" +#include "CommonConstants/MathConstants.h" +#include "CommonConstants/PhysicsConstants.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -106,7 +108,25 @@ struct derivedlambdakzeroanalysis { Configurable irSource{"irSource", "T0VTX", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"}; Configurable centralityEstimator{"centralityEstimator", kCentFT0C, "Run 3 centrality estimator (0:CentFT0C, 1:CentFT0M, 3:CentFT0CVariant1, 4:CentMFT, 5:CentNGlobal)"}; + Configurable doEventQA{"doEventQA", false, "do event QA histograms"}; + Configurable doCompleteTopoQA{"doCompleteTopoQA", false, "do topological variable QA histograms"}; + Configurable doTPCQA{"doTPCQA", false, "do TPC QA histograms"}; + Configurable doTOFQA{"doTOFQA", false, "do TOF QA histograms"}; + Configurable doDetectPropQA{"doDetectPropQA", 0, "do Detector/ITS map QA: 0: no, 1: 4D, 2: 5D with mass; 3: plain in 3D"}; + Configurable doEtaPhiQA{"doEtaPhiQA", false, "do Eta/Phi QA histograms"}; + + Configurable doPlainTopoQA{"doPlainTopoQA", true, "do simple 1D QA of candidates"}; + Configurable qaMinPt{"qaMinPt", 0.0f, "minimum pT for QA plots"}; + Configurable qaMaxPt{"qaMaxPt", 1000.0f, "maximum pT for QA plots"}; + Configurable qaCentrality{"qaCentrality", false, "qa centrality flag: check base raw values"}; + + // for MC + Configurable doMCAssociation{"doMCAssociation", true, "if MC, do MC association"}; + Configurable doTreatPiToMuon{"doTreatPiToMuon", false, "Take pi decay into muon into account in MC"}; + Configurable doCollisionAssociationQA{"doCollisionAssociationQA", true, "check collision association"}; + struct : ConfigurableGroup { + std::string prefix = "eventSelections"; // JSON group name Configurable requireSel8{"requireSel8", true, "require sel8 event selection"}; Configurable requireTriggerTVX{"requireTriggerTVX", true, "require FT0 vertex (acceptable FT0C-FT0A time difference) at trigger level"}; Configurable rejectITSROFBorder{"rejectITSROFBorder", true, "reject events at ITS ROF border (Run 3 only)"}; @@ -153,7 +173,10 @@ struct derivedlambdakzeroanalysis { Configurable useSPDTrackletsCent{"useSPDTrackletsCent", false, "Use SPD tracklets for estimating centrality? If not, use V0M-based centrality (Run 2 only)"}; } eventSelections; + static constexpr float DefaultLifetimeCuts[1][2] = {{30., 20.}}; + struct : ConfigurableGroup { + std::string prefix = "v0Selections"; // JSON group name Configurable v0TypeSelection{"v0TypeSelection", 1, "select on a certain V0 type (leave negative if no selection desired)"}; // Selection criteria: acceptance @@ -167,6 +190,7 @@ struct derivedlambdakzeroanalysis { Configurable dcapostopv{"dcapostopv", .05, "min DCA Pos To PV (cm)"}; Configurable v0radius{"v0radius", 1.2, "minimum V0 radius (cm)"}; Configurable v0radiusMax{"v0radiusMax", 1E5, "maximum V0 radius (cm)"}; + Configurable> lifetimecut{"lifetimecut", {DefaultLifetimeCuts[0], 2, {"lifetimecutLambda", "lifetimecutK0S"}}, "lifetimecut"}; // Additional selection on the AP plot (exclusive for K0Short) // original equation: lArmPt*5>TMath::Abs(lArmAlpha) @@ -187,6 +211,9 @@ struct derivedlambdakzeroanalysis { Configurable rejectNegITSafterburner{"rejectNegITSafterburner", false, "reject negative track formed out of afterburner ITS tracks"}; Configurable requirePosITSafterburnerOnly{"requirePosITSafterburnerOnly", false, "require positive track formed out of afterburner ITS tracks"}; Configurable requireNegITSafterburnerOnly{"requireNegITSafterburnerOnly", false, "require negative track formed out of afterburner ITS tracks"}; + Configurable rejectTPCsectorBoundary{"rejectTPCsectorBoundary", false, "reject tracks close to the TPC sector boundaries"}; + Configurable phiLowCut{"phiLowCut", "0.06/x+pi/18.0-0.06", "Low azimuth cut parametrisation"}; + Configurable phiHighCut{"phiHighCut", "0.1/x+pi/18.0+0.06", "High azimuth cut parametrisation"}; // PID (TPC/TOF) Configurable tpcPidNsigmaCut{"tpcPidNsigmaCut", 5, "tpcPidNsigmaCut"}; @@ -199,21 +226,8 @@ struct derivedlambdakzeroanalysis { Configurable maxDeltaTimePion{"maxDeltaTimePion", 1e+9, "check maximum allowed time"}; } v0Selections; - Configurable doCompleteTopoQA{"doCompleteTopoQA", false, "do topological variable QA histograms"}; - Configurable doTPCQA{"doTPCQA", false, "do TPC QA histograms"}; - Configurable doTOFQA{"doTOFQA", false, "do TOF QA histograms"}; - Configurable doDetectPropQA{"doDetectPropQA", 0, "do Detector/ITS map QA: 0: no, 1: 4D, 2: 5D with mass; 3: plain in 3D"}; - Configurable doEtaPhiQA{"doEtaPhiQA", false, "do Eta/Phi QA histograms"}; - - Configurable doPlainTopoQA{"doPlainTopoQA", true, "do simple 1D QA of candidates"}; - Configurable qaMinPt{"qaMinPt", 0.0f, "minimum pT for QA plots"}; - Configurable qaMaxPt{"qaMaxPt", 1000.0f, "maximum pT for QA plots"}; - Configurable qaCentrality{"qaCentrality", false, "qa centrality flag: check base raw values"}; - - // for MC - Configurable doMCAssociation{"doMCAssociation", true, "if MC, do MC association"}; - Configurable doTreatPiToMuon{"doTreatPiToMuon", false, "Take pi decay into muon into account in MC"}; - Configurable doCollisionAssociationQA{"doCollisionAssociationQA", true, "check collision association"}; + TF1* fPhiCutLow = new TF1("fPhiCutLow", v0Selections.phiLowCut.value.data(), 0, 100); + TF1* fPhiCutHigh = new TF1("fPhiCutHigh", v0Selections.phiHighCut.value.data(), 0, 100); struct : ConfigurableGroup { std::string prefix = "rctConfigurations"; // JSON group name @@ -267,49 +281,74 @@ struct derivedlambdakzeroanalysis { Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; Configurable mVtxPath{"mVtxPath", "GLO/Calib/MeanVertex", "Path of the mean vertex file"}; + + // manual + Configurable useCustomMagField{"useCustomMagField", false, "Use custom magnetic field value"}; + Configurable customMagField{"customMagField", 5.0f, "Manually set magnetic field"}; } ccdbConfigurations; o2::ccdb::CcdbApi ccdbApi; Service ccdb; ctpRateFetcher rateFetcher; int mRunNumber; + float magField; std::map metadata; + o2::parameters::GRPMagField* grpmag = nullptr; - static constexpr float DefaultLifetimeCuts[1][2] = {{30., 20.}}; - Configurable> lifetimecut{"lifetimecut", {DefaultLifetimeCuts[0], 2, {"lifetimecutLambda", "lifetimecutK0S"}}, "lifetimecut"}; - - ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "pt axis for analysis"}; - ConfigurableAxis axisPtXi{"axisPtXi", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "pt axis for feeddown from Xi"}; - ConfigurableAxis axisPtCoarse{"axisPtCoarse", {VARIABLE_WIDTH, 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 7.0f, 10.0f, 15.0f}, "pt axis for QA"}; - ConfigurableAxis axisK0Mass{"axisK0Mass", {200, 0.4f, 0.6f}, ""}; - ConfigurableAxis axisLambdaMass{"axisLambdaMass", {200, 1.101f, 1.131f}, ""}; - ConfigurableAxis axisCentrality{"axisCentrality", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f}, "Centrality (%)"}; - ConfigurableAxis axisNch{"axisNch", {500, 0.0f, +5000.0f}, "Number of charged particles"}; - ConfigurableAxis axisIRBinning{"axisIRBinning", {500, 0, 50}, "Binning for the interaction rate (kHz)"}; - - ConfigurableAxis axisRawCentrality{"axisRawCentrality", {VARIABLE_WIDTH, 0.000f, 52.320f, 75.400f, 95.719f, 115.364f, 135.211f, 155.791f, 177.504f, 200.686f, 225.641f, 252.645f, 281.906f, 313.850f, 348.302f, 385.732f, 426.307f, 470.146f, 517.555f, 568.899f, 624.177f, 684.021f, 748.734f, 818.078f, 892.577f, 973.087f, 1058.789f, 1150.915f, 1249.319f, 1354.279f, 1465.979f, 1584.790f, 1710.778f, 1844.863f, 1985.746f, 2134.643f, 2291.610f, 2456.943f, 2630.653f, 2813.959f, 3006.631f, 3207.229f, 3417.641f, 3637.318f, 3865.785f, 4104.997f, 4354.938f, 4615.786f, 4885.335f, 5166.555f, 5458.021f, 5762.584f, 6077.881f, 6406.834f, 6746.435f, 7097.958f, 7462.579f, 7839.165f, 8231.629f, 8635.640f, 9052.000f, 9484.268f, 9929.111f, 10389.350f, 10862.059f, 11352.185f, 11856.823f, 12380.371f, 12920.401f, 13476.971f, 14053.087f, 14646.190f, 15258.426f, 15890.617f, 16544.433f, 17218.024f, 17913.465f, 18631.374f, 19374.983f, 20136.700f, 20927.783f, 21746.796f, 22590.880f, 23465.734f, 24372.274f, 25314.351f, 26290.488f, 27300.899f, 28347.512f, 29436.133f, 30567.840f, 31746.818f, 32982.664f, 34276.329f, 35624.859f, 37042.588f, 38546.609f, 40139.742f, 41837.980f, 43679.429f, 45892.130f, 400000.000f}, "raw centrality signal"}; // for QA - - ConfigurableAxis axisOccupancy{"axisOccupancy", {VARIABLE_WIDTH, 0.0f, 250.0f, 500.0f, 750.0f, 1000.0f, 1500.0f, 2000.0f, 3000.0f, 4500.0f, 6000.0f, 8000.0f, 10000.0f, 50000.0f}, "Occupancy"}; - - // topological variable QA axes - ConfigurableAxis axisDCAtoPV{"axisDCAtoPV", {20, 0.0f, 1.0f}, "DCA (cm)"}; - ConfigurableAxis axisDCAdau{"axisDCAdau", {20, 0.0f, 2.0f}, "DCA (cm)"}; - ConfigurableAxis axisPointingAngle{"axisPointingAngle", {20, 0.0f, 2.0f}, "pointing angle (rad)"}; - ConfigurableAxis axisV0Radius{"axisV0Radius", {20, 0.0f, 60.0f}, "V0 2D radius (cm)"}; - ConfigurableAxis axisNsigmaTPC{"axisNsigmaTPC", {200, -10.0f, 10.0f}, "N sigma TPC"}; - ConfigurableAxis axisTPCsignal{"axisTPCsignal", {200, 0.0f, 200.0f}, "TPC signal"}; - ConfigurableAxis axisNsigmaTOF{"axisNsigmaTOF", {200, -10.0f, 10.0f}, "N sigma TOF"}; - ConfigurableAxis axisTOFdeltaT{"axisTOFdeltaT", {200, -5000.0f, 5000.0f}, "TOF Delta T (ps)"}; - ConfigurableAxis axisPhi{"axisPhi", {18, 0.0f, constants::math::TwoPI}, "Azimuth angle (rad)"}; - ConfigurableAxis axisEta{"axisEta", {10, -1.0f, 1.0f}, "#eta"}; - ConfigurableAxis axisITSchi2{"axisITSchi2", {100, 0.0f, 100.0f}, "#chi^{2} per ITS clusters"}; - ConfigurableAxis axisTPCchi2{"axisTPCchi2", {100, 0.0f, 100.0f}, "#chi^{2} per TPC clusters"}; - ConfigurableAxis axisTPCrowsOverFindable{"axisTPCrowsOverFindable", {120, 0.0f, 1.2f}, "Fraction of TPC crossed rows over findable clusters"}; - ConfigurableAxis axisTPCfoundOverFindable{"axisTPCfoundOverFindable", {120, 0.0f, 1.2f}, "Fraction of TPC found over findable clusters"}; - ConfigurableAxis axisTPCsharedClusters{"axisTPCsharedClusters", {101, -0.005f, 1.005f}, "Fraction of TPC shared clusters"}; - - // UPC axes - ConfigurableAxis axisSelGap{"axisSelGap", {4, -1.5, 2.5}, "Gap side"}; + // CCDB options + struct : ConfigurableGroup { + ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "pt axis for analysis"}; + ConfigurableAxis axisPtXi{"axisPtXi", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "pt axis for feeddown from Xi"}; + ConfigurableAxis axisPtCoarse{"axisPtCoarse", {VARIABLE_WIDTH, 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 7.0f, 10.0f, 15.0f}, "pt axis for QA"}; + ConfigurableAxis axisK0Mass{"axisK0Mass", {200, 0.4f, 0.6f}, ""}; + ConfigurableAxis axisLambdaMass{"axisLambdaMass", {200, 1.101f, 1.131f}, ""}; + ConfigurableAxis axisCentrality{"axisCentrality", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f}, "Centrality"}; + ConfigurableAxis axisNch{"axisNch", {500, 0.0f, +5000.0f}, "Number of charged particles"}; + ConfigurableAxis axisIRBinning{"axisIRBinning", {500, 0, 50}, "Binning for the interaction rate (kHz)"}; + ConfigurableAxis axisMultFT0M{"axisMultFT0M", {500, 0.0f, +100000.0f}, "Multiplicity FT0M"}; + ConfigurableAxis axisMultFT0C{"axisMultFT0C", {500, 0.0f, +10000.0f}, "Multiplicity FT0C"}; + ConfigurableAxis axisMultFV0A{"axisMultFV0A", {500, 0.0f, +100000.0f}, "Multiplicity FV0A"}; + + ConfigurableAxis axisRawCentrality{"axisRawCentrality", {VARIABLE_WIDTH, 0.000f, 52.320f, 75.400f, 95.719f, 115.364f, 135.211f, 155.791f, 177.504f, 200.686f, 225.641f, 252.645f, 281.906f, 313.850f, 348.302f, 385.732f, 426.307f, 470.146f, 517.555f, 568.899f, 624.177f, 684.021f, 748.734f, 818.078f, 892.577f, 973.087f, 1058.789f, 1150.915f, 1249.319f, 1354.279f, 1465.979f, 1584.790f, 1710.778f, 1844.863f, 1985.746f, 2134.643f, 2291.610f, 2456.943f, 2630.653f, 2813.959f, 3006.631f, 3207.229f, 3417.641f, 3637.318f, 3865.785f, 4104.997f, 4354.938f, 4615.786f, 4885.335f, 5166.555f, 5458.021f, 5762.584f, 6077.881f, 6406.834f, 6746.435f, 7097.958f, 7462.579f, 7839.165f, 8231.629f, 8635.640f, 9052.000f, 9484.268f, 9929.111f, 10389.350f, 10862.059f, 11352.185f, 11856.823f, 12380.371f, 12920.401f, 13476.971f, 14053.087f, 14646.190f, 15258.426f, 15890.617f, 16544.433f, 17218.024f, 17913.465f, 18631.374f, 19374.983f, 20136.700f, 20927.783f, 21746.796f, 22590.880f, 23465.734f, 24372.274f, 25314.351f, 26290.488f, 27300.899f, 28347.512f, 29436.133f, 30567.840f, 31746.818f, 32982.664f, 34276.329f, 35624.859f, 37042.588f, 38546.609f, 40139.742f, 41837.980f, 43679.429f, 45892.130f, 400000.000f}, "raw centrality signal"}; // for QA + + ConfigurableAxis axisOccupancy{"axisOccupancy", {VARIABLE_WIDTH, 0.0f, 250.0f, 500.0f, 750.0f, 1000.0f, 1500.0f, 2000.0f, 3000.0f, 4500.0f, 6000.0f, 8000.0f, 10000.0f, 50000.0f}, "Occupancy"}; + + // topological variable QA axes + ConfigurableAxis axisDCAtoPV{"axisDCAtoPV", {20, 0.0f, 1.0f}, "DCA (cm)"}; + ConfigurableAxis axisDCAdau{"axisDCAdau", {20, 0.0f, 2.0f}, "DCA (cm)"}; + ConfigurableAxis axisPointingAngle{"axisPointingAngle", {20, 0.0f, 2.0f}, "pointing angle (rad)"}; + ConfigurableAxis axisV0Radius{"axisV0Radius", {20, 0.0f, 60.0f}, "V0 2D radius (cm)"}; + ConfigurableAxis axisNsigmaTPC{"axisNsigmaTPC", {200, -10.0f, 10.0f}, "N sigma TPC"}; + ConfigurableAxis axisTPCsignal{"axisTPCsignal", {200, 0.0f, 200.0f}, "TPC signal"}; + ConfigurableAxis axisNsigmaTOF{"axisNsigmaTOF", {200, -10.0f, 10.0f}, "N sigma TOF"}; + ConfigurableAxis axisTOFdeltaT{"axisTOFdeltaT", {200, -5000.0f, 5000.0f}, "TOF Delta T (ps)"}; + ConfigurableAxis axisPhi{"axisPhi", {18, 0.0f, constants::math::TwoPI}, "Azimuth angle (rad)"}; + ConfigurableAxis axisPhiMod{"axisPhiMod", {100, 0.0f, constants::math::TwoPI / 18}, "Azimuth angle wrt TPC sector (rad.)"}; + ConfigurableAxis axisEta{"axisEta", {10, -1.0f, 1.0f}, "#eta"}; + ConfigurableAxis axisITSchi2{"axisITSchi2", {100, 0.0f, 100.0f}, "#chi^{2} per ITS clusters"}; + ConfigurableAxis axisTPCchi2{"axisTPCchi2", {100, 0.0f, 100.0f}, "#chi^{2} per TPC clusters"}; + ConfigurableAxis axisTPCrowsOverFindable{"axisTPCrowsOverFindable", {120, 0.0f, 1.2f}, "Fraction of TPC crossed rows over findable clusters"}; + ConfigurableAxis axisTPCfoundOverFindable{"axisTPCfoundOverFindable", {120, 0.0f, 1.2f}, "Fraction of TPC found over findable clusters"}; + ConfigurableAxis axisTPCsharedClusters{"axisTPCsharedClusters", {101, -0.005f, 1.005f}, "Fraction of TPC shared clusters"}; + + // UPC axes + ConfigurableAxis axisSelGap{"axisSelGap", {4, -1.5, 2.5}, "Gap side"}; + + // AP plot axes + ConfigurableAxis axisAPAlpha{"axisAPAlpha", {220, -1.1f, 1.1f}, "V0 AP alpha"}; + ConfigurableAxis axisAPQt{"axisAPQt", {220, 0.0f, 0.5f}, "V0 AP alpha"}; + + // Track quality axes + ConfigurableAxis axisTPCrows{"axisTPCrows", {160, 0.0f, 160.0f}, "N TPC rows"}; + ConfigurableAxis axisITSclus{"axisITSclus", {7, 0.0f, 7.0f}, "N ITS Clusters"}; + ConfigurableAxis axisITScluMap{"axisITScluMap", {128, -0.5f, 127.5f}, "ITS Cluster map"}; + ConfigurableAxis axisDetMap{"axisDetMap", {16, -0.5f, 15.5f}, "Detector use map"}; + ConfigurableAxis axisITScluMapCoarse{"axisITScluMapCoarse", {16, -3.5f, 12.5f}, "ITS Coarse cluster map"}; + ConfigurableAxis axisDetMapCoarse{"axisDetMapCoarse", {5, -0.5f, 4.5f}, "Detector Coarse user map"}; + + // MC coll assoc QA axis + ConfigurableAxis axisMonteCarloNch{"axisMonteCarloNch", {300, 0.0f, 3000.0f}, "N_{ch} MC"}; + } axisConfigurations; // UPC selections SGSelector sgSelector; @@ -322,21 +361,6 @@ struct derivedlambdakzeroanalysis { // Configurable gapSel{"gapSel", 2, "Gap selection"}; } upcCuts; - // AP plot axes - ConfigurableAxis axisAPAlpha{"axisAPAlpha", {220, -1.1f, 1.1f}, "V0 AP alpha"}; - ConfigurableAxis axisAPQt{"axisAPQt", {220, 0.0f, 0.5f}, "V0 AP alpha"}; - - // Track quality axes - ConfigurableAxis axisTPCrows{"axisTPCrows", {160, 0.0f, 160.0f}, "N TPC rows"}; - ConfigurableAxis axisITSclus{"axisITSclus", {7, 0.0f, 7.0f}, "N ITS Clusters"}; - ConfigurableAxis axisITScluMap{"axisITScluMap", {128, -0.5f, 127.5f}, "ITS Cluster map"}; - ConfigurableAxis axisDetMap{"axisDetMap", {16, -0.5f, 15.5f}, "Detector use map"}; - ConfigurableAxis axisITScluMapCoarse{"axisITScluMapCoarse", {16, -3.5f, 12.5f}, "ITS Coarse cluster map"}; - ConfigurableAxis axisDetMapCoarse{"axisDetMapCoarse", {5, -0.5f, 4.5f}, "Detector Coarse user map"}; - - // MC coll assoc QA axis - ConfigurableAxis axisMonteCarloNch{"axisMonteCarloNch", {300, 0.0f, 3000.0f}, "N_{ch} MC"}; - // For manual sliceBy // Preslice> perMcCollision = aod::v0data::straMCCollisionId; PresliceUnsorted> perMcCollision = aod::v0data::straMCCollisionId; @@ -548,9 +572,9 @@ struct derivedlambdakzeroanalysis { } // Primary particle selection, central to analysis - maskSelectionK0Short = maskTopological | maskTrackProperties | maskK0ShortSpecific | (static_cast(1) << selPhysPrimK0Short); - maskSelectionLambda = maskTopological | maskTrackProperties | maskLambdaSpecific | (static_cast(1) << selPhysPrimLambda); - maskSelectionAntiLambda = maskTopological | maskTrackProperties | maskAntiLambdaSpecific | (static_cast(1) << selPhysPrimAntiLambda); + maskSelectionK0Short = maskTopological | maskTrackProperties | maskK0ShortSpecific; + maskSelectionLambda = maskTopological | maskTrackProperties | maskLambdaSpecific; + maskSelectionAntiLambda = maskTopological | maskTrackProperties | maskAntiLambdaSpecific; BITSET(maskSelectionK0Short, selPhysPrimK0Short); BITSET(maskSelectionLambda, selPhysPrimLambda); @@ -616,7 +640,21 @@ struct derivedlambdakzeroanalysis { } histos.add("hEventCentrality", "hEventCentrality", kTH1D, {{101, 0.0f, 101.0f}}); - histos.add("hCentralityVsNch", "hCentralityVsNch", kTH2D, {{101, 0.0f, 101.0f}, axisNch}); + histos.add("hCentralityVsNch", "hCentralityVsNch", kTH2D, {{101, 0.0f, 101.0f}, axisConfigurations.axisNch}); + if (doEventQA) { + if (isRun3) { + histos.add("hCentralityVsNGlobal", "hCentralityVsNGlobal", kTH2D, {{101, 0.0f, 101.0f}, axisConfigurations.axisNch}); + histos.add("hEventCentVsMultFT0M", "hEventCentVsMultFT0M", kTH2D, {{101, 0.0f, 101.0f}, axisConfigurations.axisMultFT0M}); + histos.add("hEventCentVsMultFT0C", "hEventCentVsMultFT0C", kTH2D, {{101, 0.0f, 101.0f}, axisConfigurations.axisMultFT0C}); + histos.add("hEventCentVsMultNGlobal", "hEventCentVsMultNGlobal", kTH2D, {{101, 0.0f, 101.0f}, axisConfigurations.axisNch}); + histos.add("hEventCentVsMultFV0A", "hEventCentVsMultFV0A", kTH2D, {{101, 0.0f, 101.0f}, axisConfigurations.axisMultFV0A}); + histos.add("hEventMultFT0MvsMultNGlobal", "hEventMultFT0MvsMultNGlobal", kTH2D, {axisConfigurations.axisMultFT0M, axisConfigurations.axisNch}); + histos.add("hEventMultFT0CvsMultNGlobal", "hEventMultFT0CvsMultNGlobal", kTH2D, {axisConfigurations.axisMultFT0C, axisConfigurations.axisNch}); + histos.add("hEventMultFV0AvsMultNGlobal", "hEventMultFV0AvsMultNGlobal", kTH2D, {axisConfigurations.axisMultFV0A, axisConfigurations.axisNch}); + histos.add("hEventMultPVvsMultNGlobal", "hEventMultPVvsMultNGlobal", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisNch}); + histos.add("hEventMultFT0CvsMultFV0A", "hEventMultFT0CvsMultFV0A", kTH2D, {axisConfigurations.axisMultFT0C, axisConfigurations.axisMultFV0A}); + } + } histos.add("hEventPVz", "hEventPVz", kTH1D, {{100, -20.0f, +20.0f}}); histos.add("hCentralityVsPVz", "hCentralityVsPVz", kTH2D, {{101, 0.0f, 101.0f}, {100, -20.0f, +20.0f}}); @@ -625,368 +663,421 @@ struct derivedlambdakzeroanalysis { histos.add("hCentralityVsPVzMC", "hCentralityVsPVzMC", kTH2D, {{101, 0.0f, 101.0f}, {100, -20.0f, +20.0f}}); } - histos.add("hEventOccupancy", "hEventOccupancy", kTH1D, {axisOccupancy}); - histos.add("hCentralityVsOccupancy", "hCentralityVsOccupancy", kTH2D, {{101, 0.0f, 101.0f}, axisOccupancy}); + histos.add("hEventOccupancy", "hEventOccupancy", kTH1D, {axisConfigurations.axisOccupancy}); + histos.add("hCentralityVsOccupancy", "hCentralityVsOccupancy", kTH2D, {{101, 0.0f, 101.0f}, axisConfigurations.axisOccupancy}); histos.add("hGapSide", "Gap side; Entries", kTH1D, {{5, -0.5, 4.5}}); - histos.add("hSelGapSide", "Selected gap side; Entries", kTH1D, {axisSelGap}); - histos.add("hEventCentralityVsSelGapSide", ";Centrality (%); Selected gap side", kTH2D, {{101, 0.0f, 101.0f}, axisSelGap}); + histos.add("hSelGapSide", "Selected gap side; Entries", kTH1D, {axisConfigurations.axisSelGap}); + histos.add("hEventCentralityVsSelGapSide", ";Centrality (%); Selected gap side", kTH2D, {{101, 0.0f, 101.0f}, axisConfigurations.axisSelGap}); - histos.add("hInteractionRate", "hInteractionRate", kTH1D, {axisIRBinning}); - histos.add("hCentralityVsInteractionRate", "hCentralityVsInteractionRate", kTH2D, {{101, 0.0f, 101.0f}, axisIRBinning}); + histos.add("hInteractionRate", "hInteractionRate", kTH1D, {axisConfigurations.axisIRBinning}); + histos.add("hCentralityVsInteractionRate", "hCentralityVsInteractionRate", kTH2D, {{101, 0.0f, 101.0f}, axisConfigurations.axisIRBinning}); - histos.add("hInteractionRateVsOccupancy", "hInteractionRateVsOccupancy", kTH2D, {axisIRBinning, axisOccupancy}); + histos.add("hInteractionRateVsOccupancy", "hInteractionRateVsOccupancy", kTH2D, {axisConfigurations.axisIRBinning, axisConfigurations.axisOccupancy}); // for QA and test purposes - auto hRawCentrality = histos.add("hRawCentrality", "hRawCentrality", kTH1D, {axisRawCentrality}); + auto hRawCentrality = histos.add("hRawCentrality", "hRawCentrality", kTH1D, {axisConfigurations.axisRawCentrality}); for (int ii = 1; ii < 101; ii++) { float value = 100.5f - static_cast(ii); hRawCentrality->SetBinContent(ii, value); } - auto hPrimaryV0s = histos.add("hPrimaryV0s", "hPrimaryV0s", kTH1D, {{2, -0.5f, 1.5f}}); - hPrimaryV0s->GetXaxis()->SetBinLabel(1, "All V0s"); - hPrimaryV0s->GetXaxis()->SetBinLabel(2, "Primary V0s"); + auto hSelectionV0s = histos.add("GeneralQA/hSelectionV0s", "hSelectionV0s", kTH1D, {{static_cast(selPhysPrimAntiLambda) + 3, -0.5f, static_cast(selPhysPrimAntiLambda) + 2.5f}}); + hSelectionV0s->GetXaxis()->SetBinLabel(1, "All"); + hSelectionV0s->GetXaxis()->SetBinLabel(selCosPA + 2, "cosPA"); + hSelectionV0s->GetXaxis()->SetBinLabel(selRadius + 2, "Radius min."); + hSelectionV0s->GetXaxis()->SetBinLabel(selRadiusMax + 2, "Radius max."); + hSelectionV0s->GetXaxis()->SetBinLabel(selDCANegToPV + 2, "DCA neg. to PV"); + hSelectionV0s->GetXaxis()->SetBinLabel(selDCAPosToPV + 2, "DCA pos. to PV"); + hSelectionV0s->GetXaxis()->SetBinLabel(selDCAV0Dau + 2, "DCA V0 dau."); + hSelectionV0s->GetXaxis()->SetBinLabel(selK0ShortRapidity + 2, "K^{0}_{S} rapidity"); + hSelectionV0s->GetXaxis()->SetBinLabel(selLambdaRapidity + 2, "#Lambda rapidity"); + hSelectionV0s->GetXaxis()->SetBinLabel(selTPCPIDPositivePion + 2, "TPC PID #pi^{+}"); + hSelectionV0s->GetXaxis()->SetBinLabel(selTPCPIDNegativePion + 2, "TPC PID #pi^{-}"); + hSelectionV0s->GetXaxis()->SetBinLabel(selTPCPIDPositiveProton + 2, "TPC PID p"); + hSelectionV0s->GetXaxis()->SetBinLabel(selTPCPIDNegativeProton + 2, "TPC PID #bar{p}"); + hSelectionV0s->GetXaxis()->SetBinLabel(selTOFDeltaTPositiveProtonLambda + 2, "TOF #Delta t p from #Lambda"); + hSelectionV0s->GetXaxis()->SetBinLabel(selTOFDeltaTPositivePionLambda + 2, "TOF #Delta t #pi^{+} from #Lambda"); + hSelectionV0s->GetXaxis()->SetBinLabel(selTOFDeltaTPositivePionK0Short + 2, "TOF #Delta t #pi^{+} from K^{0}_{S}"); + hSelectionV0s->GetXaxis()->SetBinLabel(selTOFDeltaTNegativeProtonLambda + 2, "TOF #Delta t #bar{p} from #Lambda"); + hSelectionV0s->GetXaxis()->SetBinLabel(selTOFDeltaTNegativePionLambda + 2, "TOF #Delta t #pi^{-} from #Lambda"); + hSelectionV0s->GetXaxis()->SetBinLabel(selTOFDeltaTNegativePionK0Short + 2, "TOF #Delta t #pi^{-} from K^{0}_{S}"); + hSelectionV0s->GetXaxis()->SetBinLabel(selTOFNSigmaPositiveProtonLambda + 2, "TOF PID p from #Lambda"); + hSelectionV0s->GetXaxis()->SetBinLabel(selTOFNSigmaPositivePionLambda + 2, "TOF PID #pi^{+} from #Lambda"); + hSelectionV0s->GetXaxis()->SetBinLabel(selTOFNSigmaPositivePionK0Short + 2, "TOF PID #pi^{+} from K^{0}_{S}"); + hSelectionV0s->GetXaxis()->SetBinLabel(selTOFNSigmaNegativeProtonLambda + 2, "TOF PID #bar{p} from #Lambda"); + hSelectionV0s->GetXaxis()->SetBinLabel(selTOFNSigmaNegativePionLambda + 2, "TOF PID #pi^{-} from #Lambda"); + hSelectionV0s->GetXaxis()->SetBinLabel(selTOFNSigmaNegativePionK0Short + 2, "TOF PID #pi^{-} from K^{0}_{S}"); + hSelectionV0s->GetXaxis()->SetBinLabel(selK0ShortCTau + 2, "K^{0}_{S} lifetime"); + hSelectionV0s->GetXaxis()->SetBinLabel(selLambdaCTau + 2, "#Lambda lifetime"); + hSelectionV0s->GetXaxis()->SetBinLabel(selK0ShortArmenteros + 2, "Arm. pod. cut"); + hSelectionV0s->GetXaxis()->SetBinLabel(selPosGoodTPCTrack + 2, "Pos. good TPC track"); + hSelectionV0s->GetXaxis()->SetBinLabel(selNegGoodTPCTrack + 2, "Neg. good TPC track"); + hSelectionV0s->GetXaxis()->SetBinLabel(selPosGoodITSTrack + 2, "Pos. good ITS track"); + hSelectionV0s->GetXaxis()->SetBinLabel(selNegGoodITSTrack + 2, "Neg. good ITS track"); + hSelectionV0s->GetXaxis()->SetBinLabel(selPosItsOnly + 2, "Pos. ITS-only"); + hSelectionV0s->GetXaxis()->SetBinLabel(selNegItsOnly + 2, "Neg. ITS-only"); + hSelectionV0s->GetXaxis()->SetBinLabel(selPosNotTPCOnly + 2, "Pos. not TPC-only"); + hSelectionV0s->GetXaxis()->SetBinLabel(selNegNotTPCOnly + 2, "Neg. not TPC-only"); + hSelectionV0s->GetXaxis()->SetBinLabel(selConsiderK0Short + 2, "True K^{0}_{S}"); + hSelectionV0s->GetXaxis()->SetBinLabel(selConsiderLambda + 2, "True #Lambda"); + hSelectionV0s->GetXaxis()->SetBinLabel(selConsiderAntiLambda + 2, "True #bar{#Lambda}"); + hSelectionV0s->GetXaxis()->SetBinLabel(selPhysPrimK0Short + 2, "Phys. prim. K^{0}_{S}"); + hSelectionV0s->GetXaxis()->SetBinLabel(selPhysPrimLambda + 2, "Phys. prim. #Lambda"); + hSelectionV0s->GetXaxis()->SetBinLabel(selPhysPrimAntiLambda + 2, "Phys. prim. #bar{#Lambda}"); + hSelectionV0s->GetXaxis()->SetBinLabel(selPhysPrimAntiLambda + 3, "Cand. selected"); // histograms versus mass if (analyseK0Short) { - histos.add("h2dNbrOfK0ShortVsCentrality", "h2dNbrOfK0ShortVsCentrality", kTH2D, {axisCentrality, {10, -0.5f, 9.5f}}); - histos.add("h3dMassK0Short", "h3dMassK0Short", kTH3D, {axisCentrality, axisPt, axisK0Mass}); + histos.add("h2dNbrOfK0ShortVsCentrality", "h2dNbrOfK0ShortVsCentrality", kTH2D, {axisConfigurations.axisCentrality, {10, -0.5f, 9.5f}}); + histos.add("h3dMassK0Short", "h3dMassK0Short", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt, axisConfigurations.axisK0Mass}); // Non-UPC info - histos.add("h3dMassK0ShortHadronic", "h3dMassK0ShortHadronic", kTH3D, {axisCentrality, axisPt, axisK0Mass}); + histos.add("h3dMassK0ShortHadronic", "h3dMassK0ShortHadronic", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt, axisConfigurations.axisK0Mass}); // UPC info - histos.add("h3dMassK0ShortSGA", "h3dMassK0ShortSGA", kTH3D, {axisCentrality, axisPt, axisK0Mass}); - histos.add("h3dMassK0ShortSGC", "h3dMassK0ShortSGC", kTH3D, {axisCentrality, axisPt, axisK0Mass}); - histos.add("h3dMassK0ShortDG", "h3dMassK0ShortDG", kTH3D, {axisCentrality, axisPt, axisK0Mass}); + histos.add("h3dMassK0ShortSGA", "h3dMassK0ShortSGA", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt, axisConfigurations.axisK0Mass}); + histos.add("h3dMassK0ShortSGC", "h3dMassK0ShortSGC", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt, axisConfigurations.axisK0Mass}); + histos.add("h3dMassK0ShortDG", "h3dMassK0ShortDG", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt, axisConfigurations.axisK0Mass}); if (doTPCQA) { - histos.add("K0Short/h3dPosNsigmaTPC", "h3dPosNsigmaTPC", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTPC}); - histos.add("K0Short/h3dNegNsigmaTPC", "h3dNegNsigmaTPC", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTPC}); - histos.add("K0Short/h3dPosTPCsignal", "h3dPosTPCsignal", kTH3D, {axisCentrality, axisPtCoarse, axisTPCsignal}); - histos.add("K0Short/h3dNegTPCsignal", "h3dNegTPCsignal", kTH3D, {axisCentrality, axisPtCoarse, axisTPCsignal}); - histos.add("K0Short/h3dPosNsigmaTPCvsTrackPtot", "h3dPosNsigmaTPCvsTrackPtot", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTPC}); - histos.add("K0Short/h3dNegNsigmaTPCvsTrackPtot", "h3dNegNsigmaTPCvsTrackPtot", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTPC}); - histos.add("K0Short/h3dPosTPCsignalVsTrackPtot", "h3dPosTPCsignalVsTrackPtot", kTH3D, {axisCentrality, axisPtCoarse, axisTPCsignal}); - histos.add("K0Short/h3dNegTPCsignalVsTrackPtot", "h3dNegTPCsignalVsTrackPtot", kTH3D, {axisCentrality, axisPtCoarse, axisTPCsignal}); - histos.add("K0Short/h3dPosNsigmaTPCvsTrackPt", "h3dPosNsigmaTPCvsTrackPt", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTPC}); - histos.add("K0Short/h3dNegNsigmaTPCvsTrackPt", "h3dNegNsigmaTPCvsTrackPt", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTPC}); - histos.add("K0Short/h3dPosTPCsignalVsTrackPt", "h3dPosTPCsignalVsTrackPt", kTH3D, {axisCentrality, axisPtCoarse, axisTPCsignal}); - histos.add("K0Short/h3dNegTPCsignalVsTrackPt", "h3dNegTPCsignalVsTrackPt", kTH3D, {axisCentrality, axisPtCoarse, axisTPCsignal}); + histos.add("K0Short/h3dPosNsigmaTPC", "h3dPosNsigmaTPC", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTPC}); + histos.add("K0Short/h3dNegNsigmaTPC", "h3dNegNsigmaTPC", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTPC}); + histos.add("K0Short/h3dPosTPCsignal", "h3dPosTPCsignal", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCsignal}); + histos.add("K0Short/h3dNegTPCsignal", "h3dNegTPCsignal", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCsignal}); + histos.add("K0Short/h3dPosNsigmaTPCvsTrackPtot", "h3dPosNsigmaTPCvsTrackPtot", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTPC}); + histos.add("K0Short/h3dNegNsigmaTPCvsTrackPtot", "h3dNegNsigmaTPCvsTrackPtot", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTPC}); + histos.add("K0Short/h3dPosTPCsignalVsTrackPtot", "h3dPosTPCsignalVsTrackPtot", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCsignal}); + histos.add("K0Short/h3dNegTPCsignalVsTrackPtot", "h3dNegTPCsignalVsTrackPtot", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCsignal}); + histos.add("K0Short/h3dPosNsigmaTPCvsTrackPt", "h3dPosNsigmaTPCvsTrackPt", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTPC}); + histos.add("K0Short/h3dNegNsigmaTPCvsTrackPt", "h3dNegNsigmaTPCvsTrackPt", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTPC}); + histos.add("K0Short/h3dPosTPCsignalVsTrackPt", "h3dPosTPCsignalVsTrackPt", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCsignal}); + histos.add("K0Short/h3dNegTPCsignalVsTrackPt", "h3dNegTPCsignalVsTrackPt", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCsignal}); } if (doTOFQA) { - histos.add("K0Short/h3dPosNsigmaTOF", "h3dPosNsigmaTOF", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTOF}); - histos.add("K0Short/h3dNegNsigmaTOF", "h3dNegNsigmaTOF", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTOF}); - histos.add("K0Short/h3dPosTOFdeltaT", "h3dPosTOFdeltaT", kTH3D, {axisCentrality, axisPtCoarse, axisTOFdeltaT}); - histos.add("K0Short/h3dNegTOFdeltaT", "h3dNegTOFdeltaT", kTH3D, {axisCentrality, axisPtCoarse, axisTOFdeltaT}); - histos.add("K0Short/h3dPosNsigmaTOFvsTrackPtot", "h3dPosNsigmaTOFvsTrackPtot", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTOF}); - histos.add("K0Short/h3dNegNsigmaTOFvsTrackPtot", "h3dNegNsigmaTOFvsTrackPtot", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTOF}); - histos.add("K0Short/h3dPosTOFdeltaTvsTrackPtot", "h3dPosTOFdeltaTvsTrackPtot", kTH3D, {axisCentrality, axisPtCoarse, axisTOFdeltaT}); - histos.add("K0Short/h3dNegTOFdeltaTvsTrackPtot", "h3dNegTOFdeltaTvsTrackPtot", kTH3D, {axisCentrality, axisPtCoarse, axisTOFdeltaT}); - histos.add("K0Short/h3dPosNsigmaTOFvsTrackPt", "h3dPosNsigmaTOFvsTrackPt", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTOF}); - histos.add("K0Short/h3dNegNsigmaTOFvsTrackPt", "h3dNegNsigmaTOFvsTrackPt", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTOF}); - histos.add("K0Short/h3dPosTOFdeltaTvsTrackPt", "h3dPosTOFdeltaTvsTrackPt", kTH3D, {axisCentrality, axisPtCoarse, axisTOFdeltaT}); - histos.add("K0Short/h3dNegTOFdeltaTvsTrackPt", "h3dNegTOFdeltaTvsTrackPt", kTH3D, {axisCentrality, axisPtCoarse, axisTOFdeltaT}); + histos.add("K0Short/h3dPosNsigmaTOF", "h3dPosNsigmaTOF", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTOF}); + histos.add("K0Short/h3dNegNsigmaTOF", "h3dNegNsigmaTOF", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTOF}); + histos.add("K0Short/h3dPosTOFdeltaT", "h3dPosTOFdeltaT", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTOFdeltaT}); + histos.add("K0Short/h3dNegTOFdeltaT", "h3dNegTOFdeltaT", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTOFdeltaT}); + histos.add("K0Short/h3dPosNsigmaTOFvsTrackPtot", "h3dPosNsigmaTOFvsTrackPtot", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTOF}); + histos.add("K0Short/h3dNegNsigmaTOFvsTrackPtot", "h3dNegNsigmaTOFvsTrackPtot", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTOF}); + histos.add("K0Short/h3dPosTOFdeltaTvsTrackPtot", "h3dPosTOFdeltaTvsTrackPtot", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTOFdeltaT}); + histos.add("K0Short/h3dNegTOFdeltaTvsTrackPtot", "h3dNegTOFdeltaTvsTrackPtot", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTOFdeltaT}); + histos.add("K0Short/h3dPosNsigmaTOFvsTrackPt", "h3dPosNsigmaTOFvsTrackPt", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTOF}); + histos.add("K0Short/h3dNegNsigmaTOFvsTrackPt", "h3dNegNsigmaTOFvsTrackPt", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTOF}); + histos.add("K0Short/h3dPosTOFdeltaTvsTrackPt", "h3dPosTOFdeltaTvsTrackPt", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTOFdeltaT}); + histos.add("K0Short/h3dNegTOFdeltaTvsTrackPt", "h3dNegTOFdeltaTvsTrackPt", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTOFdeltaT}); } if (doCollisionAssociationQA) { - histos.add("K0Short/h2dPtVsNch", "h2dPtVsNch", kTH2D, {axisMonteCarloNch, axisPt}); - histos.add("K0Short/h2dPtVsNch_BadCollAssig", "h2dPtVsNch_BadCollAssig", kTH2D, {axisMonteCarloNch, axisPt}); + histos.add("K0Short/h2dPtVsNch", "h2dPtVsNch", kTH2D, {axisConfigurations.axisMonteCarloNch, axisConfigurations.axisPt}); + histos.add("K0Short/h2dPtVsNch_BadCollAssig", "h2dPtVsNch_BadCollAssig", kTH2D, {axisConfigurations.axisMonteCarloNch, axisConfigurations.axisPt}); } if (doDetectPropQA == 1) { - histos.add("K0Short/h6dDetectPropVsCentrality", "h6dDetectPropVsCentrality", kTHnD, {axisCentrality, axisDetMapCoarse, axisITScluMapCoarse, axisDetMapCoarse, axisITScluMapCoarse, axisPtCoarse}); - histos.add("K0Short/h4dPosDetectPropVsCentrality", "h4dPosDetectPropVsCentrality", kTHnD, {axisCentrality, axisDetMap, axisITScluMap, axisPtCoarse}); - histos.add("K0Short/h4dNegDetectPropVsCentrality", "h4dNegDetectPropVsCentrality", kTHnD, {axisCentrality, axisDetMap, axisITScluMap, axisPtCoarse}); + histos.add("K0Short/h6dDetectPropVsCentrality", "h6dDetectPropVsCentrality", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisDetMapCoarse, axisConfigurations.axisITScluMapCoarse, axisConfigurations.axisDetMapCoarse, axisConfigurations.axisITScluMapCoarse, axisConfigurations.axisPtCoarse}); + histos.add("K0Short/h4dPosDetectPropVsCentrality", "h4dPosDetectPropVsCentrality", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisDetMap, axisConfigurations.axisITScluMap, axisConfigurations.axisPtCoarse}); + histos.add("K0Short/h4dNegDetectPropVsCentrality", "h4dNegDetectPropVsCentrality", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisDetMap, axisConfigurations.axisITScluMap, axisConfigurations.axisPtCoarse}); } if (doDetectPropQA == 2) { - histos.add("K0Short/h7dDetectPropVsCentrality", "h7dDetectPropVsCentrality", kTHnD, {axisCentrality, axisDetMapCoarse, axisITScluMapCoarse, axisDetMapCoarse, axisITScluMapCoarse, axisPtCoarse, axisK0Mass}); - histos.add("K0Short/h5dPosDetectPropVsCentrality", "h5dPosDetectPropVsCentrality", kTHnD, {axisCentrality, axisDetMap, axisITScluMap, axisPtCoarse, axisK0Mass}); - histos.add("K0Short/h5dNegDetectPropVsCentrality", "h5dNegDetectPropVsCentrality", kTHnD, {axisCentrality, axisDetMap, axisITScluMap, axisPtCoarse, axisK0Mass}); + histos.add("K0Short/h7dDetectPropVsCentrality", "h7dDetectPropVsCentrality", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisDetMapCoarse, axisConfigurations.axisITScluMapCoarse, axisConfigurations.axisDetMapCoarse, axisConfigurations.axisITScluMapCoarse, axisConfigurations.axisPtCoarse, axisConfigurations.axisK0Mass}); + histos.add("K0Short/h5dPosDetectPropVsCentrality", "h5dPosDetectPropVsCentrality", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisDetMap, axisConfigurations.axisITScluMap, axisConfigurations.axisPtCoarse, axisConfigurations.axisK0Mass}); + histos.add("K0Short/h5dNegDetectPropVsCentrality", "h5dNegDetectPropVsCentrality", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisDetMap, axisConfigurations.axisITScluMap, axisConfigurations.axisPtCoarse, axisConfigurations.axisK0Mass}); } if (doDetectPropQA == 3) { - histos.add("K0Short/h3dITSchi2", "h3dMaxITSchi2", kTH3D, {axisCentrality, axisPtCoarse, axisITSchi2}); - histos.add("K0Short/h3dTPCchi2", "h3dMaxTPCchi2", kTH3D, {axisCentrality, axisPtCoarse, axisTPCchi2}); - histos.add("K0Short/h3dTPCFoundOverFindable", "h3dTPCFoundOverFindable", kTH3D, {axisCentrality, axisPtCoarse, axisTPCfoundOverFindable}); - histos.add("K0Short/h3dTPCrowsOverFindable", "h3dTPCrowsOverFindable", kTH3D, {axisCentrality, axisPtCoarse, axisTPCrowsOverFindable}); - histos.add("K0Short/h3dTPCsharedCls", "h3dTPCsharedCls", kTH3D, {axisCentrality, axisPtCoarse, axisTPCsharedClusters}); - histos.add("K0Short/h3dPositiveITSchi2", "h3dPositiveITSchi2", kTH3D, {axisCentrality, axisPtCoarse, axisITSchi2}); - histos.add("K0Short/h3dNegativeITSchi2", "h3dNegativeITSchi2", kTH3D, {axisCentrality, axisPtCoarse, axisITSchi2}); - histos.add("K0Short/h3dPositiveTPCchi2", "h3dPositiveTPCchi2", kTH3D, {axisCentrality, axisPtCoarse, axisTPCchi2}); - histos.add("K0Short/h3dNegativeTPCchi2", "h3dNegativeTPCchi2", kTH3D, {axisCentrality, axisPtCoarse, axisTPCchi2}); - histos.add("K0Short/h3dPositiveITSclusters", "h3dPositiveITSclusters", kTH3D, {axisCentrality, axisPtCoarse, axisITSclus}); - histos.add("K0Short/h3dNegativeITSclusters", "h3dNegativeITSclusters", kTH3D, {axisCentrality, axisPtCoarse, axisITSclus}); - histos.add("K0Short/h3dPositiveTPCcrossedRows", "h3dPositiveTPCcrossedRows", kTH3D, {axisCentrality, axisPtCoarse, axisTPCrows}); - histos.add("K0Short/h3dNegativeTPCcrossedRows", "h3dNegativeTPCcrossedRows", kTH3D, {axisCentrality, axisPtCoarse, axisTPCrows}); + histos.add("K0Short/h3dITSchi2", "h3dMaxITSchi2", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisITSchi2}); + histos.add("K0Short/h3dTPCchi2", "h3dMaxTPCchi2", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCchi2}); + histos.add("K0Short/h3dTPCFoundOverFindable", "h3dTPCFoundOverFindable", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCfoundOverFindable}); + histos.add("K0Short/h3dTPCrowsOverFindable", "h3dTPCrowsOverFindable", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCrowsOverFindable}); + histos.add("K0Short/h3dTPCsharedCls", "h3dTPCsharedCls", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCsharedClusters}); + histos.add("K0Short/h3dPositiveITSchi2", "h3dPositiveITSchi2", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisITSchi2}); + histos.add("K0Short/h3dNegativeITSchi2", "h3dNegativeITSchi2", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisITSchi2}); + histos.add("K0Short/h3dPositiveTPCchi2", "h3dPositiveTPCchi2", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCchi2}); + histos.add("K0Short/h3dNegativeTPCchi2", "h3dNegativeTPCchi2", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCchi2}); + histos.add("K0Short/h3dPositiveITSclusters", "h3dPositiveITSclusters", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisITSclus}); + histos.add("K0Short/h3dNegativeITSclusters", "h3dNegativeITSclusters", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisITSclus}); + histos.add("K0Short/h3dPositiveTPCcrossedRows", "h3dPositiveTPCcrossedRows", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCrows}); + histos.add("K0Short/h3dNegativeTPCcrossedRows", "h3dNegativeTPCcrossedRows", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCrows}); } if (doEtaPhiQA) { - histos.add("K0Short/h5dV0PhiVsEta", "h5dV0PhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisK0Mass, axisPhi, axisEta}); - histos.add("K0Short/h5dPosPhiVsNegPhi", "h5dPosPhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisK0Mass, axisPhi, axisPhi}); - histos.add("K0Short/h5dPosEtaVsNegEta", "h5dNegPhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisK0Mass, axisEta, axisEta}); + histos.add("K0Short/h5dV0PhiVsEta", "h5dV0PhiVsEta", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisK0Mass, axisConfigurations.axisPhi, axisConfigurations.axisEta}); + histos.add("K0Short/h5dPosPhiVsEta", "h5dPosPhiVsEta", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisK0Mass, axisConfigurations.axisPhi, axisConfigurations.axisEta}); + histos.add("K0Short/h5dNegPhiVsEta", "h5dNegPhiVsEta", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisK0Mass, axisConfigurations.axisPhi, axisConfigurations.axisEta}); } } if (analyseLambda) { - histos.add("h2dNbrOfLambdaVsCentrality", "h2dNbrOfLambdaVsCentrality", kTH2D, {axisCentrality, {10, -0.5f, 9.5f}}); - histos.add("h3dMassLambda", "h3dMassLambda", kTH3D, {axisCentrality, axisPt, axisLambdaMass}); + histos.add("h2dNbrOfLambdaVsCentrality", "h2dNbrOfLambdaVsCentrality", kTH2D, {axisConfigurations.axisCentrality, {10, -0.5f, 9.5f}}); + histos.add("h3dMassLambda", "h3dMassLambda", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt, axisConfigurations.axisLambdaMass}); // Non-UPC info - histos.add("h3dMassLambdaHadronic", "h3dMassLambdaHadronic", kTH3D, {axisCentrality, axisPt, axisLambdaMass}); + histos.add("h3dMassLambdaHadronic", "h3dMassLambdaHadronic", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt, axisConfigurations.axisLambdaMass}); // UPC info - histos.add("h3dMassLambdaSGA", "h3dMassLambdaSGA", kTH3D, {axisCentrality, axisPt, axisLambdaMass}); - histos.add("h3dMassLambdaSGC", "h3dMassLambdaSGC", kTH3D, {axisCentrality, axisPt, axisLambdaMass}); - histos.add("h3dMassLambdaDG", "h3dMassLambdaDG", kTH3D, {axisCentrality, axisPt, axisLambdaMass}); + histos.add("h3dMassLambdaSGA", "h3dMassLambdaSGA", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt, axisConfigurations.axisLambdaMass}); + histos.add("h3dMassLambdaSGC", "h3dMassLambdaSGC", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt, axisConfigurations.axisLambdaMass}); + histos.add("h3dMassLambdaDG", "h3dMassLambdaDG", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt, axisConfigurations.axisLambdaMass}); if (doTPCQA) { - histos.add("Lambda/h3dPosNsigmaTPC", "h3dPosNsigmaTPC", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTPC}); - histos.add("Lambda/h3dNegNsigmaTPC", "h3dNegNsigmaTPC", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTPC}); - histos.add("Lambda/h3dPosTPCsignal", "h3dPosTPCsignal", kTH3D, {axisCentrality, axisPtCoarse, axisTPCsignal}); - histos.add("Lambda/h3dNegTPCsignal", "h3dNegTPCsignal", kTH3D, {axisCentrality, axisPtCoarse, axisTPCsignal}); - histos.add("Lambda/h3dPosNsigmaTPCvsTrackPtot", "h3dPosNsigmaTPCvsTrackPtot", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTPC}); - histos.add("Lambda/h3dNegNsigmaTPCvsTrackPtot", "h3dNegNsigmaTPCvsTrackPtot", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTPC}); - histos.add("Lambda/h3dPosTPCsignalVsTrackPtot", "h3dPosTPCsignalVsTrackPtot", kTH3D, {axisCentrality, axisPtCoarse, axisTPCsignal}); - histos.add("Lambda/h3dNegTPCsignalVsTrackPtot", "h3dNegTPCsignalVsTrackPtot", kTH3D, {axisCentrality, axisPtCoarse, axisTPCsignal}); - histos.add("Lambda/h3dPosNsigmaTPCvsTrackPt", "h3dPosNsigmaTPCvsTrackPt", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTPC}); - histos.add("Lambda/h3dNegNsigmaTPCvsTrackPt", "h3dNegNsigmaTPCvsTrackPt", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTPC}); - histos.add("Lambda/h3dPosTPCsignalVsTrackPt", "h3dPosTPCsignalVsTrackPt", kTH3D, {axisCentrality, axisPtCoarse, axisTPCsignal}); - histos.add("Lambda/h3dNegTPCsignalVsTrackPt", "h3dNegTPCsignalVsTrackPt", kTH3D, {axisCentrality, axisPtCoarse, axisTPCsignal}); + histos.add("Lambda/h3dPosNsigmaTPC", "h3dPosNsigmaTPC", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTPC}); + histos.add("Lambda/h3dNegNsigmaTPC", "h3dNegNsigmaTPC", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTPC}); + histos.add("Lambda/h3dPosTPCsignal", "h3dPosTPCsignal", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCsignal}); + histos.add("Lambda/h3dNegTPCsignal", "h3dNegTPCsignal", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCsignal}); + histos.add("Lambda/h3dPosNsigmaTPCvsTrackPtot", "h3dPosNsigmaTPCvsTrackPtot", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTPC}); + histos.add("Lambda/h3dNegNsigmaTPCvsTrackPtot", "h3dNegNsigmaTPCvsTrackPtot", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTPC}); + histos.add("Lambda/h3dPosTPCsignalVsTrackPtot", "h3dPosTPCsignalVsTrackPtot", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCsignal}); + histos.add("Lambda/h3dNegTPCsignalVsTrackPtot", "h3dNegTPCsignalVsTrackPtot", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCsignal}); + histos.add("Lambda/h3dPosNsigmaTPCvsTrackPt", "h3dPosNsigmaTPCvsTrackPt", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTPC}); + histos.add("Lambda/h3dNegNsigmaTPCvsTrackPt", "h3dNegNsigmaTPCvsTrackPt", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTPC}); + histos.add("Lambda/h3dPosTPCsignalVsTrackPt", "h3dPosTPCsignalVsTrackPt", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCsignal}); + histos.add("Lambda/h3dNegTPCsignalVsTrackPt", "h3dNegTPCsignalVsTrackPt", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCsignal}); } if (doTOFQA) { - histos.add("Lambda/h3dPosNsigmaTOF", "h3dPosNsigmaTOF", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTOF}); - histos.add("Lambda/h3dNegNsigmaTOF", "h3dNegNsigmaTOF", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTOF}); - histos.add("Lambda/h3dPosTOFdeltaT", "h3dPosTOFdeltaT", kTH3D, {axisCentrality, axisPtCoarse, axisTOFdeltaT}); - histos.add("Lambda/h3dNegTOFdeltaT", "h3dNegTOFdeltaT", kTH3D, {axisCentrality, axisPtCoarse, axisTOFdeltaT}); - histos.add("Lambda/h3dPosNsigmaTOFvsTrackPtot", "h3dPosNsigmaTOFvsTrackPtot", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTOF}); - histos.add("Lambda/h3dNegNsigmaTOFvsTrackPtot", "h3dNegNsigmaTOFvsTrackPtot", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTOF}); - histos.add("Lambda/h3dPosTOFdeltaTvsTrackPtot", "h3dPosTOFdeltaTvsTrackPtot", kTH3D, {axisCentrality, axisPtCoarse, axisTOFdeltaT}); - histos.add("Lambda/h3dNegTOFdeltaTvsTrackPtot", "h3dNegTOFdeltaTvsTrackPtot", kTH3D, {axisCentrality, axisPtCoarse, axisTOFdeltaT}); - histos.add("Lambda/h3dPosNsigmaTOFvsTrackPt", "h3dPosNsigmaTOFvsTrackPt", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTOF}); - histos.add("Lambda/h3dNegNsigmaTOFvsTrackPt", "h3dNegNsigmaTOFvsTrackPt", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTOF}); - histos.add("Lambda/h3dPosTOFdeltaTvsTrackPt", "h3dPosTOFdeltaTvsTrackPt", kTH3D, {axisCentrality, axisPtCoarse, axisTOFdeltaT}); - histos.add("Lambda/h3dNegTOFdeltaTvsTrackPt", "h3dNegTOFdeltaTvsTrackPt", kTH3D, {axisCentrality, axisPtCoarse, axisTOFdeltaT}); + histos.add("Lambda/h3dPosNsigmaTOF", "h3dPosNsigmaTOF", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTOF}); + histos.add("Lambda/h3dNegNsigmaTOF", "h3dNegNsigmaTOF", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTOF}); + histos.add("Lambda/h3dPosTOFdeltaT", "h3dPosTOFdeltaT", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTOFdeltaT}); + histos.add("Lambda/h3dNegTOFdeltaT", "h3dNegTOFdeltaT", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTOFdeltaT}); + histos.add("Lambda/h3dPosNsigmaTOFvsTrackPtot", "h3dPosNsigmaTOFvsTrackPtot", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTOF}); + histos.add("Lambda/h3dNegNsigmaTOFvsTrackPtot", "h3dNegNsigmaTOFvsTrackPtot", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTOF}); + histos.add("Lambda/h3dPosTOFdeltaTvsTrackPtot", "h3dPosTOFdeltaTvsTrackPtot", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTOFdeltaT}); + histos.add("Lambda/h3dNegTOFdeltaTvsTrackPtot", "h3dNegTOFdeltaTvsTrackPtot", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTOFdeltaT}); + histos.add("Lambda/h3dPosNsigmaTOFvsTrackPt", "h3dPosNsigmaTOFvsTrackPt", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTOF}); + histos.add("Lambda/h3dNegNsigmaTOFvsTrackPt", "h3dNegNsigmaTOFvsTrackPt", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTOF}); + histos.add("Lambda/h3dPosTOFdeltaTvsTrackPt", "h3dPosTOFdeltaTvsTrackPt", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTOFdeltaT}); + histos.add("Lambda/h3dNegTOFdeltaTvsTrackPt", "h3dNegTOFdeltaTvsTrackPt", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTOFdeltaT}); } if (doCollisionAssociationQA) { - histos.add("Lambda/h2dPtVsNch", "h2dPtVsNch", kTH2D, {axisMonteCarloNch, axisPt}); - histos.add("Lambda/h2dPtVsNch_BadCollAssig", "h2dPtVsNch_BadCollAssig", kTH2D, {axisMonteCarloNch, axisPt}); + histos.add("Lambda/h2dPtVsNch", "h2dPtVsNch", kTH2D, {axisConfigurations.axisMonteCarloNch, axisConfigurations.axisPt}); + histos.add("Lambda/h2dPtVsNch_BadCollAssig", "h2dPtVsNch_BadCollAssig", kTH2D, {axisConfigurations.axisMonteCarloNch, axisConfigurations.axisPt}); } if (doDetectPropQA == 1) { - histos.add("Lambda/h6dDetectPropVsCentrality", "h6dDetectPropVsCentrality", kTHnD, {axisCentrality, axisDetMapCoarse, axisITScluMapCoarse, axisDetMapCoarse, axisITScluMapCoarse, axisPtCoarse}); - histos.add("Lambda/h4dPosDetectPropVsCentrality", "h4dPosDetectPropVsCentrality", kTHnD, {axisCentrality, axisDetMap, axisITScluMap, axisPtCoarse}); - histos.add("Lambda/h4dNegDetectPropVsCentrality", "h4dNegDetectPropVsCentrality", kTHnD, {axisCentrality, axisDetMap, axisITScluMap, axisPtCoarse}); + histos.add("Lambda/h6dDetectPropVsCentrality", "h6dDetectPropVsCentrality", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisDetMapCoarse, axisConfigurations.axisITScluMapCoarse, axisConfigurations.axisDetMapCoarse, axisConfigurations.axisITScluMapCoarse, axisConfigurations.axisPtCoarse}); + histos.add("Lambda/h4dPosDetectPropVsCentrality", "h4dPosDetectPropVsCentrality", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisDetMap, axisConfigurations.axisITScluMap, axisConfigurations.axisPtCoarse}); + histos.add("Lambda/h4dNegDetectPropVsCentrality", "h4dNegDetectPropVsCentrality", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisDetMap, axisConfigurations.axisITScluMap, axisConfigurations.axisPtCoarse}); } if (doDetectPropQA == 2) { - histos.add("Lambda/h7dDetectPropVsCentrality", "h7dDetectPropVsCentrality", kTHnD, {axisCentrality, axisDetMapCoarse, axisITScluMapCoarse, axisDetMapCoarse, axisITScluMapCoarse, axisPtCoarse, axisLambdaMass}); - histos.add("Lambda/h5dPosDetectPropVsCentrality", "h5dPosDetectPropVsCentrality", kTHnD, {axisCentrality, axisDetMap, axisITScluMap, axisPtCoarse, axisLambdaMass}); - histos.add("Lambda/h5dNegDetectPropVsCentrality", "h5dNegDetectPropVsCentrality", kTHnD, {axisCentrality, axisDetMap, axisITScluMap, axisPtCoarse, axisLambdaMass}); + histos.add("Lambda/h7dDetectPropVsCentrality", "h7dDetectPropVsCentrality", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisDetMapCoarse, axisConfigurations.axisITScluMapCoarse, axisConfigurations.axisDetMapCoarse, axisConfigurations.axisITScluMapCoarse, axisConfigurations.axisPtCoarse, axisConfigurations.axisLambdaMass}); + histos.add("Lambda/h5dPosDetectPropVsCentrality", "h5dPosDetectPropVsCentrality", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisDetMap, axisConfigurations.axisITScluMap, axisConfigurations.axisPtCoarse, axisConfigurations.axisLambdaMass}); + histos.add("Lambda/h5dNegDetectPropVsCentrality", "h5dNegDetectPropVsCentrality", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisDetMap, axisConfigurations.axisITScluMap, axisConfigurations.axisPtCoarse, axisConfigurations.axisLambdaMass}); } if (doDetectPropQA == 3) { - histos.add("Lambda/h3dITSchi2", "h3dMaxITSchi2", kTH3D, {axisCentrality, axisPtCoarse, axisITSchi2}); - histos.add("Lambda/h3dTPCchi2", "h3dMaxTPCchi2", kTH3D, {axisCentrality, axisPtCoarse, axisTPCchi2}); - histos.add("Lambda/h3dTPCFoundOverFindable", "h3dTPCFoundOverFindable", kTH3D, {axisCentrality, axisPtCoarse, axisTPCfoundOverFindable}); - histos.add("Lambda/h3dTPCrowsOverFindable", "h3dTPCrowsOverFindable", kTH3D, {axisCentrality, axisPtCoarse, axisTPCrowsOverFindable}); - histos.add("Lambda/h3dTPCsharedCls", "h3dTPCsharedCls", kTH3D, {axisCentrality, axisPtCoarse, axisTPCsharedClusters}); - histos.add("Lambda/h3dPositiveITSchi2", "h3dPositiveITSchi2", kTH3D, {axisCentrality, axisPtCoarse, axisITSchi2}); - histos.add("Lambda/h3dNegativeITSchi2", "h3dNegativeITSchi2", kTH3D, {axisCentrality, axisPtCoarse, axisITSchi2}); - histos.add("Lambda/h3dPositiveTPCchi2", "h3dPositiveTPCchi2", kTH3D, {axisCentrality, axisPtCoarse, axisTPCchi2}); - histos.add("Lambda/h3dNegativeTPCchi2", "h3dNegativeTPCchi2", kTH3D, {axisCentrality, axisPtCoarse, axisTPCchi2}); - histos.add("Lambda/h3dPositiveITSclusters", "h3dPositiveITSclusters", kTH3D, {axisCentrality, axisPtCoarse, axisITSclus}); - histos.add("Lambda/h3dNegativeITSclusters", "h3dNegativeITSclusters", kTH3D, {axisCentrality, axisPtCoarse, axisITSclus}); - histos.add("Lambda/h3dPositiveTPCcrossedRows", "h3dPositiveTPCcrossedRows", kTH3D, {axisCentrality, axisPtCoarse, axisTPCrows}); - histos.add("Lambda/h3dNegativeTPCcrossedRows", "h3dNegativeTPCcrossedRows", kTH3D, {axisCentrality, axisPtCoarse, axisTPCrows}); + histos.add("Lambda/h3dITSchi2", "h3dMaxITSchi2", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisITSchi2}); + histos.add("Lambda/h3dTPCchi2", "h3dMaxTPCchi2", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCchi2}); + histos.add("Lambda/h3dTPCFoundOverFindable", "h3dTPCFoundOverFindable", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCfoundOverFindable}); + histos.add("Lambda/h3dTPCrowsOverFindable", "h3dTPCrowsOverFindable", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCrowsOverFindable}); + histos.add("Lambda/h3dTPCsharedCls", "h3dTPCsharedCls", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCsharedClusters}); + histos.add("Lambda/h3dPositiveITSchi2", "h3dPositiveITSchi2", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisITSchi2}); + histos.add("Lambda/h3dNegativeITSchi2", "h3dNegativeITSchi2", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisITSchi2}); + histos.add("Lambda/h3dPositiveTPCchi2", "h3dPositiveTPCchi2", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCchi2}); + histos.add("Lambda/h3dNegativeTPCchi2", "h3dNegativeTPCchi2", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCchi2}); + histos.add("Lambda/h3dPositiveITSclusters", "h3dPositiveITSclusters", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisITSclus}); + histos.add("Lambda/h3dNegativeITSclusters", "h3dNegativeITSclusters", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisITSclus}); + histos.add("Lambda/h3dPositiveTPCcrossedRows", "h3dPositiveTPCcrossedRows", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCrows}); + histos.add("Lambda/h3dNegativeTPCcrossedRows", "h3dNegativeTPCcrossedRows", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCrows}); } if (doEtaPhiQA) { - histos.add("Lambda/h5dV0PhiVsEta", "h5dV0PhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisPhi, axisEta}); - histos.add("Lambda/h5dPosPhiVsNegPhi", "h5dPosPhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisPhi, axisPhi}); - histos.add("Lambda/h5dPosEtaVsNegEta", "h5dNegPhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisEta, axisEta}); + histos.add("Lambda/h5dV0PhiVsEta", "h5dV0PhiVsEta", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisLambdaMass, axisConfigurations.axisPhi, axisConfigurations.axisEta}); + histos.add("Lambda/h5dPosPhiVsEta", "h5dPosPhiVsEta", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisLambdaMass, axisConfigurations.axisPhi, axisConfigurations.axisEta}); + histos.add("Lambda/h5dNegPhiVsEta", "h5dNegPhiVsEta", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisLambdaMass, axisConfigurations.axisPhi, axisConfigurations.axisEta}); } } if (analyseAntiLambda) { - histos.add("h2dNbrOfAntiLambdaVsCentrality", "h2dNbrOfAntiLambdaVsCentrality", kTH2D, {axisCentrality, {10, -0.5f, 9.5f}}); - histos.add("h3dMassAntiLambda", "h3dMassAntiLambda", kTH3D, {axisCentrality, axisPt, axisLambdaMass}); + histos.add("h2dNbrOfAntiLambdaVsCentrality", "h2dNbrOfAntiLambdaVsCentrality", kTH2D, {axisConfigurations.axisCentrality, {10, -0.5f, 9.5f}}); + histos.add("h3dMassAntiLambda", "h3dMassAntiLambda", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt, axisConfigurations.axisLambdaMass}); // Non-UPC info - histos.add("h3dMassAntiLambdaHadronic", "h3dMassAntiLambdaHadronic", kTH3D, {axisCentrality, axisPt, axisLambdaMass}); + histos.add("h3dMassAntiLambdaHadronic", "h3dMassAntiLambdaHadronic", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt, axisConfigurations.axisLambdaMass}); // UPC info - histos.add("h3dMassAntiLambdaSGA", "h3dMassAntiLambdaSGA", kTH3D, {axisCentrality, axisPt, axisLambdaMass}); - histos.add("h3dMassAntiLambdaSGC", "h3dMassAntiLambdaSGC", kTH3D, {axisCentrality, axisPt, axisLambdaMass}); - histos.add("h3dMassAntiLambdaDG", "h3dMassAntiLambdaDG", kTH3D, {axisCentrality, axisPt, axisLambdaMass}); + histos.add("h3dMassAntiLambdaSGA", "h3dMassAntiLambdaSGA", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt, axisConfigurations.axisLambdaMass}); + histos.add("h3dMassAntiLambdaSGC", "h3dMassAntiLambdaSGC", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt, axisConfigurations.axisLambdaMass}); + histos.add("h3dMassAntiLambdaDG", "h3dMassAntiLambdaDG", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt, axisConfigurations.axisLambdaMass}); if (doTPCQA) { - histos.add("AntiLambda/h3dPosNsigmaTPC", "h3dPosNsigmaTPC", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTPC}); - histos.add("AntiLambda/h3dNegNsigmaTPC", "h3dNegNsigmaTPC", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTPC}); - histos.add("AntiLambda/h3dPosTPCsignal", "h3dPosTPCsignal", kTH3D, {axisCentrality, axisPtCoarse, axisTPCsignal}); - histos.add("AntiLambda/h3dNegTPCsignal", "h3dNegTPCsignal", kTH3D, {axisCentrality, axisPtCoarse, axisTPCsignal}); - histos.add("AntiLambda/h3dPosNsigmaTPCvsTrackPtot", "h3dPosNsigmaTPCvsTrackPtot", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTPC}); - histos.add("AntiLambda/h3dNegNsigmaTPCvsTrackPtot", "h3dNegNsigmaTPCvsTrackPtot", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTPC}); - histos.add("AntiLambda/h3dPosTPCsignalVsTrackPtot", "h3dPosTPCsignalVsTrackPtot", kTH3D, {axisCentrality, axisPtCoarse, axisTPCsignal}); - histos.add("AntiLambda/h3dNegTPCsignalVsTrackPtot", "h3dNegTPCsignalVsTrackPtot", kTH3D, {axisCentrality, axisPtCoarse, axisTPCsignal}); - histos.add("AntiLambda/h3dPosNsigmaTPCvsTrackPt", "h3dPosNsigmaTPCvsTrackPt", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTPC}); - histos.add("AntiLambda/h3dNegNsigmaTPCvsTrackPt", "h3dNegNsigmaTPCvsTrackPt", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTPC}); - histos.add("AntiLambda/h3dPosTPCsignalVsTrackPt", "h3dPosTPCsignalVsTrackPt", kTH3D, {axisCentrality, axisPtCoarse, axisTPCsignal}); - histos.add("AntiLambda/h3dNegTPCsignalVsTrackPt", "h3dNegTPCsignalVsTrackPt", kTH3D, {axisCentrality, axisPtCoarse, axisTPCsignal}); + histos.add("AntiLambda/h3dPosNsigmaTPC", "h3dPosNsigmaTPC", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTPC}); + histos.add("AntiLambda/h3dNegNsigmaTPC", "h3dNegNsigmaTPC", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTPC}); + histos.add("AntiLambda/h3dPosTPCsignal", "h3dPosTPCsignal", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCsignal}); + histos.add("AntiLambda/h3dNegTPCsignal", "h3dNegTPCsignal", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCsignal}); + histos.add("AntiLambda/h3dPosNsigmaTPCvsTrackPtot", "h3dPosNsigmaTPCvsTrackPtot", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTPC}); + histos.add("AntiLambda/h3dNegNsigmaTPCvsTrackPtot", "h3dNegNsigmaTPCvsTrackPtot", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTPC}); + histos.add("AntiLambda/h3dPosTPCsignalVsTrackPtot", "h3dPosTPCsignalVsTrackPtot", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCsignal}); + histos.add("AntiLambda/h3dNegTPCsignalVsTrackPtot", "h3dNegTPCsignalVsTrackPtot", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCsignal}); + histos.add("AntiLambda/h3dPosNsigmaTPCvsTrackPt", "h3dPosNsigmaTPCvsTrackPt", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTPC}); + histos.add("AntiLambda/h3dNegNsigmaTPCvsTrackPt", "h3dNegNsigmaTPCvsTrackPt", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTPC}); + histos.add("AntiLambda/h3dPosTPCsignalVsTrackPt", "h3dPosTPCsignalVsTrackPt", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCsignal}); + histos.add("AntiLambda/h3dNegTPCsignalVsTrackPt", "h3dNegTPCsignalVsTrackPt", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCsignal}); } if (doTOFQA) { - histos.add("AntiLambda/h3dPosNsigmaTOF", "h3dPosNsigmaTOF", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTOF}); - histos.add("AntiLambda/h3dNegNsigmaTOF", "h3dNegNsigmaTOF", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTOF}); - histos.add("AntiLambda/h3dPosTOFdeltaT", "h3dPosTOFdeltaT", kTH3D, {axisCentrality, axisPtCoarse, axisTOFdeltaT}); - histos.add("AntiLambda/h3dNegTOFdeltaT", "h3dNegTOFdeltaT", kTH3D, {axisCentrality, axisPtCoarse, axisTOFdeltaT}); - histos.add("AntiLambda/h3dPosNsigmaTOFvsTrackPtot", "h3dPosNsigmaTOFvsTrackPtot", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTOF}); - histos.add("AntiLambda/h3dNegNsigmaTOFvsTrackPtot", "h3dNegNsigmaTOFvsTrackPtot", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTOF}); - histos.add("AntiLambda/h3dPosTOFdeltaTvsTrackPtot", "h3dPosTOFdeltaTvsTrackPtot", kTH3D, {axisCentrality, axisPtCoarse, axisTOFdeltaT}); - histos.add("AntiLambda/h3dNegTOFdeltaTvsTrackPtot", "h3dNegTOFdeltaTvsTrackPtot", kTH3D, {axisCentrality, axisPtCoarse, axisTOFdeltaT}); - histos.add("AntiLambda/h3dPosNsigmaTOFvsTrackPt", "h3dPosNsigmaTOFvsTrackPt", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTOF}); - histos.add("AntiLambda/h3dNegNsigmaTOFvsTrackPt", "h3dNegNsigmaTOFvsTrackPt", kTH3D, {axisCentrality, axisPtCoarse, axisNsigmaTOF}); - histos.add("AntiLambda/h3dPosTOFdeltaTvsTrackPt", "h3dPosTOFdeltaTvsTrackPt", kTH3D, {axisCentrality, axisPtCoarse, axisTOFdeltaT}); - histos.add("AntiLambda/h3dNegTOFdeltaTvsTrackPt", "h3dNegTOFdeltaTvsTrackPt", kTH3D, {axisCentrality, axisPtCoarse, axisTOFdeltaT}); + histos.add("AntiLambda/h3dPosNsigmaTOF", "h3dPosNsigmaTOF", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTOF}); + histos.add("AntiLambda/h3dNegNsigmaTOF", "h3dNegNsigmaTOF", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTOF}); + histos.add("AntiLambda/h3dPosTOFdeltaT", "h3dPosTOFdeltaT", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTOFdeltaT}); + histos.add("AntiLambda/h3dNegTOFdeltaT", "h3dNegTOFdeltaT", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTOFdeltaT}); + histos.add("AntiLambda/h3dPosNsigmaTOFvsTrackPtot", "h3dPosNsigmaTOFvsTrackPtot", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTOF}); + histos.add("AntiLambda/h3dNegNsigmaTOFvsTrackPtot", "h3dNegNsigmaTOFvsTrackPtot", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTOF}); + histos.add("AntiLambda/h3dPosTOFdeltaTvsTrackPtot", "h3dPosTOFdeltaTvsTrackPtot", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTOFdeltaT}); + histos.add("AntiLambda/h3dNegTOFdeltaTvsTrackPtot", "h3dNegTOFdeltaTvsTrackPtot", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTOFdeltaT}); + histos.add("AntiLambda/h3dPosNsigmaTOFvsTrackPt", "h3dPosNsigmaTOFvsTrackPt", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTOF}); + histos.add("AntiLambda/h3dNegNsigmaTOFvsTrackPt", "h3dNegNsigmaTOFvsTrackPt", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisNsigmaTOF}); + histos.add("AntiLambda/h3dPosTOFdeltaTvsTrackPt", "h3dPosTOFdeltaTvsTrackPt", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTOFdeltaT}); + histos.add("AntiLambda/h3dNegTOFdeltaTvsTrackPt", "h3dNegTOFdeltaTvsTrackPt", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTOFdeltaT}); } if (doCollisionAssociationQA) { - histos.add("AntiLambda/h2dPtVsNch", "h2dPtVsNch", kTH2D, {axisMonteCarloNch, axisPt}); - histos.add("AntiLambda/h2dPtVsNch_BadCollAssig", "h2dPtVsNch_BadCollAssig", kTH2D, {axisMonteCarloNch, axisPt}); + histos.add("AntiLambda/h2dPtVsNch", "h2dPtVsNch", kTH2D, {axisConfigurations.axisMonteCarloNch, axisConfigurations.axisPt}); + histos.add("AntiLambda/h2dPtVsNch_BadCollAssig", "h2dPtVsNch_BadCollAssig", kTH2D, {axisConfigurations.axisMonteCarloNch, axisConfigurations.axisPt}); } if (doDetectPropQA == 1) { - histos.add("AntiLambda/h6dDetectPropVsCentrality", "h6dDetectPropVsCentrality", kTHnD, {axisCentrality, axisDetMapCoarse, axisITScluMapCoarse, axisDetMapCoarse, axisITScluMapCoarse, axisPtCoarse}); - histos.add("AntiLambda/h4dPosDetectPropVsCentrality", "h4dPosDetectPropVsCentrality", kTHnD, {axisCentrality, axisDetMap, axisITScluMap, axisPtCoarse}); - histos.add("AntiLambda/h4dNegDetectPropVsCentrality", "h4dNegDetectPropVsCentrality", kTHnD, {axisCentrality, axisDetMap, axisITScluMap, axisPtCoarse}); + histos.add("AntiLambda/h6dDetectPropVsCentrality", "h6dDetectPropVsCentrality", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisDetMapCoarse, axisConfigurations.axisITScluMapCoarse, axisConfigurations.axisDetMapCoarse, axisConfigurations.axisITScluMapCoarse, axisConfigurations.axisPtCoarse}); + histos.add("AntiLambda/h4dPosDetectPropVsCentrality", "h4dPosDetectPropVsCentrality", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisDetMap, axisConfigurations.axisITScluMap, axisConfigurations.axisPtCoarse}); + histos.add("AntiLambda/h4dNegDetectPropVsCentrality", "h4dNegDetectPropVsCentrality", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisDetMap, axisConfigurations.axisITScluMap, axisConfigurations.axisPtCoarse}); } if (doDetectPropQA == 2) { - histos.add("AntiLambda/h7dDetectPropVsCentrality", "h7dDetectPropVsCentrality", kTHnD, {axisCentrality, axisDetMapCoarse, axisITScluMapCoarse, axisDetMapCoarse, axisITScluMapCoarse, axisPtCoarse, axisLambdaMass}); - histos.add("AntiLambda/h5dPosDetectPropVsCentrality", "h5dPosDetectPropVsCentrality", kTHnD, {axisCentrality, axisDetMap, axisITScluMap, axisPtCoarse, axisLambdaMass}); - histos.add("AntiLambda/h5dNegDetectPropVsCentrality", "h5dNegDetectPropVsCentrality", kTHnD, {axisCentrality, axisDetMap, axisITScluMap, axisPtCoarse, axisLambdaMass}); + histos.add("AntiLambda/h7dDetectPropVsCentrality", "h7dDetectPropVsCentrality", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisDetMapCoarse, axisConfigurations.axisITScluMapCoarse, axisConfigurations.axisDetMapCoarse, axisConfigurations.axisITScluMapCoarse, axisConfigurations.axisPtCoarse, axisConfigurations.axisLambdaMass}); + histos.add("AntiLambda/h5dPosDetectPropVsCentrality", "h5dPosDetectPropVsCentrality", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisDetMap, axisConfigurations.axisITScluMap, axisConfigurations.axisPtCoarse, axisConfigurations.axisLambdaMass}); + histos.add("AntiLambda/h5dNegDetectPropVsCentrality", "h5dNegDetectPropVsCentrality", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisDetMap, axisConfigurations.axisITScluMap, axisConfigurations.axisPtCoarse, axisConfigurations.axisLambdaMass}); } if (doDetectPropQA == 3) { - histos.add("AntiLambda/h3dITSchi2", "h3dMaxITSchi2", kTH3D, {axisCentrality, axisPtCoarse, axisITSchi2}); - histos.add("AntiLambda/h3dTPCchi2", "h3dMaxTPCchi2", kTH3D, {axisCentrality, axisPtCoarse, axisTPCchi2}); - histos.add("AntiLambda/h3dTPCFoundOverFindable", "h3dTPCFoundOverFindable", kTH3D, {axisCentrality, axisPtCoarse, axisTPCfoundOverFindable}); - histos.add("AntiLambda/h3dTPCrowsOverFindable", "h3dTPCrowsOverFindable", kTH3D, {axisCentrality, axisPtCoarse, axisTPCrowsOverFindable}); - histos.add("AntiLambda/h3dTPCsharedCls", "h3dTPCsharedCls", kTH3D, {axisCentrality, axisPtCoarse, axisTPCsharedClusters}); - histos.add("AntiLambda/h3dPositiveITSchi2", "h3dPositiveITSchi2", kTH3D, {axisCentrality, axisPtCoarse, axisITSchi2}); - histos.add("AntiLambda/h3dNegativeITSchi2", "h3dNegativeITSchi2", kTH3D, {axisCentrality, axisPtCoarse, axisITSchi2}); - histos.add("AntiLambda/h3dPositiveTPCchi2", "h3dPositiveTPCchi2", kTH3D, {axisCentrality, axisPtCoarse, axisTPCchi2}); - histos.add("AntiLambda/h3dNegativeTPCchi2", "h3dNegativeTPCchi2", kTH3D, {axisCentrality, axisPtCoarse, axisTPCchi2}); - histos.add("AntiLambda/h3dPositiveITSclusters", "h3dPositiveITSclusters", kTH3D, {axisCentrality, axisPtCoarse, axisITSclus}); - histos.add("AntiLambda/h3dNegativeITSclusters", "h3dNegativeITSclusters", kTH3D, {axisCentrality, axisPtCoarse, axisITSclus}); - histos.add("AntiLambda/h3dPositiveTPCcrossedRows", "h3dPositiveTPCcrossedRows", kTH3D, {axisCentrality, axisPtCoarse, axisTPCrows}); - histos.add("AntiLambda/h3dNegativeTPCcrossedRows", "h3dNegativeTPCcrossedRows", kTH3D, {axisCentrality, axisPtCoarse, axisTPCrows}); + histos.add("AntiLambda/h3dITSchi2", "h3dMaxITSchi2", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisITSchi2}); + histos.add("AntiLambda/h3dTPCchi2", "h3dMaxTPCchi2", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCchi2}); + histos.add("AntiLambda/h3dTPCFoundOverFindable", "h3dTPCFoundOverFindable", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCfoundOverFindable}); + histos.add("AntiLambda/h3dTPCrowsOverFindable", "h3dTPCrowsOverFindable", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCrowsOverFindable}); + histos.add("AntiLambda/h3dTPCsharedCls", "h3dTPCsharedCls", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCsharedClusters}); + histos.add("AntiLambda/h3dPositiveITSchi2", "h3dPositiveITSchi2", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisITSchi2}); + histos.add("AntiLambda/h3dNegativeITSchi2", "h3dNegativeITSchi2", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisITSchi2}); + histos.add("AntiLambda/h3dPositiveTPCchi2", "h3dPositiveTPCchi2", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCchi2}); + histos.add("AntiLambda/h3dNegativeTPCchi2", "h3dNegativeTPCchi2", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCchi2}); + histos.add("AntiLambda/h3dPositiveITSclusters", "h3dPositiveITSclusters", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisITSclus}); + histos.add("AntiLambda/h3dNegativeITSclusters", "h3dNegativeITSclusters", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisITSclus}); + histos.add("AntiLambda/h3dPositiveTPCcrossedRows", "h3dPositiveTPCcrossedRows", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCrows}); + histos.add("AntiLambda/h3dNegativeTPCcrossedRows", "h3dNegativeTPCcrossedRows", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisTPCrows}); } if (doEtaPhiQA) { - histos.add("AntiLambda/h5dV0PhiVsEta", "h5dV0PhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisPhi, axisEta}); - histos.add("AntiLambda/h5dPosPhiVsNegPhi", "h5dPosPhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisPhi, axisPhi}); - histos.add("AntiLambda/h5dPosEtaVsNegEta", "h5dNegPhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisEta, axisEta}); + histos.add("AntiLambda/h5dV0PhiVsEta", "h5dV0PhiVsEta", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisLambdaMass, axisConfigurations.axisPhi, axisConfigurations.axisEta}); + histos.add("AntiLambda/h5dPosPhiVsEta", "h5dPosPhiVsEta", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisLambdaMass, axisConfigurations.axisPhi, axisConfigurations.axisEta}); + histos.add("AntiLambda/h5dNegPhiVsEta", "h5dNegPhiVsEta", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisLambdaMass, axisConfigurations.axisPhi, axisConfigurations.axisEta}); } } if (analyseLambda && calculateFeeddownMatrix && (doprocessMonteCarloRun3 || doprocessMonteCarloRun2)) - histos.add("h3dLambdaFeeddown", "h3dLambdaFeeddown", kTH3D, {axisCentrality, axisPt, axisPtXi}); + histos.add("h3dLambdaFeeddown", "h3dLambdaFeeddown", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt, axisConfigurations.axisPtXi}); if (analyseAntiLambda && calculateFeeddownMatrix && (doprocessMonteCarloRun3 || doprocessMonteCarloRun2)) - histos.add("h3dAntiLambdaFeeddown", "h3dAntiLambdaFeeddown", kTH3D, {axisCentrality, axisPt, axisPtXi}); + histos.add("h3dAntiLambdaFeeddown", "h3dAntiLambdaFeeddown", kTH3D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt, axisConfigurations.axisPtXi}); - // demo // fast - histos.add("hMassK0Short", "hMassK0Short", kTH1D, {axisK0Mass}); + if (analyseK0Short) + histos.add("hMassK0Short", "hMassK0Short", kTH1D, {axisConfigurations.axisK0Mass}); + if (analyseLambda) + histos.add("hMassLambda", "hMassLambda", kTH1D, {axisConfigurations.axisLambdaMass}); + if (analyseAntiLambda) + histos.add("hMassAntiLambda", "hMassAntiLambda", kTH1D, {axisConfigurations.axisLambdaMass}); // QA histograms if requested if (doCompleteTopoQA) { // initialize for K0short... if (analyseK0Short) { - histos.add("K0Short/h4dPosDCAToPV", "h4dPosDCAToPV", kTHnD, {axisCentrality, axisPtCoarse, axisK0Mass, axisDCAtoPV}); - histos.add("K0Short/h4dNegDCAToPV", "h4dNegDCAToPV", kTHnD, {axisCentrality, axisPtCoarse, axisK0Mass, axisDCAtoPV}); - histos.add("K0Short/h4dDCADaughters", "h4dDCADaughters", kTHnD, {axisCentrality, axisPtCoarse, axisK0Mass, axisDCAdau}); - histos.add("K0Short/h4dPointingAngle", "h4dPointingAngle", kTHnD, {axisCentrality, axisPtCoarse, axisK0Mass, axisPointingAngle}); - histos.add("K0Short/h4dV0Radius", "h4dV0Radius", kTHnD, {axisCentrality, axisPtCoarse, axisK0Mass, axisV0Radius}); + histos.add("K0Short/h4dPosDCAToPV", "h4dPosDCAToPV", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisK0Mass, axisConfigurations.axisDCAtoPV}); + histos.add("K0Short/h4dNegDCAToPV", "h4dNegDCAToPV", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisK0Mass, axisConfigurations.axisDCAtoPV}); + histos.add("K0Short/h4dDCADaughters", "h4dDCADaughters", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisK0Mass, axisConfigurations.axisDCAdau}); + histos.add("K0Short/h4dPointingAngle", "h4dPointingAngle", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisK0Mass, axisConfigurations.axisPointingAngle}); + histos.add("K0Short/h4dV0Radius", "h4dV0Radius", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisK0Mass, axisConfigurations.axisV0Radius}); } if (analyseLambda) { - histos.add("Lambda/h4dPosDCAToPV", "h4dPosDCAToPV", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisDCAtoPV}); - histos.add("Lambda/h4dNegDCAToPV", "h4dNegDCAToPV", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisDCAtoPV}); - histos.add("Lambda/h4dDCADaughters", "h4dDCADaughters", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisDCAdau}); - histos.add("Lambda/h4dPointingAngle", "h4dPointingAngle", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisPointingAngle}); - histos.add("Lambda/h4dV0Radius", "h4dV0Radius", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisV0Radius}); + histos.add("Lambda/h4dPosDCAToPV", "h4dPosDCAToPV", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisLambdaMass, axisConfigurations.axisDCAtoPV}); + histos.add("Lambda/h4dNegDCAToPV", "h4dNegDCAToPV", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisLambdaMass, axisConfigurations.axisDCAtoPV}); + histos.add("Lambda/h4dDCADaughters", "h4dDCADaughters", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisLambdaMass, axisConfigurations.axisDCAdau}); + histos.add("Lambda/h4dPointingAngle", "h4dPointingAngle", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisLambdaMass, axisConfigurations.axisPointingAngle}); + histos.add("Lambda/h4dV0Radius", "h4dV0Radius", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisLambdaMass, axisConfigurations.axisV0Radius}); } if (analyseAntiLambda) { - histos.add("AntiLambda/h4dPosDCAToPV", "h4dPosDCAToPV", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisDCAtoPV}); - histos.add("AntiLambda/h4dNegDCAToPV", "h4dNegDCAToPV", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisDCAtoPV}); - histos.add("AntiLambda/h4dDCADaughters", "h4dDCADaughters", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisDCAdau}); - histos.add("AntiLambda/h4dPointingAngle", "h4dPointingAngle", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisPointingAngle}); - histos.add("AntiLambda/h4dV0Radius", "h4dV0Radius", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisV0Radius}); + histos.add("AntiLambda/h4dPosDCAToPV", "h4dPosDCAToPV", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisLambdaMass, axisConfigurations.axisDCAtoPV}); + histos.add("AntiLambda/h4dNegDCAToPV", "h4dNegDCAToPV", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisLambdaMass, axisConfigurations.axisDCAtoPV}); + histos.add("AntiLambda/h4dDCADaughters", "h4dDCADaughters", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisLambdaMass, axisConfigurations.axisDCAdau}); + histos.add("AntiLambda/h4dPointingAngle", "h4dPointingAngle", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisLambdaMass, axisConfigurations.axisPointingAngle}); + histos.add("AntiLambda/h4dV0Radius", "h4dV0Radius", kTHnD, {axisConfigurations.axisCentrality, axisConfigurations.axisPtCoarse, axisConfigurations.axisLambdaMass, axisConfigurations.axisV0Radius}); } } if (doPlainTopoQA) { // All candidates received - histos.add("hPosDCAToPV", "hPosDCAToPV", kTH1D, {axisDCAtoPV}); - histos.add("hNegDCAToPV", "hNegDCAToPV", kTH1D, {axisDCAtoPV}); - histos.add("hDCADaughters", "hDCADaughters", kTH1D, {axisDCAdau}); - histos.add("hPointingAngle", "hPointingAngle", kTH1D, {axisPointingAngle}); - histos.add("hV0Radius", "hV0Radius", kTH1D, {axisV0Radius}); - histos.add("h2dPositiveITSvsTPCpts", "h2dPositiveITSvsTPCpts", kTH2D, {axisTPCrows, axisITSclus}); - histos.add("h2dNegativeITSvsTPCpts", "h2dNegativeITSvsTPCpts", kTH2D, {axisTPCrows, axisITSclus}); + histos.add("hPosDCAToPV", "hPosDCAToPV", kTH1D, {axisConfigurations.axisDCAtoPV}); + histos.add("hNegDCAToPV", "hNegDCAToPV", kTH1D, {axisConfigurations.axisDCAtoPV}); + histos.add("hDCADaughters", "hDCADaughters", kTH1D, {axisConfigurations.axisDCAdau}); + histos.add("hPointingAngle", "hPointingAngle", kTH1D, {axisConfigurations.axisPointingAngle}); + histos.add("hV0Radius", "hV0Radius", kTH1D, {axisConfigurations.axisV0Radius}); + histos.add("h2dPositiveITSvsTPCpts", "h2dPositiveITSvsTPCpts", kTH2D, {axisConfigurations.axisTPCrows, axisConfigurations.axisITSclus}); + histos.add("h2dNegativeITSvsTPCpts", "h2dNegativeITSvsTPCpts", kTH2D, {axisConfigurations.axisTPCrows, axisConfigurations.axisITSclus}); + histos.add("h2dPositivePtVsPhi", "h2dPositivePtVsPhi", kTH2D, {axisConfigurations.axisPtCoarse, axisConfigurations.axisPhiMod}); + histos.add("h2dNegativePtVsPhi", "h2dNegativePtVsPhi", kTH2D, {axisConfigurations.axisPtCoarse, axisConfigurations.axisPhiMod}); if (analyseK0Short) { - histos.add("K0Short/hPosDCAToPV", "hPosDCAToPV", kTH1D, {axisDCAtoPV}); - histos.add("K0Short/hNegDCAToPV", "hNegDCAToPV", kTH1D, {axisDCAtoPV}); - histos.add("K0Short/hDCADaughters", "hDCADaughters", kTH1D, {axisDCAdau}); - histos.add("K0Short/hPointingAngle", "hPointingAngle", kTH1D, {axisPointingAngle}); - histos.add("K0Short/hV0Radius", "hV0Radius", kTH1D, {axisV0Radius}); - histos.add("K0Short/h2dPositiveITSvsTPCpts", "h2dPositiveITSvsTPCpts", kTH2D, {axisTPCrows, axisITSclus}); - histos.add("K0Short/h2dNegativeITSvsTPCpts", "h2dNegativeITSvsTPCpts", kTH2D, {axisTPCrows, axisITSclus}); + histos.add("K0Short/hPosDCAToPV", "hPosDCAToPV", kTH1D, {axisConfigurations.axisDCAtoPV}); + histos.add("K0Short/hNegDCAToPV", "hNegDCAToPV", kTH1D, {axisConfigurations.axisDCAtoPV}); + histos.add("K0Short/hDCADaughters", "hDCADaughters", kTH1D, {axisConfigurations.axisDCAdau}); + histos.add("K0Short/hPointingAngle", "hPointingAngle", kTH1D, {axisConfigurations.axisPointingAngle}); + histos.add("K0Short/hV0Radius", "hV0Radius", kTH1D, {axisConfigurations.axisV0Radius}); + histos.add("K0Short/h2dPositiveITSvsTPCpts", "h2dPositiveITSvsTPCpts", kTH2D, {axisConfigurations.axisTPCrows, axisConfigurations.axisITSclus}); + histos.add("K0Short/h2dNegativeITSvsTPCpts", "h2dNegativeITSvsTPCpts", kTH2D, {axisConfigurations.axisTPCrows, axisConfigurations.axisITSclus}); + histos.add("K0Short/h2dPositivePtVsPhi", "h2dPositivePtVsPhi", kTH2D, {axisConfigurations.axisPtCoarse, axisConfigurations.axisPhiMod}); + histos.add("K0Short/h2dNegativePtVsPhi", "h2dNegativePtVsPhi", kTH2D, {axisConfigurations.axisPtCoarse, axisConfigurations.axisPhiMod}); } if (analyseLambda) { - histos.add("Lambda/hPosDCAToPV", "hPosDCAToPV", kTH1D, {axisDCAtoPV}); - histos.add("Lambda/hNegDCAToPV", "hNegDCAToPV", kTH1D, {axisDCAtoPV}); - histos.add("Lambda/hDCADaughters", "hDCADaughters", kTH1D, {axisDCAdau}); - histos.add("Lambda/hPointingAngle", "hPointingAngle", kTH1D, {axisPointingAngle}); - histos.add("Lambda/hV0Radius", "hV0Radius", kTH1D, {axisV0Radius}); - histos.add("Lambda/h2dPositiveITSvsTPCpts", "h2dPositiveITSvsTPCpts", kTH2D, {axisTPCrows, axisITSclus}); - histos.add("Lambda/h2dNegativeITSvsTPCpts", "h2dNegativeITSvsTPCpts", kTH2D, {axisTPCrows, axisITSclus}); + histos.add("Lambda/hPosDCAToPV", "hPosDCAToPV", kTH1D, {axisConfigurations.axisDCAtoPV}); + histos.add("Lambda/hNegDCAToPV", "hNegDCAToPV", kTH1D, {axisConfigurations.axisDCAtoPV}); + histos.add("Lambda/hDCADaughters", "hDCADaughters", kTH1D, {axisConfigurations.axisDCAdau}); + histos.add("Lambda/hPointingAngle", "hPointingAngle", kTH1D, {axisConfigurations.axisPointingAngle}); + histos.add("Lambda/hV0Radius", "hV0Radius", kTH1D, {axisConfigurations.axisV0Radius}); + histos.add("Lambda/h2dPositiveITSvsTPCpts", "h2dPositiveITSvsTPCpts", kTH2D, {axisConfigurations.axisTPCrows, axisConfigurations.axisITSclus}); + histos.add("Lambda/h2dNegativeITSvsTPCpts", "h2dNegativeITSvsTPCpts", kTH2D, {axisConfigurations.axisTPCrows, axisConfigurations.axisITSclus}); + histos.add("Lambda/h2dPositivePtVsPhi", "h2dPositivePtVsPhi", kTH2D, {axisConfigurations.axisPtCoarse, axisConfigurations.axisPhiMod}); + histos.add("Lambda/h2dNegativePtVsPhi", "h2dNegativePtVsPhi", kTH2D, {axisConfigurations.axisPtCoarse, axisConfigurations.axisPhiMod}); } if (analyseAntiLambda) { - histos.add("AntiLambda/hPosDCAToPV", "hPosDCAToPV", kTH1D, {axisDCAtoPV}); - histos.add("AntiLambda/hNegDCAToPV", "hNegDCAToPV", kTH1D, {axisDCAtoPV}); - histos.add("AntiLambda/hDCADaughters", "hDCADaughters", kTH1D, {axisDCAdau}); - histos.add("AntiLambda/hPointingAngle", "hPointingAngle", kTH1D, {axisPointingAngle}); - histos.add("AntiLambda/hV0Radius", "hV0Radius", kTH1D, {axisV0Radius}); - histos.add("AntiLambda/h2dPositiveITSvsTPCpts", "h2dPositiveITSvsTPCpts", kTH2D, {axisTPCrows, axisITSclus}); - histos.add("AntiLambda/h2dNegativeITSvsTPCpts", "h2dNegativeITSvsTPCpts", kTH2D, {axisTPCrows, axisITSclus}); + histos.add("AntiLambda/hPosDCAToPV", "hPosDCAToPV", kTH1D, {axisConfigurations.axisDCAtoPV}); + histos.add("AntiLambda/hNegDCAToPV", "hNegDCAToPV", kTH1D, {axisConfigurations.axisDCAtoPV}); + histos.add("AntiLambda/hDCADaughters", "hDCADaughters", kTH1D, {axisConfigurations.axisDCAdau}); + histos.add("AntiLambda/hPointingAngle", "hPointingAngle", kTH1D, {axisConfigurations.axisPointingAngle}); + histos.add("AntiLambda/hV0Radius", "hV0Radius", kTH1D, {axisConfigurations.axisV0Radius}); + histos.add("AntiLambda/h2dPositiveITSvsTPCpts", "h2dPositiveITSvsTPCpts", kTH2D, {axisConfigurations.axisTPCrows, axisConfigurations.axisITSclus}); + histos.add("AntiLambda/h2dNegativeITSvsTPCpts", "h2dNegativeITSvsTPCpts", kTH2D, {axisConfigurations.axisTPCrows, axisConfigurations.axisITSclus}); + histos.add("AntiLambda/h2dPositivePtVsPhi", "h2dPositivePtVsPhi", kTH2D, {axisConfigurations.axisPtCoarse, axisConfigurations.axisPhiMod}); + histos.add("AntiLambda/h2dNegativePtVsPhi", "h2dNegativePtVsPhi", kTH2D, {axisConfigurations.axisPtCoarse, axisConfigurations.axisPhiMod}); } } // Check if doing the right thing in AP space please - histos.add("GeneralQA/h2dArmenterosAll", "h2dArmenterosAll", kTH2D, {axisAPAlpha, axisAPQt}); - histos.add("GeneralQA/h2dArmenterosSelected", "h2dArmenterosSelected", kTH2D, {axisAPAlpha, axisAPQt}); + histos.add("GeneralQA/h2dArmenterosAll", "h2dArmenterosAll", kTH2D, {axisConfigurations.axisAPAlpha, axisConfigurations.axisAPQt}); + histos.add("GeneralQA/h2dArmenterosSelected", "h2dArmenterosSelected", kTH2D, {axisConfigurations.axisAPAlpha, axisConfigurations.axisAPQt}); // Creation of histograms: MC generated if ((doprocessGeneratedRun3 || doprocessGeneratedRun2)) { - histos.add("hGenEvents", "hGenEvents", kTH2D, {{axisNch}, {2, -0.5f, +1.5f}}); + histos.add("hGenEvents", "hGenEvents", kTH2D, {{axisConfigurations.axisNch}, {2, -0.5f, +1.5f}}); histos.get(HIST("hGenEvents"))->GetYaxis()->SetBinLabel(1, "All gen. events"); histos.get(HIST("hGenEvents"))->GetYaxis()->SetBinLabel(2, "Gen. with at least 1 rec. events"); histos.add("hGenEventCentrality", "hGenEventCentrality", kTH1D, {{101, 0.0f, 101.0f}}); - histos.add("hCentralityVsNcoll_beforeEvSel", "hCentralityVsNcoll_beforeEvSel", kTH2D, {axisCentrality, {50, -0.5f, 49.5f}}); - histos.add("hCentralityVsNcoll_afterEvSel", "hCentralityVsNcoll_afterEvSel", kTH2D, {axisCentrality, {50, -0.5f, 49.5f}}); - - histos.add("hCentralityVsMultMC", "hCentralityVsMultMC", kTH2D, {{101, 0.0f, 101.0f}, axisNch}); - - histos.add("h2dGenK0Short", "h2dGenK0Short", kTH2D, {axisCentrality, axisPt}); - histos.add("h2dGenLambda", "h2dGenLambda", kTH2D, {axisCentrality, axisPt}); - histos.add("h2dGenAntiLambda", "h2dGenAntiLambda", kTH2D, {axisCentrality, axisPt}); - histos.add("h2dGenXiMinus", "h2dGenXiMinus", kTH2D, {axisCentrality, axisPt}); - histos.add("h2dGenXiPlus", "h2dGenXiPlus", kTH2D, {axisCentrality, axisPt}); - histos.add("h2dGenOmegaMinus", "h2dGenOmegaMinus", kTH2D, {axisCentrality, axisPt}); - histos.add("h2dGenOmegaPlus", "h2dGenOmegaPlus", kTH2D, {axisCentrality, axisPt}); - - histos.add("h2dGenK0ShortVsMultMC_RecoedEvt", "h2dGenK0ShortVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); - histos.add("h2dGenLambdaVsMultMC_RecoedEvt", "h2dGenLambdaVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); - histos.add("h2dGenAntiLambdaVsMultMC_RecoedEvt", "h2dGenAntiLambdaVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); - histos.add("h2dGenXiMinusVsMultMC_RecoedEvt", "h2dGenXiMinusVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); - histos.add("h2dGenXiPlusVsMultMC_RecoedEvt", "h2dGenXiPlusVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); - histos.add("h2dGenOmegaMinusVsMultMC_RecoedEvt", "h2dGenOmegaMinusVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); - histos.add("h2dGenOmegaPlusVsMultMC_RecoedEvt", "h2dGenOmegaPlusVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); - - histos.add("h2dGenK0ShortVsMultMC", "h2dGenK0ShortVsMultMC", kTH2D, {axisNch, axisPt}); - histos.add("h2dGenLambdaVsMultMC", "h2dGenLambdaVsMultMC", kTH2D, {axisNch, axisPt}); - histos.add("h2dGenAntiLambdaVsMultMC", "h2dGenAntiLambdaVsMultMC", kTH2D, {axisNch, axisPt}); - histos.add("h2dGenXiMinusVsMultMC", "h2dGenXiMinusVsMultMC", kTH2D, {axisNch, axisPt}); - histos.add("h2dGenXiPlusVsMultMC", "h2dGenXiPlusVsMultMC", kTH2D, {axisNch, axisPt}); - histos.add("h2dGenOmegaMinusVsMultMC", "h2dGenOmegaMinusVsMultMC", kTH2D, {axisNch, axisPt}); - histos.add("h2dGenOmegaPlusVsMultMC", "h2dGenOmegaPlusVsMultMC", kTH2D, {axisNch, axisPt}); + histos.add("hCentralityVsNcoll_beforeEvSel", "hCentralityVsNcoll_beforeEvSel", kTH2D, {axisConfigurations.axisCentrality, {50, -0.5f, 49.5f}}); + histos.add("hCentralityVsNcoll_afterEvSel", "hCentralityVsNcoll_afterEvSel", kTH2D, {axisConfigurations.axisCentrality, {50, -0.5f, 49.5f}}); + + histos.add("hCentralityVsMultMC", "hCentralityVsMultMC", kTH2D, {{101, 0.0f, 101.0f}, axisConfigurations.axisNch}); + + histos.add("h2dGenK0Short", "h2dGenK0Short", kTH2D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt}); + histos.add("h2dGenLambda", "h2dGenLambda", kTH2D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt}); + histos.add("h2dGenAntiLambda", "h2dGenAntiLambda", kTH2D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt}); + histos.add("h2dGenXiMinus", "h2dGenXiMinus", kTH2D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt}); + histos.add("h2dGenXiPlus", "h2dGenXiPlus", kTH2D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt}); + histos.add("h2dGenOmegaMinus", "h2dGenOmegaMinus", kTH2D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt}); + histos.add("h2dGenOmegaPlus", "h2dGenOmegaPlus", kTH2D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt}); + + histos.add("h2dGenK0ShortVsMultMC_RecoedEvt", "h2dGenK0ShortVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + histos.add("h2dGenLambdaVsMultMC_RecoedEvt", "h2dGenLambdaVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + histos.add("h2dGenAntiLambdaVsMultMC_RecoedEvt", "h2dGenAntiLambdaVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + histos.add("h2dGenXiMinusVsMultMC_RecoedEvt", "h2dGenXiMinusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + histos.add("h2dGenXiPlusVsMultMC_RecoedEvt", "h2dGenXiPlusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + histos.add("h2dGenOmegaMinusVsMultMC_RecoedEvt", "h2dGenOmegaMinusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + histos.add("h2dGenOmegaPlusVsMultMC_RecoedEvt", "h2dGenOmegaPlusVsMultMC_RecoedEvt", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + + histos.add("h2dGenK0ShortVsMultMC", "h2dGenK0ShortVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + histos.add("h2dGenLambdaVsMultMC", "h2dGenLambdaVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + histos.add("h2dGenAntiLambdaVsMultMC", "h2dGenAntiLambdaVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + histos.add("h2dGenXiMinusVsMultMC", "h2dGenXiMinusVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + histos.add("h2dGenXiPlusVsMultMC", "h2dGenXiPlusVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + histos.add("h2dGenOmegaMinusVsMultMC", "h2dGenOmegaMinusVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); + histos.add("h2dGenOmegaPlusVsMultMC", "h2dGenOmegaPlusVsMultMC", kTH2D, {axisConfigurations.axisNch, axisConfigurations.axisPt}); } if (doprocessBinnedGenerated) { - histos.add("h2dGeneratedK0Short", "h2dGeneratedK0Short", kTH2D, {axisCentrality, axisPt}); - histos.add("h2dGeneratedLambda", "h2dGeneratedLambda", kTH2D, {axisCentrality, axisPt}); - histos.add("h2dGeneratedAntiLambda", "h2dGeneratedAntiLambda", kTH2D, {axisCentrality, axisPt}); - histos.add("h2dGeneratedXiMinus", "h2dGeneratedXiMinus", kTH2D, {axisCentrality, axisPt}); - histos.add("h2dGeneratedXiPlus", "h2dGeneratedXiPlus", kTH2D, {axisCentrality, axisPt}); - histos.add("h2dGeneratedOmegaMinus", "h2dGeneratedOmegaMinus", kTH2D, {axisCentrality, axisPt}); - histos.add("h2dGeneratedOmegaPlus", "h2dGeneratedOmegaPlus", kTH2D, {axisCentrality, axisPt}); + histos.add("h2dGeneratedK0Short", "h2dGeneratedK0Short", kTH2D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt}); + histos.add("h2dGeneratedLambda", "h2dGeneratedLambda", kTH2D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt}); + histos.add("h2dGeneratedAntiLambda", "h2dGeneratedAntiLambda", kTH2D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt}); + histos.add("h2dGeneratedXiMinus", "h2dGeneratedXiMinus", kTH2D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt}); + histos.add("h2dGeneratedXiPlus", "h2dGeneratedXiPlus", kTH2D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt}); + histos.add("h2dGeneratedOmegaMinus", "h2dGeneratedOmegaMinus", kTH2D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt}); + histos.add("h2dGeneratedOmegaPlus", "h2dGeneratedOmegaPlus", kTH2D, {axisConfigurations.axisCentrality, axisConfigurations.axisPt}); } // inspect histogram sizes, please @@ -1042,6 +1133,47 @@ struct derivedlambdakzeroanalysis { timeStampML = mlConfigurations.timestampCCDB.value; loadMachines(timeStampML); } + // Fetching magnetic field if requested + if (v0Selections.rejectTPCsectorBoundary) { + // In case override, don't proceed, please - no CCDB access required + if (ccdbConfigurations.useCustomMagField) { + magField = ccdbConfigurations.customMagField; + } else { + grpmag = ccdb->getForRun(ccdbConfigurations.grpmagPath, mRunNumber); + if (!grpmag) { + LOG(fatal) << "Got nullptr from CCDB for path " << ccdbConfigurations.grpmagPath << " of object GRPMagField and " << ccdbConfigurations.grpPath << " of object GRPObject for run " << mRunNumber; + } + // Fetch magnetic field from ccdb for current collision + magField = std::lround(5.f * grpmag->getL3Current() / 30000.f); + LOG(info) << "Retrieved GRP for run " << mRunNumber << " with magnetic field of " << magField << " kZG"; + } + } + } + + double computePhiMod(double phi, int sign) + // Compute phi wrt to a TPC sector + // Calculation taken from CF: https://github.com/AliceO2Group/O2Physics/blob/376392cb87349886a300c75fa2492b50b7f46725/PWGCF/Flow/Tasks/flowAnalysisGF.cxx#L470 + { + if (magField < 0) // for negative polarity field + phi = TMath::TwoPi() - phi; + if (sign < 0) // for negative charge + phi = TMath::TwoPi() - phi; + if (phi < 0) + LOGF(warning, "phi < 0: %g", phi); + + phi += TMath::Pi() / 18.0; // to center gap in the middle + return fmod(phi, TMath::Pi() / 9.0); + } + + bool isTrackFarFromTPCBoundary(double trackPt, double trackPhi, int sign) + // check whether the track passes close to a TPC sector boundary + { + double phiModn = computePhiMod(trackPhi, sign); + if (phiModn > fPhiCutHigh->Eval(trackPt)) + return true; // keep track + if (phiModn < fPhiCutLow->Eval(trackPt)) + return true; // keep track + return false; // reject track } template @@ -1089,17 +1221,19 @@ struct derivedlambdakzeroanalysis { BITSET(bitMap, selNegGoodITSTrack); // TPC quality flags - if (posTrackExtra.tpcCrossedRows() >= v0Selections.minTPCrows && // check minimum TPC crossed rows - posTrackExtra.tpcChi2NCl() < v0Selections.maxTPCchi2PerNcls && // check maximum TPC chi2 per clusters - posTrackExtra.tpcCrossedRowsOverFindableCls() >= v0Selections.minTPCrowsOverFindableClusters && // check minimum fraction of TPC rows over findable - posTrackExtra.tpcFoundOverFindableCls() >= v0Selections.minTPCfoundOverFindableClusters && // check minimum fraction of found over findable TPC clusters - posTrackExtra.tpcFractionSharedCls() < v0Selections.maxFractionTPCSharedClusters) // check the maximum fraction of allowed shared TPC clusters + if (posTrackExtra.tpcCrossedRows() >= v0Selections.minTPCrows && // check minimum TPC crossed rows + posTrackExtra.tpcChi2NCl() < v0Selections.maxTPCchi2PerNcls && // check maximum TPC chi2 per clusters + posTrackExtra.tpcCrossedRowsOverFindableCls() >= v0Selections.minTPCrowsOverFindableClusters && // check minimum fraction of TPC rows over findable + posTrackExtra.tpcFoundOverFindableCls() >= v0Selections.minTPCfoundOverFindableClusters && // check minimum fraction of found over findable TPC clusters + posTrackExtra.tpcFractionSharedCls() < v0Selections.maxFractionTPCSharedClusters && // check the maximum fraction of allowed shared TPC clusters + (!v0Selections.rejectTPCsectorBoundary || isTrackFarFromTPCBoundary(v0.positivept(), v0.positivephi(), 1))) // reject track far from TPC sector boundary or not BITSET(bitMap, selPosGoodTPCTrack); - if (negTrackExtra.tpcCrossedRows() >= v0Selections.minTPCrows && // check minimum TPC crossed rows - negTrackExtra.tpcChi2NCl() < v0Selections.maxTPCchi2PerNcls && // check maximum TPC chi2 per clusters - negTrackExtra.tpcCrossedRowsOverFindableCls() >= v0Selections.minTPCrowsOverFindableClusters && // check minimum fraction of TPC rows over findable - negTrackExtra.tpcFoundOverFindableCls() >= v0Selections.minTPCfoundOverFindableClusters && // check minimum fraction of found over findable TPC clusters - negTrackExtra.tpcFractionSharedCls() < v0Selections.maxFractionTPCSharedClusters) // check the maximum fraction of allowed shared TPC clusters + if (negTrackExtra.tpcCrossedRows() >= v0Selections.minTPCrows && // check minimum TPC crossed rows + negTrackExtra.tpcChi2NCl() < v0Selections.maxTPCchi2PerNcls && // check maximum TPC chi2 per clusters + negTrackExtra.tpcCrossedRowsOverFindableCls() >= v0Selections.minTPCrowsOverFindableClusters && // check minimum fraction of TPC rows over findable + negTrackExtra.tpcFoundOverFindableCls() >= v0Selections.minTPCfoundOverFindableClusters && // check minimum fraction of found over findable TPC clusters + negTrackExtra.tpcFractionSharedCls() < v0Selections.maxFractionTPCSharedClusters && // check the maximum fraction of allowed shared TPC clusters + (!v0Selections.rejectTPCsectorBoundary || isTrackFarFromTPCBoundary(v0.negativept(), v0.negativephi(), -1))) // reject track far from TPC sector boundary or not BITSET(bitMap, selNegGoodTPCTrack); // TPC PID @@ -1157,9 +1291,9 @@ struct derivedlambdakzeroanalysis { BITSET(bitMap, selNegNotTPCOnly); // proper lifetime - if (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 < lifetimecut->get("lifetimecutLambda")) + if (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 < v0Selections.lifetimecut->get("lifetimecutLambda")) BITSET(bitMap, selLambdaCTau); - if (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecut->get("lifetimecutK0S")) + if (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < v0Selections.lifetimecut->get("lifetimecutK0S")) BITSET(bitMap, selK0ShortCTau); // armenteros @@ -1431,11 +1565,23 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("hV0Radius"), v0.v0radius()); histos.fill(HIST("h2dPositiveITSvsTPCpts"), posTrackExtra.tpcCrossedRows(), posTrackExtra.itsNCls()); histos.fill(HIST("h2dNegativeITSvsTPCpts"), negTrackExtra.tpcCrossedRows(), negTrackExtra.itsNCls()); + histos.fill(HIST("h2dPositivePtVsPhi"), v0.positivept(), computePhiMod(v0.positivephi(), 1)); + histos.fill(HIST("h2dNegativePtVsPhi"), v0.negativept(), computePhiMod(v0.negativephi(), -1)); + } + + // Fill first bin: all candidates + histos.fill(HIST("GeneralQA/hSelectionV0s"), 0); + // Loop over all bits in the enum and fill if passed + for (uint64_t i = 0; i <= selPhysPrimAntiLambda; i++) { + if (BITCHECK(selMap, i)) { + histos.fill(HIST("GeneralQA/hSelectionV0s"), i + 1); // +1 because bin 0 = "All" + } } // __________________________________________ // main analysis if (passK0ShortSelections && analyseK0Short) { + histos.fill(HIST("GeneralQA/hSelectionV0s"), selPhysPrimAntiLambda + 2); // histos.fill(HIST("GeneralQA/h2dArmenterosSelected"), v0.alpha(), v0.qtarm()); // cross-check histos.fill(HIST("h3dMassK0Short"), centrality, pt, v0.mK0Short()); if (gapSide == 0) @@ -1455,6 +1601,8 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("K0Short/hV0Radius"), v0.v0radius()); histos.fill(HIST("K0Short/h2dPositiveITSvsTPCpts"), posTrackExtra.tpcCrossedRows(), posTrackExtra.itsNCls()); histos.fill(HIST("K0Short/h2dNegativeITSvsTPCpts"), negTrackExtra.tpcCrossedRows(), negTrackExtra.itsNCls()); + histos.fill(HIST("K0Short/h2dPositivePtVsPhi"), v0.positivept(), computePhiMod(v0.positivephi(), 1)); + histos.fill(HIST("K0Short/h2dNegativePtVsPhi"), v0.negativept(), computePhiMod(v0.negativephi(), -1)); } if (doDetectPropQA == 1) { histos.fill(HIST("K0Short/h6dDetectPropVsCentrality"), centrality, posDetMap, posITSclusMap, negDetMap, negITSclusMap, pt); @@ -1511,12 +1659,13 @@ struct derivedlambdakzeroanalysis { } if (doEtaPhiQA) { histos.fill(HIST("K0Short/h5dV0PhiVsEta"), centrality, pt, v0.mK0Short(), v0.phi(), v0.eta()); - histos.fill(HIST("K0Short/h5dPosPhiVsNegPhi"), centrality, pt, v0.mK0Short(), v0.positivephi(), v0.negativephi()); - histos.fill(HIST("K0Short/h5dPosEtaVsNegEta"), centrality, pt, v0.mK0Short(), v0.positiveeta(), v0.negativeeta()); + histos.fill(HIST("K0Short/h5dPosPhiVsEta"), centrality, v0.positivept(), v0.mK0Short(), v0.positivephi(), v0.positiveeta()); + histos.fill(HIST("K0Short/h5dNegPhiVsEta"), centrality, v0.negativept(), v0.mK0Short(), v0.negativephi(), v0.negativeeta()); } nK0Shorts++; } if (passLambdaSelections && analyseLambda) { + histos.fill(HIST("GeneralQA/hSelectionV0s"), selPhysPrimAntiLambda + 2); // histos.fill(HIST("h3dMassLambda"), centrality, pt, v0.mLambda()); if (gapSide == 0) histos.fill(HIST("h3dMassLambdaSGA"), centrality, pt, v0.mLambda()); @@ -1526,6 +1675,7 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("h3dMassLambdaDG"), centrality, pt, v0.mLambda()); else histos.fill(HIST("h3dMassLambdaHadronic"), centrality, pt, v0.mLambda()); + histos.fill(HIST("hMassLambda"), v0.mLambda()); if (doPlainTopoQA) { histos.fill(HIST("Lambda/hPosDCAToPV"), v0.dcapostopv()); histos.fill(HIST("Lambda/hNegDCAToPV"), v0.dcanegtopv()); @@ -1534,6 +1684,8 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("Lambda/hV0Radius"), v0.v0radius()); histos.fill(HIST("Lambda/h2dPositiveITSvsTPCpts"), posTrackExtra.tpcCrossedRows(), posTrackExtra.itsNCls()); histos.fill(HIST("Lambda/h2dNegativeITSvsTPCpts"), negTrackExtra.tpcCrossedRows(), negTrackExtra.itsNCls()); + histos.fill(HIST("Lambda/h2dPositivePtVsPhi"), v0.positivept(), computePhiMod(v0.positivephi(), 1)); + histos.fill(HIST("Lambda/h2dNegativePtVsPhi"), v0.negativept(), computePhiMod(v0.negativephi(), -1)); } if (doDetectPropQA == 1) { histos.fill(HIST("Lambda/h6dDetectPropVsCentrality"), centrality, posDetMap, posITSclusMap, negDetMap, negITSclusMap, pt); @@ -1590,12 +1742,13 @@ struct derivedlambdakzeroanalysis { } if (doEtaPhiQA) { histos.fill(HIST("Lambda/h5dV0PhiVsEta"), centrality, pt, v0.mLambda(), v0.phi(), v0.eta()); - histos.fill(HIST("Lambda/h5dPosPhiVsNegPhi"), centrality, pt, v0.mLambda(), v0.positivephi(), v0.negativephi()); - histos.fill(HIST("Lambda/h5dPosEtaVsNegEta"), centrality, pt, v0.mLambda(), v0.positiveeta(), v0.negativeeta()); + histos.fill(HIST("Lambda/h5dPosPhiVsEta"), centrality, v0.positivept(), v0.mLambda(), v0.positivephi(), v0.positiveeta()); + histos.fill(HIST("Lambda/h5dNegPhiVsEta"), centrality, v0.negativept(), v0.mLambda(), v0.negativephi(), v0.negativeeta()); } nLambdas++; } if (passAntiLambdaSelections && analyseAntiLambda) { + histos.fill(HIST("GeneralQA/hSelectionV0s"), selPhysPrimAntiLambda + 2); // histos.fill(HIST("h3dMassAntiLambda"), centrality, pt, v0.mAntiLambda()); if (gapSide == 0) histos.fill(HIST("h3dMassAntiLambdaSGA"), centrality, pt, v0.mAntiLambda()); @@ -1605,6 +1758,7 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("h3dMassAntiLambdaDG"), centrality, pt, v0.mAntiLambda()); else histos.fill(HIST("h3dMassAntiLambdaHadronic"), centrality, pt, v0.mAntiLambda()); + histos.fill(HIST("hMassAntiLambda"), v0.mAntiLambda()); if (doPlainTopoQA) { histos.fill(HIST("AntiLambda/hPosDCAToPV"), v0.dcapostopv()); histos.fill(HIST("AntiLambda/hNegDCAToPV"), v0.dcanegtopv()); @@ -1613,6 +1767,8 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("AntiLambda/hV0Radius"), v0.v0radius()); histos.fill(HIST("AntiLambda/h2dPositiveITSvsTPCpts"), posTrackExtra.tpcCrossedRows(), posTrackExtra.itsNCls()); histos.fill(HIST("AntiLambda/h2dNegativeITSvsTPCpts"), negTrackExtra.tpcCrossedRows(), negTrackExtra.itsNCls()); + histos.fill(HIST("AntiLambda/h2dPositivePtVsPhi"), v0.positivept(), computePhiMod(v0.positivephi(), 1)); + histos.fill(HIST("AntiLambda/h2dNegativePtVsPhi"), v0.negativept(), computePhiMod(v0.negativephi(), -1)); } if (doDetectPropQA == 1) { histos.fill(HIST("AntiLambda/h6dDetectPropVsCentrality"), centrality, posDetMap, posITSclusMap, negDetMap, negITSclusMap, pt); @@ -1669,8 +1825,8 @@ struct derivedlambdakzeroanalysis { } if (doEtaPhiQA) { histos.fill(HIST("AntiLambda/h5dV0PhiVsEta"), centrality, pt, v0.mAntiLambda(), v0.phi(), v0.eta()); - histos.fill(HIST("AntiLambda/h5dPosPhiVsNegPhi"), centrality, pt, v0.mAntiLambda(), v0.positivephi(), v0.negativephi()); - histos.fill(HIST("AntiLambda/h5dPosEtaVsNegEta"), centrality, pt, v0.mAntiLambda(), v0.positiveeta(), v0.negativeeta()); + histos.fill(HIST("AntiLambda/h5dPosPhiVsEta"), centrality, v0.positivept(), v0.mAntiLambda(), v0.positivephi(), v0.positiveeta()); + histos.fill(HIST("AntiLambda/h5dNegPhiVsEta"), centrality, v0.negativept(), v0.mAntiLambda(), v0.negativephi(), v0.negativeeta()); } nAntiLambdas++; } @@ -2090,6 +2246,20 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("hEventCentrality"), centrality); histos.fill(HIST("hCentralityVsNch"), centrality, collision.multNTracksPVeta1()); + if (doEventQA) { + if constexpr (requires { collision.centFT0C(); }) { // check if we are in Run 3 + histos.fill(HIST("hCentralityVsNGlobal"), centrality, collision.multNTracksGlobal()); + histos.fill(HIST("hEventCentVsMultFT0M"), collision.centFT0M(), collision.multFT0A() + collision.multFT0C()); + histos.fill(HIST("hEventCentVsMultFT0C"), collision.centFT0C(), collision.multFT0C()); + histos.fill(HIST("hEventCentVsMultNGlobal"), collision.centNGlobal(), collision.multNTracksGlobal()); + histos.fill(HIST("hEventCentVsMultFV0A"), collision.centFV0A(), collision.multFV0A()); + histos.fill(HIST("hEventMultFT0MvsMultNGlobal"), collision.multFT0A() + collision.multFT0C(), collision.multNTracksGlobal()); + histos.fill(HIST("hEventMultFT0CvsMultNGlobal"), collision.multFT0C(), collision.multNTracksGlobal()); + histos.fill(HIST("hEventMultFV0AvsMultNGlobal"), collision.multFV0A(), collision.multNTracksGlobal()); + histos.fill(HIST("hEventMultPVvsMultNGlobal"), collision.multNTracksPVeta1(), collision.multNTracksGlobal()); + histos.fill(HIST("hEventMultFT0CvsMultFV0A"), collision.multFT0C(), collision.multFV0A()); + } + } histos.fill(HIST("hCentralityVsPVz"), centrality, collision.posZ()); histos.fill(HIST("hEventPVz"), collision.posZ()); @@ -2178,7 +2348,8 @@ struct derivedlambdakzeroanalysis { // Fire up CCDB if ((mlConfigurations.useK0ShortScores && mlConfigurations.calculateK0ShortScores) || (mlConfigurations.useLambdaScores && mlConfigurations.calculateLambdaScores) || - (mlConfigurations.useAntiLambdaScores && mlConfigurations.calculateAntiLambdaScores)) { + (mlConfigurations.useAntiLambdaScores && mlConfigurations.calculateAntiLambdaScores) || + v0Selections.rejectTPCsectorBoundary) { initCCDB(collision); } @@ -2246,7 +2417,8 @@ struct derivedlambdakzeroanalysis { // Fire up CCDB if ((mlConfigurations.useK0ShortScores && mlConfigurations.calculateK0ShortScores) || (mlConfigurations.useLambdaScores && mlConfigurations.calculateLambdaScores) || - (mlConfigurations.useAntiLambdaScores && mlConfigurations.calculateAntiLambdaScores)) { + (mlConfigurations.useAntiLambdaScores && mlConfigurations.calculateAntiLambdaScores) || + v0Selections.rejectTPCsectorBoundary) { initCCDB(collision); } @@ -2349,12 +2521,9 @@ struct derivedlambdakzeroanalysis { if (!v0MC.has_straMCCollision()) continue; - histos.fill(HIST("hPrimaryV0s"), 0); if (!v0MC.isPhysicalPrimary()) continue; - histos.fill(HIST("hPrimaryV0s"), 1); - float ptmc = v0MC.ptMC(); float ymc = 1e3; if (v0MC.pdgCode() == 310) From 0721182c557ed36b42874c8eafd215f6bcbb7ab6 Mon Sep 17 00:00:00 2001 From: kpradhan-kshitish <149397157+kpradhan-kshitish@users.noreply.github.com> Date: Thu, 4 Sep 2025 13:55:52 +0530 Subject: [PATCH 304/986] =?UTF-8?q?[PWGDQ]=20Added=20a=20loop=20in=20proce?= =?UTF-8?q?ssMCGen=20to=20fill=20generated=20pair=20histograms=20taking?= =?UTF-8?q?=E2=80=A6=20(#12801)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index 012f0c25490..8d15f3dd22f 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -2256,6 +2256,40 @@ struct AnalysisSameEventPairing { isig++; } } + // Fill Generated PAIR histograms taking into account selected collisions + for (auto& event : events) { + if (!event.isEventSelected_bit(0)) { + continue; + } + if (!event.has_reducedMCevent()) { + continue; + } + + if (fHasTwoProngGenMCsignals) { + for (auto& [t1, t2] : combinations(mcTracks, mcTracks)) { + if (t1.reducedMCeventId() != event.reducedMCeventId()) { + continue; + } + if (t2.reducedMCeventId() != event.reducedMCeventId()) { + continue; + } + auto t1_raw = mcTracks.rawIteratorAt(t1.globalIndex()); + auto t2_raw = mcTracks.rawIteratorAt(t2.globalIndex()); + if (t1_raw.reducedMCeventId() == t2_raw.reducedMCeventId()) { + for (auto& sig : fGenMCSignals) { + if (sig->GetNProngs() != 2) { // NOTE: 2-prong signals required here + continue; + } + if (sig->CheckSignal(true, t1_raw, t2_raw)) { + // mcDecision |= (static_cast(1) << isig); + VarManager::FillPairMC(t1, t2); // NOTE: This feature will only work for muons + fHistMan->FillHistClass(Form("MCTruthGenPairSel_%s", sig->GetName()), VarManager::fgValues); + } + } + } + } + } + } // end loop over reconstructed events } void processDummy(MyEvents&) From a3486b089b64c8b3494f24f262b584f8926fe92e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= <26327373+vkucera@users.noreply.github.com> Date: Thu, 4 Sep 2025 10:59:10 +0200 Subject: [PATCH 305/986] [PWGUD] Remove using directives from headers (#12849) --- PWGUD/Core/SGTrackSelector.h | 23 +++--- PWGUD/Core/UDHelpers.h | 36 ++++----- PWGUD/Core/UPCHelpers.h | 15 ++-- PWGUD/Core/UPCJpsiCentralBarrelCorrHelper.h | 10 +-- PWGUD/Core/UPCPairCuts.h | 48 +++++------ PWGUD/Core/decayTree.cxx | 11 +-- PWGUD/Core/decayTree.h | 89 ++++++++++----------- PWGUD/TableProducer/DGBCCandProducer.h | 8 +- 8 files changed, 114 insertions(+), 126 deletions(-) diff --git a/PWGUD/Core/SGTrackSelector.h b/PWGUD/Core/SGTrackSelector.h index 4288ef89e80..455eaf24ac1 100644 --- a/PWGUD/Core/SGTrackSelector.h +++ b/PWGUD/Core/SGTrackSelector.h @@ -16,21 +16,20 @@ #ifndef PWGUD_CORE_SGTRACKSELECTOR_H_ #define PWGUD_CORE_SGTRACKSELECTOR_H_ -#include -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" +#include "PWGUD/Core/SGSelector.h" +#include "PWGUD/DataModel/UDTables.h" + #include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" #include "Framework/O2DatabasePDGPlugin.h" -#include -#include "PWGUD/DataModel/UDTables.h" -#include "PWGUD/Core/SGSelector.h" -#include +#include "Framework/runDataProcessing.h" + #include "TVector3.h" -using namespace std; -using namespace o2; -using namespace o2::aod; -using namespace o2::framework; -using namespace o2::framework::expressions; +#include + +#include +#include + template int trackselector(const T& track, const std::vector& params) { diff --git a/PWGUD/Core/UDHelpers.h b/PWGUD/Core/UDHelpers.h index 4b692f7c5c1..a4137784ac5 100644 --- a/PWGUD/Core/UDHelpers.h +++ b/PWGUD/Core/UDHelpers.h @@ -16,22 +16,22 @@ #ifndef PWGUD_CORE_UDHELPERS_H_ #define PWGUD_CORE_UDHELPERS_H_ -#include -#include +#include "PWGUD/Core/DGCutparHolder.h" +#include "PWGUD/Core/UPCHelpers.h" -#include "TLorentzVector.h" -#include "Framework/Logger.h" -#include "DataFormatsFT0/Digit.h" -#include "DataFormatsFIT/Triggers.h" -#include "CommonConstants/LHCConstants.h" #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/PIDResponse.h" -#include "PWGUD/Core/UPCHelpers.h" -#include "PWGUD/Core/DGCutparHolder.h" +#include "Common/DataModel/TrackSelectionTables.h" -using namespace o2; -using namespace o2::framework; +#include "CommonConstants/LHCConstants.h" +#include "DataFormatsFIT/Triggers.h" +#include "DataFormatsFT0/Digit.h" +#include "Framework/Logger.h" + +#include "TLorentzVector.h" + +#include +#include // namespace with helpers for UD framework namespace udhelpers @@ -674,7 +674,7 @@ void fillBGBBFlags(upchelpers::FITInfo& info, uint64_t const& minbc, BCR const& // ----------------------------------------------------------------------------- // extract FIT information template -void getFITinfo(upchelpers::FITInfo& info, BC& bc, BCS const& bcs, aod::FT0s const& ft0s, aod::FV0As const& fv0as, aod::FDDs const& fdds) +void getFITinfo(upchelpers::FITInfo& info, BC& bc, BCS const& bcs, o2::aod::FT0s const& ft0s, o2::aod::FV0As const& fv0as, o2::aod::FDDs const& fdds) { // FV0A if (bc.has_foundFV0()) { @@ -713,24 +713,24 @@ void getFITinfo(upchelpers::FITInfo& info, BC& bc, BCS const& bcs, aod::FT0s con // ----------------------------------------------------------------------------- template -bool cleanZDC(T const& bc, aod::Zdcs& zdcs, std::vector& /*lims*/, SliceCache& cache) +bool cleanZDC(T const& bc, o2::aod::Zdcs& zdcs, std::vector& /*lims*/, o2::framework::SliceCache& cache) { - const auto& ZdcBC = zdcs.sliceByCached(aod::zdc::bcId, bc.globalIndex(), cache); + const auto& ZdcBC = zdcs.sliceByCached(o2::aod::zdc::bcId, bc.globalIndex(), cache); return (ZdcBC.size() == 0); } // ----------------------------------------------------------------------------- template -bool cleanCalo(T const& bc, aod::Calos& calos, std::vector& /*lims*/, SliceCache& cache) +bool cleanCalo(T const& bc, o2::aod::Calos& calos, std::vector& /*lims*/, o2::framework::SliceCache& cache) { - const auto& CaloBC = calos.sliceByCached(aod::calo::bcId, bc.globalIndex(), cache); + const auto& CaloBC = calos.sliceByCached(o2::aod::calo::bcId, bc.globalIndex(), cache); return (CaloBC.size() == 0); } // ----------------------------------------------------------------------------- // check if all tracks come from same MCCollision template -int64_t sameMCCollision(T tracks, aod::McCollisions, aod::McParticles) +int64_t sameMCCollision(T tracks, o2::aod::McCollisions, o2::aod::McParticles) { int64_t colID = -1; for (auto const& track : tracks) { diff --git a/PWGUD/Core/UPCHelpers.h b/PWGUD/Core/UPCHelpers.h index 03ff2475c8c..a7ca4b63af4 100644 --- a/PWGUD/Core/UPCHelpers.h +++ b/PWGUD/Core/UPCHelpers.h @@ -12,16 +12,17 @@ #ifndef PWGUD_CORE_UPCHELPERS_H_ #define PWGUD_CORE_UPCHELPERS_H_ -#include "Framework/AnalysisDataModel.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/CCDB/EventSelectionParams.h" -#include "CommonConstants/LHCConstants.h" -#include "TLorentzVector.h" #include "UPCCutparHolder.h" + #include "PWGUD/DataModel/UDTables.h" -using namespace o2::framework; -using namespace o2::framework::expressions; +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/DataModel/EventSelection.h" + +#include "CommonConstants/LHCConstants.h" +#include "Framework/AnalysisDataModel.h" + +#include "TLorentzVector.h" using BCsWithBcSels = o2::soa::Join; diff --git a/PWGUD/Core/UPCJpsiCentralBarrelCorrHelper.h b/PWGUD/Core/UPCJpsiCentralBarrelCorrHelper.h index 955601495e6..2a53f2f41f8 100644 --- a/PWGUD/Core/UPCJpsiCentralBarrelCorrHelper.h +++ b/PWGUD/Core/UPCJpsiCentralBarrelCorrHelper.h @@ -16,15 +16,11 @@ #ifndef PWGUD_CORE_UPCJPSICENTRALBARRELCORRHELPER_H_ #define PWGUD_CORE_UPCJPSICENTRALBARRELCORRHELPER_H_ -#include -#include #include "CommonConstants/MathConstants.h" -#include -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; -using namespace std; +#include +#include +#include /*enum ParticleType { P_ELECTRON = 0, diff --git a/PWGUD/Core/UPCPairCuts.h b/PWGUD/Core/UPCPairCuts.h index 6b0e37adca0..f53b419ffda 100644 --- a/PWGUD/Core/UPCPairCuts.h +++ b/PWGUD/Core/UPCPairCuts.h @@ -16,18 +16,14 @@ #ifndef PWGUD_CORE_UPCPAIRCUTS_H_ #define PWGUD_CORE_UPCPAIRCUTS_H_ -#include +#include "PWGUD/Core/UPCTauCentralBarrelHelperRL.h" -#include "Framework/Logger.h" -#include "Framework/HistogramRegistry.h" #include "CommonConstants/MathConstants.h" #include "CommonConstants/PhysicsConstants.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/Logger.h" -#include "PWGUD/Core/UPCTauCentralBarrelHelperRL.h" - -using namespace o2; -using namespace o2::framework; -using namespace constants::math; +#include class UPCPairCuts { @@ -39,14 +35,14 @@ class UPCPairCuts Rho, ParticlesLastEntry }; - void setHistogramRegistry(HistogramRegistry* registry) { histogramRegistry = registry; } + void setHistogramRegistry(o2::framework::HistogramRegistry* registry) { histogramRegistry = registry; } void setPairCut(Particle particle, float cut) { LOGF(info, "Enabled pair cut for %d with value %f", static_cast(particle), cut); mCuts[particle] = cut; if (histogramRegistry != nullptr && histogramRegistry->contains(HIST("ControlConvResonances")) == false) { - histogramRegistry->add("ControlConvResonances", "", {HistType::kTH2F, {{6, -0.5, 5.5, "id"}, {500, -0.5, 0.5, "delta mass"}}}); + histogramRegistry->add("ControlConvResonances", "", {o2::framework::HistType::kTH2F, {{6, -0.5, 5.5, "id"}, {500, -0.5, 0.5, "delta mass"}}}); } } @@ -57,7 +53,7 @@ class UPCPairCuts mTwoTrackRadius = radius; if (histogramRegistry != nullptr && histogramRegistry->contains(HIST("TwoTrackDistancePt_0")) == false) { - histogramRegistry->add("TwoTrackDistancePt_0", "", {HistType::kTH3F, {{100, -0.15, 0.15, "#Delta#eta"}, {100, -0.05, 0.05, "#Delta#varphi^{*}_{min}"}, {20, 0, 10, "#Delta p_{T}"}}}); + histogramRegistry->add("TwoTrackDistancePt_0", "", {o2::framework::HistType::kTH3F, {{100, -0.15, 0.15, "#Delta#eta"}, {100, -0.05, 0.05, "#Delta#varphi^{*}_{min}"}, {20, 0, 10, "#Delta p_{T}"}}}); histogramRegistry->addClone("TwoTrackDistancePt_0", "TwoTrackDistancePt_1"); } } @@ -74,7 +70,7 @@ class UPCPairCuts float mTwoTrackRadius = 0.8f; // radius at which the two track cuts are applied int magField = 5; // magField: B field in kG - HistogramRegistry* histogramRegistry = nullptr; // if set, control histograms are stored here + o2::framework::HistogramRegistry* histogramRegistry = nullptr; // if set, control histograms are stored here template bool conversionCut(T const& track1, T const& track2, Particle conv, double cut); @@ -290,20 +286,20 @@ double UPCPairCuts::getInvMassSquaredFast(T const& track1, double m0_1, T const& // fold onto 0...pi float deltaPhi = std::fabs(phi1 - phi2); - while (deltaPhi > TwoPI) { - deltaPhi -= TwoPI; + while (deltaPhi > o2::constants::math::TwoPI) { + deltaPhi -= o2::constants::math::TwoPI; } - if (deltaPhi > PI) { - deltaPhi = TwoPI - deltaPhi; + if (deltaPhi > o2::constants::math::PI) { + deltaPhi = o2::constants::math::TwoPI - deltaPhi; } float cosDeltaPhi = 0; - if (deltaPhi < PI / 3.0f) { + if (deltaPhi < o2::constants::math::PI / 3.0f) { cosDeltaPhi = 1.0 - deltaPhi * deltaPhi / 2 + deltaPhi * deltaPhi * deltaPhi * deltaPhi / 24; - } else if (deltaPhi < 2.0f * PI / 3.0f) { - cosDeltaPhi = -(deltaPhi - PI / 2) + 1.0 / 6 * std::pow((deltaPhi - PI / 2), 3); + } else if (deltaPhi < 2.0f * o2::constants::math::PI / 3.0f) { + cosDeltaPhi = -(deltaPhi - o2::constants::math::PI / 2) + 1.0 / 6 * std::pow((deltaPhi - o2::constants::math::PI / 2), 3); } else { - cosDeltaPhi = -1.0f + 1.0f / 2.0f * (deltaPhi - PI) * (deltaPhi - PI) - 1.0f / 24.0f * std::pow(deltaPhi - PI, 4.0f); + cosDeltaPhi = -1.0f + 1.0f / 2.0f * (deltaPhi - o2::constants::math::PI) * (deltaPhi - o2::constants::math::PI) - 1.0f / 24.0f * std::pow(deltaPhi - o2::constants::math::PI, 4.0f); } double mass2 = m0_1 * m0_1 + m0_2 * m0_2 + 2.0f * (std::sqrt(e1squ * e2squ) - (pt1 * pt2 * (cosDeltaPhi + 1.0f / tantheta1 / tantheta2))); @@ -330,14 +326,14 @@ float UPCPairCuts::getDPhiStar(T const& track1, T const& track2, float radius, i float dphistar = phi1 - phi2 - charge1 * std::asin(0.015 * magField * radius / pt1) + charge2 * std::asin(0.015 * magField * radius / pt2); - if (dphistar > PI) { - dphistar = TwoPI - dphistar; + if (dphistar > o2::constants::math::PI) { + dphistar = o2::constants::math::TwoPI - dphistar; } - if (dphistar < -PI) { - dphistar = -TwoPI - dphistar; + if (dphistar < -o2::constants::math::PI) { + dphistar = -o2::constants::math::TwoPI - dphistar; } - if (dphistar > PI) { // might look funny but is needed - dphistar = TwoPI - dphistar; + if (dphistar > o2::constants::math::PI) { // might look funny but is needed + dphistar = o2::constants::math::TwoPI - dphistar; } return dphistar; diff --git a/PWGUD/Core/decayTree.cxx b/PWGUD/Core/decayTree.cxx index 026c77af706..ed05772364e 100644 --- a/PWGUD/Core/decayTree.cxx +++ b/PWGUD/Core/decayTree.cxx @@ -9,16 +9,17 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include +#include "decayTree.h" + +#include +#include + #include #include #include +#include #include -#include "rapidjson/document.h" -#include "rapidjson/filereadstream.h" -#include "decayTree.h" - using namespace rapidjson; // ----------------------------------------------------------------------------- diff --git a/PWGUD/Core/decayTree.h b/PWGUD/Core/decayTree.h index 3dd4f53578b..59421098605 100644 --- a/PWGUD/Core/decayTree.h +++ b/PWGUD/Core/decayTree.h @@ -12,21 +12,18 @@ #ifndef PWGUD_CORE_DECAYTREE_H_ #define PWGUD_CORE_DECAYTREE_H_ -#include -#include -#include -#include - #include "Framework/AnalysisTask.h" -#include "Framework/O2DatabasePDGPlugin.h" #include "Framework/HistogramRegistry.h" #include "Framework/Logger.h" -#include "TLorentzVector.h" +#include "Framework/O2DatabasePDGPlugin.h" + #include "TDatabasePDG.h" +#include "TLorentzVector.h" -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; +#include +#include +#include +#include // ----------------------------------------------------------------------------- class pidSelector @@ -463,7 +460,7 @@ class decayTree // setters // read decay tree from json file - bool init(std::string const& filename, HistogramRegistry& registry); + bool init(std::string const& filename, o2::framework::HistogramRegistry& registry); // reset status of all resonances to 0 void reset(); @@ -765,7 +762,7 @@ class decayTree std::vector fccs; std::vector fdets; std::vector fparts; - std::map fhistPointers; + std::map fhistPointers; // generate parent information for all resonances void updateParents(); @@ -834,25 +831,25 @@ class decayTree } // create histograms - void createHistograms(HistogramRegistry& registry) + void createHistograms(o2::framework::HistogramRegistry& registry) { // definitions - auto etax = AxisSpec(100, -1.5, 1.5); - auto nSax = AxisSpec(300, -15.0, 15.0); - auto chi2ax = AxisSpec(100, 0.0, 5.0); - auto nClax = AxisSpec(170, 0.0, 170.0); - auto angax = AxisSpec(315, 0.0, 3.15); - auto dcaxyax = AxisSpec(400, -0.2, 0.2); - auto dcazax = AxisSpec(600, -0.3, 0.3); - auto sTPCax = AxisSpec(1000, 0., 1000.); + auto etax = o2::framework::AxisSpec(100, -1.5, 1.5); + auto nSax = o2::framework::AxisSpec(300, -15.0, 15.0); + auto chi2ax = o2::framework::AxisSpec(100, 0.0, 5.0); + auto nClax = o2::framework::AxisSpec(170, 0.0, 170.0); + auto angax = o2::framework::AxisSpec(315, 0.0, 3.15); + auto dcaxyax = o2::framework::AxisSpec(400, -0.2, 0.2); + auto dcazax = o2::framework::AxisSpec(600, -0.3, 0.3); + auto sTPCax = o2::framework::AxisSpec(1000, 0., 1000.); std::string base; std::string hname; std::string annot; fhistPointers.clear(); for (const auto& res : getResonances()) { - auto max = AxisSpec(res->nmassBins(), res->massHistRange()[0], res->massHistRange()[1]); - auto momax = AxisSpec(res->nmomBins(), res->momHistRange()[0], res->momHistRange()[1]); + auto max = o2::framework::AxisSpec(res->nmassBins(), res->massHistRange()[0], res->massHistRange()[1]); + auto momax = o2::framework::AxisSpec(res->nmomBins(), res->momHistRange()[0], res->momHistRange()[1]); // M-pT, M-eta, pT-eta for (const auto& cc : fccs) { @@ -860,13 +857,13 @@ class decayTree base.append("/").append(res->name()).append("/"); hname = base + "mpt"; annot = "M versus pT; M (" + res->name() + ") GeV/c^{2}; pT (" + res->name() + ") GeV/c"; - fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {HistType::kTH2F, {max, momax}})}); + fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, momax}})}); hname = base + "meta"; annot = "M versus eta; M (" + res->name() + ") GeV/c^{2}; eta (" + res->name() + ")"; - fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {HistType::kTH2F, {max, etax}})}); + fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, etax}})}); hname = base + "pteta"; annot = "pT versus eta; pT (" + res->name() + ") GeV/c; eta (" + res->name() + ")"; - fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {HistType::kTH2F, {momax, etax}})}); + fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {momax, etax}})}); // M versus daughters auto daughs = res->getDaughters(); @@ -878,85 +875,85 @@ class decayTree hname = base; hname.append("MvspT_").append(res->name()).append(d1->name()); annot = "M versus pT; M (" + res->name() + ") GeV/c^{2}; pT (" + d1->name() + ") GeV/c"; - auto momax1 = AxisSpec(d1->nmomBins(), d1->momHistRange()[0], d1->momHistRange()[1]); - fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {HistType::kTH2F, {max, momax1}})}); + auto momax1 = o2::framework::AxisSpec(d1->nmomBins(), d1->momHistRange()[0], d1->momHistRange()[1]); + fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, momax1}})}); // M vs eta daughter hname = base; hname.append("Mvseta_").append(res->name()).append(d1->name()); annot = "M versus eta; M (" + res->name() + ") GeV/c^{2}; eta (" + d1->name() + ")"; - fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {HistType::kTH2F, {max, etax}})}); + fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, etax}})}); if (d1->isFinal()) { // M vs dcaXYZ hname = base; hname.append("MvsdcaXY_").append(res->name()).append(d1->name()); annot = "M versus dcaXY; M (" + res->name() + ") GeV/c^{2}; dca_{XY} (" + d1->name() + ") #mu m"; - fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {HistType::kTH2F, {max, dcaxyax}})}); + fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, dcaxyax}})}); hname = base; hname.append("MvsdcaZ_").append(res->name()).append(d1->name()); annot = "M versus dcaZ; M (" + res->name() + ") GeV/c^{2}; dca_{Z} (" + d1->name() + ") #mu m"; - fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {HistType::kTH2F, {max, dcazax}})}); + fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, dcazax}})}); // M vs chi2 track hname = base; hname.append("Mvschi2_").append(res->name()).append(d1->name()); annot = "M versus chi2; M (" + res->name() + ") GeV/c^{2}; chi2 (" + d1->name() + ")"; - fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {HistType::kTH2F, {max, chi2ax}})}); + fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, chi2ax}})}); // M vs nCl track hname = base; hname.append("MvsnCl_").append(res->name()).append(d1->name()); annot = "M versus nCl; M (" + res->name() + ") GeV/c^{2}; nCl (" + d1->name() + ")"; - fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {HistType::kTH2F, {max, nClax}})}); + fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, nClax}})}); // M versus detector hits hname = base; hname.append("MvsdetHits_").append(res->name()).append(d1->name()); annot = "M versus detector hits; M (" + res->name() + ") GeV/c^{2}; ITS + 2*TPC + 4*TRD + 8*TOF (" + d1->name() + ")"; - fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {HistType::kTH2F, {max, {16, -0.5, 15.5}}})}); + fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, {16, -0.5, 15.5}}})}); } else { // M vs Mi hname = base; hname.append("MvsM_").append(res->name()).append(d1->name()); annot = "M versus M; M (" + res->name() + ") GeV/c^{2}; M (" + d1->name() + ") GeV/c^{2}"; - auto max1 = AxisSpec(res->nmassBins(), d1->massHistRange()[0], d1->massHistRange()[1]); - fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {HistType::kTH2F, {max, max1}})}); + auto max1 = o2::framework::AxisSpec(res->nmassBins(), d1->massHistRange()[0], d1->massHistRange()[1]); + fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, max1}})}); } } // daughters vs daughters for (auto i = 0; i < static_cast(ndaughs - 1); i++) { auto d1 = getResonance(daughs[i]); - auto max1 = AxisSpec(d1->nmassBins(), d1->massHistRange()[0], d1->massHistRange()[1]); + auto max1 = o2::framework::AxisSpec(d1->nmassBins(), d1->massHistRange()[0], d1->massHistRange()[1]); for (auto j = i + 1; j < static_cast(ndaughs); j++) { auto d2 = getResonance(daughs[j]); - auto max2 = AxisSpec(d2->nmassBins(), d2->massHistRange()[0], d2->massHistRange()[1]); + auto max2 = o2::framework::AxisSpec(d2->nmassBins(), d2->massHistRange()[0], d2->massHistRange()[1]); // M1 vs M2 hname = base; hname.append("MvsM_").append(d1->name()).append(d2->name()); annot = std::string("M versus M; M (").append(d1->name()).append(") GeV/c^{2}; M (").append(d2->name()).append(") GeV/c^{2}"); - fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {HistType::kTH2F, {max1, max2}})}); + fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max1, max2}})}); // angle(d1, d2) hname = base; hname.append("angle_").append(d1->name()).append(d2->name()); annot = std::string("angle; Angle (").append(d1->name()).append(", ").append(d2->name()).append(")"); - fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {HistType::kTH1F, {angax}})}); + fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH1F, {angax}})}); // M vs angle(d1, d2) hname = base; hname.append("Mvsangle_").append(d1->name()).append(d2->name()); annot = std::string("M versus angle; M (").append(res->name()).append(") GeV/c^{2}; Angle (").append(d1->name()).append(", ").append(d2->name()).append(")"); - fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {HistType::kTH2F, {max, angax}})}); + fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {max, angax}})}); // both daughters are finals if (d1->isFinal() && d2->isFinal()) { hname = base; hname.append("TPCsignal_").append(d1->name()).append(d2->name()); annot = std::string("TPC signal of both tracks; TPCsignal (").append(d1->name()).append("); TPCsignal (").append(d2->name()).append(")"); - fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {HistType::kTH2F, {sTPCax, sTPCax}})}); + fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {sTPCax, sTPCax}})}); } } } @@ -967,11 +964,11 @@ class decayTree hname = base; hname.append("dcaXY"); annot = std::string("dcaXY; dca_{XY}(").append(res->name()).append(")"); - fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {HistType::kTH1F, {dcaxyax}})}); + fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH1F, {dcaxyax}})}); hname = base; hname.append("dcaZ"); annot = std::string("dcaZ; dca_{Z}(").append(res->name()).append(")"); - fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {HistType::kTH1F, {dcazax}})}); + fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH1F, {dcazax}})}); // nSIgma[TPC, TOF] vs pT for (const auto& det : fdets) { @@ -979,7 +976,7 @@ class decayTree hname = base; hname.append("nS").append(part).append(det); annot = std::string("nSigma_").append(det).append(" versus p; p (").append(res->name()).append(") GeV/c; nSigma_{").append(det).append(", ").append(part).append("} (").append(res->name()).append(")"); - fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {HistType::kTH2F, {momax, nSax}})}); + fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH2F, {momax, nSax}})}); } } @@ -987,7 +984,7 @@ class decayTree hname = base; hname.append("detectorHits"); annot = std::string("detectorHits; Detector(").append(res->name()).append(")"); - fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {HistType::kTH1F, {{4, 0.5, 4.5}}})}); + fhistPointers.insert({hname, registry.add(hname.c_str(), annot.c_str(), {o2::framework::HistType::kTH1F, {{4, 0.5, 4.5}}})}); } } } diff --git a/PWGUD/TableProducer/DGBCCandProducer.h b/PWGUD/TableProducer/DGBCCandProducer.h index 07717afbfde..5bdc09498c6 100644 --- a/PWGUD/TableProducer/DGBCCandProducer.h +++ b/PWGUD/TableProducer/DGBCCandProducer.h @@ -16,15 +16,13 @@ #ifndef PWGUD_TABLEPRODUCER_DGBCCANDPRODUCER_H_ #define PWGUD_TABLEPRODUCER_DGBCCANDPRODUCER_H_ -#include -#include #include "Framework/ASoA.h" #include "Framework/AnalysisDataModel.h" -#include "MathUtils/Utils.h" #include "Framework/DataTypes.h" +#include "MathUtils/Utils.h" -using namespace o2; -using namespace o2::framework; +#include +#include namespace o2::aod { From a2a0a8973604043f79e3ba22c9a71925f894622d Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Thu, 4 Sep 2025 12:38:32 +0200 Subject: [PATCH 306/986] [PWGCF] FemtoUNiverse: Add int8_t casting of configurables for sign in partitioning (#12851) Co-authored-by: ALICE Action Bot --- ...ersePairTaskTrackTrack3DMultKtExtended.cxx | 47 ++++++++++--------- ...irTaskTrackTrackSpherHarMultKtExtended.cxx | 8 ++-- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx index f5c6242f456..78446cdd2ae 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx @@ -14,30 +14,33 @@ /// \remark This file is inherited from ~/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMultKtExtended.cxx on 10/01/2024 /// \author Pritam Chakraborty, WUT Warsaw, pritam.chakraborty@pw.edu.pl -#include -#include -#include "TRandom2.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverse3DContainer.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseContainer.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniversePairCleaner.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniversePairWithCentMultKt.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h" +#include "PWGCF/FemtoUniverse/Core/femtoUtils.h" +#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" + +#include "Common/DataModel/PIDResponse.h" + +#include "Framework/ASoAHelpers.h" #include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" #include "Framework/HistogramRegistry.h" -#include "Framework/ASoAHelpers.h" +#include "Framework/O2DatabasePDGPlugin.h" #include "Framework/RunningWorkflowInfo.h" #include "Framework/StepTHn.h" -#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/PID.h" -#include "Common/DataModel/PIDResponse.h" -#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniversePairCleaner.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverse3DContainer.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseContainer.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h" -#include "PWGCF/FemtoUniverse/Core/femtoUtils.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniversePairWithCentMultKt.h" +#include "TRandom2.h" + +#include +#include using namespace o2; using namespace o2::analysis::femto_universe; @@ -98,9 +101,9 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended { } trackonefilter; /// Partition for particle 1 - Partition partsOne = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && aod::femtouniverseparticle::sign == trackonefilter.ConfChargePart1 && aod::femtouniverseparticle::pt < trackonefilter.ConfPtHighPart1 && aod::femtouniverseparticle::pt > trackonefilter.ConfPtLowPart1; + Partition partsOne = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && aod::femtouniverseparticle::sign == as(trackonefilter.ConfChargePart1) && aod::femtouniverseparticle::pt < trackonefilter.ConfPtHighPart1 && aod::femtouniverseparticle::pt > trackonefilter.ConfPtLowPart1; - Partition partsOneMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && aod::femtouniverseparticle::sign == trackonefilter.ConfChargePart1 && aod::femtouniverseparticle::pt < trackonefilter.ConfPtHighPart1 && aod::femtouniverseparticle::pt > trackonefilter.ConfPtLowPart1; + Partition partsOneMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && aod::femtouniverseparticle::sign == as(trackonefilter.ConfChargePart1) && aod::femtouniverseparticle::pt < trackonefilter.ConfPtHighPart1 && aod::femtouniverseparticle::pt > trackonefilter.ConfPtLowPart1; // /// Histogramming for particle 1 @@ -118,9 +121,9 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended { } tracktwofilter; /// Partition for particle 2 - Partition partsTwo = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == tracktwofilter.ConfChargePart2) && aod::femtouniverseparticle::pt < tracktwofilter.ConfPtHighPart2 && aod::femtouniverseparticle::pt > tracktwofilter.ConfPtLowPart2; + Partition partsTwo = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == as(tracktwofilter.ConfChargePart2)) && aod::femtouniverseparticle::pt < tracktwofilter.ConfPtHighPart2 && aod::femtouniverseparticle::pt > tracktwofilter.ConfPtLowPart2; - Partition partsTwoMC = aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack) && (aod::femtouniverseparticle::sign == tracktwofilter.ConfChargePart2) && aod::femtouniverseparticle::pt < tracktwofilter.ConfPtHighPart2 && aod::femtouniverseparticle::pt > tracktwofilter.ConfPtLowPart2; + Partition partsTwoMC = aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack) && (aod::femtouniverseparticle::sign == as(tracktwofilter.ConfChargePart2)) && aod::femtouniverseparticle::pt < tracktwofilter.ConfPtHighPart2 && aod::femtouniverseparticle::pt > tracktwofilter.ConfPtLowPart2; /// Histogramming for particle 2 FemtoUniverseParticleHisto trackHistoPartTwo; diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx index 2ea687a3ed6..d9bdee9c7a6 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx @@ -111,8 +111,8 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { } trackonefilter; /// Partition for particle 1 - Partition partsOne = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && aod::femtouniverseparticle::sign == trackonefilter.ConfChargePart1 && aod::femtouniverseparticle::pt < trackonefilter.ConfPtHighPart1 && aod::femtouniverseparticle::pt > trackonefilter.ConfPtLowPart1; - Partition partsOneMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && aod::femtouniverseparticle::sign == trackonefilter.ConfChargePart1 && aod::femtouniverseparticle::pt < trackonefilter.ConfPtHighPart1 && aod::femtouniverseparticle::pt > trackonefilter.ConfPtLowPart1; + Partition partsOne = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && aod::femtouniverseparticle::sign == as(trackonefilter.ConfChargePart1) && aod::femtouniverseparticle::pt < trackonefilter.ConfPtHighPart1 && aod::femtouniverseparticle::pt > trackonefilter.ConfPtLowPart1; + Partition partsOneMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && aod::femtouniverseparticle::sign == as(trackonefilter.ConfChargePart1) && aod::femtouniverseparticle::pt < trackonefilter.ConfPtHighPart1 && aod::femtouniverseparticle::pt > trackonefilter.ConfPtLowPart1; // /// Histogramming for particle 1 @@ -130,8 +130,8 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { } tracktwofilter; /// Partition for particle 2 - Partition partsTwo = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == tracktwofilter.ConfChargePart2) && aod::femtouniverseparticle::pt < tracktwofilter.ConfPtHighPart2 && aod::femtouniverseparticle::pt > tracktwofilter.ConfPtLowPart2; - Partition partsTwoMC = aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack) && (aod::femtouniverseparticle::sign == tracktwofilter.ConfChargePart2) && aod::femtouniverseparticle::pt < tracktwofilter.ConfPtHighPart2 && aod::femtouniverseparticle::pt > tracktwofilter.ConfPtLowPart2; + Partition partsTwo = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == as(tracktwofilter.ConfChargePart2)) && aod::femtouniverseparticle::pt < tracktwofilter.ConfPtHighPart2 && aod::femtouniverseparticle::pt > tracktwofilter.ConfPtLowPart2; + Partition partsTwoMC = aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack) && (aod::femtouniverseparticle::sign == as(tracktwofilter.ConfChargePart2)) && aod::femtouniverseparticle::pt < tracktwofilter.ConfPtHighPart2 && aod::femtouniverseparticle::pt > tracktwofilter.ConfPtLowPart2; /// Histogramming for particle 2 FemtoUniverseParticleHisto trackHistoPartTwo; From fadd22f6ece0f732ef55e8c0a244cf50e78ff8fa Mon Sep 17 00:00:00 2001 From: blacwovie Date: Thu, 4 Sep 2025 20:17:28 +0800 Subject: [PATCH 307/986] [PWGLF] add new table for Hypertiton collision ID (#12824) Co-authored-by: blacw Co-authored-by: ALICE Action Bot --- PWGLF/DataModel/LFHypernucleiTables.h | 18 ++++++++++ PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx | 37 +++++++++++++++++--- 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/PWGLF/DataModel/LFHypernucleiTables.h b/PWGLF/DataModel/LFHypernucleiTables.h index f0f37bf4d86..6b10a7ddd9f 100644 --- a/PWGLF/DataModel/LFHypernucleiTables.h +++ b/PWGLF/DataModel/LFHypernucleiTables.h @@ -34,6 +34,7 @@ DECLARE_SOA_COLUMN(QFT0C, qFT0C, float); // Amplitude with FT0 DECLARE_SOA_COLUMN(MultFT0C, multFT0C, float); // Multiplicity with FT0C estimator DECLARE_SOA_COLUMN(PsiTPC, psiTPC, float); // Psi with TPC estimator DECLARE_SOA_COLUMN(MultTPC, multTPC, float); // Multiplicity with TPC estimator +DECLARE_SOA_COLUMN(CollisionId, collisionId, int64_t); // CollisionID DECLARE_SOA_COLUMN(IsMatter, isMatter, bool); // bool: true for matter DECLARE_SOA_COLUMN(PtHe3, ptHe3, float); // Pt of the He daughter @@ -147,9 +148,26 @@ DECLARE_SOA_TABLE(MCHypCands, "AOD", "MCHYPCANDS", hyperrec::IsRecoMCCollision, hyperrec::IsSurvEvSel); +DECLARE_SOA_TABLE(DataHypCandsWColl, "AOD", "HYPCANDSWCOLL", + o2::soa::Index<>, + hyperrec::CollisionId, hyperrec::CentralityFT0A, hyperrec::CentralityFT0C, hyperrec::CentralityFT0M, + hyperrec::XPrimVtx, hyperrec::YPrimVtx, hyperrec::ZPrimVtx, + + hyperrec::IsMatter, + hyperrec::PtHe3, hyperrec::PhiHe3, hyperrec::EtaHe3, + hyperrec::PtPi, hyperrec::PhiPi, hyperrec::EtaPi, + hyperrec::XDecVtx, hyperrec::YDecVtx, hyperrec::ZDecVtx, + hyperrec::DcaV0Daug, hyperrec::DcaHe, hyperrec::DcaPi, + hyperrec::NSigmaHe, hyperrec::NTPCclusHe, hyperrec::NTPCclusPi, hyperrec::NTPCpidClusHe, hyperrec::NTPCpidClusPi, + hyperrec::TPCmomHe, hyperrec::TPCmomPi, hyperrec::TPCsignalHe, hyperrec::TPCsignalPi, hyperrec::TPCChi2He, hyperrec::ITSChi2He, hyperrec::ITSChi2Pi, + hyperrec::TOFMass, + hyperrec::ITSclusterSizesHe, hyperrec::ITSclusterSizesPi, + hyperrec::Flags, hyperrec::TrackedClSize); + using DataHypCand = DataHypCands::iterator; using DataHypCandFlow = DataHypCandsFlow::iterator; using MCHypCand = MCHypCands::iterator; +using DataHypCandWColl = DataHypCandsWColl::iterator; namespace hyperkink { diff --git a/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx b/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx index e93828980b1..ebe45137da0 100644 --- a/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx @@ -91,7 +91,7 @@ struct hyperCandidate { float genPhi() const { return std::atan2(gMom[1], gMom[0]); } float genEta() const { return std::asinh(gMom[2] / genPt()); } - int v0ID; + int v0ID = -1; int heTrackID; int piTrackID; float dcaV0dau = -10; @@ -121,7 +121,7 @@ struct hyperCandidate { uint32_t clusterSizeITSPi = 0u; // collision information - unsigned int collisionID = 0; + int64_t collisionID = 0; bool isMatter = false; bool isSignal = false; // true MC signal @@ -137,6 +137,7 @@ struct hyperRecoTask { Produces outputDataTable; Produces outputDataTableWithFlow; Produces outputMCTable; + Produces outputDataTableWithCollID; Service ccdb; Zorro zorro; OutputObj zorroSummary{"zorroSummary"}; @@ -409,10 +410,10 @@ struct hyperRecoTask { hypCand.nSigmaHe3 = computeNSigmaHe3(heTrack); hypCand.nTPCClustersHe3 = heTrack.tpcNClsFound(); hypCand.tpcSignalHe3 = heTrack.tpcSignal(); - hypCand.nTPCpidClusHe3 = (int16_t)heTrack.tpcNClsFindable() - heTrack.tpcNClsFindableMinusPID(); + hypCand.nTPCpidClusHe3 = static_cast(heTrack.tpcNClsFindable()) - heTrack.tpcNClsFindableMinusPID(); hypCand.clusterSizeITSHe3 = heTrack.itsClusterSizes(); hypCand.nTPCClustersPi = piTrack.tpcNClsFound(); - hypCand.nTPCpidClusPi = (int16_t)piTrack.tpcNClsFindable() - piTrack.tpcNClsFindableMinusPID(); + hypCand.nTPCpidClusPi = static_cast(piTrack.tpcNClsFindable()) - piTrack.tpcNClsFindableMinusPID(); hypCand.tpcSignalPi = piTrack.tpcSignal(); hypCand.tpcChi2He3 = heTrack.tpcChi2NCl(); hypCand.itsChi2He3 = heTrack.itsChi2NCl(); @@ -733,6 +734,34 @@ struct hyperRecoTask { } PROCESS_SWITCH(hyperRecoTask, processDataWithFlow, "Data analysis with flow", false); + void processDataWithCollID(CollisionsFull const& collisions, aod::V0s const& V0s, TracksFull const& tracks, aod::AmbiguousTracks const& ambiTracks, aod::BCsWithTimestamps const& bcs) + { + goodCollision.clear(); + goodCollision.resize(collisions.size(), false); + hyperCandidates.clear(); + + selectGoodCollisions(collisions); + useCustomVertexer ? fillCustomV0s(collisions, tracks, ambiTracks, bcs) : fillV0s(collisions, tracks, V0s); + + for (auto& hypCand : hyperCandidates) { + auto collision = collisions.rawIteratorAt(hypCand.collisionID); + float trackedHypClSize = !trackedClSize.empty() ? trackedClSize[hypCand.v0ID] : 0; + outputDataTableWithCollID(hypCand.collisionID, collision.centFT0A(), collision.centFT0C(), collision.centFT0M(), + collision.posX(), collision.posY(), collision.posZ(), + hypCand.isMatter, + hypCand.recoPtHe3(), hypCand.recoPhiHe3(), hypCand.recoEtaHe3(), + hypCand.recoPtPi(), hypCand.recoPhiPi(), hypCand.recoEtaPi(), + hypCand.decVtx[0], hypCand.decVtx[1], hypCand.decVtx[2], + hypCand.dcaV0dau, hypCand.he3DCAXY, hypCand.piDCAXY, + hypCand.nSigmaHe3, hypCand.nTPCClustersHe3, hypCand.nTPCClustersPi, + hypCand.nTPCpidClusHe3, hypCand.nTPCpidClusPi, + hypCand.momHe3TPC, hypCand.momPiTPC, hypCand.tpcSignalHe3, hypCand.tpcSignalPi, hypCand.tpcChi2He3, hypCand.itsChi2He3, hypCand.itsChi2Pi, + hypCand.massTOFHe3, + hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags, trackedHypClSize); + } + } + PROCESS_SWITCH(hyperRecoTask, processDataWithCollID, "Data analysis with collision ID", false); + void processMC(CollisionsFullMC const& collisions, aod::McCollisions const& mcCollisions, aod::V0s const& V0s, TracksFull const& tracks, aod::AmbiguousTracks const& ambiTracks, aod::BCsWithTimestamps const& bcs, aod::McTrackLabels const& trackLabelsMC, aod::McParticles const& particlesMC) { filledMothers.clear(); From fbfa10aedab2434ccfa885d7eeb05019fedc75ac Mon Sep 17 00:00:00 2001 From: alcaliva <32872606+alcaliva@users.noreply.github.com> Date: Thu, 4 Sep 2025 15:22:50 +0200 Subject: [PATCH 308/986] [PWGLF] Replaced the loop over all MC particles with a loop over pre-filtered strange hadrons (#12862) --- PWGLF/Tasks/Strangeness/strangenessInJets.cxx | 68 +++++++++++-------- 1 file changed, 39 insertions(+), 29 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/strangenessInJets.cxx b/PWGLF/Tasks/Strangeness/strangenessInJets.cxx index 847c6421e54..d909030b2d7 100644 --- a/PWGLF/Tasks/Strangeness/strangenessInJets.cxx +++ b/PWGLF/Tasks/Strangeness/strangenessInJets.cxx @@ -1002,6 +1002,10 @@ struct StrangenessInJets { // MC particles per collision auto mcParticlesPerColl = mcParticles.sliceBy(perMCCollision, collision.globalIndex()); + // Store strange hadron pdg code and momentum + std::vector pdg; + std::vector strHadronMomentum; + // Loop over all MC particles and select physical primaries within acceptance std::vector fjParticles; for (const auto& particle : mcParticlesPerColl) { @@ -1016,6 +1020,13 @@ struct StrangenessInJets { fastjet::PseudoJet fourMomentum(particle.px(), particle.py(), particle.pz(), energy); fourMomentum.set_user_index(particle.pdgCode()); fjParticles.emplace_back(fourMomentum); + + // Store properties of strange hadrons + int pdgAbs = std::abs(particle.pdgCode()); + if (pdgAbs == kK0Short || pdgAbs == kLambda0 || pdgAbs == kXiMinus || pdgAbs == kOmegaMinus) { + pdg.emplace_back(particle.pdgCode()); + strHadronMomentum.emplace_back(particle.px(), particle.py(), particle.pz()); + } } // Skip events with no particles @@ -1055,48 +1066,47 @@ struct StrangenessInJets { getPerpendicularAxis(jetAxis, ueAxis1, +1); getPerpendicularAxis(jetAxis, ueAxis2, -1); - // Loop over MC particles - for (const auto& particle : mcParticlesPerColl) { - if (!particle.isPhysicalPrimary()) - continue; - double minPtParticle = 0.1; - if (particle.eta() < etaMin || particle.eta() > etaMax || particle.pt() < minPtParticle) - continue; + // Loop over strange hadrons + int index = -1; + for (const auto& hadron : strHadronMomentum) { + + // Particle index + index++; // Compute distance of particles from jet and UE axes - double deltaEtaJet = particle.eta() - jetAxis.Eta(); - double deltaPhiJet = getDeltaPhi(particle.phi(), jetAxis.Phi()); + double deltaEtaJet = hadron.Eta() - jetAxis.Eta(); + double deltaPhiJet = getDeltaPhi(hadron.Phi(), jetAxis.Phi()); double deltaRJet = std::sqrt(deltaEtaJet * deltaEtaJet + deltaPhiJet * deltaPhiJet); - double deltaEtaUe1 = particle.eta() - ueAxis1.Eta(); - double deltaPhiUe1 = getDeltaPhi(particle.phi(), ueAxis1.Phi()); + double deltaEtaUe1 = hadron.Eta() - ueAxis1.Eta(); + double deltaPhiUe1 = getDeltaPhi(hadron.Phi(), ueAxis1.Phi()); double deltaRUe1 = std::sqrt(deltaEtaUe1 * deltaEtaUe1 + deltaPhiUe1 * deltaPhiUe1); - double deltaEtaUe2 = particle.eta() - ueAxis2.Eta(); - double deltaPhiUe2 = getDeltaPhi(particle.phi(), ueAxis2.Phi()); + double deltaEtaUe2 = hadron.Eta() - ueAxis2.Eta(); + double deltaPhiUe2 = getDeltaPhi(hadron.Phi(), ueAxis2.Phi()); double deltaRUe2 = std::sqrt(deltaEtaUe2 * deltaEtaUe2 + deltaPhiUe2 * deltaPhiUe2); // Select particles inside jet if (deltaRJet < coneRadius) { - switch (particle.pdgCode()) { + switch (pdg[index]) { case kK0Short: - registryMC.fill(HIST("K0s_generated_jet"), genMultiplicity, particle.pt()); + registryMC.fill(HIST("K0s_generated_jet"), genMultiplicity, hadron.Pt()); break; case kLambda0: - registryMC.fill(HIST("Lambda_generated_jet"), genMultiplicity, particle.pt()); + registryMC.fill(HIST("Lambda_generated_jet"), genMultiplicity, hadron.Pt()); break; case kLambda0Bar: - registryMC.fill(HIST("AntiLambda_generated_jet"), genMultiplicity, particle.pt()); + registryMC.fill(HIST("AntiLambda_generated_jet"), genMultiplicity, hadron.Pt()); break; case kXiMinus: - registryMC.fill(HIST("XiNeg_generated_jet"), genMultiplicity, particle.pt()); + registryMC.fill(HIST("XiNeg_generated_jet"), genMultiplicity, hadron.Pt()); break; case kXiPlusBar: - registryMC.fill(HIST("XiPos_generated_jet"), genMultiplicity, particle.pt()); + registryMC.fill(HIST("XiPos_generated_jet"), genMultiplicity, hadron.Pt()); break; case kOmegaMinus: - registryMC.fill(HIST("OmegaNeg_generated_jet"), genMultiplicity, particle.pt()); + registryMC.fill(HIST("OmegaNeg_generated_jet"), genMultiplicity, hadron.Pt()); break; case kOmegaPlusBar: - registryMC.fill(HIST("OmegaPos_generated_jet"), genMultiplicity, particle.pt()); + registryMC.fill(HIST("OmegaPos_generated_jet"), genMultiplicity, hadron.Pt()); break; default: break; @@ -1105,27 +1115,27 @@ struct StrangenessInJets { // Select particles inside UE cones if (deltaRUe1 < coneRadius || deltaRUe2 < coneRadius) { - switch (particle.pdgCode()) { + switch (pdg[index]) { case kK0Short: - registryMC.fill(HIST("K0s_generated_ue"), genMultiplicity, particle.pt()); + registryMC.fill(HIST("K0s_generated_ue"), genMultiplicity, hadron.Pt()); break; case kLambda0: - registryMC.fill(HIST("Lambda_generated_ue"), genMultiplicity, particle.pt()); + registryMC.fill(HIST("Lambda_generated_ue"), genMultiplicity, hadron.Pt()); break; case kLambda0Bar: - registryMC.fill(HIST("AntiLambda_generated_ue"), genMultiplicity, particle.pt()); + registryMC.fill(HIST("AntiLambda_generated_ue"), genMultiplicity, hadron.Pt()); break; case kXiMinus: - registryMC.fill(HIST("XiNeg_generated_ue"), genMultiplicity, particle.pt()); + registryMC.fill(HIST("XiNeg_generated_ue"), genMultiplicity, hadron.Pt()); break; case kXiPlusBar: - registryMC.fill(HIST("XiPos_generated_ue"), genMultiplicity, particle.pt()); + registryMC.fill(HIST("XiPos_generated_ue"), genMultiplicity, hadron.Pt()); break; case kOmegaMinus: - registryMC.fill(HIST("OmegaNeg_generated_ue"), genMultiplicity, particle.pt()); + registryMC.fill(HIST("OmegaNeg_generated_ue"), genMultiplicity, hadron.Pt()); break; case kOmegaPlusBar: - registryMC.fill(HIST("OmegaPos_generated_ue"), genMultiplicity, particle.pt()); + registryMC.fill(HIST("OmegaPos_generated_ue"), genMultiplicity, hadron.Pt()); break; default: break; From 29a245781956c96aa4b3252ee7424d88a0217b18 Mon Sep 17 00:00:00 2001 From: Roman Lietava Date: Thu, 4 Sep 2025 18:27:03 +0200 Subject: [PATCH 309/986] [PWGLF] double count fix II (#12865) --- PWGLF/Tasks/Strangeness/nonPromptCascade.cxx | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx b/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx index 9672a65d4f8..ef261d822ff 100644 --- a/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx +++ b/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx @@ -210,6 +210,7 @@ struct NonPromptCascadeTask { float mBz = 0.f; o2::vertexing::DCAFitterN<2> mDCAFitter; std::array mProcessCounter = {0, 0}; // {Tracked, All} + std::map mToiMap; void initCCDB(aod::BCsWithTimestamps::iterator const& bc) { @@ -299,9 +300,10 @@ struct NonPromptCascadeTask { return true; } - void zorroAccounting(const auto& collisions, auto& toiMap) + void zorroAccounting(const auto& collisions) { if (cfgSkimmedProcessing && mProcessCounter[0] != mProcessCounter[1]) { + mToiMap.clear(); int runNumber{-1}; for (const auto& coll : collisions) { auto bc = coll.template bc_as(); @@ -320,7 +322,7 @@ struct NonPromptCascadeTask { for (size_t i{0}; i < toivect.size(); i++) { toiMask += toivect[i] << i; } - toiMap[bc.globalBC()] = toiMask; + mToiMap[bc.globalBC()] = toiMask; } } } @@ -338,7 +340,7 @@ struct NonPromptCascadeTask { }; template - void fillCandidatesVector(CollisionType const&, TrackType const& tracks, auto const& cascades, auto& candidates, std::map toiMap = {}) + void fillCandidatesVector(CollisionType const&, TrackType const& tracks, auto const& cascades, auto& candidates) { const auto& getCascade = [](auto const& candidate) { @@ -543,8 +545,8 @@ struct NonPromptCascadeTask { o2::base::Propagator::Instance()->propagateToDCA(primaryVertex, ntCascadeTrack, mBz, 2.f, matCorr, &motherDCA); } uint32_t toiMask = 0x0; - if (toiMap.count(bc.globalBC())) { - toiMask = toiMap[bc.globalBC()]; + if (mToiMap.count(bc.globalBC())) { + toiMask = mToiMap[bc.globalBC()]; } candidates.emplace_back(NPCascCandidate{mcParticleID, trackedCascGlobalIndex, itsTrackGlobalIndex, candidate.collisionId(), matchingChi2, deltaPtITSCascade, deltaPtCascade, cascITSclsSize, hasReassociatedClusters, hasFakeReassociation, isGoodMatch, isGoodCascade, pdgCodeMom, itsTrackPDG, fromHF[0], fromHF[1], collision.numContrib(), cascPVContribs, collision.collisionTimeRes(), primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ(), @@ -693,10 +695,8 @@ struct NonPromptCascadeTask { aod::BCsWithTimestamps const&) { mProcessCounter[0]++; - fillMultHistos(collisions); - std::map toiMap; - zorroAccounting(collisions, toiMap); - fillCandidatesVector(collisions, tracks, trackedCascades, gCandidates, toiMap); + zorroAccounting(collisions); + fillCandidatesVector(collisions, tracks, trackedCascades, gCandidates); fillDataTable(gCandidates); } PROCESS_SWITCH(NonPromptCascadeTask, processTrackedCascadesData, "process cascades from strangeness tracking: Data analysis", false); @@ -706,9 +706,9 @@ struct NonPromptCascadeTask { aod::BCsWithTimestamps const&) { mProcessCounter[1]++; - std::map toiMap; - zorroAccounting(collisions, toiMap); - fillCandidatesVector(collisions, tracks, cascades, gCandidatesNT, toiMap); + fillMultHistos(collisions); + zorroAccounting(collisions); + fillCandidatesVector(collisions, tracks, cascades, gCandidatesNT); fillDataTable(gCandidatesNT); } PROCESS_SWITCH(NonPromptCascadeTask, processCascadesData, "process cascades: Data analysis", false); From a9bfe47303ec382b14cdd255831eabfeef2042c9 Mon Sep 17 00:00:00 2001 From: Giovanni Malfattore <89481844+giovannimalfattore@users.noreply.github.com> Date: Thu, 4 Sep 2025 19:32:42 +0200 Subject: [PATCH 310/986] [PWGLF] NucleiTask - Add mothers histo for MC (#12863) --- PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx | 192 +++++++++++++++++++------- 1 file changed, 139 insertions(+), 53 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx b/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx index 288c5fecf21..ef8cc86ef87 100644 --- a/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx +++ b/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx @@ -42,8 +42,9 @@ #include "ReconstructionDataFormats/Track.h" #include -// #include +#include +#include #include using namespace o2; @@ -221,12 +222,30 @@ struct LFNucleiBATask { static constexpr int PDGTriton = o2::constants::physics::Pdg::kTriton; static constexpr int PDGHelium = o2::constants::physics::Pdg::kHelium3; static constexpr int PDGAlpha = o2::constants::physics::Pdg::kAlpha; + static constexpr int PDGHyperTriton = o2::constants::physics::Pdg::kHyperTriton; static constexpr float MassProtonVal = o2::constants::physics::MassProton; static constexpr float MassDeuteronVal = o2::constants::physics::MassDeuteron; static constexpr float MassTritonVal = o2::constants::physics::MassTriton; static constexpr float MassHeliumVal = o2::constants::physics::MassHelium3; static constexpr float MassAlphaVal = o2::constants::physics::MassAlpha; + // PDG of Mothers + static constexpr int kPdgMotherlist[] = { + PDGProton, // proton + PDGPion, // pi+ + PDGKaon, // K+ + 311, // K0 + PDGDeuteron, // deuteron + PDGTriton, // triton + PDGHelium, // He-3 + PDGAlpha, // Alpha + 1000130270, // Aluminium + 1000140280, // Silicon + 1000260560 // Iron + }; + static constexpr int kNumMotherlist = sizeof(kPdgMotherlist) / sizeof(kPdgMotherlist[0]); + static constexpr int kMaxNumMom = 4; // X: 0..4, overflow=5 + template float averageClusterSizeTrk(const TrackType& track) { @@ -825,24 +844,12 @@ struct LFNucleiBATask { histos.add("tracks/triton/h1antiTritonSpectraTrueTransport", "#it{p}_{T} (#bar{t})", HistType::kTH1F, {ptAxis}); } if (enableHe) { - // histos.add("tracks/helium/h1HeliumSpectraTrue", "#it{p}_{T}/z (He)", HistType::kTH1F, {ptZHeAxis}); - // histos.add("tracks/helium/h1HeliumSpectraTrueWPID", "#it{p}_{T}/z (He)", HistType::kTH1F, {ptZHeAxis}); - // histos.add("tracks/helium/h1HeliumSpectraTruePrim", "#it{p}_{T}/z (He)", HistType::kTH1F, {ptZHeAxis}); - // histos.add("tracks/helium/h1HeliumSpectraTrueSec", "#it{p}_{T}/z (He)", HistType::kTH1F, {ptZHeAxis}); - // histos.add("tracks/helium/h1HeliumSpectraTrueTransport", "#it{p}_{T}/z (He)", HistType::kTH1F, {ptZHeAxis}); - histos.add("tracks/helium/h1HeliumSpectraTrue_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); histos.add("tracks/helium/h1HeliumSpectraTrueWPID_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); histos.add("tracks/helium/h1HeliumSpectraTruePrim_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); histos.add("tracks/helium/h1HeliumSpectraTrueSec_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); histos.add("tracks/helium/h1HeliumSpectraTrueTransport_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); - // histos.add("tracks/helium/h1antiHeliumSpectraTrue", "#it{p}_{T}/z (He)", HistType::kTH1F, {ptZHeAxis}); - // histos.add("tracks/helium/h1antiHeliumSpectraTrueWPID", "#it{p}_{T}/z (He)", HistType::kTH1F, {ptZHeAxis}); - // histos.add("tracks/helium/h1antiHeliumSpectraTruePrim", "#it{p}_{T}/z (He)", HistType::kTH1F, {ptZHeAxis}); - // histos.add("tracks/helium/h1antiHeliumSpectraTrueSec", "#it{p}_{T}/z (He)", HistType::kTH1F, {ptZHeAxis}); - // histos.add("tracks/helium/h1antiHeliumSpectraTrueTransport", "#it{p}_{T}/z (He)", HistType::kTH1F, {ptZHeAxis}); - histos.add("tracks/helium/h1antiHeliumSpectraTrue_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); histos.add("tracks/helium/h1antiHeliumSpectraTrueWPID_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); histos.add("tracks/helium/h1antiHeliumSpectraTruePrim_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); @@ -1138,6 +1145,25 @@ struct LFNucleiBATask { histos.add("tracks/helium/dca/before/hDCAxyVsPtHeliumTruePrim", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/hDCAxyVsPtHeliumTrueSec", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/hDCAxyVsPtHeliumTrueMaterial", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); + + histos.add("tracks/helium/dca/before/hMomTrueMaterial", "MC mothers;mother index;mother PDG", HistType::kTH2I, {{kMaxNumMom + 2, -0.5, static_cast(kMaxNumMom) + 1.5}, {kNumMotherlist + 2, -1.5, static_cast(kNumMotherlist) + 0.5}}); + + // Fix for getting TH2 pointer + std::shared_ptr hTemp = histos.get(HIST("tracks/helium/dca/before/hMomTrueMaterial")); + TH2* hPDG = hTemp.get(); + + TAxis* axPDG = hPDG->GetXaxis(); + for (int i = 0; i <= kMaxNumMom; ++i) { + axPDG->SetBinLabel(i + 1, Form("%d", i)); + } + axPDG->SetBinLabel(kMaxNumMom + 2, ">=5"); + TAxis* ayPDG = hPDG->GetYaxis(); + ayPDG->SetBinLabel(1, "-1"); // undefined + ayPDG->SetBinLabel(2, "0"); // other + for (int i = 0; i < kNumMotherlist; ++i) { + ayPDG->SetBinLabel(i + 3, Form("%d", kPdgMotherlist[i])); + } + histos.add("tracks/helium/dca/before/hDCAxyVsPtHeliumTrueTransport", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/hDCAxyVsPtantiHeliumTrue", "DCAxy vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); @@ -2099,7 +2125,7 @@ struct LFNucleiBATask { template void fillHistograms(const CollisionType& event, const TracksType& tracks, - const ParticleType& /*particles*/) + const ParticleType& particles) { histos.fill(HIST("event/eventSkimming"), 0.5); // Apply skimming @@ -2206,7 +2232,7 @@ struct LFNucleiBATask { tracks.copyIndexBindings(tracksWithITS); - for (auto& track : tracksWithITS) { + for (auto const& track : tracksWithITS) { if constexpr (!IsFilteredData) { if (!track.isGlobalTrackWoDCA() && filterOptions.enableIsGlobalTrack) { continue; @@ -2219,14 +2245,13 @@ struct LFNucleiBATask { histos.fill(HIST("tracks/avgClusterSizePerCoslInvVsITSlayers"), track.p(), averageClusterSizePerCoslInv(track), track.itsNCls()); } - if (track.itsNCls() < trkqcOptions.cfgCutITSClusters) - continue; - if (track.tpcNClsCrossedRows() < trkqcOptions.cfgCutTPCXRows) - continue; - if (track.tpcNClsFound() < trkqcOptions.cfgCutTPCClusters) - continue; - if (track.tpcCrossedRowsOverFindableCls() < trkqcOptions.cfgCutTPCCROFnd) + if (track.itsNCls() < trkqcOptions.cfgCutITSClusters || + track.tpcNClsCrossedRows() < trkqcOptions.cfgCutTPCXRows || + track.tpcNClsFound() < trkqcOptions.cfgCutTPCClusters || + track.tpcCrossedRowsOverFindableCls() < trkqcOptions.cfgCutTPCCROFnd) { continue; + } + auto tpcChi2NclRange = (std::vector)trkqcOptions.tpcChi2NclCuts; if ((track.tpcChi2NCl() < tpcChi2NclRange[0]) || (track.tpcChi2NCl() > tpcChi2NclRange[1])) continue; @@ -2252,21 +2277,21 @@ struct LFNucleiBATask { float shiftPtNeg = 0.f; if (enablePtShiftHe && !fShiftPtHe) { - fShiftPtHe = new TF1("fShiftPtHe", "[0] * TMath::Exp([1] + [2] * x) + [3] + [4] * x", 0.f, 8.f); - auto par = (std::vector)parShiftPtHe; - fShiftPtHe->SetParameters(par[0], par[1], par[2], par[3], par[4]); + fShiftPtHe = new TF1("fShiftPtHe", "[0] * exp([1] + [2] * x) + [3] + [4] * x", 0.f, 8.f); + auto parHe = (std::vector)parShiftPtHe; // NOLINT + fShiftPtHe->SetParameters(parHe[0], parHe[1], parHe[2], parHe[3], parHe[4]); } if (enablePtShiftHe && !fShiftPtantiHe) { - fShiftPtantiHe = new TF1("fShiftPtantiHe", "[0] * TMath::Exp([1] + [2] * x) + [3] + [4] * x", 0.f, 8.f); - auto par = (std::vector)parShiftPtAntiHe; - fShiftPtantiHe->SetParameters(par[0], par[1], par[2], par[3], par[4]); + fShiftPtantiHe = new TF1("fShiftPtantiHe", "[0] * exp([1] + [2] * x) + [3] + [4] * x", 0.f, 8.f); + auto parAntiHe = (std::vector)parShiftPtAntiHe; // NOLINT + fShiftPtantiHe->SetParameters(parAntiHe[0], parAntiHe[1], parAntiHe[2], parAntiHe[3], parAntiHe[4]); } if (enablePtShiftAntiD && !fShiftAntiD) { - fShiftAntiD = new TF1("fShiftAntiD", "[0] * TMath::Exp([1] + [2] * x) + [3] + [4] * x", 0.f, 8.f); - auto par = (std::vector)parShiftPtAntiD; - fShiftAntiD->SetParameters(par[0], par[1], par[2], par[3], par[4]); + fShiftAntiD = new TF1("fShiftAntiD", "[0] * exp([1] + [2] * x) + [3] + [4] * x", 0.f, 8.f); + auto parAntiD = (std::vector)parShiftPtAntiD; // NOLINT + fShiftAntiD->SetParameters(parAntiD[0], parAntiD[1], parAntiD[2], parAntiD[3], parAntiD[4]); } switch (unableAntiDPtShift) { @@ -2282,9 +2307,9 @@ struct LFNucleiBATask { } if (enablePtShiftD && !fShiftD) { - fShiftD = new TF1("fShiftD", "[0] * TMath::Exp([1] + [2] * x) + [3] + [4] * x", 0.f, 8.f); - auto par = (std::vector)parShiftPtD; - fShiftD->SetParameters(par[0], par[1], par[2], par[3], par[4]); + fShiftD = new TF1("fShiftD", "[0] * exp([1] + [2] * x) + [3] + [4] * x", 0.f, 8.f); + auto parD = (std::vector)parShiftPtD; // NOLINT + fShiftD->SetParameters(parD[0], parD[1], parD[2], parD[3], parD[4]); } switch (unableDPtShift) { @@ -2475,11 +2500,16 @@ struct LFNucleiBATask { } // Rapidity cuts - prRapCut = track.rapidity(o2::track::PID::getMass2Z(o2::track::PID::Proton)) > kinemOptions.cfgRapidityCutLow && track.rapidity(o2::track::PID::getMass2Z(o2::track::PID::Proton)) < kinemOptions.cfgRapidityCutHigh; - deRapCut = track.rapidity(o2::track::PID::getMass2Z(o2::track::PID::Deuteron)) > kinemOptions.cfgRapidityCutLow && track.rapidity(o2::track::PID::getMass2Z(o2::track::PID::Deuteron)) < kinemOptions.cfgRapidityCutHigh; - trRapCut = track.rapidity(o2::track::PID::getMass2Z(o2::track::PID::Triton)) > kinemOptions.cfgRapidityCutLow && track.rapidity(o2::track::PID::getMass2Z(o2::track::PID::Triton)) < kinemOptions.cfgRapidityCutHigh; - heRapCut = track.rapidity(o2::track::PID::getMass2Z(o2::track::PID::Helium3)) > kinemOptions.cfgRapidityCutLow && track.rapidity(o2::track::PID::getMass2Z(o2::track::PID::Helium3)) < kinemOptions.cfgRapidityCutHigh; - alRapCut = track.rapidity(o2::track::PID::getMass2Z(o2::track::PID::Alpha)) > kinemOptions.cfgRapidityCutLow && track.rapidity(o2::track::PID::getMass2Z(o2::track::PID::Alpha)) < kinemOptions.cfgRapidityCutHigh; + auto rapCheck = [&](float m2z) { + const float rap = track.rapidity(m2z); + return (rap > kinemOptions.cfgRapidityCutLow) && (rap < kinemOptions.cfgRapidityCutHigh); + }; + + prRapCut = rapCheck(MassProtonVal); + deRapCut = rapCheck(MassDeuteronVal); + trRapCut = rapCheck(MassTritonVal); + heRapCut = rapCheck(MassHeliumVal / 2.0); + alRapCut = rapCheck(MassAlphaVal / 2.0); isDeuteron = enableDe && deRapCut; isHelium = enableHe && heRapCut; @@ -2615,6 +2645,7 @@ struct LFNucleiBATask { } if constexpr (IsMC) { + // auto const& mcParticles = particles; bool isPhysPrim = false; bool isProdByGen = false; bool isWeakDecay = false; @@ -2624,7 +2655,7 @@ struct LFNucleiBATask { if constexpr (IsFilteredData) { isPhysPrim = track.isPhysicalPrimary(); isProdByGen = track.producedByGenerator(); - isWeakDecay = track.getProcess() == 4; + isWeakDecay = track.getProcess() == 4; // NOLINT pdgCode = track.pdgCode(); } else { if (!track.has_mcParticle()) { @@ -2632,7 +2663,7 @@ struct LFNucleiBATask { } isPhysPrim = track.mcParticle().isPhysicalPrimary(); isProdByGen = track.mcParticle().producedByGenerator(); - isWeakDecay = track.mcParticle().getProcess() == 4; + isWeakDecay = track.mcParticle().getProcess() == 4; // NOLINT pdgCode = track.mcParticle().pdgCode(); } @@ -3037,6 +3068,8 @@ struct LFNucleiBATask { break; } } + } else { + (void)particles; } // Tracks DCA histos fill if (outFlagOptions.makeDCABeforeCutPlots) { @@ -3114,6 +3147,7 @@ struct LFNucleiBATask { } if constexpr (IsMC) { + // auto const& mcParticles = particles; bool isPhysPrim = false; bool isProdByGen = false; bool isWeakDecay = false; @@ -3121,12 +3155,19 @@ struct LFNucleiBATask { // PID int pdgCode = 0; + int pdgMom = 0; // gen Pt float genPt = 0; + // Mothers variables + [[maybe_unused]] int firstMotherId = -1; + [[maybe_unused]] int firstMotherPdg = -1; + [[maybe_unused]] int pdgList[8]; + [[maybe_unused]] int nSaved = 0; + if constexpr (IsFilteredData) { isPhysPrim = track.isPhysicalPrimary(); isProdByGen = track.producedByGenerator(); - isWeakDecay = track.getProcess() == 4; + isWeakDecay = track.getProcess() == 4; // NOLINT pdgCode = track.pdgCode(); genPt = std::sqrt(std::pow(track.px(), 2) + std::pow(track.py(), 2)); @@ -3136,10 +3177,36 @@ struct LFNucleiBATask { } isPhysPrim = track.mcParticle().isPhysicalPrimary(); isProdByGen = track.mcParticle().producedByGenerator(); - isWeakDecay = track.mcParticle().getProcess() == 4; + isWeakDecay = track.mcParticle().getProcess() == 4; // NOLINT pdgCode = track.mcParticle().pdgCode(); - genPt = track.mcParticle().pt(); + // Access to MC particles mother + o2::aod::McParticles::iterator mc = particles.iteratorAt(track.mcParticleId()); + gsl::span motherIds = mc.mothersIds(); + const int nMothers = static_cast(motherIds.size()); + firstMotherId = -1; + firstMotherPdg = -1; + + nSaved = 0; + + for (int iMom = 0; iMom < nMothers; ++iMom) { + int motherId = motherIds[iMom]; + if (motherId < 0 || motherId >= particles.size()) { + continue; // added check on mother + } + o2::aod::McParticles::iterator mother = particles.iteratorAt(motherId); + pdgMom = mother.pdgCode(); + + if (iMom == 0) { + firstMotherId = motherId; + firstMotherPdg = pdgMom; + } + if (nSaved < 8) { + pdgList[nSaved++] = pdgMom; + } + } + + genPt = track.mcParticle().pt(); for (int i = 0; i < 10; i++) { // From ITS to TPC if (track.mcMask() & 1 << i) { hasFakeHit = true; @@ -3400,10 +3467,30 @@ struct LFNucleiBATask { } if (!isPhysPrim && !isProdByGen && outFlagOptions.makeDCABeforeCutPlots) { histos.fill(HIST("tracks/helium/dca/before/hDCAxyVsPtHeliumTrueTransport"), hePt, track.dcaXY()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/helium/dca/before/hDCAxyVsPtHeliumTrueSec"), hePt, track.dcaXY()); - else + } else { histos.fill(HIST("tracks/helium/dca/before/hDCAxyVsPtHeliumTrueMaterial"), hePt, track.dcaXY()); + if (!IsFilteredData) { + if (nSaved > 0) { + for (int i = 0; i < nSaved; ++i) { + int idxComp = (i <= kMaxNumMom) ? i : (kMaxNumMom + 1); + int pdgMom = pdgList[i]; + int yVal = -1; + if (pdgMom != -1) { + yVal = 0; + for (int j = 0; j < kNumMotherlist; ++j) { + if (kPdgMotherlist[j] == pdgMom) { + yVal = j + 1; + break; + } + } + } + histos.fill(HIST("tracks/helium/dca/before/hMomTrueMaterial"), idxComp, yVal); + } + } + } + } if (track.hasTOF() && outFlagOptions.doTOFplots) { histos.fill(HIST("tracks/helium/dca/before/TOF/hDCAxyVsPtHeliumTrueTransport"), hePt, track.dcaXY()); if (isWeakDecay) @@ -3682,6 +3769,8 @@ struct LFNucleiBATask { } break; } + } else { + (void)particles; } // DCA Cut @@ -4553,11 +4642,8 @@ struct LFNucleiBATask { histos.fill(HIST("tracks/eff/helium/hPtHe"), 2 * hePt); histos.fill(HIST("tracks/eff/helium/h2pVsTPCmomentumHe"), heTPCmomentum, heP); } - // histos.fill(HIST("tracks/helium/h1HeliumSpectra"), hePt); histos.fill(HIST("tracks/helium/h1HeliumSpectra_Z2"), 2 * hePt); - // histos.fill(HIST("tracks/helium/h2HeliumYvsPt"), track.rapidity(o2::track::PID::getMass2Z(o2::track::PID::Helium3)), hePt); histos.fill(HIST("tracks/helium/h2HeliumYvsPt_Z2"), track.rapidity(o2::track::PID::getMass2Z(o2::track::PID::Helium3)), 2 * hePt); - // histos.fill(HIST("tracks/helium/h2HeliumEtavsPt"), track.eta(), hePt); histos.fill(HIST("tracks/helium/h2HeliumEtavsPt_Z2"), track.eta(), 2 * hePt); if (outFlagOptions.enablePIDplot) histos.fill(HIST("tracks/helium/h2TPCsignVsTPCmomentumHelium"), heTPCmomentum, track.tpcSignal()); @@ -4567,11 +4653,8 @@ struct LFNucleiBATask { histos.fill(HIST("tracks/eff/helium/hPtantiHe"), 2 * antihePt); histos.fill(HIST("tracks/eff/helium/h2pVsTPCmomentumantiHe"), antiheTPCmomentum, antiheP); } - // histos.fill(HIST("tracks/helium/h1antiHeliumSpectra"), antihePt); histos.fill(HIST("tracks/helium/h1antiHeliumSpectra_Z2"), 2 * antihePt); - // histos.fill(HIST("tracks/helium/h2antiHeliumYvsPt"), track.rapidity(o2::track::PID::getMass2Z(o2::track::PID::Helium3)), antihePt); histos.fill(HIST("tracks/helium/h2antiHeliumYvsPt_Z2"), track.rapidity(o2::track::PID::getMass2Z(o2::track::PID::Helium3)), 2 * antihePt); - // histos.fill(HIST("tracks/helium/h2antiHeliumEtavsPt"), track.eta(), antihePt); histos.fill(HIST("tracks/helium/h2antiHeliumEtavsPt_Z2"), track.eta(), 2 * antihePt); if (outFlagOptions.enablePIDplot) histos.fill(HIST("tracks/helium/h2TPCsignVsTPCmomentumantiHelium"), antiheTPCmomentum, track.tpcSignal()); @@ -4811,6 +4894,7 @@ struct LFNucleiBATask { } if constexpr (IsMC) { + // auto const& mcParticles = particles; bool isPhysPrim = false; bool isProdByGen = false; bool isWeakDecay = false; @@ -5733,6 +5817,8 @@ struct LFNucleiBATask { default: break; } + } else { + (void)particles; } } } @@ -5973,7 +6059,7 @@ struct LFNucleiBATask { spectraGen.fill(HIST("histGenVetxZ"), mcCollision.posZ()); if (mcCollision.centFT0M() < cfgMultCutLow || mcCollision.centFT0M() > cfgMultCutHigh) return; - for (auto& mcParticleGen : mcParticles) { + for (auto& mcParticleGen : mcParticles) { // NOLINT if (mcParticleGen.y() > kinemOptions.cfgRapidityCutHigh || mcParticleGen.y() < kinemOptions.cfgRapidityCutLow) { continue; } From 8fecdfae4da7c5aca7ef9549488b1d64219ab152 Mon Sep 17 00:00:00 2001 From: Gyula Bencedi Date: Thu, 4 Sep 2025 21:17:32 +0200 Subject: [PATCH 311/986] [PWGLF] Added new method for track reassociation (#12856) --- PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx | 168 ++++++++++++++++++++++------- 1 file changed, 132 insertions(+), 36 deletions(-) diff --git a/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx b/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx index 7a8c4cfb23e..f1753f94879 100644 --- a/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx +++ b/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx @@ -56,6 +56,7 @@ using namespace o2::aod::fwdtrack; using namespace o2::constants::physics; using namespace o2::constants::math; using namespace pwgmm::mult; +using namespace o2::aod::rctsel; auto static constexpr kMinCharge = 3.f; @@ -63,7 +64,8 @@ AxisSpec ptAxis = {1001, -0.005, 10.005}; AxisSpec multAxis = {701, -0.5, 700.5, "N_{trk}"}; AxisSpec zAxis = {60, -30., 30.}; AxisSpec deltaZAxis = {61, -6.1, 6.1}; -AxisSpec dcaxyAxis = {500, -1, 50}; +AxisSpec dcaxyAxis = {1000, 0., 5.}; +AxisSpec dcazAxis = {1000, 0., 5.}; AxisSpec phiAxis = {629, 0, TwoPI, "Rad", "#phi"}; AxisSpec etaAxis = {20, -4., -2.}; AxisSpec centAxis{100, 0, 100, "centrality"}; @@ -101,6 +103,14 @@ struct DndetaMFTPbPb { Configurable cfgUseIRCut{"cfgUseIRCut", false, "Flag to cut on IR rate"}; Configurable cfgIRCrashOnNull{"cfgIRCrashOnNull", false, "Flag to avoid CTP RateFetcher crash"}; Configurable cfgIRSource{"cfgIRSource", "T0VTX", "Estimator of the interaction rate (Pb-Pb: ZNC hadronic)"}; + Configurable cfgUseTrackSel{"cfgUseTrackSel", false, "Flag to apply track selection"}; + + struct : ConfigurableGroup { + Configurable requireRCTFlagChecker{"requireRCTFlagChecker", false, "Check event quality in run condition table"}; + Configurable cfgEvtRCTFlagCheckerLabel{"cfgEvtRCTFlagCheckerLabel", "CBT_fw", "Evt sel: RCT flag checker label"}; + Configurable cfgEvtRCTFlagCheckerZDCCheck{"cfgEvtRCTFlagCheckerZDCCheck", false, "Evt sel: RCT flag checker ZDC check"}; + Configurable cfgEvtRCTFlagCheckerLimitAcceptAsBad{"cfgEvtRCTFlagCheckerLimitAcceptAsBad", true, "Evt sel: RCT flag checker treat Limited Acceptance As Bad"}; + } rctCuts; struct : ConfigurableGroup { Configurable usephiCut{"usephiCut", false, "use azimuthal angle cut"}; @@ -115,7 +125,8 @@ struct DndetaMFTPbPb { Configurable usePtCut{"usePtCut", false, "use track pT cut"}; Configurable minPt{"minPt", 0., "minimum pT of the MFT tracks"}; Configurable requireCA{"requireCA", false, "Use Cellular Automaton track-finding algorithm"}; - Configurable maxDCAxy{"maxDCAxy", 2.0f, "Cut on dcaXY"}; + Configurable maxDCAxy{"maxDCAxy", 0.01f, "Cut on dca XY"}; + Configurable maxDCAz{"maxDCAz", 0.01f, "Cut on dca Z"}; } trackCuts; struct : ConfigurableGroup { @@ -141,6 +152,10 @@ struct DndetaMFTPbPb { ConfigurableAxis occupancyBins{"occupancyBins", {VARIABLE_WIDTH, 0.0f, 250.0f, 500.0f, 750.0f, 1000.0f, 1500.0f, 2000.0f, 3000.0f, 4500.0f, 6000.0f, 8000.0f, 10000.0f, 50000.0f}, "Occupancy"}; ConfigurableAxis centralityBins{"centralityBins", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, "Centrality"}; ConfigurableAxis irBins{"irBins", {500, 0, 50}, "Interaction rate (kHz)"}; + ConfigurableAxis pvBins{"pvBins", {501, -0.5, 500.5}, ""}; + ConfigurableAxis fv0aMultBins{"fv0aMultBins", {501, -0.5, 500.5}, ""}; + ConfigurableAxis ft0aMultBins{"ft0aMultBins", {501, -0.5, 500.5}, ""}; + ConfigurableAxis ft0cMultBins{"ft0cMultBins", {501, -0.5, 500.5}, ""}; Service pdg; @@ -154,10 +169,20 @@ struct DndetaMFTPbPb { std::unordered_map gHadronicRate; ctpRateFetcher rateFetcher; TH2* gCurrentHadronicRate; + RCTFlagsChecker rctChecker; /// @brief init function, definition of histograms void init(InitContext&) { + AxisSpec pvAxis = {pvBins, "PV", "PVAxis"}; + AxisSpec multFV0aAxis = {fv0aMultBins, "fv0a", "FV0AMultAxis"}; + AxisSpec multFT0aAxis = {ft0aMultBins, "ft0a", "FT0AMultAxis"}; + AxisSpec multFT0cAxis = {ft0cMultBins, "ft0c", "FT0CMultAxis"}; + AxisSpec centralityAxis = {centralityBins, "Centrality", "centralityAxis"}; + AxisSpec occupancyAxis = {occupancyBins, "Occupancy", "occupancyAxis"}; + + rctChecker.init(rctCuts.cfgEvtRCTFlagCheckerLabel, rctCuts.cfgEvtRCTFlagCheckerZDCCheck, rctCuts.cfgEvtRCTFlagCheckerLimitAcceptAsBad); + ccdb->setURL(ccdbUrl.value); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); @@ -220,7 +245,7 @@ struct DndetaMFTPbPb { } auto hev = registry.add("Events/hEvtSel", "hEvtSel", HistType::kTH1F, - {{14, -0.5f, +13.5f}}); + {{15, -0.5f, +14.5f}}); hev->GetXaxis()->SetBinLabel(1, "All collisions"); hev->GetXaxis()->SetBinLabel(2, "Ev. sel."); hev->GetXaxis()->SetBinLabel(3, "kIsGoodZvtxFT0vsPV"); @@ -234,6 +259,7 @@ struct DndetaMFTPbPb { hev->GetXaxis()->SetBinLabel(11, "kNoHighMultCollInPrevRof"); hev->GetXaxis()->SetBinLabel(12, "Below min occup."); hev->GetXaxis()->SetBinLabel(13, "Above max occup."); + hev->GetXaxis()->SetBinLabel(14, "RCT Flag Checker"); registry.add("Tracks/hTrkSel", "Number of tracks; Cut; #Tracks Passed Cut", {HistType::kTH1D, {{nTrkSel, 0, nTrkSel}}}); registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelNCls + 1, "Ncl cut"); @@ -249,9 +275,6 @@ struct DndetaMFTPbPb { hBcSel->GetXaxis()->SetBinLabel(2, "BCs with collisions"); hBcSel->GetXaxis()->SetBinLabel(3, "BCs with pile-up/splitting"); - AxisSpec centralityAxis = {centralityBins, "Centrality", "centralityAxis"}; - AxisSpec occupancyAxis = {occupancyBins, "Occupancy", "occupancyAxis"}; - if (doprocessDataInclusive || doprocessDatawBestTracksInclusive || doprocessMCInclusive || doprocessMCwBestTracksInclusive) { registry.add({"Events/Selection", @@ -309,9 +332,16 @@ struct DndetaMFTPbPb { {"Tracks/DCAXYPt", "; p_{T} (GeV/c) ; DCA_{XY} (cm); occupancy", {HistType::kTHnSparseF, {ptAxis, dcaxyAxis, occupancyAxis}}}); + qaregistry.add( + {"Tracks/DCAZPt", + "; p_{T} (GeV/c) ; DCA_{Z} (cm); occupancy", + {HistType::kTHnSparseF, {ptAxis, dcazAxis, occupancyAxis}}}); qaregistry.add({"Tracks/DCAXY", "; DCA_{XY} (cm); occupancy", {HistType::kTH2F, {dcaxyAxis, occupancyAxis}}}); + qaregistry.add({"Tracks/DCAZ", + "; DCA_{Z} (cm); occupancy", + {HistType::kTH2F, {dcazAxis, occupancyAxis}}}); qaregistry.add( {"Tracks/ReTracksEtaZvtx", "; #eta; #it{z}_{vtx} (cm); occupancy", @@ -414,11 +444,20 @@ struct DndetaMFTPbPb { "; DCA_{XY} (cm); centrality; occupancy", {HistType::kTHnSparseF, {dcaxyAxis, centralityAxis, occupancyAxis}}}); + qaregistry.add({"Tracks/Centrality/DCAZ", + "; DCA_{Z} (cm); centrality; occupancy", + {HistType::kTHnSparseF, + {dcazAxis, centralityAxis, occupancyAxis}}}); qaregistry.add( {"Tracks/Centrality/DCAXYPt", "; p_{T} (GeV/c) ; DCA_{XY} (cm); centrality; occupancy", {HistType::kTHnSparseF, {ptAxis, dcaxyAxis, centralityAxis, occupancyAxis}}}); + qaregistry.add( + {"Tracks/Centrality/DCAZPt", + "; p_{T} (GeV/c) ; DCA_{Z} (cm); centrality; occupancy", + {HistType::kTHnSparseF, + {ptAxis, dcazAxis, centralityAxis, occupancyAxis}}}); qaregistry.add({"Tracks/Centrality/ReTracksEtaZvtx", "; #eta; #it{z}_{vtx} (cm); occupancy", {HistType::kTHnSparseF, @@ -696,13 +735,22 @@ struct DndetaMFTPbPb { {HistType::kTHnSparseF, {ptAxis, phiAxis, etaAxis, zAxis, centralityAxis, occupancyAxis}}}); } + + if (doprocessCorrelationwBestTracksInclusive) { + qaregistry.add("Events/hMultMFTvsFT0A", "MultMFT_vs_FT0A", {HistType::kTH2F, {multAxis, multFT0aAxis}}); + qaregistry.add("Events/hMultMFTvsFT0C", "MultMFT_vs_FT0C", {HistType::kTH2F, {multAxis, multFT0cAxis}}); + qaregistry.add("Events/hNPVtracksVsFT0C", "NPVtracks_vs_FT0C", {HistType::kTH2F, {pvAxis, multFT0cAxis}}); + qaregistry.add("Events/hMultMFTvsFV0A", "MultMFT_vs_FV0A", {HistType::kTH2F, {multAxis, multFV0aAxis}}); + qaregistry.add("Events/hNPVtracksVsMultMFT", "NPVtracks_vs_MultMFT", {HistType::kTH2F, {pvAxis, multAxis}}); + } } /// Filters - tracks Filter filtTrkEta = (aod::fwdtrack::eta < trackCuts.maxEta) && (aod::fwdtrack::eta > trackCuts.minEta); Filter filtATrackID = (aod::fwdtrack::bestCollisionId >= 0); - Filter filtATrackDCA = (nabs(aod::fwdtrack::bestDCAXY) < trackCuts.maxDCAxy); + Filter filtATrackDCAxy = (nabs(aod::fwdtrack::bestDCAXY) < trackCuts.maxDCAxy); + Filter filtATrackDCAz = (nabs(aod::fwdtrack::bestDCAZ) < trackCuts.maxDCAz); /// Filters - mc particles Filter primaries = (aod::mcparticle::flags & @@ -728,10 +776,12 @@ struct DndetaMFTPbPb { using MFTTracksLabeled = soa::Join; using MftTracksWColls = soa::Join; + using CollsCorr = soa::Join; + /// Filtered tables using FiltMftTracks = soa::Filtered; using FiltMcMftTracks = soa::Filtered; - using FiltBestTracks = soa::Filtered; + using FiltBestTracks = soa::Filtered; using FiltParticles = soa::Filtered; template @@ -855,8 +905,12 @@ struct DndetaMFTPbPb { itrack.eta(), c, occ); qaregistry.fill(HIST("Tracks/Centrality/DCAXYPt"), itrack.pt(), atrack.bestDCAXY(), c, occ); + qaregistry.fill(HIST("Tracks/Centrality/DCAZPt"), itrack.pt(), + atrack.bestDCAZ(), c, occ); qaregistry.fill(HIST("Tracks/Centrality/DCAXY"), atrack.bestDCAXY(), c, occ); + qaregistry.fill(HIST("Tracks/Centrality/DCAZ"), atrack.bestDCAZ(), + c, occ); qaregistry.fill(HIST("Tracks/Centrality/NclustersEtaBest"), itrack.nClusters(), itrack.eta(), c, occ); if (itrack.collisionId() != atrack.bestCollisionId()) { @@ -872,7 +926,10 @@ struct DndetaMFTPbPb { registry.fill(HIST("Tracks/PhiEtaBest"), phi, itrack.eta(), occ); qaregistry.fill(HIST("Tracks/DCAXYPt"), itrack.pt(), atrack.bestDCAXY(), occ); + qaregistry.fill(HIST("Tracks/DCAZPt"), itrack.pt(), + atrack.bestDCAZ(), occ); qaregistry.fill(HIST("Tracks/DCAXY"), atrack.bestDCAXY(), occ); + qaregistry.fill(HIST("Tracks/DCAZ"), atrack.bestDCAZ(), occ); qaregistry.fill(HIST("Tracks/NclustersEtaBest"), itrack.nClusters(), itrack.eta(), occ); if (itrack.collisionId() != atrack.bestCollisionId()) { @@ -1021,6 +1078,13 @@ struct DndetaMFTPbPb { if constexpr (fillHis) { registry.fill(HIST("Events/hEvtSel"), 12); } + + if (rctCuts.requireRCTFlagChecker && !rctChecker(collision)) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("Events/hEvtSel"), 13); + } return true; } @@ -1157,12 +1221,12 @@ struct DndetaMFTPbPb { } } - /// @brief process function for counting tracks (based on BestCollisionsFwd + /// @brief process function for counting tracks (based on BestCollisionsFwd3d /// table) template void processDatawBestTracks( typename C::iterator const& collision, FiltMftTracks const& tracks, - soa::SmallGroups const& besttracks, CollBCs const& /*bcs*/) + soa::SmallGroups const& besttracks, CollBCs const& /*bcs*/) { auto occ = getOccupancy(collision, eventCuts.occupancyEstimator); float c = getRecoCent(collision); @@ -1261,71 +1325,71 @@ struct DndetaMFTPbPb { void processDatawBestTracksInclusive( Colls::iterator const& collision, FiltMftTracks const& tracks, - soa::SmallGroups const& besttracks, CollBCs const& bcs) + soa::SmallGroups const& besttracks, CollBCs const& bcs) { processDatawBestTracks(collision, tracks, besttracks, bcs); } PROCESS_SWITCH(DndetaMFTPbPb, processDatawBestTracksInclusive, - "Count tracks based on BestCollisionsFwd table (inclusive)", + "Count tracks based on BestCollisionsFwd3d table (inclusive)", false); void processDatawBestTracksCentFT0C( CollsCentFT0C::iterator const& collision, FiltMftTracks const& tracks, - soa::SmallGroups const& besttracks, CollBCs const& bcs) + soa::SmallGroups const& besttracks, CollBCs const& bcs) { processDatawBestTracks(collision, tracks, besttracks, bcs); } PROCESS_SWITCH(DndetaMFTPbPb, processDatawBestTracksCentFT0C, - "Count tracks in FT0C centrality bins based on BestCollisionsFwd table", + "Count tracks in FT0C centrality bins based on BestCollisionsFwd3d table", false); void processDatawBestTracksCentFT0CVariant1( CollsCentFT0CVariant1::iterator const& collision, FiltMftTracks const& tracks, - soa::SmallGroups const& besttracks, CollBCs const& bcs) + soa::SmallGroups const& besttracks, CollBCs const& bcs) { processDatawBestTracks(collision, tracks, besttracks, bcs); } PROCESS_SWITCH(DndetaMFTPbPb, processDatawBestTracksCentFT0CVariant1, "Count tracks in FT0CVariant1 centrality bins based on " - "BestCollisionsFwd table", + "BestCollisionsFwd3d table", false); void processDatawBestTracksCentFT0M( CollsCentFT0M::iterator const& collision, FiltMftTracks const& tracks, - soa::SmallGroups const& besttracks, CollBCs const& bcs) + soa::SmallGroups const& besttracks, CollBCs const& bcs) { processDatawBestTracks(collision, tracks, besttracks, bcs); } PROCESS_SWITCH(DndetaMFTPbPb, processDatawBestTracksCentFT0M, - "Count tracks in FT0M centrality bins based on BestCollisionsFwd table", + "Count tracks in FT0M centrality bins based on BestCollisionsFwd3d table", false); void processDatawBestTracksCentNGlobal( CollsCentNGlobal::iterator const& collision, FiltMftTracks const& tracks, - soa::SmallGroups const& besttracks, CollBCs const& bcs) + soa::SmallGroups const& besttracks, CollBCs const& bcs) { processDatawBestTracks(collision, tracks, besttracks, bcs); } PROCESS_SWITCH(DndetaMFTPbPb, processDatawBestTracksCentNGlobal, "Count tracks in NGlobal centrality bins based on " - "BestCollisionsFwd table", + "BestCollisionsFwd3d table", false); void processDatawBestTracksCentMFT( CollsCentMFT::iterator const& collision, FiltMftTracks const& tracks, - soa::SmallGroups const& besttracks, CollBCs const& bcs) + soa::SmallGroups const& besttracks, CollBCs const& bcs) { processDatawBestTracks(collision, tracks, besttracks, bcs); } PROCESS_SWITCH(DndetaMFTPbPb, processDatawBestTracksCentMFT, - "Count tracks in MFT centrality bins based on BestCollisionsFwd table", + "Count tracks in MFT centrality bins based on BestCollisionsFwd3d table", false); Preslice perCol = o2::aod::fwdtrack::collisionId; @@ -1533,11 +1597,11 @@ struct DndetaMFTPbPb { PROCESS_SWITCH(DndetaMFTPbPb, processMCCentMFT, "Count MC particles in MFT centrality bins", false); - PresliceUnsorted perColU = + PresliceUnsorted perColU = aod::fwdtrack::bestCollisionId; /// @brief process template function to run on MC truth using - /// aod::BestCollisionsFwd tracks + /// aod::BestCollisionsFwd3d tracks template void processMCwBestTracks( typename MC::iterator const& mcCollision, @@ -1646,7 +1710,7 @@ struct DndetaMFTPbPb { } PROCESS_SWITCH(DndetaMFTPbPb, processMCwBestTracksInclusive, - "Count MC particles using aod::BestCollisionsFwd (inclusive)", + "Count MC particles using aod::BestCollisionsFwd3d (inclusive)", false); void processMCwBestTracksCentFT0C( @@ -1660,7 +1724,7 @@ struct DndetaMFTPbPb { } PROCESS_SWITCH(DndetaMFTPbPb, processMCwBestTracksCentFT0C, - "Count MC particles in FT0C centrality bins using aod::BestCollisionsFwd", + "Count MC particles in FT0C centrality bins using aod::BestCollisionsFwd3d", false); void processMCwBestTracksCentFT0CVariant1( @@ -1676,7 +1740,7 @@ struct DndetaMFTPbPb { PROCESS_SWITCH(DndetaMFTPbPb, processMCwBestTracksCentFT0CVariant1, "Count MC particles in FT0CVariant1 centrality bins using " - "aod::BestCollisionsFwd", + "aod::BestCollisionsFwd3d", false); void processMCwBestTracksCentFT0M( @@ -1690,7 +1754,7 @@ struct DndetaMFTPbPb { } PROCESS_SWITCH(DndetaMFTPbPb, processMCwBestTracksCentFT0M, - "Count MC particles in FT0M centrality bins using aod::BestCollisionsFwd", + "Count MC particles in FT0M centrality bins using aod::BestCollisionsFwd3d", false); void processMCwBestTracksCentNGlobal( @@ -1706,7 +1770,7 @@ struct DndetaMFTPbPb { PROCESS_SWITCH(DndetaMFTPbPb, processMCwBestTracksCentNGlobal, "Count MC particles in NGlobal centrality bins using " - "aod::BestCollisionsFwd", + "aod::BestCollisionsFwd3d", false); void processMCwBestTracksCentMFT( @@ -1720,7 +1784,7 @@ struct DndetaMFTPbPb { } PROCESS_SWITCH(DndetaMFTPbPb, processMCwBestTracksCentMFT, - "Count MC particles in MFT centrality bins using aod::BestCollisionsFwd", + "Count MC particles in MFT centrality bins using aod::BestCollisionsFwd3d", false); using ParticlesI = soa::Join; @@ -1859,13 +1923,13 @@ struct DndetaMFTPbPb { "Process tracking efficiency (in FT0C centrality bins, indexed)", false); /// @brief process function to calculate tracking efficiency (indexed) based - /// on BestCollisionsFwd in FT0C bins + /// on BestCollisionsFwd3d in FT0C bins template void processTrkEffBest( typename soa::Join::iterator const& collision, MC const& /*mccollisions*/, FiltParticles const& particles, FiltMcMftTracks const& /*tracks*/, - soa::SmallGroups const& besttracks) + soa::SmallGroups const& besttracks) { if (!isGoodEvent(collision)) { return; @@ -1927,21 +1991,21 @@ struct DndetaMFTPbPb { soa::Join::iterator const& collision, aod::McCollisions const& mccollisions, FiltParticles const& particles, FiltMcMftTracks const& tracks, - soa::SmallGroups const& besttracks) + soa::SmallGroups const& besttracks) { processTrkEffBest(collision, mccollisions, particles, tracks, besttracks); } PROCESS_SWITCH(DndetaMFTPbPb, processTrkEffBestInclusive, - "Process tracking efficiency (inclusive, based on BestCollisionsFwd)", + "Process tracking efficiency (inclusive, based on BestCollisionsFwd3d)", false); void processTrkEffBestCentFT0C( soa::Join::iterator const& collision, aod::McCollisions const& mccollisions, FiltParticles const& particles, FiltMcMftTracks const& tracks, - soa::SmallGroups const& besttracks) + soa::SmallGroups const& besttracks) { processTrkEffBest( collision, mccollisions, particles, tracks, besttracks); @@ -1949,7 +2013,7 @@ struct DndetaMFTPbPb { PROCESS_SWITCH(DndetaMFTPbPb, processTrkEffBestCentFT0C, "Process tracking efficiency (in FT0 centrality bins, based " - "on BestCollisionsFwd)", + "on BestCollisionsFwd3d)", false); Preslice filtMcTrkperCol = o2::aod::fwdtrack::collisionId; @@ -2182,6 +2246,38 @@ struct DndetaMFTPbPb { PROCESS_SWITCH(DndetaMFTPbPb, processMcQACentFT0C, "Process MC QA checks (in FT0 centrality bins)", false); + + template + void processCorrelationwBestTracks(typename C::iterator const& collision, FiltMftTracks const& /*tracks*/, soa::SmallGroups const& besttracks) + { + if (!isGoodEvent(collision)) { + return; + } + + auto nBestTrks = 0; + for (auto const& atrack : besttracks) { + auto itrack = atrack.template mfttrack_as(); + if (itrack.eta() < trackCuts.minEta || itrack.eta() > trackCuts.maxEta) { + continue; + } + if (cfgUseTrackSel && !isTrackSelected(itrack)) { + continue; + } + nBestTrks++; + } + qaregistry.fill(HIST("Events/hMultMFTvsFT0A"), nBestTrks, collision.multFT0A()); + qaregistry.fill(HIST("Events/hMultMFTvsFT0C"), nBestTrks, collision.multFT0C()); + qaregistry.fill(HIST("Events/hNPVtracksVsFT0C"), collision.multNTracksPV(), collision.multFT0C()); + qaregistry.fill(HIST("Events/hMultMFTvsFV0A"), nBestTrks, collision.multFV0A()); + qaregistry.fill(HIST("Events/hNPVtracksVsMultMFT"), collision.multNTracksPV(), nBestTrks); + } + + void processCorrelationwBestTracksInclusive(CollsCorr::iterator const& collision, FiltMftTracks const& tracks, soa::SmallGroups const& besttracks) + { + processCorrelationwBestTracks(collision, tracks, besttracks); + } + + PROCESS_SWITCH(DndetaMFTPbPb, processCorrelationwBestTracksInclusive, "Do correlation study based on BestCollisionsFwd3d table", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 05872980bd5f7b26fee38bb5ea041dfe15fea714 Mon Sep 17 00:00:00 2001 From: HANSEO PARK <53218370+hanseopark@users.noreply.github.com> Date: Fri, 5 Sep 2025 05:44:28 +0900 Subject: [PATCH 312/986] [PWGJE] Add secondary track's contamination inside jet (#12514) --- PWGJE/Tasks/jetTaggerHFQA.cxx | 104 ++++++++++++++++++++++++++++++---- 1 file changed, 92 insertions(+), 12 deletions(-) diff --git a/PWGJE/Tasks/jetTaggerHFQA.cxx b/PWGJE/Tasks/jetTaggerHFQA.cxx index 52a36b2c6e5..1cba0c2cad8 100644 --- a/PWGJE/Tasks/jetTaggerHFQA.cxx +++ b/PWGJE/Tasks/jetTaggerHFQA.cxx @@ -127,6 +127,8 @@ struct JetTaggerHFQA { // Axis AxisSpec axisJetFlavour = {binJetFlavour, "Jet flavour"}; AxisSpec axisJetPt = {binJetPt, "#it{p}_{T, jet}"}; + AxisSpec axisMCDJetPt = {binJetPt, "#it{p}_{T, jet}^{rec}"}; + AxisSpec axisMCPJetPt = {binJetPt, "#it{p}_{T, jet}^{gen}"}; AxisSpec axisEta = {binEta, "#eta"}; AxisSpec axisPhi = {binPhi, "#phi"}; AxisSpec axisNTracks = {binNtracks, "#it{N}_{tracks}"}; @@ -149,6 +151,7 @@ struct JetTaggerHFQA { AxisSpec axisMass = {binMass, "#it{m}_{SV}"}; AxisSpec axisSigmaLxy = {binSigmaLxy, "#sigma_{L_{XY}} [cm]"}; AxisSpec axisSigmaLxyz = {binSigmaLxyz, "#sigma_{L_{XYZ}} [cm]"}; + AxisSpec axisFracSecPt = {100, 0, 1, "#frac{#Sigma#it{p}_{T}^{secondary track}}{#it{p}_{T, jet}}"}; if (doprocessTracksDca) { if (fillIPxy) { @@ -164,6 +167,14 @@ struct JetTaggerHFQA { registry.add("h_impact_parameter_xyz_significance", "", {HistType::kTH1F, {{axisImpactParameterXYZSignificance}}}); } } + if (doprocessTracksInJetsData) { + registry.add("h3_track_pt_impact_parameter_xy", "", {HistType::kTH3F, {{axisJetPt}, {axisTrackPt}, {axisImpactParameterXY}}}); + } + if (doprocessSecondaryContaminationMCD) { + registry.add("hn_jet_pt_track_pt_impact_parameter_xy_physical_primary_flavour", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisTrackPt}, {axisImpactParameterXY}, {axisJetFlavour}}}); + registry.add("hn_jet_pt_track_pt_impact_parameter_xy_secondary_flavour", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisTrackPt}, {axisImpactParameterXY}, {axisJetFlavour}}}); + registry.add("h3_jet_pt_frac_secondary_pt_per_jet_flavour", "", {HistType::kTH3F, {{axisJetPt}, {axisFracSecPt}, {axisJetFlavour}}}); + } if (doprocessValFlavourDefMCD) { registry.add("h2_flavour_dist_quark_flavour_dist_hadron", "", {HistType::kTH2F, {{axisJetFlavour}, {axisJetFlavour}}}); registry.add("h2_flavour_const_quark_flavour_const_hadron", "", {HistType::kTH2F, {{axisJetFlavour}, {axisJetFlavour}}}); @@ -289,7 +300,7 @@ struct JetTaggerHFQA { registry.add("h2_jet_phi_part_flavour", "", {HistType::kTH2F, {{axisPhi}, {axisJetFlavour}}}); } if (doprocessIPsMCPMCDMatched || doprocessIPsMCPMCDMatchedWeighted) { - registry.add("h3_jet_pt_jet_pt_part_matchedgeo_flavour", "", {HistType::kTH3F, {{axisJetPt}, {axisJetPt}, {axisJetFlavour}}}); + registry.add("h3_jet_pt_jet_pt_part_matchedgeo_flavour", "", {HistType::kTH3F, {{axisMCDJetPt}, {axisMCPJetPt}, {axisJetFlavour}}}); } if (doprocessJPData) { if (!doprocessIPsData && !doprocessSV2ProngData && !doprocessSV3ProngData) { @@ -435,14 +446,17 @@ struct JetTaggerHFQA { template bool isAcceptedJet(U const& jet) { - if (jetAreaFractionMin > -98.0) { + const float noJetAreaFractionFilter = -98.0; + const float noConstituentPtMinFilter = -98.0; + const float noConstituentPtMaxFilter = 9998.0; + if (jetAreaFractionMin > noJetAreaFractionFilter) { if (jet.area() < jetAreaFractionMin * o2::constants::math::PI * (jet.r() / 100.0) * (jet.r() / 100.0)) { return false; } } bool checkConstituentPt = true; - bool checkConstituentMinPt = (leadingConstituentPtMin > -98.0); - bool checkConstituentMaxPt = (leadingConstituentPtMax < 9998.0); + bool checkConstituentMinPt = (leadingConstituentPtMin > noConstituentPtMinFilter); + bool checkConstituentMaxPt = (leadingConstituentPtMax < noConstituentPtMaxFilter); if (!checkConstituentMinPt && !checkConstituentMaxPt) { checkConstituentPt = false; } @@ -520,6 +534,9 @@ struct JetTaggerHFQA { template void fillHistogramIPsData(T const& jet, U const& /*tracks*/) { + std::size_t firstTaggerForTrackCounting = 0; + std::size_t secondTaggerForTrackCounting = 1; + std::size_t thirdTaggerForTrackCounting = 2; float eventWeight = 1.0; float pTHat = 10. / (std::pow(eventWeight, 1.0 / pTHatExponent)); if (jet.pt() > pTHatMaxMCD * pTHat) { @@ -585,7 +602,7 @@ struct JetTaggerHFQA { if (fillIPxyz) std::sort(vecSignImpXYZSig.begin(), vecSignImpXYZSig.end(), sortImp); - if (vecSignImpXYSig.size() > 0) { // N1 + if (vecSignImpXYSig.size() > firstTaggerForTrackCounting) { // N1 if (fillIPxy) registry.fill(HIST("h2_jet_pt_sign_impact_parameter_xy_significance_N1"), jet.pt(), vecSignImpXYSig[0][0]); if (fillIPz) @@ -593,7 +610,7 @@ struct JetTaggerHFQA { if (fillIPxyz) registry.fill(HIST("h2_jet_pt_sign_impact_parameter_xyz_significance_N1"), jet.pt(), vecSignImpXYZSig[0][0]); } - if (vecSignImpXYSig.size() > 1) { // N2 + if (vecSignImpXYSig.size() > secondTaggerForTrackCounting) { // N2 if (fillIPxy) registry.fill(HIST("h2_jet_pt_sign_impact_parameter_xy_significance_N2"), jet.pt(), vecSignImpXYSig[1][0]); if (fillIPz) @@ -601,7 +618,7 @@ struct JetTaggerHFQA { if (fillIPxyz) registry.fill(HIST("h2_jet_pt_sign_impact_parameter_xyz_significance_N2"), jet.pt(), vecSignImpXYZSig[1][0]); } - if (vecSignImpXYSig.size() > 2) { // N3 + if (vecSignImpXYSig.size() > thirdTaggerForTrackCounting) { // N3 if (fillIPxy) registry.fill(HIST("h2_jet_pt_sign_impact_parameter_xy_significance_N3"), jet.pt(), vecSignImpXYSig[2][0]); if (fillIPz) @@ -638,6 +655,9 @@ struct JetTaggerHFQA { template void fillHistogramIPsMCD(T const& mcdjet, U const& /*tracks*/, float eventWeight = 1.0) { + std::size_t firstTaggerForTrackCounting = 0; + std::size_t secondTaggerForTrackCounting = 1; + std::size_t thirdTaggerForTrackCounting = 2; float pTHat = 10. / (std::pow(eventWeight, 1.0 / pTHatExponent)); if (mcdjet.pt() > pTHatMaxMCD * pTHat) { return; @@ -739,7 +759,7 @@ struct JetTaggerHFQA { sort(vecSignImpZSig[jetflavour].begin(), vecSignImpZSig[jetflavour].end(), std::greater()); sort(vecSignImpXYZSig[jetflavour].begin(), vecSignImpXYZSig[jetflavour].end(), std::greater()); - if (vecImpXY[jetflavour].size() > 0) { // N1 + if (vecImpXY[jetflavour].size() > firstTaggerForTrackCounting) { // N1 if (fillIPxy) registry.fill(HIST("h3_jet_pt_sign_impact_parameter_xy_significance_flavour_N1"), mcdjet.pt(), vecSignImpXYSig[jetflavour][0], jetflavour, eventWeight); if (fillIPz) @@ -747,7 +767,7 @@ struct JetTaggerHFQA { if (fillIPxyz) registry.fill(HIST("h3_jet_pt_sign_impact_parameter_xyz_significance_flavour_N1"), mcdjet.pt(), vecSignImpXYZSig[jetflavour][0], jetflavour, eventWeight); } - if (vecImpXY[jetflavour].size() > 1) { // N2 + if (vecImpXY[jetflavour].size() > secondTaggerForTrackCounting) { // N2 if (fillIPxy) registry.fill(HIST("h3_jet_pt_sign_impact_parameter_xy_significance_flavour_N2"), mcdjet.pt(), vecSignImpXYSig[jetflavour][1], jetflavour, eventWeight); if (fillIPz) @@ -755,7 +775,7 @@ struct JetTaggerHFQA { if (fillIPxyz) registry.fill(HIST("h3_jet_pt_sign_impact_parameter_xyz_significance_flavour_N2"), mcdjet.pt(), vecSignImpXYZSig[jetflavour][1], jetflavour, eventWeight); } - if (vecImpXY[jetflavour].size() > 2) { // N3 + if (vecImpXY[jetflavour].size() > thirdTaggerForTrackCounting) { // N3 if (fillIPxy) registry.fill(HIST("h3_jet_pt_sign_impact_parameter_xy_significance_flavour_N3"), mcdjet.pt(), vecSignImpXYSig[jetflavour][2], jetflavour, eventWeight); if (fillIPz) @@ -1093,6 +1113,66 @@ struct JetTaggerHFQA { } PROCESS_SWITCH(JetTaggerHFQA, processTracksDca, "Fill inclusive tracks' imformation for data", false); + void processTracksInJetsData(soa::Filtered::iterator const& collision, soa::Join const& jets) + { + if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + return; + } + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(jet)) { + continue; + } + for (auto const& track : jet.template tracks_as()) { + float varImpXY = track.dcaXY() * jettaggingutilities::cmTomum; + registry.fill(HIST("h2_track_pt_impact_parameter_xy"), track.pt(), varImpXY); + } + } + } + PROCESS_SWITCH(JetTaggerHFQA, processTracksInJetsData, "Fill QA comtamination of secondary-track inside jets for data jets", false); + + void processSecondaryContaminationMCD(soa::Filtered>::iterator const& collision, soa::Join const& mcdjets, JetTagTracksMCD const& /*tracks*/, aod::JetParticles const& /*particles*/) + { + if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + return; + } + for (auto const& mcdjet : mcdjets) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(mcdjet)) { + continue; + } + float pTHat = 10. / (std::pow(mcdjet.eventWeight(), 1.0 / pTHatExponent)); + if (mcdjet.pt() > pTHatMaxMCD * pTHat) { + continue; + } + int jetflavour = mcdjet.origin(); + float secondaryPt = 0; + float totalJetPt = 0; + for (auto const& track : mcdjet.template tracks_as()) { + float varImpXY = track.dcaXY() * jettaggingutilities::cmTomum; + if (!track.has_mcParticle()) + continue; + auto mcParticle = track.mcParticle(); + totalJetPt += track.pt(); + if (mcParticle.isPhysicalPrimary()) { + registry.fill(HIST("hn_jet_pt_track_pt_impact_parameter_xy_physical_primary_flavour"), mcdjet.pt(), track.pt(), varImpXY, jetflavour, mcdjet.eventWeight()); + } else { + registry.fill(HIST("hn_jet_pt_track_pt_impact_parameter_xy_secondary_flavour"), mcdjet.pt(), track.pt(), varImpXY, jetflavour, mcdjet.eventWeight()); + secondaryPt += track.pt(); + } + } + if (totalJetPt > 0) { + float fracSecondary = secondaryPt / totalJetPt; + registry.fill(HIST("h3_jet_pt_frac_secondary_pt_per_jet_flavour"), mcdjet.pt(), fracSecondary, jetflavour, mcdjet.eventWeight()); + } + } + } + PROCESS_SWITCH(JetTaggerHFQA, processSecondaryContaminationMCD, "Fill QA comtamination of secondary-track inside jets for mcd jets", false); + void processValFlavourDefMCD(soa::Filtered>::iterator const& collision, soa::Join const& mcdjets, soa::Join const& /*mcpjets*/, JetTagTracksMCD const& tracks, aod::JetParticles const& particles) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { @@ -1558,10 +1638,10 @@ using JetTaggerQAChargedDataJets = soa::Join; using JetTaggerQAChargedMCPJets = soa::Join; -using JetTaggerhfQACharged = JetTaggerHFQA; +using JetTaggerhfQaCharged = JetTaggerHFQA; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc, TaskName{"jet-taggerhf-qa-charged"})}; // o2-linter: disable=name/o2-task + adaptAnalysisTask(cfgc, TaskName{"jet-taggerhf-qa-charged"})}; // o2-linter: disable=name/o2-task (templated struct) } From fb19adbdf09e676a96efeb7f6a8cae21c6a12686 Mon Sep 17 00:00:00 2001 From: CyF1rmiana <3326561594@qq.com> Date: Fri, 5 Sep 2025 05:26:38 +0800 Subject: [PATCH 313/986] [PWGCF] Fix angle calculation (#12861) --- PWGCF/Flow/Tasks/flowEseTask.cxx | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowEseTask.cxx b/PWGCF/Flow/Tasks/flowEseTask.cxx index 74dc98bd528..09f852403bf 100644 --- a/PWGCF/Flow/Tasks/flowEseTask.cxx +++ b/PWGCF/Flow/Tasks/flowEseTask.cxx @@ -104,7 +104,7 @@ struct FlowEseTask { Configurable cfgV0EtaMax{"cfgV0EtaMax", 0.5, "maximum rapidity"}; Configurable cfgV0LifeTime{"cfgV0LifeTime", 30., "maximum lambda lifetime"}; - Configurable cfgQAv0{"cfgQAv0", true, "QA plot"}; + Configurable cfgQAv0{"cfgQAv0", false, "QA plot"}; Configurable cfgDaughTPCnclsMin{"cfgDaughTPCnclsMin", 70, "minimum fired crossed rows"}; Configurable cfgDaughPIDCutsTPCPr{"cfgDaughPIDCutsTPCPr", 5, "proton nsigma for TPC"}; @@ -125,7 +125,7 @@ struct FlowEseTask { Configurable cfgUSESP{"cfgUSESP", false, "cfg for sp"}; Configurable cfgPhiDepSig{"cfgPhiDepSig", 0.2, "cfg for significance on phi dependent study"}; - Configurable cfgShiftCorr{"cfgShiftCorr", true, "additional shift correction"}; + Configurable cfgShiftCorr{"cfgShiftCorr", false, "additional shift correction"}; Configurable cfgShiftCorrDef{"cfgShiftCorrDef", false, "additional shift correction definition"}; Configurable cfgShiftPath{"cfgShiftPath", "Users/j/junlee/Qvector/QvecCalib/Shift", "Path for Shift"}; @@ -511,6 +511,18 @@ struct FlowEseTask { return true; } + double safeATan2(double y, double x) + { + if (x != 0) + return std::atan2(y, x); + if (y == 0) + return 0; + if (y > 0) + return o2::constants::math::PIHalf; + else + return -o2::constants::math::PIHalf; + } + template void fillShiftCorrection(TCollision const& collision, int nmode) { @@ -668,7 +680,7 @@ struct FlowEseTask { qvecRefAInd = refAId * 4 + 3 + (nmode - 2) * cfgNQvec * 4; qvecRefBInd = refBId * 4 + 3 + (nmode - 2) * cfgNQvec * 4; - for (const auto& v0 : V0s) { + for (auto& v0 : V0s) { // o2-linter: disable=const-ref-in-for-loop(need to modify v0) auto postrack = v0.template posTrack_as(); auto negtrack = v0.template negTrack_as(); @@ -717,7 +729,7 @@ struct FlowEseTask { protonBoostedVec = boost(protonVec); angle = protonBoostedVec.Pz() / protonBoostedVec.P(); - psi = std::atan2(collision.qvecIm()[qvecDetInd], collision.qvecRe()[qvecDetInd]) / static_cast(nmode); + psi = safeATan2(collision.qvecIm()[qvecDetInd], collision.qvecRe()[qvecDetInd]) / static_cast(nmode); relphi = TVector2::Phi_0_2pi(static_cast(nmode) * (LambdaVec.Phi() - psi)); if (cfgShiftCorr) { @@ -975,8 +987,6 @@ struct FlowEseTask { if (!eventSelected(collision)) { return; } - histos.fill(HIST("QA/CentDist"), centrality, 1.0); - histos.fill(HIST("QA/PVzDist"), collision.posZ(), 1.0); if (cfgShiftCorr) { auto bc = collision.bc_as(); @@ -1062,7 +1072,7 @@ struct FlowEseTask { continue; if (std::abs(mcParticle.eta()) > kEtaAcceptance) // main acceptance continue; - histos.fill(HIST("hSparseMCGenWeight"), centclass, RecoDecay::constrainAngle(deltaPhi), std::pow(std::cos(2.0 * RecoDecay::constrainAngle(deltaPhi)), 2.0), mcParticle.pt(), mcParticle.eta()); + histos.fill(HIST("hSparseMCGenWeight"), centclass, RecoDecay::constrainAngle(deltaPhi, 0, 2), std::pow(std::cos(2.0 * RecoDecay::constrainAngle(deltaPhi, 0, 2)), 2.0), mcParticle.pt(), mcParticle.eta()); nCh++; bool validGlobal = false; bool validAny = false; @@ -1079,11 +1089,11 @@ struct FlowEseTask { } // if valid global, fill if (validGlobal) { - histos.fill(HIST("hSparseMCRecWeight"), centclass, RecoDecay::constrainAngle(deltaPhi), std::pow(std::cos(2.0 * RecoDecay::constrainAngle(deltaPhi)), 2.0), mcParticle.pt(), mcParticle.eta()); + histos.fill(HIST("hSparseMCRecWeight"), centclass, RecoDecay::constrainAngle(deltaPhi, 0, 2), std::pow(std::cos(2.0 * RecoDecay::constrainAngle(deltaPhi, 0, 2)), 2.0), mcParticle.pt(), mcParticle.eta()); } if (validAny) { - histos.fill(HIST("hSparseMCRecAllTrackWeight"), centclass, RecoDecay::constrainAngle(deltaPhi), std::pow(std::cos(2.0 * RecoDecay::constrainAngle(deltaPhi)), 2.0), mcParticle.pt(), mcParticle.eta()); - histos.fill(HIST("hEventPlaneAngleRec"), RecoDecay::constrainAngle(deltaPhi)); + histos.fill(HIST("hSparseMCRecAllTrackWeight"), centclass, RecoDecay::constrainAngle(deltaPhi, 0, 2), std::pow(std::cos(2.0 * RecoDecay::constrainAngle(deltaPhi, 0, 2)), 2.0), mcParticle.pt(), mcParticle.eta()); + histos.fill(HIST("hEventPlaneAngleRec"), RecoDecay::constrainAngle(deltaPhi, 0, 2)); } // if any track present, fill } From 8ab21f6c92aa4113096954cc6c06e0c5f7b4f083 Mon Sep 17 00:00:00 2001 From: Georgios Mantzaridis <62671855+gmantzar@users.noreply.github.com> Date: Thu, 4 Sep 2025 23:50:05 +0200 Subject: [PATCH 314/986] [PWGCF] - FemtoDream: Cascade Update (#12820) Co-authored-by: georgios --- .../Core/femtoDreamCascadeSelection.h | 22 +- .../FemtoDream/Core/femtoDreamParticleHisto.h | 21 +- PWGCF/FemtoDream/Core/femtoDreamSelection.h | 9 +- .../Core/femtoDreamTrackSelection.h | 25 +- PWGCF/FemtoDream/Core/femtoDreamUtils.h | 14 +- PWGCF/FemtoDream/Core/femtoDreamV0Selection.h | 123 ++--- PWGCF/FemtoDream/TableProducer/CMakeLists.txt | 2 +- .../TableProducer/femtoDreamProducerTask.cxx | 343 ++++++++++++-- PWGCF/FemtoDream/Tasks/CMakeLists.txt | 5 + .../Tasks/femtodreamPairCascadeCascade.cxx | 448 ++++++++++++++++++ 10 files changed, 871 insertions(+), 141 deletions(-) create mode 100644 PWGCF/FemtoDream/Tasks/femtodreamPairCascadeCascade.cxx diff --git a/PWGCF/FemtoDream/Core/femtoDreamCascadeSelection.h b/PWGCF/FemtoDream/Core/femtoDreamCascadeSelection.h index 2a07c851d09..f9b52686567 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamCascadeSelection.h +++ b/PWGCF/FemtoDream/Core/femtoDreamCascadeSelection.h @@ -22,21 +22,23 @@ #ifndef PWGCF_FEMTODREAM_CORE_FEMTODREAMCASCADESELECTION_H_ #define PWGCF_FEMTODREAM_CORE_FEMTODREAMCASCADESELECTION_H_ -#include -#include -#include - -#include // FIXME - #include "PWGCF/FemtoDream/Core/femtoDreamObjectSelection.h" #include "PWGCF/FemtoDream/Core/femtoDreamSelection.h" #include "PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h" #include "Common/Core/RecoDecay.h" + #include "Framework/HistogramRegistry.h" #include "ReconstructionDataFormats/PID.h" +#include // FIXME + +#include +#include +#include + using namespace o2::framework; +using namespace o2::analysis::femtoDream::femtoDreamSelection; namespace o2::analysis::femtoDream { @@ -346,8 +348,8 @@ class FemtoDreamCascadeSelection }; ///< Helper information for the ///< different selections - static constexpr int kNcutStages = 2; - static constexpr std::string_view mCutStage[kNcutStages] = {"BeforeSel", "AfterSel"}; + // static constexpr int kNcutStages = 2; + // static constexpr std::string_view mCutStage[kNcutStages] = {"BeforeSel", "AfterSel"}; }; // namespace femtoDream template @@ -663,6 +665,8 @@ void FemtoDreamCascadeSelection::fillQA(Col const& col, Casc const& casc, Track const float cpaCasc = casc.casccosPA(col.posX(), col.posY(), col.posZ()); const float cpav0 = casc.v0cosPA(col.posX(), col.posY(), col.posZ()); const float v0dcatopv = casc.dcav0topv(col.posX(), col.posY(), col.posZ()); + const float invMass = isCascOmega ? casc.mOmega() : casc.mXi(); + if (mQAHistogramRegistry) { mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(mCutStage[cutstage]) + HIST("/hSign"), casc.sign()); mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(mCutStage[cutstage]) + HIST("/hPt"), casc.pt()); @@ -674,7 +678,7 @@ void FemtoDreamCascadeSelection::fillQA(Col const& col, Casc const& casc, Track mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(mCutStage[cutstage]) + HIST("/hDecVtxX"), decVtx.at(0)); mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(mCutStage[cutstage]) + HIST("/hDecVtxY"), decVtx.at(1)); mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(mCutStage[cutstage]) + HIST("/hDecVtxZ"), decVtx.at(2)); - mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(mCutStage[cutstage]) + HIST("/hInvMass"), casc.mXi()); + mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(mCutStage[cutstage]) + HIST("/hInvMass"), invMass); mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(mCutStage[cutstage]) + HIST("/hV0DCADaugh"), casc.dcaV0daughters()); mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(mCutStage[cutstage]) + HIST("/hV0CPA"), cpav0); mQAHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + HIST("/") + HIST(mCutStage[cutstage]) + HIST("/hV0TranRad"), casc.v0radius()); diff --git a/PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h b/PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h index 4148e8b3efc..af1caf11879 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h +++ b/PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h @@ -18,11 +18,14 @@ #ifndef PWGCF_FEMTODREAM_CORE_FEMTODREAMPARTICLEHISTO_H_ #define PWGCF_FEMTODREAM_CORE_FEMTODREAMPARTICLEHISTO_H_ -#include -#include #include "PWGCF/DataModel/FemtoDerived.h" -#include "Framework/HistogramRegistry.h" + #include "CommonConstants/PhysicsConstants.h" +#include "Framework/HistogramRegistry.h" + +#include + +#include using namespace o2::framework; @@ -690,11 +693,13 @@ class FemtoDreamParticleHisto } private: - HistogramRegistry* mHistogramRegistry; ///< For QA output - static constexpr o2::aod::femtodreamparticle::ParticleType mParticleType = particleType; ///< Type of the particle under analysis - static constexpr int mFolderSuffixType = suffixType; ///< Counter for the folder suffix specified below - static constexpr std::string_view mFolderSuffix[9] = {"", "_one", "_two", "_pos", "_neg", "_allSelected", "_allSelected_pos", "_allSelected_neg", "_bach"}; ///< Suffix for the folder name in case of analyses of pairs of the same kind (T-T, V-V, C-C) - int mPDG = 0; ///< PDG code of the selected particle + HistogramRegistry* mHistogramRegistry; ///< For QA output + static constexpr o2::aod::femtodreamparticle::ParticleType mParticleType = particleType; ///< Type of the particle under analysis + static constexpr int mFolderSuffixType = suffixType; ///< Counter for the folder suffix specified below + static constexpr std::string_view mFolderSuffix[12] = {"", "_one", "_two", "_pos", "_neg", + "_allSelected", "_allSelected_pos", "_allSelected_neg", "_bach", + "_two_pos", "_two_neg", "_two_bach"}; ///< Suffix for the folder name in case of analyses of pairs of the same kind (T-T, V-V, C-C) + int mPDG = 0; ///< PDG code of the selected particle }; } // namespace o2::analysis::femtoDream diff --git a/PWGCF/FemtoDream/Core/femtoDreamSelection.h b/PWGCF/FemtoDream/Core/femtoDreamSelection.h index 0e3592bf650..90fd8f58046 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamSelection.h +++ b/PWGCF/FemtoDream/Core/femtoDreamSelection.h @@ -16,10 +16,12 @@ #ifndef PWGCF_FEMTODREAM_CORE_FEMTODREAMSELECTION_H_ #define PWGCF_FEMTODREAM_CORE_FEMTODREAMSELECTION_H_ -#include -#include "Framework/HistogramRegistry.h" #include "PWGCF/DataModel/FemtoDerived.h" +#include "Framework/HistogramRegistry.h" + +#include + using namespace o2; using namespace o2::framework; @@ -36,6 +38,9 @@ enum SelectionType { kUpperLimit, ///< simple upper limit for the value, e.g. kEqual ///< values need to be equal, e.g. sign = 1 }; +static constexpr int kNcutStages = 2; +static constexpr std::string_view mCutStage[kNcutStages] = {"BeforeSel", "AfterSel"}; + } // namespace femtoDreamSelection /// Simple class taking care of individual selections diff --git a/PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h b/PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h index 9cab0f9e78b..13d1ba5280b 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h +++ b/PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h @@ -17,22 +17,25 @@ #ifndef PWGCF_FEMTODREAM_CORE_FEMTODREAMTRACKSELECTION_H_ #define PWGCF_FEMTODREAM_CORE_FEMTODREAMTRACKSELECTION_H_ -#include -#include -#include -#include - #include "PWGCF/DataModel/FemtoDerived.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/PIDResponse.h" -#include "Common/DataModel/PIDResponseITS.h" +#include "PWGCF/FemtoDream/Core/femtoDreamObjectSelection.h" + #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectionDefaults.h" -#include "PWGCF/FemtoDream/Core/femtoDreamObjectSelection.h" -#include "ReconstructionDataFormats/PID.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseITS.h" +#include "Common/DataModel/TrackSelectionTables.h" + #include "Framework/HistogramRegistry.h" +#include "ReconstructionDataFormats/PID.h" + +#include +#include +#include +#include using namespace o2::framework; +using namespace o2::analysis::femtoDream::femtoDreamSelection; namespace o2::analysis::femtoDream { @@ -301,8 +304,6 @@ class FemtoDreamTrackSelection : public FemtoDreamObjectSelection diff --git a/PWGCF/FemtoDream/Core/femtoDreamUtils.h b/PWGCF/FemtoDream/Core/femtoDreamUtils.h index f9bb60633f3..3030a1b45ef 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamUtils.h +++ b/PWGCF/FemtoDream/Core/femtoDreamUtils.h @@ -16,11 +16,13 @@ #ifndef PWGCF_FEMTODREAM_CORE_FEMTODREAMUTILS_H_ #define PWGCF_FEMTODREAM_CORE_FEMTODREAMUTILS_H_ -#include -#include -#include "CommonConstants/PhysicsConstants.h" #include "PWGCF/DataModel/FemtoDerived.h" +#include "CommonConstants/PhysicsConstants.h" + +#include +#include + namespace o2::analysis::femtoDream { @@ -67,8 +69,12 @@ inline float getMass(int pdgCode) case o2::constants::physics::Pdg::kHelium3: mass = o2::constants::physics::MassHelium3; break; + // case o2::constants::physics::Pdg::kOmegaMinus: + case kOmegaMinus: + mass = o2::constants::physics::MassOmegaMinus; + break; default: - LOG(fatal) << "PDG code is not suppored"; + LOG(fatal) << "PDG code is not supported"; } return mass; } diff --git a/PWGCF/FemtoDream/Core/femtoDreamV0Selection.h b/PWGCF/FemtoDream/Core/femtoDreamV0Selection.h index 40158105a5b..3cd52ebd219 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamV0Selection.h +++ b/PWGCF/FemtoDream/Core/femtoDreamV0Selection.h @@ -18,19 +18,21 @@ #ifndef PWGCF_FEMTODREAM_CORE_FEMTODREAMV0SELECTION_H_ #define PWGCF_FEMTODREAM_CORE_FEMTODREAMV0SELECTION_H_ -#include -#include -#include - #include "PWGCF/FemtoDream/Core/femtoDreamObjectSelection.h" #include "PWGCF/FemtoDream/Core/femtoDreamSelection.h" #include "PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h" #include "Common/Core/RecoDecay.h" + #include "Framework/HistogramRegistry.h" #include "ReconstructionDataFormats/PID.h" +#include +#include +#include + using namespace o2::framework; +using namespace o2::analysis::femtoDream::femtoDreamSelection; namespace o2::analysis::femtoDream { @@ -91,7 +93,8 @@ class FemtoDreamV0Selection T const& posTrack, T const& negTrack); - template void fillQA(C const& col, V const& v0, T const& posTrack, T const& negTrack); @@ -296,43 +299,46 @@ void FemtoDreamV0Selection::init(HistogramRegistry* QAregistry, HistogramRegistr LOG(fatal) << "FemtoDreamV0Cuts: Number of selections to large for your " "container - quitting!"; } - std::string folderName = static_cast( - o2::aod::femtodreamparticle::ParticleTypeName[part]); - /// \todo initialize histograms for children tracks of v0s - mQAHistogramRegistry->add((folderName + "/hPt").c_str(), - "; #it{p}_{T} (GeV/#it{c}); Entries", kTH1F, - {{1000, 0, 10}}); - mQAHistogramRegistry->add((folderName + "/hEta").c_str(), "; #eta; Entries", - kTH1F, {{1000, -1, 1}}); - mQAHistogramRegistry->add((folderName + "/hPhi").c_str(), "; #phi; Entries", - kTH1F, {{1000, 0, 2. * M_PI}}); - mQAHistogramRegistry->add((folderName + "/hDaughDCA").c_str(), - "; DCA^{daugh} (cm); Entries", kTH1F, - {{1000, 0, 10}}); - mQAHistogramRegistry->add((folderName + "/hTransRadius").c_str(), - "; #it{r}_{xy} (cm); Entries", kTH1F, - {{1500, 0, 150}}); - mQAHistogramRegistry->add((folderName + "/hDecayVtxX").c_str(), - "; #it{Vtx}_{x} (cm); Entries", kTH1F, - {{2000, 0, 200}}); - mQAHistogramRegistry->add((folderName + "/hDecayVtxY").c_str(), - "; #it{Vtx}_{y} (cm)); Entries", kTH1F, - {{2000, 0, 200}}); - mQAHistogramRegistry->add((folderName + "/hDecayVtxZ").c_str(), - "; #it{Vtx}_{z} (cm); Entries", kTH1F, - {{2000, 0, 200}}); - mQAHistogramRegistry->add((folderName + "/hCPA").c_str(), - "; #it{cos #theta_{p}}; Entries", kTH1F, - {{1000, 0.9, 1.}}); - mQAHistogramRegistry->add((folderName + "/hCPAvsPt").c_str(), - "; #it{p}_{T} (GeV/#it{c}); #it{cos #theta_{p}}", - kTH2F, {{8, 0.3, 4.3}, {1000, 0.9, 1.}}); - mQAHistogramRegistry->add((folderName + "/hInvMassLambda").c_str(), "", kTH1F, - {massAxisLambda}); - mQAHistogramRegistry->add((folderName + "/hInvMassAntiLambda").c_str(), "", - kTH1F, {massAxisAntiLambda}); - mQAHistogramRegistry->add((folderName + "/hInvMassLambdaAntiLambda").c_str(), - "", kTH2F, {massAxisLambda, massAxisAntiLambda}); + for (int istage = 0; istage < kNcutStages; istage++) { + std::string folderName = + static_cast(o2::aod::femtodreamparticle::ParticleTypeName[part]) + "/" + + static_cast(mCutStage[istage]); + /// \todo initialize histograms for children tracks of v0s + mQAHistogramRegistry->add((folderName + "/hPt").c_str(), + "; #it{p}_{T} (GeV/#it{c}); Entries", kTH1F, + {{1000, 0, 10}}); + mQAHistogramRegistry->add((folderName + "/hEta").c_str(), "; #eta; Entries", + kTH1F, {{1000, -1, 1}}); + mQAHistogramRegistry->add((folderName + "/hPhi").c_str(), "; #phi; Entries", + kTH1F, {{1000, 0, 2. * M_PI}}); + mQAHistogramRegistry->add((folderName + "/hDaughDCA").c_str(), + "; DCA^{daugh} (cm); Entries", kTH1F, + {{1000, 0, 10}}); + mQAHistogramRegistry->add((folderName + "/hTransRadius").c_str(), + "; #it{r}_{xy} (cm); Entries", kTH1F, + {{1500, 0, 150}}); + mQAHistogramRegistry->add((folderName + "/hDecayVtxX").c_str(), + "; #it{Vtx}_{x} (cm); Entries", kTH1F, + {{2000, 0, 200}}); + mQAHistogramRegistry->add((folderName + "/hDecayVtxY").c_str(), + "; #it{Vtx}_{y} (cm)); Entries", kTH1F, + {{2000, 0, 200}}); + mQAHistogramRegistry->add((folderName + "/hDecayVtxZ").c_str(), + "; #it{Vtx}_{z} (cm); Entries", kTH1F, + {{2000, 0, 200}}); + mQAHistogramRegistry->add((folderName + "/hCPA").c_str(), + "; #it{cos #theta_{p}}; Entries", kTH1F, + {{1000, 0.9, 1.}}); + mQAHistogramRegistry->add((folderName + "/hCPAvsPt").c_str(), + "; #it{p}_{T} (GeV/#it{c}); #it{cos #theta_{p}}", + kTH2F, {{8, 0.3, 4.3}, {1000, 0.9, 1.}}); + mQAHistogramRegistry->add((folderName + "/hInvMassLambda").c_str(), "", kTH1F, + {massAxisLambda}); + mQAHistogramRegistry->add((folderName + "/hInvMassAntiLambda").c_str(), "", + kTH1F, {massAxisAntiLambda}); + mQAHistogramRegistry->add((folderName + "/hInvMassLambdaAntiLambda").c_str(), + "", kTH2F, {massAxisLambda, massAxisAntiLambda}); + } PosDaughTrack.init outputNegTrack.at(femtoDreamTrackSelection::TrackContainerPosition::kPID)}; } -template void FemtoDreamV0Selection::fillQA(C const& /*col*/, V const& v0, T const& posTrack, @@ -645,62 +652,62 @@ void FemtoDreamV0Selection::fillQA(C const& /*col*/, V const& v0, T const& posTr if (mQAHistogramRegistry) { mQAHistogramRegistry->fill( HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + - HIST("/hPt"), + HIST("/") + HIST(mCutStage[cutstage]) + HIST("/hPt"), v0.pt()); mQAHistogramRegistry->fill( HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + - HIST("/hEta"), + HIST("/") + HIST(mCutStage[cutstage]) + HIST("/hEta"), v0.eta()); mQAHistogramRegistry->fill( HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + - HIST("/hPhi"), + HIST("/") + HIST(mCutStage[cutstage]) + HIST("/hPhi"), v0.phi()); mQAHistogramRegistry->fill( HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + - HIST("/hDaughDCA"), + HIST("/") + HIST(mCutStage[cutstage]) + HIST("/hDaughDCA"), v0.dcaV0daughters()); mQAHistogramRegistry->fill( HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + - HIST("/hTransRadius"), + HIST("/") + HIST(mCutStage[cutstage]) + HIST("/hTransRadius"), v0.v0radius()); mQAHistogramRegistry->fill( HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + - HIST("/hDecayVtxX"), + HIST("/") + HIST(mCutStage[cutstage]) + HIST("/hDecayVtxX"), v0.x()); mQAHistogramRegistry->fill( HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + - HIST("/hDecayVtxY"), + HIST("/") + HIST(mCutStage[cutstage]) + HIST("/hDecayVtxY"), v0.y()); mQAHistogramRegistry->fill( HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + - HIST("/hDecayVtxZ"), + HIST("/") + HIST(mCutStage[cutstage]) + HIST("/hDecayVtxZ"), v0.z()); mQAHistogramRegistry->fill( HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + - HIST("/hCPA"), + HIST("/") + HIST(mCutStage[cutstage]) + HIST("/hCPA"), v0.v0cosPA()); mQAHistogramRegistry->fill( HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + - HIST("/hCPAvsPt"), + HIST("/") + HIST(mCutStage[cutstage]) + HIST("/hCPAvsPt"), v0.pt(), v0.v0cosPA()); mQAHistogramRegistry->fill( HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + - HIST("/hInvMassLambda"), + HIST("/") + HIST(mCutStage[cutstage]) + HIST("/hInvMassLambda"), v0.mLambda()); mQAHistogramRegistry->fill( HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + - HIST("/hInvMassAntiLambda"), + HIST("/") + HIST(mCutStage[cutstage]) + HIST("/hInvMassAntiLambda"), v0.mAntiLambda()); mQAHistogramRegistry->fill( HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + - HIST("/hInvMassLambdaAntiLambda"), + HIST("/") + HIST(mCutStage[cutstage]) + HIST("/hInvMassLambdaAntiLambda"), v0.mLambda(), v0.mAntiLambda()); } PosDaughTrack.fillQA(posTrack); + aod::femtodreamparticle::TrackType::kPosChild, cutstage>(posTrack); NegDaughTrack.fillQA(negTrack); + aod::femtodreamparticle::TrackType::kNegChild, cutstage>(negTrack); } } // namespace o2::analysis::femtoDream diff --git a/PWGCF/FemtoDream/TableProducer/CMakeLists.txt b/PWGCF/FemtoDream/TableProducer/CMakeLists.txt index 3af1c541683..6085904e73e 100644 --- a/PWGCF/FemtoDream/TableProducer/CMakeLists.txt +++ b/PWGCF/FemtoDream/TableProducer/CMakeLists.txt @@ -22,4 +22,4 @@ o2physics_add_dpl_workflow(femtodream-producer-reduced o2physics_add_dpl_workflow(femtodream-producer-for-specific-analysis SOURCES femtoDreamProducerTaskForSpecificAnalysis.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore - COMPONENT_NAME Analysis) + COMPONENT_NAME Analysis) \ No newline at end of file diff --git a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx index f311518c56b..2103cf6f305 100644 --- a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx +++ b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx @@ -131,6 +131,7 @@ struct femtoDreamProducerTask { Configurable ConfEvtAddOfflineCheck{"ConfEvtAddOfflineCheck", false, "Evt sel: additional checks for offline selection (not part of sel8 yet)"}; Configurable ConfIsActivateV0{"ConfIsActivateV0", true, "Activate filling of V0 into femtodream tables"}; Configurable ConfIsActivateReso{"ConfIsActivateReso", false, "Activate filling of sl Resonances into femtodream tables"}; + Configurable ConfIsActivateCascade{"ConfIsActivateCascade", false, "Activate filling of Cascades into femtodream tables"}; Configurable ConfEvtMinSphericity{"ConfEvtMinSphericity", 0.0f, "Evt sel: Min. sphericity of event"}; Configurable ConfEvtSphericityPtmin{"ConfEvtSphericityPtmin", 0.0f, "Evt sel: Min. Pt for sphericity calculation"}; @@ -179,22 +180,72 @@ struct femtoDreamProducerTask { Configurable> ConfChildPIDnSigmaMax{"ConfChildPIDnSigmaMax", std::vector{5.f, 4.f}, "V0 Child sel: Max. PID nSigma TPC"}; Configurable> ConfChildPIDspecies{"ConfChildPIDspecies", std::vector{o2::track::PID::Pion, o2::track::PID::Proton}, "V0 Child sel: Particles species for PID"}; + FemtoDreamCascadeSelection cascadeCuts; + struct : o2::framework::ConfigurableGroup { + Configurable ConfCascInvMassLowLimit{"ConfCascInvMassLowLimit", 1.2, "Lower limit of the Cascade invariant mass"}; + Configurable ConfCascInvMassUpLimit{"ConfCascInvMassUpLimit", 1.5, "Upper limit of the Cascade invariant mass"}; + Configurable ConfCascIsSelectedOmega{"ConfCascIsSelectedOmega", false, "Select Omegas instead of Xis (invariant mass)"}; + // Cascade + Configurable> ConfCascadeSign{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadeSign, "ConfCascade"), std::vector{-1, 1}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadeSign, "Cascade selection: ")}; + Configurable> ConfCascadePtMin{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadePtMin, "ConfCascade"), std::vector{0.3f, 0.4f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadePtMin, "Cascade selection: ")}; + Configurable> ConfCascadePtMax{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadePtMax, "ConfCascade"), std::vector{5.5f, 6.0f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadePtMax, "Cascade selection: ")}; + Configurable> ConfCascadeEtaMax{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadeEtaMax, "ConfCascade"), std::vector{0.8f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadeEtaMax, "Cascade selection: ")}; + Configurable> ConfCascadeDCADaughMax{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadeDCADaughMax, "ConfCascade"), std::vector{1.f, 1.2f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadeDCADaughMax, "Cascade selection: ")}; + Configurable> ConfCascadeCPAMin{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadeCPAMin, "ConfCascade"), std::vector{0.99f, 0.95f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadeCPAMin, "Cascade selection: ")}; + Configurable> ConfCascadeTranRadMin{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadeTranRadMin, "ConfCascade"), std::vector{0.2f, 0.5f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadeTranRadMin, "Cascade selection: ")}; + Configurable> ConfCascadeTranRadMax{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadeTranRadMax, "ConfCascade"), std::vector{100.f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadeTranRadMax, "Cascade selection: ")}; + Configurable> ConfCascadeDecVtxMax{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadeDecVtxMax, "ConfCascade"), std::vector{100.f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadeDecVtxMax, "Cascade selection: ")}; + + // Cascade v0 daughters + Configurable> ConfCascadeV0DCADaughMax{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadeV0DCADaughMax, "ConfCascade"), std::vector{1.2f, 1.5f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadeV0DCADaughMax, "CascV0 selection: ")}; + Configurable> ConfCascadeV0CPAMin{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadeV0CPAMin, "ConfCascade"), std::vector{0.99f, 0.995f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadeV0CPAMin, "CascV0 selection: ")}; + Configurable> ConfCascadeV0TranRadMin{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadeV0TranRadMin, "ConfCascade"), std::vector{0.2f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadeV0TranRadMin, "CascV0 selection: ")}; + Configurable> ConfCascadeV0TranRadMax{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadeV0TranRadMax, "ConfCascade"), std::vector{100.f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadeV0TranRadMax, "CascV0 selection: ")}; + Configurable> ConfCascadeV0DCAtoPVMin{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadeV0DCAtoPVMin, "ConfCascade"), std::vector{100.f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadeV0DCAtoPVMin, "CascV0 selection: ")}; + Configurable> ConfCascadeV0DCAtoPVMax{FemtoDreamCascadeSelection::getSelectionName(femtoDreamCascadeSelection::kCascadeV0DCAtoPVMax, "ConfCascade"), std::vector{100.f}, FemtoDreamCascadeSelection::getSelectionHelper(femtoDreamCascadeSelection::kCascadeV0DCAtoPVMax, "CascV0 selection: ")}; + Configurable ConfCascV0InvMassLowLimit{"ConfCascV0InvMassLowLimit", 1.011461, "Lower limit of the Cascade invariant mass"}; + Configurable ConfCascV0InvMassUpLimit{"ConfCascV0InvMassUpLimit", 1.027461, "Upper limit of the Cascade invariant mass"}; + // Cascade Daughter Tracks + Configurable> ConfCascV0ChildCharge{"ConfCascV0ChildSign", std::vector{-1, 1}, "CascV0 Child sel: Charge"}; + Configurable> ConfCascV0ChildPtMin{"ConfCascV0ChildPtMin", std::vector{0.8f}, "CascV0 Child sel: min pt"}; + Configurable> ConfCascV0ChildEtaMax{"ConfCascV0ChildEtaMax", std::vector{0.8f}, "CascV0 Child sel: max eta"}; + Configurable> ConfCascV0ChildTPCnClsMin{"ConfCascV0ChildTPCnClsMin", std::vector{80.f, 70.f, 60.f}, "CascV0 Child sel: Min. nCls TPC"}; + Configurable> ConfCascV0ChildDCAMin{"ConfCascV0ChildDCAMin", std::vector{0.05f, 0.06f}, "CascV0 Child sel: Max. DCA Daugh to PV (cm)"}; + Configurable> ConfCascV0ChildPIDnSigmaMax{"ConfCascV0ChildPIDnSigmaMax", std::vector{5.f, 4.f}, "CascV0 Child sel: Max. PID nSigma TPC"}; + Configurable> ConfCascV0ChildPIDspecies{"ConfCascV0ChildPIDspecies", std::vector{o2::track::PID::Pion, o2::track::PID::Proton}, "CascV0 Child sel: Particles species for PID"}; + // Cascade Bachelor Track + Configurable> ConfCascBachelorCharge{"ConfCascBachelorSign", std::vector{-1, 1}, "Cascade Bachelor sel: Charge"}; + Configurable> ConfCascBachelorPtMin{"ConfCascBachelorPtMin", std::vector{0.8f}, "Cascade Bachelor sel: min pt"}; + Configurable> ConfCascBachelorEtaMax{"ConfCascBachelorEtaMax", std::vector{0.8f}, "Cascade Bachelor sel: max eta"}; + Configurable> ConfCascBachelorTPCnClsMin{"ConfCascBachelorTPCnClsMin", std::vector{80.f, 70.f, 60.f}, "Cascade Bachelor sel: Min. nCls TPC"}; + Configurable> ConfCascBachelorDCAMin{"ConfCascBachelorDCAMin", std::vector{0.05f, 0.06f}, "Cascade Bachelor sel: Max. DCA Daugh to PV (cm)"}; + Configurable> ConfCascBachelorPIDnSigmaMax{"ConfCascBachelorPIDnSigmaMax", std::vector{5.f, 4.f}, "Cascade Bachelor sel: Max. PID nSigma TPC"}; + Configurable> ConfCascBachelorPIDspecies{"ConfCascBachelorPIDspecies", std::vector{o2::track::PID::Pion}, "Cascade Bachelor sel: Particles species for PID"}; + + Configurable ConfCascRejectCompetingMass{"ConfCascRejectCompetingMass", false, "Switch on to reject Omegas (for Xi) or Xis (for Omegas)"}; + Configurable ConfCascInvCompetingMassLowLimit{"ConfCascInvCompetingMassLowLimit", 1.66, "Lower limit of the cascade invariant mass for competing mass rejection"}; + Configurable ConfCascInvCompetingMassUpLimit{"ConfCascInvCompetingMassUpLimit", 1.68, "Upper limit of the cascade invariant mass for competing mass rejection"}; + + } ConfCascSel; + // Resonances - Configurable ConfResoInvMassLowLimit{"ConfResoInvMassLowLimit", 1.011461, "Lower limit of the Reso invariant mass"}; - Configurable ConfResoInvMassUpLimit{"ConfResoInvMassUpLimit", 1.027461, "Upper limit of the Reso invariant mass"}; - Configurable> ConfDaughterCharge{"ConfDaughterCharge", std::vector{1, -1}, "Reso Daughter sel: Charge"}; - Configurable> ConfDaughterEta{"ConfDaughterEta", std::vector{0.8, 0.8}, "Reso Daughter sel: Eta"}; // 0.8 - Configurable> ConfDaughterDCAxy{"ConfDaughterDCAxy", std::vector{0.1, 0.1}, "Reso Daughter sel: DCAxy"}; // 0.1 - Configurable> ConfDaughterDCAz{"ConfDaughterDCAz", std::vector{0.2, 0.2}, "Reso Daughter sel: DCAz"}; // 0.2 - Configurable> ConfDaughterNClus{"ConfDaughterNClus", std::vector{80, 80}, "Reso Daughter sel: NClusters"}; // 0.2 - Configurable> ConfDaughterNCrossed{"ConfDaughterNCrossed", std::vector{70, 70}, "Reso Daughter sel: NCrossedRowss"}; - Configurable> ConfDaughterTPCfCls{"ConfDaughterTPCfCls", std::vector{0.8, 0.8}, "Reso Daughter sel: Minimum fraction of crossed rows over findable cluster"}; // 0.2 - Configurable> ConfDaughterPtUp{"ConfDaughterPtUp", std::vector{2.0, 2.0}, "Reso Daughter sel: Upper limit pT"}; // 2.0 - Configurable> ConfDaughterPtLow{"ConfDaughterPtLow", std::vector{0.15, 0.15}, "Reso Daughter sel: Lower limit pT"}; // 0.15 - Configurable> ConfDaughterPTPCThr{"ConfDaughterPTPCThr", std::vector{0.40, 0.40}, "Reso Daughter sel: momentum threshold TPC only PID, p_TPC,Thr"}; // 0.4 - Configurable> ConfDaughterPIDnSigmaMax{"ConfDaughterPIDnSigmaMax", std::vector{3.00, 3.00}, "Reso Daughter sel: Max. PID nSigma TPC"}; // 3.0 - Configurable> ConfDaughterPIDspecies{"ConfDaughterPIDspecies", std::vector{o2::track::PID::Kaon, o2::track::PID::Kaon}, "Reso Daughter sel: Particles species for PID"}; - Configurable> ConfDaug1Daugh2ResoMass{"ConfDaug1Daugh2ResoMass", std::vector{o2::constants::physics::MassKPlus, o2::constants::physics::MassKMinus, o2::constants::physics::MassPhi}, "Masses: Daughter1 - Daughter2 - Resonance"}; + struct : o2::framework::ConfigurableGroup { + Configurable ConfResoInvMassLowLimit{"ConfResoInvMassLowLimit", 1.011461, "Lower limit of the Reso invariant mass"}; + Configurable ConfResoInvMassUpLimit{"ConfResoInvMassUpLimit", 1.027461, "Upper limit of the Reso invariant mass"}; + Configurable> ConfDaughterCharge{"ConfDaughterCharge", std::vector{1, -1}, "Reso Daughter sel: Charge"}; + Configurable> ConfDaughterEta{"ConfDaughterEta", std::vector{0.8, 0.8}, "Reso Daughter sel: Eta"}; // 0.8 + Configurable> ConfDaughterDCAxy{"ConfDaughterDCAxy", std::vector{0.1, 0.1}, "Reso Daughter sel: DCAxy"}; // 0.1 + Configurable> ConfDaughterDCAz{"ConfDaughterDCAz", std::vector{0.2, 0.2}, "Reso Daughter sel: DCAz"}; // 0.2 + Configurable> ConfDaughterNClus{"ConfDaughterNClus", std::vector{80, 80}, "Reso Daughter sel: NClusters"}; // 0.2 + Configurable> ConfDaughterNCrossed{"ConfDaughterNCrossed", std::vector{70, 70}, "Reso Daughter sel: NCrossedRowss"}; + Configurable> ConfDaughterTPCfCls{"ConfDaughterTPCfCls", std::vector{0.8, 0.8}, "Reso Daughter sel: Minimum fraction of crossed rows over findable cluster"}; // 0.2 + Configurable> ConfDaughterPtUp{"ConfDaughterPtUp", std::vector{2.0, 2.0}, "Reso Daughter sel: Upper limit pT"}; // 2.0 + Configurable> ConfDaughterPtLow{"ConfDaughterPtLow", std::vector{0.15, 0.15}, "Reso Daughter sel: Lower limit pT"}; // 0.15 + Configurable> ConfDaughterPTPCThr{"ConfDaughterPTPCThr", std::vector{0.40, 0.40}, "Reso Daughter sel: momentum threshold TPC only PID, p_TPC,Thr"}; // 0.4 + Configurable> ConfDaughterPIDnSigmaMax{"ConfDaughterPIDnSigmaMax", std::vector{3.00, 3.00}, "Reso Daughter sel: Max. PID nSigma TPC"}; // 3.0 + Configurable> ConfDaughterPIDspecies{"ConfDaughterPIDspecies", std::vector{o2::track::PID::Kaon, o2::track::PID::Kaon}, "Reso Daughter sel: Particles species for PID"}; + Configurable> ConfDaug1Daugh2ResoMass{"ConfDaug1Daugh2ResoMass", std::vector{o2::constants::physics::MassKPlus, o2::constants::physics::MassKMinus, o2::constants::physics::MassPhi}, "Masses: Daughter1 - Daughter2 - Resonance"}; + } ConfResoSel; /// \todo should we add filter on min value pT/eta of V0 and daughters? /*Filter v0Filter = (nabs(aod::v0data::x) < V0DecVtxMax.value) && @@ -223,6 +274,7 @@ struct femtoDreamProducerTask { HistogramRegistry TrackRegistry{"Tracks", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry V0Registry{"V0", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry ResoRegistry{"Reso", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry CascadeRegistry{"Cascade", {}, OutputObjHandlingPolicy::AnalysisObject}; int mRunNumber; float mMagField; @@ -250,6 +302,7 @@ struct femtoDreamProducerTask { TrackRegistry.add("AnalysisQA/Mother", "; Bit; Entries", kTH1F, {{4000, -4000, 4000}}); TrackRegistry.add("AnalysisQA/Particle", "; Bit; Entries", kTH1F, {{4000, -4000, 4000}}); V0Registry.add("AnalysisQA/CutCounter", "; Bit; Counter", kTH1F, {{CutBits + 1, -0.5, CutBits + 0.5}}); + CascadeRegistry.add("AnalysisQA/CutCounter", "; Bit; Counter", kTH1F, {{CutBits + 1, -0.5, CutBits + 0.5}}); ResoRegistry.add("AnalysisQA/Reso/InvMass", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.8, 1.5}}); ResoRegistry.add("AnalysisQA/Reso/InvMass_selected", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.8, 1.5}}); ResoRegistry.add("AnalysisQA/Reso/Daughter1/Pt", "Transverse momentum of all processed tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); @@ -333,6 +386,58 @@ struct femtoDreamProducerTask { v0Cuts.setKaonInvMassLimits(ConfV0InvKaonMassLowLimit, ConfV0InvKaonMassUpLimit); } } + if (ConfIsActivateCascade) { + // Cascades + cascadeCuts.setSelection(ConfCascSel.ConfCascadeSign, femtoDreamCascadeSelection::kCascadeSign, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadeSign)); + cascadeCuts.setSelection(ConfCascSel.ConfCascadePtMin, femtoDreamCascadeSelection::kCascadePtMin, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadePtMin)); + cascadeCuts.setSelection(ConfCascSel.ConfCascadePtMax, femtoDreamCascadeSelection::kCascadePtMax, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadePtMax)); + cascadeCuts.setSelection(ConfCascSel.ConfCascadeEtaMax, femtoDreamCascadeSelection::kCascadeEtaMax, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadeEtaMax)); + cascadeCuts.setSelection(ConfCascSel.ConfCascadeDCADaughMax, femtoDreamCascadeSelection::kCascadeDCADaughMax, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadeDCADaughMax)); + cascadeCuts.setSelection(ConfCascSel.ConfCascadeCPAMin, femtoDreamCascadeSelection::kCascadeCPAMin, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadeCPAMin)); + cascadeCuts.setSelection(ConfCascSel.ConfCascadeTranRadMin, femtoDreamCascadeSelection::kCascadeTranRadMin, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadeTranRadMin)); + cascadeCuts.setSelection(ConfCascSel.ConfCascadeTranRadMax, femtoDreamCascadeSelection::kCascadeTranRadMax, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadeTranRadMax)); + cascadeCuts.setSelection(ConfCascSel.ConfCascadeDecVtxMax, femtoDreamCascadeSelection::kCascadeDecVtxMax, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadeDecVtxMax)); + // Cascade v0 + cascadeCuts.setSelection(ConfCascSel.ConfCascadeV0DCADaughMax, femtoDreamCascadeSelection::kCascadeV0DCADaughMax, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadeV0DCADaughMax)); + cascadeCuts.setSelection(ConfCascSel.ConfCascadeV0CPAMin, femtoDreamCascadeSelection::kCascadeV0CPAMin, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadeV0CPAMin)); + cascadeCuts.setSelection(ConfCascSel.ConfCascadeV0TranRadMin, femtoDreamCascadeSelection::kCascadeV0TranRadMin, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadeV0TranRadMin)); + cascadeCuts.setSelection(ConfCascSel.ConfCascadeV0TranRadMax, femtoDreamCascadeSelection::kCascadeV0TranRadMax, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadeV0TranRadMax)); + cascadeCuts.setSelection(ConfCascSel.ConfCascadeV0DCAtoPVMin, femtoDreamCascadeSelection::kCascadeV0DCAtoPVMin, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadeV0DCAtoPVMin)); + cascadeCuts.setSelection(ConfCascSel.ConfCascadeV0DCAtoPVMax, femtoDreamCascadeSelection::kCascadeV0DCAtoPVMax, FemtoDreamCascadeSelection::getSelectionType(femtoDreamCascadeSelection::kCascadeV0DCAtoPVMax)); + + // Cascade Daughter Tracks + cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kPosTrack, ConfCascSel.ConfCascV0ChildCharge, femtoDreamTrackSelection::kSign, femtoDreamSelection::kEqual); + cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kPosTrack, ConfCascSel.ConfCascV0ChildPtMin, femtoDreamTrackSelection::kpTMin, femtoDreamSelection::kLowerLimit); + cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kPosTrack, ConfCascSel.ConfCascV0ChildEtaMax, femtoDreamTrackSelection::kEtaMax, femtoDreamSelection::kAbsUpperLimit); + cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kPosTrack, ConfCascSel.ConfCascV0ChildTPCnClsMin, femtoDreamTrackSelection::kTPCnClsMin, femtoDreamSelection::kLowerLimit); + cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kPosTrack, ConfCascSel.ConfCascV0ChildDCAMin, femtoDreamTrackSelection::kDCAMin, femtoDreamSelection::kAbsLowerLimit); + cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kPosTrack, ConfCascSel.ConfCascV0ChildPIDnSigmaMax, femtoDreamTrackSelection::kPIDnSigmaMax, femtoDreamSelection::kAbsUpperLimit); + cascadeCuts.setChildPIDSpecies(femtoDreamCascadeSelection::kPosTrack, ConfCascSel.ConfCascV0ChildPIDspecies); + + cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kNegTrack, ConfCascSel.ConfCascV0ChildCharge, femtoDreamTrackSelection::kSign, femtoDreamSelection::kEqual); + cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kNegTrack, ConfCascSel.ConfCascV0ChildPtMin, femtoDreamTrackSelection::kpTMin, femtoDreamSelection::kLowerLimit); + cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kNegTrack, ConfCascSel.ConfCascV0ChildEtaMax, femtoDreamTrackSelection::kEtaMax, femtoDreamSelection::kAbsUpperLimit); + cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kNegTrack, ConfCascSel.ConfCascV0ChildTPCnClsMin, femtoDreamTrackSelection::kTPCnClsMin, femtoDreamSelection::kLowerLimit); + cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kNegTrack, ConfCascSel.ConfCascV0ChildDCAMin, femtoDreamTrackSelection::kDCAMin, femtoDreamSelection::kAbsLowerLimit); + cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kNegTrack, ConfCascSel.ConfCascV0ChildPIDnSigmaMax, femtoDreamTrackSelection::kPIDnSigmaMax, femtoDreamSelection::kAbsUpperLimit); + cascadeCuts.setChildPIDSpecies(femtoDreamCascadeSelection::kNegTrack, ConfCascSel.ConfCascV0ChildPIDspecies); + + // Cascade Bachelor Track + cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kBachTrack, ConfCascSel.ConfCascBachelorCharge, femtoDreamTrackSelection::kSign, femtoDreamSelection::kEqual); + cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kBachTrack, ConfCascSel.ConfCascBachelorPtMin, femtoDreamTrackSelection::kpTMin, femtoDreamSelection::kLowerLimit); + cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kBachTrack, ConfCascSel.ConfCascBachelorEtaMax, femtoDreamTrackSelection::kEtaMax, femtoDreamSelection::kAbsUpperLimit); + cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kBachTrack, ConfCascSel.ConfCascBachelorTPCnClsMin, femtoDreamTrackSelection::kTPCnClsMin, femtoDreamSelection::kLowerLimit); + cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kBachTrack, ConfCascSel.ConfCascBachelorDCAMin, femtoDreamTrackSelection::kDCAMin, femtoDreamSelection::kAbsLowerLimit); + cascadeCuts.setChildCuts(femtoDreamCascadeSelection::kBachTrack, ConfCascSel.ConfCascBachelorPIDnSigmaMax, femtoDreamTrackSelection::kPIDnSigmaMax, femtoDreamSelection::kAbsUpperLimit); + cascadeCuts.setChildPIDSpecies(femtoDreamCascadeSelection::kBachTrack, ConfCascSel.ConfCascBachelorPIDspecies); + + cascadeCuts.init(&qaRegistry, &CascadeRegistry, ConfCascSel.ConfCascIsSelectedOmega); + cascadeCuts.setInvMassLimits(ConfCascSel.ConfCascInvMassLowLimit, ConfCascSel.ConfCascInvMassUpLimit); + cascadeCuts.setV0InvMassLimits(ConfCascSel.ConfCascV0InvMassLowLimit, ConfCascSel.ConfCascV0InvMassUpLimit); + if (ConfCascSel.ConfCascRejectCompetingMass) { + cascadeCuts.setCompetingInvMassLimits(ConfCascSel.ConfCascInvCompetingMassLowLimit, ConfCascSel.ConfCascInvCompetingMassUpLimit); + } + } mRunNumber = 0; mMagField = 0.0; @@ -474,6 +579,29 @@ struct femtoDreamProducerTask { } } + template + void fillDebugCascade(ParticleType const& cascade, CollisionType const& col) + { + outputDebugParts(cascade.sign(), // sign + -999., -999., -999., -999., -999., -999., -999., -999., -999., // track properties (DCA, NCls, crossed rows, etc.) + -999., -999., -999., -999., -999., -999., -999., -999., // TPC PID (TPC signal + particle hypothesis) + -999., -999., -999., -999., -999., -999., -999., // TOF PID + -999., -999., -999., -999., -999., -999., -999., -999., // ITS PID + cascade.dcaV0daughters(), + cascade.v0radius(), + -999., // DecVtxV0 x + -999., // DecVtxV0 y + -999., // DecVtxV0 z + -999., // mKaon + cascade.dcav0topv(col.posX(), col.posY(), col.posZ()), + cascade.dcacascdaughters(), + cascade.cascradius(), + cascade.x(), + cascade.y(), + cascade.z(), + cascade.mOmega()); // QA for Reso + } + template void fillMCParticle(CollisionType const& col, ParticleType const& particle, o2::aod::femtodreamparticle::ParticleType fdparttype) { @@ -547,8 +675,8 @@ struct femtoDreamProducerTask { outputCollsMCLabels(-1); } } - template - void fillCollisionsAndTracksAndV0(CollisionType const& col, TrackType const& tracks, TrackTypeWithItsPid const& tracksWithItsPid, V0Type const& fullV0s) + template + void fillCollisionsAndTracksAndV0AndCascade(CollisionType const& col, TrackType const& tracks, TrackTypeWithItsPid const& tracksWithItsPid, V0Type const& fullV0s, CascadeType const& fullCascades) { // If triggering is enabled, select only events which were triggered wit our triggers if (ConfEnableTriggerSelection) { @@ -585,7 +713,12 @@ struct femtoDreamProducerTask { if (!colCuts.isSelectedCollision(col)) { return; } - + // bool emptyCollision = false; + if (ConfIsActivateCascade.value) { + if (colCuts.isEmptyCollision(col, tracks, trackCuts) && colCuts.isCollisionWithoutTrkCasc(col, fullCascades, cascadeCuts, tracks)) { + return; + } + } if (ConfIsActivateV0.value) { if (colCuts.isEmptyCollision(col, tracks, trackCuts) && colCuts.isEmptyCollision(col, fullV0s, v0Cuts, tracks)) { return; @@ -605,14 +738,15 @@ struct femtoDreamProducerTask { fillMCCollision(col); } - std::vector childIDs = {0, 0}; // these IDs are necessary to keep track of the children - std::vector tmpIDtrack; // this vector keeps track of the matching of the primary track table row <-> aod::track table global index + std::vector childIDs = {0, 0}; // these IDs are necessary to keep track of the children + std::vector cascadechildIDs = {0, 0, 0}; // these IDs are necessary to keep track of the children + std::vector tmpIDtrack; // this vector keeps track of the matching of the primary track table row <-> aod::track table global index std::vector Daughter1, Daughter2; for (auto& track : tracksWithItsPid) { /// if the most open selection criteria are not fulfilled there is no /// point looking further at the track - trackCuts.fillQA(track); + trackCuts.fillQA(track); if (track.tpcChi2NCl() < OptionTrackSpecialSelections.ConfTrkMinChi2PerClusterTPC || track.tpcChi2NCl() > OptionTrackSpecialSelections.ConfTrkMaxChi2PerClusterTPC) { continue; @@ -631,7 +765,7 @@ struct femtoDreamProducerTask { TrackRegistry.fill(HIST("AnalysisQA/Chi2ITSTPCperCluster"), track.itsChi2NCl(), track.tpcChi2NCl()); TrackRegistry.fill(HIST("AnalysisQA/RefitITSTPC"), track.hasITS(), track.hasTPC()); - trackCuts.fillQA(track); + trackCuts.fillQA(track); // the bit-wise container of the systematic variations is obtained std::array cutContainer; cutContainer = trackCuts.getCutContainer(track, track.pt(), track.eta(), sqrtf(powf(track.dcaXY(), 2.f) + powf(track.dcaZ(), 2.f))); @@ -659,9 +793,9 @@ struct femtoDreamProducerTask { // TO DO: change TTV0 task to apply there the strict selection and have here only loose selection // select daugher 1 - if (track.sign() == ConfDaughterCharge.value[0] && track.pt() <= ConfDaughterPtUp.value[0] && track.pt() >= ConfDaughterPtLow.value[0] && std::abs(track.eta()) <= ConfDaughterEta.value[0] && std::abs(track.dcaXY()) <= ConfDaughterDCAxy.value[0] && std::abs(track.dcaZ()) <= ConfDaughterDCAz.value[0] && track.tpcNClsCrossedRows() >= ConfDaughterNCrossed.value[0] && track.tpcNClsFound() >= ConfDaughterNClus.value[0] && track.tpcCrossedRowsOverFindableCls() >= ConfDaughterTPCfCls.value[0]) { - if ((track.tpcInnerParam() < ConfDaughterPTPCThr.value[0] && std::abs(o2::aod::pidutils::tpcNSigma(ConfDaughterPIDspecies.value[0], track)) <= ConfDaughterPIDnSigmaMax.value[0]) || - (track.tpcInnerParam() >= ConfDaughterPTPCThr.value[0] && std::abs(std::sqrt(o2::aod::pidutils::tpcNSigma(ConfDaughterPIDspecies.value[0], track) * o2::aod::pidutils::tpcNSigma(ConfDaughterPIDspecies.value[0], track) + o2::aod::pidutils::tofNSigma(ConfDaughterPIDspecies.value[0], track) * o2::aod::pidutils::tofNSigma(ConfDaughterPIDspecies.value[0], track))) <= ConfDaughterPIDnSigmaMax.value[0])) { + if (track.sign() == ConfResoSel.ConfDaughterCharge.value[0] && track.pt() <= ConfResoSel.ConfDaughterPtUp.value[0] && track.pt() >= ConfResoSel.ConfDaughterPtLow.value[0] && std::abs(track.eta()) <= ConfResoSel.ConfDaughterEta.value[0] && std::abs(track.dcaXY()) <= ConfResoSel.ConfDaughterDCAxy.value[0] && std::abs(track.dcaZ()) <= ConfResoSel.ConfDaughterDCAz.value[0] && track.tpcNClsCrossedRows() >= ConfResoSel.ConfDaughterNCrossed.value[0] && track.tpcNClsFound() >= ConfResoSel.ConfDaughterNClus.value[0] && track.tpcCrossedRowsOverFindableCls() >= ConfResoSel.ConfDaughterTPCfCls.value[0]) { + if ((track.tpcInnerParam() < ConfResoSel.ConfDaughterPTPCThr.value[0] && std::abs(o2::aod::pidutils::tpcNSigma(ConfResoSel.ConfDaughterPIDspecies.value[0], track)) <= ConfResoSel.ConfDaughterPIDnSigmaMax.value[0]) || + (track.tpcInnerParam() >= ConfResoSel.ConfDaughterPTPCThr.value[0] && std::abs(std::sqrt(o2::aod::pidutils::tpcNSigma(ConfResoSel.ConfDaughterPIDspecies.value[0], track) * o2::aod::pidutils::tpcNSigma(ConfResoSel.ConfDaughterPIDspecies.value[0], track) + o2::aod::pidutils::tofNSigma(ConfResoSel.ConfDaughterPIDspecies.value[0], track) * o2::aod::pidutils::tofNSigma(ConfResoSel.ConfDaughterPIDspecies.value[0], track))) <= ConfResoSel.ConfDaughterPIDnSigmaMax.value[0])) { Daughter1.push_back(track); ResoRegistry.fill(HIST("AnalysisQA/Reso/Daughter1/Pt"), track.pt()); ResoRegistry.fill(HIST("AnalysisQA/Reso/Daughter1/Eta"), track.eta()); @@ -669,9 +803,9 @@ struct femtoDreamProducerTask { } } // select daugher 2 - if (track.sign() == ConfDaughterCharge.value[1] && track.pt() <= ConfDaughterPtUp.value[1] && track.pt() >= ConfDaughterPtLow.value[1] && std::abs(track.eta()) <= ConfDaughterEta.value[1] && std::abs(track.dcaXY()) <= ConfDaughterDCAxy.value[1] && std::abs(track.dcaZ()) <= ConfDaughterDCAz.value[1] && track.tpcNClsCrossedRows() >= ConfDaughterNCrossed.value[1] && track.tpcNClsFound() >= ConfDaughterNClus.value[1] && track.tpcCrossedRowsOverFindableCls() >= ConfDaughterTPCfCls.value[1]) { - if ((track.tpcInnerParam() < ConfDaughterPTPCThr.value[1] && std::abs(o2::aod::pidutils::tpcNSigma(ConfDaughterPIDspecies.value[1], track)) <= ConfDaughterPIDnSigmaMax.value[1]) || - (track.tpcInnerParam() >= ConfDaughterPTPCThr.value[1] && std::abs(std::sqrt(o2::aod::pidutils::tpcNSigma(ConfDaughterPIDspecies.value[1], track) * o2::aod::pidutils::tpcNSigma(ConfDaughterPIDspecies.value[1], track) + o2::aod::pidutils::tofNSigma(ConfDaughterPIDspecies.value[1], track) * o2::aod::pidutils::tofNSigma(ConfDaughterPIDspecies.value[1], track))) <= ConfDaughterPIDnSigmaMax.value[1])) { + if (track.sign() == ConfResoSel.ConfDaughterCharge.value[1] && track.pt() <= ConfResoSel.ConfDaughterPtUp.value[1] && track.pt() >= ConfResoSel.ConfDaughterPtLow.value[1] && std::abs(track.eta()) <= ConfResoSel.ConfDaughterEta.value[1] && std::abs(track.dcaXY()) <= ConfResoSel.ConfDaughterDCAxy.value[1] && std::abs(track.dcaZ()) <= ConfResoSel.ConfDaughterDCAz.value[1] && track.tpcNClsCrossedRows() >= ConfResoSel.ConfDaughterNCrossed.value[1] && track.tpcNClsFound() >= ConfResoSel.ConfDaughterNClus.value[1] && track.tpcCrossedRowsOverFindableCls() >= ConfResoSel.ConfDaughterTPCfCls.value[1]) { + if ((track.tpcInnerParam() < ConfResoSel.ConfDaughterPTPCThr.value[1] && std::abs(o2::aod::pidutils::tpcNSigma(ConfResoSel.ConfDaughterPIDspecies.value[1], track)) <= ConfResoSel.ConfDaughterPIDnSigmaMax.value[1]) || + (track.tpcInnerParam() >= ConfResoSel.ConfDaughterPTPCThr.value[1] && std::abs(std::sqrt(o2::aod::pidutils::tpcNSigma(ConfResoSel.ConfDaughterPIDspecies.value[1], track) * o2::aod::pidutils::tpcNSigma(ConfResoSel.ConfDaughterPIDspecies.value[1], track) + o2::aod::pidutils::tofNSigma(ConfResoSel.ConfDaughterPIDspecies.value[1], track) * o2::aod::pidutils::tofNSigma(ConfResoSel.ConfDaughterPIDspecies.value[1], track))) <= ConfResoSel.ConfDaughterPIDnSigmaMax.value[1])) { Daughter2.push_back(track); ResoRegistry.fill(HIST("AnalysisQA/Reso/Daughter2/Pt"), track.pt()); ResoRegistry.fill(HIST("AnalysisQA/Reso/Daughter2/Eta"), track.eta()); @@ -691,6 +825,8 @@ struct femtoDreamProducerTask { // const auto dcaXYpos = postrack.dcaXY(); // const auto dcaZpos = postrack.dcaZ(); // const auto dcapos = std::sqrt(pow(dcaXYpos, 2.) + pow(dcaZpos, 2.)); + + v0Cuts.fillQA<0, aod::femtodreamparticle::ParticleType::kV0, aod::femtodreamparticle::ParticleType::kV0Child>(col, v0, postrack, negtrack); v0Cuts.fillLambdaQA(col, v0, postrack, negtrack); if (!v0Cuts.isSelectedMinimal(col, v0, postrack, negtrack)) { @@ -705,7 +841,7 @@ struct femtoDreamProducerTask { // TrackSelection::TrackCuts::kITSHits); // } - v0Cuts.fillQA(col, v0, postrack, negtrack); ///\todo fill QA also for daughters + v0Cuts.fillQA<1, aod::femtodreamparticle::ParticleType::kV0, aod::femtodreamparticle::ParticleType::kV0Child>(col, v0, postrack, negtrack); ///\todo fill QA also for daughters auto cutContainerV0 = v0Cuts.getCutContainer(col, v0, postrack, negtrack); int postrackID = v0.posTrackId(); @@ -768,6 +904,113 @@ struct femtoDreamProducerTask { } } } + if (ConfIsActivateCascade.value) { + for (auto& casc : fullCascades) { + // get the daughter tracks + const auto& posTrackCasc = casc.template posTrack_as(); + const auto& negTrackCasc = casc.template negTrack_as(); + const auto& bachTrackCasc = casc.template bachelor_as(); + + cascadeCuts.fillQA<0, aod::femtodreamparticle::ParticleType::kCascade>(col, casc, posTrackCasc, negTrackCasc, bachTrackCasc); + if (!cascadeCuts.isSelectedMinimal(col, casc, posTrackCasc, negTrackCasc, bachTrackCasc)) { + continue; + } + cascadeCuts.fillQA<1, aod::femtodreamparticle::ParticleType::kCascade>(col, casc, posTrackCasc, negTrackCasc, bachTrackCasc); + + // auto cutContainerCasc = cascadeCuts.getCutContainer(col, casc, v0daugh, posTrackCasc, negTrackCasc, bachTrackCasc); + auto cutContainerCasc = cascadeCuts.getCutContainer(col, casc, posTrackCasc, negTrackCasc, bachTrackCasc); + + // Fill positive child + int poscasctrackID = casc.posTrackId(); + int rowInPrimaryTrackTablePosCasc = -1; + rowInPrimaryTrackTablePosCasc = getRowDaughters(poscasctrackID, tmpIDtrack); + cascadechildIDs[0] = rowInPrimaryTrackTablePosCasc; + cascadechildIDs[1] = 0; + cascadechildIDs[2] = 0; + outputParts(outputCollision.lastIndex(), + posTrackCasc.pt(), + posTrackCasc.eta(), + posTrackCasc.phi(), + aod::femtodreamparticle::ParticleType::kCascadeV0Child, + cutContainerCasc.at(femtoDreamCascadeSelection::CascadeContainerPosition::kPosCuts), + cutContainerCasc.at(femtoDreamCascadeSelection::CascadeContainerPosition::kPosPID), + posTrackCasc.dcaXY(), + cascadechildIDs, + 0, + 0); + const int rowOfPosCascadeTrack = outputParts.lastIndex(); + // TODO: include here MC filling + //------ + + // Fill negative child + int negcasctrackID = casc.negTrackId(); + int rowInPrimaryTrackTableNegCasc = -1; + rowInPrimaryTrackTableNegCasc = getRowDaughters(negcasctrackID, tmpIDtrack); + cascadechildIDs[0] = 0; + cascadechildIDs[1] = rowInPrimaryTrackTableNegCasc; + cascadechildIDs[2] = 0; + outputParts(outputCollision.lastIndex(), + negTrackCasc.pt(), + negTrackCasc.eta(), + negTrackCasc.phi(), + aod::femtodreamparticle::ParticleType::kCascadeV0Child, + cutContainerCasc.at(femtoDreamCascadeSelection::CascadeContainerPosition::kNegCuts), + cutContainerCasc.at(femtoDreamCascadeSelection::CascadeContainerPosition::kNegPID), + negTrackCasc.dcaXY(), + cascadechildIDs, + 0, + 0); + const int rowOfNegCascadeTrack = outputParts.lastIndex(); + // TODO: include here MC filling + //------ + + // Fill bachelor child + int bachelorcasctrackID = casc.bachelorId(); + int rowInPrimaryTrackTableBachelorCasc = -1; + rowInPrimaryTrackTableBachelorCasc = getRowDaughters(bachelorcasctrackID, tmpIDtrack); + cascadechildIDs[0] = 0; + cascadechildIDs[1] = 0; + cascadechildIDs[2] = rowInPrimaryTrackTableBachelorCasc; + outputParts(outputCollision.lastIndex(), + bachTrackCasc.pt(), + bachTrackCasc.eta(), + bachTrackCasc.phi(), + aod::femtodreamparticle::ParticleType::kCascadeBachelor, + cutContainerCasc.at(femtoDreamCascadeSelection::CascadeContainerPosition::kBachCuts), + cutContainerCasc.at(femtoDreamCascadeSelection::CascadeContainerPosition::kBachPID), + bachTrackCasc.dcaXY(), + cascadechildIDs, + 0, + 0); + const int rowOfBachelorCascadeTrack = outputParts.lastIndex(); + // TODO: include here MC filling + //------ + + // Fill cascades + float invMassCasc = ConfCascSel.ConfCascIsSelectedOmega ? casc.mOmega() : casc.mXi(); + std::vector indexCascadeChildID = {rowOfPosCascadeTrack, rowOfNegCascadeTrack, rowOfBachelorCascadeTrack}; + outputParts(outputCollision.lastIndex(), + casc.pt(), + casc.eta(), + casc.phi(), + aod::femtodreamparticle::ParticleType::kCascade, + cutContainerCasc.at(femtoDreamCascadeSelection::CascadeContainerPosition::kCascade), + 0, + casc.casccosPA(col.posX(), col.posY(), col.posZ()), + indexCascadeChildID, + invMassCasc, + casc.mLambda()); + // TODO: include here MC filling + //------ + + if (ConfIsDebug.value) { + fillDebugParticle(posTrackCasc); // QA for positive daughter + fillDebugParticle(negTrackCasc); // QA for negative daughter + fillDebugParticle(bachTrackCasc); // QA for negative daughter + fillDebugCascade(casc, col); // QA for Cascade + } + } + } if (ConfIsActivateReso.value) { for (std::size_t iDaug1 = 0; iDaug1 < Daughter1.size(); ++iDaug1) { @@ -775,14 +1018,14 @@ struct femtoDreamProducerTask { // MC stuff is still missing, also V0 QA // ALSO: fix indices and other table entries which are now set to 0 as deflaut as not needed for p-p-phi cf ana - ROOT::Math::PtEtaPhiMVector tempD1(Daughter1.at(iDaug1).pt(), Daughter1.at(iDaug1).eta(), Daughter1.at(iDaug1).phi(), ConfDaug1Daugh2ResoMass.value[0]); - ROOT::Math::PtEtaPhiMVector tempD2(Daughter2.at(iDaug2).pt(), Daughter2.at(iDaug2).eta(), Daughter2.at(iDaug2).phi(), ConfDaug1Daugh2ResoMass.value[1]); + ROOT::Math::PtEtaPhiMVector tempD1(Daughter1.at(iDaug1).pt(), Daughter1.at(iDaug1).eta(), Daughter1.at(iDaug1).phi(), ConfResoSel.ConfDaug1Daugh2ResoMass.value[0]); + ROOT::Math::PtEtaPhiMVector tempD2(Daughter2.at(iDaug2).pt(), Daughter2.at(iDaug2).eta(), Daughter2.at(iDaug2).phi(), ConfResoSel.ConfDaug1Daugh2ResoMass.value[1]); ROOT::Math::PtEtaPhiMVector tempPhi = tempD1 + tempD2; ResoRegistry.fill(HIST("AnalysisQA/Reso/InvMass"), tempPhi.M()); - if ((tempPhi.M() >= ConfResoInvMassLowLimit.value) && (tempPhi.M() <= ConfResoInvMassUpLimit.value)) { + if ((tempPhi.M() >= ConfResoSel.ConfResoInvMassLowLimit.value) && (tempPhi.M() <= ConfResoSel.ConfResoInvMassUpLimit.value)) { ResoRegistry.fill(HIST("AnalysisQA/Reso/InvMass_selected"), tempPhi.M()); ResoRegistry.fill(HIST("AnalysisQA/Reso/PtD1_selected"), Daughter1.at(iDaug1).pt()); @@ -841,7 +1084,8 @@ struct femtoDreamProducerTask { processData(aod::FemtoFullCollision const& col, aod::BCsWithTimestamps const&, aod::FemtoFullTracks const& tracks, - o2::aod::V0Datas const& fullV0s) + o2::aod::V0Datas const& fullV0s, + o2::aod::CascDatas const& fullCascades) { // get magnetic field for run initCCDB_Mag_Trig(col.bc_as()); @@ -849,9 +1093,9 @@ struct femtoDreamProducerTask { auto tracksWithItsPid = soa::Attach(tracks); if (ConfUseItsPid.value) { - fillCollisionsAndTracksAndV0(col, tracks, tracksWithItsPid, fullV0s); + fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracksWithItsPid, fullV0s, fullCascades); } else { - fillCollisionsAndTracksAndV0(col, tracks, tracks, fullV0s); + fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracks, fullV0s, fullCascades); } } PROCESS_SWITCH(femtoDreamProducerTask, processData, @@ -861,7 +1105,8 @@ struct femtoDreamProducerTask { processData_noCentrality(aod::FemtoFullCollision_noCent const& col, aod::BCsWithTimestamps const&, aod::FemtoFullTracks const& tracks, - o2::aod::V0Datas const& fullV0s) + o2::aod::V0Datas const& fullV0s, + o2::aod::CascDatas const& fullCascades) { // get magnetic field for run initCCDB_Mag_Trig(col.bc_as()); @@ -869,9 +1114,9 @@ struct femtoDreamProducerTask { auto tracksWithItsPid = soa::Attach(tracks); if (ConfUseItsPid.value) { - fillCollisionsAndTracksAndV0(col, tracks, tracksWithItsPid, fullV0s); + fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracksWithItsPid, fullV0s, fullCascades); } else { - fillCollisionsAndTracksAndV0(col, tracks, tracks, fullV0s); + fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracks, fullV0s, fullCascades); } } PROCESS_SWITCH(femtoDreamProducerTask, processData_noCentrality, @@ -880,7 +1125,8 @@ struct femtoDreamProducerTask { void processData_CentPbPb(aod::FemtoFullCollision_CentPbPb const& col, aod::BCsWithTimestamps const&, aod::FemtoFullTracks const& tracks, - o2::aod::V0Datas const& fullV0s) + o2::aod::V0Datas const& fullV0s, + o2::aod::CascDatas const& fullCascades) { // get magnetic field for run initCCDB_Mag_Trig(col.bc_as()); @@ -888,9 +1134,9 @@ struct femtoDreamProducerTask { auto tracksWithItsPid = soa::Attach(tracks); if (ConfUseItsPid.value) { - fillCollisionsAndTracksAndV0(col, tracks, tracksWithItsPid, fullV0s); + fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracksWithItsPid, fullV0s, fullCascades); } else { - fillCollisionsAndTracksAndV0(col, tracks, tracks, fullV0s); + fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracks, fullV0s, fullCascades); } } PROCESS_SWITCH(femtoDreamProducerTask, processData_CentPbPb, @@ -901,12 +1147,13 @@ struct femtoDreamProducerTask { soa::Join const& tracks, aod::FemtoFullMCgenCollisions const&, aod::McParticles const&, - soa::Join const& fullV0s) /// \todo with FilteredFullV0s + soa::Join const& fullV0s, /// \todo with FilteredFullV0s + soa::Join const& fullCascades) { // get magnetic field for run initCCDB_Mag_Trig(col.bc_as()); // fill the tables - fillCollisionsAndTracksAndV0(col, tracks, tracks, fullV0s); + fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracks, fullV0s, fullCascades); } PROCESS_SWITCH(femtoDreamProducerTask, processMC, "Provide MC data", false); @@ -915,12 +1162,13 @@ struct femtoDreamProducerTask { soa::Join const& tracks, aod::FemtoFullMCgenCollisions const&, aod::McParticles const&, - soa::Join const& fullV0s) /// \todo with FilteredFullV0s + soa::Join const& fullV0s, /// \todo with FilteredFullV0s + soa::Join const& fullCascades) { // get magnetic field for run initCCDB_Mag_Trig(col.bc_as()); // fill the tables - fillCollisionsAndTracksAndV0(col, tracks, tracks, fullV0s); + fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracks, fullV0s, fullCascades); } PROCESS_SWITCH(femtoDreamProducerTask, processMC_noCentrality, "Provide MC data without requiring a centrality calibration", false); @@ -929,12 +1177,13 @@ struct femtoDreamProducerTask { soa::Join const& tracks, aod::FemtoFullMCgenCollisions const&, aod::McParticles const&, - soa::Join const& fullV0s) /// \todo with FilteredFullV0s + soa::Join const& fullV0s, /// \todo with FilteredFullV0s + soa::Join const& fullCascades) { // get magnetic field for run initCCDB_Mag_Trig(col.bc_as()); // fill the tables - fillCollisionsAndTracksAndV0(col, tracks, tracks, fullV0s); + fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracks, fullV0s, fullCascades); } PROCESS_SWITCH(femtoDreamProducerTask, processMC_CentPbPb, "Provide MC data with centrality information for PbPb collisions", false); }; diff --git a/PWGCF/FemtoDream/Tasks/CMakeLists.txt b/PWGCF/FemtoDream/Tasks/CMakeLists.txt index 933d50035a9..95c4f8cdaa0 100644 --- a/PWGCF/FemtoDream/Tasks/CMakeLists.txt +++ b/PWGCF/FemtoDream/Tasks/CMakeLists.txt @@ -29,6 +29,11 @@ o2physics_add_dpl_workflow(femtodream-pair-track-cascade PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(femtodream-pair-casdcade-cascade + SOURCES femtodreamPairCascadeCascade.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(femtodream-triplet-track-track-v0 SOURCES femtoDreamTripletTaskTrackTrackV0.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore diff --git a/PWGCF/FemtoDream/Tasks/femtodreamPairCascadeCascade.cxx b/PWGCF/FemtoDream/Tasks/femtodreamPairCascadeCascade.cxx new file mode 100644 index 00000000000..fbf164378a1 --- /dev/null +++ b/PWGCF/FemtoDream/Tasks/femtodreamPairCascadeCascade.cxx @@ -0,0 +1,448 @@ +// Copyright 2019-2022 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 femtoDreamPairCascadeCascade.cxx +/// \brief Tasks that reads the track tables used for the pairing and builds pairs of two cascades +/// \author Andi Mathis, Anton Riedel, Georgios Mantzaridis, Oton Vazquez Doce. + +#include "PWGCF/DataModel/FemtoDerived.h" +#include "PWGCF/FemtoDream/Core/femtoDreamContainer.h" +#include "PWGCF/FemtoDream/Core/femtoDreamDetaDphiStar.h" +#include "PWGCF/FemtoDream/Core/femtoDreamEventHisto.h" +#include "PWGCF/FemtoDream/Core/femtoDreamPairCleaner.h" +#include "PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h" +#include "PWGCF/FemtoDream/Core/femtoDreamUtils.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/Expressions.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" + +#include + +#include +#include +#include +using namespace o2; +using namespace o2::aod; +using namespace o2::soa; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::analysis::femtoDream; +struct FemtoDreamPairCascadeCascade { + SliceCache cache; + Preslice perCol = aod::femtodreamparticle::fdCollisionId; + + /// General options + struct : ConfigurableGroup { + std::string prefix = std::string("Option"); + Configurable sameSpecies{"sameSpecies", false, "Set to true if particle 1 and particle 2 are the same species"}; + Configurable isMC{"isMC", false, "Enable additional Histogramms in the case of a MonteCarlo Run"}; + Configurable use4D{"use4D", false, "Enable four dimensional histogramms (to be used only for analysis with high statistics): k* vs multiplicity vs multiplicity percentil vs mT"}; + Configurable extendedPlots{"extendedPlots", false, "Enable additional three dimensional histogramms. High memory consumption. Use for debugging"}; + Configurable highkstarCut{"highkstarCut", -1., "Set a cut for high k*, above which the pairs are rejected. Set it to -1 to deactivate it"}; + Configurable cprOn{"cprOn", true, "Close Pair Rejection"}; + Configurable cprOld{"cprOld", false, "Set to FALSE to use fixed version of CPR (for testing now, will be default soon)"}; + Configurable cprPlotPerRadii{"cprPlotPerRadii", false, "Plot CPR per radii"}; + Configurable cprDeltaPhiMax{"cprDeltaPhiMax", 0.01, "Max. Delta Phi for Close Pair Rejection"}; + Configurable cprDeltaEtaMax{"cprDeltaEtaMax", 0.01, "Max. Delta Eta for Close Pair Rejection"}; + Configurable dcaCutPtDep{"dcaCutPtDep", false, "Use pt dependent dca cut"}; + Configurable mixEventWithPairs{"mixEventWithPairs", false, "Only use events that contain particle 1 and partile 2 for the event mixing"}; + Configurable smearingByOrigin{"smearingByOrigin", false, "Obtain the smearing matrix differential in the MC origin of particle 1 and particle 2. High memory consumption. Use with care!"}; + ConfigurableAxis dummy{"dummy", {1, 0, 1}, "dummy axis"}; + } Option; + + /// Event selection + struct : ConfigurableGroup { + std::string prefix = std::string("EventSel"); + Configurable multMin{"multMin", 0, "Minimum Multiplicity (MultNtr)"}; + Configurable multMax{"multMax", 99999, "Maximum Multiplicity (MultNtr)"}; + Configurable multPercentileMin{"multPercentileMin", 0, "Minimum Multiplicity Percentile"}; + Configurable multPercentileMax{"multPercentileMax", 100, "Maximum Multiplicity Percentile"}; + } EventSel; + + // Filter EventMultiplicity = aod::femtodreamcollision::multNtr >= EventSel.multMin && aod::femtodreamcollision::multNtr <= EventSel.multMax; + // Filter EventMultiplicityPercentile = aod::femtodreamcollision::multV0M >= EventSel.multPercentileMin && aod::femtodreamcollision::multV0M <= EventSel.multPercentileMax; + + /// Histogramming for Event + FemtoDreamEventHisto eventHisto; + // using FilteredCollisions = soa::Filtered; + using FilteredCollisions = FDCollisions; + using FilteredCollision = FilteredCollisions::iterator; + using FDMCParts = soa::Join; + using FDMCPart = FDMCParts::iterator; + femtodreamcollision::BitMaskType bitMask = 1; //??????????????????? + + /// Cascade 1 (Cascade) + struct : ConfigurableGroup { + std::string prefix = std::string("Cascade1"); + Configurable pdgCode{"pdgCode", 3334, "PDG code of Particle 1 (Cascade)"}; + Configurable cutBit{"cutBit", 5542474, "Particle 1 (Cascade) - Selection bit from cutCulator"}; + Configurable childPosCutBit{"childPosCutBit", 278, "Selection bit for positive child of Cascade"}; + Configurable childPosTPCBit{"childPosTPCBit", 1024, "PID TPC bit for positive child of Cascade"}; + Configurable childNegCutBit{"childNegCutBit", 277, "Selection bit for negative child of Cascade"}; + Configurable childNegTPCBit{"childNegTPCBit", 4096, "PID TPC bit for negative child of Cascade"}; + Configurable childBachCutBit{"childBachCutBit", 277, "Selection bit for bachelor child of Cascade"}; + Configurable childBachTPCBit{"childBachTPCBit", 64, "PID TPC bit for bachelor child of Cascade"}; + + Configurable invMassMin{"invMassMin", 1.6, "Minimum invariant mass of Partricle 1 (Cascade)"}; + Configurable invMassMax{"invMassMax", 1.8, "Maximum invariant mass of Partricle 1 (Cascade)"}; + Configurable invMassV0DaughMin{"invMassV0DaughMin", 0., "Minimum invariant mass of the V0 Daughter"}; + Configurable invMassV0DaughMax{"invMassV0DaughMax", 999., "Maximum invariant mass of the V0 Daughter"}; + Configurable ptMin{"ptMin", 0., "Minimum pT of Particle 2 (Cascade)"}; + Configurable ptMax{"ptMax", 999., "Maximum pT of Particle 2 (Cascade)"}; + Configurable etaMin{"etaMin", -10., "Minimum eta of Particle 2 (Cascade)"}; + Configurable etaMax{"etaMax", 10., "Maximum eta of Particle 2 (Cascade)"}; + Configurable useChildCuts{"useChildCuts", true, "Use cuts on the children of the Cascades additional to those of the selection of the cascade builder (for debugging purposes)"}; + Configurable useChildPIDCuts{"useChildPIDCuts", true, "Use PID cuts on the children of the Cascades additional to those of the selection of the cascade builder (for debugging purposes)"}; + } Cascade1; + + /// Partition for particle 1 + Partition partitionCascade1 = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kCascade)) && + ((aod::femtodreamparticle::cut & Cascade1.cutBit) == Cascade1.cutBit) && + (aod::femtodreamparticle::pt > Cascade1.ptMin) && + (aod::femtodreamparticle::pt < Cascade1.ptMax) && + (aod::femtodreamparticle::eta > Cascade1.etaMin) && + (aod::femtodreamparticle::eta < Cascade1.etaMax) && + (aod::femtodreamparticle::mLambda > Cascade1.invMassMin) && + (aod::femtodreamparticle::mLambda < Cascade1.invMassMax) && + (aod::femtodreamparticle::mAntiLambda > Cascade1.invMassV0DaughMin) && + (aod::femtodreamparticle::mAntiLambda < Cascade1.invMassV0DaughMax); + /// Histogramming for particle 1 + FemtoDreamParticleHisto cascHistoPartOne; + FemtoDreamParticleHisto posChildHistosPartOne; + FemtoDreamParticleHisto negChildHistosPartOne; + FemtoDreamParticleHisto bachChildHistosPartOne; + + /// Particle 2 (Cascade) + struct : ConfigurableGroup { + std::string prefix = std::string("Cascade2"); + Configurable pdgCode{"pdgCode", 3334, "PDG code of particle 2 (Cascade)"}; + Configurable cutBit{"cutBit", 32221874, "Selection bit for particle 2 (Cascade)"}; + Configurable childPosCutBit{"childPosCutBit", 278, "Selection bit for positive child of Cascade"}; + Configurable childPosTPCBit{"childPosTPCBit", 1024, "PID TPC bit for positive child of Cascade"}; + Configurable childNegCutBit{"childNegCutBit", 277, "Selection bit for negative child of Cascade"}; + Configurable childNegTPCBit{"childNegTPCBit", 4096, "PID TPC bit for negative child of Cascade"}; + Configurable childBachCutBit{"childBachCutBit", 277, "Selection bit for negative child of Cascade"}; + Configurable childBachTPCBit{"childBachTPCBit", 64, "PID TPC bit for bachelor child of Cascade"}; + Configurable invMassMin{"invMassMin", 1.2, "Minimum invariant mass of Particle 2 (Cascade)"}; + Configurable invMassMax{"invMassMax", 1.4, "Maximum invariant mass of Particle 2 (Cascade)"}; + Configurable invMassV0DaughMin{"invMassV0DaughMin", 0., "Minimum invariant mass of the V0 Daughter"}; // (???????) + Configurable invMassV0DaughMax{"invMassV0DaughMax", 999., "Maximum invariant mass of the V0 Daughter"}; // (???????) + Configurable ptMin{"ptMin", 0., "Minimum pT of Particle 2 (Cascade)"}; + Configurable ptMax{"ptMax", 999., "Maximum pT of Particle 2 (Cascade)"}; + Configurable etaMin{"etaMin", -10., "Minimum eta of Particle 2 (Cascade)"}; + Configurable etaMax{"etaMax", 10., "Maximum eta of Particle 2 (Cascade)"}; + Configurable useChildCuts{"useChildCuts", true, "Use cuts on the children of the Cascades additional to those of the selection of the cascade builder (for debugging purposes)"}; + Configurable useChildPIDCuts{"useChildPIDCuts", true, "Use PID cuts on the children of the Cascades additional to those of the selection of the cascade builder (for debugging purposes)"}; + } Cascade2; + + /// Partition for particle 2 + Partition partitionCascade2 = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kCascade)) && + ((aod::femtodreamparticle::cut & Cascade2.cutBit) == Cascade2.cutBit) && + (aod::femtodreamparticle::pt > Cascade2.ptMin) && + (aod::femtodreamparticle::pt < Cascade2.ptMax) && + (aod::femtodreamparticle::eta > Cascade2.etaMin) && + (aod::femtodreamparticle::eta < Cascade2.etaMax) && + (aod::femtodreamparticle::mLambda > Cascade2.invMassMin) && + (aod::femtodreamparticle::mLambda < Cascade2.invMassMax) && + (aod::femtodreamparticle::mAntiLambda > Cascade2.invMassV0DaughMin) && + (aod::femtodreamparticle::mAntiLambda < Cascade2.invMassV0DaughMax); + /// Histogramming for particle 2 + FemtoDreamParticleHisto cascHistoPartTwo; + FemtoDreamParticleHisto posChildHistosPartTwo; + FemtoDreamParticleHisto negChildHistosPartTwo; + FemtoDreamParticleHisto bachChildHistosPartTwo; + + /// Binning configurables + struct : ConfigurableGroup { + std::string prefix = std::string("Binning"); + ConfigurableAxis tempFitVarCascade{"tempFitVarCascade", {300, 0.9, 1}, "binning of the TempFitVar in the pT vs. TempFitVar plot (Cascade)"}; + ConfigurableAxis tempFitVarCascadeChild{"tempFitVarCascadeChild", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot (Cascade child)"}; + ConfigurableAxis invMass{"invMass", {200, 1.22, 1.42}, "invMass binning"}; + ConfigurableAxis pTCascade{"pTCascade", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot (Cascade)"}; + ConfigurableAxis pTCascadeChild{"pTCascadeChild", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot (Cascade)"}; + ConfigurableAxis pT{"pT", {20, 0.5, 4.05}, "pT binning"}; + ConfigurableAxis kstar{"kstar", {1500, 0., 6.}, "binning kstar"}; + ConfigurableAxis kT{"kT", {150, 0., 9.}, "binning kT"}; + ConfigurableAxis mT{"mT", {225, 0., 7.5}, "binning mT"}; + ConfigurableAxis multTempFit{"multTempFit", {1, 0, 1}, "multiplicity for the TempFitVar plot"}; + } Binning; + struct : ConfigurableGroup { + std::string prefix = std::string("Binning4D"); + ConfigurableAxis kstar{"kstar", {1500, 0., 6.}, "binning kstar for the 4Dimensional plot: k* vs multiplicity vs multiplicity percentile vs mT (set <> to true in order to use)"}; + ConfigurableAxis mT{"mT", {VARIABLE_WIDTH, 1.02f, 1.14f, 1.20f, 1.26f, 1.38f, 1.56f, 1.86f, 4.50f}, "mT Binning for the 4Dimensional plot: k* vs multiplicity vs multiplicity percentile vs mT (set <> to true in order to use)"}; + ConfigurableAxis mult{"mult", {VARIABLE_WIDTH, 0.0f, 4.0f, 8.0f, 12.0f, 16.0f, 20.0f, 24.0f, 28.0f, 32.0f, 36.0f, 40.0f, 44.0f, 48.0f, 52.0f, 56.0f, 60.0f, 64.0f, 68.0f, 72.0f, 76.0f, 80.0f, 84.0f, 88.0f, 92.0f, 96.0f, 100.0f, 200.0f}, "multiplicity Binning for the 4Dimensional plot: k* vs multiplicity vs multiplicity percentile vs mT (set <> to true in order to use)"}; + ConfigurableAxis multPercentile{"multPercentile", {10, 0.0f, 100.0f}, "multiplicity percentile Binning for the 4Dimensional plot: k* vs multiplicity vs multiplicity percentile vs mT (set <> to true in order to use)"}; + } Binning4D; + + // Mixing configurables + struct : ConfigurableGroup { + std::string prefix = std::string("Mixing"); + ConfigurableAxis binMult{"binMult", {VARIABLE_WIDTH, 0.0f, 4.0f, 8.0f, 12.0f, 16.0f, 20.0f, 24.0f, 28.0f, 32.0f, 36.0f, 40.0f, 44.0f, 48.0f, 52.0f, 56.0f, 60.0f, 64.0f, 68.0f, 72.0f, 76.0f, 80.0f, 84.0f, 88.0f, 92.0f, 96.0f, 100.0f, 200.0f}, "bins - multiplicity"}; + ConfigurableAxis binMultPercentile{"binMultPercentile", {VARIABLE_WIDTH, 0.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.f}, "bins - multiplicity percentile"}; + ConfigurableAxis binVztx{"binVztx", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "bins - z-vertex"}; + Configurable depth{"depth", 5, "Number of events for mixing"}; + Configurable binPolicy{"binPolicy", 0, "Binning binPolicy for mixing - 0: multiplicity, 1: multipliciy percentile, 2: both"}; + } Mixing; + ColumnBinningPolicy colBinningMult{{Mixing.binVztx, Mixing.binMult}, true}; + ColumnBinningPolicy colBinningMultPercentile{{Mixing.binVztx, Mixing.binMultPercentile}, true}; + ColumnBinningPolicy colBinningMultMultPercentile{{Mixing.binVztx, Mixing.binMult, Mixing.binMultPercentile}, true}; + FemtoDreamContainer sameEventCont; + FemtoDreamContainer mixedEventCont; + FemtoDreamPairCleaner pairCleaner; + FemtoDreamDetaDphiStar pairCloseRejectionSE; + FemtoDreamDetaDphiStar pairCloseRejectionME; + + static constexpr uint32_t kSignPlusMask = 1 << 1; + + /// Histogram output + HistogramRegistry registry{"Output", {}, OutputObjHandlingPolicy::AnalysisObject}; + void init(InitContext&) + { + // setup binnnig binPolicy for mixing + colBinningMult = {{Mixing.binVztx, Mixing.binMult}, true}; + colBinningMultPercentile = {{Mixing.binVztx, Mixing.binMultPercentile}, true}; + colBinningMultMultPercentile = {{Mixing.binVztx, Mixing.binMult, Mixing.binMultPercentile}, true}; + eventHisto.init(®istry, Option.isMC); + + cascHistoPartOne.init(®istry, Binning.multTempFit, Option.dummy, Binning.pTCascade, Option.dummy, Option.dummy, Binning.tempFitVarCascade, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Option.isMC, Cascade1.pdgCode); + posChildHistosPartOne.init(®istry, Binning.multTempFit, Option.dummy, Binning.pTCascadeChild, Option.dummy, Option.dummy, Binning.tempFitVarCascadeChild, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Option.dummy, false, 0); + negChildHistosPartOne.init(®istry, Binning.multTempFit, Option.dummy, Binning.pTCascadeChild, Option.dummy, Option.dummy, Binning.tempFitVarCascadeChild, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Option.dummy, false, 0); + bachChildHistosPartOne.init(®istry, Binning.multTempFit, Option.dummy, Binning.pTCascadeChild, Option.dummy, Option.dummy, Binning.tempFitVarCascadeChild, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Option.dummy, false, 0); + + if (!Option.sameSpecies) { + cascHistoPartTwo.init(®istry, Binning.multTempFit, Option.dummy, Binning.pTCascade, Option.dummy, Option.dummy, Binning.tempFitVarCascade, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Binning.invMass, Option.dummy, Option.isMC, Cascade2.pdgCode); + posChildHistosPartTwo.init(®istry, Binning.multTempFit, Option.dummy, Binning.pTCascadeChild, Option.dummy, Option.dummy, Binning.tempFitVarCascadeChild, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Option.dummy, false, 0); + negChildHistosPartTwo.init(®istry, Binning.multTempFit, Option.dummy, Binning.pTCascadeChild, Option.dummy, Option.dummy, Binning.tempFitVarCascadeChild, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Option.dummy, false, 0); + bachChildHistosPartTwo.init(®istry, Binning.multTempFit, Option.dummy, Binning.pTCascadeChild, Option.dummy, Option.dummy, Binning.tempFitVarCascadeChild, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Option.dummy, false, 0); + } + + sameEventCont.init(®istry, + Binning.kstar, Binning.pT, Binning.kT, Binning.mT, Mixing.binMult, Mixing.binMultPercentile, + Binning4D.kstar, Binning4D.mT, Binning4D.mult, Binning4D.multPercentile, + Option.isMC, Option.use4D, Option.extendedPlots, + Option.highkstarCut, + Option.smearingByOrigin); + + sameEventCont.setPDGCodes(Cascade1.pdgCode, Cascade2.pdgCode); + + mixedEventCont.init(®istry, + Binning.kstar, Binning.pT, Binning.kT, Binning.mT, Mixing.binMult, Mixing.binMultPercentile, + Binning4D.kstar, Binning4D.mT, Binning4D.mult, Binning4D.multPercentile, + Option.isMC, Option.use4D, Option.extendedPlots, + Option.highkstarCut, + Option.smearingByOrigin); + + mixedEventCont.setPDGCodes(Cascade1.pdgCode, Cascade2.pdgCode); + + pairCleaner.init(®istry); + if (Option.cprOn.value) { + pairCloseRejectionSE.init(®istry, ®istry, Option.cprDeltaPhiMax.value, Option.cprDeltaEtaMax.value, Option.cprPlotPerRadii.value, 1, Option.cprOld.value); + pairCloseRejectionME.init(®istry, ®istry, Option.cprDeltaPhiMax.value, Option.cprDeltaEtaMax.value, Option.cprPlotPerRadii.value, 2, Option.cprOld.value, 99, true); + } + } + + /// This function processes the same event and takes care of all the histogramming + template + void doSameEvent(PartitionType& sliceCascade1, PartitionType& sliceCascade2, TableTracks const& parts, Collision const& col) + { + /// Histogramming same event + for (auto const& casc : sliceCascade1) { + const auto& posChild1 = parts.iteratorAt(casc.index() - 3); + const auto& negChild1 = parts.iteratorAt(casc.index() - 2); + const auto& bachChild1 = parts.iteratorAt(casc.index() - 1); + + // check cuts on V0 children + if (Cascade1.useChildCuts) { + if (!(((posChild1.cut() & Cascade1.childPosCutBit) == Cascade1.childPosCutBit) && + ((negChild1.cut() & Cascade1.childNegCutBit) == Cascade1.childNegCutBit) && + ((bachChild1.cut() & Cascade1.childBachCutBit) == Cascade1.childBachCutBit))) { + continue; + } + } + if (Cascade1.useChildPIDCuts) { + if (!(((posChild1.pidcut() & Cascade1.childPosTPCBit) == Cascade1.childPosTPCBit) && + ((negChild1.pidcut() & Cascade1.childNegTPCBit) == Cascade1.childNegTPCBit) && + ((bachChild1.pidcut() & Cascade1.childBachTPCBit) == Cascade1.childBachTPCBit))) { + continue; + } + } + cascHistoPartOne.fillQA(casc, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + posChildHistosPartOne.fillQA(posChild1, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + negChildHistosPartOne.fillQA(negChild1, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + bachChildHistosPartOne.fillQA(bachChild1, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + } + if (!Option.sameSpecies) { + for (auto const& casc : sliceCascade2) { + const auto& posChild2 = parts.iteratorAt(casc.index() - 3); + const auto& negChild2 = parts.iteratorAt(casc.index() - 2); + const auto& bachChild2 = parts.iteratorAt(casc.index() - 1); + + // check cuts on V0 children + if (Cascade2.useChildCuts) { + if (!(((posChild2.cut() & Cascade2.childPosCutBit) == Cascade2.childPosCutBit) && + ((negChild2.cut() & Cascade2.childNegCutBit) == Cascade2.childNegCutBit) && + ((bachChild2.cut() & Cascade2.childBachCutBit) == Cascade2.childBachCutBit))) { + continue; + } + } + if (Cascade2.useChildPIDCuts) { + if (!(((posChild2.pidcut() & Cascade2.childPosTPCBit) == Cascade2.childPosTPCBit) && + ((negChild2.pidcut() & Cascade2.childNegTPCBit) == Cascade2.childNegTPCBit) && + ((bachChild2.pidcut() & Cascade2.childBachTPCBit) == Cascade2.childBachTPCBit))) { + continue; + } + } + cascHistoPartTwo.fillQA(casc, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + posChildHistosPartTwo.fillQA(posChild2, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + negChildHistosPartTwo.fillQA(negChild2, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + bachChildHistosPartTwo.fillQA(bachChild2, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + } + } + + /// Now build particle combinations + for (auto const& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(sliceCascade1, sliceCascade2))) { + const auto& posChild1 = parts.iteratorAt(p1.index() - 3); + const auto& negChild1 = parts.iteratorAt(p1.index() - 2); + const auto& bachChild1 = parts.iteratorAt(p1.index() - 1); + const auto& posChild2 = parts.iteratorAt(p2.index() - 3); + const auto& negChild2 = parts.iteratorAt(p2.index() - 2); + const auto& bachChild2 = parts.iteratorAt(p2.index() - 1); + + // cuts on Cascade children still need to be applied + if (Cascade1.useChildCuts) { + if (!(((posChild1.cut() & Cascade1.childPosCutBit) == Cascade1.childPosCutBit) && + ((negChild1.cut() & Cascade1.childNegCutBit) == Cascade1.childNegCutBit) && + ((bachChild1.cut() & Cascade1.childBachCutBit) == Cascade1.childBachCutBit))) { + continue; + } + } + if (Cascade1.useChildPIDCuts) { + if (!(((posChild1.pidcut() & Cascade1.childPosTPCBit) == Cascade1.childPosTPCBit) && + ((negChild1.pidcut() & Cascade1.childNegTPCBit) == Cascade1.childNegTPCBit) && + ((bachChild1.pidcut() & Cascade1.childBachTPCBit) == Cascade1.childBachTPCBit))) { + continue; + } + } + + if (Cascade2.useChildCuts) { + if (!(((posChild2.cut() & Cascade2.childPosCutBit) == Cascade2.childPosCutBit) && + ((negChild2.cut() & Cascade2.childNegCutBit) == Cascade2.childNegCutBit) && + ((bachChild2.cut() & Cascade2.childBachCutBit) == Cascade2.childBachCutBit))) { + continue; + } + } + if (Cascade2.useChildPIDCuts) { + if (!(((posChild2.pidcut() & Cascade2.childPosTPCBit) == Cascade2.childPosTPCBit) && + ((negChild2.pidcut() & Cascade2.childNegTPCBit) == Cascade2.childNegTPCBit) && + ((bachChild2.pidcut() & Cascade2.childBachTPCBit) == Cascade2.childBachTPCBit))) { + continue; + } + } + + // SE pair set: + sameEventCont.setPair(p1, p2, col.multNtr(), col.multV0M(), Option.use4D, Option.extendedPlots, Option.smearingByOrigin); + } + } + + // process Same Event + void processSameEvent(FilteredCollision const& col, FDParticles const& parts) + { + eventHisto.fillQA(col); + auto sliceCascade1 = partitionCascade1->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); + auto sliceCascade2 = partitionCascade2->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); + doSameEvent(sliceCascade1, sliceCascade2, parts, col); + } + PROCESS_SWITCH(FemtoDreamPairCascadeCascade, processSameEvent, "Enable processing same event", true); + + // Mixed events + template + void doMixedEvent(CollisionType const& cols, PartType const& parts, PartitionType& part1, PartitionType& part2, BinningType binPolicy) + { + for (auto const& [collision1, collision2] : soa::selfCombinations(binPolicy, Mixing.depth.value, -1, cols, cols)) { + // make sure that tracks in same events are not mixed + if (collision1.globalIndex() == collision2.globalIndex()) { + continue; + } + auto sliceCasc1 = part1->sliceByCached(aod::femtodreamparticle::fdCollisionId, collision1.globalIndex(), cache); + auto sliceCasc2 = part2->sliceByCached(aod::femtodreamparticle::fdCollisionId, collision2.globalIndex(), cache); + for (auto const& [p1, p2] : combinations(CombinationsFullIndexPolicy(sliceCasc1, sliceCasc2))) { + const auto& posChild1 = parts.iteratorAt(p1.index() - 3); + const auto& negChild1 = parts.iteratorAt(p1.index() - 2); + const auto& bachChild1 = parts.iteratorAt(p1.index() - 1); + const auto& posChild2 = parts.iteratorAt(p2.index() - 3); + const auto& negChild2 = parts.iteratorAt(p2.index() - 2); + const auto& bachChild2 = parts.iteratorAt(p2.index() - 1); + // check cuts on Cascade children + if (Cascade1.useChildCuts) { + if (!(((posChild1.cut() & Cascade1.childPosCutBit) == Cascade1.childPosCutBit) && + ((negChild1.cut() & Cascade1.childNegCutBit) == Cascade1.childNegCutBit) && + ((bachChild1.cut() & Cascade1.childBachCutBit) == Cascade1.childBachCutBit))) { + continue; + } + } + if (Cascade1.useChildPIDCuts) { + if (!(((posChild1.pidcut() & Cascade1.childPosTPCBit) == Cascade1.childPosTPCBit) && + ((negChild1.pidcut() & Cascade1.childNegTPCBit) == Cascade1.childNegTPCBit) && + ((bachChild1.pidcut() & Cascade1.childBachTPCBit) == Cascade1.childBachTPCBit))) { + continue; + } + } + + if (Cascade2.useChildCuts) { + if (!(((posChild2.cut() & Cascade2.childPosCutBit) == Cascade2.childPosCutBit) && + ((negChild2.cut() & Cascade2.childNegCutBit) == Cascade2.childNegCutBit) && + ((bachChild2.cut() & Cascade2.childBachCutBit) == Cascade2.childBachCutBit))) { + continue; + } + } + if (Cascade2.useChildPIDCuts) { + if (!(((posChild2.pidcut() & Cascade2.childPosTPCBit) == Cascade2.childPosTPCBit) && + ((negChild2.pidcut() & Cascade2.childNegTPCBit) == Cascade2.childNegTPCBit) && + ((bachChild2.pidcut() & Cascade2.childBachTPCBit) == Cascade2.childBachTPCBit))) { + continue; + } + } + + mixedEventCont.setPair(p1, p2, collision1.multNtr(), collision1.multV0M(), Option.use4D, Option.extendedPlots, Option.smearingByOrigin); + } + } + } + + // process Mixed Event + void processMixedEvent(FilteredCollisions const& cols, FDParticles const& parts) + { + switch (Mixing.binPolicy.value) { + case femtodreamcollision::kMult: + doMixedEvent(cols, parts, partitionCascade1, partitionCascade2, colBinningMult); + break; + case femtodreamcollision::kMultPercentile: + doMixedEvent(cols, parts, partitionCascade1, partitionCascade2, colBinningMultPercentile); + break; + case femtodreamcollision::kMultMultPercentile: + doMixedEvent(cols, parts, partitionCascade1, partitionCascade2, colBinningMultMultPercentile); + break; + default: + LOG(fatal) << "Invalid binning policiy specifed. Breaking..."; + } + } + PROCESS_SWITCH(FemtoDreamPairCascadeCascade, processMixedEvent, "Enable processing mixed events", true); +}; +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{ + adaptAnalysisTask(cfgc), + }; + return workflow; +} From 61616dca905b39fc455d01245e8684a3e6102f42 Mon Sep 17 00:00:00 2001 From: Mattia Faggin Date: Fri, 5 Sep 2025 01:36:35 +0200 Subject: [PATCH 315/986] [PWGHF] tree creator for Sigmac correlated bkg. sources. (#12859) Co-authored-by: mattia --- PWGHF/D2H/Tasks/taskSigmac.cxx | 26 +- PWGHF/D2H/Utils/utilsSigmac.h | 47 +++ PWGHF/TableProducer/CMakeLists.txt | 5 + .../treeCreatorSigmacCorrBkg.cxx | 302 ++++++++++++++++++ 4 files changed, 357 insertions(+), 23 deletions(-) create mode 100644 PWGHF/D2H/Utils/utilsSigmac.h create mode 100644 PWGHF/TableProducer/treeCreatorSigmacCorrBkg.cxx diff --git a/PWGHF/D2H/Tasks/taskSigmac.cxx b/PWGHF/D2H/Tasks/taskSigmac.cxx index e3f0926fac8..6818508421a 100644 --- a/PWGHF/D2H/Tasks/taskSigmac.cxx +++ b/PWGHF/D2H/Tasks/taskSigmac.cxx @@ -17,6 +17,7 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" +#include "PWGHF/D2H/Utils/utilsSigmac.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" @@ -340,27 +341,6 @@ struct HfTaskSigmac { }; /// end init - /// @brief Function to determine if the reconstructed candidate Σc0,++ decays into Λc+ → pK-π+, Λc+ → π+K-p or both - /// @tparam L template for Lc daughter of Sc candidate - /// @tparam S template for Sc candidate - /// @param candidateLc Lc daughter of Sc candidate - /// @param candSc Sc candidate - /// @return 0: none; 1: only Λc+ → pK-π+ possible; 2: Λc+ → π+K-p possible; 3: both possible - template - int8_t isDecayToPKPiToPiKP(L& candidateLc, S& candSc) - { - int8_t channel = 0; - if ((candidateLc.isSelLcToPKPi() >= 1) && candSc.statusSpreadLcMinvPKPiFromPDG()) { - // Λc+ → pK-π+ and within the requested mass to build the Σc0,++ - SETBIT(channel, o2::aod::hf_cand_sigmac::Decays::PKPi); - } - if ((candidateLc.isSelLcToPiKP() >= 1) && candSc.statusSpreadLcMinvPiKPFromPDG()) { - // Λc+ → π+K-p and within the requested mass to build the Σc0,++ - SETBIT(channel, o2::aod::hf_cand_sigmac::Decays::PiKP); - } - return channel; /// 0: none; 1: pK-π+ only; 2: π+K-p only; 3: both possible - } - /// @brief function to fill the histograms needed in analysis (data) /// @param candidatesSc are the reconstructed candidate Σc0,++ /// @param @@ -386,7 +366,7 @@ struct HfTaskSigmac { const auto& candidateLc = candSc.prongLc_as(); // const int iscandidateLcpKpi = (candidateLc.isSelLcToPKPi() >= 1) && candSc.statusSpreadLcMinvPKPiFromPDG(); // Λc+ → pK-π+ and within the requested mass to build the Σc0,++ // const int iscandidateLcpiKp = (candidateLc.isSelLcToPiKP() >= 1) && candSc.statusSpreadLcMinvPiKPFromPDG(); // Λc+ → π+K-p and within the requested mass to build the Σc0,++ - const int8_t isCandPKPiPiKP = isDecayToPKPiToPiKP(candidateLc, candSc); + const int8_t isCandPKPiPiKP = hf_sigmac_utils::isDecayToPKPiToPiKP(candidateLc, candSc); double massSc(-1.), massLc(-1.), deltaMass(-1.); double ptSc(candSc.pt()), ptLc(candidateLc.pt()); double etaSc(candSc.eta()), etaLc(candidateLc.eta()); @@ -817,7 +797,7 @@ struct HfTaskSigmac { /// get the candidate Λc+ used to build the Σc0 /// and understand which mass hypotheses are possible const auto& candidateLc = candSc.prongLc_as(); - const int8_t isCandPKPiPiKP = isDecayToPKPiToPiKP(candidateLc, candSc); + const int8_t isCandPKPiPiKP = hf_sigmac_utils::isDecayToPKPiToPiKP(candidateLc, candSc); // candidateLc.flagMcDecayChanRec(); diff --git a/PWGHF/D2H/Utils/utilsSigmac.h b/PWGHF/D2H/Utils/utilsSigmac.h new file mode 100644 index 00000000000..b1f9012c28f --- /dev/null +++ b/PWGHF/D2H/Utils/utilsSigmac.h @@ -0,0 +1,47 @@ +// 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 utilsSigmac.h +/// \brief Utilities for Sigmac analysis +/// \author Mattia Faggin , INFN Padova + +#ifndef PWGHF_D2H_UTILS_UTILSSIGMAC_H_ +#define PWGHF_D2H_UTILS_UTILSSIGMAC_H_ + +#include "PWGHF/DataModel/CandidateReconstructionTables.h" + +#include + +namespace o2::hf_sigmac_utils +{ +/// @brief Function to determine if the reconstructed candidate Σc0,++ decays into Λc+ → pK-π+, Λc+ → π+K-p or both +/// @tparam L template for Lc daughter of Sc candidate +/// @tparam S template for Sc candidate +/// @param candidateLc Lc daughter of Sc candidate +/// @param candSc Sc candidate +/// @return 0: none; 1: only Λc+ → pK-π+ possible; 2: Λc+ → π+K-p possible; 3: both possible +template +int8_t isDecayToPKPiToPiKP(L& candidateLc, S& candSc) +{ + int8_t channel = 0; + if ((candidateLc.isSelLcToPKPi() >= 1) && candSc.statusSpreadLcMinvPKPiFromPDG()) { + // Λc+ → pK-π+ and within the requested mass to build the Σc0,++ + SETBIT(channel, o2::aod::hf_cand_sigmac::Decays::PKPi); + } + if ((candidateLc.isSelLcToPiKP() >= 1) && candSc.statusSpreadLcMinvPiKPFromPDG()) { + // Λc+ → π+K-p and within the requested mass to build the Σc0,++ + SETBIT(channel, o2::aod::hf_cand_sigmac::Decays::PiKP); + } + return channel; /// 0: none; 1: pK-π+ only; 2: π+K-p only; 3: both possible +} +} // namespace o2::hf_sigmac_utils + +#endif // PWGHF_D2H_UTILS_UTILSSIGMAC_H_ diff --git a/PWGHF/TableProducer/CMakeLists.txt b/PWGHF/TableProducer/CMakeLists.txt index e57147f6cfc..9b28ce9e88d 100644 --- a/PWGHF/TableProducer/CMakeLists.txt +++ b/PWGHF/TableProducer/CMakeLists.txt @@ -249,6 +249,11 @@ o2physics_add_dpl_workflow(tree-creator-lc-to-p-k-pi PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(tree-creator-sigmac-corr-bkg + SOURCES treeCreatorSigmacCorrBkg.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(tree-creator-omegac-st SOURCES treeCreatorOmegacSt.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter O2Physics::EventFilteringUtils diff --git a/PWGHF/TableProducer/treeCreatorSigmacCorrBkg.cxx b/PWGHF/TableProducer/treeCreatorSigmacCorrBkg.cxx new file mode 100644 index 00000000000..1e46bfc9ea5 --- /dev/null +++ b/PWGHF/TableProducer/treeCreatorSigmacCorrBkg.cxx @@ -0,0 +1,302 @@ +// 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 treeCreatorSigmacCorrBkg.cxx +/// \brief Code to reconstruct correlated-background candidates for Σc0,++ analysis +/// \note Λc± candidates selected from the HFLcCandidateSelector.cxx +/// \note Σc0,++ candidates selected from the candidateCreatorSigmac0plusplus.cxx +/// +/// \author Mattia Faggin , INFN PADOVA + +#include "PWGHF/Core/DecayChannels.h" +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/D2H/Utils/utilsSigmac.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +using namespace o2; +using namespace o2::framework; // for Produces, Configuable + +namespace o2::aod +{ +namespace hf_sigmac_bkg +{ +const int pdgCodeLambdac2595 = 14122; // o2-linter: disable=pdg/explicit-code (PDG code needed only for this study) +const int pdgCodeLambdac2625 = 4124; // o2-linter: disable=pdg/explicit-code (PDG code needed only for this study) +enum Decays { Sigmac2455Pi = 0, + LambdacPiPi }; +enum DecaysLambdac { PKPi = 0, + PiKP }; +DECLARE_SOA_COLUMN(Y, y, float); +DECLARE_SOA_COLUMN(Pt, pt, float); +DECLARE_SOA_COLUMN(Mass, mass, float); +DECLARE_SOA_COLUMN(DeltaMass, deltaMass, float); +DECLARE_SOA_COLUMN(Charge, charge, int8_t); +DECLARE_SOA_COLUMN(MotherPdg, motherPdg, int); +DECLARE_SOA_COLUMN(Decay, decay, int8_t); +DECLARE_SOA_COLUMN(DecayLambdac, decayLambdac, int8_t); +DECLARE_SOA_COLUMN(MlScoreFirstClass, mlScoreFirstClass, float); /// background score Λc +DECLARE_SOA_COLUMN(MlScoreThirdClass, mlScoreThirdClass, float); /// non-prompt score Λc +} // namespace hf_sigmac_bkg +DECLARE_SOA_TABLE(HfCorrBkgSc, "AOD", "HFCORRBKGSC", + hf_sigmac_bkg::Y, + hf_sigmac_bkg::Pt, + hf_sigmac_bkg::Mass, + hf_sigmac_bkg::DeltaMass, + hf_sigmac_bkg::Charge, + hf_sigmac_bkg::MotherPdg, + hf_sigmac_bkg::Decay, + hf_sigmac_bkg::DecayLambdac, + hf_sigmac_bkg::MlScoreFirstClass, + hf_sigmac_bkg::MlScoreThirdClass); +} // namespace o2::aod + +struct HfTreeCreatorSigmacCorrBkg { + + Produces rowCorrBkgSc; + + /// Selection of candidates Λc+ + Configurable selectionFlagLc{"selectionFlagLc", 1, "Selection Flag for Lc"}; + Configurable yCandRecoMax{"yCandRecoMax", -1, "Maximum Sc candidate rapidity"}; + + HfHelper hfHelper; + + using RecoLcMc = soa::Join; + using RecoScMc = soa::Join; + using ParticlesLcSigmac = soa::Join; + + /// @brief init function + void init(InitContext&) {} + + /// + void fillTable(RecoScMc::iterator candidateSc, RecoLcMc::iterator candLcDauSc, int motherPdg, int motherDecay = -1) + { + const int8_t chargeSc = candidateSc.charge(); // either Σc0 or Σc++ + const float rapidity = chargeSc == 0 ? hfHelper.ySc0(candidateSc) : hfHelper.yScPlusPlus(candidateSc); // NB: since in data we cannot tag Sc(2455) and Sc(2520), then we use only Sc(2455) for y selection on reconstructed signal + float massSc = -1.f; + float massLc = -1.f; + float deltaMass = -1.f; + const int8_t isCandPKPiPiKP = hf_sigmac_utils::isDecayToPKPiToPiKP(candLcDauSc, candidateSc); + std::array outputMl{-1., -1.}; + /// rapidity selection on Σc0,++ + if (yCandRecoMax >= 0. && std::abs(rapidity) > yCandRecoMax) { + return; + } + + /// BDT scores + if (candLcDauSc.mlProbLcToPiKP().size() > 0) { + outputMl.at(0) = candLcDauSc.mlProbLcToPiKP()[0]; /// bkg score + outputMl.at(1) = candLcDauSc.mlProbLcToPiKP()[2]; /// non-prompt score + } + + if ((TESTBIT(isCandPKPiPiKP, o2::aod::hf_cand_sigmac::Decays::PKPi)) && std::abs(candLcDauSc.template prong0_as().template mcParticle_as().pdgCode()) == kProton) { + massSc = hfHelper.invMassScRecoLcToPKPi(candidateSc, candLcDauSc); + massLc = hfHelper.invMassLcToPKPi(candLcDauSc); + deltaMass = massSc - massLc; + + /// fill the tree + rowCorrBkgSc(rapidity, candidateSc.pt(), massSc, deltaMass, chargeSc, motherPdg, motherDecay, aod::hf_sigmac_bkg::DecaysLambdac::PKPi, outputMl.at(0), outputMl.at(1)); + } + if ((TESTBIT(isCandPKPiPiKP, o2::aod::hf_cand_sigmac::Decays::PiKP)) && std::abs(candLcDauSc.template prong0_as().template mcParticle_as().pdgCode()) == kPiPlus) { + massSc = hfHelper.invMassScRecoLcToPiKP(candidateSc, candLcDauSc); + massLc = hfHelper.invMassLcToPiKP(candLcDauSc); + deltaMass = massSc - massLc; + + /// fill the tree + rowCorrBkgSc(rapidity, candidateSc.pt(), massSc, deltaMass, chargeSc, motherPdg, motherDecay, aod::hf_sigmac_bkg::DecaysLambdac::PiKP, outputMl.at(0), outputMl.at(1)); + } + } + + /// @brief process function to loop over the Σc reconstructed candidates and match them to corr. background sources in MC + void process(RecoScMc const& candidatesSc, + ParticlesLcSigmac const& particles, + RecoLcMc const&, + aod::TracksWMc const&) + { + /// loop over reconstructed Σc candidates + for (auto const& candidateSc : candidatesSc) { + + auto candLcDauSc = candidateSc.template prongLc_as(); + auto candSoftPiDauSc = candidateSc.template prong1_as(); + + /// tag immediately the Σc0,++(2455) and Σc0,++(2520) signal + auto flagMcDecayChanScAbs = std::abs(candidateSc.flagMcMatchRec()); + bool isTrueSigmac0 = (flagMcDecayChanScAbs == BIT(aod::hf_cand_sigmac::DecayType::Sc0ToPKPiPi)); + bool isTrueSigmacPlusPlus = (flagMcDecayChanScAbs == BIT(aod::hf_cand_sigmac::DecayType::ScplusplusToPKPiPi)); + bool isTrueSigmacStar0 = (flagMcDecayChanScAbs == BIT(aod::hf_cand_sigmac::DecayType::ScStar0ToPKPiPi)); + bool isTrueSigmacStarPlusPlus = (flagMcDecayChanScAbs == BIT(aod::hf_cand_sigmac::DecayType::ScStarPlusPlusToPKPiPi)); + if (isTrueSigmac0) { + /// fill the output for the signal + fillTable(candidateSc, candLcDauSc, o2::constants::physics::Pdg::kSigmaC0); + + /// the candidate that we reconstructed is a real Sigmac(2455, 2520), but later we look for correlated background sources + /// let's continue + continue; + } else if (isTrueSigmacPlusPlus) { + /// fill the output for the signal + fillTable(candidateSc, candLcDauSc, o2::constants::physics::Pdg::kSigmaCPlusPlus); + + /// the candidate that we reconstructed is a real Sigmac(2455, 2520), but later we look for correlated background sources + /// let's continue + continue; + } else if (isTrueSigmacStar0) { + /// fill the output for the signal + fillTable(candidateSc, candLcDauSc, o2::constants::physics::Pdg::kSigmaCStar0); + + /// the candidate that we reconstructed is a real Sigmac(2455, 2520), but later we look for correlated background sources + /// let's continue + continue; + } else if (isTrueSigmacStarPlusPlus) { + /// fill the output for the signal + fillTable(candidateSc, candLcDauSc, o2::constants::physics::Pdg::kSigmaCStarPlusPlus); + + /// the candidate that we reconstructed is a real Sigmac(2455, 2520), but later we look for correlated background sources + /// let's continue + continue; + } + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// /// + /// Look for the Σc0,++ correlated background sources. /// + /// /// + /// Two sources are possible: /// + /// /// + /// 1) Λc±(2595, 2625) → Σc0,++(2455) π+,- /// + /// In this case, we need that the candidate Σc0,++(2455) is formed by the Λc± daughter of a real Σc0,++(2455) /// + /// paired with the bachelor pion of the Λc±(2595, 2625) /// + /// /// + /// 2) Λc±(2595, 2625) → Λc± π+ π- /// + /// It means that the reconstructed Σc candidate it's actually the pair of Λc± π+ or Λc± π- /// + /// coming from the same Λc±(2595) or Λc±(2625) /// + /// /// + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + /// check if the candidate Lc and soft pion daugthers are not real Lc or pion + bool isLambdac = std::abs(candLcDauSc.flagMcMatchRec()) == hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi; + bool isPion = false; + if (candSoftPiDauSc.has_mcParticle()) { + isPion = std::abs(candSoftPiDauSc.template mcParticle_as().pdgCode()) == kPiPlus; + } + if (!isLambdac || !isPion) { + continue; + } + + /// First of all, search for an incomplete decay of Λc±(2595, 2625) into Λc± (→ pK-π+) π+ π-, + /// we will distinguish the two background sources from the first mother of the Λc± + /// This means that we look for cases in which we use 4 tracks out of 5, missing one pion. + /// The possible combinations are: (1) pK-π+ π+; (2) pK-π+ π- + /// The full chain has a max depth of 4: + /// i. Λc±(2595, 2625) → Σc0,++(2455) π+,- (+1) + /// ii. Σc0,++(2455) → Λc+ π-,+ (+1) + /// ii. Λc+ → pK-π+ which can go in the direct channel direct (+1) or through a resonance (+2) + auto arrayDaughters = std::array{candLcDauSc.template prong0_as(), + candLcDauSc.template prong1_as(), + candLcDauSc.template prong2_as(), + candidateSc.template prong1_as()}; + auto arrayPdgDaughters1 = std::array{+kProton, -kKPlus, +kPiPlus, +kPiPlus}; /// (1) + auto arrayPdgDaughters2 = std::array{+kProton, -kKPlus, +kPiPlus, -kPiPlus}; /// (2) + int8_t sign = 0; + int indexMother = -1; + int motherPdg = -1; + int motherDecay = -1; + // look for Λc±(2595) - first daughter pdg-code combination + indexMother = RecoDecay::getMatchedMCRec(particles, arrayDaughters, aod::hf_sigmac_bkg::pdgCodeLambdac2595, arrayPdgDaughters1, true, &sign, 4 /*depthMainMax*/); + if (indexMother >= 0) { + /// mother found! + motherPdg = aod::hf_sigmac_bkg::pdgCodeLambdac2595; + } else { + // look for Λc±(2595) - second daughter pdg-code combination + indexMother = RecoDecay::getMatchedMCRec(particles, arrayDaughters, aod::hf_sigmac_bkg::pdgCodeLambdac2595, arrayPdgDaughters2, true, &sign, 4 /*depthMainMax*/); + if (indexMother >= 0) { + /// mother found! + motherPdg = aod::hf_sigmac_bkg::pdgCodeLambdac2595; + } else { + // look for Λc±(2625) - first daughter pdg-code combination + indexMother = RecoDecay::getMatchedMCRec(particles, arrayDaughters, aod::hf_sigmac_bkg::pdgCodeLambdac2625, arrayPdgDaughters1, true, &sign, 4 /*depthMainMax*/); + if (indexMother >= 0) { + /// mother found! + motherPdg = aod::hf_sigmac_bkg::pdgCodeLambdac2625; + } else { + // look for Λc±(2625) - second daughter pdg-code combination + indexMother = RecoDecay::getMatchedMCRec(particles, arrayDaughters, aod::hf_sigmac_bkg::pdgCodeLambdac2625, arrayPdgDaughters2, true, &sign, 4 /*depthMainMax*/); + if (indexMother >= 0) { + /// mother found! + motherPdg = aod::hf_sigmac_bkg::pdgCodeLambdac2625; + } else { + /// no mother found, it means that this is not a corr. bkg candidate + /// let's skip it + continue; + } + } + } + } + // LOG(info) << "motherPdg: " << motherPdg; + + /// now that we matched a Λc±(2595, 2625), let's determine the precise decay channel + /// by checking the mother of the Λc± + auto arrayDaughtersLambdac = std::array{candLcDauSc.template prong0_as(), + candLcDauSc.template prong1_as(), + candLcDauSc.template prong2_as()}; + int8_t signLambdac = 0; + int indexRecLc = RecoDecay::getMatchedMCRec(particles, arrayDaughtersLambdac, o2::constants::physics::Pdg::kLambdaCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &signLambdac, 2); + if (indexRecLc < 0) { + /// this should never happen, since we check above that the isLambdac==true + LOG(fatal) << "Generated Lambdac not found. Not expected. Aborting."; + } + auto particleLc = particles.rawIteratorAt(indexRecLc); + if (particleLc.has_mothers()) { + /// we should always enter here, since the Λc± is coming from a Λc±(2595, 2625) decay + for (auto iMother = particleLc.mothersIds().front(); iMother <= particleLc.mothersIds().back(); ++iMother) { + auto mother = particles.rawIteratorAt(iMother); + int pdgCodeMotherAbs = std::abs(mother.pdgCode()); + if (pdgCodeMotherAbs == o2::constants::physics::Pdg::kSigmaC0 || pdgCodeMotherAbs == o2::constants::physics::Pdg::kSigmaCPlusPlus) { + /// the Λc± comes from a Σc0,++(2455) + /// ==> we found a Λc±(2595, 2625) → Σc0,++(2455) π+,- decay! + motherDecay = aod::hf_sigmac_bkg::Decays::Sigmac2455Pi; + + /// This should be enough, i.e. not necessary to check that the pion is not daughter of the same Sigmac + /// This case should be already excluded by searching for real Sigmac (see the beginning of the process function) + + } else { + /// considering all the checks done before, the only other possibility is that this Λc± directly comes from a Λc±(2595, 2625) + motherDecay = aod::hf_sigmac_bkg::Decays::LambdacPiPi; + } + break; + } + } else { + /// we should never eneter here + LOG(fatal) << "Lambdac particle without mothers. Not expected. Aborting."; + } + + /// we found a corr. bkg. candidate + /// let's fill our output + fillTable(candidateSc, candLcDauSc, motherPdg, motherDecay); + + } /// end loop over reconstructed Σc candidates + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From 1d5c6ce13a56975fc9615c226ef896c74f10eb6d Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 5 Sep 2025 03:11:56 +0200 Subject: [PATCH 316/986] [PWGEM/Dilepton] update matchingMFT.cxx (#12874) --- PWGEM/Dilepton/Tasks/matchingMFT.cxx | 68 +++++++++++++++++++--------- 1 file changed, 47 insertions(+), 21 deletions(-) diff --git a/PWGEM/Dilepton/Tasks/matchingMFT.cxx b/PWGEM/Dilepton/Tasks/matchingMFT.cxx index 99a0db783e2..e9f6dadc28f 100644 --- a/PWGEM/Dilepton/Tasks/matchingMFT.cxx +++ b/PWGEM/Dilepton/Tasks/matchingMFT.cxx @@ -38,6 +38,7 @@ #include #include +#include #include #include @@ -568,26 +569,37 @@ struct matchingMFT { fRegistry.fill(HIST("Event/hMultFT0CvsMultNTracksPV"), collision.multFT0C(), collision.multNTracksPV()); } - // template - // void runGen(TMCParticles const& mcParticles) - // { - // for (const auto& mcParticle : mcParticles) { - // if (std::abs(mcParticle.pdgCode()) != 13) { // select true muon - // continue; - // } - // if (!(mcParticle.isPhysicalPrimary() || mcParticle.producedByGenerator())) { - // continue; - // } - // if (mcParticle.eta() < minEtaGL || maxEtaGL < mcParticle.eta()) { - // continue; - // } - - // fRegistry.fill(HIST("Generated/primary/hs"), mcParticle.pt(), mcParticle.eta(), mcParticle.phi()); - - // } // end of mc particles - // } + std::vector> vec_min_chi2MatchMCHMFT; // std::pair -> chi2MatchMCHMFT; + template + void findBestMatchPerMCHMID(TMuons const& muons) + { + vec_min_chi2MatchMCHMFT.reserve(muons.size()); + for (const auto& muon : muons) { + if (muon.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) { + const auto& muons_per_MCHMID = muons.sliceBy(fwdtracksPerMCHTrack, muon.globalIndex()); + // LOGF(info, "stanadalone: muon.globalIndex() = %d, muon.chi2MatchMCHMFT() = %f", muon.globalIndex(), muon.chi2MatchMCHMFT()); + // LOGF(info, "muons_per_MCHMID.size() = %d", muons_per_MCHMID.size()); + + float min_chi2MatchMCHMFT = 1e+10; + std::tuple tupleIds_at_min; + for (const auto& muon_tmp : muons_per_MCHMID) { + if (muon_tmp.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) { + // LOGF(info, "muon_tmp.globalIndex() = %d, muon_tmp.matchMCHTrackId() = %d, muon_tmp.matchMFTTrackId() = %d, muon_tmp.chi2MatchMCHMFT() = %f", muon_tmp.globalIndex(), muon_tmp.matchMCHTrackId(), muon_tmp.matchMFTTrackId(), muon_tmp.chi2MatchMCHMFT()); + if (0.f < muon_tmp.chi2MatchMCHMFT() && muon_tmp.chi2MatchMCHMFT() < min_chi2MatchMCHMFT) { + min_chi2MatchMCHMFT = muon_tmp.chi2MatchMCHMFT(); + tupleIds_at_min = std::make_tuple(muon_tmp.globalIndex(), muon_tmp.matchMCHTrackId(), muon_tmp.matchMFTTrackId()); + } + } + } + vec_min_chi2MatchMCHMFT.emplace_back(tupleIds_at_min); + // mCandidates[tupleIds_at_min] = min_chi2MatchMCHMFT; + // LOGF(info, "min: muon_tmp.globalIndex() = %d, muon_tmp.matchMCHTrackId() = %d, muon_tmp.matchMFTTrackId() = %d, muon_tmp.chi2MatchMCHMFT() = %f", std::get<0>(tupleIds_at_min), std::get<1>(tupleIds_at_min), std::get<2>(tupleIds_at_min), min_chi2MatchMCHMFT); + } + } // end of muon loop + } SliceCache cache; + PresliceUnsorted fwdtracksPerMCHTrack = aod::fwdtrack::matchMCHTrackId; PresliceUnsorted perMFTTrack = o2::aod::fwdtrack::matchMFTTrackId; Preslice perCollision = o2::aod::fwdtrack::collisionId; Preslice fwdtrackIndicesPerCollision = aod::track_association::collisionId; @@ -599,6 +611,8 @@ struct matchingMFT { void processWithoutFTTCA(FilteredMyCollisions const& collisions, MyFwdTracks const& fwdtracks, MyMFTTracks const& mfttracks, aod::BCsWithTimestamps const&, aod::McParticles const&) { + findBestMatchPerMCHMID(fwdtracks); + for (const auto& collision : collisions) { const auto& bc = collision.template bc_as(); initCCDB(bc); @@ -621,15 +635,22 @@ struct matchingMFT { if (fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) { continue; } + if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && std::find(vec_min_chi2MatchMCHMFT.begin(), vec_min_chi2MatchMCHMFT.end(), std::make_tuple(fwdtrack.globalIndex(), fwdtrack.matchMCHTrackId(), fwdtrack.matchMFTTrackId())) == vec_min_chi2MatchMCHMFT.end()) { + continue; + } fillHistograms(collision, fwdtrack, fwdtracks, mfttracks); } // end of fwdtrack loop } // end of collision loop - // runGen(mcParticles); + + vec_min_chi2MatchMCHMFT.clear(); + vec_min_chi2MatchMCHMFT.shrink_to_fit(); } PROCESS_SWITCH(matchingMFT, processWithoutFTTCA, "process without FTTCA", false); void processWithFTTCA(FilteredMyCollisions const& collisions, MyFwdTracks const& fwdtracks, MyMFTTracks const& mfttracks, aod::BCsWithTimestamps const&, aod::FwdTrackAssoc const& fwdtrackIndices, aod::McParticles const&) { + findBestMatchPerMCHMID(fwdtracks); + for (const auto& collision : collisions) { const auto& bc = collision.template bc_as(); initCCDB(bc); @@ -650,13 +671,18 @@ struct matchingMFT { const auto& fwdtrackIdsThisCollision = fwdtrackIndices.sliceBy(fwdtrackIndicesPerCollision, collision.globalIndex()); for (const auto& fwdtrackId : fwdtrackIdsThisCollision) { const auto& fwdtrack = fwdtrackId.template fwdtrack_as(); - if (fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && fwdtrack.trackType()) { + if (fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) { + continue; + } + if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && std::find(vec_min_chi2MatchMCHMFT.begin(), vec_min_chi2MatchMCHMFT.end(), std::make_tuple(fwdtrack.globalIndex(), fwdtrack.matchMCHTrackId(), fwdtrack.matchMFTTrackId())) == vec_min_chi2MatchMCHMFT.end()) { continue; } fillHistograms(collision, fwdtrack, fwdtracks, mfttracks); } // end of fwdtrack loop } // end of collision loop - // runGen(mcParticles); + + vec_min_chi2MatchMCHMFT.clear(); + vec_min_chi2MatchMCHMFT.shrink_to_fit(); } PROCESS_SWITCH(matchingMFT, processWithFTTCA, "process with FTTCA", true); }; From 7c753257af8853e2e6fbcdb4f4fa966422d4520b Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 5 Sep 2025 03:46:42 +0200 Subject: [PATCH 317/986] [PWGEM/Dilepton] update treeCreatorElectronMLDDA.cxx (#12868) --- .../treeCreatorElectronMLDDA.cxx | 101 ++++++++---------- 1 file changed, 45 insertions(+), 56 deletions(-) diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx index 2cd479429bd..f45009d4646 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx @@ -229,7 +229,6 @@ struct TreeCreatorElectronMLDDA { Configurable cfg_min_ncluster_itsib{"cfg_min_ncluster_itsib", 0, "min ncluster itsib"}; Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; Configurable cfg_max_chi2its{"cfg_max_chi2its", 5.0, "max chi2/NclsITS"}; - Configurable requireTOF_for_tagging{"requireTOF_for_tagging", false, "flag to require TOF for tagging 1 leg from V0"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2, "min n sigma e in TPC for pc->ee"}; Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +2, "max n sigma e in TPC for pc->ee"}; @@ -264,7 +263,6 @@ struct TreeCreatorElectronMLDDA { Configurable cfg_min_dcaxy_v0leg{"cfg_min_dcaxy_v0leg", 0.1, "min dca XY for v0 legs in cm"}; Configurable cfg_min_dcaxy_bachelor{"cfg_min_dcaxy_bachelor", 0.05, "min dca XY for bachelor in cm"}; Configurable cfg_min_dcaxy_v0{"cfg_min_dcaxy_v0", 0.05, "min dca XY for V0 in cm"}; - Configurable requireTOF_for_tagging{"requireTOF_for_tagging", false, "flag to require TOF for tagging 1 leg from V0"}; } cascadecuts; // for RCT @@ -577,6 +575,15 @@ struct TreeCreatorElectronMLDDA { return is_Pr_TPC && is_Pr_TOF; } + template + bool isPionTightTOFreq(TTrack const& track) + { + // only for K0S-> pi+ pi- + bool is_Pi_TPC = tightv0cuts.cfg_min_TPCNsigmaPi < track.tpcNSigmaPi() && track.tpcNSigmaPi() < tightv0cuts.cfg_max_TPCNsigmaPi; + bool is_Pi_TOF = tightv0cuts.cfg_min_TOFNsigmaPi < track.tofNSigmaPi() && track.tofNSigmaPi() < tightv0cuts.cfg_max_TOFNsigmaPi; // TOFreq + return is_Pi_TPC && is_Pi_TOF; + } + template void fillTrackTable(TCollision const& collision, TTrack const& track, const uint8_t pidlabel) { @@ -800,24 +807,20 @@ struct TreeCreatorElectronMLDDA { if (v0cuts.cfg_min_qt_strangeness < v0.qtarm()) { if (v0cuts.cfg_min_qt_k0s < v0.qtarm()) { if (!(v0cuts.cfg_min_mass_lambda_veto < v0.mLambda() && v0.mLambda() < v0cuts.cfg_max_mass_lambda_veto) && !(v0cuts.cfg_min_mass_lambda_veto < v0.mAntiLambda() && v0.mAntiLambda() < v0cuts.cfg_max_mass_lambda_veto)) { - if ((isPionTight(pos) && isSelectedV0LegTight(collision, pos)) && (isPion(neg) && isSelectedV0Leg(collision, neg))) { - if (!tightv0cuts.requireTOF_for_tagging || pos.hasTOF()) { - registry.fill(HIST("V0/hMassK0Short"), v0.mK0Short()); - if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) { - registry.fill(HIST("V0/hTPCdEdx_P_Pi"), neg.tpcInnerParam(), neg.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_Pi"), neg.tpcInnerParam(), neg.beta()); - fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)); - } + if ((isPionTightTOFreq(pos) && isSelectedV0LegTight(collision, pos)) && (isPion(neg) && isSelectedV0Leg(collision, neg))) { + registry.fill(HIST("V0/hMassK0Short"), v0.mK0Short()); + if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) { + registry.fill(HIST("V0/hTPCdEdx_P_Pi"), neg.tpcInnerParam(), neg.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_Pi"), neg.tpcInnerParam(), neg.beta()); + fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)); } } - if (isPion(pos) && isSelectedV0Leg(collision, pos) && isPionTight(neg) && isSelectedV0LegTight(collision, neg)) { - if (!tightv0cuts.requireTOF_for_tagging || neg.hasTOF()) { - registry.fill(HIST("V0/hMassK0Short"), v0.mK0Short()); - if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) { - registry.fill(HIST("V0/hTPCdEdx_P_Pi"), pos.tpcInnerParam(), pos.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_Pi"), pos.tpcInnerParam(), pos.beta()); - fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)); - } + if (isPion(pos) && isSelectedV0Leg(collision, pos) && isPionTightTOFreq(neg) && isSelectedV0LegTight(collision, neg)) { + registry.fill(HIST("V0/hMassK0Short"), v0.mK0Short()); + if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) { + registry.fill(HIST("V0/hTPCdEdx_P_Pi"), pos.tpcInnerParam(), pos.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_Pi"), pos.tpcInnerParam(), pos.beta()); + fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)); } } } // end of K0S @@ -825,23 +828,19 @@ struct TreeCreatorElectronMLDDA { if (!(v0cuts.cfg_min_mass_k0s_veto < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s_veto)) { if (isProton(pos) && isSelectedV0Leg(collision, pos) && isPionTight(neg) && isSelectedV0LegTight(collision, neg)) { - if (!tightv0cuts.requireTOF_for_tagging || (neg.hasTOF() || neg.tpcInnerParam() < 0.4)) { - registry.fill(HIST("V0/hMassLambda"), v0.mLambda()); - if (v0cuts.cfg_min_mass_lambda < v0.mLambda() && v0.mLambda() < v0cuts.cfg_max_mass_lambda) { - fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton)); - registry.fill(HIST("V0/hTPCdEdx_P_Pr"), pos.tpcInnerParam(), pos.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_Pr"), pos.tpcInnerParam(), pos.beta()); - } + registry.fill(HIST("V0/hMassLambda"), v0.mLambda()); + if (v0cuts.cfg_min_mass_lambda < v0.mLambda() && v0.mLambda() < v0cuts.cfg_max_mass_lambda) { + fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton)); + registry.fill(HIST("V0/hTPCdEdx_P_Pr"), pos.tpcInnerParam(), pos.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_Pr"), pos.tpcInnerParam(), pos.beta()); } } // end of Lambda if (isPionTight(pos) && isSelectedV0LegTight(collision, pos) && isProton(neg) && isSelectedV0Leg(collision, neg)) { - if (!tightv0cuts.requireTOF_for_tagging || (pos.hasTOF() || pos.tpcInnerParam() < 0.4)) { - registry.fill(HIST("V0/hMassAntiLambda"), v0.mAntiLambda()); - if (v0cuts.cfg_min_mass_lambda < v0.mAntiLambda() && v0.mAntiLambda() < v0cuts.cfg_max_mass_lambda) { - fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton)); - registry.fill(HIST("V0/hTPCdEdx_P_Pr"), neg.tpcInnerParam(), neg.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_Pr"), neg.tpcInnerParam(), neg.beta()); - } + registry.fill(HIST("V0/hMassAntiLambda"), v0.mAntiLambda()); + if (v0cuts.cfg_min_mass_lambda < v0.mAntiLambda() && v0.mAntiLambda() < v0cuts.cfg_max_mass_lambda) { + fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton)); + registry.fill(HIST("V0/hTPCdEdx_P_Pr"), neg.tpcInnerParam(), neg.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_Pr"), neg.tpcInnerParam(), neg.beta()); } } // end of AntiLambda } @@ -849,28 +848,24 @@ struct TreeCreatorElectronMLDDA { } // end of stangeness if (isElectronTight(pos) && isSelectedV0LegTight(collision, pos) && isElectron(neg) && isSelectedV0Leg(collision, neg)) { - if (!tightv0cuts.requireTOF_for_tagging || pos.hasTOF()) { - registry.fill(HIST("V0/hMassGamma"), v0.mGamma()); - registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma()); - if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) { - registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y()); - fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)); - registry.fill(HIST("V0/hTPCdEdx_P_El"), neg.tpcInnerParam(), neg.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_El"), neg.tpcInnerParam(), neg.beta()); - } + registry.fill(HIST("V0/hMassGamma"), v0.mGamma()); + registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma()); + if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) { + registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y()); + fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)); + registry.fill(HIST("V0/hTPCdEdx_P_El"), neg.tpcInnerParam(), neg.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_El"), neg.tpcInnerParam(), neg.beta()); } } // end of photon conversion if (isElectron(pos) && isSelectedV0Leg(collision, pos) && isElectronTight(neg) && isSelectedV0LegTight(collision, neg)) { - if (!tightv0cuts.requireTOF_for_tagging || neg.hasTOF()) { - registry.fill(HIST("V0/hMassGamma"), v0.mGamma()); - registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma()); - if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) { - registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y()); - fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)); - registry.fill(HIST("V0/hTPCdEdx_P_El"), pos.tpcInnerParam(), pos.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_El"), pos.tpcInnerParam(), pos.beta()); - } + registry.fill(HIST("V0/hMassGamma"), v0.mGamma()); + registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma()); + if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) { + registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y()); + fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)); + registry.fill(HIST("V0/hTPCdEdx_P_El"), pos.tpcInnerParam(), pos.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_El"), pos.tpcInnerParam(), pos.beta()); } } // end of photon conversion @@ -890,16 +885,10 @@ struct TreeCreatorElectronMLDDA { if (!isProtonTight(pos) || !isPionTight(neg)) { continue; } - if (cascadecuts.requireTOF_for_tagging && (!pos.hasTOF() && !neg.hasTOF())) { // require TOF to proton candidates. // pion from L is soft. Don't require TOF for soft pions. - continue; - } } else { // Omegabar+ -> Lbar + K+ -> pbar + pi+ + K+ if (!isProtonTight(neg) || !isPionTight(pos)) { continue; } - if (cascadecuts.requireTOF_for_tagging && (!pos.hasTOF() && !neg.hasTOF())) { // require TOF to anti-proton candidates. // pion from L is soft. Don't require TOF for soft pions. - continue; - } } if (!(cascadecuts.cfg_min_mass_lambda < cascade.mLambda() && cascade.mLambda() < cascadecuts.cfg_max_mass_lambda)) { From 6d8f50c7404ae4be36915d1e1e1863ca6437e33f Mon Sep 17 00:00:00 2001 From: Victor Gonzalez Date: Fri, 5 Sep 2025 04:16:09 +0200 Subject: [PATCH 318/986] [PWGCF] DptDpt - Self configure the system type (#12875) Co-authored-by: Victor --- PWGCF/TableProducer/dptDptFilter.cxx | 182 +++++++++++++++++---------- PWGCF/TableProducer/dptDptFilter.h | 65 +++++----- 2 files changed, 151 insertions(+), 96 deletions(-) diff --git a/PWGCF/TableProducer/dptDptFilter.cxx b/PWGCF/TableProducer/dptDptFilter.cxx index 4f5d3644d75..6df5ac6d5ba 100644 --- a/PWGCF/TableProducer/dptDptFilter.cxx +++ b/PWGCF/TableProducer/dptDptFilter.cxx @@ -140,6 +140,20 @@ static const std::string multiplicityCentralityCorrelationsFormulaBase[11][1] = /* OO Run3 */ {"((180.584-0.211625*[CT0C]+0.00568101*[CT0C]*[CT0C]-20.9838*sqrt([CT0C])-2.5*(32.665+1.67341*[CT0C]+0.0113878*[CT0C]*[CT0C]-6.83271*sqrt([CT0C])-0.239428*[CT0C]*sqrt([CT0C])))<=[MNGLTRK])&&((-0.0533229+0.79235*[MNPVC]+5.0*(0.031512+0.0045874*[MNPVC]-1.06374e-05*[MNPVC]*[MNPVC]+0.407526*sqrt([MNPVC])))>[MNGLTRK])&&((-0.0533229+0.79235*[MNPVC]-5.0*(0.031512+0.0045874*[MNPVC]-1.06374e-05*[MNPVC]*[MNPVC]+0.407526*sqrt([MNPVC])))<=[MNGLTRK])"}, /* pO Run3 */ {""}}; +/* helpers for the system type assignment */ +static const std::string periodsOnSystemType[11][1] = { + /* no system */ {""}, + /* pp Run2 */ {""}, + /* pPb Run2 */ {""}, + /* Pbp Run2 */ {""}, + /* PbPb Run2 */ {"LHC18q,LHC18r"}, + /* XeXe Run2 */ {""}, + /* pp Run3 */ {"LHC22o"}, + /* PbPb Run3 */ {"LHC23zzh"}, + /* NeNe Run3 */ {"LHC25af"}, + /* OO Run3 */ {"LHC25ae"}, + /* pO Run3 */ {"LHC25ad"}}; + //============================================================================================ // The DptDptFilter histogram objects // TODO: consider registering in the histogram registry @@ -248,6 +262,43 @@ std::vector partMultNeg; // multiplicity of negative particles using namespace dptdptfilter; +/* we need this for the time being from TableHelper.h */ +/// Function to check for a specific configurable from another task in the current workflow and fetch its value. Useful for tasks that need to know the value of a configurable in another task. +/// @param initContext initContext of the init function +/// @param taskName name of the task to check for +/// @param optName name of the option to check for +/// @param value value of the option to set +/// @param verbose if true, print debug messages +template <> +bool o2::common::core::getTaskOptionValue(o2::framework::InitContext& initContext, const std::string& taskName, const std::string& optName, o2::framework::LabeledArray& value, const bool verbose) +{ + if (verbose) { + LOG(info) << "Checking for option '" << optName << "' in task '" << taskName << "'"; + } + const auto& workflows = initContext.services().get(); + int deviceCounter = 0; + bool found = false; + for (auto const& device : workflows.devices) { + if (verbose) { + LOG(info) << " Device " << deviceCounter++ << " " << device.name; + } + if (device.name == taskName) { // Found the mother task + int optionCounter = 0; + for (o2::framework::ConfigParamSpec const& option : device.options) { + if (verbose) { + LOG(info) << " Option " << optionCounter++ << " " << option.name << " of type " << static_cast(option.type) << " = '" << option.defaultValue.asString() << "'"; + } + if (option.name == optName) { + value = option.defaultValue.get>(); + return true; + } + } + return found; + } + } + return false; +} + ////////////////////////////////////////////////////////////////////////////// // Multiplicity in principle for on the fly generated events ////////////////////////////////////////////////////////////////////////////// @@ -416,68 +467,65 @@ struct Multiplicity { template inline void storeMultiplicitiesAndCentralities(CollisionObject const& collision, TrackListObject const& tracks) { - /* only do it if we are tracking the centrality / multiplicity correlations */ - if (useCentralityMultiplicityCorrelationsExclusion) { - int nGlobalTracks = 0; - for (auto const& track : tracks) { - if (track.isGlobalTrack()) { - nGlobalTracks++; - } + int nGlobalTracks = 0; + for (auto const& track : tracks) { + if (track.isGlobalTrack()) { + nGlobalTracks++; } - for (CentMultCorrelationsParams ipar = CentMultCorrelationsMT0A; ipar < CentMultCorrelationsNOOFPARAMS; ++ipar) { - switch (ipar) { - case CentMultCorrelationsMT0A: - collisionMultiplicityCentralityObservables[ipar] = collision.multFT0A(); - break; - case CentMultCorrelationsMT0C: - collisionMultiplicityCentralityObservables[ipar] = collision.multFT0C(); - break; - case CentMultCorrelationsMT0M: - collisionMultiplicityCentralityObservables[ipar] = collision.multFT0M(); - break; - case CentMultCorrelationsMV0A: - collisionMultiplicityCentralityObservables[ipar] = collision.multFV0A(); - break; - case CentMultCorrelationsMV0C: - collisionMultiplicityCentralityObservables[ipar] = collision.multFV0C(); - break; - case CentMultCorrelationsMV0M: - collisionMultiplicityCentralityObservables[ipar] = collision.multFV0M(); - break; - case CentMultCorrelationsMNGLTRK: - collisionMultiplicityCentralityObservables[ipar] = nGlobalTracks; - break; - case CentMultCorrelationsMNPVC: - collisionMultiplicityCentralityObservables[ipar] = collision.multNTracksPV(); - break; - case CentMultCorrelationsCT0A: - if constexpr (framework::has_type_v) { - collisionMultiplicityCentralityObservables[ipar] = collision.centFT0A(); - } - break; - case CentMultCorrelationsCT0C: - if constexpr (framework::has_type_v) { - collisionMultiplicityCentralityObservables[ipar] = collision.centFT0C(); - } - break; - case CentMultCorrelationsCT0M: - if constexpr (framework::has_type_v) { - collisionMultiplicityCentralityObservables[ipar] = collision.centFT0M(); - } - break; - case CentMultCorrelationsCV0A: - if constexpr (framework::has_type_v) { - collisionMultiplicityCentralityObservables[ipar] = collision.centFV0A(); - } - break; - case CentMultCorrelationsCNTPV: - if constexpr (framework::has_type_v) { - collisionMultiplicityCentralityObservables[ipar] = collision.centNTPV(); - } - break; - default: - break; - } + } + for (CentMultCorrelationsParams ipar = CentMultCorrelationsMT0A; ipar < CentMultCorrelationsNOOFPARAMS; ++ipar) { + switch (ipar) { + case CentMultCorrelationsMT0A: + collisionMultiplicityCentralityObservables[ipar] = collision.multFT0A(); + break; + case CentMultCorrelationsMT0C: + collisionMultiplicityCentralityObservables[ipar] = collision.multFT0C(); + break; + case CentMultCorrelationsMT0M: + collisionMultiplicityCentralityObservables[ipar] = collision.multFT0M(); + break; + case CentMultCorrelationsMV0A: + collisionMultiplicityCentralityObservables[ipar] = collision.multFV0A(); + break; + case CentMultCorrelationsMV0C: + collisionMultiplicityCentralityObservables[ipar] = collision.multFV0C(); + break; + case CentMultCorrelationsMV0M: + collisionMultiplicityCentralityObservables[ipar] = collision.multFV0M(); + break; + case CentMultCorrelationsMNGLTRK: + collisionMultiplicityCentralityObservables[ipar] = nGlobalTracks; + break; + case CentMultCorrelationsMNPVC: + collisionMultiplicityCentralityObservables[ipar] = collision.multNTracksPV(); + break; + case CentMultCorrelationsCT0A: + if constexpr (framework::has_type_v) { + collisionMultiplicityCentralityObservables[ipar] = collision.centFT0A(); + } + break; + case CentMultCorrelationsCT0C: + if constexpr (framework::has_type_v) { + collisionMultiplicityCentralityObservables[ipar] = collision.centFT0C(); + } + break; + case CentMultCorrelationsCT0M: + if constexpr (framework::has_type_v) { + collisionMultiplicityCentralityObservables[ipar] = collision.centFT0M(); + } + break; + case CentMultCorrelationsCV0A: + if constexpr (framework::has_type_v) { + collisionMultiplicityCentralityObservables[ipar] = collision.centFV0A(); + } + break; + case CentMultCorrelationsCNTPV: + if constexpr (framework::has_type_v) { + collisionMultiplicityCentralityObservables[ipar] = collision.centNTPV(); + } + break; + default: + break; } } } @@ -515,7 +563,7 @@ struct DptDptFilter { Configurable maxOccupancy{"maxOccupancy", 1e6f, "Maximum allowed occupancy. Depends on the occupancy estimation"}; } occupancySelection; } cfgEventSelection; - Configurable cfgSystem{"cfgSystem", "PbPb", "System: Auto, pp, PbPb, Pbp, pPb, XeXe, ppRun3, PbPbRun3. Default PbPb"}; + Configurable> cfgSystemForPeriod{"cfgSystemForPeriod", {periodsOnSystemType[0], 11, 1, {SYSTEMNAME(0), SYSTEMNAME(1), SYSTEMNAME(2), SYSTEMNAME(3), SYSTEMNAME(4), SYSTEMNAME(5), SYSTEMNAME(6), SYSTEMNAME(7), SYSTEMNAME(8), SYSTEMNAME(9), SYSTEMNAME(10)}, {"Periods separated by commas"}}, "List of periods associated to each system type"}; Configurable cfgDataType{"cfgDataType", "data", "Data type: data, datanoevsel, MC, FastMC, OnTheFlyMC. Default data"}; Configurable cfgCentSpec{"cfgCentSpec", "00-10,10-20,20-30,30-40,40-50,50-60,60-70,70-80", "Centrality/multiplicity ranges in min-max separated by commas"}; Configurable cfgOverallMinP{"cfgOverallMinP", 0.0f, "The overall minimum momentum for the analysis. Default: 0.0"}; @@ -588,8 +636,8 @@ struct DptDptFilter { triggerSelectionFlags = getTriggerSelection(cfgEventSelection.triggSel.value.c_str()); traceCollId0 = cfgTraceCollId0; - /* if the system type is not known at this time, we have to put the initialization somewhere else */ - fSystem = getSystemType(cfgSystem.value.c_str()); + /* get the system type */ + fSystem = getSystemType(cfgSystemForPeriod.value); fLhcRun = multRunForSystemMap.at(fSystem); fDataType = getDataType(cfgDataType); @@ -1151,10 +1199,10 @@ struct DptDptFilterTracks { tpcExcluder.setCuts(pLowCut, pUpCut, nLowCut, nUpCut); /* self configure system type and data type */ - /* if the system type is not known at this time, we have to put the initialization somewhere else */ + o2::framework::LabeledArray tmpArray = {periodsOnSystemType[0], 11, 1, {SYSTEMNAME(0), SYSTEMNAME(1), SYSTEMNAME(2), SYSTEMNAME(3), SYSTEMNAME(4), SYSTEMNAME(5), SYSTEMNAME(6), SYSTEMNAME(7), SYSTEMNAME(8), SYSTEMNAME(9), SYSTEMNAME(10)}, {"Periods separated by commas"}}; + getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgSystem", tmpArray, false); + fSystem = getSystemType(tmpArray); std::string tmpstr; - getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgSystem", tmpstr, false); - fSystem = getSystemType(tmpstr); getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgDataType", tmpstr, false); fDataType = getDataType(tmpstr); diff --git a/PWGCF/TableProducer/dptDptFilter.h b/PWGCF/TableProducer/dptDptFilter.h index 14a49c3bbf0..5e1a479631e 100644 --- a/PWGCF/TableProducer/dptDptFilter.h +++ b/PWGCF/TableProducer/dptDptFilter.h @@ -86,6 +86,25 @@ enum SystemType { SystemNoOfSystems ///< number of handled systems }; +/// @brief SystemType prefix increment operator +/// @param ipar value +/// @return the incremented value +inline SystemType& operator++(SystemType& ipar) +{ + return ipar = static_cast(static_cast(ipar) + 1); +} + +/// @brief SystemType postfix increment operator +/// @param ipar the value +/// @param empty +/// @return the same value +inline SystemType operator++(SystemType& ipar, int) +{ + SystemType iparTmp(ipar); + ++ipar; + return iparTmp; +} + /// \std::map systemInternalCodesMap /// \brief maps system names to internal system codes static const std::map systemInternalCodesMap{ @@ -856,40 +875,28 @@ inline std::bitset<32> getTriggerSelection(std::string_view const& triggstr) return flags; } -inline SystemType getSytemTypeFromMetaData() +inline SystemType getSystemType(auto const& periodsForSysType) { auto period = metadataInfo.get("LPMProductionTag"); auto anchoredPeriod = metadataInfo.get("AnchorProduction"); + bool checkAnchor = anchoredPeriod.length() > 0; - if (period == "LHC25ad" || anchoredPeriod == "LHC25ad") { - LOGF(info, "Configuring for p-O (anchored to) LHC25ad period"); - return SystemPORun3; - } else if (period == "LHC25ae" || anchoredPeriod == "LHC25ae") { - LOGF(info, "Configuring for O-O (anchored to) LHC25ae period"); - return SystemOORun3; - } else if (period == "LHC25af" || anchoredPeriod == "LHC25af") { - LOGF(info, "Configuring for Ne-Ne (anchored to) LHC25af period"); - return SystemNeNeRun3; - } else { - LOGF(fatal, "DptDptCorrelations::getSystemTypeFromMetadata(). No automatic system type configuration for %s period", period.c_str()); - } - return SystemPbPb; -} - -inline SystemType getSystemType(std::string_view const& sysstr) -{ - /* we have to figure out how extract the system type */ - if (sysstr == "Auto") { - /* special treatment for self configuration */ - /* TODO: expand it to all systems */ - return getSytemTypeFromMetaData(); - } else { - if (systemInternalCodesMap.contains(sysstr)) { - return static_cast(systemInternalCodesMap.at(sysstr)); - } else { - LOGF(fatal, "DptDptCorrelations::getSystemType(). Wrong system type: %s", sysstr.data()); + for (SystemType sT = SystemNoSystem; sT < SystemNoOfSystems; ++sT) { + const std::string& periods = periodsForSysType[static_cast(sT)][0]; + auto contains = [periods](auto const& period) { + if (periods.find(period) != std::string::npos) { + return true; + } + return false; + }; + if (periods.length() > 0) { + if (contains(period) || (checkAnchor && contains(anchoredPeriod))) { + LOGF(info, "DptDptCorrelations::getSystemType(). Assigned system type %s for period %s", systemExternalNamesMap.at(static_cast(sT)).data(), period.c_str()); + return sT; + } } } + LOGF(fatal, "DptDptCorrelations::getSystemType(). No system type for period: %s", period.c_str()); return SystemPbPb; } @@ -954,11 +961,11 @@ inline OccupancyEstimationType getOccupancyEstimator(const std::string_view& est /// @return the expression TFormula inline TFormula* getExclusionFormula(std::string_view formula) { + collisionMultiplicityCentralityObservables.resize(CentMultCorrelationsNOOFPARAMS); if (formula.length() != 0) { useCentralityMultiplicityCorrelationsExclusion = true; TFormula* f = new TFormula("Exclussion expression", formula.data()); int nParameters = f->GetNpar(); - collisionMultiplicityCentralityObservables.resize(CentMultCorrelationsNOOFPARAMS); observableIndexForCentralityMultiplicityParameter.resize(nParameters); LOGF(info, "Configuring outliers exclusion with the formula %s which has %d parameters", formula.data(), nParameters); for (int iPar = 0; iPar < nParameters; ++iPar) { From acc5a4429b11c17876be13c4eb1a03d37625d866 Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Fri, 5 Sep 2025 05:56:52 +0200 Subject: [PATCH 319/986] [DPG] Fix typo in decay length compression for D0 derived data for calibration (#12869) --- DPG/Tasks/AOTTrack/D0CalibTables.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DPG/Tasks/AOTTrack/D0CalibTables.h b/DPG/Tasks/AOTTrack/D0CalibTables.h index 1564b6cebdf..33c9efdc2dd 100644 --- a/DPG/Tasks/AOTTrack/D0CalibTables.h +++ b/DPG/Tasks/AOTTrack/D0CalibTables.h @@ -95,7 +95,7 @@ int codeSqrtScaling(float origValue, float sigma0, float sigma1, int clampMin, i template uint8_t getCompressedDecayLength(T decLen) { - return getCompressedUint8(decLen * hf_calib::toMicrometers, 0.1); + return getCompressedUint8(decLen * hf_calib::toMicrometers, 10); } /// It compresses the normalised decay length (0.5 precision) From a812ed4e865c9cc0990183a1f6b62256a85dae6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?BiaoZhang=20=28=E5=BC=A0=E5=BD=AA=29?= <52267892+zhangbiao-phy@users.noreply.github.com> Date: Fri, 5 Sep 2025 09:21:56 +0200 Subject: [PATCH 320/986] [PWGHF,PWGCF] Store charm hadron + track invariant mass in derived tree (#12864) --- PWGCF/DataModel/FemtoDerived.h | 2 + .../HFC/Tasks/taskCharmHadronsFemtoDream.cxx | 53 ++++++++++++++++++- 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/PWGCF/DataModel/FemtoDerived.h b/PWGCF/DataModel/FemtoDerived.h index 3be2baadc37..6bcd3432daf 100644 --- a/PWGCF/DataModel/FemtoDerived.h +++ b/PWGCF/DataModel/FemtoDerived.h @@ -243,6 +243,7 @@ DECLARE_SOA_COLUMN(Kstar, kstar, float); //! Relative DECLARE_SOA_COLUMN(KT, kT, float); //! kT distribution of particle pairs DECLARE_SOA_COLUMN(MT, mT, float); //! Transverse mass distribution DECLARE_SOA_COLUMN(CharmM, charmM, float); //! Charm hadron mass +DECLARE_SOA_COLUMN(CharmTrkM, charmtrkM, float); //! Charm hadron track mass DECLARE_SOA_COLUMN(CharmPt, charmPt, float); //! Transverse momentum of charm hadron for result task DECLARE_SOA_COLUMN(CharmEta, charmEta, float); //! Eta of charm hadron for result task DECLARE_SOA_COLUMN(CharmPhi, charmPhi, float); //! Phi of charm hadron for result task @@ -327,6 +328,7 @@ DECLARE_SOA_TABLE(FDHfPairs, "AOD", "FDHFPAIRS", //! table to store results for fdhf::MultPercentile, fdhf::Charge, fdhf::PairSign, + fdhf::CharmTrkM, fdhf::ProcessType, fdhf::FlagMc, fdhf::OriginMcRec); diff --git a/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx b/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx index 5632f7eefe8..96af0f52f5a 100644 --- a/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx +++ b/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx @@ -24,6 +24,8 @@ #include "PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h" #include "PWGCF/FemtoDream/Core/femtoDreamUtils.h" +#include "Common/Core/RecoDecay.h" + #include #include #include @@ -298,6 +300,49 @@ struct HfTaskCharmHadronsFemtoDream { return invMass; } + template + float getCharmHadronTrackMass(const Candidate& cand, + const Track& trk, + double trackMassHyp = o2::constants::physics::MassProton) + { + + auto pVecProng0 = RecoDecayPtEtaPhi::pVector(cand.prong0Pt(), cand.prong0Eta(), cand.prong0Phi()); + auto pVecProng1 = RecoDecayPtEtaPhi::pVector(cand.prong1Pt(), cand.prong1Eta(), cand.prong1Phi()); + auto pVecProng2 = RecoDecayPtEtaPhi::pVector(cand.prong2Pt(), cand.prong2Eta(), cand.prong2Phi()); + auto pVecTrack = RecoDecayPtEtaPhi::pVector(trk.pt(), trk.eta(), trk.phi()); + const auto pVecCharmTrk = std::array{pVecProng0, pVecProng1, pVecProng2, pVecTrack}; + + std::array massCharmTrk{}; + + if (charmHadPDGCode == o2::constants::physics::Pdg::kLambdaCPlus) { + // Λc⁺ → p K π + if (cand.candidateSelFlag() == 1) { + massCharmTrk = { + o2::constants::physics::MassProton, + o2::constants::physics::MassKPlus, + o2::constants::physics::MassPiPlus, + trackMassHyp}; + } else { + // prong0=π, prong1=K, prong2=p + massCharmTrk = { + o2::constants::physics::MassPiPlus, + o2::constants::physics::MassKPlus, + o2::constants::physics::MassProton, + trackMassHyp}; + } + } else if (charmHadPDGCode == o2::constants::physics::Pdg::kDPlus) { + // D⁺ → π K π + massCharmTrk = { + o2::constants::physics::MassPiPlus, + o2::constants::physics::MassKPlus, + o2::constants::physics::MassPiPlus, + trackMassHyp}; + } else { + return -1.f; + } + return static_cast(RecoDecay::m(pVecCharmTrk, massCharmTrk)); + } + /// This function processes the same event and takes care of all the histogramming template void doSameEvent(PartitionType& sliceTrk1, CandType& sliceCharmHad, TableTracks const& parts, Collision const& col) @@ -323,7 +368,6 @@ struct HfTaskCharmHadronsFemtoDream { if (kstar > highkstarCut) { continue; } - float invMass = getCharmHadronMass(p2); if (invMass < charmHadMinInvMass || invMass > charmHadMaxInvMass) { @@ -334,6 +378,8 @@ struct HfTaskCharmHadronsFemtoDream { continue; } + float deltaInvMassPair = getCharmHadronTrackMass(p2, p1, o2::constants::physics::MassProton) - invMass; + // proton track charge float chargeTrack = 0.; if ((p1.cut() & CutBitChargePositive) == CutBitChargePositive) { @@ -372,6 +418,7 @@ struct HfTaskCharmHadronsFemtoDream { col.multV0M(), p2.charge(), pairSign, + deltaInvMassPair, processType, charmHadMc, originType); @@ -427,6 +474,9 @@ struct HfTaskCharmHadronsFemtoDream { if (p2.pt() < charmHadMinPt || p2.pt() > charmHadMaxPt) { continue; } + + float deltaInvMassPair = getCharmHadronTrackMass(p2, p1, o2::constants::physics::MassProton) - invMass; + // proton track charge float chargeTrack = 0.; if ((p1.cut() & CutBitChargePositive) == CutBitChargePositive) { @@ -462,6 +512,7 @@ struct HfTaskCharmHadronsFemtoDream { collision1.multV0M(), p2.charge(), pairSign, + deltaInvMassPair, processType, charmHadMc, originType); From f14d03866d85e0fe556abf5874edecbf5b155d06 Mon Sep 17 00:00:00 2001 From: Francesco Mazzaschi <43742195+fmazzasc@users.noreply.github.com> Date: Fri, 5 Sep 2025 12:57:50 +0200 Subject: [PATCH 321/986] [PWGLF] Add He3 fake cluster information (#12876) Co-authored-by: Francesco Mazzaschi --- PWGLF/DataModel/LFHypernucleiTables.h | 4 +++- PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx | 11 +++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/PWGLF/DataModel/LFHypernucleiTables.h b/PWGLF/DataModel/LFHypernucleiTables.h index 6b10a7ddd9f..6f673326b2e 100644 --- a/PWGLF/DataModel/LFHypernucleiTables.h +++ b/PWGLF/DataModel/LFHypernucleiTables.h @@ -14,8 +14,8 @@ /// \brief Slim hypernuclei tables /// -#include "Framework/AnalysisDataModel.h" #include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" #ifndef PWGLF_DATAMODEL_LFHYPERNUCLEITABLES_H_ #define PWGLF_DATAMODEL_LFHYPERNUCLEITABLES_H_ @@ -81,6 +81,7 @@ DECLARE_SOA_COLUMN(GenXDecVtx, genXDecVtx, float); // Decay v DECLARE_SOA_COLUMN(GenYDecVtx, genYDecVtx, float); // Decay vertex of the candidate (y direction) DECLARE_SOA_COLUMN(GenZDecVtx, genZDecVtx, float); // Decay vertex of the candidate (z direction) DECLARE_SOA_COLUMN(IsReco, isReco, bool); // bool: true for reco +DECLARE_SOA_COLUMN(IsFakeHeOnITSLayer, isFakeHeOnITSLayer, uint8_t); // uint8_t: bit map for fake He on ITS layers DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); // bool: true for signal DECLARE_SOA_COLUMN(IsRecoMCCollision, isRecoMCCollision, bool); // bool: true for reco MC collision DECLARE_SOA_COLUMN(IsSurvEvSel, isSurvEvSel, bool); // bool: true for survived event selection @@ -144,6 +145,7 @@ DECLARE_SOA_TABLE(MCHypCands, "AOD", "MCHYPCANDS", hyperrec::GenYDecVtx, hyperrec::GenZDecVtx, hyperrec::IsReco, + hyperrec::IsFakeHeOnITSLayer, hyperrec::IsSignal, hyperrec::IsRecoMCCollision, hyperrec::IsSurvEvSel); diff --git a/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx b/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx index ebe45137da0..80854f81617 100644 --- a/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx @@ -124,8 +124,10 @@ struct hyperCandidate { int64_t collisionID = 0; bool isMatter = false; - bool isSignal = false; // true MC signal - bool isReco = false; // true if the candidate is actually reconstructed + bool isSignal = false; // true MC signal + bool isReco = false; // true if the candidate is actually reconstructed + uint8_t isFakeHeOnITSLayer = 0u; // bit map for fake He on ITS layers + bool isRecoMCCollision = false; // true if the corresponding MC collision has been reconstructed bool isSurvEvSelection = false; // true if the corresponding event passed the event selection int pdgCode = 0; // PDG code of the hypernucleus @@ -649,6 +651,7 @@ struct hyperRecoTask { hypCand.gDecVtx[i] = secVtx[i] - primVtx[i]; } hypCand.isSignal = true; + hypCand.isFakeHeOnITSLayer = mcLabHe.mcMask() & 0x7F; // check if any of the first 7 bits is set hypCand.pdgCode = heMother.pdgCode(); hypCand.isRecoMCCollision = recoCollisionIds[heMother.mcCollisionId()] > 0; hypCand.isSurvEvSelection = isSurvEvSelCollision[heMother.mcCollisionId()]; @@ -795,7 +798,7 @@ struct hyperRecoTask { hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags, trackedHypClSize, chargeFactor * hypCand.genPt(), hypCand.genPhi(), hypCand.genEta(), hypCand.genPtHe3(), hypCand.gDecVtx[0], hypCand.gDecVtx[1], hypCand.gDecVtx[2], - hypCand.isReco, hypCand.isSignal, hypCand.isRecoMCCollision, hypCand.isSurvEvSelection); + hypCand.isReco, hypCand.isFakeHeOnITSLayer, hypCand.isSignal, hypCand.isRecoMCCollision, hypCand.isSurvEvSelection); } // now we fill only the signal candidates that were not reconstructed @@ -868,7 +871,7 @@ struct hyperRecoTask { -1, -1, -1, false, chargeFactor * hypCand.genPt(), hypCand.genPhi(), hypCand.genEta(), hypCand.genPtHe3(), hypCand.gDecVtx[0], hypCand.gDecVtx[1], hypCand.gDecVtx[2], - hypCand.isReco, hypCand.isSignal, hypCand.isRecoMCCollision, hypCand.isSurvEvSelection); + hypCand.isReco, -1, hypCand.isSignal, hypCand.isRecoMCCollision, hypCand.isSurvEvSelection); } } PROCESS_SWITCH(hyperRecoTask, processMC, "MC analysis", false); From d3411d5648e92c532117de759d08545f482cd749 Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Fri, 5 Sep 2025 13:40:59 +0200 Subject: [PATCH 322/986] [PWGLF] Fix bug in derived data and rotational background in task (#12872) --- .../Resonances/f1protonreducedtable.cxx | 2 +- .../Tasks/Resonances/f1protoncorrelation.cxx | 99 ++++++++++--------- 2 files changed, 56 insertions(+), 45 deletions(-) diff --git a/PWGLF/TableProducer/Resonances/f1protonreducedtable.cxx b/PWGLF/TableProducer/Resonances/f1protonreducedtable.cxx index 0f1ea4cdbe7..5004b2f1bd8 100644 --- a/PWGLF/TableProducer/Resonances/f1protonreducedtable.cxx +++ b/PWGLF/TableProducer/Resonances/f1protonreducedtable.cxx @@ -779,7 +779,7 @@ struct f1protonreducedtable { PionTPCFinal.push_back(PionTPC.at(i1)); // Pion TPC KaonTPCFinal.push_back(KaonTPC.at(i2)); // Kaon TPC KaonTPCPionHypoFinal.push_back(KaonTPCPionHypo.at(i2)); // Kaon TPC - if (pairsign == 1) { + if (pairsign > 0) { qaRegistry.fill(HIST("hInvMassf1"), F1Vector.M(), F1Vector.Pt()); numberF1 = numberF1 + 1; for (auto iproton = protons.begin(); iproton != protons.end(); ++iproton) { diff --git a/PWGLF/Tasks/Resonances/f1protoncorrelation.cxx b/PWGLF/Tasks/Resonances/f1protoncorrelation.cxx index 41a21b66358..02395a2b1fe 100644 --- a/PWGLF/Tasks/Resonances/f1protoncorrelation.cxx +++ b/PWGLF/Tasks/Resonances/f1protoncorrelation.cxx @@ -79,6 +79,7 @@ struct f1protoncorrelation { Configurable momentumTOFProton{"momentumTOFProton", 0.7, "Proton momentum TOF"}; Configurable momentumProtonMax{"momentumProtonMax", 3.0, "Maximum proton momentum"}; Configurable lowPtF1{"lowPtF1", 1.0, "PT cut F1"}; + Configurable nRot{"nRot", 4, "Number of rotational bkg"}; // Event Mixing Configurable nEvtMixing{"nEvtMixing", 10, "Number of events to mix"}; ConfigurableAxis CfgVtxBins{"CfgVtxBins", {10, -10, 10}, "Mixing bins - z-vertex"}; @@ -213,7 +214,7 @@ struct f1protoncorrelation { } float combinedTPC; TLorentzVector F1, Proton, F1ProtonPair, Pion, Kaon, Kshort; - TLorentzVector F1Rot, PionRot, KaonKshortPair, KaonKshortPairRot; + TLorentzVector F1Rot, PionRot, KaonKshortPair; // Process the data in same event int currentRunNumber = -999; @@ -299,7 +300,9 @@ struct f1protoncorrelation { histos.fill(HIST("hNsigmaProtonTPC"), protontrack.protonNsigmaTPC(), Proton.Pt()); } histos.fill(HIST("h2SameEventPtCorrelation"), relative_momentum, F1.Pt(), Proton.Pt()); + if (f1track.f1SignalStat() > 0) { + // check charge int f1Charge = f1track.f1SignalStat(); if (f1Charge == 2) { f1Charge = -1; @@ -312,6 +315,26 @@ struct f1protoncorrelation { if (fillSparse) { histos.fill(HIST("SEMassUnlike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC, pairCharge); } + if (fillRotation) { + for (int nrotbkg = 0; nrotbkg < nRot; nrotbkg++) { + auto anglestart = 5.0 * TMath::Pi() / 6.0; + auto angleend = 7.0 * TMath::Pi() / 6.0; + auto anglestep = (angleend - anglestart) / (1.0 * (9.0 - 1.0)); + auto rotangle = anglestart + nrotbkg * anglestep; + auto rotPionPx = Pion.Px() * std::cos(rotangle) - Pion.Py() * std::sin(rotangle); + auto rotPionPy = Pion.Px() * std::sin(rotangle) + Pion.Py() * std::cos(rotangle); + PionRot.SetXYZM(rotPionPx, rotPionPy, Pion.Pz(), Pion.M()); + F1Rot = PionRot + KaonKshortPair; + if (F1Rot.Pt() < 1.0) { + continue; + } + auto relative_momentum_rot = getkstar(F1Rot, Proton); + histos.fill(HIST("h2SameEventInvariantMassRot_mass"), relative_momentum_rot, F1Rot.Pt(), F1Rot.M(), pairCharge); + if (fillSparse) { + histos.fill(HIST("SEMassRot"), F1Rot.M(), F1Rot.Pt(), Proton.Pt(), relative_momentum_rot, combinedTPC, pairCharge); + } + } + } } if (f1track.f1SignalStat() == -1) { histos.fill(HIST("h2SameEventInvariantMassLike_mass"), relative_momentum, F1.Pt(), F1.M(), protontrack.protonCharge()); @@ -319,25 +342,6 @@ struct f1protoncorrelation { histos.fill(HIST("SEMassLike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC, protontrack.protonCharge()); } } - if (fillRotation) { - for (int nrotbkg = 0; nrotbkg < 9; nrotbkg++) { - auto anglestart = 5.0 * TMath::Pi() / 6.0; - auto angleend = 7.0 * TMath::Pi() / 6.0; - auto anglestep = (angleend - anglestart) / (1.0 * (9.0 - 1.0)); - auto rotangle = anglestart + nrotbkg * anglestep; - auto rotKKPx = KaonKshortPair.Px() * std::cos(rotangle) - KaonKshortPair.Py() * std::sin(rotangle); - auto rotKKPy = KaonKshortPair.Px() * std::sin(rotangle) + KaonKshortPair.Py() * std::cos(rotangle); - KaonKshortPairRot.SetXYZM(rotKKPx, rotKKPy, KaonKshortPair.Pz(), KaonKshortPair.M()); - F1Rot = Pion + KaonKshortPairRot; - auto relative_momentum_rot = getkstar(F1Rot, Proton); - if (f1track.f1SignalStat() > 0) { - histos.fill(HIST("h2SameEventInvariantMassRot_mass"), relative_momentum_rot, F1Rot.Pt(), F1Rot.M(), protontrack.protonCharge()); - if (fillSparse) { - histos.fill(HIST("SEMassRot"), F1Rot.M(), F1Rot.Pt(), Proton.Pt(), relative_momentum_rot, combinedTPC, protontrack.protonCharge()); - } - } - } - } } } } @@ -430,15 +434,18 @@ struct f1protoncorrelation { } } if (fillRotation) { - for (int nrotbkg = 0; nrotbkg < 9; nrotbkg++) { + for (int nrotbkg = 0; nrotbkg < nRot; nrotbkg++) { auto anglestart = 5.0 * TMath::Pi() / 6.0; auto angleend = 7.0 * TMath::Pi() / 6.0; auto anglestep = (angleend - anglestart) / (1.0 * (9.0 - 1.0)); auto rotangle = anglestart + nrotbkg * anglestep; - auto rotKKPx = KaonKshortPair.Px() * std::cos(rotangle) - KaonKshortPair.Py() * std::sin(rotangle); - auto rotKKPy = KaonKshortPair.Px() * std::sin(rotangle) + KaonKshortPair.Py() * std::cos(rotangle); - KaonKshortPairRot.SetXYZM(rotKKPx, rotKKPy, KaonKshortPair.Pz(), KaonKshortPair.M()); - F1Rot = Pion + KaonKshortPairRot; + auto rotPionPx = Pion.Px() * std::cos(rotangle) - Pion.Py() * std::sin(rotangle); + auto rotPionPy = Pion.Px() * std::sin(rotangle) + Pion.Py() * std::cos(rotangle); + PionRot.SetXYZM(rotPionPx, rotPionPy, Pion.Pz(), Pion.M()); + F1Rot = PionRot + KaonKshortPair; + if (F1Rot.Pt() < 1.0) { + continue; + } auto relative_momentum_rot = getkstar(F1Rot, Proton); if (t1.f1SignalStat() > 0) { histos.fill(HIST("h2MixEventInvariantMassRot_mass"), relative_momentum_rot, F1Rot.Pt(), F1Rot.M(), 1.0); @@ -538,6 +545,29 @@ struct f1protoncorrelation { if (fillSparse) { histos.fill(HIST("MEMassUnlike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC, pairCharge); } + + if (fillRotation) { + for (int nrotbkg = 0; nrotbkg < nRot; nrotbkg++) { + auto anglestart = 5.0 * TMath::Pi() / 6.0; + auto angleend = 7.0 * TMath::Pi() / 6.0; + auto anglestep = (angleend - anglestart) / (1.0 * (9.0 - 1.0)); + auto rotangle = anglestart + nrotbkg * anglestep; + auto rotPionPx = Pion.Px() * std::cos(rotangle) - Pion.Py() * std::sin(rotangle); + auto rotPionPy = Pion.Px() * std::sin(rotangle) + Pion.Py() * std::cos(rotangle); + PionRot.SetXYZM(rotPionPx, rotPionPy, Pion.Pz(), Pion.M()); + F1Rot = PionRot + KaonKshortPair; + if (F1Rot.Pt() < 1.0) { + continue; + } + auto relative_momentum_rot = getkstar(F1Rot, Proton); + if (t1.f1SignalStat() > 0) { + histos.fill(HIST("h2MixEventInvariantMassRot_mass"), relative_momentum_rot, F1Rot.Pt(), F1Rot.M(), pairCharge); + if (fillSparse) { + histos.fill(HIST("MEMassRot"), F1Rot.M(), F1Rot.Pt(), Proton.Pt(), relative_momentum_rot, combinedTPC, pairCharge); + } + } + } + } } if (t1.f1SignalStat() == -1) { histos.fill(HIST("h2MixEventInvariantMassLike_mass"), relative_momentum, F1.Pt(), F1.M(), t2.protonCharge()); @@ -545,25 +575,6 @@ struct f1protoncorrelation { histos.fill(HIST("MEMassLike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC, t2.protonCharge()); } } - if (fillRotation) { - for (int nrotbkg = 0; nrotbkg < 9; nrotbkg++) { - auto anglestart = 5.0 * TMath::Pi() / 6.0; - auto angleend = 7.0 * TMath::Pi() / 6.0; - auto anglestep = (angleend - anglestart) / (1.0 * (9.0 - 1.0)); - auto rotangle = anglestart + nrotbkg * anglestep; - auto rotKKPx = KaonKshortPair.Px() * std::cos(rotangle) - KaonKshortPair.Py() * std::sin(rotangle); - auto rotKKPy = KaonKshortPair.Px() * std::sin(rotangle) + KaonKshortPair.Py() * std::cos(rotangle); - KaonKshortPairRot.SetXYZM(rotKKPx, rotKKPy, KaonKshortPair.Pz(), KaonKshortPair.M()); - F1Rot = Pion + KaonKshortPairRot; - auto relative_momentum_rot = getkstar(F1Rot, Proton); - if (t1.f1SignalStat() > 0) { - histos.fill(HIST("h2MixEventInvariantMassRot_mass"), relative_momentum_rot, F1Rot.Pt(), F1Rot.M(), t2.protonCharge()); - if (fillSparse) { - histos.fill(HIST("MEMassRot"), F1Rot.M(), F1Rot.Pt(), Proton.Pt(), relative_momentum_rot, combinedTPC, t2.protonCharge()); - } - } - } - } } } } From df4d2b8b8d16068afca083f212f57fb34f07474f Mon Sep 17 00:00:00 2001 From: shreyasiacharya <34233706+shreyasiacharya@users.noreply.github.com> Date: Fri, 5 Sep 2025 14:43:44 +0200 Subject: [PATCH 323/986] [PWGDQ] Update to TH1 mass width in histogramLibrary (#12852) --- PWGDQ/Core/HistogramsLibrary.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGDQ/Core/HistogramsLibrary.cxx b/PWGDQ/Core/HistogramsLibrary.cxx index dd875822000..187f1205cb6 100644 --- a/PWGDQ/Core/HistogramsLibrary.cxx +++ b/PWGDQ/Core/HistogramsLibrary.cxx @@ -982,7 +982,7 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "Mass", "", false, 500, 0.0, 5.0, VarManager::kMass); hm->AddHistogram(histClass, "Mass_HighRange", "", false, 375, 0.0, 15.0, VarManager::kMass); hm->AddHistogram(histClass, "Pt", "", false, 2000, 0.0, 20., VarManager::kPt); - hm->AddHistogram(histClass, "Mass_Pt", "", false, 125, 0.0, 5.0, VarManager::kMass, 40, 0.0, 20.0, VarManager::kPt); + hm->AddHistogram(histClass, "Mass_Pt", "", false, 500, 0.0, 5.0, VarManager::kMass, 40, 0.0, 20.0, VarManager::kPt); double massBins[76]; for (int i = 0; i < 76; i++) { massBins[i] = 1.5 + i * 0.04; From 12c6fe8c4a913f709363281c3fcfa1b59b4624fc Mon Sep 17 00:00:00 2001 From: alcaliva <32872606+alcaliva@users.noreply.github.com> Date: Fri, 5 Sep 2025 15:50:56 +0200 Subject: [PATCH 324/986] [PWGLF] Added histograms to calculate jet reconstruction efficiency (#12877) --- PWGLF/Tasks/Nuspex/antinucleiInJets.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx index 13d063d2d82..e2b2459bc2b 100644 --- a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx +++ b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx @@ -252,6 +252,7 @@ struct AntinucleiInJets { // Event counter registryMC.add("genEvents", "number of generated events in mc", HistType::kTH1F, {{10, 0, 10, "counter"}}); + registryMC.add("genJets", "number of generated jets", HistType::kTH1F, {{10, 0, 10, "counter"}}); // Generated spectra of antiprotons registryMC.add("antiproton_gen_jet", "antiproton_gen_jet", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); @@ -267,6 +268,7 @@ struct AntinucleiInJets { // Event counter registryMC.add("recEvents", "number of reconstructed events in mc", HistType::kTH1F, {{20, 0, 20, "counter"}}); + registryMC.add("recJets", "number of reconstructed jets", HistType::kTH1F, {{10, 0, 10, "counter"}}); // Reconstructed spectra of antiprotons registryMC.add("antiproton_rec_tpc_jet", "antiproton_rec_tpc_jet", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); @@ -1454,6 +1456,9 @@ struct AntinucleiInJets { continue; isAtLeastOneJetSelected = true; + // Generated jets + registryMC.fill(HIST("genJets"), 0.5); + // Analyze jet constituents std::vector jetConstituents = jet.constituents(); for (const auto& particle : jetConstituents) { @@ -1622,6 +1627,9 @@ struct AntinucleiInJets { continue; isAtLeastOneJetSelected = true; + // Reconstructed jets + registryMC.fill(HIST("recJets"), 0.5); + // Set up two perpendicular cone axes for underlying event estimation double coneRadius = std::sqrt(jet.area() / PI); TVector3 jetAxis(jet.px(), jet.py(), jet.pz()); From 3b43850b304e83fda3c6a6c1f612211c558ad5dc Mon Sep 17 00:00:00 2001 From: AlexianL <123153896+AlexianL@users.noreply.github.com> Date: Fri, 5 Sep 2025 16:40:21 +0200 Subject: [PATCH 325/986] [PWGHF] taskFlow.cxx: Improve consumption, add all FV0 correlations cases (#12873) --- PWGHF/HFC/Tasks/taskFlow.cxx | 1554 +++++++++++++++++++++++----------- 1 file changed, 1044 insertions(+), 510 deletions(-) diff --git a/PWGHF/HFC/Tasks/taskFlow.cxx b/PWGHF/HFC/Tasks/taskFlow.cxx index b3813942454..3184b62e7c6 100644 --- a/PWGHF/HFC/Tasks/taskFlow.cxx +++ b/PWGHF/HFC/Tasks/taskFlow.cxx @@ -16,44 +16,46 @@ /// \author Maja Kabus , CERN #include "PWGCF/Core/CorrelationContainer.h" -#include "PWGHF/Core/DecayChannels.h" +#include "PWGCF/Core/PairCuts.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/Utils/utilsPid.h" +#include "PWGMM/Mult/DataModel/Index.h" #include "PWGMM/Mult/DataModel/bestCollisionTable.h" -#include "Common/Core/RecoDecay.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/CollisionAssociationTables.h" #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/McCollisionExtra.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/TrackSelectionTables.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CcdbApi.h" +#include "CommonConstants/MathConstants.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsCommonDataFormats/AlignParam.h" +#include "FV0Base/Geometry.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/Logger.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/GlobalTrackID.h" + +#include +#include +#include #include -#include -#include +#include -#include +#include +#include #include -#include #include using namespace o2; @@ -78,21 +80,60 @@ enum MftTrackAmbiguityStep { NMftAmbiguitySteps }; +enum ReassociationMftTracks { + NotReassociatedMftTracks = 0, + ReassociatedMftTracks, + NReassociationMftTracksSteps +}; + enum EventSelectionStep { AllEvents = 0, AfterEventSelection, NEventSelectionSteps }; +enum DataType { + Data, + Mc +}; + +// enum EventType { +// SameEvent, +// MixedEvent +// }; + +enum CorrelationCase { + TpcTpc, + TpcMft, + TpcFv0a, + MftFv0a, +}; + +enum CorrelatedParticles { + ChPartChPart, + D0ChPart, + LcChPart +}; + +static constexpr std::string_view WhatDataType[] = {"Data/", "MC/"}; +// static constexpr std::string_view whatEventType[] = {"SameEvent/", "MixedEvent/"}; +static constexpr std::string_view WhatCorrelationCase[] = {"TpcTpc/", "TpcMft/", "TpcFv0a/", "MftFv0a/"}; +static constexpr std::string_view WhatParticles[] = {"ChPartChPart/", "D0ChPart/", "LcChPart/"}; + // static constexpr float kPairCutDefaults[1][5] = {{-1, -1, -1, -1, -1}}; struct HfTaskFlow { + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "Address of the CCDB to browse"}; + Configurable noLaterThan{"noLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "Latest acceptable timestamp of creation for the object"}; + // configurables for processing options Configurable centralityBinsForMc{"centralityBinsForMc", false, "false = OFF, true = ON for data like multiplicity/centrality bins for MC steps"}; Configurable mftMaxDCAxy{"mftMaxDCAxy", 2.0f, "Cut on dcaXY for MFT tracks"}; + Configurable doHeavyFlavor{"doHeavyFlavor", false, "Flag to know we in the heavy flavor case or not"}; Configurable doReferenceFlow{"doReferenceFlow", false, "Flag to know if reference flow should be done"}; + Configurable isReadoutCenter{"isReadoutCenter", false, "Enable Readout Center"}; // Configurable doTwoTrackCut{"doTwoTrackCut", -1, "Two track cut: -1 = off; >0 otherwise distance value (suggested: 0.02)"}; Configurable processRun2{"processRun2", false, "Flag to run on Run 2 data"}; Configurable processRun3{"processRun3", true, "Flag to run on Run 3 data"}; @@ -122,7 +163,10 @@ struct HfTaskFlow { HfHelper hfHelper; SliceCache cache; Service pdg; - // Service ccdb; + Service ccdb; + std::vector* offsetFV0; + o2::ccdb::CcdbApi ccdbApi; + o2::fv0::Geometry* fv0Det; std::vector hfIndexCache; // ========================= @@ -181,6 +225,8 @@ struct HfTaskFlow { // Filter mftTrackEtaFilter = (aod::fwdtrack::eta < etaMftTrackMax) && // (aod::fwdtrack::eta > etaMftTrackMin); + // Filter mftTrackHasCollision = aod::fwdtrack::collisionId > 0; + // Filters below will be used for uncertainties // Filter mftTrackCollisionIdFilter = (aod::fwdtrack::bestCollisionId >= 0); // Filter mftTrackDcaFilter = (nabs(aod::fwdtrack::bestDCAXY) < mftMaxDCAxy); @@ -214,7 +260,10 @@ struct HfTaskFlow { // Preslice : DATA // ========================= - Preslice perCol = o2::aod::fwdtrack::collisionId; + Preslice perColMftTracks = o2::aod::fwdtrack::collisionId; + Preslice perColTracks = aod::track::collisionId; + Preslice perColD0s = aod::track::collisionId; + Preslice perColLcs = aod::track::collisionId; // ========================= // Preslice : MC @@ -233,8 +282,8 @@ struct HfTaskFlow { ConfigurableAxis binsMixingMultiplicity{"binsMixingMultiplicity", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 100.1}, "multiplicity bins for event mixing"}; ConfigurableAxis binsMixingVertex{"binsMixingVertex", {14, -7, 7}, "vertex bins for event mixing"}; ConfigurableAxis axisEtaEfficiency{"axisEtaEfficiency", {20, -1.0, 1.0}, "eta axis for efficiency histograms"}; - ConfigurableAxis axisEtaMft{"axisEtaMft", {48, -4, -2}, "eta axis for MFT histograms"}; - ConfigurableAxis axisEtaTpc{"axisEtaTpc", {48, -1, 1}, "eta axis for TPC histograms"}; + ConfigurableAxis axisEtaAssociated{"axisEtaAssociated", {48, -4, -2}, "eta axis for MFT histograms"}; + ConfigurableAxis axisEtaTrigger{"axisEtaTrigger", {48, -1, 1}, "eta axis for TPC histograms"}; ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -PIHalf, PIHalf * 3}, "delta phi axis for histograms"}; ConfigurableAxis axisDeltaEta{"axisDeltaEta", {48, -2.4, 2.4}, "delta eta axis for histograms"}; ConfigurableAxis axisMultiplicity{"axisMultiplicity", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 100.1}, "multiplicity axis for histograms"}; @@ -258,16 +307,38 @@ struct HfTaskFlow { OutputObj sameEventHfMc{"sameEventHfMc"}; OutputObj mixedEventHfMc{"mixedEventHfMc"}; + template + void addHistograms() + { + registry.add(Form("%s%s%shEtaTrigger", WhatDataType[dataType].data(), WhatCorrelationCase[correlationCase].data(), WhatParticles[correlatedParticles].data()), "", {HistType::kTH1D, {axisEtaTrigger}}); + registry.add(Form("%s%s%shPhiTrigger", WhatDataType[dataType].data(), WhatCorrelationCase[correlationCase].data(), WhatParticles[correlatedParticles].data()), "", {HistType::kTH1D, {axisPhi}}); + registry.add(Form("%s%s%shPtTrigger", WhatDataType[dataType].data(), WhatCorrelationCase[correlationCase].data(), WhatParticles[correlatedParticles].data()), "", {HistType::kTH1D, {axisPt}}); + registry.add(Form("%s%s%shYieldsTrigger", WhatDataType[dataType].data(), WhatCorrelationCase[correlationCase].data(), WhatParticles[correlatedParticles].data()), "", {HistType::kTH3F, {axisMultiplicity, axisPt, axisEtaTrigger}}); + registry.add(Form("%s%s%shEtaPhiTrigger", WhatDataType[dataType].data(), WhatCorrelationCase[correlationCase].data(), WhatParticles[correlatedParticles].data()), "", {HistType::kTH3F, {axisMultiplicity, axisEtaTrigger, axisPhi}}); + registry.add(Form("%s%s%shEtaAssociated", WhatDataType[dataType].data(), WhatCorrelationCase[correlationCase].data(), WhatParticles[correlatedParticles].data()), "", {HistType::kTH1D, {axisEtaAssociated}}); + registry.add(Form("%s%s%shPhiAssociated", WhatDataType[dataType].data(), WhatCorrelationCase[correlationCase].data(), WhatParticles[correlatedParticles].data()), "", {HistType::kTH1D, {axisPhi}}); + registry.add(Form("%s%s%shEtaPhiAssociated", WhatDataType[dataType].data(), WhatCorrelationCase[correlationCase].data(), WhatParticles[correlatedParticles].data()), "", {HistType::kTH3F, {axisMultiplicity, axisEtaAssociated, axisPhi}}); + registry.add(Form("%s%s%shMultiplicity", WhatDataType[dataType].data(), WhatCorrelationCase[correlationCase].data(), WhatParticles[correlatedParticles].data()), "", {HistType::kTH1D, {axisMultiplicity}}); + } + // ========================= // init() // ========================= void init(InitContext&) { - const int nBinsMix = axisMultiplicity->size() * axisVertex->size(); + // const int nBinsMix = axisMultiplicity->size() * axisVertex->size(); + ccdb->setURL(ccdbUrl); + ccdbApi.init("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + LOGF(info, "Getting alignment offsets from the CCDB..."); + offsetFV0 = ccdb->getForTimeStamp>("FV0/Calib/Align", noLaterThan.value); + LOGF(info, "Offset for FV0-left: x = %.3f y = %.3f z = %.3f\n", (*offsetFV0)[0].getX(), (*offsetFV0)[0].getY(), (*offsetFV0)[0].getZ()); + LOGF(info, "Offset for FV0-right: x = %.3f y = %.3f z = %.3f\n", (*offsetFV0)[1].getX(), (*offsetFV0)[1].getY(), (*offsetFV0)[1].getZ()); // ========================= // Event histograms - // TO-DO : do i have to separate event histograms between DATA and MC ? // ========================= registry.add("Data/hEventCounter", "hEventCounter", {HistType::kTH1D, {{EventSelectionStep::NEventSelectionSteps, -0.5, +EventSelectionStep::NEventSelectionSteps - 0.5}}}); @@ -288,7 +359,7 @@ struct HfTaskFlow { labelsAmbiguityOfMftTracks[MftTrackAmbiguityStep::NumberOfNonAmbiguousTracks] = "how much tracks are non-ambiguous"; registry.get(HIST("Data/TpcMft/hAmbiguityOfMftTracks"))->SetMinimum(0); - for (int iBin = 0; iBin < NMftAmbiguitySteps; iBin++) { + for (int iBin = 0; iBin < MftTrackAmbiguityStep::NMftAmbiguitySteps; iBin++) { registry.get(HIST("Data/TpcMft/hAmbiguityOfMftTracks"))->GetXaxis()->SetBinLabel(iBin + 1, labelsAmbiguityOfMftTracks[iBin].data()); } @@ -303,283 +374,218 @@ struct HfTaskFlow { registry.get(HIST("Data/TpcMft/hMftTracksSelection"))->GetXaxis()->SetBinLabel(iBin + 1, labelsMftTracksSelection[iBin].data()); } - // ========================= - // DATA : histograms for TPC-TPC h-h case - // ========================= - - // DATA : event histograms for TPC-TPC h-h same event - registry.add("Data/TpcTpc/HadronHadron/SameEvent/hMultiplicity", "hMultiplicity", {HistType::kTH1F, {axisMultiplicity}}); - registry.add("Data/TpcTpc/HadronHadron/SameEvent/hVtxZ", "hVtxZ", {HistType::kTH1F, {axisVertex}}); - registry.add("Data/TpcTpc/HadronHadron/SameEvent/hEventCountSame", "bin", {HistType::kTH1D, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); - - // DATA : associated particles histograms for TPC-TPC h-h same event - registry.add("Data/TpcTpc/HadronHadron/SameEvent/hPt", "pT", {HistType::kTH1F, {axisPt}}); - registry.add("Data/TpcTpc/HadronHadron/SameEvent/hEta", "eta", {HistType::kTH1D, {axisEtaTpc}}); - registry.add("Data/TpcTpc/HadronHadron/SameEvent/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); - registry.add("Data/TpcTpc/HadronHadron/SameEvent/hYields", "multiplicity vs pT vs eta", {HistType::kTH3F, {axisMultiplicity, axisPt, axisEtaTpc}}); - registry.add("Data/TpcTpc/HadronHadron/SameEvent/hEtaPhi", "multiplicity vs eta vs phi", {HistType::kTH3F, {axisMultiplicity, axisEtaTpc, axisPhi}}); + registry.add("Data/TpcMft/hReassociationMftTracks", "hReassociationMftTracks", {HistType::kTH1D, {{ReassociationMftTracks::NReassociationMftTracksSteps, -0.5, +ReassociationMftTracks::NReassociationMftTracksSteps - 0.5}}}); + std::string labelsReassociationMftTracks[ReassociationMftTracks::NReassociationMftTracksSteps]; + labelsReassociationMftTracks[ReassociationMftTracks::NotReassociatedMftTracks] = "MFT tracks after track selection"; + labelsReassociationMftTracks[ReassociationMftTracks::ReassociatedMftTracks] = "Reassociated MFT tracks by DCAxy method"; + registry.get(HIST("Data/TpcMft/hReassociationMftTracks"))->SetMinimum(0); - // Katarina had this : - registry.add("Data/TpcTpc/HadronHadron/SameEvent/hVzEta", "eta vs. Vz", {HistType::kTH2F, {axisEtaTpc, axisVertex}}); + for (int iBin = 0; iBin < ReassociationMftTracks::NReassociationMftTracksSteps; iBin++) { + registry.get(HIST("Data/TpcMft/hReassociationMftTracks"))->GetXaxis()->SetBinLabel(iBin + 1, labelsReassociationMftTracks[iBin].data()); + } - // DATA : event mixing histograms for TPC-TPC h-h mixed event - registry.add("Data/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing", "bin", {HistType::kTH1D, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + registry.add("Data/TpcMft/hNTracks", "", {HistType::kTH1F, {axisMultiplicity}}); + registry.add("Data/TpcMft/hNMftTracks", "", {HistType::kTH1F, {axisMultiplicity}}); + registry.add("Data/TpcMft/hNBestCollisionFwd", "", {HistType::kTH1F, {axisMultiplicity}}); // ========================= - // DATA : histograms for TPC-TPC HF-h case for 2PRONG + // Declaration of correlation containers and their respective axis // ========================= - // DATA : event histograms for TPC-TPC HF-h same event - registry.add("Data/TpcTpc/HfHadron/SameEvent/hPt", "pT", {HistType::kTH1F, {axisPt}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/hEta", "eta", {HistType::kTH1D, {axisEtaTpc}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/hYields", "multiplicity vs pT vs eta", {HistType::kTH3F, {axisMultiplicity, axisPt, axisEtaTpc}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/hEtaPhi", "multiplicity vs eta vs phi", {HistType::kTH3F, {axisMultiplicity, axisEtaTpc, axisPhi}}); - - registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hEventCountSame", "bin", {HistType::kTH1D, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hEta", "eta", {HistType::kTH1D, {axisEtaTpc}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMultiplicity", "multiplicity;multiplicity;entries", {HistType::kTH1F, {axisMultiplicity}}); - registry.add("Data/TpcTpc/HfHadron/MixedEvent/hEventCountHFMixing", "bin", {HistType::kTH1D, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); - - // DATA : trigger particles (candidates) histograms for TPC-TPC D0-h same event - registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hPtCandidate", "2-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hPtProng0", "2-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hPtProng1", "2-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMassVsPt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisMass, axisPt}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMassVsPtVsMult", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2}); p_{T}; multiplicity", {HistType::kTH3F, {axisMass, axisPt, axisMultiplicity}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMass", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {axisMass}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hEtaCandVsPt", "2-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {axisEtaTpc, axisPt}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hSelectionStatus", "2-prong candidates;selection status;entries", {HistType::kTH2F, {{5, -0.5, 4.5}, axisPt}}); + std::vector corrAxis = {{axisDeltaEta, "#Delta#eta"}, + {axisPtAssoc, "p_{T} (GeV/c)"}, + {axisPtTrigger, "p_{T} (GeV/c)"}, + {axisMultiplicity, "multiplicity"}, + {axisDeltaPhi, "#Delta#varphi (rad)"}, + {axisVertex, "z-vtx (cm)"}}; + std::vector effAxis = {{axisEtaEfficiency, "#eta"}, + {axisPtEfficiency, "p_{T} (GeV/c)"}, + {axisVertexEfficiency, "z-vtx (cm)"}}; + std::vector userAxis = {{axisMass, "m_{inv} (GeV/c^{2})"}}; - // ========================= - // DATA : histograms for TPC-TPC HF-h case for 3PRONG - // =================== - - registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hEventCountSame", "bin", {HistType::kTH1D, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMassVsPt", "3-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisMass, axisPt}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMass", "3-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {axisMass}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMassVsPtVsMult", "3-prong candidates;inv. mass (p K #pi) (GeV/#it{c}^{2}); p_{T}; multiplicity", {HistType::kTH3F, {axisMass, axisPt, axisMultiplicity}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMultiplicity", "multiplicity;multiplicity;entries", {HistType::kTH1F, {axisMultiplicity}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPt", "3-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPtProng0", "3-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPtProng1", "3-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPtProng2", "3-prong candidates;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hEta", "3-prong candidates;#it{#eta};entries", {HistType::kTH1D, {axisEtaTpc}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPhi", "3-prong candidates;#it{#Phi};entries", {HistType::kTH1D, {axisPhi}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hEtaVsPt", "3-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {axisEtaTpc, axisPt}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPhiVsPt", "3-prong candidates;candidate #it{#Phi};entries", {HistType::kTH2F, {axisPhi, axisPt}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hSelectionStatus", "3-prong candidates;selection status;entries", {HistType::kTH2F, {{5, -0.5, 4.5}, axisPt}}); + fv0Det = o2::fv0::Geometry::instance(o2::fv0::Geometry::eUninitialized); // ========================= - // DATA : histograms for TPC-MFT h-h case + // Initialization of histograms and CorrelationContainers for TpcTpc cases // ========================= - // DATA : trigger particles (TPC tracks) histograms for TPC-MFT h-h same event - registry.add("Data/TpcMft/HadronHadron/SameEvent/hEventCountSame", "bin", {HistType::kTH1D, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); - registry.add("Data/TpcMft/HadronHadron/SameEvent/hEtaPhiTPC", "multiplicity vs eta vs phi in TPC", {HistType::kTH3F, {axisMultiplicity, axisEtaTpc, axisPhi}}); - registry.add("Data/TpcMft/HadronHadron/SameEvent/hEtaTPC", "etaTPC", {HistType::kTH1D, {axisEtaTpc}}); - registry.add("Data/TpcMft/HadronHadron/SameEvent/hPhiTPC", "phiTPC", {HistType::kTH1D, {axisPhi}}); - registry.add("Data/TpcMft/HadronHadron/SameEvent/hPtTPC", "pT", {HistType::kTH1F, {axisPt}}); - registry.add("Data/TpcMft/HadronHadron/SameEvent/hYieldsTPC", "multiplicity vs pT vs eta", {HistType::kTH3F, {axisMultiplicity, axisPt, axisEtaTpc}}); - registry.add("Data/TpcMft/HadronHadron/SameEvent/hMultiplicityTPC", "multiplicity;multiplicity;entries", {HistType::kTH1F, {axisMultiplicity}}); - - // DATA : associated particles (MFT tracks) histograms for TPC-MFT h-h same event - registry.add("Data/TpcMft/HadronHadron/SameEvent/hEtaPhiMFT", "multiplicity vs eta vs phi in MFT", {HistType::kTH3F, {axisMultiplicity, axisEtaMft, axisPhi}}); - registry.add("Data/TpcMft/HadronHadron/SameEvent/hEtaMFT", "etaMFT", {HistType::kTH1D, {axisEtaMft}}); - registry.add("Data/TpcMft/HadronHadron/SameEvent/hPhiMFT", "phiMFT", {HistType::kTH1D, {axisPhi}}); - registry.add("Data/TpcMft/HadronHadron/SameEvent/hPtMFT", "pT", {HistType::kTH1F, {axisPt}}); - registry.add("Data/TpcMft/HadronHadron/SameEvent/hYieldsMFT", "multiplicity vs pT vs eta", {HistType::kTH3F, {axisMultiplicity, axisPt, axisEtaMft}}); - - // DATA : histograms for TPC-MFT h-h event mixing for events QA - registry.add("Data/TpcMft/HadronHadron/MixedEvent/hEventCountMixing", "bin", {HistType::kTH1D, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + if (doprocessSameTpcTpcChCh) { + addHistograms(); + sameEvent.setObject(new CorrelationContainer("sameEvent", "sameEvent", corrAxis, effAxis, {})); + mixedEvent.setObject(new CorrelationContainer("mixedEvent", "mixedEvent", corrAxis, effAxis, {})); + } - // ========================= - // DATA : histograms for TPC-MFT HF-h case FOR 2PRONG - // ========================= + if (doprocessSameTpcTpcD0Ch) { + addHistograms(); + sameEventHf.setObject(new CorrelationContainer("sameEventHf", "sameEventHf", corrAxis, effAxis, userAxis)); + mixedEventHf.setObject(new CorrelationContainer("mixedEventHf", "mixedEventHf", corrAxis, effAxis, userAxis)); + } - // DATA : trigger particles (candidates) histograms for TPC-MFT HF-h same event - registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hEventCountSame", "bin", {HistType::kTH1D, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hEtaPhiCandidate", "multiplicity vs eta vs phi in TPC", {HistType::kTH3F, {axisMultiplicity, axisEtaMft, axisPhi}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hEtaCandidate", "etaTPC", {HistType::kTH1D, {axisEtaTpc}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hPhiCandidate", "phiTPC", {HistType::kTH1D, {axisPhi}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hYieldsCandidate", "multiplicity vs pT vs eta", {HistType::kTH3F, {axisMultiplicity, axisPt, axisEtaTpc}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hMultiplicityCandidate", "multiplicity;multiplicity;entries", {HistType::kTH1F, {axisMultiplicity}}); - - // DATA : trigger particles (candidates) histograms for TPC-MFT HF-h same event - registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hPtCandidate", "2-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hPtProng0", "2-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hPtProng1", "2-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hMassVsPt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisMass, axisPt}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hMass", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {axisMass}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hMassVsPtVsMult", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2}); p_{T}; multiplicity", {HistType::kTH3F, {axisMass, axisPt, axisMultiplicity}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hEtaCandVsPt", "2-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {axisEtaTpc, axisPt}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hSelectionStatus", "2-prong candidates;selection status;entries", {HistType::kTH2F, {{5, -0.5, 4.5}, axisPt}}); - - // DATA : associated particles (MFT tracks) histograms for TPC-MFT h-h same event - registry.add("Data/TpcMft/HfHadron/SameEvent/hEtaPhiMFT", "multiplicity vs eta vs phi in MFT", {HistType::kTH3F, {axisMultiplicity, axisEtaMft, axisPhi}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hEtaMFT", "etaMFT", {HistType::kTH1D, {axisEtaMft}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hPhiMFT", "phiMFT", {HistType::kTH1D, {axisPhi}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hPtMFT", "pT", {HistType::kTH1F, {axisPt}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hYieldsMFT", "multiplicity vs pT vs eta", {HistType::kTH3F, {axisMultiplicity, axisPt, axisEtaMft}}); - - // DATA : histograms for TPC-MFT h-h event mixing for events QA - registry.add("Data/TpcMft/HfHadron/MixedEvent/hEventCountMixing", "bin", {HistType::kTH1D, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + if (doprocessSameTpcTpcLcCh) { + addHistograms(); + sameEventHf.setObject(new CorrelationContainer("sameEventHf", "sameEventHf", corrAxis, effAxis, userAxis)); + mixedEventHf.setObject(new CorrelationContainer("mixedEventHf", "mixedEventHf", corrAxis, effAxis, userAxis)); + } // ========================= - // DATA : histograms for TPC-MFT HF-h case FOR 3PRONG + // Initialization of histograms and CorrelationContainers for TpcMft cases // ========================= - registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hEventCountSame", "bin", {HistType::kTH1D, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hYieldsCandidate", "multiplicity vs pT vs eta", {HistType::kTH3F, {axisMultiplicity, axisPt, axisEtaTpc}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hMultiplicityCandidate", "multiplicity;multiplicity;entries", {HistType::kTH1F, {axisMultiplicity}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hEtaPhiCandidate", "multiplicity vs eta vs phi in TPC", {HistType::kTH3F, {axisMultiplicity, axisEtaTpc, axisPhi}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hMassVsPt", "3-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisMass, axisPt}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hMass", "3-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {axisMass}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hMassVsPtVsMult", "3-prong candidates;inv. mass (p K #pi) (GeV/#it{c}^{2}); p_{T}; multiplicity", {HistType::kTH3F, {axisMass, axisPt, axisMultiplicity}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hPt", "3-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hPtProng0", "3-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hPtProng1", "3-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hPtProng2", "3-prong candidates;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hEta", "3-prong candidates;#it{#eta};entries", {HistType::kTH1D, {axisEtaTpc}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hPhi", "3-prong candidates;#it{#Phi};entries", {HistType::kTH1D, {axisPhi}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hEtaVsPt", "3-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {axisEtaTpc, axisPt}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hPhiVsPt", "3-prong candidates;candidate #it{#Phi};entries", {HistType::kTH2F, {axisPhi, axisPt}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hSelectionStatus", "3-prong candidates;selection status;entries", {HistType::kTH2F, {{5, -0.5, 4.5}, axisPt}}); + if (doprocessSameTpcMftChCh || doprocessSameTpcMftChChReassociated || doprocessSameTpcMftChChNonAmbiguous) { + addHistograms(); + + // All MFT tracks + registry.add("Data/TpcMft/kCFStepAll/hEta", "eta", {HistType::kTH1D, {axisEtaAssociated}}); + registry.add("Data/TpcMft/kCFStepAll/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); + + // Only non-ambiguous MFT tracks + registry.add("Data/TpcMft/kCFStepTracked/hEta", "eta", {HistType::kTH1D, {axisEtaAssociated}}); + registry.add("Data/TpcMft/kCFStepTracked/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); + + sameEvent.setObject(new CorrelationContainer("sameEvent", "sameEvent", corrAxis, effAxis, {})); + mixedEvent.setObject(new CorrelationContainer("mixedEvent", "mixedEvent", corrAxis, effAxis, {})); + } + + if (doprocessSameTpcMftD0Ch || doprocessSameTpcMftD0ChReassociated) { + addHistograms(); + + // All MFT tracks + registry.add("Data/TpcMft/kCFStepAll/hEta", "eta", {HistType::kTH1D, {axisEtaAssociated}}); + registry.add("Data/TpcMft/kCFStepAll/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); + + // Only non-ambiguous MFT tracks + registry.add("Data/TpcMft/kCFStepTracked/hEta", "eta", {HistType::kTH1D, {axisEtaAssociated}}); + registry.add("Data/TpcMft/kCFStepTracked/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); + + sameEventHf.setObject(new CorrelationContainer("sameEventHf", "sameEventHf", corrAxis, effAxis, userAxis)); + mixedEventHf.setObject(new CorrelationContainer("mixedEventHf", "mixedEventHf", corrAxis, effAxis, userAxis)); + } + + if (doprocessSameTpcMftLcCh || doprocessSameTpcMftLcChReassociated) { + addHistograms(); + + // All MFT tracks + registry.add("Data/TpcMft/kCFStepAll/hEta", "eta", {HistType::kTH1D, {axisEtaAssociated}}); + registry.add("Data/TpcMft/kCFStepAll/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); + + // Only non-ambiguous MFT tracks + registry.add("Data/TpcMft/kCFStepTracked/hEta", "eta", {HistType::kTH1D, {axisEtaAssociated}}); + registry.add("Data/TpcMft/kCFStepTracked/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); + + sameEventHf.setObject(new CorrelationContainer("sameEventHf", "sameEventHf", corrAxis, effAxis, userAxis)); + mixedEventHf.setObject(new CorrelationContainer("mixedEventHf", "mixedEventHf", corrAxis, effAxis, userAxis)); + } // ========================= - // DATA : histograms for MFT reassociated distributions (to plot all MFT tracks, and only non-ambiguous MFT trakcs) - // ressociated tracks distribution can be found in the normal eta and phi distributions of each individual cases + // Initialization of histograms and CorrelationContainers for TpcFv0a cases // ========================= - // All MFT tracks - registry.add("Data/TpcMft/kCFStepAll/hEta", "eta", {HistType::kTH1D, {axisEtaMft}}); - registry.add("Data/TpcMft/kCFStepAll/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); + if (doprocessSameTpcFv0aChCh || doprocessSameTpcFv0aChCh) { + addHistograms(); + + sameEvent.setObject(new CorrelationContainer("sameEvent", "sameEvent", corrAxis, effAxis, {})); + mixedEvent.setObject(new CorrelationContainer("mixedEvent", "mixedEvent", corrAxis, effAxis, {})); + } + + if (doprocessSameTpcFv0aD0Ch) { + addHistograms(); + + sameEventHf.setObject(new CorrelationContainer("sameEventHf", "sameEventHf", corrAxis, effAxis, userAxis)); + mixedEventHf.setObject(new CorrelationContainer("mixedEventHf", "mixedEventHf", corrAxis, effAxis, userAxis)); + } + + if (doprocessSameTpcFv0aLcCh) { + addHistograms(); - // Only non-ambiguous MFT tracks - registry.add("Data/TpcMft/kCFStepTracked/hEta", "eta", {HistType::kTH1D, {axisEtaMft}}); - registry.add("Data/TpcMft/kCFStepTracked/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); + sameEventHf.setObject(new CorrelationContainer("sameEventHf", "sameEventHf", corrAxis, effAxis, userAxis)); + mixedEventHf.setObject(new CorrelationContainer("mixedEventHf", "mixedEventHf", corrAxis, effAxis, userAxis)); + } // ========================= - // MC : histograms for TPC-TPC h-h case + // Initialization of histograms and CorrelationContainers for MftFv0a cases // ========================= - // MC reconstructed - - registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hMultiplicity", "hMultiplicity", {HistType::kTH1F, {axisMultiplicity}}); - registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hVtxZ", "hVtxZ", {HistType::kTH1F, {axisVertex}}); - registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hEventCountSame", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); - // Katarina had this : - registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hMultiplicityPrimary", "hMultiplicityPrimary", {HistType::kTH1F, {axisMultiplicity}}); - // histograms for MC associated particles - registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hPt", "pT", {HistType::kTH1F, {axisPt}}); - registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hEta", "eta", {HistType::kTH1F, {axisEtaTpc}}); - registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hPhi", "phi", {HistType::kTH1F, {axisPhi}}); - registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hYields", "multiplicity vs pT vs eta", {HistType::kTH3F, {axisMultiplicity, axisPt, axisEtaTpc}}); - registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hEtaPhi", "multiplicity vs eta vs phi", {HistType::kTH3F, {axisMultiplicity, axisEtaTpc, axisPhi}}); - registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hNtracks", "hNtracks", {HistType::kTH1F, {axisMultiplicity}}); - // histograms for MC particles in event mixing - registry.add("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); - registry.add("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hMultiplicityMixing", "hMultiplicityMixing", {HistType::kTH1F, {axisMultiplicity}}); - registry.add("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hVtxZMixing", "hVtxZMixing", {HistType::kTH1F, {axisVertex}}); - registry.add("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hPtMixing", "pT", {HistType::kTH1F, {axisPt}}); - registry.add("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hEtaMixing", "eta", {HistType::kTH1F, {axisEtaTpc}}); - registry.add("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hPhiMixing", "phi", {HistType::kTH1F, {axisPhi}}); - registry.add("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hNtracksMixing", "hNtracksMixing", {HistType::kTH1F, {axisMultiplicity}}); - - // MC Truth - - registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hMultiplicity", "hMultiplicity", {HistType::kTH1F, {axisMultiplicity}}); - registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hVtxZ", "hVtxZ", {HistType::kTH1F, {axisVertex}}); - registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hEventCountSame", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); - // Katarina had this : - registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hMultiplicityPrimary", "hMultiplicityPrimary", {HistType::kTH1F, {axisMultiplicity}}); - // histograms for MC associated particles - registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hPt", "pT", {HistType::kTH1F, {axisPt}}); - registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hEta", "eta", {HistType::kTH1F, {axisEtaTpc}}); - registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hPhi", "phi", {HistType::kTH1F, {axisPhi}}); - registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hYields", "multiplicity vs pT vs eta", {HistType::kTH3F, {axisMultiplicity, axisPt, axisEtaTpc}}); - registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hEtaPhi", "multiplicity vs eta vs phi", {HistType::kTH3F, {axisMultiplicity, axisEtaTpc, axisPhi}}); - registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hNtracks", "hNtracks", {HistType::kTH1F, {axisMultiplicity}}); - // histograms for MC particles in event mixing - registry.add("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); - registry.add("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hMultiplicityMixing", "hMultiplicityMixing", {HistType::kTH1F, {axisMultiplicity}}); - registry.add("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hVtxZMixing", "hVtxZMixing", {HistType::kTH1F, {axisVertex}}); - registry.add("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hPtMixing", "pT", {HistType::kTH1F, {axisPt}}); - registry.add("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hEtaMixing", "eta", {HistType::kTH1F, {axisEtaTpc}}); - registry.add("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hPhiMixing", "phi", {HistType::kTH1F, {axisPhi}}); - registry.add("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hNtracksMixing", "hNtracksMixing", {HistType::kTH1F, {axisMultiplicity}}); + if (doprocessSameMftFv0aChCh || doprocessSameMftFv0aChChReassociated || doprocessSameMftFv0aChChNonAmbiguous) { + addHistograms(); + + sameEvent.setObject(new CorrelationContainer("sameEvent", "sameEvent", corrAxis, effAxis, {})); + mixedEvent.setObject(new CorrelationContainer("mixedEvent", "mixedEvent", corrAxis, effAxis, {})); + } // ========================= - // Declaration of correlation containers and their respective axis + // Initialization of histograms and CorrelationContainers for TpcMft MONTE-CARLO cases // ========================= - std::vector corrAxis = {{axisDeltaEta, "#Delta#eta"}, - {axisPtAssoc, "p_{T} (GeV/c)"}, - {axisPtTrigger, "p_{T} (GeV/c)"}, - {axisMultiplicity, "multiplicity"}, - {axisDeltaPhi, "#Delta#varphi (rad)"}, - {axisVertex, "z-vtx (cm)"}}; - std::vector effAxis = {{axisEtaEfficiency, "#eta"}, - {axisPtEfficiency, "p_{T} (GeV/c)"}, - {axisVertexEfficiency, "z-vtx (cm)"}}; - std::vector userAxis = {{axisMass, "m_{inv} (GeV/c^{2})"}}; + if (doprocessSameTpcMftD0ChMcGen) { + addHistograms(); + sameEventHfMc.setObject(new CorrelationContainer("sameEventHfMc", "sameEventHfMc", corrAxis, effAxis, userAxis)); + mixedEventHfMc.setObject(new CorrelationContainer("mixedEventHfMc", "mixedEventHfMc", corrAxis, effAxis, userAxis)); + } - // initialization of correlation containers for data - sameEvent.setObject(new CorrelationContainer("sameEvent", "sameEvent", corrAxis, effAxis, {})); - mixedEvent.setObject(new CorrelationContainer("mixedEvent", "mixedEvent", corrAxis, effAxis, {})); - sameEventHf.setObject(new CorrelationContainer("sameEventHf", "sameEventHf", corrAxis, effAxis, userAxis)); - mixedEventHf.setObject(new CorrelationContainer("mixedEventHf", "mixedEventHf", corrAxis, effAxis, userAxis)); + if (doprocessSameTpcMftLcChMcGen) { + addHistograms(); + sameEventHfMc.setObject(new CorrelationContainer("sameEventHfMc", "sameEventHfMc", corrAxis, effAxis, userAxis)); + mixedEventHfMc.setObject(new CorrelationContainer("mixedEventHfMc", "mixedEventHfMc", corrAxis, effAxis, userAxis)); + } - // initialization of correlation containes for monte-carlo - sameEventHfMc.setObject(new CorrelationContainer("sameEventHfMc", "sameEventHfMc", corrAxis, effAxis, userAxis)); - mixedEventHfMc.setObject(new CorrelationContainer("mixedEventHfMc", "mixedEventHfMc", corrAxis, effAxis, userAxis)); } // End of init() function // ========================= - // Quality Assesment plots for Same Event + // Quality Assessment plots for TpcTpc cases // ========================= // ---- DATA : TPC-TPC h-h Same Event QA ---- template void fillTpcTpcChChSameEventQa(float multiplicity, TTrack const& track) { - registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hPt"), track.pt()); - registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hEta"), track.eta()); - registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hPhi"), track.phi()); - registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hYields"), multiplicity, track.pt(), track.eta()); - registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hEtaPhi"), multiplicity, track.eta(), track.phi()); + registry.fill(HIST("Data/TpcTpc/ChPartChPart/hPtTrigger"), track.pt()); + registry.fill(HIST("Data/TpcTpc/ChPartChPart/hEtaTrigger"), track.eta()); + registry.fill(HIST("Data/TpcTpc/ChPartChPart/hPhiTrigger"), track.phi()); + registry.fill(HIST("Data/TpcTpc/ChPartChPart/hYieldsTrigger"), multiplicity, track.pt(), track.eta()); + registry.fill(HIST("Data/TpcTpc/ChPartChPart/hEtaPhiTrigger"), multiplicity, track.eta(), track.phi()); + registry.fill(HIST("Data/TpcTpc/ChPartChPart/hMultiplicity"), multiplicity); } + // ---- DATA : TPC-MFT HF-h Same Event candidates QA ---- template - void fillTpcTpcHfChSameEventQa(float multiplicity, TTrack const& track) + void fillTpcTpcHfChSameEventCandidateQa(float multiplicity, TTrack const& track, bool isD0) { - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hPt"), track.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hEta"), track.eta()); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hPhi"), track.phi()); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hYields"), multiplicity, track.pt(), track.eta()); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hEtaPhi"), multiplicity, track.eta(), track.phi()); + if (isD0) { + registry.fill(HIST("Data/TpcTpc/D0ChPart/hPtTrigger"), track.pt()); + registry.fill(HIST("Data/TpcTpc/D0ChPart/hEtaTrigger"), track.eta()); + registry.fill(HIST("Data/TpcTpc/D0ChPart/hPhiTrigger"), track.phi()); + registry.fill(HIST("Data/TpcTpc/D0ChPart/hYieldsTrigger"), multiplicity, track.pt(), track.eta()); + registry.fill(HIST("Data/TpcTpc/D0ChPart/hEtaPhiTrigger"), multiplicity, track.eta(), track.phi()); + registry.fill(HIST("Data/TpcTpc/D0ChPart/hMultiplicity"), multiplicity); + } else { + registry.fill(HIST("Data/TpcTpc/LcChPart/hPtTrigger"), track.pt()); + registry.fill(HIST("Data/TpcTpc/LcChPart/hEtaTrigger"), track.eta()); + registry.fill(HIST("Data/TpcTpc/LcChPart/hPhiTrigger"), track.phi()); + registry.fill(HIST("Data/TpcTpc/LcChPart/hYieldsTrigger"), multiplicity, track.pt(), track.eta()); + registry.fill(HIST("Data/TpcTpc/LcChPart/hEtaPhiTrigger"), multiplicity, track.eta(), track.phi()); + registry.fill(HIST("Data/TpcTpc/LcChPart/hMultiplicity"), multiplicity); + } } - // ---- MC REC : TPC-TPC h-h Same Event QA ---- + // ---- DATA : TPC-TPC HF-h Same Event associated tracks QA ---- template - void fillTpcTpcChChSameEventQaMc(float multiplicity, TTrack const& track) + void fillTpcTpcHfChSameEventAssociatedQa(float multiplicity, TTrack const& track, bool isD0) { - if constexpr (std::is_same_v) { // if MC Rec - registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hPt"), track.pt()); - registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hEta"), track.eta()); - registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hPhi"), track.phi()); - registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hYields"), multiplicity, track.pt(), track.eta()); - registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hEtaPhi"), multiplicity, track.eta(), track.phi()); - } else { // if MC Gen - registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hPt"), track.pt()); - registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hEta"), track.eta()); - registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hPhi"), track.phi()); - registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hYields"), multiplicity, track.pt(), track.eta()); - registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hEtaPhi"), multiplicity, track.eta(), track.phi()); + if (isD0) { + registry.fill(HIST("Data/TpcTpc/D0ChPart/hEtaAssociated"), track.eta()); + registry.fill(HIST("Data/TpcTpc/D0ChPart/hPhiAssociated"), track.phi()); + registry.fill(HIST("Data/TpcTpc/D0ChPart/hEtaPhiAssociated"), multiplicity, track.eta(), track.phi()); + } else { + registry.fill(HIST("Data/TpcTpc/LcChPart/hEtaAssociated"), track.eta()); + registry.fill(HIST("Data/TpcTpc/LcChPart/hPhiAssociated"), track.phi()); + registry.fill(HIST("Data/TpcTpc/LcChPart/hEtaPhiAssociated"), multiplicity, track.eta(), track.phi()); } } + // ========================= + // Quality Assessment plots for TpcMft cases + // ========================= + // ---- DATA : TPC-MFT h-h Same Event QA ---- template void fillTpcMftChChSameEventQa(float multiplicity, TTrack const& track, bool isTPC) @@ -588,177 +594,139 @@ struct HfTaskFlow { o2::math_utils::bringTo02Pi(phi); if (isTPC) { // trigger hadron from TPC - registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hEtaTPC"), track.eta()); - registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hPhiTPC"), phi); - registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hEtaPhiTPC"), multiplicity, track.eta(), phi); - registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hPtTPC"), track.pt()); - registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hYieldsTPC"), multiplicity, track.pt(), track.eta()); - registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hMultiplicityTPC"), multiplicity); - // add multiplicity plot? + registry.fill(HIST("Data/TpcMft/ChPartChPart/hEtaTrigger"), track.eta()); + registry.fill(HIST("Data/TpcMft/ChPartChPart/hPhiTrigger"), phi); + registry.fill(HIST("Data/TpcMft/ChPartChPart/hEtaPhiTrigger"), multiplicity, track.eta(), phi); + registry.fill(HIST("Data/TpcMft/ChPartChPart/hPtTrigger"), track.pt()); + registry.fill(HIST("Data/TpcMft/ChPartChPart/hYieldsTrigger"), multiplicity, track.pt(), track.eta()); + registry.fill(HIST("Data/TpcMft/ChPartChPart/hMultiplicity"), multiplicity); } else { // associated hadron from MFT - registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hEtaMFT"), track.eta()); - registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hPhiMFT"), phi); - registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hEtaPhiMFT"), multiplicity, track.eta(), phi); - registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hPtMFT"), track.pt()); - registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hYieldsMFT"), multiplicity, track.pt(), track.eta()); + registry.fill(HIST("Data/TpcMft/ChPartChPart/hEtaAssociated"), track.eta()); + registry.fill(HIST("Data/TpcMft/ChPartChPart/hPhiAssociated"), phi); + registry.fill(HIST("Data/TpcMft/ChPartChPart/hEtaPhiAssociated"), multiplicity, track.eta(), phi); } } - // ---- DATA : TPC-MFT HF-h Same Event QA ---- + // ---- DATA : TPC-MFT HF-h Same Event associated tracks QA ---- + template + void fillTpcMftHfChSameEventCandidateQa(float multiplicity, TTrack const& track, bool isD0) + { + if (isD0) { + registry.fill(HIST("Data/TpcMft/D0ChPart/hPtTrigger"), track.pt()); + registry.fill(HIST("Data/TpcMft/D0ChPart/hEtaTrigger"), track.eta()); + registry.fill(HIST("Data/TpcMft/D0ChPart/hPhiTrigger"), track.phi()); + registry.fill(HIST("Data/TpcMft/D0ChPart/hYieldsTrigger"), multiplicity, track.pt(), track.eta()); + registry.fill(HIST("Data/TpcMft/D0ChPart/hEtaPhiTrigger"), multiplicity, track.eta(), track.phi()); + registry.fill(HIST("Data/TpcMft/D0ChPart/hMultiplicity"), multiplicity); + } else { + registry.fill(HIST("Data/TpcMft/LcChPart/hPtTrigger"), track.pt()); + registry.fill(HIST("Data/TpcMft/LcChPart/hEtaTrigger"), track.eta()); + registry.fill(HIST("Data/TpcMft/LcChPart/hPhiTrigger"), track.phi()); + registry.fill(HIST("Data/TpcMft/LcChPart/hYieldsTrigger"), multiplicity, track.pt(), track.eta()); + registry.fill(HIST("Data/TpcMft/LcChPart/hEtaPhiTrigger"), multiplicity, track.eta(), track.phi()); + registry.fill(HIST("Data/TpcMft/LcChPart/hMultiplicity"), multiplicity); + } + } + // ---- DATA : TPC-MFT HF-h Same Event (Candidates) QA ---- template - void fillTpcMftHfChSameEventQa(float multiplicity, TTrack const& track) + void fillTpcMftHfChSameEventAssociatedQa(float multiplicity, TTrack const& track, bool isD0) { - // Used to fill QA plots for associated track from MFT when doing TPC-MFT HF-h correlations - float phi = track.phi(); - o2::math_utils::bringTo02Pi(phi); + if (isD0) { + registry.fill(HIST("Data/TpcMft/D0ChPart/hEtaAssociated"), track.eta()); + registry.fill(HIST("Data/TpcMft/D0ChPart/hPhiAssociated"), track.phi()); + registry.fill(HIST("Data/TpcMft/D0ChPart/hEtaPhiAssociated"), multiplicity, track.eta(), track.phi()); + } else { + registry.fill(HIST("Data/TpcMft/LcChPart/hEtaAssociated"), track.eta()); + registry.fill(HIST("Data/TpcMft/LcChPart/hPhiAssociated"), track.phi()); + registry.fill(HIST("Data/TpcMft/LcChPart/hEtaPhiAssociated"), multiplicity, track.eta(), track.phi()); + } + } + + // ========================= + // Quality Assessment plots for TpcFv0 cases + // ========================= - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hEtaMFT"), track.eta()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hPhiMFT"), phi); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hEtaPhiMFT"), multiplicity, track.eta(), phi); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hPtMFT"), track.pt()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hYieldsMFT"), multiplicity, track.pt(), track.eta()); - // add plot for multiplicity ? + // ---- DATA : QA for FV0a ---- + void fillFv0aQa(float multiplicity, float const& eta, float const& phi, bool isTPC) + { + if (isTPC) { + registry.fill(HIST("Data/TpcFv0a/ChPartChPart/hEtaAssociated"), eta); + registry.fill(HIST("Data/TpcFv0a/ChPartChPart/hPhiAssociated"), phi); + registry.fill(HIST("Data/TpcFv0a/ChPartChPart/hEtaPhiAssociated"), multiplicity, eta, phi); + } else { + registry.fill(HIST("Data/MftFv0a/ChPartChPart/hEtaAssociated"), eta); + registry.fill(HIST("Data/MftFv0a/ChPartChPart/hPhiAssociated"), phi); + registry.fill(HIST("Data/MftFv0a/ChPartChPart/hEtaPhiAssociated"), multiplicity, eta, phi); + } } - // ---- DATA : TPC-TPC HF-h Same Event (Candidates) QA ---- - // TODO: Note: we do not need all these plots since they are in D0 and Lc task -> remove it after we are sure this works + // ---- DATA : TPC-MFT h-h Same Event trigger QA ---- template - void fillTpcTpcD0CandidateQa(float multiplicity, TTrack const& candidate) + void fillTpcFv0aChChSameEventTriggerQa(float multiplicity, TTrack const& track) { - float phi = candidate.phi(); + float phi = track.phi(); o2::math_utils::bringTo02Pi(phi); - auto eta = candidate.eta(); - auto pt = candidate.pt(); - - if (candidate.isSelD0() >= selectionFlagHf) { - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMassVsPtVsMult"), hfHelper.invMassD0ToPiK(candidate), pt, multiplicity); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMassVsPt"), hfHelper.invMassD0ToPiK(candidate), pt); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMass"), hfHelper.invMassD0ToPiK(candidate)); - } - if (candidate.isSelD0bar() >= selectionFlagHf) { - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMassVsPtVsMult"), hfHelper.invMassD0barToKPi(candidate), pt, multiplicity); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMassVsPt"), hfHelper.invMassD0barToKPi(candidate), pt); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMass"), hfHelper.invMassD0barToKPi(candidate)); - } - - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMultiplicity"), multiplicity); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hEta"), eta); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hPhi"), phi); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hPtCandidate"), pt); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hPtProng0"), candidate.ptProng0()); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hPtProng1"), candidate.ptProng1()); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hEtaCandVsPt"), eta, pt); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hSelectionStatus"), candidate.isSelD0() + (candidate.isSelD0bar() * 2), pt); + registry.fill(HIST("Data/TpcFv0a/ChPartChPart/hEtaTrigger"), track.eta()); + registry.fill(HIST("Data/TpcFv0a/ChPartChPart/hPhiTrigger"), phi); + registry.fill(HIST("Data/TpcFv0a/ChPartChPart/hEtaPhiTrigger"), multiplicity, track.eta(), phi); + registry.fill(HIST("Data/TpcFv0a/ChPartChPart/hPtTrigger"), track.pt()); + registry.fill(HIST("Data/TpcFv0a/ChPartChPart/hYieldsTrigger"), multiplicity, track.pt(), track.eta()); + registry.fill(HIST("Data/TpcFv0a/ChPartChPart/hMultiplicity"), multiplicity); } - // ---- DATA : TPC-TPC HF-h Same Event (Candidates) QA ---- - // TODO: Note: we do not need all these plots since they are in D0 and Lc task -> remove it after we are sure this works + // ---- DATA : TPC-MFT HF-h Same Event associated tracks QA ---- template - void fillTpcTpcLcCandidateQa(float multiplicity, TTrack const& candidate) + void fillTpcFv0aHfChSameEventCandidateQa(float multiplicity, TTrack const& track, bool isD0) { - float phi = candidate.phi(); - o2::math_utils::bringTo02Pi(phi); - - auto pt = candidate.pt(); - auto ptProng0 = candidate.ptProng0(); - auto ptProng1 = candidate.ptProng1(); - auto ptProng2 = candidate.ptProng2(); - auto eta = candidate.eta(); - - if (candidate.isSelLcToPKPi() >= selectionFlagHf) { - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMass"), hfHelper.invMassLcToPKPi(candidate)); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMassVsPtVsMult"), hfHelper.invMassLcToPKPi(candidate), pt, multiplicity); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMassVsPt"), hfHelper.invMassLcToPKPi(candidate), pt); - } - if (candidate.isSelLcToPiKP() >= selectionFlagHf) { - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMass"), hfHelper.invMassLcToPiKP(candidate)); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMassVsPtVsMult"), hfHelper.invMassLcToPiKP(candidate), pt, multiplicity); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMassVsPt"), hfHelper.invMassLcToPiKP(candidate), pt); - } - - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMultiplicity"), multiplicity); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPt"), pt); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPtProng0"), ptProng0); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPtProng1"), ptProng1); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPtProng2"), ptProng2); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hEta"), eta); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hEtaVsPt"), eta, pt); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPhi"), phi); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPhiVsPt"), phi, pt); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hSelectionStatus"), candidate.isSelLcToPKPi(), pt); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hSelectionStatus"), candidate.isSelLcToPiKP(), pt); + if (isD0) { + registry.fill(HIST("Data/TpcFv0a/D0ChPart/hPtTrigger"), track.pt()); + registry.fill(HIST("Data/TpcFv0a/D0ChPart/hEtaTrigger"), track.eta()); + registry.fill(HIST("Data/TpcFv0a/D0ChPart/hPhiTrigger"), track.phi()); + registry.fill(HIST("Data/TpcFv0a/D0ChPart/hYieldsTrigger"), multiplicity, track.pt(), track.eta()); + registry.fill(HIST("Data/TpcFv0a/D0ChPart/hEtaPhiTrigger"), multiplicity, track.eta(), track.phi()); + registry.fill(HIST("Data/TpcFv0a/D0ChPart/hMultiplicity"), multiplicity); + } else { + registry.fill(HIST("Data/TpcFv0a/LcChPart/hPtTrigger"), track.pt()); + registry.fill(HIST("Data/TpcFv0a/LcChPart/hEtaTrigger"), track.eta()); + registry.fill(HIST("Data/TpcFv0a/LcChPart/hPhiTrigger"), track.phi()); + registry.fill(HIST("Data/TpcFv0a/LcChPart/hYieldsTrigger"), multiplicity, track.pt(), track.eta()); + registry.fill(HIST("Data/TpcFv0a/LcChPart/hEtaPhiTrigger"), multiplicity, track.eta(), track.phi()); + registry.fill(HIST("Data/TpcFv0a/LcChPart/hMultiplicity"), multiplicity); + } } // ---- DATA : TPC-MFT HF-h Same Event (Candidates) QA ---- - // TODO: Note: we do not need all these plots since they are in D0 and Lc task -> remove it after we are sure this works - template - void fillTpcMftD0CandidateQa(float multiplicity, TTrack const& candidate) + void fillTpcFv0aHfChSameEventAssociatedQa(float multiplicity, float const& eta, float const& phi, bool isD0) { - float phi = candidate.phi(); - auto pt = candidate.pt(); - o2::math_utils::bringTo02Pi(phi); - - if (candidate.isSelD0() >= selectionFlagHf) { - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hMassVsPtVsMult"), hfHelper.invMassD0ToPiK(candidate), pt, multiplicity); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hMassVsPt"), hfHelper.invMassD0ToPiK(candidate), pt); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hMass"), hfHelper.invMassD0ToPiK(candidate)); - } - if (candidate.isSelD0bar() >= selectionFlagHf) { - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hMassVsPtVsMult"), hfHelper.invMassD0barToKPi(candidate), pt, multiplicity); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hMassVsPt"), hfHelper.invMassD0barToKPi(candidate), pt); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hMass"), hfHelper.invMassD0barToKPi(candidate)); - } - - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hEtaCandidate"), candidate.eta()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hPhiCandidate"), phi); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hMultiplicityCandidate"), multiplicity); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hEtaPhiCandidate"), multiplicity, candidate.eta(), phi); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hYieldsCandidate"), multiplicity, pt, candidate.eta()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hPtCandidate"), pt); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hPtProng0"), candidate.ptProng0()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hPtProng1"), candidate.ptProng1()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hEtaCandVsPt"), candidate.eta(), pt); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hSelectionStatus"), candidate.isSelD0() + (candidate.isSelD0bar() * 2), pt); + if (isD0) { + registry.fill(HIST("Data/TpcFv0a/D0ChPart/hEtaAssociated"), eta); + registry.fill(HIST("Data/TpcFv0a/D0ChPart/hPhiAssociated"), phi); + registry.fill(HIST("Data/TpcFv0a/D0ChPart/hEtaPhiAssociated"), multiplicity, eta, phi); + } else { + registry.fill(HIST("Data/TpcFv0a/LcChPart/hEtaAssociated"), eta); + registry.fill(HIST("Data/TpcFv0a/LcChPart/hPhiAssociated"), phi); + registry.fill(HIST("Data/TpcFv0a/LcChPart/hEtaPhiAssociated"), multiplicity, eta, phi); + } } - // ---- DATA : TPC-MFT HF-h Same Event (Candidates) QA ---- - // TODO: Note: we do not need all these plots since they are in D0 and Lc task -> remove it after we are sure this works + // ========================= + // Quality Assessment plots for MftFv0 cases + // ========================= + // ---- DATA : MFT-FV0a h-h Same Event QA for MFT ---- template - void fillTpcMftLcCandidateQa(float multiplicity, TTrack const& candidate) + void fillMftFv0aChChSameEventQa(float multiplicity, TTrack const& track) { - auto pt = candidate.pt(); - auto ptProng0 = candidate.ptProng0(); - auto ptProng1 = candidate.ptProng1(); - auto ptProng2 = candidate.ptProng2(); - float phi = candidate.phi(); + float phi = track.phi(); o2::math_utils::bringTo02Pi(phi); - if (candidate.isSelLcToPKPi() >= selectionFlagHf) { - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hMass"), hfHelper.invMassLcToPKPi(candidate)); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hMassVsPtVsMult"), hfHelper.invMassLcToPKPi(candidate), pt, multiplicity); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hMassVsPt"), hfHelper.invMassLcToPKPi(candidate), pt); - } - if (candidate.isSelLcToPiKP() >= selectionFlagHf) { - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hMass"), hfHelper.invMassLcToPiKP(candidate)); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hMassVsPtVsMult"), hfHelper.invMassLcToPiKP(candidate), pt, multiplicity); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hMassVsPt"), hfHelper.invMassLcToPiKP(candidate), pt); - } - - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hYieldsCandidate"), multiplicity, pt, candidate.eta()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hEtaPhiCandidate"), multiplicity, candidate.eta(), phi); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hMultiplicityCandidate"), multiplicity); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hPt"), pt); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hPtProng0"), ptProng0); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hPtProng1"), ptProng1); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hPtProng2"), ptProng2); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hEta"), candidate.eta()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hEtaVsPt"), candidate.eta(), pt); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hPhi"), candidate.phi()); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hPhiVsPt"), candidate.phi(), pt); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hSelectionStatus"), candidate.isSelLcToPKPi(), pt); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hSelectionStatus"), candidate.isSelLcToPiKP(), pt); + registry.fill(HIST("Data/MftFv0a/ChPartChPart/hEtaTrigger"), track.eta()); + registry.fill(HIST("Data/MftFv0a/ChPartChPart/hPhiTrigger"), phi); + registry.fill(HIST("Data/MftFv0a/ChPartChPart/hEtaPhiTrigger"), multiplicity, track.eta(), phi); + registry.fill(HIST("Data/MftFv0a/ChPartChPart/hPtTrigger"), track.pt()); + registry.fill(HIST("Data/MftFv0a/ChPartChPart/hYieldsTrigger"), multiplicity, track.pt(), track.eta()); + registry.fill(HIST("Data/MftFv0a/ChPartChPart/hMultiplicity"), multiplicity); } // ========================= @@ -779,6 +747,60 @@ struct HfTaskFlow { } } + double getPhiFV0(unsigned int chno) + { + int cellsInLeft[] = {0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27, 32, 40, 33, 41, 34, 42, 35, 43}; + bool isChnoInLeft = std::find(std::begin(cellsInLeft), std::end(cellsInLeft), chno) != std::end(cellsInLeft); + float offsetX, offsetY; + if (isChnoInLeft) { + offsetX = (*offsetFV0)[0].getX(); + offsetY = (*offsetFV0)[0].getY(); + } else { + offsetX = (*offsetFV0)[1].getX(); + offsetY = (*offsetFV0)[1].getY(); + } + + o2::fv0::Point3Dsimple chPos; + chPos = fv0Det->getReadoutCenter(chno); + + // if (isReadoutCenter) + // chPos = fv0Det->getReadoutCenter(chno); + // else + // chPos = fv0Det->getCellCenter(chno); + + return RecoDecay::phi(chPos.x + offsetX, chPos.y + offsetY); + } + + double getEtaFV0(unsigned int chno) + { + int cellsInLeft[] = {0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27, 32, 40, 33, 41, 34, 42, 35, 43}; + bool isChnoInLeft = std::find(std::begin(cellsInLeft), std::end(cellsInLeft), chno) != std::end(cellsInLeft); + float offsetX, offsetY, offsetZ; + if (isChnoInLeft) { + offsetX = (*offsetFV0)[0].getX(); + offsetY = (*offsetFV0)[0].getY(); + offsetZ = (*offsetFV0)[0].getZ(); + } else { + offsetX = (*offsetFV0)[1].getX(); + offsetY = (*offsetFV0)[1].getY(); + offsetZ = (*offsetFV0)[1].getZ(); + } + + o2::fv0::Point3Dsimple chPos; + chPos = fv0Det->getReadoutCenter(chno); + // if (isReadoutCenter) + // chPos = fv0Det->getReadoutCenter(chno); + // else + // chPos = fv0Det->getCellCenter(chno); + + auto x = chPos.x + offsetX; + auto y = chPos.y + offsetY; + auto z = chPos.z + offsetZ; + auto r = std::sqrt(x * x + y * y); + auto theta = std::atan2(r, z); + return -std::log(std::tan(0.5 * theta)); + } + // ========================= // Cuts with functions // ========================= @@ -887,7 +909,7 @@ struct HfTaskFlow { auto etaCandidate = mcCandidate.eta(); if constexpr (std::is_same_v) { // For now, that means we do D0 - if (std::abs(mcCandidate.flagMcMatchGen()) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { + if (std::abs(mcCandidate.flagMcMatchGen()) == 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) { if (etaCandidateMax >= 0. && std::abs(etaCandidate) > etaCandidateMax) { return false; @@ -903,7 +925,7 @@ struct HfTaskFlow { // } } } else { // For now, that means we do LambdaC - if (std::abs(mcCandidate.flagMcMatchGen()) == hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi) { + if (std::abs(mcCandidate.flagMcMatchGen()) == 1 << aod::hf_cand_3prong::DecayType::LcToPKPi) { if (etaCandidateMax >= 0. && std::abs(etaCandidate) > etaCandidateMax) { return false; @@ -999,10 +1021,8 @@ struct HfTaskFlow { fillingHFcontainer = true; if constexpr (std::is_same_v) { // If D0 invmass = hfHelper.invMassD0ToPiK(track1); - // Should add D0 bar ? } else { // If Lc invmass = hfHelper.invMassLcToPKPi(track1); - // Should add Lc bar ? (maybe not its the same mass right ?) } } @@ -1015,10 +1035,8 @@ struct HfTaskFlow { fillingHFcontainer = true; if constexpr (std::is_same_v) { // If D0 invmass = o2::constants::physics::MassD0; - // Should add D0 bar ? } else { // If Lc invmass = o2::constants::physics::MassLambdaCPlus; - // Should add Lc bar ? (maybe not its the same mass right ?) } } @@ -1034,17 +1052,17 @@ struct HfTaskFlow { if (processMc == false) { // If DATA if constexpr (!std::is_same_v) { // IF TPC-TPC case if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-TPC D0-h - fillTpcTpcD0CandidateQa(multiplicity, track1); + fillTpcTpcHfChSameEventCandidateQa(multiplicity, track1, true); } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-TPC Lc-h - fillTpcTpcLcCandidateQa(multiplicity, track1); + fillTpcTpcHfChSameEventCandidateQa(multiplicity, track1, false); } else { // IF NEITHER D0 NOR LC -> TPC-TPC h-h fillTpcTpcChChSameEventQa(multiplicity, track1); } } else { // IF TPC-MFT case if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-MFT D0-h - fillTpcMftD0CandidateQa(multiplicity, track1); + fillTpcMftHfChSameEventCandidateQa(multiplicity, track1, true); } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-MFT Lc-h - fillTpcMftLcCandidateQa(multiplicity, track1); + fillTpcMftHfChSameEventCandidateQa(multiplicity, track1, false); } else { // IF NEITHER D0 NOR LC -> TPC-MFT h-h fillTpcMftChChSameEventQa(multiplicity, track1, true); } // end of if condition for TPC-TPC or TPC-MFT case @@ -1052,7 +1070,7 @@ struct HfTaskFlow { // Maybe I won't need it for MC (first files are way lighter in MC, but also I need to loop over all tracks in MC GEN) } else { // If MC (add cases later) if constexpr (!std::is_same_v) { // IF TPC-TPC case - fillTpcTpcChChSameEventQaMc(multiplicity, track1); + // fillTpcTpcChChSameEventQaMc(multiplicity, track1); } } } @@ -1064,10 +1082,17 @@ struct HfTaskFlow { // apply cuts for MFT tracks if constexpr (std::is_same_v) { - registry.fill(HIST("Data/TpcMft/hMftTracksSelection"), MftTrackSelectionStep::NoSelection); - if (!isAcceptedMftTrack(track2, true)) { - continue; + if (sameEvent && loopCounter == 1) { // To avoid double counting, we fill the plots only the first time + registry.fill(HIST("Data/TpcMft/hMftTracksSelection"), MftTrackSelectionStep::NoSelection); + + if (!isAcceptedMftTrack(track2, true)) { + continue; + } + } else { // After the first loop, we don't fill the plots anymore but still do the selection + if (!isAcceptedMftTrack(track2, false)) { + continue; + } } } @@ -1134,16 +1159,16 @@ struct HfTaskFlow { // if constexpr (std::is_same_v) { // If DATA if constexpr (!std::is_same_v) { // IF TPC-TPC case if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-TPC D0-h - fillTpcTpcHfChSameEventQa(multiplicity, track2); + fillTpcTpcHfChSameEventAssociatedQa(multiplicity, track2, true); } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-TPC Lc-h - fillTpcTpcHfChSameEventQa(multiplicity, track2); + fillTpcTpcHfChSameEventAssociatedQa(multiplicity, track2, false); } // No if condition if it is h-h, because it would be the same plots than for the trigger particle } else { // IF TPC-MFT case if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-MFT D0-h - fillTpcMftHfChSameEventQa(multiplicity, track2); + fillTpcMftHfChSameEventAssociatedQa(multiplicity, track2, true); } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-MFT Lc-h - fillTpcMftHfChSameEventQa(multiplicity, track2); + fillTpcMftHfChSameEventAssociatedQa(multiplicity, track2, false); } else { // IF NEITHER D0 NOR LC -> TPC-MFT h-h fillTpcMftChChSameEventQa(multiplicity, track2, false); } // end of if condition for TPC-TPC or TPC-MFT case @@ -1153,7 +1178,7 @@ struct HfTaskFlow { //} } - if (sameEvent && (loopCounter == 1)) { + if (sameEvent && (loopCounter == 1) && std::is_same_v) { // FILL USUAL MFT DISTRIBUTIONS registry.fill(HIST("Data/TpcMft/kCFStepAll/hEta"), eta2); registry.fill(HIST("Data/TpcMft/kCFStepAll/hPhi"), phi2); @@ -1218,10 +1243,8 @@ struct HfTaskFlow { // fillingHFcontainer = true; // if constexpr (std::is_same_v) { // If D0 // invmass = o2::constants::physics::MassD0; - // // Should add D0 bar ? // } else { // If Lc // invmass = o2::constants::physics::MassLambdaCPlus; - // // Should add Lc bar ? (maybe not its the same mass right ?) // } // } @@ -1235,9 +1258,9 @@ struct HfTaskFlow { // FILL QA PLOTS for trigger particle if (sameEvent && (cutAmbiguousTracks == false)) { if constexpr (std::is_same_v) { - fillTpcMftD0CandidateQa(multiplicity, track1); + fillTpcMftHfChSameEventCandidateQa(multiplicity, track1, true); } else if constexpr (std::is_same_v) { - fillTpcTpcLcCandidateQa(multiplicity, track1); + fillTpcMftHfChSameEventCandidateQa(multiplicity, track1, false); } else { fillTpcMftChChSameEventQa(multiplicity, track1, true); } @@ -1249,12 +1272,13 @@ struct HfTaskFlow { for (const auto& track2 : tracks2) { // Fill QA plot for all MFT tracks () (only if cutAmbiguousTracks is false to avoid double counting) - if (!cutAmbiguousTracks) { + if (!cutAmbiguousTracks && sameEvent && (loopCounter == 1)) { registry.fill(HIST("Data/TpcMft/hAmbiguityOfMftTracks"), MftTrackAmbiguityStep::AllMftTracks); } // const auto& reassociatedMftTrack = track2.mfttrack(); // No one uses const and auto& here, so I will follow + auto reassociatedMftTrack = track2.template mfttrack_as(); if (!isAcceptedMftTrack(reassociatedMftTrack, false)) { @@ -1262,13 +1286,14 @@ struct HfTaskFlow { } // Fill QA plot for MFT tracks after physical selection (eta + clusters) - if (!cutAmbiguousTracks) { + if (!cutAmbiguousTracks && sameEvent && (loopCounter == 1)) { registry.fill(HIST("Data/TpcMft/hAmbiguityOfMftTracks"), MftTrackAmbiguityStep::AfterTrackSelection); + registry.fill(HIST("Data/TpcMft/hReassociationMftTracks"), ReassociationMftTracks::NotReassociatedMftTracks); } // We check if the track is ambiguous or non-ambiguous (QA plots are filled in isAmbiguousMftTrack) // Fill plots only if cutAmbiguousTracks is false (to avoid double counting) - if (isAmbiguousMftTrack(track2, !cutAmbiguousTracks)) { + if (isAmbiguousMftTrack(track2, (!cutAmbiguousTracks && sameEvent && (loopCounter == 1)))) { // If the MFT track is ambiguous we may cut or not on the ambiguous track if (cutAmbiguousTracks) { continue; @@ -1276,8 +1301,9 @@ struct HfTaskFlow { } if (reassociatedMftTrack.collisionId() != track2.bestCollisionId()) { - // track.collision_as().posZ() - continue; + if (sameEvent && (loopCounter == 1)) { + registry.fill(HIST("Data/TpcMft/hReassociationMftTracks"), ReassociationMftTracks::ReassociatedMftTracks); + } } // case of h-h correlations where the two types of tracks are the same @@ -1339,9 +1365,9 @@ struct HfTaskFlow { // FILL QA PLOTS for associated particle if (sameEvent && (loopCounter == 1) && (cutAmbiguousTracks == false)) { if constexpr (std::is_same_v) { - fillTpcMftHfChSameEventQa(multiplicity, reassociatedMftTrack); + fillTpcMftHfChSameEventAssociatedQa(multiplicity, reassociatedMftTrack, true); } else if constexpr (std::is_same_v) { - fillTpcMftHfChSameEventQa(multiplicity, reassociatedMftTrack); + fillTpcMftHfChSameEventAssociatedQa(multiplicity, reassociatedMftTrack, false); } else { fillTpcMftChChSameEventQa(multiplicity, reassociatedMftTrack, false); } @@ -1358,6 +1384,243 @@ struct HfTaskFlow { } // end of loop over tracks 1 } + template + void fillCorrelationsFV0(TTarget target, CorrelationContainer::CFStep step, + TTracksTrig const& tracks1, TTracksAssoc const& tracks2, + float multiplicity, float posZ, bool sameEvent) + { + auto triggerWeight = 1; + auto associatedWeight = 1; + + // To avoid filling associated tracks QA many times + // I fill it only for the first trigger track of the collision + auto loopCounter = 0; + + // + // TRIGGER PARTICLE + // + for (auto const& track1 : tracks1) { + + loopCounter++; + + float eta1 = track1.eta(); + float pt1 = track1.pt(); + float phi1 = track1.phi(); + o2::math_utils::bringTo02Pi(phi1); + + // TODO: add getter for NUE trigger efficiency here + + // calculating inv. mass to be filled into the container below + // Note: this is needed only in case of HF-hadron correlations + // TO DO ? Add one more if condition if its MC ? + bool fillingHFcontainer = false; + double invmass = 0; + if constexpr (std::is_same_v || std::is_same_v) { + // TODO: Check how to put this into a Filter -> Pretty sure it cannot be a filter + if (!isAcceptedCandidate(track1)) { + continue; + } + fillingHFcontainer = true; + if constexpr (std::is_same_v) { // If D0 + invmass = hfHelper.invMassD0ToPiK(track1); + } else { // If Lc + invmass = hfHelper.invMassLcToPKPi(track1); + } + } + + // Selections for MC GENERATED + if constexpr (std::is_same_v || std::is_same_v) { + // TODO: Check how to put this into a Filter -> Pretty sure it cannot be a filter + if (!isAcceptedMcCandidate(track1)) { + continue; + } + fillingHFcontainer = true; + if constexpr (std::is_same_v) { // If D0 + invmass = o2::constants::physics::MassD0; + } else { // If Lc + invmass = o2::constants::physics::MassLambdaCPlus; + } + } + + // fill single-track distributions + if (!fillingHFcontainer) { // if not HF-h case + target->getTriggerHist()->Fill(step, pt1, multiplicity, posZ, triggerWeight); + } else { + target->getTriggerHist()->Fill(step, pt1, multiplicity, posZ, invmass, triggerWeight); + } + + // FILL QA PLOTS for trigger particle + if (sameEvent && (step == CorrelationContainer::kCFStepReconstructed)) { + if (processMc == false) { // If DATA + if constexpr (!std::is_same_v) { // If not aod::MFTTracks as trigger -> TPC-FV0a correlations + if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-FV0a D0-h + fillTpcFv0aHfChSameEventCandidateQa(multiplicity, track1, true); + } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-FV0a Lc-h + fillTpcFv0aHfChSameEventCandidateQa(multiplicity, track1, false); + } else { // IF NEITHER D0 NOR LC -> TPC-MFT h-h + fillTpcFv0aChChSameEventTriggerQa(multiplicity, track1); + } + } else { // If aod::MFTTracks as trigger -> MFT-FV0a (non reassoc/ambiguous) correlations + fillMftFv0aChChSameEventQa(multiplicity, track1); + // registry.fill(HIST("Data/TpcMft/kCFStepAll/hEta"), eta2); + // registry.fill(HIST("Data/TpcMft/kCFStepAll/hPhi"), phi2); + } + } + //} else { // If MC (add cases later) + // if constexpr (!std::is_same_v) { // IF TPC-TPC case + // fillTpcTpcChChSameEventQaMc(multiplicity, track1); + // } + } // end of if condition to fill QA plots for trigger particle + + // + // ASSOCIATED PARTICLE + // + for (std::size_t indexChannel = 0; indexChannel < tracks2.channel().size(); indexChannel++) { + + auto channelId = tracks2.channel()[indexChannel]; + // float fv0Amplitude = tracks2.amplitude()[indexChannel]; + // if (fv0Amplitude <= 0) { + // continue; + // } + + auto phi2 = getPhiFV0(channelId); + auto eta2 = getEtaFV0(channelId); + + float deltaPhi = phi1 - phi2; + // set range of delta phi in (-pi/2 , 3/2*pi) + deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); + + // IF EVERYTHING WORKS WITH THE REASSOCIATED MFT TRACKS, I WILL HAVE TO CHANGE HOW THOSE FUNCTIONS ARE FILLED TOO + if (!fillingHFcontainer) { + // fill pair correlations + target->getPairHist()->Fill(step, eta1 - eta2, pt1, pt1, multiplicity, deltaPhi, posZ, + triggerWeight * associatedWeight); + } else { + target->getPairHist()->Fill(step, eta1 - eta2, pt1, pt1, multiplicity, deltaPhi, posZ, invmass, + triggerWeight * associatedWeight); + } + + // FILL QA PLOTS for associated particle + if (sameEvent && (loopCounter == 1) && (step == CorrelationContainer::kCFStepReconstructed)) { + // if constexpr (std::is_same_v) { // If DATA + if constexpr (!std::is_same_v) { // If not aod::MFTTracks as trigger -> TPC-FV0a correlations + if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-FV0a D0-h + fillTpcFv0aHfChSameEventAssociatedQa(multiplicity, eta2, phi2, true); + } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-FV0a Lc-h + fillTpcFv0aHfChSameEventAssociatedQa(multiplicity, eta2, phi2, false); + } else { // IF NEITHER D0 NOR LC -> ch. part. - ch. part + fillFv0aQa(multiplicity, eta2, phi2, true); + } + } else { // If aod::MFTTracks as trigger -> MFT-FV0a (non reassoc/ambiguous) correlations + fillFv0aQa(multiplicity, eta2, phi2, false); + } + //} else { // If MC (add cases later) + // fillTpcTpcChChSameEventQaMc(multiplicityTracks2, vz, tracks1); + //} + } // end of if condition to fill QA plots for associated particle + + } // end of loop over FV0 channel indices + } // end of loop over tracks 1 + } + + template + void fillCorrelationsFV0ReassociatedMftTracks(TTarget target, CorrelationContainer::CFStep step, + TTracksTrig const& tracks1, TTracksAssoc const& tracks2, + float multiplicity, float posZ, bool sameEvent, bool cutAmbiguousTracks) + { + auto triggerWeight = 1; + auto associatedWeight = 1; + + // To avoid filling associated tracks QA many times + // I fill it only for the first trigger track of the collision + auto loopCounter = 0; + + // + // TRIGGER PARTICLE + // + for (auto const& track1 : tracks1) { + loopCounter++; + + // TO-DO (if useful) : adapt this but or Mft-FV0a + // Fill QA plot for all MFT tracks () (only if cutAmbiguousTracks is false to avoid double counting) + // if (!cutAmbiguousTracks && sameEvent && (loopCounter == 1)) { + // registry.fill(HIST("Data/TpcMft/hAmbiguityOfMftTracks"), MftTrackAmbiguityStep::AllMftTracks); + //} + + auto reassociatedMftTrack = track1.template mfttrack_as(); + + if (!isAcceptedMftTrack(reassociatedMftTrack, false)) { + continue; + } + + // TO-DO (if useful) : adapt this but or Mft-FV0a + // Fill QA plot for MFT tracks after physical selection (eta + clusters) + // if (!cutAmbiguousTracks && sameEvent && (loopCounter == 1)) { + // registry.fill(HIST("Data/TpcMft/hAmbiguityOfMftTracks"), MftTrackAmbiguityStep::AfterTrackSelection); + // registry.fill(HIST("Data/TpcMft/hReassociationMftTracks"), ReassociationMftTracks::NotReassociatedMftTracks); + //} + + // We check if the track is ambiguous or non-ambiguous (QA plots are filled in isAmbiguousMftTrack) + // Fill plots only if cutAmbiguousTracks is false (to avoid double counting) + if (isAmbiguousMftTrack(track1, false)) { + // If the MFT track is ambiguous we may cut or not on the ambiguous track + if (cutAmbiguousTracks) { + continue; + } + } + + // if (reassociatedMftTrack.collisionId() != track2.bestCollisionId()) { + // if (sameEvent && (loopCounter == 1)) { + // registry.fill(HIST("Data/TpcMft/hReassociationMftTracks"), ReassociationMftTracks::ReassociatedMftTracks); + // } + // } + + float eta1 = reassociatedMftTrack.eta(); + float pt1 = reassociatedMftTrack.pt(); + float phi1 = reassociatedMftTrack.phi(); + o2::math_utils::bringTo02Pi(phi1); + + // TODO: add getter for NUE trigger efficiency here + + target->getTriggerHist()->Fill(step, pt1, multiplicity, posZ, triggerWeight); + + // FILL QA PLOTS for trigger particle + if (sameEvent && (step == CorrelationContainer::kCFStepReconstructed)) { + if (processMc == false) { // If DATA + fillMftFv0aChChSameEventQa(multiplicity, reassociatedMftTrack); + } + } // end of if condition to fill QA plots for trigger particle + + // + // ASSOCIATED PARTICLE + // + for (std::size_t indexChannel = 0; indexChannel < tracks2.channel().size(); indexChannel++) { + + auto channelId = tracks2.channel()[indexChannel]; + // float fv0Amplitude = tracks2.amplitude()[indexChannel]; + // if (fv0Amplitude <= 0) { + // continue; + // } + + auto phi2 = getPhiFV0(channelId); + auto eta2 = getEtaFV0(channelId); + + float deltaPhi = phi1 - phi2; + // set range of delta phi in (-pi/2 , 3/2*pi) + deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); + + target->getPairHist()->Fill(step, eta1 - eta2, pt1, pt1, multiplicity, deltaPhi, posZ, + triggerWeight * associatedWeight); + + // FILL QA PLOTS for associated particle + if (sameEvent && (loopCounter == 1) && (step == CorrelationContainer::kCFStepReconstructed)) { + fillFv0aQa(multiplicity, eta2, phi2, false); + } // end of if condition to fill QA plots for associated particle + + } // end of loop over FV0 channel indices + } // end of loop over tracks 1 + } + // =============================================================================================================================================================================== // mixCollisions for RECONSTRUCTED events // =============================================================================================================================================================================== @@ -1386,28 +1649,30 @@ struct HfTaskFlow { } } - auto binningValues = binningWithTracksSize.getBinningValues(collision1, collisions); - int bin = binningWithTracksSize.getBin(binningValues); + // auto binningValues = binningWithTracksSize.getBinningValues(collision1, collisions); + // int bin = binningWithTracksSize.getBin(binningValues); const auto multiplicityTracks1 = getPartsSize(collision1); + /* if constexpr (std::is_same_v) { // If MC - registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing"), bin); + registry.fill(HIST("MC/Rec/TpcTpc/ChPartChPart/MixedEvent/hEventCountMixing"), bin); } else { // If not MC if constexpr (std::is_same_v) { // IF TPC-MFT case if constexpr (std::is_same_v || std::is_same_v) { // IF HF-h case -> TPC-MFT HF-h registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hEventCountMixing"), bin); } else { // IF h-h case -> TPC-MFT h-h case - registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hEventCountMixing"), bin); + registry.fill(HIST("Data/TpcMft/ChPartChPart/MixedEvent/hEventCountMixing"), bin); } } else { // IF TPC-TPC case if constexpr (std::is_same_v || std::is_same_v) { // IF HF-h case -> TPC-TPC HF-h registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hEventCountHFMixing"), bin); } else { // IF h-h case -> TPC-TPC h-h case - registry.fill(HIST("Data/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing"), bin); + registry.fill(HIST("Data/TpcTpc/ChPartChPart/MixedEvent/hEventCountMixing"), bin); } } // end of if condition for TPC-TPC or TPC-MFT case } + */ corrContainer->fillEvent(multiplicityTracks1, step); fillCorrelations(corrContainer, step, tracks1, tracks2, multiplicityTracks1, collision1.posZ(), false); @@ -1449,19 +1714,19 @@ struct HfTaskFlow { if constexpr (std::is_same_v) { // If MC - registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing"), bin); + registry.fill(HIST("MC/Rec/TpcTpc/ChPartChPart/MixedEvent/hEventCountMixing"), bin); } else { // If not MC if constexpr (std::is_same_v) { // IF TPC-MFT case if constexpr (std::is_same_v || std::is_same_v) { // IF HF-h case -> TPC-MFT HF-h registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hEventCountMixing"), bin); } else { // IF h-h case -> TPC-MFT h-h case - registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hEventCountMixing"), bin); + registry.fill(HIST("Data/TpcMft/ChPartChPart/MixedEvent/hEventCountMixing"), bin); } } else { // IF TPC-TPC case if constexpr (std::is_same_v || std::is_same_v) { // IF HF-h case -> TPC-TPC HF-h registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hEventCountHFMixing"), bin); } else { // IF h-h case -> TPC-TPC h-h case - registry.fill(HIST("Data/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing"), bin); + registry.fill(HIST("Data/TpcTpc/ChPartChPart/MixedEvent/hEventCountMixing"), bin); } } // end of if condition for TPC-TPC or TPC-MFT case } @@ -1490,14 +1755,14 @@ struct HfTaskFlow { for (const auto& [collision1, tracks1, collision2, tracks2] : pair) { - auto binningValues = binningWithTracksSize.getBinningValues(collision1, mcCollisions); - int bin = binningWithTracksSize.getBin(binningValues); + // auto binningValues = binningWithTracksSize.getBinningValues(collision1, mcCollisions); + // int bin = binningWithTracksSize.getBin(binningValues); const auto multiplicity = getPartsSize(collision1); // get multiplicity of charged hadrons, which is used for slicing in mixing // TO BE DONE : ADD ONE MORE IF CONDITION TO FILL THE MC CASE // TODO : FILL NEW PLOTS FOR MCTRUTH ONLY - registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing"), bin); + // registry.fill(HIST("MC/Gen/TpcTpc/ChPartChPart/MixedEvent/hEventCountMixing"), bin); corrContainer->fillEvent(multiplicity, CorrelationContainer::kCFStepAll); fillCorrelations(corrContainer, CorrelationContainer::CFStep::kCFStepAll, tracks1, tracks2, multiplicity, collision1.posZ(), false); @@ -1531,16 +1796,14 @@ struct HfTaskFlow { // temporary solution, since other correlation options always have to be ran with h-h, too // TODO: rewrite it in a more intelligent way const auto multiplicity = collision.multNTracksPV(); - registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hMultiplicity"), multiplicity); - registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hVtxZ"), collision.posZ()); + // registry.fill(HIST("Data/TpcTpc/ChPartChPart/SameEvent/hMultiplicity"), multiplicity); + // registry.fill(HIST("Data/TpcTpc/ChPartChPart/SameEvent/hVtxZ"), collision.posZ()); BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; - int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); - registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hEventCountSame"), bin); + // int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); + // registry.fill(HIST("Data/TpcTpc/ChPartChPart/SameEvent/hEventCountSame"), bin); sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - - // TO-DO : add if condition for when we will implant corrected correlations (kCFStepReconstructed -> kCFStepCorrected) fillCorrelations(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, tracks, multiplicity, collision.posZ(), true); } PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcChCh, "DATA : Process same-event correlations for TPC-TPC h-h case", false); @@ -1565,11 +1828,10 @@ struct HfTaskFlow { const auto multiplicity = collision.multNTracksPV(); BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; - int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hEventCountSame"), bin); + // int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); + // registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hEventCountSame"), bin); sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelations(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, tracks, multiplicity, collision.posZ(), true); } PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcD0Ch, "DATA : Process same-event correlations for TPC-TPC D0-h case", false); @@ -1594,11 +1856,10 @@ struct HfTaskFlow { const auto multiplicity = collision.multNTracksPV(); BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; - int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); - registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hEventCountSame"), bin); + // int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); + // registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hEventCountSame"), bin); sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelations(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, tracks, multiplicity, collision.posZ(), true); } PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcLcCh, "DATA : Process same-event correlations for TPC-TPC Lc-h case", false); @@ -1617,23 +1878,13 @@ struct HfTaskFlow { const auto multiplicity = collision.multNTracksPV(); BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; - int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); - registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hEventCountSame"), bin); + // int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); + // registry.fill(HIST("Data/TpcMft/ChPartChPart/SameEvent/hEventCountSame"), bin); // I use kCFStepAll for running my code with all MFTTracks were the reassociation process was not applied // We don't fill "normal" QA plots with these tracks, only specific plots to compare with other type of MFTTracks sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); fillCorrelations(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, mftTracks, multiplicity, collision.posZ(), true); - - // I use the step kCFStepReconstructed for reassociatedMftTracks (most likely the ones we will use in the end) - // sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - // fillCorrelationsReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, reassociatedMftTracks, multiplicity, collision.posZ(), true, false); - - // I use kCFStepTracked for running my code with only non-ambiguous MFTTracks - // This is the same as running with reassociatedMftTracks, but applying one more cut in the fillCorrelations function - // We don't fill "normal" QA plots with these tracks, only specific plots to compare with other type of MFTTracks - // sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepTracked); - // fillCorrelationsReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepTracked, tracks, reassociatedMftTracks, multiplicity, collision.posZ(), false, true); } PROCESS_SWITCH(HfTaskFlow, processSameTpcMftChCh, "DATA : Process same-event correlations for TPC-MFT h-h case", false); @@ -1643,30 +1894,49 @@ struct HfTaskFlow { aod::MFTTracks const& mftTracks) { if (!(isAcceptedCollision(collision, true))) { - return; // when process function has iterator + return; } + registry.fill(HIST("Data/TpcMft/hNTracks"), tracks.size()); + registry.fill(HIST("Data/TpcMft/hNMftTracks"), mftTracks.size()); + registry.fill(HIST("Data/TpcMft/hNBestCollisionFwd"), reassociatedMftTracks.size()); + const auto multiplicity = collision.multNTracksPV(); BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; - int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); - registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hEventCountSame"), bin); - - // I use kCFStepAll for running my code with all MFTTracks were the reassociation process was not applied - // We don't fill "normal" QA plots with these tracks, only specific plots to compare with other type of MFTTracks - sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepAll); - fillCorrelations(sameEvent, CorrelationContainer::CFStep::kCFStepAll, tracks, mftTracks, multiplicity, collision.posZ(), true); + // int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); + // registry.fill(HIST("Data/TpcMft/ChPartChPart/SameEvent/hEventCountSame"), bin); // I use the step kCFStepReconstructed for reassociatedMftTracks (most likely the ones we will use in the end) sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); fillCorrelationsReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, reassociatedMftTracks, multiplicity, collision.posZ(), true, false); + } + PROCESS_SWITCH(HfTaskFlow, processSameTpcMftChChReassociated, "DATA : Process same-event correlations for TPC-MFT h-h case reassociated", false); + + void processSameTpcMftChChNonAmbiguous(FilteredCollisionsWSelMult::iterator const& collision, + soa::SmallGroups const& reassociatedMftTracks, + FilteredTracksWDcaSel const& tracks, + aod::MFTTracks const& mftTracks) + { + if (!(isAcceptedCollision(collision, true))) { + return; // when process function has iterator + } + + registry.fill(HIST("Data/TpcMft/hNTracks"), tracks.size()); + registry.fill(HIST("Data/TpcMft/hNMftTracks"), mftTracks.size()); + registry.fill(HIST("Data/TpcMft/hNBestCollisionFwd"), reassociatedMftTracks.size()); + + const auto multiplicity = collision.multNTracksPV(); + BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; + // int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); + // registry.fill(HIST("Data/TpcMft/ChPartChPart/SameEvent/hEventCountSame"), bin); // I use kCFStepTracked for running my code with only non-ambiguous MFTTracks // This is the same as running with reassociatedMftTracks, but applying one more cut in the fillCorrelations function // We don't fill "normal" QA plots with these tracks, only specific plots to compare with other type of MFTTracks - sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepTracked); - fillCorrelationsReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepTracked, tracks, reassociatedMftTracks, multiplicity, collision.posZ(), true, true); + sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelationsReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, reassociatedMftTracks, multiplicity, collision.posZ(), true, true); } - PROCESS_SWITCH(HfTaskFlow, processSameTpcMftChChReassociated, "DATA : Process same-event correlations for TPC-MFT h-h case reassociated", false); + PROCESS_SWITCH(HfTaskFlow, processSameTpcMftChChNonAmbiguous, "DATA : Process same-event correlations for TPC-MFT h-h case with non-ambiguous tracks", false); // ===================================== // DATA : process same event correlations: TPC-MFT HF-h case for D0 @@ -1689,11 +1959,10 @@ struct HfTaskFlow { const auto multiplicity = collision.multNTracksPV(); BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; - int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hEventCountSame"), bin); + // int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); + // registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hEventCountSame"), bin); sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelations(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, mftTracks, multiplicity, collision.posZ(), true); } PROCESS_SWITCH(HfTaskFlow, processSameTpcMftD0Ch, "DATA : Process same-event correlations for TPC-MFT D0-h case", false); @@ -1701,31 +1970,17 @@ struct HfTaskFlow { void processSameTpcMftD0ChReassociated(FilteredCollisionsWSelMult::iterator const& collision, HfCandidatesSelD0 const& candidates, soa::SmallGroups const& reassociatedMftTracks, - aod::MFTTracks const& mftTracks) + aod::MFTTracks const&) { if (!(isAcceptedCollision(collision, true))) { return; // when process function has iterator } const auto multiplicity = collision.multNTracksPV(); - BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; - // int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); - // registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hEventCountSame"), bin); - - // I use kCFStepAll for running my code with all MFTTracks were the reassociation process was not applied - // We don't fill "normal" QA plots with these tracks, only specific plots to compare with other type of MFTTracks - sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepAll); - fillCorrelations(sameEventHf, CorrelationContainer::CFStep::kCFStepAll, candidates, mftTracks, multiplicity, collision.posZ(), true); // I use the step kCFStepReconstructed for reassociatedMftTracks (most likely the ones we will use in the end) sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); fillCorrelationsReassociatedMftTracks(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, reassociatedMftTracks, multiplicity, collision.posZ(), true, false); - - // I use kCFStepTracked for running my code with only non-ambiguous MFTTracks - // This is the same as running with reassociatedMftTracks, but applying one more cut in the fillCorrelations function - // We don't fill "normal" QA plots with these tracks, only specific plots to compare with other type of MFTTracks - sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepTracked); - fillCorrelationsReassociatedMftTracks(sameEventHf, CorrelationContainer::CFStep::kCFStepTracked, candidates, reassociatedMftTracks, multiplicity, collision.posZ(), true, true); } PROCESS_SWITCH(HfTaskFlow, processSameTpcMftD0ChReassociated, "DATA : Process same-event correlations for TPC-MFT D0-h case reassociated", false); @@ -1750,11 +2005,10 @@ struct HfTaskFlow { const auto multiplicity = collision.multNTracksPV(); BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; - int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); - registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hEventCountSame"), bin); + // int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); + // registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hEventCountSame"), bin); sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelations(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, mftTracks, multiplicity, collision.posZ(), true); } PROCESS_SWITCH(HfTaskFlow, processSameTpcMftLcCh, "DATA : Process same-event correlations for TPC-MFT Lc-h case", false); @@ -1762,7 +2016,7 @@ struct HfTaskFlow { void processSameTpcMftLcChReassociated(FilteredCollisionsWSelMult::iterator const& collision, HfCandidatesSelLc const& candidates, soa::SmallGroups const& reassociatedMftTracks, - aod::MFTTracks const& mftTracks) + aod::MFTTracks const&) { if (!(isAcceptedCollision(collision, true))) { return; // when process function has iterator @@ -1771,25 +2025,146 @@ struct HfTaskFlow { const auto multiplicity = collision.multNTracksPV(); BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; // int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); - // registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hEventCountSame"), bin); - - // I use kCFStepAll for running my code with all MFTTracks were the reassociation process was not applied - // We don't fill "normal" QA plots with these tracks, only specific plots to compare with other type of MFTTracks - sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepAll); - fillCorrelations(sameEventHf, CorrelationContainer::CFStep::kCFStepAll, candidates, mftTracks, multiplicity, collision.posZ(), true); + // registry.fill(HIST("Data/TpcMft/ChPartChPart/SameEvent/hEventCountSame"), bin); // I use the step kCFStepReconstructed for reassociatedMftTracks (most likely the ones we will use in the end) sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); fillCorrelationsReassociatedMftTracks(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, reassociatedMftTracks, multiplicity, collision.posZ(), true, false); - - // I use kCFStepTracked for running my code with only non-ambiguous MFTTracks - // This is the same as running with reassociatedMftTracks, but applying one more cut in the fillCorrelations function - // We don't fill "normal" QA plots with these tracks, only specific plots to compare with other type of MFTTracks - sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepTracked); - fillCorrelationsReassociatedMftTracks(sameEventHf, CorrelationContainer::CFStep::kCFStepTracked, candidates, reassociatedMftTracks, multiplicity, collision.posZ(), true, true); } PROCESS_SWITCH(HfTaskFlow, processSameTpcMftLcChReassociated, "DATA : Process same-event correlations for TPC-MFT Lc-h case reassociated", false); + // ===================================== + // DATA : process same event correlations: TPC-FV0A Ch. Part. - Ch. Part + // ===================================== + + void processSameTpcFv0aChCh(FilteredCollisionsWSelMult::iterator const& collision, + FilteredTracksWDcaSel const& tracks, + aod::FV0As const&) + { + if (!(isAcceptedCollision(collision, true))) { + return; + } + + const auto multiplicity = collision.multNTracksPV(); + + if (collision.has_foundFV0()) { + const auto& fv0 = collision.foundFV0(); + + sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelationsFV0(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, fv0, multiplicity, collision.posZ(), true); + } + } + PROCESS_SWITCH(HfTaskFlow, processSameTpcFv0aChCh, "DATA : Process same-event correlations for TPC-FV0-A h-h case", false); + + // ===================================== + // DATA : process same event correlations: TPC-FV0A D0 - Ch. Part + // ===================================== + + void processSameTpcFv0aD0Ch(FilteredCollisionsWSelMult::iterator const& collision, + HfCandidatesSelD0 const& candidates, + aod::FV0As const&) + { + if (!(isAcceptedCollision(collision, true))) { + return; + } + + const auto multiplicity = collision.multNTracksPV(); + + if (collision.has_foundFV0()) { + const auto& fv0 = collision.foundFV0(); + + sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelationsFV0(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, fv0, multiplicity, collision.posZ(), true); + } + } + PROCESS_SWITCH(HfTaskFlow, processSameTpcFv0aD0Ch, "DATA : Process same-event correlations for TPC-FV0-A D0-h case", false); + + // ===================================== + // DATA : process same event correlations: TPC-FV0A Lc - Ch. Part + // ===================================== + + void processSameTpcFv0aLcCh(FilteredCollisionsWSelMult::iterator const& collision, + HfCandidatesSelLc const& candidates, + aod::FV0As const&) + { + if (!(isAcceptedCollision(collision, true))) { + return; + } + + const auto multiplicity = collision.multNTracksPV(); + + if (collision.has_foundFV0()) { + const auto& fv0 = collision.foundFV0(); + + sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelationsFV0(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, fv0, multiplicity, collision.posZ(), true); + } + } + PROCESS_SWITCH(HfTaskFlow, processSameTpcFv0aLcCh, "DATA : Process same-event correlations for TPC-FV0-A Lc-h case", false); + + // ===================================== + // DATA : process same event correlations: MFT-FV0A Ch. Part. - Ch. Part + // ===================================== + + void processSameMftFv0aChCh(FilteredCollisionsWSelMult::iterator const& collision, + aod::MFTTracks const& mftTracks, + aod::FV0As const&) + { + if (!(isAcceptedCollision(collision, true))) { + return; + } + + const auto multiplicity = collision.multNTracksPV(); + + if (collision.has_foundFV0()) { + const auto& fv0 = collision.foundFV0(); + + sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelationsFV0(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, mftTracks, fv0, multiplicity, collision.posZ(), true); + } + } + PROCESS_SWITCH(HfTaskFlow, processSameMftFv0aChCh, "DATA : Process same-event correlations for MFT-FV0-A h-h case", false); + + void processSameMftFv0aChChReassociated(FilteredCollisionsWSelMult::iterator const& collision, + soa::SmallGroups const& reassociatedMftTracks, + aod::MFTTracks const& /*mftTracks*/, + aod::FV0As const&) + { + if (!(isAcceptedCollision(collision, true))) { + return; + } + + const auto multiplicity = collision.multNTracksPV(); + + if (collision.has_foundFV0()) { + const auto& fv0 = collision.foundFV0(); + + sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelationsFV0ReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, reassociatedMftTracks, fv0, multiplicity, collision.posZ(), true, false); + } + } + PROCESS_SWITCH(HfTaskFlow, processSameMftFv0aChChReassociated, "DATA : Process same-event correlations for MFT-FV0a h-h case reassociated", false); + + void processSameMftFv0aChChNonAmbiguous(FilteredCollisionsWSelMult::iterator const& collision, + soa::SmallGroups const& reassociatedMftTracks, + aod::MFTTracks const& /*mftTracks*/, + aod::FV0As const&) + { + if (!(isAcceptedCollision(collision, true))) { + return; + } + + const auto multiplicity = collision.multNTracksPV(); + + if (collision.has_foundFV0()) { + const auto& fv0 = collision.foundFV0(); + + sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelationsFV0ReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, reassociatedMftTracks, fv0, multiplicity, collision.posZ(), true, true); + } + } + PROCESS_SWITCH(HfTaskFlow, processSameMftFv0aChChNonAmbiguous, "DATA : Process same-event correlations for MFT-FV0a h-h non-ambiguous case", false); + // =================================================================================================================================================================================================================================================================== // MONTE-CARLO // =================================================================================================================================================================================================================================================================== @@ -1961,6 +2336,165 @@ struct HfTaskFlow { } PROCESS_SWITCH(HfTaskFlow, processMixedTpcMftLcCh, "DATA : Process mixed-event correlations for TPC-MFT Lc-h case", false); + // ===================================== + // DATA : process mixed event correlations: TPC-FV0-A ch part. - ch. part. case + // ===================================== + + void processMixedTpcFv0aChCh(FilteredCollisionsWSelMult const& collisions, + FilteredTracksWDcaSel const& tracks, + aod::FV0As const&) + { + auto getMultiplicity = [](FilteredCollisionsWSelMult::iterator const& collision) { + auto multiplicity = collision.numContrib(); + return multiplicity; + }; + + using MixedBinning = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getMultiplicity)>; + MixedBinning binningOnVtxAndMult{{getMultiplicity}, {binsMixingVertex, binsMixingMultiplicity}, true}; + + for (auto const& [collision1, collision2] : soa::selfCombinations(binningOnVtxAndMult, nMixedEvents, -1, collisions, collisions)) { + + if (!isAcceptedCollision(collision1) || !isAcceptedCollision(collision2)) { + continue; + } + + if (collision1.globalIndex() == collision2.globalIndex()) { + continue; + } + + if (collision1.has_foundFV0() && collision2.has_foundFV0()) { + + const auto multiplicity = getMultiplicity(collision1); + + auto slicedTriggerTracks = tracks.sliceBy(perColTracks, collision1.globalIndex()); + const auto& fv0 = collision2.foundFV0(); + + mixedEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelationsFV0(mixedEvent, CorrelationContainer::CFStep::kCFStepReconstructed, slicedTriggerTracks, fv0, multiplicity, collision1.posZ(), false); + } + } + } + PROCESS_SWITCH(HfTaskFlow, processMixedTpcFv0aChCh, "DATA : Process mixed-event correlations for TPC-FV0-A h-h case", false); + + // ===================================== + // DATA : process mixed event correlations: TPC-FV0-A D0 - ch. part. case + // ===================================== + + void processMixedTpcFv0aD0Ch(FilteredCollisionsWSelMult const& collisions, + HfCandidatesSelD0 const& candidates, + aod::FV0As const&) + { + auto getMultiplicity = [](FilteredCollisionsWSelMult::iterator const& collision) { + auto multiplicity = collision.numContrib(); + return multiplicity; + }; + + using MixedBinning = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getMultiplicity)>; + MixedBinning binningOnVtxAndMult{{getMultiplicity}, {binsMixingVertex, binsMixingMultiplicity}, true}; + + for (auto const& [collision1, collision2] : soa::selfCombinations(binningOnVtxAndMult, nMixedEvents, -1, collisions, collisions)) { + + if (!isAcceptedCollision(collision1) || !isAcceptedCollision(collision2)) { + continue; + } + + if (collision1.globalIndex() == collision2.globalIndex()) { + continue; + } + + if (collision1.has_foundFV0() && collision2.has_foundFV0()) { + + const auto multiplicity = getMultiplicity(collision1); + + auto slicedTriggerCandidates = candidates.sliceBy(perColD0s, collision1.globalIndex()); + const auto& fv0 = collision2.foundFV0(); + + mixedEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelationsFV0(mixedEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, slicedTriggerCandidates, fv0, multiplicity, collision1.posZ(), false); + } + } + } + PROCESS_SWITCH(HfTaskFlow, processMixedTpcFv0aD0Ch, "DATA : Process mixed-event correlations for TPC-FV0-A D0-h case", false); + + // ===================================== + // DATA : process mixed event correlations: TPC-FV0-A Lc - ch. part. case + // ===================================== + + void processMixedTpcFv0aLcCh(FilteredCollisionsWSelMult const& collisions, + HfCandidatesSelLc const& candidates, + aod::FV0As const&) + { + auto getMultiplicity = [](FilteredCollisionsWSelMult::iterator const& collision) { + auto multiplicity = collision.numContrib(); + return multiplicity; + }; + + using MixedBinning = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getMultiplicity)>; + MixedBinning binningOnVtxAndMult{{getMultiplicity}, {binsMixingVertex, binsMixingMultiplicity}, true}; + + for (auto const& [collision1, collision2] : soa::selfCombinations(binningOnVtxAndMult, nMixedEvents, -1, collisions, collisions)) { + + if (!isAcceptedCollision(collision1) || !isAcceptedCollision(collision2)) { + continue; + } + + if (collision1.globalIndex() == collision2.globalIndex()) { + continue; + } + + if (collision1.has_foundFV0() && collision2.has_foundFV0()) { + + const auto multiplicity = getMultiplicity(collision1); + + auto slicedTriggerCandidates = candidates.sliceBy(perColLcs, collision1.globalIndex()); + const auto& fv0 = collision2.foundFV0(); + + mixedEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelationsFV0(mixedEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, slicedTriggerCandidates, fv0, multiplicity, collision1.posZ(), false); + } + } + } + PROCESS_SWITCH(HfTaskFlow, processMixedTpcFv0aLcCh, "DATA : Process mixed-event correlations for TPC-FV0-A Lc-h case", false); + + // ===================================== + // DATA : process mixed event correlations: TPC-FV0-A ch part. - ch. part. case + // ===================================== + + void processMixedMftFv0aChCh(FilteredCollisionsWSelMult const& collisions, + aod::MFTTracks const& mftTracks, + aod::FV0As const&) + { + auto getMultiplicity = [](FilteredCollisionsWSelMult::iterator const& collision) { + auto multiplicity = collision.numContrib(); + return multiplicity; + }; + + using MixedBinning = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getMultiplicity)>; + MixedBinning binningOnVtxAndMult{{getMultiplicity}, {binsMixingVertex, binsMixingMultiplicity}, true}; + + for (auto const& [collision1, collision2] : soa::selfCombinations(binningOnVtxAndMult, nMixedEvents, -1, collisions, collisions)) { + + if (!isAcceptedCollision(collision1) || !isAcceptedCollision(collision2)) { + continue; + } + + if (collision1.globalIndex() == collision2.globalIndex()) { + continue; + } + + if (collision1.has_foundFV0() && collision2.has_foundFV0()) { + + const auto multiplicity = getMultiplicity(collision1); + auto slicedTriggerMftTracks = mftTracks.sliceBy(perColMftTracks, collision1.globalIndex()); + const auto& fv0 = collision2.foundFV0(); + + mixedEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelationsFV0(mixedEvent, CorrelationContainer::CFStep::kCFStepReconstructed, slicedTriggerMftTracks, fv0, multiplicity, collision1.posZ(), false); + } + } + } + PROCESS_SWITCH(HfTaskFlow, processMixedMftFv0aChCh, "DATA : Process mixed-event correlations for Mft-FV0-A h-h case", false); + // =================================================================================================================================================================================================================================================================== // MONTE-CARLO // =================================================================================================================================================================================================================================================================== From 022eca806b99dad02c4b25cf1a888ea7614903ca Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 5 Sep 2025 17:44:26 +0200 Subject: [PATCH 326/986] [PWGEM/PhotonMeson] update TaggingPi0 (#12882) --- PWGEM/PhotonMeson/Core/TaggingPi0.h | 61 ++++++++++++++++----- PWGEM/PhotonMeson/Core/TaggingPi0MC.h | 77 +++++++++++++++++++-------- 2 files changed, 103 insertions(+), 35 deletions(-) diff --git a/PWGEM/PhotonMeson/Core/TaggingPi0.h b/PWGEM/PhotonMeson/Core/TaggingPi0.h index 5f37d60d277..986a79b34bd 100644 --- a/PWGEM/PhotonMeson/Core/TaggingPi0.h +++ b/PWGEM/PhotonMeson/Core/TaggingPi0.h @@ -64,9 +64,12 @@ using namespace o2::aod::pwgem::photon; using namespace o2::aod::pwgem::dilepton::utils::emtrackutil; using namespace o2::aod::pwgem::dilepton::utils; -using MyCollisions = soa::Join; +using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; +using MyCollisionsWithJJMC = soa::Join; +using MyCollisionWithJJMC = MyCollisionsWithJJMC::iterator; + using MyV0Photons = soa::Join; using MyV0Photon = MyV0Photons::iterator; @@ -465,7 +468,12 @@ struct TaggingPi0 { initCCDB(collision); int ndiphoton = 0; - if (eventcuts.onlyKeepWeightedEvents && std::fabs(collision.weight() - 1.f) < 1e-10) { + float weight = 1.f; + if constexpr (std::is_same_v, FilteredMyCollisionsWithJJMC>) { + weight = collision.weight(); + } + + if (eventcuts.onlyKeepWeightedEvents && std::fabs(weight - 1.f) < 1e-10) { continue; } @@ -474,13 +482,13 @@ struct TaggingPi0 { continue; } - o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<0>(&fRegistry, collision, collision.weight()); + o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<0>(&fRegistry, collision, weight); if (!fEMEventCut.IsSelected(collision)) { continue; } - o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<1>(&fRegistry, collision, collision.weight()); - fRegistry.fill(HIST("Event/before/hCollisionCounter"), 12.0, collision.weight()); // accepted - fRegistry.fill(HIST("Event/after/hCollisionCounter"), 12.0, collision.weight()); // accepted + o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<1>(&fRegistry, collision, weight); + fRegistry.fill(HIST("Event/before/hCollisionCounter"), 12.0, weight); // accepted + fRegistry.fill(HIST("Event/after/hCollisionCounter"), 12.0, weight); // accepted int zbin = lower_bound(zvtx_bin_edges.begin(), zvtx_bin_edges.end(), collision.posZ()) - zvtx_bin_edges.begin() - 1; if (zbin < 0) { @@ -537,8 +545,8 @@ struct TaggingPi0 { auto pos1 = g1.template posTrack_as(); auto ele1 = g1.template negTrack_as(); ROOT::Math::PtEtaPhiMVector v_gamma(g1.pt(), g1.eta(), g1.phi(), 0.); - fRegistry.fill(HIST("Photon/hPt"), v_gamma.Pt(), collision.weight()); - fRegistry.fill(HIST("Photon/hEtaPhi"), v_gamma.Phi() > 0 ? v_gamma.Phi() : v_gamma.Phi() + 2 * M_PI, v_gamma.Eta(), collision.weight()); + fRegistry.fill(HIST("Photon/hPt"), v_gamma.Pt(), weight); + fRegistry.fill(HIST("Photon/hEtaPhi"), v_gamma.Phi() > 0 ? v_gamma.Phi() : v_gamma.Phi() + 2 * M_PI, v_gamma.Eta(), weight); for (const auto& [pos2, ele2] : combinations(CombinationsFullIndexPolicy(positrons_per_collision, electrons_per_collision))) { @@ -561,7 +569,7 @@ struct TaggingPi0 { ROOT::Math::PtEtaPhiMVector v_ele(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron); ROOT::Math::PtEtaPhiMVector v_ee = v_pos + v_ele; ROOT::Math::PtEtaPhiMVector veeg = v_gamma + v_pos + v_ele; - fRegistry.fill(HIST("Pair/same/hMvsPt"), veeg.M(), v_gamma.Pt(), collision.weight()); + fRegistry.fill(HIST("Pair/same/hMvsPt"), veeg.M(), v_gamma.Pt(), weight); std::pair pair_tmp_id1 = std::make_pair(ndf, g1.globalIndex()); std::tuple tuple_tmp_id2 = std::make_tuple(ndf, collision.globalIndex(), pos2.trackId(), ele2.trackId()); @@ -588,7 +596,7 @@ struct TaggingPi0 { ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - fRegistry.fill(HIST("Pair/same/hMvsPt"), v12.M(), v1.Pt(), collision.weight()); + fRegistry.fill(HIST("Pair/same/hMvsPt"), v12.M(), v1.Pt(), weight); std::pair pair_tmp_id1 = std::make_pair(ndf, g1.globalIndex()); std::pair pair_tmp_id2 = std::make_pair(ndf, g2.globalIndex()); @@ -643,7 +651,7 @@ struct TaggingPi0 { v2.SetM(g2.mass()); } ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - fRegistry.fill(HIST("Pair/mix/hMvsPt"), v12.M(), v1.Pt(), collision.weight()); + fRegistry.fill(HIST("Pair/mix/hMvsPt"), v12.M(), v1.Pt(), weight); } } } // end of loop over mixed event pool @@ -687,9 +695,36 @@ struct TaggingPi0 { // } ndf++; } - PROCESS_SWITCH(TaggingPi0, processAnalysis, "process pair analysis", false); + PROCESS_SWITCH(TaggingPi0, processAnalysis, "process pair analysis", true); + + using FilteredMyCollisionsWithJJMC = soa::Filtered; + void processAnalysisJJMC(FilteredMyCollisionsWithJJMC const& collisions, Types const&... args) + { + // LOGF(info, "ndf = %d", ndf); + if constexpr (pairtype == PairType::kPCMDalitzEE) { + auto v0photons = std::get<0>(std::tie(args...)); + auto v0legs = std::get<1>(std::tie(args...)); + auto emprimaryelectrons = std::get<2>(std::tie(args...)); + // LOGF(info, "electrons.size() = %d, positrons.size() = %d", electrons.size(), positrons.size()); + runPairing(collisions, v0photons, emprimaryelectrons, v0legs, emprimaryelectrons, perCollision_pcm, perCollision_electron, fV0PhotonCut, fDileptonCut); + } + // else if constexpr (pairtype == PairType::kPCMEMC) { + // auto v0photons = std::get<0>(std::tie(args...)); + // auto v0legs = std::get<1>(std::tie(args...)); + // auto emcclusters = std::get<2>(std::tie(args...)); + // auto emcmatchedtracks = std::get<3>(std::tie(args...)); + // runPairing(collisions, v0photons, emcclusters, v0legs, nullptr, perCollision_pcm, perCollision_emc, fV0PhotonCut, fEMCCut, emcmatchedtracks, nullptr); + // } else if constexpr (pairtype == PairType::kPCMPHOS) { + // auto v0photons = std::get<0>(std::tie(args...)); + // auto v0legs = std::get<1>(std::tie(args...)); + // auto phosclusters = std::get<2>(std::tie(args...)); + // runPairing(collisions, v0photons, phosclusters, v0legs, nullptr, perCollision_pcm, perCollision_phos, fV0PhotonCut, fPHOSCut, nullptr, nullptr); + // } + ndf++; + } + PROCESS_SWITCH(TaggingPi0, processAnalysisJJMC, "process pair analysis", false); void processDummy(MyCollisions const&) {} - PROCESS_SWITCH(TaggingPi0, processDummy, "Dummy function", true); + PROCESS_SWITCH(TaggingPi0, processDummy, "Dummy function", false); }; #endif // PWGEM_PHOTONMESON_CORE_TAGGINGPI0_H_ diff --git a/PWGEM/PhotonMeson/Core/TaggingPi0MC.h b/PWGEM/PhotonMeson/Core/TaggingPi0MC.h index faf777d0185..a8d325426b7 100644 --- a/PWGEM/PhotonMeson/Core/TaggingPi0MC.h +++ b/PWGEM/PhotonMeson/Core/TaggingPi0MC.h @@ -56,9 +56,12 @@ using namespace o2::aod::pwgem::photonmeson::photonpair; using namespace o2::aod::pwgem::photonmeson::utils::mcutil; using namespace o2::aod::pwgem::dilepton::utils::mcutil; -using MyCollisions = soa::Join; +using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; +using MyCollisionsWithJJMC = soa::Join; +using MyCollisionWithJJMC = MyCollisionsWithJJMC::iterator; + using MyMCCollisions = soa::Join; using MyMCCollision = MyMCCollisions::iterator; @@ -429,7 +432,12 @@ struct TaggingPi0MC { for (const auto& collision : collisions) { initCCDB(collision); - if (eventcuts.onlyKeepWeightedEvents && std::fabs(collision.weight() - 1.f) < 1e-10) { + float weight = 1.f; + if constexpr (std::is_same_v, FilteredMyCollisionsWithJJMC>) { + weight = collision.weight(); + } + + if (eventcuts.onlyKeepWeightedEvents && std::fabs(weight - 1.f) < 1e-10) { continue; } @@ -438,13 +446,13 @@ struct TaggingPi0MC { continue; } - o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<0>(&fRegistry, collision, collision.weight()); + o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<0>(&fRegistry, collision, weight); if (!fEMEventCut.IsSelected(collision)) { continue; } - o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<1>(&fRegistry, collision, collision.weight()); - fRegistry.fill(HIST("Event/before/hCollisionCounter"), 12.0, collision.weight()); // accepted - fRegistry.fill(HIST("Event/after/hCollisionCounter"), 12.0, collision.weight()); // accepted + o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<1>(&fRegistry, collision, weight); + fRegistry.fill(HIST("Event/before/hCollisionCounter"), 12.0, weight); // accepted + fRegistry.fill(HIST("Event/after/hCollisionCounter"), 12.0, weight); // accepted if constexpr (pairtype == PairType::kPCMDalitzEE) { auto photons1_per_collision = photons1.sliceBy(perCollision1, collision.globalIndex()); @@ -457,8 +465,8 @@ struct TaggingPi0MC { } ROOT::Math::PtEtaPhiMVector v_gamma(g1.pt(), g1.eta(), g1.phi(), 0.f); - fRegistry.fill(HIST("Photon/candidate/hPt"), v_gamma.Pt(), collision.weight()); - fRegistry.fill(HIST("Photon/candidate/hEtaPhi"), v_gamma.Phi() > 0 ? v_gamma.Phi() : v_gamma.Phi() + 2 * M_PI, v_gamma.Eta(), collision.weight()); + fRegistry.fill(HIST("Photon/candidate/hPt"), v_gamma.Pt(), weight); + fRegistry.fill(HIST("Photon/candidate/hEtaPhi"), v_gamma.Phi() > 0 ? v_gamma.Phi() : v_gamma.Phi() + 2 * M_PI, v_gamma.Eta(), weight); auto pos1 = g1.template posTrack_as(); auto ele1 = g1.template negTrack_as(); @@ -475,13 +483,13 @@ struct TaggingPi0MC { } if (g1mc.isPhysicalPrimary() || g1mc.producedByGenerator()) { - fRegistry.fill(HIST("Photon/primary/hPt"), v_gamma.Pt(), collision.weight()); - fRegistry.fill(HIST("Photon/primary/hEtaPhi"), v_gamma.Phi() > 0 ? v_gamma.Phi() : v_gamma.Phi() + 2 * M_PI, v_gamma.Eta(), collision.weight()); + fRegistry.fill(HIST("Photon/primary/hPt"), v_gamma.Pt(), weight); + fRegistry.fill(HIST("Photon/primary/hEtaPhi"), v_gamma.Phi() > 0 ? v_gamma.Phi() : v_gamma.Phi() + 2 * M_PI, v_gamma.Eta(), weight); if (g1mc.has_mothers()) { auto mp = g1mc.template mothers_first_as(); if (std::abs(mp.pdgCode()) == 111) { - fRegistry.fill(HIST("Photon/fromPi0/hPt"), v_gamma.Pt(), collision.weight()); - fRegistry.fill(HIST("Photon/fromPi0/hEtaPhi"), v_gamma.Phi() > 0 ? v_gamma.Phi() : v_gamma.Phi() + 2 * M_PI, v_gamma.Eta(), collision.weight()); + fRegistry.fill(HIST("Photon/fromPi0/hPt"), v_gamma.Pt(), weight); + fRegistry.fill(HIST("Photon/fromPi0/hEtaPhi"), v_gamma.Phi() > 0 ? v_gamma.Phi() : v_gamma.Phi() + 2 * M_PI, v_gamma.Eta(), weight); } } } else if (IsFromWD(g1mc.template emmcevent_as(), g1mc, mcparticles) > 0) { @@ -491,11 +499,11 @@ struct TaggingPi0MC { if (std::abs(str_had.pdgCode()) == 310 && f1fd_k0s_to_pi0 != nullptr) { weight = f1fd_k0s_to_pi0->Eval(str_had.pt()); } - fRegistry.fill(HIST("Photon/fromWD/hPt"), v_gamma.Pt(), collision.weight() * weight); - fRegistry.fill(HIST("Photon/fromWD/hEtaPhi"), v_gamma.Phi() > 0 ? v_gamma.Phi() : v_gamma.Phi() + 2 * M_PI, v_gamma.Eta(), collision.weight() * weight); + fRegistry.fill(HIST("Photon/fromWD/hPt"), v_gamma.Pt(), weight * weight); + fRegistry.fill(HIST("Photon/fromWD/hEtaPhi"), v_gamma.Phi() > 0 ? v_gamma.Phi() : v_gamma.Phi() + 2 * M_PI, v_gamma.Eta(), weight * weight); } else { - fRegistry.fill(HIST("Photon/fromHS/hPt"), v_gamma.Pt(), collision.weight()); - fRegistry.fill(HIST("Photon/fromHS/hEtaPhi"), v_gamma.Phi() > 0 ? v_gamma.Phi() : v_gamma.Phi() + 2 * M_PI, v_gamma.Eta(), collision.weight()); + fRegistry.fill(HIST("Photon/fromHS/hPt"), v_gamma.Pt(), weight); + fRegistry.fill(HIST("Photon/fromHS/hEtaPhi"), v_gamma.Phi() > 0 ? v_gamma.Phi() : v_gamma.Phi() + 2 * M_PI, v_gamma.Eta(), weight); } for (const auto& [pos2, ele2] : combinations(CombinationsFullIndexPolicy(positrons_per_collision, electrons_per_collision))) { // ULS @@ -529,7 +537,7 @@ struct TaggingPi0MC { ROOT::Math::PtEtaPhiMVector veeg = v_gamma + v_pos + v_ele; if (pi0mc.isPhysicalPrimary() || pi0mc.producedByGenerator()) { - fRegistry.fill(HIST("Pair/primary/hMvsPt"), veeg.M(), v_gamma.Pt(), collision.weight()); + fRegistry.fill(HIST("Pair/primary/hMvsPt"), veeg.M(), v_gamma.Pt(), weight); } else if (IsFromWD(pi0mc.template emmcevent_as(), pi0mc, mcparticles) > 0) { int motherid_strhad = IsFromWD(pi0mc.template emmcevent_as(), pi0mc, mcparticles); auto str_had = mcparticles.iteratorAt(motherid_strhad); @@ -537,9 +545,9 @@ struct TaggingPi0MC { if (std::abs(str_had.pdgCode()) == 310 && f1fd_k0s_to_pi0 != nullptr) { weight = f1fd_k0s_to_pi0->Eval(str_had.pt()); } - fRegistry.fill(HIST("Pair/fromWD/hMvsPt"), veeg.M(), v_gamma.Pt(), collision.weight() * weight); + fRegistry.fill(HIST("Pair/fromWD/hMvsPt"), veeg.M(), v_gamma.Pt(), weight * weight); } else { - fRegistry.fill(HIST("Pair/fromHS/hMvsPt"), veeg.M(), v_gamma.Pt(), collision.weight()); + fRegistry.fill(HIST("Pair/fromHS/hMvsPt"), veeg.M(), v_gamma.Pt(), weight); } } // end of dielectron loop @@ -557,7 +565,7 @@ struct TaggingPi0MC { // ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; // if (pi0id > 0) { // auto pi0mc = mcparticles.iteratorAt(pi0id); - // o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, pi0mc, mcparticles, mccollisions, f1fd_k0s_to_pi0, collision.weight()); + // o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, pi0mc, mcparticles, mccollisions, f1fd_k0s_to_pi0, weight); // } } // end of pairing loop } // end of pairing in same event @@ -591,9 +599,34 @@ struct TaggingPi0MC { // runPairing(collisions, v0photons, phosclusters, v0legs, nullptr, perCollision_pcm, perCollision_phos, fV0PhotonCut, fPHOSCut, nullptr, nullptr); // } } - PROCESS_SWITCH(TaggingPi0MC, processAnalysis, "process pair analysis", false); + PROCESS_SWITCH(TaggingPi0MC, processAnalysis, "process pair analysis", true); + + using FilteredMyCollisionsWithJJMC = soa::Filtered; + void processAnalysisJJMC(FilteredMyCollisionsWithJJMC const& collisions, MyMCCollisions const& mccollisions, aod::EMMCParticles const& mcparticles, Types const&... args) + { + if constexpr (pairtype == PairType::kPCMDalitzEE) { + auto v0photons = std::get<0>(std::tie(args...)); + auto v0legs = std::get<1>(std::tie(args...)); + auto emprimaryelectrons = std::get<2>(std::tie(args...)); + // LOGF(info, "electrons.size() = %d, positrons.size() = %d", electrons.size(), positrons.size()); + runTruePairing(collisions, v0photons, emprimaryelectrons, v0legs, emprimaryelectrons, perCollision_pcm, perCollision_electron, fV0PhotonCut, fDileptonCut, mccollisions, mcparticles); + } + // else if constexpr (pairtype == PairType::kPCMEMC) { + // auto v0photons = std::get<0>(std::tie(args...)); + // auto v0legs = std::get<1>(std::tie(args...)); + // auto emcclusters = std::get<2>(std::tie(args...)); + // auto emcmatchedtracks = std::get<3>(std::tie(args...)); + // runPairing(collisions, v0photons, emcclusters, v0legs, nullptr, perCollision_pcm, perCollision_emc, fV0PhotonCut, fEMCCut, emcmatchedtracks, nullptr); + // } else if constexpr (pairtype == PairType::kPCMPHOS) { + // auto v0photons = std::get<0>(std::tie(args...)); + // auto v0legs = std::get<1>(std::tie(args...)); + // auto phosclusters = std::get<2>(std::tie(args...)); + // runPairing(collisions, v0photons, phosclusters, v0legs, nullptr, perCollision_pcm, perCollision_phos, fV0PhotonCut, fPHOSCut, nullptr, nullptr); + // } + } + PROCESS_SWITCH(TaggingPi0MC, processAnalysisJJMC, "process pair analysis", false); void processDummy(MyCollisions const&) {} - PROCESS_SWITCH(TaggingPi0MC, processDummy, "Dummy function", true); + PROCESS_SWITCH(TaggingPi0MC, processDummy, "Dummy function", false); }; #endif // PWGEM_PHOTONMESON_CORE_TAGGINGPI0MC_H_ From a21d449646deb4bb4cbdc86a4f0ee345d80b2423 Mon Sep 17 00:00:00 2001 From: Marvin Hemmer <53471402+mhemmer-cern@users.noreply.github.com> Date: Fri, 5 Sep 2025 18:01:03 +0200 Subject: [PATCH 327/986] [PWGJE] EMCALQAtask: Add position difference histogram (#12878) --- PWGJE/Tasks/taskEmcExtensiveMcQa.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/PWGJE/Tasks/taskEmcExtensiveMcQa.cxx b/PWGJE/Tasks/taskEmcExtensiveMcQa.cxx index 7bd1e5c53fd..f9845724101 100644 --- a/PWGJE/Tasks/taskEmcExtensiveMcQa.cxx +++ b/PWGJE/Tasks/taskEmcExtensiveMcQa.cxx @@ -105,6 +105,8 @@ struct TaskEmcExtensiveMcQa { ConfigurableAxis clusterNContributor{"clusterNContributor", {20, 0.5, 20.5}, "binning for the number of contributor of a cluster"}; ConfigurableAxis clusterEnergyRatio{"clusterEnergyRatio", {100, 0., 10.}, "binning for ratio of the deposited energy of the leading particle to its generated momentum cluster"}; ConfigurableAxis collisionCent{"collisionCent", {10, 0., 100.}, "binning for the event centrality"}; + ConfigurableAxis clusterEtaReso{"clusterEtaReso", {100, -0.1, 0.1}, "binning for cluster position resolution in eta"}; + ConfigurableAxis clusterPhiReso{"clusterPhiReso", {100, -0.1, 0.1}, "binning for cluster position resolution in phi"}; std::vector mCellTime; @@ -127,6 +129,10 @@ struct TaskEmcExtensiveMcQa { const AxisSpec axisLeadingEnergy{clusterEnergy, "#it{E}_{lead} (GeV)"}; const AxisSpec axisLeadingGenMomentum{clusterEnergy, "#it{p}_{lead, gen} (GeV/#it{c})"}; const AxisSpec axisLeadingRatio{clusterEnergy, "#it{E}_{lead}/#it{p}_{lead, gen} (#it{c})"}; + const AxisSpec axisEtaReso{clusterEtaReso, "#Delta#eta"}; + const AxisSpec axisPhiReso{clusterPhiReso, "#Delta#varphi (rad)"}; + + const AxisSpec axisSM{{20, -0.5, 19.5}, "SM"}; // create histograms @@ -138,6 +144,8 @@ struct TaskEmcExtensiveMcQa { mHistManager.add("hSparseClusterContributors", "THnSparse with cluster contributors and energies", HistType::kTHnSparseF, {axisEnergy, axisParticle, axisNContributor, axisLeadingEnergy, axisLeadingGenMomentum, axisLeadingRatio, axisCent}); mHistManager.add("clusterEtaPhi", "Eta and phi of cluster", HistType::kTH2F, {{140, -0.7, 0.7}, {360, 0, o2::constants::math::TwoPI}}); + mHistManager.add("hSparsePosReso", "THnSparse for cluster position resolution", HistType::kTHnSparseF, {axisEnergy, axisEtaReso, axisPhiReso, axisNCell, axisSM, axisParticle, axisNContributor, axisCent}); + hfEvSel.addHistograms(mHistManager); ccdb->setURL(ccdbUrl); @@ -213,8 +221,12 @@ struct TaskEmcExtensiveMcQa { float momentum = mainMcParticle.p(); float leadingEnergy = cluster.energy() * cluster.amplitudeA()[0]; float leadingFraction = leadingEnergy / momentum; + float dEta = cluster.eta() - mainMcParticle.eta(); + float dPhi = cluster.phi() - mainMcParticle.phi(); + int iSM = mGeometry->SuperModuleNumberFromEtaPhi(cluster.eta(), cluster.phi()); mHistManager.fill(HIST("hSparseClusterQA"), cluster.energy(), cluster.m02(), cluster.m20(), cluster.nCells(), radius, findPoIType(mainMcParticle), cluster.mcParticle().size(), cent); mHistManager.fill(HIST("hSparseClusterContributors"), cluster.energy(), findPoIType(mainMcParticle), cluster.mcParticle().size(), leadingEnergy, momentum, leadingFraction, cent); + mHistManager.fill(HIST("hSparsePosReso"), cluster.energy(), dEta, dPhi, cluster.nCells(), iSM, findPoIType(mainMcParticle), cluster.mcParticle().size(), cent); } } } From 3e3a9af0eaa89f5c2393d1e4e0e04452e240aedd Mon Sep 17 00:00:00 2001 From: prottayCMT <61418725+prottayCMT@users.noreply.github.com> Date: Fri, 5 Sep 2025 19:20:56 +0200 Subject: [PATCH 328/986] [PWGCF] updating PID sel for phi v2 (#12870) Co-authored-by: Prottay Das --- PWGCF/DataModel/CorrelationsDerived.h | 4 +- PWGCF/TableProducer/filter2Prong.cxx | 98 +++++++++++++++++++++++++-- PWGCF/Tasks/correlations.cxx | 13 ++-- 3 files changed, 102 insertions(+), 13 deletions(-) diff --git a/PWGCF/DataModel/CorrelationsDerived.h b/PWGCF/DataModel/CorrelationsDerived.h index 9be8ac7d58e..9fd636f9924 100644 --- a/PWGCF/DataModel/CorrelationsDerived.h +++ b/PWGCF/DataModel/CorrelationsDerived.h @@ -140,7 +140,9 @@ enum ParticleDecay { JPsiToEE, JPsiToMuMu, Generic2Prong, - PhiToKK, + PhiToKKPID1, + PhiToKKPID2, + PhiToKKPID3, K0stoPiPi, LambdatoPPi, AntiLambdatoPiP diff --git a/PWGCF/TableProducer/filter2Prong.cxx b/PWGCF/TableProducer/filter2Prong.cxx index 00f7bb58827..3dc4937b74a 100644 --- a/PWGCF/TableProducer/filter2Prong.cxx +++ b/PWGCF/TableProducer/filter2Prong.cxx @@ -102,6 +102,7 @@ struct Filter2Prong { O2_DEFINE_CONFIGURABLE(cutTOFBeta, float, 0.5, "TOF beta"); O2_DEFINE_CONFIGURABLE(confFakeKaonCut, float, 0.15, "Cut based on track from momentum difference"); O2_DEFINE_CONFIGURABLE(removefaketrack, bool, true, "Flag to remove fake kaon"); + O2_DEFINE_CONFIGURABLE(applyTOF, bool, false, "Flag for applying TOF"); } grpPhi; HfHelper hfHelper; @@ -432,6 +433,79 @@ struct Filter2Prong { return false; } + template + bool selectionPID2(const T& candidate) + { + double nsigmaTPC = candidate.tpcNSigmaKa(); + double nsigmaTOF = candidate.tofNSigmaKa(); + + if (grpPhi.applyTOF) { + if (!candidate.hasTOF() && TMath::Abs(nsigmaTPC) < grpPhi.nsigmaCutTPC) { + return true; + } + if (candidate.p() > 0.5 && candidate.hasTOF() && TMath::Abs(nsigmaTPC) < grpPhi.nsigmaCutTPC) { + if (candidate.p() > 0.5 && candidate.p() < 1.6 && candidate.beta() > grpPhi.cutTOFBeta && nsigmaTOF > -5.0 && nsigmaTOF < 10.0) { + return true; + } + if (candidate.p() >= 1.6 && candidate.p() < 2.0 && candidate.beta() > grpPhi.cutTOFBeta && nsigmaTOF > -3.0 && nsigmaTOF < 10.0) { + return true; + } + if (candidate.p() >= 2.0 && candidate.p() < 2.5 && candidate.beta() > grpPhi.cutTOFBeta && nsigmaTOF > -3.0 && nsigmaTOF < 6.0) { + return true; + } + if (candidate.p() >= 2.5 && candidate.p() < 4.0 && candidate.beta() > grpPhi.cutTOFBeta && nsigmaTOF > -2.5 && nsigmaTOF < 4.0) { + return true; + } + if (candidate.p() >= 4.0 && candidate.p() < 5.0 && candidate.beta() > grpPhi.cutTOFBeta && nsigmaTOF > -4.0 && nsigmaTOF < 3.0) { + return true; + } + if (candidate.p() >= 5.0 && candidate.p() < 6.0 && candidate.beta() > grpPhi.cutTOFBeta && nsigmaTOF > -4.0 && nsigmaTOF < 2.5) { + return true; + } + if (candidate.p() >= 6.0 && candidate.beta() > grpPhi.cutTOFBeta && nsigmaTOF > -3.0 && nsigmaTOF < 3.0) { + return true; + } + } + } else if (TMath::Abs(nsigmaTPC) < grpPhi.nsigmaCutTPC) { + return true; + } + return false; + } + + template + bool selectionPID3(const T& candidate) + { + double nsigmaTPC = candidate.tpcNSigmaKa(); + double nsigmaTOF = candidate.tofNSigmaKa(); + if (candidate.p() < 0.7 && TMath::Abs(nsigmaTPC) < grpPhi.nsigmaCutTPC) { + return true; + } + if (candidate.p() > 0.7 && candidate.hasTOF() && TMath::Abs(nsigmaTPC) < grpPhi.nsigmaCutTPC) { + if (candidate.p() > 0.7 && candidate.p() < 1.6 && candidate.beta() > grpPhi.cutTOFBeta && nsigmaTOF > -5.0 && nsigmaTOF < 10.0) { + return true; + } + if (candidate.p() >= 1.6 && candidate.p() < 2.0 && candidate.beta() > grpPhi.cutTOFBeta && nsigmaTOF > -3.0 && nsigmaTOF < 10.0) { + return true; + } + if (candidate.p() >= 2.0 && candidate.p() < 2.5 && candidate.beta() > grpPhi.cutTOFBeta && nsigmaTOF > -3.0 && nsigmaTOF < 6.0) { + return true; + } + if (candidate.p() >= 2.5 && candidate.p() < 4.0 && candidate.beta() > grpPhi.cutTOFBeta && nsigmaTOF > -2.5 && nsigmaTOF < 4.0) { + return true; + } + if (candidate.p() >= 4.0 && candidate.p() < 5.0 && candidate.beta() > grpPhi.cutTOFBeta && nsigmaTOF > -4.0 && nsigmaTOF < 3.0) { + return true; + } + if (candidate.p() >= 5.0 && candidate.p() < 6.0 && candidate.beta() > grpPhi.cutTOFBeta && nsigmaTOF > -4.0 && nsigmaTOF < 2.5) { + return true; + } + if (candidate.p() >= 6.0 && candidate.beta() > grpPhi.cutTOFBeta && nsigmaTOF > -3.0 && nsigmaTOF < 3.0) { + return true; + } + } + return false; + } + // Generic 2-prong invariant mass method candidate finder. Only works for non-identical daughters of opposite charge for now. void processDataInvMass(aod::Collisions::iterator const&, aod::BCsWithTimestamps const&, aod::CFCollRefs const& cfcollisions, aod::CFTrackRefs const& cftracks, Filter2Prong::PIDTrack const& tracks) { @@ -530,9 +604,9 @@ struct Filter2Prong { if (grpPhi.ITSPIDSelection && p1.p() < grpPhi.ITSPIDPthreshold.value && !(itsResponse.nSigmaITS(p1) > grpPhi.lowITSPIDNsigma.value && itsResponse.nSigmaITS(p1) < grpPhi.highITSPIDNsigma.value)) { // Check ITS PID condition continue; } - if (!selectionPID(p1)) { + /*if (!selectionPID(p1)) { continue; - } + }*/ if (grpPhi.removefaketrack && isFakeTrack(p1)) { // Check if the track is a fake kaon continue; } @@ -548,9 +622,9 @@ struct Filter2Prong { if (!selectionTrack(p2)) { continue; } - if (!selectionPID(p2)) { + /*if (!selectionPID(p2)) { continue; - } + }*/ if (grpPhi.ITSPIDSelection && p2.p() < grpPhi.ITSPIDPthreshold.value && !(itsResponse.nSigmaITS(p2) > grpPhi.lowITSPIDNsigma.value && itsResponse.nSigmaITS(p2) < grpPhi.highITSPIDNsigma.value)) { // Check ITS PID condition continue; } @@ -568,8 +642,18 @@ struct Filter2Prong { continue; } float phi = RecoDecay::constrainAngle(s.Phi(), 0.0f); - output2ProngTracks(cfcollisions.begin().globalIndex(), - cftrack1.globalIndex(), cftrack2.globalIndex(), s.pt(), s.eta(), phi, s.M(), aod::cf2prongtrack::PhiToKK); + if (selectionPID(p1) && selectionPID(p2)) { + output2ProngTracks(cfcollisions.begin().globalIndex(), + cftrack1.globalIndex(), cftrack2.globalIndex(), s.pt(), s.eta(), phi, s.M(), aod::cf2prongtrack::PhiToKKPID1); + } + if (selectionPID2(p1) && selectionPID2(p2)) { + output2ProngTracks(cfcollisions.begin().globalIndex(), + cftrack1.globalIndex(), cftrack2.globalIndex(), s.pt(), s.eta(), phi, s.M(), aod::cf2prongtrack::PhiToKKPID2); + } + if (selectionPID3(p1) && selectionPID3(p2)) { + output2ProngTracks(cfcollisions.begin().globalIndex(), + cftrack1.globalIndex(), cftrack2.globalIndex(), s.pt(), s.eta(), phi, s.M(), aod::cf2prongtrack::PhiToKKPID3); + } } // end of loop over second track } // end of loop over first track } @@ -674,7 +758,7 @@ struct Filter2Prong { } float phi = RecoDecay::constrainAngle(s.Phi(), 0.0f); output2ProngTracks(cfcollisions.begin().globalIndex(), - cftrack1.globalIndex(), cftrack2.globalIndex(), s.pt(), s.eta(), phi, s.M(), aod::cf2prongtrack::PhiToKK); + cftrack1.globalIndex(), cftrack2.globalIndex(), s.pt(), s.eta(), phi, s.M(), aod::cf2prongtrack::PhiToKKPID1); } // end of loop over second track } // end of loop over first track } diff --git a/PWGCF/Tasks/correlations.cxx b/PWGCF/Tasks/correlations.cxx index 5122b9ebf64..a94fd8c1bab 100644 --- a/PWGCF/Tasks/correlations.cxx +++ b/PWGCF/Tasks/correlations.cxx @@ -487,7 +487,7 @@ struct CorrelationTask { mass = o2::constants::physics::MassK0Short; } else if (decayType == aod::cf2prongtrack::LambdatoPPi || decayType == aod::cf2prongtrack::AntiLambdatoPiP) { mass = o2::constants::physics::MassLambda; - } else if (decayType == aod::cf2prongtrack::PhiToKK) { + } else if (decayType == aod::cf2prongtrack::PhiToKKPID1 || decayType == aod::cf2prongtrack::PhiToKKPID2 || decayType == aod::cf2prongtrack::PhiToKKPID3) { mass = o2::constants::physics::MassPhi; } else { return {false, 0.0f}; // unsupported decay type, return dummy rapidity @@ -640,11 +640,14 @@ struct CorrelationTask { if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << static_cast(track2.decay()))) == 0u) { continue; // skip particles that do not match the decay mask } - if (cfgV0RapidityMax > 0) { + + // track2 here is charged hadron so we don't need rapidity cut for this track...this rapidity is only needed for V0 + /* + if (cfgV0RapidityMax > 0) { auto [t, y] = getV0Rapidity(track2); - if (t && std::abs(y) > cfgV0RapidityMax) - continue; // V0s are not allowed to be outside the rapidity range - } + if (t && std::abs(y) > cfgV0RapidityMax) + continue; + }*/ } if constexpr (std::experimental::is_detected::value && std::experimental::is_detected::value) { From 4b50cd305817f973047bd204ce4ca7a16683b4bb Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 5 Sep 2025 22:21:36 +0200 Subject: [PATCH 329/986] [PWGEM/Dilepton] add a histogram for PC in SingleTrackQCMC.h (#12881) --- PWGEM/Dilepton/Core/SingleTrackQCMC.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/PWGEM/Dilepton/Core/SingleTrackQCMC.h b/PWGEM/Dilepton/Core/SingleTrackQCMC.h index 02eb4035160..df7f1c78726 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQCMC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQCMC.h @@ -303,6 +303,8 @@ struct SingleTrackQCMC { fRegistry.addClone("Track/lf/", "Track/c2l/"); fRegistry.addClone("Track/lf/", "Track/b2l/"); fRegistry.addClone("Track/lf/", "Track/b2c2l/"); + fRegistry.add("Track/Photon/positive/hProdVtx", "production vertex of e from #gamma;p_{T,e}^{rec} (GeV/c);r_{xy}^{gen} (cm);", kTH2F, {axis_pt, {100, 0, 100}}, false); + fRegistry.addClone("Track/Photon/positive/hProdVtx", "Track/Photon/negative/hProdVtx"); if (cfgFillQA) { fRegistry.add("Track/PID/positive/hTPCdEdx", "TPC dE/dx;p_{in} (GeV/c);TPC dE/dx (a.u.)", kTH2F, {{1000, 0, 10}, {200, 0, 200}}, false); @@ -605,6 +607,10 @@ struct SingleTrackQCMC { if (track.sign() > 0) { fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hs"), track.pt(), track.eta(), track.phi(), dca3D, dcaXY, dcaZ, -mctrack.pdgCode() / pdg_lepton, weight); + if constexpr (lepton_source_id == 2) { // for electron from photon conversion + fRegistry.fill(HIST("Track/Photon/positive/hProdVtx"), track.pt(), std::sqrt(std::pow(mctrack.vx(), 2) + std::pow(mctrack.vy(), 2)), weight); + } + if (fillGenValuesForRec) { fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hsGenRec"), mctrack.pt(), mctrack.eta(), mctrack.phi(), dca3D, dcaXY, dcaZ, -mctrack.pdgCode() / pdg_lepton, weight); } @@ -655,6 +661,9 @@ struct SingleTrackQCMC { } } else { fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hs"), track.pt(), track.eta(), track.phi(), dca3D, dcaXY, dcaZ, -mctrack.pdgCode() / pdg_lepton, weight); + if constexpr (lepton_source_id == 2) { // for electron from photon conversion + fRegistry.fill(HIST("Track/Photon/negative/hProdVtx"), track.pt(), std::sqrt(std::pow(mctrack.vx(), 2) + std::pow(mctrack.vy(), 2)), weight); + } if (fillGenValuesForRec) { fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hsGenRec"), mctrack.pt(), mctrack.eta(), mctrack.phi(), dca3D, dcaXY, dcaZ, -mctrack.pdgCode() / pdg_lepton, weight); } From 6d517d29863af40f188406bd2c75aa73c93ea996 Mon Sep 17 00:00:00 2001 From: Noor Koster <82090643+cnkoster@users.noreply.github.com> Date: Sat, 6 Sep 2025 00:31:51 +0200 Subject: [PATCH 330/986] =?UTF-8?q?[PWGCF]=20FlowSP:=20Put=20all=20histos?= =?UTF-8?q?=20in=20TProfile3D=20to=20reduce=20amount=20of=20total=20histos?= =?UTF-8?q?=E2=80=A6=20(#12883)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: ALICE Action Bot --- PWGCF/Flow/Tasks/flowSP.cxx | 192 ++++++++---------------------------- 1 file changed, 43 insertions(+), 149 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowSP.cxx b/PWGCF/Flow/Tasks/flowSP.cxx index 44cc6d7b027..ce75e1c9bc1 100644 --- a/PWGCF/Flow/Tasks/flowSP.cxx +++ b/PWGCF/Flow/Tasks/flowSP.cxx @@ -445,95 +445,47 @@ struct FlowSP { if (cfgFillGeneralV1Histos) { // track properties per centrality and per eta, pt bin - registry.add("incl/vnC_eta", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.add("incl/vnA_eta", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.add("incl/vnC_pt", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/vnA_pt", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/vnC_pt_odd", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/vnA_pt_odd", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/vnC_cent_minEta", "", kTProfile, {axisCent}); - registry.add("incl/vnA_cent_minEta", "", kTProfile, {axisCent}); - registry.add("incl/vnC_cent_plusEta", "", kTProfile, {axisCent}); - registry.add("incl/vnA_cent_plusEta", "", kTProfile, {axisCent}); + registry.add("incl/vnC", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); + registry.add("incl/vnA", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); } if (cfgFillPID) { - registry.add("incl/pion/vnC_eta", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.add("incl/pion/vnA_eta", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.add("incl/pion/vnC_pt", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/pion/vnA_pt", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/pion/vnC_pt_odd", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/pion/vnA_pt_odd", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/pion/vnC_cent_minEta", "", kTProfile, {axisCent}); - registry.add("incl/pion/vnA_cent_minEta", "", kTProfile, {axisCent}); - registry.add("incl/pion/vnC_cent_plusEta", "", kTProfile, {axisCent}); - registry.add("incl/pion/vnA_cent_plusEta", "", kTProfile, {axisCent}); + registry.add("incl/pion/vnC", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); + registry.add("incl/pion/vnA", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); + + if (cfgFillEventPlane) { + registry.add("incl/pion/vnA_EP", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); + registry.add("incl/pion/vnC_EP", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); + registry.add("incl/pion/vnFull_EP", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); + } } if (cfgFillXandYterms) { - registry.add("incl/vnAx_eta", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.add("incl/vnAy_eta", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.add("incl/vnCx_eta", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.add("incl/vnCy_eta", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.add("incl/vnAx_pt", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/vnAy_pt", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/vnCx_pt", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/vnCy_pt", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/vnCx_pt_odd", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/vnAx_pt_odd", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/vnCy_pt_odd", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/vnAy_pt_odd", "", kTProfile2D, {axisPt, axisCentrality}); + registry.add("incl/vnAx", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); + registry.add("incl/vnAy", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); + registry.add("incl/vnCx", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); + registry.add("incl/vnCy", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); if (cfgFillPID) { - registry.add("incl/pion/vnAx_eta", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.add("incl/pion/vnAy_eta", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.add("incl/pion/vnCx_eta", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.add("incl/pion/vnCy_eta", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.add("incl/pion/vnAx_pt", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/pion/vnAy_pt", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/pion/vnCx_pt", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/pion/vnCy_pt", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/pion/vnCx_pt_odd", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/pion/vnAx_pt_odd", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/pion/vnCy_pt_odd", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/pion/vnAy_pt_odd", "", kTProfile2D, {axisPt, axisCentrality}); + registry.add("incl/pion/vnAx", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); + registry.add("incl/pion/vnAy", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); + registry.add("incl/pion/vnCx", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); + registry.add("incl/pion/vnCy", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); } } if (cfgFillMixedHarmonics) { - registry.add("incl/MH/vnAxCxUx_pt_MH", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/MH/vnAxCyUx_pt_MH", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/MH/vnAxCyUy_pt_MH", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/MH/vnAyCxUy_pt_MH", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/MH/vnAxCxUx_cent_MH", "", kTProfile, {axisCent}); - registry.add("incl/MH/vnAxCyUx_cent_MH", "", kTProfile, {axisCent}); - registry.add("incl/MH/vnAxCyUy_cent_MH", "", kTProfile, {axisCent}); - registry.add("incl/MH/vnAyCxUy_cent_MH", "", kTProfile, {axisCent}); - registry.add("incl/MH/vnAxCxUx_eta_MH", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.add("incl/MH/vnAxCyUx_eta_MH", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.add("incl/MH/vnAxCyUy_eta_MH", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.add("incl/MH/vnAyCxUy_eta_MH", "", kTProfile2D, {axisEtaVn, axisCentrality}); + registry.add("incl/MH/vnAxCxUx_MH", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); + registry.add("incl/MH/vnAxCyUx_MH", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); + registry.add("incl/MH/vnAxCyUy_MH", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); + registry.add("incl/MH/vnAyCxUy_MH", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); if (cfgFillPID) { - registry.add("incl/pion/MH/vnAxCxUx_pt_MH", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/pion/MH/vnAxCyUx_pt_MH", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/pion/MH/vnAxCyUy_pt_MH", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/pion/MH/vnAyCxUy_pt_MH", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/pion/MH/vnAxCxUx_cent_MH", "", kTProfile, {axisCent}); - registry.add("incl/pion/MH/vnAxCyUx_cent_MH", "", kTProfile, {axisCent}); - registry.add("incl/pion/MH/vnAxCyUy_cent_MH", "", kTProfile, {axisCent}); - registry.add("incl/pion/MH/vnAyCxUy_cent_MH", "", kTProfile, {axisCent}); - registry.add("incl/pion/MH/vnAxCxUx_eta_MH", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.add("incl/pion/MH/vnAxCyUx_eta_MH", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.add("incl/pion/MH/vnAxCyUy_eta_MH", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.add("incl/pion/MH/vnAyCxUy_eta_MH", "", kTProfile2D, {axisEtaVn, axisCentrality}); + registry.add("incl/pion/MH/vnAxCxUx_MH", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); + registry.add("incl/pion/MH/vnAxCyUx_MH", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); + registry.add("incl/pion/MH/vnAxCyUy_MH", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); + registry.add("incl/pion/MH/vnAyCxUy_MH", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); } } if (cfgFillEventPlane) { - registry.add("incl/vnA_cent_EP", "", kTProfile, {axisCent}); - registry.add("incl/vnC_cent_EP", "", kTProfile, {axisCent}); - registry.add("incl/vnFull_cent_EP", "", kTProfile, {axisCent}); - registry.add("incl/vnA_pt_EP", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/vnC_pt_EP", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/vnFull_pt_EP", "", kTProfile2D, {axisPt, axisCentrality}); - registry.add("incl/vnA_eta_EP", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.add("incl/vnC_eta_EP", "", kTProfile2D, {axisEtaVn, axisCentrality}); - registry.add("incl/vnFull_eta_EP", "", kTProfile2D, {axisEtaVn, axisCentrality}); + registry.add("incl/vnA_EP", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); + registry.add("incl/vnC_EP", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); + registry.add("incl/vnFull_EP", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); } if (cfgFillEventPlaneQA) { histos.add("QA/hSPplaneA", "hSPplaneA", kTH1D, {axisPhiPlane}); @@ -977,86 +929,28 @@ struct FlowSP { double weight = wacc * weff * centWeight; if (cfgFillGeneralV1Histos) { - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnA_eta"), track.eta(), centrality, (uy * qyA + ux * qxA) / std::sqrt(std::fabs(corrQQ)), weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnC_eta"), track.eta(), centrality, (uy * qyC + ux * qxC) / std::sqrt(std::fabs(corrQQ)), weight); - - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnA_pt"), track.pt(), centrality, (uy * qyA + ux * qxA) / std::sqrt(std::fabs(corrQQ)), weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnC_pt"), track.pt(), centrality, (uy * qyC + ux * qxC) / std::sqrt(std::fabs(corrQQ)), weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnA"), track.pt(), track.eta(), centrality, (uy * qyA + ux * qxA) / std::sqrt(std::fabs(corrQQ)), weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnC"), track.pt(), track.eta(), centrality, (uy * qyC + ux * qxC) / std::sqrt(std::fabs(corrQQ)), weight); } if (cfgFillMixedHarmonics) { - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCxUx_eta_MH"), track.eta(), centrality, (uxMH * qxA * qxC) / corrQQx, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCyUx_eta_MH"), track.eta(), centrality, (uxMH * qyA * qyC) / corrQQy, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCyUy_eta_MH"), track.eta(), centrality, (uyMH * qxA * qyC) / corrQQx, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAyCxUy_eta_MH"), track.eta(), centrality, (uyMH * qyA * qxC) / corrQQy, weight); - - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCxUx_pt_MH"), track.pt(), centrality, (uxMH * qxA * qxC) / corrQQx, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCyUx_pt_MH"), track.pt(), centrality, (uxMH * qyA * qyC) / corrQQy, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCyUy_pt_MH"), track.pt(), centrality, (uyMH * qxA * qyC) / corrQQx, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAyCxUy_pt_MH"), track.pt(), centrality, (uyMH * qyA * qxC) / corrQQy, weight); - - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCxUx_cent_MH"), centrality, (uxMH * qxA * qxC) / corrQQx, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCyUx_cent_MH"), centrality, (uxMH * qyA * qyC) / corrQQy, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCyUy_cent_MH"), centrality, (uyMH * qxA * qyC) / corrQQx, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAyCxUy_cent_MH"), centrality, (uyMH * qyA * qxC) / corrQQy, weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCxUx_MH"), track.pt(), track.eta(), centrality, (uxMH * qxA * qxC) / corrQQx, weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCyUx_MH"), track.pt(), track.eta(), centrality, (uxMH * qyA * qyC) / corrQQy, weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCyUy_MH"), track.pt(), track.eta(), centrality, (uyMH * qxA * qyC) / corrQQx, weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAyCxUy_MH"), track.pt(), track.eta(), centrality, (uyMH * qyA * qxC) / corrQQy, weight); } if (cfgFillXandYterms) { - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnAx_eta"), track.eta(), centrality, (ux * qxA) / std::sqrt(std::fabs(corrQQx)), weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnAy_eta"), track.eta(), centrality, (uy * qyA) / std::sqrt(std::fabs(corrQQy)), weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnCx_eta"), track.eta(), centrality, (ux * qxC) / std::sqrt(std::fabs(corrQQx)), weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnCy_eta"), track.eta(), centrality, (uy * qyC) / std::sqrt(std::fabs(corrQQy)), weight); - - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnAx_pt"), track.pt(), centrality, (ux * qxA) / std::sqrt(std::fabs(corrQQx)), weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnAy_pt"), track.pt(), centrality, (uy * qyA) / std::sqrt(std::fabs(corrQQy)), weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnCx_pt"), track.pt(), centrality, (ux * qxC) / std::sqrt(std::fabs(corrQQx)), weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnCy_pt"), track.pt(), centrality, (uy * qyC) / std::sqrt(std::fabs(corrQQy)), weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnAx"), track.pt(), track.eta(), centrality, (ux * qxA) / std::sqrt(std::fabs(corrQQx)), weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnAy"), track.pt(), track.eta(), centrality, (uy * qyA) / std::sqrt(std::fabs(corrQQy)), weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnCx"), track.pt(), track.eta(), centrality, (ux * qxC) / std::sqrt(std::fabs(corrQQx)), weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnCy"), track.pt(), track.eta(), centrality, (uy * qyC) / std::sqrt(std::fabs(corrQQy)), weight); } - if (cfgFillEventPlane && pt == 0) { // only fill for inclusive! - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnA_eta_EP"), track.eta(), centrality, vnA, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnC_eta_EP"), track.eta(), centrality, vnC, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnFull_eta_EP"), track.eta(), centrality, vnFull, weight); - - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnA_pt_EP"), track.pt(), centrality, vnA, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnC_pt_EP"), track.pt(), centrality, vnC, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnFull_pt_EP"), track.pt(), centrality, vnFull, weight); - - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnA_cent_EP"), centrality, vnA, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnC_cent_EP"), centrality, vnC, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnFull_cent_EP"), centrality, vnFull, weight); - } - - // For integrated v1 take only tracks from eta>0. - // Following https://arxiv.org/pdf/1306.4145 - if (cfgFillGeneralV1Histos) { - if (track.eta() < 0 && cfgHarm == 1) { - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnA_cent_minEta"), centrality, -1.0 * (uy * qyA + ux * qxA) / std::sqrt(std::fabs(corrQQ)), weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnC_cent_minEta"), centrality, -1.0 * (uy * qyC + ux * qxC) / std::sqrt(std::fabs(corrQQ)), weight); - - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnA_pt_odd"), track.pt(), centrality, -1.0 * (uy * qyA + ux * qxA) / std::sqrt(std::fabs(corrQQ)), weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnC_pt_odd"), track.pt(), centrality, -1.0 * (uy * qyC + ux * qxC) / std::sqrt(std::fabs(corrQQ)), weight); - - if (cfgFillXandYterms) { - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnAx_pt_odd"), track.pt(), centrality, -1.0 * (ux * qxA) / std::sqrt(std::fabs(corrQQx)), weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnAy_pt_odd"), track.pt(), centrality, -1.0 * (uy * qyA) / std::sqrt(std::fabs(corrQQy)), weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnCx_pt_odd"), track.pt(), centrality, -1.0 * (ux * qxC) / std::sqrt(std::fabs(corrQQx)), weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnCy_pt_odd"), track.pt(), centrality, -1.0 * (uy * qyC) / std::sqrt(std::fabs(corrQQy)), weight); - } - } else { - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnA_cent_plusEta"), centrality, (uy * qyA + ux * qxA) / std::sqrt(std::fabs(corrQQ)), weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnC_cent_plusEta"), centrality, (uy * qyC + ux * qxC) / std::sqrt(std::fabs(corrQQ)), weight); - - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnA_pt_odd"), track.pt(), centrality, (uy * qyA + ux * qxA) / std::sqrt(std::fabs(corrQQ)), weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnC_pt_odd"), track.pt(), centrality, (uy * qyC + ux * qxC) / std::sqrt(std::fabs(corrQQ)), weight); - - if (cfgFillXandYterms) { - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnAx_pt_odd"), track.pt(), centrality, (ux * qxA) / std::sqrt(std::fabs(corrQQx)), weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnAy_pt_odd"), track.pt(), centrality, (uy * qyA) / std::sqrt(std::fabs(corrQQy)), weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnCx_pt_odd"), track.pt(), centrality, (ux * qxC) / std::sqrt(std::fabs(corrQQx)), weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnCy_pt_odd"), track.pt(), centrality, (uy * qyC) / std::sqrt(std::fabs(corrQQy)), weight); - } - } + if (cfgFillEventPlane) { // only fill for inclusive! + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnA_EP"), track.pt(), track.eta(), centrality, vnA, weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnC_EP"), track.pt(), track.eta(), centrality, vnC, weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnFull_EP"), track.pt(), track.eta(), centrality, vnFull, weight); } } From 52c6eedf671a43ed149afabea42fd97fb6eb874c Mon Sep 17 00:00:00 2001 From: Giorgio Alberto Lucia <87222843+GiorgioAlbertoLucia@users.noreply.github.com> Date: Sat, 6 Sep 2025 02:41:42 +0200 Subject: [PATCH 331/986] [PWGLF] added invariant mass histograms for offline purity estimation, added selections on the tpc chi2 variable (#12884) --- .../Nuspex/LFTreeCreatorClusterStudies.cxx | 89 +++++++++++++++++-- 1 file changed, 84 insertions(+), 5 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/LFTreeCreatorClusterStudies.cxx b/PWGLF/TableProducer/Nuspex/LFTreeCreatorClusterStudies.cxx index ffa41989881..274f627f6e3 100644 --- a/PWGLF/TableProducer/Nuspex/LFTreeCreatorClusterStudies.cxx +++ b/PWGLF/TableProducer/Nuspex/LFTreeCreatorClusterStudies.cxx @@ -179,9 +179,10 @@ struct LfTreeCreatorClusterStudies { Configurable track_nClsItsMin{"track_NclsItsMin", 0.f, "Minimum number of ITS clusters for the V0 daughters"}; Configurable track_nClsTpcMin{"track_NclsTpcMin", 100.f, "Minimum number of TPC clusters for the V0 daughters"}; Configurable track_nClsTpcMaxShared{"track_NclsTpcMaxShared", 5.f, "Maximum number of shared TPC clusters for the V0 daughters"}; + Configurable track_etaMax{"etaMax", 0.8f, "Maximum eta"}; + Configurable track_tpcChi2Min{"track_tpcChi2Min", 0.5f, "Minimum TPC chi2 per cluster"}; // Configurable v0setting_etaMaxV0{"etaMaxV0", 0.8f, "Maximum eta for the V0 daughters"}; - Configurable v0setting_etaMaxV0dau{"etaMaxV0dau", 0.8f, "Maximum eta for the V0 daughters"}; Configurable v0setting_dcaV0daughters{"v0setting_dcaV0daughters", 0.5f, "DCA between the V0 daughters"}; Configurable v0setting_dcaV0toPV{"v0setting_dcaV0fromPV", 1.f, "DCA of the V0 to the primary vertex"}; Configurable v0setting_dcaDaughtersToPV{"v0setting_dcaDaughtersToPV", 1.f, "DCA of the daughters to the primary vertex"}; @@ -232,7 +233,8 @@ struct LfTreeCreatorClusterStudies { {"he3_selections", "He3 track selection; selection; counts", {HistType::kTH1F, {{He3Selections::kHe3All, -0.5, static_cast(He3Selections::kHe3All) - 0.5}}}}, {"v0_type", "Selected V0; particle; counts", {HistType::kTH1F, {{V0Type::V0TypeAll, -0.5, static_cast(V0Type::V0TypeAll) - 0.5}}}}, {"radiusV0", "Decay radius (xy) V0; radius (cm); counts", {HistType::kTH1F, {{100, 0., 100.}}}}, - {"massLambda", "#Lambda invariant mass; signed #it{p} (GeV/#it{c}); m (GeV/#it{c}^{2})", {HistType::kTH2F, {{100, -5.f, 5.f}, {50, 1.08f, 1.18f}}}}, + {"massLambda", "#Lambda invariant mass; signed #it{p} (GeV/#it{c}); m (GeV/#it{c}^{2})", {HistType::kTH2F, {{100, -5.f, 5.f}, {200, 1.08f, 1.18f}}}}, + {"massLambdaMc", "#Lambda invariant mass (MC); signed #it{p} (GeV/#it{c}); m (GeV/#it{c}^{2})", {HistType::kTH2F, {{100, -5.f, 5.f}, {200, 1.08f, 1.18f}}}}, {"Lambda_vs_K0s", "Mass #Lambda vs K^{0}_s; m_{K^{0}_{s}} (GeV/#it{c}^{2}); m_{#Lambda} (GeV/#it{c}^{2})", {HistType::kTH2F, {{50, 0.f, 1.f}, {70, 0.6f, 2.f}}}}, {"armenteros_plot_before_selections", "Armenteros-Podolanski plot; #alpha; q_{T} (GeV/#it{c})", {HistType::kTH2F, {{100, -1.f, 1.f}, {100, 0.f, 0.3f}}}}, {"armenteros_plot", "Armenteros-Podolanski plot; #alpha; q_{T} (GeV/#it{c})", {HistType::kTH2F, {{100, -1.f, 1.f}, {100, 0.f, 0.3f}}}}, @@ -243,7 +245,8 @@ struct LfTreeCreatorClusterStudies { {"photon_conversion_position_layer", "Photon conversion position (ITS layers); x (cm); y (cm)", {HistType::kTH2F, {{100, -5.f, 5.f}, {100, -5.f, 5.f}}}}, {"casc_dca_daughter_pairs", "DCA (xy) for cascade daughter pairs; DCAxy (cm); counts", {HistType::kTH1F, {{100, -0.1, 0.1}}}}, {"Xi_vs_Omega", "Mass Xi vs Omega; mass Omega (GeV/#it{c}^{2}); mass Xi (GeV/#it{c}^{2})", {HistType::kTH2F, {{50, 1.f, 2.f}, {50, 1.f, 2.f}}}}, - {"massOmega", "Mass #Omega; signed #it{p}_{T} (GeV/#it{c}); mass (GeV/#it{c}^{2})", {HistType::kTH2F, {{100, -5.f, 5.f}, {100, 1.62f, 1.72f}}}}, + {"massOmega", "Mass #Omega; signed #it{p}_{T} (GeV/#it{c}); mass (GeV/#it{c}^{2})", {HistType::kTH2F, {{100, -5.f, 5.f}, {400, 1.62f, 1.72f}}}}, + {"massOmegaMc", "Mass #Omega (MC); signed #it{p}_{T} (GeV/#it{c}); mass (GeV/#it{c}^{2})", {HistType::kTH2F, {{100, -5.f, 5.f}, {400, 1.62f, 1.72f}}}}, {"massOmegaWithBkg", "Mass Omega with Background; mass Omega (GeV/#it{c}^{2}); counts", {HistType::kTH1F, {{100, 1.62f, 1.72f}}}}, {"nSigmaTPCEl", "nSigma TPC Electron; signed #it{p} (GeV/#it{c}); n#sigma_{TPC} e", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {60, -2.0f, 2.0f}}}}, {"nSigmaTPCPi", "nSigma TPC Pion; signed #it{p} (GeV/#it{c}); n#sigma_{TPC} #pi", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {60, -3.0f, 3.0f}}}}, @@ -389,14 +392,16 @@ struct LfTreeCreatorClusterStudies { template bool qualityTrackSelection(const T& track) { - if (std::abs(track.eta()) > v0setting_etaMaxV0dau) { + if (std::abs(track.eta()) > track_etaMax) { return false; } if (track.itsNCls() < track_nClsItsMin || track.tpcNClsFound() < track_nClsTpcMin || track.tpcNClsCrossedRows() < track_nClsTpcMin || track.tpcNClsCrossedRows() < 0.8 * track.tpcNClsFindable() || - track.tpcNClsShared() > track_nClsTpcMaxShared) { + track.tpcNClsShared() > track_nClsTpcMaxShared || + track.tpcChi2NCl() < track_tpcChi2Min || + track.tpcChi2NCl() > 4.0f) { return false; } return true; @@ -556,6 +561,64 @@ struct LfTreeCreatorClusterStudies { return massV0; } + template + void fillMcHistogramsV0(const float massLambda, const float massAntiLambda, + const std::array& momMother, + const McPart& posDaughter, const McPart& negDaughter) + { + if ((std::abs(posDaughter.pdgCode()) != 2212 && std::abs(posDaughter.pdgCode()) != 211) || + (std::abs(negDaughter.pdgCode()) != 2212 && std::abs(negDaughter.pdgCode()) != 211)) { + return; + } + + int motherPdgCode = 0; + for (const auto& posMother : posDaughter.template mothers_as()) { + for (const auto& negMother : negDaughter.template mothers_as()) { + if (negMother.globalIndex() == posMother.globalIndex()) { + motherPdgCode = posMother.pdgCode(); + } + } + } + + if (motherPdgCode == 3122) { + m_hAnalysis.fill(HIST("massLambdaMc"), std::hypot(momMother[0], momMother[1], momMother[2]), massLambda); + } else if (motherPdgCode == -3122) { + m_hAnalysis.fill(HIST("massLambdaMc"), std::hypot(momMother[0], momMother[1], momMother[2]) * -1.f, massAntiLambda); + } + } + + template + void fillMcHistogramsCascade(const float massOmega, + const std::array& momMother, + const McPart& bachelorDaughter, const McPart& posV0Daughter) + { + McPart v0Daughter; + for (const auto& iterV0Daughter : posV0Daughter.template mothers_as()) { + if (std::abs(iterV0Daughter.pdgCode()) != 3122) { + continue; + } + v0Daughter = iterV0Daughter; + } + if (std::abs(bachelorDaughter.pdgCode()) != 321) { + return; + } + + int motherPdgCode = 0; + for (const auto& bachelorMother : bachelorDaughter.template mothers_as()) { + for (const auto& v0Mother : v0Daughter.template mothers_as()) { + if (v0Mother.globalIndex() == bachelorMother.globalIndex()) { + motherPdgCode = bachelorMother.pdgCode(); + } + } + } + + if (motherPdgCode == 3334) { + m_hAnalysis.fill(HIST("massOmegaMc"), std::hypot(momMother[0], momMother[1], momMother[2]), massOmega); + } else if (motherPdgCode == -3334) { + m_hAnalysis.fill(HIST("massOmegaMc"), std::hypot(momMother[0], momMother[1], momMother[2]) * -1.f, massOmega); + } + } + template void fillTable(const Candidate& candidate) { @@ -587,9 +650,16 @@ struct LfTreeCreatorClusterStudies { template bool nucleiTrackSelection(const T& track) { + if (std::abs(track.eta()) > track_etaMax) { + return false; + } if (track.tpcNClsFound() < 90) { return false; } + if ((track.tpcChi2NCl() > 4.0f) || + (track.tpcChi2NCl() < track_tpcChi2Min)) { + return false; + } return true; } @@ -837,6 +907,8 @@ struct LfTreeCreatorClusterStudies { candidatePos.pdgCode = posMcParticle.pdgCode(); candidateNeg.pdgCode = negMcParticle.pdgCode(); + + fillMcHistogramsV0(massLambdaV0, massAntiLambdaV0, momMother, posMcParticle, negMcParticle); } fillTable(candidatePos); @@ -929,6 +1001,13 @@ struct LfTreeCreatorClusterStudies { m_ClusterStudiesTableMc( mcParticle.pdgCode()); // pdgCode_K + + auto posV0Daughter = v0Track.posTrack_as(); + if (!posV0Daughter.has_mcParticle()) { + return; + } + auto mcPosParticleV0 = posV0Daughter.mcParticle(); + fillMcHistogramsCascade(massOmega, momMother, mcParticle, mcPosParticleV0); } m_hAnalysis.fill(HIST("isPositive"), bachelorTrack.p() > 0); From 995df1481ee523dc8844e0832cb2d1bad471cd86 Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Sat, 6 Sep 2025 04:51:16 +0200 Subject: [PATCH 332/986] [DPG] Add possibility to skip trackQA variables and reject with ML (#12885) --- .../derivedDataCreatorD0Calibration.cxx | 100 ++++++++++++------ 1 file changed, 65 insertions(+), 35 deletions(-) diff --git a/DPG/Tasks/AOTTrack/derivedDataCreatorD0Calibration.cxx b/DPG/Tasks/AOTTrack/derivedDataCreatorD0Calibration.cxx index 20b50370644..15b5bd5dc77 100644 --- a/DPG/Tasks/AOTTrack/derivedDataCreatorD0Calibration.cxx +++ b/DPG/Tasks/AOTTrack/derivedDataCreatorD0Calibration.cxx @@ -168,12 +168,14 @@ struct DerivedDataCreatorD0Calibration { selectorKaon = selectorPion; } - void process(CollisionsWEvSel const& collisions, - aod::TrackAssoc const& trackIndices, - TracksWCovExtraPid const&, - aod::BCsWithTimestamps const&, - TrackMeanOccs const&, - aod::TracksQAVersion const&) + // main function + template + void runDataCreation(CollisionsWEvSel const& collisions, + aod::TrackAssoc const& trackIndices, + TracksWCovExtraPid const&, + aod::BCsWithTimestamps const&, + TrackMeanOccs const&, + TTrackQa const&) { std::map selectedCollisions; // map with indices of selected collisions (key: original AOD Collision table index, value: D0 collision index) std::map selectedTracks; // map with indices of selected tracks (key: original AOD Track table index, value: D0 daughter track index) @@ -419,7 +421,9 @@ struct DerivedDataCreatorD0Calibration { // apply BDT models if (cfgMl.apply) { std::vector featuresCandD0 = {dcaPos.getY(), dcaNeg.getY(), chi2PCA, cosPaD0, cosPaXYD0, decLenXYD0, decLenD0, dcaPos.getY() * dcaNeg.getY(), aod::pid_tpc_tof_utils::combineNSigma(trackPos.tpcNSigmaPi(), trackPos.tofNSigmaPi()), aod::pid_tpc_tof_utils::combineNSigma(trackNeg.tpcNSigmaKa(), trackNeg.tofNSigmaKa()), trackPos.tpcNSigmaPi(), trackPos.tpcNSigmaKa(), aod::pid_tpc_tof_utils::combineNSigma(trackPos.tpcNSigmaKa(), trackPos.tofNSigmaKa()), trackNeg.tpcNSigmaPi(), trackNeg.tpcNSigmaKa(), aod::pid_tpc_tof_utils::combineNSigma(trackNeg.tpcNSigmaPi(), trackNeg.tofNSigmaPi())}; - mlResponse.isSelectedMl(featuresCandD0, ptD0, bdtScoresD0); + if (!mlResponse.isSelectedMl(featuresCandD0, ptD0, bdtScoresD0)) { + massHypo -= D0MassHypo::D0; + } } } } @@ -432,7 +436,9 @@ struct DerivedDataCreatorD0Calibration { // apply BDT models if (cfgMl.apply) { std::vector featuresCandD0bar = {dcaPos.getY(), dcaNeg.getY(), chi2PCA, cosPaD0, cosPaXYD0, decLenXYD0, decLenD0, dcaPos.getY() * dcaNeg.getY(), aod::pid_tpc_tof_utils::combineNSigma(trackNeg.tpcNSigmaPi(), trackNeg.tofNSigmaPi()), aod::pid_tpc_tof_utils::combineNSigma(trackPos.tpcNSigmaKa(), trackPos.tofNSigmaKa()), trackNeg.tpcNSigmaPi(), trackNeg.tpcNSigmaKa(), aod::pid_tpc_tof_utils::combineNSigma(trackNeg.tpcNSigmaKa(), trackNeg.tofNSigmaKa()), trackPos.tpcNSigmaPi(), trackPos.tpcNSigmaKa(), aod::pid_tpc_tof_utils::combineNSigma(trackPos.tpcNSigmaPi(), trackPos.tofNSigmaPi())}; - mlResponse.isSelectedMl(featuresCandD0bar, ptD0, bdtScoresD0bar); + if (!mlResponse.isSelectedMl(featuresCandD0bar, ptD0, bdtScoresD0bar)) { + massHypo -= D0MassHypo::D0Bar; + } } } } @@ -515,33 +521,35 @@ struct DerivedDataCreatorD0Calibration { int8_t deltaRefGloParamQ2Pt{0}; int8_t deltaTOFdX{0}; int8_t deltaTOFdZ{0}; - if (trackPos.has_trackQA()) { - auto trackQA = trackPos.trackQA_as(); // obtain track QA - tpcTime0 = trackQA.tpcTime0(); - tpcdEdxNorm = trackQA.tpcdEdxNorm(); - tpcDcaR = trackQA.tpcdcaR(); - tpcDcaZ = trackQA.tpcdcaZ(); - tpcClusterByteMask = trackQA.tpcClusterByteMask(); - tpcdEdxMax0R = trackQA.tpcdEdxMax0R(); - tpcdEdxMax1R = trackQA.tpcdEdxMax1R(); - tpcdEdxMax2R = trackQA.tpcdEdxMax2R(); - tpcdEdxMax3R = trackQA.tpcdEdxMax3R(); - tpcdEdxTot0R = trackQA.tpcdEdxTot0R(); - tpcdEdxTot1R = trackQA.tpcdEdxTot1R(); - tpcdEdxTot2R = trackQA.tpcdEdxTot2R(); - tpcdEdxTot3R = trackQA.tpcdEdxTot3R(); - deltaRefContParamY = trackQA.deltaRefContParamY(); - deltaRefITSParamZ = trackQA.deltaRefITSParamZ(); - deltaRefContParamSnp = trackQA.deltaRefContParamSnp(); - deltaRefContParamTgl = trackQA.deltaRefContParamTgl(); - deltaRefContParamQ2Pt = trackQA.deltaRefContParamQ2Pt(); - deltaRefGloParamY = trackQA.deltaRefGloParamY(); - deltaRefGloParamZ = trackQA.deltaRefGloParamZ(); - deltaRefGloParamSnp = trackQA.deltaRefGloParamSnp(); - deltaRefGloParamTgl = trackQA.deltaRefGloParamTgl(); - deltaRefGloParamQ2Pt = trackQA.deltaRefGloParamQ2Pt(); - deltaTOFdX = trackQA.deltaTOFdX(); - deltaTOFdZ = trackQA.deltaTOFdZ(); + if constexpr (withTrackQa) { + if (trackPos.has_trackQA()) { + auto trackQA = trackPos.template trackQA_as(); // obtain track QA + tpcTime0 = trackQA.tpcTime0(); + tpcdEdxNorm = trackQA.tpcdEdxNorm(); + tpcDcaR = trackQA.tpcdcaR(); + tpcDcaZ = trackQA.tpcdcaZ(); + tpcClusterByteMask = trackQA.tpcClusterByteMask(); + tpcdEdxMax0R = trackQA.tpcdEdxMax0R(); + tpcdEdxMax1R = trackQA.tpcdEdxMax1R(); + tpcdEdxMax2R = trackQA.tpcdEdxMax2R(); + tpcdEdxMax3R = trackQA.tpcdEdxMax3R(); + tpcdEdxTot0R = trackQA.tpcdEdxTot0R(); + tpcdEdxTot1R = trackQA.tpcdEdxTot1R(); + tpcdEdxTot2R = trackQA.tpcdEdxTot2R(); + tpcdEdxTot3R = trackQA.tpcdEdxTot3R(); + deltaRefContParamY = trackQA.deltaRefContParamY(); + deltaRefITSParamZ = trackQA.deltaRefITSParamZ(); + deltaRefContParamSnp = trackQA.deltaRefContParamSnp(); + deltaRefContParamTgl = trackQA.deltaRefContParamTgl(); + deltaRefContParamQ2Pt = trackQA.deltaRefContParamQ2Pt(); + deltaRefGloParamY = trackQA.deltaRefGloParamY(); + deltaRefGloParamZ = trackQA.deltaRefGloParamZ(); + deltaRefGloParamSnp = trackQA.deltaRefGloParamSnp(); + deltaRefGloParamTgl = trackQA.deltaRefGloParamTgl(); + deltaRefGloParamQ2Pt = trackQA.deltaRefGloParamQ2Pt(); + deltaTOFdX = trackQA.deltaTOFdX(); + deltaTOFdZ = trackQA.deltaTOFdZ(); + } } trackTable(selectedCollisions[collision.globalIndex()], // stored at PV @@ -821,6 +829,28 @@ struct DerivedDataCreatorD0Calibration { } // end loop over positive tracks } // end loop over collisions tracks } + + // process functions + void processWithTrackQa(CollisionsWEvSel const& collisions, + aod::TrackAssoc const& trackIndices, + TracksWCovExtraPid const& tracks, + aod::BCsWithTimestamps const& bcs, + TrackMeanOccs const& occ, + aod::TracksQAVersion const& trackQa) + { + runDataCreation(collisions, trackIndices, tracks, bcs, occ, trackQa); + } + PROCESS_SWITCH(DerivedDataCreatorD0Calibration, processWithTrackQa, "Process with trackQA enabled", false); + + void processNoTrackQa(CollisionsWEvSel const& collisions, + aod::TrackAssoc const& trackIndices, + TracksWCovExtraPid const& tracks, + aod::BCsWithTimestamps const& bcs, + TrackMeanOccs const& occ) + { + runDataCreation(collisions, trackIndices, tracks, bcs, occ, nullptr); + } + PROCESS_SWITCH(DerivedDataCreatorD0Calibration, processNoTrackQa, "Process without trackQA enabled", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From e87fbb420b45c8a25ab7b840b9009db99ba87786 Mon Sep 17 00:00:00 2001 From: prottayCMT <61418725+prottayCMT@users.noreply.github.com> Date: Sat, 6 Sep 2025 08:32:00 +0200 Subject: [PATCH 333/986] [PWGLF] added track tables to reduce throughput in hyperloop run (#12860) Co-authored-by: Prottay Das --- PWGLF/TableProducer/Common/spvector.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/PWGLF/TableProducer/Common/spvector.cxx b/PWGLF/TableProducer/Common/spvector.cxx index e5940962e1f..a9e82a2db99 100644 --- a/PWGLF/TableProducer/Common/spvector.cxx +++ b/PWGLF/TableProducer/Common/spvector.cxx @@ -93,6 +93,7 @@ struct spvector { Configurable cfgCutCentralityMax{"cfgCutCentralityMax", 80.0f, "Centrality cut Max"}; Configurable cfgCutCentralityMin{"cfgCutCentralityMin", 0.0f, "Centrality cut Min"}; Configurable additionalEvSel{"additionalEvSel", false, "additionalEvSel"}; + Configurable usemem{"usemem", true, "usemem"}; struct : ConfigurableGroup { Configurable QxyNbins{"QxyNbins", 100, "Number of bins in QxQy histograms"}; @@ -230,6 +231,7 @@ struct spvector { AxisSpec basisAxis = {2, 0, 2, "basis"}; AxisSpec VxyAxis = {2, 0, 2, "Vxy"}; + histos.add("htpcnsigmapi", "htpcnsigmapi", kTH1F, {{50, -10, 10.0}}); histos.add("hEvtSelInfo", "hEvtSelInfo", kTH1F, {{10, 0, 10.0}}); histos.add("hCentrality", "hCentrality", kTH1F, {{centfineAxis}}); histos.add("Vz", "Vz", kTH1F, {vzfineAxis}); @@ -409,11 +411,18 @@ struct spvector { } using MyCollisions = soa::Join; + using AllTrackCandidates = soa::Join; Preslice zdcPerCollision = aod::collision::bcId; - void process(MyCollisions::iterator const& collision, aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0s*/, BCsRun3 const& bcs, aod::Zdcs const&) + void process(MyCollisions::iterator const& collision, aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0s*/, BCsRun3 const& bcs, aod::Zdcs const&, AllTrackCandidates const& tracks) { + if (usemem) { + for (const auto& track : tracks) { + histos.fill(HIST("htpcnsigmapi"), track.tpcNSigmaPi()); + } + } + histos.fill(HIST("hEvtSelInfo"), 0.5); auto centrality = collision.centFT0C(); bool triggerevent = false; From eb9948c7763eec1391180a25f28552e6403320ca Mon Sep 17 00:00:00 2001 From: Jaideep Tanwar <141036812+jtanwar2212@users.noreply.github.com> Date: Sat, 6 Sep 2025 13:24:32 +0530 Subject: [PATCH 334/986] [PWGLF] Update nucleitpcpbpb.cxx with efficiency plots (#12879) --- PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx | 468 +++++++++++++++++++++------ 1 file changed, 378 insertions(+), 90 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx b/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx index fc99ebcd30b..1eff338cec8 100644 --- a/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx +++ b/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx @@ -59,6 +59,7 @@ static const std::vector particlePdgCodes{211, 2212, o2::constants::physics static const std::vector particleMasses{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron, o2::constants::physics::MassTriton, o2::constants::physics::MassHelium3, o2::constants::physics::MassAlpha}; static const std::vector particleCharge{1, 1, 1, 1, 2, 2}; const int nBetheParams = 6; +std::vector hfMothCodes = {511, 521, 531, 541, 5122}; // b-mesons + Lambda_b static const std::vector betheBlochParNames{"p0", "p1", "p2", "p3", "p4", "resolution"}; constexpr double kBetheBlochDefault[nParticles][nBetheParams]{ {13.611469, 3.598765, -0.021138, 2.039562, 0.651040, 0.09}, // pion @@ -103,7 +104,7 @@ struct PrimParticles { } }; // struct PrimParticles //---------------------------------------------------------------------------------------------------------------- -std::vector> hmass; +std::vector> hmass; std::vector> hmassnsigma; } // namespace //---------------------------------------------------------------------------------------------------------------- @@ -144,6 +145,7 @@ struct NucleitpcPbPb { Configurable cfgmaxGetMeanItsClsSizeRequire{"cfgmaxGetMeanItsClsSizeRequire", true, "Require maxGetMeanItsClsSize Cut"}; Configurable cfgDCAwithptRequire{"cfgDCAwithptRequire", true, "Require DCA cuts with pt dependance"}; Configurable cfgRequirebetaplot{"cfgRequirebetaplot", true, "Require beta plot"}; + Configurable cfgIncludeMaterialInEfficiency{"cfgIncludeMaterialInEfficiency", true, "Require from material in efficiency"}; Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {kBetheBlochDefault[0], nParticles, nBetheParams, particleNames, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for light nuclei"}; Configurable> cfgTrackPIDsettings{"cfgTrackPIDsettings", {kTrackPIDSettings[0], nParticles, nTrkSettings, particleNames, trackPIDsettingsNames}, "track selection and PID criteria"}; @@ -153,6 +155,7 @@ struct NucleitpcPbPb { Configurable cfgFillmassnsigma{"cfgFillmassnsigma", true, "Fill mass vs nsigma histograms"}; Configurable centcut{"centcut", 80.0f, "centrality cut"}; Configurable cfgCutRapidity{"cfgCutRapidity", 0.5f, "Rapidity range"}; + Configurable cfgtpcNClsFindable{"cfgtpcNClsFindable", 0.8f, "tpcNClsFindable over crossedRows"}; ///////////// Configurable cfgZvertex{"cfgZvertex", 10, "Min Z Vertex"}; Configurable cfgZvertexRequire{"cfgZvertexRequire", true, "Pos Z cut require"}; Configurable cfgZvertexRequireMC{"cfgZvertexRequireMC", true, "Pos Z cut require for generated particles"}; @@ -165,14 +168,18 @@ struct NucleitpcPbPb { ConfigurableAxis axisdEdx{"axisdEdx", {4000, 0, 4000}, "d#it{E}/d#it{x}"}; ConfigurableAxis axisCent{"axisCent", {100, 0, 100}, "centrality"}; ConfigurableAxis axisVtxZ{"axisVtxZ", {120, -20, 20}, "z"}; - ConfigurableAxis axisImpt{"axisImpt", {100, 0, 20}, "impact parameter"}; + ConfigurableAxis ptAxis{"ptAxis", {200, 0, 10}, "#it{p}_{T} (GeV/#it{c})"}; ConfigurableAxis axiseta{"axiseta", {100, -1, 1}, "eta"}; ConfigurableAxis axisrapidity{"axisrapidity", {100, -2, 2}, "rapidity"}; - ConfigurableAxis axismass{"axismass", {100, -10, 10}, "mass^{2}"}; + ConfigurableAxis axismass{"axismass", {100, -10, 10}, "mass"}; + ConfigurableAxis axismassnsigma{"axismassnsigma", {100, 0, 20}, "mass"}; ConfigurableAxis nsigmaAxis{"nsigmaAxis", {160, -10, 10}, "n#sigma_{#pi^{+}}"}; ConfigurableAxis speciesBitAxis{"speciesBitAxis", {8, -0.5, 7.5}, "particle type 0: pion, 1: proton, 2: deuteron, 3: triton, 4:He3, 5:He4"}; + ConfigurableAxis speciesTrackingAxis{"speciesTrackingAxis", {11, -0.5, 10.5}, "particle type 0: pion, 1: proton, 2: deuteron, 3: triton, 4:He3, 5:He4"}; ConfigurableAxis axisDCA{"axisDCA", {400, -10., 10.}, "DCA axis"}; + ConfigurableAxis particleAntiAxis{"particleAntiAxis", {2, 0, 2}, "Particle/Anti-particle"}; // 0 = particle, 1 = anti-particle + ConfigurableAxis decayTypeAxis{"decayTypeAxis", {3, 0, 3}, "Decay type"}; // 0 = primary, 1 = from decay // CCDB Service ccdb; @@ -192,6 +199,7 @@ struct NucleitpcPbPb { TRandom3 rand; float he3 = 4; float he4 = 5; + float processmaterial = 23; //---------------------------------------------------------------------------------------------------------------- void init(InitContext const&) { @@ -213,6 +221,7 @@ struct NucleitpcPbPb { histos.add("histCentFT0C", "histCentFT0C", kTH1F, {axisCent}); histos.add("histCentFT0M", "histCentFT0M", kTH1F, {axisCent}); histos.add("histCentFTOC_cut", "histCentFTOC_cut", kTH1F, {axisCent}); + histos.add("hSpectra", " ", HistType::kTHnSparseF, {speciesBitAxis, ptAxis, nsigmaAxis, {5, -2.5, 2.5}, axisCent, axisDCA, axisDCA}); } histos.add("histeta", "histeta", kTH1F, {axiseta}); histos.add("Tofsignal", "Tofsignal", kTH2F, {axisRigidity, {4000, 0.2, 1.2, "#beta"}}); @@ -224,43 +233,71 @@ struct NucleitpcPbPb { for (int i = 0; i < nParticles; i++) { TString histName = primaryParticles[i].name; if (cfgFillmass) { - hmass[2 * i] = histos.add(Form("histmass_pt/histmass_%s", histName.Data()), ";p_T{TPC} (GeV/#it{c}); mass^{2}", HistType::kTH2F, {ptAxis, axismass}); - hmass[2 * i + 1] = histos.add(Form("histmass_ptanti/histmass_%s", histName.Data()), ";p_T{TPC} (GeV/#it{c}); mass^{2}", HistType::kTH2F, {ptAxis, axismass}); + hmass[2 * i] = histos.add(Form("histmass_pt/histmass_%s", histName.Data()), ";p_T{TPC} (GeV/#it{c}); mass^{2}; centrality(%)", HistType::kTH3F, {ptAxis, axismass, axisCent}); + hmass[2 * i + 1] = histos.add(Form("histmass_ptanti/histmass_%s", histName.Data()), ";p_T{TPC} (GeV/#it{c}); mass^{2}; centrality(%)", HistType::kTH3F, {ptAxis, axismass, axisCent}); } } for (int i = 0; i < nParticles; i++) { TString histName = primaryParticles[i].name; if (cfgFillmassnsigma) { - hmassnsigma[2 * i] = histos.add(Form("histmass_nsigma/histmass_%s", histName.Data()), ";nsigma; mass^{2}", HistType::kTH2F, {nsigmaAxis, axismass}); - hmassnsigma[2 * i + 1] = histos.add(Form("histmass_nsigmaanti/histmass_%s", histName.Data()), ";p_T{TPC} (GeV/#it{c}); mass^{2}", HistType::kTH2F, {nsigmaAxis, axismass}); + hmassnsigma[2 * i] = histos.add(Form("histmass_nsigma/histmass_%s", histName.Data()), ";nsigma; mass^{2}", HistType::kTH2F, {nsigmaAxis, axismassnsigma}); + hmassnsigma[2 * i + 1] = histos.add(Form("histmass_nsigmaanti/histmass_%s", histName.Data()), ";p_T{TPC} (GeV/#it{c}); mass^{2}", HistType::kTH2F, {nsigmaAxis, axismassnsigma}); } } - histos.add("hSpectra", " ", HistType::kTHnSparseF, {speciesBitAxis, ptAxis, nsigmaAxis, {5, -2.5, 2.5}, axisCent, axisDCA, axisDCA, axisrapidity, axiseta}); - if (doprocessMC) { + histomc.add("hSpectramc", " ", HistType::kTHnSparseF, {speciesBitAxis, {5, -2.5, 2.5}, axisCent, ptAxis, ptAxis}); + + histomc.add("hDenomEffAcc", "Denominator for Efficiency x Acceptance", + {HistType::kTHnSparseF, {speciesBitAxis, ptAxis, axisrapidity, axisCent, particleAntiAxis, decayTypeAxis}}); + histomc.add("hNumerEffAcc", "Numerator for Efficiency x Acceptance", + {HistType::kTHnSparseF, {speciesBitAxis, ptAxis, axisrapidity, axisCent, particleAntiAxis, decayTypeAxis}}); + histomc.add("hDenomSignalLoss", "Denominator for Signal Loss", + {HistType::kTHnSparseF, {speciesBitAxis, ptAxis, axisrapidity, axisCent, particleAntiAxis, decayTypeAxis}}); + histomc.add("hNumerSignalLoss", "Numerator for Signal Loss", + {HistType::kTHnSparseF, {speciesBitAxis, ptAxis, axisrapidity, axisCent, particleAntiAxis, decayTypeAxis}}); + + // Material secondary histograms + histomc.add("histSecondaryMaterialHe3", "He3 from material", HistType::kTH2F, {ptAxis, axisCent}); + histomc.add("histSecondaryMaterialAntiHe3", "Anti-He3 from material", HistType::kTH2F, {ptAxis, axisCent}); + histomc.add("histSecondaryMaterialHe4", "He4 from material", HistType::kTH2F, {ptAxis, axisCent}); + histomc.add("histSecondaryMaterialAntiHe4", "Anti-He4 from material", HistType::kTH2F, {ptAxis, axisCent}); + histomc.add("histVtxZgen", "histVtxZgen", kTH1F, {axisVtxZ}); - histomc.add("ImptParameter", "ImptParameter", kTH1F, {axisImpt}); histomc.add("histEtagen", "histEtagen", kTH1F, {axiseta}); histomc.add("histPtgenHe3", "histPtgenHe3", kTH1F, {ptAxis}); histomc.add("histPtgenAntiHe3", "histPtgenAntiHe3", kTH1F, {ptAxis}); histomc.add("histPtgenHe4", "histPtgenHe4", kTH1F, {ptAxis}); histomc.add("histPtgenAntiHe4", "histPtgenAntiHe4", kTH1F, {ptAxis}); - // Reconstrcuted eta histomc.add("histNevReco", "histNevReco", kTH1F, {axisNev}); histomc.add("histVtxZReco", "histVtxZReco", kTH1F, {axisVtxZ}); histomc.add("histCentFT0CReco", "histCentFT0CReco", kTH1F, {axisCent}); histomc.add("histCentFT0MReco", "histCentFT0MReco", kTH1F, {axisCent}); - histomc.add("histPtRecoHe3", "histPtgenHe3", kTH1F, {ptAxis}); - histomc.add("histPtRecoAntiHe3", "histPtgenAntiHe3", kTH1F, {ptAxis}); - histomc.add("histPtRecoHe4", "histPtgenHe4", kTH1F, {ptAxis}); - histomc.add("histPtRecoAntiHe4", "histPtgenAntiHe4", kTH1F, {ptAxis}); histomc.add("histDeltaPtVsPtGen", " delta pt vs pt rec", HistType::kTH2F, {{1000, 0, 10}, {1000, -0.5, 0.5, "p_{T}(reco) - p_{T}(gen);p_{T}(reco)"}}); histomc.add("histDeltaPtVsPtGenanti", " delta pt vs pt rec", HistType::kTH2F, {{1000, 0, 10}, {1000, -0.5, 0.5, "p_{T}(reco) - p_{T}(gen);p_{T}(reco)"}}); - histomc.add("histPIDtrack", " delta pt vs pt rec", HistType::kTH2F, {{1000, 0, 10, "p_{T}(reco)"}, {9, -0.5, 8.5, "p_{T}(reco) - p_{T}(gen)"}}); - histomc.add("histPIDtrackanti", " delta pt vs pt rec", HistType::kTH2F, {{1000, 0, 10, "p_{T}(reco)"}, {9, -0.5, 8.5, "p_{T}(reco) - p_{T}(gen)"}}); histomc.add("histDeltaPtVsPtGenHe4", " delta pt vs pt rec", HistType::kTH2F, {{1000, 0, 10}, {1000, -0.5, 0.5, "p_{T}(reco) - p_{T}(gen);p_{T}(reco)"}}); histomc.add("histDeltaPtVsPtGenHe4anti", " delta pt vs pt rec", HistType::kTH2F, {{1000, 0, 10}, {1000, -0.5, 0.5, "p_{T}(reco) - p_{T}(gen);p_{T}(reco)"}}); + histomc.add("histPIDtrack", " delta pt vs pt rec", HistType::kTH2F, {{1000, 0, 10, "p_{T}(reco)"}, {9, -0.5, 8.5, "p_{T}(reco) - p_{T}(gen)"}}); + histomc.add("histPIDtrackanti", " delta pt vs pt rec", HistType::kTH2F, {{1000, 0, 10, "p_{T}(reco)"}, {9, -0.5, 8.5, "p_{T}(reco) - p_{T}(gen)"}}); + histomc.add("histPIDtrackhe4", " delta pt vs pt rec", HistType::kTH2F, {{1000, 0, 10, "p_{T}(reco)"}, {9, -0.5, 8.5, "p_{T}(reco) - p_{T}(gen)"}}); + histomc.add("histPIDtrackantihe4", " delta pt vs pt rec", HistType::kTH2F, {{1000, 0, 10, "p_{T}(reco)"}, {9, -0.5, 8.5, "p_{T}(reco) - p_{T}(gen)"}}); + + histomc.add("histWeakDecayPtHe3", "Pt distribution of He3 from weak decays", kTH2F, {ptAxis, axisCent}); + histomc.add("histWeakDecayPtAntiHe3", "Pt distribution of Anti-He3 from weak decays", kTH2F, {ptAxis, axisCent}); + histomc.add("histWeakDecayPtHe4", "Pt distribution of He4 from weak decays", kTH2F, {ptAxis, axisCent}); + histomc.add("histWeakDecayPtAntiHe4", "Pt distribution of Anti-He4 from weak decays", kTH2F, {ptAxis, axisCent}); + histomc.add("histRecoWeakDecayPtHe3", "Pt distribution of reconstructed He3 from weak decays", kTH2F, {ptAxis, axisCent}); + histomc.add("histRecoWeakDecayPtHe4", "Pt distribution of reconstructed He4 from weak decays", kTH2F, {ptAxis, axisCent}); + histomc.add("histRecoSecondaryMaterialHe3", "Reco He3 from material", HistType::kTH2F, {ptAxis, axisCent}); + histomc.add("histRecoSecondaryMaterialAntiHe3", "Reco Anti-He3 from material", HistType::kTH2F, {ptAxis, axisCent}); + histomc.add("histRecoSecondaryMaterialHe4", "Reco He4 from material", HistType::kTH2F, {ptAxis, axisCent}); + histomc.add("histRecoSecondaryMaterialAntiHe4", "Reco Anti-He4 from material", HistType::kTH2F, {ptAxis, axisCent}); + histomc.add("histProcessCodeHe", "Process codes for He isotopes", kTH1F, {{100, 0, 100, "process code"}}); + histomc.add("histProcess23Details", "Process 23 details", kTH2F, {{4, 0.5, 4.5, "particle type"}, {100, 0, 10, "p_{T}"}}); + histomc.add("histAllMaterialSecondariesGen", "All material secondaries (gen)", kTH3F, {{100, 0, 10, "p_{T}"}, {20, -1, 1, "y"}, {5, -0.5, 4.5, "type"}}); + histomc.add("histAllMaterialSecondariesReco", "All material secondaries (reco)", kTH3F, {{100, 0, 10, "p_{T}"}, {20, -1, 1, "y"}, {5, -0.5, 4.5, "type"}}); + + // Add axis labels for type: 0=unknown, 1=He3, 2=anti-He3, 3=He4, 4=anti-He4 } } //---------------------------------------------------------------------------------------------------------------- @@ -286,6 +323,7 @@ struct NucleitpcPbPb { if (removeNoTimeFrameBorder && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) continue; histos.fill(HIST("histCentFTOC_cut"), collision.centFT0C()); + histos.fill(HIST("histNev"), 2.5); const uint64_t collIdx = collision.globalIndex(); auto tracksByColl = tracksColl.sliceBy(perCollision, collIdx); ///////////////////////////////////////////////////////////////////////////////// @@ -320,7 +358,7 @@ struct NucleitpcPbPb { continue; if (track.tpcNClsFound() < cfgTrackPIDsettings->get(i, "minTPCnCls") && cfgTPCNClsfoundRequire) continue; - if (((track.tpcNClsCrossedRows() < cfgTrackPIDsettings->get(i, "minTPCnClsCrossedRows")) || track.tpcNClsCrossedRows() < 0.8 * track.tpcNClsFindable()) && cfgTPCNClsCrossedRowsRequire) // o2-linter: disable=magic-number (To be checked) + if (((track.tpcNClsCrossedRows() < cfgTrackPIDsettings->get(i, "minTPCnClsCrossedRows")) || track.tpcNClsCrossedRows() < cfgtpcNClsFindable * track.tpcNClsFindable()) && cfgTPCNClsCrossedRowsRequire) continue; if (track.tpcChi2NCl() > cfgTrackPIDsettings->get(i, "maxTPCchi2") && cfgmaxTPCchi2Require) continue; @@ -353,12 +391,12 @@ struct NucleitpcPbPb { histos.fill(HIST("Tpcsignal"), getRigidity(track) * track.sign(), track.tpcSignal()); if (cfgFillhspectra && cfgTrackPIDsettings2->get(i, "fillsparsh") == 1) { - histos.fill(HIST("hSpectra"), i, ptMomn, tpcNsigma, sign, collision.centFT0C(), track.dcaZ(), track.dcaXY(), getRapidity(track, i), track.eta()); + histos.fill(HIST("hSpectra"), i, ptMomn, tpcNsigma, sign, collision.centFT0C(), track.dcaZ(), track.dcaXY()); } fillhmassnsigma(track, i, tpcNsigma); if ((std::abs(tpcNsigma) > cfgTrackPIDsettings2->get(i, "maxTPCnsigmaTOF")) && cfgTrackPIDsettings2->get(i, "useTPCnsigmaTOF") < 1) continue; - fillhmass(track, i); + fillhmass(track, i, collision.centFT0C()); if (cfgRequirebetaplot) { histos.fill(HIST("Tofsignal"), getRigidity(track) * track.sign(), o2::pid::tof::Beta::GetBeta(track)); @@ -370,58 +408,246 @@ struct NucleitpcPbPb { } } PROCESS_SWITCH(NucleitpcPbPb, processData, "data analysis", false); + //---------------------------------------------------------------------------------------------------------------- - // MC particles - //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + // MC particles - Efficiency x Acceptance and Signal Loss calculations + //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- struct McCollInfo { bool passedEvSel = false; + float centrality = -1.0f; }; std::vector mcCollInfos; - void processMC(CollisionsFullMC const& collisions, aod::McCollisions const& mcCollisions, TracksFull const& tracks, aod::BCsWithTimestamps const& bcs, aod::McParticles const& particlesMC, aod::McTrackLabels const& trackLabelsMC, aod::McCollisionLabels const& collLabels, aod::TrackAssoc const& tracksColl, CollisionsFull const& colls) + + void processMC(CollisionsFullMC const& collisions, + aod::McCollisions const& mcCollisions, + TracksFull const& tracks, + aod::BCsWithTimestamps const& bcs, + aod::McParticles const& particlesMC, + aod::McTrackLabels const& trackLabelsMC, + aod::McCollisionLabels const& collLabels, + aod::TrackAssoc const& tracksColl, + CollisionsFull const& colls) { - (void)colls; - (void)collLabels; + (void)bcs; + (void)collLabels; + (void)colls; + mcCollInfos.clear(); mcCollInfos.resize(mcCollisions.size()); - // ----------------------------- Generated particles loop ----------------------------- - for (auto const& mcColl : mcCollisions) { - if (std::abs(mcColl.posZ()) > cfgZvertex && cfgZvertexRequireMC) + for (auto const& collision : collisions) { + int mcCollIdx = collision.mcCollisionId(); + if (mcCollIdx < 0 || mcCollIdx >= static_cast(mcCollisions.size())) { + continue; + } + if (std::abs(collision.posZ()) > cfgZvertex) + continue; + if (!collision.sel8()) + continue; + if (collision.centFT0C() > centcut) + continue; + + mcCollInfos[mcCollIdx].passedEvSel = true; + mcCollInfos[mcCollIdx].centrality = collision.centFT0C(); + } + for (auto const& mcCollision : mcCollisions) { + size_t idx = mcCollision.globalIndex(); + + if (idx >= mcCollInfos.size()) continue; - histomc.fill(HIST("histVtxZgen"), mcColl.posZ()); - histomc.fill(HIST("ImptParameter"), mcColl.impactParameter()); + for (auto const& mcParticle : particlesMC) { - if (mcParticle.mcCollisionId() != mcColl.globalIndex()) - continue; - if (!mcParticle.isPhysicalPrimary()) + + if (mcParticle.mcCollisionId() != mcCollision.globalIndex()) continue; + int pdgCode = mcParticle.pdgCode(); - if (std::abs(mcParticle.y()) > cfgCutRapidity && cfgrapidityRequireMC) + bool isHe3 = (std::abs(pdgCode) == particlePdgCodes.at(4)); + bool isHe4 = (std::abs(pdgCode) == particlePdgCodes.at(5)); + + if (std::abs(mcParticle.eta()) > cfgCutEta) + continue; + if (std::abs(mcParticle.y()) > cfgCutRapidity) + continue; + bool isMaterialSecondary = false; + if (!mcParticle.isPhysicalPrimary() && (isHe3 || isHe4)) { + if (!mcParticle.has_mothers()) { + isMaterialSecondary = true; + } else { + auto mother = mcParticle.mothers_as().front(); + float notmother = 1000000000; + if (std::abs(mother.pdgCode()) < notmother) { + isMaterialSecondary = true; + } + } + } + if (isHe3 || isHe4) { + histomc.fill(HIST("histProcessCodeHe"), mcParticle.getProcess()); + if (mcParticle.getProcess() == processmaterial) { + histomc.fill(HIST("histProcess23Details"), std::abs(pdgCode), mcParticle.pt()); + } + } + + if (isMaterialSecondary) { + float centrality = mcCollInfos[idx].passedEvSel ? mcCollInfos[idx].centrality : -1.0f; + + if (pdgCode == particlePdgCodes.at(4)) { + histomc.fill(HIST("histSecondaryMaterialHe3"), mcParticle.pt(), centrality); + } else if (pdgCode == -particlePdgCodes.at(4)) { + histomc.fill(HIST("histSecondaryMaterialAntiHe3"), mcParticle.pt(), centrality); + } else if (pdgCode == particlePdgCodes.at(5)) { + histomc.fill(HIST("histSecondaryMaterialHe4"), mcParticle.pt(), centrality); + } else if (pdgCode == -particlePdgCodes.at(5)) { + histomc.fill(HIST("histSecondaryMaterialAntiHe4"), mcParticle.pt(), centrality); + } + int type = 0; + if (std::abs(pdgCode) == particlePdgCodes.at(4)) + type = (pdgCode > 0) ? 1 : 2; + else if (std::abs(pdgCode) == particlePdgCodes.at(5)) + type = (pdgCode > 0) ? 3 : 4; + histomc.fill(HIST("histAllMaterialSecondariesGen"), mcParticle.pt(), mcParticle.y(), type); + } + + if (!isHe3 && !isHe4) continue; - if (std::abs(mcParticle.eta()) > cfgCutEta && cfgetaRequireMC) + + int decayType = 0; + int particleAnti = (pdgCode > 0) ? 0 : 1; + + if (mcParticle.isPhysicalPrimary()) { + decayType = 0; + if (mcParticle.has_mothers()) { + for (const auto& motherparticle : mcParticle.mothers_as()) { + if (std::find(hfMothCodes.begin(), hfMothCodes.end(), + std::abs(motherparticle.pdgCode())) != hfMothCodes.end()) { + decayType = 1; + break; + } + } + } + } else if (mcParticle.has_mothers()) { + decayType = 1; + } else { + decayType = 2; + continue; + } + bool isFromWeakDecay = (decayType == 1); + + if (!mcParticle.isPhysicalPrimary() && !isFromWeakDecay) continue; - histomc.fill(HIST("histEtagen"), mcParticle.eta()); - float ptScaled = mcParticle.pt(); + + int particleType = -1; + if (std::abs(pdgCode) == particlePdgCodes.at(4)) + particleType = he3; + else if (std::abs(pdgCode) == particlePdgCodes.at(5)) + particleType = he4; + + if (particleType >= 0) { + float centrality = mcCollInfos[idx].passedEvSel ? mcCollInfos[idx].centrality : -1.0f; + histomc.fill(HIST("hDenomSignalLoss"), particleType, mcParticle.pt(), mcParticle.y(), centrality, particleAnti, decayType); + + if (mcCollInfos[idx].passedEvSel) { + histomc.fill(HIST("hNumerSignalLoss"), particleType, mcParticle.pt(), mcParticle.y(), centrality, particleAnti, decayType); + } + } + + if (isFromWeakDecay) { + float centrality = mcCollInfos[idx].passedEvSel ? mcCollInfos[idx].centrality : -1.0f; + if (pdgCode == particlePdgCodes.at(4)) { + histomc.fill(HIST("histWeakDecayPtHe3"), mcParticle.pt(), centrality); + } else if (pdgCode == -particlePdgCodes.at(4)) { + histomc.fill(HIST("histWeakDecayPtAntiHe3"), mcParticle.pt(), centrality); + } else if (pdgCode == particlePdgCodes.at(5)) { + histomc.fill(HIST("histWeakDecayPtHe4"), mcParticle.pt(), centrality); + } else if (pdgCode == -particlePdgCodes.at(5)) { + histomc.fill(HIST("histWeakDecayPtAntiHe4"), mcParticle.pt(), centrality); + } + } if (pdgCode == particlePdgCodes.at(4)) { - histomc.fill(HIST("histPtgenHe3"), ptScaled); + histomc.fill(HIST("histPtgenHe3"), mcParticle.pt()); } else if (pdgCode == -particlePdgCodes.at(4)) { - histomc.fill(HIST("histPtgenAntiHe3"), ptScaled); + histomc.fill(HIST("histPtgenAntiHe3"), mcParticle.pt()); } else if (pdgCode == particlePdgCodes.at(5)) { - histomc.fill(HIST("histPtgenHe4"), ptScaled); + histomc.fill(HIST("histPtgenHe4"), mcParticle.pt()); } else if (pdgCode == -particlePdgCodes.at(5)) { - histomc.fill(HIST("histPtgenAntiHe4"), ptScaled); + histomc.fill(HIST("histPtgenAntiHe4"), mcParticle.pt()); } - } // mc track loop generated - } // mc collision loop generated - // ----------------------------- Reconstructed track loop ----------------------------- + } + } + for (auto const& mcCollision : mcCollisions) { + size_t idx = mcCollision.globalIndex(); + + if (idx >= mcCollInfos.size()) + continue; + if (!mcCollInfos[idx].passedEvSel) + continue; + if (std::abs(mcCollision.posZ()) > cfgZvertex) + continue; + + histomc.fill(HIST("histVtxZgen"), mcCollision.posZ()); + float centrality = mcCollInfos[idx].centrality; + + for (auto const& mcParticle : particlesMC) { + if (mcParticle.mcCollisionId() != mcCollision.globalIndex()) + continue; + + int pdgCode = mcParticle.pdgCode(); + bool isHe3 = (std::abs(pdgCode) == particlePdgCodes.at(4)); + bool isHe4 = (std::abs(pdgCode) == particlePdgCodes.at(5)); + + if (!isHe3 && !isHe4) + continue; + if (std::abs(mcParticle.eta()) > cfgCutEta) + continue; + if (std::abs(mcParticle.y()) > cfgCutRapidity) + continue; + + int decayType = 0; + int particleAnti = (pdgCode > 0) ? 0 : 1; + + if (mcParticle.isPhysicalPrimary()) { + decayType = 0; + if (mcParticle.has_mothers()) { + for (const auto& motherparticle : mcParticle.mothers_as()) { + if (std::find(hfMothCodes.begin(), hfMothCodes.end(), + std::abs(motherparticle.pdgCode())) != hfMothCodes.end()) { + decayType = 1; + break; + } + } + } + } else if (mcParticle.has_mothers()) { + decayType = 1; + } else { + decayType = 2; + continue; + } + bool isFromWeakDecay = (decayType == 1); + + if (!mcParticle.isPhysicalPrimary() && !isFromWeakDecay) + continue; + + int particleType = -1; + if (std::abs(pdgCode) == particlePdgCodes.at(4)) + particleType = he3; + else if (std::abs(pdgCode) == particlePdgCodes.at(5)) + particleType = he4; + + if (particleType >= 0) { + histomc.fill(HIST("hDenomEffAcc"), particleType, mcParticle.pt(), mcParticle.y(), centrality, particleAnti, decayType); + } + } + } for (auto const& collision : collisions) { auto mcCollIdx = collision.mcCollisionId(); - if (mcCollIdx < 0 || mcCollIdx >= mcCollisions.size()) + if (mcCollIdx < 0 || mcCollIdx >= static_cast(mcCollisions.size())) continue; + auto bc = collision.bc_as(); initCCDB(bc); collHasCandidate = false; histomc.fill(HIST("histNevReco"), 0.5); + if (std::abs(collision.posZ()) > cfgZvertex && cfgZvertexRequire) continue; collPassedEvSel = collision.sel8(); @@ -444,17 +670,74 @@ struct NucleitpcPbPb { continue; if (removeNoTimeFrameBorder && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) continue; - // Loop through TrackAssoc and check if this track belongs to the current collision for (const auto& assoc : tracksColl) { if (assoc.collisionId() != collision.globalIndex()) continue; const auto& track = tracks.rawIteratorAt(assoc.trackId()); auto labelRow = trackLabelsMC.iteratorAt(track.globalIndex()); int label = labelRow.mcParticleId(); - if (label < 0 || label >= particlesMC.size()) + if (label < 0 || label >= static_cast(particlesMC.size())) continue; auto const& matchedMCParticle = particlesMC.iteratorAt(label); + int pdg = matchedMCParticle.pdgCode(); + bool isHe3 = (std::abs(pdg) == particlePdgCodes.at(4)); + bool isHe4 = (std::abs(pdg) == particlePdgCodes.at(5)); + + bool isMaterialSecondary = false; + if ((isHe3 || isHe4) && !matchedMCParticle.isPhysicalPrimary()) { + + if (matchedMCParticle.getProcess() == processmaterial) { // kPMaterial + isMaterialSecondary = true; + } else if (!matchedMCParticle.has_mothers()) { + isMaterialSecondary = true; + } + } + + if (isMaterialSecondary) { + if (pdg == particlePdgCodes.at(4)) { + histomc.fill(HIST("histRecoSecondaryMaterialHe3"), track.pt(), collision.centFT0C()); + } else if (pdg == -particlePdgCodes.at(4)) { + histomc.fill(HIST("histRecoSecondaryMaterialAntiHe3"), track.pt(), collision.centFT0C()); + } else if (pdg == particlePdgCodes.at(5)) { + histomc.fill(HIST("histRecoSecondaryMaterialHe4"), track.pt(), collision.centFT0C()); + } else if (pdg == -particlePdgCodes.at(5)) { + histomc.fill(HIST("histRecoSecondaryMaterialAntiHe4"), track.pt(), collision.centFT0C()); + } + + int type = 0; + if (std::abs(pdg) == particlePdgCodes.at(4)) + type = (pdg > 0) ? 1 : 2; + else if (std::abs(pdg) == particlePdgCodes.at(5)) + type = (pdg > 0) ? 3 : 4; + histomc.fill(HIST("histAllMaterialSecondariesReco"), track.pt(), getRapidity(track, he3), type); + + if (!cfgIncludeMaterialInEfficiency) { + continue; + } + } + int decayType = 0; + bool isFromWeakDecay = false; + + if (matchedMCParticle.isPhysicalPrimary()) { + decayType = 0; + if (matchedMCParticle.has_mothers()) { + for (const auto& motherparticle : matchedMCParticle.mothers_as()) { + if (std::find(hfMothCodes.begin(), hfMothCodes.end(), + std::abs(motherparticle.pdgCode())) != hfMothCodes.end()) { + isFromWeakDecay = true; + decayType = 1; + break; + } + } + } + } else if (matchedMCParticle.has_mothers()) { + isFromWeakDecay = true; + decayType = 1; + } else { + decayType = 2; + } + if (!track.isPVContributor() && cfgUsePVcontributors) continue; if (!track.hasITS() && cfgITSrequire) @@ -467,12 +750,12 @@ struct NucleitpcPbPb { continue; if (std::abs(track.eta()) > cfgCutEta && cfgetaRequire) continue; - if (!matchedMCParticle.isPhysicalPrimary()) + if (!matchedMCParticle.isPhysicalPrimary() && !isFromWeakDecay && !isMaterialSecondary) continue; + for (size_t i = 0; i < primaryParticles.size(); i++) { if (std::abs(pdg) != std::abs(particlePdgCodes.at(i))) continue; - float ptMomn; setTrackParCov(track, mTrackParCov); mTrackParCov.setPID(track.pidForTracking()); @@ -488,7 +771,7 @@ struct NucleitpcPbPb { continue; if (track.tpcNClsFound() < cfgTrackPIDsettings->get(i, "minTPCnCls") && cfgTPCNClsfoundRequire) continue; - if (((track.tpcNClsCrossedRows() < cfgTrackPIDsettings->get(i, "minTPCnClsCrossedRows")) || track.tpcNClsCrossedRows() < 0.8 * track.tpcNClsFindable()) && cfgTPCNClsCrossedRowsRequire) // o2-linter: disable=magic-number (To be checked) + if (((track.tpcNClsCrossedRows() < cfgTrackPIDsettings->get(i, "minTPCnClsCrossedRows")) || track.tpcNClsCrossedRows() < cfgtpcNClsFindable * track.tpcNClsFindable()) && cfgTPCNClsCrossedRowsRequire) continue; if (track.tpcChi2NCl() > cfgTrackPIDsettings->get(i, "maxTPCchi2") && cfgmaxTPCchi2Require) continue; @@ -506,7 +789,7 @@ struct NucleitpcPbPb { if (getMeanItsClsSize(track) < cfgTrackPIDsettings->get(i, "minITSclsSize") && cfgminGetMeanItsClsSizeRequire) continue; - bool insideDCAxy = (std::abs(track.dcaXY()) <= (cfgTrackPIDsettings->get(i, "maxDcaXY") * (0.0105f + 0.0350f / std::pow(ptMomn, 1.1f)))); // o2-linter: disable=magic-number (To be checked) + bool insideDCAxy = (std::abs(track.dcaXY()) <= (cfgTrackPIDsettings->get(i, "maxDcaXY") * (0.0105f + 0.0350f / std::pow(ptMomn, 1.1f)))); if ((!(insideDCAxy) || std::abs(track.dcaZ()) > dcazSigma(ptMomn, cfgTrackPIDsettings->get(i, "maxDcaZ"))) && cfgDCAwithptRequire) continue; @@ -518,24 +801,25 @@ struct NucleitpcPbPb { continue; if (itsSigma > cfgTrackPIDsettings2->get(i, "maxITSnsigma") && cfgTrackPIDsettings2->get(i, "useITSnsigma") < 1) continue; - histos.fill(HIST("Tpcsignal"), getRigidity(track) * track.sign(), track.tpcSignal()); + float ptReco; + mTrackParCov.setPID(track.pidForTracking()); + ptReco = (std::abs(pdg) == particlePdgCodes.at(4) || std::abs(pdg) == particlePdgCodes.at(5)) ? 2 * mTrackParCov.getPt() : mTrackParCov.getPt(); - if (cfgFillhspectra && cfgTrackPIDsettings2->get(i, "fillsparsh") == 1) { - histos.fill(HIST("hSpectra"), i, ptMomn, tpcNsigma, sign, collision.centFT0C(), track.dcaZ(), track.dcaXY(), getRapidity(track, i), track.eta()); - } - fillhmassnsigma(track, i, tpcNsigma); - if ((std::abs(tpcNsigma) > cfgTrackPIDsettings2->get(i, "maxTPCnsigmaTOF")) && cfgTrackPIDsettings2->get(i, "useTPCnsigmaTOF") < 1) - continue; - fillhmass(track, i); + int particleAnti = (pdg > 0) ? 0 : 1; - if (cfgRequirebetaplot) { - histos.fill(HIST("Tofsignal"), getRigidity(track) * track.sign(), o2::pid::tof::Beta::GetBeta(track)); + if (i == he3 || i == he4) { + histomc.fill(HIST("hNumerEffAcc"), i, matchedMCParticle.pt(), matchedMCParticle.y(), collision.centFT0C(), particleAnti, decayType); + } + if (isFromWeakDecay) { + if (std::abs(pdg) == particlePdgCodes.at(4)) { + histomc.fill(HIST("histRecoWeakDecayPtHe3"), ptReco, collision.centFT0C()); + } else if (std::abs(pdg) == particlePdgCodes.at(5)) { + histomc.fill(HIST("histRecoWeakDecayPtHe4"), ptReco, collision.centFT0C()); + } } - /*----------------------------------------------------------------------------------------------------------------*/ - float ptReco; - mTrackParCov.setPID(track.pidForTracking()); - ptReco = (std::abs(pdg) == particlePdgCodes.at(4) || std::abs(pdg) == particlePdgCodes.at(5)) ? 2 * mTrackParCov.getPt() : mTrackParCov.getPt(); + histos.fill(HIST("Tpcsignal"), getRigidity(track) * track.sign(), track.tpcSignal()); + if (pdg == -particlePdgCodes.at(5) && cfgmccorrectionhe4Require) { ptReco = ptReco + 0.00765 + 0.503791 * std::exp(-1.10517 * ptReco); } @@ -545,10 +829,10 @@ struct NucleitpcPbPb { int antitriton = 6; if (pidGuess == antitriton) { ptReco = ptReco - 0.464215 + 0.195771 * ptReco - 0.0183111 * ptReco * ptReco; - // LOG(info) << "we have he3" << pidGuess; } } float ptGen = matchedMCParticle.pt(); + float deltaPt = ptReco - ptGen; if (pdg == -particlePdgCodes.at(4)) { @@ -559,31 +843,37 @@ struct NucleitpcPbPb { histomc.fill(HIST("histDeltaPtVsPtGen"), ptReco, deltaPt); histomc.fill(HIST("histPIDtrack"), ptReco, track.pidForTracking()); } - if (pdg == -particlePdgCodes.at(5)) { histomc.fill(HIST("histDeltaPtVsPtGenHe4anti"), ptReco, deltaPt); + histomc.fill(HIST("histPIDtrackantihe4"), ptReco, track.pidForTracking()); } if (pdg == particlePdgCodes.at(5)) { histomc.fill(HIST("histDeltaPtVsPtGenHe4"), ptReco, deltaPt); + histomc.fill(HIST("histPIDtrackhe4"), ptReco, track.pidForTracking()); } - if (pdg == particlePdgCodes.at(4)) { - histomc.fill(HIST("histPtRecoHe3"), ptReco); - } else if (pdg == -particlePdgCodes.at(4)) { - histomc.fill(HIST("histPtRecoAntiHe3"), ptReco); - } else if (pdg == particlePdgCodes.at(5)) { - histomc.fill(HIST("histPtRecoHe4"), ptReco); - } else if (pdg == -particlePdgCodes.at(5)) { - histomc.fill(HIST("histPtRecoAntiHe4"), ptReco); + // For TOF matching efficiency + float ptTOF = -1.0; // Default: no TOF + if (track.hasTOF()) { + ptTOF = ptReco; } - } + + if (cfgTrackPIDsettings2->get(i, "fillsparsh") == 1) { + histomc.fill(HIST("hSpectramc"), i, sign, collision.centFT0C(), + ptReco, ptTOF); + } + + if (cfgRequirebetaplot) { + histos.fill(HIST("Tofsignal"), getRigidity(track) * track.sign(), o2::pid::tof::Beta::GetBeta(track)); + } + } // loop over primaryParticles types histos.fill(HIST("histeta"), track.eta()); - /*----------------------------------------------------------------------------------------------------------------*/ - } // Track loop + } // TrackAssoc loop } // Collision loop } - PROCESS_SWITCH(NucleitpcPbPb, processMC, "MC reco+gen analysis", false); - //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + + PROCESS_SWITCH(NucleitpcPbPb, processMC, "MC reco+gen analysis with efficiency corrections", false); + //=-=-=-==-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= void initCCDB(aod::BCsWithTimestamps::iterator const& bc) { if (mRunNumber == bc.runNumber()) { @@ -639,7 +929,7 @@ struct NucleitpcPbPb { } //---------------------------------------------------------------------------------------------------------------- template - void fillhmass(T const& track, int species) + void fillhmass(T const& track, int species, float cent) { if (!track.hasTOF() || !cfgFillmass) return; @@ -652,15 +942,15 @@ struct NucleitpcPbPb { float massTOF = p * charge * std::sqrt(1.f / (beta * beta) - 1.f); // get PDG mass float pdgMass = particleMasses[species]; - float massDiff = massTOF * massTOF - pdgMass * pdgMass; + float massDiff = massTOF - pdgMass; float ptMomn; setTrackParCov(track, mTrackParCov); mTrackParCov.setPID(track.pidForTracking()); ptMomn = (species == he3 || species == he4) ? 2 * mTrackParCov.getPt() : mTrackParCov.getPt(); if (track.sign() > 0) { - hmass[2 * species]->Fill(ptMomn, massDiff); + hmass[2 * species]->Fill(ptMomn, massDiff, cent); } else if (track.sign() < 0) { - hmass[2 * species + 1]->Fill(ptMomn, massDiff); + hmass[2 * species + 1]->Fill(ptMomn, massDiff, cent); } } //---------------------------------------------------------------------------------------------------------------- @@ -674,16 +964,14 @@ struct NucleitpcPbPb { if (beta < eps || beta > 1.0f - eps) return; float charge = (species == he3 || species == he4) ? 2.f : 1.f; - float p = getRigidity(track); // assuming this is the momentum from inner TPC + float p = getRigidity(track); float massTOF = p * charge * std::sqrt(1.f / (beta * beta) - 1.f); // get PDG mass - float pdgMass = particleMasses[species]; - float massDiff = massTOF * massTOF - pdgMass * pdgMass; - + float masssquare = massTOF * massTOF; if (track.sign() > 0) { - hmassnsigma[2 * species]->Fill(sigma, massDiff); + hmassnsigma[2 * species]->Fill(sigma, masssquare); } else if (track.sign() < 0) { - hmassnsigma[2 * species + 1]->Fill(sigma, massDiff); + hmassnsigma[2 * species + 1]->Fill(sigma, masssquare); } } //---------------------------------------------------------------------------------------------------------------- From 7dcd0f966071092fbd4d90d7d6acf5280c07b17e Mon Sep 17 00:00:00 2001 From: spucillo <93769017+spucillo@users.noreply.github.com> Date: Sat, 6 Sep 2025 13:11:21 +0200 Subject: [PATCH 335/986] [PWGLF] Add the subscription to CascadeMCCores in the processMonteCarloRec process function (#12890) --- PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx b/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx index 2453c10309a..08474177861 100644 --- a/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx +++ b/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx @@ -826,7 +826,7 @@ struct CascadeAnalysisLightIonsDerivedData { PROCESS_SWITCH(CascadeAnalysisLightIonsDerivedData, processData, "Process data", true); - void processMonteCarloRec(SimCollisions const& RecCols, CascadeMCCandidates const& fullCascades, DaughterTracks const&) + void processMonteCarloRec(SimCollisions const& RecCols, CascadeMCCandidates const& fullCascades, DaughterTracks const&, CascadeMCCores const&) { for (const auto& RecCol : RecCols) { // Fill event counter before event selection From 84c47fc89fd4e3be8adeaf2b621cb42165d78a5c Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sat, 6 Sep 2025 14:19:55 +0200 Subject: [PATCH 336/986] [Common] Enable interdependency autoenable (#12887) Co-authored-by: ALICE Builder --- Common/Tools/TrackPropagationModule.h | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Common/Tools/TrackPropagationModule.h b/Common/Tools/TrackPropagationModule.h index a08ec358993..1c5f681623e 100644 --- a/Common/Tools/TrackPropagationModule.h +++ b/Common/Tools/TrackPropagationModule.h @@ -113,20 +113,35 @@ class TrackPropagationModule fillTracksDCA = isTableRequiredInWorkflow(initContext, "TracksDCA"); fillTracksDCACov = isTableRequiredInWorkflow(initContext, "TracksDCACov"); + // enable Tracks in case Tracks have been requested + if (fillTracksDCA) { + LOGF(info, "******************************************************************"); + LOGF(info, " There is no task subscribed to Tracks, but I have detected a"); + LOGF(info, " subscription to TracksDCA. Now enabling tracks as algorithmic"); + LOGF(info, " dependency. Note: please be sure this is intentional! For"); + LOGF(info, " secondary analyses, the proper DCA to test against is the DCA"); + LOGF(info, " that the V0 or Cascade is assigned to and not necessarily the"); + LOGF(info, " the one that the Track is assigned to (if any). "); + LOGF(info, "******************************************************************"); + fillTracks = true; + } + if (!fillTracks) { LOGF(info, "Track propagation to PV not required. Suppressing all further processing and logs."); } LOGF(info, " Track propagation table detection results:"); - LOGF(info, " ---> Will generate Tracks table."); + if (fillTracks) { + LOGF(info, " ---> Will generate Tracks table."); + } if (fillTracksCov) { - LOGF(info, "---> Will generate TracksCov table."); + LOGF(info, " ---> Will generate TracksCov table."); } if (fillTracksDCA) { - LOGF(info, "---> Will generate TracksDCA table."); + LOGF(info, " ---> Will generate TracksDCA table."); } if (fillTracksDCACov) { - LOGF(info, "---> Will generate TracksDCACov table."); + LOGF(info, " ---> Will generate TracksDCACov table."); } if (fillTracksCov) { LOGF(info, "**************************************************************"); From a37e9cca5aaba19dd75b30e0ce3589a69657a43a Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Sat, 6 Sep 2025 16:32:28 +0200 Subject: [PATCH 337/986] [PWGLF] Add new histogram for spin correlation (#12889) --- .../Strangeness/lambdaspincorrderived.cxx | 115 ++++++++++++------ 1 file changed, 80 insertions(+), 35 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx index 3a350f5b6d0..9bf238cec25 100644 --- a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx @@ -109,6 +109,8 @@ struct lambdaspincorrderived { ConfigurableAxis configThnAxisR{"configThnAxisR", {80, 0.0, 8.0}, "#it{R}"}; ConfigurableAxis configThnAxisPol{"configThnAxisPol", {80, 0.0, 8.0}, "cos#it{#theta *}"}; ConfigurableAxis configThnAxisCentrality{"configThnAxisCentrality", {8, 0.0, 80.0}, "Centrality"}; + ConfigurableAxis configThnAxisRapidity{"configThnAxisRapidity", {5, 0.0, 1.0}, "Rapidity"}; + ConfigurableAxis configThnAxisPhi{"configThnAxisPhi", {18, 0.0, 2.0 * TMath::Pi()}, "Phi"}; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; void init(o2::framework::InitContext&) @@ -131,15 +133,35 @@ struct lambdaspincorrderived { histos.add("hLambdaMixForALL", "hLambdaMixForALL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); histos.add("hAntiLambdaMixForALAL", "hAntiLambdaMixForALAL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - histos.add("hSparseLambdaLambda", "hSparseLambdaLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisCentrality, configThnAxisR}, true); - histos.add("hSparseLambdaAntiLambda", "hSparseLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisCentrality, configThnAxisR}, true); - histos.add("hSparseAntiLambdaLambda", "hSparseAntiLambdLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisCentrality, configThnAxisR}, true); - histos.add("hSparseAntiLambdaAntiLambda", "hSparseAntiLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisCentrality, configThnAxisR}, true); + histos.add("hSparseLambdaLambda", "hSparseLambdaLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisR}, true); + histos.add("hSparseLambdaAntiLambda", "hSparseLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisR}, true); + histos.add("hSparseAntiLambdaLambda", "hSparseAntiLambdLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisR}, true); + histos.add("hSparseAntiLambdaAntiLambda", "hSparseAntiLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisR}, true); - histos.add("hSparseLambdaLambdaMixed", "hSparseLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisCentrality, configThnAxisR}, true); - histos.add("hSparseLambdaAntiLambdaMixed", "hSparseLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisCentrality, configThnAxisR}, true); - histos.add("hSparseAntiLambdaLambdaMixed", "hSparseAntiLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisCentrality, configThnAxisR}, true); - histos.add("hSparseAntiLambdaAntiLambdaMixed", "hSparseAntiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisCentrality, configThnAxisR}, true); + histos.add("hSparseLambdaLambdaMixed", "hSparseLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity, configThnAxisR}, true); + histos.add("hSparseLambdaAntiLambdaMixed", "hSparseLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity, configThnAxisR}, true); + histos.add("hSparseAntiLambdaLambdaMixed", "hSparseAntiLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity, configThnAxisR}, true); + histos.add("hSparseAntiLambdaAntiLambdaMixed", "hSparseAntiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity, configThnAxisR}, true); + + histos.add("hSparseRapLambdaLambda", "hSparseRapLambdaLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); + histos.add("hSparseRapLambdaAntiLambda", "hSparseRapLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); + histos.add("hSparseRapAntiLambdaLambda", "hSparseRapAntiLambdLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); + histos.add("hSparseRapAntiLambdaAntiLambda", "hSparseRapAntiLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); + + histos.add("hSparseRapLambdaLambdaMixed", "hSparseRapLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); + histos.add("hSparseRapLambdaAntiLambdaMixed", "hSparseRapLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); + histos.add("hSparseRapAntiLambdaLambdaMixed", "hSparseRapAntiLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); + histos.add("hSparseRapAntiLambdaAntiLambdaMixed", "hSparseRapAntiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); + + histos.add("hSparsePhiLambdaLambda", "hSparsePhiLambdaLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPhi}, true); + histos.add("hSparsePhiLambdaAntiLambda", "hSparsePhiLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPhi}, true); + histos.add("hSparsePhiAntiLambdaLambda", "hSparsePhiAntiLambdLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPhi}, true); + histos.add("hSparsePhiAntiLambdaAntiLambda", "hSparsePhiAntiLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPhi}, true); + + histos.add("hSparsePhiLambdaLambdaMixed", "hSparsePhiLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPhi}, true); + histos.add("hSparsePhiLambdaAntiLambdaMixed", "hSparsePhiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPhi}, true); + histos.add("hSparsePhiAntiLambdaLambdaMixed", "hSparsePhiAntiLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPhi}, true); + histos.add("hSparsePhiAntiLambdaAntiLambdaMixed", "hSparsePhiAntiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPhi}, true); ccdb->setURL(cfgCcdbParam.cfgURL); ccdbApi.init("http://alice-ccdb.cern.ch"); @@ -147,10 +169,12 @@ struct lambdaspincorrderived { ccdb->setLocalObjectValidityChecking(); ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); LOGF(info, "Getting alignment offsets from the CCDB..."); - hweight1 = ccdb->getForTimeStamp(ConfWeightPathLL.value, cfgCcdbParam.nolaterthan.value); - hweight2 = ccdb->getForTimeStamp(ConfWeightPathLAL.value, cfgCcdbParam.nolaterthan.value); - hweight3 = ccdb->getForTimeStamp(ConfWeightPathALL.value, cfgCcdbParam.nolaterthan.value); - hweight4 = ccdb->getForTimeStamp(ConfWeightPathALAL.value, cfgCcdbParam.nolaterthan.value); + if (useweight) { + hweight1 = ccdb->getForTimeStamp(ConfWeightPathLL.value, cfgCcdbParam.nolaterthan.value); + hweight2 = ccdb->getForTimeStamp(ConfWeightPathLAL.value, cfgCcdbParam.nolaterthan.value); + hweight3 = ccdb->getForTimeStamp(ConfWeightPathALL.value, cfgCcdbParam.nolaterthan.value); + hweight4 = ccdb->getForTimeStamp(ConfWeightPathALAL.value, cfgCcdbParam.nolaterthan.value); + } } template @@ -214,7 +238,7 @@ struct lambdaspincorrderived { void fillHistograms(int tag1, int tag2, const ROOT::Math::PtEtaPhiMVector& particle1, const ROOT::Math::PtEtaPhiMVector& particle2, const ROOT::Math::PtEtaPhiMVector& daughpart1, const ROOT::Math::PtEtaPhiMVector& daughpart2, - double centrality, int datatype, float mixpairweight) + int datatype, float mixpairweight) { auto lambda1Mass = 0.0; @@ -249,24 +273,36 @@ struct lambdaspincorrderived { auto cosThetaDiff = -999.0; cosThetaDiff = proton1LambdaRF.Vect().Unit().Dot(proton2LambdaRF.Vect().Unit()); + + auto costhetaz1costhetaz2 = (proton1LambdaRF.Pz() * proton2LambdaRF.Pz()) / (proton1LambdaRF.P() * proton2LambdaRF.P()); + double deltaPhi = std::abs(RecoDecay::constrainAngle(particle1Dummy.Phi(), 0.0F, harmonic) - RecoDecay::constrainAngle(particle2Dummy.Phi(), 0.0F, harmonic)); double deltaEta = particle1Dummy.Eta() - particle2Dummy.Eta(); + double deltaRap = std::abs(particle1Dummy.Rapidity() - particle2Dummy.Rapidity()); double deltaR = TMath::Sqrt(deltaEta * deltaEta + deltaPhi * deltaPhi); if (datatype == 0) { mixpairweight = 1.0; histos.fill(HIST("hPtYSame"), particle1.Pt(), particle1.Rapidity(), mixpairweight); if (tag1 == 0 && tag2 == 0) { - histos.fill(HIST("hSparseLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR, mixpairweight); + histos.fill(HIST("hSparseLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); + histos.fill(HIST("hSparseRapLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); + histos.fill(HIST("hSparsePhiLambdaLambda"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, mixpairweight); histos.fill(HIST("hLambdaSameForLL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), mixpairweight); } else if (tag1 == 0 && tag2 == 1) { - histos.fill(HIST("hSparseLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR, mixpairweight); + histos.fill(HIST("hSparseLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); + histos.fill(HIST("hSparseRapLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); + histos.fill(HIST("hSparsePhiLambdaAntiLambda"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, mixpairweight); histos.fill(HIST("hLambdaSameForLAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), mixpairweight); } else if (tag1 == 1 && tag2 == 0) { - histos.fill(HIST("hSparseAntiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR, mixpairweight); + histos.fill(HIST("hSparseAntiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); + histos.fill(HIST("hSparseRapAntiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); + histos.fill(HIST("hSparsePhiAntiLambdaLambda"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, mixpairweight); histos.fill(HIST("hLambdaSameForALL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), mixpairweight); } else if (tag1 == 1 && tag2 == 1) { - histos.fill(HIST("hSparseAntiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR, mixpairweight); + histos.fill(HIST("hSparseAntiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); + histos.fill(HIST("hSparseRapAntiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); + histos.fill(HIST("hSparsePhiAntiLambdaAntiLambda"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, mixpairweight); histos.fill(HIST("hAntiLambdaSameForALAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), mixpairweight); } } else if (datatype == 1) { @@ -282,16 +318,25 @@ struct lambdaspincorrderived { } histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity()); if (tag1 == 0 && tag2 == 0) { - histos.fill(HIST("hSparseLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR, weight1); + histos.fill(HIST("hSparseLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight1); + histos.fill(HIST("hSparseRapLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight1); + histos.fill(HIST("hSparsePhiLambdaLambdaMixed"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, weight1); histos.fill(HIST("hLambdaMixForLL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), weight1); } else if (tag1 == 0 && tag2 == 1) { - histos.fill(HIST("hSparseLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR, weight2); + histos.fill(HIST("hSparseLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight2); + histos.fill(HIST("hSparseRapLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight2); + histos.fill(HIST("hSparsePhiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, weight2); histos.fill(HIST("hLambdaMixForLAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), weight2); } else if (tag1 == 1 && tag2 == 0) { - histos.fill(HIST("hSparseAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR, weight3); + histos.fill(HIST("hSparseAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight3); + histos.fill(HIST("hSparseRapAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight3); + histos.fill(HIST("hSparsePhiAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, weight3); + histos.fill(HIST("hLambdaMixForALL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), weight3); } else if (tag1 == 1 && tag2 == 1) { - histos.fill(HIST("hSparseAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR, weight4); + histos.fill(HIST("hSparseAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight4); + histos.fill(HIST("hSparseRapAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight4); + histos.fill(HIST("hSparsePhiAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, weight4); histos.fill(HIST("hAntiLambdaMixForALAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), weight4); } } @@ -334,16 +379,16 @@ struct lambdaspincorrderived { lambda2 = ROOT::Math::PtEtaPhiMVector(v02.lambdaPt(), v02.lambdaEta(), v02.lambdaPhi(), v02.lambdaMass()); histos.fill(HIST("deltaPhiSame"), std::abs(RecoDecay::constrainAngle(v0.lambdaPhi(), 0.0F, harmonic) - RecoDecay::constrainAngle(v02.lambdaPhi(), 0.0F, harmonic))); if (v0.v0Status() == 0 && v02.v0Status() == 0) { - fillHistograms(0, 0, lambda, lambda2, proton, proton2, centrality, 0, 1.0); + fillHistograms(0, 0, lambda, lambda2, proton, proton2, 0, 1.0); } if (v0.v0Status() == 0 && v02.v0Status() == 1) { - fillHistograms(0, 1, lambda, lambda2, proton, proton2, centrality, 0, 1.0); + fillHistograms(0, 1, lambda, lambda2, proton, proton2, 0, 1.0); } if (v0.v0Status() == 1 && v02.v0Status() == 0) { - fillHistograms(1, 0, lambda, lambda2, proton, proton2, centrality, 0, 1.0); + fillHistograms(1, 0, lambda, lambda2, proton, proton2, 0, 1.0); } if (v0.v0Status() == 1 && v02.v0Status() == 1) { - fillHistograms(1, 1, lambda, lambda2, proton, proton2, centrality, 0, 1.0); + fillHistograms(1, 1, lambda, lambda2, proton, proton2, 0, 1.0); } } } @@ -361,7 +406,7 @@ struct lambdaspincorrderived { std::vector t1Used; for (auto& [collision1, collision2] : selfCombinations(colBinning, nEvtMixing, -1, collisions, collisions)) { // LOGF(info, "Mixed event collisions: (%d, %d)", collision1.index(), collision2.index()); - auto centrality = collision1.cent(); + // auto centrality = collision1.cent(); auto groupV01 = V0s.sliceBy(tracksPerCollisionV0, collision1.index()); auto groupV02 = V0s.sliceBy(tracksPerCollisionV0, collision1.index()); auto groupV03 = V0s.sliceBy(tracksPerCollisionV0, collision2.index()); @@ -406,16 +451,16 @@ struct lambdaspincorrderived { lambda2 = ROOT::Math::PtEtaPhiMVector(t2.lambdaPt(), t2.lambdaEta(), t2.lambdaPhi(), t2.lambdaMass()); histos.fill(HIST("deltaPhiMix"), std::abs(RecoDecay::constrainAngle(t3.lambdaPhi(), 0.0F, harmonic) - RecoDecay::constrainAngle(t2.lambdaPhi(), 0.0F, harmonic))); if (t3.v0Status() == 0 && t2.v0Status() == 0) { - fillHistograms(0, 0, lambda, lambda2, proton, proton2, centrality, 1, 1.0); + fillHistograms(0, 0, lambda, lambda2, proton, proton2, 1, 1.0); } if (t3.v0Status() == 0 && t2.v0Status() == 1) { - fillHistograms(0, 1, lambda, lambda2, proton, proton2, centrality, 1, 1.0); + fillHistograms(0, 1, lambda, lambda2, proton, proton2, 1, 1.0); } if (t3.v0Status() == 1 && t2.v0Status() == 0) { - fillHistograms(1, 0, lambda, lambda2, proton, proton2, centrality, 1, 1.0); + fillHistograms(1, 0, lambda, lambda2, proton, proton2, 1, 1.0); } if (t3.v0Status() == 1 && t2.v0Status() == 1) { - fillHistograms(1, 1, lambda, lambda2, proton, proton2, centrality, 1, 1.0); + fillHistograms(1, 1, lambda, lambda2, proton, proton2, 1, 1.0); } } } // replacement track pair @@ -431,7 +476,7 @@ struct lambdaspincorrderived { for (auto& collision1 : collisions) { int bin = colBinning.getBin(std::make_tuple(collision1.posz(), collision1.cent())); auto poolA = V0s.sliceBy(tracksPerCollisionV0, collision1.index()); - float centrality = collision1.cent(); + // float centrality = collision1.cent(); // <<< CHANGED: map old collision index → set of (t2.idx, t3.idx) we've already filled std::unordered_map>> seenMap; @@ -486,16 +531,16 @@ struct lambdaspincorrderived { histos.fill(HIST("deltaPhiMix"), dPhi, invN); if (t3.v0Status() == 0 && t2.v0Status() == 0) { - fillHistograms(0, 0, lambda, lambda2, proton, proton2, centrality, 1, invN); + fillHistograms(0, 0, lambda, lambda2, proton, proton2, 1, invN); } if (t3.v0Status() == 0 && t2.v0Status() == 1) { - fillHistograms(0, 1, lambda, lambda2, proton, proton2, centrality, 1, invN); + fillHistograms(0, 1, lambda, lambda2, proton, proton2, 1, invN); } if (t3.v0Status() == 1 && t2.v0Status() == 0) { - fillHistograms(1, 0, lambda, lambda2, proton, proton2, centrality, 1, invN); + fillHistograms(1, 0, lambda, lambda2, proton, proton2, 1, invN); } if (t3.v0Status() == 1 && t2.v0Status() == 1) { - fillHistograms(1, 1, lambda, lambda2, proton, proton2, centrality, 1, invN); + fillHistograms(1, 1, lambda, lambda2, proton, proton2, 1, invN); } } } // end mixing-event loop From d4eae0de8479e80ad94254ff5070f0706a2bd205 Mon Sep 17 00:00:00 2001 From: Victor Gonzalez Date: Sat, 6 Sep 2025 18:44:53 +0200 Subject: [PATCH 338/986] [PWGCF] DptDpt - proper auto system type for track filtering (#12891) Co-authored-by: Victor --- PWGCF/TableProducer/dptDptFilter.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PWGCF/TableProducer/dptDptFilter.cxx b/PWGCF/TableProducer/dptDptFilter.cxx index 6df5ac6d5ba..dcdfec15498 100644 --- a/PWGCF/TableProducer/dptDptFilter.cxx +++ b/PWGCF/TableProducer/dptDptFilter.cxx @@ -1199,9 +1199,9 @@ struct DptDptFilterTracks { tpcExcluder.setCuts(pLowCut, pUpCut, nLowCut, nUpCut); /* self configure system type and data type */ - o2::framework::LabeledArray tmpArray = {periodsOnSystemType[0], 11, 1, {SYSTEMNAME(0), SYSTEMNAME(1), SYSTEMNAME(2), SYSTEMNAME(3), SYSTEMNAME(4), SYSTEMNAME(5), SYSTEMNAME(6), SYSTEMNAME(7), SYSTEMNAME(8), SYSTEMNAME(9), SYSTEMNAME(10)}, {"Periods separated by commas"}}; - getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgSystem", tmpArray, false); - fSystem = getSystemType(tmpArray); + o2::framework::LabeledArray tmpLabeledArray = {}; + getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgSystemForPeriod", tmpLabeledArray, false); + fSystem = getSystemType(tmpLabeledArray); std::string tmpstr; getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgDataType", tmpstr, false); fDataType = getDataType(tmpstr); From ca1b9e044f2d7cb2aa9cdd718f554747475f35cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Mart=C3=ADnez=20Garc=C3=ADa?= Date: Sat, 6 Sep 2025 15:58:27 -0600 Subject: [PATCH 339/986] [PWGUD] Constraining phi rane (#12886) --- PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx b/PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx index 2f964f71a85..40592fa2362 100644 --- a/PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx +++ b/PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx @@ -416,7 +416,8 @@ struct UpcPhotonuclearAnalysisJMG { if (isTrackCut(track) == false) { continue; } - float phiVal = RecoDecay::constrainAngle(phi(track.px(), track.py()), 0.f, TwoPI); + float phiVal = RecoDecay::constrainAngle(phi(track.px(), track.py()), 0.f); + histos.fill(HIST("yields"), multiplicity, track.pt(), eta(track.px(), track.py(), track.pz())); histos.fill(HIST("etaphi"), multiplicity, eta(track.px(), track.py(), track.pz()), phiVal); } @@ -503,7 +504,7 @@ struct UpcPhotonuclearAnalysisJMG { float getNUAWeight(float vz, float eta, float phi) { auto hWeight = histos.get(HIST("weightNUA")); - phi = RecoDecay::constrainAngle(phi, 0.f, TwoPI); + phi = RecoDecay::constrainAngle(phi, 0.f); int iPhi = hWeight->GetZaxis()->FindBin(phi); int iEta = hWeight->GetYaxis()->FindBin(eta); int iVz = hWeight->GetXaxis()->FindBin(vz); @@ -530,7 +531,7 @@ struct UpcPhotonuclearAnalysisJMG { if (isTrackCut(track) == false) { continue; } - float phiVal = RecoDecay::constrainAngle(phi(track.px(), track.py()), 0.f, TwoPI); + float phiVal = RecoDecay::constrainAngle(phi(track.px(), track.py()), 0.f); histos.fill(HIST("etaphiVtx"), reconstructedCollision.posZ(), eta(track.px(), track.py(), track.pz()), phiVal); histos.fill(HIST("Tracks/hTrackPhiBeforeCorr"), phiVal); } @@ -561,7 +562,7 @@ struct UpcPhotonuclearAnalysisJMG { } nTracksCharged++; sumPt += track.pt(); - float phiVal = RecoDecay::constrainAngle(phi(track.px(), track.py()), 0.f, TwoPI); + float phiVal = RecoDecay::constrainAngle(phi(track.px(), track.py()), 0.f); histos.fill(HIST("Tracks/SGsideA/hTrackPt"), track.pt()); histos.fill(HIST("Tracks/SGsideA/hTrackPhi"), phiVal); histos.fill(HIST("Tracks/SGsideA/hTrackEta"), eta(track.px(), track.py(), track.pz())); @@ -621,7 +622,7 @@ struct UpcPhotonuclearAnalysisJMG { } nTracksCharged++; sumPt += track.pt(); - float phiVal = RecoDecay::constrainAngle(phi(track.px(), track.py()), 0.f, TwoPI); + float phiVal = RecoDecay::constrainAngle(phi(track.px(), track.py()), 0.f); histos.fill(HIST("Tracks/SGsideC/hTrackPt"), track.pt()); histos.fill(HIST("Tracks/SGsideC/hTrackPhi"), phiVal); histos.fill(HIST("Tracks/SGsideC/hTrackEta"), eta(track.px(), track.py(), track.pz())); @@ -859,7 +860,7 @@ struct UpcPhotonuclearAnalysisJMG { ++multiplicity; float weightNUA = getNUAWeight(reconstructedCollision.posZ(), eta(track.px(), track.py(), track.pz()), phi(track.px(), track.py())); - float phiVal = RecoDecay::constrainAngle(phi(track.px(), track.py()), 0.f, TwoPI); + float phiVal = RecoDecay::constrainAngle(phi(track.px(), track.py()), 0.f); histos.fill(HIST("Tracks/hTrackPhiAfterCorr"), phiVal, weightNUA); } // multiplicity = reconstructedTracks.size(); From 4a3c305a7db5f99709b0025c454926448ad00c81 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sun, 7 Sep 2025 03:01:05 +0200 Subject: [PATCH 340/986] [PWGEM/Dilepton] add chi2TOF in treeCreatorElectronMLDDA.cxx (#12892) --- PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx index f45009d4646..eb0d33e4208 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx @@ -229,6 +229,7 @@ struct TreeCreatorElectronMLDDA { Configurable cfg_min_ncluster_itsib{"cfg_min_ncluster_itsib", 0, "min ncluster itsib"}; Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; Configurable cfg_max_chi2its{"cfg_max_chi2its", 5.0, "max chi2/NclsITS"}; + Configurable cfg_max_chi2tof{"cfg_max_chi2tof", 1e+10, "max chi2 TOF"}; // distance in cm Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2, "min n sigma e in TPC for pc->ee"}; Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +2, "max n sigma e in TPC for pc->ee"}; @@ -580,7 +581,7 @@ struct TreeCreatorElectronMLDDA { { // only for K0S-> pi+ pi- bool is_Pi_TPC = tightv0cuts.cfg_min_TPCNsigmaPi < track.tpcNSigmaPi() && track.tpcNSigmaPi() < tightv0cuts.cfg_max_TPCNsigmaPi; - bool is_Pi_TOF = tightv0cuts.cfg_min_TOFNsigmaPi < track.tofNSigmaPi() && track.tofNSigmaPi() < tightv0cuts.cfg_max_TOFNsigmaPi; // TOFreq + bool is_Pi_TOF = tightv0cuts.cfg_min_TOFNsigmaPi < track.tofNSigmaPi() && track.tofNSigmaPi() < tightv0cuts.cfg_max_TOFNsigmaPi && std::fabs(track.tofChi2()) < tightv0cuts.cfg_max_chi2tof; // TOFreq return is_Pi_TPC && is_Pi_TOF; } From 3b67cb321712cd583561c188ed88099aeede1fd9 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sun, 7 Sep 2025 20:32:49 +0200 Subject: [PATCH 341/986] [PWGEM/Dilepton] update polarization frame (#12893) --- PWGEM/Dilepton/Core/Dilepton.h | 60 +++-- PWGEM/Dilepton/Core/DileptonMC.h | 345 +++++++++++++++------------ PWGEM/Dilepton/Utils/PairUtilities.h | 44 ++-- 3 files changed, 252 insertions(+), 197 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 18815b73ee0..9477a2aee56 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -121,6 +121,7 @@ struct Dilepton { Configurable cfgApplyWeightTTCA{"cfgApplyWeightTTCA", false, "flag to apply weighting by 1/N"}; Configurable cfgDCAType{"cfgDCAType", 0, "type of DCA for output. 0:3D, 1:XY, 2:Z, else:3D"}; Configurable cfgUseSignedDCA{"cfgUseSignedDCA", false, "flag to use signs in the DCA calculation"}; + Configurable cfgPolarizationFrame{"cfgPolarizationFrame", 0, "frame of polarization. 0:CS, 1:HX, else:FATAL"}; ConfigurableAxis ConfMllBins{"ConfMllBins", {VARIABLE_WIDTH, 0.00, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.50, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.70, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.80, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.00, 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.10, 2.20, 2.30, 2.40, 2.50, 2.60, 2.70, 2.75, 2.80, 2.85, 2.90, 2.95, 3.00, 3.05, 3.10, 3.15, 3.20, 3.25, 3.30, 3.35, 3.40, 3.45, 3.50, 3.55, 3.60, 3.65, 3.70, 3.75, 3.80, 3.85, 3.90, 3.95, 4.00}, "mll bins for output histograms"}; ConfigurableAxis ConfPtllBins{"ConfPtllBins", {VARIABLE_WIDTH, 0.00, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.50, 3.00, 3.50, 4.00, 4.50, 5.00, 6.00, 7.00, 8.00, 9.00, 10.00}, "pTll bins for output histograms"}; @@ -571,8 +572,17 @@ struct Dilepton { const AxisSpec axis_aco{10, 0, 1.f, "#alpha = 1 - #frac{|#varphi_{l^{+}} - #varphi_{l^{-}}|}{#pi}"}; const AxisSpec axis_asym_pt{10, 0, 1.f, "A = #frac{|p_{T,l^{+}} - p_{T,l^{-}}|}{|p_{T,l^{+}} + p_{T,l^{-}}|}"}; const AxisSpec axis_dphi_e_ee{18, 0, M_PI, "#Delta#varphi = #varphi_{l} - #varphi_{ll} (rad.)"}; - const AxisSpec axis_cos_theta_cs{ConfPolarizationCosThetaBins, "|cos(#theta^{CS})|"}; - fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_cos_theta_cs}, true); + + std::string frameName = "CS"; + if (cfgPolarizationFrame == 0) { + frameName = "CS"; + } else if (cfgPolarizationFrame == 1) { + frameName = "HX"; + } else { + LOG(fatal) << "set 0 or 1 to cfgPolarizationFrame!"; + } + const AxisSpec axis_cos_theta{ConfPolarizationCosThetaBins, Form("|cos(#theta^{%s})|", frameName.data())}; + fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_cos_theta}, true); fRegistry.addClone("Pair/same/uls/", "Pair/same/lspp/"); fRegistry.addClone("Pair/same/uls/", "Pair/same/lsmm/"); fRegistry.addClone("Pair/same/", "Pair/mix/"); @@ -594,9 +604,18 @@ struct Dilepton { fRegistry.addClone("Pair/mix/uls/", "Pair/mix/lsmm/"); } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kPolarization)) { - const AxisSpec axis_cos_theta_cs{ConfPolarizationCosThetaBins, "|cos(#theta^{CS})|"}; - const AxisSpec axis_phi_cs{ConfPolarizationPhiBins, "|#varphi^{CS}| (rad.)"}; - fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y, axis_cos_theta_cs, axis_phi_cs}, true); + std::string frameName = "CS"; + if (cfgPolarizationFrame == 0) { + frameName = "CS"; + } else if (cfgPolarizationFrame == 1) { + frameName = "HX"; + } else { + LOG(fatal) << "set 0 or 1 to cfgPolarizationFrame!"; + } + + const AxisSpec axis_cos_theta{ConfPolarizationCosThetaBins, Form("|cos(#theta^{%s})|", frameName.data())}; + const AxisSpec axis_phi{ConfPolarizationPhiBins, Form("|#varphi^{%s}| (rad.)", frameName.data())}; + fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y, axis_cos_theta, axis_phi}, true); fRegistry.addClone("Pair/same/uls/", "Pair/same/lspp/"); fRegistry.addClone("Pair/same/uls/", "Pair/same/lsmm/"); fRegistry.addClone("Pair/same/", "Pair/mix/"); @@ -968,15 +987,20 @@ struct Dilepton { float dphi_e_ee = v1.Phi() - v12.Phi(); o2::math_utils::bringToPMPi(dphi_e_ee); - float cos_thetaCS = 999, phiCS = 999.f; - o2::aod::pwgem::dilepton::utils::pairutil::getAngleCS(t1, t2, leptonM1, leptonM2, beamE1, beamE2, beamP1, beamP2, cos_thetaCS, phiCS); + float cos_thetaPol = 999, phiPol = 999.f; + if (cfgPolarizationFrame == 0) { + o2::aod::pwgem::dilepton::utils::pairutil::getAngleCS(std::array{t1.px(), t1.py(), t1.pz(), leptonM1}, std::array{t2.px(), t2.py(), t2.pz(), leptonM2}, beamE1, beamE2, beamP1, beamP2, t1.sign(), cos_thetaPol, phiPol); + } else if (cfgPolarizationFrame == 1) { + o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(std::array{t1.px(), t1.py(), t1.pz(), leptonM1}, std::array{t2.px(), t2.py(), t2.pz(), leptonM2}, beamE1, beamE2, beamP1, beamP2, t1.sign(), cos_thetaPol, phiPol); + } + o2::math_utils::bringToPMPi(phiPol); if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), aco, asym, std::fabs(dphi_e_ee), std::fabs(cos_thetaCS), weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), aco, asym, std::fabs(dphi_e_ee), std::fabs(cos_thetaPol), weight); } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), aco, asym, std::fabs(dphi_e_ee), std::fabs(cos_thetaCS), weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), aco, asym, std::fabs(dphi_e_ee), std::fabs(cos_thetaPol), weight); } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), aco, asym, std::fabs(dphi_e_ee), std::fabs(cos_thetaCS), weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), aco, asym, std::fabs(dphi_e_ee), std::fabs(cos_thetaPol), weight); } } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kFlowV2) || cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kFlowV3)) { std::array q2ft0m = {collision.q2xft0m(), collision.q2yft0m()}; @@ -1020,16 +1044,20 @@ struct Dilepton { } } } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kPolarization)) { - float cos_thetaCS = 999, phiCS = 999.f; - o2::aod::pwgem::dilepton::utils::pairutil::getAngleCS(t1, t2, leptonM1, leptonM2, beamE1, beamE2, beamP1, beamP2, cos_thetaCS, phiCS); - o2::math_utils::bringToPMPi(phiCS); + float cos_thetaPol = 999, phiPol = 999.f; + if (cfgPolarizationFrame == 0) { + o2::aod::pwgem::dilepton::utils::pairutil::getAngleCS(std::array{t1.px(), t1.py(), t1.pz(), leptonM1}, std::array{t2.px(), t2.py(), t2.pz(), leptonM2}, beamE1, beamE2, beamP1, beamP2, t1.sign(), cos_thetaPol, phiPol); + } else if (cfgPolarizationFrame == 1) { + o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(std::array{t1.px(), t1.py(), t1.pz(), leptonM1}, std::array{t2.px(), t2.py(), t2.pz(), leptonM2}, beamE1, beamE2, beamP1, beamP2, t1.sign(), cos_thetaPol, phiPol); + } + o2::math_utils::bringToPMPi(phiPol); if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), std::fabs(cos_thetaCS), std::fabs(phiCS), weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), std::fabs(cos_thetaPol), std::fabs(phiPol), weight); } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), std::fabs(cos_thetaCS), std::fabs(phiCS), weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), std::fabs(cos_thetaPol), std::fabs(phiPol), weight); } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), std::fabs(cos_thetaCS), std::fabs(phiCS), weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), std::fabs(cos_thetaPol), std::fabs(phiPol), weight); } } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kHFll)) { float dphi = v1.Phi() - v2.Phi(); diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index abd188b5712..0f924be57f4 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -47,6 +47,7 @@ #include "Math/Vector4D.h" #include "TString.h" +#include #include #include #include @@ -126,6 +127,7 @@ struct DileptonMC { Configurable cfg_nbin_dphi_e_ee{"cfg_nbin_dphi_e_ee", 1, "number of bins for dphi_ee_e"}; // 18 ConfigurableAxis ConfPolarizationPhiBins{"ConfPolarizationPhiBins", {6, 0.f, M_PI}, "phi bins for polarization analysis"}; ConfigurableAxis ConfPolarizationCosThetaBins{"ConfPolarizationCosThetaBins", {5, 0.f, 1.f}, "phi bins for polarization analysis"}; + Configurable cfgPolarizationFrame{"cfgPolarizationFrame", 0, "frame of polarization. 0:CS, 1:HX, else:FATAL"}; EMEventCut fEMEventCut; struct : ConfigurableGroup { @@ -353,17 +355,26 @@ struct DileptonMC { const AxisSpec axis_dca_track1{ConfTrackDCA, "DCA_{e,1}^{Z} (#sigma)"}; const AxisSpec axis_dca_track2{ConfTrackDCA, "DCA_{e,2}^{Z} (#sigma)"}; + std::string frameName = "CS"; + if (cfgPolarizationFrame == 0) { + frameName = "CS"; + } else if (cfgPolarizationFrame == 1) { + frameName = "HX"; + } else { + LOG(fatal) << "set 0 or 1 to cfgPolarizationFrame!"; + } + const AxisSpec axis_dphi_ee{cfg_nbin_dphi_ee, -M_PI / 2., 3. / 2. * M_PI, "#Delta#varphi = #varphi_{l1} - #varphi_{l2} (rad.)"}; // for kHFll const AxisSpec axis_deta_ee{cfg_nbin_deta_ee, -2., 2., "#Delta#eta = #eta_{l1} - #eta_{l2}"}; // for kHFll - const AxisSpec axis_cos_theta_cs{ConfPolarizationCosThetaBins, "|cos(#theta^{CS})|"}; // for kPolarization, kUPC - const AxisSpec axis_phi_cs{ConfPolarizationPhiBins, "|#varphi^{CS}| (rad.)"}; // for kPolarization + const AxisSpec axis_cos_theta_pol{ConfPolarizationCosThetaBins, Form("|cos(#theta^{%s})|", frameName.data())}; // for kPolarization, kUPC + const AxisSpec axis_phi_pol{ConfPolarizationPhiBins, Form("|#varphi^{%s}| (rad.)", frameName.data())}; // for kPolarization const AxisSpec axis_aco{cfg_nbin_aco, 0, 1.f, "#alpha = 1 - #frac{|#varphi_{l^{+}} - #varphi_{l^{-}}|}{#pi}"}; // for kUPC const AxisSpec axis_asym_pt{cfg_nbin_asym_pt, 0, 1.f, "A = #frac{|p_{T,l^{+}} - p_{T,l^{-}}|}{|p_{T,l^{+}} + p_{T,l^{-}}|}"}; // for kUPC const AxisSpec axis_dphi_e_ee{cfg_nbin_dphi_e_ee, 0, M_PI, "#Delta#varphi = #varphi_{l} - #varphi_{ll} (rad.)"}; // for kUPC const AxisSpec axis_isInAcc{2, -0.5, 1.5, "is in acc"}; // in acc or not (bool) // generated info - fRegistry.add("Generated/sm/PromptPi0/hs", "generated dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_cs, axis_phi_cs, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_isInAcc}, true); + fRegistry.add("Generated/sm/PromptPi0/hs", "generated dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_isInAcc}, true); fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/NonPromptPi0/"); fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/Eta/"); fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/EtaPrime/"); @@ -379,7 +390,7 @@ struct DileptonMC { fRegistry.add("Generated/sm/Omega2ll/hPtY", "pT of #omega meson", kTH2D, {axis_y, axis_pt_meson}, true); fRegistry.add("Generated/sm/Phi2ll/hPtY", "pT of #phi meson", kTH2D, {axis_y, axis_pt_meson}, true); - fRegistry.add("Generated/ccbar/c2l_c2l/hadron_hadron/hs", "generated dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_cs, axis_phi_cs, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_isInAcc}, true); + fRegistry.add("Generated/ccbar/c2l_c2l/hadron_hadron/hs", "generated dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_isInAcc}, true); fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", "Generated/ccbar/c2l_c2l/meson_meson/"); fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", "Generated/ccbar/c2l_c2l/baryon_baryon/"); fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", "Generated/ccbar/c2l_c2l/meson_baryon/"); @@ -421,7 +432,7 @@ struct DileptonMC { } // reconstructed pair info - fRegistry.add("Pair/sm/Photon/hs", "rec. dilepton signal", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_cs, axis_phi_cs, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_dca}, true); + fRegistry.add("Pair/sm/Photon/hs", "rec. dilepton signal", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_dca}, true); fRegistry.addClone("Pair/sm/Photon/", "Pair/sm/PromptPi0/"); fRegistry.addClone("Pair/sm/Photon/", "Pair/sm/NonPromptPi0/"); fRegistry.addClone("Pair/sm/Photon/", "Pair/sm/Eta/"); @@ -449,7 +460,7 @@ struct DileptonMC { fRegistry.add("Pair/sm/PromptJPsi/hDCAz1vsDCAz2", "DCA_{z,1} vs DCA_{z,2}", kTH2F, {axis_dca_track1, axis_dca_track2}, true); } - fRegistry.add("Pair/ccbar/c2l_c2l/hadron_hadron/hs", "hs pair", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_cs, axis_phi_cs, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_dca}, true); + fRegistry.add("Pair/ccbar/c2l_c2l/hadron_hadron/hs", "hs pair", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_dca}, true); fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", "Pair/ccbar/c2l_c2l/meson_meson/"); fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", "Pair/ccbar/c2l_c2l/baryon_baryon/"); fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", "Pair/ccbar/c2l_c2l/meson_baryon/"); @@ -481,7 +492,7 @@ struct DileptonMC { } // for correlated bkg due to mis-identified hadrons, and true combinatorial bkg - fRegistry.add("Pair/corr_bkg_lh/uls/hs", "rec. bkg", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_cs, axis_phi_cs, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_dca}, true); + fRegistry.add("Pair/corr_bkg_lh/uls/hs", "rec. bkg", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_dca}, true); fRegistry.addClone("Pair/corr_bkg_lh/uls/", "Pair/corr_bkg_lh/lspp/"); fRegistry.addClone("Pair/corr_bkg_lh/uls/", "Pair/corr_bkg_lh/lsmm/"); fRegistry.addClone("Pair/corr_bkg_lh/", "Pair/corr_bkg_hh/"); @@ -961,37 +972,43 @@ struct DileptonMC { o2::math_utils::bringToPMPi(dphi_e_ee); dphi = RecoDecay::constrainAngle(dphi, -o2::constants::math::PIHalf, 1); // shift dphi in [-pi/2, +3pi/2] rad. - float cos_thetaCS = 999, phiCS = 999.f; - o2::aod::pwgem::dilepton::utils::pairutil::getAngleCS(t1, t2, leptonM1, leptonM2, beamE1, beamE2, beamP1, beamP2, cos_thetaCS, phiCS); - o2::math_utils::bringToPMPi(phiCS); + std::array arrP1 = {t1.px(), t1.py(), t1.pz(), leptonM1}; + std::array arrP2 = {t2.px(), t2.py(), t2.pz(), leptonM2}; + float cos_thetaPol = 999, phiPol = 999.f; + if (cfgPolarizationFrame == 0) { + o2::aod::pwgem::dilepton::utils::pairutil::getAngleCS(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, t1.sign(), cos_thetaPol, phiPol); + } else if (cfgPolarizationFrame == 1) { + o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, t1.sign(), cos_thetaPol, phiPol); + } + o2::math_utils::bringToPMPi(phiPol); if ((FindCommonMotherFrom2ProngsWithoutPDG(t1mc, t2mc) > 0 || IsHF(t1mc, t2mc, mcparticles) > 0) && is_pair_from_same_mcevent) { // for bkg study if (std::abs(t1mc.pdgCode()) != pdg_lepton || std::abs(t2mc.pdgCode()) != pdg_lepton) { // hh or lh correlated bkg if (std::abs(t1mc.pdgCode()) != pdg_lepton && std::abs(t2mc.pdgCode()) != pdg_lepton) { // hh correlated bkg if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("Pair/corr_bkg_hh/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/corr_bkg_hh/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("Pair/corr_bkg_hh/lspp/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/corr_bkg_hh/lspp/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - fRegistry.fill(HIST("Pair/corr_bkg_hh/lsmm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/corr_bkg_hh/lsmm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } } else { // lh correlated bkg if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("Pair/corr_bkg_lh/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/corr_bkg_lh/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("Pair/corr_bkg_lh/lspp/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/corr_bkg_lh/lspp/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - fRegistry.fill(HIST("Pair/corr_bkg_lh/lsmm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/corr_bkg_lh/lsmm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } } } } else { // true combinatorial bkg if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("Pair/comb_bkg/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/comb_bkg/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("Pair/comb_bkg/lspp/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/comb_bkg/lspp/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - fRegistry.fill(HIST("Pair/comb_bkg/lsmm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/comb_bkg/lsmm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } } @@ -1020,14 +1037,14 @@ struct DileptonMC { switch (std::abs(mcmother.pdgCode())) { case 111: if (IsFromCharm(mcmother, mcparticles) < 0 && IsFromBeauty(mcmother, mcparticles) < 0) { // prompt pi0 - fRegistry.fill(HIST("Pair/sm/PromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/PromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/sm/PromptPi0/hDeltaPtvsDCA"), pair_dca, deltaPt1 + deltaPt2); fRegistry.fill(HIST("Pair/sm/PromptPi0/hMvsPhiV"), phiv, v12.M()); fRegistry.fill(HIST("Pair/sm/PromptPi0/hDCAz1vsDCAz2"), dcaZinSigma(t1), dcaZinSigma(t2)); } } else { // non-prompt pi0 - fRegistry.fill(HIST("Pair/sm/NonPromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/NonPromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/sm/NonPromptPi0/hDeltaPtvsDCA"), pair_dca, deltaPt1 + deltaPt2); fRegistry.fill(HIST("Pair/sm/NonPromptPi0/hMvsPhiV"), phiv, v12.M()); @@ -1035,34 +1052,34 @@ struct DileptonMC { } break; case 221: - fRegistry.fill(HIST("Pair/sm/Eta/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/Eta/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); break; case 331: - fRegistry.fill(HIST("Pair/sm/EtaPrime/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/EtaPrime/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); break; case 113: - fRegistry.fill(HIST("Pair/sm/Rho/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/Rho/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); break; case 223: - fRegistry.fill(HIST("Pair/sm/Omega/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/Omega/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if (mcmother.daughtersIds().size() == 2) { // omeag->ee - fRegistry.fill(HIST("Pair/sm/Omega2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/Omega2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } break; case 333: - fRegistry.fill(HIST("Pair/sm/Phi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/Phi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if (mcmother.daughtersIds().size() == 2) { // phi->ee - fRegistry.fill(HIST("Pair/sm/Phi2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/Phi2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } break; case 443: { if (IsFromBeauty(mcmother, mcparticles) > 0) { - fRegistry.fill(HIST("Pair/sm/NonPromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/NonPromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/sm/NonPromptJPsi/hDeltaPtvsDCA"), pair_dca, deltaPt1 + deltaPt2); } } else { - fRegistry.fill(HIST("Pair/sm/PromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/PromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/sm/PromptJPsi/hDeltaPtvsDCA"), pair_dca, deltaPt1 + deltaPt2); fRegistry.fill(HIST("Pair/sm/PromptJPsi/hDCAz1vsDCAz2"), dcaZinSigma(t1), dcaZinSigma(t2)); @@ -1072,9 +1089,9 @@ struct DileptonMC { } case 100443: { if (IsFromBeauty(mcmother, mcparticles) > 0) { - fRegistry.fill(HIST("Pair/sm/NonPromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/NonPromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else { - fRegistry.fill(HIST("Pair/sm/PromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/PromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } break; } @@ -1084,7 +1101,7 @@ struct DileptonMC { } else if (!(t1mc.isPhysicalPrimary() || t1mc.producedByGenerator()) && !(t2mc.isPhysicalPrimary() || t2mc.producedByGenerator())) { switch (std::abs(mcmother.pdgCode())) { case 22: - fRegistry.fill(HIST("Pair/sm/Photon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/Photon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/sm/Photon/hMvsPhiV"), phiv, v12.M()); float rxy_gen = std::sqrt(std::pow(t1mc.vx(), 2) + std::pow(t1mc.vy(), 2)); @@ -1103,105 +1120,105 @@ struct DileptonMC { if (t1mc.pdgCode() * t2mc.pdgCode() < 0) { // ULS switch (hfee_type) { case static_cast(EM_HFeeType::kCe_Ce): { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if (isCharmMeson(mp1) && isCharmMeson(mp2)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if (std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 411) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dplus_Dminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dplus_Dminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if (std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 421) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_D0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_D0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if (std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 431) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dsplus_Dsminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dsplus_Dsminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 421) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 421)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_D0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_D0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 431)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 431)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } } else if (isCharmBaryon(mp1) && isCharmBaryon(mp2)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if (std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4122) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcplus_Lcminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcplus_Lcminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if (std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4232) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicplus_Xicminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicplus_Xicminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if (std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4132) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xic0_Xic0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xic0_Xic0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if (std::abs(mp1.pdgCode()) == 4332 && std::abs(mp2.pdgCode()) == 4332) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Omegac0_Omegac0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Omegac0_Omegac0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4132 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xic0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xic0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } } else { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } } break; } case static_cast(EM_HFeeType::kBe_Be): { - fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if (isBeautyMeson(mp1) && isBeautyMeson(mp2)) { - fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if (isBeautyBaryon(mp1) && isBeautyBaryon(mp2)) { - fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else { - fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } break; } case static_cast(EM_HFeeType::kBCe_BCe): { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if (isCharmMeson(mp1) && isCharmMeson(mp2)) { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if (isCharmBaryon(mp1) && isCharmBaryon(mp2)) { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } break; } case static_cast(EM_HFeeType::kBCe_Be_SameB): { // ULS - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } break; } @@ -1226,13 +1243,13 @@ struct DileptonMC { LOGF(info, "You should not see kBCe_Be_SameB in LS. Good luck."); break; case static_cast(EM_HFeeType::kBCe_Be_DiffB): { // LS - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } break; } @@ -1430,9 +1447,15 @@ struct DileptonMC { o2::math_utils::bringToPMPi(dphi_e_ee); dphi = RecoDecay::constrainAngle(dphi, -o2::constants::math::PIHalf, 1); // shift dphi in [-pi/2, +3pi/2] rad. after deta-dphi cut. - float cos_thetaCS = 999, phiCS = 999.f; - o2::aod::pwgem::dilepton::utils::pairutil::getAngleCS(t1, t2, leptonM1, leptonM2, beamE1, beamE2, beamP1, beamP2, cos_thetaCS, phiCS); - o2::math_utils::bringToPMPi(phiCS); + std::array arrP1 = {static_cast(v1.Px()), static_cast(v1.Py()), static_cast(v1.Pz()), leptonM1}; + std::array arrP2 = {static_cast(v2.Px()), static_cast(v2.Py()), static_cast(v2.Pz()), leptonM2}; + float cos_thetaPol = 999, phiPol = 999.f; + if (cfgPolarizationFrame == 0) { + o2::aod::pwgem::dilepton::utils::pairutil::getAngleCS(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, -t1.pdgCode() / pdg_lepton, cos_thetaPol, phiPol); + } else if (cfgPolarizationFrame == 1) { + o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, -t1.pdgCode() / pdg_lepton, cos_thetaPol, phiPol); + } + o2::math_utils::bringToPMPi(phiPol); bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); @@ -1443,45 +1466,45 @@ struct DileptonMC { switch (std::abs(mcmother.pdgCode())) { case 111: if (IsFromCharm(mcmother, mcparticles) < 0 && IsFromBeauty(mcmother, mcparticles) < 0) { // prompt pi0 - fRegistry.fill(HIST("Generated/sm/PromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/sm/PromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else { // non-prompt pi0 - fRegistry.fill(HIST("Generated/sm/NonPromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/sm/NonPromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; case 221: - fRegistry.fill(HIST("Generated/sm/Eta/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/sm/Eta/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); break; case 331: - fRegistry.fill(HIST("Generated/sm/EtaPrime/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/sm/EtaPrime/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); break; case 113: - fRegistry.fill(HIST("Generated/sm/Rho/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/sm/Rho/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); break; case 223: - fRegistry.fill(HIST("Generated/sm/Omega/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/sm/Omega/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); if (mcmother.daughtersIds().size() == 2) { // omega->ee - fRegistry.fill(HIST("Generated/sm/Omega2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/sm/Omega2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; case 333: - fRegistry.fill(HIST("Generated/sm/Phi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/sm/Phi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); if (mcmother.daughtersIds().size() == 2) { // phi->ee - fRegistry.fill(HIST("Generated/sm/Phi2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/sm/Phi2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; case 443: { if (IsFromBeauty(mcmother, mcparticles) > 0) { - fRegistry.fill(HIST("Generated/sm/NonPromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/sm/NonPromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else { - fRegistry.fill(HIST("Generated/sm/PromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/sm/PromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; } case 100443: { if (IsFromBeauty(mcmother, mcparticles) > 0) { - fRegistry.fill(HIST("Generated/sm/NonPromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/sm/NonPromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else { - fRegistry.fill(HIST("Generated/sm/PromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/sm/PromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; } @@ -1494,105 +1517,105 @@ struct DileptonMC { auto mp2 = mcparticles.iteratorAt(t2.mothersIds()[0]); switch (hfee_type) { case static_cast(EM_HFeeType::kCe_Ce): { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); if (isCharmMeson(mp1) && isCharmMeson(mp2)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); if (std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 411) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dplus_Dminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dplus_Dminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if (std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 421) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_D0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_D0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if (std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 431) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dsplus_Dsminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dsplus_Dsminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 421) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 421)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_D0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_D0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 431)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 431)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } } else if (isCharmBaryon(mp1) && isCharmBaryon(mp2)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); if (std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4122) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcplus_Lcminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcplus_Lcminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if (std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4232) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicplus_Xicminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicplus_Xicminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if (std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4132) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xic0_Xic0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xic0_Xic0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if (std::abs(mp1.pdgCode()) == 4332 && std::abs(mp2.pdgCode()) == 4332) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Omegac0_Omegac0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Omegac0_Omegac0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4132 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xic0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xic0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } } else { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } } break; } case static_cast(EM_HFeeType::kBe_Be): { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); if (isBeautyMeson(mp1) && isBeautyMeson(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if (isBeautyBaryon(mp1) && isBeautyBaryon(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; } case static_cast(EM_HFeeType::kBCe_BCe): { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); if (isCharmMeson(mp1) && isCharmMeson(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if (isCharmBaryon(mp1) && isCharmBaryon(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; } case static_cast(EM_HFeeType::kBCe_Be_SameB): { // ULS - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; } @@ -1702,9 +1725,15 @@ struct DileptonMC { o2::math_utils::bringToPMPi(dphi_e_ee); dphi = RecoDecay::constrainAngle(dphi, -o2::constants::math::PIHalf, 1); // shift dphi in [-pi/2, +3pi/2] rad. after deta-dphi cut. - float cos_thetaCS = 999, phiCS = 999.f; - o2::aod::pwgem::dilepton::utils::pairutil::getAngleCS(t1, t2, leptonM1, leptonM2, beamE1, beamE2, beamP1, beamP2, cos_thetaCS, phiCS); - o2::math_utils::bringToPMPi(phiCS); + std::array arrP1 = {static_cast(v1.Px()), static_cast(v1.Py()), static_cast(v1.Pz()), leptonM1}; + std::array arrP2 = {static_cast(v2.Px()), static_cast(v2.Py()), static_cast(v2.Pz()), leptonM2}; + float cos_thetaPol = 999, phiPol = 999.f; + if (cfgPolarizationFrame == 0) { + o2::aod::pwgem::dilepton::utils::pairutil::getAngleCS(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, -t1.pdgCode() / pdg_lepton, cos_thetaPol, phiPol); + } else if (cfgPolarizationFrame == 1) { + o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, -t1.pdgCode() / pdg_lepton, cos_thetaPol, phiPol); + } + o2::math_utils::bringToPMPi(phiPol); bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); if (hfee_type > -1) { @@ -1724,13 +1753,13 @@ struct DileptonMC { LOGF(info, "You should not see kBCe_Be_SameB in LS++. Good luck."); break; case static_cast(EM_HFeeType::kBCe_Be_DiffB): { // LS - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; } @@ -1837,9 +1866,15 @@ struct DileptonMC { o2::math_utils::bringToPMPi(dphi_e_ee); dphi = RecoDecay::constrainAngle(dphi, -o2::constants::math::PIHalf, 1); // shift dphi in [-pi/2, +3pi/2] rad. after deta-dphi cut. - float cos_thetaCS = 999, phiCS = 999.f; - o2::aod::pwgem::dilepton::utils::pairutil::getAngleCS(t1, t2, leptonM1, leptonM2, beamE1, beamE2, beamP1, beamP2, cos_thetaCS, phiCS); - o2::math_utils::bringToPMPi(phiCS); + std::array arrP1 = {static_cast(v1.Px()), static_cast(v1.Py()), static_cast(v1.Pz()), leptonM1}; + std::array arrP2 = {static_cast(v2.Px()), static_cast(v2.Py()), static_cast(v2.Pz()), leptonM2}; + float cos_thetaPol = 999, phiPol = 999.f; + if (cfgPolarizationFrame == 0) { + o2::aod::pwgem::dilepton::utils::pairutil::getAngleCS(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, -t1.pdgCode() / pdg_lepton, cos_thetaPol, phiPol); + } else if (cfgPolarizationFrame == 1) { + o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, -t1.pdgCode() / pdg_lepton, cos_thetaPol, phiPol); + } + o2::math_utils::bringToPMPi(phiPol); bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); if (hfee_type > -1) { @@ -1859,13 +1894,13 @@ struct DileptonMC { LOGF(info, "You should not see kBCe_Be_SameB in LS--. Good luck."); break; case static_cast(EM_HFeeType::kBCe_Be_DiffB): { // LS - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; } diff --git a/PWGEM/Dilepton/Utils/PairUtilities.h b/PWGEM/Dilepton/Utils/PairUtilities.h index 6a574c3fb7e..bd2a7f19f2a 100644 --- a/PWGEM/Dilepton/Utils/PairUtilities.h +++ b/PWGEM/Dilepton/Utils/PairUtilities.h @@ -68,11 +68,12 @@ using SMatrix55 = ROOT::Math::SMatrix; //_______________________________________________________________________ -template -void getAngleHX(TTrack1 const& t1, TTrack2 const& t2, const float m1, const float m2, const float beamE1, const float beamE2, const float beamP1, const float beamP2, float& cos_thetaHX, float& phiHX) +template +void getAngleHX(std::array const& t1, std::array const& t2, const float beamE1, const float beamE2, const float beamP1, const float beamP2, const int8_t c1, float& cos_thetaHX, float& phiHX) { - ROOT::Math::PxPyPzEVector v1(t1.px(), t1.py(), t1.pz(), std::sqrt(std::pow(t1.p(), 2) + std::pow(m1, 2))); - ROOT::Math::PxPyPzEVector v2(t2.px(), t2.py(), t2.pz(), std::sqrt(std::pow(t2.p(), 2) + std::pow(m2, 2))); + // t1[0] = px, t1[1] = py, t1[2] = pz, t1[3] = mass; + ROOT::Math::PxPyPzEVector v1(t1[0], t1[1], t1[2], std::sqrt(std::pow(t1[0], 2) + std::pow(t1[1], 2) + std::pow(t1[2], 2) + std::pow(t1[3], 2))); + ROOT::Math::PxPyPzEVector v2(t2[0], t2[1], t2[2], std::sqrt(std::pow(t2[0], 2) + std::pow(t2[1], 2) + std::pow(t2[2], 2) + std::pow(t2[3], 2))); ROOT::Math::PxPyPzEVector v12 = v1 + v2; ROOT::Math::PxPyPzEVector Beam1(0., 0., -beamP1, beamE1); @@ -95,22 +96,18 @@ void getAngleHX(TTrack1 const& t1, TTrack2 const& t2, const float m1, const floa // pdgCode : 13 for negative muon, -13 for positive muon // LOGF(info, "zaxis_HX.Dot(v1_CM) = %f , zaxis_HX.Dot(v2_CM) = %f", zaxis_HX.Dot(v1_CM), zaxis_HX.Dot(v2_CM)); // absolute value is identical. only sign is opposite. - if constexpr (isMC) { - cos_thetaHX = t1.pdgCode() < 0 ? zaxis_HX.Dot(v1_CM) : zaxis_HX.Dot(v2_CM); - phiHX = t1.pdgCode() < 0 ? std::atan2(yaxis_HX.Dot(v1_CM), xaxis_HX.Dot(v1_CM)) : std::atan2(yaxis_HX.Dot(v2_CM), xaxis_HX.Dot(v2_CM)); - } else { - cos_thetaHX = t1.sign() > 0 ? zaxis_HX.Dot(v1_CM) : zaxis_HX.Dot(v2_CM); - phiHX = t1.sign() > 0 ? std::atan2(yaxis_HX.Dot(v1_CM), xaxis_HX.Dot(v1_CM)) : std::atan2(yaxis_HX.Dot(v2_CM), xaxis_HX.Dot(v2_CM)); - } + cos_thetaHX = c1 > 0 ? zaxis_HX.Dot(v1_CM) : zaxis_HX.Dot(v2_CM); + phiHX = c1 > 0 ? std::atan2(yaxis_HX.Dot(v1_CM), xaxis_HX.Dot(v1_CM)) : std::atan2(yaxis_HX.Dot(v2_CM), xaxis_HX.Dot(v2_CM)); } //_______________________________________________________________________ //_______________________________________________________________________ -template -void getAngleCS(TTrack1 const& t1, TTrack2 const& t2, const float m1, const float m2, const float beamE1, const float beamE2, const float beamP1, const float beamP2, float& cos_thetaCS, float& phiCS) +template +void getAngleCS(std::array const& t1, std::array const& t2, const float beamE1, const float beamE2, const float beamP1, const float beamP2, const int8_t c1, float& cos_thetaCS, float& phiCS) { - ROOT::Math::PxPyPzEVector v1(t1.px(), t1.py(), t1.pz(), std::sqrt(std::pow(t1.p(), 2) + std::pow(m1, 2))); - ROOT::Math::PxPyPzEVector v2(t2.px(), t2.py(), t2.pz(), std::sqrt(std::pow(t2.p(), 2) + std::pow(m2, 2))); + // t1[0] = px, t1[1] = py, t1[2] = pz, t1[3] = mass; + ROOT::Math::PxPyPzEVector v1(t1[0], t1[1], t1[2], std::sqrt(std::pow(t1[0], 2) + std::pow(t1[1], 2) + std::pow(t1[2], 2) + std::pow(t1[3], 2))); + ROOT::Math::PxPyPzEVector v2(t2[0], t2[1], t2[2], std::sqrt(std::pow(t2[0], 2) + std::pow(t2[1], 2) + std::pow(t2[2], 2) + std::pow(t2[3], 2))); ROOT::Math::PxPyPzEVector v12 = v1 + v2; ROOT::Math::PxPyPzEVector Beam1(0., 0., -beamP1, beamE1); @@ -133,13 +130,8 @@ void getAngleCS(TTrack1 const& t1, TTrack2 const& t2, const float m1, const floa // pdgCode : 13 for negative muon, -13 for positive muon // LOGF(info, "zaxis_CS.Dot(v1_CM) = %f , zaxis_CS.Dot(v2_CM) = %f", zaxis_CS.Dot(v1_CM), zaxis_CS.Dot(v2_CM)); // absolute value is identical. only sign is opposite. - if constexpr (isMC) { - cos_thetaCS = t1.pdgCode() < 0 ? zaxis_CS.Dot(v1_CM) : zaxis_CS.Dot(v2_CM); - phiCS = t1.pdgCode() < 0 ? std::atan2(yaxis_CS.Dot(v1_CM), xaxis_CS.Dot(v1_CM)) : std::atan2(yaxis_CS.Dot(v2_CM), xaxis_CS.Dot(v2_CM)); - } else { - cos_thetaCS = t1.sign() > 0 ? zaxis_CS.Dot(v1_CM) : zaxis_CS.Dot(v2_CM); - phiCS = t1.sign() > 0 ? std::atan2(yaxis_CS.Dot(v1_CM), xaxis_CS.Dot(v1_CM)) : std::atan2(yaxis_CS.Dot(v2_CM), xaxis_CS.Dot(v2_CM)); - } + cos_thetaCS = c1 > 0 ? zaxis_CS.Dot(v1_CM) : zaxis_CS.Dot(v2_CM); + phiCS = c1 > 0 ? std::atan2(yaxis_CS.Dot(v1_CM), xaxis_CS.Dot(v1_CM)) : std::atan2(yaxis_CS.Dot(v2_CM), xaxis_CS.Dot(v2_CM)); } //_______________________________________________________________________ @@ -237,7 +229,7 @@ bool isSVFoundFwd(TFwdDCAFitter fitter, TCollision const& collision, TTrack cons } } //_______________________________________________________________________ -inline float getPhivPair(float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg, int cpos, int cneg, float bz) +inline float getPhivPair(const float pxpos, const float pypos, const float pzpos, const float pxneg, const float pyneg, const float pzneg, const int8_t cpos, const int8_t cneg, const float bz) { // cos(phiv) = w*a /|w||a| // with w = u x v @@ -325,7 +317,7 @@ inline float getPhivPair(float pxpos, float pypos, float pzpos, float pxneg, flo return std::acos(clipToPM1(wx * ax + wy * ay)); // phiv in [0,pi] //cosPhiV = wx * ax + wy * ay; } //_______________________________________________________________________ -inline float getPsiPair(float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) +inline float getPsiPair(const float pxpos, const float pypos, const float pzpos, const float pxneg, const float pyneg, const float pzneg) { auto clipToPM1 = [](float x) { return x < -1.f ? -1.f : (x > 1.f ? 1.f : x); }; float ptot2 = RecoDecay::p2(pxpos, pypos, pzpos) * RecoDecay::p2(pxneg, pyneg, pzneg); @@ -336,7 +328,7 @@ inline float getPsiPair(float pxpos, float pypos, float pzpos, float pxneg, floa return std::asin(clipToPM1(argsin)); } //_______________________________________________________________________ -inline float getOpeningAngle(float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) +inline float getOpeningAngle(const float pxpos, const float pypos, const float pzpos, const float pxneg, const float pyneg, const float pzneg) { auto clipToPM1 = [](float x) { return x < -1.f ? -1.f : (x > 1.f ? 1.f : x); }; float ptot2 = RecoDecay::p2(pxpos, pypos, pzpos) * RecoDecay::p2(pxneg, pyneg, pzneg); @@ -350,7 +342,7 @@ inline float pairDCAQuadSum(const float dca1, const float dca2) } //_______________________________________________________________________ -inline float pairDCASignQuadSum(const float dca1, const float dca2, const float charge1, const float charge2) +inline float pairDCASignQuadSum(const float dca1, const float dca2, const int8_t charge1, const int8_t charge2) { return charge1 * charge2 * TMath::Sign(1., dca1) * TMath::Sign(1., dca2) * std::sqrt((dca1 * dca1 + dca2 * dca2) / 2.); } From f67ba3fbe41a8858a62b283f81e4655c5549fb97 Mon Sep 17 00:00:00 2001 From: Ionut Cristian Arsene Date: Sun, 7 Sep 2025 21:27:45 +0200 Subject: [PATCH 342/986] [PWGDQ] Added posibility to define multiple histogram classes for JSON histograms (#12855) Co-authored-by: Ionut Cristian Arsene Co-authored-by: ALICE Action Bot --- PWGDQ/Core/HistogramsLibrary.cxx | 54 +++++++++++++++++++------- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 12 +++--- PWGDQ/Tasks/tableReader_withAssoc.cxx | 12 +++--- 3 files changed, 51 insertions(+), 27 deletions(-) diff --git a/PWGDQ/Core/HistogramsLibrary.cxx b/PWGDQ/Core/HistogramsLibrary.cxx index 187f1205cb6..15e22ae0ab9 100644 --- a/PWGDQ/Core/HistogramsLibrary.cxx +++ b/PWGDQ/Core/HistogramsLibrary.cxx @@ -2008,6 +2008,18 @@ bool o2::aod::dqhistograms::ValidateJSONHistogram(T hist) return false; } + // check that the histClass field is an array of strings + if (!hist->FindMember("histClass")->value.IsArray()) { + LOG(fatal) << "histClass field should be an array of strings, e.g. [class1, class2]"; + return false; + } + for (auto& v : hist->FindMember("histClass")->value.GetArray()) { + if (!v.IsString()) { + LOG(fatal) << "histClass field should be an array of strings, e.g. [class1, class2]"; + return false; + } + } + TString histTypeStr = hist->FindMember("type")->value.GetString(); bool isTH1 = (histTypeStr.CompareTo("TH1") == 0); bool isTH2 = (histTypeStr.CompareTo("TH2") == 0); @@ -2218,7 +2230,11 @@ void o2::aod::dqhistograms::AddHistogramsFromJSON(HistogramManager* hm, const ch isConstantBinning = false; } - const char* histClass = hist.FindMember("histClass")->value.GetString(); + // create an array of strings to store the different histogram classes + std::vector histClasses; + for (auto& v : hist.FindMember("histClass")->value.GetArray()) { + histClasses.push_back(v.GetString()); + } const char* title = hist.FindMember("title")->value.GetString(); if (isTHn) { @@ -2282,9 +2298,13 @@ void o2::aod::dqhistograms::AddHistogramsFromJSON(HistogramManager* hm, const ch bool isDouble = (hist.HasMember("isDouble") ? hist.FindMember("isDouble")->value.GetBool() : false); if (isConstantBinning) { - hm->AddHistogram(histClass, histName, title, nDimensions, vars, nBins, xmin, xmax, axLabels, varW, useSparse, isDouble); + for (auto histClass : histClasses) { + hm->AddHistogram(histClass, histName, title, nDimensions, vars, nBins, xmin, xmax, axLabels, varW, useSparse, isDouble); + } } else { - hm->AddHistogram(histClass, histName, title, nDimensions, vars, binLimits, axLabels, varW, useSparse, isDouble); + for (auto histClass : histClasses) { + hm->AddHistogram(histClass, histName, title, nDimensions, vars, binLimits, axLabels, varW, useSparse, isDouble); + } } } else { // TH1, TH2 or TH3 @@ -2379,12 +2399,14 @@ void o2::aod::dqhistograms::AddHistogramsFromJSON(HistogramManager* hm, const ch LOG(debug) << "isFillLabelx: " << isFillLabelx; if (isConstantBinning) { - hm->AddHistogram(histClass, histName, title, isProfile, - nXbins, xmin, xmax, VarManager::fgVarNamesMap[varX], - nYbins, ymin, ymax, VarManager::fgVarNamesMap[varY], - nZbins, zmin, zmax, VarManager::fgVarNamesMap[varZ], - xLabels, yLabels, zLabels, - VarManager::fgVarNamesMap[varT], VarManager::fgVarNamesMap[varW], isdouble, isFillLabelx); + for (auto histClass : histClasses) { + hm->AddHistogram(histClass, histName, title, isProfile, + nXbins, xmin, xmax, VarManager::fgVarNamesMap[varX], + nYbins, ymin, ymax, VarManager::fgVarNamesMap[varY], + nZbins, zmin, zmax, VarManager::fgVarNamesMap[varZ], + xLabels, yLabels, zLabels, + VarManager::fgVarNamesMap[varT], VarManager::fgVarNamesMap[varW], isdouble, isFillLabelx); + } } else { int xBinsSize = xbinsVec.size(); if (xBinsSize != (nXbins + 1)) { @@ -2413,12 +2435,14 @@ void o2::aod::dqhistograms::AddHistogramsFromJSON(HistogramManager* hm, const ch zbins = new double[zbinsVec.size()]; std::copy(zbinsVec.begin(), zbinsVec.end(), zbins); } - hm->AddHistogram(histClass, histName, title, isProfile, - nXbins, xbins, VarManager::fgVarNamesMap[varX], - nYbins, ybins, VarManager::fgVarNamesMap[varY], - nZbins, zbins, VarManager::fgVarNamesMap[varZ], - xLabels, yLabels, zLabels, - VarManager::fgVarNamesMap[varT], VarManager::fgVarNamesMap[varW], isdouble, isFillLabelx); + for (auto histClass : histClasses) { + hm->AddHistogram(histClass, histName, title, isProfile, + nXbins, xbins, VarManager::fgVarNamesMap[varX], + nYbins, ybins, VarManager::fgVarNamesMap[varY], + nZbins, zbins, VarManager::fgVarNamesMap[varZ], + xLabels, yLabels, zLabels, + VarManager::fgVarNamesMap[varT], VarManager::fgVarNamesMap[varW], isdouble, isFillLabelx); + } } // end if (!isTHn) } } diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index 8d15f3dd22f..8da479a1cf8 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -431,7 +431,7 @@ struct AnalysisEventSelection { } PROCESS_SWITCH(AnalysisEventSelection, processSkimmed, "Run event selection on DQ skimmed events", false); - PROCESS_SWITCH(AnalysisEventSelection, processDummy, "Dummy function", false); + PROCESS_SWITCH(AnalysisEventSelection, processDummy, "Dummy function", true); }; // Produces a table with barrel track decisions (joinable to the ReducedTracksAssociations) @@ -756,7 +756,7 @@ struct AnalysisTrackSelection { PROCESS_SWITCH(AnalysisTrackSelection, processSkimmed, "Run barrel track selection on DQ skimmed track associations", false); PROCESS_SWITCH(AnalysisTrackSelection, processSkimmedWithCov, "Run barrel track selection on DQ skimmed tracks w/ cov matrix associations", false); - PROCESS_SWITCH(AnalysisTrackSelection, processDummy, "Dummy function", false); + PROCESS_SWITCH(AnalysisTrackSelection, processDummy, "Dummy function", true); }; // Produces a table with muon decisions (joinable to the ReducedMuonsAssociations) @@ -1060,7 +1060,7 @@ struct AnalysisMuonSelection { PROCESS_SWITCH(AnalysisMuonSelection, processSkimmed, "Run muon selection on DQ skimmed muons", false); PROCESS_SWITCH(AnalysisMuonSelection, processSkimmedWithCov, "Run muon selection on DQ skimmed muons, with event and track covariances", false); - PROCESS_SWITCH(AnalysisMuonSelection, processDummy, "Dummy function", false); + PROCESS_SWITCH(AnalysisMuonSelection, processDummy, "Dummy function", true); }; // Run the prefilter selection (e.g. electron prefiltering for photon conversions) @@ -1247,7 +1247,7 @@ struct AnalysisPrefilterSelection { } PROCESS_SWITCH(AnalysisPrefilterSelection, processBarrelSkimmed, "Run Prefilter selection on reduced tracks", false); - PROCESS_SWITCH(AnalysisPrefilterSelection, processDummy, "Do nothing", false); + PROCESS_SWITCH(AnalysisPrefilterSelection, processDummy, "Do nothing", true); }; // Run the same-event pairing @@ -2302,7 +2302,7 @@ struct AnalysisSameEventPairing { PROCESS_SWITCH(AnalysisSameEventPairing, processBarrelOnlyWithCollSkimmed, "Run barrel only pairing, with skimmed tracks and with collision information", false); PROCESS_SWITCH(AnalysisSameEventPairing, processMuonOnlySkimmed, "Run muon only pairing, with skimmed tracks", false); PROCESS_SWITCH(AnalysisSameEventPairing, processMCGen, "Loop over MC particle stack and fill generator level histograms", false); - PROCESS_SWITCH(AnalysisSameEventPairing, processDummy, "Dummy function, enabled only if none of the others are enabled", false); + PROCESS_SWITCH(AnalysisSameEventPairing, processDummy, "Dummy function, enabled only if none of the others are enabled", true); }; // Run pairing for resonance with legs fulfilling separate cuts (asymmetric decay channel) @@ -4113,7 +4113,7 @@ struct AnalysisDileptonTrack { PROCESS_SWITCH(AnalysisDileptonTrack, processMuonSkimmed, "Run muon dilepton-track pairing, using skimmed data", false); PROCESS_SWITCH(AnalysisDileptonTrack, processMCGen, "Loop over MC particle stack and fill generator level histograms", false); PROCESS_SWITCH(AnalysisDileptonTrack, processMCGenWithEventSelection, "Loop over MC particle stack and fill generator level histograms", false); - PROCESS_SWITCH(AnalysisDileptonTrack, processDummy, "Dummy function", false); + PROCESS_SWITCH(AnalysisDileptonTrack, processDummy, "Dummy function", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index 6cb6e8b3221..2511cfba2d0 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -542,7 +542,7 @@ struct AnalysisEventSelection { PROCESS_SWITCH(AnalysisEventSelection, processSkimmedWithMultExtra, "Run event selection on DQ skimmed events, with mult extra", false); PROCESS_SWITCH(AnalysisEventSelection, processSkimmedWithMultExtraZdc, "Run event selection on DQ skimmed events, with mult extra and ZDC", false); PROCESS_SWITCH(AnalysisEventSelection, processSkimmedWithQvectorCentr, "Run event selection on DQ skimmed events, with Q-vector", false); - PROCESS_SWITCH(AnalysisEventSelection, processDummy, "Dummy function", false); + PROCESS_SWITCH(AnalysisEventSelection, processDummy, "Dummy function", true); }; // Produces a table with barrel track decisions (joinable to the ReducedTracksAssociations) @@ -802,7 +802,7 @@ struct AnalysisTrackSelection { PROCESS_SWITCH(AnalysisTrackSelection, processSkimmed, "Run barrel track selection on DQ skimmed track associations", false); PROCESS_SWITCH(AnalysisTrackSelection, processSkimmedWithMultExtra, "Run barrel track selection on DQ skimmed track associations, with extra multiplicity tables", false); PROCESS_SWITCH(AnalysisTrackSelection, processSkimmedWithCov, "Run barrel track selection on DQ skimmed tracks w/ cov matrix associations", false); - PROCESS_SWITCH(AnalysisTrackSelection, processDummy, "Dummy function", false); + PROCESS_SWITCH(AnalysisTrackSelection, processDummy, "Dummy function", true); }; // Produces a table with muon decisions (joinable to the ReducedMuonsAssociations) @@ -1013,7 +1013,7 @@ struct AnalysisMuonSelection { } PROCESS_SWITCH(AnalysisMuonSelection, processSkimmed, "Run muon selection on DQ skimmed muons", false); - PROCESS_SWITCH(AnalysisMuonSelection, processDummy, "Dummy function", false); + PROCESS_SWITCH(AnalysisMuonSelection, processDummy, "Dummy function", true); }; // Run the prefilter selection (e.g. electron prefiltering for photon conversions) @@ -1197,7 +1197,7 @@ struct AnalysisPrefilterSelection { } PROCESS_SWITCH(AnalysisPrefilterSelection, processBarrelSkimmed, "Run Prefilter selection on reduced tracks", false); - PROCESS_SWITCH(AnalysisPrefilterSelection, processDummy, "Do nothing", false); + PROCESS_SWITCH(AnalysisPrefilterSelection, processDummy, "Do nothing", true); }; // Run the same-event pairing @@ -2342,7 +2342,7 @@ struct AnalysisSameEventPairing { PROCESS_SWITCH(AnalysisSameEventPairing, processMixingBarrelSkimmedFlow, "Run barrel type mixing pairing, with flow, with skimmed tracks", false); PROCESS_SWITCH(AnalysisSameEventPairing, processMixingBarrelWithQvectorCentrSkimmedNoCov, "Run barrel type mixing pairing, with skimmed tracks and with Qvector from central framework", false); PROCESS_SWITCH(AnalysisSameEventPairing, processMixingMuonSkimmed, "Run muon type mixing pairing, with skimmed muons", false); - PROCESS_SWITCH(AnalysisSameEventPairing, processDummy, "Dummy function, enabled only if none of the others are enabled", false); + PROCESS_SWITCH(AnalysisSameEventPairing, processDummy, "Dummy function, enabled only if none of the others are enabled", true); }; // Run pairing for resonance with legs fulfilling separate cuts (asymmetric decay channel) @@ -3722,7 +3722,7 @@ struct AnalysisDileptonTrack { PROCESS_SWITCH(AnalysisDileptonTrack, processMuonSkimmed, "Run muon dilepton-track pairing, using skimmed data", false); PROCESS_SWITCH(AnalysisDileptonTrack, processBarrelMixedEvent, "Run barrel dilepton-hadron mixed event pairing", false); PROCESS_SWITCH(AnalysisDileptonTrack, processMuonMixedEvent, "Run muon dilepton-hadron mixed event pairing", false); - PROCESS_SWITCH(AnalysisDileptonTrack, processDummy, "Dummy function", false); + PROCESS_SWITCH(AnalysisDileptonTrack, processDummy, "Dummy function", true); }; struct AnalysisDileptonTrackTrack { From 6ff552b4aa1ec284e542ef50ea3e9f77bc166041 Mon Sep 17 00:00:00 2001 From: Ida Storehaug <38440296+torkjellsdatter@users.noreply.github.com> Date: Mon, 8 Sep 2025 09:59:53 +0200 Subject: [PATCH 343/986] [PWGDQ] tableReader_withAssoc/dqEfficiency_withAssoc: Columns added to Bmeson table in AnalysisDileptonTrack (#12880) Co-authored-by: Ida Torkjellsdatter Storehaug Co-authored-by: ALICE Action Bot --- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 12 +++++++++++- PWGDQ/Tasks/tableReader_withAssoc.cxx | 11 ++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index 8da479a1cf8..c6fe7567577 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -77,6 +77,9 @@ DECLARE_SOA_COLUMN(MuonAmbiguityInBunch, muonAmbiguityInBunch, int8_t); DECLARE_SOA_COLUMN(MuonAmbiguityOutOfBunch, muonAmbiguityOutOfBunch, int8_t); //! Muon track out of bunch ambiguity DECLARE_SOA_BITMAP_COLUMN(IsBarrelSelectedPrefilter, isBarrelSelectedPrefilter, 32); //! Barrel prefilter decisions (joinable to ReducedTracksAssoc) // Bcandidate columns for ML analysis of B->Jpsi+K +DECLARE_SOA_COLUMN(RunNumber, runNumber, uint64_t); +DECLARE_SOA_COLUMN(EventIdx, eventIdx, uint64_t); +DECLARE_SOA_COLUMN(EventTimestamp, eventTimestamp, uint64_t); DECLARE_SOA_COLUMN(massBcandidate, MBcandidate, float); DECLARE_SOA_COLUMN(MassDileptonCandidate, massDileptonCandidate, float); DECLARE_SOA_COLUMN(deltaMassBcandidate, deltaMBcandidate, float); @@ -88,6 +91,9 @@ DECLARE_SOA_COLUMN(TauxyBcandidate, tauxyBcandidate, float); DECLARE_SOA_COLUMN(TauzBcandidate, tauzBcandidate, float); DECLARE_SOA_COLUMN(CosPBcandidate, cosPBcandidate, float); DECLARE_SOA_COLUMN(Chi2Bcandidate, chi2Bcandidate, float); +DECLARE_SOA_COLUMN(GlobalIndexassoc, globalIndexassoc, uint64_t); +DECLARE_SOA_COLUMN(GlobalIndexleg1, globalIndexleg1, uint64_t); +DECLARE_SOA_COLUMN(GlobalIndexleg2, globalIndexleg2, uint64_t); DECLARE_SOA_COLUMN(Ptassoc, ptassoc, float); DECLARE_SOA_COLUMN(PINassoc, pINassoc, float); DECLARE_SOA_COLUMN(Etaassoc, etaassoc, float); @@ -147,9 +153,11 @@ DECLARE_SOA_TABLE(MuonTrackCuts, "AOD", "DQANAMUONCUTS", dqanalysisflags::IsMuon DECLARE_SOA_TABLE(MuonAmbiguities, "AOD", "DQMUONAMB", dqanalysisflags::MuonAmbiguityInBunch, dqanalysisflags::MuonAmbiguityOutOfBunch); //! joinable to ReducedMuonTracks DECLARE_SOA_TABLE(Prefilter, "AOD", "DQPREFILTER", dqanalysisflags::IsBarrelSelectedPrefilter); //! joinable to ReducedTracksAssoc DECLARE_SOA_TABLE(BmesonCandidates, "AOD", "DQBMESONS", + dqanalysisflags::RunNumber, dqanalysisflags::EventIdx, dqanalysisflags::EventTimestamp, dqanalysisflags::massBcandidate, dqanalysisflags::MassDileptonCandidate, dqanalysisflags::deltaMassBcandidate, dqanalysisflags::pTBcandidate, dqanalysisflags::LxyBcandidate, dqanalysisflags::LxyzBcandidate, dqanalysisflags::LzBcandidate, dqanalysisflags::TauxyBcandidate, dqanalysisflags::TauzBcandidate, dqanalysisflags::CosPBcandidate, dqanalysisflags::Chi2Bcandidate, + dqanalysisflags::GlobalIndexassoc, dqanalysisflags::GlobalIndexleg1, dqanalysisflags::GlobalIndexleg2, dqanalysisflags::PINassoc, dqanalysisflags::Etaassoc, dqanalysisflags::Ptpair, dqanalysisflags::Etapair, dqanalysisflags::PINleg1, dqanalysisflags::Etaleg1, dqanalysisflags::PINleg2, dqanalysisflags::Etaleg2, dqanalysisflags::TPCnsigmaKaassoc, dqanalysisflags::TPCnsigmaPiassoc, dqanalysisflags::TPCnsigmaPrassoc, dqanalysisflags::TOFnsigmaKaassoc, @@ -3790,10 +3798,12 @@ struct AnalysisDileptonTrack { } } // table to be written out for ML analysis - BmesonsTable(fValuesHadron[VarManager::kPairMass], dilepton.mass(), fValuesHadron[VarManager::kDeltaMass], fValuesHadron[VarManager::kPairPt], + BmesonsTable(event.runNumber(), event.globalIndex(), event.timestamp(), + fValuesHadron[VarManager::kPairMass], dilepton.mass(), fValuesHadron[VarManager::kDeltaMass], fValuesHadron[VarManager::kPairPt], fValuesHadron[VarManager::kVertexingLxy], fValuesHadron[VarManager::kVertexingLxyz], fValuesHadron[VarManager::kVertexingLz], fValuesHadron[VarManager::kVertexingTauxy], fValuesHadron[VarManager::kVertexingTauz], fValuesHadron[VarManager::kCosPointingAngle], fValuesHadron[VarManager::kVertexingChi2PCA], + track.globalIndex(), lepton1.globalIndex(), lepton2.globalIndex(), track.tpcInnerParam(), track.eta(), dilepton.pt(), dilepton.eta(), lepton1.tpcInnerParam(), lepton1.eta(), lepton2.tpcInnerParam(), lepton2.eta(), track.tpcNSigmaKa(), track.tpcNSigmaPi(), track.tpcNSigmaPr(), track.tofNSigmaKa(), lepton1.tpcNSigmaEl(), lepton1.tpcNSigmaPi(), lepton1.tpcNSigmaPr(), diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index 2511cfba2d0..7b3733d774c 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -86,6 +86,9 @@ DECLARE_SOA_COLUMN(MuonAmbiguityInBunch, muonAmbiguityInBunch, int8_t); DECLARE_SOA_COLUMN(MuonAmbiguityOutOfBunch, muonAmbiguityOutOfBunch, int8_t); //! Muon track out of bunch ambiguity DECLARE_SOA_BITMAP_COLUMN(IsBarrelSelectedPrefilter, isBarrelSelectedPrefilter, 32); //! Barrel prefilter decisions (joinable to ReducedTracksAssoc) // Bcandidate columns for ML analysis of B->Jpsi+K +DECLARE_SOA_COLUMN(RunNumber, runNumber, uint64_t); +DECLARE_SOA_COLUMN(EventIdx, eventIdx, uint64_t); +DECLARE_SOA_COLUMN(EventTimestamp, eventTimestamp, uint64_t); DECLARE_SOA_COLUMN(massBcandidate, MBcandidate, float); DECLARE_SOA_COLUMN(MassDileptonCandidate, massDileptonCandidate, float); DECLARE_SOA_COLUMN(deltamassBcandidate, deltaMBcandidate, float); @@ -98,6 +101,9 @@ DECLARE_SOA_COLUMN(TauxyBcandidate, tauxyBcandidate, float); DECLARE_SOA_COLUMN(TauzBcandidate, tauzBcandidate, float); DECLARE_SOA_COLUMN(CosPBcandidate, cosPBcandidate, float); DECLARE_SOA_COLUMN(Chi2Bcandidate, chi2Bcandidate, float); +DECLARE_SOA_COLUMN(GlobalIndexassoc, globalIndexassoc, uint64_t); +DECLARE_SOA_COLUMN(GlobalIndexleg1, globalIndexleg1, uint64_t); +DECLARE_SOA_COLUMN(GlobalIndexleg2, globalIndexleg2, uint64_t); DECLARE_SOA_COLUMN(Ptassoc, ptassoc, float); DECLARE_SOA_COLUMN(PINassoc, pINassoc, float); DECLARE_SOA_COLUMN(Etaassoc, etaassoc, float); @@ -157,9 +163,11 @@ DECLARE_SOA_TABLE(MuonTrackCuts, "AOD", "DQANAMUONCUTSA", dqanalysisflags::IsMuo DECLARE_SOA_TABLE(MuonAmbiguities, "AOD", "DQMUONAMBA", dqanalysisflags::MuonAmbiguityInBunch, dqanalysisflags::MuonAmbiguityOutOfBunch); //! joinable to ReducedMuonTracks DECLARE_SOA_TABLE(Prefilter, "AOD", "DQPREFILTERA", dqanalysisflags::IsBarrelSelectedPrefilter); //! joinable to ReducedTracksAssoc DECLARE_SOA_TABLE(BmesonCandidates, "AOD", "DQBMESONSA", + dqanalysisflags::RunNumber, dqanalysisflags::EventIdx, dqanalysisflags::EventTimestamp, dqanalysisflags::massBcandidate, dqanalysisflags::MassDileptonCandidate, dqanalysisflags::deltamassBcandidate, dqanalysisflags::pTBcandidate, dqanalysisflags::EtaBcandidate, dqanalysisflags::LxyBcandidate, dqanalysisflags::LxyzBcandidate, dqanalysisflags::LzBcandidate, dqanalysisflags::TauxyBcandidate, dqanalysisflags::TauzBcandidate, dqanalysisflags::CosPBcandidate, dqanalysisflags::Chi2Bcandidate, + dqanalysisflags::GlobalIndexassoc, dqanalysisflags::GlobalIndexleg1, dqanalysisflags::GlobalIndexleg2, dqanalysisflags::PINassoc, dqanalysisflags::Etaassoc, dqanalysisflags::Ptpair, dqanalysisflags::Etapair, dqanalysisflags::PINleg1, dqanalysisflags::Etaleg1, dqanalysisflags::PINleg2, dqanalysisflags::Etaleg2, dqanalysisflags::TPCnsigmaKaassoc, dqanalysisflags::TPCnsigmaPiassoc, dqanalysisflags::TPCnsigmaPrassoc, dqanalysisflags::TOFnsigmaKaassoc, @@ -3459,10 +3467,11 @@ struct AnalysisDileptonTrack { VarManager::FillDileptonHadron(dilepton, track, fValuesHadron); VarManager::FillDileptonTrackVertexing(event, lepton1, lepton2, track, fValuesHadron); // table to be written out for ML analysis - BmesonsTable(fValuesHadron[VarManager::kPairMass], dilepton.mass(), fValuesHadron[VarManager::kDeltaMass], fValuesHadron[VarManager::kPairPt], fValuesHadron[VarManager::kPairEta], + BmesonsTable(event.runNumber(), event.globalIndex(), event.timestamp(), fValuesHadron[VarManager::kPairMass], dilepton.mass(), fValuesHadron[VarManager::kDeltaMass], fValuesHadron[VarManager::kPairPt], fValuesHadron[VarManager::kPairEta], fValuesHadron[VarManager::kVertexingLxy], fValuesHadron[VarManager::kVertexingLxyz], fValuesHadron[VarManager::kVertexingLz], fValuesHadron[VarManager::kVertexingTauxy], fValuesHadron[VarManager::kVertexingTauz], fValuesHadron[VarManager::kCosPointingAngle], fValuesHadron[VarManager::kVertexingChi2PCA], + track.globalIndex(), lepton1.globalIndex(), lepton2.globalIndex(), track.tpcInnerParam(), track.eta(), dilepton.pt(), dilepton.eta(), lepton1.tpcInnerParam(), lepton1.eta(), lepton2.tpcInnerParam(), lepton2.eta(), track.tpcNSigmaKa(), track.tpcNSigmaPi(), track.tpcNSigmaPr(), track.tofNSigmaKa(), lepton1.tpcNSigmaEl(), lepton1.tpcNSigmaPi(), lepton1.tpcNSigmaPr(), From 644fb83db73f42e228b4a2e4fb4b233e8fd96c96 Mon Sep 17 00:00:00 2001 From: samrangy Date: Mon, 8 Sep 2025 10:00:24 +0200 Subject: [PATCH 344/986] [PWGHF] Adding Preslice to tracks and McParticles (#12624) --- PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index afe123a2386..09585789935 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -244,6 +244,8 @@ struct HfCorrelatorD0Hadrons { Filter particlesFilter = nabs(aod::mcparticle::pdgCode) == static_cast(Pdg::kD0) || ((aod::mcparticle::flags & (uint8_t)o2::aod::mcparticle::enums::PhysicalPrimary) == (uint8_t)o2::aod::mcparticle::enums::PhysicalPrimary); Preslice perCol = aod::hf_cand::collisionId; + Preslice perCollisionID = aod::track::collisionId; + Preslice perTrueCollision = o2::aod::mcparticle::mcCollisionId; ConfigurableAxis zPoolBins{"zPoolBins", {VARIABLE_WIDTH, -10.0f, -2.5f, 2.5f, 10.0f}, "z vertex position pools"}; ConfigurableAxis multPoolBins{"multPoolBins", {VARIABLE_WIDTH, 0.0f, 2000.0f, 6000.0f, 10000.0f}, "event multiplicity pools (FT0M)"}; From f51b6e3b32eb1dbea77de0772a3fa2f4bd734f59 Mon Sep 17 00:00:00 2001 From: Chuntai <48704924+wuctlby@users.noreply.github.com> Date: Mon, 8 Sep 2025 11:26:48 +0200 Subject: [PATCH 345/986] [PWGHF] Add D0 into correlatorFlowCharmHadrons (#12866) --- .../DataModel/DerivedDataCorrelationTables.h | 12 +++- .../correlatorFlowCharmHadrons.cxx | 63 +++++++++++++++++-- 2 files changed, 70 insertions(+), 5 deletions(-) diff --git a/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h b/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h index d48cd0f9d10..4565189a5ab 100644 --- a/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h +++ b/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h @@ -81,7 +81,17 @@ DECLARE_SOA_TABLE(DsCandSelInfos, "AOD", "DSCANDSELINFO", //! Table with Ds cand aod::hf_candidate_reduced::BdtScorePrompt, aod::hf_candidate_reduced::BdtScoreBkg); -DECLARE_SOA_TABLE(HfcRedCharmHads, "AOD", "HFCREDCHARMHAD", //! Table with charm hadron candidate info +DECLARE_SOA_TABLE(HfcRedCharmHads2P, "AOD", "HFCREDCHARM2P", //! Table with 2-prong charm hadron candidate info + soa::Index<>, + aod::hf_candidate_reduced::HfcRedFlowCollId, + aod::hf_candidate_reduced::PhiCand, + aod::hf_candidate_reduced::EtaCand, + aod::hf_candidate_reduced::PtCand, + aod::hf_candidate_reduced::InvMassCharmHad, + aod::hf_candidate_reduced::Prong0Id, + aod::hf_candidate_reduced::Prong1Id); + +DECLARE_SOA_TABLE(HfcRedCharmHads3P, "AOD", "HFCREDCHARM3P", //! Table with 3-prong charm hadron candidate info soa::Index<>, aod::hf_candidate_reduced::HfcRedFlowCollId, aod::hf_candidate_reduced::PhiCand, diff --git a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx index dcf48645fe4..f4dd7761455 100644 --- a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx @@ -13,6 +13,7 @@ /// \brief CharmHadrons-Hadrons correlator tree creator for data and MC-reco analyses /// \author Marcello Di Costanzo , Politecnico and INFN Torino /// \author Stefano Politanò , CERN +/// \author Wu Chuntai , CCNU, INFN Padova, and Padova University #include "PWGHF/Core/HfHelper.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" @@ -53,13 +54,16 @@ using namespace o2::hf_evsel; enum DecayChannel { DplusToPiKPi = 0, DsToKKPi, - DsToPiKK + DsToPiKK, + D0ToPiK, + D0ToKPi }; /// Code to select collisions with at least one Ds meson struct HfCorrelatorFlowCharmHadrons { Produces rowCollisions; - Produces rowCharmCandidates; + Produces rowCharmCandidates2P; + Produces rowCharmCandidates3P; Produces rowCharmCandidatesMl; Produces rowAssocTrackReduced; Produces rowAssocTrackSelInfo; @@ -88,18 +92,23 @@ struct HfCorrelatorFlowCharmHadrons { using CollsWithCentMult = soa::Join; using CandDsDataWMl = soa::Filtered>; using CandDplusDataWMl = soa::Filtered>; + using CandD0DataWMl = soa::Filtered>; using TracksData = soa::Filtered>; Filter filterSelectDsCandidates = aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlag || aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlag; Filter filterSelectDplusCandidates = aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= selectionFlag; + Filter filterSelectD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlag || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlag; Filter filterSelectTrackData = (nabs(aod::track::eta) < etaTrackMax) && (aod::track::pt > ptTrackMin) && (aod::track::pt < ptTrackMax) && (nabs(aod::track::dcaXY) < dcaXYTrackMax) && (nabs(aod::track::dcaZ) < dcaZTrackMax); Preslice candsDsPerCollWMl = aod::hf_cand::collisionId; Preslice candsDplusPerCollWMl = aod::hf_cand::collisionId; + Preslice candsD0PerCollWMl = aod::hf_cand::collisionId; Preslice trackIndicesPerColl = aod::track::collisionId; Partition selectedDsToKKPiWMl = aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlag; Partition selectedDsToPiKKWMl = aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlag; + Partition selectedD0ToPiKWMl = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlag; + Partition selectedD0ToKPiWMl = aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlag; HistogramRegistry registry{"registry", {}}; @@ -109,6 +118,10 @@ struct HfCorrelatorFlowCharmHadrons { massCharm = o2::constants::physics::MassDPlus; } else if (doprocessDsWithMl) { massCharm = o2::constants::physics::MassDS; + } else if (doprocessD0WithMl) { + massCharm = o2::constants::physics::MassD0; + } else { + LOG(fatal) << "No decay channel selected to process"; } hfEvSel.addHistograms(registry); // collision monitoring @@ -163,6 +176,12 @@ struct HfCorrelatorFlowCharmHadrons { if constexpr (channel == DecayChannel::DplusToPiKPi) { return hfHelper.invMassDplusToPiKPi(candidate); } + if constexpr (channel == DecayChannel::D0ToPiK) { + return hfHelper.invMassD0ToPiK(candidate); + } + if constexpr (channel == DecayChannel::D0ToKPi) { + return hfHelper.invMassD0barToKPi(candidate); + } return -1.; } @@ -187,6 +206,16 @@ struct HfCorrelatorFlowCharmHadrons { outputMl[iclass] = candidate.mlProbDplusToPiKPi()[classMl->at(iclass)]; } } + if constexpr (channel == DecayChannel::D0ToPiK) { + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { + outputMl[iclass] = candidate.mlProbD0()[classMl->at(iclass)]; + } + } + if constexpr (channel == DecayChannel::D0ToKPi) { + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { + outputMl[iclass] = candidate.mlProbD0bar()[classMl->at(iclass)]; + } + } return outputMl; } @@ -201,8 +230,11 @@ struct HfCorrelatorFlowCharmHadrons { continue; } double massCand = getCandMass(candidate); - rowCharmCandidates(indexRedColl, candidate.phi(), candidate.eta(), candidate.pt(), massCand, candidate.prong0Id(), candidate.prong1Id(), candidate.prong2Id()); - + if constexpr (channel == DecayChannel::D0ToKPi || channel == DecayChannel::D0ToPiK) { + rowCharmCandidates2P(indexRedColl, candidate.phi(), candidate.eta(), candidate.pt(), massCand, candidate.prong0Id(), candidate.prong1Id()); + } else { + rowCharmCandidates3P(indexRedColl, candidate.phi(), candidate.eta(), candidate.pt(), massCand, candidate.prong0Id(), candidate.prong1Id(), candidate.prong2Id()); + } std::vector outputMl = getCandMlScores(candidate); rowCharmCandidatesMl(indexRedColl, outputMl[0], outputMl[1]); } @@ -266,6 +298,29 @@ struct HfCorrelatorFlowCharmHadrons { } } PROCESS_SWITCH(HfCorrelatorFlowCharmHadrons, processDsWithMl, "Process Ds candidates with ML info", false); + + // D0 with ML selections + void processD0WithMl(CollsWithCentMult const& colls, + TracksData const& tracks, + CandD0DataWMl const&) + { + for (const auto& coll : colls) { + auto thisCollId = coll.globalIndex(); + auto candsD0ToPiKWMl = selectedD0ToPiKWMl->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); + auto candsD0ToKPiWMl = selectedD0ToKPiWMl->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); + if (forceCharmInCollision && candsD0ToPiKWMl.size() < 1 && candsD0ToKPiWMl.size() < 1) { + continue; + } + if (!checkAndFillCollision(coll)) { + continue; + } + auto trackIdsThisColl = tracks.sliceBy(trackIndicesPerColl, thisCollId); + fillCharmHadronTables(candsD0ToPiKWMl); + fillCharmHadronTables(candsD0ToKPiWMl); + fillTracksTables(trackIdsThisColl); + } + } + PROCESS_SWITCH(HfCorrelatorFlowCharmHadrons, processD0WithMl, "Process D0 candidates with ML info", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From e0237f6c64048e7a9635138ae31c7375d2df0679 Mon Sep 17 00:00:00 2001 From: Maxim Virta <84773378+MaximVirta@users.noreply.github.com> Date: Mon, 8 Sep 2025 12:47:21 +0300 Subject: [PATCH 346/986] [PWGCF] Effiency changed to float to match CCDB requirements (#12871) --- PWGCF/Core/CorrelationContainer.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGCF/Core/CorrelationContainer.cxx b/PWGCF/Core/CorrelationContainer.cxx index 1421288bd18..3267cda3988 100644 --- a/PWGCF/Core/CorrelationContainer.cxx +++ b/PWGCF/Core/CorrelationContainer.cxx @@ -115,7 +115,7 @@ CorrelationContainer::CorrelationContainer(const char* name, const char* objTitl triggerAxis.insert(triggerAxis.end(), userAxis.begin(), userAxis.end()); mTriggerHist = HistFactory::createHist({"mTriggerHist", "d^{2}N_{ch}/d#varphid#eta", {HistType::kStepTHnF, triggerAxis, fgkCFSteps}}).release(); - mTrackHistEfficiency = HistFactory::createHist({"mTrackHistEfficiency", "Tracking efficiency", {HistType::kStepTHnD, {efficiencyAxis[0], efficiencyAxis[1], {5, -0.5, 4.5, "species"}, correlationAxis[3], efficiencyAxis[2]}, fgkCFSteps}}).release(); + mTrackHistEfficiency = HistFactory::createHist({"mTrackHistEfficiency", "Tracking efficiency", {HistType::kStepTHnF, {efficiencyAxis[0], efficiencyAxis[1], {5, -0.5, 4.5, "species"}, correlationAxis[3], efficiencyAxis[2]}, fgkCFSteps}}).release(); mEventCount = HistFactory::createHist({"mEventCount", ";step;centrality;count", {HistType::kTH2F, {{fgkCFSteps + 2, -2.5, -0.5 + fgkCFSteps, "step"}, correlationAxis[3]}}}).release(); } From e30d45ef0644bf04d7ecd8b8e01b4e0ed45fd225 Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Mon, 8 Sep 2025 13:13:59 +0200 Subject: [PATCH 347/986] [DPG] Add missing `if` for TrackQA table in D0 data creator for calibration studies (#12899) --- .../derivedDataCreatorD0Calibration.cxx | 56 ++++++++++--------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/DPG/Tasks/AOTTrack/derivedDataCreatorD0Calibration.cxx b/DPG/Tasks/AOTTrack/derivedDataCreatorD0Calibration.cxx index 15b5bd5dc77..17224a1545e 100644 --- a/DPG/Tasks/AOTTrack/derivedDataCreatorD0Calibration.cxx +++ b/DPG/Tasks/AOTTrack/derivedDataCreatorD0Calibration.cxx @@ -686,33 +686,35 @@ struct DerivedDataCreatorD0Calibration { int8_t deltaRefGloParamQ2Pt{0}; int8_t deltaTOFdX{0}; int8_t deltaTOFdZ{0}; - if (trackNeg.has_trackQA()) { - auto trackQA = trackNeg.trackQA_as(); // obtain track QA - tpcTime0 = trackQA.tpcTime0(); - tpcdEdxNorm = trackQA.tpcdEdxNorm(); - tpcDcaR = trackQA.tpcdcaR(); - tpcDcaZ = trackQA.tpcdcaZ(); - tpcClusterByteMask = trackQA.tpcClusterByteMask(); - tpcdEdxMax0R = trackQA.tpcdEdxMax0R(); - tpcdEdxMax1R = trackQA.tpcdEdxMax1R(); - tpcdEdxMax2R = trackQA.tpcdEdxMax2R(); - tpcdEdxMax3R = trackQA.tpcdEdxMax3R(); - tpcdEdxTot0R = trackQA.tpcdEdxTot0R(); - tpcdEdxTot1R = trackQA.tpcdEdxTot1R(); - tpcdEdxTot2R = trackQA.tpcdEdxTot2R(); - tpcdEdxTot3R = trackQA.tpcdEdxTot3R(); - deltaRefContParamY = trackQA.deltaRefContParamY(); - deltaRefITSParamZ = trackQA.deltaRefITSParamZ(); - deltaRefContParamSnp = trackQA.deltaRefContParamSnp(); - deltaRefContParamTgl = trackQA.deltaRefContParamTgl(); - deltaRefContParamQ2Pt = trackQA.deltaRefContParamQ2Pt(); - deltaRefGloParamY = trackQA.deltaRefGloParamY(); - deltaRefGloParamZ = trackQA.deltaRefGloParamZ(); - deltaRefGloParamSnp = trackQA.deltaRefGloParamSnp(); - deltaRefGloParamTgl = trackQA.deltaRefGloParamTgl(); - deltaRefGloParamQ2Pt = trackQA.deltaRefGloParamQ2Pt(); - deltaTOFdX = trackQA.deltaTOFdX(); - deltaTOFdZ = trackQA.deltaTOFdZ(); + if constexpr (withTrackQa) { + if (trackNeg.has_trackQA()) { + auto trackQA = trackNeg.template trackQA_as(); // obtain track QA + tpcTime0 = trackQA.tpcTime0(); + tpcdEdxNorm = trackQA.tpcdEdxNorm(); + tpcDcaR = trackQA.tpcdcaR(); + tpcDcaZ = trackQA.tpcdcaZ(); + tpcClusterByteMask = trackQA.tpcClusterByteMask(); + tpcdEdxMax0R = trackQA.tpcdEdxMax0R(); + tpcdEdxMax1R = trackQA.tpcdEdxMax1R(); + tpcdEdxMax2R = trackQA.tpcdEdxMax2R(); + tpcdEdxMax3R = trackQA.tpcdEdxMax3R(); + tpcdEdxTot0R = trackQA.tpcdEdxTot0R(); + tpcdEdxTot1R = trackQA.tpcdEdxTot1R(); + tpcdEdxTot2R = trackQA.tpcdEdxTot2R(); + tpcdEdxTot3R = trackQA.tpcdEdxTot3R(); + deltaRefContParamY = trackQA.deltaRefContParamY(); + deltaRefITSParamZ = trackQA.deltaRefITSParamZ(); + deltaRefContParamSnp = trackQA.deltaRefContParamSnp(); + deltaRefContParamTgl = trackQA.deltaRefContParamTgl(); + deltaRefContParamQ2Pt = trackQA.deltaRefContParamQ2Pt(); + deltaRefGloParamY = trackQA.deltaRefGloParamY(); + deltaRefGloParamZ = trackQA.deltaRefGloParamZ(); + deltaRefGloParamSnp = trackQA.deltaRefGloParamSnp(); + deltaRefGloParamTgl = trackQA.deltaRefGloParamTgl(); + deltaRefGloParamQ2Pt = trackQA.deltaRefGloParamQ2Pt(); + deltaTOFdX = trackQA.deltaTOFdX(); + deltaTOFdZ = trackQA.deltaTOFdZ(); + } } trackTable(selectedCollisions[collision.globalIndex()], // stored at PV From 469f4e23b3f7d84669d4f30665c5da018fd4582a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Mon, 8 Sep 2025 14:55:49 +0200 Subject: [PATCH 348/986] [PWGEM] Fix include in EMCPhotonCut.h (#12900) --- PWGEM/PhotonMeson/Core/EMCPhotonCut.h | 1 + 1 file changed, 1 insertion(+) diff --git a/PWGEM/PhotonMeson/Core/EMCPhotonCut.h b/PWGEM/PhotonMeson/Core/EMCPhotonCut.h index 1e3ac74f6cd..8719fa83626 100644 --- a/PWGEM/PhotonMeson/Core/EMCPhotonCut.h +++ b/PWGEM/PhotonMeson/Core/EMCPhotonCut.h @@ -20,6 +20,7 @@ #include +#include #include #include From 87063e3d1de57d07914d0a3ae03969455ddf9244 Mon Sep 17 00:00:00 2001 From: vbarbaso <146095385+vbarbaso@users.noreply.github.com> Date: Mon, 8 Sep 2025 15:28:01 +0200 Subject: [PATCH 349/986] [PWGLF] Improvements and bug fix in phianalysisTHnSparse task (#12901) Signed-off-by: Veronika Barbasova Co-authored-by: Veronika Barbasova --- .../Tasks/Resonances/phianalysisTHnSparse.cxx | 855 ++++++++---------- 1 file changed, 369 insertions(+), 486 deletions(-) diff --git a/PWGLF/Tasks/Resonances/phianalysisTHnSparse.cxx b/PWGLF/Tasks/Resonances/phianalysisTHnSparse.cxx index f9fa43c1d7f..5d16db9af39 100644 --- a/PWGLF/Tasks/Resonances/phianalysisTHnSparse.cxx +++ b/PWGLF/Tasks/Resonances/phianalysisTHnSparse.cxx @@ -13,22 +13,24 @@ /// \brief Analysis of phi resonance using THnSparse histograms. /// \author Veronika Barbasova (veronika.barbasova@cern.ch) -#include -#include -#include +#include "PWGLF/Utils/rsnOutput.h" +#include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" + #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisTask.h" #include "Framework/O2DatabasePDGPlugin.h" #include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/PID.h" -#include "PWGLF/Utils/rsnOutput.h" -// #include "TDatabasePDG.h" + +#include + +#include +#include using namespace o2; using namespace o2::analysis; @@ -46,31 +48,34 @@ struct PhianalysisTHnSparse { Configurable eventMixing{"eventMixing", "none", "Produce Event Mixing histograms of type."}; } produce; - struct : ConfigurableGroup { - Configurable verboselevel{"verboselevel", 0, "Verbose level"}; - Configurable refresh{"refresh", 0, "Freqency of print event information."}; - Configurable refreshIndex{"refreshIndex", 0, "Freqency of print event information index."}; - } verbose; - - Configurable dautherPos{"dautherPos", 3, "Particle type of the positive dauther according to ReconstructionDataFormats/PID.h (Default = Kaon)"}; - Configurable dautherNeg{"dautherNeg", 3, "Particle type of the negative dauther according to ReconstructionDataFormats/PID.h (Default = Kaon)"}; + Configurable daughterPos{"daughterPos", 3, "Particle type of the positive dauther according to ReconstructionDataFormats/PID.h (Default = Kaon)"}; + Configurable daughterNeg{"daughterNeg", 3, "Particle type of the negative dauther according to ReconstructionDataFormats/PID.h (Default = Kaon)"}; Configurable motherPDG{"motherPDG", 333, "PDG code of mother particle."}; - Configurable dautherPosPDG{"dautherPosPDG", 321, "PDG code of positive dauther particle."}; - Configurable dautherNegPDG{"dautherNegPDG", 321, "PDG code of negative dauther particle."}; + Configurable daughterPosPDG{"daughterPosPDG", 321, "PDG code of positive dauther particle."}; + Configurable daughterNegPDG{"daughterNegPDG", 321, "PDG code of negative dauther particle."}; struct : ConfigurableGroup { Configurable tpcnSigmaPos{"tpcnSigmaPos", 3.0f, "TPC NSigma cut of the positive particle."}; Configurable tpcnSigmaNeg{"tpcnSigmaNeg", 3.0f, "TPC NSigma cut of the negative particle."}; - Configurable vZ{"vZ", 10.0f, "Z vertex range."}; - Configurable y{"y", 0.5, "Rapidity cut (maximum)."}; - Configurable etatrack{"etatrack", 0.8, "Eta cut for track."}; - Configurable etapair{"etapair", 0.8, "Eta cut for pair."}; + Configurable tpcPidOnly{"tpcPidOnly", false, "Use TPC only for PID."}; + Configurable combinedNSigma{"combinedNSigma", 3.0f, "Combined NSigma cut for combined TPC and TOF NSigma cut."}; + Configurable ptTOFThreshold{"ptTOFThreshold", 0.5f, "Threshold for applying TOF."}; + Configurable rapidity{"rapidity", 0.5f, "Rapidity cut (maximum)."}; + Configurable etatrack{"etatrack", 0.8f, "Eta cut for track."}; + Configurable etapair{"etapair", 0.5f, "Eta cut for pair."}; Configurable pt{"pt", 0.15f, "Cut: Minimal value of tracks pt."}; Configurable dcaXY{"dcaXY", 1.0f, "Cut: Maximal value of tracks DCA XY."}; Configurable dcaZ{"dcaZ", 1.0f, "Cut: Maximal value of tracks DCA Z."}; + Configurable globalTrack{"globalTrack", false, "Use global track selection."}; Configurable tpcNClsFound{"tpcNClsFound", 70, "Cut: Minimal value of found TPC clasters"}; } cut; + struct : ConfigurableGroup { + Configurable verboselevel{"verboselevel", 0, "Verbose level"}; + Configurable refresh{"refresh", 0, "Freqency of print event information."}; + Configurable refreshIndex{"refreshIndex", 0, "Freqency of print event information index."}; + } verbose; + Configurable> sparseAxes{"sparseAxes", std::vector{o2::analysis::rsn::pair_axis::names}, "Axes."}; Configurable> sysAxes{"sysAxes", std::vector{o2::analysis::rsn::systematic_axis::names}, "Axes."}; @@ -80,9 +85,9 @@ struct PhianalysisTHnSparse { ConfigurableAxis multiplicityaxis{"multiplicityaxis", {50, 0., 5000.}, "Multiplicity axis binning."}; ConfigurableAxis centralityaxis{"centralityaxis", {20, 0., 100.}, "Centrality axis binning."}; ConfigurableAxis etaaxis{"etaaxis", {16., -1.0 * static_cast(cut.etatrack), static_cast(cut.etatrack)}, "Pseudorapidity axis binning."}; - ConfigurableAxis rapidityaxis{"rapidityaxis", {10., -1.0 * static_cast(cut.y), static_cast(cut.y)}, "Rapidity axis binning."}; - ConfigurableAxis nsigmaaxisPos{"nsigmaaxisPos", {1, 0., static_cast(cut.tpcnSigmaPos)}, "NSigma of positive particle axis binning in THnSparse."}; - ConfigurableAxis nsigmaaxisNeg{"nsigmaaxisNeg", {1, 0., static_cast(cut.tpcnSigmaNeg)}, "NSigma of negative particle axis binning in THnSparse."}; + ConfigurableAxis rapidityaxis{"rapidityaxis", {10., -1.0 * static_cast(cut.rapidity), static_cast(cut.rapidity)}, "Rapidity axis binning."}; + ConfigurableAxis nsigmaaxisPos{"nsigmaaxisPos", {1, -static_cast(cut.tpcnSigmaPos), static_cast(cut.tpcnSigmaPos)}, "NSigma of positive particle axis binning in THnSparse."}; + ConfigurableAxis nsigmaaxisNeg{"nsigmaaxisNeg", {1, -static_cast(cut.tpcnSigmaNeg), static_cast(cut.tpcnSigmaNeg)}, "NSigma of negative particle axis binning in THnSparse."}; // mixing using BinningTypeVzMu = ColumnBinningPolicy>; @@ -92,14 +97,10 @@ struct PhianalysisTHnSparse { ConfigurableAxis axisMultiplicityMixing{"axisMultiplicityMixing", {5, 0, 5000}, "TPC multiplicity for bin"}; ConfigurableAxis axisCentralityMixing{"axisCentralityMixing", {10, 0, 100}, "Multiplicity percentil binning for mixing"}; - // defined in DataFormats/Reconstruction/include/ReconstructionDataFormats/PID.h - float massPos = o2::track::PID::getMass(dautherPos); - float massNeg = o2::track::PID::getMass(dautherNeg); - // Axes specifications AxisSpec posZaxis = {400, -20., 20., "V_{z} (cm)"}; - AxisSpec dcaXYaxis = {120, -3.0, 3.0, "DCA_{xy} (cm)"}; - AxisSpec dcaZaxis = {120, -3.0, 3.0, "DCA_{z} (cm)"}; + AxisSpec dcaXYaxis = {800, -2.0, 2.0, "DCA_{xy} (cm)"}; + AxisSpec dcaZaxis = {800, -2.0, 2.0, "DCA_{z} (cm)"}; AxisSpec etaQAaxis = {1000, -1.0, 1.0, "#eta"}; AxisSpec tpcNClsFoundQAaxis = {110, 50., 160., "tpcNClsFound"}; @@ -109,45 +110,51 @@ struct PhianalysisTHnSparse { Service pdg; int n = 0; + float massPos = o2::track::PID::getMass(3); + float massNeg = o2::track::PID::getMass(3); double* pointPair = nullptr; double* pointSys = nullptr; - TLorentzVector d1, d2, mother; - bool produceQA, dataQA, MCTruthQA, t1, t2 = false; - int id; - float etapair = 0.8; - float tpcnSigmaPos = 3.0f; - float tpcnSigmaNeg = 3.0f; + ROOT::Math::PxPyPzMVector d1, d2, mother; + bool produceQA, dataQA, MCTruthQA, globalTrack, tpcPidOnly = false; + float tpcnSigmaPos = 100.0f; + float tpcnSigmaNeg = 100.0f; + float combinedNSigma = 100.0f; + float ptTOFThreshold = 0.5f; int tpcNClsFound = 70; + int dauSize = 2; rsn::MixingType mixingType = rsn::MixingType::none; + float vzCut = 10.0f; Filter triggerFilter = (o2::aod::evsel::sel8 == true); - Filter vtxFilter = (nabs(o2::aod::collision::posZ) < static_cast(cut.vZ)); - - Filter ptFilter = nabs(aod::track::pt) > static_cast(cut.pt); - Filter etaFilter = nabs(aod::track::eta) < static_cast(cut.etatrack); - Filter dcaFilter = (nabs(o2::aod::track::dcaXY) < static_cast(cut.dcaXY)) && (nabs(o2::aod::track::dcaZ) < static_cast(cut.dcaZ)); + Filter vtxFilter = (nabs(o2::aod::collision::posZ) < vzCut); using EventCandidates = soa::Filtered>; using EventCandidate = EventCandidates::iterator; - using TrackCandidates = soa::Filtered>; + using TrackCandidates = soa::Join; using EventCandidatesMC = soa::Filtered>; - using TrackCandidatesMC = soa::Filtered>; + using TrackCandidatesMC = soa::Join; using EventCandidatesMCGen = soa::Join; - using LabeledTracks = soa::Join; Preslice perCollision = aod::track::collisionId; - Partition positive = (aod::track::signed1Pt > 0.0f) && (nabs(o2::aod::pidtpc::tpcNSigmaKa) < std::abs(static_cast(cut.tpcnSigmaPos))); - Partition negative = (aod::track::signed1Pt < 0.0f) && (nabs(o2::aod::pidtpc::tpcNSigmaKa) < std::abs(static_cast(cut.tpcnSigmaNeg))); + Partition positive = (aod::track::signed1Pt > 0.0f); + Partition negative = (aod::track::signed1Pt < 0.0f); - Partition positiveMC = (aod::track::signed1Pt > 0.0f) && (nabs(o2::aod::pidtpc::tpcNSigmaKa) < std::abs(static_cast(cut.tpcnSigmaPos))); - Partition negativeMC = (aod::track::signed1Pt < 0.0f) && (nabs(o2::aod::pidtpc::tpcNSigmaKa) < std::abs(static_cast(cut.tpcnSigmaNeg))); + Partition positiveMC = (aod::track::signed1Pt > 0.0f); + Partition negativeMC = (aod::track::signed1Pt < 0.0f); void init(o2::framework::InitContext&) { + // defined in DataFormats/Reconstruction/include/ReconstructionDataFormats/PID.h + massPos = o2::track::PID::getMass(static_cast(daughterPos)); + massNeg = o2::track::PID::getMass(static_cast(daughterNeg)); + LOGF(info, "Initializing particle masses: "); + LOGF(info, " Positive: %d, mass: %f", static_cast(daughterPos), massPos); + LOGF(info, " Negative: %d, mass: %f", static_cast(daughterNeg), massNeg); + // Sparse axes AxisSpec invAxis = {invaxis, "Inv. mass (GeV/c^{2})", "im"}; AxisSpec ptAxis = {ptaxis, "p_{T} (GeV/c)", "pt"}; @@ -172,85 +179,113 @@ struct PhianalysisTHnSparse { produceQA = static_cast(produce.produceQA); mixingType = rsn::mixingTypeName(static_cast(produce.eventMixing)); - etapair = static_cast(cut.etapair); tpcnSigmaPos = static_cast(cut.tpcnSigmaPos); tpcnSigmaNeg = static_cast(cut.tpcnSigmaNeg); tpcNClsFound = static_cast(cut.tpcNClsFound); + globalTrack = static_cast(cut.globalTrack); + combinedNSigma = static_cast(cut.combinedNSigma); + tpcPidOnly = static_cast(cut.tpcPidOnly); + ptTOFThreshold = static_cast(cut.ptTOFThreshold); pointPair = new double[static_cast(o2::analysis::rsn::PairAxisType::unknown)]; pointSys = new double[static_cast(o2::analysis::rsn::SystematicsAxisType::unknown)]; rsnOutput = new o2::analysis::rsn::OutputSparse(); rsnOutput->init(sparseAxes, allAxes, sysAxes, allAxesSys, static_cast(produce.produceTrue), mixingType, static_cast(produce.produceLikesign), ®istry); + // Print summary of configuration + LOGF(info, "=== PhianalysisTHnSparse configuration summary ==="); + LOGF(info, "produceQA: %s", produceQA ? "true" : "false"); + LOGF(info, "produceTrue: %s", static_cast(produce.produceTrue) ? "true" : "false"); + LOGF(info, "produceLikesign: %s", static_cast(produce.produceLikesign) ? "true" : "false"); + LOGF(info, "eventMixing: %s", static_cast(produce.eventMixing).c_str()); + LOGF(info, "daughterPos: %d (PDG: %d)", static_cast(daughterPos), static_cast(daughterPosPDG)); + LOGF(info, "daughterNeg: %d (PDG: %d)", static_cast(daughterNeg), static_cast(daughterNegPDG)); + LOGF(info, "motherPDG: %d", static_cast(motherPDG)); + LOGF(info, "tpcnSigmaPos: %.2f", tpcnSigmaPos); + LOGF(info, "tpcnSigmaNeg: %.2f", tpcnSigmaNeg); + LOGF(info, "tpcPidOnly: %s", tpcPidOnly ? "true" : "false"); + LOGF(info, "combinedNSigma: %.2f", combinedNSigma); + LOGF(info, "ptTOFThreshold: %.2f", ptTOFThreshold); + LOGF(info, "rapidity: %.2f", static_cast(cut.rapidity)); + LOGF(info, "etatrack: %.2f", static_cast(cut.etatrack)); + LOGF(info, "etapair: %.2f", static_cast(cut.etapair)); + LOGF(info, "pt (min): %.2f", static_cast(cut.pt)); + LOGF(info, "dcaXY: %.2f", static_cast(cut.dcaXY)); + LOGF(info, "dcaZ: %.2f", static_cast(cut.dcaZ)); + LOGF(info, "globalTrack: %s", globalTrack ? "true" : "false"); + LOGF(info, "tpcNClsFound: %d", tpcNClsFound); + LOGF(info, "mixingType: %d", static_cast(mixingType)); + LOGF(info, "numberofMixedEvents: %d", static_cast(numberofMixedEvents)); + LOGF(info, "sparseAxes: "); + for (const auto& axis : static_cast>(sparseAxes)) { + LOGF(info, " %s", axis.c_str()); + } + LOGF(info, "sysAxes: "); + for (const auto& axis : static_cast>(sysAxes)) { + LOGF(info, " %s", axis.c_str()); + } + LOGF(info, "==============================================="); + if (produceQA) { // Event QA - registry.add("QAEvent/hSelection", "Event selection statistics", kTH1F, {{1, 0.0f, 1.0f}}); + registry.add("QAEvent/hSelection", "Event selection statistics", kTH1D, {{3, 0.0f, 3.0f}}); auto hEvent = registry.get(HIST("QAEvent/hSelection")); hEvent->GetXaxis()->SetBinLabel(1, "Full event statistics"); + hEvent->GetXaxis()->SetBinLabel(2, "Events with at least one #phi candidate"); + hEvent->GetXaxis()->SetBinLabel(3, "#phi candidates"); hEvent->SetMinimum(0.1); registry.add("QAEvent/hVtxZ", "Vertex position along the z-axis", kTH1F, {posZaxis}); - registry.add("QAEvent/hCent", "Distribution of multiplicity percentile", kTH1F, {{100, 0., 100.}}); + registry.add("QAEvent/hCent", "Distribution of multiplicity percentile", kTH1F, {{101, 0., 101.}}); registry.add("QAEvent/hMult", "Multiplicity (amplitude of non-zero channels in the FV0A + FV0C) ", kTH1F, {{300, 0., 30000.}}); - registry.add("QAEvent/h2Size", "Number of positive vs. negative Kaons per collision", kTH2F, {{30, 0., 30.}, {30, 0., 30.}}); // Track QA - registry.add("QATrack/hSelection", "Tracks combinations statistics", kTH1F, {{11, 0.0f, 11.0f}}); + registry.add("QATrack/hSelection", "Tracks statistics", kTH1D, {{10, 0.0f, 10.0f}}); auto hTrack = registry.get(HIST("QATrack/hSelection")); - hTrack->GetXaxis()->SetBinLabel(1, "all K^{+} K^{-} combinations"); - hTrack->GetXaxis()->SetBinLabel(2, "all K^{+}"); - hTrack->GetXaxis()->SetBinLabel(3, "all K^{-}"); - hTrack->GetXaxis()->SetBinLabel(4, "K^{+} tpcNClsFound"); - hTrack->GetXaxis()->SetBinLabel(5, "K^{-} tpcNClsFound"); - hTrack->GetXaxis()->SetBinLabel(6, "K^{+} isPrimaryTrack"); - hTrack->GetXaxis()->SetBinLabel(7, "K^{-} isPrimaryTrack"); - hTrack->GetXaxis()->SetBinLabel(8, "K^{+} isPVContributor"); - hTrack->GetXaxis()->SetBinLabel(9, "K^{-} isPVContributor"); - hTrack->GetXaxis()->SetBinLabel(10, "selected combinations"); - hTrack->GetXaxis()->SetBinLabel(11, "selected pairs (eta cut)"); + hTrack->GetXaxis()->SetBinLabel(1, "all tracks"); + hTrack->GetXaxis()->SetBinLabel(2, "passed pT cut"); + hTrack->GetXaxis()->SetBinLabel(3, "passed eta cut"); + hTrack->GetXaxis()->SetBinLabel(4, "passed DCA cut"); + hTrack->GetXaxis()->SetBinLabel(5, "passed PID cut"); + hTrack->GetXaxis()->SetBinLabel(6, "passed rapidity cut"); + hTrack->GetXaxis()->SetBinLabel(7, "passed tpcNClsFound cut"); + hTrack->GetXaxis()->SetBinLabel(8, "passed isPrimaryTrack cut"); + hTrack->GetXaxis()->SetBinLabel(9, "passed isPVContributor cut"); + hTrack->GetXaxis()->SetBinLabel(10, "passed all cuts"); hTrack->SetMinimum(0.1); - // Track1 - registry.add("QATrack/bs/hTrack1pt", "K^{+} p_{T} before selection", kTH1F, {ptAxis}); - registry.add("QATrack/bs/hTrack1DCAxy", "K^{+} DCA_{xy} before selection", kTH1F, {dcaXYaxis}); - registry.add("QATrack/bs/hTrack1DCAz", "K^{+} DCA_{z} before selection", kTH1F, {dcaZaxis}); - registry.add("QATrack/bs/hTrack1eta", "K^{+} #eta before selection", kTH1F, {{etaQAaxis}}); - registry.add("QATrack/bs/hTrack1tpcNClsFound", "K^{+} tpcNClsFound before selection", kTH1F, {{tpcNClsFoundQAaxis}}); - - registry.add("QATrack/as/hTrack1pt", "K^{+} p_{T} after selection", kTH1F, {ptAxis}); - registry.add("QATrack/as/hTrack1DCAxy", "K^{+} DCA_{xy} after selection", kTH1F, {dcaXYaxis}); - registry.add("QATrack/as/hTrack1DCAz", "K^{+} DCA_{z} after selection", kTH1F, {dcaZaxis}); - registry.add("QATrack/as/hTrack1eta", "K^{+} #eta after selection", kTH1F, {{etaQAaxis}}); - registry.add("QATrack/as/hTrack1tpcNClsFound", "K^{+} tpcNClsFound after selection", kTH1F, {{tpcNClsFoundQAaxis}}); - - // Track2 - registry.add("QATrack/bs/hTrack2pt", "K^{-} p_{T} before selection", kTH1F, {ptAxis}); - registry.add("QATrack/bs/hTrack2DCAxy", "K^{-} DCA_{xy} before selection", kTH1F, {dcaXYaxis}); - registry.add("QATrack/bs/hTrack2DCAz", "K^{-} DCA_{z} before selection", kTH1F, {dcaZaxis}); - registry.add("QATrack/bs/hTrack2eta", "K^{-} #eta before selection", kTH1F, {{etaQAaxis}}); - registry.add("QATrack/bs/hTrack2tpcNClsFound", "K^{-} tpcNClsFound before selection", kTH1F, {{tpcNClsFoundQAaxis}}); - - registry.add("QATrack/as/hTrack2pt", "K^{-} p_{T} after selection", kTH1F, {ptAxis}); - registry.add("QATrack/as/hTrack2DCAxy", "K^{-} DCA_{xy} after selection", kTH1F, {dcaXYaxis}); - registry.add("QATrack/as/hTrack2DCAz", "K^{-} DCA_{z} after selection", kTH1F, {dcaZaxis}); - registry.add("QATrack/as/hTrack2eta", "K^{-} #eta after selection", kTH1F, {{etaQAaxis}}); - registry.add("QATrack/as/hTrack2tpcNClsFound", "K^{-} tpcNClsFound after selection", kTH1F, {{tpcNClsFoundQAaxis}}); + registry.add("QATrack/hRapidity", "Rapidity distribution of K^{+} and K^{-}", kTH1F, {{200, -1, 1}}); + registry.add("QATrack/hEta", "Pseudorapidity distribution of K^{+} and K^{-}", kTH1F, {{200, -1, 1}}); + registry.add("QATrack/hTPCNClsFound", "Distribution of TPC NClsFound of K^{+} and K^{-}", kTH1F, {tpcNClsFoundQAaxis}); + registry.add("QATrack/hDCAxy", "Distribution of DCA_{xy} of K^{+} and K^{-}", kTH1F, {dcaXYaxis}); + registry.add("QATrack/hDCAz", "Distribution of DCA_{z} of K^{+} and K^{-}", kTH1F, {dcaZaxis}); + registry.add("QATrack/hPt", "Distribution of p_{T} of K^{+} and K^{-}", kTH1F, {ptaxis}); // TPC PID - registry.add("QATrack/TPCPID/h2TracknSigma", "", kTH2F, {{120, -6, 6}, {120, -6, 6}}); - auto h2TracknSigma = registry.get(HIST("QATrack/TPCPID/h2TracknSigma")); - h2TracknSigma->GetXaxis()->SetTitle("n#sigma_{TPC} K^{+}"); - h2TracknSigma->GetYaxis()->SetTitle("n#sigma_{TPC} K^{-}"); + registry.add("QATrack/hTPCnSigma", "Distribution of TPC nSigma of K^{+} and K^{-}", kTH1F, {{200, -10, 10}}); - registry.add("QATrack/TPCPID/h2nTrack1SigmaPt", "", kTH2F, {{100, 0, 10}, {120, -6, 6}}); - auto h2nTrack1SigmaPt = registry.get(HIST("QATrack/TPCPID/h2nTrack1SigmaPt")); - h2nTrack1SigmaPt->GetXaxis()->SetTitle("p_{T} (GeV/c)"); - h2nTrack1SigmaPt->GetYaxis()->SetTitle("n#sigma_{TPC} K^{+}"); + registry.add("QATrack/h2TPCnSigma", "", kTH2F, {{200, -10, 10}, {200, -10, 10}}); + auto h2TPCnSigma = registry.get(HIST("QATrack/h2TPCnSigma")); + h2TPCnSigma->GetXaxis()->SetTitle("n#sigma_{TPC} K^{+}"); + h2TPCnSigma->GetYaxis()->SetTitle("n#sigma_{TPC} K^{-}"); - registry.add("QATrack/TPCPID/h2nTrack2SigmaPt", "", kTH2F, {{100, 0, 10}, {120, -6, 6}}); - auto h2nTrack2SigmaPt = registry.get(HIST("QATrack/TPCPID/h2nTrack2SigmaPt")); - h2nTrack2SigmaPt->GetXaxis()->SetTitle("p_{T} (GeV/c)"); - h2nTrack2SigmaPt->GetYaxis()->SetTitle("n#sigma_{TPC} K^{-}"); + registry.add("QATrack/h2TPCnSigmaPt", "", kTH2F, {ptaxis, {200, -10, 10}}); + auto h2TPCnSigmaPt = registry.get(HIST("QATrack/h2TPCnSigmaPt")); + h2TPCnSigmaPt->GetXaxis()->SetTitle("p_{T} (GeV/c)"); + h2TPCnSigmaPt->GetYaxis()->SetTitle("n#sigma_{TPC} K^{#pm}"); + + // TOF PID + registry.add("QATrack/hTOFnSigma", "Distribution of TOF nSigma of K^{+} and K^{-}", kTH1F, {{200, -10, 10}}); + + registry.add("QATrack/h2TOFnSigma", "", kTH2F, {{200, -10, 10}, {200, -10, 10}}); + auto h2TOFnSigma = registry.get(HIST("QATrack/h2TOFnSigma")); + h2TOFnSigma->GetXaxis()->SetTitle("n#sigma_{TOF} K^{+}"); + h2TOFnSigma->GetYaxis()->SetTitle("n#sigma_{TOF} K^{-}"); + + registry.add("QATrack/h2TOFnSigmaPt", "", kTH2F, {ptaxis, {200, -10, 10}}); + auto h2TOFnSigmaPt = registry.get(HIST("QATrack/h2TOFnSigmaPt")); + h2TOFnSigmaPt->GetXaxis()->SetTitle("p_{T} (GeV/c)"); + h2TOFnSigmaPt->GetYaxis()->SetTitle("n#sigma_{TOF} K^{#pm}"); // MC Truth if (static_cast(produce.produceTrue)) { @@ -259,27 +294,6 @@ struct PhianalysisTHnSparse { hMCEventTruth->GetXaxis()->SetBinLabel(1, "Full MC Truth event statistics"); hMCEventTruth->SetMinimum(0.1); - registry.add("QAMC/Truth/hMCTrack", "MC Truth Track statistics", kTH1F, {{17, 0.0f, 17.0f}}); - auto hMCTrackTruth = registry.get(HIST("QAMC/Truth/hMCTrack")); - hMCTrackTruth->GetXaxis()->SetBinLabel(1, "all K^{+} K^{-} combinations"); - hMCTrackTruth->GetXaxis()->SetBinLabel(2, "all K^{+}"); - hMCTrackTruth->GetXaxis()->SetBinLabel(3, "all K^{-}"); - hMCTrackTruth->GetXaxis()->SetBinLabel(4, "K^{+} tpcNClsFound"); - hMCTrackTruth->GetXaxis()->SetBinLabel(5, "K^{-} tpcNClsFound"); - hMCTrackTruth->GetXaxis()->SetBinLabel(6, "K^{+} isPrimaryTrack"); - hMCTrackTruth->GetXaxis()->SetBinLabel(7, "K^{-} isPrimaryTrack"); - hMCTrackTruth->GetXaxis()->SetBinLabel(8, "K^{+} isPVContributor"); - hMCTrackTruth->GetXaxis()->SetBinLabel(9, "K^{-} isPVContributor"); - hMCTrackTruth->GetXaxis()->SetBinLabel(10, "selected combinations"); - hMCTrackTruth->GetXaxis()->SetBinLabel(11, "MCtrack PDG = 321"); - hMCTrackTruth->GetXaxis()->SetBinLabel(12, "all mothers"); - hMCTrackTruth->GetXaxis()->SetBinLabel(13, "equal mother PDGs"); - hMCTrackTruth->GetXaxis()->SetBinLabel(14, "equal mother IDs"); - hMCTrackTruth->GetXaxis()->SetBinLabel(15, "mother rapidity cut"); - hMCTrackTruth->GetXaxis()->SetBinLabel(16, "mother PDG = 333"); - hMCTrackTruth->GetXaxis()->SetBinLabel(17, "selected pairs (eta cut)"); - hMCTrackTruth->SetMinimum(0.1); - registry.add("QAMC/hInvMassTrueFalse", "", kTH1F, {invAxis}); // not written events in True distribution due to repetition of mothers?? // MC Gen @@ -289,33 +303,14 @@ struct PhianalysisTHnSparse { hMCEventGen->GetXaxis()->SetBinLabel(2, "McCollision V_{z} cut"); hMCEventGen->GetXaxis()->SetBinLabel(3, "collisions"); hMCEventGen->SetMinimum(0.1); - - registry.add("QAMC/Gen/hMCTrack", "MC Gen Track statistics", kTH1D, {{7, 0.0f, 7.0f}}); - auto hMCTrackGen = registry.get(HIST("QAMC/Gen/hMCTrack")); - hMCTrackGen->GetXaxis()->SetBinLabel(1, "all mcParticles"); - hMCTrackGen->GetXaxis()->SetBinLabel(2, "rapidity cut"); - hMCTrackGen->GetXaxis()->SetBinLabel(3, "particle PDG = 333"); - hMCTrackGen->GetXaxis()->SetBinLabel(4, "has 2 dauthers"); - hMCTrackGen->GetXaxis()->SetBinLabel(5, "all dauthers"); - hMCTrackGen->GetXaxis()->SetBinLabel(6, "isPhysicalPrimary"); - hMCTrackGen->GetXaxis()->SetBinLabel(7, "selected pairs"); - hMCTrackGen->SetMinimum(0.1); } // Mixing QA if (mixingType != rsn::MixingType::none) { - registry.add("QAMixing/hSelection", "Event mixing selection statistics", kTH1F, {{1, 0.0f, 1.0f}}); + registry.add("QAMixing/hSelection", "Event mixing selection statistics", kTH1D, {{1, 0.0f, 1.0f}}); auto hEM = registry.get(HIST("QAMixing/hSelection")); hEM->GetXaxis()->SetBinLabel(1, "Full event mixing statistics"); hEM->SetMinimum(0.1); - registry.add("QAMixing/hTrackSelection", "Event mixing tracks combinations statistics", kTH1F, {{4, 0.0f, 4.0f}}); - auto hEMTrack = registry.get(HIST("QAMixing/hTrackSelection")); - hEMTrack->GetXaxis()->SetBinLabel(1, "all K^{+} K^{-} combinations"); - hEMTrack->GetXaxis()->SetBinLabel(2, "all K^{+}"); - hEMTrack->GetXaxis()->SetBinLabel(3, "all K^{-}"); - hEMTrack->GetXaxis()->SetBinLabel(4, "selected pairs (eta cut)"); - hEMTrack->SetMinimum(0.1); - registry.add("QAMixing/h2mu1_mu2", "Event Mixing Multiplicity", kTH2F, {axisMultiplicityMixing, axisMultiplicityMixing}); auto h2EMmu = registry.get(HIST("QAMixing/h2mu1_mu2")); h2EMmu->GetXaxis()->SetTitle("1.Event multiplicity"); @@ -338,88 +333,94 @@ struct PhianalysisTHnSparse { } template - bool selectedTrack(const T& track) + bool selectedTrack(const T& track, bool isPositive) { - if (produceQA) { - if (t1) { - if (dataQA) - registry.fill(HIST("QATrack/hSelection"), 1.5); - if (MCTruthQA) - registry.fill(HIST("QAMC/Truth/hMCTrack"), 1.5); - } - if (t2) { - if (dataQA) - registry.fill(HIST("QATrack/hSelection"), 2.5); - if (MCTruthQA) - registry.fill(HIST("QAMC/Truth/hMCTrack"), 2.5); - } + if (produceQA && dataQA) + registry.fill(HIST("QATrack/hSelection"), 0.5); // all tracks + + // Apply pT cut + if (track.pt() < static_cast(cut.pt)) + return false; + if (produceQA && dataQA) + registry.fill(HIST("QATrack/hSelection"), 1.5); + + // Apply eta cut + if (std::abs(track.eta()) >= static_cast(cut.etatrack)) + return false; + if (produceQA && dataQA) + registry.fill(HIST("QATrack/hSelection"), 2.5); + + // Apply DCA cuts + if (std::abs(track.dcaXY()) >= static_cast(cut.dcaXY) || + std::abs(track.dcaZ()) >= static_cast(cut.dcaZ)) + return false; + if (produceQA && dataQA) + registry.fill(HIST("QATrack/hSelection"), 3.5); + + // PID selection: TPC-only for pt < threshold value, TPC+TOF for pt >= threshold value and have TOF, else TPC-only + float nSigmaCut = isPositive ? tpcnSigmaPos : tpcnSigmaNeg; + if (track.pt() < ptTOFThreshold || !track.hasTOF() || tpcPidOnly) { + if (std::abs(track.tpcNSigmaKa()) >= nSigmaCut) + return false; + } else { + if (std::sqrt(track.tpcNSigmaKa() * track.tpcNSigmaKa() + track.tofNSigmaKa() * track.tofNSigmaKa()) >= combinedNSigma) + return false; } + if (produceQA && dataQA) + registry.fill(HIST("QATrack/hSelection"), 4.5); - if (track.tpcNClsFound() < tpcNClsFound) + // Apply rapidity cut + if (std::abs(track.rapidity(isPositive ? massPos : massNeg)) > static_cast(cut.rapidity)) { return false; - if (produceQA) { - if (t1) { - if (dataQA) - registry.fill(HIST("QATrack/hSelection"), 3.5); - if (MCTruthQA) - registry.fill(HIST("QAMC/Truth/hMCTrack"), 3.5); - } - if (t2) { - if (dataQA) - registry.fill(HIST("QATrack/hSelection"), 4.5); - if (MCTruthQA) - registry.fill(HIST("QAMC/Truth/hMCTrack"), 4.5); - } } - if (!track.isPrimaryTrack()) + if (produceQA && dataQA) + registry.fill(HIST("QATrack/hSelection"), 5.5); + + // Apply tpcNClsFound cut + if (track.tpcNClsFound() < tpcNClsFound) return false; - if (produceQA) { - if (t1) { - if (dataQA) - registry.fill(HIST("QATrack/hSelection"), 5.5); - if (MCTruthQA) - registry.fill(HIST("QAMC/Truth/hMCTrack"), 5.5); - } - if (t2) { - if (dataQA) - registry.fill(HIST("QATrack/hSelection"), 6.5); - if (MCTruthQA) - registry.fill(HIST("QAMC/Truth/hMCTrack"), 6.5); - } + if (produceQA && dataQA) + registry.fill(HIST("QATrack/hSelection"), 6.5); + + if (globalTrack) { + // Apply Global track cuts + if (!track.isGlobalTrack()) + return false; + } else { + // Apply Primary track cuts + if (!track.isPrimaryTrack()) + return false; } + if (produceQA && dataQA) + registry.fill(HIST("QATrack/hSelection"), 7.5); + + // Apply PV Contributor cuts if (!track.isPVContributor()) return false; - if (produceQA) { - if (t1) { - if (dataQA) - registry.fill(HIST("QATrack/hSelection"), 7.5); - if (MCTruthQA) - registry.fill(HIST("QAMC/Truth/hMCTrack"), 7.5); - } - if (t2) { - if (dataQA) - registry.fill(HIST("QATrack/hSelection"), 8.5); - if (MCTruthQA) - registry.fill(HIST("QAMC/Truth/hMCTrack"), 8.5); - } - } + if (produceQA && dataQA) + registry.fill(HIST("QATrack/hSelection"), 8.5); + + if (produceQA && dataQA) + registry.fill(HIST("QATrack/hSelection"), 9.5); + return true; } template - bool selectedPair(TLorentzVector& mother, const T& track1, const T& track2) + bool selectedPair(ROOT::Math::PxPyPzMVector& mother, const T& track1, const T& track2) { - d1.SetXYZM(track1.px(), track1.py(), track1.pz(), massPos); - d2.SetXYZM(track2.px(), track2.py(), track2.pz(), massNeg); + d1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massPos); + d2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massNeg); mother = d1 + d2; - if (std::abs(mother.Eta()) > etapair) + if (std::abs(mother.Eta()) > static_cast(cut.etapair)) return false; + return true; } template float getMultiplicity(const T& collision) { - float multiplicity = collision.multFT0C() + collision.multFT0A(); + float multiplicity = collision.multFT0M(); return multiplicity; } template @@ -449,81 +450,74 @@ struct PhianalysisTHnSparse { void processData(EventCandidate const& collision, TrackCandidates const& /*tracks*/) { - auto posDauthers = positive->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - auto negDauthers = negative->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - + auto posDaughters = positive->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + auto negDaughters = negative->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + n = 0; if (produceQA) { registry.fill(HIST("QAEvent/hSelection"), 0.5); - registry.fill(HIST("QAEvent/h2Size"), posDauthers.size(), negDauthers.size()); registry.fill(HIST("QAEvent/hVtxZ"), collision.posZ()); registry.fill(HIST("QAEvent/hMult"), getMultiplicity(collision)); registry.fill(HIST("QAEvent/hCent"), getCentrality(collision)); + + dataQA = true; + for (const auto& track : posDaughters) { + selectedTrack(track, true); + } + for (const auto& track : negDaughters) { + selectedTrack(track, false); + } + dataQA = false; } if (static_cast(verbose.verboselevel) > 0 && static_cast(verbose.refresh) > 0 && collision.globalIndex() % static_cast(verbose.refresh) == static_cast(verbose.refreshIndex)) - LOGF(info, "%d pos=%lld neg=%lld, Z vertex position: %f [cm]", collision.globalIndex(), posDauthers.size(), negDauthers.size(), collision.posZ()); + LOGF(info, "%d pos=%lld neg=%lld, Z vertex position: %f [cm]", collision.globalIndex(), posDaughters.size(), negDaughters.size(), collision.posZ()); - for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(posDauthers, negDauthers))) { - if (produceQA) { - registry.fill(HIST("QATrack/hSelection"), 0.5); - - registry.fill(HIST("QATrack/bs/hTrack1pt"), track1.pt()); - registry.fill(HIST("QATrack/bs/hTrack1DCAxy"), track1.dcaXY()); - registry.fill(HIST("QATrack/bs/hTrack1DCAz"), track1.dcaZ()); - registry.fill(HIST("QATrack/bs/hTrack1eta"), track1.eta()); - registry.fill(HIST("QATrack/bs/hTrack1tpcNClsFound"), track1.tpcNClsFound()); - - registry.fill(HIST("QATrack/bs/hTrack2pt"), track2.pt()); - registry.fill(HIST("QATrack/bs/hTrack2DCAxy"), track2.dcaXY()); - registry.fill(HIST("QATrack/bs/hTrack2DCAz"), track2.dcaZ()); - registry.fill(HIST("QATrack/bs/hTrack2eta"), track2.eta()); - registry.fill(HIST("QATrack/bs/hTrack2tpcNClsFound"), track2.tpcNClsFound()); - } + for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(posDaughters, negDaughters))) { - dataQA = true; - t1 = true; - if (!selectedTrack(track1)) + if (!selectedTrack(track1, true)) // track1 is positive continue; - t1 = false; - t2 = true; - if (!selectedTrack(track2)) + if (!selectedTrack(track2, false)) // track2 is negative continue; - t2 = false; - dataQA = false; - - if (produceQA) { - registry.fill(HIST("QATrack/hSelection"), 9.5); - - registry.fill(HIST("QATrack/as/hTrack1pt"), track1.pt()); - registry.fill(HIST("QATrack/as/hTrack1DCAxy"), track1.dcaXY()); - registry.fill(HIST("QATrack/as/hTrack1DCAz"), track1.dcaZ()); - registry.fill(HIST("QATrack/as/hTrack1eta"), track1.eta()); - registry.fill(HIST("QATrack/as/hTrack1tpcNClsFound"), track1.tpcNClsFound()); - - registry.fill(HIST("QATrack/as/hTrack2pt"), track2.pt()); - registry.fill(HIST("QATrack/as/hTrack2DCAxy"), track2.dcaXY()); - registry.fill(HIST("QATrack/as/hTrack2DCAz"), track2.dcaZ()); - registry.fill(HIST("QATrack/as/hTrack2eta"), track2.eta()); - registry.fill(HIST("QATrack/as/hTrack2tpcNClsFound"), track2.tpcNClsFound()); - } if (!selectedPair(mother, track1, track2)) continue; if (produceQA) { - registry.fill(HIST("QATrack/hSelection"), 10.5); - - registry.fill(HIST("QATrack/TPCPID/h2TracknSigma"), track1.tpcNSigmaKa(), track2.tpcNSigmaKa()); - registry.fill(HIST("QATrack/TPCPID/h2nTrack1SigmaPt"), track1.pt(), track1.tpcNSigmaKa()); - registry.fill(HIST("QATrack/TPCPID/h2nTrack2SigmaPt"), track2.pt(), track2.tpcNSigmaKa()); + registry.fill(HIST("QATrack/h2TPCnSigma"), track1.tpcNSigmaKa(), track2.tpcNSigmaKa()); + registry.fill(HIST("QATrack/h2TPCnSigmaPt"), track1.pt(), track1.tpcNSigmaKa()); + registry.fill(HIST("QATrack/h2TPCnSigmaPt"), track2.pt(), track2.tpcNSigmaKa()); + + registry.fill(HIST("QATrack/h2TOFnSigma"), track1.tofNSigmaKa(), track2.tofNSigmaKa()); + registry.fill(HIST("QATrack/h2TOFnSigmaPt"), track1.pt(), track1.tofNSigmaKa()); + registry.fill(HIST("QATrack/h2TOFnSigmaPt"), track2.pt(), track2.tofNSigmaKa()); + + registry.fill(HIST("QATrack/hTPCnSigma"), track1.tpcNSigmaKa()); + registry.fill(HIST("QATrack/hTPCnSigma"), track2.tpcNSigmaKa()); + if (track1.hasTOF()) + registry.fill(HIST("QATrack/hTOFnSigma"), track1.tofNSigmaKa()); + if (track2.hasTOF()) + registry.fill(HIST("QATrack/hTOFnSigma"), track2.tofNSigmaKa()); + + registry.fill(HIST("QATrack/hEta"), track1.eta()); + registry.fill(HIST("QATrack/hEta"), track2.eta()); + registry.fill(HIST("QATrack/hPt"), track1.pt()); + registry.fill(HIST("QATrack/hPt"), track2.pt()); + registry.fill(HIST("QATrack/hDCAxy"), track1.dcaXY()); + registry.fill(HIST("QATrack/hDCAxy"), track2.dcaXY()); + registry.fill(HIST("QATrack/hDCAz"), track1.dcaZ()); + registry.fill(HIST("QATrack/hDCAz"), track2.dcaZ()); + registry.fill(HIST("QATrack/hTPCNClsFound"), track1.tpcNClsFound()); + registry.fill(HIST("QATrack/hTPCNClsFound"), track2.tpcNClsFound()); + registry.fill(HIST("QATrack/hRapidity"), track1.rapidity(massPos)); + registry.fill(HIST("QATrack/hRapidity"), track2.rapidity(massNeg)); } - pointPair = fillPointPair(mother.Mag(), + pointPair = fillPointPair(mother.M(), mother.Pt(), getMultiplicity(collision), getCentrality(collision), - (tpcnSigmaPos > 0) ? std::abs(track1.tpcNSigmaKa()) : track1.tpcNSigmaKa(), - (tpcnSigmaNeg > 0) ? std::abs(track2.tpcNSigmaKa()) : track2.tpcNSigmaKa(), + track1.tpcNSigmaKa(), + track2.tpcNSigmaKa(), mother.Eta(), mother.Rapidity(), collision.posZ(), @@ -531,28 +525,34 @@ struct PhianalysisTHnSparse { 0, 0); rsnOutput->fillUnlikepm(pointPair); + + if (produceQA) + registry.fill(HIST("QAEvent/hSelection"), 2.5); + if (n == 0) + registry.fill(HIST("QAEvent/hSelection"), 1.5); + n = n + 1; } if (static_cast(produce.produceLikesign)) { - for (const auto& [track1, track2] : combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(posDauthers, posDauthers))) { - if (!selectedTrack(track1)) + for (const auto& [track1, track2] : combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(posDaughters, posDaughters))) { + if (!selectedTrack(track1, true)) // both positive continue; - if (!selectedTrack(track2)) + if (!selectedTrack(track2, true)) // both positive continue; if (!selectedPair(mother, track1, track2)) continue; if (static_cast(verbose.verboselevel) > 1) - LOGF(info, "Like-sign positive: d1=%ld , d2=%ld , mother=%f", track1.globalIndex(), track2.globalIndex(), mother.Mag()); + LOGF(info, "Like-sign positive: d1=%ld , d2=%ld , mother=%f", track1.globalIndex(), track2.globalIndex(), mother.M()); - pointPair = fillPointPair(mother.Mag(), + pointPair = fillPointPair(mother.M(), mother.Pt(), getMultiplicity(collision), getCentrality(collision), - (tpcnSigmaPos > 0) ? std::abs(track1.tpcNSigmaKa()) : track1.tpcNSigmaKa(), - (tpcnSigmaNeg > 0) ? std::abs(track2.tpcNSigmaKa()) : track2.tpcNSigmaKa(), + track1.tpcNSigmaKa(), + track2.tpcNSigmaKa(), mother.Eta(), mother.Rapidity(), collision.posZ(), @@ -563,24 +563,24 @@ struct PhianalysisTHnSparse { rsnOutput->fillLikepp(pointPair); } - for (const auto& [track1, track2] : combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(negDauthers, negDauthers))) { - if (!selectedTrack(track1)) + for (const auto& [track1, track2] : combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(negDaughters, negDaughters))) { + if (!selectedTrack(track1, false)) // both negative continue; - if (!selectedTrack(track2)) + if (!selectedTrack(track2, false)) // both negative continue; if (!selectedPair(mother, track1, track2)) continue; if (static_cast(verbose.verboselevel) > 1) - LOGF(info, "Like-sign negative: d1=%ld , d2=%ld , mother=%f", track1.globalIndex(), track2.globalIndex(), mother.Mag()); + LOGF(info, "Like-sign negative: d1=%ld , d2=%ld , mother=%f", track1.globalIndex(), track2.globalIndex(), mother.M()); - pointPair = fillPointPair(mother.Mag(), + pointPair = fillPointPair(mother.M(), mother.Pt(), getMultiplicity(collision), getCentrality(collision), - (tpcnSigmaPos > 0) ? std::abs(track1.tpcNSigmaKa()) : track1.tpcNSigmaKa(), - (tpcnSigmaNeg > 0) ? std::abs(track2.tpcNSigmaKa()) : track2.tpcNSigmaKa(), + track1.tpcNSigmaKa(), + track2.tpcNSigmaKa(), mother.Eta(), mother.Rapidity(), collision.posZ(), @@ -601,76 +601,57 @@ struct PhianalysisTHnSparse { registry.fill(HIST("QAMC/Truth/hMCEvent"), 0.5); - auto posDauthersMC = positiveMC->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - auto negDauthersMC = negativeMC->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + auto posDaughtersMC = positiveMC->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + auto negDaughtersMC = negativeMC->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); if (!collision.has_mcCollision()) { - LOGF(warning, "No MC collision for this collision, skip..."); + if (static_cast(verbose.verboselevel) > 0) + LOGF(warning, "No MC collision for this collision, skip..."); return; } - for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(posDauthersMC, negDauthersMC))) { - registry.fill(HIST("QAMC/Truth/hMCTrack"), 0.5); + for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(posDaughtersMC, negDaughtersMC))) { if (!track1.has_mcParticle()) { - LOGF(warning, "No MC particle for track, skip..."); + if (static_cast(verbose.verboselevel) > 0) + LOGF(warning, "No MC particle for track, skip..."); continue; } if (!track2.has_mcParticle()) { - LOGF(warning, "No MC particle for track, skip..."); + if (static_cast(verbose.verboselevel) > 0) + LOGF(warning, "No MC particle for track, skip..."); continue; } - MCTruthQA = true; - t1 = true; - if (!selectedTrack(track1)) + if (!selectedTrack(track1, true)) // track1 is positive continue; - t1 = false; - t2 = true; - if (!selectedTrack(track2)) + if (!selectedTrack(track2, false)) // track2 is negative continue; - t2 = false; - MCTruthQA = false; - - registry.fill(HIST("QAMC/Truth/hMCTrack"), 9.5); const auto mctrack1 = track1.mcParticle(); const auto mctrack2 = track2.mcParticle(); int track1PDG = std::abs(mctrack1.pdgCode()); int track2PDG = std::abs(mctrack2.pdgCode()); - if (!(track1PDG == dautherPosPDG && track2PDG == dautherNegPDG)) { + if (!(track1PDG == daughterPosPDG && track2PDG == daughterNegPDG)) { continue; } - if (produceQA) - registry.fill(HIST("QAMC/Truth/hMCTrack"), 10.5); - n = 0; for (const auto& mothertrack1 : mctrack1.mothers_as()) { for (const auto& mothertrack2 : mctrack2.mothers_as()) { - if (produceQA) - registry.fill(HIST("QAMC/Truth/hMCTrack"), 11.5); if (mothertrack1.pdgCode() != mothertrack2.pdgCode()) continue; - if (produceQA) - registry.fill(HIST("QAMC/Truth/hMCTrack"), 12.5); if (mothertrack1.globalIndex() != mothertrack2.globalIndex()) continue; - if (produceQA) - registry.fill(HIST("QAMC/Truth/hMCTrack"), 13.5); - if (std::abs(mothertrack1.y()) > static_cast(cut.y)) + if (std::abs(mothertrack1.y()) > static_cast(cut.rapidity)) continue; - if (produceQA) - registry.fill(HIST("QAMC/Truth/hMCTrack"), 14.5); if (std::abs(mothertrack1.pdgCode()) != motherPDG) continue; - if (produceQA) - registry.fill(HIST("QAMC/Truth/hMCTrack"), 15.5); if (static_cast(verbose.verboselevel) > 1) { LOGF(info, "True: %d, d1=%d (%ld), d2=%d (%ld), mother=%d (%ld)", n, mctrack1.pdgCode(), mctrack1.globalIndex(), mctrack2.pdgCode(), mctrack2.globalIndex(), mothertrack1.pdgCode(), mothertrack1.globalIndex()); @@ -679,21 +660,19 @@ struct PhianalysisTHnSparse { if (!selectedPair(mother, mctrack1, mctrack2)) continue; - if (produceQA) - registry.fill(HIST("QAMC/Truth/hMCTrack"), 16.5); if (n > 0) { if (produceQA) - registry.fill(HIST("QAMC/hInvMassTrueFalse"), mother.Mag()); + registry.fill(HIST("QAMC/hInvMassTrueFalse"), mother.M()); continue; } - pointPair = fillPointPair(mother.Mag(), + pointPair = fillPointPair(mother.M(), mother.Pt(), getMultiplicity(collision), getCentrality(collision), - (tpcnSigmaPos > 0) ? std::abs(track1.tpcNSigmaKa()) : track1.tpcNSigmaKa(), - (tpcnSigmaNeg > 0) ? std::abs(track2.tpcNSigmaKa()) : track2.tpcNSigmaKa(), + track1.tpcNSigmaKa(), + track2.tpcNSigmaKa(), mother.Eta(), mother.Rapidity(), collision.posZ(), @@ -711,76 +690,66 @@ struct PhianalysisTHnSparse { void processGen(aod::McCollision const& mcCollision, soa::SmallGroups const& collisions, LabeledTracks const& /*particles*/, aod::McParticles const& mcParticles) { - registry.fill(HIST("QAMC/Gen/hMCEvent"), 0.5); - if (std::abs(mcCollision.posZ()) > static_cast(cut.vZ)) + + if (produceQA) + registry.fill(HIST("QAMC/Gen/hMCEvent"), 0.5); + + if (std::abs(mcCollision.posZ()) > vzCut) return; - registry.fill(HIST("QAMC/Gen/hMCEvent"), 1.5); + + if (produceQA) + registry.fill(HIST("QAMC/Gen/hMCEvent"), 1.5); if (collisions.size() == 0) return; for (const auto& collision : collisions) { - registry.fill(HIST("QAMC/Gen/hMCEvent"), 2.5); + if (produceQA) + registry.fill(HIST("QAMC/Gen/hMCEvent"), 2.5); if (!collision.has_mcCollision()) { - LOGF(warning, "No McCollision for this collision, skip..."); + if (static_cast(verbose.verboselevel) > 0) + LOGF(warning, "No McCollision for this collision, skip..."); return; } - auto centralityGen = 0; - centralityGen = getCentrality(collision); - auto multiplicityGen = 0; - multiplicityGen = getMultiplicity(collision); + auto centralityGen = getCentrality(collision); + auto multiplicityGen = getMultiplicity(collision); for (const auto& particle : mcParticles) { - registry.fill(HIST("QAMC/Gen/hMCTrack"), 0.5); - if (std::abs(particle.y()) > static_cast(cut.y)) + if (std::abs(particle.y()) > static_cast(cut.rapidity)) continue; - registry.fill(HIST("QAMC/Gen/hMCTrack"), 1.5); - if (particle.pdgCode() == motherPDG) { - registry.fill(HIST("QAMC/Gen/hMCTrack"), 2.5); auto daughters = particle.daughters_as(); - if (daughters.size() != 2) + if (daughters.size() != dauSize) continue; - registry.fill(HIST("QAMC/Gen/hMCTrack"), 3.5); - auto daup = false; auto daun = false; for (const auto& dau : daughters) { - registry.fill(HIST("QAMC/Gen/hMCTrack"), 4.5); - - if (!dau.isPhysicalPrimary()) - continue; - - registry.fill(HIST("QAMC/Gen/hMCTrack"), 5.5); - - if (dau.pdgCode() == dautherPosPDG) { + if (dau.pdgCode() == daughterPosPDG) { daup = true; - d1.SetXYZM(dau.px(), dau.py(), dau.pz(), massPos); - } else if (dau.pdgCode() == -dautherNegPDG) { + d1 = ROOT::Math::PxPyPzMVector(dau.px(), dau.py(), dau.pz(), massPos); + } else if (dau.pdgCode() == -daughterNegPDG) { daun = true; - d2.SetXYZM(dau.px(), dau.py(), dau.pz(), massNeg); + d2 = ROOT::Math::PxPyPzMVector(dau.px(), dau.py(), dau.pz(), massNeg); } } - if (!daup && !daun) + if (!daup || !daun) continue; - registry.fill(HIST("QAMC/Gen/hMCTrack"), 6.5); - mother = d1 + d2; - pointPair = fillPointPair(mother.Mag(), + pointPair = fillPointPair(mother.M(), mother.Pt(), multiplicityGen, centralityGen, - std::abs(static_cast(cut.tpcnSigmaPos) / 2.0), - std::abs(static_cast(cut.tpcnSigmaNeg) / 2.0), + 0, + 0, mother.Eta(), mother.Rapidity(), mcCollision.posZ(), @@ -793,7 +762,7 @@ struct PhianalysisTHnSparse { } } } - PROCESS_SWITCH(PhianalysisTHnSparse, processGen, "Process MC Mateched.", true); + PROCESS_SWITCH(PhianalysisTHnSparse, processGen, "Process MC Generated.", false); void processMixed(EventCandidates const& collisions, TrackCandidates const& tracks) { @@ -813,10 +782,10 @@ struct PhianalysisTHnSparse { if (produceQA) registry.fill(HIST("QAMixing/hSelection"), 0.5); - auto posDauthersc1 = positive->sliceByCached(aod::track::collisionId, c1.globalIndex(), cache); - auto posDauthersc2 = positive->sliceByCached(aod::track::collisionId, c2.globalIndex(), cache); - auto negDauthersc1 = negative->sliceByCached(aod::track::collisionId, c1.globalIndex(), cache); - auto negDauthersc2 = negative->sliceByCached(aod::track::collisionId, c2.globalIndex(), cache); + auto posDaughtersc1 = positive->sliceByCached(aod::track::collisionId, c1.globalIndex(), cache); + auto posDaughtersc2 = positive->sliceByCached(aod::track::collisionId, c2.globalIndex(), cache); + auto negDaughtersc1 = negative->sliceByCached(aod::track::collisionId, c1.globalIndex(), cache); + auto negDaughtersc2 = negative->sliceByCached(aod::track::collisionId, c2.globalIndex(), cache); if (produceQA) { registry.fill(HIST("QAMixing/h2mu1_mu2"), getMultiplicity(c1), getMultiplicity(c2)); @@ -824,30 +793,22 @@ struct PhianalysisTHnSparse { registry.fill(HIST("QAMixing/h2vz1_vz2"), c1.posZ(), c2.posZ()); } - for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(posDauthersc1, negDauthersc2))) { - if (produceQA) - registry.fill(HIST("QAMixing/hTrackSelection"), 0.5); + for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(posDaughtersc1, negDaughtersc2))) { - if (!selectedTrack(track1)) + if (!selectedTrack(track1, true)) // track1 is positive continue; - if (produceQA) - registry.fill(HIST("QAMixing/hTrackSelection"), 1.5); - if (!selectedTrack(track2)) + if (!selectedTrack(track2, false)) // track2 is negative continue; - if (produceQA) - registry.fill(HIST("QAMixing/hTrackSelection"), 2.5); if (!selectedPair(mother, track1, track2)) continue; - if (produceQA) - registry.fill(HIST("QAMixing/hTrackSelection"), 3.5); - pointPair = fillPointPair(mother.Mag(), + pointPair = fillPointPair(mother.M(), mother.Pt(), getMultiplicity(c1), getCentrality(c1), - (tpcnSigmaPos > 0) ? std::abs(track1.tpcNSigmaKa()) : track1.tpcNSigmaKa(), - (tpcnSigmaNeg > 0) ? std::abs(track2.tpcNSigmaKa()) : track2.tpcNSigmaKa(), + track1.tpcNSigmaKa(), + track2.tpcNSigmaKa(), mother.Eta(), mother.Rapidity(), c1.posZ(), @@ -860,23 +821,22 @@ struct PhianalysisTHnSparse { if (static_cast(produce.produceLikesign)) { - for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(posDauthersc1, posDauthersc2))) { - - if (!selectedTrack(track1)) + for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(posDaughtersc1, posDaughtersc2))) { + if (!selectedTrack(track1, true)) // track1 is positive continue; - if (!selectedTrack(track2)) + if (!selectedTrack(track2, true)) // track2 is positive continue; if (!selectedPair(mother, track1, track2)) continue; - pointPair = fillPointPair(mother.Mag(), + pointPair = fillPointPair(mother.M(), mother.Pt(), getMultiplicity(c1), getCentrality(c1), - (tpcnSigmaPos > 0) ? std::abs(track1.tpcNSigmaKa()) : track1.tpcNSigmaKa(), - (tpcnSigmaNeg > 0) ? std::abs(track2.tpcNSigmaKa()) : track2.tpcNSigmaKa(), + track1.tpcNSigmaKa(), + track2.tpcNSigmaKa(), mother.Eta(), mother.Rapidity(), c1.posZ(), @@ -887,22 +847,21 @@ struct PhianalysisTHnSparse { rsnOutput->fillMixingpp(pointPair); } - for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(negDauthersc1, negDauthersc2))) { - - if (!selectedTrack(track1)) + for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(negDaughtersc1, negDaughtersc2))) { + if (!selectedTrack(track1, false)) continue; - if (!selectedTrack(track2)) + if (!selectedTrack(track2, false)) continue; if (!selectedPair(mother, track1, track2)) continue; - pointPair = fillPointPair(mother.Mag(), + pointPair = fillPointPair(mother.M(), mother.Pt(), getMultiplicity(c1), getCentrality(c1), - (tpcnSigmaPos > 0) ? std::abs(track1.tpcNSigmaKa()) : track1.tpcNSigmaKa(), - (tpcnSigmaNeg > 0) ? std::abs(track2.tpcNSigmaKa()) : track2.tpcNSigmaKa(), + track1.tpcNSigmaKa(), + track2.tpcNSigmaKa(), mother.Eta(), mother.Rapidity(), c1.posZ(), @@ -914,23 +873,22 @@ struct PhianalysisTHnSparse { } } - for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(posDauthersc2, negDauthersc1))) { - - if (!selectedTrack(track1)) + for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(posDaughtersc2, negDaughtersc1))) { + if (!selectedTrack(track1, true)) // track1 is positive continue; - if (!selectedTrack(track2)) + if (!selectedTrack(track2, false)) // track2 is negative continue; if (!selectedPair(mother, track1, track2)) continue; - pointPair = fillPointPair(mother.Mag(), + pointPair = fillPointPair(mother.M(), mother.Pt(), getMultiplicity(c1), getCentrality(c1), - (tpcnSigmaPos > 0) ? std::abs(track1.tpcNSigmaKa()) : track1.tpcNSigmaKa(), - (tpcnSigmaNeg > 0) ? std::abs(track2.tpcNSigmaKa()) : track2.tpcNSigmaKa(), + track1.tpcNSigmaKa(), + track2.tpcNSigmaKa(), mother.Eta(), mother.Rapidity(), c1.posZ(), @@ -947,10 +905,10 @@ struct PhianalysisTHnSparse { if (produceQA) registry.fill(HIST("QAMixing/hSelection"), 0.5); - auto posDauthersc1 = positive->sliceByCached(aod::track::collisionId, c1.globalIndex(), cache); - auto posDauthersc2 = positive->sliceByCached(aod::track::collisionId, c2.globalIndex(), cache); - auto negDauthersc1 = negative->sliceByCached(aod::track::collisionId, c1.globalIndex(), cache); - auto negDauthersc2 = negative->sliceByCached(aod::track::collisionId, c2.globalIndex(), cache); + auto posDaughtersc1 = positive->sliceByCached(aod::track::collisionId, c1.globalIndex(), cache); + auto posDaughtersc2 = positive->sliceByCached(aod::track::collisionId, c2.globalIndex(), cache); + auto negDaughtersc1 = negative->sliceByCached(aod::track::collisionId, c1.globalIndex(), cache); + auto negDaughtersc2 = negative->sliceByCached(aod::track::collisionId, c2.globalIndex(), cache); if (produceQA) { registry.fill(HIST("QAMixing/h2mu1_mu2"), getMultiplicity(c1), getMultiplicity(c2)); @@ -958,30 +916,23 @@ struct PhianalysisTHnSparse { registry.fill(HIST("QAMixing/h2vz1_vz2"), c1.posZ(), c2.posZ()); } - for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(posDauthersc1, negDauthersc2))) { - if (produceQA) - registry.fill(HIST("QAMixing/hTrackSelection"), 0.5); + for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(posDaughtersc1, negDaughtersc2))) { - if (!selectedTrack(track1)) + if (!selectedTrack(track1, true)) // track1 is positive continue; - if (produceQA) - registry.fill(HIST("QAMixing/hTrackSelection"), 1.5); - if (!selectedTrack(track2)) + + if (!selectedTrack(track2, false)) // track2 is negative continue; - if (produceQA) - registry.fill(HIST("QAMixing/hTrackSelection"), 2.5); if (!selectedPair(mother, track1, track2)) continue; - if (produceQA) - registry.fill(HIST("QAMixing/hTrackSelection"), 3.5); - pointPair = fillPointPair(mother.Mag(), + pointPair = fillPointPair(mother.M(), mother.Pt(), getMultiplicity(c1), getCentrality(c1), - (tpcnSigmaPos > 0) ? std::abs(track1.tpcNSigmaKa()) : track1.tpcNSigmaKa(), - (tpcnSigmaNeg > 0) ? std::abs(track2.tpcNSigmaKa()) : track2.tpcNSigmaKa(), + track1.tpcNSigmaKa(), + track2.tpcNSigmaKa(), mother.Eta(), mother.Rapidity(), c1.posZ(), @@ -994,23 +945,23 @@ struct PhianalysisTHnSparse { if (static_cast(produce.produceLikesign)) { - for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(posDauthersc1, posDauthersc2))) { + for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(posDaughtersc1, posDaughtersc2))) { - if (!selectedTrack(track1)) + if (!selectedTrack(track1, true)) // track1 is positive continue; - if (!selectedTrack(track2)) + if (!selectedTrack(track2, true)) // track2 is positive continue; if (!selectedPair(mother, track1, track2)) continue; - pointPair = fillPointPair(mother.Mag(), + pointPair = fillPointPair(mother.M(), mother.Pt(), getMultiplicity(c1), getCentrality(c1), - (tpcnSigmaPos > 0) ? std::abs(track1.tpcNSigmaKa()) : track1.tpcNSigmaKa(), - (tpcnSigmaNeg > 0) ? std::abs(track2.tpcNSigmaKa()) : track2.tpcNSigmaKa(), + track1.tpcNSigmaKa(), + track2.tpcNSigmaKa(), mother.Eta(), mother.Rapidity(), c1.posZ(), @@ -1021,22 +972,22 @@ struct PhianalysisTHnSparse { rsnOutput->fillMixingpp(pointPair); } - for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(negDauthersc1, negDauthersc2))) { + for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(negDaughtersc1, negDaughtersc2))) { - if (!selectedTrack(track1)) + if (!selectedTrack(track1, false)) continue; - if (!selectedTrack(track2)) + if (!selectedTrack(track2, false)) continue; if (!selectedPair(mother, track1, track2)) continue; - pointPair = fillPointPair(mother.Mag(), + pointPair = fillPointPair(mother.M(), mother.Pt(), getMultiplicity(c1), getCentrality(c1), - (tpcnSigmaPos > 0) ? std::abs(track1.tpcNSigmaKa()) : track1.tpcNSigmaKa(), - (tpcnSigmaNeg > 0) ? std::abs(track2.tpcNSigmaKa()) : track2.tpcNSigmaKa(), + track1.tpcNSigmaKa(), + track2.tpcNSigmaKa(), mother.Eta(), mother.Rapidity(), c1.posZ(), @@ -1048,23 +999,23 @@ struct PhianalysisTHnSparse { } } - for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(posDauthersc2, negDauthersc1))) { + for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(posDaughtersc2, negDaughtersc1))) { - if (!selectedTrack(track1)) + if (!selectedTrack(track1, true)) continue; - if (!selectedTrack(track2)) + if (!selectedTrack(track2, false)) continue; if (!selectedPair(mother, track1, track2)) continue; - pointPair = fillPointPair(mother.Mag(), + pointPair = fillPointPair(mother.M(), mother.Pt(), getMultiplicity(c1), getCentrality(c1), - (tpcnSigmaPos > 0) ? std::abs(track1.tpcNSigmaKa()) : track1.tpcNSigmaKa(), - (tpcnSigmaNeg > 0) ? std::abs(track2.tpcNSigmaKa()) : track2.tpcNSigmaKa(), + track1.tpcNSigmaKa(), + track2.tpcNSigmaKa(), mother.Eta(), mother.Rapidity(), c1.posZ(), @@ -1077,76 +1028,8 @@ struct PhianalysisTHnSparse { } } } - PROCESS_SWITCH(PhianalysisTHnSparse, processMixed, "Process Mixing Event.", true); - - void processGenOld(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles) - { - if (!static_cast(produce.produceTrue)) - return; - - registry.fill(HIST("QAMC/hMC"), 0.5); - - if (std::abs(mcCollision.posZ()) > static_cast(cut.vZ)) - return; - - registry.fill(HIST("QAMC/hMC"), 1.5); - - for (const auto& particle : mcParticles) { - registry.fill(HIST("QAMC/hMC"), 2.5); - if (std::abs(particle.y()) > static_cast(cut.y)) - continue; - - registry.fill(HIST("QAMC/hMC"), 3.5); - - if (particle.pdgCode() == motherPDG) { - auto daughters = particle.daughters_as(); - if (daughters.size() != 2) - continue; - - registry.fill(HIST("QAMC/hMC"), 4.5); - - auto daup = false; - auto daun = false; - - for (const auto& dau : daughters) { - if (!dau.isPhysicalPrimary()) - continue; - - if (dau.pdgCode() == dautherPosPDG) { - daup = true; - d1.SetXYZM(dau.px(), dau.py(), dau.pz(), massPos); - } else if (dau.pdgCode() == -dautherNegPDG) { - daun = true; - d2.SetXYZM(dau.px(), dau.py(), dau.pz(), massNeg); - } - } - if (!daup && !daun) - continue; - - registry.fill(HIST("QAMC/hMC"), 5.5); - - mother = d1 + d2; - - pointPair = fillPointPair(mother.Mag(), - mother.Pt(), - 0, - 0, - std::abs(static_cast(cut.tpcnSigmaPos) / 2.0), - std::abs(static_cast(cut.tpcnSigmaNeg) / 2.0), - mother.Eta(), - mother.Rapidity(), - mcCollision.posZ(), - 0, - 0, - 0); - - rsnOutput->fillUnlikegenOld(pointPair); - } - } - } - PROCESS_SWITCH(PhianalysisTHnSparse, processGenOld, "Process generated.", false); + PROCESS_SWITCH(PhianalysisTHnSparse, processMixed, "Process Mixing Event.", false); }; - WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ From 1c25547058b3a1ac676710a78e75dc183a1c4a5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?BiaoZhang=20=28=E5=BC=A0=E5=BD=AA=29?= <52267892+zhangbiao-phy@users.noreply.github.com> Date: Mon, 8 Sep 2025 15:45:51 +0200 Subject: [PATCH 350/986] [PWGHF] Improve the mass window selection and v0 type matched for lambda (#12905) --- .../candidateCreatorCharmResoReduced.cxx | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx index 4df706619fe..052626a6ef3 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx @@ -246,6 +246,8 @@ struct HfCandidateCreatorCharmResoReduced { bool isV0Selected(V0RedTable const& candV0) { int ptBin = findBin(cfgV0Cuts.binsPtV0, candV0.pt()); + const float invMassLow = cfgV0Cuts.cutsV0->get(ptBin, "invMassLow"); + const float invMassHigh = cfgV0Cuts.cutsV0->get(ptBin, "invMassHigh"); if (ptBin == -1) { return false; } @@ -253,18 +255,24 @@ struct HfCandidateCreatorCharmResoReduced { if (!TESTBIT(candV0.v0Type(), V0Type::K0s)) { return false; } - if ((candV0.invMassK0s() - MassK0Short) > cfgV0Cuts.cutsV0->get(ptBin, "invMassLow") && (MassK0Short - candV0.invMassK0s()) < cfgV0Cuts.cutsV0->get(ptBin, "invMassLow")) { + if (candV0.invMassK0s() < invMassLow || candV0.invMassK0s() > invMassHigh) { return false; } } else if (cfgV0Cuts.v0Type == V0Type::Lambda) { // Lambda if (!TESTBIT(candV0.v0Type(), V0Type::Lambda) && !TESTBIT(candV0.v0Type(), V0Type::AntiLambda)) { return false; } - if ((candV0.invMassLambda() - MassLambda) > cfgV0Cuts.cutsV0->get(ptBin, "invMassLow") && (MassLambda - candV0.invMassLambda()) < cfgV0Cuts.cutsV0->get(ptBin, "invMassLow")) { - return false; + + if (TESTBIT(candV0.v0Type(), V0Type::Lambda)) { + if (candV0.invMassLambda() < invMassLow || candV0.invMassLambda() > invMassHigh) { + return false; + } } - if ((candV0.invMassAntiLambda() - MassLambda) > cfgV0Cuts.cutsV0->get(ptBin, "invMassLow") && (MassLambda - candV0.invMassAntiLambda()) < cfgV0Cuts.cutsV0->get(ptBin, "invMassLow")) { - return false; + + if (TESTBIT(candV0.v0Type(), V0Type::AntiLambda)) { + if (candV0.invMassAntiLambda() < invMassLow || candV0.invMassAntiLambda() > invMassHigh) { + return false; + } } } else { LOG(error) << "Unsupported V0 type for selection: " << cfgV0Cuts.v0Type; @@ -378,10 +386,10 @@ struct HfCandidateCreatorCharmResoReduced { invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassDPlus, MassK0Short}); } } else if (cfgV0Cuts.v0Type == V0Type::Lambda) { // Lambda - if (candV0Tr.v0Type() == V0Type::Lambda) { + if (TESTBIT(candV0Tr.v0Type(), V0Type::Lambda)) { invMassV0Tr = candV0Tr.invMassLambda(); signReso = candD.sign(); - } else if (candV0Tr.v0Type() == V0Type::AntiLambda) { + } else if (TESTBIT(candV0Tr.v0Type(), V0Type::AntiLambda)) { invMassV0Tr = candV0Tr.invMassAntiLambda(); signReso = candD.sign(); isWrongSign = 1; @@ -464,9 +472,9 @@ struct HfCandidateCreatorCharmResoReduced { invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassDStar, MassK0Short}); } } else if (cfgV0Cuts.v0Type == V0Type::Lambda) { // Lambda - if (candV0Tr.v0Type() == V0Type::Lambda) { + if (TESTBIT(candV0Tr.v0Type(), V0Type::Lambda)) { invMassV0Tr = candV0Tr.invMassLambda(); - } else if (candV0Tr.v0Type() == V0Type::AntiLambda) { + } else if (TESTBIT(candV0Tr.v0Type(), V0Type::AntiLambda)) { invMassV0Tr = candV0Tr.invMassAntiLambda(); isWrongSign = 1; } @@ -554,9 +562,9 @@ struct HfCandidateCreatorCharmResoReduced { invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassD0, MassK0Short}); } } else if (cfgV0Cuts.v0Type == V0Type::Lambda) { // Lambda - if (candV0Tr.v0Type() == V0Type::Lambda) { + if (TESTBIT(candV0Tr.v0Type(), V0Type::Lambda)) { invMassV0Tr = candV0Tr.invMassLambda(); - } else if (candV0Tr.v0Type() == V0Type::AntiLambda) { + } else if (TESTBIT(candV0Tr.v0Type(), V0Type::AntiLambda)) { invMassV0Tr = candV0Tr.invMassAntiLambda(); isWrongSign = 1; } @@ -628,10 +636,10 @@ struct HfCandidateCreatorCharmResoReduced { invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{MassD0Bar, MassK0Short}); } } else if (cfgV0Cuts.v0Type == V0Type::Lambda) { // Lambda - if (candV0Tr.v0Type() == V0Type::Lambda) { + if (TESTBIT(candV0Tr.v0Type(), V0Type::Lambda)) { invMassV0Tr = candV0Tr.invMassLambda(); isWrongSign = 1; - } else if (candV0Tr.v0Type() == V0Type::AntiLambda) { + } else if (TESTBIT(candV0Tr.v0Type(), V0Type::AntiLambda)) { invMassV0Tr = candV0Tr.invMassAntiLambda(); } if (useDeltaMass) { From 955e948634a3e25c3aebb369d1c172fb20bed6cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= <26327373+vkucera@users.noreply.github.com> Date: Mon, 8 Sep 2025 15:50:56 +0200 Subject: [PATCH 351/986] [Infrastructure] Header sorting: Add GPU in the O2 include list (#12853) --- .clang-format | 2 +- Scripts/format_includes.awk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.clang-format b/.clang-format index 33e5d4f9d0c..674e1494ecd 100644 --- a/.clang-format +++ b/.clang-format @@ -51,7 +51,7 @@ IncludeCategories: Priority: 3 CaseSensitive: true # O2 - - Regex: ^(<|")(Algorithm|CCDB|Common[A-Z]|DataFormats|DCAFitter|Detectors|EMCAL|Field|Framework|FT0|FV0|GlobalTracking|ITS|MathUtils|MFT|MCH|MID|PHOS|PID|ReconstructionDataFormats|SimulationDataFormat|TOF|TPC|ZDC).*/.*\.h + - Regex: ^(<|")(Algorithm|CCDB|Common[A-Z]|DataFormats|DCAFitter|Detectors|EMCAL|Field|Framework|FT0|FV0|GlobalTracking|GPU|ITS|MathUtils|MFT|MCH|MID|PHOS|PID|ReconstructionDataFormats|SimulationDataFormat|TOF|TPC|ZDC).*/.*\.h Priority: 4 CaseSensitive: true # ROOT diff --git a/Scripts/format_includes.awk b/Scripts/format_includes.awk index 47f9132ed80..ac22332acc5 100644 --- a/Scripts/format_includes.awk +++ b/Scripts/format_includes.awk @@ -7,7 +7,7 @@ if ($1 ~ /^#include/) { h = substr($2, 2, length($2) - 2) if ( h ~ /^(PWG[A-Z]{2}|Common|ALICE3|DPG|EventFiltering|Tools|Tutorials)\/.*\.h/ ) { $2 = "\""h"\"" } # O2Physics - else if ( h ~ /^(Algorithm|CCDB|Common[A-Z]|DataFormats|DCAFitter|Detectors|EMCAL|Field|Framework|FT0|FV0|GlobalTracking|ITS|MathUtils|MFT|MCH|MID|PHOS|PID|ReconstructionDataFormats|SimulationDataFormat|TOF|TPC|ZDC).*\/.*\.h/ ) { $2 = "<"h">" } # O2 + else if ( h ~ /^(Algorithm|CCDB|Common[A-Z]|DataFormats|DCAFitter|Detectors|EMCAL|Field|Framework|FT0|FV0|GlobalTracking|GPU|ITS|MathUtils|MFT|MCH|MID|PHOS|PID|ReconstructionDataFormats|SimulationDataFormat|TOF|TPC|ZDC).*\/.*\.h/ ) { $2 = "<"h">" } # O2 else if ( h ~ /^(T[A-Z]|Math\/|Roo[A-Z])[[:alnum:]\/]+\.h/ ) { $2 = "<"h">" } # ROOT else if ( h ~ /^KF[A-Z][[:alnum:]]+\.h/ ) { $2 = "<"h">" } # KFParticle else if ( h ~ /^(fastjet\/|onnxruntime)/ ) { $2 = "<"h">" } # FastJet, ONNX From d3c2e47c18275733046117d3974fc334b6635a64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= <26327373+vkucera@users.noreply.github.com> Date: Mon, 8 Sep 2025 15:55:28 +0200 Subject: [PATCH 352/986] [Common] Fix includes (#12833) --- Common/CCDB/EventSelectionParams.cxx | 3 + Common/CCDB/RCTSelectionFlags.h | 8 +- Common/CCDB/TriggerAliases.cxx | 6 +- Common/CCDB/TriggerAliases.h | 1 + Common/CCDB/ctpRateFetcher.cxx | 5 ++ Common/CCDB/ctpRateFetcher.h | 1 + Common/Core/CollisionAssociation.cxx | 2 +- Common/Core/CollisionAssociation.h | 8 +- Common/Core/CollisionTypeHelper.cxx | 1 + Common/Core/CollisionTypeHelper.h | 2 +- Common/Core/EventPlaneHelper.cxx | 6 ++ Common/Core/EventPlaneHelper.h | 15 ++-- Common/Core/FFitWeights.cxx | 9 ++ Common/Core/FFitWeights.h | 12 +-- Common/Core/MetadataHelper.cxx | 4 +- Common/Core/MetadataHelper.h | 2 +- Common/Core/OrbitRange.cxx | 12 ++- Common/Core/OrbitRange.h | 5 ++ Common/Core/PID/DetectorResponse.h | 14 ++- Common/Core/PID/PIDTOF.cxx | 11 +++ Common/Core/PID/PIDTOF.h | 26 +++--- Common/Core/PID/ParamBase.cxx | 3 + Common/Core/PID/ParamBase.h | 15 ++-- Common/Core/PID/TPCPIDResponse.h | 13 +-- Common/Core/TPCVDriftManager.h | 18 ++-- Common/Core/TableHelper.cxx | 1 + Common/Core/TableHelper.h | 4 +- Common/Core/TrackSelection.cxx | 4 + Common/Core/TrackSelection.h | 6 +- Common/Core/TrackSelectionDefaults.cxx | 9 +- Common/Core/TrackSelectionDefaults.h | 1 - Common/Core/TrackSelectorPID.h | 6 +- Common/Core/trackUtilities.h | 6 +- Common/DataModel/CaloClusters.h | 4 +- Common/DataModel/Centrality.h | 2 +- Common/DataModel/CollisionAssociationTables.h | 2 +- Common/DataModel/EseTable.h | 5 +- Common/DataModel/EventSelection.h | 9 +- Common/DataModel/FT0Corrected.h | 2 +- Common/DataModel/FwdTrackReAlignTables.h | 2 +- Common/DataModel/MatchMFTFT0.h | 7 +- Common/DataModel/MatchMFTMuonData.h | 8 +- Common/DataModel/McCollisionExtra.h | 10 ++- Common/DataModel/MftmchMatchingML.h | 3 +- Common/DataModel/Multiplicity.h | 5 +- Common/DataModel/OccupancyTables.h | 7 +- Common/DataModel/PIDResponse.h | 5 +- Common/DataModel/PIDResponseCombined.h | 10 +-- Common/DataModel/PIDResponseITS.h | 16 ++-- Common/DataModel/PIDResponseTOF.h | 15 ++-- Common/DataModel/PIDResponseTPC.h | 12 +-- Common/DataModel/PmdTable.h | 2 +- Common/DataModel/Qvectors.h | 3 +- Common/DataModel/SelectionStudyTables.h | 4 +- Common/DataModel/TrackSelectionTables.h | 4 +- Common/DataModel/ZDCInterCalib.h | 4 +- Common/LegacyDataQA/centqa.cxx | 17 ++-- Common/LegacyDataQA/otfv0qa.cxx | 17 ++-- Common/LegacyDataQA/pcmRun2.cxx | 4 +- Common/LegacyDataQA/pmdQa.cxx | 27 +++--- Common/LegacyDataQA/tpcpidqa.cxx | 21 +++-- .../TableProducer/Converters/bcConverter.cxx | 9 +- .../Converters/bcFlagsCreator.cxx | 9 +- .../Converters/caloLabelConverter.cxx | 10 ++- .../Converters/collisionConverter.cxx | 12 ++- .../TableProducer/Converters/fddConverter.cxx | 9 +- .../TableProducer/Converters/hmpConverter.cxx | 7 +- .../Converters/mcCollisionConverter.cxx | 7 +- .../TableProducer/Converters/mcConverter.cxx | 9 +- .../Converters/mftTracksConverter.cxx | 9 +- .../Converters/multMCExtrasConverter.cxx | 8 +- .../Converters/multsExtraConverter.cxx | 8 +- .../Converters/run2TinyToFullPID.cxx | 18 ++-- .../Converters/run2bcinfosConverter.cxx | 7 +- .../Converters/run2tracksExtraConverter.cxx | 7 +- .../Converters/trackQA002Converter.cxx | 11 ++- .../Converters/trackQA003Converter.cxx | 11 ++- .../Converters/trackQAConverter.cxx | 10 ++- .../Converters/tracksExtraConverter.cxx | 9 +- .../Converters/tracksExtraV002Converter.cxx | 11 ++- .../TableProducer/Converters/v0converter.cxx | 9 +- .../TableProducer/Converters/zdcConverter.cxx | 12 ++- Common/TableProducer/PID/pidBayes.cxx | 38 ++++++--- Common/TableProducer/PID/pidITS.cxx | 30 ++++--- Common/TableProducer/PID/pidTOF.cxx | 33 +++++-- Common/TableProducer/PID/pidTOFBase.cxx | 37 +++++--- Common/TableProducer/PID/pidTOFBase.h | 9 +- Common/TableProducer/PID/pidTOFFull.cxx | 33 +++++-- Common/TableProducer/PID/pidTOFMerge.cxx | 49 +++++++---- Common/TableProducer/PID/pidTOFbeta.cxx | 29 +++++-- Common/TableProducer/PID/pidTPC.cxx | 38 +++++---- Common/TableProducer/PID/pidTPCBase.cxx | 30 ++++--- Common/TableProducer/PID/pidTPCBase.h | 10 ++- Common/TableProducer/PID/pidTPCService.cxx | 42 ++++----- .../TableProducer/PID/pidTPCServiceRun2.cxx | 42 ++++----- .../TableProducer/PID/pidTPCServiceRun3.cxx | 42 ++++----- Common/TableProducer/caloClusterProducer.cxx | 13 ++- Common/TableProducer/centralityTable.cxx | 17 ++-- Common/TableProducer/eseTableProducer.cxx | 42 +++++---- Common/TableProducer/eventSelection.cxx | 1 - .../TableProducer/eventSelectionService.cxx | 35 ++++---- Common/TableProducer/ft0CorrectedTable.cxx | 35 +++++--- .../fwdtrackToCollisionAssociator.cxx | 12 +-- Common/TableProducer/fwdtrackextension.cxx | 22 ++--- Common/TableProducer/match-mft-ft0.cxx | 71 +++++++++------- .../TableProducer/match-mft-mch-data-mc.cxx | 62 ++++++++------ Common/TableProducer/match-mft-mch-data.cxx | 62 ++++++++------ Common/TableProducer/mcCollsExtra.cxx | 42 +++------ Common/TableProducer/mftmchMatchingML.cxx | 55 +++++++----- Common/TableProducer/multCentTable.cxx | 37 ++++---- .../TableProducer/multiplicityExtraTable.cxx | 34 +++++--- Common/TableProducer/multiplicityTable.cxx | 18 +++- Common/TableProducer/muonRealignment.cxx | 59 +++++++------ .../TableProducer/occupancyTableProducer.cxx | 46 +++++----- Common/TableProducer/qVectorsTable.cxx | 16 +++- Common/TableProducer/selectionStudyTable.cxx | 17 ++-- Common/TableProducer/timestamp.cxx | 39 ++++++--- .../TableProducer/trackDcaCovFillerRun2.cxx | 31 ++++++- Common/TableProducer/trackPropagation.cxx | 34 +++++++- .../trackToCollisionAssociator.cxx | 10 ++- Common/TableProducer/trackextension.cxx | 25 +++--- Common/TableProducer/trackselection.cxx | 7 +- Common/TableProducer/weakDecayIndices.cxx | 7 +- Common/TableProducer/zdcTaskInterCalib.cxx | 23 +++-- Common/Tasks/centralityQa.cxx | 18 ++-- Common/Tasks/centralityStudy.cxx | 35 +++++--- Common/Tasks/checkDataModel.cxx | 15 +++- Common/Tasks/checkDataModelMC.cxx | 9 ++ Common/Tasks/cpvQa.cxx | 18 +++- Common/Tasks/flowTest.cxx | 28 +++--- Common/Tasks/ft0Qa.cxx | 20 +++-- Common/Tasks/integrationTest.cxx | 29 ++++--- Common/Tasks/integrationTestCCDB.cxx | 34 ++++---- Common/Tasks/multiplicityDerivedQa.cxx | 22 +++-- Common/Tasks/multiplicityQa.cxx | 23 +++-- Common/Tasks/orbitRangeTask.cxx | 15 ++-- Common/Tasks/propagatorQa.cxx | 15 +++- Common/Tasks/qVectorsCorrection.cxx | 35 ++++---- Common/Tasks/qaMuon.cxx | 85 ++++++++++++------- Common/Tasks/trackqa.cxx | 2 +- Common/Tasks/validation.cxx | 16 ++-- Common/Tools/EventSelectionModule.h | 34 +++++--- Common/Tools/Multiplicity/MultModule.h | 25 +++--- Common/Tools/Multiplicity/multCalibrator.cxx | 14 +-- Common/Tools/Multiplicity/multCalibrator.h | 7 +- .../Multiplicity/multGlauberNBDFitter.cxx | 10 ++- .../Tools/Multiplicity/multGlauberNBDFitter.h | 5 +- .../Tools/Multiplicity/multMCCalibrator.cxx | 9 +- Common/Tools/Multiplicity/multMCCalibrator.h | 7 +- Common/Tools/PID/checkPidPacking.cxx | 15 ++-- Common/Tools/PID/handleParamBase.h | 9 +- Common/Tools/PID/handleParamTPCResponse.cxx | 22 +++-- Common/Tools/PID/pidTPCModule.h | 49 +++++------ Common/Tools/StandardCCDBLoader.h | 15 ++-- Common/Tools/TrackPropagationModule.h | 1 + Common/Tools/TrackTuner.h | 23 ++--- Common/Tools/aodDataModelGraph.cxx | 22 +++-- Common/Tools/timestampModule.h | 16 ++-- Common/Tools/trackSelectionRequest.cxx | 4 +- Common/Tools/trackSelectionRequest.h | 3 +- 160 files changed, 1652 insertions(+), 1059 deletions(-) diff --git a/Common/CCDB/EventSelectionParams.cxx b/Common/CCDB/EventSelectionParams.cxx index 74587314240..013711d0464 100644 --- a/Common/CCDB/EventSelectionParams.cxx +++ b/Common/CCDB/EventSelectionParams.cxx @@ -18,6 +18,9 @@ #include "EventSelectionParams.h" +#include +#include + namespace o2::aod::evsel { const char* selectionLabels[kNsel] = { diff --git a/Common/CCDB/RCTSelectionFlags.h b/Common/CCDB/RCTSelectionFlags.h index 5f04cb42c90..eca25895962 100644 --- a/Common/CCDB/RCTSelectionFlags.h +++ b/Common/CCDB/RCTSelectionFlags.h @@ -19,14 +19,12 @@ #include -#include - -#include - #include +#include +#include +#include #include #include -#include namespace o2::aod::rctsel { diff --git a/Common/CCDB/TriggerAliases.cxx b/Common/CCDB/TriggerAliases.cxx index 789d293c1d0..c3d28889bca 100644 --- a/Common/CCDB/TriggerAliases.cxx +++ b/Common/CCDB/TriggerAliases.cxx @@ -10,7 +10,11 @@ // or submit itself to any jurisdiction. #include "Common/CCDB/TriggerAliases.h" -#include "Framework/Logger.h" + +#include + +#include +#include std::string aliasLabels[kNaliases] = { "kINT7", diff --git a/Common/CCDB/TriggerAliases.h b/Common/CCDB/TriggerAliases.h index 3ee5c3ba87c..60dbd965741 100644 --- a/Common/CCDB/TriggerAliases.h +++ b/Common/CCDB/TriggerAliases.h @@ -13,6 +13,7 @@ #define COMMON_CCDB_TRIGGERALIASES_H_ #include +#include #include #include diff --git a/Common/CCDB/ctpRateFetcher.cxx b/Common/CCDB/ctpRateFetcher.cxx index 4dbec5d8c0c..6cf7213f2e7 100644 --- a/Common/CCDB/ctpRateFetcher.cxx +++ b/Common/CCDB/ctpRateFetcher.cxx @@ -16,8 +16,13 @@ #include #include #include +#include +#include +#include +#include #include +#include #include #include diff --git a/Common/CCDB/ctpRateFetcher.h b/Common/CCDB/ctpRateFetcher.h index 9d4de6215d3..58c9d2ed553 100644 --- a/Common/CCDB/ctpRateFetcher.h +++ b/Common/CCDB/ctpRateFetcher.h @@ -14,6 +14,7 @@ #include +#include #include namespace o2 diff --git a/Common/Core/CollisionAssociation.cxx b/Common/Core/CollisionAssociation.cxx index dff8fee51cd..99b3b00e45f 100644 --- a/Common/Core/CollisionAssociation.cxx +++ b/Common/Core/CollisionAssociation.cxx @@ -17,4 +17,4 @@ /// \author Sarah Herrmann , IP2I Lyon /// \author Maurice Coquet , CEA-Saclay/Irfu -#include "Common/Core/CollisionAssociation.h" +#include "Common/Core/CollisionAssociation.h" // IWYU pragma: keep diff --git a/Common/Core/CollisionAssociation.h b/Common/Core/CollisionAssociation.h index e6b7f9f8cc5..e224dad51ed 100644 --- a/Common/Core/CollisionAssociation.h +++ b/Common/Core/CollisionAssociation.h @@ -21,9 +21,15 @@ #define COMMON_CORE_COLLISIONASSOCIATION_H_ #include -#include #include +#include +#include +#include + +#include +#include +#include #include #include #include diff --git a/Common/Core/CollisionTypeHelper.cxx b/Common/Core/CollisionTypeHelper.cxx index 10e23f19423..f66fd85a198 100644 --- a/Common/Core/CollisionTypeHelper.cxx +++ b/Common/Core/CollisionTypeHelper.cxx @@ -17,6 +17,7 @@ #include "Common/Core/CollisionTypeHelper.h" +#include #include #include diff --git a/Common/Core/CollisionTypeHelper.h b/Common/Core/CollisionTypeHelper.h index c8dc7a21842..f0edc19fd90 100644 --- a/Common/Core/CollisionTypeHelper.h +++ b/Common/Core/CollisionTypeHelper.h @@ -18,7 +18,7 @@ #ifndef COMMON_CORE_COLLISIONTYPEHELPER_H_ #define COMMON_CORE_COLLISIONTYPEHELPER_H_ -#include "DataFormatsParameters/GRPLHCIFData.h" +#include #include diff --git a/Common/Core/EventPlaneHelper.cxx b/Common/Core/EventPlaneHelper.cxx index 8c8cb88c896..9ffd39538a4 100644 --- a/Common/Core/EventPlaneHelper.cxx +++ b/Common/Core/EventPlaneHelper.cxx @@ -20,10 +20,16 @@ #include "Common/Core/EventPlaneHelper.h" +#include +#include + +#include +#include #include #include #include +#include #include #include #include diff --git a/Common/Core/EventPlaneHelper.h b/Common/Core/EventPlaneHelper.h index d6a2f3cba11..820af4336c2 100644 --- a/Common/Core/EventPlaneHelper.h +++ b/Common/Core/EventPlaneHelper.h @@ -21,17 +21,16 @@ #ifndef COMMON_CORE_EVENTPLANEHELPER_H_ #define COMMON_CORE_EVENTPLANEHELPER_H_ -#include -#include - -#include "TNamed.h" +#include +#include #include -#include -#include +#include -#include "FV0Base/Geometry.h" -#include "FT0Base/Geometry.h" +#include + +#include +#include class EventPlaneHelper { diff --git a/Common/Core/FFitWeights.cxx b/Common/Core/FFitWeights.cxx index 4133d6453eb..bc2623e7be9 100644 --- a/Common/Core/FFitWeights.cxx +++ b/Common/Core/FFitWeights.cxx @@ -16,7 +16,16 @@ #include "FFitWeights.h" +#include +#include +#include +#include +#include #include +#include + +#include +#include #include #include diff --git a/Common/Core/FFitWeights.h b/Common/Core/FFitWeights.h index 68470f95b55..155fd9af97f 100644 --- a/Common/Core/FFitWeights.h +++ b/Common/Core/FFitWeights.h @@ -17,19 +17,15 @@ #ifndef COMMON_CORE_FFITWEIGHTS_H_ #define COMMON_CORE_FFITWEIGHTS_H_ +#include #include -#include -#include -#include -#include -#include #include #include #include -#include -#include -#include +#include +#include + #include #include #include diff --git a/Common/Core/MetadataHelper.cxx b/Common/Core/MetadataHelper.cxx index 91037d615d0..79aa051a64f 100644 --- a/Common/Core/MetadataHelper.cxx +++ b/Common/Core/MetadataHelper.cxx @@ -17,9 +17,11 @@ #include "Common/Core/MetadataHelper.h" +#include #include -#include +#include +#include #include using namespace o2::common::core; diff --git a/Common/Core/MetadataHelper.h b/Common/Core/MetadataHelper.h index f3522a5d190..bab7b1f7eb0 100644 --- a/Common/Core/MetadataHelper.h +++ b/Common/Core/MetadataHelper.h @@ -16,7 +16,7 @@ #ifndef COMMON_CORE_METADATAHELPER_H_ #define COMMON_CORE_METADATAHELPER_H_ -#include "Framework/ConfigContext.h" +#include #include #include diff --git a/Common/Core/OrbitRange.cxx b/Common/Core/OrbitRange.cxx index 51a3ec5fe78..f9fbbb9eec0 100644 --- a/Common/Core/OrbitRange.cxx +++ b/Common/Core/OrbitRange.cxx @@ -14,8 +14,16 @@ // #include "Common/Core/OrbitRange.h" -#include "TCollection.h" -#include "TMath.h" + +#include +#include +#include +#include + +#include +#include + +#include ClassImp(OrbitRange) diff --git a/Common/Core/OrbitRange.h b/Common/Core/OrbitRange.h index f499b771e9b..ed1e298fe37 100644 --- a/Common/Core/OrbitRange.h +++ b/Common/Core/OrbitRange.h @@ -18,6 +18,11 @@ #include +#include +#include + +#include + class TCollection; class OrbitRange : public TNamed diff --git a/Common/Core/PID/DetectorResponse.h b/Common/Core/PID/DetectorResponse.h index 7b8c5bb2406..f161a1a0e4b 100644 --- a/Common/Core/PID/DetectorResponse.h +++ b/Common/Core/PID/DetectorResponse.h @@ -20,21 +20,17 @@ #ifndef COMMON_CORE_PID_DETECTORRESPONSE_H_ #define COMMON_CORE_PID_DETECTORRESPONSE_H_ +#include "Common/Core/PID/ParamBase.h" + #include -#include -#include -#include -// ROOT includes #include -#include #include -// O2 includes -#include "Common/Core/PID/ParamBase.h" - -#include +#include +#include +#include namespace o2::pid { diff --git a/Common/Core/PID/PIDTOF.cxx b/Common/Core/PID/PIDTOF.cxx index bec41fafc43..eaef6e9113f 100644 --- a/Common/Core/PID/PIDTOF.cxx +++ b/Common/Core/PID/PIDTOF.cxx @@ -17,7 +17,18 @@ /// #include "PIDTOF.h" + +#include + +#include +#include +#include +#include + +#include +#include #include +#include namespace o2::pid::tof { diff --git a/Common/Core/PID/PIDTOF.h b/Common/Core/PID/PIDTOF.h index 5822732dc5c..b4c00631048 100644 --- a/Common/Core/PID/PIDTOF.h +++ b/Common/Core/PID/PIDTOF.h @@ -19,25 +19,25 @@ #ifndef COMMON_CORE_PID_PIDTOF_H_ #define COMMON_CORE_PID_PIDTOF_H_ -#include -#include -#include - -// ROOT includes -#include -#include -#include -#include - -#include - -// O2 includes #include #include #include #include #include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + namespace o2::pid::tof { diff --git a/Common/Core/PID/ParamBase.cxx b/Common/Core/PID/ParamBase.cxx index a79ed660b7d..e1375b3916c 100644 --- a/Common/Core/PID/ParamBase.cxx +++ b/Common/Core/PID/ParamBase.cxx @@ -21,6 +21,9 @@ #include #include +#include + +#include #include diff --git a/Common/Core/PID/ParamBase.h b/Common/Core/PID/ParamBase.h index cc7812c3036..fa9f0749d2a 100644 --- a/Common/Core/PID/ParamBase.h +++ b/Common/Core/PID/ParamBase.h @@ -20,16 +20,19 @@ #ifndef COMMON_CORE_PID_PARAMBASE_H_ #define COMMON_CORE_PID_PARAMBASE_H_ -#include // std::copy -#include // std::map -#include // std::string -#include // std::vector - -// ROOT includes #include #include #include +#include + +#include +#include + +#include // std::copy +#include // std::map +#include // std::string +#include // std::vector namespace o2::pid { diff --git a/Common/Core/PID/TPCPIDResponse.h b/Common/Core/PID/TPCPIDResponse.h index deafdf4fed2..3f2fe069490 100644 --- a/Common/Core/PID/TPCPIDResponse.h +++ b/Common/Core/PID/TPCPIDResponse.h @@ -17,14 +17,15 @@ #ifndef COMMON_CORE_PID_TPCPIDRESPONSE_H_ #define COMMON_CORE_PID_TPCPIDRESPONSE_H_ +#include +#include +#include + +#include + #include -#include #include -#include "Framework/Logger.h" -// O2 includes -#include "ReconstructionDataFormats/PID.h" -#include "Framework/DataTypes.h" -#include "DataFormatsTPC/BetheBlochAleph.h" +#include namespace o2::pid::tpc { diff --git a/Common/Core/TPCVDriftManager.h b/Common/Core/TPCVDriftManager.h index 5d35db5ea99..3219b6189a0 100644 --- a/Common/Core/TPCVDriftManager.h +++ b/Common/Core/TPCVDriftManager.h @@ -12,17 +12,17 @@ #ifndef COMMON_CORE_TPCVDRIFTMANAGER_H_ #define COMMON_CORE_TPCVDRIFTMANAGER_H_ +#include +#include +#include +#include +#include +#include +#include + +#include #include -#include "CCDB/BasicCCDBManager.h" -#include "Framework/Logger.h" -#include "Framework/DataTypes.h" -#include "DataFormatsTPC/VDriftCorrFact.h" -#include "CommonConstants/LHCConstants.h" -#include "DataFormatsParameters/GRPLHCIFData.h" -#include "DataFormatsParameters/GRPECSObject.h" -#include "ReconstructionDataFormats/Track.h" - namespace o2::aod::common { diff --git a/Common/Core/TableHelper.cxx b/Common/Core/TableHelper.cxx index 57f03e43c35..acd09e49c31 100644 --- a/Common/Core/TableHelper.cxx +++ b/Common/Core/TableHelper.cxx @@ -18,6 +18,7 @@ #include "Common/Core/TableHelper.h" #include +#include #include #include diff --git a/Common/Core/TableHelper.h b/Common/Core/TableHelper.h index 40f31515a79..af5df6a7b0a 100644 --- a/Common/Core/TableHelper.h +++ b/Common/Core/TableHelper.h @@ -18,8 +18,10 @@ #ifndef COMMON_CORE_TABLEHELPER_H_ #define COMMON_CORE_TABLEHELPER_H_ -#include +#include +#include #include +#include #include #include diff --git a/Common/Core/TrackSelection.cxx b/Common/Core/TrackSelection.cxx index 474a6859e0c..6fe7a2e162b 100644 --- a/Common/Core/TrackSelection.cxx +++ b/Common/Core/TrackSelection.cxx @@ -15,8 +15,12 @@ #include "Common/Core/TrackSelection.h" +#include #include +#include +#include +#include #include #include #include diff --git a/Common/Core/TrackSelection.h b/Common/Core/TrackSelection.h index 4be97408f73..5f8590cb85f 100644 --- a/Common/Core/TrackSelection.h +++ b/Common/Core/TrackSelection.h @@ -16,11 +16,13 @@ #ifndef COMMON_CORE_TRACKSELECTION_H_ #define COMMON_CORE_TRACKSELECTION_H_ -#include "Framework/DataTypes.h" -#include "Framework/Logger.h" +#include #include +#include +#include +#include #include #include #include diff --git a/Common/Core/TrackSelectionDefaults.cxx b/Common/Core/TrackSelectionDefaults.cxx index 2958718feba..e8476db5e17 100644 --- a/Common/Core/TrackSelectionDefaults.cxx +++ b/Common/Core/TrackSelectionDefaults.cxx @@ -15,10 +15,15 @@ /// \since 20-10-2020 /// -#include "Framework/DataTypes.h" -#include "Common/Core/TrackSelection.h" #include "TrackSelectionDefaults.h" +#include "Common/Core/TrackSelection.h" + +#include +#include + +#include + // Default track selection requiring one hit in the SPD TrackSelection getGlobalTrackSelection() { diff --git a/Common/Core/TrackSelectionDefaults.h b/Common/Core/TrackSelectionDefaults.h index 72c666456ae..aaa1ef3644f 100644 --- a/Common/Core/TrackSelectionDefaults.h +++ b/Common/Core/TrackSelectionDefaults.h @@ -18,7 +18,6 @@ #ifndef COMMON_CORE_TRACKSELECTIONDEFAULTS_H_ #define COMMON_CORE_TRACKSELECTIONDEFAULTS_H_ -#include "Framework/DataTypes.h" #include "Common/Core/TrackSelection.h" // Default track selection requiring one hit in the SPD diff --git a/Common/Core/TrackSelectorPID.h b/Common/Core/TrackSelectorPID.h index 214627a2d72..f0a0e0619e2 100644 --- a/Common/Core/TrackSelectorPID.h +++ b/Common/Core/TrackSelectorPID.h @@ -17,10 +17,12 @@ #ifndef COMMON_CORE_TRACKSELECTORPID_H_ #define COMMON_CORE_TRACKSELECTORPID_H_ +#include +#include + #include -#include "Framework/Logger.h" -#include "ReconstructionDataFormats/PID.h" +#include /// Class for track selection using PID detectors diff --git a/Common/Core/trackUtilities.h b/Common/Core/trackUtilities.h index 21d30990e72..26f55491f05 100644 --- a/Common/Core/trackUtilities.h +++ b/Common/Core/trackUtilities.h @@ -20,9 +20,13 @@ #include "Common/Core/RecoDecay.h" #include -#include +#include +#include #include +#include + +#include #include // std::move /// Extracts track parameters from a track. diff --git a/Common/DataModel/CaloClusters.h b/Common/DataModel/CaloClusters.h index 23a44371d80..473cba9a5a7 100644 --- a/Common/DataModel/CaloClusters.h +++ b/Common/DataModel/CaloClusters.h @@ -12,8 +12,10 @@ #ifndef COMMON_DATAMODEL_CALOCLUSTERS_H_ #define COMMON_DATAMODEL_CALOCLUSTERS_H_ +#include + +#include #include -#include "Framework/AnalysisDataModel.h" namespace o2::aod { diff --git a/Common/DataModel/Centrality.h b/Common/DataModel/Centrality.h index fa7e2ec51bc..4713cceb697 100644 --- a/Common/DataModel/Centrality.h +++ b/Common/DataModel/Centrality.h @@ -11,7 +11,7 @@ #ifndef COMMON_DATAMODEL_CENTRALITY_H_ #define COMMON_DATAMODEL_CENTRALITY_H_ -#include "Framework/AnalysisDataModel.h" +#include namespace o2::aod { diff --git a/Common/DataModel/CollisionAssociationTables.h b/Common/DataModel/CollisionAssociationTables.h index 7bdbc0c97bd..7ddb2868683 100644 --- a/Common/DataModel/CollisionAssociationTables.h +++ b/Common/DataModel/CollisionAssociationTables.h @@ -20,7 +20,7 @@ #ifndef COMMON_DATAMODEL_COLLISIONASSOCIATIONTABLES_H_ #define COMMON_DATAMODEL_COLLISIONASSOCIATIONTABLES_H_ -#include "Framework/AnalysisDataModel.h" +#include namespace o2::aod { diff --git a/Common/DataModel/EseTable.h b/Common/DataModel/EseTable.h index 68ffdff450a..8463848312f 100644 --- a/Common/DataModel/EseTable.h +++ b/Common/DataModel/EseTable.h @@ -17,10 +17,9 @@ #ifndef COMMON_DATAMODEL_ESETABLE_H_ #define COMMON_DATAMODEL_ESETABLE_H_ -#include +#include -#include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" +#include namespace o2::aod { diff --git a/Common/DataModel/EventSelection.h b/Common/DataModel/EventSelection.h index 77849d0d7cf..670e1e05b61 100644 --- a/Common/DataModel/EventSelection.h +++ b/Common/DataModel/EventSelection.h @@ -17,10 +17,11 @@ #ifndef COMMON_DATAMODEL_EVENTSELECTION_H_ #define COMMON_DATAMODEL_EVENTSELECTION_H_ -#include "Framework/AnalysisDataModel.h" -#include "Common/CCDB/TriggerAliases.h" -#include "Common/CCDB/EventSelectionParams.h" -#include "Common/CCDB/RCTSelectionFlags.h" +#include "Common/CCDB/EventSelectionParams.h" // FIXME: remove +#include "Common/CCDB/RCTSelectionFlags.h" // FIXME: remove +#include "Common/CCDB/TriggerAliases.h" // FIXME: remove + +#include namespace o2::aod { diff --git a/Common/DataModel/FT0Corrected.h b/Common/DataModel/FT0Corrected.h index af11b3ff811..4c587dc28ad 100644 --- a/Common/DataModel/FT0Corrected.h +++ b/Common/DataModel/FT0Corrected.h @@ -11,7 +11,7 @@ #ifndef COMMON_DATAMODEL_FT0CORRECTED_H_ #define COMMON_DATAMODEL_FT0CORRECTED_H_ -#include "Framework/AnalysisDataModel.h" +#include namespace o2::aod { diff --git a/Common/DataModel/FwdTrackReAlignTables.h b/Common/DataModel/FwdTrackReAlignTables.h index 2dc9bf3dd6c..199a9c994c0 100644 --- a/Common/DataModel/FwdTrackReAlignTables.h +++ b/Common/DataModel/FwdTrackReAlignTables.h @@ -16,7 +16,7 @@ #ifndef COMMON_DATAMODEL_FWDTRACKREALIGNTABLES_H_ #define COMMON_DATAMODEL_FWDTRACKREALIGNTABLES_H_ -#include "Framework/AnalysisDataModel.h" +#include namespace o2::aod { diff --git a/Common/DataModel/MatchMFTFT0.h b/Common/DataModel/MatchMFTFT0.h index 21ee19b696f..8ff2e04ecad 100644 --- a/Common/DataModel/MatchMFTFT0.h +++ b/Common/DataModel/MatchMFTFT0.h @@ -15,7 +15,10 @@ // \brief Declaration of tables useful for the matching of MFT tracks to FT0-C signals // \date 03/09/24 -#include "Framework/AnalysisDataModel.h" +#ifndef COMMON_DATAMODEL_MATCHMFTFT0_H_ +#define COMMON_DATAMODEL_MATCHMFTFT0_H_ + +#include namespace o2::aod { @@ -32,3 +35,5 @@ DECLARE_SOA_TABLE(MatchedToFT0, "AOD", "MAFT", indices::BCId, indices::FT0Ids); DECLARE_SOA_TABLE(BCofMFT, "AOD", "BCOFMFT", ambii::MFTTrackId, indices::BCIds); } // namespace o2::aod + +#endif // COMMON_DATAMODEL_MATCHMFTFT0_H_ diff --git a/Common/DataModel/MatchMFTMuonData.h b/Common/DataModel/MatchMFTMuonData.h index d1b59dc168c..582e8e46692 100644 --- a/Common/DataModel/MatchMFTMuonData.h +++ b/Common/DataModel/MatchMFTMuonData.h @@ -8,10 +8,13 @@ // 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. + #ifndef COMMON_DATAMODEL_MATCHMFTMUONDATA_H_ #define COMMON_DATAMODEL_MATCHMFTMUONDATA_H_ -#include "Framework/AnalysisDataModel.h" -#endif // COMMON_DATAMODEL_MATCHMFTMUONDATA_H_ + +#include + +#include namespace o2::aod { @@ -133,3 +136,4 @@ DECLARE_SOA_TABLE(MuonPair, "AOD", "MUONPAIR", muon_pair::Rap); } // namespace o2::aod +#endif // COMMON_DATAMODEL_MATCHMFTMUONDATA_H_ diff --git a/Common/DataModel/McCollisionExtra.h b/Common/DataModel/McCollisionExtra.h index 14b11b9a4e8..475ab68d50a 100644 --- a/Common/DataModel/McCollisionExtra.h +++ b/Common/DataModel/McCollisionExtra.h @@ -14,15 +14,17 @@ #ifndef COMMON_DATAMODEL_MCCOLLISIONEXTRA_H_ #define COMMON_DATAMODEL_MCCOLLISIONEXTRA_H_ +#include + #include -#include "Framework/AnalysisDataModel.h" +#include namespace o2::aod { namespace mccollisionprop { -DECLARE_SOA_COLUMN(NumRecoCollision, numRecoCollision, int); //! stores N times this PV was recoed -DECLARE_SOA_COLUMN(BestCollisionIndex, bestCollisionIndex, int); //! stores N times this PV was recoed +DECLARE_SOA_COLUMN(NumRecoCollision, numRecoCollision, int); //! stores N times this PV was recoed +DECLARE_SOA_COLUMN(BestCollisionIndex, bestCollisionIndex, int); //! stores N times this PV was recoed DECLARE_SOA_COLUMN(BestCollisionCentFT0C, bestCollisionCentFT0C, float); //! stores best FT0C centrality // collision MC context (neighbours contain PoI?) @@ -35,4 +37,4 @@ DECLARE_SOA_TABLE(McCollContexts, "AOD", "MCCOLLCONTEXT", mccollisionprop::ForwardCollisionMap, mccollisionprop::BackwardCollisionMap); } // namespace o2::aod -#endif // COMMON_DATAMODEL_MCCOLLISIONEXTRA_H_ \ No newline at end of file +#endif // COMMON_DATAMODEL_MCCOLLISIONEXTRA_H_ diff --git a/Common/DataModel/MftmchMatchingML.h b/Common/DataModel/MftmchMatchingML.h index f243411f3b7..65e9234586f 100644 --- a/Common/DataModel/MftmchMatchingML.h +++ b/Common/DataModel/MftmchMatchingML.h @@ -12,9 +12,10 @@ #ifndef COMMON_DATAMODEL_MFTMCHMATCHINGML_H_ #define COMMON_DATAMODEL_MFTMCHMATCHINGML_H_ -#include "Framework/AnalysisDataModel.h" #include "Common/DataModel/TrackSelectionTables.h" +#include + namespace o2::aod { DECLARE_SOA_TABLE(FwdTracksML, "AOD", "FWDTRACKML", diff --git a/Common/DataModel/Multiplicity.h b/Common/DataModel/Multiplicity.h index 8d1e9b10ab3..5337d5ffd59 100644 --- a/Common/DataModel/Multiplicity.h +++ b/Common/DataModel/Multiplicity.h @@ -16,9 +16,12 @@ #ifndef COMMON_DATAMODEL_MULTIPLICITY_H_ #define COMMON_DATAMODEL_MULTIPLICITY_H_ -#include "Framework/AnalysisDataModel.h" #include "Common/DataModel/EventSelection.h" +#include + +#include + namespace o2::aod { namespace mult diff --git a/Common/DataModel/OccupancyTables.h b/Common/DataModel/OccupancyTables.h index 9e14fd8f4f2..92cc075414b 100644 --- a/Common/DataModel/OccupancyTables.h +++ b/Common/DataModel/OccupancyTables.h @@ -14,10 +14,11 @@ /// /// \author Rahul Verma (rahul.verma@iitb.ac.in) :: Marian I Ivanov (marian.ivanov@cern.ch) -#include +#include +#include -#include "Framework/ASoA.h" -#include "Framework/AnalysisDataModel.h" +#include +#include #ifndef COMMON_DATAMODEL_OCCUPANCYTABLES_H_ #define COMMON_DATAMODEL_OCCUPANCYTABLES_H_ diff --git a/Common/DataModel/PIDResponse.h b/Common/DataModel/PIDResponse.h index eee2e4df2e3..a2b3c0f7390 100644 --- a/Common/DataModel/PIDResponse.h +++ b/Common/DataModel/PIDResponse.h @@ -19,9 +19,8 @@ #ifndef COMMON_DATAMODEL_PIDRESPONSE_H_ #define COMMON_DATAMODEL_PIDRESPONSE_H_ -#include "PIDResponseTOF.h" -#include "PIDResponseTPC.h" -#include "PIDResponseCombined.h" +#include "Common/DataModel/PIDResponseTOF.h" // FIXME: remove +#include "Common/DataModel/PIDResponseTPC.h" // FIXME: remove namespace o2::aod { diff --git a/Common/DataModel/PIDResponseCombined.h b/Common/DataModel/PIDResponseCombined.h index 4b54d214838..d18b2528c32 100644 --- a/Common/DataModel/PIDResponseCombined.h +++ b/Common/DataModel/PIDResponseCombined.h @@ -19,13 +19,11 @@ #ifndef COMMON_DATAMODEL_PIDRESPONSECOMBINED_H_ #define COMMON_DATAMODEL_PIDRESPONSECOMBINED_H_ -#include +#include +#include +#include -// O2 includes -#include "Framework/ASoA.h" -#include "Framework/AnalysisDataModel.h" -#include "ReconstructionDataFormats/PID.h" -#include "Framework/Logger.h" +#include namespace o2::aod { diff --git a/Common/DataModel/PIDResponseITS.h b/Common/DataModel/PIDResponseITS.h index e1e2a586472..7a13c4cbfa1 100644 --- a/Common/DataModel/PIDResponseITS.h +++ b/Common/DataModel/PIDResponseITS.h @@ -22,13 +22,17 @@ #ifndef COMMON_DATAMODEL_PIDRESPONSEITS_H_ #define COMMON_DATAMODEL_PIDRESPONSEITS_H_ -// O2 includes -#include "TableHelper.h" +#include "Common/Core/TableHelper.h" -#include "Framework/ASoA.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/Logger.h" -#include "ReconstructionDataFormats/PID.h" +#include +#include +#include +#include +#include +#include + +#include +#include namespace o2::aod { diff --git a/Common/DataModel/PIDResponseTOF.h b/Common/DataModel/PIDResponseTOF.h index 5edfe931ad8..23f266228b8 100644 --- a/Common/DataModel/PIDResponseTOF.h +++ b/Common/DataModel/PIDResponseTOF.h @@ -20,15 +20,16 @@ #ifndef COMMON_DATAMODEL_PIDRESPONSETOF_H_ #define COMMON_DATAMODEL_PIDRESPONSETOF_H_ -#include - -// O2 includes -#include "Framework/ASoA.h" -#include "Framework/AnalysisDataModel.h" -#include "ReconstructionDataFormats/PID.h" -#include "Framework/Logger.h" #include "Common/Core/PID/PIDTOF.h" +#include +#include +#include +#include + +#include +#include + namespace o2::aod { namespace pidutils diff --git a/Common/DataModel/PIDResponseTPC.h b/Common/DataModel/PIDResponseTPC.h index a22d5c9c008..66df7dc403f 100644 --- a/Common/DataModel/PIDResponseTPC.h +++ b/Common/DataModel/PIDResponseTPC.h @@ -20,13 +20,13 @@ #ifndef COMMON_DATAMODEL_PIDRESPONSETPC_H_ #define COMMON_DATAMODEL_PIDRESPONSETPC_H_ -#include +#include +#include +#include +#include -// O2 includes -#include "Framework/ASoA.h" -#include "Framework/AnalysisDataModel.h" -#include "ReconstructionDataFormats/PID.h" -#include "Framework/Logger.h" +#include +#include namespace o2::aod { diff --git a/Common/DataModel/PmdTable.h b/Common/DataModel/PmdTable.h index fe1cb14018e..5efd66df32e 100644 --- a/Common/DataModel/PmdTable.h +++ b/Common/DataModel/PmdTable.h @@ -18,7 +18,7 @@ #ifndef COMMON_DATAMODEL_PMDTABLE_H_ #define COMMON_DATAMODEL_PMDTABLE_H_ -#include "Framework/AnalysisDataModel.h" +#include namespace o2::aod { diff --git a/Common/DataModel/Qvectors.h b/Common/DataModel/Qvectors.h index 423c2648e89..d723d659bc5 100644 --- a/Common/DataModel/Qvectors.h +++ b/Common/DataModel/Qvectors.h @@ -21,8 +21,9 @@ #ifndef COMMON_DATAMODEL_QVECTORS_H_ #define COMMON_DATAMODEL_QVECTORS_H_ +#include + #include -#include "Framework/AnalysisDataModel.h" namespace o2::aod { diff --git a/Common/DataModel/SelectionStudyTables.h b/Common/DataModel/SelectionStudyTables.h index 3a62c30b267..e2c14375ab1 100644 --- a/Common/DataModel/SelectionStudyTables.h +++ b/Common/DataModel/SelectionStudyTables.h @@ -14,8 +14,8 @@ /// /// \author ALICE -#include "Framework/ASoA.h" -#include "Framework/AnalysisDataModel.h" +#include +#include #include diff --git a/Common/DataModel/TrackSelectionTables.h b/Common/DataModel/TrackSelectionTables.h index 46ebf03868f..b710ff89ac1 100644 --- a/Common/DataModel/TrackSelectionTables.h +++ b/Common/DataModel/TrackSelectionTables.h @@ -12,7 +12,9 @@ #ifndef COMMON_DATAMODEL_TRACKSELECTIONTABLES_H_ #define COMMON_DATAMODEL_TRACKSELECTIONTABLES_H_ -#include "Framework/AnalysisDataModel.h" +#include + +#include namespace o2::aod { diff --git a/Common/DataModel/ZDCInterCalib.h b/Common/DataModel/ZDCInterCalib.h index d7b66575340..08f9961884f 100644 --- a/Common/DataModel/ZDCInterCalib.h +++ b/Common/DataModel/ZDCInterCalib.h @@ -16,7 +16,9 @@ #ifndef COMMON_DATAMODEL_ZDCINTERCALIB_H_ #define COMMON_DATAMODEL_ZDCINTERCALIB_H_ -#include "Framework/AnalysisDataModel.h" +#include + +#include namespace o2::aod { diff --git a/Common/LegacyDataQA/centqa.cxx b/Common/LegacyDataQA/centqa.cxx index 0d69be10754..6d9e2722bbf 100644 --- a/Common/LegacyDataQA/centqa.cxx +++ b/Common/LegacyDataQA/centqa.cxx @@ -22,15 +22,16 @@ // - david.dobrigkeit.chinellato@cern.ch // -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Common/DataModel/McCollisionExtra.h" #include "Common/DataModel/Centrality.h" -#include "Common/DataModel/EventSelection.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "TH1F.h" -#include "TH2F.h" + +#include +#include +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/LegacyDataQA/otfv0qa.cxx b/Common/LegacyDataQA/otfv0qa.cxx index 8dc446d9a01..65ce7891dbb 100644 --- a/Common/LegacyDataQA/otfv0qa.cxx +++ b/Common/LegacyDataQA/otfv0qa.cxx @@ -9,15 +9,14 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Common/DataModel/McCollisionExtra.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/EventSelection.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "TH1F.h" -#include "TH2F.h" +#include +#include +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/LegacyDataQA/pcmRun2.cxx b/Common/LegacyDataQA/pcmRun2.cxx index 87032dd96d3..a05932170de 100644 --- a/Common/LegacyDataQA/pcmRun2.cxx +++ b/Common/LegacyDataQA/pcmRun2.cxx @@ -25,7 +25,8 @@ #include #include -#include +#include // IWYU pragma: keep (do not replace with Math/Vector4Dfwd.h) +#include #include #include @@ -39,6 +40,7 @@ using namespace o2::aod; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::soa; + struct PcmRun2 { struct : ConfigurableGroup { std::string prefix = "trackcuts"; diff --git a/Common/LegacyDataQA/pmdQa.cxx b/Common/LegacyDataQA/pmdQa.cxx index 9958fd26761..e2e3da0001a 100644 --- a/Common/LegacyDataQA/pmdQa.cxx +++ b/Common/LegacyDataQA/pmdQa.cxx @@ -15,20 +15,23 @@ /// \author Abhi Modak (abhi.modak@cern.ch) /// \since May 17, 2025 -#include -#include -#include - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/ASoA.h" -#include "Framework/AnalysisDataModel.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/PmdTable.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "CCDB/BasicCCDBManager.h" -#include "TH1F.h" -#include "TH2F.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include using namespace o2; using namespace o2::aod::run2; diff --git a/Common/LegacyDataQA/tpcpidqa.cxx b/Common/LegacyDataQA/tpcpidqa.cxx index a67043fd342..46b02aa8d93 100644 --- a/Common/LegacyDataQA/tpcpidqa.cxx +++ b/Common/LegacyDataQA/tpcpidqa.cxx @@ -18,11 +18,22 @@ // // Warning: expected resolution is NOT provided. -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Common/DataModel/PIDResponse.h" -#include "TableHelper.h" +#include "Common/DataModel/PIDResponseTPC.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/Converters/bcConverter.cxx b/Common/TableProducer/Converters/bcConverter.cxx index 54f9a90aa8b..a8d8ab7d6ed 100644 --- a/Common/TableProducer/Converters/bcConverter.cxx +++ b/Common/TableProducer/Converters/bcConverter.cxx @@ -8,9 +8,12 @@ // 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. -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" +#include +#include +#include +#include + +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/Converters/bcFlagsCreator.cxx b/Common/TableProducer/Converters/bcFlagsCreator.cxx index 972832716b5..4d10272e1d7 100644 --- a/Common/TableProducer/Converters/bcFlagsCreator.cxx +++ b/Common/TableProducer/Converters/bcFlagsCreator.cxx @@ -8,9 +8,12 @@ // 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. -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" +#include +#include +#include +#include + +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/Converters/caloLabelConverter.cxx b/Common/TableProducer/Converters/caloLabelConverter.cxx index 0186e34f628..7716abf964f 100644 --- a/Common/TableProducer/Converters/caloLabelConverter.cxx +++ b/Common/TableProducer/Converters/caloLabelConverter.cxx @@ -8,9 +8,13 @@ // 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. -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" +#include +#include +#include +#include + +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/Converters/collisionConverter.cxx b/Common/TableProducer/Converters/collisionConverter.cxx index d3186ea462f..d6d27dcdaf3 100644 --- a/Common/TableProducer/Converters/collisionConverter.cxx +++ b/Common/TableProducer/Converters/collisionConverter.cxx @@ -8,9 +8,15 @@ // 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. -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/Converters/fddConverter.cxx b/Common/TableProducer/Converters/fddConverter.cxx index 50d47ade048..d7f359e6f68 100644 --- a/Common/TableProducer/Converters/fddConverter.cxx +++ b/Common/TableProducer/Converters/fddConverter.cxx @@ -8,9 +8,12 @@ // 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. -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" +#include +#include +#include +#include + +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/Converters/hmpConverter.cxx b/Common/TableProducer/Converters/hmpConverter.cxx index da4eeeb7bca..ae423c0c9e8 100644 --- a/Common/TableProducer/Converters/hmpConverter.cxx +++ b/Common/TableProducer/Converters/hmpConverter.cxx @@ -12,9 +12,10 @@ // HMPID converter to new format // to be used with Run 2 converted data and older AO2Ds -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" +#include +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/Converters/mcCollisionConverter.cxx b/Common/TableProducer/Converters/mcCollisionConverter.cxx index b965a092117..290ce3d13dd 100644 --- a/Common/TableProducer/Converters/mcCollisionConverter.cxx +++ b/Common/TableProducer/Converters/mcCollisionConverter.cxx @@ -8,9 +8,10 @@ // 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. -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" +#include +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/Converters/mcConverter.cxx b/Common/TableProducer/Converters/mcConverter.cxx index a78ac3158ea..4f18556f8a9 100644 --- a/Common/TableProducer/Converters/mcConverter.cxx +++ b/Common/TableProducer/Converters/mcConverter.cxx @@ -8,9 +8,12 @@ // 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. -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" +#include +#include +#include +#include + +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/Converters/mftTracksConverter.cxx b/Common/TableProducer/Converters/mftTracksConverter.cxx index 425bb0c6392..175e9610f4f 100644 --- a/Common/TableProducer/Converters/mftTracksConverter.cxx +++ b/Common/TableProducer/Converters/mftTracksConverter.cxx @@ -19,9 +19,12 @@ /// \author L.Micheletti -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" +#include +#include +#include +#include + +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/Converters/multMCExtrasConverter.cxx b/Common/TableProducer/Converters/multMCExtrasConverter.cxx index ac2c074ba1b..56d6233690d 100644 --- a/Common/TableProducer/Converters/multMCExtrasConverter.cxx +++ b/Common/TableProducer/Converters/multMCExtrasConverter.cxx @@ -9,11 +9,13 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" #include "Common/DataModel/Multiplicity.h" +#include +#include +#include +#include + using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/Converters/multsExtraConverter.cxx b/Common/TableProducer/Converters/multsExtraConverter.cxx index d62b34508b8..36b7f70d33a 100644 --- a/Common/TableProducer/Converters/multsExtraConverter.cxx +++ b/Common/TableProducer/Converters/multsExtraConverter.cxx @@ -9,11 +9,13 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" #include "Common/DataModel/Multiplicity.h" +#include +#include +#include +#include + using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/Converters/run2TinyToFullPID.cxx b/Common/TableProducer/Converters/run2TinyToFullPID.cxx index 23b6c5a8cbf..ecad9de711f 100644 --- a/Common/TableProducer/Converters/run2TinyToFullPID.cxx +++ b/Common/TableProducer/Converters/run2TinyToFullPID.cxx @@ -18,11 +18,19 @@ // // Warning: expected resolution is NOT provided. -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Common/DataModel/PIDResponse.h" -#include "TableHelper.h" +#include "Common/Core/TableHelper.h" +#include "Common/DataModel/PIDResponseTPC.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/Converters/run2bcinfosConverter.cxx b/Common/TableProducer/Converters/run2bcinfosConverter.cxx index 6257d371824..fd0f43f3fda 100644 --- a/Common/TableProducer/Converters/run2bcinfosConverter.cxx +++ b/Common/TableProducer/Converters/run2bcinfosConverter.cxx @@ -9,9 +9,10 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" +#include +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/Converters/run2tracksExtraConverter.cxx b/Common/TableProducer/Converters/run2tracksExtraConverter.cxx index 28ae54c4367..2d321ee06fb 100644 --- a/Common/TableProducer/Converters/run2tracksExtraConverter.cxx +++ b/Common/TableProducer/Converters/run2tracksExtraConverter.cxx @@ -9,9 +9,10 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" +#include +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/Converters/trackQA002Converter.cxx b/Common/TableProducer/Converters/trackQA002Converter.cxx index 566c998e1bc..34e1bac2363 100644 --- a/Common/TableProducer/Converters/trackQA002Converter.cxx +++ b/Common/TableProducer/Converters/trackQA002Converter.cxx @@ -8,11 +8,14 @@ // 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. -#include +#include +#include +#include +#include +#include -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/Converters/trackQA003Converter.cxx b/Common/TableProducer/Converters/trackQA003Converter.cxx index 56a6d3551e9..4b6e0c7b2bd 100644 --- a/Common/TableProducer/Converters/trackQA003Converter.cxx +++ b/Common/TableProducer/Converters/trackQA003Converter.cxx @@ -8,11 +8,14 @@ // 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. -#include +#include +#include +#include +#include +#include -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/Converters/trackQAConverter.cxx b/Common/TableProducer/Converters/trackQAConverter.cxx index bdfecbca8d0..25200812076 100644 --- a/Common/TableProducer/Converters/trackQAConverter.cxx +++ b/Common/TableProducer/Converters/trackQAConverter.cxx @@ -8,11 +8,13 @@ // 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. -#include +#include +#include +#include +#include -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/Converters/tracksExtraConverter.cxx b/Common/TableProducer/Converters/tracksExtraConverter.cxx index b097cb7c4a3..0366a84dd8f 100644 --- a/Common/TableProducer/Converters/tracksExtraConverter.cxx +++ b/Common/TableProducer/Converters/tracksExtraConverter.cxx @@ -19,9 +19,12 @@ /// \author F.Mazzaschi -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" +#include +#include +#include +#include + +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/Converters/tracksExtraV002Converter.cxx b/Common/TableProducer/Converters/tracksExtraV002Converter.cxx index a70ac8ea8a8..d45eb6e2c09 100644 --- a/Common/TableProducer/Converters/tracksExtraV002Converter.cxx +++ b/Common/TableProducer/Converters/tracksExtraV002Converter.cxx @@ -9,9 +9,14 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" +#include +#include +#include +#include +#include +#include + +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/Converters/v0converter.cxx b/Common/TableProducer/Converters/v0converter.cxx index 849e35591e1..38c513681b4 100644 --- a/Common/TableProducer/Converters/v0converter.cxx +++ b/Common/TableProducer/Converters/v0converter.cxx @@ -8,9 +8,12 @@ // 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. -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" +#include +#include +#include +#include + +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/Converters/zdcConverter.cxx b/Common/TableProducer/Converters/zdcConverter.cxx index 2c94d5ca46f..99a88d2b6ca 100644 --- a/Common/TableProducer/Converters/zdcConverter.cxx +++ b/Common/TableProducer/Converters/zdcConverter.cxx @@ -12,10 +12,14 @@ // ZDC converter to new format // to be used with Run 2 converted data and older AO2Ds -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "ZDCBase/Constants.h" +#include +#include +#include +#include +#include + +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/PID/pidBayes.cxx b/Common/TableProducer/PID/pidBayes.cxx index 5a91afa6f70..dd52d06e6cb 100644 --- a/Common/TableProducer/PID/pidBayes.cxx +++ b/Common/TableProducer/PID/pidBayes.cxx @@ -16,15 +16,6 @@ /// Only the tables for the mass hypotheses requested are filled, the others are sent empty. /// -#include -#include -#include -#include -#include - -// O2 includes -#include "pidTOFBase.h" - #include "Common/Core/PID/DetectorResponse.h" #include "Common/Core/PID/PIDTOF.h" #include "Common/Core/PID/ParamBase.h" @@ -32,14 +23,39 @@ #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponseCombined.h" #include "Common/DataModel/PIDResponseTOF.h" -#include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/TrackSelectionTables.h" #include +#include +#include +#include #include -#include +#include +#include #include +#include +#include +#include #include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/PID/pidITS.cxx b/Common/TableProducer/PID/pidITS.cxx index 1a6cdbc5491..ab9f30c3659 100644 --- a/Common/TableProducer/PID/pidITS.cxx +++ b/Common/TableProducer/PID/pidITS.cxx @@ -19,21 +19,23 @@ /// Only the tables for the mass hypotheses requested are filled, the others are sent empty. /// -#include -#include -#include - -// O2 includes -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "ReconstructionDataFormats/Track.h" -#include "CCDB/BasicCCDBManager.h" -#include "TOFBase/EventTimeMaker.h" - -// O2Physics includes +#include "Common/Core/MetadataHelper.h" #include "Common/DataModel/PIDResponseITS.h" -#include "MetadataHelper.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/PID/pidTOF.cxx b/Common/TableProducer/PID/pidTOF.cxx index 076cc0c26de..b9efb4ca12f 100644 --- a/Common/TableProducer/PID/pidTOF.cxx +++ b/Common/TableProducer/PID/pidTOF.cxx @@ -16,15 +16,32 @@ /// Only the tables for the mass hypotheses requested are filled, the others are sent empty. /// -// O2 includes +#include "pidTOFBase.h" + +#include "Common/Core/TableHelper.h" +#include "Common/DataModel/PIDResponseTOF.h" + #include -#include "TOFBase/EventTimeMaker.h" -#include "Framework/AnalysisTask.h" -#include "ReconstructionDataFormats/Track.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -// O2Physics includes -#include "TableHelper.h" -#include "pidTOFBase.h" +#include +#include + +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -38,7 +55,7 @@ void customize(std::vector& workflowOptions) std::swap(workflowOptions, options); } -#include "Framework/runDataProcessing.h" +#include /// Task to produce the response table struct tofPid { diff --git a/Common/TableProducer/PID/pidTOFBase.cxx b/Common/TableProducer/PID/pidTOFBase.cxx index f55a4049e04..50854085476 100644 --- a/Common/TableProducer/PID/pidTOFBase.cxx +++ b/Common/TableProducer/PID/pidTOFBase.cxx @@ -15,27 +15,36 @@ /// \brief Base to build tasks for TOF PID tasks. /// -#include -#include -#include - -// O2 includes -#include -#include -#include -#include - -// O2Physics includes -#include "TableHelper.h" #include "pidTOFBase.h" +#include "Common/Core/TableHelper.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/FT0Corrected.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include +#include +#include +#include +#include +#include +#include +#include #include +#include +#include +#include #include +#include +#include +#include + +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/PID/pidTOFBase.h b/Common/TableProducer/PID/pidTOFBase.h index 44367eacb75..0aa87763775 100644 --- a/Common/TableProducer/PID/pidTOFBase.h +++ b/Common/TableProducer/PID/pidTOFBase.h @@ -18,15 +18,12 @@ #ifndef COMMON_TABLEPRODUCER_PID_PIDTOFBASE_H_ #define COMMON_TABLEPRODUCER_PID_PIDTOFBASE_H_ +#include + +#include #include #include -// O2Physics -#include "PID/ParamBase.h" -#include "PID/PIDTOF.h" -#include "Common/DataModel/PIDResponseTOF.h" -#include "Common/DataModel/PIDResponse.h" - static constexpr int nSpecies = 9; static constexpr int nParameters = 1; static const std::vector particleNames{"El", "Mu", "Pi", "Ka", "Pr", "De", "Tr", "He", "Al"}; diff --git a/Common/TableProducer/PID/pidTOFFull.cxx b/Common/TableProducer/PID/pidTOFFull.cxx index 6fec03a10ff..e8c94641f18 100644 --- a/Common/TableProducer/PID/pidTOFFull.cxx +++ b/Common/TableProducer/PID/pidTOFFull.cxx @@ -16,15 +16,32 @@ /// Only the tables for the mass hypotheses requested are filled, the others are sent empty. /// -// O2 includes +#include "pidTOFBase.h" + +#include "Common/Core/TableHelper.h" +#include "Common/DataModel/PIDResponseTOF.h" + #include -#include "TOFBase/EventTimeMaker.h" -#include "Framework/AnalysisTask.h" -#include "ReconstructionDataFormats/Track.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -// O2Physics includes -#include "TableHelper.h" -#include "pidTOFBase.h" +#include +#include + +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -38,7 +55,7 @@ void customize(std::vector& workflowOptions) std::swap(workflowOptions, options); } -#include "Framework/runDataProcessing.h" +#include /// Task to produce the response table struct tofPidFull { diff --git a/Common/TableProducer/PID/pidTOFMerge.cxx b/Common/TableProducer/PID/pidTOFMerge.cxx index 91c76e6e50a..3627c349b6f 100644 --- a/Common/TableProducer/PID/pidTOFMerge.cxx +++ b/Common/TableProducer/PID/pidTOFMerge.cxx @@ -15,30 +15,47 @@ /// \author Nicolò Jacazio nicolo.jacazio@cern.ch /// -#include -#include -#include -#include -#include +#include "pidTOFBase.h" + +#include "Common/Core/CollisionTypeHelper.h" +#include "Common/Core/MetadataHelper.h" +#include "Common/Core/TableHelper.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/FT0Corrected.h" +#include "Common/DataModel/PIDResponseTOF.h" -// O2 includes #include +#include +#include +#include +#include +#include #include +#include +#include +#include #include +#include +#include +#include #include -#include +#include +#include #include -// O2Physics includes -#include "CollisionTypeHelper.h" -#include "MetadataHelper.h" -#include "TableHelper.h" -#include "pidTOFBase.h" +#include +#include +#include -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/FT0Corrected.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/TrackSelectionTables.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/PID/pidTOFbeta.cxx b/Common/TableProducer/PID/pidTOFbeta.cxx index d76d631bc4d..8015dc3caea 100644 --- a/Common/TableProducer/PID/pidTOFbeta.cxx +++ b/Common/TableProducer/PID/pidTOFbeta.cxx @@ -15,15 +15,26 @@ /// \brief Task to produce TOF beta and TOF mass tables /// -// O2 includes -#include "CCDB/BasicCCDBManager.h" -#include "Framework/AnalysisTask.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "pidTOFBase.h" -#include "TableHelper.h" +#include "Common/Core/TableHelper.h" +#include "Common/DataModel/PIDResponseTOF.h" -// O2Physics includes -#include "PID/PIDTOF.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include using namespace o2; using namespace o2::pid; @@ -37,7 +48,7 @@ void customize(std::vector& workflowOptions) std::swap(workflowOptions, options); } -#include "Framework/runDataProcessing.h" +#include struct tofPidBeta { Produces tablePIDBeta; diff --git a/Common/TableProducer/PID/pidTPC.cxx b/Common/TableProducer/PID/pidTPC.cxx index bd126939f0f..c59785b5247 100644 --- a/Common/TableProducer/PID/pidTPC.cxx +++ b/Common/TableProducer/PID/pidTPC.cxx @@ -18,35 +18,41 @@ /// \brief Task to produce PID tables for TPC split for each particle. /// Only the tables for the mass hypotheses requested are filled, and only for the requested table size ("Full" or "Tiny"). The others are sent empty. /// -#include -#include -#include -#include -#include -// ROOT includes -#include -#include -#include - -// O2 includes -#include "MetadataHelper.h" -#include "TableHelper.h" #include "pidTPCBase.h" #include "Common/CCDB/ctpRateFetcher.h" +#include "Common/Core/MetadataHelper.h" #include "Common/Core/PID/TPCPIDResponse.h" +#include "Common/Core/TableHelper.h" #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponseTPC.h" #include "Tools/ML/model.h" #include #include -#include #include +#include #include +#include +#include +#include #include -#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/PID/pidTPCBase.cxx b/Common/TableProducer/PID/pidTPCBase.cxx index 1f9ef4278fc..75a5add7820 100644 --- a/Common/TableProducer/PID/pidTPCBase.cxx +++ b/Common/TableProducer/PID/pidTPCBase.cxx @@ -15,21 +15,27 @@ /// \brief Base to build tasks for TPC PID tasks. /// -#include -#include -#include - -// O2 includes -#include "TableHelper.h" #include "pidTPCBase.h" #include "Common/CCDB/ctpRateFetcher.h" -#include "Common/DataModel/FT0Corrected.h" - -#include "CCDB/BasicCCDBManager.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/Track.h" +#include "Common/Core/TableHelper.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/PID/pidTPCBase.h b/Common/TableProducer/PID/pidTPCBase.h index 42dedec46ff..bd948bc99e6 100644 --- a/Common/TableProducer/PID/pidTPCBase.h +++ b/Common/TableProducer/PID/pidTPCBase.h @@ -19,9 +19,15 @@ #define COMMON_TABLEPRODUCER_PID_PIDTPCBASE_H_ #include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/PIDResponseTPC.h" -#include "TMatrixD.h" +#include +#include + +#include // IWYU pragma: keep (do not replace with TMatrixDfwd.h) +#include + +#include +#include namespace o2::aod { diff --git a/Common/TableProducer/PID/pidTPCService.cxx b/Common/TableProducer/PID/pidTPCService.cxx index 7350b9e9fa5..02f8cfa255b 100644 --- a/Common/TableProducer/PID/pidTPCService.cxx +++ b/Common/TableProducer/PID/pidTPCService.cxx @@ -19,35 +19,23 @@ // //=============================================================== -#include -#include -#include -#include -#include -// ROOT includes -#include "TFile.h" -#include "TRandom.h" -#include "TSystem.h" - -// O2 includes -#include "MetadataHelper.h" -#include "TableHelper.h" -#include "pidTPCBase.h" - -#include "Common/Core/PID/TPCPIDResponse.h" +#include "Common/Core/MetadataHelper.h" #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/PIDResponseTPC.h" #include "Common/Tools/PID/pidTPCModule.h" -#include "Tools/ML/model.h" - -#include "CCDB/BasicCCDBManager.h" -#include "CCDB/CcdbApi.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/Track.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/PID/pidTPCServiceRun2.cxx b/Common/TableProducer/PID/pidTPCServiceRun2.cxx index e13908cd715..4ab83e917a2 100644 --- a/Common/TableProducer/PID/pidTPCServiceRun2.cxx +++ b/Common/TableProducer/PID/pidTPCServiceRun2.cxx @@ -19,35 +19,23 @@ // //=============================================================== -#include -#include -#include -#include -#include -// ROOT includes -#include "TFile.h" -#include "TRandom.h" -#include "TSystem.h" - -// O2 includes -#include "MetadataHelper.h" -#include "TableHelper.h" -#include "pidTPCBase.h" - -#include "Common/Core/PID/TPCPIDResponse.h" +#include "Common/Core/MetadataHelper.h" #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/PIDResponseTPC.h" #include "Common/Tools/PID/pidTPCModule.h" -#include "Tools/ML/model.h" - -#include "CCDB/BasicCCDBManager.h" -#include "CCDB/CcdbApi.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/Track.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/PID/pidTPCServiceRun3.cxx b/Common/TableProducer/PID/pidTPCServiceRun3.cxx index 1415ecee6bf..5902ed9c6c9 100644 --- a/Common/TableProducer/PID/pidTPCServiceRun3.cxx +++ b/Common/TableProducer/PID/pidTPCServiceRun3.cxx @@ -19,35 +19,23 @@ // //=============================================================== -#include -#include -#include -#include -#include -// ROOT includes -#include "TFile.h" -#include "TRandom.h" -#include "TSystem.h" - -// O2 includes -#include "MetadataHelper.h" -#include "TableHelper.h" -#include "pidTPCBase.h" - -#include "Common/Core/PID/TPCPIDResponse.h" +#include "Common/Core/MetadataHelper.h" #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/PIDResponseTPC.h" #include "Common/Tools/PID/pidTPCModule.h" -#include "Tools/ML/model.h" - -#include "CCDB/BasicCCDBManager.h" -#include "CCDB/CcdbApi.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/Track.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/caloClusterProducer.cxx b/Common/TableProducer/caloClusterProducer.cxx index 6b660ad4c68..5227b133335 100644 --- a/Common/TableProducer/caloClusterProducer.cxx +++ b/Common/TableProducer/caloClusterProducer.cxx @@ -14,11 +14,12 @@ /// /// \author Dmitri Peresunko +#include "Common/Core/RecoDecay.h" #include "Common/Core/trackUtilities.h" #include "Common/DataModel/CaloClusters.h" -#include "Common/DataModel/TrackSelectionTables.h" #include +#include #include #include #include @@ -29,18 +30,26 @@ #include #include #include +#include #include -#include +#include +#include #include #include #include #include #include +#include + #include +#include +#include +#include #include #include #include +#include #include using namespace o2::framework; diff --git a/Common/TableProducer/centralityTable.cxx b/Common/TableProducer/centralityTable.cxx index e83c41d00c1..d73c83f0ecf 100644 --- a/Common/TableProducer/centralityTable.cxx +++ b/Common/TableProducer/centralityTable.cxx @@ -15,25 +15,32 @@ /// \author ALICE // -#include "MetadataHelper.h" -#include "TableHelper.h" - +#include "Common/Core/MetadataHelper.h" +#include "Common/Core/TableHelper.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" #include #include +#include #include +#include +#include #include -#include +#include +#include +#include #include +#include #include -#include +#include #include #include +#include +#include #include #include #include diff --git a/Common/TableProducer/eseTableProducer.cxx b/Common/TableProducer/eseTableProducer.cxx index 098bfbe400f..877815873e8 100644 --- a/Common/TableProducer/eseTableProducer.cxx +++ b/Common/TableProducer/eseTableProducer.cxx @@ -14,30 +14,36 @@ /// /// \author Joachim C. K. B. Hansen +#include "FFitWeights.h" + +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EseTable.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/Qvectors.h" + #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include #include +#include +#include #include -#include -#include -#include #include #include - -#include "Framework/ASoA.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/runDataProcessing.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/HistogramRegistry.h" - -#include "Common/DataModel/EventSelection.h" -#include "Common/Core/TrackSelection.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" - -#include "Common/DataModel/EseTable.h" -#include "Common/DataModel/Qvectors.h" -#include "FFitWeights.h" +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/eventSelection.cxx b/Common/TableProducer/eventSelection.cxx index ee78a9d6f03..101dc04ab63 100644 --- a/Common/TableProducer/eventSelection.cxx +++ b/Common/TableProducer/eventSelection.cxx @@ -26,7 +26,6 @@ #include #include #include -#include // missing include in TimeDeadMap. #include #include #include diff --git a/Common/TableProducer/eventSelectionService.cxx b/Common/TableProducer/eventSelectionService.cxx index 58d529e5df4..834b1c28321 100644 --- a/Common/TableProducer/eventSelectionService.cxx +++ b/Common/TableProducer/eventSelectionService.cxx @@ -19,27 +19,26 @@ // //=============================================================== -#include "MetadataHelper.h" - -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/Core/MetadataHelper.h" +#include "Common/DataModel/EventSelection.h" #include "Common/Tools/EventSelectionModule.h" #include "Common/Tools/timestampModule.h" -#include "CCDB/BasicCCDBManager.h" -#include "CCDB/CcdbApi.h" -#include "CommonConstants/GeomConstants.h" -#include "CommonUtils/NameConf.h" -#include "DataFormatsCalibration/MeanVertexObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DetectorsBase/GeometryManager.h" -#include "DetectorsBase/Propagator.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/DCA.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/ft0CorrectedTable.cxx b/Common/TableProducer/ft0CorrectedTable.cxx index a8a2787aa5a..d3396544e6c 100644 --- a/Common/TableProducer/ft0CorrectedTable.cxx +++ b/Common/TableProducer/ft0CorrectedTable.cxx @@ -9,21 +9,30 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +#include "Common/Core/CollisionTypeHelper.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/FT0Corrected.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + #include +#include +#include #include -#include "Framework/ConfigParamSpec.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/HistogramRegistry.h" -#include "Common/DataModel/FT0Corrected.h" -#include "Common/DataModel/EventSelection.h" -#include "CommonConstants/LHCConstants.h" -#include "CommonConstants/PhysicsConstants.h" -#include "DataFormatsFT0/Digit.h" -#include "CCDB/BasicCCDBManager.h" -#include "CollisionTypeHelper.h" -#include "TRandom3.h" using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/fwdtrackToCollisionAssociator.cxx b/Common/TableProducer/fwdtrackToCollisionAssociator.cxx index 20d6e4c6a60..862cee97872 100644 --- a/Common/TableProducer/fwdtrackToCollisionAssociator.cxx +++ b/Common/TableProducer/fwdtrackToCollisionAssociator.cxx @@ -16,11 +16,13 @@ #include "Common/Core/CollisionAssociation.h" #include "Common/DataModel/CollisionAssociationTables.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "CommonConstants/LHCConstants.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" + +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/fwdtrackextension.cxx b/Common/TableProducer/fwdtrackextension.cxx index 4a78bf8de5f..c554b2c4fbf 100644 --- a/Common/TableProducer/fwdtrackextension.cxx +++ b/Common/TableProducer/fwdtrackextension.cxx @@ -13,19 +13,19 @@ // Task performing forward track DCA computation // -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "Common/Core/TrackSelection.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/Core/trackUtilities.h" -#include "ReconstructionDataFormats/DCA.h" -#include "DetectorsBase/Propagator.h" -#include "CommonUtils/NameConf.h" -#include "Math/SMatrix.h" -#include "ReconstructionDataFormats/TrackFwd.h" +#include +#include +#include +#include +#include +#include + +#include +#include + +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/match-mft-ft0.cxx b/Common/TableProducer/match-mft-ft0.cxx index a4b208a03c9..a6160cabe4b 100644 --- a/Common/TableProducer/match-mft-ft0.cxx +++ b/Common/TableProducer/match-mft-ft0.cxx @@ -9,41 +9,48 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -// \file match-mft-ft0.cxx -// \author Sarah Herrmann -// -// \brief This code loops over every MFT tracks (except orphan tracks) and propagates -// them to the FT0-C, matching the signals in some BC to reduce track ambiguity -// It produces a table containing for each MFT track a list of BCs with an FT0C match -// called aod::BCofMFT -// \date 03/09/24 - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" - -#include "MathUtils/Utils.h" -#include "CommonConstants/LHCConstants.h" -#include "Common/Core/trackUtilities.h" //for getTrackPar() -#include "ReconstructionDataFormats/TrackFwd.h" //for propagate -// https://github.com/AliceO2Group/AliceO2/blob/dev/DataFormats/Reconstruction/include/ReconstructionDataFormats/TrackFwd.h -#include "CommonConstants/LHCConstants.h" -#include "Math/MatrixFunctions.h" -#include "Math/SMatrix.h" - -#include "CCDB/BasicCCDBManager.h" -#include "CCDB/CcdbApi.h" - -#include "DataFormatsParameters/GRPMagField.h" -#include "DetectorsBase/GeometryManager.h" -#include "Field/MagneticField.h" -#include "TGeoGlobalMagField.h" - -#include "DataFormatsParameters/GRPMagField.h" -#include "DetectorsBase/GeometryManager.h" -#include "DetectorsBase/Propagator.h" +/// \file match-mft-ft0.cxx +/// \author Sarah Herrmann +/// +/// \brief This code loops over every MFT tracks (except orphan tracks) and propagates +/// them to the FT0-C, matching the signals in some BC to reduce track ambiguity +/// It produces a table containing for each MFT track a list of BCs with an FT0C match +/// called aod::BCofMFT +/// \date 03/09/24 +/// \note https://github.com/AliceO2Group/AliceO2/blob/dev/DataFormats/Reconstruction/include/ReconstructionDataFormats/TrackFwd.h #include "Common/DataModel/MatchMFTFT0.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include //for propagate + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + using SMatrix55 = ROOT::Math::SMatrix>; using SMatrix5 = ROOT::Math::SVector; diff --git a/Common/TableProducer/match-mft-mch-data-mc.cxx b/Common/TableProducer/match-mft-mch-data-mc.cxx index 11d59611772..2e801bc4040 100644 --- a/Common/TableProducer/match-mft-mch-data-mc.cxx +++ b/Common/TableProducer/match-mft-mch-data-mc.cxx @@ -8,30 +8,46 @@ // 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. + +#include "Common/DataModel/MatchMFTFT0.h" +#include "Common/DataModel/MatchMFTMuonData.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include #include #include -#include #include #include -#include "CCDB/BasicCCDBManager.h" -#include "Common/DataModel/MatchMFTFT0.h" -#include "Common/DataModel/MatchMFTMuonData.h" -#include "DataFormatsGlobalTracking/RecoContainer.h" -#include "Common/DataModel/CollisionAssociationTables.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "Field/MagneticField.h" -#include "TGeoGlobalMagField.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "MCHTracking/TrackExtrap.h" -#include "GlobalTracking/MatchGlobalFwd.h" -#include "Math/SMatrix.h" -#include "Math/SVector.h" -#include "TLorentzVector.h" -#include "TVector2.h" -#include "TDatabasePDG.h" - using namespace std; using namespace o2; @@ -40,12 +56,6 @@ using namespace o2::aod; using namespace o2::framework; using namespace o2::framework::expressions; -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/DataTypes.h" -#include "Framework/runDataProcessing.h" - using MyCollisions = aod::Collisions; using MyBCs = soa::Join; using MyMUONs = soa::Join; @@ -624,7 +634,7 @@ struct match_mft_mch_data_mc { return; mRunNumber = bc.runNumber(); - std::map metadata; + std::map metadata; auto soreor = o2::ccdb::BasicCCDBManager::getRunDuration(ccdbApi, mRunNumber); auto ts = soreor.first; auto grpmag = ccdbApi.retrieveFromTFileAny(grpmagPath, metadata, ts); diff --git a/Common/TableProducer/match-mft-mch-data.cxx b/Common/TableProducer/match-mft-mch-data.cxx index 96471ddefab..9541af4d5cc 100644 --- a/Common/TableProducer/match-mft-mch-data.cxx +++ b/Common/TableProducer/match-mft-mch-data.cxx @@ -8,30 +8,46 @@ // 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. + +#include "Common/DataModel/MatchMFTFT0.h" +#include "Common/DataModel/MatchMFTMuonData.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include #include #include -#include #include #include -#include "CCDB/BasicCCDBManager.h" -#include "Common/DataModel/MatchMFTFT0.h" -#include "Common/DataModel/MatchMFTMuonData.h" -#include "DataFormatsGlobalTracking/RecoContainer.h" -#include "Common/DataModel/CollisionAssociationTables.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "Field/MagneticField.h" -#include "TGeoGlobalMagField.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "MCHTracking/TrackExtrap.h" -#include "GlobalTracking/MatchGlobalFwd.h" -#include "Math/SMatrix.h" -#include "Math/SVector.h" -#include "TLorentzVector.h" -#include "TVector2.h" -#include "TDatabasePDG.h" - using namespace std; using namespace o2; @@ -40,12 +56,6 @@ using namespace o2::aod; using namespace o2::framework; using namespace o2::framework::expressions; -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/DataTypes.h" -#include "Framework/runDataProcessing.h" - using MyCollisions = aod::Collisions; using MyBCs = soa::Join; using MyMUONs = soa::Join; @@ -624,7 +634,7 @@ struct match_mft_mch_data_mc { return; mRunNumber = bc.runNumber(); - std::map metadata; + std::map metadata; auto soreor = o2::ccdb::BasicCCDBManager::getRunDuration(ccdbApi, mRunNumber); auto ts = soreor.first; auto grpmag = ccdbApi.retrieveFromTFileAny(grpmagPath, metadata, ts); diff --git a/Common/TableProducer/mcCollsExtra.cxx b/Common/TableProducer/mcCollsExtra.cxx index 452930494ba..b975e0d335e 100644 --- a/Common/TableProducer/mcCollsExtra.cxx +++ b/Common/TableProducer/mcCollsExtra.cxx @@ -12,39 +12,25 @@ // Quick and dirty task to correlate MC <-> data // +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/McCollisionExtra.h" +#include "Common/DataModel/Multiplicity.h" + +#include +#include +#include +#include +#include + +#include #include #include +#include #include +#include +#include #include -#include "Math/Vector4D.h" -#include -#include -#include -#include -#include -#include - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "ReconstructionDataFormats/Track.h" -#include "Common/DataModel/McCollisionExtra.h" -#include "Common/Core/RecoDecay.h" -#include "Common/Core/trackUtilities.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/DataModel/LFParticleIdentification.h" -#include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Centrality.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "CCDB/BasicCCDBManager.h" - using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; diff --git a/Common/TableProducer/mftmchMatchingML.cxx b/Common/TableProducer/mftmchMatchingML.cxx index 4df90bbfdd1..9a5091d3eb9 100644 --- a/Common/TableProducer/mftmchMatchingML.cxx +++ b/Common/TableProducer/mftmchMatchingML.cxx @@ -9,31 +9,42 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include -#include -#include -#include -#include #include "Common/DataModel/MftmchMatchingML.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "Framework/ASoAHelpers.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/CCDB/EventSelectionParams.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/Core/trackUtilities.h" -#include "Common/Core/TrackSelection.h" -#include "ReconstructionDataFormats/TrackFwd.h" -#include "Math/SMatrix.h" -#include "DetectorsBase/Propagator.h" -#include "MFTTracking/Tracker.h" -#include "MCHTracking/TrackParam.h" -#include "MCHTracking/TrackExtrap.h" -#include "GlobalTracking/MatchGlobalFwd.h" -#include "CCDB/CcdbApi.h" + #include "Tools/ML/model.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include // FIXME: Replace M_PI + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; diff --git a/Common/TableProducer/multCentTable.cxx b/Common/TableProducer/multCentTable.cxx index 1bbf3dcd48d..a8bfa50ee9d 100644 --- a/Common/TableProducer/multCentTable.cxx +++ b/Common/TableProducer/multCentTable.cxx @@ -20,33 +20,28 @@ // //=============================================================== -#include "MetadataHelper.h" +#include "PWGMM/Mult/DataModel/bestCollisionTable.h" -#include "Common/Core/trackUtilities.h" +#include "Common/Core/MetadataHelper.h" +#include "Common/DataModel/EventSelection.h" #include "Common/DataModel/TrackSelectionTables.h" #include "Common/Tools/Multiplicity/MultModule.h" -#include "Common/Tools/StandardCCDBLoader.h" -#include "Common/Tools/TrackPropagationModule.h" - -#include "CCDB/BasicCCDBManager.h" -#include "CCDB/CcdbApi.h" -#include "CommonConstants/GeomConstants.h" -#include "CommonUtils/NameConf.h" -#include "DataFormatsCalibration/MeanVertexObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DetectorsBase/GeometryManager.h" -#include "DetectorsBase/Propagator.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/DCA.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include using namespace o2; using namespace o2::framework; -// using namespace o2::framework::expressions; o2::common::core::MetadataHelper metadataInfo; // Metadata helper diff --git a/Common/TableProducer/multiplicityExtraTable.cxx b/Common/TableProducer/multiplicityExtraTable.cxx index 5b0840e5f2d..949d461298d 100644 --- a/Common/TableProducer/multiplicityExtraTable.cxx +++ b/Common/TableProducer/multiplicityExtraTable.cxx @@ -8,20 +8,30 @@ // 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. -#include // megalinter thinks this is a C header... -#include -#include "Framework/ConfigParamSpec.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" -#include "DataFormatsFIT/Triggers.h" -#include "TableHelper.h" -#include "CCDB/CcdbApi.h" -#include "CommonDataFormat/BunchFilling.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPLHCIFData.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/multiplicityTable.cxx b/Common/TableProducer/multiplicityTable.cxx index efbb87908d2..53882bb9d77 100644 --- a/Common/TableProducer/multiplicityTable.cxx +++ b/Common/TableProducer/multiplicityTable.cxx @@ -24,21 +24,35 @@ #include "Common/DataModel/TrackSelectionTables.h" #include -#include #include +#include #include -#include +#include +#include +#include #include +#include +#include #include +#include #include #include +#include +#include #include +#include +#include +#include +#include +#include #include #include #include +#include + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; diff --git a/Common/TableProducer/muonRealignment.cxx b/Common/TableProducer/muonRealignment.cxx index 58745af69a6..3fa9b462c0f 100644 --- a/Common/TableProducer/muonRealignment.cxx +++ b/Common/TableProducer/muonRealignment.cxx @@ -13,33 +13,40 @@ /// \brief Task for muon re-alignment at analysis level /// \author Chi Zhang , CEA-Saclay -#include -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "Framework/ASoAHelpers.h" - -#include "CCDB/BasicCCDBManager.h" -#include "CCDB/CCDBTimeStampUtils.h" -#include "CommonUtils/NameConf.h" -#include "CommonUtils/ConfigurableParam.h" -#include "DataFormatsMCH/Cluster.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DetectorsBase/GeometryManager.h" -#include "DetectorsBase/GRPGeomHelper.h" -#include "DetectorsBase/Propagator.h" -#include "MathUtils/Cartesian.h" -#include "MCHGeometryTransformer/Transformations.h" -#include "MCHTracking/Track.h" -#include "MCHTracking/TrackExtrap.h" -#include "MCHTracking/TrackParam.h" -#include "MCHTracking/TrackFitter.h" -#include "MCHBase/TrackerParam.h" -#include "GlobalTracking/MatchGlobalFwd.h" -#include "ReconstructionDataFormats/TrackFwd.h" #include "Common/DataModel/FwdTrackReAlignTables.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/CollisionAssociationTables.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include using namespace std; using namespace o2; diff --git a/Common/TableProducer/occupancyTableProducer.cxx b/Common/TableProducer/occupancyTableProducer.cxx index a700b394772..bfa41fcd87b 100644 --- a/Common/TableProducer/occupancyTableProducer.cxx +++ b/Common/TableProducer/occupancyTableProducer.cxx @@ -15,31 +15,35 @@ /// Ambg tracks were not used /// \author Rahul Verma (rahul.verma@iitb.ac.in) :: Marian I Ivanov (marian.ivanov@cern.ch) -#include -#include -#include -#include -#include - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/O2DatabasePDGPlugin.h" - -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/PIDResponse.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Centrality.h" #include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/OccupancyTables.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -#include "Common/DataModel/OccupancyTables.h" +#include + +#include -#include "Framework/AnalysisDataModel.h" -#include "Framework/HistogramRegistry.h" -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsFT0/Digit.h" -#include "DataFormatsParameters/GRPLHCIFData.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/qVectorsTable.cxx b/Common/TableProducer/qVectorsTable.cxx index 9b6189ef121..d1d39acf3d4 100644 --- a/Common/TableProducer/qVectorsTable.cxx +++ b/Common/TableProducer/qVectorsTable.cxx @@ -19,7 +19,6 @@ /// #include "Common/Core/EventPlaneHelper.h" -#include "Common/Core/TrackSelection.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/FT0Corrected.h" @@ -28,16 +27,29 @@ #include "Common/DataModel/TrackSelectionTables.h" #include +#include #include +#include +#include #include +#include #include +#include +#include +#include +#include +#include +#include #include #include #include -#include +#include +#include #include +#include +#include #include #include #include diff --git a/Common/TableProducer/selectionStudyTable.cxx b/Common/TableProducer/selectionStudyTable.cxx index 4d27e358ed1..bd7febf9bb9 100644 --- a/Common/TableProducer/selectionStudyTable.cxx +++ b/Common/TableProducer/selectionStudyTable.cxx @@ -17,17 +17,14 @@ #include "Common/DataModel/SelectionStudyTables.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/ConfigParamSpec.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "Framework/runDataProcessing.h" +#include +#include +#include +#include +#include -#include -#include -#include +#include +#include #include using namespace o2; diff --git a/Common/TableProducer/timestamp.cxx b/Common/TableProducer/timestamp.cxx index 40ab7000772..30ad84150c5 100644 --- a/Common/TableProducer/timestamp.cxx +++ b/Common/TableProducer/timestamp.cxx @@ -16,14 +16,25 @@ /// \brief A task to fill the timestamp table from run number. /// Uses headers from CCDB /// -#include +#include "Common/Core/MetadataHelper.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include #include -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "CCDB/BasicCCDBManager.h" -#include "CommonDataFormat/InteractionRecord.h" -#include "DetectorsRaw/HBFUtils.h" -#include "MetadataHelper.h" +#include +#include +#include using namespace o2::framework; using namespace o2::header; @@ -32,15 +43,15 @@ using namespace o2; o2::common::core::MetadataHelper metadataInfo; // Metadata helper struct TimestampTask { - Produces timestampTable; /// Table with SOR timestamps produced by the task - Service ccdb; /// CCDB manager to access orbit-reset timestamp - o2::ccdb::CcdbApi ccdb_api; /// API to access CCDB headers + Produces timestampTable; /// Table with SOR timestamps produced by the task + Service ccdb; /// CCDB manager to access orbit-reset timestamp + o2::ccdb::CcdbApi ccdb_api; /// API to access CCDB headers Configurable fatalOnInvalidTimestamp{"fatalOnInvalidTimestamp", false, "Generate fatal error for invalid timestamps"}; - std::map mapRunToOrbitReset; /// Cache of orbit reset timestamps + std::map mapRunToOrbitReset; /// Cache of orbit reset timestamps std::map> mapRunToRunDuration; /// Cache of run duration timestamps - int lastRunNumber = 0; /// Last run number processed - int64_t orbitResetTimestamp = 0; /// Orbit-reset timestamp in us - std::pair runDuration; /// Pair of SOR and EOR timestamps + int lastRunNumber = 0; /// Last run number processed + int64_t orbitResetTimestamp = 0; /// Orbit-reset timestamp in us + std::pair runDuration; /// Pair of SOR and EOR timestamps // Configurables Configurable verbose{"verbose", false, "verbose mode"}; diff --git a/Common/TableProducer/trackDcaCovFillerRun2.cxx b/Common/TableProducer/trackDcaCovFillerRun2.cxx index d07833ae9e0..7fb77b96c87 100644 --- a/Common/TableProducer/trackDcaCovFillerRun2.cxx +++ b/Common/TableProducer/trackDcaCovFillerRun2.cxx @@ -15,12 +15,35 @@ // Run 2 AO2Ds cannot have their dcacov filled by the current track-propagation workflow as the workflow isn't designed for them, given Run 2 tracks are already propagated to the PV. // This task fills the DCA Cov (and DCA) tables for Run 2 tracks by "propagating" the tracks (though given they are already at the PV it doesn't actually do the propagation) and retrieving the DCA and DCA cov given by the propagateToDCABxByBz function +#include "Common/Core/TableHelper.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include #include -#include "TableHelper.h" -#include "Common/Tools/TrackTuner.h" -#include "DataFormatsParameters/GRPObject.h" - using namespace o2; using namespace o2::framework; // using namespace o2::framework::expressions; diff --git a/Common/TableProducer/trackPropagation.cxx b/Common/TableProducer/trackPropagation.cxx index e1b6528ce53..703265a8dab 100644 --- a/Common/TableProducer/trackPropagation.cxx +++ b/Common/TableProducer/trackPropagation.cxx @@ -13,9 +13,41 @@ // Task to add a table of track parameters propagated to the primary vertex // -#include "TableHelper.h" +#include "Common/Core/TableHelper.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/TrackSelectionTables.h" #include "Common/Tools/TrackTuner.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + // The Run 3 AO2D stores the tracks at the point of innermost update. For a track with ITS this is the innermost (or second innermost) // ITS layer. For a track without ITS, this is the TPC inner wall or for loopers in the TPC even a radius beyond that. // In order to use the track parameters, the tracks have to be propagated to the collision vertex which is done by this task. diff --git a/Common/TableProducer/trackToCollisionAssociator.cxx b/Common/TableProducer/trackToCollisionAssociator.cxx index 62d90edaa9f..f789c250cac 100644 --- a/Common/TableProducer/trackToCollisionAssociator.cxx +++ b/Common/TableProducer/trackToCollisionAssociator.cxx @@ -18,9 +18,13 @@ #include "Common/Core/CollisionAssociation.h" #include "Common/DataModel/CollisionAssociationTables.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" + +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/trackextension.cxx b/Common/TableProducer/trackextension.cxx index 210f9adc122..e17965c1ed1 100644 --- a/Common/TableProducer/trackextension.cxx +++ b/Common/TableProducer/trackextension.cxx @@ -13,18 +13,23 @@ // Task performing basic track selection. // -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/Multiplicity.h" #include "Common/Core/trackUtilities.h" -#include "ReconstructionDataFormats/DCA.h" -#include "DetectorsBase/Propagator.h" -#include "CommonUtils/NameConf.h" -#include "DataFormatsParameters/GRPObject.h" +#include "Common/DataModel/TrackSelectionTables.h" + #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/trackselection.cxx b/Common/TableProducer/trackselection.cxx index 142ae81a2e1..47b5cb3087b 100644 --- a/Common/TableProducer/trackselection.cxx +++ b/Common/TableProducer/trackselection.cxx @@ -21,13 +21,18 @@ #include "Common/Core/TableHelper.h" #include "Common/Core/TrackSelectionDefaults.h" -#include "Common/Core/trackUtilities.h" #include "Common/DataModel/TrackSelectionTables.h" #include +#include #include +#include +#include +#include #include +#include + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; diff --git a/Common/TableProducer/weakDecayIndices.cxx b/Common/TableProducer/weakDecayIndices.cxx index b2937e1c8a5..0c9a33345bc 100644 --- a/Common/TableProducer/weakDecayIndices.cxx +++ b/Common/TableProducer/weakDecayIndices.cxx @@ -8,9 +8,10 @@ // 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. -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" +#include +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/TableProducer/zdcTaskInterCalib.cxx b/Common/TableProducer/zdcTaskInterCalib.cxx index 78054580b81..5cf5b83725f 100644 --- a/Common/TableProducer/zdcTaskInterCalib.cxx +++ b/Common/TableProducer/zdcTaskInterCalib.cxx @@ -13,19 +13,24 @@ /// \brief Task for ZDC tower inter-calibration /// \author chiara.oppedisano@cern.ch -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" -#include "Common/DataModel/EventSelection.h" #include "Common/CCDB/EventSelectionParams.h" -#include "Common/CCDB/TriggerAliases.h" #include "Common/DataModel/Centrality.h" -#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/EventSelection.h" #include "Common/DataModel/ZDCInterCalib.h" -#include "TH1F.h" -#include "TH2F.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include using namespace o2; using namespace o2::framework; diff --git a/Common/Tasks/centralityQa.cxx b/Common/Tasks/centralityQa.cxx index 9e39194415c..51dc8875e08 100644 --- a/Common/Tasks/centralityQa.cxx +++ b/Common/Tasks/centralityQa.cxx @@ -8,13 +8,19 @@ // 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. -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/EventSelection.h" +#include "Common/CCDB/TriggerAliases.h" #include "Common/DataModel/Centrality.h" -#include "TH1F.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" + +#include +#include +#include +#include +#include + +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/Tasks/centralityStudy.cxx b/Common/Tasks/centralityStudy.cxx index 46166ddc0d7..a8765e488fc 100644 --- a/Common/Tasks/centralityStudy.cxx +++ b/Common/Tasks/centralityStudy.cxx @@ -13,24 +13,33 @@ // Run 3 Pb-Pb centrality selections in 2023 data. It is compatible with // derived data. +#include "EventSelectionParams.h" + #include "Common/CCDB/ctpRateFetcher.h" #include "Common/DataModel/Centrality.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/McCollisionExtra.h" #include "Common/DataModel/Multiplicity.h" -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPECSObject.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "Framework/runDataProcessing.h" - -#include "TH1F.h" -#include "TH2F.h" -#include "TProfile.h" - +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include #include +#include #include using namespace o2; diff --git a/Common/Tasks/checkDataModel.cxx b/Common/Tasks/checkDataModel.cxx index 33b059e870b..b5432bd76fa 100644 --- a/Common/Tasks/checkDataModel.cxx +++ b/Common/Tasks/checkDataModel.cxx @@ -13,10 +13,19 @@ /// \author /// \since -#include "Framework/ConfigParamSpec.h" +#include +#include +#include +#include +#include + +#include + +#include using namespace o2; using namespace o2::framework; +using namespace o2::framework::expressions; // custom configurable for switching between run2 and run3 selection types void customize(std::vector& workflowOptions) @@ -25,9 +34,7 @@ void customize(std::vector& workflowOptions) // workflowOptions.push_back(ConfigParamSpec{"isMC", VariantType::Bool, false, {"Check also MC tables if set"}}); } -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -using namespace o2::framework::expressions; +#include template struct LoadTable { diff --git a/Common/Tasks/checkDataModelMC.cxx b/Common/Tasks/checkDataModelMC.cxx index c8c0ecdda62..612f2b8da1e 100644 --- a/Common/Tasks/checkDataModelMC.cxx +++ b/Common/Tasks/checkDataModelMC.cxx @@ -13,9 +13,18 @@ /// \author /// \since +#include +#include #include +#include +#include +#include +#include +#include #include +#include + #include #include diff --git a/Common/Tasks/cpvQa.cxx b/Common/Tasks/cpvQa.cxx index e549d89e33d..d6d41fa7cac 100644 --- a/Common/Tasks/cpvQa.cxx +++ b/Common/Tasks/cpvQa.cxx @@ -13,9 +13,21 @@ /// \author Sergey Evdokimov /// \since 25.10.2022 -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/StaticFor.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include using namespace o2; using namespace o2::framework; diff --git a/Common/Tasks/flowTest.cxx b/Common/Tasks/flowTest.cxx index bb27c0cc504..bfb42acff04 100644 --- a/Common/Tasks/flowTest.cxx +++ b/Common/Tasks/flowTest.cxx @@ -13,28 +13,30 @@ // cross-PWG effort in tracking studies // includes basic tracking, V0s and Cascades -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/TrackSelectionDefaults.h" -#include "ReconstructionDataFormats/Track.h" -#include "Common/Core/trackUtilities.h" -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" #include "PWGLF/DataModel/LFStrangenessTables.h" - #include "PWGMM/Mult/DataModel/Index.h" // for Particles2Tracks table +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; #define bitcheck(var, nbit) ((var) & (1 << (nbit))) -#include "Framework/runDataProcessing.h" +#include struct flowTest { HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; diff --git a/Common/Tasks/ft0Qa.cxx b/Common/Tasks/ft0Qa.cxx index f7dcb8d75c4..7b7857a9ba3 100644 --- a/Common/Tasks/ft0Qa.cxx +++ b/Common/Tasks/ft0Qa.cxx @@ -9,16 +9,22 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/FT0Corrected.h" #include "Common/DataModel/Multiplicity.h" -#include "DataFormatsFT0/Digit.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "TH1F.h" -#include "TH2F.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/Tasks/integrationTest.cxx b/Common/Tasks/integrationTest.cxx index 04e0ad4778e..c3915100f2a 100644 --- a/Common/Tasks/integrationTest.cxx +++ b/Common/Tasks/integrationTest.cxx @@ -15,23 +15,28 @@ // // Includes further QA if option enabled -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/TrackSelectionDefaults.h" -#include "ReconstructionDataFormats/Track.h" -#include "Common/Core/trackUtilities.h" -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -#include "Framework/runDataProcessing.h" +#include using FullTracksIU = soa::Join; diff --git a/Common/Tasks/integrationTestCCDB.cxx b/Common/Tasks/integrationTestCCDB.cxx index 33dbc6dd3e4..c7096d5774c 100644 --- a/Common/Tasks/integrationTestCCDB.cxx +++ b/Common/Tasks/integrationTestCCDB.cxx @@ -22,26 +22,30 @@ // // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/TrackSelectionDefaults.h" -#include "ReconstructionDataFormats/Track.h" -#include "Common/Core/trackUtilities.h" -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -#include "Framework/runDataProcessing.h" - struct integrationTestCCDB { // this is anyway what this is all about Service ccdb; diff --git a/Common/Tasks/multiplicityDerivedQa.cxx b/Common/Tasks/multiplicityDerivedQa.cxx index 78f229fa2d6..1d1f77e51b9 100644 --- a/Common/Tasks/multiplicityDerivedQa.cxx +++ b/Common/Tasks/multiplicityDerivedQa.cxx @@ -12,15 +12,21 @@ // This code does QA based on a saved derived dataset using the // tables provided by multiplicityTable. -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Common/DataModel/McCollisionExtra.h" #include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/EventSelection.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "TH1F.h" -#include "TH2F.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include using namespace o2; using namespace o2::framework; diff --git a/Common/Tasks/multiplicityQa.cxx b/Common/Tasks/multiplicityQa.cxx index 3fc2374c2cc..2178164854c 100644 --- a/Common/Tasks/multiplicityQa.cxx +++ b/Common/Tasks/multiplicityQa.cxx @@ -22,15 +22,24 @@ // - david.dobrigkeit.chinellato@cern.ch // -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" +#include "Common/DataModel/EventSelection.h" #include "Common/DataModel/McCollisionExtra.h" #include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/EventSelection.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "TH1F.h" -#include "TH2F.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include using namespace o2; using namespace o2::framework; diff --git a/Common/Tasks/orbitRangeTask.cxx b/Common/Tasks/orbitRangeTask.cxx index 250751c25ba..2db5ac27d6b 100644 --- a/Common/Tasks/orbitRangeTask.cxx +++ b/Common/Tasks/orbitRangeTask.cxx @@ -11,12 +11,17 @@ // This task finds minimum and maximum orbit among all processed bcs -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "CommonConstants/LHCConstants.h" #include "OrbitRange.h" -#include "TMath.h" + +#include +#include +#include +#include +#include + +#include + +#include using namespace o2; using namespace o2::framework; diff --git a/Common/Tasks/propagatorQa.cxx b/Common/Tasks/propagatorQa.cxx index 3a426d2cf09..dcdd50b87ce 100644 --- a/Common/Tasks/propagatorQa.cxx +++ b/Common/Tasks/propagatorQa.cxx @@ -14,8 +14,6 @@ // Work in progress! More to follow, use at your own peril // -#include "Common/Core/TrackSelection.h" -#include "Common/Core/TrackSelectionDefaults.h" #include "Common/Core/trackUtilities.h" #include "Common/DataModel/TrackSelectionTables.h" #include "Common/Tools/trackSelectionRequest.h" @@ -24,13 +22,26 @@ #include #include #include +#include #include #include +#include #include +#include +#include #include +#include +#include +#include #include +#include #include +#include +#include + +#include +#include #include using namespace o2; diff --git a/Common/Tasks/qVectorsCorrection.cxx b/Common/Tasks/qVectorsCorrection.cxx index 2d3c5c78804..37636ce369d 100644 --- a/Common/Tasks/qVectorsCorrection.cxx +++ b/Common/Tasks/qVectorsCorrection.cxx @@ -18,31 +18,30 @@ /// // C++/ROOT includes. -#include +#include +#include + +#include + #include #include -#include -#include -#include -#include -#include // o2Physics includes. -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/StaticFor.h" - -#include "Common/DataModel/Qvectors.h" +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/Core/EventPlaneHelper.h" #include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Qvectors.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "Common/Core/EventPlaneHelper.h" -#include "Common/Core/TrackSelection.h" -#include "CommonConstants/PhysicsConstants.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include // o2 includes. diff --git a/Common/Tasks/qaMuon.cxx b/Common/Tasks/qaMuon.cxx index 8ef5a42f824..2aef776035a 100644 --- a/Common/Tasks/qaMuon.cxx +++ b/Common/Tasks/qaMuon.cxx @@ -13,45 +13,70 @@ /// \author Paul Veen /// \author Chi Zhang -#include "Common/DataModel/CollisionAssociationTables.h" #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/FwdTrackReAlignTables.h" - -#include "CCDB/BasicCCDBManager.h" -#include "CCDB/CCDBTimeStampUtils.h" -#include "CommonUtils/ConfigurableParam.h" -#include "CommonUtils/NameConf.h" -#include "DataFormatsMCH/Cluster.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DetectorsBase/GRPGeomHelper.h" -#include "DetectorsBase/GeometryManager.h" -#include "DetectorsBase/Propagator.h" -#include "Field/MagneticField.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "GlobalTracking/MatchGlobalFwd.h" -#include "MCHBase/TrackerParam.h" -#include "MCHGeometryTransformer/Transformations.h" -#include "MCHTracking/Track.h" -#include "MCHTracking/TrackExtrap.h" -#include "MCHTracking/TrackFitter.h" -#include "MCHTracking/TrackParam.h" -#include "MathUtils/Cartesian.h" -#include "ReconstructionDataFormats/TrackFwd.h" - -#include "Math/Vector4D.h" -#include "TGeoGlobalMagField.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include // IWYU pragma: keep (do not replace with Math/Vector4Dfwd.h) +#include +#include +#include +#include +#include +#include + +#include + +#include #include +#include #include +#include +#include +#include +#include +#include +#include #include +#include #include +#include #include #include +#include // FIXME: Replace M_PI + using namespace std; using namespace o2; using namespace o2::aod; diff --git a/Common/Tasks/trackqa.cxx b/Common/Tasks/trackqa.cxx index 788fba7e29b..e445ba65336 100644 --- a/Common/Tasks/trackqa.cxx +++ b/Common/Tasks/trackqa.cxx @@ -31,7 +31,7 @@ #include // std::swap #include -#include +#include // FIXME: Replace M_PI using namespace o2; using namespace o2::framework; diff --git a/Common/Tasks/validation.cxx b/Common/Tasks/validation.cxx index 5c464aebb30..b6afe11f2f2 100644 --- a/Common/Tasks/validation.cxx +++ b/Common/Tasks/validation.cxx @@ -8,18 +8,14 @@ // 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. -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "ReconstructionDataFormats/Track.h" +#include +#include +#include +#include + +#include -#include -#include #include -#include -namespace o2::aod -{ -} // namespace o2::aod using namespace o2; using namespace o2::framework; diff --git a/Common/Tools/EventSelectionModule.h b/Common/Tools/EventSelectionModule.h index 741eb60b51e..5a7c46d3cc7 100644 --- a/Common/Tools/EventSelectionModule.h +++ b/Common/Tools/EventSelectionModule.h @@ -13,15 +13,12 @@ /// \brief /// \author ALICE -#ifndef COMMON_TOOLS_EVENTSELECTIONTOOLS_H_ -#define COMMON_TOOLS_EVENTSELECTIONTOOLS_H_ - -#define bitcheck(var, nbit) ((var) & (static_cast(1) << (nbit))) -#define bitcheck64(var, nbit) ((var) & (static_cast(1) << (nbit))) +#ifndef COMMON_TOOLS_EVENTSELECTIONMODULE_H_ +#define COMMON_TOOLS_EVENTSELECTIONMODULE_H_ #include "Common/CCDB/EventSelectionParams.h" +#include "Common/CCDB/RCTSelectionFlags.h" #include "Common/CCDB/TriggerAliases.h" -#include "Common/Core/MetadataHelper.h" #include "Common/Core/TableHelper.h" #include "Common/DataModel/EventSelection.h" @@ -30,25 +27,40 @@ #include #include #include -#include // missing include in TimeDeadMap.h #include #include -#include #include #include +#include #include +#include +#include #include #include -#include +#include +#include +#include +#include + +#include +#include + +#include +#include #include +#include #include +#include #include #include -#include #include +#include #include +#define bitcheck(var, nbit) ((var) & (static_cast(1) << (nbit))) +#define bitcheck64(var, nbit) ((var) & (static_cast(1) << (nbit))) + //__________________________________________ // MultModule @@ -1802,4 +1814,4 @@ class LumiModule } // namespace common } // namespace o2 -#endif // COMMON_TOOLS_EVENTSELECTIONTOOLS_H_ +#endif // COMMON_TOOLS_EVENTSELECTIONMODULE_H_ diff --git a/Common/Tools/Multiplicity/MultModule.h b/Common/Tools/Multiplicity/MultModule.h index f3122106de4..d2faac6ca16 100644 --- a/Common/Tools/Multiplicity/MultModule.h +++ b/Common/Tools/Multiplicity/MultModule.h @@ -13,28 +13,33 @@ /// \brief combined multiplicity + centrality module with autodetect features /// \author ALICE -#ifndef COMMON_TOOLS_MULTMODULE_H_ -#define COMMON_TOOLS_MULTMODULE_H_ +#ifndef COMMON_TOOLS_MULTIPLICITY_MULTMODULE_H_ +#define COMMON_TOOLS_MULTIPLICITY_MULTMODULE_H_ -#include "PWGMM/Mult/DataModel/bestCollisionTable.h" - -#include "Common/Core/TPCVDriftManager.h" -#include "Common/Core/TableHelper.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/Multiplicity.h" #include #include +#include #include -#include +#include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include -#include #include +#include #include #include -#include #include #include @@ -1434,4 +1439,4 @@ class MultModule } // namespace common } // namespace o2 -#endif // COMMON_TOOLS_MULTMODULE_H_ +#endif // COMMON_TOOLS_MULTIPLICITY_MULTMODULE_H_ diff --git a/Common/Tools/Multiplicity/multCalibrator.cxx b/Common/Tools/Multiplicity/multCalibrator.cxx index 7d3f4e51019..e54a3d5a0aa 100644 --- a/Common/Tools/Multiplicity/multCalibrator.cxx +++ b/Common/Tools/Multiplicity/multCalibrator.cxx @@ -18,17 +18,17 @@ // #include "multCalibrator.h" -#include -#include #include #include -#include -#include +#include #include -#include -#include -#include +#include +#include +#include +#include + +#include #include // FIXME using namespace std; diff --git a/Common/Tools/Multiplicity/multCalibrator.h b/Common/Tools/Multiplicity/multCalibrator.h index 1ad8839a1f1..a4e38ae1fd2 100644 --- a/Common/Tools/Multiplicity/multCalibrator.h +++ b/Common/Tools/Multiplicity/multCalibrator.h @@ -19,11 +19,14 @@ #ifndef COMMON_TOOLS_MULTIPLICITY_MULTCALIBRATOR_H_ #define COMMON_TOOLS_MULTIPLICITY_MULTCALIBRATOR_H_ -#include +#include #include +#include + +#include +#include #include -#include class multCalibrator : public TNamed { diff --git a/Common/Tools/Multiplicity/multGlauberNBDFitter.cxx b/Common/Tools/Multiplicity/multGlauberNBDFitter.cxx index dbdefd874d4..85c86e808fd 100644 --- a/Common/Tools/Multiplicity/multGlauberNBDFitter.cxx +++ b/Common/Tools/Multiplicity/multGlauberNBDFitter.cxx @@ -30,11 +30,19 @@ #include #include #include -#include +#include +#include +#include +#include +#include +#include #include #include #include +#include +#include + #include // FIXME using namespace std; diff --git a/Common/Tools/Multiplicity/multGlauberNBDFitter.h b/Common/Tools/Multiplicity/multGlauberNBDFitter.h index 951be39bd50..218caf43fc3 100644 --- a/Common/Tools/Multiplicity/multGlauberNBDFitter.h +++ b/Common/Tools/Multiplicity/multGlauberNBDFitter.h @@ -14,12 +14,13 @@ #include #include -#include #include #include #include +#include -#include +#include +#include class multGlauberNBDFitter : public TNamed { diff --git a/Common/Tools/Multiplicity/multMCCalibrator.cxx b/Common/Tools/Multiplicity/multMCCalibrator.cxx index 7e93e9b023e..be3bd71596f 100644 --- a/Common/Tools/Multiplicity/multMCCalibrator.cxx +++ b/Common/Tools/Multiplicity/multMCCalibrator.cxx @@ -20,16 +20,15 @@ #include "multCalibrator.h" -#include -#include #include #include #include -#include -#include #include +#include #include -#include +#include + +#include #include // FIXME diff --git a/Common/Tools/Multiplicity/multMCCalibrator.h b/Common/Tools/Multiplicity/multMCCalibrator.h index 7d355146728..c89fe728328 100644 --- a/Common/Tools/Multiplicity/multMCCalibrator.h +++ b/Common/Tools/Multiplicity/multMCCalibrator.h @@ -20,12 +20,13 @@ #define COMMON_TOOLS_MULTIPLICITY_MULTMCCALIBRATOR_H_ #include -#include +#include #include #include +#include -#include // FIXME -#include +#include +#include class multMCCalibrator : public TNamed { diff --git a/Common/Tools/PID/checkPidPacking.cxx b/Common/Tools/PID/checkPidPacking.cxx index 84f72c4f48c..dc497240ef3 100644 --- a/Common/Tools/PID/checkPidPacking.cxx +++ b/Common/Tools/PID/checkPidPacking.cxx @@ -16,13 +16,18 @@ /// \since 03/05/2024 /// -#include - #include "Common/DataModel/PIDResponseTOF.h" #include "Common/DataModel/PIDResponseTPC.h" -#include "TH1F.h" -#include "TCanvas.h" -#include "TRandom.h" + +#include + +#include +#include +#include +#include + +#include +#include using namespace o2; diff --git a/Common/Tools/PID/handleParamBase.h b/Common/Tools/PID/handleParamBase.h index 53938f26b7f..2362696d1b4 100644 --- a/Common/Tools/PID/handleParamBase.h +++ b/Common/Tools/PID/handleParamBase.h @@ -22,10 +22,15 @@ #include #include -#include +#include -#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/Common/Tools/PID/handleParamTPCResponse.cxx b/Common/Tools/PID/handleParamTPCResponse.cxx index 242503f16e1..74ade0f5f5a 100644 --- a/Common/Tools/PID/handleParamTPCResponse.cxx +++ b/Common/Tools/PID/handleParamTPCResponse.cxx @@ -14,14 +14,26 @@ /// \author Jeremy Wilkinson /// \brief exec for writing and reading TPC PID Response object +#include "Common/Core/PID/TPCPIDResponse.h" +#include "Common/Tools/PID/handleParamBase.h" + +#include +#include + +#include +#include + +#include +#include + #include #include +#include +#include #include -#include -#include "TFile.h" -#include "Common/Core/PID/TPCPIDResponse.h" -#include "handleParamBase.h" -#include "Algorithm/RangeTokenizer.h" +#include +#include + using namespace o2::pid::tpc; bool initOptionsAndParse(bpo::options_description& options, int argc, char* argv[]) diff --git a/Common/Tools/PID/pidTPCModule.h b/Common/Tools/PID/pidTPCModule.h index 47ad5d5a01c..36b3c54df00 100644 --- a/Common/Tools/PID/pidTPCModule.h +++ b/Common/Tools/PID/pidTPCModule.h @@ -18,38 +18,35 @@ /// \author Annalena Kalteyer annalena.sophie.kalteyer@cern.ch /// \author Jeremy Wilkinson jeremy.wilkinson@cern.ch -#ifndef COMMON_TOOLS_PIDTPCMODULE_H_ -#define COMMON_TOOLS_PIDTPCMODULE_H_ - -#include -#include -#include -#include -#include -// ROOT includes -#include "TFile.h" -#include "TRandom.h" -#include "TSystem.h" - -// O2 includes -#include "MetadataHelper.h" -#include "TableHelper.h" +#ifndef COMMON_TOOLS_PID_PIDTPCMODULE_H_ +#define COMMON_TOOLS_PID_PIDTPCMODULE_H_ #include "Common/CCDB/ctpRateFetcher.h" #include "Common/Core/PID/TPCPIDResponse.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Multiplicity.h" +#include "Common/Core/TableHelper.h" #include "Common/DataModel/PIDResponseTPC.h" +#include "Common/TableProducer/PID/pidTPCBase.h" #include "Tools/ML/model.h" -#include "CCDB/BasicCCDBManager.h" -#include "CCDB/CcdbApi.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/Track.h" +#include #include +#include +#include +#include + +#include // IWYU pragma: keep (do not replace with TMatrixDfwd.h) +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include namespace o2::aod { @@ -790,4 +787,4 @@ class pidTPCModule } // namespace pid } // namespace o2::aod -#endif // COMMON_TOOLS_PIDTPCMODULE_H_ +#endif // COMMON_TOOLS_PID_PIDTPCMODULE_H_ diff --git a/Common/Tools/StandardCCDBLoader.h b/Common/Tools/StandardCCDBLoader.h index 2134fec2666..b215fc70569 100644 --- a/Common/Tools/StandardCCDBLoader.h +++ b/Common/Tools/StandardCCDBLoader.h @@ -16,14 +16,13 @@ #ifndef COMMON_TOOLS_STANDARDCCDBLOADER_H_ #define COMMON_TOOLS_STANDARDCCDBLOADER_H_ -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsCalibration/MeanVertexObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DetectorsBase/GeometryManager.h" -#include "DetectorsBase/Propagator.h" -#include "Framework/AnalysisDataModel.h" - -#include +#include +#include +#include +#include +#include +#include + #include #include #include diff --git a/Common/Tools/TrackPropagationModule.h b/Common/Tools/TrackPropagationModule.h index 1c5f681623e..e03eb956f5e 100644 --- a/Common/Tools/TrackPropagationModule.h +++ b/Common/Tools/TrackPropagationModule.h @@ -17,6 +17,7 @@ #define COMMON_TOOLS_TRACKPROPAGATIONMODULE_H_ #include "Common/Core/TableHelper.h" +#include "Common/Core/trackUtilities.h" #include "Common/DataModel/TrackSelectionTables.h" #include "Common/Tools/TrackTuner.h" diff --git a/Common/Tools/TrackTuner.h b/Common/Tools/TrackTuner.h index ca7ae6c5eb5..02001ccf196 100644 --- a/Common/Tools/TrackTuner.h +++ b/Common/Tools/TrackTuner.h @@ -18,35 +18,28 @@ #ifndef COMMON_TOOLS_TRACKTUNER_H_ #define COMMON_TOOLS_TRACKTUNER_H_ -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/TrackSelectionTables.h" - #include #include -#include -#include -#include -#include -#include +#include +#include // FIXME: remove #include #include -#include #include -#include -#include #include -#include -#include +#include +#include +#include #include -#include +#include #include +#include #include +#include #include #include -#include #include #include #include diff --git a/Common/Tools/aodDataModelGraph.cxx b/Common/Tools/aodDataModelGraph.cxx index da854a700f5..29695228220 100644 --- a/Common/Tools/aodDataModelGraph.cxx +++ b/Common/Tools/aodDataModelGraph.cxx @@ -9,19 +9,23 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include -#include -#include -#include -#include "Framework/AnalysisDataModel.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGJE/DataModel/Jet.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" + +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponseTOF.h" #include "Common/DataModel/PIDResponseTPC.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "PWGJE/DataModel/Jet.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" + +#include + +#include + +#include +#include +#include using namespace o2::framework; using namespace o2::aod; diff --git a/Common/Tools/timestampModule.h b/Common/Tools/timestampModule.h index 80016dbfde3..03981beccaf 100644 --- a/Common/Tools/timestampModule.h +++ b/Common/Tools/timestampModule.h @@ -9,14 +9,20 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#ifndef COMMON_TOOLS_TIMESTAMPMODULEH_ -#define COMMON_TOOLS_TIMESTAMPMODULEH_ +#ifndef COMMON_TOOLS_TIMESTAMPMODULE_H_ +#define COMMON_TOOLS_TIMESTAMPMODULE_H_ -#include "Framework/AnalysisDataModel.h" +#include +#include +#include -#include #include +#include #include +#include +#include +#include +#include namespace o2 { @@ -148,4 +154,4 @@ class TimestampModule } // namespace common } // namespace o2 -#endif // COMMON_TOOLS_TIMESTAMPMODULEH_ +#endif // COMMON_TOOLS_TIMESTAMPMODULE_H_ diff --git a/Common/Tools/trackSelectionRequest.cxx b/Common/Tools/trackSelectionRequest.cxx index ed82f1ff7bf..576b3bc042e 100644 --- a/Common/Tools/trackSelectionRequest.cxx +++ b/Common/Tools/trackSelectionRequest.cxx @@ -12,7 +12,9 @@ // see header for a more detailed description. #include "trackSelectionRequest.h" -#include "Framework/Logger.h" + +#include + #include std::ostream& operator<<(std::ostream& os, trackSelectionRequest const& c) diff --git a/Common/Tools/trackSelectionRequest.h b/Common/Tools/trackSelectionRequest.h index a056eaaaed0..19d25405c38 100644 --- a/Common/Tools/trackSelectionRequest.h +++ b/Common/Tools/trackSelectionRequest.h @@ -24,10 +24,9 @@ #ifndef COMMON_TOOLS_TRACKSELECTIONREQUEST_H_ #define COMMON_TOOLS_TRACKSELECTIONREQUEST_H_ -#include - #include +#include #include class trackSelectionRequest From b178c96d03ede873ee769ef8a4d7c1e21bf78332 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Mon, 8 Sep 2025 17:38:46 +0200 Subject: [PATCH 353/986] [PWGDQ] Switch from O2 grouping to manual grouping (#12841) --- PWGDQ/Tasks/quarkoniaToHyperons.cxx | 649 ++++++++++++++++------------ 1 file changed, 369 insertions(+), 280 deletions(-) diff --git a/PWGDQ/Tasks/quarkoniaToHyperons.cxx b/PWGDQ/Tasks/quarkoniaToHyperons.cxx index 6133ee4e090..1d999efb78c 100644 --- a/PWGDQ/Tasks/quarkoniaToHyperons.cxx +++ b/PWGDQ/Tasks/quarkoniaToHyperons.cxx @@ -100,6 +100,19 @@ struct QuarkoniaToHyperons { Configurable cfgSkimmedProcessing{"cfgSkimmedProcessing", false, "If running over skimmed data, switch it on true"}; Configurable cfgSkimmedTrigger{"cfgSkimmedTrigger", "fDoubleXi,fTripleXi,fQuadrupleXi", "(std::string) Comma separated list of triggers of interest"}; + // Custom grouping + std::vector> v0sGrouped; + std::vector> cascadesGrouped; + + // vector of selected V0/cascade indices + std::vector selK0ShortIndices; + std::vector selLambdaIndices; + std::vector selAntiLambdaIndices; + std::vector selXiIndices; + std::vector selAntiXiIndices; + std::vector selOmIndices; + std::vector selAntiOmIndices; + // switch on/off event selections Configurable requireSel8{"requireSel8", true, "require sel8 event selection"}; Configurable requireTriggerTVX{"requireTriggerTVX", true, "require FT0 vertex (acceptable FT0C-FT0A time difference) at trigger level"}; @@ -1360,7 +1373,7 @@ struct QuarkoniaToHyperons { } template - void analyseV0Candidate(TV0 v0, float pt, uint64_t selMap, std::vector& selK0ShortIndices, std::vector& selLambdaIndices, std::vector& selAntiLambdaIndices, int v0TableOffset) + void analyseV0Candidate(TV0 v0, float pt, uint64_t selMap, std::vector& selK0ShortIndices, std::vector& selLambdaIndices, std::vector& selAntiLambdaIndices /*, int v0TableOffset*/) // precalculate this information so that a check is one mask operation, not many { bool passK0ShortSelections = false; @@ -1418,9 +1431,12 @@ struct QuarkoniaToHyperons { } // need local index because of the grouping of collisions - selK0ShortIndices[v0.globalIndex() - v0TableOffset] = passK0ShortSelections; - selLambdaIndices[v0.globalIndex() - v0TableOffset] = passLambdaSelections; - selAntiLambdaIndices[v0.globalIndex() - v0TableOffset] = passAntiLambdaSelections; + if (passK0ShortSelections) + selK0ShortIndices.push_back(v0.globalIndex()); + if (passLambdaSelections) + selLambdaIndices.push_back(v0.globalIndex()); + if (passAntiLambdaSelections) + selAntiLambdaIndices.push_back(v0.globalIndex()); } template @@ -1895,27 +1911,20 @@ struct QuarkoniaToHyperons { } template - void buildHyperonAntiHyperonPairs(TCollision const& collision, THyperons const& fullHyperons, std::vector selHypIndices, std::vector selAntiHypIndices, float centrality, uint8_t gapSide, int type) + void buildHyperonAntiHyperonPairs(TCollision const& collision, THyperons const& fullHyperons, std::vector selHypIndices, std::vector selAntiHypIndices, float centrality, uint8_t gapSide, int type) { // 1st loop over all v0s/cascades - for (const auto& hyperon : fullHyperons) { - // select only v0s matching Lambda selections - if (!selHypIndices[hyperon.globalIndex() - fullHyperons.offset()]) { // local index needed due to collisions grouping - continue; - } + for (std::size_t iHyp = 0; iHyp < selHypIndices.size(); iHyp++) { + auto hyperon = fullHyperons.rawIteratorAt(selHypIndices[iHyp]); // 2nd loop over all v0s/cascade - for (const auto& antiHyperon : fullHyperons) { - // select only v0s matching Anti-Lambda selections - if (!selAntiHypIndices[antiHyperon.globalIndex() - fullHyperons.offset()]) { // local index needed due to collisions grouping - continue; - } - + for (std::size_t iAntiHyp = 0; iAntiHyp < selAntiHypIndices.size(); iAntiHyp++) { // check we don't look at the same v0s/cascades - if (hyperon.globalIndex() == antiHyperon.globalIndex()) { + if (selHypIndices[iHyp] == selAntiHypIndices[iAntiHyp]) { continue; } + auto antiHyperon = fullHyperons.rawIteratorAt(selAntiHypIndices[iAntiHyp]); // check that the two hyperons have different daughter tracks if (!checkTrackIndices(hyperon, antiHyperon)) { continue; @@ -1926,155 +1935,209 @@ struct QuarkoniaToHyperons { } // end antiHyperon loop } // end hyperon loop + // for (const auto& hyperon : fullHyperons) { + // // select only v0s matching Lambda selections + // if (!selHypIndices[hyperon.globalIndex() /*- fullHyperons.offset()*/]) { // local index needed due to collisions grouping + // continue; + // } + + // // 2nd loop over all v0s/cascade + // for (const auto& antiHyperon : fullHyperons) { + // // select only v0s matching Anti-Lambda selections + // if (!selAntiHypIndices[antiHyperon.globalIndex() /*- fullHyperons.offset()*/]) { // local index needed due to collisions grouping + // continue; + // } + + // // check we don't look at the same v0s/cascades + // if (hyperon.globalIndex() == antiHyperon.globalIndex()) { + // continue; + // } + + // // check that the two hyperons have different daughter tracks + // if (!checkTrackIndices(hyperon, antiHyperon)) { + // continue; + // } + + // // form V0 pairs and fill histograms + // analyseHyperonPairCandidate(collision, hyperon, antiHyperon, centrality, gapSide, type); + // } // end antiHyperon loop + // } // end hyperon loop + return; } // ______________________________________________________ // Real data processing - no MC subscription - void processRealData(soa::Join::iterator const& collision, V0Candidates const& fullV0s, CascadeCandidates const& fullCascades, DauTracks const&) + void processRealData(soa::Join const& collisions, V0Candidates const& fullV0s, CascadeCandidates const& fullCascades, DauTracks const&) { - // Fire up CCDB - if (cfgSkimmedProcessing || - (mlConfigurations.useK0ShortScores && mlConfigurations.calculateK0ShortScores) || - (mlConfigurations.useLambdaScores && mlConfigurations.calculateLambdaScores) || - (mlConfigurations.useAntiLambdaScores && mlConfigurations.calculateAntiLambdaScores)) { - initCCDB(collision); - } + // Custom grouping + v0sGrouped.clear(); + cascadesGrouped.clear(); + v0sGrouped.resize(collisions.size()); + cascadesGrouped.resize(collisions.size()); + + for (const auto& v0 : fullV0s) { + v0sGrouped[v0.straCollisionId()].push_back(v0.globalIndex()); + } + for (const auto& cascade : fullCascades) { + cascadesGrouped[cascade.straCollisionId()].push_back(cascade.globalIndex()); + } + + for (const auto& collision : collisions) { + // Fire up CCDB + if (cfgSkimmedProcessing || + (mlConfigurations.useK0ShortScores && mlConfigurations.calculateK0ShortScores) || + (mlConfigurations.useLambdaScores && mlConfigurations.calculateLambdaScores) || + (mlConfigurations.useAntiLambdaScores && mlConfigurations.calculateAntiLambdaScores)) { + initCCDB(collision); + } - if (!isEventAccepted(collision, true)) { - return; - } + if (!isEventAccepted(collision, true)) { + return; + } - if (cfgSkimmedProcessing) { - zorro.isSelected(collision.globalBC()); /// Just let Zorro do the accounting - } + if (cfgSkimmedProcessing) { + zorro.isSelected(collision.globalBC()); /// Just let Zorro do the accounting + } - float centrality = -1; - int selGapSide = -1; // only useful in case one wants to use this task in Pb-Pb UPC - fillEventHistograms(collision, centrality, selGapSide); + float centrality = -1; + int selGapSide = -1; // only useful in case one wants to use this task in Pb-Pb UPC + fillEventHistograms(collision, centrality, selGapSide); - // __________________________________________ - // perform main analysis - // - if (buildK0sK0sPairs || buildLaLaBarPairs) { // Look at V0s - std::vector selK0ShortIndices(fullV0s.size()); - std::vector selLambdaIndices(fullV0s.size()); - std::vector selAntiLambdaIndices(fullV0s.size()); - for (const auto& v0 : fullV0s) { - if (std::abs(v0.negativeeta()) > v0Selections.daughterEtaCut || std::abs(v0.positiveeta()) > v0Selections.daughterEtaCut) - continue; // remove acceptance that's badly reproduced by MC / superfluous in future + // __________________________________________ + // perform main analysis + // + if (buildK0sK0sPairs || buildLaLaBarPairs) { // Look at V0s + std::size_t nV0sThisColl = v0sGrouped[collision.globalIndex()].size(); + selK0ShortIndices.clear(); + selLambdaIndices.clear(); + selAntiLambdaIndices.clear(); + for (std::size_t i = 0; i < nV0sThisColl; i++) { + auto v0 = fullV0s.rawIteratorAt(v0sGrouped[collision.globalIndex()][i]); + + if (std::abs(v0.negativeeta()) > v0Selections.daughterEtaCut || std::abs(v0.positiveeta()) > v0Selections.daughterEtaCut) + continue; // remove acceptance that's badly reproduced by MC / superfluous in future - if (v0.v0Type() != v0Selections.v0TypeSelection && v0Selections.v0TypeSelection > -1) - continue; // skip V0s that are not standard + if (v0.v0Type() != v0Selections.v0TypeSelection && v0Selections.v0TypeSelection > -1) + continue; // skip V0s that are not standard - uint64_t selMap = computeReconstructionBitmap(v0, collision, v0.yLambda(), v0.yK0Short(), v0.pt()); + uint64_t selMap = computeReconstructionBitmap(v0, collision, v0.yLambda(), v0.yK0Short(), v0.pt()); - // consider for histograms for all species - selMap = selMap | (static_cast(1) << selConsiderK0Short) | (static_cast(1) << selConsiderLambda) | (static_cast(1) << selConsiderAntiLambda); - selMap = selMap | (static_cast(1) << selPhysPrimK0Short) | (static_cast(1) << selPhysPrimLambda) | (static_cast(1) << selPhysPrimAntiLambda); + // consider for histograms for all species + selMap = selMap | (static_cast(1) << selConsiderK0Short) | (static_cast(1) << selConsiderLambda) | (static_cast(1) << selConsiderAntiLambda); + selMap = selMap | (static_cast(1) << selPhysPrimK0Short) | (static_cast(1) << selPhysPrimLambda) | (static_cast(1) << selPhysPrimAntiLambda); - analyseV0Candidate(v0, v0.pt(), selMap, selK0ShortIndices, selLambdaIndices, selAntiLambdaIndices, fullV0s.offset()); - } // end v0 loop + analyseV0Candidate(v0, v0.pt(), selMap, selK0ShortIndices, selLambdaIndices, selAntiLambdaIndices /*, fullV0s.offset()*/); + } // end v0 loop - // count the number of K0s, Lambda and AntiLambdas passsing the selections - int nK0Shorts = std::count(selK0ShortIndices.begin(), selK0ShortIndices.end(), true); - int nLambdas = std::count(selLambdaIndices.begin(), selLambdaIndices.end(), true); - int nAntiLambdas = std::count(selAntiLambdaIndices.begin(), selAntiLambdaIndices.end(), true); + // count the number of K0s, Lambda and AntiLambdas passsing the selections + std::size_t nK0Shorts = selK0ShortIndices.size(); + std::size_t nLambdas = selLambdaIndices.size(); + std::size_t nAntiLambdas = selAntiLambdaIndices.size(); - if (buildK0sK0sPairs) { - // fill the histograms with the number of reconstructed K0s/Lambda/antiLambda per collision - histos.fill(HIST("K0sK0s/h2dNbrOfK0ShortVsCentrality"), centrality, nK0Shorts); + if (buildK0sK0sPairs) { + // fill the histograms with the number of reconstructed K0s/Lambda/antiLambda per collision + histos.fill(HIST("K0sK0s/h2dNbrOfK0ShortVsCentrality"), centrality, nK0Shorts); - // Check the number of K0Short - // needs at least 2 to form K0s-K0s pairs - if (nK0Shorts >= 2) { // consider K0s K0s pairs - buildHyperonAntiHyperonPairs(collision, fullV0s, selK0ShortIndices, selK0ShortIndices, centrality, selGapSide, 0); + // Check the number of K0Short + // needs at least 2 to form K0s-K0s pairs + if (nK0Shorts >= 2) { // consider K0s K0s pairs + buildHyperonAntiHyperonPairs(collision, fullV0s, selK0ShortIndices, selK0ShortIndices, centrality, selGapSide, 0); + } } - } - if (buildLaLaBarPairs) { - // fill the histograms with the number of reconstructed K0s/Lambda/antiLambda per collision - histos.fill(HIST("LaLaBar/h2dNbrOfLambdaVsCentrality"), centrality, nLambdas); - histos.fill(HIST("LaLaBar/h2dNbrOfAntiLambdaVsCentrality"), centrality, nAntiLambdas); + if (buildLaLaBarPairs) { + // fill the histograms with the number of reconstructed K0s/Lambda/antiLambda per collision + histos.fill(HIST("LaLaBar/h2dNbrOfLambdaVsCentrality"), centrality, nLambdas); + histos.fill(HIST("LaLaBar/h2dNbrOfAntiLambdaVsCentrality"), centrality, nAntiLambdas); - // Check the number of Lambdas and antiLambdas - // needs at least 1 of each - if (!buildSameSignPairs && nLambdas >= 1 && nAntiLambdas >= 1) { // consider Lambda antiLambda pairs - buildHyperonAntiHyperonPairs(collision, fullV0s, selLambdaIndices, selAntiLambdaIndices, centrality, selGapSide, 1); - } - if (buildSameSignPairs && nLambdas > 1) { // consider Lambda Lambda pairs - buildHyperonAntiHyperonPairs(collision, fullV0s, selLambdaIndices, selLambdaIndices, centrality, selGapSide, 1); - } - if (buildSameSignPairs && nAntiLambdas > 1) { // consider antiLambda antiLambda pairs - buildHyperonAntiHyperonPairs(collision, fullV0s, selAntiLambdaIndices, selAntiLambdaIndices, centrality, selGapSide, 1); + // Check the number of Lambdas and antiLambdas + // needs at least 1 of each + if (!buildSameSignPairs && nLambdas >= 1 && nAntiLambdas >= 1) { // consider Lambda antiLambda pairs + buildHyperonAntiHyperonPairs(collision, fullV0s, selLambdaIndices, selAntiLambdaIndices, centrality, selGapSide, 1); + } + if (buildSameSignPairs && nLambdas > 1) { // consider Lambda Lambda pairs + buildHyperonAntiHyperonPairs(collision, fullV0s, selLambdaIndices, selLambdaIndices, centrality, selGapSide, 1); + } + if (buildSameSignPairs && nAntiLambdas > 1) { // consider antiLambda antiLambda pairs + buildHyperonAntiHyperonPairs(collision, fullV0s, selAntiLambdaIndices, selAntiLambdaIndices, centrality, selGapSide, 1); + } } } - } - if (buildXiXiBarPairs || buildOmOmBarPairs) { // Look at Cascades - std::vector selXiIndices(fullCascades.size()); - std::vector selAntiXiIndices(fullCascades.size()); - std::vector selOmIndices(fullCascades.size()); - std::vector selAntiOmIndices(fullCascades.size()); - for (const auto& cascade : fullCascades) { - if (std::abs(cascade.negativeeta()) > cascSelections.daughterEtaCut || - std::abs(cascade.positiveeta()) > cascSelections.daughterEtaCut || - std::abs(cascade.bacheloreta()) > cascSelections.daughterEtaCut) - continue; // remove acceptance that's badly reproduced by MC / superfluous in future + if (buildXiXiBarPairs || buildOmOmBarPairs) { // Look at Cascades + std::size_t nCascadesThisColl = cascadesGrouped[collision.globalIndex()].size(); + + selXiIndices.clear(); + selAntiXiIndices.clear(); + selOmIndices.clear(); + selAntiOmIndices.clear(); + for (std::size_t i = 0; i < nCascadesThisColl; i++) { + auto cascade = fullCascades.rawIteratorAt(cascadesGrouped[collision.globalIndex()][i]); + + if (std::abs(cascade.negativeeta()) > cascSelections.daughterEtaCut || + std::abs(cascade.positiveeta()) > cascSelections.daughterEtaCut || + std::abs(cascade.bacheloreta()) > cascSelections.daughterEtaCut) + continue; // remove acceptance that's badly reproduced by MC / superfluous in future + + if (buildXiXiBarPairs) { + if (isCascadeSelected(cascade, collision, cascade.yXi(), true)) { + if (cascade.sign() < 0) { + selXiIndices.push_back(cascade.globalIndex()); + } else { + selAntiXiIndices.push_back(cascade.globalIndex()); + } + } + } + if (buildOmOmBarPairs) { + if (isCascadeSelected(cascade, collision, cascade.yOmega(), false)) { + if (cascade.sign() < 0) { + selOmIndices.push_back(cascade.globalIndex()); + } else { + selAntiOmIndices.push_back(cascade.globalIndex()); + } + } + } + } // end cascade loop + + // count the number of Xi and antiXi passsing the selections + std::size_t nXis = selXiIndices.size(); + std::size_t nAntiXis = selAntiXiIndices.size(); + std::size_t nOmegas = selOmIndices.size(); + std::size_t nAntiOmegas = selAntiOmIndices.size(); + // fill the histograms with the number of reconstructed K0s/Lambda/antiLambda per collision if (buildXiXiBarPairs) { - if (cascade.sign() < 0) { - selXiIndices[cascade.globalIndex() - fullCascades.offset()] = isCascadeSelected(cascade, collision, cascade.yXi(), true); - } else { - selAntiXiIndices[cascade.globalIndex() - fullCascades.offset()] = isCascadeSelected(cascade, collision, cascade.yXi(), true); + histos.fill(HIST("XiXiBar/h2dNbrOfXiVsCentrality"), centrality, nXis); + histos.fill(HIST("XiXiBar/h2dNbrOfAntiXiVsCentrality"), centrality, nAntiXis); + + // Check the number of Lambdas and antiLambdas + // needs at least 1 of each + if (!buildSameSignPairs && nXis >= 1 && nAntiXis >= 1) { + buildHyperonAntiHyperonPairs(collision, fullCascades, selXiIndices, selAntiXiIndices, centrality, selGapSide, 2); + } + if (buildSameSignPairs && nXis > 1) { + buildHyperonAntiHyperonPairs(collision, fullCascades, selXiIndices, selXiIndices, centrality, selGapSide, 2); + } + if (buildSameSignPairs && nAntiXis > 1) { + buildHyperonAntiHyperonPairs(collision, fullCascades, selAntiXiIndices, selAntiXiIndices, centrality, selGapSide, 2); } } if (buildOmOmBarPairs) { - if (cascade.sign() < 0) { - selOmIndices[cascade.globalIndex() - fullCascades.offset()] = isCascadeSelected(cascade, collision, cascade.yOmega(), false); - } else { - selAntiOmIndices[cascade.globalIndex() - fullCascades.offset()] = isCascadeSelected(cascade, collision, cascade.yOmega(), false); + histos.fill(HIST("OmOmBar/h2dNbrOfOmegaVsCentrality"), centrality, nOmegas); + histos.fill(HIST("OmOmBar/h2dNbrOfAntiOmegaVsCentrality"), centrality, nAntiOmegas); + + // Check the number of Lambdas and antiLambdas + // needs at least 1 of each + if (!buildSameSignPairs && nOmegas >= 1 && nAntiOmegas >= 1) { + buildHyperonAntiHyperonPairs(collision, fullCascades, selOmIndices, selAntiOmIndices, centrality, selGapSide, 3); + } + if (buildSameSignPairs && nOmegas > 1) { + buildHyperonAntiHyperonPairs(collision, fullCascades, selOmIndices, selOmIndices, centrality, selGapSide, 3); + } + if (buildSameSignPairs && nAntiOmegas > 1) { + buildHyperonAntiHyperonPairs(collision, fullCascades, selAntiOmIndices, selAntiOmIndices, centrality, selGapSide, 3); } - } - } // end cascade loop - - // count the number of Xi and antiXi passsing the selections - int nXis = std::count(selXiIndices.begin(), selXiIndices.end(), true); - int nAntiXis = std::count(selAntiXiIndices.begin(), selAntiXiIndices.end(), true); - int nOmegas = std::count(selOmIndices.begin(), selOmIndices.end(), true); - int nAntiOmegas = std::count(selAntiOmIndices.begin(), selAntiOmIndices.end(), true); - - // fill the histograms with the number of reconstructed K0s/Lambda/antiLambda per collision - if (buildXiXiBarPairs) { - histos.fill(HIST("XiXiBar/h2dNbrOfXiVsCentrality"), centrality, nXis); - histos.fill(HIST("XiXiBar/h2dNbrOfAntiXiVsCentrality"), centrality, nAntiXis); - - // Check the number of Lambdas and antiLambdas - // needs at least 1 of each - if (!buildSameSignPairs && nXis >= 1 && nAntiXis >= 1) { - buildHyperonAntiHyperonPairs(collision, fullCascades, selXiIndices, selAntiXiIndices, centrality, selGapSide, 2); - } - if (buildSameSignPairs && nXis > 1) { - buildHyperonAntiHyperonPairs(collision, fullCascades, selXiIndices, selXiIndices, centrality, selGapSide, 2); - } - if (buildSameSignPairs && nAntiXis > 1) { - buildHyperonAntiHyperonPairs(collision, fullCascades, selAntiXiIndices, selAntiXiIndices, centrality, selGapSide, 2); - } - } - if (buildOmOmBarPairs) { - histos.fill(HIST("OmOmBar/h2dNbrOfOmegaVsCentrality"), centrality, nOmegas); - histos.fill(HIST("OmOmBar/h2dNbrOfAntiOmegaVsCentrality"), centrality, nAntiOmegas); - - // Check the number of Lambdas and antiLambdas - // needs at least 1 of each - if (!buildSameSignPairs && nOmegas >= 1 && nAntiOmegas >= 1) { - buildHyperonAntiHyperonPairs(collision, fullCascades, selOmIndices, selAntiOmIndices, centrality, selGapSide, 3); - } - if (buildSameSignPairs && nOmegas > 1) { - buildHyperonAntiHyperonPairs(collision, fullCascades, selOmIndices, selOmIndices, centrality, selGapSide, 3); - } - if (buildSameSignPairs && nAntiOmegas > 1) { - buildHyperonAntiHyperonPairs(collision, fullCascades, selAntiOmIndices, selAntiOmIndices, centrality, selGapSide, 3); } } } @@ -2082,170 +2145,196 @@ struct QuarkoniaToHyperons { // ______________________________________________________ // Simulated processing (subscribes to MC information too) - void processMonteCarlo(soa::Join::iterator const& collision, V0MCCandidates const& fullV0s, CascadeMCCandidates const& fullCascades, DauTracks const&, aod::MotherMCParts const&, soa::Join const& /*mccollisions*/, soa::Join const&, soa::Join const&) + void processMonteCarlo(soa::Join const& collisions, V0MCCandidates const& fullV0s, CascadeMCCandidates const& fullCascades, DauTracks const&, aod::MotherMCParts const&, soa::Join const& /*mccollisions*/, soa::Join const&, soa::Join const&) { - // Fire up CCDB - if (cfgSkimmedProcessing || - (mlConfigurations.useK0ShortScores && mlConfigurations.calculateK0ShortScores) || - (mlConfigurations.useLambdaScores && mlConfigurations.calculateLambdaScores) || - (mlConfigurations.useAntiLambdaScores && mlConfigurations.calculateAntiLambdaScores)) { - initCCDB(collision); - } - - if (!isEventAccepted(collision, true)) { - return; - } - - if (cfgSkimmedProcessing) { - zorro.isSelected(collision.globalBC()); /// Just let Zorro do the accounting - } - - float centrality = -1; - int selGapSide = -1; // only useful in case one wants to use this task in Pb-Pb UPC - fillEventHistograms(collision, centrality, selGapSide); - - // __________________________________________ - // perform main analysis - if (buildK0sK0sPairs || buildLaLaBarPairs) { // Look at V0s - std::vector selK0ShortIndices(fullV0s.size()); - std::vector selLambdaIndices(fullV0s.size()); - std::vector selAntiLambdaIndices(fullV0s.size()); - for (const auto& v0 : fullV0s) { - if (std::abs(v0.negativeeta()) > v0Selections.daughterEtaCut || std::abs(v0.positiveeta()) > v0Selections.daughterEtaCut) - continue; // remove acceptance that's badly reproduced by MC / superfluous in future - - if (!v0.has_v0MCCore()) - continue; - - auto v0MC = v0.v0MCCore_as>(); + // Custom grouping + v0sGrouped.clear(); + cascadesGrouped.clear(); + v0sGrouped.resize(collisions.size()); + cascadesGrouped.resize(collisions.size()); + + for (const auto& v0 : fullV0s) { + v0sGrouped[v0.straCollisionId()].push_back(v0.globalIndex()); + } + for (const auto& cascade : fullCascades) { + cascadesGrouped[cascade.straCollisionId()].push_back(cascade.globalIndex()); + } + + for (const auto& collision : collisions) { + // Fire up CCDB + if (cfgSkimmedProcessing || + (mlConfigurations.useK0ShortScores && mlConfigurations.calculateK0ShortScores) || + (mlConfigurations.useLambdaScores && mlConfigurations.calculateLambdaScores) || + (mlConfigurations.useAntiLambdaScores && mlConfigurations.calculateAntiLambdaScores)) { + initCCDB(collision); + } - float ptmc = RecoDecay::sqrtSumOfSquares(v0MC.pxPosMC() + v0MC.pxNegMC(), v0MC.pyPosMC() + v0MC.pyNegMC()); - float ymc = 1e-3; - if (v0MC.pdgCode() == 310) - ymc = RecoDecay::y(std::array{v0MC.pxPosMC() + v0MC.pxNegMC(), v0MC.pyPosMC() + v0MC.pyNegMC(), v0MC.pzPosMC() + v0MC.pzNegMC()}, o2::constants::physics::MassKaonNeutral); - else if (std::fabs(v0MC.pdgCode()) == 3122) - ymc = RecoDecay::y(std::array{v0MC.pxPosMC() + v0MC.pxNegMC(), v0MC.pyPosMC() + v0MC.pyNegMC(), v0MC.pzPosMC() + v0MC.pzNegMC()}, o2::constants::physics::MassLambda); + if (!isEventAccepted(collision, true)) { + return; + } - uint64_t selMap = computeReconstructionBitmap(v0, collision, ymc, ymc, ptmc); - selMap = selMap | computeMCAssociation(v0MC); + if (cfgSkimmedProcessing) { + zorro.isSelected(collision.globalBC()); /// Just let Zorro do the accounting + } - // consider only associated candidates if asked to do so, disregard association - if (!doMCAssociation) { - selMap = selMap | (static_cast(1) << selConsiderK0Short) | (static_cast(1) << selConsiderLambda) | (static_cast(1) << selConsiderAntiLambda); - selMap = selMap | (static_cast(1) << selPhysPrimK0Short) | (static_cast(1) << selPhysPrimLambda) | (static_cast(1) << selPhysPrimAntiLambda); - } + float centrality = -1; + int selGapSide = -1; // only useful in case one wants to use this task in Pb-Pb UPC + fillEventHistograms(collision, centrality, selGapSide); + + // __________________________________________ + // perform main analysis + if (buildK0sK0sPairs || buildLaLaBarPairs) { // Look at V0s + std::size_t nV0sThisColl = v0sGrouped[collision.globalIndex()].size(); + selK0ShortIndices.clear(); + selLambdaIndices.clear(); + selAntiLambdaIndices.clear(); + for (std::size_t i = 0; i < nV0sThisColl; i++) { + auto v0 = fullV0s.rawIteratorAt(v0sGrouped[collision.globalIndex()][i]); + + if (std::abs(v0.negativeeta()) > v0Selections.daughterEtaCut || std::abs(v0.positiveeta()) > v0Selections.daughterEtaCut) + continue; // remove acceptance that's badly reproduced by MC / superfluous in future + + if (!v0.has_v0MCCore()) + continue; + + auto v0MC = v0.v0MCCore_as>(); + + float ptmc = RecoDecay::sqrtSumOfSquares(v0MC.pxPosMC() + v0MC.pxNegMC(), v0MC.pyPosMC() + v0MC.pyNegMC()); + float ymc = 1e-3; + if (v0MC.pdgCode() == 310) + ymc = RecoDecay::y(std::array{v0MC.pxPosMC() + v0MC.pxNegMC(), v0MC.pyPosMC() + v0MC.pyNegMC(), v0MC.pzPosMC() + v0MC.pzNegMC()}, o2::constants::physics::MassKaonNeutral); + else if (std::fabs(v0MC.pdgCode()) == 3122) + ymc = RecoDecay::y(std::array{v0MC.pxPosMC() + v0MC.pxNegMC(), v0MC.pyPosMC() + v0MC.pyNegMC(), v0MC.pzPosMC() + v0MC.pzNegMC()}, o2::constants::physics::MassLambda); + + uint64_t selMap = computeReconstructionBitmap(v0, collision, ymc, ymc, ptmc); + selMap = selMap | computeMCAssociation(v0MC); + + // consider only associated candidates if asked to do so, disregard association + if (!doMCAssociation) { + selMap = selMap | (static_cast(1) << selConsiderK0Short) | (static_cast(1) << selConsiderLambda) | (static_cast(1) << selConsiderAntiLambda); + selMap = selMap | (static_cast(1) << selPhysPrimK0Short) | (static_cast(1) << selPhysPrimLambda) | (static_cast(1) << selPhysPrimAntiLambda); + } - analyseV0Candidate(v0, ptmc, selMap, selK0ShortIndices, selLambdaIndices, selAntiLambdaIndices, fullV0s.offset()); - } // end v0 loop + analyseV0Candidate(v0, ptmc, selMap, selK0ShortIndices, selLambdaIndices, selAntiLambdaIndices /*, fullV0s.offset()*/); + } // end v0 loop - /// count the number of K0s, Lambda and AntiLambdas passsing the selections - int nK0Shorts = std::count(selK0ShortIndices.begin(), selK0ShortIndices.end(), true); - int nLambdas = std::count(selLambdaIndices.begin(), selLambdaIndices.end(), true); - int nAntiLambdas = std::count(selAntiLambdaIndices.begin(), selAntiLambdaIndices.end(), true); + /// count the number of K0s, Lambda and AntiLambdas passsing the selections + std::size_t nK0Shorts = selK0ShortIndices.size(); + std::size_t nLambdas = selLambdaIndices.size(); + std::size_t nAntiLambdas = selAntiLambdaIndices.size(); - if (buildK0sK0sPairs) { - // fill the histograms with the number of reconstructed K0s/Lambda/antiLambda per collision - histos.fill(HIST("K0sK0s/h2dNbrOfK0ShortVsCentrality"), centrality, nK0Shorts); + if (buildK0sK0sPairs) { + // fill the histograms with the number of reconstructed K0s/Lambda/antiLambda per collision + histos.fill(HIST("K0sK0s/h2dNbrOfK0ShortVsCentrality"), centrality, nK0Shorts); - // Check the number of K0Short - // needs at least 2 to form K0s-K0s pairs - if (nK0Shorts >= 2) { // consider K0s K0s pairs - buildHyperonAntiHyperonPairs(collision, fullV0s, selK0ShortIndices, selK0ShortIndices, centrality, selGapSide, 0); + // Check the number of K0Short + // needs at least 2 to form K0s-K0s pairs + if (nK0Shorts >= 2) { // consider K0s K0s pairs + buildHyperonAntiHyperonPairs(collision, fullV0s, selK0ShortIndices, selK0ShortIndices, centrality, selGapSide, 0); + } } - } - if (buildLaLaBarPairs) { - // fill the histograms with the number of reconstructed Lambda/antiLambda per collision - histos.fill(HIST("LaLaBar/h2dNbrOfLambdaVsCentrality"), centrality, nLambdas); - histos.fill(HIST("LaLaBar/h2dNbrOfAntiLambdaVsCentrality"), centrality, nAntiLambdas); + if (buildLaLaBarPairs) { + // fill the histograms with the number of reconstructed Lambda/antiLambda per collision + histos.fill(HIST("LaLaBar/h2dNbrOfLambdaVsCentrality"), centrality, nLambdas); + histos.fill(HIST("LaLaBar/h2dNbrOfAntiLambdaVsCentrality"), centrality, nAntiLambdas); - if (!buildSameSignPairs && nLambdas >= 1 && nAntiLambdas >= 1) { // consider Lambda antiLambda pairs - buildHyperonAntiHyperonPairs(collision, fullV0s, selLambdaIndices, selAntiLambdaIndices, centrality, selGapSide, 1); - } - if (buildSameSignPairs && nLambdas > 1) { // consider Lambda Lambda pairs - buildHyperonAntiHyperonPairs(collision, fullV0s, selLambdaIndices, selLambdaIndices, centrality, selGapSide, 1); - } - if (buildSameSignPairs && nAntiLambdas > 1) { // consider antiLambda antiLambda pairs - buildHyperonAntiHyperonPairs(collision, fullV0s, selAntiLambdaIndices, selAntiLambdaIndices, centrality, selGapSide, 1); + if (!buildSameSignPairs && nLambdas >= 1 && nAntiLambdas >= 1) { // consider Lambda antiLambda pairs + buildHyperonAntiHyperonPairs(collision, fullV0s, selLambdaIndices, selAntiLambdaIndices, centrality, selGapSide, 1); + } + if (buildSameSignPairs && nLambdas > 1) { // consider Lambda Lambda pairs + buildHyperonAntiHyperonPairs(collision, fullV0s, selLambdaIndices, selLambdaIndices, centrality, selGapSide, 1); + } + if (buildSameSignPairs && nAntiLambdas > 1) { // consider antiLambda antiLambda pairs + buildHyperonAntiHyperonPairs(collision, fullV0s, selAntiLambdaIndices, selAntiLambdaIndices, centrality, selGapSide, 1); + } } } - } - - if (buildXiXiBarPairs || buildOmOmBarPairs) { // Look at Cascades - std::vector selXiIndices(fullCascades.size()); - std::vector selAntiXiIndices(fullCascades.size()); - std::vector selOmIndices(fullCascades.size()); - std::vector selAntiOmIndices(fullCascades.size()); - for (const auto& cascade : fullCascades) { - if (std::abs(cascade.negativeeta()) > cascSelections.daughterEtaCut || - std::abs(cascade.positiveeta()) > cascSelections.daughterEtaCut || - std::abs(cascade.bacheloreta()) > cascSelections.daughterEtaCut) - continue; // remove acceptance that's badly reproduced by MC / superfluous in future - - if (!cascade.has_cascMCCore()) - continue; - auto cascadeMC = cascade.cascMCCore_as>(); + if (buildXiXiBarPairs || buildOmOmBarPairs) { // Look at Cascades + std::size_t nCascadesThisColl = cascadesGrouped[collision.globalIndex()].size(); + + selXiIndices.clear(); + selAntiXiIndices.clear(); + selOmIndices.clear(); + selAntiOmIndices.clear(); + for (std::size_t i = 0; i < nCascadesThisColl; i++) { + auto cascade = fullCascades.rawIteratorAt(cascadesGrouped[collision.globalIndex()][i]); + + if (std::abs(cascade.negativeeta()) > cascSelections.daughterEtaCut || + std::abs(cascade.positiveeta()) > cascSelections.daughterEtaCut || + std::abs(cascade.bacheloreta()) > cascSelections.daughterEtaCut) + continue; // remove acceptance that's badly reproduced by MC / superfluous in future + + if (!cascade.has_cascMCCore()) + continue; + + auto cascadeMC = cascade.cascMCCore_as>(); + + float ymc = 1e-3; + if (std::fabs(cascadeMC.pdgCode()) == 3312) + ymc = RecoDecay::y(std::array{cascadeMC.pxMC(), cascadeMC.pyMC(), cascadeMC.pzMC()}, o2::constants::physics::MassXiMinus); + else if (std::fabs(cascadeMC.pdgCode()) == 3334) + ymc = RecoDecay::y(std::array{cascadeMC.pxMC(), cascadeMC.pyMC(), cascadeMC.pzMC()}, o2::constants::physics::MassOmegaMinus); + + if (buildXiXiBarPairs) { + if (isCascadeSelected(cascade, collision, ymc, true)) { + if (cascade.sign() < 0) { + selXiIndices.push_back(cascade.globalIndex()); + } else { + selAntiXiIndices.push_back(cascade.globalIndex()); + } + } + } + if (buildOmOmBarPairs) { + if (isCascadeSelected(cascade, collision, ymc, false)) { + if (cascade.sign() < 0) { + selOmIndices.push_back(cascade.globalIndex()); + } else { + selAntiOmIndices.push_back(cascade.globalIndex()); + } + } + } + } // end cascade loop - float ymc = 1e-3; - if (std::fabs(cascadeMC.pdgCode()) == 3312) - ymc = RecoDecay::y(std::array{cascadeMC.pxMC(), cascadeMC.pyMC(), cascadeMC.pzMC()}, o2::constants::physics::MassXiMinus); - else if (std::fabs(cascadeMC.pdgCode()) == 3334) - ymc = RecoDecay::y(std::array{cascadeMC.pxMC(), cascadeMC.pyMC(), cascadeMC.pzMC()}, o2::constants::physics::MassOmegaMinus); + // count the number of Xi and antiXi passsing the selections + std::size_t nXis = selXiIndices.size(); + std::size_t nAntiXis = selAntiXiIndices.size(); + std::size_t nOmegas = selOmIndices.size(); + std::size_t nAntiOmegas = selAntiOmIndices.size(); + // fill the histograms with the number of reconstructed K0s/Lambda/antiLambda per collision if (buildXiXiBarPairs) { - if (cascade.sign() < 0) { - selXiIndices[cascade.globalIndex() - fullCascades.offset()] = isCascadeSelected(cascade, collision, ymc, true); - } else { - selAntiXiIndices[cascade.globalIndex() - fullCascades.offset()] = isCascadeSelected(cascade, collision, ymc, true); + histos.fill(HIST("XiXiBar/h2dNbrOfXiVsCentrality"), centrality, nXis); + histos.fill(HIST("XiXiBar/h2dNbrOfAntiXiVsCentrality"), centrality, nAntiXis); + + // Check the number of Lambdas and antiLambdas + // needs at least 1 of each + if (!buildSameSignPairs && nXis >= 1 && nAntiXis >= 1) { + buildHyperonAntiHyperonPairs(collision, fullCascades, selXiIndices, selAntiXiIndices, centrality, selGapSide, 2); + } + if (buildSameSignPairs && nXis > 1) { + buildHyperonAntiHyperonPairs(collision, fullCascades, selXiIndices, selXiIndices, centrality, selGapSide, 2); + } + if (buildSameSignPairs && nAntiXis > 1) { + buildHyperonAntiHyperonPairs(collision, fullCascades, selAntiXiIndices, selAntiXiIndices, centrality, selGapSide, 2); } } if (buildOmOmBarPairs) { - if (cascade.sign() < 0) { - selOmIndices[cascade.globalIndex() - fullCascades.offset()] = isCascadeSelected(cascade, collision, ymc, false); - } else { - selAntiOmIndices[cascade.globalIndex() - fullCascades.offset()] = isCascadeSelected(cascade, collision, ymc, false); + histos.fill(HIST("OmOmBar/h2dNbrOfOmegaVsCentrality"), centrality, nOmegas); + histos.fill(HIST("OmOmBar/h2dNbrOfAntiOmegaVsCentrality"), centrality, nAntiOmegas); + + // Check the number of Lambdas and antiLambdas + // needs at least 1 of each + if (!buildSameSignPairs && nOmegas >= 1 && nAntiOmegas >= 1) { + buildHyperonAntiHyperonPairs(collision, fullCascades, selOmIndices, selAntiOmIndices, centrality, selGapSide, 3); + } + if (buildSameSignPairs && nOmegas > 1) { + buildHyperonAntiHyperonPairs(collision, fullCascades, selOmIndices, selOmIndices, centrality, selGapSide, 3); + } + if (buildSameSignPairs && nAntiOmegas > 1) { + buildHyperonAntiHyperonPairs(collision, fullCascades, selAntiOmIndices, selAntiOmIndices, centrality, selGapSide, 3); } - } - } // end cascade loop - - // count the number of Xi and antiXi passsing the selections - int nXis = std::count(selXiIndices.begin(), selXiIndices.end(), true); - int nAntiXis = std::count(selAntiXiIndices.begin(), selAntiXiIndices.end(), true); - int nOmegas = std::count(selOmIndices.begin(), selOmIndices.end(), true); - int nAntiOmegas = std::count(selAntiOmIndices.begin(), selAntiOmIndices.end(), true); - - // fill the histograms with the number of reconstructed K0s/Lambda/antiLambda per collision - if (buildXiXiBarPairs) { - histos.fill(HIST("XiXiBar/h2dNbrOfXiVsCentrality"), centrality, nXis); - histos.fill(HIST("XiXiBar/h2dNbrOfAntiXiVsCentrality"), centrality, nAntiXis); - - // Check the number of Lambdas and antiLambdas - // needs at least 1 of each - if (!buildSameSignPairs && nXis >= 1 && nAntiXis >= 1) { - buildHyperonAntiHyperonPairs(collision, fullCascades, selXiIndices, selAntiXiIndices, centrality, selGapSide, 2); - } - if (buildSameSignPairs && nXis > 1) { - buildHyperonAntiHyperonPairs(collision, fullCascades, selXiIndices, selXiIndices, centrality, selGapSide, 2); - } - if (buildSameSignPairs && nAntiXis > 1) { - buildHyperonAntiHyperonPairs(collision, fullCascades, selAntiXiIndices, selAntiXiIndices, centrality, selGapSide, 2); - } - } - if (buildOmOmBarPairs) { - histos.fill(HIST("OmOmBar/h2dNbrOfOmegaVsCentrality"), centrality, nOmegas); - histos.fill(HIST("OmOmBar/h2dNbrOfAntiOmegaVsCentrality"), centrality, nAntiOmegas); - - // Check the number of Lambdas and antiLambdas - // needs at least 1 of each - if (!buildSameSignPairs && nOmegas >= 1 && nAntiOmegas >= 1) { - buildHyperonAntiHyperonPairs(collision, fullCascades, selOmIndices, selAntiOmIndices, centrality, selGapSide, 3); - } - if (buildSameSignPairs && nOmegas > 1) { - buildHyperonAntiHyperonPairs(collision, fullCascades, selOmIndices, selOmIndices, centrality, selGapSide, 3); - } - if (buildSameSignPairs && nAntiOmegas > 1) { - buildHyperonAntiHyperonPairs(collision, fullCascades, selAntiOmIndices, selAntiOmIndices, centrality, selGapSide, 3); } } } From f2d174cf21517887871ff338e6414edd91773784 Mon Sep 17 00:00:00 2001 From: blacwovie Date: Thu, 11 Sep 2025 03:48:18 +0800 Subject: [PATCH 354/986] [PWGCF] pi-hypertriton femto test (#12898) Co-authored-by: blacw Co-authored-by: ALICE Action Bot --- PWGCF/Femto/DataModel/PionDeuteronTables.h | 111 ---- PWGCF/Femto/DataModel/PionNucleiTables.h | 133 +++++ PWGCF/Femto/TableProducer/CMakeLists.txt | 4 +- ...{PiDeuteronFemto.cxx => PiNucleiFemto.cxx} | 497 ++++++++++++------ 4 files changed, 477 insertions(+), 268 deletions(-) delete mode 100644 PWGCF/Femto/DataModel/PionDeuteronTables.h create mode 100644 PWGCF/Femto/DataModel/PionNucleiTables.h rename PWGCF/Femto/TableProducer/{PiDeuteronFemto.cxx => PiNucleiFemto.cxx} (67%) diff --git a/PWGCF/Femto/DataModel/PionDeuteronTables.h b/PWGCF/Femto/DataModel/PionDeuteronTables.h deleted file mode 100644 index 89754a8cc97..00000000000 --- a/PWGCF/Femto/DataModel/PionDeuteronTables.h +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// -/// \file PionDeuteronTables.h -/// \brief Slim tables for piDeuteron -/// \author CMY -/// \date 2025-04-10 - -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" - -#ifndef PWGCF_FEMTO_DATAMODEL_PIONDEUTERONTABLES_H_ -#define PWGCF_FEMTO_DATAMODEL_PIONDEUTERONTABLES_H_ - -namespace o2::aod -{ -namespace pion_deuteron_tables -{ - -DECLARE_SOA_COLUMN(PtDe, ptDe, float); -DECLARE_SOA_COLUMN(EtaDe, etaDe, float); -DECLARE_SOA_COLUMN(PhiDe, phiDe, float); -DECLARE_SOA_COLUMN(PtPi, ptPi, float); -DECLARE_SOA_COLUMN(EtaPi, etaPi, float); -DECLARE_SOA_COLUMN(PhiPi, phiPi, float); - -DECLARE_SOA_COLUMN(DcaxyDe, dcaxyDe, float); -DECLARE_SOA_COLUMN(DcazDe, dcazDe, float); -DECLARE_SOA_COLUMN(DcaxyPi, dcaxyPi, float); -DECLARE_SOA_COLUMN(DcazPi, dcazPi, float); - -DECLARE_SOA_COLUMN(SignalTPCDe, signalTPCDe, float); -DECLARE_SOA_COLUMN(InnerParamTPCDe, innerParamTPCDe, float); -DECLARE_SOA_COLUMN(SignalTPCPi, signalTPCPi, float); -DECLARE_SOA_COLUMN(InnerParamTPCPi, innerParamTPCPi, float); -DECLARE_SOA_COLUMN(NClsTPCDe, nClsTPCDe, uint8_t); -DECLARE_SOA_COLUMN(NSigmaTPCDe, nSigmaTPCDe, float); -DECLARE_SOA_COLUMN(NSigmaTPCPi, nSigmaTPCPi, float); -DECLARE_SOA_COLUMN(Chi2TPCDe, chi2TPCDe, float); -DECLARE_SOA_COLUMN(Chi2TPCPi, chi2TPCPi, float); -DECLARE_SOA_COLUMN(MassTOFDe, massTOFDe, float); -DECLARE_SOA_COLUMN(MassTOFPi, massTOFPi, float); -DECLARE_SOA_COLUMN(PidTrkDe, pidTrkDe, uint32_t); -DECLARE_SOA_COLUMN(PidTrkPi, pidTrkPi, uint32_t); - -DECLARE_SOA_COLUMN(ItsClusterSizeDe, itsClusterSizeDe, uint32_t); -DECLARE_SOA_COLUMN(ItsClusterSizePi, itsClusterSizePi, uint32_t); - -DECLARE_SOA_COLUMN(SharedClustersDe, sharedClustersDe, uint8_t); -DECLARE_SOA_COLUMN(SharedClustersPi, sharedClustersPi, uint8_t); - -DECLARE_SOA_COLUMN(IsBkgUS, isBkgUS, bool); -DECLARE_SOA_COLUMN(IsBkgEM, isBkgEM, bool); - -DECLARE_SOA_COLUMN(CollisionId, collisionId, int64_t); -DECLARE_SOA_COLUMN(ZVertex, zVertex, float); -DECLARE_SOA_COLUMN(Multiplicity, multiplicity, uint16_t); -DECLARE_SOA_COLUMN(CentFT0C, centFT0C, float); -DECLARE_SOA_COLUMN(MultiplicityFT0C, multiplicityFT0C, float); - -} // namespace pion_deuteron_tables - -DECLARE_SOA_TABLE(PionDeuteronTable, "AOD", "PIDEUTERONTABLE", - pion_deuteron_tables::PtDe, - pion_deuteron_tables::EtaDe, - pion_deuteron_tables::PhiDe, - pion_deuteron_tables::PtPi, - pion_deuteron_tables::EtaPi, - pion_deuteron_tables::PhiPi, - pion_deuteron_tables::DcaxyDe, - pion_deuteron_tables::DcazDe, - pion_deuteron_tables::DcaxyPi, - pion_deuteron_tables::DcazPi, - pion_deuteron_tables::SignalTPCDe, - pion_deuteron_tables::InnerParamTPCDe, - pion_deuteron_tables::SignalTPCPi, - pion_deuteron_tables::InnerParamTPCPi, - pion_deuteron_tables::NClsTPCDe, - pion_deuteron_tables::NSigmaTPCDe, - pion_deuteron_tables::NSigmaTPCPi, - pion_deuteron_tables::Chi2TPCDe, - pion_deuteron_tables::Chi2TPCPi, - pion_deuteron_tables::MassTOFDe, - pion_deuteron_tables::MassTOFPi, - pion_deuteron_tables::PidTrkDe, - pion_deuteron_tables::PidTrkPi, - pion_deuteron_tables::ItsClusterSizeDe, - pion_deuteron_tables::ItsClusterSizePi, - pion_deuteron_tables::SharedClustersDe, - pion_deuteron_tables::SharedClustersPi, - pion_deuteron_tables::IsBkgUS, - pion_deuteron_tables::IsBkgEM) -DECLARE_SOA_TABLE(PionDeuteronMult, "AOD", "PIDEUTERONMULT", - pion_deuteron_tables::CollisionId, - pion_deuteron_tables::ZVertex, - pion_deuteron_tables::Multiplicity, - pion_deuteron_tables::CentFT0C, - pion_deuteron_tables::MultiplicityFT0C) - -} // namespace o2::aod - -#endif // PWGCF_FEMTO_DATAMODEL_PIONDEUTERONTABLES_H_ diff --git a/PWGCF/Femto/DataModel/PionNucleiTables.h b/PWGCF/Femto/DataModel/PionNucleiTables.h new file mode 100644 index 00000000000..7b7b534fb1d --- /dev/null +++ b/PWGCF/Femto/DataModel/PionNucleiTables.h @@ -0,0 +1,133 @@ +// 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 PionNucleiTables.h +/// \brief Slim tables for piNuclei +/// \author CMY +/// \date 2025-04-10 + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" + +#ifndef PWGCF_FEMTO_DATAMODEL_PIONNUCLEITABLES_H_ +#define PWGCF_FEMTO_DATAMODEL_PIONNUCLEITABLES_H_ + +namespace o2::aod +{ +namespace pion_nuclei_tables +{ + +DECLARE_SOA_COLUMN(PtNu, ptNu, float); +DECLARE_SOA_COLUMN(EtaNu, etaNu, float); +DECLARE_SOA_COLUMN(PhiNu, phiNu, float); +DECLARE_SOA_COLUMN(PtHyp, ptHyp, float); +DECLARE_SOA_COLUMN(EtaHyp, etaHyp, float); +DECLARE_SOA_COLUMN(PhiHyp, phiHyp, float); +DECLARE_SOA_COLUMN(PtPi, ptPi, float); +DECLARE_SOA_COLUMN(EtaPi, etaPi, float); +DECLARE_SOA_COLUMN(PhiPi, phiPi, float); + +DECLARE_SOA_COLUMN(DcaxyNu, dcaxyNu, float); +DECLARE_SOA_COLUMN(DcazNu, dcazNu, float); +DECLARE_SOA_COLUMN(DcaxyPi, dcaxyPi, float); +DECLARE_SOA_COLUMN(DcazPi, dcazPi, float); + +DECLARE_SOA_COLUMN(SignalTPCNu, signalTPCNu, float); +DECLARE_SOA_COLUMN(InnerParamTPCNu, innerParamTPCNu, float); +DECLARE_SOA_COLUMN(SignalTPCPi, signalTPCPi, float); +DECLARE_SOA_COLUMN(InnerParamTPCPi, innerParamTPCPi, float); +DECLARE_SOA_COLUMN(NClsTPCNu, nClsTPCNu, uint8_t); +DECLARE_SOA_COLUMN(NSigmaTPCNu, nSigmaTPCNu, float); +DECLARE_SOA_COLUMN(NSigmaTPCPi, nSigmaTPCPi, float); +DECLARE_SOA_COLUMN(Chi2TPCNu, chi2TPCNu, float); +DECLARE_SOA_COLUMN(Chi2TPCPi, chi2TPCPi, float); +DECLARE_SOA_COLUMN(MassTOFNu, massTOFNu, float); +DECLARE_SOA_COLUMN(MassTOFPi, massTOFPi, float); +DECLARE_SOA_COLUMN(PidTrkNu, pidTrkNu, uint32_t); +DECLARE_SOA_COLUMN(PidTrkPi, pidTrkPi, uint32_t); + +DECLARE_SOA_COLUMN(ItsClusterSizeNu, itsClusterSizeNu, uint32_t); +DECLARE_SOA_COLUMN(ItsClusterSizePi, itsClusterSizePi, uint32_t); + +DECLARE_SOA_COLUMN(SharedClustersNu, sharedClustersNu, uint8_t); +DECLARE_SOA_COLUMN(SharedClustersPi, sharedClustersPi, uint8_t); + +DECLARE_SOA_COLUMN(IsBkgUS, isBkgUS, bool); +DECLARE_SOA_COLUMN(IsBkgEM, isBkgEM, bool); + +DECLARE_SOA_COLUMN(CollisionId, collisionId, int64_t); +DECLARE_SOA_COLUMN(ZVertex, zVertex, float); +DECLARE_SOA_COLUMN(Multiplicity, multiplicity, uint16_t); +DECLARE_SOA_COLUMN(CentFT0C, centFT0C, float); +DECLARE_SOA_COLUMN(MultiplicityFT0C, multiplicityFT0C, float); + +} // namespace pion_nuclei_tables + +DECLARE_SOA_TABLE(PionNucleiTable, "AOD", "PINUCLEITABLE", + pion_nuclei_tables::PtNu, + pion_nuclei_tables::EtaNu, + pion_nuclei_tables::PhiNu, + pion_nuclei_tables::PtPi, + pion_nuclei_tables::EtaPi, + pion_nuclei_tables::PhiPi, + pion_nuclei_tables::DcaxyNu, + pion_nuclei_tables::DcazNu, + pion_nuclei_tables::DcaxyPi, + pion_nuclei_tables::DcazPi, + pion_nuclei_tables::SignalTPCNu, + pion_nuclei_tables::InnerParamTPCNu, + pion_nuclei_tables::SignalTPCPi, + pion_nuclei_tables::InnerParamTPCPi, + pion_nuclei_tables::NClsTPCNu, + pion_nuclei_tables::NSigmaTPCNu, + pion_nuclei_tables::NSigmaTPCPi, + pion_nuclei_tables::Chi2TPCNu, + pion_nuclei_tables::Chi2TPCPi, + pion_nuclei_tables::MassTOFNu, + pion_nuclei_tables::MassTOFPi, + pion_nuclei_tables::PidTrkNu, + pion_nuclei_tables::PidTrkPi, + pion_nuclei_tables::ItsClusterSizeNu, + pion_nuclei_tables::ItsClusterSizePi, + pion_nuclei_tables::SharedClustersNu, + pion_nuclei_tables::SharedClustersPi, + pion_nuclei_tables::IsBkgUS, + pion_nuclei_tables::IsBkgEM) +DECLARE_SOA_TABLE(PionHyperTable, "AOD", "PIHYPERTABLE", + pion_nuclei_tables::PtHyp, + pion_nuclei_tables::EtaHyp, + pion_nuclei_tables::PhiHyp, + pion_nuclei_tables::PtPi, + pion_nuclei_tables::EtaPi, + pion_nuclei_tables::PhiPi, + pion_nuclei_tables::DcaxyPi, + pion_nuclei_tables::DcazPi, + pion_nuclei_tables::SignalTPCPi, + pion_nuclei_tables::InnerParamTPCPi, + pion_nuclei_tables::NSigmaTPCPi, + pion_nuclei_tables::Chi2TPCPi, + pion_nuclei_tables::MassTOFPi, + pion_nuclei_tables::PidTrkPi, + pion_nuclei_tables::ItsClusterSizePi, + pion_nuclei_tables::SharedClustersPi, + pion_nuclei_tables::IsBkgUS, + pion_nuclei_tables::IsBkgEM) +DECLARE_SOA_TABLE(PionNucleiMult, "AOD", "PINUCLEIMULT", + pion_nuclei_tables::CollisionId, + pion_nuclei_tables::ZVertex, + pion_nuclei_tables::Multiplicity, + pion_nuclei_tables::CentFT0C, + pion_nuclei_tables::MultiplicityFT0C) + +} // namespace o2::aod + +#endif // PWGCF_FEMTO_DATAMODEL_PIONNUCLEITABLES_H_ diff --git a/PWGCF/Femto/TableProducer/CMakeLists.txt b/PWGCF/Femto/TableProducer/CMakeLists.txt index 10a75557174..4c6576278a5 100644 --- a/PWGCF/Femto/TableProducer/CMakeLists.txt +++ b/PWGCF/Femto/TableProducer/CMakeLists.txt @@ -9,7 +9,7 @@ # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. -o2physics_add_dpl_workflow(pideuteronfemto - SOURCES PiDeuteronFemto.cxx +o2physics_add_dpl_workflow(pinucleifemto + SOURCES PiNucleiFemto.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) diff --git a/PWGCF/Femto/TableProducer/PiDeuteronFemto.cxx b/PWGCF/Femto/TableProducer/PiNucleiFemto.cxx similarity index 67% rename from PWGCF/Femto/TableProducer/PiDeuteronFemto.cxx rename to PWGCF/Femto/TableProducer/PiNucleiFemto.cxx index 6eaf78e8036..ca56171858d 100644 --- a/PWGCF/Femto/TableProducer/PiDeuteronFemto.cxx +++ b/PWGCF/Femto/TableProducer/PiNucleiFemto.cxx @@ -10,13 +10,14 @@ // or submit itself to any jurisdiction. // -/// \file PiDeuteronFemto.cxx -/// \brief Analysis task for Deuteron-Pion femto analysis +/// \file PiNucleiFemto.cxx +/// \brief Analysis task for Nuclei-Pion femto analysis /// \author CMY /// \date 2025-04-10 -#include "PWGCF/Femto/DataModel/PionDeuteronTables.h" +#include "PWGCF/Femto/DataModel/PionNucleiTables.h" #include "PWGLF/DataModel/EPCalibrationTables.h" +#include "PWGLF/DataModel/LFHypernucleiTables.h" #include "PWGLF/Utils/svPoolCreator.h" #include "Common/Core/PID/PIDTOF.h" @@ -90,61 +91,62 @@ enum Selections { } // namespace -struct PiDecandidate { +struct PiNucandidate { - float recoPtDe() const { return signDe * std::hypot(momDe[0], momDe[1]); } - float recoPhiDe() const { return std::atan2(momDe[1], momDe[0]); } - float recoEtaDe() const { return std::asinh(momDe[2] / std::abs(recoPtDe())); } + float recoPtNu() const { return signNu * std::hypot(momNu[0], momNu[1]); } + float recoPhiNu() const { return std::atan2(momNu[1], momNu[0]); } + float recoEtaNu() const { return std::asinh(momNu[2] / std::abs(recoPtNu())); } float recoPtPi() const { return signPi * std::hypot(momPi[0], momPi[1]); } float recoPhiPi() const { return std::atan2(momPi[1], momPi[0]); } float recoEtaPi() const { return std::asinh(momPi[2] / std::abs(recoPtPi())); } - std::array momDe = {99.f, 99.f, 99.f}; + std::array momNu = {99.f, 99.f, 99.f}; std::array momPi = {99.f, 99.f, 99.f}; - float signDe = 1.f; + float signNu = 1.f; float signPi = 1.f; float invMass = -10.f; - float dcaxyDe = -10.f; - float dcazDe = -10.f; + float dcaxyNu = -10.f; + float dcazNu = -10.f; float dcaxyPi = -10.f; float dcazPi = -10.f; - uint16_t tpcSignalDe = 0u; + uint16_t tpcSignalNu = 0u; uint16_t tpcSignalPi = 0u; - float momDeTPC = -99.f; + float momNuTPC = -99.f; float momPiTPC = -99.f; - uint8_t nTPCClustersDe = 0u; - uint8_t sharedClustersDe = 0u; + uint8_t nTPCClustersNu = 0u; + uint8_t sharedClustersNu = 0u; uint8_t sharedClustersPi = 0u; - float chi2TPCDe = -10.f; + float chi2TPCNu = -10.f; float chi2TPCPi = -10.f; - float nSigmaDe = -10.f; + float nSigmaNu = -10.f; float nSigmaPi = -10.f; - uint32_t pidTrkDe = 0xFFFFF; // PID in tracking + uint32_t pidTrkNu = 0xFFFFF; // PID in tracking uint32_t pidTrkPi = 0xFFFFF; - float massTOFDe = -10; + float massTOFNu = -10; float massTOFPi = -10; - uint32_t itsClSizeDe = 0u; + uint32_t itsClSizeNu = 0u; uint32_t itsClSizePi = 0u; - uint8_t nClsItsDe = 0u; + uint8_t nClsItsNu = 0u; uint8_t nClsItsPi = 0u; bool isBkgUS = false; // unlike sign bool isBkgEM = false; // event mixing - int trackIDDe = -1; + int trackIDNu = -1; int trackIDPi = -1; // collision information int32_t collisionID = 0; }; -struct PiDeuteronFemto { +struct PiNucleiFemto { - Produces mOutputDataTable; - Produces mOutputMultiplicityTable; + Produces mOutputDataTable; + Produces mOutputHyperDataTable; + Produces mOutputMultiplicityTable; // Selections Configurable settingCutVertex{"settingCutVertex", 10.0f, "Accepted z-vertex range"}; @@ -199,6 +201,7 @@ struct PiDeuteronFemto { Configurable settingMaterialCorrection{"settingMaterialCorrection", static_cast(o2::base::Propagator::MatCorrType::USEMatCorrNONE), "Material correction type"}; Preslice mPerCol = aod::track::collisionId; + PresliceUnsorted hypPerCol = o2::aod::hyperrec::collisionId; // binning for EM background ConfigurableAxis axisVertex{"axisVertex", {30, -10, 10}, "Binning for multiplicity"}; @@ -213,6 +216,7 @@ struct PiDeuteronFemto { std::vector mRecoCollisionIDs; std::vector mGoodCollisions; std::vector mTrackPairs; + std::vector mTrackHypPairs; o2::vertexing::DCAFitterN<2> mFitter; int mRunNumber; @@ -228,31 +232,31 @@ struct PiDeuteronFemto { {"hTrackSel", "Accepted tracks", {HistType::kTH1F, {{Selections::kAll, -0.5, static_cast(Selections::kAll) - 0.5}}}}, {"hEvents", "; Events;", {HistType::kTH1F, {{3, -0.5, 2.5}}}}, {"hEmptyPool", "svPoolCreator did not find track pairs false/true", {HistType::kTH1F, {{2, -0.5, 1.5}}}}, - {"hdcaxyDe", ";DCA_{xy} (cm)", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}}, - {"hdcazDe", ";DCA_{z} (cm)", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}}, - {"hdcazDe_min", ";DCA_{z}-min (cm)", {HistType::kTH1F, {{20, -1.0f, 1.0f}}}}, - {"hNClsDeITS", ";N_{ITS} Cluster", {HistType::kTH1F, {{20, -10.0f, 10.0f}}}}, + {"hdcaxyNu", ";DCA_{xy} (cm)", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}}, + {"hdcazNu", ";DCA_{z} (cm)", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}}, + {"hdcazNu_min", ";DCA_{z}-min (cm)", {HistType::kTH1F, {{20, -1.0f, 1.0f}}}}, + {"hNClsNuITS", ";N_{ITS} Cluster", {HistType::kTH1F, {{20, -10.0f, 10.0f}}}}, {"hNClsPiITS", ";N_{ITS} Cluster", {HistType::kTH1F, {{20, -10.0f, 10.0f}}}}, - {"hDePitInvMass", "; M(De + p) (GeV/#it{c}^{2})", {HistType::kTH1F, {{300, 3.74f, 4.34f}}}}, - {"hDePt", "#it{p}_{T} distribution; #it{p}_{T} (GeV/#it{c})", {HistType::kTH1F, {{240, -6.0f, 6.0f}}}}, + {"hNuPitInvMass", "; M(Nu + p) (GeV/#it{c}^{2})", {HistType::kTH1F, {{300, 3.74f, 4.34f}}}}, + {"hNuPt", "#it{p}_{T} distribution; #it{p}_{T} (GeV/#it{c})", {HistType::kTH1F, {{240, -6.0f, 6.0f}}}}, {"hPiPt", "Pt distribution; #it{p}_{T} (GeV/#it{c})", {HistType::kTH1F, {{120, -3.0f, 3.0f}}}}, - {"hDeEta", "eta distribution; #eta(De)", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}}, + {"hNuEta", "eta distribution; #eta(Nu)", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}}, {"hPiEta", "eta distribution; #eta(#pi)", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}}, - {"hDePhi", "phi distribution; phi(De)", {HistType::kTH1F, {{600, -4.0f, 4.0f}}}}, + {"hNuPhi", "phi distribution; phi(Nu)", {HistType::kTH1F, {{600, -4.0f, 4.0f}}}}, {"hPiPhi", "phi distribution; phi(#pi)", {HistType::kTH1F, {{600, -4.0f, 4.0f}}}}, - {"h2dEdxDecandidates", "dEdx distribution; #it{p} (GeV/#it{c}); dE/dx (a.u.)", {HistType::kTH2F, {{200, -5.0f, 5.0f}, {100, 0.0f, 2000.0f}}}}, + {"h2dEdxNucandidates", "dEdx distribution; #it{p} (GeV/#it{c}); dE/dx (a.u.)", {HistType::kTH2F, {{200, -5.0f, 5.0f}, {100, 0.0f, 2000.0f}}}}, {"h2dEdx", "dEdx distribution; #it{p} (GeV/#it{c}); dE/dx (a.u.)", {HistType::kTH2F, {{200, -5.0f, 5.0f}, {100, 0.0f, 2000.0f}}}}, - {"h2NsigmaDeTPC", "NsigmaDe TPC distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}(De)", {HistType::kTH2F, {{100, -2.0f, 2.0f}, {200, -5.0f, 5.0f}}}}, - {"h2NsigmaDeComb", "NsigmaDe TPCTOF comb distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{comb}(De)", {HistType::kTH2F, {{100, -2.0f, 2.0f}, {100, 0.0f, 5.0f}}}}, + {"h2NsigmaNuTPC", "NsigmaNu TPC distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}(Nu)", {HistType::kTH2F, {{100, -2.0f, 2.0f}, {200, -5.0f, 5.0f}}}}, + {"h2NsigmaNuComb", "NsigmaNu TPCTOF comb distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{comb}(Nu)", {HistType::kTH2F, {{100, -2.0f, 2.0f}, {100, 0.0f, 5.0f}}}}, {"h2NsigmaPiComb", "NsigmaPi TPCTOF comb distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{comb}(#pi)", {HistType::kTH2F, {{100, -2.0f, 2.0f}, {100, 0.0f, 5.0f}}}}, - {"h2NsigmaDeTPC_preselection", "NsigmaDe TPC distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}(De)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {400, -10.0f, 10.0f}}}}, - {"h2NsigmaDeTPC_preselecComp", "NsigmaDe TPC distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}(De)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {400, -10.0f, 10.0f}}}}, - {"h2NSigmaDeITS_preselection", "NsigmaDe ITS distribution; signed #it{p}_{T} (GeV/#it{c}); n#sigma_{ITS} De", {HistType::kTH2F, {{50, -5.0f, 5.0f}, {120, -3.0f, 3.0f}}}}, - {"h2NSigmaDeITS", "NsigmaDe ITS distribution; signed #it{p}_{T} (GeV/#it{c}); n#sigma_{ITS} De", {HistType::kTH2F, {{100, -2.0f, 2.0f}, {120, -3.0f, 3.0f}}}}, + {"h2NsigmaNuTPC_preselection", "NsigmaNu TPC distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}(Nu)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {400, -10.0f, 10.0f}}}}, + {"h2NsigmaNuTPC_preselecComp", "NsigmaNu TPC distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}(Nu)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {400, -10.0f, 10.0f}}}}, + {"h2NSigmaNuITS_preselection", "NsigmaNu ITS distribution; signed #it{p}_{T} (GeV/#it{c}); n#sigma_{ITS} Nu", {HistType::kTH2F, {{50, -5.0f, 5.0f}, {120, -3.0f, 3.0f}}}}, + {"h2NSigmaNuITS", "NsigmaNu ITS distribution; signed #it{p}_{T} (GeV/#it{c}); n#sigma_{ITS} Nu", {HistType::kTH2F, {{100, -2.0f, 2.0f}, {120, -3.0f, 3.0f}}}}, {"h2NsigmaPiTPC", "NsigmaPi TPC distribution; #it{p}_{T}(GeV/#it{c}); n#sigma_{TPC}(p)", {HistType::kTH2F, {{200, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}}}, - {"h2NsigmaPiTPC_preselection", "NsigmaDe TPC distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}(De)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {400, -10.0f, 10.0f}}}}, + {"h2NsigmaPiTPC_preselection", "NsigmaNu TPC distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}(Nu)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {400, -10.0f, 10.0f}}}}, {"h2NsigmaPiTOF", "NsigmaPi TOF distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}(p)", {HistType::kTH2F, {{200, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}}}, - {"h2NsigmaDeTOF", "NsigmaDe TOF distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}(De)", {HistType::kTH2F, {{200, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}}}, + {"h2NsigmaNuTOF", "NsigmaNu TOF distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}(Nu)", {HistType::kTH2F, {{200, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}}}, {"h2NsigmaPiTOF_preselection", "NsigmaPi TOF distribution; #iit{p}_{T} (GeV/#it{c}); n#sigma_{TOF}(p)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {400, -10.0f, 10.0f}}}}, {"hkStar_LS_M", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}}, {"hkStar_LS_A", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}}, @@ -450,8 +454,8 @@ struct PiDeuteronFemto { tpcNSigmaDe = candidate.tpcNSigmaDe(); } - mQaRegistry.fill(HIST("h2NsigmaDeTPC_preselection"), candidate.sign() * candidate.pt(), tpcNSigmaDe); - mQaRegistry.fill(HIST("h2NsigmaDeTPC_preselecComp"), candidate.sign() * candidate.pt(), candidate.tpcNSigmaDe()); + mQaRegistry.fill(HIST("h2NsigmaNuTPC_preselection"), candidate.sign() * candidate.pt(), tpcNSigmaDe); + mQaRegistry.fill(HIST("h2NsigmaNuTPC_preselecComp"), candidate.sign() * candidate.pt(), candidate.tpcNSigmaDe()); if (std::abs(candidate.pt()) < settingCutDeptMin || std::abs(candidate.pt()) > settingCutDeptMax) return false; if (candidate.hasTOF() && candidate.tpcInnerParam() > settingCutPinMinTOFITSDe) { @@ -460,10 +464,10 @@ struct PiDeuteronFemto { if (combNsigma > settingCutNsigmaTOFTPCDe) { return false; } - mQaRegistry.fill(HIST("h2dEdxDecandidates"), candidate.sign() * tpcInnerParam, candidate.tpcSignal()); - mQaRegistry.fill(HIST("h2NsigmaDeComb"), candidate.sign() * candidate.pt(), combNsigma); - mQaRegistry.fill(HIST("h2NsigmaDeTPC"), candidate.sign() * candidate.pt(), tpcNSigmaDe); - mQaRegistry.fill(HIST("h2NsigmaDeTOF"), candidate.sign() * candidate.pt(), tofNSigmaDe); + mQaRegistry.fill(HIST("h2dEdxNucandidates"), candidate.sign() * tpcInnerParam, candidate.tpcSignal()); + mQaRegistry.fill(HIST("h2NsigmaNuComb"), candidate.sign() * candidate.pt(), combNsigma); + mQaRegistry.fill(HIST("h2NsigmaNuTPC"), candidate.sign() * candidate.pt(), tpcNSigmaDe); + mQaRegistry.fill(HIST("h2NsigmaNuTOF"), candidate.sign() * candidate.pt(), tofNSigmaDe); return true; } else if (candidate.tpcInnerParam() <= settingCutPinMinTOFITSDe) { if (std::abs(tpcNSigmaDe) > settingCutNsigmaTPCDe) { @@ -471,14 +475,14 @@ struct PiDeuteronFemto { } o2::aod::ITSResponse mResponseITS; auto itsnSigmaDe = mResponseITS.nSigmaITS(candidate.itsClusterSizes(), candidate.p(), candidate.eta()); - mQaRegistry.fill(HIST("h2NSigmaDeITS_preselection"), candidate.sign() * candidate.pt(), itsnSigmaDe); + mQaRegistry.fill(HIST("h2NSigmaNuITS_preselection"), candidate.sign() * candidate.pt(), itsnSigmaDe); if (std::abs(itsnSigmaDe) > settingCutNsigmaITSDe) { return false; } - mQaRegistry.fill(HIST("h2NsigmaDeTPC"), candidate.sign() * candidate.pt(), tpcNSigmaDe); - mQaRegistry.fill(HIST("h2NSigmaDeITS"), candidate.sign() * candidate.pt(), itsnSigmaDe); - // mQaRegistry.fill(HIST("h2NsigmaDeComb"), candidate.sign() * candidate.pt(), combNsigma); - mQaRegistry.fill(HIST("h2dEdxDecandidates"), candidate.sign() * tpcInnerParam, candidate.tpcSignal()); + mQaRegistry.fill(HIST("h2NsigmaNuTPC"), candidate.sign() * candidate.pt(), tpcNSigmaDe); + mQaRegistry.fill(HIST("h2NSigmaNuITS"), candidate.sign() * candidate.pt(), itsnSigmaDe); + // mQaRegistry.fill(HIST("h2NsigmaNuComb"), candidate.sign() * candidate.pt(), combNsigma); + mQaRegistry.fill(HIST("h2dEdxNucandidates"), candidate.sign() * tpcInnerParam, candidate.tpcSignal()); return true; } return false; @@ -487,7 +491,7 @@ struct PiDeuteronFemto { // ================================================================================================================== template - bool fillCandidateInfo(const Ttrack& trackDe, const Ttrack& trackPi, const CollBracket& collBracket, const Tcollisions& collisions, PiDecandidate& piDecand, const Ttracks& /*trackTable*/, bool isMixedEvent) + bool fillCandidateInfo(const Ttrack& trackDe, const Ttrack& trackPi, const CollBracket& collBracket, const Tcollisions& collisions, PiNucandidate& piNucand, const Ttracks& /*trackTable*/, bool isMixedEvent) { const int numCoordinates = 3; if (!isMixedEvent) { @@ -525,79 +529,147 @@ struct PiDeuteronFemto { if (!mGoodCollisions[collIdxMin]) { return false; } - piDecand.collisionID = collIdxMin; + piNucand.collisionID = collIdxMin; } else { - piDecand.collisionID = collBracket.getMin(); + piNucand.collisionID = collBracket.getMin(); } - piDecand.momDe = std::array{trackDe.px(), trackDe.py(), trackDe.pz()}; - piDecand.momPi = std::array{trackPi.px(), trackPi.py(), trackPi.pz()}; + piNucand.momNu = std::array{trackDe.px(), trackDe.py(), trackDe.pz()}; + piNucand.momPi = std::array{trackPi.px(), trackPi.py(), trackPi.pz()}; float invMass = 0; - invMass = RecoDecay::m(std::array{piDecand.momDe, piDecand.momPi}, std::array{o2::constants::physics::MassDeuteron, o2::constants::physics::MassPiPlus}); + invMass = RecoDecay::m(std::array{piNucand.momNu, piNucand.momPi}, std::array{o2::constants::physics::MassDeuteron, o2::constants::physics::MassPiPlus}); if (settingCutInvMass > 0 && invMass > settingCutInvMass) { return false; } - float ptDePi = std::hypot(piDecand.momDe[0] + piDecand.momPi[0], piDecand.momDe[1] + piDecand.momPi[1]); + float ptDePi = std::hypot(piNucand.momNu[0] + piNucand.momPi[0], piNucand.momNu[1] + piNucand.momPi[1]); if (ptDePi < settingCutPtMinDePi) { return false; } - piDecand.signDe = trackDe.sign(); - piDecand.signPi = trackPi.sign(); + piNucand.signNu = trackDe.sign(); + piNucand.signPi = trackPi.sign(); - piDecand.dcaxyDe = trackDe.dcaXY(); - piDecand.dcaxyPi = trackPi.dcaXY(); + piNucand.dcaxyNu = trackDe.dcaXY(); + piNucand.dcaxyPi = trackPi.dcaXY(); - piDecand.dcazDe = trackDe.dcaZ(); - piDecand.dcazPi = trackPi.dcaZ(); + piNucand.dcazNu = trackDe.dcaZ(); + piNucand.dcazPi = trackPi.dcaZ(); - piDecand.tpcSignalDe = trackDe.tpcSignal(); - piDecand.momDeTPC = trackDe.tpcInnerParam(); - piDecand.tpcSignalPi = trackPi.tpcSignal(); - piDecand.momPiTPC = trackPi.tpcInnerParam(); + piNucand.tpcSignalNu = trackDe.tpcSignal(); + piNucand.momNuTPC = trackDe.tpcInnerParam(); + piNucand.tpcSignalPi = trackPi.tpcSignal(); + piNucand.momPiTPC = trackPi.tpcInnerParam(); - piDecand.nTPCClustersDe = trackDe.tpcNClsFound(); - piDecand.nSigmaDe = computeNSigmaDe(trackDe); - piDecand.nSigmaPi = trackPi.tpcNSigmaPi(); + piNucand.nTPCClustersNu = trackDe.tpcNClsFound(); + piNucand.nSigmaNu = computeNSigmaDe(trackDe); + piNucand.nSigmaPi = trackPi.tpcNSigmaPi(); - piDecand.chi2TPCDe = trackDe.tpcChi2NCl(); - piDecand.chi2TPCPi = trackPi.tpcChi2NCl(); + piNucand.chi2TPCNu = trackDe.tpcChi2NCl(); + piNucand.chi2TPCPi = trackPi.tpcChi2NCl(); - piDecand.pidTrkDe = trackDe.pidForTracking(); - piDecand.pidTrkPi = trackPi.pidForTracking(); + piNucand.pidTrkNu = trackDe.pidForTracking(); + piNucand.pidTrkPi = trackPi.pidForTracking(); - piDecand.itsClSizeDe = trackDe.itsClusterSizes(); - piDecand.itsClSizePi = trackPi.itsClusterSizes(); + piNucand.itsClSizeNu = trackDe.itsClusterSizes(); + piNucand.itsClSizePi = trackPi.itsClusterSizes(); - piDecand.nClsItsDe = trackDe.itsNCls(); - piDecand.nClsItsPi = trackPi.itsNCls(); + piNucand.nClsItsNu = trackDe.itsNCls(); + piNucand.nClsItsPi = trackPi.itsNCls(); - piDecand.sharedClustersDe = trackDe.tpcNClsShared(); - piDecand.sharedClustersPi = trackPi.tpcNClsShared(); + piNucand.sharedClustersNu = trackDe.tpcNClsShared(); + piNucand.sharedClustersPi = trackPi.tpcNClsShared(); - piDecand.isBkgUS = trackDe.sign() * trackPi.sign() < 0; - piDecand.isBkgEM = isMixedEvent; + piNucand.isBkgUS = trackDe.sign() * trackPi.sign() < 0; + piNucand.isBkgEM = isMixedEvent; - piDecand.invMass = invMass; + piNucand.invMass = invMass; - piDecand.trackIDDe = trackDe.globalIndex(); - piDecand.trackIDPi = trackPi.globalIndex(); + piNucand.trackIDNu = trackDe.globalIndex(); + piNucand.trackIDPi = trackPi.globalIndex(); if (trackDe.hasTOF()) { float beta = o2::pid::tof::Beta::GetBeta(trackDe); beta = std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked float tpcInnerParamDe = trackDe.tpcInnerParam(); - piDecand.massTOFDe = tpcInnerParamDe * std::sqrt(1.f / (beta * beta) - 1.f); + piNucand.massTOFNu = tpcInnerParamDe * std::sqrt(1.f / (beta * beta) - 1.f); } if (trackPi.hasTOF()) { float beta = o2::pid::tof::Beta::GetBeta(trackPi); beta = std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked - piDecand.massTOFPi = trackPi.tpcInnerParam() * std::sqrt(1.f / (beta * beta) - 1.f); + piNucand.massTOFPi = trackPi.tpcInnerParam() * std::sqrt(1.f / (beta * beta) - 1.f); } return true; } + template + bool fillCandidateInfoHyper(const aod::DataHypCandsWColl::iterator& V0Hyper, const Ttrack& trackPi, PiNucandidate& piHypercand, bool isMixedEvent) + { + piHypercand.collisionID = V0Hyper.collisionId(); + // get hypertriton information + // constexpr double mHe3 = o2::constants::physics::MassHelium3; + // constexpr double mPi = o2::constants::physics::MassPiPlus; + // --- He3 + float pxHe3 = V0Hyper.ptHe3() * std::cos(V0Hyper.phiHe3()); + float pyHe3 = V0Hyper.ptHe3() * std::sin(V0Hyper.phiHe3()); + float pzHe3 = V0Hyper.ptHe3() * std::sinh(V0Hyper.etaHe3()); + // float pHe3 = V0Hyper.ptHe3() * std::cosh(V0Hyper.etaHe3()); + // float enHe3 = std::sqrt(pHe3 * pHe3 + mHe3 * mHe3); + // --- pi + float pxPi = V0Hyper.ptPi() * std::cos(V0Hyper.phiPi()); + float pyPi = V0Hyper.ptPi() * std::sin(V0Hyper.phiPi()); + float pzPi = V0Hyper.ptPi() * std::sinh(V0Hyper.etaPi()); + // float pPi = V0Hyper.ptPi() * std::cosh(V0Hyper.etaPi()); + // float enPi = std::sqrt(pPi * pPi + mPi * mPi); + // --- hypertriton + float px = pxHe3 + pxPi; + float py = pyHe3 + pyPi; + float pz = pzHe3 + pzPi; + piHypercand.momNu = std::array{px, py, pz}; + piHypercand.momPi = std::array{trackPi.px(), trackPi.py(), trackPi.pz()}; + + float invMass = 0; + invMass = RecoDecay::m(std::array{piHypercand.momNu, piHypercand.momPi}, std::array{o2::constants::physics::MassHelium3, o2::constants::physics::MassPiPlus}); + if (settingCutInvMass > 0 && invMass > settingCutInvMass) { + return false; + } + float ptDePi = std::hypot(piHypercand.momNu[0] + piHypercand.momPi[0], piHypercand.momNu[1] + piHypercand.momPi[1]); + if (ptDePi < settingCutPtMinDePi) { + return false; + } + + piHypercand.signPi = trackPi.sign(); + if (V0Hyper.isMatter()) { + piHypercand.signNu = 1; + } else { + piHypercand.signNu = -1; + } + + piHypercand.dcaxyPi = trackPi.dcaXY(); + piHypercand.dcazPi = trackPi.dcaZ(); + piHypercand.tpcSignalPi = trackPi.tpcSignal(); + piHypercand.momPiTPC = trackPi.tpcInnerParam(); + piHypercand.nSigmaPi = trackPi.tpcNSigmaPi(); + piHypercand.chi2TPCPi = trackPi.tpcChi2NCl(); + piHypercand.pidTrkPi = trackPi.pidForTracking(); + piHypercand.itsClSizePi = trackPi.itsClusterSizes(); + piHypercand.nClsItsPi = trackPi.itsNCls(); + piHypercand.sharedClustersPi = trackPi.tpcNClsShared(); + + piHypercand.isBkgUS = piHypercand.signNu * trackPi.sign() < 0; + piHypercand.isBkgEM = isMixedEvent; + piHypercand.invMass = invMass; + + piHypercand.trackIDPi = trackPi.globalIndex(); + + if (trackPi.hasTOF()) { + float beta = o2::pid::tof::Beta::GetBeta(trackPi); + beta = std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked + piHypercand.massTOFPi = trackPi.tpcInnerParam() * std::sqrt(1.f / (beta * beta) - 1.f); + } + return true; + } + template void pairTracksSameEvent(const Ttrack& tracks) { @@ -645,6 +717,36 @@ struct PiDeuteronFemto { } } + template + void pairTracksSameEventHyper(const Ttrack& piTracks, const Thypers& V0Hypers) + { + for (const auto& piTrack : piTracks) { + + mQaRegistry.fill(HIST("hTrackSel"), Selections::kNoCuts); + + if (!selectTrack(piTrack)) { + continue; + } + mQaRegistry.fill(HIST("hTrackSel"), Selections::kTrackCuts); + + if (!selectionPIDPion(piTrack)) { + continue; + } + mQaRegistry.fill(HIST("hTrackSel"), Selections::kPID); + + for (const auto& V0Hyper : V0Hypers) { + + SVCand pair; + pair.tr0Idx = piTrack.globalIndex(); + pair.tr1Idx = V0Hyper.globalIndex(); + const int collIdx = V0Hyper.collisionId(); + CollBracket collBracket{collIdx, collIdx}; + pair.collBracket = collBracket; + mTrackHypPairs.push_back(pair); + } + } + } + template void pairTracksEventMixing(T& DeCands, T& pionCands) { @@ -669,38 +771,70 @@ struct PiDeuteronFemto { } template - void fillTable(const PiDecandidate& piDecand, const Tcoll& collision) + void fillTable(const PiNucandidate& piNucand, const Tcoll& collision) { mOutputDataTable( - piDecand.recoPtDe(), - piDecand.recoEtaDe(), - piDecand.recoPhiDe(), - piDecand.recoPtPi(), - piDecand.recoEtaPi(), - piDecand.recoPhiPi(), - piDecand.dcaxyDe, - piDecand.dcazDe, - piDecand.dcaxyPi, - piDecand.dcazPi, - piDecand.tpcSignalDe, - piDecand.momDeTPC, - piDecand.tpcSignalPi, - piDecand.momPiTPC, - piDecand.nTPCClustersDe, - piDecand.nSigmaDe, - piDecand.nSigmaPi, - piDecand.chi2TPCDe, - piDecand.chi2TPCPi, - piDecand.massTOFDe, - piDecand.massTOFPi, - piDecand.pidTrkDe, - piDecand.pidTrkPi, - piDecand.itsClSizeDe, - piDecand.itsClSizePi, - piDecand.sharedClustersDe, - piDecand.sharedClustersPi, - piDecand.isBkgUS, - piDecand.isBkgEM); + piNucand.recoPtNu(), + piNucand.recoEtaNu(), + piNucand.recoPhiNu(), + piNucand.recoPtPi(), + piNucand.recoEtaPi(), + piNucand.recoPhiPi(), + piNucand.dcaxyNu, + piNucand.dcazNu, + piNucand.dcaxyPi, + piNucand.dcazPi, + piNucand.tpcSignalNu, + piNucand.momNuTPC, + piNucand.tpcSignalPi, + piNucand.momPiTPC, + piNucand.nTPCClustersNu, + piNucand.nSigmaNu, + piNucand.nSigmaPi, + piNucand.chi2TPCNu, + piNucand.chi2TPCPi, + piNucand.massTOFNu, + piNucand.massTOFPi, + piNucand.pidTrkNu, + piNucand.pidTrkPi, + piNucand.itsClSizeNu, + piNucand.itsClSizePi, + piNucand.sharedClustersNu, + piNucand.sharedClustersPi, + piNucand.isBkgUS, + piNucand.isBkgEM); + if (settingFillMultiplicity) { + mOutputMultiplicityTable( + collision.globalIndex(), + collision.posZ(), + collision.numContrib(), + collision.centFT0C(), + collision.multFT0C()); + } + } + + template + void fillTableHyper(const PiNucandidate& piNucand, const Tcoll& collision) + { + mOutputHyperDataTable( + piNucand.recoPtNu(), + piNucand.recoEtaNu(), + piNucand.recoPhiNu(), + piNucand.recoPtPi(), + piNucand.recoEtaPi(), + piNucand.recoPhiPi(), + piNucand.dcaxyPi, + piNucand.dcazPi, + piNucand.tpcSignalPi, + piNucand.momPiTPC, + piNucand.nSigmaPi, + piNucand.chi2TPCPi, + piNucand.massTOFPi, + piNucand.pidTrkPi, + piNucand.itsClSizePi, + piNucand.sharedClustersPi, + piNucand.isBkgUS, + piNucand.isBkgEM); if (settingFillMultiplicity) { mOutputMultiplicityTable( collision.globalIndex(), @@ -711,21 +845,21 @@ struct PiDeuteronFemto { } } - void fillHistograms(const PiDecandidate& piDecand) + void fillHistograms(const PiNucandidate& piNucand) { - mQaRegistry.fill(HIST("hDePt"), piDecand.recoPtDe()); - mQaRegistry.fill(HIST("hPiPt"), piDecand.recoPtPi()); - mQaRegistry.fill(HIST("hDeEta"), piDecand.recoEtaDe()); - mQaRegistry.fill(HIST("hPiEta"), piDecand.recoEtaPi()); - mQaRegistry.fill(HIST("hDePhi"), piDecand.recoPhiDe()); - mQaRegistry.fill(HIST("hPiPhi"), piDecand.recoPhiPi()); - mQaRegistry.fill(HIST("hDePitInvMass"), piDecand.invMass); - mQaRegistry.fill(HIST("hdcaxyDe"), piDecand.dcaxyDe); - mQaRegistry.fill(HIST("hdcazDe"), piDecand.dcazDe); - mQaRegistry.fill(HIST("hdcazDe_min"), (abs(piDecand.dcazDe) - settingCutDeDCAzMin)); - mQaRegistry.fill(HIST("hNClsDeITS"), piDecand.nClsItsDe); - mQaRegistry.fill(HIST("hNClsPiITS"), piDecand.nClsItsPi); - mQaRegistry.fill(HIST("hisBkgEM"), piDecand.isBkgEM); + mQaRegistry.fill(HIST("hNuPt"), piNucand.recoPtNu()); + mQaRegistry.fill(HIST("hPiPt"), piNucand.recoPtPi()); + mQaRegistry.fill(HIST("hNuEta"), piNucand.recoEtaNu()); + mQaRegistry.fill(HIST("hPiEta"), piNucand.recoEtaPi()); + mQaRegistry.fill(HIST("hNuPhi"), piNucand.recoPhiNu()); + mQaRegistry.fill(HIST("hPiPhi"), piNucand.recoPhiPi()); + mQaRegistry.fill(HIST("hNuPitInvMass"), piNucand.invMass); + mQaRegistry.fill(HIST("hdcaxyNu"), piNucand.dcaxyNu); + mQaRegistry.fill(HIST("hdcazNu"), piNucand.dcazNu); + mQaRegistry.fill(HIST("hdcazNu_min"), (abs(piNucand.dcazNu) - settingCutDeDCAzMin)); + mQaRegistry.fill(HIST("hNClsNuITS"), piNucand.nClsItsNu); + mQaRegistry.fill(HIST("hNClsPiITS"), piNucand.nClsItsPi); + mQaRegistry.fill(HIST("hisBkgEM"), piNucand.isBkgEM); } double computePrTPCnsig(double InnerParamTPCHad, double SignalTPCHad) @@ -749,13 +883,13 @@ struct PiDeuteronFemto { return fNSigmaTOFHad; } - double computeKstar(const PiDecandidate& piDecand) + double computeKstar(const PiNucandidate& piNucand) { constexpr double massDe = o2::constants::physics::MassDeuteron; constexpr double massHad = o2::constants::physics::MassPiPlus; - const ROOT::Math::PtEtaPhiMVector De(std::abs(piDecand.recoPtDe()), piDecand.recoEtaDe(), piDecand.recoPhiDe(), massDe); - const ROOT::Math::PtEtaPhiMVector Had(std::abs(piDecand.recoPtPi()), piDecand.recoEtaPi(), piDecand.recoPhiPi(), massHad); + const ROOT::Math::PtEtaPhiMVector De(std::abs(piNucand.recoPtNu()), piNucand.recoEtaNu(), piNucand.recoPhiNu(), massDe); + const ROOT::Math::PtEtaPhiMVector Had(std::abs(piNucand.recoPtPi()), piNucand.recoEtaPi(), piNucand.recoPhiPi(), massHad); const ROOT::Math::PtEtaPhiMVector trackSum = De + Had; const float beta = trackSum.Beta(); @@ -774,28 +908,28 @@ struct PiDeuteronFemto { return 0.5 * RelKstar.P(); } - void fillKstar(const PiDecandidate& piDecand) + void fillKstar(const PiNucandidate& piNucand) { - double PrTPCnsigma = computePrTPCnsig(piDecand.momPiTPC, piDecand.tpcSignalPi); - double PrTOFnsigma = tofNSigmaCalculation(piDecand.massTOFPi, piDecand.recoPtPi()); + double PrTPCnsigma = computePrTPCnsig(piNucand.momPiTPC, piNucand.tpcSignalPi); + double PrTOFnsigma = tofNSigmaCalculation(piNucand.massTOFPi, piNucand.recoPtPi()); if (abs(PrTPCnsigma) < settingCutNsigTPCPrMin) return; if (abs(PrTOFnsigma) < settingCutNsigTOFPrMin) return; - float DeDCAxyMin = 0.015 + 0.0305 / TMath::Power(piDecand.recoPtDe(), 1.1); - if (abs(piDecand.dcaxyDe) > DeDCAxyMin || abs(piDecand.dcazDe) > settingCutDeDCAzMin || abs(piDecand.dcaxyPi) > settingCutPiDCAxyMin || abs(piDecand.dcazPi) > settingCutPiDCAzMin) + float DeDCAxyMin = 0.015 + 0.0305 / TMath::Power(piNucand.recoPtNu(), 1.1); + if (abs(piNucand.dcaxyNu) > DeDCAxyMin || abs(piNucand.dcazNu) > settingCutDeDCAzMin || abs(piNucand.dcaxyPi) > settingCutPiDCAxyMin || abs(piNucand.dcazPi) > settingCutPiDCAzMin) return; - fillHistograms(piDecand); + fillHistograms(piNucand); - double kstar = computeKstar(piDecand); - if (piDecand.isBkgUS == 0) { - if (piDecand.recoPtDe() > 0) { + double kstar = computeKstar(piNucand); + if (piNucand.isBkgUS == 0) { + if (piNucand.recoPtNu() > 0) { mQaRegistry.fill(HIST("hkStar_LS_M"), kstar); } else { mQaRegistry.fill(HIST("hkStar_LS_A"), kstar); } } else { - if (piDecand.recoPtDe() > 0) { + if (piNucand.recoPtNu() > 0) { mQaRegistry.fill(HIST("hkStar_US_M"), kstar); } else { mQaRegistry.fill(HIST("hkStar_US_A"), kstar); @@ -815,17 +949,39 @@ struct PiDeuteronFemto { auto piTrack = tracks.rawIteratorAt(trackPair.tr1Idx); auto collBracket = trackPair.collBracket; - PiDecandidate piDecand; - if (!fillCandidateInfo(deTrack, piTrack, collBracket, collisions, piDecand, tracks, isMixedEvent)) { + PiNucandidate piNucand; + if (!fillCandidateInfo(deTrack, piTrack, collBracket, collisions, piNucand, tracks, isMixedEvent)) { continue; } - fillKstar(piDecand); + fillKstar(piNucand); + + auto collision = collisions.rawIteratorAt(piNucand.collisionID); + + if (settingFillTable) { + fillTable(piNucand, collision); + } + } + } + + template + void fillPairsHyper(const Tcollisions& collisions, const Ttracks& piTracks, const o2::aod::DataHypCandsWColl& V0Hypers, const bool isMixedEvent) + { + for (const auto& trackPair : mTrackHypPairs) { + + auto v0hyper = V0Hypers.rawIteratorAt(trackPair.tr1Idx); + auto piTrack = piTracks.rawIteratorAt(trackPair.tr0Idx); + // auto collBracket = trackPair.collBracket; + + PiNucandidate piNucand; + if (!fillCandidateInfoHyper(v0hyper, piTrack, piNucand, isMixedEvent)) { + continue; + } - auto collision = collisions.rawIteratorAt(piDecand.collisionID); + auto collision = collisions.rawIteratorAt(piNucand.collisionID); if (settingFillTable) { - fillTable(piDecand, collision); + fillTableHyper(piNucand, collision); } } } @@ -859,7 +1015,38 @@ struct PiDeuteronFemto { fillPairs(collisions, tracks, /*isMixedEvent*/ false); } } - PROCESS_SWITCH(PiDeuteronFemto, processSameEvent, "Process Same event", false); + PROCESS_SWITCH(PiNucleiFemto, processSameEvent, "Process Same event", false); + + void processSameEventHyper(const CollisionsFull& collisions, const TrackCandidates& pitracks, o2::aod::DataHypCandsWColl const& V0Hypers, const aod::BCsWithTimestamps& bcs) + { + mGoodCollisions.clear(); + mGoodCollisions.resize(collisions.size(), false); + + for (const auto& collision : collisions) { + + mTrackHypPairs.clear(); + + if (!selectCollision(collision, bcs)) { + continue; + } + + mGoodCollisions[collision.globalIndex()] = true; + const uint64_t collIdx = collision.globalIndex(); + auto trackTableThisCollision = pitracks.sliceBy(mPerCol, collIdx); + auto hypdTableThisCollision = V0Hypers.sliceBy(hypPerCol, collIdx); + trackTableThisCollision.bindExternalIndices(&pitracks); + hypdTableThisCollision.bindExternalIndices(&V0Hypers); + + pairTracksSameEventHyper(trackTableThisCollision, hypdTableThisCollision); + + if (mTrackHypPairs.size() == 0) { + continue; + } + + fillPairsHyper(collisions, pitracks, V0Hypers, /*isMixedEvent*/ false); + } + } + PROCESS_SWITCH(PiNucleiFemto, processSameEventHyper, "Process Same event", false); void processMixedEvent(const CollisionsFull& collisions, const TrackCandidates& tracks) { @@ -880,11 +1067,11 @@ struct PiDeuteronFemto { fillPairs(collisions, tracks, /*isMixedEvent*/ true); } - PROCESS_SWITCH(PiDeuteronFemto, processMixedEvent, "Process Mixed event", false); + PROCESS_SWITCH(PiNucleiFemto, processMixedEvent, "Process Mixed event", false); }; WorkflowSpec defineDataProcessing(const ConfigContext& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(cfgc)}; } From 13e76abf1efc737dde6880dd38d5c7411377ebd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= <26327373+vkucera@users.noreply.github.com> Date: Thu, 11 Sep 2025 00:59:10 +0200 Subject: [PATCH 355/986] [PWGHF] derivedDataCreators: Fix type in candidate filter (#12915) --- .../derivedDataCreatorB0ToDPi.cxx | 18 ++++++------ .../derivedDataCreatorBplusToD0Pi.cxx | 18 ++++++------ .../derivedDataCreatorD0ToKPi.cxx | 28 +++++++++---------- .../derivedDataCreatorDplusToPiKPi.cxx | 18 ++++++------ .../derivedDataCreatorDsToKKPi.cxx | 2 +- .../derivedDataCreatorXicToXiPiPi.cxx | 2 +- 6 files changed, 43 insertions(+), 43 deletions(-) diff --git a/PWGHF/TableProducer/derivedDataCreatorB0ToDPi.cxx b/PWGHF/TableProducer/derivedDataCreatorB0ToDPi.cxx index 290773cfa9f..53a1c31e8c7 100644 --- a/PWGHF/TableProducer/derivedDataCreatorB0ToDPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorB0ToDPi.cxx @@ -93,7 +93,7 @@ struct HfDerivedDataCreatorB0ToDPi { HfHelper hfHelper; SliceCache cache; - static constexpr double mass{o2::constants::physics::MassB0}; + static constexpr double Mass{o2::constants::physics::MassB0}; using CollisionsWCentMult = soa::Join; using CollisionsWMcCentMult = soa::Join; @@ -106,7 +106,7 @@ struct HfDerivedDataCreatorB0ToDPi { using TypeMcCollisions = soa::Join; using THfCandDaughtersMl = soa::Join; - Filter filterSelectCandidates = (aod::hf_sel_candidate_b0::isSelB0ToDPi & static_cast(BIT(aod::SelectionStep::RecoMl - 1))) != 0; + Filter filterSelectCandidates = (aod::hf_sel_candidate_b0::isSelB0ToDPi & static_cast(BIT(aod::SelectionStep::RecoMl - 1))) != 0; Filter filterMcGenMatching = nabs(aod::hf_cand_b0::flagMcMatchGen) == static_cast(DecayChannelMain::B0ToDminusPi); Preslice candidatesPerCollision = aod::hf_cand::collisionId; @@ -344,7 +344,7 @@ struct HfDerivedDataCreatorB0ToDPi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcSig, candidatesDaughters, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorB0ToDPi, processMcSig, "Process MC only for signals", false); @@ -358,7 +358,7 @@ struct HfDerivedDataCreatorB0ToDPi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcBkg, candidatesDaughters, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorB0ToDPi, processMcBkg, "Process MC only for background", false); @@ -372,7 +372,7 @@ struct HfDerivedDataCreatorB0ToDPi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcAll, candidatesDaughters, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorB0ToDPi, processMcAll, "Process MC", false); @@ -398,7 +398,7 @@ struct HfDerivedDataCreatorB0ToDPi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcMlSig, candidatesDaughters, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorB0ToDPi, processMcMlSig, "Process MC with ML only for signals", false); @@ -412,7 +412,7 @@ struct HfDerivedDataCreatorB0ToDPi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcMlBkg, candidatesDaughters, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorB0ToDPi, processMcMlBkg, "Process MC with ML only for background", false); @@ -426,14 +426,14 @@ struct HfDerivedDataCreatorB0ToDPi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcMlAll, candidatesDaughters, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorB0ToDPi, processMcMlAll, "Process MC with ML", false); void processMcGenOnly(TypeMcCollisions const& mcCollisions, MatchedGenCandidatesMc const& mcParticles) { - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorB0ToDPi, processMcGenOnly, "Process MC gen. only", false); }; diff --git a/PWGHF/TableProducer/derivedDataCreatorBplusToD0Pi.cxx b/PWGHF/TableProducer/derivedDataCreatorBplusToD0Pi.cxx index ca79660d0bc..da07e1abfad 100644 --- a/PWGHF/TableProducer/derivedDataCreatorBplusToD0Pi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorBplusToD0Pi.cxx @@ -94,7 +94,7 @@ struct HfDerivedDataCreatorBplusToD0Pi { HfHelper hfHelper; SliceCache cache; - static constexpr double mass{o2::constants::physics::MassBPlus}; + static constexpr double Mass{o2::constants::physics::MassBPlus}; using CollisionsWCentMult = soa::Join; using CollisionsWMcCentMult = soa::Join; @@ -107,7 +107,7 @@ struct HfDerivedDataCreatorBplusToD0Pi { using TypeMcCollisions = soa::Join; using THfCandDaughtersMl = soa::Join; - Filter filterSelectCandidates = (aod::hf_sel_candidate_bplus::isSelBplusToD0Pi & static_cast(BIT(aod::SelectionStep::RecoMl - 1))) != 0; + Filter filterSelectCandidates = (aod::hf_sel_candidate_bplus::isSelBplusToD0Pi & static_cast(BIT(aod::SelectionStep::RecoMl - 1))) != 0; Filter filterMcGenMatching = nabs(aod::hf_cand_bplus::flagMcMatchGen) == static_cast(DecayChannelMain::BplusToD0Pi); Preslice candidatesPerCollision = aod::hf_cand::collisionId; @@ -353,7 +353,7 @@ struct HfDerivedDataCreatorBplusToD0Pi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcSig, candidatesDaughters, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorBplusToD0Pi, processMcSig, "Process MC only for signals", false); @@ -367,7 +367,7 @@ struct HfDerivedDataCreatorBplusToD0Pi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcBkg, candidatesDaughters, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorBplusToD0Pi, processMcBkg, "Process MC only for background", false); @@ -381,7 +381,7 @@ struct HfDerivedDataCreatorBplusToD0Pi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcAll, candidatesDaughters, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorBplusToD0Pi, processMcAll, "Process MC", false); @@ -407,7 +407,7 @@ struct HfDerivedDataCreatorBplusToD0Pi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcMlSig, candidatesDaughters, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorBplusToD0Pi, processMcMlSig, "Process MC with ML only for signals", false); @@ -421,7 +421,7 @@ struct HfDerivedDataCreatorBplusToD0Pi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcMlBkg, candidatesDaughters, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorBplusToD0Pi, processMcMlBkg, "Process MC with ML only for background", false); @@ -435,14 +435,14 @@ struct HfDerivedDataCreatorBplusToD0Pi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcMlAll, candidatesDaughters, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorBplusToD0Pi, processMcMlAll, "Process MC with ML", false); void processMcGenOnly(TypeMcCollisions const& mcCollisions, MatchedGenCandidatesMc const& mcParticles) { - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorBplusToD0Pi, processMcGenOnly, "Process MC gen. only", false); }; diff --git a/PWGHF/TableProducer/derivedDataCreatorD0ToKPi.cxx b/PWGHF/TableProducer/derivedDataCreatorD0ToKPi.cxx index 194b50eb2c0..d1d803d5361 100644 --- a/PWGHF/TableProducer/derivedDataCreatorD0ToKPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorD0ToKPi.cxx @@ -89,7 +89,7 @@ struct HfDerivedDataCreatorD0ToKPi { HfHelper hfHelper; SliceCache cache; - static constexpr double mass{o2::constants::physics::MassD0}; + static constexpr double Mass{o2::constants::physics::MassD0}; using CollisionsWCentMult = soa::Join; using CollisionsWMcCentMult = soa::Join; @@ -363,7 +363,7 @@ struct HfDerivedDataCreatorD0ToKPi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcSig, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorD0ToKPi, processMcWithDCAFitterSig, "Process MC with DCAFitterN only for signals", false); @@ -376,7 +376,7 @@ struct HfDerivedDataCreatorD0ToKPi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcBkg, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorD0ToKPi, processMcWithDCAFitterBkg, "Process MC with DCAFitterN only for background", false); @@ -389,7 +389,7 @@ struct HfDerivedDataCreatorD0ToKPi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcAll, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorD0ToKPi, processMcWithDCAFitterAll, "Process MC with DCAFitterN", false); @@ -402,7 +402,7 @@ struct HfDerivedDataCreatorD0ToKPi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcKfSig, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorD0ToKPi, processMcWithKFParticleSig, "Process MC with KFParticle only for signals", false); @@ -415,7 +415,7 @@ struct HfDerivedDataCreatorD0ToKPi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcKfBkg, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorD0ToKPi, processMcWithKFParticleBkg, "Process MC with KFParticle only for background", false); @@ -428,7 +428,7 @@ struct HfDerivedDataCreatorD0ToKPi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcKfAll, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorD0ToKPi, processMcWithKFParticleAll, "Process MC with KFParticle", false); @@ -461,7 +461,7 @@ struct HfDerivedDataCreatorD0ToKPi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcMlSig, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorD0ToKPi, processMcWithDCAFitterMlSig, "Process MC with DCAFitterN and ML only for signals", false); @@ -474,7 +474,7 @@ struct HfDerivedDataCreatorD0ToKPi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcMlBkg, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorD0ToKPi, processMcWithDCAFitterMlBkg, "Process MC with DCAFitterN and ML only for background", false); @@ -487,7 +487,7 @@ struct HfDerivedDataCreatorD0ToKPi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcMlAll, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorD0ToKPi, processMcWithDCAFitterMlAll, "Process MC with DCAFitterN and ML", false); @@ -500,7 +500,7 @@ struct HfDerivedDataCreatorD0ToKPi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcKfMlSig, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorD0ToKPi, processMcWithKFParticleMlSig, "Process MC with KFParticle and ML only for signals", false); @@ -513,7 +513,7 @@ struct HfDerivedDataCreatorD0ToKPi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcKfMlBkg, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorD0ToKPi, processMcWithKFParticleMlBkg, "Process MC with KFParticle and ML only for background", false); @@ -526,14 +526,14 @@ struct HfDerivedDataCreatorD0ToKPi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcKfMlAll, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorD0ToKPi, processMcWithKFParticleMlAll, "Process MC with KFParticle and ML", false); void processMcGenOnly(TypeMcCollisions const& mcCollisions, MatchedGenCandidatesMc const& mcParticles) { - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorD0ToKPi, processMcGenOnly, "Process MC gen. only", false); }; diff --git a/PWGHF/TableProducer/derivedDataCreatorDplusToPiKPi.cxx b/PWGHF/TableProducer/derivedDataCreatorDplusToPiKPi.cxx index 96d3ed0acf4..e1b06568c49 100644 --- a/PWGHF/TableProducer/derivedDataCreatorDplusToPiKPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorDplusToPiKPi.cxx @@ -87,7 +87,7 @@ struct HfDerivedDataCreatorDplusToPiKPi { HfHelper hfHelper; SliceCache cache; - static constexpr double mass{o2::constants::physics::MassDPlus}; + static constexpr double Mass{o2::constants::physics::MassDPlus}; using CollisionsWCentMult = soa::Join; using CollisionsWMcCentMult = soa::Join; @@ -99,7 +99,7 @@ struct HfDerivedDataCreatorDplusToPiKPi { using MatchedGenCandidatesMc = soa::Filtered>; using TypeMcCollisions = soa::Join; - Filter filterSelectCandidates = (aod::hf_sel_candidate_dplus::isSelDplusToPiKPi & static_cast(BIT(aod::SelectionStep::RecoMl - 1))) != 0; // select candidates which passed all cuts at least up to RecoMl - 1 + Filter filterSelectCandidates = (aod::hf_sel_candidate_dplus::isSelDplusToPiKPi & static_cast(BIT(aod::SelectionStep::RecoMl - 1))) != 0; // select candidates which passed all cuts at least up to RecoMl - 1 Filter filterMcGenMatching = nabs(aod::hf_cand_3prong::flagMcMatchGen) == static_cast(hf_decay::hf_cand_3prong::DecayChannelMain::DplusToPiKPi); Preslice candidatesPerCollision = aod::hf_cand::collisionId; @@ -312,7 +312,7 @@ struct HfDerivedDataCreatorDplusToPiKPi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcSig, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorDplusToPiKPi, processMcSig, "Process MC only for signals", false); @@ -325,7 +325,7 @@ struct HfDerivedDataCreatorDplusToPiKPi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcBkg, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorDplusToPiKPi, processMcBkg, "Process MC only for background", false); @@ -338,7 +338,7 @@ struct HfDerivedDataCreatorDplusToPiKPi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcAll, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorDplusToPiKPi, processMcAll, "Process MC", false); @@ -362,7 +362,7 @@ struct HfDerivedDataCreatorDplusToPiKPi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcMlSig, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorDplusToPiKPi, processMcMlSig, "Process MC with ML only for signals", false); @@ -375,7 +375,7 @@ struct HfDerivedDataCreatorDplusToPiKPi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcMlBkg, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorDplusToPiKPi, processMcMlBkg, "Process MC with ML only for background", false); @@ -388,14 +388,14 @@ struct HfDerivedDataCreatorDplusToPiKPi { { rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); processCandidates(collisions, candidatesMcMlAll, tracks, bcs); - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorDplusToPiKPi, processMcMlAll, "Process MC with ML", false); void processMcGenOnly(TypeMcCollisions const& mcCollisions, MatchedGenCandidatesMc const& mcParticles) { - rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, mass); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); } PROCESS_SWITCH(HfDerivedDataCreatorDplusToPiKPi, processMcGenOnly, "Process MC gen. only", false); }; diff --git a/PWGHF/TableProducer/derivedDataCreatorDsToKKPi.cxx b/PWGHF/TableProducer/derivedDataCreatorDsToKKPi.cxx index d63294ff14d..1dfe94c9d62 100644 --- a/PWGHF/TableProducer/derivedDataCreatorDsToKKPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorDsToKKPi.cxx @@ -99,7 +99,7 @@ struct HfDerivedDataCreatorDsToKKPi { using MatchedGenCandidatesMc = soa::Filtered>; using TypeMcCollisions = soa::Join; - Filter filterSelectCandidates = (aod::hf_sel_candidate_ds::isSelDsToKKPi & static_cast(BIT(aod::SelectionStep::RecoMl - 1))) != 0; // select candidates which passed all cuts at least up to RecoMl - 1 + Filter filterSelectCandidates = (aod::hf_sel_candidate_ds::isSelDsToKKPi & static_cast(BIT(aod::SelectionStep::RecoMl - 1))) != 0; // select candidates which passed all cuts at least up to RecoMl - 1 Filter filterMcGenMatching = nabs(aod::hf_cand_3prong::flagMcMatchGen) == static_cast(hf_decay::hf_cand_3prong::DecayChannelMain::DsToPiKK); Preslice candidatesPerCollision = aod::hf_cand::collisionId; diff --git a/PWGHF/TableProducer/derivedDataCreatorXicToXiPiPi.cxx b/PWGHF/TableProducer/derivedDataCreatorXicToXiPiPi.cxx index a59636bc500..92af9a89c53 100644 --- a/PWGHF/TableProducer/derivedDataCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorXicToXiPiPi.cxx @@ -100,7 +100,7 @@ struct HfDerivedDataCreatorXicToXiPiPi { using TypeMcCollisions = soa::Join; using THfCandDaughtersMl = aod::Cascades; - Filter filterSelectCandidates = (aod::hf_sel_candidate_xic::isSelXicToXiPiPi & static_cast(BIT(o2::aod::hf_sel_candidate_xic::XicToXiPiPiSelectionStep::RecoMl - 1))) != 0; + Filter filterSelectCandidates = (aod::hf_sel_candidate_xic::isSelXicToXiPiPi & static_cast(BIT(o2::aod::hf_sel_candidate_xic::XicToXiPiPiSelectionStep::RecoMl - 1))) != 0; Filter filterMcGenMatching = aod::hf_cand_xic_to_xi_pi_pi::flagMcMatchGen != 0; Preslice candidatesPerCollision = aod::hf_cand::collisionId; From 3bf465f648d882f9409e031682f22a65d44b3622 Mon Sep 17 00:00:00 2001 From: CyF1rmiana <3326561594@qq.com> Date: Thu, 11 Sep 2025 10:05:29 +0800 Subject: [PATCH 356/986] [PWGCF] Add some QA plots (#12924) --- PWGCF/Flow/Tasks/flowEseTask.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/PWGCF/Flow/Tasks/flowEseTask.cxx b/PWGCF/Flow/Tasks/flowEseTask.cxx index 09f852403bf..99569afbe0f 100644 --- a/PWGCF/Flow/Tasks/flowEseTask.cxx +++ b/PWGCF/Flow/Tasks/flowEseTask.cxx @@ -226,6 +226,9 @@ struct FlowEseTask { histos.add(Form("histQvecV2"), "", {HistType::kTH3F, {qvecAxis, qvecAxis, centAxis}}); histos.add(Form("histMult_Cent"), "", {HistType::kTH2F, {multNumAxis, centAxis}}); histos.add(Form("histQvecCent"), "", {HistType::kTH2F, {lowerQAxis, centAxis}}); + histos.add(Form("histPrPtCent"), "", {HistType::kTHnSparseF, {ptAxis, ptAxis, ptAxis, centAxis}}); + histos.add(Form("histPiPtCent"), "", {HistType::kTHnSparseF, {ptAxis, ptAxis, ptAxis, centAxis}}); + histos.add(Form("histPrBoostedPtCent"), "", {HistType::kTHnSparseF, {ptAxis, ptAxis, ptAxis, centAxis}}); for (auto i = 2; i < cfgnMods + 2; i++) { histos.add(Form("psi%d/h_lambda_cos", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis, epAxis}}); @@ -680,7 +683,7 @@ struct FlowEseTask { qvecRefAInd = refAId * 4 + 3 + (nmode - 2) * cfgNQvec * 4; qvecRefBInd = refBId * 4 + 3 + (nmode - 2) * cfgNQvec * 4; - for (auto& v0 : V0s) { // o2-linter: disable=const-ref-in-for-loop(need to modify v0) + for (const auto& v0 : V0s) { auto postrack = v0.template posTrack_as(); auto negtrack = v0.template negTrack_as(); @@ -732,6 +735,10 @@ struct FlowEseTask { psi = safeATan2(collision.qvecIm()[qvecDetInd], collision.qvecRe()[qvecDetInd]) / static_cast(nmode); relphi = TVector2::Phi_0_2pi(static_cast(nmode) * (LambdaVec.Phi() - psi)); + histos.fill(HIST("histPrPtCent"), protonVec.Px(), protonVec.Py(), protonVec.Pz(), collision.centFT0C()); + histos.fill(HIST("histPiPtCent"), pionVec.Px(), pionVec.Py(), pionVec.Pz(), collision.centFT0C()); + histos.fill(HIST("histPrBoostedPtCent"), protonBoostedVec.Px(), protonBoostedVec.Py(), protonBoostedVec.Pz(), collision.centFT0C()); + if (cfgShiftCorr) { auto deltapsiFT0C = 0.0; auto deltapsiFT0A = 0.0; From 0ae609c2638a7894639b31b3b0c302fa924dc1f4 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Thu, 11 Sep 2025 05:10:01 +0200 Subject: [PATCH 357/986] [PWGLF] Improvements in data model for strangeness, strangeness tof pid cleanup (#12912) Co-authored-by: ALICE Builder --- PWGLF/DataModel/LFStrangenessPIDTables.h | 142 +- PWGLF/DataModel/LFStrangenessTables.h | 5 + .../Strangeness/Converters/CMakeLists.txt | 10 + .../stradautrackstofpidconverter.cxx | 2 +- .../stradautrackstofpidconverter2.cxx | 66 + .../stradautrackstpcpidconverter.cxx | 42 + .../Strangeness/strangederivedbuilder.cxx | 454 ++--- .../Strangeness/strangenesstofpid.cxx | 1541 +++++++---------- 8 files changed, 1093 insertions(+), 1169 deletions(-) create mode 100644 PWGLF/TableProducer/Strangeness/Converters/stradautrackstofpidconverter2.cxx create mode 100644 PWGLF/TableProducer/Strangeness/Converters/stradautrackstpcpidconverter.cxx diff --git a/PWGLF/DataModel/LFStrangenessPIDTables.h b/PWGLF/DataModel/LFStrangenessPIDTables.h index 0b7e95ce302..b157097a605 100644 --- a/PWGLF/DataModel/LFStrangenessPIDTables.h +++ b/PWGLF/DataModel/LFStrangenessPIDTables.h @@ -15,36 +15,156 @@ #ifndef PWGLF_DATAMODEL_LFSTRANGENESSPIDTABLES_H_ #define PWGLF_DATAMODEL_LFSTRANGENESSPIDTABLES_H_ -#include -#include "Framework/AnalysisDataModel.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" + #include "Common/Core/RecoDecay.h" + #include "CommonConstants/PhysicsConstants.h" +#include "Framework/AnalysisDataModel.h" + +#include namespace o2::aod { namespace dautrack { -// ==== TPC INFORMATION === -DECLARE_SOA_COLUMN(TPCSignal, tpcSignal, float); //! track TPC signal +// ==== define packing helpers === +namespace packing +{ +// define variables for packing +static constexpr int nbins = (1 << 8 * sizeof(int8_t)) - 2; +static constexpr int8_t overflowBin = nbins >> 1; +static constexpr int8_t underflowBin = -(nbins >> 1); +static constexpr float binned_max = 6.35; +static constexpr float binned_min = -6.35; +static constexpr float bin_width = (binned_max - binned_min) / nbins; +static constexpr float underflow_return = -100.0f; +static constexpr float overflow_return = +100.0f; + +// define helper function to do packing +int8_t packInInt8(float nSigma) +{ + // calculate + if (nSigma <= binned_min) + return underflowBin; + if (nSigma >= binned_max) + return overflowBin; + if (nSigma >= 0) { + return static_cast((nSigma / bin_width) + 0.5f); + } + // automatic: this is the case in which nSigma < 0 + return static_cast((nSigma / bin_width) - 0.5f); +} + +// define helper function to do unpacking +float unpackInt8(int8_t nSigma) +{ + if (nSigma == underflowBin) { + return underflow_return; + } + if (nSigma == overflowBin) { + return overflow_return; + } + return bin_width * nSigma; +} + +} // namespace packing +} // namespace dautrack + +namespace dautrack_legacy +{ +// ==== LEGACY TPC INFORMATION (full size tables) === DECLARE_SOA_COLUMN(TPCNSigmaEl, tpcNSigmaEl, float); //! Nsigma proton DECLARE_SOA_COLUMN(TPCNSigmaPi, tpcNSigmaPi, float); //! Nsigma proton DECLARE_SOA_COLUMN(TPCNSigmaKa, tpcNSigmaKa, float); //! Nsigma proton DECLARE_SOA_COLUMN(TPCNSigmaPr, tpcNSigmaPr, float); //! Nsigma proton DECLARE_SOA_COLUMN(TPCNSigmaHe, tpcNSigmaHe, float); //! Nsigma proton +} // namespace dautrack_legacy + +namespace dautrack +{ +// ==== COMPACT TPC INFORMATION (full size tables) === +DECLARE_SOA_COLUMN(TPCSignal, tpcSignal, float); //! track TPC signal +DECLARE_SOA_COLUMN(PackedTPCNSigmaEl, packedTpcNSigmaEl, int8_t); //! Nsigma proton +DECLARE_SOA_COLUMN(PackedTPCNSigmaPi, packedTpcNSigmaPi, int8_t); //! Nsigma proton +DECLARE_SOA_COLUMN(PackedTPCNSigmaKa, packedTpcNSigmaKa, int8_t); //! Nsigma proton +DECLARE_SOA_COLUMN(PackedTPCNSigmaPr, packedTpcNSigmaPr, int8_t); //! Nsigma proton + +DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaEl, tpcNSigmaEl, //! unpacked TPC nsigma + [](int8_t nsigma_packed) -> float { return o2::aod::dautrack::packing::unpackInt8(nsigma_packed); }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaPi, tpcNSigmaPi, //! unpacked TPC nsigma + [](int8_t nsigma_packed) -> float { return o2::aod::dautrack::packing::unpackInt8(nsigma_packed); }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaKa, tpcNSigmaKa, //! unpacked TPC nsigma + [](int8_t nsigma_packed) -> float { return o2::aod::dautrack::packing::unpackInt8(nsigma_packed); }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaPr, tpcNSigmaPr, //! unpacked TPC nsigma + [](int8_t nsigma_packed) -> float { return o2::aod::dautrack::packing::unpackInt8(nsigma_packed); }); // ==== TOF INFORMATION === +DECLARE_SOA_INDEX_COLUMN(DauTrackExtra, dauTrackExtra); //! point to daughter this TOF info belongs to +DECLARE_SOA_INDEX_COLUMN(StraCollision, straCollision); //! point to collision associated with this track (not the V0/Casc) DECLARE_SOA_COLUMN(TOFSignal, tofSignal, float); //! track TOF signal -DECLARE_SOA_COLUMN(TOFEvTime, tofEvTime, float); //! track TOF signal -DECLARE_SOA_COLUMN(Length, length, float); //! track TOF signal +DECLARE_SOA_COLUMN(TOFEvTime, tofEvTime, float); //! event time +DECLARE_SOA_COLUMN(Length, length, float); //! track length (to assigned PV) +DECLARE_SOA_COLUMN(TOFExpMom, tofExpMom, float); //! tof Exp Mom (to assigned PV) + +// dynamics with expected times +DECLARE_SOA_DYNAMIC_COLUMN(TOFExpTimeEl, tofExpTimeEl, //! Expected time for the track to reach the TOF under the electron hypothesis + [](float length, float tofExpMom) -> float { + constexpr float massSquared = o2::constants::physics::MassElectron * o2::constants::physics::MassElectron; + return o2::framework::pid::tof::MassToExpTime(tofExpMom, length, massSquared); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(TOFExpTimePi, tofExpTimePi, //! Expected time for the track to reach the TOF under the pion hypothesis + [](float length, float tofExpMom) -> float { + constexpr float massSquared = o2::constants::physics::MassPionCharged * o2::constants::physics::MassPionCharged; + return o2::framework::pid::tof::MassToExpTime(tofExpMom, length, massSquared); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(TOFExpTimeKa, tofExpTimeKa, //! Expected time for the track to reach the TOF under the kaon hypothesis + [](float length, float tofExpMom) -> float { + constexpr float massSquared = o2::constants::physics::MassKaonCharged * o2::constants::physics::MassKaonCharged; + return o2::framework::pid::tof::MassToExpTime(tofExpMom, length, massSquared); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(TOFExpTimePr, tofExpTimePr, //! Expected time for the track to reach the TOF under the proton hypothesis + [](float length, float tofExpMom) -> float { + constexpr float massSquared = o2::constants::physics::MassProton * o2::constants::physics::MassProton; + return o2::framework::pid::tof::MassToExpTime(tofExpMom, length, massSquared); + }); + } // namespace dautrack -DECLARE_SOA_TABLE(DauTrackTPCPIDs, "AOD", "DAUTRACKTPCPID", // nsigma table (for analysis) - dautrack::TPCSignal, dautrack::TPCNSigmaEl, - dautrack::TPCNSigmaPi, dautrack::TPCNSigmaKa, - dautrack::TPCNSigmaPr, dautrack::TPCNSigmaHe); -DECLARE_SOA_TABLE(DauTrackTOFPIDs, "AOD", "DAUTRACKTOFPID", // raw table (for posterior TOF calculation) +DECLARE_SOA_TABLE(DauTrackTPCPIDs_000, "AOD", "DAUTRACKTPCPID", // nsigma table (for analysis) + dautrack::TPCSignal, dautrack_legacy::TPCNSigmaEl, + dautrack_legacy::TPCNSigmaPi, dautrack_legacy::TPCNSigmaKa, + dautrack_legacy::TPCNSigmaPr, dautrack_legacy::TPCNSigmaHe); + +DECLARE_SOA_TABLE_VERSIONED(DauTrackTPCPIDs_001, "AOD", "DAUTRACKTPCPID", 1, // nsigma table (for analysis) + dautrack::TPCSignal, + dautrack::PackedTPCNSigmaEl, dautrack::PackedTPCNSigmaPi, + dautrack::PackedTPCNSigmaKa, dautrack::PackedTPCNSigmaPr, + dautrack::TPCNSigmaEl, + dautrack::TPCNSigmaPi, + dautrack::TPCNSigmaKa, + dautrack::TPCNSigmaPr); + +using DauTrackTPCPIDs = DauTrackTPCPIDs_001; // second gen: packed Nsigma, no He + +DECLARE_SOA_TABLE(DauTrackTOFPIDs_000, "AOD", "DAUTRACKTOFPID", // raw table (for posterior TOF calculation) dautrack::TOFSignal, dautrack::TOFEvTime, dautrack::Length); +DECLARE_SOA_TABLE_VERSIONED(DauTrackTOFPIDs_001, "AOD", "DAUTRACKTOFPID", 1, // raw table (for posterior TOF calculation) + o2::soa::Index<>, + dautrack::StraCollisionId, dautrack::DauTrackExtraId, + dautrack::TOFSignal, dautrack::TOFEvTime, + dautrack::Length, dautrack::TOFExpMom, + dautrack::TOFExpTimeEl, + dautrack::TOFExpTimePi, + dautrack::TOFExpTimeKa, + dautrack::TOFExpTimePr); + +using DauTrackTOFPIDs = DauTrackTOFPIDs_001; // second gen: with collision Id, with TOFExpMom + namespace v0data { // define constants for NSigma operation diff --git a/PWGLF/DataModel/LFStrangenessTables.h b/PWGLF/DataModel/LFStrangenessTables.h index ca58973dff8..6da514fa64e 100644 --- a/PWGLF/DataModel/LFStrangenessTables.h +++ b/PWGLF/DataModel/LFStrangenessTables.h @@ -63,6 +63,9 @@ DECLARE_SOA_DYNAMIC_COLUMN(EnergyCommonZNA, energyCommonZNA, //! get the total s [](float value) -> float { return value; }); DECLARE_SOA_DYNAMIC_COLUMN(EnergyCommonZNC, energyCommonZNC, //! get the total sum of the ZN A amplitudes [](float value) -> float { return value; }); + +// event time +DECLARE_SOA_COLUMN(EventTime, eventTime, float); //! event time (FT0, TOF) for TOF PID (stored once per event) } // namespace stracollision //______________________________________________________ @@ -308,6 +311,8 @@ DECLARE_SOA_TABLE(StraStamps_000, "AOD", "STRASTAMPS", //! information for ID-in bc::RunNumber, timestamp::Timestamp); DECLARE_SOA_TABLE_VERSIONED(StraStamps_001, "AOD", "STRASTAMPS", 1, //! information for ID-ing mag field if needed bc::RunNumber, timestamp::Timestamp, bc::GlobalBC); +DECLARE_SOA_TABLE(StraEvTimes, "AOD", "STRAEVTIMES", //! event time (FT0, TOF) + stracollision::EventTime); using StraRawCents = StraRawCents_004; using StraCents = StraCents_001; diff --git a/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt b/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt index 842137dafe1..e0ebdb862f9 100644 --- a/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt +++ b/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt @@ -9,11 +9,21 @@ # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. +o2physics_add_dpl_workflow(stradautrackstpcpidconverter + SOURCES stradautrackstpcpidconverter.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(stradautrackstofpidconverter SOURCES stradautrackstofpidconverter.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(stradautrackstofpidconverter2 + SOURCES stradautrackstofpidconverter2.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(stradautracksextraconverter2 SOURCES stradautracksextraconverter2.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore diff --git a/PWGLF/TableProducer/Strangeness/Converters/stradautrackstofpidconverter.cxx b/PWGLF/TableProducer/Strangeness/Converters/stradautrackstofpidconverter.cxx index 8731939ca53..26cefdf2485 100644 --- a/PWGLF/TableProducer/Strangeness/Converters/stradautrackstofpidconverter.cxx +++ b/PWGLF/TableProducer/Strangeness/Converters/stradautrackstofpidconverter.cxx @@ -53,7 +53,7 @@ struct stradautrackstofpidconverter { lTOFEvTimes[casc.bachTrackExtraId()] = casc.bachTOFEventTime(); } for (int ii = 0; ii < dauTracks.size(); ii++) { - dautracktofpids(lTOFSignals[ii], lTOFEvTimes[ii], lLengths[ii]); + dautracktofpids(-1, -1, lTOFSignals[ii], lTOFEvTimes[ii], lLengths[ii], 0.0f); } } }; diff --git a/PWGLF/TableProducer/Strangeness/Converters/stradautrackstofpidconverter2.cxx b/PWGLF/TableProducer/Strangeness/Converters/stradautrackstofpidconverter2.cxx new file mode 100644 index 00000000000..371c5c133d3 --- /dev/null +++ b/PWGLF/TableProducer/Strangeness/Converters/stradautrackstofpidconverter2.cxx @@ -0,0 +1,66 @@ +// 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. +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" + +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +using namespace o2; +using namespace o2::framework; + +// converts DauTrackTOFPIDs_000 to _001 +struct stradautrackstofpidconverter2 { + Produces dautracktofpids; + Produces straEvTimes; + + void process(aod::StraCollisions const& collisions, soa::Join const& dauTracks, soa::Join const& v0s) + { + // create new TOFPIDs + for (int ii = 0; ii < dauTracks.size(); ii++) { + auto dauTrack = dauTracks.rawIteratorAt(ii); + dautracktofpids(-1, -1, dauTrack.tofSignal(), dauTrack.tofEvTime(), dauTrack.length(), 0.0f); + } + + // fill EvTimes (created simultaneously, so done in the same converter) + // recover as much as possible from the previous format + std::vector collisionEventTime(collisions.size(), 0.0); + std::vector collisionNtracks(collisions.size(), 0); + + for (const auto& v0 : v0s) { + auto posTrackTOF = dauTracks.rawIteratorAt(v0.posTrackExtraId()); + auto negTrackTOF = dauTracks.rawIteratorAt(v0.negTrackExtraId()); + if (posTrackTOF.hasTOF()) { + collisionEventTime[v0.straCollisionId()] += posTrackTOF.tofEvTime(); + collisionNtracks[v0.straCollisionId()]++; + } + if (negTrackTOF.hasTOF()) { + collisionEventTime[v0.straCollisionId()] += negTrackTOF.tofEvTime(); + collisionNtracks[v0.straCollisionId()]++; + } + } + for (const auto& collision : collisions) { + if (collisionNtracks[collision.globalIndex()] > 0) { + collisionEventTime[collision.globalIndex()] /= static_cast(collisionNtracks[collision.globalIndex()]); + } else { + collisionEventTime[collision.globalIndex()] = -1e+6; // undefined + } + straEvTimes(collisionEventTime[collision.globalIndex()]); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/TableProducer/Strangeness/Converters/stradautrackstpcpidconverter.cxx b/PWGLF/TableProducer/Strangeness/Converters/stradautrackstpcpidconverter.cxx new file mode 100644 index 00000000000..627872555bc --- /dev/null +++ b/PWGLF/TableProducer/Strangeness/Converters/stradautrackstpcpidconverter.cxx @@ -0,0 +1,42 @@ +// 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. +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" + +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +using namespace o2; +using namespace o2::framework; + +// converts DauTrackTOFPIDs_000 to _001 +struct stradautrackstpcpidconverter { + Produces dautrackpcpids; + + void process(aod::DauTrackTPCPIDs_000 const& v000s) + { + for (int ii = 0; ii < v000s.size(); ii++) { + auto dauTrackTPCPID = v000s.rawIteratorAt(ii); + dautrackpcpids(dauTrackTPCPID.tpcSignal(), + aod::dautrack::packing::packInInt8(dauTrackTPCPID.tpcNSigmaEl()), + aod::dautrack::packing::packInInt8(dauTrackTPCPID.tpcNSigmaPi()), + aod::dautrack::packing::packInInt8(dauTrackTPCPID.tpcNSigmaKa()), + aod::dautrack::packing::packInInt8(dauTrackTPCPID.tpcNSigmaPr())); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx index 8140448576a..5a563a10a3d 100644 --- a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx @@ -72,74 +72,77 @@ using BCsWithTimestampsAndRun2Infos = soa::Join strangeColl; // characterises collisions - Produces strangeCollLabels; // characterises collisions - Produces strangeMCColl; // characterises collisions / MC - Produces strangeMCMults; // characterises collisions / MC mults - Produces strangeCents; // characterises collisions / centrality in Run 3 - Produces strangeCentsRun2; // characterises collisions / centrality in Run 2 - Produces strangeEvSels; // characterises collisions / centrality / sel8 selection in Run 3 - Produces strangeEvSelsRun2; // characterises collisions / centrality / sel8 selection in Run 2 - Produces strangeStamps; // provides timestamps, run numbers - Produces v0collref; // references collisions from V0s - Produces casccollref; // references collisions from cascades - Produces kfcasccollref; // references collisions from KF cascades - Produces tracasccollref; // references collisions from tracked cascades - - //__________________________________________________ - // track extra references - Produces dauTrackExtras; // daughter track detector properties - Produces dauTrackMCIds; // daughter track MC Particle ID - Produces dauTrackTPCPIDs; // daughter track TPC PID - Produces dauTrackTOFPIDs; // daughter track TOF PID - Produces v0Extras; // references DauTracks from V0s - Produces cascExtras; // references DauTracks from cascades - Produces straTrackExtras; // references DauTracks from tracked cascades - - //__________________________________________________ - // cascade interlinks - Produces cascToTraRefs; // cascades -> tracked - Produces cascToKFRefs; // cascades -> KF - Produces traToCascRefs; // tracked -> cascades - Produces kfToCascRefs; // KF -> cascades - - //__________________________________________________ - // mother information - Produces v0mothers; // V0 mother references - Produces cascmothers; // casc mother references - Produces motherMCParts; // mc particles for mothers - - //__________________________________________________ - // UPC specific information - Produces zdcNeutrons; // Primary neutrons within ZDC acceptance - Produces zdcNeutronsMCCollRefs; // references collisions from ZDCNeutrons - - //__________________________________________________ - // Q-vectors - Produces StraFT0AQVs; // FT0A Q-vector - Produces StraFT0CQVs; // FT0C Q-vector - Produces StraFT0MQVs; // FT0M Q-vector - Produces StraFV0AQVs; // FV0A Q-vector - Produces StraTPCQVs; // TPC Q-vector - Produces StraFT0CQVsEv; // events used to compute FT0C Q-vector (LF) - Produces StraZDCSP; // ZDC Sums and Products - - //__________________________________________________ - // Generated binned data - // this is a hack while the system does not do better - Produces geK0Short; - Produces geLambda; - Produces geAntiLambda; - Produces geXiMinus; - Produces geXiPlus; - Produces geOmegaMinus; - Produces geOmegaPlus; - - //__________________________________________________ - // Debug - Produces straOrigin; + struct : ProducesGroup { + //__________________________________________________ + // fundamental building blocks of derived data + Produces strangeColl; // characterises collisions + Produces strangeCollLabels; // characterises collisions + Produces strangeMCColl; // characterises collisions / MC + Produces strangeMCMults; // characterises collisions / MC mults + Produces strangeCents; // characterises collisions / centrality in Run 3 + Produces strangeCentsRun2; // characterises collisions / centrality in Run 2 + Produces strangeEvSels; // characterises collisions / centrality / sel8 selection in Run 3 + Produces strangeEvSelsRun2; // characterises collisions / centrality / sel8 selection in Run 2 + Produces strangeStamps; // provides timestamps, run numbers + Produces straEvTimes; // provides event times (FT0, TOF) + Produces v0collref; // references collisions from V0s + Produces casccollref; // references collisions from cascades + Produces kfcasccollref; // references collisions from KF cascades + Produces tracasccollref; // references collisions from tracked cascades + + //__________________________________________________ + // track extra references + Produces dauTrackExtras; // daughter track detector properties + Produces dauTrackMCIds; // daughter track MC Particle ID + Produces dauTrackTPCPIDs; // daughter track TPC PID + Produces dauTrackTOFPIDs; // daughter track TOF PID + Produces v0Extras; // references DauTracks from V0s + Produces cascExtras; // references DauTracks from cascades + Produces straTrackExtras; // references DauTracks from tracked cascades + + //__________________________________________________ + // cascade interlinks + Produces cascToTraRefs; // cascades -> tracked + Produces cascToKFRefs; // cascades -> KF + Produces traToCascRefs; // tracked -> cascades + Produces kfToCascRefs; // KF -> cascades + + //__________________________________________________ + // mother information + Produces v0mothers; // V0 mother references + Produces cascmothers; // casc mother references + Produces motherMCParts; // mc particles for mothers + + //__________________________________________________ + // UPC specific information + Produces zdcNeutrons; // Primary neutrons within ZDC acceptance + Produces zdcNeutronsMCCollRefs; // references collisions from ZDCNeutrons + + //__________________________________________________ + // Q-vectors + Produces StraFT0AQVs; // FT0A Q-vector + Produces StraFT0CQVs; // FT0C Q-vector + Produces StraFT0MQVs; // FT0M Q-vector + Produces StraFV0AQVs; // FV0A Q-vector + Produces StraTPCQVs; // TPC Q-vector + Produces StraFT0CQVsEv; // events used to compute FT0C Q-vector (LF) + Produces StraZDCSP; // ZDC Sums and Products + + //__________________________________________________ + // Generated binned data + // this is a hack while the system does not do better + Produces geK0Short; + Produces geLambda; + Produces geAntiLambda; + Produces geXiMinus; + Produces geXiPlus; + Produces geOmegaMinus; + Produces geOmegaPlus; + + //__________________________________________________ + // Debug + Produces straOrigin; + } products; // histogram registry for bookkeeping HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -482,10 +485,10 @@ struct strangederivedbuilder { // +-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+ // fill collision tables if (strange || fillEmptyCollisions) { - strangeStamps(bc.runNumber(), bc.timestamp(), bc.globalBC()); - strangeColl(collision.posX(), collision.posY(), collision.posZ()); + products.strangeStamps(bc.runNumber(), bc.timestamp(), bc.globalBC()); + products.strangeColl(collision.posX(), collision.posY(), collision.posZ()); if constexpr (requires { collision.mcCollisionId(); }) { // check if MC information is available and if so fill labels - strangeCollLabels(collision.mcCollisionId()); + products.strangeCollLabels(collision.mcCollisionId()); } if constexpr (requires { collision.centFT0C(); }) { // check if we are in Run 3 @@ -495,89 +498,111 @@ struct strangederivedbuilder { centrality = hRawCentrality->GetBinContent(hRawCentrality->FindBin(collision.multFT0C())); } - strangeCents(collision.centFT0M(), collision.centFT0A(), - centrality, collision.centFV0A(), collision.centFT0CVariant1(), - collision.centMFT(), collision.centNGlobal()); - strangeEvSels(collision.sel8(), collision.selection_raw(), - collision.multFT0A() * static_cast(fillTruncationOptions.fillRawFT0A), - collision.multFT0C() * static_cast(fillTruncationOptions.fillRawFT0C), - collision.multFV0A() * static_cast(fillTruncationOptions.fillRawFV0A), - collision.multFDDA() * static_cast(fillTruncationOptions.fillRawFDDA), - collision.multFDDC() * static_cast(fillTruncationOptions.fillRawFDDC), - collision.multNTracksPVeta1() * static_cast(fillTruncationOptions.fillRawNTracksEta1), - collision.multPVTotalContributors() * static_cast(fillTruncationOptions.fillRawNTracksForCorrelation), - collision.multNTracksGlobal() * static_cast(fillTruncationOptions.fillRawNTracksForCorrelation), - collision.multNTracksITSTPC() * static_cast(fillTruncationOptions.fillRawNTracksForCorrelation), - collision.multAllTracksTPCOnly() * static_cast(fillTruncationOptions.fillRawNTracksForCorrelation), - collision.multAllTracksITSTPC() * static_cast(fillTruncationOptions.fillRawNTracksForCorrelation), - collision.multZNA() * static_cast(fillTruncationOptions.fillRawZDC), - collision.multZNC() * static_cast(fillTruncationOptions.fillRawZDC), - collision.multZEM1() * static_cast(fillTruncationOptions.fillRawZDC), - collision.multZEM2() * static_cast(fillTruncationOptions.fillRawZDC), - collision.multZPA() * static_cast(fillTruncationOptions.fillRawZDC), - collision.multZPC() * static_cast(fillTruncationOptions.fillRawZDC), - collision.trackOccupancyInTimeRange(), - collision.ft0cOccupancyInTimeRange(), - // UPC info - gapSide, - totalFT0AmplitudeA, totalFT0AmplitudeC, totalFV0AmplitudeA, - totalFDDAmplitudeA, totalFDDAmplitudeC, - energyCommonZNA, energyCommonZNC, - // Collision flags - collision.flags(), - collision.alias_raw(), - collision.rct_raw()); + products.strangeCents(collision.centFT0M(), collision.centFT0A(), + centrality, collision.centFV0A(), collision.centFT0CVariant1(), + collision.centMFT(), collision.centNGlobal()); + products.strangeEvSels(collision.sel8(), collision.selection_raw(), + collision.multFT0A() * static_cast(fillTruncationOptions.fillRawFT0A), + collision.multFT0C() * static_cast(fillTruncationOptions.fillRawFT0C), + collision.multFV0A() * static_cast(fillTruncationOptions.fillRawFV0A), + collision.multFDDA() * static_cast(fillTruncationOptions.fillRawFDDA), + collision.multFDDC() * static_cast(fillTruncationOptions.fillRawFDDC), + collision.multNTracksPVeta1() * static_cast(fillTruncationOptions.fillRawNTracksEta1), + collision.multPVTotalContributors() * static_cast(fillTruncationOptions.fillRawNTracksForCorrelation), + collision.multNTracksGlobal() * static_cast(fillTruncationOptions.fillRawNTracksForCorrelation), + collision.multNTracksITSTPC() * static_cast(fillTruncationOptions.fillRawNTracksForCorrelation), + collision.multAllTracksTPCOnly() * static_cast(fillTruncationOptions.fillRawNTracksForCorrelation), + collision.multAllTracksITSTPC() * static_cast(fillTruncationOptions.fillRawNTracksForCorrelation), + collision.multZNA() * static_cast(fillTruncationOptions.fillRawZDC), + collision.multZNC() * static_cast(fillTruncationOptions.fillRawZDC), + collision.multZEM1() * static_cast(fillTruncationOptions.fillRawZDC), + collision.multZEM2() * static_cast(fillTruncationOptions.fillRawZDC), + collision.multZPA() * static_cast(fillTruncationOptions.fillRawZDC), + collision.multZPC() * static_cast(fillTruncationOptions.fillRawZDC), + collision.trackOccupancyInTimeRange(), + collision.ft0cOccupancyInTimeRange(), + // UPC info + gapSide, + totalFT0AmplitudeA, totalFT0AmplitudeC, totalFV0AmplitudeA, + totalFDDAmplitudeA, totalFDDAmplitudeC, + energyCommonZNA, energyCommonZNC, + // Collision flags + collision.flags(), + collision.alias_raw(), + collision.rct_raw()); } else { // We are in Run 2 - strangeCentsRun2(collision.centRun2V0M(), collision.centRun2V0A(), - collision.centRun2SPDTracklets(), collision.centRun2SPDClusters()); - strangeEvSelsRun2(collision.sel8(), collision.sel7(), collision.selection_raw(), - collision.multFT0A() * static_cast(fillTruncationOptions.fillRawFT0A), - collision.multFT0C() * static_cast(fillTruncationOptions.fillRawFT0C), - collision.multFV0A() * static_cast(fillTruncationOptions.fillRawFV0A), - collision.multFV0C() * static_cast(fillTruncationOptions.fillRawFV0C), - collision.multFDDA() * static_cast(fillTruncationOptions.fillRawFDDA), - collision.multFDDC() * static_cast(fillTruncationOptions.fillRawFDDC), - bc.spdClustersL0() * static_cast(fillTruncationOptions.fillRawSPDclsL0Run2), - bc.spdClustersL1() * static_cast(fillTruncationOptions.fillRawSPDclsL1Run2), - collision.multNTracksPVeta1() * static_cast(fillTruncationOptions.fillRawNTracksEta1), - collision.multTracklets() * static_cast(fillTruncationOptions.fillRawTrackletsRun2), - -1, /* dummy number of PV contribs total while waiting for the multiplicity task to produce it */ - -1, /* dummy global track multiplicities while waiting for the multiplicity task to produce it */ - -1, /* dummy track multiplicities, PV contribs, no eta cut while waiting for the multiplicity task to produce it */ - -1, /* dummy TPConly track multiplicities, all, no eta cut while waiting for the multiplicity task to produce it */ - -1, /* dummy ITSTPC track multiplicities, all, no eta cut waiting for the multiplicity task to produce it */ - collision.multZNA() * static_cast(fillTruncationOptions.fillRawZDC), - collision.multZNC() * static_cast(fillTruncationOptions.fillRawZDC), - collision.multZEM1() * static_cast(fillTruncationOptions.fillRawZDC), - collision.multZEM2() * static_cast(fillTruncationOptions.fillRawZDC), - collision.multZPA() * static_cast(fillTruncationOptions.fillRawZDC), - collision.multZPC() * static_cast(fillTruncationOptions.fillRawZDC), - collision.alias_raw()); + products.strangeCentsRun2(collision.centRun2V0M(), collision.centRun2V0A(), + collision.centRun2SPDTracklets(), collision.centRun2SPDClusters()); + products.strangeEvSelsRun2(collision.sel8(), collision.sel7(), collision.selection_raw(), + collision.multFT0A() * static_cast(fillTruncationOptions.fillRawFT0A), + collision.multFT0C() * static_cast(fillTruncationOptions.fillRawFT0C), + collision.multFV0A() * static_cast(fillTruncationOptions.fillRawFV0A), + collision.multFV0C() * static_cast(fillTruncationOptions.fillRawFV0C), + collision.multFDDA() * static_cast(fillTruncationOptions.fillRawFDDA), + collision.multFDDC() * static_cast(fillTruncationOptions.fillRawFDDC), + bc.spdClustersL0() * static_cast(fillTruncationOptions.fillRawSPDclsL0Run2), + bc.spdClustersL1() * static_cast(fillTruncationOptions.fillRawSPDclsL1Run2), + collision.multNTracksPVeta1() * static_cast(fillTruncationOptions.fillRawNTracksEta1), + collision.multTracklets() * static_cast(fillTruncationOptions.fillRawTrackletsRun2), + -1, /* dummy number of PV contribs total while waiting for the multiplicity task to produce it */ + -1, /* dummy global track multiplicities while waiting for the multiplicity task to produce it */ + -1, /* dummy track multiplicities, PV contribs, no eta cut while waiting for the multiplicity task to produce it */ + -1, /* dummy TPConly track multiplicities, all, no eta cut while waiting for the multiplicity task to produce it */ + -1, /* dummy ITSTPC track multiplicities, all, no eta cut waiting for the multiplicity task to produce it */ + collision.multZNA() * static_cast(fillTruncationOptions.fillRawZDC), + collision.multZNC() * static_cast(fillTruncationOptions.fillRawZDC), + collision.multZEM1() * static_cast(fillTruncationOptions.fillRawZDC), + collision.multZEM2() * static_cast(fillTruncationOptions.fillRawZDC), + collision.multZPA() * static_cast(fillTruncationOptions.fillRawZDC), + collision.multZPC() * static_cast(fillTruncationOptions.fillRawZDC), + collision.alias_raw()); } } for (const auto& v0 : V0Table_thisColl) - V0CollIndices[v0.globalIndex()] = strangeColl.lastIndex(); + V0CollIndices[v0.globalIndex()] = products.strangeColl.lastIndex(); for (const auto& casc : CascTable_thisColl) - CascadeCollIndices[casc.globalIndex()] = strangeColl.lastIndex(); + CascadeCollIndices[casc.globalIndex()] = products.strangeColl.lastIndex(); for (const auto& casc : KFCascTable_thisColl) - KFCascadeCollIndices[casc.globalIndex()] = strangeColl.lastIndex(); + KFCascadeCollIndices[casc.globalIndex()] = products.strangeColl.lastIndex(); for (const auto& casc : TraCascTable_thisColl) - TraCascadeCollIndices[casc.globalIndex()] = strangeColl.lastIndex(); + TraCascadeCollIndices[casc.globalIndex()] = products.strangeColl.lastIndex(); } // +-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+ // populate references, including those that might not be assigned for (const auto& v0 : V0s) { - v0collref(V0CollIndices[v0.globalIndex()]); + products.v0collref(V0CollIndices[v0.globalIndex()]); } for (const auto& casc : Cascades) { - casccollref(CascadeCollIndices[casc.globalIndex()]); + products.casccollref(CascadeCollIndices[casc.globalIndex()]); } for (const auto& casc : KFCascades) { - kfcasccollref(KFCascadeCollIndices[casc.globalIndex()]); + products.kfcasccollref(KFCascadeCollIndices[casc.globalIndex()]); } for (const auto& casc : TraCascades) { - tracasccollref(TraCascadeCollIndices[casc.globalIndex()]); + products.tracasccollref(TraCascadeCollIndices[casc.globalIndex()]); + } + } + + // helper function to estimate collision time + template + void populateEventTimes(coll const& collisions, TTracks const& tracks) + { + std::vector collisionEventTime(collisions.size(), 0.0); + std::vector collisionNtracks(collisions.size(), 0); + for (const auto& track : tracks) { + if (track.hasTOF() && track.collisionId() >= 0) { + collisionEventTime[track.collisionId()] += track.tofEvTime(); + collisionNtracks[track.collisionId()]++; + } + } + for (const auto& collision : collisions) { + if (collisionNtracks[collision.globalIndex()] > 0) { + collisionEventTime[collision.globalIndex()] /= static_cast(collisionNtracks[collision.globalIndex()]); + } else { + collisionEventTime[collision.globalIndex()] = -1e+6; // undefined + } + products.straEvTimes(collisionEventTime[collision.globalIndex()]); } } @@ -611,13 +636,13 @@ struct strangederivedbuilder { totalMult++; } - strangeMCColl(mccollision.posX(), mccollision.posY(), mccollision.posZ(), - mccollision.impactParameter(), mccollision.eventPlaneAngle(), mccollision.generatorsID()); - strangeMCMults(mccollision.multMCFT0A(), mccollision.multMCFT0C(), - mccollision.multMCNParticlesEta05(), - mccollision.multMCNParticlesEta08(), - mccollision.multMCNParticlesEta10(), - totalMult); + products.strangeMCColl(mccollision.posX(), mccollision.posY(), mccollision.posZ(), + mccollision.impactParameter(), mccollision.eventPlaneAngle(), mccollision.generatorsID()); + products.strangeMCMults(mccollision.multMCFT0A(), mccollision.multMCFT0C(), + mccollision.multMCNParticlesEta05(), + mccollision.multMCNParticlesEta08(), + mccollision.multMCNParticlesEta10(), + totalMult); } } @@ -680,21 +705,21 @@ struct strangederivedbuilder { for (auto const& v0 : V0s) { auto const& posTrack = v0.posTrack_as(); auto const& negTrack = v0.negTrack_as(); - v0Extras(trackMap[posTrack.globalIndex()], - trackMap[negTrack.globalIndex()]); // joinable with V0Datas + products.v0Extras(trackMap[posTrack.globalIndex()], + trackMap[negTrack.globalIndex()]); // joinable with V0Datas } //__________________________________________________ // circle back and populate actual DauTrackExtra table for (auto const& tr : tracksExtra) { if (trackMap[tr.globalIndex()] >= 0) { - dauTrackExtras(tr.itsChi2NCl(), - tr.tpcChi2NCl(), - tr.detectorMap(), - tr.itsClusterSizes(), - tr.tpcNClsFindable(), - tr.tpcNClsFindableMinusFound(), - tr.tpcNClsFindableMinusCrossedRows(), - tr.tpcNClsShared()); + products.dauTrackExtras(tr.itsChi2NCl(), + tr.tpcChi2NCl(), + tr.detectorMap(), + tr.itsClusterSizes(), + tr.tpcNClsFindable(), + tr.tpcNClsFindableMinusFound(), + tr.tpcNClsFindableMinusCrossedRows(), + tr.tpcNClsShared()); } } // done! @@ -760,8 +785,8 @@ struct strangederivedbuilder { for (auto const& v0 : V0s) { auto const& posTrack = v0.template posTrack_as(); auto const& negTrack = v0.template negTrack_as(); - v0Extras(trackMap[posTrack.globalIndex()], - trackMap[negTrack.globalIndex()]); // joinable with V0Datas + products.v0Extras(trackMap[posTrack.globalIndex()], + trackMap[negTrack.globalIndex()]); // joinable with V0Datas } //__________________________________________________ // populate track references @@ -769,61 +794,60 @@ struct strangederivedbuilder { auto bachTrack = casc.template bachelor_as(); auto posTrack = casc.template posTrack_as(); auto negTrack = casc.template negTrack_as(); - cascExtras(trackMap[posTrack.globalIndex()], - trackMap[negTrack.globalIndex()], - trackMap[bachTrack.globalIndex()]); // joinable with CascDatas + products.cascExtras(trackMap[posTrack.globalIndex()], + trackMap[negTrack.globalIndex()], + trackMap[bachTrack.globalIndex()]); // joinable with CascDatas } //__________________________________________________ // populate track references for (auto const& casc : TraCascades) { auto strangeTrack = casc.template strangeTrack_as(); - straTrackExtras(trackMap[strangeTrack.globalIndex()]); // joinable with TraCascDatas + products.straTrackExtras(trackMap[strangeTrack.globalIndex()]); // joinable with TraCascDatas } //__________________________________________________ // circle back and populate actual DauTrackExtra table for (auto const& tr : tracksExtra) { if (trackMap[tr.globalIndex()] >= 0) { - dauTrackExtras(tr.itsChi2NCl(), - tr.tpcChi2NCl(), - tr.detectorMap(), - tr.itsClusterSizes(), - tr.tpcNClsFindable(), - tr.tpcNClsFindableMinusFound(), - tr.tpcNClsFindableMinusCrossedRows(), - tr.tpcNClsShared()); + products.dauTrackExtras(tr.itsChi2NCl(), + tr.tpcChi2NCl(), + tr.detectorMap(), + tr.itsClusterSizes(), + tr.tpcNClsFindable(), + tr.tpcNClsFindableMinusFound(), + tr.tpcNClsFindableMinusCrossedRows(), + tr.tpcNClsShared()); // _________________________________________ // if the table has MC info if constexpr (requires { tr.mcParticle(); }) { // do your thing with the mcParticleIds only in case the table has the MC info - dauTrackMCIds(tr.mcParticleId()); // joinable with dauTrackExtras + products.dauTrackMCIds(tr.mcParticleId()); // joinable with dauTrackExtras } if constexpr (requires { tr.tpcNSigmaEl(); }) { - if (roundNSigmaVariables) { // round if requested - dauTrackTPCPIDs(tr.tpcSignal(), - roundToPrecision(tr.tpcNSigmaEl(), precisionNSigmas), - roundToPrecision(tr.tpcNSigmaPi(), precisionNSigmas), - roundToPrecision(tr.tpcNSigmaKa(), precisionNSigmas), - roundToPrecision(tr.tpcNSigmaPr(), precisionNSigmas), - roundToPrecision(tr.tpcNSigmaHe(), precisionNSigmas)); - } else { - dauTrackTPCPIDs(tr.tpcSignal(), tr.tpcNSigmaEl(), - tr.tpcNSigmaPi(), tr.tpcNSigmaKa(), - tr.tpcNSigmaPr(), tr.tpcNSigmaHe()); - } + products.dauTrackTPCPIDs(tr.tpcSignal(), + aod::dautrack::packing::packInInt8(tr.tpcNSigmaEl()), + aod::dautrack::packing::packInInt8(tr.tpcNSigmaPi()), + aod::dautrack::packing::packInInt8(tr.tpcNSigmaKa()), + aod::dautrack::packing::packInInt8(tr.tpcNSigmaPr())); // populate daughter-level TOF information - dauTrackTOFPIDs(tr.tofSignal(), tr.tofEvTime(), tr.length()); + if (tr.hasTOF()) { + products.dauTrackTOFPIDs(tr.collisionId(), products.dauTrackExtras.lastIndex(), tr.tofSignal(), tr.tofEvTime(), tr.length(), tr.tofExpMom()); + } } else { // populate with empty fully-compatible Nsigmas if no corresponding table available - dauTrackTPCPIDs(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - dauTrackTOFPIDs(0.0f, 0.0f, 0.0f); + products.dauTrackTPCPIDs(0.0f, 0, 0, 0, 0); } } } // done! } + void processPopulateEventTimes(aod::Collisions const& collisions, soa::Join const& tracks) + { + populateEventTimes(collisions, tracks); + } + void processTrackExtras(aod::V0Datas const& V0s, aod::CascDatas const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, soa::Join const& tracksExtra, aod::V0s const&) { fillTrackExtras(V0s, Cascades, KFCascades, TraCascades, tracksExtra); @@ -872,23 +896,23 @@ struct strangederivedbuilder { // populate track references for (auto const& v0 : V0s) { if (v0.mcMotherParticleId() > -1) { - v0mothers(motherReference[v0.mcMotherParticleId()]); // joinable with V0Datas + products.v0mothers(motherReference[v0.mcMotherParticleId()]); // joinable with V0Datas } else { - v0mothers(-1); // joinable with V0Datas + products.v0mothers(-1); // joinable with V0Datas } } for (auto const& ca : Cascades) { if (ca.mcMotherParticleId() > -1) { - cascmothers(motherReference[ca.mcMotherParticleId()]); // joinable with CascDatas + products.cascmothers(motherReference[ca.mcMotherParticleId()]); // joinable with CascDatas } else { - cascmothers(-1); // joinable with CascDatas + products.cascmothers(-1); // joinable with CascDatas } } //__________________________________________________ // populate motherMCParticles for (auto const& tr : mcParticles) { if (motherReference[tr.globalIndex()] >= 0) { - motherMCParts(tr.px(), tr.py(), tr.pz(), tr.pdgCode(), tr.isPhysicalPrimary()); + products.motherMCParts(tr.px(), tr.py(), tr.pz(), tr.pdgCode(), tr.isPhysicalPrimary()); } } } @@ -904,7 +928,7 @@ struct strangederivedbuilder { auto cascade = c.cascade_as(); indexTracked = cascade.traCascDataId(); } - cascToTraRefs(indexTracked); + products.cascToTraRefs(indexTracked); } // Tracked to standard for (auto const& c : TraCascades) { @@ -913,7 +937,7 @@ struct strangederivedbuilder { auto cascade = c.cascade_as(); index = cascade.cascDataId(); } - traToCascRefs(index); + products.traToCascRefs(index); } } @@ -926,7 +950,7 @@ struct strangederivedbuilder { auto cascade = c.cascade_as(); indexKF = cascade.kfCascDataId(); } - cascToKFRefs(indexKF); + products.cascToKFRefs(indexKF); } // KF to standard for (auto const& c : KFCascades) { @@ -935,7 +959,7 @@ struct strangederivedbuilder { auto cascade = c.cascade_as(); index = cascade.cascDataId(); } - kfToCascRefs(index); + products.kfToCascRefs(index); } } @@ -1024,48 +1048,48 @@ struct strangederivedbuilder { } // at end of data frame // -> pack information from this DF into a generated histogram, once / DF - geK0Short(genK0Short); - geLambda(genLambda); - geAntiLambda(genAntiLambda); - geXiMinus(genXiMinus); - geXiPlus(genXiPlus); - geOmegaMinus(genOmegaMinus); - geOmegaPlus(genOmegaPlus); + products.geK0Short(genK0Short); + products.geLambda(genLambda); + products.geAntiLambda(genAntiLambda); + products.geXiMinus(genXiMinus); + products.geXiPlus(genXiPlus); + products.geOmegaMinus(genOmegaMinus); + products.geOmegaPlus(genOmegaPlus); } void processFT0AQVectors(soa::Join::iterator const& collision) { - StraFT0AQVs(collision.qvecFT0ARe(), collision.qvecFT0AIm(), collision.sumAmplFT0A()); + products.StraFT0AQVs(collision.qvecFT0ARe(), collision.qvecFT0AIm(), collision.sumAmplFT0A()); } void processFT0CQVectors(soa::Join::iterator const& collision) { - StraFT0CQVs(collision.qvecFT0CRe(), collision.qvecFT0CIm(), collision.sumAmplFT0C()); + products.StraFT0CQVs(collision.qvecFT0CRe(), collision.qvecFT0CIm(), collision.sumAmplFT0C()); } void processFT0CQVectorsLF(soa::Join::iterator const& collision) { - StraFT0CQVs(collision.qFT0C() * std::cos(2 * collision.psiFT0C()), collision.qFT0C() * std::sin(2 * collision.psiFT0C()), collision.qFT0C()); - StraFT0CQVsEv(collision.triggereventep()); + products.StraFT0CQVs(collision.qFT0C() * std::cos(2 * collision.psiFT0C()), collision.qFT0C() * std::sin(2 * collision.psiFT0C()), collision.qFT0C()); + products.StraFT0CQVsEv(collision.triggereventep()); } void processZDCSP(soa::Join::iterator const& collision) { - StraZDCSP(collision.triggereventsp(), - collision.psiZDCA(), collision.psiZDCC(), collision.qxZDCA(), collision.qxZDCC(), collision.qyZDCA(), collision.qyZDCC()); + products.StraZDCSP(collision.triggereventsp(), + collision.psiZDCA(), collision.psiZDCC(), collision.qxZDCA(), collision.qxZDCC(), collision.qyZDCA(), collision.qyZDCC()); } void processFT0MQVectors(soa::Join::iterator const& collision) { - StraFT0MQVs(collision.qvecFT0MRe(), collision.qvecFT0MIm(), collision.sumAmplFT0M()); + products.StraFT0MQVs(collision.qvecFT0MRe(), collision.qvecFT0MIm(), collision.sumAmplFT0M()); } void processFV0AQVectors(soa::Join::iterator const& collision) { - StraFV0AQVs(collision.qvecFV0ARe(), collision.qvecFV0AIm(), collision.sumAmplFV0A()); + products.StraFV0AQVs(collision.qvecFV0ARe(), collision.qvecFV0AIm(), collision.sumAmplFV0A()); } void processTPCQVectors(soa::Join::iterator const& collision) { - StraTPCQVs(collision.qvecBNegRe(), collision.qvecBNegIm(), collision.nTrkBNeg(), collision.qvecBPosRe(), collision.qvecBPosIm(), collision.nTrkBPos()); + products.StraTPCQVs(collision.qvecBNegRe(), collision.qvecBNegIm(), collision.nTrkBNeg(), collision.qvecBPosRe(), collision.qvecBPosIm(), collision.nTrkBPos()); } void processTPCQVectorsLF(soa::Join::iterator const& collision) { - StraTPCQVs(collision.qTPCL() * std::cos(2 * collision.psiTPCL()), collision.qTPCL() * std::sin(2 * collision.psiTPCL()), collision.qTPCL(), collision.qTPCR() * std::cos(2 * collision.psiTPCR()), collision.qTPCR() * std::sin(2 * collision.psiTPCR()), collision.qTPCR()); + products.StraTPCQVs(collision.qTPCL() * std::cos(2 * collision.psiTPCL()), collision.qTPCL() * std::sin(2 * collision.psiTPCL()), collision.qTPCL(), collision.qTPCR() * std::cos(2 * collision.psiTPCR()), collision.qTPCR() * std::sin(2 * collision.psiTPCR()), collision.qTPCR()); } using uint128_t = __uint128_t; @@ -1077,7 +1101,7 @@ struct strangederivedbuilder { void processDataframeIDs(aod::Origins const& origins) { auto origin = origins.begin(); - straOrigin(origin.dataframeID()); + products.straOrigin(origin.dataframeID()); } void processSimulatedZDCNeutrons(soa::Join const& mcCollisions, aod::McParticles const& mcParticlesEntireTable) @@ -1089,11 +1113,11 @@ struct strangederivedbuilder { for (const auto& mcPart : mcParticles) { if (std::abs(mcPart.pdgCode()) == kNeutron) { // check if it is a neutron or anti-neutron if (std::abs(mcPart.eta()) > 8.7) { // check if it is within ZDC acceptance - zdcNeutrons(mcPart.pdgCode(), mcPart.statusCode(), mcPart.flags(), - mcPart.vx(), mcPart.vy(), mcPart.vz(), mcPart.vt(), - mcPart.px(), mcPart.py(), mcPart.pz(), mcPart.e()); + products.zdcNeutrons(mcPart.pdgCode(), mcPart.statusCode(), mcPart.flags(), + mcPart.vx(), mcPart.vy(), mcPart.vz(), mcPart.vt(), + mcPart.px(), mcPart.py(), mcPart.pz(), mcPart.e()); - zdcNeutronsMCCollRefs(mcPart.mcCollisionId()); + products.zdcNeutronsMCCollRefs(mcPart.mcCollisionId()); } } } @@ -1111,6 +1135,8 @@ struct strangederivedbuilder { // Run 2: collision processing PROCESS_SWITCH(strangederivedbuilder, processCollisionsRun2, "Produce collisions (Run2)", false); PROCESS_SWITCH(strangederivedbuilder, processCollisionsRun2WithMC, "Produce collisions (Run 2) with MC info", false); + // Event times + PROCESS_SWITCH(strangederivedbuilder, processPopulateEventTimes, "Populate event times", true); // detailed information processing PROCESS_SWITCH(strangederivedbuilder, processTrackExtrasV0sOnly, "Produce track extra information (V0s only)", true); diff --git a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx index f74a6d95d1d..b19d7ba04c8 100644 --- a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx @@ -70,7 +70,7 @@ using CascOriginalDatas = soa::Join; using TracksWithAllExtras = soa::Join; // For derived data analysis -using dauTracks = soa::Join; +using dauTracks = soa::Join; using V0DerivedDatas = soa::Join; using V0DerivedDatasMC = soa::Join; using CascDerivedDatas = soa::Join; @@ -104,22 +104,6 @@ struct strangenesstofpid { struct : ConfigurableGroup { Configurable d_bz_input{"d_bz", -999, "bz field, -999 is automatic"}; Configurable tofPosition{"tofPosition", 377.934f, "TOF effective (inscribed) radius"}; - - Configurable correctELossInclination{"correctELossInclination", false, "factor out inclination when doing effective e-loss correction (0: no, 1: yes)"}; - Configurable numberOfStepsFirstStage{"numberOfStepsFirstStage", 500, "Max number of alpha rotations to attempt in first stage"}; - Configurable numberOfStepsSecondStage{"numberOfStepsSecondStage", 500, "Max number of steps rotations to attempt in second stage"}; - Configurable stepSizeFirstStage{"stepSizeFirstStage", 2.0f, "Max number of alpha rotations to attempt in first stage"}; - Configurable firstApproximationThreshold{"firstApproximationThreshold", 4.0f, "be satisfied if first approach to TOF radius is OK within this threshold (cm)"}; - - // regulate e-loss calculation to save CPU - Configurable maxPionMomentumForEloss{"maxPionMomentumForEloss", 1.5f, "above this momentum, do fast analytical TOF calculation for pions"}; - Configurable maxKaonMomentumForEloss{"maxKaonMomentumForEloss", 2.0f, "above this momentum, do fast analytical TOF calculation for kaons"}; - Configurable maxProtonMomentumForEloss{"maxProtonMomentumForEloss", 2.5f, "above this momentum, do fast analytical TOF calculation for protons"}; - - Configurable rejectKaonMomentumForEloss{"rejectKaonMomentumForEloss", 0.2f, "below this momentum, reject kaon hypothesis (won't reach TOF)"}; - Configurable rejectProtonMomentumForEloss{"rejectProtonMomentumForEloss", 0.2f, "below this momentum, reject proton hypothesis (won't reach TOF)"}; - - Configurable tpcNsigmaThreshold{"tpcNsigmaThreshold", 6.0f, "require TPC compatibility to attempt eloss propagation (otherwise, don't calculate)"}; } propagationConfiguration; Configurable doQA{"doQA", false, "create QA histos"}; @@ -335,138 +319,6 @@ struct strangenesstofpid { return length; } - /// O2 Propagator + TrackLTIntegral approach helpers - - /// function to calculate segmented (truncated) radius based on a certain x, y position - float segmentedRadius(float x, float y) - { - float atAngle = std::atan2(y, x); - float roundedAngle = TMath::Pi() / 9; // 18 segments = use 9 here - float angleSegmentAxis = 0.5f * roundedAngle + roundedAngle * static_cast(std::floor(atAngle / roundedAngle)); - float xSegmentAxis = TMath::Cos(angleSegmentAxis); - float ySegmentAxis = TMath::Sin(angleSegmentAxis); - return xSegmentAxis * x + ySegmentAxis * y; // inner product - } - - /// function to calculate track length of this track up to a certain segmented detector - /// \param track the input track - /// \param time returned time (with PID given by track PID) - void calculateTOF(o2::track::TrackPar track, float& time) - { - time = -1e+6; - - if (track.getPID() == o2::track::PID::Proton && track.getP() < propagationConfiguration.rejectProtonMomentumForEloss.value) { - return; // don't attempt to calculate below-threshold protons (will stop anyway) - } - if (track.getPID() == o2::track::PID::Kaon && track.getP() < propagationConfiguration.rejectKaonMomentumForEloss.value) { - return; // don't attempt to calculate below-threshold kaons (will stop anyway) - } - - o2::track::TrackLTIntegral ltIntegral; - - static constexpr float MAX_SIN_PHI = 0.85f; - static constexpr float MAX_STEP = 2.0f; - static constexpr float MAX_STEP_FINAL_STAGE = 0.5f; - static constexpr float MAX_FINAL_X = 450.0f; // maximum extra X on top of TOF X for correcting value - - //____________________________________________________________ - // stage 1: propagate to TOF-inscribed circle at tofPosition - - // define standard variables - std::array xyz; - std::array pxpypz; - track.getXYZGlo(xyz); - float segmentedRstart = segmentedRadius(xyz[0], xyz[1]); - - bool firstPropag = true; - for (int iRot = 0; iRot < propagationConfiguration.numberOfStepsFirstStage.value; iRot++) { - track.rotateParam(track.getPhi()); // start rotated - float currentX = track.getX(); - float tofX = currentX; - track.getXatLabR(propagationConfiguration.tofPosition, tofX, d_bz, o2::track::DirOutward); - if (std::abs(tofX - currentX) < propagationConfiguration.firstApproximationThreshold.value) { - // signal conclusion - if (calculationMethod.value == 2) { - histos.fill(HIST("hInitialPropagationSteps"), iRot); // store number of steps - } - break; - } - float nextX = std::min(currentX + propagationConfiguration.stepSizeFirstStage.value, tofX); - firstPropag = o2::base::Propagator::Instance()->propagateToX(track, nextX, d_bz, MAX_SIN_PHI, MAX_STEP, o2::base::Propagator::MatCorrType::USEMatCorrLUT, <Integral); - } - - // mark start position of next step - track.getXYZGlo(xyz); - float snp = track.getSnp(); - float segmentedR = segmentedRadius(xyz[0], xyz[1]); - float segmentedRintermediate = segmentedR; - float currentTime = ltIntegral.getTOF(track.getPID()); - if (calculationMethod.value == 2) { - histos.fill(HIST("hSegRadiusFirstPropagVsStart"), segmentedRstart, segmentedR); // for debugging purposes - histos.fill(HIST("hSnp"), track.getSnp()); // for debugging purposes - histos.fill(HIST("hTOFPosition"), xyz[0], xyz[1]); // for debugging purposes - histos.fill(HIST("hSegRadius"), segmentedR); // for debugging purposes - if (!firstPropag) { - histos.fill(HIST("hTOFPositionFirstPropagFail"), xyz[0], xyz[1]); // for debugging purposes - histos.fill(HIST("hSegRadiusFirstPropagFail"), segmentedR); // for debugging purposes - histos.fill(HIST("hSnpFirstPropagFail"), track.getSnp()); // for debugging purposes - } - } - - // correct for TOF segmentation - bool trackOKextra = true; - float trackXextra = track.getX(); - int propagationSteps = 0; - int maxPropagationSteps = propagationConfiguration.numberOfStepsSecondStage.value; - while ((trackXextra < MAX_FINAL_X) && (propagationSteps < maxPropagationSteps)) { - // continue with alpha aligned with pT - track.getPxPyPzGlo(pxpypz); - track.rotateParam(std::atan2(pxpypz[1], pxpypz[0])); - trackXextra = track.getX() + MAX_STEP_FINAL_STAGE; - trackOKextra = o2::base::Propagator::Instance()->propagateToX(track, trackXextra, d_bz, MAX_SIN_PHI, MAX_STEP, o2::base::Propagator::MatCorrType::USEMatCorrLUT, <Integral); - if (!trackOKextra) { - if (calculationMethod.value == 2) { - track.getXYZGlo(xyz); - histos.fill(HIST("hTOFPositionStopped"), xyz[0], xyz[1]); // for debugging purposes - histos.fill(HIST("hSnpStopped"), snp); // for debugging purposes - histos.fill(HIST("hSegRadiusStopped"), segmentedRadius(xyz[0], xyz[1])); // for debugging purposes - histos.fill(HIST("hSegRadiusStoppedVsFirstPropag"), segmentedRintermediate, segmentedRadius(xyz[0], xyz[1])); // for debugging purposes - } - time = -1e+6; - return; // propagation failed, skip, won't look reasonable - } - - // re-evaluate - did we cross? if yes break - float previousX = xyz[0], previousY = xyz[1]; - track.getXYZGlo(xyz); - if (segmentedRadius(xyz[0], xyz[1]) > propagationConfiguration.tofPosition) { - // crossed boundary -> do proportional scaling with how much we actually crossed the boundary - float segmentedRFinal = segmentedRadius(xyz[0], xyz[1]); - float timeFinal = ltIntegral.getTOF(track.getPID()); - float fraction = (propagationConfiguration.tofPosition - segmentedR) / (segmentedRFinal - segmentedR + 1e-6); // proportional fraction - time = currentTime + (timeFinal - currentTime) * fraction; - if (calculationMethod.value == 2) { - histos.fill(HIST("hTOFPositionFinal"), previousX + fraction * (xyz[0] - previousX), previousY + fraction * (xyz[1] - previousY)); // for debugging purposes - histos.fill(HIST("hSegRadiusFinal"), segmentedRadius(previousX + fraction * (xyz[0] - previousX), previousY + fraction * (xyz[1] - previousY))); // for debugging purposes - histos.fill(HIST("hSnpFinal"), track.getSnp()); // for debugging purposes - histos.fill(HIST("hSegRadiusFinalVsFirstPropag"), segmentedRintermediate, segmentedRadius(previousX + fraction * (xyz[0] - previousX), previousY + fraction * (xyz[1] - previousY))); // for debugging purposes - histos.fill(HIST("hRefinedPropagationSteps"), propagationSteps, 1.0f); // for debugging purposes - } - return; // get out of the entire function and return (don't just break) - } - - // prepare for next step by setting current position and desired variables - segmentedR = segmentedRadius(xyz[0], xyz[1]); - currentTime = ltIntegral.getTOF(track.getPID()); - propagationSteps++; - } - if (calculationMethod.value == 2) { - histos.fill(HIST("hRefinedPropagationSteps"), propagationSteps, 0.0f); // for debugging purposes - track.getXYZGlo(xyz); - histos.fill(HIST("hSegRadiusGotLost"), segmentedRadius(xyz[0], xyz[1])); // for debugging purposes - } - } - void init(InitContext& initContext) { if (calculateV0s.value < 0) { @@ -566,93 +418,6 @@ struct strangenesstofpid { // delta lambda decay time histos.add("h2dLambdaDeltaDecayTime", "h2dLambdaDeltaDecayTime", {HistType::kTH2F, {axisP, axisDeltaTime}}); } - - if (calculationMethod.value == 2) { - //_____________________________________________________________________ - // special mode in which comparison histograms are required - - //_____________________________________________________________________ - // histograms for debugging modes 0 vs 1 - // encoded success rates in each hypothesis and method vs prong p - histos.add("h2dSucessRatePion", "h2dSucessRatePion", kTH2F, {axisSmallP, {4, -0.5f, 3.5f}}); - histos.add("h2dSucessRateKaon", "h2dSucessRateKaon", kTH2F, {axisSmallP, {4, -0.5f, 3.5f}}); - histos.add("h2dSucessRateProton", "h2dSucessRateProton", kTH2F, {axisSmallP, {4, -0.5f, 3.5f}}); - - histos.add("hInitialPropagationSteps", "hInitialPropagationSteps", kTH1F, {{500, -0.5f, 499.5f}}); - histos.add("hRefinedPropagationSteps", "hRefinedPropagationSteps", kTH2F, {{1000, -0.5f, 999.5f}, {2, -0.5f, 1.5f}}); - - // base ArcDebug: comparison between times of arrival in different methods - histos.add("hArcDebug", "hArcDebug", kTH2F, {axisTime, axisTime}); - - // Position of TrackLTIntegral method: intermediate (getXatLabR) and final (reach segmented detector) - histos.add("hTOFPosition", "hTOFPosition", kTH2F, {axisPosition, axisPosition}); - histos.add("hTOFPositionFirstPropagFail", "hTOFPositionFirstPropagFail", kTH2F, {axisPosition, axisPosition}); - histos.add("hTOFPositionFinal", "hTOFPositionFinal", kTH2F, {axisPosition, axisPosition}); - histos.add("hTOFPositionGetXAtLabFail", "hTOFPositionGetXAtLabFail", kTH2F, {axisPosition, axisPosition}); - histos.add("hTOFPositionStopped", "hTOFPositionStopped", kTH2F, {axisPosition, axisPosition}); - - // Snp cross-check - histos.add("hSnp", "hSnp", kTH1F, {axisSnp}); - histos.add("hSnpFirstPropagFail", "hSnpFirstPropagFail", kTH1F, {axisSnp}); - histos.add("hSnpFinal", "hSnpFinal", kTH1F, {axisSnp}); - histos.add("hSnpGetXAtLabFail", "hSnpGetXAtLabFail", kTH1F, {axisSnp}); - histos.add("hSnpStopped", "hSnpStopped", kTH1F, {axisSnp}); - - // segmented radius: positions - histos.add("hSegRadius", "hSegRadius", kTH1F, {{400, 0.0f, 400.0f}}); - histos.add("hSegRadiusFirstPropagFail", "hSegRadiusFirstPropagFail", kTH1F, {{400, 0.0f, 400.0f}}); - histos.add("hSegRadiusFinal", "hSegRadiusFinal", kTH1F, {{400, 0.0f, 400.0f}}); - histos.add("hSegRadiusStopped", "hSegRadiusStopped", kTH1F, {{400, 0.0f, 400.0f}}); - histos.add("hSegRadiusGotLost", "hSegRadiusGotLost", kTH1F, {{400, 0.0f, 400.0f}}); - - histos.add("hSegRadiusFirstPropagVsStart", "hSegRadiusFirstPropagVsStart", kTH2F, {{400, 0.0f, 400.0f}, {400, 0.0f, 400.0f}}); - histos.add("hSegRadiusStoppedVsFirstPropag", "hSegRadiusStoppedVsFirstPropag", kTH2F, {{400, 0.0f, 400.0f}, {400, 0.0f, 400.0f}}); - histos.add("hSegRadiusFinalVsFirstPropag", "hSegRadiusFinalVsFirstPropag", kTH2F, {{400, 0.0f, 400.0f}, {400, 0.0f, 400.0f}}); - - // Delta-times of each method for the various species - histos.add("hDeltaTimeMethodsVsP_posLaPr", "hDeltaTimeMethodsVsP_posLaPr", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); - histos.add("hDeltaTimeMethodsVsP_posLaPi", "hDeltaTimeMethodsVsP_posLaPi", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); - histos.add("hDeltaTimeMethodsVsP_posK0Pi", "hDeltaTimeMethodsVsP_posK0Pi", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); - histos.add("hDeltaTimeMethodsVsP_negLaPr", "hDeltaTimeMethodsVsP_negLaPr", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); - histos.add("hDeltaTimeMethodsVsP_negLaPi", "hDeltaTimeMethodsVsP_negLaPi", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); - histos.add("hDeltaTimeMethodsVsP_negK0Pi", "hDeltaTimeMethodsVsP_negK0Pi", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); - - histos.add("hDeltaTimeMethodsVsP_posXiPi", "hDeltaTimeMethodsVsP_posXiPi", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); - histos.add("hDeltaTimeMethodsVsP_posXiPr", "hDeltaTimeMethodsVsP_posXiPr", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); - histos.add("hDeltaTimeMethodsVsP_negXiPi", "hDeltaTimeMethodsVsP_negXiPi", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); - histos.add("hDeltaTimeMethodsVsP_negXiPr", "hDeltaTimeMethodsVsP_negXiPr", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); - histos.add("hDeltaTimeMethodsVsP_bachXiPi", "hDeltaTimeMethodsVsP_bachXiPi", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); - - histos.add("hDeltaTimeMethodsVsP_posOmPi", "hDeltaTimeMethodsVsP_posOmPi", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); - histos.add("hDeltaTimeMethodsVsP_posOmPr", "hDeltaTimeMethodsVsP_posOmPr", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); - histos.add("hDeltaTimeMethodsVsP_negOmPi", "hDeltaTimeMethodsVsP_negOmPi", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); - histos.add("hDeltaTimeMethodsVsP_negOmPr", "hDeltaTimeMethodsVsP_negOmPr", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); - histos.add("hDeltaTimeMethodsVsP_bachOmKa", "hDeltaTimeMethodsVsP_bachOmKa", kTH3F, {axisSmallP, axisEta, axisDeltaTime}); - - histos.add("hRatioTimeMethodsVsP_posLaPr", "hRatioTimeMethodsVsP_posLaPr", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); - histos.add("hRatioTimeMethodsVsP_posLaPi", "hRatioTimeMethodsVsP_posLaPi", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); - histos.add("hRatioTimeMethodsVsP_posK0Pi", "hRatioTimeMethodsVsP_posK0Pi", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); - histos.add("hRatioTimeMethodsVsP_negLaPr", "hRatioTimeMethodsVsP_negLaPr", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); - histos.add("hRatioTimeMethodsVsP_negLaPi", "hRatioTimeMethodsVsP_negLaPi", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); - histos.add("hRatioTimeMethodsVsP_negK0Pi", "hRatioTimeMethodsVsP_negK0Pi", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); - - histos.add("hRatioTimeMethodsVsP_posXiPi", "hRatioTimeMethodsVsP_posXiPi", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); - histos.add("hRatioTimeMethodsVsP_posXiPr", "hRatioTimeMethodsVsP_posXiPr", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); - histos.add("hRatioTimeMethodsVsP_negXiPi", "hRatioTimeMethodsVsP_negXiPi", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); - histos.add("hRatioTimeMethodsVsP_negXiPr", "hRatioTimeMethodsVsP_negXiPr", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); - histos.add("hRatioTimeMethodsVsP_bachXiPi", "hRatioTimeMethodsVsP_bachXiPi", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); - - histos.add("hRatioTimeMethodsVsP_posOmPi", "hRatioTimeMethodsVsP_posOmPi", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); - histos.add("hRatioTimeMethodsVsP_posOmPr", "hRatioTimeMethodsVsP_posOmPr", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); - histos.add("hRatioTimeMethodsVsP_negOmPi", "hRatioTimeMethodsVsP_negOmPi", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); - histos.add("hRatioTimeMethodsVsP_negOmPr", "hRatioTimeMethodsVsP_negOmPr", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); - histos.add("hRatioTimeMethodsVsP_bachOmKa", "hRatioTimeMethodsVsP_bachOmKa", kTH3F, {axisSmallP, axisEta, axisRatioMethods}); - } - - // list memory consumption at start if running in modes with more output - if (calculationMethod.value == 2 || doQA) { - histos.print(); - } } void initCCDB(int runNumber) @@ -767,15 +532,15 @@ struct strangenesstofpid { } } - if (calculationMethod.value > 0 && !lut) { - // setMatLUT only after magfield has been initalized - // (setMatLUT has implicit and problematic init field call if not) - LOG(info) << "Loading full (all-radius) material look-up table for run number: " << runNumber; - lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->getForRun(ccdbConfigurations.lutPath, runNumber)); - o2::base::Propagator::Instance()->setMatLUT(lut); - o2::base::Propagator::Instance()->setTGeoFallBackAllowed(false); - LOG(info) << "Material look-up table loaded!"; - } + // if (calculationMethod.value > 0 && !lut) { + // // setMatLUT only after magfield has been initalized + // // (setMatLUT has implicit and problematic init field call if not) + // LOG(info) << "Loading full (all-radius) material look-up table for run number: " << runNumber; + // lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->getForRun(ccdbConfigurations.lutPath, runNumber)); + // o2::base::Propagator::Instance()->setMatLUT(lut); + // o2::base::Propagator::Instance()->setTGeoFallBackAllowed(false); + // LOG(info) << "Material look-up table loaded!"; + // } mRunNumber = runNumber; } @@ -787,24 +552,12 @@ struct strangenesstofpid { return 0.0299792458 * TMath::Sqrt(lA / (1 + lA)); } - // templatized process function for symmetric operation in derived and original AO2D - template - void processV0Candidate(TCollision const& collision, TV0 const& v0, TTrack const& pTra, TTrack const& nTra, int v0pdg) - { - // time of V0 segment - float lengthV0 = std::hypot(v0.x() - collision.getX(), v0.y() - collision.getY(), v0.z() - collision.getZ()); - float velocityK0Short = velocity(v0.p(), o2::constants::physics::MassKaonNeutral); - float velocityLambda = velocity(v0.p(), o2::constants::physics::MassLambda); - float timeK0Short = lengthV0 / velocityK0Short; // in picoseconds - float timeLambda = lengthV0 / velocityLambda; // in picoseconds - - // initialize from V0 position and momenta - o2::track::TrackPar posTrack = o2::track::TrackPar({v0.x(), v0.y(), v0.z()}, {v0.pxpos(), v0.pypos(), v0.pzpos()}, +1, false); - o2::track::TrackPar negTrack = o2::track::TrackPar({v0.x(), v0.y(), v0.z()}, {v0.pxneg(), v0.pyneg(), v0.pzneg()}, -1, false); - - // at minimum - float positiveP = std::hypot(v0.pxpos(), v0.pypos(), v0.pzpos()); - float negativeP = std::hypot(v0.pxneg(), v0.pyneg(), v0.pzneg()); + // structs to hold information + struct v0TofInfo { // holds processed information regarding TOF for V0s + float timePositivePr = o2::aod::v0data::kNoTOFValue; + float timePositivePi = o2::aod::v0data::kNoTOFValue; + float timeNegativePr = o2::aod::v0data::kNoTOFValue; + float timeNegativePi = o2::aod::v0data::kNoTOFValue; float deltaTimePositiveLambdaPi = o2::aod::v0data::kNoTOFValue; float deltaTimeNegativeLambdaPi = o2::aod::v0data::kNoTOFValue; @@ -819,304 +572,229 @@ struct strangenesstofpid { float nSigmaNegativeLambdaPr = o2::aod::v0data::kNoTOFValue; float nSigmaPositiveK0ShortPi = o2::aod::v0data::kNoTOFValue; float nSigmaNegativeK0ShortPi = o2::aod::v0data::kNoTOFValue; + }; - float timePositivePr = o2::aod::v0data::kNoTOFValue; - float timePositivePi = o2::aod::v0data::kNoTOFValue; - float timeNegativePr = o2::aod::v0data::kNoTOFValue; - float timeNegativePi = o2::aod::v0data::kNoTOFValue; - - float timePositivePr_Method0 = o2::aod::v0data::kNoTOFValue; - float timePositivePi_Method0 = o2::aod::v0data::kNoTOFValue; - float timeNegativePr_Method0 = o2::aod::v0data::kNoTOFValue; - float timeNegativePi_Method0 = o2::aod::v0data::kNoTOFValue; - - float timePositivePr_Method1 = o2::aod::v0data::kNoTOFValue; - float timePositivePi_Method1 = o2::aod::v0data::kNoTOFValue; - float timeNegativePr_Method1 = o2::aod::v0data::kNoTOFValue; - float timeNegativePi_Method1 = o2::aod::v0data::kNoTOFValue; - - float velocityPositivePr = velocity(posTrack.getP(), o2::constants::physics::MassProton); - float velocityPositivePi = velocity(posTrack.getP(), o2::constants::physics::MassPionCharged); - float velocityNegativePr = velocity(negTrack.getP(), o2::constants::physics::MassProton); - float velocityNegativePi = velocity(negTrack.getP(), o2::constants::physics::MassPionCharged); - - if (pTra.hasTOF() && pTra.hasITS()) { - float lengthPositive = findInterceptLength(posTrack, d_bz); // FIXME: tofPosition ok? adjust? - if (lengthPositive > 0) { - timePositivePr_Method0 = lengthPositive / velocityPositivePr; - timePositivePi_Method0 = lengthPositive / velocityPositivePi; - } - } - if (nTra.hasTOF() && nTra.hasITS()) { - float lengthNegative = findInterceptLength(negTrack, d_bz); // FIXME: tofPosition ok? adjust? - if (lengthNegative > 0) { - timeNegativePr_Method0 = lengthNegative / velocityNegativePr; - timeNegativePi_Method0 = lengthNegative / velocityNegativePi; - } - } - - if (calculationMethod.value > 0) { - // method to calculate the time and length via Propagator TrackLTIntegral - if (pTra.hasTOF() && pTra.hasITS()) { // calculate if signal present, otherwise skip - if (posTrack.getP() < propagationConfiguration.maxProtonMomentumForEloss.value && std::abs(pTra.tpcNSigmaPr()) < propagationConfiguration.tpcNsigmaThreshold) { - o2::track::TrackPar posTrackAsProton(posTrack); - posTrackAsProton.setPID(o2::track::PID::Proton); - calculateTOF(posTrackAsProton, timePositivePr_Method1); - } else { - timePositivePr_Method1 = timePositivePr_Method0; - } - if (posTrack.getP() < propagationConfiguration.maxPionMomentumForEloss.value && std::abs(pTra.tpcNSigmaPi()) < propagationConfiguration.tpcNsigmaThreshold) { - o2::track::TrackPar posTrackAsPion(posTrack); - posTrackAsPion.setPID(o2::track::PID::Pion); - calculateTOF(posTrackAsPion, timePositivePi_Method1); - } else { - timePositivePi_Method1 = timePositivePi_Method0; - } - } - if (nTra.hasTOF() && nTra.hasITS()) { // calculate if signal present, otherwise skip - if (negTrack.getP() < propagationConfiguration.maxProtonMomentumForEloss.value && std::abs(nTra.tpcNSigmaPr()) < propagationConfiguration.tpcNsigmaThreshold) { - o2::track::TrackPar negTrackAsProton(negTrack); - negTrackAsProton.setPID(o2::track::PID::Proton); - calculateTOF(negTrackAsProton, timeNegativePr_Method1); - } else { - timeNegativePr_Method1 = timeNegativePr_Method0; - } - - if (negTrack.getP() < propagationConfiguration.maxPionMomentumForEloss.value && std::abs(nTra.tpcNSigmaPi()) < propagationConfiguration.tpcNsigmaThreshold) { - o2::track::TrackPar negTrackAsPion(negTrack); - negTrackAsPion.setPID(o2::track::PID::Pion); - calculateTOF(negTrackAsPion, timeNegativePi_Method1); - } else { - timeNegativePi_Method1 = timeNegativePi_Method0; - } - } - } - - // assign values to be used in main calculation - if (calculationMethod.value == 0) { - timePositivePr = timePositivePr_Method0; - timePositivePi = timePositivePi_Method0; - timeNegativePr = timeNegativePr_Method0; - timeNegativePi = timeNegativePi_Method0; - } else { - timePositivePr = timePositivePr_Method1; - timePositivePi = timePositivePi_Method1; - timeNegativePr = timeNegativePr_Method1; - timeNegativePi = timeNegativePi_Method1; - } - - if (calculationMethod.value == 2) { - // do analysis of successes and failures - bool positiveSuccessMethod0Pr = std::abs(timePositivePr_Method0 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon; - bool negativeSuccessMethod0Pr = std::abs(timeNegativePr_Method0 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon; - bool positiveSuccessMethod1Pr = std::abs(timePositivePr_Method1 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon; - bool negativeSuccessMethod1Pr = std::abs(timeNegativePr_Method1 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon; - bool positiveSuccessMethod0Pi = std::abs(timePositivePi_Method0 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon; - bool negativeSuccessMethod0Pi = std::abs(timeNegativePi_Method0 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon; - bool positiveSuccessMethod1Pi = std::abs(timePositivePi_Method1 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon; - bool negativeSuccessMethod1Pi = std::abs(timeNegativePi_Method1 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon; - - int encodedPositiveSuccessPi = positiveSuccessMethod0Pi + 2 * positiveSuccessMethod1Pi; - int encodedPositiveSuccessPr = positiveSuccessMethod0Pr + 2 * positiveSuccessMethod1Pr; - int encodedNegativeSuccessPi = negativeSuccessMethod0Pi + 2 * negativeSuccessMethod1Pi; - int encodedNegativeSuccessPr = negativeSuccessMethod0Pr + 2 * negativeSuccessMethod1Pr; - - if (pTra.hasTOF()) { - histos.fill(HIST("h2dSucessRateProton"), positiveP, encodedPositiveSuccessPr); - histos.fill(HIST("h2dSucessRatePion"), positiveP, encodedPositiveSuccessPi); - } - if (nTra.hasTOF()) { - histos.fill(HIST("h2dSucessRateProton"), negativeP, encodedNegativeSuccessPr); - histos.fill(HIST("h2dSucessRatePion"), negativeP, encodedNegativeSuccessPi); - } - } - - if (pTra.hasTOF() && pTra.hasITS() && timePositivePr > 0) { - deltaTimePositiveLambdaPr = (pTra.tofSignal() - pTra.tofEvTime()) - (timeLambda + timePositivePr); - deltaTimePositiveLambdaPi = (pTra.tofSignal() - pTra.tofEvTime()) - (timeLambda + timePositivePi); - deltaTimePositiveK0ShortPi = (pTra.tofSignal() - pTra.tofEvTime()) - (timeK0Short + timePositivePi); - } - if (nTra.hasTOF() && nTra.hasITS() && timeNegativePr > 0) { - deltaTimeNegativeLambdaPr = (nTra.tofSignal() - nTra.tofEvTime()) - (timeLambda + timeNegativePr); - deltaTimeNegativeLambdaPi = (nTra.tofSignal() - nTra.tofEvTime()) - (timeLambda + timeNegativePi); - deltaTimeNegativeK0ShortPi = (nTra.tofSignal() - nTra.tofEvTime()) - (timeK0Short + timeNegativePi); - } - - if (doQA) { - // calculate and pack properties for QA purposes - int posProperties = 0; - if (timePositivePr > 0) - posProperties = posProperties | (static_cast(1) << kLength); - if (pTra.hasTOF()) - posProperties = posProperties | (static_cast(1) << kHasTOF); - int negProperties = 0; - if (timeNegativePr > 0) - negProperties = negProperties | (static_cast(1) << kLength); - if (nTra.hasTOF()) - negProperties = negProperties | (static_cast(1) << kHasTOF); - - histos.fill(HIST("h2dPositiveTOFProperties"), v0.p(), posProperties); - histos.fill(HIST("h2dNegativeTOFProperties"), v0.p(), negProperties); - } - - float deltaDecayTimeLambda = -10e+4; - float deltaDecayTimeAntiLambda = -10e+4; - float deltaDecayTimeK0Short = -10e+4; - if (nTra.hasTOF() && pTra.hasTOF() && timePositivePr > 0 && timeNegativePr > 0) { // does not depend on event time - deltaDecayTimeLambda = (pTra.tofSignal() - timePositivePr) - (nTra.tofSignal() - timeNegativePi); - deltaDecayTimeAntiLambda = (pTra.tofSignal() - timePositivePi) - (nTra.tofSignal() - timeNegativePr); - deltaDecayTimeK0Short = (pTra.tofSignal() - timePositivePi) - (nTra.tofSignal() - timeNegativePi); - } + // structs to hold information + struct cascTofInfo { // holds processed information regarding TOF for Cascades + float posFlightPi = o2::aod::cascdata::kNoTOFValue; + float posFlightPr = o2::aod::cascdata::kNoTOFValue; + float negFlightPi = o2::aod::cascdata::kNoTOFValue; + float negFlightPr = o2::aod::cascdata::kNoTOFValue; + float bachFlightPi = o2::aod::cascdata::kNoTOFValue; + float bachFlightKa = o2::aod::cascdata::kNoTOFValue; - // calculate betas + float posDeltaTimeAsXiPi = o2::aod::cascdata::kNoTOFValue, posDeltaTimeAsXiPr = o2::aod::cascdata::kNoTOFValue; + float negDeltaTimeAsXiPi = o2::aod::cascdata::kNoTOFValue, negDeltaTimeAsXiPr = o2::aod::cascdata::kNoTOFValue; + float bachDeltaTimeAsXiPi = o2::aod::cascdata::kNoTOFValue; + float posDeltaTimeAsOmPi = o2::aod::cascdata::kNoTOFValue, posDeltaTimeAsOmPr = o2::aod::cascdata::kNoTOFValue; + float negDeltaTimeAsOmPi = o2::aod::cascdata::kNoTOFValue, negDeltaTimeAsOmPr = o2::aod::cascdata::kNoTOFValue; + float bachDeltaTimeAsOmKa = o2::aod::cascdata::kNoTOFValue; - float evTimeMean = 0.5f * (pTra.tofEvTime() + nTra.tofEvTime()); - float decayTimeLambda = 0.5f * ((pTra.tofSignal() - timePositivePr) + (nTra.tofSignal() - timeNegativePi)) - evTimeMean; - float decayTimeAntiLambda = 0.5f * ((pTra.tofSignal() - timePositivePi) + (nTra.tofSignal() - timeNegativePr)) - evTimeMean; - float decayTimeK0Short = 0.5f * ((pTra.tofSignal() - timePositivePi) + (nTra.tofSignal() - timeNegativePi)) - evTimeMean; + float nSigmaXiLaPr = o2::aod::cascdata::kNoTOFValue; + float nSigmaXiLaPi = o2::aod::cascdata::kNoTOFValue; + float nSigmaXiPi = o2::aod::cascdata::kNoTOFValue; + float nSigmaOmLaPr = o2::aod::cascdata::kNoTOFValue; + float nSigmaOmLaPi = o2::aod::cascdata::kNoTOFValue; + float nSigmaOmKa = o2::aod::cascdata::kNoTOFValue; + }; + + struct trackTofInfo { // holds input track info + bool hasITS = false; + bool hasTPC = false; + bool hasTOF = false; + int collisionId = -1; + float tofExpMom = 0.0f; + float tofSignal = 0.0f; + float tofEvTime = 0.0f; + float length = 0.0f; + + // save TPC PID here for completeness too + float tpcNSigmaPi = 0.0f; + float tpcNSigmaKa = 0.0f; + float tpcNSigmaPr = 0.0f; + }; - float betaLambda = o2::aod::cascdata::kNoTOFValue; - float betaAntiLambda = o2::aod::cascdata::kNoTOFValue; - float betaK0Short = o2::aod::cascdata::kNoTOFValue; + // templatized process function for symmetric operation in derived and original AO2D + /// \param collisions the collisions table (needed for de-referencing V0 and progns) + /// \param v0 the V0 being processed + /// \param pTof the TOF information for the positive track + /// \param nTof the TOF information for the negative track + template + v0TofInfo calculateTofInfoV0(TCollisions const& collisions, int const& collisionId, TV0 const& v0, TTOFInfo const& pTof, TTOFInfo const& nTof) + { + v0TofInfo v0tof; // return this struct + auto collision = collisions.rawIteratorAt(collisionId); - if (nTra.hasTOF() && pTra.hasTOF()) { - betaLambda = (lengthV0 / decayTimeLambda) / 0.0299792458; - betaAntiLambda = (lengthV0 / decayTimeAntiLambda) / 0.0299792458; - betaK0Short = (lengthV0 / decayTimeK0Short) / 0.0299792458; - } + //_____________________________________________________________________________________________ + // daughter tracks: initialize from V0 position and momenta + o2::track::TrackPar posTrack = o2::track::TrackPar({v0.x(), v0.y(), v0.z()}, {v0.pxpos(), v0.pypos(), v0.pzpos()}, +1, false); + o2::track::TrackPar negTrack = o2::track::TrackPar({v0.x(), v0.y(), v0.z()}, {v0.pxneg(), v0.pyneg(), v0.pzneg()}, -1, false); - v0tofpid(deltaTimePositiveLambdaPi, deltaTimePositiveLambdaPr, - deltaTimeNegativeLambdaPi, deltaTimeNegativeLambdaPr, - deltaTimePositiveK0ShortPi, deltaTimeNegativeK0ShortPi, - deltaDecayTimeLambda, deltaDecayTimeAntiLambda, deltaDecayTimeK0Short); - v0tofbeta(betaLambda, betaAntiLambda, betaK0Short); - v0tofdebugs(timeLambda, timeK0Short, timePositivePr, timePositivePi, timeNegativePr, timeNegativePi); - - // do Nsigmas if requested - if (doNSigmas && nSigmaCalibLoaded) { - // sweep through all viable hypotheses and produce N-sigma - - if (deltaTimePositiveLambdaPi > -1e+5) - nSigmaPositiveLambdaPi = (deltaTimePositiveLambdaPi - hMeanPosLaPi->Interpolate(v0.p())) / hSigmaPosLaPi->Interpolate(v0.p()); - if (deltaTimePositiveLambdaPr > -1e+5) - nSigmaPositiveLambdaPr = (deltaTimePositiveLambdaPr - hMeanPosLaPr->Interpolate(v0.p())) / hSigmaPosLaPr->Interpolate(v0.p()); - if (deltaTimeNegativeLambdaPi > -1e+5) - nSigmaNegativeLambdaPi = (deltaTimeNegativeLambdaPi - hMeanNegLaPi->Interpolate(v0.p())) / hSigmaNegLaPi->Interpolate(v0.p()); - if (deltaTimeNegativeLambdaPr > -1e+5) - nSigmaNegativeLambdaPr = (deltaTimeNegativeLambdaPr - hMeanNegLaPr->Interpolate(v0.p())) / hSigmaNegLaPr->Interpolate(v0.p()); - if (deltaTimePositiveK0ShortPi > -1e+5) - nSigmaPositiveK0ShortPi = (deltaTimePositiveK0ShortPi - hMeanPosK0Pi->Interpolate(v0.p())) / hSigmaPosK0Pi->Interpolate(v0.p()); - if (deltaTimeNegativeK0ShortPi > -1e+5) - nSigmaNegativeK0ShortPi = (deltaTimeNegativeK0ShortPi - hMeanNegK0Pi->Interpolate(v0.p())) / hSigmaNegK0Pi->Interpolate(v0.p()); - - v0tofnsigmas( - nSigmaPositiveLambdaPr, nSigmaNegativeLambdaPi, - nSigmaNegativeLambdaPr, nSigmaPositiveLambdaPi, - nSigmaPositiveK0ShortPi, nSigmaNegativeK0ShortPi); - } + //_____________________________________________________________________________________________ + // time of V0 segment + float lengthV0 = std::hypot(v0.x() - collision.posX(), v0.y() - collision.posY(), v0.z() - collision.posZ()); + float velocityK0Short = velocity(v0.p(), o2::constants::physics::MassKaonNeutral); + float velocityLambda = velocity(v0.p(), o2::constants::physics::MassLambda); + float timeK0Short = lengthV0 / velocityK0Short; // in picoseconds + float timeLambda = lengthV0 / velocityLambda; // in picoseconds - if (doQA) { - // length factor due to eta (to offset e-loss) - float positiveCosine = 1.0f / sqrt(1.0f + posTrack.getTgl() * posTrack.getTgl()); - float negativeCosine = 1.0f / sqrt(1.0f + negTrack.getTgl() * negTrack.getTgl()); - if (propagationConfiguration.correctELossInclination.value == false) { - negativeCosine = positiveCosine = 1.0f; + //_____________________________________________________________________________________________ + // define simple checks + bool passesQAcuts = (v0.v0cosPA() > v0Group.qaCosPA && v0.dcaV0daughters() < v0Group.qaDCADau); + bool lambdaCandidate = std::abs(v0.mLambda() - o2::constants::physics::MassLambda) < v0Group.qaMassWindow && + std::abs(pTof.tpcNSigmaPr) < v0Group.qaTPCNSigma && + std::abs(nTof.tpcNSigmaPi) < v0Group.qaTPCNSigma; + bool antiLambdaCandidate = std::abs(v0.mAntiLambda() - o2::constants::physics::MassLambda) < v0Group.qaMassWindow && + std::abs(pTof.tpcNSigmaPi) < v0Group.qaTPCNSigma && + std::abs(nTof.tpcNSigmaPr) < v0Group.qaTPCNSigma; + bool k0ShortCandidate = std::abs(v0.mK0Short() - o2::constants::physics::MassKaonNeutral) < v0Group.qaMassWindow && + std::abs(pTof.tpcNSigmaPi) < v0Group.qaTPCNSigma && + std::abs(nTof.tpcNSigmaPi) < v0Group.qaTPCNSigma; + + //_____________________________________________________________________________________________ + // Actual calculation + if (pTof.hasTOF && pTof.hasITS) { + float velocityPositivePr, velocityPositivePi, lengthPositive; + velocityPositivePr = velocityPositivePi = lengthPositive = o2::aod::v0data::kNoTOFValue; + // method 0: legacy standalone without use of primary particle TOF + if (calculationMethod.value == 0) { + velocityPositivePr = velocity(posTrack.getP(), o2::constants::physics::MassProton); + velocityPositivePi = velocity(posTrack.getP(), o2::constants::physics::MassPionCharged); + lengthPositive = findInterceptLength(posTrack, d_bz); + v0tof.timePositivePr = lengthPositive / velocityPositivePr; + v0tof.timePositivePi = lengthPositive / velocityPositivePi; } + // method 1: correct primary particle TOF information + // length -> revise by removing travel length to primary vertex + // expected momentum -> kept as is for now, could correct at second stage + // use main method from TOF to calculate expected time + if (calculationMethod.value == 1) { + if (pTof.collisionId >= 0) { + auto trackCollision = collisions.rawIteratorAt(pTof.collisionId); + const o2::math_utils::Point3D trackVertex{trackCollision.posX(), trackCollision.posY(), trackCollision.posZ()}; + o2::track::TrackLTIntegral ltIntegral; + bool successPropag = o2::base::Propagator::Instance()->propagateToDCA(trackVertex, posTrack, d_bz, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrNONE, nullptr, <Integral); + if (successPropag) { + lengthPositive = pTof.length - ltIntegral.getL(); + v0tof.timePositivePr = o2::framework::pid::tof::MassToExpTime(pTof.tofExpMom, lengthPositive, o2::constants::physics::MassProton * o2::constants::physics::MassProton); + v0tof.timePositivePi = o2::framework::pid::tof::MassToExpTime(pTof.tofExpMom, lengthPositive, o2::constants::physics::MassPionCharged * o2::constants::physics::MassPionCharged); + } + } + } + if (lengthPositive > 0.0f) { + v0tof.deltaTimePositiveLambdaPr = (pTof.tofSignal - pTof.tofEvTime) - (timeLambda + v0tof.timePositivePr); + v0tof.deltaTimePositiveLambdaPi = (pTof.tofSignal - pTof.tofEvTime) - (timeLambda + v0tof.timePositivePi); + v0tof.deltaTimePositiveK0ShortPi = (pTof.tofSignal - pTof.tofEvTime) - (timeK0Short + v0tof.timePositivePi); + + // de facto nsigma + if (nSigmaCalibLoaded) { + v0tof.nSigmaPositiveLambdaPi = (v0tof.deltaTimePositiveLambdaPi - hMeanPosLaPi->Interpolate(v0.p())) / hSigmaPosLaPi->Interpolate(v0.p()); + v0tof.nSigmaPositiveLambdaPr = (v0tof.deltaTimePositiveLambdaPr - hMeanPosLaPr->Interpolate(v0.p())) / hSigmaPosLaPr->Interpolate(v0.p()); + v0tof.nSigmaPositiveK0ShortPi = (v0tof.deltaTimePositiveK0ShortPi - hMeanPosK0Pi->Interpolate(v0.p())) / hSigmaPosK0Pi->Interpolate(v0.p()); + } - if (pTra.hasTOF() && pTra.hasITS()) { - if (v0.v0cosPA() > v0Group.qaCosPA && v0.dcaV0daughters() < v0Group.qaDCADau) { - if (std::abs(v0.mLambda() - 1.115683) < v0Group.qaMassWindow && fabs(pTra.tpcNSigmaPr()) < v0Group.qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma && ((v0pdg == 0) || (v0pdg == 3122))) { - histos.fill(HIST("h2dDeltaTimePositiveLambdaPr"), v0.p(), v0.eta(), deltaTimePositiveLambdaPr); - if (calculationMethod.value == 2 && std::abs(timePositivePr_Method0 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon && std::abs(timePositivePr_Method1 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { - histos.fill(HIST("hDeltaTimeMethodsVsP_posLaPr"), positiveP, v0.positiveeta(), (timePositivePr_Method0 - timePositivePr_Method1) * positiveCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_posLaPr"), positiveP, v0.positiveeta(), (timePositivePr_Method1 / timePositivePr_Method0) * positiveCosine); + // do QA histograms (calibration / QC) + if (doQA) { + if (passesQAcuts) { + if (lambdaCandidate) { + histos.fill(HIST("h2dDeltaTimePositiveLambdaPr"), v0.p(), v0.eta(), v0tof.deltaTimePositiveLambdaPr); } - if (doQANSigma) - histos.fill(HIST("h2dNSigmaPositiveLambdaPr"), v0.p(), nSigmaPositiveLambdaPr); - } - if (std::abs(v0.mAntiLambda() - 1.115683) < v0Group.qaMassWindow && fabs(pTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma && fabs(nTra.tpcNSigmaPr()) < v0Group.qaTPCNSigma && ((v0pdg == 0) || (v0pdg == -3122))) { - histos.fill(HIST("h2dDeltaTimePositiveLambdaPi"), v0.p(), v0.eta(), deltaTimePositiveLambdaPi); - if (calculationMethod.value == 2 && std::abs(timePositivePi_Method0 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon && std::abs(timePositivePi_Method1 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { - histos.fill(HIST("hDeltaTimeMethodsVsP_posLaPi"), positiveP, v0.positiveeta(), (timePositivePi_Method0 - timePositivePi_Method1) * positiveCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_posLaPi"), positiveP, v0.positiveeta(), (timePositivePi_Method1 / timePositivePi_Method0) * positiveCosine); + if (antiLambdaCandidate) { + histos.fill(HIST("h2dDeltaTimePositiveLambdaPi"), v0.p(), v0.eta(), v0tof.deltaTimePositiveLambdaPi); } - if (doQANSigma) - histos.fill(HIST("h2dNSigmaPositiveLambdaPi"), v0.p(), nSigmaPositiveLambdaPi); - } - if (std::abs(v0.mK0Short() - 0.497) < v0Group.qaMassWindow && fabs(pTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma && ((v0pdg == 0) || (v0pdg == 310))) { - histos.fill(HIST("h2dDeltaTimePositiveK0ShortPi"), v0.p(), v0.eta(), deltaTimePositiveK0ShortPi); - if (calculationMethod.value == 2 && std::abs(timePositivePi_Method0 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon && std::abs(timePositivePi_Method1 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { - histos.fill(HIST("hDeltaTimeMethodsVsP_posK0Pi"), positiveP, v0.positiveeta(), (timePositivePi_Method0 - timePositivePi_Method1) * positiveCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_posK0Pi"), positiveP, v0.positiveeta(), (timePositivePi_Method1 / timePositivePi_Method0) * positiveCosine); + if (k0ShortCandidate) { + histos.fill(HIST("h2dDeltaTimePositiveK0ShortPi"), v0.p(), v0.eta(), v0tof.deltaTimePositiveK0ShortPi); } - if (doQANSigma) - histos.fill(HIST("h2dNSigmaPositiveK0ShortPi"), v0.p(), nSigmaPositiveK0ShortPi); } } } + } + if (nTof.hasTOF && nTof.hasITS) { + float velocityNegativePr, velocityNegativePi, lengthNegative; + velocityNegativePr = velocityNegativePi = lengthNegative = o2::aod::v0data::kNoTOFValue; + // method 0: legacy standalone without use of primary particle TOF + if (calculationMethod.value == 0) { + velocityNegativePr = velocity(negTrack.getP(), o2::constants::physics::MassProton); + velocityNegativePi = velocity(negTrack.getP(), o2::constants::physics::MassPionCharged); + lengthNegative = findInterceptLength(negTrack, d_bz); + v0tof.timeNegativePr = lengthNegative / velocityNegativePr; + v0tof.timeNegativePi = lengthNegative / velocityNegativePi; + } + // method 1: correct primary particle TOF information + // length -> revise by removing travel length to primary vertex + // expected momentum -> kept as is for now, could correct at second stage + // use main method from TOF to calculate expected time + if (calculationMethod.value == 1) { + if (nTof.collisionId >= 0) { + auto trackCollision = collisions.rawIteratorAt(nTof.collisionId); + const o2::math_utils::Point3D trackVertex{trackCollision.posX(), trackCollision.posY(), trackCollision.posZ()}; + o2::track::TrackLTIntegral ltIntegral; + bool successPropag = o2::base::Propagator::Instance()->propagateToDCA(trackVertex, negTrack, d_bz, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrNONE, nullptr, <Integral); + if (successPropag) { + lengthNegative = nTof.length - ltIntegral.getL(); + v0tof.timeNegativePr = o2::framework::pid::tof::MassToExpTime(nTof.tofExpMom, nTof.length - ltIntegral.getL(), o2::constants::physics::MassProton * o2::constants::physics::MassProton); + v0tof.timeNegativePi = o2::framework::pid::tof::MassToExpTime(nTof.tofExpMom, nTof.length - ltIntegral.getL(), o2::constants::physics::MassPionCharged * o2::constants::physics::MassPionCharged); + } + } + } + if (lengthNegative > 0.0f) { + v0tof.deltaTimeNegativeLambdaPr = (nTof.tofSignal - nTof.tofEvTime) - (timeLambda + v0tof.timeNegativePr); + v0tof.deltaTimeNegativeLambdaPi = (nTof.tofSignal - nTof.tofEvTime) - (timeLambda + v0tof.timeNegativePi); + v0tof.deltaTimeNegativeK0ShortPi = (nTof.tofSignal - nTof.tofEvTime) - (timeK0Short + v0tof.timeNegativePi); + + // de facto nsigma + if (nSigmaCalibLoaded) { + v0tof.nSigmaNegativeLambdaPi = (v0tof.deltaTimeNegativeLambdaPi - hMeanNegLaPi->Interpolate(v0.p())) / hSigmaNegLaPi->Interpolate(v0.p()); + v0tof.nSigmaNegativeLambdaPr = (v0tof.deltaTimeNegativeLambdaPr - hMeanNegLaPr->Interpolate(v0.p())) / hSigmaNegLaPr->Interpolate(v0.p()); + v0tof.nSigmaNegativeK0ShortPi = (v0tof.deltaTimeNegativeK0ShortPi - hMeanNegK0Pi->Interpolate(v0.p())) / hSigmaNegK0Pi->Interpolate(v0.p()); + } - if (nTra.hasTOF() && nTra.hasITS()) { - if (v0.v0cosPA() > v0Group.qaCosPA && v0.dcaV0daughters() < v0Group.qaDCADau) { - if (std::abs(v0.mLambda() - 1.115683) < v0Group.qaMassWindow && fabs(pTra.tpcNSigmaPr()) < v0Group.qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma && ((v0pdg == 0) || (v0pdg == 3122))) { - histos.fill(HIST("h2dDeltaTimeNegativeLambdaPi"), v0.p(), v0.eta(), deltaTimeNegativeLambdaPi); - if (calculationMethod.value == 2 && std::abs(timeNegativePi_Method0 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon && std::abs(timeNegativePi_Method1 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { - histos.fill(HIST("hDeltaTimeMethodsVsP_negLaPi"), negativeP, v0.negativeeta(), (timeNegativePi_Method0 - timeNegativePi_Method1) * negativeCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_negLaPi"), negativeP, v0.negativeeta(), (timeNegativePi_Method1 / timeNegativePi_Method0)); + // do QA histograms (calibration / QC) + if (doQA) { + if (passesQAcuts) { + if (lambdaCandidate) { + histos.fill(HIST("h2dDeltaTimeNegativeLambdaPi"), v0.p(), v0.eta(), v0tof.deltaTimeNegativeLambdaPi); } - // delta lambda decay time - histos.fill(HIST("h2dLambdaDeltaDecayTime"), v0.p(), deltaDecayTimeLambda); - if (doQANSigma) - histos.fill(HIST("h2dNSigmaNegativeLambdaPi"), v0.p(), nSigmaNegativeLambdaPi); - } - if (std::abs(v0.mAntiLambda() - 1.115683) < v0Group.qaMassWindow && fabs(pTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma && fabs(nTra.tpcNSigmaPr()) < v0Group.qaTPCNSigma && ((v0pdg == 0) || (v0pdg == -3122))) { - histos.fill(HIST("h2dDeltaTimeNegativeLambdaPr"), v0.p(), v0.eta(), deltaTimeNegativeLambdaPr); - if (calculationMethod.value == 2 && std::abs(timeNegativePr_Method0 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon && std::abs(timeNegativePr_Method1 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { - histos.fill(HIST("hDeltaTimeMethodsVsP_negLaPr"), negativeP, v0.negativeeta(), (timeNegativePr_Method0 - timeNegativePr_Method1) * negativeCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_negLaPr"), negativeP, v0.negativeeta(), (timeNegativePr_Method1 / timeNegativePr_Method0)); + if (antiLambdaCandidate) { + histos.fill(HIST("h2dDeltaTimeNegativeLambdaPr"), v0.p(), v0.eta(), v0tof.deltaTimeNegativeLambdaPr); } - if (doQANSigma) - histos.fill(HIST("h2dNSigmaNegativeLambdaPr"), v0.p(), nSigmaNegativeLambdaPr); - } - if (std::abs(v0.mK0Short() - 0.497) < v0Group.qaMassWindow && fabs(pTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < v0Group.qaTPCNSigma && ((v0pdg == 0) || (v0pdg == 310))) { - histos.fill(HIST("h2dDeltaTimeNegativeK0ShortPi"), v0.p(), v0.eta(), deltaTimeNegativeK0ShortPi); - if (calculationMethod.value == 2 && std::abs(timeNegativePi_Method0 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon && std::abs(timeNegativePi_Method1 - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { - histos.fill(HIST("hDeltaTimeMethodsVsP_negK0Pi"), negativeP, v0.negativeeta(), (timeNegativePi_Method0 - timeNegativePi_Method1) * negativeCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_negK0Pi"), negativeP, v0.negativeeta(), (timeNegativePi_Method1 / timeNegativePi_Method0)); + if (k0ShortCandidate) { + histos.fill(HIST("h2dDeltaTimeNegativeK0ShortPi"), v0.p(), v0.eta(), v0tof.deltaTimeNegativeK0ShortPi); } - if (doQANSigma) - histos.fill(HIST("h2dNSigmaNegativeK0ShortPi"), v0.p(), nSigmaNegativeK0ShortPi); } } } } - } - template - void processCascadeCandidate(TCollision const& collision, TCascade const& cascade, TTrack const& pTra, TTrack const& nTra, TTrack const& bTra, int cascpdg) + return v0tof; + } // end calculation altogether + + template + cascTofInfo calculateTofInfoCascade(TCollisions const& collisions, int const& collisionId, TCascade const& cascade, TTOFInfo const& pTof, TTOFInfo const& nTof, TTOFInfo const& bTof) { - // initialize from positions and momenta as needed + cascTofInfo casctof; // return this struct + auto collision = collisions.rawIteratorAt(collisionId); + + //_____________________________________________________________________________________________ + // daughter tracks: initialize from V0 position and momenta o2::track::TrackPar posTrack = o2::track::TrackPar({cascade.xlambda(), cascade.ylambda(), cascade.zlambda()}, {cascade.pxpos(), cascade.pypos(), cascade.pzpos()}, +1, false); o2::track::TrackPar negTrack = o2::track::TrackPar({cascade.xlambda(), cascade.ylambda(), cascade.zlambda()}, {cascade.pxneg(), cascade.pyneg(), cascade.pzneg()}, -1, false); o2::track::TrackPar bachTrack = o2::track::TrackPar({cascade.x(), cascade.y(), cascade.z()}, {cascade.pxbach(), cascade.pybach(), cascade.pzbach()}, cascade.sign(), false); o2::track::TrackPar cascTrack = o2::track::TrackPar({cascade.x(), cascade.y(), cascade.z()}, {cascade.px(), cascade.py(), cascade.pz()}, cascade.sign(), false); - float positiveP = std::hypot(cascade.pxpos(), cascade.pypos(), cascade.pzpos()); - float negativeP = std::hypot(cascade.pxneg(), cascade.pyneg(), cascade.pzneg()); - float bachelorP = std::hypot(cascade.pxbach(), cascade.pybach(), cascade.pzbach()); - - // start calculation: calculate velocities + //_____________________________________________________________________________________________ + // time of V0 segment float velocityXi = velocity(cascTrack.getP(), o2::constants::physics::MassXiMinus); float velocityOm = velocity(cascTrack.getP(), o2::constants::physics::MassOmegaMinus); float velocityLa = velocity(std::hypot(cascade.pxlambda(), cascade.pylambda(), cascade.pzlambda()), o2::constants::physics::MassLambda); - - // calculate mother lengths float lengthV0 = std::hypot(cascade.xlambda() - cascade.x(), cascade.ylambda() - cascade.y(), cascade.zlambda() - cascade.z()); float lengthCascade = o2::aod::cascdata::kNoTOFValue; - ; - const o2::math_utils::Point3D collVtx{collision.getX(), collision.getY(), collision.getZ()}; + + // cascade length (N.B. could be simpler via trackLTIntegral, kept with legacy calculation) + const o2::math_utils::Point3D collVtx{collision.posX(), collision.posY(), collision.posZ()}; bool successPropag = o2::base::Propagator::Instance()->propagateToDCA(collVtx, cascTrack, d_bz, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrNONE); float d = -1.0f; - float linearToPV = std::hypot(cascade.x() - collision.getX(), cascade.y() - collision.getY(), cascade.z() - collision.getZ()); + float linearToPV = std::hypot(cascade.x() - collision.posX(), cascade.y() - collision.posY(), cascade.z() - collision.posZ()); if (successPropag) { std::array cascCloseToPVPosition; cascTrack.getXYZGlo(cascCloseToPVPosition); @@ -1136,349 +814,234 @@ struct strangenesstofpid { lengthCascade = linearToPV; // if propagation failed, use linear estimate (optional: actually do not define?) } - // lambda, xi and omega flight time is always defined + // flight times of decaying particles float lambdaFlight = lengthV0 / velocityLa; float xiFlight = lengthCascade / velocityXi; float omFlight = lengthCascade / velocityOm; - float posFlightPi = o2::aod::cascdata::kNoTOFValue; - float posFlightPr = o2::aod::cascdata::kNoTOFValue; - float negFlightPi = o2::aod::cascdata::kNoTOFValue; - float negFlightPr = o2::aod::cascdata::kNoTOFValue; - float bachFlightPi = o2::aod::cascdata::kNoTOFValue; - float bachFlightKa = o2::aod::cascdata::kNoTOFValue; - float posFlightPi_Method0 = o2::aod::cascdata::kNoTOFValue; - float posFlightPr_Method0 = o2::aod::cascdata::kNoTOFValue; - float negFlightPi_Method0 = o2::aod::cascdata::kNoTOFValue; - float negFlightPr_Method0 = o2::aod::cascdata::kNoTOFValue; - float bachFlightPi_Method0 = o2::aod::cascdata::kNoTOFValue; - float bachFlightKa_Method0 = o2::aod::cascdata::kNoTOFValue; - - float posFlightPi_Method1 = o2::aod::cascdata::kNoTOFValue; - float posFlightPr_Method1 = o2::aod::cascdata::kNoTOFValue; - float negFlightPi_Method1 = o2::aod::cascdata::kNoTOFValue; - float negFlightPr_Method1 = o2::aod::cascdata::kNoTOFValue; - float bachFlightPi_Method1 = o2::aod::cascdata::kNoTOFValue; - float bachFlightKa_Method1 = o2::aod::cascdata::kNoTOFValue; - - // actual time-of-flight of daughter calculation - if (calculationMethod.value == 0 || calculationMethod.value == 2) { - float velocityPositivePr = velocity(posTrack.getP(), o2::constants::physics::MassProton); - float velocityPositivePi = velocity(posTrack.getP(), o2::constants::physics::MassPionCharged); - float velocityNegativePr = velocity(negTrack.getP(), o2::constants::physics::MassProton); - float velocityNegativePi = velocity(negTrack.getP(), o2::constants::physics::MassPionCharged); - float velocityBachelorPi = velocity(bachTrack.getP(), o2::constants::physics::MassPionCharged); - float velocityBachelorKa = velocity(bachTrack.getP(), o2::constants::physics::MassKaonCharged); - - float lengthPositive = findInterceptLength(posTrack, d_bz); // FIXME: tofPosition ok? adjust? - float lengthNegative = findInterceptLength(negTrack, d_bz); // FIXME: tofPosition ok? adjust? - float lengthBachelor = findInterceptLength(bachTrack, d_bz); // FIXME: tofPosition ok? adjust? - - if (lengthPositive > 0 && pTra.hasTOF() && pTra.hasITS()) { - posFlightPi_Method0 = lengthPositive / velocityPositivePi; - posFlightPr_Method0 = lengthPositive / velocityPositivePr; - } - if (lengthNegative > 0 && nTra.hasTOF() && nTra.hasITS()) { - negFlightPi_Method0 = lengthNegative / velocityNegativePi; - negFlightPr_Method0 = lengthNegative / velocityNegativePr; - } - if (lengthBachelor > 0 && bTra.hasTOF() && bTra.hasITS()) { - bachFlightPi_Method0 = lengthBachelor / velocityBachelorPi; - bachFlightKa_Method0 = lengthBachelor / velocityBachelorKa; - } - } - - if (calculationMethod.value > 0) { - if (pTra.hasTOF() && pTra.hasITS()) { // calculate if signal present, otherwise skip - if (posTrack.getP() < propagationConfiguration.maxProtonMomentumForEloss.value && std::abs(pTra.tpcNSigmaPr()) < propagationConfiguration.tpcNsigmaThreshold) { - o2::track::TrackPar posTrackAsProton(posTrack); - posTrackAsProton.setPID(o2::track::PID::Proton); - calculateTOF(posTrackAsProton, posFlightPr_Method1); - } else { - posFlightPr_Method1 = posFlightPr_Method0; - } - - if (posTrack.getP() < propagationConfiguration.maxPionMomentumForEloss.value && std::abs(pTra.tpcNSigmaPi()) < propagationConfiguration.tpcNsigmaThreshold) { - o2::track::TrackPar posTrackAsPion(posTrack); - posTrackAsPion.setPID(o2::track::PID::Pion); - calculateTOF(posTrackAsPion, posFlightPi_Method1); - } else { - posFlightPi_Method1 = posFlightPi_Method0; - } + //_____________________________________________________________________________________________ + // define simple checks + bool passesQAcuts = (cascade.dcaV0daughters() < cascadeGroup.qaV0DCADau && cascade.dcacascdaughters() < cascadeGroup.qaCascDCADau && cascade.v0cosPA(collision.posX(), collision.posY(), collision.posZ()) > cascadeGroup.qaV0CosPA && cascade.casccosPA(collision.posX(), collision.posY(), collision.posZ()) > cascadeGroup.qaCascCosPA); + bool xiMinusCandidate = cascade.sign() < 0 && + std::abs(cascade.mXi() - o2::constants::physics::MassXiMinus) < cascadeGroup.qaMassWindow && + std::abs(pTof.tpcNSigmaPr) < cascadeGroup.qaTPCNSigma && + std::abs(nTof.tpcNSigmaPi) < cascadeGroup.qaTPCNSigma && + std::abs(bTof.tpcNSigmaPi) < cascadeGroup.qaTPCNSigma; + bool xiPlusCandidate = cascade.sign() > 0 && + std::abs(cascade.mXi() - o2::constants::physics::MassXiMinus) < cascadeGroup.qaMassWindow && + std::abs(pTof.tpcNSigmaPi) < cascadeGroup.qaTPCNSigma && + std::abs(nTof.tpcNSigmaPr) < cascadeGroup.qaTPCNSigma && + std::abs(bTof.tpcNSigmaPi) < cascadeGroup.qaTPCNSigma; + bool omegaMinusCandidate = cascade.sign() < 0 && + std::abs(cascade.mOmega() - o2::constants::physics::MassOmegaMinus) < cascadeGroup.qaMassWindow && + std::abs(pTof.tpcNSigmaPr) < cascadeGroup.qaTPCNSigma && + std::abs(nTof.tpcNSigmaPi) < cascadeGroup.qaTPCNSigma && + std::abs(bTof.tpcNSigmaKa) < cascadeGroup.qaTPCNSigma; + bool omegaPlusCandidate = cascade.sign() > 0 && + std::abs(cascade.mOmega() - o2::constants::physics::MassOmegaMinus) < cascadeGroup.qaMassWindow && + std::abs(pTof.tpcNSigmaPi) < cascadeGroup.qaTPCNSigma && + std::abs(nTof.tpcNSigmaPr) < cascadeGroup.qaTPCNSigma && + std::abs(bTof.tpcNSigmaKa) < cascadeGroup.qaTPCNSigma; + + //_____________________________________________________________________________________________ + // Actual calculation + if (pTof.hasTOF && pTof.hasITS) { + float velocityPositivePr, velocityPositivePi, lengthPositive; + velocityPositivePr = velocityPositivePi = lengthPositive = o2::aod::v0data::kNoTOFValue; + if (calculationMethod.value == 0) { + velocityPositivePr = velocity(posTrack.getP(), o2::constants::physics::MassProton); + velocityPositivePi = velocity(posTrack.getP(), o2::constants::physics::MassPionCharged); + lengthPositive = findInterceptLength(posTrack, d_bz); + casctof.posFlightPr = lengthPositive / velocityPositivePr; + casctof.posFlightPi = lengthPositive / velocityPositivePi; } - if (nTra.hasTOF() && nTra.hasITS()) { // calculate if signal present, otherwise skip - if (negTrack.getP() < propagationConfiguration.maxProtonMomentumForEloss.value && std::abs(nTra.tpcNSigmaPr()) < propagationConfiguration.tpcNsigmaThreshold) { - o2::track::TrackPar negTrackAsProton(negTrack); - negTrackAsProton.setPID(o2::track::PID::Proton); - calculateTOF(negTrackAsProton, negFlightPr_Method1); - } else { - negFlightPr_Method1 = negFlightPr_Method0; - } - - if (negTrack.getP() < propagationConfiguration.maxProtonMomentumForEloss.value && std::abs(nTra.tpcNSigmaPi()) < propagationConfiguration.tpcNsigmaThreshold) { - o2::track::TrackPar negTrackAsPion(negTrack); - negTrackAsPion.setPID(o2::track::PID::Pion); - calculateTOF(negTrackAsPion, negFlightPi_Method1); - } else { - negFlightPi_Method1 = negFlightPi_Method0; + // method 1: correct primary particle TOF information + // length -> revise by removing travel length to primary vertex + // expected momentum -> kept as is for now, could correct at second stage + // use main method from TOF to calculate expected time + if (calculationMethod.value == 1) { + if (pTof.collisionId >= 0) { + auto trackCollision = collisions.rawIteratorAt(pTof.collisionId); + const o2::math_utils::Point3D trackVertex{trackCollision.posX(), trackCollision.posY(), trackCollision.posZ()}; + o2::track::TrackLTIntegral ltIntegral; + bool successPropag = o2::base::Propagator::Instance()->propagateToDCA(trackVertex, posTrack, d_bz, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrNONE, nullptr, <Integral); + if (successPropag) { + lengthPositive = pTof.length - ltIntegral.getL(); + casctof.posFlightPr = o2::framework::pid::tof::MassToExpTime(pTof.tofExpMom, pTof.length - ltIntegral.getL(), o2::constants::physics::MassProton * o2::constants::physics::MassProton); + casctof.posFlightPi = o2::framework::pid::tof::MassToExpTime(pTof.tofExpMom, pTof.length - ltIntegral.getL(), o2::constants::physics::MassPionCharged * o2::constants::physics::MassPionCharged); + } } } - if (bTra.hasTOF() && bTra.hasITS()) { // calculate if signal present, otherwise skip - if (bachTrack.getP() < propagationConfiguration.maxPionMomentumForEloss.value && std::abs(bTra.tpcNSigmaPi()) < propagationConfiguration.tpcNsigmaThreshold) { - o2::track::TrackPar bachTrackAsPion(bachTrack); - bachTrackAsPion.setPID(o2::track::PID::Pion); - calculateTOF(bachTrackAsPion, bachFlightPi_Method1); - } else { - bachFlightPi_Method1 = bachFlightPi_Method0; + if (lengthPositive > 0.0f) { + casctof.posDeltaTimeAsXiPi = (pTof.tofSignal - pTof.tofEvTime) - (xiFlight + lambdaFlight + casctof.posFlightPi); + casctof.posDeltaTimeAsXiPr = (pTof.tofSignal - pTof.tofEvTime) - (xiFlight + lambdaFlight + casctof.posFlightPr); + casctof.posDeltaTimeAsOmPi = (pTof.tofSignal - pTof.tofEvTime) - (omFlight + lambdaFlight + casctof.posFlightPi); + casctof.posDeltaTimeAsOmPr = (pTof.tofSignal - pTof.tofEvTime) - (omFlight + lambdaFlight + casctof.posFlightPr); + + // de facto nsigma + if (nSigmaCalibLoaded) { + if (cascade.sign() < 0) { + casctof.nSigmaXiLaPr = (casctof.posDeltaTimeAsXiPr - hMeanPosXiPr->Interpolate(cascade.p())) / hSigmaPosXiPr->Interpolate(cascade.p()); + casctof.nSigmaOmLaPr = (casctof.posDeltaTimeAsOmPr - hMeanPosOmPr->Interpolate(cascade.p())) / hSigmaPosOmPr->Interpolate(cascade.p()); + } else { + casctof.nSigmaXiLaPi = (casctof.posDeltaTimeAsXiPi - hMeanPosXiPi->Interpolate(cascade.p())) / hSigmaPosXiPi->Interpolate(cascade.p()); + casctof.nSigmaOmLaPi = (casctof.posDeltaTimeAsOmPi - hMeanPosOmPi->Interpolate(cascade.p())) / hSigmaPosOmPi->Interpolate(cascade.p()); + } } - if (bachTrack.getP() < propagationConfiguration.maxKaonMomentumForEloss.value && std::abs(bTra.tpcNSigmaKa()) < propagationConfiguration.tpcNsigmaThreshold) { - o2::track::TrackPar bachTrackAsKaon(bachTrack); - bachTrackAsKaon.setPID(o2::track::PID::Kaon); - calculateTOF(bachTrackAsKaon, bachFlightKa_Method1); - } else { - bachFlightKa_Method1 = bachFlightKa_Method0; + // do QA histograms (calibration / QC) + if (doQA) { + if (passesQAcuts) { + if (xiMinusCandidate) { + histos.fill(HIST("h2dposDeltaTimeAsXiPr"), cascade.p(), cascade.eta(), casctof.posDeltaTimeAsXiPr); + } + if (xiPlusCandidate) { + histos.fill(HIST("h2dposDeltaTimeAsXiPi"), cascade.p(), cascade.eta(), casctof.posDeltaTimeAsXiPi); + } + if (omegaMinusCandidate) { + histos.fill(HIST("h2dposDeltaTimeAsOmPr"), cascade.p(), cascade.eta(), casctof.posDeltaTimeAsOmPr); + } + if (omegaPlusCandidate) { + histos.fill(HIST("h2dposDeltaTimeAsOmPi"), cascade.p(), cascade.eta(), casctof.posDeltaTimeAsOmPi); + } + } } } - } - - // assign values to be used in main calculation - if (calculationMethod.value == 0) { - posFlightPi = posFlightPi_Method0; - posFlightPr = posFlightPr_Method0; - negFlightPi = negFlightPi_Method0; - negFlightPr = negFlightPr_Method0; - bachFlightPi = bachFlightPi_Method0; - bachFlightKa = bachFlightKa_Method0; - } else { - posFlightPi = posFlightPi_Method1; - posFlightPr = posFlightPr_Method1; - negFlightPi = negFlightPi_Method1; - negFlightPr = negFlightPr_Method1; - bachFlightPi = bachFlightPi_Method1; - bachFlightKa = bachFlightKa_Method1; - } - - if (calculationMethod.value == 2) { - // do analysis of successes and failures - bool positiveSuccessMethod0Pr = std::abs(posFlightPr_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon; - bool negativeSuccessMethod0Pr = std::abs(negFlightPr_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon; - bool positiveSuccessMethod1Pr = std::abs(posFlightPr_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon; - bool negativeSuccessMethod1Pr = std::abs(negFlightPr_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon; - bool positiveSuccessMethod0Pi = std::abs(posFlightPi_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon; - bool negativeSuccessMethod0Pi = std::abs(negFlightPi_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon; - bool positiveSuccessMethod1Pi = std::abs(posFlightPi_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon; - bool negativeSuccessMethod1Pi = std::abs(negFlightPi_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon; - - bool bachelorSuccessMethod0Pi = std::abs(bachFlightPi_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon; - bool bachelorSuccessMethod0Ka = std::abs(bachFlightKa_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon; - bool bachelorSuccessMethod1Pi = std::abs(bachFlightPi_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon; - bool bachelorSuccessMethod1Ka = std::abs(bachFlightKa_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon; - - int encodedPositiveSuccessPi = positiveSuccessMethod0Pi + 2 * positiveSuccessMethod1Pi; - int encodedPositiveSuccessPr = positiveSuccessMethod0Pr + 2 * positiveSuccessMethod1Pr; - int encodedNegativeSuccessPi = negativeSuccessMethod0Pi + 2 * negativeSuccessMethod1Pi; - int encodedNegativeSuccessPr = negativeSuccessMethod0Pr + 2 * negativeSuccessMethod1Pr; - int encodedBachelorSuccessPi = bachelorSuccessMethod0Pi + 2 * bachelorSuccessMethod1Pi; - int encodedBachelorSuccessKa = bachelorSuccessMethod0Ka + 2 * bachelorSuccessMethod1Ka; - - if (pTra.hasTOF()) { - histos.fill(HIST("h2dSucessRateProton"), positiveP, encodedPositiveSuccessPr); - histos.fill(HIST("h2dSucessRatePion"), positiveP, encodedPositiveSuccessPi); - } - if (nTra.hasTOF()) { - histos.fill(HIST("h2dSucessRateProton"), negativeP, encodedNegativeSuccessPr); - histos.fill(HIST("h2dSucessRatePion"), negativeP, encodedNegativeSuccessPi); + } // end positive + + if (nTof.hasTOF && nTof.hasITS) { + float velocityNegativePr, velocityNegativePi, lengthNegative; + velocityNegativePr = velocityNegativePi = lengthNegative = o2::aod::v0data::kNoTOFValue; + // method 0: legacy standalone without use of primary particle TOF + if (calculationMethod.value == 0) { + velocityNegativePr = velocity(negTrack.getP(), o2::constants::physics::MassProton); + velocityNegativePi = velocity(negTrack.getP(), o2::constants::physics::MassPionCharged); + lengthNegative = findInterceptLength(negTrack, d_bz); + casctof.negFlightPr = lengthNegative / velocityNegativePr; + casctof.negFlightPi = lengthNegative / velocityNegativePi; } - if (bTra.hasTOF()) { - histos.fill(HIST("h2dSucessRateKaon"), bachelorP, encodedBachelorSuccessKa); - histos.fill(HIST("h2dSucessRatePion"), bachelorP, encodedBachelorSuccessPi); - } - } - - // initialize delta-times (actual PID variables) - float posDeltaTimeAsXiPi = o2::aod::cascdata::kNoTOFValue, posDeltaTimeAsXiPr = o2::aod::cascdata::kNoTOFValue; - float negDeltaTimeAsXiPi = o2::aod::cascdata::kNoTOFValue, negDeltaTimeAsXiPr = o2::aod::cascdata::kNoTOFValue; - float bachDeltaTimeAsXiPi = o2::aod::cascdata::kNoTOFValue; - float posDeltaTimeAsOmPi = o2::aod::cascdata::kNoTOFValue, posDeltaTimeAsOmPr = o2::aod::cascdata::kNoTOFValue; - float negDeltaTimeAsOmPi = o2::aod::cascdata::kNoTOFValue, negDeltaTimeAsOmPr = o2::aod::cascdata::kNoTOFValue; - float bachDeltaTimeAsOmKa = o2::aod::cascdata::kNoTOFValue; - - if (pTra.hasTOF() && pTra.hasITS()) { - posDeltaTimeAsXiPi = (pTra.tofSignal() - pTra.tofEvTime()) - (xiFlight + lambdaFlight + posFlightPi); - posDeltaTimeAsXiPr = (pTra.tofSignal() - pTra.tofEvTime()) - (xiFlight + lambdaFlight + posFlightPr); - posDeltaTimeAsOmPi = (pTra.tofSignal() - pTra.tofEvTime()) - (omFlight + lambdaFlight + posFlightPi); - posDeltaTimeAsOmPr = (pTra.tofSignal() - pTra.tofEvTime()) - (omFlight + lambdaFlight + posFlightPr); - } - if (nTra.hasTOF() && nTra.hasITS()) { - negDeltaTimeAsXiPi = (nTra.tofSignal() - nTra.tofEvTime()) - (xiFlight + lambdaFlight + negFlightPi); - negDeltaTimeAsXiPr = (nTra.tofSignal() - nTra.tofEvTime()) - (xiFlight + lambdaFlight + negFlightPr); - negDeltaTimeAsOmPi = (nTra.tofSignal() - nTra.tofEvTime()) - (omFlight + lambdaFlight + negFlightPi); - negDeltaTimeAsOmPr = (nTra.tofSignal() - nTra.tofEvTime()) - (omFlight + lambdaFlight + negFlightPr); - } - if (bTra.hasTOF() && bTra.hasITS()) { - bachDeltaTimeAsXiPi = (bTra.tofSignal() - bTra.tofEvTime()) - (xiFlight + bachFlightPi); - bachDeltaTimeAsOmKa = (bTra.tofSignal() - bTra.tofEvTime()) - (omFlight + bachFlightKa); - } - - casctofpids( - posDeltaTimeAsXiPi, posDeltaTimeAsXiPr, negDeltaTimeAsXiPi, negDeltaTimeAsXiPr, bachDeltaTimeAsXiPi, - posDeltaTimeAsOmPi, posDeltaTimeAsOmPr, negDeltaTimeAsOmPi, negDeltaTimeAsOmPr, bachDeltaTimeAsOmKa); - - float nSigmaXiLaPr = o2::aod::cascdata::kNoTOFValue; - float nSigmaXiLaPi = o2::aod::cascdata::kNoTOFValue; - float nSigmaXiPi = o2::aod::cascdata::kNoTOFValue; - float nSigmaOmLaPr = o2::aod::cascdata::kNoTOFValue; - float nSigmaOmLaPi = o2::aod::cascdata::kNoTOFValue; - float nSigmaOmKa = o2::aod::cascdata::kNoTOFValue; - - // go for Nsigma values if requested - if (doNSigmas && nSigmaCalibLoaded) { - // Xi hypothesis ________________________ - if (cascade.sign() < 0) { // XiMinus - if (posDeltaTimeAsXiPr > -1e+5) // proton from Lambda from XiMinus has signal - nSigmaXiLaPr = (posDeltaTimeAsXiPr - hMeanPosXiPr->Interpolate(cascade.p())) / hSigmaPosXiPr->Interpolate(cascade.p()); - if (negDeltaTimeAsXiPi > -1e+5) // pion from Lambda from XiMinus has signal - nSigmaXiLaPi = (negDeltaTimeAsXiPi - hMeanNegXiPi->Interpolate(cascade.p())) / hSigmaNegXiPi->Interpolate(cascade.p()); - if (bachDeltaTimeAsXiPi > -1e+5) // pion from XiMinus has signal - nSigmaXiPi = (bachDeltaTimeAsXiPi - hMeanBachXiPi->Interpolate(cascade.p())) / hSigmaBachXiPi->Interpolate(cascade.p()); - if (posDeltaTimeAsOmPr > -1e+5) // proton from Lambda from OmegaMinus has signal - nSigmaOmLaPr = (posDeltaTimeAsOmPr - hMeanPosOmPr->Interpolate(cascade.p())) / hSigmaPosOmPr->Interpolate(cascade.p()); - if (negDeltaTimeAsOmPi > -1e+5) // pion from Lambda from OmegaMinus has signal - nSigmaOmLaPi = (negDeltaTimeAsOmPi - hMeanNegOmPi->Interpolate(cascade.p())) / hSigmaNegOmPi->Interpolate(cascade.p()); - if (bachDeltaTimeAsOmKa > -1e+5) // kaon from OmegaMinus has signal - nSigmaOmKa = (bachDeltaTimeAsOmKa - hMeanBachOmKa->Interpolate(cascade.p())) / hSigmaBachOmKa->Interpolate(cascade.p()); - } else { - if (posDeltaTimeAsXiPi > -1e+5) // proton from Lambda from XiMinus has signal - nSigmaXiLaPi = (posDeltaTimeAsXiPi - hMeanPosXiPi->Interpolate(cascade.p())) / hSigmaPosXiPi->Interpolate(cascade.p()); - if (negDeltaTimeAsXiPr > -1e+5) // pion from Lambda from XiMinus has signal - nSigmaXiLaPr = (negDeltaTimeAsXiPr - hMeanNegXiPr->Interpolate(cascade.p())) / hSigmaNegXiPr->Interpolate(cascade.p()); - if (bachDeltaTimeAsXiPi > -1e+5) // pion from XiMinus has signal - nSigmaXiPi = (bachDeltaTimeAsXiPi - hMeanBachXiPi->Interpolate(cascade.p())) / hSigmaBachXiPi->Interpolate(cascade.p()); - if (posDeltaTimeAsOmPi > -1e+5) // proton from Lambda from OmegaMinus has signal - nSigmaOmLaPi = (posDeltaTimeAsOmPi - hMeanPosOmPi->Interpolate(cascade.p())) / hSigmaPosOmPi->Interpolate(cascade.p()); - if (negDeltaTimeAsOmPr > -1e+5) // pion from Lambda from OmegaMinus has signal - nSigmaOmLaPr = (negDeltaTimeAsOmPr - hMeanNegOmPr->Interpolate(cascade.p())) / hSigmaNegOmPr->Interpolate(cascade.p()); - if (bachDeltaTimeAsOmKa > -1e+5) // kaon from OmegaMinus has signal - nSigmaOmKa = (bachDeltaTimeAsOmKa - hMeanBachOmKa->Interpolate(cascade.p())) / hSigmaBachOmKa->Interpolate(cascade.p()); - } - casctofnsigmas(nSigmaXiLaPi, nSigmaXiLaPr, nSigmaXiPi, nSigmaOmLaPi, nSigmaOmLaPr, nSigmaOmKa); - } - - if (doQA) { - // length factor due to eta (to offset e-loss) - float positiveCosine = 1.0f / sqrt(1.0f + posTrack.getTgl() * posTrack.getTgl()); - float negativeCosine = 1.0f / sqrt(1.0f + negTrack.getTgl() * negTrack.getTgl()); - float bachelorCosine = 1.0f / sqrt(1.0f + bachTrack.getTgl() * bachTrack.getTgl()); - if (propagationConfiguration.correctELossInclination.value == false) { - negativeCosine = positiveCosine = bachelorCosine = 1.0f; + // method 1: correct primary particle TOF information + // length -> revise by removing travel length to primary vertex + // expected momentum -> kept as is for now, could correct at second stage + // use main method from TOF to calculate expected time + if (calculationMethod.value == 1) { + if (nTof.collisionId >= 0) { + auto trackCollision = collisions.rawIteratorAt(nTof.collisionId); + const o2::math_utils::Point3D trackVertex{trackCollision.posX(), trackCollision.posY(), trackCollision.posZ()}; + o2::track::TrackLTIntegral ltIntegral; + bool successPropag = o2::base::Propagator::Instance()->propagateToDCA(trackVertex, negTrack, d_bz, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrNONE, nullptr, <Integral); + if (successPropag) { + lengthNegative = nTof.length - ltIntegral.getL(); + casctof.negFlightPr = o2::framework::pid::tof::MassToExpTime(nTof.tofExpMom, nTof.length - ltIntegral.getL(), o2::constants::physics::MassProton * o2::constants::physics::MassProton); + casctof.negFlightPi = o2::framework::pid::tof::MassToExpTime(nTof.tofExpMom, nTof.length - ltIntegral.getL(), o2::constants::physics::MassPionCharged * o2::constants::physics::MassPionCharged); + } + } } + if (lengthNegative > 0.0f) { + casctof.negDeltaTimeAsXiPi = (nTof.tofSignal - nTof.tofEvTime) - (xiFlight + lambdaFlight + casctof.negFlightPi); + casctof.negDeltaTimeAsXiPr = (nTof.tofSignal - nTof.tofEvTime) - (xiFlight + lambdaFlight + casctof.negFlightPr); + casctof.negDeltaTimeAsOmPi = (nTof.tofSignal - nTof.tofEvTime) - (omFlight + lambdaFlight + casctof.negFlightPi); + casctof.negDeltaTimeAsOmPr = (nTof.tofSignal - nTof.tofEvTime) - (omFlight + lambdaFlight + casctof.negFlightPr); + + // de facto nsigma + if (nSigmaCalibLoaded) { + if (cascade.sign() < 0) { + casctof.nSigmaXiLaPr = (casctof.negDeltaTimeAsXiPr - hMeanPosXiPr->Interpolate(cascade.p())) / hSigmaPosXiPr->Interpolate(cascade.p()); + casctof.nSigmaOmLaPr = (casctof.negDeltaTimeAsOmPr - hMeanPosOmPr->Interpolate(cascade.p())) / hSigmaPosOmPr->Interpolate(cascade.p()); + } else { + casctof.nSigmaXiLaPi = (casctof.negDeltaTimeAsXiPi - hMeanPosXiPi->Interpolate(cascade.p())) / hSigmaPosXiPi->Interpolate(cascade.p()); + casctof.nSigmaOmLaPi = (casctof.negDeltaTimeAsOmPi - hMeanPosOmPi->Interpolate(cascade.p())) / hSigmaPosOmPi->Interpolate(cascade.p()); + } + } - if (cascade.dcaV0daughters() < cascadeGroup.qaV0DCADau && cascade.dcacascdaughters() < cascadeGroup.qaCascDCADau && cascade.v0cosPA(collision.getX(), collision.getY(), collision.getZ()) > cascadeGroup.qaV0CosPA && cascade.casccosPA(collision.getX(), collision.getY(), collision.getZ()) > cascadeGroup.qaCascCosPA) { - if (cascade.sign() < 0) { - if (std::abs(cascade.mXi() - 1.32171) < cascadeGroup.qaMassWindow && fabs(pTra.tpcNSigmaPr()) < cascadeGroup.qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < cascadeGroup.qaTPCNSigma && fabs(bTra.tpcNSigmaPi()) < cascadeGroup.qaTPCNSigma && ((cascpdg == 0) || (cascpdg == 3312))) { - histos.fill(HIST("h2dposDeltaTimeAsXiPr"), cascade.p(), cascade.eta(), posDeltaTimeAsXiPr); - histos.fill(HIST("h2dnegDeltaTimeAsXiPi"), cascade.p(), cascade.eta(), negDeltaTimeAsXiPi); - histos.fill(HIST("h2dbachDeltaTimeAsXiPi"), cascade.p(), cascade.eta(), bachDeltaTimeAsXiPi); - if (calculationMethod.value == 2) { - if (std::abs(posFlightPr_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(posFlightPr_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { - histos.fill(HIST("hDeltaTimeMethodsVsP_posXiPr"), positiveP, cascade.positiveeta(), (posFlightPr_Method0 - posFlightPr_Method1) * positiveCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_posXiPr"), positiveP, cascade.positiveeta(), (posFlightPr_Method1 / posFlightPr_Method0)); - } - if (std::abs(negFlightPi_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(negFlightPi_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { - histos.fill(HIST("hDeltaTimeMethodsVsP_negXiPi"), negativeP, cascade.negativeeta(), (negFlightPi_Method0 - negFlightPi_Method1) * negativeCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_negXiPi"), negativeP, cascade.negativeeta(), (negFlightPi_Method1 / negFlightPi_Method0)); - } - if (std::abs(bachFlightPi_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(bachFlightPi_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { - histos.fill(HIST("hDeltaTimeMethodsVsP_bachXiPi"), bachelorP, cascade.bacheloreta(), (bachFlightPi_Method0 - bachFlightPi_Method1) * bachelorCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_bachXiPi"), bachelorP, cascade.bacheloreta(), (bachFlightPi_Method1 / bachFlightPi_Method0)); - } + // do QA histograms (calibration / QC) + if (doQA) { + if (passesQAcuts) { + if (xiMinusCandidate) { + histos.fill(HIST("h2dnegDeltaTimeAsXiPi"), cascade.p(), cascade.eta(), casctof.negDeltaTimeAsXiPi); } - if (doQANSigma) { - histos.fill(HIST("h2dNSigmaXiLaPi"), cascade.p(), nSigmaXiLaPi); - histos.fill(HIST("h2dNSigmaXiLaPr"), cascade.p(), nSigmaXiLaPr); - histos.fill(HIST("h2dNSigmaXiPi"), cascade.p(), nSigmaXiPi); + if (xiPlusCandidate) { + histos.fill(HIST("h2dnegDeltaTimeAsXiPr"), cascade.p(), cascade.eta(), casctof.negDeltaTimeAsXiPr); } - } - if (std::abs(cascade.mOmega() - 1.67245) < cascadeGroup.qaMassWindow && fabs(pTra.tpcNSigmaPr()) < cascadeGroup.qaTPCNSigma && fabs(nTra.tpcNSigmaPi()) < cascadeGroup.qaTPCNSigma && fabs(bTra.tpcNSigmaKa()) < cascadeGroup.qaTPCNSigma && ((cascpdg == 0) || (cascpdg == 3334))) { - histos.fill(HIST("h2dposDeltaTimeAsOmPr"), cascade.p(), cascade.eta(), posDeltaTimeAsOmPr); - histos.fill(HIST("h2dnegDeltaTimeAsOmPi"), cascade.p(), cascade.eta(), negDeltaTimeAsOmPi); - histos.fill(HIST("h2dbachDeltaTimeAsOmKa"), cascade.p(), cascade.eta(), bachDeltaTimeAsOmKa); - if (calculationMethod.value == 2) { - if (std::abs(posFlightPr_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(posFlightPr_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { - histos.fill(HIST("hDeltaTimeMethodsVsP_posOmPr"), positiveP, cascade.positiveeta(), (posFlightPr_Method0 - posFlightPr_Method1) * positiveCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_posOmPr"), positiveP, cascade.positiveeta(), (posFlightPr_Method1 / posFlightPr_Method0)); - } - if (std::abs(negFlightPi_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(negFlightPi_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { - histos.fill(HIST("hDeltaTimeMethodsVsP_negOmPi"), negativeP, cascade.negativeeta(), (negFlightPi_Method0 - negFlightPi_Method1) * negativeCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_negOmPi"), negativeP, cascade.negativeeta(), (negFlightPi_Method1 / negFlightPi_Method0)); - } - if (std::abs(bachFlightKa_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(bachFlightKa_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { - histos.fill(HIST("hDeltaTimeMethodsVsP_bachOmKa"), bachelorP, cascade.bacheloreta(), (bachFlightKa_Method0 - bachFlightKa_Method1) * bachelorCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_bachOmKa"), bachelorP, cascade.bacheloreta(), (bachFlightKa_Method1 / bachFlightKa_Method0)); - } + if (omegaMinusCandidate) { + histos.fill(HIST("h2dnegDeltaTimeAsOmPi"), cascade.p(), cascade.eta(), casctof.negDeltaTimeAsOmPi); } - if (doQANSigma) { - histos.fill(HIST("h2dNSigmaOmLaPi"), cascade.p(), nSigmaOmLaPi); - histos.fill(HIST("h2dNSigmaOmLaPr"), cascade.p(), nSigmaOmLaPr); - histos.fill(HIST("h2dNSigmaOmKa"), cascade.p(), nSigmaOmKa); + if (omegaPlusCandidate) { + histos.fill(HIST("h2dnegDeltaTimeAsOmPr"), cascade.p(), cascade.eta(), casctof.negDeltaTimeAsOmPr); } } - } else { - if (std::abs(cascade.mXi() - 1.32171) < cascadeGroup.qaMassWindow && fabs(pTra.tpcNSigmaPi()) < cascadeGroup.qaTPCNSigma && fabs(nTra.tpcNSigmaPr()) < cascadeGroup.qaTPCNSigma && fabs(bTra.tpcNSigmaPi()) < cascadeGroup.qaTPCNSigma && ((cascpdg == 0) || (cascpdg == -3312))) { - histos.fill(HIST("h2dposDeltaTimeAsXiPi"), cascade.p(), cascade.eta(), posDeltaTimeAsXiPi); - histos.fill(HIST("h2dnegDeltaTimeAsXiPr"), cascade.p(), cascade.eta(), negDeltaTimeAsXiPr); - histos.fill(HIST("h2dbachDeltaTimeAsXiPi"), cascade.p(), cascade.eta(), bachDeltaTimeAsXiPi); - if (calculationMethod.value == 2) { - if (std::abs(posFlightPi_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(posFlightPi_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { - histos.fill(HIST("hDeltaTimeMethodsVsP_posXiPi"), positiveP, cascade.positiveeta(), (posFlightPi_Method0 - posFlightPi_Method1) * positiveCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_posXiPi"), positiveP, cascade.positiveeta(), (posFlightPi_Method1 / posFlightPi_Method1)); - } - if (std::abs(negFlightPr_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(negFlightPr_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { - histos.fill(HIST("hDeltaTimeMethodsVsP_negXiPr"), negativeP, cascade.negativeeta(), (negFlightPr_Method0 - negFlightPr_Method1) * negativeCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_negXiPr"), negativeP, cascade.negativeeta(), (negFlightPr_Method1 / negFlightPr_Method0)); - } - if (std::abs(bachFlightPi_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(bachFlightPi_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { - histos.fill(HIST("hDeltaTimeMethodsVsP_bachXiPi"), bachelorP, cascade.bacheloreta(), (bachFlightPi_Method0 - bachFlightPi_Method1) * bachelorCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_bachXiPi"), bachelorP, cascade.bacheloreta(), (bachFlightPi_Method1 / bachFlightPi_Method0)); - } + } + } + } // end negative + + if (bTof.hasTOF && bTof.hasITS) { + float velocityBachelorKa, velocityBachelorPi, lengthBachelor; + velocityBachelorKa = velocityBachelorPi = lengthBachelor = o2::aod::v0data::kNoTOFValue; + // method 0: legacy standalone without use of primary particle TOF + if (calculationMethod.value == 0) { + velocityBachelorPi = velocity(bachTrack.getP(), o2::constants::physics::MassPionCharged); + velocityBachelorKa = velocity(bachTrack.getP(), o2::constants::physics::MassKaonCharged); + lengthBachelor = findInterceptLength(bachTrack, d_bz); + casctof.bachFlightPi = lengthBachelor / velocityBachelorPi; + casctof.bachFlightKa = lengthBachelor / velocityBachelorKa; + } + // method 1: correct primary particle TOF information + // length -> revise by removing travel length to primary vertex + // expected momentum -> kept as is for now, could correct at second stage + // use main method from TOF to calculate expected time + if (calculationMethod.value == 1) { + if (bTof.collisionId >= 0) { + auto trackCollision = collisions.rawIteratorAt(bTof.collisionId); + const o2::math_utils::Point3D trackVertex{trackCollision.posX(), trackCollision.posY(), trackCollision.posZ()}; + o2::track::TrackLTIntegral ltIntegral; + bool successPropag = o2::base::Propagator::Instance()->propagateToDCA(trackVertex, bachTrack, d_bz, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrNONE, nullptr, <Integral); + if (successPropag) { + lengthBachelor = bTof.length - ltIntegral.getL(); + casctof.bachFlightPi = o2::framework::pid::tof::MassToExpTime(bTof.tofExpMom, bTof.length - ltIntegral.getL(), o2::constants::physics::MassPionCharged * o2::constants::physics::MassPionCharged); + casctof.bachFlightKa = o2::framework::pid::tof::MassToExpTime(bTof.tofExpMom, bTof.length - ltIntegral.getL(), o2::constants::physics::MassKaonCharged * o2::constants::physics::MassKaonCharged); + } + } + } + if (lengthBachelor > 0.0f) { + casctof.bachDeltaTimeAsXiPi = (bTof.tofSignal - bTof.tofEvTime) - (xiFlight + casctof.bachFlightPi); + casctof.bachDeltaTimeAsOmKa = (bTof.tofSignal - bTof.tofEvTime) - (omFlight + casctof.bachFlightKa); + + // de facto nsigma + if (nSigmaCalibLoaded) { + if (cascade.sign() < 0) { + casctof.nSigmaXiPi = (casctof.bachDeltaTimeAsXiPi - hMeanBachXiPi->Interpolate(cascade.p())) / hSigmaBachXiPi->Interpolate(cascade.p()); + casctof.nSigmaOmKa = (casctof.bachDeltaTimeAsOmKa - hMeanBachOmKa->Interpolate(cascade.p())) / hSigmaBachOmKa->Interpolate(cascade.p()); + } else { + casctof.nSigmaXiPi = (casctof.bachDeltaTimeAsXiPi - hMeanBachXiPi->Interpolate(cascade.p())) / hSigmaBachXiPi->Interpolate(cascade.p()); + casctof.nSigmaOmKa = (casctof.bachDeltaTimeAsOmKa - hMeanBachOmKa->Interpolate(cascade.p())) / hSigmaBachOmKa->Interpolate(cascade.p()); + } + } + + // do QA histograms (calibration / QC) + if (doQA) { + if (passesQAcuts) { + if (xiMinusCandidate) { + histos.fill(HIST("h2dbachDeltaTimeAsXiPi"), cascade.p(), cascade.eta(), casctof.bachDeltaTimeAsXiPi); } - if (doQANSigma) { - histos.fill(HIST("h2dNSigmaXiLaPi"), cascade.p(), nSigmaXiLaPi); - histos.fill(HIST("h2dNSigmaXiLaPr"), cascade.p(), nSigmaXiLaPr); - histos.fill(HIST("h2dNSigmaXiPi"), cascade.p(), nSigmaXiPi); + if (xiPlusCandidate) { + histos.fill(HIST("h2dbachDeltaTimeAsXiPi"), cascade.p(), cascade.eta(), casctof.bachDeltaTimeAsXiPi); } - } - if (std::abs(cascade.mOmega() - 1.67245) < cascadeGroup.qaMassWindow && fabs(pTra.tpcNSigmaPi()) < cascadeGroup.qaTPCNSigma && fabs(nTra.tpcNSigmaPr()) < cascadeGroup.qaTPCNSigma && fabs(bTra.tpcNSigmaKa()) < cascadeGroup.qaTPCNSigma && ((cascpdg == 0) || (cascpdg == -3334))) { - histos.fill(HIST("h2dposDeltaTimeAsOmPi"), cascade.p(), cascade.eta(), posDeltaTimeAsOmPi); - histos.fill(HIST("h2dnegDeltaTimeAsOmPr"), cascade.p(), cascade.eta(), negDeltaTimeAsOmPr); - histos.fill(HIST("h2dbachDeltaTimeAsOmKa"), cascade.p(), cascade.eta(), bachDeltaTimeAsOmKa); - if (calculationMethod.value == 2) { - if (std::abs(posFlightPi_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(posFlightPi_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { - histos.fill(HIST("hDeltaTimeMethodsVsP_posOmPi"), positiveP, cascade.positiveeta(), (posFlightPi_Method0 - posFlightPi_Method1) * positiveCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_posOmPi"), positiveP, cascade.positiveeta(), (posFlightPi_Method1 / posFlightPi_Method1)); - } - if (std::abs(negFlightPr_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(negFlightPr_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { - histos.fill(HIST("hDeltaTimeMethodsVsP_negOmPr"), negativeP, cascade.negativeeta(), (negFlightPr_Method0 - negFlightPr_Method1) * negativeCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_negOmPr"), negativeP, cascade.negativeeta(), (negFlightPr_Method1 / negFlightPr_Method0)); - } - if (std::abs(bachFlightKa_Method0 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon && std::abs(bachFlightKa_Method1 - o2::aod::cascdata::kNoTOFValue) > o2::aod::cascdata::kEpsilon) { - histos.fill(HIST("hDeltaTimeMethodsVsP_bachOmKa"), bachelorP, cascade.bacheloreta(), (bachFlightKa_Method0 - bachFlightKa_Method1) * bachelorCosine); - histos.fill(HIST("hRatioTimeMethodsVsP_bachOmKa"), bachelorP, cascade.bacheloreta(), (bachFlightKa_Method1 / bachFlightKa_Method1)); - } + if (omegaMinusCandidate) { + histos.fill(HIST("h2dbachDeltaTimeAsOmKa"), cascade.p(), cascade.eta(), casctof.bachDeltaTimeAsOmKa); } - if (doQANSigma) { - histos.fill(HIST("h2dNSigmaOmLaPi"), cascade.p(), nSigmaOmLaPi); - histos.fill(HIST("h2dNSigmaOmLaPr"), cascade.p(), nSigmaOmLaPr); - histos.fill(HIST("h2dNSigmaOmKa"), cascade.p(), nSigmaOmKa); + if (omegaPlusCandidate) { + histos.fill(HIST("h2dbachDeltaTimeAsOmKa"), cascade.p(), cascade.eta(), casctof.bachDeltaTimeAsOmKa); } } } } - } + } // end bachelor + + // don't forget to give feedback + return casctof; } - void processStandardData(aod::Collisions const& collisions, V0OriginalDatas const& V0s, CascOriginalDatas const& cascades, TracksWithAllExtras const&, aod::BCsWithTimestamps const& /*bcs*/) + void processStandardData(aod::Collisions const& collisions, V0OriginalDatas const& V0s, CascOriginalDatas const& cascades, TracksWithAllExtras const& tracks, aod::BCsWithTimestamps const& /*bcs*/) { // Fire up CCDB with first collision in record. If no collisions, bypass if (useCustomRunNumber || collisions.size() < 1) { @@ -1489,46 +1052,125 @@ struct strangenesstofpid { initCCDB(bc.runNumber()); } + //________________________________________________________________________ + // estimate event times (only necessary for original data) + std::vector collisionEventTime(collisions.size(), 0.0); + std::vector collisionNtracks(collisions.size(), 0); + for (const auto& track : tracks) { + if (track.hasTOF()) { + collisionEventTime[track.collisionId()] += track.tofEvTime(); + collisionNtracks[track.collisionId()]++; + } + } + for (const auto& collision : collisions) { + if (collisionNtracks[collision.globalIndex()] > 0) { + collisionEventTime[collision.globalIndex()] /= static_cast(collisionNtracks[collision.globalIndex()]); + } else { + collisionEventTime[collision.globalIndex()] = -1e+6; // undefined + } + } + if (calculateV0s.value) { for (const auto& V0 : V0s) { - // for storing whatever is the relevant quantity for the PV - o2::dataformats::VertexBase primaryVertex; - if (V0.has_collision()) { - auto const& collision = V0.collision(); - primaryVertex.setPos({collision.posX(), collision.posY(), collision.posZ()}); - primaryVertex.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - } else { - primaryVertex.setPos({mVtx->getX(), mVtx->getY(), mVtx->getZ()}); - } + trackTofInfo pTof, nTof; // information storage auto pTra = V0.posTrack_as(); auto nTra = V0.negTrack_as(); - processV0Candidate(primaryVertex, V0, pTra, nTra, 0); + + pTof.collisionId = pTra.collisionId(); + pTof.hasITS = pTra.hasITS(); + pTof.hasTPC = pTra.hasTPC(); + pTof.hasTOF = pTra.hasTOF(); + pTof.tofExpMom = pTra.tofExpMom(); + pTof.tofEvTime = collisionEventTime[V0.collisionId()]; + pTof.tofSignal = pTra.tofSignal(); + pTof.length = pTra.length(); + pTof.tpcNSigmaPi = pTra.tpcNSigmaPi(); + pTof.tpcNSigmaPr = pTra.tpcNSigmaPr(); + + nTof.collisionId = nTra.collisionId(); + nTof.hasITS = nTra.hasITS(); + nTof.hasTPC = nTra.hasTPC(); + nTof.hasTOF = nTra.hasTOF(); + nTof.tofExpMom = nTra.tofExpMom(); + nTof.tofEvTime = collisionEventTime[V0.collisionId()]; + nTof.tofSignal = nTra.tofSignal(); + nTof.length = nTra.length(); + nTof.tpcNSigmaPi = nTra.tpcNSigmaPi(); + nTof.tpcNSigmaPr = nTra.tpcNSigmaPr(); + + v0TofInfo v0tof = calculateTofInfoV0(collisions, V0.collisionId(), V0, pTof, nTof); + + if (doNSigmas) { + v0tofnsigmas( + v0tof.nSigmaPositiveLambdaPr, v0tof.nSigmaNegativeLambdaPi, + v0tof.nSigmaNegativeLambdaPr, v0tof.nSigmaPositiveLambdaPi, + v0tof.nSigmaPositiveK0ShortPi, v0tof.nSigmaNegativeK0ShortPi); + } } } if (calculateCascades.value) { for (const auto& cascade : cascades) { - // for storing whatever is the relevant quantity for the PV - o2::dataformats::VertexBase primaryVertex; - if (cascade.has_collision()) { - auto const& collision = cascade.collision(); - primaryVertex.setPos({collision.posX(), collision.posY(), collision.posZ()}); - primaryVertex.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - } else { - primaryVertex.setPos({mVtx->getX(), mVtx->getY(), mVtx->getZ()}); - } + trackTofInfo pTof, nTof, bTof; // information storage auto pTra = cascade.posTrack_as(); auto nTra = cascade.negTrack_as(); auto bTra = cascade.bachelor_as(); - processCascadeCandidate(primaryVertex, cascade, pTra, nTra, bTra, 0); + + pTof.collisionId = pTra.collisionId(); + pTof.hasITS = pTra.hasITS(); + pTof.hasTPC = pTra.hasTPC(); + pTof.hasTOF = pTra.hasTOF(); + pTof.tofExpMom = pTra.tofExpMom(); + pTof.tofEvTime = collisionEventTime[cascade.collisionId()]; + pTof.tofSignal = pTra.tofSignal(); + pTof.length = pTra.length(); + pTof.tpcNSigmaPi = pTra.tpcNSigmaPi(); + pTof.tpcNSigmaPr = pTra.tpcNSigmaPr(); + + nTof.collisionId = nTra.collisionId(); + nTof.hasITS = nTra.hasITS(); + nTof.hasTPC = nTra.hasTPC(); + nTof.hasTOF = nTra.hasTOF(); + nTof.tofExpMom = nTra.tofExpMom(); + nTof.tofEvTime = collisionEventTime[cascade.collisionId()]; + nTof.tofSignal = nTra.tofSignal(); + nTof.length = nTra.length(); + nTof.tpcNSigmaPi = nTra.tpcNSigmaPi(); + nTof.tpcNSigmaPr = nTra.tpcNSigmaPr(); + + bTof.collisionId = bTra.collisionId(); + bTof.hasITS = bTra.hasITS(); + bTof.hasTPC = bTra.hasTPC(); + bTof.hasTOF = bTra.hasTOF(); + bTof.tofExpMom = bTra.tofExpMom(); + bTof.tofEvTime = collisionEventTime[cascade.collisionId()]; + bTof.tofSignal = bTra.tofSignal(); + bTof.length = bTra.length(); + bTof.tpcNSigmaPi = bTra.tpcNSigmaPi(); + bTof.tpcNSigmaKa = bTra.tpcNSigmaKa(); + + cascTofInfo casctof = calculateTofInfoCascade(collisions, cascade.collisionId(), cascade, pTof, nTof, bTof); + + if (doNSigmas) { + casctofnsigmas( + casctof.nSigmaXiLaPi, casctof.nSigmaXiLaPr, casctof.nSigmaXiPi, + casctof.nSigmaOmLaPi, casctof.nSigmaOmLaPr, casctof.nSigmaOmKa); + } } } } - void processDerivedData(soa::Join const& collisions, V0DerivedDatas const& V0s, CascDerivedDatas const& cascades, dauTracks const&) + void processDerivedData(soa::Join const& collisions, V0DerivedDatas const& V0s, CascDerivedDatas const& cascades, dauTracks const& dauTrackTable, aod::DauTrackTOFPIDs const& dauTrackTOFPIDs) { + // auto-determine if current or old generation of dauTrackTOFPIDs + if (dauTrackTOFPIDs.size() == 0) { + return; + } + auto firstTOFPID = dauTrackTOFPIDs.rawIteratorAt(0); + bool isNewTOFFOrmat = firstTOFPID.straCollisionId() < 0 ? false : true; + // Fire up CCDB with first collision in record. If no collisions, bypass if (useCustomRunNumber || collisions.size() < 1) { initCCDB(manualRunNumber); @@ -1537,117 +1179,130 @@ struct strangenesstofpid { initCCDB(collision.runNumber()); } + // hold indices + std::vector tofIndices(dauTrackTable.size(), -1); + + if (isNewTOFFOrmat) { + // re-index + for (const auto& dauTrackTOFPID : dauTrackTOFPIDs) { + tofIndices[dauTrackTOFPID.dauTrackExtraId()] = dauTrackTOFPID.globalIndex(); + } + } else { + // they are actually joinable + std::iota(tofIndices.begin(), tofIndices.end(), 0); + } + if (calculateV0s.value) { for (const auto& V0 : V0s) { - // for storing whatever is the relevant quantity for the PV - o2::dataformats::VertexBase primaryVertex; - if (V0.has_straCollision()) { - auto const& collision = V0.straCollision_as>(); - primaryVertex.setPos({collision.posX(), collision.posY(), collision.posZ()}); - // cov: won't be used anyways, all fine - primaryVertex.setCov(1e-6, 1e-6, 1e-6, 1e-6, 1e-6, 1e-6); - } else { - primaryVertex.setPos({mVtx->getX(), mVtx->getY(), mVtx->getZ()}); - } + trackTofInfo pTof, nTof; // information storage + auto collision = collisions.rawIteratorAt(V0.straCollisionId()); auto pTra = V0.posTrackExtra_as(); auto nTra = V0.negTrackExtra_as(); - processV0Candidate(primaryVertex, V0, pTra, nTra, 0); + + pTof.hasITS = pTra.hasITS(); + pTof.hasTPC = pTra.hasTPC(); + pTof.hasTOF = pTra.hasTOF(); + pTof.tpcNSigmaPi = pTra.tpcNSigmaPi(); + pTof.tpcNSigmaPr = pTra.tpcNSigmaPr(); + if (tofIndices[V0.posTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { + auto pTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[V0.posTrackExtraId()]); + pTof.collisionId = pTofExt.straCollisionId(); + pTof.tofExpMom = pTofExt.tofExpMom(); + pTof.tofEvTime = collision.eventTime(); + pTof.tofSignal = pTofExt.tofSignal(); + pTof.length = pTofExt.length(); + } + + nTof.hasITS = nTra.hasITS(); + nTof.hasTPC = nTra.hasTPC(); + nTof.hasTOF = nTra.hasTOF(); + nTof.tpcNSigmaPi = nTra.tpcNSigmaPi(); + nTof.tpcNSigmaPr = nTra.tpcNSigmaPr(); + if (tofIndices[V0.negTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { + auto nTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[V0.negTrackExtraId()]); + nTof.collisionId = nTofExt.straCollisionId(); + nTof.tofExpMom = nTofExt.tofExpMom(); + nTof.tofEvTime = collision.eventTime(); + nTof.tofSignal = nTofExt.tofSignal(); + nTof.length = nTofExt.length(); + } + + v0TofInfo v0tof = calculateTofInfoV0(collisions, V0.straCollisionId(), V0, pTof, nTof); + + if (doNSigmas) { + v0tofnsigmas( + v0tof.nSigmaPositiveLambdaPr, v0tof.nSigmaNegativeLambdaPi, + v0tof.nSigmaNegativeLambdaPr, v0tof.nSigmaPositiveLambdaPi, + v0tof.nSigmaPositiveK0ShortPi, v0tof.nSigmaNegativeK0ShortPi); + } } } if (calculateCascades.value) { for (const auto& cascade : cascades) { - // for storing whatever is the relevant quantity for the PV - o2::dataformats::VertexBase primaryVertex; - if (cascade.has_straCollision()) { - auto const& collision = cascade.straCollision_as>(); - primaryVertex.setPos({collision.posX(), collision.posY(), collision.posZ()}); - primaryVertex.setCov(1e-6, 1e-6, 1e-6, 1e-6, 1e-6, 1e-6); - } else { - primaryVertex.setPos({mVtx->getX(), mVtx->getY(), mVtx->getZ()}); - } + trackTofInfo pTof, nTof, bTof; // information storage + auto collision = collisions.rawIteratorAt(cascade.straCollisionId()); auto pTra = cascade.posTrackExtra_as(); auto nTra = cascade.negTrackExtra_as(); auto bTra = cascade.bachTrackExtra_as(); - processCascadeCandidate(primaryVertex, cascade, pTra, nTra, bTra, 0); - } - } - } - - void processDerivedDataMCTest(soa::Join const& collisions, V0DerivedDatasMC const& V0s, CascDerivedDatasMC const& cascades, dauTracks const&, aod::V0MCCores const& v0mcs, aod::CascMCCores const& cascmcs) - { - // Fire up CCDB with first collision in record. If no collisions, bypass - if (useCustomRunNumber || collisions.size() < 1) { - initCCDB(manualRunNumber); - } else { - auto collision = collisions.begin(); - initCCDB(collision.runNumber()); - } - if (calculateV0s.value) { - for (const auto& V0 : V0s) { - // for storing whatever is the relevant quantity for the PV - o2::dataformats::VertexBase primaryVertex; - if (V0.has_straCollision()) { - auto const& collision = V0.straCollision_as>(); - primaryVertex.setPos({collision.posX(), collision.posY(), collision.posZ()}); - // cov: won't be used anyways, all fine - primaryVertex.setCov(1e-6, 1e-6, 1e-6, 1e-6, 1e-6, 1e-6); - } else { - primaryVertex.setPos({mVtx->getX(), mVtx->getY(), mVtx->getZ()}); + pTof.hasITS = pTra.hasITS(); + pTof.hasTPC = pTra.hasTPC(); + pTof.hasTOF = pTra.hasTOF(); + pTof.tpcNSigmaPi = pTra.tpcNSigmaPi(); + pTof.tpcNSigmaPr = pTra.tpcNSigmaPr(); + if (tofIndices[cascade.posTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { + auto pTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[cascade.posTrackExtraId()]); + pTof.collisionId = pTofExt.straCollisionId(); + pTof.tofExpMom = pTofExt.tofExpMom(); + pTof.tofEvTime = collision.eventTime(); + pTof.tofSignal = pTofExt.tofSignal(); + pTof.length = pTofExt.length(); } - // check association - int v0pdg = 0; - if (V0.v0MCCoreId() > -1) { - auto v0mc = v0mcs.rawIteratorAt(V0.v0MCCoreId()); - v0pdg = v0mc.pdgCode(); - if (std::abs(v0pdg) != 3122 && v0pdg != 310) { - continue; // only associated from this point on - } + nTof.hasITS = nTra.hasITS(); + nTof.hasTPC = nTra.hasTPC(); + nTof.hasTOF = nTra.hasTOF(); + nTof.tpcNSigmaPi = nTra.tpcNSigmaPi(); + nTof.tpcNSigmaPr = nTra.tpcNSigmaPr(); + if (tofIndices[cascade.negTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { + auto nTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[cascade.negTrackExtraId()]); + nTof.collisionId = nTofExt.straCollisionId(); + nTof.tofExpMom = nTofExt.tofExpMom(); + nTof.tofEvTime = collision.eventTime(); + nTof.tofSignal = nTofExt.tofSignal(); + nTof.length = nTofExt.length(); } - auto pTra = V0.posTrackExtra_as(); - auto nTra = V0.negTrackExtra_as(); - processV0Candidate(primaryVertex, V0, pTra, nTra, v0pdg); - } - } - - if (calculateCascades.value) { - for (const auto& cascade : cascades) { - // for storing whatever is the relevant quantity for the PV - o2::dataformats::VertexBase primaryVertex; - if (cascade.has_straCollision()) { - auto const& collision = cascade.straCollision_as>(); - primaryVertex.setPos({collision.posX(), collision.posY(), collision.posZ()}); - primaryVertex.setCov(1e-6, 1e-6, 1e-6, 1e-6, 1e-6, 1e-6); - } else { - primaryVertex.setPos({mVtx->getX(), mVtx->getY(), mVtx->getZ()}); + bTof.hasITS = bTra.hasITS(); + bTof.hasTPC = bTra.hasTPC(); + bTof.hasTOF = bTra.hasTOF(); + bTof.tpcNSigmaPi = bTra.tpcNSigmaPi(); + bTof.tpcNSigmaKa = bTra.tpcNSigmaKa(); + if (tofIndices[cascade.bachTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { + auto bTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[cascade.bachTrackExtraId()]); + bTof.collisionId = bTofExt.straCollisionId(); + bTof.tofExpMom = bTofExt.tofExpMom(); + bTof.tofEvTime = collision.eventTime(); + bTof.tofSignal = bTofExt.tofSignal(); + bTof.length = bTofExt.length(); } - // check association - int cascpdg = 0; - if (cascade.cascMCCoreId() > -1) { - auto cascmc = cascmcs.rawIteratorAt(cascade.cascMCCoreId()); - cascpdg = cascmc.pdgCode(); - if (std::abs(cascpdg) != 3312 && std::abs(cascpdg) != 3334) { - continue; // only associated from this point on - } - } + cascTofInfo casctof = calculateTofInfoCascade(collisions, cascade.straCollisionId(), cascade, pTof, nTof, bTof); - auto pTra = cascade.posTrackExtra_as(); - auto nTra = cascade.negTrackExtra_as(); - auto bTra = cascade.bachTrackExtra_as(); - processCascadeCandidate(primaryVertex, cascade, pTra, nTra, bTra, cascpdg); + if (doNSigmas) { + casctofnsigmas( + casctof.nSigmaXiLaPi, casctof.nSigmaXiLaPr, casctof.nSigmaXiPi, + casctof.nSigmaOmLaPi, casctof.nSigmaOmLaPr, casctof.nSigmaOmKa); + } } } } PROCESS_SWITCH(strangenesstofpid, processStandardData, "Process standard data", false); PROCESS_SWITCH(strangenesstofpid, processDerivedData, "Process derived data", true); - PROCESS_SWITCH(strangenesstofpid, processDerivedDataMCTest, "Process derived data / MC with assoc / not for analysis", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From e5cdb02bc1e4fc3929e9b927f53063ceec5aa8bc Mon Sep 17 00:00:00 2001 From: dajones2 <140733426+dajones2@users.noreply.github.com> Date: Thu, 11 Sep 2025 04:37:24 +0100 Subject: [PATCH 358/986] [PWGJE] Setting ghostRepeatN = 0 for jet reclusterer (#12931) --- PWGJE/Tasks/jetHadronRecoil.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/PWGJE/Tasks/jetHadronRecoil.cxx b/PWGJE/Tasks/jetHadronRecoil.cxx index 81e2ae5893d..5728b4d542c 100644 --- a/PWGJE/Tasks/jetHadronRecoil.cxx +++ b/PWGJE/Tasks/jetHadronRecoil.cxx @@ -135,6 +135,7 @@ struct JetHadronRecoil { jetReclusterer.isReclustering = true; jetReclusterer.algorithm = fastjet::JetAlgorithm::cambridge_algorithm; jetReclusterer.jetR = 2 * jetR; + jetReclusterer.ghostRepeatN = 0; jetReclusterer.recombScheme = fastjet::WTA_pt_scheme; registry.add("hZvtxSelected", "Z vertex position;Z_{vtx};entries", {HistType::kTH1F, {{80, -20, 20}}}, doSumw); From 947b3bfef8bfea49decb9ea9c74e7b5e74bb1bf8 Mon Sep 17 00:00:00 2001 From: Gyula Bencedi Date: Thu, 11 Sep 2025 05:40:52 +0200 Subject: [PATCH 359/986] [PWGLF] Added extra QA checks (#12948) --- PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx | 135 +++++++++++++++++++---------- 1 file changed, 90 insertions(+), 45 deletions(-) diff --git a/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx b/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx index f1753f94879..d15ec15864d 100644 --- a/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx +++ b/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx @@ -60,19 +60,10 @@ using namespace o2::aod::rctsel; auto static constexpr kMinCharge = 3.f; -AxisSpec ptAxis = {1001, -0.005, 10.005}; -AxisSpec multAxis = {701, -0.5, 700.5, "N_{trk}"}; -AxisSpec zAxis = {60, -30., 30.}; -AxisSpec deltaZAxis = {61, -6.1, 6.1}; -AxisSpec dcaxyAxis = {1000, 0., 5.}; -AxisSpec dcazAxis = {1000, 0., 5.}; -AxisSpec phiAxis = {629, 0, TwoPI, "Rad", "#phi"}; -AxisSpec etaAxis = {20, -4., -2.}; -AxisSpec centAxis{100, 0, 100, "centrality"}; -AxisSpec chiSqAxis = {100, 0., 1000.}; -AxisSpec nclsAxis{10, 0.5, 10.5, "# clusters"}; - enum TrkSel { + trkSelAll, + trkSelWoAmbiguous, + trkSelNumReassoc, trkSelNCls, trkSelChi2Ncl, trkSelEta, @@ -102,9 +93,30 @@ struct DndetaMFTPbPb { Configurable cfgDoIR{"cfgDoIR", false, "Flag to retrieve Interaction rate from CCDB"}; Configurable cfgUseIRCut{"cfgUseIRCut", false, "Flag to cut on IR rate"}; Configurable cfgIRCrashOnNull{"cfgIRCrashOnNull", false, "Flag to avoid CTP RateFetcher crash"}; - Configurable cfgIRSource{"cfgIRSource", "T0VTX", "Estimator of the interaction rate (Pb-Pb: ZNC hadronic)"}; + Configurable cfgIRSource{"cfgIRSource", "ZNC hadronic", "Estimator of the interaction rate (Pb-Pb: ZNC hadronic)"}; Configurable cfgUseTrackSel{"cfgUseTrackSel", false, "Flag to apply track selection"}; + struct : ConfigurableGroup { + ConfigurableAxis interactionRateBins{"interactionRateBins", {500, 0, 50}, "Binning for the interaction rate (kHz)"}; + ConfigurableAxis occupancyBins{"occupancyBins", {VARIABLE_WIDTH, 0.0f, 250.0f, 500.0f, 750.0f, 1000.0f, 1500.0f, 2000.0f, 3000.0f, 4500.0f, 6000.0f, 8000.0f, 10000.0f, 50000.0f}, "Occupancy"}; + ConfigurableAxis centralityBins{"centralityBins", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, "Centrality"}; + ConfigurableAxis irBins{"irBins", {500, 0, 50}, "Interaction rate (kHz)"}; + ConfigurableAxis pvBins{"pvBins", {501, -0.5, 500.5}, ""}; + ConfigurableAxis fv0aMultBins{"fv0aMultBins", {501, -0.5, 500.5}, ""}; + ConfigurableAxis ft0aMultBins{"ft0aMultBins", {501, -0.5, 500.5}, ""}; + ConfigurableAxis ft0cMultBins{"ft0cMultBins", {501, -0.5, 500.5}, ""}; + ConfigurableAxis ptBins{"ptBins", {101, -0.5, 10.5}, "pT binning (GeV/c)"}; + ConfigurableAxis multBins{"multBins", {701, -0.5, 700.5}, "Multiplicity binning"}; + ConfigurableAxis zvtxBins{"zvtxBins", {60, -30., 30.}, "Z-vtx binning (cm)"}; + ConfigurableAxis deltaZBins{"deltaZBins", {120, -6., 6.}, "Delta Z-vtx binning (cm)"}; + ConfigurableAxis dcaXYBins{"dcaXYBins", {800, -1., 1.}, "DCAxy binning (cm)"}; + ConfigurableAxis dcaZBins{"dcaZBins", {800, -1., 1.}, "DCAz binning (cm)"}; + ConfigurableAxis phiBins{"phiBins", {629, 0., TwoPI}, "#varphi binning (rad)"}; + ConfigurableAxis etaBins{"etaBins", {20, -4., -2.}, "#eta binning"}; + ConfigurableAxis chiSqPerNclBins{"chiSqPerNclBins", {100, 0, 100}, "#chi^{2} binning"}; + ConfigurableAxis nClBins{"nClBins", {10, 0.5, 10.5}, "number of clusters binning"}; + } binOpt; + struct : ConfigurableGroup { Configurable requireRCTFlagChecker{"requireRCTFlagChecker", false, "Check event quality in run condition table"}; Configurable cfgEvtRCTFlagCheckerLabel{"cfgEvtRCTFlagCheckerLabel", "CBT_fw", "Evt sel: RCT flag checker label"}; @@ -123,20 +135,21 @@ struct DndetaMFTPbPb { Configurable useChi2Cut{"useChi2Cut", false, "use track chi2 cut"}; Configurable maxChi2NCl{"maxChi2NCl", 1000.f, "maximum chi2 per MFT clusters"}; Configurable usePtCut{"usePtCut", false, "use track pT cut"}; - Configurable minPt{"minPt", 0., "minimum pT of the MFT tracks"}; + Configurable minPt{"minPt", 0., "minimum pT of the MFT tracks"}; Configurable requireCA{"requireCA", false, "Use Cellular Automaton track-finding algorithm"}; + Configurable excludeAmbiguous{"excludeAmbiguous", false, "Exclude Ambiguous tracks"}; Configurable maxDCAxy{"maxDCAxy", 0.01f, "Cut on dca XY"}; Configurable maxDCAz{"maxDCAz", 0.01f, "Cut on dca Z"}; } trackCuts; struct : ConfigurableGroup { - Configurable maxZvtx{"maxZvtx", 10.0f, "maximum cut on z-vtx (cm)"}; - Configurable minZvtx{"minZvtx", -10.0f, "minimum cut on z-vtx (cm)"}; + Configurable maxZvtx{"maxZvtx", 20.0f, "maximum cut on z-vtx (cm)"}; + Configurable minZvtx{"minZvtx", -20.0f, "minimum cut on z-vtx (cm)"}; Configurable useZDiffCut{"useZDiffCut", false, "use Zvtx reco-mc diff. cut"}; Configurable maxZvtxDiff{"maxZvtxDiff", 1.0f, "max allowed Z vtx difference for reconstruced collisions (cm)"}; Configurable requireIsGoodZvtxFT0VsPV{"requireIsGoodZvtxFT0VsPV", true, "require events with PV position along z consistent (within 1 cm) between PV reconstructed using tracks and PV using FT0 A-C time difference"}; Configurable requireRejectSameBunchPileup{"requireRejectSameBunchPileup", true, "reject collisions in case of pileup with another collision in the same foundBC"}; - Configurable requireNoCollInTimeRangeStrict{"requireNoCollInTimeRangeStrict", false, " requireNoCollInTimeRangeStrict"}; + Configurable requireNoCollInTimeRangeStrict{"requireNoCollInTimeRangeStrict", true, " requireNoCollInTimeRangeStrict"}; Configurable requireNoCollInRofStrict{"requireNoCollInRofStrict", false, "requireNoCollInRofStrict"}; Configurable requireNoCollInRofStandard{"requireNoCollInRofStandard", false, "requireNoCollInRofStandard"}; Configurable requireNoHighMultCollInPrevRof{"requireNoHighMultCollInPrevRof", false, "requireNoHighMultCollInPrevRof"}; @@ -149,23 +162,14 @@ struct DndetaMFTPbPb { Configurable maxIR{"maxIR", -1, "maximum IR (kHz) collisions"}; } eventCuts; - ConfigurableAxis occupancyBins{"occupancyBins", {VARIABLE_WIDTH, 0.0f, 250.0f, 500.0f, 750.0f, 1000.0f, 1500.0f, 2000.0f, 3000.0f, 4500.0f, 6000.0f, 8000.0f, 10000.0f, 50000.0f}, "Occupancy"}; - ConfigurableAxis centralityBins{"centralityBins", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, "Centrality"}; - ConfigurableAxis irBins{"irBins", {500, 0, 50}, "Interaction rate (kHz)"}; - ConfigurableAxis pvBins{"pvBins", {501, -0.5, 500.5}, ""}; - ConfigurableAxis fv0aMultBins{"fv0aMultBins", {501, -0.5, 500.5}, ""}; - ConfigurableAxis ft0aMultBins{"ft0aMultBins", {501, -0.5, 500.5}, ""}; - ConfigurableAxis ft0cMultBins{"ft0cMultBins", {501, -0.5, 500.5}, ""}; - Service pdg; - Service ccdb; Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; int mRunNumber{-1}; uint64_t mSOR{0}; - double mMinSeconds{-1.}; + float mMinSeconds{-1.}; std::unordered_map gHadronicRate; ctpRateFetcher rateFetcher; TH2* gCurrentHadronicRate; @@ -174,12 +178,23 @@ struct DndetaMFTPbPb { /// @brief init function, definition of histograms void init(InitContext&) { - AxisSpec pvAxis = {pvBins, "PV", "PVAxis"}; - AxisSpec multFV0aAxis = {fv0aMultBins, "fv0a", "FV0AMultAxis"}; - AxisSpec multFT0aAxis = {ft0aMultBins, "ft0a", "FT0AMultAxis"}; - AxisSpec multFT0cAxis = {ft0cMultBins, "ft0c", "FT0CMultAxis"}; - AxisSpec centralityAxis = {centralityBins, "Centrality", "centralityAxis"}; - AxisSpec occupancyAxis = {occupancyBins, "Occupancy", "occupancyAxis"}; + const AxisSpec pvAxis = {binOpt.pvBins, "PV", "PV axis"}; + const AxisSpec multFV0aAxis = {binOpt.fv0aMultBins, "fv0a", "FV0AMult axis"}; + const AxisSpec multFT0aAxis = {binOpt.ft0aMultBins, "ft0a", "FT0AMult axis"}; + const AxisSpec multFT0cAxis = {binOpt.ft0cMultBins, "ft0c", "FT0CMult axis"}; + const AxisSpec centralityAxis = {binOpt.centralityBins, "Centrality", "centrality axis"}; + const AxisSpec occupancyAxis = {binOpt.occupancyBins, "Occupancy", "occupancy axis"}; + const AxisSpec irAxis = {binOpt.interactionRateBins, "Interaction Rate", "IR axis"}; + const AxisSpec ptAxis = {binOpt.ptBins, "Pt axis (GeV/c)"}; + const AxisSpec multAxis = {binOpt.multBins, "N_{trk} axis"}; + const AxisSpec zAxis = {binOpt.zvtxBins, "Z-vtx axis"}; + const AxisSpec deltaZAxis = {binOpt.deltaZBins, "Delta Z-vtx axis"}; + const AxisSpec dcaxyAxis = {binOpt.dcaXYBins, "DCA-xy axis"}; + const AxisSpec dcazAxis = {binOpt.dcaZBins, "DCA-z axis"}; + const AxisSpec phiAxis = {binOpt.phiBins, "#phi axis"}; + const AxisSpec etaAxis = {binOpt.etaBins, "#eta axis"}; + const AxisSpec chiSqAxis = {binOpt.chiSqPerNclBins, "Chi2 axis"}; + const AxisSpec nclsAxis = {binOpt.nClBins, "Number of clusters axis"}; rctChecker.init(rctCuts.cfgEvtRCTFlagCheckerLabel, rctCuts.cfgEvtRCTFlagCheckerZDCCheck, rctCuts.cfgEvtRCTFlagCheckerLimitAcceptAsBad); @@ -261,7 +276,10 @@ struct DndetaMFTPbPb { hev->GetXaxis()->SetBinLabel(13, "Above max occup."); hev->GetXaxis()->SetBinLabel(14, "RCT Flag Checker"); - registry.add("Tracks/hTrkSel", "Number of tracks; Cut; #Tracks Passed Cut", {HistType::kTH1D, {{nTrkSel, 0, nTrkSel}}}); + registry.add("Tracks/hTrkSel", "Number of tracks; Cut; #Tracks Passed Cut", {HistType::kTH1F, {{nTrkSel, -0.5, +nTrkSel - 0.5}}}); + registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelAll + 1, "All"); + registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelWoAmbiguous + 1, "Ambiguity cut"); + registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelNumReassoc + 1, "Reassociated"); registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelNCls + 1, "Ncl cut"); registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelChi2Ncl + 1, "#chi^{2}/Ncl cut"); registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelEta + 1, "#eta cut"); @@ -285,6 +303,8 @@ struct DndetaMFTPbPb { x->SetBinLabel(1, "All"); x->SetBinLabel(2, "Selected"); + registry.add("Events/hInteractionRate", "; occupancy; IR (kHz)", kTH2F, {occupancyAxis, irAxis}); + registry.add({"Events/NtrkZvtx", "; N_{trk}; Z_{vtx} (cm); occupancy", {HistType::kTHnSparseF, {multAxis, zAxis, occupancyAxis}}}); @@ -375,9 +395,11 @@ struct DndetaMFTPbPb { hstat->GetAxis(0)->SetBinLabel(1, "All"); hstat->GetAxis(0)->SetBinLabel(2, "Selected"); + registry.add("Events/Centrality/hInteractionRate", "; centrality; occupancy; IR (kHz)", kTHnSparseF, {centralityAxis, occupancyAxis, irAxis}); + qaregistry.add({"Events/Centrality/hCent", "; centrality; occupancy", - {HistType::kTH2F, {centAxis, occupancyAxis}}, + {HistType::kTH2F, {centralityAxis, occupancyAxis}}, true}); qaregistry.add( {"Events/Centrality/hZvtxCent", @@ -775,7 +797,6 @@ struct DndetaMFTPbPb { using CollGenCent = CollsGenCentFT0C::iterator; using MFTTracksLabeled = soa::Join; using MftTracksWColls = soa::Join; - using CollsCorr = soa::Join; /// Filtered tables @@ -888,7 +909,15 @@ struct DndetaMFTPbPb { auto nATrk = 0; if (besttracks.size() > 0) { for (auto const& atrack : besttracks) { + registry.fill(HIST("Tracks/hTrkSel"), trkSelAll); + if (trackCuts.excludeAmbiguous && atrack.ambDegree() > 1) { + continue; + } + registry.fill(HIST("Tracks/hTrkSel"), trkSelWoAmbiguous); auto itrack = atrack.template mfttrack_as(); + if (itrack.collisionId() != atrack.bestCollisionId()) { + registry.fill(HIST("Tracks/hTrkSel"), trkSelNumReassoc); + } if (!isTrackSelected(itrack)) { continue; } @@ -985,8 +1014,8 @@ struct DndetaMFTPbPb { if (gHadronicRate.find(mRunNumber) == gHadronicRate.end()) { auto runDuration = ccdb->getRunDuration(mRunNumber); mSOR = runDuration.first; - mMinSeconds = std::floor(mSOR * 1.e-3); /// round tsSOR to the highest integer lower than tsSOR - double maxSec = std::ceil(runDuration.second * 1.e-3); /// round tsEOR to the lowest integer higher than tsEOR + mMinSeconds = std::floor(mSOR * 1.e-3); /// round tsSOR to the highest integer lower than tsSOR + float maxSec = std::ceil(runDuration.second * 1.e-3); /// round tsEOR to the lowest integer higher than tsEOR const AxisSpec axisSeconds{static_cast((maxSec - mMinSeconds) / 20.f), 0, maxSec - mMinSeconds, "Seconds since SOR"}; int hadronicRateBins = static_cast(eventCuts.maxIR - eventCuts.minIR); gHadronicRate[mRunNumber] = registry.add(Form("HadronicRate/%i", mRunNumber), ";Time since SOR (s);Hadronic rate (kHz)", kTH2D, {axisSeconds, {hadronicRateBins, eventCuts.minIR, eventCuts.maxIR}}).get(); @@ -1195,8 +1224,13 @@ struct DndetaMFTPbPb { if (cfgDoIR) { initHadronicRate(bc); - double ir = rateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), cfgIRSource, cfgIRCrashOnNull) * 1.e-3; - double seconds = bc.timestamp() * 1.e-3 - mMinSeconds; + float ir = !cfgIRSource.value.empty() ? rateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), cfgIRSource, cfgIRCrashOnNull) * 1.e-3 : -1; + if constexpr (has_reco_cent) { + registry.fill(HIST("Events/Centrality/hInteractionRate"), c, occ, ir); + } else { + registry.fill(HIST("Events/hInteractionRate"), occ, ir); + } + float seconds = bc.timestamp() * 1.e-3 - mMinSeconds; if (cfgUseIRCut && (ir < eventCuts.minIR || ir > eventCuts.maxIR)) { // cut on hadronic rate return; } @@ -1206,8 +1240,6 @@ struct DndetaMFTPbPb { auto z = collision.posZ(); if constexpr (has_reco_cent) { registry.fill(HIST("Events/Centrality/Selection"), 2., c, occ); - qaregistry.fill(HIST("Events/Centrality/hZvtxCent"), z, c, occ); - qaregistry.fill(HIST("Events/Centrality/hCent"), c, occ); } else { registry.fill(HIST("Events/Selection"), 2., occ); } @@ -1237,14 +1269,19 @@ struct DndetaMFTPbPb { registry.fill(HIST("Events/Selection"), 1., occ); } - if (!isGoodEvent(collision)) { + if (!isGoodEvent(collision)) { return; } if (cfgDoIR) { initHadronicRate(bc); - double ir = rateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), cfgIRSource, cfgIRCrashOnNull) * 1.e-3; - double seconds = bc.timestamp() * 1.e-3 - mMinSeconds; + float ir = !cfgIRSource.value.empty() ? rateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), cfgIRSource, cfgIRCrashOnNull) * 1.e-3 : -1; + if constexpr (has_reco_cent) { + registry.fill(HIST("Events/Centrality/hInteractionRate"), c, occ, ir); + } else { + registry.fill(HIST("Events/hInteractionRate"), occ, ir); + } + float seconds = bc.timestamp() * 1.e-3 - mMinSeconds; if (cfgUseIRCut && (ir < eventCuts.minIR || ir > eventCuts.maxIR)) { // cut on hadronic rate return; } @@ -1254,6 +1291,8 @@ struct DndetaMFTPbPb { auto z = collision.posZ(); if constexpr (has_reco_cent) { registry.fill(HIST("Events/Centrality/Selection"), 2., c, occ); + qaregistry.fill(HIST("Events/Centrality/hZvtxCent"), z, c, occ); + qaregistry.fill(HIST("Events/Centrality/hCent"), c, occ); } else { registry.fill(HIST("Events/Selection"), 2., occ); } @@ -1960,6 +1999,9 @@ struct DndetaMFTPbPb { } for (auto const& track : besttracks) { + if (trackCuts.excludeAmbiguous && track.ambDegree() > 1) { + continue; + } auto itrack = track.mfttrack_as(); if (!isTrackSelected(itrack)) { continue; @@ -2256,6 +2298,9 @@ struct DndetaMFTPbPb { auto nBestTrks = 0; for (auto const& atrack : besttracks) { + if (trackCuts.excludeAmbiguous && atrack.ambDegree() > 1) { + continue; + } auto itrack = atrack.template mfttrack_as(); if (itrack.eta() < trackCuts.minEta || itrack.eta() > trackCuts.maxEta) { continue; From 116001fde6c2ec7b8ad956f042456c97c06fe161 Mon Sep 17 00:00:00 2001 From: yuanzhe <90246048+wang-yuanzhe@users.noreply.github.com> Date: Thu, 11 Sep 2025 06:26:53 +0200 Subject: [PATCH 360/986] [PWGLF] Remove svR cut on MC signals for hypertriton kink analysis (#12935) --- PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx b/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx index 7dbef51d646..33ae40974f0 100644 --- a/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx @@ -747,9 +747,7 @@ struct HyperkinkRecoTask { if (hypoMoth == kHypertriton) { auto dChannel = H3LDecay::getDecayChannel(mcMothTrack, dauIDList); if (dChannel == H3LDecay::k2bodyNeutral && dauIDList[0] == mcDaugTrack.globalIndex()) { - if (std::hypot(mcDaugTrack.vx(), mcDaugTrack.vy()) > LayerRadii[3]) { - isKinkSignal = true; - } + isKinkSignal = true; } } else if (hypoMoth == kHyperhelium4sigma) { auto dChannel = He4SDecay::getDecayChannel(mcMothTrack, dauIDList); From 51221cc9e6438797362d92a9fabcf70f5ee866c1 Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Thu, 11 Sep 2025 08:43:58 +0200 Subject: [PATCH 361/986] [PWGLF] Add new event-mixing process function (#12916) --- .../Strangeness/lambdaspincorrderived.cxx | 114 +++++++++++++++++- 1 file changed, 108 insertions(+), 6 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx index 9bf238cec25..c8a3b5f729a 100644 --- a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx @@ -138,10 +138,10 @@ struct lambdaspincorrderived { histos.add("hSparseAntiLambdaLambda", "hSparseAntiLambdLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisR}, true); histos.add("hSparseAntiLambdaAntiLambda", "hSparseAntiLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisR}, true); - histos.add("hSparseLambdaLambdaMixed", "hSparseLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity, configThnAxisR}, true); - histos.add("hSparseLambdaAntiLambdaMixed", "hSparseLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity, configThnAxisR}, true); - histos.add("hSparseAntiLambdaLambdaMixed", "hSparseAntiLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity, configThnAxisR}, true); - histos.add("hSparseAntiLambdaAntiLambdaMixed", "hSparseAntiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity, configThnAxisR}, true); + histos.add("hSparseLambdaLambdaMixed", "hSparseLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisR}, true); + histos.add("hSparseLambdaAntiLambdaMixed", "hSparseLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisR}, true); + histos.add("hSparseAntiLambdaLambdaMixed", "hSparseAntiLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisR}, true); + histos.add("hSparseAntiLambdaAntiLambdaMixed", "hSparseAntiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisR}, true); histos.add("hSparseRapLambdaLambda", "hSparseRapLambdaLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); histos.add("hSparseRapLambdaAntiLambda", "hSparseRapLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); @@ -316,24 +316,27 @@ struct lambdaspincorrderived { weight3 = mixpairweight * hweight3->GetBinContent(hweight3->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic))); weight4 = mixpairweight * hweight4->GetBinContent(hweight4->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic))); } - histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity()); + if (tag1 == 0 && tag2 == 0) { + histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight1); histos.fill(HIST("hSparseLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight1); histos.fill(HIST("hSparseRapLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight1); histos.fill(HIST("hSparsePhiLambdaLambdaMixed"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, weight1); histos.fill(HIST("hLambdaMixForLL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), weight1); } else if (tag1 == 0 && tag2 == 1) { + histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight2); histos.fill(HIST("hSparseLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight2); histos.fill(HIST("hSparseRapLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight2); histos.fill(HIST("hSparsePhiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, weight2); histos.fill(HIST("hLambdaMixForLAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), weight2); } else if (tag1 == 1 && tag2 == 0) { + histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight3); histos.fill(HIST("hSparseAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight3); histos.fill(HIST("hSparseRapAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight3); histos.fill(HIST("hSparsePhiAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, weight3); - histos.fill(HIST("hLambdaMixForALL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), weight3); } else if (tag1 == 1 && tag2 == 1) { + histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight4); histos.fill(HIST("hSparseAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight4); histos.fill(HIST("hSparseRapAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight4); histos.fill(HIST("hSparsePhiAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, weight4); @@ -554,6 +557,105 @@ struct lambdaspincorrderived { } // end primary-event loop } PROCESS_SWITCH(lambdaspincorrderived, processMEV2, "Process data ME", false); + + void processMEV3(EventCandidates const& collisions, AllTrackCandidates const& V0s) + { + // one pool (deque) per mixing bin; each entry holds (collision index, slice of its V0s) + auto nBins = colBinning.getAllBinsCount(); + std::vector>> eventPools(nBins); + + for (auto& collision1 : collisions) { + // select mixing bin for this event + const int bin = colBinning.getBin(std::make_tuple(collision1.posz(), collision1.cent())); + + // all V0s from the current event + auto poolA = V0s.sliceBy(tracksPerCollisionV0, collision1.index()); + + // loop over same-event candidate pairs (t1,t2) + for (auto& [t1, t2] : soa::combinations(o2::soa::CombinationsFullIndexPolicy(poolA, poolA))) { + if (!selectionV0(t1) || !selectionV0(t2)) + continue; + if (t2.index() <= t1.index()) + continue; // unique unordered pairs + if (t1.protonIndex() == t2.protonIndex()) + continue; // no shared daughter + if (t1.pionIndex() == t2.pionIndex()) + continue; + + // --- First pass over previous events in this bin: count replacements and build a list of usable pools + int mixes = 0; + struct PoolView { + AllTrackCandidates* pool; + int nRepl; + int collIdx; + }; + std::vector usable; + int totalRepl = 0; + + for (auto it = eventPools[bin].rbegin(); + it != eventPools[bin].rend() && mixes < nEvtMixing; ++it, ++mixes) { + const int collision2idx = it->first; + auto& poolB = it->second; + + // (defensive; shouldn't happen because we push the current event after mixing) + if (collision2idx == collision1.index()) + continue; + + int nRepl = 0; + for (auto& t3 : poolB) { + if (selectionV0(t3) && checkKinematics(t1, t3)) + ++nRepl; + } + if (nRepl > 0) { + usable.push_back(PoolView{&poolB, nRepl, collision2idx}); + totalRepl += nRepl; + } + } + + if (totalRepl == 0) + continue; + const float w = 1.0f / static_cast(totalRepl); // global normalization: sum of weights over all replacements = 1 + + // --- Second pass: fill with normalized weight w + for (auto& pv : usable) { + auto& poolB = *pv.pool; + for (auto& t3 : poolB) { + if (!(selectionV0(t3) && checkKinematics(t1, t3))) + continue; + + // build 4-vectors for the mixed pair (t3 from prior event replaces t1; t2 stays from current event) + proton = ROOT::Math::PtEtaPhiMVector(t3.protonPt(), t3.protonEta(), t3.protonPhi(), o2::constants::physics::MassProton); + lambda = ROOT::Math::PtEtaPhiMVector(t3.lambdaPt(), t3.lambdaEta(), t3.lambdaPhi(), t3.lambdaMass()); + proton2 = ROOT::Math::PtEtaPhiMVector(t2.protonPt(), t2.protonEta(), t2.protonPhi(), o2::constants::physics::MassProton); + lambda2 = ROOT::Math::PtEtaPhiMVector(t2.lambdaPt(), t2.lambdaEta(), t2.lambdaPhi(), t2.lambdaMass()); + + float dPhi = std::fabs( + RecoDecay::constrainAngle(lambda.Phi(), 0.0F, harmonic) - + RecoDecay::constrainAngle(lambda2.Phi(), 0.0F, harmonic)); + histos.fill(HIST("deltaPhiMix"), dPhi, w); + + if (t3.v0Status() == 0 && t2.v0Status() == 0) { + fillHistograms(0, 0, lambda, lambda2, proton, proton2, 1, w); + } else if (t3.v0Status() == 0 && t2.v0Status() == 1) { + fillHistograms(0, 1, lambda, lambda2, proton, proton2, 1, w); + } else if (t3.v0Status() == 1 && t2.v0Status() == 0) { + fillHistograms(1, 0, lambda, lambda2, proton, proton2, 1, w); + } else if (t3.v0Status() == 1 && t2.v0Status() == 1) { + fillHistograms(1, 1, lambda, lambda2, proton, proton2, 1, w); + } + } + } + } // end same-event pair loop + + // after mixing with prior events, push current event into the pool + auto sliced = V0s.sliceBy(tracksPerCollisionV0, collision1.index()); + eventPools[bin].emplace_back(collision1.index(), std::move(sliced)); + if (static_cast(eventPools[bin].size()) > nEvtMixing) { + eventPools[bin].pop_front(); + } + } // end primary-event loop + } + PROCESS_SWITCH(lambdaspincorrderived, processMEV3, "Process data ME", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { From ce88cf7aa455acce3a09de90efc5b28035465ada Mon Sep 17 00:00:00 2001 From: Junlee Kim Date: Thu, 11 Sep 2025 16:33:01 +0900 Subject: [PATCH 362/986] [PWGLF] adding rapidity dependent polarization (#12927) --- PWGLF/Tasks/Strangeness/lambdapolarization.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/PWGLF/Tasks/Strangeness/lambdapolarization.cxx b/PWGLF/Tasks/Strangeness/lambdapolarization.cxx index 38e17ba338a..48a15baa05a 100644 --- a/PWGLF/Tasks/Strangeness/lambdapolarization.cxx +++ b/PWGLF/Tasks/Strangeness/lambdapolarization.cxx @@ -231,6 +231,8 @@ struct lambdapolarization { if (cfgRapidityDep) { histos.add(Form("psi%d/h_lambda_cos2_rap", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis, RapAxis}}); histos.add(Form("psi%d/h_alambda_cos2_rap", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis, RapAxis}}); + histos.add(Form("psi%d/h_lambda_cos_rap", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis, RapAxis}}); + histos.add(Form("psi%d/h_alambda_cos_rap", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis, RapAxis}}); } histos.add(Form("psi%d/h_lambda_cossin", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); @@ -754,6 +756,7 @@ struct lambdapolarization { if (cfgRapidityDep) { histos.fill(HIST("psi2/h_lambda_cos2_rap"), v0.mLambda(), v0.pt(), angle * angle, centrality, v0.yLambda(), weight); + histos.fill(HIST("psi2/h_lambda_cos_rap"), v0.mLambda(), v0.pt(), angle * weight, centrality, v0.yLambda()); } if (cfgAccAzimuth) { @@ -803,6 +806,7 @@ struct lambdapolarization { if (cfgRapidityDep) { histos.fill(HIST("psi2/h_alambda_cos2_rap"), v0.mAntiLambda(), v0.pt(), angle * angle, centrality, v0.yLambda(), weight); + histos.fill(HIST("psi2/h_alambda_cos_rap"), v0.mAntiLambda(), v0.pt(), angle * weight, centrality, v0.yLambda()); } if (cfgAccAzimuth) { @@ -853,6 +857,7 @@ struct lambdapolarization { if (cfgRapidityDep) { histos.fill(HIST("psi3/h_lambda_cos2_rap"), v0.mLambda(), v0.pt(), angle * angle, centrality, v0.yLambda(), weight); + histos.fill(HIST("psi3/h_lambda_cos_rap"), v0.mLambda(), v0.pt(), angle * weight, centrality, v0.yLambda()); } if (cfgAccAzimuth) { @@ -868,6 +873,7 @@ struct lambdapolarization { if (cfgRapidityDep) { histos.fill(HIST("psi3/h_alambda_cos2_rap"), v0.mAntiLambda(), v0.pt(), angle * angle, centrality, v0.yLambda(), weight); + histos.fill(HIST("psi3/h_alambda_cos_rap"), v0.mAntiLambda(), v0.pt(), angle * weight, centrality, v0.yLambda()); } if (cfgAccAzimuth) { @@ -884,6 +890,7 @@ struct lambdapolarization { if (cfgRapidityDep) { histos.fill(HIST("psi4/h_lambda_cos2_rap"), v0.mLambda(), v0.pt(), angle * angle, centrality, v0.yLambda(), weight); + histos.fill(HIST("psi4/h_lambda_cos_rap"), v0.mLambda(), v0.pt(), angle * weight, centrality, v0.yLambda()); } if (cfgAccAzimuth) { @@ -899,6 +906,7 @@ struct lambdapolarization { if (cfgRapidityDep) { histos.fill(HIST("psi4/h_alambda_cos2_rap"), v0.mAntiLambda(), v0.pt(), angle * angle, centrality, v0.yLambda(), weight); + histos.fill(HIST("psi4/h_alambda_cos_rap"), v0.mAntiLambda(), v0.pt(), angle * weight, centrality, v0.yLambda()); } if (cfgAccAzimuth) { From de57a7c46adf18625c2681b7ffb880b02482a8c1 Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Thu, 11 Sep 2025 10:31:34 +0200 Subject: [PATCH 363/986] [PWGCF] FemtoUniverse: Add asymmetric nsig in electron reject (#12918) --- ...femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx index d9bdee9c7a6..83497834459 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx @@ -69,7 +69,8 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { Configurable ConfNsigmaCombined{"ConfNsigmaCombined", 3.0f, "TPC and TOF Pion Sigma (combined) for momentum > ConfTOFPtMin"}; Configurable ConfNsigmaTPC{"ConfNsigmaTPC", 3.0f, "TPC Pion Sigma for momentum < ConfTOFPtMin"}; Configurable ConfIsElReject{"ConfIsElReject", false, "Is electron rejection activated"}; - Configurable ConfNsigmaTPCElReject{"ConfNsigmaTPCElReject", 2.0f, "TPC Electron Sigma for momentum < ConfTOFPtMin"}; + Configurable ConfNsigmaTPCElRejectMin{"ConfNsigmaTPCElRejectMin", 2.0f, "TPC Electron SigmaMin for momentum < ConfTOFPtMin"}; + Configurable ConfNsigmaTPCElRejectMax{"ConfNsigmaTPCElRejectMax", 2.0f, "TPC Electron SigmaMax for momentum < ConfTOFPtMin"}; Configurable ConfTOFPtMin{"ConfTOFPtMin", 0.5f, "Min. Pt for which TOF is required for PID."}; Configurable ConfEtaMax{"ConfEtaMax", 0.8f, "Higher limit for |Eta| (the same for both particles)"}; @@ -320,7 +321,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { if (true) { if (mom < twotracksconfigs.ConfTOFPtMin) { if (twotracksconfigs.ConfIsElReject) { - if ((std::abs(nsigmaTPCPi) < twotracksconfigs.ConfNsigmaTPC) && (std::abs(nsigmaTPCElReject) > twotracksconfigs.ConfNsigmaTPCElReject)) { + if ((std::abs(nsigmaTPCPi) < twotracksconfigs.ConfNsigmaTPC) && (nsigmaTPCElReject < twotracksconfigs.ConfNsigmaTPCElRejectMin || nsigmaTPCElReject > twotracksconfigs.ConfNsigmaTPCElRejectMax)) { return true; } else { return false; From ba2d9315947eb45ec02985da09b28e454157bb7b Mon Sep 17 00:00:00 2001 From: jaelpark Date: Thu, 11 Sep 2025 17:32:45 +0800 Subject: [PATCH 364/986] [PWGCF] JCorran: Fix crash when MultSet not in use (#12953) --- PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.cxx b/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.cxx index 502a14c6b28..468b2cf5cce 100644 --- a/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.cxx +++ b/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.cxx @@ -41,6 +41,8 @@ JFFlucAnalysisO2Hist::JFFlucAnalysisO2Hist(HistogramRegistry& registry, AxisSpec multAxes.emplace_back(100, 0, 1000, "Nch Global"); registry.add("multCorrelations", "Multiplicity correlations", {HistType::kTHnSparseF, multAxes}); phs[HIST_THN_SPARSE_MULTCORR] = std::get>(registry.add(Form("%s/h_multcorr", folder.Data()), "multiplicity/centrality correlations", {HistType::kTHnSparseF, multAxes})).get(); + } else { + phs[HIST_THN_SPARSE_MULTCORR] = 0; } AxisSpec chgAxis = {3, -1.5, 1.5, "charge"}; @@ -61,7 +63,8 @@ JFFlucAnalysisO2Hist::JFFlucAnalysisO2Hist(HistogramRegistry& registry, AxisSpec phs[HIST_THN_SPARSE_VN] = std::get>(registry.add(Form("%s/hvna", folder.Data()), "#it{V}_#it{n}^#it{k}", {HistType::kTHnSparseF, {axisMultiplicity, massAxis, hAxis, kAxis, vnAxis}})).get(); phs[HIST_THN_SPARSE_VN_VN] = std::get>(registry.add(Form("%s/hvn_vn", folder.Data()), "#it{V}_#it{n_1}^#it{k_1}#it{V}_#it{n_2}^#it{k_2}", {HistType::kTHnSparseF, {axisMultiplicity, massAxis, hAxis, kAxis, hAxis, kAxis, vnAxis}})).get(); for (UInt_t i = 0; i < HIST_THN_SPARSE_COUNT; ++i) - phs[i]->Sumw2(); + if (phs[i]) + phs[i]->Sumw2(); } JFFlucAnalysisO2Hist::~JFFlucAnalysisO2Hist() From a9b0c50a6c4825c8567fca117a2c0e5d91aa64d1 Mon Sep 17 00:00:00 2001 From: Chiara De Martin <39315597+ChiaraDeMartin95@users.noreply.github.com> Date: Fri, 12 Sep 2025 02:20:57 +0200 Subject: [PATCH 365/986] [PWGLF] Fix shift correction (#12909) Co-authored-by: Chiara De Martin Co-authored-by: ALICE Action Bot --- .../TableProducer/Strangeness/cascadeflow.cxx | 218 ++++++++++-------- 1 file changed, 126 insertions(+), 92 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx index 2923a6da215..85a79a5c02a 100644 --- a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx @@ -15,25 +15,29 @@ /// \author Chiara De Martin (chiara.de.martin@cern.ch) /// \author Maximiliano Puccio (maximiliano.puccio@cern.ch) -#include -#include -#include -#include "Math/Vector3D.h" -#include "TRandom3.h" +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/cascqaanalysis.h" + #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "Framework/AnalysisTask.h" +#include "Tools/ML/MlResponse.h" + +#include "CCDB/BasicCCDBManager.h" #include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" #include "Framework/O2DatabasePDGPlugin.h" #include "Framework/runDataProcessing.h" -#include "PWGLF/DataModel/cascqaanalysis.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/DataModel/LFStrangenessPIDTables.h" -#include "Tools/ML/MlResponse.h" -#include "CCDB/BasicCCDBManager.h" + +#include "Math/Vector3D.h" +#include "TRandom3.h" + +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -171,31 +175,38 @@ struct cascadeFlow { ConfigurableAxis axisQVsNorm{"axisQVsNorm", {200, -1.f, 1.f}, "axisQVsNorm"}; // Configurable for shift correction - Configurable cfgShiftCorr{"cfgShiftCorr", 0, ""}; - Configurable cfgShiftPath{"cfgShiftPath", "Users/j/junlee/Qvector/QvecCalib/Shift", "Path for Shift"}; - Configurable cfgnMods{"cfgnMods", 1, "The number of modulations of interest starting from 2"}; + struct : ConfigurableGroup { + Configurable cfgShiftCorr{"cfgShiftCorr", 0, ""}; + Configurable cfgShiftPath{"cfgShiftPath", "Users/j/junlee/Qvector/QvecCalib/Shift", "Path for Shift"}; + Configurable cfgShiftPathFT0C{"cfgShiftPathFT0C", "Users/j/junlee/Qvector/QvecCalib/Shift", "Path for Shift"}; + Configurable cfgShiftPathTPCL{"cfgShiftPathTPCL", "Users/j/junlee/Qvector/QvecCalib/Shift", "Path for Shift"}; + Configurable cfgShiftPathTPCR{"cfgShiftPathTPCR", "Users/j/junlee/Qvector/QvecCalib/Shift", "Path for Shift"}; + Configurable cfgnMods{"cfgnMods", 1, "The number of modulations of interest starting from 2"}; + } ShiftConfigs; // Configurable cfgHarmonic{"cfgHarmonic", 2, "Harmonic for event plane calculation"}; // THN axes - ConfigurableAxis thnConfigAxisFT0C{"thnConfigAxisFT0C", {8, 0, 80}, "FT0C centrality (%)"}; - ConfigurableAxis thnConfigAxisEta{"thnConfigAxisEta", {8, -0.8, 0.8}, "pseudorapidity"}; - ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {VARIABLE_WIDTH, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2, 2.25, 2.5, 2.75, 3, 3.5, 4, 5, 6, 8, 10}, "#it{p}_{T} (GeV/#it{c})"}; - ConfigurableAxis thnConfigAxisPtLambda{"thnConfigAxisPtLambda", {VARIABLE_WIDTH, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2, 2.25, 2.5, 2.75, 3, 3.5, 4, 5, 6, 8, 10, 20}, "#it{p}_{T} (GeV/#it{c})"}; - ConfigurableAxis thnConfigAxisCharge{"thnConfigAxisCharge", {2, 0, 2}, ""}; - ConfigurableAxis thnConfigAxisPsiDiff{"thnConfigAxisPsiDiff", {100, 0, o2::constants::math::TwoPI}, ""}; - ConfigurableAxis thnConfigAxisMassXi{"thnConfigAxisMassXi", {45, 1.300, 1.345}, ""}; - ConfigurableAxis thnConfigAxisMassOmega{"thnConfigAxisMassOmega", {45, 1.655, 1.690}, ""}; - ConfigurableAxis thnConfigAxisMassLambda{"thnConfigAxisMassLambda", {60, 1.1, 1.13}, ""}; - ConfigurableAxis thnConfigAxisBDTScore{"thnConfigAxisBDTScore", {15, 0.4, 1}, ""}; - ConfigurableAxis thnConfigAxisV2{"thnConfigAxiV2", {100, -1., 1.}, ""}; - ConfigurableAxis thnConfigAxisPzs2Xi{"thnConfigAxiPzs2Xi", {200, -2.8, 2.8}, ""}; - ConfigurableAxis thnConfigAxisPzs2Omega{"thnConfigAxiPzs2Omega", {200, -70, 70}, ""}; - ConfigurableAxis thnConfigAxisPzs2Lambda{"thnConfigAxiPzs2Lambda", {200, -2, 2}, ""}; - ConfigurableAxis thnConfigAxisCos2Theta{"thnConfigAxiCos2Theta", {100, 0, 1}, ""}; - ConfigurableAxis thnConfigAxisCos2ThetaL{"thnConfigAxiCos2ThetaL", {100, 0, 1}, ""}; - ConfigurableAxis thnConfigAxisCosThetaXiAlpha{"thnConfigAxisCosThetaXiAlpha", {200, -2.8, 2.8}, ""}; - ConfigurableAxis thnConfigAxisCosThetaOmegaAlpha{"thnConfigAxisCosThetaOmegaAlpha", {200, -70, 70}, ""}; - ConfigurableAxis thnConfigAxisCosThetaProtonAlpha{"thnConfigAxisCosThetaProtonAlpha", {200, -2, 2}, ""}; + struct : ConfigurableGroup { + ConfigurableAxis thnConfigAxisFT0C{"thnConfigAxisFT0C", {8, 0, 80}, "FT0C centrality (%)"}; + ConfigurableAxis thnConfigAxisEta{"thnConfigAxisEta", {8, -0.8, 0.8}, "pseudorapidity"}; + ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {VARIABLE_WIDTH, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2, 2.25, 2.5, 2.75, 3, 3.5, 4, 5, 6, 8, 10}, "#it{p}_{T} (GeV/#it{c})"}; + ConfigurableAxis thnConfigAxisPtLambda{"thnConfigAxisPtLambda", {VARIABLE_WIDTH, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2, 2.25, 2.5, 2.75, 3, 3.5, 4, 5, 6, 8, 10, 20}, "#it{p}_{T} (GeV/#it{c})"}; + ConfigurableAxis thnConfigAxisCharge{"thnConfigAxisCharge", {2, 0, 2}, ""}; + ConfigurableAxis thnConfigAxisPsiDiff{"thnConfigAxisPsiDiff", {100, 0, o2::constants::math::TwoPI}, ""}; + ConfigurableAxis thnConfigAxisMassXi{"thnConfigAxisMassXi", {45, 1.300, 1.345}, ""}; + ConfigurableAxis thnConfigAxisMassOmega{"thnConfigAxisMassOmega", {45, 1.655, 1.690}, ""}; + ConfigurableAxis thnConfigAxisMassLambda{"thnConfigAxisMassLambda", {60, 1.1, 1.13}, ""}; + ConfigurableAxis thnConfigAxisBDTScore{"thnConfigAxisBDTScore", {15, 0.4, 1}, ""}; + ConfigurableAxis thnConfigAxisV2{"thnConfigAxiV2", {100, -1., 1.}, ""}; + ConfigurableAxis thnConfigAxisPzs2Xi{"thnConfigAxiPzs2Xi", {200, -2.8, 2.8}, ""}; + ConfigurableAxis thnConfigAxisPzs2Omega{"thnConfigAxiPzs2Omega", {200, -70, 70}, ""}; + ConfigurableAxis thnConfigAxisPzs2Lambda{"thnConfigAxiPzs2Lambda", {200, -2, 2}, ""}; + ConfigurableAxis thnConfigAxisCos2Theta{"thnConfigAxiCos2Theta", {100, 0, 1}, ""}; + ConfigurableAxis thnConfigAxisCos2ThetaL{"thnConfigAxiCos2ThetaL", {100, 0, 1}, ""}; + ConfigurableAxis thnConfigAxisCosThetaXiAlpha{"thnConfigAxisCosThetaXiAlpha", {200, -2.8, 2.8}, ""}; + ConfigurableAxis thnConfigAxisCosThetaOmegaAlpha{"thnConfigAxisCosThetaOmegaAlpha", {200, -70, 70}, ""}; + ConfigurableAxis thnConfigAxisCosThetaProtonAlpha{"thnConfigAxisCosThetaProtonAlpha", {200, -2, 2}, ""}; + } thnAxisConfigs; // Event selection criteria Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; @@ -473,7 +484,13 @@ struct cascadeFlow { int currentRunNumber = -999; int lastRunNumber = -999; std::vector shiftprofile{}; + std::vector shiftprofileFT0C{}; + std::vector shiftprofileTPCL{}; + std::vector shiftprofileTPCR{}; std::string fullCCDBShiftCorrPath; + std::string fullCCDBShiftCorrPathFT0C; + std::string fullCCDBShiftCorrPathTPCL; + std::string fullCCDBShiftCorrPathTPCR; template double ApplyShiftCorrection(TCollision coll, double psiT0C) @@ -775,25 +792,25 @@ struct cascadeFlow { histos.add("hv1EPvsv1SP", "hV1EPvsV1SP", HistType::kTH2F, {{100, -1, 1}, {100, -1, 1}}); histos.add("hv1SP_ZDCA_vs_ZDCC", "hv1SP_ZDCA_vs_ZDCC", HistType::kTH2F, {{100, -1, 1}, {100, -1, 1}}); - const AxisSpec thnAxisFT0C{thnConfigAxisFT0C, "FT0C (%)"}; - const AxisSpec thnAxisEta{thnConfigAxisEta, "#eta"}; - const AxisSpec thnAxisPt{thnConfigAxisPt, "p_{T}"}; - const AxisSpec thnAxisPtLambda{thnConfigAxisPtLambda, "p_{T, #Lambda}"}; - const AxisSpec thnAxisCharge{thnConfigAxisCharge, "Charge"}; - const AxisSpec thnAxisPsiDiff{thnConfigAxisPsiDiff, "2(phi-Psi)"}; - const AxisSpec thnAxisMassXi{thnConfigAxisMassXi, "inv. mass (#Lambda #pi) (GeV/#it{c}^{2})"}; - const AxisSpec thnAxisMassOmega{thnConfigAxisMassOmega, "inv. mass (#Lambda K) (GeV/#it{c}^{2})"}; - const AxisSpec thnAxisMassLambda{thnConfigAxisMassLambda, "inv. mass (p #pi) (GeV/#it{c}^{2})"}; - const AxisSpec thnAxisBDTScore{thnConfigAxisBDTScore, "BDT score"}; - const AxisSpec thnAxisV2{thnConfigAxisV2, "v_{2}"}; - const AxisSpec thnAxisPzs2Xi{thnConfigAxisPzs2Xi, "Pzs2Xi"}; - const AxisSpec thnAxisPzs2Omega{thnConfigAxisPzs2Omega, "Pzs2Omega"}; - const AxisSpec thnAxisPzs2Lambda{thnConfigAxisPzs2Lambda, "Pzs2Lambda"}; - const AxisSpec thnAxisCos2Theta{thnConfigAxisCos2Theta, "Cos2Theta"}; - const AxisSpec thnAxisCos2ThetaL{thnConfigAxisCos2ThetaL, "Cos2ThetaL"}; - const AxisSpec thnAxisCosThetaXiAlpha{thnConfigAxisCosThetaXiAlpha, "CosThetaXiWithAlpha"}; - const AxisSpec thnAxisCosThetaOmegaAlpha{thnConfigAxisCosThetaOmegaAlpha, "CosThetaOmegaWithAlpha"}; - const AxisSpec thnAxisCosThetaProtonAlpha{thnConfigAxisCosThetaProtonAlpha, "CosThetaProtonWithAlpha"}; + const AxisSpec thnAxisFT0C{thnAxisConfigs.thnConfigAxisFT0C, "FT0C (%)"}; + const AxisSpec thnAxisEta{thnAxisConfigs.thnConfigAxisEta, "#eta"}; + const AxisSpec thnAxisPt{thnAxisConfigs.thnConfigAxisPt, "p_{T}"}; + const AxisSpec thnAxisPtLambda{thnAxisConfigs.thnConfigAxisPtLambda, "p_{T, #Lambda}"}; + const AxisSpec thnAxisCharge{thnAxisConfigs.thnConfigAxisCharge, "Charge"}; + const AxisSpec thnAxisPsiDiff{thnAxisConfigs.thnConfigAxisPsiDiff, "2(phi-Psi)"}; + const AxisSpec thnAxisMassXi{thnAxisConfigs.thnConfigAxisMassXi, "inv. mass (#Lambda #pi) (GeV/#it{c}^{2})"}; + const AxisSpec thnAxisMassOmega{thnAxisConfigs.thnConfigAxisMassOmega, "inv. mass (#Lambda K) (GeV/#it{c}^{2})"}; + const AxisSpec thnAxisMassLambda{thnAxisConfigs.thnConfigAxisMassLambda, "inv. mass (p #pi) (GeV/#it{c}^{2})"}; + const AxisSpec thnAxisBDTScore{thnAxisConfigs.thnConfigAxisBDTScore, "BDT score"}; + const AxisSpec thnAxisV2{thnAxisConfigs.thnConfigAxisV2, "v_{2}"}; + const AxisSpec thnAxisPzs2Xi{thnAxisConfigs.thnConfigAxisPzs2Xi, "Pzs2Xi"}; + const AxisSpec thnAxisPzs2Omega{thnAxisConfigs.thnConfigAxisPzs2Omega, "Pzs2Omega"}; + const AxisSpec thnAxisPzs2Lambda{thnAxisConfigs.thnConfigAxisPzs2Lambda, "Pzs2Lambda"}; + const AxisSpec thnAxisCos2Theta{thnAxisConfigs.thnConfigAxisCos2Theta, "Cos2Theta"}; + const AxisSpec thnAxisCos2ThetaL{thnAxisConfigs.thnConfigAxisCos2ThetaL, "Cos2ThetaL"}; + const AxisSpec thnAxisCosThetaXiAlpha{thnAxisConfigs.thnConfigAxisCosThetaXiAlpha, "CosThetaXiWithAlpha"}; + const AxisSpec thnAxisCosThetaOmegaAlpha{thnAxisConfigs.thnConfigAxisCosThetaOmegaAlpha, "CosThetaOmegaWithAlpha"}; + const AxisSpec thnAxisCosThetaProtonAlpha{thnAxisConfigs.thnConfigAxisCosThetaProtonAlpha, "CosThetaProtonWithAlpha"}; histos.add("massXi_ProtonAcc", "massXi", HistType::kTH1F, {thnAxisMassXi}); histos.add("massOmega_ProtonAcc", "massOmega", HistType::kTH1F, {thnAxisMassOmega}); @@ -1059,21 +1076,26 @@ struct cascadeFlow { histos.fill(HIST("ShiftTPCR"), coll.centFT0C(), 1.5, ishift - 0.5, std::cos(ishift * 2 * psiTPCC)); } - if (cfgShiftCorr) { + if (ShiftConfigs.cfgShiftCorr) { currentRunNumber = coll.runNumber(); if (currentRunNumber != lastRunNumber) { - shiftprofile.clear(); - for (int i = 2; i < cfgnMods + 2; i++) { - fullCCDBShiftCorrPath = cfgShiftPath; - fullCCDBShiftCorrPath += "/v"; - fullCCDBShiftCorrPath += std::to_string(i); - auto objshift = ccdb->getForTimeStamp(fullCCDBShiftCorrPath, coll.timestamp()); - shiftprofile.push_back(objshift); - } + shiftprofileFT0C.clear(); + shiftprofileTPCL.clear(); + shiftprofileTPCR.clear(); + fullCCDBShiftCorrPathFT0C = ShiftConfigs.cfgShiftPathFT0C; + fullCCDBShiftCorrPathTPCL = ShiftConfigs.cfgShiftPathTPCL; + fullCCDBShiftCorrPathTPCR = ShiftConfigs.cfgShiftPathTPCR; + auto objshiftFT0C = ccdb->getForTimeStamp(fullCCDBShiftCorrPathFT0C, coll.timestamp()); + shiftprofileFT0C.push_back(objshiftFT0C); + auto objshiftTPCL = ccdb->getForTimeStamp(fullCCDBShiftCorrPathTPCL, coll.timestamp()); + shiftprofileTPCL.push_back(objshiftTPCL); + auto objshiftTPCR = ccdb->getForTimeStamp(fullCCDBShiftCorrPathTPCR, coll.timestamp()); + shiftprofileTPCR.push_back(objshiftTPCR); lastRunNumber = currentRunNumber; } } - if (cfgShiftCorr) { + + if (ShiftConfigs.cfgShiftCorr) { psiT0CCorr = ApplyShiftCorrection(coll, psiT0C); ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC); } @@ -1373,21 +1395,25 @@ struct cascadeFlow { histos.fill(HIST("ShiftTPCR"), coll.centFT0C(), 1.5, ishift - 0.5, std::cos(ishift * 2 * psiTPCC)); } - if (cfgShiftCorr) { + if (ShiftConfigs.cfgShiftCorr) { currentRunNumber = coll.runNumber(); if (currentRunNumber != lastRunNumber) { - shiftprofile.clear(); - for (int i = 2; i < cfgnMods + 2; i++) { - fullCCDBShiftCorrPath = cfgShiftPath; - fullCCDBShiftCorrPath += "/v"; - fullCCDBShiftCorrPath += std::to_string(i); - auto objshift = ccdb->getForTimeStamp(fullCCDBShiftCorrPath, coll.timestamp()); - shiftprofile.push_back(objshift); - } + shiftprofileFT0C.clear(); + shiftprofileTPCL.clear(); + shiftprofileTPCR.clear(); + fullCCDBShiftCorrPathFT0C = ShiftConfigs.cfgShiftPathFT0C; + fullCCDBShiftCorrPathTPCL = ShiftConfigs.cfgShiftPathTPCL; + fullCCDBShiftCorrPathTPCR = ShiftConfigs.cfgShiftPathTPCR; + auto objshiftFT0C = ccdb->getForTimeStamp(fullCCDBShiftCorrPathFT0C, coll.timestamp()); + shiftprofileFT0C.push_back(objshiftFT0C); + auto objshiftTPCL = ccdb->getForTimeStamp(fullCCDBShiftCorrPathTPCL, coll.timestamp()); + shiftprofileTPCL.push_back(objshiftTPCL); + auto objshiftTPCR = ccdb->getForTimeStamp(fullCCDBShiftCorrPathTPCR, coll.timestamp()); + shiftprofileTPCR.push_back(objshiftTPCR); lastRunNumber = currentRunNumber; } } - if (cfgShiftCorr) { + if (ShiftConfigs.cfgShiftCorr) { psiT0CCorr = ApplyShiftCorrection(coll, psiT0C); ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC); } @@ -1674,21 +1700,25 @@ struct cascadeFlow { histos.fill(HIST("ShiftTPCR"), coll.centFT0C(), 1.5, ishift - 0.5, std::cos(ishift * 2 * psiTPCC)); } - if (cfgShiftCorr) { + if (ShiftConfigs.cfgShiftCorr) { currentRunNumber = coll.runNumber(); if (currentRunNumber != lastRunNumber) { - shiftprofile.clear(); - for (int i = 2; i < cfgnMods + 2; i++) { - fullCCDBShiftCorrPath = cfgShiftPath; - fullCCDBShiftCorrPath += "/v"; - fullCCDBShiftCorrPath += std::to_string(i); - auto objshift = ccdb->getForTimeStamp(fullCCDBShiftCorrPath, coll.timestamp()); - shiftprofile.push_back(objshift); - } + shiftprofileFT0C.clear(); + shiftprofileTPCL.clear(); + shiftprofileTPCR.clear(); + fullCCDBShiftCorrPathFT0C = ShiftConfigs.cfgShiftPathFT0C; + fullCCDBShiftCorrPathTPCL = ShiftConfigs.cfgShiftPathTPCL; + fullCCDBShiftCorrPathTPCR = ShiftConfigs.cfgShiftPathTPCR; + auto objshiftFT0C = ccdb->getForTimeStamp(fullCCDBShiftCorrPathFT0C, coll.timestamp()); + shiftprofileFT0C.push_back(objshiftFT0C); + auto objshiftTPCL = ccdb->getForTimeStamp(fullCCDBShiftCorrPathTPCL, coll.timestamp()); + shiftprofileTPCL.push_back(objshiftTPCL); + auto objshiftTPCR = ccdb->getForTimeStamp(fullCCDBShiftCorrPathTPCR, coll.timestamp()); + shiftprofileTPCR.push_back(objshiftTPCR); lastRunNumber = currentRunNumber; } } - if (cfgShiftCorr) { + if (ShiftConfigs.cfgShiftCorr) { psiT0CCorr = ApplyShiftCorrection(coll, psiT0C); ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC); } @@ -1902,21 +1932,25 @@ struct cascadeFlow { histos.fill(HIST("ShiftTPCR"), coll.centFT0C(), 1.5, ishift - 0.5, std::cos(ishift * 2 * psiTPCC)); } - if (cfgShiftCorr) { + if (ShiftConfigs.cfgShiftCorr) { currentRunNumber = coll.runNumber(); if (currentRunNumber != lastRunNumber) { - shiftprofile.clear(); - for (int i = 2; i < cfgnMods + 2; i++) { - fullCCDBShiftCorrPath = cfgShiftPath; - fullCCDBShiftCorrPath += "/v"; - fullCCDBShiftCorrPath += std::to_string(i); - auto objshift = ccdb->getForTimeStamp(fullCCDBShiftCorrPath, coll.timestamp()); - shiftprofile.push_back(objshift); - } + shiftprofileFT0C.clear(); + shiftprofileTPCL.clear(); + shiftprofileTPCR.clear(); + fullCCDBShiftCorrPathFT0C = ShiftConfigs.cfgShiftPathFT0C; + fullCCDBShiftCorrPathTPCL = ShiftConfigs.cfgShiftPathTPCL; + fullCCDBShiftCorrPathTPCR = ShiftConfigs.cfgShiftPathTPCR; + auto objshiftFT0C = ccdb->getForTimeStamp(fullCCDBShiftCorrPathFT0C, coll.timestamp()); + shiftprofileFT0C.push_back(objshiftFT0C); + auto objshiftTPCL = ccdb->getForTimeStamp(fullCCDBShiftCorrPathTPCL, coll.timestamp()); + shiftprofileTPCL.push_back(objshiftTPCL); + auto objshiftTPCR = ccdb->getForTimeStamp(fullCCDBShiftCorrPathTPCR, coll.timestamp()); + shiftprofileTPCR.push_back(objshiftTPCR); lastRunNumber = currentRunNumber; } } - if (cfgShiftCorr) { + if (ShiftConfigs.cfgShiftCorr) { psiT0CCorr = ApplyShiftCorrection(coll, psiT0C); ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC); } From d8d3e5bbdfbffbe3996ae4c444621c169f6e99aa Mon Sep 17 00:00:00 2001 From: Marcello Di Costanzo <96481191+Marcellocosti@users.noreply.github.com> Date: Fri, 12 Sep 2025 05:48:49 +0200 Subject: [PATCH 366/986] [PWGHF] Reduced workflow for charm hadron correlations (#12941) Co-authored-by: ALICE Action Bot --- .../DataModel/DerivedDataCorrelationTables.h | 72 +-- PWGHF/HFC/TableProducer/CMakeLists.txt | 9 +- .../correlatorFlowCharmHadronsReduced.cxx | 470 ++++++++++++++++++ ...derivedDataCreatorCorrelationsReduced.cxx} | 21 +- 4 files changed, 531 insertions(+), 41 deletions(-) create mode 100644 PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx rename PWGHF/HFC/TableProducer/{correlatorFlowCharmHadrons.cxx => derivedDataCreatorCorrelationsReduced.cxx} (93%) diff --git a/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h b/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h index 4565189a5ab..40274d89cef 100644 --- a/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h +++ b/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h @@ -49,20 +49,20 @@ using HfcRedCollision = HfcRedCollisions::iterator; namespace hf_candidate_reduced { -DECLARE_SOA_INDEX_COLUMN(HfcRedCollision, hfcRedCollision); //! ReducedCollision index -DECLARE_SOA_INDEX_COLUMN(HfcRedFlowColl, hfcRedFlowColl); //! ReducedCollision index -DECLARE_SOA_COLUMN(Prong0Id, prong0Id, int); //! Prong 0 index -DECLARE_SOA_COLUMN(Prong1Id, prong1Id, int); //! Prong 1 index -DECLARE_SOA_COLUMN(Prong2Id, prong2Id, int); //! Prong2 index -DECLARE_SOA_COLUMN(PhiCand, phiCand, float); //! Phi of the candidate -DECLARE_SOA_COLUMN(EtaCand, etaCand, float); //! Eta of the candidate -DECLARE_SOA_COLUMN(PtCand, ptCand, float); //! Pt of the candidate -DECLARE_SOA_COLUMN(InvMassDs, invMassDs, float); //! Invariant mass of Ds candidate -DECLARE_SOA_COLUMN(InvMassCharmHad, invMassCharmHad, float); //! Invariant mass of CharmHad candidate -DECLARE_SOA_COLUMN(BdtScorePrompt, bdtScorePrompt, float); //! BDT output score for prompt hypothesis -DECLARE_SOA_COLUMN(BdtScoreBkg, bdtScoreBkg, float); //! BDT output score for backgronud hypothesis -DECLARE_SOA_COLUMN(BdtScore0, bdtScore0, float); //! First BDT output score -DECLARE_SOA_COLUMN(BdtScore1, bdtScore1, float); //! Second BDT output score +DECLARE_SOA_INDEX_COLUMN(HfcRedCollision, hfcRedCollision); //! ReducedCollision index +DECLARE_SOA_INDEX_COLUMN(HfcRedFlowColl, hfcRedFlowColl); //! ReducedCollision index +DECLARE_SOA_COLUMN(Prong0Id, prong0Id, int); //! Prong 0 index +DECLARE_SOA_COLUMN(Prong1Id, prong1Id, int); //! Prong 1 index +DECLARE_SOA_COLUMN(Prong2Id, prong2Id, int); //! Prong2 index +DECLARE_SOA_COLUMN(PhiCand, phiCand, float); //! Phi of the candidate +DECLARE_SOA_COLUMN(EtaCand, etaCand, float); //! Eta of the candidate +DECLARE_SOA_COLUMN(PtCand, ptCand, float); //! Pt of the candidate +DECLARE_SOA_COLUMN(InvMassDs, invMassDs, float); //! Invariant mass of Ds candidate +DECLARE_SOA_COLUMN(InvMassCand, invMassCand, float); //! Invariant mass of Charm candidate +DECLARE_SOA_COLUMN(BdtScorePrompt, bdtScorePrompt, float); //! BDT output score for prompt hypothesis +DECLARE_SOA_COLUMN(BdtScoreBkg, bdtScoreBkg, float); //! BDT output score for background hypothesis +DECLARE_SOA_COLUMN(BdtScore0, bdtScore0, float); //! First BDT output score +DECLARE_SOA_COLUMN(BdtScore1, bdtScore1, float); //! Second BDT output score } // namespace hf_candidate_reduced DECLARE_SOA_TABLE(DsCandReduceds, "AOD", "DSCANDREDUCED", //! Table with Ds candidate info soa::Index<>, @@ -81,23 +81,13 @@ DECLARE_SOA_TABLE(DsCandSelInfos, "AOD", "DSCANDSELINFO", //! Table with Ds cand aod::hf_candidate_reduced::BdtScorePrompt, aod::hf_candidate_reduced::BdtScoreBkg); -DECLARE_SOA_TABLE(HfcRedCharmHads2P, "AOD", "HFCREDCHARM2P", //! Table with 2-prong charm hadron candidate info +DECLARE_SOA_TABLE(HfcRedCharmTrigs, "AOD", "HFCREDCHARMTRIG", //! Table with charm hadron candidate info soa::Index<>, aod::hf_candidate_reduced::HfcRedFlowCollId, aod::hf_candidate_reduced::PhiCand, aod::hf_candidate_reduced::EtaCand, aod::hf_candidate_reduced::PtCand, - aod::hf_candidate_reduced::InvMassCharmHad, - aod::hf_candidate_reduced::Prong0Id, - aod::hf_candidate_reduced::Prong1Id); - -DECLARE_SOA_TABLE(HfcRedCharmHads3P, "AOD", "HFCREDCHARM3P", //! Table with 3-prong charm hadron candidate info - soa::Index<>, - aod::hf_candidate_reduced::HfcRedFlowCollId, - aod::hf_candidate_reduced::PhiCand, - aod::hf_candidate_reduced::EtaCand, - aod::hf_candidate_reduced::PtCand, - aod::hf_candidate_reduced::InvMassCharmHad, + aod::hf_candidate_reduced::InvMassCand, aod::hf_candidate_reduced::Prong0Id, aod::hf_candidate_reduced::Prong1Id, aod::hf_candidate_reduced::Prong2Id); @@ -137,7 +127,7 @@ DECLARE_SOA_TABLE(AssocTrackSels, "AOD", "ASSOCTRACKSEL", //! Table with associa aod::hf_assoc_track_reduced::DcaXY, aod::hf_assoc_track_reduced::DcaZ) -DECLARE_SOA_TABLE(HfcRedTrkAssoc, "AOD", "HFCREDTRKASSOC", //! Table with associated track info +DECLARE_SOA_TABLE(HfcRedTrkAssocs, "AOD", "HFCREDTRKASSOC", //! Table with associated track info soa::Index<>, aod::hf_candidate_reduced::HfcRedFlowCollId, aod::hf_assoc_track_reduced::OriginTrackId, @@ -145,7 +135,7 @@ DECLARE_SOA_TABLE(HfcRedTrkAssoc, "AOD", "HFCREDTRKASSOC", //! Table with associ aod::hf_assoc_track_reduced::EtaAssocTrack, aod::hf_assoc_track_reduced::PtAssocTrack); -DECLARE_SOA_TABLE(HfcRedTrkSels, "AOD", "HFCREDTRKSELS", //! Table with associated track info +DECLARE_SOA_TABLE(HfcRedTrkSels, "AOD", "HFCREDTRKSEL", //! Table with associated track info soa::Index<>, aod::hf_candidate_reduced::HfcRedFlowCollId, aod::hf_assoc_track_reduced::NTpcCrossedRows, @@ -153,6 +143,32 @@ DECLARE_SOA_TABLE(HfcRedTrkSels, "AOD", "HFCREDTRKSELS", //! Table with associat aod::hf_assoc_track_reduced::ItsNCls, aod::hf_assoc_track_reduced::DcaXY, aod::hf_assoc_track_reduced::DcaZ) + +// definition of columns and tables for Charm-Hadron and Hadron-Hadron correlation pairs +namespace hf_correlation_charm_hadron_reduced +{ +DECLARE_SOA_INDEX_COLUMN_FULL(CharmTrig, charmTrig, int, HfcRedCharmTrigs, "_0"); //! Reduced charm trigger candidate index +DECLARE_SOA_INDEX_COLUMN_FULL(HadTrig, hadTrig, int, HfcRedTrkAssocs, "_1"); //! Reduced hadron trigger candidate index +DECLARE_SOA_INDEX_COLUMN_FULL(TrkAssoc, trkAssoc, int, HfcRedTrkAssocs, "_2"); //! Reduced associated track index +DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! DeltaPhi between charm hadron and Hadrons +DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); //! DeltaEta between charm hadron and Hadrons +DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin for the MixedEvent +} // namespace hf_correlation_charm_hadron_reduced + +DECLARE_SOA_TABLE(HfcRedChHads, "AOD", "HFCREDCHHAD", //! Charm-Hadron pairs information + aod::hf_correlation_charm_hadron_reduced::CharmTrigId, + aod::hf_correlation_charm_hadron_reduced::TrkAssocId, + aod::hf_correlation_charm_hadron_reduced::DeltaEta, + aod::hf_correlation_charm_hadron_reduced::DeltaPhi, + aod::hf_correlation_charm_hadron_reduced::PoolBin); + +DECLARE_SOA_TABLE(HfcRedHadHads, "AOD", "HFCREDHADHAD", //! Hadron-Hadron pairs information + aod::hf_correlation_charm_hadron_reduced::HadTrigId, + aod::hf_correlation_charm_hadron_reduced::TrkAssocId, + aod::hf_correlation_charm_hadron_reduced::DeltaEta, + aod::hf_correlation_charm_hadron_reduced::DeltaPhi, + aod::hf_correlation_charm_hadron_reduced::PoolBin); + } // namespace o2::aod #endif // PWGHF_HFC_DATAMODEL_DERIVEDDATACORRELATIONTABLES_H_ diff --git a/PWGHF/HFC/TableProducer/CMakeLists.txt b/PWGHF/HFC/TableProducer/CMakeLists.txt index eff0f6557b3..28022d68247 100644 --- a/PWGHF/HFC/TableProducer/CMakeLists.txt +++ b/PWGHF/HFC/TableProducer/CMakeLists.txt @@ -44,11 +44,16 @@ o2physics_add_dpl_workflow(correlator-ds-hadrons PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(correlator-flow-charm-hadrons - SOURCES correlatorFlowCharmHadrons.cxx +o2physics_add_dpl_workflow(derived-data-creator-correlations-reduced + SOURCES derivedDataCreatorCorrelationsReduced.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(correlator-flow-charm-hadrons-reduced + SOURCES correlatorFlowCharmHadronsReduced.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(correlator-ds-hadrons-reduced SOURCES correlatorDsHadronsReduced.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore diff --git a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx new file mode 100644 index 00000000000..e1d1662924e --- /dev/null +++ b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx @@ -0,0 +1,470 @@ +// 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 correlatorFlowCharmHadronsReduced.cxx +/// \brief CharmHadrons-Hadrons correlator tree creator for data analyses +/// \author Marcello Di Costanzo , Politecnico and INFN Torino + +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h" + +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::hf_centrality; +using namespace o2::hf_evsel; + +using BinningTypeDerivedCent = ColumnBinningPolicy; +using BinningTypeDerivedMult = ColumnBinningPolicy; + +struct HfCorrelatorFlowCharmHadronsReduced { + Produces entryCharmHadPair; + Produces entryHadHadPair; + + Configurable fillSparses{"fillSparses", true, "Fill sparse histograms"}; + Configurable fillTables{"fillTables", false, "Fill tables"}; + Configurable numberEventsMixed{"numberEventsMixed", 5, "Number of events mixed in ME process"}; + Configurable> binsPtTrig{"binsPtTrig", std::vector{1., 3., 5., 8., 16., 36.}, "pT bin limits for trigger candidates"}; + Configurable> binsPtAssoc{"binsPtAssoc", std::vector{0.3, 1., 2., 50.}, "pT bin limits for associated particles"}; + Configurable deltaEtaAbsMin{"deltaEtaAbsMin", 0.5, "min. pair delta eta"}; + Configurable deltaEtaAbsMax{"deltaEtaAbsMax", 2., "max. pair delta eta"}; + Configurable dcaXYTrackMax{"dcaXYTrackMax", 1., "max. track DCA XY"}; + Configurable dcaZTrackMax{"dcaZTrackMax", 1., "max. track DCA Z"}; + Configurable tpcCrossedRowsMin{"tpcCrossedRowsMin", 1, "min. TPC crossed rows"}; + Configurable itsNClsMin{"itsNClsMin", 1, "min. ITS clusters"}; + + SliceCache cache; + + using AssocTracks = soa::Filtered>; + + Filter filterSelectTrackData = (nabs(aod::hf_assoc_track_reduced::dcaXY) < dcaXYTrackMax) && (nabs(aod::hf_assoc_track_reduced::dcaZ) < dcaZTrackMax) && (aod::hf_assoc_track_reduced::nTpcCrossedRows > tpcCrossedRowsMin) && (aod::hf_assoc_track_reduced::itsNCls > itsNClsMin); + + Preslice tracksPerCol = aod::hf_candidate_reduced::hfcRedFlowCollId; + Preslice candsPerCol = aod::hf_candidate_reduced::hfcRedFlowCollId; + + ConfigurableAxis zPoolBins{"zPoolBins", {VARIABLE_WIDTH, -10.0, -2.5, 2.5, 10.0}, "Z vertex position pools"}; + ConfigurableAxis multPoolBins{"multPoolBins", {VARIABLE_WIDTH, 0., 900., 1800., 6000.}, "Event multiplicity pools (FT0M)"}; + ConfigurableAxis centPoolBins{"centPoolBins", {VARIABLE_WIDTH, 0., 10., 20., 30.}, "Event centrality pools"}; + ConfigurableAxis binsInvMass{"binsInvMass", {300, 1.6, 2.2}, ""}; + ConfigurableAxis binsMultFT0M{"binsMultFT0M", {100, 0., 10000.}, "Multiplicity as FT0M signal amplitude"}; + ConfigurableAxis binsCent{"binsCent", {100, 0., 100.}, "Centrality bins"}; + ConfigurableAxis binsPosZ{"binsPosZ", {100, -10., 10.}, "Primary vertex z coordinate"}; + ConfigurableAxis binsEta{"binsEta", {50, -2., 2.}, "Eta bins"}; + ConfigurableAxis binsPhi{"binsPhi", {64, -o2::constants::math::PIHalf, 3. * o2::constants::math::PIHalf}, "Phi bins"}; + ConfigurableAxis binsDeltaEta{"binsDeltaEta", {100, -2., 2.}, "Delta Eta bins"}; + ConfigurableAxis binsDeltaPhi{"binsDeltaPhi", {64, -3., 3.}, "Delta Phi bins"}; + ConfigurableAxis binsPoolBin{"binsPoolBin", {9, 0., 9.}, "PoolBin"}; + ConfigurableAxis binsMlOne{"binsMlOne", {100, 0., 1.}, ""}; + ConfigurableAxis binsMlTwo{"binsMlTwo", {100, 0., 1.}, ""}; + + HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; + + void init(InitContext&) + { + std::array doprocess{doprocessSameEventCharmHadWCentMix, doprocessSameEventCharmHadWMultMix, doprocessMixedEventCharmHadWCentMix, doprocessMixedEventCharmHadWMultMix, + doprocessSameEventHadHadWCentMix, doprocessSameEventHadHadWMultMix, doprocessMixedEventHadHadWCentMix, doprocessMixedEventHadHadWMultMix}; + if ((std::accumulate(doprocess.begin(), doprocess.end(), 0)) > 1) { + LOGP(fatal, "Only one process function should be enabled! Please check your configuration!"); + if (!((doprocessSameEventCharmHadWCentMix && doprocessMixedEventCharmHadWCentMix) || (doprocessSameEventCharmHadWMultMix && doprocessMixedEventCharmHadWMultMix))) { + LOG(fatal) << "Different binning policies between Same Event and Mixed Event"; + } + if (!((doprocessSameEventHadHadWCentMix && doprocessMixedEventHadHadWCentMix) || (doprocessSameEventHadHadWMultMix && doprocessMixedEventHadHadWMultMix))) { + LOG(fatal) << "Different binning policies between Same Event and Mixed Event"; + } + } + + const AxisSpec axisInvMass{binsInvMass, "Inv. mass (GeV/#it{c}^{2})"}; + const AxisSpec axisCent = {binsCent, "Centrality"}; + const AxisSpec axisMultFT0M = {binsMultFT0M, "MultiplicityFT0M"}; + const AxisSpec axisPosZ = {binsPosZ, "PosZ"}; + const AxisSpec axisPoolBin = {binsPoolBin, "PoolBin"}; + const AxisSpec axisEta = {binsEta, "#it{#eta}"}; + const AxisSpec axisPhi = {binsPhi, "#it{#varphi}"}; + const AxisSpec axisDeltaEta = {binsDeltaEta, "#Delta#it{#eta}"}; + const AxisSpec axisDeltaPhi = {binsDeltaPhi, "#Delta#it{#varphi}"}; + const AxisSpec axisPtTrig = {(std::vector)binsPtTrig, "#it{p}_{T} Trig (GeV/#it{c})"}; + const AxisSpec axisPtAssoc = {(std::vector)binsPtAssoc, "#it{p}_{T} Assoc (GeV/#it{c})"}; + const AxisSpec axisMlOne{binsMlOne, "bdtScore0"}; + const AxisSpec axisMlTwo{binsMlTwo, "bdtScore1"}; + + // Histograms for data analysis + if (doprocessSameEventCharmHadWCentMix || doprocessMixedEventCharmHadWCentMix || doprocessSameEventHadHadWCentMix || doprocessMixedEventHadHadWCentMix) { + registry.add("hCent", "Centrality", {HistType::kTH2F, {{axisCent}, {axisPoolBin}}}); + } else { + registry.add("hMultFT0M", "Multiplicity FT0M", {HistType::kTH2F, {{axisMultFT0M}, {axisPoolBin}}}); + } + registry.add("hZVtx", "z vertex", {HistType::kTH2F, {{axisPosZ}, {axisPoolBin}}}); + registry.add("hCollisionPoolBin", "Collision pool bin", {HistType::kTH1F, {axisPoolBin}}); + registry.add("hPoolBinTrig", "Trigger candidates pool bin", {HistType::kTH1F, {axisPoolBin}}); + registry.add("hPhiVsPtTrig", "Trigger candidates phiVsPt", {HistType::kTH2F, {{axisPhi}, {axisPtTrig}}}); + registry.add("hEtaVsPtTrig", "Trigger candidates etaVsPt", {HistType::kTH2F, {{axisEta}, {axisPtTrig}}}); + registry.add("hPoolBinAssoc", "Associated particles pool bin", {HistType::kTH1F, {axisPoolBin}}); + registry.add("hPhiVsPtAssoc", "Associated particles phiVsPt", {HistType::kTH3F, {{axisPhi}, {axisPtTrig}, {axisPtAssoc}}}); + registry.add("hEtaVsPtAssoc", "Associated particles etaVsPt", {HistType::kTH3F, {{axisEta}, {axisPtTrig}, {axisPtAssoc}}}); + + if (fillSparses) { + std::vector axes = {axisPtTrig, axisPtAssoc, axisDeltaEta, axisDeltaPhi, axisPoolBin}; + if (doprocessSameEventHadHadWCentMix || doprocessSameEventHadHadWMultMix) { + registry.add("hSparseCorrelationsSEHadHad", "THn for SE Had-Had correlations", HistType::kTHnSparseF, axes); + } else if (doprocessMixedEventHadHadWCentMix || doprocessMixedEventHadHadWMultMix) { + registry.add("hSparseCorrelationsMEHadHad", "THn for ME Had-Had correlations", HistType::kTHnSparseF, axes); + } else { + axes.insert(axes.end(), {axisMlOne, axisMlTwo, axisInvMass}); + if (doprocessSameEventCharmHadWCentMix || doprocessSameEventCharmHadWMultMix) { + registry.add("hSparseCorrelationsSECharmHad", "THn for SE Charm-Had correlations", HistType::kTHnSparseF, axes); + } else if (doprocessMixedEventCharmHadWCentMix || doprocessMixedEventCharmHadWMultMix) { + registry.add("hSparseCorrelationsMECharmHad", "THn for ME Charm-Had correlations", HistType::kTHnSparseF, axes); + } + } + } + } + + /// Get charm candidate or hadron track pT + /// \param track is the candidate + template + double getPt(const TTrack& track) + { + if constexpr (requires { track.ptAssocTrack(); }) { + return track.ptAssocTrack(); + } else { + return track.ptCand(); + } + } + + /// Get charm candidate or hadron track eta + /// \param track is the candidate + template + double getEta(const TTrack& track) + { + if constexpr (requires { track.etaAssocTrack(); }) { + return track.etaAssocTrack(); + } else { + return track.etaCand(); + } + } + + /// Get charm candidate or hadron track phi + /// \param track is the candidate + template + double getPhi(const TTrack& track) + { + if constexpr (requires { track.phiAssocTrack(); }) { + return track.phiAssocTrack(); + } else { + return track.phiCand(); + } + } + + /// Get the binning pool associated to the collision + /// \param collision is the collision + /// \param corrBinning is the binning policy for the correlation + template + int getPoolBin(const TColl& collision, const TBinningType& corrBinning) + { + int poolBin{0}; + if constexpr (std::is_same_v) { + poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.centrality())); + if constexpr (fillHistos) { + registry.fill(HIST("hCent"), collision.centrality(), poolBin); + } + } else if constexpr (std::is_same_v) { + poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multiplicity())); + if constexpr (fillHistos) { + registry.fill(HIST("hMultFT0M"), collision.multiplicity(), poolBin); + } + } + return poolBin; + } + + /// Reject daughter-track pairs and same-track pairs + /// \param cand is the trigger candidate + /// \param track is the associated track + template + bool rejSameEvtPair(const TTrigPart& cand, const TTrack& track) + { + if constexpr (requires { cand.originTrackId(); }) { + // Remove same track pairs for Had-Had correlations + return (cand.originTrackId() == track.originTrackId()); + } else { + // Remove pairs with 2- and 3-prong daughters (prong2Id returns -1 for 2-prongs) + return ((cand.prong0Id() == track.originTrackId()) || (cand.prong1Id() == track.originTrackId()) || (cand.prong2Id() == track.originTrackId())); + } + } + + /// Slice trigger candidates by collision + /// \param cands are the trigger candidates + /// \param collId is the collision index + template + auto sliceTrigCands(TTrigCands const& cands, const int collId) + { + if constexpr (std::is_same_v) { + return cands.sliceBy(tracksPerCol, collId); + } else { + return cands.sliceBy(candsPerCol, collId); + } + } + + /// Fill Charm-Hadron correlation table and sparse + /// \param trigCand is the trigger charm hadron candidate + /// \param assocTrack is the associated hadron track + /// \param poolBin is the pool bin of the collision + template + void fillCharmHadInfo(TTrigCand const& trigCand, + TTrack const& assocTrack, + const int poolBin) + { + double deltaEta = getEta(assocTrack) - getEta(trigCand); + double deltaPhi = RecoDecay::constrainAngle(getPhi(assocTrack) - getPhi(trigCand), -o2::constants::math::PIHalf); + if (fillTables) { + entryCharmHadPair(trigCand.globalIndex(), assocTrack.globalIndex(), deltaEta, deltaPhi, poolBin); + } + if (fillSparses) { + if constexpr (isMixedEvent) { + registry.fill(HIST("hSparseCorrelationsMECharmHad"), getPt(trigCand), getPt(assocTrack), + deltaEta, deltaPhi, poolBin, trigCand.bdtScore0(), + trigCand.bdtScore1(), trigCand.invMassCand()); + } else { + registry.fill(HIST("hSparseCorrelationsSECharmHad"), getPt(trigCand), getPt(assocTrack), + deltaEta, deltaPhi, poolBin, trigCand.bdtScore0(), + trigCand.bdtScore1(), trigCand.invMassCand()); + } + } + } + + /// Fill Hadron-Hadron correlation table and sparse + /// \param trigCand is the trigger hadron candidate + /// \param assocTrack is the associated hadron track + /// \param poolBin is the pool bin of the collision + template + void fillHadHadInfo(TCand const& trigCand, + TCand const& assocTrack, + const int poolBin) + { + double deltaEta = getEta(assocTrack) - getEta(trigCand); + double deltaPhi = RecoDecay::constrainAngle(getPhi(assocTrack) - getPhi(trigCand), -o2::constants::math::PIHalf); + if (fillTables) { + entryHadHadPair(trigCand.globalIndex(), assocTrack.globalIndex(), deltaEta, deltaPhi, poolBin); + } + if (fillSparses) { + if constexpr (isMixedEvent) { + registry.fill(HIST("hSparseCorrelationsMEHadHad"), getPt(trigCand), getPt(assocTrack), deltaEta, deltaPhi, poolBin); + } else { + registry.fill(HIST("hSparseCorrelationsSEHadHad"), getPt(trigCand), getPt(assocTrack), deltaEta, deltaPhi, poolBin); + } + } + } + + /// Save info for Same Event pairs + /// \param collisions are the selected collisions + /// \param trigCands are the selected trigger candidates + /// \param assocTracks are the selected associated tracks + /// \param corrBinning is the binning policy for the correlation + template + void fillSameEvent(aod::HfcRedFlowColls const& collisions, + TTrigCands const& trigCands, + TAssocTracks const& assocTracks, + TBinningType corrBinning) + { + for (const auto& collision : collisions) { + int poolBin = getPoolBin(collision, corrBinning); + registry.fill(HIST("hCollisionPoolBin"), poolBin); + registry.fill(HIST("hZVtx"), collision.posZ(), poolBin); + + auto thisCollId = collision.globalIndex(); + auto trigCandsThisColl = sliceTrigCands(trigCands, thisCollId); + auto assocTracksThisColl = assocTracks.sliceBy(tracksPerCol, thisCollId); + + for (const auto& trigCand : trigCandsThisColl) { + registry.fill(HIST("hPoolBinTrig"), poolBin); + registry.fill(HIST("hPhiVsPtTrig"), RecoDecay::constrainAngle(getPhi(trigCand), -o2::constants::math::PIHalf), getPt(trigCand)); + registry.fill(HIST("hEtaVsPtTrig"), getEta(trigCand), getPt(trigCand)); + for (const auto& assocTrack : assocTracksThisColl) { + if (rejSameEvtPair(trigCand, assocTrack)) { + continue; + } + double deltaEta = getEta(assocTrack) - getEta(trigCand); + if (std::abs(deltaEta) < deltaEtaAbsMin || std::abs(deltaEta) > deltaEtaAbsMax) { + continue; + } + registry.fill(HIST("hPoolBinAssoc"), poolBin); + registry.fill(HIST("hPhiVsPtAssoc"), RecoDecay::constrainAngle(getPhi(assocTrack), -o2::constants::math::PIHalf), getPt(trigCand), getPt(assocTrack)); + registry.fill(HIST("hEtaVsPtAssoc"), getEta(assocTrack), getPt(trigCand), getPt(assocTrack)); + + if constexpr (std::is_same_v) { + fillHadHadInfo(trigCand, assocTrack, poolBin); + } else { + fillCharmHadInfo(trigCand, assocTrack, poolBin); + } + } + } + } + } + + /// Save info for Mixed Event pairs + /// \param collisions are the selected collisions + /// \param trigCands are the selected trigger candidates + /// \param assocTracks are the selected associated tracks + /// \param corrBinning is the binning policy for the correlation + template + void fillMixedEvent(aod::HfcRedFlowColls const& collisions, + TTrigCands const& trigCands, + TAssocTracks const& assocTracks, + TBinningType corrBinning) + { + for (const auto& collision : collisions) { + int poolBin = getPoolBin(collision, corrBinning); + registry.fill(HIST("hCollisionPoolBin"), poolBin); + registry.fill(HIST("hZVtx"), collision.posZ(), poolBin); + + auto thisCollId = collision.globalIndex(); + auto trigCandsThisColl = sliceTrigCands(trigCands, thisCollId); + auto assocTracksThisColl = assocTracks.sliceBy(tracksPerCol, thisCollId); + for (const auto& trigCand : trigCandsThisColl) { + registry.fill(HIST("hPoolBinTrig"), poolBin); + registry.fill(HIST("hPhiVsPtTrig"), RecoDecay::constrainAngle(getPhi(trigCand), -o2::constants::math::PIHalf), getPt(trigCand)); + registry.fill(HIST("hEtaVsPtTrig"), getEta(trigCand), getPt(trigCand)); + for (const auto& assocTrack : assocTracksThisColl) { + registry.fill(HIST("hPoolBinAssoc"), poolBin); + registry.fill(HIST("hPhiVsPtAssoc"), RecoDecay::constrainAngle(getPhi(assocTrack), -o2::constants::math::PIHalf), getPt(trigCand), getPt(assocTrack)); + registry.fill(HIST("hEtaVsPtAssoc"), getEta(assocTrack), getPt(trigCand), getPt(assocTrack)); + } + } + } + + auto pairsTuple = std::make_tuple(trigCands, assocTracks); + Pair pairData{corrBinning, numberEventsMixed, -1, collisions, pairsTuple, &cache}; + + for (const auto& [trigColl, trigCands, assocColl, assocTracks] : pairData) { + if (trigCands.size() == 0 || assocTracks.size() == 0) { + continue; + } + int poolBinCharm = getPoolBin(trigColl, corrBinning); + int poolBinAssoc = getPoolBin(assocColl, corrBinning); + if (poolBinAssoc != poolBinCharm) { + LOGF(info, "Error, poolBins are different"); + continue; + } + + for (const auto& [trigCand, assocTrack] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(trigCands, assocTracks))) { + double deltaEta = getEta(assocTrack) - getEta(trigCand); + if (std::abs(deltaEta) < deltaEtaAbsMin || std::abs(deltaEta) > deltaEtaAbsMax) { + continue; + } + // LOGF(info, "Mixed event tracks pair: (%d, %d) from events (%d, %d), track event: (%d, %d)", trigCand.index(), assocTrack.index(), trigColl.index(), assocColl.index(), trigCand.hfcRedFlowCollId(), assocTrack.hfcRedFlowCollId()); + if constexpr (std::is_same_v) { + fillHadHadInfo(trigCand, assocTrack, poolBinCharm); + } else { + fillCharmHadInfo(trigCand, assocTrack, poolBinCharm); + } + } + } + } + + void processSameEventCharmHadWCentMix(aod::HfcRedFlowColls const& collisions, + soa::Join const& candidates, + AssocTracks const& tracks) + { + ColumnBinningPolicy corrBinningCent{{zPoolBins, centPoolBins}, true}; + fillSameEvent(collisions, candidates, tracks, corrBinningCent); + } + PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processSameEventCharmHadWCentMix, "Process Same Event for Charm-Had with centrality pools", true); + + void processSameEventCharmHadWMultMix(aod::HfcRedFlowColls const& collisions, + soa::Join const& candidates, + AssocTracks const& tracks) + { + ColumnBinningPolicy corrBinningMult{{zPoolBins, multPoolBins}, true}; + fillSameEvent(collisions, candidates, tracks, corrBinningMult); + } + PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processSameEventCharmHadWMultMix, "Process Same Event for Charm-Had with multiplicity pools", false); + + void processMixedEventCharmHadWCentMix(aod::HfcRedFlowColls const& collisions, + soa::Join const& candidates, + AssocTracks const& tracks) + { + ColumnBinningPolicy corrBinningCent{{zPoolBins, centPoolBins}, true}; + fillMixedEvent(collisions, candidates, tracks, corrBinningCent); + } + PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processMixedEventCharmHadWCentMix, "Process Mixed Event for Charm-Had with centrality pools", false); + + void processMixedEventCharmHadWMultMix(aod::HfcRedFlowColls const& collisions, + soa::Join const& candidates, + AssocTracks const& tracks) + { + ColumnBinningPolicy corrBinningMult{{zPoolBins, multPoolBins}, true}; + fillMixedEvent(collisions, candidates, tracks, corrBinningMult); + } + PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processMixedEventCharmHadWMultMix, "Process Mixed Event for Charm-Had with multiplicity pools", false); + + void processSameEventHadHadWCentMix(aod::HfcRedFlowColls const& collisions, + AssocTracks const& tracks) + { + ColumnBinningPolicy corrBinningCent{{zPoolBins, centPoolBins}, true}; + fillSameEvent(collisions, tracks, tracks, corrBinningCent); + } + PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processSameEventHadHadWCentMix, "Process Same Event for Had-Had with centrality pools", false); + + void processSameEventHadHadWMultMix(aod::HfcRedFlowColls const& collisions, + AssocTracks const& tracks) + { + ColumnBinningPolicy corrBinningMult{{zPoolBins, multPoolBins}, true}; + fillSameEvent(collisions, tracks, tracks, corrBinningMult); + } + PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processSameEventHadHadWMultMix, "Process Same Event for Had-Had with multiplicity pools", false); + + void processMixedEventHadHadWCentMix(aod::HfcRedFlowColls const& collisions, + AssocTracks const& tracks) + { + ColumnBinningPolicy corrBinningCent{{zPoolBins, centPoolBins}, true}; + fillMixedEvent(collisions, tracks, tracks, corrBinningCent); + } + PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processMixedEventHadHadWCentMix, "Process Mixed Event for Had-Had with centrality pools", false); + + void processMixedEventHadHadWMultMix(aod::HfcRedFlowColls const& collisions, + AssocTracks const& tracks) + { + ColumnBinningPolicy corrBinningMult{{zPoolBins, multPoolBins}, true}; + fillMixedEvent(collisions, tracks, tracks, corrBinningMult); + } + PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processMixedEventHadHadWMultMix, "Process Mixed Event for Had-Had with multiplicity pools", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx b/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx similarity index 93% rename from PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx rename to PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx index f4dd7761455..e5bb19f2e9e 100644 --- a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx +++ b/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file correlatorFlowCharmHadrons.cxx +/// \file derivedDataCreatorCorrelationsReduced.cxx /// \brief CharmHadrons-Hadrons correlator tree creator for data and MC-reco analyses /// \author Marcello Di Costanzo , Politecnico and INFN Torino /// \author Stefano Politanò , CERN @@ -60,12 +60,11 @@ enum DecayChannel { }; /// Code to select collisions with at least one Ds meson -struct HfCorrelatorFlowCharmHadrons { +struct HfDerivedDataCreatorCorrelationsReduced { Produces rowCollisions; - Produces rowCharmCandidates2P; - Produces rowCharmCandidates3P; + Produces rowCharmCandidates; Produces rowCharmCandidatesMl; - Produces rowAssocTrackReduced; + Produces rowAssocTrackReduced; Produces rowAssocTrackSelInfo; Configurable centEstimator{"centEstimator", 2, "Centrality estimation (FT0A: 1, FT0C: 2, FT0M: 3, FV0A: 4)"}; @@ -231,9 +230,9 @@ struct HfCorrelatorFlowCharmHadrons { } double massCand = getCandMass(candidate); if constexpr (channel == DecayChannel::D0ToKPi || channel == DecayChannel::D0ToPiK) { - rowCharmCandidates2P(indexRedColl, candidate.phi(), candidate.eta(), candidate.pt(), massCand, candidate.prong0Id(), candidate.prong1Id()); + rowCharmCandidates(indexRedColl, candidate.phi(), candidate.eta(), candidate.pt(), massCand, candidate.prong0Id(), candidate.prong1Id(), -1); } else { - rowCharmCandidates3P(indexRedColl, candidate.phi(), candidate.eta(), candidate.pt(), massCand, candidate.prong0Id(), candidate.prong1Id(), candidate.prong2Id()); + rowCharmCandidates(indexRedColl, candidate.phi(), candidate.eta(), candidate.pt(), massCand, candidate.prong0Id(), candidate.prong1Id(), candidate.prong2Id()); } std::vector outputMl = getCandMlScores(candidate); rowCharmCandidatesMl(indexRedColl, outputMl[0], outputMl[1]); @@ -274,7 +273,7 @@ struct HfCorrelatorFlowCharmHadrons { fillTracksTables(trackIdsThisColl); } } - PROCESS_SWITCH(HfCorrelatorFlowCharmHadrons, processDplusWithMl, "Process Dplus candidates with ML info", false); + PROCESS_SWITCH(HfDerivedDataCreatorCorrelationsReduced, processDplusWithMl, "Process Dplus candidates with ML info", false); // Ds with ML selections void processDsWithMl(CollsWithCentMult const& colls, @@ -297,7 +296,7 @@ struct HfCorrelatorFlowCharmHadrons { fillTracksTables(trackIdsThisColl); } } - PROCESS_SWITCH(HfCorrelatorFlowCharmHadrons, processDsWithMl, "Process Ds candidates with ML info", false); + PROCESS_SWITCH(HfDerivedDataCreatorCorrelationsReduced, processDsWithMl, "Process Ds candidates with ML info", false); // D0 with ML selections void processD0WithMl(CollsWithCentMult const& colls, @@ -320,10 +319,10 @@ struct HfCorrelatorFlowCharmHadrons { fillTracksTables(trackIdsThisColl); } } - PROCESS_SWITCH(HfCorrelatorFlowCharmHadrons, processD0WithMl, "Process D0 candidates with ML info", false); + PROCESS_SWITCH(HfDerivedDataCreatorCorrelationsReduced, processD0WithMl, "Process D0 candidates with ML info", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{adaptAnalysisTask(cfgc)}; + return WorkflowSpec{adaptAnalysisTask(cfgc)}; } From 5688f778d52c578256b84337ed340d278238e30b Mon Sep 17 00:00:00 2001 From: omvazque Date: Fri, 12 Sep 2025 02:20:00 -0500 Subject: [PATCH 367/986] [PWGLF] Change track selection optimized for electrons (#12933) --- PWGLF/Tasks/Nuspex/piKpRAA.cxx | 270 +++++++++++++++++++++------------ 1 file changed, 174 insertions(+), 96 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/piKpRAA.cxx b/PWGLF/Tasks/Nuspex/piKpRAA.cxx index d41dd1b4812..c64467b7c6d 100644 --- a/PWGLF/Tasks/Nuspex/piKpRAA.cxx +++ b/PWGLF/Tasks/Nuspex/piKpRAA.cxx @@ -77,6 +77,9 @@ std::array, kNEtaHists> dEdxPrV0{}; std::array, kNEtaHists> dEdxElV0{}; std::array, kNEtaHists> dEdxPiTOF{}; std::array, kNEtaHists> dEdx{}; +std::array, kNEtaHists> nClVsdEdxPiV0{}; +std::array, kNEtaHists> nClVsdEdxElV0{}; +std::array, kNEtaHists> nClVsdEdxPrV0{}; std::array, kNEtaHists> pTVsP{}; std::array, kNEtaHists> nClVsP{}; std::array, kNEtaHists> nClVsPElV0{}; @@ -86,6 +89,9 @@ std::array, kNEtaHists> nClVsPp{}; std::array, kNEtaHists> nClVsPpElV0{}; std::array, kNEtaHists> nClVsPpPiV0{}; std::array, kNEtaHists> nClVsPpPrV0{}; +std::array, kNEtaHists> nClVsdEdxpPiV0{}; +std::array, kNEtaHists> nClVsdEdxpElV0{}; +std::array, kNEtaHists> nClVsdEdxpPrV0{}; struct PiKpRAA { @@ -124,7 +130,9 @@ struct PiKpRAA { Configurable maxEtaDaughter{"maxEtaDaughter", +0.8, "Daughter maximum-eta selection"}; Configurable minPt{"minPt", 0.15, "minimum pt of the tracks"}; Configurable maxPt{"maxPt", 20.0, "maximum pt of the tracks"}; - Configurable minNclFound{"minNclFound", 135, "minimum found Ncl in TPC"}; + Configurable useNclsPID{"useNclsPID", true, "Use Ncl for PID?"}; + Configurable minNcl{"minNcl", 135, "minimum found Ncl in TPC"}; + Configurable minNCrossedRows{"minNCrossedRows", 70, "minimum number of crossed rows"}; // Standard 5 topological criteria Configurable v0cospa{"v0cospa", 0.995, "min V0 CosPA"}; @@ -141,15 +149,17 @@ struct PiKpRAA { Configurable qTSel{"qTSel", 0.01f, "Armenteros qT select (Gammas)"}; // Selection + Configurable selElecFromGammas{"selElecFromGammas", true, "track selection for electrons"}; Configurable applyInvMassSel{"applyInvMassSel", false, "Select V0s close to the Inv. mass value"}; Configurable dMassSel{"dMassSel", 0.01f, "Invariant mass selection"}; Configurable dMassSelG{"dMassSelG", 0.1f, "Inv mass selection gammas"}; Configurable dMassGcut{"dMassGcut", 0.1f, "Inv mass selection gammas"}; // PID (TPC/TOF) + Configurable dEdxPlateauSel{"dEdxPlateauSel", 50, "dEdx selection for electrons"}; Configurable tpcPidNsigmaCut{"tpcPidNsigmaCut", 5, "tpcPidNsigmaCut"}; - Configurable maxPiTOFBeta{"maxPiTOFBeta", 0.00005, "Maximum beta TOF selection"}; - Configurable maxElTOFBeta{"maxElTOFBeta", 0.1, "Maximum beta TOF selection"}; + Configurable maxExpTOFPi{"maxExpTOFPi", 0.00005, "Maximum beta TOF selection"}; + Configurable maxExpTOFEl{"maxExpTOFEl", 0.001, "Maximum beta TOF selection"}; Configurable applyTPCTOFCombinedCut{"applyTPCTOFCombinedCut", false, " Apply geometrical cut ? "}; // Phi cut @@ -191,7 +201,7 @@ struct PiKpRAA { ConfigurableAxis axisArmqT{"axisArmqT", {600, 0.0f, 0.3f}, "Armenteros qT"}; ConfigurableAxis axisK0Mass{"axisK0Mass", {200, 0.4f, 0.6f}, "Mass K0Short"}; ConfigurableAxis axisLambdaMass{"axisLambdaMass", {200, 1.101f, 1.131f}, "Mass Lambda"}; - ConfigurableAxis axisGammaMass{"axisGammaMass", {200, 0.0f, 0.5f}, "Mass Gamma"}; + ConfigurableAxis axisGammaMass{"axisGammaMass", {150, 0.0f, 0.15f}, "Mass Gamma"}; ConfigurableAxis axisNsigmaTPC{"axisNsigmaTPC", {200, -10.0f, 10.0f}, "N sigma TPC"}; ConfigurableAxis axisdEdx{"axisdEdx", {140, 20.0, 160.0}, "dEdx binning"}; Configurable nBinsNch{"nBinsNch", 400, "N bins Nch (|eta|<0.8)"}; @@ -205,6 +215,7 @@ struct PiKpRAA { Configurable pathMeanNch{"pathMeanNch", "Users/o/omvazque/MeanNch/OO/Pass2/PerTimeStamp/Aug20", "base path to the ccdb object"}; Configurable pathSigmaNch{"pathSigmaNch", "Users/o/omvazque/SigmaNch/OO/Pass2/PerTimeStamp/Aug20", "base path to the ccdb object"}; Configurable pathEtaCal{"pathEtaCal", "Users/o/omvazque/EtaCal/OO/Global", "base path to the ccdb object"}; + Configurable pathEtaCalPlateau{"pathEtaCalPlateau", "Users/o/omvazque/EtaCal/OO/Global", "base path to the ccdb object"}; Configurable pathPhiCutHigh{"pathPhiCutHigh", "Users/o/omvazque/PhiCut/OO/Global/High", "base path to the ccdb object"}; Configurable pathPhiCutLow{"pathPhiCutLow", "Users/o/omvazque/PhiCut/OO/Global/Low", "base path to the ccdb object"}; Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; @@ -250,6 +261,7 @@ struct PiKpRAA { struct ConfigEtaCalib { TProfile* pEtaCal = nullptr; + TProfile* pEtaCalPlateau = nullptr; bool isCalLoaded = false; } etaCal; @@ -336,20 +348,25 @@ struct PiKpRAA { registry.add("NclFindable", ";;Findable Ncl TPC", kTH2F, {axisPtNcl, axisNcl}); registry.add("NclFindablep", ";;Findable #LTNcl#GT TPC", kTProfile, {axisPtNcl}); - registry.add("NclFoundVsPhipBeforeCut", Form("Found #LTNcl#GT TPC;%s (GeV/#it{c});#varphi", titlePorPt.data()), kTProfile2D, {{{axisXPhiCut}, {350, 0.0, 0.35}}}); - registry.add("NclFoundVsPhipAfterCut", Form("Found #LTNcl#GT TPC;%s (GeV/#it{c});#varphi", titlePorPt.data()), kTProfile2D, {{{axisXPhiCut}, {350, 0.0, 0.35}}}); + registry.add("NclVsPhipBeforeCut", Form("Found #LTNcl#GT TPC;%s (GeV/#it{c});#varphi", titlePorPt.data()), kTProfile2D, {{{axisXPhiCut}, {350, 0.0, 0.35}}}); + registry.add("NclVsPhipBeforeCutPID", Form("#LTNcl#GT used for PID;%s (GeV/#it{c});#varphi", titlePorPt.data()), kTProfile2D, {{{axisXPhiCut}, {350, 0.0, 0.35}}}); + registry.add("NclVsPhipAfterCut", Form("Found #LTNcl#GT TPC;%s (GeV/#it{c});#varphi", titlePorPt.data()), kTProfile2D, {{{axisXPhiCut}, {350, 0.0, 0.35}}}); + registry.add("NclVsPhipAfterCutPID", Form("#LTNcl#GT used for PID;%s (GeV/#it{c});#varphi", titlePorPt.data()), kTProfile2D, {{{axisXPhiCut}, {350, 0.0, 0.35}}}); registry.add("NclVsEta", ";#eta;Found Ncl TPC", kTH2F, {{{axisEta}, {161, -0.5, 160.5}}}); + registry.add("NclVsEtaPID", ";#eta;Ncl used for PID", kTH2F, {{{axisEta}, {161, -0.5, 160.5}}}); registry.add("NclVsEtap", ";#eta;Found #LTNcl#GT TPC", kTProfile, {axisEta}); - - registry.add("NclVsEtaPiMIP", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c}, 40 < dE/dx < 60);#eta; Found Ncl TPC", kTH2F, {{{axisEta}, {161, -0.5, 160.5}}}); - registry.add("NclVsEtaPiMIPp", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c}, 40 < dE/dx < 60);#eta; Found #LTNcl#GT TPC", kTProfile, {axisEta}); - registry.add("NclVsEtaPiV0", ";#eta; Found Ncl TPC", kTH2F, {axisEta, axisNcl}); - registry.add("NclVsEtaPiV0p", ";#eta; Found #LTNcl#GT TPC", kTProfile, {axisEta}); - registry.add("NclVsEtaPrV0", ";#eta; Found Ncl TPC", kTH2F, {axisEta, axisNcl}); - registry.add("NclVsEtaPrV0p", ";#eta; Found #LTNcl#GT TPC", kTProfile, {axisEta}); - registry.add("NclVsEtaElV0", ";#eta; Found Ncl TPC", kTH2F, {axisEta, axisNcl}); - registry.add("NclVsEtaElV0p", ";#eta; Found #LTNcl#GT TPC", kTProfile, {axisEta}); - + registry.add("NclVsEtaPIDp", ";#eta;#LTNcl#GT used for PID", kTProfile, {axisEta}); + + registry.add("NclVsEtaPiMIP", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c}, 40 < dE/dx < 60);#eta;Ncl TPC", kTH2F, {{{axisEta}, {161, -0.5, 160.5}}}); + registry.add("NclVsEtaPiMIPp", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c}, 40 < dE/dx < 60);#eta;#LTNcl#GT TPC", kTProfile, {axisEta}); + registry.add("NclVsEtaPiV0", ";#eta;Ncl TPC", kTH2F, {axisEta, axisNcl}); + registry.add("NclVsEtaPiV0p", ";#eta;#LTNcl#GT TPC", kTProfile, {axisEta}); + registry.add("NclVsEtaPrV0", ";#eta;Ncl TPC", kTH2F, {axisEta, axisNcl}); + registry.add("NclVsEtaPrV0p", ";#eta;#LTNcl#GT TPC", kTProfile, {axisEta}); + registry.add("NclVsEtaElV0", ";#eta;Ncl TPC", kTH2F, {axisEta, axisNcl}); + registry.add("NclVsEtaElV0p", ";#eta;#LTNcl#GT TPC", kTProfile, {axisEta}); + + registry.add("EtaVsPhi", ";#eta;#varphi;", kTH2F, {{axisEta}, {100, 0, o2::constants::math::TwoPI}}); registry.add("EtaVsYK0s", ";#eta;#it{y};", kTH2F, {axisEta, axisY}); registry.add("EtaVsYPiL", ";#eta;#it{y};", kTH2F, {axisEta, axisY}); registry.add("EtaVsYPrL", ";#eta;#it{y};", kTH2F, {axisEta, axisY}); @@ -357,8 +374,8 @@ struct PiKpRAA { registry.add("EtaVsYPrAL", ";#eta;#it{y};", kTH2F, {axisEta, axisY}); registry.add("EtaVsYG", ";#eta;#it{y};", kTH2F, {axisEta, axisY}); - registry.add("TOFExpPi2TOF", ";Momentum (GeV/#it{c});t^{e}_{Exp}/t_{TOF}", kTH2F, {{{axisPtV0s}, {100, 0.2, 1.2}}}); - registry.add("TOFExpEl2TOF", ";Momentum (GeV/#it{c});t^{#pi}_{Exp}/t_{TOF}", kTH2F, {{{axisPtV0s}, {100, 0.2, 1.2}}}); + registry.add("TOFExpPi2TOF", ";Momentum (GeV/#it{c});t^{#pi}_{Exp}/t_{TOF}", kTH2F, {{{axisPtV0s}, {100, 0.2, 1.2}}}); + registry.add("TOFExpEl2TOF", ";Momentum (GeV/#it{c});t^{e}_{Exp}/t_{TOF}", kTH2F, {{{axisPtV0s}, {100, 0.2, 1.2}}}); registry.add("betaVsMomentum", ";Momentum (GeV/#it{c}); #beta", kTH2F, {{{axisPtV0s}, {500, 0, 1.2}}}); registry.add("dEdxVsEtaPiMIP", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; dE/dx;", kTH2F, {{{axisEta}, {100, 0, 100}}}); @@ -377,14 +394,20 @@ struct PiKpRAA { dEdxPrV0[i] = registry.add(Form("dEdxPrV0_%s", endingEta[i]), Form("p + #bar{p}, %s;Momentum (GeV/#it{c});dE/dx;", latexEta[i]), kTH3F, {axisPtV0s, axisdEdx, axisCent}); dEdxElV0[i] = registry.add(Form("dEdxElV0_%s", endingEta[i]), Form("e^{+} + e^{-}, %s;Momentum (GeV/#it{c});dE/dx;", latexEta[i]), kTH3F, {axisPtV0s, axisdEdx, axisCent}); dEdxPiTOF[i] = registry.add(Form("dEdxPiTOF_%s", endingEta[i]), Form("#pi^{+} + #pi^{-}, %s;Momentum (GeV/#it{c});dE/dx;", latexEta[i]), kTH3F, {axisPtV0s, axisdEdx, axisCent}); - nClVsP[i] = registry.add(Form("NclFound_%s", endingEta[i]), Form("%s;;Found Ncl TPC", latexEta[i]), kTH2F, {axisPtNcl, axisNcl}); - nClVsPElV0[i] = registry.add(Form("NclFoundElV0_%s", endingEta[i]), Form("%s;;Found Ncl TPC", latexEta[i]), kTH2F, {axisPtNcl, axisNcl}); - nClVsPPiV0[i] = registry.add(Form("NclFoundPiV0_%s", endingEta[i]), Form("%s;;Found Ncl TPC", latexEta[i]), kTH2F, {axisPtNcl, axisNcl}); - nClVsPPrV0[i] = registry.add(Form("NclFoundPrV0_%s", endingEta[i]), Form("%s;;Found Ncl TPC", latexEta[i]), kTH2F, {axisPtNcl, axisNcl}); - nClVsPp[i] = registry.add(Form("NclFoundp_%s", endingEta[i]), Form("%s;;Found #LT#it{N}_{cl}#GT TPC", latexEta[i]), kTProfile, {axisPtNcl}); - nClVsPpElV0[i] = registry.add(Form("NclFoundpElV0_%s", endingEta[i]), Form("%s;;Found #LT#it{N}_{cl}#GT TPC", latexEta[i]), kTProfile, {axisPtNcl}); - nClVsPpPiV0[i] = registry.add(Form("NclFoundpPiV0_%s", endingEta[i]), Form("%s;;Found #LT#it{N}_{cl}#GT TPC", latexEta[i]), kTProfile, {axisPtNcl}); - nClVsPpPrV0[i] = registry.add(Form("NclFoundpPrV0_%s", endingEta[i]), Form("%s;;Found #LT#it{N}_{cl}#GT TPC", latexEta[i]), kTProfile, {axisPtNcl}); + nClVsdEdxPiV0[i] = registry.add(Form("NclVsdEdxPiV0_%s", endingEta[i]), Form("%s;#it{N}_{cl} used for PID;dE/dx;", latexEta[i]), kTH2F, {axisNcl, axisdEdx}); + nClVsdEdxElV0[i] = registry.add(Form("NclVsdEdxElV0_%s", endingEta[i]), Form("%s;#it{N}_{cl} used for PID;dE/dx;", latexEta[i]), kTH2F, {axisNcl, axisdEdx}); + nClVsdEdxPrV0[i] = registry.add(Form("NclVsdEdxPrV0_%s", endingEta[i]), Form("%s;#it{N}_{cl} used for PID;dE/dx;", latexEta[i]), kTH2F, {axisNcl, axisdEdx}); + nClVsP[i] = registry.add(Form("NclVsPPrimaries_%s", endingEta[i]), Form("%s;;Ncl TPC", latexEta[i]), kTH2F, {axisPtNcl, axisNcl}); + nClVsPElV0[i] = registry.add(Form("NclVsPElV0_%s", endingEta[i]), Form("%s;;Ncl TPC", latexEta[i]), kTH2F, {axisPtNcl, axisNcl}); + nClVsPPiV0[i] = registry.add(Form("NclVsPPiV0_%s", endingEta[i]), Form("%s;;Ncl TPC", latexEta[i]), kTH2F, {axisPtNcl, axisNcl}); + nClVsPPrV0[i] = registry.add(Form("NclVsPPrV0_%s", endingEta[i]), Form("%s;;Ncl TPC", latexEta[i]), kTH2F, {axisPtNcl, axisNcl}); + nClVsPp[i] = registry.add(Form("NclVsPrimariesp_%s", endingEta[i]), Form("%s;;#LT#it{N}_{cl}#GT TPC", latexEta[i]), kTProfile, {axisPtNcl}); + nClVsPpElV0[i] = registry.add(Form("NclVsPElV0p_%s", endingEta[i]), Form("%s;;#LT#it{N}_{cl}#GT TPC", latexEta[i]), kTProfile, {axisPtNcl}); + nClVsPpPiV0[i] = registry.add(Form("NclVsPPiV0p_%s", endingEta[i]), Form("%s;;#LT#it{N}_{cl}#GT TPC", latexEta[i]), kTProfile, {axisPtNcl}); + nClVsPpPrV0[i] = registry.add(Form("NclVsPPrV0p_%s", endingEta[i]), Form("%s;;#LT#it{N}_{cl}#GT TPC", latexEta[i]), kTProfile, {axisPtNcl}); + nClVsdEdxpElV0[i] = registry.add(Form("NclVsdEdxElV0p_%s", endingEta[i]), Form("%s;;#LTd#it{E}/d#it{x}#GT", latexEta[i]), kTProfile, {axisNcl}); + nClVsdEdxpPiV0[i] = registry.add(Form("NclVsdEdxPiV0p_%s", endingEta[i]), Form("%s;;#LTd#it{E}/d#it{x}#GT", latexEta[i]), kTProfile, {axisNcl}); + nClVsdEdxpPrV0[i] = registry.add(Form("NclVsdEdxPrV0p_%s", endingEta[i]), Form("%s;;#LTd#it{E}/d#it{x}#GT", latexEta[i]), kTProfile, {axisNcl}); } } @@ -394,6 +417,7 @@ struct PiKpRAA { LOG(info) << "\tv0TypeSelection=" << static_cast(v0Selections.v0TypeSelection); LOG(info) << "\tminPt=" << v0Selections.minPt; LOG(info) << "\tmaxPt=" << v0Selections.maxPt; + LOG(info) << "\tuseNclsPID=" << v0Selections.useNclsPID; LOG(info) << "\tqTSel=" << v0Selections.qTSel; LOG(info) << "\tarmAlphaSel=" << v0Selections.armAlphaSel; LOG(info) << "\tapplyTPCTOFCombinedCut=" << v0Selections.applyTPCTOFCombinedCut; @@ -413,24 +437,25 @@ struct PiKpRAA { if (applyNchSel.value) { LOG(info) << "\tLoading Nch-based selections!"; - LOG(info) << "\t pathMeanNch=" << pathMeanNch.value; - LOG(info) << "\t pathSigmaNch=" << pathSigmaNch.value; + LOG(info) << "\tpathMeanNch=" << pathMeanNch.value; + LOG(info) << "\tpathSigmaNch=" << pathSigmaNch.value; } if (v0Selections.applyPhiCut) { LOG(info) << "\tLoading Phi cut!"; - LOG(info) << "\t pathPhiCutLow=" << pathPhiCutLow.value; - LOG(info) << "\t pathPhiCutHigh=" << pathPhiCutHigh.value; + LOG(info) << "\tpathPhiCutLow=" << pathPhiCutLow.value; + LOG(info) << "\tpathPhiCutHigh=" << pathPhiCutHigh.value; } if (v0Selections.applyEtaCal) { LOG(info) << "\tLoading Eta Cal!"; - LOG(info) << "\t pathEtaCal=" << pathEtaCal.value; + LOG(info) << "\tpathEtaCal=" << pathEtaCal.value; + LOG(info) << "\tpathEtaCalPlateau=" << pathEtaCalPlateau.value; loadEtaCalibration(); } if (v0Selections.applyNclSel) - LOG(info) << "\t minNclFound=" << v0Selections.minNclFound; + LOG(info) << "\t minNcl=" << v0Selections.minNcl; } void processCalibrationAndV0s(ColEvSels::iterator const& collision, BCsRun3 const& /**/, aod::V0Datas const& v0s, aod::FV0As const& /**/, aod::FT0s const& /**/, TracksFull const& tracks) @@ -532,13 +557,16 @@ struct PiKpRAA { const int charge{track.sign()}; const float pOrPt{v0Selections.usePinPhiSelection ? momentum : pt}; const int16_t nclFound{track.tpcNClsFound()}; + const int16_t nclPID{track.tpcNClsPID()}; - if (v0Selections.applyNclSel && nclFound < v0Selections.minNclFound) + const int16_t ncl = v0Selections.useNclsPID ? nclPID : nclFound; + if (v0Selections.applyNclSel && ncl < v0Selections.minNcl) continue; float phiPrime{phi}; phiPrimeFunc(phiPrime, magField, charge); - registry.fill(HIST("NclFoundVsPhipBeforeCut"), pOrPt, phiPrime, track.tpcNClsFound()); + registry.fill(HIST("NclVsPhipBeforeCut"), pOrPt, phiPrime, nclFound); + registry.fill(HIST("NclVsPhipBeforeCutPID"), pOrPt, phiPrime, nclPID); if (v0Selections.applyPhiCut) { if (!passesPhiSelection(pOrPt, phiPrime)) @@ -567,41 +595,52 @@ struct PiKpRAA { if (momentum > kMinPMIP && momentum < kMaxPMIP && dedx > kMindEdxMIP && dedx < kMaxdEdxMIP) { registry.fill(HIST("dEdxVsEtaPiMIP"), eta, dedx); registry.fill(HIST("dEdxVsEtaPiMIPp"), eta, dedx); - registry.fill(HIST("NclVsEtaPiMIP"), eta, track.tpcNClsFound()); - registry.fill(HIST("NclVsEtaPiMIPp"), eta, track.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPiMIP"), eta, ncl); + registry.fill(HIST("NclVsEtaPiMIPp"), eta, ncl); } if (momentum > kMinPElMIP && momentum < kMaxPElMIP && dedx > kMindEdxMIPPlateau && dedx < kMaxdEdxMIPPlateau) { - registry.fill(HIST("dEdxVsEtaElMIP"), eta, dedx); - registry.fill(HIST("dEdxVsEtaElMIPp"), eta, dedx); + if (track.hasTOF() && track.goodTOFMatch()) { + const float tTOF{track.tofSignal()}; + const float trkLength{track.length()}; + const float tExpElTOF{track.tofExpSignalEl(tTOF)}; + + if (trkLength > kZero && tTOF > kZero) { + if (std::abs((tExpElTOF / tTOF) - kOne) < v0Selections.maxExpTOFEl) { + registry.fill(HIST("dEdxVsEtaElMIP"), eta, dedx); + registry.fill(HIST("dEdxVsEtaElMIPp"), eta, dedx); + } + } + } } dEdx[indexEta]->Fill(momentum, dedx, centrality); pTVsP[indexEta]->Fill(momentum, pt); - nClVsP[indexEta]->Fill(pOrPt, track.tpcNClsFound()); - nClVsPp[indexEta]->Fill(pOrPt, track.tpcNClsFound()); + nClVsP[indexEta]->Fill(pOrPt, ncl); + nClVsPp[indexEta]->Fill(pOrPt, ncl); registry.fill(HIST("dcaVsPt"), pt, track.dcaXY()); - registry.fill(HIST("NclVsEta"), eta, track.tpcNClsFound()); - registry.fill(HIST("NclVsEtap"), eta, track.tpcNClsFound()); - // registry.fill(HIST("NclFoundp"), pOrPt, track.tpcNClsFound()); + registry.fill(HIST("EtaVsPhi"), eta, track.phi()); + registry.fill(HIST("NclVsEta"), eta, nclFound); + registry.fill(HIST("NclVsEtap"), eta, nclFound); + registry.fill(HIST("NclVsEtaPID"), eta, nclPID); + registry.fill(HIST("NclVsEtaPIDp"), eta, nclPID); registry.fill(HIST("NclFindable"), pOrPt, track.tpcNClsFindable()); registry.fill(HIST("NclFindablep"), pOrPt, track.tpcNClsFindable()); - registry.fill(HIST("NclFoundVsPhipAfterCut"), pOrPt, phiPrime, track.tpcNClsFound()); + registry.fill(HIST("NclVsPhipAfterCut"), pOrPt, phiPrime, nclFound); + registry.fill(HIST("NclVsPhipAfterCutPID"), pOrPt, phiPrime, nclPID); if (track.hasTOF() && track.goodTOFMatch()) { const float tTOF{track.tofSignal()}; const float trkLength{track.length()}; const float tExpPiTOF{track.tofExpSignalPi(tTOF)}; const float tExpElTOF{track.tofExpSignalEl(tTOF)}; - // const float dTOFPi{tTOF - tExpPiTOF - colTime}; - // const float dTOFEl{tTOF - tExpElTOF - colTime}; if (trkLength > kZero && tTOF > kZero) { registry.fill(HIST("betaVsMomentum"), momentum, track.beta()); registry.fill(HIST("TOFExpPi2TOF"), momentum, tExpPiTOF / tTOF); registry.fill(HIST("TOFExpEl2TOF"), momentum, tExpElTOF / tTOF); - if (std::abs((tExpPiTOF / tTOF) - kOne) < v0Selections.maxPiTOFBeta) { + if (std::abs((tExpPiTOF / tTOF) - kOne) < v0Selections.maxExpTOFPi) { dEdxPiTOF[indexEta]->Fill(momentum, dedx, centrality); } } @@ -631,6 +670,11 @@ struct PiKpRAA { float negTrackPhiPrime{negTrack.phi()}; const int16_t posNclFound{posTrack.tpcNClsFound()}; const int16_t negNclFound{negTrack.tpcNClsFound()}; + const int16_t posNclPID{posTrack.tpcNClsPID()}; + const int16_t negNclPID{negTrack.tpcNClsPID()}; + const int16_t posNcl = v0Selections.useNclsPID ? posNclPID : posNclFound; + const int16_t negNcl = v0Selections.useNclsPID ? negNclPID : negNclFound; + phiPrimeFunc(posTrackPhiPrime, magField, posTrackCharge); phiPrimeFunc(negTrackPhiPrime, magField, negTrackCharge); const float posPorPt{v0Selections.usePinPhiSelection ? posTrkP : posTrkPt}; @@ -650,7 +694,7 @@ struct PiKpRAA { if (!(passesTrackSelectionDaughters(posTrack) && passesTrackSelectionDaughters(negTrack))) continue; - if (v0Selections.applyNclSel && (posNclFound < v0Selections.minNclFound || negNclFound < v0Selections.minNclFound)) + if (v0Selections.applyNclSel && !(posNcl >= v0Selections.minNcl && negNcl >= v0Selections.minNcl)) continue; if (v0Selections.applyEtaCal) { @@ -723,14 +767,18 @@ struct PiKpRAA { registry.fill(HIST("MassK0sVsPt"), v0.pt(), v0.mK0Short()); registry.fill(HIST("nSigPiFromK0s"), posTrkPt, posTrack.tpcNSigmaPi()); registry.fill(HIST("nSigPiFromK0s"), negTrkPt, negTrack.tpcNSigmaPi()); - registry.fill(HIST("NclVsEtaPiV0"), posTrkEta, posTrack.tpcNClsFound()); - registry.fill(HIST("NclVsEtaPiV0p"), posTrkEta, posTrack.tpcNClsFound()); - registry.fill(HIST("NclVsEtaPiV0"), negTrkEta, negTrack.tpcNClsFound()); - registry.fill(HIST("NclVsEtaPiV0p"), negTrkEta, negTrack.tpcNClsFound()); - nClVsPPiV0[posIndexEta]->Fill(posPorPt, posTrack.tpcNClsFound()); - nClVsPpPiV0[posIndexEta]->Fill(posPorPt, posTrack.tpcNClsFound()); - nClVsPPiV0[negIndexEta]->Fill(negPorPt, negTrack.tpcNClsFound()); - nClVsPpPiV0[negIndexEta]->Fill(negPorPt, negTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPiV0"), posTrkEta, posNcl); + registry.fill(HIST("NclVsEtaPiV0p"), posTrkEta, posNcl); + registry.fill(HIST("NclVsEtaPiV0"), negTrkEta, negNcl); + registry.fill(HIST("NclVsEtaPiV0p"), negTrkEta, negNcl); + nClVsPPiV0[posIndexEta]->Fill(posPorPt, posNcl); + nClVsPpPiV0[posIndexEta]->Fill(posPorPt, posNcl); + nClVsPPiV0[negIndexEta]->Fill(negPorPt, negNcl); + nClVsdEdxPiV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + nClVsdEdxpPiV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + nClVsdEdxPiV0[posIndexEta]->Fill(posNcl, posTrkdEdx); + nClVsdEdxpPiV0[posIndexEta]->Fill(posNcl, posTrkdEdx); + nClVsPpPiV0[negIndexEta]->Fill(negPorPt, negNcl); dEdxPiV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); dEdxPiV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); @@ -755,14 +803,18 @@ struct PiKpRAA { registry.fill(HIST("MassLVsPt"), v0.pt(), v0.mLambda()); registry.fill(HIST("nSigPrFromL"), posTrkPt, posTrack.tpcNSigmaPr()); registry.fill(HIST("nSigPiFromL"), negTrkPt, negTrack.tpcNSigmaPi()); - registry.fill(HIST("NclVsEtaPrV0"), posTrkEta, posTrack.tpcNClsFound()); - registry.fill(HIST("NclVsEtaPrV0p"), posTrkEta, posTrack.tpcNClsFound()); - registry.fill(HIST("NclVsEtaPiV0"), negTrkEta, negTrack.tpcNClsFound()); - registry.fill(HIST("NclVsEtaPiV0p"), negTrkEta, negTrack.tpcNClsFound()); - nClVsPPrV0[posIndexEta]->Fill(posPorPt, posTrack.tpcNClsFound()); - nClVsPpPrV0[posIndexEta]->Fill(posPorPt, posTrack.tpcNClsFound()); - nClVsPPiV0[negIndexEta]->Fill(negPorPt, negTrack.tpcNClsFound()); - nClVsPpPiV0[negIndexEta]->Fill(negPorPt, negTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPrV0"), posTrkEta, posNcl); + registry.fill(HIST("NclVsEtaPrV0p"), posTrkEta, posNcl); + registry.fill(HIST("NclVsEtaPiV0"), negTrkEta, negNcl); + registry.fill(HIST("NclVsEtaPiV0p"), negTrkEta, negNcl); + nClVsPPrV0[posIndexEta]->Fill(posPorPt, posNcl); + nClVsPpPrV0[posIndexEta]->Fill(posPorPt, posNcl); + nClVsPPiV0[negIndexEta]->Fill(negPorPt, negNcl); + nClVsPpPiV0[negIndexEta]->Fill(negPorPt, negNcl); + nClVsdEdxPiV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + nClVsdEdxpPiV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + nClVsdEdxPrV0[posIndexEta]->Fill(posNcl, posTrkdEdx); + nClVsdEdxpPrV0[posIndexEta]->Fill(posNcl, posTrkdEdx); dEdxPrV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); dEdxPiV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); } @@ -776,42 +828,58 @@ struct PiKpRAA { registry.fill(HIST("MassALVsPt"), v0.pt(), v0.mAntiLambda()); registry.fill(HIST("nSigPrFromAL"), negTrkPt, negTrack.tpcNSigmaPr()); registry.fill(HIST("nSigPiFromAL"), posTrkPt, posTrack.tpcNSigmaPi()); - registry.fill(HIST("NclVsEtaPiV0"), posTrkEta, posTrack.tpcNClsFound()); - registry.fill(HIST("NclVsEtaPiV0p"), posTrkEta, posTrack.tpcNClsFound()); - registry.fill(HIST("NclVsEtaPrV0"), negTrkEta, negTrack.tpcNClsFound()); - registry.fill(HIST("NclVsEtaPrV0p"), negTrkEta, negTrack.tpcNClsFound()); - nClVsPPrV0[negIndexEta]->Fill(negPorPt, negTrack.tpcNClsFound()); - nClVsPpPrV0[negIndexEta]->Fill(negPorPt, negTrack.tpcNClsFound()); - nClVsPPiV0[posIndexEta]->Fill(posPorPt, posTrack.tpcNClsFound()); - nClVsPpPiV0[posIndexEta]->Fill(posPorPt, posTrack.tpcNClsFound()); + registry.fill(HIST("NclVsEtaPiV0"), posTrkEta, posNcl); + registry.fill(HIST("NclVsEtaPiV0p"), posTrkEta, posNcl); + registry.fill(HIST("NclVsEtaPrV0"), negTrkEta, negNcl); + registry.fill(HIST("NclVsEtaPrV0p"), negTrkEta, negNcl); + nClVsPPrV0[negIndexEta]->Fill(negPorPt, negNcl); + nClVsPpPrV0[negIndexEta]->Fill(negPorPt, negNcl); + nClVsPPiV0[posIndexEta]->Fill(posPorPt, posNcl); + nClVsPpPiV0[posIndexEta]->Fill(posPorPt, posNcl); + nClVsdEdxPrV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + nClVsdEdxpPrV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + nClVsdEdxPiV0[posIndexEta]->Fill(posNcl, posTrkdEdx); + nClVsdEdxpPiV0[posIndexEta]->Fill(posNcl, posTrkdEdx); dEdxPrV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); dEdxPiV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); } } } - if (v0Selections.applyInvMassSel && dMassK0s > v0Selections.dMassSel && dMassL > v0Selections.dMassSel && dMassAL > v0Selections.dMassSel && dMassG < v0Selections.dMassGcut) { + if (v0Selections.applyInvMassSel && dMassK0s > v0Selections.dMassSel && dMassL > v0Selections.dMassSel && dMassAL > v0Selections.dMassSel && dMassG < v0Selections.dMassSel) { if (passesGammaSelection(collision, v0)) { if (std::abs(alpha) < v0Selections.armAlphaSel && qT < v0Selections.qTSel) { - registry.fill(HIST("V0sCounter"), V0sCounter::Gamma); - registry.fill(HIST("ArmG"), alpha, qT); - registry.fill(HIST("MassGVsPt"), v0.pt(), v0.mGamma()); - registry.fill(HIST("nSigElFromG"), negTrkPt, negTrack.tpcNSigmaEl()); - registry.fill(HIST("nSigElFromG"), posTrkPt, posTrack.tpcNSigmaEl()); - registry.fill(HIST("NclVsEtaElV0"), posTrkEta, posTrack.tpcNClsFound()); - registry.fill(HIST("NclVsEtaElV0p"), posTrkEta, posTrack.tpcNClsFound()); - registry.fill(HIST("NclVsEtaElV0"), negTrkEta, negTrack.tpcNClsFound()); - registry.fill(HIST("NclVsEtaElV0p"), negTrkEta, negTrack.tpcNClsFound()); - nClVsPElV0[negIndexEta]->Fill(negPorPt, negTrack.tpcNClsFound()); - nClVsPpElV0[negIndexEta]->Fill(negPorPt, negTrack.tpcNClsFound()); - nClVsPElV0[posIndexEta]->Fill(posPorPt, posTrack.tpcNClsFound()); - nClVsPpElV0[posIndexEta]->Fill(posPorPt, posTrack.tpcNClsFound()); - registry.fill(HIST("dEdxVsEtaElMIPV0"), posTrkEta, posTrkdEdx); - registry.fill(HIST("dEdxVsEtaElMIPV0p"), posTrkEta, posTrkdEdx); - registry.fill(HIST("dEdxVsEtaElMIPV0"), negTrkEta, negTrkdEdx); - registry.fill(HIST("dEdxVsEtaElMIPV0p"), negTrkEta, negTrkdEdx); - dEdxElV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); - dEdxElV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); + const double posDedxCal{etaCal.pEtaCalPlateau->GetBinContent(etaCal.pEtaCalPlateau->FindBin(posTrkEta))}; + const double negDedxCal{etaCal.pEtaCalPlateau->GetBinContent(etaCal.pEtaCalPlateau->FindBin(negTrkEta))}; + if (std::abs(posTrkdEdx - posDedxCal) < v0Selections.dEdxPlateauSel && std::abs(negTrkdEdx - negDedxCal) < v0Selections.dEdxPlateauSel) { + registry.fill(HIST("V0sCounter"), V0sCounter::Gamma); + registry.fill(HIST("ArmG"), alpha, qT); + registry.fill(HIST("MassGVsPt"), v0.pt(), v0.mGamma()); + registry.fill(HIST("nSigElFromG"), negTrkPt, negTrack.tpcNSigmaEl()); + registry.fill(HIST("nSigElFromG"), posTrkPt, posTrack.tpcNSigmaEl()); + registry.fill(HIST("NclVsEtaElV0"), posTrkEta, posNcl); + registry.fill(HIST("NclVsEtaElV0p"), posTrkEta, posNcl); + registry.fill(HIST("NclVsEtaElV0"), negTrkEta, negNcl); + registry.fill(HIST("NclVsEtaElV0p"), negTrkEta, negNcl); + nClVsPElV0[negIndexEta]->Fill(negPorPt, negNcl); + nClVsPpElV0[negIndexEta]->Fill(negPorPt, negNcl); + nClVsPElV0[posIndexEta]->Fill(posPorPt, posNcl); + nClVsPpElV0[posIndexEta]->Fill(posPorPt, posNcl); + nClVsdEdxElV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + nClVsdEdxpElV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + nClVsdEdxElV0[posIndexEta]->Fill(posNcl, posTrkdEdx); + nClVsdEdxpElV0[posIndexEta]->Fill(posNcl, posTrkdEdx); + if (posTrkP > kMinPMIP && posTrkP < kMaxPMIP) { + registry.fill(HIST("dEdxVsEtaElMIPV0"), posTrkEta, posTrkdEdx); + registry.fill(HIST("dEdxVsEtaElMIPV0p"), posTrkEta, posTrkdEdx); + } + if (negTrkP > kMinPMIP && negTrkP < kMaxPMIP) { + registry.fill(HIST("dEdxVsEtaElMIPV0"), negTrkEta, negTrkdEdx); + registry.fill(HIST("dEdxVsEtaElMIPV0p"), negTrkEta, negTrkdEdx); + } + dEdxElV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); + dEdxElV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); + } } } } @@ -870,7 +938,14 @@ struct PiKpRAA { bool passesTrackSelectionDaughters(const T& track) { - bool isSelected = trkSelDaugthers.IsSelected(track) ? true : false; + const float eta{track.eta()}; + const int16_t nCrossedRows{track.tpcNClsCrossedRows()}; + + bool isSelected{false}; + if (v0Selections.selElecFromGammas) + isSelected = std::abs(eta) < v0Selections.maxEtaDaughter && nCrossedRows >= v0Selections.minNCrossedRows ? true : false; + if (!v0Selections.selElecFromGammas) + isSelected = trkSelDaugthers.IsSelected(track) ? true : false; return isSelected; } @@ -1188,12 +1263,15 @@ struct PiKpRAA { { if (pathEtaCal.value.empty() == false) { etaCal.pEtaCal = ccdb->getForTimeStamp(pathEtaCal, ccdbNoLaterThan.value); - if (etaCal.pEtaCal == nullptr) { + etaCal.pEtaCalPlateau = ccdb->getForTimeStamp(pathEtaCalPlateau, ccdbNoLaterThan.value); + if (etaCal.pEtaCal == nullptr) LOGF(fatal, "Could not load pEtaCal from %s", pathEtaCal.value.c_str()); - } + + if (etaCal.pEtaCalPlateau == nullptr) + LOGF(fatal, "Could not load pEtaCalPlateau from %s", pathEtaCalPlateau.value.c_str()); } - if (etaCal.pEtaCal) + if (etaCal.pEtaCal && etaCal.pEtaCalPlateau) etaCal.isCalLoaded = true; } }; From 35cb78a5a335382d757a5dab0703175f38add3b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Fri, 12 Sep 2025 09:50:48 +0200 Subject: [PATCH 368/986] [DPG] Add new histograms for track contributions and chi2 (#12930) --- DPG/Tasks/AOTTrack/qaEventTrack.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/DPG/Tasks/AOTTrack/qaEventTrack.cxx b/DPG/Tasks/AOTTrack/qaEventTrack.cxx index 09590267ed8..144e41af1a0 100644 --- a/DPG/Tasks/AOTTrack/qaEventTrack.cxx +++ b/DPG/Tasks/AOTTrack/qaEventTrack.cxx @@ -245,9 +245,12 @@ struct qaEventTrack { histos.add("Events/nContrib", "", kTH1D, {axisVertexNumContrib}); histos.add("Events/nContribVsFilteredMult", "", kTH2D, {axisVertexNumContrib, axisTrackMultiplicity}); histos.add("Events/nContribVsMult", "", kTH2D, {axisVertexNumContrib, axisTrackMultiplicity}); + histos.add("Events/nContribVsAtLeastITSMult", "", kTH2D, {axisVertexNumContrib, axisTrackMultiplicity}); histos.add("Events/nContribWithTOFvsWithTRD", ";PV contrib. with TOF; PV contrib. with TRD;", kTH2D, {axisVertexNumContrib, axisVertexNumContrib}); histos.add("Events/nContribAllvsWithTRD", ";PV contrib. all; PV contrib. with TRD;", kTH2D, {axisVertexNumContrib, axisVertexNumContrib}); histos.add("Events/vertexChi2", ";#chi^{2}", kTH1D, {{100, 0, 100}}); + histos.add("Events/vertexChi2OvernContrib", ";#chi^{2} / n contrib.", kTH1D, {{100, 0, 100}}); + histos.add("Events/vertexChi2VsnContrib", ";#chi^{2};n contrib.", kTH2D, {{100, 0, 100}, axisVertexNumContrib}); histos.add("Events/covXX", ";Cov_{xx} [cm^{2}]", kTH1D, {axisVertexCov}); histos.add("Events/covXY", ";Cov_{xy} [cm^{2}]", kTH1D, {axisVertexCov}); @@ -1286,11 +1289,15 @@ void qaEventTrack::fillRecoHistogramsGroupedTracks(const C& collision, const T& } int nFilteredTracks = 0; + int atLeastITSTracks = 0; for (const auto& track : tracks) { if (checkOnlyPVContributor && !track.isPVContributor()) { continue; } histos.fill(HIST("Tracks/selection"), 1.f); + if (track.hasITS()) { + atLeastITSTracks++; + } if (!isSelectedTrack(track)) { continue; } @@ -1437,7 +1444,10 @@ void qaEventTrack::fillRecoHistogramsGroupedTracks(const C& collision, const T& histos.fill(HIST("Events/nContrib"), collision.numContrib()); histos.fill(HIST("Events/nContribVsFilteredMult"), collision.numContrib(), nFilteredTracks); histos.fill(HIST("Events/nContribVsMult"), collision.numContrib(), tracksUnfiltered.size()); + histos.fill(HIST("Events/nContribVsAtLeastITSMult"), collision.numContrib(), atLeastITSTracks); histos.fill(HIST("Events/vertexChi2"), collision.chi2()); + histos.fill(HIST("Events/vertexChi2OvernContrib"), collision.chi2() / collision.numContrib()); + histos.fill(HIST("Events/vertexChi2VsnContrib"), collision.chi2(), collision.numContrib()); histos.fill(HIST("Events/covXX"), collision.covXX()); histos.fill(HIST("Events/covXY"), collision.covXY()); From c05477b235b021c5fbdd66f3a2034ea9c3d03271 Mon Sep 17 00:00:00 2001 From: a-m-andrushko <96832230+a-m-andrushko@users.noreply.github.com> Date: Fri, 12 Sep 2025 13:44:16 +0200 Subject: [PATCH 369/986] [PWGCF] FemtoUniverse -- Fix MCTruth for helicity analysis. (#12969) --- .../TableProducer/femtoUniverseProducerTask.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx index 23d14062fee..4b6c0fef8e0 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx @@ -898,6 +898,12 @@ struct FemtoUniverseProducerTask { outputPartsMC(particleOrigin, pdgCode, mcparticle.pt(), mcparticle.eta(), mcparticle.phi()); fillDebugParticleMC(mcparticle); outputPartsMCLabels(outputPartsMC.lastIndex()); + + // Artificial fill of a debug table -- solves conflicts between FDParticles and FDExtParticles tables + outputDebugParts(-111., -111., -111., -111., -111., -111., -111., -111., -111., + -111., -111., -111., -111., -111., -111., -111., -111., + -111., -111., -111., -111., -111., + -111., -111., -111., -111., -111., -111.); } template From e750600e49d22b25269b2516cf165513710de863 Mon Sep 17 00:00:00 2001 From: HANSEO PARK <53218370+hanseopark@users.noreply.github.com> Date: Fri, 12 Sep 2025 21:03:29 +0900 Subject: [PATCH 370/986] [PWGJE] Small incorrect code for histogram name and name of table (#12925) --- PWGJE/Tasks/jetTaggerHFQA.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PWGJE/Tasks/jetTaggerHFQA.cxx b/PWGJE/Tasks/jetTaggerHFQA.cxx index 1cba0c2cad8..555f59896df 100644 --- a/PWGJE/Tasks/jetTaggerHFQA.cxx +++ b/PWGJE/Tasks/jetTaggerHFQA.cxx @@ -168,7 +168,7 @@ struct JetTaggerHFQA { } } if (doprocessTracksInJetsData) { - registry.add("h3_track_pt_impact_parameter_xy", "", {HistType::kTH3F, {{axisJetPt}, {axisTrackPt}, {axisImpactParameterXY}}}); + registry.add("h2_track_pt_impact_parameter_xy", "", {HistType::kTH2F, {{axisTrackPt}, {axisImpactParameterXY}}}); } if (doprocessSecondaryContaminationMCD) { registry.add("hn_jet_pt_track_pt_impact_parameter_xy_physical_primary_flavour", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisTrackPt}, {axisImpactParameterXY}, {axisJetFlavour}}}); @@ -1113,7 +1113,7 @@ struct JetTaggerHFQA { } PROCESS_SWITCH(JetTaggerHFQA, processTracksDca, "Fill inclusive tracks' imformation for data", false); - void processTracksInJetsData(soa::Filtered::iterator const& collision, soa::Join const& jets) + void processTracksInJetsData(soa::Filtered::iterator const& collision, soa::Join const& jets, JetTagTracksData const& /*tracks*/) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -1125,7 +1125,7 @@ struct JetTaggerHFQA { if (!isAcceptedJet(jet)) { continue; } - for (auto const& track : jet.template tracks_as()) { + for (auto const& track : jet.template tracks_as()) { float varImpXY = track.dcaXY() * jettaggingutilities::cmTomum; registry.fill(HIST("h2_track_pt_impact_parameter_xy"), track.pt(), varImpXY); } From c6f333ebed01dc432141cf42dad69c9d7931e117 Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Fri, 12 Sep 2025 14:34:30 +0200 Subject: [PATCH 371/986] [PWGLF] Add new process function for doublephi and modify charge pairing for f1p correlation (#12957) --- PWGLF/Tasks/Resonances/doublephimeson.cxx | 228 +++++++++++++++++- .../Tasks/Resonances/f1protoncorrelation.cxx | 20 +- 2 files changed, 229 insertions(+), 19 deletions(-) diff --git a/PWGLF/Tasks/Resonances/doublephimeson.cxx b/PWGLF/Tasks/Resonances/doublephimeson.cxx index 0c8f9c2c780..4e6b9918155 100644 --- a/PWGLF/Tasks/Resonances/doublephimeson.cxx +++ b/PWGLF/Tasks/Resonances/doublephimeson.cxx @@ -13,27 +13,32 @@ /// \author sourav kundu /// \since 02/11/2023 +#include "PWGLF/DataModel/ReducedDoublePhiTables.h" + +#include "Common/Core/trackUtilities.h" + +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" #include -#include + #include -#include #include +#include +#include #include +#include + #include + #include #include #include #include -#include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/StepTHn.h" -#include "Common/Core/trackUtilities.h" -#include "PWGLF/DataModel/ReducedDoublePhiTables.h" -#include "CommonConstants/PhysicsConstants.h" - using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -631,6 +636,207 @@ struct doublephimeson { } PROCESS_SWITCH(doublephimeson, processopti, "Process Optimized same event", false); + void processopti2(aod::RedPhiEvents::iterator const& collision, aod::PhiTracks const& phitracks) + { + if (additionalEvsel && (collision.numPos() < 2 || collision.numNeg() < 2)) { + return; + } + + // === Helpers === + // PDG phi mass (centralized constant, easy to vary for systematics) + constexpr double mPhiPDG = 1.019461; // GeV/c^2 + + // ΔR with proper Δφ wrapping (−π, π] + const auto deltaR = [](double phi1, double eta1, double phi2, double eta2) { + const double dphi = TVector2::Phi_mpi_pi(phi1 - phi2); + const double deta = eta1 - eta2; + return std::sqrt(dphi * dphi + deta * deta); + }; + + // Combined mass offset from PDG (tie-breaker metric) + const auto deltam = [=](double m1, double m2) { + return std::sqrt((m1 - mPhiPDG) * (m1 - mPhiPDG) + (m2 - mPhiPDG) * (m2 - mPhiPDG)); + }; + + // Anti-merging/duplication veto: + // Require same-sign kaons from the two φ's to be separated in (η,φ). + // This protects against split/merged tracks and near-duplicate topologies. + const auto passDaughterDR = [&](const ROOT::Math::PtEtaPhiMVector& kplusA, + const ROOT::Math::PtEtaPhiMVector& kplusB, + const ROOT::Math::PtEtaPhiMVector& kminusA, + const ROOT::Math::PtEtaPhiMVector& kminusB) { + const double dRkplus = deltaR(kplusA.Phi(), kplusA.Eta(), kplusB.Phi(), kplusB.Eta()); + const double dRkminus = deltaR(kminusA.Phi(), kminusA.Eta(), kminusB.Phi(), kminusB.Eta()); + return (dRkplus > daughterDeltaR) && (dRkminus > daughterDeltaR); + // If later needed, make pT-aware: + // const double thr = std::max(0.01, daughterDeltaR - 0.002 * std::min(10.0, exoticPt)); + // return (dRkplus > thr) && (dRkminus > thr); + }; + + // === Phi multiplicity (uses PID1 for d1, PID2 for d2) === + int phimult = 0; + for (auto const& t : phitracks) { + if (t.phiMass() < minPhiMass1 || t.phiMass() > maxPhiMass1) + continue; + const double kpluspt = std::hypot(t.phid1Px(), t.phid1Py()); + const double kminuspt = std::hypot(t.phid2Px(), t.phid2Py()); + if (kpluspt > maxKaonPt) + continue; + if (kminuspt > maxKaonPt) + continue; + if (!selectionPID(t.phid1TPC(), t.phid1TOF(), t.phid1TOFHit(), strategyPID1, kpluspt)) + continue; // d1 → PID1 + if (!selectionPID(t.phid2TPC(), t.phid2TOF(), t.phid2TOFHit(), strategyPID2, kminuspt)) + continue; // d2 → PID2 + ++phimult; + } + + // === Collect candidates first === + std::vector exoticres, phi1v, phi2v, kplus1, kplus2, kminus1, kminus2; + std::vector d1id, d2id, d3id, d4id; + + const auto n = phitracks.size(); + exoticres.reserve(n); + phi1v.reserve(n); + phi2v.reserve(n); + kplus1.reserve(n); + kplus2.reserve(n); + kminus1.reserve(n); + kminus2.reserve(n); + d1id.reserve(n); + d2id.reserve(n); + d3id.reserve(n); + d4id.reserve(n); + + for (auto const& t1 : phitracks) { + // Per-φ selection for the first φ + const double kplus1pt = std::hypot(t1.phid1Px(), t1.phid1Py()); + const double kminus1pt = std::hypot(t1.phid2Px(), t1.phid2Py()); + if (kplus1pt > maxKaonPt) + continue; + if (kminus1pt > maxKaonPt) + continue; + if (!selectionPID(t1.phid1TPC(), t1.phid1TOF(), t1.phid1TOFHit(), strategyPID1, kplus1pt)) + continue; + if (!selectionPID(t1.phid2TPC(), t1.phid2TOF(), t1.phid2TOFHit(), strategyPID2, kminus1pt)) + continue; + + // Set vectors BEFORE QA fills + Phid1.SetXYZM(t1.phiPx(), t1.phiPy(), t1.phiPz(), t1.phiMass()); + Phi1kaonplus.SetXYZM(t1.phid1Px(), t1.phid1Py(), t1.phid1Pz(), 0.493); + Phi1kaonminus.SetXYZM(t1.phid2Px(), t1.phid2Py(), t1.phid2Pz(), 0.493); + + // PID QA + histos.fill(HIST("hnsigmaTPCTOFKaon"), t1.phid1TPC(), t1.phid1TOF(), kplus1pt); + histos.fill(HIST("hnsigmaTPCKaonPlus"), t1.phid1TPC(), kplus1pt); + histos.fill(HIST("hnsigmaTPCKaonMinus"), t1.phid2TPC(), kminus1pt); + histos.fill(HIST("hPhiMass"), Phid1.M(), Phid1.Pt()); + + const auto id1 = t1.index(); + + for (auto const& t2 : phitracks) { + const auto id2 = t2.index(); + if (id2 <= id1) + continue; // unique unordered pairs + + // Per-φ selection for the second φ + const double kplus2pt = std::hypot(t2.phid1Px(), t2.phid1Py()); + const double kminus2pt = std::hypot(t2.phid2Px(), t2.phid2Py()); + if (kplus2pt > maxKaonPt) + continue; + if (kminus2pt > maxKaonPt) + continue; + if (!selectionPID(t2.phid1TPC(), t2.phid1TOF(), t2.phid1TOFHit(), strategyPID1, kplus2pt)) + continue; + if (!selectionPID(t2.phid2TPC(), t2.phid2TOF(), t2.phid2TOFHit(), strategyPID2, kminus2pt)) + continue; + + // Disallow shared same-sign daughters between the two φ's + if ((t1.phid1Index() == t2.phid1Index()) || (t1.phid2Index() == t2.phid2Index())) + continue; + + Phid2.SetXYZM(t2.phiPx(), t2.phiPy(), t2.phiPz(), t2.phiMass()); + Phi2kaonplus.SetXYZM(t2.phid1Px(), t2.phid1Py(), t2.phid1Pz(), 0.493); + Phi2kaonminus.SetXYZM(t2.phid2Px(), t2.phid2Py(), t2.phid2Pz(), 0.493); + + // Mass windows + if (t1.phiMass() < minPhiMass1 || t1.phiMass() > maxPhiMass1) + continue; + if (t2.phiMass() < minPhiMass2 || t2.phiMass() > maxPhiMass2) + continue; + + exotic = Phid1 + Phid2; + if (exotic.M() < minExoticMass || exotic.M() > maxExoticMass) + continue; + + // Store candidate and bookkeeping + exoticres.emplace_back(exotic.Pt(), exotic.Eta(), exotic.Phi(), exotic.M()); + phi1v.emplace_back(Phid1.Pt(), Phid1.Eta(), Phid1.Phi(), Phid1.M()); + phi2v.emplace_back(Phid2.Pt(), Phid2.Eta(), Phid2.Phi(), Phid2.M()); + + kplus1.emplace_back(Phi1kaonplus.Pt(), Phi1kaonplus.Eta(), Phi1kaonplus.Phi(), 0.493); + kminus1.emplace_back(Phi1kaonminus.Pt(), Phi1kaonminus.Eta(), Phi1kaonminus.Phi(), 0.493); + kplus2.emplace_back(Phi2kaonplus.Pt(), Phi2kaonplus.Eta(), Phi2kaonplus.Phi(), 0.493); + kminus2.emplace_back(Phi2kaonminus.Pt(), Phi2kaonminus.Eta(), Phi2kaonminus.Phi(), 0.493); + + d1id.push_back(t1.phid1Index()); + d2id.push_back(t2.phid1Index()); + d3id.push_back(t1.phid2Index()); + d4id.push_back(t2.phid2Index()); + } + } + + if (exoticres.empty()) + return; + + // === Special handling if exactly two candidates were built === + if (exoticres.size() == 2) { + const int i0 = 0, i1 = 1; + + const bool sameFour = + ((d1id[i0] == d1id[i1] || d1id[i0] == d2id[i1]) && + (d2id[i0] == d1id[i1] || d2id[i0] == d2id[i1]) && + (d3id[i0] == d3id[i1] || d3id[i0] == d4id[i1]) && + (d4id[i0] == d3id[i1] || d4id[i0] == d4id[i1])); + + const double deltam0 = deltam(phi1v[i0].M(), phi2v[i0].M()); + const double deltam1 = deltam(phi1v[i1].M(), phi2v[i1].M()); + const bool dr0 = passDaughterDR(kplus1[i0], kplus2[i0], kminus1[i0], kminus2[i0]); + const bool dr1 = passDaughterDR(kplus1[i1], kplus2[i1], kminus1[i1], kminus2[i1]); + + if (sameFour) { + // Choose the candidate closer to mφ (if it passes ΔR) + int keep = (deltam1 < deltam0 && dr1) ? i1 : (dr0 ? i0 : -1); + if (keep >= 0) { + const double dR = deltaR(phi1v[keep].Phi(), phi1v[keep].Eta(), phi2v[keep].Phi(), phi2v[keep].Eta()); + const double dm = (keep == i0) ? deltam0 : deltam1; + histos.fill(HIST("SEMassUnlike"), exoticres[keep].M(), exoticres[keep].Pt(), dR, dm, phimult); + } + } else { + // Independent candidates → fill both (respect ΔR) + if (dr0) { + const double dR0 = deltaR(phi1v[i0].Phi(), phi1v[i0].Eta(), phi2v[i0].Phi(), phi2v[i0].Eta()); + histos.fill(HIST("SEMassUnlike"), exoticres[i0].M(), exoticres[i0].Pt(), dR0, deltam0, phimult); + } + if (dr1) { + const double dR1 = deltaR(phi1v[i1].Phi(), phi1v[i1].Eta(), phi2v[i1].Phi(), phi2v[i1].Eta()); + histos.fill(HIST("SEMassUnlike"), exoticres[i1].M(), exoticres[i1].Pt(), dR1, deltam1, phimult); + } + } + return; + } + + // === General case: fill each candidate once (respect ΔR) === + for (size_t i = 0; i < exoticres.size(); ++i) { + if (!passDaughterDR(kplus1[i], kplus2[i], kminus1[i], kminus2[i])) + continue; + const double dR = deltaR(phi1v[i].Phi(), phi1v[i].Eta(), phi2v[i].Phi(), phi2v[i].Eta()); + const double dm = deltam(phi1v[i].M(), phi2v[i].M()); + histos.fill(HIST("SEMassUnlike"), exoticres[i].M(), exoticres[i].Pt(), dR, dm, phimult); + } + } + PROCESS_SWITCH(doublephimeson, processopti2, "Process Optimized same event", false); + SliceCache cache; using BinningTypeVertexContributor = ColumnBinningPolicy; void processMixedEvent(aod::RedPhiEvents& collisions, aod::PhiTracks& phitracks) diff --git a/PWGLF/Tasks/Resonances/f1protoncorrelation.cxx b/PWGLF/Tasks/Resonances/f1protoncorrelation.cxx index 02395a2b1fe..177f4b6a5dd 100644 --- a/PWGLF/Tasks/Resonances/f1protoncorrelation.cxx +++ b/PWGLF/Tasks/Resonances/f1protoncorrelation.cxx @@ -303,13 +303,15 @@ struct f1protoncorrelation { if (f1track.f1SignalStat() > 0) { // check charge + float pairCharge = f1track.f1SignalStat() * protontrack.protonCharge(); int f1Charge = f1track.f1SignalStat(); + int pionCharge = -1; + int kaonCharge = 1; if (f1Charge == 2) { - f1Charge = -1; + pionCharge = 1; + kaonCharge = -1; } - int pionCharge = -1.0 * f1Charge; - float pairCharge = f1Charge * protontrack.protonCharge(); - histos.fill(HIST("hPhaseSpaceProtonKaonSame"), Proton.Eta() - Kaon.Eta(), PhiAtSpecificRadiiTPC(Proton, Kaon, protontrack.protonCharge(), f1Charge, bz, bz)); // Phase Space Proton kaon + histos.fill(HIST("hPhaseSpaceProtonKaonSame"), Proton.Eta() - Kaon.Eta(), PhiAtSpecificRadiiTPC(Proton, Kaon, protontrack.protonCharge(), kaonCharge, bz, bz)); // Phase Space Proton kaon histos.fill(HIST("hPhaseSpaceProtonPionSame"), Proton.Eta() - Kaon.Eta(), PhiAtSpecificRadiiTPC(Proton, Pion, protontrack.protonCharge(), pionCharge, bz, bz)); // Phase Space Proton Pion histos.fill(HIST("h2SameEventInvariantMassUnlike_mass"), relative_momentum, F1.Pt(), F1.M(), pairCharge); // F1 sign = 1 unlike, F1 sign = -1 like if (fillSparse) { @@ -533,14 +535,16 @@ struct f1protoncorrelation { } auto relative_momentum = getkstar(F1, Proton); if (t1.f1SignalStat() > 0) { + float pairCharge = t1.f1SignalStat() * t2.protonCharge(); int f1Charge = t1.f1SignalStat(); + int pionCharge = -1; + int kaonCharge = 1; if (f1Charge == 2) { - f1Charge = -1; + pionCharge = 1; + kaonCharge = -1; } - int pionCharge = -1.0 * f1Charge; - float pairCharge = f1Charge * t2.protonCharge(); histos.fill(HIST("h2MixEventInvariantMassUnlike_mass"), relative_momentum, F1.Pt(), F1.M(), pairCharge); // F1 sign = 1 unlike, F1 sign = -1 like - histos.fill(HIST("hPhaseSpaceProtonKaonMix"), Proton.Eta() - Kaon.Eta(), PhiAtSpecificRadiiTPC(Proton, Kaon, t2.protonCharge(), f1Charge, bz, bz2)); // Phase Space Proton kaon + histos.fill(HIST("hPhaseSpaceProtonKaonMix"), Proton.Eta() - Kaon.Eta(), PhiAtSpecificRadiiTPC(Proton, Kaon, t2.protonCharge(), kaonCharge, bz, bz2)); // Phase Space Proton kaon histos.fill(HIST("hPhaseSpaceProtonPionMix"), Proton.Eta() - Kaon.Eta(), PhiAtSpecificRadiiTPC(Proton, Pion, t2.protonCharge(), pionCharge, bz, bz2)); // Phase Space Proton Pion if (fillSparse) { histos.fill(HIST("MEMassUnlike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC, pairCharge); From ef83bb685e090b0cba8c09e75677507b211ac00d Mon Sep 17 00:00:00 2001 From: Gyula Bencedi Date: Fri, 12 Sep 2025 15:14:59 +0200 Subject: [PATCH 372/986] [PWGLF] Updated V0s selection (#12952) --- .../GlobalEventProperties/flattenictyPikp.cxx | 682 +++++++++++------- 1 file changed, 426 insertions(+), 256 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx b/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx index 101898b826d..21784752a8e 100644 --- a/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx @@ -68,6 +68,9 @@ using namespace o2::framework; using namespace o2::constants::math; auto static constexpr kMinCharge = 3.f; +static constexpr float kNull = 0.0f; +static constexpr float kOne = 1.0f; + // FV0 specific constants static constexpr int kMaxRingsFV0 = 5; static constexpr int kNCellsFV0 = 48; @@ -117,7 +120,19 @@ enum V0sSel { kaLam = 3 }; -enum TrkSelNoFilt { +enum FillType { + kBefore, + kAfter +}; + +enum ChargeType { + kAll, + kPos, + kNeg +}; + +enum TrkSel { + trkSelAll, trkSelEta, trkSelPt, trkSelDCA, @@ -127,6 +142,20 @@ enum TrkSelNoFilt { nTrkSel }; +enum V0Sel { + v0SelAll, + v0SelEta, + v0SelDaughters, + v0SelTPCnClsFound, + v0SelRejectV0sAtTPCSector, + v0SelRejectSameSign, + v0SelDCAv0daughter, + v0SelCosPA, + v0SelV0radius, + v0SelDCAposToPV, + nV0Sel +}; + enum EvtSel { evtSelAll, evtSelSel8, @@ -141,17 +170,6 @@ enum EvtSel { nEvtSel }; -enum FillType { - kBefore, - kAfter -}; - -enum ChargeType { - kAll, - kPos, - kNeg -}; - struct MultE { static constexpr int kNoMult = 0; static constexpr int kMultFT0M = 1; @@ -190,7 +208,9 @@ struct FlattenictyPikp { std::vector fv0AmplCorr{}; TProfile2D* zVtxMap = nullptr; + float magField; int runNumber{-1}; + o2::parameters::GRPMagField* grpmag = nullptr; Configurable multEst{"multEst", 1, "0: without multiplicity; 1: MultFT0M; 2: MultTPC"}; Configurable applyCalibGain{"applyCalibGain", false, "equalize detector amplitudes"}; @@ -228,6 +248,7 @@ struct FlattenictyPikp { struct : ConfigurableGroup { ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.1, 0.12, 0.14, 0.16, 0.18, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 18.0, 20.0}, "pT binning"}; + ConfigurableAxis axisPtV0s{"axisPtV0s", {VARIABLE_WIDTH, 0, 0.15, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.2, 1.4, 1.6, 1.8, 2, 2.5, 3.0, 3.5, 4, 5, 7, 9, 12, 15, 20}, "pT V0s binning"}; ConfigurableAxis axisFlatPerc{"axisFlatPerc", {102, -0.01, 1.01}, "Flattenicity percentiles binning"}; ConfigurableAxis axisMultPerc{"axisMultPerc", {20, 0, 100}, "Multiplicity percentiles binning"}; ConfigurableAxis axisVertexZ{"axisVertexZ", {80, -20., 20.}, "Vertex z binning"}; @@ -236,11 +257,12 @@ struct FlattenictyPikp { ConfigurableAxis axisDCAz{"axisDCAz", {200, -5, 5}, "DCAz binning"}; ConfigurableAxis axisPhi = {"axisPhi", {60, 0, constants::math::TwoPI}, "#varphi binning"}; ConfigurableAxis axisPhiMod = {"axisPhiMod", {100, 0, constants::math::PI / 9}, "fmod(#varphi,#pi/9)"}; - ConfigurableAxis axisEta = {"axisEta", {8, -0.8, 0.8}, "#eta binning"}; + ConfigurableAxis axisEta = {"axisEta", {50, -1.0, 1.0}, "#eta binning"}; + ConfigurableAxis axisRapidity = {"axisRapidity", {50, -1.0, 1.0}, "#it{y} binning"}; ConfigurableAxis axisDedx{"axisDedx", {100, 0, 100}, "dE/dx binning"}; ConfigurableAxis axisNsigmaTPC{"axisNsigmaTPC", {200, -10, 10}, "nsigmaTPC binning"}; ConfigurableAxis axisNsigmaTOF{"axisNsigmaTOF", {200, -10, 10}, "nsigmaTOF binning"}; - ConfigurableAxis axisAmplFV0{"axsAmplFV0", {4096, 0, 4096}, "FV0 amplitude (ADC) binning"}; + ConfigurableAxis axisAmplFV0{"axisAmplFV0", {4096, 0, 4096}, "FV0 amplitude (ADC) binning"}; ConfigurableAxis axisAmplFV0Sum{"axisAmplFV0Sum", {4096, 0, 4096 * 49}, "FV0 amplitude sum (ADC) binning"}; ConfigurableAxis axisChannelFV0{"axisChannelFV0", {49, 0., 49.}, "FV0 channel ID binning"}; } binOpt; @@ -252,7 +274,8 @@ struct FlattenictyPikp { Configurable cfgNclTPCMin{"cfgNclTPCMin", 100.0f, "Minimum of number of TPC clusters"}; Configurable cfgPhiCutPtMin{"cfgPhiCutPtMin", 2.0f, "Minimum pT for phi cut"}; Configurable cfgTOFBetaPion{"cfgTOFBetaPion", 1.0f, "Minimum beta for TOF pions"}; - Configurable cfgUseExtraTrkCut{"cfgUseExtraTrkCut", true, "Use extra track cut"}; + Configurable cfgTofBetaPiMax{"cfgTofBetaPiMax", 5E-5, "Maximum beta for TOF pion selection"}; + Configurable cfgRejectTrkAtTPCSector{"cfgRejectTrkAtTPCSector", true, "Reject tracks close to the TPC sector boundaries"}; Configurable cfgGeoTrkCutMin{"cfgGeoTrkCutMin", "0.06/x+pi/18.0-0.06", "ROOT TF1 formula for minimum phi cut in TPC"}; Configurable cfgGeoTrkCutMax{"cfgGeoTrkCutMax", "0.1/x+pi/18.0+0.06", "ROOT TF1 formula for maximum phi cut in TPC"}; Configurable cfgMomMIPMax{"cfgMomMIPMax", 0.6f, "Maximum momentum of MIP pions"}; @@ -260,30 +283,54 @@ struct FlattenictyPikp { Configurable cfgDeDxMIPMax{"cfgDeDxMIPMax", 60.0f, "Maximum range of MIP dedx"}; Configurable cfgDeDxMIPMin{"cfgDeDxMIPMin", 40.0f, "Maximum range of MIP dedx"}; Configurable cfgNsigmaMax{"cfgNsigmaMax", 100.0f, "Maximum range of nsgima for tracks"}; - Configurable cfgMomSelPiTOF{"cfgMomSelPiTOF", 0.7f, "Momentum cut for TOF pions"}; + Configurable cfgMomSelPiTOF{"cfgMomSelPiTOF", 0.4f, "Minimum momentum cut for TOF pions"}; Configurable cfgNsigSelKaTOF{"cfgNsigSelKaTOF", 3.0f, "Nsigma cut for TOF kaons"}; Configurable cfgBetaPlateuMax{"cfgBetaPlateuMax", 0.1f, "Beta max for Plateau electrons"}; } trkSelOpt; struct : ConfigurableGroup { - Configurable cfgDCAv0daughter{"cfgDCAv0daughter", 0.3, "DCA of V0 daughter tracks"}; - Configurable cfgV0etamax{"cfgV0etamax", 0.9f, "max eta of V0s"}; - Configurable cfgV0DaughterTpcMomMax{"cfgV0DaughterTpcMomMax", 0.6f, "Maximum momentum of V0 daughter tracks in TPC"}; - Configurable cfgTPCnClsmin{"cfgTPCnClsmin", 50.0f, "cfgTPCnClsmin"}; - Configurable cfgDCAposToPV{"cfgDCAposToPV", 0.05f, "cfgDCAposToPV"}; - Configurable cfgv0cospa{"cfgv0cospa", 0.998, "V0 CosPA"}; - Configurable cfgv0Rmin{"cfgv0Rmin", 0.0, "cfgv0Rmin"}; - Configurable cfgv0Rmax{"cfgv0Rmax", 90.0, "cfgv0Rmax"}; - Configurable cfgdmassG{"cfgdmassG", 0.1, "max mass for photon"}; - Configurable cfgdmassK{"cfgdmassK", 0.1, "max mass for K0s"}; - Configurable cfgdmassL{"cfgdmassL", 0.1, "max mass for Lambda"}; - Configurable cfgdmassAL{"cfgdmassAL", 0.1, "max mass for anti Lambda"}; + // common selection + Configurable cfgV0TypeSel{"cfgV0TypeSel", 1, "select on a certain V0 type (leave negative if no selection desired)"}; + Configurable cfgV0Ymax{"cfgV0Ymax", 0.5f, "Maximum rapidity of V0s"}; + Configurable cfgRejectV0sAtTPCSector{"cfgRejectV0sAtTPCSector", true, "Reject V0s close to the TPC sector boundaries"}; Configurable cfgNsigmaElTPC{"cfgNsigmaElTPC", 5.0, "max nsigma of TPC for electorn"}; Configurable cfgNsigmaPiTPC{"cfgNsigmaPiTPC", 5.0, "max nsigma of TPC for pion"}; Configurable cfgNsigmaPrTPC{"cfgNsigmaPrTPC", 5.0, "max nsigma of TPC for proton"}; Configurable cfgNsigmaElTOF{"cfgNsigmaElTOF", 3.0, "max nsigma of TOF for electorn"}; Configurable cfgNsigmaPiTOF{"cfgNsigmaPiTOF", 3.0, "max nsigma of TOF for pion"}; Configurable cfgNsigmaPrTOF{"cfgNsigmaPrTOF", 3.0, "max nsigma of TOF for proton"}; + ConfigurableAxis axisArmPodAlpha{"axisArmPodAlpha", {200, -1.0, 1.0}, "Armenteros-Podolanski alpha"}; + ConfigurableAxis axisArmPodqT{"axisArmPodqT", {600, 0.0f, 0.3f}, "Armenteros-Podolanski qT"}; + //!! >>>>>>>> + // Configurable cfgV0DaughterTpcMomMax{"cfgV0DaughterTpcMomMax", 0.6f, "Maximum momentum of V0 daughter tracks in TPC"}; + //!! >>>>>>>> + // standad parameters for V0 selection + Configurable cfgV0etamax{"cfgV0etamax", 0.8f, "max eta of V0s"}; + Configurable cfgTPCnClsmin{"cfgTPCnClsmin", 70.0f, "cfgTPCnClsmin"}; + Configurable cfgDCAv0daughter{"cfgDCAv0daughter", 1.0, "max DCA of V0 daughter tracks (cm)"}; + Configurable cfgv0cospa{"cfgv0cospa", 0.995, "min V0 CosPA"}; + Configurable cfgDCAposToPV{"cfgDCAposToPV", 0.05f, "min DCA Pos To PV (cm)"}; + Configurable cfgDCAnegToPV{"cfgDCAnegToPV", 0.05f, "min DCA Neg To PV (cm)"}; + Configurable cfgv0Rmin{"cfgv0Rmin", 1.2, "min V0 radius (cm)"}; + Configurable cfgv0Rmax{"cfgv0Rmax", 1E5, "max V0 radius (cm)"}; + // parameters for selection KOs + Configurable cfgcTauK0s{"cfgcTauK0s", 20, "v0ctau for K0s"}; + Configurable cfgCosPAK0s{"cfgCosPAK0s", 0.995, "V0 CosPA for K0s"}; + Configurable cfgV0radiusK0s{"cfgV0radiusK0s", 0.5, "v0radius for K0s"}; + Configurable cfgdmassK{"cfgdmassK", 0.005, "Competing Mass Rejection cut for K0s"}; + Configurable cfgArmPodK0s{"cfgArmPodK0s", 5.0f, "pT * (cut) > |alpha|, Armenteros-Podolanski cut for K0s"}; + ConfigurableAxis axisK0sMass{"axisK0sMass", {200, 0.4f, 0.6f}, "K0Short mass binning"}; + // parameters for selection Lambda / antiLambda + Configurable cfgcTauLambda{"cfgcTauLambda", 30, "v0ctau for Lambda"}; + Configurable cfgCosPALambda{"cfgCosPALambda", 0.995, "V0 CosPA for Lambda"}; + Configurable cfgV0radiusLambda{"cfgV0radiusLambda", 0.5, "v0radius for Lambda"}; + Configurable cfgdmassL{"cfgdmassL", 0.01f, "Competing Mass Rejection cut for Lambda"}; + ConfigurableAxis axisLambdaMass{"axisLambdaMass", {200, 1.101f, 1.131f}, "Lambda mass binning"}; + // parameters for selection Gamma + Configurable cfgdmassG{"cfgdmassG", 0.1f, "max mass for Gammas"}; + Configurable cfgArmPodGammasalpha{"cfgArmPodGammasalpha", 0.45f, "Armenteros-Podolanski alpha cut for Gammas"}; + Configurable cfgArmPodGammasqT{"cfgArmPodGammasqT", 0.01f, "Armenteros-Podolanski qT cut for Gammas"}; + ConfigurableAxis axisGammaMass{"axisGammaMass", {200, 0.0f, 0.5f}, "Gamma mass binning"}; } v0SelOpt; Service ccdb; @@ -294,11 +341,11 @@ struct FlattenictyPikp { Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; } ccdbConf; - TrackSelection mTrackSelector; - Configurable isCustomTracks{"isCustomTracks", false, "Use custom track cuts"}; + TrackSelection selTrkGlobal; + Configurable isCustomTracks{"isCustomTracks", true, "Use custom track cuts"}; Configurable requirePt{"requirePt", 0.15f, "Set minimum pT of tracks"}; Configurable requireEta{"requireEta", 0.8f, "Set eta range of tracks"}; - Configurable setITSreq{"setITSreq", 1, "0 = Run3ITSibAny, 1 = Run3ITSallAny, 2 = Run3ITSall7Layers, 3 = Run3ITSibTwo"}; + Configurable setITSreq{"setITSreq", 2, "0 = Run3ITSibAny, 1 = Run3ITSallAny, 2 = Run3ITSall7Layers, 3 = Run3ITSibTwo"}; Configurable requireITS{"requireITS", true, "Additional cut on the ITS requirement"}; Configurable requireTPC{"requireTPC", true, "Additional cut on the TPC requirement"}; Configurable requireGoldenChi2{"requireGoldenChi2", true, "Additional cut on the GoldenChi2"}; @@ -311,6 +358,17 @@ struct FlattenictyPikp { Configurable maxDcaZ{"maxDcaZ", 2.f, "Additional cut on the maximum value of the DCA z"}; Configurable minTPCNClsFound{"minTPCNClsFound", 70.0f, "Additional cut on the minimum value of the number of found clusters in the TPC"}; + TrackSelection selTrkV0sDaughters; + TrackSelection selV0sDaugthers() + { + TrackSelection selTracks; + selTracks.SetEtaRange(-0.8f, 0.8f); + selTracks.SetMinNCrossedRowsTPC(minNCrossedRowsTPC.value); + selTracks.SetMaxChi2PerClusterTPC(maxChi2PerClusterTPC.value); + selTracks.SetMinNCrossedRowsOverFindableClustersTPC(minNCrossedRowsOverFindableClustersTPC.value); + return selTracks; + } + TF1* fPhiCutLow = nullptr; TF1* fPhiCutHigh = nullptr; @@ -342,23 +400,25 @@ struct FlattenictyPikp { ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); ccdb->setFatalWhenNull(false); + selTrkV0sDaughters = selV0sDaugthers(); + if (isCustomTracks.value) { - mTrackSelector = getGlobalTrackSelectionRun3ITSMatch(setITSreq.value); - mTrackSelector.SetPtRange(requirePt.value, 1e10f); - mTrackSelector.SetEtaRange(-requireEta.value, requireEta.value); - mTrackSelector.SetRequireITSRefit(requireITS.value); - mTrackSelector.SetRequireTPCRefit(requireTPC.value); - mTrackSelector.SetRequireGoldenChi2(requireGoldenChi2.value); - mTrackSelector.SetMaxChi2PerClusterTPC(maxChi2PerClusterTPC.value); - mTrackSelector.SetMaxChi2PerClusterITS(maxChi2PerClusterITS.value); - mTrackSelector.SetMinNClustersITS(minITSnClusters.value); - mTrackSelector.SetMinNCrossedRowsTPC(minNCrossedRowsTPC.value); - mTrackSelector.SetMinNClustersTPC(minTPCNClsFound.value); - mTrackSelector.SetMinNCrossedRowsOverFindableClustersTPC(minNCrossedRowsOverFindableClustersTPC.value); - // // mTrackSelector.SetMaxDcaXYPtDep([](float pt) { return 0.0105f + 0.0350f / pow(pt, 1.1f); }); - mTrackSelector.SetMaxDcaXYPtDep([](float /*pt*/) { return 10000.f; }); - mTrackSelector.SetMaxDcaZ(maxDcaZ.value); - mTrackSelector.print(); + selTrkGlobal = getGlobalTrackSelectionRun3ITSMatch(setITSreq.value); + selTrkGlobal.SetPtRange(requirePt.value, 1e10f); + selTrkGlobal.SetEtaRange(-requireEta.value, requireEta.value); + selTrkGlobal.SetRequireITSRefit(requireITS.value); + selTrkGlobal.SetRequireTPCRefit(requireTPC.value); + selTrkGlobal.SetRequireGoldenChi2(requireGoldenChi2.value); + selTrkGlobal.SetMaxChi2PerClusterTPC(maxChi2PerClusterTPC.value); + selTrkGlobal.SetMaxChi2PerClusterITS(maxChi2PerClusterITS.value); + selTrkGlobal.SetMinNClustersITS(minITSnClusters.value); + selTrkGlobal.SetMinNCrossedRowsTPC(minNCrossedRowsTPC.value); + selTrkGlobal.SetMinNClustersTPC(minTPCNClsFound.value); + selTrkGlobal.SetMinNCrossedRowsOverFindableClustersTPC(minNCrossedRowsOverFindableClustersTPC.value); + // // selTrkGlobal.SetMaxDcaXYPtDep([](float pt) { return 0.0105f + 0.0350f / pow(pt, 1.1f); }); + selTrkGlobal.SetMaxDcaXYPtDep([](float /*pt*/) { return 10000.f; }); + selTrkGlobal.SetMaxDcaZ(maxDcaZ.value); + selTrkGlobal.print(); } const AxisSpec chargeAxis{2, -2.f, 2.f, "Charge"}; @@ -366,10 +426,12 @@ struct FlattenictyPikp { const AxisSpec vtxzAxis{binOpt.axisVertexZ, "Z_{vtx} (cm)"}; const AxisSpec flatAxis{binOpt.axisFlatPerc, "Flat FV0"}; const AxisSpec etaAxis{binOpt.axisEta, "#eta"}; + const AxisSpec rapidityAxis{binOpt.axisRapidity, "#it{y}"}; const AxisSpec phiAxis{binOpt.axisPhi, "#varphi"}; const AxisSpec phiAxisMod{binOpt.axisPhiMod, "fmod(#varphi,#pi/9)"}; const AxisSpec pAxis{binOpt.axisPt, "#it{p} (GeV/#it{c})"}; const AxisSpec ptAxis{binOpt.axisPt, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec ptAxisV0s{binOpt.axisPtV0s, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec dcaXYAxis{binOpt.axisDCAxy, "DCA_{xy} (cm)"}; const AxisSpec dcaZAxis{binOpt.axisDCAz, "DCA_{z} (cm)"}; const AxisSpec shCluserAxis{200, 0, 1, "Fraction of shared TPC clusters"}; @@ -396,7 +458,7 @@ struct FlattenictyPikp { } // Event counter - flatchrg.add("Events/hEvtSel", "Number of events; Cut; #Events Passed Cut", {HistType::kTH1F, {{nEvtSel, 0, nEvtSel}}}); + flatchrg.add("Events/hEvtSel", "Number of events; Cut; #Events Passed Cut", {kTH1F, {{nEvtSel + 1, 0, nEvtSel + 1}}}); flatchrg.get(HIST("Events/hEvtSel"))->GetXaxis()->SetBinLabel(evtSelAll + 1, "Events read"); flatchrg.get(HIST("Events/hEvtSel"))->GetXaxis()->SetBinLabel(evtSelSel8 + 1, "Evt. sel8"); flatchrg.get(HIST("Events/hEvtSel"))->GetXaxis()->SetBinLabel(evtSelNoITSROFrameBorder + 1, "NoITSROFrameBorder"); @@ -408,69 +470,82 @@ struct FlattenictyPikp { flatchrg.get(HIST("Events/hEvtSel"))->GetXaxis()->SetBinLabel(evtSelVtxZ + 1, "Vtx-z pos"); flatchrg.get(HIST("Events/hEvtSel"))->GetXaxis()->SetBinLabel(evtSelINELgt0 + 1, "INEL>0"); // Track counter - flatchrg.add("Tracks/hTrkSel", "Number of tracks; Cut; #Tracks Passed Cut", {HistType::kTH1F, {{nTrkSel, 0, nTrkSel}}}); + flatchrg.add("Tracks/hTrkSel", "Number of tracks; Cut; #Tracks Passed Cut", {kTH1F, {{nTrkSel + 1, 0, nTrkSel + 1}}}); + flatchrg.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelAll + 1, "All"); flatchrg.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelEta + 1, "Eta"); flatchrg.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelPt + 1, "Pt"); flatchrg.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelDCA + 1, "DCA"); flatchrg.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkNRowsTPC + 1, "trkNRowsTPC"); flatchrg.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelNCls + 1, "NClsTPC"); flatchrg.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelTPCBndr + 1, "TPC Boundary"); - - if (trkSelOpt.cfgUseExtraTrkCut) { + // V0 counter + flatchrg.add("Tracks/V0qa/hV0Sel", "Number of V0s; Cut; #Tracks Passed Cut", {kTH1F, {{nV0Sel + 1, 0, nV0Sel + 1}}}); + flatchrg.get(HIST("Tracks/V0qa/hV0Sel"))->GetXaxis()->SetBinLabel(v0SelAll + 1, "All"); + flatchrg.get(HIST("Tracks/V0qa/hV0Sel"))->GetXaxis()->SetBinLabel(v0SelEta + 1, "Eta"); + flatchrg.get(HIST("Tracks/V0qa/hV0Sel"))->GetXaxis()->SetBinLabel(v0SelDaughters + 1, "V0 daughters' sel."); + flatchrg.get(HIST("Tracks/V0qa/hV0Sel"))->GetXaxis()->SetBinLabel(v0SelTPCnClsFound + 1, "TPC nCls found"); + flatchrg.get(HIST("Tracks/V0qa/hV0Sel"))->GetXaxis()->SetBinLabel(v0SelRejectV0sAtTPCSector + 1, "Reject V0s at TPC sector"); + flatchrg.get(HIST("Tracks/V0qa/hV0Sel"))->GetXaxis()->SetBinLabel(v0SelRejectSameSign + 1, "Reject same sign"); + flatchrg.get(HIST("Tracks/V0qa/hV0Sel"))->GetXaxis()->SetBinLabel(v0SelDCAv0daughter + 1, "DCA v0 daughter"); + flatchrg.get(HIST("Tracks/V0qa/hV0Sel"))->GetXaxis()->SetBinLabel(v0SelCosPA + 1, "Cos PA"); + flatchrg.get(HIST("Tracks/V0qa/hV0Sel"))->GetXaxis()->SetBinLabel(v0SelV0radius + 1, "V0 radius"); + flatchrg.get(HIST("Tracks/V0qa/hV0Sel"))->GetXaxis()->SetBinLabel(v0SelDCAposToPV + 1, "DCA pos to PV"); + + if (trkSelOpt.cfgRejectTrkAtTPCSector || v0SelOpt.cfgRejectV0sAtTPCSector) { fPhiCutLow = new TF1("fPhiCutLow", trkSelOpt.cfgGeoTrkCutMin.value.c_str(), 0, 100); fPhiCutHigh = new TF1("fPhiCutHigh", trkSelOpt.cfgGeoTrkCutMax.value.c_str(), 0, 100); } if (doprocessFlat) { - flatchrg.add("Events/hVtxZ", "Measured vertex z position", HistType::kTH1F, {vtxzAxis}); - flatchrg.add("Events/hFlatVsMultEst", "hFlatVsMultEst", HistType::kTH2F, {flatAxis, multAxis}); - flatchrg.add("Tracks/postSel/hPVsPtEta", "; #it{p} (GeV/#it{c}); #it{p}_{T} (GeV/#it{c}); #eta;", {HistType::kTH3F, {pAxis, ptAxis, etaAxis}}); + flatchrg.add("Events/hVtxZ", "Measured vertex z position", kTH1F, {vtxzAxis}); + flatchrg.add("Events/hFlatVsMultEst", "hFlatVsMultEst", kTH2F, {flatAxis, multAxis}); + flatchrg.add("Tracks/postSel/hPVsPtEta", "; #it{p} (GeV/#it{c}); #it{p}_{T} (GeV/#it{c}); #eta;", {kTH3F, {pAxis, ptAxis, etaAxis}}); if (cfgFillTrackQaHist || cfgFilldEdxQaHist || cfgFillNsigmaQAHist) { if (cfgFillTrackQaHist) { - flatchrg.add("Tracks/postSel/hPtPhi", "; #it{p}_{T} (GeV/#it{c}); fmod(#varphi,#pi/9)", {HistType::kTH2F, {ptAxis, phiAxisMod}}); - flatchrg.add("Tracks/postSel/hPtVsWOcutDCA", "hPtVsWOcutDCA", HistType::kTH2F, {ptAxis, dcaXYAxis}); - flatchrg.add("Tracks/postSel/hPt", "", HistType::kTH1F, {ptAxis}); - flatchrg.add("Tracks/postSel/hPhi", "", HistType::kTH1F, {phiAxis}); - flatchrg.add("Tracks/postSel/hEta", "", HistType::kTH1F, {etaAxis}); - flatchrg.add("Tracks/postSel/hDCAXYvsPt", "", HistType::kTH2F, {ptAxis, dcaXYAxis}); - flatchrg.add("Tracks/postSel/hDCAZvsPt", "", HistType::kTH2F, {ptAxis, dcaZAxis}); + flatchrg.add("Tracks/postSel/hPtPhi", "; #it{p}_{T} (GeV/#it{c}); fmod(#varphi,#pi/9)", {kTH2F, {ptAxis, phiAxisMod}}); + flatchrg.add("Tracks/postSel/hPtVsWOcutDCA", "hPtVsWOcutDCA", kTH2F, {ptAxis, dcaXYAxis}); + flatchrg.add("Tracks/postSel/hPt", "", kTH1F, {ptAxis}); + flatchrg.add("Tracks/postSel/hPhi", "", kTH1F, {phiAxis}); + flatchrg.add("Tracks/postSel/hEta", "", kTH1F, {etaAxis}); + flatchrg.add("Tracks/postSel/hDCAXYvsPt", "", kTH2F, {ptAxis, dcaXYAxis}); + flatchrg.add("Tracks/postSel/hDCAZvsPt", "", kTH2F, {ptAxis, dcaZAxis}); // tpc if (cfgStoreThnSparse) { - flatchrg.add("Tracks/postSel/hPtPhiTPCCluster", "; #it{p}_{T} (GeV/#it{c}); fmod(#varphi,#pi/9); N_{cluster}", {HistType::kTHnSparseF, {ptAxis, phiAxisMod, clTpcAxis}}); + flatchrg.add("Tracks/postSel/hPtPhiTPCCluster", "; #it{p}_{T} (GeV/#it{c}); fmod(#varphi,#pi/9); N_{cluster}", {kTHnSparseF, {ptAxis, phiAxisMod, clTpcAxis}}); } else { - flatchrg.add("Tracks/postSel/hPtPhiTPCCluster", "; #it{p}_{T} (GeV/#it{c}); fmod(#varphi,#pi/9); N_{cluster}", {HistType::kTH2F, {ptAxis, phiAxisMod}}); + flatchrg.add("Tracks/postSel/hPtPhiTPCCluster", "; #it{p}_{T} (GeV/#it{c}); fmod(#varphi,#pi/9); N_{cluster}", {kTH2F, {ptAxis, phiAxisMod}}); } - flatchrg.add("Tracks/postSel/hShTpcClvsPt", "", {HistType::kTH2F, {ptAxis, shCluserAxis}}); - flatchrg.add("Tracks/postSel/hCrossTPCvsPt", "", {HistType::kTH2F, {ptAxis, clTpcAxis}}); - flatchrg.add("Tracks/postSel/hTPCCluster", "N_{cluster}", HistType::kTH1F, {clTpcAxis}); - flatchrg.add("Tracks/postSel/tpcNClsShared", " ; # shared TPC clusters TPC", HistType::kTH1F, {{165, -0.5, 164.5}}); - flatchrg.add("Tracks/postSel/tpcCrossedRows", " ; # crossed TPC rows", HistType::kTH1F, {{165, -0.5, 164.5}}); - flatchrg.add("Tracks/postSel/tpcCrossedRowsOverFindableCls", " ; crossed rows / findable TPC clusters", HistType::kTH1F, {{60, 0.7, 1.3}}); + flatchrg.add("Tracks/postSel/hShTpcClvsPt", "", {kTH2F, {ptAxis, shCluserAxis}}); + flatchrg.add("Tracks/postSel/hCrossTPCvsPt", "", {kTH2F, {ptAxis, clTpcAxis}}); + flatchrg.add("Tracks/postSel/hTPCCluster", "N_{cluster}", kTH1F, {clTpcAxis}); + flatchrg.add("Tracks/postSel/tpcNClsShared", " ; # shared TPC clusters TPC", kTH1F, {{165, -0.5, 164.5}}); + flatchrg.add("Tracks/postSel/tpcCrossedRows", " ; # crossed TPC rows", kTH1F, {{165, -0.5, 164.5}}); + flatchrg.add("Tracks/postSel/tpcCrossedRowsOverFindableCls", " ; crossed rows / findable TPC clusters", kTH1F, {{60, 0.7, 1.3}}); // its - flatchrg.add("Tracks/postSel/itsNCls", " ; # ITS clusters", HistType::kTH1F, {{8, -0.5, 7.5}}); - flatchrg.add("Tracks/postSel/hChi2ITSTrkSegment", "chi2ITS", HistType::kTH1F, {{100, -0.5, 99.5}}); + flatchrg.add("Tracks/postSel/itsNCls", " ; # ITS clusters", kTH1F, {{8, -0.5, 7.5}}); + flatchrg.add("Tracks/postSel/hChi2ITSTrkSegment", "chi2ITS", kTH1F, {{100, -0.5, 99.5}}); // tof - flatchrg.add("Tracks/postSel/hTOFPvsBeta", "Beta from TOF; #it{p} (GeV/#it{c}); #beta", {HistType::kTH2F, {pAxis, {120, 0.0, 1.2}}}); + flatchrg.add("Tracks/postSel/hTOFPvsBeta", "Beta from TOF; #it{p} (GeV/#it{c}); #beta", {kTH2F, {pAxis, {120, 0.0, 1.2}}}); if (cfgStoreThnSparse) { - flatchrg.add("Tracks/postSel/hTOFpi", "Primary Pions from TOF; #eta; #it{p} (GeV/#it{c}); dEdx", {HistType::kTHnSparseF, {etaAxis, pAxis, dEdxAxis}}); + flatchrg.add("Tracks/postSel/hTOFpi", "Primary Pions from TOF; #eta; #it{p} (GeV/#it{c}); dEdx", {kTHnSparseF, {etaAxis, pAxis, dEdxAxis}}); } else { - flatchrg.add("Tracks/postSel/hTOFpi", "Primary Pions from TOF; #eta; #it{p} (GeV/#it{c}); dEdx", {HistType::kTH3F, {etaAxis, pAxis, dEdxAxis}}); + flatchrg.add("Tracks/postSel/hTOFpi", "Primary Pions from TOF; #eta; #it{p} (GeV/#it{c}); dEdx", {kTH3F, {etaAxis, pAxis, dEdxAxis}}); } } if (cfgFilldEdxQaHist) { if (cfgStoreThnSparse) { - flatchrg.add("Tracks/postCalib/all/hMIP", "; mult; flat; #eta; #LT dE/dx #GT_{MIP, primary tracks};", {HistType::kTHnSparseF, {multAxis, flatAxis, etaAxis, dEdxAxis}}); - flatchrg.add("Tracks/postCalib/all/hPlateau", "; mult; flat; #eta; #LT dE/dx #GT_{Plateau, primary tracks};", {HistType::kTHnSparseF, {multAxis, flatAxis, etaAxis, dEdxAxis}}); + flatchrg.add("Tracks/postCalib/all/hMIP", "; mult; flat; #eta; #LT dE/dx #GT_{MIP, primary tracks};", {kTHnSparseF, {multAxis, flatAxis, etaAxis, dEdxAxis}}); + flatchrg.add("Tracks/postCalib/all/hPlateau", "; mult; flat; #eta; #LT dE/dx #GT_{Plateau, primary tracks};", {kTHnSparseF, {multAxis, flatAxis, etaAxis, dEdxAxis}}); } else { - flatchrg.add("Tracks/postCalib/all/hMIP", "; #eta; #LT dE/dx #GT_{MIP, primary tracks};", {HistType::kTH2F, {etaAxis, dEdxAxis}}); - flatchrg.add("Tracks/postCalib/all/hPlateau", "; #eta; #LT dE/dx #GT_{Plateau, primary tracks};", {HistType::kTH2F, {etaAxis, dEdxAxis}}); + flatchrg.add("Tracks/postCalib/all/hMIP", "; #eta; #LT dE/dx #GT_{MIP, primary tracks};", {kTH2F, {etaAxis, dEdxAxis}}); + flatchrg.add("Tracks/postCalib/all/hPlateau", "; #eta; #LT dE/dx #GT_{Plateau, primary tracks};", {kTH2F, {etaAxis, dEdxAxis}}); } - flatchrg.add("Tracks/postCalib/all/hMIPVsPhi", "; #varphi; #LT dE/dx #GT_{MIP, primary tracks};", {HistType::kTH2F, {phiAxis, dEdxAxis}}); - flatchrg.add("Tracks/postCalib/all/pMIPVsPhi", "; #varphi; #LT dE/dx #GT_{MIP, primary tracks};", {HistType::kTProfile, {phiAxis}}); - flatchrg.add("Tracks/postCalib/all/hMIPVsPhiVsEta", "; #varphi; #LT dE/dx #GT_{MIP, primary tracks}; #eta;", {HistType::kTH3F, {phiAxis, dEdxAxis, etaAxis}}); - flatchrg.add("Tracks/postCalib/all/hPlateauVsPhi", "; #varphi; #LT dE/dx #GT_{Plateau, primary tracks};", {HistType::kTH2F, {phiAxis, dEdxAxis}}); - flatchrg.add("Tracks/postCalib/all/pPlateauVsPhi", "; #varphi; #LT dE/dx #GT_{Plateau, primary tracks};", {HistType::kTProfile, {phiAxis}}); - flatchrg.add("Tracks/postCalib/all/hPlateauVsPhiVsEta", "; #varphi; #LT dE/dx #GT_{Plateau, primary tracks}; #eta;", {HistType::kTH3F, {phiAxis, dEdxAxis, etaAxis}}); + flatchrg.add("Tracks/postCalib/all/hMIPVsPhi", "; #varphi; #LT dE/dx #GT_{MIP, primary tracks};", {kTH2F, {phiAxis, dEdxAxis}}); + flatchrg.add("Tracks/postCalib/all/pMIPVsPhi", "; #varphi; #LT dE/dx #GT_{MIP, primary tracks};", {kTProfile, {phiAxis}}); + flatchrg.add("Tracks/postCalib/all/hMIPVsPhiVsEta", "; #varphi; #LT dE/dx #GT_{MIP, primary tracks}; #eta;", {kTH3F, {phiAxis, dEdxAxis, etaAxis}}); + flatchrg.add("Tracks/postCalib/all/hPlateauVsPhi", "; #varphi; #LT dE/dx #GT_{Plateau, primary tracks};", {kTH2F, {phiAxis, dEdxAxis}}); + flatchrg.add("Tracks/postCalib/all/pPlateauVsPhi", "; #varphi; #LT dE/dx #GT_{Plateau, primary tracks};", {kTProfile, {phiAxis}}); + flatchrg.add("Tracks/postCalib/all/hPlateauVsPhiVsEta", "; #varphi; #LT dE/dx #GT_{Plateau, primary tracks}; #eta;", {kTH3F, {phiAxis, dEdxAxis, etaAxis}}); flatchrg.addClone("Tracks/postCalib/all/", "Tracks/preCalib/all/"); if (cfgFillChrgType) { flatchrg.addClone("Tracks/postCalib/all/", "Tracks/postCalib/pos/"); @@ -483,40 +558,61 @@ struct FlattenictyPikp { for (int i = 0; i < NpartChrg; i++) { const std::string strID = Form("/%s/%s", (i < Npart) ? "pos" : "neg", Pid[i % Npart]); if (cfgStoreThnSparse) { - hThPtNsigmaTPC[i] = flatchrg.add("Tracks/hThPtNsigmaTPC" + strID, " ; p_{T} (GeV/c)", HistType::kTHnSparseF, {ptAxis, nSigmaTPCAxis, multAxis, flatAxis}); + hThPtNsigmaTPC[i] = flatchrg.add("Tracks/hThPtNsigmaTPC" + strID, " ; p_{T} (GeV/c)", kTHnSparseF, {ptAxis, nSigmaTPCAxis, multAxis, flatAxis}); } else { - hPtNsigmaTPC[i] = flatchrg.add("Tracks/hPtNsigmaTPC" + strID, " ; p_{T} (GeV/c)", HistType::kTH2F, {ptAxis, nSigmaTPCAxis}); + hPtNsigmaTPC[i] = flatchrg.add("Tracks/hPtNsigmaTPC" + strID, " ; p_{T} (GeV/c)", kTH2F, {ptAxis, nSigmaTPCAxis}); } - hPtNsigmaTOF[i] = flatchrg.add("Tracks/hPtNsigmaTOF" + strID, " ; p_{T} (GeV/c)", HistType::kTH2F, {ptAxis, nSigmaTOFAxis}); - hPtNsigmaTPCTOF[i] = flatchrg.add("Tracks/hPtNsigmaTPCTOF" + strID, PidChrg[i], HistType::kTH2F, {nSigmaTPCAxis, nSigmaTOFAxis}); + hPtNsigmaTOF[i] = flatchrg.add("Tracks/hPtNsigmaTOF" + strID, " ; p_{T} (GeV/c)", kTH2F, {ptAxis, nSigmaTOFAxis}); + hPtNsigmaTPCTOF[i] = flatchrg.add("Tracks/hPtNsigmaTPCTOF" + strID, PidChrg[i], kTH2F, {nSigmaTPCAxis, nSigmaTOFAxis}); } } } flatchrg.addClone("Tracks/postSel/", "Tracks/preSel/"); // FV0 QA - flatchrg.add("FV0/hFV0AmplWCalib", "", {HistType::kTH2F, {channelFV0Axis, amplitudeFV0}}); - flatchrg.add("FV0/hFV0AmplvsVtxzWoCalib", "", {HistType::kTH2F, {vtxzAxis, amplitudeFV0Sum}}); - flatchrg.add("FV0/hFV0AmplvsVtxzCalib", "", {HistType::kTH2F, {vtxzAxis, amplitudeFV0Sum}}); - flatchrg.add("FV0/hFV0amp", "", {HistType::kTH2F, {channelFV0Axis, amplitudeFV0}}); - flatchrg.add("FV0/pFV0amp", "", HistType::kTProfile, {channelFV0Axis}); - flatchrg.add("FV0/hFV0ampCorr", "", {HistType::kTH2F, {channelFV0Axis, amplitudeFV0}}); + flatchrg.add("FV0/hFV0AmplWCalib", "", {kTH2F, {channelFV0Axis, amplitudeFV0}}); + flatchrg.add("FV0/hFV0AmplvsVtxzWoCalib", "", {kTH2F, {vtxzAxis, amplitudeFV0Sum}}); + flatchrg.add("FV0/hFV0AmplvsVtxzCalib", "", {kTH2F, {vtxzAxis, amplitudeFV0Sum}}); + flatchrg.add("FV0/hFV0amp", "", {kTH2F, {channelFV0Axis, amplitudeFV0}}); + flatchrg.add("FV0/pFV0amp", "", kTProfile, {channelFV0Axis}); + flatchrg.add("FV0/hFV0ampCorr", "", {kTH2F, {channelFV0Axis, amplitudeFV0}}); // V0's QA - flatchrg.add("Tracks/V0qa/hV0Pt", "pT", HistType::kTH1F, {{100, 0.0f, 10}}); - flatchrg.add("Tracks/V0qa/hV0ArmPod", ";#alpha; #it{q}_T", HistType::kTH2F, {{200, -1.0f, +1.0f}, {250, 0.0f, 0.25f}}); + flatchrg.add("Tracks/V0qa/hV0Pt", "pT", kTH1F, {ptAxisV0s}); + flatchrg.add("Tracks/V0qa/hEtaVsRapK0s", ";#eta;#it{y};", kTH2F, {etaAxis, rapidityAxis}); + flatchrg.add("Tracks/V0qa/hEtaVsRapLam", ";#eta;#it{y};", kTH2F, {etaAxis, rapidityAxis}); + flatchrg.add("Tracks/V0qa/hEtaVsRapALam", ";#eta;#it{y};", kTH2F, {etaAxis, rapidityAxis}); + flatchrg.add("Tracks/V0qa/hEtaVsRapGamma", ";#eta;#it{y};", kTH2F, {etaAxis, rapidityAxis}); + flatchrg.add("Tracks/V0qa/hV0ArmPod", ";#alpha; #it{q}_T (GeV/c)", kTH2F, {v0SelOpt.axisArmPodAlpha, v0SelOpt.axisArmPodqT}); + flatchrg.add("Tracks/V0qa/hArmPodK0s", ";#alpha; #it{q}_T (GeV/c)", kTH2F, {v0SelOpt.axisArmPodAlpha, v0SelOpt.axisArmPodqT}); + flatchrg.add("Tracks/V0qa/hArmPodLam", ";#alpha; #it{q}_T (GeV/c)", kTH2F, {v0SelOpt.axisArmPodAlpha, v0SelOpt.axisArmPodqT}); + flatchrg.add("Tracks/V0qa/hArmPodALam", ";#alpha; #it{q}_T (GeV/c)", kTH2F, {v0SelOpt.axisArmPodAlpha, v0SelOpt.axisArmPodqT}); + flatchrg.add("Tracks/V0qa/hArmPodGamma", ";#alpha; #it{q}_T (GeV/c)", kTH2F, {v0SelOpt.axisArmPodAlpha, v0SelOpt.axisArmPodqT}); + flatchrg.add("Tracks/V0qa/hMassK0sVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {ptAxisV0s, v0SelOpt.axisK0sMass}); + flatchrg.add("Tracks/V0qa/hMassLamVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {ptAxisV0s, v0SelOpt.axisLambdaMass}); + flatchrg.add("Tracks/V0qa/hMassALamVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {ptAxisV0s, v0SelOpt.axisLambdaMass}); + flatchrg.add("Tracks/V0qa/hMassGammaVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {ptAxisV0s, v0SelOpt.axisGammaMass}); + flatchrg.add("Tracks/V0qa/hNsigmaPiFromK0s", ";#it{n#sigma};;", kTH2F, {ptAxisV0s, nSigmaTPCAxis}); + flatchrg.add("Tracks/V0qa/hNsigmaPiFromLam", ";#it{n#sigma};;", kTH2F, {ptAxisV0s, nSigmaTPCAxis}); + flatchrg.add("Tracks/V0qa/hNsigmaPrFromLam", ";#it{n#sigma};;", kTH2F, {ptAxisV0s, nSigmaTPCAxis}); + flatchrg.add("Tracks/V0qa/hNsigmaPiFromALam", ";#it{n#sigma};;", kTH2F, {ptAxisV0s, nSigmaTPCAxis}); + flatchrg.add("Tracks/V0qa/hNsigmaPrFromALam", ";#it{n#sigma};;", kTH2F, {ptAxisV0s, nSigmaTPCAxis}); + flatchrg.add("Tracks/V0qa/hNsigmaElFromGamma", ";#it{n#sigma};;", kTH2F, {ptAxisV0s, nSigmaTPCAxis}); + // dEdx PID - flatchrg.add({"Tracks/all/hdEdx", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {HistType::kTHnSparseF, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); + flatchrg.add({"Tracks/all/hdEdx", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {kTHnSparseF, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); // Clean samples if (cfgFillV0Hist) { if (cfgStoreThnSparse) { - flatchrg.add({"Tracks/CleanTof/all/hPiTof", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {HistType::kTHnSparseF, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); - flatchrg.add({"Tracks/CleanV0/pos/hEV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {HistType::kTHnSparseF, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); - flatchrg.add({"Tracks/CleanV0/pos/hPiV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {HistType::kTHnSparseF, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); - flatchrg.add({"Tracks/CleanV0/pos/hPV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {HistType::kTHnSparseF, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); + flatchrg.add({"Tracks/CleanTof/all/hPiTof", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {kTHnSparseF, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); + flatchrg.add({"Tracks/CleanV0/pos/hEV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {kTHnSparseF, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); + flatchrg.add({"Tracks/CleanV0/pos/hPiV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {kTHnSparseF, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); + flatchrg.add({"Tracks/CleanV0/pos/hPV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {kTHnSparseF, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); } else { - flatchrg.add({"Tracks/CleanTof/all/hPiTof", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {HistType::kTH3F, {etaAxis, pAxis, dEdxAxis}}}); - flatchrg.add({"Tracks/CleanV0/pos/hEV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {HistType::kTH3F, {etaAxis, pAxis, dEdxAxis}}}); - flatchrg.add({"Tracks/CleanV0/pos/hPiV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {HistType::kTH3F, {etaAxis, pAxis, dEdxAxis}}}); - flatchrg.add({"Tracks/CleanV0/pos/hPV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {HistType::kTH3F, {etaAxis, pAxis, dEdxAxis}}}); + flatchrg.add("Tracks/CleanTof/hBetaVsP", ";Momentum (GeV/#it{c}); #beta", kTH2F, {{{ptAxisV0s}, {120, 0., 1.2}}}); + flatchrg.add("Tracks/CleanTof/hTofExpPi", ";Momentum (GeV/#it{c});#it{t}^{#pi}_{Exp}/#it{t}_{TOF}", kTH2F, {{{ptAxisV0s}, {100, 0.2, 1.2}}}); + flatchrg.add({"Tracks/CleanTof/all/hPiTof", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {kTH3F, {etaAxis, pAxis, dEdxAxis}}}); + flatchrg.add({"Tracks/CleanV0/pos/hEV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {kTH3F, {etaAxis, pAxis, dEdxAxis}}}); + flatchrg.add({"Tracks/CleanV0/pos/hPiV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {kTH3F, {etaAxis, pAxis, dEdxAxis}}}); + flatchrg.add({"Tracks/CleanV0/pos/hPV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {kTH3F, {etaAxis, pAxis, dEdxAxis}}}); } flatchrg.addClone("Tracks/CleanV0/pos/", "Tracks/CleanV0/neg/"); if (cfgFillChrgType) { @@ -536,7 +632,7 @@ struct FlattenictyPikp { h->GetXaxis()->SetBinLabel(2, "Rec coll"); h->GetXaxis()->SetBinLabel(3, "INEL>0"); - flatchrg.add("hEvtMcGenColls", "Number of events; Cut; #Events Passed Cut", {HistType::kTH1F, {{5, 0.5, 5.5}}}); + flatchrg.add("hEvtMcGenColls", "Number of events; Cut; #Events Passed Cut", {kTH1F, {{5, 0.5, 5.5}}}); flatchrg.get(HIST("hEvtMcGenColls"))->GetXaxis()->SetBinLabel(1, "Gen. coll"); flatchrg.get(HIST("hEvtMcGenColls"))->GetXaxis()->SetBinLabel(2, "At least 1 reco"); flatchrg.get(HIST("hEvtMcGenColls"))->GetXaxis()->SetBinLabel(3, "Reco. coll."); @@ -544,32 +640,32 @@ struct FlattenictyPikp { for (int i = 0; i < NpartChrg; i++) { const std::string strID = Form("/%s/%s", (i < Npart) ? "pos" : "neg", Pid[i % Npart]); - hPtGenRecEvt[i] = flatchrg.add("Tracks/hPtGenRecEvt" + strID, " ; p_{T} (GeV/c)", HistType::kTH1F, {ptAxis}); - hPtGenPrimRecEvt[i] = flatchrg.add("Tracks/hPtGenPrimRecEvt" + strID, " ; p_{T} (GeV/c)", HistType::kTH1F, {ptAxis}); - hPtEffGenPrim[i] = flatchrg.add("Tracks/hPtEffGenPrim" + strID, " ; p_{T} (GeV/c)", HistType::kTH3F, {multAxis, flatAxis, ptAxis}); - hPtEffGenWeak[i] = flatchrg.add("Tracks/hPtEffGenWeak" + strID, " ; p_{T} (GeV/c)", HistType::kTH3F, {multAxis, flatAxis, ptAxis}); - hPtEffGenMat[i] = flatchrg.add("Tracks/hPtEffGenMat" + strID, " ; p_{T} (GeV/c)", HistType::kTH3F, {multAxis, flatAxis, ptAxis}); - hPtEffRecPrim[i] = flatchrg.add("Tracks/hPtEffRecPrim" + strID, " ; p_{T} (GeV/c)", HistType::kTH3F, {multAxis, flatAxis, ptAxis}); - hPtEffRecWeak[i] = flatchrg.add("Tracks/hPtEffRecWeak" + strID, " ; p_{T} (GeV/c)", HistType::kTH3F, {multAxis, flatAxis, ptAxis}); - hPtEffRecMat[i] = flatchrg.add("Tracks/hPtEffRecMat" + strID, " ; p_{T} (GeV/c)", HistType::kTH3F, {multAxis, flatAxis, ptAxis}); - hDCAxyBadCollPrim[i] = flatchrg.add("Tracks/hDCAxyBadCollPrim" + strID, " ; p_{T} (GeV/c)", HistType::kTH2F, {ptAxis, dcaXYAxis}); - hDCAxyBadCollWeak[i] = flatchrg.add("Tracks/hDCAxyBadCollWeak" + strID, " ; p_{T} (GeV/c)", HistType::kTH2F, {ptAxis, dcaXYAxis}); - hDCAxyBadCollMat[i] = flatchrg.add("Tracks/hDCAxyBadCollMat" + strID, " ; p_{T} (GeV/c)", HistType::kTH2F, {ptAxis, dcaXYAxis}); - hPtVsDCAxyPrim[i] = flatchrg.add("Tracks/hPtVsDCAxyPrim" + strID, " ; p_{T} (GeV/c)", HistType::kTH2F, {ptAxis, dcaXYAxis}); - hPtVsDCAxyWeak[i] = flatchrg.add("Tracks/hPtVsDCAxyWeak" + strID, " ; p_{T} (GeV/c)", HistType::kTH2F, {ptAxis, dcaXYAxis}); - hPtVsDCAxyMat[i] = flatchrg.add("Tracks/hPtVsDCAxyMat" + strID, " ; p_{T} (GeV/c)", HistType::kTH2F, {ptAxis, dcaXYAxis}); - } - - flatchrg.add({"hPtOut", " ; p_{T} (GeV/c)", {HistType::kTH1F, {ptAxis}}}); - flatchrg.add({"hPtOutPrim", " ; p_{T} (GeV/c)", {HistType::kTH1F, {ptAxis}}}); - flatchrg.add({"hPtOutNoEtaCut", " ; p_{T} (GeV/c)", {HistType::kTH1F, {ptAxis}}}); - flatchrg.add({"PtOutFakes", " ; p_{T} (GeV/c)", {HistType::kTH1F, {ptAxis}}}); - flatchrg.add("hPtVsDCAxyPrimAll", "hPtVsDCAxyPrimAll", HistType::kTH2F, {ptAxis, dcaXYAxis}); - flatchrg.add("hPtVsDCAxyWeakAll", "hPtVsDCAxyWeakAll", HistType::kTH2F, {ptAxis, dcaXYAxis}); - flatchrg.add("hPtVsDCAxyMatAll", "hPtVsDCAxyMatAll", HistType::kTH2F, {ptAxis, dcaXYAxis}); - flatchrg.add("hPtVsDCAxyAll", "hPtVsDCAxyAll", HistType::kTH2F, {ptAxis, dcaXYAxis}); - flatchrg.add({"ResponseGen", " ; N_{part}; F_{FV0};", {HistType::kTHnSparseF, {multAxis, flatAxis}}}); - flatchrg.add("h1flatencityFV0MCGen", "", HistType::kTH1F, {{102, -0.01, 1.01, "1-flatencityFV0"}}); + hPtGenRecEvt[i] = flatchrg.add("Tracks/hPtGenRecEvt" + strID, " ; p_{T} (GeV/c)", kTH1F, {ptAxis}); + hPtGenPrimRecEvt[i] = flatchrg.add("Tracks/hPtGenPrimRecEvt" + strID, " ; p_{T} (GeV/c)", kTH1F, {ptAxis}); + hPtEffGenPrim[i] = flatchrg.add("Tracks/hPtEffGenPrim" + strID, " ; p_{T} (GeV/c)", kTH3F, {multAxis, flatAxis, ptAxis}); + hPtEffGenWeak[i] = flatchrg.add("Tracks/hPtEffGenWeak" + strID, " ; p_{T} (GeV/c)", kTH3F, {multAxis, flatAxis, ptAxis}); + hPtEffGenMat[i] = flatchrg.add("Tracks/hPtEffGenMat" + strID, " ; p_{T} (GeV/c)", kTH3F, {multAxis, flatAxis, ptAxis}); + hPtEffRecPrim[i] = flatchrg.add("Tracks/hPtEffRecPrim" + strID, " ; p_{T} (GeV/c)", kTH3F, {multAxis, flatAxis, ptAxis}); + hPtEffRecWeak[i] = flatchrg.add("Tracks/hPtEffRecWeak" + strID, " ; p_{T} (GeV/c)", kTH3F, {multAxis, flatAxis, ptAxis}); + hPtEffRecMat[i] = flatchrg.add("Tracks/hPtEffRecMat" + strID, " ; p_{T} (GeV/c)", kTH3F, {multAxis, flatAxis, ptAxis}); + hDCAxyBadCollPrim[i] = flatchrg.add("Tracks/hDCAxyBadCollPrim" + strID, " ; p_{T} (GeV/c)", kTH2F, {ptAxis, dcaXYAxis}); + hDCAxyBadCollWeak[i] = flatchrg.add("Tracks/hDCAxyBadCollWeak" + strID, " ; p_{T} (GeV/c)", kTH2F, {ptAxis, dcaXYAxis}); + hDCAxyBadCollMat[i] = flatchrg.add("Tracks/hDCAxyBadCollMat" + strID, " ; p_{T} (GeV/c)", kTH2F, {ptAxis, dcaXYAxis}); + hPtVsDCAxyPrim[i] = flatchrg.add("Tracks/hPtVsDCAxyPrim" + strID, " ; p_{T} (GeV/c)", kTH2F, {ptAxis, dcaXYAxis}); + hPtVsDCAxyWeak[i] = flatchrg.add("Tracks/hPtVsDCAxyWeak" + strID, " ; p_{T} (GeV/c)", kTH2F, {ptAxis, dcaXYAxis}); + hPtVsDCAxyMat[i] = flatchrg.add("Tracks/hPtVsDCAxyMat" + strID, " ; p_{T} (GeV/c)", kTH2F, {ptAxis, dcaXYAxis}); + } + + flatchrg.add({"hPtOut", " ; p_{T} (GeV/c)", {kTH1F, {ptAxis}}}); + flatchrg.add({"hPtOutPrim", " ; p_{T} (GeV/c)", {kTH1F, {ptAxis}}}); + flatchrg.add({"hPtOutNoEtaCut", " ; p_{T} (GeV/c)", {kTH1F, {ptAxis}}}); + flatchrg.add({"PtOutFakes", " ; p_{T} (GeV/c)", {kTH1F, {ptAxis}}}); + flatchrg.add("hPtVsDCAxyPrimAll", "hPtVsDCAxyPrimAll", kTH2F, {ptAxis, dcaXYAxis}); + flatchrg.add("hPtVsDCAxyWeakAll", "hPtVsDCAxyWeakAll", kTH2F, {ptAxis, dcaXYAxis}); + flatchrg.add("hPtVsDCAxyMatAll", "hPtVsDCAxyMatAll", kTH2F, {ptAxis, dcaXYAxis}); + flatchrg.add("hPtVsDCAxyAll", "hPtVsDCAxyAll", kTH2F, {ptAxis, dcaXYAxis}); + flatchrg.add({"ResponseGen", " ; N_{part}; F_{FV0};", {kTHnSparseF, {multAxis, flatAxis}}}); + flatchrg.add("h1flatencityFV0MCGen", "", kTH1F, {{102, -0.01, 1.01, "1-flatencityFV0"}}); // Hash list for efficiency listEfficiency.setObject(new THashList); @@ -585,35 +681,35 @@ struct FlattenictyPikp { if (doprocessMCclosure) { for (int i = 0; i < Npart; i++) { - flatchrg.add({fmt::format(kPtMCclosurePrimF.data(), kSpeciesAll[i]).c_str(), " ; p_{T} (GeV/c)", {HistType::kTH3F, {multAxis, flatAxis, ptAxis}}}); + flatchrg.add({fmt::format(kPtMCclosurePrimF.data(), kSpeciesAll[i]).c_str(), " ; p_{T} (GeV/c)", {kTH3F, {multAxis, flatAxis, ptAxis}}}); } } if (doprocessSgnLoss) { - flatchrg.add("hFlatMCGenRecColl", "hFlatMCGenRecColl", {HistType::kTH1F, {flatAxis}}); - flatchrg.add("hFlatMCGen", "hFlatMCGen", {HistType::kTH1F, {flatAxis}}); + flatchrg.add("hFlatMCGenRecColl", "hFlatMCGenRecColl", {kTH1F, {flatAxis}}); + flatchrg.add("hFlatMCGen", "hFlatMCGen", {kTH1F, {flatAxis}}); // Event counter - flatchrg.add("hEvtMcGen", "hEvtMcGen", {HistType::kTH1F, {{4, 0.f, 4.f}}}); + flatchrg.add("hEvtMcGen", "hEvtMcGen", {kTH1F, {{4, 0.f, 4.f}}}); flatchrg.get(HIST("hEvtMcGen"))->GetXaxis()->SetBinLabel(1, "all"); flatchrg.get(HIST("hEvtMcGen"))->GetXaxis()->SetBinLabel(2, "z-vtx"); flatchrg.get(HIST("hEvtMcGen"))->GetXaxis()->SetBinLabel(3, "INELgt0"); - flatchrg.add("hEvtMCRec", "hEvtMCRec", {HistType::kTH1F, {{4, 0.f, 4.f}}}); + flatchrg.add("hEvtMCRec", "hEvtMCRec", {kTH1F, {{4, 0.f, 4.f}}}); flatchrg.get(HIST("hEvtMCRec"))->GetXaxis()->SetBinLabel(1, "all"); flatchrg.get(HIST("hEvtMCRec"))->GetXaxis()->SetBinLabel(2, "evt sel"); flatchrg.get(HIST("hEvtMCRec"))->GetXaxis()->SetBinLabel(3, "INELgt0"); - flatchrg.add("hEvtMcGenRecColl", "hEvtMcGenRecColl", {HistType::kTH1F, {{2, 0.f, 2.f}}}); + flatchrg.add("hEvtMcGenRecColl", "hEvtMcGenRecColl", {kTH1F, {{2, 0.f, 2.f}}}); flatchrg.get(HIST("hEvtMcGenRecColl"))->GetXaxis()->SetBinLabel(1, "INEL"); flatchrg.get(HIST("hEvtMcGenRecColl"))->GetXaxis()->SetBinLabel(2, "INELgt0"); - flatchrg.add("hFlatGenINELgt0", "hFlatGenINELgt0", {HistType::kTH1F, {flatAxis}}); + flatchrg.add("hFlatGenINELgt0", "hFlatGenINELgt0", {kTH1F, {flatAxis}}); for (int i = 0; i < NpartChrg; ++i) { - flatchrg.add({fmt::format(kPtGenPrimSgnF.data(), kSpecies[i]).c_str(), " ; p_{T} (GeV/c)", {HistType::kTH3F, {multAxis, flatAxis, ptAxis}}}); - flatchrg.add({fmt::format(kPtGenPrimSgnINELF.data(), kSpecies[i]).c_str(), " ; p_{T} (GeV/c)", {HistType::kTH3F, {multAxis, flatAxis, ptAxis}}}); - flatchrg.add({fmt::format(kPtRecCollPrimSgnF.data(), kSpecies[i]).c_str(), " ; p_{T} (GeV/c)", {HistType::kTH3F, {multAxis, flatAxis, ptAxis}}}); - flatchrg.add({fmt::format(kPtRecCollPrimSgnINELF.data(), kSpecies[i]).c_str(), " ; p_{T} (GeV/c)", {HistType::kTH3F, {multAxis, flatAxis, ptAxis}}}); - flatchrg.add({fmt::format(kPtGenRecCollPrimSgnF.data(), kSpecies[i]).c_str(), " ; p_{T} (GeV/c)", {HistType::kTH3F, {multAxis, flatAxis, ptAxis}}}); - flatchrg.add({fmt::format(kPtGenRecCollPrimSgnINELF.data(), kSpecies[i]).c_str(), " ; p_{T} (GeV/c)", {HistType::kTH3F, {multAxis, flatAxis, ptAxis}}}); + flatchrg.add({fmt::format(kPtGenPrimSgnF.data(), kSpecies[i]).c_str(), " ; p_{T} (GeV/c)", {kTH3F, {multAxis, flatAxis, ptAxis}}}); + flatchrg.add({fmt::format(kPtGenPrimSgnINELF.data(), kSpecies[i]).c_str(), " ; p_{T} (GeV/c)", {kTH3F, {multAxis, flatAxis, ptAxis}}}); + flatchrg.add({fmt::format(kPtRecCollPrimSgnF.data(), kSpecies[i]).c_str(), " ; p_{T} (GeV/c)", {kTH3F, {multAxis, flatAxis, ptAxis}}}); + flatchrg.add({fmt::format(kPtRecCollPrimSgnINELF.data(), kSpecies[i]).c_str(), " ; p_{T} (GeV/c)", {kTH3F, {multAxis, flatAxis, ptAxis}}}); + flatchrg.add({fmt::format(kPtGenRecCollPrimSgnF.data(), kSpecies[i]).c_str(), " ; p_{T} (GeV/c)", {kTH3F, {multAxis, flatAxis, ptAxis}}}); + flatchrg.add({fmt::format(kPtGenRecCollPrimSgnINELF.data(), kSpecies[i]).c_str(), " ; p_{T} (GeV/c)", {kTH3F, {multAxis, flatAxis, ptAxis}}}); } } @@ -630,6 +726,14 @@ struct FlattenictyPikp { auto timestamp = bc.timestamp(); auto runnumber = bc.runNumber(); + if (trkSelOpt.cfgRejectTrkAtTPCSector || v0SelOpt.cfgRejectV0sAtTPCSector) { + grpmag = ccdb->getForRun(ccdbConf.grpmagPath, runnumber); + if (!grpmag) { + LOG(fatal) << "Got nullptr from CCDB for path " << ccdbConf.grpmagPath << " of object GRPMagField and " << ccdbConf.grpPath << " of object GRPObject for run " << runnumber; + } + magField = std::lround(5.f * grpmag->getL3Current() / 30000.f); + LOG(info) << "Retrieved GRP for run " << runnumber << " with magnetic field of " << magField << " kZG"; + } if (applyCalibGain) { fullPathCalibGain = cfgGainEqCcdbPath; fullPathCalibGain += "/FV0"; @@ -643,7 +747,6 @@ struct FlattenictyPikp { fv0AmplCorr = *(objfv0Gain); } } - if (applyCalibVtx) { fullPathCalibVtx = cfgVtxEqCcdbPath; fullPathCalibVtx += "/FV0"; @@ -656,7 +759,7 @@ struct FlattenictyPikp { using CollsGen = soa::Join; using MCColls = soa::Join; using CollsGenSgn = soa::SmallGroups>; - using MyPIDTracks = soa::Join; + using MyPIDTracks = soa::Join; using MyLabeledTracks = soa::Join; using MyFiltLabeledTracks = soa::Filtered; using MyLabeledPIDTracks = soa::Join; @@ -676,8 +779,8 @@ struct FlattenictyPikp { template bool isPID(const P& mcParticle) { - static_assert(pidSgn == 0 || pidSgn == 1); - static_assert(id > 0 || id < Npart); + static_assert(pidSgn == kNull || pidSgn == 1); + static_assert(id > kNull || id < Npart); constexpr int kIdx = id + pidSgn * Npart; return mcParticle.pdgCode() == PidSgn[kIdx]; } @@ -696,10 +799,17 @@ struct FlattenictyPikp { template bool selTOFPi(T const& track) { - if (track.p() < trkSelOpt.cfgMomSelPiTOF) { - if (track.hasTOF()) { - if (std::abs(track.tpcNSigmaPi()) < v0SelOpt.cfgNsigmaPiTPC && std::abs(track.tofNSigmaPi()) < v0SelOpt.cfgNsigmaPiTOF) { + if (track.hasTOF() && track.goodTOFMatch()) { + const float tTOF = track.tofSignal(); + const float trkLength = track.length(); + const float tExpPiTOF = track.tofExpSignalPi(tTOF); + if (track.p() >= trkSelOpt.cfgMomSelPiTOF && trkLength > kNull && tTOF > kNull) { + flatchrg.fill(HIST("Tracks/CleanTof/hTofExpPi"), track.p(), tExpPiTOF / tTOF); + if (std::abs((tExpPiTOF / tTOF) - kOne) < trkSelOpt.cfgTofBetaPiMax) { + flatchrg.fill(HIST("Tracks/CleanTof/hBetaVsP"), track.p(), track.beta()); + // if (std::abs(track.tpcNSigmaPi()) < v0SelOpt.cfgNsigmaPiTPC && std::abs(track.tofNSigmaPi()) < v0SelOpt.cfgNsigmaPiTOF) { return true; + // } } } } @@ -707,7 +817,7 @@ struct FlattenictyPikp { } template - void fillNsigma(T const& tracks, const C& collision) + void fillNsigma(T const& tracks, C const& collision) { const float mult = getMult(collision); const float flat = fillFlat(collision); @@ -717,12 +827,10 @@ struct FlattenictyPikp { } template - void filldEdx(T const& tracks, V const& v0s, const C& collision, aod::BCsWithTimestamps const& /*bcs*/) + void filldEdx(T const& tracks, V const& v0s, C const& collision, aod::BCsWithTimestamps const& /*bcs*/) { - auto bc = collision.template bc_as(); - auto magField = (ccdbConf.cfgMagField == 0) ? getMagneticField(bc.timestamp()) : ccdbConf.cfgMagField; - - if (applyCalibGain || applyCalibVtx) { + if (trkSelOpt.cfgRejectTrkAtTPCSector || v0SelOpt.cfgRejectV0sAtTPCSector || applyCalibGain || applyCalibVtx) { + auto bc = collision.template bc_as(); int currentRun = bc.runNumber(); if (runNumber != currentRun) { initCCDB(bc); @@ -747,7 +855,7 @@ struct FlattenictyPikp { } if (cfgFilldEdxCalibHist && cfgFilldEdxQaHist) { if (cfgFillChrgType) { - if (track.sign() * track.tpcInnerParam() > 0) { + if (track.sign() * track.tpcInnerParam() > kNull) { filldEdxQA(track, collision, dEdx); } else { filldEdxQA(track, collision, dEdx); @@ -760,7 +868,7 @@ struct FlattenictyPikp { if (cfgFillChrgType) { dEdx *= (50.0 / getCalibration(fDeDxVsEta, track)); if (cfgFilldEdxQaHist) { - if (track.sign() * track.tpcInnerParam() > 0) { + if (track.sign() * track.tpcInnerParam() > kNull) { filldEdxQA(track, collision, dEdx); } else { filldEdxQA(track, collision, dEdx); @@ -776,7 +884,7 @@ struct FlattenictyPikp { // PID TPC dEdx if (cfgFillChrgType) { - if (track.sign() * track.tpcInnerParam() > 0) { + if (track.sign() * track.tpcInnerParam() > kNull) { flatchrg.fill(HIST(kPrefix) + HIST(kCharge[kPos]) + HIST("hdEdx"), track.eta(), mult, flat, track.tpcInnerParam(), dEdx); } else { flatchrg.fill(HIST(kPrefix) + HIST(kCharge[kNeg]) + HIST("hdEdx"), track.eta(), mult, flat, track.tpcInnerParam(), dEdx); @@ -787,29 +895,27 @@ struct FlattenictyPikp { // TOF pions if (cfgFillV0Hist) { - if (track.hasTOF() && track.beta() > 1.) { - if (selTOFPi(track)) { - if (cfgFillChrgType) { - if (track.sign() * track.tpcInnerParam() > 0) { - if (cfgStoreThnSparse) { - flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[kPos]) + HIST("hPiTof"), track.eta(), mult, flat, track.tpcInnerParam(), dEdx); - } else { - flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[kPos]) + HIST("hPiTof"), track.eta(), track.tpcInnerParam(), dEdx); - } + if (selTOFPi(track)) { + if (cfgFillChrgType) { + if (track.sign() * track.tpcInnerParam() > kNull) { + if (cfgStoreThnSparse) { + flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[kPos]) + HIST("hPiTof"), track.eta(), mult, flat, track.tpcInnerParam(), dEdx); } else { - if (cfgStoreThnSparse) { - flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[kNeg]) + HIST("hPiTof"), track.eta(), mult, flat, track.tpcInnerParam(), dEdx); - } else { - flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[kNeg]) + HIST("hPiTof"), track.eta(), track.tpcInnerParam(), dEdx); - } + flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[kPos]) + HIST("hPiTof"), track.eta(), track.tpcInnerParam(), dEdx); } } else { if (cfgStoreThnSparse) { - flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[kAll]) + HIST("hPiTof"), track.eta(), mult, flat, track.tpcInnerParam(), dEdx); + flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[kNeg]) + HIST("hPiTof"), track.eta(), mult, flat, track.tpcInnerParam(), dEdx); } else { - flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[kAll]) + HIST("hPiTof"), track.eta(), track.tpcInnerParam(), dEdx); + flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[kNeg]) + HIST("hPiTof"), track.eta(), track.tpcInnerParam(), dEdx); } } + } else { + if (cfgStoreThnSparse) { + flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[kAll]) + HIST("hPiTof"), track.eta(), mult, flat, track.tpcInnerParam(), dEdx); + } else { + flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[kAll]) + HIST("hPiTof"), track.eta(), track.tpcInnerParam(), dEdx); + } } } } @@ -818,7 +924,10 @@ struct FlattenictyPikp { // V0s if (cfgFillV0Hist) { for (const auto& v0 : v0s) { - if (!isGoodV0Track(v0, tracks)) { + if (v0.v0Type() != v0SelOpt.cfgV0TypeSel && v0SelOpt.cfgV0TypeSel > -1) { + continue; + } + if (!isGoodV0Track(v0, tracks, magField)) { continue; } @@ -832,7 +941,7 @@ struct FlattenictyPikp { dEdxNeg *= (50.0 / getCalibration(fDeDxVsEta, negTrack)); } - if (selectTypeV0s(v0, posTrack, negTrack) == kGa) { // Gamma selection + if (selectTypeV0s(collision, v0, posTrack, negTrack) == kGa) { // Gamma selection if (cfgStoreThnSparse) { flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kPos]) + HIST("hEV0"), posTrack.eta(), mult, flat, posTrack.sign() * posTrack.tpcInnerParam(), dEdxPos); flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kNeg]) + HIST("hEV0"), negTrack.eta(), mult, flat, negTrack.sign() * negTrack.tpcInnerParam(), dEdxNeg); @@ -841,7 +950,7 @@ struct FlattenictyPikp { flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kNeg]) + HIST("hEV0"), negTrack.eta(), negTrack.sign() * negTrack.tpcInnerParam(), dEdxNeg); } } - if (selectTypeV0s(v0, posTrack, negTrack) == kKz) { // K0S -> pi + pi + if (selectTypeV0s(collision, v0, posTrack, negTrack) == kKz) { // K0S -> pi + pi if (cfgStoreThnSparse) { flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kPos]) + HIST("hPiV0"), posTrack.eta(), mult, flat, posTrack.sign() * posTrack.tpcInnerParam(), dEdxPos); flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kNeg]) + HIST("hPiV0"), negTrack.eta(), mult, flat, negTrack.sign() * negTrack.tpcInnerParam(), dEdxNeg); @@ -850,21 +959,21 @@ struct FlattenictyPikp { flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kNeg]) + HIST("hPiV0"), negTrack.eta(), negTrack.sign() * negTrack.tpcInnerParam(), dEdxNeg); } } - if (selectTypeV0s(v0, posTrack, negTrack) == kLam) { // L -> p + pi- + if (selectTypeV0s(collision, v0, posTrack, negTrack) == kLam) { // L -> p + pi- if (cfgStoreThnSparse) { flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kPos]) + HIST("hPV0"), posTrack.eta(), mult, flat, posTrack.sign() * posTrack.tpcInnerParam(), dEdxPos); - flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kNeg]) + HIST("hPV0"), negTrack.eta(), mult, flat, negTrack.sign() * negTrack.tpcInnerParam(), dEdxNeg); + flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kNeg]) + HIST("hPiV0"), negTrack.eta(), mult, flat, negTrack.sign() * negTrack.tpcInnerParam(), dEdxNeg); } else { flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kPos]) + HIST("hPV0"), posTrack.eta(), posTrack.sign() * posTrack.tpcInnerParam(), dEdxPos); - flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kNeg]) + HIST("hPV0"), negTrack.eta(), negTrack.sign() * negTrack.tpcInnerParam(), dEdxNeg); + flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kNeg]) + HIST("hPiV0"), negTrack.eta(), negTrack.sign() * negTrack.tpcInnerParam(), dEdxNeg); } } - if (selectTypeV0s(v0, posTrack, negTrack) == kaLam) { // L -> p + pi- + if (selectTypeV0s(collision, v0, posTrack, negTrack) == kaLam) { // L -> p + pi- if (cfgStoreThnSparse) { - flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kPos]) + HIST("hPiV0"), posTrack.eta(), mult, flat, posTrack.sign() * posTrack.tpcInnerParam(), dEdxPos); + flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kPos]) + HIST("hPV0"), posTrack.eta(), mult, flat, posTrack.sign() * posTrack.tpcInnerParam(), dEdxPos); flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kNeg]) + HIST("hPiV0"), negTrack.eta(), mult, flat, negTrack.sign() * negTrack.tpcInnerParam(), dEdxNeg); } else { - flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kPos]) + HIST("hPiV0"), posTrack.eta(), posTrack.sign() * posTrack.tpcInnerParam(), dEdxPos); + flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kPos]) + HIST("hPV0"), posTrack.eta(), posTrack.sign() * posTrack.tpcInnerParam(), dEdxPos); flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kNeg]) + HIST("hPiV0"), negTrack.eta(), negTrack.sign() * negTrack.tpcInnerParam(), dEdxNeg); } } @@ -877,7 +986,7 @@ struct FlattenictyPikp { { float valCalib = -1.; if constexpr (isChrg) { - if (track.sign() * track.tpcInnerParam() > 0) { + if (track.sign() * track.tpcInnerParam() > kNull) { valCalib = fCalib.at(0)->Eval(track.eta()); } else { valCalib = fCalib.at(1)->Eval(track.eta()); @@ -905,15 +1014,15 @@ struct FlattenictyPikp { return true; // cut to remove tracks at TPC boundaries double phimodn = track.phi(); - if (mag < 0) // for negative polarity field + if (mag < kNull) // for negative polarity field phimodn = o2::constants::math::TwoPI - phimodn; - if (track.sign() < 0) // for negative charge + if (track.sign() < kNull) // for negative charge phimodn = o2::constants::math::TwoPI - phimodn; - if (phimodn < 0) - LOGF(warning, "phi < 0: %g", phimodn); + if (phimodn < kNull) + LOGF(warning, "phi < kNull: %g", phimodn); - phimodn += o2::constants::math::PI / 18.0; // to center gap in the middle - phimodn = std::fmod(phimodn, o2::constants::math::PI / 9.0); + phimodn += o2::constants::math::PI / 18.0f; // to center gap in the middle + phimodn = std::fmod(phimodn, o2::constants::math::PI / 9.0f); if (cfgFillTrackQaHist) { flatchrg.fill(HIST("Tracks/preSel/hPtPhi"), track.pt(), phimodn); @@ -944,6 +1053,7 @@ struct FlattenictyPikp { template bool isGoodTrack(T const& track, int const magfield) { + flatchrg.fill(HIST("Tracks/hTrkSel"), trkSelAll); if (std::abs(track.eta()) > trkSelOpt.cfgTrkEtaMax) { return false; } @@ -965,55 +1075,102 @@ struct FlattenictyPikp { return false; } flatchrg.fill(HIST("Tracks/hTrkSel"), trkSelNCls); - if (trkSelOpt.cfgUseExtraTrkCut && !phiCut(track, magfield, fPhiCutLow, fPhiCutHigh)) { + if (trkSelOpt.cfgRejectTrkAtTPCSector && !phiCut(track, magfield, fPhiCutLow, fPhiCutHigh)) { return false; } flatchrg.fill(HIST("Tracks/hTrkSel"), trkSelTPCBndr); return true; } - template - int selectTypeV0s(T1 const& v0, T2 const& postrk, T2 const& negtrk) + template + int selectTypeV0s(C const& collision, T1 const& v0, T2 const& postrk, T2 const& negtrk) { // Gamma selection - if (v0.mGamma() < v0SelOpt.cfgdmassG) { - if (postrk.tpcInnerParam() < v0SelOpt.cfgV0DaughterTpcMomMax && postrk.hasTPC() && std::abs(postrk.tpcNSigmaEl()) < v0SelOpt.cfgNsigmaElTPC) { - if (postrk.hasTOF() && std::abs(postrk.tofNSigmaEl()) < v0SelOpt.cfgNsigmaElTOF) { - return kGa; - } - } - if (negtrk.tpcInnerParam() < v0SelOpt.cfgV0DaughterTpcMomMax && negtrk.hasTPC() && std::abs(negtrk.tpcNSigmaEl()) < v0SelOpt.cfgNsigmaElTPC) { - if (negtrk.hasTOF() && std::abs(negtrk.tofNSigmaEl()) < v0SelOpt.cfgNsigmaElTOF) { - return kGa; + const float yGamma = RecoDecay::y(std::array{v0.px(), v0.py(), v0.pz()}, o2::constants::physics::MassGamma); + if (v0.mGamma() < v0SelOpt.cfgdmassG) { // inv mass cut + if (std::abs(yGamma) < v0SelOpt.cfgV0Ymax) { // rapidity cut + if (std::abs(v0.alpha()) < v0SelOpt.cfgArmPodGammasalpha && v0.qtarm() < v0SelOpt.cfgArmPodGammasqT) { // + if (/*postrk.tpcInnerParam() < v0SelOpt.cfgV0DaughterTpcMomMax &&*/ postrk.hasTPC() && std::abs(postrk.tpcNSigmaEl()) < v0SelOpt.cfgNsigmaElTPC) { + if (postrk.hasTOF() && std::abs(postrk.tofNSigmaEl()) < v0SelOpt.cfgNsigmaElTOF) { + return kGa; + } + } + if (/*negtrk.tpcInnerParam() < v0SelOpt.cfgV0DaughterTpcMomMax &&*/ negtrk.hasTPC() && std::abs(negtrk.tpcNSigmaEl()) < v0SelOpt.cfgNsigmaElTPC) { + if (negtrk.hasTOF() && std::abs(negtrk.tofNSigmaEl()) < v0SelOpt.cfgNsigmaElTOF) { + return kGa; + } + } + flatchrg.fill(HIST("Tracks/V0qa/hEtaVsRapGamma"), negtrk.eta(), yGamma); + flatchrg.fill(HIST("Tracks/V0qa/hEtaVsRapGamma"), postrk.eta(), yGamma); + flatchrg.fill(HIST("Tracks/V0qa/hArmPodGamma"), v0.alpha(), v0.qtarm()); + flatchrg.fill(HIST("Tracks/V0qa/hMassGammaVsPt"), v0.pt(), v0.mGamma()); + flatchrg.fill(HIST("Tracks/V0qa/hNsigmaElFromGamma"), postrk.pt(), postrk.tpcNSigmaEl()); + flatchrg.fill(HIST("Tracks/V0qa/hNsigmaElFromGamma"), negtrk.pt(), negtrk.tpcNSigmaEl()); } } } // K0S selection, K0S -> pi + pi - if (std::abs(v0.mK0Short() - o2::constants::physics::MassK0Short) < v0SelOpt.cfgdmassK) { - if (postrk.tpcInnerParam() < v0SelOpt.cfgV0DaughterTpcMomMax && postrk.hasTPC() && std::abs(postrk.tpcNSigmaPi()) < v0SelOpt.cfgNsigmaPiTPC) { - if (postrk.hasTOF() && std::abs(postrk.tofNSigmaPi()) < v0SelOpt.cfgNsigmaElTOF) { - return kKz; - } - } - if (negtrk.tpcInnerParam() < v0SelOpt.cfgV0DaughterTpcMomMax && negtrk.hasTPC() && std::abs(negtrk.tpcNSigmaPi()) < v0SelOpt.cfgNsigmaPiTPC) { - if (negtrk.hasTOF() && std::abs(negtrk.tofNSigmaPi()) < v0SelOpt.cfgNsigmaPiTOF) { - return kKz; + if (std::abs(v0.mK0Short() - o2::constants::physics::MassK0Short) < v0SelOpt.cfgdmassK) { // inv mass cut + if (std::abs(v0.yK0Short()) < v0SelOpt.cfgV0Ymax) { // rapidity cut + if (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < v0SelOpt.cfgcTauK0s) { // ctau cut + if (v0.v0cosPA() >= v0SelOpt.cfgCosPAK0s && v0.v0radius() >= v0SelOpt.cfgV0radiusK0s && v0.qtarm() * v0SelOpt.cfgArmPodK0s > std::abs(v0.alpha())) { // + if (/*postrk.tpcInnerParam() < v0SelOpt.cfgV0DaughterTpcMomMax &&*/ postrk.hasTPC() && std::abs(postrk.tpcNSigmaPi()) < v0SelOpt.cfgNsigmaPiTPC) { + if (postrk.hasTOF() && std::abs(postrk.tofNSigmaPi()) < v0SelOpt.cfgNsigmaPiTOF) { + return kKz; + } + } + if (/*negtrk.tpcInnerParam() < v0SelOpt.cfgV0DaughterTpcMomMax &&*/ negtrk.hasTPC() && std::abs(negtrk.tpcNSigmaPi()) < v0SelOpt.cfgNsigmaPiTPC) { + if (negtrk.hasTOF() && std::abs(negtrk.tofNSigmaPi()) < v0SelOpt.cfgNsigmaPiTOF) { + return kKz; + } + } + flatchrg.fill(HIST("Tracks/V0qa/hEtaVsRapK0s"), negtrk.eta(), v0.yK0Short()); + flatchrg.fill(HIST("Tracks/V0qa/hEtaVsRapK0s"), postrk.eta(), v0.yK0Short()); + flatchrg.fill(HIST("Tracks/V0qa/hArmPodK0s"), v0.alpha(), v0.qtarm()); + flatchrg.fill(HIST("Tracks/V0qa/hMassK0sVsPt"), v0.pt(), v0.mK0Short()); + flatchrg.fill(HIST("Tracks/V0qa/hNsigmaPiFromK0s"), postrk.pt(), postrk.tpcNSigmaPi()); + flatchrg.fill(HIST("Tracks/V0qa/hNsigmaPiFromK0s"), negtrk.pt(), negtrk.tpcNSigmaPi()); + } } } } // Lambda selection, L -> p + pi- - if (std::abs(v0.mLambda() - o2::constants::physics::MassLambda0) < v0SelOpt.cfgdmassL) { - if (postrk.tpcInnerParam() < v0SelOpt.cfgV0DaughterTpcMomMax && postrk.hasTPC() && std::abs(postrk.tpcNSigmaPr()) < v0SelOpt.cfgNsigmaPrTPC && negtrk.hasTPC() && std::abs(negtrk.tpcNSigmaPi()) < v0SelOpt.cfgNsigmaPiTPC) { - if (postrk.hasTOF() && std::abs(postrk.tofNSigmaPr()) < v0SelOpt.cfgNsigmaPrTOF && negtrk.hasTOF() && std::abs(negtrk.tofNSigmaPi()) < v0SelOpt.cfgNsigmaPiTOF) { - return kLam; + if (std::abs(v0.mLambda() - o2::constants::physics::MassLambda0) < v0SelOpt.cfgdmassL) { // inv mass cut + if (std::abs(v0.yLambda()) < v0SelOpt.cfgV0Ymax) { // rapidity cut + if (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 < v0SelOpt.cfgcTauLambda) { // ctau cut + if (v0.v0cosPA() >= v0SelOpt.cfgCosPALambda && v0.v0radius() >= v0SelOpt.cfgV0radiusLambda) { // + if (/*postrk.tpcInnerParam() < v0SelOpt.cfgV0DaughterTpcMomMax &&*/ postrk.hasTPC() && std::abs(postrk.tpcNSigmaPr()) < v0SelOpt.cfgNsigmaPrTPC && negtrk.hasTPC() && std::abs(negtrk.tpcNSigmaPi()) < v0SelOpt.cfgNsigmaPiTPC) { + if (postrk.hasTOF() && std::abs(postrk.tofNSigmaPr()) < v0SelOpt.cfgNsigmaPrTOF && negtrk.hasTOF() && std::abs(negtrk.tofNSigmaPi()) < v0SelOpt.cfgNsigmaPiTOF) { + return kLam; + } + } + flatchrg.fill(HIST("Tracks/V0qa/hEtaVsRapLam"), negtrk.eta(), v0.yLambda()); + flatchrg.fill(HIST("Tracks/V0qa/hEtaVsRapLam"), postrk.eta(), v0.yLambda()); + flatchrg.fill(HIST("Tracks/V0qa/hArmPodLam"), v0.alpha(), v0.qtarm()); + flatchrg.fill(HIST("Tracks/V0qa/hMassLamVsPt"), v0.pt(), v0.mLambda()); + flatchrg.fill(HIST("Tracks/V0qa/hNsigmaPrFromLam"), postrk.pt(), postrk.tpcNSigmaPr()); + flatchrg.fill(HIST("Tracks/V0qa/hNsigmaPiFromLam"), negtrk.pt(), negtrk.tpcNSigmaPi()); + } } } } // antiLambda -> pbar + pi+ - if (std::abs(v0.mAntiLambda() - o2::constants::physics::MassLambda0) < v0SelOpt.cfgdmassL) { - if (postrk.tpcInnerParam() < v0SelOpt.cfgV0DaughterTpcMomMax && postrk.hasTPC() && std::abs(postrk.tpcNSigmaPi()) < v0SelOpt.cfgNsigmaPiTPC && negtrk.hasTPC() && std::abs(negtrk.tpcNSigmaPr()) < v0SelOpt.cfgNsigmaPrTPC) { - if (postrk.hasTOF() && std::abs(postrk.tofNSigmaPi()) < v0SelOpt.cfgNsigmaPiTOF && negtrk.hasTOF() && std::abs(negtrk.tofNSigmaPr()) < v0SelOpt.cfgNsigmaPrTOF) { - return kaLam; + if (std::abs(v0.mAntiLambda() - o2::constants::physics::MassLambda0) < v0SelOpt.cfgdmassL) { // inv mass cut + if (std::abs(v0.yLambda()) < v0SelOpt.cfgV0Ymax) { // rapidity cut + if (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 < v0SelOpt.cfgcTauLambda) { // ctau cut + if (v0.v0cosPA() >= v0SelOpt.cfgCosPALambda && v0.v0radius() >= v0SelOpt.cfgV0radiusLambda) { // + if (/*postrk.tpcInnerParam() < v0SelOpt.cfgV0DaughterTpcMomMax &&*/ postrk.hasTPC() && std::abs(postrk.tpcNSigmaPi()) < v0SelOpt.cfgNsigmaPiTPC && negtrk.hasTPC() && std::abs(negtrk.tpcNSigmaPr()) < v0SelOpt.cfgNsigmaPrTPC) { + if (postrk.hasTOF() && std::abs(postrk.tofNSigmaPi()) < v0SelOpt.cfgNsigmaPiTOF && negtrk.hasTOF() && std::abs(negtrk.tofNSigmaPr()) < v0SelOpt.cfgNsigmaPrTOF) { + return kaLam; + } + } + flatchrg.fill(HIST("Tracks/V0qa/hEtaVsRapALam"), negtrk.eta(), v0.yLambda()); + flatchrg.fill(HIST("Tracks/V0qa/hEtaVsRapALam"), postrk.eta(), v0.yLambda()); + flatchrg.fill(HIST("Tracks/V0qa/hArmPodALam"), v0.alpha(), v0.qtarm()); + flatchrg.fill(HIST("Tracks/V0qa/hMassALamVsPt"), v0.pt(), v0.mLambda()); + flatchrg.fill(HIST("Tracks/V0qa/hNsigmaPiFromALam"), postrk.pt(), postrk.tpcNSigmaPi()); + flatchrg.fill(HIST("Tracks/V0qa/hNsigmaPrFromALam"), negtrk.pt(), negtrk.tpcNSigmaPr()); + } } } } @@ -1021,32 +1178,50 @@ struct FlattenictyPikp { } template - bool isGoodV0Track(T1 const& v0, T2 const& /*track*/) + bool isGoodV0Track(T1 const& v0, T2 const& /*track*/, int const magfield) { const auto& posTrack = v0.template posTrack_as(); const auto& negTrack = v0.template negTrack_as(); + flatchrg.fill(HIST("Tracks/V0qa/hV0Sel"), v0SelAll); if (std::abs(posTrack.eta()) > v0SelOpt.cfgV0etamax || std::abs(negTrack.eta()) > v0SelOpt.cfgV0etamax) { return false; } + flatchrg.fill(HIST("Tracks/V0qa/hV0Sel"), v0SelEta); + if (!(selTrkV0sDaughters.IsSelected(posTrack) && selTrkV0sDaughters.IsSelected(negTrack))) { + return false; + } + flatchrg.fill(HIST("Tracks/V0qa/hV0Sel"), v0SelDaughters); if (posTrack.tpcNClsFound() < v0SelOpt.cfgTPCnClsmin || negTrack.tpcNClsFound() < v0SelOpt.cfgTPCnClsmin) { return false; } - if (posTrack.sign() * negTrack.sign() > 0) { // reject same sign pair + flatchrg.fill(HIST("Tracks/V0qa/hV0Sel"), v0SelTPCnClsFound); + if (v0SelOpt.cfgRejectV0sAtTPCSector) { + if (!(phiCut(posTrack, magfield, fPhiCutLow, fPhiCutHigh) && phiCut(negTrack, magfield, fPhiCutLow, fPhiCutHigh))) { + return false; + } + } + flatchrg.fill(HIST("Tracks/V0qa/hV0Sel"), v0SelRejectV0sAtTPCSector); + if (posTrack.sign() * negTrack.sign() > kNull) { // reject same sign pair return false; } + flatchrg.fill(HIST("Tracks/V0qa/hV0Sel"), v0SelRejectSameSign); if (v0.dcaV0daughters() > v0SelOpt.cfgDCAv0daughter) { return false; } + flatchrg.fill(HIST("Tracks/V0qa/hV0Sel"), v0SelDCAv0daughter); if (v0.v0cosPA() < v0SelOpt.cfgv0cospa) { return false; } + flatchrg.fill(HIST("Tracks/V0qa/hV0Sel"), v0SelCosPA); if (v0.v0radius() < v0SelOpt.cfgv0Rmin || v0.v0radius() > v0SelOpt.cfgv0Rmax) { return false; } - if (std::abs(v0.dcapostopv()) < v0SelOpt.cfgDCAposToPV || std::abs(v0.dcanegtopv()) < v0SelOpt.cfgDCAposToPV) { + flatchrg.fill(HIST("Tracks/V0qa/hV0Sel"), v0SelV0radius); + if (std::abs(v0.dcapostopv()) < v0SelOpt.cfgDCAposToPV || std::abs(v0.dcanegtopv()) < v0SelOpt.cfgDCAnegToPV) { return false; } + flatchrg.fill(HIST("Tracks/V0qa/hV0Sel"), v0SelDCAposToPV); if constexpr (fillHist) { flatchrg.fill(HIST("Tracks/V0qa/hV0Pt"), v0.pt()); flatchrg.fill(HIST("Tracks/V0qa/hV0ArmPod"), v0.alpha(), v0.qtarm()); @@ -1088,7 +1263,7 @@ struct FlattenictyPikp { break; } - if (track.sign() > 0) { + if (track.sign() > kNull) { if (cfgStoreThnSparse) { hThPtNsigmaTPC[pid]->Fill(track.pt(), valTPCnsigma, mult, flat); } else { @@ -1104,7 +1279,7 @@ struct FlattenictyPikp { if (!track.hasTOF()) { return; } - if (track.sign() > 0) { + if (track.sign() > kNull) { hPtNsigmaTOF[pid]->Fill(track.pt(), valTOFnsigma); hPtNsigmaTPCTOF[pid]->Fill(valTPCnsigma, valTOFnsigma); } else { @@ -1351,16 +1526,6 @@ struct FlattenictyPikp { return iRing; } - int getMagneticField(uint64_t timestamp) - { - o2::parameters::GRPMagField* grpmag = nullptr; - grpmag = ccdb->getForTimeStamp(ccdbConf.grpmagPath, timestamp); - if (!grpmag) { - return 0; - } - return grpmag->getNominalL3Field(); - } - template float getMult(C const& collision) { @@ -1400,7 +1565,7 @@ struct FlattenictyPikp { float flat{-1}; float mRho{0}; for (int iCell = 0; iCell < entries; ++iCell) { - if (signals[iCell] > 0.) { + if (signals[iCell] > kNull) { mRho += 1.0 * signals[iCell]; } } @@ -1413,13 +1578,13 @@ struct FlattenictyPikp { float sRhoTmp{0}; float sRho{0}; for (int iCell = 0; iCell < entries; ++iCell) { - if (signals[iCell] > 0.) { + if (signals[iCell] > kNull) { sRhoTmp += std::pow(1.0 * signals[iCell] - mRho, 2); } } sRhoTmp /= (1.0 * entries * entries); sRho = std::sqrt(sRhoTmp); - if (mRho > 0.) { + if (mRho > kNull) { flat = sRho / mRho; } else { flat = -1; @@ -1449,11 +1614,11 @@ struct FlattenictyPikp { flatchrg.fill(HIST("FV0/hFV0ampCorr"), chv0, amplCh / fv0AmplCorr[chv0]); } } - if (amplCh > 0.) { + if (amplCh > kNull) { if (applyCalibGain) { // equalize gain channel-by-channel amplCh /= fv0AmplCorr[chv0]; } - if (chv0phi > 0) { + if (chv0phi > kNull) { fv0AmplitudeWoCalib[chv0phi] = amplCh; if constexpr (fillHist) { flatchrg.fill(HIST("FV0/hFV0AmplWCalib"), ich, fv0AmplitudeWoCalib[ich]); @@ -1493,7 +1658,7 @@ struct FlattenictyPikp { if (i == static_cast(TrackSelection::TrackCuts::kDCAxy)) { continue; } - if (!mTrackSelector.IsSelected(track, static_cast(i))) { + if (!selTrkGlobal.IsSelected(track, static_cast(i))) { return false; } } @@ -1513,7 +1678,7 @@ struct FlattenictyPikp { if (i == static_cast(TrackSelection::TrackCuts::kDCAz)) { continue; } - if (!mTrackSelector.IsSelected(track, static_cast(i))) { + if (!selTrkGlobal.IsSelected(track, static_cast(i))) { return false; } } @@ -1627,16 +1792,16 @@ struct FlattenictyPikp { AxisSpec ptAxis{binOpt.axisPt, "#it{p}_{T} (GeV/#it{c})"}; constexpr int kHistIdx = id + pidSgn * Npart; auto kIdx = static_cast(id); - const std::string strID = Form("/%s/%s", (pidSgn == 0 && id < Npart) ? "pos" : "neg", Pid[kIdx]); - hPtEffRec[kHistIdx] = flatchrg.add("Tracks/hPtEffRec" + strID, " ; p_{T} (GeV/c)", HistType::kTH1F, {ptAxis}); - hPtEffGen[kHistIdx] = flatchrg.add("Tracks/hPtEffGen" + strID, " ; p_{T} (GeV/c)", HistType::kTH1F, {ptAxis}); + const std::string strID = Form("/%s/%s", (pidSgn == kNull && id < Npart) ? "pos" : "neg", Pid[kIdx]); + hPtEffRec[kHistIdx] = flatchrg.add("Tracks/hPtEffRec" + strID, " ; p_{T} (GeV/c)", kTH1F, {ptAxis}); + hPtEffGen[kHistIdx] = flatchrg.add("Tracks/hPtEffGen" + strID, " ; p_{T} (GeV/c)", kTH1F, {ptAxis}); } template void initEfficiency() { - static_assert(pidSgn == 0 || pidSgn == 1); - static_assert(id > 0 || id < Npart); + static_assert(pidSgn == kNull || pidSgn == 1); + static_assert(id > kNull || id < Npart); constexpr int kIdx = id + pidSgn * Npart; const TString partName = PidChrg[kIdx]; THashList* lhash = new THashList(); @@ -1658,7 +1823,7 @@ struct FlattenictyPikp { template void fillEfficiency() { - static_assert(pidSgn == 0 || pidSgn == 1); + static_assert(pidSgn == kNull || pidSgn == 1); constexpr int kHistIdx = id + pidSgn * Npart; const char* partName = PidChrg[kHistIdx]; THashList* lhash = static_cast(listEfficiency->FindObject(partName)); @@ -1682,7 +1847,7 @@ struct FlattenictyPikp { template void fillMCRecTrack(MyLabeledPIDTracks::iterator const& track, const float mult, const float flat) { - static_assert(pidSgn == 0 || pidSgn == 1); + static_assert(pidSgn == kNull || pidSgn == 1); constexpr int kHistIdx = id + pidSgn * Npart; const aod::McParticles::iterator& mcParticle = track.mcParticle(); const CollsGen::iterator& collision = track.collision_as(); @@ -1739,7 +1904,7 @@ struct FlattenictyPikp { template void fillMCGen(aod::McParticles::iterator const& mcParticle, const float mult, const float flat) { - static_assert(pidSgn == 0 || pidSgn == 1); + static_assert(pidSgn == kNull || pidSgn == 1); constexpr int kHistIdx = id + pidSgn * Npart; if (!isPID(mcParticle)) { @@ -1865,7 +2030,7 @@ struct FlattenictyPikp { } // Evt loss num flatchrg.fill(HIST("hEvtMcGenRecColl"), 0.5); - if (nRecCollINELgt0 > 0) { + if (nRecCollINELgt0 > kNull) { flatchrg.fill(HIST("hEvtMcGenRecColl"), 1.5); } @@ -1908,9 +2073,14 @@ struct FlattenictyPikp { continue; } const auto& coll = track.collision_as(); - auto bc = coll.template bc_as(); - auto magField = (ccdbConf.cfgMagField == 0) ? getMagneticField(bc.timestamp()) : ccdbConf.cfgMagField; - + if (trkSelOpt.cfgRejectTrkAtTPCSector) { + auto bc = coll.template bc_as(); + int currentRun = bc.runNumber(); + if (runNumber != currentRun) { + initCCDB(bc); + runNumber = currentRun; + } + } if (!isGoodEvent(coll)) { continue; } From e0481d539c02eea7792e7248b4623fa2c068abc3 Mon Sep 17 00:00:00 2001 From: Francesca Ercolessi Date: Fri, 12 Sep 2025 15:23:32 +0200 Subject: [PATCH 373/986] [PWGLF] V0 analysis: add feeddown for Lambdas (#12971) --- PWGLF/Tasks/Strangeness/v0postprocessing.cxx | 51 ++++++++++---------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/v0postprocessing.cxx b/PWGLF/Tasks/Strangeness/v0postprocessing.cxx index 4f6ab094f46..946cef56144 100644 --- a/PWGLF/Tasks/Strangeness/v0postprocessing.cxx +++ b/PWGLF/Tasks/Strangeness/v0postprocessing.cxx @@ -13,14 +13,16 @@ /// \author Francesca Ercolessi (francesca.ercolessi@cern.ch) /// \since -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Common/DataModel/TrackSelectionTables.h" #include "PWGLF/DataModel/LFStrangenessTables.h" #include "PWGLF/DataModel/v0qaanalysis.h" + #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + #include "CommonConstants/PhysicsConstants.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" using namespace o2; using namespace o2::framework; @@ -122,11 +124,11 @@ struct v0postprocessing { registry.add("hMassLambda_MC", "hMassLambda", {HistType::kTH1F, {{200, 1.016f, 1.216f}}}); registry.add("hMassVsPtLambdaVsCentFT0M_MC", ";p_{T} [GeV/c];M_{p^{+}#pi^{-}} [GeV/c^{2}]", {HistType::kTH3F, {{250, 0.0f, 25.0f}, {100, 0.f, 100.f}, {200, 1.016f, 1.216f}}}); registry.add("hMassAntiLambda_MC", "hMassAntiLambda", {HistType::kTH1F, {{200, 1.016f, 1.216f}}}); - registry.add("hMassVsPtLambdaVsMotherPt_DoubleCharged_MC", ";p_{T} [GeV/c] (V0);p_{T}^{gen} [GeV/c] (Xi);M_{p^{-}#pi^{+}} [GeV/c^{2}]", {HistType::kTH3F, {{250, 0.0f, 25.0f}, {250, 0.0f, 25.0f}, {200, 1.016f, 1.216f}}}); - registry.add("hMassVsPtLambdaVsMotherPt_MCRatio_MC", ";p_{T} [GeV/c] (V0);p_{T}^{gen} [GeV/c] (Xi);M_{p^{-}#pi^{+}} [GeV/c^{2}]", {HistType::kTH3F, {{250, 0.0f, 25.0f}, {250, 0.0f, 25.0f}, {200, 1.016f, 1.216f}}}); + registry.add("hFDVsPtLambdaVsMotherPt_DoubleCharged_MC", ";p_{T} [GeV/c] (V0);p_{T}^{gen} [GeV/c] (#Xi^{-}); percentile", {HistType::kTH3F, {{250, 0.0f, 25.0f}, {250, 0.0f, 25.0f}, {100, 0.f, 100.f}}}); + registry.add("hFDVsPtLambdaVsMotherPt_MCRatio_MC", ";p_{T} [GeV/c] (V0);p_{T}^{gen} [GeV/c] (#Xi^{-/0}); percentile", {HistType::kTH3F, {{250, 0.0f, 25.0f}, {250, 0.0f, 25.0f}, {100, 0.f, 100.f}}}); registry.add("hMassVsPtAntiLambdaVsCentFT0M_MC", ";p_{T} [GeV/c];M_{p^{-}#pi^{+}} [GeV/c^{2}]", {HistType::kTH3F, {{250, 0.0f, 25.0f}, {100, 0.f, 100.f}, {200, 1.016f, 1.216f}}}); - registry.add("hMassVsPtAntiLambdaVsMotherPt_DoubleCharged_MC", ";p_{T} [GeV/c] (V0);p_{T}^{gen} [GeV/c] (Xi);M_{p^{-}#pi^{+}} [GeV/c^{2}]", {HistType::kTH3F, {{250, 0.0f, 25.0f}, {250, 0.0f, 25.0f}, {200, 1.016f, 1.216f}}}); - registry.add("hMassVsPtAntiLambdaVsMotherPt_MCRatio_MC", ";p_{T} [GeV/c] (V0);p_{T}^{gen} [GeV/c] (Xi);M_{p^{-}#pi^{+}} [GeV/c^{2}]", {HistType::kTH3F, {{250, 0.0f, 25.0f}, {250, 0.0f, 25.0f}, {200, 1.016f, 1.216f}}}); + registry.add("hFDVsPtAntiLambdaVsMotherPt_DoubleCharged_MC", ";p_{T} [GeV/c] (V0);p_{T}^{gen} [GeV/c] (#bar{#Xi}^{+});percentile", {HistType::kTH3F, {{250, 0.0f, 25.0f}, {250, 0.0f, 25.0f}, {100, 0.f, 100.f}}}); + registry.add("hFDVsPtAntiLambdaVsMotherPt_MCRatio_MC", ";p_{T} [GeV/c] (V0);p_{T}^{gen} [GeV/c] (#bar{#Xi}^{+/0});percentile", {HistType::kTH3F, {{250, 0.0f, 25.0f}, {250, 0.0f, 25.0f}, {100, 0.f, 100.f}}}); } if (doQA) { @@ -398,7 +400,7 @@ struct v0postprocessing { if (candidate.v0cospa() > cospaK0s && std::abs(candidate.rapk0short()) < rap && candidate.ctauk0short() < ctauK0s && - std::abs(candidate.massk0short() - o2::constants::physics::MassK0Short) < 0.075 && + std::abs(candidate.massk0short() - o2::constants::physics::MassK0Short) < 0.1 && std::abs(candidate.masslambda() - o2::constants::physics::MassLambda0) > v0rejK0s && std::abs(candidate.ntpcsigmanegpi()) <= ntpcsigma && std::abs(candidate.ntpcsigmapospi()) <= ntpcsigma && @@ -448,20 +450,17 @@ struct v0postprocessing { registry.fill(HIST("hMassVsPtLambda"), candidate.v0pt(), candidate.masslambda()); registry.fill(HIST("hMassVsPtLambdaVsCentFT0M"), candidate.v0pt(), candidate.multft0m(), candidate.masslambda()); - if (isMC) { - - if (candidate.pdgcode() == 3122 && candidate.isdaulambda()) { - - if (candidate.isphysprimary() == 1) { - registry.fill(HIST("hMassLambda_MC"), candidate.masslambda()); - registry.fill(HIST("hMassVsPtLambdaVsCentFT0M_MC"), candidate.v0pt(), candidate.multft0m(), candidate.masslambda()); - } + if (isMC && candidate.pdgcode() == 3122 && candidate.isdaulambda()) { + if (candidate.isphysprimary() == 1) { + registry.fill(HIST("hMassLambda_MC"), candidate.masslambda()); + registry.fill(HIST("hMassVsPtLambdaVsCentFT0M_MC"), candidate.v0pt(), candidate.multft0m(), candidate.masslambda()); + } else if (std::abs(candidate.masslambda() - o2::constants::physics::MassLambda0) < 0.01) { if (candidate.pdgcodemother() == 3312) { - registry.fill(HIST("hMassVsPtLambdaVsMotherPt_DoubleCharged_MC"), candidate.v0pt(), candidate.v0motherpt(), candidate.masslambda()); + registry.fill(HIST("hFDVsPtLambdaVsMotherPt_DoubleCharged_MC"), candidate.v0pt(), candidate.v0motherpt(), candidate.multft0m()); } if (candidate.pdgcodemother() == 3312 || candidate.pdgcodemother() == 3322) { - registry.fill(HIST("hMassVsPtLambdaVsMotherPt_MCRatio_MC"), candidate.v0pt(), candidate.v0motherpt(), candidate.masslambda()); + registry.fill(HIST("hFDVsPtLambdaVsMotherPt_MCRatio_MC"), candidate.v0pt(), candidate.v0motherpt(), candidate.multft0m()); } } } @@ -489,18 +488,18 @@ struct v0postprocessing { registry.fill(HIST("hMassVsPtAntiLambda"), candidate.v0pt(), candidate.massantilambda()); registry.fill(HIST("hMassVsPtAntiLambdaVsCentFT0M"), candidate.v0pt(), candidate.multft0m(), candidate.massantilambda()); - if (candidate.pdgcode() == -3122 && candidate.isdauantilambda()) { + if (isMC && candidate.pdgcode() == -3122 && candidate.isdauantilambda()) { if (candidate.isphysprimary() == 1) { registry.fill(HIST("hMassAntiLambda_MC"), candidate.massantilambda()); registry.fill(HIST("hMassVsPtAntiLambdaVsCentFT0M_MC"), candidate.v0pt(), candidate.v0motherpt(), candidate.massantilambda()); - } - - if (candidate.pdgcodemother() == -3312) { - registry.fill(HIST("hMassVsPtAntiLambdaVsMotherPt_DoubleCharged_MC"), candidate.v0pt(), candidate.v0motherpt(), candidate.massantilambda()); - } - if (candidate.pdgcodemother() == -3312 || candidate.pdgcodemother() == -3322) { - registry.fill(HIST("hMassVsPtAntiLambdaVsMotherPt_MCRatio_MC"), candidate.v0pt(), candidate.v0motherpt(), candidate.massantilambda()); + } else if (std::abs(candidate.massantilambda() - o2::constants::physics::MassLambda0) < 0.01) { + if (candidate.pdgcodemother() == -3312) { + registry.fill(HIST("hFDVsPtAntiLambdaVsMotherPt_DoubleCharged_MC"), candidate.v0pt(), candidate.v0motherpt(), candidate.multft0m()); + } + if (candidate.pdgcodemother() == -3312 || candidate.pdgcodemother() == -3322) { + registry.fill(HIST("hFDVsPtAntiLambdaVsMotherPt_MCRatio_MC"), candidate.v0pt(), candidate.v0motherpt(), candidate.multft0m()); + } } } From 18a3aa34c6db791d0daf4b7057923841d9e4b86a Mon Sep 17 00:00:00 2001 From: Noor Koster <82090643+cnkoster@users.noreply.github.com> Date: Fri, 12 Sep 2025 15:31:37 +0200 Subject: [PATCH 374/986] [PWGCF] FlowSP: add rct flags for zdc and shift correction (#12956) Co-authored-by: ALICE Action Bot --- PWGCF/Flow/TableProducer/zdcQVectors.cxx | 150 ++++- PWGCF/Flow/Tasks/flowSP.cxx | 766 ++++++++++++----------- 2 files changed, 544 insertions(+), 372 deletions(-) diff --git a/PWGCF/Flow/TableProducer/zdcQVectors.cxx b/PWGCF/Flow/TableProducer/zdcQVectors.cxx index bf6dc06422c..a734cc5cb43 100644 --- a/PWGCF/Flow/TableProducer/zdcQVectors.cxx +++ b/PWGCF/Flow/TableProducer/zdcQVectors.cxx @@ -63,6 +63,7 @@ using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::aod::track; using namespace o2::aod::evsel; +using namespace o2::aod::rctsel; namespace o2::analysis::qvectortask { @@ -103,6 +104,15 @@ struct ZdcQVectors { Produces spTableZDC; + struct : ConfigurableGroup { + Configurable cfgEvtUseRCTFlagChecker{"cfgEvtUseRCTFlagChecker", false, "Evt sel: use RCT flag checker"}; + Configurable cfgEvtRCTFlagCheckerLabel{"cfgEvtRCTFlagCheckerLabel", "CBT_hadronPID", "Evt sel: RCT flag checker label (CBT, CBT_hadronPID)"}; // all Labels can be found in Common/CCDB/RCTSelectionFlags.h + Configurable cfgEvtRCTFlagCheckerZDCCheck{"cfgEvtRCTFlagCheckerZDCCheck", false, "Evt sel: RCT flag checker ZDC check"}; + Configurable cfgEvtRCTFlagCheckerLimitAcceptAsBad{"cfgEvtRCTFlagCheckerLimitAcceptAsBad", false, "Evt sel: RCT flag checker treat Limited Acceptance As Bad"}; + } rctFlags; + + RCTFlagsChecker rctChecker; + ConfigurableAxis axisCent{"axisCent", {90, 0, 90}, "Centrality axis in 1% bins"}; ConfigurableAxis axisCent10{"axisCent10", {9, 0, 90}, "Centrality axis in 10% bins"}; ConfigurableAxis axisQ{"axisQ", {100, -2, 2}, "Q vector (xy) in ZDC"}; @@ -121,10 +131,10 @@ struct ZdcQVectors { O2_DEFINE_CONFIGURABLE(cfgVtxZ, float, 10.0f, "Accepted z-vertex range") O2_DEFINE_CONFIGURABLE(cfgMagField, float, 99999, "Configurable magnetic field; default CCDB will be queried") - O2_DEFINE_CONFIGURABLE(cfgEnergyCal, std::string, "Users/c/ckoster/ZDC/LHC23_zzh_pass4/Energy", "ccdb path for energy calibration histos") - O2_DEFINE_CONFIGURABLE(cfgMeanv, std::string, "Users/c/ckoster/ZDC/LHC23_zzh_pass4/vmean", "ccdb path for mean v histos") + O2_DEFINE_CONFIGURABLE(cfgEnergyCal, std::string, "Users/c/ckoster/ZDC/LHC23_PbPb_pass5/Energy", "ccdb path for energy calibration histos") + O2_DEFINE_CONFIGURABLE(cfgMeanv, std::string, "Users/c/ckoster/ZDC/LHC23_PbPb_pass5/vmean", "ccdb path for mean v histos") O2_DEFINE_CONFIGURABLE(cfgMinEntriesSparseBin, int, 100, "Minimal number of entries allowed in 4D recentering histogram to use for recentering.") - O2_DEFINE_CONFIGURABLE(cfgRec, std::string, "Users/c/ckoster/ZDC/LHC23_PbPb_pass4", "ccdb path for recentering histos"); + O2_DEFINE_CONFIGURABLE(cfgRec, std::string, "Users/c/ckoster/ZDC/LHC23_PbPb_pass5", "ccdb path for recentering histos"); O2_DEFINE_CONFIGURABLE(cfgFillCommonRegistry, bool, true, "Fill common registry with histograms"); // Additional event selections @@ -138,6 +148,9 @@ struct ZdcQVectors { O2_DEFINE_CONFIGURABLE(cfgEvSelsCentMin, float, 0, "Minimum cenrality for selected events"); O2_DEFINE_CONFIGURABLE(cfgEvSelsCentMax, float, 90, "Maximum cenrality for selected events"); + O2_DEFINE_CONFIGURABLE(cfgUseShift, bool, false, "Use shift for PsiA and PsiC ZDC"); + O2_DEFINE_CONFIGURABLE(cfgCCDBdir_Shift, std::string, "Users/c/ckoster/ZDC/LHC23_PbPb_pass5/Shift", "CCDB directory for Shift ZDC"); + // define my..... // Filter collisionFilter = nabs(aod::collision::posZ) < cfgVtxZ; using UsedCollisions = soa::Join; @@ -145,6 +158,7 @@ struct ZdcQVectors { enum SelectionCriteria { evSel_FilteredEvent, + evSel_RCTFlagsZDC, evSel_Zvtx, evSel_sel8, evSel_occupancy, @@ -175,6 +189,12 @@ struct ZdcQVectors { std::vector calibfilesLoaded = std::vector(3, false); int atStep = 0; int atIteration = 0; + + TProfile3D* shiftprofileC = nullptr; + TProfile3D* shiftprofileA = nullptr; + + bool isShiftProfileFound = false; + } cal; enum FillType { @@ -191,6 +211,8 @@ struct ZdcQVectors { int64_t now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); ccdb->setCreatedNotAfter(now); + rctChecker.init(rctFlags.cfgEvtRCTFlagCheckerLabel, rctFlags.cfgEvtRCTFlagCheckerZDCCheck, rctFlags.cfgEvtRCTFlagCheckerLimitAcceptAsBad); + std::vector sides = {"A", "C"}; std::vector capCOORDS = {"X", "Y"}; @@ -236,6 +258,13 @@ struct ZdcQVectors { registry.add("QA/ZNA_Energy", "ZNA_Energy", kTProfile, {{8, 0, 8}}); registry.add("QA/ZNC_Energy", "ZNC_Energy", kTProfile, {{8, 0, 8}}); + registry.add("QA/ShiftZDCC", "ShiftZDCC", kTProfile3D, {{100, 0, 100}, {2, 0, 2}, {10, 0, 10}}); + registry.add("QA/ShiftZDCA", "ShiftZDCA", kTProfile3D, {{100, 0, 100}, {2, 0, 2}, {10, 0, 10}}); + registry.add("QA/psiZDCA", "psiZDCA", kTH1D, {{100, -4, 4}}); + registry.add("QA/psiZDCA_shift", "psiZDCA_shift", kTH1D, {{100, -4, 4}}); + registry.add("QA/psiZDCC", "psiZDCC", kTH1D, {{100, -4, 4}}); + registry.add("QA/psiZDCC_shift", "psiZDCC_shift", kTH1D, {{100, -4, 4}}); + registry.add("QA/before/ZNA_pmC", "ZNA_pmC", kTProfile, {{1, 0, 1.}}); registry.add("QA/before/ZNA_pm1", "ZNA_pm1", kTProfile, {{1, 0, 1.}}); registry.add("QA/before/ZNA_pm2", "ZNA_pm2", kTProfile, {{1, 0, 1.}}); @@ -295,6 +324,7 @@ struct ZdcQVectors { registry.add("hEventCount", "Number of Event; Cut; #Events Passed Cut", {HistType::kTH1D, {{nEventSelections, 0, nEventSelections}}}); registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_FilteredEvent + 1, "Filtered events"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_RCTFlagsZDC + 1, "RCT Flags ZDC"); registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_Zvtx + 1, "Z vertex cut event"); registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_sel8 + 1, "Sel8"); registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_occupancy + 1, "kOccupancy"); @@ -560,34 +590,46 @@ struct ZdcQVectors { if (cfgNGlobal) cent = collision.centNGlobal(); + v[0] = collision.posX(); + v[1] = collision.posY(); + v[2] = collision.posZ(); + centrality = cent; + + const auto& foundBC = collision.foundBC_as(); + runnumber = foundBC.runNumber(); + if (cfgFillCommonRegistry) registry.fill(HIST("QA/centrality_before"), cent); registry.fill(HIST("hEventCount"), evSel_FilteredEvent); - if (!eventSelected(collision, cent)) { + if (rctFlags.cfgEvtUseRCTFlagChecker && !rctChecker(collision)) { // event not selected isSelected = false; spTableZDC(runnumber, cent, v[0], v[1], v[2], 0, 0, 0, 0, isSelected, 0, 0); counter++; + lastRunNumber = runnumber; return; } + registry.fill(HIST("hEventCount"), evSel_RCTFlagsZDC); - const auto& foundBC = collision.foundBC_as(); + if (!eventSelected(collision, cent)) { + // event not selected + isSelected = false; + spTableZDC(runnumber, cent, v[0], v[1], v[2], 0, 0, 0, 0, isSelected, 0, 0); + counter++; + lastRunNumber = runnumber; + return; + } if (!foundBC.has_zdc()) { isSelected = false; spTableZDC(runnumber, cent, v[0], v[1], v[2], 0, 0, 0, 0, isSelected, 0, 0); counter++; + lastRunNumber = runnumber; return; } - v[0] = collision.posX(); - v[1] = collision.posY(); - v[2] = collision.posZ(); - centrality = cent; - runnumber = foundBC.runNumber(); - // load new calibrations for new runs only if (runnumber != lastRunNumber) { cal.calibfilesLoaded[0] = false; @@ -598,8 +640,6 @@ struct ZdcQVectors { cal.calibfilesLoaded[2] = false; cal.calibList[2] = nullptr; - - lastRunNumber = runnumber; } const auto& zdcCol = foundBC.zdc(); @@ -663,6 +703,7 @@ struct ZdcQVectors { counter++; isSelected = false; spTableZDC(runnumber, centrality, v[0], v[1], v[2], 0, 0, 0, 0, isSelected, 0, 0); + lastRunNumber = runnumber; return; } @@ -673,6 +714,7 @@ struct ZdcQVectors { counter++; isSelected = false; spTableZDC(runnumber, centrality, v[0], v[1], v[2], 0, 0, 0, 0, isSelected, 0, 0); + lastRunNumber = runnumber; return; } @@ -814,6 +856,7 @@ struct ZdcQVectors { spTableZDC(runnumber, centrality, v[0], v[1], v[2], q[0], q[1], q[2], q[3], isSelected, 0, 0); counter++; + lastRunNumber = runnumber; return; } else { if (cfgFillCommonRegistry) @@ -867,14 +910,93 @@ struct ZdcQVectors { registry.get(HIST("QA/after/ZNC_Qy"))->Fill(Form("%d", runnumber), qRec[3]); } - spTableZDC(runnumber, centrality, v[0], v[1], v[2], qRec[0], qRec[1], qRec[2], qRec[3], isSelected, cal.atIteration, cal.atStep); + // do shift for psi. + double psiZDCA = 1.0 * std::atan2(qRec[1], qRec[0]); + double psiZDCC = 1.0 * std::atan2(qRec[3], qRec[2]); + + int nshift = 10; // no. of iterations + + double psiZDCAshift = psiZDCA; + double psiZDCCshift = psiZDCC; + + double deltaPsiZDCA = 0; + double deltaPsiZDCC = 0; + + if (cfgUseShift && !cfgCCDBdir_Shift.value.empty()) { + if (lastRunNumber != runnumber) { + cal.isShiftProfileFound = false; + LOGF(info, "Getting shift profile from CCDB for runnumber: %d", runnumber); + TList* hcorrList = ccdb->getForTimeStamp(cfgCCDBdir_Shift.value, foundBC.timestamp()); + cal.shiftprofileC = reinterpret_cast(hcorrList->FindObject("ShiftZDCC")); + cal.shiftprofileA = reinterpret_cast(hcorrList->FindObject("ShiftZDCA")); + if (!cal.shiftprofileC || !cal.shiftprofileA) { + LOGF(error, "Shift profile not found in CCDB for runnumber: %d", runnumber); + } else { + LOGF(error, "Shift profile found in CCDB for runnumber: %d", runnumber); + cal.isShiftProfileFound = true; + } + } + } + + float coeffshiftxZDCC = 0.0; + float coeffshiftyZDCC = 0.0; + float coeffshiftxZDCA = 0.0; + float coeffshiftyZDCA = 0.0; + + for (int ishift = 1; ishift <= nshift; ishift++) { + if (cfgFillCommonRegistry) { + registry.fill(HIST("QA/ShiftZDCC"), centrality, 0.5, ishift - 0.5, std::sin(ishift * 1.0 * psiZDCC)); + registry.fill(HIST("QA/ShiftZDCC"), centrality, 1.5, ishift - 0.5, std::cos(ishift * 1.0 * psiZDCC)); + registry.fill(HIST("QA/ShiftZDCA"), centrality, 0.5, ishift - 0.5, std::sin(ishift * 1.0 * psiZDCA)); + registry.fill(HIST("QA/ShiftZDCA"), centrality, 1.5, ishift - 0.5, std::cos(ishift * 1.0 * psiZDCA)); + } + + if (cal.isShiftProfileFound) { + int binshiftxZDCC = cal.shiftprofileC->FindBin(centrality, 0.5, ishift - 0.5); + int binshiftyZDCC = cal.shiftprofileC->FindBin(centrality, 1.5, ishift - 0.5); + int binshiftxZDCA = cal.shiftprofileA->FindBin(centrality, 0.5, ishift - 0.5); + int binshiftyZDCA = cal.shiftprofileA->FindBin(centrality, 1.5, ishift - 0.5); + + if (binshiftxZDCC > 0 && binshiftyZDCC > 0 && binshiftxZDCA > 0 && binshiftyZDCA > 0) { + coeffshiftxZDCC = cal.shiftprofileC->GetBinContent(binshiftxZDCC); + coeffshiftyZDCC = cal.shiftprofileC->GetBinContent(binshiftyZDCC); + coeffshiftxZDCA = cal.shiftprofileA->GetBinContent(binshiftxZDCA); + coeffshiftyZDCA = cal.shiftprofileA->GetBinContent(binshiftyZDCA); + } + deltaPsiZDCC += deltaPsiZDCC + ((2 / (1.0 * ishift)) * (-coeffshiftxZDCC * std::cos(ishift * 1.0 * psiZDCC) + coeffshiftyZDCC * std::sin(ishift * 1.0 * psiZDCC))); + deltaPsiZDCA += deltaPsiZDCA + ((2 / (1.0 * ishift)) * (-coeffshiftxZDCA * std::cos(ishift * 1.0 * psiZDCA) + coeffshiftyZDCA * std::sin(ishift * 1.0 * psiZDCA))); + } + } + + psiZDCCshift += deltaPsiZDCC; + psiZDCAshift += deltaPsiZDCA; + + // Normalize angles to [-pi, pi] + psiZDCCshift = std::atan2(std::sin(psiZDCCshift), std::cos(psiZDCCshift)); + psiZDCAshift = std::atan2(std::sin(psiZDCAshift), std::cos(psiZDCAshift)); + + if (cfgFillCommonRegistry) { + registry.fill(HIST("QA/psiZDCA"), psiZDCA); + registry.fill(HIST("QA/psiZDCC"), psiZDCC); + registry.fill(HIST("QA/psiZDCA_shift"), psiZDCAshift); + registry.fill(HIST("QA/psiZDCC_shift"), psiZDCCshift); + } + + double qXaShift = std::hypot(qRec[1], qRec[0]) * std::cos(psiZDCAshift); + double qYaShift = std::hypot(qRec[1], qRec[0]) * std::sin(psiZDCAshift); + double qXcShift = std::hypot(qRec[2], qRec[3]) * std::cos(psiZDCCshift); + double qYcShift = std::hypot(qRec[2], qRec[3]) * std::sin(psiZDCCshift); + + spTableZDC(runnumber, centrality, v[0], v[1], v[2], qXaShift, qYaShift, qXcShift, qYcShift, isSelected, cal.atIteration, cal.atStep); qRec.clear(); counter++; + lastRunNumber = runnumber; return; } LOGF(warning, "We return without saving table... -> THis is a problem"); + lastRunNumber = runnumber; } // end of process }; diff --git a/PWGCF/Flow/Tasks/flowSP.cxx b/PWGCF/Flow/Tasks/flowSP.cxx index ce75e1c9bc1..df366eaf341 100644 --- a/PWGCF/Flow/Tasks/flowSP.cxx +++ b/PWGCF/Flow/Tasks/flowSP.cxx @@ -18,12 +18,14 @@ #include "PWGCF/DataModel/SPTableZDC.h" +#include "Common/Core/EventPlaneHelper.h" #include "Common/Core/RecoDecay.h" #include "Common/Core/TrackSelection.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/Qvectors.h" #include "Common/DataModel/TrackSelectionTables.h" #include "CCDB/BasicCCDBManager.h" @@ -41,6 +43,7 @@ #include "TPDGCode.h" #include +#include #include #include #include @@ -50,11 +53,21 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace o2::aod::rctsel; // using namespace o2::analysis; #define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; struct FlowSP { + RCTFlagsChecker rctChecker; + + struct : ConfigurableGroup { + O2_DEFINE_CONFIGURABLE(cfgEvtUseRCTFlagChecker, bool, false, "Evt sel: use RCT flag checker"); + O2_DEFINE_CONFIGURABLE(cfgEvtRCTFlagCheckerLabel, std::string, "CBT_hadronPID", "Evt sel: RCT flag checker label (CBT, CBT_hadronPID)"); // all Labels can be found in Common/CCDB/RCTSelectionFlags.h + O2_DEFINE_CONFIGURABLE(cfgEvtRCTFlagCheckerZDCCheck, bool, false, "Evt sel: RCT flag checker ZDC check"); + O2_DEFINE_CONFIGURABLE(cfgEvtRCTFlagCheckerLimitAcceptAsBad, bool, false, "Evt sel: RCT flag checker treat Limited Acceptance As Bad"); + } rctFlags; + // QA Plots O2_DEFINE_CONFIGURABLE(cfgFillEventQA, bool, false, "Fill histograms for event QA"); O2_DEFINE_CONFIGURABLE(cfgFillTrackQA, bool, false, "Fill histograms for track QA"); @@ -112,8 +125,7 @@ struct FlowSP { O2_DEFINE_CONFIGURABLE(cfgEvSelsIsGoodITSLayersAll, bool, true, "Cut time intervals with dead ITS staves"); // harmonics for v coefficients O2_DEFINE_CONFIGURABLE(cfgHarm, int, 1, "Flow harmonic n for ux and uy: (Cos(n*phi), Sin(n*phi))"); - O2_DEFINE_CONFIGURABLE(cfgHarmMixed1, int, 2, "Flow harmonic n for ux and uy in mixed harmonics (MH): (Cos(n*phi), Sin(n*phi))"); - O2_DEFINE_CONFIGURABLE(cfgHarmMixed2, int, 3, "Flow harmonic n for ux and uy in mixed harmonics (MH): (Cos(n*phi), Sin(n*phi))"); + O2_DEFINE_CONFIGURABLE(cfgHarmMixed, int, 2, "Flow harmonic n for ux and uy in mixed harmonics (MH): (Cos(n*phi), Sin(n*phi))"); // settings for CCDB data O2_DEFINE_CONFIGURABLE(cfgCCDBdir_QQ, std::string, "Users/c/ckoster/ZDC/LHC23_PbPb_pass5/meanQQ/Default", "ccdb dir for average QQ values in 1% centrality bins"); O2_DEFINE_CONFIGURABLE(cfgCCDBdir_SP, std::string, "", "ccdb dir for average event plane resolution in 1% centrality bins"); @@ -138,7 +150,7 @@ struct FlowSP { using ZDCCollisions = soa::Filtered>; // For MC Reco and Gen - using CCs = soa::Filtered>; // without SPTableZDC + using CCs = soa::Filtered>; using CC = CCs::iterator; using TCs = soa::Join; using FilteredTCs = soa::Filtered; @@ -174,6 +186,32 @@ struct FlowSP { } cfg; + struct SPMvars { + std::vector> wacc = {{{0, 1.0}, {1, 1.0}, {2, 1.0}, {3, 1.0}}, {{0, 1.0}, {1, 1.0}, {2, 1.0}, {3, 1.0}}, {{0, 1.0}, {1, 1.0}, {2, 1.0}, {3, 1.0}}}; // int for part species, float for weight vector for kIncl, kPos, kNeg + std::vector> weff = {{{0, 1.0}, {1, 1.0}, {2, 1.0}, {3, 1.0}}, {{0, 1.0}, {1, 1.0}, {2, 1.0}, {3, 1.0}}, {{0, 1.0}, {1, 1.0}, {2, 1.0}, {3, 1.0}}}; // int for part species, float for weight vector for kIncl, kPos, kNeg + double centWeight = 1.0; + double ux = 0; + double uy = 0; + double uxMH = 0; + double uyMH = 0; + double qxA = 0; + double qyA = 0; + double qxC = 0; + double qyC = 0; + double corrQQx = 1; + double corrQQy = 1; + double corrQQ = 1; + double vnA = 0; + double vnC = 0; + double vnFull = 0; + float centrality = 0; + float vtxz = 0; + double vx = 0; + double vy = 0; + double vz = 0; + int charge = 0; + } spm; + OutputObj fWeights{GFWWeights("weights")}; OutputObj fWeightsPOS{GFWWeights("weights_positive")}; OutputObj fWeightsNEG{GFWWeights("weights_negative")}; @@ -193,6 +231,7 @@ struct FlowSP { enum SelectionCriteria { evSel_FilteredEvent, evSel_sel8, + evSel_RCTFlagsZDC, evSel_occupancy, evSel_kTVXinTRD, evSel_kNoSameBunchPileup, @@ -223,24 +262,28 @@ struct FlowSP { enum ChargeType { kInclusive, kPositive, - kNegative + kNegative, + nChargeTypes }; enum FillType { kBefore, - kAfter + kAfter, + nFillTypes }; enum ModeType { kGen, - kReco + kReco, + nModeTypes }; enum ParticleType { kUnidentified, kPions, kKaons, - kProtons + kProtons, + nParticleTypes }; static constexpr std::string_view Charge[] = {"incl/", "pos/", "neg/"}; @@ -282,9 +325,12 @@ struct FlowSP { int ptbins = ptbinning.size() - 1; + rctChecker.init(rctFlags.cfgEvtRCTFlagCheckerLabel, rctFlags.cfgEvtRCTFlagCheckerZDCCheck, rctFlags.cfgEvtRCTFlagCheckerLimitAcceptAsBad); + histos.add("hEventCount", "Number of Event; Cut; #Events Passed Cut", {HistType::kTH1D, {{nEventSelections, 0, nEventSelections}}}); histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_FilteredEvent + 1, "Filtered event"); histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_sel8 + 1, "Sel8"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_RCTFlagsZDC + 1, "RCTFlags (ZDC CBT LimAcc"); histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_occupancy + 1, "kOccupancy"); histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kTVXinTRD + 1, "kTVXinTRD"); histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kNoSameBunchPileup + 1, "kNoSameBunchPileup"); @@ -293,7 +339,7 @@ struct FlowSP { histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsVertexITSTPC + 1, "kIsVertexITSTPC"); histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_MultCuts + 1, "Multiplicity cuts"); histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodITSLayersAll + 1, "kkIsGoodITSLayersAll"); - histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_isSelectedZDC + 1, "isSelected"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_isSelectedZDC + 1, "isSelected ZDC"); histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_CentCuts + 1, "Cenrality range"); histos.add("hTrackCount", "Number of Tracks; Cut; #Tracks Passed Cut", {HistType::kTH1D, {{nTrackSelections, 0, nTrackSelections}}}); @@ -566,7 +612,7 @@ struct FlowSP { } template - int getTrackPID(TrackObject track) + ParticleType getTrackPID(TrackObject track) { float usedNSigmaPi = -1; @@ -589,10 +635,10 @@ struct FlowSP { return kUnidentified; // No PID information available } - std::unordered_map usedNSigma = {{usedNSigmaPi, kPions}, {usedNSigmaKa, kKaons}, {usedNSigmaPr, kProtons}}; + std::unordered_map usedNSigma = {{usedNSigmaPi, kPions}, {usedNSigmaKa, kKaons}, {usedNSigmaPr, kProtons}}; int nIdentified = 0; - int valPID = 0; + ParticleType valPID = kUnidentified; for (const auto& nsigma : usedNSigma) { if (std::abs(nsigma.first) < cfgTrackSelsPIDNsigma) { @@ -608,8 +654,6 @@ struct FlowSP { } else { return kUnidentified; // Multiple PID matches found } - - return -1; } int getMagneticField(uint64_t timestamp) @@ -694,7 +738,7 @@ struct FlowSP { } // From Generic Framework - bool setCurrentParticleWeights(int pID, float& weight_nue, float& weight_nua, const float& phi, const float& eta, const float& pt, const float& vtxz) + bool setCurrentParticleWeights(int pID, int spec, const float& phi, const float& eta, const float& pt, const float& vtxz) { float eff = 1.; int sizeEff = cfg.mEfficiency.size(); @@ -704,20 +748,21 @@ struct FlowSP { eff = 1.0; if (eff == 0) return false; - weight_nue = 1. / eff; + + spm.weff[pID][spec] = 1. / eff; if (cfguseNUA1D) { int sizeAcc = cfg.mAcceptance.size(); if (sizeAcc > pID) { - weight_nua = cfg.mAcceptance[pID]->getNUA(phi, eta, vtxz); + spm.wacc[pID][spec] = cfg.mAcceptance[pID]->getNUA(phi, eta, vtxz); } else { - weight_nua = 1; + spm.wacc[pID][spec] = 1; } } else if (cfguseNUA2D) { if (cfg.mAcceptance2D.size() > 0) { - weight_nua = getNUA2D(cfg.mAcceptance2D[0], eta, phi, vtxz); + spm.wacc[pID][spec] = getNUA2D(cfg.mAcceptance2D[0], eta, phi, vtxz); } else { - weight_nua = 1; + spm.wacc[pID][spec] = 1; } } return true; @@ -730,6 +775,10 @@ struct FlowSP { return 0; histos.fill(HIST("hEventCount"), evSel_sel8); + if (rctFlags.cfgEvtUseRCTFlagChecker && !rctChecker(collision)) + return 0; + histos.fill(HIST("hEventCount"), evSel_RCTFlagsZDC); + // Occupancy if (cfgEvSelsDoOccupancySel) { auto occupancy = collision.trackOccupancyInTimeRange(); @@ -876,28 +925,28 @@ struct FlowSP { } template - inline void fillEventQA(CollisionObject collision, TracksObject tracks, double centWeight = 1.0) + inline void fillEventQA(CollisionObject collision, TracksObject tracks) { if (!cfgFillEventQA) return; static constexpr std::string_view Time[] = {"before", "after"}; - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hCentFT0C"), collision.centFT0C(), centWeight); - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hCentNGlobal"), collision.centNGlobal(), centWeight); - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hCentFT0M"), collision.centFT0M(), centWeight); - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hCentFV0A"), collision.centFV0A(), centWeight); - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/globalTracks_centT0C"), collision.centFT0C(), tracks.size(), centWeight); - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PVTracks_centT0C"), collision.centFT0C(), collision.multNTracksPV(), centWeight); - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/globalTracks_PVTracks"), collision.multNTracksPV(), tracks.size(), centWeight); - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/globalTracks_multT0A"), collision.multFT0A(), tracks.size(), centWeight); - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/globalTracks_multV0A"), collision.multFV0A(), tracks.size(), centWeight); - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/multV0A_multT0A"), collision.multFT0A(), collision.multFV0A(), centWeight); - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/multT0C_centT0C"), collision.centFT0C(), collision.multFT0C(), centWeight); - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/CentFT0C_vs_CentFT0Cvariant1"), collision.centFT0C(), collision.centFT0CVariant1(), centWeight); - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/CentFT0C_vs_CentFT0M"), collision.centFT0C(), collision.centFT0M(), centWeight); - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/CentFT0C_vs_CentFV0A"), collision.centFT0C(), collision.centFV0A(), centWeight); - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/CentFT0C_vs_CentNGlobal"), collision.centFT0C(), collision.centNGlobal(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hCentFT0C"), collision.centFT0C(), spm.centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hCentNGlobal"), collision.centNGlobal(), spm.centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hCentFT0M"), collision.centFT0M(), spm.centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/hCentFV0A"), collision.centFV0A(), spm.centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/globalTracks_centT0C"), collision.centFT0C(), tracks.size(), spm.centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PVTracks_centT0C"), collision.centFT0C(), collision.multNTracksPV(), spm.centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/globalTracks_PVTracks"), collision.multNTracksPV(), tracks.size(), spm.centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/globalTracks_multT0A"), collision.multFT0A(), tracks.size(), spm.centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/globalTracks_multV0A"), collision.multFV0A(), tracks.size(), spm.centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/multV0A_multT0A"), collision.multFT0A(), collision.multFV0A(), spm.centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/multT0C_centT0C"), collision.centFT0C(), collision.multFT0C(), spm.centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/CentFT0C_vs_CentFT0Cvariant1"), collision.centFT0C(), collision.centFT0CVariant1(), spm.centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/CentFT0C_vs_CentFT0M"), collision.centFT0C(), collision.centFT0M(), spm.centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/CentFT0C_vs_CentFV0A"), collision.centFT0C(), collision.centFV0A(), spm.centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/CentFT0C_vs_CentNGlobal"), collision.centFT0C(), collision.centNGlobal(), spm.centWeight); if (cfgFillEventPlaneQA) { if constexpr (o2::framework::has_type_v) { @@ -905,95 +954,79 @@ struct FlowSP { double psiC = 1.0 * std::atan2(collision.qyC(), collision.qxC()); double psiFull = 1.0 * std::atan2(collision.qyA() + collision.qyC(), collision.qxA() + collision.qxC()); - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiA_vs_Cent"), psiA, collision.centFT0C(), centWeight); - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiC_vs_Cent"), psiC, collision.centFT0C(), centWeight); - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiFull_vs_Cent"), psiFull, collision.centFT0C(), centWeight); - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiA_vs_Vx"), psiA, collision.vx(), centWeight); - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiC_vs_Vx"), psiC, collision.vx(), centWeight); - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiFull_vs_Vx"), psiFull, collision.vx(), centWeight); - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiA_vs_Vy"), psiA, collision.vy(), centWeight); - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiC_vs_Vy"), psiC, collision.vy(), centWeight); - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiFull_vs_Vy"), psiFull, collision.vy(), centWeight); - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiA_vs_Vz"), psiA, collision.posZ(), centWeight); - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiC_vs_Vz"), psiC, collision.posZ(), centWeight); - histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiFull_vs_Vz"), psiFull, collision.posZ(), centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiA_vs_Cent"), psiA, collision.centFT0C(), spm.centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiC_vs_Cent"), psiC, collision.centFT0C(), spm.centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiFull_vs_Cent"), psiFull, collision.centFT0C(), spm.centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiA_vs_Vx"), psiA, collision.vx(), spm.centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiC_vs_Vx"), psiC, collision.vx(), spm.centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiFull_vs_Vx"), psiFull, collision.vx(), spm.centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiA_vs_Vy"), psiA, collision.vy(), spm.centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiC_vs_Vy"), psiC, collision.vy(), spm.centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiFull_vs_Vy"), psiFull, collision.vy(), spm.centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiA_vs_Vz"), psiA, collision.posZ(), spm.centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiC_vs_Vz"), psiC, collision.posZ(), spm.centWeight); + histos.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/PsiFull_vs_Vz"), psiFull, collision.posZ(), spm.centWeight); } } return; } template - inline void fillHistograms(TrackObject track, float wacc, float weff, double centWeight, double ux, double uy, double uxMH, double uyMH, double qxA, double qyA, double qxC, double qyC, double corrQQx, double corrQQy, double corrQQ, double vnA, double vnC, double vnFull, double centrality) + inline void fillHistograms(TrackObject track) { - - double weight = wacc * weff * centWeight; + double weight = spm.wacc[ct][pt] * spm.weff[ct][pt] * spm.centWeight; if (cfgFillGeneralV1Histos) { - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnA"), track.pt(), track.eta(), centrality, (uy * qyA + ux * qxA) / std::sqrt(std::fabs(corrQQ)), weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnC"), track.pt(), track.eta(), centrality, (uy * qyC + ux * qxC) / std::sqrt(std::fabs(corrQQ)), weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnA"), track.pt(), track.eta(), spm.centrality, (spm.uy * spm.qyA + spm.ux * spm.qxA) / std::sqrt(std::fabs(spm.corrQQ)), weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnC"), track.pt(), track.eta(), spm.centrality, (spm.uy * spm.qyC + spm.ux * spm.qxC) / std::sqrt(std::fabs(spm.corrQQ)), weight); } if (cfgFillMixedHarmonics) { - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCxUx_MH"), track.pt(), track.eta(), centrality, (uxMH * qxA * qxC) / corrQQx, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCyUx_MH"), track.pt(), track.eta(), centrality, (uxMH * qyA * qyC) / corrQQy, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCyUy_MH"), track.pt(), track.eta(), centrality, (uyMH * qxA * qyC) / corrQQx, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAyCxUy_MH"), track.pt(), track.eta(), centrality, (uyMH * qyA * qxC) / corrQQy, weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCxUx_MH"), track.pt(), track.eta(), spm.centrality, (spm.uxMH * spm.qxA * spm.qxC) / spm.corrQQx, weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCyUx_MH"), track.pt(), track.eta(), spm.centrality, (spm.uxMH * spm.qyA * spm.qyC) / spm.corrQQy, weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCyUy_MH"), track.pt(), track.eta(), spm.centrality, (spm.uyMH * spm.qxA * spm.qyC) / spm.corrQQx, weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAyCxUy_MH"), track.pt(), track.eta(), spm.centrality, (spm.uyMH * spm.qyA * spm.qxC) / spm.corrQQy, weight); } if (cfgFillXandYterms) { - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnAx"), track.pt(), track.eta(), centrality, (ux * qxA) / std::sqrt(std::fabs(corrQQx)), weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnAy"), track.pt(), track.eta(), centrality, (uy * qyA) / std::sqrt(std::fabs(corrQQy)), weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnCx"), track.pt(), track.eta(), centrality, (ux * qxC) / std::sqrt(std::fabs(corrQQx)), weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnCy"), track.pt(), track.eta(), centrality, (uy * qyC) / std::sqrt(std::fabs(corrQQy)), weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnAx"), track.pt(), track.eta(), spm.centrality, (spm.ux * spm.qxA) / std::sqrt(std::fabs(spm.corrQQx)), weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnAy"), track.pt(), track.eta(), spm.centrality, (spm.uy * spm.qyA) / std::sqrt(std::fabs(spm.corrQQy)), weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnCx"), track.pt(), track.eta(), spm.centrality, (spm.ux * spm.qxC) / std::sqrt(std::fabs(spm.corrQQx)), weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnCy"), track.pt(), track.eta(), spm.centrality, (spm.uy * spm.qyC) / std::sqrt(std::fabs(spm.corrQQy)), weight); } if (cfgFillEventPlane) { // only fill for inclusive! - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnA_EP"), track.pt(), track.eta(), centrality, vnA, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnC_EP"), track.pt(), track.eta(), centrality, vnC, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnFull_EP"), track.pt(), track.eta(), centrality, vnFull, weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnA_EP"), track.pt(), track.eta(), spm.centrality, spm.vnA, weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnC_EP"), track.pt(), track.eta(), spm.centrality, spm.vnC, weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("vnFull_EP"), track.pt(), track.eta(), spm.centrality, spm.vnFull, weight); } } template - inline void fillTrackQA(TrackObject track, double vz, float wacc = 1, float weff = 1) + inline void fillTrackQA(TrackObject track, bool useCentrality = false) { if (!cfgFillTrackQA) return; static constexpr std::string_view Time[] = {"before/", "after/"}; // NOTE: species[kUnidentified] = "" (when no PID) - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_Pt"), track.phi(), track.eta(), track.pt()); - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_Pt_corrected"), track.phi(), track.eta(), track.pt(), wacc * weff); - - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_vz"), track.phi(), track.eta(), vz); - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_vz_corrected"), track.phi(), track.eta(), vz, wacc * weff); - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hDCAxy_pt"), track.pt(), track.dcaXY(), wacc * weff); - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hDCAz_pt"), track.pt(), track.dcaZ(), wacc * weff); - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hSharedClusters_pt"), track.pt(), track.tpcFractionSharedCls(), wacc * weff); - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hCrossedRows_pt"), track.pt(), track.tpcNClsFound(), wacc * weff); - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hCrossedRows_vs_SharedClusters"), track.tpcNClsFound(), track.tpcFractionSharedCls(), wacc * weff); - } - - template - inline void fillTrackQA(TrackObject track, double vz, double centrality, float wacc = 1, float weff = 1) - { - if (!cfgFillTrackQA) - return; + if (useCentrality) { + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPt_Eta"), track.pt(), track.eta(), spm.centrality, spm.wacc[ct][pt] * spm.weff[ct][pt]); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPt_Eta_uncorrected"), track.pt(), track.eta(), spm.centrality); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta"), track.phi(), track.eta(), spm.centrality, spm.wacc[ct][pt] * spm.weff[ct][pt]); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_uncorrected"), track.phi(), track.eta(), spm.centrality); + } else { + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_Pt"), track.phi(), track.eta(), track.pt()); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_Pt_corrected"), track.phi(), track.eta(), track.pt(), spm.wacc[ct][pt] * spm.weff[ct][pt]); + } - static constexpr std::string_view Time[] = {"before/", "after/"}; - // NOTE: species[kUnidentified] = "" (when no PID) - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPt_Eta"), track.pt(), track.eta(), centrality, wacc * weff); - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPt_Eta_uncorrected"), track.pt(), track.eta(), centrality); - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta"), track.phi(), track.eta(), centrality, wacc * weff); - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_uncorrected"), track.phi(), track.eta(), centrality); - - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_vz"), track.phi(), track.eta(), vz); - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_vz_corrected"), track.phi(), track.eta(), vz, wacc); - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hDCAxy_pt"), track.pt(), track.dcaXY(), wacc * weff); - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hDCAz_pt"), track.pt(), track.dcaZ(), wacc * weff); - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hSharedClusters_pt"), track.pt(), track.tpcFractionSharedCls(), wacc * weff); - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hCrossedRows_pt"), track.pt(), track.tpcNClsFound(), wacc * weff); - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hCrossedRows_vs_SharedClusters"), track.tpcNClsFound(), track.tpcFractionSharedCls(), wacc * weff); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_vz"), track.phi(), track.eta(), spm.vz); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_vz_corrected"), track.phi(), track.eta(), spm.vz, spm.wacc[ct][pt]); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hDCAxy_pt"), track.pt(), track.dcaXY(), spm.wacc[ct][pt] * spm.weff[ct][pt]); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hDCAz_pt"), track.pt(), track.dcaZ(), spm.wacc[ct][pt] * spm.weff[ct][pt]); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hSharedClusters_pt"), track.pt(), track.tpcFractionSharedCls(), spm.wacc[ct][pt] * spm.weff[ct][pt]); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hCrossedRows_pt"), track.pt(), track.tpcNClsFound(), spm.wacc[ct][pt] * spm.weff[ct][pt]); + histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hCrossedRows_vs_SharedClusters"), track.tpcNClsFound(), track.tpcFractionSharedCls(), spm.wacc[ct][pt] * spm.weff[ct][pt]); } template @@ -1016,86 +1049,79 @@ struct FlowSP { } template - inline void fillMCPtHistos(TrackObject track, int pdgCode, float centrality) + inline void fillMCPtHistos(TrackObject track, int pdgCode) { static constexpr std::string_view Time[] = {"before/", "after/"}; static constexpr std::string_view Mode[] = {"Gen/", "Reco/"}; - registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("incl/hPt_hadron"), track.pt(), track.eta(), centrality); + registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("incl/hPt_hadron"), track.pt(), track.eta(), spm.centrality); if (pdgCode > 0) { - registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("pos/hPt_hadron"), track.pt(), track.eta(), centrality); + registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("pos/hPt_hadron"), track.pt(), track.eta(), spm.centrality); } else { - registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("neg/hPt_hadron"), track.pt(), track.eta(), centrality); + registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("neg/hPt_hadron"), track.pt(), track.eta(), spm.centrality); } if (pdgCode == kPiPlus || pdgCode == kPiMinus) { - registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("incl/hPt_pion"), track.pt(), track.eta(), centrality); + registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("incl/hPt_pion"), track.pt(), track.eta(), spm.centrality); if (pdgCode == kPiPlus) { - registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("pos/hPt_pion"), track.pt(), track.eta(), centrality); + registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("pos/hPt_pion"), track.pt(), track.eta(), spm.centrality); } else { - registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("neg/hPt_pion"), track.pt(), track.eta(), centrality); + registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("neg/hPt_pion"), track.pt(), track.eta(), spm.centrality); } } else if (pdgCode == kKPlus || pdgCode == kKMinus) { - registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("incl/hPt_kaon"), track.pt(), track.eta(), centrality); + registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("incl/hPt_kaon"), track.pt(), track.eta(), spm.centrality); if (pdgCode == kKPlus) { - registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("pos/hPt_kaon"), track.pt(), track.eta(), centrality); + registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("pos/hPt_kaon"), track.pt(), track.eta(), spm.centrality); } else { - registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("neg/hPt_kaon"), track.pt(), track.eta(), centrality); + registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("neg/hPt_kaon"), track.pt(), track.eta(), spm.centrality); } } else if (pdgCode == kProton || pdgCode == kProtonBar) { - registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("incl/hPt_proton"), track.pt(), track.eta(), centrality); + registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("incl/hPt_proton"), track.pt(), track.eta(), spm.centrality); if (pdgCode == kProton) { - registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("pos/hPt_proton"), track.pt(), track.eta(), centrality); + registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("pos/hPt_proton"), track.pt(), track.eta(), spm.centrality); } else { - registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("neg/hPt_proton"), track.pt(), track.eta(), centrality); + registry.fill(HIST("trackMC") + HIST(Mode[md]) + HIST(Time[ft]) + HIST("neg/hPt_proton"), track.pt(), track.eta(), spm.centrality); } } } template - inline void fillPrimaryHistos(McParticleObject mcparticle, float centrality) + inline void fillPrimaryHistos(McParticleObject mcparticle) { static constexpr std::string_view Time[] = {"/before", "/after"}; if (!mcparticle.isPhysicalPrimary()) { - registry.fill(HIST("trackMCReco") + HIST(Time[ft]) + HIST("/hIsPhysicalPrimary"), 0, centrality); + registry.fill(HIST("trackMCReco") + HIST(Time[ft]) + HIST("/hIsPhysicalPrimary"), 0, spm.centrality); } else { - registry.fill(HIST("trackMCReco") + HIST(Time[ft]) + HIST("/hIsPhysicalPrimary"), 1, centrality); + registry.fill(HIST("trackMCReco") + HIST(Time[ft]) + HIST("/hIsPhysicalPrimary"), 1, spm.centrality); } } - template - void fillAllQA(TrackObject track, double vtxz, double centrality, bool pos, float wacc = 1, float weff = 1, float waccP = 1, float weffP = 1, float waccN = 1, float weffN = 1) + template + void fillAllQA(TrackObject track) { - if (!cfgTrackSelDoTrackQAvsCent) { - fillTrackQA(track, vtxz, wacc, weff); - } else { - fillTrackQA(track, vtxz, centrality, wacc, weff); - } + fillTrackQA(track, cfgTrackSelDoTrackQAvsCent); fillPIDQA(track); - if (!cfgFillChargeDependenceQA) - return; - - if (pos) { - if (!cfgTrackSelDoTrackQAvsCent) { - fillTrackQA(track, vtxz, waccP, weffP); - } else { - fillTrackQA(track, vtxz, centrality, waccP, weffP); - } - fillPIDQA(track); - } else { - if (!cfgTrackSelDoTrackQAvsCent) { - fillTrackQA(track, vtxz, waccN, weffN); - } else { - fillTrackQA(track, vtxz, centrality, waccN, weffN); + if (cfgFillChargeDependenceQA) { + switch (spm.charge) { + case kPositive: { + fillTrackQA(track, cfgTrackSelDoTrackQAvsCent); + fillPIDQA(track); + break; + } + case kNegative: { + fillTrackQA(track, cfgTrackSelDoTrackQAvsCent); + fillPIDQA(track); + break; + } } - fillPIDQA(track); } } void processData(ZDCCollisions::iterator const& collision, aod::BCsWithTimestamps const&, UsedTracks const& tracks) { + histos.fill(HIST("hEventCount"), evSel_FilteredEvent); auto bc = collision.bc_as(); int standardMagField = 99999; @@ -1114,233 +1140,263 @@ struct FlowSP { loadCorrections(bc.timestamp()); - float centrality = collision.centFT0C(); + spm.centrality = collision.centFT0C(); if (cfgCentFT0Cvariant1) - centrality = collision.centFT0CVariant1(); + spm.centrality = collision.centFT0CVariant1(); if (cfgCentFT0M) - centrality = collision.centFT0M(); + spm.centrality = collision.centFT0M(); if (cfgCentFV0A) - centrality = collision.centFV0A(); + spm.centrality = collision.centFV0A(); if (cfgCentNGlobal) - centrality = collision.centNGlobal(); + spm.centrality = collision.centNGlobal(); if (!eventSelected(collision, tracks.size())) return; - if (collision.isSelected()) { + if (!collision.isSelected()) // selected by ZDCQVectors task (checks signal in ZDC) --> only possible in data not MC + return; + histos.fill(HIST("hEventCount"), evSel_isSelectedZDC); - histos.fill(HIST("hEventCount"), evSel_isSelectedZDC); + spm.qxA = collision.qxA(); + spm.qyA = collision.qyA(); + spm.qxC = collision.qxC(); + spm.qyC = collision.qyC(); - double qxA = collision.qxA(); - double qyA = collision.qyA(); - double qxC = collision.qxC(); - double qyC = collision.qyC(); + spm.vz = collision.posZ(); + float vtxz = collision.posZ(); - double vtxz = collision.posZ(); - double psiA = 1.0 * std::atan2(qyA, qxA); - double psiC = 1.0 * std::atan2(qyC, qxC); + double psiA = 1.0 * std::atan2(spm.qyA, spm.qxA); + double psiC = 1.0 * std::atan2(spm.qyC, spm.qxC); - // https://twiki.cern.ch/twiki/pub/ALICE/DirectedFlowAnalysisNote/vn_ZDC_ALICE_INT_NOTE_version02.pdf - double psiFull = 1.0 * std::atan2(qyA + qyC, qxA + qxC); + // https://twiki.cern.ch/twiki/pub/ALICE/DirectedFlowAnalysisNote/vn_ZDC_ALICE_INT_NOTE_version02.pdf + double psiFull = 1.0 * std::atan2(spm.qyA + spm.qyC, spm.qxA + spm.qxC); - // always fill these histograms! - registry.fill(HIST("QQCorrelations/qAqCXY"), centrality, qxA * qxC + qyA * qyC); - registry.fill(HIST("QQCorrelations/qAXqCY"), centrality, qxA * qyC); - registry.fill(HIST("QQCorrelations/qAYqCX"), centrality, qyA * qxC); - registry.fill(HIST("QQCorrelations/qAXYqCXY"), centrality, qyA * qxC + qxA * qyC); - registry.fill(HIST("QQCorrelations/qAqCX"), centrality, qxA * qxC); - registry.fill(HIST("QQCorrelations/qAqCY"), centrality, qyA * qyC); + // always fill these histograms! + registry.fill(HIST("QQCorrelations/qAqCXY"), spm.centrality, spm.qxA * spm.qxC + spm.qyA * spm.qyC); + registry.fill(HIST("QQCorrelations/qAXqCY"), spm.centrality, spm.qxA * spm.qyC); + registry.fill(HIST("QQCorrelations/qAYqCX"), spm.centrality, spm.qyA * spm.qxC); + registry.fill(HIST("QQCorrelations/qAXYqCXY"), spm.centrality, spm.qyA * spm.qxC + spm.qxA * spm.qyC); + registry.fill(HIST("QQCorrelations/qAqCX"), spm.centrality, spm.qxA * spm.qxC); + registry.fill(HIST("QQCorrelations/qAqCY"), spm.centrality, spm.qyA * spm.qyC); - if (cfgFillEventQA) { - histos.fill(HIST("QA/hCentFull"), centrality, 1); - } - if (cfgFillEventPlaneQA) { - histos.fill(HIST("QA/hSPplaneA"), psiA, 1); - histos.fill(HIST("QA/hSPplaneC"), psiC, 1); - histos.fill(HIST("QA/hSPplaneFull"), psiFull, 1); - histos.fill(HIST("QA/hCosPhiACosPhiC"), centrality, std::cos(psiA) * std::cos(psiC)); - histos.fill(HIST("QA/hSinPhiASinPhiC"), centrality, std::sin(psiA) * std::sin(psiC)); - histos.fill(HIST("QA/hSinPhiACosPhiC"), centrality, std::sin(psiA) * std::cos(psiC)); - histos.fill(HIST("QA/hCosPhiASinsPhiC"), centrality, std::cos(psiA) * std::sin(psiC)); - histos.fill(HIST("QA/hFullEvPlaneRes"), centrality, -1 * std::cos(psiA - psiC)); - } + if (cfgFillEventQA) { + histos.fill(HIST("QA/hCentFull"), spm.centrality, 1); + } + if (cfgFillEventPlaneQA) { + histos.fill(HIST("QA/hSPplaneA"), psiA, 1); + histos.fill(HIST("QA/hSPplaneC"), psiC, 1); + histos.fill(HIST("QA/hSPplaneFull"), psiFull, 1); + histos.fill(HIST("QA/hCosPhiACosPhiC"), spm.centrality, std::cos(psiA) * std::cos(psiC)); + histos.fill(HIST("QA/hSinPhiASinPhiC"), spm.centrality, std::sin(psiA) * std::sin(psiC)); + histos.fill(HIST("QA/hSinPhiACosPhiC"), spm.centrality, std::sin(psiA) * std::cos(psiC)); + histos.fill(HIST("QA/hCosPhiASinsPhiC"), spm.centrality, std::cos(psiA) * std::sin(psiC)); + histos.fill(HIST("QA/hFullEvPlaneRes"), spm.centrality, -1 * std::cos(psiA - psiC)); + } - if (centrality > cfgCentMax || centrality < cfgCentMin) - return; - - histos.fill(HIST("hEventCount"), evSel_CentCuts); - - // Load correlations and SP resolution needed for Scalar Product and event plane methods. - // Only load once! - // If not loaded set to 1 - double corrQQ = 1., corrQQx = 1., corrQQy = 1.; - if (cfgCCDBdir_QQ.value.empty() == false) { - if (!cfg.clQQ) { - TList* hcorrList = ccdb->getForTimeStamp(cfgCCDBdir_QQ.value, bc.timestamp()); - cfg.hcorrQQ = reinterpret_cast(hcorrList->FindObject("qAqCXY")); - cfg.hcorrQQx = reinterpret_cast(hcorrList->FindObject("qAqCX")); - cfg.hcorrQQy = reinterpret_cast(hcorrList->FindObject("qAqCY")); - cfg.clQQ = true; - } - corrQQ = cfg.hcorrQQ->GetBinContent(cfg.hcorrQQ->FindBin(centrality)); - corrQQx = cfg.hcorrQQx->GetBinContent(cfg.hcorrQQx->FindBin(centrality)); - corrQQy = cfg.hcorrQQy->GetBinContent(cfg.hcorrQQy->FindBin(centrality)); - } + if (spm.centrality > cfgCentMax || spm.centrality < cfgCentMin) + return; - double evPlaneRes = 1.; - if (cfgCCDBdir_SP.value.empty() == false) { - if (!cfg.clEvPlaneRes) { - cfg.hEvPlaneRes = ccdb->getForTimeStamp(cfgCCDBdir_SP.value, bc.timestamp()); - cfg.clEvPlaneRes = true; - } - evPlaneRes = cfg.hEvPlaneRes->GetBinContent(cfg.hEvPlaneRes->FindBin(centrality)); - if (evPlaneRes < 0) - LOGF(fatal, " > 0 for centrality %.2f! Cannot determine resolution.. Change centrality ranges!!!", centrality); - evPlaneRes = std::sqrt(evPlaneRes); - } + histos.fill(HIST("hEventCount"), evSel_CentCuts); - double centWeight = 1.0; - if (cfgCCDBdir_centrality.value.empty() == false) { - if (!cfg.clCentrality) { - cfg.hCentrality = ccdb->getForTimeStamp(cfgCCDBdir_centrality.value, bc.timestamp()); - cfg.clCentrality = true; - } - centWeight = cfg.hCentrality->GetBinContent(cfg.hCentrality->FindBin(centrality)); - if (centWeight < 0) - LOGF(fatal, "Centrality weight cannot be negative.. abort for (%.2f)", centrality); + // Load correlations and SP resolution needed for Scalar Product and event plane methods. + // Only load once! + // If not loaded set to 1 + + if (cfgCCDBdir_QQ.value.empty() == false) { + if (!cfg.clQQ) { + TList* hcorrList = ccdb->getForTimeStamp(cfgCCDBdir_QQ.value, bc.timestamp()); + cfg.hcorrQQ = reinterpret_cast(hcorrList->FindObject("qAqCXY")); + cfg.hcorrQQx = reinterpret_cast(hcorrList->FindObject("qAqCX")); + cfg.hcorrQQy = reinterpret_cast(hcorrList->FindObject("qAqCY")); + cfg.clQQ = true; } + spm.corrQQ = cfg.hcorrQQ->GetBinContent(cfg.hcorrQQ->FindBin(spm.centrality)); + spm.corrQQx = cfg.hcorrQQx->GetBinContent(cfg.hcorrQQx->FindBin(spm.centrality)); + spm.corrQQy = cfg.hcorrQQy->GetBinContent(cfg.hcorrQQy->FindBin(spm.centrality)); + } - fillEventQA(collision, tracks, centWeight); - - for (const auto& track : tracks) { - - int trackPID = (cfgFillPID || cfgFillPIDQA) ? getTrackPID(track) : kUnidentified; + double evPlaneRes = 1.; + if (cfgCCDBdir_SP.value.empty() == false) { + if (!cfg.clEvPlaneRes) { + cfg.hEvPlaneRes = ccdb->getForTimeStamp(cfgCCDBdir_SP.value, bc.timestamp()); + cfg.clEvPlaneRes = true; + } + evPlaneRes = cfg.hEvPlaneRes->GetBinContent(cfg.hEvPlaneRes->FindBin(spm.centrality)); + if (evPlaneRes < 0) + LOGF(fatal, " > 0 for centrality %.2f! Cannot determine resolution.. Change centrality ranges!!!", spm.centrality); + evPlaneRes = std::sqrt(evPlaneRes); + } - if (cfgFillPIDQA) - histos.fill(HIST("hPIDcounts"), trackPID, track.pt()); + if (cfgCCDBdir_centrality.value.empty() == false) { + if (!cfg.clCentrality) { + cfg.hCentrality = ccdb->getForTimeStamp(cfgCCDBdir_centrality.value, bc.timestamp()); + cfg.clCentrality = true; + } + spm.centWeight = cfg.hCentrality->GetBinContent(cfg.hCentrality->FindBin(spm.centrality)); + if (spm.centWeight < 0) + LOGF(fatal, "Centrality weight cannot be negative.. abort for (%.2f)", spm.centrality); + } - float weff = 1., wacc = 1.; - float weffP = 1., waccP = 1.; - float weffN = 1., waccN = 1.; + fillEventQA(collision, tracks); - if (track.sign() == 0.0) - continue; + for (const auto& track : tracks) { - histos.fill(HIST("hTrackCount"), trackSel_ZeroCharge); - bool pos = (track.sign() > 0) ? true : false; + ParticleType trackPID = (cfgFillPID || cfgFillPIDQA) ? getTrackPID(track) : kUnidentified; - if (cfgFillQABefore) { - fillAllQA(track, vtxz, centrality, pos); - - if (cfgFillPIDQA) { - switch (trackPID) { - case kPions: - fillAllQA(track, vtxz, centrality, pos); - break; - case kKaons: - fillAllQA(track, vtxz, centrality, pos); - break; - case kProtons: - fillAllQA(track, vtxz, centrality, pos); - break; - } - } - } - - if (!trackSelected(track, field)) - continue; + if (cfgFillPIDQA) + histos.fill(HIST("hPIDcounts"), trackPID, track.pt()); - // constrain angle to 0 -> [0,0+2pi] - auto phi = RecoDecay::constrainAngle(track.phi(), 0); - - // Fill NUA weights (last 0 is for Data see GFWWeights class (not a weight)) - // ToDo: Add pi, ka, proton here! - if (cfgFillWeights) { - fWeights->fill(phi, track.eta(), vtxz, track.pt(), centrality, 0); - registry.fill(HIST("weights2D/hPhi_Eta_vz"), phi, track.eta(), vtxz, 1); - } - if (cfgFillWeightsPOS && pos) { - fWeightsPOS->fill(phi, track.eta(), vtxz, track.pt(), centrality, 0); - registry.fill(HIST("weights2D/hPhi_Eta_vz_positive"), phi, track.eta(), vtxz, 1); - } - if (cfgFillWeightsNEG && !pos) { - fWeightsNEG->fill(phi, track.eta(), vtxz, track.pt(), centrality, 0); - registry.fill(HIST("weights2D/hPhi_Eta_vz_negative"), phi, track.eta(), vtxz, 1); - } - - // Set weff and wacc for inclusive, negative and positive hadrons - if (!setCurrentParticleWeights(kInclusive, weff, wacc, phi, track.eta(), track.pt(), vtxz)) - continue; - if (pos && !setCurrentParticleWeights(kPositive, weffP, waccP, phi, track.eta(), track.pt(), vtxz)) - continue; - if (!pos && !setCurrentParticleWeights(kNegative, weffN, waccN, phi, track.eta(), track.pt(), vtxz)) - continue; + if (track.sign() == 0) + continue; - histos.fill(HIST("hTrackCount"), trackSel_ParticleWeights); + histos.fill(HIST("hTrackCount"), trackSel_ZeroCharge); - fillAllQA(track, vtxz, centrality, pos, wacc, weff, waccP, weffP, waccN, weffN); + spm.charge = ((track.sign() > 0)) ? kPositive : kNegative; + if (cfgFillQABefore) { + fillAllQA(track); if (cfgFillPIDQA) { switch (trackPID) { case kPions: - fillAllQA(track, vtxz, centrality, pos, wacc, weff, waccP, weffP, waccN, weffN); + fillAllQA(track); break; case kKaons: - fillAllQA(track, vtxz, centrality, pos, wacc, weff, waccP, weffP, waccN, weffN); + fillAllQA(track); break; case kProtons: - fillAllQA(track, vtxz, centrality, pos, wacc, weff, waccP, weffP, waccN, weffN); + fillAllQA(track); + break; + default: /* do nothing */ break; } } + } - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - auto ux = std::cos(cfgHarm * phi); - auto uy = std::sin(cfgHarm * phi); + if (!trackSelected(track, field)) + continue; - auto uxMH = std::cos(cfgHarmMixed1 * phi); - auto uyMH = std::sin(cfgHarmMixed1 * phi); - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // constrain angle to 0 -> [0,0+2pi] + auto phi = RecoDecay::constrainAngle(track.phi(), 0); + + // Fill NUA weights (last 0 is for Data see GFWWeights class (not a weight)) + // ToDo: Add pi, ka, proton here! + if (cfgFillWeights) { + fWeights->fill(phi, track.eta(), spm.vz, track.pt(), spm.centrality, 0); + registry.fill(HIST("weights2D/hPhi_Eta_vz"), phi, track.eta(), spm.vz, 1); + } + if (cfgFillWeightsPOS && spm.charge == kPositive) { + fWeightsPOS->fill(phi, track.eta(), spm.vz, track.pt(), spm.centrality, 0); + registry.fill(HIST("weights2D/hPhi_Eta_vz_positive"), phi, track.eta(), spm.vz, 1); + } + if (cfgFillWeightsNEG && spm.charge == kNegative) { + fWeightsNEG->fill(phi, track.eta(), spm.vz, track.pt(), spm.centrality, 0); + registry.fill(HIST("weights2D/hPhi_Eta_vz_negative"), phi, track.eta(), spm.vz, 1); + } - double vnA = std::cos(cfgHarm * (phi - psiA)) / evPlaneRes; - double vnC = std::cos(cfgHarm * (phi - psiC)) / evPlaneRes; - double vnFull = std::cos(cfgHarm * (phi - psiFull)) / evPlaneRes; + // Set weff and wacc for inclusive, negative and positive hadrons + if (!setCurrentParticleWeights(kInclusive, kUnidentified, phi, track.eta(), track.pt(), vtxz)) + continue; + if (!setCurrentParticleWeights(spm.charge, kUnidentified, phi, track.eta(), track.pt(), vtxz)) + continue; - fillHistograms(track, wacc, weff, centWeight, ux, uy, uxMH, uyMH, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); + histos.fill(HIST("hTrackCount"), trackSel_ParticleWeights); - // NOTE: these are not the right wacc and weff!! Need to do for each particle species! This is just to test for now. - if (cfgFillPID) { - if (trackPID == kPions) { - fillHistograms(track, wacc, weff, centWeight, ux, uy, uxMH, uyMH, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); - if (pos) - fillHistograms(track, waccP, weffP, centWeight, ux, uy, uxMH, uyMH, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); - else - fillHistograms(track, waccN, weffN, centWeight, ux, uy, uxMH, uyMH, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); - } else if (trackPID == kKaons) { - fillHistograms(track, wacc, weff, centWeight, ux, uy, uxMH, uyMH, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); - if (pos) - fillHistograms(track, waccP, weffP, centWeight, ux, uy, uxMH, uyMH, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); - else - fillHistograms(track, waccN, weffN, centWeight, ux, uy, uxMH, uyMH, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); - } else if (trackPID == kProtons) { - fillHistograms(track, wacc, weff, centWeight, ux, uy, uxMH, uyMH, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); - if (pos) - fillHistograms(track, waccP, weffP, centWeight, ux, uy, uxMH, uyMH, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); - else - fillHistograms(track, waccN, weffN, centWeight, ux, uy, uxMH, uyMH, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); - } + fillAllQA(track); + if (cfgFillPIDQA) { + switch (trackPID) { + case kPions: + fillAllQA(track); + break; + case kKaons: + fillAllQA(track); + break; + case kProtons: + fillAllQA(track); + break; + default: /* do nothing */ + break; + } + } + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + spm.ux = std::cos(cfgHarm * phi); + spm.uy = std::sin(cfgHarm * phi); + + spm.uxMH = std::cos(cfgHarmMixed * phi); + spm.uyMH = std::sin(cfgHarmMixed * phi); + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + spm.vnA = std::cos(cfgHarm * (phi - psiA)) / evPlaneRes; + spm.vnC = std::cos(cfgHarm * (phi - psiC)) / evPlaneRes; + spm.vnFull = std::cos(cfgHarm * (phi - psiFull)) / evPlaneRes; + + fillHistograms(track); + + if (cfgFillChargeDependence) { + switch (spm.charge) { + case kPositive: + fillHistograms(track); + break; + case kNegative: + fillHistograms(track); + break; } + } + if (cfgFillPID) { + switch (trackPID) { + case kPions: + fillHistograms(track); + break; + case kKaons: + fillHistograms(track); + break; + case kProtons: + fillHistograms(track); + break; + default: /* do nothing */ + break; + } if (cfgFillChargeDependence) { - if (pos) { - fillHistograms(track, waccP, weffP, centWeight, ux, uy, uxMH, uyMH, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); - } else { - fillHistograms(track, waccN, weffN, centWeight, ux, uy, uxMH, uyMH, qxA, qyA, qxC, qyC, corrQQx, corrQQy, corrQQ, vnA, vnC, vnFull, centrality); + switch (spm.charge) { + case kPositive: { + switch (trackPID) { + case kPions: + fillHistograms(track); + break; + case kKaons: + fillHistograms(track); + break; + case kProtons: + fillHistograms(track); + break; + default: /* do nothing */ + break; + } + break; + } + case kNegative: { + switch (trackPID) { + case kPions: + fillHistograms(track); + break; + case kKaons: + fillHistograms(track); + break; + case kProtons: + fillHistograms(track); + break; + default: /* do nothing */ + break; + } + break; + } } } - } // end of track loop - } // end of collision isSelected loop + } // end of fillPID + + } // end of track loop } PROCESS_SWITCH(FlowSP, processData, "Process analysis for non-derived data", true); @@ -1351,16 +1407,16 @@ struct FlowSP { int standardMagField = 99999; auto field = (cfgMagField == standardMagField) ? getMagneticField(bc.timestamp()) : cfgMagField; - double vtxz = collision.posZ(); - float centrality = collision.centFT0C(); + spm.vz = collision.posZ(); + spm.centrality = collision.centFT0C(); if (cfgCentFT0Cvariant1) - centrality = collision.centFT0CVariant1(); + spm.centrality = collision.centFT0CVariant1(); if (cfgCentFT0M) - centrality = collision.centFT0M(); + spm.centrality = collision.centFT0M(); if (cfgCentFV0A) - centrality = collision.centFV0A(); + spm.centrality = collision.centFV0A(); if (cfgCentNGlobal) - centrality = collision.centNGlobal(); + spm.centrality = collision.centNGlobal(); if (cfgFillQABefore) fillEventQA(collision, filteredTracks); @@ -1368,7 +1424,7 @@ struct FlowSP { if (!eventSelected(collision, filteredTracks.size())) return; - if (centrality > cfgCentMax || centrality < cfgCentMin) + if (spm.centrality > cfgCentMax || spm.centrality < cfgCentMin) return; histos.fill(HIST("hEventCount"), evSel_CentCuts); @@ -1380,8 +1436,8 @@ struct FlowSP { fillEventQA(collision, filteredTracks); - registry.fill(HIST("trackMCReco/hTrackSize_unFiltered"), tracks.size(), centrality); - registry.fill(HIST("trackMCReco/hTrackSize_Filtered"), filteredTracks.size(), centrality); + registry.fill(HIST("trackMCReco/hTrackSize_unFiltered"), tracks.size(), spm.centrality); + registry.fill(HIST("trackMCReco/hTrackSize_Filtered"), filteredTracks.size(), spm.centrality); for (const auto& track : filteredTracks) { auto mcParticle = track.mcParticle(); @@ -1389,28 +1445,27 @@ struct FlowSP { continue; histos.fill(HIST("hTrackCount"), trackSel_ZeroCharge); - fillMCPtHistos(track, mcParticle.pdgCode(), centrality); - fillPrimaryHistos(mcParticle, centrality); + fillMCPtHistos(track, mcParticle.pdgCode()); + fillPrimaryHistos(mcParticle); if (!mcParticle.isPhysicalPrimary()) continue; - bool pos = (track.sign() > 0) ? true : false; + spm.charge = (track.sign() > 0) ? kPositive : kNegative; // This neglects PID (for now) later use getPID like in data. if (cfgFillQABefore) { - fillAllQA(track, vtxz, centrality, pos); - + fillAllQA(track); if (cfgFillPIDQA) { switch (std::abs(mcParticle.pdgCode())) { - case kPions: - fillAllQA(track, vtxz, centrality, pos); + case kPiPlus: + fillAllQA(track); break; - case kKaons: - fillAllQA(track, vtxz, centrality, pos); + case kKPlus: + fillAllQA(track); break; - case kProtons: - fillAllQA(track, vtxz, centrality, pos); + case kProton: + fillAllQA(track); break; } } @@ -1419,25 +1474,25 @@ struct FlowSP { if (!trackSelected(track, field)) continue; - fillMCPtHistos(track, mcParticle.pdgCode(), centrality); + fillMCPtHistos(track, mcParticle.pdgCode()); - fillAllQA(track, vtxz, centrality, pos); + fillAllQA(track); if (cfgFillPIDQA) { switch (std::abs(mcParticle.pdgCode())) { case kPions: - fillAllQA(track, vtxz, centrality, pos); + fillAllQA(track); break; case kKaons: - fillAllQA(track, vtxz, centrality, pos); + fillAllQA(track); break; case kProtons: - fillAllQA(track, vtxz, centrality, pos); + fillAllQA(track); break; } } - fillPrimaryHistos(mcParticle, centrality); + fillPrimaryHistos(mcParticle); } // end of track loop } @@ -1447,7 +1502,7 @@ struct FlowSP { { for (const auto& mcCollision : mcCollisions) { - float centrality = -1; + spm.centrality = -1; bool colSelected = true; // get McParticles which belong to mccollision @@ -1466,15 +1521,15 @@ struct FlowSP { auto filteredTrackSlice = filteredTracks.sliceBy(trackPerCollision, col.globalIndex()); - centrality = col.centFT0C(); + spm.centrality = col.centFT0C(); if (cfgCentFT0Cvariant1) - centrality = col.centFT0CVariant1(); + spm.centrality = col.centFT0CVariant1(); if (cfgCentFT0M) - centrality = col.centFT0M(); + spm.centrality = col.centFT0M(); if (cfgCentFV0A) - centrality = col.centFV0A(); + spm.centrality = col.centFV0A(); if (cfgCentNGlobal) - centrality = col.centNGlobal(); + spm.centrality = col.centNGlobal(); if (cfgFillQABefore) fillEventQA(col, filteredTrackSlice); @@ -1488,7 +1543,7 @@ struct FlowSP { continue; } - if (centrality > cfgCentMax || centrality < cfgCentMin) { + if (spm.centrality > cfgCentMax || spm.centrality < cfgCentMin) { colSelected = false; continue; } @@ -1507,29 +1562,24 @@ struct FlowSP { if (!particle.isPhysicalPrimary()) continue; - int charge = 0; - auto pdgCode = particle.pdgCode(); auto pdgInfo = pdg->GetParticle(pdgCode); - if (pdgInfo != nullptr) { - charge = pdgInfo->Charge(); - } - if (std::fabs(charge) < 1) + if (std::abs(pdgInfo->Charge()) < 1) continue; + spm.charge = (pdgInfo->Charge() > 0) ? kPositive : kNegative; + int minVal = 100; - if (cfgFilterLeptons && std::fabs(pdgCode) < minVal) { + if (cfgFilterLeptons && std::abs(pdgCode) < minVal) { continue; } - bool pos = (charge > 0) ? true : false; - - fillMCPtHistos(particle, pdgCode, centrality); + fillMCPtHistos(particle, pdgCode); registry.fill(HIST("trackMCGen/before/incl/phi_eta_vtxZ_gen"), particle.phi(), particle.eta(), vtxz); - if (pos) { + if (spm.charge == kPositive) { registry.fill(HIST("trackMCGen/before/pos/phi_eta_vtxZ_gen"), particle.phi(), particle.eta(), vtxz); } else { registry.fill(HIST("trackMCGen/before/neg/phi_eta_vtxZ_gen"), particle.phi(), particle.eta(), vtxz); @@ -1538,11 +1588,11 @@ struct FlowSP { if (particle.eta() < -cfgTrackSelsEta || particle.eta() > cfgTrackSelsEta || particle.pt() < cfgTrackSelsPtmin || particle.pt() > cfgTrackSelsPtmax) continue; - fillMCPtHistos(particle, pdgCode, centrality); + fillMCPtHistos(particle, pdgCode); registry.fill(HIST("trackMCGen/after/incl/phi_eta_vtxZ_gen"), particle.phi(), particle.eta(), vtxz); - if (pos) { + if (spm.charge == kPositive) { registry.fill(HIST("trackMCGen/after/pos/phi_eta_vtxZ_gen"), particle.phi(), particle.eta(), vtxz); } else { registry.fill(HIST("trackMCGen/after/neg/phi_eta_vtxZ_gen"), particle.phi(), particle.eta(), vtxz); From 4f187dc73dcc894bca5fd2080586723624bf1944 Mon Sep 17 00:00:00 2001 From: abmodak <67369858+abmodak@users.noreply.github.com> Date: Fri, 12 Sep 2025 13:01:07 -0500 Subject: [PATCH 375/986] [PWGCF] Update longrangecorrelation task (#12963) Co-authored-by: ALICE Action Bot --- .../Tasks/longrangeCorrelation.cxx | 141 +++++++++++++++--- 1 file changed, 120 insertions(+), 21 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx index 02cd3ac1d0a..fdf69531056 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx @@ -85,10 +85,11 @@ enum KindOfCorrType { kFT0CGLOBAL, kFV0GLOBAL, kMFTGLOBAL, - kFV0MFT + kFV0MFT, + kFT0AMFT }; -static constexpr std::string_view kCorrType[] = {"Ft0aGlobal/", "Ft0cGlobal/", "Fv0Global/", "MftGlobal/", "Fv0Mft/"}; +static constexpr std::string_view kCorrType[] = {"Ft0aGlobal/", "Ft0cGlobal/", "Fv0Global/", "MftGlobal/", "Fv0Mft/", "Ft0aMft/"}; static constexpr std::string_view kEvntType[] = {"SE/", "ME/"}; AxisSpec axisEvent{10, 0.5, 9.5, "#Event", "EventAxis"}; @@ -159,6 +160,8 @@ struct LongrangeCorrelation { OutputObj mixedFv0Global{Form("mixedEventFv0Global_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; OutputObj sameFv0Mft{Form("sameEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; OutputObj mixedFv0Mft{Form("mixedEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; + OutputObj sameFt0aMft{Form("sameEventFt0aMft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; + OutputObj mixedFt0aMft{Form("mixedEventFt0aMft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; template void addHistos() @@ -253,6 +256,13 @@ struct LongrangeCorrelation { sameFv0Mft.setObject(new CorrelationContainer(Form("sameEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); mixedFv0Mft.setObject(new CorrelationContainer(Form("mixedEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); } + + if (doprocessFt0aMftSE || doprocessFt0aMftME) { + addHistos(); + addHistos(); + sameFt0aMft.setObject(new CorrelationContainer(Form("sameEventFt0aMft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFt0aMft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); + mixedFt0aMft.setObject(new CorrelationContainer(Form("mixedEventFt0aMft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFt0aMft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); + } } Filter fTrackSelectionITS = ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) && @@ -268,14 +278,14 @@ struct LongrangeCorrelation { Filter fMftTrackColID = (aod::fwdtrack::bestCollisionId >= 0); Filter fMftTrackDca = (nabs(aod::fwdtrack::bestDCAXY) < cfigMftDcaxy); - double getPhiFT0(UInt_t chno, int i) + double getPhiFT0(uint chno, int i) { ft0Det.calculateChannelCenter(); auto chPos = ft0Det.getChannelCenter(chno); return RecoDecay::phi(chPos.X() + (*offsetFT0)[i].getX(), chPos.Y() + (*offsetFT0)[i].getY()); } - double getPhiFV0(UInt_t chno) + double getPhiFV0(uint chno) { int cellsInLeft[] = {0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27, 32, 40, 33, 41, 34, 42, 35, 43}; bool isChnoInLeft = std::find(std::begin(cellsInLeft), std::end(cellsInLeft), chno) != std::end(cellsInLeft); @@ -296,7 +306,7 @@ struct LongrangeCorrelation { return RecoDecay::phi(chPos.x + offsetX, chPos.y + offsetY); } - double getEtaFT0(UInt_t chno, int i) + double getEtaFT0(uint chno, int i) { ft0Det.calculateChannelCenter(); auto chPos = ft0Det.getChannelCenter(chno); @@ -308,7 +318,7 @@ struct LongrangeCorrelation { return -std::log(std::tan(0.5 * theta)); } - double getEtaFV0(UInt_t chno) + double getEtaFV0(uint chno) { int cellsInLeft[] = {0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27, 32, 40, 33, 41, 34, 42, 35, 43}; bool isChnoInLeft = std::find(std::begin(cellsInLeft), std::end(cellsInLeft), chno) != std::end(cellsInLeft); @@ -367,22 +377,16 @@ struct LongrangeCorrelation { template void fillYield(TTracks tracks) { - if (evntType == 1) { - histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("hMult"), tracks.size()); - for (auto const& iTrk : tracks) { - histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_etavsphi"), iTrk.phi(), iTrk.eta()); - histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_eta"), iTrk.eta()); - histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_phi"), iTrk.phi()); - histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_pt"), iTrk.pt()); - } - } else { - histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("hMult"), tracks.size()); - for (auto const& iTrk : tracks) { - histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_etavsphi"), iTrk.phi(), iTrk.eta()); - histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_eta"), iTrk.eta()); - histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_phi"), iTrk.phi()); - histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_pt"), iTrk.pt()); + histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("hMult"), tracks.size()); + for (auto const& iTrk : tracks) { + auto phi = iTrk.phi(); + if constexpr (corrType == kFV0MFT || corrType == kFT0AMFT) { + o2::math_utils::bringTo02Pi(phi); } + histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_etavsphi"), phi, iTrk.eta()); + histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_eta"), iTrk.eta()); + histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_phi"), phi); + histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_pt"), iTrk.pt()); } } @@ -597,6 +601,55 @@ struct LongrangeCorrelation { } // trigger tracks } // fillCorrFv0Mft + template + void fillCorrFt0aMft(TTarget target, TTracks const& tracks, TTriggers const& triggers, TFT0s const& ft0, bool mixing, float vz) + { + int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); + if (!mixing) + histos.fill(HIST("Ft0aMft/SE/hMult_used"), tracks.size()); + for (auto const& triggerTrack : triggers) { + if (!isMftTrackSelected(triggerTrack)) { + continue; + } + if (!mixing) + histos.fill(HIST("Ft0aMft/SE/Trig_hist"), fSampleIndex, vz, triggerTrack.pt()); + + auto trigphi = triggerTrack.phi(); + o2::math_utils::bringTo02Pi(trigphi); + + for (std::size_t iCh = 0; iCh < ft0.channelA().size(); iCh++) { + auto chanelid = ft0.channelA()[iCh]; + float ampl = ft0.amplitudeA()[iCh]; + + if (mixing) + histos.fill(HIST("Ft0aMft/ME/Assoc_amp"), chanelid, ampl); + else + histos.fill(HIST("Ft0aMft/SE/Assoc_amp"), chanelid, ampl); + + auto phi = getPhiFT0(chanelid, 0); + auto eta = getEtaFT0(chanelid, 0); + + if (mixing) { + histos.fill(HIST("Ft0aMft/ME/Assoc_eta"), eta); + histos.fill(HIST("Ft0aMft/ME/Assoc_phi"), phi); + histos.fill(HIST("Ft0aMft/ME/Assoc_etavsphi"), phi, eta); + } else { + histos.fill(HIST("Ft0aMft/SE/Assoc_eta"), eta); + histos.fill(HIST("Ft0aMft/SE/Assoc_phi"), phi); + histos.fill(HIST("Ft0aMft/SE/Assoc_etavsphi"), phi, eta); + } + + float deltaPhi = RecoDecay::constrainAngle(trigphi - phi, -PIHalf); + float deltaEta = triggerTrack.eta() - eta; + if (mixing) + histos.fill(HIST("Ft0aMft/ME/deltaEta_deltaPhi"), deltaPhi, deltaEta); + else + histos.fill(HIST("Ft0aMft/SE/deltaEta_deltaPhi"), deltaPhi, deltaEta); + target->getPairHist()->Fill(step, fSampleIndex, vz, triggerTrack.pt(), triggerTrack.pt(), deltaPhi, deltaEta); + } // associated ft0 tracks + } // trigger tracks + } // fillCorrFt0aMft + void processEventStat(CollTable::iterator const& col) { histos.fill(HIST("QA/EventHist"), 1); @@ -691,6 +744,21 @@ struct LongrangeCorrelation { } } // same event + void processFt0aMftSE(CollTable::iterator const& col, aod::FT0s const&, TrksTable const& tracks, MftTrkTable const& mfttracks) + { + if (!isEventSelected(col)) { + return; + } + if (col.has_foundFT0()) { + fillYield(mfttracks); + const auto& ft0 = col.foundFT0(); + if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { + return; + } + fillCorrFt0aMft(sameFt0aMft, tracks, mfttracks, ft0, false, col.posZ()); + } + } // same event + void processFt0aGlobalME(CollTable const& col, aod::FT0s const&, TrksTable const& tracks) { auto getTracksSize = [&tracks, this](CollTable::iterator const& collision) { @@ -826,6 +894,35 @@ struct LongrangeCorrelation { } } // mixed event + void processFt0aMftME(CollTable const& col, aod::FT0s const&, TrksTable const& tracks, MftTrkTable const& mfttracks) + { + auto getTracksSize = [&tracks, this](CollTable::iterator const& collision) { + auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), this->cache); + return associatedTracks.size(); + }; + + using MixedBinning = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getTracksSize)>; + MixedBinning binningOnVtxAndMult{{getTracksSize}, {axisVtxZME, axisMultME}, true}; + for (auto const& [col1, col2] : soa::selfCombinations(binningOnVtxAndMult, mixingParameter, -1, col, col)) { + if (!isEventSelected(col1) || !isEventSelected(col2)) { + continue; + } + if (col1.globalIndex() == col2.globalIndex()) { + continue; + } + if (col1.has_foundFT0() && col2.has_foundFT0()) { + auto slicedGlobalTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); + auto slicedTriggerMftTracks = mfttracks.sliceBy(perColMft, col1.globalIndex()); + fillYield(slicedTriggerMftTracks); + const auto& ft0 = col2.foundFT0(); + if (slicedGlobalTracks.size() < cfgMinMult || slicedGlobalTracks.size() >= cfgMaxMult) { + continue; + } + fillCorrFt0aMft(mixedFt0aMft, slicedGlobalTracks, slicedTriggerMftTracks, ft0, true, col1.posZ()); + } + } + } // mixed event + PROCESS_SWITCH(LongrangeCorrelation, processEventStat, "event stat", false); PROCESS_SWITCH(LongrangeCorrelation, processFt0aGlobalSE, "same event FT0a vs global", false); PROCESS_SWITCH(LongrangeCorrelation, processFt0aGlobalME, "mixed event FT0a vs global", false); @@ -837,6 +934,8 @@ struct LongrangeCorrelation { PROCESS_SWITCH(LongrangeCorrelation, processFv0GlobalME, "mixed event FV0 vs global", false); PROCESS_SWITCH(LongrangeCorrelation, processFv0MftSE, "same event FV0 vs MFT", false); PROCESS_SWITCH(LongrangeCorrelation, processFv0MftME, "mixed event FV0 vs MFT", false); + PROCESS_SWITCH(LongrangeCorrelation, processFt0aMftSE, "same event FT0a vs MFT", false); + PROCESS_SWITCH(LongrangeCorrelation, processFt0aMftME, "mixed event FT0a vs MFT", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 14baa654a4b9842b6160887664ce64f5fa13197b Mon Sep 17 00:00:00 2001 From: Alica Marie <138608995+alicamarie@users.noreply.github.com> Date: Fri, 12 Sep 2025 20:12:12 +0200 Subject: [PATCH 376/986] [PWGHF] Add histograms to charm directed flow task (#12960) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: BiaoZhang (张彪) <52267892+zhangbiao-phy@users.noreply.github.com> --- PWGHF/D2H/Tasks/taskDirectedFlowCharmHadrons.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PWGHF/D2H/Tasks/taskDirectedFlowCharmHadrons.cxx b/PWGHF/D2H/Tasks/taskDirectedFlowCharmHadrons.cxx index bc4d3308c18..23afd2c23ba 100644 --- a/PWGHF/D2H/Tasks/taskDirectedFlowCharmHadrons.cxx +++ b/PWGHF/D2H/Tasks/taskDirectedFlowCharmHadrons.cxx @@ -152,6 +152,8 @@ struct HfTaskDirectedFlowCharmHadrons { registry.add("hpQytQypvscent", "hpQytQypvscent", HistType::kTHnSparseF, {thnAxisCent, thnAxisScalarProd}, true); registry.add("hpQxtQypvscent", "hpQxtQypvscent", HistType::kTHnSparseF, {thnAxisCent, thnAxisScalarProd}, true); registry.add("hpQxpQytvscent", "hpQxpQytvscent", HistType::kTHnSparseF, {thnAxisCent, thnAxisScalarProd}, true); + registry.add("hpQxtQxpvscentpteta", "hpQxtQxpvscentpteta", HistType::kTHnSparseF, axes, true); + registry.add("hpQytQypvscentpteta", "hpQytQypvscentpteta", HistType::kTHnSparseF, axes, true); registry.add("hpuxQxpvscentpteta", "hpuxQxpvscentpteta", HistType::kTHnSparseF, axes, true); registry.add("hpuyQypvscentpteta", "hpuyQypvscentpteta", HistType::kTHnSparseF, axes, true); registry.add("hpuxQxtvscentpteta", "hpuxQxtvscentpteta", HistType::kTHnSparseF, axes, true); @@ -336,6 +338,8 @@ struct HfTaskDirectedFlowCharmHadrons { registry.fill(HIST("hpuyQypvscentpteta"), massCand, cent, ptCand, etaCand, uyQyp, sign, outputMl[0], outputMl[1]); registry.fill(HIST("hpuxQxtvscentpteta"), massCand, cent, ptCand, etaCand, uxQxt, sign, outputMl[0], outputMl[1]); registry.fill(HIST("hpuyQytvscentpteta"), massCand, cent, ptCand, etaCand, uyQyt, sign, outputMl[0], outputMl[1]); + registry.fill(HIST("hpQxtQxpvscentpteta"), massCand, cent, ptCand, etaCand, qxtQxp, sign, outputMl[0], outputMl[1]); + registry.fill(HIST("hpQytQypvscentpteta"), massCand, cent, ptCand, etaCand, qytQyp, sign, outputMl[0], outputMl[1]); registry.fill(HIST("hpuxvscentpteta"), massCand, cent, ptCand, etaCand, ux, sign, outputMl[0], outputMl[1]); registry.fill(HIST("hpuyvscentpteta"), massCand, cent, ptCand, etaCand, uy, sign, outputMl[0], outputMl[1]); From 12aea969aaa71127dc98687f9d4b884d34652b86 Mon Sep 17 00:00:00 2001 From: abmodak <67369858+abmodak@users.noreply.github.com> Date: Fri, 12 Sep 2025 14:52:57 -0500 Subject: [PATCH 377/986] [PWGLF] Add new task to study multiplicity distributions (#12958) Co-authored-by: ALICE Action Bot --- .../GlobalEventProperties/CMakeLists.txt | 5 + .../Tasks/GlobalEventProperties/studyPnch.cxx | 342 ++++++++++++++++++ 2 files changed, 347 insertions(+) create mode 100644 PWGLF/Tasks/GlobalEventProperties/studyPnch.cxx diff --git a/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt b/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt index 258a43a91d0..50a0d2dfa52 100644 --- a/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt +++ b/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt @@ -28,3 +28,8 @@ o2physics_add_dpl_workflow(flattenicty-pikp SOURCES flattenictyPikp.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::AnalysisCCDB COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(study-pnch + SOURCES studyPnch.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGLF/Tasks/GlobalEventProperties/studyPnch.cxx b/PWGLF/Tasks/GlobalEventProperties/studyPnch.cxx new file mode 100644 index 00000000000..cb00a8d6d2c --- /dev/null +++ b/PWGLF/Tasks/GlobalEventProperties/studyPnch.cxx @@ -0,0 +1,342 @@ +// 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 studyPnch.cxx +/// +/// \brief task for analysis of charged-particle multiplicity distributions +/// \author Abhi Modak (abhi.modak@cern.ch) +/// \since September 10, 2025 + +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGMM/Mult/DataModel/Index.h" +#include "PWGMM/Mult/DataModel/bestCollisionTable.h" + +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/MathConstants.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/Configurable.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/GlobalTrackID.h" +#include "ReconstructionDataFormats/Track.h" + +#include + +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::aod::track; +using namespace o2::aod::evsel; + +using ColDataTable = soa::Join; +using TrackDataTable = soa::Join; +using FilTrackDataTable = soa::Filtered; +using ColMCTrueTable = aod::McCollisions; +using TrackMCTrueTable = aod::McParticles; +using ColMCRecTable = soa::SmallGroups>; +using TrackMCRecTable = soa::Join; +using FilTrackMCRecTable = soa::Filtered; + +static constexpr TrackSelectionFlags::flagtype TrackSelectionIts = + TrackSelectionFlags::kITSNCls | TrackSelectionFlags::kITSChi2NDF | + TrackSelectionFlags::kITSHits; +static constexpr TrackSelectionFlags::flagtype TrackSelectionTpc = + TrackSelectionFlags::kTPCNCls | + TrackSelectionFlags::kTPCCrossedRowsOverNCls | + TrackSelectionFlags::kTPCChi2NDF; +static constexpr TrackSelectionFlags::flagtype TrackSelectionDca = + TrackSelectionFlags::kDCAz | TrackSelectionFlags::kDCAxy; +static constexpr TrackSelectionFlags::flagtype TrackSelectionDcaxyOnly = + TrackSelectionFlags::kDCAxy; + +AxisSpec axisEvent{10, 0.5, 10.5, "#Event", "EventAxis"}; +AxisSpec axisVtxZ{40, -20, 20, "Vertex Z", "VzAxis"}; +AxisSpec axisEta{40, -2, 2, "#eta", "EtaAxis"}; +AxisSpec axisPhi{629, 0, o2::constants::math::TwoPI, "#phi"}; +auto static constexpr kMinCharge = 3.f; + +struct StudyPnch { + + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + Service pdg; + Preslice perCollision = aod::track::collisionId; + + Configurable etaRange{"etaRange", 1.0f, "Eta range to consider"}; + Configurable vtxRange{"vtxRange", 10.0f, "Vertex Z range to consider"}; + Configurable dcaZ{"dcaZ", 0.2f, "Custom DCA Z cut (ignored if negative)"}; + Configurable extraphicut1{"extraphicut1", 3.07666f, "Extra Phi cut 1"}; + Configurable extraphicut2{"extraphicut2", 3.12661f, "Extra Phi cut 2"}; + Configurable extraphicut3{"extraphicut3", 0.03f, "Extra Phi cut 3"}; + Configurable extraphicut4{"extraphicut4", 6.253f, "Extra Phi cut 4"}; + ConfigurableAxis multHistBin{"multHistBin", {501, -0.5, 500.5}, ""}; + ConfigurableAxis pvHistBin{"pvHistBin", {501, -0.5, 500.5}, ""}; + ConfigurableAxis fv0aMultHistBin{"fv0aMultHistBin", {501, -0.5, 500.5}, ""}; + ConfigurableAxis ft0aMultHistBin{"ft0aMultHistBin", {501, -0.5, 500.5}, ""}; + ConfigurableAxis ft0cMultHistBin{"ft0cMultHistBin", {501, -0.5, 500.5}, ""}; + ConfigurableAxis ptHistBin{"ptHistBin", {200, 0., 20.}, ""}; + + Configurable isApplyTFcut{"isApplyTFcut", true, "Enable TimeFrameBorder cut"}; + Configurable isApplyITSROcut{"isApplyITSROcut", true, "Enable ITS ReadOutFrameBorder cut"}; + Configurable isApplySameBunchPileup{"isApplySameBunchPileup", true, "Enable SameBunchPileup cut"}; + Configurable isApplyInelgt0{"isApplyInelgt0", false, "Enable INEL > 0 condition"}; + Configurable isApplyExtraPhiCut{"isApplyExtraPhiCut", false, "Enable extra phi cut"}; + + void init(InitContext const&) + { + AxisSpec axisMult = {multHistBin, "Mult", "MultAxis"}; + AxisSpec axisPV = {pvHistBin, "PV", "PVAxis"}; + AxisSpec axisFv0aMult = {fv0aMultHistBin, "fv0a", "FV0AMultAxis"}; + AxisSpec axisFt0aMult = {ft0aMultHistBin, "ft0a", "FT0AMultAxis"}; + AxisSpec axisFt0cMult = {ft0cMultHistBin, "ft0c", "FT0CMultAxis"}; + AxisSpec axisPt = {ptHistBin, "pT", "pTAxis"}; + + histos.add("EventHist", "EventHist", kTH1D, {axisEvent}, false); + histos.add("VtxZHist", "VtxZHist", kTH1D, {axisVtxZ}, false); + + auto hstat = histos.get(HIST("EventHist")); + auto* x = hstat->GetXaxis(); + x->SetBinLabel(1, "All events"); + x->SetBinLabel(2, "kIsTriggerTVX"); + x->SetBinLabel(3, "kNoTimeFrameBorder"); + x->SetBinLabel(4, "kNoITSROFrameBorder"); + x->SetBinLabel(5, "kNoSameBunchPileup"); // reject collisions in case of pileup with another collision in the same foundBC + x->SetBinLabel(6, "INEL > 0"); + x->SetBinLabel(7, "|vz| < 10"); + + if (doprocessData || doprocessCorrelation || doprocessMonteCarlo) { + histos.add("PhiVsEtaHist", "PhiVsEtaHist", kTH2F, {axisPhi, axisEta}, false); + } + if (doprocessData) { + histos.add("hMultiplicityData", "hMultiplicityData", kTH1F, {axisMult}, true); + } + if (doprocessCorrelation) { + histos.add("GlobalMult_vs_FT0A", "GlobalMult_vs_FT0A", kTH2F, {axisMult, axisFt0aMult}, true); + histos.add("GlobalMult_vs_FT0C", "GlobalMult_vs_FT0C", kTH2F, {axisMult, axisFt0cMult}, true); + histos.add("GlobalMult_vs_FV0A", "GlobalMult_vs_FV0A", kTH2F, {axisMult, axisFv0aMult}, true); + histos.add("NPVtracks_vs_FT0C", "NPVtracks_vs_FT0C", kTH2F, {axisPV, axisFt0cMult}, true); + histos.add("NPVtracks_vs_GlobalMult", "NPVtracks_vs_GlobalMult", kTH2F, {axisPV, axisMult}, true); + } + if (doprocessMonteCarlo) { + histos.add("hMultiplicityMCrec", "hMultiplicityMCrec", kTH1F, {axisMult}, true); + histos.add("hMultiplicityMCgen", "hMultiplicityMCgen", kTH1F, {axisMult}, true); + histos.add("hResponseMatrix", "hResponseMatrix", kTH2F, {axisMult, axisMult}, true); + } + if (doprocessEvtLossSigLossMC) { + histos.add("MCEventHist", "MCEventHist", kTH1F, {axisEvent}, false); + auto hstat = histos.get(HIST("MCEventHist")); + auto* x = hstat->GetXaxis(); + x->SetBinLabel(1, "All MC events"); + x->SetBinLabel(2, "MC events with atleast one reco event"); + histos.add("hMultiplicityMCgenAll", "hMultiplicityMCgenAll", kTH1F, {axisMult}, true); + histos.add("hMultiplicityMCgenSel", "hMultiplicityMCgenSel", kTH1F, {axisMult}, true); + } + } + + template + bool isEventSelected(CheckCol const& col) + { + histos.fill(HIST("EventHist"), 1); + if (!col.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { + return false; + } + histos.fill(HIST("EventHist"), 2); + if (isApplyTFcut && !col.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + return false; + } + histos.fill(HIST("EventHist"), 3); + if (isApplyITSROcut && !col.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + return false; + } + histos.fill(HIST("EventHist"), 4); + if (isApplySameBunchPileup && !col.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + return false; + } + histos.fill(HIST("EventHist"), 5); + if (isApplyInelgt0 && !col.isInelGt0()) { + return false; + } + histos.fill(HIST("EventHist"), 6); + if (std::abs(col.posZ()) >= vtxRange) { + return false; + } + histos.fill(HIST("EventHist"), 7); + histos.fill(HIST("VtxZHist"), col.posZ()); + return true; + } + + template + bool isTrackSelected(CheckTrack const& track) + { + if (std::abs(track.eta()) >= etaRange) { + return false; + } + if (isApplyExtraPhiCut && ((track.phi() > extraphicut1 && track.phi() < extraphicut2) || track.phi() <= extraphicut3 || track.phi() >= extraphicut4)) { + return false; + } + return true; + } + + template + bool isGenTrackSelected(CheckGenTrack const& track) + { + if (!track.isPhysicalPrimary()) { + return false; + } + if (!track.producedByGenerator()) { + return false; + } + auto pdgTrack = pdg->GetParticle(track.pdgCode()); + if (pdgTrack == nullptr) { + return false; + } + if (std::abs(pdgTrack->Charge()) < kMinCharge) { + return false; + } + if (std::abs(track.eta()) >= etaRange) { + return false; + } + if (isApplyExtraPhiCut && ((track.phi() > extraphicut1 && track.phi() < extraphicut2) || track.phi() <= extraphicut3 || track.phi() >= extraphicut4)) { + return false; + } + return true; + } + + template + int countNTracks(countTrk const& tracks) + { + auto nTrk = 0; + for (const auto& track : tracks) { + if (!isTrackSelected(track)) { + continue; + } + histos.fill(HIST("PhiVsEtaHist"), track.phi(), track.eta()); + nTrk++; + } + return nTrk; + } + + template + int countGenTracks(countTrk const& tracks) + { + auto nTrk = 0; + for (const auto& track : tracks) { + if (!isGenTrackSelected(track)) { + continue; + } + histos.fill(HIST("PhiVsEtaHist"), track.phi(), track.eta()); + nTrk++; + } + return nTrk; + } + + Filter fTrackSelectionITS = ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) && + ncheckbit(aod::track::trackCutFlag, TrackSelectionIts); + Filter fTrackSelectionTPC = ifnode(ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC), + ncheckbit(aod::track::trackCutFlag, TrackSelectionTpc), true); + Filter fTrackSelectionDCA = ifnode(dcaZ.node() > 0.f, nabs(aod::track::dcaZ) <= dcaZ && ncheckbit(aod::track::trackCutFlag, TrackSelectionDcaxyOnly), + ncheckbit(aod::track::trackCutFlag, TrackSelectionDca)); + + void processData(ColDataTable::iterator const& cols, FilTrackDataTable const& tracks) + { + if (!isEventSelected(cols)) { + return; + } + auto mult = countNTracks(tracks); + histos.fill(HIST("hMultiplicityData"), mult); + } + + void processCorrelation(ColDataTable::iterator const& cols, FilTrackDataTable const& tracks) + { + if (!isEventSelected(cols)) { + return; + } + auto mult = countNTracks(tracks); + histos.fill(HIST("GlobalMult_vs_FT0A"), mult, cols.multFT0A()); + histos.fill(HIST("GlobalMult_vs_FT0C"), mult, cols.multFT0C()); + histos.fill(HIST("GlobalMult_vs_FV0A"), mult, cols.multFV0A()); + histos.fill(HIST("NPVtracks_vs_FT0C"), cols.multNTracksPV(), cols.multFT0C()); + histos.fill(HIST("NPVtracks_vs_GlobalMult"), cols.multNTracksPV(), mult); + } + + void processMonteCarlo(ColMCTrueTable::iterator const&, ColMCRecTable const& RecCols, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks) + { + for (const auto& RecCol : RecCols) { + if (!isEventSelected(RecCol)) { + continue; + } + auto recTracksPart = RecTracks.sliceBy(perCollision, RecCol.globalIndex()); + auto multrec = countNTracks(recTracksPart); + histos.fill(HIST("hMultiplicityMCrec"), multrec); + auto multgen = countGenTracks(GenParticles); + histos.fill(HIST("hMultiplicityMCgen"), multgen); + histos.fill(HIST("hResponseMatrix"), multrec, multgen); + } + } + + void processEvtLossSigLossMC(soa::Join::iterator const& mcCollision, ColMCRecTable const& RecCols, TrackMCTrueTable const& GenParticles) + { + if (isApplyInelgt0 && !mcCollision.isInelGt0()) { + return; + } + if (std::abs(mcCollision.posZ()) >= vtxRange) { + return; + } + // All generated events + histos.fill(HIST("MCEventHist"), 1); + auto multAll = countGenTracks(GenParticles); + histos.fill(HIST("hMultiplicityMCgenAll"), multAll); + + bool atLeastOne = false; + auto numcontributors = -999; + for (const auto& RecCol : RecCols) { + if (!isEventSelected(RecCol)) { + continue; + } + if (RecCol.numContrib() <= numcontributors) { + continue; + } else { + numcontributors = RecCol.numContrib(); + } + atLeastOne = true; + } + + if (atLeastOne) { + histos.fill(HIST("MCEventHist"), 2); + auto multSel = countGenTracks(GenParticles); + histos.fill(HIST("hMultiplicityMCgenSel"), multSel); + } + } + + PROCESS_SWITCH(StudyPnch, processData, "process data CentFT0C", false); + PROCESS_SWITCH(StudyPnch, processCorrelation, "do correlation study in data", false); + PROCESS_SWITCH(StudyPnch, processMonteCarlo, "process MC CentFT0C", false); + PROCESS_SWITCH(StudyPnch, processEvtLossSigLossMC, "process Signal Loss, Event Loss", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From 6f082d893e831d2901f271c20c9ae7801ae1f5cf Mon Sep 17 00:00:00 2001 From: shreyasiacharya <34233706+shreyasiacharya@users.noreply.github.com> Date: Sat, 13 Sep 2025 03:12:52 +0200 Subject: [PATCH 378/986] [PWGDQ] For ME correlations (#12940) --- PWGDQ/Core/HistogramsLibrary.cxx | 8 ++++---- PWGDQ/Tasks/tableReader_withAssoc.cxx | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/PWGDQ/Core/HistogramsLibrary.cxx b/PWGDQ/Core/HistogramsLibrary.cxx index 15e22ae0ab9..e2012ef0aeb 100644 --- a/PWGDQ/Core/HistogramsLibrary.cxx +++ b/PWGDQ/Core/HistogramsLibrary.cxx @@ -1850,11 +1850,11 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h for (int i = 0; i <= kDelEtaBins; i++) DelEtaBinLims[i] = -2 + i * 0.2; - const int kDelPhiBins = 52; - double DelPhiBinLims[] = {-1.69647, -1.57080, -1.44513, -1.31947, -1.19381, -1.06814, -0.94248, -0.81681, -0.69115, -0.56549, -0.43982, -0.31416, -0.18850, -0.06283, 0.06283, 0.18850, 0.31416, 0.43982, 0.56549, 0.69115, 0.81681, 0.94248, 1.06814, 1.19381, 1.31947, 1.44513, 1.57080, 1.69646, 1.82212, 1.94779, 2.07345, 2.19911, 2.32478, 2.45044, 2.57611, 2.70177, 2.82743, 2.95310, 3.07876, 3.20442, 3.33009, 3.45575, 3.58142, 3.70708, 3.83274, 3.95841, 4.08407, 4.20973, 4.33540, 4.46106, 4.58673, 4.71239, 4.8380600}; + const int kDelPhiBins = 26; + double DelPhiBinLims[] = {-1.69647, -1.44513, -1.19381, -0.94248, -0.69115, -0.43982, -0.18850, 0.06283, 0.31416, 0.56549, 0.81681, 1.06814, 1.31947, 1.57080, 1.82212, 2.07345, 2.32478, 2.57611, 2.82743, 3.07876, 3.33009, 3.58142, 3.83274, 4.08407, 4.33540, 4.58673, 4.83806}; - const int kPtBins = 45; - double PtBinLims[kPtBins + 1] = {0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4, 4.5, 5, 7.5, 10, 20}; + const int kPtBins = 12; + double PtBinLims[kPtBins + 1] = {0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 5, 7.5, 10, 20}; TArrayD nJPsiHadCorr[4]; nJPsiHadCorr[0] = TArrayD(kInvMassBins + 1, InvMassBinLims); diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index 7b3733d774c..d37c8f0302c 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -3349,7 +3349,7 @@ struct AnalysisDileptonTrack { } if (isBarrelME || isMuonME) { - DefineHistograms(fHistMan, Form("DileptonTrackME_%s_%s", pairLegCutName.Data(), fTrackCutNames[iCutTrack].Data()), "mixedevent"); // define ME histograms + DefineHistograms(fHistMan, Form("DileptonTrackME_%s_%s", pairLegCutName.Data(), fTrackCutNames[iCutTrack].Data()), "dilepton-hadron-array-correlation"); // define ME histograms } } // end loop over track cuts to be combined with dileptons / di-tracks } // end loop over pair leg track cuts From 92ce034850ee6b2de2d9965beec4818b7bdecde9 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sat, 13 Sep 2025 06:34:21 +0200 Subject: [PATCH 379/986] [Common] Improve / fix printout conditionals (#12917) --- Common/Tools/TrackPropagationModule.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/Tools/TrackPropagationModule.h b/Common/Tools/TrackPropagationModule.h index e03eb956f5e..a95f70a7ffb 100644 --- a/Common/Tools/TrackPropagationModule.h +++ b/Common/Tools/TrackPropagationModule.h @@ -115,7 +115,7 @@ class TrackPropagationModule fillTracksDCACov = isTableRequiredInWorkflow(initContext, "TracksDCACov"); // enable Tracks in case Tracks have been requested - if (fillTracksDCA) { + if (fillTracksDCA && !fillTracks) { LOGF(info, "******************************************************************"); LOGF(info, " There is no task subscribed to Tracks, but I have detected a"); LOGF(info, " subscription to TracksDCA. Now enabling tracks as algorithmic"); From a5ff3b923e8d05555a11ae01703a78cd200f330e Mon Sep 17 00:00:00 2001 From: suyoupeng <109774812+15071832337@users.noreply.github.com> Date: Sat, 13 Sep 2025 15:06:22 +0800 Subject: [PATCH 380/986] [PWGLF] The local polarization calculation (#12959) --- .../Strangeness/lambdaJetpolarization.cxx | 486 +++++++++++++++--- 1 file changed, 409 insertions(+), 77 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx b/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx index cca1bdf193e..d5648fada70 100644 --- a/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx @@ -11,41 +11,47 @@ /// /// \author Youpeng Su (yousu@cern.ch) -#include -#include -#include -#include -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Common/DataModel/EventSelection.h" +#include "PWGLF/DataModel/lambdaJetpolarization.h" + +#include "PWGJE/Core/JetBkgSubUtils.h" +#include "PWGJE/Core/JetDerivedDataUtilities.h" +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/DataModel/JetReducedData.h" #include "PWGLF/DataModel/LFStrangenessTables.h" + +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/EventSelection.h" #include "Common/DataModel/PIDResponse.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include + #include "Framework/ASoA.h" #include "Framework/AnalysisDataModel.h" -#include -#include -#include -#include "TProfile2D.h" -#include "PWGLF/DataModel/lambdaJetpolarization.h" +#include "Framework/AnalysisTask.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/runDataProcessing.h" + +#include "Math/GenVector/Boost.h" #include "Math/Vector3D.h" #include "Math/Vector4D.h" -#include "Math/GenVector/Boost.h" +#include "TProfile2D.h" +#include +#include +#include +#include +#include #include #include +#include +#include +#include #include #include -#include -#include -#include -#include -#include "PWGJE/Core/JetBkgSubUtils.h" -#include "PWGJE/Core/JetDerivedDataUtilities.h" -#include "PWGJE/DataModel/JetReducedData.h" -#include "PWGJE/DataModel/Jet.h" -#include "Common/Core/trackUtilities.h" + +#include +#include +#include +#include using std::cout; using std::endl; @@ -73,6 +79,9 @@ struct LfMyV0s { Configurable maxChi2ITS{"maxChi2ITS", 36.0f, "max chi2 per cluster ITS"}; Configurable requireTOF{"requireTOF", false, "require TOF hit"}; Configurable requireITS{"requireITS", false, "require ITS hit"}; + Configurable max_tpcSharedCls{"max_tpcSharedCls", 100, "max_tpcSharedCls"}; + Configurable max_chi2_TPC{"max_chi2_TPC", 4, "max_chi2_TPC"}; + Configurable max_chi2_ITS{"max_chi2_ITS", 36, "max_chi2_ITS"}; Configurable ptMinV0Proton{"ptMinV0Proton", 0.3f, "pt min of proton from V0"}; Configurable ptMaxV0Proton{"ptMaxV0Proton", 10.0f, "pt max of proton from V0"}; @@ -87,11 +96,16 @@ struct LfMyV0s { // v0 parameters Configurable v0cospaMin{"v0cospaMin", 0.995f, "Minimum V0 CosPA"}; + Configurable v0cospainit{"v0cospainit", 0.97f, "Minimum V0 CosPA"}; Configurable minimumV0Radius{"minimumV0Radius", 0.2f, "Minimum V0 Radius"}; - Configurable maximumV0Radius{"maximumV0Radius", 40.0f, "Maximum V0 Radius"}; + Configurable maximumV0Radius{"maximumV0Radius", 100000.0f, "Maximum V0 Radius"}; Configurable dcaV0DaughtersMax{"dcaV0DaughtersMax", 1.0f, "Maximum DCA Daughters"}; Configurable dcanegtoPVmin{"dcanegtoPVmin", 0.1f, "Minimum DCA Neg To PV"}; Configurable dcapostoPVmin{"dcapostoPVmin", 0.1f, "Minimum DCA Pos To PV"}; + Configurable v0radius{"v0radius", 0.0, "Radius"}; + Configurable dcav0dau{"dcav0dau", 10, "DCA V0 Daughters"}; + Configurable dcanegtopv{"dcanegtopv", 0.0, "DCA Neg To PV"}; + Configurable dcapostopv{"dcapostopv", 0.0, "DCA Pos To PV"}; // jet selection Configurable cfgjetPtMin{"cfgjetPtMin", 8.0, "minimum jet pT cut"}; @@ -104,6 +118,7 @@ struct LfMyV0s { Configurable isNoTimeFrameBorder{"isNoTimeFrameBorder", 1, "TF border cut"}; Configurable isNoITSROFrameBorder{"isNoITSROFrameBorder", 1, "ITS ROF border cut"}; Configurable isVertexTOFmatched{"isVertexTOFmatched", 1, "Is Vertex TOF matched"}; + Configurable isNoSameBunchPileup{"isNoSameBunchPileup", 0, "isNoSameBunchPileup"}; Configurable isGoodZvtxFT0vsPV{"isGoodZvtxFT0vsPV", 1, "isGoodZvtxFT0vsPV"}; Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; Configurable CtauLambda{"ctauLambda", 30, "C tau Lambda (cm)"}; @@ -120,6 +135,12 @@ struct LfMyV0s { Configurable paramArmenterosCut{"paramArmenterosCut", 0.2, "parameter Armenteros Cut"}; Configurable doArmenterosCut{"doArmenterosCut", 0, "do Armenteros Cut"}; Configurable noSameBunchPileUp{"noSameBunchPileUp", true, "reject SameBunchPileUp"}; + Configurable v0TypeSelection{"v0TypeSelection", 1, "select on a certain V0 type (leave negative if no selection desired)"}; + Configurable NotITSAfterburner{"NotITSAfterburner", 0, "NotITSAfterburner"}; + Configurable doQA{"doQA", 1, "fill QA histograms"}; + Configurable evSel{"evSel", 1, "evSel"}; + Configurable hasTOF2Leg{"hasTOF2Leg", 0, "hasTOF2Leg"}; + Configurable hasTOF1Leg{"hasTOF1Leg", 0, "hasTOF1Leg"}; // Jet background subtraction JetBkgSubUtils backgroundSub; @@ -136,15 +157,15 @@ struct LfMyV0s { const AxisSpec JetaxisPhi{200, -1, +7, "#phi"}; const AxisSpec JetaxisPt{200, 0, +200, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec ptAxis{100, 0.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"}; - const AxisSpec invMassLambdaAxis{200, 1.09, 1.14, "m_{p#pi} (GeV/#it{c}^{2})"}; + const AxisSpec invMassLambdaAxis{200, 1.016, 1.216, "m_{p#pi} (GeV/#it{c}^{2})"}; ConfigurableAxis TProfile2DaxisPt{"#it{p}_{T} (GeV/#it{c})", {VARIABLE_WIDTH, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.2, 3.7, 4.2, 5, 6, 8, 10, 12}, "pt axis for histograms"}; ConfigurableAxis TProfile2DaxisMass{"Mass p#pi (GeV/#it{c^{2}})", {VARIABLE_WIDTH, 1.10068, 1.10668, 1.11068, 1.11268, 1.11368, 1.11468, 1.11568, 1.11668, 1.11768, 1.11868, 1.12068, 1.12468, 1.13068}, "Mass axis for histograms"}; - registry.add("hMassLambda", "hMassLambda", {HistType::kTH1F, {{200, 0.9f, 1.2f}}}); + registry.add("hMassLambda", "hMassLambda", {HistType::kTH1F, {invMassLambdaAxis}}); registry.add("V0pTInLab", "V0pTInLab", kTH1F, {axisPT}); - registry.add("hMassVsPtLambda", "hMassVsPtLambda", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {200, 1.016f, 1.216f}}}); - registry.add("hMassVsPtAntiLambda", "hMassVsPtAntiLambda", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {200, 1.016f, 1.216f}}}); + registry.add("hMassVsPtLambda", "hMassVsPtLambda", {HistType::kTH2F, {ptAxis, invMassLambdaAxis}}); + registry.add("hMassVsPtAntiLambda", "hMassVsPtAntiLambda", {HistType::kTH2F, {ptAxis, invMassLambdaAxis}}); registry.add("V0pxInLab", "V0pxInLab", kTH1F, {axisPx}); registry.add("V0pyInLab", "V0pyInLab", kTH1F, {axisPy}); @@ -278,13 +299,13 @@ struct LfMyV0s { registryData.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(8, "isGoodZvtxFT0vsPV"); registryData.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(9, "Applied selected"); - registryV0Data.add("hLambdaPt", "hLambdaPt", {HistType::kTH1F, {{100, 0.0f, 10.0f}}}); - registryV0Data.add("hAntiLambdaPt", "hAntiLambdaPt", {HistType::kTH1F, {{100, 0.0f, 10.0f}}}); + registryV0Data.add("hLambdaPt", "hLambdaPt", {HistType::kTH1F, {ptAxis}}); + registryV0Data.add("hAntiLambdaPt", "hAntiLambdaPt", {HistType::kTH1F, {ptAxis}}); - registryV0Data.add("hMassVsPtLambda", "hMassVsPtLambda", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {200, 1.016f, 1.216f}}}); - registryV0Data.add("hMassVsPtAntiLambda", "hMassVsPtAntiLambda", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {200, 1.016f, 1.216f}}}); - registryV0Data.add("hMassLambda", "hMassLambda", {HistType::kTH1F, {{200, 0.9f, 1.2f}}}); - registryV0Data.add("hMassAntiLambda", "hMassAntiLambda", {HistType::kTH1F, {{200, 0.9f, 1.2f}}}); + registryV0Data.add("hMassVsPtLambda", "hMassVsPtLambda", {HistType::kTH2F, {ptAxis, invMassLambdaAxis}}); + registryV0Data.add("hMassVsPtAntiLambda", "hMassVsPtAntiLambda", {HistType::kTH2F, {ptAxis, invMassLambdaAxis}}); + registryV0Data.add("hMassLambda", "hMassLambda", {HistType::kTH1F, {invMassLambdaAxis}}); + registryV0Data.add("hMassAntiLambda", "hMassAntiLambda", {HistType::kTH1F, {invMassLambdaAxis}}); registryV0Data.add("nV0sPerEvent", "nV0sPerEvent", kTH1F, {{10, 0.0, 10.0}}); registryV0Data.add("nV0sPerEventsel", "nV0sPerEventsel", kTH1F, {{10, 0.0, 10.0}}); @@ -319,16 +340,25 @@ struct LfMyV0s { registryV0Data.add("AverageCosSquarethetainJetV0", "AverageCosSquarethetainJetV0", {HistType::kTProfile, {{200, 0.9, 1.2}}}); // LongitudinalPolarization event selection - registryLongitudinalPolarization.add("hNEvents", "hNEvents", {HistType::kTH1I, {{5, 0.f, 5.f}}}); + registryLongitudinalPolarization.add("hNEvents", "hNEvents", {HistType::kTH1D, {{10, 0.f, 10.f}}}); registryLongitudinalPolarization.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(1, "all"); registryLongitudinalPolarization.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(2, "sel8"); - registryLongitudinalPolarization.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(3, "zvertex"); - registryLongitudinalPolarization.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(4, "isGoodZvtxFT0vsPV"); - registryLongitudinalPolarization.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(5, "isNoSameBunchPileup"); - registryLongitudinalPolarization.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(6, "Applied selected"); - - registryLongitudinalPolarization.add("hMassVsPtLambda", "hMassVsPtLambda", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {200, 1.016f, 1.216f}}}); - registryLongitudinalPolarization.add("hMassVsPtAntiLambda", "hMassVsPtAntiLambda", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {200, 1.016f, 1.216f}}}); + registryLongitudinalPolarization.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(3, "TVX"); + registryLongitudinalPolarization.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(4, "zvertex"); + registryLongitudinalPolarization.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(5, "TFBorder"); + registryLongitudinalPolarization.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(6, "ITSROFBorder"); + registryLongitudinalPolarization.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(7, "isTOFVertexMatched"); + registryLongitudinalPolarization.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(8, "isNoSameBunchPileup"); + registryLongitudinalPolarization.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(9, "Applied selection"); + + registryLongitudinalPolarization.add("hMassVsPtLambda", "hMassVsPtLambda", {HistType::kTH2F, {ptAxis, invMassLambdaAxis}}); + registryLongitudinalPolarization.add("hMassLambda", "hMassLambda", {HistType::kTH1F, {invMassLambdaAxis}}); + registryLongitudinalPolarization.add("hMassVsPtAntiLambda", "hMassVsPtAntiLambda", {HistType::kTH2F, {ptAxis, invMassLambdaAxis}}); + + registryLongitudinalPolarization.add("hMassLambdasel", "hMassLambdasel", {HistType::kTH1F, {invMassLambdaAxis}}); + registryLongitudinalPolarization.add("hMassAntiLambdasel", "hMassAntiLambdasel", {HistType::kTH1F, {invMassLambdaAxis}}); + registryLongitudinalPolarization.add("hMassVsPtLambdasel", "hMassVsPtLambdasel", {HistType::kTH2F, {ptAxis, invMassLambdaAxis}}); + registryLongitudinalPolarization.add("hMassVsPtAntiLambdasel", "hMassVsPtAntiLambdasel", {HistType::kTH2F, {ptAxis, invMassLambdaAxis}}); registryLongitudinalPolarization.add("V0pxInRest_frame", "V0pxInRest_frame", kTH1F, {axisPx}); registryLongitudinalPolarization.add("V0pyInRest_frame", "V0pyInRest_frame", kTH1F, {axisPy}); @@ -348,9 +378,32 @@ struct LfMyV0s { registryLongitudinalPolarization.add("hAntiLambdamassandCosthetaInV0", "hAntiLambdamassandCosthetaInV0", kTH2F, {{200, 0.9, 1.2}, {200, -1, 1}}); registryLongitudinalPolarization.add("TProfile2DAntiLambdaPtMassCostheta", "TProfile2DAntiLambdaPtMassCostheta", kTProfile2D, {TProfile2DaxisMass, TProfile2DaxisPt}); registryLongitudinalPolarization.add("TProfile2DAntiLambdaPtMassCosSquareTheta", "TProfile2DAntiLambdaPtMassCosSquareTheta", kTProfile2D, {TProfile2DaxisMass, TProfile2DaxisPt}); - registryLongitudinalPolarization.add("TProfile1DLambdaPtMassCostheta", "Invariant Mass vs cos(#theta)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); registryLongitudinalPolarization.add("TProfile1DAntiLambdaPtMassCostheta", "Invariant Mass vs cos(#theta)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); + + if (doQA) { + registryLongitudinalPolarization.add("QA/hv0sSelection", ";Sel", {HistType::kTH1D, {{22, 0., 22.}}}); + registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(1, "all"); + registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(2, "Event selection"); + registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(3, "Radius"); + registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(4, "Eta Daughters"); + registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(5, "Dau DCA to PV"); + registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(6, "DCA Daughters"); + registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(7, "min ITS hits"); + registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(8, "has TOF 1 Leg"); + registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(9, "has TOF 2 Legs"); + registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(10, "TPC NCl"); + registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(11, "TPC Cls Shared"); + registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(12, "ITS Chi2"); + registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(13, "TPC Chi2"); + registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(14, "cosPA"); + registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(15, "rapidity"); + registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(16, "ctau"); + registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(17, "v0 rej"); + registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(18, "TPC nsigma Neg Dau"); + registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(19, "TPC nsigma Pos Dau"); + registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(20, "Armenteros-Podolansky"); + } } double massPr = o2::constants::physics::MassProton; double massLambda = o2::constants::physics::MassLambda; @@ -415,8 +468,10 @@ struct LfMyV0s { return matrixLabToJet; } // aod::MyCollision const& collision + void processJetV0Analysis(aod::MyTable const& myv0s, aod::MyTableJet const& myJets) { + for (auto& candidate : myv0s) { registry.fill(HIST("hMassLambda"), candidate.v0Lambdamass()); registry.fill(HIST("V0pTInLab"), candidate.v0pt()); @@ -631,26 +686,25 @@ struct LfMyV0s { template bool passedInitLambdaSelection(const Lambda& v0, const TrackPos& ptrack, const TrackNeg& ntrack) { - if (v0.v0radius() < minimumV0Radius || v0.v0cosPA() < v0cospaMin || + if (v0.v0radius() < v0radius || v0.v0cosPA() < v0cospainit || TMath::Abs(ptrack.eta()) > V0tracketaMax || TMath::Abs(ntrack.eta()) > V0tracketaMax) { return false; } - if (v0.dcaV0daughters() > dcaV0DaughtersMax) { + if (v0.dcaV0daughters() > dcav0dau) { return false; } - if (TMath::Abs(v0.dcanegtopv()) < dcanegtoPVmin) { + if (TMath::Abs(v0.dcanegtopv()) < dcanegtopv) { return false; } - if (TMath::Abs(v0.dcapostopv()) < dcapostoPVmin) { + if (TMath::Abs(v0.dcapostopv()) < dcapostopv) { return false; } return true; } - // Lambda Selections - template - bool passedLambdaSelection(const Lambda& v0, const TrackPos& ptrack, const TrackNeg& ntrack) + template + bool AcceptV0Lambda(const Lambda& v0, const TrackPos& ptrack, const TrackNeg& ntrack, const TCollision& collision) { // Single-Track Selections if (requirepassedSingleTrackSelection && !passedSingleTrackSelection(ptrack)) @@ -658,34 +712,284 @@ struct LfMyV0s { if (requirepassedSingleTrackSelection && !passedSingleTrackSelection(ntrack)) return false; - // Momentum of Lambda Daughters - TVector3 proton(v0.pxpos(), v0.pypos(), v0.pzpos()); - TVector3 pion(v0.pxneg(), v0.pyneg(), v0.pzneg()); + int evFlag = 0; + if (collision.isInelGt0()) { + evFlag = 1; + } - if (proton.Pt() < ptMinV0Proton) + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 0.5); + + if (evSel && evFlag < 1) return false; - if (proton.Pt() > ptMaxV0Proton) + + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 1.5); + + if (v0.v0radius() < minimumV0Radius || v0.v0radius() > maximumV0Radius) return false; - if (pion.Pt() < ptMinV0Pion) + + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 2.5); + + if (TMath::Abs(ptrack.eta()) > V0tracketaMax || TMath::Abs(ntrack.eta()) > V0tracketaMax) { return false; - if (pion.Pt() > ptMaxV0Pion) + } + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 3.5); + + if (std::fabs(v0.dcapostopv()) < dcapostoPVmin) return false; + if (std::fabs(v0.dcanegtopv()) < dcanegtoPVmin) + return false; + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 4.5); + + if (std::fabs(v0.dcaV0daughters()) > dcaV0DaughtersMax) + return false; + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 5.5); + + if (requireITS && ptrack.itsNCls() < minITSnCls) + return false; + if (requireITS && ntrack.itsNCls() < minITSnCls) + return false; + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 6.5); + + if (hasTOF1Leg && !ptrack.hasTOF() && !ntrack.hasTOF()) + return false; + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 7.5); + + if (hasTOF2Leg && (!ptrack.hasTOF() || !ntrack.hasTOF())) + return false; + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 8.5); + + if (ptrack.tpcNClsCrossedRows() < minNCrossedRowsTPC) + return false; + if (ntrack.tpcNClsCrossedRows() < minNCrossedRowsTPC) + return false; + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 9.5); + + if (ptrack.tpcNClsShared() > max_tpcSharedCls) + return false; + if (ntrack.tpcNClsShared() > max_tpcSharedCls) + return false; + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 10.5); + + if (ptrack.itsChi2NCl() > max_chi2_ITS) + return false; + if (ntrack.itsChi2NCl() > max_chi2_ITS) + return false; + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 11.5); + + if (ptrack.tpcChi2NCl() > max_chi2_TPC) + return false; + if (ntrack.tpcChi2NCl() > max_chi2_TPC) + return false; + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 12.5); - // V0 Selections if (v0.v0cosPA() < v0cospaMin) return false; - if (v0.v0radius() < minimumV0Radius) + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 13.5); + + if (v0.yLambda() < yMin || v0.yLambda() > yMax) { return false; - if (std::fabs(v0.dcaV0daughters()) > dcaV0DaughtersMax) + } + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 14.5); + + float ctauLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0; + if (ctauLambda >= CtauLambda) + return false; + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 15.5); + + if (TMath::Abs(v0.mK0Short() - o2::constants::physics::MassK0Short) < v0rejLambda) { + return false; + } + if (std::abs(v0.mLambda() - o2::constants::physics::MassLambda0) > v0accLambda) { + return false; + } + + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 16.5); + + if (ntrack.tpcNSigmaPi() < nsigmaTPCmin || ntrack.tpcNSigmaPi() > nsigmaTPCmax) + return false; + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 17.5); + + if (ptrack.tpcNSigmaPr() < nsigmaTPCmin || ptrack.tpcNSigmaPr() > nsigmaTPCmax) + return false; + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 18.5); + + if (doArmenterosCut && v0.qtarm() > (paramArmenterosCut * std::abs(v0.alpha()))) + return false; + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 19.5); + + return true; + } + + template + bool AcceptV0AntiLambda(const Lambda& v0, const TrackPos& ptrack, const TrackNeg& ntrack, const TCollision& collision) + { + // Single-Track Selections + if (requirepassedSingleTrackSelection && !passedSingleTrackSelection(ptrack)) + return false; + if (requirepassedSingleTrackSelection && !passedSingleTrackSelection(ntrack)) + return false; + + int evFlag = 0; + if (collision.isInelGt0()) { + evFlag = 1; + } + + if (evSel && evFlag < 1) + return false; + + if (v0.v0radius() < minimumV0Radius || v0.v0radius() > maximumV0Radius) return false; + + if (TMath::Abs(ptrack.eta()) > V0tracketaMax || TMath::Abs(ntrack.eta()) > V0tracketaMax) { + return false; + } + if (std::fabs(v0.dcapostopv()) < dcapostoPVmin) return false; if (std::fabs(v0.dcanegtopv()) < dcanegtoPVmin) return false; + if (std::fabs(v0.dcaV0daughters()) > dcaV0DaughtersMax) + return false; + + if (requireITS && ptrack.itsNCls() < minITSnCls) + return false; + if (requireITS && ntrack.itsNCls() < minITSnCls) + return false; + + if (hasTOF1Leg && !ptrack.hasTOF() && !ntrack.hasTOF()) + return false; + + if (hasTOF2Leg && (!ptrack.hasTOF() || !ntrack.hasTOF())) + return false; + + if (ptrack.tpcNClsCrossedRows() < minNCrossedRowsTPC) + return false; + if (ntrack.tpcNClsCrossedRows() < minNCrossedRowsTPC) + return false; + + if (ptrack.tpcNClsShared() > max_tpcSharedCls) + return false; + if (ntrack.tpcNClsShared() > max_tpcSharedCls) + return false; + + if (ptrack.itsChi2NCl() > max_chi2_ITS) + return false; + if (ntrack.itsChi2NCl() > max_chi2_ITS) + return false; + + if (ptrack.tpcChi2NCl() > max_chi2_TPC) + return false; + if (ntrack.tpcChi2NCl() > max_chi2_TPC) + return false; + + if (v0.v0cosPA() < v0cospaMin) + return false; + + if (v0.yLambda() < yMin || v0.yLambda() > yMax) { + return false; + } + + float ctauAntiLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0Bar; + if (ctauAntiLambda >= CtauLambda) + return false; + + if (TMath::Abs(v0.mK0Short() - o2::constants::physics::MassK0Short) < v0rejLambda) { + return false; + } + if (std::abs(v0.mAntiLambda() - o2::constants::physics::MassLambda0) > v0accLambda) { + return false; + } + if (ntrack.tpcNSigmaPr() < nsigmaTPCmin || ntrack.tpcNSigmaPr() > nsigmaTPCmax) + return false; + + if (ptrack.tpcNSigmaPi() < nsigmaTPCmin || ptrack.tpcNSigmaPi() > nsigmaTPCmax) + return false; + + if (doArmenterosCut && v0.qtarm() > (paramArmenterosCut * std::abs(v0.alpha()))) + return false; + + return true; + } + + // Lambda Selections + template + bool passedLambdaSelection(const Lambda& v0, const TrackPos& ptrack, const TrackNeg& ntrack) + { + // Single-Track Selections + if (requirepassedSingleTrackSelection && !passedSingleTrackSelection(ptrack)) + return false; + if (requirepassedSingleTrackSelection && !passedSingleTrackSelection(ntrack)) + return false; + + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 1.5); + + if (v0.v0radius() < minimumV0Radius || v0.v0radius() > maximumV0Radius) + return false; + + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 2.5); + if (TMath::Abs(ptrack.eta()) > V0tracketaMax || TMath::Abs(ntrack.eta()) > V0tracketaMax) { return false; } + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 3.5); + + if (std::fabs(v0.dcapostopv()) < dcapostoPVmin) + return false; + if (std::fabs(v0.dcanegtopv()) < dcanegtoPVmin) + return false; + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 4.5); + + if (std::fabs(v0.dcaV0daughters()) > dcaV0DaughtersMax) + return false; + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 5.5); + + if (requireITS && ptrack.itsNCls() < minITSnCls) + return false; + if (requireITS && ntrack.itsNCls() < minITSnCls) + return false; + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 6.5); + + if (hasTOF1Leg && !ptrack.hasTOF() && !ntrack.hasTOF()) + return false; + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 7.5); + + if (hasTOF2Leg && (!ptrack.hasTOF() || !ntrack.hasTOF())) + return false; + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 8.5); + + if (ptrack.tpcNClsCrossedRows() < minNCrossedRowsTPC) + return false; + if (ntrack.tpcNClsCrossedRows() < minNCrossedRowsTPC) + return false; + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 9.5); + + if (ptrack.tpcNClsShared() > max_tpcSharedCls) + return false; + if (ntrack.tpcNClsShared() > max_tpcSharedCls) + return false; + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 10.5); + + if (ptrack.itsChi2NCl() > max_chi2_ITS) + return false; + if (ntrack.itsChi2NCl() > max_chi2_ITS) + return false; + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 11.5); + + if (ptrack.tpcChi2NCl() > max_chi2_TPC) + return false; + if (ntrack.tpcChi2NCl() > max_chi2_TPC) + return false; + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 12.5); + + if (v0.v0cosPA() < v0cospaMin) + return false; + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 13.5); + + if (v0.yLambda() < yMin || v0.yLambda() > yMax) { + return false; + } + registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 14.5); // PID Selections (TPC) if (requireTPC) { @@ -858,25 +1162,35 @@ struct LfMyV0s { template bool AcceptEventForLongitudinalPolarization(TCollision const& collision) { + registryLongitudinalPolarization.fill(HIST("hNEvents"), 0.5); if (sel8 && !collision.sel8()) { return false; } registryLongitudinalPolarization.fill(HIST("hNEvents"), 1.5); - - if (iscutzvertex && TMath::Abs(collision.posZ()) > cutzvertex) { + if (isTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { return false; } registryLongitudinalPolarization.fill(HIST("hNEvents"), 2.5); - - if (noSameBunchPileUp && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { + if (std::abs(collision.posZ()) > cutzvertex) { return false; } registryLongitudinalPolarization.fill(HIST("hNEvents"), 3.5); - // check vertex matching to FT0 - if (isGoodZvtxFT0vsPV && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + if (isNoTimeFrameBorder && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { return false; } registryLongitudinalPolarization.fill(HIST("hNEvents"), 4.5); + if (isNoITSROFrameBorder && !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + return false; + } + registryLongitudinalPolarization.fill(HIST("hNEvents"), 5.5); + if (isVertexTOFmatched && !collision.selection_bit(aod::evsel::kIsVertexTOFmatched)) { + return false; + } + registryLongitudinalPolarization.fill(HIST("hNEvents"), 6.5); + if (isNoSameBunchPileup && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { + return false; + } + registryLongitudinalPolarization.fill(HIST("hNEvents"), 7.5); return true; } @@ -1219,25 +1533,42 @@ struct LfMyV0s { } PROCESS_SWITCH(LfMyV0s, processDataV0, "processDataV0", true); - void processLongitudinalPolarization(SelCollisions::iterator const& collision, aod::V0Datas const& fullV0s, StrHadronDaughterTracks const&) + // V0Collisions + // SelCollisions + using V0Collisions = soa::Join; + void processLongitudinalPolarization(V0Collisions::iterator const& collision, aod::V0Datas const& fullV0s, StrHadronDaughterTracks const&) { - registryLongitudinalPolarization.fill(HIST("hNEvents"), 0.5); + if (!AcceptEventForLongitudinalPolarization(collision)) { return; } - registryLongitudinalPolarization.fill(HIST("hNEvents"), 5.5); + registryLongitudinalPolarization.fill(HIST("hNEvents"), 8.5); + int V0NumbersPerEvent = 0; int V0NumbersPerEventsel = 0; - for (const auto& v0 : fullV0s) { + for (const auto& v0 : fullV0s) { // loop over V0s + + if (v0.v0Type() != v0TypeSelection) { + continue; + } + V0NumbersPerEvent++; - float ctauLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0; - float ctauAntiLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0Bar; const auto& pos = v0.posTrack_as(); const auto& neg = v0.negTrack_as(); - if (passedLambdaSelection(v0, pos, neg) && ctauLambda < CtauLambda && ifpasslambda) { - V0NumbersPerEventsel++; + if (NotITSAfterburner && (v0.negTrack_as().isITSAfterburner() || v0.posTrack_as().isITSAfterburner())) { + continue; + } + if (passedInitLambdaSelection(v0, pos, neg) && ifinitpasslambda) { registryLongitudinalPolarization.fill(HIST("hMassVsPtLambda"), v0.pt(), v0.mLambda()); + registryLongitudinalPolarization.fill(HIST("hMassVsPtAntiLambda"), v0.pt(), v0.mAntiLambda()); + registryLongitudinalPolarization.fill(HIST("hMassLambda"), v0.mLambda()); + } + + if (AcceptV0Lambda(v0, pos, neg, collision) && ifpasslambda) { + V0NumbersPerEventsel++; + registryLongitudinalPolarization.fill(HIST("hMassLambdasel"), v0.mLambda()); + registryLongitudinalPolarization.fill(HIST("hMassVsPtLambdasel"), v0.pt(), v0.mLambda()); ProtonVec = ROOT::Math::PxPyPzMVector(v0.pxpos(), v0.pypos(), v0.pzpos(), massPr); PionVec = ROOT::Math::PxPyPzMVector(v0.pxneg(), v0.pyneg(), v0.pzneg(), massPi); @@ -1262,8 +1593,9 @@ struct LfMyV0s { registryLongitudinalPolarization.fill(HIST("TProfile1DLambdaPtMassCostheta"), v0.mLambda(), protonCosThetainV0); } - if (passedAntiLambdaSelection(v0, pos, neg) && ctauAntiLambda < CtauLambda && ifpasslambda) { - registryLongitudinalPolarization.fill(HIST("hMassVsPtAntiLambda"), v0.pt(), v0.mAntiLambda()); + if (AcceptV0AntiLambda(v0, pos, neg, collision) && ifpasslambda) { + registryLongitudinalPolarization.fill(HIST("hMassAntiLambdasel"), v0.mAntiLambda()); + registryLongitudinalPolarization.fill(HIST("hMassVsPtAntiLambdasel"), v0.pt(), v0.mAntiLambda()); ProtonVec = ROOT::Math::PxPyPzMVector(v0.pxneg(), v0.pyneg(), v0.pzneg(), massPr); PionVec = ROOT::Math::PxPyPzMVector(v0.pxpos(), v0.pypos(), v0.pzpos(), massPi); From b808fdb8b1731b973e58faeb7db594957c73d68e Mon Sep 17 00:00:00 2001 From: Roman Lietava Date: Sat, 13 Sep 2025 11:20:41 +0200 Subject: [PATCH 381/986] [PWGLF] Omegahm (#12962) --- PWGLF/DataModel/LFNonPromptCascadeTables.h | 18 ++++++-- PWGLF/Tasks/Strangeness/nonPromptCascade.cxx | 46 +++++++++++++++----- 2 files changed, 48 insertions(+), 16 deletions(-) diff --git a/PWGLF/DataModel/LFNonPromptCascadeTables.h b/PWGLF/DataModel/LFNonPromptCascadeTables.h index b698164abd4..ca175591c06 100644 --- a/PWGLF/DataModel/LFNonPromptCascadeTables.h +++ b/PWGLF/DataModel/LFNonPromptCascadeTables.h @@ -121,9 +121,12 @@ DECLARE_SOA_COLUMN(CentFT0A, centFT0A, float); DECLARE_SOA_COLUMN(CentFT0M, centFT0M, float); DECLARE_SOA_COLUMN(MultNTracksGlobal, multNTracksGlobal, int); DECLARE_SOA_COLUMN(ToiMask, toiMask, uint32_t); +DECLARE_SOA_COLUMN(RunNumber, runNumber, int); +DECLARE_SOA_COLUMN(NoSameBunchPileup, noSameBunchPileup, bool); } // namespace NPCascadeTable DECLARE_SOA_TABLE(NPCascTable, "AOD", "NPCASCTABLE", + NPCascadeTable::RunNumber, NPCascadeTable::MatchingChi2, NPCascadeTable::DeltaPtITSCascade, NPCascadeTable::DeltaPtCascade, @@ -187,9 +190,11 @@ DECLARE_SOA_TABLE(NPCascTable, "AOD", "NPCASCTABLE", NPCascadeTable::CentFT0A, NPCascadeTable::CentFT0M, NPCascadeTable::MultNTracksGlobal, - NPCascadeTable::ToiMask) + NPCascadeTable::ToiMask, + NPCascadeTable::NoSameBunchPileup) DECLARE_SOA_TABLE(NPCascTableNT, "AOD", "NPCASCTABLENT", + NPCascadeTable::RunNumber, NPCascadeTable::MatchingChi2, NPCascadeTable::DeltaPtITSCascade, NPCascadeTable::DeltaPtCascade, @@ -253,9 +258,11 @@ DECLARE_SOA_TABLE(NPCascTableNT, "AOD", "NPCASCTABLENT", NPCascadeTable::CentFT0A, NPCascadeTable::CentFT0M, NPCascadeTable::MultNTracksGlobal, - NPCascadeTable::ToiMask) + NPCascadeTable::ToiMask, + NPCascadeTable::NoSameBunchPileup) DECLARE_SOA_TABLE(NPCascTableMC, "AOD", "NPCASCTABLEMC", + NPCascadeTable::RunNumber, NPCascadeTable::MatchingChi2, NPCascadeTable::DeltaPtITSCascade, NPCascadeTable::DeltaPtCascade, @@ -338,9 +345,11 @@ DECLARE_SOA_TABLE(NPCascTableMC, "AOD", "NPCASCTABLEMC", NPCascadeTable::HasFakeReassociation, NPCascadeTable::MotherDecayDaughters, NPCascadeTable::MultNTracksGlobal, - NPCascadeTable::ToiMask) + NPCascadeTable::ToiMask, + NPCascadeTable::NoSameBunchPileup) DECLARE_SOA_TABLE(NPCascTableMCNT, "AOD", "NPCASCTABLEMCNT", + NPCascadeTable::RunNumber, NPCascadeTable::MatchingChi2, NPCascadeTable::DeltaPtITSCascade, NPCascadeTable::DeltaPtCascade, @@ -423,7 +432,8 @@ DECLARE_SOA_TABLE(NPCascTableMCNT, "AOD", "NPCASCTABLEMCNT", NPCascadeTable::HasFakeReassociation, NPCascadeTable::MotherDecayDaughters, NPCascadeTable::MultNTracksGlobal, - NPCascadeTable::ToiMask) + NPCascadeTable::ToiMask, + NPCascadeTable::NoSameBunchPileup) DECLARE_SOA_TABLE(NPCascTableGen, "AOD", "NPCASCTABLEGen", NPCascadeTable::gPt, diff --git a/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx b/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx index ef261d822ff..d5e93102df0 100644 --- a/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx +++ b/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx @@ -52,6 +52,7 @@ using namespace o2::framework::expressions; namespace { struct NPCascCandidate { + int runNumber; int64_t mcParticleId; int64_t trackGlobID; int64_t trackITSID; @@ -127,6 +128,7 @@ struct NPCascCandidate { float centFT0M; int multNTracksGlobal; uint32_t toiMask; + bool noSameBunchPileup; }; std::array isFromHF(auto& particle) { @@ -211,6 +213,16 @@ struct NonPromptCascadeTask { o2::vertexing::DCAFitterN<2> mDCAFitter; std::array mProcessCounter = {0, 0}; // {Tracked, All} std::map mToiMap; + std::unordered_set mRuns; + std::shared_ptr mHistPointer1; + std::shared_ptr mHistPointer2; + std::shared_ptr mHistPointer3; + std::shared_ptr mHistPointer4; + AxisSpec multAxis = {10000, 0, 10000, "Multiplicity FT0M"}; + AxisSpec centAxis = {2021, -0.025, 101.025, "Centrality"}; + AxisSpec centAxisZoom = {2000, -0.0025, 10.0025, "Centrality"}; + AxisSpec multAxisZoom = {7000, 3000, 10000, "Multiplicity FT0M"}; + AxisSpec nTracksAxis = {100, 0., 100., "NTracksGlobal"}; void initCCDB(aod::BCsWithTimestamps::iterator const& bc) { @@ -248,11 +260,6 @@ struct NonPromptCascadeTask { std::vector ptBinning = {0.4, 0.8, 1.2, 1.6, 2.0, 2.4, 2.8, 3.2, 3.6, 4.0, 4.4, 4.8, 5.2, 5.6, 6.0}; // AxisSpec ptAxis = {ptBinning, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec centAxis = {101, 0., 101., "Centrality"}; - AxisSpec centAxisZoom = {100, 0., 10., "Centrality"}; - AxisSpec multAxis = {10000, 0, 10000, "Multiplicity FT0M"}; - AxisSpec multAxisZoom = {7000, 3000, 10000, "Multiplicity FT0M"}; - AxisSpec nTracksAxis = {100, 0., 100., "NTracksGlobal"}; std::array cutsNames{"# candidates", "hasTOF", "nClusTPC", "nSigmaTPCbach", "nSigmaTPCprotontrack", "nSigmaTPCpiontrack", "cosPA"}; auto cutsOmega{std::get>(mRegistry.add("h_PIDcutsOmega", ";;Invariant mass (GeV/#it{c}^{2})", HistType::kTH2D, {{cutsNames.size(), -0.5, -0.5 + cutsNames.size()}, {125, 1.650, 1.700}}))}; @@ -331,7 +338,22 @@ struct NonPromptCascadeTask { { // std::cout << "Filling mult histos" << std::endl; for (const auto& coll : collisions) { - // std::cout << coll.centFT0M() << " mult, cent " << coll.multNTracksGlobal() << std::endl; + if (!mRuns.count(mRunNumber)) { + std::string histName = "mult/hMultVsCent_run" + std::to_string(mRunNumber); + mHistPointer1 = std::get>(mRegistry.add(histName.c_str(), histName.c_str(), HistType::kTH2F, {centAxis, multAxis})); + histName = "mult/hMultVsCentZoom_run" + std::to_string(mRunNumber); + mHistPointer2 = std::get>(mRegistry.add(histName.c_str(), histName.c_str(), HistType::kTH2F, {centAxisZoom, multAxisZoom})); + histName = "mult/hNTracksVsCent_run" + std::to_string(mRunNumber); + mHistPointer3 = std::get>(mRegistry.add(histName.c_str(), histName.c_str(), HistType::kTH2F, {centAxis, nTracksAxis})); + histName = "mult/hNTracksVsCentZoom_run" + std::to_string(mRunNumber); + mHistPointer4 = std::get>(mRegistry.add(histName.c_str(), histName.c_str(), HistType::kTH2F, {centAxisZoom, nTracksAxis})); + mRuns.insert(mRunNumber); + } + mHistPointer1->Fill(coll.centFT0M(), coll.multFT0M()); + mHistPointer2->Fill(coll.centFT0M(), coll.multFT0M()); + mHistPointer3->Fill(coll.centFT0M(), coll.multNTracksGlobal()); + mHistPointer4->Fill(coll.centFT0M(), coll.multNTracksGlobal()); + mRegistry.fill(HIST("hMultVsCent"), coll.centFT0M(), coll.multFT0M()); mRegistry.fill(HIST("hMultVsCentZoom"), coll.centFT0M(), coll.multFT0M()); mRegistry.fill(HIST("hNTracksVsCent"), coll.centFT0M(), (float)coll.multNTracksGlobal()); @@ -548,7 +570,7 @@ struct NonPromptCascadeTask { if (mToiMap.count(bc.globalBC())) { toiMask = mToiMap[bc.globalBC()]; } - candidates.emplace_back(NPCascCandidate{mcParticleID, trackedCascGlobalIndex, itsTrackGlobalIndex, candidate.collisionId(), matchingChi2, deltaPtITSCascade, deltaPtCascade, cascITSclsSize, hasReassociatedClusters, hasFakeReassociation, isGoodMatch, isGoodCascade, pdgCodeMom, itsTrackPDG, fromHF[0], fromHF[1], + candidates.emplace_back(NPCascCandidate{mRunNumber, mcParticleID, trackedCascGlobalIndex, itsTrackGlobalIndex, candidate.collisionId(), matchingChi2, deltaPtITSCascade, deltaPtCascade, cascITSclsSize, hasReassociatedClusters, hasFakeReassociation, isGoodMatch, isGoodCascade, pdgCodeMom, itsTrackPDG, fromHF[0], fromHF[1], collision.numContrib(), cascPVContribs, collision.collisionTimeRes(), primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ(), cascadeLvector.pt(), cascadeLvector.eta(), cascadeLvector.phi(), protonTrack.pt(), protonTrack.eta(), pionTrack.pt(), pionTrack.eta(), bachelor.pt(), bachelor.eta(), @@ -558,7 +580,7 @@ struct NonPromptCascadeTask { cascITSclusters, protonTrack.itsNCls(), pionTrack.itsNCls(), bachelor.itsNCls(), protonTrack.tpcNClsFound(), pionTrack.tpcNClsFound(), bachelor.tpcNClsFound(), protonTrack.tpcNSigmaPr(), pionTrack.tpcNSigmaPi(), bachelor.tpcNSigmaKa(), bachelor.tpcNSigmaPi(), protonTrack.hasTOF(), pionTrack.hasTOF(), bachelor.hasTOF(), - protonTrack.tofNSigmaPr(), pionTrack.tofNSigmaPi(), bachelor.tofNSigmaKa(), bachelor.tofNSigmaPi(), collision.sel8(), collision.multFT0C(), collision.multFT0A(), collision.multFT0M(), collision.centFT0C(), collision.centFT0A(), collision.centFT0M(), collision.multNTracksGlobal(), toiMask}); + protonTrack.tofNSigmaPr(), pionTrack.tofNSigmaPi(), bachelor.tofNSigmaKa(), bachelor.tofNSigmaPi(), collision.sel8(), collision.multFT0C(), collision.multFT0A(), collision.multFT0M(), collision.centFT0C(), collision.centFT0A(), collision.centFT0M(), collision.multNTracksGlobal(), toiMask, collision.selection_bit(aod::evsel::kNoSameBunchPileup)}); } } @@ -566,7 +588,7 @@ struct NonPromptCascadeTask { void fillDataTable(auto const& candidates) { for (const auto& c : candidates) { - getDataTable()(c.matchingChi2, c.deltaPtITS, c.deltaPt, c.itsClusSize, c.hasReassociatedCluster, + getDataTable()(mRunNumber, c.matchingChi2, c.deltaPtITS, c.deltaPt, c.itsClusSize, c.hasReassociatedCluster, c.pvContributors, c.cascPVContribs, c.pvTimeResolution, c.pvX, c.pvY, c.pvZ, c.cascPt, c.cascEta, c.cascPhi, c.protonPt, c.protonEta, c.pionPt, c.pionEta, c.bachPt, c.bachEta, @@ -578,7 +600,7 @@ struct NonPromptCascadeTask { c.protonTPCNSigma, c.pionTPCNSigma, c.bachKaonTPCNSigma, c.bachPionTPCNSigma, c.protonHasTOF, c.pionHasTOF, c.bachHasTOF, c.protonTOFNSigma, c.pionTOFNSigma, c.bachKaonTOFNSigma, c.bachPionTOFNSigma, - c.sel8, c.multFT0C, c.multFT0A, c.multFT0M, c.centFT0C, c.centFT0A, c.centFT0M, c.multNTracksGlobal, c.toiMask); + c.sel8, c.multFT0C, c.multFT0A, c.multFT0M, c.centFT0C, c.centFT0A, c.centFT0M, c.multNTracksGlobal, c.toiMask, c.noSameBunchPileup); } } @@ -606,7 +628,7 @@ struct NonPromptCascadeTask { auto mcCollision = particle.template mcCollision_as(); auto recCollision = collisions.iteratorAt(c.collisionID); - getMCtable()(c.matchingChi2, c.deltaPtITS, c.deltaPt, c.itsClusSize, c.hasReassociatedCluster, c.isGoodMatch, c.isGoodCascade, c.pdgCodeMom, c.pdgCodeITStrack, c.isFromBeauty, c.isFromCharm, + getMCtable()(mRunNumber, c.matchingChi2, c.deltaPtITS, c.deltaPt, c.itsClusSize, c.hasReassociatedCluster, c.isGoodMatch, c.isGoodCascade, c.pdgCodeMom, c.pdgCodeITStrack, c.isFromBeauty, c.isFromCharm, c.pvContributors, c.cascPVContribs, c.pvTimeResolution, c.pvX, c.pvY, c.pvZ, c.cascPt, c.cascEta, c.cascPhi, c.protonPt, c.protonEta, c.pionPt, c.pionEta, c.bachPt, c.bachEta, c.cascDCAxy, c.cascDCAz, c.protonDCAxy, c.protonDCAz, c.pionDCAxy, c.pionDCAz, c.bachDCAxy, c.bachDCAz, @@ -617,7 +639,7 @@ struct NonPromptCascadeTask { c.sel8, c.multFT0C, c.multFT0A, c.multFT0M, c.centFT0C, c.centFT0A, c.centFT0M, particle.pt(), particle.eta(), particle.phi(), mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(), particle.pdgCode(), mcCollision.posX() - particle.vx(), mcCollision.posY() - particle.vy(), - mcCollision.posZ() - particle.vz(), mcCollision.globalIndex() == recCollision.mcCollisionId(), c.hasFakeReassociation, motherDecayDaughters, c.multNTracksGlobal, c.toiMask); + mcCollision.posZ() - particle.vz(), mcCollision.globalIndex() == recCollision.mcCollisionId(), c.hasFakeReassociation, motherDecayDaughters, c.multNTracksGlobal, c.toiMask, c.noSameBunchPileup); } } From 6b707c615c2dc4b16f4da3d29852fb7e3068e95d Mon Sep 17 00:00:00 2001 From: Giovanni Malfattore <89481844+giovannimalfattore@users.noreply.github.com> Date: Sat, 13 Sep 2025 13:34:39 +0200 Subject: [PATCH 382/986] [PWGLF] NucleiTask - Add mothers for Deuteron (#12928) --- PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx | 198 ++++++++++++++++++-------- 1 file changed, 136 insertions(+), 62 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx b/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx index ef8cc86ef87..3e365e0991d 100644 --- a/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx +++ b/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx @@ -41,6 +41,7 @@ #include "ReconstructionDataFormats/PID.h" #include "ReconstructionDataFormats/Track.h" +#include "TMCProcess.h" #include #include @@ -71,7 +72,7 @@ struct LFNucleiBATask { Configurable enableAl{"enableAl", true, "Flag to enable alpha analysis."}; Configurable enableTrackingEff{"enableTrackingEff", 0, "Flag to enable tracking efficiency hitos."}; - Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable ccdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; // Set the triggered events skimming scheme struct : ConfigurableGroup { @@ -214,6 +215,12 @@ struct LFNucleiBATask { Configurable enableCentrality{"enableCentrality", true, "Flag to enable centrality 3D histos)"}; + // ITS to TPC - Fake hit loop + static constexpr int kFakeLoop = 10; // Fixed O2Linter error + // TPC low/high momentum range + static constexpr float kCfgTpcClasses[] = {0.5f, 0.1f}; + static constexpr float kCfgKaonCut = 5.f; + // PDG codes and masses used in this analysis static constexpr int PDGPion = PDG_t::kPiPlus; static constexpr int PDGKaon = PDG_t::kKPlus; @@ -230,20 +237,34 @@ struct LFNucleiBATask { static constexpr float MassAlphaVal = o2::constants::physics::MassAlpha; // PDG of Mothers - static constexpr int kPdgMotherlist[] = { - PDGProton, // proton - PDGPion, // pi+ - PDGKaon, // K+ - 311, // K0 - PDGDeuteron, // deuteron - PDGTriton, // triton - PDGHelium, // He-3 - PDGAlpha, // Alpha - 1000130270, // Aluminium - 1000140280, // Silicon - 1000260560 // Iron - }; - static constexpr int kNumMotherlist = sizeof(kPdgMotherlist) / sizeof(kPdgMotherlist[0]); + static constexpr int kPdgMotherList[] = { + PDG_t::kPiPlus, + PDG_t::kKPlus, + PDG_t::kK0Short, + PDG_t::kNeutron, + PDG_t::kProton, + PDG_t::kLambda0, + o2::constants::physics::Pdg::kDeuteron, + o2::constants::physics::Pdg::kHelium3, + o2::constants::physics::Pdg::kTriton, + o2::constants::physics::Pdg::kHyperTriton, + o2::constants::physics::Pdg::kAlpha}; + + static constexpr int kNumMotherList = sizeof(kPdgMotherList) / sizeof(kPdgMotherList[0]); + + static constexpr const char* kMotherNames[kNumMotherList] = { + "#pi^{+}", + "K^{+}", + "K^{0}_{S}", + "n", + "p", + "#Lambda", + "d", + "He3", + "t", + "^{3}_{#Lambda}H", + "He4"}; + static constexpr int kMaxNumMom = 4; // X: 0..4, overflow=5 template @@ -949,6 +970,26 @@ struct LFNucleiBATask { histos.add("tracks/deuteron/dca/before/hDCAxyVsPtDeuteronTruePrim", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/hDCAxyVsPtDeuteronTrueSec", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/hDCAxyVsPtDeuteronTrueMaterial", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); + + histos.add("tracks/deuteron/dca/before/hNumMothers", "N mothers per particle; N mothers;counts", HistType::kTH1I, {{7, 1.0, 8.0}}); + histos.add("tracks/deuteron/dca/before/hMomTrueMaterial", "MC mothers;mother index;mother type; mother #it{p}_{T}", HistType::kTH3F, {{kMaxNumMom + 2, -0.5, static_cast(kMaxNumMom) + 1.5}, {kNumMotherList + 2, -1.5, static_cast(kNumMotherList) + 0.5}, {250, 0.0, 10.0}}); + + std::shared_ptr hTempDe = histos.get(HIST("tracks/deuteron/dca/before/hMomTrueMaterial")); + TH3* hPdgDe = hTempDe.get(); + + TAxis* axPdgDe = hPdgDe->GetXaxis(); + for (int i = 0; i <= kMaxNumMom; i++) { + axPdgDe->SetBinLabel(i + 1, Form("%d", i)); + } + axPdgDe->SetBinLabel(kMaxNumMom + 2, ">=5"); + + TAxis* ayPdgDe = hPdgDe->GetYaxis(); + ayPdgDe->SetBinLabel(1, "undef."); + ayPdgDe->SetBinLabel(2, "other"); + for (int i = 0; i < kNumMotherList; i++) { + ayPdgDe->SetBinLabel(i + 3, kMotherNames[i]); + } + histos.add("tracks/deuteron/dca/before/hDCAxyVsPtDeuteronTrueTransport", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/hDCAxyVsPtantiDeuteronTrue", "DCAxy vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); @@ -1146,22 +1187,24 @@ struct LFNucleiBATask { histos.add("tracks/helium/dca/before/hDCAxyVsPtHeliumTrueSec", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/hDCAxyVsPtHeliumTrueMaterial", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); - histos.add("tracks/helium/dca/before/hMomTrueMaterial", "MC mothers;mother index;mother PDG", HistType::kTH2I, {{kMaxNumMom + 2, -0.5, static_cast(kMaxNumMom) + 1.5}, {kNumMotherlist + 2, -1.5, static_cast(kNumMotherlist) + 0.5}}); + histos.add("tracks/helium/dca/before/hNumMothers", "N mothers per particle; N mothers;counts", HistType::kTH1I, {{7, 1.0, 8.0}}); + histos.add("tracks/helium/dca/before/hMomTrueMaterial", "MC mothers;mother index;mother type; mother #it{p}_{T}", HistType::kTH3F, {{kMaxNumMom + 2, -0.5, static_cast(kMaxNumMom) + 1.5}, {kNumMotherList + 2, -1.5, static_cast(kNumMotherList) + 0.5}, {250, 0.0, 10.0}}); - // Fix for getting TH2 pointer - std::shared_ptr hTemp = histos.get(HIST("tracks/helium/dca/before/hMomTrueMaterial")); - TH2* hPDG = hTemp.get(); + // Fix for getting TH3 pointer + std::shared_ptr hTempHe = histos.get(HIST("tracks/helium/dca/before/hMomTrueMaterial")); + TH3* hPdgHe = hTempHe.get(); - TAxis* axPDG = hPDG->GetXaxis(); - for (int i = 0; i <= kMaxNumMom; ++i) { - axPDG->SetBinLabel(i + 1, Form("%d", i)); + TAxis* axPdgHe = hPdgHe->GetXaxis(); + for (int i = 0; i <= kMaxNumMom; i++) { + axPdgHe->SetBinLabel(i + 1, Form("%d", i)); } - axPDG->SetBinLabel(kMaxNumMom + 2, ">=5"); - TAxis* ayPDG = hPDG->GetYaxis(); - ayPDG->SetBinLabel(1, "-1"); // undefined - ayPDG->SetBinLabel(2, "0"); // other - for (int i = 0; i < kNumMotherlist; ++i) { - ayPDG->SetBinLabel(i + 3, Form("%d", kPdgMotherlist[i])); + axPdgHe->SetBinLabel(kMaxNumMom + 2, ">=5"); + + TAxis* ayPdgHe = hPdgHe->GetYaxis(); + ayPdgHe->SetBinLabel(1, "undef."); + ayPdgHe->SetBinLabel(2, "other"); + for (int i = 0; i < kNumMotherList; i++) { + ayPdgHe->SetBinLabel(i + 3, kMotherNames[i]); } histos.add("tracks/helium/dca/before/hDCAxyVsPtHeliumTrueTransport", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); @@ -2655,7 +2698,7 @@ struct LFNucleiBATask { if constexpr (IsFilteredData) { isPhysPrim = track.isPhysicalPrimary(); isProdByGen = track.producedByGenerator(); - isWeakDecay = track.getProcess() == 4; // NOLINT + isWeakDecay = (track.getProcess() == TMCProcess::kPDecay); pdgCode = track.pdgCode(); } else { if (!track.has_mcParticle()) { @@ -2663,7 +2706,7 @@ struct LFNucleiBATask { } isPhysPrim = track.mcParticle().isPhysicalPrimary(); isProdByGen = track.mcParticle().producedByGenerator(); - isWeakDecay = track.mcParticle().getProcess() == 4; // NOLINT + isWeakDecay = (track.mcParticle().getProcess() == TMCProcess::kPDecay); pdgCode = track.mcParticle().pdgCode(); } @@ -3158,16 +3201,19 @@ struct LFNucleiBATask { int pdgMom = 0; // gen Pt float genPt = 0; + float ptMom = 0; // Mothers variables [[maybe_unused]] int firstMotherId = -1; [[maybe_unused]] int firstMotherPdg = -1; - [[maybe_unused]] int pdgList[8]; + [[maybe_unused]] float firstMotherPt = -1.f; + [[maybe_unused]] int pdgMomList[kMaxNumMom]; + [[maybe_unused]] float ptMomList[kMaxNumMom]; [[maybe_unused]] int nSaved = 0; if constexpr (IsFilteredData) { isPhysPrim = track.isPhysicalPrimary(); isProdByGen = track.producedByGenerator(); - isWeakDecay = track.getProcess() == 4; // NOLINT + isWeakDecay = (track.getProcess() == TMCProcess::kPDecay); pdgCode = track.pdgCode(); genPt = std::sqrt(std::pow(track.px(), 2) + std::pow(track.py(), 2)); @@ -3177,7 +3223,7 @@ struct LFNucleiBATask { } isPhysPrim = track.mcParticle().isPhysicalPrimary(); isProdByGen = track.mcParticle().producedByGenerator(); - isWeakDecay = track.mcParticle().getProcess() == 4; // NOLINT + isWeakDecay = (track.mcParticle().getProcess() == TMCProcess::kPDecay); pdgCode = track.mcParticle().pdgCode(); // Access to MC particles mother @@ -3186,28 +3232,32 @@ struct LFNucleiBATask { const int nMothers = static_cast(motherIds.size()); firstMotherId = -1; firstMotherPdg = -1; - + firstMotherPt = -1.f; nSaved = 0; - for (int iMom = 0; iMom < nMothers; ++iMom) { + for (int iMom = 0; iMom < nMothers; iMom++) { int motherId = motherIds[iMom]; if (motherId < 0 || motherId >= particles.size()) { continue; // added check on mother } o2::aod::McParticles::iterator mother = particles.iteratorAt(motherId); pdgMom = mother.pdgCode(); + ptMom = mother.pt(); if (iMom == 0) { firstMotherId = motherId; firstMotherPdg = pdgMom; + firstMotherPt = ptMom; } - if (nSaved < 8) { - pdgList[nSaved++] = pdgMom; + if (nSaved < kMaxNumMom) { + pdgMomList[nSaved] = pdgMom; + ptMomList[nSaved] = ptMom; + nSaved++; } } genPt = track.mcParticle().pt(); - for (int i = 0; i < 10; i++) { // From ITS to TPC + for (int i = 0; i < kFakeLoop; i++) { // From ITS to TPC if (track.mcMask() & 1 << i) { hasFakeHit = true; break; @@ -3308,10 +3358,32 @@ struct LFNucleiBATask { if (!isPhysPrim && !isProdByGen) { if (outFlagOptions.makeDCABeforeCutPlots) { histos.fill(HIST("tracks/deuteron/dca/before/hDCAxyVsPtDeuteronTrueTransport"), DPt, track.dcaXY()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/deuteron/dca/before/hDCAxyVsPtDeuteronTrueSec"), DPt, track.dcaXY()); - else + } else { histos.fill(HIST("tracks/deuteron/dca/before/hDCAxyVsPtDeuteronTrueMaterial"), DPt, track.dcaXY()); + if constexpr (!IsFilteredData) { + histos.fill(HIST("tracks/deuteron/dca/before/hNumMothers"), nSaved); + if (nSaved > 0) { + for (int iMom = 0; iMom < nSaved; iMom++) { + int motherIndexBin = (iMom <= kMaxNumMom) ? iMom : (kMaxNumMom + 1); + int pdgMom = pdgMomList[iMom]; + float ptMom = ptMomList[iMom]; + int motherSpeciesBin = -1; + if (pdgMom != -1) { + motherSpeciesBin = 0; + for (int j = 0; j < kNumMotherList; j++) { + if (kPdgMotherList[j] == pdgMom) { + motherSpeciesBin = j + 1; + break; + } + } + } + histos.fill(HIST("tracks/deuteron/dca/before/hMomTrueMaterial"), motherIndexBin, motherSpeciesBin, ptMom); + } + } + } + } if (track.hasTOF() && outFlagOptions.doTOFplots) { histos.fill(HIST("tracks/deuteron/dca/before/TOF/hDCAxyVsPtDeuteronTrueTransport"), DPt, track.dcaXY()); if (isWeakDecay) @@ -3472,21 +3544,23 @@ struct LFNucleiBATask { } else { histos.fill(HIST("tracks/helium/dca/before/hDCAxyVsPtHeliumTrueMaterial"), hePt, track.dcaXY()); if (!IsFilteredData) { + histos.fill(HIST("tracks/helium/dca/before/hNumMothers"), nSaved); if (nSaved > 0) { - for (int i = 0; i < nSaved; ++i) { - int idxComp = (i <= kMaxNumMom) ? i : (kMaxNumMom + 1); - int pdgMom = pdgList[i]; - int yVal = -1; + for (int iMom = 0; iMom < nSaved; iMom++) { + int motherIndexBin = (iMom <= kMaxNumMom) ? iMom : (kMaxNumMom + 1); + int pdgMom = pdgMomList[iMom]; + float ptMom = ptMomList[iMom]; + int motherSpeciesBin = -1; if (pdgMom != -1) { - yVal = 0; - for (int j = 0; j < kNumMotherlist; ++j) { - if (kPdgMotherlist[j] == pdgMom) { - yVal = j + 1; + motherSpeciesBin = 0; + for (int j = 0; j < kNumMotherList; j++) { + if (kPdgMotherList[j] == pdgMom) { + motherSpeciesBin = j + 1; break; } } } - histos.fill(HIST("tracks/helium/dca/before/hMomTrueMaterial"), idxComp, yVal); + histos.fill(HIST("tracks/helium/dca/before/hMomTrueMaterial"), motherIndexBin, motherSpeciesBin, ptMom); } } } @@ -3902,26 +3976,26 @@ struct LFNucleiBATask { debugHistos.fill(HIST("debug/qa/h2TPCncrVsPtPos"), track.tpcInnerParam(), track.tpcNClsCrossedRows()); debugHistos.fill(HIST("debug/qa/h2TPCncrVsTPCsignalPos"), track.tpcSignal(), track.tpcNClsCrossedRows()); - if (track.tpcInnerParam() < 0.5f) { + if (track.tpcInnerParam() < kCfgTpcClasses[0]) { debugHistos.fill(HIST("debug/qa/h1TPCncrLowPPos"), track.tpcNClsCrossedRows()); } - if ((track.tpcInnerParam() >= 0.5f) && (track.tpcInnerParam() < 1.f)) { + if ((track.tpcInnerParam() >= kCfgTpcClasses[0]) && (track.tpcInnerParam() < kCfgTpcClasses[1])) { debugHistos.fill(HIST("debug/qa/h1TPCncrMidPPos"), track.tpcNClsCrossedRows()); } - if (track.tpcInnerParam() >= 1.f) { + if (track.tpcInnerParam() >= kCfgTpcClasses[1]) { debugHistos.fill(HIST("debug/qa/h1TPCncrHighPPos"), track.tpcNClsCrossedRows()); } } else { debugHistos.fill(HIST("debug/qa/h2TPCncrVsPtNeg"), track.tpcInnerParam(), track.tpcNClsCrossedRows()); debugHistos.fill(HIST("debug/qa/h2TPCncrVsTPCsignalNeg"), track.tpcSignal(), track.tpcNClsCrossedRows()); - if (track.tpcInnerParam() < 0.5f) { + if (track.tpcInnerParam() < kCfgTpcClasses[0]) { debugHistos.fill(HIST("debug/qa/h1TPCncrLowPNeg"), track.tpcNClsCrossedRows()); } - if ((track.tpcInnerParam() >= 0.5f) && (track.tpcInnerParam() < 1.f)) { + if ((track.tpcInnerParam() >= kCfgTpcClasses[0]) && (track.tpcInnerParam() < kCfgTpcClasses[1])) { debugHistos.fill(HIST("debug/qa/h1TPCncrMidPNeg"), track.tpcNClsCrossedRows()); } - if (track.tpcInnerParam() >= 1.f) { + if (track.tpcInnerParam() >= kCfgTpcClasses[1]) { debugHistos.fill(HIST("debug/qa/h1TPCncrHighPNeg"), track.tpcNClsCrossedRows()); } } @@ -3934,7 +4008,7 @@ struct LFNucleiBATask { histos.fill(HIST("tracks/eff/h2pVsTPCmomentum"), track.tpcInnerParam(), track.p()); if (filterOptions.enableFiltering) { - if (track.tpcNSigmaKa() < 5) + if (track.tpcNSigmaKa() < kCfgKaonCut) continue; } @@ -4908,7 +4982,7 @@ struct LFNucleiBATask { if constexpr (IsFilteredData) { isPhysPrim = track.isPhysicalPrimary(); isProdByGen = track.producedByGenerator(); - isWeakDecay = track.getProcess() == 4; + isWeakDecay = (track.getProcess() == TMCProcess::kPDecay); pdgCode = track.pdgCode(); isItsPassed = track.itsPassed(); isTpcPassed = track.tpcPassed(); @@ -4920,7 +4994,7 @@ struct LFNucleiBATask { } isPhysPrim = track.mcParticle().isPhysicalPrimary(); isProdByGen = track.mcParticle().producedByGenerator(); - isWeakDecay = track.mcParticle().getProcess() == 4; + isWeakDecay = (track.mcParticle().getProcess() == TMCProcess::kPDecay); pdgCode = track.mcParticle().pdgCode(); isItsPassed = track.passedITSNCls() && track.passedITSChi2NDF() && @@ -4934,7 +5008,7 @@ struct LFNucleiBATask { track.passedTPCRefit() && track.hasTPC(); - for (int i = 0; i < 10; i++) { // From ITS to TPC + for (int i = 0; i < kFakeLoop; i++) { // From ITS to TPC if (track.mcMask() & 1 << i) { hasFakeHit = true; break; @@ -6059,14 +6133,14 @@ struct LFNucleiBATask { spectraGen.fill(HIST("histGenVetxZ"), mcCollision.posZ()); if (mcCollision.centFT0M() < cfgMultCutLow || mcCollision.centFT0M() > cfgMultCutHigh) return; - for (auto& mcParticleGen : mcParticles) { // NOLINT + for (auto const& mcParticleGen : mcParticles) { // NOLINT if (mcParticleGen.y() > kinemOptions.cfgRapidityCutHigh || mcParticleGen.y() < kinemOptions.cfgRapidityCutLow) { continue; } bool isPhysPrim = mcParticleGen.isPhysicalPrimary(); bool isProdByGen = mcParticleGen.producedByGenerator(); - bool isWeakDecay = mcParticleGen.getProcess() == 4; + bool isWeakDecay = (mcParticleGen.getProcess() == TMCProcess::kPDecay); if (mcParticleGen.pdgCode() == PDGPion) { spectraGen.fill(HIST("pion/histGenPtPion"), mcParticleGen.pt()); @@ -6324,7 +6398,7 @@ struct LFNucleiBATask { for (const auto& mcPart : mcParticles) { if (!mcPart.isPhysicalPrimary()) continue; - if (std::abs(mcPart.y()) >= 0.5) + if (std::abs(mcPart.y()) >= kCfgTpcClasses[0]) continue; if (mcPart.pdgCode() == PDGDeuteron) { evLossHistos.fill(HIST("evLoss/pt/hDeuteronGen"), mcPart.pt()); From c3600a5a923145db65677533133cb6e6e0e62028 Mon Sep 17 00:00:00 2001 From: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Date: Sat, 13 Sep 2025 13:40:08 +0200 Subject: [PATCH 383/986] [PWGCF] add TPC-FT0A/C dihadron correlations (#12954) --- .../Tasks/CMakeLists.txt | 6 + .../Tasks/longRangeDihadronCor.cxx | 712 ++++++++++++++++++ 2 files changed, 718 insertions(+) create mode 100644 PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx diff --git a/PWGCF/TwoParticleCorrelations/Tasks/CMakeLists.txt b/PWGCF/TwoParticleCorrelations/Tasks/CMakeLists.txt index 0b61a13fbb5..5aae9125860 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/CMakeLists.txt +++ b/PWGCF/TwoParticleCorrelations/Tasks/CMakeLists.txt @@ -72,3 +72,9 @@ o2physics_add_dpl_workflow(longrange-correlation SOURCES longrangeCorrelation.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(long-range-dihadron-cor + SOURCES longRangeDihadronCor.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore O2Physics::AnalysisCCDB O2Physics::GFWCore + COMPONENT_NAME Analysis) + diff --git a/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx b/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx new file mode 100644 index 00000000000..ae3a3056bad --- /dev/null +++ b/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx @@ -0,0 +1,712 @@ +// 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 longRangeDihadronCor.cxx +/// \brief long range di-hadron correlation for O-O, Pb-Pb collisions +/// \author Zhiyong Lu (zhiyong.lu@cern.ch) +/// \since Sep/10/2025 + +#include "PWGCF/Core/CorrelationContainer.h" +#include "PWGCF/Core/PairCuts.h" +#include "PWGCF/DataModel/CorrelationsDerived.h" +#include "PWGCF/GenericFramework/Core/GFW.h" +#include "PWGCF/GenericFramework/Core/GFWCumulant.h" +#include "PWGCF/GenericFramework/Core/GFWPowerArray.h" +#include "PWGCF/GenericFramework/Core/GFWWeights.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/FT0Corrected.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CommonConstants/MathConstants.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsCommonDataFormats/AlignParam.h" +#include "FT0Base/Geometry.h" +#include "FV0Base/Geometry.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" +#include + +#include "TF1.h" +#include "TRandom3.h" +#include + +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +// define the filtered collisions and tracks +#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; + +struct LongRangeDihadronCor { + Service ccdb; + + O2_DEFINE_CONFIGURABLE(cfgCutVtxZ, float, 10.0f, "Accepted z-vertex range") + O2_DEFINE_CONFIGURABLE(cfgCutPtMin, float, 0.2f, "minimum accepted track pT") + O2_DEFINE_CONFIGURABLE(cfgCutPtMax, float, 10.0f, "maximum accepted track pT") + O2_DEFINE_CONFIGURABLE(cfgCutEta, float, 0.8f, "Eta cut") + O2_DEFINE_CONFIGURABLE(cfgCutChi2prTPCcls, float, 2.5f, "max chi2 per TPC clusters") + O2_DEFINE_CONFIGURABLE(cfgCutTPCclu, float, 50.0f, "minimum TPC clusters") + O2_DEFINE_CONFIGURABLE(cfgCutTPCCrossedRows, float, 70.0f, "minimum TPC crossed rows") + O2_DEFINE_CONFIGURABLE(cfgCutITSclu, float, 5.0f, "minimum ITS clusters") + O2_DEFINE_CONFIGURABLE(cfgCutDCAz, float, 2.0f, "max DCA to vertex z") + O2_DEFINE_CONFIGURABLE(cfgSelCollByNch, bool, true, "Select collisions by Nch or centrality") + O2_DEFINE_CONFIGURABLE(cfgCutMultMin, int, 0, "Minimum multiplicity for collision") + O2_DEFINE_CONFIGURABLE(cfgCutMultMax, int, 10, "Maximum multiplicity for collision") + O2_DEFINE_CONFIGURABLE(cfgCutCentMin, float, 60.0f, "Minimum centrality for collision") + O2_DEFINE_CONFIGURABLE(cfgCutCentMax, float, 80.0f, "Maximum centrality for collision") + O2_DEFINE_CONFIGURABLE(cfgMixEventNumMin, int, 5, "Minimum number of events to mix") + O2_DEFINE_CONFIGURABLE(cfgSampleSize, double, 10, "Sample size for mixed event") + O2_DEFINE_CONFIGURABLE(cfgCentEstimator, int, 0, "0:FT0C; 1:FT0CVariant1; 2:FT0M; 3:FT0A") + O2_DEFINE_CONFIGURABLE(cfgCentTableUnavailable, bool, false, "if a dataset does not provide centrality information") + O2_DEFINE_CONFIGURABLE(cfgUseAdditionalEventCut, bool, false, "Use additional event cut on mult correlations") + O2_DEFINE_CONFIGURABLE(cfgEvSelkNoSameBunchPileup, bool, false, "rejects collisions which are associated with the same found-by-T0 bunch crossing") + O2_DEFINE_CONFIGURABLE(cfgEvSelkNoITSROFrameBorder, bool, false, "reject events at ITS ROF border") + O2_DEFINE_CONFIGURABLE(cfgEvSelkNoTimeFrameBorder, bool, false, "reject events at TF border") + O2_DEFINE_CONFIGURABLE(cfgEvSelkIsGoodZvtxFT0vsPV, bool, false, "removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference, use this cut at low multiplicities with caution") + O2_DEFINE_CONFIGURABLE(cfgEvSelkNoCollInTimeRangeStandard, bool, false, "no collisions in specified time range") + O2_DEFINE_CONFIGURABLE(cfgEvSelkIsGoodITSLayersAll, bool, true, "cut time intervals with dead ITS staves") + O2_DEFINE_CONFIGURABLE(cfgEvSelkNoCollInRofStandard, bool, false, "no other collisions in this Readout Frame with per-collision multiplicity above threshold") + O2_DEFINE_CONFIGURABLE(cfgEvSelkNoHighMultCollInPrevRof, bool, false, "veto an event if FT0C amplitude in previous ITS ROF is above threshold") + O2_DEFINE_CONFIGURABLE(cfgEvSelMultCorrelation, bool, true, "Multiplicity correlation cut") + O2_DEFINE_CONFIGURABLE(cfgEvSelV0AT0ACut, bool, true, "V0A T0A 5 sigma cut") + O2_DEFINE_CONFIGURABLE(cfgEvSelOccupancy, bool, true, "Occupancy cut") + O2_DEFINE_CONFIGURABLE(cfgCutOccupancyHigh, int, 2000, "High cut on TPC occupancy") + O2_DEFINE_CONFIGURABLE(cfgCutOccupancyLow, int, 0, "Low cut on TPC occupancy") + O2_DEFINE_CONFIGURABLE(cfgEfficiency, std::string, "", "CCDB path to efficiency object") + O2_DEFINE_CONFIGURABLE(cfgCentralityWeight, std::string, "", "CCDB path to centrality weight object") + O2_DEFINE_CONFIGURABLE(cfgLocalEfficiency, bool, false, "Use local efficiency object") + O2_DEFINE_CONFIGURABLE(cfgUseEventWeights, bool, false, "Use event weights for mixed event") + O2_DEFINE_CONFIGURABLE(cfgSwitchCor, int, 0, "0:TPC-FT0A; 1:TPC-FT0C") + struct : ConfigurableGroup { + O2_DEFINE_CONFIGURABLE(cfgMultCentHighCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x + 10.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultCentLowCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x - 3.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultT0CCutEnabled, bool, false, "Enable Global multiplicity vs T0C centrality cut") + Configurable> cfgMultT0CCutPars{"cfgMultT0CCutPars", std::vector{143.04, -4.58368, 0.0766055, -0.000727796, 2.86153e-06, 23.3108, -0.36304, 0.00437706, -4.717e-05, 1.98332e-07}, "Global multiplicity vs T0C centrality cut parameter values"}; + O2_DEFINE_CONFIGURABLE(cfgMultPVT0CCutEnabled, bool, false, "Enable PV multiplicity vs T0C centrality cut") + Configurable> cfgMultPVT0CCutPars{"cfgMultPVT0CCutPars", std::vector{195.357, -6.15194, 0.101313, -0.000955828, 3.74793e-06, 30.0326, -0.43322, 0.00476265, -5.11206e-05, 2.13613e-07}, "PV multiplicity vs T0C centrality cut parameter values"}; + O2_DEFINE_CONFIGURABLE(cfgMultMultPVHighCutFunction, std::string, "[0]+[1]*x + 5.*([2]+[3]*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultMultPVLowCutFunction, std::string, "[0]+[1]*x - 5.*([2]+[3]*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultGlobalPVCutEnabled, bool, false, "Enable global multiplicity vs PV multiplicity cut") + Configurable> cfgMultGlobalPVCutPars{"cfgMultGlobalPVCutPars", std::vector{-0.140809, 0.734344, 2.77495, 0.0165935}, "PV multiplicity vs T0C centrality cut parameter values"}; + O2_DEFINE_CONFIGURABLE(cfgMultMultV0AHighCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x + 4.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultMultV0ALowCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x - 3.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultMultV0ACutEnabled, bool, false, "Enable global multiplicity vs V0A multiplicity cut") + Configurable> cfgMultMultV0ACutPars{"cfgMultMultV0ACutPars", std::vector{534.893, 184.344, 0.423539, -0.00331436, 5.34622e-06, 871.239, 53.3735, -0.203528, 0.000122758, 5.41027e-07}, "Global multiplicity vs V0A multiplicity cut parameter values"}; + std::vector multT0CCutPars; + std::vector multPVT0CCutPars; + std::vector multGlobalPVCutPars; + std::vector multMultV0ACutPars; + TF1* fMultPVT0CCutLow = nullptr; + TF1* fMultPVT0CCutHigh = nullptr; + TF1* fMultT0CCutLow = nullptr; + TF1* fMultT0CCutHigh = nullptr; + TF1* fMultGlobalPVCutLow = nullptr; + TF1* fMultGlobalPVCutHigh = nullptr; + TF1* fMultMultV0ACutLow = nullptr; + TF1* fMultMultV0ACutHigh = nullptr; + TF1* fT0AV0AMean = nullptr; + TF1* fT0AV0ASigma = nullptr; + } cfgFuncParas; + + SliceCache cache; + + ConfigurableAxis axisVertex{"axisVertex", {10, -10, 10}, "vertex axis for histograms"}; + ConfigurableAxis axisMultiplicity{"axisMultiplicity", {VARIABLE_WIDTH, 0, 10, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260}, "multiplicity axis for histograms"}; + ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.2, 0.5, 1, 1.5, 2, 3, 4, 6, 10}, "pt axis for histograms"}; + ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -PIHalf, PIHalf * 3}, "delta phi axis for histograms"}; + ConfigurableAxis axisDeltaEta{"axisDeltaEta", {32, -5.8, -2.6}, "delta eta axis, -5.8~-2.6 for TPC-FT0A, 1.2~4.2 for TPC-FT0C"}; + ConfigurableAxis axisPtTrigger{"axisPtTrigger", {VARIABLE_WIDTH, 0.2, 0.5, 1, 1.5, 2, 3, 4, 6, 10}, "pt trigger axis for histograms"}; + ConfigurableAxis axisPtAssoc{"axisPtAssoc", {VARIABLE_WIDTH, 0.2, 0.5, 1, 1.5, 2, 3, 4, 6, 10}, "pt associated axis for histograms"}; + ConfigurableAxis axisVtxMix{"axisVtxMix", {VARIABLE_WIDTH, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, "vertex axis for mixed event histograms"}; + ConfigurableAxis axisMultMix{"axisMultMix", {VARIABLE_WIDTH, 0, 10, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260}, "multiplicity / centrality axis for mixed event histograms"}; + ConfigurableAxis axisSample{"axisSample", {cfgSampleSize, 0, cfgSampleSize}, "sample axis for histograms"}; + + ConfigurableAxis axisVertexEfficiency{"axisVertexEfficiency", {10, -10, 10}, "vertex axis for efficiency histograms"}; + ConfigurableAxis axisEtaEfficiency{"axisEtaEfficiency", {20, -1.0, 1.0}, "eta axis for efficiency histograms"}; + ConfigurableAxis axisPtEfficiency{"axisPtEfficiency", {VARIABLE_WIDTH, 0.2, 0.5, 1, 1.5, 2, 3, 4, 6, 10}, "pt axis for efficiency histograms"}; + ConfigurableAxis axisAmplitudeFt0a{"axisAmplitudeFt0a", {5000, 0, 1000}, "FT0A amplitude"}; + ConfigurableAxis axisChannelFt0aAxis{"axisChannelFt0aAxis", {96, 0.0, 96.0}, "FT0A channel"}; + + // make the filters and cuts. + Filter collisionFilter = (nabs(aod::collision::posZ) < cfgCutVtxZ); + Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls) && (nabs(aod::track::dcaZ) < cfgCutDCAz); + using FilteredCollisions = soa::Filtered>; + using FilteredTracks = soa::Filtered>; + + // FT0 geometry + o2::ft0::Geometry ft0Det; + std::vector* offsetFT0; + + // Corrections + TH3D* mEfficiency = nullptr; + TH1D* mCentralityWeight = nullptr; + bool correctionsLoaded = false; + + // Define the outputs + OutputObj same{"sameEvent"}; + OutputObj mixed{"mixedEvent"}; + HistogramRegistry registry{"registry"}; + + // define global variables + TRandom3* gRandom = new TRandom3(); + enum CentEstimators { + kCentFT0C = 0, + kCentFT0CVariant1, + kCentFT0M, + kCentFV0A, + // Count the total number of enum + kCount_CentEstimators + }; + enum EventType { + SameEvent = 1, + MixedEvent = 3 + }; + enum FITIndex { + kFT0A = 0, + kFT0C = 1 + }; + + void init(InitContext&) + { + if (cfgCentTableUnavailable && !cfgSelCollByNch) { + LOGF(fatal, "Centrality table is unavailable, cannot select collisions by centrality"); + } + const AxisSpec axisPhi{72, 0.0, constants::math::TwoPI, "#varphi"}; + const AxisSpec axisEta{40, -1., 1., "#eta"}; + + ccdb->setURL("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + auto now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); + ccdb->setCreatedNotAfter(now); + + LOGF(info, "Starting init"); + + // Event Counter + if (doprocessSame && cfgUseAdditionalEventCut) { + registry.add("hEventCountSpecific", "Number of Event;; Count", {HistType::kTH1D, {{12, 0, 12}}}); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(1, "after sel8"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(2, "kNoSameBunchPileup"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(3, "kNoITSROFrameBorder"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(4, "kNoTimeFrameBorder"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(5, "kIsGoodZvtxFT0vsPV"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(6, "kNoCollInTimeRangeStandard"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(7, "kIsGoodITSLayersAll"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(8, "kNoCollInRofStandard"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(9, "kNoHighMultCollInPrevRof"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(10, "occupancy"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(11, "MultCorrelation"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(12, "cfgEvSelV0AT0ACut"); + } + + if (cfgEvSelMultCorrelation) { + cfgFuncParas.multT0CCutPars = cfgFuncParas.cfgMultT0CCutPars; + cfgFuncParas.multPVT0CCutPars = cfgFuncParas.cfgMultPVT0CCutPars; + cfgFuncParas.multGlobalPVCutPars = cfgFuncParas.cfgMultGlobalPVCutPars; + cfgFuncParas.multMultV0ACutPars = cfgFuncParas.cfgMultMultV0ACutPars; + cfgFuncParas.fMultPVT0CCutLow = new TF1("fMultPVT0CCutLow", cfgFuncParas.cfgMultCentLowCutFunction->c_str(), 0, 100); + cfgFuncParas.fMultPVT0CCutLow->SetParameters(&(cfgFuncParas.multPVT0CCutPars[0])); + cfgFuncParas.fMultPVT0CCutHigh = new TF1("fMultPVT0CCutHigh", cfgFuncParas.cfgMultCentHighCutFunction->c_str(), 0, 100); + cfgFuncParas.fMultPVT0CCutHigh->SetParameters(&(cfgFuncParas.multPVT0CCutPars[0])); + + cfgFuncParas.fMultT0CCutLow = new TF1("fMultT0CCutLow", cfgFuncParas.cfgMultCentLowCutFunction->c_str(), 0, 100); + cfgFuncParas.fMultT0CCutLow->SetParameters(&(cfgFuncParas.multT0CCutPars[0])); + cfgFuncParas.fMultT0CCutHigh = new TF1("fMultT0CCutHigh", cfgFuncParas.cfgMultCentHighCutFunction->c_str(), 0, 100); + cfgFuncParas.fMultT0CCutHigh->SetParameters(&(cfgFuncParas.multT0CCutPars[0])); + + cfgFuncParas.fMultGlobalPVCutLow = new TF1("fMultGlobalPVCutLow", cfgFuncParas.cfgMultMultPVLowCutFunction->c_str(), 0, 4000); + cfgFuncParas.fMultGlobalPVCutLow->SetParameters(&(cfgFuncParas.multGlobalPVCutPars[0])); + cfgFuncParas.fMultGlobalPVCutHigh = new TF1("fMultGlobalPVCutHigh", cfgFuncParas.cfgMultMultPVHighCutFunction->c_str(), 0, 4000); + cfgFuncParas.fMultGlobalPVCutHigh->SetParameters(&(cfgFuncParas.multGlobalPVCutPars[0])); + + cfgFuncParas.fMultMultV0ACutLow = new TF1("fMultMultV0ACutLow", cfgFuncParas.cfgMultMultV0ALowCutFunction->c_str(), 0, 4000); + cfgFuncParas.fMultMultV0ACutLow->SetParameters(&(cfgFuncParas.multMultV0ACutPars[0])); + cfgFuncParas.fMultMultV0ACutHigh = new TF1("fMultMultV0ACutHigh", cfgFuncParas.cfgMultMultV0AHighCutFunction->c_str(), 0, 4000); + cfgFuncParas.fMultMultV0ACutHigh->SetParameters(&(cfgFuncParas.multMultV0ACutPars[0])); + + cfgFuncParas.fT0AV0AMean = new TF1("fT0AV0AMean", "[0]+[1]*x", 0, 200000); + cfgFuncParas.fT0AV0AMean->SetParameters(-1601.0581, 9.417652e-01); + cfgFuncParas.fT0AV0ASigma = new TF1("fT0AV0ASigma", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 200000); + cfgFuncParas.fT0AV0ASigma->SetParameters(463.4144, 6.796509e-02, -9.097136e-07, 7.971088e-12, -2.600581e-17); + } + + std::string hCentTitle = "Centrality distribution, Estimator " + std::to_string(cfgCentEstimator); + // Make histograms to check the distributions after cuts + if (doprocessSame) { + registry.add("deltaEta_deltaPhi_same", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEta}}); // check to see the delta eta and delta phi distribution + registry.add("deltaEta_deltaPhi_mixed", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEta}}); + registry.add("Phi", "Phi", {HistType::kTH1D, {axisPhi}}); + registry.add("Eta", "Eta", {HistType::kTH1D, {axisEta}}); + registry.add("EtaCorrected", "EtaCorrected", {HistType::kTH1D, {axisEta}}); + registry.add("pT", "pT", {HistType::kTH1D, {axisPtTrigger}}); + registry.add("pTCorrected", "pTCorrected", {HistType::kTH1D, {axisPtTrigger}}); + registry.add("Nch", "N_{ch}", {HistType::kTH1D, {axisMultiplicity}}); + registry.add("Nch_used", "N_{ch}", {HistType::kTH1D, {axisMultiplicity}}); // histogram to see how many events are in the same and mixed event + registry.add("Centrality", hCentTitle.c_str(), {HistType::kTH1D, {{100, 0, 100}}}); + registry.add("CentralityWeighted", hCentTitle.c_str(), {HistType::kTH1D, {{100, 0, 100}}}); + registry.add("Centrality_used", hCentTitle.c_str(), {HistType::kTH1D, {{100, 0, 100}}}); // histogram to see how many events are in the same and mixed event + registry.add("zVtx", "zVtx", {HistType::kTH1D, {axisVertex}}); + registry.add("zVtx_used", "zVtx_used", {HistType::kTH1D, {axisVertex}}); + registry.add("Trig_hist", "", {HistType::kTHnSparseF, {{axisSample, axisVertex, axisPtTrigger}}}); + registry.add("Assoc_amp_same", "", {HistType::kTH2D, {axisChannelFt0aAxis, axisAmplitudeFt0a}}); + registry.add("Assoc_amp_mixed", "", {HistType::kTH2D, {axisChannelFt0aAxis, axisAmplitudeFt0a}}); + } + + registry.add("eventcount", "bin", {HistType::kTH1F, {{4, 0, 4, "bin"}}}); // histogram to see how many events are in the same and mixed event + + LOGF(info, "Initializing correlation container"); + std::vector corrAxis = {{axisSample, "Sample"}, + {axisVertex, "z-vtx (cm)"}, + {axisPtTrigger, "p_{T} (GeV/c)"}, + {axisPtAssoc, "p_{T} (GeV/c)"}, + {axisDeltaPhi, "#Delta#varphi (rad)"}, + {axisDeltaEta, "#Delta#eta"}}; + std::vector effAxis = { + {axisEtaEfficiency, "#eta"}, + {axisPtEfficiency, "p_{T} (GeV/c)"}, + {axisVertexEfficiency, "z-vtx (cm)"}, + }; + std::vector userAxis; + + same.setObject(new CorrelationContainer("sameEvent", "sameEvent", corrAxis, effAxis, userAxis)); + mixed.setObject(new CorrelationContainer("mixedEvent", "mixedEvent", corrAxis, effAxis, userAxis)); + + LOGF(info, "End of init"); + } + + double getPhiFT0(uint64_t chno, int i) + { + // offsetFT0[0]: FT0A, offsetFT0[1]: FT0C + ft0Det.calculateChannelCenter(); + auto chPos = ft0Det.getChannelCenter(chno); + return RecoDecay::phi(chPos.X() + (*offsetFT0)[i].getX(), chPos.Y() + (*offsetFT0)[i].getY()); + } + + double getEtaFT0(uint64_t chno, int i) + { + // offsetFT0[0]: FT0A, offsetFT0[1]: FT0C + ft0Det.calculateChannelCenter(); + auto chPos = ft0Det.getChannelCenter(chno); + auto x = chPos.X() + (*offsetFT0)[i].getX(); + auto y = chPos.Y() + (*offsetFT0)[i].getY(); + auto z = chPos.Z() + (*offsetFT0)[i].getZ(); + auto r = std::sqrt(x * x + y * y); + auto theta = std::atan2(r, z); + return -std::log(std::tan(0.5 * theta)); + } + + template + float getCentrality(TCollision const& collision) + { + float cent; + switch (cfgCentEstimator) { + case kCentFT0C: + cent = collision.centFT0C(); + break; + case kCentFT0CVariant1: + cent = collision.centFT0CVariant1(); + break; + case kCentFT0M: + cent = collision.centFT0M(); + break; + case kCentFV0A: + cent = collision.centFV0A(); + break; + default: + cent = collision.centFT0C(); + } + return cent; + } + + template + bool trackSelected(TTrack track) + { + return ((track.tpcNClsFound() >= cfgCutTPCclu) && (track.tpcNClsCrossedRows() >= cfgCutTPCCrossedRows) && (track.itsNCls() >= cfgCutITSclu)); + } + + void loadAlignParam(uint64_t timestamp) + { + offsetFT0 = ccdb->getForTimeStamp>("FT0/Calib/Align", timestamp); + if (offsetFT0 == nullptr) { + LOGF(fatal, "Could not load FT0/Calib/Align for timestamp %d", timestamp); + } + } + + void loadCorrection(uint64_t timestamp) + { + if (correctionsLoaded) { + return; + } + if (cfgEfficiency.value.empty() == false) { + if (cfgLocalEfficiency > 0) { + TFile* fEfficiencyTrigger = TFile::Open(cfgEfficiency.value.c_str(), "READ"); + mEfficiency = reinterpret_cast(fEfficiencyTrigger->Get("ccdb_object")); + } else { + mEfficiency = ccdb->getForTimeStamp(cfgEfficiency, timestamp); + } + if (mEfficiency == nullptr) { + LOGF(fatal, "Could not load efficiency histogram for trigger particles from %s", cfgEfficiency.value.c_str()); + } + LOGF(info, "Loaded efficiency histogram from %s (%p)", cfgEfficiency.value.c_str(), (void*)mEfficiency); + } + if (cfgCentralityWeight.value.empty() == false) { + mCentralityWeight = ccdb->getForTimeStamp(cfgCentralityWeight, timestamp); + if (mCentralityWeight == nullptr) { + LOGF(fatal, "Could not load efficiency histogram for trigger particles from %s", cfgCentralityWeight.value.c_str()); + } + LOGF(info, "Loaded efficiency histogram from %s (%p)", cfgCentralityWeight.value.c_str(), (void*)mCentralityWeight); + } + correctionsLoaded = true; + } + + bool getEfficiencyCorrection(float& weight_nue, float eta, float pt, float posZ) + { + float eff = 1.; + if (mEfficiency) { + int etaBin = mEfficiency->GetXaxis()->FindBin(eta); + int ptBin = mEfficiency->GetYaxis()->FindBin(pt); + int zBin = mEfficiency->GetZaxis()->FindBin(posZ); + eff = mEfficiency->GetBinContent(etaBin, ptBin, zBin); + } else { + eff = 1.0; + } + if (eff == 0) + return false; + weight_nue = 1. / eff; + return true; + } + + bool getCentralityWeight(float& weightCent, const float centrality) + { + float weight = 1.; + if (mCentralityWeight) + weight = mCentralityWeight->GetBinContent(mCentralityWeight->FindBin(centrality)); + else + weight = 1.0; + if (weight == 0) + return false; + weightCent = weight; + return true; + } + + // fill multiple histograms + template + void fillYield(TCollision collision, TTracks tracks) // function to fill the yield and etaphi histograms. + { + float weff1 = 1; + float vtxz = collision.posZ(); + for (auto const& track1 : tracks) { + if (!trackSelected(track1)) + continue; + if (!getEfficiencyCorrection(weff1, track1.eta(), track1.pt(), vtxz)) + continue; + registry.fill(HIST("Phi"), RecoDecay::constrainAngle(track1.phi(), 0.0)); + registry.fill(HIST("Eta"), track1.eta()); + registry.fill(HIST("EtaCorrected"), track1.eta(), weff1); + registry.fill(HIST("pT"), track1.pt()); + registry.fill(HIST("pTCorrected"), track1.pt(), weff1); + } + } + + template + void getChannel(TFT0s const& ft0, std::size_t const& iCh, int& id, float& ampl) + { + int switchCor = cfgSwitchCor; + if (switchCor == kFT0C) { + id = ft0.channelC()[iCh]; + ampl = ft0.amplitudeC()[iCh]; + } else if (switchCor == kFT0A) { + id = ft0.channelA()[iCh]; + ampl = ft0.amplitudeA()[iCh]; + } else { + LOGF(fatal, "Cor Index %d out of range", switchCor); + } + } + + template + void fillCorrelations(TTracks tracks1, TFT0s const& ft0, float posZ, int system, float cent, float eventWeight) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms + { + if (system == SameEvent) { + if (!cfgCentTableUnavailable) + registry.fill(HIST("Centrality_used"), cent); + registry.fill(HIST("Nch_used"), tracks1.size()); + } + + int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); + + float triggerWeight = 1.0f; + // loop over all tracks + for (auto const& track1 : tracks1) { + + if (!trackSelected(track1)) + continue; + if (!getEfficiencyCorrection(triggerWeight, track1.eta(), track1.pt(), posZ)) + continue; + if (system == SameEvent) { + registry.fill(HIST("Trig_hist"), fSampleIndex, posZ, track1.pt(), eventWeight * triggerWeight); + } + + std::size_t channelSize = 0; + int switchCor = cfgSwitchCor; + if (switchCor == kFT0C) { + channelSize = ft0.channelC().size(); + } else if (switchCor == kFT0A) { + channelSize = ft0.channelA().size(); + } else { + LOGF(fatal, "Cor Index %d out of range", switchCor); + } + for (std::size_t iCh = 0; iCh < channelSize; iCh++) { + int chanelid = 0; + float ampl = 0.; + getChannel(ft0, iCh, chanelid, ampl); + auto phi = getPhiFT0(chanelid, switchCor); + auto eta = getEtaFT0(chanelid, switchCor); + float deltaPhi = RecoDecay::constrainAngle(track1.phi() - phi, -PIHalf); + float deltaEta = track1.eta() - eta; + // fill the right sparse and histograms + if (system == SameEvent) { + registry.fill(HIST("Assoc_amp_same"), chanelid, ampl); + same->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track1.pt(), deltaPhi, deltaEta, eventWeight * triggerWeight); + registry.fill(HIST("deltaEta_deltaPhi_same"), deltaPhi, deltaEta, eventWeight * triggerWeight); + } else if (system == MixedEvent) { + registry.fill(HIST("Assoc_amp_mixed"), chanelid, ampl); + mixed->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track1.pt(), deltaPhi, deltaEta, eventWeight * triggerWeight); + registry.fill(HIST("deltaEta_deltaPhi_mixed"), deltaPhi, deltaEta, eventWeight * triggerWeight); + } + } + } + } + + template + bool eventSelected(TCollision collision, const int multTrk, const float centrality, const bool fillCounter) + { + registry.fill(HIST("hEventCountSpecific"), 0.5); + if (cfgEvSelkNoSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + // rejects collisions which are associated with the same "found-by-T0" bunch crossing + // https://indico.cern.ch/event/1396220/#1-event-selection-with-its-rof + return 0; + } + if (fillCounter && cfgEvSelkNoSameBunchPileup) + registry.fill(HIST("hEventCountSpecific"), 1.5); + if (cfgEvSelkNoITSROFrameBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + return 0; + } + if (fillCounter && cfgEvSelkNoITSROFrameBorder) + registry.fill(HIST("hEventCountSpecific"), 2.5); + if (cfgEvSelkNoTimeFrameBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + return 0; + } + if (fillCounter && cfgEvSelkNoTimeFrameBorder) + registry.fill(HIST("hEventCountSpecific"), 3.5); + if (cfgEvSelkIsGoodZvtxFT0vsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + // removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference + // use this cut at low multiplicities with caution + return 0; + } + if (fillCounter && cfgEvSelkIsGoodZvtxFT0vsPV) + registry.fill(HIST("hEventCountSpecific"), 4.5); + if (cfgEvSelkNoCollInTimeRangeStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + // no collisions in specified time range + return 0; + } + if (fillCounter && cfgEvSelkNoCollInTimeRangeStandard) + registry.fill(HIST("hEventCountSpecific"), 5.5); + if (cfgEvSelkIsGoodITSLayersAll && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + // from Jan 9 2025 AOT meeting + // cut time intervals with dead ITS staves + return 0; + } + if (fillCounter && cfgEvSelkIsGoodITSLayersAll) + registry.fill(HIST("hEventCountSpecific"), 6.5); + if (cfgEvSelkNoCollInRofStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { + // no other collisions in this Readout Frame with per-collision multiplicity above threshold + return 0; + } + if (fillCounter && cfgEvSelkNoCollInRofStandard) + registry.fill(HIST("hEventCountSpecific"), 7.5); + if (cfgEvSelkNoHighMultCollInPrevRof && !collision.selection_bit(o2::aod::evsel::kNoHighMultCollInPrevRof)) { + // veto an event if FT0C amplitude in previous ITS ROF is above threshold + return 0; + } + if (fillCounter && cfgEvSelkNoHighMultCollInPrevRof) + registry.fill(HIST("hEventCountSpecific"), 8.5); + auto occupancy = collision.trackOccupancyInTimeRange(); + if (cfgEvSelOccupancy && (occupancy < cfgCutOccupancyLow || occupancy > cfgCutOccupancyHigh)) + return 0; + if (fillCounter && cfgEvSelOccupancy) + registry.fill(HIST("hEventCountSpecific"), 9.5); + + auto multNTracksPV = collision.multNTracksPV(); + if (cfgEvSelMultCorrelation) { + if (cfgFuncParas.cfgMultPVT0CCutEnabled && !cfgCentTableUnavailable) { + if (multNTracksPV < cfgFuncParas.fMultPVT0CCutLow->Eval(centrality)) + return 0; + if (multNTracksPV > cfgFuncParas.fMultPVT0CCutHigh->Eval(centrality)) + return 0; + } + if (cfgFuncParas.cfgMultT0CCutEnabled && !cfgCentTableUnavailable) { + if (multTrk < cfgFuncParas.fMultT0CCutLow->Eval(centrality)) + return 0; + if (multTrk > cfgFuncParas.fMultT0CCutHigh->Eval(centrality)) + return 0; + } + if (cfgFuncParas.cfgMultGlobalPVCutEnabled) { + if (multTrk < cfgFuncParas.fMultGlobalPVCutLow->Eval(multNTracksPV)) + return 0; + if (multTrk > cfgFuncParas.fMultGlobalPVCutHigh->Eval(multNTracksPV)) + return 0; + } + if (cfgFuncParas.cfgMultMultV0ACutEnabled) { + if (collision.multFV0A() < cfgFuncParas.fMultMultV0ACutLow->Eval(multTrk)) + return 0; + if (collision.multFV0A() > cfgFuncParas.fMultMultV0ACutHigh->Eval(multTrk)) + return 0; + } + } + if (fillCounter && cfgEvSelMultCorrelation) + registry.fill(HIST("hEventCountSpecific"), 10.5); + + // V0A T0A 5 sigma cut + float sigma = 5.0; + if (cfgEvSelV0AT0ACut && (std::fabs(collision.multFV0A() - cfgFuncParas.fT0AV0AMean->Eval(collision.multFT0A())) > sigma * cfgFuncParas.fT0AV0ASigma->Eval(collision.multFT0A()))) + return 0; + if (fillCounter && cfgEvSelV0AT0ACut) + registry.fill(HIST("hEventCountSpecific"), 11.5); + + return 1; + } + + void processSame(FilteredCollisions::iterator const& collision, FilteredTracks const& tracks, aod::FT0s const&, aod::BCsWithTimestamps const&) + { + if (!collision.sel8()) + return; + auto bc = collision.bc_as(); + float cent = -1.; + float weightCent = 1.0f; + if (!cfgCentTableUnavailable) { + cent = getCentrality(collision); + } + if (cfgUseAdditionalEventCut && !eventSelected(collision, tracks.size(), cent, true)) + return; + if (!collision.has_foundFT0()) + return; + loadAlignParam(bc.timestamp()); + loadCorrection(bc.timestamp()); + if (!cfgCentTableUnavailable) { + getCentralityWeight(weightCent, cent); + registry.fill(HIST("Centrality"), cent); + registry.fill(HIST("CentralityWeighted"), cent, weightCent); + } + registry.fill(HIST("Nch"), tracks.size()); + registry.fill(HIST("zVtx"), collision.posZ()); + + if (cfgSelCollByNch && (tracks.size() < cfgCutMultMin || tracks.size() >= cfgCutMultMax)) { + return; + } + if (!cfgSelCollByNch && !cfgCentTableUnavailable && (cent < cfgCutCentMin || cent >= cfgCutCentMax)) { + return; + } + + registry.fill(HIST("eventcount"), SameEvent); // because its same event i put it in the 1 bin + fillYield(collision, tracks); + + same->fillEvent(tracks.size(), CorrelationContainer::kCFStepReconstructed); + const auto& ft0 = collision.foundFT0(); + fillCorrelations(tracks, ft0, collision.posZ(), SameEvent, cent, weightCent); + } + PROCESS_SWITCH(LongRangeDihadronCor, processSame, "Process same event", true); + + // the process for filling the mixed events + void processMixed(FilteredCollisions const& collisions, FilteredTracks const& tracks, aod::FT0s const&, aod::BCsWithTimestamps const&) + { + + auto getTracksSize = [&tracks, this](FilteredCollisions::iterator const& collision) { + auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), this->cache); + auto mult = associatedTracks.size(); + return mult; + }; + + using MixedBinning = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getTracksSize)>; + + MixedBinning binningOnVtxAndMult{{getTracksSize}, {axisVtxMix, axisMultMix}, true}; + + auto tracksTuple = std::make_tuple(tracks, tracks); + Pair pairs{binningOnVtxAndMult, cfgMixEventNumMin, -1, collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip + for (auto it = pairs.begin(); it != pairs.end(); it++) { + auto& [collision1, tracks1, collision2, tracks2] = *it; + if (!collision1.sel8() || !collision2.sel8()) + continue; + + if (cfgSelCollByNch && (tracks1.size() < cfgCutMultMin || tracks1.size() >= cfgCutMultMax)) + continue; + + if (cfgSelCollByNch && (tracks2.size() < cfgCutMultMin || tracks2.size() >= cfgCutMultMax)) + continue; + + float cent1 = -1; + float cent2 = -1; + if (!cfgCentTableUnavailable) { + cent1 = getCentrality(collision1); + cent2 = getCentrality(collision2); + } + if (cfgUseAdditionalEventCut && !eventSelected(collision1, tracks1.size(), cent1, false)) + continue; + if (cfgUseAdditionalEventCut && !eventSelected(collision2, tracks2.size(), cent2, false)) + continue; + + if (!cfgSelCollByNch && !cfgCentTableUnavailable && (cent1 < cfgCutCentMin || cent1 >= cfgCutCentMax)) + continue; + + if (!cfgSelCollByNch && !cfgCentTableUnavailable && (cent2 < cfgCutCentMin || cent2 >= cfgCutCentMax)) + continue; + + if (!(collision1.has_foundFT0() && collision2.has_foundFT0())) + continue; + + registry.fill(HIST("eventcount"), MixedEvent); // fill the mixed event in the 3 bin + auto bc = collision1.bc_as(); + loadAlignParam(bc.timestamp()); + loadCorrection(bc.timestamp()); + float eventWeight = 1.0f; + if (cfgUseEventWeights) { + eventWeight = 1.0f / it.currentWindowNeighbours(); + } + float weightCent = 1.0f; + if (!cfgCentTableUnavailable) + getCentralityWeight(weightCent, cent1); + const auto& ft0 = collision2.foundFT0(); + fillCorrelations(tracks1, ft0, collision1.posZ(), MixedEvent, cent1, eventWeight * weightCent); + } + } + + PROCESS_SWITCH(LongRangeDihadronCor, processMixed, "Process mixed events", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc), + }; +} From b56a61dd36f18a97b59aa96a9a9a2d0fae65f00b Mon Sep 17 00:00:00 2001 From: Victor Gonzalez Date: Sat, 13 Sep 2025 17:59:21 +0200 Subject: [PATCH 384/986] [PWGCF] Cleaning repo an adhering `linter` recomendations (#12974) Co-authored-by: Victor --- .../DataModel/IdentifiedBfFiltered.h | 115 - .../TableProducer/CMakeLists.txt | 13 +- .../TableProducer/identifiedBfFilter.cxx | 2296 ----------------- .../TableProducer/identifiedBfFilter.h | 775 ------ .../Tasks/CMakeLists.txt | 12 +- .../Tasks/identifiedbf.cxx | 1507 ----------- .../Tasks/identifiedbfqa.cxx | 152 -- 7 files changed, 5 insertions(+), 4865 deletions(-) delete mode 100644 PWGCF/TwoParticleCorrelations/DataModel/IdentifiedBfFiltered.h delete mode 100644 PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.cxx delete mode 100644 PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.h delete mode 100644 PWGCF/TwoParticleCorrelations/Tasks/identifiedbf.cxx delete mode 100644 PWGCF/TwoParticleCorrelations/Tasks/identifiedbfqa.cxx diff --git a/PWGCF/TwoParticleCorrelations/DataModel/IdentifiedBfFiltered.h b/PWGCF/TwoParticleCorrelations/DataModel/IdentifiedBfFiltered.h deleted file mode 100644 index 96a5721d35c..00000000000 --- a/PWGCF/TwoParticleCorrelations/DataModel/IdentifiedBfFiltered.h +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -#ifndef PWGCF_TWOPARTICLECORRELATIONS_DATAMODEL_IDENTIFIEDBFFILTERED_H_ -#define PWGCF_TWOPARTICLECORRELATIONS_DATAMODEL_IDENTIFIEDBFFILTERED_H_ - -#include "Framework/ASoA.h" -#include "Framework/AnalysisDataModel.h" - -namespace o2 -{ -namespace aod -{ -/* we have to change from int to bool when bool columns work properly */ -namespace identifiedbffilter -{ -DECLARE_SOA_COLUMN(IdentifiedBfCFCollisionAccepted, collisionaccepted, uint8_t); //! If the collision/event has been accepted or not -DECLARE_SOA_COLUMN(IdentifiedBfCFCollisionCentMult, centmult, float); //! The centrality/multiplicity pecentile -DECLARE_SOA_DYNAMIC_COLUMN(IsCollisionAccepted, //! Is the collision/event accepted - iscollisionaccepted, - [](uint8_t _collisionaccepted) -> uint8_t { return _collisionaccepted; }); -DECLARE_SOA_DYNAMIC_COLUMN(IsGenCollisionAccepted, //! Is the generated collision/event accepted - isgencollisionaccepted, - [](uint8_t _collisionaccepted) -> uint8_t { return _collisionaccepted; }); -} // namespace identifiedbffilter -DECLARE_SOA_TABLE(IdentifiedBfCFAcceptedCollisions, - "AOD", - "IBFCFACCCOLL", //! Accepted reconstructed collisions/events filtered table - o2::soa::Index<>, - collision::BCId, - collision::PosZ, - identifiedbffilter::IdentifiedBfCFCollisionAccepted, - identifiedbffilter::IdentifiedBfCFCollisionCentMult, - identifiedbffilter::IsCollisionAccepted); -using IdentifiedBfCFAcceptedCollision = IdentifiedBfCFAcceptedCollisions::iterator; -DECLARE_SOA_TABLE(IdentifiedBfCFAcceptedTrueCollisions, - "AOD", - "IBFCFACCGENCOLL", //! Accepted generated collisions/events filtered table - o2::soa::Index<>, - collision::BCId, - mccollision::PosZ, - identifiedbffilter::IdentifiedBfCFCollisionAccepted, - identifiedbffilter::IdentifiedBfCFCollisionCentMult, - identifiedbffilter::IsGenCollisionAccepted); -using IdentifiedBfCFAcceptedTrueCollision = IdentifiedBfCFAcceptedTrueCollisions::iterator; -DECLARE_SOA_TABLE( - IdentifiedBfCFCollisionsInfo, - "AOD", - "IBFCFCOLLINF", //! Accepted reconstructed collisions/events Collisions joinable table - identifiedbffilter::IdentifiedBfCFCollisionAccepted, - identifiedbffilter::IdentifiedBfCFCollisionCentMult, - identifiedbffilter::IsCollisionAccepted); -DECLARE_SOA_TABLE( - IdentifiedBfCFGenCollisionsInfo, - "AOD", - "IBFGENCFCOLLINF", //! Accepted generated collisions/events mcCollisions joinable table - identifiedbffilter::IdentifiedBfCFCollisionAccepted, - identifiedbffilter::IdentifiedBfCFCollisionCentMult, - identifiedbffilter::IsGenCollisionAccepted); -namespace identifiedbffilter -{ -DECLARE_SOA_INDEX_COLUMN(IdentifiedBfCFAcceptedCollision, event); //! Reconstructed collision/event -DECLARE_SOA_INDEX_COLUMN(IdentifiedBfCFAcceptedTrueCollision, mcevent); //! Generated collision/event -DECLARE_SOA_COLUMN(TrackacceptedId, - trackacceptedid, - int8_t); //! Id of accepted track, criteria: even (+) odd (-) -DECLARE_SOA_COLUMN(Pt, pt, float); //! The track transverse momentum -DECLARE_SOA_COLUMN(Eta, eta, float); //! The track pseudorapidity -DECLARE_SOA_COLUMN(Phi, phi, float); //! The track azimuthal angle -DECLARE_SOA_DYNAMIC_COLUMN(Sign, - sign, //! Charge: positive: 1, negative: -1 - [](int8_t trackacceptedid) -> int8_t { - return (trackacceptedid % 2 == 0 - ? 1 - : (trackacceptedid % 2 == 1 ? -1 : 0)); - }); -DECLARE_SOA_DYNAMIC_COLUMN(TrkID, - trkid, //! The track id - [](int8_t trackacceptedid) -> int8_t { return trackacceptedid; }); -DECLARE_SOA_DYNAMIC_COLUMN(PartID, - partid, //! The generated particle id - [](int8_t trackacceptedid) -> int8_t { return trackacceptedid; }); -} // namespace identifiedbffilter -DECLARE_SOA_TABLE(ScannedTracks, "AOD", "SCANNEDTRACKS", //! The reconstructed tracks filtered table - identifiedbffilter::IdentifiedBfCFAcceptedCollisionId, - identifiedbffilter::TrackacceptedId, - identifiedbffilter::Pt, - identifiedbffilter::Eta, - identifiedbffilter::Phi, - identifiedbffilter::Sign); -DECLARE_SOA_TABLE(ScannedTrueTracks, "AOD", "SCANTRUETRACKS", //! The generated particles filtered table - identifiedbffilter::IdentifiedBfCFAcceptedTrueCollisionId, - identifiedbffilter::TrackacceptedId, - identifiedbffilter::Pt, - identifiedbffilter::Eta, - identifiedbffilter::Phi, - identifiedbffilter::Sign); -DECLARE_SOA_TABLE(IdentifiedBfCFTracksInfo, "AOD", "SCANDTRCKINF", //! The additional information Tracks joinable table - identifiedbffilter::TrackacceptedId, - identifiedbffilter::TrkID); -DECLARE_SOA_TABLE(IdentifiedBfCFGenTracksInfo, "AOD", "SCANDGENTRCKINF", //! The additional information mcParticle joinable table - identifiedbffilter::TrackacceptedId, - identifiedbffilter::Sign, - identifiedbffilter::PartID); -} // namespace aod -} // namespace o2 - -#endif // PWGCF_TWOPARTICLECORRELATIONS_DATAMODEL_IDENTIFIEDBFFILTERED_H_ diff --git a/PWGCF/TwoParticleCorrelations/TableProducer/CMakeLists.txt b/PWGCF/TwoParticleCorrelations/TableProducer/CMakeLists.txt index 4bc1d428324..c7820c37871 100644 --- a/PWGCF/TwoParticleCorrelations/TableProducer/CMakeLists.txt +++ b/PWGCF/TwoParticleCorrelations/TableProducer/CMakeLists.txt @@ -9,27 +9,22 @@ # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. -o2physics_add_dpl_workflow(twopartcorr-register-skim +o2physics_add_dpl_workflow(two-particle-correlations-register-skimming SOURCES twoParticleCorrelationsRegisterSkimming.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::TwoPartCorrCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(twopartcorr-skim +o2physics_add_dpl_workflow(two-particle-correlations-full-skimming SOURCES twoParticleCorrelationsFullSkimming.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::TwoPartCorrCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(twopartcorr-notstored-skim +o2physics_add_dpl_workflow(two-particle-correlations-not-stored-skimming SOURCES twoParticleCorrelationsNotStoredSkimming.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::TwoPartCorrCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(twopartcorr-filter +o2physics_add_dpl_workflow(two-particle-correlations-filtering SOURCES twoParticleCorrelationsFiltering.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::TwoPartCorrCore COMPONENT_NAME Analysis) - -o2physics_add_dpl_workflow(identifiedbf-filter - SOURCES identifiedBfFilter.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore - COMPONENT_NAME Analysis) diff --git a/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.cxx b/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.cxx deleted file mode 100644 index 535dd77cce2..00000000000 --- a/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.cxx +++ /dev/null @@ -1,2296 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file identifiedBfFilter.cxx -/// \brief Filters collisions and tracks according to selection criteria -/// \author bghanley1995@gmail.com - -#include "PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.h" - -#include -#include -#include -#include - -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Centrality.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/TrackSelectionDefaults.h" -#include "Common/DataModel/PIDResponse.h" -#include "PWGCF/Core/AnalysisConfigurableCuts.h" -#include "PWGCF/TwoParticleCorrelations/DataModel/IdentifiedBfFiltered.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/CollisionAssociationTables.h" -#include "Framework/runDataProcessing.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace o2; -using namespace o2::framework; -using namespace o2::soa; -using namespace o2::framework::expressions; -using namespace o2::analysis; - -#define IDENTIFIEDBFFILTERLOGCOLLISIONS debug -#define IDENTIFIEDBFFILTERLOGTRACKS debug - -namespace o2::analysis::identifiedbffilter -{ -using IdBfFullTracks = soa::Join; -using IdBfFullTracksAmbiguous = soa::Join; -using IdBfTracksPID = soa::Join; -using IdBfTracksTOF = soa::Join; -using IdBfTracksFullPID = soa::Join; -using IdBfFullTracksPID = soa::Join; -using IdBfFullTracksFullPID = soa::Join; -using IdBfFullTracksPIDAmbiguous = soa::Join; -using IdBfFullTracksFullPIDAmbiguous = soa::Join; -using IdBfFullTracksDetLevel = soa::Join; -using IdBfFullTracksDetLevelAmbiguous = soa::Join; -using IdBfFullTracksPIDDetLevel = soa::Join; -using IdBfFullTracksFullPIDDetLevel = soa::Join; -using IdBfFullTracksPIDDetLevelAmbiguous = soa::Join; -using IdBfFullTracksFullPIDDetLevelAmbiguous = soa::Join; - -bool fullDerivedData = false; /* produce full derived data for its external storage */ - -TList* ccdblst = nullptr; -bool loadfromccdb = false; - -std::vector recoIdMethods = {0, 1, 2}; // Reconstructed PID Methods, 0 is no PID, 1 is calculated PID, 2 is MC PID -std::vector trackTypes = {0, 1, 2, 3}; -const int twoDenom = 2; // Used to test if a value is even or odd - -//============================================================================================ -// The IdentifiedBfFilter histogram objects -// TODO: consider registering in the histogram registry -//============================================================================================ -TH1F* fhCentMultB = nullptr; -TH1F* fhCentMultA = nullptr; -TH1F* fhVertexZB = nullptr; -TH1F* fhVertexZA = nullptr; -TH1F* fhMultB = nullptr; -TH1F* fhMultA = nullptr; -TH2F* fhYZB = nullptr; -TH2F* fhXYB = nullptr; -TH2F* fhYZA = nullptr; -TH2F* fhXYA = nullptr; -TH1F* fhPB = nullptr; -TH1F* fhPA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhPtB = nullptr; -TH1F* fhPtA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhPtPosB = nullptr; -TH1F* fhPtPosA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhPtNegB = nullptr; -TH1F* fhPtNegA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhNPosNegA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhDeltaNA[kIdBfNoOfSpecies + 1] = {nullptr}; - -TH2F* fhPtEtaPosA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhPtEtaNegA[kIdBfNoOfSpecies + 1] = {nullptr}; - -TH1I* fhNClustersB = nullptr; -TH2F* fhPhiYB = nullptr; -TH2F* fhPtYB = nullptr; -TH1F* fhChi2B = nullptr; -TH1I* fhITSNclB = nullptr; - -TH1I* fhNClustersA = nullptr; -TH2F* fhPhiYA = nullptr; -TH2F* fhPtYA = nullptr; -TH1F* fhChi2A = nullptr; -TH1I* fhITSNclA = nullptr; - -TH2F* fhNSigmaTPC[kIdBfNoOfSpecies] = {nullptr}; -TH2F* fhNSigmaTOF[kIdBfNoOfSpecies] = {nullptr}; -TH2F* fhNSigmaCombo[kIdBfNoOfSpecies] = {nullptr}; -TH2F* fhNSigmaTPCIdTrks[kIdBfNoOfSpecies] = {nullptr}; - -TH1F* fhNSigmaCorrection[kIdBfNoOfSpecies] = {nullptr}; - -TH1F* fhEtaB = nullptr; -TH1F* fhEtaA = nullptr; - -TH1F* fhPhiB = nullptr; -TH1F* fhPhiA = nullptr; - -TH1F* fhTrackLengthB = nullptr; -TH1F* fhTrackLengthTOFB = nullptr; -TH2F* fhTrackTimeB = nullptr; -TH2F* fhTrackBetaInvB = nullptr; -TH2F* fhTrackTimeIPB = nullptr; -TH2F* fhTrackBetaInvIPB = nullptr; -TH2F* fhdEdxB = nullptr; -TH2F* fhdEdxIPTPCB = nullptr; -TH1F* fhTrackLengthA[kIdBfNoOfSpecies + 2] = {nullptr}; -TH1F* fhTrackLengthTOFA[kIdBfNoOfSpecies + 2] = {nullptr}; -TH2F* fhdEdxA[kIdBfNoOfSpecies + 2] = {nullptr}; -TH2F* fhdEdxIPTPCA[kIdBfNoOfSpecies + 2] = {nullptr}; -TH2F* fhTrackTimeA[kIdBfNoOfSpecies + 2] = {nullptr}; -TH2F* fhTrackBetaInvA[kIdBfNoOfSpecies + 2] = {nullptr}; -TH2F* fhTrackTimeIPA[kIdBfNoOfSpecies + 2] = {nullptr}; -TH2F* fhTrackBetaInvIPA[kIdBfNoOfSpecies + 2] = {nullptr}; - -TH1F* fhMassB = nullptr; -TH1F* fhMassA[kIdBfNoOfSpecies + 1] = {nullptr}; - -TH2S* fhDoublePID = nullptr; - -TH1F* fhDCAxyB = nullptr; -TH1F* fhDCAxyA = nullptr; -TH1F* fhFineDCAxyA = nullptr; -TH1F* fhDCAzB = nullptr; -TH2F* fhDCAxyzB = nullptr; -TH1F* fhDCAzA = nullptr; -TH1F* fhFineDCAzA = nullptr; -TH2F* fhDCAxyzA = nullptr; - -TH1F* fhWrongTrackID = nullptr; - -TH2D* fhAmbiguousTrackType = nullptr; -TH2F* fhAmbiguousTrackPt = nullptr; -TH2F* fhAmbiguityDegree = nullptr; -TH2F* fhCompatibleCollisionsZVtxRms = nullptr; - -TH2S* fhTruePIDMismatch = nullptr; -TH1S* fhTruePIDCorrect = nullptr; - -std::vector> fhTrueNSigmaTPC = {o2::analysis::identifiedbffilter::kIdBfNoOfSpecies, {o2::analysis::identifiedbffilter::kIdBfNoOfSpecies, nullptr}}; -std::vector> fhTrueNSigmaTOF = {o2::analysis::identifiedbffilter::kIdBfNoOfSpecies, {o2::analysis::identifiedbffilter::kIdBfNoOfSpecies, nullptr}}; - -std::vector> fhPrimaryNSigmaTPC = {o2::analysis::identifiedbffilter::kIdBfNoOfSpecies, {o2::analysis::identifiedbffilter::kIdBfNoOfSpecies, nullptr}}; -std::vector> fhPrimaryNSigmaTOF = {o2::analysis::identifiedbffilter::kIdBfNoOfSpecies, {o2::analysis::identifiedbffilter::kIdBfNoOfSpecies, nullptr}}; - -TH1F* fhTrueCentMultB = nullptr; -TH1F* fhTrueCentMultA = nullptr; -TH1F* fhTrueVertexZB = nullptr; -TH1F* fhTrueVertexZA = nullptr; -TH1F* fhTrueVertexZAA = nullptr; -TH1F* fhTruePB = nullptr; -TH1F* fhTrueCharge = nullptr; -TH1F* fhTruePA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhTruePtB = nullptr; -TH1F* fhTruePtA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhTruePtPosB = nullptr; -TH1F* fhTruePtPosA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhTruePtNegB = nullptr; -TH1F* fhTruePtNegA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhTrueNPosNegA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhTrueDeltaNA[kIdBfNoOfSpecies + 1] = {nullptr}; - -TH2F* fhTruedEdxA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhTruedEdxIPTPCA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhTrueTrackLengthA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhTrueTrackLengthTOFA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhTrueTrackTimeA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhTrueTrackBetaInvA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhTrueTrackTimeIPA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhTrueTrackBetaInvIPA[kIdBfNoOfSpecies + 1] = {nullptr}; - -TH1F* fhPrimaryPA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhPrimaryPtA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhPrimarydEdxA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhPrimarydEdxIPTPCA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhPrimaryTrackLengthA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhPrimaryTrackLengthTOFA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhPrimaryTrackTimeA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhPrimaryTrackBetaInvA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhPrimaryTrackTimeIPA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhPrimaryTrackBetaInvIPA[kIdBfNoOfSpecies + 1] = {nullptr}; - -TH1F* fhPurePA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhPurePtA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhPuredEdxA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhPuredEdxIPTPCA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhPureTrackLengthA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhPureTrackLengthTOFA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhPureTrackTimeA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhPureTrackBetaInvA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhPureTrackTimeIPA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhPureTrackBetaInvIPA[kIdBfNoOfSpecies + 1] = {nullptr}; - -TH2F* fhTruePtEtaPosA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhTruePtEtaNegA[kIdBfNoOfSpecies + 1] = {nullptr}; - -TH2F* fhTruePhiYB = nullptr; -TH2F* fhTruePtYB = nullptr; - -TH2F* fhTruePhiYA = nullptr; -TH2F* fhTruePtYA = nullptr; - -TH1F* fhTrueEtaB = nullptr; -TH1F* fhTrueEtaA = nullptr; - -TH1F* fhTruePhiB = nullptr; -TH1F* fhTruePhiA = nullptr; - -TH1F* fhTrueDCAxyB = nullptr; -TH1F* fhTrueDCAxyA = nullptr; -TH1F* fhTrueDCAzB = nullptr; -TH1F* fhTrueDCAxyBid = nullptr; -TH1F* fhTrueDCAzA = nullptr; -TH2F* fhTrueDCAxyzB = nullptr; -TH2F* fhTrueDCAxyzA = nullptr; - -TH1F* fhPrimaryPB = nullptr; -TH1F* fhPrimaryPtB = nullptr; -TH2F* fhPrimarydEdxB = nullptr; -TH2F* fhPrimarydEdxIPTPCB = nullptr; -TH1F* fhPrimaryTrackLengthB = nullptr; -TH1F* fhPrimaryTrackLengthTOFB = nullptr; -TH2F* fhPrimaryTrackTimeB = nullptr; -TH2F* fhPrimaryTrackBetaInvB = nullptr; -TH2F* fhPrimaryTrackTimeIPB = nullptr; -TH2F* fhPrimaryTrackBetaInvIPB = nullptr; - -//============================================================================================ -// The IdentifiedBfFilter multiplicity counters -//============================================================================================ -int trkMultPos[kIdBfNoOfSpecies + 1]; // multiplicity of positive tracks -int trkMultNeg[kIdBfNoOfSpecies + 1]; // multiplicity of negative tracks -int partMultPos[kIdBfNoOfSpecies + 1]; // multiplicity of positive particles -int partMultNeg[kIdBfNoOfSpecies + 1]; // multiplicity of negative particles -} // namespace o2::analysis::identifiedbffilter - -using namespace identifiedbffilter; - -struct IdentifiedBfFilter { - Configurable cfgFullDerivedData{"cfgFullDerivedData", false, "Produce the full derived data for external storage. Default false"}; - Configurable cfgCentMultEstimator{"cfgCentMultEstimator", "V0M", "Centrality/multiplicity estimator detector: V0M,CL0,CL1,FV0A,FT0M,FT0A,FT0C,NTPV,NOCM: none. Default V0M"}; - Configurable cfgSystem{"cfgSystem", "PbPb", "System: pp, PbPb, Pbp, pPb, XeXe, ppRun3, PbPbRun3. Default PbPb"}; - Configurable cfgDataType{"cfgDataType", "data", "Data type: data, datanoevsel, MC, FastMC, OnTheFlyMC. Default data"}; - Configurable cfgTriggSel{"cfgTriggSel", "MB", "Trigger selection: MB, None. Default MB"}; - Configurable cfgBinning{"cfgBinning", - {28, -7.0, 7.0, 18, 0.2, 2.0, 16, -0.8, 0.8, 72, 0.5}, - "triplets - nbins, min, max - for z_vtx, pT, eta and phi, binning plus bin fraction of phi origin shift"}; - Configurable cfgTraceCollId0{"cfgTraceCollId0", false, "Trace particles in collisions id 0. Default false"}; - - OutputObj fOutput{"IdentifiedBfFilterCollisionsInfo", OutputObjHandlingPolicy::AnalysisObject}; - - Produces acceptedcollisions; - Produces collisionsinfo; - Produces acceptedtrueevents; - Produces gencollisionsinfo; - - void init(InitContext const&) - { - using namespace identifiedbffilter; - - LOGF(info, "IdentifiedBfFilterTask::init()"); - - fullDerivedData = cfgFullDerivedData; - - /* update with the configurable values */ - /* the binning */ - ptbins = cfgBinning->mPTbins; - ptlow = cfgBinning->mPTmin; - ptup = cfgBinning->mPTmax; - etabins = cfgBinning->mEtabins; - etalow = cfgBinning->mEtamin; - etaup = cfgBinning->mEtamax; - zvtxbins = cfgBinning->mZVtxbins; - zvtxlow = cfgBinning->mZVtxmin; - zvtxup = cfgBinning->mZVtxmax; - /* the track types and combinations */ - /* the centrality/multiplicity estimation */ - fCentMultEstimator = getCentMultEstimator(cfgCentMultEstimator); - /* the trigger selection */ - fTriggerSelection = getTriggerSelection(cfgTriggSel); - traceCollId0 = cfgTraceCollId0; - - /* if the system type is not known at this time, we have to put the initialization somewhere else */ - fSystem = getSystemType(cfgSystem); - fDataType = getDataType(cfgDataType); - - /* create the output list which will own the task histograms */ - TList* fOutputList = new TList(); - fOutputList->SetOwner(true); - fOutput.setObject(fOutputList); - - if ((fDataType == kData) || (fDataType == kDataNoEvtSel) || (fDataType == kMC)) { - /* create the reconstructed data histograms */ - /* TODO: proper axes and axes titles according to the system; still incomplete */ - std::string multestimator = getCentMultEstimatorName(fCentMultEstimator); - if (fSystem > kPbp) { - fhCentMultB = new TH1F("CentralityB", "Centrality before cut; centrality (%)", 100, 0, 100); - fhCentMultA = new TH1F("CentralityA", "Centrality; centrality (%)", 100, 0, 100); - fhMultB = new TH1F("MultB", TString::Format("%s Multiplicity before cut;%s Multiplicity;Collisions", multestimator.c_str(), multestimator.c_str()), 4001, -0.5, 4000.5); - fhMultA = new TH1F("MultA", TString::Format("%s Multiplicity;%s Multiplicity;Collisions", multestimator.c_str(), multestimator.c_str()), 4001, -0.5, 4000.5); - } else { - /* for pp, pPb and Pbp systems use multiplicity instead */ - fhCentMultB = new TH1F("MultiplicityB", "Multiplicity before cut; multiplicity (%)", 100, 0, 100); - fhCentMultA = new TH1F("MultiplicityA", "Multiplicity; multiplicity (%)", 100, 0, 100); - fhMultB = new TH1F("MultB", TString::Format("%s Multiplicity before cut;%s Multiplicity;Collisions", multestimator.c_str(), multestimator.c_str()), 601, -0.5, 600.5); - fhMultA = new TH1F("MultA", TString::Format("%s Multiplicity;%s Multiplicity;Collisions", multestimator.c_str(), multestimator.c_str()), 601, -0.5, 600.5); - } - - fhVertexZB = new TH1F("VertexZB", "Vertex Z; z_{vtx}", 60, -15, 15); - fhVertexZA = new TH1F("VertexZA", "Vertex Z; z_{vtx}", zvtxbins, zvtxlow, zvtxup); - - /* add the hstograms to the output list */ - fOutputList->Add(fhCentMultB); - fOutputList->Add(fhCentMultA); - fOutputList->Add(fhMultB); - fOutputList->Add(fhMultA); - fOutputList->Add(fhVertexZB); - fOutputList->Add(fhVertexZA); - } - - if ((fDataType != kData) && (fDataType != kDataNoEvtSel)) { - /* create the true data histograms */ - /* TODO: proper axes and axes titles according to the system; still incomplete */ - if (fSystem > kPbp) { - fhTrueCentMultB = new TH1F("TrueCentralityB", "Centrality before (truth); centrality (%)", 100, 0, 100); - fhTrueCentMultA = new TH1F("TrueCentralityA", "Centrality (truth); centrality (%)", 100, 0, 100); - } else { - /* for pp, pPb and Pbp systems use multiplicity instead */ - fhTrueCentMultB = new TH1F("TrueMultiplicityB", "Multiplicity before (truth); multiplicity (%)", 100, 0, 100); - fhTrueCentMultA = new TH1F("TrueMultiplicityA", "Multiplicity (truth); multiplicity (%)", 100, 0, 100); - } - - fhTrueVertexZB = new TH1F("TrueVertexZB", "Vertex Z before (truth); z_{vtx}", 60, -15, 15); - fhTrueVertexZA = new TH1F("TrueVertexZA", "Vertex Z (truth); z_{vtx}", zvtxbins, zvtxlow, zvtxup); - fhTrueVertexZAA = new TH1F("TrueVertexZAA", "Vertex Z (truth rec associated); z_{vtx}", zvtxbins, zvtxlow, zvtxup); - - /* add the hstograms to the output list */ - fOutputList->Add(fhTrueCentMultB); - fOutputList->Add(fhTrueCentMultA); - fOutputList->Add(fhTrueVertexZB); - fOutputList->Add(fhTrueVertexZA); - fOutputList->Add(fhTrueVertexZAA); - } - } - - template - void processReconstructed(CollisionObject const& collision, TracksObject const& ftracks, float centormult); - - void processWithCent(aod::CollisionEvSelCent const& collision, IdBfFullTracks const& ftracks); - PROCESS_SWITCH(IdentifiedBfFilter, processWithCent, "Process reco with centrality", false); - - void processWithRun2Cent(aod::CollisionEvSelRun2Cent const& collision, IdBfFullTracks const& ftracks); - PROCESS_SWITCH(IdentifiedBfFilter, processWithRun2Cent, "Process reco with Run !/2 centrality", false); - - void processWithoutCent(aod::CollisionEvSel const& collision, IdBfFullTracks const& ftracks); - PROCESS_SWITCH(IdentifiedBfFilter, processWithoutCent, "Process reco without centrality", false); - - void processWithCentPID(aod::CollisionEvSelCent const& collision, IdBfFullTracksPID const& ftracks); - PROCESS_SWITCH(IdentifiedBfFilter, processWithCentPID, "Process PID reco with centrality", false); - - void processWithRun2CentPID(aod::CollisionEvSelRun2Cent const& collision, IdBfFullTracksPID const& ftracks); - PROCESS_SWITCH(IdentifiedBfFilter, processWithRun2CentPID, "Process PID reco with centrality", false); - - void processWithoutCentPID(aod::CollisionEvSel const& collision, IdBfFullTracksPID const& ftracks); - PROCESS_SWITCH(IdentifiedBfFilter, processWithoutCentPID, "Process PID reco without centrality", false); - - void processWithCentFullPID(aod::CollisionEvSelCent const& collision, IdBfFullTracksFullPID const& ftracks); - PROCESS_SWITCH(IdentifiedBfFilter, processWithCentFullPID, "Process Full PID reco with centrality", false); - - void processWithRun2CentFullPID(aod::CollisionEvSelRun2Cent const& collision, IdBfFullTracksFullPID const& ftracks); - PROCESS_SWITCH(IdentifiedBfFilter, processWithRun2CentFullPID, "Process Full PID reco with centrality", false); - - void processWithoutCentFullPID(aod::CollisionEvSel const& collision, IdBfFullTracksFullPID const& ftracks); - PROCESS_SWITCH(IdentifiedBfFilter, processWithoutCentFullPID, "Process Full PID reco without centrality", false); - - void processWithCentDetectorLevel(aod::CollisionEvSelCent const& collision, IdBfFullTracksDetLevel const& ftracks, aod::McParticles const&); - PROCESS_SWITCH(IdentifiedBfFilter, processWithCentDetectorLevel, "Process MC detector level with centrality", false); - - void processWithRun2CentDetectorLevel(aod::CollisionEvSelRun2Cent const& collision, IdBfFullTracksDetLevel const& ftracks, aod::McParticles const&); - PROCESS_SWITCH(IdentifiedBfFilter, processWithRun2CentDetectorLevel, "Process MC detector level with centrality", false); - - void processWithoutCentDetectorLevel(aod::CollisionEvSel const& collision, IdBfFullTracksDetLevel const& ftracks, aod::McParticles const&); - PROCESS_SWITCH(IdentifiedBfFilter, processWithoutCentDetectorLevel, "Process MC detector level without centrality", false); - - void processWithCentPIDDetectorLevel(aod::CollisionEvSelCent const& collision, IdBfFullTracksPIDDetLevel const& ftracks, aod::McParticles const&); - PROCESS_SWITCH(IdentifiedBfFilter, processWithCentPIDDetectorLevel, "Process PID MC detector level with centrality", false); - - void processWithRun2CentPIDDetectorLevel(aod::CollisionEvSelRun2Cent const& collision, IdBfFullTracksPIDDetLevel const& ftracks, aod::McParticles const&); - PROCESS_SWITCH(IdentifiedBfFilter, processWithRun2CentPIDDetectorLevel, "Process PID MC detector level with centrality", false); - - void processWithoutCentPIDDetectorLevel(aod::CollisionEvSel const& collision, IdBfFullTracksPIDDetLevel const& ftracks, aod::McParticles const&); - PROCESS_SWITCH(IdentifiedBfFilter, processWithoutCentPIDDetectorLevel, "Process PID MC detector level without centrality", false); - - void processWithCentFullPIDDetectorLevel(aod::CollisionEvSelCent const& collision, IdBfFullTracksFullPIDDetLevel const& ftracks, aod::McParticles const&); - PROCESS_SWITCH(IdentifiedBfFilter, processWithCentFullPIDDetectorLevel, "Process Full PID MC detector level with centrality", false); - - void processWithRun2CentFullPIDDetectorLevel(aod::CollisionEvSelRun2Cent const& collision, IdBfFullTracksFullPIDDetLevel const& ftracks, aod::McParticles const&); - PROCESS_SWITCH(IdentifiedBfFilter, processWithRun2CentFullPIDDetectorLevel, "Process Full PID MC detector level with centrality", false); - - void processWithoutCentFullPIDDetectorLevel(aod::CollisionEvSel const& collision, IdBfFullTracksFullPIDDetLevel const& ftracks, aod::McParticles const&); - PROCESS_SWITCH(IdentifiedBfFilter, processWithoutCentFullPIDDetectorLevel, "Process Full PID MC detector level without centrality", false); - - template - void processGenerated(CollisionObject const& mccollision, ParticlesList const& mcparticles, float centormult); - - template - void processGeneratorLevel(aod::McCollision const& mccollision, - CollisionsGroup const& collisions, - aod::McParticles const& mcparticles, - AllCollisions const& allcollisions, - float defaultcent); - - void processWithCentGeneratorLevel(aod::McCollision const& mccollision, - soa::SmallGroups> const& collisions, - aod::McParticles const& mcparticles, - aod::CollisionsEvSelCent const& allcollisions); - PROCESS_SWITCH(IdentifiedBfFilter, processWithCentGeneratorLevel, "Process generated with centrality", false); - - void processWithRun2CentGeneratorLevel(aod::McCollision const& mccollision, - soa::SmallGroups> const& collisions, - aod::McParticles const& mcparticles, - aod::CollisionsEvSelRun2Cent const& allcollisions); - PROCESS_SWITCH(IdentifiedBfFilter, processWithRun2CentGeneratorLevel, "Process generated with centrality", false); - - void processWithoutCentGeneratorLevel(aod::McCollision const& mccollision, - soa::SmallGroups> const& collisions, - aod::McParticles const& mcparticles, - aod::CollisionsEvSel const& allcollisions); - PROCESS_SWITCH(IdentifiedBfFilter, processWithoutCentGeneratorLevel, "Process generated without centrality", false); - - void processVertexGenerated(aod::McCollisions const&); - PROCESS_SWITCH(IdentifiedBfFilter, processVertexGenerated, "Process vertex generator level", false); -}; - -template -void IdentifiedBfFilter::processReconstructed(CollisionObject const& collision, TracksObject const& ftracks, float tentativecentmult) -{ - using namespace identifiedbffilter; - - LOGF(IDENTIFIEDBFFILTERLOGCOLLISIONS, "IdentifiedBfFilterTask::processReconstructed(). New collision with %d tracks", ftracks.size()); - - float mult = extractMultiplicity(collision, fCentMultEstimator); - - fhCentMultB->Fill(tentativecentmult); - fhMultB->Fill(mult); - fhVertexZB->Fill(collision.posZ()); - uint8_t acceptedevent = uint8_t(false); - float centormult = tentativecentmult; - if (isEvtSelected(collision, centormult)) { - acceptedevent = true; - fhCentMultA->Fill(centormult); - fhMultA->Fill(mult); - fhVertexZA->Fill(collision.posZ()); - if (fullDerivedData) { - acceptedcollisions(collision.bcId(), collision.posZ(), acceptedevent, centormult); - } else { - collisionsinfo(acceptedevent, centormult); - } - } else { - if (!fullDerivedData) { - /* the tracks are done at a different level */ - collisionsinfo(uint8_t(false), 105.0); - } - } -} - -void IdentifiedBfFilter::processWithCent(aod::CollisionEvSelCent const& collision, IdBfFullTracks const& ftracks) -{ - processReconstructed(collision, ftracks, getCentMultPercentile(collision)); -} - -void IdentifiedBfFilter::processWithRun2Cent(aod::CollisionEvSelRun2Cent const& collision, IdBfFullTracks const& ftracks) -{ - processReconstructed(collision, ftracks, getCentMultPercentile(collision)); -} - -void IdentifiedBfFilter::processWithoutCent(aod::CollisionEvSel const& collision, IdBfFullTracks const& ftracks) -{ - processReconstructed(collision, ftracks, 50.0); -} - -void IdentifiedBfFilter::processWithCentPID(aod::CollisionEvSelCent const& collision, IdBfFullTracksPID const& ftracks) -{ - processReconstructed(collision, ftracks, getCentMultPercentile(collision)); -} - -void IdentifiedBfFilter::processWithRun2CentPID(aod::CollisionEvSelRun2Cent const& collision, IdBfFullTracksPID const& ftracks) -{ - processReconstructed(collision, ftracks, getCentMultPercentile(collision)); -} - -void IdentifiedBfFilter::processWithoutCentPID(aod::CollisionEvSel const& collision, IdBfFullTracksPID const& ftracks) -{ - processReconstructed(collision, ftracks, 50.0); -} - -void IdentifiedBfFilter::processWithCentFullPID(aod::CollisionEvSelCent const& collision, IdBfFullTracksFullPID const& ftracks) -{ - processReconstructed(collision, ftracks, getCentMultPercentile(collision)); -} - -void IdentifiedBfFilter::processWithRun2CentFullPID(aod::CollisionEvSelRun2Cent const& collision, IdBfFullTracksFullPID const& ftracks) -{ - processReconstructed(collision, ftracks, getCentMultPercentile(collision)); -} - -void IdentifiedBfFilter::processWithoutCentFullPID(aod::CollisionEvSel const& collision, IdBfFullTracksFullPID const& ftracks) -{ - processReconstructed(collision, ftracks, 50.0); -} - -void IdentifiedBfFilter::processWithCentDetectorLevel(aod::CollisionEvSelCent const& collision, IdBfFullTracksDetLevel const& ftracks, aod::McParticles const&) -{ - processReconstructed(collision, ftracks, getCentMultPercentile(collision)); -} - -void IdentifiedBfFilter::processWithRun2CentDetectorLevel(aod::CollisionEvSelRun2Cent const& collision, IdBfFullTracksDetLevel const& ftracks, aod::McParticles const&) -{ - processReconstructed(collision, ftracks, getCentMultPercentile(collision)); -} - -void IdentifiedBfFilter::processWithoutCentDetectorLevel(aod::CollisionEvSel const& collision, IdBfFullTracksDetLevel const& ftracks, aod::McParticles const&) -{ - processReconstructed(collision, ftracks, 50.0); -} - -void IdentifiedBfFilter::processWithCentPIDDetectorLevel(aod::CollisionEvSelCent const& collision, IdBfFullTracksPIDDetLevel const& ftracks, aod::McParticles const&) -{ - processReconstructed(collision, ftracks, getCentMultPercentile(collision)); -} - -void IdentifiedBfFilter::processWithRun2CentPIDDetectorLevel(aod::CollisionEvSelRun2Cent const& collision, IdBfFullTracksPIDDetLevel const& ftracks, aod::McParticles const&) -{ - processReconstructed(collision, ftracks, getCentMultPercentile(collision)); -} - -void IdentifiedBfFilter::processWithoutCentPIDDetectorLevel(aod::CollisionEvSel const& collision, IdBfFullTracksPIDDetLevel const& ftracks, aod::McParticles const&) -{ - processReconstructed(collision, ftracks, 50.0); -} - -void IdentifiedBfFilter::processWithCentFullPIDDetectorLevel(aod::CollisionEvSelCent const& collision, IdBfFullTracksFullPIDDetLevel const& ftracks, aod::McParticles const&) -{ - processReconstructed(collision, ftracks, getCentMultPercentile(collision)); -} - -void IdentifiedBfFilter::processWithRun2CentFullPIDDetectorLevel(aod::CollisionEvSelRun2Cent const& collision, IdBfFullTracksFullPIDDetLevel const& ftracks, aod::McParticles const&) -{ - processReconstructed(collision, ftracks, getCentMultPercentile(collision)); -} - -void IdentifiedBfFilter::processWithoutCentFullPIDDetectorLevel(aod::CollisionEvSel const& collision, IdBfFullTracksFullPIDDetLevel const& ftracks, aod::McParticles const&) -{ - processReconstructed(collision, ftracks, 50.0); -} - -template -void IdentifiedBfFilter::processGenerated(CollisionObject const& mccollision, ParticlesList const&, float centormult) -{ - using namespace identifiedbffilter; - - uint8_t acceptedevent = uint8_t(false); - if (isEvtSelected(mccollision, centormult)) { - acceptedevent = uint8_t(true); - } - if (fullDerivedData) { - acceptedtrueevents(mccollision.bcId(), mccollision.posZ(), acceptedevent, centormult); - } else { - gencollisionsinfo(acceptedevent, centormult); - } -} - -template -void IdentifiedBfFilter::processGeneratorLevel(aod::McCollision const& mccollision, - CollisionsGroup const& collisions, - aod::McParticles const& mcparticles, - AllCollisions const& allcollisions, - float defaultcent) -{ - using namespace identifiedbffilter; - - LOGF(IDENTIFIEDBFFILTERLOGCOLLISIONS, "IdentifiedBfFilterTask::processGeneratorLevel(). New generated collision with %d reconstructed collisions and %d particles", collisions.size(), mcparticles.size()); - - if (collisions.size() > 1) { - LOGF(IDENTIFIEDBFFILTERLOGCOLLISIONS, "IdentifiedBfFilterTask::processGeneratorLevel(). Generated collision with more than one reconstructed collisions. Processing only the first accepted for centrality/multiplicity classes extraction"); - } - - bool processed = false; - for (const auto& tmpcollision : collisions) { - if (tmpcollision.has_mcCollision()) { - if (tmpcollision.mcCollisionId() == mccollision.globalIndex()) { - typename AllCollisions::iterator const& collision = allcollisions.iteratorAt(tmpcollision.globalIndex()); - if (isEvtSelected(collision, defaultcent)) { - fhTrueVertexZAA->Fill(mccollision.posZ()); - processGenerated(mccollision, mcparticles, defaultcent); - processed = true; - break; /* TODO: only processing the first reconstructed accepted collision */ - } - } - } - } - if (!processed && !fullDerivedData) { - gencollisionsinfo(uint8_t(false), 105.0); - } -} - -void IdentifiedBfFilter::processWithCentGeneratorLevel(aod::McCollision const& mccollision, - soa::SmallGroups> const& collisions, - aod::McParticles const& mcparticles, - aod::CollisionsEvSelCent const& allcollisions) -{ - processGeneratorLevel(mccollision, collisions, mcparticles, allcollisions, 50.0); -} - -void IdentifiedBfFilter::processWithRun2CentGeneratorLevel(aod::McCollision const& mccollision, - soa::SmallGroups> const& collisions, - aod::McParticles const& mcparticles, - aod::CollisionsEvSelRun2Cent const& allcollisions) -{ - processGeneratorLevel(mccollision, collisions, mcparticles, allcollisions, 50.0); -} - -void IdentifiedBfFilter::processWithoutCentGeneratorLevel(aod::McCollision const& mccollision, - soa::SmallGroups> const& collisions, - aod::McParticles const& mcparticles, - aod::CollisionsEvSel const& allcollisions) -{ - processGeneratorLevel(mccollision, collisions, mcparticles, allcollisions, 50.0); -} - -void IdentifiedBfFilter::processVertexGenerated(aod::McCollisions const& mccollisions) -{ - for (aod::McCollision const& mccollision : mccollisions) { - fhTrueVertexZB->Fill(mccollision.posZ()); - /* we assign a default value */ - float centmult = 50.0f; - if (isEvtSelected(mccollision, centmult)) { - fhTrueVertexZA->Fill((mccollision.posZ())); - } - } -} - -/// RMS calculation. Taken from PWGHF/Tasks/taskMcValidation.cxx -/// \param vec vector of values to compute RMS -template -T computeRMS(std::vector& vec) -{ - T sum = std::accumulate(vec.begin(), vec.end(), 0.0); - T mean = sum / vec.size(); - - std::vector diff(vec.size()); - std::transform(vec.begin(), vec.end(), diff.begin(), [mean](T x) { return x - mean; }); - T sqSum = std::inner_product(diff.begin(), diff.end(), diff.begin(), 0.0); - T stdev = std::sqrt(sqSum / vec.size()); - - return stdev; -} - -struct IdentifiedBfFilterTracks { - - struct : ConfigurableGroup { - Configurable inputCCDBUrl{"inputCCDBUrl", "http://ccdb-test.cern.ch:8080", "The CCDB url for the input file"}; - Configurable inputCCDBPathName{"inputCCDBPathName", "", "The CCDB path for the input file. Default \"\", i.e. don't load from CCDB"}; - Configurable inputCCDBDate{"inputCCDBDate", "20220307", "The CCDB date for the input file"}; - } cfgcentersinputfile; - Service ccdb; - - TList* getCCDBInput(const char* ccdbpath, const char* ccdbdate) - { - - std::tm cfgtm = {}; - std::stringstream ss(ccdbdate); - ss >> std::get_time(&cfgtm, "%Y%m%d"); - cfgtm.tm_hour = 12; - int64_t timestamp = std::mktime(&cfgtm) * 1000; - - TList* lst = ccdb->getForTimeStamp(ccdbpath, timestamp); - if (lst != nullptr) { - LOGF(info, "Correctly loaded CCDB input object"); - } else { - LOGF(error, "CCDB input object could not be loaded"); - } - return lst; - } - - Service fPDG; - Produces scannedtracks; - Produces tracksinfo; - Produces scannedgentracks; - Produces gentracksinfo; - - Configurable cfgFullDerivedData{"cfgFullDerivedData", false, "Produce the full derived data for external storage. Default false"}; - Configurable cfgTrackType{"cfgTrackType", 1, "Type of selected tracks: 0 = no selection, 1 = Run2 global tracks FB96, 3 = Run3 tracks, 5 = Run2 TPC only tracks, 7 = Run 3 TPC only tracks. Default 1"}; - Configurable cfgSystem{"cfgSystem", "PbPb", "System: pp, PbPb, Pbp, pPb, XeXe, ppRun3, PbPbRun3. Default PbPb"}; - Configurable cfgDataType{"cfgDataType", "data", "Data type: data, datanoevsel, MC, FastMC, OnTheFlyMC. Default data"}; - Configurable cfgBinning{"cfgBinning", - {28, -7.0, 7.0, 18, 0.2, 2.0, 16, -0.8, 0.8, 72, 0.5}, - "triplets - nbins, min, max - for z_vtx, pT, eta and phi, binning plus bin fraction of phi origin shift"}; - Configurable cfgTraceDCAOutliers{"cfgTraceDCAOutliers", {false, 0.0, 0.0}, "Track the generator level DCAxy outliers: false/true, low dcaxy, up dcaxy. Default {false,0.0,0.0}"}; - Configurable cfgTraceOutOfSpeciesParticles{"cfgTraceOutOfSpeciesParticles", false, "Track the particles which are not e,mu,pi,K,p: false/true. Default false"}; - Configurable cfgRecoIdMethod{"cfgRecoIdMethod", 0, "Method for identifying reconstructed tracks: 0 No PID, 1 PID, 2 mcparticle. Default 0"}; - Configurable cfgTrackSelection{"cfgTrackSelection", {false, false, 0, 70, 0.8, 2.4, 3.2}, "Track selection: {useit: true/false, ongen: true/false, tpccls, tpcxrws, tpcxrfc, dcaxy, dcaz}. Default {false,0.70.0.8,2.4,3.2}"}; - Configurable reqTOF{"reqTOF", false, "Require TOF data for PID. Default false"}; - Configurable onlyTOF{"onlyTOF", false, "Only use TOF data for PID. Default false"}; - - // Configurable pidEl{"pidEl", -1, "Identify Electron Tracks"}; - // Configurable pidPi{"pidPi", -1, "Identify Pion Tracks"}; - // Configurable pidKa{"pidKa", -1, "Identify Kaon Tracks"}; - // Configurable pidPr{"pidPr", -1, "Identify Proton Tracks"}; - - // Configurable minPIDSigma{"minPIDSigma", -3.0, "Minimum required sigma for PID Acceptance"}; - // Configurable maxPIDSigma{"maxPIDSigma", 3.0, "Maximum required sigma for PID Acceptance"}; - - // Configurable> minPIDSigmas{"minPIDSigmas", {-3.,-3.,-3.,-3.},"Minimum required sigma for PID Acceptance, {e, pi, K, p}"}; - // Configurable>> acceptPIDSigmas{"acceptPIDSigmas", {{-3.,3.},{-3.,3.},{-3.,3.},{-3.,3.}},"Sigma range for PID Acceptance, {e, pi, K, p}"}; - // Configurable> minRejectSigmas{"minRejectSigmas", {-1.,-1.,-1.,-1.},"Minimum required sigma for PID double match rejection, {e, pi, K, p}"}; - - // Configurable minRejectSigma{"minRejectSigma", -1.0, "Minimum required sigma for PID double match rejection"}; - // Configurable maxRejectSigma{"maxRejectSigma", 1.0, "Maximum required sigma for PID double match rejection"}; - - Configurable> cfgDoPID{"cfgDoPID", {-1, -1, -1, -1}, "Do PID for particle, {e, pi, K, p}"}; - Configurable> cfgTOFCut{"cfgTOFCut", {0.8, 0.8, 0.8, 0.8}, "Momentum under which we don't use TOF PID data, {e, pi, K, p}"}; - Configurable> cfgTPCCut{"cfgTPCCut", {1.2, 1.2, 1.2, 1.2}, "Momentum over which we don't use TPC PID data, {e, pi, K, p}"}; - - Configurable makeNSigmaPlots{"makeNSigmaPlots", false, "Produce the N Sigma Plots for external storage. Default false"}; - - struct : ConfigurableGroup { - Configurable> rejectPIDSigmasEl{"rejectPIDSigmasEl", {0., 1., 1., 1.}, "Required sigma for PID double match rejection of electrons for {e, pi, K, p}"}; - Configurable> rejectPIDSigmasPi{"rejectPIDSigmasPi", {1., 0., 1., 1.}, "Required sigma for PID double match rejection of pions for {e, pi, K, p}"}; - Configurable> rejectPIDSigmasKa{"rejectPIDSigmasKa", {1., 1., 0., 1.}, "Required sigma for PID double match rejection of kaons for {e, pi, K, p}"}; - Configurable> rejectPIDSigmasPr{"rejectPIDSigmasPr", {1., 1., 1., 0.}, "Required sigma for PID double match rejection of protons for {e, pi, K, p}"}; - } rejectPIDSigmas; - - struct : ConfigurableGroup { - Configurable> acceptPIDSigmasEl{"acceptPIDSigmasEl", {-3., 3.}, "Sigma range for PID Acceptance for electrons"}; - Configurable> acceptPIDSigmasPi{"acceptPIDSigmasPi", {-3., 3.}, "Sigma range for PID Acceptance for pions"}; - Configurable> acceptPIDSigmasKa{"acceptPIDSigmasKa", {-3., 3.}, "Sigma range for PID Acceptance for kaons"}; - Configurable> acceptPIDSigmasPr{"acceptPIDSigmasPr", {-3., 3.}, "Sigma range for PID Acceptance for protons"}; - } acceptPIDSigmas; - - OutputObj fOutput{"IdentifiedBfFilterTracksInfo", OutputObjHandlingPolicy::AnalysisObject}; - bool checkAmbiguousTracks = false; - - void init(InitContext&) - { - LOGF(info, "IdentifiedBfFilterTracks::init()"); - - // ccdb info - ccdb->setURL(cfgcentersinputfile.inputCCDBUrl); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - LOGF(info, "Initizalized CCDB"); - - loadfromccdb = cfgcentersinputfile.inputCCDBPathName->length() > 0; - - if (ccdblst == nullptr) { - if (loadfromccdb) { - LOGF(info, "Loading CCDB Objects"); - - ccdblst = getCCDBInput(cfgcentersinputfile.inputCCDBPathName->c_str(), cfgcentersinputfile.inputCCDBDate->c_str()); - for (int i = 0; i < kIdBfNoOfSpecies; i++) { - fhNSigmaCorrection[i] = reinterpret_cast(ccdblst->FindObject(Form("centerBin_%s", speciesName[i]))); - } - } - } - LOGF(info, "Loaded CCDB Objects"); - - fullDerivedData = cfgFullDerivedData; - - /* update with the configurable values */ - /* the binning */ - ptbins = cfgBinning->mPTbins; - ptlow = cfgBinning->mPTmin; - ptup = cfgBinning->mPTmax; - etabins = cfgBinning->mEtabins; - etalow = cfgBinning->mEtamin; - etaup = cfgBinning->mEtamax; - zvtxbins = cfgBinning->mZVtxbins; - zvtxlow = cfgBinning->mZVtxmin; - zvtxup = cfgBinning->mZVtxmax; - - LOGF(info, "Initializing ranges"); - acceptRange.push_back(acceptPIDSigmas.acceptPIDSigmasEl); - acceptRange.push_back(acceptPIDSigmas.acceptPIDSigmasPi); - acceptRange.push_back(acceptPIDSigmas.acceptPIDSigmasKa); - acceptRange.push_back(acceptPIDSigmas.acceptPIDSigmasPr); - - rejectRange.push_back(rejectPIDSigmas.rejectPIDSigmasEl); - rejectRange.push_back(rejectPIDSigmas.rejectPIDSigmasPi); - rejectRange.push_back(rejectPIDSigmas.rejectPIDSigmasKa); - rejectRange.push_back(rejectPIDSigmas.rejectPIDSigmasPr); - - doPID = cfgDoPID; - tofCut = cfgTOFCut; - tpcCut = cfgTPCCut; - /* the track types and combinations */ - tracktype = cfgTrackType.value; - initializeTrackSelection(); - traceDCAOutliers = cfgTraceDCAOutliers; - traceOutOfSpeciesParticles = cfgTraceOutOfSpeciesParticles; - recoIdMethod = cfgRecoIdMethod; - if (cfgTrackSelection->mUseIt) { - useOwnTrackSelection = true; - if (cfgTrackSelection->mOnGen) { - useOwnParticleSelection = true; - particleMaxDCAxy = cfgTrackSelection->mDCAxy; - particleMaxDCAZ = cfgTrackSelection->mDCAz; - } - ownTrackSelection.ResetITSRequirements(); - ownTrackSelection.SetMinNClustersTPC(cfgTrackSelection->mTPCclusters); - ownTrackSelection.SetMinNCrossedRowsTPC(cfgTrackSelection->mTPCxRows); - ownTrackSelection.SetMaxDcaXYPtDep([&](float) { return cfgTrackSelection->mDCAxy; }); - ownTrackSelection.SetMaxDcaXY(cfgTrackSelection->mDCAxy); - ownTrackSelection.SetMaxDcaZ(cfgTrackSelection->mDCAz); - o2::aod::track::TrackTypeEnum ttype; - switch (tracktype) { - case 1: - ttype = o2::aod::track::Run2Track; - break; - case 3: - ttype = o2::aod::track::Track; - break; - default: - ttype = o2::aod::track::Track; - break; - } - ownTrackSelection.SetTrackType(ttype); - } else { - useOwnTrackSelection = false; - } - - /* if the system type is not known at this time, we have to put the initialization somewhere else */ - fSystem = getSystemType(cfgSystem); - fDataType = getDataType(cfgDataType); - - /* required ambiguous tracks checks? */ - if (dofilterDetectorLevelWithoutPIDAmbiguous || dofilterDetectorLevelWithPIDAmbiguous || dofilterRecoWithoutPIDAmbiguous || dofilterRecoWithPIDAmbiguous) { - checkAmbiguousTracks = true; - } - - /* create the output list which will own the task histograms */ - TList* fOutputList = new TList(); - fOutputList->SetOwner(true); - fOutput.setObject(fOutputList); - - /* incorporate configuration parameters to the output */ - fOutputList->Add(new TParameter("TrackType", cfgTrackType, 'f')); - fOutputList->Add(new TParameter("TrackOneCharge", 1, 'f')); - fOutputList->Add(new TParameter("TrackTwoCharge", -1, 'f')); - - if ((fDataType == kData) || (fDataType == kDataNoEvtSel) || (fDataType == kMC)) { - /* create the reconstructed data histograms */ - fhXYB = new TH2F("fHistXYB", "x and y distribution for reconstructed before", 1000, -10.0, 10.0, 1000, -10.0, 10.0); - fhYZB = new TH2F("fHistYZB", "y and z distribution for reconstructed before", 1000, -10.0, 10.0, 1000, -10.0, 10.0); - fhXYA = new TH2F("fHistXYA", "x and y distribution for reconstructed after", 1000, -10.0, 10.0, 1000, -10.0, 10.0); - fhYZA = new TH2F("fHistYZA", "y and z distribution for reconstructed after", 1000, -10.0, 10.0, 1000, -10.0, 10.0); - fhPB = new TH1F("fHistPB", "p distribution for reconstructed before;p (GeV/c);dN/dp (c/GeV)", 100, 0.0, 15.0); - fhPtB = new TH1F("fHistPtB", "p_{T} distribution for reconstructed before;p_{T} (GeV/c);dN/dP_{T} (c/GeV)", 100, 0.0, 15.0); - fhPtPosB = new TH1F("fHistPtPosB", "P_{T} distribution for reconstructed (#plus) before;P_{T} (GeV/c);dN/dP_{T} (c/GeV)", 100, 0.0, 15.0); - fhPtNegB = new TH1F("fHistPtNegB", "P_{T} distribution for reconstructed (#minus) before;P_{T} (GeV/c);dN/dP_{T} (c/GeV)", 100, 0.0, 15.0); - fhEtaB = new TH1F("fHistEtaB", "#eta distribution for reconstructed before;#eta;counts", 40, -2.0, 2.0); - fhEtaA = new TH1F("fHistEtaA", "#eta distribution for reconstructed;#eta;counts", etabins, etalow, etaup); - fhPhiB = new TH1F("fHistPhiB", "#phi distribution for reconstructed before;#phi;counts", 360, 0.0, constants::math::TwoPI); - fhdEdxB = new TH2F("fHistdEdxB", "dE/dx vs P before; P (GeV/c); dE/dx (a.u.)", ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhdEdxIPTPCB = new TH2F("fHistdEdxIPTPCB", "dE/dx vs P_{IP} before; P (GeV/c); dE/dx (a.u.)", ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhTrackLengthB = new TH1F(TString::Format("fhTrackLengthB").Data(), - TString::Format("Track Length; L (cm)").Data(), - 1000, 0., 1000.0); - fhTrackLengthTOFB = new TH1F(TString::Format("fhTrackLengthTOFB").Data(), - TString::Format("Track Length with TOF; L (cm)").Data(), - 1000, 0.0, 1000.0); - fhTrackTimeB = new TH2F(TString::Format("fhTrackTimeB").Data(), - TString::Format("Track Time vs P; P (GeV/c); Track Time(ns)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhTrackBetaInvB = new TH2F(TString::Format("fhTrackBetaInvB").Data(), - TString::Format("1/#Beta vs P; P (GeV/c); 1/#Beta(ns/m)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhTrackTimeIPB = new TH2F(TString::Format("fhTrackTimeIPB").Data(), - TString::Format("Track Time vs P_{IP}; P (GeV/c); Track Time(ns)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhTrackBetaInvIPB = new TH2F(TString::Format("fhTrackBetaInvIPB").Data(), - TString::Format("1/#Beta vs P_{IP}; P (GeV/c); 1/#Beta(ns/m)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhPhiA = new TH1F("fHistPhiA", "#phi distribution for reconstructed;#phi;counts", 360, 0.0, constants::math::TwoPI); - fhDCAxyB = new TH1F("DCAxyB", "DCA_{xy} distribution for reconstructed before;DCA_{xy} (cm);counts", 1000, -4.0, 4.0); - fhDCAxyA = new TH1F("DCAxyA", "DCA_{xy} distribution for reconstructed;DCA_{xy} (cm);counts", 1000, -4., 4.0); - fhDCAxyzB = new TH2F("DCAxyzB", "DCA_{xy} vs DCA_{z} distribution for reconstructed before;DCA_{xy} (cm); DCA_{z} (cm);counts", 1000, -4.0, 4.0, 1000, -4.0, 4.0); - fhFineDCAxyA = new TH1F("FineDCAxyA", "DCA_{xy} distribution for reconstructed;DCA_{xy} (cm);counts", 4000, -1.0, 1.0); - fhDCAzB = new TH1F("DCAzB", "DCA_{z} distribution for reconstructed before;DCA_{z} (cm);counts", 1000, -4.0, 4.0); - fhDCAzA = new TH1F("DCAzA", "DCA_{z} distribution for reconstructed;DCA_{z} (cm);counts", 1000, -4.0, 4.0); - fhFineDCAzA = new TH1F("FineDCAzA", "DCA_{z} distribution for reconstructed;DCA_{z} (cm);counts", 4000, -1.0, 1.0); - fhDCAxyzA = new TH2F("DCAxyzA", "DCA_{xy} vs DCA_{z} distribution for reconstructed;DCA_{xy} (cm); DCA_{z} (cm);counts", 1000, -4.0, 4.0, 1000, -4.0, 4.0); - - fhNClustersB = new TH1I("fHistNClB", "TPC NClusters distribution for reconstructed before;counts", 201, 0, 200); - fhPhiYB = new TH2F("fHistPhiYB", "#phi vs #eta distribution for reconstructed before;#phi;#eta;counts", 360, 0.0, constants::math::TwoPI, 40, -2.0, 2.0); - fhPtYB = new TH2F("fHistPtYB", "p_{T} vs #eta distribution for reconstructed before;p_{T} (GeV/c);#eta;counts", 100, 0.0, 15.0, 40, -2.0, 2.0); - fhChi2B = new TH1F("fHistChi2B", "#chi^{2}/Ncl TPC distribution for reconstructed before;", 100, 0.0, 20.0); - fhITSNclB = new TH1I("fHistITSNClB", "ITS NClusters distribution for reconstructed before;counts", 21, 0, 20); - - fhNClustersA = new TH1I("fHistNClA", "TPC NClusters distribution for reconstructed after;counts", 201, 0, 200); - fhPhiYA = new TH2F("fHistPhiYA", "#phi vs #eta distribution for reconstructed after;#phi;#eta;counts", 360, 0.0, constants::math::TwoPI, 40, -2.0, 2.0); - fhPtYA = new TH2F("fHistPtYA", "p_{T} vs #eta distribution for reconstructed after;p_{T} (GeV/c);#eta;counts", 100, 0.0, 15.0, 40, -2.0, 2.0); - fhChi2A = new TH1F("fHistChi2A", "#chi^{2}/Ncl TPC distribution for reconstructed after;", 100, 0.0, 20.0); - fhITSNclA = new TH1I("fHistITSNClA", "ITS NClusters distribution for reconstructed after;counts", 21, 0, 20); - - fhDoublePID = new TH2S("DoublePID", "PIDs for double match;Original Species;Secondary Species", kIdBfNoOfSpecies, 0, kIdBfNoOfSpecies, kIdBfNoOfSpecies, 0, kIdBfNoOfSpecies); - - fhWrongTrackID = new TH1F("WrongTrackId", "Wrong Tracks From Double Track Id distribution in p", ptbins, ptlow, ptup); - if (checkAmbiguousTracks) { - /* let's allocate the ambigous tracks tracking histograms*/ - fhAmbiguousTrackType = new TH2D("fHistAmbiguousTracksType", "Ambiguous tracks type vs. multiplicity class;Ambiguous track type;Multiplicity (%);counts", 4, -0.5, 3.5, 101, -0.5, 100.5); - fhAmbiguousTrackPt = new TH2F("fHistAmbiguousTracksPt", "Ambiguous tracks #it{p}_{T} vs. multiplicity class;#it{p}_{T} (GeV/#it{c});Multiplicity (%);counts", 100, 0.0, 15.0, 101, -0.5, 100.5); - fhAmbiguityDegree = new TH2F("fHistAmbiguityDegree", "Ambiguity degree vs. multiplicity class;Ambiguity degree;Multiplicity (%);counts", 31, -0.5, 30.5, 101, -0.5, 100.5); - fhCompatibleCollisionsZVtxRms = new TH2F("fHistCompatibleCollisionsZVtxRms", "Compatible collisions #it{z}_{vtx} RMS;#sigma_{#it{z}_{vtx}};Multiplicity (%);counts", 100, -10.0, 10.0, 101, -0.5, 100.5); - } - - for (int sp = 0; sp < kIdBfNoOfSpecies; ++sp) { - fhNSigmaTPC[sp] = new TH2F(TString::Format("fhNSigmaTPC_%s", speciesName[sp]).Data(), - TString::Format("N Sigma from TPC vs P for %s;N #sigma;p (GeV/c)", speciesTitle[sp]).Data(), - 48, -6, 6, - ptbins, ptlow, ptup); - fhNSigmaTOF[sp] = new TH2F(TString::Format("fhNSigmaTOF_%s", speciesName[sp]).Data(), - TString::Format("N Sigma from TOF vs P for %s;N #sigma;p (GeV/c)", speciesTitle[sp]).Data(), - 48, -6, 6, - ptbins, ptlow, ptup); - fhNSigmaCombo[sp] = new TH2F(TString::Format("fhNSigmaCombo_%s", speciesName[sp]).Data(), - TString::Format("N Sigma from Combo vs P for %s;N #sigma;p (GeV/c)", speciesTitle[sp]).Data(), - 48, -6, 6, - ptbins, ptlow, ptup); - fhNSigmaTPCIdTrks[sp] = new TH2F(TString::Format("fhNSigmaTPC_IdTrks_%s", speciesName[sp]).Data(), - TString::Format("N Sigma from TPC vs P for Identified %s;N #sigma;p (GeV/c)", speciesTitle[sp]).Data(), - 48, -6, 6, - ptbins, ptlow, ptup); - } - - for (int sp = 0; sp < kIdBfNoOfSpecies + 1; ++sp) { - fhPA[sp] = new TH1F(TString::Format("fHistPA_%s", speciesName[sp]).Data(), - TString::Format("p distribution for reconstructed %s;p (GeV/c);dN/dp (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup); - fhPtA[sp] = new TH1F(TString::Format("fHistPtA_%s", speciesName[sp]), - TString::Format("p_{T} distribution for reconstructed %s;p_{T} (GeV/c);dN/dP_{T} (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup); - fhPtPosA[sp] = new TH1F(TString::Format("fHistPtPosA_%s", speciesName[sp]), - TString::Format("P_{T} distribution for reconstructed %s^{#plus};P_{T} (GeV/c);dN/dP_{T} (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup); - fhPtNegA[sp] = new TH1F(TString::Format("fHistPtNegA_%s", speciesName[sp]), - TString::Format("P_{T} distribution for reconstructed %s^{#minus};P_{T} (GeV/c);dN/dP_{T} (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup); - fhPtEtaPosA[sp] = new TH2F(TString::Format("fHistPtEtaPosA_%s", speciesName[sp]), - TString::Format("P_{T} vs #eta distribution for reconstructed %s^{#plus};P_{T} (GeV/c);#eta;dN/dP_{T} (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, - etabins, etalow, etaup); - fhPtEtaNegA[sp] = new TH2F(TString::Format("fHistPtEtaNegA_%s", speciesName[sp]), - TString::Format("P_{T} vs #eta distribution for reconstructed %s^{#minus};P_{T} (GeV/c);#eta;dN/dP_{T} (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, - etabins, etalow, etaup); - fhNPosNegA[sp] = new TH2F(TString::Format("fhNPosNegA_%s", speciesName[sp]).Data(), - TString::Format("N(%s^{#plus}) N(%s^{#minus}) distribution for reconstructed;N(%s^{#plus});N(%s^{#minus})", speciesTitle[sp], speciesTitle[sp], speciesTitle[sp], speciesTitle[sp]).Data(), - 40, -0.5, 39.5, 40, -0.5, 39.5); - fhDeltaNA[sp] = new TH1F(TString::Format("fhDeltaNA_%s", speciesName[sp]).Data(), - TString::Format("N(%s^{#plus}) #minus N(%s^{#minus}) distribution for reconstructed;N(%s^{#plus}) #minus N(%s^{#minus})", speciesTitle[sp], speciesTitle[sp], speciesTitle[sp], speciesTitle[sp]).Data(), - 79, -39.5, 39.5); - fhdEdxA[sp] = new TH2F(TString::Format("fhdEdxA_%s", speciesName[sp]).Data(), - TString::Format("dE/dx vs P reconstructed %s; P (GeV/c); dE/dx (a.u.)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhdEdxIPTPCA[sp] = new TH2F(TString::Format("fhdEdxIPTPCA_%s", speciesName[sp]).Data(), - TString::Format("dE/dx vs P_{IP} reconstructed %s; P (GeV/c); dE/dx (a.u.)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhTrackLengthA[sp] = new TH1F(TString::Format("fhTrackLengthA_%s", speciesName[sp]).Data(), - TString::Format("Track Length of reconstructed %s; L (cm)", speciesTitle[sp]).Data(), - 1000, 0.0, 1000.0); - fhTrackLengthTOFA[sp] = new TH1F(TString::Format("fhTrackLengthTOFA_%s", speciesName[sp]).Data(), - TString::Format("Track Length of reconstructed %s with TOF; L (cm)", speciesTitle[sp]).Data(), - 1000, 0.0, 1000.0); - fhTrackTimeA[sp] = new TH2F(TString::Format("fhTrackTimeA_%s", speciesName[sp]).Data(), - TString::Format("Track Time vs P reconstructed %s; P (GeV/c); Track Time(ns)", speciesTitle[sp]).Data(), ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhTrackBetaInvA[sp] = new TH2F(TString::Format("fhTrackBetaInvA_%s", speciesName[sp]).Data(), - TString::Format("1/#Beta vs P reconstructed %s; P (GeV/c); 1/#Beta(ns/m)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhTrackTimeIPA[sp] = new TH2F(TString::Format("fhTrackTimeIPA_%s", speciesName[sp]).Data(), - TString::Format("Track Time vs P_{IP} reconstructed %s; P (GeV/c); Track Time(ns)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhTrackBetaInvIPA[sp] = new TH2F(TString::Format("fhTrackBetaInvIPA_%s", speciesName[sp]).Data(), - TString::Format("1/#Beta vs P_{IP} reconstructed %s; P (GeV/c); 1/#Beta(ns/m)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - LOGF(info, "Made Histos"); - } - fhdEdxA[kIdBfNoOfSpecies + 1] = new TH2F(TString::Format("fhdEdxA_WrongSpecies").Data(), - TString::Format("dE/dx vs P reconstructed Wrong Species; P (GeV/c); dE/dx (a.u.)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhdEdxIPTPCA[kIdBfNoOfSpecies + 1] = new TH2F(TString::Format("fhdEdxIPTPCA_WrongSpecies").Data(), - TString::Format("dE/dx vs P_{IP} reconstructed Wrong Species; P (GeV/c); dE/dx (a.u.)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhTrackLengthA[kIdBfNoOfSpecies + 1] = new TH1F(TString::Format("fhTrackLengthA_WrongSpecies").Data(), - TString::Format("Track Length of reconstructed Wrong Species; L (cm)").Data(), - 1000, 0.0, 1000.0); - fhTrackLengthTOFA[kIdBfNoOfSpecies + 1] = new TH1F(TString::Format("fhTrackLengthTOFA_WrongSpecies").Data(), - TString::Format("Track Length of reconstructed Wrong Species with TOF; L (cm)").Data(), - 1000, 0.0, 1000.0); - fhTrackTimeA[kIdBfNoOfSpecies + 1] = new TH2F(TString::Format("fhTrackTimeA_WrongSpecies").Data(), - TString::Format("Track Time vs P reconstructed Wrong Species; P (GeV/c); Track Time(ns)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhTrackBetaInvA[kIdBfNoOfSpecies + 1] = new TH2F(TString::Format("fhTrackBetaInvA_WrongSpecies").Data(), - TString::Format("1/#Beta vs P reconstructed Wrong Species; P (GeV/c); 1/#Beta(ns/m)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhTrackTimeIPA[kIdBfNoOfSpecies + 1] = new TH2F(TString::Format("fhTrackTimeIPA_WrongSpecies").Data(), - TString::Format("Track Time vs P_{IP} reconstructed Wrong Species; P (GeV/c); Track Time(ns)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhTrackBetaInvIPA[kIdBfNoOfSpecies + 1] = new TH2F(TString::Format("fhTrackBetaInvIPA_WrongSpecies").Data(), - TString::Format("1/#Beta vs P_{IP} reconstructed Wrong Species; P (GeV/c); 1/#Beta(ns/m)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - - /* add the hstograms to the output list */ - fOutputList->Add(fhXYB); - fOutputList->Add(fhYZB); - fOutputList->Add(fhXYA); - fOutputList->Add(fhYZA); - fOutputList->Add(fhNClustersB); - fOutputList->Add(fhNClustersA); - fOutputList->Add(fhPhiYB); - fOutputList->Add(fhPhiYA); - fOutputList->Add(fhPtYB); - fOutputList->Add(fhPtYA); - fOutputList->Add(fhChi2B); - fOutputList->Add(fhChi2A); - fOutputList->Add(fhITSNclB); - fOutputList->Add(fhITSNclA); - fOutputList->Add(fhPB); - fOutputList->Add(fhPtB); - fOutputList->Add(fhPtPosB); - fOutputList->Add(fhPtNegB); - fOutputList->Add(fhEtaB); - fOutputList->Add(fhEtaA); - fOutputList->Add(fhPhiB); - fOutputList->Add(fhPhiA); - fOutputList->Add(fhdEdxB); - fOutputList->Add(fhdEdxIPTPCB); - fOutputList->Add(fhTrackLengthB); - fOutputList->Add(fhTrackLengthTOFB); - fOutputList->Add(fhTrackTimeB); - fOutputList->Add(fhTrackBetaInvB); - fOutputList->Add(fhTrackTimeIPB); - fOutputList->Add(fhTrackBetaInvIPB); - fOutputList->Add(fhDCAxyB); - fOutputList->Add(fhDCAxyA); - fOutputList->Add(fhDCAxyzB); - fOutputList->Add(fhDCAxyzA); - fOutputList->Add(fhWrongTrackID); - fOutputList->Add(fhDoublePID); - fOutputList->Add(fhFineDCAxyA); - fOutputList->Add(fhDCAzB); - fOutputList->Add(fhDCAzA); - fOutputList->Add(fhFineDCAzA); - - if (checkAmbiguousTracks) { - fOutputList->Add(fhAmbiguousTrackType); - fOutputList->Add(fhAmbiguousTrackPt); - fOutputList->Add(fhAmbiguityDegree); - fOutputList->Add(fhCompatibleCollisionsZVtxRms); - } - - for (int sp = 0; sp < kIdBfNoOfSpecies; ++sp) { - fOutputList->Add(fhNSigmaTPC[sp]); - fOutputList->Add(fhNSigmaTOF[sp]); - fOutputList->Add(fhNSigmaCombo[sp]); - fOutputList->Add(fhNSigmaTPCIdTrks[sp]); - } - - for (int sp = 0; sp < kIdBfNoOfSpecies + 1; ++sp) { - fOutputList->Add(fhPA[sp]); - fOutputList->Add(fhPtA[sp]); - fOutputList->Add(fhPtPosA[sp]); - fOutputList->Add(fhPtNegA[sp]); - fOutputList->Add(fhPtEtaPosA[sp]); - fOutputList->Add(fhPtEtaNegA[sp]); - fOutputList->Add(fhNPosNegA[sp]); - fOutputList->Add(fhDeltaNA[sp]); - fOutputList->Add(fhdEdxA[sp]); - fOutputList->Add(fhdEdxIPTPCA[sp]); - fOutputList->Add(fhTrackLengthA[sp]); - fOutputList->Add(fhTrackLengthTOFA[sp]); - fOutputList->Add(fhTrackTimeA[sp]); - fOutputList->Add(fhTrackBetaInvA[sp]); - fOutputList->Add(fhTrackTimeIPA[sp]); - fOutputList->Add(fhTrackBetaInvIPA[sp]); - LOGF(info, "Added histos"); - } - fOutputList->Add(fhdEdxA[kIdBfNoOfSpecies + 1]); - fOutputList->Add(fhdEdxIPTPCA[kIdBfNoOfSpecies + 1]); - fOutputList->Add(fhTrackLengthA[kIdBfNoOfSpecies + 1]); - fOutputList->Add(fhTrackLengthTOFA[kIdBfNoOfSpecies + 1]); - fOutputList->Add(fhTrackTimeA[kIdBfNoOfSpecies + 1]); - fOutputList->Add(fhTrackBetaInvA[kIdBfNoOfSpecies + 1]); - fOutputList->Add(fhTrackTimeIPA[kIdBfNoOfSpecies + 1]); - fOutputList->Add(fhTrackBetaInvIPA[kIdBfNoOfSpecies + 1]); - } - - if ((fDataType != kData) && (fDataType != kDataNoEvtSel)) { - /* create the true data histograms */ - - fhTruePIDMismatch = new TH2S("fHistTruePIDMismatch", "Mismatched Generated and Reconstructed PID;Generated Species;Reconstructed Species", kIdBfNoOfSpecies, 0, kIdBfNoOfSpecies, kIdBfNoOfSpecies, 0, kIdBfNoOfSpecies); - fhTruePIDCorrect = new TH1S("fHistTruePIDCorrect", "Correct PID between Generated and Reconstructed PID;Species", kIdBfNoOfSpecies, 0, kIdBfNoOfSpecies); - - fhTruePB = new TH1F("fTrueHistPB", "p distribution before (truth);p (GeV/c);dN/dp (c/GeV)", 100, 0.0, 15.0); - fhTrueCharge = new TH1F("fTrueHistCharge", "Charge distribution before (truth);charge;count", 3, -1.0, 1.0); - - fhTruePhiYB = new TH2F("fTrueHistPhiYB", "#phi vs #eta distribution before (truth);#phi;#eta;counts", 360, 0.0, constants::math::TwoPI, 40, -2.0, 2.0); - fhTruePtYB = new TH2F("fTrueHistPtYB", "p_{T} vs #eta distribution before (truth);p_{T} (GeV/c);#eta;counts", 100, 0.0, 15.0, 40, -2.0, 2.0); - - fhTruePhiYA = new TH2F("fTrueHistPhiYA", "#phi vs #eta distribution after (truth);#phi;#eta;counts", 360, 0.0, constants::math::TwoPI, 40, -2.0, 2.0); - fhTruePtYA = new TH2F("fTrueHistPtYA", "p_{T} vs #eta distribution after (truth);p_{T} (GeV/c);#eta;counts", 100, 0.0, 15.0, 40, -2.0, 2.0); - - fhTruePtB = new TH1F("fTrueHistPtB", "p_{T} distribution before (truth);p_{T} (GeV/c);dN/dP_{T} (c/GeV)", 100, 0.0, 15.0); - fhTruePtPosB = new TH1F("fTrueHistPtPosB", "P_{T} distribution (#plus) before (truth);P_{T} (GeV/c);dN/dP_{T} (c/GeV)", 100, 0.0, 15.0); - fhTruePtNegB = new TH1F("fTrueHistPtNegB", "P_{T} distribution (#minus) before (truth);P_{T} (GeV/c);dN/dP_{T} (c/GeV)", 100, 0.0, 15.0); - fhTrueEtaB = new TH1F("fTrueHistEtaB", "#eta distribution before (truth);#eta;counts", 40, -2.0, 2.0); - fhTrueEtaA = new TH1F("fTrueHistEtaA", "#eta distribution (truth);#eta;counts", etabins, etalow, etaup); - fhTruePhiB = new TH1F("fTrueHistPhiB", "#phi distribution before (truth);#phi;counts", 360, 0.0, constants::math::TwoPI); - fhTruePhiA = new TH1F("fTrueHistPhiA", "#phi distribution (truth);#phi;counts", 360, 0.0, constants::math::TwoPI); - fhTrueDCAxyB = new TH1F("TrueDCAxyB", "DCA_{xy} distribution for generated before;DCA_{xy} (cm);counts", 1000, -4.0, 4.0); - fhPrimaryPB = new TH1F(TString::Format("fhPrimaryPB").Data(), - TString::Format("p distribution Primary Before Selection;p (GeV/c);dN/dp (c/GeV)").Data(), - ptbins, ptlow, ptup); - fhPrimaryPtB = new TH1F(TString::Format("fhPrimaryPtB"), - TString::Format("p_{T} distribution Primary Before Selection ;p_{T} (GeV/c);dN/dP_{T} (c/GeV)").Data(), - ptbins, ptlow, ptup); - fhPrimarydEdxB = new TH2F(TString::Format("fhPrimarydEdxB").Data(), - TString::Format("dE/dx vs P Primary Before Selection; P (GeV/c); dE/dx (a.u.)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhPrimarydEdxIPTPCB = new TH2F(TString::Format("fhPrimarydEdxIPTPCB").Data(), - TString::Format("dE/dx vs P_{IP} Primary Before Selection; P (GeV/c); dE/dx (a.u.)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhPrimaryTrackLengthB = new TH1F(TString::Format("fhPrimaryTrackLengthB").Data(), - TString::Format("Track Length of Primary Before Selection; L (cm)").Data(), - 1000, 0.0, 1000.0); - fhPrimaryTrackLengthTOFB = new TH1F(TString::Format("fhPrimaryTrackLengthTOFB").Data(), - TString::Format("Track Length of Primary Before Selection with TOF; L (cm)").Data(), - 1000, 0.0, 1000.0); - fhPrimaryTrackTimeB = new TH2F(TString::Format("fhPrimaryTrackTimeB").Data(), - TString::Format("Track Time vs P Primary Before Selection; P (GeV/c); Track Time(ns)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhPrimaryTrackBetaInvB = new TH2F(TString::Format("fhPrimaryTrackBetaInvB").Data(), - TString::Format("1/#Beta vs P Primary Before Selection; P (GeV/c); 1/#Beta(ns/m)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhPrimaryTrackTimeIPB = new TH2F(TString::Format("fhPrimaryTrackTimeIPB").Data(), - TString::Format("Track Time vs P_{IP} Primary Before Selection; P (GeV/c); Track Time(ns)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhPrimaryTrackBetaInvIPB = new TH2F(TString::Format("fhPrimaryTrackBetaInvIPB").Data(), - TString::Format("1/#Beta vs P_{IP} Primary Before Selection; P (GeV/c); 1/#Beta(ns/m)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - if (traceDCAOutliers.mDoIt) { - fhTrueDCAxyBid = new TH1F("PDGCodeDCAxyB", - TString::Format("PDG code within %.2f<|DCA_{#it{xy}}|<%.2f; PDG code", traceDCAOutliers.mLowValue, traceDCAOutliers.mUpValue).Data(), - 100, 0.5, 100.5); - } - fhTrueDCAxyA = new TH1F("TrueDCAxyA", "DCA_{xy} distribution for generated;DCA_{xy};counts (cm)", 1000, -4., 4.0); - fhTrueDCAzB = new TH1F("TrueDCAzB", "DCA_{z} distribution for generated before;DCA_{z} (cm);counts", 1000, -4.0, 4.0); - fhTrueDCAzA = new TH1F("TrueDCAzA", "DCA_{z} distribution for generated;DCA_{z} (cm);counts", 1000, -4.0, 4.0); - fhTrueDCAxyzB = new TH2F("TrueDCAxyzB", "DCA_{xy} vs DCA_{z} distribution for generated before;DCA_{xy} (cm);DCA_{z} (cm);counts", 1000, -4.0, 4.0, 1000, -4.0, 4.0); - fhTrueDCAxyzA = new TH2F("TrueDCAxyzA", "DCA_{xy} vs DCA_{z} distribution for generated after;DCA_{xy} (cm);DCA_{z} (cm);counts", 1000, -4.0, 4.0, 1000, -4.0, 4.0); - - for (int sp = 0; sp < kIdBfNoOfSpecies + 1; ++sp) { - fhTruePA[sp] = new TH1F(TString::Format("fTrueHistPA_%s", speciesName[sp]).Data(), - TString::Format("p distribution %s (truth);p (GeV/c);dN/dp (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup); - fhTruePtA[sp] = new TH1F(TString::Format("fTrueHistPtA_%s", speciesName[sp]), - TString::Format("p_{T} distribution %s (truth);p_{T} (GeV/c);dN/dP_{T} (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup); - fhTruePtPosA[sp] = new TH1F(TString::Format("fTrueHistPtPosA_%s", speciesName[sp]), - TString::Format("P_{T} distribution %s^{#plus} (truth);P_{T} (GeV/c);dN/dP_{T} (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup); - fhTruePtNegA[sp] = new TH1F(TString::Format("fTrueHistPtNegA_%s", speciesName[sp]), - TString::Format("P_{T} distribution %s^{#minus} (truth);P_{T} (GeV/c);dN/dP_{T} (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup); - fhTruePtEtaPosA[sp] = new TH2F(TString::Format("fTrueHistPtEtaPosA_%s", speciesName[sp]), - TString::Format("P_{T} vs #eta distribution %s^{#plus} (truth);P_{T} (GeV/c);#eta;dN/dP_{T} (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, - etabins, etalow, etaup); - fhTruePtEtaNegA[sp] = new TH2F(TString::Format("fTrueHistPtEtaNegA_%s", speciesName[sp]), - TString::Format("P_{T} vs #eta distribution %s^{#minus} (truth);P_{T} (GeV/c);#eta;dN/dP_{T} (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, - etabins, etalow, etaup); - fhTrueNPosNegA[sp] = new TH2F(TString::Format("fhTrueNPosNegA_%s", speciesName[sp]).Data(), - TString::Format("N(%s^{#plus}) N(%s^{#minus}) distribution (truth);N(%s^{#plus});N(%s^{#minus})", speciesTitle[sp], speciesTitle[sp], speciesTitle[sp], speciesTitle[sp]).Data(), - 40, -0.5, 39.5, 40, -0.5, 39.5); - fhTrueDeltaNA[sp] = new TH1F(TString::Format("fhTrueDeltaNA_%s", speciesName[sp]).Data(), - TString::Format("N(%s^{#plus}) #minus N(%s^{#minus}) distribution (truth);N(%s^{#plus}) #minus N(%s^{#minus})", speciesTitle[sp], speciesTitle[sp], speciesTitle[sp], speciesTitle[sp]).Data(), - 79, -39.5, 39.5); - fhTruedEdxA[sp] = new TH2F(TString::Format("fhTruedEdxA_%s", speciesName[sp]).Data(), - TString::Format("dE/dx vs P generated %s; P (GeV/c); dE/dx (a.u.)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhTruedEdxIPTPCA[sp] = new TH2F(TString::Format("fhTruedEdxIPTPCA_%s", speciesName[sp]).Data(), - TString::Format("dE/dx vs P_{IP} generated %s; P (GeV/c); dE/dx (a.u.)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhTrueTrackLengthA[sp] = new TH1F(TString::Format("fhTrueTrackLengthA_%s", speciesName[sp]).Data(), - TString::Format("Track Length of generated %s; L (cm)", speciesTitle[sp]).Data(), - 1000, 0.0, 1000.0); - fhTrueTrackLengthTOFA[sp] = new TH1F(TString::Format("fhTrueTrackLengthTOFA_%s", speciesName[sp]).Data(), - TString::Format("Track Length of generated %s with TOF; L (cm)", speciesTitle[sp]).Data(), - 1000, 0.0, 1000.0); - fhTrueTrackTimeA[sp] = new TH2F(TString::Format("fhTrueTrackTimeA_%s", speciesName[sp]).Data(), - TString::Format("Track Time vs P generated %s; P (GeV/c); Track Time(ns)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhTrueTrackBetaInvA[sp] = new TH2F(TString::Format("fhTrueTrackBetaInvA_%s", speciesName[sp]).Data(), - TString::Format("1/#Beta vs P generated %s; P (GeV/c); 1/#Beta(ns/m)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhTrueTrackTimeIPA[sp] = new TH2F(TString::Format("fhTrueTrackTimeIPA_%s", speciesName[sp]).Data(), - TString::Format("Track Time vs P_{IP} generated %s; P (GeV/c); Track Time(ns)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhTrueTrackBetaInvIPA[sp] = new TH2F(TString::Format("fhTrueTrackBetaInvIPA_%s", speciesName[sp]).Data(), - TString::Format("1/#Beta vs P_{IP} generated %s; P (GeV/c); 1/#Beta(ns/m)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - - fhPrimaryPA[sp] = new TH1F(TString::Format("fhPrimaryPA_%s", speciesName[sp]).Data(), - TString::Format("p distribution Primary %s;p (GeV/c);dN/dp (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup); - fhPrimaryPtA[sp] = new TH1F(TString::Format("fhPrimaryPtA_%s", speciesName[sp]), - TString::Format("p_{T} distribution Primary %s ;p_{T} (GeV/c);dN/dP_{T} (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup); - fhPrimarydEdxA[sp] = new TH2F(TString::Format("fhPrimarydEdxA_%s", speciesName[sp]).Data(), - TString::Format("dE/dx vs P Primary %s; P (GeV/c); dE/dx (a.u.)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhPrimarydEdxIPTPCA[sp] = new TH2F(TString::Format("fhPrimarydEdxIPTPCA_%s", speciesName[sp]).Data(), - TString::Format("dE/dx vs P_{IP} Primary %s; P (GeV/c); dE/dx (a.u.)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhPrimaryTrackLengthA[sp] = new TH1F(TString::Format("fhPrimaryTrackLengthA_%s", speciesName[sp]).Data(), - TString::Format("Track Length of Primary %s; L (cm)", speciesTitle[sp]).Data(), - 1000, 0.0, 1000.0); - fhPrimaryTrackLengthTOFA[sp] = new TH1F(TString::Format("fhPrimaryTrackLengthTOFA_%s", speciesName[sp]).Data(), - TString::Format("Track Length of Primary %s with TOF; L (cm)", speciesTitle[sp]).Data(), - 1000, 0.0, 1000.0); - fhPrimaryTrackTimeA[sp] = new TH2F(TString::Format("fhPrimaryTrackTimeA_%s", speciesName[sp]).Data(), - TString::Format("Track Time vs P Primary %s; P (GeV/c); Track Time(ns)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhPrimaryTrackBetaInvA[sp] = new TH2F(TString::Format("fhPrimaryTrackBetaInvA_%s", speciesName[sp]).Data(), - TString::Format("1/#Beta vs P Primary %s; P (GeV/c); 1/#Beta(ns/m)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhPrimaryTrackTimeIPA[sp] = new TH2F(TString::Format("fhPrimaryTrackTimeIPA_%s", speciesName[sp]).Data(), - TString::Format("Track Time vs P_{IP} Primary %s; P (GeV/c); Track Time(ns)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhPrimaryTrackBetaInvIPA[sp] = new TH2F(TString::Format("fhPrimaryTrackBetaInvIPA_%s", speciesName[sp]).Data(), - TString::Format("1/#Beta vs P_{IP} Primary %s; P (GeV/c); 1/#Beta(ns/m)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - - fhPurePA[sp] = new TH1F(TString::Format("fhPurePA_%s", speciesName[sp]).Data(), - TString::Format("p distribution Pure %s;p (GeV/c);dN/dp (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup); - fhPurePtA[sp] = new TH1F(TString::Format("fhPurePtA_%s", speciesName[sp]), - TString::Format("p_{T} distribution Pure %s ;p_{T} (GeV/c);dN/dP_{T} (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup); - fhPuredEdxA[sp] = new TH2F(TString::Format("fhPuredEdxA_%s", speciesName[sp]).Data(), - TString::Format("dE/dx vs P Pure %s; P (GeV/c); dE/dx (a.u.)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhPuredEdxIPTPCA[sp] = new TH2F(TString::Format("fhPuredEdxIPTPCA_%s", speciesName[sp]).Data(), - TString::Format("dE/dx vs P_{IP} Pure %s; P (GeV/c); dE/dx (a.u.)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhPureTrackLengthA[sp] = new TH1F(TString::Format("fhPureTrackLengthA_%s", speciesName[sp]).Data(), - TString::Format("Track Length of Pure %s; L (cm)", speciesTitle[sp]).Data(), - 1000, 0.0, 1000.0); - fhPureTrackLengthTOFA[sp] = new TH1F(TString::Format("fhPureTrackLengthTOFA_%s", speciesName[sp]).Data(), - TString::Format("Track Length of Pure %s with TOF; L (cm)", speciesTitle[sp]).Data(), - 1000, 0.0, 1000.0); - fhPureTrackTimeA[sp] = new TH2F(TString::Format("fhPureTrackTimeA_%s", speciesName[sp]).Data(), - TString::Format("Track Time vs P Pure %s; P (GeV/c); Track Time(ns)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhPureTrackBetaInvA[sp] = new TH2F(TString::Format("fhPureTrackBetaInvA_%s", speciesName[sp]).Data(), - TString::Format("1/#Beta vs P Pure %s; P (GeV/c); 1/#Beta(ns/m)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhPureTrackTimeIPA[sp] = new TH2F(TString::Format("fhPureTrackTimeIPA_%s", speciesName[sp]).Data(), - TString::Format("Track Time vs P_{IP} Pure %s; P (GeV/c); Track Time(ns)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhPureTrackBetaInvIPA[sp] = new TH2F(TString::Format("fhPureTrackBetaInvIPA_%s", speciesName[sp]).Data(), - TString::Format("1/#Beta vs P_{IP} Pure %s; P (GeV/c); 1/#Beta(ns/m)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - } - if (makeNSigmaPlots) { - for (int sp1 = 0; sp1 < kIdBfNoOfSpecies; ++sp1) { - for (int sp2 = 0; sp2 < kIdBfNoOfSpecies; ++sp2) { - fhTrueNSigmaTPC[sp1][sp2] = new TH2F(TString::Format("fhTrueNSigmaTPC%s_%s", speciesName[sp1], speciesName[sp2]).Data(), - TString::Format("N #sigma %s from TPC vs P for generated %s;N #sigma;p (GeV/c)", speciesTitle[sp1], speciesTitle[sp2]).Data(), - 48, -6, 6, - ptbins, ptlow, ptup); - - fhTrueNSigmaTOF[sp1][sp2] = new TH2F(TString::Format("fhTrueNSigmaTOF%s_%s", speciesName[sp1], speciesName[sp2]).Data(), - TString::Format("N #sigma %s from TOF vs P for generated %s;N #sigma;p (GeV/c)", speciesTitle[sp1], speciesTitle[sp2]).Data(), - 48, -6, 6, - ptbins, ptlow, ptup); - fhPrimaryNSigmaTPC[sp1][sp2] = new TH2F(TString::Format("fhPrimaryNSigmaTPC%s_%s", speciesName[sp1], speciesName[sp2]).Data(), - TString::Format("N #sigma %s from TPC vs P for primary %s;N #sigma;p (GeV/c)", speciesTitle[sp1], speciesTitle[sp2]).Data(), - 48, -6, 6, - ptbins, ptlow, ptup); - - fhPrimaryNSigmaTOF[sp1][sp2] = new TH2F(TString::Format("fhPrimaryNSigmaTOF%s_%s", speciesName[sp1], speciesName[sp2]).Data(), - TString::Format("N #sigma %s from TOF vs P for primary %s;N #sigma;p (GeV/c)", speciesTitle[sp1], speciesTitle[sp2]).Data(), - 48, -6, 6, - ptbins, ptlow, ptup); - } - } - } - - /* add the hstograms to the output list */ - fOutputList->Add(fhTruePIDMismatch); - fOutputList->Add(fhTruePIDCorrect); - fOutputList->Add(fhTruePhiYB); - fOutputList->Add(fhTruePtYB); - fOutputList->Add(fhTruePhiYA); - fOutputList->Add(fhTruePtYA); - fOutputList->Add(fhTruePB); - fOutputList->Add(fhTruePtB); - fOutputList->Add(fhTruePtPosB); - fOutputList->Add(fhTruePtNegB); - fOutputList->Add(fhTrueCharge); - fOutputList->Add(fhTrueEtaB); - fOutputList->Add(fhTrueEtaA); - fOutputList->Add(fhTruePhiB); - fOutputList->Add(fhTruePhiA); - fOutputList->Add(fhTrueDCAxyB); - fOutputList->Add(fhPrimaryPB); - fOutputList->Add(fhPrimaryPtB); - fOutputList->Add(fhPrimarydEdxB); - fOutputList->Add(fhPrimarydEdxIPTPCB); - fOutputList->Add(fhPrimaryTrackLengthB); - fOutputList->Add(fhPrimaryTrackLengthTOFB); - fOutputList->Add(fhPrimaryTrackTimeB); - fOutputList->Add(fhPrimaryTrackBetaInvB); - fOutputList->Add(fhPrimaryTrackTimeIPB); - fOutputList->Add(fhPrimaryTrackBetaInvIPB); - if (traceDCAOutliers.mDoIt) { - fOutputList->Add(fhTrueDCAxyBid); - } - fOutputList->Add(fhTrueDCAxyA); - fOutputList->Add(fhTrueDCAzB); - fOutputList->Add(fhTrueDCAzA); - fOutputList->Add(fhTrueDCAxyzB); - fOutputList->Add(fhTrueDCAxyzA); - - for (int sp = 0; sp < kIdBfNoOfSpecies + 1; ++sp) { - fOutputList->Add(fhTruePA[sp]); - fOutputList->Add(fhTruePtA[sp]); - fOutputList->Add(fhTruePtPosA[sp]); - fOutputList->Add(fhTruePtNegA[sp]); - fOutputList->Add(fhTruePtEtaPosA[sp]); - fOutputList->Add(fhTruePtEtaNegA[sp]); - fOutputList->Add(fhTrueNPosNegA[sp]); - fOutputList->Add(fhTrueDeltaNA[sp]); - - fOutputList->Add(fhTruedEdxA[sp]); - fOutputList->Add(fhTruedEdxIPTPCA[sp]); - fOutputList->Add(fhTrueTrackLengthA[sp]); - fOutputList->Add(fhTrueTrackLengthTOFA[sp]); - fOutputList->Add(fhTrueTrackTimeA[sp]); - fOutputList->Add(fhTrueTrackBetaInvA[sp]); - fOutputList->Add(fhTrueTrackTimeIPA[sp]); - fOutputList->Add(fhTrueTrackBetaInvIPA[sp]); - - fOutputList->Add(fhPrimaryPA[sp]); - fOutputList->Add(fhPrimaryPtA[sp]); - fOutputList->Add(fhPrimarydEdxA[sp]); - fOutputList->Add(fhPrimarydEdxIPTPCA[sp]); - fOutputList->Add(fhPrimaryTrackLengthA[sp]); - fOutputList->Add(fhPrimaryTrackLengthTOFA[sp]); - fOutputList->Add(fhPrimaryTrackTimeA[sp]); - fOutputList->Add(fhPrimaryTrackBetaInvA[sp]); - fOutputList->Add(fhPrimaryTrackTimeIPA[sp]); - fOutputList->Add(fhPrimaryTrackBetaInvIPA[sp]); - - fOutputList->Add(fhPurePA[sp]); - fOutputList->Add(fhPurePtA[sp]); - fOutputList->Add(fhPuredEdxA[sp]); - fOutputList->Add(fhPuredEdxIPTPCA[sp]); - fOutputList->Add(fhPureTrackLengthA[sp]); - fOutputList->Add(fhPureTrackLengthTOFA[sp]); - fOutputList->Add(fhPureTrackTimeA[sp]); - fOutputList->Add(fhPureTrackBetaInvA[sp]); - fOutputList->Add(fhPureTrackTimeIPA[sp]); - fOutputList->Add(fhPureTrackBetaInvIPA[sp]); - } - if (makeNSigmaPlots) { - for (int sp1 = 0; sp1 < kIdBfNoOfSpecies; ++sp1) { - for (int sp2 = 0; sp2 < kIdBfNoOfSpecies; ++sp2) { - fOutputList->Add(fhTrueNSigmaTPC[sp1][sp2]); - fOutputList->Add(fhTrueNSigmaTOF[sp1][sp2]); - fOutputList->Add(fhPrimaryNSigmaTPC[sp1][sp2]); - fOutputList->Add(fhPrimaryNSigmaTOF[sp1][sp2]); - } - } - } - } - /* initialize access to the CCDB */ - } - - template - inline MatchRecoGenSpecies identifyTrack(TrackObject const& track); - template - int8_t acceptTrack(TrackObject const& track); - template - int8_t acceptParticle(ParticleObject& particle, MCCollisionObject const& mccollision); - template - int8_t selectTrackAmbiguousCheck(CollisionObjects const& collisions, TrackObject const& track); - template - inline void identifyPIDMismatch(ParticleObject const& particle, MatchRecoGenSpecies const& trkId); - template - inline void identifyRealNSigma(ParticleObject const& particle, std::vector tpcNSigma, std::vector tofNSigma, float tpcInnerParam); - template - inline MatchRecoGenSpecies identifyParticle(ParticleObject const& particle); - template - void fillTrackHistosBeforeSelection(TrackObject const& track); - template - void fillTrackHistosAfterSelection(TrackObject const& track, MatchRecoGenSpecies sp); - template - bool isPrimary(ParticleObject const& particle); - template - void fillRealPIDTrackHistosAfter(TrackObject const& track, MatchRecoGenSpecies sp); - template - void fillParticleHistosBeforeSelection(ParticleObject const& particle, - MCCollisionObject const& collision, - float charge); - template - void fillParticleHistosAfterSelection(ParticleObject const& particle, - MCCollisionObject const& collision, - float charge, - MatchRecoGenSpecies sp); - - /* TODO: as it is now when the derived data is stored (fullDerivedData = true) */ - /* the collision index stored with the track is wrong. This has to be fixed */ - template - void filterTracks(soa::Join const& collisions, - passedtracks const& tracks) - { - // LOGF(info, "Top of filterTracks"); - int naccepted = 0; - int ncollaccepted = 0; - if (!fullDerivedData) { - tracksinfo.reserve(tracks.size()); - } - for (const auto& collision : collisions) { - if (collision.collisionaccepted()) { - ncollaccepted++; - } - } - for (const auto& track : tracks) { - int8_t pid = -1; - if (track.has_collision() && (track.template collision_as>()).collisionaccepted()) { - pid = selectTrackAmbiguousCheck(collisions, track); - if (!(pid < 0)) { - naccepted++; - /* update charged multiplicities */ - if (pid % twoDenom == trackTypes[0]) { - trkMultPos[kIdBfCharged]++; - } - if (pid % twoDenom == trackTypes[1]) { - trkMultNeg[kIdBfCharged]++; - } - if (fullDerivedData) { - LOGF(fatal, "Stored derived data not prepared for saving the proper new collision id"); - scannedtracks((track.template collision_as>()).globalIndex(), pid, track.pt(), track.eta(), track.phi()); - } else { - tracksinfo(pid); - } - } else { - if (!fullDerivedData) { - /* track not accepted */ - tracksinfo(pid); - } - } - } else { - if (!fullDerivedData) { - /* track collision not accepted */ - tracksinfo(pid); - } - } - } - LOGF(IDENTIFIEDBFFILTERLOGCOLLISIONS, - "Processed %d accepted collisions out of a total of %d with %d accepted tracks out of a " - "total of %d", - ncollaccepted, - collisions.size(), - naccepted, - tracks.size()); - } - - /* TODO: for the time being the full derived data is still not supported */ - /* for doing that we need to get the index of the associated mc collision */ - void filterParticles(soa::Join const& gencollisions, aod::McParticles const& particles) - { - using namespace identifiedbffilter; - int acceptedparticles = 0; - int acceptedcollisions = 0; - if (!fullDerivedData) { - gentracksinfo.reserve(particles.size()); - } - - for (const auto& gencoll : gencollisions) { - if (gencoll.collisionaccepted()) { - acceptedcollisions++; - } - } - - for (const auto& particle : particles) { - int8_t pid = -1; - if (particle.isPhysicalPrimary()) { - TParticlePDG* pdgpart = fPDG->GetParticle(particle.pdgCode()); - float charge = 0; - if (pdgpart != nullptr) { - charge = getCharge(pdgpart->Charge()); - // print charge - } - fhTrueCharge->Fill(charge); - if (charge != 0) { - if (particle.has_mcCollision() && (particle.template mcCollision_as>()).collisionaccepted()) { - auto mccollision = particle.template mcCollision_as>(); - /* before particle selection */ - fillParticleHistosBeforeSelection(particle, mccollision, charge); - - /* track selection */ - pid = acceptParticle(particle, mccollision); - if (!(pid < 0)) { // if PID isn't negative - acceptedparticles++; - } - } - } else { - if ((particle.mcCollisionId() == 0) && traceCollId0) { - LOGF(IDENTIFIEDBFFILTERLOGTRACKS, "Particle %d with fractional charge or equal to zero", particle.globalIndex()); - } - } - - } else { - if ((particle.mcCollisionId() == 0) && traceCollId0) { - LOGF(IDENTIFIEDBFFILTERLOGTRACKS, "Particle %d not Physical Primary", particle.globalIndex()); - } - } - if (!fullDerivedData) { - gentracksinfo(pid); - } - } - LOGF(info, - "Processed %d accepted generated collisions out of a total of %d with %d accepted particles out of a " - "total of %d", - acceptedcollisions, - gencollisions.size(), - acceptedparticles, - particles.size()); - } - - void filterRecoWithPID(soa::Join& collisions, IdBfFullTracksPID const& tracks) - { - filterTracks(collisions, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterTracks, filterRecoWithPID, "Not stored derived data track filtering", false) - - void filterRecoWithPIDAmbiguous(soa::Join& collisions, IdBfFullTracksPIDAmbiguous const& tracks) - { - filterTracks(collisions, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterTracks, filterRecoWithPIDAmbiguous, "Not stored derived data track filtering with ambiguous tracks check", false) - - void filterDetectorLevelWithPID(soa::Join& collisions, IdBfFullTracksPIDDetLevel const& tracks, aod::McParticles const&) - { - filterTracks(collisions, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterTracks, filterDetectorLevelWithPID, "Not stored derived data detector level track filtering", false) - - void filterDetectorLevelWithPIDAmbiguous(soa::Join& collisions, IdBfFullTracksPIDDetLevelAmbiguous const& tracks, aod::McParticles const&) - { - filterTracks(collisions, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterTracks, filterDetectorLevelWithPIDAmbiguous, "Not stored derived data detector level track filtering with ambiguous tracks check", false) - - void filterRecoWithFullPID(soa::Join& collisions, IdBfFullTracksFullPID const& tracks, aod::McParticles const&) - { - filterTracks(collisions, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterTracks, filterRecoWithFullPID, "Not stored derived data track filtering", false) - - void filterRecoWithFullPIDAmbiguous(soa::Join& collisions, IdBfFullTracksFullPIDAmbiguous const& tracks) - { - filterTracks(collisions, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterTracks, filterRecoWithFullPIDAmbiguous, "Not stored derived data track filtering with ambiguous tracks check", false) - - void filterDetectorLevelWithFullPID(soa::Join& collisions, IdBfFullTracksFullPIDDetLevel const& tracks, aod::McParticles const&) - { - filterTracks(collisions, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterTracks, filterDetectorLevelWithFullPID, "Not stored derived data detector level track filtering", false) - - void filterDetectorLevelWithFullPIDAmbiguous(soa::Join& collisions, IdBfFullTracksFullPIDDetLevelAmbiguous const& tracks, aod::McParticles const&) - { - filterTracks(collisions, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterTracks, filterDetectorLevelWithFullPIDAmbiguous, "Not stored derived data detector level track filtering with ambiguous tracks check", false) - - void filterRecoWithoutPID(soa::Join const& collisions, IdBfFullTracks const& tracks) - { - filterTracks(collisions, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterTracks, filterRecoWithoutPID, "Track filtering without PID information", true) - - void filterRecoWithoutPIDAmbiguous(soa::Join const& collisions, IdBfFullTracksAmbiguous const& tracks) - { - filterTracks(collisions, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterTracks, filterRecoWithoutPIDAmbiguous, "Track filtering without PID information with ambiguous tracks check", false) - - void filterDetectorLevelWithoutPID(soa::Join const& collisions, IdBfFullTracksDetLevel const& tracks, aod::McParticles const&) - { - filterTracks(collisions, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterTracks, filterDetectorLevelWithoutPID, "Detector level track filtering without PID information", false) - - void filterDetectorLevelWithoutPIDAmbiguous(soa::Join const& collisions, IdBfFullTracksDetLevelAmbiguous const& tracks, aod::McParticles const&) - { - filterTracks(collisions, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterTracks, filterDetectorLevelWithoutPIDAmbiguous, "Detector level track filtering without PID information with ambiguous tracks check", false) - - void filterGenerated(soa::Join const& gencollisions, aod::McParticles const& particles) - { - filterParticles(gencollisions, particles); - } - PROCESS_SWITCH(IdentifiedBfFilterTracks, filterGenerated, "Generated particles filtering", true) -}; - -template -inline MatchRecoGenSpecies IdentifiedBfFilterTracks::identifyParticle(ParticleObject const& particle) -{ - using namespace identifiedbffilter; - // LOGF(info, "Top of identifyParticle"); - - int pdgcode = std::fabs(particle.pdgCode()); - - switch (pdgcode) { - case kPositron: - return kIdBfElectron; - break; - - case kPiPlus: - return kIdBfPion; - break; - case kKPlus: - return kIdBfKaon; - break; - case kProton: - return kIdBfProton; - break; - - default: - if (traceOutOfSpeciesParticles) { - LOGF(info, "Wrong particle passed selection cuts. PDG code: %d", pdgcode); - } - return kWrongSpecies; - break; - } -} - -template -inline void IdentifiedBfFilterTracks::identifyPIDMismatch(ParticleObject const& particle, MatchRecoGenSpecies const& trkId) -{ - MatchRecoGenSpecies realPID = identifyParticle(particle); - if (!(realPID < 0)) { - if (realPID == trkId) { - fhTruePIDCorrect->Fill(realPID); - } else { - fhTruePIDMismatch->Fill(realPID, trkId); - } - } -} - -template -inline void IdentifiedBfFilterTracks::identifyRealNSigma(ParticleObject const& particle, std::vector tpcNSigma, std::vector tofNSigma, float tpcInnerParam) -{ - - MatchRecoGenSpecies realPID = identifyParticle(particle); - if (!(realPID < 0)) { - fhTrueNSigmaTPC[kIdBfElectron][realPID]->Fill(tpcNSigma[kIdBfElectron], tpcInnerParam); - fhTrueNSigmaTOF[kIdBfElectron][realPID]->Fill(tofNSigma[kIdBfElectron], tpcInnerParam); - fhTrueNSigmaTPC[kIdBfPion][realPID]->Fill(tpcNSigma[kIdBfPion], tpcInnerParam); - fhTrueNSigmaTOF[kIdBfPion][realPID]->Fill(tofNSigma[kIdBfPion], tpcInnerParam); - fhTrueNSigmaTPC[kIdBfKaon][realPID]->Fill(tpcNSigma[kIdBfKaon], tpcInnerParam); - fhTrueNSigmaTOF[kIdBfKaon][realPID]->Fill(tofNSigma[kIdBfKaon], tpcInnerParam); - fhTrueNSigmaTPC[kIdBfProton][realPID]->Fill(tpcNSigma[kIdBfProton], tpcInnerParam); - fhTrueNSigmaTOF[kIdBfProton][realPID]->Fill(tofNSigma[kIdBfProton], tpcInnerParam); - - if (particle.isPhysicalPrimary()) { - fhPrimaryNSigmaTPC[kIdBfElectron][realPID]->Fill(tpcNSigma[kIdBfElectron], tpcInnerParam); - fhPrimaryNSigmaTOF[kIdBfElectron][realPID]->Fill(tofNSigma[kIdBfElectron], tpcInnerParam); - fhPrimaryNSigmaTPC[kIdBfPion][realPID]->Fill(tpcNSigma[kIdBfPion], tpcInnerParam); - fhPrimaryNSigmaTOF[kIdBfPion][realPID]->Fill(tofNSigma[kIdBfPion], tpcInnerParam); - fhPrimaryNSigmaTPC[kIdBfKaon][realPID]->Fill(tpcNSigma[kIdBfKaon], tpcInnerParam); - fhPrimaryNSigmaTOF[kIdBfKaon][realPID]->Fill(tofNSigma[kIdBfKaon], tpcInnerParam); - fhPrimaryNSigmaTPC[kIdBfProton][realPID]->Fill(tpcNSigma[kIdBfProton], tpcInnerParam); - fhPrimaryNSigmaTOF[kIdBfProton][realPID]->Fill(tofNSigma[kIdBfProton], tpcInnerParam); - } - } -} - -template -void fillNSigmaHistos(TrackObject const& track) -{ - - float actualTPCNSigma[kIdBfNoOfSpecies]; - - actualTPCNSigma[kIdBfElectron] = track.tpcNSigmaEl(); - actualTPCNSigma[kIdBfPion] = track.tpcNSigmaPi(); - actualTPCNSigma[kIdBfKaon] = track.tpcNSigmaKa(); - actualTPCNSigma[kIdBfProton] = track.tpcNSigmaPr(); - - float actualTOFNSigma[kIdBfNoOfSpecies]; - - actualTOFNSigma[kIdBfElectron] = track.tofNSigmaEl(); - actualTOFNSigma[kIdBfPion] = track.tofNSigmaPi(); - actualTOFNSigma[kIdBfKaon] = track.tofNSigmaKa(); - actualTOFNSigma[kIdBfProton] = track.tofNSigmaPr(); - - if (loadfromccdb) { - actualTPCNSigma[kIdBfElectron] = actualTPCNSigma[kIdBfElectron] - fhNSigmaCorrection[kIdBfElectron]->GetBinContent(fhNSigmaCorrection[kIdBfElectron]->FindBin(track.tpcInnerParam())); - actualTPCNSigma[kIdBfPion] = actualTPCNSigma[kIdBfPion] - fhNSigmaCorrection[kIdBfPion]->GetBinContent(fhNSigmaCorrection[kIdBfPion]->FindBin(track.tpcInnerParam())); - actualTPCNSigma[kIdBfKaon] = actualTPCNSigma[kIdBfKaon] - fhNSigmaCorrection[kIdBfKaon]->GetBinContent(fhNSigmaCorrection[kIdBfKaon]->FindBin(track.tpcInnerParam())); - actualTPCNSigma[kIdBfProton] = actualTPCNSigma[kIdBfProton] - fhNSigmaCorrection[kIdBfProton]->GetBinContent(fhNSigmaCorrection[kIdBfProton]->FindBin(track.tpcInnerParam())); - } - - fhNSigmaTPC[kIdBfElectron]->Fill(actualTPCNSigma[kIdBfElectron], track.tpcInnerParam()); - fhNSigmaTPC[kIdBfPion]->Fill(actualTPCNSigma[kIdBfPion], track.tpcInnerParam()); - fhNSigmaTPC[kIdBfKaon]->Fill(actualTPCNSigma[kIdBfKaon], track.tpcInnerParam()); - fhNSigmaTPC[kIdBfProton]->Fill(actualTPCNSigma[kIdBfProton], track.tpcInnerParam()); - - fhNSigmaTOF[kIdBfElectron]->Fill(actualTOFNSigma[kIdBfElectron], track.tpcInnerParam()); - fhNSigmaTOF[kIdBfPion]->Fill(actualTOFNSigma[kIdBfPion], track.tpcInnerParam()); - fhNSigmaTOF[kIdBfKaon]->Fill(actualTOFNSigma[kIdBfKaon], track.tpcInnerParam()); - fhNSigmaTOF[kIdBfProton]->Fill(actualTOFNSigma[kIdBfProton], track.tpcInnerParam()); - - fhNSigmaCombo[kIdBfElectron]->Fill(sqrtf(actualTOFNSigma[kIdBfElectron] * actualTOFNSigma[kIdBfElectron] + actualTPCNSigma[kIdBfElectron] * actualTPCNSigma[kIdBfElectron]), track.tpcInnerParam()); - fhNSigmaCombo[kIdBfPion]->Fill(sqrtf(actualTOFNSigma[kIdBfPion] * actualTOFNSigma[kIdBfPion] + actualTPCNSigma[kIdBfPion] * actualTPCNSigma[kIdBfPion]), track.tpcInnerParam()); - fhNSigmaCombo[kIdBfKaon]->Fill(sqrtf(actualTOFNSigma[kIdBfKaon] * actualTOFNSigma[kIdBfKaon] + actualTPCNSigma[kIdBfKaon] * actualTPCNSigma[kIdBfKaon]), track.tpcInnerParam()); - fhNSigmaCombo[kIdBfProton]->Fill(sqrtf(actualTOFNSigma[kIdBfProton] * actualTOFNSigma[kIdBfProton] + actualTPCNSigma[kIdBfProton] * actualTPCNSigma[kIdBfProton]), track.tpcInnerParam()); -} - -/// \brief Identifies the passed track with TPC and TOF data -/// \param track the track of interest -/// \return the internal track id, -1 if not accepted - -template -inline MatchRecoGenSpecies IdentifiedBfFilterTracks::identifyTrack(TrackObject const& track) -{ - using namespace o2::analysis::identifiedbffilter; - - fillNSigmaHistos(track); - - std::vector actualTPCNSigma(kIdBfNoOfSpecies, 0.); - - actualTPCNSigma[kIdBfElectron] = track.tpcNSigmaEl(); - actualTPCNSigma[kIdBfPion] = track.tpcNSigmaPi(); - actualTPCNSigma[kIdBfKaon] = track.tpcNSigmaKa(); - actualTPCNSigma[kIdBfProton] = track.tpcNSigmaPr(); - - std::vector actualTOFNSigma(kIdBfNoOfSpecies, 0.); - - actualTOFNSigma[kIdBfElectron] = track.tofNSigmaEl(); - actualTOFNSigma[kIdBfPion] = track.tofNSigmaPi(); - actualTOFNSigma[kIdBfKaon] = track.tofNSigmaKa(); - actualTOFNSigma[kIdBfProton] = track.tofNSigmaPr(); - - float nsigmas[kIdBfNoOfSpecies]; - - if constexpr (framework::has_type_v) { - if (makeNSigmaPlots) { - identifyRealNSigma(track.template mcParticle_as(), actualTPCNSigma, actualTOFNSigma, track.tpcInnerParam()); - } - } - - if (loadfromccdb) { - for (int iSp = 0; iSp < kIdBfNoOfSpecies; iSp++) { - actualTPCNSigma[iSp] = actualTPCNSigma[iSp] - fhNSigmaCorrection[iSp]->GetBinContent(fhNSigmaCorrection[iSp]->FindBin(track.tpcInnerParam())); - } - } - - for (int iSp = 0; iSp < kIdBfNoOfSpecies; iSp++) { - - if (track.tpcInnerParam() < tofCut[iSp] && track.tpcInnerParam() < tpcCut[iSp] && !onlyTOF) { - nsigmas[iSp] = actualTPCNSigma[iSp]; - } else if (track.tpcInnerParam() > tofCut[iSp] && track.tpcInnerParam() < tpcCut[iSp] && !onlyTOF && track.hasTOF()) { - nsigmas[iSp] = sqrtf(actualTPCNSigma[iSp] * actualTPCNSigma[iSp] + actualTOFNSigma[iSp] * actualTOFNSigma[iSp]); - } else if (track.hasTOF() && ((track.tpcInnerParam() > tofCut[iSp] && track.tpcInnerParam() > tpcCut[iSp]) || onlyTOF)) { - nsigmas[iSp] = actualTOFNSigma[iSp]; - } else { - return kWrongSpecies; - } - } - - float minNSigma = 999.0f; - MatchRecoGenSpecies spMinNSigma = kWrongSpecies; - for (int sp = 0; sp < kIdBfNoOfSpecies; ++sp) { - if (doPID[sp]) { // Check if we're IDing PID for this species - if (std::fabs(nsigmas[sp]) < std::fabs(minNSigma)) { // Check if species nsigma is less than current nsigma - minNSigma = nsigmas[sp]; // If yes, set species nsigma to current nsigma - spMinNSigma = MatchRecoGenSpecies(sp); // set current species sp number to current sp - } - } - } - bool doublematch = false; - MatchRecoGenSpecies spDouble = kWrongSpecies; - // LOGF(info,"Looking at accept range"); - if (minNSigma < acceptRange[spMinNSigma][1] && minNSigma > acceptRange[spMinNSigma][0]) { // Check that current nsigma is in accpetance range - // LOGF(info,"In accept Range"); - for (int sp = 0; (sp < kIdBfNoOfSpecies) && !doublematch; ++sp) { // iterate over all species while there's no double match and we're in the list - if (sp != spMinNSigma) { // for species not current minimum nsigma species - // LOGF(info, "looking at Reject Range"); - if (std::fabs(nsigmas[sp]) < rejectRange[spMinNSigma][sp]) { // If secondary species is in rejection range - doublematch = true; // Set double match true - spDouble = MatchRecoGenSpecies(sp); - } - } - } - if (doublematch) { // if double match true - fhWrongTrackID->Fill(track.p()); - fhdEdxA[kIdBfNoOfSpecies]->Fill(track.p(), track.tpcSignal()); - fhdEdxIPTPCA[kIdBfNoOfSpecies]->Fill(track.tpcInnerParam(), track.tpcSignal()); - fhTrackLengthA[kIdBfNoOfSpecies]->Fill(track.length()); - fhTrackTimeA[kIdBfNoOfSpecies]->Fill(track.p(), (track.trackTime())); - fhTrackTimeIPA[kIdBfNoOfSpecies]->Fill(track.tpcInnerParam(), (track.trackTime())); - - if constexpr (framework::has_type_v) { - fhTrackBetaInvA[kIdBfNoOfSpecies]->Fill(track.p(), 1 / track.beta()); - fhTrackBetaInvIPA[kIdBfNoOfSpecies]->Fill(track.tpcInnerParam(), 1 / track.beta()); - } - fhDoublePID->Fill(spMinNSigma, spDouble); - return kWrongSpecies; // Return wrong species value - } else { - fhNSigmaTPCIdTrks[spMinNSigma]->Fill(actualTPCNSigma[spMinNSigma], track.tpcInnerParam()); - - if constexpr (framework::has_type_v) { - identifyPIDMismatch(track.template mcParticle_as(), spMinNSigma); - } - return spMinNSigma; - } - } else { - return kWrongSpecies; - } -} - -/// \brief Accepts or not the passed track -/// \param track the track of interest -/// \return the internal track id, -1 if not accepted - -template -inline int8_t IdentifiedBfFilterTracks::acceptTrack(TrackObject const& track) -{ - // LOGF(info,"Top of acceptTrack"); - fillTrackHistosBeforeSelection(track); // ) { - if (track.mcParticleId() < 0) { - // LOGF(info,"No matching MC particle"); - return -1; - } - } - - if (matchTrackType(track)) { - // LOGF(info, "Track type match"); - if (ptlow < track.pt() && track.pt() < ptup && etalow < track.eta() && track.eta() < etaup) { - // LOGF(info, "Track Accepted"); - fillTrackHistosAfterSelection(track, kIdBfCharged); - MatchRecoGenSpecies sp = kWrongSpecies; - if (recoIdMethod == recoIdMethods[0]) { - sp = kIdBfCharged; - } else if (recoIdMethod == recoIdMethods[1]) { - if constexpr (framework::has_type_v || framework::has_type_v) { - sp = identifyTrack(track); - } else { - LOGF(fatal, "Track identification required but PID information not present"); - } - } else if (recoIdMethod == recoIdMethods[2]) { - if constexpr (framework::has_type_v) { - sp = identifyParticle(track.template mcParticle_as()); - } else { - LOGF(fatal, "Track identification required from MC particle but MC information not present"); - } - } - if (sp == kWrongSpecies) { - return -1; - } - if (!(sp < 0)) { - fillTrackHistosAfterSelection(track, sp); // 0) { // if positive - trkMultPos[sp]++; //<< Update Particle Multiplicity - return speciesChargeValue1[sp]; - } - if (track.sign() < 0) { // if negative - trkMultNeg[sp]++; //<< Update Particle Multiplicity - return speciesChargeValue1[sp] + 1; - } - } - } - } - return -1; -} - -/// \brief Accepts or not the passed generated particle -/// \param track the particle of interest -/// \return `true` if the particle is accepted, `false` otherwise -template -inline int8_t IdentifiedBfFilterTracks::acceptParticle(ParticleObject& particle, MCCollisionObject const& mccollision) -{ - /* overall momentum cut */ - if (!(overallminp < particle.p())) { - return kWrongSpecies; - } - TParticlePDG* pdgpart = fPDG->GetParticle(particle.pdgCode()); - float charge = 0; - if (pdgpart != nullptr) { - charge = getCharge(pdgpart->Charge()); - } - if ((particle.flags() & 0x8) != 0x8) { - if (particle.isPhysicalPrimary() && std::fabs(charge) > 0.0) { - if ((particle.mcCollisionId() == 0) && traceCollId0) { - LOGF(info, "Particle %d passed isPhysicalPrimary", particle.globalIndex()); - } - - if (ptlow < particle.pt() && particle.pt() < ptup && etalow < particle.eta() && particle.eta() < etaup) { - MatchRecoGenSpecies sp = kWrongSpecies; - if (recoIdMethod == recoIdMethods[0]) { - sp = kIdBfCharged; - } - if (recoIdMethod == recoIdMethods[1] || recoIdMethod == recoIdMethods[2]) { - sp = identifyParticle(particle); - } - - if (sp != kWrongSpecies) { - if (sp != kIdBfCharged) { - /* fill the charged particle histograms */ - fillParticleHistosAfterSelection(particle, mccollision, charge, kIdBfCharged); - /* update charged multiplicities */ - if (charge == 1) { - partMultPos[kIdBfCharged]++; - } else if (charge == -1) { - partMultNeg[kIdBfCharged]++; - } - } - /* fill the species histograms */ - fillParticleHistosAfterSelection(particle, mccollision, charge, sp); - /* update species multiplicities */ - if (charge == 1) { - partMultPos[sp]++; - } else if (charge == -1) { - partMultNeg[sp]++; - } - } - if (charge == 1) { - return speciesChargeValue1[sp]; - - } else if (charge == -1) { - return speciesChargeValue1[sp] + 1; - } - } - } else { - if ((particle.mcCollisionId() == 0) && traceCollId0) { - LOGF(info, "Particle %d NOT passed isPhysicalPrimary", particle.globalIndex()); - } - } - } else { - if ((particle.mcCollisionId() == 0) && traceCollId0) { - LOGF(info, "Particle %d Out of Bunch Pileup", particle.globalIndex()); - } - } - return kWrongSpecies; -} - -template -int8_t IdentifiedBfFilterTracks::selectTrackAmbiguousCheck(CollisionObjects const& collisions, TrackObject const& track) -{ - // LOGF(info,"Top of AmbiguousCheck"); - bool ambiguoustrack = false; - int tracktype = 0; /* no ambiguous */ - std::vector zvertexes{}; - /* ambiguous tracks checks if required */ - if constexpr (has_type_v) { - if (track.compatibleCollIds().size() > 0) { - if (track.compatibleCollIds().size() == 1) { - if (track.collisionId() != track.compatibleCollIds()[0]) { - /* ambiguous track! */ - ambiguoustrack = true; - /* in principle we should not be here because the track is associated to two collisions at least */ - tracktype = 2; - zvertexes.push_back(collisions.iteratorAt(track.collisionId()).posZ()); - zvertexes.push_back(collisions.iteratorAt(track.compatibleCollIds()[0]).posZ()); - } else { - /* we consider the track as no ambiguous */ - tracktype = 1; - } - } else { - /* ambiguous track! */ - ambiguoustrack = true; - tracktype = 3; - /* the track is associated to more than one collision */ - for (const auto& collIdx : track.compatibleCollIds()) { - zvertexes.push_back(collisions.iteratorAt(collIdx).posZ()); - } - } - } - } - - float multiplicityclass = (track.template collision_as>()).centmult(); - if (ambiguoustrack) { - /* keep track of ambiguous tracks */ - fhAmbiguousTrackType->Fill(tracktype, multiplicityclass); - fhAmbiguousTrackPt->Fill(track.pt(), multiplicityclass); - fhAmbiguityDegree->Fill(zvertexes.size(), multiplicityclass); - if (tracktype == trackTypes[2]) { - fhCompatibleCollisionsZVtxRms->Fill(-computeRMS(zvertexes), multiplicityclass); - } else { - fhCompatibleCollisionsZVtxRms->Fill(computeRMS(zvertexes), multiplicityclass); - } - return -1; - } else { - if (checkAmbiguousTracks) { - /* feedback of no ambiguous tracks only if checks required */ - fhAmbiguousTrackType->Fill(tracktype, multiplicityclass); - } - return acceptTrack(track); - } -} - -template -void IdentifiedBfFilterTracks::fillTrackHistosBeforeSelection(TrackObject const& track) -{ - fhXYB->Fill(track.x(), track.y()); - fhYZB->Fill(track.y(), track.z()); - fhNClustersB->Fill(track.tpcNClsFound()); - fhPhiYB->Fill(track.phi(), track.eta()); - fhPtYB->Fill(track.pt(), track.eta()); - fhChi2B->Fill(track.tpcChi2NCl()); - fhITSNclB->Fill(track.itsNCls()); - - fhPB->Fill(track.p()); - fhPtB->Fill(track.pt()); - fhEtaB->Fill(track.eta()); - fhPhiB->Fill(track.phi()); - fhdEdxB->Fill(track.p(), track.tpcSignal()); - fhdEdxIPTPCB->Fill(track.tpcInnerParam(), track.tpcSignal()); - if (track.sign() > 0) { - fhPtPosB->Fill(track.pt()); - } else { - fhPtNegB->Fill(track.pt()); - } - fhDCAxyB->Fill(track.dcaXY()); - fhDCAzB->Fill(track.dcaZ()); - fhDCAxyzB->Fill(track.dcaXY(), track.dcaZ()); - - if constexpr (framework::has_type_v) { - - if (isPrimary(track.template mcParticle_as())) { - fhPrimaryPB->Fill(track.p()); - fhPrimaryPtB->Fill(track.pt()); - fhPrimarydEdxB->Fill(track.p(), track.tpcSignal()); - fhPrimarydEdxIPTPCB->Fill(track.tpcInnerParam(), track.tpcSignal()); - fhPrimaryTrackLengthB->Fill(track.length()); - if (track.hasTOF() && track.p() > tofCut[0]) { - fhPrimaryTrackLengthTOFB->Fill(track.length()); - fhPrimaryTrackTimeB->Fill(track.p(), (track.trackTime())); - fhPrimaryTrackTimeIPB->Fill(track.tpcInnerParam(), (track.trackTime())); - - if constexpr (framework::has_type_v) { - fhPrimaryTrackBetaInvB->Fill(track.p(), 1 / track.beta()); - fhPrimaryTrackBetaInvIPB->Fill(track.tpcInnerParam(), 1 / track.beta()); - } - } - } - } -} -template -bool IdentifiedBfFilterTracks::isPrimary(ParticleObject const& particle) -{ - return particle.isPhysicalPrimary(); -} -template -void IdentifiedBfFilterTracks::fillRealPIDTrackHistosAfter(TrackObject const& track, MatchRecoGenSpecies sp) -{ - - if constexpr (framework::has_type_v) { - MatchRecoGenSpecies realPID = identifyParticle(track.template mcParticle_as()); - if (!(realPID < 0)) { - fhTruedEdxA[realPID]->Fill(track.p(), track.tpcSignal()); - fhTruedEdxIPTPCA[realPID]->Fill(track.tpcInnerParam(), track.tpcSignal()); - fhTrueTrackLengthA[realPID]->Fill(track.length()); - if (track.hasTOF() && track.p() > tofCut[realPID]) { - fhTrueTrackLengthTOFA[realPID]->Fill(track.length()); - fhTrueTrackTimeA[realPID]->Fill(track.p(), (track.trackTime())); - fhTrueTrackTimeIPA[realPID]->Fill(track.tpcInnerParam(), (track.trackTime())); - if constexpr (framework::has_type_v) { - fhTrueTrackBetaInvA[realPID]->Fill(track.p(), 1 / track.beta()); - fhTrueTrackBetaInvIPA[realPID]->Fill(track.tpcInnerParam(), 1 / track.beta()); - } - } - } - - if (isPrimary(track.template mcParticle_as())) { - fhPrimaryPA[sp]->Fill(track.p()); - fhPrimaryPtA[sp]->Fill(track.pt()); - fhPrimarydEdxA[sp]->Fill(track.p(), track.tpcSignal()); - fhPrimarydEdxIPTPCA[sp]->Fill(track.tpcInnerParam(), track.tpcSignal()); - fhPrimaryTrackLengthA[sp]->Fill(track.length()); - if (track.hasTOF() && track.p() > tofCut[sp]) { - fhPrimaryTrackLengthTOFA[sp]->Fill(track.length()); - fhPrimaryTrackTimeA[sp]->Fill(track.p(), (track.trackTime())); - fhPrimaryTrackTimeIPA[sp]->Fill(track.tpcInnerParam(), (track.trackTime())); - - if constexpr (framework::has_type_v) { - fhPrimaryTrackBetaInvA[sp]->Fill(track.p(), 1 / track.beta()); - fhPrimaryTrackBetaInvIPA[sp]->Fill(track.tpcInnerParam(), 1 / track.beta()); - } - } - - if (sp == realPID) { - fhPurePA[realPID]->Fill(track.p()); - fhPurePtA[realPID]->Fill(track.pt()); - fhPuredEdxA[realPID]->Fill(track.p(), track.tpcSignal()); - fhPuredEdxIPTPCA[realPID]->Fill(track.tpcInnerParam(), track.tpcSignal()); - fhPureTrackLengthA[realPID]->Fill(track.length()); - if (track.hasTOF() && track.p() > tofCut[realPID]) { - fhPureTrackLengthTOFA[realPID]->Fill(track.length()); - fhPureTrackTimeA[realPID]->Fill(track.p(), (track.trackTime())); - fhPureTrackTimeIPA[realPID]->Fill(track.tpcInnerParam(), (track.trackTime())); - - if constexpr (framework::has_type_v) { - fhPureTrackBetaInvA[realPID]->Fill(track.p(), 1 / track.beta()); - fhPureTrackBetaInvIPA[realPID]->Fill(track.tpcInnerParam(), 1 / track.beta()); - } - } - } - } - } -} -template -void IdentifiedBfFilterTracks::fillTrackHistosAfterSelection(TrackObject const& track, MatchRecoGenSpecies sp) -{ - /* the charged species should have been called first so avoid double counting */ - // LOGF(info,"Top of AfterSelection"); - if (sp == kIdBfCharged) { - fhEtaA->Fill(track.eta()); - fhPhiA->Fill(track.phi()); - fhXYA->Fill(track.x(), track.y()); - fhYZA->Fill(track.y(), track.z()); - fhNClustersA->Fill(track.tpcNClsFound()); - fhPhiYA->Fill(track.phi(), track.eta()); - fhPtYA->Fill(track.pt(), track.eta()); - fhChi2A->Fill(track.tpcChi2NCl()); - fhITSNclA->Fill(track.itsNCls()); - fhDCAxyA->Fill(track.dcaXY()); - fhDCAzA->Fill(track.dcaZ()); - fhDCAxyzA->Fill(track.dcaXY(), track.dcaZ()); - - if (track.dcaXY() < 1.0) { - fhFineDCAxyA->Fill(track.dcaXY()); - } - if (track.dcaZ() < 1.0) { - fhFineDCAzA->Fill(track.dcaZ()); - } - } - fhPA[sp]->Fill(track.p()); - fhPtA[sp]->Fill(track.pt()); - fhdEdxA[sp]->Fill(track.p(), track.tpcSignal()); - fhdEdxIPTPCA[sp]->Fill(track.tpcInnerParam(), track.tpcSignal()); - fhTrackLengthA[sp]->Fill(track.length()); - if (track.hasTOF() && track.p() > tofCut[sp]) { - fhTrackLengthTOFA[sp]->Fill(track.length()); - fhTrackTimeA[sp]->Fill(track.p(), (track.trackTime())); - fhTrackTimeIPA[sp]->Fill(track.tpcInnerParam(), (track.trackTime())); - - if constexpr (framework::has_type_v) { - fhTrackBetaInvA[sp]->Fill(track.p(), 1 / track.beta()); - fhTrackBetaInvIPA[sp]->Fill(track.tpcInnerParam(), 1 / track.beta()); - } - } - if (track.sign() > 0) { - fhPtPosA[sp]->Fill(track.pt()); - fhPtEtaPosA[sp]->Fill(track.pt(), track.eta()); - } else { - fhPtNegA[sp]->Fill(track.pt()); - fhPtEtaNegA[sp]->Fill(track.pt(), track.eta()); - } - if ((fDataType != kData) && (fDataType != kDataNoEvtSel)) { - fillRealPIDTrackHistosAfter(track, sp); - } -} - -template -void IdentifiedBfFilterTracks::fillParticleHistosBeforeSelection(ParticleObject const& particle, MCCollisionObject const& collision, float charge) -{ - fhTruePhiYB->Fill(particle.phi(), particle.eta()); - fhTruePtYB->Fill(particle.pt(), particle.eta()); - fhTruePB->Fill(particle.p()); - fhTruePtB->Fill(particle.pt()); - fhTrueEtaB->Fill(particle.eta()); - fhTruePhiB->Fill(particle.phi()); - if (charge > 0) { - fhTruePtPosB->Fill(particle.pt()); - } else if (charge < 0) { - fhTruePtNegB->Fill(particle.pt()); - } - - float dcaxy = std::sqrt((particle.vx() - collision.posX()) * (particle.vx() - collision.posX()) + - (particle.vy() - collision.posY()) * (particle.vy() - collision.posY())); - if (traceDCAOutliers.mDoIt && (traceDCAOutliers.mLowValue < dcaxy) && (dcaxy < traceDCAOutliers.mUpValue)) { - fhTrueDCAxyBid->Fill(TString::Format("%d", particle.pdgCode()).Data(), 1.0); - } - - fhTrueDCAxyB->Fill(std::sqrt((particle.vx() - collision.posX()) * (particle.vx() - collision.posX()) + - (particle.vy() - collision.posY()) * (particle.vy() - collision.posY()))); - fhTrueDCAxyzB->Fill(std::sqrt((particle.vx() - collision.posX()) * (particle.vx() - collision.posX()) + - (particle.vy() - collision.posY()) * (particle.vy() - collision.posY())), - (particle.vz() - collision.posZ())); - fhTrueDCAzB->Fill((particle.vz() - collision.posZ())); -} - -template -void IdentifiedBfFilterTracks::fillParticleHistosAfterSelection(ParticleObject const& particle, MCCollisionObject const& collision, float charge, MatchRecoGenSpecies sp) -{ - /* the charged species should have been called first so avoid double counting */ - if (sp == kIdBfCharged) { - fhTruePhiYA->Fill(particle.phi(), particle.eta()); - fhTruePtYA->Fill(particle.pt(), particle.eta()); - fhTrueEtaA->Fill(particle.eta()); - fhTruePhiA->Fill(particle.phi()); - float dcaxy = std::sqrt((particle.vx() - collision.posX()) * (particle.vx() - collision.posX()) + - (particle.vy() - collision.posY()) * (particle.vy() - collision.posY())); - if (traceDCAOutliers.mDoIt && (traceDCAOutliers.mLowValue < dcaxy) && (dcaxy < traceDCAOutliers.mUpValue)) { - LOGF(info, "DCAxy outlier: Particle with index %d and pdg code %d assigned to MC collision %d, pT: %f, phi: %f, eta: %f", - particle.globalIndex(), particle.pdgCode(), particle.mcCollisionId(), particle.pt(), particle.phi(), particle.eta()); - LOGF(info, " With status %d and flags %0X", particle.statusCode(), particle.flags()); - } - - fhTrueDCAxyA->Fill(std::sqrt((particle.vx() - collision.posX()) * (particle.vx() - collision.posX()) + - (particle.vy() - collision.posY()) * (particle.vy() - collision.posY()))); - fhTrueDCAzA->Fill((particle.vz() - collision.posZ())); - fhTrueDCAxyzA->Fill(std::sqrt((particle.vx() - collision.posX()) * (particle.vx() - collision.posX()) + - (particle.vy() - collision.posY()) * (particle.vy() - collision.posY())), - (particle.vz() - collision.posZ())); - } - fhTruePA[sp]->Fill(particle.p()); - fhTruePtA[sp]->Fill(particle.pt()); - if (charge > 0) { - fhTruePtPosA[sp]->Fill(particle.pt()); - fhTruePtEtaPosA[sp]->Fill(particle.pt(), particle.eta()); - } else { - fhTruePtNegA[sp]->Fill(particle.pt()); - fhTruePtEtaNegA[sp]->Fill(particle.pt(), particle.eta()); - } -} -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - WorkflowSpec workflow{adaptAnalysisTask(cfgc, - SetDefaultProcesses{ - {{"processWithoutCent", true}, - {"processWithoutCentGeneratorLevel", true}}}), - adaptAnalysisTask(cfgc)}; - return workflow; -} diff --git a/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.h b/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.h deleted file mode 100644 index 7335b36c421..00000000000 --- a/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.h +++ /dev/null @@ -1,775 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file identifiedBfFilter.h -/// \brief Filters collisions and tracks according to selection criteria -/// \author bghanley1995@gmail.com - -#ifndef PWGCF_TWOPARTICLECORRELATIONS_TABLEPRODUCER_IDENTIFIEDBFFILTER_H_ -#define PWGCF_TWOPARTICLECORRELATIONS_TABLEPRODUCER_IDENTIFIEDBFFILTER_H_ - -#include - -#include -#include - -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/runDataProcessing.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/TrackSelectionDefaults.h" -#include "PWGCF/Core/AnalysisConfigurableCuts.h" -#include "MathUtils/Utils.h" - -namespace o2 - -{ -namespace aod -{ -using CollisionsEvSelCent = soa::Join; -using CollisionEvSelCent = soa::Join::iterator; -using CollisionsEvSelRun2Cent = soa::Join; -using CollisionEvSelRun2Cent = soa::Join::iterator; -using CollisionsEvSel = soa::Join; -using CollisionEvSel = soa::Join::iterator; -using TrackData = soa::Join::iterator; -} // namespace aod -namespace analysis -{ -namespace identifiedbffilter -{ - -const std::vector pdgcodes = {11, 211, 321, 2212}; - -/// \enum MatchRecoGenSpecies -/// \brief The species considered by the matching test -enum MatchRecoGenSpecies { - kIdBfElectron = 0, ///< electron - kIdBfPion, ///< pion - kIdBfKaon, ///< kaon - kIdBfProton, ///< proton - kIdBfNoOfSpecies, ///< the number of considered species - kIdBfCharged = 4, - kWrongSpecies = -1 -}; - -/// \enum SpeciesPairMatch -/// \brief The species pair considered by the matching test -enum SpeciesPairMatch { - kIdBfElectronElectron, ///< Electron-Electron,Electron-Positron - kIdBfElectronMuon, ///< Electron-Muon - kIdBfElectronPion, ///< Electron-Pion - kIdBfElectronKaon, ///< Electron-Kaon - kIdBfElectronProton, ///< Electron-Proton - kIdBfMuonMuon, ///< Muon-Muon - kIdBfMuonPion, ///< Muon-Pion - kIdBfMuonKaon, ///< Muon-Kaon - kIdBfMuonProton, ///< Muon-Proton - kIdBfPionPion, ///< Pion-Pion - kIdBfPionKaon, ///< Pion-Kaon - kIdBfPionProton, ///< Pion-Proton - kIdBfKaonKaon, ///< Kaon-Kaon - kIdBfKaonProton, ///< Kaon-Proton - kIdBfProtonProton ///< Proton-Proton -}; - -const char* speciesName[kIdBfNoOfSpecies + 1] = {"e", "pi", "ka", "p", "ha"}; - -const char* speciesTitle[kIdBfNoOfSpecies + 1] = {"e", "#pi", "K", "p", "ha"}; - -const int speciesChargeValue1[kIdBfNoOfSpecies] = { - 0, //< electron - 2, //< pion - 4, //< Kaon - 6 //< proton -}; - -/// \enum SystemType -/// \brief The type of the system under analysis -enum SystemType { - kNoSystem = 0, ///< no system defined - kpp, ///< **p-p** system - kpPb, ///< **p-Pb** system - kPbp, ///< **Pb-p** system - kPbPb, ///< **Pb-Pb** system - kXeXe, ///< **Xe-Xe** system - kppRun3, ///< **p-p Run 3** system - kPbPbRun3, ///< **Pb-Pb Run 3** system - knSystems ///< number of handled systems -}; - -/// \enum DataType -/// \brief Which kind of data is the task addressing -enum DataType { - kData = 0, ///< actual data, not generated - kMC, ///< Generator level and detector level - kFastMC, ///< Gererator level but stored dataset - kOnTheFly, ///< On the fly generator level data - kDataNoEvtSel, ///< actual data but not event selection available yet - knGenData ///< number of different generator data types -}; - -/// \enum CentMultEstimatorType -/// \brief The detector used to estimate centrality/multiplicity -enum CentMultEstimatorType { - kNOCM = 0, ///< do not use centrality/multiplicity estimator - kV0M, ///< V0M centrality/multiplicity estimator Run 1/2 - kCL0, ///< CL0 centrality/multiplicity estimator Run 1/2 - kCL1, ///< CL1 centrality/multiplicity estimator Run 1/2 - kFV0A, ///< FV0A centrality/multiplicity estimator Run 3 - kFT0M, ///< FT0M centrality/multiplicity estimator Run 3 - kFT0A, ///< FT0A centrality/multiplicity estimator Run 3 - kFT0C, ///< FT0C centrality/multiplicity estimator Run 3 - kNTPV, ///< NTPV centrality/multiplicity estimator Run 3 - knCentMultEstimators ///< number of centrality/mutiplicity estimator -}; - -float overallminp = 0.0f; - -/// \enum TriggerSelectionType -/// \brief The type of trigger to apply for event selection -enum TriggerSelectionType { - kNONE = 0, ///< do not use trigger selection - kMB, ///< Minimum bias trigger - knEventSelection ///< number of triggers for event selection -}; - -//============================================================================================ -// The IdentifiedBfFilter configuration objects -//============================================================================================ -int ptbins = 18; -float ptlow = 0.2, ptup = 2.0; -int etabins = 16; -float etalow = -0.8, etaup = 0.8; -int zvtxbins = 40; -float zvtxlow = -10.0, zvtxup = 10.0; -int phibins = 72; -float philow = 0.0; -float phiup = constants::math::TwoPI; - -std::vector> acceptRange; -std::vector> rejectRange; - -std::vector doPID; -std::vector tofCut; -std::vector tpcCut; - -int tracktype = 1; - -std::vector trackFilters = {}; -bool dca2Dcut = false; -float maxDCAz = 1e6f; -float maxDCAxy = 1e6f; - -inline void initializeTrackSelection() -{ - switch (tracktype) { - case 1: { /* Run2 global track */ - TrackSelection* globalRun2 = new TrackSelection(getGlobalTrackSelection()); - globalRun2->SetTrackType(o2::aod::track::Run2Track); // Run 2 track asked by default - globalRun2->SetMaxChi2PerClusterTPC(2.5f); - TrackSelection* globalSDDRun2 = new TrackSelection(getGlobalTrackSelectionSDD()); - globalSDDRun2->SetTrackType(o2::aod::track::Run2Track); // Run 2 track asked by default - globalSDDRun2->SetMaxChi2PerClusterTPC(2.5f); - trackFilters.push_back(globalRun2); - trackFilters.push_back(globalSDDRun2); - } break; - case 3: { /* Run3 track */ - TrackSelection* globalRun3 = new TrackSelection(getGlobalTrackSelection()); - globalRun3->SetTrackType(o2::aod::track::TrackTypeEnum::Track); - globalRun3->ResetITSRequirements(); - globalRun3->SetRequireHitsInITSLayers(1, {0, 1, 2}); - TrackSelection* globalSDDRun3 = new TrackSelection(getGlobalTrackSelection()); - globalSDDRun3->SetTrackType(o2::aod::track::TrackTypeEnum::Track); - globalSDDRun3->ResetITSRequirements(); - globalSDDRun3->SetRequireNoHitsInITSLayers({0, 1, 2}); - globalSDDRun3->SetRequireHitsInITSLayers(1, {3}); - trackFilters.push_back(globalRun3); - trackFilters.push_back(globalSDDRun3); - } break; - case 5: { /* Run2 TPC only track */ - TrackSelection* tpcOnly = new TrackSelection; - tpcOnly->SetTrackType(o2::aod::track::Run2Track); // Run 2 track asked by default - tpcOnly->SetMinNClustersTPC(50); - tpcOnly->SetMaxChi2PerClusterTPC(4); - tpcOnly->SetMaxDcaZ(3.2f); - maxDCAz = 3.2; - tpcOnly->SetMaxDcaXY(2.4f); - maxDCAxy = 2.4; - dca2Dcut = true; - trackFilters.push_back(tpcOnly); - } break; - case 7: { /* Run3 TPC only track */ - TrackSelection* tpcOnly = new TrackSelection; - tpcOnly->SetTrackType(o2::aod::track::TrackTypeEnum::Track); - tpcOnly->SetMinNClustersTPC(50); - tpcOnly->SetMaxChi2PerClusterTPC(4); - tpcOnly->SetMaxDcaZ(3.2f); - maxDCAz = 3.2; - tpcOnly->SetMaxDcaXY(2.4f); - maxDCAxy = 2.4; - dca2Dcut = true; - trackFilters.push_back(tpcOnly); - } break; - default: - break; - } -} - -SystemType fSystem = kNoSystem; -DataType fDataType = kData; -CentMultEstimatorType fCentMultEstimator = kV0M; -TriggerSelectionType fTriggerSelection = kMB; - -/* adaptations for the pp nightly checks */ -analysis::CheckRangeCfg traceDCAOutliers; -bool traceOutOfSpeciesParticles = false; -int recoIdMethod = 0; -bool useOwnTrackSelection = false; -TrackSelection ownTrackSelection = getGlobalTrackSelection(); -bool useOwnParticleSelection = false; -float particleMaxDCAxy = 999.9f; -float particleMaxDCAZ = 999.9f; -bool traceCollId0 = false; - -inline TriggerSelectionType getTriggerSelection(std::string const& triggstr) -{ - if (triggstr.empty() || triggstr == "MB") { - return kMB; - } else if (triggstr == "None") { - return kNONE; - } else { - LOGF(fatal, "Wrong trigger selection: %s", triggstr.c_str()); - return kNONE; - } -} - -inline SystemType getSystemType(std::string const& sysstr) -{ - /* we have to figure out how extract the system type */ - if (sysstr.empty() || (sysstr == "PbPb")) { - return kPbPb; - } else if (sysstr == "pp") { - return kpp; - } else if (sysstr == "pPb") { - return kpPb; - } else if (sysstr == "Pbp") { - return kPbp; - } else if (sysstr == "pPb") { - return kpPb; - } else if (sysstr == "XeXe") { - return kXeXe; - } else if (sysstr == "ppRun3") { - return kppRun3; - } else if (sysstr == "PbPbRun3") { - return kPbPbRun3; - } else { - LOGF(fatal, "IdentifiedBfCorrelations::getSystemType(). Wrong system type: %s", sysstr.c_str()); - } - return kPbPb; -} - -/// \brief Type of data according to the configuration string -/// \param datastr The data type configuration string -/// \return Internal code for the passed kind of data string -inline DataType getDataType(std::string const& datastr) -{ - /* we have to figure out how extract the type of data*/ - if (datastr.empty() || (datastr == "data")) { - return kData; - } else if (datastr == "datanoevsel") { - return kDataNoEvtSel; - } else if (datastr == "MC") { - return kMC; - } else if (datastr == "FastMC") { - return kFastMC; - } else if (datastr == "OnTheFlyMC") { - return kOnTheFly; - } else { - LOGF(fatal, "IdentifiedBfCorrelations::getDataType(). Wrong type of dat: %d", datastr.c_str()); - } - return kData; -} - -inline CentMultEstimatorType getCentMultEstimator(std::string const& datastr) -{ - if (datastr == "V0M") { - return kV0M; - } else if (datastr == "CL0") { - return kCL0; - } else if (datastr == "CL1") { - return kCL1; - } else if (datastr == "FV0A") { - return kFV0A; - } else if (datastr == "FT0M") { - return kFT0M; - } else if (datastr == "FT0A") { - return kFT0A; - } else if (datastr == "FT0C") { - return kFT0C; - } else if (datastr == "NTPV") { - return kNTPV; - } else if (datastr == "NOCM") { - return kNOCM; - } else { - LOGF(fatal, "Centrality/Multiplicity estimator %s not supported yet", datastr.c_str()); - } - return kNOCM; -} - -inline std::string getCentMultEstimatorName(CentMultEstimatorType est) -{ - switch (est) { - case kV0M: - return "V0M"; - break; - case kCL0: - return "CL0"; - break; - case kCL1: - return "CL1"; - break; - case kFV0A: - return "FV0A"; - break; - case kFT0M: - return "FT0M"; - break; - case kFT0A: - return "FT0A"; - break; - case kFT0C: - return "FT0C"; - break; - case kNTPV: - return "NTPV"; - break; - case kNOCM: - return "NOCM"; - break; - default: - LOGF(fatal, "Centrality/Multiplicity estimator %d not supported yet", (int)est); - return "WRONG"; - break; - } -} - -////////////////////////////////////////////////////////////////////////////////// -/// Trigger selection -////////////////////////////////////////////////////////////////////////////////// - -/// \brief Trigger selection for reconstructed and detector level collision tables -template -inline bool triggerSelectionReco(CollisionObject const& collision) -{ - bool trigsel = false; - switch (fSystem) { - case kpp: - case kpPb: - case kPbp: - case kPbPb: - case kXeXe: - switch (fTriggerSelection) { - case kMB: - switch (fDataType) { - case kData: - if (collision.alias_bit(kINT7)) { - if (collision.sel7()) { - trigsel = true; - } - } - break; - case kMC: - if (collision.sel7()) { - trigsel = true; - } - break; - default: - trigsel = true; - break; - } - break; - case kNONE: - trigsel = true; - break; - default: - break; - } - break; - case kppRun3: - case kPbPbRun3: - switch (fTriggerSelection) { - case kMB: - if (collision.sel8()) { - trigsel = true; - } - break; - case kNONE: - trigsel = true; - break; - default: - break; - } - break; - default: - break; - } - return trigsel; -} - -/// \brief Trigger selection by default: unknow subscribed collision table -template -inline bool triggerSelection(CollisionObject const&) -{ - LOGF(fatal, "Trigger selection not implemented for this kind of collisions"); - return false; -} - -/// \brief Trigger selection for reconstructed collision tables without centrality/multiplicity -template <> -inline bool triggerSelection(aod::CollisionEvSel const& collision) -{ - return triggerSelectionReco(collision); -} - -/// \brief Trigger selection for reconstructed collision tables with Run 2 centrality/multiplicity -template <> -inline bool triggerSelection(aod::CollisionEvSelRun2Cent const& collision) -{ - return triggerSelectionReco(collision); -} - -/// \brief Trigger selection for reconstructed collision tables with centrality/multiplicity -template <> -inline bool triggerSelection(aod::CollisionEvSelCent const& collision) -{ - return triggerSelectionReco(collision); -} - -/// \brief Trigger selection for detector level collision tables without centrality/multiplicity -template <> -inline bool triggerSelection::iterator>(soa::Join::iterator const& collision) -{ - return triggerSelectionReco(collision); -} - -/// \brief Trigger selection for detector level collision tables with Run 2 centrality/multiplicity -template <> -inline bool triggerSelection::iterator>(soa::Join::iterator const& collision) -{ - return triggerSelectionReco(collision); -} - -/// \brief Trigger selection for detector level collision tables with centrality/multiplicity -template <> -inline bool triggerSelection::iterator>(soa::Join::iterator const& collision) -{ - return triggerSelectionReco(collision); -} - -/// \brief Trigger selection for generator level collison table -template <> -inline bool triggerSelection(aod::McCollision const&) -{ - return true; -} - -////////////////////////////////////////////////////////////////////////////////// -/// Multiplicity extraction -////////////////////////////////////////////////////////////////////////////////// - -/// \brief Extract the collision multiplicity from the event selection information -template -inline float extractMultiplicity(CollisionObject const& collision, CentMultEstimatorType est) -{ - switch (est) { - case kV0M: - return collision.multFV0M(); - break; - case kCL0: - return collision.multTracklets(); - break; - case kCL1: - return collision.multTracklets(); - break; - case kFV0A: - return collision.multFV0A(); - break; - case kFT0M: - return collision.multFT0M(); - break; - case kFT0A: - return collision.multFT0A(); - break; - case kFT0C: - return collision.multFT0M(); - break; - case kNTPV: - return collision.multNTracksPV(); - break; - case kNOCM: - return collision.multFT0M(); - break; - default: - LOGF(fatal, "Centrality/Multiplicity estimator %d not supported yet", (int)est); - return collision.multFT0M(); - break; - } -} - -////////////////////////////////////////////////////////////////////////////////// -/// Centrality selection -////////////////////////////////////////////////////////////////////////////////// -/// \brief Centrality/multiplicity percentile -template -float getCentMultPercentile(CollisionObject collision) -{ - if constexpr (framework::has_type_v || - framework::has_type_v || - framework::has_type_v) { - switch (fCentMultEstimator) { - case kV0M: - return collision.centRun2V0M(); - break; - case kCL0: - if constexpr (framework::has_type_v) { - return collision.centRun2CL0(); - } else { - return 105.0; - } - break; - - case kCL1: - if constexpr (framework::has_type_v) { - return collision.centRun2CL1(); - } else { - return 105.0; - } - break; - default: - return 105.0; - break; - } - } - if constexpr (framework::has_type_v || - framework::has_type_v || - framework::has_type_v || - framework::has_type_v || - framework::has_type_v) { - switch (fCentMultEstimator) { - case kFV0A: - return collision.centFV0A(); - break; - case kFT0M: - return collision.centFT0M(); - break; - case kFT0A: - return collision.centFT0A(); - break; - case kFT0C: - return collision.centFT0C(); - break; - case kNTPV: - return collision.centNTPV(); - break; - default: - return 105.0; - break; - } - } -} - -/// \brief Centrality selection when there is centrality/multiplicity information -template -inline bool centralitySelectionMult(CollisionObject collision, float& centmult) -{ - float mult = getCentMultPercentile(collision); - int maxMult = 100; - int minMult = 0; - if (mult < maxMult && minMult < mult) { - centmult = mult; - return true; - } - return false; -} - -/// \brief Centrality selection when there is not centrality/multiplicity information -template -inline bool centralitySelectionNoMult(CollisionObject const&, float& centmult) -{ - bool centmultsel = false; - switch (fCentMultEstimator) { - case kNOCM: - centmult = 50.0; - centmultsel = true; - break; - default: - break; - } - return centmultsel; -} - -/// \brief Centrality selection by default: unknown subscribed collision table -template -inline bool centralitySelection(CollisionObject const&, float&) -{ - LOGF(fatal, "Centrality selection not implemented for this kind of collisions"); - return false; -} - -/// \brief Centrality selection for reconstructed and detector level collision tables with centrality/multiplicity information -template <> -inline bool centralitySelection(aod::CollisionEvSelCent const& collision, float& centmult) -{ - - return centralitySelectionMult(collision, centmult); -} - -/// \brief Centrality selection for reconstructed and detector level collision tables with Run 2 centrality/multiplicity information -template <> -inline bool centralitySelection(aod::CollisionEvSelRun2Cent const& collision, float& centmult) -{ - - return centralitySelectionMult(collision, centmult); -} - -/// \brief Centrality selection for reconstructed and detector level collision tables without centrality/multiplicity information -template <> -inline bool centralitySelection(aod::CollisionEvSel const& collision, float& centmult) -{ - - return centralitySelectionNoMult(collision, centmult); -} - -/// \brief Centrality selection for detector level collision tables without centrality/multiplicity -template <> -inline bool centralitySelection::iterator>(soa::Join::iterator const& collision, float& centmult) -{ - - return centralitySelectionNoMult(collision, centmult); -} - -/// \brief Centrality selection for detector level collision tables with centrality/multiplicity -template <> -inline bool centralitySelection::iterator>(soa::Join::iterator const& collision, float& centmult) -{ - - return centralitySelectionMult(collision, centmult); -} - -/// \brief Centrality selection for detector level collision tables with Run 2 centrality/multiplicity -template <> -inline bool centralitySelection::iterator>(soa::Join::iterator const& collision, float& centmult) -{ - return centralitySelectionMult(collision, centmult); -} - -/// \brief Centrality selection for generator level collision table -template <> -inline bool centralitySelection(aod::McCollision const&, float& centmult) -{ - int maxMult = 100; - int minMult = 0; - if (centmult < maxMult && minMult < centmult) { - return true; - } else { - return false; - } -} - -////////////////////////////////////////////////////////////////////////////////// -/// Event selection -////////////////////////////////////////////////////////////////////////////////// - -template -inline bool isEvtSelected(CollisionObject const& collision, float& centormult) -{ - bool trigsel = triggerSelection(collision); - - bool zvtxsel = false; - /* TODO: vertex quality checks */ - if (zvtxlow < collision.posZ() && collision.posZ() < zvtxup) { - zvtxsel = true; - } - - bool centmultsel = centralitySelection(collision, centormult); - - return trigsel && zvtxsel && centmultsel; -} - -////////////////////////////////////////////////////////////////////////////////// -/// Track selection -////////////////////////////////////////////////////////////////////////////////// - -template -inline bool matchTrackType(TrackObject const& track) -{ - if (useOwnTrackSelection) { - return ownTrackSelection.IsSelected(track); - } else { - for (const auto& filter : trackFilters) { - if (filter->IsSelected(track)) { - if (dca2Dcut) { - if (track.dcaXY() * track.dcaXY() / maxDCAxy / maxDCAxy + track.dcaZ() * track.dcaZ() / maxDCAz / maxDCAz > 1) { - return false; - } else { - return true; - } - } else { - return true; - } - } - } - return false; - } -} - -/// \brief Accepts or not the passed track -/// \param track the track of interest -/// \return the internal track id, -1 if not accepted -/// TODO: the PID implementation -/// For the time being we keep the convention -/// - positive track pid even -/// - negative track pid odd -/// - charged hadron 0/1 -template -void exploreMothers(ParticleObject& particle, MCCollisionObject& collision) -{ - for (const auto& m : particle.template mothers_as()) { - LOGF(info, " mother index: %d", m.globalIndex()); - LOGF(info, " Tracking back mother"); - LOGF(info, " assigned collision Id: %d, looping on collision Id: %d", m.mcCollisionId(), collision.globalIndex()); - LOGF(info, " index: %d, pdg code: %d", m.globalIndex(), m.pdgCode()); - LOGF(info, " Passed isPhysicalPrimary(): %s", m.isPhysicalPrimary() ? "YES" : "NO"); - - exploreMothers(m, collision); - } -} - -inline float getCharge(float pdgCharge) -{ - int posCharge = 1; - int negCharge = -1; - int denom = 3; - float charge = (pdgCharge / denom >= posCharge) ? 1.0 : ((pdgCharge / denom <= negCharge) ? -1.0 : 0); - return charge; -} - -} // namespace identifiedbffilter -} // namespace analysis -} // namespace o2 - -#endif // PWGCF_TWOPARTICLECORRELATIONS_TABLEPRODUCER_IDENTIFIEDBFFILTER_H_ diff --git a/PWGCF/TwoParticleCorrelations/Tasks/CMakeLists.txt b/PWGCF/TwoParticleCorrelations/Tasks/CMakeLists.txt index 5aae9125860..0fca88628ef 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/CMakeLists.txt +++ b/PWGCF/TwoParticleCorrelations/Tasks/CMakeLists.txt @@ -9,7 +9,7 @@ # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. -o2physics_add_dpl_workflow(twopartcorr +o2physics_add_dpl_workflow(two-particle-correlations SOURCES twoParticleCorrelations.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::TwoPartCorrCore COMPONENT_NAME Analysis) @@ -23,16 +23,6 @@ o2physics_add_dpl_workflow(lambdacorr PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(identifiedbf - SOURCES identifiedbf.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore - COMPONENT_NAME Analysis) - -o2physics_add_dpl_workflow(identifiedbf-filter-qa - SOURCES identifiedbfqa.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(dpt-dpt-efficiency-and-qc SOURCES dptDptEfficiencyAndQc.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore diff --git a/PWGCF/TwoParticleCorrelations/Tasks/identifiedbf.cxx b/PWGCF/TwoParticleCorrelations/Tasks/identifiedbf.cxx deleted file mode 100644 index b357272c17c..00000000000 --- a/PWGCF/TwoParticleCorrelations/Tasks/identifiedbf.cxx +++ /dev/null @@ -1,1507 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file identifiedbf.cxx -/// \brief Fills histograms with particles and tracks to calculate the Balance Function -/// \author bghanley1995@gmail.com -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "Common/Core/TrackSelection.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/Core/RecoDecay.h" -#include "DataFormatsParameters/GRPObject.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "PWGCF/Core/AnalysisConfigurableCuts.h" -#include "PWGCF/Core/PairCuts.h" -#include "PWGCF/TwoParticleCorrelations/DataModel/IdentifiedBfFiltered.h" -#include "PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.h" - -using namespace o2; -using namespace o2::framework; -using namespace o2::soa; -using namespace o2::framework::expressions; - -#define IDENTIFIEDBFLOGCOLLISIONS debug -#define IDENTIFIEDBFLOGTRACKS debug - -namespace correlationstask -{ -using namespace o2::analysis::identifiedbffilter; -float phibinshift = 0.5; -float etabinwidth = (etaup - etalow) / static_cast(etabins); -float phibinwidth = (phiup - philow) / static_cast(phibins); -int deltaetabins = etabins * 2 - 1; -float deltaetalow = etalow - etaup, deltaetaup = etaup - etalow; -float deltaetabinwidth = (deltaetaup - deltaetalow) / static_cast(deltaetabins); -int deltaphibins = phibins; -float deltaphibinwidth = constants::math::TwoPI / deltaphibins; -float deltaphilow = 0.0 - deltaphibinwidth / 2.0; -float deltaphiup = constants::math::TwoPI - deltaphibinwidth / 2.0; - -int maxLogComb = 10; - -bool processpairs = false; -bool processmixedevents = false; -bool ptorder = false; - -PairCuts fPairCuts; // pair suppression engine -bool fUseConversionCuts = false; // suppress resonances and conversions -bool fUseTwoTrackCut = false; // suppress too close tracks - -std::vector tname = {"e+", "e-", "pi+", "pi-", "K+", "K-", "p+", "p-"}; ///< the track names -} // namespace correlationstask - -// Task for building correlations -struct IdentifiedbfTask { - - /* the data collecting engine */ - template - struct DataCollectingEngine { - int nspecies = static_cast(analysis::identifiedbffilter::kIdBfNoOfSpecies); /* Doing All Species */ - size_t nch = nspecies * 2; - - //============================================================================================ - // The IdentifiedBfCorrelationsAnalysisTask output objects - //============================================================================================ - /* histograms */ - TH1F* fhVertexZA; //! fhN1VsPt{nch, nullptr}; //! fhN1VsEtaPhi{nch, nullptr}; //! fhSum1PtVsEtaPhi{nch, nullptr}; //! fhN1VsZEtaPhiPt{nch + 1, nullptr}; //! fhN1VsZEtaPhiPtPrimary{nch, nullptr}; //! fhN1VsZEtaPhiPtSecondary{nch, nullptr}; //! fhN1VsZEtaPhiPtPure{nch + 1, nullptr}; //! fhSum1PtVsZEtaPhiPt{nch, nullptr}; //! fhNuaNueVsZEtaPhiPt{nch, nullptr}; //! fhPtAvgVsEtaPhi{nch, nullptr}; //!> fhN2VsPtPt{nch, {nch, nullptr}}; //!> fhN2VsDEtaDPhi{nch, {nch, nullptr}}; //!> fhN2ContVsDEtaDPhi{nch, {nch, nullptr}}; //!> fhSum2PtPtVsDEtaDPhi{nch, {nch, nullptr}}; //!> fhSum2DptDptVsDEtaDPhi{nch, {nch, nullptr}}; //!) ({p_T}_2 - <{p_T}_2>) \f$ distribution vs \f$\Delta\eta,\;\Delta\phi\f$ for the different species combinations - std::vector> fhSupN1N1VsDEtaDPhi{nch, {nch, nullptr}}; //!> fhSupPt1Pt1VsDEtaDPhi{nch, {nch, nullptr}}; //! fhN1VsC{nch, nullptr}; //! fhSum1PtVsC{nch, nullptr}; //! fhN1NWVsC{nch, nullptr}; //! fhSum1PtNWVsC{nch, nullptr}; //!> fhN2VsC{nch, {nch, nullptr}}; //!> fhSum2PtPtVsC{nch, {nch, nullptr}}; //!> fhSum2DptDptVsC{nch, {nch, nullptr}}; //!) ({p_T}_2 - <{p_T}_2>) \f$ distribution vs event centrality/multiplicity 1-1,1-2,2-1,2-2, combinations - std::vector> fhN2NWVsC{nch, {nch, nullptr}}; //!> fhSum2PtPtNWVsC{nch, {nch, nullptr}}; //!> fhSum2DptDptNWVsC{nch, {nch, nullptr}}; //!) ({p_T}_2 - <{p_T}_2>) \f$ distribution vs \f$\Delta\eta,\;\Delta\phi\f$ distribution vs event centrality/multiplicity 1-1,1-2,2-1,2-2, combinations - - std::vector> chargePairsNames = {{"OO", "OT"}, {"TO", "TT"}}; - std::vector> speciesPairNames = {{"e+e+", "e+e-", "e+pi+", "e+pi-", "e+K+", "e+K-", "e+p+", "e+p-"}, - {"e-e+", "e-e-", "e-pi+", "e-pi-", "e-K+", "e-K-", "e-p+", "e-p-"}, - {"pi+e+", "pi+e-", "pi+pi+", "pi+pi-", "pi+K+", "pi+K-", "pi+p+", "pi+p-"}, - {"pi-e+", "pi-e-", "pi-pi+", "pi-pi-", "pi-K+", "pi-K-", "pi-p+", "pi-p-"}, - {"K+e+", "K+e-", "K+pi+", "K+pi-", "K+K+", "K+K-", "K+p+", "K+p-"}, - {"K-e+", "K-e-", "K-pi+", "K-pi-", "K-K+", "K-K-", "K-p+", "K-p-"}, - {"p+e+", "p+e-", "p+pi+", "p+pi-", "p+K+", "p+K-", "p+p+", "p+p-"}, - {"p-e+", "p-e-", "p-pi+", "p-pi-", "p-K+", "p-K-", "p-p+", "p-p-"}}; - bool ccdbstored = false; - - float isCCDBstored() - { - return ccdbstored; - } - - /// \brief Returns the potentially phi origin shifted phi - /// \param phi the track azimuthal angle - /// \return the track phi origin shifted azimuthal angle - float getShiftedPhi(float phi) - { - using namespace correlationstask; - using namespace o2::analysis::identifiedbffilter; - phi = RecoDecay::constrainAngle(phi, philow, 1U); - return phi; - } - - /// \brief Returns the zero based bin index of the eta phi passed track - /// \param t the intended track - /// \return the zero based bin index - /// - /// According to the bining structure, to the track eta will correspond - /// a zero based bin index and similarly for the track phi - /// The returned index is the composition of both considering eta as - /// the first index component - /// WARNING: for performance reasons no checks are done about the consistency - /// of track's eta and phin with the corresponding ranges so, it is suppossed - /// the track has been accepted and it is within that ranges - /// IF THAT IS NOT THE CASE THE ROUTINE WILL PRODUCE NONSENSE RESULTS - template - int getEtaPhiIndex(TrackObject const& t) - { - using namespace correlationstask; - using namespace o2::analysis::identifiedbffilter; - - int etaix = static_cast((t.eta() - etalow) / etabinwidth); - /* consider a potential phi origin shift */ - float phi = getShiftedPhi(t.phi()); - int phiix = static_cast((phi - philow) / phibinwidth); - return etaix * phibins + phiix; - } - - /// \brief Returns the TH2 global index for the differential histograms - /// \param t1 the intended track one - /// \param t2 the intended track two - /// \return the globl TH2 bin for delta eta delta phi - /// - /// WARNING: for performance reasons no checks are done about the consistency - /// of tracks' eta and phi within the corresponding ranges so, it is suppossed - /// the tracks have been accepted and they are within that ranges - /// IF THAT IS NOT THE CASE THE ROUTINE WILL PRODUCE NONSENSE RESULTS - template - int getDEtaDPhiGlobalIndex(TrackObject const& t1, TrackObject const& t2) - { - using namespace correlationstask; - using namespace o2::analysis::identifiedbffilter; - - /* rule: ix are always zero based while bins are always one based */ - int etaix1 = static_cast((t1.eta() - etalow) / etabinwidth); - /* consider a potential phi origin shift */ - float phi = getShiftedPhi(t1.phi()); - int phiix1 = static_cast((phi - philow) / phibinwidth); - int etaix2 = static_cast((t2.eta() - etalow) / etabinwidth); - /* consider a potential phi origin shift */ - phi = getShiftedPhi(t2.phi()); - int phiix2 = static_cast((phi - philow) / phibinwidth); - - int deltaetaix = etaix1 - etaix2 + etabins - 1; - int deltaphiix = phiix1 - phiix2; - if (deltaphiix < 0) { - deltaphiix += phibins; - } - - return fhN2VsDEtaDPhi[0][0]->GetBin(deltaetaix + 1, deltaphiix + 1); - } - - void storeTrackCorrections(std::vector corrs) - { - LOGF(info, "Stored NUA&NUE corrections for %d track ids", corrs.size()); - for (uint i = 0; i < corrs.size(); ++i) { - LOGF(info, " Stored NUA&NUE corrections %s for track id %d %s", corrs[i] != nullptr ? corrs[i]->GetName() : "nullptr", i, corrs[i] != nullptr ? "yes" : "no"); - fhNuaNueVsZEtaPhiPt[i] = corrs[i]; - if (fhNuaNueVsZEtaPhiPt[i] != nullptr) { - int nbins = 0; - double avg = 0.0; - for (int ix = 0; ix < fhNuaNueVsZEtaPhiPt[i]->GetNbinsX(); ++ix) { - for (int iy = 0; iy < fhNuaNueVsZEtaPhiPt[i]->GetNbinsY(); ++iy) { - for (int iz = 0; iz < fhNuaNueVsZEtaPhiPt[i]->GetNbinsZ(); ++iz) { - nbins++; - avg += fhNuaNueVsZEtaPhiPt[i]->GetBinContent(ix + 1, iy + 1, iz + 1); - } - } - } - LOGF(info, "Average NUA&NUE correction for track id %d: %f", i, avg / nbins); - } - } - ccdbstored = true; - } - - void storePtAverages(std::vector ptavgs) - { - LOGF(info, "Stored pT average for %d track ids", ptavgs.size()); - for (uint i = 0; i < ptavgs.size(); ++i) { - LOGF(info, " Stored pT average for track id %d %s", i, ptavgs[i] != nullptr ? "yes" : "no"); - fhPtAvgVsEtaPhi[i] = ptavgs[i]; - } - ccdbstored = true; - } - - template - std::vector* getTrackCorrections(TrackListObject const& tracks, float zvtx) - { - std::vector* corr = new std::vector(tracks.size(), 1.0f); - int index = 0; - for (const auto& t : tracks) { - if (fhNuaNueVsZEtaPhiPt[t.trackacceptedid()] != nullptr) { - (*corr)[index] = fhNuaNueVsZEtaPhiPt[t.trackacceptedid()]->GetBinContent(fhNuaNueVsZEtaPhiPt[t.trackacceptedid()]->FindFixBin(zvtx, getEtaPhiIndex(t) + 0.5, t.pt())); - } - index++; - } - return corr; - } - - template - std::vector* getPtAvg(TrackListObject const& tracks) - { - std::vector* ptavg = new std::vector(tracks.size(), 0.0f); - int index = 0; - for (const auto& t : tracks) { - if (fhPtAvgVsEtaPhi[t.trackacceptedid()] != nullptr) { - (*ptavg)[index] = fhPtAvgVsEtaPhi[t.trackacceptedid()]->GetBinContent(fhPtAvgVsEtaPhi[t.trackacceptedid()]->FindFixBin(t.eta(), t.phi())); - index++; - } - } - return ptavg; - } - - /// \brief checks whether MC track is a physical primary or secondary - /// \param track passed MC track converted to MCParticle - template - void trackPrimaryCheck(TrackObject const& track, float zvtx, float corr) - { - if constexpr (framework::has_type_v) { - if (isPrimaryCheck(track.template mcParticle_as())) { - fhN1VsZEtaPhiPtPrimary[track.trackacceptedid()]->Fill(zvtx, getEtaPhiIndex(track) + 0.5, track.pt(), corr); - } else { - fhN1VsZEtaPhiPtSecondary[track.trackacceptedid()]->Fill(zvtx, getEtaPhiIndex(track) + 0.5, track.pt(), corr); - } - } else if constexpr (framework::has_type_v) { - if (isPrimaryCheck(track)) { - fhN1VsZEtaPhiPtPrimary[track.trackacceptedid()]->Fill(zvtx, getEtaPhiIndex(track) + 0.5, track.pt(), corr); - } else { - fhN1VsZEtaPhiPtSecondary[track.trackacceptedid()]->Fill(zvtx, getEtaPhiIndex(track) + 0.5, track.pt(), corr); - } - } - } - - /// \brief checks whether MC track is a physical primary or secondary - /// \param particle passed MC track converted to MCParticle - template - bool isPrimaryCheck(ParticleObject const& particle) - { - return particle.isPhysicalPrimary(); - } - - /// \brief checks whether MC track is a physical primary or secondary - /// \param particle passed MC track converted to MCParticle - template - bool isSpeciesCheck(ParticleObject const& particle, int trkId) - { - int pdgcode = particle.pdgCode(); - int realPID = -1; - switch (pdgcode) { - case kPositron: - realPID = 0; - break; - case kElectron: - realPID = 1; - break; - case kPiPlus: - realPID = 2; - break; - case kPiMinus: - realPID = 3; - break; - case kKPlus: - realPID = 4; - break; - case kKMinus: - realPID = 5; - break; - case kProton: - realPID = 6; - break; - case kProtonBar: - realPID = 7; - break; - default: - realPID = -1; - break; - } - return (realPID == trkId); - } - - /// \brief checks whether MC track is a physical primary or secondary - /// \param particle passed MC track converted to MCParticle - template - bool isPrimarySpeciesCheck(TrackObject const& track, int trkId) - { - if constexpr (framework::has_type_v) { - return (isPrimaryCheck(track.template mcParticle_as()) && isSpeciesCheck(track.template mcParticle_as(), trkId)); - } - return false; - } - - /// \brief fills the singles histograms in singles execution mode - /// \param passedtracks filtered table with the tracks associated to the passed index - /// \param tix index, in the singles histogram bank, for the passed filetered track table - template - void processSingles(TrackListObject const& passedtracks, std::vector* corrs, float zvtx) - { - int index = 0; - for (const auto& track : passedtracks) { - float corr = (*corrs)[index]; - fhN1VsPt[track.trackacceptedid()]->Fill(track.pt(), corr); - if constexpr (smallsingles) { - fhN1VsEtaPhi[track.trackacceptedid()]->Fill(track.eta(), getShiftedPhi(track.phi()), corr); - fhSum1PtVsEtaPhi[track.trackacceptedid()]->Fill(track.eta(), getShiftedPhi(track.phi()), track.pt() * corr); - } else { - fhN1VsZEtaPhiPt[nch]->Fill(zvtx, getEtaPhiIndex(track) + 0.5, track.pt(), corr); - fhN1VsZEtaPhiPt[track.trackacceptedid()]->Fill(zvtx, getEtaPhiIndex(track) + 0.5, track.pt(), corr); - fhSum1PtVsZEtaPhiPt[track.trackacceptedid()]->Fill(zvtx, getEtaPhiIndex(track) + 0.5, track.pt(), track.pt() * corr); - trackPrimaryCheck(track, zvtx, corr); - if (isPrimarySpeciesCheck(track, track.trackacceptedid())) { - fhN1VsZEtaPhiPtPure[track.trackacceptedid()]->Fill(zvtx, getEtaPhiIndex(track) + 0.5, track.pt(), corr); - } - } - index++; - } - } - - /// \brief fills the singles histograms in pair execution mode - /// \param passedtracks filtered table with the tracks associated to the passed index - /// \param tix index, in the singles histogram bank, for the passed filetered track table - /// \param cmul centrality - multiplicity for the collision being analyzed - template - void processTracks(TrackListObject const& passedtracks, std::vector* corrs, float cmul) - { - LOGF(IDENTIFIEDBFLOGCOLLISIONS, "Processing %d tracks in a collision with cent/mult %f ", passedtracks.size(), cmul); - - /* process magnitudes */ - std::vector n1(nch, 0.0); ///< weighted number of single tracks for current collision - std::vector sum1Pt(nch, 0.0); ///< accumulated sum of weighted single track \f$p_T\f$ for current collision - std::vector n1nw(nch, 0.0); ///< not weighted number of single tracks for current collision - std::vector sum1Ptnw(nch, 0.0); ///< accumulated sum of not weighted single \f$p_T\f$ for current collision - int index = 0; - for (const auto& track : passedtracks) { - float corr = (*corrs)[index]; - n1[track.trackacceptedid()] += corr; - sum1Pt[track.trackacceptedid()] += track.pt() * corr; - n1nw[track.trackacceptedid()] += 1; - sum1Ptnw[track.trackacceptedid()] += track.pt(); - - fhN1VsEtaPhi[track.trackacceptedid()]->Fill(track.eta(), getShiftedPhi(track.phi()), corr); - fhSum1PtVsEtaPhi[track.trackacceptedid()]->Fill(track.eta(), getShiftedPhi(track.phi()), track.pt() * corr); - index++; - } - for (uint tid = 0; tid < nch; ++tid) { - fhN1VsC[tid]->Fill(cmul, n1[tid]); - fhSum1PtVsC[tid]->Fill(cmul, sum1Pt[tid]); - fhN1NWVsC[tid]->Fill(cmul, n1nw[tid]); - fhSum1PtNWVsC[tid]->Fill(cmul, sum1Ptnw[tid]); - } - } - - /// \brief fills the pair histograms in pair execution mode - /// \param trks1 filtered table with the tracks associated to the first track in the pair - /// \param trks2 filtered table with the tracks associated to the second track in the pair - /// \param cmul centrality - multiplicity for the collision being analyzed - /// Be aware that in most of the cases traks1 and trks2 will have the same content (exception: mixed events) - template - void processTrackPairs(TrackOneListObject const& trks1, TrackTwoListObject const& trks2, std::vector* corrs1, std::vector* corrs2, std::vector* ptavgs1, std::vector* ptavgs2, float cmul, int bfield) - { - using namespace correlationstask; - - /* process pair magnitudes */ - std::vector> n2(nch, std::vector(nch, 0.0)); ///< weighted number of track 1 track 2 pairs for current collision - std::vector> n2sup(nch, std::vector(nch, 0.0)); ///< weighted number of track 1 track 2 suppressed pairs for current collision - std::vector> sum2PtPt(nch, std::vector(nch, 0.0)); ///< accumulated sum of weighted track 1 track 2 \f${p_T}_1 {p_T}_2\f$ for current collision - std::vector> sum2DptDpt(nch, std::vector(nch, 0.0)); ///< accumulated sum of weighted number of track 1 tracks times weighted track 2 \f$p_T\f$ for current collision - std::vector> n2nw(nch, std::vector(nch, 0.0)); ///< not weighted number of track1 track 2 pairs for current collision - std::vector> sum2PtPtnw(nch, std::vector(nch, 0.0)); ///< accumulated sum of not weighted track 1 track 2 \f${p_T}_1 {p_T}_2\f$ for current collision - std::vector> sum2DptDptnw(nch, std::vector(nch, 0.0)); ///< accumulated sum of not weighted number of track 1 tracks times not weighted track 2 \f$p_T\f$ for current collision - int index1 = 0; - - for (const auto& track1 : trks1) { - double ptavg1 = (*ptavgs1)[index1]; - double corr1 = (*corrs1)[index1]; - int index2 = 0; - for (const auto& track2 : trks2) { - /* checking the same track id condition */ - if (track1 == track2) { - /* exclude autocorrelations */ - continue; - } - - if constexpr (doptorder) { - if (track2.pt() >= track1.pt()) { - continue; - } - } - /* process pair magnitudes */ - double ptavg2 = (*ptavgs2)[index2]; - double corr2 = (*corrs2)[index2]; - double corr = corr1 * corr2; - double dptdptnw = (track1.pt() - ptavg1) * (track2.pt() - ptavg2); - double dptdptw = (corr1 * track1.pt() - ptavg1) * (corr2 * track2.pt() - ptavg2); - - /* get the global bin for filling the differential histograms */ - int globalbin = getDEtaDPhiGlobalIndex(track1, track2); - float deltaeta = track1.eta() - track2.eta(); - float deltaphi = track1.phi() - track2.phi(); - deltaphi = RecoDecay::constrainAngle(deltaphi, deltaphilow, 1U); - if ((fUseConversionCuts && fPairCuts.conversionCuts(track1, track2)) || (fUseTwoTrackCut && fPairCuts.twoTrackCut(track1, track2, bfield))) { - /* suppress the pair */ - fhSupN1N1VsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->AddBinContent(globalbin, corr); - fhSupPt1Pt1VsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->AddBinContent(globalbin, track1.pt() * track2.pt() * corr); - n2sup[track1.trackacceptedid()][track2.trackacceptedid()] += corr; - } else { - /* count the pair */ - n2[track1.trackacceptedid()][track2.trackacceptedid()] += corr; - sum2PtPt[track1.trackacceptedid()][track2.trackacceptedid()] += track1.pt() * track2.pt() * corr; - sum2DptDpt[track1.trackacceptedid()][track2.trackacceptedid()] += dptdptw; - n2nw[track1.trackacceptedid()][track2.trackacceptedid()] += 1; - sum2PtPtnw[track1.trackacceptedid()][track2.trackacceptedid()] += track1.pt() * track2.pt(); - sum2DptDptnw[track1.trackacceptedid()][track2.trackacceptedid()] += dptdptnw; - - fhN2VsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->AddBinContent(globalbin, corr); - fhN2ContVsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->Fill(deltaeta, deltaphi, corr); - fhSum2DptDptVsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->AddBinContent(globalbin, dptdptw); - fhSum2PtPtVsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->AddBinContent(globalbin, track1.pt() * track2.pt() * corr); - } - fhN2VsPtPt[track1.trackacceptedid()][track2.trackacceptedid()]->Fill(track1.pt(), track2.pt(), corr); - index2++; - } - index1++; - } - for (uint pid1 = 0; pid1 < nch; ++pid1) { - for (uint pid2 = 0; pid2 < nch; ++pid2) { - fhN2VsC[pid1][pid2]->Fill(cmul, n2[pid1][pid2]); - fhSum2PtPtVsC[pid1][pid2]->Fill(cmul, sum2PtPt[pid1][pid2]); - fhSum2DptDptVsC[pid1][pid2]->Fill(cmul, sum2DptDpt[pid1][pid2]); - fhN2NWVsC[pid1][pid2]->Fill(cmul, n2nw[pid1][pid2]); - fhSum2PtPtNWVsC[pid1][pid2]->Fill(cmul, sum2PtPtnw[pid1][pid2]); - fhSum2DptDptNWVsC[pid1][pid2]->Fill(cmul, sum2DptDptnw[pid1][pid2]); - /* let's also update the number of entries in the differential histograms */ - fhN2VsDEtaDPhi[pid1][pid2]->SetEntries(fhN2VsDEtaDPhi[pid1][pid2]->GetEntries() + n2[pid1][pid2]); - fhSum2DptDptVsDEtaDPhi[pid1][pid2]->SetEntries(fhSum2DptDptVsDEtaDPhi[pid1][pid2]->GetEntries() + n2[pid1][pid2]); - fhSum2PtPtVsDEtaDPhi[pid1][pid2]->SetEntries(fhSum2PtPtVsDEtaDPhi[pid1][pid2]->GetEntries() + n2[pid1][pid2]); - fhSupN1N1VsDEtaDPhi[pid1][pid2]->SetEntries(fhSupN1N1VsDEtaDPhi[pid1][pid2]->GetEntries() + n2sup[pid1][pid2]); - fhSupPt1Pt1VsDEtaDPhi[pid1][pid2]->SetEntries(fhSupPt1Pt1VsDEtaDPhi[pid1][pid2]->GetEntries() + n2sup[pid1][pid2]); - } - } - } - - template - void processCollision(TrackOneListObject const& Tracks1, TrackTwoListObject const& Tracks2, float zvtx, float centmult, int bfield) - { - using namespace correlationstask; - std::vector* corrs1; - std::vector* corrs2; - corrs1 = getTrackCorrections(Tracks1, zvtx); - if constexpr (mixed) { - corrs2 = getTrackCorrections(Tracks2, zvtx); - } - - if (!processpairs) { - /* process single tracks */ - fhVertexZA->Fill(zvtx); - processSingles(Tracks1, corrs1, zvtx); - if constexpr (mixed) { - processSingles(Tracks2, corrs2, zvtx); - } - } else { - /* process track magnitudes */ - std::vector* ptavgs1; - std::vector* ptavgs2; - ptavgs1 = getPtAvg(Tracks1); - if constexpr (mixed) { - ptavgs2 = getPtAvg(Tracks2); - } - - /* TODO: the centrality should be chosen non detector dependent */ - processTracks(Tracks1, corrs1, centmult); - if constexpr (mixed) { - processTracks(Tracks2, corrs2, centmult); - } - /* process pair magnitudes */ - if constexpr (mixed) { - if (ptorder) { - processTrackPairs(Tracks1, Tracks2, corrs1, corrs2, ptavgs1, ptavgs2, centmult, bfield); - } else { - processTrackPairs(Tracks1, Tracks2, corrs1, corrs2, ptavgs1, ptavgs2, centmult, bfield); - } - } else { - if (ptorder) { - processTrackPairs(Tracks1, Tracks1, corrs1, corrs1, ptavgs1, ptavgs1, centmult, bfield); - } else { - processTrackPairs(Tracks1, Tracks1, corrs1, corrs1, ptavgs1, ptavgs1, centmult, bfield); - } - } - - delete ptavgs1; - if constexpr (mixed) { - delete ptavgs2; - } - } - delete corrs1; - if constexpr (mixed) { - delete corrs2; - } - } - - void init(TList* fOutputList) - { - using namespace correlationstask; - using namespace o2::analysis::identifiedbffilter; - - /* create the histograms */ - bool oldstatus = TH1::AddDirectoryStatus(); - TH1::AddDirectory(kFALSE); - - if (!processpairs) { - fhVertexZA = new TH1F("VertexZA", "Vertex Z; z_{vtx}", zvtxbins, zvtxlow, zvtxup); - fOutputList->Add(fhVertexZA); - for (uint i = 0; i < nch; ++i) { - /* histograms for each track, one and two */ - fhN1VsPt[i] = new TH1F(TString::Format("n1_%s_vsPt", tname[i].c_str()).Data(), - TString::Format("#LT n_{1} #GT;p_{t,%s} (GeV/c);#LT n_{1} #GT", tname[i].c_str()).Data(), - ptbins, ptlow, ptup); - /* we don't want the Sumw2 structure being created here */ - bool defSumw2 = TH1::GetDefaultSumw2(); - if constexpr (smallsingles) { - fhN1VsEtaPhi[i] = new TH2F(TString::Format("n1_%s_vsEtaPhi", tname[i].c_str()).Data(), - TString::Format("#LT n_{1} #GT;#eta_{%s};#varphi_{%s} (radian);#LT n_{1} #GT", tname[i].c_str(), tname[i].c_str()).Data(), - etabins, etalow, etaup, phibins, philow, phiup); - fhSum1PtVsEtaPhi[i] = new TH2F(TString::Format("sumPt_%s_vsEtaPhi", tname[i].c_str()).Data(), - TString::Format("#LT #Sigma p_{t,%s} #GT;#eta_{%s};#varphi_{%s} (radian);#LT #Sigma p_{t,%s} #GT (GeV/c)", - tname[i].c_str(), tname[i].c_str(), tname[i].c_str(), tname[i].c_str()) - .Data(), - etabins, etalow, etaup, phibins, philow, phiup); - } else { - TH1::SetDefaultSumw2(false); - fhN1VsZEtaPhiPt[i] = new TH3F( - TString::Format("n1_%s_vsZ_vsEtaPhi_vsPt", tname[i].c_str()).Data(), - TString::Format("#LT n_{1} #GT;vtx_{z};#eta_{%s}#times#varphi_{%s};p_{t,%s} (GeV/c)", - tname[i].c_str(), - tname[i].c_str(), - tname[i].c_str()) - .Data(), - zvtxbins, - zvtxlow, - zvtxup, - etabins * phibins, - 0.0, - static_cast(etabins * phibins), - ptbins, - ptlow, - ptup); - - fhN1VsZEtaPhiPtPrimary[i] = new TH3F( - TString::Format("n1_%s_Primary_vsZ_vsEtaPhi_vsPt", tname[i].c_str()).Data(), - TString::Format("#LT n_{1} Primary #GT;vtx_{z};#eta_{%s}#times#varphi_{%s};p_{t,%s} (GeV/c)", - tname[i].c_str(), - tname[i].c_str(), - tname[i].c_str()) - .Data(), - zvtxbins, - zvtxlow, - zvtxup, - etabins * phibins, - 0.0, - static_cast(etabins * phibins), - ptbins, - ptlow, - ptup); - - fhN1VsZEtaPhiPtSecondary[i] = new TH3F( - TString::Format("n1_%s_Secondary_vsZ_vsEtaPhi_vsPt", tname[i].c_str()).Data(), - TString::Format("#LT n_{1} Secondary #GT;vtx_{z};#eta_{%s}#times#varphi_{%s};p_{t,%s} (GeV/c)", - tname[i].c_str(), - tname[i].c_str(), - tname[i].c_str()) - .Data(), - zvtxbins, - zvtxlow, - zvtxup, - etabins * phibins, - 0.0, - static_cast(etabins * phibins), - ptbins, - ptlow, - ptup); - - fhN1VsZEtaPhiPtPure[i] = new TH3F( - TString::Format("n1_%s_Pure_vsZ_vsEtaPhi_vsPt", tname[i].c_str()).Data(), - TString::Format("#LT n_{1} Pure #GT;vtx_{z};#eta_{%s}#times#varphi_{%s};p_{t,%s} (GeV/c)", - tname[i].c_str(), - tname[i].c_str(), - tname[i].c_str()) - .Data(), - zvtxbins, - zvtxlow, - zvtxup, - etabins * phibins, - 0.0, - static_cast(etabins * phibins), - ptbins, - ptlow, - ptup); - - fhSum1PtVsZEtaPhiPt[i] = new TH3F( - TString::Format("sumPt1_%s_vsZ_vsEtaPhi_vsPt", tname[i].c_str()).Data(), - TString::Format( - "#LT #Sigma p_{t,%s}#GT;vtx_{z};#eta_{%s}#times#varphi_{%s};p_{t,%s} (GeV/c)", - tname[i].c_str(), - tname[i].c_str(), - tname[i].c_str(), - tname[i].c_str()) - .Data(), - zvtxbins, - zvtxlow, - zvtxup, - etabins * phibins, - 0.0, - static_cast(etabins * phibins), - ptbins, - ptlow, - ptup); - } - /* we return it back to previuos state */ - TH1::SetDefaultSumw2(defSumw2); - - /* the statistical uncertainties will be estimated by the subsamples method so let's get rid of the error tracking */ - if constexpr (smallsingles) { - fhN1VsEtaPhi[i]->SetBit(TH1::kIsNotW); - fhN1VsEtaPhi[i]->Sumw2(false); - fhSum1PtVsEtaPhi[i]->SetBit(TH1::kIsNotW); - fhSum1PtVsEtaPhi[i]->Sumw2(false); - } else { - fhN1VsZEtaPhiPt[i]->SetBit(TH1::kIsNotW); - fhN1VsZEtaPhiPt[i]->Sumw2(false); - fhN1VsZEtaPhiPtPrimary[i]->SetBit(TH1::kIsNotW); - fhN1VsZEtaPhiPtPrimary[i]->Sumw2(false); - fhN1VsZEtaPhiPtSecondary[i]->SetBit(TH1::kIsNotW); - fhN1VsZEtaPhiPtSecondary[i]->Sumw2(false); - fhN1VsZEtaPhiPtPure[i]->SetBit(TH1::kIsNotW); - fhN1VsZEtaPhiPtPure[i]->Sumw2(false); - fhSum1PtVsZEtaPhiPt[i]->SetBit(TH1::kIsNotW); - fhSum1PtVsZEtaPhiPt[i]->Sumw2(false); - } - fhNuaNueVsZEtaPhiPt[i] = nullptr; - fhPtAvgVsEtaPhi[i] = nullptr; - - fOutputList->Add(fhN1VsPt[i]); - if constexpr (smallsingles) { - fOutputList->Add(fhN1VsEtaPhi[i]); - fOutputList->Add(fhSum1PtVsEtaPhi[i]); - } else { - fOutputList->Add(fhN1VsZEtaPhiPt[i]); - fOutputList->Add(fhN1VsZEtaPhiPtPrimary[i]); - fOutputList->Add(fhN1VsZEtaPhiPtSecondary[i]); - fOutputList->Add(fhN1VsZEtaPhiPtPure[i]); - fOutputList->Add(fhSum1PtVsZEtaPhiPt[i]); - } - } - if (!smallsingles) { - TH1::SetDefaultSumw2(false); - fhN1VsZEtaPhiPt[nch] = new TH3F( - TString::Format("n1_%s_vsZ_vsEtaPhi_vsPt", "h"), - TString::Format("#LT n_{1} #GT;vtx_{z};#eta_{%s}#times#varphi_{%s};p_{t,%s} (GeV/c)", - "h", - "h", - "h") - .Data(), - zvtxbins, - zvtxlow, - zvtxup, - etabins * phibins, - 0.0, - static_cast(etabins * phibins), - ptbins, - ptlow, - ptup); - fOutputList->Add(fhN1VsZEtaPhiPt[nch]); - } - - } else { - for (uint i = 0; i < nch; ++i) { - /* histograms for each track species */ - fhN1VsEtaPhi[i] = new TH2F(TString::Format("n1_%s_vsEtaPhi", tname[i].c_str()).Data(), - TString::Format("#LT n_{1} #GT;#eta_{%s};#varphi_{%s} (radian);#LT n_{1} #GT", tname[i].c_str(), tname[i].c_str()).Data(), - etabins, etalow, etaup, phibins, philow, phiup); - fhSum1PtVsEtaPhi[i] = new TH2F(TString::Format("sumPt_%s_vsEtaPhi", tname[i].c_str()).Data(), - TString::Format("#LT #Sigma p_{t,%s} #GT;#eta_{%s};#varphi_{%s} (radian);#LT #Sigma p_{t,%s} #GT (GeV/c)", - tname[i].c_str(), tname[i].c_str(), tname[i].c_str(), tname[i].c_str()) - .Data(), - etabins, etalow, etaup, phibins, philow, phiup); - fhN1VsC[i] = new TProfile(TString::Format("n1_%s_vsM", tname[i].c_str()).Data(), - TString::Format("#LT n_{1} #GT (weighted);Centrality/Multiplicity (%%);#LT n_{1} #GT").Data(), - 100, 0.0, 100.0); - fhSum1PtVsC[i] = new TProfile(TString::Format("sumPt_%s_vsM", tname[i].c_str()), - TString::Format("#LT #Sigma p_{t,%s} #GT (weighted);Centrality/Multiplicity (%%);#LT #Sigma p_{t,%s} #GT (GeV/c)", tname[i].c_str(), tname[i].c_str()).Data(), - 100, 0.0, 100.0); - fhN1NWVsC[i] = new TProfile(TString::Format("n1Nw_%s_vsM", tname[i].c_str()).Data(), - TString::Format("#LT n_{1} #GT;Centrality/Multiplicity (%%);#LT n_{1} #GT").Data(), - 100, 0.0, 100.0); - fhSum1PtNWVsC[i] = new TProfile(TString::Format("sumPtNw_%s_vsM", tname[i].c_str()).Data(), - TString::Format("#LT #Sigma p_{t,%s} #GT;Centrality/Multiplicity (%%);#LT #Sigma p_{t,%s} #GT (GeV/c)", tname[i].c_str(), tname[i].c_str()).Data(), 100, 0.0, 100.0); - fhNuaNueVsZEtaPhiPt[i] = nullptr; - fhPtAvgVsEtaPhi[i] = nullptr; - fOutputList->Add(fhN1VsEtaPhi[i]); - fOutputList->Add(fhSum1PtVsEtaPhi[i]); - fOutputList->Add(fhN1VsC[i]); - fOutputList->Add(fhSum1PtVsC[i]); - fOutputList->Add(fhN1NWVsC[i]); - fOutputList->Add(fhSum1PtNWVsC[i]); - } - for (uint i = 0; i < nch; ++i) { - for (uint j = 0; j < nch; ++j) { - /* histograms for each track pair combination */ - /* we don't want the Sumw2 structure being created here */ - bool defSumw2 = TH1::GetDefaultSumw2(); - TH1::SetDefaultSumw2(false); - // const char* pname = chargePairsNames[i][j].c_str(); - const char* pname = speciesPairNames[i][j].c_str(); - fhN2VsDEtaDPhi[i][j] = new TH2F(TString::Format("n2_12_vsDEtaDPhi_%s", pname), TString::Format("#LT n_{2} #GT (%s);#Delta#eta;#Delta#varphi;#LT n_{2} #GT", pname), - deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); - fhN2ContVsDEtaDPhi[i][j] = new TH2F(TString::Format("n2_12cont_vsDEtaDPhi_%s", pname), TString::Format("#LT n_{2} #GT (%s);#Delta#eta;#Delta#varphi;#LT n_{2} #GT", pname), - deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); - fhSum2PtPtVsDEtaDPhi[i][j] = new TH2F(TString::Format("sumPtPt_12_vsDEtaDPhi_%s", pname), TString::Format("#LT #Sigma p_{t,1}p_{t,2} #GT (%s);#Delta#eta;#Delta#varphi;#LT #Sigma p_{t,1}p_{t,2} #GT (GeV^{2})", pname), - deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); - fhSum2DptDptVsDEtaDPhi[i][j] = new TH2F(TString::Format("sumDptDpt_12_vsDEtaDPhi_%s", pname), TString::Format("#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (%s);#Delta#eta;#Delta#varphi;#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (GeV^{2})", pname), - deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); - fhSupN1N1VsDEtaDPhi[i][j] = new TH2F(TString::Format("suppn1n1_12_vsDEtaDPhi_%s", pname), TString::Format("Suppressed #LT n_{1} #GT#LT n_{1} #GT (%s);#Delta#eta;#Delta#varphi;#LT n_{1} #GT#LT n_{1} #GT", pname), - deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); - fhSupPt1Pt1VsDEtaDPhi[i][j] = new TH2F(TString::Format("suppPtPt_12_vsDEtaDPhi_%s", pname), TString::Format("Suppressed #LT p_{t,1} #GT#LT p_{t,2} #GT (%s);#Delta#eta;#Delta#varphi;#LT p_{t,1} #GT#LT p_{t,2} #GT (GeV^{2})", pname), - deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); - /* we return it back to previuos state */ - TH1::SetDefaultSumw2(defSumw2); - - fhN2VsPtPt[i][j] = new TH2F(TString::Format("n2_12_vsPtVsPt_%s", pname), TString::Format("#LT n_{2} #GT (%s);p_{t,1} (GeV/c);p_{t,2} (GeV/c);#LT n_{2} #GT", pname), - ptbins, ptlow, ptup, ptbins, ptlow, ptup); - - fhN2VsC[i][j] = new TProfile(TString::Format("n2_12_vsM_%s", pname), TString::Format("#LT n_{2} #GT (%s) (weighted);Centrality/Multiplicity (%%);#LT n_{2} #GT", pname), 100, 0.0, 100.0); - fhSum2PtPtVsC[i][j] = new TProfile(TString::Format("sumPtPt_12_vsM_%s", pname), TString::Format("#LT #Sigma p_{t,1}p_{t,2} #GT (%s) (weighted);Centrality/Multiplicity (%%);#LT #Sigma p_{t,1}p_{t,2} #GT (GeV^{2})", pname), 100, 0.0, 100.0); - fhSum2DptDptVsC[i][j] = new TProfile(TString::Format("sumDptDpt_12_vsM_%s", pname), TString::Format("#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (%s) (weighted);Centrality/Multiplicity (%%);#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (GeV^{2})", pname), 100, 0.0, 100.0); - fhN2NWVsC[i][j] = new TProfile(TString::Format("n2Nw_12_vsM_%s", pname), TString::Format("#LT n_{2} #GT (%s);Centrality/Multiplicity (%%);#LT n_{2} #GT", pname), 100, 0.0, 100.0); - fhSum2PtPtNWVsC[i][j] = new TProfile(TString::Format("sumPtPtNw_12_vsM_%s", pname), TString::Format("#LT #Sigma p_{t,1}p_{t,2} #GT (%s);Centrality/Multiplicity (%%);#LT #Sigma p_{t,1}p_{t,2} #GT (GeV^{2})", pname), 100, 0.0, 100.0); - fhSum2DptDptNWVsC[i][j] = new TProfile(TString::Format("sumDptDptNw_12_vsM_%s", pname), TString::Format("#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (%s);Centrality/Multiplicity (%%);#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (GeV^{2})", pname), 100, 0.0, 100.0); - - /* the statistical uncertainties will be estimated by the subsamples method so let's get rid of the error tracking */ - fhN2VsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); - fhN2VsDEtaDPhi[i][j]->Sumw2(false); - fhN2ContVsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); - fhN2ContVsDEtaDPhi[i][j]->Sumw2(false); - fhSum2PtPtVsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); - fhSum2PtPtVsDEtaDPhi[i][j]->Sumw2(false); - fhSum2DptDptVsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); - fhSum2DptDptVsDEtaDPhi[i][j]->Sumw2(false); - fhSupN1N1VsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); - fhSupN1N1VsDEtaDPhi[i][j]->Sumw2(false); - fhSupPt1Pt1VsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); - fhSupPt1Pt1VsDEtaDPhi[i][j]->Sumw2(false); - - fOutputList->Add(fhN2VsDEtaDPhi[i][j]); - fOutputList->Add(fhN2ContVsDEtaDPhi[i][j]); - fOutputList->Add(fhSum2PtPtVsDEtaDPhi[i][j]); - fOutputList->Add(fhSum2DptDptVsDEtaDPhi[i][j]); - fOutputList->Add(fhSupN1N1VsDEtaDPhi[i][j]); - fOutputList->Add(fhSupPt1Pt1VsDEtaDPhi[i][j]); - fOutputList->Add(fhN2VsPtPt[i][j]); - fOutputList->Add(fhN2VsC[i][j]); - fOutputList->Add(fhSum2PtPtVsC[i][j]); - fOutputList->Add(fhSum2DptDptVsC[i][j]); - fOutputList->Add(fhN2NWVsC[i][j]); - fOutputList->Add(fhSum2PtPtNWVsC[i][j]); - fOutputList->Add(fhSum2DptDptNWVsC[i][j]); - } - } - } - TH1::AddDirectory(oldstatus); - } - }; // DataCollectingEngine - - Service ccdb; - - /* the data memebers for this task */ - /* the centrality / multiplicity limits for collecting data in this task instance */ - int ncmranges = 0; - float* fCentMultMin = nullptr; - float* fCentMultMax = nullptr; - - /* the data collecting engine instances */ - DataCollectingEngine** dataCE; - DataCollectingEngine** dataCESmall; - DataCollectingEngine** dataCEME; - - /* the input file structure from CCDB */ - TList* ccdblst = nullptr; - bool loadfromccdb = false; - - /* pair conversion suppression defaults */ - static constexpr float PairCutDefaults[1][5] = {{-1, -1, -1, -1, -1}}; - Configurable> cfgPairCut{"cfgPairCut", {PairCutDefaults[0], 5, {"Photon", "K0", "Lambda", "Phi", "Rho"}}, "Conversion suppressions"}; - /* two tracks cut */ - Configurable cfgTwoTrackCut{"cfgTwoTrackCut", -1, "Two-tracks cut: -1 = off; >0 otherwise distance value (suggested: 0.02"}; - Configurable cfgTwoTrackCutMinRadius{"cfgTwoTrackCutMinRadius", 0.8f, "Two-tracks cut: radius in m from which two-tracks cut is applied"}; - - Configurable cfgSmallDCE{"cfgSmallDCE", true, "Use small data collecting engine for singles processing, true = yes. Default = true"}; - Configurable cfgProcessPairs{"cfgProcessPairs", false, "Process pairs: false = no, just singles, true = yes, process pairs"}; - Configurable cfgProcessME{"cfgProcessME", false, "Process mixed events: false = no, just same event, true = yes, also process mixed events"}; - Configurable cfgCentSpec{"cfgCentSpec", "00-05,05-10,10-20,20-30,30-40,40-50,50-60,60-70,70-80", "Centrality/multiplicity ranges in min-max separated by commas"}; - - Configurable cfgBinning{"cfgBinning", - {28, -7.0, 7.0, 18, 0.2, 2.0, 16, -0.8, 0.8, 72, 0.5}, - "triplets - nbins, min, max - for z_vtx, pT, eta and phi, binning plus bin fraction of phi origin shift"}; - Configurable cfgPtOrder{"cfgPtOrder", false, "enforce pT_1 < pT_2. Defalut: false"}; - struct : ConfigurableGroup { - Configurable cfgCCDBUrl{"cfgCCDBUrl", "http://ccdb-test.cern.ch:8080", "The CCDB url for the input file"}; - Configurable cfgCCDBPathName{"cfgCCDBPathName", "", "The CCDB path for the input file. Default \"\", i.e. don't load from CCDB"}; - Configurable cfgCCDBDate{"cfgCCDBDate", "20220307", "The CCDB date for the input file"}; - } cfginputfile; - - OutputObj fOutput{"IdentifiedBfCorrelationsData", OutputObjHandlingPolicy::AnalysisObject, OutputObjSourceType::OutputObjSource}; - - void init(InitContext const&) - { - using namespace correlationstask; - using namespace o2::analysis::identifiedbffilter; - - /* update with the configurable values */ - ptbins = cfgBinning->mPTbins; - ptlow = cfgBinning->mPTmin; - ptup = cfgBinning->mPTmax; - etabins = cfgBinning->mEtabins; - etalow = cfgBinning->mEtamin; - etaup = cfgBinning->mEtamax; - zvtxbins = cfgBinning->mZVtxbins; - zvtxlow = cfgBinning->mZVtxmin; - zvtxup = cfgBinning->mZVtxmax; - phibins = cfgBinning->mPhibins; - philow = 0.0f; - phiup = constants::math::TwoPI; - phibinshift = cfgBinning->mPhibinshift; - processpairs = cfgProcessPairs.value; - processmixedevents = cfgProcessME.value; - ptorder = cfgPtOrder.value; - loadfromccdb = cfginputfile.cfgCCDBPathName->length() > 0; - /* update the potential binning change */ - etabinwidth = (etaup - etalow) / static_cast(etabins); - phibinwidth = (phiup - philow) / static_cast(phibins); - - /* the differential bining */ - deltaetabins = etabins * 2 - 1; - deltaetalow = etalow - etaup, deltaetaup = etaup - etalow; - deltaetabinwidth = (deltaetaup - deltaetalow) / static_cast(deltaetabins); - deltaphibins = phibins; - deltaphibinwidth = constants::math::TwoPI / deltaphibins; - deltaphilow = 0.0 - deltaphibinwidth / 2.0; - deltaphiup = constants::math::TwoPI - deltaphibinwidth / 2.0; - - /* create the output directory which will own the task output */ - TList* fGlobalOutputList = new TList(); - fGlobalOutputList->SetOwner(true); - fOutput.setObject(fGlobalOutputList); - - /* incorporate configuration parameters to the output */ - fGlobalOutputList->Add(new TParameter("NoBinsPt", ptbins, 'f')); - fGlobalOutputList->Add(new TParameter("NoBinsEta", etabins, 'f')); - fGlobalOutputList->Add(new TParameter("NoBinsPhi", phibins, 'f')); - fGlobalOutputList->Add(new TParameter("NoBinsVertexZ", zvtxbins, 'f')); - fGlobalOutputList->Add(new TParameter("MinVertexZ", zvtxlow, 'f')); - fGlobalOutputList->Add(new TParameter("MaxVertexZ", zvtxup, 'f')); - fGlobalOutputList->Add(new TParameter("MinPt", ptlow, 'f')); - fGlobalOutputList->Add(new TParameter("MaxPt", ptup, 'f')); - fGlobalOutputList->Add(new TParameter("MinEta", etalow, 'f')); - fGlobalOutputList->Add(new TParameter("MaxEta", etaup, 'f')); - fGlobalOutputList->Add(new TParameter("MinPhi", philow, 'f')); - fGlobalOutputList->Add(new TParameter("MaxPhi", phiup, 'f')); - fGlobalOutputList->Add(new TParameter("PhiBinShift", phibinshift, 'f')); - fGlobalOutputList->Add(new TParameter("DifferentialOutput", true, 'f')); - fGlobalOutputList->Add(new TParameter("SmallDCE", cfgSmallDCE.value, 'f')); - - /* after the parameters dump the proper phi limits are set according to the phi shift */ - phiup = phiup - phibinwidth * phibinshift; - philow = philow - phibinwidth * phibinshift; - - /* create the data collecting engine instances according to the configured centrality/multiplicity ranges */ - { - TObjArray* tokens = TString(cfgCentSpec.value.c_str()).Tokenize(","); - ncmranges = tokens->GetEntries(); - fCentMultMin = new float[ncmranges]; - fCentMultMax = new float[ncmranges]; - dataCE = new DataCollectingEngine*[ncmranges]; - if (cfgSmallDCE) { - dataCESmall = new DataCollectingEngine*[ncmranges]; - } else { - dataCE = new DataCollectingEngine*[ncmranges]; - } - if (processmixedevents) { - dataCEME = new DataCollectingEngine*[ncmranges]; - } - - for (int i = 0; i < ncmranges; ++i) { - auto initializeCEInstance = [&fGlobalOutputList](auto dce, auto name) { - /* crete the output list for the passed centrality/multiplicity range */ - TList* fOutputList = new TList(); - fOutputList->SetName(name); - fOutputList->SetOwner(true); - /* init the data collection instance */ - dce->init(fOutputList); - fGlobalOutputList->Add(fOutputList); - }; - auto builSmallDCEInstance = [&initializeCEInstance](auto rg, bool me = false) { - DataCollectingEngine* dce = new DataCollectingEngine(); - initializeCEInstance(dce, TString::Format("IdentifiedBfCorrelationsData%s-%s", me ? "ME" : "", rg)); - return dce; - }; - auto buildCEInstance = [&initializeCEInstance](auto rg, bool me = false) { - DataCollectingEngine* dce = new DataCollectingEngine(); - initializeCEInstance(dce, TString::Format("IdentifiedBfCorrelationsData%s-%s", me ? "ME" : "", rg)); - return dce; - }; - float cmmin = 0.0f; - float cmmax = 0.0f; - sscanf(tokens->At(i)->GetName(), "%f-%f", &cmmin, &cmmax); - fCentMultMin[i] = cmmin; - fCentMultMax[i] = cmmax; - if (cfgSmallDCE.value) { - if (processpairs) { - LOGF(fatal, "Processing pairs cannot be used with the small DCE, please configure properly!!"); - } - dataCESmall[i] = builSmallDCEInstance(tokens->At(i)->GetName()); - } else { - dataCE[i] = buildCEInstance(tokens->At(i)->GetName()); - } - if (processmixedevents) { - /* consistency check */ - if (cfgSmallDCE.value) { - LOGF(fatal, "Mixed events cannot be used with the small DCE, please configure properly!!"); - } - dataCEME[i] = buildCEInstance(tokens->At(i)->GetName(), true); - } - } - delete tokens; - for (int i = 0; i < ncmranges; ++i) { - LOGF(info, " centrality/multipliicty range: %d, low limit: %f, up limit: %f", i, fCentMultMin[i], fCentMultMax[i]); - } - } - /* two-track cut and conversion suppression */ - fPairCuts.SetHistogramRegistry(nullptr); // not histogram registry for the time being, incompatible with TList when it is empty - if (processpairs && ((cfgPairCut->get("Photon") > 0) || (cfgPairCut->get("K0") > 0) || (cfgPairCut->get("Lambda") > 0) || (cfgPairCut->get("Phi") > 0) || (cfgPairCut->get("Rho") > 0))) { - fPairCuts.SetPairCut(PairCuts::Photon, cfgPairCut->get("Photon")); - fPairCuts.SetPairCut(PairCuts::K0, cfgPairCut->get("K0")); - fPairCuts.SetPairCut(PairCuts::Lambda, cfgPairCut->get("Lambda")); - fPairCuts.SetPairCut(PairCuts::Phi, cfgPairCut->get("Phi")); - fPairCuts.SetPairCut(PairCuts::Rho, cfgPairCut->get("Rho")); - fUseConversionCuts = true; - } - if (processpairs && (cfgTwoTrackCut > 0)) { - fPairCuts.SetTwoTrackCuts(cfgTwoTrackCut, cfgTwoTrackCutMinRadius); - fUseTwoTrackCut = true; - } - - /* initialize access to the CCDB */ - ccdb->setURL(cfginputfile.cfgCCDBUrl); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - } - - /// \brief Get the data collecting engine index corresponding to the passed collision - template - int getDCEindex(FilteredCollision collision) - { - int ixDCE = -1; - float cm = collision.centmult(); - for (int i = 0; i < ncmranges; ++i) { - if (cm < fCentMultMax[i]) { - ixDCE = i; - break; - } - } - if (!(ixDCE < 0)) { - if (cm < fCentMultMin[ixDCE]) { - ixDCE = -1; - } - } - return ixDCE; - } - - TList* getCCDBInput(const char* ccdbpath, const char* ccdbdate) - { - std::tm cfgtm = {}; - std::stringstream ss(ccdbdate); - ss >> std::get_time(&cfgtm, "%Y%m%d"); - cfgtm.tm_hour = 12; - int64_t timestamp = std::mktime(&cfgtm) * 1000; - - TList* lst = ccdb->getForTimeStamp(ccdbpath, timestamp); - if (lst != nullptr) { - LOGF(info, "Correctly loaded CCDB input object"); - } else { - LOGF(error, "CCDB input object could not be loaded"); - } - return lst; - } - - int getMagneticField(uint64_t timestamp) - { - // TODO done only once (and not per run). Will be replaced by CCDBConfigurable - static o2::parameters::GRPObject* grpo = nullptr; - if (grpo == nullptr) { - grpo = ccdb->getForTimeStamp("GLO/GRP/GRP", timestamp); - if (grpo == nullptr) { - LOGF(fatal, "GRP object not found for timestamp %llu", timestamp); - return 0; - } - LOGF(info, "Retrieved GRP for timestamp %llu with magnetic field of %d kG", timestamp, grpo->getNominalL3Field()); - } - return grpo->getNominalL3Field(); - } - - template - void processSame(FilterdCollision const& collision, FilteredTracks const& tracks, uint64_t timestamp = 0) - { - using namespace correlationstask; - if (ccdblst == nullptr) { - if (loadfromccdb) { - ccdblst = getCCDBInput(cfginputfile.cfgCCDBPathName->c_str(), cfginputfile.cfgCCDBDate->c_str()); - } - } - - /* locate the data collecting engine for the collision centrality/multiplicity */ - int ixDCE = getDCEindex(collision); - if (!(ixDCE < 0)) { - if (ccdblst != nullptr && !(dataCE[ixDCE]->isCCDBstored())) { - if constexpr (gen) { - std::vector ptavgs{tname.size(), nullptr}; - for (uint isp = 0; isp < tname.size(); ++isp) { - ptavgs[isp] = reinterpret_cast(ccdblst->FindObject( - TString::Format("trueptavgetaphi_%02d-%02d_%s", - static_cast(fCentMultMin[ixDCE]), - static_cast(fCentMultMax[ixDCE]), - tname[isp].c_str()) - .Data())); - } - if (cfgSmallDCE.value) { - dataCESmall[ixDCE]->storePtAverages(ptavgs); - } else { - dataCE[ixDCE]->storePtAverages(ptavgs); - } - } else { - std::vector corrs{tname.size(), nullptr}; - for (uint isp = 0; isp < tname.size(); ++isp) { - corrs[isp] = reinterpret_cast(ccdblst->FindObject( - TString::Format("correction_%02d-%02d_%s", - static_cast(fCentMultMin[ixDCE]), - static_cast(fCentMultMax[ixDCE]), - tname[isp].c_str()) - .Data())); - } - if (cfgSmallDCE.value) { - dataCESmall[ixDCE]->storeTrackCorrections(corrs); - } else { - dataCE[ixDCE]->storeTrackCorrections(corrs); - } - - std::vector ptavgs{tname.size(), nullptr}; - for (uint isp = 0; isp < tname.size(); ++isp) { - ptavgs[isp] = reinterpret_cast(ccdblst->FindObject( - TString::Format("ptavgetaphi_%02d-%02d_%s", - static_cast(fCentMultMin[ixDCE]), - static_cast(fCentMultMax[ixDCE]), - tname[isp].c_str()) - .Data())); - } - if (cfgSmallDCE.value) { - dataCESmall[ixDCE]->storePtAverages(ptavgs); - } else { - dataCE[ixDCE]->storePtAverages(ptavgs); - } - } - } - - std::string generated = ""; - if constexpr (gen) { - generated = "generated "; - } - - LOGF(IDENTIFIEDBFLOGCOLLISIONS, - "Accepted BC id %d %scollision with cent/mult %f and %d total tracks. Assigned DCE: %d", - collision.bcId(), - generated.c_str(), - collision.centmult(), - tracks.size(), - ixDCE); - int bfield = 0; - if constexpr (!gen) { - bfield = (fUseConversionCuts || fUseTwoTrackCut) ? getMagneticField(timestamp) : 0; - } - if (cfgSmallDCE.value) { - dataCESmall[ixDCE]->processCollision(tracks, tracks, collision.posZ(), collision.centmult(), bfield); - } else { - dataCE[ixDCE]->processCollision(tracks, tracks, collision.posZ(), collision.centmult(), bfield); - } - } - } - - template - void processMixed(FilterdCollision const& collision, FilteredTracks1 const& tracks1, FilteredTracks2 const& tracks2, uint64_t timestamp = 0) - { - using namespace correlationstask; - - if (ccdblst == nullptr) { - if (loadfromccdb) { - ccdblst = getCCDBInput(cfginputfile.cfgCCDBPathName->c_str(), cfginputfile.cfgCCDBDate->c_str()); - } - } - - /* locate the data collecting engine for the collision centrality/multiplicity */ - int ixDCE = getDCEindex(collision); - if (!(ixDCE < 0)) { - if (ccdblst != nullptr && !(dataCEME[ixDCE]->isCCDBstored())) { - if constexpr (gen) { - std::vector ptavgs{tname.size(), nullptr}; - for (uint isp = 0; isp < tname.size(); ++isp) { - ptavgs[isp] = reinterpret_cast(ccdblst->FindObject( - TString::Format("trueptavgetaphi_%02d-%02d_%s", - static_cast(fCentMultMin[ixDCE]), - static_cast(fCentMultMax[ixDCE]), - tname[isp].c_str()) - .Data())); - } - dataCEME[ixDCE]->storePtAverages(ptavgs); - } else { - std::vector corrs{tname.size(), nullptr}; - for (uint isp = 0; isp < tname.size(); ++isp) { - corrs[isp] = reinterpret_cast(ccdblst->FindObject( - TString::Format("correction_%02d-%02d_%s", - static_cast(fCentMultMin[ixDCE]), - static_cast(fCentMultMax[ixDCE]), - tname[isp].c_str()) - .Data())); - } - dataCEME[ixDCE]->storeTrackCorrections(corrs); - - std::vector ptavgs{tname.size(), nullptr}; - for (uint isp = 0; isp < tname.size(); ++isp) { - ptavgs[isp] = reinterpret_cast(ccdblst->FindObject( - TString::Format("ptavgetaphi_%02d-%02d_%s", - static_cast(fCentMultMin[ixDCE]), - static_cast(fCentMultMax[ixDCE]), - tname[isp].c_str()) - .Data())); - } - dataCEME[ixDCE]->storePtAverages(ptavgs); - } - } - - std::string generated = ""; - if constexpr (gen) { - generated = "generated "; - } - - LOGF(IDENTIFIEDBFLOGCOLLISIONS, - "Accepted BC id %d mixed %scollision with cent/mult %f and %d-%d total mixed tracks. " - "Assigned DCE: %d", - collision.bcId(), - generated.c_str(), - collision.centmult(), - tracks1.size(), - tracks2.size(), - ixDCE); - int bfield = 0; - if constexpr (!gen) { - bfield = (fUseConversionCuts || fUseTwoTrackCut) ? getMagneticField(timestamp) : 0; - } - dataCEME[ixDCE]->processCollision(tracks1, tracks2, collision.posZ(), collision.centmult(), bfield); - } - } - - Filter onlyacceptedcollisions = (aod::identifiedbffilter::collisionaccepted == uint8_t(true)); - Filter onlyacceptedtracks = (aod::identifiedbffilter::trackacceptedid >= int8_t(0)); - - void processRecLevel(soa::Filtered::iterator const& collision, aod::BCsWithTimestamps const&, soa::Filtered const& tracks) - { - processSame(collision, tracks, collision.bc_as().timestamp()); - } - PROCESS_SWITCH(IdentifiedbfTask, processRecLevel, "Process reco level correlations", false); - - void processRecLevelCheck(aod::Collisions const& collisions, aod::Tracks const& tracks) - { - int nAssignedTracks = 0; - int nNotAssignedTracks = 0; - int64_t firstNotAssignedIndex = -1; - int64_t lastNotAssignedIndex = -1; - - for (const auto& track : tracks) { - if (track.has_collision()) { - nAssignedTracks++; - } else { - nNotAssignedTracks++; - if (firstNotAssignedIndex < 0) { - firstNotAssignedIndex = track.globalIndex(); - } else { - lastNotAssignedIndex = track.globalIndex(); - } - } - } - LOGF(info, "Received %d collisions and %d tracks.", collisions.size(), tracks.size()); - LOGF(info, " Assigned tracks %d", nAssignedTracks); - LOGF(info, " Not assigned tracks %d", nNotAssignedTracks); - LOGF(info, " First not assigned track index %d", firstNotAssignedIndex); - LOGF(info, " Last not assigned track index %d", lastNotAssignedIndex); - } - PROCESS_SWITCH(IdentifiedbfTask, processRecLevelCheck, "Process reco level checks", true); - - void processGenLevelCheck(aod::McCollisions const& mccollisions, aod::McParticles const& particles) - { - int nAssignedParticles = 0; - int nNotAssignedParticles = 0; - int64_t firstNotAssignedIndex = -1; - int64_t lastNotAssignedIndex = -1; - - for (const auto& particle : particles) { - if (particle.has_mcCollision()) { - nAssignedParticles++; - } else { - nNotAssignedParticles++; - if (firstNotAssignedIndex < 0) { - firstNotAssignedIndex = particle.globalIndex(); - } else { - lastNotAssignedIndex = particle.globalIndex(); - } - } - } - LOGF(info, "Received %d generated collisions and %d particles.", mccollisions.size(), particles.size()); - LOGF(info, " Assigned tracks %d", nAssignedParticles); - LOGF(info, " Not assigned tracks %d", nNotAssignedParticles); - LOGF(info, " First not assigned track index %d", firstNotAssignedIndex); - LOGF(info, " Last not assigned track index %d", lastNotAssignedIndex); - } - PROCESS_SWITCH(IdentifiedbfTask, processGenLevelCheck, "Process generator level checks", true); - - void processRecLevelNotStored( - soa::Filtered>::iterator const& collision, - aod::BCsWithTimestamps const&, - soa::Filtered> const& tracks) - { - processSame(collision, tracks, collision.bc_as().timestamp()); - } - PROCESS_SWITCH(IdentifiedbfTask, processRecLevelNotStored, - "Process reco level correlations for not stored derived data", - true); - - void processDetLevelNotStored( - soa::Filtered>::iterator const& collision, - aod::BCsWithTimestamps const&, - soa::Filtered> const& tracks, - aod::McParticles const&) - { - processSame(collision, tracks, collision.bc_as().timestamp()); - } - PROCESS_SWITCH(IdentifiedbfTask, processDetLevelNotStored, - "Process detecotr level correlations for not stored derived data", - true); - - void processGenLevel( - soa::Filtered::iterator const& collision, - soa::Filtered> const& tracks) - { - processSame(collision, tracks); - } - PROCESS_SWITCH(IdentifiedbfTask, processGenLevel, "Process generator level correlations", false); - - void processGenLevelNotStored( - soa::Filtered>::iterator const& collision, - soa::Filtered> const& particles) - { - processSame(collision, particles); - } - PROCESS_SWITCH(IdentifiedbfTask, processGenLevelNotStored, - "Process generator level correlations for not stored derived data", - false); - - std::vector - vtxBinsEdges{VARIABLE_WIDTH, -7.0f, -5.0f, -3.0f, -1.0f, 1.0f, 3.0f, 5.0f, 7.0f}; - std::vector multBinsEdges{VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0, 100.1f}; - SliceCache cache; - using BinningZVtxMultRec = ColumnBinningPolicy; - BinningZVtxMultRec bindingOnVtxAndMultRec{{vtxBinsEdges, multBinsEdges}, true}; // true is for 'ignore overflows' (true by default) - - void processRecLevelMixed(soa::Filtered const& collisions, aod::BCsWithTimestamps const&, soa::Filtered const& tracks) - { - auto tracksTuple = std::make_tuple(tracks); - SameKindPair, soa::Filtered, BinningZVtxMultRec> pairreco{bindingOnVtxAndMultRec, 5, -1, collisions, tracksTuple, &cache}; // indicates that 5 events should be mixed and under/overflow (-1) to be ignored - - LOGF(IDENTIFIEDBFLOGCOLLISIONS, "Received %d collisions", collisions.size()); - int logcomb = 0; - for (const auto& [collision1, tracks1, collision2, tracks2] : pairreco) { - if (logcomb < correlationstask::maxLogComb) { - LOGF(IDENTIFIEDBFLOGCOLLISIONS, "Received collision pair: %ld (%f, %f): %s, %ld (%f, %f): %s", - collision1.globalIndex(), collision1.posZ(), collision1.centmult(), collision1.collisionaccepted() ? "accepted" : "not accepted", - collision2.globalIndex(), collision2.posZ(), collision2.centmult(), collision2.collisionaccepted() ? "accepted" : "not accepted"); - logcomb++; - } - if (!collision1.collisionaccepted() || !collision2.collisionaccepted()) { - LOGF(error, "Received collision pair: %ld (%f, %f): %s, %ld (%f, %f): %s", - collision1.globalIndex(), collision1.posZ(), collision1.centmult(), collision1.collisionaccepted() ? "accepted" : "not accepted", - collision2.globalIndex(), collision2.posZ(), collision2.centmult(), collision2.collisionaccepted() ? "accepted" : "not accepted"); - } - processMixed(collision1, tracks1, tracks2, collision1.bc_as().timestamp()); - } - } - PROCESS_SWITCH(IdentifiedbfTask, processRecLevelMixed, "Process reco level mixed events correlations", false); - - void processRecLevelMixedNotStored( - soa::Filtered> const& collisions, - aod::BCsWithTimestamps const&, - soa::Filtered> const& tracks) - { - auto tracksTuple = std::make_tuple(tracks); - SameKindPair>, - soa::Filtered>, - BinningZVtxMultRec> - pairreco{bindingOnVtxAndMultRec, - 5, - -1, - collisions, - tracksTuple, - &cache}; // indicates that 5 events should be mixed and under/overflow (-1) to be ignored - - LOGF(IDENTIFIEDBFLOGCOLLISIONS, "Received %d collisions", collisions.size()); - int logcomb = 0; - for (const auto& [collision1, tracks1, collision2, tracks2] : pairreco) { - if (logcomb < correlationstask::maxLogComb) { - LOGF(IDENTIFIEDBFLOGCOLLISIONS, - "Received collision pair: %ld (%f, %f): %s, %ld (%f, %f): %s", - collision1.globalIndex(), - collision1.posZ(), - collision1.centmult(), - collision1.collisionaccepted() ? "accepted" : "not accepted", - collision2.globalIndex(), - collision2.posZ(), - collision2.centmult(), - collision2.collisionaccepted() ? "accepted" : "not accepted"); - logcomb++; - } - if (!collision1.collisionaccepted() || !collision2.collisionaccepted()) { - LOGF(error, - "Received collision pair: %ld (%f, %f): %s, %ld (%f, %f): %s", - collision1.globalIndex(), - collision1.posZ(), - collision1.centmult(), - collision1.collisionaccepted() ? "accepted" : "not accepted", - collision2.globalIndex(), - collision2.posZ(), - collision2.centmult(), - collision2.collisionaccepted() ? "accepted" : "not accepted"); - } - processMixed(collision1, - tracks1, - tracks2, - collision1.bc_as().timestamp()); - } - } - PROCESS_SWITCH(IdentifiedbfTask, processRecLevelMixedNotStored, - "Process reco level mixed events correlations for not stored derived data", - false); - - using BinningZVtxMultGen = ColumnBinningPolicy; - BinningZVtxMultGen bindingOnVtxAndMultGen{{vtxBinsEdges, multBinsEdges}, true}; // true is for 'ignore overflows' (true by default) - - void processGenLevelMixed(soa::Filtered const& collisions, soa::Filtered const& tracks) - { - auto tracksTuple = std::make_tuple(tracks); - SameKindPair, soa::Filtered, BinningZVtxMultGen> pairgen{bindingOnVtxAndMultGen, 5, -1, collisions, tracksTuple, &cache}; // indicates that 5 events should be mixed and under/overflow (-1) to be ignored - - LOGF(IDENTIFIEDBFLOGCOLLISIONS, "Received %d generated collisions", collisions.size()); - int logcomb = 0; - for (const auto& [collision1, tracks1, collision2, tracks2] : pairgen) { - if (logcomb < correlationstask::maxLogComb) { - LOGF(IDENTIFIEDBFLOGCOLLISIONS, "Received generated collision pair: %ld (%f, %f): %s, %ld (%f, %f): %s", - collision1.globalIndex(), collision1.posZ(), collision1.centmult(), collision1.collisionaccepted() ? "accepted" : "not accepted", - collision2.globalIndex(), collision2.posZ(), collision2.centmult(), collision2.collisionaccepted() ? "accepted" : "not accepted"); - } - if (!collision1.collisionaccepted() || !collision2.collisionaccepted()) { - LOGF(error, "Received collision pair: %ld (%f, %f): %s, %ld (%f, %f): %s", - collision1.globalIndex(), collision1.posZ(), collision1.centmult(), collision1.collisionaccepted() ? "accepted" : "not accepted", - collision2.globalIndex(), collision2.posZ(), collision2.centmult(), collision2.collisionaccepted() ? "accepted" : "not accepted"); - } - processMixed(collision1, tracks1, tracks2); - } - } - PROCESS_SWITCH(IdentifiedbfTask, processGenLevelMixed, "Process generator level mixed events correlations", false); - - void processGenLevelMixedNotStored( - soa::Filtered> const& collisions, - soa::Filtered> const& tracks) - { - auto tracksTuple = std::make_tuple(tracks); - SameKindPair>, - soa::Filtered>, - BinningZVtxMultGen> - pairgen{bindingOnVtxAndMultGen, - 5, - -1, - collisions, - tracksTuple, - &cache}; // indicates that 5 events should be mixed and under/overflow (-1) to be ignored - - LOGF(IDENTIFIEDBFLOGCOLLISIONS, "Received %d generated collisions", collisions.size()); - int logcomb = 0; - for (const auto& [collision1, tracks1, collision2, tracks2] : pairgen) { - if (logcomb < correlationstask::maxLogComb) { - LOGF(IDENTIFIEDBFLOGCOLLISIONS, - "Received generated collision pair: %ld (%f, %f): %s, %ld (%f, %f): %s", - collision1.globalIndex(), - collision1.posZ(), - collision1.centmult(), - collision1.collisionaccepted() ? "accepted" : "not accepted", - collision2.globalIndex(), - collision2.posZ(), - collision2.centmult(), - collision2.collisionaccepted() ? "accepted" : "not accepted"); - } - if (!collision1.collisionaccepted() || !collision2.collisionaccepted()) { - LOGF(error, - "Received collision pair: %ld (%f, %f): %s, %ld (%f, %f): %s", - collision1.globalIndex(), - collision1.posZ(), - collision1.centmult(), - collision1.collisionaccepted() ? "accepted" : "not accepted", - collision2.globalIndex(), - collision2.posZ(), - collision2.centmult(), - collision2.collisionaccepted() ? "accepted" : "not accepted"); - } - processMixed(collision1, tracks1, tracks2); - } - } - PROCESS_SWITCH(IdentifiedbfTask, processGenLevelMixedNotStored, - "Process generator level mixed events correlations for not stored derived data", - false); - - /// cleans the output object when the task is not used - void processCleaner(soa::Filtered const& colls) - { - LOGF(IDENTIFIEDBFLOGCOLLISIONS, "Got %d new collisions", colls.size()); - fOutput->Clear(); - } - PROCESS_SWITCH(IdentifiedbfTask, processCleaner, "Cleaner process for not used output", false); -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - WorkflowSpec workflow{ - adaptAnalysisTask(cfgc, TaskName{"IdentifiedbfTaskRec"}, SetDefaultProcesses{{{"processRecLevel", true}, {"processRecLevelMixed", false}, {"processCleaner", false}}}), // o2-linter: disable=name/o2-task (Task is adapted multiple times) - adaptAnalysisTask(cfgc, TaskName{"IdentifiedbfTaskGen"}, SetDefaultProcesses{{{"processGenLevel", false}, {"processGenLevelMixed", false}, {"processCleaner", true}}})}; // o2-linter: disable=name/o2-task (Task is adapted multiple times) - return workflow; -} diff --git a/PWGCF/TwoParticleCorrelations/Tasks/identifiedbfqa.cxx b/PWGCF/TwoParticleCorrelations/Tasks/identifiedbfqa.cxx deleted file mode 100644 index a52ff377832..00000000000 --- a/PWGCF/TwoParticleCorrelations/Tasks/identifiedbfqa.cxx +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#include - -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "PWGCF/TwoParticleCorrelations/DataModel/IdentifiedBfFiltered.h" -#include "PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.h" - -using namespace o2; -using namespace o2::framework; -using namespace o2::soa; -using namespace o2::framework::expressions; - -#define IDENTIFIEDBFFILTERLOGCOLLISIONS debug -// #define IDENTIFIEDBFFILTERLOGTRACKS debug - -namespace o2::analysis::identifiedbffilterqa -{ -typedef enum { kRECO = 0, - kGEN } innerdatatype; -static constexpr std::string_view dirname[] = {"reconstructed/", "generated/"}; -} // namespace o2::analysis::identifiedbffilterqa - -// Checking the filtered tables -struct IdentifiedBfFilterQA { - Configurable cfgDataType{"datatype", "data", "Data type: data, MC, FastMC, OnTheFlyMC. Default data"}; - HistogramRegistry histos{"IdentifiedBfFilterQA", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - o2::analysis::identifiedbffilter::DataType datatype; - - template - void createHistograms() - { - - using namespace o2::analysis::identifiedbffilterqa; - - histos.add(TString::Format("%s%s", dirname[dir].data(), "TracksOne").Data(), "Tracks as track one", kTH1F, {{1500, 0.0, 1500.0, "number of tracks"}}); - histos.add(TString::Format("%s%s", dirname[dir].data(), "TracksTwo").Data(), "Tracks as track two", kTH1F, {{1500, 0.0, 1500.0, "number of tracks"}}); - histos.add(TString::Format("%s%s", dirname[dir].data(), "TracksOneAndTwo").Data(), "Tracks as track one and as track two", kTH1F, {{1500, 0.0, 1500.0, "number of tracks"}}); - histos.add(TString::Format("%s%s", dirname[dir].data(), "TracksNone").Data(), "Not selected tracks", kTH1F, {{1500, 0.0, 1500.0, "number of tracks"}}); - histos.add(TString::Format("%s%s", dirname[dir].data(), "TracksOneUnsel").Data(), "Tracks as track one", kTH1F, {{1500, 0.0, 1500.0, "number of tracks"}}); - histos.add(TString::Format("%s%s", dirname[dir].data(), "TracksTwoUnsel").Data(), "Tracks as track two", kTH1F, {{1500, 0.0, 1500.0, "number of tracks"}}); - histos.add(TString::Format("%s%s", dirname[dir].data(), "TracksOneAndTwoUnsel").Data(), "Tracks as track one and as track two", kTH1F, {{1500, 0.0, 1500.0, "number of tracks"}}); - histos.add(TString::Format("%s%s", dirname[dir].data(), "TracksNoneUnsel").Data(), "Not selected tracks", kTH1F, {{1500, 0.0, 1500.0}}); - histos.add(TString::Format("%s%s", dirname[dir].data(), "SelectedEvents").Data(), "Selected events", kTH1F, {{2, 0.0, 2.0}}); - histos.get(HIST(dirname[dir]) + HIST("SelectedEvents"))->GetXaxis()->SetBinLabel(1, "Not selected events"); - histos.get(HIST(dirname[dir]) + HIST("SelectedEvents"))->GetXaxis()->SetBinLabel(2, "Selected events"); - }; - - void init(InitContext const&) - { - using namespace o2::analysis::identifiedbffilter; - using namespace o2::analysis::identifiedbffilterqa; - - switch (getDataType(cfgDataType)) { - case kData: - createHistograms(); - break; - case kMC: - createHistograms(); - createHistograms(); - break; - case kFastMC: - case kOnTheFly: - createHistograms(); - break; - default: - LOGF(fatal, "Data type %s not supported", (std::string)cfgDataType); - break; - } - } - - template - void processQATask(FilteredCollision const& collision, - FilteredTracks const& tracks) - { - using namespace o2::analysis::identifiedbffilterqa; - - if (collision.collisionaccepted() != uint8_t(true)) { - histos.fill(HIST(dirname[dir]) + HIST("SelectedEvents"), 0.5); - } else { - histos.fill(HIST(dirname[dir]) + HIST("SelectedEvents"), 1.5); - } - - int ntracks_one = 0; - int ntracks_two = 0; - int ntracks_one_and_two = 0; - int ntracks_none = 0; - for (auto& track : tracks) { - if (!(track.trackacceptedid() < 0) && !(track.trackacceptedid() < 2)) { - LOGF(fatal, "Task not prepared for identified particles"); - } - if (track.trackacceptedid() != 0 && track.trackacceptedid() != 1) { - ntracks_none++; - } - if (track.trackacceptedid() == 0) { - ntracks_one++; - } - if (track.trackacceptedid() == 1) { - ntracks_two++; - } - } - if (collision.collisionaccepted() != uint8_t(true)) { - /* control for non selected events */ - histos.fill(HIST(dirname[dir]) + HIST("TracksOneUnsel"), ntracks_one); - histos.fill(HIST(dirname[dir]) + HIST("TracksTwoUnsel"), ntracks_two); - histos.fill(HIST(dirname[dir]) + HIST("TracksNoneUnsel"), ntracks_none); - histos.fill(HIST(dirname[dir]) + HIST("TracksOneAndTwoUnsel"), ntracks_one_and_two); - } else { - histos.fill(HIST(dirname[dir]) + HIST("TracksOne"), ntracks_one); - histos.fill(HIST(dirname[dir]) + HIST("TracksTwo"), ntracks_two); - histos.fill(HIST(dirname[dir]) + HIST("TracksNone"), ntracks_none); - histos.fill(HIST(dirname[dir]) + HIST("TracksOneAndTwo"), ntracks_one_and_two); - } - } - - Filter onlyacceptedcollisions = (aod::identifiedbffilter::collisionaccepted == uint8_t(true)); - Filter onlyacceptedtracks = (int8_t(0) <= aod::identifiedbffilter::trackacceptedid); - - void processGeneratorLevel(soa::Filtered::iterator const& collision, soa::Filtered const& tracks) - { - using namespace o2::analysis::identifiedbffilterqa; - LOGF(IDENTIFIEDBFFILTERLOGCOLLISIONS, "New filtered generated collision with BC id %d and with %d accepted tracks", collision.bcId(), tracks.size()); - processQATask(collision, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterQA, processGeneratorLevel, "Process generator level filter task QA", true); - - void processDetectorLevel(soa::Filtered::iterator const& collision, soa::Filtered const& tracks) - { - using namespace o2::analysis::identifiedbffilterqa; - LOGF(IDENTIFIEDBFFILTERLOGCOLLISIONS, "New filtered collision with BC id %d and with %d accepted tracks", collision.bcId(), tracks.size()); - processQATask(collision, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterQA, processDetectorLevel, "Process detector level filter task QA", true); -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - WorkflowSpec workflow{adaptAnalysisTask(cfgc)}; - return workflow; -} From 2da90068ac100e6d00ed049dacb863ec7df5bc18 Mon Sep 17 00:00:00 2001 From: ariedel-cern <85537041+ariedel-cern@users.noreply.github.com> Date: Sat, 13 Sep 2025 18:03:34 +0200 Subject: [PATCH 385/986] [PWGCF] New unified data model for femto analysis (#12376) --- PWGCF/Femto/CMakeLists.txt | 6 +- PWGCF/Femto/Core/CMakeLists.txt | 10 + PWGCF/Femto/Core/baseSelection.h | 275 ++++++++ PWGCF/Femto/Core/cascadeBuilder.h | 465 +++++++++++++ PWGCF/Femto/Core/cascadeHistManager.h | 268 ++++++++ PWGCF/Femto/Core/collisionBuilder.h | 358 ++++++++++ PWGCF/Femto/Core/collisionHistManager.h | 153 +++++ PWGCF/Femto/Core/dataTypes.h | 51 ++ PWGCF/Femto/Core/femtoUtils.h | 189 ++++++ PWGCF/Femto/Core/histManager.h | 82 +++ PWGCF/Femto/Core/modes.h | 112 ++++ PWGCF/Femto/Core/partitions.h | 113 ++++ PWGCF/Femto/Core/selectionContainer.h | 342 ++++++++++ PWGCF/Femto/Core/trackBuilder.h | 615 ++++++++++++++++++ PWGCF/Femto/Core/trackHistManager.h | 557 ++++++++++++++++ PWGCF/Femto/Core/twoTrackResonanceBuilder.h | 608 +++++++++++++++++ .../Femto/Core/twoTrackResonanceHistManager.h | 200 ++++++ PWGCF/Femto/Core/v0Builder.h | 471 ++++++++++++++ PWGCF/Femto/Core/v0HistManager.h | 334 ++++++++++ PWGCF/Femto/DataModel/CMakeLists.txt | 10 + PWGCF/Femto/DataModel/FemtoTables.h | 575 ++++++++++++++++ PWGCF/Femto/FemtoNuclei/CMakeLists.txt | 12 + .../DataModel/PionNucleiTables.h | 6 +- .../FemtoNuclei/TableProducer/CMakeLists.txt | 15 + .../TableProducer/PiNucleiFemto.cxx | 2 +- PWGCF/Femto/TableProducer/CMakeLists.txt | 6 +- PWGCF/Femto/TableProducer/femtoProducer.cxx | 300 +++++++++ PWGCF/Femto/Tasks/CMakeLists.txt | 40 ++ PWGCF/Femto/Tasks/femtoCascadeQa.cxx | 161 +++++ PWGCF/Femto/Tasks/femtoTrackQa.cxx | 100 +++ .../Femto/Tasks/femtoTwotrackresonanceQa.cxx | 181 ++++++ PWGCF/Femto/Tasks/femtoV0Qa.cxx | 160 +++++ PWGCF/Femto/Utils/CMakeLists.txt | 10 + 33 files changed, 6778 insertions(+), 9 deletions(-) create mode 100644 PWGCF/Femto/Core/CMakeLists.txt create mode 100644 PWGCF/Femto/Core/baseSelection.h create mode 100644 PWGCF/Femto/Core/cascadeBuilder.h create mode 100644 PWGCF/Femto/Core/cascadeHistManager.h create mode 100644 PWGCF/Femto/Core/collisionBuilder.h create mode 100644 PWGCF/Femto/Core/collisionHistManager.h create mode 100644 PWGCF/Femto/Core/dataTypes.h create mode 100644 PWGCF/Femto/Core/femtoUtils.h create mode 100644 PWGCF/Femto/Core/histManager.h create mode 100644 PWGCF/Femto/Core/modes.h create mode 100644 PWGCF/Femto/Core/partitions.h create mode 100644 PWGCF/Femto/Core/selectionContainer.h create mode 100644 PWGCF/Femto/Core/trackBuilder.h create mode 100644 PWGCF/Femto/Core/trackHistManager.h create mode 100644 PWGCF/Femto/Core/twoTrackResonanceBuilder.h create mode 100644 PWGCF/Femto/Core/twoTrackResonanceHistManager.h create mode 100644 PWGCF/Femto/Core/v0Builder.h create mode 100644 PWGCF/Femto/Core/v0HistManager.h create mode 100644 PWGCF/Femto/DataModel/CMakeLists.txt create mode 100644 PWGCF/Femto/DataModel/FemtoTables.h create mode 100644 PWGCF/Femto/FemtoNuclei/CMakeLists.txt rename PWGCF/Femto/{ => FemtoNuclei}/DataModel/PionNucleiTables.h (96%) create mode 100644 PWGCF/Femto/FemtoNuclei/TableProducer/CMakeLists.txt rename PWGCF/Femto/{ => FemtoNuclei}/TableProducer/PiNucleiFemto.cxx (99%) create mode 100644 PWGCF/Femto/TableProducer/femtoProducer.cxx create mode 100644 PWGCF/Femto/Tasks/CMakeLists.txt create mode 100644 PWGCF/Femto/Tasks/femtoCascadeQa.cxx create mode 100644 PWGCF/Femto/Tasks/femtoTrackQa.cxx create mode 100644 PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx create mode 100644 PWGCF/Femto/Tasks/femtoV0Qa.cxx create mode 100644 PWGCF/Femto/Utils/CMakeLists.txt diff --git a/PWGCF/Femto/CMakeLists.txt b/PWGCF/Femto/CMakeLists.txt index 3b94846cb86..d43e99e58fb 100644 --- a/PWGCF/Femto/CMakeLists.txt +++ b/PWGCF/Femto/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2019-2025 CERN and copyright holders of ALICE O2. +# Copyright 2019-2024 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. # @@ -9,6 +9,8 @@ # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. -#add_subdirectory(DataModel) +add_subdirectory(Core) add_subdirectory(TableProducer) +add_subdirectory(Tasks) +add_subdirectory(FemtoNuclei) diff --git a/PWGCF/Femto/Core/CMakeLists.txt b/PWGCF/Femto/Core/CMakeLists.txt new file mode 100644 index 00000000000..4c182222bf2 --- /dev/null +++ b/PWGCF/Femto/Core/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright 2019-2024 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. diff --git a/PWGCF/Femto/Core/baseSelection.h b/PWGCF/Femto/Core/baseSelection.h new file mode 100644 index 00000000000..f452db10e21 --- /dev/null +++ b/PWGCF/Femto/Core/baseSelection.h @@ -0,0 +1,275 @@ +// Copyright 2019-2025 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 baseSelection.h +/// \brief Defines the BaseSelection class for managing and evaluating multiple selections over multiple observables. +/// \author Anton Riedel, TU München, anton.riedel@tum.de + +#ifndef PWGCF_FEMTO_CORE_BASESELECTION_H_ +#define PWGCF_FEMTO_CORE_BASESELECTION_H_ + +#include "PWGCF/Femto/Core/selectionContainer.h" + +#include "fairlogger/Logger.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace o2::analysis::femto +{ + +/// \class BaseSelection +/// \brief Template class for managing selection criteria across multiple observables. +/// +/// This class manages an array of SelectionContainer objects, each corresponding to a specific observable. +/// It evaluates which selections are fulfilled, assembles a final bitmask, and tracks required vs. optional cuts. +/// +/// \tparam T Type of observable values (mostly floats). +/// \tparam BitmaskType Type used for internal bitmask operations (e.g., uint32_t, uint64_t). +/// \tparam NumObservables Total number of observables handled. +template +class BaseSelection +{ + public: + /// \brief Default constructor. + BaseSelection() {} + + /// \brief Destructor + virtual ~BaseSelection() = default; + + /// \brief Add a static-value based selection for a specific observable. + /// \param selectionValues Vector of threshold values. + /// \param observableIndex Index of the observable. + /// \param limitType Type of limit (from limits::LimitType). + /// \param skipMostPermissiveBit Whether to skip the loosest threshold in the bitmask. + /// \param isMinimalCut Whether this cut is mandatory or optional. + void addSelection(std::vector const& selectionValues, int observableIndex, limits::LimitType limitType, bool skipMostPermissiveBit, bool isMinimalCut) + { + if (static_cast(observableIndex) >= NumObservables) { + LOG(fatal) << "Observable is not valid. Observable (index) has to be smaller than " << NumObservables; + } + if (skipMostPermissiveBit) { + mNSelections += selectionValues.size() - 1; + } else { + mNSelections += selectionValues.size(); + } + if (mNSelections >= sizeof(BitmaskType) * CHAR_BIT) { + LOG(fatal) << "Too many selections. At most " << sizeof(BitmaskType) * CHAR_BIT << " are supported"; + } + // check if any cut is optional + if (!isMinimalCut) { + mHasOptionalSelection = true; + } + mSelectionContainers.at(observableIndex) = SelectionContainer(selectionValues, limitType, skipMostPermissiveBit, isMinimalCut); + } + + /// \brief Add a function-based selection for a specific observable. + /// \param baseName Base name for TF1 functions. + /// \param lowerLimit Lower bound for the TF1 domain. + /// \param upperLimit Upper bound for the TF1 domain. + /// \param selectionValues Function definitions as strings. + /// \param observableIndex Index of the observable. + /// \param limitType Type of limit. + /// \param skipMostPermissiveBit Whether to skip the loosest threshold in the bitmask. + /// \param isMinimalCut Whether this cut is mandatory or optional. + void addSelection(std::string const& baseName, + T lowerLimit, + T upperLimit, + std::vector const& selectionValues, + int observableIndex, + limits::LimitType limitType, + bool skipMostPermissiveBit, + bool isMinimalCut) + { + if (static_cast(observableIndex) >= NumObservables) { + LOG(fatal) << "Observable is not valid. Observable (index) has to be smaller than " << NumObservables; + } + if (skipMostPermissiveBit) { + mNSelections += selectionValues.size() - 1; + } else { + mNSelections += selectionValues.size(); + } + if (mNSelections >= sizeof(BitmaskType) * CHAR_BIT) { + LOG(fatal) << "Too many selections. At most " << sizeof(BitmaskType) * CHAR_BIT << " are supported"; + } + mSelectionContainers.at(observableIndex) = SelectionContainer(baseName, lowerLimit, upperLimit, selectionValues, limitType, skipMostPermissiveBit, isMinimalCut); + } + + /// \brief Update the limits of a function-based selection for a specific observable. + /// \param observable Index of the observable. + /// \param value Value at which to evaluate the selection functions. + void updateLimits(int observable, T value) { mSelectionContainers.at(observable).updateLimits(value); } + + /// \brief Reset the internal bitmask and evaluation flags before evaluating a new event. + void reset() + { + mFinalBitmask.reset(); + mPassesMinimalSelections = true; + // will be true if no optional cut as been defined and + // will be set to false if we have optional cuts (but will be set to true in the case at least one optional cut succeeds) + mPassesOptionalSelections = !mHasOptionalSelection; + } + + /// \brief Evaluate a single observable against its configured selections. + /// \param observableIndex Index of the observable. + /// \param value Value of the observable. + void evaluateObservable(int observableIndex, T value) + { + // if there are no selections configured, bail out + if (mSelectionContainers.at(observableIndex).isEmpty()) { + return; + } + // if any previous observable did not pass minimal selections, there is no point in setting bitmask for other observables + // minimal selection for each observable is computed after adding it + if (mPassesMinimalSelections == false) { + return; + } + // set bitmask for given observable + mSelectionContainers.at(observableIndex).evaluate(value); + // check if minimal selction for this observable holds + if (mSelectionContainers.at(observableIndex).passesAsMinimalCut() == false) { + mPassesMinimalSelections = false; + } + // check if any optional selection holds + if (mSelectionContainers.at(observableIndex).passesAsOptionalCut() == true) { + mPassesOptionalSelections = true; + } + } + + /// \brief Check if all required (minimal) and optional cuts are passed. + /// \return True if all required and at least one optional cut (if present) is passed. + bool passesAllRequiredSelections() const + { + return mPassesMinimalSelections && mPassesOptionalSelections; + } + + /// \brief Check if the optional selection for a specific observable is passed. + /// \param observableIndex Index of the observable. + /// \return True if at least one optional selection is fulfilled. + bool passesOptionalSelection(int observableIndex) const + { + return mSelectionContainers.at(observableIndex).passesAsOptionalCut(); + } + + /// \brief Assemble the global selection bitmask from individual observable selections. + void assembleBitmask() + { + // if minimal selections are not passed, just set bitmask to 0 + if (mPassesMinimalSelections == false) { + mFinalBitmask.reset(); + return; + } + + // to assemble bitmask, convert all bitmask into integers + // shift the current one and add the new bits + for (auto const& selectionContainer : mSelectionContainers) { + // if there are no selections for a certain observable, skip + if (selectionContainer.isEmpty()) { + continue; + } + // Shift the result to make space and add the new value + mFinalBitmask = (mFinalBitmask << selectionContainer.getShift()) | selectionContainer.getBitmask(); + } + } + + /// \brief Retrieve the assembled bitmask as an integer value. + /// \return The combined selection bitmask. + BitmaskType getBitmask() const { return static_cast(mFinalBitmask.to_ullong()); } + + /// \brief Retrieve the assembled bitmask as an integer value. + /// \return The combined selection bitmask. + BitmaskType getBitmask(int observableIndex) const { return static_cast(mSelectionContainers.at(observableIndex).getBitmask().to_ullong()); } + + /// \brief Retrieve the assembled bitmask as an integer value. + /// \return The combined selection bitmask. + template + void setBitmask(int observableIndex, R bitmask) + { + mSelectionContainers.at(observableIndex).setBitmask(bitmask); + } + + /// \brief Print detailed information about all configured selections. + /// \tparam MapType Type used in the observable name map (usually an enum or int). + /// \param objectName Name of the current object (e.g. particle species). + /// \param observableNames Map from observable index to human-readable names. + template + void printSelections(const std::string& objectName, const std::unordered_map& observableNames) const + { + LOG(info) << "Printing Configuration of " << objectName; + + size_t globalBitIndex = 0; // Tracks bit position across all containers + + for (size_t idx = mSelectionContainers.size(); idx-- > 0;) { + const auto& container = mSelectionContainers[idx]; + if (container.isEmpty()) { + continue; + } + + const MapType key = static_cast(idx); + const std::string& name = observableNames.count(key) ? observableNames.at(key) : "[Unknown]"; + + LOG(info) << "Observable: " << name << " (index " << idx << ")"; + LOG(info) << " Limit type : " << container.getLimitTypeAsString(); + LOG(info) << " Minimal cut : " << (container.isMinimalCut() ? "yes" : "no"); + LOG(info) << " Skip most permissive : " << (container.skipMostPermissiveBit() ? "yes" : "no"); + LOG(info) << " Bitmask shift : " << container.getShift(); + LOG(info) << " Selections : "; + + const auto& values = container.getSelectionValues(); + const auto& functions = container.getSelectionFunction(); + const bool useFunctions = !functions.empty(); + const size_t numSelections = useFunctions ? functions.size() : values.size(); + const bool skipMostPermissive = container.skipMostPermissiveBit(); + + int valWidth = 20; + int bitWidth = 30; + + for (size_t j = 0; j < numSelections; ++j) { + std::stringstream line; + + // Selection string (either value or function) + const std::string& sel = useFunctions ? std::string(functions[j].GetFormula()->GetExpFormula().Data()) : std::to_string(values[j]); + line << " " << std::left << std::setw(valWidth) << sel; + + // Bitmask + if (skipMostPermissive && j == 0) { + line << std::setw(bitWidth) << "-> loosest minimal selection, no bit saved"; + } else { + const uint64_t bitmask = uint64_t{1} << globalBitIndex++; + line << std::setw(bitWidth) << ("-> bitmask: " + std::to_string(bitmask)); + } + + LOG(info) << line.str(); + } + + LOG(info) << ""; // blank line between observables + } + LOG(info) << "Printing done"; + } + + protected: + std::array, NumObservables> mSelectionContainers = {}; ///< Array containing all selections + std::bitset mFinalBitmask = {}; ///< final bitmaks + size_t mNSelections = 0; ///< Number of selections + bool mPassesMinimalSelections = true; ///< Set to true if all minimal (mandatory) selections are passed + bool mHasOptionalSelection = false; ///< Set to true if at least one selections is optional + bool mPassesOptionalSelections = true; ///< Set to true if at least one optional (non-mandatory) selections is passed +}; +} // namespace o2::analysis::femto + +#endif // PWGCF_FEMTO_CORE_BASESELECTION_H_ diff --git a/PWGCF/Femto/Core/cascadeBuilder.h b/PWGCF/Femto/Core/cascadeBuilder.h new file mode 100644 index 00000000000..637bbce5f3d --- /dev/null +++ b/PWGCF/Femto/Core/cascadeBuilder.h @@ -0,0 +1,465 @@ +// Copyright 2019-2025 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 cascadeBuilder.h +/// \brief cascade builder +/// \author anton.riedel@tum.de, TU München, anton.riedel@tum.de + +#ifndef PWGCF_FEMTO_CORE_CASCADEBUILDER_H_ +#define PWGCF_FEMTO_CORE_CASCADEBUILDER_H_ + +#include "PWGCF/Femto/Core/baseSelection.h" +#include "PWGCF/Femto/Core/dataTypes.h" +#include "PWGCF/Femto/Core/femtoUtils.h" +#include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/selectionContainer.h" +#include "PWGCF/Femto/DataModel/FemtoTables.h" + +#include "CommonConstants/MathConstants.h" +#include "Framework/AnalysisHelpers.h" +#include "Framework/Configurable.h" + +#include "fairlogger/Logger.h" + +#include +#include +#include +#include +#include +#include +#include + +namespace o2::analysis::femto +{ +namespace cascadebuilder +{ + +struct ConfCascadeFilters : o2::framework::ConfigurableGroup { + std::string prefix = std::string("CascadeFilters"); + o2::framework::Configurable ptMin{"ptMin", 0.f, "Minimum pT"}; + o2::framework::Configurable ptMax{"ptMax", 99.f, "Maximum pT"}; + o2::framework::Configurable etaMin{"etaMin", -10.f, "Minimum eta"}; + o2::framework::Configurable etaMax{"etaMax", 10.f, "Maximum eta"}; + o2::framework::Configurable phiMin{"phiMin", 0.f, "Minimum phi"}; + o2::framework::Configurable phiMax{"phiMax", 1.f * o2::constants::math::TwoPI, "Maximum phi"}; + o2::framework::Configurable massXiMin{"massXiMin", 1.2f, "Minimum Xi mass"}; + o2::framework::Configurable massXiMax{"massXiMax", 1.4f, "Maximum Xi mass"}; + o2::framework::Configurable rejectMassXiMin{"rejectMassXiMin", 1.317f, "Reject Minimum Xi mass for Omega hypothesis"}; + o2::framework::Configurable rejectMassXiMax{"rejectMassXiMax", 1.325f, "Rejection Maximum Xi mass for Omega hypothesis"}; + o2::framework::Configurable massOmegaMin{"massOmegaMin", 1.5f, "Minimum Omega mass"}; + o2::framework::Configurable massOmegaMax{"massOmegaMax", 1.9f, "Maximum Omega mass"}; + o2::framework::Configurable rejectMassOmegaMin{"rejectMassOmegaMin", 1.668f, "Reject minimum Omega mass for Xi hypothesis"}; + o2::framework::Configurable rejectMassOmegaMax{"rejectMassOmegaMax", 1.676f, "Reject maximum Omega mass for Xi hypothesis"}; + o2::framework::Configurable massLambdaMin{"massLambdaMin", 1.0f, "Minimum Lambda mass"}; + o2::framework::Configurable massLambdaMax{"massLambdaMax", 1.2f, "Maximum Lambda mass"}; +}; + +#define CASCADE_DEFAULT_BITS \ + o2::framework::Configurable> cascadeCpaMin{"cascadeCpaMin", {0.95f}, "Minimum cosine of pointing angle"}; \ + o2::framework::Configurable> cascadeTransRadMin{"cascadeTransRadMin", {0.9f}, "Minimum transverse radius (cm)"}; \ + o2::framework::Configurable> cascadeDcaDauMax{"cascadeDcaDauMax", {0.25f}, "Maximum DCA between the daughters at decay vertex (cm)"}; \ + o2::framework::Configurable> lambdaCpaMin{"lambdaCpaMin", {0.78f}, "Minimum cosine of pointing angle"}; \ + o2::framework::Configurable> lambdaTransRadMin{"lambdaTransRadMin", {0.9f}, "Minimum transverse radius (cm)"}; \ + o2::framework::Configurable> lambdaDcaDauMax{"lambdaDcaDauMax", {0.5f}, "Maximum DCA between the daughters at decay vertex (cm)"}; \ + o2::framework::Configurable> lambdaDcaToPvMin{"lambdaDcaToPvMin", {0.3f}, "Minimum DCA between the lambda and primary vertex"}; \ + o2::framework::Configurable> dauAbsEtaMax{"dauAbsEtaMax", {0.8f}, "Minimum DCA of the daughters from primary vertex (cm)"}; \ + o2::framework::Configurable> dauDcaMin{"dauDcaMin", {0.05f}, "Minimum DCA of the daughters from primary vertex (cm)"}; \ + o2::framework::Configurable> dauTpcClustersMin{"dauTpcClustersMin", {80.f}, "Minimum number of TPC clusters for daughter tracks"}; \ + o2::framework::Configurable> posDauTpc{"posDauTpc", {5.f}, "Maximum |nsimga_Pion/Proton| TPC for positive daughter tracks"}; \ + o2::framework::Configurable> negDauTpc{"negDauTpc", {5.f}, "Maximum |nsimga_Pion/Proton| TPC for negative daughter tracks"}; + +struct ConfXiBits : o2::framework::ConfigurableGroup { + std::string prefix = std::string("XiBits"); + CASCADE_DEFAULT_BITS + o2::framework::Configurable> bachelorTpcPion{"bachelorTpcPion", {5.f}, "Maximum |nsimga_Pion| TPC for bachelor tracks"}; +}; + +struct ConfOmegaBits : o2::framework::ConfigurableGroup { + std::string prefix = std::string("OmegaBits"); + CASCADE_DEFAULT_BITS + o2::framework::Configurable> bachelorTpcKaon{"bachelorTpcKaon", {5.f}, "Maximum |nsimga_Kaon| TPC for bachelor tracks"}; +}; + +#undef CASCADE_DEFAULT_BITS + +#define CASCADE_DEFAULT_SELECTION(defaultMassMin, defaultMassMax, defaultPdgCode) \ + o2::framework::Configurable pdgCode{"pdgCode", defaultPdgCode, "Track PDG code"}; \ + o2::framework::Configurable sign{"sign", 1, "Sign of the Lambda (+1 for Lambda and -1 for Antilambda"}; \ + o2::framework::Configurable ptMin{"ptMin", 0.f, "Minimum pT"}; \ + o2::framework::Configurable ptMax{"ptMax", 999.f, "Maximum pT"}; \ + o2::framework::Configurable etaMin{"etaMin", -10.f, "Minimum eta"}; \ + o2::framework::Configurable etaMax{"etaMax", 10.f, "Maximum eta"}; \ + o2::framework::Configurable phiMin{"phiMin", 0.f, "Minimum eta"}; \ + o2::framework::Configurable phiMax{"phiMax", 1.f * o2::constants::math::TwoPI, "Maximum phi"}; \ + o2::framework::Configurable massMin{"massMin", defaultMassMin, "Minimum invariant mass for Cascade"}; \ + o2::framework::Configurable massMax{"massMax", defaultMassMax, "Maximum invariant mass for Cascade"}; \ + o2::framework::Configurable mask{"mask", 0, "Bitmask for cascade selection"}; + +struct ConfXiSelection : o2::framework::ConfigurableGroup { + std::string prefix = std::string("XiSelection"); + CASCADE_DEFAULT_SELECTION(1.22, 1.42, 3212) +}; + +struct ConfOmegaSelection : o2::framework::ConfigurableGroup { + std::string prefix = std::string("OmegaSelection"); + CASCADE_DEFAULT_SELECTION(1.57, 1.77, 3334) +}; + +/// The different selections this task is capable of doing +enum CascadeSels { + // selections for cascades + kCascadeCpaMin, ///< Min. CPA (cosine pointing angle) + kCascadeDcaDaughMax, ///< Max. DCA of the daughers at decay vertex + kCascadeTransRadMin, ///< max. transverse radius + + // selection for lambda daughter + kLambdaCpaMin, ///< Min. DCA of the lambda daughers at primary vertex + kLambdaDcaDauMax, ///< TPC PID for daughters (Pion/Proton) + kLambdaTransRadMin, ///< Min. number of TPC clusters of daughter + kLambdaDcaToPvMin, ///< Min. DCA to primary vertex of daughter lambda + + // selection for bachelor/daugthers + kDauAbsEtaMax, ///< Min. DCA of the daughers/bachelor at primary vertex + kDauTpcClsMin, ///< Min. number of TPC clusters of daughters/bachelor + kDauDcaMin, ///< TPC Pion PID for negative daughter + + // PID selection for cascade bachelor + kBachelorTpcPion, ///< TPC Pion PID for bachelor + kBachelorTpcKaon, ///< TPC Kaon PID for bachelor + /// + // PID selection for lambda daughers + kPosDauTpc, ///< TPC PID for positive daughter + kNegDauTpc, ///< TPC PID for negative daughter + + kCascadeSelsMax +}; + +const char cascadeSelsName[] = "Cascade Selection Object"; +const std::unordered_map cascadeSelsToString = { + {kCascadeCpaMin, "Cascade CPA Min"}, + {kCascadeDcaDaughMax, "Cascade DCA Daughters Max"}, + {kCascadeTransRadMin, "Cascade Transverse Radius Min"}, + + {kLambdaCpaMin, "Lambda CPA Min"}, + {kLambdaDcaDauMax, "Lambda DCA Daughter Max"}, + {kLambdaTransRadMin, "Lambda Transverse Radius Min"}, + {kLambdaDcaToPvMin, "Lambda DCA to PV Min"}, + + {kDauAbsEtaMax, "Daughter Abs Eta Max"}, + {kDauTpcClsMin, "Daughter TPC Clusters Min"}, + {kDauDcaMin, "Daughter DCA Min"}, + + {kBachelorTpcPion, "Bachelor TPC Pion PID"}, + {kBachelorTpcKaon, "Bachelor TPC Kaon PID"}, + + {kPosDauTpc, "Positive Daughter TPC PID"}, + {kNegDauTpc, "Negative Daughter TPC PID"}, + + {kCascadeSelsMax, "Cascade Selections Max"}}; + +/// \class FemtoDreamTrackCuts +/// \brief Cut class to contain and execute all cuts applied to tracks +template +class CascadeSelection : public BaseSelection +{ + public: + CascadeSelection() {} + virtual ~CascadeSelection() = default; + + template + void configure(T1 const& config, T2 const& filter) + { + if constexpr (modes::isEqual(cascadeType, modes::Cascade::kXi)) { + mXiMassLowerLimit = filter.massXiMin.value; + mXiMassUpperLimit = filter.massXiMax.value; + mOmegaMassLowerLimit = filter.rejectMassOmegaMin.value; + mOmegaMassUpperLimit = filter.rejectMassOmegaMax.value; + this->addSelection(config.bachelorTpcPion.value, kBachelorTpcPion, limits::kAbsUpperLimit, true, true); + } + if constexpr (modes::isEqual(cascadeType, modes::Cascade::kOmega)) { + mOmegaMassLowerLimit = filter.massOmegaMin.value; + mOmegaMassUpperLimit = filter.massOmegaMax.value; + mXiMassLowerLimit = filter.rejectMassXiMin.value; + mXiMassUpperLimit = filter.rejectMassXiMax.value; + this->addSelection(config.bachelorTpcKaon.value, kBachelorTpcKaon, limits::kAbsUpperLimit, true, true); + } + + mPtMin = filter.ptMin.value; + mPtMax = filter.ptMax.value; + mEtaMin = filter.etaMin.value; + mEtaMax = filter.etaMax.value; + mPhiMin = filter.phiMin.value; + mPhiMax = filter.phiMax.value; + mLambdaMassMin = filter.massLambdaMin.value; + mLambdaMassMax = filter.massLambdaMax.value; + + this->addSelection(config.posDauTpc.value, kPosDauTpc, limits::kAbsUpperLimit, true, true); + this->addSelection(config.negDauTpc.value, kNegDauTpc, limits::kAbsUpperLimit, true, true); + + this->addSelection(config.cascadeCpaMin.value, kCascadeCpaMin, limits::kLowerLimit, true, true); + this->addSelection(config.cascadeTransRadMin.value, kCascadeTransRadMin, limits::kLowerLimit, true, true); + this->addSelection(config.cascadeDcaDauMax.value, kCascadeDcaDaughMax, limits::kAbsUpperLimit, true, true); + this->addSelection(config.lambdaCpaMin.value, kLambdaCpaMin, limits::kLowerLimit, true, true); + this->addSelection(config.lambdaTransRadMin.value, kLambdaTransRadMin, limits::kLowerLimit, true, true); + this->addSelection(config.lambdaDcaDauMax.value, kLambdaDcaDauMax, limits::kAbsUpperLimit, true, true); + this->addSelection(config.lambdaDcaToPvMin.value, kLambdaDcaToPvMin, limits::kLowerLimit, true, true); + this->addSelection(config.dauAbsEtaMax.value, kDauAbsEtaMax, limits::kAbsUpperLimit, true, true); + this->addSelection(config.dauDcaMin.value, kDauDcaMin, limits::kAbsLowerLimit, true, true); + this->addSelection(config.dauTpcClustersMin.value, kDauTpcClsMin, limits::kLowerLimit, true, true); + }; + + template + void applySelections(T1 const& cascade, T2 const& /*tracks*/, T3 const& col) + { + this->reset(); + // cascade selections + this->evaluateObservable(kCascadeCpaMin, cascade.casccosPA(col.posX(), col.posY(), col.posZ())); + this->evaluateObservable(kCascadeDcaDaughMax, cascade.dcacascdaughters()); + this->evaluateObservable(kCascadeTransRadMin, cascade.cascradius()); + + // lambda selection + this->evaluateObservable(kLambdaCpaMin, cascade.v0cosPA(col.posX(), col.posY(), col.posZ())); + this->evaluateObservable(kLambdaDcaDauMax, cascade.dcaV0daughters()); + this->evaluateObservable(kLambdaTransRadMin, cascade.v0radius()); + this->evaluateObservable(kLambdaDcaToPvMin, cascade.dcav0topv(col.posX(), col.posY(), col.posZ())); + + auto bachelor = cascade.template bachelor_as(); + auto posDaughter = cascade.template posTrack_as(); + auto negDaughter = cascade.template negTrack_as(); + + // daughter selections + std::array etaDaughters = {std::fabs(bachelor.eta()), std::fabs(posDaughter.eta()), std::fabs(negDaughter.eta())}; + this->evaluateObservable(kDauAbsEtaMax, *std::max_element(etaDaughters.begin(), etaDaughters.end())); + + std::array dcaDaughters = {std::hypot(bachelor.dcaXY(), bachelor.dcaZ()), + std::hypot(posDaughter.dcaXY(), posDaughter.dcaZ()), + std::hypot(negDaughter.dcaXY(), negDaughter.dcaZ())}; + this->evaluateObservable(kDauDcaMin, *std::min_element(dcaDaughters.begin(), dcaDaughters.end())); + + std::array clustersDaughters = {1.f * bachelor.tpcNClsFound(), 1.f * posDaughter.tpcNClsFound(), 1.f * negDaughter.tpcNClsFound()}; + this->evaluateObservable(kDauTpcClsMin, *std::min_element(clustersDaughters.begin(), clustersDaughters.end())); + + // bachelor pid selection + // check both pion and kaon PID for xi and omega + this->evaluateObservable(kBachelorTpcPion, bachelor.tpcNSigmaPi()); + this->evaluateObservable(kBachelorTpcKaon, bachelor.tpcNSigmaKa()); + + // depending on the charge, we check lambda or antilambda hypothesis + if (cascade.sign() < 0) { + this->evaluateObservable(kPosDauTpc, posDaughter.tpcNSigmaPr()); + this->evaluateObservable(kNegDauTpc, negDaughter.tpcNSigmaPi()); + } else if (cascade.sign() > 0) { + this->evaluateObservable(kPosDauTpc, posDaughter.tpcNSigmaPi()); + this->evaluateObservable(kNegDauTpc, negDaughter.tpcNSigmaPr()); + } else { + LOG(warn) << "Encountered Cascade candidate with 0 charge"; + } + + this->assembleBitmask(); + }; + + template + bool checkFilters(const T& cascade) const + { + return ((cascade.pt() > mPtMin && cascade.pt() < mPtMax) && + (cascade.eta() > mEtaMin && cascade.eta() < mEtaMax) && + (cascade.phi() > mPhiMin && cascade.phi() < mPhiMax) && + (cascade.mLambda() > mLambdaMassMin && cascade.mLambda() < mLambdaMassMax)); + } + + template + bool checkHypothesis(T const& cascadeCandidate) + { + // no need to check PID of the bachelor/daughters here, they are set as minimal cuts + if constexpr (modes::isEqual(cascadeType, modes::Cascade::kXi)) { + return (mXiMassLowerLimit < cascadeCandidate.mXi() && mXiMassUpperLimit > cascadeCandidate.mXi()) && // inside xi mass window + (cascadeCandidate.mOmega() < mOmegaMassLowerLimit || cascadeCandidate.mOmega() > mOmegaMassUpperLimit); // outside omega mass window + } + if constexpr (modes::isEqual(cascadeType, modes::Cascade::kXi)) { + return (mOmegaMassLowerLimit < cascadeCandidate.mOmega() && mOmegaMassUpperLimit > cascadeCandidate.mOmega()) && // inside omega mass window + (cascadeCandidate.mXi() < mXiMassLowerLimit || cascadeCandidate.mXi() > mXiMassUpperLimit); // outside xi mass window + } + return false; + } + + protected: + float mXiMassLowerLimit = 0.f; + float mXiMassUpperLimit = 999.f; + + float mOmegaMassLowerLimit = 0.f; + float mOmegaMassUpperLimit = 999.f; + + // kinematic filters + float mPtMin = 0.f; + float mPtMax = 6.f; + float mEtaMin = -0.9f; + float mEtaMax = 0.9f; + float mPhiMin = 0.f; + float mPhiMax = o2::constants::math::TwoPI; + float mLambdaMassMin = 1.f; + float mLambdaMassMax = 1.2f; +}; + +struct CascadeBuilderProducts : o2::framework::ProducesGroup { + o2::framework::Produces producedXis; + o2::framework::Produces producedXiMasks; + o2::framework::Produces producedXiExtras; + o2::framework::Produces producedOmegas; + o2::framework::Produces producedOmegaMasks; + o2::framework::Produces producedOmegaExtras; +}; + +struct ConfCascadeTables : o2::framework::ConfigurableGroup { + std::string prefix = std::string("CascadeTables"); + o2::framework::Configurable produceXis{"produceXis", -1, "Produce Xis (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceXiMasks{"produceXiMasks", -1, "Produce XiMasks (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceXiExtras{"produceXiExtras", -1, "Produce XiExtras (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceOmegas{"produceOmegas", -1, "Produce Omegas (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceOmegaMasks{"produceOmegaMasks", -1, "Produce OmegaMasks (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceOmegaExtras{"produceOmegaExtras", -1, "Produce OmegaExtras (-1: auto; 0 off; 1 on)"}; +}; + +template +class CascadeBuilder +{ + public: + CascadeBuilder() {} + virtual ~CascadeBuilder() = default; + + template + void init(T1& config, T2& filter, T3& table, T4& initContext) + { + cascadeSelection.configure(config, filter); + if constexpr (modes::isEqual(cascadeType, modes::Cascade::kXi)) { + LOG(info) << "Initialize femto Xi builder..."; + produceXis = utils::enableTable("FXis_001", table.produceXis.value, initContext); + produceXiMasks = utils::enableTable("FXiMasks_001", table.produceXiMasks.value, initContext); + produceXiExtras = utils::enableTable("FXiExtras_001", table.produceXiExtras.value, initContext); + } + if constexpr (modes::isEqual(cascadeType, modes::Cascade::kOmega)) { + LOG(info) << "Initialize femto Omega builder..."; + produceOmegas = utils::enableTable("FOmegas_001", table.produceOmegas.value, initContext); + produceOmegaMasks = utils::enableTable("FOmegaMasks_001", table.produceOmegaMasks.value, initContext); + produceOmegaExtras = utils::enableTable("FOmegaExtras_001", table.produceOmegaExtras.value, initContext); + } + + if (produceXis || produceXiExtras || produceXiMasks || produceOmegas || produceOmegaMasks || produceOmegaExtras) { + mFillAnyTable = true; + cascadeSelection.printSelections(cascadeSelsName, cascadeSelsToString); + } else { + LOG(info) << "No tables configured"; + } + LOG(info) << "Initialization done..."; + } + + template + void fillCascades(T1& collisionProducts, T2& trackProducts, T3& cascadeProducts, T4 const& fullCascades, T5 const& fullTracks, T6 const& col, T7& trackBuilder, T8& indexMap) + { + if (!mFillAnyTable) { + return; + } + + int64_t bachelorIndex = 0; + int64_t posDaughterIndex = 0; + int64_t negDaughterIndex = 0; + for (const auto& cascade : fullCascades) { + if (!cascadeSelection.checkFilters(cascade)) { + continue; + } + cascadeSelection.applySelections(cascade, fullTracks, col); + if (cascadeSelection.passesAllRequiredSelections() && cascadeSelection.checkHypothesis(cascade)) { + + auto bachelor = cascade.template bachelor_as(); + auto posDaughter = cascade.template posTrack_as(); + auto negDaughter = cascade.template negTrack_as(); + + bachelorIndex = trackBuilder.template getDaughterIndex(bachelor, trackProducts, collisionProducts, indexMap); + posDaughterIndex = trackBuilder.template getDaughterIndex(posDaughter, trackProducts, collisionProducts, indexMap); + negDaughterIndex = trackBuilder.template getDaughterIndex(negDaughter, trackProducts, collisionProducts, indexMap); + + fillCascade(collisionProducts, cascadeProducts, cascade, col, bachelorIndex, posDaughterIndex, negDaughterIndex); + } + } + } + + template + void fillCascade(T1& collisionProducts, T2& cascadeProducts, T3 const& cascade, T4 const& col, int bachelorIndex, int posDaughterIndex, int negDaughterIndex) + { + if constexpr (modes::isEqual(cascadeType, modes::Cascade::kXi)) { + if (produceXis) { + cascadeProducts.producedXis(collisionProducts.producedCollision.lastIndex(), + cascade.sign() * cascade.pt(), + cascade.eta(), + cascade.phi(), + cascade.mXi(), + bachelorIndex, + posDaughterIndex, + negDaughterIndex); + } + if (produceXiMasks) { + cascadeProducts.producedXiMasks(cascadeSelection.getBitmask()); + } + if (produceXiExtras) { + cascadeProducts.producedXiExtras( + cascade.mOmega(), + cascade.casccosPA(col.posX(), col.posY(), col.posZ()), + cascade.dcacascdaughters(), + cascade.cascradius(), + cascade.v0cosPA(col.posX(), col.posY(), col.posZ()), + cascade.dcaV0daughters(), + cascade.v0radius(), + cascade.dcav0topv(col.posY(), col.posY(), col.posZ())); + } + } + if constexpr (modes::isEqual(cascadeType, modes::Cascade::kOmega)) { + if (produceOmegas) { + cascadeProducts.producedOmegas(collisionProducts.producedCollision.lastIndex(), + cascade.sign() * cascade.pt(), + cascade.eta(), + cascade.phi(), + cascade.mOmega(), + bachelorIndex, + posDaughterIndex, + negDaughterIndex); + } + if (produceOmegaMasks) { + cascadeProducts.producedOmegaMasks(cascadeSelection.getBitmask()); + } + if (produceOmegaExtras) { + cascadeProducts.producedOmegaExtras( + cascade.mXi(), + cascade.casccosPA(col.posX(), col.posY(), col.posZ()), + cascade.dcacascdaughters(), + cascade.cascradius(), + cascade.v0cosPA(col.posX(), col.posY(), col.posZ()), + cascade.dcaV0daughters(), + cascade.v0radius(), + cascade.dcav0topv(col.posY(), col.posY(), col.posZ())); + } + } + } + + bool fillAnyTable() { return mFillAnyTable; } + + private: + CascadeSelection cascadeSelection; + bool mFillAnyTable = false; + bool produceXis = false; + bool produceXiMasks = false; + bool produceXiExtras = false; + bool produceOmegas = false; + bool produceOmegaMasks = false; + bool produceOmegaExtras = false; +}; + +} // namespace cascadebuilder +} // namespace o2::analysis::femto +#endif // PWGCF_FEMTO_CORE_CASCADEBUILDER_H_ diff --git a/PWGCF/Femto/Core/cascadeHistManager.h b/PWGCF/Femto/Core/cascadeHistManager.h new file mode 100644 index 00000000000..19c0f9f0d97 --- /dev/null +++ b/PWGCF/Femto/Core/cascadeHistManager.h @@ -0,0 +1,268 @@ +// Copyright 2019-2025 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 cascadeHistManager.h +/// \brief histogram manager for cascade histograms +/// \author Anton Riedel, TU München, anton.riedel@cern.ch + +#ifndef PWGCF_FEMTO_CORE_CASCADEHISTMANAGER_H_ +#define PWGCF_FEMTO_CORE_CASCADEHISTMANAGER_H_ + +#include "PWGCF/Femto/Core/histManager.h" +#include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/trackHistManager.h" + +#include "CommonConstants/MathConstants.h" +#include "Framework/Configurable.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/HistogramSpec.h" + +#include +#include +#include +#include +#include + +namespace o2::analysis::femto +{ +namespace cascadehistmanager +{ +// enum for track histograms +enum CascadeHist { + // analysis + kPt, + kEta, + kPhi, + kMass, + kSign, + // qa variables + kMassXi, + kMassOmega, + kCosPa, + kDecayDauDca, + kTransRadius, + // 2d qa + kPtVsEta, + kPtVsPhi, + kPhiVsEta, + kPtVsCosPa, + kPtVsMassXi, + kPtVsMassOmega, + kMassXiVsMassOmega, + kCascadeHistLast +}; + +template +struct ConfCascadeBinning : o2::framework::ConfigurableGroup { + std::string prefix = Prefix; + o2::framework::ConfigurableAxis pt{"pt", {{600, 0, 6}}, "Pt"}; + o2::framework::ConfigurableAxis eta{"eta", {{300, -1.5, 1.5}}, "Eta"}; + o2::framework::ConfigurableAxis phi{"phi", {{720, 0, 1.f * o2::constants::math::TwoPI}}, "Phi"}; + o2::framework::ConfigurableAxis mass{"mass", {{1000, 1.f, 2.f}}, "Mass"}; + o2::framework::ConfigurableAxis sign{"sign", {{3, -1.5, 1.5}}, "Sign"}; +}; + +constexpr const char PrefixXiBinning[] = "XiBinning"; +using ConfXiBinning = ConfCascadeBinning; +constexpr const char PrefixOmegaBinning[] = "OmegaBinning"; +using ConfOmegaBinning = ConfCascadeBinning; + +template +struct ConfCascadeQaBinning : o2::framework::ConfigurableGroup { + std::string prefix = Prefix; + o2::framework::ConfigurableAxis cosPa{"cosPa", {{100, 0.9, 1}}, "Cosine of poiting angle"}; + o2::framework::ConfigurableAxis dauDcaAtDecay{"dauDcaAtDecay", {{150, 0, 1.5}}, "Daughter DCA at decay vertex"}; + o2::framework::ConfigurableAxis transRadius{"transRadius", {{100, 0, 100}}, "Transverse radius"}; + o2::framework::ConfigurableAxis massXi{"massXi", {{400, 1.2f, 1.6f}}, "mass for antiparticle hypothesis"}; + o2::framework::ConfigurableAxis massOmega{"massOmega", {{400, 1.4f, 1.8f}}, "mass for antiparticle hypothesis"}; +}; + +constexpr const char PrefixXiQaBinning[] = "XiQaBinning"; +using ConfXiQaBinning = ConfCascadeQaBinning; + +constexpr const char PrefixOmegatQaBinning[] = "OmegaQaBinning"; +using ConfOmegaQaBinning = ConfCascadeQaBinning; + +// must be in sync with enum TrackVariables +// the enum gives the correct index in the array +constexpr std::array, kCascadeHistLast> HistTable = { + {{kPt, o2::framework::kTH1F, "hPt", "Transverse Momentum; p_{T} (GeV/#it{c}); Entries"}, + {kEta, o2::framework::kTH1F, "hEta", "Pseudorapdity; #eta; Entries"}, + {kPhi, o2::framework::kTH1F, "hPhi", "Azimuthal angle; #varphi; Entries"}, + {kMass, o2::framework::kTH1F, "hMass", "Invariant Mass; m_{Inv} (GeV/#it{c}^{2}); Entries"}, + {kSign, o2::framework::kTH1F, "hSign", "Sign (-1 -> antiparticle, 0 -> self conjugate, +1 -> particle); sign; Entries"}, + {kMassXi, o2::framework::kTH1F, "hMassXi", "Mass #Xi; m_{#Lambda#pi} (GeV/#it{c}^{2}); Entries"}, + {kMassOmega, o2::framework::kTH1F, "hMassOmega", "mass #Omega; m_{#LambdaK} (GeV/#it{c}^{2}); Entries"}, + {kCosPa, o2::framework::kTH1F, "hCosPa", "Cosine of pointing angle; coa(#alpha); Entries"}, + {kDecayDauDca, o2::framework::kTH1F, "hDauDca", "Daughter DCA at decay vertex ; DCA_{Decay vertex} (cm); Entries"}, + {kTransRadius, o2::framework::kTH1F, "hTransRadius", "Transverse radius ; r_{xy} (cm); Entries"}, + {kPtVsEta, o2::framework::kTH2F, "hPtVsEta", "p_{T} vs #eta; p_{T} (GeV/#it{c}) ; #eta"}, + {kPtVsPhi, o2::framework::kTH2F, "hPtVsPhi", "p_{T} vs #varphi; p_{T} (GeV/#it{c}) ; #varphi"}, + {kPhiVsEta, o2::framework::kTH2F, "hPhiVsEta", "#varphi vs #eta; #varphi ; #eta"}, + {kPtVsCosPa, o2::framework::kTH2F, "hPtVsCosPa", "Cosine of poiting angle vs p_{T}; cos(#alpha); p_{T} (GeV/#it{c})"}, + {kPtVsMassXi, o2::framework::kTH2F, "hPtVsMassXi", "p_{T} vs mass #Xi; p_{T} (GeV/#it{c}); m_{#Lambda#pi} (GeV/#it{c}^{2})"}, + {kPtVsMassOmega, o2::framework::kTH2F, "hPtVsMassOmega", "p_{T} vs mass #Omega; p_{T} (GeV/#it{c}); m_{#LambdaK} (GeV/#it{c}^{2})"}, + {kMassXiVsMassOmega, o2::framework::kTH2F, "hMassXiVsMassOmega", "mass #Xi vs mass #Omega; m_{#Lambda#pi} (GeV/#it{c}^{2}); m_{#LambdaK} (GeV/#it{c}^{2})"}}}; + +template +auto makeCascadeAnalysisHistSpecMap(const T& confBinningAnalysis) +{ + return std::map>{ + {kPt, {confBinningAnalysis.pt}}, + {kEta, {confBinningAnalysis.eta}}, + {kPhi, {confBinningAnalysis.phi}}, + {kMass, {confBinningAnalysis.mass}}, + {kSign, {confBinningAnalysis.sign}}}; +} + +template +std::map> makeCascadeQaHistSpecMap(T1 const& confBinningAnalysis, T2 const& confBinningQa) +{ + return std::map>{ + {kPt, {confBinningAnalysis.pt}}, + {kEta, {confBinningAnalysis.eta}}, + {kPhi, {confBinningAnalysis.phi}}, + {kMass, {confBinningAnalysis.mass}}, + {kSign, {confBinningAnalysis.sign}}, + {kCosPa, {confBinningQa.cosPa}}, + {kDecayDauDca, {confBinningQa.dauDcaAtDecay}}, + {kTransRadius, {confBinningQa.transRadius}}, + {kPtVsEta, {confBinningAnalysis.pt, confBinningAnalysis.eta}}, + {kPtVsPhi, {confBinningAnalysis.pt, confBinningAnalysis.phi}}, + {kPhiVsEta, {confBinningAnalysis.phi, confBinningAnalysis.eta}}, + {kPtVsCosPa, {confBinningAnalysis.pt, confBinningQa.cosPa}}, + {kMassXi, {confBinningQa.massXi}}, + {kMassOmega, {confBinningQa.massOmega}}, + {kPtVsMassXi, {confBinningAnalysis.pt, confBinningQa.massXi}}, + {kPtVsMassOmega, {confBinningAnalysis.pt, confBinningQa.massOmega}}, + {kMassXiVsMassOmega, {confBinningQa.massXi, confBinningQa.massOmega}}}; +}; + +constexpr char PrefixXiQa[] = "XiQA/"; +constexpr char PrefixXi[] = "Xi/"; +constexpr char PrefixOmegaQa[] = "OmegaQa/"; +constexpr char PrefixOmega[] = "Omega/"; + +constexpr char PrefixLambdaCascade[] = "LambdaCascadeQa/"; + +constexpr std::string_view AnalysisDir = "Kinematics/"; +constexpr std::string_view QaDir = "QA/"; + +/// \class FemtoDreamEventHisto +/// \brief Class for histogramming event properties +// template +template +class CascadeHistManager +{ + public: + /// Destructor + virtual ~CascadeHistManager() = default; + /// Initializes histograms for the task + /// \param registry Histogram registry to be passed + /// + void init(o2::framework::HistogramRegistry* registry, + std::map> cascadeSpecs, + std::map> BachelorSpecs, + std::map> PosDauSpecs, + std::map> NegDauSpecs) + { + mHistogramRegistry = registry; + mBachelorManager.init(registry, BachelorSpecs); + mPosDauManager.init(registry, PosDauSpecs); + mNegDauManager.init(registry, NegDauSpecs); + if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { + std::string analysisDir = std::string(cascadePrefix) + std::string(AnalysisDir); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kPt, HistTable), GetHistDesc(kPt, HistTable), GetHistType(kPt, HistTable), {cascadeSpecs[kPt]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kEta, HistTable), GetHistDesc(kEta, HistTable), GetHistType(kEta, HistTable), {cascadeSpecs[kEta]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kPhi, HistTable), GetHistDesc(kPhi, HistTable), GetHistType(kPhi, HistTable), {cascadeSpecs[kPhi]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kMass, HistTable), GetHistDesc(kMass, HistTable), GetHistType(kMass, HistTable), {cascadeSpecs[kMass]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kSign, HistTable), GetHistDesc(kSign, HistTable), GetHistType(kSign, HistTable), {cascadeSpecs[kSign]}); + } + + if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { + std::string qaDir = std::string(cascadePrefix) + std::string(QaDir); + + mHistogramRegistry->add(qaDir + GetHistNamev2(kCosPa, HistTable), GetHistDesc(kCosPa, HistTable), GetHistType(kCosPa, HistTable), {cascadeSpecs[kCosPa]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kDecayDauDca, HistTable), GetHistDesc(kDecayDauDca, HistTable), GetHistType(kDecayDauDca, HistTable), {cascadeSpecs[kDecayDauDca]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kTransRadius, HistTable), GetHistDesc(kTransRadius, HistTable), GetHistType(kTransRadius, HistTable), {cascadeSpecs[kTransRadius]}); + + // qa 2d + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsEta, HistTable), GetHistDesc(kPtVsEta, HistTable), GetHistType(kPtVsEta, HistTable), {cascadeSpecs[kPtVsEta]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsPhi, HistTable), GetHistDesc(kPtVsPhi, HistTable), GetHistType(kPtVsPhi, HistTable), {cascadeSpecs[kPtVsPhi]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPhiVsEta, HistTable), GetHistDesc(kPhiVsEta, HistTable), GetHistType(kPhiVsEta, HistTable), {cascadeSpecs[kPhiVsEta]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsCosPa, HistTable), GetHistDesc(kPtVsCosPa, HistTable), GetHistType(kPtVsCosPa, HistTable), {cascadeSpecs[kPtVsCosPa]}); + + mHistogramRegistry->add(qaDir + GetHistNamev2(kMassXi, HistTable), GetHistDesc(kMassXi, HistTable), GetHistType(kMassXi, HistTable), {cascadeSpecs[kMassXi]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kMassOmega, HistTable), GetHistDesc(kMassOmega, HistTable), GetHistType(kMassOmega, HistTable), {cascadeSpecs[kMassOmega]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsMassXi, HistTable), GetHistDesc(kPtVsMassXi, HistTable), GetHistType(kPtVsMassXi, HistTable), {cascadeSpecs[kPtVsMassXi]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsMassOmega, HistTable), GetHistDesc(kPtVsMassOmega, HistTable), GetHistType(kPtVsMassOmega, HistTable), {cascadeSpecs[kPtVsMassOmega]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kMassXiVsMassOmega, HistTable), GetHistDesc(kMassXiVsMassOmega, HistTable), GetHistType(kMassXiVsMassOmega, HistTable), {cascadeSpecs[kMassXiVsMassOmega]}); + } + } + + template + void fill(T1 const& cascadeCandidate, T2 const& /*tracks*/) + { + + auto bachelor = cascadeCandidate.template bachelor_as(); + mBachelorManager.fill(bachelor); + auto posDaughter = cascadeCandidate.template posDau_as(); + mPosDauManager.fill(posDaughter); + auto negDaughter = cascadeCandidate.template negDau_as(); + mNegDauManager.fill(negDaughter); + + if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(GetHistName(kPt, HistTable)), cascadeCandidate.pt()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(GetHistName(kEta, HistTable)), cascadeCandidate.eta()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(GetHistName(kPhi, HistTable)), cascadeCandidate.phi()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(GetHistName(kMass, HistTable)), cascadeCandidate.mass()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(GetHistName(kSign, HistTable)), cascadeCandidate.sign()); + } + if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { + float massXi, massOmega; + if constexpr (modes::isEqual(cascade, modes::Cascade::kXi)) { + massXi = cascadeCandidate.mass(); + massOmega = cascadeCandidate.massOmega(); + } + if constexpr (modes::isEqual(cascade, modes::Cascade::kOmega)) { + massXi = cascadeCandidate.massXi(); + massOmega = cascadeCandidate.mass(); + } + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(GetHistName(kCosPa, HistTable)), cascadeCandidate.cascadeCosPa()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(GetHistName(kDecayDauDca, HistTable)), cascadeCandidate.cascadeDauDca()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(GetHistName(kTransRadius, HistTable)), cascadeCandidate.cascadeTransRadius()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(GetHistName(kPtVsEta, HistTable)), cascadeCandidate.pt(), cascadeCandidate.eta()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(GetHistName(kPtVsPhi, HistTable)), cascadeCandidate.pt(), cascadeCandidate.phi()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(GetHistName(kPhiVsEta, HistTable)), cascadeCandidate.phi(), cascadeCandidate.eta()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(GetHistName(kPtVsCosPa, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadeCosPa()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(GetHistName(kMassXi, HistTable)), massXi); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(GetHistName(kMassOmega, HistTable)), massOmega); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(GetHistName(kPtVsMassXi, HistTable)), cascadeCandidate.pt(), massXi); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(GetHistName(kPtVsMassOmega, HistTable)), cascadeCandidate.pt(), massOmega); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(GetHistName(kMassXiVsMassOmega, HistTable)), massXi, massOmega); + } + } + + private: + o2::framework::HistogramRegistry* mHistogramRegistry; + + trackhistmanager::TrackHistManager mBachelorManager; + trackhistmanager::TrackHistManager mPosDauManager; + trackhistmanager::TrackHistManager mNegDauManager; +}; +}; // namespace cascadehistmanager +}; // namespace o2::analysis::femto +#endif // PWGCF_FEMTO_CORE_CASCADEHISTMANAGER_H_ diff --git a/PWGCF/Femto/Core/collisionBuilder.h b/PWGCF/Femto/Core/collisionBuilder.h new file mode 100644 index 00000000000..a11a4071721 --- /dev/null +++ b/PWGCF/Femto/Core/collisionBuilder.h @@ -0,0 +1,358 @@ +// Copyright 2019-2022 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 collisionBuilder.h +/// \brief collision builder +/// \author Anton Riedel, TU München, anton.riedel@cern.ch + +#ifndef PWGCF_FEMTO_CORE_COLLISIONBUILDER_H_ +#define PWGCF_FEMTO_CORE_COLLISIONBUILDER_H_ + +#include "PWGCF/Femto/Core/femtoUtils.h" +#include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/DataModel/FemtoTables.h" + +#include "Common/CCDB/EventSelectionParams.h" + +#include "Framework/AnalysisHelpers.h" +#include "Framework/Configurable.h" + +#include "fairlogger/Logger.h" + +#include +#include + +namespace o2::analysis::femto +{ +namespace collisionbuilder +{ + +// configurables for collision selection +struct ConfCollisionFilter : o2::framework::ConfigurableGroup { + std::string prefix = std::string("CollisionFilter"); + o2::framework::Configurable vtxZMin{"vtxZMin", -10.f, "Minimum vertex Z position (cm)"}; + o2::framework::Configurable vtxZMax{"vtxZMax", 10.f, "Maximum vertex Z position (cm)"}; + o2::framework::Configurable multMin{"multMin", 0.f, "Minimum multiplicity"}; + o2::framework::Configurable multMax{"multMax", 999.f, "Maximum multiplicity"}; + o2::framework::Configurable centMin{"centMin", 0.f, "Minimum centrality (multiplicity percentile)"}; + o2::framework::Configurable centMax{"centMax", 999.f, "Maximum centrality (multiplicity percentile)"}; + o2::framework::Configurable spherMin{"spherMin", 0.f, "Minimum centrality (multiplicity percentile)"}; + o2::framework::Configurable spherMax{"spherMax", 2.f, "Maximum centrality (multiplicity percentile)"}; + o2::framework::Configurable occupancyMin{"occupancyMin", 0.f, "Minimum occupancy (Cut works at producer level and if occupancy is stored also at consumer level)"}; + o2::framework::Configurable occupancyMax{"occupancyMax", 1e6f, "Maximum occupancy (Cut works at producer level and if occupancy is stored also at consumer level)"}; + o2::framework::Configurable magFieldMin{"magFieldMin", -1.f, "Minimum magnetic field strength (T)"}; + o2::framework::Configurable magFieldMax{"magFieldMax", 1.f, "Maximum magnetic field strength (T)"}; +}; + +struct ConfCollisionFlags : o2::framework::ConfigurableGroup { + o2::framework::Configurable sel8{"sel8", true, "Use sel8 (Should suffice for pp, for PbPb the other flags are more important)"}; + o2::framework::Configurable noSameBunchPileup{"noSameBunchPileup", false, "Reject collisions in case of pileup with another collision in the same foundBC"}; + o2::framework::Configurable isVertexItsTpc{"isVertexItsTpc", false, "At least one ITS-TPC track found for the vertex"}; + o2::framework::Configurable isGoodZvtxFt0VsPv{"isGoodZvtxFt0VsPv", false, "small difference between z-vertex from PV and from FT0"}; + o2::framework::Configurable noCollInTimeRangeNarrow{"noCollInTimeRangeNarrow", false, "no other collisions in specified time range (narrower than Strict)"}; + o2::framework::Configurable noCollInTimeRangeStrict{"noCollInTimeRangeStrict", false, "no other collisions in specified time range"}; + o2::framework::Configurable noCollInTimeRangeStandard{"noCollInTimeRangeStandard", false, "no other collisions in specified time range with per-collision multiplicity above threshold"}; + o2::framework::Configurable noCollInRofStrict{"noCollInRofStrict", false, "no other collisions in this Readout Frame"}; + o2::framework::Configurable noCollInRofStandard{"noCollInRofStandard", false, "no other collisions in this Readout Frame with per-collision multiplicity above threshold"}; + o2::framework::Configurable noHighMultCollInPrevRof{"noHighMultCollInPrevRof", false, "veto an event if FT0C amplitude in previous ITS ROF is above threshold"}; + o2::framework::Configurable isGoodItsLayer3{"isGoodItsLayer3", false, "number of inactive chips on ITS layer 3 is below maximum allowed value"}; + o2::framework::Configurable isGoodItsLayer0123{"isGoodItsLayer0123", false, "numbers of inactive chips on ITS layers 0-3 are below maximum allowed values"}; + o2::framework::Configurable isGoodItsLayersAll{"isGoodItsLayersAll", false, "numbers of inactive chips on all ITS layers are below maximum allowed values"}; +}; + +/// \class FemtoDreamTrackCuts +/// \brief Cut class to contain and execute all cuts applied to tracks +class CollisionSelection +{ + public: + CollisionSelection() {} + virtual ~CollisionSelection() = default; + + template + void configure(T1 const& filter, T2 const& flags) + { + // flags + mSel8 = flags.sel8.value; + mNoSameBunchPileup = flags.noSameBunchPileup.value; + mIsVertexItsTpc = flags.isVertexItsTpc.value; + mIsGoodZvtxFt0VsPv = flags.isGoodZvtxFt0VsPv.value; + mNoCollInTimeRangeNarrow = flags.noCollInTimeRangeNarrow.value; + mNoCollInTimeRangeStrict = flags.noCollInTimeRangeStrict.value; + mNoCollInTimeRangeStandard = flags.noCollInTimeRangeStandard.value; + mNoCollInRofStrict = flags.noCollInRofStrict.value; + mNoCollInRofStandard = flags.noCollInRofStandard.value; + mNoHighMultCollInPrevRof = flags.noHighMultCollInPrevRof.value; + mIsGoodItsLayer3 = flags.isGoodItsLayer3.value; + mIsGoodItsLayer0123 = flags.isGoodItsLayer0123.value; + mIsGoodItsLayersAll = flags.isGoodItsLayersAll.value; + + // cuts + mVtxZMin = filter.vtxZMin.value; + mVtxZMax = filter.vtxZMax.value; + mMagFieldMin = filter.magFieldMin.value; + mMagFieldMax = filter.magFieldMax.value; + mMultMin = filter.multMin.value; + mMultMax = filter.multMax.value; + mCentMin = filter.centMin.value; + mCentMax = filter.centMax.value; + mSphericityMin = filter.spherMin.value; + mSphericityMax = filter.spherMax.value; + mOccupancyMin = filter.occupancyMin.value; + mOccupancyMax = filter.occupancyMax.value; + }; + + void setMagneticField(float MagField) + { + mMagField = MagField; + } + + float getMagneticField() + { + return mMagField; + } + + template + void setSphericity(T tracks) + { + mSphericity = utils::sphericity(tracks); + } + + float getSphericity() const { return mSphericity; } + + template + void setCentrality(const T& col) + { + if constexpr (modes::isFlagSet(system, modes::System::kPP)) { + mCentrality = col.centFT0M(); + } + if constexpr (modes::isFlagSet(system, modes::System::kPbPb)) { + mCentrality = col.centFT0C(); + } + } + float getCentrality() const { return mCentrality; } + + template + bool checkCuts(T const& col) + { + + // flags + if (mSel8 && !col.sel8()) { // might change in the future, but sel8 checks TVXTrigger and cuts out time frame border and ITS readout frame border + return false; + } + if (mNoSameBunchPileup && !col.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + return false; + } + if (mIsVertexItsTpc && !col.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + return false; + } + if (mIsGoodZvtxFt0VsPv && !col.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + return false; + } + if (mNoCollInTimeRangeNarrow && !col.selection_bit(aod::evsel::kNoCollInTimeRangeNarrow)) { + return false; + } + if (mNoCollInTimeRangeStrict && !col.selection_bit(aod::evsel::kNoCollInTimeRangeStrict)) { + return false; + } + if (mNoCollInTimeRangeStandard && !col.selection_bit(aod::evsel::kNoCollInTimeRangeStandard)) { + return false; + } + if (mNoCollInRofStrict && !col.selection_bit(aod::evsel::kNoCollInRofStrict)) { + return false; + } + if (mNoCollInRofStandard && !col.selection_bit(aod::evsel::kNoCollInRofStandard)) { + return false; + } + if (mNoHighMultCollInPrevRof && !col.selection_bit(aod::evsel::kNoHighMultCollInPrevRof)) { + return false; + } + if (mIsGoodItsLayer3 && !col.selection_bit(aod::evsel::kIsGoodITSLayer3)) { + return false; + } + if (mIsGoodItsLayer0123 && !col.selection_bit(aod::evsel::kIsGoodITSLayer0123)) { + return false; + } + if (mIsGoodItsLayersAll && !col.selection_bit(aod::evsel::kIsGoodITSLayersAll)) { + return false; + } + + // cuts + if (col.posZ() < mVtxZMin || col.posZ() > mVtxZMax) { + return false; + } + if (col.multNTracksPV() < mMultMin || col.multNTracksPV() > mMultMax) { + return false; + } + if (mCentrality < mCentMin || mCentrality > mCentMax) { + return false; + } + if (mMagField < mMagFieldMin || mMagField > mMagFieldMax) { + return false; + } + if (mSphericity < mSphericityMin || mSphericity > mSphericityMax) { + return false; + } + return true; + } + + private: + float mCentrality = 0.f; + + // flags + bool mSel8 = false; + bool mNoSameBunchPileup = false; + bool mIsVertexItsTpc = false; + bool mIsGoodZvtxFt0VsPv = false; + bool mNoCollInTimeRangeNarrow = false; + bool mNoCollInTimeRangeStrict = false; + bool mNoCollInTimeRangeStandard = false; + bool mNoCollInRofStrict = false; + bool mNoCollInRofStandard = false; + bool mNoHighMultCollInPrevRof = false; + bool mIsGoodItsLayer3 = false; + bool mIsGoodItsLayer0123 = false; + bool mIsGoodItsLayersAll = false; + + // cuts + float mVtxZMin = -12.f; + float mVtxZMax = -12.f; + float mSphericityMin = 0.f; + float mSphericityMax = 2.f; + float mMagFieldMin = -1.f; + float mMagFieldMax = 1.f; + float mMultMin = 0.f; + float mMultMax = 999.f; + float mCentMin = 0.f; + float mCentMax = 999.f; + float mOccupancyMin = 0.; + float mOccupancyMax = 1e6f; + + float mMagField = 0.f; + float mSphericity = 0.f; +}; + +struct CollisionBuilderProducts : o2::framework::ProducesGroup { + o2::framework::Produces producedCollision; + o2::framework::Produces producedOccupancy; + o2::framework::Produces producedQns; + o2::framework::Produces producedPositions; + o2::framework::Produces producedMultiplicityEstimators; + o2::framework::Produces producedCentralityEstimators; +}; + +struct ConfCollisionTables : o2::framework::ConfigurableGroup { + std::string prefix = std::string("CollisionTables"); + o2::framework::Configurable produceCollisions{"produceCollisions", -1, "Produce Collisions (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceOccupancy{"produceOccupancy", -1, "Produce Occupancy (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceQns{"produceQns", -1, "Produce Qn (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable producePositions{"producePositions", -1, "Produce Positions (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceMults{"produceMults", -1, "Produce Multiplicities (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceCents{"produceCents", -1, "Produce Centralities (-1: auto; 0 off; 1 on)"}; +}; + +class CollisionBuilder +{ + public: + CollisionBuilder() {} + virtual ~CollisionBuilder() = default; + + template + void init(T1& filter, T2& flags, T3& table, T4& initContext) + { + collisionSelection.configure(filter, flags); + LOG(info) << "Initialize femto collision builder..."; + producedCollisions = utils::enableTable("FCols_001", table.produceCollisions.value, initContext); + produceOccupancy = utils::enableTable("FColOccs_001", table.produceOccupancy.value, initContext); + produceQns = utils::enableTable("FColQnBins_001", table.produceQns.value, initContext); + producedPositions = utils::enableTable("FColPos_001", table.producePositions.value, initContext); + producedMultiplicities = utils::enableTable("FColMults_001", table.produceMults.value, initContext); + producedCentralities = utils::enableTable("FColCents_001", table.produceCents.value, initContext); + if (producedCollisions || producedPositions || producedMultiplicities || producedCentralities) { + fillAnyTable = true; + } else { + LOG(info) << "No tables configured"; + } + LOG(info) << "Initialization done..."; + } + + template + void buildCollision(T1& col, T2 tracks, float magField) + { + collisionSelection.setMagneticField(magField); + collisionSelection.setSphericity(tracks); + collisionSelection.setCentrality(col); + } + + template + bool checkCuts(T const& col) + { + return collisionSelection.checkCuts(col); + } + + template + void fillCollision(T1& collisionProducts, T2 const& col) + { + if (!fillAnyTable) { + return; + } + if (producedCollisions) { + collisionProducts.producedCollision(col.posZ(), + col.multNTracksPV(), + collisionSelection.getCentrality(), + collisionSelection.getSphericity(), + collisionSelection.getMagneticField()); + } + + if (produceOccupancy) { + collisionProducts.producedOccupancy(col.trackOccupancyInTimeRange()); + } + + if (producedPositions) { + collisionProducts.producedPositions(col.posX(), + col.posY()); + } + if (producedMultiplicities) { + collisionProducts.producedMultiplicityEstimators( + col.multFT0A(), + col.multFT0C(), + col.multNTracksPVeta1(), + col.multNTracksPVetaHalf(), + col.trackOccupancyInTimeRange(), + col.ft0cOccupancyInTimeRange()); + } + if (producedCentralities) { + collisionProducts.producedCentralityEstimators( + col.centFT0A(), + col.centFT0C()); + } + + // PbPb specific columns + if constexpr (modes::isFlagSet(system, modes::System::kPbPb)) { + if (produceQns) { + collisionProducts.producedQns(utils::qn(col)); + } + } + } + + private: + CollisionSelection collisionSelection; + bool fillAnyTable = false; + bool producedCollisions = false; + bool produceOccupancy = false; + bool produceQns = false; + bool producedPositions = false; + bool producedMultiplicities = false; + bool producedCentralities = false; +}; +}; // namespace collisionbuilder +}; // namespace o2::analysis::femto +; +#endif // PWGCF_FEMTO_CORE_COLLISIONBUILDER_H_ diff --git a/PWGCF/Femto/Core/collisionHistManager.h b/PWGCF/Femto/Core/collisionHistManager.h new file mode 100644 index 00000000000..83c9d1ef64b --- /dev/null +++ b/PWGCF/Femto/Core/collisionHistManager.h @@ -0,0 +1,153 @@ +// Copyright 2019-2022 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 collisionHistManager.h +/// \brief collision histogram manager +/// \author anton.riedel@tum.de, TU München, anton.riedel@tum.de + +#ifndef PWGCF_FEMTO_CORE_COLLISIONHISTMANAGER_H_ +#define PWGCF_FEMTO_CORE_COLLISIONHISTMANAGER_H_ + +#include "PWGCF/Femto/Core/histManager.h" +#include "PWGCF/Femto/Core/modes.h" + +#include "Framework/Configurable.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/HistogramSpec.h" + +#include +#include +#include +#include +#include + +namespace o2::analysis::femto +{ +namespace colhistmanager +{ + +enum ColHist { + kPosz, + kMult, + kCent, + kMagField, + kSphericity, + // 2d qa + kPoszVsMult, + kPoszVsCent, + kCentVsMult, + kCentVsSphericity, + kMultVsSphericity, + kColHistLast +}; + +constexpr std::string_view ColAnalysisDir = "Collisions/Analysis/"; +constexpr std::string_view ColQaDir = "Collisions/QA/"; + +constexpr std::array, kColHistLast> HistTable = { + { + {kPosz, o2::framework::kTH1F, "hPosz", "Vertex Z; V_{Z} (cm); Entries"}, + {kMult, o2::framework::kTH1F, "hMult", "Multiplicity; Multiplicity; Entries"}, + {kCent, o2::framework::kTH1F, "hCent", "Centrality; Centrality (%); Entries"}, + {kMagField, o2::framework::kTH1F, "hMagField", "Magnetic Field; B (T); Entries"}, + {kSphericity, o2::framework::kTH1F, "hSphericity", "Sphericity; Sphericity; Entries"}, + {kPoszVsMult, o2::framework::kTH2F, "hPoszVsMult", "Vertex Z vs Multiplicity; V_{Z} (cm); Multiplicity"}, + {kPoszVsCent, o2::framework::kTH2F, "hPoszVsCent", "Vertex Z vs Centrality; V_{Z} (cm); Centrality (%)"}, + {kCentVsMult, o2::framework::kTH2F, "hCentVsMult", "Centrality vs Multiplicity; Centrality (%); Multiplicity"}, + {kMultVsSphericity, o2::framework::kTH2F, "hMultVsSphericity", "Multiplicity vs Sphericity; Multiplicity; Sphericity"}, + {kCentVsSphericity, o2::framework::kTH2F, "hCentVsSphericity", "Centrality vs Sphericity; Centrality (%); Sphericity"}, + }}; + +template +auto makeColHistSpecMap(const BinningStruct& binning) +{ + return std::map>{ + {kPosz, {binning.vtZ}}, + {kMult, {binning.mult}}, + {kCent, {binning.cent}}, + {kSphericity, {binning.spher}}, + {kMagField, {binning.magField}}, + {kPoszVsMult, {binning.vtZ, binning.mult}}, + {kPoszVsCent, {binning.vtZ, binning.cent}}, + {kCentVsMult, {binning.cent, binning.mult}}, + {kMultVsSphericity, {binning.mult, binning.spher}}, + {kCentVsSphericity, {binning.cent, binning.spher}}}; +} + +struct ConfCollisionBinning : o2::framework::ConfigurableGroup { + std::string prefix = std::string("CollisionBinning"); + o2::framework::ConfigurableAxis vtZ{"vtZ", {200, -10, 10}, "Vertex Z binning"}; + o2::framework::ConfigurableAxis mult{"mult", {200, 0, 200}, "Multiplicity binning"}; + o2::framework::ConfigurableAxis cent{"cent", {100, 0.0f, 100.0f}, "Centrality (multiplicity percentile) binning"}; + o2::framework::ConfigurableAxis spher{"spher", {200, 0.0f, 2.0f}, "Sphericity binning"}; + o2::framework::ConfigurableAxis magField{"magField", {2, -1, 1}, "Magnetic field binning"}; +}; + +/// \class FemtoDreamEventHisto +/// \brief Class for histogramming event properties +template +class CollisionHistManager +{ + public: + /// Destructor + virtual ~CollisionHistManager() = default; + /// Initializes histograms for the task + /// \param registry Histogram registry to be passed + void init(o2::framework::HistogramRegistry* registry, std::map> Specs) + { + mHistogramRegistry = registry; + if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { + std::string analysisDir = std::string(ColAnalysisDir); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kPosz, HistTable), GetHistDesc(kPosz, HistTable), GetHistType(kPosz, HistTable), {Specs[kPosz]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kMult, HistTable), GetHistDesc(kMult, HistTable), GetHistType(kMult, HistTable), {Specs[kMult]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kCent, HistTable), GetHistDesc(kCent, HistTable), GetHistType(kCent, HistTable), {Specs[kCent]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kSphericity, HistTable), GetHistDesc(kSphericity, HistTable), GetHistType(kSphericity, HistTable), {Specs[kSphericity]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kMagField, HistTable), GetHistDesc(kMagField, HistTable), GetHistType(kMagField, HistTable), {Specs[kMagField]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kPoszVsMult, HistTable), GetHistDesc(kPoszVsMult, HistTable), GetHistType(kPoszVsMult, HistTable), {Specs[kPoszVsMult]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kPoszVsCent, HistTable), GetHistDesc(kPoszVsCent, HistTable), GetHistType(kPoszVsCent, HistTable), {Specs[kPoszVsCent]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kCentVsMult, HistTable), GetHistDesc(kCentVsMult, HistTable), GetHistType(kCentVsMult, HistTable), {Specs[kCentVsMult]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kMultVsSphericity, HistTable), GetHistDesc(kMultVsSphericity, HistTable), GetHistType(kMultVsSphericity, HistTable), {Specs[kMultVsSphericity]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kCentVsSphericity, HistTable), GetHistDesc(kCentVsSphericity, HistTable), GetHistType(kCentVsSphericity, HistTable), {Specs[kCentVsSphericity]}); + } + + if constexpr (isFlagSet(mode, modes::Mode::kQa)) { + std::string qaDir = std::string(ColQaDir); + // to be implemented + } + } // namespace o2::analysis::femtounited + + template + void fill(T const& col) + { + if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { + mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kPosz, HistTable)), col.posZ()); + mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kMult, HistTable)), col.mult()); + mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kCent, HistTable)), col.cent()); + mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kSphericity, HistTable)), col.sphericity()); + mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kMagField, HistTable)), col.magField()); + mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kPoszVsMult, HistTable)), col.posZ(), col.mult()); + mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kPoszVsCent, HistTable)), col.posZ(), col.cent()); + mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kCentVsMult, HistTable)), col.cent(), col.mult()); + mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kMultVsSphericity, HistTable)), col.mult(), col.sphericity()); + mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kCentVsSphericity, HistTable)), col.cent(), col.sphericity()); + } + + if constexpr (isFlagSet(mode, modes::Mode::kQa)) { + // to be implemented + } + } + + private: + o2::framework::HistogramRegistry* mHistogramRegistry; +}; // namespace femtounitedcolhistmanager +}; // namespace colhistmanager +}; // namespace o2::analysis::femto +#endif // PWGCF_FEMTO_CORE_COLLISIONHISTMANAGER_H_ diff --git a/PWGCF/Femto/Core/dataTypes.h b/PWGCF/Femto/Core/dataTypes.h new file mode 100644 index 00000000000..ade9456f068 --- /dev/null +++ b/PWGCF/Femto/Core/dataTypes.h @@ -0,0 +1,51 @@ +// Copyright 2019-2025 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 dataTypes.h +/// \brief datatypes for bitmasks +/// \author anton.riedel@tum.de, TU München, anton.riedel@tum.de + +#ifndef PWGCF_FEMTO_CORE_DATATYPES_H_ +#define PWGCF_FEMTO_CORE_DATATYPES_H_ + +#include + +namespace o2::aod +{ +namespace femtodatatypes +{ +// Note: Length of the bitmask is the limit of how many selections can be configured + +// datatypes for tracks +using TrackMaskType = uint64_t; +using TrackType = uint16_t; + +// datatypes for v0s +using V0MaskType = uint16_t; +using V0Type = uint8_t; + +// datatypes for two track resonances +using TwoTrackResonanceMaskType = uint32_t; +// two track resonance types +using TwoTrackResonanceType = uint8_t; + +// datatypes for cascades +using CascadeMaskType = uint16_t; +using CascadeType = uint8_t; + +// datatypes for pairs +using PairType = uint8_t; + +} // namespace femtodatatypes + +} // namespace o2::aod + +#endif // PWGCF_FEMTO_CORE_DATATYPES_H_ diff --git a/PWGCF/Femto/Core/femtoUtils.h b/PWGCF/Femto/Core/femtoUtils.h new file mode 100644 index 00000000000..10f81cf3669 --- /dev/null +++ b/PWGCF/Femto/Core/femtoUtils.h @@ -0,0 +1,189 @@ +// Copyright 2019-2022 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 femtoUtils.h +/// \brief Collision selection +/// \author Anton Riedel, TU München, anton.riedel@cern.ch + +#ifndef PWGCF_FEMTO_CORE_FEMTOUTILS_H_ +#define PWGCF_FEMTO_CORE_FEMTOUTILS_H_ + +#include "Common/Core/TableHelper.h" + +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/InitContext.h" + +#include "TPDGCode.h" + +#include "fairlogger/Logger.h" + +#include +#include +#include +#include + +namespace o2::analysis::femto +{ +namespace utils +{ + +template +inline std::optional getIndex(const T1& index, const std::unordered_map& map) +{ + auto it = map.find(index); + if (it != map.end()) { + return it->second; + } + return std::nullopt; +} + +template +float itsSignal(T const& track) +{ + uint32_t clsizeflag = track.itsClusterSizes(); + auto clSizeLayer0 = (clsizeflag >> (0 * 4)) & 0xf; + auto clSizeLayer1 = (clsizeflag >> (1 * 4)) & 0xf; + auto clSizeLayer2 = (clsizeflag >> (2 * 4)) & 0xf; + auto clSizeLayer3 = (clsizeflag >> (3 * 4)) & 0xf; + auto clSizeLayer4 = (clsizeflag >> (4 * 4)) & 0xf; + auto clSizeLayer5 = (clsizeflag >> (5 * 4)) & 0xf; + auto clSizeLayer6 = (clsizeflag >> (6 * 4)) & 0xf; + int numLayers = 7; + int sumClusterSizes = clSizeLayer0 + clSizeLayer1 + clSizeLayer2 + clSizeLayer3 + clSizeLayer4 + clSizeLayer5 + clSizeLayer6; + float cosLamnda = 1. / std::cosh(track.eta()); + return (static_cast(sumClusterSizes) / numLayers) * cosLamnda; +}; + +template +float sphericity(T const& tracks) +{ + + int minNumberTracks = 2; + float maxSphericity = 2.f; + + if (tracks.size() <= minNumberTracks) { + return maxSphericity; + } + + // Initialize the transverse momentum tensor components + float sxx = 0.f; + float syy = 0.f; + float sxy = 0.f; + float sumPt = 0.f; + + // Loop over the tracks to compute the tensor components + for (const auto& track : tracks) { + sxx += (track.px() * track.px()) / track.pt(); + syy += (track.py() * track.py()) / track.pt(); + sxy += (track.px() * track.py()) / track.pt(); + sumPt += track.pt(); + } + sxx /= sumPt; + syy /= sumPt; + sxy /= sumPt; + + // Compute the eigenvalues (real values) + float lambda1 = ((sxx + syy) + std::sqrt((sxx + syy) * (sxx + syy) - 4 * (sxx * syy - sxy * sxy))) / 2; + float lambda2 = ((sxx + syy) - std::sqrt((sxx + syy) * (sxx + syy) - 4 * (sxx * syy - sxy * sxy))) / 2; + + if (lambda1 <= 0.f || lambda2 <= 0.f) { + return maxSphericity; + } + + // Compute sphericity + return 2.f * lambda2 / (lambda1 + lambda2); +} + +inline float getMass(int pdgCode) +{ + // use this function instead of TDatabasePDG to return masses defined in the PhysicsConstants.h header + // this approach saves a lot of memory and important partilces like deuteron are missing in TDatabasePDG anyway + float mass = 0.f; + // add new particles if necessary here + switch (std::abs(pdgCode)) { + case kPiPlus: + mass = o2::constants::physics::MassPiPlus; + break; + case kKPlus: + mass = o2::constants::physics::MassKPlus; + break; + case kProton: + mass = o2::constants::physics::MassProton; + break; + case kLambda0: + mass = o2::constants::physics::MassLambda; + break; + case o2::constants::physics::Pdg::kPhi: + mass = o2::constants::physics::MassPhi; + break; + case kRho770_0: + mass = 775.26; // not defined in O2? + break; + case kRho770Plus: + mass = 775.11; // not defined in O2? + break; + case o2::constants::physics::Pdg::kK0Star892: + mass = o2::constants::physics::MassK0Star892; + break; + case o2::constants::physics::Pdg::kLambdaCPlus: + mass = o2::constants::physics::MassLambdaCPlus; + break; + case o2::constants::physics::Pdg::kDeuteron: + mass = o2::constants::physics::MassDeuteron; + break; + case o2::constants::physics::Pdg::kTriton: + mass = o2::constants::physics::MassTriton; + break; + case o2::constants::physics::Pdg::kHelium3: + mass = o2::constants::physics::MassHelium3; + break; + default: + LOG(fatal) << "PDG code is not suppored"; + } + return mass; +} + +template +float qn(T const& col) +{ + float qn = std::sqrt(col.qvecFT0CReVec()[0] * col.qvecFT0CReVec()[0] + col.qvecFT0CImVec()[0] * col.qvecFT0CImVec()[0]) * std::sqrt(col.sumAmplFT0C()); + return qn; +} + +inline std::optional dphistar(float magfield, float radius, float sign, float pt, float phi) +{ + float arg = 0.3f * sign * magfield * radius * 0.01f / (2.f * pt); + if (std::fabs(arg) < 1.f) { + return phi - std::asin(arg); + } + return std::nullopt; +} + +inline bool enableTable(const char* tableName, int userSetting, o2::framework::InitContext& initContext) +{ + if (userSetting == 1) { + LOG(info) << "Enabled femto table (forced on): " << tableName; + return true; + } + if (userSetting == 0) { + LOG(info) << "Disabled femto table (forced off): " << tableName; + return false; + } + bool required = o2::common::core::isTableRequiredInWorkflow(initContext, tableName); + if (required) { + LOG(info) << "Enabled femto table (auto): " << tableName; + } + return required; +} + +}; // namespace utils +}; // namespace o2::analysis::femto +#endif // PWGCF_FEMTO_CORE_FEMTOUTILS_H_ diff --git a/PWGCF/Femto/Core/histManager.h b/PWGCF/Femto/Core/histManager.h new file mode 100644 index 00000000000..8c22277d642 --- /dev/null +++ b/PWGCF/Femto/Core/histManager.h @@ -0,0 +1,82 @@ +// Copyright 2019-2025 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 histManager.h +/// \brief common structs for histogram managers +/// \author anton.riedel@tum.de, TU München, anton.riedel@tum.de + +#ifndef PWGCF_FEMTO_CORE_HISTMANAGER_H_ +#define PWGCF_FEMTO_CORE_HISTMANAGER_H_ + +#include "Framework/HistogramSpec.h" + +#include +#include + +namespace o2::analysis::femto +{ +namespace histmanager +{ + +template +struct HistInfo { + Hist hist; + o2::framework::HistType histtype; + std::string_view histname; + std::string_view histdesc; +}; + +template +constexpr o2::framework::HistType GetHistType(EnumType variable, const ArrayType& array) +{ + for (const auto& entry : array) { + if (entry.hist == variable) { + return entry.histtype; + } + } + return o2::framework::kUndefinedHist; +} + +template +constexpr std::string_view GetHistName(EnumType variable, const ArrayType& array) +{ + for (const auto& entry : array) { + if (entry.hist == variable) { + return entry.histname; + } + } + return ""; // Return an empty string or a default name if not found +} + +template +constexpr std::string GetHistNamev2(EnumType variable, const ArrayType& array) +{ + for (const auto& entry : array) { + if (entry.hist == variable) { + return std::string(entry.histname); + } + } + return std::string(""); // Return an empty string or a default name if not found +} + +template +constexpr const char* GetHistDesc(EnumType variable, const ArrayType& array) +{ + for (const auto& entry : array) { + if (entry.hist == variable) { + return entry.histdesc.data(); + } + } + return ""; // Return an empty string or a default description if not found +} +} // namespace histmanager +} // namespace o2::analysis::femto +#endif // PWGCF_FEMTO_CORE_HISTMANAGER_H_ diff --git a/PWGCF/Femto/Core/modes.h b/PWGCF/Femto/Core/modes.h new file mode 100644 index 00000000000..83a230672ff --- /dev/null +++ b/PWGCF/Femto/Core/modes.h @@ -0,0 +1,112 @@ +// Copyright 2019-2025 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 modes.h +/// \brief common modes +/// \author anton.riedel@tum.de, TU München, anton.riedel@tum.de + +#ifndef PWGCF_FEMTO_CORE_MODES_H_ +#define PWGCF_FEMTO_CORE_MODES_H_ + +#include "PWGCF/Femto/Core/dataTypes.h" + +#include + +#include +#include + +namespace o2::analysis::femto +{ +namespace modes +{ + +// check if flag is set +template +constexpr bool isFlagSet(T value, T flag) +{ + using U = std::underlying_type_t; + return (static_cast(value) & static_cast(flag)) != 0; +} + +// check if flag is equal +template +constexpr bool isEqual(T lhs, T rhs) +{ + using U = std::underlying_type_t; + return static_cast(lhs) == static_cast(rhs); +} + +enum class Mode : uint32_t { + kAnalysis = BIT(0), + kQa = BIT(1), + kMc = BIT(2), + kAnalysis_Qa = kAnalysis | kQa, + kAnalysis_Mc = kAnalysis | kMc, + kAnalysis_Qa_Mc = kAnalysis | kQa | kMc, +}; + +enum class System : uint32_t { + kPP = BIT(0), + kPbPb = BIT(1), + kMC = BIT(2), + kRun3 = BIT(3), + kRun2 = BIT(4), + kNoCentCal = BIT(5), + kPP_Run3 = kPP | kRun3, + kPP_Run2 = kPP | kRun2, + kPP_NoCentCal_Run3 = kPP | kRun3 | kNoCentCal, + kPbPb_Run3 = kPbPb | kRun3, + kPbPb_Run2 = kPbPb | kRun2, +}; + +enum class Track : o2::aod::femtodatatypes::TrackType { + kPrimaryTrack, + kV0Daughter, + kCascadeBachelor, + kResonanceDaughter +}; + +enum class V0 : o2::aod::femtodatatypes::V0Type { + kLambda, + kAntiLambda, + kK0short +}; + +enum class Cascade : o2::aod::femtodatatypes::CascadeType { + kXi, + kOmega +}; + +// enum of supported resonances +enum class TwoTrackResonance : o2::aod::femtodatatypes::TwoTrackResonanceType { + kRho0, + kPhi, + kKstar0, + kKstar0Bar +}; + +enum class Pairs : o2::aod::femtodatatypes::PairType { + kTrackTrack, + kTrackV0, + kTrackResonance, + kTrackCascade +}; + +enum class TrackPairs : o2::aod::femtodatatypes::PairType { + kTrackTrack, + kTrackPosDaughter, + kTrackNegDaughter, + kTrackBachelor +}; + +}; // namespace modes +}; // namespace o2::analysis::femto +#endif // PWGCF_FEMTO_CORE_MODES_H_ diff --git a/PWGCF/Femto/Core/partitions.h b/PWGCF/Femto/Core/partitions.h new file mode 100644 index 00000000000..adbac4d2213 --- /dev/null +++ b/PWGCF/Femto/Core/partitions.h @@ -0,0 +1,113 @@ +// Copyright 2019-2025 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 partitions.h +/// \brief common partition definitons +/// \author anton.riedel@tum.de, TU München, anton.riedel@tum.de + +#ifndef PWGCF_FEMTO_CORE_PARTITIONS_H_ +#define PWGCF_FEMTO_CORE_PARTITIONS_H_ + +// collsion filters +#define MAKE_COLLISION_FILTER(selection) \ + (femtocollisions::posZ >= (selection).vtxZMin && femtocollisions::posZ <= (selection).vtxZMax) && \ + (femtocollisions::mult >= (selection).multMin && femtocollisions::mult <= (selection).multMax) && \ + (femtocollisions::cent >= (selection).centMin && femtocollisions::cent <= (selection).centMax) && \ + (femtocollisions::sphericity >= (selection).spherMin && femtocollisions::sphericity <= (selection).spherMax) && \ + (femtocollisions::magField >= (selection).magFieldMin && femtocollisions::magField <= (selection).magFieldMax) + +// standard track partition +#define MAKE_TRACK_PARTITION(selection) \ + ifnode(selection.sign.node() > 0, femtobase::stored::signedPt > 0.f, femtobase::stored::signedPt < 0.f) && \ + (nabs(femtobase::stored::signedPt) > selection.ptMin) && \ + (nabs(femtobase::stored::signedPt) < selection.ptMax) && \ + (femtobase::stored::eta > selection.etaMin) && \ + (femtobase::stored::eta < selection.etaMax) && \ + (femtobase::stored::phi > selection.phiMin) && \ + (femtobase::stored::phi < selection.phiMax) && \ + ifnode(nabs(femtobase::stored::signedPt) * (nexp(femtobase::stored::eta) + nexp(-1.f * femtobase::stored::eta)) / 2.f <= selection.pidThres, \ + ncheckbit(femtotracks::trackMask, selection.maskLowMomentum), \ + ncheckbit(femtotracks::trackMask, selection.maskHighMomentum)) + +// partition for phis and rhos, i.e. resonance that are their own antiparticle +#define MAKE_RESONANCE_0_PARTITON(selection) \ + (femtobase::stored::pt > selection.ptMin) && \ + (femtobase::stored::pt < selection.ptMax) && \ + (femtobase::stored::eta > selection.etaMin) && \ + (femtobase::stored::eta < selection.etaMax) && \ + (femtobase::stored::phi > selection.phiMin) && \ + (femtobase::stored::phi < selection.phiMax) && \ + (femtobase::stored::mass > selection.massMin) && \ + (femtobase::stored::mass < selection.massMax) && \ + ifnode(ncheckbit(femtotwotrackresonances::mask, selection.posDauBitForThres), \ + ncheckbit(femtotwotrackresonances::mask, selection.posDauMaskAboveThres), \ + ncheckbit(femtotwotrackresonances::mask, selection.posDauMaskBelowThres)) && \ + ifnode(ncheckbit(femtotwotrackresonances::mask, selection.negDauBitForThres), \ + ncheckbit(femtotwotrackresonances::mask, selection.negDauMaskAboveThres), \ + ncheckbit(femtotwotrackresonances::mask, selection.negDauMaskBelowThres)) + +// partition for kstars, they have distince antiparticle +#define MAKE_RESONANCE_1_PARTITON(selection) \ + ifnode(selection.sign.node() > 0, femtobase::stored::signedPt > 0.f, femtobase::stored::signedPt < 0.f) && \ + (nabs(femtobase::stored::signedPt) > selection.ptMin) && \ + (nabs(femtobase::stored::signedPt) < selection.ptMax) && \ + (femtobase::stored::eta > selection.etaMin) && \ + (femtobase::stored::eta < selection.etaMax) && \ + (femtobase::stored::phi > selection.phiMin) && \ + (femtobase::stored::phi < selection.phiMax) && \ + (femtobase::stored::mass > selection.massMin) && \ + (femtobase::stored::mass < selection.massMax) && \ + ifnode(ncheckbit(femtotwotrackresonances::mask, selection.posDauBitForThres), \ + ncheckbit(femtotwotrackresonances::mask, selection.posDauMaskAboveThres), \ + ncheckbit(femtotwotrackresonances::mask, selection.posDauMaskBelowThres)) && \ + ifnode(ncheckbit(femtotwotrackresonances::mask, selection.negDauBitForThres), \ + ncheckbit(femtotwotrackresonances::mask, selection.negDauMaskAboveThres), \ + ncheckbit(femtotwotrackresonances::mask, selection.negDauMaskBelowThres)) + +// partition for lambdas +#define MAKE_LAMBDA_PARTITION(selection) \ + ifnode(selection.sign.node() > 0, femtobase::stored::signedPt > 0.f, femtobase::stored::signedPt < 0.f) && \ + (nabs(femtobase::stored::signedPt) > selection.ptMin) && \ + (nabs(femtobase::stored::signedPt) < selection.ptMax) && \ + (femtobase::stored::eta > selection.etaMin) && \ + (femtobase::stored::eta < selection.etaMax) && \ + (femtobase::stored::phi > selection.phiMin) && \ + (femtobase::stored::phi < selection.phiMax) && \ + (femtobase::stored::mass > selection.massMin) && \ + (femtobase::stored::mass < selection.massMax) && \ + ncheckbit(femtov0s::mask, selection.mask) + +// partition for k0shorts +// need special partition since k0shorts have no antiparticle +#define MAKE_K0SHORT_PARTITION(selection) \ + (femtobase::stored::pt > selection.ptMin) && \ + (femtobase::stored::pt < selection.ptMax) && \ + (femtobase::stored::eta > selection.etaMin) && \ + (femtobase::stored::eta < selection.etaMax) && \ + (femtobase::stored::phi > selection.phiMin) && \ + (femtobase::stored::phi < selection.phiMax) && \ + (femtobase::stored::mass > selection.massMin) && \ + (femtobase::stored::mass < selection.massMax) && \ + ncheckbit(femtov0s::mask, selection.mask) + +#define MAKE_CASCADE_PARTITION(selection) \ + ifnode(selection.sign.node() > 0, femtobase::stored::signedPt > 0.f, femtobase::stored::signedPt < 0.f) && \ + (nabs(femtobase::stored::signedPt) > selection.ptMin) && \ + (nabs(femtobase::stored::signedPt) < selection.ptMax) && \ + (femtobase::stored::eta > selection.etaMin) && \ + (femtobase::stored::eta < selection.etaMax) && \ + (femtobase::stored::phi > selection.phiMin) && \ + (femtobase::stored::phi < selection.phiMax) && \ + (femtobase::stored::mass > selection.massMin) && \ + (femtobase::stored::mass < selection.massMax) && \ + ncheckbit(femtocascades::mask, selection.mask) + +#endif // PWGCF_FEMTO_CORE_PARTITIONS_H_ diff --git a/PWGCF/Femto/Core/selectionContainer.h b/PWGCF/Femto/Core/selectionContainer.h new file mode 100644 index 00000000000..8b050a4b700 --- /dev/null +++ b/PWGCF/Femto/Core/selectionContainer.h @@ -0,0 +1,342 @@ +// Copyright 2019-2025 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 selectionContainer.h +/// \brief Defines the SelectionContainer class for managing selection criteria in analysis. +/// \author Anton Riedel, TU München, anton.riedel@tum.de + +#ifndef PWGCF_FEMTO_CORE_SELECTIONCONTAINER_H_ +#define PWGCF_FEMTO_CORE_SELECTIONCONTAINER_H_ + +#include "CommonConstants/MathConstants.h" + +#include "TF1.h" + +#include "fairlogger/Logger.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace o2::analysis::femto +{ + +/// Limit type for selections +namespace limits +{ +enum LimitType { kUpperLimit, ///< simple upper limit for the value, e.g. p_T < 1 GeV/c + kAbsUpperLimit, ///< upper limit of the absolute value, e.g. |eta| < 0.8 + kLowerLimit, ///< simple lower limit for the value, e.g. p_T > 0.2 GeV/c + kAbsLowerLimit, ///< lower limit of the absolute value, e.g. |DCA_xyz| > 0.05 cm + kEqual, ///< values need to be equal, e.g. sign = 1 + kUpperFunctionLimit, ///< simple upper limit of a function value, e.g. DCA_xy > f(pt) + kAbsUpperFunctionLimit, ///< upper limit of an absolute value given by a function, e.g. |DCA_xy| > f(pt) + kLowerFunctionLimit, ///< simple lower limit of a function value, e.g. DCA_xy < f(pt) + kAbsLowerFunctionLimit ///< lower limit of an absolute value given by a function, e.g. |DCA_xy| < f(pt) +}; + +std::unordered_map limitTypeAsStrings = { + {kUpperLimit, "Upper Limit"}, + {kAbsUpperLimit, "Absolute Upper Limit"}, + {kLowerLimit, "Lower Limit"}, + {kAbsLowerLimit, "Absolute Lower Limit"}, + {kEqual, "Equal"}, + {kUpperFunctionLimit, "Upper Function Limit"}, + {kAbsUpperFunctionLimit, "Absolute Upper Function Limit"}, + {kLowerFunctionLimit, "Lower Function Limit"}, + {kAbsLowerFunctionLimit, "Absolute Lower Function Limit"}}; + +}; // namespace limits + +/// \class SelectionContainer +/// \brief Class for storing and evaluating multiple selection thresholds for a single observable. +/// \tparam T Data type for selection values (mostly floats) +/// \tparam BitmaskType Type used for bitmask storage (e.g., uint8_t, uint32_t). +template +class SelectionContainer +{ + public: + /// Default constructor + SelectionContainer() {} + + /// \brief Constructor for static value-based selection. + /// \param SelectionValues Vector of values for the selection. + /// \param limitType Type of limit (from limits::LimitType). + /// \param SkipMostPermissiveBit Whether to skip the most permissive bit in the bitmask. + /// \param IsMinimalCut Whether this selection should be treated as a minimal required cut. + SelectionContainer(std::vector const& SelectionValues, limits::LimitType limitType, bool SkipMostPermissiveBit, bool IsMinimalCut) + : mSelectionValues(SelectionValues), + mLimitType(limitType), + mSkipMostPermissiveBit(SkipMostPermissiveBit), + mIsMinimalCut(IsMinimalCut) + { + if (mSelectionValues.size() > sizeof(BitmaskType) * CHAR_BIT) { + LOG(fatal) << "Too many selections for single a observable. Limit is " << sizeof(BitmaskType) * CHAR_BIT; + } + // for kEqual we can never skip the last bit + if (limitType == limits::kEqual) { + mSkipMostPermissiveBit = false; + } + // values for selection are not necessarily ordered correctly + sortSelections(); + } + + /// \brief Constructor for function-based dynamic selection. + /// \param baseName Base name for TF1 functions. + /// \param lowerLimit Lower bound for TF1 domain. + /// \param upperLimit Upper bound for TF1 domain. + /// \param functions Vector of strings defining TF1 functions. + /// \param limitType Type of limit. + /// \param skipMostPermissiveBit Whether to skip the most permissive bit in the bitmask. + /// \param IsMinimalCut Whether this selection should be treated as a minimal required cut. + SelectionContainer(std::string const& baseName, + T lowerLimit, + T upperLimit, + std::vector const& functions, + limits::LimitType limitType, + bool skipMostPermissiveBit, + bool IsMinimalCut) + : mLimitType(limitType), + mSkipMostPermissiveBit(skipMostPermissiveBit), + mIsMinimalCut(IsMinimalCut) + { + if (functions.size() > sizeof(BitmaskType) * CHAR_BIT) { + LOG(fatal) << "Too many selections for single a observable. Limit is " << sizeof(BitmaskType) * CHAR_BIT; + } + for (std::size_t i = 0; i < functions.size(); i++) { + const std::string& func = functions.at(i); + const std::string& safeFunc = func.empty() ? "0.1" : func; // in case string is empty, set to constant value of 0.1 + mSelectionFunctions.emplace_back((baseName + std::to_string(i)).c_str(), safeFunc.c_str(), lowerLimit, upperLimit); + } + // functions for selection are not necessarily ordered correctly + // use value at midpoint to order them + // here we rely on the user that the functions can be ordered like this over the whole interval + T midPoint = (lowerLimit + upperLimit) / 2.; + sortFunctions(midPoint); + // initialize the values also to the midpoint + for (std::size_t i = 0; i < functions.size(); i++) { + mSelectionValues.push_back(mSelectionFunctions.at(i).Eval(midPoint)); + } + } + + virtual ~SelectionContainer() = default; + + /// \brief Sort static selection values based on the limit type. + void sortSelections() + { + switch (mLimitType) { + case (limits::kUpperLimit): + case (limits::kAbsUpperLimit): + std::sort(mSelectionValues.begin(), mSelectionValues.end(), [](T a, T b) { return a > b; }); + break; + case (limits::kLowerLimit): + case (limits::kAbsLowerLimit): + case (limits::kEqual): + std::sort(mSelectionValues.begin(), mSelectionValues.end(), [](T a, T b) { return a < b; }); + break; + default: + break; + } + } + + /// \brief Sort selection functions based on evaluation at a given point. + /// \param value Point at which to evaluate the functions for ordering. + void sortFunctions(T value) + { + switch (mLimitType) { + case (limits::kUpperFunctionLimit): + case (limits::kAbsUpperFunctionLimit): + std::sort(mSelectionFunctions.begin(), mSelectionFunctions.end(), [value](TF1 a, TF1 b) { return a.Eval(value) > b.Eval(value); }); + break; + case (limits::kLowerFunctionLimit): + case (limits::kAbsLowerFunctionLimit): + std::sort(mSelectionFunctions.begin(), mSelectionFunctions.end(), [value](TF1 a, TF1 b) { return a.Eval(value) < b.Eval(value); }); + break; + default: + break; + } + } + + /// \brief Update selection limits using internal functions evaluated at a given value. + /// \param value Input value to evaluate functions at. + void updateLimits(T value) + { + // functions are ordered so just add the values in the same order + for (std::size_t i = 0; i < mSelectionValues.size(); i++) { + mSelectionValues.at(i) = mSelectionFunctions.at(i).Eval(value); + } + } + + /// \brief Evaluate which selection criteria are fulfilled for a given value. + /// \param value Value of the observable to evaluate. + void evaluate(T value) + { + // better safe than sorry and reset the bitmask before you evaluate and set minimal selection to true + mBitmask.reset(); + // the values are ordered, from most loose to most tight, as soon as one comparison is not true, we can break out of the loop + bool breakLoop = false; + // iterate over all limits and set the corresponding bit if we pass the selection, otherwise break out as soon as we can + // only break if the observable is used for the minimal selection + for (size_t i = 0; i < mSelectionValues.size(); i++) { + switch (mLimitType) { + case (limits::kUpperLimit): + case (limits::kUpperFunctionLimit): + if (value <= mSelectionValues.at(i)) { + mBitmask.set(i); + } else { + breakLoop = true; + } + break; + case (limits::kAbsUpperLimit): + case (limits::kAbsUpperFunctionLimit): + if (std::abs(value) <= mSelectionValues.at(i)) { + mBitmask.set(i); + } else { + breakLoop = true; + } + break; + case (limits::kLowerLimit): + case (limits::kLowerFunctionLimit): + if (value >= mSelectionValues.at(i)) { + mBitmask.set(i); + } else { + breakLoop = true; + } + break; + case (limits::kAbsLowerLimit): + case (limits::kAbsLowerFunctionLimit): + if (std::abs(value) >= mSelectionValues.at(i)) { + mBitmask.set(i); + } else { + breakLoop = true; + } + break; + case (limits::kEqual): + // special case for kEqual since here we cannot really establish an order so we need to check all cases explicitly and we cannot bail early + if (std::abs(value - mSelectionValues.at(i)) < constants::math::Epsilon) { + mBitmask.set(i); + } + break; + default: + breakLoop = true; + } + // bail early if a comparison fails + // the values are ordered, so all following we also fail, there there is no point in contiuing + if (breakLoop) { + break; + } + } + } + + /// \brief Retrieve the bitmask indicating which selections were passed. + /// \return Bitset representing passed selections. + std::bitset getBitmask() const + { + // if we do not skip the last bit, return full bitmask + // in the constructor we ensure that for kEqual we do not skip the most permissive bit + if (mSkipMostPermissiveBit == false) { + return mBitmask; + } else { + // for the other selections we can remove the first bit since it is the minimal selection and therefore always true + return mBitmask >> 1; + } + } + template + void setBitmask(R bitmask) + { + mBitmask = std::bitset(bitmask); + } + + /// \brief Check whether the minimal cut condition is fulfilled. + /// \return True if minimal selection is fulfilled, false otherwise. + bool passesAsMinimalCut() const + { + if (mIsMinimalCut) { + // check if loosest bit is set + return mBitmask.test(0); + } else { + // if selection is not marked as a minimal cut, we return true by default + return true; + } + } + + /// \brief Check whether any optional cuts are fulfilled. + /// \return True if at least one optional cut is passed. + bool passesAsOptionalCut() const + { + // if selection is marekd as minimal cut, we return false by default + if (mIsMinimalCut) { + return false; + } else { + // check if any bit is set + return mBitmask.any(); + } + } + + /// \brief Get the loosest (most permissive) selection value. + /// \return First (loosest) selection value. + T getLoosestSelection() const { return mSelectionValues.at(0); } + + /// \brief Check if there are any selection values configured. + /// \return True if no selections are configured. + bool isEmpty() const { return mSelectionValues.empty(); } + + /// \brief Get the number of bits to shift for the final bitmask. + /// \return Number of bits to shift. + int getShift() const + { + if (mSelectionValues.empty()) { + return 0; + } + if (mSkipMostPermissiveBit) { + return static_cast(mSelectionValues.size() - 1); + } else { + return static_cast(mSelectionValues.size()); + } + } + + /// \brief Get string representation of the limit type. + /// \return String name of the limit type. + std::string getLimitTypeAsString() const { return limits::limitTypeAsStrings[mLimitType]; } + + /// \brief Get a copy of all selection values. + /// \return Vector of selection values. + std::vector getSelectionValues() const { return mSelectionValues; } + + /// \brief Get a copy of all selection values. + /// \return Vector of selection values. + std::vector getSelectionFunction() const { return mSelectionFunctions; } + + /// \brief Check if this container is marked as minimal cut. + /// \return True if minimal cut, false otherwise. + bool isMinimalCut() const { return mIsMinimalCut; } + + /// \brief Check whether the most permissive bit is skipped. + /// \return True if skipped, false otherwise. + bool skipMostPermissiveBit() const { return mSkipMostPermissiveBit; } + + private: + std::vector mSelectionValues = {}; ///< Values used for the selection + std::vector mSelectionFunctions = {}; ///< Function used for the selection + limits::LimitType mLimitType; ///< Limit type of selection + std::bitset mBitmask = {}; ///< bitmask for the observable + bool mSkipMostPermissiveBit = false; ///< whether to skip the last bit or not + bool mIsMinimalCut = false; ///< whether to use this observable for minimal selection or not +}; + +} // namespace o2::analysis::femto + +#endif // PWGCF_FEMTO_CORE_SELECTIONCONTAINER_H_ diff --git a/PWGCF/Femto/Core/trackBuilder.h b/PWGCF/Femto/Core/trackBuilder.h new file mode 100644 index 00000000000..ae3331226b1 --- /dev/null +++ b/PWGCF/Femto/Core/trackBuilder.h @@ -0,0 +1,615 @@ +// Copyright 2019-2025 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 trackBuilder.h +/// \brief track builder +/// \author Anton Riedel, TU München, anton.riedel@cern.ch + +#ifndef PWGCF_FEMTO_CORE_TRACKBUILDER_H_ +#define PWGCF_FEMTO_CORE_TRACKBUILDER_H_ + +#include "PWGCF/Femto/Core/baseSelection.h" +#include "PWGCF/Femto/Core/dataTypes.h" +#include "PWGCF/Femto/Core/femtoUtils.h" +#include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/selectionContainer.h" +#include "PWGCF/Femto/DataModel/FemtoTables.h" + +#include "CommonConstants/MathConstants.h" +#include "Framework/AnalysisHelpers.h" +#include "Framework/Configurable.h" + +#include "fairlogger/Logger.h" + +#include +#include +#include +#include +#include + +namespace o2::analysis::femto +{ +namespace trackbuilder +{ + +struct ConfTrackFilters : o2::framework::ConfigurableGroup { + std::string prefix = std::string("TrackFilters"); + // kinematic cuts for filtering tracks + o2::framework::Configurable ptMin{"ptMin", 0.2f, "Minimum pT"}; + o2::framework::Configurable ptMax{"ptMax", 6.f, "Maximum pT"}; + o2::framework::Configurable etaMin{"etaMin", -0.9f, "Minimum eta"}; + o2::framework::Configurable etaMax{"etaMax", 0.9f, "Maximum eta"}; + o2::framework::Configurable phiMin{"phiMin", 0.f, "Minimum phi"}; + o2::framework::Configurable phiMax{"phiMax", 1.f * o2::constants::math::TwoPI, "Maximum phi"}; +}; + +struct ConfTrackBits : o2::framework::ConfigurableGroup { + std::string prefix = std::string("TrackBits"); + // track quality cuts + o2::framework::Configurable> tpcClustersMin{"tpcClustersMin", {90.f}, "Minimum number of clusters in TPC"}; + o2::framework::Configurable> tpcCrossedRowsMin{"tpcCrossedRowsMin", {80.f}, "Minimum number of crossed rows in TPC"}; + o2::framework::Configurable> tpcSharedClustersMax{"tpcSharedClustersMax", {160.f}, "Maximum number of shared clusters in TPC"}; + o2::framework::Configurable> tpcSharedClusterFractionMax{"tpcSharedClusterFractionMax", {1.f}, "Maximum fraction of shared clusters in TPC"}; + o2::framework::Configurable> itsClustersMin{"itsClustersMin", {5.f}, "Minimum number of clusters in ITS"}; + o2::framework::Configurable> itsIbClustersMin{"itsIbClustersMin", {3.f}, "Minimum number of clusters in inner barrel (max 3) of ITS"}; + o2::framework::Configurable> dcaxyMax{"dcaxyMax", {"0.004 + 0.013*pow(x, -1)"}, "Maximum |dca_xy| as a function of pT. Has to be a valid TForumal, where x=pt"}; + o2::framework::Configurable> dcazMax{"dcazMax", {"0.004 + 0.013*pow(x, -1)"}, "Maximum |dca_z| as a function of pT. Has to be a valid TForumal, where x=pt"}; + + o2::framework::Configurable minMomentumForTof{"minMomentumForTof", 2.0f, "Minimum momentum to required TOF PID (all species)"}; + + // track its pid cuts + o2::framework::Configurable> itsElectron{"itsElectron", {}, "Maximum |nsigma| for electron PID"}; + o2::framework::Configurable> itsPion{"itsPion", {}, "Maximum |nsigma| for pion PID"}; + o2::framework::Configurable> itsKaon{"itsKaon", {}, "Maximum |nsigma| for kaon PID"}; + o2::framework::Configurable> itsProton{"itsProton", {}, "Maximum |nsigma| for proton PID"}; + o2::framework::Configurable> itsDeuteron{"itsDeuteron", {}, "Maximum |nsigma| for deuteron PID"}; + o2::framework::Configurable> itsTriton{"itsTriton", {}, "Maximum |nsigma| for trition PID"}; + o2::framework::Configurable> itsHelium{"itsHelium", {}, "Maximum |nsigma| for helium PID"}; + + // track tpc pid cuts + o2::framework::Configurable> tpcElectron{"tpcElectron", {}, "Maximum |nsigma| for electron PID"}; + o2::framework::Configurable> tpcPion{"tpcPion", {}, "Maximum |nsigma| for pion PID"}; + o2::framework::Configurable> tpcKaon{"tpcKaon", {}, "Maximum |nsigma| for kaon PID"}; + o2::framework::Configurable> tpcProton{"tpcProton", {}, "Maximum |nsigma| for proton PID"}; + o2::framework::Configurable> tpcDeuteron{"tpcDeuteron", {}, "Maximum |nsigma| for deuteron PID"}; + o2::framework::Configurable> tpcTriton{"tpcTriton", {}, "Maximum |nsigma| for trition PID"}; + o2::framework::Configurable> tpcHelium{"tpcHelium", {}, "Maximum |nsigma| for helium PID"}; + + // track tof pid cuts + o2::framework::Configurable> tofElectron{"tofElectron", {}, "Maximum |nsigma| for electron PID"}; + o2::framework::Configurable> tofPion{"tofPion", {}, "Maximum |nsigma| for pion PID"}; + o2::framework::Configurable> tofKaon{"tofKaon", {}, "Maximum |nsigma| for kaon PID"}; + o2::framework::Configurable> tofProton{"tofProton", {}, "Maximum |nsigma| for proton PID"}; + o2::framework::Configurable> tofDeuteron{"tofDeuteron", {}, "Maximum |nsigma| for deuteron PID"}; + o2::framework::Configurable> tofTriton{"tofTriton", {}, "Maximum |nsigma| for trition PID"}; + o2::framework::Configurable> tofHelium{"tofHelium", {}, "Maximum |nsigma| for helium PID"}; + + // track tpcits pid cuts + o2::framework::Configurable> tpcitsElectron{"tpcitsElectron", {}, "Maximum |nsigma| for electron PID"}; + o2::framework::Configurable> tpcitsPion{"tpcitsPion", {}, "Maximum |nsigma| for pion PID"}; + o2::framework::Configurable> tpcitsKaon{"tpcitsKaon", {}, "Maximum |nsigma| for kaon PID"}; + o2::framework::Configurable> tpcitsProton{"tpcitsProton", {3.f}, "Maximum |nsigma| for proton PID"}; + o2::framework::Configurable> tpcitsDeuteron{"tpcitsDeuteron", {}, "Maximum |nsigma| for deuteron PID"}; + o2::framework::Configurable> tpcitsTriton{"tpcitsTriton", {}, "Maximum |nsigma| for trition PID"}; + o2::framework::Configurable> tpcitsHelium{"tpcitsHelium", {}, "Maximum |nsigma| for helium PID"}; + + // track tpctof pid cuts + o2::framework::Configurable> tpctofElectron{"tpctofElectron", {}, "Maximum |nsigma| for electron PID"}; + o2::framework::Configurable> tpctofPion{"tpctofPion", {}, "Maximum |nsigma| for pion PID"}; + o2::framework::Configurable> tpctofKaon{"tpctofKaon", {}, "Maximum |nsigma| for kaon PID"}; + o2::framework::Configurable> tpctofProton{"tpctofProton", {3.f}, "Maximum |nsigma| for proton PID"}; + o2::framework::Configurable> tpctofDeuteron{"tpctofDeuteron", {}, "Maximum |nsigma| for deuteron PID"}; + o2::framework::Configurable> tpctofTriton{"tpctofTriton", {}, "Maximum |nsigma| for trition PID"}; + o2::framework::Configurable> tpctofHelium{"tpctofHelium", {}, "Maximum |nsigma| for helium PID"}; +}; + +// define the template structure for TrackSelection +template +struct ConfTrackSelection : public o2::framework::ConfigurableGroup { + std::string prefix = Prefix; // Unique prefix based on the template argument + // configuration parameters + o2::framework::Configurable pdgCode{"pdgCode", 2212, "Track PDG code"}; + o2::framework::Configurable sign{"sign", 1, "Sign of the track (1 for positive tracks and -1 for negative tracks)"}; + // filters for kinematics + o2::framework::Configurable ptMin{"ptMin", 0.2f, "Minimum pT (GeV/c)"}; + o2::framework::Configurable ptMax{"ptMax", 6.f, "Maximum pT (GeV/c)"}; + o2::framework::Configurable etaMin{"etaMin", -0.9f, "Minimum eta"}; + o2::framework::Configurable etaMax{"etaMax", 0.9f, "Maximum eta"}; + o2::framework::Configurable phiMin{"phiMin", 0.f, "Minimum phi"}; + o2::framework::Configurable phiMax{"phiMax", 1.f * o2::constants::math::TwoPI, "Maximum phi"}; + // track selection masks + o2::framework::Configurable maskLowMomentum{"maskLowMomentum", 2u, "Bitmask for selections below momentum threshold"}; + o2::framework::Configurable maskHighMomentum{"maskHighMomentum", 1u, "Bitmask for selections above momentum threshold"}; + // momentum threshold for PID usage + o2::framework::Configurable pidThres{"pidThres", 1.2f, "Momentum threshold for using TPCTOF/TOF pid for tracks with large momentum (GeV/c)"}; +}; + +// Define unique prefixes as constexpr string literals +constexpr const char PrefixTrackSelection1[] = "TrackSelection1"; +constexpr const char PrefixTrackSelection2[] = "TrackSelection2"; +constexpr const char PrefixTrackSelection3[] = "TrackSelection3"; + +// Instantiate different instances with unique prefixes +using ConfTrackSelection1 = ConfTrackSelection; +using ConfTrackSelection2 = ConfTrackSelection; +using ConfTrackSelection3 = ConfTrackSelection; + +/// enum for all track selections +enum TrackSels { + // track quality cuts + kTPCnClsMin, ///< Min. number of TPC clusters + kTPCcRowsMin, ///< Min. number of crossed TPC rows + kTPCsClsMax, ///< Max. number of shared TPC clusters + kTPCsClsFracMax, ///< Max. fractions of shared TPC clusters + kITSnClsMin, ///< Min. number of ITS clusters + kITSnClsIbMin, ///< Min. number of ITS clusters in the inner barrel + kDCAxyMax, ///< Max. |DCA_xy| (cm) as a function of pT + kDCAzMax, ///< Max. |DCA_z| (cm) as a function of pT + + /// track pid cuts + kItsElectron, ///< ITS Electon PID + kItsPion, ///< ITS Pion PID + kItsKaon, ///< ITS Kaon PID + kItsProton, ///< ITS Proton PID + kItsDeuteron, ///< ITS Deuteron PID + kItsTriton, ///< ITS Triton PID + kItsHelium, ///< ITS He3 PID + + kTpcElectron, ///< TPC Electon PID + kTpcPion, ///< TPC Pion PID + kTpcKaon, ///< TPC Kaon PID + kTpcProton, ///< TPC Proton PID + kTpcDeuteron, ///< TPC Deuteron PID + kTpcTriton, ///< TPC Triton PID + kTpcHelium, ///< TPC He3 PID + + kTofElectron, ///< TOF Electon PID + kTofPion, ///< TOF Pion PID + kTofKaon, ///< TOF Kaon PID + kTofProton, ///< TOF Proton PID + kTofDeuteron, ///< TOF Deuteron PID + kTofTriton, ///< TOF Triton PID + kTofHelium, ///< TOF He3 PID + + kTpcitsElectron, ///< TPC+ITS Electon PID + kTpcitsPion, ///< TPC+ITS Pion PID + kTpcitsKaon, ///< TPC+ITS Kaon PID + kTpcitsProton, ///< TPC+ITS Proton PID + kTpcitsDeuteron, ///< TPC+ITS Deuteron PID + kTpcitsTriton, ///< TPC+ITS Triton PID + kTpcitsHelium, ///< TPC+ITS He3 PID + + kTpctofElectron, ///< TPC+TOF Electon PID + kTpctofPion, ///< TPC+TOF Pion PID + kTpctofKaon, ///< TPC+TOF Kaon PID + kTpctofProton, ///< TPC+TOF Proton PID + kTpctofDeuteron, ///< TPC+TOF Deuteron PID + kTpctofTriton, ///< TPC+TOF Triton PID + kTpctofHelium, ///< TPC+TOF He3 PID + + kTrackSelsMax +}; + +const char trackSelsName[] = "Track Selection Object"; +const std::unordered_map trackSelsToString = { + {kTPCnClsMin, "Min. number of TPC clusters"}, + {kTPCcRowsMin, "Min. number of crossed TPC rows"}, + {kTPCsClsMax, "Max. number of shared TPC clusters"}, + {kTPCsClsFracMax, "Max. fractions of shared TPC clusters"}, + {kITSnClsMin, "Min. number of ITS clusters"}, + {kITSnClsIbMin, "Min. number of ITS clusters in the inner barrel"}, + {kDCAxyMax, "Max. |DCA_xy| (cm) as a function of pT"}, + {kDCAzMax, "Max. |DCA_z| (cm) as a function of pT"}, + + {kItsElectron, "ITS Electron PID"}, + {kItsPion, "ITS Pion PID"}, + {kItsKaon, "ITS Kaon PID"}, + {kItsProton, "ITS Proton PID"}, + {kItsDeuteron, "ITS Deuteron PID"}, + {kItsTriton, "ITS Triton PID"}, + {kItsHelium, "ITS He3 PID"}, + + {kTpcElectron, "TPC Electron PID"}, + {kTpcPion, "TPC Pion PID"}, + {kTpcKaon, "TPC Kaon PID"}, + {kTpcProton, "TPC Proton PID"}, + {kTpcDeuteron, "TPC Deuteron PID"}, + {kTpcTriton, "TPC Triton PID"}, + {kTpcHelium, "TPC He3 PID"}, + + {kTofElectron, "TOF Electron PID"}, + {kTofPion, "TOF Pion PID"}, + {kTofKaon, "TOF Kaon PID"}, + {kTofProton, "TOF Proton PID"}, + {kTofDeuteron, "TOF Deuteron PID"}, + {kTofTriton, "TOF Triton PID"}, + {kTofHelium, "TOF He3 PID"}, + + {kTpcitsElectron, "TPC+ITS Electron PID"}, + {kTpcitsPion, "TPC+ITS Pion PID"}, + {kTpcitsKaon, "TPC+ITS Kaon PID"}, + {kTpcitsProton, "TPC+ITS Proton PID"}, + {kTpcitsDeuteron, "TPC+ITS Deuteron PID"}, + {kTpcitsTriton, "TPC+ITS Triton PID"}, + {kTpcitsHelium, "TPC+ITS He PID"}, + + {kTpctofElectron, "TPC+TOF Electron PID"}, + {kTpctofPion, "TPC+TOF Pion PID"}, + {kTpctofKaon, "TPC+TOF Kaon PID"}, + {kTpctofProton, "TPC+TOF Proton PID"}, + {kTpctofDeuteron, "TPC+TOF Deuteron PID"}, + {kTpctofTriton, "TPC+TOF Triton PID"}, + {kTpctofHelium, "TPC+TOF He3 PID"}}; + +/// \class FemtoDreamTrackCuts +/// \brief Cut class to contain and execute all cuts applied to tracks +class TrackSelection : public BaseSelection +{ + public: + TrackSelection() {} + virtual ~TrackSelection() = default; + + template + void configure(T1& config, T2& filter) + { + mPtMin = filter.ptMin; + mPtMax = filter.ptMax; + mEtaMin = filter.etaMin; + mEtaMax = filter.etaMax; + mPhiMin = filter.phiMin; + mPhiMax = filter.phiMax; + mMinimalMomentumForTof = config.minMomentumForTof.value; + + // add selections for track quality + this->addSelection(config.tpcClustersMin.value, kTPCnClsMin, limits::kLowerLimit, true, true); + this->addSelection(config.tpcCrossedRowsMin.value, kTPCcRowsMin, limits::kLowerLimit, true, true); + this->addSelection(config.tpcSharedClustersMax.value, kTPCsClsMax, limits::kUpperLimit, true, true); + this->addSelection(config.tpcSharedClusterFractionMax.value, kTPCsClsFracMax, limits::kUpperLimit, true, true); + this->addSelection(config.itsClustersMin.value, kITSnClsMin, limits::kLowerLimit, true, true); + this->addSelection(config.itsIbClustersMin.value, kITSnClsIbMin, limits::kLowerLimit, true, true); + this->addSelection(config.dcaxyMax.name, filter.ptMin.value, filter.ptMax.value, config.dcaxyMax.value, kDCAxyMax, limits::kAbsUpperFunctionLimit, true, true); + this->addSelection(config.dcazMax.name, filter.ptMin.value, filter.ptMax.value, config.dcazMax.value, kDCAzMax, limits::kAbsUpperFunctionLimit, true, true); + + // add selections for its pid + this->addSelection(config.itsElectron.value, kItsElectron, limits::kAbsUpperLimit, false, false); + this->addSelection(config.itsPion.value, kItsPion, limits::kAbsUpperLimit, false, false); + this->addSelection(config.itsKaon.value, kItsKaon, limits::kAbsUpperLimit, false, false); + this->addSelection(config.itsProton.value, kItsProton, limits::kAbsUpperLimit, false, false); + this->addSelection(config.itsDeuteron.value, kItsDeuteron, limits::kAbsUpperLimit, false, false); + this->addSelection(config.itsTriton.value, kItsTriton, limits::kAbsUpperLimit, false, false); + this->addSelection(config.itsHelium.value, kItsHelium, limits::kAbsUpperLimit, false, false); + // add selections for tpc pid + this->addSelection(config.tpcElectron.value, kTpcElectron, limits::kAbsUpperLimit, false, false); + this->addSelection(config.tpcPion.value, kTpcPion, limits::kAbsUpperLimit, false, false); + this->addSelection(config.tpcKaon.value, kTpcKaon, limits::kAbsUpperLimit, false, false); + this->addSelection(config.tpcProton.value, kTpcProton, limits::kAbsUpperLimit, false, false); + this->addSelection(config.tpcDeuteron.value, kTpcDeuteron, limits::kAbsUpperLimit, false, false); + this->addSelection(config.tpcTriton.value, kTpcTriton, limits::kAbsUpperLimit, false, false); + this->addSelection(config.tpcHelium.value, kTpcHelium, limits::kAbsUpperLimit, false, false); + // add selections for tof pid + this->addSelection(config.tofElectron.value, kTofElectron, limits::kAbsUpperLimit, false, false); + this->addSelection(config.tofPion.value, kTofPion, limits::kAbsUpperLimit, false, false); + this->addSelection(config.tofKaon.value, kTofKaon, limits::kAbsUpperLimit, false, false); + this->addSelection(config.tofProton.value, kTofProton, limits::kAbsUpperLimit, false, false); + this->addSelection(config.tofDeuteron.value, kTofDeuteron, limits::kAbsUpperLimit, false, false); + this->addSelection(config.tofTriton.value, kTofTriton, limits::kAbsUpperLimit, false, false); + this->addSelection(config.tofHelium.value, kTofHelium, limits::kAbsUpperLimit, false, false); + // add selections for tpcits pid + this->addSelection(config.tpcitsElectron.value, kTpcitsElectron, limits::kUpperLimit, false, false); + this->addSelection(config.tpcitsPion.value, kTpcitsPion, limits::kUpperLimit, false, false); + this->addSelection(config.tpcitsKaon.value, kTpcitsKaon, limits::kUpperLimit, false, false); + this->addSelection(config.tpcitsProton.value, kTpcitsProton, limits::kUpperLimit, false, false); + this->addSelection(config.tpcitsDeuteron.value, kTpcitsDeuteron, limits::kUpperLimit, false, false); + this->addSelection(config.tpcitsTriton.value, kTpcitsTriton, limits::kUpperLimit, false, false); + this->addSelection(config.tpcitsHelium.value, kTpcitsHelium, limits::kUpperLimit, false, false); + // add selections for tpctof pid + this->addSelection(config.tpctofElectron.value, kTpctofElectron, limits::kUpperLimit, false, false); + this->addSelection(config.tpctofPion.value, kTpctofPion, limits::kUpperLimit, false, false); + this->addSelection(config.tpctofKaon.value, kTpctofKaon, limits::kUpperLimit, false, false); + this->addSelection(config.tpctofProton.value, kTpctofProton, limits::kUpperLimit, false, false); + this->addSelection(config.tpctofDeuteron.value, kTpctofDeuteron, limits::kUpperLimit, false, false); + this->addSelection(config.tpctofTriton.value, kTpctofTriton, limits::kUpperLimit, false, false); + this->addSelection(config.tpctofHelium.value, kTpctofHelium, limits::kUpperLimit, false, false); + } + + template + bool hasTofAboveThreshold(T const& track) const + { + // If track momentum exceeds threshold, we require valid TOF info + return !(track.p() > mMinimalMomentumForTof && !track.hasTOF()); + } + + template + bool checkFilters(T const& track) const + { + return ((track.pt() > mPtMin && track.pt() < mPtMax) && + (track.eta() > mEtaMin && track.eta() < mEtaMax) && + (track.phi() > mPhiMin && track.phi() < mPhiMax)); + } + + template + void applySelections(T const& Track) + { + this->reset(); + this->evaluateObservable(kTPCnClsMin, Track.tpcNClsFound()); + this->evaluateObservable(kTPCcRowsMin, Track.tpcNClsCrossedRows()); + this->evaluateObservable(kTPCsClsMax, Track.tpcNClsShared()); + this->evaluateObservable(kTPCsClsFracMax, static_cast(Track.tpcNClsShared()) / static_cast(Track.tpcNClsFound())); + this->evaluateObservable(kITSnClsMin, Track.itsNCls()); + this->evaluateObservable(kITSnClsIbMin, Track.itsNClsInnerBarrel()); + + // evalue bitmask for pt dependent dca cuts + this->updateLimits(kDCAxyMax, Track.pt()); + this->evaluateObservable(kDCAxyMax, Track.dcaXY()); + + this->updateLimits(kDCAzMax, Track.pt()); + this->evaluateObservable(kDCAzMax, Track.dcaZ()); + + // its pid + this->evaluateObservable(kItsElectron, Track.itsNSigmaEl()); + this->evaluateObservable(kItsPion, Track.itsNSigmaPi()); + this->evaluateObservable(kItsKaon, Track.itsNSigmaKa()); + this->evaluateObservable(kItsProton, Track.itsNSigmaPr()); + this->evaluateObservable(kItsDeuteron, Track.itsNSigmaDe()); + this->evaluateObservable(kItsTriton, Track.itsNSigmaTr()); + this->evaluateObservable(kItsHelium, Track.itsNSigmaHe()); + + // tpc pid + this->evaluateObservable(kTpcElectron, Track.tpcNSigmaEl()); + this->evaluateObservable(kTpcPion, Track.tpcNSigmaPi()); + this->evaluateObservable(kTpcKaon, Track.tpcNSigmaKa()); + this->evaluateObservable(kTpcProton, Track.tpcNSigmaPr()); + this->evaluateObservable(kTpcDeuteron, Track.tpcNSigmaDe()); + this->evaluateObservable(kTpctofTriton, Track.tpcNSigmaTr()); + this->evaluateObservable(kTpcHelium, Track.tpcNSigmaHe()); + + // tof pid + this->evaluateObservable(kTofElectron, Track.tofNSigmaEl()); + this->evaluateObservable(kTofPion, Track.tofNSigmaPi()); + this->evaluateObservable(kTofKaon, Track.tofNSigmaKa()); + this->evaluateObservable(kTofProton, Track.tofNSigmaPr()); + this->evaluateObservable(kTofDeuteron, Track.tofNSigmaDe()); + this->evaluateObservable(kTofTriton, Track.tofNSigmaTr()); + this->evaluateObservable(kTofHelium, Track.tofNSigmaHe()); + + // combined tpc + its pid + this->evaluateObservable(kTpcitsElectron, std::hypot(Track.tpcNSigmaEl(), Track.itsNSigmaEl())); + this->evaluateObservable(kTpcitsPion, std::hypot(Track.tpcNSigmaPi(), Track.itsNSigmaPi())); + this->evaluateObservable(kTpcitsKaon, std::hypot(Track.tpcNSigmaKa(), Track.itsNSigmaKa())); + this->evaluateObservable(kTpcitsProton, std::hypot(Track.tpcNSigmaPr(), Track.itsNSigmaPr())); + this->evaluateObservable(kTpcitsDeuteron, std::hypot(Track.tpcNSigmaDe(), Track.itsNSigmaDe())); + this->evaluateObservable(kTpcitsTriton, std::hypot(Track.tpcNSigmaTr(), Track.itsNSigmaTr())); + this->evaluateObservable(kTpcitsHelium, std::hypot(Track.tpcNSigmaHe(), Track.itsNSigmaHe())); + + // combined tpc + tof pid + this->evaluateObservable(kTpctofElectron, std::hypot(Track.tpcNSigmaEl(), Track.tofNSigmaEl())); + this->evaluateObservable(kTpctofPion, std::hypot(Track.tpcNSigmaPi(), Track.tofNSigmaPi())); + this->evaluateObservable(kTpctofKaon, std::hypot(Track.tpcNSigmaKa(), Track.tofNSigmaKa())); + this->evaluateObservable(kTpctofProton, std::hypot(Track.tpcNSigmaPr(), Track.tofNSigmaPr())); + this->evaluateObservable(kTpctofDeuteron, std::hypot(Track.tpcNSigmaDe(), Track.tofNSigmaDe())); + this->evaluateObservable(kTpctofTriton, std::hypot(Track.tpcNSigmaTr(), Track.tofNSigmaTr())); + this->evaluateObservable(kTpctofHelium, std::hypot(Track.tpcNSigmaHe(), Track.tofNSigmaHe())); + + this->assembleBitmask(); + }; + + protected: + float mMinimalMomentumForTof = 2.f; + float mPtMin = 0.f; + float mPtMax = 0.f; + float mEtaMin = -0.9; + float mEtaMax = 0.9; + float mPhiMin = 0; + float mPhiMax = o2::constants::math::TwoPI; +}; + +struct TrackBuilderProducts : o2::framework::ProducesGroup { + o2::framework::Produces producedTracks; + o2::framework::Produces producedTrackMasks; + o2::framework::Produces producedTrackDcas; + o2::framework::Produces producedTrackExtras; + o2::framework::Produces producedElectronPids; + o2::framework::Produces producedPionPids; + o2::framework::Produces producedKaonPids; + o2::framework::Produces producedProtonPids; + o2::framework::Produces producedDeuteronPids; + o2::framework::Produces producedTritonPids; + o2::framework::Produces producedHeliumPids; +}; + +struct ConfTrackTables : o2::framework::ConfigurableGroup { + std::string prefix = std::string("TrackTables"); + o2::framework::Configurable produceTracks{"produceTracks", -1, "Produce Tracks (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceTrackMasks{"produceTrackMasks", -1, "Produce TrackMasks (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceTrackDcas{"produceTrackDcas", -1, "Produce TrackDcas (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceTrackExtras{"produceTrackExtras", -1, "Produce TrackExtras (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceElectronPids{"produceElectronPids", -1, "Produce ElectronPids (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable producePionPids{"producePionPids", -1, "Produce PionPids (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceKaonPids{"produceKaonPids", -1, "Produce KaonPids (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceProtonPids{"produceProtonPids", -1, "Produce ProtonPids (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceDeuteronPids{"produceDeuteronPids", -1, "Produce DeuteronPids (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceTritonPids{"produceTritonPids", -1, "Produce TritonPids (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceHeliumPids{"produceHeliumPids", -1, "Produce HeliumPids (-1: auto; 0 off; 1 on)"}; +}; + +class TrackBuilder +{ + public: + TrackBuilder() {} + virtual ~TrackBuilder() = default; + + template + void init(T1& config, T2& filter, T3& table, T4& initContext) + { + trackSelection.configure(config, filter); + LOG(info) << "Initialize femto track builder..."; + + produceTracks = utils::enableTable("FTracks_001", table.produceTracks.value, initContext); + produceTrackMasks = utils::enableTable("FTrackMasks_001", table.produceTrackMasks.value, initContext); + produceTrackDcas = utils::enableTable("FTrackDcas_001", table.produceTrackDcas.value, initContext); + produceTrackExtras = utils::enableTable("FTrackExtras_001", table.produceTrackExtras.value, initContext); + produceElectronPids = utils::enableTable("FElectronPids_001", table.produceElectronPids.value, initContext); + producePionPids = utils::enableTable("FPionPids_001", table.producePionPids.value, initContext); + produceKaonPids = utils::enableTable("FKaonPids_001", table.produceKaonPids.value, initContext); + produceProtonPids = utils::enableTable("FProtonPids_001", table.produceProtonPids.value, initContext); + produceDeuteronPids = utils::enableTable("FDeuteronPids_001", table.produceDeuteronPids.value, initContext); + produceTritonPids = utils::enableTable("FTritonPids_001", table.produceTritonPids.value, initContext); + produceHeliumPids = utils::enableTable("FHeliumPids_001", table.produceHeliumPids.value, initContext); + + if (produceTracks || produceTrackMasks || produceTrackDcas || produceTrackExtras || produceElectronPids || producePionPids || produceKaonPids || produceProtonPids || produceDeuteronPids || produceTritonPids || produceHeliumPids) { + fillAnyTable = true; + trackSelection.printSelections(trackSelsName, trackSelsToString); + } else { + LOG(info) << "No tables configured"; + } + LOG(info) << "Initialization done..."; + } + + template + void fillTracks(T1 const& tracks, T2& trackProducts, T3& collisionProducts, T4& indexMap) + { + if (!fillAnyTable) { + return; + } + for (const auto& track : tracks) { + if (!trackSelection.checkFilters(track) || !trackSelection.hasTofAboveThreshold(track)) { + continue; + } + trackSelection.applySelections(track); + if (!trackSelection.passesAllRequiredSelections()) { + continue; + } + this->fillTrack(track, trackProducts, collisionProducts, indexMap); + } + } + + template + void fillTrack(T1 const& track, T2& trackProducts, T3& collisionProducts, T4& indexMap) + { + if (produceTracks) { + trackProducts.producedTracks(collisionProducts.producedCollision.lastIndex(), + track.pt() * track.sign(), + track.eta(), + track.phi()); + } + + if (produceTrackMasks) { + if constexpr (type == modes::Track::kPrimaryTrack) { + trackProducts.producedTrackMasks(trackSelection.getBitmask()); + } else { + trackProducts.producedTrackMasks(static_cast(0u)); + } + } + + if (produceTrackDcas) { + trackProducts.producedTrackDcas(track.dcaXY(), track.dcaZ()); + } + if (produceTrackExtras) { + trackProducts.producedTrackExtras(track.isPVContributor(), + track.itsNCls(), + track.itsNClsInnerBarrel(), + track.itsChi2NCl(), + track.itsClusterSizes(), + track.tpcSignal(), + track.tpcInnerParam(), + track.tpcNClsFound(), + track.tpcNClsCrossedRows(), + track.tpcNClsShared(), + track.beta(), + track.mass()); + } + + if (produceElectronPids) { + if constexpr (type == modes::Track::kPrimaryTrack) { + trackProducts.producedElectronPids(track.itsNSigmaEl(), track.tpcNSigmaEl(), track.tofNSigmaEl()); + } else { + trackProducts.producedElectronPids(0, track.tpcNSigmaEl(), track.tofNSigmaEl()); + } + } + if (producePionPids) { + if constexpr (type == modes::Track::kPrimaryTrack) { + trackProducts.producedPionPids(track.itsNSigmaPi(), track.tpcNSigmaPi(), track.tofNSigmaPi()); + } else { + trackProducts.producedPionPids(0, track.tpcNSigmaPi(), track.tofNSigmaPi()); + } + } + if (produceKaonPids) { + if constexpr (type == modes::Track::kPrimaryTrack) { + trackProducts.producedKaonPids(track.itsNSigmaKa(), track.tpcNSigmaKa(), track.tofNSigmaKa()); + } else { + trackProducts.producedKaonPids(0, track.tpcNSigmaKa(), track.tofNSigmaKa()); + } + } + if (produceProtonPids) { + if constexpr (type == modes::Track::kPrimaryTrack) { + trackProducts.producedProtonPids(track.itsNSigmaPr(), track.tpcNSigmaPr(), track.tofNSigmaPr()); + } else { + trackProducts.producedProtonPids(0, track.tpcNSigmaPr(), track.tofNSigmaPr()); + } + } + if (produceDeuteronPids) { + if constexpr (type == modes::Track::kPrimaryTrack) { + trackProducts.producedDeuteronPids(track.itsNSigmaDe(), track.tpcNSigmaDe(), track.tofNSigmaDe()); + } else { + trackProducts.producedDeuteronPids(0, track.tpcNSigmaDe(), track.tofNSigmaDe()); + } + } + if (produceTritonPids) { + if constexpr (type == modes::Track::kPrimaryTrack) { + trackProducts.producedTritonPids(track.itsNSigmaTr(), track.tpcNSigmaTr(), track.tofNSigmaTr()); + } else { + trackProducts.producedTritonPids(0, track.tpcNSigmaTr(), track.tofNSigmaTr()); + } + } + if (produceHeliumPids) { + if constexpr (type == modes::Track::kPrimaryTrack) { + trackProducts.producedHeliumPids(track.itsNSigmaHe(), track.tpcNSigmaHe(), track.tofNSigmaHe()); + } else { + trackProducts.producedHeliumPids(0, track.tpcNSigmaHe(), track.tofNSigmaHe()); + } + } + indexMap.emplace(track.globalIndex(), trackProducts.producedTracks.lastIndex()); + } + + template + int64_t getDaughterIndex(const T1& daughter, T2& trackProducts, T3& collisionProducts, T4& indexMap) + { + auto result = utils::getIndex(daughter.globalIndex(), indexMap); + if (result) { + return result.value(); + } else { + this->fillTrack(daughter, trackProducts, collisionProducts, indexMap); + int64_t idx = trackProducts.producedTracks.lastIndex(); + indexMap.emplace(daughter.globalIndex(), idx); + return idx; + } + } + + private: + TrackSelection trackSelection; + bool fillAnyTable = false; + bool produceTracks = false; + bool produceTrackMasks = false; + bool produceTrackDcas = false; + bool produceTrackExtras = false; + bool produceElectronPids = false; + bool producePionPids = false; + bool produceKaonPids = false; + bool produceProtonPids = false; + bool produceDeuteronPids = false; + bool produceTritonPids = false; + bool produceHeliumPids = false; +}; + +} // namespace trackbuilder +} // namespace o2::analysis::femto + +#endif // PWGCF_FEMTO_CORE_TRACKBUILDER_H_ diff --git a/PWGCF/Femto/Core/trackHistManager.h b/PWGCF/Femto/Core/trackHistManager.h new file mode 100644 index 00000000000..3f22459ac5b --- /dev/null +++ b/PWGCF/Femto/Core/trackHistManager.h @@ -0,0 +1,557 @@ +// Copyright 2019-2025 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 trackHistManager.h +/// \brief histogram manager for track histograms +/// \author Anton Riedel, TU München, anton.riedel@cern.ch + +#ifndef PWGCF_FEMTO_CORE_TRACKHISTMANAGER_H_ +#define PWGCF_FEMTO_CORE_TRACKHISTMANAGER_H_ + +#include "PWGCF/Femto/Core/femtoUtils.h" +#include "PWGCF/Femto/Core/histManager.h" +#include "PWGCF/Femto/Core/modes.h" + +#include "CommonConstants/MathConstants.h" +#include "Framework/Configurable.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/HistogramSpec.h" + +#include +#include +#include +#include +#include + +namespace o2::analysis::femto +{ +namespace trackhistmanager +{ + +// enum for track histograms +enum TrackHist { + // kinemtics + kPt, + kEta, + kPhi, + kSign, + // qa variables + kItsCluster, + kItsClusterIb, + kTpcCrossedRows, + kTpcCluster, + kTpcClusterShared, + kTpcClusterFractionShared, + // kDcaxy, + // kDcaz, + // kDca, + // 2d qa + kPtVsEta, + kPtVsPhi, + kPhiVsEta, + kPtVsItsCluster, + kPtVsTpcCluster, + kPtVsTpcClusterShared, + kTpcClusterVsTpcClusterShared, + kPtVsDcaxy, + kPtVsDcaz, + kPtVsDca, + // its pid + kItsSignal, + kItsElectron, + kItsPion, + kItsKaon, + kItsProton, + kItsDeuteron, + kItsTriton, + kItsHelium, + // tpc pid + kTpcSignal, + kTpcElectron, + kTpcPion, + kTpcKaon, + kTpcProton, + kTpcDeuteron, + kTpcTriton, + kTpcHelium, + // tof pid + kTofBeta, + kTofMass, + kTofElectron, + kTofPion, + kTofKaon, + kTofProton, + kTofDeuteron, + kTofTriton, + kTofHelium, + // tpc+its pid + kTpcitsElectron, + kTpcitsPion, + kTpcitsKaon, + kTpcitsProton, + kTpcitsDeuteron, + kTpcitsTriton, + kTpcitsHelium, + // tpc+tof pid + kTpctofElectron, + kTpctofPion, + kTpctofKaon, + kTpctofProton, + kTpctofDeuteron, + kTpctofTriton, + kTpctofHelium, + kTrackHistLast +}; + +template +struct ConfTrackBinning : o2::framework::ConfigurableGroup { + std::string prefix = Prefix; + o2::framework::ConfigurableAxis pt{"pt", {{600, 0, 6}}, "Pt"}; + o2::framework::ConfigurableAxis eta{"eta", {{300, -1.5, 1.5}}, "Eta"}; + o2::framework::ConfigurableAxis phi{"phi", {{720, 0, 1.f * o2::constants::math::TwoPI}}, "Phi"}; + o2::framework::ConfigurableAxis sign{"sign", {{3, -1.5, 1.5}}, "Sign"}; +}; + +constexpr const char PrefixTrackBinning1[] = "TrackBinning1"; +constexpr const char PrefixTrackBinning2[] = "TrackBinning2"; +constexpr const char PrefixResonancePosDauBinning[] = "ResonancePosDauBinning"; +constexpr const char PrefixResonanceNegDauBinning[] = "ResonanceNegDauBinning"; +constexpr const char PrefixV0PosDauBinning[] = "V0PosDauBinning"; +constexpr const char PrefixV0NegDauBinning[] = "V0NegDauBinning"; +constexpr const char PrefixCascadePosDauBinning[] = "CascadePosDauBinning"; +constexpr const char PrefixCascadeNegDauBinning[] = "CascadeNegDauBinning"; +constexpr const char PrefixCascadeBachelorBinning[] = "CascadeBachelorBinning"; + +using ConfTrackBinning1 = ConfTrackBinning; +using ConfTrackBinning2 = ConfTrackBinning; +using ConfResonancePosDauBinning = ConfTrackBinning; +using ConfResonanceNegDauBinning = ConfTrackBinning; +using ConfV0PosDauBinning = ConfTrackBinning; +using ConfV0NegDauBinning = ConfTrackBinning; +using ConfCascadePosDauBinning = ConfTrackBinning; +using ConfCascadeNegDauBinning = ConfTrackBinning; +using ConfCascadeBachelorBinning = ConfTrackBinning; + +template +struct ConfTrackQaBinning : o2::framework::ConfigurableGroup { + std::string prefix = Prefix; + o2::framework::ConfigurableAxis itsCluster{"itsCluster", {{8, -0.5, 7.5}}, "ITS cluster"}; + o2::framework::ConfigurableAxis itsClusterIb{"itsClusterIb", {{4, -0.5, 3.5}}, "ITS cluster in inner barrel"}; + o2::framework::ConfigurableAxis tpcCrossedRows{"tpcCrossedRows", {{161, -0.5, 160.5}}, "TPC cluster"}; + o2::framework::ConfigurableAxis tpcCluster{"tpcCluster", {{161, -0.5, 160.5}}, "TPC cluster"}; + o2::framework::ConfigurableAxis tpcClusterShared{"tpcClusterShared", {{161, -0.5, 160.5}}, "TPC cluster shared"}; + o2::framework::ConfigurableAxis tpcClusterFractionShared{"tpcClusterFractionShared", {{60, 0, 1.2}}, "TPC cluster fraction shared"}; + o2::framework::ConfigurableAxis dcaXy{"dcaXy", {{300, -0.3, 0.3}}, "DCA_xy"}; + o2::framework::ConfigurableAxis dcaZ{"dcaZ", {{300, -0.3, 0.3}}, "DCA_Z"}; + o2::framework::ConfigurableAxis dca{"dca", {{300, 0, 0.3}}, "DCA"}; + o2::framework::ConfigurableAxis p{"p", {{300, 0, 6}}, "Momentum axis"}; + o2::framework::ConfigurableAxis itsSignal{"itsSignal", {{150, 0, 15}}, "ITS Signal"}; + o2::framework::ConfigurableAxis itsElectron{"itsElectron", {{300, -3, 3}}, "ITS PID for electron"}; + o2::framework::ConfigurableAxis itsPion{"itsPion", {{300, -3, 3}}, "ITS PID for pion"}; + o2::framework::ConfigurableAxis itsKaon{"itsKaon", {{300, -3, 3}}, "ITS PID for kaon"}; + o2::framework::ConfigurableAxis itsProton{"itsProton", {{300, -3, 3}}, "ITS PID for proton"}; + o2::framework::ConfigurableAxis itsDeuteron{"itsDeuteron", {{300, -3, 3}}, "ITS PID for deuteron"}; + o2::framework::ConfigurableAxis itsTriton{"itsTriton", {{300, -3, 3}}, "ITS PID for triton"}; + o2::framework::ConfigurableAxis itsHelium{"itsHelium", {{300, -3, 3}}, "ITS PID for helium"}; + o2::framework::ConfigurableAxis tpcSignal{"tpcSignal", {{150, 0, 150}}, "TPC Signal"}; + o2::framework::ConfigurableAxis tpcElectron{"tpcElectron", {{300, -3, 3}}, "TPC PID for electron"}; + o2::framework::ConfigurableAxis tpcPion{"tpcPion", {{300, -3, 3}}, "TPC PID for pion"}; + o2::framework::ConfigurableAxis tpcKaon{"tpcKaon", {{300, -3, 3}}, "TPC PID for kaon"}; + o2::framework::ConfigurableAxis tpcProton{"tpcProton", {{300, -3, 3}}, "TPC PID for proton"}; + o2::framework::ConfigurableAxis tpcDeuteron{"tpcDeuteron", {{300, -3, 3}}, "TPC PID for deuteron"}; + o2::framework::ConfigurableAxis tpcTriton{"tpcTriton", {{300, -3, 3}}, "TPC PID for triton"}; + o2::framework::ConfigurableAxis tpcHelium{"tpcHelium", {{300, -3, 3}}, "TPC PID for helium"}; + o2::framework::ConfigurableAxis tofBeta{"tofBeta", {{150, 0, 1.5}}, "TOF Signal"}; + o2::framework::ConfigurableAxis tofMass{"tofMass", {{150, 0, 1.5}}, "TOF Mass"}; + o2::framework::ConfigurableAxis tofElectron{"tofElectron", {{300, -3, 3}}, "TOF PID for electron"}; + o2::framework::ConfigurableAxis tofPion{"tofPion", {{300, -3, 3}}, "TOF PID for pion"}; + o2::framework::ConfigurableAxis tofKaon{"tofKaon", {{300, -3, 3}}, "TOF PID for kaon"}; + o2::framework::ConfigurableAxis tofProton{"tofProton", {{300, -3, 3}}, "TOF PID for proton"}; + o2::framework::ConfigurableAxis tofDeuteron{"tofDeuteron", {{300, -3, 3}}, "TOF PID for deuteron"}; + o2::framework::ConfigurableAxis tofTriton{"tofTriton", {{300, -3, 3}}, "TOF PID for triton"}; + o2::framework::ConfigurableAxis tofHelium{"tofHelium", {{300, -3, 3}}, "TOF PID for helium"}; + o2::framework::ConfigurableAxis tpcitsElectron{"tpcitsElectron", {{300, 0, 3}}, "tpcits PID for electron"}; + o2::framework::ConfigurableAxis tpcitsPion{"tpcitsPion", {{300, 0, 3}}, "TPCITS PID for pion"}; + o2::framework::ConfigurableAxis tpcitsKaon{"tpcitsKaon", {{300, 0, 3}}, "TPCITS PID for kaon"}; + o2::framework::ConfigurableAxis tpcitsProton{"tpcitsProton", {{300, 0, 3}}, "TPCITS PID for proton"}; + o2::framework::ConfigurableAxis tpcitsDeuteron{"tpcitsDeuteron", {{300, 0, 3}}, "TPCITS PID for deuteron"}; + o2::framework::ConfigurableAxis tpcitsTriton{"tpcitsTriton", {{300, 0, 3}}, "TPCITS PID for triton"}; + o2::framework::ConfigurableAxis tpcitsHelium{"tpcitsHelium", {{300, 0, 3}}, "TPCITS PID for helium"}; + o2::framework::ConfigurableAxis tpctofElectron{"tpctofElectron", {{300, 0, 3}}, "TPCTOF PID for electron"}; + o2::framework::ConfigurableAxis tpctofPion{"tpctofPion", {{300, 0, 3}}, "TPCTOF PID for pion"}; + o2::framework::ConfigurableAxis tpctofKaon{"tpctofKaon", {{300, 0, 3}}, "TPCTOF PID for kaon"}; + o2::framework::ConfigurableAxis tpctofProton{"tpctofProton", {{300, 0, 3}}, "TPCTOF PID for proton"}; + o2::framework::ConfigurableAxis tpctofDeuteron{"tpctofDeuteron", {{300, 0, 3}}, "TPCTOF PID for deuteron"}; + o2::framework::ConfigurableAxis tpctofTriton{"tpctofTriton", {{300, 0, 3}}, "TPCTOF PID for triton"}; + o2::framework::ConfigurableAxis tpctofHelium{"tpctofHelium", {{300, 0, 3}}, "TPCTOF PID for helium"}; +}; + +constexpr const char PrefixTrackQaBinning1[] = "TrackQaBinning1"; +constexpr const char PrefixTrackQaBinning2[] = "TrackQaBinning1"; +constexpr const char PrefixResonancePosDauQaBinning[] = "ResonancePosDauQaBinning"; +constexpr const char PrefixResonanceNegDauQaBinning[] = "ResonanceNegDauQaBinning"; +constexpr const char PrefixV0PosDauQaBinning[] = "V0PosDauQaBinning"; +constexpr const char PrefixV0NegDauQaBinning[] = "V0NegDauQaBinning"; +constexpr const char PrefixCascadePosDauQaBinning[] = "CascadePosDauQaBinning"; +constexpr const char PrefixCascadeNegDauQaBinning[] = "CascadeNegDauQaBinning"; +constexpr const char PrefixCascadeBachelorQaBinning[] = "CascadeBachelorQaBinning"; + +using ConfTrackQaBinning1 = ConfTrackQaBinning; +using ConfTrackQaBinning2 = ConfTrackQaBinning; +using ConfResonancePosDauQaBinning = ConfTrackQaBinning; +using ConfResonanceNegDauQaBinning = ConfTrackQaBinning; +using ConfV0PosDauQaBinning = ConfTrackQaBinning; +using ConfV0NegDauQaBinning = ConfTrackQaBinning; +using ConfCascadePosDauQaBinning = ConfTrackQaBinning; +using ConfCascadeNegDauQaBinning = ConfTrackQaBinning; +using ConfCascadeBachelorQaBinning = ConfTrackQaBinning; + +// must be in sync with enum TrackVariables +// the enum gives the correct index in the array +constexpr std::array, kTrackHistLast> HistTable = { + {{kPt, o2::framework::kTH1F, "hPt", "Transverse Momentum; p_{T} (GeV/#it{c}); Entries"}, + {kEta, o2::framework::kTH1F, "hEta", "Pseudorapdity; #eta; Entries"}, + {kPhi, o2::framework::kTH1F, "hPhi", "Azimuthal angle; #varphi; Entries"}, + {kSign, o2::framework::kTH1F, "hSign", "Sign of charge ; Sign; Entries"}, + {kItsCluster, o2::framework::kTH1F, "hItsCluster", "ITS cluster; ITS cluster; Entries"}, + {kItsClusterIb, o2::framework::kTH1F, "hItsClusterIb", "ITS cluster in inner barrel; ITS IB cluster; Entries"}, + {kTpcCrossedRows, o2::framework::kTH1F, "hTpcCrossedRows", "TPC crossed rows; TPC crossed rows; Entries"}, + {kTpcCluster, o2::framework::kTH1F, "hTpcCluster", "TPC cluster found; TPC cluster found; Entries"}, + {kTpcClusterShared, o2::framework::kTH1F, "hTpcClusterShared", "TPC cluster shared; TPC cluster shared ; Entries"}, + {kTpcClusterFractionShared, o2::framework::kTH1F, "hTpcClusterFractionShared", "TPC cluster fraction shared; TPC cluster found / TPC cluster shared ; Entries"}, + {kPtVsEta, o2::framework::kTH2F, "hPtVsEta", "p_{T} vs #eta; p_{T} (GeV/#it{c}) ; #eta"}, + {kPtVsPhi, o2::framework::kTH2F, "hPtVsPhi", "p_{T} vs #varphi; p_{T} (GeV/#it{c}) ; #varphi"}, + {kPhiVsEta, o2::framework::kTH2F, "hPhiVsEta", "#varphi vs #eta; #varphi ; #eta"}, + {kPtVsItsCluster, o2::framework::kTH2F, "hPtVsItsCluster", "p_{T} vs ITS cluster; p_{T} (GeV/#it{c}) ; ITS cluster"}, + {kPtVsTpcCluster, o2::framework::kTH2F, "hPtVsTpcCluster", "p_{T} vs TPC cluster found; p_{T} (GeV/#it{c}) ; TPC cluster found"}, + {kPtVsTpcClusterShared, o2::framework::kTH2F, "hPtVsTpcClusterShared", "p_{T} vs TPC cluster shared; p_{T} (GeV/#it{c}) ; TPC cluster shared"}, + {kTpcClusterVsTpcClusterShared, o2::framework::kTH2F, "hTpcClusterVsTpcClusterShared", "TPC cluster found vs TPC cluster shared; TPC cluster found; TPC cluster shared"}, + {kPtVsDcaxy, o2::framework::kTH2F, "hPtVsDcaxy", "p_{T} vs DCA_{XY}; p_{T} (GeV/#it{c}); DCA_{XY} (cm)"}, + {kPtVsDcaz, o2::framework::kTH2F, "hPtVsDcaz", "p_{T} vs DCA_{Z}; p_{T} (GeV/#it{c}); DCA_{Z} (cm)"}, + {kPtVsDca, o2::framework::kTH2F, "hPtVsDca", "p_{T} vs DCA; p_{T} (GeV/#it{c}); DCA (cm)"}, + {kItsSignal, o2::framework::kTH2F, "hItsSignal", "ITS Signal; p (GeV/#it{c}) ; x "}, + {kItsElectron, o2::framework::kTH2F, "hItsPidElectron", "TPC PID Electron; p (GeV/#it{c}) ; n#sigma_{TPC,el}"}, + {kItsPion, o2::framework::kTH2F, "hItsPidPion", "ITS PID Pion; p (GeV/#it{c}) ; n#sigma_{ITS,pi}"}, + {kItsKaon, o2::framework::kTH2F, "hItsPidKaon", "ITS PID Kaon; p (GeV/#it{c}) ; n#sigma_{ITS,ka}"}, + {kItsProton, o2::framework::kTH2F, "hItsPidProton", "ITS PID Proton; p (GeV/#it{c}) ; n#sigma_{ITS,pr}"}, + {kItsDeuteron, o2::framework::kTH2F, "hItsPidDeuteron", "ITS PID Deuteron; p (GeV/#it{c}) ; n#sigma_{ITS,de}"}, + {kItsTriton, o2::framework::kTH2F, "hItsPidTriton", "ITS PID Triton; p (GeV/#it{c}) ; n#sigma_{ITS,tr}"}, + {kItsHelium, o2::framework::kTH2F, "hItsPidHelium", "ITS PID Helium; p (GeV/#it{c}) ; n#sigma_{ITS,he}"}, + {kTpcSignal, o2::framework::kTH2F, "hTpcSignal", "TPC Signal; p (GeV/#it{c}) ; TPC Signal"}, + {kTpcElectron, o2::framework::kTH2F, "hTpcPidElectron", "TPC PID Electron; p (GeV/#it{c}) ; n#sigma_{TPC,el}"}, + {kTpcPion, o2::framework::kTH2F, "hTpcPidPion", "TPC PID Pion; p (GeV/#it{c}) ; n#sigma_{TPC,pi}"}, + {kTpcKaon, o2::framework::kTH2F, "hTpcPidKaon", "TPC PID Kaon; p (GeV/#it{c}) ; n#sigma_{TPC,ka}"}, + {kTpcProton, o2::framework::kTH2F, "hTpcPidProton", "TPC PID Proton; p (GeV/#it{c}) ; n#sigma_{TPC,pr}"}, + {kTpcDeuteron, o2::framework::kTH2F, "hTpcPidDeuteron", "TPC PID Deuteron; p (GeV/#it{c}) ; n#sigma_{TPC,de}"}, + {kTpcTriton, o2::framework::kTH2F, "hTpcPidTriton", "TPC PID Triton; p (GeV/#it{c}) ; n#sigma_{TPC,tr}"}, + {kTpcHelium, o2::framework::kTH2F, "hTpcPidHelium", "TPC PID Helium; p (GeV/#it{c}) ; n#sigma_{TPC,he}"}, + {kTofBeta, o2::framework::kTH2F, "hTofBeta", "TOF #beta; p (GeV/#it{c}) ; TOF #beta"}, + {kTofMass, o2::framework::kTH2F, "hTofMass", "TOF mass; p (GeV/#it{c}) ; m_{TOF} (GeV/#it{c}^{2})"}, + {kTofElectron, o2::framework::kTH2F, "hTofPidElectron", "TOF PID Electron; p (GeV/#it{c}) ; n#sigma_{TOF,el}"}, + {kTofPion, o2::framework::kTH2F, "hTofPidPion", "TOF PID Pion; p (GeV/#it{c}) ; n#sigma_{TOF,pi}"}, + {kTofKaon, o2::framework::kTH2F, "hTofPidKaon", "TOF PID Kaon; p (GeV/#it{c}) ; n#sigma_{TOF,ka}"}, + {kTofProton, o2::framework::kTH2F, "hTofPidProton", "TOF PID Proton; p (GeV/#it{c}) ; n#sigma_{TOF,pr}"}, + {kTofDeuteron, o2::framework::kTH2F, "hTofPidDeuteron", "TOF PID Deuteron; p (GeV/#it{c}) ; n#sigma_{TOF,de}"}, + {kTofTriton, o2::framework::kTH2F, "hTofPidTriton", "TOF PID Triton; p (GeV/#it{c}) ; n#sigma_{TOF,tr}"}, + {kTofHelium, o2::framework::kTH2F, "hTofPidHelium", "TOF PID Helium; p (GeV/#it{c}) ; n#sigma_{TOF,he}"}, + {kTpcitsElectron, o2::framework::kTH2F, "hTpcitsPidElectron", "its PID Electron; p (GeV/#it{c}) ; n#sigma_{its,el}"}, + {kTpcitsPion, o2::framework::kTH2F, "hTpcitsPidPion", "TPC+ITS PID Pion; p (GeV/#it{c}) ; #sqrt{n#sigma_{TPC,pi}^{2}+n#sigma_{its,pi}^{2}}"}, + {kTpcitsKaon, o2::framework::kTH2F, "hTpcitsPidKaon", "TPC+ITS PID Kaon; p (GeV/#it{c}) ; #sqrt{n#sigma_{TPC,ka}^{2}+n#sigma_{its,ka}^{2}}"}, + {kTpcitsProton, o2::framework::kTH2F, "hTpcitsPidProton", "TPC+ITS PID Proton; p (GeV/#it{c}) ; #sqrt{n#sigma_{TPC,pr}^{2}+n#sigma_{its,pr}^{2}}"}, + {kTpcitsDeuteron, o2::framework::kTH2F, "hTpcitsPidDeuteron", "TPC+ITS PID Deuteron; p (GeV/#it{c}) ; #sqrt{n#sigma_{TPC,de}^{2}+n#sigma_{its,de}^{2}}"}, + {kTpcitsTriton, o2::framework::kTH2F, "hTpcitsPidTriton", "TPC+ITS PID Triton; p (GeV/#it{c}) ; #sqrt{n#sigma_{TPC,tr}^{2}+n#sigma_{its,tr}^{2}}"}, + {kTpcitsHelium, o2::framework::kTH2F, "hTpcitsPidHelium", "TPC+ITS PID Helium; p (GeV/#it{c}) ; #sqrt{n#sigma_{TPC,he}^{2}+n#sigma_{its,he}^{2}}"}, + {kTpctofElectron, o2::framework::kTH2F, "hTpctofPidElectron", "TOF PID Electron; p (GeV/#it{c}) ; n#sigma_{TOF,el}"}, + {kTpctofPion, o2::framework::kTH2F, "hTpctofPidPion", "TPC+TOF PID Pion; p (GeV/#it{c}) ; #sqrt{n#sigma_{TPC,pi}^{2}+n#sigma_{TOF,pi}^{2}}"}, + {kTpctofKaon, o2::framework::kTH2F, "hTpctofPidKaon", "TPC+TOF PID Kaon; p (GeV/#it{c}) ; #sqrt{n#sigma_{TPC,ka}^{2}+n#sigma_{TOF,ka}^{2}}"}, + {kTpctofProton, o2::framework::kTH2F, "hTpctofPidProton", "TPC+TOF PID Proton; p (GeV/#it{c}) ; #sqrt{n#sigma_{TPC,pr}^{2}+n#sigma_{TOF,pr}^{2}}"}, + {kTpctofDeuteron, o2::framework::kTH2F, "hTpctofPidDeuteron", "TPC+TOF PID Deuteron; p (GeV/#it{c}) ; #sqrt{n#sigma_{TPC,de}^{2}+n#sigma_{TOF,de}^{2}}"}, + {kTpctofTriton, o2::framework::kTH2F, "hTpctofPidTriton", "TPC+TOF PID Triton; p (GeV/#it{c}) ; #sqrt{n#sigma_{TPC,tr}^{2}+n#sigma_{TOF,tr}^{2}}"}, + {kTpctofHelium, o2::framework::kTH2F, "hTpctofPidHelium", "TPC+TOF PID Helium; p (GeV/#it{c}) ; #sqrt{n#sigma_{TPC,he}^{2}+n#sigma_{TOF,he}^{2}}"}}}; + +template +auto makeTrackHistSpecMap(const T& confBinningAnalysis) +{ + return std::map>{ + {kPt, {confBinningAnalysis.pt}}, + {kEta, {confBinningAnalysis.eta}}, + {kPhi, {confBinningAnalysis.phi}}, + {kSign, {confBinningAnalysis.sign}}}; +}; + +template +auto makeTrackQaHistSpecMap(const T1& confBinningAnalysis, const T2 confiBinningQa) +{ + return std::map>{ + {kPt, {confBinningAnalysis.pt}}, + {kEta, {confBinningAnalysis.eta}}, + {kPhi, {confBinningAnalysis.phi}}, + {kSign, {confBinningAnalysis.sign}}, + {kItsCluster, {confiBinningQa.itsCluster}}, + {kItsClusterIb, {confiBinningQa.itsClusterIb}}, + {kPtVsEta, {confBinningAnalysis.pt, confBinningAnalysis.eta}}, + {kPtVsPhi, {confBinningAnalysis.pt, confBinningAnalysis.phi}}, + {kPhiVsEta, {confBinningAnalysis.phi, confBinningAnalysis.eta}}, + {kPtVsItsCluster, {confBinningAnalysis.pt, confiBinningQa.itsCluster}}, + {kPtVsTpcCluster, {confBinningAnalysis.pt, confiBinningQa.tpcCluster}}, + {kPtVsTpcClusterShared, {confBinningAnalysis.pt, confiBinningQa.tpcClusterShared}}, + {kTpcClusterVsTpcClusterShared, {confiBinningQa.tpcCluster, confiBinningQa.tpcClusterShared}}, + {kTpcCrossedRows, {confiBinningQa.tpcCrossedRows}}, + {kTpcCluster, {confiBinningQa.tpcCluster}}, + {kTpcClusterShared, {confiBinningQa.tpcClusterShared}}, + {kTpcClusterFractionShared, {confiBinningQa.tpcClusterFractionShared}}, + {kPtVsDcaxy, {confBinningAnalysis.pt, confiBinningQa.dcaXy}}, + {kPtVsDcaz, {confBinningAnalysis.pt, confiBinningQa.dcaZ}}, + {kPtVsDca, {confBinningAnalysis.pt, confiBinningQa.dca}}, + {kItsSignal, {confiBinningQa.p, confiBinningQa.itsSignal}}, + {kItsElectron, {confiBinningQa.p, confiBinningQa.itsElectron}}, + {kItsPion, {confiBinningQa.p, confiBinningQa.itsPion}}, + {kItsKaon, {confiBinningQa.p, confiBinningQa.itsKaon}}, + {kItsProton, {confiBinningQa.p, confiBinningQa.itsProton}}, + {kItsDeuteron, {confiBinningQa.p, confiBinningQa.itsDeuteron}}, + {kItsTriton, {confiBinningQa.p, confiBinningQa.itsTriton}}, + {kItsHelium, {confiBinningQa.p, confiBinningQa.itsHelium}}, + {kTpcSignal, {confiBinningQa.p, confiBinningQa.tpcSignal}}, + {kTpcElectron, {confiBinningQa.p, confiBinningQa.tpcElectron}}, + {kTpcPion, {confiBinningQa.p, confiBinningQa.tpcPion}}, + {kTpcKaon, {confiBinningQa.p, confiBinningQa.tpcKaon}}, + {kTpcProton, {confiBinningQa.p, confiBinningQa.tpcProton}}, + {kTpcDeuteron, {confiBinningQa.p, confiBinningQa.tpcDeuteron}}, + {kTpcTriton, {confiBinningQa.p, confiBinningQa.tpcTriton}}, + {kTpcHelium, {confiBinningQa.p, confiBinningQa.tpcHelium}}, + {kTofBeta, {confiBinningQa.p, confiBinningQa.tofBeta}}, + {kTofMass, {confiBinningQa.p, confiBinningQa.tofMass}}, + {kTofElectron, {confiBinningQa.p, confiBinningQa.tofElectron}}, + {kTofPion, {confiBinningQa.p, confiBinningQa.tofPion}}, + {kTofKaon, {confiBinningQa.p, confiBinningQa.tofKaon}}, + {kTofProton, {confiBinningQa.p, confiBinningQa.tofProton}}, + {kTofDeuteron, {confiBinningQa.p, confiBinningQa.tofDeuteron}}, + {kTofTriton, {confiBinningQa.p, confiBinningQa.tofTriton}}, + {kTofHelium, {confiBinningQa.p, confiBinningQa.tofHelium}}, + {kTpcitsElectron, {confiBinningQa.p, confiBinningQa.tpcitsElectron}}, + {kTpcitsPion, {confiBinningQa.p, confiBinningQa.tpcitsPion}}, + {kTpcitsKaon, {confiBinningQa.p, confiBinningQa.tpcitsKaon}}, + {kTpcitsProton, {confiBinningQa.p, confiBinningQa.tpcitsProton}}, + {kTpcitsDeuteron, {confiBinningQa.p, confiBinningQa.tpcitsDeuteron}}, + {kTpcitsTriton, {confiBinningQa.p, confiBinningQa.tpcitsTriton}}, + {kTpcitsHelium, {confiBinningQa.p, confiBinningQa.tpcitsHelium}}, + {kTpctofElectron, {confiBinningQa.p, confiBinningQa.tpctofElectron}}, + {kTpctofPion, {confiBinningQa.p, confiBinningQa.tpctofPion}}, + {kTpctofKaon, {confiBinningQa.p, confiBinningQa.tpctofKaon}}, + {kTpctofProton, {confiBinningQa.p, confiBinningQa.tpctofProton}}, + {kTpctofDeuteron, {confiBinningQa.p, confiBinningQa.tpctofDeuteron}}, + {kTpctofTriton, {confiBinningQa.p, confiBinningQa.tpctofTriton}}, + {kTpctofHelium, {confiBinningQa.p, confiBinningQa.tpctofHelium}}}; +}; + +constexpr char PrefixTrackQa[] = "TrackQA/"; +constexpr char PrefixTrack1[] = "Track1/"; +constexpr char PrefixTrack2[] = "Track2/"; +constexpr char PrefixTrack3[] = "Track3/"; + +constexpr char PrefixResonancePosDaughter[] = "ResonancePosDau/"; +constexpr char PrefixResonanceNegDaughter[] = "ResonanceNegDau/"; +constexpr char PrefixResonancePosDaughterQa[] = "ResonancePosDauQa/"; +constexpr char PrefixResonanceNegDaughterQa[] = "ResonanceNegDauQa/"; + +constexpr char PrefixV0PosDaughter[] = "V0PosDau/"; +constexpr char PrefixV0NegDaughter[] = "V0NegDau/"; +constexpr char PrefixV0PosDaughterQa[] = "V0PosDauQa/"; +constexpr char PrefixV0NegDaughterQa[] = "V0NegDauQa/"; + +constexpr char PrefixCascadePosDaughter[] = "CascadePosDau/"; +constexpr char PrefixCascadeNegDaughter[] = "CascadeNegDau/"; +constexpr char PrefixCascadeBachelor[] = "CascadeBachelor/"; +constexpr char PrefixCascadePosDaughterQa[] = "CascadePosDauQa/"; +constexpr char PrefixCascadeNegDaughterQa[] = "CascadeNegDauQa/"; +constexpr char PrefixCascadeBachelorQa[] = "CascadeBachelorQa/"; + +constexpr std::string_view AnalysisDir = "Kinematics/"; +constexpr std::string_view QaDir = "QA/"; +constexpr std::string_view PidDir = "PID/"; + +/// \class FemtoDreamEventHisto +/// \brief Class for histogramming event properties +// template +template +class TrackHistManager +{ + public: + /// Destructor + virtual ~TrackHistManager() = default; + + void init(o2::framework::HistogramRegistry* registry, std::map> Specs) + { + mHistogramRegistry = registry; + + if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { + std::string analysisDir = std::string(prefix) + std::string(AnalysisDir); + + mHistogramRegistry->add(analysisDir + GetHistNamev2(kPt, HistTable), GetHistDesc(kPt, HistTable), GetHistType(kPt, HistTable), {Specs[kPt]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kEta, HistTable), GetHistDesc(kEta, HistTable), GetHistType(kEta, HistTable), {Specs[kEta]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kPhi, HistTable), GetHistDesc(kPhi, HistTable), GetHistType(kPhi, HistTable), {Specs[kPhi]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kSign, HistTable), GetHistDesc(kSign, HistTable), GetHistType(kSign, HistTable), {Specs[kSign]}); + } + + if constexpr (isFlagSet(mode, modes::Mode::kQa)) { + std::string qaDir = std::string(prefix) + std::string(QaDir); + + mHistogramRegistry->add(qaDir + GetHistNamev2(kItsCluster, HistTable), GetHistDesc(kItsCluster, HistTable), GetHistType(kItsCluster, HistTable), {Specs[kItsCluster]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kItsClusterIb, HistTable), GetHistDesc(kItsClusterIb, HistTable), GetHistType(kItsClusterIb, HistTable), {Specs[kItsClusterIb]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kTpcCrossedRows, HistTable), GetHistDesc(kTpcCrossedRows, HistTable), GetHistType(kTpcCrossedRows, HistTable), {Specs[kTpcCrossedRows]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kTpcCluster, HistTable), GetHistDesc(kTpcCluster, HistTable), GetHistType(kTpcCluster, HistTable), {Specs[kTpcCluster]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kTpcClusterShared, HistTable), GetHistDesc(kTpcClusterShared, HistTable), GetHistType(kTpcClusterShared, HistTable), {Specs[kTpcClusterShared]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kTpcClusterFractionShared, HistTable), GetHistDesc(kTpcClusterFractionShared, HistTable), GetHistType(kTpcClusterFractionShared, HistTable), {Specs[kTpcClusterFractionShared]}); + + // qa 2d + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsEta, HistTable), GetHistDesc(kPtVsEta, HistTable), GetHistType(kPtVsEta, HistTable), {Specs[kPtVsEta]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsPhi, HistTable), GetHistDesc(kPtVsPhi, HistTable), GetHistType(kPtVsPhi, HistTable), {Specs[kPtVsPhi]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPhiVsEta, HistTable), GetHistDesc(kPhiVsEta, HistTable), GetHistType(kPhiVsEta, HistTable), {Specs[kPhiVsEta]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsItsCluster, HistTable), GetHistDesc(kPtVsItsCluster, HistTable), GetHistType(kPtVsItsCluster, HistTable), {Specs[kPtVsItsCluster]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsTpcCluster, HistTable), GetHistDesc(kPtVsTpcCluster, HistTable), GetHistType(kPtVsTpcCluster, HistTable), {Specs[kPtVsTpcCluster]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsTpcClusterShared, HistTable), GetHistDesc(kPtVsTpcClusterShared, HistTable), GetHistType(kPtVsTpcClusterShared, HistTable), {Specs[kPtVsTpcClusterShared]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kTpcClusterVsTpcClusterShared, HistTable), GetHistDesc(kTpcClusterVsTpcClusterShared, HistTable), GetHistType(kTpcClusterVsTpcClusterShared, HistTable), {Specs[kTpcClusterVsTpcClusterShared]}); + + // dca + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsDcaxy, HistTable), GetHistDesc(kPtVsDcaxy, HistTable), GetHistType(kPtVsDcaxy, HistTable), {Specs[kPtVsDcaxy]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsDcaz, HistTable), GetHistDesc(kPtVsDcaz, HistTable), GetHistType(kPtVsDcaz, HistTable), {Specs[kPtVsDcaz]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsDca, HistTable), GetHistDesc(kPtVsDca, HistTable), GetHistType(kPtVsDca, HistTable), {Specs[kPtVsDca]}); + + std::string pidDir = std::string(prefix) + std::string(PidDir); + + mHistogramRegistry->add(pidDir + GetHistNamev2(kItsSignal, HistTable), GetHistDesc(kItsSignal, HistTable), GetHistType(kItsSignal, HistTable), {Specs[kItsSignal]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kItsElectron, HistTable), GetHistDesc(kItsElectron, HistTable), GetHistType(kItsElectron, HistTable), {Specs[kItsElectron]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kItsPion, HistTable), GetHistDesc(kItsPion, HistTable), GetHistType(kItsPion, HistTable), {Specs[kItsPion]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kItsKaon, HistTable), GetHistDesc(kItsKaon, HistTable), GetHistType(kItsKaon, HistTable), {Specs[kItsKaon]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kItsProton, HistTable), GetHistDesc(kItsProton, HistTable), GetHistType(kItsProton, HistTable), {Specs[kItsProton]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kItsDeuteron, HistTable), GetHistDesc(kItsDeuteron, HistTable), GetHistType(kItsDeuteron, HistTable), {Specs[kItsDeuteron]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kItsTriton, HistTable), GetHistDesc(kItsTriton, HistTable), GetHistType(kItsTriton, HistTable), {Specs[kItsTriton]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kItsHelium, HistTable), GetHistDesc(kItsHelium, HistTable), GetHistType(kItsHelium, HistTable), {Specs[kItsHelium]}); + + mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcSignal, HistTable), GetHistDesc(kTpcSignal, HistTable), GetHistType(kTpcSignal, HistTable), {Specs[kTpcSignal]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcElectron, HistTable), GetHistDesc(kTpcElectron, HistTable), GetHistType(kTpcElectron, HistTable), {Specs[kTpcElectron]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcPion, HistTable), GetHistDesc(kTpcPion, HistTable), GetHistType(kTpcPion, HistTable), {Specs[kTpcPion]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcKaon, HistTable), GetHistDesc(kTpcKaon, HistTable), GetHistType(kTpcKaon, HistTable), {Specs[kTpcKaon]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcProton, HistTable), GetHistDesc(kTpcProton, HistTable), GetHistType(kTpcProton, HistTable), {Specs[kTpcProton]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcDeuteron, HistTable), GetHistDesc(kTpcDeuteron, HistTable), GetHistType(kTpcDeuteron, HistTable), {Specs[kTpcDeuteron]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcTriton, HistTable), GetHistDesc(kTpcTriton, HistTable), GetHistType(kTpcTriton, HistTable), {Specs[kTpcTriton]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcHelium, HistTable), GetHistDesc(kTpcHelium, HistTable), GetHistType(kTpcHelium, HistTable), {Specs[kTpcHelium]}); + + mHistogramRegistry->add(pidDir + GetHistNamev2(kTofBeta, HistTable), GetHistDesc(kTofBeta, HistTable), GetHistType(kTofBeta, HistTable), {Specs[kTofBeta]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTofMass, HistTable), GetHistDesc(kTofMass, HistTable), GetHistType(kTofMass, HistTable), {Specs[kTofMass]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTofElectron, HistTable), GetHistDesc(kTofElectron, HistTable), GetHistType(kTofElectron, HistTable), {Specs[kTofElectron]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTofPion, HistTable), GetHistDesc(kTofPion, HistTable), GetHistType(kTofPion, HistTable), {Specs[kTofPion]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTofKaon, HistTable), GetHistDesc(kTofKaon, HistTable), GetHistType(kTofKaon, HistTable), {Specs[kTofKaon]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTofProton, HistTable), GetHistDesc(kTofProton, HistTable), GetHistType(kTofProton, HistTable), {Specs[kTofProton]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTofDeuteron, HistTable), GetHistDesc(kTofDeuteron, HistTable), GetHistType(kTofDeuteron, HistTable), {Specs[kTofDeuteron]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTofTriton, HistTable), GetHistDesc(kTofTriton, HistTable), GetHistType(kTofTriton, HistTable), {Specs[kTofTriton]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTofHelium, HistTable), GetHistDesc(kTofHelium, HistTable), GetHistType(kTofHelium, HistTable), {Specs[kTofHelium]}); + + mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcitsElectron, HistTable), GetHistDesc(kTpcitsElectron, HistTable), GetHistType(kTpcitsElectron, HistTable), {Specs[kTpcitsElectron]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcitsPion, HistTable), GetHistDesc(kTpcitsPion, HistTable), GetHistType(kTpcitsPion, HistTable), {Specs[kTpcitsPion]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcitsKaon, HistTable), GetHistDesc(kTpcitsKaon, HistTable), GetHistType(kTpcitsKaon, HistTable), {Specs[kTpcitsKaon]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcitsProton, HistTable), GetHistDesc(kTpcitsProton, HistTable), GetHistType(kTpcitsProton, HistTable), {Specs[kTpcitsProton]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcitsDeuteron, HistTable), GetHistDesc(kTpcitsDeuteron, HistTable), GetHistType(kTpcitsDeuteron, HistTable), {Specs[kTpcitsDeuteron]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcitsTriton, HistTable), GetHistDesc(kTpcitsTriton, HistTable), GetHistType(kTpcitsTriton, HistTable), {Specs[kTpcitsTriton]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcitsHelium, HistTable), GetHistDesc(kTpcitsHelium, HistTable), GetHistType(kTpcitsHelium, HistTable), {Specs[kTpcitsHelium]}); + + mHistogramRegistry->add(pidDir + GetHistNamev2(kTpctofElectron, HistTable), GetHistDesc(kTpctofElectron, HistTable), GetHistType(kTpctofElectron, HistTable), {Specs[kTpctofElectron]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTpctofPion, HistTable), GetHistDesc(kTpctofPion, HistTable), GetHistType(kTpctofPion, HistTable), {Specs[kTpctofPion]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTpctofKaon, HistTable), GetHistDesc(kTpctofKaon, HistTable), GetHistType(kTpctofKaon, HistTable), {Specs[kTpctofKaon]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTpctofProton, HistTable), GetHistDesc(kTpctofProton, HistTable), GetHistType(kTpctofProton, HistTable), {Specs[kTpctofProton]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTpctofDeuteron, HistTable), GetHistDesc(kTpctofDeuteron, HistTable), GetHistType(kTpctofDeuteron, HistTable), {Specs[kTpctofDeuteron]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTpctofTriton, HistTable), GetHistDesc(kTpctofTriton, HistTable), GetHistType(kTpctofTriton, HistTable), {Specs[kTpctofTriton]}); + mHistogramRegistry->add(pidDir + GetHistNamev2(kTpctofHelium, HistTable), GetHistDesc(kTpctofHelium, HistTable), GetHistType(kTpctofHelium, HistTable), {Specs[kTpctofHelium]}); + } + } + + template + void fill(T const& track) + { + if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kPt, HistTable)), track.pt()); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kEta, HistTable)), track.eta()); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kPhi, HistTable)), track.phi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kSign, HistTable)), track.sign()); + } + + if constexpr (isFlagSet(mode, modes::Mode::kQa)) { + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kItsCluster, HistTable)), static_cast(track.itsNCls())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kItsClusterIb, HistTable)), static_cast(track.itsNClsInnerBarrel())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kTpcCrossedRows, HistTable)), static_cast(track.tpcNClsCrossedRows())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kTpcCluster, HistTable)), static_cast(track.tpcNClsFound())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kTpcClusterShared, HistTable)), static_cast(track.tpcNClsShared())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kTpcClusterFractionShared, HistTable)), track.tpcSharedOverFound()); + + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsEta, HistTable)), track.pt(), track.eta()); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsPhi, HistTable)), track.pt(), track.phi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPhiVsEta, HistTable)), track.phi(), track.eta()); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsItsCluster, HistTable)), track.pt(), static_cast(track.itsNCls())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsTpcCluster, HistTable)), track.pt(), static_cast(track.tpcNClsFound())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsTpcClusterShared, HistTable)), track.pt(), static_cast(track.tpcNClsShared())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kTpcClusterVsTpcClusterShared, HistTable)), static_cast(track.tpcNClsFound()), static_cast(track.tpcNClsShared())); + + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsDcaxy, HistTable)), track.pt(), track.dcaXY()); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsDcaz, HistTable)), track.pt(), track.dcaZ()); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsDca, HistTable)), track.pt(), track.dca()); + + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsSignal, HistTable)), track.p(), o2::analysis::femto::utils::itsSignal(track)); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsElectron, HistTable)), track.p(), track.itsNSigmaEl()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsPion, HistTable)), track.p(), track.itsNSigmaPi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsKaon, HistTable)), track.p(), track.itsNSigmaKa()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsProton, HistTable)), track.p(), track.itsNSigmaPr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsDeuteron, HistTable)), track.p(), track.itsNSigmaDe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsTriton, HistTable)), track.p(), track.itsNSigmaTr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsHelium, HistTable)), track.p(), track.itsNSigmaHe()); + + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcSignal, HistTable)), track.p(), track.tpcSignal()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcElectron, HistTable)), track.p(), track.tpcNSigmaEl()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcPion, HistTable)), track.p(), track.tpcNSigmaPi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcKaon, HistTable)), track.p(), track.tpcNSigmaKa()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcProton, HistTable)), track.p(), track.tpcNSigmaPr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcDeuteron, HistTable)), track.p(), track.tpcNSigmaDe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcTriton, HistTable)), track.p(), track.tpcNSigmaTr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcHelium, HistTable)), track.p(), track.tpcNSigmaHe()); + + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofBeta, HistTable)), track.p(), track.tofBeta()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofMass, HistTable)), track.p(), track.tofMass()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofElectron, HistTable)), track.p(), track.tofNSigmaEl()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofPion, HistTable)), track.p(), track.tofNSigmaPi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofKaon, HistTable)), track.p(), track.tofNSigmaKa()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofProton, HistTable)), track.p(), track.tofNSigmaPr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofDeuteron, HistTable)), track.p(), track.tofNSigmaDe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofTriton, HistTable)), track.p(), track.tofNSigmaTr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofHelium, HistTable)), track.p(), track.tofNSigmaHe()); + + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsElectron, HistTable)), track.p(), track.tpcitsNSigmaEl()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsPion, HistTable)), track.p(), track.tpcitsNSigmaPi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsKaon, HistTable)), track.p(), track.tpcitsNSigmaKa()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsProton, HistTable)), track.p(), track.tpcitsNSigmaPr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsDeuteron, HistTable)), track.p(), track.tpcitsNSigmaDe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsTriton, HistTable)), track.p(), track.tpcitsNSigmaTr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsHelium, HistTable)), track.p(), track.tpcitsNSigmaHe()); + + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofElectron, HistTable)), track.p(), track.tpctofNSigmaEl()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofPion, HistTable)), track.p(), track.tpctofNSigmaPi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofKaon, HistTable)), track.p(), track.tpctofNSigmaKa()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofProton, HistTable)), track.p(), track.tpctofNSigmaPr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofDeuteron, HistTable)), track.p(), track.tpctofNSigmaDe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofTriton, HistTable)), track.p(), track.tpctofNSigmaTr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofHelium, HistTable)), track.p(), track.tpctofNSigmaHe()); + } + } + + private: + o2::framework::HistogramRegistry* mHistogramRegistry; +}; +}; // namespace trackhistmanager +}; // namespace o2::analysis::femto +#endif // PWGCF_FEMTO_CORE_TRACKHISTMANAGER_H_ diff --git a/PWGCF/Femto/Core/twoTrackResonanceBuilder.h b/PWGCF/Femto/Core/twoTrackResonanceBuilder.h new file mode 100644 index 00000000000..9b44d628af6 --- /dev/null +++ b/PWGCF/Femto/Core/twoTrackResonanceBuilder.h @@ -0,0 +1,608 @@ +// Copyright 2019-2025 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 twoTrackResonanceBuilder.h +/// \brief two track resonance builder +/// \author anton.riedel@tum.de, TU München, anton.riedel@tum.de + +#ifndef PWGCF_FEMTO_CORE_TWOTRACKRESONANCEBUILDER_H_ +#define PWGCF_FEMTO_CORE_TWOTRACKRESONANCEBUILDER_H_ + +#include "RecoDecay.h" + +#include "PWGCF/Femto/Core/baseSelection.h" +#include "PWGCF/Femto/Core/dataTypes.h" +#include "PWGCF/Femto/Core/femtoUtils.h" +#include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/selectionContainer.h" +#include "PWGCF/Femto/DataModel/FemtoTables.h" + +#include "CommonConstants/MathConstants.h" +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/AnalysisHelpers.h" +#include "Framework/Configurable.h" + +#include "Math/Vector4D.h" + +#include "fairlogger/Logger.h" + +#include +#include +#include +#include +#include +#include +#include + +namespace o2::analysis::femto +{ +namespace twotrackresonancebuilder +{ + +struct ConfTwoTrackResonanceDaughterFilters : o2::framework::ConfigurableGroup { + std::string prefix = std::string("TwoTrackResonanceDaughterFilter"); + o2::framework::Configurable ptMin{"ptMin", 0.2f, "Minimum pT of daughters"}; + o2::framework::Configurable ptMax{"ptMax", 6.f, "Maximum pT of daughters"}; + o2::framework::Configurable etaMin{"etaMin", -0.9f, "Minimum eta of daughters"}; + o2::framework::Configurable etaMax{"etaMax", 0.9f, "Maximum eta of daughters"}; + o2::framework::Configurable phiMin{"phiMin", 0.f, "Minimum phi of daughters"}; + o2::framework::Configurable phiMax{"phiMax", 1.f * o2::constants::math::TwoPI, "Maximum phi of daughters"}; +}; + +template +struct ConfTwoTrackResonanceFilters : o2::framework::ConfigurableGroup { + std::string prefix = Prefix; + o2::framework::Configurable ptMin{"ptMin", 0.2f, "Minimum pT"}; + o2::framework::Configurable ptMax{"ptMax", 6.f, "Maximum pT"}; + o2::framework::Configurable etaMin{"etaMin", -0.9f, "Minimum eta"}; + o2::framework::Configurable etaMax{"etaMax", 0.9f, "Maximum eta"}; + o2::framework::Configurable phiMin{"phiMin", 0.f, "Minimum phi"}; + o2::framework::Configurable phiMax{"phiMax", 1.f * o2::constants::math::TwoPI, "Maximum phi"}; + o2::framework::Configurable massMin{"massMin", 0.f, "Minimum invariant mass for Resonance"}; + o2::framework::Configurable massMax{"massMax", 6.f, "Maximum invariant mass for Resonance"}; +}; +constexpr const char PrefixRhoFilters[] = "Rho0Filters1"; +constexpr const char PrefixPhiFilters[] = "PhiFilters1"; +constexpr const char PrefixKstarFilters[] = "Kstar0Filters1"; +using ConfRhoFilters = ConfTwoTrackResonanceFilters; +using ConfPhiFilters = ConfTwoTrackResonanceFilters; +using ConfKstarFilters = ConfTwoTrackResonanceFilters; + +#define TWOTRACKRESONANCE_DEFAULT_BITS(posThres, negThres) \ + o2::framework::Configurable> dauEtaMax{"dauEtaMax", {0.8f}, "Maximum |eta| "}; \ + o2::framework::Configurable> dauTpcClustersMin{"dauTpcClustersMin", {90.f}, "Minimum number of clusters in TPC"}; \ + o2::framework::Configurable> dauDcaxyMax{"dauDcaxyMax", {"0.004 + 0.013*pow(x, -1)"}, "Maximum |dca_xy| as a function of pT"}; \ + o2::framework::Configurable> dauDcazMax{"dauDcazMax", {"0.004 + 0.013*pow(x, -1)"}, "Maximum |dca_z| as a function of pT"}; \ + o2::framework::Configurable> posDauPtMin{"posDauPtMin", {0.2f}, "Minimum pT of positive daughter "}; \ + o2::framework::Configurable> posDauPtMax{"posDauPtMax", {6.f}, "Maximum pT of the positive daughter"}; \ + o2::framework::Configurable> negDauPtMin{"negDauPtMin", {0.2f}, "Minimum pT of negative daughter "}; \ + o2::framework::Configurable> negDauPtMax{"negDauPtMax", {6.f}, "Maximum pT of the negative daughter"}; \ + o2::framework::Configurable> posDauMinMomForTof{"posDauMinMomForTof", {posThres}, "Minimum momentum to require TOF PID (positive daughters)"}; \ + o2::framework::Configurable> negDauMinMomForTof{"negDauMinMomForTof", {negThres}, "Minimum momentum to require TOF PID (negative daughters)"}; + +#define TWOTRACKRESONANCE_PIONPID_BITS \ + o2::framework::Configurable> posDauTpcPion{"posDauTpcPion", {3.f}, "Maximum |nsimga_Pion| TPC for positive daughter tracks"}; \ + o2::framework::Configurable> posDauTofPion{"posDauTofPion", {}, "Maximum |nsimga_Pion| TOF for positive daughter tracks"}; \ + o2::framework::Configurable> posDauTpctofPion{"posDauTpctofPion", {3.f}, "Maximum |nsimga_Pion| TPCTOF for positive daughter tracks"}; \ + o2::framework::Configurable> negDauTpcPion{"negDauTpcPion", {3.f}, "Maximum |nsimga_Pion| TPC for negative daughter tracks"}; \ + o2::framework::Configurable> negDauTofPion{"negDauTofPion", {}, "Maximum |nsimga_Pion| TOF for negative daughter tracks"}; \ + o2::framework::Configurable> negDauTpctofPion{"negDauTpctofPion", {3.f}, "Maximum |nsimga_Pion| TPCTOF for negative daughter tracks"}; + +#define TWOTRACKRESONANCE_KAONPID_BITS \ + o2::framework::Configurable> posDauTpcKaon{"posDauTpcKaon", {3.f}, "Maximum |nsimga_Kaon| TPC for positive daughter tracks"}; \ + o2::framework::Configurable> posDauTofKaon{"posDauTofKaon", {}, "Maximum |nsimga_Kaon| TOF for positive daughter tracks"}; \ + o2::framework::Configurable> posDauTpctofKaon{"posDauTpctofKaon", {3.f}, "Maximum |nsimga_Kaon| TPCTOF for positive daughter tracks"}; \ + o2::framework::Configurable> negDauTpcKaon{"negDauTpcKaon", {3.f}, "Maximum |nsimga_Kaon| TPC for negative daughter tracks"}; \ + o2::framework::Configurable> negDauTofKaon{"negDauTofKaon", {}, "Maximum |nsimga_Kaon| TOF for negative daughter tracks"}; \ + o2::framework::Configurable> negDauTpctofKaon{"negDauTpctofKaon", {3.f}, "Maximum |nsimga_Kaon| TPCTOF for negative daughter tracks"}; + +struct ConfPhiBits : o2::framework::ConfigurableGroup { + std::string prefix = std::string("PhiBits"); + TWOTRACKRESONANCE_DEFAULT_BITS(0.4f, 0.4f) + TWOTRACKRESONANCE_KAONPID_BITS +}; + +struct ConfRho0Bits : o2::framework::ConfigurableGroup { + std::string prefix = std::string("Rho0Bits"); + TWOTRACKRESONANCE_DEFAULT_BITS(0.5f, 0.5f) + TWOTRACKRESONANCE_PIONPID_BITS +}; + +struct ConfKstar0Bits : o2::framework::ConfigurableGroup { + std::string prefix = std::string("Kstar0Bits"); + TWOTRACKRESONANCE_DEFAULT_BITS(0.5f, 0.4f) + TWOTRACKRESONANCE_PIONPID_BITS + TWOTRACKRESONANCE_KAONPID_BITS +}; + +#undef TWOTRACKRESONANCE_DEFAULT_BITS +#undef TWOTRACKRESONANCE_KAONPID_BITS +#undef TWOTRACKRESONANCE_PIONPID_BITS + +#define TWOTRACKRESONANCE_DEFAULT_SELECTION(defaultMassMin, defaultMassMax) \ + o2::framework::Configurable ptMin{"ptMin", 0.f, "Minimum pT"}; \ + o2::framework::Configurable ptMax{"ptMax", 6.f, "Maximum pT"}; \ + o2::framework::Configurable etaMin{"etaMin", -0.9f, "Minimum eta"}; \ + o2::framework::Configurable etaMax{"etaMax", 0.9f, "Maximum eta"}; \ + o2::framework::Configurable phiMin{"phiMin", 0.f, "Minimum phi"}; \ + o2::framework::Configurable phiMax{"phiMax", 1.f * o2::constants::math::TwoPI, "Maximum phi"}; \ + o2::framework::Configurable massMin{"massMin", defaultMassMin, "Minimum invariant mass for Resonance"}; \ + o2::framework::Configurable massMax{"massMax", defaultMassMax, "Maximum invariant mass for Resonance"}; \ + o2::framework::Configurable posDauBitForThres{"posDauBitForThres", 32u, "Bit marking momentum threshold for positive daughter"}; \ + o2::framework::Configurable posDauMaskBelowThres{"posDauMaskBelowThres", 16u, "Bitmask for resonance selection"}; \ + o2::framework::Configurable posDauMaskAboveThres{"posDauMaskAboveThres", 8u, "Bitmask for resonance selection"}; \ + o2::framework::Configurable negDauBitForThres{"negDauBitForThres", 4u, "Bit marking resonance selection for negative daughter"}; \ + o2::framework::Configurable negDauMaskBelowThres{"negDauMaskBelowThres", 2u, "Bitmask for resonance selection"}; \ + o2::framework::Configurable negDauMaskAboveThres{"negDauMaskAboveThres", 1u, "Bitmask for resonance selection"}; + +struct ConfPhiSelection : o2::framework::ConfigurableGroup { + std::string prefix = std::string("PhiSelection"); + TWOTRACKRESONANCE_DEFAULT_SELECTION(0.95f, 1.05f) +}; + +struct ConfRho0Selection : o2::framework::ConfigurableGroup { + std::string prefix = std::string("RhoSelection"); + TWOTRACKRESONANCE_DEFAULT_SELECTION(0.7f, 0.84f) +}; + +struct ConfKstar0Selection : o2::framework::ConfigurableGroup { + std::string prefix = std::string("Kstar0Selection"); + o2::framework::Configurable sign{"sign", 1, "Sign (+1 for Kstar0 and -1 for Kstar0Bar) "}; + TWOTRACKRESONANCE_DEFAULT_SELECTION(0.8f, 1.0f) +}; + +#undef TWOTRACKRESONANCE_DEFAULT_SELECTION + +/// The different selections this task is capable of doing +enum TwoTrackResonanceSels { + + // common selections for both daughters + kDauEtaAbsMax, ///< max |eta| + kDauTpcClusterMin, ///< min number of TPC cluster + kDauDcaxyAbsMax, ///< max |DCA_xy| + kDauDcazAbsMax, ///< max |DCA_z| + + // selection for positive daughter + // add one bit for the momentum threshold + // when the partition for a resonance is build, we do not have information about the daughter tracks so have to store everything needed for the selection here + kPosDauMinMomForTof, ///< min p for TOF + kPosDauPtMin, ///< min pt + kPosDauPtMax, ///< max pt + kPosDauTpcPion, /// < max |nsigma_TPC| for pion + kPosDauTofPion, /// < max |nsigma_TOF| for pion + kPosDauTpctofPion, /// < max |nsigma_TPC+TOF| for pion + kPosDauTpcKaon, /// < max |nsigma_TPC| for kaon + kPosDauTofKaon, /// < max |nsigma_TOF| for kaon + kPosDauTpctofKaon, /// < max |nsigma_TPC+TOF| for kaon + + // selection for negative daughter + kNegDauMinMomForTof, ///< min p for TOF + kNegDauPtMin, ///< min pt + kNegDauPtMax, ///< max pt + kNegDauTpcPion, /// < max |nsigma_TPC| for pion + kNegDauTofPion, /// < max |nsigma_TOF| for pion + kNegDauTpctofPion, /// < max |nsigma_TPC+TOF| for pion + kNegDauTpcKaon, /// < max |nsigma_TPC| for kaon + kNegDauTofKaon, /// < max |nsigma_TOF| for kaon + kNegDauTpctofKaon, /// < max |nsigma_TPC+TOF| for kaon + + kResonanceSelsMax +}; + +const char twoTrackResonanceSelsName[] = "TwoTrackResonance Selection Object"; +const std::unordered_map twoTrackResonanceSelsToString = { + {kDauEtaAbsMax, "Max. |eta| of daughters"}, + {kDauTpcClusterMin, "Min. number of TPC clusters of daughters"}, + {kDauDcaxyAbsMax, "Max. |DCA_xy| of daughters"}, + {kDauDcazAbsMax, "Max. |DCA_z| of the daughters"}, + {kPosDauMinMomForTof, "Min. p of TOF PID of positive daughter"}, + {kPosDauPtMin, "Min. pt of positive daughter"}, + {kPosDauPtMax, "Max. pt of positive daughter"}, + {kPosDauTpcPion, "Max. |sigma_TPC| for pion of positive daughter"}, + {kPosDauTofPion, "Max. |sigma_TOF| for pion of positive daughter"}, + {kPosDauTpctofPion, "Max. |sigma_TPCTOF| for pion of positive daughter"}, + {kPosDauTpcKaon, "Max. |sigma_TPC| for kaon of positive daughter"}, + {kPosDauTofKaon, "Max. |sigma_TOF| for kaon of positive daughter"}, + {kPosDauTpctofKaon, "Max. |sigma_TPCTOF| for kaon of positive daughter"}, + {kNegDauMinMomForTof, "Min. p for TOF PID of negative daughter"}, + {kNegDauPtMin, "Min. pt of negative daughter"}, + {kNegDauPtMax, "Max. pt of negative daughter"}, + {kNegDauTpcPion, "Max. |sigma_TPC| for pion of negative daughter"}, + {kNegDauTofPion, "Max. |sigma_TOF| for pion of negative daughter"}, + {kNegDauTpctofPion, "Max. |sigma_TPCTOF| for pion of negative daughter"}, + {kNegDauTpcKaon, "Max. |sigma_TPC| for kaon of negative daughter"}, + {kNegDauTofKaon, "Max. |sigma_TOF| for kaon of negative daughter"}, + {kNegDauTpctofKaon, "Max. |sigma_TPCTOF| for kaon of negative daughter"}}; + +/// \class FemtoDreamTrackCuts +/// \brief Cut class to contain and execute all cuts applied to tracks +template +class TwoTrackResonanceSelection : public BaseSelection +{ + public: + TwoTrackResonanceSelection() {} + virtual ~TwoTrackResonanceSelection() = default; + + template + void configure(T1& config, T2& filter, T3& daughterFilter) + { + if constexpr (modes::isEqual(resoType, modes::TwoTrackResonance::kPhi)) { + mPosDaughterMass = o2::constants::physics::MassKPlus; + mNegDaughterMass = o2::constants::physics::MassKMinus; + this->addSelection(config.posDauTpcKaon.value, kPosDauTpcKaon, limits::kAbsUpperLimit, false, false); + this->addSelection(config.posDauTofKaon.value, kPosDauTofKaon, limits::kAbsUpperLimit, false, false); + this->addSelection(config.posDauTpctofKaon.value, kPosDauTpctofKaon, limits::kUpperLimit, false, false); + this->addSelection(config.negDauTpcKaon.value, kNegDauTpcKaon, limits::kAbsUpperLimit, false, false); + this->addSelection(config.negDauTofKaon.value, kNegDauTofKaon, limits::kAbsUpperLimit, false, false); + this->addSelection(config.negDauTpctofKaon.value, kNegDauTpctofKaon, limits::kUpperLimit, false, false); + } + if constexpr (modes::isEqual(resoType, modes::TwoTrackResonance::kRho0)) { + mPosDaughterMass = o2::constants::physics::MassPiPlus; + mNegDaughterMass = o2::constants::physics::MassPiMinus; + this->addSelection(config.posDauTpcPion.value, kPosDauTpcPion, limits::kAbsUpperLimit, false, false); + this->addSelection(config.posDauTofPion.value, kPosDauTofPion, limits::kAbsUpperLimit, false, false); + this->addSelection(config.posDauTpctofPion.value, kPosDauTpctofPion, limits::kUpperLimit, false, false); + this->addSelection(config.negDauTpcPion.value, kNegDauTpcPion, limits::kAbsUpperLimit, false, false); + this->addSelection(config.negDauTofPion.value, kNegDauTofPion, limits::kAbsUpperLimit, false, false); + this->addSelection(config.negDauTpctofPion.value, kNegDauTpctofPion, limits::kUpperLimit, false, false); + } + if constexpr (modes::isEqual(resoType, modes::TwoTrackResonance::kKstar0)) { + mPosDaughterMass = o2::constants::physics::MassKPlus; + mNegDaughterMass = o2::constants::physics::MassPiMinus; + this->addSelection(config.posDauTpcKaon.value, kPosDauTpcKaon, limits::kAbsUpperLimit, false, false); + this->addSelection(config.posDauTofKaon.value, kPosDauTofKaon, limits::kAbsUpperLimit, false, false); + this->addSelection(config.posDauTpctofKaon.value, kPosDauTpctofKaon, limits::kUpperLimit, false, false); + this->addSelection(config.negDauTpcPion.value, kNegDauTpcPion, limits::kAbsUpperLimit, false, false); + this->addSelection(config.negDauTofPion.value, kNegDauTofPion, limits::kAbsUpperLimit, false, false); + this->addSelection(config.negDauTpctofPion.value, kNegDauTpctofPion, limits::kUpperLimit, false, false); + } + if constexpr (modes::isEqual(resoType, modes::TwoTrackResonance::kKstar0Bar)) { + mPosDaughterMass = o2::constants::physics::MassPiPlus; + mNegDaughterMass = o2::constants::physics::MassKMinus; + this->addSelection(config.posDauTpcPion.value, kPosDauTpcPion, limits::kAbsUpperLimit, false, false); + this->addSelection(config.posDauTofPion.value, kPosDauTofPion, limits::kAbsUpperLimit, false, false); + this->addSelection(config.posDauTpctofPion.value, kPosDauTpctofPion, limits::kUpperLimit, false, false); + this->addSelection(config.negDauTpcKaon.value, kNegDauTpcKaon, limits::kAbsUpperLimit, false, false); + this->addSelection(config.negDauTofKaon.value, kNegDauTofKaon, limits::kAbsUpperLimit, false, false); + this->addSelection(config.negDauTpctofKaon.value, kNegDauTpctofKaon, limits::kUpperLimit, false, false); + } + + mMassMin = filter.massMin.value; + mMassMax = filter.massMax.value; + mPtMin = filter.ptMin.value; + mPtMax = filter.ptMax.value; + mEtaMin = filter.etaMin.value; + mEtaMax = filter.etaMax.value; + mPhiMin = filter.phiMin.value; + mPhiMax = filter.phiMax.value; + + this->addSelection(config.dauEtaMax.value, kDauEtaAbsMax, limits::kAbsUpperLimit, true, true); + this->addSelection(config.dauTpcClustersMin.value, kDauTpcClusterMin, limits::kLowerLimit, true, true); + this->addSelection(config.dauDcaxyMax.name, daughterFilter.ptMin.value, daughterFilter.ptMax.value, config.dauDcaxyMax.value, kDauDcaxyAbsMax, limits::kAbsUpperFunctionLimit, true, true); + this->addSelection(config.dauDcazMax.name, daughterFilter.ptMin.value, daughterFilter.ptMax.value, config.dauDcazMax.value, kDauDcazAbsMax, limits::kAbsUpperFunctionLimit, true, true); + + this->addSelection(config.posDauMinMomForTof.value, kPosDauMinMomForTof, limits::kLowerLimit, false, false); // momentum threshold for TOF is no minimal cut + this->addSelection(config.posDauPtMin.value, kPosDauPtMin, limits::kLowerLimit, true, true); + this->addSelection(config.posDauPtMax.value, kPosDauPtMax, limits::kUpperLimit, true, true); + + this->addSelection(config.negDauMinMomForTof.value, kNegDauMinMomForTof, limits::kLowerLimit, false, false); // momentum threshold for TOF is no minimal cut + this->addSelection(config.negDauPtMin.value, kNegDauPtMin, limits::kLowerLimit, true, true); + this->addSelection(config.negDauPtMax.value, kNegDauPtMax, limits::kUpperLimit, true, true); + }; + + template + void reconstructResonance(Tracks const& posDaughter, Tracks const& negDaughter) + { + + ROOT::Math::PtEtaPhiMVector vecPosDaughter{posDaughter.pt(), posDaughter.eta(), posDaughter.phi(), mPosDaughterMass}; + ROOT::Math::PtEtaPhiMVector vecNegDaughter{negDaughter.pt(), negDaughter.eta(), negDaughter.phi(), mNegDaughterMass}; + ROOT::Math::PtEtaPhiMVector vecResonance = vecPosDaughter + vecNegDaughter; + + // cache kinematics + mMass = vecResonance.M(); + mPt = vecResonance.Pt(); + mEta = vecResonance.Eta(); + mPhi = RecoDecay::constrainAngle(vecResonance.Phi()); + } + + bool checkFilters() const + { + return ((mMass > mMassMin && mMass < mMassMax) && + (mPt > mPtMin && mPt < mPtMax) && + (mEta > mEtaMin && mEta < mEtaMax) && + (mPhi > mPhiMin && mPhi < mPhiMax)); + } + + template + bool hasTofAboveThreshold(T const& positiveDaughter, T const& negativeDaughter) + { + bool posDauHasTofAboveThreshold = !this->passesOptionalSelection(kPosDauMinMomForTof) || positiveDaughter.hasTOF(); // is always true if momentum is below threshold + bool negDauHasTofAboveThreshold = !this->passesOptionalSelection(kNegDauMinMomForTof) || negativeDaughter.hasTOF(); // is always true if momentum is below threshold + return posDauHasTofAboveThreshold && negDauHasTofAboveThreshold; + } + + float getPt() const { return mPt; } + float getEta() const { return mEta; } + float getPhi() const { return mPhi; } + float getMass() const { return mMass; } + + template + void applySelections(Tracks const& posDaughter, Tracks const& negDaughter) + { + this->reset(); + // for resoanace topological selectsion are in general not possible, so only selections on the daughters are performed + + // common daugher selections + std::array etaDaughters = {std::fabs(posDaughter.eta()), std::fabs(negDaughter.eta())}; + this->evaluateObservable(kDauEtaAbsMax, *std::max_element(etaDaughters.begin(), etaDaughters.end())); + std::array tpcClusterDaughters = {1.f * posDaughter.tpcNClsFound(), 1.f * negDaughter.tpcNClsFound()}; + this->evaluateObservable(kDauTpcClusterMin, *std::min_element(tpcClusterDaughters.begin(), tpcClusterDaughters.end())); + + // check pt dependend dca cut on both daughters + // we apply the same cut to both daughters so we only want to store the result were both daughters survive the cut + // since momenta of daughters are different, we compute the bitmask for both, combine them with logical AND and keep the result + uint64_t bitmaskDcaPos, bitmaskDcaNeg, bitmaskDca; + this->updateLimits(kDauDcaxyAbsMax, posDaughter.pt()); + this->evaluateObservable(kDauDcaxyAbsMax, posDaughter.dcaXY()); + bitmaskDcaPos = this->getBitmask(kDauDcaxyAbsMax); + this->updateLimits(kDauDcaxyAbsMax, negDaughter.pt()); + this->evaluateObservable(kDauDcaxyAbsMax, negDaughter.dcaXY()); + bitmaskDcaNeg = this->getBitmask(kDauDcaxyAbsMax); + bitmaskDca = bitmaskDcaPos & bitmaskDcaNeg; + this->setBitmask(kDauDcaxyAbsMax, bitmaskDca); + + this->updateLimits(kDauDcazAbsMax, posDaughter.pt()); + this->evaluateObservable(kDauDcazAbsMax, posDaughter.dcaZ()); + bitmaskDcaPos = this->getBitmask(kDauDcazAbsMax); + this->updateLimits(kDauDcazAbsMax, negDaughter.pt()); + this->evaluateObservable(kDauDcazAbsMax, negDaughter.dcaZ()); + bitmaskDcaNeg = this->getBitmask(kDauDcazAbsMax); + bitmaskDca = bitmaskDcaPos & bitmaskDcaNeg; + this->setBitmask(kDauDcazAbsMax, bitmaskDca); + + // positive daughter selections + this->evaluateObservable(kPosDauMinMomForTof, posDaughter.p()); + this->evaluateObservable(kPosDauPtMin, posDaughter.pt()); + this->evaluateObservable(kPosDauPtMax, posDaughter.pt()); + + this->evaluateObservable(kPosDauTpcPion, posDaughter.tpcNSigmaPi()); + this->evaluateObservable(kPosDauTofPion, posDaughter.tofNSigmaPi()); + this->evaluateObservable(kPosDauTpctofPion, std::hypot(posDaughter.tpcNSigmaPi(), posDaughter.tofNSigmaPi())); + + this->evaluateObservable(kPosDauTpcKaon, posDaughter.tpcNSigmaKa()); + this->evaluateObservable(kPosDauTofKaon, posDaughter.tofNSigmaKa()); + this->evaluateObservable(kPosDauTpctofKaon, std::hypot(posDaughter.tpcNSigmaKa(), posDaughter.tofNSigmaKa())); + + // negative daughter selections + this->evaluateObservable(kNegDauMinMomForTof, negDaughter.p()); + this->evaluateObservable(kNegDauPtMin, negDaughter.pt()); + this->evaluateObservable(kNegDauPtMax, negDaughter.pt()); + + this->evaluateObservable(kNegDauTpcPion, negDaughter.tpcNSigmaPi()); + this->evaluateObservable(kNegDauTofPion, negDaughter.tofNSigmaPi()); + this->evaluateObservable(kNegDauTpctofPion, std::hypot(negDaughter.tpcNSigmaPi(), negDaughter.tofNSigmaPi())); + + this->evaluateObservable(kNegDauTpcKaon, negDaughter.tpcNSigmaKa()); + this->evaluateObservable(kNegDauTofKaon, negDaughter.tofNSigmaKa()); + this->evaluateObservable(kNegDauTpctofKaon, std::hypot(negDaughter.tpcNSigmaKa(), negDaughter.tofNSigmaKa())); + + this->assembleBitmask(); + }; + + bool checkHypothesis() + { + if constexpr (modes::isEqual(resoType, modes::TwoTrackResonance::kRho0)) { + return (this->passesOptionalSelection(kPosDauTpcPion) || this->passesOptionalSelection(kPosDauTofPion) || this->passesOptionalSelection(kPosDauTpctofPion)) && + (this->passesOptionalSelection(kNegDauTpcPion) || this->passesOptionalSelection(kNegDauTofPion) || this->passesOptionalSelection(kNegDauTpctofPion)); + } + if constexpr (modes::isEqual(resoType, modes::TwoTrackResonance::kPhi)) { + return (this->passesOptionalSelection(kPosDauTpcKaon) || this->passesOptionalSelection(kPosDauTofKaon) || this->passesOptionalSelection(kPosDauTpctofKaon)) && + (this->passesOptionalSelection(kNegDauTpcKaon) || this->passesOptionalSelection(kNegDauTofKaon) || this->passesOptionalSelection(kNegDauTpctofKaon)); + } + if constexpr (modes::isEqual(resoType, modes::TwoTrackResonance::kKstar0)) { + return (this->passesOptionalSelection(kPosDauTpcKaon) || this->passesOptionalSelection(kPosDauTofKaon) || this->passesOptionalSelection(kPosDauTpctofKaon)) && + (this->passesOptionalSelection(kNegDauTpcPion) || this->passesOptionalSelection(kNegDauTofPion) || this->passesOptionalSelection(kNegDauTpctofPion)); + } + if constexpr (modes::isEqual(resoType, modes::TwoTrackResonance::kKstar0Bar)) { + return (this->passesOptionalSelection(kPosDauTpcPion) || this->passesOptionalSelection(kPosDauTofPion) || this->passesOptionalSelection(kPosDauTpctofPion)) && + (this->passesOptionalSelection(kNegDauTpcKaon) || this->passesOptionalSelection(kNegDauTofKaon) || this->passesOptionalSelection(kNegDauTpctofKaon)); + } + return false; + } + + protected: + // (cached) kinematic variables of the resonance + float mPt = 0.f; + float mEta = 0.f; + float mPhi = 0.f; + float mMass = 0.f; + + // kinematic selections of the resonance + float mMassMin = 0.f; + float mMassMax = 6.f; + float mPtMin = 0.f; + float mPtMax = 6.f; + float mEtaMin = -0.9f; + float mEtaMax = 0.9f; + float mPhiMin = 0.f; + float mPhiMax = o2::constants::math::TwoPI; + + // daughter masses + float mPosDaughterMass = 0.f; + float mNegDaughterMass = 0.f; +}; + +struct TwoTrackResonanceBuilderProducts : o2::framework::ProducesGroup { + o2::framework::Produces producedPhis; + o2::framework::Produces producedPhiMasks; + o2::framework::Produces producedKstars; + o2::framework::Produces producedKstarMasks; + o2::framework::Produces producedRhos; + o2::framework::Produces producedRhoMasks; +}; + +struct ConfTwoTrackResonanceTables : o2::framework::ConfigurableGroup { + std::string prefix = std::string("TwoTrackResonanceTables"); + o2::framework::Configurable producePhis{"producePhis", -1, "Produce Phis (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable producePhiMasks{"producePhiMasks", -1, "Produce PhiMasks (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceKstar0s{"produceKstar0s", -1, "Produce K0stars (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceKstar0Masks{"produceKstar0Masks", -1, "Produce Kstar0Masks (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceRho0s{"produceRho0s", -1, "Produce Rho0s (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceRho0Masks{"produceRho0Masks", -1, "Produce Rho0Masks (-1: auto; 0 off; 1 on)"}; +}; + +template +class TwoTrackResonanceBuilder +{ + public: + TwoTrackResonanceBuilder() {} + virtual ~TwoTrackResonanceBuilder() = default; + + template + void init(T1& config, T2& filter, T3& daughterFilter, T4& table, T5 initContext) + { + twoTrackResonanceSelection.configure(config, filter, daughterFilter); + if constexpr (modes::isEqual(resoType, modes::TwoTrackResonance::kPhi)) { + LOG(info) << "Initialize femto Phi builder..."; + producePhis = utils::enableTable("FPhis_001", table.producePhis.value, initContext); + producePhiMasks = utils::enableTable("FPhiMasks_001", table.producePhiMasks.value, initContext); + } + if constexpr (modes::isEqual(resoType, modes::TwoTrackResonance::kKstar0) || modes::isEqual(resoType, modes::TwoTrackResonance::kKstar0Bar)) { + if constexpr (modes::isEqual(resoType, modes::TwoTrackResonance::kKstar0)) { + LOG(info) << "Initialize femto Kstar0 builder..."; + } + if constexpr (modes::isEqual(resoType, modes::TwoTrackResonance::kKstar0Bar)) { + LOG(info) << "Initialize femto Kstar0Bar builder..."; + } + produceKstar0s = utils::enableTable("FKstar0s_001", table.produceKstar0s.value, initContext); + produceKstar0Masks = utils::enableTable("FKstar0Masks_001", table.produceKstar0Masks.value, initContext); + } + if constexpr (modes::isEqual(resoType, modes::TwoTrackResonance::kRho0)) { + LOG(info) << "Initialize femto Rho0 builder..."; + produceRho0s = utils::enableTable("FRho0s_001", table.produceRho0s.value, initContext); + produceRho0Masks = utils::enableTable("FRho0Masks_001", table.produceRho0Masks.value, initContext); + } + + if (producePhis || producePhiMasks || produceKstar0s || produceKstar0Masks || produceRho0s || produceRho0Masks) { + fillAnyTable = true; + twoTrackResonanceSelection.printSelections(twoTrackResonanceSelsName, twoTrackResonanceSelsToString); + } else { + LOG(info) << "No tables configured"; + } + LOG(info) << "Initialization done..."; + } + + template + void fillResonances(T1& collisionProducts, T2& trackProducts, T3& resonanceProducts, T4& groupPositiveTracks, T5& groupNegativeTracks, T6& trackBuilder, T7& indexMap) + { + if (!fillAnyTable) { + return; + } + for (auto const& positiveTrack : groupPositiveTracks) { + for (auto const& negativeTrack : groupNegativeTracks) { + this->fillResonance(collisionProducts, trackProducts, resonanceProducts, positiveTrack, negativeTrack, trackBuilder, indexMap); + } + } + } + + template + void fillResonance(T1& collisionProducts, T2& trackProducts, T3& resonanceProducts, T4 const& posDaughter, T4 const& negDaughter, T5& trackBuilder, T6& indexMap) + { + + twoTrackResonanceSelection.applySelections(posDaughter, negDaughter); // for resonances selection are only applied to daughter tracks + if (!twoTrackResonanceSelection.hasTofAboveThreshold(posDaughter, negDaughter) || !twoTrackResonanceSelection.passesAllRequiredSelections()) { + return; + } + twoTrackResonanceSelection.reconstructResonance(posDaughter, negDaughter); + if (!twoTrackResonanceSelection.checkFilters() || !twoTrackResonanceSelection.checkHypothesis()) { + return; + } + int64_t posDaughterIndex = 0; + int64_t negDaughterIndex = 0; + posDaughterIndex = trackBuilder.template getDaughterIndex(posDaughter, trackProducts, collisionProducts, indexMap); + negDaughterIndex = trackBuilder.template getDaughterIndex(negDaughter, trackProducts, collisionProducts, indexMap); + + if constexpr (modes::isEqual(resoType, modes::TwoTrackResonance::kRho0)) { + if (produceRho0s) { + resonanceProducts.producedRhos( + collisionProducts.producedCollision.lastIndex(), + twoTrackResonanceSelection.getPt(), + twoTrackResonanceSelection.getEta(), + twoTrackResonanceSelection.getPhi(), + twoTrackResonanceSelection.getMass(), + posDaughterIndex, + negDaughterIndex); + } + if (produceRho0Masks) { + resonanceProducts.producedRhoMasks(twoTrackResonanceSelection.getBitmask()); + } + } + if constexpr (modes::isEqual(resoType, modes::TwoTrackResonance::kPhi)) { + if (producePhis) { + resonanceProducts.producedPhis( + collisionProducts.producedCollision.lastIndex(), + twoTrackResonanceSelection.getPt(), + twoTrackResonanceSelection.getEta(), + twoTrackResonanceSelection.getPhi(), + twoTrackResonanceSelection.getMass(), + posDaughterIndex, + negDaughterIndex); + } + if (producePhiMasks) { + resonanceProducts.producedPhiMasks(twoTrackResonanceSelection.getBitmask()); + } + } + if constexpr (modes::isEqual(resoType, modes::TwoTrackResonance::kKstar0)) { + if (produceKstar0s) { + resonanceProducts.producedKstars( + collisionProducts.producedCollision.lastIndex(), + twoTrackResonanceSelection.getPt(), + twoTrackResonanceSelection.getEta(), + twoTrackResonanceSelection.getPhi(), + twoTrackResonanceSelection.getMass(), + posDaughterIndex, + negDaughterIndex); + } + if (produceKstar0Masks) { + resonanceProducts.producedKstarMasks(twoTrackResonanceSelection.getBitmask()); + } + } + if constexpr (modes::isEqual(resoType, modes::TwoTrackResonance::kKstar0Bar)) { + if (produceKstar0s) { + resonanceProducts.producedKstars( + collisionProducts.producedCollision.lastIndex(), + -1.f * twoTrackResonanceSelection.getPt(), + twoTrackResonanceSelection.getEta(), + twoTrackResonanceSelection.getPhi(), + twoTrackResonanceSelection.getMass(), + posDaughterIndex, + negDaughterIndex); + } + if (produceKstar0Masks) { + resonanceProducts.producedKstarMasks(twoTrackResonanceSelection.getBitmask()); + } + } + } + + private: + TwoTrackResonanceSelection twoTrackResonanceSelection; + bool fillAnyTable = false; + bool producePhis = false; + bool producePhiMasks = false; + bool produceKstar0s = false; + bool produceKstar0Masks = false; + bool produceRho0s = false; + bool produceRho0Masks = false; +}; // namespace twotrackresonancebuilder + +} // namespace twotrackresonancebuilder +} // namespace o2::analysis::femto +#endif // PWGCF_FEMTO_CORE_TWOTRACKRESONANCEBUILDER_H_ diff --git a/PWGCF/Femto/Core/twoTrackResonanceHistManager.h b/PWGCF/Femto/Core/twoTrackResonanceHistManager.h new file mode 100644 index 00000000000..b6e429b434a --- /dev/null +++ b/PWGCF/Femto/Core/twoTrackResonanceHistManager.h @@ -0,0 +1,200 @@ +// Copyright 2019-2022 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 twoTrackResonanceHistManager.h +/// \brief histogram manager for two track resonances +/// \author Anton Riedel, TU München, anton.riedel@cern.ch + +#ifndef PWGCF_FEMTO_CORE_TWOTRACKRESONANCEHISTMANAGER_H_ +#define PWGCF_FEMTO_CORE_TWOTRACKRESONANCEHISTMANAGER_H_ + +#include "PWGCF/Femto/Core/histManager.h" +#include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/trackHistManager.h" + +#include "CommonConstants/MathConstants.h" +#include "Framework/Configurable.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/HistogramSpec.h" + +#include +#include +#include +#include +#include + +namespace o2::analysis::femto +{ +namespace twotrackresonancehistmanager +{ +// enum for track histograms +enum TwoTrackResonanceHist { + // analysis + kPt, + kEta, + kPhi, + kMass, + kSign, + // 2d qa + kPtVsEta, + kPtVsPhi, + kPhiVsEta, + kPtVsMass, + kTwoTrackResonanceHistLast +}; + +#define TWOTRACKRESONANCE_DEFAULT_BINNING(defaultMassMin, defaultMassMax) \ + o2::framework::ConfigurableAxis pt{"pt", {{600, 0, 6}}, "Pt"}; \ + o2::framework::ConfigurableAxis eta{"eta", {{300, -1.5, 1.5}}, "Eta"}; \ + o2::framework::ConfigurableAxis phi{"phi", {{720, 0, 1.f * o2::constants::math::TwoPI}}, "Phi"}; \ + o2::framework::ConfigurableAxis mass{"mass", {{200, defaultMassMin, defaultMassMax}}, "Mass"}; \ + o2::framework::ConfigurableAxis sign{"sign", {{3, -1.5, 1.5}}, "Sign"}; + +struct ConfPhiBinning : o2::framework::ConfigurableGroup { + std::string prefix = std::string("PhiBinning"); + TWOTRACKRESONANCE_DEFAULT_BINNING(0.8f, 1.2f) +}; + +struct ConfRho0Binning : o2::framework::ConfigurableGroup { + std::string prefix = std::string("Rho0Binning"); + TWOTRACKRESONANCE_DEFAULT_BINNING(0.5f, 1.f) +}; + +struct ConfKstar0Binning : o2::framework::ConfigurableGroup { + std::string prefix = std::string("Kstar0Binning"); + TWOTRACKRESONANCE_DEFAULT_BINNING(0.6f, 1.f) +}; +#undef TWOTRACKRESONANCE_DEFAULT_BINNING + +constexpr std::array, kTwoTrackResonanceHistLast> HistTable = { + {{kPt, o2::framework::kTH1F, "hPt", "Transverse Momentum; p_{T} (GeV/#it{c}); Entries"}, + {kEta, o2::framework::kTH1F, "hEta", "Pseudorapdity; #eta; Entries"}, + {kPhi, o2::framework::kTH1F, "hPhi", "Azimuthal angle; #varphi; Entries"}, + {kMass, o2::framework::kTH1F, "hMass", "Invariant mass; m (GeV/#it{c}^{2}); Entries"}, + {kSign, o2::framework::kTH1F, "hSign", "Sign (-1 -> antiparticle, 0 -> self conjugate, +1 -> particle); sign; Entries"}, + {kPtVsEta, o2::framework::kTH2F, "hPtVsEta", "p_{T} vs #eta; p_{T} (GeV/#it{c}) ; #eta"}, + {kPtVsPhi, o2::framework::kTH2F, "hPtVsPhi", "p_{T} vs #varphi;p_{T} (GeV/#it{c});#varphi"}, + {kPhiVsEta, o2::framework::kTH2F, "hPhiVsEta", "#varphi vs #eta; #varphi ; #eta"}, + {kPtVsMass, o2::framework::kTH2F, "hPtVsMass", "p_{T} vs invariant mass; p_{T} (GeV/#it{c}); m (GeV/#it{c}^{2})"}}}; + +template +std::map> makeTwoTrackResonanceHistSpecMap(const T& confBinningAnalysis) +{ + return std::map>{ + {kPt, {confBinningAnalysis.pt}}, + {kEta, {confBinningAnalysis.eta}}, + {kPhi, {confBinningAnalysis.phi}}, + {kMass, {confBinningAnalysis.mass}}, + {kSign, {confBinningAnalysis.sing}}}; +}; + +template +auto makeTwoTrackResonanceQaHistSpecMap(const T& confBinningAnalysis) +{ + return std::map>{ + {kPt, {confBinningAnalysis.pt}}, + {kEta, {confBinningAnalysis.eta}}, + {kPhi, {confBinningAnalysis.phi}}, + {kMass, {confBinningAnalysis.mass}}, + {kSign, {confBinningAnalysis.sign}}, + {kPtVsEta, {confBinningAnalysis.pt, confBinningAnalysis.eta}}, + {kPtVsPhi, {confBinningAnalysis.pt, confBinningAnalysis.phi}}, + {kPhiVsEta, {confBinningAnalysis.phi, confBinningAnalysis.eta}}, + {kPtVsMass, {confBinningAnalysis.pt, confBinningAnalysis.mass}}}; +}; + +constexpr char PrefixRho[] = "Rho0/"; +constexpr char PrefixPhi[] = "Phi/"; +constexpr char PrefixKstar[] = "Kstar0/"; + +constexpr std::string_view AnalysisDir = "Kinematics/"; +constexpr std::string_view QaDir = "QA/"; + +/// \class FemtoDreamEventHisto +/// \brief Class for histogramming event properties +// template +template +class TwoTrackResonanceHistManager +{ + public: + /// Destructor + virtual ~TwoTrackResonanceHistManager() = default; + /// Initializes histograms for the task + /// \param registry Histogram registry to be passed + /// + void init(o2::framework::HistogramRegistry* registry, + std::map> ResoSpecs, + std::map> PosDauSpecs, + std::map> NegDauSpecs) + { + mHistogramRegistry = registry; + mPosDauManager.init(registry, PosDauSpecs); + mNegDauManager.init(registry, NegDauSpecs); + + if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { + std::string analysisDir = std::string(resoPrefix) + std::string(AnalysisDir); + + mHistogramRegistry->add(analysisDir + GetHistNamev2(kPt, HistTable), GetHistDesc(kPt, HistTable), GetHistType(kPt, HistTable), {ResoSpecs[kPt]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kEta, HistTable), GetHistDesc(kEta, HistTable), GetHistType(kEta, HistTable), {ResoSpecs[kEta]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kPhi, HistTable), GetHistDesc(kPhi, HistTable), GetHistType(kPhi, HistTable), {ResoSpecs[kPhi]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kMass, HistTable), GetHistDesc(kMass, HistTable), GetHistType(kMass, HistTable), {ResoSpecs[kMass]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kSign, HistTable), GetHistDesc(kSign, HistTable), GetHistType(kSign, HistTable), {ResoSpecs[kSign]}); + } + + if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { + std::string qaDir = std::string(resoPrefix) + std::string(QaDir); + + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsEta, HistTable), GetHistDesc(kPtVsEta, HistTable), GetHistType(kPtVsEta, HistTable), {ResoSpecs[kPtVsEta]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsPhi, HistTable), GetHistDesc(kPtVsPhi, HistTable), GetHistType(kPtVsPhi, HistTable), {ResoSpecs[kPtVsPhi]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPhiVsEta, HistTable), GetHistDesc(kPhiVsEta, HistTable), GetHistType(kPhiVsEta, HistTable), {ResoSpecs[kPhiVsEta]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsMass, HistTable), GetHistDesc(kPtVsMass, HistTable), GetHistType(kPtVsMass, HistTable), {ResoSpecs[kPtVsMass]}); + } + } + + template + void fill(T1 const& resonance, T2 const& /*tracks*/) + { + auto posDaughter = resonance.template posDau_as(); + mPosDauManager.fill(posDaughter); + auto negDaughter = resonance.template negDau_as(); + mNegDauManager.fill(negDaughter); + + if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(GetHistName(kPt, HistTable)), resonance.pt()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(GetHistName(kEta, HistTable)), resonance.eta()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(GetHistName(kPhi, HistTable)), resonance.phi()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(GetHistName(kMass, HistTable)), resonance.mass()); + + if constexpr (modes::isEqual(reso, modes::TwoTrackResonance::kPhi) || modes::isEqual(reso, modes::TwoTrackResonance::kRho0)) { + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(GetHistName(kSign, HistTable)), 0); + } + if constexpr (modes::isEqual(reso, modes::TwoTrackResonance::kKstar0) || modes::isEqual(reso, modes::TwoTrackResonance::kKstar0Bar)) { + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(GetHistName(kSign, HistTable)), resonance.sign()); + } + } + + if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(GetHistName(kPtVsEta, HistTable)), resonance.pt(), resonance.eta()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(GetHistName(kPtVsPhi, HistTable)), resonance.pt(), resonance.phi()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(GetHistName(kPhiVsEta, HistTable)), resonance.phi(), resonance.eta()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(GetHistName(kPtVsMass, HistTable)), resonance.pt(), resonance.mass()); + } + } + + private: + o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; + + trackhistmanager::TrackHistManager mPosDauManager; + trackhistmanager::TrackHistManager mNegDauManager; +}; +}; // namespace twotrackresonancehistmanager +}; // namespace o2::analysis::femto +#endif // PWGCF_FEMTO_CORE_TWOTRACKRESONANCEHISTMANAGER_H_ diff --git a/PWGCF/Femto/Core/v0Builder.h b/PWGCF/Femto/Core/v0Builder.h new file mode 100644 index 00000000000..300a996c05e --- /dev/null +++ b/PWGCF/Femto/Core/v0Builder.h @@ -0,0 +1,471 @@ +// Copyright 2019-2025 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 v0Builder.h +/// \brief v0 builder +/// \author Anton Riedel, TU München, anton.riedel@cern.ch + +#ifndef PWGCF_FEMTO_CORE_V0BUILDER_H_ +#define PWGCF_FEMTO_CORE_V0BUILDER_H_ + +#include "PWGCF/Femto/Core/baseSelection.h" +#include "PWGCF/Femto/Core/dataTypes.h" +#include "PWGCF/Femto/Core/femtoUtils.h" +#include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/selectionContainer.h" +#include "PWGCF/Femto/DataModel/FemtoTables.h" + +#include "CommonConstants/MathConstants.h" +#include "Framework/AnalysisHelpers.h" +#include "Framework/Configurable.h" + +#include "fairlogger/Logger.h" + +#include +#include +#include +#include +#include +#include +#include + +namespace o2::analysis::femto +{ +namespace v0builder +{ + +// filters applied in the producer task +struct ConfV0Filters : o2::framework::ConfigurableGroup { + std::string prefix = std::string("V0Filters"); + o2::framework::Configurable ptMin{"ptMin", 0.f, "Minimum pT"}; + o2::framework::Configurable ptMax{"ptMax", 99.f, "Maximum pT"}; + o2::framework::Configurable etaMin{"etaMin", -10.f, "Minimum eta"}; + o2::framework::Configurable etaMax{"etaMax", 10.f, "Maximum eta"}; + o2::framework::Configurable phiMin{"phiMin", 0.f, "Minimum phi"}; + o2::framework::Configurable phiMax{"phiMax", 1.f * o2::constants::math::TwoPI, "Maximum phi"}; + o2::framework::Configurable massMinLambda{"massMinLambda", 1.f, "Minimum mass for Lambda hypothesis"}; + o2::framework::Configurable massMaxLambda{"massMaxLambda", 1.2f, "Maximum mass for Lambda hypothesis"}; + o2::framework::Configurable massMinK0short{"massMinK0short", 0.45f, "Minimum mass for K0Short hypothesis"}; + o2::framework::Configurable massMaxK0short{"massMaxK0short", 0.53f, "Maximum mass for K0Short hypothesis"}; + o2::framework::Configurable rejectMassMinLambda{"rejectMassMinLambda", 1.11f, "Minimum mass to rejection K0short hypothesis for Lambda candidates"}; + o2::framework::Configurable rejectMassMaxLambda{"rejectMassMaxLambda", 1.12f, "Maximum mass to rejection K0short hypothesis for Lambda candidates"}; + o2::framework::Configurable rejectMassMinK0short{"rejectMassMinK0short", 0.48f, "Minimum mass to rejection K0short hypothesis for Lambda candidates"}; + o2::framework::Configurable rejectMassMaxK0short{"rejectMassMaxK0short", 0.5f, "Maximum mass to rejection K0short hypothesis for Lambda candidates"}; +}; + +// selections bits for all v0s +#define V0_DEFAULT_BITS \ + o2::framework::Configurable> dcaDauMax{"dcaDauMax", {1.5f}, "Maximum DCA between the daughters at decay vertex (cm)"}; \ + o2::framework::Configurable> cpaMin{"cpaMin", {0.99f}, "Minimum cosine of pointing angle"}; \ + o2::framework::Configurable> transRadMin{"transRadMin", {0.2f}, "Minimum transverse radius (cm)"}; \ + o2::framework::Configurable> transRadMax{"transRadMax", {100.f}, "Maximum transverse radius (cm)"}; \ + o2::framework::Configurable> decayVtxMax{"decayVtxMax", {100.f}, "Maximum distance in x,y,z of the decay vertex from primary vertex (cm)"}; \ + o2::framework::Configurable> dauAbsEtaMax{"dauAbsEtaMax", {0.8f}, "Maximum |eta| for daughter tracks"}; \ + o2::framework::Configurable> dauDcaMin{"dauDcaMin", {0.05f}, "Minimum DCA of the daughters from primary vertex (cm)"}; \ + o2::framework::Configurable> dauTpcClustersMin{"dauTpcClustersMin", {80.f}, "Minimum number of TPC clusters for daughter tracks"}; + +// derived selection bits for lambda +struct ConfLambdaBits : o2::framework::ConfigurableGroup { + std::string prefix = std::string("LambdaBits"); + V0_DEFAULT_BITS + o2::framework::Configurable> posDauTpcPion{"posDauTpcPion", {5.f}, "Maximum |nsimga_Pion| TPC for positive daughter tracks"}; + o2::framework::Configurable> posDauTpcProton{"posDauTpcProton", {5.f}, "Maximum |nsimga_Proton| TPC for positive daughter tracks"}; + o2::framework::Configurable> negDauTpcPion{"negDauTpcPion", {5.f}, "Maximum |nsimga_Pion| TPC for negative daughter tracks"}; + o2::framework::Configurable> negDauTpcProton{"negDauTpcProton", {5.f}, "Maximum |nsimga_Proton| TPC negative for daughter tracks"}; +}; + +// derived selection bits for K0Short +struct ConfK0shortBits : o2::framework::ConfigurableGroup { + std::string prefix = std::string("K0shortBits"); + V0_DEFAULT_BITS + o2::framework::Configurable> posDauTpcPion{"posDauTpcPion", {5.f}, "Maximum |nsimga_Pion| TPC for positive daughter tracks"}; + o2::framework::Configurable> negDauTpcPion{"negDauTpcPion", {5.f}, "Maximum |nsimga_Pion| TPC for negative daughter tracks"}; +}; + +#undef V0_DEFAULT_BITS + +// base selection for analysis task for v0s +#define V0_DEFAULT_SELECTIONS(defaultMassMin, defaultMassMax, defaultPdgCode) \ + o2::framework::Configurable pdgCode{"pdgCode", defaultPdgCode, "V0 PDG code"}; \ + o2::framework::Configurable ptMin{"ptMin", 0.f, "Minimum pT"}; \ + o2::framework::Configurable ptMax{"ptMax", 999.f, "Maximum pT"}; \ + o2::framework::Configurable etaMin{"etaMin", -10.f, "Minimum eta"}; \ + o2::framework::Configurable etaMax{"etaMax", 10.f, "Maximum eta"}; \ + o2::framework::Configurable phiMin{"phiMin", 0.f, "Minimum eta"}; \ + o2::framework::Configurable phiMax{"phiMax", 1.f * o2::constants::math::TwoPI, "Maximum phi"}; \ + o2::framework::Configurable massMin{"massMin", defaultMassMin, "Minimum invariant mass for Lambda"}; \ + o2::framework::Configurable massMax{"massMax", defaultMassMax, "Maximum invariant mass for Lambda"}; \ + o2::framework::Configurable mask{"mask", 0, "Bitmask for v0 selection"}; + +// base selection for analysis task for lambdas +template +struct ConfLambdaSelection : o2::framework::ConfigurableGroup { + std::string prefix = Prefix; + V0_DEFAULT_SELECTIONS(1.0, 1.2, 3122) + o2::framework::Configurable sign{"sign", 1, "Sign of the Lambda (+1 for Lambda and -1 for Antilambda"}; +}; + +// base selection for analysis task for k0short +template +struct ConfK0shortSelection : o2::framework::ConfigurableGroup { + std::string prefix = Prefix; + V0_DEFAULT_SELECTIONS(0.47, 0.51, 310) +}; + +#undef V0_DEFAULT_SELECTIONS + +constexpr const char PrefixLambdaSelection1[] = "LambdaSelection1"; +using ConfLambdaSelection1 = ConfLambdaSelection; +constexpr const char PrefixK0shortSelection1[] = "K0shortSelection1"; +using ConfK0shortSelection1 = ConfK0shortSelection; + +/// The different selections for v0s +enum V0Seles { + // selections for lambdas + kCpaMin, ///< Min. CPA (cosine pointing angle) + kDcaDaughMax, ///< Max. DCA of the daughters at decay vertex + kDecayVtxMax, ///< Max. distance of decay vertex in x,y,z + kTransRadMin, ///< Min. transverse radius + kTransRadMax, ///< max. transverse radius + + // selection for daughter + kDauAbsEtaMax, ///< Max. absolute pseudo rapidity + kDauDcaMin, ///< Min. DCA of the positive daughters at primary vertex + kDauTpcClsMin, ///< Min. number of TPC clusters of positive daughter + + // pid selection for daughters + kPosDaughTpcPion, ///< TPC Pion PID for positive daughter + kPosDaughTpcProton, ///< TPC Proton PID for positive daughter + kNegDaughTpcPion, ///< TPC Pion PID for negative daughter + kNegDaughTpcProton, ///< TPC Proton PID for negative daughter + + kV0SelsMax +}; + +const char v0SelsName[] = "K0short selection object"; +const std::unordered_map v0SelsToStrings = { + {kCpaMin, "Min. CPA (cosine pointing angle)"}, + {kDcaDaughMax, "Max. DCA of the daughters at decay vertex"}, + {kDecayVtxMax, "Max. distance of decay vertex in x,y,z"}, + {kTransRadMin, "Min. transverse radius"}, + {kTransRadMax, "Max. transverse radius"}, + + {kDauAbsEtaMax, "Max. absolute pseudo rapidity"}, + {kDauDcaMin, "Min. DCA of the positive daughters at primary vertex"}, + {kDauTpcClsMin, "Min. number of TPC clusters of positive daughter"}, + + {kPosDaughTpcPion, "TPC Pion PID for positive daughter"}, + {kPosDaughTpcProton, "TPC Proton PID for positive daughter"}, + {kNegDaughTpcPion, "TPC Pion PID for negative daughter"}, + {kNegDaughTpcProton, "TPC Proton PID for negative daughter"}}; + +/// \class FemtoDreamTrackCuts +/// \brief Cut class to contain and execute all cuts applied to tracks +template +class V0Selection : public BaseSelection +{ + public: + V0Selection() {} + virtual ~V0Selection() = default; + + template + void configure(T1& config, T2& filter) + { + mPtMin = filter.ptMin.value; + mPtMax = filter.ptMax.value; + mEtaMin = filter.etaMin.value; + mEtaMax = filter.etaMax.value; + mPhiMin = filter.phiMin.value; + mPhiMax = filter.phiMax.value; + + if constexpr (modes::isEqual(v0Type, modes::V0::kLambda) || modes::isEqual(v0Type, modes::V0::kAntiLambda)) { + mMassLambdaLowerLimit = filter.massMinLambda.value; + mMassLambdaUpperLimit = filter.massMaxLambda.value; + mMassK0shortLowerLimit = filter.rejectMassMinK0short.value; + mMassK0shortUpperLimit = filter.rejectMassMaxK0short.value; + + if constexpr (modes::isEqual(v0Type, modes::V0::kLambda)) { + this->addSelection(config.posDauTpcProton.value, kPosDaughTpcProton, limits::kAbsUpperLimit, true, true); + this->addSelection(config.negDauTpcPion.value, kNegDaughTpcPion, limits::kAbsUpperLimit, true, true); + } + + if constexpr (modes::isEqual(v0Type, modes::V0::kAntiLambda)) { + this->addSelection(config.posDauTpcPion.value, kPosDaughTpcPion, limits::kAbsUpperLimit, true, true); + this->addSelection(config.negDauTpcProton.value, kNegDaughTpcProton, limits::kAbsUpperLimit, true, true); + } + } + if constexpr (modes::isEqual(v0Type, modes::V0::kK0short)) { + mMassK0shortLowerLimit = filter.massMinK0short.value; + mMassK0shortUpperLimit = filter.massMaxK0short.value; + mMassLambdaLowerLimit = filter.rejectMassMinLambda.value; + mMassLambdaUpperLimit = filter.rejectMassMaxLambda.value; + this->addSelection(config.posDauTpcPion.value, kPosDaughTpcPion, limits::kAbsUpperLimit, true, true); + this->addSelection(config.negDauTpcPion.value, kNegDaughTpcPion, limits::kAbsUpperLimit, true, true); + } + + this->addSelection(config.dcaDauMax.value, kDcaDaughMax, limits::kAbsUpperLimit, true, true); + this->addSelection(config.cpaMin.value, kCpaMin, limits::kLowerLimit, true, true); + this->addSelection(config.transRadMin.value, kTransRadMin, limits::kLowerLimit, true, true); + this->addSelection(config.transRadMax.value, kTransRadMax, limits::kUpperLimit, true, true); + this->addSelection(config.dauAbsEtaMax.value, kDauAbsEtaMax, limits::kAbsUpperLimit, true, true); + this->addSelection(config.dauDcaMin.value, kDauDcaMin, limits::kAbsLowerFunctionLimit, true, true); + this->addSelection(config.dauTpcClustersMin.value, kDauTpcClsMin, limits::kLowerLimit, true, true); + } + + template + void applySelections(T1 const& v0candidate, T2 const& /*tracks*/) + { + this->reset(); + // v0 selections + this->evaluateObservable(kCpaMin, v0candidate.v0cosPA()); + this->evaluateObservable(kDcaDaughMax, v0candidate.dcaV0daughters()); + // for decay vertex, the x,y and z coordinate have to be below a certain threshold + // compare the largest of the 3 to the limit set by the bit + std::array decayCoordinates = {std::fabs(v0candidate.x()), std::fabs(v0candidate.y()), std::fabs(v0candidate.z())}; + this->evaluateObservable(kDecayVtxMax, *std::max_element(decayCoordinates.begin(), decayCoordinates.end())); + this->evaluateObservable(kTransRadMin, v0candidate.v0radius()); + this->evaluateObservable(kTransRadMax, v0candidate.v0radius()); + + // daughter selection + // for daughter selections, both have to fit the same track quality selection, so we store only one bit for both + // take largest/smallest from both daughters and evaluate the observable with this value + auto posDaughter = v0candidate.template posTrack_as(); + auto negDaughter = v0candidate.template negTrack_as(); + + std::array etaDaughters = {std::fabs(posDaughter.eta()), std::fabs(negDaughter.eta())}; + this->evaluateObservable(kDauAbsEtaMax, *std::max_element(etaDaughters.begin(), etaDaughters.end())); + + std::array dcaDaughters = {std::hypot(posDaughter.dcaXY(), posDaughter.dcaZ()), std::hypot(negDaughter.dcaXY(), negDaughter.dcaZ())}; + this->evaluateObservable(kDauDcaMin, *std::min_element(dcaDaughters.begin(), dcaDaughters.end())); + + std::array clustersDaughters = {1.f * posDaughter.tpcNClsFound(), 1.f * negDaughter.tpcNClsFound()}; + this->evaluateObservable(kDauTpcClsMin, *std::min_element(clustersDaughters.begin(), clustersDaughters.end())); + + // daughter pid selections + this->evaluateObservable(kPosDaughTpcPion, posDaughter.tpcNSigmaPi()); + this->evaluateObservable(kPosDaughTpcProton, posDaughter.tpcNSigmaPr()); + this->evaluateObservable(kNegDaughTpcPion, negDaughter.tpcNSigmaPi()); + this->evaluateObservable(kNegDaughTpcProton, negDaughter.tpcNSigmaPr()); + + this->assembleBitmask(); + } + + template + bool checkFilters(const T& v0) const + { + return ((v0.pt() > mPtMin && v0.pt() < mPtMax) && + (v0.eta() > mEtaMin && v0.eta() < mEtaMax) && + (v0.phi() > mPhiMin && v0.phi() < mPhiMax)); + } + + template + bool checkHypothesis(T const& v0candidate) const + { + // no need to check PID of the daughters here, they are set as minimal cuts + if constexpr (modes::isEqual(v0Type, modes::V0::kLambda)) { + return (v0candidate.mLambda() > mMassLambdaLowerLimit && v0candidate.mLambda() < mMassLambdaUpperLimit) && // inside Lambda window + (v0candidate.mK0Short() < mMassK0shortLowerLimit || v0candidate.mK0Short() > mMassK0shortUpperLimit); // outside K0short window + } + if constexpr (modes::isEqual(v0Type, modes::V0::kAntiLambda)) { + return // check PID for daughters + (v0candidate.mAntiLambda() > mMassLambdaLowerLimit && v0candidate.mAntiLambda() < mMassLambdaUpperLimit) && // inside AntiLambda window + (v0candidate.mK0Short() < mMassK0shortLowerLimit || v0candidate.mK0Short() > mMassK0shortUpperLimit); // outside K0short window + } + if constexpr (modes::isEqual(v0Type, modes::V0::kK0short)) { + return (v0candidate.mK0Short() > mMassK0shortLowerLimit && v0candidate.mK0Short() < mMassK0shortUpperLimit) && // inside K0short window + (v0candidate.mLambda() < mMassLambdaLowerLimit || v0candidate.mLambda() > mMassLambdaUpperLimit) && // outside Lambda window + (v0candidate.mAntiLambda() < mMassLambdaLowerLimit || v0candidate.mAntiLambda() > mMassLambdaUpperLimit); // outside AntiLambda window + } + return false; + } + + protected: + float mMassK0shortLowerLimit = 0.483f; + float mMassK0shortUpperLimit = 0.503f; + + float mMassLambdaLowerLimit = 1.105f; + float mMassLambdaUpperLimit = 1.125f; + + // kinematic filters + float mPtMin = 0.f; + float mPtMax = 6.f; + float mEtaMin = -1.f; + float mEtaMax = 1.f; + float mPhiMin = 0.f; + float mPhiMax = o2::constants::math::TwoPI; +}; + +struct V0BuilderProducts : o2::framework::ProducesGroup { + o2::framework::Produces producedLambdas; + o2::framework::Produces producedLambdaMasks; + o2::framework::Produces producedLambdaExtras; + o2::framework::Produces producedK0shorts; + o2::framework::Produces producedK0shortMasks; + o2::framework::Produces producedK0shortExtras; +}; + +struct ConfV0Tables : o2::framework::ConfigurableGroup { + std::string prefix = std::string("V0Tables"); + o2::framework::Configurable produceLambdas{"produceLambdas", -1, "Produce Lambdas (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceLambdaMasks{"produceLambdaMasks", -1, "Produce LambdaMasks (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceLambdaExtras{"produceLambdaExtras", -1, "Produce LambdaExtras (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceK0shorts{"produceK0shorts", -1, "Produce K0shorts (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceK0shortMasks{"produceK0shortMasks", -1, "Produce K0shortMasks (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceK0shortExtras{"produceK0shortExtras", -1, "Produce K0shortExtras (-1: auto; 0 off; 1 on)"}; +}; + +template +class V0Builder +{ + public: + V0Builder() {} + virtual ~V0Builder() = default; + + template + void init(T1& config, T2& filter, T3& table, T4& initContext) + { + v0Selection.configure(config, filter); + if constexpr (modes::isEqual(v0Type, modes::V0::kLambda) || modes::isEqual(v0Type, modes::V0::kAntiLambda)) { + if constexpr (modes::isEqual(v0Type, modes::V0::kLambda)) { + LOG(info) << "Initialize femto Lambda builder..."; + } + if constexpr (modes::isEqual(v0Type, modes::V0::kAntiLambda)) { + LOG(info) << "Initialize femto AntiLambda builder..."; + } + produceLambdas = utils::enableTable("FLambdas_001", table.produceLambdas.value, initContext); + produceLambdaMasks = utils::enableTable("FLambdaMasks_001", table.produceLambdaMasks.value, initContext); + produceLambdaExtras = utils::enableTable("FLambdaExtras_001", table.produceLambdaExtras.value, initContext); + } + if constexpr (modes::isEqual(v0Type, modes::V0::kK0short)) { + LOG(info) << "Initialize femto K0short builder..."; + produceK0shorts = utils::enableTable("FK0shorts_001", table.produceK0shorts.value, initContext); + produceK0shortMasks = utils::enableTable("FK0shortMasks_001", table.produceK0shortMasks.value, initContext); + produceK0shortExtras = utils::enableTable("FK0shortExtras_001", table.produceK0shortExtras.value, initContext); + } + if (produceLambdas || produceLambdaMasks || produceLambdaExtras || produceK0shorts || produceK0shortMasks || produceK0shortExtras) { + mFillAnyTable = true; + v0Selection.printSelections(v0SelsName, v0SelsToStrings); + } else { + LOG(info) << "No tables configured"; + } + LOG(info) << "Initialization done..."; + } + + template + void fillV0s(T1& collisionProducts, T2& trackProducts, T3& v0products, T4 const& v0s, T5 const& tracks, T6& trackBuilder, T7& indexMap) + { + if (!mFillAnyTable) { + return; + } + int64_t posDaughterIndex = 0; + int64_t negDaughterIndex = 0; + for (const auto& v0 : v0s) { + if (!v0Selection.checkFilters(v0)) { + continue; + } + v0Selection.applySelections(v0, tracks); + if (v0Selection.passesAllRequiredSelections() && v0Selection.checkHypothesis(v0)) { + auto posDaughter = v0.template posTrack_as(); + auto negDaughter = v0.template negTrack_as(); + posDaughterIndex = trackBuilder.template getDaughterIndex(posDaughter, trackProducts, collisionProducts, indexMap); + negDaughterIndex = trackBuilder.template getDaughterIndex(negDaughter, trackProducts, collisionProducts, indexMap); + if constexpr (modes::isEqual(v0Type, modes::V0::kLambda)) { + fillLambda(collisionProducts, v0products, v0, 1.f, posDaughterIndex, negDaughterIndex); + } + if constexpr (modes::isEqual(v0Type, modes::V0::kAntiLambda)) { + fillLambda(collisionProducts, v0products, v0, -1.f, posDaughterIndex, negDaughterIndex); + } + if constexpr (modes::isEqual(v0Type, modes::V0::kK0short)) { + fillK0short(collisionProducts, v0products, v0, posDaughterIndex, negDaughterIndex); + } + } + } + } + + template + void fillLambda(T1& collisionProducts, T2& v0products, T3 const& v0, float sign, int posDaughterIndex, int negDaughterIndex) + { + float mass, massAnti; + if (sign > 0.f) { + mass = v0.mLambda(); + massAnti = v0.mAntiLambda(); + } else { + mass = v0.mAntiLambda(); + massAnti = v0.mLambda(); + } + if (produceLambdas) { + v0products.producedLambdas(collisionProducts.producedCollision.lastIndex(), + sign * v0.pt(), + v0.eta(), + v0.phi(), + mass, + posDaughterIndex, + negDaughterIndex); + } + if (produceLambdaMasks) { + v0products.producedLambdaMasks(v0Selection.getBitmask()); + } + if (produceLambdaExtras) { + v0products.producedLambdaExtras( + massAnti, + v0.mK0Short(), + v0.v0cosPA(), + v0.dcaV0daughters(), + v0.v0radius(), + v0.x(), + v0.y(), + v0.z()); + } + } + + template + void fillK0short(T1& collisionProducts, T2& v0products, T3 const& v0, int posDaughterIndex, int negDaughterIndex) + { + if (produceK0shorts) { + v0products.producedK0shorts(collisionProducts.producedCollision.lastIndex(), + v0.pt(), + v0.eta(), + v0.phi(), + v0.mK0Short(), + posDaughterIndex, + negDaughterIndex); + } + if (produceK0shortMasks) { + v0products.producedK0shortMasks(v0Selection.getBitmask()); + } + if (produceK0shortExtras) { + v0products.producedK0shortExtras( + v0.mLambda(), + v0.mAntiLambda(), + v0.v0cosPA(), + v0.dcaV0daughters(), + v0.v0radius(), + v0.x(), + v0.y(), + v0.z()); + } + } + + bool fillAnyTable() { return mFillAnyTable; } + + private: + V0Selection v0Selection; + bool mFillAnyTable = false; + bool produceLambdas = false; + bool produceLambdaMasks = false; + bool produceLambdaExtras = false; + bool produceK0shorts = false; + bool produceK0shortMasks = false; + bool produceK0shortExtras = false; +}; +} // namespace v0builder +} // namespace o2::analysis::femto +#endif // PWGCF_FEMTO_CORE_V0BUILDER_H_ diff --git a/PWGCF/Femto/Core/v0HistManager.h b/PWGCF/Femto/Core/v0HistManager.h new file mode 100644 index 00000000000..7dc732b84b1 --- /dev/null +++ b/PWGCF/Femto/Core/v0HistManager.h @@ -0,0 +1,334 @@ +// Copyright 2019-2025 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 v0HistManager.h +/// \brief histogram manager for vzero histograms +/// \author Anton Riedel, TU München, anton.riedel@cern.ch + +#ifndef PWGCF_FEMTO_CORE_V0HISTMANAGER_H_ +#define PWGCF_FEMTO_CORE_V0HISTMANAGER_H_ + +#include "PWGCF/Femto/Core/histManager.h" +#include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/trackHistManager.h" + +#include "CommonConstants/MathConstants.h" +#include "Framework/Configurable.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/HistogramSpec.h" + +#include +#include +#include +#include +#include + +namespace o2::analysis::femto +{ +namespace v0histmanager +{ +// enum for track histograms +enum V0Hist { + // analysis + kPt, + kEta, + kPhi, + kMass, + kSign, + // qa variables + kMassLambda, + kMassAntiLambda, + kMassK0short, + kCosPa, + kDecayDauDca, + kDecayVtxX, + kDecayVtxY, + kDecayVtxZ, + kDecayVtx, + kTransRadius, + // 2d qa + kPtVsEta, + kPtVsPhi, + kPhiVsEta, + kPtVsCosPa, + kPtVsLambdaMass, + kPtVsAntiLambdaMass, + kPtVsK0shortMass, + kLambdaMassVsAntiLambdaMass, + kK0shortMassVsLambdaMass, + kK0shortMassVsAntiLambdaMass, + kV0HistLast +}; + +#define V0_DEFAULT_BINNING(defaultMassMin, defaultMassMax) \ + o2::framework::ConfigurableAxis pt{"pt", {{600, 0, 6}}, "Pt"}; \ + o2::framework::ConfigurableAxis eta{"eta", {{300, -1.5, 1.5}}, "Eta"}; \ + o2::framework::ConfigurableAxis phi{"phi", {{720, 0, 1.f * o2::constants::math::TwoPI}}, "Phi"}; \ + o2::framework::ConfigurableAxis mass{"mass", {{200, defaultMassMin, defaultMassMax}}, "Mass"}; \ + o2::framework::ConfigurableAxis sign{"sign", {{3, -1.5, 1.5}}, "Sign"}; + +template +struct ConfLambdaBinning : o2::framework::ConfigurableGroup { + std::string prefix = Prefix; + V0_DEFAULT_BINNING(1.0, 1.2) +}; +template +struct ConfK0shortBinning : o2::framework::ConfigurableGroup { + std::string prefix = Prefix; + V0_DEFAULT_BINNING(0.475, 0.515) +}; +#undef V0_DEFAULT_BINNING + +constexpr const char PrefixLambdaBinning1[] = "LambdaBinning1"; +using ConfLambdaBinning1 = ConfLambdaBinning; +constexpr const char PrefixK0shortBinning1[] = "K0shortBinning1"; +using ConfK0shortBinning1 = ConfK0shortBinning; + +template +struct ConfV0QaBinning : o2::framework::ConfigurableGroup { + std::string prefix = Prefix; + o2::framework::ConfigurableAxis cosPa{"cosPa", {{100, 0.9, 1}}, "Cosine of poiting angle"}; + o2::framework::ConfigurableAxis dauDcaAtDecay{"dauDcaAtDecay", {{150, 0, 1.5}}, "Daughter DCA at decay vertex"}; + o2::framework::ConfigurableAxis decayVertex{"decayVertex", {{100, 0, 100}}, "Decay vertex"}; + o2::framework::ConfigurableAxis transRadius{"transRadius", {{100, 0, 100}}, "Transverse radius"}; + o2::framework::ConfigurableAxis massLambda{"massLambda", {{200, 1, 1.2}}, "mass for antiparticle hypothesis"}; + o2::framework::ConfigurableAxis massAntiLambda{"massAntiLambda", {{100, 1, 1.2}}, "mass for antiparticle hypothesis"}; + o2::framework::ConfigurableAxis massK0short{"massK0short", {{200, 0.45, 0.55}}, "Mass for k0short hypothesis"}; +}; + +constexpr const char PrefixLambdaQaBinning1[] = "LambdaQaBinning1"; +using ConfLambdaQaBinning1 = ConfV0QaBinning; + +constexpr const char PrefixK0shortQaBinning1[] = "K0shortQaBinning1"; +using ConfK0shortQaBinning1 = ConfV0QaBinning; + +// must be in sync with enum TrackVariables +// the enum gives the correct index in the array +constexpr std::array, kV0HistLast> HistTable = { + {{kPt, o2::framework::kTH1F, "hPt", "Transverse Momentum; p_{T} (GeV/#it{c}); Entries"}, + {kEta, o2::framework::kTH1F, "hEta", "Pseudorapdity; #eta; Entries"}, + {kPhi, o2::framework::kTH1F, "hPhi", "Azimuthal angle; #varphi; Entries"}, + {kMass, o2::framework::kTH1F, "hMass", "Invariant Mass; m_{Inv} (GeV/#it{c}^{2}); Entries"}, + {kSign, o2::framework::kTH1F, "hSign", "Sign (-1 -> antiparticle, 0 -> self conjugate, +1 -> particle); sign; Entries"}, + {kMassLambda, o2::framework::kTH1F, "hMassLambda", "#Lambda mass; m_{p#pi^{-}} (GeV/#it{c}^{2}); Entries"}, + {kMassAntiLambda, o2::framework::kTH1F, "hMassAntiLambda", "#bar{#Lambda} mass; m_{#bar{p}#pi^{+}} (GeV/#it{c}^{2}); Entries"}, + {kMassK0short, o2::framework::kTH1F, "hMassK0short", "K^{0}_{s} mass; m_{#pi^{+}#pi^{-}} (GeV/#it{c}^{2}); Entries"}, + {kCosPa, o2::framework::kTH1F, "hCosPa", "Cosine of pointing angle; coa(#alpha); Entries"}, + {kDecayDauDca, o2::framework::kTH1F, "hDauDca", "Daughter DCA at decay vertex ; DCA_{Decay vertex} (cm); Entries"}, + {kDecayVtxX, o2::framework::kTH1F, "hDecayVtxX", "X coordinate of decay vertex ; DV_{X} (cm); Entries"}, + {kDecayVtxY, o2::framework::kTH1F, "hDecayVtxY", "Y coordinate of decay vertex ; DV_{Y} (cm); Entries"}, + {kDecayVtxZ, o2::framework::kTH1F, "hDecayVtxZ", "Z coordinate of decay vertex ; DV_{Z} (cm); Entries"}, + {kDecayVtx, o2::framework::kTH1F, "hDecayVtx", "Distance of decay vertex from primary vertex ; DV (cm); Entries"}, + {kTransRadius, o2::framework::kTH1F, "hTransRadius", "Transverse radius ; r_{xy} (cm); Entries"}, + {kPtVsEta, o2::framework::kTH2F, "hPtVsEta", "p_{T} vs #eta; p_{T} (GeV/#it{c}) ; #eta"}, + {kPtVsPhi, o2::framework::kTH2F, "hPtVsPhi", "p_{T} vs #varphi; p_{T} (GeV/#it{c}) ; #varphi"}, + {kPhiVsEta, o2::framework::kTH2F, "hPhiVsEta", "#varphi vs #eta; #varphi ; #eta"}, + {kPtVsCosPa, o2::framework::kTH2F, "hPtVsCosPa", "Cosine of poiting angle vs p_{T}; cos(#alpha); p_{T} (GeV/#it{c})"}, + {kPtVsLambdaMass, o2::framework::kTH2F, "hPtVsLambdaMass", "p_{T} vs #Lambda mass; p_{T} (GeV/#it{c}); m_{p#pi^{-}} (GeV/#it{c}^{2})"}, + {kPtVsAntiLambdaMass, o2::framework::kTH2F, "hPtVsAntiLambdaMass", "p_{T} vs #bar{#Lambda} mass; p_{T} (GeV/#it{c}); m_{#bar{p}#pi^{+}} (GeV/#it{c}^{2})"}, + {kPtVsK0shortMass, o2::framework::kTH2F, "hPtVsK0shortMass", "p_{T} vs K^{0}_{S} mass; p_{T} (GeV/#it{c}); m_{#pi^{+}#pi^{-}} (GeV/#it{c}^{2})"}, + {kK0shortMassVsLambdaMass, o2::framework::kTH2F, "hK0shortMassVsLambdaMass", " K^{0}_{S} mass vs #Lambda mass; m_{#pi^{+}#pi^{-}} (GeV/#it{c}^{2}); m_{p#pi^{-}} (GeV/#it{c}^{2})"}, + {kK0shortMassVsAntiLambdaMass, o2::framework::kTH2F, "hK0shortMassVsAntiLambdaMass", "K^{0}_{S} mass vs #bar{#Lambda} mass; m_{#pi^{+}#pi^{-}} (GeV/#it{c}^{2}); m_{#bar{p}#pi^{+}} (GeV/#it{c}^{2})"}, + {kLambdaMassVsAntiLambdaMass, o2::framework::kTH2F, "hLambdaMassVsAntiLambdaMass", "#Lambda mass vs #bar{#Lambda}; m_{p#pi^{-}} (GeV/#it{c}^{2}); m_{#bar{p}#pi^{+}} (GeV/#it{c}^{2})"}}}; + +template +auto makeV0HistSpecMap(const T& confBinningAnalysis) +{ + return std::map>{ + {kPt, {confBinningAnalysis.pt}}, + {kEta, {confBinningAnalysis.eta}}, + {kPhi, {confBinningAnalysis.phi}}, + {kMass, {confBinningAnalysis.mass}}, + {kSign, {confBinningAnalysis.sign}}}; +} + +template +std::map> makeV0QaHistSpecMap(T1 const& confBinningAnalysis, T2 const& confBinningQa) +{ + return std::map>{ + {kPt, {confBinningAnalysis.pt}}, + {kEta, {confBinningAnalysis.eta}}, + {kPhi, {confBinningAnalysis.phi}}, + {kMass, {confBinningAnalysis.mass}}, + {kSign, {confBinningAnalysis.sign}}, + {kCosPa, {confBinningQa.cosPa}}, + {kDecayDauDca, {confBinningQa.dauDcaAtDecay}}, + {kDecayVtxX, {confBinningQa.decayVertex}}, + {kDecayVtxY, {confBinningQa.decayVertex}}, + {kDecayVtxZ, {confBinningQa.decayVertex}}, + {kDecayVtx, {confBinningQa.decayVertex}}, + {kTransRadius, {confBinningQa.transRadius}}, + {kPtVsEta, {confBinningAnalysis.pt, confBinningAnalysis.eta}}, + {kPtVsPhi, {confBinningAnalysis.pt, confBinningAnalysis.phi}}, + {kPhiVsEta, {confBinningAnalysis.phi, confBinningAnalysis.eta}}, + {kPtVsCosPa, {confBinningAnalysis.pt, confBinningQa.cosPa}}, + {kMassLambda, {confBinningQa.massLambda}}, + {kMassAntiLambda, {confBinningQa.massAntiLambda}}, + {kMassK0short, {confBinningQa.massK0short}}, + {kPtVsLambdaMass, {confBinningAnalysis.pt, confBinningQa.massLambda}}, + {kPtVsAntiLambdaMass, {confBinningAnalysis.pt, confBinningQa.massAntiLambda}}, + {kPtVsK0shortMass, {confBinningAnalysis.pt, confBinningQa.massK0short}}, + {kLambdaMassVsAntiLambdaMass, {confBinningQa.massLambda, confBinningQa.massAntiLambda}}, + {kK0shortMassVsLambdaMass, {confBinningQa.massK0short, confBinningQa.massLambda}}, + {kK0shortMassVsAntiLambdaMass, {confBinningQa.massK0short, confBinningQa.massAntiLambda}}}; +}; + +constexpr char PrefixLambdaQa[] = "LambdaQA/"; +constexpr char PrefixLambda[] = "Lambda/"; +constexpr char PrefixK0shortQa[] = "K0shortQa/"; +constexpr char PrefixK0short[] = "K0short/"; + +constexpr char PrefixLambdaCascade[] = "LambdaCascadeQa/"; + +constexpr std::string_view AnalysisDir = "Kinematics/"; +constexpr std::string_view QaDir = "QA/"; + +/// \class FemtoDreamEventHisto +/// \brief Class for histogramming event properties +// template +template +class V0HistManager +{ + public: + /// Destructor + virtual ~V0HistManager() = default; + /// Initializes histograms for the task + /// \param registry Histogram registry to be passed + /// + void init(o2::framework::HistogramRegistry* registry, + std::map> V0Specs, + std::map> PosDauSpecs, + std::map> NegDauSpecs) + { + mHistogramRegistry = registry; + mPosDauManager.init(registry, PosDauSpecs); + mNegDauManager.init(registry, NegDauSpecs); + + if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { + std::string analysisDir = std::string(v0Prefix) + std::string(AnalysisDir); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kPt, HistTable), GetHistDesc(kPt, HistTable), GetHistType(kPt, HistTable), {V0Specs[kPt]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kEta, HistTable), GetHistDesc(kEta, HistTable), GetHistType(kEta, HistTable), {V0Specs[kEta]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kPhi, HistTable), GetHistDesc(kPhi, HistTable), GetHistType(kPhi, HistTable), {V0Specs[kPhi]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kMass, HistTable), GetHistDesc(kMass, HistTable), GetHistType(kMass, HistTable), {V0Specs[kMass]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kSign, HistTable), GetHistDesc(kSign, HistTable), GetHistType(kSign, HistTable), {V0Specs[kSign]}); + } + + if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { + std::string qaDir = std::string(v0Prefix) + std::string(QaDir); + + mHistogramRegistry->add(qaDir + GetHistNamev2(kCosPa, HistTable), GetHistDesc(kCosPa, HistTable), GetHistType(kCosPa, HistTable), {V0Specs[kCosPa]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kDecayDauDca, HistTable), GetHistDesc(kDecayDauDca, HistTable), GetHistType(kDecayDauDca, HistTable), {V0Specs[kDecayDauDca]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kDecayVtxX, HistTable), GetHistDesc(kDecayVtxX, HistTable), GetHistType(kDecayVtxX, HistTable), {V0Specs[kDecayVtxX]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kDecayVtxY, HistTable), GetHistDesc(kDecayVtxY, HistTable), GetHistType(kDecayVtxY, HistTable), {V0Specs[kDecayVtxY]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kDecayVtxZ, HistTable), GetHistDesc(kDecayVtxZ, HistTable), GetHistType(kDecayVtxZ, HistTable), {V0Specs[kDecayVtxZ]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kDecayVtx, HistTable), GetHistDesc(kDecayVtx, HistTable), GetHistType(kDecayVtx, HistTable), {V0Specs[kDecayVtx]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kTransRadius, HistTable), GetHistDesc(kTransRadius, HistTable), GetHistType(kTransRadius, HistTable), {V0Specs[kTransRadius]}); + + // qa 2d + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsEta, HistTable), GetHistDesc(kPtVsEta, HistTable), GetHistType(kPtVsEta, HistTable), {V0Specs[kPtVsEta]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsPhi, HistTable), GetHistDesc(kPtVsPhi, HistTable), GetHistType(kPtVsPhi, HistTable), {V0Specs[kPtVsPhi]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPhiVsEta, HistTable), GetHistDesc(kPhiVsEta, HistTable), GetHistType(kPhiVsEta, HistTable), {V0Specs[kPhiVsEta]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsCosPa, HistTable), GetHistDesc(kPtVsCosPa, HistTable), GetHistType(kPtVsCosPa, HistTable), {V0Specs[kPtVsCosPa]}); + + mHistogramRegistry->add(qaDir + GetHistNamev2(kMassLambda, HistTable), GetHistDesc(kMassLambda, HistTable), GetHistType(kMassLambda, HistTable), {V0Specs[kMassLambda]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kMassAntiLambda, HistTable), GetHistDesc(kMassAntiLambda, HistTable), GetHistType(kMassAntiLambda, HistTable), {V0Specs[kMassAntiLambda]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kMassK0short, HistTable), GetHistDesc(kMassK0short, HistTable), GetHistType(kMassK0short, HistTable), {V0Specs[kMassK0short]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsLambdaMass, HistTable), GetHistDesc(kPtVsLambdaMass, HistTable), GetHistType(kPtVsLambdaMass, HistTable), {V0Specs[kPtVsLambdaMass]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsAntiLambdaMass, HistTable), GetHistDesc(kPtVsAntiLambdaMass, HistTable), GetHistType(kPtVsAntiLambdaMass, HistTable), {V0Specs[kPtVsAntiLambdaMass]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsK0shortMass, HistTable), GetHistDesc(kPtVsK0shortMass, HistTable), GetHistType(kPtVsK0shortMass, HistTable), {V0Specs[kPtVsK0shortMass]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kLambdaMassVsAntiLambdaMass, HistTable), GetHistDesc(kLambdaMassVsAntiLambdaMass, HistTable), GetHistType(kLambdaMassVsAntiLambdaMass, HistTable), {V0Specs[kLambdaMassVsAntiLambdaMass]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kK0shortMassVsLambdaMass, HistTable), GetHistDesc(kK0shortMassVsLambdaMass, HistTable), GetHistType(kK0shortMassVsLambdaMass, HistTable), {V0Specs[kK0shortMassVsLambdaMass]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kK0shortMassVsAntiLambdaMass, HistTable), GetHistDesc(kK0shortMassVsAntiLambdaMass, HistTable), GetHistType(kK0shortMassVsAntiLambdaMass, HistTable), {V0Specs[kK0shortMassVsAntiLambdaMass]}); + } + } + + template + void fill(T1 const& v0candidate, T2 const& /*tracks*/) + { + + auto posDaughter = v0candidate.template posDau_as(); + mPosDauManager.fill(posDaughter); + auto negDaughter = v0candidate.template negDau_as(); + mNegDauManager.fill(negDaughter); + + if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(GetHistName(kPt, HistTable)), v0candidate.pt()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(GetHistName(kEta, HistTable)), v0candidate.eta()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(GetHistName(kPhi, HistTable)), v0candidate.phi()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(GetHistName(kMass, HistTable)), v0candidate.mass()); + + if constexpr (modes::isEqual(v0, modes::V0::kLambda) || modes::isEqual(v0, modes::V0::kAntiLambda)) { + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(GetHistName(kSign, HistTable)), v0candidate.sign()); + } + if constexpr (modes::isEqual(v0, modes::V0::kK0short)) { + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(GetHistName(kSign, HistTable)), 0); + } + } + + if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kCosPa, HistTable)), v0candidate.cosPa()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kDecayDauDca, HistTable)), v0candidate.dauDca()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kDecayVtxX, HistTable)), v0candidate.decayVtxX()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kDecayVtxY, HistTable)), v0candidate.decayVtxY()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kDecayVtxZ, HistTable)), v0candidate.decayVtxZ()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kDecayVtx, HistTable)), v0candidate.decayVtx()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kTransRadius, HistTable)), v0candidate.transRadius()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsEta, HistTable)), v0candidate.pt(), v0candidate.eta()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsPhi, HistTable)), v0candidate.pt(), v0candidate.phi()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kPhiVsEta, HistTable)), v0candidate.phi(), v0candidate.eta()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsCosPa, HistTable)), v0candidate.pt(), v0candidate.cosPa()); + + if constexpr (modes::isEqual(v0, modes::V0::kLambda) || modes::isEqual(v0, modes::V0::kAntiLambda)) { + float massLambda, massAntiLambda; + if (v0candidate.sign() > 0) { + massLambda = v0candidate.mass(); + massAntiLambda = v0candidate.massAnti(); + } else { + massLambda = v0candidate.massAnti(); + massAntiLambda = v0candidate.mass(); + } + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kMassLambda, HistTable)), massLambda); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kMassAntiLambda, HistTable)), massAntiLambda); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kMassK0short, HistTable)), v0candidate.massK0short()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsLambdaMass, HistTable)), v0candidate.pt(), massLambda); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsAntiLambdaMass, HistTable)), v0candidate.pt(), massAntiLambda); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsK0shortMass, HistTable)), v0candidate.pt(), v0candidate.massK0short()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kLambdaMassVsAntiLambdaMass, HistTable)), massLambda, massAntiLambda); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kK0shortMassVsLambdaMass, HistTable)), v0candidate.massK0short(), massLambda); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kK0shortMassVsAntiLambdaMass, HistTable)), v0candidate.massK0short(), massAntiLambda); + } + if constexpr (modes::isEqual(v0, modes::V0::kK0short)) { + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kMassLambda, HistTable)), v0candidate.massLambda()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kMassAntiLambda, HistTable)), v0candidate.massAntiLambda()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kMassK0short, HistTable)), v0candidate.mass()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsLambdaMass, HistTable)), v0candidate.pt(), v0candidate.massLambda()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsAntiLambdaMass, HistTable)), v0candidate.pt(), v0candidate.massAntiLambda()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsK0shortMass, HistTable)), v0candidate.pt(), v0candidate.mass()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kLambdaMassVsAntiLambdaMass, HistTable)), v0candidate.massLambda(), v0candidate.massAntiLambda()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kK0shortMassVsLambdaMass, HistTable)), v0candidate.mass(), v0candidate.massLambda()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kK0shortMassVsAntiLambdaMass, HistTable)), v0candidate.mass(), v0candidate.massAntiLambda()); + } + } + } + + private: + o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; + + trackhistmanager::TrackHistManager mPosDauManager; + trackhistmanager::TrackHistManager mNegDauManager; +}; +}; // namespace v0histmanager +}; // namespace o2::analysis::femto +#endif // PWGCF_FEMTO_CORE_V0HISTMANAGER_H_ diff --git a/PWGCF/Femto/DataModel/CMakeLists.txt b/PWGCF/Femto/DataModel/CMakeLists.txt new file mode 100644 index 00000000000..4c182222bf2 --- /dev/null +++ b/PWGCF/Femto/DataModel/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright 2019-2024 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. diff --git a/PWGCF/Femto/DataModel/FemtoTables.h b/PWGCF/Femto/DataModel/FemtoTables.h new file mode 100644 index 00000000000..e96708d657d --- /dev/null +++ b/PWGCF/Femto/DataModel/FemtoTables.h @@ -0,0 +1,575 @@ +// Copyright 2019-2025 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 FemtoTables.h +/// \brief Datamodel for femto analysis +/// \author Anton Riedel, TU München, anton.riedel@cern.ch + +#ifndef PWGCF_FEMTO_DATAMODEL_FEMTOTABLES_H_ +#define PWGCF_FEMTO_DATAMODEL_FEMTOTABLES_H_ + +#include "PWGCF/Femto/Core/dataTypes.h" + +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" + +#include "Framework/ASoA.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/Expressions.h" + +#include +#include + +namespace o2::aod +{ + +namespace femtocollisions +{ +DECLARE_SOA_COLUMN(PosX, posX, float); //! x coordinate of vertex +DECLARE_SOA_COLUMN(PosY, posY, float); //! y coordinate of vertex +DECLARE_SOA_COLUMN(PosZ, posZ, float); //! z coordinate of vertex +DECLARE_SOA_COLUMN(Mult, mult, float); //! Multiplicity estimator set by producer +DECLARE_SOA_COLUMN(Cent, cent, float); //! Centrality (~= multiplicity percentile) estimator set by producer +DECLARE_SOA_COLUMN(MagField, magField, float); //! Magnetic field of the event +DECLARE_SOA_COLUMN(Sphericity, sphericity, float); //! Sphericity of the event +DECLARE_SOA_COLUMN(Occupancy, occupancy, float); //! occupancy of the event +DECLARE_SOA_COLUMN(Qn, qn, float); //! qn bins for dividing events +} // namespace femtocollisions + +// table for basic collision information +DECLARE_SOA_TABLE_STAGED_VERSIONED(FCols_001, "FCOL", 1, //! femto collisions + o2::soa::Index<>, + femtocollisions::PosZ, + femtocollisions::Mult, + femtocollisions::Cent, + femtocollisions::Sphericity, + femtocollisions::MagField); +using FCols = FCols_001; + +// table for occupancy +DECLARE_SOA_TABLE_STAGED_VERSIONED(FColOccs_001, "FCOLOCC", 1, //! occupancy + femtocollisions::Occupancy); +using FColOccs = FColOccs_001; + +// table for qn values +DECLARE_SOA_TABLE_STAGED_VERSIONED(FColQns_001, "FCOLQN", 1, //! qn vector + femtocollisions::Qn); +using FColQns = FColQns_001; + +// table for primary vertex location +DECLARE_SOA_TABLE_STAGED_VERSIONED(FColPos_001, "FCOLPOS", 1, //! full vertex position + femtocollisions::PosX, + femtocollisions::PosY); +using FColPos = FColPos_001; + +// table for different multiplicity estimators +DECLARE_SOA_TABLE_STAGED_VERSIONED(FColMults_001, "FCOLMULT", 1, //! multiplicities + mult::MultFT0A, mult::MultFT0C, //! FIT detectors + mult::MultNTracksPVeta1, //! number of PV contribs total + mult::MultNTracksPVetaHalf, //! global track multiplicities + evsel::NumTracksInTimeRange, //! occupancy (number of track in time range) + evsel::SumAmpFT0CInTimeRange); //! occupancy (FT0C amplitude in time range) +using FColMults = FColMults_001; + +// table for different centrality (multiplicity percentile) estimators +DECLARE_SOA_TABLE_STAGED_VERSIONED(FColCents_001, "FCOLCENT", 1, //! centralities + cent::CentFT0A, //! centrality from FT0A + cent::CentFT0C); //! centrality from FT0C +using FColCents = FColCents_001; + +namespace femtobase +// all "basic" information to perform femto analysis, i.e. collision index and kinematics +// split kinematics in stored, i.e. stored in derived data, and dynmaic, i.e. can be computed on the fly +{ +namespace stored +{ +// static columns +DECLARE_SOA_INDEX_COLUMN(Collision, collision); //! collision index +DECLARE_SOA_COLUMN(SignedPt, signedPt, float); //! signed pt +DECLARE_SOA_COLUMN(Pt, pt, float); //! pt +DECLARE_SOA_COLUMN(Eta, eta, float); //! eta +DECLARE_SOA_COLUMN(Phi, phi, float); //! phi +DECLARE_SOA_COLUMN(Mass, mass, float); //! mass of particle +DECLARE_SOA_COLUMN(MassAnti, massAnti, float); //! mass of antiparticle +} // namespace stored + +namespace dynamic +{ +// dynamic columns +DECLARE_SOA_DYNAMIC_COLUMN(Sign, sign, //! sign of the track + [](float signedPt) -> int { + return signedPt > 0.f ? 1 : -1; + }); +DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, //! transverse momentum + [](float signedPt) -> float { + return std::fabs(signedPt); + }); +// use fabs for pt so it can also be used with signed pt +DECLARE_SOA_DYNAMIC_COLUMN(Px, px, //! momentum in x + [](float pt, float phi) -> float { + return std::fabs(pt) * std::sin(phi); + }); +DECLARE_SOA_DYNAMIC_COLUMN(Py, py, //! momentum in y + [](float pt, float phi) -> float { + return std::fabs(pt) * std::cos(phi); + }); +DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, //! momentum in z + [](float pt, float eta) -> float { + return std::fabs(pt) * std::sinh(eta); + }); +DECLARE_SOA_DYNAMIC_COLUMN(P, p, //! momentum + [](float pt, float eta) -> float { + return std::fabs(pt) * std::cosh(eta); + }); +DECLARE_SOA_DYNAMIC_COLUMN(Theta, theta, //! theta + [](float eta) -> float { + return 2.f * std::atan(std::exp(-eta)); + }); +} // namespace dynamic +} // namespace femtobase + +namespace femtotracks +{ +// columns for track selections +DECLARE_SOA_COLUMN(TrackMask, trackMask, femtodatatypes::TrackMaskType); //! Bitmask for track selections + +// columns for DCA +DECLARE_SOA_COLUMN(DcaXY, dcaXY, float); //! Dca in XY plane +DECLARE_SOA_COLUMN(DcaZ, dcaZ, float); //! Dca in Z direction +DECLARE_SOA_DYNAMIC_COLUMN(Dca, dca, [](float dcaXY, float dcaZ) -> float { return std::hypot(dcaXY, dcaZ); }); //! Dca + +// its related information +DECLARE_SOA_COLUMN(IsPVContributor, isPVContributor, bool); //! True if track is PV contributer +DECLARE_SOA_COLUMN(ItsNCls, itsNCls, uint8_t); //! Number of Its clusters (max 7) +DECLARE_SOA_COLUMN(ItsNClsInnerBarrel, itsNClsInnerBarrel, uint8_t); //! Number of Its clusters in the inner barrel (max 3) +DECLARE_SOA_COLUMN(ItsChi2NCl, itsChi2NCl, float); //! Its chi2 / cluster +DECLARE_SOA_COLUMN(ItsClusterSizes, itsClusterSizes, uint32_t); //! Its cluster sizes (4 bits per layer) + +// tpc related information +DECLARE_SOA_COLUMN(TpcSignal, tpcSignal, float); //! Tpc signal +DECLARE_SOA_COLUMN(TpcInnerParam, tpcInnerParam, bool); //! Momentum at inner wall of Tpc +DECLARE_SOA_COLUMN(TpcNClsFound, tpcNClsFound, uint8_t); //! Number of Tpc clusters +DECLARE_SOA_COLUMN(TpcNClsCrossedRows, tpcNClsCrossedRows, uint8_t); //! Number of Tpc crossed rows +DECLARE_SOA_DYNAMIC_COLUMN(TpcCrossedRowsOverFound, tpcCrossedRowsOverFound, //! Number of crossed rows over found Tpc clusters + [](uint8_t tpcNClsFound, uint8_t tpcNClsCrossedRows) -> float { return static_cast(tpcNClsCrossedRows) / static_cast(tpcNClsFound); }); +DECLARE_SOA_COLUMN(TpcNClsShared, tpcNClsShared, uint8_t); //! Number of shared Tpc clusters +DECLARE_SOA_DYNAMIC_COLUMN(TpcSharedOverFound, tpcSharedOverFound, //! Number of crossed rows over found Tpc clusters + [](uint8_t tpcNclsFound, uint8_t tpcNClsShared) -> float { return static_cast(tpcNClsShared) / static_cast(tpcNclsFound); }); +DECLARE_SOA_COLUMN(TpcChi2NCl, tpcChi2NCl, float); //! Tpc chi2 + +// tof related information +DECLARE_SOA_COLUMN(TofBeta, tofBeta, float); //! Tof beta +DECLARE_SOA_COLUMN(TofMass, tofMass, float); //! Tof mass + +// PID information +// ITS PID information +DECLARE_SOA_COLUMN(ItsNSigmaEl, itsNSigmaEl, float); //! Nsigma separation with the Its for electron +DECLARE_SOA_COLUMN(ItsNSigmaPi, itsNSigmaPi, float); //! Nsigma separation with the Its for pion +DECLARE_SOA_COLUMN(ItsNSigmaKa, itsNSigmaKa, float); //! Nsigma separation with the Its for kaon +DECLARE_SOA_COLUMN(ItsNSigmaPr, itsNSigmaPr, float); //! Nsigma separation with the Its for proton +DECLARE_SOA_COLUMN(ItsNSigmaDe, itsNSigmaDe, float); //! Nsigma separation with the Its for deuteron +DECLARE_SOA_COLUMN(ItsNSigmaTr, itsNSigmaTr, float); //! Nsigma separation with the Its for triton +DECLARE_SOA_COLUMN(ItsNSigmaHe, itsNSigmaHe, float); //! Nsigma separation with the Its for helium3 + +// TPC PID information +DECLARE_SOA_COLUMN(TpcNSigmaEl, tpcNSigmaEl, float); //! Nsigma separation with the Tpc for electron +DECLARE_SOA_COLUMN(TpcNSigmaPi, tpcNSigmaPi, float); //! Nsigma separation with the Tpc for pion +DECLARE_SOA_COLUMN(TpcNSigmaKa, tpcNSigmaKa, float); //! Nsigma separation with the Tpc for kaon +DECLARE_SOA_COLUMN(TpcNSigmaPr, tpcNSigmaPr, float); //! Nsigma separation with the Tpc for proton +DECLARE_SOA_COLUMN(TpcNSigmaDe, tpcNSigmaDe, float); //! Nsigma separation with the Tpc for deuteron +DECLARE_SOA_COLUMN(TpcNSigmaTr, tpcNSigmaTr, float); //! Nsigma separation with the Tpc for triton +DECLARE_SOA_COLUMN(TpcNSigmaHe, tpcNSigmaHe, float); //! Nsigma separation with the Tpc for helium3 + +// TOF PID information +DECLARE_SOA_COLUMN(TofNSigmaEl, tofNSigmaEl, float); //! Nsigma separation with the Tof for electron +DECLARE_SOA_COLUMN(TofNSigmaPi, tofNSigmaPi, float); //! Nsigma separation with the Tof for pion +DECLARE_SOA_COLUMN(TofNSigmaKa, tofNSigmaKa, float); //! Nsigma separation with the Tof for kaon +DECLARE_SOA_COLUMN(TofNSigmaPr, tofNSigmaPr, float); //! Nsigma separation with the Tof for proton +DECLARE_SOA_COLUMN(TofNSigmaDe, tofNSigmaDe, float); //! Nsigma separation with the Tof for deuteron +DECLARE_SOA_COLUMN(TofNSigmaTr, tofNSigmaTr, float); //! Nsigma separation with the Tof for triton +DECLARE_SOA_COLUMN(TofNSigmaHe, tofNSigmaHe, float); //! Nsigma separation with the Tof for helium3 + +DECLARE_SOA_DYNAMIC_COLUMN(TpcitsNSigmaEl, tpcitsNSigmaEl, [](float tpc, float its) -> float { return std::hypot(tpc, its); }); //! Combined Nsigma separation with Tpc and Its for electon +DECLARE_SOA_DYNAMIC_COLUMN(TpcitsNSigmaPi, tpcitsNSigmaPi, [](float tpc, float its) -> float { return std::hypot(tpc, its); }); //! Combined Nsigma separation with Tpc and Its for pion +DECLARE_SOA_DYNAMIC_COLUMN(TpcitsNSigmaKa, tpcitsNSigmaKa, [](float tpc, float its) -> float { return std::hypot(tpc, its); }); //! Combined Nsigma separation with Tpc and Its for kaon +DECLARE_SOA_DYNAMIC_COLUMN(TpcitsNSigmaPr, tpcitsNSigmaPr, [](float tpc, float its) -> float { return std::hypot(tpc, its); }); //! Combined Nsigma separation with Tpc and Its for proton +DECLARE_SOA_DYNAMIC_COLUMN(TpcitsNSigmaDe, tpcitsNSigmaDe, [](float tpc, float its) -> float { return std::hypot(tpc, its); }); //! Combined Nsigma separation with Tpc and Its for deuteron +DECLARE_SOA_DYNAMIC_COLUMN(TpcitsNSigmaTr, tpcitsNSigmaTr, [](float tpc, float its) -> float { return std::hypot(tpc, its); }); //! Combined Nsigma separation with Tpc and Its for trition +DECLARE_SOA_DYNAMIC_COLUMN(TpcitsNSigmaHe, tpcitsNSigmaHe, [](float tpc, float its) -> float { return std::hypot(tpc, its); }); //! Combined Nsigma separation with Tpc and Its for helium3 + +DECLARE_SOA_DYNAMIC_COLUMN(TpctofNSigmaEl, tpctofNSigmaEl, [](float tpc, float tof) -> float { return std::hypot(tpc, tof); }); //! Combined Nsigma separation with Tpc and Tof for electons +DECLARE_SOA_DYNAMIC_COLUMN(TpctofNSigmaPi, tpctofNSigmaPi, [](float tpc, float tof) -> float { return std::hypot(tpc, tof); }); //! Combined Nsigma separation with Tpc and Tof for pion +DECLARE_SOA_DYNAMIC_COLUMN(TpctofNSigmaKa, tpctofNSigmaKa, [](float tpc, float tof) -> float { return std::hypot(tpc, tof); }); //! Combined Nsigma separation with Tpc and Tof for kaon +DECLARE_SOA_DYNAMIC_COLUMN(TpctofNSigmaPr, tpctofNSigmaPr, [](float tpc, float tof) -> float { return std::hypot(tpc, tof); }); //! Combined Nsigma separation with Tpc and Tof for proton +DECLARE_SOA_DYNAMIC_COLUMN(TpctofNSigmaDe, tpctofNSigmaDe, [](float tpc, float tof) -> float { return std::hypot(tpc, tof); }); //! Combined Nsigma separation with Tpc and Tof for deuteron +DECLARE_SOA_DYNAMIC_COLUMN(TpctofNSigmaTr, tpctofNSigmaTr, [](float tpc, float tof) -> float { return std::hypot(tpc, tof); }); //! Combined Nsigma separation with Tpc and Tof for triton +DECLARE_SOA_DYNAMIC_COLUMN(TpctofNSigmaHe, tpctofNSigmaHe, [](float tpc, float tof) -> float { return std::hypot(tpc, tof); }); //! Combined Nsigma separation with Tpc and Tof for helium3 + +} // namespace femtotracks + +// table for basic track information +DECLARE_SOA_TABLE_STAGED_VERSIONED(FTracks_001, "FTRACK", 1, //! femto tracks + o2::soa::Index<>, + femtobase::stored::CollisionId, + femtobase::stored::SignedPt, + femtobase::stored::Eta, + femtobase::stored::Phi, + femtobase::dynamic::Sign, + femtobase::dynamic::Pt, + femtobase::dynamic::P, + femtobase::dynamic::Px, + femtobase::dynamic::Py, + femtobase::dynamic::Pz, + femtobase::dynamic::Theta); +using FTracks = FTracks_001; + +// table for track selections and PID selections +DECLARE_SOA_TABLE_STAGED_VERSIONED(FTrackMasks_001, "FTRACKMASK", 1, //! track masks + femtotracks::TrackMask); +using FTrackMasks = FTrackMasks_001; + +// table for track DCA +DECLARE_SOA_TABLE_STAGED_VERSIONED(FTrackDcas_001, "FTRACKDCAS", 1, //! track dcas + femtotracks::DcaXY, + femtotracks::DcaZ, + femtotracks::Dca); +using FTrackDcas = FTrackDcas_001; + +// table for extra track information +DECLARE_SOA_TABLE_STAGED_VERSIONED(FTrackExtras_001, "FTRACKEXTRA", 1, //! track extra information + femtotracks::IsPVContributor, + femtotracks::ItsNCls, + femtotracks::ItsNClsInnerBarrel, + femtotracks::ItsChi2NCl, + femtotracks::ItsClusterSizes, + femtotracks::TpcSignal, + femtotracks::TpcInnerParam, + femtotracks::TpcNClsFound, + femtotracks::TpcNClsCrossedRows, + femtotracks::TpcNClsShared, + femtotracks::TofBeta, + femtotracks::TofMass, + femtotracks::TpcCrossedRowsOverFound, + femtotracks::TpcSharedOverFound); +using FTrackExtras = FTrackExtras_001; + +// table for extra PID information +DECLARE_SOA_TABLE_STAGED_VERSIONED(FElectronPids_001, "FELECTRONPID", 1, //! full electron pid + femtotracks::ItsNSigmaEl, + femtotracks::TpcNSigmaEl, + femtotracks::TofNSigmaEl, + femtotracks::TpcitsNSigmaEl, + femtotracks::TpctofNSigmaEl); +using FElectronPids = FElectronPids_001; +DECLARE_SOA_TABLE_STAGED_VERSIONED(FPionPids_001, "FPIONPID", 1, //! full pion pid + femtotracks::ItsNSigmaPi, + femtotracks::TpcNSigmaPi, + femtotracks::TofNSigmaPi, + femtotracks::TpcitsNSigmaPi, + femtotracks::TpctofNSigmaPi); +using FPionPids = FPionPids_001; +DECLARE_SOA_TABLE_STAGED_VERSIONED(FKaonPids_001, "FKAONPID", 1, //! full kaon pid + femtotracks::ItsNSigmaKa, + femtotracks::TpcNSigmaKa, + femtotracks::TofNSigmaKa, + femtotracks::TpcitsNSigmaKa, + femtotracks::TpctofNSigmaKa); +using FKaonPids = FKaonPids_001; +DECLARE_SOA_TABLE_STAGED_VERSIONED(FProtonPids_001, "FPROTONPID", 1, //! full proton pid + femtotracks::ItsNSigmaPr, + femtotracks::TpcNSigmaPr, + femtotracks::TofNSigmaPr, + femtotracks::TpcitsNSigmaPr, + femtotracks::TpctofNSigmaPr); +using FProtonPids = FProtonPids_001; +DECLARE_SOA_TABLE_STAGED_VERSIONED(FDeuteronPids_001, "FDEUTERONPID", 1, //! full deuteron pid + femtotracks::ItsNSigmaDe, + femtotracks::TpcNSigmaDe, + femtotracks::TofNSigmaDe, + femtotracks::TpcitsNSigmaDe, + femtotracks::TpctofNSigmaDe); +using FDeuteronPids = FDeuteronPids_001; +DECLARE_SOA_TABLE_STAGED_VERSIONED(FTritonPids_001, "FTRITONPID", 1, //! full triton pid + femtotracks::ItsNSigmaTr, + femtotracks::TpcNSigmaTr, + femtotracks::TofNSigmaTr, + femtotracks::TpcitsNSigmaTr, + femtotracks::TpctofNSigmaTr); +using FTritonPids = FTritonPids_001; +DECLARE_SOA_TABLE_STAGED_VERSIONED(FHeliumPids_001, "FHELIUMPID", 1, //! full helium3 pid + femtotracks::ItsNSigmaHe, + femtotracks::TpcNSigmaHe, + femtotracks::TofNSigmaHe, + femtotracks::TpcitsNSigmaHe, + femtotracks::TpctofNSigmaHe); +using FHeliumPids = FHeliumPids_001; + +using FTrackPids = soa::Join; + +namespace femtotwotrackresonances +{ +// columns for resonance bit masks +DECLARE_SOA_COLUMN(Mask, mask, femtodatatypes::TwoTrackResonanceMaskType); //! Bitmask for resonance selections + +// id columns for resonance daughter tracks +DECLARE_SOA_INDEX_COLUMN_FULL(PosDau, posDau, int32_t, FTracks, "_PosDau"); //! index column for positive daughter track +DECLARE_SOA_INDEX_COLUMN_FULL(NegDau, negDau, int32_t, FTracks, "_NegDau"); //! index column for negative daughter track +} // namespace femtotwotrackresonances +// table for phis +DECLARE_SOA_TABLE_STAGED_VERSIONED(FPhis_001, "FPHI", 1, //! femto phis + o2::soa::Index<>, + femtobase::stored::CollisionId, + femtobase::stored::Pt, + femtobase::stored::Eta, + femtobase::stored::Phi, + femtobase::stored::Mass, + femtotwotrackresonances::PosDauId, + femtotwotrackresonances::NegDauId, + femtobase::dynamic::P, + femtobase::dynamic::Px, + femtobase::dynamic::Py, + femtobase::dynamic::Pz, + femtobase::dynamic::Theta); +using FPhis = FPhis_001; +DECLARE_SOA_TABLE_STAGED_VERSIONED(FPhiMasks_001, "FPHIMASK", 1, //! mask for phis + femtotwotrackresonances::Mask); +using FPhiMasks = FPhiMasks_001; + +// table for kstars +DECLARE_SOA_TABLE_STAGED_VERSIONED(FKstar0s_001, "FKSTAR0", 1, //! femto k0star + o2::soa::Index<>, + femtobase::stored::CollisionId, + femtobase::stored::SignedPt, //! +1 for k0star and -1 for k0starbar + femtobase::stored::Eta, + femtobase::stored::Phi, + femtobase::stored::Mass, + femtotwotrackresonances::PosDauId, + femtotwotrackresonances::NegDauId, + femtobase::dynamic::Sign, + femtobase::dynamic::Pt, + femtobase::dynamic::P, + femtobase::dynamic::Px, + femtobase::dynamic::Py, + femtobase::dynamic::Pz, + femtobase::dynamic::Theta); +using FKstar0s = FKstar0s_001; +DECLARE_SOA_TABLE_STAGED_VERSIONED(FKstar0Masks_001, "FKSTAR0MASK", 1, //! k0star masks + femtotwotrackresonances::Mask); +using FKstar0Masks = FKstar0Masks_001; + +DECLARE_SOA_TABLE_STAGED_VERSIONED(FRho0s_001, "FRHO0", 1, //! femto rho0s + o2::soa::Index<>, + femtobase::stored::CollisionId, + femtobase::stored::Pt, + femtobase::stored::Eta, + femtobase::stored::Phi, + femtobase::stored::Mass, + femtotwotrackresonances::PosDauId, + femtotwotrackresonances::NegDauId, + femtobase::dynamic::P, + femtobase::dynamic::Px, + femtobase::dynamic::Py, + femtobase::dynamic::Pz, + femtobase::dynamic::Theta); +using FRho0s = FRho0s_001; +DECLARE_SOA_TABLE_STAGED_VERSIONED(FRho0Masks_001, "FRHO0MASK", 1, //! rho0s masks + femtotwotrackresonances::Mask); +using FRho0Masks = FRho0Masks_001; + +namespace femtov0s +{ +// columns for bit masks +DECLARE_SOA_COLUMN(Mask, mask, femtodatatypes::V0MaskType); //! Bitmask for v0 selections + +// columns for debug information +DECLARE_SOA_COLUMN(MassLambda, massLambda, float); //! Mass of Lambda +DECLARE_SOA_COLUMN(MassAntiLambda, massAntiLambda, float); //! Mass of AntiLambda +DECLARE_SOA_COLUMN(MassK0short, massK0short, float); //! Mass of K0short +DECLARE_SOA_COLUMN(CosPa, cosPa, float); //! Lambda daughter DCA at decay vertex +DECLARE_SOA_COLUMN(DauDca, dauDca, float); //! Lambda daughter DCA at decay vertex +DECLARE_SOA_COLUMN(TransRadius, transRadius, float); //! Lambda transvers radius +DECLARE_SOA_COLUMN(DecayVtxX, decayVtxX, float); //! x coordinate of Lambda decay vertex +DECLARE_SOA_COLUMN(DecayVtxY, decayVtxY, float); //! y coordinate of Lambda decay vertex +DECLARE_SOA_COLUMN(DecayVtxZ, decayVtxZ, float); //! z coordinate of Lambda decay vertex +DECLARE_SOA_DYNAMIC_COLUMN(DecayVtx, decayVtx, //! distance of decay vertex from nominal interaction point + [](float vtxX, float vtxY, float vtxZ) -> float { + return std::hypot(vtxX, vtxY, vtxZ); + }); + +// id columns for Lambda daughter tracks +DECLARE_SOA_INDEX_COLUMN_FULL(PosDau, posDau, int32_t, FTracks, "_PosDau"); //! index column for positive daughter track +DECLARE_SOA_INDEX_COLUMN_FULL(NegDau, negDau, int32_t, FTracks, "_NegDau"); //! index column for negative daughter track + +} // namespace femtov0s + +// table for basic lambda information +DECLARE_SOA_TABLE_STAGED_VERSIONED(FLambdas_001, "FLAMBDA", 1, //! femto lambdas + o2::soa::Index<>, + femtobase::stored::CollisionId, // use sign to differentiate between lambda (+1) and antilambda (-1) + femtobase::stored::SignedPt, + femtobase::stored::Eta, + femtobase::stored::Phi, + femtobase::stored::Mass, // mass of the lambda/antilambda depending on the sign of the pt + femtov0s::PosDauId, + femtov0s::NegDauId, + femtobase::dynamic::Sign, + femtobase::dynamic::Pt, + femtobase::dynamic::P, + femtobase::dynamic::Px, + femtobase::dynamic::Py, + femtobase::dynamic::Pz, + femtobase::dynamic::Theta); +using FLambdas = FLambdas_001; + +DECLARE_SOA_TABLE_STAGED_VERSIONED(FLambdaMasks_001, "FLAMBDAMASK", 1, //! lambda masks + femtov0s::Mask); +using FLambdaMasks = FLambdaMasks_001; + +DECLARE_SOA_TABLE_STAGED_VERSIONED(FLambdaExtras_001, "FLAMBDAEXTRA", 1, //! lambda extra information + femtobase::stored::MassAnti, // put mass of antiparticle, i.e. antilambda mass for lambdas and vice versa + femtov0s::MassK0short, + femtov0s::CosPa, + femtov0s::DauDca, + femtov0s::TransRadius, + femtov0s::DecayVtxX, + femtov0s::DecayVtxY, + femtov0s::DecayVtxZ, + femtov0s::DecayVtx); + +using FLambdaExtras = FLambdaExtras_001; + +// table for basic k0short information +DECLARE_SOA_TABLE_STAGED_VERSIONED(FK0shorts_001, "FK0SHORT", 1, //! femto k0shorts + o2::soa::Index<>, + femtobase::stored::CollisionId, + femtobase::stored::Pt, + femtobase::stored::Eta, + femtobase::stored::Phi, + femtobase::stored::Mass, + femtov0s::PosDauId, + femtov0s::NegDauId, + femtobase::dynamic::P, + femtobase::dynamic::Px, + femtobase::dynamic::Py, + femtobase::dynamic::Pz, + femtobase::dynamic::Theta); +using FK0shorts = FK0shorts_001; + +DECLARE_SOA_TABLE_STAGED_VERSIONED(FK0shortMasks_001, "FK0SHORTMASK", 1, //! k0short masks + femtov0s::Mask); +using FK0shortMasks = FK0shortMasks_001; + +DECLARE_SOA_TABLE_STAGED_VERSIONED(FK0shortExtras_001, "FK0SHORTEXTRA", 1, //! k0short extra information + femtov0s::MassLambda, + femtov0s::MassAntiLambda, + femtov0s::CosPa, + femtov0s::DauDca, + femtov0s::TransRadius, + femtov0s::DecayVtxX, + femtov0s::DecayVtxY, + femtov0s::DecayVtxZ, + femtov0s::DecayVtx); + +using FK0shortExtras = FK0shortExtras_001; + +namespace femtocascades +{ +// columns for cascade bit masks +DECLARE_SOA_COLUMN(Mask, mask, femtodatatypes::CascadeMaskType); //! Bitmask for cascade selections + +// columns for cascad debug information +DECLARE_SOA_COLUMN(MassXi, massXi, float); //! Mass of xi +DECLARE_SOA_COLUMN(MassOmega, massOmega, float); //! Mass of omega +DECLARE_SOA_COLUMN(CascadeCosPa, cascadeCosPa, float); //! cosine of the poiting angle at decay vertex +DECLARE_SOA_COLUMN(CascadeDauDca, cascadeDauDca, float); //! Lambda daughter DCA at decay vertex +DECLARE_SOA_COLUMN(CascadeTransRadius, cascadeTransRadius, float); //! Lambda transvers radius +DECLARE_SOA_COLUMN(LambdaCosPa, lambdaCosPa, float); //! cosine of the poiting angle at decay vertex +DECLARE_SOA_COLUMN(LambdaDauDca, lambdaDauDca, float); //! Lambda daughter DCA at decay vertex +DECLARE_SOA_COLUMN(LambdaTransRadius, lambdaTransRadius, float); //! Lambda transvers radius +DECLARE_SOA_COLUMN(LambdaDcaToPv, lambdaDcaToPv, float); //! Lambda transvers radius + +// id columns for bachelor +// following same style as strangeness tables were we do not store the id of the lambda, but its daughters +DECLARE_SOA_INDEX_COLUMN_FULL(Bachelor, bachelor, int32_t, FTracks, "_Bachelor"); //! bachelor id + +} // namespace femtocascades + +DECLARE_SOA_TABLE_STAGED_VERSIONED(FXis_001, "FXI", 1, //! femto xis + o2::soa::Index<>, + femtobase::stored::CollisionId, + femtobase::stored::SignedPt, + femtobase::stored::Eta, + femtobase::stored::Phi, + femtobase::stored::Mass, + femtocascades::BachelorId, + femtov0s::PosDauId, + femtov0s::NegDauId, + femtobase::dynamic::Sign, + femtobase::dynamic::Pt, + femtobase::dynamic::P, + femtobase::dynamic::Px, + femtobase::dynamic::Py, + femtobase::dynamic::Pz, + femtobase::dynamic::Theta); +using FXis = FXis_001; + +DECLARE_SOA_TABLE_STAGED_VERSIONED(FXiMasks_001, "FXIMASK", 1, //! xi masks + femtocascades::Mask); +using FXiMasks = FXiMasks_001; + +DECLARE_SOA_TABLE_STAGED_VERSIONED(FXiExtras_001, "FXIEXTRA", 1, //! xi extra information + femtocascades::MassOmega, + femtocascades::CascadeCosPa, + femtocascades::CascadeDauDca, + femtocascades::CascadeTransRadius, + femtocascades::LambdaCosPa, + femtocascades::LambdaDauDca, + femtocascades::LambdaTransRadius, + femtocascades::LambdaDcaToPv); +using FXiExtras = FXiExtras_001; + +DECLARE_SOA_TABLE_STAGED_VERSIONED(FOmegas_001, "FOMEGA", 1, //! femto omegas + o2::soa::Index<>, + femtobase::stored::CollisionId, + femtobase::stored::SignedPt, + femtobase::stored::Eta, + femtobase::stored::Phi, + femtobase::stored::Mass, + femtocascades::BachelorId, + femtov0s::PosDauId, + femtov0s::NegDauId, + femtobase::dynamic::Sign, + femtobase::dynamic::Pt, + femtobase::dynamic::P, + femtobase::dynamic::Px, + femtobase::dynamic::Py, + femtobase::dynamic::Pz, + femtobase::dynamic::Theta); +using FOmegas = FOmegas_001; + +DECLARE_SOA_TABLE_STAGED_VERSIONED(FOmegaMasks_001, "FOMEGAMASK", 1, //! omega masks + femtocascades::Mask); +using FOmegaMasks = FOmegaMasks_001; + +DECLARE_SOA_TABLE_STAGED_VERSIONED(FOmegaExtras_001, "FOMEGAEXTRA", 1, //! omega extra information + femtocascades::MassXi, + femtocascades::CascadeCosPa, + femtocascades::CascadeDauDca, + femtocascades::CascadeTransRadius, + femtocascades::LambdaCosPa, + femtocascades::LambdaDauDca, + femtocascades::LambdaTransRadius, + femtocascades::LambdaDcaToPv); +using FOmegaExtras = FOmegaExtras_001; + +} // namespace o2::aod +#endif // PWGCF_FEMTO_DATAMODEL_FEMTOTABLES_H_ diff --git a/PWGCF/Femto/FemtoNuclei/CMakeLists.txt b/PWGCF/Femto/FemtoNuclei/CMakeLists.txt new file mode 100644 index 00000000000..27462d99baf --- /dev/null +++ b/PWGCF/Femto/FemtoNuclei/CMakeLists.txt @@ -0,0 +1,12 @@ +# Copyright 2019-2024 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. + +add_subdirectory(TableProducer) diff --git a/PWGCF/Femto/DataModel/PionNucleiTables.h b/PWGCF/Femto/FemtoNuclei/DataModel/PionNucleiTables.h similarity index 96% rename from PWGCF/Femto/DataModel/PionNucleiTables.h rename to PWGCF/Femto/FemtoNuclei/DataModel/PionNucleiTables.h index 7b7b534fb1d..8900fcfbcd6 100644 --- a/PWGCF/Femto/DataModel/PionNucleiTables.h +++ b/PWGCF/Femto/FemtoNuclei/DataModel/PionNucleiTables.h @@ -18,8 +18,8 @@ #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" -#ifndef PWGCF_FEMTO_DATAMODEL_PIONNUCLEITABLES_H_ -#define PWGCF_FEMTO_DATAMODEL_PIONNUCLEITABLES_H_ +#ifndef PWGCF_FEMTO_FEMTONUCLEI_DATAMODEL_PIONNUCLEITABLES_H_ +#define PWGCF_FEMTO_FEMTONUCLEI_DATAMODEL_PIONNUCLEITABLES_H_ namespace o2::aod { @@ -130,4 +130,4 @@ DECLARE_SOA_TABLE(PionNucleiMult, "AOD", "PINUCLEIMULT", } // namespace o2::aod -#endif // PWGCF_FEMTO_DATAMODEL_PIONNUCLEITABLES_H_ +#endif // PWGCF_FEMTO_FEMTONUCLEI_DATAMODEL_PIONNUCLEITABLES_H_ diff --git a/PWGCF/Femto/FemtoNuclei/TableProducer/CMakeLists.txt b/PWGCF/Femto/FemtoNuclei/TableProducer/CMakeLists.txt new file mode 100644 index 00000000000..4c6576278a5 --- /dev/null +++ b/PWGCF/Femto/FemtoNuclei/TableProducer/CMakeLists.txt @@ -0,0 +1,15 @@ +# Copyright 2019-2025 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(pinucleifemto + SOURCES PiNucleiFemto.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils + COMPONENT_NAME Analysis) diff --git a/PWGCF/Femto/TableProducer/PiNucleiFemto.cxx b/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx similarity index 99% rename from PWGCF/Femto/TableProducer/PiNucleiFemto.cxx rename to PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx index ca56171858d..c7272ad3e30 100644 --- a/PWGCF/Femto/TableProducer/PiNucleiFemto.cxx +++ b/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx @@ -15,7 +15,7 @@ /// \author CMY /// \date 2025-04-10 -#include "PWGCF/Femto/DataModel/PionNucleiTables.h" +#include "PWGCF/Femto/FemtoNuclei/DataModel/PionNucleiTables.h" #include "PWGLF/DataModel/EPCalibrationTables.h" #include "PWGLF/DataModel/LFHypernucleiTables.h" #include "PWGLF/Utils/svPoolCreator.h" diff --git a/PWGCF/Femto/TableProducer/CMakeLists.txt b/PWGCF/Femto/TableProducer/CMakeLists.txt index 4c6576278a5..e5808562f51 100644 --- a/PWGCF/Femto/TableProducer/CMakeLists.txt +++ b/PWGCF/Femto/TableProducer/CMakeLists.txt @@ -9,7 +9,7 @@ # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. -o2physics_add_dpl_workflow(pinucleifemto - SOURCES PiNucleiFemto.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils +o2physics_add_dpl_workflow(femto-producer + SOURCES femtoProducer.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) diff --git a/PWGCF/Femto/TableProducer/femtoProducer.cxx b/PWGCF/Femto/TableProducer/femtoProducer.cxx new file mode 100644 index 00000000000..0f69056e11d --- /dev/null +++ b/PWGCF/Femto/TableProducer/femtoProducer.cxx @@ -0,0 +1,300 @@ +// Copyright 2019-2025 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 femtoProducer.cxx +/// \brief Tasks that produces the all femto tables +/// \author Anton Riedel, TU München, anton.riedel@tum.de + +#include "PWGCF/Femto/Core/cascadeBuilder.h" +#include "PWGCF/Femto/Core/collisionBuilder.h" +#include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/trackBuilder.h" +#include "PWGCF/Femto/Core/twoTrackResonanceBuilder.h" +#include "PWGCF/Femto/Core/v0Builder.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" + +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponseITS.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CCDB/BasicCCDBManager.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/Configurable.h" +#include "Framework/Expressions.h" +#include "Framework/InitContext.h" +#include "Framework/runDataProcessing.h" + +#include "fairlogger/Logger.h" + +#include +#include +#include +#include + +using namespace o2::aod; +using namespace o2::soa; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::analysis::femto; + +namespace o2::analysis::femto +{ +namespace consumeddata +{ +using Run3PpCollisions = soa::Join; +// FIXME: sometimes people want to run analyis even though centrality calibration is not available yet +// using Run3PpWithoutCentCollisions = soa::Join; + +using Run3FullPidTracks = + soa::Join; + +using Run3PpVzeros = V0Datas; + +using Run3PpCascades = CascDatas; + +} // namespace consumeddata +} // namespace o2::analysis::femto + +struct FemtoProducer { + + // configurables + struct : ConfigurableGroup { + std::string prefix = std::string("General"); + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "URL to ccdb"}; + Configurable grpPath{"grpPath", "GLO/Config/GRPMagField", "Path to GRP object (Run3 -> GLO/Config/GRPMagField/Run2 -> GLO/GRP/GRP"}; + } ConfOptions; + + // collision builder + collisionbuilder::CollisionBuilderProducts collisionBuilderProducts; + collisionbuilder::ConfCollisionTables confCollisionTables; + collisionbuilder::ConfCollisionFilter confCollisionFilter; + collisionbuilder::ConfCollisionFlags confCollisionFlags; + collisionbuilder::CollisionBuilder collisionBuilder; + + // track builder + trackbuilder::TrackBuilderProducts trackBuilderProducts; + trackbuilder::ConfTrackTables confTrackTables; + trackbuilder::TrackBuilder trackBuilder; + trackbuilder::ConfTrackBits confTrackBits; + trackbuilder::ConfTrackFilters confTrackFilters; + + // v0 builders + v0builder::V0BuilderProducts v0builderProducts; + v0builder::ConfV0Tables confV0Tables; + v0builder::ConfV0Filters confV0Filters; + v0builder::ConfK0shortBits confK0shortBits; + v0builder::V0Builder k0shortBuilder; + v0builder::ConfLambdaBits confLambdaBits; + v0builder::V0Builder lambdaBuilder; + v0builder::V0Builder antilambdaBuilder; + + // cascade builder + cascadebuilder::CascadeBuilderProducts cascadeBuilderProducts; + cascadebuilder::ConfCascadeTables confCascadeTables; + cascadebuilder::ConfCascadeFilters confCascadeFilters; + cascadebuilder::ConfXiBits confXiBits; + cascadebuilder::CascadeBuilder xiBuilder; + cascadebuilder::ConfOmegaBits confOmegaBits; + cascadebuilder::CascadeBuilder omegaBuilder; + + // resonance daughter filters and partitions + twotrackresonancebuilder::ConfTwoTrackResonanceDaughterFilters confResonanceDaughterFilters; + // caching and preslicing + SliceCache cache; + Preslice perColTracks = o2::aod::track::collisionId; + Partition partitionPositiveDaughters = + (track::signed1Pt > 0.f) && + (track::pt > confResonanceDaughterFilters.ptMin && track::pt < confResonanceDaughterFilters.ptMax) && + (track::eta > confResonanceDaughterFilters.etaMin && track::eta < confResonanceDaughterFilters.etaMax) && + (track::phi > confResonanceDaughterFilters.phiMin && track::phi < confResonanceDaughterFilters.phiMax); + Partition partitionNegativeDaughters = + (track::signed1Pt < 0.f) && + (track::pt > confResonanceDaughterFilters.ptMin && track::pt < confResonanceDaughterFilters.ptMax) && + (track::eta > confResonanceDaughterFilters.etaMin && track::eta < confResonanceDaughterFilters.etaMax) && + (track::phi > confResonanceDaughterFilters.phiMin && track::phi < confResonanceDaughterFilters.phiMax); + + // resonance builders + twotrackresonancebuilder::TwoTrackResonanceBuilderProducts twoTrackResonanceBuilderProducts; + twotrackresonancebuilder::ConfTwoTrackResonanceTables confTwoTrackResonanceTables; + twotrackresonancebuilder::ConfRhoFilters confRhoFilters; + twotrackresonancebuilder::ConfRho0Bits confRho0Bits; + twotrackresonancebuilder::TwoTrackResonanceBuilder rho0Builder; + twotrackresonancebuilder::ConfPhiFilters confPhiFilters; + twotrackresonancebuilder::ConfPhiBits confPhiBits; + twotrackresonancebuilder::TwoTrackResonanceBuilder phiBuilder; + twotrackresonancebuilder::ConfKstarFilters confKstarFilters; + twotrackresonancebuilder::ConfKstar0Bits confKstar0Bits; + twotrackresonancebuilder::TwoTrackResonanceBuilder kstar0Builder; + twotrackresonancebuilder::TwoTrackResonanceBuilder kstar0barBuilder; + + // histogramming + // add histograms in next iteration + // HistogramRegistry hRegistry{"FemtoProducer", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // data members + int runNumber = -1; + float magField = 0.f; + Service ccdb; /// Accessing the CCDB + std::unordered_map indexMapTracks; // for mapping tracks to lambdas, cascades and resonances + + void initFromCcdb(o2::aod::BCsWithTimestamps::iterator const& bc) + { + if (runNumber == bc.runNumber()) + return; + auto timestamp = bc.timestamp(); + static o2::parameters::GRPMagField* grpo = nullptr; + grpo = ccdb->getForTimeStamp(ConfOptions.grpPath.value, timestamp); + if (grpo == nullptr) { + LOGF(fatal, "GRP object not found for timestamp %llu", timestamp); + return; + } + magField = 0.1 * grpo->getNominalL3Field(); // get magnetic field in tesla + runNumber = bc.runNumber(); + }; + + void init(InitContext& context) + { + // init ccdb + ccdb->setURL(ConfOptions.ccdbUrl.value); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + int64_t now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); + ccdb->setCreatedNotAfter(now); + + // collision selection + collisionBuilder.init(confCollisionFilter, confCollisionFlags, confCollisionTables, context); + + // configure track builder + trackBuilder.init(confTrackBits, confTrackFilters, confTrackTables, context); + + // configure v0 builder + k0shortBuilder.init(confK0shortBits, confV0Filters, confV0Tables, context); + lambdaBuilder.init(confLambdaBits, confV0Filters, confV0Tables, context); + antilambdaBuilder.init(confLambdaBits, confV0Filters, confV0Tables, context); + + // cascade selections + xiBuilder.init(confXiBits, confCascadeFilters, confCascadeTables, context); + omegaBuilder.init(confOmegaBits, confCascadeFilters, confCascadeTables, context); + + // configure resonance selections + rho0Builder.init(confRho0Bits, confRhoFilters, confResonanceDaughterFilters, confTwoTrackResonanceTables, context); + phiBuilder.init(confPhiBits, confPhiFilters, confResonanceDaughterFilters, confTwoTrackResonanceTables, context); + kstar0Builder.init(confKstar0Bits, confKstarFilters, confResonanceDaughterFilters, confTwoTrackResonanceTables, context); + kstar0barBuilder.init(confKstar0Bits, confKstarFilters, confResonanceDaughterFilters, confTwoTrackResonanceTables, context); + + if ((xiBuilder.fillAnyTable() || omegaBuilder.fillAnyTable()) && !doprocessTracksV0sCascadesRun3pp) { + LOG(fatal) << "At least one cascade tabel is enabled, but wrong process function is enabled. Breaking..."; + } + if ((lambdaBuilder.fillAnyTable() || antilambdaBuilder.fillAnyTable() || k0shortBuilder.fillAnyTable()) && (!doprocessTracksV0sCascadesRun3pp && !doprocessTracksV0sRun3pp)) { + LOG(info) << "At least one v0 tabel is enbaled, but wrong process function is enabled. Breaking..."; + } + } + + // Core implementation, parameterized by builders to call + template + void processTracks(T1 const& col, T2 const& /* bcs*/, T3 const& tracks, T4 const& tracksWithItsPid) + { + initFromCcdb(col.template bc_as()); + collisionBuilder.buildCollision(col, tracks, magField); + if (!collisionBuilder.checkCuts(col)) { + return; + } + collisionBuilder.fillCollision(collisionBuilderProducts, col); + + // tracks + indexMapTracks.clear(); + trackBuilder.fillTracks(tracksWithItsPid, trackBuilderProducts, collisionBuilderProducts, indexMapTracks); + + // resonances + auto groupPositiveTracks = partitionPositiveDaughters->sliceByCached(o2::aod::track::collisionId, col.globalIndex(), cache); + auto groupNegativeTracks = partitionNegativeDaughters->sliceByCached(o2::aod::track::collisionId, col.globalIndex(), cache); + rho0Builder.fillResonances(collisionBuilderProducts, trackBuilderProducts, twoTrackResonanceBuilderProducts, groupPositiveTracks, groupNegativeTracks, trackBuilder, indexMapTracks); + phiBuilder.fillResonances(collisionBuilderProducts, trackBuilderProducts, twoTrackResonanceBuilderProducts, groupPositiveTracks, groupNegativeTracks, trackBuilder, indexMapTracks); + kstar0Builder.fillResonances(collisionBuilderProducts, trackBuilderProducts, twoTrackResonanceBuilderProducts, groupPositiveTracks, groupNegativeTracks, trackBuilder, indexMapTracks); + kstar0barBuilder.fillResonances(collisionBuilderProducts, trackBuilderProducts, twoTrackResonanceBuilderProducts, groupPositiveTracks, groupNegativeTracks, trackBuilder, indexMapTracks); + } + + // add v0s + template + void processTracksV0s(T1 const& col, T2 const& bcs, T3 const& tracks, T4 const& tracksWithItsPid, T5 const& v0s) + { + processTracks(col, bcs, tracks, tracksWithItsPid); + lambdaBuilder.fillV0s(collisionBuilderProducts, trackBuilderProducts, v0builderProducts, v0s, tracks, trackBuilder, indexMapTracks); + antilambdaBuilder.fillV0s(collisionBuilderProducts, trackBuilderProducts, v0builderProducts, v0s, tracks, trackBuilder, indexMapTracks); + k0shortBuilder.fillV0s(collisionBuilderProducts, trackBuilderProducts, v0builderProducts, v0s, tracks, trackBuilder, indexMapTracks); + } + + // add cascades + template + void processTracksV0sCascades(T1 const& col, T2 const& bcs, T3 const& tracks, T4 const& tracksWithItsPid, T5 const& v0s, T6 const& cascades) + { + processTracksV0s(col, bcs, tracks, tracksWithItsPid, v0s); + xiBuilder.fillCascades(collisionBuilderProducts, trackBuilderProducts, cascadeBuilderProducts, + cascades, tracks, col, trackBuilder, indexMapTracks); + omegaBuilder.fillCascades(collisionBuilderProducts, trackBuilderProducts, cascadeBuilderProducts, + cascades, tracks, col, trackBuilder, indexMapTracks); + } + + // proccess functions + void processTracksRun3pp(consumeddata::Run3PpCollisions::iterator const& col, + BCsWithTimestamps const& bcs, + consumeddata::Run3FullPidTracks const& tracks) + { + // its pid information is generated dynamically, so we need to add it here + auto tracksWithItsPid = o2::soa::Attach(tracks); + processTracks(col, bcs, tracks, tracksWithItsPid); + } + PROCESS_SWITCH(FemtoProducer, processTracksRun3pp, "Process tracks", true); + + // process tracks and v0s + void processTracksV0sRun3pp(consumeddata::Run3PpCollisions::iterator const& col, + BCsWithTimestamps const& bcs, + consumeddata::Run3FullPidTracks const& tracks, + consumeddata::Run3PpVzeros const& v0s) + { + // its pid information is generated dynamically, so we need to add it here + auto tracksWithItsPid = o2::soa::Attach(tracks); + processTracksV0s(col, bcs, tracks, tracksWithItsPid, v0s); + }; + PROCESS_SWITCH(FemtoProducer, processTracksV0sRun3pp, "Process tracks and v0s", false); + + // process tracks, v0s and casacades + void processTracksV0sCascadesRun3pp(consumeddata::Run3PpCollisions::iterator const& col, + BCsWithTimestamps const& bcs, + consumeddata::Run3FullPidTracks const& tracks, + consumeddata::Run3PpVzeros const& v0s, + consumeddata::Run3PpCascades const& cascades) + { + // its pid information is generated dynamically, so we need to add it here + auto tracksWithItsPid = o2::soa::Attach(tracks); + processTracksV0sCascades(col, bcs, tracks, tracksWithItsPid, v0s, cascades); + } + PROCESS_SWITCH(FemtoProducer, processTracksV0sCascadesRun3pp, "Provide Tracks, V0s and Cascades for Run3", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{adaptAnalysisTask(cfgc)}; + return workflow; +} diff --git a/PWGCF/Femto/Tasks/CMakeLists.txt b/PWGCF/Femto/Tasks/CMakeLists.txt new file mode 100644 index 00000000000..eb16171c62b --- /dev/null +++ b/PWGCF/Femto/Tasks/CMakeLists.txt @@ -0,0 +1,40 @@ +# Copyright 2019-2025 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(femto-track-qa + SOURCES femtoTrackQa.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(femto-twotrackresonance-qa + SOURCES femtoTwotrackresonanceQa.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(femto-v0-qa + SOURCES femtoV0Qa.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(femto-cascade-qa + SOURCES femtoCascadeQa.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +# o2physics_add_dpl_workflow(femtounited-pair-track-track +# SOURCES femtounitedPairTrackTrack.cxx +# PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore +# COMPONENT_NAME Analysis) +# +# o2physics_add_dpl_workflow(femtounited-pair-track-v0 +# SOURCES femtounitedPairTrackV0.cxx +# PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore +# COMPONENT_NAME Analysis) diff --git a/PWGCF/Femto/Tasks/femtoCascadeQa.cxx b/PWGCF/Femto/Tasks/femtoCascadeQa.cxx new file mode 100644 index 00000000000..b447d31633b --- /dev/null +++ b/PWGCF/Femto/Tasks/femtoCascadeQa.cxx @@ -0,0 +1,161 @@ +// Copyright 2019-2025 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 femtoCascadeQa.cxx +/// \brief Tasks for Qa of cascades +/// \author Anton Riedel, TU München, anton.riedel@cern.ch + +#include "PWGCF/Femto/Core/cascadeBuilder.h" +#include "PWGCF/Femto/Core/cascadeHistManager.h" +#include "PWGCF/Femto/Core/collisionBuilder.h" +#include "PWGCF/Femto/Core/collisionHistManager.h" +#include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/partitions.h" +#include "PWGCF/Femto/Core/trackHistManager.h" +#include "PWGCF/Femto/DataModel/FemtoTables.h" + +#include "Framework/ASoA.h" +#include "Framework/AnalysisHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/Configurable.h" +#include "Framework/Expressions.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/InitContext.h" +#include "Framework/OutputObjHeader.h" +#include "Framework/runDataProcessing.h" + +#include +#include +#include + +using namespace o2; +using namespace o2::aod; +using namespace o2::soa; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::analysis::femto; + +struct FemtoCascadeQa { + + // setup tables + using Collisions = FCols; + using Collision = Collisions::iterator; + + using FilteredCollisions = o2::soa::Filtered; + using FilteredCollision = FilteredCollisions::iterator; + + using Xis = o2::soa::Join; + using Omegas = o2::soa::Join; + using Tracks = o2::soa::Join; + + SliceCache cache; + + // setup collisions + colhistmanager::CollisionHistManager colHistManager; + colhistmanager::ConfCollisionBinning confCollisionBinning; + collisionbuilder::ConfCollisionFilter collisionSelection; + Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); + + // setup for xis + cascadebuilder::ConfXiSelection confXiSelection; + Partition xiPartition = MAKE_CASCADE_PARTITION(confXiSelection); + Preslice preColXis = aod::femtobase::stored::collisionId; + + cascadehistmanager::ConfXiBinning confXiBinning; + cascadehistmanager::ConfXiQaBinning confXiQaBinning; + cascadehistmanager::CascadeHistManager< + cascadehistmanager::PrefixXiQa, + trackhistmanager::PrefixCascadeBachelorQa, + trackhistmanager::PrefixV0PosDaughterQa, + trackhistmanager::PrefixV0NegDaughterQa, + modes::Mode::kAnalysis_Qa, + modes::Cascade::kXi> + xiHistManager; + + // setup for omegas + cascadebuilder::ConfOmegaSelection confOmegaSelection; + Partition omegaPartition = MAKE_CASCADE_PARTITION(confOmegaSelection); + Preslice preColOmegas = aod::femtobase::stored::collisionId; + + cascadehistmanager::ConfOmegaBinning confOmegaBinning; + cascadehistmanager::ConfOmegaQaBinning confOmegaQaBinning; + cascadehistmanager::CascadeHistManager< + cascadehistmanager::PrefixOmegaQa, + trackhistmanager::PrefixCascadeBachelorQa, + trackhistmanager::PrefixV0PosDaughterQa, + trackhistmanager::PrefixV0NegDaughterQa, + modes::Mode::kAnalysis_Qa, + modes::Cascade::kOmega> + omegaHistManager; + + // setup for daughters/bachelor + trackhistmanager::ConfCascadePosDauBinning confPosDaughterBinning; + trackhistmanager::ConfCascadePosDauQaBinning confPosDaughterQaBinning; + trackhistmanager::ConfCascadeNegDauBinning confNegDaughterBinning; + trackhistmanager::ConfCascadeNegDauQaBinning confNegDaughterQaBinning; + trackhistmanager::ConfCascadeBachelorBinning confBachelorBinning; + trackhistmanager::ConfCascadeBachelorQaBinning confBachelorQaBinning; + + HistogramRegistry hRegistry{"FemtoCascadeQA", {}, OutputObjHandlingPolicy::AnalysisObject}; + + void init(InitContext&) + { + // create a map for histogram specs + auto colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); + colHistManager.init(&hRegistry, colHistSpec); + + auto bachelorHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confBachelorBinning, confBachelorQaBinning); + auto posDaughterHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confPosDaughterBinning, confPosDaughterQaBinning); + auto negDaughterHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confNegDaughterBinning, confNegDaughterQaBinning); + + if ((doprocessXis + doprocessOmegas) > 1) { + LOG(fatal) << "Only one process can be activated"; + } + + if (doprocessXis) { + auto xiHistSpec = cascadehistmanager::makeCascadeQaHistSpecMap(confXiBinning, confXiQaBinning); + xiHistManager.init(&hRegistry, xiHistSpec, bachelorHistSpec, posDaughterHistSpec, negDaughterHistSpec); + } + + if (doprocessOmegas) { + auto omegaHistSpec = cascadehistmanager::makeCascadeQaHistSpecMap(confOmegaBinning, confOmegaQaBinning); + omegaHistManager.init(&hRegistry, omegaHistSpec, bachelorHistSpec, posDaughterHistSpec, negDaughterHistSpec); + } + }; + + void processXis(FilteredCollision const& col, Xis const& /*xis*/, Tracks const& tracks) + { + colHistManager.fill(col); + auto xiSlice = xiPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + for (auto const& xi : xiSlice) { + xiHistManager.fill(xi, tracks); + } + } + PROCESS_SWITCH(FemtoCascadeQa, processXis, "Process Xis", true); + + void processOmegas(FilteredCollision const& col, Omegas const& /*omegas*/, Tracks const& tracks) + { + colHistManager.fill(col); + auto omegaSlice = omegaPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + for (auto const& omega : omegaSlice) { + omegaHistManager.fill(omega, tracks); + } + } + PROCESS_SWITCH(FemtoCascadeQa, processOmegas, "Process Omegas", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{ + adaptAnalysisTask(cfgc), + }; + return workflow; +} diff --git a/PWGCF/Femto/Tasks/femtoTrackQa.cxx b/PWGCF/Femto/Tasks/femtoTrackQa.cxx new file mode 100644 index 00000000000..4963b54f9dc --- /dev/null +++ b/PWGCF/Femto/Tasks/femtoTrackQa.cxx @@ -0,0 +1,100 @@ +// Copyright 2019-2025 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 femtoTrackQa.cxx +/// \brief QA task for tracks +/// \author Anton Riedel, TU München, anton.riedel@cern.ch + +#include "PWGCF/Femto/Core/collisionBuilder.h" +#include "PWGCF/Femto/Core/collisionHistManager.h" +#include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/partitions.h" +#include "PWGCF/Femto/Core/trackBuilder.h" +#include "PWGCF/Femto/Core/trackHistManager.h" +#include "PWGCF/Femto/DataModel/FemtoTables.h" + +#include "Framework/ASoA.h" +#include "Framework/AnalysisHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/Expressions.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/InitContext.h" +#include "Framework/OutputObjHeader.h" +#include "Framework/runDataProcessing.h" + +#include +#include + +using namespace o2; +using namespace o2::aod; +using namespace o2::soa; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::analysis::femto; + +struct FemtoTrackQa { + + // setup tables + using Collisions = FCols; + using Collision = Collisions::iterator; + + using FilteredCollisions = o2::soa::Filtered; + using FilteredCollision = FilteredCollisions::iterator; + + using Tracks = o2::soa::Join; + + SliceCache cache; + + // setup collisions + collisionbuilder::ConfCollisionFilter collisionSelection; + Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); + colhistmanager::ConfCollisionBinning confCollisionBinning; + colhistmanager::CollisionHistManager colHistManager; + + // setup tracks + trackbuilder::ConfTrackSelection1 trackSelections; + trackhistmanager::ConfTrackBinning1 confTrackBinning; + trackhistmanager::ConfTrackQaBinning1 confTrackQaBinning; + trackhistmanager::TrackHistManager trackHistManager; + + Partition trackPartition = MAKE_TRACK_PARTITION(trackSelections); + Preslice perColReco = aod::femtobase::stored::collisionId; + + HistogramRegistry hRegistry{"FemtoTrackQA", {}, OutputObjHandlingPolicy::AnalysisObject}; + + void init(InitContext&) + { + // create a map for histogram specs + auto colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); + colHistManager.init(&hRegistry, colHistSpec); + auto trackHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confTrackBinning, confTrackQaBinning); + trackHistManager.init(&hRegistry, trackHistSpec); + }; + + void process(FilteredCollision const& col, Tracks const& /*tracks*/) + { + colHistManager.fill(col); + auto trackSlice = trackPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + for (auto const& track : trackSlice) { + trackHistManager.fill(track); + // asdf + } + } +}; + +WorkflowSpec + defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{ + adaptAnalysisTask(cfgc), + }; + return workflow; +} diff --git a/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx b/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx new file mode 100644 index 00000000000..3ea287908d5 --- /dev/null +++ b/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx @@ -0,0 +1,181 @@ +// Copyright 2019-2025 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 femtoTwotrackresonanceQa.cxx +/// \brief Qa task for two track resonances +/// \author Anton Riedel, TU München, anton.riedel@cern.ch + +#include "PWGCF/Femto/Core/collisionBuilder.h" +#include "PWGCF/Femto/Core/collisionHistManager.h" +#include "PWGCF/Femto/Core/dataTypes.h" +#include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/partitions.h" +#include "PWGCF/Femto/Core/trackHistManager.h" +#include "PWGCF/Femto/Core/twoTrackResonanceBuilder.h" +#include "PWGCF/Femto/Core/twoTrackResonanceHistManager.h" +#include "PWGCF/Femto/DataModel/FemtoTables.h" + +#include "Framework/ASoA.h" +#include "Framework/AnalysisTask.h" +#include "Framework/Configurable.h" +#include "Framework/Expressions.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" + +#include +#include +#include + +using namespace o2; +using namespace o2::aod; +using namespace o2::soa; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::analysis::femto; + +struct FemtoTwotrackresonanceQa { + + // setup tables + using Collisions = FCols; + using Collision = Collisions::iterator; + + using FilteredCollisions = o2::soa::Filtered; + using FilteredCollision = FilteredCollisions::iterator; + + using Phis = o2::soa::Join; + using Rho0s = o2::soa::Join; + using Kstar0s = o2::soa::Join; + using Tracks = o2::soa::Join; + + SliceCache cache; + + // setup for collisions + colhistmanager::CollisionHistManager colHistManager; + colhistmanager::ConfCollisionBinning confCollisionBinning; + collisionbuilder::ConfCollisionFilter collisionSelection; + Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); + + // setup for phis + twotrackresonancebuilder::ConfPhiSelection confPhiSelection; + Partition phiPartition = MAKE_RESONANCE_0_PARTITON(confPhiSelection); + Preslice perColPhis = aod::femtobase::stored::collisionId; + + twotrackresonancehistmanager::ConfPhiBinning confPhiBinning; + twotrackresonancehistmanager::TwoTrackResonanceHistManager< + twotrackresonancehistmanager::PrefixPhi, + trackhistmanager::PrefixResonancePosDaughterQa, + trackhistmanager::PrefixResonanceNegDaughterQa, + modes::Mode::kAnalysis_Qa, + modes::TwoTrackResonance::kPhi> + phiHistManager; + + // setup for rho0s + twotrackresonancebuilder::ConfRho0Selection confRho0Selection; + Partition rho0Partition = MAKE_RESONANCE_0_PARTITON(confRho0Selection); + Preslice perColRhos = aod::femtobase::stored::collisionId; + + twotrackresonancehistmanager::ConfRho0Binning confRho0Binning; + twotrackresonancehistmanager::TwoTrackResonanceHistManager< + twotrackresonancehistmanager::PrefixRho, + trackhistmanager::PrefixResonancePosDaughterQa, + trackhistmanager::PrefixResonanceNegDaughterQa, + modes::Mode::kAnalysis_Qa, + modes::TwoTrackResonance::kRho0> + rho0HistManager; + + // setup for kstar0s + twotrackresonancebuilder::ConfKstar0Selection confKstar0Selection; + Partition kstar0Partition = MAKE_RESONANCE_1_PARTITON(confKstar0Selection); + Preslice perColKstars = aod::femtobase::stored::collisionId; + + twotrackresonancehistmanager::ConfKstar0Binning confKstar0Binning; + twotrackresonancehistmanager::TwoTrackResonanceHistManager< + twotrackresonancehistmanager::PrefixKstar, + trackhistmanager::PrefixResonancePosDaughterQa, + trackhistmanager::PrefixResonanceNegDaughterQa, + modes::Mode::kAnalysis_Qa, + modes::TwoTrackResonance::kKstar0> + kstar0HistManager; + + // setup for daughters + trackhistmanager::ConfResonancePosDauBinning confPosDaughterBinning; + trackhistmanager::ConfResonancePosDauQaBinning confPosDaughterQaBinning; + trackhistmanager::ConfResonanceNegDauBinning confNegDaughterBinning; + trackhistmanager::ConfResonanceNegDauQaBinning confNegDaughterQaBinning; + + HistogramRegistry hRegistry{"ResonanceQA", {}, OutputObjHandlingPolicy::AnalysisObject}; + + void init(InitContext&) + { + // create a map for histogram specs + auto colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); + colHistManager.init(&hRegistry, colHistSpec); + + auto posDaughterHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confPosDaughterBinning, confPosDaughterQaBinning); + auto negDaughterHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confNegDaughterBinning, confNegDaughterQaBinning); + + if ((doprocessPhis + doprocessRho0s + doprocessKstar0s) > 1) { + LOG(fatal) << "Only one process can be activated"; + } + + if (doprocessPhis) { + auto phiHistSpec = twotrackresonancehistmanager::makeTwoTrackResonanceQaHistSpecMap(confPhiBinning); + phiHistManager.init(&hRegistry, phiHistSpec, posDaughterHistSpec, negDaughterHistSpec); + } + if (doprocessRho0s) { + auto rho0HistSpec = twotrackresonancehistmanager::makeTwoTrackResonanceQaHistSpecMap(confRho0Binning); + rho0HistManager.init(&hRegistry, rho0HistSpec, posDaughterHistSpec, negDaughterHistSpec); + } + + if (doprocessKstar0s) { + auto kstar0HistSpec = twotrackresonancehistmanager::makeTwoTrackResonanceQaHistSpecMap(confKstar0Binning); + kstar0HistManager.init(&hRegistry, kstar0HistSpec, posDaughterHistSpec, negDaughterHistSpec); + } + }; + + void processPhis(FilteredCollision const& col, Phis const& /*phis*/, Tracks const& tracks) + { + colHistManager.fill(col); + auto phiSlice = phiPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + for (auto const& phi : phiSlice) { + phiHistManager.fill(phi, tracks); + } + }; + PROCESS_SWITCH(FemtoTwotrackresonanceQa, processPhis, "Process Phis", true); + + void processRho0s(FilteredCollision const& col, Rho0s const& /*rho0s*/, Tracks const& tracks) + { + colHistManager.fill(col); + auto rho0Slice = rho0Partition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + for (auto const& rho0 : rho0Slice) { + rho0HistManager.fill(rho0, tracks); + } + }; + PROCESS_SWITCH(FemtoTwotrackresonanceQa, processRho0s, "Process Rho0s", false); + + void processKstar0s(FilteredCollision const& col, Kstar0s const& /*kstar0s*/, Tracks const& tracks) + { + colHistManager.fill(col); + auto kstar0Slice = kstar0Partition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + for (auto const& kstar0 : kstar0Slice) { + kstar0HistManager.fill(kstar0, tracks); + } + }; + PROCESS_SWITCH(FemtoTwotrackresonanceQa, processKstar0s, "Process Kstar0s", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{ + adaptAnalysisTask(cfgc), + }; + return workflow; +} diff --git a/PWGCF/Femto/Tasks/femtoV0Qa.cxx b/PWGCF/Femto/Tasks/femtoV0Qa.cxx new file mode 100644 index 00000000000..c7ae9a8d786 --- /dev/null +++ b/PWGCF/Femto/Tasks/femtoV0Qa.cxx @@ -0,0 +1,160 @@ +// Copyright 2019-2025 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 femtoV0Qa.cxx +/// \brief QA task for v0s +/// \author Anton Riedel, TU München, anton.riedel@cern.ch + +#include "PWGCF/Femto/Core/collisionBuilder.h" +#include "PWGCF/Femto/Core/collisionHistManager.h" +#include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/partitions.h" +#include "PWGCF/Femto/Core/trackHistManager.h" +#include "PWGCF/Femto/Core/v0Builder.h" +#include "PWGCF/Femto/Core/v0HistManager.h" +#include "PWGCF/Femto/DataModel/FemtoTables.h" + +#include "Framework/ASoA.h" +#include "Framework/AnalysisHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/Configurable.h" +#include "Framework/Expressions.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/InitContext.h" +#include "Framework/OutputObjHeader.h" +#include "Framework/runDataProcessing.h" + +#include +#include +#include + +using namespace o2; +using namespace o2::aod; +using namespace o2::soa; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::analysis::femto; + +struct FemtoV0Qa { + + // setup for collisions + collisionbuilder::ConfCollisionFilter collisionSelection; + Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); + + colhistmanager::CollisionHistManager colHistManager; + colhistmanager::ConfCollisionBinning confCollisionBinning; + + // using Collisions = o2::soa::Join; + using Collisions = FCols; + using Collision = Collisions::iterator; + + using FilteredCollisions = o2::soa::Filtered; + using FilteredCollision = FilteredCollisions::iterator; + + using Lambdas = o2::soa::Join; + using K0shorts = o2::soa::Join; + using Tracks = o2::soa::Join; + + SliceCache cache; + + // setup for lambdas + v0builder::ConfLambdaSelection1 confLambdaSelection; + + Partition lambdaPartition = MAKE_LAMBDA_PARTITION(confLambdaSelection); + Preslice perColLambdas = aod::femtobase::stored::collisionId; + + v0histmanager::ConfLambdaBinning1 confLambdaBinning; + v0histmanager::ConfLambdaQaBinning1 confLambdaQaBinning; + v0histmanager::V0HistManager< + v0histmanager::PrefixLambdaQa, + trackhistmanager::PrefixV0PosDaughterQa, + trackhistmanager::PrefixV0NegDaughterQa, + modes::Mode::kAnalysis_Qa, + modes::V0::kLambda> + lambdaHistManager; + + // setup for k0shorts + v0builder::ConfK0shortSelection1 confK0shortSelection; + + Partition k0shortPartition = MAKE_K0SHORT_PARTITION(confK0shortSelection); + Preslice perColK0shorts = aod::femtobase::stored::collisionId; + + v0histmanager::ConfK0shortBinning1 confK0shortBinning; + v0histmanager::ConfK0shortQaBinning1 confK0shortQaBinning; + v0histmanager::V0HistManager< + v0histmanager::PrefixK0shortQa, + trackhistmanager::PrefixV0PosDaughterQa, + trackhistmanager::PrefixV0NegDaughterQa, + modes::Mode::kAnalysis_Qa, + modes::V0::kK0short> + k0shortHistManager; + + // setup for daughters + trackhistmanager::ConfV0PosDauBinning confV0PosDaughterBinning; + trackhistmanager::ConfV0PosDauQaBinning confV0PosDaughterQaBinning; + + trackhistmanager::ConfV0NegDauBinning confV0NegDaughterBinning; + trackhistmanager::ConfV0NegDauQaBinning confV0NegDaughterQaBinning; + + HistogramRegistry hRegistry{"FemtoV0Qa", {}, OutputObjHandlingPolicy::AnalysisObject}; + + void init(InitContext&) + { + // create a map for histogram specs + auto colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); + colHistManager.init(&hRegistry, colHistSpec); + + auto posDaughterHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confV0PosDaughterBinning, confV0PosDaughterQaBinning); + auto negDaughterHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confV0NegDaughterBinning, confV0NegDaughterQaBinning); + + if ((doprocessK0short + doprocessLambda) > 1) { + LOG(fatal) << "Only one process can be activated"; + } + + if (doprocessLambda) { + auto lambdaHistSpec = v0histmanager::makeV0QaHistSpecMap(confLambdaBinning, confLambdaQaBinning); + lambdaHistManager.init(&hRegistry, lambdaHistSpec, posDaughterHistSpec, negDaughterHistSpec); + } + + if (doprocessK0short) { + auto k0shortHistSpec = v0histmanager::makeV0QaHistSpecMap(confK0shortBinning, confK0shortQaBinning); + k0shortHistManager.init(&hRegistry, k0shortHistSpec, posDaughterHistSpec, negDaughterHistSpec); + } + }; + + void processK0short(FilteredCollision const& col, K0shorts const& /*k0shorts*/, Tracks const& tracks) + { + colHistManager.fill(col); + auto k0shortSlice = k0shortPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + for (auto const& k0short : k0shortSlice) { + k0shortHistManager.fill(k0short, tracks); + } + } + PROCESS_SWITCH(FemtoV0Qa, processK0short, "Process k0shorts", false); + + void processLambda(FilteredCollision const& col, Lambdas const& /*lambdas*/, Tracks const& tracks) + { + colHistManager.fill(col); + auto lambdaSlice = lambdaPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + for (auto const& lambda : lambdaSlice) { + lambdaHistManager.fill(lambda, tracks); + } + } + PROCESS_SWITCH(FemtoV0Qa, processLambda, "Process lambdas", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{ + adaptAnalysisTask(cfgc), + }; + return workflow; +} diff --git a/PWGCF/Femto/Utils/CMakeLists.txt b/PWGCF/Femto/Utils/CMakeLists.txt new file mode 100644 index 00000000000..4c182222bf2 --- /dev/null +++ b/PWGCF/Femto/Utils/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright 2019-2024 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. From d96bdbd053f3d85ebfa5d15e012e5697ef21647d Mon Sep 17 00:00:00 2001 From: Nida Malik Date: Sat, 13 Sep 2025 21:50:04 +0530 Subject: [PATCH 386/986] [PWGCF] Added histograms to calculate error with subsample method (#12972) --- .../Tasks/netchargeFluctuations.cxx | 122 +++++++++++++----- 1 file changed, 91 insertions(+), 31 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index c33bdd9cb22..8ce63ab6cf8 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -89,7 +89,7 @@ struct NetchargeFluctuations { // Configurables Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable cfgUrlCCDB{"cfgUrlCCDB", "http://alice-ccdb.cern.ch", "url of ccdb"}; - Configurable cfgPathCCDB{"cfgPathCCDB", "Users/n/nimalik/efftest", "Path for ccdb-object"}; + Configurable cfgPathCCDB{"cfgPathCCDB", "Users/n/nimalik/netcharge/p/Run3/LHC24f3d", "Path for ccdb-object"}; Configurable cfgLoadEff{"cfgLoadEff", true, "Load efficiency"}; Configurable vertexZcut{"vertexZcut", 10.f, "Vertex Z"}; @@ -111,43 +111,44 @@ struct NetchargeFluctuations { Configurable cSel8Trig{"cSel8Trig", true, "Sel8 (T0A + T0C) Selection Run3"}; // sel8 Configurable cInt7Trig{"cInt7Trig", true, "kINT7 MB Trigger"}; // kINT7 Configurable cSel7Trig{"cSel7Trig", true, "Sel7 (V0A + V0C) Selection Run2"}; // sel7 - Configurable cTFBorder{"cTFBorder", false, "Timeframe Border Selection"}; // pileup - Configurable cNoItsROBorder{"cNoItsROBorder", false, "No ITSRO Border Cut"}; // pileup - Configurable cItsTpcVtx{"cItsTpcVtx", false, "ITS+TPC Vertex Selection"}; // pileup Configurable cPileupReject{"cPileupReject", false, "Pileup rejection"}; // pileup - Configurable cZVtxTimeDiff{"cZVtxTimeDiff", false, "z-vtx time diff selection"}; // pileup Configurable cfgUseGoodItsLayerAllCut{"cfgUseGoodItsLayerAllCut", false, "Good ITS Layers All"}; // pileup Configurable cDcaXy{"cDcaXy", false, "Dca XY cut"}; Configurable cDcaZ{"cDcaZ", false, "Dca Z cut"}; Configurable cTpcCr{"cTpcCr", false, "tpc crossrows"}; Configurable cItsChi{"cItsChi", false, "ITS chi"}; Configurable cTpcChi{"cTpcChi", false, "TPC chi"}; + Configurable cFT0C{"cFT0C", true, "cent FT0C"}; + Configurable cFT0M{"cFT0M", false, "cent FT0M"}; + ConfigurableAxis centBining{"centBining", {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, "Centrality/Multiplicity percentile bining"}; + Configurable cTFBorder{"cTFBorder", false, "Timeframe Border Selection"}; // pileup + Configurable cNoItsROBorder{"cNoItsROBorder", false, "No ITSRO Border Cut"}; // pileup + Configurable cItsTpcVtx{"cItsTpcVtx", false, "ITS+TPC Vertex Selection"}; // pileup + Configurable cZVtxTimeDiff{"cZVtxTimeDiff", false, "z-vtx time diff selection"}; // pileup // CCDB efficiency histograms - TH2D* efficiency = nullptr; + TH1D* efficiency = nullptr; // Initialization void init(o2::framework::InitContext&) { const AxisSpec vtxzAxis = {800, -20, 20, "V_{Z} (cm)"}; - const AxisSpec dcaAxis = {250, -0.5, 0.5, "DCA_{xy} (cm)"}; - const AxisSpec dcazAxis = {250, -0.5, 0.5, "DCA_{z} (cm)"}; + const AxisSpec dcaAxis = {1000, -0.5, 0.5, "DCA_{xy} (cm)"}; + const AxisSpec dcazAxis = {600, -3, 3, "DCA_{z} (cm)"}; const AxisSpec ptAxis = {70, 0.0, 7.0, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec etaAxis = {20, -1., 1., "#eta"}; const AxisSpec deltaEtaAxis = {9, 0, 1.8, "#eta"}; const AxisSpec centAxis = {100, 0., 100., "centrality"}; - const AxisSpec multAxis = {200, 0., 10000., "FT0M Amplitude"}; - const AxisSpec tpcChiAxis = {1400, 0., 7., "Chi2"}; - const AxisSpec itsChiAxis = {800, 0., 40., "Chi2"}; + const AxisSpec multAxis = {100000, 0., 100000., "FT0M Amplitude"}; + const AxisSpec tpcChiAxis = {700, 0., 7., "Chi2"}; + const AxisSpec itsChiAxis = {400, 0., 40., "Chi2"}; const AxisSpec crossedRowAxis = {1600, 0., 160., "TPC Crossed rows"}; const AxisSpec eventsAxis = {10, 0, 10, ""}; const AxisSpec signAxis = {20, -10, 10, ""}; const AxisSpec nchAxis = {5000, 0, 5000, "Nch"}; const AxisSpec nch1Axis = {1500, 0, 1500, "Nch"}; const AxisSpec nchpAxis = {50000, 0, 50000, "Nch"}; - - std::vector centBining = {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}; - AxisSpec cent1Axis = {centBining, "Multiplicity percentile from FT0M (%)"}; + const AxisSpec cent1Axis{centBining, "Multiplicity percentile from FT0M (%)"}; auto noSubsample = static_cast(cfgNSubsample); float maxSubsample = 1.0 * noSubsample; @@ -251,16 +252,37 @@ struct NetchargeFluctuations { histogramRegistry.add("subsample/neg_sq", "", kTProfile2D, {cent1Axis, subsampleAxis}); histogramRegistry.add("subsample/posneg", "", kTProfile2D, {cent1Axis, subsampleAxis}); + histogramRegistry.add("subsample/gen/pos", "", kTProfile2D, {cent1Axis, subsampleAxis}); + histogramRegistry.add("subsample/gen/neg", "", kTProfile2D, {cent1Axis, subsampleAxis}); + histogramRegistry.add("subsample/gen/termp", "", kTProfile2D, {cent1Axis, subsampleAxis}); + histogramRegistry.add("subsample/gen/termn", "", kTProfile2D, {cent1Axis, subsampleAxis}); + histogramRegistry.add("subsample/gen/pos_sq", "", kTProfile2D, {cent1Axis, subsampleAxis}); + histogramRegistry.add("subsample/gen/neg_sq", "", kTProfile2D, {cent1Axis, subsampleAxis}); + histogramRegistry.add("subsample/gen/posneg", "", kTProfile2D, {cent1Axis, subsampleAxis}); + + histogramRegistry.add("subsample/delta_eta/pos", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + histogramRegistry.add("subsample/delta_eta/neg", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + histogramRegistry.add("subsample/delta_eta/termp", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + histogramRegistry.add("subsample/delta_eta/termn", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + histogramRegistry.add("subsample/delta_eta/pos_sq", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + histogramRegistry.add("subsample/delta_eta/neg_sq", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + histogramRegistry.add("subsample/delta_eta/posneg", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + + histogramRegistry.add("subsample/delta_eta/gen/pos", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + histogramRegistry.add("subsample/delta_eta/gen/neg", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + histogramRegistry.add("subsample/delta_eta/gen/termp", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + histogramRegistry.add("subsample/delta_eta/gen/termn", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + histogramRegistry.add("subsample/delta_eta/gen/pos_sq", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + histogramRegistry.add("subsample/delta_eta/gen/neg_sq", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + histogramRegistry.add("subsample/delta_eta/gen/posneg", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + if (cfgLoadEff) { ccdb->setURL(cfgUrlCCDB.value); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); - // ccdb->setCreatedNotAfter(ccdbNoLaterThan.value); - // LOGF(info, "Getting object %s", ccdbPath.value.data()); - TList* list = ccdb->getForTimeStamp(cfgPathCCDB.value, -1); - efficiency = reinterpret_cast(list->FindObject("efficiency_Run3")); + efficiency = reinterpret_cast(list->FindObject("efficiency_Run3")); if (!efficiency) { LOGF(info, "FATAL!! Could not find required histograms in CCDB"); } @@ -277,8 +299,14 @@ struct NetchargeFluctuations { if (cSel8Trig && !coll.sel8()) { return false; } // require min bias trigger - cent = coll.centFT0M(); // centrality for run3 - mult = coll.multFT0M(); // multiplicity for run3 + if (cFT0M) { + cent = coll.centFT0M(); // centrality for run3 using FT0M + mult = coll.multFT0M(); + } else if (cFT0C) { + cent = coll.centFT0C(); // centrality for run3 using FT0C + mult = coll.multFT0C(); + } + } else if constexpr (run == kRun2) { if (cInt7Trig && !coll.alias_bit(kINT7)) { return false; @@ -358,17 +386,16 @@ struct NetchargeFluctuations { return true; } - double getEfficiency(float pt, float eta, TH2D* hEff) + double getEfficiency(float pt, TH1D* hEff) { if (!hEff) { return 1e-6; } - int binX = hEff->GetXaxis()->FindBin(pt); - int binY = hEff->GetYaxis()->FindBin(eta); - if (binX < 1 || binX > hEff->GetNbinsX() || binY < 1 || binY > hEff->GetNbinsY()) { + int bin = hEff->GetXaxis()->FindBin(pt); + if (bin < 1 || bin > hEff->GetNbinsX()) { return 1e-6; } - double eff = hEff->GetBinContent(binX, binY); + double eff = hEff->GetBinContent(bin); return eff; } @@ -420,7 +447,7 @@ struct NetchargeFluctuations { double posWeight = 0, negWeight = 0, nchCor = 0, nchTotalCor = 0; for (const auto& track : tracks) { - double eff = getEfficiency(track.pt(), track.eta(), efficiency); + double eff = getEfficiency(track.pt(), efficiency); if (eff < threshold) continue; double weight = 1.0 / eff; @@ -490,7 +517,7 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("QA/cent_hEta"), cent, track.eta()); histogramRegistry.fill(HIST("QA/cent_hPt"), cent, track.pt()); - double eff = getEfficiency(track.pt(), track.eta(), efficiency); + double eff = getEfficiency(track.pt(), efficiency); if (eff < threshold) continue; double weight = 1.0 / eff; @@ -574,6 +601,17 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("gen/cent_nch"), cent, nchGen); histogramRegistry.fill(HIST("gen/nch"), nchGen); + float lRandom = fRndm->Rndm(); + int sampleIndex = static_cast(cfgNSubsample * lRandom); + + histogramRegistry.fill(HIST("subsample/gen/pos"), cent, sampleIndex, posGen); + histogramRegistry.fill(HIST("subsample/gen/neg"), cent, sampleIndex, negGen); + histogramRegistry.fill(HIST("subsample/gen/termp"), cent, sampleIndex, termPGen); + histogramRegistry.fill(HIST("subsample/gen/termn"), cent, sampleIndex, termNGen); + histogramRegistry.fill(HIST("subsample/gen/pos_sq"), cent, sampleIndex, posGen * posGen); + histogramRegistry.fill(HIST("subsample/gen/neg_sq"), cent, sampleIndex, negGen * negGen); + histogramRegistry.fill(HIST("subsample/gen/posneg"), cent, sampleIndex, posNegGen); + } // void template @@ -593,7 +631,7 @@ struct NetchargeFluctuations { if (!selTrack(track)) continue; nch += 1; - double eff = getEfficiency(track.pt(), track.eta(), efficiency); + double eff = getEfficiency(track.pt(), efficiency); if (eff < threshold) continue; double weight = 1.0 / eff; @@ -630,6 +668,17 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fpos * fpos); histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fneg * fneg); histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posneg); + + float lRandom = fRndm->Rndm(); + int sampleIndex = static_cast(cfgNSubsample * lRandom); + + histogramRegistry.fill(HIST("subsample/delta_eta/pos"), deltaEtaWidth, sampleIndex, fpos); + histogramRegistry.fill(HIST("subsample/delta_eta/neg"), deltaEtaWidth, sampleIndex, fneg); + histogramRegistry.fill(HIST("subsample/delta_eta/termp"), deltaEtaWidth, sampleIndex, termp); + histogramRegistry.fill(HIST("subsample/delta_eta/termn"), deltaEtaWidth, sampleIndex, termn); + histogramRegistry.fill(HIST("subsample/delta_eta/pos_sq"), deltaEtaWidth, sampleIndex, fpos * fpos); + histogramRegistry.fill(HIST("subsample/delta_eta/neg_sq"), deltaEtaWidth, sampleIndex, fneg * fneg); + histogramRegistry.fill(HIST("subsample/delta_eta/posneg"), deltaEtaWidth, sampleIndex, posneg); } template @@ -662,7 +711,7 @@ struct NetchargeFluctuations { continue; histogramRegistry.fill(HIST("data/delta_eta_eta"), eta); - double eff = getEfficiency(track.pt(), eta, efficiency); + double eff = getEfficiency(track.pt(), efficiency); if (eff < threshold) continue; double weight = 1.0 / eff; @@ -754,6 +803,17 @@ struct NetchargeFluctuations { histogramRegistry.fill(HIST("gen/delta_eta_posneg"), deltaEtaWidth, posNegGen); histogramRegistry.fill(HIST("gen/delta_eta_nch"), deltaEtaWidth, nchGen); + float lRandom = fRndm->Rndm(); + int sampleIndex = static_cast(cfgNSubsample * lRandom); + + histogramRegistry.fill(HIST("subsample/delta_eta/gen/pos"), deltaEtaWidth, sampleIndex, posGen); + histogramRegistry.fill(HIST("subsample/delta_eta/gen/neg"), deltaEtaWidth, sampleIndex, negGen); + histogramRegistry.fill(HIST("subsample/delta_eta/gen/termp"), deltaEtaWidth, sampleIndex, termPGen); + histogramRegistry.fill(HIST("subsample/delta_eta/gen/termn"), deltaEtaWidth, sampleIndex, termNGen); + histogramRegistry.fill(HIST("subsample/delta_eta/gen/pos_sq"), deltaEtaWidth, sampleIndex, posGen * posGen); + histogramRegistry.fill(HIST("subsample/delta_eta/gen/neg_sq"), deltaEtaWidth, sampleIndex, negGen * negGen); + histogramRegistry.fill(HIST("subsample/delta_eta/gen/posneg"), deltaEtaWidth, sampleIndex, posNegGen); + } // void SliceCache cache; @@ -771,7 +831,7 @@ struct NetchargeFluctuations { } } - PROCESS_SWITCH(NetchargeFluctuations, processDataRun3, "Process for Run3 DATA", true); + PROCESS_SWITCH(NetchargeFluctuations, processDataRun3, "Process for Run3 DATA", false); // process function for Data Run2 void processDataRun2(aod::MyCollisionRun2 const& coll, aod::MyTracks const& tracks) @@ -799,7 +859,7 @@ struct NetchargeFluctuations { calculationMcDeltaEta(coll, inputTracks, mcCollisions, mcParticles, etaMin, etaMax); } } - PROCESS_SWITCH(NetchargeFluctuations, processMcRun3, "Process reconstructed", false); + PROCESS_SWITCH(NetchargeFluctuations, processMcRun3, "Process reconstructed", true); // process function for MC Run2 From 94b403463340394c425d89d7019fafad7be8fdbf Mon Sep 17 00:00:00 2001 From: JStaa <39123272+JStaa@users.noreply.github.com> Date: Sat, 13 Sep 2025 18:20:51 +0200 Subject: [PATCH 387/986] [PWGCF] Separated TPC & TOF distributions by charge (#12973) --- .../Tasks/threeParticleCorrelations.cxx | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx b/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx index 534c88d2cda..b4cdb1f8531 100644 --- a/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx +++ b/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx @@ -194,21 +194,21 @@ struct ThreeParticleCorrelations { rQARegistry.add("hPtProton_MC", "hPtProton_MC", {HistType::kTH3D, {{trackPtAxis}, {centralityAxis}, {2, -2, 2}}}); rQARegistry.add("hPtV0_MC", "hPtV0_MC", {HistType::kTH3D, {{v0PtAxis}, {centralityAxis}, {2, -2, 2}}}); - rQARegistry.add("hdEdx", "hdEdx", {HistType::kTH2D, {{56, 0.2, 3.0}, {180, 20, 200}}}); - rQARegistry.add("hdEdxPion", "hdEdxPion", {HistType::kTH2D, {{56, 0.2, 3.0}, {180, 20, 200}}}); - rQARegistry.add("hdEdxKaon", "hdEdxKaon", {HistType::kTH2D, {{56, 0.2, 3.0}, {180, 20, 200}}}); - rQARegistry.add("hdEdxProton", "hdEdxProton", {HistType::kTH2D, {{56, 0.2, 3.0}, {180, 20, 200}}}); - rQARegistry.add("hBeta", "hBeta", {HistType::kTH2D, {{56, 0.2, 3.0}, {70, 0.4, 1.1}}}); - rQARegistry.add("hBetaPion", "hBetaPion", {HistType::kTH2D, {{56, 0.2, 3.0}, {70, 0.4, 1.1}}}); - rQARegistry.add("hBetaKaon", "hBetaKaon", {HistType::kTH2D, {{56, 0.2, 3.0}, {70, 0.4, 1.1}}}); - rQARegistry.add("hBetaProton", "hBetaProton", {HistType::kTH2D, {{56, 0.2, 3.0}, {70, 0.4, 1.1}}}); - - rQARegistry.add("hTPCPion", "hTPCPion", {HistType::kTH2D, {{trackPtAxis}, {1001, -50.05, 50.05}}}); - rQARegistry.add("hTPCKaon", "hTPCKaon", {HistType::kTH2D, {{trackPtAxis}, {1001, -50.05, 50.05}}}); - rQARegistry.add("hTPCProton", "hTPCProton", {HistType::kTH2D, {{trackPtAxis}, {1001, -50.05, 50.05}}}); - rQARegistry.add("hTOFPion", "hTOFPion", {HistType::kTH2D, {{trackPtAxis}, {1001, -50.05, 50.05}}}); - rQARegistry.add("hTOFKaon", "hTOFKaon", {HistType::kTH2D, {{trackPtAxis}, {1001, -50.05, 50.05}}}); - rQARegistry.add("hTOFProton", "hTOFProton", {HistType::kTH2D, {{trackPtAxis}, {1001, -50.05, 50.05}}}); + rQARegistry.add("hdEdx", "hdEdx", {HistType::kTH2D, {{120, -3.0, 3.0}, {180, 20, 200}}}); + rQARegistry.add("hdEdxPion", "hdEdxPion", {HistType::kTH2D, {{120, -3.0, 3.0}, {180, 20, 200}}}); + rQARegistry.add("hdEdxKaon", "hdEdxKaon", {HistType::kTH2D, {{120, -3.0, 3.0}, {180, 20, 200}}}); + rQARegistry.add("hdEdxProton", "hdEdxProton", {HistType::kTH2D, {{120, -3.0, 3.0}, {180, 20, 200}}}); + rQARegistry.add("hBeta", "hBeta", {HistType::kTH2D, {{120, -3.0, 3.0}, {70, 0.4, 1.1}}}); + rQARegistry.add("hBetaPion", "hBetaPion", {HistType::kTH2D, {{120, -3.0, 3.0}, {70, 0.4, 1.1}}}); + rQARegistry.add("hBetaKaon", "hBetaKaon", {HistType::kTH2D, {{120, -3.0, 3.0}, {70, 0.4, 1.1}}}); + rQARegistry.add("hBetaProton", "hBetaProton", {HistType::kTH2D, {{120, -3.0, 3.0}, {70, 0.4, 1.1}}}); + + rQARegistry.add("hTPCPion", "hTPCPion", {HistType::kTH3D, {{trackPtAxis}, {1001, -50.05, 50.05}, {2, -2, 2}}}); + rQARegistry.add("hTPCKaon", "hTPCKaon", {HistType::kTH3D, {{trackPtAxis}, {1001, -50.05, 50.05}, {2, -2, 2}}}); + rQARegistry.add("hTPCProton", "hTPCProton", {HistType::kTH3D, {{trackPtAxis}, {1001, -50.05, 50.05}, {2, -2, 2}}}); + rQARegistry.add("hTOFPion", "hTOFPion", {HistType::kTH3D, {{trackPtAxis}, {1001, -50.05, 50.05}, {2, -2, 2}}}); + rQARegistry.add("hTOFKaon", "hTOFKaon", {HistType::kTH3D, {{trackPtAxis}, {1001, -50.05, 50.05}, {2, -2, 2}}}); + rQARegistry.add("hTOFProton", "hTOFProton", {HistType::kTH3D, {{trackPtAxis}, {1001, -50.05, 50.05}, {2, -2, 2}}}); rQARegistry.add("hInvMassLambda", "hInvMassLambda", {HistType::kTH3D, {{lambdaInvMassAxis}, {v0PtAxis}, {centralityAxis}}}); rQARegistry.add("hInvMassAntiLambda", "hInvMassAntiLambda", {HistType::kTH3D, {{lambdaInvMassAxis}, {v0PtAxis}, {centralityAxis}}}); @@ -348,13 +348,13 @@ struct ThreeParticleCorrelations { // Start of the Track QA for (const auto& track : tracks) { - rQARegistry.fill(HIST("hTPCPion"), track.pt(), track.tpcNSigmaPi()); - rQARegistry.fill(HIST("hTPCKaon"), track.pt(), track.tpcNSigmaKa()); - rQARegistry.fill(HIST("hTPCProton"), track.pt(), track.tpcNSigmaPr()); + rQARegistry.fill(HIST("hTPCPion"), track.pt(), track.tpcNSigmaPi(), track.sign()); + rQARegistry.fill(HIST("hTPCKaon"), track.pt(), track.tpcNSigmaKa(), track.sign()); + rQARegistry.fill(HIST("hTPCProton"), track.pt(), track.tpcNSigmaPr(), track.sign()); if (track.hasTOF()) { - rQARegistry.fill(HIST("hTOFPion"), track.pt(), track.tofNSigmaPi()); - rQARegistry.fill(HIST("hTOFKaon"), track.pt(), track.tofNSigmaKa()); - rQARegistry.fill(HIST("hTOFProton"), track.pt(), track.tofNSigmaPr()); + rQARegistry.fill(HIST("hTOFPion"), track.pt(), track.tofNSigmaPi(), track.sign()); + rQARegistry.fill(HIST("hTOFKaon"), track.pt(), track.tofNSigmaKa(), track.sign()); + rQARegistry.fill(HIST("hTOFProton"), track.pt(), track.tofNSigmaPr(), track.sign()); } if (trackFilters(track)) { @@ -363,23 +363,23 @@ struct ThreeParticleCorrelations { rQARegistry.fill(HIST("hTrackEta"), track.eta()); rQARegistry.fill(HIST("hTrackPhi"), track.phi()); rQARegistry.fill(HIST("hTrackNSharedClusters"), track.tpcNClsShared()); - rQARegistry.fill(HIST("hdEdx"), track.pt(), track.tpcSignal()); - rQARegistry.fill(HIST("hBeta"), track.pt(), track.beta()); + rQARegistry.fill(HIST("hdEdx"), track.sign() * track.pt(), track.tpcSignal()); + rQARegistry.fill(HIST("hBeta"), track.sign() * track.pt(), track.beta()); if (assocPID[0] == pionID) { // Pions rQARegistry.fill(HIST("hPtPion_Uncorrected"), track.pt(), collision.centFT0C(), track.sign()); rQARegistry.fill(HIST("hPtPion_Corrected"), track.pt(), collision.centFT0C(), track.sign(), 1. / trackEff(hEffPions, track, collision.centFT0C())); - rQARegistry.fill(HIST("hdEdxPion"), track.pt(), track.tpcSignal()); - rQARegistry.fill(HIST("hBetaPion"), track.pt(), track.beta()); + rQARegistry.fill(HIST("hdEdxPion"), track.sign() * track.pt(), track.tpcSignal()); + rQARegistry.fill(HIST("hBetaPion"), track.sign() * track.pt(), track.beta()); } else if (assocPID[0] == kaonID) { // Kaons rQARegistry.fill(HIST("hPtKaon_Uncorrected"), track.pt(), collision.centFT0C(), track.sign()); rQARegistry.fill(HIST("hPtKaon_Corrected"), track.pt(), collision.centFT0C(), track.sign(), 1. / trackEff(hEffKaons, track, collision.centFT0C())); - rQARegistry.fill(HIST("hdEdxKaon"), track.pt(), track.tpcSignal()); - rQARegistry.fill(HIST("hBetaKaon"), track.pt(), track.beta()); + rQARegistry.fill(HIST("hdEdxKaon"), track.sign() * track.pt(), track.tpcSignal()); + rQARegistry.fill(HIST("hBetaKaon"), track.sign() * track.pt(), track.beta()); } else if (assocPID[0] == protonID) { // Protons rQARegistry.fill(HIST("hPtProton_Uncorrected"), track.pt(), collision.centFT0C(), track.sign()); rQARegistry.fill(HIST("hPtProton_Corrected"), track.pt(), collision.centFT0C(), track.sign(), 1. / trackEff(hEffProtons, track, collision.centFT0C())); - rQARegistry.fill(HIST("hdEdxProton"), track.pt(), track.tpcSignal()); - rQARegistry.fill(HIST("hBetaProton"), track.pt(), track.beta()); + rQARegistry.fill(HIST("hdEdxProton"), track.sign() * track.pt(), track.tpcSignal()); + rQARegistry.fill(HIST("hBetaProton"), track.sign() * track.pt(), track.beta()); } } } From 58fab41fd673c4f58bc308b70930f2420b660fee Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sat, 13 Sep 2025 23:21:22 +0200 Subject: [PATCH 388/986] [PWGLF] Minor safety changes for strangenesstofpid task (#12975) Co-authored-by: ALICE Builder --- .../Strangeness/strangenesstofpid.cxx | 48 +++++++++++-------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx index b19d7ba04c8..12234489158 100644 --- a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx @@ -10,7 +10,7 @@ // or submit itself to any jurisdiction. // // *+-+*+-+*+-+*+-+*+-+*+-+* -// Lambdakzero PID +// Strangeness TOF PID // *+-+*+-+*+-+*+-+*+-+*+-+* // /// \author Nicolò Jacazio @@ -162,23 +162,23 @@ struct strangenesstofpid { // for n-sigma calibration bool nSigmaCalibLoaded; - TList* nSigmaCalibObjects; - TH1 *hMeanPosLaPi, *hSigmaPosLaPi; - TH1 *hMeanPosLaPr, *hSigmaPosLaPr; - TH1 *hMeanNegLaPi, *hSigmaNegLaPi; - TH1 *hMeanNegLaPr, *hSigmaNegLaPr; - TH1 *hMeanPosK0Pi, *hSigmaPosK0Pi; - TH1 *hMeanNegK0Pi, *hSigmaNegK0Pi; - TH1 *hMeanPosXiPi, *hSigmaPosXiPi; - TH1 *hMeanPosXiPr, *hSigmaPosXiPr; - TH1 *hMeanNegXiPi, *hSigmaNegXiPi; - TH1 *hMeanNegXiPr, *hSigmaNegXiPr; - TH1 *hMeanBachXiPi, *hSigmaBachXiPi; - TH1 *hMeanPosOmPi, *hSigmaPosOmPi; - TH1 *hMeanPosOmPr, *hSigmaPosOmPr; - TH1 *hMeanNegOmPi, *hSigmaNegOmPi; - TH1 *hMeanNegOmPr, *hSigmaNegOmPr; - TH1 *hMeanBachOmKa, *hSigmaBachOmKa; + TList* nSigmaCalibObjects = nullptr; + TH1 *hMeanPosLaPi = nullptr, *hSigmaPosLaPi = nullptr; + TH1 *hMeanPosLaPr = nullptr, *hSigmaPosLaPr = nullptr; + TH1 *hMeanNegLaPi = nullptr, *hSigmaNegLaPi = nullptr; + TH1 *hMeanNegLaPr = nullptr, *hSigmaNegLaPr = nullptr; + TH1 *hMeanPosK0Pi = nullptr, *hSigmaPosK0Pi = nullptr; + TH1 *hMeanNegK0Pi = nullptr, *hSigmaNegK0Pi = nullptr; + TH1 *hMeanPosXiPi = nullptr, *hSigmaPosXiPi = nullptr; + TH1 *hMeanPosXiPr = nullptr, *hSigmaPosXiPr = nullptr; + TH1 *hMeanNegXiPi = nullptr, *hSigmaNegXiPi = nullptr; + TH1 *hMeanNegXiPr = nullptr, *hSigmaNegXiPr = nullptr; + TH1 *hMeanBachXiPi = nullptr, *hSigmaBachXiPi = nullptr; + TH1 *hMeanPosOmPi = nullptr, *hSigmaPosOmPi = nullptr; + TH1 *hMeanPosOmPr = nullptr, *hSigmaPosOmPr = nullptr; + TH1 *hMeanNegOmPi = nullptr, *hSigmaNegOmPi = nullptr; + TH1 *hMeanNegOmPr = nullptr, *hSigmaNegOmPr = nullptr; + TH1 *hMeanBachOmKa = nullptr, *hSigmaBachOmKa = nullptr; int mRunNumber; float d_bz; @@ -191,7 +191,7 @@ struct strangenesstofpid { kNEnums }; /// function to calculate track length of this track up to a certain segment of a detector - /// to be used internally in another funcrtion that calculates length until it finds the proper one + /// to be used internally in another function that calculates length until it finds the proper one /// warning: this could be optimised further for speed /// \param track the input track /// \param x1 x of the first point of the detector segment @@ -1169,7 +1169,13 @@ struct strangenesstofpid { return; } auto firstTOFPID = dauTrackTOFPIDs.rawIteratorAt(0); - bool isNewTOFFOrmat = firstTOFPID.straCollisionId() < 0 ? false : true; + bool isNewTOFFormat = firstTOFPID.straCollisionId() < 0 ? false : true; + + LOGF(info, "Processing derived data. Is this the new TOF info format? %i", isNewTOFFormat); + + if (!isNewTOFFormat && calculationMethod.value > 0) { + LOGF(fatal, "Using the old derived data format with the new calculation method is not viable due to lack of needed info! Crashing."); + } // Fire up CCDB with first collision in record. If no collisions, bypass if (useCustomRunNumber || collisions.size() < 1) { @@ -1182,7 +1188,7 @@ struct strangenesstofpid { // hold indices std::vector tofIndices(dauTrackTable.size(), -1); - if (isNewTOFFOrmat) { + if (isNewTOFFormat) { // re-index for (const auto& dauTrackTOFPID : dauTrackTOFPIDs) { tofIndices[dauTrackTOFPID.dauTrackExtraId()] = dauTrackTOFPID.globalIndex(); From 5699df7a0d53b2e84ec7ce393c5e8d9d5eb3b39a Mon Sep 17 00:00:00 2001 From: Oleksii Lubynets Date: Sat, 13 Sep 2025 23:26:51 +0200 Subject: [PATCH 389/986] [PWGHF] Bugfix: do not write KF minv into non-KF tree (#12906) --- PWGHF/TableProducer/treeCreatorLcToPKPi.cxx | 30 +++++++++------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx b/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx index 90b47824835..e9cc4401c31 100644 --- a/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx @@ -565,17 +565,11 @@ struct HfTreeCreatorLcToPKPi { /// \brief function to evaluate invariant mass of the Lc candidate and KPi pair /// \param candidate candidate instance /// \param candFlag flag indicating if PKPi (0) or PiKP (1) hypothesis is used - template - std::pair evaluateInvariantMasses(CandType const& candidate, int candFlag) + template + std::pair evaluateInvariantMassesDCAFitter(CandType const& candidate, int candFlag) { - float invMass, invMassKPi; - if constexpr (reconstructionType == aod::hf_cand::VertexerType::DCAFitter) { - invMass = candFlag == 0 ? hfHelper.invMassLcToPKPi(candidate) : hfHelper.invMassLcToPiKP(candidate); - invMassKPi = candFlag == 0 ? hfHelper.invMassKPiPairLcToPKPi(candidate) : hfHelper.invMassKPiPairLcToPiKP(candidate); - } else { - invMass = candFlag == 0 ? candidate.kfMassPKPi() : candidate.kfMassPiKP(); - invMassKPi = candFlag == 0 ? candidate.kfMassKPi() : candidate.kfMassPiK(); - } + const float invMass = candFlag == 0 ? hfHelper.invMassLcToPKPi(candidate) : hfHelper.invMassLcToPiKP(candidate); + const float invMassKPi = candFlag == 0 ? hfHelper.invMassKPiPairLcToPKPi(candidate) : hfHelper.invMassKPiPairLcToPiKP(candidate); return std::make_pair(invMass, invMassKPi); } @@ -612,10 +606,10 @@ struct HfTreeCreatorLcToPKPi { /// \param candidate candidate instance /// \param candidateMlScore instance of handler of vectors with ML scores associated with the current candidate /// \param candFlag flag indicating if PKPi (0) or PiKP (1) hypothesis is used - template + template void fillLiteTable(CandType const& candidate, aod::HfMlLcToPKPi::iterator const& candidateMlScore, int candFlag) { - auto [functionInvMass, functionInvMassKPi] = evaluateInvariantMasses(candidate, candFlag); + auto [functionInvMass, functionInvMassKPi] = evaluateInvariantMassesDCAFitter(candidate, candFlag); const float functionCt = hfHelper.ctLc(candidate); const float functionY = hfHelper.yLc(candidate); @@ -697,10 +691,10 @@ struct HfTreeCreatorLcToPKPi { /// \param candidate candidate instance /// \param candidateMlScore instance of handler of vectors with ML scores associated with the current candidate /// \param candFlag flag indicating if PKPi (0) or PiKP (1) hypothesis is used - template + template void fillFullTable(CandType const& candidate, aod::HfMlLcToPKPi::iterator const& candidateMlScore, int candFlag) { - auto [functionInvMass, functionInvMassKPi] = evaluateInvariantMasses(candidate, candFlag); + auto [functionInvMass, functionInvMassKPi] = evaluateInvariantMassesDCAFitter(candidate, candFlag); const float functionCt = hfHelper.ctLc(candidate); const float functionY = hfHelper.yLc(candidate); const float functionE = hfHelper.eLc(candidate); @@ -948,9 +942,9 @@ struct HfTreeCreatorLcToPKPi { const bool notSkippedBkg = isMcCandidateSignal || candidate.pt() > downSampleBkgPtMax || pseudoRndm < downSampleBkgFactor; if (passSelection && notSkippedBkg && (keepAll || (keepOnlySignalMc && isMcCandidateSignal) || (keepOnlyBkg && !isMcCandidateSignal) || (keepCorrBkgMC && isCorrBkg))) { if (fillCandidateLiteTable) { - fillLiteTable(candidate, candidateMlScore, candFlag); + fillLiteTable(candidate, candidateMlScore, candFlag); } else { - fillFullTable(candidate, candidateMlScore, candFlag); + fillFullTable(candidate, candidateMlScore, candFlag); } if constexpr (reconstructionType == aod::hf_cand::VertexerType::KfParticle) { @@ -1130,9 +1124,9 @@ struct HfTreeCreatorLcToPKPi { const int functionSelection = candFlag == 0 ? candidate.isSelLcToPKPi() : candidate.isSelLcToPiKP(); if (functionSelection >= selectionFlagLc && (candidate.pt() > downSampleBkgPtMax || (pseudoRndm < downSampleBkgFactor && candidate.pt() < downSampleBkgPtMax))) { if (fillCandidateLiteTable) { - fillLiteTable(candidate, candidateMlScore, candFlag); + fillLiteTable(candidate, candidateMlScore, candFlag); } else { - fillFullTable(candidate, candidateMlScore, candFlag); + fillFullTable(candidate, candidateMlScore, candFlag); } if constexpr (reconstructionType == aod::hf_cand::VertexerType::KfParticle) { From dbf3c1f5f909c7503a7930f1b4e1afe0521bf776 Mon Sep 17 00:00:00 2001 From: dajones2 <140733426+dajones2@users.noreply.github.com> Date: Sun, 14 Sep 2025 08:50:56 +0100 Subject: [PATCH 390/986] [PWGJE] Fixing runtime issues and other minor bugs (#12970) --- PWGJE/Tasks/jetHadronRecoil.cxx | 54 ++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/PWGJE/Tasks/jetHadronRecoil.cxx b/PWGJE/Tasks/jetHadronRecoil.cxx index 5728b4d542c..7850288059d 100644 --- a/PWGJE/Tasks/jetHadronRecoil.cxx +++ b/PWGJE/Tasks/jetHadronRecoil.cxx @@ -169,8 +169,6 @@ struct JetHadronRecoil { registry.add("hTrack3D", "3D tracks histogram;p_{T};#eta;#phi", {HistType::kTH3F, {{200, 0, 200}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}, doSumw); registry.add("hPtTrackPtHard", "Tracks vs pThard;#frac{p_{T}}{#hat{p}};p_{T}", {HistType::kTH2F, {{20, 0, 5}, {200, 0, 200}}}, doSumw); registry.add("hTracksvsJets", "comparing leading tracks and jets;p_{T,track};p_{T,jet};#hat{p}", {HistType::kTH3F, {{200, 0, 200}, {500, -100, 400}, {195, 5, 200}}}, doSumw); - registry.add("hDeltaR", "#DeltaR;#DeltaR;#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}, doSumw); - registry.add("hDeltaRpT", "jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{500, -100, 400}, dRAxis}}, doSumw); registry.add("hRhoSignal", "Signal Rho bkg;#rho;entries", {HistType::kTH1F, {{220, 0, 220}}}, doSumw); registry.add("hRhoReference", "Reference Rho bkg;#rho;entries", {HistType::kTH1F, {{220, 0, 220}}}, doSumw); registry.add("hRhoReferenceShift", "Testing reference shifts;#rho;shift", {HistType::kTH2F, {{220, 0, 220}, {20, 0.0, 2.0}}}, doSumw); @@ -190,8 +188,6 @@ struct JetHadronRecoil { registry.add("hPhiPart", "Particle #phi;#phi;entries", {HistType::kTH1F, {{100, 0.0, o2::constants::math::TwoPI}}}, doSumw); registry.add("hPart3D", "3D tracks histogram;p_{T};#eta;#phi", {HistType::kTH3F, {{200, 0, 200}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}, doSumw); registry.add("hPtPartPtHard", "Track p_{T} vs #hat{p};p_{T};#frac{p_{T}}{#hat{p}}", {HistType::kTH2F, {{200, 0, 200}, {20, 0, 5}}}, doSumw); - registry.add("hDeltaRPart", "Particle #DeltaR;#DeltaR;#frac{1}{N_{jets}}#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}, doSumw); - registry.add("hDeltaRpTPart", "Particle jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{400, 0, 400}, dRAxis}}, doSumw); registry.add("hDeltaRSignalPart", "Particle #DeltaR;#DeltaR;#frac{1}{N_{jets}}#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}, doSumw); registry.add("hDeltaRpTSignalPart", "Particle jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{400, 0, 400}, dRAxis}}, doSumw); registry.add("hDeltaRpTDPhiSignalPart", "Particle jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{400, 0, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis}}, doSumw); @@ -312,14 +308,9 @@ struct JetHadronRecoil { registry.fill(HIST("hJetPhi"), jet.phi(), weight); registry.fill(HIST("hJet3D"), jet.pt() - (rho * jet.area()), jet.eta(), jet.phi(), weight); - double dR = getWTAaxisDifference(jet, tracks); - - registry.fill(HIST("hDeltaR"), dR, weight); - registry.fill(HIST("hDeltaRpT"), jet.pt() - (rho * jet.area()), dR, weight); - // try with fjcontrib - if (nTT > 0) { float dphi = RecoDecay::constrainAngle(jet.phi() - phiTT); + double dR = getWTAaxisDifference(jet, tracks); if (isSigCol) { if (std::abs(dphi - o2::constants::math::PI) < 0.6) { registry.fill(HIST("hDeltaRpTSignal"), jet.pt() - (rho * jet.area()), dR, weight); @@ -443,12 +434,9 @@ struct JetHadronRecoil { registry.fill(HIST("hJetPhi"), jet.phi(), weight); registry.fill(HIST("hJet3D"), jet.pt(), jet.eta(), jet.phi(), weight); - double dR = getWTAaxisDifference(jet, particles); - - registry.fill(HIST("hDeltaRPart"), dR, weight); - registry.fill(HIST("hDeltaRpTPart"), jet.pt(), dR, weight); if (nTT > 0) { float dphi = RecoDecay::constrainAngle(jet.phi() - phiTT); + double dR = getWTAaxisDifference(jet, particles); if (isSigCol) { if (std::abs(dphi - o2::constants::math::PI) < 0.6) { registry.fill(HIST("hDeltaRpTSignalPart"), jet.pt(), dR, weight); @@ -588,16 +576,16 @@ struct JetHadronRecoil { float dphip = RecoDecay::constrainAngle(jetTag.phi() - phiTTPart); dRp = getWTAaxisDifference(jetTag, particles); - registry.fill(HIST("hPtMatched"), jetBase.pt() - (rho * jetBase.area()), jetTag.pt(), weight); registry.fill(HIST("hPhiMatched"), dphi, dphip, weight); - registry.fill(HIST("hPtResolution"), jetTag.pt(), (jetTag.pt() - (jetBase.pt() - (rho * jetBase.area()))) / jetTag.pt(), weight); registry.fill(HIST("hPhiResolution"), jetTag.pt(), dphip - dphi, weight); - registry.fill(HIST("hDeltaRMatched"), dR, dRp, weight); - registry.fill(HIST("hDeltaRResolution"), jetTag.pt(), dRp - dR, weight); registry.fill(HIST("hFullMatching"), jetBase.pt() - (rho * jetBase.area()), jetTag.pt(), dphi, dphip, dR, dRp, weight); if ((std::abs(dphi - o2::constants::math::PI) < 0.6) || (std::abs(dphip - o2::constants::math::PI) < 0.6)) { registry.fill(HIST("hPtMatched1d"), jetTag.pt(), weight); registry.fill(HIST("hDeltaRMatched1d"), dRp, weight); + registry.fill(HIST("hPtMatched"), jetBase.pt() - (rho * jetBase.area()), jetTag.pt(), weight); + registry.fill(HIST("hPtResolution"), jetTag.pt(), (jetTag.pt() - (jetBase.pt() - (rho * jetBase.area()))) / jetTag.pt(), weight); + registry.fill(HIST("hDeltaRMatched"), dR, dRp, weight); + registry.fill(HIST("hDeltaRResolution"), jetTag.pt(), dRp - dR, weight); } } } @@ -648,6 +636,9 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } + if (collision.has_mcCollision()) { + return; + } if (collision.mcCollision().ptHard() < pTHatMinEvent) { return; } @@ -670,6 +661,9 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } + if (collision.has_mcCollision()) { + return; + } if (collision.mcCollision().ptHard() < pTHatMinEvent) { return; } @@ -692,6 +686,9 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } + if (collision.has_mcCollision()) { + return; + } if (collision.mcCollision().ptHard() < pTHatMinEvent) { return; } @@ -714,6 +711,9 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } + if (collision.has_mcCollision()) { + return; + } if (collision.mcCollision().ptHard() < pTHatMinEvent) { return; } @@ -771,6 +771,9 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } + if (collision.has_mcCollision()) { + return; + } if (collision.mcCollision().ptHard() < pTHatMinEvent) { return; } @@ -792,6 +795,9 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } + if (collision.has_mcCollision()) { + return; + } if (collision.mcCollision().ptHard() < pTHatMinEvent) { return; } @@ -813,6 +819,9 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } + if (collision.has_mcCollision()) { + return; + } if (collision.mcCollision().ptHard() < pTHatMinEvent) { return; } @@ -834,6 +843,9 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } + if (collision.has_mcCollision()) { + return; + } if (collision.mcCollision().ptHard() < pTHatMinEvent) { return; } @@ -855,6 +867,9 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } + if (collision.has_mcCollision()) { + return; + } if (collision.mcCollision().ptHard() < pTHatMinEvent) { return; } @@ -876,6 +891,9 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } + if (collision.has_mcCollision()) { + return; + } if (collision.mcCollision().ptHard() < pTHatMinEvent) { return; } From 5b32849a14373ba43e6358e8040aa3ef2caee807 Mon Sep 17 00:00:00 2001 From: GijsvWeelden <55794847+GijsvWeelden@users.noreply.github.com> Date: Sun, 14 Sep 2025 09:55:31 +0200 Subject: [PATCH 391/986] [PWGJE] Jet Fragmentation & V0 QA (#12964) --- PWGJE/Tasks/jetFragmentation.cxx | 582 +++++++++++++++---------------- PWGJE/Tasks/v0QA.cxx | 248 ++++++++++++- 2 files changed, 527 insertions(+), 303 deletions(-) diff --git a/PWGJE/Tasks/jetFragmentation.cxx b/PWGJE/Tasks/jetFragmentation.cxx index 5a6104ad872..997a475400f 100644 --- a/PWGJE/Tasks/jetFragmentation.cxx +++ b/PWGJE/Tasks/jetFragmentation.cxx @@ -48,34 +48,14 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -// Charged jets -using MyTracks = soa::Join; -using ChargedJetsWithConstituents = soa::Join; - -using MCDJets = aod::ChargedMCDetectorLevelJets; -using MCDJetsWithConstituents = soa::Join; -using MatchedMCDJets = soa::Join; -using MatchedMCDJetsWithConstituents = soa::Join; - -using MCPJets = aod::ChargedMCParticleLevelJets; -using MatchedMCPJets = soa::Join; -using MCPJetsWithConstituents = soa::Join; -using MatchedMCPJetsWithConstituents = soa::Join; - -// V0 jets using DataV0JetsWithConstituents = soa::Join; -using CandidatesV0DataWithFlags = aod::CandidatesV0Data; -using CandidatesV0MCDWithLabelsAndFlags = soa::Join; -using MCDV0Jets = aod::V0ChargedMCDetectorLevelJets; -using MCDV0JetsWithConstituents = soa::Join; -using MatchedMCDV0Jets = soa::Join; -using MatchedMCDV0JetsWithConstituents = soa::Join; +using CandidatesV0MCDWithLabels = soa::Join; +using MatchedMCDV0Jets = soa::Join; +using MatchedMCDV0JetsWithConstituents = soa::Join; -using MCPV0Jets = aod::V0ChargedMCParticleLevelJets; -using MCPV0JetsWithConstituents = soa::Join; -using MatchedMCPV0Jets = soa::Join; -using MatchedMCPV0JetsWithConstituents = soa::Join; +using MatchedMCPV0Jets = soa::Join; +using MatchedMCPV0JetsWithConstituents = soa::Join; struct JetFragmentation { HistogramRegistry registry{"registry"}; // CallSumw2 = false? @@ -240,6 +220,7 @@ struct JetFragmentation { AxisSpec antiLambdaMassCutAxis = {binAntiLambdaMassCut, "Inv. mass (GeV/#it{c}^{2})"}; if (doprocessDataV0) { + registry.add("data/hEvents", "hEvents", {HistType::kTH1D, {{2, 0.0f, 2.0f}}}); registry.add("data/V0/nV0sEvent", "nV0sEvent", HistType::kTH1D, {v0Count}); registry.add("data/V0/nV0sEventAcc", "nV0s per event (accepted)", HistType::kTH1D, {v0Count}); registry.add("data/V0/nV0sEventAccWeighted", "nV0s per event (accepted, weighted)", HistType::kTH1D, {v0Weight}, true); @@ -342,11 +323,10 @@ struct JetFragmentation { // Cut variation registry.add("data/V0/V0CutVariation", "V0CutVariation", HistType::kTHnSparseD, {ptCutAxis, k0SMassCutAxis, lambdaMassCutAxis, antiLambdaMassCutAxis, rCutAxis, ctauCutAxis, cosPACutAxis, dcapCutAxis, dcanCutAxis, dcadCutAxis}); - } // doprocessDataV0 - if (doprocessDataV0JetsFrag) { + // Jets registry.add("data/jets/jetPtEtaPhi", "Jet #it{p}_{T}, #eta, #phi", HistType::kTH3D, {jetPtAxis, etaAxis, phiAxis}); - + registry.add("data/jets/inclJetPtEtaPhi", "incljetPtEtaPhi", HistType::kTH3D, {jetPtAxis, etaAxis, phiAxis}); registry.add("data/jets/V0/jetPtV0TrackProj", "jetPtV0TrackProj", HistType::kTH2D, {jetPtAxis, zAxis}); registry.add("data/jets/V0/jetPtnV0nK0SnLambdanAntiLambda", "jetPtnV0nK0SnLambdanAntiLambda", HistType::kTHnSparseD, {jetPtAxis, v0Count, v0Count, v0Count, v0Count}); @@ -547,9 +527,51 @@ struct JetFragmentation { registry.add("data/jets/weighted/V0/jetPtBkgTrackProjDCAposAntiLambdaMass", "jetPtBkgTrackProjDCAposAntiLambdaMass", HistType::kTHnSparseD, {jetPtAxis, zAxis, v0DCApAxis, lambdaMassAxis}, true); registry.add("data/jets/weighted/V0/jetPtBkgTrackProjDCAnegAntiLambdaMass", "jetPtBkgTrackProjDCAnegAntiLambdaMass", HistType::kTHnSparseD, {jetPtAxis, zAxis, v0DCAnAxis, lambdaMassAxis}, true); registry.add("data/jets/weighted/V0/jetPtBkgTrackProjDCAdAntiLambdaMass", "jetPtBkgTrackProjDCAdAntiLambdaMass", HistType::kTHnSparseD, {jetPtAxis, zAxis, v0DCAdAxis, lambdaMassAxis}, true); - } - if (doprocessMcMatchedV0) { + // Perp Cone + registry.add("data/PC/JetPtEtaV0Pt", "JetPtEtaV0Pt", HistType::kTH3D, {jetPtAxis, etaAxis, v0PtAxis}); + registry.add("data/PC/V0PtEtaPhi", "V0 #it{p}_{T}, #eta, #phi", HistType::kTH3D, {v0PtAxis, v0EtaAxis, v0PhiAxis}); + registry.add("data/PC/V0PtCtau", "V0PtCtau", HistType::kTHnSparseD, {v0PtAxis, v0CtauAxis, v0CtauAxis, v0CtauAxis}); + registry.add("data/PC/V0PtMass", "V0PtMass", HistType::kTHnSparseD, {v0PtAxis, k0SMassAxis, lambdaMassAxis, lambdaMassAxis}); + registry.add("data/PC/V0PtMassWide", "V0PtMassWide", HistType::kTHnSparseD, {v0PtAxis, k0SWideAxis, lambdaMassAxis, lambdaMassAxis}); + registry.add("data/PC/V0PtRadiusCosPA", "V0PtRadiusCosPA", HistType::kTH3D, {v0PtAxis, v0RadiusAxis, v0CosPAAxis}); + registry.add("data/PC/V0PtDCAposneg", "V0PtDCAposneg", HistType::kTH3D, {v0PtAxis, v0DCApAxis, v0DCAnAxis}); + registry.add("data/PC/V0PtDCAd", "V0PtDCAd", HistType::kTH2D, {v0PtAxis, v0DCAdAxis}); + + // K0S + registry.add("data/PC/JetPtK0SPtMass", "JetPtK0SPtMass", HistType::kTH3D, {jetPtAxis, v0PtAxis, k0SMassAxis}); + registry.add("data/PC/JetPtEtaK0SPt", "JetPtEtaK0SPt", HistType::kTH3D, {jetPtAxis, etaAxis, v0PtAxis}); + registry.add("data/PC/K0SPtEtaPhi", "K0SPtEtaPhi", HistType::kTH3D, {v0PtAxis, v0EtaAxis, v0PhiAxis}); + registry.add("data/PC/K0SPtCtauMass", "K0SPtCtauMass", HistType::kTH3D, {v0PtAxis, v0CtauAxis, k0SMassAxis}); + registry.add("data/PC/K0SPtRadiusCosPA", "K0SPtRadiusCosPA", HistType::kTH3D, {v0PtAxis, v0RadiusAxis, v0CosPAAxis}); + registry.add("data/PC/K0SPtDCAposneg", "K0SPtDCAposneg", HistType::kTH3D, {v0PtAxis, v0DCApAxis, v0DCAnAxis}); + registry.add("data/PC/K0SPtDCAd", "K0SPtDCAd", HistType::kTH2D, {v0PtAxis, v0DCAdAxis}); + + // Lambda + registry.add("data/PC/JetPtLambdaPtMass", "JetPtLambdaPtMass", HistType::kTH3D, {jetPtAxis, v0PtAxis, lambdaMassAxis}); + registry.add("data/PC/JetPtEtaLambdaPt", "JetPtEtaLambdaPt", HistType::kTH3D, {jetPtAxis, etaAxis, v0PtAxis}); + registry.add("data/PC/LambdaPtEtaPhi", "LambdaPtEtaPhi", HistType::kTH3D, {v0PtAxis, v0EtaAxis, v0PhiAxis}); + registry.add("data/PC/LambdaPtCtauMass", "LambdaPtCtauMass", HistType::kTH3D, {v0PtAxis, v0CtauAxis, lambdaMassAxis}); + registry.add("data/PC/LambdaPtRadiusCosPA", "LambdaPtRadiusCosPA", HistType::kTH3D, {v0PtAxis, v0RadiusAxis, v0CosPAAxis}); + registry.add("data/PC/LambdaPtDCAposneg", "LambdaPtDCAposneg", HistType::kTH3D, {v0PtAxis, v0DCApAxis, v0DCAnAxis}); + registry.add("data/PC/LambdaPtDCAd", "LambdaPtDCAd", HistType::kTH2D, {v0PtAxis, v0DCAdAxis}); + + // AntiLambda + registry.add("data/PC/JetPtAntiLambdaPtMass", "JetPtAntiLambdaPtMass", HistType::kTH3D, {jetPtAxis, v0PtAxis, lambdaMassAxis}); + registry.add("data/PC/JetPtEtaAntiLambdaPt", "JetPtEtaAntiLambdaPt", HistType::kTH3D, {jetPtAxis, etaAxis, v0PtAxis}); + registry.add("data/PC/AntiLambdaPtEtaPhi", "AntiLambdaPtEtaPhi", HistType::kTH3D, {v0PtAxis, v0EtaAxis, v0PhiAxis}); + registry.add("data/PC/AntiLambdaPtCtauMass", "AntiLambdaPtCtauMass", HistType::kTH3D, {v0PtAxis, v0CtauAxis, lambdaMassAxis}); + registry.add("data/PC/AntiLambdaPtRadiusCosPA", "AntiLambdaPtRadiusCosPA", HistType::kTH3D, {v0PtAxis, v0RadiusAxis, v0CosPAAxis}); + registry.add("data/PC/AntiLambdaPtDCAposneg", "AntiLambdaPtDCAposneg", HistType::kTH3D, {v0PtAxis, v0DCApAxis, v0DCAnAxis}); + registry.add("data/PC/AntiLambdaPtDCAd", "AntiLambdaPtDCAd", HistType::kTH2D, {v0PtAxis, v0DCAdAxis}); + + registry.add("data/PC/nV0sConePtEta", "nV0sConePtEta", HistType::kTH3D, {v0Count, jetPtAxis, etaAxis}); + registry.add("data/PC/ConePtEtaPhi", "ConePtEtaPhi", HistType::kTH3D, {jetPtAxis, etaAxis, phiAxis}); + registry.add("data/PC/JetPtEtaConePt", "JetPtEtaConePt", HistType::kTH3D, {jetPtAxis, etaAxis, jetPtAxis}); + } // doprocessDataV0 + + if (doprocessMcV0) { + registry.add("matching/hEvents", "hEvents", {HistType::kTH1D, {{3, 0.0f, 3.0f}}}); // MCP registry.add("mcp/V0/nV0sEventAcc", "nV0s per event (accepted)", HistType::kTH1D, {v0Count}, true); registry.add("mcp/V0/nV0sEventAccWeighted", "nV0s per event (accepted, weighted)", HistType::kTH1D, {v0Weight}, true); @@ -716,13 +738,18 @@ struct JetFragmentation { registry.add("matching/V0/K0SPosNegPtMass", "K0SPosNegPtMass", HistType::kTHnSparseD, {v0partPtAxis, trackPtAxis, trackPtAxis, k0SMassAxis}, true); registry.add("matching/V0/LambdaPosNegPtMass", "LambdaPosNegPtMass", HistType::kTHnSparseD, {v0partPtAxis, trackPtAxis, trackPtAxis, lambdaMassAxis}, true); registry.add("matching/V0/AntiLambdaPosNegPtMass", "AntiLambdaPosNegPtMass", HistType::kTHnSparseD, {v0partPtAxis, trackPtAxis, trackPtAxis, lambdaMassAxis}, true); - } // doprocessMcMatchedV0 - if (doprocessMcMatchedV0JetsFrag) { // Matching - Jets + registry.add("mcp/jets/inclPartJetPtEtaPhi", "inclPartJetPtEtaPhi", HistType::kTH3D, {partJetPtAxis, partEtaAxis, partPhiAxis}, true); registry.add("mcp/jets/partJetPtEtaPhi", "Particle level jet #it{p}_{T}, #eta, #phi", HistType::kTH3D, {partJetPtAxis, partEtaAxis, partPhiAxis}, true); + registry.add("mcd/jets/inclDetJetPtEtaPhi", "inclDetJetPtEtaPhi", HistType::kTH3D, {detJetPtAxis, detEtaAxis, detPhiAxis}, true); registry.add("mcd/jets/detJetPtEtaPhi", "Detector level jet #it{p}_{T}, #eta, #phi", HistType::kTH3D, {detJetPtAxis, detEtaAxis, detPhiAxis}, true); + registry.add("matching/jets/fakeJetPtEtaPhi", "fakeJetPtEtaPhi", HistType::kTH3D, {detJetPtAxis, detEtaAxis, detPhiAxis}, true); + registry.add("matching/jets/inclFakeJetPtEtaPhi", "inclFakeJetPtEtaPhi", HistType::kTH3D, {detJetPtAxis, detEtaAxis, detPhiAxis}, true); + registry.add("matching/jets/inclMissJetPtEtaPhi", "inclMissJetPtEtaPhi", HistType::kTH3D, {partJetPtAxis, partEtaAxis, partPhiAxis}, true); + registry.add("matching/jets/missJetPtEtaPhi", "missJetPtEtaPhi", HistType::kTH3D, {partJetPtAxis, partEtaAxis, partPhiAxis}, true); + registry.add("matching/jets/matchDetJetPtEtaPhi", "Matched detector level jet #it{p}_{T}, #eta, #phi", HistType::kTH3D, {detJetPtAxis, detEtaAxis, detPhiAxis}, true); registry.add("matching/jets/matchPartJetPtEtaPhi", "Matched particle level jet #it{p}_{T}, #eta, #phi", HistType::kTH3D, {partJetPtAxis, partEtaAxis, partPhiAxis}, true); registry.add("matching/jets/matchPartJetPtEtaPhiMatchDist", "matchJetMatchDist", HistType::kTHnSparseD, {partJetPtAxis, partEtaAxis, partPhiAxis, matchDistAxis}, true); @@ -735,6 +762,18 @@ struct JetFragmentation { registry.add("matching/jets/matchPartJetPtResolutionPhi", "#phi^{jet, det} - #phi^{jet, part}", HistType::kTH3D, {partJetPtAxis, partPhiAxis, phiDiffAxis}, true); registry.add("matching/jets/matchPartJetPtRelDiffPt", "#it{p}_{T}^{jet, det} - #it{p}_{T}^{jet, part}", HistType::kTH2D, {partJetPtAxis, ptJetRelDiffAxis}, true); + registry.add("matching/jets/inclMatchDetJetPtEtaPhi", "inclMatchDetJetPtEtaPhi", HistType::kTH3D, {detJetPtAxis, detEtaAxis, detPhiAxis}, true); + registry.add("matching/jets/inclMatchPartJetPtEtaPhi", "inclMatchPartJetPtEtaPhi", HistType::kTH3D, {partJetPtAxis, partEtaAxis, partPhiAxis}, true); + registry.add("matching/jets/inclMatchPartJetPtEtaPhiMatchDist", "matchJetMatchDist", HistType::kTHnSparseD, {partJetPtAxis, partEtaAxis, partPhiAxis, matchDistAxis}, true); + registry.add("matching/jets/inclMatchPartJetPtEnergyScale", "jetEnergyScale", HistType::kTH2D, {partJetPtAxis, ptRatioAxis}, true); + registry.add("matching/jets/inclMatchDetJetPtPartJetPt", "matchDetJetPtPartJetPt", HistType::kTH2D, {detJetPtAxis, partJetPtAxis}, true); + registry.add("matching/jets/inclMatchPartJetPtDetJetEtaPartJetEta", "matchPartJetPtDetJetEtaPartJetEta", HistType::kTH3D, {partJetPtAxis, detEtaAxis, partEtaAxis}, true); + registry.add("matching/jets/inclMatchPartJetPtDetJetPhiPartJetPhi", "matchPartJetPtDetJetPhiPartJetPhi", HistType::kTH3D, {partJetPtAxis, detPhiAxis, partPhiAxis}, true); + registry.add("matching/jets/inclMatchPartJetPtResolutionPt", "inclMatchPartJetPtResolutionPt", HistType::kTH2D, {partJetPtAxis, ptDiffAxis}, true); + registry.add("matching/jets/inclMatchPartJetPtResolutionEta", "inclMatchPartJetPtResolutionEta", HistType::kTH3D, {partJetPtAxis, partEtaAxis, etaDiffAxis}, true); + registry.add("matching/jets/inclMatchPartJetPtResolutionPhi", "inclMatchPartJetPtResolutionPhi", HistType::kTH3D, {partJetPtAxis, partPhiAxis, phiDiffAxis}, true); + registry.add("matching/jets/inclMatchPartJetPtRelDiffPt", "inclMatchPartJetPtRelDiffPt", HistType::kTH2D, {partJetPtAxis, ptJetRelDiffAxis}, true); + registry.add("matching/jets/V0/jetPtnV0MatchednK0SnLambdanAntiLambda", "jet Pt, nV0 matched, nK0S nLambdan AntiLambda", HistType::kTHnSparseD, {detJetPtAxis, v0Count, v0Count, v0Count, v0Count}, true); registry.add("matching/jets/V0/partJetPtV0PtDetPt", "V0PartPtDetPt", HistType::kTH3D, {partJetPtAxis, v0partPtAxis, v0detPtAxis}, true); registry.add("matching/jets/V0/partJetPtDetJetPtPartV0PtRatioPtRelDiffPt", "V0PartPtRatioRelDiffPt", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, v0partPtAxis, v0PtRatioAxis, v0PtRelDiffAxis}, true); @@ -980,51 +1019,7 @@ struct JetFragmentation { registry.add("matching/V0/decayedOtherPtV0PtMass", "decayedOtherPtV0PtMass", HistType::kTHnSparseD, {v0partPtAxis, v0detPtAxis, k0SMassAxis, lambdaMassAxis, lambdaMassAxis}, true); registry.add("matching/jets/V0/decayedOtherPtV0PtMass", "decayedOtherPtV0PtMass", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, v0partPtAxis, v0detPtAxis, k0SMassAxis, lambdaMassAxis, lambdaMassAxis}, true); registry.add("matching/jets/V0/decayedOtherPtV0TrackProjMass", "decayedOtherPtV0TrackProjMass", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, partZAxis, detZAxis, k0SMassAxis, lambdaMassAxis, lambdaMassAxis}, true); - } // doprocessMcMatchedV0JetsFrag - - if (doprocessDataV0PerpCone) { - registry.add("data/PC/JetPtEtaV0Pt", "JetPtEtaV0Pt", HistType::kTH3D, {jetPtAxis, etaAxis, v0PtAxis}); - registry.add("data/PC/V0PtEtaPhi", "V0 #it{p}_{T}, #eta, #phi", HistType::kTH3D, {v0PtAxis, v0EtaAxis, v0PhiAxis}); - registry.add("data/PC/V0PtCtau", "V0PtCtau", HistType::kTHnSparseD, {v0PtAxis, v0CtauAxis, v0CtauAxis, v0CtauAxis}); - registry.add("data/PC/V0PtMass", "V0PtMass", HistType::kTHnSparseD, {v0PtAxis, k0SMassAxis, lambdaMassAxis, lambdaMassAxis}); - registry.add("data/PC/V0PtMassWide", "V0PtMassWide", HistType::kTHnSparseD, {v0PtAxis, k0SWideAxis, lambdaMassAxis, lambdaMassAxis}); - registry.add("data/PC/V0PtRadiusCosPA", "V0PtRadiusCosPA", HistType::kTH3D, {v0PtAxis, v0RadiusAxis, v0CosPAAxis}); - registry.add("data/PC/V0PtDCAposneg", "V0PtDCAposneg", HistType::kTH3D, {v0PtAxis, v0DCApAxis, v0DCAnAxis}); - registry.add("data/PC/V0PtDCAd", "V0PtDCAd", HistType::kTH2D, {v0PtAxis, v0DCAdAxis}); - // K0S - registry.add("data/PC/JetPtK0SPtMass", "JetPtK0SPtMass", HistType::kTH3D, {jetPtAxis, v0PtAxis, k0SMassAxis}); - registry.add("data/PC/JetPtEtaK0SPt", "JetPtEtaK0SPt", HistType::kTH3D, {jetPtAxis, etaAxis, v0PtAxis}); - registry.add("data/PC/K0SPtEtaPhi", "K0SPtEtaPhi", HistType::kTH3D, {v0PtAxis, v0EtaAxis, v0PhiAxis}); - registry.add("data/PC/K0SPtCtauMass", "K0SPtCtauMass", HistType::kTH3D, {v0PtAxis, v0CtauAxis, k0SMassAxis}); - registry.add("data/PC/K0SPtRadiusCosPA", "K0SPtRadiusCosPA", HistType::kTH3D, {v0PtAxis, v0RadiusAxis, v0CosPAAxis}); - registry.add("data/PC/K0SPtDCAposneg", "K0SPtDCAposneg", HistType::kTH3D, {v0PtAxis, v0DCApAxis, v0DCAnAxis}); - registry.add("data/PC/K0SPtDCAd", "K0SPtDCAd", HistType::kTH2D, {v0PtAxis, v0DCAdAxis}); - - // Lambda - registry.add("data/PC/JetPtLambdaPtMass", "JetPtLambdaPtMass", HistType::kTH3D, {jetPtAxis, v0PtAxis, lambdaMassAxis}); - registry.add("data/PC/JetPtEtaLambdaPt", "JetPtEtaLambdaPt", HistType::kTH3D, {jetPtAxis, etaAxis, v0PtAxis}); - registry.add("data/PC/LambdaPtEtaPhi", "LambdaPtEtaPhi", HistType::kTH3D, {v0PtAxis, v0EtaAxis, v0PhiAxis}); - registry.add("data/PC/LambdaPtCtauMass", "LambdaPtCtauMass", HistType::kTH3D, {v0PtAxis, v0CtauAxis, lambdaMassAxis}); - registry.add("data/PC/LambdaPtRadiusCosPA", "LambdaPtRadiusCosPA", HistType::kTH3D, {v0PtAxis, v0RadiusAxis, v0CosPAAxis}); - registry.add("data/PC/LambdaPtDCAposneg", "LambdaPtDCAposneg", HistType::kTH3D, {v0PtAxis, v0DCApAxis, v0DCAnAxis}); - registry.add("data/PC/LambdaPtDCAd", "LambdaPtDCAd", HistType::kTH2D, {v0PtAxis, v0DCAdAxis}); - - // AntiLambda - registry.add("data/PC/JetPtAntiLambdaPtMass", "JetPtAntiLambdaPtMass", HistType::kTH3D, {jetPtAxis, v0PtAxis, lambdaMassAxis}); - registry.add("data/PC/JetPtEtaAntiLambdaPt", "JetPtEtaAntiLambdaPt", HistType::kTH3D, {jetPtAxis, etaAxis, v0PtAxis}); - registry.add("data/PC/AntiLambdaPtEtaPhi", "AntiLambdaPtEtaPhi", HistType::kTH3D, {v0PtAxis, v0EtaAxis, v0PhiAxis}); - registry.add("data/PC/AntiLambdaPtCtauMass", "AntiLambdaPtCtauMass", HistType::kTH3D, {v0PtAxis, v0CtauAxis, lambdaMassAxis}); - registry.add("data/PC/AntiLambdaPtRadiusCosPA", "AntiLambdaPtRadiusCosPA", HistType::kTH3D, {v0PtAxis, v0RadiusAxis, v0CosPAAxis}); - registry.add("data/PC/AntiLambdaPtDCAposneg", "AntiLambdaPtDCAposneg", HistType::kTH3D, {v0PtAxis, v0DCApAxis, v0DCAnAxis}); - registry.add("data/PC/AntiLambdaPtDCAd", "AntiLambdaPtDCAd", HistType::kTH2D, {v0PtAxis, v0DCAdAxis}); - - registry.add("data/PC/nV0sConePtEta", "nV0sConePtEta", HistType::kTH3D, {v0Count, jetPtAxis, etaAxis}); - registry.add("data/PC/ConePtEtaPhi", "ConePtEtaPhi", HistType::kTH3D, {jetPtAxis, etaAxis, phiAxis}); - registry.add("data/PC/JetPtEtaConePt", "JetPtEtaConePt", HistType::kTH3D, {jetPtAxis, etaAxis, jetPtAxis}); - } // doprocessDataV0PerpCone - - if (doprocessMcV0PerpCone) { registry.add("mcd/V0/nV0sEvent", "NV0s in event", HistType::kTH1D, {v0Count}); registry.add("mcd/V0/nV0sEventWeighted", "NV0s in event weighted", HistType::kTH1D, {v0Count}, true); @@ -1095,7 +1090,7 @@ struct JetFragmentation { // PerpCone - Matched AntiLambda in Matched jets registry.add("matching/PC/matchedJetPtAntiLambdaPtMass", "matchedJetPtAntiLambdaPtMass", HistType::kTH3D, {detJetPtAxis, v0PtAxis, lambdaMassAxis}, true); registry.add("matching/PC/matchedJetsPtAntiLambdaPtMass", "matchedJetsPtAntiLambdaPtMass", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, v0PtAxis, lambdaMassAxis}, true); - } // doprocessMcV0PerpCone + } // doprocessMcV0 } // init // --------------------------------------------------- @@ -1174,7 +1169,6 @@ struct JetFragmentation { // Convert state from uint32_t to std::vector containing the particle classes for that weight std::vector convertState(uint32_t state, int nParticles, int nClasses = 4) { - // TODO: Should we cast these to uint32_t? std::vector v(nParticles, nClasses); int nStates = std::round(std::pow(static_cast(nClasses), static_cast(nParticles))); int nBitsPerParticle = std::round(std::log2(nClasses)); @@ -1307,11 +1301,11 @@ struct JetFragmentation { return (jet.candidatesIds().size() > 0); } template - bool v0sAreMatched(T const& v0, U const& particle, V const& /*tracks*/) + // bool v0sAreMatched(T const& v0, U const& particle, V const& /*tracks*/) + bool v0sAreMatched(U const& v0, V const& particle) { - // FIXME: Should this check whether V0 is selected as correct species? Probably! - auto negId = v0.template negTrack_as().mcParticleId(); - auto posId = v0.template posTrack_as().mcParticleId(); + auto negId = v0.template negTrack_as().mcParticleId(); + auto posId = v0.template posTrack_as().mcParticleId(); auto daughters = particle.daughtersIds(); return ((negId == daughters[0] && posId == daughters[1]) || (posId == daughters[0] && negId == daughters[1])); } @@ -1353,7 +1347,7 @@ struct JetFragmentation { // --------------------------------------------------- // Data - Counts template - void fillDataV0Histograms(CollisionType const& collision, V0Type const& V0s) + void fillDataV0sInclusive(CollisionType const& coll, V0Type const& V0s) { // Fill histograms unweighted. Hists will be filled with V0 counts float nV0s = 0; @@ -1362,9 +1356,9 @@ struct JetFragmentation { continue; nV0s += 1; - double ctauLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * constants::physics::MassLambda0; - double ctauAntiLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * constants::physics::MassLambda0Bar; - double ctauK0s = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * constants::physics::MassK0Short; + double ctauLambda = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * constants::physics::MassLambda0; + double ctauAntiLambda = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * constants::physics::MassLambda0Bar; + double ctauK0s = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * constants::physics::MassK0Short; double massDiff = v0.mLambda() - v0.mAntiLambda(); double massRatio = v0.mAntiLambda() / v0.mLambda(); @@ -1426,17 +1420,23 @@ struct JetFragmentation { registry.fill(HIST("data/V0/nV0sEventAcc"), nV0s); } template - void fillDataJetHistograms(T const& jet) + void fillDataJet(T const& jet) + { + registry.fill(HIST("data/jets/inclJetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi()); + if (jetContainsV0s(jet)) + registry.fill(HIST("data/jets/jetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi()); + } + void fillDataJetWeighted(double jetpt, double jeteta, double jetphi, double weight = 1.) { - registry.fill(HIST("data/jets/jetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi()); + registry.fill(HIST("data/jets/weighted/jetPtEtaPhi"), jetpt, jeteta, jetphi, weight); } template - void fillDataV0FragHistograms(CollisionType const& collision, JetType const& jet, V0Type const& v0) + void fillDataV0sInJet(CollisionType const& coll, JetType const& jet, V0Type const& v0) { double trackProj = getMomFrac(jet, v0); - double ctauLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * constants::physics::MassLambda0; - double ctauAntiLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * constants::physics::MassLambda0Bar; - double ctauK0s = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * constants::physics::MassK0Short; + double ctauLambda = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * constants::physics::MassLambda0; + double ctauAntiLambda = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * constants::physics::MassLambda0Bar; + double ctauK0s = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * constants::physics::MassK0Short; double massDiff = v0.mLambda() - v0.mAntiLambda(); double massRatio = v0.mAntiLambda() / v0.mLambda(); @@ -1553,7 +1553,7 @@ struct JetFragmentation { } } template - void fillDataPerpConeHists(T const& coll, U const& jet, V const& v0s) + void fillDataV0sInPerpCone(T const& coll, U const& jet, V const& v0s) { const int nCones = 2; double perpConeR = jet.r() * 1e-2; @@ -1633,7 +1633,7 @@ struct JetFragmentation { } // Data - Weighted template - void fillDataV0HistogramsWeighted(CollisionType const& collision, V0Type const& V0s) + void fillDataV0sInclusiveWeighted(CollisionType const& coll, V0Type const& V0s) { // Fill histograms with V0 signal weights float nV0s = 0; @@ -1644,9 +1644,9 @@ struct JetFragmentation { float weight = getV0SignalProb(v0); nV0s += weight; // Sum weights (purity) of V0s - double ctauLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * constants::physics::MassLambda0; - double ctauAntiLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * constants::physics::MassLambda0Bar; - double ctauK0s = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * constants::physics::MassK0Short; + double ctauLambda = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * constants::physics::MassLambda0; + double ctauAntiLambda = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * constants::physics::MassLambda0Bar; + double ctauK0s = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * constants::physics::MassK0Short; double massDiff = v0.mLambda() - v0.mAntiLambda(); double massRatio = v0.mAntiLambda() / v0.mLambda(); @@ -1705,25 +1705,21 @@ struct JetFragmentation { } // for v0 registry.fill(HIST("data/V0/nV0sEventAccWeighted"), nV0s); } - void fillDataJetHistogramsWeighted(double jetpt, double jeteta, double jetphi, double weight = 1.) - { - registry.fill(HIST("data/jets/weighted/jetPtEtaPhi"), jetpt, jeteta, jetphi, weight); - } template - void fillDataV0FragHistogramsWeighted(C const& collision, J const& jet, std::vector state, std::vector values, double weight) + void fillDataV0sInJetWeighted(C const& coll, J const& jet, std::vector state, std::vector values, double weight) { double jetpt = values[values.size() - 1]; int ip = 0; - for (const auto& v0 : jet.template candidates_as()) { + for (const auto& v0 : jet.template candidates_as()) { if (v0.isRejectedCandidate()) continue; double z = values[ip]; ip++; - double ctauK0s = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * constants::physics::MassK0Short; - double ctauLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * constants::physics::MassLambda0; - double ctauAntiLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * constants::physics::MassLambda0Bar; + double ctauK0s = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * constants::physics::MassK0Short; + double ctauLambda = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * constants::physics::MassLambda0; + double ctauAntiLambda = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * constants::physics::MassLambda0Bar; double massDiff = v0.mLambda() - v0.mAntiLambda(); double massRatio = v0.mAntiLambda() / v0.mLambda(); @@ -1818,7 +1814,7 @@ struct JetFragmentation { // MC - Counts (or event weights) template - void fillMCPV0Histograms(T const& pV0s, double weight = 1.) + void fillMcpV0sInclusive(T const& pV0s, double weight = 1.) { float nV0s = 0; for (const auto& pv0 : pV0s) { @@ -1838,12 +1834,15 @@ struct JetFragmentation { registry.fill(HIST("mcp/V0/nV0sEventAccWeighted"), nV0s, weight); } template - void fillMCPJetHistograms(T const& jet, double weight = 1.) + void fillMcpJet(T const& jet, double weight = 1.) { - registry.fill(HIST("mcp/jets/partJetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi(), weight); + registry.fill(HIST("mcp/jets/inclPartJetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi(), weight); + if (jetContainsV0s(jet)) { + registry.fill(HIST("mcp/jets/partJetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi(), weight); + } } template - void fillMCDV0Histograms(T const& coll, U const& V0s, double weight = 1.) + void fillMcdV0sInclusive(T const& coll, U const& V0s, double weight = 1.) { float nV0s = 0; for (const auto& v0 : V0s) { @@ -1912,14 +1911,50 @@ struct JetFragmentation { registry.fill(HIST("mcd/V0/nV0sEventAcc"), nV0s); registry.fill(HIST("mcd/V0/nV0sEventAccWeighted"), nV0s, weight); } + template + void fillMatchingV0sInclusive(V const& coll, W const& V0s, X const& pV0s, double weight = 1.) + { + float nV0s = 0; + for (const auto& v0 : V0s) { + if (v0.isRejectedCandidate()) + continue; + + if (!v0.has_mcParticle()) { + fillFakeV0Inclusive(coll, v0, weight); + fillFakeV0DaughtersInclusive(v0, weight); + fillFakeV0DecayedInclusive(v0, weight); + continue; + } + for (const auto& pv0 : pV0s) { + if (v0sAreMatched(v0, pv0)) { + nV0s += 1; + fillMatchedV0Inclusive(coll, v0, pv0, weight); + fillMatchedV0DaughtersInclusive(v0, pv0, weight); + } + } + } // Reconstructed V0s + for (const auto& pv0 : pV0s) { + for (const auto& v0 : V0s) { + if (v0sAreMatched(v0, pv0)) + continue; + + fillMissV0Inclusive(pv0); + } + } + registry.fill(HIST("matching/V0/nV0sEventAcc"), nV0s); + registry.fill(HIST("matching/V0/nV0sEventAccWeighted"), nV0s, weight); + } template - void fillMCDJetHistograms(T const& jet, double weight = 1.) + void fillMcdJet(T const& jet, double weight = 1.) { - registry.fill(HIST("mcd/jets/detJetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi(), weight); + registry.fill(HIST("mcd/jets/inclDetJetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi(), weight); + if (jetContainsV0s(jet)) { + registry.fill(HIST("mcd/jets/detJetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi(), weight); + } } // Reconstructed V0s in the cone of MCD jets template - void fillMcPerpConeHists(T const& coll, U const& mcdjet, V const& v0s, W const& /* V0 particles */, double weight = 1.) + void fillMcV0sInPerpCone(T const& coll, U const& mcdjet, V const& v0s, W const& /* V0 particles */, double weight = 1.) { const int nCones = 2; double perpConeR = mcdjet.r() * 1e-2; @@ -1989,7 +2024,7 @@ struct JetFragmentation { } // Reconstructed V0s in the cone of matched jets template - void fillMcPerpConeHists(T const& coll, U const& mcdjet, V const& mcpjet, W const& v0s, X const& /* V0 particles */, double weight = 1.) + void fillMcV0sInMatchedPerpCone(T const& coll, U const& mcdjet, V const& mcpjet, W const& v0s, X const& /* V0 particles */, double weight = 1.) { const int nCones = 2; double perpConeR = mcdjet.r() * 1e-2; @@ -2066,11 +2101,11 @@ struct JetFragmentation { } // Matched - Counts (or event weights) template // Reconstructed signal for inclusive V0s - void fillMatchingV0Histograms(CollisionType const& collision, V0Type const& v0, particleType const& particle, double weight = 1.) + void fillMatchedV0Inclusive(CollisionType const& coll, V0Type const& v0, particleType const& particle, double weight = 1.) { - double ctauLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * constants::physics::MassLambda0; - double ctauAntiLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * constants::physics::MassLambda0Bar; - double ctauK0s = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * constants::physics::MassK0Short; + double ctauLambda = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * constants::physics::MassLambda0; + double ctauAntiLambda = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * constants::physics::MassLambda0Bar; + double ctauK0s = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * constants::physics::MassK0Short; registry.fill(HIST("matching/V0/V0PartPtDetPt"), particle.pt(), v0.pt(), weight); registry.fill(HIST("matching/V0/V0PartPtRatioPtRelDiffPt"), particle.pt(), v0.pt() / particle.pt(), (v0.pt() - particle.pt()) / particle.pt(), weight); @@ -2107,7 +2142,7 @@ struct JetFragmentation { } } template // Reconstructed signal for inclusive V0s: daughters - void fillMatchingV0DauHistograms(V0Type const& v0, ParticleType const& pv0, double weight = 1.) + void fillMatchedV0DaughtersInclusive(V0Type const& v0, ParticleType const& pv0, double weight = 1.) { auto negTrack = v0.template negTrack_as(); auto posTrack = v0.template posTrack_as(); @@ -2125,12 +2160,27 @@ struct JetFragmentation { } } template // Reconstructed jets - void fillMatchingHistogramsJet(DetJet const& detJet, PartJet const& partJet, double weight = 1.) + void fillMatchedJet(DetJet const& detJet, PartJet const& partJet, double weight = 1.) { double deltaEta = detJet.eta() - partJet.eta(); double deltaPhi = RecoDecay::constrainAngle(detJet.phi() - partJet.phi(), -constants::math::PI); double dR = jetutilities::deltaR(detJet, partJet); + registry.fill(HIST("matching/jets/inclMatchDetJetPtEtaPhi"), detJet.pt(), detJet.eta(), detJet.phi(), weight); + registry.fill(HIST("matching/jets/inclMatchPartJetPtEtaPhi"), partJet.pt(), partJet.eta(), partJet.phi(), weight); + registry.fill(HIST("matching/jets/inclMatchPartJetPtEtaPhiMatchDist"), partJet.pt(), partJet.eta(), partJet.phi(), dR, weight); + registry.fill(HIST("matching/jets/inclMatchPartJetPtEnergyScale"), partJet.pt(), detJet.pt() / partJet.pt(), weight); + registry.fill(HIST("matching/jets/inclMatchDetJetPtPartJetPt"), detJet.pt(), partJet.pt(), weight); + registry.fill(HIST("matching/jets/inclMatchPartJetPtDetJetEtaPartJetEta"), partJet.pt(), detJet.eta(), partJet.eta(), weight); + registry.fill(HIST("matching/jets/inclMatchPartJetPtDetJetPhiPartJetPhi"), partJet.pt(), detJet.phi(), partJet.phi(), weight); + registry.fill(HIST("matching/jets/inclMatchPartJetPtResolutionPt"), partJet.pt(), (detJet.pt() - partJet.pt()), weight); + registry.fill(HIST("matching/jets/inclMatchPartJetPtResolutionEta"), partJet.pt(), partJet.eta(), deltaEta, weight); + registry.fill(HIST("matching/jets/inclMatchPartJetPtResolutionPhi"), partJet.pt(), partJet.phi(), deltaPhi, weight); + registry.fill(HIST("matching/jets/inclMatchPartJetPtRelDiffPt"), partJet.pt(), (detJet.pt() - partJet.pt()) / partJet.pt(), weight); + + if (!jetContainsV0s(detJet)) + return; + registry.fill(HIST("matching/jets/matchDetJetPtEtaPhi"), detJet.pt(), detJet.eta(), detJet.phi(), weight); registry.fill(HIST("matching/jets/matchPartJetPtEtaPhi"), partJet.pt(), partJet.eta(), partJet.phi(), weight); registry.fill(HIST("matching/jets/matchPartJetPtEtaPhiMatchDist"), partJet.pt(), partJet.eta(), partJet.phi(), dR, weight); @@ -2144,15 +2194,15 @@ struct JetFragmentation { registry.fill(HIST("matching/jets/matchPartJetPtRelDiffPt"), partJet.pt(), (detJet.pt() - partJet.pt()) / partJet.pt(), weight); } template // Reconstructed signal for in-jet V0s - void fillMatchingV0FragHistograms(CollisionType const& collision, DetJetType const& detJet, PartJetType const& partJet, V0Type const& v0, ParticleType const& particle, double weight = 1.) + void fillMatchedV0InJet(CollisionType const& coll, DetJetType const& detJet, PartJetType const& partJet, V0Type const& v0, ParticleType const& particle, double weight = 1.) { - bool correctCollision = (collision.mcCollisionId() == particle.mcCollisionId()); + bool correctCollision = (coll.mcCollisionId() == particle.mcCollisionId()); double detTrackProj = getMomFrac(detJet, v0); double partTrackProj = getMomFrac(partJet, particle); - double ctauLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * constants::physics::MassLambda0; - double ctauAntiLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * constants::physics::MassLambda0Bar; - double ctauK0s = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * constants::physics::MassK0Short; + double ctauLambda = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * constants::physics::MassLambda0; + double ctauAntiLambda = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * constants::physics::MassLambda0Bar; + double ctauK0s = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * constants::physics::MassK0Short; registry.fill(HIST("matching/jets/V0/matchDetJetPtV0TrackProjPartJetPtV0TrackProj"), detJet.pt(), detTrackProj, partJet.pt(), partTrackProj, weight); registry.fill(HIST("matching/jets/V0/partJetPtV0PtDetJetPtV0Pt"), partJet.pt(), particle.pt(), detJet.pt(), v0.pt(), weight); @@ -2296,7 +2346,7 @@ struct JetFragmentation { } // AntiLambda } template // Reconstructed signal for in-jet V0s: daughters - void fillMatchingV0DauJetHistograms(DetJetType const& detJet, PartJetType const& partJet, V0Type const& v0, ParticleType const& particle, double weight = 1.) + void fillMatchedV0DaughtersInJet(DetJetType const& detJet, PartJetType const& partJet, V0Type const& v0, ParticleType const& particle, double weight = 1.) { auto negTrack = v0.template negTrack_as(); auto posTrack = v0.template posTrack_as(); @@ -2306,8 +2356,8 @@ struct JetFragmentation { registry.fill(HIST("matching/jets/V0/partJetPtDetJetPtPartV0PtNegPtRatioPtRelDiffPt"), partJet.pt(), detJet.pt(), particle.pt(), negPart.pt(), negTrack.pt() / negPart.pt(), (negTrack.pt() - negPart.pt()) / negPart.pt(), weight); } // Misses - Counts (or event weights) - template // Missed inclusive V0s - void fillMatchingMissV0Histograms(T const& pv0, double weight = 1.) + template + void fillMissV0Inclusive(T const& pv0, double weight = 1.) { int pdg = pv0.pdgCode(); registry.fill(HIST("matching/V0/missV0PtEtaPhi"), pv0.pt(), pv0.eta(), pv0.phi(), weight); @@ -2319,8 +2369,17 @@ struct JetFragmentation { registry.fill(HIST("matching/V0/missAntiLambdaPtEtaPhi"), pv0.pt(), pv0.eta(), pv0.phi(), weight); } } - template // Missed V0s in jets - void fillMatchingV0Miss(JetType const& jet, V0Type const& v0, double weight = 1.) + template + void fillMissJet(T const& jet, double weight = 1.) + { + registry.fill(HIST("matching/jets/inclMissJetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi(), weight); + if (!jetContainsV0s(jet)) + return; + + registry.fill(HIST("matching/jets/missJetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi(), weight); + } + template + void fillMissV0InJet(JetType const& jet, V0Type const& v0, double weight = 1.) { double trackProj = getMomFrac(jet, v0); @@ -2338,8 +2397,8 @@ struct JetFragmentation { } } // Fakes - Counts (or event weights) - template // Fake inclusive V0s - void fillMatchingV0FakeHistograms(T const& coll, U const& v0, double weight = 1.) + template + void fillFakeV0Inclusive(T const& coll, U const& v0, double weight = 1.) { double ctauLambda = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * constants::physics::MassLambda0; double ctauAntiLambda = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * constants::physics::MassLambda0Bar; @@ -2399,8 +2458,8 @@ struct JetFragmentation { registry.fill(HIST("matching/V0/fakeAntiLambdaPtDCAdMass"), v0.pt(), v0.dcaV0daughters(), v0.mAntiLambda(), weight); } } - template // Fake inclusive V0s daughters - void fillMatchingFakeV0DauHistograms(U const& v0, double weight = 1.) + template + void fillFakeV0DaughtersInclusive(U const& v0, double weight = 1.) { auto negTrack = v0.template negTrack_as(); auto posTrack = v0.template posTrack_as(); @@ -2427,7 +2486,7 @@ struct JetFragmentation { } } template // Check if inclusive V0 was missed because daughter decayed - void fillMatchingV0DecayedHistograms(V const& v0, double weight = 1.) + void fillFakeV0DecayedInclusive(V const& v0, double weight = 1.) { // Check if decayed daughter auto posTrack = v0.template posTrack_as(); @@ -2481,13 +2540,22 @@ struct JetFragmentation { } } } - template // Fake V0s in jets - void fillMatchingV0JetFakeHistograms(CollisionType const& collision, JetType const& jet, V0Type const& v0, double weight = 1.) + template + void fillFakeJet(T const& jet, double weight = 1.) + { + registry.fill(HIST("matching/jets/fakeJetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi(), weight); + if (!jetContainsV0s(jet)) + return; + + registry.fill(HIST("matching/jets/inclFakeJetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi(), weight); + } + template + void fillFakeV0InJet(CollisionType const& coll, JetType const& jet, V0Type const& v0, double weight = 1.) { double trackProj = getMomFrac(jet, v0); - double ctauLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * constants::physics::MassLambda0; - double ctauAntiLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * constants::physics::MassLambda0Bar; - double ctauK0s = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * constants::physics::MassK0Short; + double ctauLambda = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * constants::physics::MassLambda0; + double ctauAntiLambda = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * constants::physics::MassLambda0Bar; + double ctauK0s = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * constants::physics::MassK0Short; double massDiff = v0.mLambda() - v0.mAntiLambda(); double massRatio = v0.mAntiLambda() / v0.mLambda(); double massRelDiff = (v0.mLambda() - v0.mAntiLambda()) / v0.mLambda(); @@ -2566,7 +2634,7 @@ struct JetFragmentation { } } template // Check if V0 in jet was missed because daughter decayed - void fillMatchingV0JetDecayedHistograms(V const& partJet, W const& detJet, X const& v0, double weight = 1.) + void fillFakeV0DecayedInJet(V const& partJet, W const& detJet, X const& v0, double weight = 1.) { // Check if decayed daughter auto posTrack = v0.template posTrack_as(); @@ -2658,40 +2726,30 @@ struct JetFragmentation { void processDummy(aod::JetTracks const&) {} PROCESS_SWITCH(JetFragmentation, processDummy, "Dummy process function turned on by default", true); - // Data - void processDataV0(soa::Filtered::iterator const& jcoll, CandidatesV0DataWithFlags const& V0s) + void processDataV0(soa::Filtered::iterator const& coll, DataV0JetsWithConstituents const& jets, aod::CandidatesV0Data const& V0s, aod::JetTracks const&) { - if (!jetderiveddatautilities::selectCollision(jcoll, eventSelectionBits)) { + registry.fill(HIST("data/hEvents"), 0.5); + if (!jetderiveddatautilities::selectCollision(coll, eventSelectionBits)) return; - } - registry.fill(HIST("data/V0/nV0sEvent"), V0s.size()); - fillDataV0Histograms(jcoll, V0s); - fillDataV0HistogramsWeighted(jcoll, V0s); - } - PROCESS_SWITCH(JetFragmentation, processDataV0, "Data V0", false); - void processDataV0JetsFrag(soa::Filtered::iterator const& jcoll, DataV0JetsWithConstituents const& v0jets, CandidatesV0DataWithFlags const&, aod::JetTracks const&) - { - if (!jetderiveddatautilities::selectCollision(jcoll, eventSelectionBits)) { - return; - } - - for (const auto& jet : v0jets) { - if (!jetfindingutilities::isInEtaAcceptance(jet, -99., -99., v0EtaMin, v0EtaMax)) { - continue; - } + registry.fill(HIST("data/hEvents"), 1.5); + registry.fill(HIST("data/V0/nV0sEvent"), V0s.size()); + fillDataV0sInclusive(coll, V0s); + fillDataV0sInclusiveWeighted(coll, V0s); - if (!jetContainsV0s(jet)) // Double check if the jet contains V0s + for (const auto& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, -99., -99., v0EtaMin, v0EtaMax)) continue; - fillDataJetHistograms(jet); + fillDataJet(jet); + fillDataV0sInPerpCone(coll, jet, V0s); int nV0inJet = 0, nLambdainJet = 0, nAntiLambdainJet = 0, nK0SinJet = 0; // Counts float wV0inJet = 0, wLambdainJet = 0, wAntiLambdainJet = 0, wK0SinJet = 0; // Weights std::vector values; std::vector> weights; - for (const auto& v0 : jet.candidates_as()) { + for (const auto& v0 : jet.candidates_as()) { if (v0.isRejectedCandidate()) continue; @@ -2711,7 +2769,7 @@ struct JetFragmentation { wAntiLambdainJet += signalProb; } - fillDataV0FragHistograms(jcoll, jet, v0); + fillDataV0sInJet(coll, jet, v0); double z = getMomFrac(jet, v0); std::vector w; @@ -2729,144 +2787,94 @@ struct JetFragmentation { registry.fill(HIST("data/jets/V0/jetPtnV0nK0SnLambdanAntiLambda"), jet.pt(), nV0inJet, nK0SinJet, nLambdainJet, nAntiLambdainJet); registry.fill(HIST("data/jets/weighted/V0/jetPtnV0nK0SnLambdanAntiLambda"), jet.pt(), wV0inJet, wK0SinJet, wLambdainJet, wAntiLambdainJet); + if (nV0inJet == 0) + continue; + int nStates = std::round(std::pow(static_cast(nV0Classes), static_cast(nV0inJet))); for (int M = 0; M < nStates; M++) { std::vector state = convertState(M, nV0inJet, nV0Classes); std::vector corrected; if (doCorrectionWithTracks) - corrected = correctedValuesPlusTracks(state, jet); + corrected = correctedValuesPlusTracks(state, jet); else corrected = correctedValues(state, values); double ws = stateWeight(state, weights); double jetpt = corrected[nV0inJet]; - fillDataJetHistogramsWeighted(jetpt, jet.eta(), jet.phi(), ws); - fillDataV0FragHistogramsWeighted(jcoll, jet, state, corrected, ws); + fillDataJetWeighted(jetpt, jet.eta(), jet.phi(), ws); + fillDataV0sInJetWeighted(coll, jet, state, corrected, ws); } } } - PROCESS_SWITCH(JetFragmentation, processDataV0JetsFrag, "Data V0 jets fragmentation with weights", false); - - void processDataV0PerpCone(soa::Filtered::iterator const& jcoll, aod::V0ChargedJets const& v0jets, CandidatesV0DataWithFlags const& v0s) - { - if (!jetderiveddatautilities::selectCollision(jcoll, eventSelectionBits)) { - return; - } - - for (const auto& jet : v0jets) { - if (!jetfindingutilities::isInEtaAcceptance(jet, -99., -99., v0EtaMin, v0EtaMax)) { - continue; - } - fillDataPerpConeHists(jcoll, jet, v0s); - } - } - PROCESS_SWITCH(JetFragmentation, processDataV0PerpCone, "Perpendicular cone V0s in data", false); + PROCESS_SWITCH(JetFragmentation, processDataV0, "Data V0", false); - // Matching - void processMcMatchedV0(soa::Filtered::iterator const& jcoll, aod::JetMcCollisions const&, CandidatesV0MCDWithLabelsAndFlags const& v0s, aod::CandidatesV0MCP const& pv0s, aod::JetTracksMCD const& jTracks, aod::JetParticles const&) + void processMcV0(soa::Filtered::iterator const& coll, aod::JetMcCollisions const&, MatchedMCDV0JetsWithConstituents const& v0jetsMCD, MatchedMCPV0JetsWithConstituents const& v0jetsMCP, CandidatesV0MCDWithLabels const& V0s, aod::CandidatesV0MCP const& pV0s, aod::JetTracksMCD const&, aod::JetParticles const&, aod::McParticles const& particles) { - if (!jcoll.has_mcCollision()) { + registry.fill(HIST("matching/hEvents"), 0.5); + if (!coll.has_mcCollision()) return; - } - if (!jetderiveddatautilities::selectCollision(jcoll, eventSelectionBits)) { + if (!jetderiveddatautilities::selectCollision(coll, eventSelectionBits)) return; - } - double weight = jcoll.mcCollision().weight(); - registry.fill(HIST("matching/V0/nV0sEvent"), v0s.size()); - registry.fill(HIST("matching/V0/nV0sEventWeighted"), v0s.size(), weight); - // TODO: Fill mcd and mcp hists - fillMCDV0Histograms(jcoll, v0s, weight); - fillMCPV0Histograms(pv0s, weight); + registry.fill(HIST("matching/hEvents"), 1.5); + double weight = coll.mcCollision().weight(); + registry.fill(HIST("matching/hEvents"), 2.5, weight); + registry.fill(HIST("matching/V0/nV0sEvent"), V0s.size()); + registry.fill(HIST("matching/V0/nV0sEventWeighted"), V0s.size(), weight); - float nV0s = 0; - for (const auto& v0 : v0s) { - if (v0.isRejectedCandidate()) - continue; - - if (!v0.has_mcParticle()) { - fillMatchingV0FakeHistograms(jcoll, v0, weight); - fillMatchingFakeV0DauHistograms(v0, weight); - fillMatchingV0DecayedHistograms(v0, weight); - continue; - } - for (const auto& pv0 : pv0s) { - if (v0sAreMatched(v0, pv0, jTracks)) { - nV0s += 1; - fillMatchingV0Histograms(jcoll, v0, pv0, weight); - fillMatchingV0DauHistograms(v0, pv0, weight); - } - } - } // Reconstructed V0s - for (const auto& pv0 : pv0s) { - for (const auto& v0 : v0s) { - if (v0sAreMatched(v0, pv0, jTracks)) { - continue; - } - // Fill histograms for missed V0s - } - } - registry.fill(HIST("matching/V0/nV0sEventAcc"), nV0s); - registry.fill(HIST("matching/V0/nV0sEventAccWeighted"), nV0s, weight); - } - PROCESS_SWITCH(JetFragmentation, processMcMatchedV0, "Monte Carlo V0", false); - - void processMcMatchedV0JetsFrag(soa::Filtered::iterator const& jcoll, aod::JetMcCollisions const&, MatchedMCDV0JetsWithConstituents const& v0jetsMCD, MatchedMCPV0JetsWithConstituents const& v0jetsMCP, CandidatesV0MCDWithLabelsAndFlags const&, aod::CandidatesV0MCP const&, aod::JetTracksMCD const& jTracks, aod::JetParticles const&) - { - if (!jcoll.has_mcCollision()) - return; - if (!jetderiveddatautilities::selectCollision(jcoll, eventSelectionBits)) - return; - - double weight = jcoll.mcCollision().weight(); + fillMcdV0sInclusive(coll, V0s, weight); + fillMcpV0sInclusive(pV0s, weight); + fillMatchingV0sInclusive(coll, V0s, pV0s, weight); for (const auto& detJet : v0jetsMCD) { if (!jetfindingutilities::isInEtaAcceptance(detJet, -99., -99., v0EtaMin, v0EtaMax)) continue; - // Double check if the jet contains V0s - if (!jetContainsV0s(detJet)) - continue; - - fillMCDJetHistograms(detJet, weight); + fillMcdJet(detJet, weight); + fillMcV0sInPerpCone(coll, detJet, V0s, particles, weight); int nV0inJet = 0, nLambdainJet = 0, nAntiLambdainJet = 0, nK0SinJet = 0; if (!detJet.has_matchedJetGeo()) { - for (const auto& detV0 : detJet.candidates_as()) { - fillMatchingV0JetFakeHistograms(jcoll, detJet, detV0, weight); + fillFakeJet(detJet, weight); + for (const auto& v0 : detJet.candidates_as()) { + fillFakeV0InJet(coll, detJet, v0, weight); } continue; } // if jet not matched for (const auto& partJet : detJet.template matchedJetGeo_as()) { - fillMatchingHistogramsJet(detJet, partJet, weight); - for (const auto& detV0 : detJet.candidates_as()) { + fillMatchedJet(detJet, partJet, weight); + fillMcV0sInMatchedPerpCone(coll, detJet, partJet, V0s, particles, weight); + + for (const auto& detV0 : detJet.candidates_as()) { if (!detV0.has_mcParticle()) { - fillMatchingV0JetFakeHistograms(jcoll, detJet, detV0, weight); - fillMatchingV0JetDecayedHistograms(partJet, detJet, detV0, weight); + fillFakeV0InJet(coll, detJet, detV0, weight); + fillFakeV0DecayedInJet(partJet, detJet, detV0, weight); continue; } + bool isV0Matched = false; for (const auto& partV0 : partJet.template candidates_as()) { - if (v0sAreMatched(detV0, partV0, jTracks)) { - isV0Matched = true; - nV0inJet++; - fillMatchingV0FragHistograms(jcoll, detJet, partJet, detV0, partV0, weight); - fillMatchingV0DauJetHistograms(detJet, partJet, detV0, partV0, weight); - - if (std::abs(partV0.pdgCode()) == PDG_t::kK0Short) { - nK0SinJet++; - } else if (partV0.pdgCode() == PDG_t::kLambda0) { - nLambdainJet++; - } else if (partV0.pdgCode() == PDG_t::kLambda0Bar) { - nAntiLambdainJet++; - } - break; - } // if matched + if (!v0sAreMatched(detV0, partV0)) + continue; + + isV0Matched = true; + nV0inJet++; + fillMatchedV0InJet(coll, detJet, partJet, detV0, partV0, weight); + fillMatchedV0DaughtersInJet(detJet, partJet, detV0, partV0, weight); + + if (std::abs(partV0.pdgCode()) == PDG_t::kK0Short) { + nK0SinJet++; + } else if (partV0.pdgCode() == PDG_t::kLambda0) { + nLambdainJet++; + } else if (partV0.pdgCode() == PDG_t::kLambda0Bar) { + nAntiLambdainJet++; + } + break; } // partV0 loop if (!isV0Matched) { - fillMatchingV0JetFakeHistograms(jcoll, detJet, detV0, weight); + fillFakeV0InJet(coll, detJet, detV0, weight); } } // detV0 loop registry.fill(HIST("matching/jets/V0/jetPtnV0MatchednK0SnLambdanAntiLambda"), partJet.pt(), nV0inJet, nK0SinJet, nLambdainJet, nAntiLambdainJet, weight); @@ -2874,70 +2882,46 @@ struct JetFragmentation { } // detJet loop for (const auto& partJet : v0jetsMCP) { - if (!jetContainsV0s(partJet)) { - continue; - } - fillMCPJetHistograms(partJet, weight); + fillMcpJet(partJet, weight); if (!partJet.has_matchedJetGeo()) { + fillMissJet(partJet, weight); for (const auto& partV0 : partJet.candidates_as()) { - fillMatchingV0Miss(partJet, partV0, weight); + fillMissV0InJet(partJet, partV0, weight); } continue; } // if jet not matched bool isJetMatched = false; for (const auto& detJet : partJet.template matchedJetGeo_as()) { - if (!jetfindingutilities::isInEtaAcceptance(detJet, -99., -99., v0EtaMin, v0EtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(detJet, -99., -99., v0EtaMin, v0EtaMax)) continue; - } + isJetMatched = true; for (const auto& partV0 : partJet.candidates_as()) { bool isV0Matched = false; - for (const auto& detV0 : detJet.candidates_as()) { - if (v0sAreMatched(detV0, partV0, jTracks)) { + for (const auto& detV0 : detJet.candidates_as()) { + if (v0sAreMatched(detV0, partV0)) { isV0Matched = true; break; } } // detV0 loop - if (!isV0Matched) { - fillMatchingV0Miss(partJet, partV0, weight); - } + + // If V0 is matched, it has already been filled in the mcdjet loop + if (!isV0Matched) + fillMissV0InJet(partJet, partV0, weight); } // partV0 loop } // detJet loop // To account for matched jets where the detector level jet is outside of the eta range (cut applied within this task) if (!isJetMatched) { for (const auto& partV0 : partJet.candidates_as()) { - fillMatchingV0Miss(partJet, partV0, weight); + fillMissV0InJet(partJet, partV0, weight); } } } // partJet loop } - PROCESS_SWITCH(JetFragmentation, processMcMatchedV0JetsFrag, "Matched V0 jets fragmentation", false); - - void processMcV0PerpCone(soa::Filtered::iterator const& jcoll, aod::JetMcCollisions const&, MatchedMCDV0Jets const& v0jets, CandidatesV0MCDWithLabelsAndFlags const& v0s, aod::McParticles const& particles, MatchedMCPV0Jets const&) - { - if (!jetderiveddatautilities::selectCollision(jcoll, eventSelectionBits)) { - return; - } - double weight = jcoll.mcCollision().weight(); - registry.fill(HIST("mcd/V0/nV0sEvent"), v0s.size()); - registry.fill(HIST("mcd/V0/nV0sEventWeighted"), v0s.size(), weight); - - for (const auto& mcdjet : v0jets) { - if (!jetfindingutilities::isInEtaAcceptance(mcdjet, -99., -99., v0EtaMin, v0EtaMax)) - continue; - - fillMcPerpConeHists(jcoll, mcdjet, v0s, particles, weight); - - for (const auto& mcpjet : mcdjet.template matchedJetGeo_as()) { - fillMcPerpConeHists(jcoll, mcdjet, mcpjet, v0s, particles, weight); - break; // Make sure we only do this once - } - } - } - PROCESS_SWITCH(JetFragmentation, processMcV0PerpCone, "Perpendicular cone V0s in MC", false); + PROCESS_SWITCH(JetFragmentation, processMcV0, "MC V0", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGJE/Tasks/v0QA.cxx b/PWGJE/Tasks/v0QA.cxx index c66bf164def..31b47a88a6e 100644 --- a/PWGJE/Tasks/v0QA.cxx +++ b/PWGJE/Tasks/v0QA.cxx @@ -45,6 +45,7 @@ using namespace o2::framework; using namespace o2::framework::expressions; // V0 jets +using V0ChargedJetsWithConstituents = soa::Join; using MCDV0Jets = aod::V0ChargedMCDetectorLevelJets; using MCDV0JetsWithConstituents = soa::Join; using MatchedMCDV0Jets = soa::Join; @@ -59,6 +60,10 @@ using MatchedMCPV0JetsWithConstituents = soa::Join; +// Tracks +using DaughterJTracks = soa::Join; +using DaughterTracks = soa::Join; + struct V0QA { HistogramRegistry registry{"registry"}; @@ -300,6 +305,44 @@ struct V0QA { registry.add("tests/sub/JetPtEtaAntiLambdaPt", "Jet Pt, Eta, AntiLambda Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); registry.add("tests/sub/JetPtEtaAntiLambdaZ", "Jet Pt, Eta, AntiLambda Z", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); } + if (doprocessTestV0DaughterSharing) { + registry.add("sharing/hEvents", "Events", {HistType::kTH1D, {{2, 0.0f, 2.0f}}}); + registry.add("sharing/V0PtEtaPhi", "V0 Pt, Eta, Phi", HistType::kTH3D, {axisV0Pt, axisEta, axisPhi}); + registry.add("sharing/K0SPtEtaPhi", "K0S Pt, Eta, Phi", HistType::kTH3D, {axisV0Pt, axisEta, axisPhi}); + registry.add("sharing/LambdaPtEtaPhi", "Lambda Pt, Eta, Phi", HistType::kTH3D, {axisV0Pt, axisEta, axisPhi}); + registry.add("sharing/AntiLambdaPtEtaPhi", "AntiLambda Pt, Eta, Phi", HistType::kTH3D, {axisV0Pt, axisEta, axisPhi}); + + registry.add("sharing/V0PtEtaPt", "V0s w shared daughter", HistType::kTHnSparseD, {axisV0Pt, axisEta, axisV0Pt}); + registry.add("sharing/V0PtEtaPtDaughterPt", "V0s w shared daughter and daughter pt", HistType::kTHnSparseD, {axisV0Pt, axisEta, axisV0Pt, axisV0Pt}); + registry.add("sharing/K0SK0S", "K0S-K0S w shared daughter", HistType::kTHnSparseD, {axisV0Pt, axisEta, axisV0Pt}); + registry.add("sharing/K0SLambda", "K0S-Lambda w shared daughter", HistType::kTHnSparseD, {axisV0Pt, axisEta, axisV0Pt}); + registry.add("sharing/K0SAntiLambda", "K0S-AntiLambda w shared daughter", HistType::kTHnSparseD, {axisV0Pt, axisEta, axisV0Pt}); + registry.add("sharing/LambdaK0S", "Lambda-K0S w shared daughter", HistType::kTHnSparseD, {axisV0Pt, axisEta, axisV0Pt}); + registry.add("sharing/LambdaLambda", "Lambda-Lambda w shared daughter", HistType::kTHnSparseD, {axisV0Pt, axisEta, axisV0Pt}); + registry.add("sharing/LambdaAntiLambda", "Lambda-AntiLambda w shared daughter", HistType::kTHnSparseD, {axisV0Pt, axisEta, axisV0Pt}); + registry.add("sharing/AntiLambdaK0S", "AntiLambda-K0S w shared daughter", HistType::kTHnSparseD, {axisV0Pt, axisEta, axisV0Pt}); + registry.add("sharing/AntiLambdaLambda", "AntiLambda-Lambda w shared daughter", HistType::kTHnSparseD, {axisV0Pt, axisEta, axisV0Pt}); + registry.add("sharing/AntiLambdaAntiLambda", "AntiLambda-AntiLambda w shared daughter", HistType::kTHnSparseD, {axisV0Pt, axisEta, axisV0Pt}); + + registry.add("sharing/JetPtEtaPhi", "JetPtEtaPhi", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); + registry.add("sharing/JetPtEtaPhiSingle", "JetPtEtaPhiSingle", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); + registry.add("sharing/JetPtEtaPhiMultiple", "JetPtEtaPhiMultiple", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); + registry.add("sharing/JetPtEtaV0Pt", "JetPtEtaV0Pt", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); + registry.add("sharing/JetPtEtaK0SPt", "JetPtEtaK0SPt", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); + registry.add("sharing/JetPtEtaLambdaPt", "JetPtEtaLambdaPt", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); + registry.add("sharing/JetPtEtaAntiLambdaPt", "JetPtEtaAntiLambdaPt", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); + registry.add("sharing/JetPtEtaV0PtPt", "JetPtEtaV0PtPt", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisV0Pt}); + registry.add("sharing/JetPtEtaV0PtPtDaughterPt", "JetPtEtaV0PtPtDaughterPt", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisV0Pt, axisV0Pt}); + registry.add("sharing/JetK0SK0S", "JetK0SK0S", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisV0Pt}); + registry.add("sharing/JetK0SLambda", "JetK0SLambda", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisV0Pt}); + registry.add("sharing/JetK0SAntiLambda", "JetK0SAntiLambda", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisV0Pt}); + registry.add("sharing/JetLambdaK0S", "JetLambdaK0S", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisV0Pt}); + registry.add("sharing/JetLambdaLambda", "JetLambdaLambda", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisV0Pt}); + registry.add("sharing/JetLambdaAntiLambda", "JetLambdaAntiLambda", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisV0Pt}); + registry.add("sharing/JetAntiLambdaK0S", "JetAntiLambdaK0S", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisV0Pt}); + registry.add("sharing/JetAntiLambdaLambda", "JetAntiLambdaLambda", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisV0Pt}); + registry.add("sharing/JetAntiLambdaAntiLambda", "JetAntiLambdaAntiLambda", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisV0Pt}); + } if (doprocessV0TrackQA) { registry.add("tracks/hEvents", "evts", {HistType::kTH1D, {{2, 0.0f, 2.0f}}}); registry.add("tracks/Pos", "pos", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisEta, axisPhi}); @@ -496,6 +539,16 @@ struct V0QA { auto daughters = particle.daughtersIds(); return ((negId == daughters[0] && posId == daughters[1]) || (posId == daughters[0] && negId == daughters[1])); } + template + bool v0sShareDaughter(U const& trigger, U const& associate) + { + // LOGF(info, "Checking if V0s share daughter"); + auto trigNeg = trigger.template negTrack_as(); + auto trigPos = trigger.template posTrack_as(); + auto assocNeg = associate.template negTrack_as(); + auto assocPos = associate.template posTrack_as(); + return (trigNeg == assocNeg || trigNeg == assocPos || trigPos == assocNeg || trigPos == assocPos); + } template bool genV0PassesEfficiencyCuts(T const& pv0) { @@ -784,6 +837,138 @@ struct V0QA { } } + template + void fillV0DaughterSharingInclusive(T const& v0) + { + registry.fill(HIST("sharing/V0PtEtaPhi"), v0.pt(), v0.eta(), v0.phi()); + if (v0.isK0SCandidate()) + registry.fill(HIST("sharing/K0SPtEtaPhi"), v0.pt(), v0.eta(), v0.phi()); + if (v0.isLambdaCandidate()) + registry.fill(HIST("sharing/LambdaPtEtaPhi"), v0.pt(), v0.eta(), v0.phi()); + if (v0.isAntiLambdaCandidate()) + registry.fill(HIST("sharing/AntiLambdaPtEtaPhi"), v0.pt(), v0.eta(), v0.phi()); + } + + template + void fillV0DaughterSharingInclusive(V const& trigger, V const& associate) + { + double weight = 0.5; // To correct for double-counting + double pthard, etahard, ptsoft; + if (trigger.pt() > associate.pt()) { + pthard = trigger.pt(); + etahard = trigger.eta(); + ptsoft = associate.pt(); + } else { + pthard = associate.pt(); + etahard = associate.eta(); + ptsoft = trigger.pt(); + } + + registry.fill(HIST("sharing/V0PtEtaPt"), pthard, etahard, ptsoft, weight); + // Tried to get this in a function, but couldn't make it work + auto trigNeg = trigger.template negTrack_as().template track_as(); + auto trigPos = trigger.template posTrack_as().template track_as(); + auto assocNeg = associate.template negTrack_as().template track_as(); + auto assocPos = associate.template posTrack_as().template track_as(); + double sharedDaughterPt; + if (trigNeg == assocNeg || trigNeg == assocPos) + sharedDaughterPt = trigNeg.pt(); + else + sharedDaughterPt = trigPos.pt(); + registry.fill(HIST("sharing/V0PtEtaPtDaughterPt"), pthard, etahard, ptsoft, sharedDaughterPt, weight); + + if (trigger.isK0SCandidate() && associate.isK0SCandidate()) + registry.fill(HIST("sharing/K0SK0S"), pthard, etahard, ptsoft, weight); + if (trigger.isK0SCandidate() && associate.isLambdaCandidate()) + registry.fill(HIST("sharing/K0SLambda"), pthard, etahard, ptsoft, weight); + if (trigger.isK0SCandidate() && associate.isAntiLambdaCandidate()) + registry.fill(HIST("sharing/K0SAntiLambda"), pthard, etahard, ptsoft, weight); + + if (trigger.isLambdaCandidate() && associate.isK0SCandidate()) + registry.fill(HIST("sharing/LambdaK0S"), pthard, etahard, ptsoft, weight); + if (trigger.isLambdaCandidate() && associate.isLambdaCandidate()) + registry.fill(HIST("sharing/LambdaLambda"), pthard, etahard, ptsoft, weight); + if (trigger.isLambdaCandidate() && associate.isAntiLambdaCandidate()) + registry.fill(HIST("sharing/LambdaAntiLambda"), pthard, etahard, ptsoft, weight); + + if (trigger.isAntiLambdaCandidate() && associate.isK0SCandidate()) + registry.fill(HIST("sharing/AntiLambdaK0S"), pthard, etahard, ptsoft, weight); + if (trigger.isAntiLambdaCandidate() && associate.isLambdaCandidate()) + registry.fill(HIST("sharing/AntiLambdaLambda"), pthard, etahard, ptsoft, weight); + if (trigger.isAntiLambdaCandidate() && associate.isAntiLambdaCandidate()) + registry.fill(HIST("sharing/AntiLambdaAntiLambda"), pthard, etahard, ptsoft, weight); + } + + template + void fillV0DaughterSharingJet(T const& jet, bool jetHasSingleV0) + { + registry.fill(HIST("sharing/JetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi()); + + if (jetHasSingleV0) + registry.fill(HIST("sharing/JetPtEtaPhiSingle"), jet.pt(), jet.eta(), jet.phi()); + else + registry.fill(HIST("sharing/JetPtEtaPhiMultiple"), jet.pt(), jet.eta(), jet.phi()); + } + + template + void fillV0DaughterSharingJet(T const& jet, U const& v0) + { + registry.fill(HIST("sharing/JetPtEtaV0Pt"), jet.pt(), jet.eta(), v0.pt()); + if (v0.isK0SCandidate()) + registry.fill(HIST("sharing/JetPtEtaK0SPt"), jet.pt(), jet.eta(), v0.pt()); + if (v0.isLambdaCandidate()) + registry.fill(HIST("sharing/JetPtEtaLambdaPt"), jet.pt(), jet.eta(), v0.pt()); + if (v0.isAntiLambdaCandidate()) + registry.fill(HIST("sharing/JetPtEtaAntiLambdaPt"), jet.pt(), jet.eta(), v0.pt()); + } + + template + void fillV0DaughterSharingJet(V const& jet, W const& trigger, W const& associate) + { + double weight = 0.5; // To correct for double-counting + double pthard, ptsoft; + if (trigger.pt() > associate.pt()) { + pthard = trigger.pt(); + ptsoft = associate.pt(); + } else { + pthard = associate.pt(); + ptsoft = trigger.pt(); + } + + registry.fill(HIST("sharing/JetPtEtaV0PtPt"), jet.pt(), jet.eta(), pthard, ptsoft, weight); + auto trigNeg = trigger.template negTrack_as().template track_as(); + auto trigPos = trigger.template posTrack_as().template track_as(); + auto assocNeg = associate.template negTrack_as().template track_as(); + auto assocPos = associate.template posTrack_as().template track_as(); + double sharedDaughterPt; + if (trigNeg == assocNeg || trigNeg == assocPos) + sharedDaughterPt = trigNeg.pt(); + else + sharedDaughterPt = trigPos.pt(); + registry.fill(HIST("sharing/JetPtEtaV0PtPtDaughterPt"), jet.pt(), jet.eta(), pthard, ptsoft, sharedDaughterPt, weight); + + if (trigger.isK0SCandidate() && associate.isK0SCandidate()) + registry.fill(HIST("sharing/JetK0SK0S"), jet.pt(), jet.eta(), pthard, ptsoft, weight); + if (trigger.isK0SCandidate() && associate.isLambdaCandidate()) + registry.fill(HIST("sharing/JetK0SLambda"), jet.pt(), jet.eta(), pthard, ptsoft, weight); + if (trigger.isK0SCandidate() && associate.isAntiLambdaCandidate()) + registry.fill(HIST("sharing/JetK0SAntiLambda"), jet.pt(), jet.eta(), pthard, ptsoft, weight); + + if (trigger.isLambdaCandidate() && associate.isK0SCandidate()) + registry.fill(HIST("sharing/JetLambdaK0S"), jet.pt(), jet.eta(), pthard, ptsoft, weight); + if (trigger.isLambdaCandidate() && associate.isLambdaCandidate()) + registry.fill(HIST("sharing/JetLambdaLambda"), jet.pt(), jet.eta(), pthard, ptsoft, weight); + if (trigger.isLambdaCandidate() && associate.isAntiLambdaCandidate()) + registry.fill(HIST("sharing/JetLambdaAntiLambda"), jet.pt(), jet.eta(), pthard, ptsoft, weight); + + if (trigger.isAntiLambdaCandidate() && associate.isK0SCandidate()) + registry.fill(HIST("sharing/JetAntiLambdaK0S"), jet.pt(), jet.eta(), pthard, ptsoft, weight); + if (trigger.isAntiLambdaCandidate() && associate.isLambdaCandidate()) + registry.fill(HIST("sharing/JetAntiLambdaLambda"), jet.pt(), jet.eta(), pthard, ptsoft, weight); + if (trigger.isAntiLambdaCandidate() && associate.isAntiLambdaCandidate()) + registry.fill(HIST("sharing/JetAntiLambdaAntiLambda"), jet.pt(), jet.eta(), pthard, ptsoft, weight); + } + template void fillTrackQa(V const& v0) { @@ -1477,7 +1662,7 @@ struct V0QA { PROCESS_SWITCH(V0QA, processFeeddownMatchedJets, "Jets feeddown", false); // Test the difference between excluding V0s from jet finding and subtracting V0s from jets afterwards - void processTestWeightedJetFinder(soa::Filtered::iterator const& jcoll, soa::Join const& jets, aod::CandidatesV0Data const& v0s) + void processTestWeightedJetFinder(soa::Filtered::iterator const& jcoll, V0ChargedJetsWithConstituents const& jets, aod::CandidatesV0Data const& v0s) { registry.fill(HIST("tests/weighted/hEvents"), 0.5); if (!jetderiveddatautilities::selectCollision(jcoll, eventSelectionBits)) @@ -1505,7 +1690,7 @@ struct V0QA { } PROCESS_SWITCH(V0QA, processTestWeightedJetFinder, "Test weighted jet finder", false); - void processTestSubtractedJetFinder(soa::Filtered::iterator const& jcoll, soa::Join const& jets, aod::CandidatesV0Data const& v0s) + void processTestSubtractedJetFinder(soa::Filtered::iterator const& jcoll, V0ChargedJetsWithConstituents const& jets, aod::CandidatesV0Data const& v0s) { registry.fill(HIST("tests/hEvents"), 0.5); if (!jetderiveddatautilities::selectCollision(jcoll, eventSelectionBits)) @@ -1552,8 +1737,63 @@ struct V0QA { } PROCESS_SWITCH(V0QA, processTestSubtractedJetFinder, "Test subtracted jet finder", false); - using DaughterJTracks = soa::Join; - using DaughterTracks = soa::Join; + void processTestV0DaughterSharing(soa::Filtered::iterator const& jcoll, V0ChargedJetsWithConstituents const& jets, aod::CandidatesV0Data const& v0s, DaughterJTracks const&, DaughterTracks const&) + { + registry.fill(HIST("sharing/hEvents"), 0.5); + if (!jetderiveddatautilities::selectCollision(jcoll, eventSelectionBits)) + return; + registry.fill(HIST("sharing/hEvents"), 1.5); + + // Check if V0s within the same event share daughters + for (const auto& trigger : v0s) { + if (trigger.isRejectedCandidate()) + continue; + + fillV0DaughterSharingInclusive(trigger); + + for (const auto& associate : v0s) { + if (associate.isRejectedCandidate()) + continue; + + if (trigger == associate) + continue; + + // Double-counting accounted for by filling histograms with weight 0.5 + if (v0sShareDaughter(trigger, associate)) { + fillV0DaughterSharingInclusive(trigger, associate); + } + } + } + + // Check if V0s within the same jet share daughters + for (const auto& jet : jets) { + bool jetHasSingleV0 = true; + + for (const auto& trigger : jet.template candidates_as()) { + if (trigger.isRejectedCandidate()) + continue; + + fillV0DaughterSharingJet(jet, trigger); + + for (const auto& associate : jet.template candidates_as()) { + if (associate.isRejectedCandidate()) + continue; + + if (trigger == associate) + continue; + + jetHasSingleV0 = false; + + // Double-counting accounted for by filling histograms with weight 0.5 + if (v0sShareDaughter(trigger, associate)) + fillV0DaughterSharingJet(jet, trigger, associate); + } + } + fillV0DaughterSharingJet(jet, jetHasSingleV0); + } + } + PROCESS_SWITCH(V0QA, processTestV0DaughterSharing, "Test V0s with shared daughters", false); + void processV0TrackQA(aod::JetCollision const& jcoll, aod::CandidatesV0Data const& v0s, DaughterJTracks const&, DaughterTracks const&) { registry.fill(HIST("tracks/hEvents"), 0.5); From fc3c02a1d199854a496219c83df29c99a5345bc8 Mon Sep 17 00:00:00 2001 From: blacwovie Date: Sun, 14 Sep 2025 21:45:58 +0800 Subject: [PATCH 392/986] [PWGLF] add DCA fitter switch (#12977) Co-authored-by: blacw Co-authored-by: ALICE Action Bot --- PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx b/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx index f50262bd998..975572e927e 100644 --- a/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx +++ b/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx @@ -64,6 +64,7 @@ #include #include // std::prev #include +#include #include using namespace o2; @@ -609,21 +610,23 @@ struct he3HadronFemto { he3Hadcand.signHe3 = trackHe3.sign(); he3Hadcand.signHad = trackHad.sign(); - - // he3Hadcand.dcaxyHe3 = trackHe3.dcaXY(); - // he3Hadcand.dcaxyHad = trackHad.dcaXY(); - // he3Hadcand.dcazHe3 = trackHe3.dcaZ(); - // he3Hadcand.dcazHad = trackHad.dcaZ(); - auto trackCovHe3 = getTrackParCov(trackHe3); - auto trackCovHad = getTrackParCov(trackHad); - std::array dcaInfo; - o2::base::Propagator::Instance()->propagateToDCABxByBz({collisionVertex[0], collisionVertex[1], collisionVertex[2]}, trackCovHe3, 2.f, mFitter.getMatCorrType(), &dcaInfo); - he3Hadcand.dcaxyHe3 = dcaInfo[0]; - he3Hadcand.dcazHe3 = dcaInfo[1]; - o2::base::Propagator::Instance()->propagateToDCABxByBz({collisionVertex[0], collisionVertex[1], collisionVertex[2]}, trackCovHad, 2.f, mFitter.getMatCorrType(), &dcaInfo); - he3Hadcand.dcaxyHad = dcaInfo[0]; - he3Hadcand.dcazHad = dcaInfo[1]; - he3Hadcand.dcaPair = std::sqrt(std::abs(mFitter.getChi2AtPCACandidate())); + if (!settingEnableDCAfitter) { + he3Hadcand.dcaxyHe3 = trackHe3.dcaXY(); + he3Hadcand.dcaxyHad = trackHad.dcaXY(); + he3Hadcand.dcazHe3 = trackHe3.dcaZ(); + he3Hadcand.dcazHad = trackHad.dcaZ(); + } else { + auto trackCovHe3 = getTrackParCov(trackHe3); + auto trackCovHad = getTrackParCov(trackHad); + std::array dcaInfo; + o2::base::Propagator::Instance()->propagateToDCABxByBz({collisionVertex[0], collisionVertex[1], collisionVertex[2]}, trackCovHe3, 2.f, mFitter.getMatCorrType(), &dcaInfo); + he3Hadcand.dcaxyHe3 = dcaInfo[0]; + he3Hadcand.dcazHe3 = dcaInfo[1]; + o2::base::Propagator::Instance()->propagateToDCABxByBz({collisionVertex[0], collisionVertex[1], collisionVertex[2]}, trackCovHad, 2.f, mFitter.getMatCorrType(), &dcaInfo); + he3Hadcand.dcaxyHad = dcaInfo[0]; + he3Hadcand.dcazHad = dcaInfo[1]; + he3Hadcand.dcaPair = std::sqrt(std::abs(mFitter.getChi2AtPCACandidate())); + } he3Hadcand.tpcSignalHe3 = trackHe3.tpcSignal(); bool heliumPID = trackHe3.pidForTracking() == o2::track::PID::Helium3 || trackHe3.pidForTracking() == o2::track::PID::Alpha; From 87b03fae2eb916db44e1ea8ed6e02304c8a55c0a Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sun, 14 Sep 2025 17:43:52 +0200 Subject: [PATCH 393/986] [PWGLF] Very minor cleanup of printouts (#12979) --- PWGLF/Utils/strangenessBuilderHelper.h | 2 +- PWGLF/Utils/strangenessBuilderModule.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGLF/Utils/strangenessBuilderHelper.h b/PWGLF/Utils/strangenessBuilderHelper.h index 6eda3c07848..c4adf1c2874 100644 --- a/PWGLF/Utils/strangenessBuilderHelper.h +++ b/PWGLF/Utils/strangenessBuilderHelper.h @@ -132,7 +132,7 @@ std::vector groupDuplicates(const T& V0s) } v0tableGrouped.push_back(thisV0); // publish last - LOGF(info, "Duplicate V0s grouped. aod::V0s counted: %i, unique index pairs: %i", V0s.size(), v0tableGrouped.size()); + LOGF(debug, "Duplicate V0s grouped. aod::V0s counted: %i, unique index pairs: %i", V0s.size(), v0tableGrouped.size()); return v0tableGrouped; } diff --git a/PWGLF/Utils/strangenessBuilderModule.h b/PWGLF/Utils/strangenessBuilderModule.h index fc33a44f40c..e5ed9214869 100644 --- a/PWGLF/Utils/strangenessBuilderModule.h +++ b/PWGLF/Utils/strangenessBuilderModule.h @@ -1278,7 +1278,7 @@ class BuilderModule sorted_cascade = sort_indices(cascadeList, (baseOpts.mc_findableMode.value > 0)); } - LOGF(info, "AO2D input: %i V0s, %i cascades. Building list sizes: %i V0s, %i cascades", v0s.size(), cascades.size(), v0List.size(), cascadeList.size()); + LOGF(debug, "AO2D input: %i V0s, %i cascades. Building list sizes: %i V0s, %i cascades", v0s.size(), cascades.size(), v0List.size(), cascadeList.size()); } //__________________________________________________ From 8d419f2c879fa5b0edc0e0890491ab6ed7869fd6 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sun, 14 Sep 2025 18:51:23 +0200 Subject: [PATCH 394/986] [Common] Adjustments for ev sel service in Run 2 (prior to autodetect) (#12978) Co-authored-by: ALICE Builder --- Common/TableProducer/CMakeLists.txt | 6 + Common/TableProducer/PID/CMakeLists.txt | 5 - Common/TableProducer/PID/pidTPCService.cxx | 20 +- .../TableProducer/PID/pidTPCServiceRun2.cxx | 4 - .../TableProducer/PID/pidTPCServiceRun3.cxx | 96 --------- .../TableProducer/eventSelectionService.cxx | 5 + .../eventSelectionServiceRun2.cxx | 186 ++++++++++++++++++ 7 files changed, 202 insertions(+), 120 deletions(-) delete mode 100644 Common/TableProducer/PID/pidTPCServiceRun3.cxx create mode 100644 Common/TableProducer/eventSelectionServiceRun2.cxx diff --git a/Common/TableProducer/CMakeLists.txt b/Common/TableProducer/CMakeLists.txt index b1805257bb9..17735237459 100644 --- a/Common/TableProducer/CMakeLists.txt +++ b/Common/TableProducer/CMakeLists.txt @@ -34,6 +34,12 @@ o2physics_add_dpl_workflow(event-selection-service O2::DataFormatsITSMFT COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(event-selection-service-run2 + SOURCES eventSelectionServiceRun2.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCCDB + O2::DataFormatsITSMFT + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(multiplicity-table SOURCES multiplicityTable.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore diff --git a/Common/TableProducer/PID/CMakeLists.txt b/Common/TableProducer/PID/CMakeLists.txt index ab502d138b0..975898966fe 100644 --- a/Common/TableProducer/PID/CMakeLists.txt +++ b/Common/TableProducer/PID/CMakeLists.txt @@ -53,11 +53,6 @@ o2physics_add_dpl_workflow(pid-tpc-service-run2 PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore O2Physics::AnalysisCCDB COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(pid-tpc-service-run3 - SOURCES pidTPCServiceRun3.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore O2Physics::AnalysisCCDB - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(pid-tpc-base SOURCES pidTPCBase.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::AnalysisCCDB diff --git a/Common/TableProducer/PID/pidTPCService.cxx b/Common/TableProducer/PID/pidTPCService.cxx index 02f8cfa255b..6ad86916c1f 100644 --- a/Common/TableProducer/PID/pidTPCService.cxx +++ b/Common/TableProducer/PID/pidTPCService.cxx @@ -67,33 +67,23 @@ struct pidTpcService { pidTPC.init(ccdb, ccdbApi, initContext, pidTPCopts, metadataInfo); } - void processTracks(soa::Join const& collisions, soa::Join const& tracks, aod::BCsWithTimestamps const& bcs) - { - pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast(nullptr), products); - } - void processTracksWithTracksQA(soa::Join const& collisions, soa::Join const& tracks, aod::BCsWithTimestamps const& bcs, aod::TracksQA const& tracksQA) - { - pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, tracksQA, products); - } - - void processTracksMC(soa::Join const& collisions, soa::Join const& tracks, aod::BCsWithTimestamps const& bcs, aod::McParticles const&) + void processTracksIU(soa::Join const& collisions, soa::Join const& tracks, aod::BCsWithTimestamps const& bcs) { pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast(nullptr), products); } - void processTracksIU(soa::Join const& collisions, soa::Join const& tracks, aod::BCsWithTimestamps const& bcs) + void processTracksMCIU(soa::Join const& collisions, soa::Join const& tracks, aod::BCsWithTimestamps const& bcs, aod::McParticles const&) { pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast(nullptr), products); } - void processTracksMCIU(soa::Join const& collisions, soa::Join const& tracks, aod::BCsWithTimestamps const& bcs, aod::McParticles const&) + void processTracksIUWithTracksQA(soa::Join const& collisions, soa::Join const& tracks, aod::BCsWithTimestamps const& bcs, aod::TracksQAVersion const& tracksQA) { - pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast(nullptr), products); + pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, tracksQA, products); } - PROCESS_SWITCH(pidTpcService, processTracks, "Process Tracks", false); - PROCESS_SWITCH(pidTpcService, processTracksMC, "Process Tracks in MC (enables tune-on-data)", false); PROCESS_SWITCH(pidTpcService, processTracksIU, "Process TracksIU (Run 3)", true); + PROCESS_SWITCH(pidTpcService, processTracksIUWithTracksQA, "Process TracksIU (Run 3)", false); PROCESS_SWITCH(pidTpcService, processTracksMCIU, "Process TracksIUMC (Run 3)", false); }; diff --git a/Common/TableProducer/PID/pidTPCServiceRun2.cxx b/Common/TableProducer/PID/pidTPCServiceRun2.cxx index 4ab83e917a2..184fb4eb6e0 100644 --- a/Common/TableProducer/PID/pidTPCServiceRun2.cxx +++ b/Common/TableProducer/PID/pidTPCServiceRun2.cxx @@ -71,10 +71,6 @@ struct pidTpcServiceRun2 { { pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast(nullptr), products); } - void processTracksWithTracksQA(soa::Join const& collisions, soa::Join const& tracks, aod::BCsWithTimestamps const& bcs, aod::TracksQA const& tracksQA) - { - pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, tracksQA, products); - } void processTracksMC(soa::Join const& collisions, soa::Join const& tracks, aod::BCsWithTimestamps const& bcs, aod::McParticles const&) { diff --git a/Common/TableProducer/PID/pidTPCServiceRun3.cxx b/Common/TableProducer/PID/pidTPCServiceRun3.cxx deleted file mode 100644 index 5902ed9c6c9..00000000000 --- a/Common/TableProducer/PID/pidTPCServiceRun3.cxx +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file trackPropagationTester.cxx -/// \brief testing ground for track propagation -/// \author ALICE - -//=============================================================== -// -// Modularized version of TPC PID task -// -//=============================================================== - -#include "Common/Core/MetadataHelper.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/Tools/PID/pidTPCModule.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -using namespace o2; -using namespace o2::framework; - -o2::common::core::MetadataHelper metadataInfo; // Metadata helper - -struct pidTpcServiceRun3 { - - // CCDB boilerplate declarations - o2::framework::Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Service ccdb; - o2::ccdb::CcdbApi ccdbApi; - - o2::aod::pid::pidTPCProducts products; - o2::aod::pid::pidTPCConfigurables pidTPCopts; - o2::aod::pid::pidTPCModule pidTPC; - - void init(o2::framework::InitContext& initContext) - { - // CCDB boilerplate init - ccdb->setURL(ccdburl.value); - ccdb->setFatalWhenNull(false); // manual fallback in case ccdb entry empty - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); - ccdbApi.init(ccdburl.value); - - // task-specific - pidTPC.init(ccdb, ccdbApi, initContext, pidTPCopts, metadataInfo); - } - - void processTracksIU(soa::Join const& collisions, soa::Join const& tracks, aod::BCsWithTimestamps const& bcs) - { - pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast(nullptr), products); - } - - void processTracksMCIU(soa::Join const& collisions, soa::Join const& tracks, aod::BCsWithTimestamps const& bcs, aod::McParticles const&) - { - pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast(nullptr), products); - } - - PROCESS_SWITCH(pidTpcServiceRun3, processTracksIU, "Process TracksIU (Run 3)", true); - PROCESS_SWITCH(pidTpcServiceRun3, processTracksMCIU, "Process TracksIUMC (Run 3)", false); -}; - -//**************************************************************************************** -/** - * Workflow definition. - */ -//**************************************************************************************** -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - // Parse the metadata for later too - metadataInfo.initMetadata(cfgc); - - WorkflowSpec workflow{adaptAnalysisTask(cfgc)}; - return workflow; -} diff --git a/Common/TableProducer/eventSelectionService.cxx b/Common/TableProducer/eventSelectionService.cxx index 834b1c28321..55068b32fe7 100644 --- a/Common/TableProducer/eventSelectionService.cxx +++ b/Common/TableProducer/eventSelectionService.cxx @@ -197,6 +197,11 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) if (isRun3) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } else { + LOGF(info, "******************************************************************"); + LOGF(info, " Event selection service self-configuring for Run 2."); + LOGF(info, " WARNING: THIS HAS NOT BEEN VALIDATED YET, USE WITH CAUTION"); + LOGF(info, " If this fails, please use event-selection-service-run2 instead."); + LOGF(info, "******************************************************************"); return WorkflowSpec{adaptAnalysisTask(cfgc)}; } } diff --git a/Common/TableProducer/eventSelectionServiceRun2.cxx b/Common/TableProducer/eventSelectionServiceRun2.cxx new file mode 100644 index 00000000000..554ec1ff480 --- /dev/null +++ b/Common/TableProducer/eventSelectionServiceRun2.cxx @@ -0,0 +1,186 @@ +// 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 eventSelectionTester.cxx +/// \brief unified, self-configuring event selection task +/// \author ALICE + +//=============================================================== +// +// Unified, self-configuring event selection task +// +//=============================================================== + +#include "Common/Core/MetadataHelper.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/Tools/EventSelectionModule.h" +#include "Common/Tools/timestampModule.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; + +o2::common::core::MetadataHelper metadataInfo; // Metadata helper + +using BCsWithRun2InfosAndMatches = soa::Join; +using BCsWithRun3Matchings = soa::Join; +using FullTracks = soa::Join; +using FullTracksIU = soa::Join; + +struct eventselectionRun2 { + o2::common::timestamp::timestampConfigurables timestampConfigurables; + o2::common::timestamp::TimestampModule timestampMod; + + o2::common::eventselection::bcselConfigurables bcselOpts; + o2::common::eventselection::BcSelectionModule bcselmodule; + + o2::common::eventselection::evselConfigurables evselOpts; + o2::common::eventselection::EventSelectionModule evselmodule; + + Produces timestampTable; /// Table with SOR timestamps produced by the task + Produces bcsel; + Produces evsel; + + // for slicing + SliceCache cache; + + // CCDB boilerplate declarations + o2::framework::Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Service ccdb; + + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // buffering intermediate results for passing + std::vector timestamps; + std::vector bcselsbuffer; + + // auxiliary + Partition tracklets = (aod::track::trackType == static_cast(o2::aod::track::TrackTypeEnum::Run2Tracklet)); + Preslice perCollision = aod::track::collisionId; + + void init(o2::framework::InitContext& context) + { + // CCDB boilerplate init + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setURL(ccdburl.value); + + // task-specific + timestampMod.init(timestampConfigurables, metadataInfo); + bcselmodule.init(context, bcselOpts, histos, metadataInfo); + evselmodule.init(context, evselOpts, histos, metadataInfo); + } + + void process(BCsWithRun2InfosAndMatches const& bcs, + aod::Collisions const& collisions, + aod::Zdcs const&, + aod::FV0As const&, + aod::FV0Cs const&, + aod::FT0s const&, + aod::FDDs const&, + FullTracks const&) + { + timestampMod.process(bcs, ccdb, timestamps, timestampTable); + bcselmodule.processRun2(ccdb, bcs, timestamps, bcselsbuffer, bcsel); + evselmodule.processRun2(ccdb, histos, collisions, tracklets, cache, timestamps, bcselsbuffer, evsel); + } +}; + +struct eventselectionRun3 { + o2::common::timestamp::timestampConfigurables timestampConfigurables; + o2::common::timestamp::TimestampModule timestampMod; + + o2::common::eventselection::bcselConfigurables bcselOpts; + o2::common::eventselection::BcSelectionModule bcselmodule; + + o2::common::eventselection::evselConfigurables evselOpts; + o2::common::eventselection::EventSelectionModule evselmodule; + + o2::common::eventselection::lumiConfigurables lumiOpts; + o2::common::eventselection::LumiModule lumimodule; + + Produces timestampTable; /// Table with SOR timestamps produced by the task + Produces bcsel; + Produces evsel; + + // for slicing + SliceCache cache; + + // CCDB boilerplate declarations + o2::framework::Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Service ccdb; + + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // the best: have readable cursors + // this: a stopgap solution to avoid spawning yet another device + std::vector timestamps; + std::vector bcselsbuffer; + + // auxiliary + Partition pvTracks = ((aod::track::flags & static_cast(o2::aod::track::PVContributor)) == static_cast(o2::aod::track::PVContributor)); + Preslice perCollisionIU = aod::track::collisionId; + + void init(o2::framework::InitContext& context) + { + // CCDB boilerplate init + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setURL(ccdburl.value); + + // task-specific + timestampMod.init(timestampConfigurables, metadataInfo); + bcselmodule.init(context, bcselOpts, histos, metadataInfo); + evselmodule.init(context, evselOpts, histos, metadataInfo); + lumimodule.init(context, lumiOpts, histos); + } + + void process(aod::Collisions const& collisions, + BCsWithRun3Matchings const& bcs, + aod::Zdcs const&, + aod::FV0As const&, + aod::FT0s const& ft0s, // to resolve iterator + aod::FDDs const&, + FullTracksIU const&) + { + timestampMod.process(bcs, ccdb, timestamps, timestampTable); + bcselmodule.processRun3(ccdb, histos, bcs, timestamps, bcselsbuffer, bcsel); + evselmodule.processRun3(ccdb, histos, bcs, collisions, pvTracks, ft0s, cache, timestamps, bcselsbuffer, evsel); + lumimodule.process(ccdb, histos, bcs, timestamps, bcselsbuffer); + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + // Parse the metadata for later too + metadataInfo.initMetadata(cfgc); + + LOGF(info, "Event selection with forced Run 2 mode engaging in unchecked mode."); + LOGF(info, "To be improved once metadata enabling in defineDataProcessing is worked out."); + + // force Run 2 mode + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From 6b8100a82ca6f617943b64d385c5f596817b8e4b Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sun, 14 Sep 2025 20:18:12 +0200 Subject: [PATCH 395/986] [Common] Propagation service moved to Common, tuned further (#12980) Co-authored-by: ALICE Builder --- Common/TableProducer/CMakeLists.txt | 10 ++ Common/TableProducer/propagationService.cxx | 151 ++++++++++++++++++ .../TableProducer/propagationServiceRun2.cxx | 138 ++++++++++++++++ 3 files changed, 299 insertions(+) create mode 100644 Common/TableProducer/propagationService.cxx create mode 100644 Common/TableProducer/propagationServiceRun2.cxx diff --git a/Common/TableProducer/CMakeLists.txt b/Common/TableProducer/CMakeLists.txt index 17735237459..d6980ea729f 100644 --- a/Common/TableProducer/CMakeLists.txt +++ b/Common/TableProducer/CMakeLists.txt @@ -80,6 +80,16 @@ o2physics_add_dpl_workflow(track-propagation PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(propagationservice + SOURCES propagationService.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter KFParticle::KFParticle O2Physics::TPCDriftManager + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(propagationservice-run2 + SOURCES propagationServiceRun2.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter KFParticle::KFParticle O2Physics::TPCDriftManager + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(track-dca-cov-filler-run2 SOURCES trackDcaCovFillerRun2.cxx PUBLIC_LINK_LIBRARIES O2::DetectorsBase O2Physics::AnalysisCore diff --git a/Common/TableProducer/propagationService.cxx b/Common/TableProducer/propagationService.cxx new file mode 100644 index 00000000000..9eb3dba4c10 --- /dev/null +++ b/Common/TableProducer/propagationService.cxx @@ -0,0 +1,151 @@ +// 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 propagationService.cxx +/// \brief +/// \author ALICE + +//=============================================================== +// +// Merged track propagation + strangeness building task +// +// Provides a common task to deal with track propagation and +// strangeness building in a single DPL device that is particularly +// adequate for pipelining. +// +//=============================================================== + +#include "PWGLF/Utils/strangenessBuilderModule.h" + +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/Tools/StandardCCDBLoader.h" +#include "Common/Tools/TrackPropagationModule.h" +#include "Common/Tools/TrackTuner.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CcdbApi.h" +#include "CommonConstants/GeomConstants.h" +#include "CommonUtils/NameConf.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/DCA.h" + +#include + +using namespace o2; +using namespace o2::framework; +// using namespace o2::framework::expressions; + +// use parameters + cov mat non-propagated, aux info + (extension propagated) +using FullTracksExt = soa::Join; +using FullTracksExtIU = soa::Join; +using FullTracksExtWithPID = soa::Join; +using FullTracksExtIUWithPID = soa::Join; +using FullTracksExtLabeled = soa::Join; +using FullTracksExtLabeledIU = soa::Join; +using FullTracksExtLabeledWithPID = soa::Join; +using FullTracksExtLabeledIUWithPID = soa::Join; +using TracksWithExtra = soa::Join; + +// For dE/dx association in pre-selection +using TracksExtraWithPID = soa::Join; + +struct propagationService { + // CCDB boilerplate declarations + o2::framework::Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Service ccdb; + + // propagation stuff + o2::common::StandardCCDBLoaderConfigurables standardCCDBLoaderConfigurables; + o2::common::StandardCCDBLoader ccdbLoader; + + // boilerplate: strangeness builder stuff + o2::pwglf::strangenessbuilder::products products; + o2::pwglf::strangenessbuilder::coreConfigurables baseOpts; + o2::pwglf::strangenessbuilder::v0Configurables v0BuilderOpts; + o2::pwglf::strangenessbuilder::cascadeConfigurables cascadeBuilderOpts; + o2::pwglf::strangenessbuilder::preSelectOpts preSelectOpts; + o2::pwglf::strangenessbuilder::BuilderModule strangenessBuilderModule; + + // the track tuner object -> needs to be here as it inherits from ConfigurableGroup (+ has its own copy of ccdbApi) + TrackTuner trackTunerObj; + + // track propagation + o2::common::TrackPropagationProducts trackPropagationProducts; + o2::common::TrackPropagationConfigurables trackPropagationConfigurables; + o2::common::TrackPropagationModule trackPropagation; + + // registry + HistogramRegistry histos{"histos"}; + + void init(o2::framework::InitContext& initContext) + { + // CCDB boilerplate init + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setURL(ccdburl.value); + + // task-specific + trackPropagation.init(trackPropagationConfigurables, trackTunerObj, histos, initContext); + strangenessBuilderModule.init(baseOpts, v0BuilderOpts, cascadeBuilderOpts, preSelectOpts, histos, initContext); + } + + void processRealData(soa::Join const& collisions, aod::V0s const& v0s, aod::Cascades const& cascades, aod::TrackedCascades const& trackedCascades, FullTracksExtIU const& tracks, aod::BCsWithTimestamps const& bcs) + { + ccdbLoader.initCCDBfromBCs(standardCCDBLoaderConfigurables, ccdb, bcs); + trackPropagation.fillTrackTables(trackPropagationConfigurables, trackTunerObj, ccdbLoader, collisions, tracks, trackPropagationProducts, histos); + strangenessBuilderModule.dataProcess(ccdb, histos, collisions, static_cast(nullptr), v0s, cascades, trackedCascades, tracks, bcs, static_cast(nullptr), products); + } + + void processMonteCarlo(soa::Join const& collisions, aod::McCollisions const& mccollisions, aod::V0s const& v0s, aod::Cascades const& cascades, aod::TrackedCascades const& trackedCascades, FullTracksExtLabeledIU const& tracks, aod::BCsWithTimestamps const& bcs, aod::McParticles const& mcParticles) + { + ccdbLoader.initCCDBfromBCs(standardCCDBLoaderConfigurables, ccdb, bcs); + trackPropagation.fillTrackTables(trackPropagationConfigurables, trackTunerObj, ccdbLoader, collisions, tracks, trackPropagationProducts, histos); + strangenessBuilderModule.dataProcess(ccdb, histos, collisions, mccollisions, v0s, cascades, trackedCascades, tracks, bcs, mcParticles, products); + } + + void processRealDataWithPID(soa::Join const& collisions, aod::V0s const& v0s, aod::Cascades const& cascades, aod::TrackedCascades const& trackedCascades, FullTracksExtIUWithPID const& tracks, aod::BCsWithTimestamps const& bcs) + { + ccdbLoader.initCCDBfromBCs(standardCCDBLoaderConfigurables, ccdb, bcs); + trackPropagation.fillTrackTables(trackPropagationConfigurables, trackTunerObj, ccdbLoader, collisions, tracks, trackPropagationProducts, histos); + strangenessBuilderModule.dataProcess(ccdb, histos, collisions, static_cast(nullptr), v0s, cascades, trackedCascades, tracks, bcs, static_cast(nullptr), products); + } + + void processMonteCarloWithPID(soa::Join const& collisions, aod::McCollisions const& mccollisions, aod::V0s const& v0s, aod::Cascades const& cascades, aod::TrackedCascades const& trackedCascades, FullTracksExtLabeledIUWithPID const& tracks, aod::BCsWithTimestamps const& bcs, aod::McParticles const& mcParticles) + { + ccdbLoader.initCCDBfromBCs(standardCCDBLoaderConfigurables, ccdb, bcs); + trackPropagation.fillTrackTables(trackPropagationConfigurables, trackTunerObj, ccdbLoader, collisions, tracks, trackPropagationProducts, histos); + strangenessBuilderModule.dataProcess(ccdb, histos, collisions, mccollisions, v0s, cascades, trackedCascades, tracks, bcs, mcParticles, products); + } + + PROCESS_SWITCH(propagationService, processRealData, "process real data", true); + PROCESS_SWITCH(propagationService, processMonteCarlo, "process monte carlo", false); + PROCESS_SWITCH(propagationService, processRealDataWithPID, "process real data", false); + PROCESS_SWITCH(propagationService, processMonteCarloWithPID, "process monte carlo", false); +}; + +//**************************************************************************************** +/** + * Workflow definition. + */ +//**************************************************************************************** +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{adaptAnalysisTask(cfgc)}; + return workflow; +} diff --git a/Common/TableProducer/propagationServiceRun2.cxx b/Common/TableProducer/propagationServiceRun2.cxx new file mode 100644 index 00000000000..9c7765280c0 --- /dev/null +++ b/Common/TableProducer/propagationServiceRun2.cxx @@ -0,0 +1,138 @@ +// 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 propagationService.cxx +/// \brief +/// \author ALICE + +//=============================================================== +// +// Merged track propagation + strangeness building task +// +// Provides a common task to deal with track propagation and +// strangeness building in a single DPL device that is particularly +// adequate for pipelining. +// +//=============================================================== + +#include "PWGLF/Utils/strangenessBuilderModule.h" + +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/Tools/StandardCCDBLoader.h" +#include "Common/Tools/TrackPropagationModule.h" +#include "Common/Tools/TrackTuner.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CcdbApi.h" +#include "CommonConstants/GeomConstants.h" +#include "CommonUtils/NameConf.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/DCA.h" + +#include + +using namespace o2; +using namespace o2::framework; +// using namespace o2::framework::expressions; + +// use parameters + cov mat non-propagated, aux info + (extension propagated) +using FullTracksExt = soa::Join; +using FullTracksExtIU = soa::Join; +using FullTracksExtWithPID = soa::Join; +using FullTracksExtIUWithPID = soa::Join; +using FullTracksExtLabeled = soa::Join; +using FullTracksExtLabeledIU = soa::Join; +using FullTracksExtLabeledWithPID = soa::Join; +using FullTracksExtLabeledIUWithPID = soa::Join; +using TracksWithExtra = soa::Join; + +// For dE/dx association in pre-selection +using TracksExtraWithPID = soa::Join; + +struct propagationServiceRun2 { + // CCDB boilerplate declarations + o2::framework::Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Service ccdb; + + // propagation stuff + o2::common::StandardCCDBLoaderConfigurables standardCCDBLoaderConfigurables; + o2::common::StandardCCDBLoader ccdbLoader; + + // boilerplate: strangeness builder stuff + o2::pwglf::strangenessbuilder::products products; + o2::pwglf::strangenessbuilder::coreConfigurables baseOpts; + o2::pwglf::strangenessbuilder::v0Configurables v0BuilderOpts; + o2::pwglf::strangenessbuilder::cascadeConfigurables cascadeBuilderOpts; + o2::pwglf::strangenessbuilder::preSelectOpts preSelectOpts; + o2::pwglf::strangenessbuilder::BuilderModule strangenessBuilderModule; + + // registry + HistogramRegistry histos{"histos"}; + + void init(o2::framework::InitContext& initContext) + { + // CCDB boilerplate init + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setURL(ccdburl.value); + + // task-specific + strangenessBuilderModule.init(baseOpts, v0BuilderOpts, cascadeBuilderOpts, preSelectOpts, histos, initContext); + } + + void processRealData(soa::Join const& collisions, aod::V0s const& v0s, aod::Cascades const& cascades, FullTracksExt const& tracks, aod::BCsWithTimestamps const& bcs) + { + ccdbLoader.initCCDBfromBCs(standardCCDBLoaderConfigurables, ccdb, bcs); + strangenessBuilderModule.dataProcess(ccdb, histos, collisions, static_cast(nullptr), v0s, cascades, static_cast(nullptr), tracks, bcs, static_cast(nullptr), products); + } + + void processMonteCarlo(soa::Join const& collisions, aod::McCollisions const& mccollisions, aod::V0s const& v0s, aod::Cascades const& cascades, FullTracksExtLabeled const& tracks, aod::BCsWithTimestamps const& bcs, aod::McParticles const& mcParticles) + { + ccdbLoader.initCCDBfromBCs(standardCCDBLoaderConfigurables, ccdb, bcs); + strangenessBuilderModule.dataProcess(ccdb, histos, collisions, mccollisions, v0s, cascades, static_cast(nullptr), tracks, bcs, mcParticles, products); + } + + void processRealDataWithPID(soa::Join const& collisions, aod::V0s const& v0s, aod::Cascades const& cascades, FullTracksExtWithPID const& tracks, aod::BCsWithTimestamps const& bcs) + { + ccdbLoader.initCCDBfromBCs(standardCCDBLoaderConfigurables, ccdb, bcs); + strangenessBuilderModule.dataProcess(ccdb, histos, collisions, static_cast(nullptr), v0s, cascades, static_cast(nullptr), tracks, bcs, static_cast(nullptr), products); + } + + void processMonteCarloWithPID(soa::Join const& collisions, aod::McCollisions const& mccollisions, aod::V0s const& v0s, aod::Cascades const& cascades, FullTracksExtLabeledWithPID const& tracks, aod::BCsWithTimestamps const& bcs, aod::McParticles const& mcParticles) + { + ccdbLoader.initCCDBfromBCs(standardCCDBLoaderConfigurables, ccdb, bcs); + strangenessBuilderModule.dataProcess(ccdb, histos, collisions, mccollisions, v0s, cascades, static_cast(nullptr), tracks, bcs, mcParticles, products); + } + + PROCESS_SWITCH(propagationServiceRun2, processRealData, "process real data", true); + PROCESS_SWITCH(propagationServiceRun2, processMonteCarlo, "process monte carlo", false); + PROCESS_SWITCH(propagationServiceRun2, processRealDataWithPID, "process real data", false); + PROCESS_SWITCH(propagationServiceRun2, processMonteCarloWithPID, "process monte carlo", false); +}; + +//**************************************************************************************** +/** + * Workflow definition. + */ +//**************************************************************************************** +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{adaptAnalysisTask(cfgc)}; + return workflow; +} From 32984cf1e869616923b195b9c2613563457dc023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Mart=C3=ADnez=20Garc=C3=ADa?= Date: Mon, 15 Sep 2025 00:32:09 -0600 Subject: [PATCH 396/986] [PWGUD] Applying NUA correction and adding nMax option (#12932) --- PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx | 121 +++++++++++++++------ 1 file changed, 86 insertions(+), 35 deletions(-) diff --git a/PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx b/PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx index 40592fa2362..14852ce36c6 100644 --- a/PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx +++ b/PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx @@ -139,17 +139,18 @@ struct UpcPhotonuclearAnalysisJMG { Configurable cutMyTPCChi2NclMax{"cutMyTPCChi2NclMax", 4.f, {"My Track cut"}}; Configurable myWeightMin{"myWeightMin", 0.2f, {"My Track cut"}}; Configurable myWeightMax{"myWeightMax", 5.f, {"My Track cut"}}; - Configurable myEpsilonToWeight{"myEpsilonToWeight", 1e-6f, {"My Track cut"}}; - Configurable useEpsilon{"useEpsilon", false, {"My Track cut"}}; + Configurable myEpsilonToWeight{"myEpsilonToWeight", 1e-6f, {"NUA correction"}}; + Configurable useEpsilon{"useEpsilon", false, {"NUA correction"}}; + Configurable useNMax{"useNMax", true, {"NUA correction"}}; Configurable> cfgPairCut{"cfgPairCut", {CFGPairCutDefaults[0], 5, {"Photon", "K0", "Lambda", "Phi", "Rho"}}, "Pair cuts on various particles"}; Configurable cfgTwoTrackCut{"cfgTwoTrackCut", -1, {"Two track cut"}}; - ConfigurableAxis axisVertex{"axisVertex", {10, -10, 10}, "vertex axis for histograms"}; + ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for histograms"}; ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -PIHalf, kThreeHalfPi}, "delta phi axis for histograms"}; - ConfigurableAxis axisDeltaEta{"axisDeltaEta", {40, -2, 2}, "delta eta axis for histograms"}; + ConfigurableAxis axisDeltaEta{"axisDeltaEta", {32, -1.6, 1.6}, "delta eta axis for histograms"}; ConfigurableAxis axisPtTrigger{"axisPtTrigger", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 10.0}, "pt trigger axis for histograms"}; ConfigurableAxis axisPtAssoc{"axisPtAssoc", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0}, "pt associated axis for histograms"}; ConfigurableAxis axisMultiplicity{"axisMultiplicity", {VARIABLE_WIDTH, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100, 110.1}, "multiplicity / multiplicity axis for histograms"}; @@ -417,7 +418,6 @@ struct UpcPhotonuclearAnalysisJMG { continue; } float phiVal = RecoDecay::constrainAngle(phi(track.px(), track.py()), 0.f); - histos.fill(HIST("yields"), multiplicity, track.pt(), eta(track.px(), track.py(), track.pz())); histos.fill(HIST("etaphi"), multiplicity, eta(track.px(), track.py(), track.pz()), phiVal); } @@ -431,32 +431,6 @@ struct UpcPhotonuclearAnalysisJMG { return true; } - template - void fillCorrelationsUD(TTarget target, const TTracks tracks1, const TTracks tracks2, float multiplicity, float posZ) - { - multiplicity = tracks1.size(); - for (const auto& track1 : tracks1) { - if (isTrackCut(track1) == false) { - return; - } - target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, track1.pt(), multiplicity, posZ, 1.0); - for (const auto& track2 : tracks2) { - if (track1 == track2) { - continue; - } - if (isTrackCut(track2) == false) { - return; - } - /*if (doPairCuts && mPairCuts.conversionCuts(track1, track2)) { - continue; - }*/ - float deltaPhi = phi(track1.px(), track1.py()) - phi(track2.px(), track2.py()); - deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); - target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, eta(track1.px(), track1.py(), track1.pz()) - eta(track2.px(), track2.py(), track2.pz()), track2.pt(), track1.pt(), multiplicity, deltaPhi, posZ, 1.0); - } - } - } - void makeNUAWeights(std::shared_ptr histoRaw3D) { const int nPhi = histoRaw3D->GetZaxis()->GetNbins(); @@ -466,12 +440,23 @@ struct UpcPhotonuclearAnalysisJMG { for (int jEtha = 1; jEtha <= nEta; ++jEtha) { for (int iVtxZ = 1; iVtxZ <= nVz; ++iVtxZ) { // average on phi to (eta_jEtha, vz_iVtxZ) - double sum = 0, count = 0; + double sum = 0.0; + double nMax = 0.0; + int count = 0; for (int kPhi = 1; kPhi <= nPhi; ++kPhi) { - sum += histoRaw3D->GetBinContent(iVtxZ, jEtha, kPhi); + double nEntry = histoRaw3D->GetBinContent(iVtxZ, jEtha, kPhi); + sum += nEntry; count += 1.0; + if (nEntry > nMax) { + nMax = nEntry; + } + } + double nMean; + if (useNMax) { + nMean = nMax; + } else { + nMean = (count > 0) ? sum / count : 0.0; } - const double nMean = (count > 0) ? sum / count : 0.0; for (int kPhi = 1; kPhi <= nPhi; ++kPhi) { double nEntry = histoRaw3D->GetBinContent(iVtxZ, jEtha, kPhi); @@ -511,6 +496,51 @@ struct UpcPhotonuclearAnalysisJMG { return hWeight->GetBinContent(iVz, iEta, iPhi); } + template + void fillCorrelationsUD(TTarget target, const TTracks tracks1, const TTracks tracks2, float multiplicity, float posZ) + { + // multiplicity = tracks1.size(); + for (const auto& track1 : tracks1) { + if (isTrackCut(track1) == false) { + return; + } + // weight NUA for track1 + float phi1 = phi(track1.px(), track1.py()); + phi1 = RecoDecay::constrainAngle(phi1, 0.f); + float eta1 = eta(track1.px(), track1.py(), track1.pz()); + float w1 = getNUAWeight(posZ, eta1, phi1); + target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, track1.pt(), multiplicity, posZ, 1.0); + for (const auto& track2 : tracks2) { + if (track1 == track2) { + continue; + } + if (isTrackCut(track2) == false) { + return; + } + // weight NUA for track 2 + float phi2 = phi(track2.px(), track2.py()); + phi2 = RecoDecay::constrainAngle(phi2, 0.f); + float eta2 = eta(track2.px(), track2.py(), track2.pz()); + float w2 = getNUAWeight(posZ, eta2, phi2); + // total weight + float wPair = w1 * w2; + /*if (doPairCuts && mPairCuts.conversionCuts(track1, track2)) { + continue; + }*/ + float deltaPhi = phi1 - phi2; + float deltaEta = eta1 - eta2; + deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); + target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, + deltaEta, + track2.pt(), track1.pt(), + multiplicity, + deltaPhi, + posZ, + wPair); + } + } + } + void processSG(FullSGUDCollision::iterator const& reconstructedCollision, FullUDTracks const& reconstructedTracks) { histos.fill(HIST("Events/hCountCollisions"), 0); @@ -777,6 +807,27 @@ struct UpcPhotonuclearAnalysisJMG { if (isCollisionCutSG(reconstructedCollision) == false) { return; } + + // Configure track flow histogram labels + auto hFlow = histos.get(HIST("Tracks/hTracksAfterCuts")); + hFlow->GetXaxis()->SetBinLabel(1, "All tracks"); + hFlow->GetXaxis()->SetBinLabel(2, "Track sign"); + hFlow->GetXaxis()->SetBinLabel(3, "p_{T} range"); + hFlow->GetXaxis()->SetBinLabel(4, "#eta range"); + hFlow->GetXaxis()->SetBinLabel(5, "dcaZ"); + hFlow->GetXaxis()->SetBinLabel(6, "dcaXY"); + hFlow->GetXaxis()->SetBinLabel(7, "PV contrib cut"); + hFlow->GetXaxis()->SetBinLabel(8, "has ITS cut"); + hFlow->GetXaxis()->SetBinLabel(9, "N clusters ITS cut"); + hFlow->GetXaxis()->SetBinLabel(10, "#chi^{2} N cluster ITS cut"); + hFlow->GetXaxis()->SetBinLabel(11, "has TPC cut"); + hFlow->GetXaxis()->SetBinLabel(12, "N clusters crossed row TPC cut"); + hFlow->GetXaxis()->SetBinLabel(13, "(N cluster findable - N cluster minus findable) TPC cut"); + hFlow->GetXaxis()->SetBinLabel(14, "N cluster findable TPC cut"); + hFlow->GetXaxis()->SetBinLabel(15, "(N cluster crossed row / N cluster findable) TPC cut"); + hFlow->GetXaxis()->SetBinLabel(16, "(N cluster findable - N cluster minus findable) / N cluster findable cut"); + hFlow->GetXaxis()->SetBinLabel(17, "#chi^{2} N cluster TPC cut"); + for (const auto& track : reconstructedTracks) { histos.fill(HIST("Tracks/hTracksAfterCuts"), 0); if (track.sign() != 1 && track.sign() != -1) { @@ -881,7 +932,7 @@ struct UpcPhotonuclearAnalysisJMG { if (fillCollisionUD(sameGapSideA, multiplicity) == false) { return; } - // LOGF(debug, "Filling sameGapSideA events"); + LOGF(info, "Filling sameGapSideA events"); histos.fill(HIST("eventcount"), -2); fillQAUD(reconstructedTracks); fillCorrelationsUD(sameGapSideA, reconstructedTracks, reconstructedTracks, multiplicity, reconstructedCollision.posZ()); From 4004c689d1c907d29ed06f0106948b34ed9e7140 Mon Sep 17 00:00:00 2001 From: fuchuncui <162277233+fuchuncui@users.noreply.github.com> Date: Mon, 15 Sep 2025 14:36:51 +0800 Subject: [PATCH 397/986] [PWGCF] add cascades' run by run NUA correction (#12926) Co-authored-by: fuchuncui --- PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx | 89 ++++++++++++++++++++++++++++- 1 file changed, 87 insertions(+), 2 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx b/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx index c0c3fd8e592..658ab1fea95 100644 --- a/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx +++ b/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx @@ -50,8 +50,11 @@ #include #include +#include #include #include +#include +#include #include using namespace o2; @@ -79,6 +82,7 @@ std::shared_ptr omegac22[10]; std::shared_ptr omegac24[10]; std::shared_ptr omegac22Full[10]; std::shared_ptr omegac32[10]; + } // namespace #define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; @@ -166,6 +170,7 @@ struct FlowGfwOmegaXi { O2_DEFINE_CONFIGURABLE(cfgLocDenParaOmega, std::vector, (std::vector{-0.000444324, -6.0424, -0.000566208, -5.42168, -0.000580338, -4.96967, -0.000721054, -4.41994, -0.000626394, -4.27934, -0.000652167, -3.9543, -0.000592327, -3.79053, -0.000544721, -3.73292, -0.000613419, -3.43849, -0.000402506, -3.47687, -0.000602687, -3.24491, -0.000460848, -3.056, -0.00039428, -2.35188, -0.00041908, -2.03642}), "Local density efficiency function parameter for Omega, exp(Ax + B)") O2_DEFINE_CONFIGURABLE(cfgLocDenParaK0s, std::vector, (std::vector{-0.00043057, -3.2435, -0.000385085, -2.97687, -0.000350298, -2.81502, -0.000326159, -2.71091, -0.000299563, -2.65448, -0.000294284, -2.60865, -0.000277938, -2.589, -0.000277091, -2.56983, -0.000272783, -2.56825, -0.000252706, -2.58996, -0.000247834, -2.63158, -0.00024379, -2.76976, -0.000286468, -2.92484, -0.000310149, -3.27746}), "Local density efficiency function parameter for K0s, exp(Ax + B)") O2_DEFINE_CONFIGURABLE(cfgLocDenParaLambda, std::vector, (std::vector{-0.000510948, -4.4846, -0.000460629, -4.14465, -0.000433729, -3.94173, -0.000412751, -3.81839, -0.000411211, -3.72502, -0.000401511, -3.68426, -0.000407461, -3.67005, -0.000379371, -3.71153, -0.000392828, -3.73214, -0.000403996, -3.80717, -0.000403376, -3.90917, -0.000354624, -4.34629, -0.000477606, -4.66307, -0.000541139, -4.61364}), "Local density efficiency function parameter for Lambda, exp(Ax + B)") + O2_DEFINE_CONFIGURABLE(cfgRunNumbers, std::vector, (std::vector{544095, 544098, 544116, 544121, 544122, 544123, 544124}), "Preconfigured run numbers") // switch O2_DEFINE_CONFIGURABLE(cfgDoAccEffCorr, bool, false, "do acc and eff corr") O2_DEFINE_CONFIGURABLE(cfgDoLocDenCorr, bool, false, "do local density corr") @@ -173,6 +178,7 @@ struct FlowGfwOmegaXi { O2_DEFINE_CONFIGURABLE(cfgOutputV0, bool, true, "Fill and output V0s flow") O2_DEFINE_CONFIGURABLE(cfgOutputCasc, bool, true, "Fill and output cascades flow") O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeights, bool, false, "Fill and output NUA weights") + O2_DEFINE_CONFIGURABLE(cfgOutputrunbyrun, bool, false, "Fill and output NUA weights run by run") O2_DEFINE_CONFIGURABLE(cfgOutputLocDenWeights, bool, false, "Fill and output local density weights") O2_DEFINE_CONFIGURABLE(cfgOutputQA, bool, false, "do QA") @@ -221,6 +227,32 @@ struct FlowGfwOmegaXi { std::vector cfgEfficiency; std::vector cfgNSigma; std::vector cfgmassbins; + std::vector runNumbers; + std::map>> th1sList; + std::map>> th3sList; + enum OutputTH1Names { + // here are TProfiles for vn-pt correlations that are not implemented in GFW + hPhi = 0, + hPhicorr, + hPhiK0s, + hPhiLambda, + hPhiXi, + hPhiOmega, + hPhiK0scorr, + hPhiLambdacorr, + hPhiXicorr, + hPhiOmegacorr, + kCount_TH1Names + }; + + enum OutputTH3Names { + hPhiEtaVtxz = 0, + hPhiEtaVtxzK0s, + hPhiEtaVtxzLambda, + hPhiEtaVtxzXi, + hPhiEtaVtxzOmega, + kCount_TH3Names + }; std::vector mAcceptance; std::vector mEfficiency; @@ -325,6 +357,32 @@ struct FlowGfwOmegaXi { registry.add("hEtaPhiVtxzPOIK0s", "", {HistType::kTH3D, {cfgaxisPhi, cfgaxisEta, {20, -10, 10}}}); registry.add("hEtaPhiVtxzPOILambda", "", {HistType::kTH3D, {cfgaxisPhi, cfgaxisEta, {20, -10, 10}}}); + if (cfgOutputrunbyrun) { + runNumbers = cfgRunNumbers; + for (const auto& runNumber : runNumbers) { + std::vector> histosPhi(kCount_TH1Names); + histosPhi[hPhi] = registry.add(Form("%d/hPhi", runNumber), "", {HistType::kTH1D, {cfgaxisPhi}}); + histosPhi[hPhicorr] = registry.add(Form("%d/hPhicorr", runNumber), "", {HistType::kTH1D, {cfgaxisPhi}}); + histosPhi[hPhiK0s] = registry.add(Form("%d/hPhiK0s", runNumber), "", {HistType::kTH1D, {cfgaxisPhi}}); + histosPhi[hPhiLambda] = registry.add(Form("%d/hPhiLambda", runNumber), "", {HistType::kTH1D, {cfgaxisPhi}}); + histosPhi[hPhiXi] = registry.add(Form("%d/hPhiXi", runNumber), "", {HistType::kTH1D, {cfgaxisPhi}}); + histosPhi[hPhiOmega] = registry.add(Form("%d/hPhiOmega", runNumber), "", {HistType::kTH1D, {cfgaxisPhi}}); + histosPhi[hPhiK0scorr] = registry.add(Form("%d/hPhiK0scorr", runNumber), "", {HistType::kTH1D, {cfgaxisPhi}}); + histosPhi[hPhiLambdacorr] = registry.add(Form("%d/hPhiLambdacorr", runNumber), "", {HistType::kTH1D, {cfgaxisPhi}}); + histosPhi[hPhiXicorr] = registry.add(Form("%d/hPhiXicorr", runNumber), "", {HistType::kTH1D, {cfgaxisPhi}}); + histosPhi[hPhiOmegacorr] = registry.add(Form("%d/hPhiOmegacorr", runNumber), "", {HistType::kTH1D, {cfgaxisPhi}}); + th1sList.insert(std::make_pair(runNumber, histosPhi)); + + std::vector> nuaTH3(kCount_TH3Names); + nuaTH3[hPhiEtaVtxz] = registry.add(Form("%d/hPhiEtaVtxz", runNumber), ";#varphi;#eta;v_{z}", {HistType::kTH3D, {cfgaxisPhi, {64, -1.6, 1.6}, cfgaxisVertex}}); + nuaTH3[hPhiEtaVtxzK0s] = registry.add(Form("%d/hPhiEtaVtxzK0s", runNumber), ";#varphi;#eta;v_{z}", {HistType::kTH3D, {cfgaxisPhi, {64, -1.6, 1.6}, cfgaxisVertex}}); + nuaTH3[hPhiEtaVtxzLambda] = registry.add(Form("%d/hPhiEtaVtxzLambda", runNumber), ";#varphi;#eta;v_{z}", {HistType::kTH3D, {cfgaxisPhi, {64, -1.6, 1.6}, cfgaxisVertex}}); + nuaTH3[hPhiEtaVtxzXi] = registry.add(Form("%d/hPhiEtaVtxzXi", runNumber), ";#varphi;#eta;v_{z}", {HistType::kTH3D, {cfgaxisPhi, {64, -1.6, 1.6}, cfgaxisVertex}}); + nuaTH3[hPhiEtaVtxzOmega] = registry.add(Form("%d/hPhiEtaVtxzOmega", runNumber), ";#varphi;#eta;v_{z}", {HistType::kTH3D, {cfgaxisPhi, {64, -1.6, 1.6}, cfgaxisVertex}}); + th3sList.insert(std::make_pair(runNumber, nuaTH3)); + } + } + registry.add("hEventCount", "", {HistType::kTH1D, {{12, 0, 12}}}); registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(1, "Filtered event"); registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(2, "after sel8"); @@ -446,7 +504,7 @@ struct FlowGfwOmegaXi { registry.add("MC/Lambdac22dptMC", ";pt ; C_{2}{2} ", {HistType::kTProfile2D, {cfgaxisPtLambda, axisMultiplicity}}); // InvMass(GeV) of casc and v0 AxisSpec axisOmegaMass = {80, 1.63f, 1.71f, "Inv. Mass (GeV)"}; - AxisSpec axisXiMass = {70, 1.3f, 1.37f, "Inv. Mass (GeV)"}; + AxisSpec axisXiMass = {80, 1.29f, 1.37f, "Inv. Mass (GeV)"}; AxisSpec axisK0sMass = {400, 0.4f, 0.6f, "Inv. Mass (GeV)"}; AxisSpec axisLambdaMass = {160, 1.08f, 1.16f, "Inv. Mass (GeV)"}; registry.add("InvMassXi_all", "", {HistType::kTHnSparseF, {cfgaxisPtXi, axisXiMass, cfgaxisEta, axisMultiplicity}}); @@ -919,6 +977,7 @@ struct FlowGfwOmegaXi { return; TH1D* hLocalDensity = new TH1D("hphi", "hphi", 400, -constants::math::TwoPI, constants::math::TwoPI); auto bc = collision.bc_as(); + int runNumber = bc.runNumber(); loadCorrections(bc.timestamp()); float vtxz = collision.posZ(); registry.fill(HIST("hVtxZ"), vtxz); @@ -954,6 +1013,12 @@ struct FlowGfwOmegaXi { } if (cfgOutputNUAWeights) fWeightsREF->fill(track.phi(), track.eta(), vtxz, track.pt(), cent, 0); + + if (cfgOutputrunbyrun) { + th1sList[runNumber][hPhi]->Fill(track.phi()); + th1sList[runNumber][hPhicorr]->Fill(track.phi(), wacc); + th3sList[runNumber][hPhiEtaVtxz]->Fill(track.phi(), track.eta(), vtxz); + } } if (cfgDoLocDenCorr) { registry.fill(HIST("hCentvsNch"), cent, nch); @@ -1080,6 +1145,11 @@ struct FlowGfwOmegaXi { fGFW->Fill(v0.eta(), fK0sPtAxis->FindBin(v0.pt()) - 1 + ((fK0sMass->FindBin(v0.mK0Short()) - 1) * nK0sPtBins), v0.phi(), wacc * weff * wloc, 8); if (cfgOutputNUAWeights) fWeightsK0s->fill(v0.phi(), v0.eta(), vtxz, v0.pt(), cent, 0); + if (cfgOutputrunbyrun) { + th1sList[runNumber][hPhiK0s]->Fill(v0.phi()); + th1sList[runNumber][hPhiK0scorr]->Fill(v0.phi(), wacc); + th3sList[runNumber][hPhiEtaVtxzK0s]->Fill(v0.phi(), v0.eta(), vtxz); + } } if (isLambda) { if (cfgDoAccEffCorr) @@ -1099,6 +1169,11 @@ struct FlowGfwOmegaXi { fGFW->Fill(v0.eta(), fK0sPtAxis->FindBin(v0.pt()) - 1 + ((fLambdaMass->FindBin(v0.mLambda()) - 1) * nK0sPtBins), v0.phi(), wacc * weff * wloc, 16); if (cfgOutputNUAWeights) fWeightsLambda->fill(v0.phi(), v0.eta(), vtxz, v0.pt(), cent, 0); + if (cfgOutputrunbyrun) { + th1sList[runNumber][hPhiLambda]->Fill(v0.phi()); + th1sList[runNumber][hPhiLambdacorr]->Fill(v0.phi(), wacc); + th3sList[runNumber][hPhiEtaVtxzLambda]->Fill(v0.phi(), v0.eta(), vtxz); + } } } } @@ -1222,7 +1297,7 @@ struct FlowGfwOmegaXi { isXi = false; } if (isOmega && std::fabs(casc.mXi() - o2::constants::physics::MassXiMinus) < cascBuilderOpts.cfgcasc_compmassrej.value) { - isXi = false; + isOmega = false; } // fill QA if (cfgOutputQA) { @@ -1264,6 +1339,11 @@ struct FlowGfwOmegaXi { if (cfgOutputNUAWeights) fWeightsOmega->fill(casc.phi(), casc.eta(), vtxz, casc.pt(), cent, 0); + if (cfgOutputrunbyrun) { + th1sList[runNumber][hPhiOmega]->Fill(casc.phi()); + th1sList[runNumber][hPhiOmegacorr]->Fill(casc.phi(), wacc); + th3sList[runNumber][hPhiEtaVtxzOmega]->Fill(casc.phi(), casc.eta(), vtxz); + } } if (isXi) { if (cfgDoAccEffCorr) { @@ -1285,6 +1365,11 @@ struct FlowGfwOmegaXi { if (cfgOutputNUAWeights) fWeightsXi->fill(casc.phi(), casc.eta(), vtxz, casc.pt(), cent, 0); + if (cfgOutputrunbyrun) { + th1sList[runNumber][hPhiXi]->Fill(casc.phi()); + th1sList[runNumber][hPhiXicorr]->Fill(casc.phi(), wacc); + th3sList[runNumber][hPhiEtaVtxzXi]->Fill(casc.phi(), casc.eta(), vtxz); + } } } } From fbc0a106a02c7338d2c44126d8434fbbbf385c2e Mon Sep 17 00:00:00 2001 From: Anantha Padmanabhan M Nair <82643666+ananthapadmanabhan18@users.noreply.github.com> Date: Mon, 15 Sep 2025 03:30:13 -0400 Subject: [PATCH 398/986] [PWGUD] Modified all the histograms, and added few Sparse Histograms (#12982) --- PWGUD/Tasks/exclusiveRhoTo4Pi.cxx | 1472 +++++++++++++---------------- 1 file changed, 648 insertions(+), 824 deletions(-) diff --git a/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx b/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx index 7d875f0e1b9..5d9ffdb9f1c 100644 --- a/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx +++ b/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx @@ -51,356 +51,22 @@ using XYZVectorF = ROOT::Math::XYZVectorF; using PxPyPzEVector = ROOT::Math::PxPyPzEVector; using PxPyPzMVector = ROOT::Math::PxPyPzMVector; -namespace o2::aod -{ -namespace branch -{ -// Run Number -DECLARE_SOA_COLUMN(RunNumber, runNumber, int); -// Check UPC mode -DECLARE_SOA_COLUMN(IfCheckUPCmode, ifCheckUPCmode, uint16_t); -// vertex Position -DECLARE_SOA_COLUMN(PosX, posX, double); -DECLARE_SOA_COLUMN(PosY, posY, double); -DECLARE_SOA_COLUMN(PosZ, posZ, double); -// FIT signals -DECLARE_SOA_COLUMN(Fv0signal, fv0signal, double); -DECLARE_SOA_COLUMN(Ft0asignal, ft0asignal, double); -DECLARE_SOA_COLUMN(Ft0csignal, ft0csignal, double); -DECLARE_SOA_COLUMN(Fddasignal, fddasignal, double); -DECLARE_SOA_COLUMN(Fddcsignal, fddcsignal, double); -// FIT times -DECLARE_SOA_COLUMN(TimeFv0, timeFv0, double); -DECLARE_SOA_COLUMN(TimeFt0a, timeFt0a, double); -DECLARE_SOA_COLUMN(TimeFt0c, timeFt0c, double); -DECLARE_SOA_COLUMN(TimeFdda, timeFdda, double); -DECLARE_SOA_COLUMN(TimeFddc, timeFddc, double); -// ZDC times -DECLARE_SOA_COLUMN(TimeZna, timeZna, double); -DECLARE_SOA_COLUMN(TimeZnc, timeZnc, double); -// Occupancy -DECLARE_SOA_COLUMN(Occupancy, occupancy, double); -// Atleast one pion has TOF -DECLARE_SOA_COLUMN(HasAtLeastOneTOF, hasAtLeastOneTOF, bool); -// DCA XY -DECLARE_SOA_COLUMN(Dcaxy1, dcaxy1, double); -DECLARE_SOA_COLUMN(Dcaxy2, dcaxy2, double); -DECLARE_SOA_COLUMN(Dcaxy3, dcaxy3, double); -DECLARE_SOA_COLUMN(Dcaxy4, dcaxy4, double); -// DCA Z -DECLARE_SOA_COLUMN(Dcaz1, dcaz1, double); -DECLARE_SOA_COLUMN(Dcaz2, dcaz2, double); -DECLARE_SOA_COLUMN(Dcaz3, dcaz3, double); -DECLARE_SOA_COLUMN(Dcaz4, dcaz4, double); -// TPC nSigmaPi -DECLARE_SOA_COLUMN(TpcNsigmaPi1, tpcNsigmaPi1, double); -DECLARE_SOA_COLUMN(TpcNsigmaPi2, tpcNsigmaPi2, double); -DECLARE_SOA_COLUMN(TpcNsigmaPi3, tpcNsigmaPi3, double); -DECLARE_SOA_COLUMN(TpcNsigmaPi4, tpcNsigmaPi4, double); -// TPC nSigmaKa -DECLARE_SOA_COLUMN(TpcNsigmaKa1, tpcNsigmaKa1, double); -DECLARE_SOA_COLUMN(TpcNsigmaKa2, tpcNsigmaKa2, double); -DECLARE_SOA_COLUMN(TpcNsigmaKa3, tpcNsigmaKa3, double); -DECLARE_SOA_COLUMN(TpcNsigmaKa4, tpcNsigmaKa4, double); -// TPC nSigmaPr -DECLARE_SOA_COLUMN(TpcNsigmaPr1, tpcNsigmaPr1, double); -DECLARE_SOA_COLUMN(TpcNsigmaPr2, tpcNsigmaPr2, double); -DECLARE_SOA_COLUMN(TpcNsigmaPr3, tpcNsigmaPr3, double); -DECLARE_SOA_COLUMN(TpcNsigmaPr4, tpcNsigmaPr4, double); -// TPC nSigmaEl -DECLARE_SOA_COLUMN(TpcNsigmaEl1, tpcNsigmaEl1, double); -DECLARE_SOA_COLUMN(TpcNsigmaEl2, tpcNsigmaEl2, double); -DECLARE_SOA_COLUMN(TpcNsigmaEl3, tpcNsigmaEl3, double); -DECLARE_SOA_COLUMN(TpcNsigmaEl4, tpcNsigmaEl4, double); -// TPC nSigmaMu -DECLARE_SOA_COLUMN(TpcNsigmaMu1, tpcNsigmaMu1, double); -DECLARE_SOA_COLUMN(TpcNsigmaMu2, tpcNsigmaMu2, double); -DECLARE_SOA_COLUMN(TpcNsigmaMu3, tpcNsigmaMu3, double); -DECLARE_SOA_COLUMN(TpcNsigmaMu4, tpcNsigmaMu4, double); -// TPC Chi2 -DECLARE_SOA_COLUMN(TpcChi21, tpcChi21, double); -DECLARE_SOA_COLUMN(TpcChi22, tpcChi22, double); -DECLARE_SOA_COLUMN(TpcChi23, tpcChi23, double); -DECLARE_SOA_COLUMN(TpcChi24, tpcChi24, double); -// TPC NClsFindable -DECLARE_SOA_COLUMN(TpcNClsFindable1, tpcNClsFindable1, double); -DECLARE_SOA_COLUMN(TpcNClsFindable2, tpcNClsFindable2, double); -DECLARE_SOA_COLUMN(TpcNClsFindable3, tpcNClsFindable3, double); -DECLARE_SOA_COLUMN(TpcNClsFindable4, tpcNClsFindable4, double); -// ITS Chi2 -DECLARE_SOA_COLUMN(ItsChi21, itsChi21, double); -DECLARE_SOA_COLUMN(ItsChi22, itsChi22, double); -DECLARE_SOA_COLUMN(ItsChi23, itsChi23, double); -DECLARE_SOA_COLUMN(ItsChi24, itsChi24, double); -// PionPt -DECLARE_SOA_COLUMN(PionPt1, pionPt1, double); -DECLARE_SOA_COLUMN(PionPt2, pionPt2, double); -DECLARE_SOA_COLUMN(PionPt3, pionPt3, double); -DECLARE_SOA_COLUMN(PionPt4, pionPt4, double); -// Pion Eta -DECLARE_SOA_COLUMN(PionEta1, pionEta1, double); -DECLARE_SOA_COLUMN(PionEta2, pionEta2, double); -DECLARE_SOA_COLUMN(PionEta3, pionEta3, double); -DECLARE_SOA_COLUMN(PionEta4, pionEta4, double); -// Pion Phi -DECLARE_SOA_COLUMN(PionPhi1, pionPhi1, double); -DECLARE_SOA_COLUMN(PionPhi2, pionPhi2, double); -DECLARE_SOA_COLUMN(PionPhi3, pionPhi3, double); -DECLARE_SOA_COLUMN(PionPhi4, pionPhi4, double); -// Pion Rapidity -DECLARE_SOA_COLUMN(PionRapidity1, pionRapidity1, double); -DECLARE_SOA_COLUMN(PionRapidity2, pionRapidity2, double); -DECLARE_SOA_COLUMN(PionRapidity3, pionRapidity3, double); -DECLARE_SOA_COLUMN(PionRapidity4, pionRapidity4, double); -// Four Pion Pt, Eta, Phi Rapidity -DECLARE_SOA_COLUMN(FourPionPt, fourPionPt, double); -DECLARE_SOA_COLUMN(FourPionEta, fourPionEta, double); -DECLARE_SOA_COLUMN(FourPionPhi, fourPionPhi, double); -DECLARE_SOA_COLUMN(FourPionRapidity, fourPionRapidity, double); -DECLARE_SOA_COLUMN(FourPionMass, fourPionMass, double); -// Collin-Soper Angles -DECLARE_SOA_COLUMN(FourPionPhiPair1, fourPionPhiPair1, double); -DECLARE_SOA_COLUMN(FourPionPhiPair2, fourPionPhiPair2, double); -DECLARE_SOA_COLUMN(FourPionPhiPair3, fourPionPhiPair3, double); -DECLARE_SOA_COLUMN(FourPionPhiPair4, fourPionPhiPair4, double); -DECLARE_SOA_COLUMN(FourPionCosThetaPair1, fourPionCosThetaPair1, double); -DECLARE_SOA_COLUMN(FourPionCosThetaPair2, fourPionCosThetaPair2, double); -DECLARE_SOA_COLUMN(FourPionCosThetaPair3, fourPionCosThetaPair3, double); -DECLARE_SOA_COLUMN(FourPionCosThetaPair4, fourPionCosThetaPair4, double); -} // namespace branch - -DECLARE_SOA_TABLE(SignalData, "AOD", "signalData", - branch::RunNumber, - - branch::IfCheckUPCmode, - - branch::PosX, - branch::PosY, - branch::PosZ, - - branch::Fv0signal, - branch::Ft0asignal, - branch::Ft0csignal, - branch::Fddasignal, - branch::Fddcsignal, - - branch::TimeFv0, - branch::TimeFt0a, - branch::TimeFt0c, - branch::TimeFdda, - branch::TimeFddc, - branch::TimeZna, - branch::TimeZnc, - - branch::Occupancy, - - branch::HasAtLeastOneTOF, - - branch::Dcaxy1, - branch::Dcaxy2, - branch::Dcaxy3, - branch::Dcaxy4, - - branch::Dcaz1, - branch::Dcaz2, - branch::Dcaz3, - branch::Dcaz4, - - branch::TpcNsigmaPi1, - branch::TpcNsigmaPi2, - branch::TpcNsigmaPi3, - branch::TpcNsigmaPi4, - - branch::TpcNsigmaKa1, - branch::TpcNsigmaKa2, - branch::TpcNsigmaKa3, - branch::TpcNsigmaKa4, - - branch::TpcNsigmaPr1, - branch::TpcNsigmaPr2, - branch::TpcNsigmaPr3, - branch::TpcNsigmaPr4, - - branch::TpcNsigmaEl1, - branch::TpcNsigmaEl2, - branch::TpcNsigmaEl3, - branch::TpcNsigmaEl4, - - branch::TpcNsigmaMu1, - branch::TpcNsigmaMu2, - branch::TpcNsigmaMu3, - branch::TpcNsigmaMu4, - - branch::TpcChi21, - branch::TpcChi22, - branch::TpcChi23, - branch::TpcChi24, - - branch::TpcNClsFindable1, - branch::TpcNClsFindable2, - branch::TpcNClsFindable3, - branch::TpcNClsFindable4, - - branch::ItsChi21, - branch::ItsChi22, - branch::ItsChi23, - branch::ItsChi24, - - branch::PionPt1, - branch::PionPt2, - branch::PionPt3, - branch::PionPt4, - - branch::PionEta1, - branch::PionEta2, - branch::PionEta3, - branch::PionEta4, - - branch::PionPhi1, - branch::PionPhi2, - branch::PionPhi3, - branch::PionPhi4, - - branch::PionRapidity1, - branch::PionRapidity2, - branch::PionRapidity3, - branch::PionRapidity4, - - branch::FourPionPt, - branch::FourPionEta, - branch::FourPionPhi, - branch::FourPionRapidity, - branch::FourPionMass, - branch::FourPionPhiPair1, - branch::FourPionPhiPair2, - branch::FourPionPhiPair3, - branch::FourPionPhiPair4, - branch::FourPionCosThetaPair1, - branch::FourPionCosThetaPair2, - branch::FourPionCosThetaPair3, - branch::FourPionCosThetaPair4); - -DECLARE_SOA_TABLE(BkgroundData, "AOD", "bkgroundData", - branch::RunNumber, - - branch::IfCheckUPCmode, - - branch::PosX, - branch::PosY, - branch::PosZ, - - branch::Fv0signal, - branch::Ft0asignal, - branch::Ft0csignal, - branch::Fddasignal, - branch::Fddcsignal, - - branch::TimeFv0, - branch::TimeFt0a, - branch::TimeFt0c, - branch::TimeFdda, - branch::TimeFddc, - branch::TimeZna, - branch::TimeZnc, - - branch::Occupancy, - - branch::HasAtLeastOneTOF, - - branch::Dcaxy1, - branch::Dcaxy2, - branch::Dcaxy3, - branch::Dcaxy4, - - branch::Dcaz1, - branch::Dcaz2, - branch::Dcaz3, - branch::Dcaz4, - - branch::TpcNsigmaPi1, - branch::TpcNsigmaPi2, - branch::TpcNsigmaPi3, - branch::TpcNsigmaPi4, - - branch::TpcNsigmaKa1, - branch::TpcNsigmaKa2, - branch::TpcNsigmaKa3, - branch::TpcNsigmaKa4, - - branch::TpcNsigmaPr1, - branch::TpcNsigmaPr2, - branch::TpcNsigmaPr3, - branch::TpcNsigmaPr4, - - branch::TpcNsigmaEl1, - branch::TpcNsigmaEl2, - branch::TpcNsigmaEl3, - branch::TpcNsigmaEl4, - - branch::TpcNsigmaMu1, - branch::TpcNsigmaMu2, - branch::TpcNsigmaMu3, - branch::TpcNsigmaMu4, - - branch::TpcChi21, - branch::TpcChi22, - branch::TpcChi23, - branch::TpcChi24, - - branch::TpcNClsFindable1, - branch::TpcNClsFindable2, - branch::TpcNClsFindable3, - branch::TpcNClsFindable4, - - branch::ItsChi21, - branch::ItsChi22, - branch::ItsChi23, - branch::ItsChi24, - - branch::PionPt1, - branch::PionPt2, - branch::PionPt3, - branch::PionPt4, - - branch::PionEta1, - branch::PionEta2, - branch::PionEta3, - branch::PionEta4, - - branch::PionPhi1, - branch::PionPhi2, - branch::PionPhi3, - branch::PionPhi4, - - branch::PionRapidity1, - branch::PionRapidity2, - branch::PionRapidity3, - branch::PionRapidity4, - - branch::FourPionPt, - branch::FourPionEta, - branch::FourPionPhi, - branch::FourPionRapidity, - branch::FourPionMass); -} // namespace o2::aod - struct ExclusiveRhoTo4Pi { SGSelector sgSelector; // Defining constants int numFourPionTracks = 4; int numPiPlus = 2; int numPiMinus = 2; - float zeroPointEight = 0.8; double mRho0 = 0.77526; // GeV/c^2 // Run Numbers static int runNos[113]; static int numRunNums; - // Derived Data - Produces sigFromData; - Produces bkgFromData; // Histogram Registry - HistogramRegistry histosData{"Data", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry histosCounter{"counters", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry histosDataCounter{"Counters", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry histosQA{"QA", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry histosPID{"PID", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry histosKin{"Kinematics", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry histos4piKin{"Four-Pion-Kinematics", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; // Configurable Event parameters Configurable ifUPC{"ifUPC", 1, "Enable UPC reconstruction only"}; Configurable vZCut{"vZCut", 10., "Vertex Cut"}; @@ -426,13 +92,8 @@ struct ExclusiveRhoTo4Pi { Configurable tpcNClsFindableCut{"tpcNClsFindableCut", 70, "Min TPC Findable Clusters"}; // Configurable PID parameters Configurable useTOF{"useTOF", true, "if track has TOF use TOF"}; - Configurable nSigmaTPCcut{"nSigmaTPCcut", 3, "TPC cut"}; - Configurable nSigmaTOFcut{"nSigmaTOFcut", 3, "TOF cut"}; - // Configurable Rho parameters - Configurable rhoRapCut{"rhoRapCut", 0.5, "Max abs Rapidity of rho"}; - Configurable rhoPtCut{"rhoPtCut", 0.15, "Min Pt of rho"}; - Configurable rhoMassMin{"rhoMassMin", 1, "Min Mass of rho"}; - Configurable rhoMassMax{"rhoMassMax", 2.5, "Max Mass of rho"}; + Configurable nSigmaTPCcut{"nSigmaTPCcut", 5, "TPC cut"}; + Configurable nSigmaTOFcut{"nSigmaTOFcut", 5, "TOF cut"}; // Axis Configurations ConfigurableAxis pTAxis{"pTAxis", {1000, 0, 1}, "Axis for pT histograms"}; ConfigurableAxis etaAxis{"etaAxis", {1000, -1.1, 1.1}, "Axis for Eta histograms"}; @@ -444,116 +105,137 @@ struct ExclusiveRhoTo4Pi { void init(InitContext const&) { // QA plots: Event and Track Counter - histosCounter.add("EventsCounts_vs_runNo", "Event Counter Run by Run; Run Number; Number of Events", kTH2F, {{113, 0, 113}, {14, 0, 14}}); - histosCounter.add("TracksCounts_vs_runNo", "Track Counter Run by Run; Run Number; Number of Tracks", kTH2F, {{113, 0, 113}, {14, 0, 14}}); - histosCounter.add("fourPionCounts_0c", "Four Pion Counts; Run Number; Events", kTH1F, {{113, 0, 113}}); - histosCounter.add("fourPionCounts_0c_within_mass", "Four Pion Counts within mass range; Run Number; Events", kTH1F, {{113, 0, 113}}); - histosCounter.add("fourPionCounts_0c_within_rap", "Four Pion Counts; Run Number; Events", kTH1F, {{113, 0, 113}}); - histosCounter.add("fourPionCounts_0c_selected", "Four Pion Counts; Run Number; Events", kTH1F, {{113, 0, 113}}); - histosCounter.add("fourPionCounts_n0c", "Four Pion Counts; Run Number; Events", kTH1F, {{113, 0, 113}}); - histosCounter.add("fourPionCounts_n0c_within_mass", "Four Pion Counts within mass range; Run Number; Events", kTH1F, {{113, 0, 113}}); - histosCounter.add("fourPionCounts_n0c_within_rap", "Four Pion Counts; Run Number; Events", kTH1F, {{113, 0, 113}}); - histosCounter.add("fourPionCounts_n0c_selected", "Four Pion Counts; Run Number; Events", kTH1F, {{113, 0, 113}}); - // QA plots: event selection - histosData.add("UPCmode", "UPC mode; Events", kTH1F, {{5, 0, 5}}); - histosData.add("GapSide", "Gap Side;Gap Side; Events", kTH1F, {{4, 0, 4}}); - histosData.add("TrueGapSide", "True Gap Side; True Gap Side; Events", kTH1F, {{4, 0, 4}}); - histosData.add("isCBTOk", "isCBTOk; bool; Events", kTH1F, {{4, 0, 4}}); - histosData.add("isCBTHadronOk", "isCBTHadronOk; bool; Events", kTH1F, {{4, 0, 4}}); - histosData.add("isCBTZdcOk", "isCBTZdcOk; bool; Events", kTH1F, {{4, 0, 4}}); - histosData.add("isCBTHadronZdcOk", "isCBTHadronZdcOk; bool; Events", kTH1F, {{4, 0, 4}}); - histosData.add("FT0A", "T0A amplitude", kTH1F, {{500, 0.0, 500.0}}); - histosData.add("FT0C", "T0C amplitude", kTH1F, {{500, 0.0, 500.0}}); - histosData.add("FV0A", "V0A amplitude", kTH1F, {{100, 0.0, 100}}); - histosData.add("ZDC_A", "ZDC amplitude", kTH1F, {{10000, 0.0, 10000}}); - histosData.add("ZDC_C", "ZDC amplitude", kTH1F, {{10000, 0.0, 10000}}); - histosData.add("FDDA", "FDD A signal; FDD A signal; Counts", kTH1F, {{500, 0.0, 2000}}); - histosData.add("FDDC", "FDD C signal; FDD C signal; Counts", kTH1F, {{500, 0.0, 2000}}); - histosData.add("vertexX", "Vertex X; Vertex X [cm]; Counts", kTH1F, {{2000, -0.05, 0.05}}); - histosData.add("vertexY", "Vertex Y; Vertex Y [cm]; Counts", kTH1F, {{2000, -0.05, 0.05}}); - histosData.add("vertexZ", "Vertex Z; Vertex Z [cm]; Counts", kTH1F, {{2000, -15, 15}}); - histosData.add("occupancy", "Occupancy; Occupancy; Counts", kTH1F, {{20000, 0, 20000}}); - // QA plots: tracks - histosData.add("dcaXY_all", "dcaXY; dcaXY [cm]; Counts", kTH1F, {{2000, -0.1, 0.1}}); - histosData.add("dcaXY_pions", "dcaXY_pions; dcaXY of Pions [cm]; Counts", kTH1F, {{2000, -0.1, 0.1}}); - histosData.add("dcaZ_all", "dcaZ; dcaZ [cm]; Counts", kTH1F, {{2000, -0.1, 0.1}}); - histosData.add("dcaZ_pions", "dcaZ_pions; dcaZ of Pions [cm]; Counts", kTH1F, {{2000, -0.1, 0.1}}); - histosData.add("itsChi2NCl_all", "ITS Chi2/NCl; Chi2/NCl; Counts", kTH1F, {{250, 0, 50}}); - histosData.add("itsChi2_all", "ITS Chi2; ITS Chi2; Counts", kTH1F, {{500, 0, 50}}); - histosData.add("tpcChi2NCl_all", "TPC Chi2/NCl; Chi2/NCl; Counts", kTH1F, {{250, 0, 50}}); - histosData.add("tpcNClsFindable_all", "TPC N Cls Findable; N Cls Findable; Counts", kTH1F, {{200, 0, 200}}); - // QA plots: PID - histosData.add("tpcSignal_all", "TPC dEdx vs p; p [GeV/c]; dEdx [a.u.]", kTH2F, {{500, 0, 10}, {5000, 0.0, 5000.0}}); - histosData.add("tpcSignal_pions", "TPC dEdx vs p for pions; p [GeV/c]; dEdx [a.u.]", kTH2F, {{500, 0, 10}, {5000, 0.0, 5000.0}}); - histosData.add("tpcNSigmaPi_all", "TPC nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosData.add("tpcNSigmaPi_pions", "TPC nSigma Pion with track selection and PID Selection of Pi; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosData.add("tpcNSigmaKa_pions", "TPC nSigma Kaon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosData.add("tpcNSigmaPr_pions", "TPC nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosData.add("tpcNSigmaEl_pions", "TPC nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosData.add("tpcNSigmaMu_pions", "TPC nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosData.add("tofBeta_all", "TOF beta vs p; p [GeV/c]; #beta", kTH2F, {{500, 0, 10}, {500, 0.0, 1.0}}); - histosData.add("tofBeta_pions", "TOF beta vs p for pions; p [GeV/c]; #beta", kTH2F, {{500, 0, 10}, {500, 0.0, 1.0}}); - histosData.add("tofNSigmaPi_all", "TOF nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosData.add("tofNSigmaPi_pions", "TOF nSigma Pion with track selection and PID Selection of Pi; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosData.add("tofNSigmaKa_pions", "TOF nSigma Kaon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosData.add("tofNSigmaPr_pions", "TOF nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosData.add("tofNSigmaEl_pions", "TOF nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosData.add("tofNSigmaMu_pions", "TOF nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - // Track Transverse Momentum - histosData.add("pT_track_all", "pT with track selection; pT [GeV/c]; Counts", kTH1F, {pTAxis}); - histosData.add("pT_track_pions", "pT with track selection and PID selection of Pi; pT [GeV/c]; Events", kTH1F, {pTAxis}); - histosData.add("pT_track_pions_contributed", "pT with track selection and PID selection of Pi which are contributed to selected event; pT [GeV/c]; Events", kTH1F, {pTAxis}); - // Track Pseudorapidity - histosData.add("eta_track_all", "Pseudorapidity with track selection; #eta; Counts", kTH1F, {etaAxis}); - histosData.add("eta_track_pions", "Pseudorapidity with track selection and PID selection of Pi; #eta; Events", kTH1F, {etaAxis}); - histosData.add("eta_track_pions_contributed", "Pseudorapidity with track selection and PID selection of Pi which are contributed to selected event; #eta; Events", kTH1F, {etaAxis}); - // Track Phi - histosData.add("phi_track_all", "Phi with track selection; #phi [rad]; Counts", kTH1F, {phiAxis}); - histosData.add("phi_track_pions", "Phi with track selection and PID selection of Pi; #phi [rad]; Events", kTH1F, {phiAxis}); - histosData.add("phi_track_pions_contributed", "Phi with track selection and PID selection of Pi which are contributed to selected event; #phi [rad]; Events", kTH1F, {phiAxis}); - // Track Rapidity - histosData.add("rapidity_track_all", "Rapidity with track selection; y; Counts", kTH1F, {rapidityAxis}); - histosData.add("rapidity_track_pions", "Rapidity with track selection and PID selection of Pi; y; Events", kTH1F, {rapidityAxis}); - histosData.add("rapidity_track_pions_contributed", "Rapidity with track selection and PID selection of Pi which are contributed to selected event; y; Events", kTH1F, {rapidityAxis}); - // Four Pion Transverse Momentum - histosData.add("fourpion_pT_0_charge", "Event pT in 0 Charge Events With Track Selection and PID Selection of Pi; pT [GeV/c]; Events", kTH1F, {pTAxis}); - histosData.add("fourpion_pT_0_charge_within_rap", "Event pT in 0 Charge Events With Track Selection and PID Selection of Pi; pT [GeV/c]; Events", kTH1F, {pTAxis}); - histosData.add("fourpion_pT_non_0_charge", "Event pT in Non 0 Charge Events With Track Selection and PID Selection of Pi; pT [GeV/c]; Events", kTH1F, {pTAxis}); - histosData.add("fourpion_pT_non_0_charge_within_rap", "Event pT in Non 0 Charge Events With Track Selection and PID Selection of Pi; pT [GeV/c]; Events", kTH1F, {pTAxis}); - // Four Pion Eta - histosData.add("fourpion_eta_0_charge", "Four Pion #eta (0 charge); #eta; Events", kTH1F, {etaAxis}); - histosData.add("fourpion_eta_0_charge_within_rap", "Four Pion #eta (0 charge within rap); #eta; Events", kTH1F, {etaAxis}); - histosData.add("fourpion_eta_non_0_charge", "Four Pion #eta (non 0 charge); #eta; #eta; Events", kTH1F, {etaAxis}); - histosData.add("fourpion_eta_non_0_charge_within_rap", "Four Pion #eta (non 0 charge within rap); #eta; Events", kTH1F, {etaAxis}); - // Four Pion Phi - histosData.add("fourpion_phi_0_charge", "Four Pion #phi (0 charge); #phi [rad]; Events", kTH1F, {phiAxis}); - histosData.add("fourpion_phi_0_charge_within_rap", "Four Pion #phi (0 charge within rap); #phi [rad]; Events", kTH1F, {phiAxis}); - histosData.add("fourpion_phi_non_0_charge", "Four Pion #phi (non 0 charge); #phi [rad]; Events", kTH1F, {phiAxis}); - histosData.add("fourpion_phi_non_0_charge_within_rap", "Four Pion #phi (non 0 charge within rap); #phi [rad]; Events", kTH1F, {phiAxis}); - // Four Pion Rapidity - histosData.add("fourpion_rap_0_charge", "Four Pion Rapidity (0 charge); y; Events", kTH1F, {{1000, -2.5, 2.5}}); - histosData.add("fourpion_rap_0_charge_within_rap", "Four Pion Rapidity (0 charge within rap); y; Events", kTH1F, {{1000, -2.5, 2.5}}); - histosData.add("fourpion_rap_non_0_charge", "Four Pion Rapidity (non 0 charge); y; Events", kTH1F, {rapidityAxis}); - histosData.add("fourpion_rap_non_0_charge_within_rap", "Four Pion Rapidity (non 0 charge within rap); y; Events", kTH1F, {rapidityAxis}); - // Four Pion Mass - histosData.add("fourpion_mass_0_charge", "Four Pion Invariant Mass (0 charge); m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]; Events", kTH1F, {invMassAxis}); - histosData.add("fourpion_mass_0_charge_within_rap", "Four Pion Invariant Mass (0 charge within rap); m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]; Events", kTH1F, {invMassAxis}); - histosData.add("fourpion_mass_non_0_charge", "Four Pion Invariant Mass (non 0 charge); m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]; Events", kTH1F, {invMassAxis}); - histosData.add("fourpion_mass_non_0_charge_within_rap", "Four Pion Invariant Mass (non 0 charge within rap); m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]; Events", kTH1F, {invMassAxis}); - // Pair Invariant Mass - histosData.add("twopion_mass_1", "Invariant Mass Distribution of 2 pions 1 ; m(#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{5000, 0, 5}}); - histosData.add("twopion_mass_2", "Invariant Mass Distribution of 2 pions 2 ; m(#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{5000, 0, 5}}); - histosData.add("twopion_mass_3", "Invariant Mass Distribution of 2 pions 3 ; m(#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{5000, 0, 5}}); - histosData.add("twopion_mass_4", "Invariant Mass Distribution of 2 pions 4 ; m(#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{5000, 0, 5}}); - // Four Pion Invariant Mass - histosData.add("fourpion_mass_0_charge_domA", "Invariant Mass Distribution of 0 charge Events with PID Selection of Pi for p_{T} < 0.15 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {invMassAxis}); // pT < 0.15GeV - histosData.add("fourpion_mass_0_charge_domB", "Invariant Mass Distribution of 0 charge Events with PID Selection of Pi for 0.15< p_{T} < 0.80 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {invMassAxis}); // 0.15GeV < pT < 0.8GeV - histosData.add("fourpion_mass_0_charge_domC", "Invariant Mass Distribution of 0 charge Events with PID Selection of Pi for p_{T} > 0.80 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {invMassAxis}); // 0.8GeV < pT - histosData.add("fourpion_mass_non_0_charge_domA", "Invariant Mass Distribution of non 0 charge Events with PID Selection of Pi for p_{T} < 0.15 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {invMassAxis}); // pT < 0.15GeV - histosData.add("fourpion_mass_non_0_charge_domB", "Invariant Mass Distribution of non 0 charge Events with PID Selection of Pi for 0.15< p_{T} < 0.80 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {invMassAxis}); // 0.15GeV < pT < 0.8GeV - histosData.add("fourpion_mass_non_0_charge_domC", "Invariant Mass Distribution of non 0 charge Events with PID Selection of Pi for p_{T} > 0.80 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {invMassAxis}); // 0.8GeV < pT - // Collin Soper Theta and Phi after selection - histosData.add("CSphi_vs_CScosTheta", "Phi vs cosTheta for small mass; #phi; cos(#theta)", kTH2F, {phiAxis, cosThetaAxis}); + histosDataCounter.add("EventsCounts_vs_runNo", "Event Counter Run by Run; Run Number; Number of Events", kTH2F, {{113, 0, 113}, {14, 0, 14}}); + histosDataCounter.add("TracksCounts_vs_runNo", "Track Counter Run by Run; Run Number; Number of Tracks", kTH2F, {{113, 0, 113}, {14, 0, 14}}); + // QA plots: event selection-selected events + histosQA.add("Events/selected/UPCmode", "UPC mode; Events", kTH1F, {{5, 0, 5}}); + histosQA.add("Events/selected/GapSide", "Gap Side;Gap Side; Events", kTH1F, {{4, 0, 4}}); + histosQA.add("Events/selected/TrueGapSide", "True Gap Side; True Gap Side; Events", kTH1F, {{4, 0, 4}}); + histosQA.add("Events/selected/isCBTOk", "isCBTOk; bool; Events", kTH1F, {{4, 0, 4}}); + histosQA.add("Events/selected/isCBTHadronOk", "isCBTHadronOk; bool; Events", kTH1F, {{4, 0, 4}}); + histosQA.add("Events/selected/isCBTZdcOk", "isCBTZdcOk; bool; Events", kTH1F, {{4, 0, 4}}); + histosQA.add("Events/selected/isCBTHadronZdcOk", "isCBTHadronZdcOk; bool; Events", kTH1F, {{4, 0, 4}}); + histosQA.add("Events/selected/FT0A", "T0A amplitude", kTH1F, {{500, 0.0, 500.0}}); + histosQA.add("Events/selected/FT0C", "T0C amplitude", kTH1F, {{500, 0.0, 500.0}}); + histosQA.add("Events/selected/FV0A", "V0A amplitude", kTH1F, {{100, 0.0, 100}}); + histosQA.add("Events/selected/ZDC_A", "ZDC amplitude", kTH1F, {{10000, 0.0, 10000}}); + histosQA.add("Events/selected/ZDC_C", "ZDC amplitude", kTH1F, {{10000, 0.0, 10000}}); + histosQA.add("Events/selected/FDDA", "FDD A signal; FDD A signal; Counts", kTH1F, {{500, 0.0, 2000}}); + histosQA.add("Events/selected/FDDC", "FDD C signal; FDD C signal; Counts", kTH1F, {{500, 0.0, 2000}}); + histosQA.add("Events/selected/vertexX", "Vertex X; Vertex X [cm]; Counts", kTH1F, {{2000, -0.05, 0.05}}); + histosQA.add("Events/selected/vertexY", "Vertex Y; Vertex Y [cm]; Counts", kTH1F, {{2000, -0.05, 0.05}}); + histosQA.add("Events/selected/vertexZ", "Vertex Z; Vertex Z [cm]; Counts", kTH1F, {{2000, -15, 15}}); + histosQA.add("Events/selected/occupancy", "Occupancy; Occupancy; Counts", kTH1F, {{20000, 0, 20000}}); + // QA plots: event selection-4 pion events + histosQA.add("Events/4pion/UPCmode", "UPC mode; Events", kTH1F, {{5, 0, 5}}); + histosQA.add("Events/4pion/GapSide", "Gap Side;Gap Side; Events", kTH1F, {{4, 0, 4}}); + histosQA.add("Events/4pion/TrueGapSide", "True Gap Side; True Gap Side; Events", kTH1F, {{4, 0, 4}}); + histosQA.add("Events/4pion/isCBTOk", "isCBTOk; bool; Events", kTH1F, {{4, 0, 4}}); + histosQA.add("Events/4pion/isCBTHadronOk", "isCBTHadronOk; bool; Events", kTH1F, {{4, 0, 4}}); + histosQA.add("Events/4pion/isCBTZdcOk", "isCBTZdcOk; bool; Events", kTH1F, {{4, 0, 4}}); + histosQA.add("Events/4pion/isCBTHadronZdcOk", "isCBTHadronZdcOk; bool; Events", kTH1F, {{4, 0, 4}}); + histosQA.add("Events/4pion/FT0A", "T0A amplitude", kTH1F, {{500, 0.0, 500.0}}); + histosQA.add("Events/4pion/FT0C", "T0C amplitude", kTH1F, {{500, 0.0, 500.0}}); + histosQA.add("Events/4pion/FV0A", "V0A amplitude", kTH1F, {{100, 0.0, 100}}); + histosQA.add("Events/4pion/ZDC_A", "ZDC amplitude", kTH1F, {{10000, 0.0, 10000}}); + histosQA.add("Events/4pion/ZDC_C", "ZDC amplitude", kTH1F, {{10000, 0.0, 10000}}); + histosQA.add("Events/4pion/FDDA", "FDD A signal; FDD A signal; Counts", kTH1F, {{500, 0.0, 2000}}); + histosQA.add("Events/4pion/FDDC", "FDD C signal; FDD C signal; Counts", kTH1F, {{500, 0.0, 2000}}); + histosQA.add("Events/4pion/vertexX", "Vertex X; Vertex X [cm]; Counts", kTH1F, {{2000, -0.05, 0.05}}); + histosQA.add("Events/4pion/vertexY", "Vertex Y; Vertex Y [cm]; Counts", kTH1F, {{2000, -0.05, 0.05}}); + histosQA.add("Events/4pion/vertexZ", "Vertex Z; Vertex Z [cm]; Counts", kTH1F, {{2000, -15, 15}}); + histosQA.add("Events/4pion/occupancy", "Occupancy; Occupancy; Counts", kTH1F, {{20000, 0, 20000}}); + // QA plots: All tracks in selected events + histosQA.add("Tracks/all/dcaXY", "dcaXY; dcaXY [cm]; Counts", kTH1F, {{2000, -0.1, 0.1}}); + histosQA.add("Tracks/all/dcaZ", "dcaZ; dcaZ [cm]; Counts", kTH1F, {{2000, -0.1, 0.1}}); + histosQA.add("Tracks/all/itsChi2NCl", "ITS Chi2/NCl; Chi2/NCl; Counts", kTH1F, {{250, 0, 50}}); + histosQA.add("Tracks/all/itsChi2", "ITS Chi2; ITS Chi2; Counts", kTH1F, {{500, 0, 50}}); + histosQA.add("Tracks/all/tpcChi2NCl", "TPC Chi2/NCl; Chi2/NCl; Counts", kTH1F, {{250, 0, 50}}); + histosQA.add("Tracks/all/tpcNClsFindable", "TPC N Cls Findable; N Cls Findable; Counts", kTH1F, {{200, 0, 200}}); + // QA plots: Selected tracks in selected events + histosQA.add("Tracks/selected/dcaXY", "dcaXY; dcaXY [cm]; Counts", kTH1F, {{2000, -0.1, 0.1}}); + histosQA.add("Tracks/selected/dcaZ", "dcaZ; dcaZ [cm]; Counts", kTH1F, {{2000, -0.1, 0.1}}); + histosQA.add("Tracks/selected/itsChi2NCl", "ITS Chi2/NCl; Chi2/NCl; Counts", kTH1F, {{250, 0, 50}}); + histosQA.add("Tracks/selected/itsChi2", "ITS Chi2; ITS Chi2; Counts", kTH1F, {{500, 0, 50}}); + histosQA.add("Tracks/selected/tpcChi2NCl", "TPC Chi2/NCl; Chi2/NCl; Counts", kTH1F, {{250, 0, 50}}); + histosQA.add("Tracks/selected/tpcNClsFindable", "TPC N Cls Findable; N Cls Findable; Counts", kTH1F, {{200, 0, 200}}); + // QA plots: Pion tracks in selected events + histosQA.add("Tracks/pions/dcaXY", "dcaXY; dcaXY [cm]; Counts", kTH1F, {{2000, -0.1, 0.1}}); + histosQA.add("Tracks/pions/dcaZ", "dcaZ; dcaZ [cm]; Counts", kTH1F, {{2000, -0.1, 0.1}}); + histosQA.add("Tracks/pions/itsChi2NCl", "ITS Chi2/NCl; Chi2/NCl; Counts", kTH1F, {{250, 0, 50}}); + histosQA.add("Tracks/pions/itsChi2", "ITS Chi2; ITS Chi2; Counts", kTH1F, {{500, 0, 50}}); + histosQA.add("Tracks/pions/tpcChi2NCl", "TPC Chi2/NCl; Chi2/NCl; Counts", kTH1F, {{250, 0, 50}}); + histosQA.add("Tracks/pions/tpcNClsFindable", "TPC N Cls Findable; N Cls Findable; Counts", kTH1F, {{200, 0, 200}}); + // QA plots: Pion tracks from 4pi in selected events + histosQA.add("Tracks/pions-from-4pi/dcaXY", "dcaXY; dcaXY [cm]; Counts", kTH1F, {{2000, -0.1, 0.1}}); + histosQA.add("Tracks/pions-from-4pi/dcaZ", "dcaZ; dcaZ [cm]; Counts", kTH1F, {{2000, -0.1, 0.1}}); + histosQA.add("Tracks/pions-from-4pi/itsChi2NCl", "ITS Chi2/NCl; Chi2/NCl; Counts", kTH1F, {{250, 0, 50}}); + histosQA.add("Tracks/pions-from-4pi/itsChi2", "ITS Chi2; ITS Chi2; Counts", kTH1F, {{500, 0, 50}}); + histosQA.add("Tracks/pions-from-4pi/tpcChi2NCl", "TPC Chi2/NCl; Chi2/NCl; Counts", kTH1F, {{250, 0, 50}}); + histosQA.add("Tracks/pions-from-4pi/tpcNClsFindable", "TPC N Cls Findable; N Cls Findable; Counts", kTH1F, {{200, 0, 200}}); + // QA plots: PID- All tracks + histosPID.add("all/tpcSignal", "TPC dEdx vs p; p [GeV/c]; dEdx [a.u.]", kTH2F, {{500, 0, 10}, {5000, 0.0, 5000.0}}); + histosPID.add("all/tpcNSigmaPi", "TPC nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("all/tpcNSigmaKa", "TPC nSigma Kaon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("all/tpcNSigmaPr", "TPC nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("all/tpcNSigmaEl", "TPC nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("all/tpcNSigmaMu", "TPC nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("all/tofBeta", "TOF beta vs p; p [GeV/c]; #beta", kTH2F, {{500, 0, 10}, {500, 0.0, 1.0}}); + histosPID.add("all/tofNSigmaPi", "TOF nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("all/tofNSigmaKa", "TOF nSigma Kaon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("all/tofNSigmaPr", "TOF nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("all/tofNSigmaEl", "TOF nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("all/tofNSigmaMu", "TOF nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + // QA plots: PID- Selected tracks + histosPID.add("selected/tpcSignal", "TPC dEdx vs p; p [GeV/c]; dEdx [a.u.]", kTH2F, {{500, 0, 10}, {5000, 0.0, 5000.0}}); + histosPID.add("selected/tpcNSigmaPi", "TPC nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("selected/tpcNSigmaKa", "TPC nSigma Kaon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("selected/tpcNSigmaPr", "TPC nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("selected/tpcNSigmaEl", "TPC nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("selected/tpcNSigmaMu", "TPC nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("selected/tofBeta", "TOF beta vs p; p [GeV/c]; #beta", kTH2F, {{500, 0, 10}, {500, 0.0, 1.0}}); + histosPID.add("selected/tofNSigmaPi", "TOF nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("selected/tofNSigmaKa", "TOF nSigma Kaon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("selected/tofNSigmaPr", "TOF nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("selected/tofNSigmaEl", "TOF nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("selected/tofNSigmaMu", "TOF nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + // QA plots: PID- Pion tracks + histosPID.add("pions/tpcSignal", "TPC dEdx vs p; p [GeV/c]; dEdx [a.u.]", kTH2F, {{500, 0, 10}, {5000, 0.0, 5000.0}}); + histosPID.add("pions/tpcNSigmaPi", "TPC nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions/tpcNSigmaKa", "TPC nSigma Kaon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions/tpcNSigmaPr", "TPC nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions/tpcNSigmaEl", "TPC nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions/tpcNSigmaMu", "TPC nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions/tofBeta", "TOF beta vs p; p [GeV/c]; #beta", kTH2F, {{500, 0, 10}, {500, 0.0, 1.0}}); + histosPID.add("pions/tofNSigmaPi", "TOF nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions/tofNSigmaKa", "TOF nSigma Kaon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions/tofNSigmaPr", "TOF nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions/tofNSigmaEl", "TOF nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions/tofNSigmaMu", "TOF nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + // QA plots: PID- Pion tracks from 4pi events + histosPID.add("pions-from-4pi/tpcSignal", "TPC dEdx vs p; p [GeV/c]; dEdx [a.u.]", kTH2F, {{500, 0, 10}, {5000, 0.0, 5000.0}}); + histosPID.add("pions-from-4pi/tpcNSigmaPi", "TPC nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions-from-4pi/tpcNSigmaKa", "TPC nSigma Kaon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions-from-4pi/tpcNSigmaPr", "TPC nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions-from-4pi/tpcNSigmaEl", "TPC nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions-from-4pi/tpcNSigmaMu", "TPC nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions-from-4pi/tofBeta", "TOF beta vs p; p [GeV/c]; #beta", kTH2F, {{500, 0, 10}, {500, 0.0, 1.0}}); + histosPID.add("pions-from-4pi/tofNSigmaPi", "TOF nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions-from-4pi/tofNSigmaKa", "TOF nSigma Kaon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions-from-4pi/tofNSigmaPr", "TOF nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions-from-4pi/tofNSigmaEl", "TOF nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions-from-4pi/tofNSigmaMu", "TOF nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + // Kinematics for all particles + histosKin.add("all", ";pT [GeV/c]; #eta;#varphi", kTH3F, {pTAxis, etaAxis, phiAxis}); + histosKin.add("selected", ";pT [GeV/c]; #eta;#varphi", kTH3F, {pTAxis, etaAxis, phiAxis}); + histosKin.add("pions", ";pT [GeV/c]; #eta;#varphi", kTH3F, {pTAxis, etaAxis, phiAxis}); + histosKin.add("pions-from-4pi", ";pT [GeV/c]; #eta;#varphi;y ", kTHnSparseF, {pTAxis, etaAxis, phiAxis, rapidityAxis}); + // Rho Prime Kinematics + histos4piKin.add("two-pion-mass", ";m_{#pi^{+}#pi^{-}} [GeV/c^2];m_{#pi^{+}#pi^{-}} [GeV/c^2];m_{#pi^{+}#pi^{-}} [GeV/c^2];m_{#pi^{+}#pi^{-}} [GeV/c^2]", kTHnSparseF, {{100, 0, 2}, {100, 0, 2}, {100, 0, 2}, {100, 0, 2}}); + histos4piKin.add("zero-charge", ";pT [GeV/c]; #eta; #varphi [rad];y; m_{4#pi} [GeV/c^{2}]; Collin-Soper cos(#theta); Collin-Soper #varphi [rad];Run Number", kTHnSparseF, {pTAxis, etaAxis, phiAxis, rapidityAxis, invMassAxis, cosThetaAxis, phiAxis, {113, 0, 113}}); + histos4piKin.add("non-zero-charge", ";pT [GeV/c]; #eta; #varphi [rad];y; m_{4#pi} [GeV/c^{2}];Run Number", kTHnSparseF, {pTAxis, etaAxis, phiAxis, rapidityAxis, invMassAxis, {113, 0, 113}}); + //___________________________________________________________________________________________________________________________ + setHistBinLabels(); } // End of init function @@ -577,36 +259,31 @@ struct ExclusiveRhoTo4Pi { void processData(soa::Filtered::iterator const& collision, soa::Filtered const& tracks) { - // Check if the Event is reconstructed in UPC mode - if (collision.flags() != ifUPC) { - return; - } - - // RCT flag - if (!sgSelector.isCBTHadronZdcOk(collision)) { + // Check if the Event is reconstructed in UPC mode and RCT flag + if ((collision.flags() != ifUPC) || (!sgSelector.isCBTHadronOk(collision))) { return; } int runIndex = getRunNumberIndex(collision.runNumber()); - histosData.fill(HIST("GapSide"), collision.gapSide()); - histosData.fill(HIST("TrueGapSide"), sgSelector.trueGap(collision, fv0Cut, ft0aCut, ft0cCut, zdcCut)); - histosData.fill(HIST("isCBTOk"), sgSelector.isCBTOk(collision)); - histosData.fill(HIST("isCBTHadronOk"), sgSelector.isCBTHadronOk(collision)); - histosData.fill(HIST("isCBTZdcOk"), sgSelector.isCBTZdcOk(collision)); - histosData.fill(HIST("isCBTHadronZdcOk"), sgSelector.isCBTHadronZdcOk(collision)); - histosData.fill(HIST("vertexX"), collision.posX()); - histosData.fill(HIST("vertexY"), collision.posY()); - histosData.fill(HIST("vertexZ"), collision.posZ()); - histosData.fill(HIST("occupancy"), collision.occupancyInTime()); - histosData.fill(HIST("FV0A"), collision.totalFV0AmplitudeA()); - histosData.fill(HIST("FT0A"), collision.totalFT0AmplitudeA()); - histosData.fill(HIST("FT0C"), collision.totalFT0AmplitudeC()); - histosData.fill(HIST("ZDC_A"), collision.energyCommonZNA()); - histosData.fill(HIST("ZDC_C"), collision.energyCommonZNC()); - histosData.fill(HIST("FDDA"), collision.totalFDDAmplitudeA()); - histosData.fill(HIST("FDDC"), collision.totalFDDAmplitudeC()); - histosData.fill(HIST("UPCmode"), collision.flags()); + histosQA.fill(HIST("Events/selected/UPCmode"), collision.flags()); + histosQA.fill(HIST("Events/selected/GapSide"), collision.gapSide()); + histosQA.fill(HIST("Events/selected/TrueGapSide"), sgSelector.trueGap(collision, fv0Cut, ft0aCut, ft0cCut, zdcCut)); + histosQA.fill(HIST("Events/selected/isCBTOk"), sgSelector.isCBTOk(collision)); + histosQA.fill(HIST("Events/selected/isCBTHadronOk"), sgSelector.isCBTHadronOk(collision)); + histosQA.fill(HIST("Events/selected/isCBTZdcOk"), sgSelector.isCBTZdcOk(collision)); + histosQA.fill(HIST("Events/selected/isCBTHadronZdcOk"), sgSelector.isCBTHadronZdcOk(collision)); + histosQA.fill(HIST("Events/selected/vertexX"), collision.posX()); + histosQA.fill(HIST("Events/selected/vertexY"), collision.posY()); + histosQA.fill(HIST("Events/selected/vertexZ"), collision.posZ()); + histosQA.fill(HIST("Events/selected/occupancy"), collision.occupancyInTime()); + histosQA.fill(HIST("Events/selected/FV0A"), collision.totalFV0AmplitudeA()); + histosQA.fill(HIST("Events/selected/FT0A"), collision.totalFT0AmplitudeA()); + histosQA.fill(HIST("Events/selected/FT0C"), collision.totalFT0AmplitudeC()); + histosQA.fill(HIST("Events/selected/ZDC_A"), collision.energyCommonZNA()); + histosQA.fill(HIST("Events/selected/ZDC_C"), collision.energyCommonZNC()); + histosQA.fill(HIST("Events/selected/FDDA"), collision.totalFDDAmplitudeA()); + histosQA.fill(HIST("Events/selected/FDDC"), collision.totalFDDAmplitudeC()); std::vector selectedTracks; std::vector selectedPionTracks; @@ -614,12 +291,94 @@ struct ExclusiveRhoTo4Pi { std::vector selectedPionMinusTracks; for (const auto& t0 : tracks) { + + PxPyPzMVector tVector(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassPionCharged); + + // QA-Tracks before selection + histosQA.fill(HIST("Tracks/all/dcaXY"), t0.tpcChi2NCl()); + histosQA.fill(HIST("Tracks/all/dcaZ"), t0.tpcChi2NCl()); + histosQA.fill(HIST("Tracks/all/itsChi2NCl"), t0.itsChi2NCl()); + histosQA.fill(HIST("Tracks/all/itsChi2"), t0.itsChi2NCl() * t0.itsNCls()); + histosQA.fill(HIST("Tracks/all/tpcChi2NCl"), t0.tpcChi2NCl()); + histosQA.fill(HIST("Tracks/all/tpcNClsFindable"), t0.tpcNClsFindable()); + + // PID before track selection + histosPID.fill(HIST("all/tpcSignal"), tVector.P(), t0.tpcSignal()); + histosPID.fill(HIST("all/tpcNSigmaPi"), t0.tpcNSigmaPi(), tVector.Pt()); + histosPID.fill(HIST("all/tpcNSigmaKa"), t0.tpcNSigmaKa(), tVector.Pt()); + histosPID.fill(HIST("all/tpcNSigmaPr"), t0.tpcNSigmaPr(), tVector.Pt()); + histosPID.fill(HIST("all/tpcNSigmaEl"), t0.tpcNSigmaEl(), tVector.Pt()); + histosPID.fill(HIST("all/tpcNSigmaMu"), t0.tpcNSigmaMu(), tVector.Pt()); + histosPID.fill(HIST("all/tofBeta"), tVector.P(), t0.beta()); + histosPID.fill(HIST("all/tofNSigmaPi"), t0.tofNSigmaPi(), tVector.Pt()); + histosPID.fill(HIST("all/tofNSigmaKa"), t0.tofNSigmaKa(), tVector.Pt()); + histosPID.fill(HIST("all/tofNSigmaPr"), t0.tofNSigmaPr(), tVector.Pt()); + histosPID.fill(HIST("all/tofNSigmaEl"), t0.tofNSigmaEl(), tVector.Pt()); + histosPID.fill(HIST("all/tofNSigmaMu"), t0.tofNSigmaMu(), tVector.Pt()); + + // Kinematics for all particles before selection + histosKin.fill(HIST("all"), tVector.Pt(), tVector.Eta(), tVector.Phi()); + + // Selecting good tracks if (!isSelectedTrack(t0, pTcut, etaCut, dcaXYcut, dcaZcut, useITStracksOnly, useTPCtracksOnly, itsChi2NClsCut, tpcChi2NClsCut, tpcNClsFindableCut)) { continue; } + + // QA-Tracks after selection + histosQA.fill(HIST("Tracks/selected/dcaXY"), t0.dcaXY()); + histosQA.fill(HIST("Tracks/selected/dcaZ"), t0.dcaZ()); + histosQA.fill(HIST("Tracks/selected/itsChi2NCl"), t0.itsChi2NCl()); + histosQA.fill(HIST("Tracks/selected/itsChi2"), t0.itsChi2NCl() * t0.itsNCls()); + histosQA.fill(HIST("Tracks/selected/tpcChi2NCl"), t0.tpcChi2NCl()); + histosQA.fill(HIST("Tracks/selected/tpcNClsFindable"), t0.tpcNClsFindable()); + + // PID after track selection before selecting pions + histosPID.fill(HIST("selected/tpcSignal"), tVector.P(), t0.tpcSignal()); + histosPID.fill(HIST("selected/tpcNSigmaPi"), t0.tpcNSigmaPi(), tVector.Pt()); + histosPID.fill(HIST("selected/tpcNSigmaKa"), t0.tpcNSigmaKa(), tVector.Pt()); + histosPID.fill(HIST("selected/tpcNSigmaPr"), t0.tpcNSigmaPr(), tVector.Pt()); + histosPID.fill(HIST("selected/tpcNSigmaEl"), t0.tpcNSigmaEl(), tVector.Pt()); + histosPID.fill(HIST("selected/tpcNSigmaMu"), t0.tpcNSigmaMu(), tVector.Pt()); + histosPID.fill(HIST("selected/tofBeta"), tVector.P(), t0.beta()); + histosPID.fill(HIST("selected/tofNSigmaPi"), t0.tofNSigmaPi(), tVector.Pt()); + histosPID.fill(HIST("selected/tofNSigmaKa"), t0.tofNSigmaKa(), tVector.Pt()); + histosPID.fill(HIST("selected/tofNSigmaPr"), t0.tofNSigmaPr(), tVector.Pt()); + histosPID.fill(HIST("selected/tofNSigmaEl"), t0.tofNSigmaEl(), tVector.Pt()); + histosPID.fill(HIST("selected/tofNSigmaMu"), t0.tofNSigmaMu(), tVector.Pt()); + + // Kinematics for all particles after track selection before selecting pions + histosKin.fill(HIST("selected"), tVector.Pt(), tVector.Eta(), tVector.Phi()); + selectedTracks.push_back(t0); - if (selectionPIDPion(t0, useTOF, nSigmaTPCcut, nSigmaTOFcut)) { + if (ifPion(t0, useTOF, nSigmaTPCcut, nSigmaTOFcut)) { + selectedPionTracks.push_back(t0); + + // QA-Tracks after selecting pions + histosQA.fill(HIST("Tracks/pions/dcaXY"), t0.dcaXY()); + histosQA.fill(HIST("Tracks/pions/dcaZ"), t0.dcaZ()); + histosQA.fill(HIST("Tracks/pions/itsChi2NCl"), t0.itsChi2NCl()); + histosQA.fill(HIST("Tracks/pions/itsChi2"), t0.itsChi2NCl() * t0.itsNCls()); + histosQA.fill(HIST("Tracks/pions/tpcChi2NCl"), t0.tpcChi2NCl()); + histosQA.fill(HIST("Tracks/pions/tpcNClsFindable"), t0.tpcNClsFindable()); + + // PID after selecting pions + histosPID.fill(HIST("pions/tpcSignal"), tVector.P(), t0.tpcSignal()); + histosPID.fill(HIST("pions/tpcNSigmaPi"), t0.tpcNSigmaPi(), tVector.Pt()); + histosPID.fill(HIST("pions/tpcNSigmaKa"), t0.tpcNSigmaKa(), tVector.Pt()); + histosPID.fill(HIST("pions/tpcNSigmaPr"), t0.tpcNSigmaPr(), tVector.Pt()); + histosPID.fill(HIST("pions/tpcNSigmaEl"), t0.tpcNSigmaEl(), tVector.Pt()); + histosPID.fill(HIST("pions/tpcNSigmaMu"), t0.tpcNSigmaMu(), tVector.Pt()); + histosPID.fill(HIST("pions/tofBeta"), tVector.P(), t0.beta()); + histosPID.fill(HIST("pions/tofNSigmaPi"), t0.tofNSigmaPi(), tVector.Pt()); + histosPID.fill(HIST("pions/tofNSigmaKa"), t0.tofNSigmaKa(), tVector.Pt()); + histosPID.fill(HIST("pions/tofNSigmaPr"), t0.tofNSigmaPr(), tVector.Pt()); + histosPID.fill(HIST("pions/tofNSigmaEl"), t0.tofNSigmaEl(), tVector.Pt()); + histosPID.fill(HIST("pions/tofNSigmaMu"), t0.tofNSigmaMu(), tVector.Pt()); + + // Kinematics for pions + histosKin.fill(HIST("pions"), tVector.Pt(), tVector.Eta(), tVector.Phi()); + if (t0.sign() == 1) { selectedPionPlusTracks.push_back(t0); } @@ -629,391 +388,182 @@ struct ExclusiveRhoTo4Pi { } // End of Selection PID Pion } // End of loop over tracks - int numSelectedTracks = static_cast(selectedTracks.size()); int numSelectedPionTracks = static_cast(selectedPionTracks.size()); int numPiPlusTracks = static_cast(selectedPionPlusTracks.size()); int numPionMinusTracks = static_cast(selectedPionMinusTracks.size()); - for (int i = 0; i < numSelectedTracks; i++) { - PxPyPzMVector selectedTrackVector(selectedTracks[i].px(), selectedTracks[i].py(), selectedTracks[i].pz(), o2::constants::physics::MassPionCharged); - histosData.fill(HIST("pT_track_all"), selectedTrackVector.Pt()); - histosData.fill(HIST("eta_track_all"), selectedTrackVector.Eta()); - histosData.fill(HIST("phi_track_all"), selectedTrackVector.Phi()); - histosData.fill(HIST("rapidity_track_all"), selectedTrackVector.Rapidity()); - - histosData.fill(HIST("dcaXY_all"), selectedTracks[i].dcaXY()); - histosData.fill(HIST("dcaZ_all"), selectedTracks[i].dcaZ()); - - histosData.fill(HIST("itsChi2NCl_all"), selectedTracks[i].itsChi2NCl()); - histosData.fill(HIST("itsChi2_all"), selectedTracks[i].itsChi2NCl() * selectedTracks[i].itsNCls()); - histosData.fill(HIST("tpcChi2NCl_all"), selectedTracks[i].tpcChi2NCl()); - histosData.fill(HIST("tpcNClsFindable_all"), selectedTracks[i].tpcNClsFindable()); - - histosData.fill(HIST("tpcSignal_all"), selectedTrackVector.P(), selectedTracks[i].tpcSignal()); - histosData.fill(HIST("tpcNSigmaPi_all"), selectedTracks[i].tpcNSigmaPi(), selectedTrackVector.Pt()); - histosData.fill(HIST("tofBeta_all"), selectedTrackVector.P(), selectedTracks[i].beta()); - histosData.fill(HIST("tofNSigmaPi_all"), selectedTracks[i].tofNSigmaPi(), selectedTrackVector.Pt()); - } // End of loop over tracks with selection only - - for (int i = 0; i < numSelectedPionTracks; i++) { - PxPyPzMVector selectedPionTrackVector(selectedPionTracks[i].px(), selectedPionTracks[i].py(), selectedPionTracks[i].pz(), o2::constants::physics::MassPionCharged); - - histosData.fill(HIST("pT_track_pions"), selectedPionTrackVector.Pt()); - histosData.fill(HIST("eta_track_pions"), selectedPionTrackVector.Eta()); - histosData.fill(HIST("phi_track_pions"), selectedPionTrackVector.Phi()); - histosData.fill(HIST("rapidity_track_pions"), selectedPionTrackVector.Rapidity()); - - histosData.fill(HIST("dcaXY_pions"), selectedPionTracks[i].dcaXY()); - histosData.fill(HIST("dcaZ_pions"), selectedPionTracks[i].dcaZ()); - - histosData.fill(HIST("tpcSignal_pions"), selectedPionTrackVector.P(), selectedPionTracks[i].tpcSignal()); - histosData.fill(HIST("tpcNSigmaPi_pions"), selectedPionTracks[i].tpcNSigmaPi(), selectedPionTrackVector.Pt()); - histosData.fill(HIST("tpcNSigmaKa_pions"), selectedPionTracks[i].tpcNSigmaKa(), selectedPionTrackVector.Pt()); - histosData.fill(HIST("tpcNSigmaPr_pions"), selectedPionTracks[i].tpcNSigmaPr(), selectedPionTrackVector.Pt()); - histosData.fill(HIST("tpcNSigmaEl_pions"), selectedPionTracks[i].tpcNSigmaEl(), selectedPionTrackVector.Pt()); - histosData.fill(HIST("tpcNSigmaMu_pions"), selectedPionTracks[i].tpcNSigmaMu(), selectedPionTrackVector.Pt()); - - histosData.fill(HIST("tofBeta_pions"), selectedPionTrackVector.P(), selectedPionTracks[i].beta()); - histosData.fill(HIST("tofNSigmaPi_pions"), selectedPionTracks[i].tofNSigmaPi(), selectedPionTrackVector.Pt()); - histosData.fill(HIST("tofNSigmaKa_pions"), selectedPionTracks[i].tofNSigmaKa(), selectedPionTrackVector.Pt()); - histosData.fill(HIST("tofNSigmaPr_pions"), selectedPionTracks[i].tofNSigmaPr(), selectedPionTrackVector.Pt()); - histosData.fill(HIST("tofNSigmaEl_pions"), selectedPionTracks[i].tofNSigmaEl(), selectedPionTrackVector.Pt()); - histosData.fill(HIST("tofNSigmaMu_pions"), selectedPionTracks[i].tofNSigmaMu(), selectedPionTrackVector.Pt()); - } // End of loop over tracks with selection and PID of pions - // event should have exactly 4 pions if (numSelectedPionTracks != numFourPionTracks) { return; } - // Check if there is at least one track with TOF in the selected events (for derived Data) - bool hasAtleastOneTOF = false; - for (int i = 0; i < numPiPlusTracks; i++) { - if (selectedPionPlusTracks[i].hasTOF() == true) { - hasAtleastOneTOF = true; - break; - } - } - // Selecting Events with net charge = 0 if (numPionMinusTracks == numPiMinus && numPiPlusTracks == numPiPlus) { - PtEtaPhiMVector k1, k2, k3, k4, k1234, k13, k14, k23, k24; + // QA-Events-4pion + histosQA.fill(HIST("Events/4pion/UPCmode"), collision.flags()); + histosQA.fill(HIST("Events/4pion/GapSide"), collision.gapSide()); + histosQA.fill(HIST("Events/4pion/TrueGapSide"), sgSelector.trueGap(collision, fv0Cut, ft0aCut, ft0cCut, zdcCut)); + histosQA.fill(HIST("Events/4pion/isCBTOk"), sgSelector.isCBTOk(collision)); + histosQA.fill(HIST("Events/4pion/isCBTHadronOk"), sgSelector.isCBTHadronOk(collision)); + histosQA.fill(HIST("Events/4pion/isCBTZdcOk"), sgSelector.isCBTZdcOk(collision)); + histosQA.fill(HIST("Events/4pion/isCBTHadronZdcOk"), sgSelector.isCBTHadronZdcOk(collision)); + histosQA.fill(HIST("Events/4pion/vertexX"), collision.posX()); + histosQA.fill(HIST("Events/4pion/vertexY"), collision.posY()); + histosQA.fill(HIST("Events/4pion/vertexZ"), collision.posZ()); + histosQA.fill(HIST("Events/4pion/occupancy"), collision.occupancyInTime()); + histosQA.fill(HIST("Events/4pion/FV0A"), collision.totalFV0AmplitudeA()); + histosQA.fill(HIST("Events/4pion/FT0A"), collision.totalFT0AmplitudeA()); + histosQA.fill(HIST("Events/4pion/FT0C"), collision.totalFT0AmplitudeC()); + histosQA.fill(HIST("Events/4pion/ZDC_A"), collision.energyCommonZNA()); + histosQA.fill(HIST("Events/4pion/ZDC_C"), collision.energyCommonZNC()); + histosQA.fill(HIST("Events/4pion/FDDA"), collision.totalFDDAmplitudeA()); + histosQA.fill(HIST("Events/4pion/FDDC"), collision.totalFDDAmplitudeC()); + + for (int i = 0; i < numFourPionTracks; i++) { + PxPyPzMVector tVector(selectedPionTracks[i].px(), selectedPionTracks[i].py(), selectedPionTracks[i].pz(), o2::constants::physics::MassPionCharged); + // Tracks QA for all four pions + histosQA.fill(HIST("Tracks/pions-from-4pi/dcaXY"), selectedPionTracks[i].dcaXY()); + histosQA.fill(HIST("Tracks/pions-from-4pi/dcaZ"), selectedPionTracks[i].dcaZ()); + histosQA.fill(HIST("Tracks/pions-from-4pi/itsChi2NCl"), selectedPionTracks[i].itsChi2NCl()); + histosQA.fill(HIST("Tracks/pions-from-4pi/itsChi2"), selectedPionTracks[i].itsChi2NCl() * selectedPionTracks[i].itsNCls()); + histosQA.fill(HIST("Tracks/pions-from-4pi/tpcChi2NCl"), selectedPionTracks[i].tpcChi2NCl()); + histosQA.fill(HIST("Tracks/pions-from-4pi/tpcNClsFindable"), selectedPionTracks[i].tpcNClsFindable()); + // PID for all four pions + histosPID.fill(HIST("pions-from-4pi/tpcSignal"), tVector.P(), selectedPionTracks[i].tpcSignal()); + histosPID.fill(HIST("pions-from-4pi/tpcNSigmaPi"), selectedPionTracks[i].tpcNSigmaPi(), tVector.Pt()); + histosPID.fill(HIST("pions-from-4pi/tpcNSigmaKa"), selectedPionTracks[i].tpcNSigmaKa(), tVector.Pt()); + histosPID.fill(HIST("pions-from-4pi/tpcNSigmaPr"), selectedPionTracks[i].tpcNSigmaPr(), tVector.Pt()); + histosPID.fill(HIST("pions-from-4pi/tpcNSigmaEl"), selectedPionTracks[i].tpcNSigmaEl(), tVector.Pt()); + histosPID.fill(HIST("pions-from-4pi/tpcNSigmaMu"), selectedPionTracks[i].tpcNSigmaMu(), tVector.Pt()); + histosPID.fill(HIST("pions-from-4pi/tofBeta"), tVector.P(), selectedPionTracks[i].beta()); + histosPID.fill(HIST("pions-from-4pi/tofNSigmaPi"), selectedPionTracks[i].tofNSigmaPi(), tVector.Pt()); + histosPID.fill(HIST("pions-from-4pi/tofNSigmaKa"), selectedPionTracks[i].tofNSigmaKa(), tVector.Pt()); + histosPID.fill(HIST("pions-from-4pi/tofNSigmaPr"), selectedPionTracks[i].tofNSigmaPr(), tVector.Pt()); + histosPID.fill(HIST("pions-from-4pi/tofNSigmaEl"), selectedPionTracks[i].tofNSigmaEl(), tVector.Pt()); + histosPID.fill(HIST("pions-from-4pi/tofNSigmaMu"), selectedPionTracks[i].tofNSigmaMu(), tVector.Pt()); + } PxPyPzMVector p1(selectedPionPlusTracks[0].px(), selectedPionPlusTracks[0].py(), selectedPionPlusTracks[0].pz(), o2::constants::physics::MassPionCharged); PxPyPzMVector p2(selectedPionPlusTracks[1].px(), selectedPionPlusTracks[1].py(), selectedPionPlusTracks[1].pz(), o2::constants::physics::MassPionCharged); PxPyPzMVector p3(selectedPionMinusTracks[0].px(), selectedPionMinusTracks[0].py(), selectedPionMinusTracks[0].pz(), o2::constants::physics::MassPionCharged); PxPyPzMVector p4(selectedPionMinusTracks[1].px(), selectedPionMinusTracks[1].py(), selectedPionMinusTracks[1].pz(), o2::constants::physics::MassPionCharged); - histosData.fill(HIST("pT_track_pions_contributed"), p1.Pt()); - histosData.fill(HIST("pT_track_pions_contributed"), p2.Pt()); - histosData.fill(HIST("pT_track_pions_contributed"), p3.Pt()); - histosData.fill(HIST("pT_track_pions_contributed"), p4.Pt()); - - histosData.fill(HIST("eta_track_pions_contributed"), p1.Eta()); - histosData.fill(HIST("eta_track_pions_contributed"), p2.Eta()); - histosData.fill(HIST("eta_track_pions_contributed"), p3.Eta()); - histosData.fill(HIST("eta_track_pions_contributed"), p4.Eta()); - - histosData.fill(HIST("phi_track_pions_contributed"), p1.Phi()); - histosData.fill(HIST("phi_track_pions_contributed"), p2.Phi()); - histosData.fill(HIST("phi_track_pions_contributed"), p3.Phi()); - histosData.fill(HIST("phi_track_pions_contributed"), p4.Phi()); - - histosData.fill(HIST("rapidity_track_pions_contributed"), p1.Rapidity()); - histosData.fill(HIST("rapidity_track_pions_contributed"), p2.Rapidity()); - histosData.fill(HIST("rapidity_track_pions_contributed"), p3.Rapidity()); - histosData.fill(HIST("rapidity_track_pions_contributed"), p4.Rapidity()); - - k1.SetCoordinates(p1.Pt(), p1.Eta(), p1.Phi(), o2::constants::physics::MassPionCharged); - k2.SetCoordinates(p2.Pt(), p2.Eta(), p2.Phi(), o2::constants::physics::MassPionCharged); - k3.SetCoordinates(p3.Pt(), p3.Eta(), p3.Phi(), o2::constants::physics::MassPionCharged); - k4.SetCoordinates(p4.Pt(), p4.Eta(), p4.Phi(), o2::constants::physics::MassPionCharged); + // Kinematics for pions from 4 pion events + histosKin.fill(HIST("pions-from-4pi"), p1.Pt(), p1.Eta(), p1.Phi(), p1.Rapidity()); + histosKin.fill(HIST("pions-from-4pi"), p2.Pt(), p2.Eta(), p2.Phi(), p2.Rapidity()); + histosKin.fill(HIST("pions-from-4pi"), p3.Pt(), p3.Eta(), p3.Phi(), p3.Rapidity()); + histosKin.fill(HIST("pions-from-4pi"), p4.Pt(), p4.Eta(), p4.Phi(), p4.Rapidity()); PxPyPzMVector p1234 = p1 + p2 + p3 + p4; - k1234 = k1 + k2 + k3 + k4; - - k13 = k1 + k3; - k14 = k1 + k4; - k23 = k2 + k3; - k24 = k2 + k4; - - histosData.fill(HIST("fourpion_pT_0_charge"), p1234.Pt()); - histosData.fill(HIST("fourpion_eta_0_charge"), p1234.Eta()); - histosData.fill(HIST("fourpion_phi_0_charge"), p1234.Phi()); - histosData.fill(HIST("fourpion_rap_0_charge"), p1234.Rapidity()); - histosData.fill(HIST("fourpion_mass_0_charge"), p1234.M()); - - double fourPiPhiPair1 = collinSoperPhi(k13, k1234); - double fourPiPhiPair2 = collinSoperPhi(k14, k1234); - double fourPiPhiPair3 = collinSoperPhi(k23, k1234); - double fourPiPhiPair4 = collinSoperPhi(k24, k1234); - double fourPiCosThetaPair1 = collinSoperCosTheta(k13, k1234); - double fourPiCosThetaPair2 = collinSoperCosTheta(k14, k1234); - double fourPiCosThetaPair3 = collinSoperCosTheta(k23, k1234); - double fourPiCosThetaPair4 = collinSoperCosTheta(k24, k1234); - - sigFromData( - // run number - collision.runNumber(), - // UPC mode - collision.flags(), - // vertex - collision.posX(), collision.posY(), collision.posZ(), - // FIT Signals - collision.totalFV0AmplitudeA(), collision.totalFT0AmplitudeA(), collision.totalFT0AmplitudeC(), collision.totalFDDAmplitudeA(), collision.totalFDDAmplitudeC(), - // FIT and ZDC Signals - collision.timeFV0A(), collision.timeFT0A(), collision.timeFT0C(), collision.timeFDDA(), collision.timeFDDC(), collision.timeZNA(), collision.timeZNC(), - // Occupancy - collision.occupancyInTime(), - // has atleast one TOF - hasAtleastOneTOF, - // DCA XY and Z - selectedPionPlusTracks[0].dcaXY(), selectedPionPlusTracks[1].dcaXY(), selectedPionMinusTracks[0].dcaXY(), selectedPionMinusTracks[1].dcaXY(), - selectedPionPlusTracks[0].dcaZ(), selectedPionPlusTracks[1].dcaZ(), selectedPionMinusTracks[0].dcaZ(), selectedPionMinusTracks[1].dcaZ(), - // TPC N Sigma Pi - selectedPionPlusTracks[0].tpcNSigmaPi(), selectedPionPlusTracks[1].tpcNSigmaPi(), selectedPionMinusTracks[0].tpcNSigmaPi(), selectedPionMinusTracks[1].tpcNSigmaPi(), - // TPC N Sigma Ka - selectedPionPlusTracks[0].tpcNSigmaKa(), selectedPionPlusTracks[1].tpcNSigmaKa(), selectedPionMinusTracks[0].tpcNSigmaKa(), selectedPionMinusTracks[1].tpcNSigmaKa(), - // TPC N Sigma Pr - selectedPionPlusTracks[0].tpcNSigmaPr(), selectedPionPlusTracks[1].tpcNSigmaPr(), selectedPionMinusTracks[0].tpcNSigmaPr(), selectedPionMinusTracks[1].tpcNSigmaPr(), - // TPC N Sigma El - selectedPionPlusTracks[0].tpcNSigmaEl(), selectedPionPlusTracks[1].tpcNSigmaEl(), selectedPionMinusTracks[0].tpcNSigmaEl(), selectedPionMinusTracks[1].tpcNSigmaEl(), - // TPC N Sigma Mu - selectedPionPlusTracks[0].tpcNSigmaMu(), selectedPionPlusTracks[1].tpcNSigmaMu(), selectedPionMinusTracks[0].tpcNSigmaMu(), selectedPionMinusTracks[1].tpcNSigmaMu(), - // tpc Chi2 NCl - selectedPionPlusTracks[0].tpcChi2NCl(), selectedPionPlusTracks[1].tpcChi2NCl(), selectedPionMinusTracks[0].tpcChi2NCl(), selectedPionMinusTracks[1].tpcChi2NCl(), - // TPC NCls Findable - selectedPionPlusTracks[0].tpcNClsFindable(), selectedPionPlusTracks[1].tpcNClsFindable(), selectedPionMinusTracks[0].tpcNClsFindable(), selectedPionMinusTracks[1].tpcNClsFindable(), - // ITS Chi2 NCl - selectedPionPlusTracks[0].itsChi2NCl(), selectedPionPlusTracks[1].itsChi2NCl(), selectedPionMinusTracks[0].itsChi2NCl(), selectedPionMinusTracks[1].itsChi2NCl(), - // Pion Pt - p1.Pt(), p2.Pt(), p3.Pt(), p4.Pt(), - // Pion Eta - p1.Eta(), p2.Eta(), p3.Eta(), p4.Eta(), - // Pion Phi - p1.Phi(), p2.Phi(), p3.Phi(), p4.Phi(), - // Pion Rapidity - p1.Rapidity(), p2.Rapidity(), p3.Rapidity(), p4.Rapidity(), - // Four Pt - p1234.Pt(), - // Four Eta - p1234.Eta(), - // Four Phi - p1234.Phi(), - // Four Rapidity - p1234.Rapidity(), - // Four Mass - p1234.M(), - // Four Collins Soper Phi and CosTheta - fourPiPhiPair1, fourPiPhiPair2, fourPiPhiPair3, fourPiPhiPair4, - fourPiCosThetaPair1, fourPiCosThetaPair2, fourPiCosThetaPair3, fourPiCosThetaPair4); - - histosCounter.fill(HIST("fourPionCounts_0c"), runIndex); - - if (rhoMassMin < p1234.M() && p1234.M() < rhoMassMax) { - histosCounter.fill(HIST("fourPionCounts_0c_within_mass"), runIndex); + PxPyPzMVector p13 = p1 + p3; + PxPyPzMVector p14 = p1 + p4; + PxPyPzMVector p23 = p2 + p3; + PxPyPzMVector p24 = p2 + p4; + + // Two Pion Mass combinations + histos4piKin.fill(HIST("two-pion-mass"), p13.M(), p14.M(), p23.M(), p24.M()); + + double fourPiPhiPair1 = collinSoperPhi(p13, p1234); + double fourPiPhiPair2 = collinSoperPhi(p14, p1234); + double fourPiPhiPair3 = collinSoperPhi(p23, p1234); + double fourPiPhiPair4 = collinSoperPhi(p24, p1234); + + double fourPiCosThetaPair1 = collinSoperCosTheta(p13, p1234); + double fourPiCosThetaPair2 = collinSoperCosTheta(p14, p1234); + double fourPiCosThetaPair3 = collinSoperCosTheta(p23, p1234); + double fourPiCosThetaPair4 = collinSoperCosTheta(p24, p1234); + + double mDiff13 = std::abs((p13.M() - mRho0)); + double mDiff14 = std::abs((p14.M() - mRho0)); + double mDiff23 = std::abs((p23.M() - mRho0)); + double mDiff24 = std::abs((p24.M() - mRho0)); + if ((mDiff13 < mDiff14) && (mDiff13 < mDiff23) && (mDiff13 < mDiff24)) { + histos4piKin.fill(HIST("zero-charge"), p1234.Pt(), p1234.Eta(), p1234.Phi(), p1234.Rapidity(), p1234.M(), fourPiCosThetaPair1, fourPiPhiPair1, runIndex); + } else if ((mDiff14 < mDiff13) && (mDiff14 < mDiff23) && (mDiff14 < mDiff24)) { + histos4piKin.fill(HIST("zero-charge"), p1234.Pt(), p1234.Eta(), p1234.Phi(), p1234.Rapidity(), p1234.M(), fourPiCosThetaPair2, fourPiPhiPair2, runIndex); + } else if ((mDiff23 < mDiff13) && (mDiff23 < mDiff14) && (mDiff23 < mDiff24)) { + histos4piKin.fill(HIST("zero-charge"), p1234.Pt(), p1234.Eta(), p1234.Phi(), p1234.Rapidity(), p1234.M(), fourPiCosThetaPair3, fourPiPhiPair3, runIndex); + } else if ((mDiff24 < mDiff13) && (mDiff24 < mDiff14) && (mDiff24 < mDiff23)) { + histos4piKin.fill(HIST("zero-charge"), p1234.Pt(), p1234.Eta(), p1234.Phi(), p1234.Rapidity(), p1234.M(), fourPiCosThetaPair4, fourPiPhiPair4, runIndex); } - - if (std::fabs(p1234.Rapidity()) < rhoRapCut) { - histosData.fill(HIST("fourpion_pT_0_charge_within_rap"), p1234.Pt()); - histosData.fill(HIST("fourpion_eta_0_charge_within_rap"), p1234.Eta()); - histosData.fill(HIST("fourpion_phi_0_charge_within_rap"), p1234.Phi()); - histosData.fill(HIST("fourpion_rap_0_charge_within_rap"), p1234.Rapidity()); - histosData.fill(HIST("fourpion_mass_0_charge_within_rap"), p1234.M()); - histosCounter.fill(HIST("fourPionCounts_0c_within_rap"), runIndex); - if (p1234.Pt() < rhoPtCut) { - if (rhoMassMin < p1234.M() && p1234.M() < rhoMassMax) { - // Selected Four Pion Events - histosCounter.fill(HIST("fourPionCounts_0c_selected"), runIndex); - // Fill the Invariant Mass Histogram - histosData.fill(HIST("fourpion_mass_0_charge_domA"), p1234.M()); - // Two Pion Masses - histosData.fill(HIST("twopion_mass_1"), (p1 + p3).M()); - histosData.fill(HIST("twopion_mass_2"), (p1 + p4).M()); - histosData.fill(HIST("twopion_mass_3"), (p2 + p3).M()); - histosData.fill(HIST("twopion_mass_4"), (p2 + p4).M()); - // Fill the Collins-Soper Frame histograms - double mDiff13 = std::abs((k13.M() - mRho0)); - double mDiff14 = std::abs((k14.M() - mRho0)); - double mDiff23 = std::abs((k23.M() - mRho0)); - double mDiff24 = std::abs((k24.M() - mRho0)); - if ((mDiff13 < mDiff14) && (mDiff13 < mDiff23) && (mDiff13 < mDiff24)) { - histosData.fill(HIST("CSphi_vs_CScosTheta"), fourPiPhiPair1, fourPiCosThetaPair1); - } else if ((mDiff14 < mDiff13) && (mDiff14 < mDiff23) && (mDiff14 < mDiff24)) { - histosData.fill(HIST("CSphi_vs_CScosTheta"), fourPiPhiPair2, fourPiCosThetaPair2); - } else if ((mDiff23 < mDiff13) && (mDiff23 < mDiff14) && (mDiff23 < mDiff24)) { - histosData.fill(HIST("CSphi_vs_CScosTheta"), fourPiPhiPair3, fourPiCosThetaPair3); - } else if ((mDiff24 < mDiff13) && (mDiff24 < mDiff14) && (mDiff24 < mDiff23)) { - histosData.fill(HIST("CSphi_vs_CScosTheta"), fourPiPhiPair4, fourPiCosThetaPair4); - } - } // End of Pt selection for rho mass - } // End of Pt selection for rho mass - if (p1234.Pt() > rhoPtCut && p1234.Pt() < zeroPointEight) { - histosData.fill(HIST("fourpion_mass_0_charge_domB"), p1234.M()); - } - if (p1234.Pt() > zeroPointEight) { - histosData.fill(HIST("fourpion_mass_0_charge_domC"), p1234.M()); - } - } // End of Rapidity range selection } // End of Analysis for 0 charge events // Selecting Events with net charge != 0 for estimation of background if (numPionMinusTracks != numPiMinus && numPiPlusTracks != numPiPlus) { - PxPyPzMVector p1(selectedPionTracks[0].px(), selectedPionTracks[0].py(), selectedPionTracks[0].pz(), o2::constants::physics::MassPionCharged); PxPyPzMVector p2(selectedPionTracks[1].px(), selectedPionTracks[1].py(), selectedPionTracks[1].pz(), o2::constants::physics::MassPionCharged); PxPyPzMVector p3(selectedPionTracks[2].px(), selectedPionTracks[2].py(), selectedPionTracks[2].pz(), o2::constants::physics::MassPionCharged); PxPyPzMVector p4(selectedPionTracks[3].px(), selectedPionTracks[3].py(), selectedPionTracks[3].pz(), o2::constants::physics::MassPionCharged); PxPyPzMVector p1234 = p1 + p2 + p3 + p4; - - histosData.fill(HIST("fourpion_pT_non_0_charge"), p1234.Pt()); - histosData.fill(HIST("fourpion_eta_non_0_charge"), p1234.Eta()); - histosData.fill(HIST("fourpion_phi_non_0_charge"), p1234.Phi()); - histosData.fill(HIST("fourpion_rap_non_0_charge"), p1234.Rapidity()); - histosData.fill(HIST("fourpion_mass_non_0_charge"), p1234.M()); - - bkgFromData( - // Run Number - collision.runNumber(), - // UPC mode - collision.flags(), - // vertex - collision.posX(), collision.posY(), collision.posZ(), - // FIT Signals - collision.totalFV0AmplitudeA(), collision.totalFT0AmplitudeA(), collision.totalFT0AmplitudeC(), collision.totalFDDAmplitudeA(), collision.totalFDDAmplitudeC(), - // FIT and ZDC Signals - collision.timeFV0A(), collision.timeFT0A(), collision.timeFT0C(), collision.timeFDDA(), collision.timeFDDC(), collision.timeZNA(), collision.timeZNC(), - // Occupancy - collision.occupancyInTime(), - // has atleast one TOF - hasAtleastOneTOF, - // DCA XY and Z - selectedPionTracks[0].dcaXY(), selectedPionTracks[1].dcaXY(), selectedPionTracks[2].dcaXY(), selectedPionTracks[3].dcaXY(), - selectedPionTracks[0].dcaZ(), selectedPionTracks[1].dcaZ(), selectedPionTracks[2].dcaZ(), selectedPionTracks[3].dcaZ(), - // TPC N Sigma Pi - selectedPionTracks[0].tpcNSigmaPi(), selectedPionTracks[1].tpcNSigmaPi(), selectedPionTracks[2].tpcNSigmaPi(), selectedPionTracks[3].tpcNSigmaPi(), - // TPC N Sigma Ka - selectedPionTracks[0].tpcNSigmaKa(), selectedPionTracks[1].tpcNSigmaKa(), selectedPionTracks[2].tpcNSigmaKa(), selectedPionTracks[3].tpcNSigmaKa(), - // TPC N Sigma Pr - selectedPionTracks[0].tpcNSigmaPr(), selectedPionTracks[1].tpcNSigmaPr(), selectedPionTracks[2].tpcNSigmaPr(), selectedPionTracks[3].tpcNSigmaPr(), - // TPC N Sigma El - selectedPionTracks[0].tpcNSigmaEl(), selectedPionTracks[1].tpcNSigmaEl(), selectedPionTracks[2].tpcNSigmaEl(), selectedPionTracks[3].tpcNSigmaEl(), - // TPC N Sigma Mu - selectedPionTracks[0].tpcNSigmaMu(), selectedPionTracks[1].tpcNSigmaMu(), selectedPionTracks[2].tpcNSigmaMu(), selectedPionTracks[3].tpcNSigmaMu(), - // tpc Chi2 NCl - selectedPionTracks[0].tpcChi2NCl(), selectedPionTracks[1].tpcChi2NCl(), selectedPionTracks[2].tpcChi2NCl(), selectedPionTracks[3].tpcChi2NCl(), - // TPC NCls Findable - selectedPionTracks[0].tpcNClsFindable(), selectedPionTracks[1].tpcNClsFindable(), selectedPionTracks[2].tpcNClsFindable(), selectedPionTracks[3].tpcNClsFindable(), - // ITS Chi2 NCl - selectedPionTracks[0].itsChi2NCl(), selectedPionTracks[1].itsChi2NCl(), selectedPionTracks[2].itsChi2NCl(), selectedPionTracks[3].itsChi2NCl(), - // Pion Pt - p1.Pt(), p2.Pt(), p3.Pt(), p4.Pt(), - // Pion Eta - p1.Eta(), p2.Eta(), p3.Eta(), p4.Eta(), - // Pion Phi - p1.Phi(), p2.Phi(), p3.Phi(), p4.Phi(), - // Pion Rapidity - p1.Rapidity(), p2.Rapidity(), p3.Rapidity(), p4.Rapidity(), - // Four Pt - p1234.Pt(), - // Four Eta - p1234.Eta(), - // Four Phi - p1234.Phi(), - // Four Rapidity - p1234.Rapidity(), - // Four Mass - p1234.M()); - - histosCounter.fill(HIST("fourPionCounts_n0c"), runIndex); - if (rhoMassMin < p1234.M() && p1234.M() < rhoMassMax) { - histosCounter.fill(HIST("fourPionCounts_n0c_within_mass"), runIndex); - } - if (std::fabs(p1234.Rapidity()) < rhoRapCut) { - histosData.fill(HIST("fourpion_pT_non_0_charge_within_rap"), p1234.Pt()); - histosData.fill(HIST("fourpion_eta_non_0_charge_within_rap"), p1234.Eta()); - histosData.fill(HIST("fourpion_phi_non_0_charge_within_rap"), p1234.Phi()); - histosData.fill(HIST("fourpion_rap_non_0_charge_within_rap"), p1234.Rapidity()); - histosData.fill(HIST("fourpion_mass_non_0_charge_within_rap"), p1234.M()); - histosCounter.fill(HIST("fourPionCounts_n0c_within_rap"), runIndex); - if (p1234.Pt() < rhoPtCut) { - histosData.fill(HIST("fourpion_mass_non_0_charge_domA"), p1234.M()); - histosCounter.fill(HIST("fourPionCounts_n0c_selected"), runIndex); - } - if (p1234.Pt() > rhoPtCut && p1234.Pt() < zeroPointEight) { - histosData.fill(HIST("fourpion_mass_non_0_charge_domB"), p1234.M()); - } - if (p1234.Pt() > zeroPointEight) { - histosData.fill(HIST("fourpion_mass_non_0_charge_domC"), p1234.M()); - } - } // End of Rapidity range selection + // Kinematics for 4 pion system from non 0 charge events + histos4piKin.fill(HIST("non-zero-charge"), p1234.Pt(), p1234.Eta(), p1234.Phi(), p1234.Rapidity(), p1234.M(), runIndex); } // End of Analysis for non 0 charge events } // End of 4 Pion Analysis Process function for Pass5 Data void processEventCounter(UDCollisions::iterator const& collision) { - histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 0); + histosDataCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 0); // RCT flag if (!sgSelector.isCBTHadronZdcOk(collision)) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 1); + histosDataCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 1); // UPC mode if (collision.flags() != ifUPC) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 2); + histosDataCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 2); // vtxITSTPC if (collision.vtxITSTPC() != vtxITSTPCcut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 3); + histosDataCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 3); // sbp if (collision.sbp() != sbpCut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 4); + histosDataCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 4); // itsROFb if (collision.itsROFb() != itsROFbCut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 5); + histosDataCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 5); // tfb if (collision.tfb() != tfbCut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 6); + histosDataCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 6); // FT0A if (collision.totalFT0AmplitudeA() > ft0aCut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 7); + histosDataCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 7); // FT0C if (collision.totalFT0AmplitudeC() > ft0cCut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 8); + histosDataCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 8); // FV0A if (collision.totalFV0AmplitudeA() > fv0Cut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 9); + histosDataCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 9); // ZDC if (collision.energyCommonZNA() > zdcCut || collision.energyCommonZNC() > zdcCut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 10); + histosDataCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 10); // numContributors if (collision.numContrib() != numPVContrib) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 11); + histosDataCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 11); // vertexZ if (std::abs(collision.posZ()) > vZCut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 12); + histosDataCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 12); } // End of processCounter function void processTrackCounter(soa::Filtered::iterator const& collision, UDtracks const& tracks) @@ -1024,28 +574,28 @@ struct ExclusiveRhoTo4Pi { return; } for (const auto& track : tracks) { - histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 0); + histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 0); PxPyPzMVector trackVector(track.px(), track.py(), track.pz(), o2::constants::physics::MassPionCharged); // is PV contributor if (track.isPVContributor() != useOnlyPVtracks) { continue; } - histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 1); + histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 1); // pt cut if (trackVector.Pt() < pTcut) { continue; } - histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 2); + histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 2); // eta cut if (std::abs(trackVector.Eta()) > etaCut) { continue; } - histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 3); + histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 3); // DCA Z cut if (std::abs(track.dcaZ()) > dcaZcut) { continue; } - histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 4); + histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 4); // DCA XY cut float maxDCAxy = 0.0105 + 0.035 / std::pow(trackVector.Pt(), 1.1); if (dcaXYcut == 0 && (std::fabs(track.dcaXY()) > maxDCAxy)) { @@ -1053,50 +603,306 @@ struct ExclusiveRhoTo4Pi { } else if (dcaXYcut != 0 && (std::fabs(track.dcaXY()) > dcaXYcut)) { continue; } - histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 5); + histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 5); // ITS Track only if (useITStracksOnly && !track.hasITS()) { continue; } - histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 6); + histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 6); // TPC Track only if (useTPCtracksOnly && !track.hasTPC()) { continue; } - histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 7); + histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 7); // ITS Chi2 N Clusters cut if (track.hasITS() && track.itsChi2NCl() > itsChi2NClsCut) { continue; } - histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 8); + histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 8); // TPC Chi2 N Clusters cut if (track.hasTPC() && track.tpcChi2NCl() > tpcChi2NClsCut) { continue; } - histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 9); + histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 9); // TPC N Clusters Findable cut if (track.hasTPC() && track.tpcNClsFindable() < tpcNClsFindableCut) { continue; } - histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 10); + histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 10); // Selection PID Pion - if (selectionPIDPion(track, useTOF, nSigmaTPCcut, nSigmaTOFcut)) { - histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 11); + if (ifPion(track, useTOF, nSigmaTPCcut, nSigmaTOFcut)) { + histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 11); if (track.sign() == 1) { - histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 12); + histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 12); } if (track.sign() == -1) { - histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 13); + histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 13); } } // End of Selection PID Pion } // End of loop over tracks } // End of processCounter function + using MCtracks = soa::Join; + using MCCollisions = soa::Join; + + void processMCrec(soa::Filtered::iterator const& collision, soa::Filtered const& tracks) + { + + if (collision.has_udMcCollision()) { + return; + } + + // Check if the Event is reconstructed in UPC mode and RCT flag + if ((collision.flags() != ifUPC) || (!sgSelector.isCBTHadronOk(collision))) { + return; + } + + int runIndex = getRunNumberIndex(collision.runNumber()); + + histosQA.fill(HIST("Events/selected/UPCmode"), collision.flags()); + histosQA.fill(HIST("Events/selected/GapSide"), collision.gapSide()); + histosQA.fill(HIST("Events/selected/TrueGapSide"), sgSelector.trueGap(collision, fv0Cut, ft0aCut, ft0cCut, zdcCut)); + histosQA.fill(HIST("Events/selected/isCBTOk"), sgSelector.isCBTOk(collision)); + histosQA.fill(HIST("Events/selected/isCBTHadronOk"), sgSelector.isCBTHadronOk(collision)); + histosQA.fill(HIST("Events/selected/isCBTZdcOk"), sgSelector.isCBTZdcOk(collision)); + histosQA.fill(HIST("Events/selected/isCBTHadronZdcOk"), sgSelector.isCBTHadronZdcOk(collision)); + histosQA.fill(HIST("Events/selected/vertexX"), collision.posX()); + histosQA.fill(HIST("Events/selected/vertexY"), collision.posY()); + histosQA.fill(HIST("Events/selected/vertexZ"), collision.posZ()); + histosQA.fill(HIST("Events/selected/occupancy"), collision.occupancyInTime()); + histosQA.fill(HIST("Events/selected/FV0A"), collision.totalFV0AmplitudeA()); + histosQA.fill(HIST("Events/selected/FT0A"), collision.totalFT0AmplitudeA()); + histosQA.fill(HIST("Events/selected/FT0C"), collision.totalFT0AmplitudeC()); + histosQA.fill(HIST("Events/selected/ZDC_A"), collision.energyCommonZNA()); + histosQA.fill(HIST("Events/selected/ZDC_C"), collision.energyCommonZNC()); + histosQA.fill(HIST("Events/selected/FDDA"), collision.totalFDDAmplitudeA()); + histosQA.fill(HIST("Events/selected/FDDC"), collision.totalFDDAmplitudeC()); + + std::vector selectedTracks; + std::vector selectedPionTracks; + std::vector selectedPionPlusTracks; + std::vector selectedPionMinusTracks; + + for (const auto& t0 : tracks) { + + PxPyPzMVector tVector(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassPionCharged); + + // QA-Tracks before selection + histosQA.fill(HIST("Tracks/all/dcaXY"), t0.tpcChi2NCl()); + histosQA.fill(HIST("Tracks/all/dcaZ"), t0.tpcChi2NCl()); + histosQA.fill(HIST("Tracks/all/itsChi2NCl"), t0.itsChi2NCl()); + histosQA.fill(HIST("Tracks/all/itsChi2"), t0.itsChi2NCl() * t0.itsNCls()); + histosQA.fill(HIST("Tracks/all/tpcChi2NCl"), t0.tpcChi2NCl()); + histosQA.fill(HIST("Tracks/all/tpcNClsFindable"), t0.tpcNClsFindable()); + + // PID before track selection + histosPID.fill(HIST("all/tpcSignal"), tVector.P(), t0.tpcSignal()); + histosPID.fill(HIST("all/tpcNSigmaPi"), t0.tpcNSigmaPi(), tVector.Pt()); + histosPID.fill(HIST("all/tpcNSigmaKa"), t0.tpcNSigmaKa(), tVector.Pt()); + histosPID.fill(HIST("all/tpcNSigmaPr"), t0.tpcNSigmaPr(), tVector.Pt()); + histosPID.fill(HIST("all/tpcNSigmaEl"), t0.tpcNSigmaEl(), tVector.Pt()); + histosPID.fill(HIST("all/tpcNSigmaMu"), t0.tpcNSigmaMu(), tVector.Pt()); + histosPID.fill(HIST("all/tofBeta"), tVector.P(), t0.beta()); + histosPID.fill(HIST("all/tofNSigmaPi"), t0.tofNSigmaPi(), tVector.Pt()); + histosPID.fill(HIST("all/tofNSigmaKa"), t0.tofNSigmaKa(), tVector.Pt()); + histosPID.fill(HIST("all/tofNSigmaPr"), t0.tofNSigmaPr(), tVector.Pt()); + histosPID.fill(HIST("all/tofNSigmaEl"), t0.tofNSigmaEl(), tVector.Pt()); + histosPID.fill(HIST("all/tofNSigmaMu"), t0.tofNSigmaMu(), tVector.Pt()); + + // Kinematics for all particles before selection + histosKin.fill(HIST("all"), tVector.Pt(), tVector.Eta(), tVector.Phi()); + + // Selecting good tracks + if (!isSelectedTrack(t0, pTcut, etaCut, dcaXYcut, dcaZcut, useITStracksOnly, useTPCtracksOnly, itsChi2NClsCut, tpcChi2NClsCut, tpcNClsFindableCut)) { + continue; + } + if (!t0.has_udMcParticle()) { + continue; + } + + // QA-Tracks after selection + histosQA.fill(HIST("Tracks/selected/dcaXY"), t0.dcaXY()); + histosQA.fill(HIST("Tracks/selected/dcaZ"), t0.dcaZ()); + histosQA.fill(HIST("Tracks/selected/itsChi2NCl"), t0.itsChi2NCl()); + histosQA.fill(HIST("Tracks/selected/itsChi2"), t0.itsChi2NCl() * t0.itsNCls()); + histosQA.fill(HIST("Tracks/selected/tpcChi2NCl"), t0.tpcChi2NCl()); + histosQA.fill(HIST("Tracks/selected/tpcNClsFindable"), t0.tpcNClsFindable()); + + // PID after track selection before selecting pions + histosPID.fill(HIST("selected/tpcSignal"), tVector.P(), t0.tpcSignal()); + histosPID.fill(HIST("selected/tpcNSigmaPi"), t0.tpcNSigmaPi(), tVector.Pt()); + histosPID.fill(HIST("selected/tpcNSigmaKa"), t0.tpcNSigmaKa(), tVector.Pt()); + histosPID.fill(HIST("selected/tpcNSigmaPr"), t0.tpcNSigmaPr(), tVector.Pt()); + histosPID.fill(HIST("selected/tpcNSigmaEl"), t0.tpcNSigmaEl(), tVector.Pt()); + histosPID.fill(HIST("selected/tpcNSigmaMu"), t0.tpcNSigmaMu(), tVector.Pt()); + histosPID.fill(HIST("selected/tofBeta"), tVector.P(), t0.beta()); + histosPID.fill(HIST("selected/tofNSigmaPi"), t0.tofNSigmaPi(), tVector.Pt()); + histosPID.fill(HIST("selected/tofNSigmaKa"), t0.tofNSigmaKa(), tVector.Pt()); + histosPID.fill(HIST("selected/tofNSigmaPr"), t0.tofNSigmaPr(), tVector.Pt()); + histosPID.fill(HIST("selected/tofNSigmaEl"), t0.tofNSigmaEl(), tVector.Pt()); + histosPID.fill(HIST("selected/tofNSigmaMu"), t0.tofNSigmaMu(), tVector.Pt()); + + // Kinematics for all particles after track selection before selecting pions + histosKin.fill(HIST("selected"), tVector.Pt(), tVector.Eta(), tVector.Phi()); + + selectedTracks.push_back(t0); + if (ifPion(t0, useTOF, nSigmaTPCcut, nSigmaTOFcut)) { + + selectedPionTracks.push_back(t0); + + // QA-Tracks after selecting pions + histosQA.fill(HIST("Tracks/pions/dcaXY"), t0.dcaXY()); + histosQA.fill(HIST("Tracks/pions/dcaZ"), t0.dcaZ()); + histosQA.fill(HIST("Tracks/pions/itsChi2NCl"), t0.itsChi2NCl()); + histosQA.fill(HIST("Tracks/pions/itsChi2"), t0.itsChi2NCl() * t0.itsNCls()); + histosQA.fill(HIST("Tracks/pions/tpcChi2NCl"), t0.tpcChi2NCl()); + histosQA.fill(HIST("Tracks/pions/tpcNClsFindable"), t0.tpcNClsFindable()); + + // PID after selecting pions + histosPID.fill(HIST("pions/tpcSignal"), tVector.P(), t0.tpcSignal()); + histosPID.fill(HIST("pions/tpcNSigmaPi"), t0.tpcNSigmaPi(), tVector.Pt()); + histosPID.fill(HIST("pions/tpcNSigmaKa"), t0.tpcNSigmaKa(), tVector.Pt()); + histosPID.fill(HIST("pions/tpcNSigmaPr"), t0.tpcNSigmaPr(), tVector.Pt()); + histosPID.fill(HIST("pions/tpcNSigmaEl"), t0.tpcNSigmaEl(), tVector.Pt()); + histosPID.fill(HIST("pions/tpcNSigmaMu"), t0.tpcNSigmaMu(), tVector.Pt()); + histosPID.fill(HIST("pions/tofBeta"), tVector.P(), t0.beta()); + histosPID.fill(HIST("pions/tofNSigmaPi"), t0.tofNSigmaPi(), tVector.Pt()); + histosPID.fill(HIST("pions/tofNSigmaKa"), t0.tofNSigmaKa(), tVector.Pt()); + histosPID.fill(HIST("pions/tofNSigmaPr"), t0.tofNSigmaPr(), tVector.Pt()); + histosPID.fill(HIST("pions/tofNSigmaEl"), t0.tofNSigmaEl(), tVector.Pt()); + histosPID.fill(HIST("pions/tofNSigmaMu"), t0.tofNSigmaMu(), tVector.Pt()); + + // Kinematics for pions + histosKin.fill(HIST("pions"), tVector.Pt(), tVector.Eta(), tVector.Phi()); + + if (t0.sign() == 1) { + selectedPionPlusTracks.push_back(t0); + } + if (t0.sign() == -1) { + selectedPionMinusTracks.push_back(t0); + } + } // End of Selection PID Pion + } // End of loop over tracks + + int numSelectedPionTracks = static_cast(selectedPionTracks.size()); + int numPiPlusTracks = static_cast(selectedPionPlusTracks.size()); + int numPionMinusTracks = static_cast(selectedPionMinusTracks.size()); + + // event should have exactly 4 pions + if (numSelectedPionTracks != numFourPionTracks) { + return; + } + + // Selecting Events with net charge = 0 + if (numPionMinusTracks == numPiMinus && numPiPlusTracks == numPiPlus) { + + // QA-Events-4pion + histosQA.fill(HIST("Events/4pion/UPCmode"), collision.flags()); + histosQA.fill(HIST("Events/4pion/GapSide"), collision.gapSide()); + histosQA.fill(HIST("Events/4pion/TrueGapSide"), sgSelector.trueGap(collision, fv0Cut, ft0aCut, ft0cCut, zdcCut)); + histosQA.fill(HIST("Events/4pion/isCBTOk"), sgSelector.isCBTOk(collision)); + histosQA.fill(HIST("Events/4pion/isCBTHadronOk"), sgSelector.isCBTHadronOk(collision)); + histosQA.fill(HIST("Events/4pion/isCBTZdcOk"), sgSelector.isCBTZdcOk(collision)); + histosQA.fill(HIST("Events/4pion/isCBTHadronZdcOk"), sgSelector.isCBTHadronZdcOk(collision)); + histosQA.fill(HIST("Events/4pion/vertexX"), collision.posX()); + histosQA.fill(HIST("Events/4pion/vertexY"), collision.posY()); + histosQA.fill(HIST("Events/4pion/vertexZ"), collision.posZ()); + histosQA.fill(HIST("Events/4pion/occupancy"), collision.occupancyInTime()); + histosQA.fill(HIST("Events/4pion/FV0A"), collision.totalFV0AmplitudeA()); + histosQA.fill(HIST("Events/4pion/FT0A"), collision.totalFT0AmplitudeA()); + histosQA.fill(HIST("Events/4pion/FT0C"), collision.totalFT0AmplitudeC()); + histosQA.fill(HIST("Events/4pion/ZDC_A"), collision.energyCommonZNA()); + histosQA.fill(HIST("Events/4pion/ZDC_C"), collision.energyCommonZNC()); + histosQA.fill(HIST("Events/4pion/FDDA"), collision.totalFDDAmplitudeA()); + histosQA.fill(HIST("Events/4pion/FDDC"), collision.totalFDDAmplitudeC()); + + for (int i = 0; i < numFourPionTracks; i++) { + PxPyPzMVector tVector(selectedPionTracks[i].px(), selectedPionTracks[i].py(), selectedPionTracks[i].pz(), o2::constants::physics::MassPionCharged); + // Tracks QA for all four pions + histosQA.fill(HIST("Tracks/pions-from-4pi/dcaXY"), selectedPionTracks[i].dcaXY()); + histosQA.fill(HIST("Tracks/pions-from-4pi/dcaZ"), selectedPionTracks[i].dcaZ()); + histosQA.fill(HIST("Tracks/pions-from-4pi/itsChi2NCl"), selectedPionTracks[i].itsChi2NCl()); + histosQA.fill(HIST("Tracks/pions-from-4pi/itsChi2"), selectedPionTracks[i].itsChi2NCl() * selectedPionTracks[i].itsNCls()); + histosQA.fill(HIST("Tracks/pions-from-4pi/tpcChi2NCl"), selectedPionTracks[i].tpcChi2NCl()); + histosQA.fill(HIST("Tracks/pions-from-4pi/tpcNClsFindable"), selectedPionTracks[i].tpcNClsFindable()); + // PID for all four pions + histosPID.fill(HIST("pions-from-4pi/tpcSignal"), tVector.P(), selectedPionTracks[i].tpcSignal()); + histosPID.fill(HIST("pions-from-4pi/tpcNSigmaPi"), selectedPionTracks[i].tpcNSigmaPi(), tVector.Pt()); + histosPID.fill(HIST("pions-from-4pi/tpcNSigmaKa"), selectedPionTracks[i].tpcNSigmaKa(), tVector.Pt()); + histosPID.fill(HIST("pions-from-4pi/tpcNSigmaPr"), selectedPionTracks[i].tpcNSigmaPr(), tVector.Pt()); + histosPID.fill(HIST("pions-from-4pi/tpcNSigmaEl"), selectedPionTracks[i].tpcNSigmaEl(), tVector.Pt()); + histosPID.fill(HIST("pions-from-4pi/tpcNSigmaMu"), selectedPionTracks[i].tpcNSigmaMu(), tVector.Pt()); + histosPID.fill(HIST("pions-from-4pi/tofBeta"), tVector.P(), selectedPionTracks[i].beta()); + histosPID.fill(HIST("pions-from-4pi/tofNSigmaPi"), selectedPionTracks[i].tofNSigmaPi(), tVector.Pt()); + histosPID.fill(HIST("pions-from-4pi/tofNSigmaKa"), selectedPionTracks[i].tofNSigmaKa(), tVector.Pt()); + histosPID.fill(HIST("pions-from-4pi/tofNSigmaPr"), selectedPionTracks[i].tofNSigmaPr(), tVector.Pt()); + histosPID.fill(HIST("pions-from-4pi/tofNSigmaEl"), selectedPionTracks[i].tofNSigmaEl(), tVector.Pt()); + histosPID.fill(HIST("pions-from-4pi/tofNSigmaMu"), selectedPionTracks[i].tofNSigmaMu(), tVector.Pt()); + } + + PxPyPzMVector p1(selectedPionPlusTracks[0].px(), selectedPionPlusTracks[0].py(), selectedPionPlusTracks[0].pz(), o2::constants::physics::MassPionCharged); + PxPyPzMVector p2(selectedPionPlusTracks[1].px(), selectedPionPlusTracks[1].py(), selectedPionPlusTracks[1].pz(), o2::constants::physics::MassPionCharged); + PxPyPzMVector p3(selectedPionMinusTracks[0].px(), selectedPionMinusTracks[0].py(), selectedPionMinusTracks[0].pz(), o2::constants::physics::MassPionCharged); + PxPyPzMVector p4(selectedPionMinusTracks[1].px(), selectedPionMinusTracks[1].py(), selectedPionMinusTracks[1].pz(), o2::constants::physics::MassPionCharged); + + // Kinematics for pions from 4 pion events + histosKin.fill(HIST("pions-from-4pi"), p1.Pt(), p1.Eta(), p1.Phi(), p1.Rapidity()); + histosKin.fill(HIST("pions-from-4pi"), p2.Pt(), p2.Eta(), p2.Phi(), p2.Rapidity()); + histosKin.fill(HIST("pions-from-4pi"), p3.Pt(), p3.Eta(), p3.Phi(), p3.Rapidity()); + histosKin.fill(HIST("pions-from-4pi"), p4.Pt(), p4.Eta(), p4.Phi(), p4.Rapidity()); + + PxPyPzMVector p1234 = p1 + p2 + p3 + p4; + PxPyPzMVector p13 = p1 + p3; + PxPyPzMVector p14 = p1 + p4; + PxPyPzMVector p23 = p2 + p3; + PxPyPzMVector p24 = p2 + p4; + + // Two Pion Mass combinations + histos4piKin.fill(HIST("two-pion-mass"), p13.M(), p14.M(), p23.M(), p24.M()); + + double fourPiPhiPair1 = collinSoperPhi(p13, p1234); + double fourPiPhiPair2 = collinSoperPhi(p14, p1234); + double fourPiPhiPair3 = collinSoperPhi(p23, p1234); + double fourPiPhiPair4 = collinSoperPhi(p24, p1234); + + double fourPiCosThetaPair1 = collinSoperCosTheta(p13, p1234); + double fourPiCosThetaPair2 = collinSoperCosTheta(p14, p1234); + double fourPiCosThetaPair3 = collinSoperCosTheta(p23, p1234); + double fourPiCosThetaPair4 = collinSoperCosTheta(p24, p1234); + + double mDiff13 = std::abs((p13.M() - mRho0)); + double mDiff14 = std::abs((p14.M() - mRho0)); + double mDiff23 = std::abs((p23.M() - mRho0)); + double mDiff24 = std::abs((p24.M() - mRho0)); + if ((mDiff13 < mDiff14) && (mDiff13 < mDiff23) && (mDiff13 < mDiff24)) { + histos4piKin.fill(HIST("zero-charge"), p1234.Pt(), p1234.Eta(), p1234.Phi(), p1234.Rapidity(), p1234.M(), fourPiCosThetaPair1, fourPiPhiPair1, runIndex); + } else if ((mDiff14 < mDiff13) && (mDiff14 < mDiff23) && (mDiff14 < mDiff24)) { + histos4piKin.fill(HIST("zero-charge"), p1234.Pt(), p1234.Eta(), p1234.Phi(), p1234.Rapidity(), p1234.M(), fourPiCosThetaPair2, fourPiPhiPair2, runIndex); + } else if ((mDiff23 < mDiff13) && (mDiff23 < mDiff14) && (mDiff23 < mDiff24)) { + histos4piKin.fill(HIST("zero-charge"), p1234.Pt(), p1234.Eta(), p1234.Phi(), p1234.Rapidity(), p1234.M(), fourPiCosThetaPair3, fourPiPhiPair3, runIndex); + } else if ((mDiff24 < mDiff13) && (mDiff24 < mDiff14) && (mDiff24 < mDiff23)) { + histos4piKin.fill(HIST("zero-charge"), p1234.Pt(), p1234.Eta(), p1234.Phi(), p1234.Rapidity(), p1234.M(), fourPiCosThetaPair4, fourPiPhiPair4, runIndex); + } + } // End of Analysis for 0 charge events + + // Selecting Events with net charge != 0 for estimation of background + if (numPionMinusTracks != numPiMinus && numPiPlusTracks != numPiPlus) { + PxPyPzMVector p1(selectedPionTracks[0].px(), selectedPionTracks[0].py(), selectedPionTracks[0].pz(), o2::constants::physics::MassPionCharged); + PxPyPzMVector p2(selectedPionTracks[1].px(), selectedPionTracks[1].py(), selectedPionTracks[1].pz(), o2::constants::physics::MassPionCharged); + PxPyPzMVector p3(selectedPionTracks[2].px(), selectedPionTracks[2].py(), selectedPionTracks[2].pz(), o2::constants::physics::MassPionCharged); + PxPyPzMVector p4(selectedPionTracks[3].px(), selectedPionTracks[3].py(), selectedPionTracks[3].pz(), o2::constants::physics::MassPionCharged); + PxPyPzMVector p1234 = p1 + p2 + p3 + p4; + // Kinematics for 4 pion system from non 0 charge events + histos4piKin.fill(HIST("non-zero-charge"), p1234.Pt(), p1234.Eta(), p1234.Phi(), p1234.Rapidity(), p1234.M(), runIndex); + } // End of Analysis for non 0 charge events + } // End of 4 Pion Analysis Process function for Pass5 MC + PROCESS_SWITCH(ExclusiveRhoTo4Pi, processData, "Data Analysis Function", true); + PROCESS_SWITCH(ExclusiveRhoTo4Pi, processMCrec, "MC reconstructed Analysis Function", false); PROCESS_SWITCH(ExclusiveRhoTo4Pi, processEventCounter, "Event Counter Function", true); PROCESS_SWITCH(ExclusiveRhoTo4Pi, processTrackCounter, "Track Counter Function", true); - double collinSoperPhi(PtEtaPhiMVector twoPionVector, PtEtaPhiMVector fourPionVector) + double collinSoperPhi(PxPyPzMVector twoPionVector, PxPyPzMVector fourPionVector) { // Half of the energy per pair of the colliding nucleons. double halfSqrtSnn = 2680.; @@ -1117,7 +923,7 @@ struct ExclusiveRhoTo4Pi { return phi; } - double collinSoperCosTheta(PtEtaPhiMVector twoPionVector, PtEtaPhiMVector fourPionVector) + double collinSoperCosTheta(PxPyPzMVector twoPionVector, PxPyPzMVector fourPionVector) { // Half of the energy per pair of the colliding nucleons. double halfSqrtSnn = 2680.; @@ -1192,6 +998,24 @@ struct ExclusiveRhoTo4Pi { return true; } // End of Track Selection function + template + bool ifPion(const T& candidate, bool use_tof, float nsigmatpc_cut, float nsigmatof_cut) + { + + if (use_tof && candidate.hasTOF() && (candidate.tofNSigmaPi() * candidate.tofNSigmaPi() + candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi()) < (nsigmatof_cut * nsigmatof_cut)) { + return true; + } + + if (use_tof && !candidate.hasTOF() && std::abs(candidate.tpcNSigmaPi()) < nsigmatpc_cut) { + return true; + } + + if (!use_tof && std::abs(candidate.tpcNSigmaPi()) < nsigmatpc_cut) { + return true; + } + return false; + } + int getRunNumberIndex(int runNumber) { for (int i = 0; i < numRunNums; ++i) { @@ -1247,29 +1071,29 @@ struct ExclusiveRhoTo4Pi { int numTrackCuts = 14; - auto h1 = histosCounter.get(HIST("EventsCounts_vs_runNo")); - auto h2 = histosCounter.get(HIST("TracksCounts_vs_runNo")); - auto h3 = histosCounter.get(HIST("fourPionCounts_0c")); - auto h4 = histosCounter.get(HIST("fourPionCounts_0c_within_rap")); - auto h5 = histosCounter.get(HIST("fourPionCounts_0c_selected")); - auto h6 = histosCounter.get(HIST("fourPionCounts_n0c")); - auto h7 = histosCounter.get(HIST("fourPionCounts_n0c_within_rap")); - auto h8 = histosCounter.get(HIST("fourPionCounts_n0c_selected")); - auto h9 = histosCounter.get(HIST("fourPionCounts_0c_within_mass")); - auto h10 = histosCounter.get(HIST("fourPionCounts_n0c_within_mass")); - - for (int i = 0; i < numRunNums; ++i) { - h1->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); - h2->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); - h3->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); - h4->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); - h5->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); - h6->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); - h7->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); - h8->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); - h9->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); - h10->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); - } + auto h1 = histosDataCounter.get(HIST("EventsCounts_vs_runNo")); + auto h2 = histosDataCounter.get(HIST("TracksCounts_vs_runNo")); + // auto h3 = histosDataCounter.get(HIST("fourPionCounts_0c")); + // auto h4 = histosDataCounter.get(HIST("fourPionCounts_0c_within_rap")); + // auto h5 = histosDataCounter.get(HIST("fourPionCounts_0c_selected")); + // auto h6 = histosDataCounter.get(HIST("fourPionCounts_n0c")); + // auto h7 = histosDataCounter.get(HIST("fourPionCounts_n0c_within_rap")); + // auto h8 = histosDataCounter.get(HIST("fourPionCounts_n0c_selected")); + // auto h9 = histosDataCounter.get(HIST("fourPionCounts_0c_within_mass")); + // auto h10 = histosDataCounter.get(HIST("fourPionCounts_n0c_within_mass")); + + // for (int i = 0; i < numRunNums; ++i) { + // h1->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); + // h2->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); + // h3->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); + // h4->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); + // h5->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); + // h6->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); + // h7->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); + // h8->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); + // h9->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); + // h10->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); + // } for (int i = 0; i < numEventCuts; ++i) { h1->GetYaxis()->SetBinLabel(i + 1, eventLabels[i].c_str()); } From 883859a9eed1ad46e1dce29cb58d90c8a9f0e957 Mon Sep 17 00:00:00 2001 From: Kaare Endrup Iversen <69893472+kaareendrup@users.noreply.github.com> Date: Mon, 15 Sep 2025 09:56:53 +0200 Subject: [PATCH 399/986] [PWGDQ] Fixes to dilepton track mc (#12914) --- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index c6fe7567577..8a41665c038 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -3730,6 +3730,9 @@ struct AnalysisDileptonTrack { // get full track info of tracks based on the index auto lepton1 = tracks.rawIteratorAt(dilepton.index0Id()); auto lepton2 = tracks.rawIteratorAt(dilepton.index1Id()); + if (!lepton1.has_reducedMCTrack() || !lepton2.has_reducedMCTrack()) { + continue; + } auto lepton1MC = lepton1.reducedMCTrack(); auto lepton2MC = lepton2.reducedMCTrack(); // Check that the dilepton has zero charge @@ -3841,8 +3844,6 @@ struct AnalysisDileptonTrack { mcDecision |= (static_cast(1) << isig); } } - // Fill table for correlation analysis - DileptonTrackTable(fValuesHadron[VarManager::kDeltaEta], fValuesHadron[VarManager::kDeltaPhi], dilepton.mass(), dilepton.pt(), dilepton.eta(), track.pt(), track.eta(), mcDecision); } if constexpr (TCandidateType == VarManager::kBcToThreeMuons) { @@ -3870,6 +3871,8 @@ struct AnalysisDileptonTrack { mcDecision |= (static_cast(1) << isig); } } + // Fill table for correlation analysis + DileptonTrackTable(fValuesHadron[VarManager::kDeltaEta], fValuesHadron[VarManager::kDeltaPhi], dilepton.mass(), dilepton.pt(), dilepton.eta(), track.pt(), track.eta(), mcDecision); } // Fill histograms for the triplets From fc6498d72b75065d66a04dc1a1a8d16069670788 Mon Sep 17 00:00:00 2001 From: shreyasiacharya <34233706+shreyasiacharya@users.noreply.github.com> Date: Mon, 15 Sep 2025 09:58:48 +0200 Subject: [PATCH 400/986] [PWGDQ] Edit to update ME histograms (Changes in the previous PR were testsed lcoally, was okay...., In HY, after the PR, in the .root the histogrom doesnot pass)! (#12976) --- PWGDQ/Tasks/tableReader_withAssoc.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index d37c8f0302c..28c98566251 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -4058,7 +4058,7 @@ void DefineHistograms(HistogramManager* histMan, TString histClasses, const char } if (classStr.Contains("DileptonTrackME")) { - dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "dilepton-track", "mixedevent"); + dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "dilepton-track", "dilepton-hadron-array-correlation"); } if (classStr.Contains("HadronsSelected")) { From db4c3e07fd423ee648d77d58ec7c176e53cc793d Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Mon, 15 Sep 2025 13:29:12 +0530 Subject: [PATCH 401/986] [PWGLF] Added Collins Soper frame and renamed some configurables (#12937) --- PWGLF/Tasks/Resonances/higherMassResonances.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Resonances/higherMassResonances.cxx b/PWGLF/Tasks/Resonances/higherMassResonances.cxx index b1cd9d2ddf2..535c3007195 100644 --- a/PWGLF/Tasks/Resonances/higherMassResonances.cxx +++ b/PWGLF/Tasks/Resonances/higherMassResonances.cxx @@ -85,7 +85,7 @@ struct HigherMassResonances { kFV0A, kFV0C, kFV0M, - kNEstimators // useful if you want to iterate or size things + kNEstimators }; struct : ConfigurableGroup { From 5fa94f8c9d4c0dcf0ffa263a3f5402b365262ca2 Mon Sep 17 00:00:00 2001 From: Dukhishyam Mallick <160018357+dmallick2@users.noreply.github.com> Date: Mon, 15 Sep 2025 10:01:20 +0200 Subject: [PATCH 402/986] =?UTF-8?q?[PWGDQ]=20=E2=80=9CPWGDQ:Fix=20histogra?= =?UTF-8?q?m=20binnings,add=20CS=20fraeme=20and=20add=20hist=20dielectron?= =?UTF-8?q?=20for=20lowpt=20studies=E2=80=9D=20(#12968)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PWGDQ/Core/HistogramsLibrary.cxx | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/PWGDQ/Core/HistogramsLibrary.cxx b/PWGDQ/Core/HistogramsLibrary.cxx index e2012ef0aeb..3bd3be0d6ce 100644 --- a/PWGDQ/Core/HistogramsLibrary.cxx +++ b/PWGDQ/Core/HistogramsLibrary.cxx @@ -1009,6 +1009,21 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "Mass_VtxNcontribReal_VtxZ", "Mass vs VtxNcontribReal vs VtxZ", false, 200, 2.0, 5.0, VarManager::kMass, 150, 0, 150.0, VarManager::kVtxNcontribReal, 20, -10.0, 10.0, VarManager::kVtxZ); hm->AddHistogram(histClass, "VtxZ_VtxNcontribReal", "VtxZ vs VtxNcontribReal", false, 240, -12.0, 12.0, VarManager::kVtxZ, 200, 0, 200.0, VarManager::kVtxNcontribReal); } + if (subGroupStr.Contains("dielectron-polarization-he-pbpb")) { + int varsHEpbpb[5] = {VarManager::kMass, VarManager::kPt, VarManager::kCentFT0C, VarManager::kCosThetaHE, VarManager::kPhiHE}; + int binspT[5] = {100, 30, 10, 10, 10}; + double xminpT[5] = {2., 0., 0, -1., 0.0}; + double xmaxpT[5] = {4.5, 3., 100, 1., 6.28}; + hm->AddHistogram(histClass, "Dielectron_Mass_Pt_Cent_cosThetaHE", "", 5, varsHEpbpb, binspT, xminpT, xmaxpT, 0, -1, kFALSE); + } + + if (subGroupStr.Contains("dielectron-polarization-cs-pbpb")) { + int varsCSpbpb[5] = {VarManager::kMass, VarManager::kPt, VarManager::kCentFT0C, VarManager::kCosThetaCS, VarManager::kPhiCS}; + int binspT[5] = {100, 30, 10, 10, 10}; + double xminpT[5] = {2.0, 0., 0, -1., 0.0}; + double xmaxpT[5] = {4.5, 3., 100, 1., 6.28}; + hm->AddHistogram(histClass, "Dielectron_Mass_Pt_Cent_cosThetaCS", "", 5, varsCSpbpb, binspT, xminpT, xmaxpT, 0, -1, kFALSE); + } if (subGroupStr.Contains("polarization")) { if (subGroupStr.Contains("helicity")) { hm->AddHistogram(histClass, "cosThetaHE", "", false, 100, -1., 1., VarManager::kCosThetaHE); @@ -1078,8 +1093,8 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h if (subGroupStr.Contains("tauxy-midy-pol-he")) { int varspTHE[4] = {VarManager::kMass, VarManager::kPt, VarManager::kCosThetaHE, VarManager::kVertexingTauxyProjectedPoleJPsiMass}; int binspT[4] = {50, 10, 20, 1000}; - double xminpT[4] = {2., 0., -1., -0.03}; - double xmaxpT[4] = {4., 20., 1., 0.03}; + double xminpT[4] = {2., 0., -1., -0.05}; + double xmaxpT[4] = {4., 20., 1., 0.05}; hm->AddHistogram(histClass, "Tauxy_Mass_Pt_CosthetaHE", "", 4, varspTHE, binspT, xminpT, xmaxpT, 0, -1, kFALSE); } @@ -1087,11 +1102,20 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h int varspTRand[4] = {VarManager::kMass, VarManager::kPt, VarManager::kCosThetaRM, VarManager::kVertexingTauxyProjectedPoleJPsiMass}; int binspT[4] = {50, 10, 20, 1000}; - double xminpT[4] = {2., 0., -1., -0.03}; - double xmaxpT[4] = {4., 20., 1., 0.03}; + double xminpT[4] = {2., 0., -1., -0.05}; + double xmaxpT[4] = {4., 20., 1., 0.05}; hm->AddHistogram(histClass, "Tauxy_Mass_Pt_CosthetaRand", "", 4, varspTRand, binspT, xminpT, xmaxpT, 0, -1, kFALSE); } + if (subGroupStr.Contains("tauxy-midy-pol-cs")) { + int varspTCS[4] = {VarManager::kMass, VarManager::kPt, VarManager::kCosThetaCS, VarManager::kVertexingTauxyProjectedPoleJPsiMass}; + + int binspT[4] = {50, 10, 20, 1000}; + double xminpT[4] = {2., 0., -1., -0.05}; + double xmaxpT[4] = {4., 20., 1., 0.05}; + hm->AddHistogram(histClass, "Tauxy_Mass_Pt_CosthetaCS", "", 4, varspTCS, binspT, xminpT, xmaxpT, 0, -1, kFALSE); + } + if (subGroupStr.Contains("kalman-filter")) { hm->AddHistogram(histClass, "LxyErr", "", false, 100, 0.0, 10.0, VarManager::kVertexingLxyErr); hm->AddHistogram(histClass, "LxyzErr", "", false, 100, 0.0, 10.0, VarManager::kVertexingLxyzErr); From ee8cd35429e3a46e1bcb3c62b6d35883cb114dde Mon Sep 17 00:00:00 2001 From: wrzesaCERN <41298293+wrzesaCERN@users.noreply.github.com> Date: Mon, 15 Sep 2025 10:11:11 +0200 Subject: [PATCH 403/986] =?UTF-8?q?[PWGCF]=20A=20correlation=20task=20for?= =?UTF-8?q?=20triplets=20(track-track-v0)=20in=20Pb=E2=80=93Pb=20collision?= =?UTF-8?q?s=20(#12794)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Victor Gonzalez --- PWGCF/FemtoDream/Tasks/CMakeLists.txt | 12 +- .../Tasks/femtoDreamCollisionMasker.cxx | 2 +- .../femtoDreamTripletTaskTrackTrackV0PbPb.cxx | 776 ++++++++++++++++++ 3 files changed, 788 insertions(+), 2 deletions(-) create mode 100644 PWGCF/FemtoDream/Tasks/femtoDreamTripletTaskTrackTrackV0PbPb.cxx diff --git a/PWGCF/FemtoDream/Tasks/CMakeLists.txt b/PWGCF/FemtoDream/Tasks/CMakeLists.txt index 95c4f8cdaa0..a6a2aa2ed8e 100644 --- a/PWGCF/FemtoDream/Tasks/CMakeLists.txt +++ b/PWGCF/FemtoDream/Tasks/CMakeLists.txt @@ -19,6 +19,11 @@ o2physics_add_dpl_workflow(femtodream-triplet-track-track-track PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(femto-dream-triplet-task-track-track-track-pb-pb + SOURCES femtoDreamTripletTaskTrackTrackTrackPbPb.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(femtodream-pair-track-v0 SOURCES femtoDreamPairTaskTrackV0.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore @@ -39,6 +44,11 @@ o2physics_add_dpl_workflow(femtodream-triplet-track-track-v0 PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(femto-dream-triplet-task-track-track-v0-pb-pb + SOURCES femtoDreamTripletTaskTrackTrackV0PbPb.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(femtodream-debug-track SOURCES femtoDreamDebugTrack.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore @@ -67,4 +77,4 @@ o2physics_add_dpl_workflow(femtodream-hash o2physics_add_dpl_workflow(femtodream-pair-v0-v0 SOURCES femtoDreamPairTaskV0V0.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore - COMPONENT_NAME Analysis) \ No newline at end of file + COMPONENT_NAME Analysis) diff --git a/PWGCF/FemtoDream/Tasks/femtoDreamCollisionMasker.cxx b/PWGCF/FemtoDream/Tasks/femtoDreamCollisionMasker.cxx index fddbee16a88..1cb8c18caef 100644 --- a/PWGCF/FemtoDream/Tasks/femtoDreamCollisionMasker.cxx +++ b/PWGCF/FemtoDream/Tasks/femtoDreamCollisionMasker.cxx @@ -268,7 +268,7 @@ struct femoDreamCollisionMasker { TrackDCACutPtDep.push_back(option.defaultValue.get()); } } - } else if (device.name.find("femto-dream-triplet-task-track-track-v0") != std::string::npos) { + } else if ((device.name.find("femto-dream-triplet-task-track-track-v0") != std::string::npos) || (device.name.find("femto-dream-triplet-task-track-track-v0-pb-pb") != std::string::npos)) { LOG(info) << "Matched workflow: " << device.name; TaskFinder = CollisionMasks::kTrackTrackV0; for (auto const& option : device.options) { diff --git a/PWGCF/FemtoDream/Tasks/femtoDreamTripletTaskTrackTrackV0PbPb.cxx b/PWGCF/FemtoDream/Tasks/femtoDreamTripletTaskTrackTrackV0PbPb.cxx new file mode 100644 index 00000000000..84ec7dc9cd8 --- /dev/null +++ b/PWGCF/FemtoDream/Tasks/femtoDreamTripletTaskTrackTrackV0PbPb.cxx @@ -0,0 +1,776 @@ +// Copyright 2019-2025 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 femtoDreamTripletTaskTrackTrackV0PbPb.cxx +/// \brief Tasks that reads the track and V0 tables and creates triplets; only two identical tracks and a V0 can be used +/// \author Laura Serksnyte, CERN, laura.serksnyte@cern.ch +/// \author Wioleta Rzęsa, TU München, wioleta.rzesa@cern.ch + +#include "PWGCF/DataModel/FemtoDerived.h" +#include "PWGCF/FemtoDream/Core/femtoDreamContainerThreeBody.h" +#include "PWGCF/FemtoDream/Core/femtoDreamDetaDphiStar.h" +#include "PWGCF/FemtoDream/Core/femtoDreamEventHisto.h" +#include "PWGCF/FemtoDream/Core/femtoDreamPairCleaner.h" +#include "PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h" +#include "PWGCF/FemtoDream/Core/femtoDreamUtils.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" + +#include +#include +#include + +using namespace o2; +using namespace o2::analysis::femtoDream; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; + +struct FemtoDreamTripletTaskTrackTrackV0PbPb { + SliceCache cache; + Preslice perCol = aod::femtodreamparticle::fdCollisionId; + Configurable confCentralityMin{"confCentralityMin", 0, "Event sel: Minimum Centrality Percentile"}; + Configurable confCentralityMax{"confCentralityMax", 10, "Event sel: Maximum Centrality Percentile"}; + Configurable confZVertexCut{"confZVertexCut", 10.f, "Event sel: Maximum z-Vertex (cm)"}; + Filter eventCentrality = aod::femtodreamcollision::multV0M >= confCentralityMin && aod::femtodreamcollision::multV0M <= confCentralityMax; + Filter eventVertex = (nabs(aod::collision::posZ) < confZVertexCut); + using FilteredFDCollisions = soa::Filtered; + using FilteredFDCollision = FilteredFDCollisions::iterator; + using MaskedCollisions = soa::Filtered>; + using MaskedCollision = MaskedCollisions::iterator; + + aod::femtodreamcollision::BitMaskType maskBit = -1; + float mMassOne = -999, mMassTwo = -999, mMassThree = -999; + + // Pair/triplet cuts + Configurable confMixIfTripletPresent{"confMixIfTripletPresent", true, "Use for mixing only events which have a TTV0 triplet"}; + Configurable confMixIfTVOPairPresent{"confMixIfTVOPairPresent", false, "Use for mixing only events which have a TV0 pair (at least one track and one V0)"}; + Configurable confMixIfTOrVOPartsPresent{"confMixIfTOrVOPartsPresent", false, "Use for mixing only events which have at least one particle of interest"}; + Configurable confMinTrackNumber{"confMinTrackNumber", 2, "Minimum number of tracks in the event"}; + Configurable confMinV0Number{"confMinV0Number", 1, "Minimum number of V0 in the event"}; + + // which CPR to use, old is with a possible bug and new is fixed + Configurable confUseOLDPossiblyWrongCPR{"confUseOLDPossiblyWrongCPR", true, "Use for old CPR, which possibly has a bug. This is implemented only for debugging reasons to compare old and new code on hyperloop datasets."}; + Configurable confAtWhichRadiiToCut{"confAtWhichRadiiToCut", 1, "At which radii perform deta dphi selection: 0 - at PV, 1 - averaged phi, 2 - at given radii"}; + Configurable confAtWhichTPCRadii{"confAtWhichTPCRadii", 85., "If confAtWhichRadiiToCut = 2; this allows to select at which TPC radii to cut"}; + + /// First 2 tracks of the triplet + Configurable confPDGCodePart{"confPDGCodePart", 2212, "Particle PDG code"}; // proton + Configurable confCutPart{"confCutPart", 5542474, "Track - Selection bit from cutCulator"}; + Configurable confTPCPIDBit{"confTPCPIDBit", 16, "PID TPC bit from cutCulator "}; + Configurable confTPCTOFPIDBit{"confTPCTOFPIDBit", 8, "PID TPCTOF bit from cutCulator"}; + Configurable confMaxpT{"confMaxpT", 4.0f, "Maximum transverse momentum of the particles"}; + Configurable confMinpT{"confMinpT", 0.5f, "Minimum transverse momentum of the particles"}; + Configurable confMaxDCAxy{"confMaxDCAxy", 0.1f, "Maximum DCAxy of the particles"}; + Configurable confMinDCAxy{"confMinDCAxy", -0.1f, "Minimum DCAxy of the particles"}; + Configurable confPIDthrMom{"confPIDthrMom", 0.75f, "Momentum threshold from which TPC and TOF are required for PID"}; + Configurable confIsMC{"confIsMC", false, "Enable additional Histogramms in the case of a MonteCarlo Run"}; + Configurable confUse3D{"confUse3D", false, "Enable three dimensional histogramms (to be used only for analysis with high statistics): k* vs mT vs multiplicity"}; + Configurable confDCACutPtDep{"confDCACutPtDep", false, "Use pt dependent dca cut for tracks"}; + Configurable confDCACutPtDepPar0{"confDCACutPtDepPar0", 0.0105, "Parameter par[0] of the pt dep cut, par[0] + par[1]/(pT/(GeV/c)−1.1) cm"}; + Configurable confDCACutPtDepPar1{"confDCACutPtDepPar1", 0.035, "Parameter par[1] of the pt dep cut, par[0] + par[1]/(pT/(GeV/c)−1.1) cm"}; + + /// Partition for selected particles + Partition selectedParts = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && + ifnode(aod::femtodreamparticle::pt * (0.5f * nexp(aod::femtodreamparticle::eta) + 0.5f * nexp(-1.f * aod::femtodreamparticle::eta)) <= confPIDthrMom, ncheckbit(aod::femtodreamparticle::pidcut, confTPCPIDBit), ncheckbit(aod::femtodreamparticle::pidcut, confTPCTOFPIDBit)) && + (ncheckbit(aod::femtodreamparticle::cut, confCutPart)) && + (aod::femtodreamparticle::pt < confMaxpT) && + (aod::femtodreamparticle::pt > confMinpT) && + ifnode(confDCACutPtDep, (nabs(aod::femtodreamparticle::tempFitVar) <= confDCACutPtDepPar0 + (confDCACutPtDepPar1 / npow(aod::femtodreamparticle::pt, 1.1f))), + ((aod::femtodreamparticle::tempFitVar >= confMinDCAxy) && + (aod::femtodreamparticle::tempFitVar <= confMaxDCAxy))); + ; + + Partition> selectedPartsMC = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && + ifnode(aod::femtodreamparticle::pt * (0.5f * nexp(aod::femtodreamparticle::eta) + 0.5f * nexp(-1.f * aod::femtodreamparticle::eta)) <= confPIDthrMom, ncheckbit(aod::femtodreamparticle::pidcut, confTPCPIDBit), ncheckbit(aod::femtodreamparticle::pidcut, confTPCTOFPIDBit)) && + (ncheckbit(aod::femtodreamparticle::cut, confCutPart)) && + (aod::femtodreamparticle::pt < confMaxpT) && + (aod::femtodreamparticle::pt > confMinpT) && + ifnode(confDCACutPtDep, (nabs(aod::femtodreamparticle::tempFitVar) <= confDCACutPtDepPar0 + (confDCACutPtDepPar1 / npow(aod::femtodreamparticle::pt, 1.1f))), + ((aod::femtodreamparticle::tempFitVar >= confMinDCAxy) && + (aod::femtodreamparticle::tempFitVar <= confMaxDCAxy))); + ; + + /// Histogramming of selected tracks + FemtoDreamParticleHisto trackHistoselectedParts; + FemtoDreamParticleHisto trackHistoALLselectedParts; + + /// V0 selection + Configurable confPDGCodeV0{"confPDGCodeV0", 3122, "V0 PDG code"}; + Configurable confCutV0{"confCutV0", 7518, "V0 - Selection bit from cutCulator"}; + Configurable confChildPosCutV0{"confChildPosCutV0", 8234, "Selection bit for positive child of V0"}; + Configurable confChildPosTPCBitV0{"confChildPosTPCBitV0", 1024, "PID TPC bit for positive child of V0"}; + Configurable confChildNegCutV0{"confChildNegCutV0", 8233, "Selection bit for negative child of V0"}; + Configurable confChildNegTPCBitV0{"confChildNegTPCBitV0", 4096, "PID TPC bit for negative child of V0"}; + + Configurable confMinInvMassV0{"confMinInvMassV0", 1.08, "Minimum invariant mass of V0 (particle)"}; + Configurable confMaxInvMassV0{"confMaxInvMassV0", 1.15, "Maximum invariant mass of V0 (particle)"}; + Configurable confMinInvMassAntiV0{"confMinInvMassAntiV0", 1.08, "Minimum invariant mass of V0 (antiparticle)"}; + Configurable confMaxInvMassAntiV0{"confMaxInvMassAntiV0", 1.15, "Maximum invariant mass of V0 (antiparticle)"}; + + Configurable confMinPtV0{"confMinPtV0", 0.0, "Minimum pT of V0"}; + Configurable confMaxPtV0{"confMaxPtV0", 999.0, "Maximum pT of V0"}; + + // Partition for selected particles + Partition selectedV0s = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kV0)) && + (ncheckbit(aod::femtodreamparticle::cut, confCutV0)) && + (aod::femtodreamparticle::mLambda > confMinInvMassV0) && + (aod::femtodreamparticle::mLambda < confMaxInvMassV0) && + (aod::femtodreamparticle::mAntiLambda > confMinInvMassAntiV0) && + (aod::femtodreamparticle::mAntiLambda < confMaxInvMassAntiV0) && + (aod::femtodreamparticle::pt > confMinPtV0) && + (aod::femtodreamparticle::pt < confMaxPtV0); + Partition> selectedV0sMC = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kV0)) && + (ncheckbit(aod::femtodreamparticle::cut, confCutV0)) && + (aod::femtodreamparticle::mLambda > confMinInvMassV0) && + (aod::femtodreamparticle::mLambda < confMaxInvMassV0) && + (aod::femtodreamparticle::mAntiLambda > confMinInvMassAntiV0) && + (aod::femtodreamparticle::mAntiLambda < confMaxInvMassAntiV0) && + (aod::femtodreamparticle::pt > confMinPtV0) && + (aod::femtodreamparticle::pt < confMaxPtV0); + + /// Histogramming of selected V0s + FemtoDreamParticleHisto particleHistoselectedV0s; + FemtoDreamParticleHisto particleHistoPosChild; + FemtoDreamParticleHisto particleHistoNegChild; + FemtoDreamParticleHisto particleHistoALLselectedV0s; + FemtoDreamParticleHisto particleHistoALLPosChild; + FemtoDreamParticleHisto particleHistoALLNegChild; + + /// Histogramming for Event + FemtoDreamEventHisto eventHisto; + + /// Particles + ConfigurableAxis confTempFitVarBinsTrack{"confTempFitVarBinsTrack", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot"}; + ConfigurableAxis confTempFitVarpTBins{"confTempFitVarpTBins", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot (track)"}; + ConfigurableAxis confTempFitVarBinsV0{"confTempFitVarBinsV0", {300, 0.9, 1}, "binning of the TempFitVar in the pT vs. TempFitVar plot (V0)"}; + ConfigurableAxis confTempFitVarBinsV0Child{"confTempFitVarBinsV0Child", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot (V0 child)"}; + ConfigurableAxis confTempFitVarpTV0Bins{"confTempFitVarpTV0Bins", {35, 0, 6}, "pT binning of the pT vs. TempFitVar plot (V0)"}; + ConfigurableAxis confTempFitVarpTV0Child{"confTempFitVarpTV0Child", {35, 0, 6}, "pT binning of the pT vs. TempFitVar plot (V0 child)"}; + ConfigurableAxis confInvMassBins{"confInvMassBins", {200, 1, 1.2}, "InvMass binning"}; + + /// Correlations + ConfigurableAxis confMultBins{"confMultBins", {VARIABLE_WIDTH, 0.0f, 23.0f, 38.0f, 53.0f, 81.0f, 110.0f, 157.0f, 205.0f, 278.0f, 351.0f, 455.0f, 559.0f, 703.0f, 848.0f, 1050.0f, 1253.0f, 1530.0f, 1668.0f, 1857.0f, 2047.0f, 99999.f}, "Mixing bins - multiplicity"}; + ConfigurableAxis confVtxBins{"confVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; + + ColumnBinningPolicy colBinning{{confVtxBins, confMultBins}, true}; + + ConfigurableAxis confQ3Bins{"confQ3Bins", {2000, 0., 8.}, "binning Q3"}; + ConfigurableAxis confQ3BinsFor4D{"confQ3BinsFor4D", {500, 0., 2.}, "binning Q3 for 4D hist"}; + Configurable confNEventsMix{"confNEventsMix", 5, "Number of events for mixing"}; + Configurable confIsCPR{"confIsCPR", true, "Close Pair Rejection"}; + Configurable confFillCPRQA{"confFillCPRQA", false, "Fill Close Pair Rejection plots as a function of eta and phi"}; + Configurable confCPRPlotPerRadii{"confCPRPlotPerRadii", false, "Plot CPR per radii"}; + Configurable confCPRdeltaPhiMaxpp{"confCPRdeltaPhiMaxpp", 0.01, "Max. Delta Phi for Close Pair Rejection of pp"}; + Configurable confCPRdeltaEtaMaxpp{"confCPRdeltaEtaMaxpp", 0.01, "Max. Delta Eta for Close Pair Rejection of pp"}; + Configurable confCPRdeltaPhiMaxpL{"confCPRdeltaPhiMaxpL", 0.1, "Max. Delta Phi for Close Pair Rejection of p and Lambda daughter"}; + Configurable confCPRdeltaEtaMaxpL{"confCPRdeltaEtaMaxpL", 0.1, "Max. Delta Eta for Close Pair Rejection of p and Lambda daughter"}; + Configurable confMaxQ3IncludedInCPRPlots{"confMaxQ3IncludedInCPRPlots", 8., "Maximum Q3, for which the pair CPR is included in plots"}; + ConfigurableAxis confDummy{"confDummy", {1, 0, 1}, "Dummy axis"}; + + FemtoDreamContainerThreeBody sameEventCont; + FemtoDreamContainerThreeBody mixedEventCont; + FemtoDreamPairCleaner pairCleanerTrackTrack; + FemtoDreamPairCleaner pairCleanerTrackV0; + FemtoDreamDetaDphiStar pairCloseRejectionTrackTrackSE; + FemtoDreamDetaDphiStar pairCloseRejectionTrackV0SE; + FemtoDreamDetaDphiStar pairCloseRejectionTrackTrackME; + FemtoDreamDetaDphiStar pairCloseRejectionTrackV0ME; + /// Histogram output + HistogramRegistry qaRegistry{"TrackQA", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry resultRegistry{"Correlations", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry threeBodyQARegistry{"threeBodyQARegistry", {}, OutputObjHandlingPolicy::AnalysisObject}; + + void init(InitContext& context) + { + + eventHisto.init(&qaRegistry, false); + + colBinning = {{confVtxBins, confMultBins}, true}; + + trackHistoselectedParts.init(&qaRegistry, confDummy, confDummy, confTempFitVarpTBins, confDummy, confDummy, confTempFitVarBinsTrack, confDummy, confDummy, confDummy, confDummy, confDummy, confDummy, confIsMC, confPDGCodePart); + trackHistoALLselectedParts.init(&qaRegistry, confDummy, confDummy, confTempFitVarpTBins, confDummy, confDummy, confTempFitVarBinsTrack, confDummy, confDummy, confDummy, confDummy, confDummy, confDummy, confIsMC, confPDGCodePart); + particleHistoselectedV0s.init(&qaRegistry, confDummy, confDummy, confTempFitVarpTV0Bins, confDummy, confDummy, confTempFitVarBinsV0, confDummy, confDummy, confDummy, confDummy, confInvMassBins, confDummy, confIsMC, confPDGCodeV0); + particleHistoPosChild.init(&qaRegistry, confDummy, confDummy, confTempFitVarpTV0Child, confDummy, confDummy, confTempFitVarBinsV0Child, confDummy, confDummy, confDummy, confDummy, confDummy, confDummy, confIsMC, 0); + particleHistoNegChild.init(&qaRegistry, confDummy, confDummy, confTempFitVarpTV0Child, confDummy, confDummy, confTempFitVarBinsV0Child, confDummy, confDummy, confDummy, confDummy, confDummy, confDummy, confIsMC, 0); + particleHistoALLselectedV0s.init(&qaRegistry, confDummy, confDummy, confTempFitVarpTV0Bins, confDummy, confDummy, confTempFitVarBinsV0, confDummy, confDummy, confDummy, confDummy, confInvMassBins, confDummy, confIsMC, confPDGCodeV0); + particleHistoALLPosChild.init(&qaRegistry, confDummy, confDummy, confTempFitVarpTV0Child, confDummy, confDummy, confTempFitVarBinsV0Child, confDummy, confDummy, confDummy, confDummy, confDummy, confDummy, confIsMC, 0); + particleHistoALLNegChild.init(&qaRegistry, confDummy, confDummy, confTempFitVarpTV0Child, confDummy, confDummy, confTempFitVarBinsV0Child, confDummy, confDummy, confDummy, confDummy, confDummy, confDummy, confIsMC, 0); + + threeBodyQARegistry.add("TripletTaskQA/hSECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); + threeBodyQARegistry.add("TripletTaskQA/hMECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); + threeBodyQARegistry.add("TripletTaskQA/hMinvSE_Lambda", ";Q_{3};M_{inv}", kTH2F, {confQ3Bins, confInvMassBins}); + threeBodyQARegistry.add("TripletTaskQA/hMinvME_Lambda", ";Q_{3};M_{inv}", kTH2F, {confQ3Bins, confInvMassBins}); + threeBodyQARegistry.add("TripletTaskQA/hMinvSE_AntiLambda", ";Q_{3};M_{inv}", kTH2F, {confQ3Bins, confInvMassBins}); + threeBodyQARegistry.add("TripletTaskQA/hMinvME_AntiLambda", ";Q_{3};M_{inv}", kTH2F, {confQ3Bins, confInvMassBins}); + threeBodyQARegistry.add("TripletTaskQA/particle_pT_in_Triplet_SE", "; p_{T1} ; p_{T2} ; p_{T3} ; Q_{3}", kTHnSparseF, {confTempFitVarpTBins, confTempFitVarpTBins, confTempFitVarpTV0Bins, confQ3BinsFor4D}); + threeBodyQARegistry.add("TripletTaskQA/particle_pT_in_Triplet_ME", "; p_{T1} ; p_{T2} ; p_{T3} ; Q_{3}", kTHnSparseF, {confTempFitVarpTBins, confTempFitVarpTBins, confTempFitVarpTV0Bins, confQ3BinsFor4D}); + threeBodyQARegistry.add("TripletTaskQA/hCentrality", ";Centrality; Q3", kTH2F, {{100, 0, 100}, confQ3Bins}); + + std::vector tmpVecMult = confMultBins; + framework::AxisSpec multAxis = {tmpVecMult, "Multiplicity"}; + threeBodyQARegistry.add("TripletTaskQA/hSEMultVSGoodTracks", ";Mult;GoodT", kTH2F, {multAxis, {100, 0, 100}}); + threeBodyQARegistry.add("TripletTaskQA/hTestPairCleaner", ";posDaughtID; negDaughID", kTH2F, {{40, -20, 20}, {40, -20, 20}}); + threeBodyQARegistry.add("TripletTaskQA/hTestPairCleanerPos", ";primaryTrack; posDaughtID", kTH2F, {{40, -20, 20}, {40, -20, 20}}); + threeBodyQARegistry.add("TripletTaskQA/hTestPairCleanerNeg", ";primaryTrack; negDaughtID", kTH2F, {{40, -20, 20}, {40, -20, 20}}); + threeBodyQARegistry.add("TripletTaskQA/hTestPairCleanerPosGlobal", ";primaryTrackGlobal; posDaughtID", kTH2F, {{40, -20, 20}, {40, -20, 20}}); + threeBodyQARegistry.add("TripletTaskQA/hTestPairCleanerNegGlobal", ";primaryTrackGlobal; negDaughtID", kTH2F, {{40, -20, 20}, {40, -20, 20}}); + threeBodyQARegistry.add("TripletTaskQA/hTestPairCleanerPosAfter", ";primaryTrack; posDaughtID", kTH2F, {{40, -20, 20}, {40, -20, 20}}); + threeBodyQARegistry.add("TripletTaskQA/hTestPairCleanerNegAfter", ";primaryTrack; negDaughtID", kTH2F, {{40, -20, 20}, {40, -20, 20}}); + threeBodyQARegistry.add("TripletTaskQA/hCentralityME", ";Centrality;Entries", kTH1F, {{100, 0.0, 100.0}}); + sameEventCont.init(&resultRegistry, confQ3Bins, confMultBins, confIsMC); + mixedEventCont.init(&resultRegistry, confQ3Bins, confMultBins, confIsMC); + sameEventCont.setPDGCodes(confPDGCodePart, confPDGCodePart, confPDGCodeV0); + mixedEventCont.setPDGCodes(confPDGCodePart, confPDGCodePart, confPDGCodeV0); + + pairCleanerTrackTrack.init(&qaRegistry); + pairCleanerTrackV0.init(&qaRegistry); + if (confIsCPR.value) { + pairCloseRejectionTrackTrackSE.init(&resultRegistry, &qaRegistry, confCPRdeltaPhiMaxpp.value, confCPRdeltaEtaMaxpp.value, confCPRPlotPerRadii.value, 1, confUseOLDPossiblyWrongCPR, confMaxQ3IncludedInCPRPlots, false, confAtWhichRadiiToCut, confAtWhichTPCRadii, confFillCPRQA); + pairCloseRejectionTrackV0SE.init(&resultRegistry, &qaRegistry, confCPRdeltaPhiMaxpL.value, confCPRdeltaEtaMaxpL.value, confCPRPlotPerRadii.value, 1, confUseOLDPossiblyWrongCPR, confMaxQ3IncludedInCPRPlots, false, confAtWhichRadiiToCut, confAtWhichTPCRadii, confFillCPRQA); + pairCloseRejectionTrackTrackME.init(&resultRegistry, &qaRegistry, confCPRdeltaPhiMaxpp.value, confCPRdeltaEtaMaxpp.value, confCPRPlotPerRadii.value, 2, confUseOLDPossiblyWrongCPR, confMaxQ3IncludedInCPRPlots, false, confAtWhichRadiiToCut, confAtWhichTPCRadii, confFillCPRQA); + pairCloseRejectionTrackV0ME.init(&resultRegistry, &qaRegistry, confCPRdeltaPhiMaxpL.value, confCPRdeltaEtaMaxpL.value, confCPRPlotPerRadii.value, 2, confUseOLDPossiblyWrongCPR, confMaxQ3IncludedInCPRPlots, true, confAtWhichRadiiToCut, confAtWhichTPCRadii, confFillCPRQA); + } + + // get masses + mMassOne = o2::constants::physics::MassProton; + mMassTwo = o2::constants::physics::MassProton; + mMassThree = o2::constants::physics::MassLambda; + + // get bit for the collision mask + std::bitset<8 * sizeof(aod::femtodreamcollision::BitMaskType)> mask; + int index = 0; + auto& workflows = context.services().get(); + for (DeviceSpec const& device : workflows.devices) { + if (device.name.find("femto-dream-triplet-task-track-track-v0-pb-pb") != std::string::npos) { + if (containsNameValuePair(device.options, "confCutPart", confCutPart.value) && + containsNameValuePair(device.options, "confTPCPIDBit", confTPCPIDBit.value) && + containsNameValuePair(device.options, "confTPCTOFPIDBit", confTPCTOFPIDBit.value) && + containsNameValuePair(device.options, "confPIDthrMom", confPIDthrMom.value) && + containsNameValuePair(device.options, "confMaxpT", confMaxpT.value) && + containsNameValuePair(device.options, "confMinpT", confMinpT.value) && + containsNameValuePair(device.options, "confCutV0", confCutV0.value) && + containsNameValuePair(device.options, "confChildPosCutV0", confChildPosCutV0.value) && + containsNameValuePair(device.options, "confChildPosTPCBitV0", confChildPosTPCBitV0.value) && + containsNameValuePair(device.options, "confChildNegCutV0", confChildNegCutV0.value) && + containsNameValuePair(device.options, "confChildNegTPCBitV0", confChildNegTPCBitV0.value) && + containsNameValuePair(device.options, "confMinInvMassV0", confMinInvMassV0.value) && + containsNameValuePair(device.options, "confMaxInvMassV0", confMaxInvMassV0.value) && + containsNameValuePair(device.options, "confMinInvMassAntiV0", confMinInvMassAntiV0.value) && + containsNameValuePair(device.options, "confMaxInvMassAntiV0", confMaxInvMassAntiV0.value) && + containsNameValuePair(device.options, "confMinPtV0", confMinPtV0.value) && + containsNameValuePair(device.options, "confMaxPtV0", confMaxPtV0.value)) { + mask.set(index); + maskBit = static_cast(mask.to_ulong()); + LOG(info) << "Device name matched: " << device.name; + LOG(info) << "Bitmask for collisions: " << mask.to_string(); + break; + } else { + index++; + } + } + } + + if ((doprocessSameEvent && doprocessSameEventMasked) || + (doprocessMixedEvent && doprocessMixedEventMasked) || + (doprocessSameEventMC && doprocessSameEventMCMasked) || + (doprocessMixedEventMC && doprocessMixedEventMCMasked)) { + LOG(fatal) << "Normal and masked processing cannot be activated simultaneously!"; + } + + if ((confMixIfTripletPresent && confMixIfTVOPairPresent) || + (confMixIfTripletPresent && confMixIfTOrVOPartsPresent) || + (confMixIfTVOPairPresent && confMixIfTOrVOPartsPresent)) { + LOG(fatal) << "Only one method of mixing can be chosen!"; + } + } + + template + void fillCollision(CollisionType col) + { + threeBodyQARegistry.fill(HIST("TripletTaskQA/hSECollisionBins"), colBinning.getBin({col.posZ(), col.multNtr()})); + eventHisto.fillQA(col); + } + + /// This function processes the same event and takes care of all the histogramming + /// @tparam PartitionType + /// @tparam PartType + /// @tparam isMC: enables Monte Carlo truth specific histograms + /// @param groupSelectedTracks partition for the first particle passed by the process function + /// @param parts femtoDreamParticles table (in case of Monte Carlo joined with FemtoDreamMCLabels) + /// @param magFieldTesla magnetic field of the collision + /// @param multCol multiplicity of the collision + template + void doSameEvent(PartitionType groupSelectedTracks, PartitionType groupselectedV0s, PartType parts, float magFieldTesla, int multCol, float centCol) + { + /// Histograming tracks + for (const auto& part : groupSelectedTracks) { + trackHistoselectedParts.fillQA(part, aod::femtodreamparticle::kPt, multCol, centCol); + } + /// Histograming V0s + for (const auto& V0 : groupselectedV0s) { + const auto& posChild = parts.iteratorAt(V0.index() - 2); + const auto& negChild = parts.iteratorAt(V0.index() - 1); + + if (((posChild.cut() & confChildPosCutV0) == confChildPosCutV0 && + (posChild.pidcut() & confChildPosTPCBitV0) == confChildPosTPCBitV0 && + (negChild.cut() & confChildNegCutV0) == confChildNegCutV0 && + (negChild.pidcut() & confChildNegTPCBitV0) == confChildNegTPCBitV0)) { + particleHistoselectedV0s.fillQA(V0, aod::femtodreamparticle::kPt, multCol, centCol); + particleHistoPosChild.fillQA(posChild, aod::femtodreamparticle::kPt, multCol, centCol); + particleHistoNegChild.fillQA(negChild, aod::femtodreamparticle::kPt, multCol, centCol); + } + } + + /// Now build the combinations + for (const auto& V0 : groupselectedV0s) { + const auto& posChild = parts.iteratorAt(V0.index() - 2); + const auto& negChild = parts.iteratorAt(V0.index() - 1); + + const auto& childrenPos = posChild.childrenIds(); + const auto& childrenNeg = negChild.childrenIds(); + auto posID = childrenPos[0]; + auto negID = childrenNeg[1]; + threeBodyQARegistry.fill(HIST("TripletTaskQA/hTestPairCleaner"), posID, negID); + + if (!((posChild.cut() & confChildPosCutV0) == confChildPosCutV0 && + (posChild.pidcut() & confChildPosTPCBitV0) == confChildPosTPCBitV0 && + (negChild.cut() & confChildNegCutV0) == confChildNegCutV0 && + (negChild.pidcut() & confChildNegTPCBitV0) == confChildNegTPCBitV0)) { + continue; + } + + for (const auto& [T1, T2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupSelectedTracks, groupSelectedTracks))) { + threeBodyQARegistry.fill(HIST("TripletTaskQA/hTestPairCleanerPos"), T1.index(), posID); + threeBodyQARegistry.fill(HIST("TripletTaskQA/hTestPairCleanerNeg"), T1.index(), negID); + threeBodyQARegistry.fill(HIST("TripletTaskQA/hTestPairCleanerPos"), T2.index(), posID); + threeBodyQARegistry.fill(HIST("TripletTaskQA/hTestPairCleanerNeg"), T2.index(), negID); + threeBodyQARegistry.fill(HIST("TripletTaskQA/hTestPairCleanerPosGlobal"), T1.globalIndex(), posID); + threeBodyQARegistry.fill(HIST("TripletTaskQA/hTestPairCleanerNegGlobal"), T1.globalIndex(), negID); + threeBodyQARegistry.fill(HIST("TripletTaskQA/hTestPairCleanerPosGlobal"), T2.globalIndex(), posID); + threeBodyQARegistry.fill(HIST("TripletTaskQA/hTestPairCleanerNegGlobal"), T2.globalIndex(), negID); + auto q3 = FemtoDreamMath::getQ3(T1, mMassOne, T2, mMassTwo, V0, mMassThree); + // Close pair rejection + if (confIsCPR.value) { + if (pairCloseRejectionTrackTrackSE.isClosePair(T1, T2, parts, magFieldTesla, q3)) { + continue; + } + if (pairCloseRejectionTrackV0SE.isClosePair(T1, V0, parts, magFieldTesla, q3)) { + continue; + } + if (pairCloseRejectionTrackV0SE.isClosePair(T2, V0, parts, magFieldTesla, q3)) { + continue; + } + } + + // track cleaning + if (!pairCleanerTrackTrack.isCleanPair(T1, T2, parts)) { + continue; + } + if (!pairCleanerTrackV0.isCleanPair(T2, V0, parts)) { + continue; + } + if (!pairCleanerTrackV0.isCleanPair(T1, V0, parts)) { + continue; + } + threeBodyQARegistry.fill(HIST("TripletTaskQA/hTestPairCleanerPosAfter"), T1.index(), posID); + threeBodyQARegistry.fill(HIST("TripletTaskQA/hTestPairCleanerNegAfter"), T1.index(), negID); + threeBodyQARegistry.fill(HIST("TripletTaskQA/hTestPairCleanerPosAfter"), T2.index(), posID); + threeBodyQARegistry.fill(HIST("TripletTaskQA/hTestPairCleanerNegAfter"), T2.index(), negID); + // fill inv Mass as a function of Q3 for purity fits + threeBodyQARegistry.fill(HIST("TripletTaskQA/hMinvSE_Lambda"), q3, V0.mLambda()); + threeBodyQARegistry.fill(HIST("TripletTaskQA/hMinvSE_AntiLambda"), q3, V0.mAntiLambda()); + threeBodyQARegistry.fill(HIST("TripletTaskQA/particle_pT_in_Triplet_SE"), T1.pt(), T2.pt(), V0.pt(), q3); + sameEventCont.setTriplet(T1, T2, V0, multCol, q3); + threeBodyQARegistry.fill(HIST("TripletTaskQA/hCentrality"), centCol, q3); + } + } + } + + /// process function to call doSameEvent with Data + /// \param col subscribe to the collision table (Data) + /// \param parts subscribe to the femtoDreamParticleTable + void processSameEvent(const FilteredFDCollision& col, const o2::aod::FDParticles& parts) + { + fillCollision(col); + auto thegroupSelectedTracks = selectedParts->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); + for (const auto& part : thegroupSelectedTracks) { + trackHistoALLselectedParts.fillQA(part, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + } + auto thegroupselectedV0s = selectedV0s->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); /// Histograming V0s + for (const auto& V0 : thegroupselectedV0s) { + const auto& posChild = parts.iteratorAt(V0.index() - 2); + const auto& negChild = parts.iteratorAt(V0.index() - 1); + + if (((posChild.cut() & confChildPosCutV0) == confChildPosCutV0 && + (posChild.pidcut() & confChildPosTPCBitV0) == confChildPosTPCBitV0 && + (negChild.cut() & confChildNegCutV0) == confChildNegCutV0 && + (negChild.pidcut() & confChildNegTPCBitV0) == confChildNegTPCBitV0)) { + particleHistoALLselectedV0s.fillQA(V0, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + particleHistoALLPosChild.fillQA(posChild, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + particleHistoALLNegChild.fillQA(negChild, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + } + } + if (thegroupSelectedTracks.size() < confMinTrackNumber || thegroupselectedV0s.size() < confMinV0Number) { + return; + } + doSameEvent(thegroupSelectedTracks, thegroupselectedV0s, parts, col.magField(), col.multNtr(), col.multV0M()); + } + PROCESS_SWITCH(FemtoDreamTripletTaskTrackTrackV0PbPb, processSameEvent, "Enable processing same event", true); + + /// process function to call doSameEvent with Data which has a mask for containing particles or not + /// \param col subscribe to the collision table (Data) + /// \param parts subscribe to the femtoDreamParticleTable + void processSameEventMasked(const MaskedCollision& col, const o2::aod::FDParticles& parts) + { + fillCollision(col); + auto thegroupSelectedTracks = selectedParts->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); + for (const auto& part : thegroupSelectedTracks) { + trackHistoALLselectedParts.fillQA(part, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + } + auto thegroupselectedV0s = selectedV0s->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); + for (const auto& V0 : thegroupselectedV0s) { + const auto& posChild = parts.iteratorAt(V0.index() - 2); + const auto& negChild = parts.iteratorAt(V0.index() - 1); + + if (((posChild.cut() & confChildPosCutV0) == confChildPosCutV0 && + (posChild.pidcut() & confChildPosTPCBitV0) == confChildPosTPCBitV0 && + (negChild.cut() & confChildNegCutV0) == confChildNegCutV0 && + (negChild.pidcut() & confChildNegTPCBitV0) == confChildNegTPCBitV0)) { + particleHistoALLselectedV0s.fillQA(V0, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + particleHistoALLPosChild.fillQA(posChild, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + particleHistoALLNegChild.fillQA(negChild, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + } + } + if (thegroupSelectedTracks.size() < confMinTrackNumber || thegroupselectedV0s.size() < confMinV0Number) { + return; + } + doSameEvent(thegroupSelectedTracks, thegroupselectedV0s, parts, col.magField(), col.multNtr(), col.multV0M()); + } + PROCESS_SWITCH(FemtoDreamTripletTaskTrackTrackV0PbPb, processSameEventMasked, "Enable processing same event with masks", false); + + /// process function for to call doSameEvent with Monte Carlo + /// \param col subscribe to the collision table (Monte Carlo Reconstructed reconstructed) + /// \param parts subscribe to joined table FemtoDreamParticles and FemtoDreamMCLables to access Monte Carlo truth + /// \param FemtoDreamMCParticles subscribe to the Monte Carlo truth table + void processSameEventMC(const o2::aod::FDCollision& col, + const soa::Join& parts, + const o2::aod::FDMCParticles&) + { + fillCollision(col); + auto thegroupSelectedTracks = selectedPartsMC->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); + for (const auto& part : thegroupSelectedTracks) { + trackHistoALLselectedParts.fillQA(part, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + threeBodyQARegistry.fill(HIST("TrackMC_QA/hMazzachi"), part.fdMCParticle().pt(), (part.pt() - part.fdMCParticle().pt()) / part.fdMCParticle().pt()); + } + auto thegroupselectedV0s = selectedV0sMC->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); + for (const auto& V0 : thegroupselectedV0s) { + const auto& posChild = parts.iteratorAt(V0.index() - 2); + const auto& negChild = parts.iteratorAt(V0.index() - 1); + + if (((posChild.cut() & confChildPosCutV0) == confChildPosCutV0 && + (posChild.pidcut() & confChildPosTPCBitV0) == confChildPosTPCBitV0 && + (negChild.cut() & confChildNegCutV0) == confChildNegCutV0 && + (negChild.pidcut() & confChildNegTPCBitV0) == confChildNegTPCBitV0)) { + particleHistoALLselectedV0s.fillQA(V0, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + particleHistoALLPosChild.fillQA(posChild, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + particleHistoALLNegChild.fillQA(negChild, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + } + } + if (thegroupSelectedTracks.size() < confMinTrackNumber || thegroupselectedV0s.size() < confMinV0Number) { + return; + } + doSameEvent(thegroupSelectedTracks, thegroupselectedV0s, parts, col.magField(), col.multNtr(), col.multV0M()); + } + PROCESS_SWITCH(FemtoDreamTripletTaskTrackTrackV0PbPb, processSameEventMC, "Enable processing same event for Monte Carlo", false); + + /// process function for to call doSameEvent with Monte Carlo which has a mask for containing particles or not + /// \param col subscribe to the collision table (Monte Carlo Reconstructed reconstructed) + /// \param parts subscribe to joined table FemtoDreamParticles and FemtoDreamMCLables to access Monte Carlo truth + /// \param FemtoDreamMCParticles subscribe to the Monte Carlo truth table + void processSameEventMCMasked(const MaskedCollision& col, + const soa::Join& parts, + const o2::aod::FDMCParticles&) + { + fillCollision(col); + auto thegroupSelectedTracks = selectedPartsMC->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); + for (const auto& part : thegroupSelectedTracks) { + trackHistoALLselectedParts.fillQA(part, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + threeBodyQARegistry.fill(HIST("TrackMC_QA/hMazzachi"), part.fdMCParticle().pt(), (part.pt() - part.fdMCParticle().pt()) / part.fdMCParticle().pt()); + } + auto thegroupselectedV0s = selectedV0sMC->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); + for (const auto& V0 : thegroupselectedV0s) { + const auto& posChild = parts.iteratorAt(V0.index() - 2); + const auto& negChild = parts.iteratorAt(V0.index() - 1); + + if (((posChild.cut() & confChildPosCutV0) == confChildPosCutV0 && + (posChild.pidcut() & confChildPosTPCBitV0) == confChildPosTPCBitV0 && + (negChild.cut() & confChildNegCutV0) == confChildNegCutV0 && + (negChild.pidcut() & confChildNegTPCBitV0) == confChildNegTPCBitV0)) { + particleHistoALLselectedV0s.fillQA(V0, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + particleHistoALLPosChild.fillQA(posChild, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + particleHistoALLNegChild.fillQA(negChild, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + } + } + if (thegroupSelectedTracks.size() < confMinTrackNumber || thegroupselectedV0s.size() < confMinV0Number) { + return; + } + doSameEvent(thegroupSelectedTracks, thegroupselectedV0s, parts, col.magField(), col.multNtr(), col.multV0M()); + } + PROCESS_SWITCH(FemtoDreamTripletTaskTrackTrackV0PbPb, processSameEventMCMasked, "Enable processing same event for Monte Carlo", false); + + /// This function processes the mixed event + /// \tparam PartitionType + /// \tparam PartType + /// \tparam isMC: enables Monte Carlo truth specific histograms + /// \param groupPartsOne partition for the first particle passed by the process function + /// \param groupPartsTwo partition for the second particle passed by the process function + /// \param groupPartsThree partition for the third particle passed by the process function + /// \param parts femtoDreamParticles table (in case of Monte Carlo joined with FemtoDreamMCLabels) + /// \param magFieldTesla magnetic field of the collision + /// \param multCol multiplicity of the collision + template + void doMixedEvent(PartitionType groupPartsOne, PartitionType groupPartsTwo, PartitionType groupPartsThree, PartType parts, float magFieldTesla, int multCol) + { + for (const auto& [T1, T2, V0] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo, groupPartsThree))) { + const auto& posChild = parts.iteratorAt(V0.globalIndex() - 2); + const auto& negChild = parts.iteratorAt(V0.globalIndex() - 1); + + if (!((posChild.cut() & confChildPosCutV0) == confChildPosCutV0 && + (posChild.pidcut() & confChildPosTPCBitV0) == confChildPosTPCBitV0 && + (negChild.cut() & confChildNegCutV0) == confChildNegCutV0 && + (negChild.pidcut() & confChildNegTPCBitV0) == confChildNegTPCBitV0)) { + continue; + } + + auto q3 = FemtoDreamMath::getQ3(T1, mMassOne, T2, mMassTwo, V0, mMassThree); + // Close pair rejection + if (confIsCPR.value) { + if (pairCloseRejectionTrackTrackME.isClosePair(T1, T2, parts, magFieldTesla, q3)) { + continue; + } + if (pairCloseRejectionTrackV0ME.isClosePair(T1, V0, parts, magFieldTesla, q3)) { + continue; + } + if (pairCloseRejectionTrackV0ME.isClosePair(T2, V0, parts, magFieldTesla, q3)) { + continue; + } + } + + // fill inv Mass as a function of Q3 for purity fits + threeBodyQARegistry.fill(HIST("TripletTaskQA/hMinvME_Lambda"), q3, V0.mLambda()); + threeBodyQARegistry.fill(HIST("TripletTaskQA/hMinvME_AntiLambda"), q3, V0.mAntiLambda()); + threeBodyQARegistry.fill(HIST("TripletTaskQA/particle_pT_in_Triplet_ME"), T1.pt(), T2.pt(), V0.pt(), q3); + mixedEventCont.setTriplet(T1, T2, V0, multCol, q3); + } + } + + /// process function for to call doMixedEvent with Data + /// @param cols subscribe to the collisions table (Data) + /// @param parts subscribe to the femtoDreamParticleTable + void processMixedEvent(const FilteredFDCollisions& cols, + const o2::aod::FDParticles& parts) + { + for (const auto& [collision1, collision2, collision3] : soa::selfCombinations(colBinning, confNEventsMix, -1, cols, cols, cols)) { + const int multiplicityCol = collision1.multNtr(); + threeBodyQARegistry.fill(HIST("TripletTaskQA/hMECollisionBins"), colBinning.getBin({collision1.posZ(), multiplicityCol})); + threeBodyQARegistry.fill(HIST("TripletTaskQA/hCentralityME"), collision1.multV0M()); + threeBodyQARegistry.fill(HIST("TripletTaskQA/hCentralityME"), collision2.multV0M()); + threeBodyQARegistry.fill(HIST("TripletTaskQA/hCentralityME"), collision3.multV0M()); + + auto groupPartsOne = selectedParts->sliceByCached(aod::femtodreamparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupPartsTwo = selectedParts->sliceByCached(aod::femtodreamparticle::fdCollisionId, collision2.globalIndex(), cache); + auto groupPartsThree = selectedV0s->sliceByCached(aod::femtodreamparticle::fdCollisionId, collision3.globalIndex(), cache); + + const auto& magFieldTesla1 = collision1.magField(); + const auto& magFieldTesla2 = collision2.magField(); + const auto& magFieldTesla3 = collision3.magField(); + if ((magFieldTesla1 != magFieldTesla2) || (magFieldTesla2 != magFieldTesla3) || (magFieldTesla1 != magFieldTesla3)) { + continue; + } + + doMixedEvent(groupPartsOne, groupPartsTwo, groupPartsThree, parts, magFieldTesla1, multiplicityCol); + } + } + PROCESS_SWITCH(FemtoDreamTripletTaskTrackTrackV0PbPb, processMixedEvent, "Enable processing mixed events", true); + + /// process function for to call doMixedEvent with Data which has a mask for containing particles or not + /// @param cols subscribe to the collisions table (Data) + /// @param parts subscribe to the femtoDreamParticleTable + void processMixedEventMasked(const MaskedCollisions& cols, const o2::aod::FDParticles& parts) + { + if (confMixIfTripletPresent || confMixIfTVOPairPresent) { + Partition partitionMaskedCol1 = (confMixIfTripletPresent && (aod::femtodreamcollision::bitmaskTrackTwo & maskBit) == maskBit && (aod::femtodreamcollision::bitmaskTrackThree & maskBit) == maskBit) || + (confMixIfTVOPairPresent && (aod::femtodreamcollision::bitmaskTrackOne & maskBit) == maskBit && (aod::femtodreamcollision::bitmaskTrackThree & maskBit) == maskBit); + partitionMaskedCol1.bindTable(cols); + + for (const auto& [collision1, collision2, collision3] : soa::selfCombinations(colBinning, confNEventsMix, -1, *partitionMaskedCol1.mFiltered, *partitionMaskedCol1.mFiltered, *partitionMaskedCol1.mFiltered)) { + + const int multiplicityCol = collision1.multNtr(); + threeBodyQARegistry.fill(HIST("TripletTaskQA/hMECollisionBins"), colBinning.getBin({collision1.posZ(), multiplicityCol})); + threeBodyQARegistry.fill(HIST("TripletTaskQA/hCentralityME"), collision1.multV0M()); + threeBodyQARegistry.fill(HIST("TripletTaskQA/hCentralityME"), collision2.multV0M()); + threeBodyQARegistry.fill(HIST("TripletTaskQA/hCentralityME"), collision3.multV0M()); + + auto groupPartsOne = selectedParts->sliceByCached(aod::femtodreamparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupPartsTwo = selectedParts->sliceByCached(aod::femtodreamparticle::fdCollisionId, collision2.globalIndex(), cache); + auto groupPartsThree = selectedV0s->sliceByCached(aod::femtodreamparticle::fdCollisionId, collision3.globalIndex(), cache); + + const auto& magFieldTesla1 = collision1.magField(); + const auto& magFieldTesla2 = collision2.magField(); + const auto& magFieldTesla3 = collision3.magField(); + + if ((magFieldTesla1 != magFieldTesla2) || (magFieldTesla2 != magFieldTesla3) || (magFieldTesla1 != magFieldTesla3)) { + continue; + } + doMixedEvent(groupPartsOne, groupPartsTwo, groupPartsThree, parts, magFieldTesla1, multiplicityCol); + } + } else if (confMixIfTOrVOPartsPresent) { + Partition partitionMaskedColT = ((aod::femtodreamcollision::bitmaskTrackOne & maskBit) == maskBit); + Partition partitionMaskedColV0 = ((aod::femtodreamcollision::bitmaskTrackThree & maskBit) == maskBit); + partitionMaskedColT.bindTable(cols); + partitionMaskedColV0.bindTable(cols); + + for (const auto& [ColWithTrack1, ColWithTrack2, ColWithV0] : soa::combinations(soa::CombinationsBlockFullIndexPolicy(colBinning, confNEventsMix, -1, *partitionMaskedColT.mFiltered, *partitionMaskedColT.mFiltered, *partitionMaskedColV0.mFiltered))) { + if (ColWithTrack1.globalIndex() == ColWithTrack2.globalIndex() || ColWithTrack1.globalIndex() == ColWithV0.globalIndex() || ColWithTrack2.globalIndex() == ColWithV0.globalIndex()) { + continue; + } + if (ColWithTrack1.globalIndex() > ColWithTrack2.globalIndex()) { + continue; + } + const int multiplicityCol = ColWithTrack1.multNtr(); + threeBodyQARegistry.fill(HIST("TripletTaskQA/hMECollisionBins"), colBinning.getBin({ColWithTrack1.posZ(), multiplicityCol})); + + auto groupPartsOne = selectedParts->sliceByCached(aod::femtodreamparticle::fdCollisionId, ColWithTrack1.globalIndex(), cache); + auto groupPartsTwo = selectedParts->sliceByCached(aod::femtodreamparticle::fdCollisionId, ColWithTrack2.globalIndex(), cache); + auto groupPartsThree = selectedV0s->sliceByCached(aod::femtodreamparticle::fdCollisionId, ColWithV0.globalIndex(), cache); + + const auto& magFieldTesla1 = ColWithTrack1.magField(); + const auto& magFieldTesla2 = ColWithTrack2.magField(); + const auto& magFieldTesla3 = ColWithV0.magField(); + + if ((magFieldTesla1 != magFieldTesla2) || (magFieldTesla2 != magFieldTesla3) || (magFieldTesla1 != magFieldTesla3)) { + continue; + } + doMixedEvent(groupPartsOne, groupPartsTwo, groupPartsThree, parts, magFieldTesla1, multiplicityCol); + } + } + } + PROCESS_SWITCH(FemtoDreamTripletTaskTrackTrackV0PbPb, processMixedEventMasked, "Enable processing mixed events", false); + + /// brief process function for to call doMixedEvent with Monte Carlo + /// @param cols subscribe to the collisions table (Monte Carlo Reconstructed reconstructed) + /// @param parts subscribe to joined table FemtoDreamParticles and FemtoDreamMCLables to access Monte Carlo truth + /// @param FemtoDreamMCParticles subscribe to the Monte Carlo truth table + void processMixedEventMC(const o2::aod::FDCollisions& cols, + const soa::Join& parts, + const o2::aod::FDMCParticles&) + { + for (const auto& [collision1, collision2, collision3] : soa::selfCombinations(colBinning, confNEventsMix, -1, cols, cols, cols)) { + + const int multiplicityCol = collision1.multNtr(); + threeBodyQARegistry.fill(HIST("TripletTaskQA/hMECollisionBins"), colBinning.getBin({collision1.posZ(), multiplicityCol})); + + auto groupPartsOne = selectedPartsMC->sliceByCached(aod::femtodreamparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupPartsTwo = selectedPartsMC->sliceByCached(aod::femtodreamparticle::fdCollisionId, collision2.globalIndex(), cache); + auto groupPartsThree = selectedV0sMC->sliceByCached(aod::femtodreamparticle::fdCollisionId, collision3.globalIndex(), cache); + + const auto& magFieldTesla1 = collision1.magField(); + const auto& magFieldTesla2 = collision2.magField(); + const auto& magFieldTesla3 = collision3.magField(); + + if ((magFieldTesla1 != magFieldTesla2) || (magFieldTesla2 != magFieldTesla3) || (magFieldTesla1 != magFieldTesla3)) { + continue; + } + // CONSIDER testing different strategies to which events to use + + doMixedEvent(groupPartsOne, groupPartsTwo, groupPartsThree, parts, magFieldTesla1, multiplicityCol); + } + } + PROCESS_SWITCH(FemtoDreamTripletTaskTrackTrackV0PbPb, processMixedEventMC, "Enable processing mixed events MC", false); + + /// brief process function for to call doMixedEvent with Monte Carlo which has a mask for containing particles or not + /// @param cols subscribe to the collisions table (Monte Carlo Reconstructed reconstructed) + /// @param parts subscribe to joined table FemtoDreamParticles and FemtoDreamMCLables to access Monte Carlo truth + /// @param FemtoDreamMCParticles subscribe to the Monte Carlo truth table + void processMixedEventMCMasked(const MaskedCollisions& cols, + const soa::Join& parts, + const o2::aod::FDMCParticles&) + { + if (confMixIfTripletPresent || confMixIfTVOPairPresent) { + Partition partitionMaskedCol1 = (confMixIfTripletPresent && (aod::femtodreamcollision::bitmaskTrackTwo & maskBit) == maskBit && (aod::femtodreamcollision::bitmaskTrackThree & maskBit) == maskBit) || + (confMixIfTVOPairPresent && (aod::femtodreamcollision::bitmaskTrackOne & maskBit) == maskBit && (aod::femtodreamcollision::bitmaskTrackThree & maskBit) == maskBit); + partitionMaskedCol1.bindTable(cols); + + for (const auto& [collision1, collision2, collision3] : soa::selfCombinations(colBinning, confNEventsMix, -1, *partitionMaskedCol1.mFiltered, *partitionMaskedCol1.mFiltered, *partitionMaskedCol1.mFiltered)) { + const int multiplicityCol = collision1.multNtr(); + threeBodyQARegistry.fill(HIST("TripletTaskQA/hMECollisionBins"), colBinning.getBin({collision1.posZ(), multiplicityCol})); + + auto groupPartsOne = selectedPartsMC->sliceByCached(aod::femtodreamparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupPartsTwo = selectedPartsMC->sliceByCached(aod::femtodreamparticle::fdCollisionId, collision2.globalIndex(), cache); + auto groupPartsThree = selectedV0sMC->sliceByCached(aod::femtodreamparticle::fdCollisionId, collision3.globalIndex(), cache); + + const auto& magFieldTesla1 = collision1.magField(); + const auto& magFieldTesla2 = collision2.magField(); + const auto& magFieldTesla3 = collision3.magField(); + + if ((magFieldTesla1 != magFieldTesla2) || (magFieldTesla2 != magFieldTesla3) || (magFieldTesla1 != magFieldTesla3)) { + continue; + } + doMixedEvent(groupPartsOne, groupPartsTwo, groupPartsThree, parts, magFieldTesla1, multiplicityCol); + } + } else if (confMixIfTOrVOPartsPresent) { + Partition partitionMaskedColT = ((aod::femtodreamcollision::bitmaskTrackOne & maskBit) == maskBit); + Partition partitionMaskedColV0 = ((aod::femtodreamcollision::bitmaskTrackThree & maskBit) == maskBit); + partitionMaskedColT.bindTable(cols); + partitionMaskedColV0.bindTable(cols); + + for (const auto& [ColWithTrack1, ColWithTrack2, ColWithV0] : soa::combinations(soa::CombinationsBlockFullIndexPolicy(colBinning, confNEventsMix, -1, *partitionMaskedColT.mFiltered, *partitionMaskedColT.mFiltered, *partitionMaskedColV0.mFiltered))) { + if (ColWithTrack1.globalIndex() == ColWithTrack2.globalIndex() || ColWithTrack1.globalIndex() == ColWithV0.globalIndex() || ColWithTrack2.globalIndex() == ColWithV0.globalIndex()) { + continue; + } + if (ColWithTrack1.globalIndex() > ColWithTrack2.globalIndex()) { + continue; + } + const int multiplicityCol = ColWithTrack1.multNtr(); + threeBodyQARegistry.fill(HIST("TripletTaskQA/hMECollisionBins"), colBinning.getBin({ColWithTrack1.posZ(), multiplicityCol})); + + auto groupPartsOne = selectedPartsMC->sliceByCached(aod::femtodreamparticle::fdCollisionId, ColWithTrack1.globalIndex(), cache); + auto groupPartsTwo = selectedPartsMC->sliceByCached(aod::femtodreamparticle::fdCollisionId, ColWithTrack2.globalIndex(), cache); + auto groupPartsThree = selectedV0sMC->sliceByCached(aod::femtodreamparticle::fdCollisionId, ColWithV0.globalIndex(), cache); + + const auto& magFieldTesla1 = ColWithTrack1.magField(); + const auto& magFieldTesla2 = ColWithTrack2.magField(); + const auto& magFieldTesla3 = ColWithV0.magField(); + + if ((magFieldTesla1 != magFieldTesla2) || (magFieldTesla2 != magFieldTesla3) || (magFieldTesla1 != magFieldTesla3)) { + continue; + } + doMixedEvent(groupPartsOne, groupPartsTwo, groupPartsThree, parts, magFieldTesla1, multiplicityCol); + } + } + } + PROCESS_SWITCH(FemtoDreamTripletTaskTrackTrackV0PbPb, processMixedEventMCMasked, "Enable processing mixed events MC", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{ + adaptAnalysisTask(cfgc), + }; + return workflow; +} From 5ddd747750c15ee4ed87619fa11025195802eec9 Mon Sep 17 00:00:00 2001 From: Yuanjing Ji Date: Mon, 15 Sep 2025 14:06:53 +0200 Subject: [PATCH 404/986] [PWGDQ] Fix bug: no AssocsCorrectBarrel entries for single MC tracks (#12922) Co-authored-by: Yuanjing Ji Co-authored-by: Yuanjing Ji --- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index 8a41665c038..b9ddcf2fb0d 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -607,10 +607,8 @@ struct AnalysisTrackSelection { VarManager::ResetValues(0, VarManager::kNBarrelTrackVariables); // fill event information which might be needed in histograms/cuts that combine track and event properties VarManager::FillEvent(event); - ReducedMCEvent* eventMC = nullptr; if (event.has_reducedMCevent()) { - auto eventMC = event.reducedMCevent(); - VarManager::FillEvent(eventMC); + VarManager::FillEvent(event.reducedMCevent()); } auto track = assoc.template reducedtrack_as(); @@ -622,8 +620,8 @@ struct AnalysisTrackSelection { if (track.has_reducedMCTrack()) { auto trackMC = track.reducedMCTrack(); auto eventMCfromTrack = trackMC.reducedMCevent(); - if (eventMC != nullptr) { - isCorrectAssoc = (eventMCfromTrack.globalIndex() == eventMC->globalIndex()); + if (event.has_reducedMCevent()) { + isCorrectAssoc = (eventMCfromTrack.globalIndex() == event.reducedMCevent().globalIndex()); } VarManager::FillTrackMC(tracksMC, trackMC); } From aeea6042af308ffbe6c8c446e6f9e8a7313dcc21 Mon Sep 17 00:00:00 2001 From: mcoquet642 <74600025+mcoquet642@users.noreply.github.com> Date: Mon, 15 Sep 2025 17:19:37 +0200 Subject: [PATCH 405/986] [PWGDQ] Implementing usage of mft covariance matrices (#12769) Co-authored-by: Maurice Coquet Co-authored-by: ALICE Action Bot Co-authored-by: Maurice Coquet Co-authored-by: Maurice Coquet Co-authored-by: Maurice Coquet --- PWGDQ/Core/VarManager.h | 35 ++++- .../TableProducer/tableMakerMC_withAssoc.cxx | 74 ++++++++--- PWGDQ/TableProducer/tableMaker_withAssoc.cxx | 121 ++++++++++++++---- 3 files changed, 181 insertions(+), 49 deletions(-) diff --git a/PWGDQ/Core/VarManager.h b/PWGDQ/Core/VarManager.h index 130634f60b9..f5b7b67f16c 100644 --- a/PWGDQ/Core/VarManager.h +++ b/PWGDQ/Core/VarManager.h @@ -28,6 +28,7 @@ #include "Common/CCDB/TriggerAliases.h" #include "Common/Core/CollisionTypeHelper.h" #include "Common/Core/EventPlaneHelper.h" +#include "Common/Core/fwdtrackUtilities.h" #include "Common/Core/trackUtilities.h" #include "CommonConstants/LHCConstants.h" @@ -134,7 +135,8 @@ class VarManager : public TObject ReducedTrackCollInfo = BIT(24), // TODO: remove it once new reduced data tables are produced for dielectron with ReducedTracksBarrelInfo ReducedMuonCollInfo = BIT(25), // TODO: remove it once new reduced data tables are produced for dielectron with ReducedTracksBarrelInfo MuonRealign = BIT(26), - MuonCovRealign = BIT(27) + MuonCovRealign = BIT(27), + MFTCov = BIT(28) }; enum PairCandidateType { @@ -1081,6 +1083,8 @@ class VarManager : public TObject static void FillPairPropagateMuon(T1 const& muon1, T2 const& muon2, const C& collision, float* values = nullptr); template static void FillGlobalMuonRefit(T1 const& muontrack, T2 const& mfttrack, const C& collision, float* values = nullptr); + template + static void FillGlobalMuonRefitCov(T1 const& muontrack, T2 const& mfttrack, const C& collision, C2 const& mftcov, float* values = nullptr); template static void FillPair(T1 const& t1, T2 const& t2, float* values = nullptr); template @@ -1478,6 +1482,35 @@ void VarManager::FillGlobalMuonRefit(T1 const& muontrack, T2 const& mfttrack, co } } +template +void VarManager::FillGlobalMuonRefitCov(T1 const& muontrack, T2 const& mfttrack, const C& collision, C2 const& mftcov, float* values) +{ + if (!values) { + values = fgValues; + } + if constexpr ((MuonfillMap & MuonCov) > 0) { + if constexpr ((MFTfillMap & MFTCov) > 0) { + o2::dataformats::GlobalFwdTrack propmuon = PropagateMuon(muontrack, collision); + SMatrix5 tpars(mfttrack.x(), mfttrack.y(), mfttrack.phi(), mfttrack.tgl(), mfttrack.signed1Pt()); + std::vector v1{mftcov.cXX(), mftcov.cXY(), mftcov.cYY(), mftcov.cPhiX(), mftcov.cPhiY(), + mftcov.cPhiPhi(), mftcov.cTglX(), mftcov.cTglY(), mftcov.cTglPhi(), mftcov.cTglTgl(), + mftcov.c1PtX(), mftcov.c1PtY(), mftcov.c1PtPhi(), mftcov.c1PtTgl(), mftcov.c1Pt21Pt2()}; + SMatrix55 tcovs(v1.begin(), v1.end()); + o2::track::TrackParCovFwd mft{mfttrack.z(), tpars, tcovs, mfttrack.chi2()}; + + o2::dataformats::GlobalFwdTrack globalRefit = o2::aod::fwdtrackutils::refitGlobalMuonCov(propmuon, mft); + values[kX] = globalRefit.getX(); + values[kY] = globalRefit.getY(); + values[kZ] = globalRefit.getZ(); + values[kTgl] = globalRefit.getTgl(); + values[kPt] = globalRefit.getPt(); + values[kPz] = globalRefit.getPz(); + values[kEta] = globalRefit.getEta(); + values[kPhi] = globalRefit.getPhi(); + } + } +} + template void VarManager::FillBC(T const& bc, float* values) { diff --git a/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx b/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx index ad48874301e..a3c257652fd 100644 --- a/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx +++ b/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx @@ -111,6 +111,7 @@ constexpr static uint32_t gkMuonRealignFillMapWithCov = VarManager::ObjTypes::Mu // constexpr static uint32_t gkMuonFillMapWithCovAmbi = VarManager::ObjTypes::Muon | VarManager::ObjTypes::MuonCov | VarManager::ObjTypes::AmbiMuon; // constexpr static uint32_t gkTrackFillMapWithAmbi = VarManager::ObjTypes::Track | VarManager::ObjTypes::AmbiTrack; constexpr static uint32_t gkMFTFillMap = VarManager::ObjTypes::TrackMFT; +constexpr static uint32_t gkMFTCovFillMap = VarManager::ObjTypes::TrackMFT | VarManager::ObjTypes::MFTCov; template void PrintBitMap(TMap map, int nbits) @@ -237,13 +238,14 @@ struct TableMakerMC { std::map fMftIndexMap; // key: MFT tracklet global index, value: new MFT tracklet global index std::map fBestMatch; + std::unordered_map map_mfttrackcovs; void init(o2::framework::InitContext& context) { // Check whether barrel or muon are enabled bool isProcessBCenabled = context.mOptions.get("processPP"); bool isBarrelEnabled = (context.mOptions.get("processPP") || context.mOptions.get("processPPBarrelOnly") || context.mOptions.get("processPbPbBarrelOnly") || context.mOptions.get("processPbPbWithFilterBarrelOnly")); - bool isMuonEnabled = (context.mOptions.get("processPP") || context.mOptions.get("processPPMuonOnlyBasic") || context.mOptions.get("processPPMuonOnly") || context.mOptions.get("processPPRealignedMuonOnly") || context.mOptions.get("processPbPbMuonOnly") || context.mOptions.get("processPbPbRealignedMuonOnly")); + bool isMuonEnabled = (context.mOptions.get("processPP") || context.mOptions.get("processPPMuonOnlyBasic") || context.mOptions.get("processPPMuonOnly") || context.mOptions.get("processPPRealignedMuonOnly") || context.mOptions.get("processPbPbMuonOnly") || context.mOptions.get("processPbPbRealignedMuonOnly")) || context.mOptions.get("processPPMuonRefit"); // Make sure at least one process function is enabled if (!(isProcessBCenabled || isBarrelEnabled || isMuonEnabled)) { LOG(fatal) << "No process function was enabled for TableMakerMC. Check it out!!!"; @@ -894,8 +896,8 @@ struct TableMakerMC { } } - template - void skimMuons(TEvent const& collision, TMuons const& muons, FwdTrackAssoc const& muonAssocs, aod::McParticles const& mcTracks, TMFTTracks const& /*mftTracks*/) + template + void skimMuons(TEvent const& collision, TMuons const& muons, FwdTrackAssoc const& muonAssocs, aod::McParticles const& mcTracks, TMFTTracks const& /*mftTracks*/, TMFTCovs const& mfCovs) { // Skim the fwd-tracks (muons) // Loop over the collision-track associations, recompute track properties depending on the collision assigned, and apply track cuts for selection @@ -942,7 +944,12 @@ struct TableMakerMC { } auto mfttrack = muon.template matchMFTTrack_as(); VarManager::FillTrackCollision(muontrack, collision); - VarManager::FillGlobalMuonRefit(muontrack, mfttrack, collision); + if constexpr (static_cast(TMFTFillMap & VarManager::ObjTypes::MFTCov)) { + auto const& mfttrackcov = mfCovs.rawIteratorAt(map_mfttrackcovs[mfttrack.globalIndex()]); + VarManager::FillGlobalMuonRefitCov(muontrack, mfttrack, collision, mfttrackcov); + } else { + VarManager::FillGlobalMuonRefit(muontrack, mfttrack, collision); + } } else { VarManager::FillTrackCollision(muon, collision); } @@ -1059,16 +1066,23 @@ struct TableMakerMC { VarManager::FillPropagateMuon(muon, collision); } // recalculte pDca and global muon kinematics + int globalClusters = muon.nClusters(); if (static_cast(muon.trackType()) < 2 && fConfigVariousOptions.fRefitGlobalMuon) { auto muontrack = muon.template matchMCHTrack_as(); auto mfttrack = muon.template matchMFTTrack_as(); + globalClusters += mfttrack.nClusters(); VarManager::FillTrackCollision(muontrack, collision); - VarManager::FillGlobalMuonRefit(muontrack, mfttrack, collision); + if constexpr (static_cast(TMFTFillMap & VarManager::ObjTypes::MFTCov)) { + auto const& mfttrackcov = mfCovs.rawIteratorAt(map_mfttrackcovs[mfttrack.globalIndex()]); + VarManager::FillGlobalMuonRefitCov(muontrack, mfttrack, collision, mfttrackcov); + } else { + VarManager::FillGlobalMuonRefit(muontrack, mfttrack, collision); + } } else { VarManager::FillTrackCollision(muon, collision); } muonBasic(reducedEventIdx, mchIdx, mftIdx, fFwdTrackFilterMap[muon.globalIndex()], VarManager::fgValues[VarManager::kPt], VarManager::fgValues[VarManager::kEta], VarManager::fgValues[VarManager::kPhi], muon.sign(), 0); - muonExtra(muon.nClusters(), VarManager::fgValues[VarManager::kMuonPDca], VarManager::fgValues[VarManager::kMuonRAtAbsorberEnd], + muonExtra(globalClusters, VarManager::fgValues[VarManager::kMuonPDca], VarManager::fgValues[VarManager::kMuonRAtAbsorberEnd], VarManager::fgValues[VarManager::kMuonChi2], muon.chi2MatchMCHMID(), muon.chi2MatchMCHMFT(), muon.matchScoreMCHMFT(), muon.mchBitMap(), muon.midBitMap(), @@ -1090,11 +1104,11 @@ struct TableMakerMC { } // end skimMuons template + typename TMuons, typename TMFTTracks, typename TTrackAssoc, typename TFwdTrackAssoc, typename TMFTTrackAssoc, typename TMFTCov> void fullSkimming(TEvents const& collisions, BCsWithTimestamps const& bcs, TTracks const& tracksBarrel, TMuons const& muons, TMFTTracks const& mftTracks, TTrackAssoc const& trackAssocs, TFwdTrackAssoc const& fwdTrackAssocs, TMFTTrackAssoc const& mftAssocs, - aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) + aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles, TMFTCov const& mftCovs) { // Check whether the run changed and update CCDB if it did if (bcs.size() > 0 && fCurrentRun != bcs.begin().runNumber()) { @@ -1155,6 +1169,7 @@ struct TableMakerMC { // Clear index map and reserve memory for MFT tables if constexpr (static_cast(TMFTFillMap)) { fMftIndexMap.clear(); + map_mfttrackcovs.clear(); mftTrack.reserve(mftTracks.size()); mftTrackExtra.reserve(mftTracks.size()); mftAssoc.reserve(mftTracks.size()); @@ -1173,6 +1188,12 @@ struct TableMakerMC { muonLabels.reserve(muons.size()); } + if constexpr (static_cast(TMFTFillMap & VarManager::ObjTypes::MFTCov)) { + for (auto& mfttrackConv : mftCovs) { + map_mfttrackcovs[mfttrackConv.matchMFTTrackId()] = mfttrackConv.globalIndex(); + } + } + // loop over selected collisions and select the tracks and fwd tracks to be skimmed if (fCollIndexMap.size() > 0) { for (auto const& [origIdx, skimIdx] : fCollIndexMap) { @@ -1192,10 +1213,14 @@ struct TableMakerMC { if (fConfigVariousOptions.fKeepBestMatch) { skimBestMuonMatches(muons); } - skimMuons(collision, muons, groupedMuonIndices, mcParticles, mftTracks); + if constexpr (static_cast(TMFTFillMap & VarManager::ObjTypes::MFTCov)) { + skimMuons(collision, muons, groupedMuonIndices, mcParticles, mftTracks, mftCovs); + } else { + skimMuons(collision, muons, groupedMuonIndices, mcParticles, mftTracks, nullptr); + } } else { auto groupedMuonIndices = fwdTrackAssocs.sliceBy(fwdtrackIndicesPerCollision, origIdx); - skimMuons(collision, muons, groupedMuonIndices, mcParticles, nullptr); + skimMuons(collision, muons, groupedMuonIndices, mcParticles, nullptr, nullptr); } } } // end loop over skimmed collisions @@ -1344,14 +1369,14 @@ struct TableMakerMC { aod::TrackAssoc const& trackAssocs, aod::FwdTrackAssoc const& fwdTrackAssocs, aod::MFTTrackAssoc const& mftAssocs, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { - fullSkimming(collisions, bcs, tracksBarrel, tracksMuon, mftTracks, trackAssocs, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles); + fullSkimming(collisions, bcs, tracksBarrel, tracksMuon, mftTracks, trackAssocs, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles, nullptr); } void processPPBarrelOnly(MyEventsWithMults const& collisions, aod::BCsWithTimestamps const& bcs, MyBarrelTracksWithCov const& tracksBarrel, aod::TrackAssoc const& trackAssocs, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { - fullSkimming(collisions, bcs, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr, mcCollisions, mcParticles); + fullSkimming(collisions, bcs, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr, mcCollisions, mcParticles, nullptr); } void processPPMuonOnlyBasic(MyEvents const& collisions, aod::BCsWithTimestamps const& bcs, @@ -1359,7 +1384,7 @@ struct TableMakerMC { aod::FwdTrackAssoc const& fwdTrackAssocs, aod::MFTTrackAssoc const& mftAssocs, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { - fullSkimming(collisions, bcs, nullptr, tracksMuon, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles); + fullSkimming(collisions, bcs, nullptr, tracksMuon, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles, nullptr); } void processPPMuonOnly(MyEventsWithMults const& collisions, aod::BCsWithTimestamps const& bcs, @@ -1367,7 +1392,15 @@ struct TableMakerMC { aod::FwdTrackAssoc const& fwdTrackAssocs, aod::MFTTrackAssoc const& mftAssocs, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { - fullSkimming(collisions, bcs, nullptr, tracksMuon, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles); + fullSkimming(collisions, bcs, nullptr, tracksMuon, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles, nullptr); + } + + void processPPMuonRefit(MyEventsWithMults const& collisions, aod::BCsWithTimestamps const& bcs, + MyMuonsWithCov const& tracksMuon, MFTTrackLabeled const& mftTracks, + aod::FwdTrackAssoc const& fwdTrackAssocs, aod::MFTTrackAssoc const& mftAssocs, + aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles, aod::MFTTracksCov const& mftCovs) + { + fullSkimming(collisions, bcs, nullptr, tracksMuon, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles, mftCovs); } void processPPRealignedMuonOnly(MyEventsWithMults const& collisions, aod::BCsWithTimestamps const& bcs, @@ -1375,7 +1408,7 @@ struct TableMakerMC { aod::FwdTrackAssoc const& fwdTrackAssocs, aod::MFTTrackAssoc const& mftAssocs, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { - fullSkimming(collisions, bcs, nullptr, tracksMuon, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles); + fullSkimming(collisions, bcs, nullptr, tracksMuon, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles, nullptr); } void processPbPb(MyEventsWithCentAndMults const& collisions, aod::BCsWithTimestamps const& bcs, @@ -1383,21 +1416,21 @@ struct TableMakerMC { aod::TrackAssoc const& trackAssocs, aod::FwdTrackAssoc const& fwdTrackAssocs, aod::MFTTrackAssoc const& mftAssocs, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { - fullSkimming(collisions, bcs, tracksBarrel, tracksMuon, mftTracks, trackAssocs, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles); + fullSkimming(collisions, bcs, tracksBarrel, tracksMuon, mftTracks, trackAssocs, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles, nullptr); } void processPbPbBarrelOnly(MyEventsWithCentAndMults const& collisions, aod::BCsWithTimestamps const& bcs, MyBarrelTracksWithCov const& tracksBarrel, aod::TrackAssoc const& trackAssocs, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { - fullSkimming(collisions, bcs, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr, mcCollisions, mcParticles); + fullSkimming(collisions, bcs, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr, mcCollisions, mcParticles, nullptr); } void processPbPbWithFilterBarrelOnly(MyEventsWithMultsAndRapidityGapFilter const& collisions, aod::BCsWithTimestamps const& bcs, MyBarrelTracksWithCov const& tracksBarrel, aod::TrackAssoc const& trackAssocs, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { - fullSkimming(collisions, bcs, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr, mcCollisions, mcParticles); + fullSkimming(collisions, bcs, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr, mcCollisions, mcParticles, nullptr); } void processPbPbMuonOnly(MyEventsWithCentAndMults const& collisions, aod::BCsWithTimestamps const& bcs, @@ -1405,7 +1438,7 @@ struct TableMakerMC { aod::FwdTrackAssoc const& fwdTrackAssocs, aod::MFTTrackAssoc const& mftAssocs, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { - fullSkimming(collisions, bcs, nullptr, tracksMuon, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles); + fullSkimming(collisions, bcs, nullptr, tracksMuon, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles, nullptr); } void processPbPbRealignedMuonOnly(MyEventsWithCentAndMults const& collisions, aod::BCsWithTimestamps const& bcs, @@ -1413,7 +1446,7 @@ struct TableMakerMC { aod::FwdTrackAssoc const& fwdTrackAssocs, aod::MFTTrackAssoc const& mftAssocs, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { - fullSkimming(collisions, bcs, nullptr, tracksMuon, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles); + fullSkimming(collisions, bcs, nullptr, tracksMuon, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles, nullptr); } // Process the BCs and store stats for luminosity retrieval ----------------------------------------------------------------------------------- @@ -1431,6 +1464,7 @@ struct TableMakerMC { PROCESS_SWITCH(TableMakerMC, processPPBarrelOnly, "Produce only barrel skims, pp settings ", false); PROCESS_SWITCH(TableMakerMC, processPPMuonOnlyBasic, "Produce only muon skims, pp settings, no multiplicity", false); PROCESS_SWITCH(TableMakerMC, processPPMuonOnly, "Produce only muon skims, pp settings", false); + PROCESS_SWITCH(TableMakerMC, processPPMuonRefit, "Produce only muon skims, pp settings", false); PROCESS_SWITCH(TableMakerMC, processPPRealignedMuonOnly, "Build realigned muon only DQ skimmed data model typically for pp/p-Pb and UPC Pb-Pb", false); PROCESS_SWITCH(TableMakerMC, processPbPb, "Produce both barrel and muon skims, PbPb settings", false); PROCESS_SWITCH(TableMakerMC, processPbPbBarrelOnly, "Produce only barrel skims, PbPb settings", false); diff --git a/PWGDQ/TableProducer/tableMaker_withAssoc.cxx b/PWGDQ/TableProducer/tableMaker_withAssoc.cxx index c72742c3225..97cf93bfd87 100644 --- a/PWGDQ/TableProducer/tableMaker_withAssoc.cxx +++ b/PWGDQ/TableProducer/tableMaker_withAssoc.cxx @@ -144,6 +144,7 @@ constexpr static uint32_t gkMuonRealignFillMapWithCov = VarManager::ObjTypes::Mu // constexpr static uint32_t gkMuonFillMapWithCovAmbi = VarManager::ObjTypes::Muon | VarManager::ObjTypes::MuonCov | VarManager::ObjTypes::AmbiMuon; // constexpr static uint32_t gkTrackFillMapWithAmbi = VarManager::ObjTypes::Track | VarManager::ObjTypes::AmbiTrack; constexpr static uint32_t gkMFTFillMap = VarManager::ObjTypes::TrackMFT; +constexpr static uint32_t gkMFTCovFillMap = VarManager::ObjTypes::TrackMFT | VarManager::ObjTypes::MFTCov; // Enum containing the ordering of statistics histograms to be written in the QA file enum SkimStatsHists { @@ -253,6 +254,7 @@ struct TableMaker { // Muon related options Configurable fPropMuon{"cfgPropMuon", true, "Propagate muon tracks through absorber (do not use if applying pairing)"}; Configurable fRefitGlobalMuon{"cfgRefitGlobalMuon", true, "Correct global muon parameters"}; + Configurable fKeepBestMatch{"cfgKeepBestMatch", false, "Keep only the best match global muons in the skimming"}; Configurable fMuonMatchEtaMin{"cfgMuonMatchEtaMin", -4.0f, "Definition of the acceptance of muon tracks to be matched with MFT"}; Configurable fMuonMatchEtaMax{"cfgMuonMatchEtaMax", -2.5f, "Definition of the acceptance of muon tracks to be matched with MFT"}; @@ -285,6 +287,8 @@ struct TableMaker { std::map fFwdTrackFilterMap; // key: fwd-track global index, value: fwd-track filter map std::map fMftIndexMap; // key: MFT tracklet global index, value: new MFT tracklet global index + std::map fBestMatch; + std::unordered_map map_mfttrackcovs; // FIXME: For now, the skimming is done using the Common track-collision association task, which does not allow to use // our own Filtered tracks. If the filter is very selective, then it may be worth to run the association in this workflow // using the Common/CollisionAssociation class @@ -1131,8 +1135,30 @@ struct TableMaker { } } - template - void skimMuons(TEvent const& collision, TBCs const& /*bcs*/, TMuons const& muons, FwdTrackAssoc const& muonAssocs, TMFTTracks const& /*mftTracks*/) + template + void skimBestMuonMatches(TMuons const& muons) + { + std::unordered_map> mCandidates; + for (const auto& muon : muons) { + if (static_cast(muon.trackType()) < 2) { + auto muonID = muon.matchMCHTrackId(); + auto chi2 = muon.chi2MatchMCHMFT(); + if (mCandidates.find(muonID) == mCandidates.end()) { + mCandidates[muonID] = {chi2, muon.globalIndex()}; + } else { + if (chi2 < mCandidates[muonID].first) { + mCandidates[muonID] = {chi2, muon.globalIndex()}; + } + } + } + } + for (auto& pairCand : mCandidates) { + fBestMatch[pairCand.second.second] = true; + } + } + + template + void skimMuons(TEvent const& collision, TBCs const& /*bcs*/, TMuons const& muons, FwdTrackAssoc const& muonAssocs, TMFTTracks const& /*mftTracks*/, TMFTCovs const& mfCovs) { // Skim the fwd-tracks (muons) // Loop over the collision-track associations, recompute track properties depending on the collision assigned, and apply track cuts for selection @@ -1150,6 +1176,11 @@ struct TableMaker { for (const auto& assoc : muonAssocs) { // get the muon auto muon = muons.rawIteratorAt(assoc.fwdtrackId()); + if (fConfigVariousOptions.fKeepBestMatch && static_cast(muon.trackType()) < 2) { + if (fBestMatch.find(muon.globalIndex()) == fBestMatch.end()) { + continue; + } + } trackFilteringTag = static_cast(0); trackTempFilterMap = static_cast(0); @@ -1174,11 +1205,16 @@ struct TableMaker { if (muontrack.eta() < fConfigVariousOptions.fMuonMatchEtaMin || muontrack.eta() > fConfigVariousOptions.fMuonMatchEtaMax) { continue; } + auto mfttrack = muon.template matchMFTTrack_as(); VarManager::FillTrackCollision(muontrack, collision); // NOTE: the MFT track originally associated to the MUON track is currently used in the global muon refit // Should MUON - MFT time ambiguities be taken into account ? - auto mfttrack = muon.template matchMFTTrack_as(); - VarManager::FillGlobalMuonRefit(muontrack, mfttrack, collision); + if constexpr (static_cast(TMFTFillMap & VarManager::ObjTypes::MFTCov)) { + auto const& mfttrackcov = mfCovs.rawIteratorAt(map_mfttrackcovs[mfttrack.globalIndex()]); + VarManager::FillGlobalMuonRefitCov(muontrack, mfttrack, collision, mfttrackcov); + } else { + VarManager::FillGlobalMuonRefit(muontrack, mfttrack, collision); + } } else { VarManager::FillTrackCollision(muon, collision); } @@ -1265,7 +1301,12 @@ struct TableMaker { auto mfttrack = muon.template matchMFTTrack_as(); globalClusters += mfttrack.nClusters(); VarManager::FillTrackCollision(muontrack, collision); - VarManager::FillGlobalMuonRefit(muontrack, mfttrack, collision); + if constexpr (static_cast(TMFTFillMap & VarManager::ObjTypes::MFTCov)) { + auto const& mfttrackcov = mfCovs.rawIteratorAt(map_mfttrackcovs[mfttrack.globalIndex()]); + VarManager::FillGlobalMuonRefitCov(muontrack, mfttrack, collision, mfttrackcov); + } else { + VarManager::FillGlobalMuonRefit(muontrack, mfttrack, collision); + } } else { VarManager::FillTrackCollision(muon, collision); } @@ -1289,10 +1330,10 @@ struct TableMaker { // Produce standard barrel + muon tables with event filter (typically for pp and p-Pb) ------------------------------------------------------ template + typename TTrackAssoc, typename TFwdTrackAssoc, typename TMFTTrackAssoc, typename TMFTCov> void fullSkimming(TEvents const& collisions, TBCs const& bcs, TZdcs const& zdcs, TTracks const& tracksBarrel, TMuons const& muons, TMFTTracks const& mftTracks, - TTrackAssoc const& trackAssocs, TFwdTrackAssoc const& fwdTrackAssocs, TMFTTrackAssoc const& mftAssocs) + TTrackAssoc const& trackAssocs, TFwdTrackAssoc const& fwdTrackAssocs, TMFTTrackAssoc const& mftAssocs, TMFTCov const& mftCovs) { if (bcs.size() > 0 && fCurrentRun != bcs.begin().runNumber()) { @@ -1363,6 +1404,7 @@ struct TableMaker { if constexpr (static_cast(TMFTFillMap)) { fMftIndexMap.clear(); + map_mfttrackcovs.clear(); mftTrack.reserve(mftTracks.size()); mftTrackExtra.reserve(mftTracks.size()); mftAssoc.reserve(mftTracks.size()); @@ -1371,6 +1413,7 @@ struct TableMaker { if constexpr (static_cast(TMuonFillMap)) { fFwdTrackIndexMap.clear(); fFwdTrackFilterMap.clear(); + fBestMatch.clear(); muonBasic.reserve(muons.size()); muonExtra.reserve(muons.size()); muonInfo.reserve(muons.size()); @@ -1378,6 +1421,12 @@ struct TableMaker { muonAssoc.reserve(muons.size()); } + if constexpr (static_cast(TMFTFillMap & VarManager::ObjTypes::MFTCov)) { + for (auto& mfttrackConv : mftCovs) { + map_mfttrackcovs[mfttrackConv.matchMFTTrackId()] = mfttrackConv.globalIndex(); + } + } + // loop over selected collisions, group the compatible associations, and run the skimming for (auto const& [origIdx, skimIdx] : fCollIndexMap) { auto collision = collisions.rawIteratorAt(origIdx); @@ -1395,10 +1444,17 @@ struct TableMaker { if constexpr (static_cast(TMuonFillMap)) { if constexpr (static_cast(TMFTFillMap)) { auto groupedMuonIndices = fwdTrackAssocs.sliceBy(fwdtrackIndicesPerCollision, origIdx); - skimMuons(collision, bcs, muons, groupedMuonIndices, mftTracks); + if (fConfigVariousOptions.fKeepBestMatch) { + skimBestMuonMatches(muons); + } + if constexpr (static_cast(TMFTFillMap & VarManager::ObjTypes::MFTCov)) { + skimMuons(collision, bcs, muons, groupedMuonIndices, mftTracks, mftCovs); + } else { + skimMuons(collision, bcs, muons, groupedMuonIndices, mftTracks, nullptr); + } } else { auto groupedMuonIndices = fwdTrackAssocs.sliceBy(fwdtrackIndicesPerCollision, origIdx); - skimMuons(collision, bcs, muons, groupedMuonIndices, nullptr); + skimMuons(collision, bcs, muons, groupedMuonIndices, nullptr, nullptr); } } } // end loop over skimmed collisions @@ -1415,7 +1471,7 @@ struct TableMaker { TrackAssoc const& trackAssocs, FwdTrackAssoc const& fwdTrackAssocs, MFTTrackAssoc const& mftAssocs) { - fullSkimming(collisions, bcs, nullptr, tracksBarrel, muons, mftTracks, trackAssocs, fwdTrackAssocs, mftAssocs); + fullSkimming(collisions, bcs, nullptr, tracksBarrel, muons, mftTracks, trackAssocs, fwdTrackAssocs, mftAssocs, nullptr); } // produce the barrel-only DQ skimmed data model typically for pp/p-Pb or UPC Pb-Pb (no centrality), subscribe to the DQ event filter (filter-pp or filter-PbPb) @@ -1423,14 +1479,14 @@ struct TableMaker { MyBarrelTracksWithCov const& tracksBarrel, TrackAssoc const& trackAssocs) { - fullSkimming(collisions, bcs, zdcs, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr); + fullSkimming(collisions, bcs, zdcs, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr, nullptr); } // produce the muon-only DQ skimmed data model typically for pp/p-Pb or UPC Pb-Pb (no centrality), subscribe to the DQ event filter (filter-pp or filter-PbPb) void processPPWithFilterMuonOnly(MyEventsWithMultsAndFilter const& collisions, BCsWithTimestamps const& bcs, MyMuonsWithCov const& muons, FwdTrackAssoc const& fwdTrackAssocs) { - fullSkimming(collisions, bcs, nullptr, nullptr, muons, nullptr, nullptr, fwdTrackAssocs, nullptr); + fullSkimming(collisions, bcs, nullptr, nullptr, muons, nullptr, nullptr, fwdTrackAssocs, nullptr, nullptr); } // produce the muon+mft DQ skimmed data model typically for pp/p-Pb or UPC Pb-Pb (no centrality), subscribe to the DQ event filter (filter-pp or filter-PbPb) @@ -1438,7 +1494,7 @@ struct TableMaker { MyMuonsWithCov const& muons, MFTTracks const& mftTracks, FwdTrackAssoc const& fwdTrackAssocs, MFTTrackAssoc const& mftAssocs) { - fullSkimming(collisions, bcs, nullptr, nullptr, muons, mftTracks, nullptr, fwdTrackAssocs, mftAssocs); + fullSkimming(collisions, bcs, nullptr, nullptr, muons, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, nullptr); } // produce the barrel-only DQ skimmed data model typically for pp/p-Pb or UPC Pb-Pb (no centrality), meant to run on skimmed data @@ -1446,7 +1502,7 @@ struct TableMaker { MyBarrelTracksWithCov const& tracksBarrel, TrackAssoc const& trackAssocs) { - fullSkimming(collisions, bcs, zdcs, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr); + fullSkimming(collisions, bcs, zdcs, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr, nullptr); } // produce the barrel-only DQ skimmed barrel data model, with V0 tagged tracks @@ -1454,21 +1510,21 @@ struct TableMaker { MyBarrelTracksWithV0BitsNoTOF const& tracksBarrel, TrackAssoc const& trackAssocs) { - fullSkimming(collisions, bcs, nullptr, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr); + fullSkimming(collisions, bcs, nullptr, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr, nullptr); } // produce the muon-only DQ skimmed data model typically for pp/p-Pb or UPC Pb-Pb (no centrality), meant to run on skimmed data void processPPMuonOnly(MyEventsWithMults const& collisions, BCsWithTimestamps const& bcs, MyMuonsWithCov const& muons, FwdTrackAssoc const& fwdTrackAssocs) { - fullSkimming(collisions, bcs, nullptr, nullptr, muons, nullptr, nullptr, fwdTrackAssocs, nullptr); + fullSkimming(collisions, bcs, nullptr, nullptr, muons, nullptr, nullptr, fwdTrackAssocs, nullptr, nullptr); } // produce the realigned muon-only DQ skimmed data model typically for pp/p-Pb or UPC Pb-Pb (no centrality), meant to run on skimmed data void processPPRealignedMuonOnly(MyEventsWithMults const& collisions, BCsWithTimestamps const& bcs, MyMuonsRealignWithCov const& muons, FwdTrackAssoc const& fwdTrackAssocs) { - fullSkimming(collisions, bcs, nullptr, nullptr, muons, nullptr, nullptr, fwdTrackAssocs, nullptr); + fullSkimming(collisions, bcs, nullptr, nullptr, muons, nullptr, nullptr, fwdTrackAssocs, nullptr, nullptr); } // produce the muon+mft DQ skimmed data model typically for pp/p-Pb or UPC Pb-Pb (no centrality), meant to run on skimmed data @@ -1476,7 +1532,7 @@ struct TableMaker { MyMuonsWithCov const& muons, MFTTracks const& mftTracks, FwdTrackAssoc const& fwdTrackAssocs, MFTTrackAssoc const& mftAssocs) { - fullSkimming(collisions, bcs, nullptr, nullptr, muons, mftTracks, nullptr, fwdTrackAssocs, mftAssocs); + fullSkimming(collisions, bcs, nullptr, nullptr, muons, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, nullptr); } // Central barrel multiplicity estimation @@ -1484,7 +1540,7 @@ struct TableMaker { MyMuonsWithCov const& muons, MFTTracks const& mftTracks, FwdTrackAssoc const& fwdTrackAssocs, MFTTrackAssoc const& mftAssocs) { - fullSkimming(collisions, bcs, nullptr, nullptr, muons, mftTracks, nullptr, fwdTrackAssocs, mftAssocs); + fullSkimming(collisions, bcs, nullptr, nullptr, muons, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, nullptr); } // produce the full DQ skimmed data model typically for Pb-Pb (with centrality), no subscribtion to the DQ event filter @@ -1494,7 +1550,7 @@ struct TableMaker { TrackAssoc const& trackAssocs, FwdTrackAssoc const& fwdTrackAssocs, MFTTrackAssoc const& mftAssocs) { - fullSkimming(collisions, bcs, nullptr, tracksBarrel, muons, mftTracks, trackAssocs, fwdTrackAssocs, mftAssocs); + fullSkimming(collisions, bcs, nullptr, tracksBarrel, muons, mftTracks, trackAssocs, fwdTrackAssocs, mftAssocs, nullptr); } // produce the barrel only DQ skimmed data model typically for Pb-Pb (with centrality), no subscribtion to the DQ event filter @@ -1502,7 +1558,7 @@ struct TableMaker { MyBarrelTracksWithCov const& tracksBarrel, TrackAssoc const& trackAssocs) { - fullSkimming(collisions, bcs, nullptr, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr); + fullSkimming(collisions, bcs, nullptr, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr, nullptr); } // produce the barrel only DQ skimmed data model typically for Pb-Pb (with centrality), no TOF @@ -1511,7 +1567,7 @@ struct TableMaker { TrackAssoc const& trackAssocs) { computeOccupancyEstimators(collisions, tracksPosWithCovNoTOF, tracksNegWithCovNoTOF, presliceWithCovNoTOF, bcs); - fullSkimming(collisions, bcs, nullptr, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr); + fullSkimming(collisions, bcs, nullptr, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr, nullptr); } // produce the barrel-only DQ skimmed data model typically for UPC Pb-Pb (no centrality), subscribe to the DQ rapidity gap event filter (filter-PbPb) @@ -1519,7 +1575,7 @@ struct TableMaker { MyBarrelTracksWithCov const& tracksBarrel, TrackAssoc const& trackAssocs) { - fullSkimming(collisions, bcs, zdcs, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr); + fullSkimming(collisions, bcs, zdcs, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr, nullptr); } // produce the barrel only DQ skimmed data model typically for Pb-Pb (with centrality), no subscribtion to the DQ event filter @@ -1528,7 +1584,7 @@ struct TableMaker { TrackAssoc const& trackAssocs) { computeOccupancyEstimators(collisions, tracksPos, tracksNeg, preslice, bcs); - fullSkimming(collisions, bcs, nullptr, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr); + fullSkimming(collisions, bcs, nullptr, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr, nullptr); } // produce the barrel only DQ skimmed data model typically for Pb-Pb (with centrality), no subscribtion to the DQ event filter @@ -1537,21 +1593,21 @@ struct TableMaker { TrackAssoc const& trackAssocs) { computeOccupancyEstimators(collisions, tracksPosNoTOF, tracksNegNoTOF, presliceNoTOF, bcs); - fullSkimming(collisions, bcs, nullptr, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr); + fullSkimming(collisions, bcs, nullptr, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr, nullptr); } // produce the muon only DQ skimmed data model typically for Pb-Pb (with centrality), no subscribtion to the DQ event filter void processPbPbMuonOnly(MyEventsWithCentAndMults const& collisions, BCsWithTimestamps const& bcs, MyMuonsWithCov const& muons, FwdTrackAssoc const& fwdTrackAssocs) { - fullSkimming(collisions, bcs, nullptr, nullptr, muons, nullptr, nullptr, fwdTrackAssocs, nullptr); + fullSkimming(collisions, bcs, nullptr, nullptr, muons, nullptr, nullptr, fwdTrackAssocs, nullptr, nullptr); } // produce the realigned muon only DQ skimmed data model typically for Pb-Pb (with centrality), no subscribtion to the DQ event filter void processPbPbRealignedMuonOnly(MyEventsWithCentAndMults const& collisions, BCsWithTimestamps const& bcs, MyMuonsRealignWithCov const& muons, FwdTrackAssoc const& fwdTrackAssocs) { - fullSkimming(collisions, bcs, nullptr, nullptr, muons, nullptr, nullptr, fwdTrackAssocs, nullptr); + fullSkimming(collisions, bcs, nullptr, nullptr, muons, nullptr, nullptr, fwdTrackAssocs, nullptr, nullptr); } // produce the muon+mft DQ skimmed data model typically for Pb-Pb (with centrality), no subscribtion to the DQ event filter @@ -1559,7 +1615,16 @@ struct TableMaker { MyMuonsWithCov const& muons, MFTTracks const& mftTracks, FwdTrackAssoc const& fwdTrackAssocs, MFTTrackAssoc const& mftAssocs) { - fullSkimming(collisions, bcs, nullptr, nullptr, muons, mftTracks, nullptr, fwdTrackAssocs, mftAssocs); + fullSkimming(collisions, bcs, nullptr, nullptr, muons, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, nullptr); + } + + // produce the muon+mft DQ skimmed data model typically including MFT covariances + void processPPMuonRefit(MyEventsWithMults const& collisions, BCsWithTimestamps const& bcs, + MyMuonsWithCov const& muons, MFTTracks const& mftTracks, + FwdTrackAssoc const& fwdTrackAssocs, MFTTrackAssoc const& mftAssocs, + aod::MFTTracksCov const& mftCovs) + { + fullSkimming(collisions, bcs, nullptr, nullptr, muons, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, mftCovs); } // Process the BCs and store stats for luminosity retrieval ----------------------------------------------------------------------------------- From 771ca9d81a7e0e89def214f0077c1f674a810941 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Mon, 15 Sep 2025 18:16:08 +0200 Subject: [PATCH 406/986] [PWGLF] Remove lf-propagation-service (#12984) --- .../TableProducer/Strangeness/CMakeLists.txt | 7 +- .../Strangeness/propagationService.cxx | 156 ------------------ 2 files changed, 1 insertion(+), 162 deletions(-) delete mode 100644 PWGLF/TableProducer/Strangeness/propagationService.cxx diff --git a/PWGLF/TableProducer/Strangeness/CMakeLists.txt b/PWGLF/TableProducer/Strangeness/CMakeLists.txt index b9ae33532f2..7a7366043d2 100644 --- a/PWGLF/TableProducer/Strangeness/CMakeLists.txt +++ b/PWGLF/TableProducer/Strangeness/CMakeLists.txt @@ -165,9 +165,4 @@ o2physics_add_dpl_workflow(stracents o2physics_add_dpl_workflow(lambdaspincorrelation SOURCES lambdaspincorrelation.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - -o2physics_add_dpl_workflow(propagationservice - SOURCES propagationService.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter KFParticle::KFParticle O2Physics::TPCDriftManager - COMPONENT_NAME Analysis) + COMPONENT_NAME Analysis) \ No newline at end of file diff --git a/PWGLF/TableProducer/Strangeness/propagationService.cxx b/PWGLF/TableProducer/Strangeness/propagationService.cxx deleted file mode 100644 index 191b920d9ef..00000000000 --- a/PWGLF/TableProducer/Strangeness/propagationService.cxx +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file propagationService.cxx -/// \brief -/// \author ALICE - -//=============================================================== -// -// Merged track propagation + strangeness building task -// -// Provides a common task to deal with track propagation and -// strangeness building in a single DPL device that is particularly -// adequate for pipelining. -// -// Currently meant for testing and performance check -// -//=============================================================== - -#include "PWGLF/Utils/strangenessBuilderModule.h" - -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/Tools/StandardCCDBLoader.h" -#include "Common/Tools/TrackPropagationModule.h" -#include "Common/Tools/TrackTuner.h" - -#include "CCDB/BasicCCDBManager.h" -#include "CCDB/CcdbApi.h" -#include "CommonConstants/GeomConstants.h" -#include "CommonUtils/NameConf.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DetectorsBase/GeometryManager.h" -#include "DetectorsBase/Propagator.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/DCA.h" - -#include - -using namespace o2; -using namespace o2::framework; -// using namespace o2::framework::expressions; - -// use parameters + cov mat non-propagated, aux info + (extension propagated) -using FullTracksExt = soa::Join; -using FullTracksExtIU = soa::Join; -using FullTracksExtWithPID = soa::Join; -using FullTracksExtIUWithPID = soa::Join; -using FullTracksExtLabeled = soa::Join; -using FullTracksExtLabeledIU = soa::Join; -using FullTracksExtLabeledWithPID = soa::Join; -using FullTracksExtLabeledIUWithPID = soa::Join; -using TracksWithExtra = soa::Join; - -// For dE/dx association in pre-selection -using TracksExtraWithPID = soa::Join; - -struct propagationService { - // CCDB boilerplate declarations - o2::framework::Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Service ccdb; - - // propagation stuff - o2::common::StandardCCDBLoaderConfigurables standardCCDBLoaderConfigurables; - o2::common::StandardCCDBLoader ccdbLoader; - - // boilerplate: strangeness builder stuff - o2::pwglf::strangenessbuilder::products products; - o2::pwglf::strangenessbuilder::coreConfigurables baseOpts; - o2::pwglf::strangenessbuilder::v0Configurables v0BuilderOpts; - o2::pwglf::strangenessbuilder::cascadeConfigurables cascadeBuilderOpts; - o2::pwglf::strangenessbuilder::preSelectOpts preSelectOpts; - o2::pwglf::strangenessbuilder::BuilderModule strangenessBuilderModule; - - // the track tuner object -> needs to be here as it inherits from ConfigurableGroup (+ has its own copy of ccdbApi) - TrackTuner trackTunerObj; - - // track propagation - o2::common::TrackPropagationProducts trackPropagationProducts; - o2::common::TrackPropagationConfigurables trackPropagationConfigurables; - o2::common::TrackPropagationModule trackPropagation; - - // registry - HistogramRegistry histos{"histos"}; - - void init(o2::framework::InitContext& initContext) - { - // CCDB boilerplate init - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - ccdb->setURL(ccdburl.value); - - // task-specific - trackPropagation.init(trackPropagationConfigurables, trackTunerObj, histos, initContext); - strangenessBuilderModule.init(baseOpts, v0BuilderOpts, cascadeBuilderOpts, preSelectOpts, histos, initContext); - } - - void processRealData(soa::Join const& collisions, aod::V0s const& v0s, aod::Cascades const& cascades, aod::TrackedCascades const& trackedCascades, FullTracksExtIU const& tracks, aod::BCsWithTimestamps const& bcs) - { - ccdbLoader.initCCDBfromBCs(standardCCDBLoaderConfigurables, ccdb, bcs); - trackPropagation.fillTrackTables(trackPropagationConfigurables, trackTunerObj, ccdbLoader, collisions, tracks, trackPropagationProducts, histos); - strangenessBuilderModule.dataProcess(ccdb, histos, collisions, static_cast(nullptr), v0s, cascades, trackedCascades, tracks, bcs, static_cast(nullptr), products); - } - - void processMonteCarlo(soa::Join const& collisions, aod::McCollisions const& mccollisions, aod::V0s const& v0s, aod::Cascades const& cascades, aod::TrackedCascades const& trackedCascades, FullTracksExtLabeledIU const& tracks, aod::BCsWithTimestamps const& bcs, aod::McParticles const& mcParticles) - { - ccdbLoader.initCCDBfromBCs(standardCCDBLoaderConfigurables, ccdb, bcs); - trackPropagation.fillTrackTables(trackPropagationConfigurables, trackTunerObj, ccdbLoader, collisions, tracks, trackPropagationProducts, histos); - strangenessBuilderModule.dataProcess(ccdb, histos, collisions, mccollisions, v0s, cascades, trackedCascades, tracks, bcs, mcParticles, products); - } - - // FIXME: the part below is only viable if TPC PID - // switches to using TracksIU (circular dependency) - // - // void processRealDataWithPID(soa::Join const& collisions, aod::V0s const& v0s, aod::Cascades const& cascades, aod::TrackedCascades const& trackedCascades, FullTracksExtIUWithPID const& tracks, aod::BCsWithTimestamps const& bcs) - // { - // ccdbLoader.initCCDBfromBCs(standardCCDBLoaderConfigurables, ccdb, bcs); - // trackPropagation.fillTrackTables(trackPropagationConfigurables, ccdbLoader, collisions, tracks, trackPropagationProducts, histos); - // strangenessBuilderModule.dataProcess(ccdb, histos, collisions, static_cast(nullptr), v0s, cascades, trackedCascades, tracks, bcs, static_cast(nullptr), products); - // } - - // void processMonteCarloWithPID(soa::Join const& collisions, aod::McCollisions const& mccollisions, aod::V0s const& v0s, aod::Cascades const& cascades, aod::TrackedCascades const& trackedCascades, FullTracksExtLabeledIUWithPID const& tracks, aod::BCsWithTimestamps const& bcs, aod::McParticles const& mcParticles) - // { - // ccdbLoader.initCCDBfromBCs(standardCCDBLoaderConfigurables, ccdb, bcs); - // trackPropagation.fillTrackTables(trackPropagationConfigurables, ccdbLoader, collisions, tracks, trackPropagationProducts, histos); - // strangenessBuilderModule.dataProcess(ccdb, histos, collisions, mccollisions, v0s, cascades, trackedCascades, tracks, bcs, mcParticles, products); - // } - - PROCESS_SWITCH(propagationService, processRealData, "process real data", true); - PROCESS_SWITCH(propagationService, processMonteCarlo, "process monte carlo", false); - // PROCESS_SWITCH(propagationService, processRealDataWithPID, "process real data", false); - // PROCESS_SWITCH(propagationService, processMonteCarloWithPID, "process monte carlo", false); -}; - -//**************************************************************************************** -/** - * Workflow definition. - */ -//**************************************************************************************** -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - WorkflowSpec workflow{adaptAnalysisTask(cfgc)}; - return workflow; -} From 9013419bf9fd806bbf4fe6155d71ac55f5ac7e77 Mon Sep 17 00:00:00 2001 From: Chiara De Martin <39315597+ChiaraDeMartin95@users.noreply.github.com> Date: Mon, 15 Sep 2025 18:34:56 +0200 Subject: [PATCH 407/986] [PWGLF] Fix shift correction vectors (#12986) Co-authored-by: Chiara De Martin Co-authored-by: ALICE Action Bot --- .../TableProducer/Strangeness/cascadeflow.cxx | 109 +++++++----------- 1 file changed, 44 insertions(+), 65 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx index 85a79a5c02a..379a845ada5 100644 --- a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx @@ -177,11 +177,9 @@ struct cascadeFlow { // Configurable for shift correction struct : ConfigurableGroup { Configurable cfgShiftCorr{"cfgShiftCorr", 0, ""}; - Configurable cfgShiftPath{"cfgShiftPath", "Users/j/junlee/Qvector/QvecCalib/Shift", "Path for Shift"}; - Configurable cfgShiftPathFT0C{"cfgShiftPathFT0C", "Users/j/junlee/Qvector/QvecCalib/Shift", "Path for Shift"}; - Configurable cfgShiftPathTPCL{"cfgShiftPathTPCL", "Users/j/junlee/Qvector/QvecCalib/Shift", "Path for Shift"}; - Configurable cfgShiftPathTPCR{"cfgShiftPathTPCR", "Users/j/junlee/Qvector/QvecCalib/Shift", "Path for Shift"}; - Configurable cfgnMods{"cfgnMods", 1, "The number of modulations of interest starting from 2"}; + Configurable cfgShiftPathFT0C{"cfgShiftPathFT0C", "Users/c/chdemart/OOpass2Shift/ShiftFT0C", "Path for Shift"}; + Configurable cfgShiftPathTPCL{"cfgShiftPathTPCL", "Users/c/chdemart/OOpass2Shift/ShiftTPCL", "Path for Shift"}; + Configurable cfgShiftPathTPCR{"cfgShiftPathTPCR", "Users/c/chdemart/OOpass2Shift/ShiftTPCR", "Path for Shift"}; } ShiftConfigs; // Configurable cfgHarmonic{"cfgHarmonic", 2, "Harmonic for event plane calculation"}; @@ -483,24 +481,24 @@ struct cascadeFlow { int currentRunNumber = -999; int lastRunNumber = -999; - std::vector shiftprofile{}; - std::vector shiftprofileFT0C{}; - std::vector shiftprofileTPCL{}; - std::vector shiftprofileTPCR{}; + TProfile3D* shiftprofile; + TProfile3D* shiftprofileFT0C; + TProfile3D* shiftprofileTPCL; + TProfile3D* shiftprofileTPCR; std::string fullCCDBShiftCorrPath; std::string fullCCDBShiftCorrPathFT0C; std::string fullCCDBShiftCorrPathTPCL; std::string fullCCDBShiftCorrPathTPCR; template - double ApplyShiftCorrection(TCollision coll, double psiT0C) + double ApplyShiftCorrection(TCollision coll, double psiT0C, TProfile3D* shiftprofile) { - int nmode = 2; auto deltapsiFT0C = 0.0; + int nmode = 2; for (int ishift = 1; ishift <= 10; ishift++) { - auto coeffshiftxFT0C = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 0.5, ishift - 0.5)); - auto coeffshiftyFT0C = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 1.5, ishift - 0.5)); + auto coeffshiftxFT0C = shiftprofile->GetBinContent(shiftprofile->FindBin(coll.centFT0C(), 0.5, ishift - 0.5)); + auto coeffshiftyFT0C = shiftprofile->GetBinContent(shiftprofile->FindBin(coll.centFT0C(), 1.5, ishift - 0.5)); deltapsiFT0C += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0C * TMath::Cos(ishift * static_cast(nmode) * psiT0C) + coeffshiftyFT0C * TMath::Sin(ishift * static_cast(nmode) * psiT0C))); } @@ -508,19 +506,19 @@ struct cascadeFlow { } template - double ComputeEPResolutionwShifts(TCollision coll, double psiT0C, double psiTPCA, double psiTPCC) + double ComputeEPResolutionwShifts(TCollision coll, double psiT0C, double psiTPCA, double psiTPCC, TProfile3D* shiftprofileA, TProfile3D* shiftprofileB, TProfile3D* shiftprofileC) { int nmode = 2; auto deltapsiFT0C = 0.0; auto deltapsiTPCA = 0.0; auto deltapsiTPCC = 0.0; for (int ishift = 1; ishift <= 10; ishift++) { - auto coeffshiftxFT0C = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 0.5, ishift - 0.5)); - auto coeffshiftyFT0C = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 1.5, ishift - 0.5)); - auto coeffshiftxTPCA = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 2.5, ishift - 0.5)); - auto coeffshiftyTPCA = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 3.5, ishift - 0.5)); - auto coeffshiftxTPCC = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 4.5, ishift - 0.5)); - auto coeffshiftyTPCC = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(coll.centFT0C(), 5.5, ishift - 0.5)); + auto coeffshiftxFT0C = shiftprofileA->GetBinContent(shiftprofileFT0C->FindBin(coll.centFT0C(), 0.5, ishift - 0.5)); + auto coeffshiftyFT0C = shiftprofileA->GetBinContent(shiftprofileFT0C->FindBin(coll.centFT0C(), 1.5, ishift - 0.5)); + auto coeffshiftxTPCA = shiftprofileB->GetBinContent(shiftprofileTPCL->FindBin(coll.centFT0C(), 2.5, ishift - 0.5)); + auto coeffshiftyTPCA = shiftprofileB->GetBinContent(shiftprofileTPCL->FindBin(coll.centFT0C(), 3.5, ishift - 0.5)); + auto coeffshiftxTPCC = shiftprofileC->GetBinContent(shiftprofileTPCR->FindBin(coll.centFT0C(), 4.5, ishift - 0.5)); + auto coeffshiftyTPCC = shiftprofileC->GetBinContent(shiftprofileTPCR->FindBin(coll.centFT0C(), 5.5, ishift - 0.5)); deltapsiFT0C += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0C * TMath::Cos(ishift * static_cast(nmode) * psiT0C) + coeffshiftyFT0C * TMath::Sin(ishift * static_cast(nmode) * psiT0C))); deltapsiTPCA += ((1 / (1.0 * ishift)) * (-coeffshiftxTPCA * TMath::Cos(ishift * static_cast(nmode) * psiTPCA) + coeffshiftyTPCA * TMath::Sin(ishift * static_cast(nmode) * psiTPCA))); deltapsiTPCC += ((1 / (1.0 * ishift)) * (-coeffshiftxTPCC * TMath::Cos(ishift * static_cast(nmode) * psiTPCC) + coeffshiftyTPCC * TMath::Sin(ishift * static_cast(nmode) * psiTPCC))); @@ -1079,25 +1077,19 @@ struct cascadeFlow { if (ShiftConfigs.cfgShiftCorr) { currentRunNumber = coll.runNumber(); if (currentRunNumber != lastRunNumber) { - shiftprofileFT0C.clear(); - shiftprofileTPCL.clear(); - shiftprofileTPCR.clear(); fullCCDBShiftCorrPathFT0C = ShiftConfigs.cfgShiftPathFT0C; fullCCDBShiftCorrPathTPCL = ShiftConfigs.cfgShiftPathTPCL; fullCCDBShiftCorrPathTPCR = ShiftConfigs.cfgShiftPathTPCR; - auto objshiftFT0C = ccdb->getForTimeStamp(fullCCDBShiftCorrPathFT0C, coll.timestamp()); - shiftprofileFT0C.push_back(objshiftFT0C); - auto objshiftTPCL = ccdb->getForTimeStamp(fullCCDBShiftCorrPathTPCL, coll.timestamp()); - shiftprofileTPCL.push_back(objshiftTPCL); - auto objshiftTPCR = ccdb->getForTimeStamp(fullCCDBShiftCorrPathTPCR, coll.timestamp()); - shiftprofileTPCR.push_back(objshiftTPCR); + shiftprofileFT0C = ccdb->getForTimeStamp(fullCCDBShiftCorrPathFT0C, coll.timestamp()); + shiftprofileTPCL = ccdb->getForTimeStamp(fullCCDBShiftCorrPathTPCL, coll.timestamp()); + shiftprofileTPCR = ccdb->getForTimeStamp(fullCCDBShiftCorrPathTPCR, coll.timestamp()); lastRunNumber = currentRunNumber; } } if (ShiftConfigs.cfgShiftCorr) { - psiT0CCorr = ApplyShiftCorrection(coll, psiT0C); - ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC); + psiT0CCorr = ApplyShiftCorrection(coll, psiT0C, shiftprofileFT0C); + ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC, shiftprofileFT0C, shiftprofileTPCL, shiftprofileTPCR); } histos.fill(HIST("hPsiT0C"), psiT0CCorr); @@ -1398,25 +1390,21 @@ struct cascadeFlow { if (ShiftConfigs.cfgShiftCorr) { currentRunNumber = coll.runNumber(); if (currentRunNumber != lastRunNumber) { - shiftprofileFT0C.clear(); - shiftprofileTPCL.clear(); - shiftprofileTPCR.clear(); fullCCDBShiftCorrPathFT0C = ShiftConfigs.cfgShiftPathFT0C; fullCCDBShiftCorrPathTPCL = ShiftConfigs.cfgShiftPathTPCL; fullCCDBShiftCorrPathTPCR = ShiftConfigs.cfgShiftPathTPCR; - auto objshiftFT0C = ccdb->getForTimeStamp(fullCCDBShiftCorrPathFT0C, coll.timestamp()); - shiftprofileFT0C.push_back(objshiftFT0C); - auto objshiftTPCL = ccdb->getForTimeStamp(fullCCDBShiftCorrPathTPCL, coll.timestamp()); - shiftprofileTPCL.push_back(objshiftTPCL); - auto objshiftTPCR = ccdb->getForTimeStamp(fullCCDBShiftCorrPathTPCR, coll.timestamp()); - shiftprofileTPCR.push_back(objshiftTPCR); + shiftprofileFT0C = ccdb->getForTimeStamp(fullCCDBShiftCorrPathFT0C, coll.timestamp()); + shiftprofileTPCL = ccdb->getForTimeStamp(fullCCDBShiftCorrPathTPCL, coll.timestamp()); + shiftprofileTPCR = ccdb->getForTimeStamp(fullCCDBShiftCorrPathTPCR, coll.timestamp()); lastRunNumber = currentRunNumber; } } + if (ShiftConfigs.cfgShiftCorr) { - psiT0CCorr = ApplyShiftCorrection(coll, psiT0C); - ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC); + psiT0CCorr = ApplyShiftCorrection(coll, psiT0C, shiftprofileFT0C); + ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC, shiftprofileFT0C, shiftprofileTPCL, shiftprofileTPCR); } + histos.fill(HIST("hPsiT0C"), psiT0CCorr); histos.fill(HIST("hPsiT0CvsCentFT0C"), coll.centFT0C(), psiT0CCorr); @@ -1703,25 +1691,21 @@ struct cascadeFlow { if (ShiftConfigs.cfgShiftCorr) { currentRunNumber = coll.runNumber(); if (currentRunNumber != lastRunNumber) { - shiftprofileFT0C.clear(); - shiftprofileTPCL.clear(); - shiftprofileTPCR.clear(); fullCCDBShiftCorrPathFT0C = ShiftConfigs.cfgShiftPathFT0C; fullCCDBShiftCorrPathTPCL = ShiftConfigs.cfgShiftPathTPCL; fullCCDBShiftCorrPathTPCR = ShiftConfigs.cfgShiftPathTPCR; - auto objshiftFT0C = ccdb->getForTimeStamp(fullCCDBShiftCorrPathFT0C, coll.timestamp()); - shiftprofileFT0C.push_back(objshiftFT0C); - auto objshiftTPCL = ccdb->getForTimeStamp(fullCCDBShiftCorrPathTPCL, coll.timestamp()); - shiftprofileTPCL.push_back(objshiftTPCL); - auto objshiftTPCR = ccdb->getForTimeStamp(fullCCDBShiftCorrPathTPCR, coll.timestamp()); - shiftprofileTPCR.push_back(objshiftTPCR); + shiftprofileFT0C = ccdb->getForTimeStamp(fullCCDBShiftCorrPathFT0C, coll.timestamp()); + shiftprofileTPCL = ccdb->getForTimeStamp(fullCCDBShiftCorrPathTPCL, coll.timestamp()); + shiftprofileTPCR = ccdb->getForTimeStamp(fullCCDBShiftCorrPathTPCR, coll.timestamp()); lastRunNumber = currentRunNumber; } } + if (ShiftConfigs.cfgShiftCorr) { - psiT0CCorr = ApplyShiftCorrection(coll, psiT0C); - ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC); + psiT0CCorr = ApplyShiftCorrection(coll, psiT0C, shiftprofileFT0C); + ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC, shiftprofileFT0C, shiftprofileTPCL, shiftprofileTPCR); } + histos.fill(HIST("hPsiT0C"), psiT0CCorr); histos.fill(HIST("hPsiT0CvsCentFT0C"), coll.centFT0C(), psiT0CCorr); @@ -1931,29 +1915,24 @@ struct cascadeFlow { histos.fill(HIST("ShiftTPCR"), coll.centFT0C(), 0.5, ishift - 0.5, std::sin(ishift * 2 * psiTPCC)); histos.fill(HIST("ShiftTPCR"), coll.centFT0C(), 1.5, ishift - 0.5, std::cos(ishift * 2 * psiTPCC)); } - if (ShiftConfigs.cfgShiftCorr) { currentRunNumber = coll.runNumber(); if (currentRunNumber != lastRunNumber) { - shiftprofileFT0C.clear(); - shiftprofileTPCL.clear(); - shiftprofileTPCR.clear(); fullCCDBShiftCorrPathFT0C = ShiftConfigs.cfgShiftPathFT0C; fullCCDBShiftCorrPathTPCL = ShiftConfigs.cfgShiftPathTPCL; fullCCDBShiftCorrPathTPCR = ShiftConfigs.cfgShiftPathTPCR; - auto objshiftFT0C = ccdb->getForTimeStamp(fullCCDBShiftCorrPathFT0C, coll.timestamp()); - shiftprofileFT0C.push_back(objshiftFT0C); - auto objshiftTPCL = ccdb->getForTimeStamp(fullCCDBShiftCorrPathTPCL, coll.timestamp()); - shiftprofileTPCL.push_back(objshiftTPCL); - auto objshiftTPCR = ccdb->getForTimeStamp(fullCCDBShiftCorrPathTPCR, coll.timestamp()); - shiftprofileTPCR.push_back(objshiftTPCR); + shiftprofileFT0C = ccdb->getForTimeStamp(fullCCDBShiftCorrPathFT0C, coll.timestamp()); + shiftprofileTPCL = ccdb->getForTimeStamp(fullCCDBShiftCorrPathTPCL, coll.timestamp()); + shiftprofileTPCR = ccdb->getForTimeStamp(fullCCDBShiftCorrPathTPCR, coll.timestamp()); lastRunNumber = currentRunNumber; } } + if (ShiftConfigs.cfgShiftCorr) { - psiT0CCorr = ApplyShiftCorrection(coll, psiT0C); - ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC); + psiT0CCorr = ApplyShiftCorrection(coll, psiT0C, shiftprofileFT0C); + ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC, shiftprofileFT0C, shiftprofileTPCL, shiftprofileTPCR); } + histos.fill(HIST("hpsiT0C"), psiT0CCorr); histos.fill(HIST("hpsiT0CvsCentFT0C"), coll.centFT0C(), psiT0CCorr); From 3a609603b8b7807e2651f68a1cbbed1e63f23d26 Mon Sep 17 00:00:00 2001 From: Noor Koster <82090643+cnkoster@users.noreply.github.com> Date: Mon, 15 Sep 2025 20:29:54 +0200 Subject: [PATCH 408/986] [PWGCF] flowSP: move shift corrections and fix bug in QA for PID (#12985) --- PWGCF/Flow/TableProducer/zdcQVectors.cxx | 16 +++--- PWGCF/Flow/Tasks/flowSP.cxx | 62 +++++++++++++----------- 2 files changed, 40 insertions(+), 38 deletions(-) diff --git a/PWGCF/Flow/TableProducer/zdcQVectors.cxx b/PWGCF/Flow/TableProducer/zdcQVectors.cxx index a734cc5cb43..14206f7b732 100644 --- a/PWGCF/Flow/TableProducer/zdcQVectors.cxx +++ b/PWGCF/Flow/TableProducer/zdcQVectors.cxx @@ -258,8 +258,6 @@ struct ZdcQVectors { registry.add("QA/ZNA_Energy", "ZNA_Energy", kTProfile, {{8, 0, 8}}); registry.add("QA/ZNC_Energy", "ZNC_Energy", kTProfile, {{8, 0, 8}}); - registry.add("QA/ShiftZDCC", "ShiftZDCC", kTProfile3D, {{100, 0, 100}, {2, 0, 2}, {10, 0, 10}}); - registry.add("QA/ShiftZDCA", "ShiftZDCA", kTProfile3D, {{100, 0, 100}, {2, 0, 2}, {10, 0, 10}}); registry.add("QA/psiZDCA", "psiZDCA", kTH1D, {{100, -4, 4}}); registry.add("QA/psiZDCA_shift", "psiZDCA_shift", kTH1D, {{100, -4, 4}}); registry.add("QA/psiZDCC", "psiZDCC", kTH1D, {{100, -4, 4}}); @@ -322,6 +320,9 @@ struct ZdcQVectors { registry.add("vmean/hvertex_vy", "hvertex_vy", kTProfile, {{1, 0., 1.}}); registry.add("vmean/hvertex_vz", "hvertex_vz", kTProfile, {{1, 0., 1.}}); + registry.add("shift/ShiftZDCC", "ShiftZDCC", kTProfile3D, {{100, 0, 100}, {2, 0, 2}, {10, 0, 10}}); + registry.add("shift/ShiftZDCA", "ShiftZDCA", kTProfile3D, {{100, 0, 100}, {2, 0, 2}, {10, 0, 10}}); + registry.add("hEventCount", "Number of Event; Cut; #Events Passed Cut", {HistType::kTH1D, {{nEventSelections, 0, nEventSelections}}}); registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_FilteredEvent + 1, "Filtered events"); registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_RCTFlagsZDC + 1, "RCT Flags ZDC"); @@ -944,12 +945,10 @@ struct ZdcQVectors { float coeffshiftyZDCA = 0.0; for (int ishift = 1; ishift <= nshift; ishift++) { - if (cfgFillCommonRegistry) { - registry.fill(HIST("QA/ShiftZDCC"), centrality, 0.5, ishift - 0.5, std::sin(ishift * 1.0 * psiZDCC)); - registry.fill(HIST("QA/ShiftZDCC"), centrality, 1.5, ishift - 0.5, std::cos(ishift * 1.0 * psiZDCC)); - registry.fill(HIST("QA/ShiftZDCA"), centrality, 0.5, ishift - 0.5, std::sin(ishift * 1.0 * psiZDCA)); - registry.fill(HIST("QA/ShiftZDCA"), centrality, 1.5, ishift - 0.5, std::cos(ishift * 1.0 * psiZDCA)); - } + registry.fill(HIST("shift/ShiftZDCC"), centrality, 0.5, ishift - 0.5, std::sin(ishift * 1.0 * psiZDCC)); + registry.fill(HIST("shift/ShiftZDCC"), centrality, 1.5, ishift - 0.5, std::cos(ishift * 1.0 * psiZDCC)); + registry.fill(HIST("shift/ShiftZDCA"), centrality, 0.5, ishift - 0.5, std::sin(ishift * 1.0 * psiZDCA)); + registry.fill(HIST("shift/ShiftZDCA"), centrality, 1.5, ishift - 0.5, std::cos(ishift * 1.0 * psiZDCA)); if (cal.isShiftProfileFound) { int binshiftxZDCC = cal.shiftprofileC->FindBin(centrality, 0.5, ishift - 0.5); @@ -988,7 +987,6 @@ struct ZdcQVectors { double qYcShift = std::hypot(qRec[2], qRec[3]) * std::sin(psiZDCCshift); spTableZDC(runnumber, centrality, v[0], v[1], v[2], qXaShift, qYaShift, qXcShift, qYcShift, isSelected, cal.atIteration, cal.atStep); - qRec.clear(); counter++; diff --git a/PWGCF/Flow/Tasks/flowSP.cxx b/PWGCF/Flow/Tasks/flowSP.cxx index df366eaf341..da0e4af3733 100644 --- a/PWGCF/Flow/Tasks/flowSP.cxx +++ b/PWGCF/Flow/Tasks/flowSP.cxx @@ -448,10 +448,17 @@ struct FlowSP { histos.add("incl/pion/QA/after/hNsigmaTPC_pt", "", {HistType::kTH2D, {axisPt, axisNsigma}}); histos.add("incl/pion/QA/after/hNsigmaTOF_pt", "", {HistType::kTH2D, {axisPt, axisNsigma}}); + if (cfgTrackSelDoTrackQAvsCent) { + histos.add("incl/pion/QA/after/hPt_Eta", "", kTH3D, {axisPt, axisEta, axisCent}); + histos.add("incl/pion/QA/after/hPt_Eta_uncorrected", "", kTH3D, {axisPt, axisEta, axisCent}); + histos.add("incl/pion/QA/after/hPhi_Eta", "", kTH3D, {axisPhi, axisEta, axisCent}); + histos.add("incl/pion/QA/after/hPhi_Eta_uncorrected", "", kTH3D, {axisPhi, axisEta, axisCent}); + } else { + histos.add("incl/pion/QA/after/hPhi_Eta_Pt", "", kTH3D, {axisPhi, axisEta, axisPt}); + histos.add("incl/pion/QA/after/hPhi_Eta_Pt_corrected", "", kTH3D, {axisPhi, axisEta, axisPt}); + } histos.add("incl/pion/QA/after/hPhi_Eta_vz", "", kTH3D, {axisPhi, axisEta, axisVz}); histos.add("incl/pion/QA/after/hPhi_Eta_vz_corrected", "", kTH3D, {axisPhi, axisEta, axisVz}); - histos.add("incl/pion/QA/after/hPhi_Eta_Pt", "", kTH3D, {axisPhi, axisEta, axisPt}); - histos.add("incl/pion/QA/after/hPhi_Eta_Pt_corrected", "", kTH3D, {axisPhi, axisEta, axisPt}); histos.add("incl/pion/QA/after/hDCAxy_pt", "", kTH2D, {axisPt, axisDCAxy}); histos.add("incl/pion/QA/after/hDCAz_pt", "", kTH2D, {axisPt, axisDCAz}); histos.add("incl/pion/QA/after/hSharedClusters_pt", "", {HistType::kTH2D, {axisPt, axisShCl}}); @@ -518,12 +525,12 @@ struct FlowSP { } if (cfgFillMixedHarmonics) { registry.add("incl/MH/vnAxCxUx_MH", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); - registry.add("incl/MH/vnAxCyUx_MH", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); + registry.add("incl/MH/vnAyCyUx_MH", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); registry.add("incl/MH/vnAxCyUy_MH", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); registry.add("incl/MH/vnAyCxUy_MH", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); if (cfgFillPID) { registry.add("incl/pion/MH/vnAxCxUx_MH", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); - registry.add("incl/pion/MH/vnAxCyUx_MH", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); + registry.add("incl/pion/MH/vnAyCyUx_MH", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); registry.add("incl/pion/MH/vnAxCyUy_MH", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); registry.add("incl/pion/MH/vnAyCxUy_MH", "", kTProfile3D, {axisPt, axisEtaVn, axisCentrality}); } @@ -983,7 +990,7 @@ struct FlowSP { if (cfgFillMixedHarmonics) { registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCxUx_MH"), track.pt(), track.eta(), spm.centrality, (spm.uxMH * spm.qxA * spm.qxC) / spm.corrQQx, weight); - registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCyUx_MH"), track.pt(), track.eta(), spm.centrality, (spm.uxMH * spm.qyA * spm.qyC) / spm.corrQQy, weight); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAyCyUx_MH"), track.pt(), track.eta(), spm.centrality, (spm.uxMH * spm.qyA * spm.qyC) / spm.corrQQy, weight); registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAxCyUy_MH"), track.pt(), track.eta(), spm.centrality, (spm.uyMH * spm.qxA * spm.qyC) / spm.corrQQx, weight); registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("MH/vnAyCxUy_MH"), track.pt(), track.eta(), spm.centrality, (spm.uyMH * spm.qyA * spm.qxC) / spm.corrQQy, weight); } @@ -1002,31 +1009,31 @@ struct FlowSP { } } - template - inline void fillTrackQA(TrackObject track, bool useCentrality = false) + template + inline void fillTrackQA(TrackObject track) { if (!cfgFillTrackQA) return; static constexpr std::string_view Time[] = {"before/", "after/"}; - // NOTE: species[kUnidentified] = "" (when no PID) - if (useCentrality) { - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPt_Eta"), track.pt(), track.eta(), spm.centrality, spm.wacc[ct][pt] * spm.weff[ct][pt]); - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPt_Eta_uncorrected"), track.pt(), track.eta(), spm.centrality); - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta"), track.phi(), track.eta(), spm.centrality, spm.wacc[ct][pt] * spm.weff[ct][pt]); - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_uncorrected"), track.phi(), track.eta(), spm.centrality); + // NOTE: species[kUnidentified] = "" (when nocfgTrackSelDo) { + if (cfgTrackSelDoTrackQAvsCent) { + histos.fill(HIST(Charge[ct]) + HIST(Species[par]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPt_Eta"), track.pt(), track.eta(), spm.centrality, spm.wacc[ct][par] * spm.weff[ct][par]); + histos.fill(HIST(Charge[ct]) + HIST(Species[par]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPt_Eta_uncorrected"), track.pt(), track.eta(), spm.centrality); + histos.fill(HIST(Charge[ct]) + HIST(Species[par]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta"), track.phi(), track.eta(), spm.centrality, spm.wacc[ct][par] * spm.weff[ct][par]); + histos.fill(HIST(Charge[ct]) + HIST(Species[par]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_uncorrected"), track.phi(), track.eta(), spm.centrality); } else { - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_Pt"), track.phi(), track.eta(), track.pt()); - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_Pt_corrected"), track.phi(), track.eta(), track.pt(), spm.wacc[ct][pt] * spm.weff[ct][pt]); + histos.fill(HIST(Charge[ct]) + HIST(Species[par]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_Pt"), track.phi(), track.eta(), track.pt()); + histos.fill(HIST(Charge[ct]) + HIST(Species[par]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_Pt_corrected"), track.phi(), track.eta(), track.pt(), spm.wacc[ct][par] * spm.weff[ct][par]); } - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_vz"), track.phi(), track.eta(), spm.vz); - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_vz_corrected"), track.phi(), track.eta(), spm.vz, spm.wacc[ct][pt]); - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hDCAxy_pt"), track.pt(), track.dcaXY(), spm.wacc[ct][pt] * spm.weff[ct][pt]); - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hDCAz_pt"), track.pt(), track.dcaZ(), spm.wacc[ct][pt] * spm.weff[ct][pt]); - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hSharedClusters_pt"), track.pt(), track.tpcFractionSharedCls(), spm.wacc[ct][pt] * spm.weff[ct][pt]); - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hCrossedRows_pt"), track.pt(), track.tpcNClsFound(), spm.wacc[ct][pt] * spm.weff[ct][pt]); - histos.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hCrossedRows_vs_SharedClusters"), track.tpcNClsFound(), track.tpcFractionSharedCls(), spm.wacc[ct][pt] * spm.weff[ct][pt]); + histos.fill(HIST(Charge[ct]) + HIST(Species[par]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_vz"), track.phi(), track.eta(), spm.vz); + histos.fill(HIST(Charge[ct]) + HIST(Species[par]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_vz_corrected"), track.phi(), track.eta(), spm.vz, spm.wacc[ct][par]); + histos.fill(HIST(Charge[ct]) + HIST(Species[par]) + HIST("QA/") + HIST(Time[ft]) + HIST("hDCAxy_pt"), track.pt(), track.dcaXY(), spm.wacc[ct][par] * spm.weff[ct][par]); + histos.fill(HIST(Charge[ct]) + HIST(Species[par]) + HIST("QA/") + HIST(Time[ft]) + HIST("hDCAz_pt"), track.pt(), track.dcaZ(), spm.wacc[ct][par] * spm.weff[ct][par]); + histos.fill(HIST(Charge[ct]) + HIST(Species[par]) + HIST("QA/") + HIST(Time[ft]) + HIST("hSharedClusters_pt"), track.pt(), track.tpcFractionSharedCls(), spm.wacc[ct][par] * spm.weff[ct][par]); + histos.fill(HIST(Charge[ct]) + HIST(Species[par]) + HIST("QA/") + HIST(Time[ft]) + HIST("hCrossedRows_pt"), track.pt(), track.tpcNClsFound(), spm.wacc[ct][par] * spm.weff[ct][par]); + histos.fill(HIST(Charge[ct]) + HIST(Species[par]) + HIST("QA/") + HIST(Time[ft]) + HIST("hCrossedRows_vs_SharedClusters"), track.tpcNClsFound(), track.tpcFractionSharedCls(), spm.wacc[ct][par] * spm.weff[ct][par]); } template @@ -1041,9 +1048,6 @@ struct FlowSP { histos.fill(HIST(Charge[ct]) + HIST("kaon/") + HIST("QA/") + HIST(Time[ft]) + HIST("hNsigmaTPC_pt"), track.pt(), track.tpcNSigmaKa()); histos.fill(HIST(Charge[ct]) + HIST("proton/") + HIST("QA/") + HIST(Time[ft]) + HIST("hNsigmaTOF_pt"), track.pt(), track.tofNSigmaPr()); histos.fill(HIST(Charge[ct]) + HIST("proton/") + HIST("QA/") + HIST(Time[ft]) + HIST("hNsigmaTPC_pt"), track.pt(), track.tpcNSigmaPr()); - - histos.fill(HIST(Charge[ct]) + HIST("proton/") + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_Pt"), track.phi(), track.eta(), track.pt()); - histos.fill(HIST(Charge[ct]) + HIST("QA/") + HIST(Time[ft]) + HIST("hdEdxTPC_pt"), track.pt(), track.tpcSignal()); histos.fill(HIST(Charge[ct]) + HIST("QA/") + HIST(Time[ft]) + HIST("hBetaTOF_pt"), track.pt(), track.beta()); } @@ -1097,21 +1101,21 @@ struct FlowSP { } } - template + template void fillAllQA(TrackObject track) { - fillTrackQA(track, cfgTrackSelDoTrackQAvsCent); + fillTrackQA(track); fillPIDQA(track); if (cfgFillChargeDependenceQA) { switch (spm.charge) { case kPositive: { - fillTrackQA(track, cfgTrackSelDoTrackQAvsCent); + fillTrackQA(track); fillPIDQA(track); break; } case kNegative: { - fillTrackQA(track, cfgTrackSelDoTrackQAvsCent); + fillTrackQA(track); fillPIDQA(track); break; } From 5f127b3f8ae867b6d415e6467baee381668053de Mon Sep 17 00:00:00 2001 From: ldellost <47105254+DelloStritto@users.noreply.github.com> Date: Mon, 15 Sep 2025 22:42:54 +0200 Subject: [PATCH 409/986] [PWGHF] remove collID from particle tree (#12944) --- PWGHF/TableProducer/treeCreatorLcToK0sP.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx b/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx index 1e2b2484c13..e14b9182347 100644 --- a/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx +++ b/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx @@ -217,7 +217,6 @@ DECLARE_SOA_TABLE(HfCandCascFullEs, "AOD", "HFCANDCASCFULLE", collision::PosZ); DECLARE_SOA_TABLE(HfCandCascFullPs, "AOD", "HFCANDCASCFULLP", - collision::BCId, full::Pt, full::Eta, full::Phi, @@ -463,7 +462,6 @@ struct HfTreeCreatorLcToK0sP { for (const auto& particle : particles) { if (std::abs(particle.flagMcMatchGen()) == 1) { rowCandidateFullParticles( - particle.mcCollision().bcId(), particle.pt(), particle.eta(), particle.phi(), From 0709f1890f158778fdf8c1747d53fffbecab791c Mon Sep 17 00:00:00 2001 From: Francesco Mazzaschi <43742195+fmazzasc@users.noreply.github.com> Date: Mon, 15 Sep 2025 23:01:05 +0200 Subject: [PATCH 410/986] [PWGLF] Add task to study Xi Lambda correlation (#12988) --- PWGLF/Tasks/Strangeness/CMakeLists.txt | 5 + PWGLF/Tasks/Strangeness/xiLambdaCorr.cxx | 245 +++++++++++++++++++++++ 2 files changed, 250 insertions(+) create mode 100644 PWGLF/Tasks/Strangeness/xiLambdaCorr.cxx diff --git a/PWGLF/Tasks/Strangeness/CMakeLists.txt b/PWGLF/Tasks/Strangeness/CMakeLists.txt index a3cf8efabc5..3198993318b 100644 --- a/PWGLF/Tasks/Strangeness/CMakeLists.txt +++ b/PWGLF/Tasks/Strangeness/CMakeLists.txt @@ -54,6 +54,11 @@ o2physics_add_dpl_workflow(k0mixedevents PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(xi-lambda-corr-task + SOURCES xiLambdaCorr.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(vzero-cascade-absorption SOURCES vzero_cascade_absorption.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore diff --git a/PWGLF/Tasks/Strangeness/xiLambdaCorr.cxx b/PWGLF/Tasks/Strangeness/xiLambdaCorr.cxx new file mode 100644 index 00000000000..18a07e19926 --- /dev/null +++ b/PWGLF/Tasks/Strangeness/xiLambdaCorr.cxx @@ -0,0 +1,245 @@ +// 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. + +#include "PWGLF/DataModel/LFDoubleCascTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" + +#include "Common/Core/PID/TPCPIDResponse.h" +#include "Common/Core/RecoDecay.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" + +#include "TDatabasePDG.h" +#include + +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +using Collisions = soa::Join::iterator; +using FullCascades = aod::CascDataExt; +using FullV0s = aod::V0Datas; +using TracksFull = soa::Join; +struct xiLambdaCorr { + ConfigurableAxis centAxis{"centAxis", {106, 0, 106}, "binning for the centrality"}; + ConfigurableAxis zVtxAxis{"zVtxBins", {100, -20.f, 20.f}, "Binning for the vertex z in cm"}; + // binning of (anti)lambda mass QA histograms + ConfigurableAxis massLambdaAxis{"massLambdaAxis", {200, o2::constants::physics::MassLambda - 0.05f, o2::constants::physics::MassLambda + 0.05f}, "binning for the lambda invariant-mass"}; + ConfigurableAxis massXiAxis{"massXiAxis", {200, o2::constants::physics::MassXiMinus - 0.05f, o2::constants::physics::MassXiMinus + 0.05f}, "binning for the Xi invariant-mass"}; + ConfigurableAxis massXiLambdaAxis{"massXiLambdaAxis", {200, o2::constants::physics::MassXiMinus + o2::constants::physics::MassLambda, o2::constants::physics::MassXiMinus + o2::constants::physics::MassLambda + 0.1f}, "binning for the Xi+Lambda invariant-mass"}; + + Configurable zVtxMax{"zVtxMax", 10.0f, "maximum z position of the primary vertex"}; + Configurable etaMax{"etaMax", 0.9f, "maximum eta"}; + ConfigurableAxis momAxis{"momAxisFine", {5.e2, 0.f, 5.f}, "momentum axis binning"}; + ConfigurableAxis mixTypeAxis{"mixTypeAxis", {4, -0.5f, 3.5f}, "mixing type axis"}; // xi - lambda , xi - anti-lambda, anti-xi - lambda, anti-xi - anti-lambda + + Configurable cascPtMin{"cascPtMin", 1.f, "minimum (anti)casc pT (GeV/c)"}; + Configurable cascPtMax{"cascPtMax", 4.f, "maximum (anti)casc pT (GeV/c)"}; + + Configurable minNTPCClus{"minNTPCClus", 100, "Minimum number of TPC clusters"}; + Configurable minCascCosPA{"minCascCosPA", 0.99f, "Minimum cosine of the pointing angle of the cascade"}; + Configurable minV0CosPA{"minV0CosPA", 0.97f, "Minimum cosine of the pointing angle of the V0"}; + + Configurable nSigmaTPCCut{"nSigmaTPCCut", 3.f, "Number of sigmas for the TPC PID"}; + Configurable dcaBachToPV{"dcaBachToPV", 0.05f, "DCA of the bachelor to the primary vertex"}; + Configurable dcaV0Bach{"dcaV0Bach", 1.f, "DCA between the V0 daughters"}; + + Configurable lambdaPtMin{"lambdaPtMin", 0.5f, "minimum (anti)lambda pT (GeV/c)"}; + Configurable lambdaPtMax{"lambdaPtMax", 4.f, "maximum (anti)lambda pT (GeV/c)"}; + Configurable dcaLambdaDauToPV{"dcaLambdaDauToPV", 0.05f, "DCA of the lambda daughter to the primary vertex"}; + Configurable minLambdaCosPA{"minLambdaCosPA", 0.99f, "Minimum cosine of the pointing angle of the lambda"}; + + Configurable mLambdaWindow{"mLambdaWindow", 0.02f, "mLambdaWindow"}; + Configurable mXiWindow{"mXiWindow", 0.02f, "mXiWindow"}; + + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + template + bool selectTrack(T const& track) + { + if (std::abs(track.eta()) > etaMax) { + return false; + } + if (track.tpcNClsFound() < minNTPCClus) { + return false; + } + return true; + } + + void init(o2::framework::InitContext&) + { + // event QA + histos.add("QA/zVtx", ";#it{z}_{vtx} (cm);Entries", HistType::kTH1F, {zVtxAxis}); + histos.add("QA/massLambda", ";#it{p}_{T} (GeV/#it{c});#it{m}_{#Lambda} (GeV/#it{c}^{2})", HistType::kTH2F, {momAxis, massLambdaAxis}); + histos.add("QA/massXi", ";#it{p}_{T} (GeV/#it{c});#it{m}_{#Xi} (GeV/#it{c}^{2})", HistType::kTH2F, {momAxis, massXiAxis}); + histos.add("xiMinusLambda", "", {HistType::kTHnSparseF, {massXiLambdaAxis, momAxis, mixTypeAxis}}); + } + + template + bool isSelectedCasc(C const& collision, T const&, FullCascades::iterator const& casc) + { + + auto bachelor = casc.bachelor_as(); + auto posDau = casc.posTrack_as(); + auto negDau = casc.negTrack_as(); + + if (!selectTrack(bachelor) || !selectTrack(posDau) || !selectTrack(negDau)) { + return false; + } + if (casc.sign() > 0) { + if (TMath::Abs(posDau.tpcNSigmaPi()) > nSigmaTPCCut || TMath::Abs(negDau.tpcNSigmaPr()) > nSigmaTPCCut) { + return false; + } + } else if (casc.sign() < 0) { + if (TMath::Abs(negDau.tpcNSigmaPi()) > nSigmaTPCCut || TMath::Abs(posDau.tpcNSigmaPr()) > nSigmaTPCCut) { + return false; + } + } + if (TMath::Abs(casc.dcabachtopv()) < dcaBachToPV) { + return false; + } + if (TMath::Abs(casc.dcacascdaughters()) > dcaV0Bach) { + return false; + } + if (casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ()) < minCascCosPA) { + return false; + } + if (TMath::Abs(casc.eta()) > etaMax) { + return false; + } + // mass cuts + bool massInWindow = false; + if (casc.mXi() > o2::constants::physics::MassXiMinus - mXiWindow && casc.mXi() < o2::constants::physics::MassXiMinus + mXiWindow) { + massInWindow = true; + } + if (!massInWindow) { + return false; + } + histos.fill(HIST("QA/massXi"), casc.pt(), casc.mXi()); + return true; + }; + + template + bool isSelectedLambda(T const&, FullV0s::iterator const& v0) + { + auto posDau = v0.posTrack_as(); + auto negDau = v0.negTrack_as(); + + if (!selectTrack(posDau) || !selectTrack(negDau)) { + return false; + } + if (v0.alpha() > 0) { + if (TMath::Abs(posDau.tpcNSigmaPr()) > nSigmaTPCCut || TMath::Abs(negDau.tpcNSigmaPi()) > nSigmaTPCCut) { + return false; + } + } else { + if (TMath::Abs(posDau.tpcNSigmaPi()) > nSigmaTPCCut || TMath::Abs(negDau.tpcNSigmaPr()) > nSigmaTPCCut) { + return false; + } + } + + if (TMath::Abs(v0.dcapostopv()) < dcaLambdaDauToPV || TMath::Abs(v0.dcanegtopv()) < dcaLambdaDauToPV) { + return false; + } + + if (v0.v0cosPA() < minLambdaCosPA) { + return false; + } + if (TMath::Abs(v0.eta()) > etaMax) { + return false; + } + // mass cuts + bool massInWindow = false; + float massLambda = v0.alpha() > 0 ? v0.mLambda() : v0.mAntiLambda(); + if (v0.mLambda() > o2::constants::physics::MassLambda - mLambdaWindow && v0.mLambda() < o2::constants::physics::MassLambda + mLambdaWindow) { + massInWindow = true; + } + if (!massInWindow) { + return false; + } + histos.fill(HIST("QA/massLambda"), v0.pt(), massLambda); + return true; + }; + + template + void fillXiLambda(C const& collision, T const& tracks, FullV0s const& v0s, FullCascades const& cascades) + { + for (auto& casc : cascades) { + if (!isSelectedCasc(collision, tracks, casc)) { + continue; + } + for (auto& v0 : v0s) { + if (!isSelectedLambda(tracks, v0)) { + continue; + } + if (casc.posTrackId() == v0.posTrackId() || casc.posTrackId() == v0.negTrackId()) { + continue; + } + + int mixType = -1; + if (casc.sign() > 0 && v0.alpha() > 0) { + mixType = 0; // xi - lambda + } else if (casc.sign() > 0 && v0.alpha() < 0) { + mixType = 1; // xi - anti-lambda + } else if (casc.sign() < 0 && v0.alpha() > 0) { + mixType = 2; // anti-xi - lambda + } else if (casc.sign() < 0 && v0.alpha() < 0) { + mixType = 3; // anti-xi - anti-lambda + } + + ROOT::Math::LorentzVector> cascMom4D(casc.px(), casc.py(), casc.pz(), o2::constants::physics::MassXiMinus); + ROOT::Math::LorentzVector> lambdaMom4D{v0.px(), v0.py(), v0.pz(), o2::constants::physics::MassLambda}; + auto xiLambdaMom4D = cascMom4D + lambdaMom4D; + histos.fill(HIST("xiMinusLambda"), xiLambdaMom4D.M(), xiLambdaMom4D.Pt(), mixType); + } + } + }; + + void processData(Collisions const& collision, TracksFull const& tracks, FullV0s const& v0s, FullCascades const& cascades) + { + + if (!collision.sel8()) + return; + + if (std::abs(collision.posZ()) > zVtxMax) + return; + + if (!collision.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) + return; + + histos.fill(HIST("QA/zVtx"), collision.posZ()); + fillXiLambda(collision, tracks, v0s, cascades); + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} From 6e5d91d795d5a08702d4c6fc6f4f16b7f702ce8a Mon Sep 17 00:00:00 2001 From: ilikmeta <152337132+ilikmeta@users.noreply.github.com> Date: Mon, 15 Sep 2025 17:56:02 -0500 Subject: [PATCH 411/986] [PWGCF] Add plots with FT0C aplitude for UCC (#12919) The issue with the `macOS-arm` is still not fixed Once it is the compilation checks will slowly start again over the open PR (there has been no PR merged today). It is usually much quicker than the standard OS but it will take a while I enable the auto-merge to have it ready for merging once the CI finishes correctly --- PWGCF/Flow/Tasks/flowGfwTask.cxx | 79 ++++++++++++++++++++++---------- 1 file changed, 55 insertions(+), 24 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowGfwTask.cxx b/PWGCF/Flow/Tasks/flowGfwTask.cxx index e5854dcf43b..eacb6978329 100644 --- a/PWGCF/Flow/Tasks/flowGfwTask.cxx +++ b/PWGCF/Flow/Tasks/flowGfwTask.cxx @@ -75,11 +75,11 @@ struct FlowGfwTask { O2_DEFINE_CONFIGURABLE(cfgTrackSel, bool, false, "ITS and TPC cluster selection") O2_DEFINE_CONFIGURABLE(cfgMinCentFT0C, float, 0.0f, "Minimum FT0C Centrality") O2_DEFINE_CONFIGURABLE(cfgMaxCentFT0C, float, 100.0f, "Maximum FT0C Centrality") - O2_DEFINE_CONFIGURABLE(cfgcentEstFt0c, bool, false, "Centrality estimator based on FT0C signal") - O2_DEFINE_CONFIGURABLE(cfgcentEstFt0a, bool, false, "Centrality estimator based on FT0A signal") - O2_DEFINE_CONFIGURABLE(cfgcentEstFt0m, bool, false, " A centrality estimator based on FT0A+FT0C signals.") - O2_DEFINE_CONFIGURABLE(cfgcentEstFv0a, bool, false, "Centrality estimator based on FV0A signal") - O2_DEFINE_CONFIGURABLE(cfgcentEstFt0cVariant1, bool, false, "A variant of FT0C") + O2_DEFINE_CONFIGURABLE(cfgCentEstFt0c, bool, false, "Centrality estimator based on FT0C signal") + O2_DEFINE_CONFIGURABLE(cfgCentEstFt0a, bool, false, "Centrality estimator based on FT0A signal") + O2_DEFINE_CONFIGURABLE(cfgCentEstFt0m, bool, false, " A centrality estimator based on FT0A+FT0C signals.") + O2_DEFINE_CONFIGURABLE(cfgCentEstFv0a, bool, false, "Centrality estimator based on FV0A signal") + O2_DEFINE_CONFIGURABLE(cfgCentEstFt0cVariant1, bool, false, "A variant of FT0C") O2_DEFINE_CONFIGURABLE(cfgUseAdditionalEventCut, bool, false, "Use additional event cut on mult correlations") O2_DEFINE_CONFIGURABLE(cfgUseAdditionalTrackCut, bool, false, "Use additional track cut on phi") O2_DEFINE_CONFIGURABLE(cfgTrackSelRun3ITSMatch, bool, false, "Track selection for ITS matches") @@ -94,7 +94,7 @@ struct FlowGfwTask { O2_DEFINE_CONFIGURABLE(cfgCutOccupancyLow, int, 0, "Low cut on TPC occupancy") O2_DEFINE_CONFIGURABLE(cfgCutDCAz, float, 2, "Custom DCA Z cut") O2_DEFINE_CONFIGURABLE(cfgCutDCAxy, float, 0.2f, "Custom DCA XY cut") - O2_DEFINE_CONFIGURABLE(cfgDCAzPt, bool, false, "switch for DCAz pt dependent") + O2_DEFINE_CONFIGURABLE(cfgDCAzPt, bool, true, "switch for DCAz pt dependent") O2_DEFINE_CONFIGURABLE(cfgNoTimeFrameBorder, bool, false, "kNoTimeFrameBorder"); O2_DEFINE_CONFIGURABLE(cfgNoITSROFrameBorder, bool, false, "kNoITSROFrameBorder"); O2_DEFINE_CONFIGURABLE(cfgNoSameBunchPileup, bool, false, "kNoSameBunchPileup"); @@ -187,6 +187,8 @@ struct FlowGfwTask { kc32Nch05, kc32Nch05etagap, kc34Nch05, + kc22etagapft0c, + kc32etagapft0c, // Count the total number of enum kCount_ExtraProfile @@ -400,6 +402,9 @@ struct FlowGfwTask { registry.add("c32Nch05", ";N_{ch 0-5%}(|#eta| < 0.8) ; C_{3}{2} ", {HistType::kTProfile, {axisNch}}); registry.add("c32Nch05etagap", ";N_{ch 0-5%}(|#eta| < 0.8) ; C_{3}{2} (|#eta| < 0.8) ", {HistType::kTProfile, {axisNch}}); registry.add("c34Nch05", ";N_{ch 0-5%}(|#eta| < 0.8) ; C_{3}{4} ", {HistType::kTProfile, {axisNch}}); + + registry.add("c22etagapft0c", ";FT0C Amplitude ; C_{2}{2} (|#eta| < 0.8) ", {HistType::kTProfile, {axisFT0CAmp}}); + registry.add("c32etagapft0c", ";FT0C Amplitude ; C_{3}{2} (|#eta| < 0.8) ", {HistType::kTProfile, {axisFT0CAmp}}); } // End doprocessData const AxisSpec axisZpos{48, -12., 12., "Vtx_{z} (cm)"}; @@ -480,6 +485,9 @@ struct FlowGfwTask { bootstrapArray[i][kc32Nch05] = registry.add(Form("BootstrapContainer_%d/c32Nch05", i), ";N_ch05(|#eta| < 0.8) ; C_{3}{2}", {HistType::kTProfile, {axisNch}}); bootstrapArray[i][kc32Nch05etagap] = registry.add(Form("BootstrapContainer_%d/c32Nch05etagap", i), ";N_ch05(|#eta| < 0.8) ; C_{3}{2} (|#eta| < 0.8)", {HistType::kTProfile, {axisNch}}); bootstrapArray[i][kc34Nch05] = registry.add(Form("BootstrapContainer_%d/c34Nch05", i), ";N_ch05(|#eta| < 0.8) ; C_{3}{4}", {HistType::kTProfile, {axisNch}}); + + bootstrapArray[i][kc22etagapft0c] = registry.add(Form("BootstrapContainer_%d/c22etagapftoc", i), ";FT0C Amplitude ; C_{2}{2} (|#eta| < 0.8)", {HistType::kTProfile, {axisFT0CAmp}}); + bootstrapArray[i][kc32etagapft0c] = registry.add(Form("BootstrapContainer_%d/c32etagapftoc", i), ";FT0C Amplitude ; C_{3}{2} (|#eta| < 0.8)", {HistType::kTProfile, {axisFT0CAmp}}); } o2::framework::AxisSpec axis = axisPt; @@ -718,11 +726,11 @@ struct FlowGfwTask { registry.fill(HIST("hEventCount"), kISGOODITSLAYERSALL); } - float vtxz = -999; + float vtxz = -999, zResmin = 0.25, maxContrib = 20; if (collision.numContrib() > 1) { vtxz = collision.posZ(); float zRes = std::sqrt(collision.covZZ()); - if (zRes > 0.25 && collision.numContrib() < 20) + if (zRes > zResmin && collision.numContrib() < maxContrib) vtxz = -999; } @@ -744,8 +752,9 @@ struct FlowGfwTask { } // V0A T0A 5 sigma cut + float five = 5; if (cfgV0AT0A5Sigma) { - if (std::abs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > 5 * fT0AV0ASigma->Eval(collision.multFT0A())) + if (std::abs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > five * fT0AV0ASigma->Eval(collision.multFT0A())) return false; } @@ -828,27 +837,27 @@ struct FlowGfwTask { // Choose centrality estimator -- Only one can be true auto centrality = -1; - if (cfgcentEstFt0c) { + if (cfgCentEstFt0c) { centrality = collision.centFT0C(); registry.fill(HIST("hCentEstimators"), kCentFT0C); registry.fill(HIST("hCentFT0C"), centrality); } - if (cfgcentEstFt0a) { + if (cfgCentEstFt0a) { centrality = collision.centFT0A(); registry.fill(HIST("hCentEstimators"), kCentFT0A); registry.fill(HIST("hCentFT0A"), centrality); } - if (cfgcentEstFt0m) { + if (cfgCentEstFt0m) { centrality = collision.centFT0M(); registry.fill(HIST("hCentEstimators"), kCentFT0M); registry.fill(HIST("hCentFT0M"), centrality); } - if (cfgcentEstFv0a) { + if (cfgCentEstFv0a) { centrality = collision.centFV0A(); registry.fill(HIST("hCentEstimators"), kCentFV0A); registry.fill(HIST("hCentFV0A"), centrality); } - if (cfgcentEstFt0cVariant1) { + if (cfgCentEstFt0cVariant1) { centrality = collision.centFT0CVariant1(); registry.fill(HIST("hCentEstimators"), kCentFT0CVariant1); registry.fill(HIST("hCentFT0CVariant1"), centrality); @@ -925,19 +934,29 @@ struct FlowGfwTask { registry.fill(HIST("ZNvsZEMcoll"), aZEM1 + aZEM2, aZNA + aZNC); - if (centrality >= 0 && centrality <= 5) { + // Draft notation for centrality limits + float zero = 0, five = 5, ten = 10, twenty = 20, thirty = 30; + if (centrality >= zero && centrality <= five) { registry.fill(HIST("ZNvsZEMcoll05"), aZEM1 + aZEM2, aZNA + aZNC); - } else if (centrality > 5 && centrality <= 10) { + } else if (centrality > five && centrality <= ten) { registry.fill(HIST("ZNvsZEMcoll510"), aZEM1 + aZEM2, aZNA + aZNC); - } else if (centrality > 10 && centrality <= 20) { + } else if (centrality > ten && centrality <= twenty) { registry.fill(HIST("ZNvsZEMcoll1020"), aZEM1 + aZEM2, aZNA + aZNC); - } else if (centrality > 20 && centrality <= 30) { + } else if (centrality > twenty && centrality <= thirty) { registry.fill(HIST("ZNvsZEMcoll2030"), aZEM1 + aZEM2, aZNA + aZNC); } else { registry.fill(HIST("ZNvsZEMcollrest"), aZEM1 + aZEM2, aZNA + aZNC); } } // End of ZDC + // Use for c22 vs ft0 amplitude + double ft0cAmp = 0; + if (foundBC.has_ft0()) { + for (const auto& amplitude : foundBC.ft0().amplitudeC()) { + ft0cAmp += amplitude; + } + } + float vtxz = collision.posZ(); float lRandom = fRndm->Rndm(); registry.fill(HIST("hVtxZ"), vtxz); @@ -1046,7 +1065,7 @@ struct FlowGfwTask { registry.fill(HIST("Events_per_Centrality_Bin"), centrality); registry.fill(HIST("Tracks_per_Centrality_Bin"), centrality, nch); - // Filling c22 with ROOT TProfile + // Filling Cumulants with ROOT TProfile fillProfile(corrconfigs.at(0), HIST("c22"), centrality); fillProfile(corrconfigs.at(1), HIST("c24"), centrality); fillProfile(corrconfigs.at(2), HIST("c26"), centrality); @@ -1066,7 +1085,8 @@ struct FlowGfwTask { fillProfile(corrconfigs.at(7), HIST("c34Nch"), nch); // 0-5% centrality Nch - if (centrality >= 0 && centrality <= 5) { + float zero = 0, five = 5; + if (centrality >= zero && centrality <= five) { fillProfile(corrconfigs.at(0), HIST("c22Nch05"), nch); fillProfile(corrconfigs.at(1), HIST("c24Nch05"), nch); fillProfile(corrconfigs.at(2), HIST("c26Nch05"), nch); @@ -1077,6 +1097,10 @@ struct FlowGfwTask { fillProfile(corrconfigs.at(7), HIST("c34Nch05"), nch); } + // C22 and C32 vs FT0C amplitude + fillProfile(corrconfigs.at(4), HIST("c22etagapft0c"), ft0cAmp); + fillProfile(corrconfigs.at(6), HIST("c32etagapft0c"), ft0cAmp); + // Filling Bootstrap Samples int sampleIndex = static_cast(cfgNbootstrap * lRandom); fillProfile(corrconfigs.at(0), bootstrapArray[sampleIndex][kc22], centrality); @@ -1097,7 +1121,7 @@ struct FlowGfwTask { fillProfile(corrconfigs.at(6), bootstrapArray[sampleIndex][kc32Nchetagap], nch); fillProfile(corrconfigs.at(7), bootstrapArray[sampleIndex][kc34Nch], nch); - if (centrality >= 0 && centrality <= 5) { + if (centrality >= zero && centrality <= five) { fillProfile(corrconfigs.at(0), bootstrapArray[sampleIndex][kc22Nch05], nch); fillProfile(corrconfigs.at(1), bootstrapArray[sampleIndex][kc24Nch05], nch); fillProfile(corrconfigs.at(2), bootstrapArray[sampleIndex][kc26Nch05], nch); @@ -1112,6 +1136,10 @@ struct FlowGfwTask { registry.fill(HIST("Nch"), nch); + // Filling Bootstrap Samples for FT0C Amplitudes + fillProfile(corrconfigs.at(4), bootstrapArray[sampleIndex][kc22etagapft0c], ft0cAmp); + fillProfile(corrconfigs.at(6), bootstrapArray[sampleIndex][kc32etagapft0c], ft0cAmp); + // Filling Flow Container for (uint l_ind = 0; l_ind < corrconfigs.size(); l_ind++) { fillFC(corrconfigs.at(l_ind), centrality, lRandom); @@ -1169,7 +1197,8 @@ struct FlowGfwTask { registry.fill(HIST("hCenMCRec"), centrality); registry.fill(HIST("hPtNchMCRec"), track.pt(), track.size()); - if (centrality >= 0 && centrality <= 5) { + float zero = 0, five = 5; + if (centrality >= zero && centrality <= five) { registry.fill(HIST("hPtMCRec05"), track.pt()); registry.fill(HIST("hCenMCRec05"), centrality); registry.fill(HIST("hPtNchMCRec05"), track.pt(), track.size()); @@ -1233,7 +1262,8 @@ struct FlowGfwTask { registry.fill(HIST("hPtMCGen"), particle.pt()); registry.fill(HIST("hCenMCGen"), centrality); - if (centrality >= 0 && centrality <= 5) { + float zero = 0, five = 5; + if (centrality >= zero && centrality <= five) { registry.fill(HIST("hPtMCGen05"), particle.pt()); registry.fill(HIST("hCenMCGen05"), centrality); registry.fill(HIST("hPtNchMCGen05"), particle.pt(), numberOfTracks[0]); @@ -1247,7 +1277,8 @@ struct FlowGfwTask { for (const auto& track : groupedTracksReco) { registry.fill(HIST("hCorr"), numberOfTracks[0], track.size()); - if (centrality >= 0 && centrality <= 5) { + float zero = 0, five = 5; + if (centrality >= zero && centrality <= five) { registry.fill(HIST("hCorr05"), numberOfTracks[0], track.size()); } } From c255dac8905e654a04706292562b4668428d24c0 Mon Sep 17 00:00:00 2001 From: Paola Vargas Torres <88360333+PaolaVT@users.noreply.github.com> Date: Tue, 16 Sep 2025 02:01:31 -0600 Subject: [PATCH 412/986] [PWGLF] Implement validation histograms and code cleanup (#12981) Co-authored-by: Paola Vargas Torres --- PWGLF/Tasks/Nuspex/dedxPidAnalysis.cxx | 644 +++++++++++++++++++++---- PWGMM/UE/Tasks/dedxAnalysis.cxx | 532 ++++++++++++++++---- 2 files changed, 975 insertions(+), 201 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/dedxPidAnalysis.cxx b/PWGLF/Tasks/Nuspex/dedxPidAnalysis.cxx index 2d042bd5e96..86d9030e6ff 100644 --- a/PWGLF/Tasks/Nuspex/dedxPidAnalysis.cxx +++ b/PWGLF/Tasks/Nuspex/dedxPidAnalysis.cxx @@ -25,9 +25,13 @@ #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" +#include "CCDB/BasicCCDBManager.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "Framework/ASoA.h" #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" +#include "Framework/Logger.h" #include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/Track.h" @@ -35,13 +39,15 @@ using namespace o2; using namespace o2::framework; +using namespace o2::framework::expressions; using namespace constants::physics; using PIDTracks = soa::Join< aod::Tracks, aod::TracksExtra, aod::TrackSelectionExtension, aod::TracksDCA, aod::TrackSelection, - aod::pidTOFFullPi, aod::pidTOFFullPr, aod::pidTOFFullEl, aod::pidTOFbeta>; + aod::pidTOFFullPi, aod::pidTOFFullPr, aod::pidTOFFullEl, aod::pidTOFbeta, aod::pidTPCPi, aod::pidTPCPr, aod::pidTPCEl>; using SelectedCollisions = soa::Join; +using BCsRun3 = soa::Join; struct DedxPidAnalysis { @@ -62,13 +68,57 @@ struct DedxPidAnalysis { float pionTofCut = 1.0; float invMassCut = 0.01; float invMassCutGamma = 0.0015; - float magField = 1; float pTcut = 2.0; - + int v0TPC = 1; + int v0TOF = 2; + int v0TPCTOF = 3; + + // Event cut labels + enum EvCutLabel { + AllEv = 1, + SelEigth, + ZVtxCut, + NoSameBunchPileup, + GoodZvtxFT0vsPV + + }; + + // Track primary label + enum TrkPriCutLabel { + AllPri = 1, + SelectionPrim, + PhiVarCutPri, + NTPCClCutPri, + NITSClCutPri + }; + + // Track secondary lebel + enum TrkSecCutLabel { + AllSec = 1, + V0CosPA, + V0DecayRadius, + V0Daughters, + TPCRefit, + PhiVarCutSec, + NTPCClCutSec, + NITSClCutSec, + AllK0s, + V0RapidityK0s, + V0ProperLifetimeK0s, + AllLambda, + V0RapidityLambda, + V0ProperLifetimeLambda, + AllAntiLambda, + V0RapidityAntiLambda, + V0ProperLifetimeAntiLambda, + AllGamma + }; // Configurable Parameters // Tracks cuts - Configurable minTPCnClsFound{"minTPCnClsFound", 70.0f, + Configurable minTPCnClsFound{"minTPCnClsFound", 135.0f, "min number of found TPC clusters"}; + Configurable minITSnCls{"minITSnCls", 0.0f, + "min number of ITS clusters"}; Configurable minNCrossedRowsTPC{"minNCrossedRowsTPC", 70.0f, "min number of found TPC crossed rows"}; Configurable maxChi2TPC{"maxChi2TPC", 4.0f, "max chi2 per cluster TPC"}; @@ -88,6 +138,9 @@ struct DedxPidAnalysis { "Maximum V0 Radius"}; Configurable dcaV0DaughtersMax{"dcaV0DaughtersMax", 0.5f, "Maximum DCA Daughters"}; + Configurable v0rapidityCut{"v0rapidityCut", 0.5f, "V0 rapidity cut"}; + Configurable v0ProperLifetimeCutK0s{"v0ProperLifetimeCutK0s", 20.f, "V0 proper lifetime cut for K0s"}; + Configurable v0ProperLifetimeCutLambda{"v0ProperLifetimeCutLambda", 30.f, "V0 proper lifetime cut for Lambda"}; Configurable nsigmaTOFmax{"nsigmaTOFmax", 3.0f, "Maximum nsigma TOF"}; Configurable minMassK0s{"minMassK0s", 0.4f, "Minimum Mass K0s"}; Configurable maxMassK0s{"maxMassK0s", 0.6f, "Maximum Mass K0s"}; @@ -99,17 +152,24 @@ struct DedxPidAnalysis { "Minimum Mass Gamma"}; Configurable maxMassGamma{"maxMassGamma", 0.002022f, "Maximum Mass Gamma"}; - Configurable nclCut{"nclCut", 135.0f, - "ncl Cut"}; Configurable calibrationMode{"calibrationMode", false, "calibration mode"}; - Configurable additionalCuts{"additionalCuts", true, "additional cuts"}; + Configurable phiVarCut{"phiVarCut", true, "phi var cut"}; + Configurable nTPCClCut{"nTPCClCut", true, "number of clusters in TPC cut"}; + Configurable nITSClCut{"nITSClCut", true, "number of clusters in ITS cut"}; + Configurable v0SelectionMode{"v0SelectionMode", 1, "V0 Selection base on TPC: 1, TOF:2 ,Both:3"}; // Histograms names static constexpr std::string_view kDedxvsMomentumPos[kParticlesType] = {"dEdx_vs_Momentum_all_Pos", "dEdx_vs_Momentum_Pi_v0_Pos", "dEdx_vs_Momentum_Pr_v0_Pos", "dEdx_vs_Momentum_El_v0_Pos"}; static constexpr std::string_view kDedxvsMomentumNeg[kParticlesType] = {"dEdx_vs_Momentum_all_Neg", "dEdx_vs_Momentum_Pi_v0_Neg", "dEdx_vs_Momentum_Pr_v0_Neg", "dEdx_vs_Momentum_El_v0_Neg"}; - static constexpr std::string_view kNclDedxMomentumNegBefore[kEtaIntervals] = {"Ncl_vs_dEdx_vs_Momentum_Neg_1_Before", "Ncl_vs_dEdx_vs_Momentum_Neg_2_Before", "Ncl_vs_dEdx_vs_Momentum_Neg_3_Before", "Ncl_vs_dEdx_vs_Momentum_Neg_4_Before", "Ncl_vs_dEdx_vs_Momentum_Neg_5_Before", "Ncl_vs_dEdx_vs_Momentum_Neg_6_Before", "Ncl_vs_dEdx_vs_Momentum_Neg_7_Before", "Ncl_vs_dEdx_vs_Momentum_Neg_8_Before"}; - static constexpr std::string_view kNclDedxMomentumPosBefore[kEtaIntervals] = {"Ncl_vs_dEdx_vs_Momentum_Pos_1_Before", "Ncl_vs_dEdx_vs_Momentum_Pos_2_Before", "Ncl_vs_dEdx_vs_Momentum_Pos_3_Before", "Ncl_vs_dEdx_vs_Momentum_Pos_4_Before", "Ncl_vs_dEdx_vs_Momentum_Pos_5_Before", "Ncl_vs_dEdx_vs_Momentum_Pos_6_Before", "Ncl_vs_dEdx_vs_Momentum_Pos_7_Before", "Ncl_vs_dEdx_vs_Momentum_Pos_8_Before"}; - static constexpr std::string_view kNclDedxMomentumNegAfter[kEtaIntervals] = {"Ncl_vs_dEdx_vs_Momentum_Neg_1_After", "Ncl_vs_dEdx_vs_Momentum_Neg_2_After", "Ncl_vs_dEdx_vs_Momentum_Neg_3_After", "Ncl_vs_dEdx_vs_Momentum_Neg_4_After", "Ncl_vs_dEdx_vs_Momentum_Neg_5_After", "Ncl_vs_dEdx_vs_Momentum_Neg_6_After", "Ncl_vs_dEdx_vs_Momentum_Neg_7_After", "Ncl_vs_dEdx_vs_Momentum_Neg_8_After"}; - static constexpr std::string_view kNclDedxMomentumPosAfter[kEtaIntervals] = {"Ncl_vs_dEdx_vs_Momentum_Pos_1_After", "Ncl_vs_dEdx_vs_Momentum_Pos_2_After", "Ncl_vs_dEdx_vs_Momentum_Pos_3_After", "Ncl_vs_dEdx_vs_Momentum_Pos_4_After", "Ncl_vs_dEdx_vs_Momentum_Pos_5_After", "Ncl_vs_dEdx_vs_Momentum_Pos_6_After", "Ncl_vs_dEdx_vs_Momentum_Pos_7_After", "Ncl_vs_dEdx_vs_Momentum_Pos_8_After"}; + // Ncl TPC + static constexpr std::string_view kNclTPCDedxMomentumNegBefore[kEtaIntervals] = {"Ncl_TPC_vs_dEdx_vs_Momentum_Neg_1_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_2_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_3_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_4_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_5_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_6_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_7_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_8_Before"}; + static constexpr std::string_view kNclTPCDedxMomentumPosBefore[kEtaIntervals] = {"Ncl_TPC_vs_dEdx_vs_Momentum_Pos_1_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_2_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_3_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_4_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_5_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_6_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_7_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_8_Before"}; + static constexpr std::string_view kNclTPCDedxMomentumNegAfter[kEtaIntervals] = {"Ncl_TPC_vs_dEdx_vs_Momentum_Neg_1_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_2_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_3_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_4_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_5_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_6_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_7_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_8_After"}; + static constexpr std::string_view kNclTPCDedxMomentumPosAfter[kEtaIntervals] = {"Ncl_TPC_vs_dEdx_vs_Momentum_Pos_1_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_2_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_3_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_4_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_5_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_6_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_7_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_8_After"}; + // Ncl TPC + static constexpr std::string_view kNclITSDedxMomentumNegBefore[kEtaIntervals] = {"Ncl_ITS_vs_dEdx_vs_Momentum_Neg_1_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_2_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_3_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_4_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_5_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_6_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_7_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_8_Before"}; + static constexpr std::string_view kNclITSDedxMomentumPosBefore[kEtaIntervals] = {"Ncl_ITS_vs_dEdx_vs_Momentum_Pos_1_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_2_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_3_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_4_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_5_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_6_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_7_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_8_Before"}; + static constexpr std::string_view kNclITSDedxMomentumNegAfter[kEtaIntervals] = {"Ncl_ITS_vs_dEdx_vs_Momentum_Neg_1_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_2_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_3_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_4_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_5_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_6_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_7_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_8_After"}; + static constexpr std::string_view kNclITSDedxMomentumPosAfter[kEtaIntervals] = {"Ncl_ITS_vs_dEdx_vs_Momentum_Pos_1_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_2_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_3_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_4_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_5_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_6_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_7_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_8_After"}; static constexpr double EtaCut[kEtaIntervals + 1] = {-0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6, 0.8}; Configurable> calibrationFactorNeg{"calibrationFactorNeg", {50.4011, 50.4764, 50.186, 49.2955, 48.8222, 49.4273, 49.9292, 50.0556}, "negative calibration factors"}; Configurable> calibrationFactorPos{"calibrationFactorPos", {50.5157, 50.6359, 50.3198, 49.3345, 48.9197, 49.4931, 50.0188, 50.1406}, "positive calibration factors"}; @@ -118,6 +178,7 @@ struct DedxPidAnalysis { // phi cut fits TF1* fphiCutHigh = nullptr; TF1* fphiCutLow = nullptr; + Service ccdb; TrackSelection myTrackSelection() { @@ -129,7 +190,7 @@ struct DedxPidAnalysis { selectedTracks.SetMinNCrossedRowsTPC(minNCrossedRowsTPC); selectedTracks.SetMinNCrossedRowsOverFindableClustersTPC(minNCrossedRowsOverFindableClustersTPC); selectedTracks.SetMaxChi2PerClusterTPC(maxChi2TPC); - selectedTracks.SetRequireHitsInITSLayers(1, {0, 1}); + selectedTracks.SetRequireHitsInITSLayers(1, {0, 1, 2}); selectedTracks.SetMaxChi2PerClusterITS(maxChi2ITS); selectedTracks.SetMaxDcaXYPtDep([](float pt) { return 0.0105f + 0.0350f / std::pow(pt, 1.1f); }); selectedTracks.SetMaxDcaZ(maxDCAz); @@ -142,6 +203,14 @@ struct DedxPidAnalysis { void init(InitContext const&) { + if (v0SelectionMode == v0TPC) { + LOGF(info, "V0 seleccion using TPC only"); + } else if (v0SelectionMode == v0TOF) { + LOGF(info, "V0 seleccion using TOF only"); + } else if (v0SelectionMode == v0TPCTOF) { + LOGF(info, "V0 seleccion using TOF + TPC"); + } + AxisSpec dedxAxis{100, 0.0, 100.0, "dE/dx (a. u.)"}; AxisSpec ptAxis = {binP, "pT (GeV/c)"}; AxisSpec etaAxis{8, -0.8, 0.8, "#eta"}; @@ -219,28 +288,61 @@ struct DedxPidAnalysis { registryDeDx.add( "hdEdx_vs_phi", "dE/dx", HistType::kTH2F, {{100, 0.0, 6.4, "#phi"}, {dedxAxis}}); - // phi cut - registryDeDx.add( - "hpt_vs_phi_Ncl_After", "phi cut", HistType::kTH3F, - {{ptAxis}, {100, 0.0, 0.4, "#varphi^{'}"}, {100, 0, 160, "N_{cl}"}}); + if (phiVarCut) { + // pt + registryDeDx.add( + "hpt_vs_phi_Ncl_TPC_After", "phi cut vs pt", HistType::kTH3F, + {{ptAxis}, {100, 0.0, 0.4, "#varphi^{'}"}, {100, 0, 160, "N_{cl}"}}); - registryDeDx.add( - "hpt_vs_phi_Ncl_Before", "phi cut", HistType::kTH3F, - {{ptAxis}, {100, 0.0, 0.4, "#varphi^{'}"}, {100, 0, 160, "N_{cl}"}}); + registryDeDx.add( + "hpt_vs_phi_Ncl_TPC_Before", "phi cut vs pt", HistType::kTH3F, + {{ptAxis}, {100, 0.0, 0.4, "#varphi^{'}"}, {100, 0, 160, "N_{cl}"}}); + // p + registryDeDx.add( + "hp_vs_phi_Ncl_TPC_After", "phi cut vs p", HistType::kTH3F, + {{pAxis}, {100, 0.0, 0.4, "#varphi^{'}"}, {100, 0, 160, "N_{cl}"}}); - // Ncl vs de/dx + registryDeDx.add( + "hp_vs_phi_Ncl_TPC_Before", "phi cut vs p", HistType::kTH3F, + {{pAxis}, {100, 0.0, 0.4, "#varphi^{'}"}, {100, 0, 160, "N_{cl}"}}); + // eta + registryDeDx.add( + "heta_vs_Ncl_TPC_Before", "eta and N_{cl}", HistType::kTH2F, + {{100, -0.8, 0.8, "#eta"}, {100, 0, 160, "N_{cl}"}}); - for (int i = 0; i < kEtaIntervals; ++i) { - registryDeDx.add(kNclDedxMomentumPosBefore[i].data(), "Ncl vs dE/dx vs Momentum Positive before", HistType::kTH3F, - {{100, 0, 160, "N_{cl}"}, {dedxAxis}, {pAxis}}); - registryDeDx.add(kNclDedxMomentumNegBefore[i].data(), "Ncl vs dE/dx vs Momentum Negative before", HistType::kTH3F, - {{100, 0, 160, "N_{cl}"}, {dedxAxis}, {pAxis}}); + registryDeDx.add( + "heta_vs_Ncl_TPC_After", "eta and N_{cl} ", HistType::kTH2F, + {{100, -0.8, 0.8, "#eta"}, {100, 0, 160, "N_{cl}"}}); + } + // Ncl vs de/dx TPC + if (nTPCClCut) { + for (int i = 0; i < kEtaIntervals; ++i) { + registryDeDx.add(kNclTPCDedxMomentumPosBefore[i].data(), "Ncl TPC vs dE/dx vs Momentum Positive before", HistType::kTH3F, + {{100, 0, 160, "N_{cl}^{TPC}"}, {dedxAxis}, {pAxis}}); + registryDeDx.add(kNclTPCDedxMomentumNegBefore[i].data(), "Ncl TPC vs dE/dx vs Momentum Negative before", HistType::kTH3F, + {{100, 0, 160, "N_{cl}^{TPC}"}, {dedxAxis}, {pAxis}}); + + registryDeDx.add(kNclTPCDedxMomentumPosAfter[i].data(), "Ncl TPC vs dE/dx vs Momentum Positive after", HistType::kTH3F, + {{100, 0, 160, "N_{cl}^{TPC}"}, {dedxAxis}, {pAxis}}); + registryDeDx.add(kNclTPCDedxMomentumNegAfter[i].data(), "Ncl TPC vs dE/dx vs Momentum Negative after", HistType::kTH3F, + {{100, 0, 160, "N_{cl}^{TPC}"}, {dedxAxis}, {pAxis}}); + } + } - registryDeDx.add(kNclDedxMomentumPosAfter[i].data(), "Ncl vs dE/dx vs Momentum Positive after", HistType::kTH3F, - {{100, 0, 160, "N_{cl}"}, {dedxAxis}, {pAxis}}); - registryDeDx.add(kNclDedxMomentumNegAfter[i].data(), "Ncl vs dE/dx vs Momentum Negative after", HistType::kTH3F, - {{100, 0, 160, "N_{cl}"}, {dedxAxis}, {pAxis}}); + // Ncl vs de/dx ITS + if (nITSClCut) { + for (int i = 0; i < kEtaIntervals; ++i) { + registryDeDx.add(kNclITSDedxMomentumPosBefore[i].data(), "Ncl ITS vs dE/dx vs Momentum Positive before", HistType::kTH3F, + {{100, 0, 160, "N_{cl}^{ITS}"}, {dedxAxis}, {pAxis}}); + registryDeDx.add(kNclITSDedxMomentumNegBefore[i].data(), "Ncl ITS vs dE/dx vs Momentum Negative before", HistType::kTH3F, + {{100, 0, 160, "N_{cl}^{ITS}"}, {dedxAxis}, {pAxis}}); + + registryDeDx.add(kNclITSDedxMomentumPosAfter[i].data(), "Ncl ITS vs dE/dx vs Momentum Positive after", HistType::kTH3F, + {{100, 0, 160, "N_{cl}^{ITS}"}, {dedxAxis}, {pAxis}}); + registryDeDx.add(kNclITSDedxMomentumNegAfter[i].data(), "Ncl ITS vs dE/dx vs Momentum Negative after", HistType::kTH3F, + {{100, 0, 160, "N_{cl}^{ITS}"}, {dedxAxis}, {pAxis}}); + } } // beta plot @@ -255,6 +357,48 @@ struct DedxPidAnalysis { // Event Counter registryDeDx.add("histRecVtxZData", "collision z position", HistType::kTH1F, {{100, -20.0, +20.0, "z_{vtx} (cm)"}}); + // Event Counter + registryDeDx.add("evsel", "events selected", HistType::kTH1F, {{5, 0.5, 5.5, ""}}); + auto hstat = registryDeDx.get(HIST("evsel")); + auto* x = hstat->GetXaxis(); + x->SetBinLabel(AllEv, "AllEv"); + x->SetBinLabel(SelEigth, "SelEigth"); + x->SetBinLabel(ZVtxCut, "ZVtxCut"); + x->SetBinLabel(NoSameBunchPileup, "NoSameBunchPileup"); + x->SetBinLabel(GoodZvtxFT0vsPV, "GoodZvtxFT0vsPV"); + + // Track Counter + registryDeDx.add("trackselAll", "track selected all particles", HistType::kTH1F, {{5, 0.5, 5.5, ""}}); + auto htrackAll = registryDeDx.get(HIST("trackselAll")); + auto* xAll = htrackAll->GetXaxis(); + xAll->SetBinLabel(AllPri, "AllPri"); + xAll->SetBinLabel(SelectionPrim, "SelectionPrim"); + xAll->SetBinLabel(PhiVarCutPri, "PhiVarCutPri"); + xAll->SetBinLabel(NTPCClCutPri, "NTPCClCutPri"); + xAll->SetBinLabel(NITSClCutPri, "NITSClCutPri"); + + registryDeDx.add("trackselSec", "track selected sec particles", HistType::kTH1F, {{18, 0.5, 18.5, ""}}); + auto htrackSec = registryDeDx.get(HIST("trackselSec")); + auto* xSec = htrackSec->GetXaxis(); + xSec->SetBinLabel(AllSec, "AllSec"); + xSec->SetBinLabel(V0CosPA, "V0CosPA"); + xSec->SetBinLabel(V0DecayRadius, "V0DecayRadius"); + xSec->SetBinLabel(V0Daughters, "V0Daughters"); + xSec->SetBinLabel(TPCRefit, "TPCRefit"); + xSec->SetBinLabel(PhiVarCutSec, "PhiVarCutSec"); + xSec->SetBinLabel(NTPCClCutSec, "NTPCClCutSec"); + xSec->SetBinLabel(NITSClCutSec, "NITSClCutSec"); + xSec->SetBinLabel(AllK0s, "AllK0s"); + xSec->SetBinLabel(V0RapidityK0s, "V0RapidityK0s"); + xSec->SetBinLabel(V0ProperLifetimeK0s, "V0ProperLifetimeK0s"); + xSec->SetBinLabel(AllLambda, "AllLambda"); + xSec->SetBinLabel(V0RapidityLambda, "V0RapidityLambda"); + xSec->SetBinLabel(V0ProperLifetimeLambda, "V0ProperLifetimeLambda"); + xSec->SetBinLabel(AllAntiLambda, "AllAntiLambda"); + xSec->SetBinLabel(V0RapidityAntiLambda, "V0RapidityAntiLambda"); + xSec->SetBinLabel(V0ProperLifetimeAntiLambda, "V0ProperLifetimeAntiLambda"); + xSec->SetBinLabel(AllGamma, "AllGamma"); + mySelectionPrim = myTrackSelection(); } @@ -265,8 +409,6 @@ struct DedxPidAnalysis { // Single-Track Selections if (!track.hasTPC()) return false; - if (track.tpcNClsFound() < minTPCnClsFound) - return false; if (track.tpcNClsCrossedRows() < minNCrossedRowsTPC) return false; if (track.tpcChi2NCl() > maxChi2TPC) @@ -283,8 +425,15 @@ struct DedxPidAnalysis { { if (v0.v0cosPA() < v0cospaMin) return false; + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0CosPA); + if (v0.v0radius() < minimumV0Radius || v0.v0radius() > maximumV0Radius) return false; + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0DecayRadius); + + if (v0.dcaV0daughters() > dcaV0DaughtersMax) + return false; + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0Daughters); return true; } @@ -299,18 +448,31 @@ struct DedxPidAnalysis { return false; if (!passedSingleTrackSelection(ntrack, collision)) return false; + double sigmap = 0.0; + double sigman = 0.0; + + if (v0SelectionMode == v0TPC) { + sigmap = ptrack.tpcNSigmaPi(); + sigman = ntrack.tpcNSigmaPi(); + } else if (v0SelectionMode == v0TOF) { + sigmap = ptrack.tofNSigmaPi(); + sigman = ntrack.tofNSigmaPi(); + } else if (v0SelectionMode == v0TPCTOF) { + sigmap = std::hypot(ptrack.tpcNSigmaPi(), ptrack.tofNSigmaPi()); + sigman = std::hypot(ntrack.tpcNSigmaPi(), ntrack.tofNSigmaPi()); + } if (ptrack.tpcInnerParam() > tpcCut) { if (!ptrack.hasTOF()) return false; - if (std::abs(ptrack.tofNSigmaPi()) > nsigmaTOFmax) + if (std::abs(sigmap) > nsigmaTOFmax) return false; } if (ntrack.tpcInnerParam() > tpcCut) { if (!ntrack.hasTOF()) return false; - if (std::abs(ntrack.tofNSigmaPi()) > nsigmaTOFmax) + if (std::abs(sigman) > nsigmaTOFmax) return false; } @@ -332,17 +494,31 @@ struct DedxPidAnalysis { if (!passedSingleTrackSelection(ntrack, collision)) return false; + double sigmap = 0.0; + double sigman = 0.0; + + if (v0SelectionMode == v0TPC) { + sigmap = ptrack.tpcNSigmaPr(); + sigman = ntrack.tpcNSigmaPi(); + } else if (v0SelectionMode == v0TOF) { + sigmap = ptrack.tofNSigmaPr(); + sigman = ntrack.tofNSigmaPi(); + } else if (v0SelectionMode == v0TPCTOF) { + sigmap = std::hypot(ptrack.tpcNSigmaPr(), ptrack.tofNSigmaPr()); + sigman = std::hypot(ntrack.tpcNSigmaPi(), ntrack.tofNSigmaPi()); + } + if (ptrack.tpcInnerParam() > tpcCut) { if (!ptrack.hasTOF()) return false; - if (std::abs(ptrack.tofNSigmaPr()) > nsigmaTOFmax) + if (std::abs(sigmap) > nsigmaTOFmax) return false; } if (ntrack.tpcInnerParam() > tpcCut) { if (!ntrack.hasTOF()) return false; - if (std::abs(ntrack.tofNSigmaPi()) > nsigmaTOFmax) + if (std::abs(sigman) > nsigmaTOFmax) return false; } @@ -364,18 +540,30 @@ struct DedxPidAnalysis { return false; if (!passedSingleTrackSelection(ntrack, collision)) return false; - + double sigmap = 0.0; + double sigman = 0.0; + + if (v0SelectionMode == v0TPC) { + sigmap = ptrack.tpcNSigmaPi(); + sigman = ntrack.tpcNSigmaPr(); + } else if (v0SelectionMode == v0TOF) { + sigmap = ptrack.tofNSigmaPi(); + sigman = ntrack.tofNSigmaPr(); + } else if (v0SelectionMode == v0TPCTOF) { + sigmap = std::hypot(ptrack.tpcNSigmaPi(), ptrack.tofNSigmaPi()); + sigman = std::hypot(ntrack.tpcNSigmaPr(), ntrack.tofNSigmaPr()); + } if (ptrack.tpcInnerParam() > tpcCut) { if (!ptrack.hasTOF()) return false; - if (std::abs(ptrack.tofNSigmaPi()) > nsigmaTOFmax) + if (std::abs(sigmap) > nsigmaTOFmax) return false; } if (ntrack.tpcInnerParam() > tpcCut) { if (!ntrack.hasTOF()) return false; - if (std::abs(ntrack.tofNSigmaPr()) > nsigmaTOFmax) + if (std::abs(sigman) > nsigmaTOFmax) return false; } @@ -397,17 +585,31 @@ struct DedxPidAnalysis { if (!passedSingleTrackSelection(ntrack, collision)) return false; + double sigmap = 0.0; + double sigman = 0.0; + + if (v0SelectionMode == v0TPC) { + sigmap = ptrack.tpcNSigmaEl(); + sigman = ntrack.tpcNSigmaEl(); + } else if (v0SelectionMode == v0TOF) { + sigmap = ptrack.tofNSigmaEl(); + sigman = ntrack.tofNSigmaEl(); + } else if (v0SelectionMode == v0TPCTOF) { + sigmap = std::hypot(ptrack.tpcNSigmaEl(), ptrack.tofNSigmaEl()); + sigman = std::hypot(ntrack.tpcNSigmaEl(), ntrack.tofNSigmaEl()); + } + if (ptrack.tpcInnerParam() > tpcCut) { if (!ptrack.hasTOF()) return false; - if (std::abs(ptrack.tofNSigmaEl()) > nsigmaTOFmax) + if (std::abs(sigmap) > nsigmaTOFmax) return false; } if (ntrack.tpcInnerParam() > tpcCut) { if (!ntrack.hasTOF()) return false; - if (std::abs(ntrack.tofNSigmaEl()) > nsigmaTOFmax) + if (std::abs(sigman) > nsigmaTOFmax) return false; } @@ -417,17 +619,30 @@ struct DedxPidAnalysis { return true; } - + // Magnetic field + int getMagneticField(uint64_t timestamp) + { + static o2::parameters::GRPMagField* grpo = nullptr; + if (grpo == nullptr) { + grpo = ccdb->getForTimeStamp("GLO/Config/GRPMagField", timestamp); + if (grpo == nullptr) { + LOGF(fatal, "GRP object not found for timestamp %llu", timestamp); + return 0; + } + LOGF(info, "Retrieved GRP for timestamp %llu with magnetic field of %d kG", timestamp, grpo->getNominalL3Field()); + } + return grpo->getNominalL3Field(); + } // Phi cut template - bool passedPhiCut(const T& trk, float magField, const TF1& fphiCutLow, const TF1& fphiCutHigh) + bool passedPhiCutPri(const T& trk, float magField, const TF1& fphiCutLow, const TF1& fphiCutHigh) { + float p = trk.pt(); float pt = trk.pt(); float phi = trk.phi(); int charge = trk.sign(); float eta = trk.eta(); - auto nTPCCl = trk.tpcNClsFindable() - trk.tpcNClsFindableMinusFound(); - float sigP = trk.sign() * trk.tpcInnerParam(); + auto nTPCCl = trk.tpcNClsFound(); if (pt < pTcut) return true; @@ -441,115 +656,243 @@ struct DedxPidAnalysis { phi += o2::constants::math::PI / 18.0f; phi = std::fmod(phi, o2::constants::math::PI / 9.0f); - registryDeDx.fill(HIST("hpt_vs_phi_Ncl_Before"), pt, phi, nTPCCl); + registryDeDx.fill(HIST("hpt_vs_phi_Ncl_TPC_Before"), pt, phi, nTPCCl); + registryDeDx.fill(HIST("hp_vs_phi_Ncl_TPC_Before"), p, phi, nTPCCl); + registryDeDx.fill(HIST("heta_vs_Ncl_TPC_Before"), eta, nTPCCl); // cut phi if (phi < fphiCutHigh.Eval(pt) && phi > fphiCutLow.Eval(pt)) return false; // reject track + registryDeDx.fill(HIST("hpt_vs_phi_Ncl_TPC_After"), pt, phi, nTPCCl); + registryDeDx.fill(HIST("hp_vs_phi_Ncl_TPC_After"), p, phi, nTPCCl); + registryDeDx.fill(HIST("heta_vs_Ncl_TPC_After"), eta, nTPCCl); + + return true; + } + + // NclCutTPC + template + bool passedNTPCClCutPri(const T& trk) + { + float eta = trk.eta(); + float sigP = trk.sign() * trk.tpcInnerParam(); + auto nTPCCl = trk.tpcNClsFound(); + if (eta > EtaCut[0] && eta < EtaCut[1]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegBefore[0]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegBefore[0]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosBefore[0]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosBefore[0]), nTPCCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[1] && eta < EtaCut[2]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegBefore[1]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegBefore[1]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosBefore[1]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosBefore[1]), nTPCCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[2] && eta < EtaCut[3]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegBefore[2]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegBefore[2]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosBefore[2]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosBefore[2]), nTPCCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[3] && eta < EtaCut[4]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegBefore[3]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegBefore[3]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosBefore[3]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosBefore[3]), nTPCCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[4] && eta < EtaCut[5]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegBefore[4]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegBefore[4]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosBefore[4]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosBefore[4]), nTPCCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[5] && eta < EtaCut[6]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegBefore[5]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegBefore[5]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosBefore[5]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosBefore[5]), nTPCCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[6] && eta < EtaCut[7]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegBefore[6]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegBefore[6]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosBefore[6]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosBefore[6]), nTPCCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[7] && eta < EtaCut[8]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegBefore[7]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegBefore[7]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosBefore[7]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosBefore[7]), nTPCCl, trk.tpcSignal(), sigP); } } - // cut Ncl - if (nTPCCl < nclCut) + if (nTPCCl < minTPCnClsFound) return false; - registryDeDx.fill(HIST("hpt_vs_phi_Ncl_After"), pt, phi, nTPCCl); + if (eta > EtaCut[0] && eta < EtaCut[1]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegAfter[0]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosAfter[0]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[1] && eta < EtaCut[2]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegAfter[1]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosAfter[1]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[2] && eta < EtaCut[3]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegAfter[2]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosAfter[2]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[3] && eta < EtaCut[4]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegAfter[3]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosAfter[3]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[4] && eta < EtaCut[5]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegAfter[4]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosAfter[4]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[5] && eta < EtaCut[6]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegAfter[5]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosAfter[5]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[6] && eta < EtaCut[7]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegAfter[6]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosAfter[6]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[7] && eta < EtaCut[8]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegAfter[7]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosAfter[7]), nTPCCl, trk.tpcSignal(), sigP); + } + } + + return true; + } + + // NclCutITS + template + bool passedNITSClCutPri(const T& trk) + { + float eta = trk.eta(); + float sigP = trk.sign() * trk.tpcInnerParam(); + auto nITSCl = trk.itsNCls(); + + if (eta > EtaCut[0] && eta < EtaCut[1]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclITSDedxMomentumNegBefore[0]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclITSDedxMomentumPosBefore[0]), nITSCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[1] && eta < EtaCut[2]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclITSDedxMomentumNegBefore[1]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclITSDedxMomentumPosBefore[1]), nITSCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[2] && eta < EtaCut[3]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclITSDedxMomentumNegBefore[2]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclITSDedxMomentumPosBefore[2]), nITSCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[3] && eta < EtaCut[4]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclITSDedxMomentumNegBefore[3]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclITSDedxMomentumPosBefore[3]), nITSCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[4] && eta < EtaCut[5]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclITSDedxMomentumNegBefore[4]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclITSDedxMomentumPosBefore[4]), nITSCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[5] && eta < EtaCut[6]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclITSDedxMomentumNegBefore[5]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclITSDedxMomentumPosBefore[5]), nITSCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[6] && eta < EtaCut[7]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclITSDedxMomentumNegBefore[6]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclITSDedxMomentumPosBefore[6]), nITSCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[7] && eta < EtaCut[8]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclITSDedxMomentumNegBefore[7]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclITSDedxMomentumPosBefore[7]), nITSCl, trk.tpcSignal(), sigP); + } + } + + if (nITSCl < minITSnCls) + return false; if (eta > EtaCut[0] && eta < EtaCut[1]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegAfter[0]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclITSDedxMomentumNegAfter[0]), nITSCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosAfter[0]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclITSDedxMomentumPosAfter[0]), nITSCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[1] && eta < EtaCut[2]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegAfter[1]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclITSDedxMomentumNegAfter[1]), nITSCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosAfter[1]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclITSDedxMomentumPosAfter[1]), nITSCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[2] && eta < EtaCut[3]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegAfter[2]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclITSDedxMomentumNegAfter[2]), nITSCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosAfter[2]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclITSDedxMomentumPosAfter[2]), nITSCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[3] && eta < EtaCut[4]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegAfter[3]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclITSDedxMomentumNegAfter[3]), nITSCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosAfter[3]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclITSDedxMomentumPosAfter[3]), nITSCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[4] && eta < EtaCut[5]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegAfter[4]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclITSDedxMomentumNegAfter[4]), nITSCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosAfter[4]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclITSDedxMomentumPosAfter[4]), nITSCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[5] && eta < EtaCut[6]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegAfter[5]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclITSDedxMomentumNegAfter[5]), nITSCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosAfter[5]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclITSDedxMomentumPosAfter[5]), nITSCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[6] && eta < EtaCut[7]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegAfter[6]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclITSDedxMomentumNegAfter[6]), nITSCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosAfter[6]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclITSDedxMomentumPosAfter[6]), nITSCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[7] && eta < EtaCut[8]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegAfter[7]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclITSDedxMomentumNegAfter[7]), nITSCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosAfter[7]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclITSDedxMomentumPosAfter[7]), nITSCl, trk.tpcSignal(), sigP); } } @@ -563,7 +906,6 @@ struct DedxPidAnalysis { float pt = trk.pt(); float phi = trk.phi(); int charge = trk.sign(); - auto nTPCCl = trk.tpcNClsFindable() - trk.tpcNClsFindableMinusFound(); if (pt < pTcut) return true; @@ -581,42 +923,94 @@ struct DedxPidAnalysis { if (phi < fphiCutHigh.Eval(pt) && phi > fphiCutLow.Eval(pt)) return false; // reject track - // cut Ncl - if (nTPCCl < nclCut) + return true; + } + + // NclCutTPC + template + bool passedNTPCClCutSecondaries(const T& trk) + { + auto nTPCCl = trk.tpcNClsFound(); + + if (nTPCCl < minTPCnClsFound) + return false; + + return true; + } + + // NclCutITS primary + template + bool passedNITSClCutSecondaries(const T& trk) + { + auto nITSCl = trk.itsNCls(); + + if (nITSCl < minITSnCls) return false; return true; } // Process Data - void process(SelectedCollisions::iterator const& collision, + void process(SelectedCollisions::iterator const& collision, BCsRun3 const& /**/, aod::V0Datas const& fullV0s, PIDTracks const& tracks) { + registryDeDx.fill(HIST("evsel"), EvCutLabel::AllEv); // Event Selection if (!collision.sel8()) return; + registryDeDx.fill(HIST("evsel"), EvCutLabel::SelEigth); + if (std::abs(collision.posZ()) > maxZDistanceToIP) return; + registryDeDx.fill(HIST("evsel"), EvCutLabel::ZVtxCut); + + if (!collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) + return; + + registryDeDx.fill(HIST("evsel"), EvCutLabel::NoSameBunchPileup); + + if (!collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) + return; + + registryDeDx.fill(HIST("evsel"), EvCutLabel::GoodZvtxFT0vsPV); + // Event Counter registryDeDx.fill(HIST("histRecVtxZData"), collision.posZ()); - // Kaons - for (const auto& trk : tracks) { + // For magnetic field + const auto& foundBC = collision.foundBC_as(); + const uint64_t timeStamp{foundBC.timestamp()}; + const int magField{getMagneticField(timeStamp)}; + for (const auto& trk : tracks) { + registryDeDx.fill(HIST("trackselAll"), TrkPriCutLabel::AllPri); // track Selection - if (!passedSingleTrackSelection(trk, collision)) - continue; - if (!mySelectionPrim.IsSelected(trk)) continue; + registryDeDx.fill(HIST("trackselAll"), TrkPriCutLabel::SelectionPrim); + // phi and Ncl cut - if (additionalCuts) { - if (!passedPhiCut(trk, magField, *fphiCutLow, *fphiCutHigh)) + if (phiVarCut) { + if (!passedPhiCutPri(trk, magField, *fphiCutLow, *fphiCutHigh)) + continue; + } + registryDeDx.fill(HIST("trackselAll"), TrkPriCutLabel::PhiVarCutPri); + // NCl cut ITS + if (nTPCClCut) { + if (!passedNTPCClCutPri(trk)) + continue; + } + registryDeDx.fill(HIST("trackselAll"), TrkPriCutLabel::NTPCClCutPri); + + // NCl cut ITS + if (nITSClCut) { + if (!passedNITSClCutPri(trk)) continue; } + registryDeDx.fill(HIST("trackselAll"), TrkPriCutLabel::NITSClCutPri); float signedP = trk.sign() * trk.tpcInnerParam(); @@ -710,14 +1104,11 @@ struct DedxPidAnalysis { for (const auto& v0 : fullV0s) { // Standard V0 Selections + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::AllSec); if (!passedV0Selection(v0, collision)) { continue; } - if (v0.dcaV0daughters() > dcaV0DaughtersMax) { - continue; - } - // Positive and Negative Tracks const auto& posTrack = v0.posTrack_as(); const auto& negTrack = v0.negTrack_as(); @@ -726,14 +1117,37 @@ struct DedxPidAnalysis { continue; if (!negTrack.passedTPCRefit()) continue; + + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::TPCRefit); // phi and Ncl cut - if (additionalCuts) { + if (phiVarCut) { if (!passedPhiCutSecondaries(posTrack, magField, *fphiCutLow, *fphiCutHigh)) continue; if (!passedPhiCutSecondaries(negTrack, magField, *fphiCutLow, *fphiCutHigh)) continue; } + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel ::PhiVarCutSec); + + if (nTPCClCut) { + if (!passedNTPCClCutSecondaries(posTrack)) + continue; + + if (!passedNTPCClCutSecondaries(negTrack)) + continue; + } + + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel ::NTPCClCutSec); + + if (nITSClCut) { + if (!passedNITSClCutSecondaries(posTrack)) + continue; + + if (!passedNITSClCutSecondaries(negTrack)) + continue; + } + + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel ::NITSClCutSec); float signedPpos = posTrack.sign() * posTrack.tpcInnerParam(); float signedPneg = negTrack.sign() * negTrack.tpcInnerParam(); @@ -750,6 +1164,19 @@ struct DedxPidAnalysis { // K0s Selection if (passedK0Selection(v0, negTrack, posTrack, collision)) { + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::AllK0s); + + if (std::abs(v0.rapidity(MassK0Short)) > v0rapidityCut) + continue; + + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0RapidityK0s); + float properLifetime = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * MassK0Short; + + if (properLifetime > v0ProperLifetimeCutK0s) + continue; + + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0ProperLifetimeK0s); + float ePosPi = posTrack.energy(MassPionCharged); float eNegPi = negTrack.energy(MassPionCharged); @@ -771,6 +1198,18 @@ struct DedxPidAnalysis { // Lambda Selection if (passedLambdaSelection(v0, negTrack, posTrack, collision)) { + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::AllLambda); + + if (std::abs(v0.rapidity(MassLambda)) > v0rapidityCut) + continue; + + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0RapidityLambda); + float properLifetime = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * MassLambda; + + if (properLifetime > v0ProperLifetimeCutLambda) + continue; + + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0ProperLifetimeLambda); float ePosPr = posTrack.energy(MassProton); float eNegPi = negTrack.energy(MassPionCharged); @@ -793,6 +1232,18 @@ struct DedxPidAnalysis { // AntiLambda Selection if (passedAntiLambdaSelection(v0, negTrack, posTrack, collision)) { + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::AllAntiLambda); + + if (std::abs(v0.rapidity(MassLambda)) > v0rapidityCut) + continue; + + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0RapidityAntiLambda); + float properLifetime = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * MassLambda; + + if (properLifetime > v0ProperLifetimeCutLambda) + continue; + + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0ProperLifetimeAntiLambda); float ePosPi = posTrack.energy(MassPionCharged); float eNegPr = negTrack.energy(MassProton); @@ -815,6 +1266,7 @@ struct DedxPidAnalysis { // Gamma Selection if (passedGammaSelection(v0, negTrack, posTrack, collision)) { + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::AllGamma); float ePosEl = posTrack.energy(MassElectron); float eNegEl = negTrack.energy(MassElectron); diff --git a/PWGMM/UE/Tasks/dedxAnalysis.cxx b/PWGMM/UE/Tasks/dedxAnalysis.cxx index 11aea4031be..faaf9cca459 100644 --- a/PWGMM/UE/Tasks/dedxAnalysis.cxx +++ b/PWGMM/UE/Tasks/dedxAnalysis.cxx @@ -25,11 +25,18 @@ #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CcdbApi.h" +#include "CommonConstants/PhysicsConstants.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "Framework/ASoA.h" #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" +#include "Framework/Logger.h" #include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/Track.h" +#include "ReconstructionDataFormats/V0.h" #include "TF1.h" @@ -42,6 +49,7 @@ using PIDTracks = soa::Join< aod::pidTOFFullPi, aod::pidTOFFullPr, aod::pidTOFFullEl, aod::pidTOFbeta>; using SelectedCollisions = soa::Join; +using BCsRun3 = soa::Join; struct DedxAnalysis { @@ -62,13 +70,47 @@ struct DedxAnalysis { float pionTofCut = 1.0; float invMassCut = 0.01; float invMassCutGamma = 0.0015; - float magField = 1; float pTcut = 2.0; + // Event cut labels + enum EvCutLabel { + AllEv = 1, + SelEigth, + ZVtxCut + }; + + // Track primary label + enum TrkPriCutLabel { + AllPri = 1, + SelectionPrim, + PhiVarCutPri, + NTPCClCutPri, + NITSClCutPri + }; + + // Track secondary lebel + enum TrkSecCutLabel { + AllSec = 1, + V0CosPA, + V0DecayRadius, + V0Daughters, + TPCRefit, + PhiVarCutSec, + NTPCClCutSec, + NITSClCutSec, + V0RapidityK0s, + V0ProperLifetimeK0s, + V0RapidityLambda, + V0ProperLifetimeLambda, + V0RapidityAntiLambda, + V0ProperLifetimeAntiLambda + }; // Configurable Parameters // Tracks cuts Configurable minTPCnClsFound{"minTPCnClsFound", 70.0f, "min number of found TPC clusters"}; + Configurable minITSnCls{"minITSnCls", 70.0f, + "min number of ITS clusters"}; Configurable minNCrossedRowsTPC{"minNCrossedRowsTPC", 70.0f, "min number of found TPC crossed rows"}; Configurable maxChi2TPC{"maxChi2TPC", 4.0f, "max chi2 per cluster TPC"}; @@ -79,7 +121,7 @@ struct DedxAnalysis { Configurable etaMin{"etaMin", -0.8f, "etaMin"}; Configurable etaMax{"etaMax", +0.8f, "etaMax"}; Configurable minNCrossedRowsOverFindableClustersTPC{"minNCrossedRowsOverFindableClustersTPC", 0.8f, "Additional cut on the minimum value of the ratio between crossed rows and findable clusters in the TPC"}; - Configurable maxDCAz{"maxDCAz", 2.f, "maxDCAz"}; + Configurable maxDCAz{"maxDCAz", 0.1f, "maxDCAz"}; // v0 cuts Configurable v0cospaMin{"v0cospaMin", 0.998f, "Minimum V0 CosPA"}; Configurable minimumV0Radius{"minimumV0Radius", 0.5f, @@ -88,6 +130,9 @@ struct DedxAnalysis { "Maximum V0 Radius"}; Configurable dcaV0DaughtersMax{"dcaV0DaughtersMax", 0.5f, "Maximum DCA Daughters"}; + Configurable v0rapidityCut{"v0rapidityCut", 0.5f, "V0 rapidity cut"}; + Configurable v0ProperLifetimeCutK0s{"v0ProperLifetimeCutK0s", 20.f, "V0 proper lifetime cut for K0s"}; + Configurable v0ProperLifetimeCutLambda{"v0ProperLifetimeCutLambda", 30.f, "V0 proper lifetime cut for Lambda"}; Configurable nsigmaTOFmax{"nsigmaTOFmax", 3.0f, "Maximum nsigma TOF"}; Configurable minMassK0s{"minMassK0s", 0.4f, "Minimum Mass K0s"}; Configurable maxMassK0s{"maxMassK0s", 0.6f, "Maximum Mass K0s"}; @@ -99,17 +144,23 @@ struct DedxAnalysis { "Minimum Mass Gamma"}; Configurable maxMassGamma{"maxMassGamma", 0.002022f, "Maximum Mass Gamma"}; - Configurable nclCut{"nclCut", 135.0f, - "ncl Cut"}; Configurable calibrationMode{"calibrationMode", false, "calibration mode"}; - Configurable additionalCuts{"additionalCuts", true, "additional cuts"}; + Configurable phiVarCut{"phiVarCut", true, "phi var cut"}; + Configurable nTPCClCut{"nTPCClCut", true, "number of clusters in TPC cut"}; + Configurable nITSClCut{"nITSClCut", true, "number of clusters in ITS cut"}; // Histograms names static constexpr std::string_view kDedxvsMomentumPos[kParticlesType] = {"dEdx_vs_Momentum_all_Pos", "dEdx_vs_Momentum_Pi_v0_Pos", "dEdx_vs_Momentum_Pr_v0_Pos", "dEdx_vs_Momentum_El_v0_Pos"}; static constexpr std::string_view kDedxvsMomentumNeg[kParticlesType] = {"dEdx_vs_Momentum_all_Neg", "dEdx_vs_Momentum_Pi_v0_Neg", "dEdx_vs_Momentum_Pr_v0_Neg", "dEdx_vs_Momentum_El_v0_Neg"}; - static constexpr std::string_view kNclDedxMomentumNegBefore[kEtaIntervals] = {"Ncl_vs_dEdx_vs_Momentum_Neg_1_Before", "Ncl_vs_dEdx_vs_Momentum_Neg_2_Before", "Ncl_vs_dEdx_vs_Momentum_Neg_3_Before", "Ncl_vs_dEdx_vs_Momentum_Neg_4_Before", "Ncl_vs_dEdx_vs_Momentum_Neg_5_Before", "Ncl_vs_dEdx_vs_Momentum_Neg_6_Before", "Ncl_vs_dEdx_vs_Momentum_Neg_7_Before", "Ncl_vs_dEdx_vs_Momentum_Neg_8_Before"}; - static constexpr std::string_view kNclDedxMomentumPosBefore[kEtaIntervals] = {"Ncl_vs_dEdx_vs_Momentum_Pos_1_Before", "Ncl_vs_dEdx_vs_Momentum_Pos_2_Before", "Ncl_vs_dEdx_vs_Momentum_Pos_3_Before", "Ncl_vs_dEdx_vs_Momentum_Pos_4_Before", "Ncl_vs_dEdx_vs_Momentum_Pos_5_Before", "Ncl_vs_dEdx_vs_Momentum_Pos_6_Before", "Ncl_vs_dEdx_vs_Momentum_Pos_7_Before", "Ncl_vs_dEdx_vs_Momentum_Pos_8_Before"}; - static constexpr std::string_view kNclDedxMomentumNegAfter[kEtaIntervals] = {"Ncl_vs_dEdx_vs_Momentum_Neg_1_After", "Ncl_vs_dEdx_vs_Momentum_Neg_2_After", "Ncl_vs_dEdx_vs_Momentum_Neg_3_After", "Ncl_vs_dEdx_vs_Momentum_Neg_4_After", "Ncl_vs_dEdx_vs_Momentum_Neg_5_After", "Ncl_vs_dEdx_vs_Momentum_Neg_6_After", "Ncl_vs_dEdx_vs_Momentum_Neg_7_After", "Ncl_vs_dEdx_vs_Momentum_Neg_8_After"}; - static constexpr std::string_view kNclDedxMomentumPosAfter[kEtaIntervals] = {"Ncl_vs_dEdx_vs_Momentum_Pos_1_After", "Ncl_vs_dEdx_vs_Momentum_Pos_2_After", "Ncl_vs_dEdx_vs_Momentum_Pos_3_After", "Ncl_vs_dEdx_vs_Momentum_Pos_4_After", "Ncl_vs_dEdx_vs_Momentum_Pos_5_After", "Ncl_vs_dEdx_vs_Momentum_Pos_6_After", "Ncl_vs_dEdx_vs_Momentum_Pos_7_After", "Ncl_vs_dEdx_vs_Momentum_Pos_8_After"}; + // Ncl TPC + static constexpr std::string_view kNclTPCDedxMomentumNegBefore[kEtaIntervals] = {"Ncl_TPC_vs_dEdx_vs_Momentum_Neg_1_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_2_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_3_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_4_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_5_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_6_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_7_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_8_Before"}; + static constexpr std::string_view kNclTPCDedxMomentumPosBefore[kEtaIntervals] = {"Ncl_TPC_vs_dEdx_vs_Momentum_Pos_1_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_2_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_3_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_4_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_5_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_6_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_7_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_8_Before"}; + static constexpr std::string_view kNclTPCDedxMomentumNegAfter[kEtaIntervals] = {"Ncl_TPC_vs_dEdx_vs_Momentum_Neg_1_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_2_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_3_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_4_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_5_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_6_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_7_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_8_After"}; + static constexpr std::string_view kNclTPCDedxMomentumPosAfter[kEtaIntervals] = {"Ncl_TPC_vs_dEdx_vs_Momentum_Pos_1_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_2_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_3_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_4_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_5_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_6_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_7_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_8_After"}; + // Ncl TPC + static constexpr std::string_view kNclITSDedxMomentumNegBefore[kEtaIntervals] = {"Ncl_ITS_vs_dEdx_vs_Momentum_Neg_1_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_2_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_3_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_4_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_5_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_6_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_7_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_8_Before"}; + static constexpr std::string_view kNclITSDedxMomentumPosBefore[kEtaIntervals] = {"Ncl_ITS_vs_dEdx_vs_Momentum_Pos_1_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_2_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_3_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_4_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_5_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_6_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_7_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_8_Before"}; + static constexpr std::string_view kNclITSDedxMomentumNegAfter[kEtaIntervals] = {"Ncl_ITS_vs_dEdx_vs_Momentum_Neg_1_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_2_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_3_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_4_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_5_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_6_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_7_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_8_After"}; + static constexpr std::string_view kNclITSDedxMomentumPosAfter[kEtaIntervals] = {"Ncl_ITS_vs_dEdx_vs_Momentum_Pos_1_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_2_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_3_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_4_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_5_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_6_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_7_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_8_After"}; static constexpr double EtaCut[kEtaIntervals + 1] = {-0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6, 0.8}; Configurable> calibrationFactorNeg{"calibrationFactorNeg", {50.4011, 50.4764, 50.186, 49.2955, 48.8222, 49.4273, 49.9292, 50.0556}, "negative calibration factors"}; Configurable> calibrationFactorPos{"calibrationFactorPos", {50.5157, 50.6359, 50.3198, 49.3345, 48.9197, 49.4931, 50.0188, 50.1406}, "positive calibration factors"}; @@ -118,6 +169,7 @@ struct DedxAnalysis { // phi cut fits TF1* fphiCutHigh = nullptr; TF1* fphiCutLow = nullptr; + Service ccdb; TrackSelection myTrackSelection() { @@ -129,7 +181,7 @@ struct DedxAnalysis { selectedTracks.SetMinNCrossedRowsTPC(minNCrossedRowsTPC); selectedTracks.SetMinNCrossedRowsOverFindableClustersTPC(minNCrossedRowsOverFindableClustersTPC); selectedTracks.SetMaxChi2PerClusterTPC(maxChi2TPC); - selectedTracks.SetRequireHitsInITSLayers(1, {0, 1}); + selectedTracks.SetRequireHitsInITSLayers(1, {0, 1, 2}); selectedTracks.SetMaxChi2PerClusterITS(maxChi2ITS); selectedTracks.SetMaxDcaXYPtDep([](float pt) { return 0.0105f + 0.0350f / std::pow(pt, 1.1f); }); selectedTracks.SetMaxDcaZ(maxDCAz); @@ -201,11 +253,11 @@ struct DedxAnalysis { // pt vs p registryDeDx.add( - "hp_vs_pt_all_Neg", "p_vs_pT", HistType::kTH2F, - {{ptAxis}, {pAxis}}); + "heta_vs_p_vs_pt_all_Neg", "eta_vs_p_vs_pT", HistType::kTH3F, + {{etaAxis}, {ptAxis}, {pAxis}}); registryDeDx.add( - "hp_vs_pt_all_Pos", "p_vs_pT", HistType::kTH2F, - {{ptAxis}, {pAxis}}); + "heta_vs_p_vs_pt_all_Pos", "eta_vs_p_vs_pT", HistType::kTH3F, + {{etaAxis}, {ptAxis}, {pAxis}}); // De/Dx for ch and v0 particles for (int i = 0; i < kParticlesType; ++i) { @@ -219,28 +271,45 @@ struct DedxAnalysis { registryDeDx.add( "hdEdx_vs_phi", "dE/dx", HistType::kTH2F, {{100, 0.0, 6.4, "#phi"}, {dedxAxis}}); - // phi cut - registryDeDx.add( - "hpt_vs_phi_Ncl_After", "phi cut", HistType::kTH3F, - {{ptAxis}, {100, 0.0, 0.4, "#varphi^{'}"}, {100, 0, 160, "N_{cl}"}}); - - registryDeDx.add( - "hpt_vs_phi_Ncl_Before", "phi cut", HistType::kTH3F, - {{ptAxis}, {100, 0.0, 0.4, "#varphi^{'}"}, {100, 0, 160, "N_{cl}"}}); - - // Ncl vs de/dx + if (phiVarCut) { + registryDeDx.add( + "hpt_vs_phi_Ncl_TPC_After", "phi cut", HistType::kTH3F, + {{ptAxis}, {100, 0.0, 0.4, "#varphi^{'}"}, {100, 0, 160, "N_{cl}"}}); - for (int i = 0; i < kEtaIntervals; ++i) { - registryDeDx.add(kNclDedxMomentumPosBefore[i].data(), "Ncl vs dE/dx vs Momentum Positive before", HistType::kTH3F, - {{100, 0, 160, "N_{cl}"}, {dedxAxis}, {pAxis}}); - registryDeDx.add(kNclDedxMomentumNegBefore[i].data(), "Ncl vs dE/dx vs Momentum Negative before", HistType::kTH3F, - {{100, 0, 160, "N_{cl}"}, {dedxAxis}, {pAxis}}); + registryDeDx.add( + "hpt_vs_phi_Ncl_TPC_Before", "phi cut", HistType::kTH3F, + {{ptAxis}, {100, 0.0, 0.4, "#varphi^{'}"}, {100, 0, 160, "N_{cl}"}}); + + // Ncl vs de/dx TPC + + for (int i = 0; i < kEtaIntervals; ++i) { + registryDeDx.add(kNclTPCDedxMomentumPosBefore[i].data(), "Ncl TPC vs dE/dx vs Momentum Positive before", HistType::kTH3F, + {{100, 0, 160, "N_{cl}^{TPC}"}, {dedxAxis}, {pAxis}}); + registryDeDx.add(kNclTPCDedxMomentumNegBefore[i].data(), "Ncl TPC vs dE/dx vs Momentum Negative before", HistType::kTH3F, + {{100, 0, 160, "N_{cl}^{TPC}"}, {dedxAxis}, {pAxis}}); + if (nTPCClCut) { + registryDeDx.add(kNclTPCDedxMomentumPosAfter[i].data(), "Ncl TPC vs dE/dx vs Momentum Positive after", HistType::kTH3F, + {{100, 0, 160, "N_{cl}^{TPC}"}, {dedxAxis}, {pAxis}}); + registryDeDx.add(kNclTPCDedxMomentumNegAfter[i].data(), "Ncl TPC vs dE/dx vs Momentum Negative after", HistType::kTH3F, + {{100, 0, 160, "N_{cl}^{TPC}"}, {dedxAxis}, {pAxis}}); + } + } + } - registryDeDx.add(kNclDedxMomentumPosAfter[i].data(), "Ncl vs dE/dx vs Momentum Positive after", HistType::kTH3F, - {{100, 0, 160, "N_{cl}"}, {dedxAxis}, {pAxis}}); - registryDeDx.add(kNclDedxMomentumNegAfter[i].data(), "Ncl vs dE/dx vs Momentum Negative after", HistType::kTH3F, - {{100, 0, 160, "N_{cl}"}, {dedxAxis}, {pAxis}}); + // Ncl vs de/dx ITS + if (nITSClCut) { + for (int i = 0; i < kEtaIntervals; ++i) { + registryDeDx.add(kNclITSDedxMomentumPosBefore[i].data(), "Ncl ITS vs dE/dx vs Momentum Positive before", HistType::kTH3F, + {{100, 0, 160, "N_{cl}^{ITS}"}, {dedxAxis}, {pAxis}}); + registryDeDx.add(kNclITSDedxMomentumNegBefore[i].data(), "Ncl ITS vs dE/dx vs Momentum Negative before", HistType::kTH3F, + {{100, 0, 160, "N_{cl}^{ITS}"}, {dedxAxis}, {pAxis}}); + + registryDeDx.add(kNclITSDedxMomentumPosAfter[i].data(), "Ncl ITS vs dE/dx vs Momentum Positive after", HistType::kTH3F, + {{100, 0, 160, "N_{cl}^{ITS}"}, {dedxAxis}, {pAxis}}); + registryDeDx.add(kNclITSDedxMomentumNegAfter[i].data(), "Ncl ITS vs dE/dx vs Momentum Negative after", HistType::kTH3F, + {{100, 0, 160, "N_{cl}^{ITS}"}, {dedxAxis}, {pAxis}}); + } } // beta plot @@ -255,6 +324,42 @@ struct DedxAnalysis { // Event Counter registryDeDx.add("histRecVtxZData", "collision z position", HistType::kTH1F, {{100, -20.0, +20.0, "z_{vtx} (cm)"}}); + // Event Counter + registryDeDx.add("evsel", "events selected", HistType::kTH1F, {{3, 0.5, 3.5, ""}}); + auto hstat = registryDeDx.get(HIST("evsel")); + auto* x = hstat->GetXaxis(); + x->SetBinLabel(1, "AllEv"); + x->SetBinLabel(2, "SelEigth"); + x->SetBinLabel(3, "ZVtxCut"); + + // Track Counter + registryDeDx.add("trackselAll", "track selected all particles", HistType::kTH1F, {{5, 0.5, 5.5, ""}}); + auto htrackAll = registryDeDx.get(HIST("trackselAll")); + auto* xAll = htrackAll->GetXaxis(); + xAll->SetBinLabel(1, "AllPri"); + xAll->SetBinLabel(2, "SelectionPrim"); + xAll->SetBinLabel(3, "PhiVarCutPri"); + xAll->SetBinLabel(4, "NTPCClCutPri"); + xAll->SetBinLabel(5, "NITSClCutPri"); + + registryDeDx.add("trackselSec", "track selected sec particles", HistType::kTH1F, {{13, 0.5, 13.5, ""}}); + auto htrackSec = registryDeDx.get(HIST("trackselSec")); + auto* xSec = htrackSec->GetXaxis(); + xSec->SetBinLabel(1, "AllSec"); + xSec->SetBinLabel(2, "V0CosPA"); + xSec->SetBinLabel(3, "V0DecayRadius"); + xSec->SetBinLabel(4, "V0Daughters"); + xSec->SetBinLabel(5, "TPCRefit"); + xSec->SetBinLabel(6, "PhiVarCutSec"); + xSec->SetBinLabel(7, "NTPCClCutSec"); + xSec->SetBinLabel(8, "NITSClCutSec"); + xSec->SetBinLabel(9, "V0RapidityK0s"); + xSec->SetBinLabel(10, "V0ProperLifetimeK0s"); + xSec->SetBinLabel(11, "V0RapidityLambda"); + xSec->SetBinLabel(12, "V0ProperLifetimeLambda"); + xSec->SetBinLabel(13, "V0RapidityAntiLambda"); + xSec->SetBinLabel(14, "V0ProperLifetimeAntiLambda"); + mySelectionPrim = myTrackSelection(); } @@ -265,8 +370,6 @@ struct DedxAnalysis { // Single-Track Selections if (!track.hasTPC()) return false; - if (track.tpcNClsFound() < minTPCnClsFound) - return false; if (track.tpcNClsCrossedRows() < minNCrossedRowsTPC) return false; if (track.tpcChi2NCl() > maxChi2TPC) @@ -283,8 +386,15 @@ struct DedxAnalysis { { if (v0.v0cosPA() < v0cospaMin) return false; + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0CosPA); + if (v0.v0radius() < minimumV0Radius || v0.v0radius() > maximumV0Radius) return false; + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0DecayRadius); + + if (v0.dcaV0daughters() > dcaV0DaughtersMax) + return false; + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0Daughters); return true; } @@ -417,17 +527,31 @@ struct DedxAnalysis { return true; } + // Magnetic field + int getMagneticField(uint64_t timestamp) + { + static o2::parameters::GRPMagField* grpo = nullptr; + if (grpo == nullptr) { + grpo = ccdb->getForTimeStamp("GLO/Config/GRPMagField", timestamp); + if (grpo == nullptr) { + LOGF(fatal, "GRP object not found for timestamp %llu", timestamp); + return 0; + } + LOGF(info, "Retrieved GRP for timestamp %llu with magnetic field of %d kG", timestamp, grpo->getNominalL3Field()); + } + return grpo->getNominalL3Field(); + } // Phi cut template - bool passedPhiCut(const T& trk, float magField, const TF1& fphiCutLow, const TF1& fphiCutHigh) + bool passedPhiVarCut(const T& trk, float magField, const TF1& fphiCutLow, const TF1& fphiCutHigh) { float pt = trk.pt(); float phi = trk.phi(); int charge = trk.sign(); float eta = trk.eta(); - auto nTPCCl = trk.tpcNClsFindable() - trk.tpcNClsFindableMinusFound(); float sigP = trk.sign() * trk.tpcInnerParam(); + auto nTPCCl = trk.tpcNClsFound(); if (pt < pTcut) return true; @@ -441,7 +565,7 @@ struct DedxAnalysis { phi += o2::constants::math::PI / 18.0f; phi = std::fmod(phi, o2::constants::math::PI / 9.0f); - registryDeDx.fill(HIST("hpt_vs_phi_Ncl_Before"), pt, phi, nTPCCl); + registryDeDx.fill(HIST("hpt_vs_phi_Ncl_TPC_Before"), pt, phi, nTPCCl); // cut phi if (phi < fphiCutHigh.Eval(pt) && phi > fphiCutLow.Eval(pt)) @@ -449,107 +573,224 @@ struct DedxAnalysis { if (eta > EtaCut[0] && eta < EtaCut[1]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegBefore[0]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegBefore[0]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosBefore[0]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosBefore[0]), nTPCCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[1] && eta < EtaCut[2]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegBefore[1]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegBefore[1]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosBefore[1]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosBefore[1]), nTPCCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[2] && eta < EtaCut[3]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegBefore[2]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegBefore[2]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosBefore[2]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosBefore[2]), nTPCCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[3] && eta < EtaCut[4]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegBefore[3]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegBefore[3]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosBefore[3]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosBefore[3]), nTPCCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[4] && eta < EtaCut[5]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegBefore[4]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegBefore[4]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosBefore[4]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosBefore[4]), nTPCCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[5] && eta < EtaCut[6]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegBefore[5]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegBefore[5]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosBefore[5]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosBefore[5]), nTPCCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[6] && eta < EtaCut[7]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegBefore[6]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegBefore[6]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosBefore[6]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosBefore[6]), nTPCCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[7] && eta < EtaCut[8]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegBefore[7]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegBefore[7]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosBefore[7]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosBefore[7]), nTPCCl, trk.tpcSignal(), sigP); } } + registryDeDx.fill(HIST("trackselAll"), TrkPriCutLabel::PhiVarCutPri); - // cut Ncl - if (nTPCCl < nclCut) - return false; + if (nTPCClCut) { + // cut Ncl + if (nTPCCl < minTPCnClsFound) + return false; - registryDeDx.fill(HIST("hpt_vs_phi_Ncl_After"), pt, phi, nTPCCl); + registryDeDx.fill(HIST("hpt_vs_phi_Ncl_TPC_After"), pt, phi, nTPCCl); + + if (eta > EtaCut[0] && eta < EtaCut[1]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegAfter[0]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosAfter[0]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[1] && eta < EtaCut[2]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegAfter[1]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosAfter[1]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[2] && eta < EtaCut[3]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegAfter[2]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosAfter[2]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[3] && eta < EtaCut[4]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegAfter[3]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosAfter[3]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[4] && eta < EtaCut[5]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegAfter[4]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosAfter[4]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[5] && eta < EtaCut[6]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegAfter[5]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosAfter[5]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[6] && eta < EtaCut[7]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegAfter[6]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosAfter[6]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[7] && eta < EtaCut[8]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclTPCDedxMomentumNegAfter[7]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclTPCDedxMomentumPosAfter[7]), nTPCCl, trk.tpcSignal(), sigP); + } + } + } + registryDeDx.fill(HIST("trackselAll"), TrkPriCutLabel::NTPCClCutPri); + return true; + } + + // NclCutITS + template + bool passedNITSClCut(const T& trk) + { + float eta = trk.eta(); + float sigP = trk.sign() * trk.tpcInnerParam(); + auto nITSCl = trk.itsNCls(); if (eta > EtaCut[0] && eta < EtaCut[1]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegAfter[0]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclITSDedxMomentumNegBefore[0]), nITSCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosAfter[0]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclITSDedxMomentumPosBefore[0]), nITSCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[1] && eta < EtaCut[2]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegAfter[1]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclITSDedxMomentumNegBefore[1]), nITSCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosAfter[1]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclITSDedxMomentumPosBefore[1]), nITSCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[2] && eta < EtaCut[3]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegAfter[2]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclITSDedxMomentumNegBefore[2]), nITSCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosAfter[2]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclITSDedxMomentumPosBefore[2]), nITSCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[3] && eta < EtaCut[4]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegAfter[3]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclITSDedxMomentumNegBefore[3]), nITSCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosAfter[3]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclITSDedxMomentumPosBefore[3]), nITSCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[4] && eta < EtaCut[5]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegAfter[4]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclITSDedxMomentumNegBefore[4]), nITSCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosAfter[4]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclITSDedxMomentumPosBefore[4]), nITSCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[5] && eta < EtaCut[6]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegAfter[5]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclITSDedxMomentumNegBefore[5]), nITSCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosAfter[5]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclITSDedxMomentumPosBefore[5]), nITSCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[6] && eta < EtaCut[7]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegAfter[6]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclITSDedxMomentumNegBefore[6]), nITSCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosAfter[6]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclITSDedxMomentumPosBefore[6]), nITSCl, trk.tpcSignal(), sigP); } } else if (eta > EtaCut[7] && eta < EtaCut[8]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclDedxMomentumNegAfter[7]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclITSDedxMomentumNegBefore[7]), nITSCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclDedxMomentumPosAfter[7]), nTPCCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclITSDedxMomentumPosBefore[7]), nITSCl, trk.tpcSignal(), sigP); + } + } + + if (nITSCl < minITSnCls) + return false; + + if (eta > EtaCut[0] && eta < EtaCut[1]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclITSDedxMomentumNegAfter[0]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclITSDedxMomentumPosAfter[0]), nITSCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[1] && eta < EtaCut[2]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclITSDedxMomentumNegAfter[1]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclITSDedxMomentumPosAfter[1]), nITSCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[2] && eta < EtaCut[3]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclITSDedxMomentumNegAfter[2]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclITSDedxMomentumPosAfter[2]), nITSCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[3] && eta < EtaCut[4]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclITSDedxMomentumNegAfter[3]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclITSDedxMomentumPosAfter[3]), nITSCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[4] && eta < EtaCut[5]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclITSDedxMomentumNegAfter[4]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclITSDedxMomentumPosAfter[4]), nITSCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[5] && eta < EtaCut[6]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclITSDedxMomentumNegAfter[5]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclITSDedxMomentumPosAfter[5]), nITSCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[6] && eta < EtaCut[7]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclITSDedxMomentumNegAfter[6]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclITSDedxMomentumPosAfter[6]), nITSCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[7] && eta < EtaCut[8]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclITSDedxMomentumNegAfter[7]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclITSDedxMomentumPosAfter[7]), nITSCl, trk.tpcSignal(), sigP); } } @@ -563,7 +804,6 @@ struct DedxAnalysis { float pt = trk.pt(); float phi = trk.phi(); int charge = trk.sign(); - auto nTPCCl = trk.tpcNClsFindable() - trk.tpcNClsFindableMinusFound(); if (pt < pTcut) return true; @@ -581,8 +821,28 @@ struct DedxAnalysis { if (phi < fphiCutHigh.Eval(pt) && phi > fphiCutLow.Eval(pt)) return false; // reject track - // cut Ncl - if (nTPCCl < nclCut) + return true; + } + + // NclCutTPC + template + bool passedNTPCClCutSecondaries(const T& trk) + { + auto nTPCCl = trk.tpcNClsFound(); + + if (nTPCCl < minTPCnClsFound) + return false; + + return true; + } + + // NclCutITS primary + template + bool passedNITSClCutSecondaries(const T& trk) + { + auto nITSCl = trk.itsNCls(); + + if (nITSCl < minITSnCls) return false; return true; @@ -592,40 +852,46 @@ struct DedxAnalysis { void process(SelectedCollisions::iterator const& collision, aod::V0Datas const& fullV0s, PIDTracks const& tracks) { + registryDeDx.fill(HIST("evsel"), EvCutLabel::AllEv); // Event Selection if (!collision.sel8()) return; - if (additionalCuts) { - if (!collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) - return; + registryDeDx.fill(HIST("evsel"), EvCutLabel::SelEigth); - if (!collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) - return; - - if (std::abs(collision.posZ()) >= maxZDistanceToIP) - return; + if (std::abs(collision.posZ()) > maxZDistanceToIP) + return; - if (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) - return; - } + registryDeDx.fill(HIST("evsel"), EvCutLabel::ZVtxCut); // Event Counter registryDeDx.fill(HIST("histRecVtxZData"), collision.posZ()); - // Kaons - for (const auto& trk : tracks) { + // For magnetic field + const auto& foundBC = collision.foundBC_as(); + const uint64_t timeStamp{foundBC.timestamp()}; + const int magField{getMagneticField(timeStamp)}; + for (const auto& trk : tracks) { + registryDeDx.fill(HIST("trackselAll"), TrkPriCutLabel::AllPri); // track Selection - if (!passedSingleTrackSelection(trk, collision)) - continue; - if (!mySelectionPrim.IsSelected(trk)) continue; + registryDeDx.fill(HIST("trackselAll"), TrkPriCutLabel::SelectionPrim); + // phi and Ncl cut - if (!passedPhiCut(trk, magField, *fphiCutLow, *fphiCutHigh)) - continue; + if (phiVarCut) { + if (!passedPhiVarCut(trk, magField, *fphiCutLow, *fphiCutHigh)) + continue; + } + + // NCl cut ITS + if (nITSClCut) { + if (!passedNITSClCut(trk)) + continue; + } + registryDeDx.fill(HIST("trackselAll"), TrkPriCutLabel::NITSClCutPri); float signedP = trk.sign() * trk.tpcInnerParam(); @@ -704,10 +970,10 @@ struct DedxAnalysis { if (trk.eta() > EtaCut[i] && trk.eta() < EtaCut[i + 1]) { if (signedP > 0) { registryDeDx.fill(HIST(kDedxvsMomentumPos[0]), signedP, trk.tpcSignal() * 50 / calibrationFactorPos->at(i), trk.eta()); - registryDeDx.fill(HIST("hp_vs_pt_all_Pos"), trk.pt(), signedP); + registryDeDx.fill(HIST("heta_vs_p_vs_pt_all_Pos"), trk.eta(), trk.pt(), signedP); } else { registryDeDx.fill(HIST(kDedxvsMomentumNeg[0]), std::abs(signedP), trk.tpcSignal() * 50 / calibrationFactorNeg->at(i), trk.eta()); - registryDeDx.fill(HIST("hp_vs_pt_all_Neg"), trk.pt(), std::abs(signedP)); + registryDeDx.fill(HIST("heta_vs_p_vs_pt_all_Neg"), trk.eta(), trk.pt(), std::abs(signedP)); } } } @@ -719,14 +985,11 @@ struct DedxAnalysis { for (const auto& v0 : fullV0s) { // Standard V0 Selections + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::AllSec); if (!passedV0Selection(v0, collision)) { continue; } - if (v0.dcaV0daughters() > dcaV0DaughtersMax) { - continue; - } - // Positive and Negative Tracks const auto& posTrack = v0.posTrack_as(); const auto& negTrack = v0.negTrack_as(); @@ -735,12 +998,37 @@ struct DedxAnalysis { continue; if (!negTrack.passedTPCRefit()) continue; + + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::TPCRefit); // phi and Ncl cut - if (!passedPhiCutSecondaries(posTrack, magField, *fphiCutLow, *fphiCutHigh)) - continue; + if (phiVarCut) { + if (!passedPhiCutSecondaries(posTrack, magField, *fphiCutLow, *fphiCutHigh)) + continue; - if (!passedPhiCutSecondaries(negTrack, magField, *fphiCutLow, *fphiCutHigh)) - continue; + if (!passedPhiCutSecondaries(negTrack, magField, *fphiCutLow, *fphiCutHigh)) + continue; + } + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel ::PhiVarCutSec); + + if (nTPCClCut) { + if (!passedNTPCClCutSecondaries(posTrack)) + continue; + + if (!passedNTPCClCutSecondaries(negTrack)) + continue; + } + + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel ::NTPCClCutSec); + + if (nITSClCut) { + if (!passedNITSClCutSecondaries(posTrack)) + continue; + + if (!passedNITSClCutSecondaries(negTrack)) + continue; + } + + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel ::NITSClCutSec); float signedPpos = posTrack.sign() * posTrack.tpcInnerParam(); float signedPneg = negTrack.sign() * negTrack.tpcInnerParam(); @@ -757,6 +1045,18 @@ struct DedxAnalysis { // K0s Selection if (passedK0Selection(v0, negTrack, posTrack, collision)) { + + if (std::abs(v0.rapidity(MassK0Short)) > v0rapidityCut) + continue; + + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0RapidityK0s); + float properLifetime = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * MassK0Short; + + if (properLifetime > v0ProperLifetimeCutK0s) + continue; + + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0ProperLifetimeK0s); + float ePosPi = posTrack.energy(MassPionCharged); float eNegPi = negTrack.energy(MassPionCharged); @@ -779,6 +1079,17 @@ struct DedxAnalysis { // Lambda Selection if (passedLambdaSelection(v0, negTrack, posTrack, collision)) { + if (std::abs(v0.rapidity(MassLambda)) > v0rapidityCut) + continue; + + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0RapidityLambda); + float properLifetime = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * MassLambda; + + if (properLifetime > v0ProperLifetimeCutLambda) + continue; + + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0ProperLifetimeLambda); + float ePosPr = posTrack.energy(MassProton); float eNegPi = negTrack.energy(MassPionCharged); @@ -801,6 +1112,17 @@ struct DedxAnalysis { // AntiLambda Selection if (passedAntiLambdaSelection(v0, negTrack, posTrack, collision)) { + if (std::abs(v0.rapidity(MassLambda)) > v0rapidityCut) + continue; + + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0RapidityAntiLambda); + float properLifetime = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * MassLambda; + + if (properLifetime > v0ProperLifetimeCutLambda) + continue; + + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0ProperLifetimeAntiLambda); + float ePosPi = posTrack.energy(MassPionCharged); float eNegPr = negTrack.energy(MassProton); From 6aa00f160b338dc36c4176e1cedfd96d4924ccf4 Mon Sep 17 00:00:00 2001 From: dajones2 <140733426+dajones2@users.noreply.github.com> Date: Tue, 16 Sep 2025 09:06:26 +0100 Subject: [PATCH 413/986] [PWGJE] Adding process for running recoil jets with rho subtraction (#12987) --- PWGJE/Tasks/jetHadronRecoil.cxx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/PWGJE/Tasks/jetHadronRecoil.cxx b/PWGJE/Tasks/jetHadronRecoil.cxx index 7850288059d..7090b4418a1 100644 --- a/PWGJE/Tasks/jetHadronRecoil.cxx +++ b/PWGJE/Tasks/jetHadronRecoil.cxx @@ -902,6 +902,30 @@ struct JetHadronRecoil { } PROCESS_SWITCH(JetHadronRecoil, processRecoilJetsMCPMCDMatchedWeighted, "process MC matched with event weights (recoil jets)", false); + void processRecoilJetsMCPMCDMatchedWeightedWithRhoSubtraction(soa::Filtered>::iterator const& collision, + soa::Filtered> const& mcdjets, + soa::Filtered const& tracks, + soa::Filtered const& particles, + aod::JetMcCollisions const&, + soa::Filtered> const& mcpjets) + { + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { + return; + } + if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { + return; + } + if (collision.has_mcCollision()) { + return; + } + if (collision.mcCollision().ptHard() < pTHatMinEvent) { + return; + } + registry.fill(HIST("hZvtxSelected"), collision.posZ()); + fillRecoilJetMatchedHistograms(mcdjets, mcpjets, tracks, particles, collision.mcCollision().weight(), collision.rho(), collision.mcCollision().ptHard()); + } + PROCESS_SWITCH(JetHadronRecoil, processRecoilJetsMCPMCDMatchedWeightedWithRhoSubtraction, "process MC matched with event weights (recoil jets) and rho subtraction", false); + template double getWTAaxisDifference(T const& jet, X const& /*tracks or particles*/) { From 53892f7977a639f634f53894e890112fc45bd52a Mon Sep 17 00:00:00 2001 From: spucillo <93769017+spucillo@users.noreply.github.com> Date: Tue, 16 Sep 2025 15:17:00 +0200 Subject: [PATCH 414/986] [PWGLF] Add 2D histogram for event selections vs centrality + improve binning (#12994) Co-authored-by: ALICE Action Bot --- .../cascadeAnalysisLightIonsDerivedData.cxx | 241 +++++++++++------- 1 file changed, 144 insertions(+), 97 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx b/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx index 08474177861..d6486d8c8ac 100644 --- a/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx +++ b/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx @@ -131,10 +131,10 @@ struct CascadeAnalysisLightIonsDerivedData { Configurable v0masswindow{"v0masswindow", 0.005, "v0 mass window"}; Configurable competingmassrej{"competingmassrej", 0.008, "Competing mass rejection"}; // Axes parameters - ConfigurableAxis centEstimatorHistBin{"centEstimatorHistBin", {501, -0.5, 500.5}, ""}; + ConfigurableAxis centEstimatorHistBin{"centEstimatorHistBin", {101, 0.0f, 101.0f}, ""}; ConfigurableAxis centralityBinning{"centralityBinning", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, ""}; - ConfigurableAxis axisNch{"axisNch", {500, 0.0f, +1000.0f}, "Number of charged particles"}; - ConfigurableAxis axisMult{"axisMult", {500, 0.0f, +1000.0f}, "Multiplicity"}; + ConfigurableAxis axisNch{"axisNch", {500, 0.0f, +5000.0f}, "Number of charged particles"}; + ConfigurableAxis axisMult{"axisMult", {500, 0.0f, +100000.0f}, "Multiplicity"}; // Centrality estimator Configurable centralityEstimator{"centralityEstimator", 0, "0 = FT0C, 1 = FTOM, 2 = FV0A, 3 = NGlobal"}; @@ -185,18 +185,31 @@ struct CascadeAnalysisLightIonsDerivedData { registryData.get(HIST("number_of_events_data"))->GetXaxis()->SetBinLabel(9, "kIsVertexTRDmatched"); registryData.get(HIST("number_of_events_data"))->GetXaxis()->SetBinLabel(10, "kNoSameBunchPileup"); + registryData.add("number_of_events_data_vs_centrality", "number of events in data vs centrality", HistType::kTH2D, {{20, -0.5f, +19.5f}, axisCentEstimator}); + registryData.get(HIST("number_of_events_data_vs_centrality"))->GetXaxis()->SetBinLabel(1, "All collisions"); + registryData.get(HIST("number_of_events_data_vs_centrality"))->GetXaxis()->SetBinLabel(2, "sel8 cut"); + registryData.get(HIST("number_of_events_data_vs_centrality"))->GetXaxis()->SetBinLabel(3, "posZ cut"); + registryData.get(HIST("number_of_events_data_vs_centrality"))->GetXaxis()->SetBinLabel(4, "kNoITSROFrameBorder"); + registryData.get(HIST("number_of_events_data_vs_centrality"))->GetXaxis()->SetBinLabel(5, "kNoTimeFrameBorder"); + registryData.get(HIST("number_of_events_data_vs_centrality"))->GetXaxis()->SetBinLabel(6, "kIsVertexITSTPC"); + registryData.get(HIST("number_of_events_data_vs_centrality"))->GetXaxis()->SetBinLabel(7, "kIsGoodZvtxFT0vsPV"); + registryData.get(HIST("number_of_events_data_vs_centrality"))->GetXaxis()->SetBinLabel(8, "kIsVertexTOFmatched"); + registryData.get(HIST("number_of_events_data_vs_centrality"))->GetXaxis()->SetBinLabel(9, "kIsVertexTRDmatched"); + registryData.get(HIST("number_of_events_data_vs_centrality"))->GetXaxis()->SetBinLabel(10, "kNoSameBunchPileup"); + registryData.get(HIST("number_of_events_data_vs_centrality"))->GetYaxis()->SetTitle("Centrality (%)"); + // QC Histograms - registryQC.add("hVertexZdata", "hVertexZdata", HistType::kTH1F, {vertexZAxis}); - registryQC.add("hv0cosPAdata", "hv0cosPAdata", HistType::kTH1F, {{nBins, 0.95f, 1.f}}); - registryQC.add("hcasccosPAdata", "hcasccosPAdata", HistType::kTH1F, {{nBins, 0.95f, 1.f}}); - registryQC.add("hv0radiusdata", "hv0radiusdata", HistType::kTH1F, {{nBins, 0.0f, 5.0f}}); - registryQC.add("hcascradiusdata", "hcascradiusdata", HistType::kTH1F, {{nBins, 0.0f, 5.0f}}); - registryQC.add("hdcaV0daughtersdata", "hdcaV0daughtersdata", HistType::kTH1F, {{nBins, 0.0f, 1.5f}}); - registryQC.add("hdcacascdaughtersdata", "hdcacascdaughtersdata", HistType::kTH1F, {{nBins, 0.0f, 1.5f}}); - registryQC.add("hdcapostopvdata", "hdcapostopvdata", HistType::kTH1F, {{nBins, 0.0f, 2.0f}}); - registryQC.add("hdcanegtopvdata", "hdcanegtopvdata", HistType::kTH1F, {{nBins, 0.0f, 2.0f}}); - registryQC.add("hdcabachtopvdata", "hdcabachtopvdata", HistType::kTH1F, {{nBins, 0.0f, 2.0f}}); - registryQC.add("hdcav0topvdata", "hdcav0topvdata", HistType::kTH1F, {{nBins, 0.0f, 2.0f}}); + registryQC.add("hVertexZdata", "hVertexZdata", HistType::kTH1D, {vertexZAxis}); + registryQC.add("hv0cosPAdata", "hv0cosPAdata", HistType::kTH1D, {{nBins, 0.95f, 1.f}}); + registryQC.add("hcasccosPAdata", "hcasccosPAdata", HistType::kTH1D, {{nBins, 0.95f, 1.f}}); + registryQC.add("hv0radiusdata", "hv0radiusdata", HistType::kTH1D, {{nBins, 0.0f, 5.0f}}); + registryQC.add("hcascradiusdata", "hcascradiusdata", HistType::kTH1D, {{nBins, 0.0f, 5.0f}}); + registryQC.add("hdcaV0daughtersdata", "hdcaV0daughtersdata", HistType::kTH1D, {{nBins, 0.0f, 1.5f}}); + registryQC.add("hdcacascdaughtersdata", "hdcacascdaughtersdata", HistType::kTH1D, {{nBins, 0.0f, 1.5f}}); + registryQC.add("hdcapostopvdata", "hdcapostopvdata", HistType::kTH1D, {{nBins, 0.0f, 2.0f}}); + registryQC.add("hdcanegtopvdata", "hdcanegtopvdata", HistType::kTH1D, {{nBins, 0.0f, 2.0f}}); + registryQC.add("hdcabachtopvdata", "hdcabachtopvdata", HistType::kTH1D, {{nBins, 0.0f, 2.0f}}); + registryQC.add("hdcav0topvdata", "hdcav0topvdata", HistType::kTH1D, {{nBins, 0.0f, 2.0f}}); // Multiplicity Histograms registryData.add("hCentEstimator", "hCentEstimator", HistType::kTH1D, {axisCentEstimator}); @@ -204,16 +217,16 @@ struct CascadeAnalysisLightIonsDerivedData { registryData.add("hCentralityVsMultiplicity", "hCentralityVsMultiplicity", HistType::kTH2D, {axisCentEstimator, axisMult}); // Histograms for xi (data) - registryData.add("hMassXipos", "hMassXipos", HistType::kTH3F, {centAxis, ptAxis, invMassXiAxis}); - registryData.add("hMassXineg", "hMassXineg", HistType::kTH3F, {centAxis, ptAxis, invMassXiAxis}); - registryData.add("hMassXiposSelected", "hMassXiposSelected", HistType::kTH3F, {centAxis, ptAxis, invMassXiAxis}); - registryData.add("hMassXinegSelected", "hMassXinegSelected", HistType::kTH3F, {centAxis, ptAxis, invMassXiAxis}); + registryData.add("hMassXipos", "hMassXipos", HistType::kTH3D, {centAxis, ptAxis, invMassXiAxis}); + registryData.add("hMassXineg", "hMassXineg", HistType::kTH3D, {centAxis, ptAxis, invMassXiAxis}); + registryData.add("hMassXiposSelected", "hMassXiposSelected", HistType::kTH3D, {centAxis, ptAxis, invMassXiAxis}); + registryData.add("hMassXinegSelected", "hMassXinegSelected", HistType::kTH3D, {centAxis, ptAxis, invMassXiAxis}); // Histograms for omega (data) - registryData.add("hMassOmegapos", "hMassOmegapos", HistType::kTH3F, {centAxis, ptAxis, invMassOmegaAxis}); - registryData.add("hMassOmeganeg", "hMassOmeganeg", HistType::kTH3F, {centAxis, ptAxis, invMassOmegaAxis}); - registryData.add("hMassOmegaposSelected", "hMassOmegaposSelected", HistType::kTH3F, {centAxis, ptAxis, invMassOmegaAxis}); - registryData.add("hMassOmeganegSelected", "hMassOmeganegSelected", HistType::kTH3F, {centAxis, ptAxis, invMassOmegaAxis}); + registryData.add("hMassOmegapos", "hMassOmegapos", HistType::kTH3D, {centAxis, ptAxis, invMassOmegaAxis}); + registryData.add("hMassOmeganeg", "hMassOmeganeg", HistType::kTH3D, {centAxis, ptAxis, invMassOmegaAxis}); + registryData.add("hMassOmegaposSelected", "hMassOmegaposSelected", HistType::kTH3D, {centAxis, ptAxis, invMassOmegaAxis}); + registryData.add("hMassOmeganegSelected", "hMassOmeganegSelected", HistType::kTH3D, {centAxis, ptAxis, invMassOmegaAxis}); } if (doprocessMonteCarloRec) { @@ -230,18 +243,31 @@ struct CascadeAnalysisLightIonsDerivedData { registryMC.get(HIST("number_of_events_mc_rec"))->GetXaxis()->SetBinLabel(9, "kIsVertexTRDmatched"); registryMC.get(HIST("number_of_events_mc_rec"))->GetXaxis()->SetBinLabel(10, "kNoSameBunchPileup"); + registryMC.add("number_of_events_mc_rec_vs_centrality", "number of events in mc_rec vs centrality", HistType::kTH2D, {{20, -0.5f, +19.5f}, axisCentEstimator}); + registryMC.get(HIST("number_of_events_mc_rec_vs_centrality"))->GetXaxis()->SetBinLabel(1, "All collisions"); + registryMC.get(HIST("number_of_events_mc_rec_vs_centrality"))->GetXaxis()->SetBinLabel(2, "sel8 cut"); + registryMC.get(HIST("number_of_events_mc_rec_vs_centrality"))->GetXaxis()->SetBinLabel(3, "posZ cut"); + registryMC.get(HIST("number_of_events_mc_rec_vs_centrality"))->GetXaxis()->SetBinLabel(4, "kNoITSROFrameBorder"); + registryMC.get(HIST("number_of_events_mc_rec_vs_centrality"))->GetXaxis()->SetBinLabel(5, "kNoTimeFrameBorder"); + registryMC.get(HIST("number_of_events_mc_rec_vs_centrality"))->GetXaxis()->SetBinLabel(6, "kIsVertexITSTPC"); + registryMC.get(HIST("number_of_events_mc_rec_vs_centrality"))->GetXaxis()->SetBinLabel(7, "kIsGoodZvtxFT0vsPV"); + registryMC.get(HIST("number_of_events_mc_rec_vs_centrality"))->GetXaxis()->SetBinLabel(8, "kIsVertexTOFmatched"); + registryMC.get(HIST("number_of_events_mc_rec_vs_centrality"))->GetXaxis()->SetBinLabel(9, "kIsVertexTRDmatched"); + registryMC.get(HIST("number_of_events_mc_rec_vs_centrality"))->GetXaxis()->SetBinLabel(10, "kNoSameBunchPileup"); + registryMC.get(HIST("number_of_events_mc_rec_vs_centrality"))->GetYaxis()->SetTitle("Centrality (%)"); + // QC Histograms - registryQC.add("hVertexZRec", "hVertexZRec", HistType::kTH1F, {{vertexZAxis}}); - registryQC.add("hv0cosPARec", "hv0cosPARec", HistType::kTH1F, {{nBins, 0.95f, 1.f}}); - registryQC.add("hcasccosPARec", "hcasccosPARec", HistType::kTH1F, {{nBins, 0.95f, 1.f}}); - registryQC.add("hv0radiusRec", "hv0radiusRec", HistType::kTH1F, {{nBins, 0.0f, 5.0f}}); - registryQC.add("hcascradiusRec", "hcascradiusRec", HistType::kTH1F, {{nBins, 0.0f, 5.0f}}); - registryQC.add("hdcaV0daughtersRec", "hdcaV0daughtersRec", HistType::kTH1F, {{nBins, 0.0f, 1.5f}}); - registryQC.add("hdcacascdaughtersRec", "hdcacascdaughtersRec", HistType::kTH1F, {{nBins, 0.0f, 1.5f}}); - registryQC.add("hdcapostopvRec", "hdcapostopvRec", HistType::kTH1F, {{nBins, 0.0f, 2.0f}}); - registryQC.add("hdcanegtopvRec", "hdcanegtopvRec", HistType::kTH1F, {{nBins, 0.0f, 2.0f}}); - registryQC.add("hdcabachtopvRec", "hdcabachtopvRec", HistType::kTH1F, {{nBins, 0.0f, 2.0f}}); - registryQC.add("hdcav0topvRec", "hdcav0topvRec", HistType::kTH1F, {{nBins, 0.0f, 2.0f}}); + registryQC.add("hVertexZRec", "hVertexZRec", HistType::kTH1D, {{vertexZAxis}}); + registryQC.add("hv0cosPARec", "hv0cosPARec", HistType::kTH1D, {{nBins, 0.95f, 1.f}}); + registryQC.add("hcasccosPARec", "hcasccosPARec", HistType::kTH1D, {{nBins, 0.95f, 1.f}}); + registryQC.add("hv0radiusRec", "hv0radiusRec", HistType::kTH1D, {{nBins, 0.0f, 5.0f}}); + registryQC.add("hcascradiusRec", "hcascradiusRec", HistType::kTH1D, {{nBins, 0.0f, 5.0f}}); + registryQC.add("hdcaV0daughtersRec", "hdcaV0daughtersRec", HistType::kTH1D, {{nBins, 0.0f, 1.5f}}); + registryQC.add("hdcacascdaughtersRec", "hdcacascdaughtersRec", HistType::kTH1D, {{nBins, 0.0f, 1.5f}}); + registryQC.add("hdcapostopvRec", "hdcapostopvRec", HistType::kTH1D, {{nBins, 0.0f, 2.0f}}); + registryQC.add("hdcanegtopvRec", "hdcanegtopvRec", HistType::kTH1D, {{nBins, 0.0f, 2.0f}}); + registryQC.add("hdcabachtopvRec", "hdcabachtopvRec", HistType::kTH1D, {{nBins, 0.0f, 2.0f}}); + registryQC.add("hdcav0topvRec", "hdcav0topvRec", HistType::kTH1D, {{nBins, 0.0f, 2.0f}}); // Multiplicity Histograms registryMC.add("hCentEstimator_truerec", "hCentEstimator_truerec", HistType::kTH1D, {axisCentEstimator}); @@ -249,44 +275,44 @@ struct CascadeAnalysisLightIonsDerivedData { registryMC.add("hCentralityVsMultiplicity_truerec", "hCentralityVsMultiplicity_truerec", HistType::kTH2D, {axisCentEstimator, axisMult}); // Histograms for xi (mc) - registryMC.add("hMassXipos_truerec", "hMassXipos_truerec", HistType::kTH3F, {centAxis, ptAxis, invMassXiAxis}); - registryMC.add("hMassXineg_truerec", "hMassXineg_truerec", HistType::kTH3F, {centAxis, ptAxis, invMassXiAxis}); - registryMC.add("hMassXiposSelected_truerec", "hMassXiposSelected_truerec", HistType::kTH3F, {centAxis, ptAxis, invMassXiAxis}); - registryMC.add("hMassXinegSelected_truerec", "hMassXinegSelected_truerec", HistType::kTH3F, {centAxis, ptAxis, invMassXiAxis}); + registryMC.add("hMassXipos_truerec", "hMassXipos_truerec", HistType::kTH3D, {centAxis, ptAxis, invMassXiAxis}); + registryMC.add("hMassXineg_truerec", "hMassXineg_truerec", HistType::kTH3D, {centAxis, ptAxis, invMassXiAxis}); + registryMC.add("hMassXiposSelected_truerec", "hMassXiposSelected_truerec", HistType::kTH3D, {centAxis, ptAxis, invMassXiAxis}); + registryMC.add("hMassXinegSelected_truerec", "hMassXinegSelected_truerec", HistType::kTH3D, {centAxis, ptAxis, invMassXiAxis}); // Histograms for omega (mc) - registryMC.add("hMassOmegapos_truerec", "hMassOmegapos_truerec", HistType::kTH3F, {centAxis, ptAxis, invMassOmegaAxis}); - registryMC.add("hMassOmeganeg_truerec", "hMassOmeganeg_truerec", HistType::kTH3F, {centAxis, ptAxis, invMassOmegaAxis}); - registryMC.add("hMassOmegaposSelected_truerec", "hMassOmegaposSelected_truerec", HistType::kTH3F, {centAxis, ptAxis, invMassOmegaAxis}); - registryMC.add("hMassOmeganegSelected_truerec", "hMassOmeganegSelected_truerec", HistType::kTH3F, {centAxis, ptAxis, invMassOmegaAxis}); + registryMC.add("hMassOmegapos_truerec", "hMassOmegapos_truerec", HistType::kTH3D, {centAxis, ptAxis, invMassOmegaAxis}); + registryMC.add("hMassOmeganeg_truerec", "hMassOmeganeg_truerec", HistType::kTH3D, {centAxis, ptAxis, invMassOmegaAxis}); + registryMC.add("hMassOmegaposSelected_truerec", "hMassOmegaposSelected_truerec", HistType::kTH3D, {centAxis, ptAxis, invMassOmegaAxis}); + registryMC.add("hMassOmeganegSelected_truerec", "hMassOmeganegSelected_truerec", HistType::kTH3D, {centAxis, ptAxis, invMassOmegaAxis}); } if (doprocessMonteCarloGen) { // Histograms for mc generated // QC Histograms - registryQC.add("hVertexZGen", "hVertexZGen", HistType::kTH1F, {{vertexZAxis}}); + registryQC.add("hVertexZGen", "hVertexZGen", HistType::kTH1D, {{vertexZAxis}}); // Histograms for xi (mc) - registryMC.add("h2dGenXiMinusVsMultMC_RecoedEvt", "h2dGenXiMinusVsMultMC_RecoedEvt", HistType::kTH2F, {axisNch, ptAxis}); - registryMC.add("h2dGenXiPlusVsMultMC_RecoedEvt", "h2dGenXiPlusVsMultMC_RecoedEvt", HistType::kTH2F, {axisNch, ptAxis}); - registryMC.add("h2dGenXiMinusVsMultMC", "h2dGenXiMinusVsMultMC", HistType::kTH2F, {axisNch, ptAxis}); - registryMC.add("h2dGenXiPlusVsMultMC", "h2dGenXiPlusVsMultMC", HistType::kTH2F, {axisNch, ptAxis}); + registryMC.add("h2dGenXiMinusVsMultMC_RecoedEvt", "h2dGenXiMinusVsMultMC_RecoedEvt", HistType::kTH2D, {axisNch, ptAxis}); + registryMC.add("h2dGenXiPlusVsMultMC_RecoedEvt", "h2dGenXiPlusVsMultMC_RecoedEvt", HistType::kTH2D, {axisNch, ptAxis}); + registryMC.add("h2dGenXiMinusVsMultMC", "h2dGenXiMinusVsMultMC", HistType::kTH2D, {axisNch, ptAxis}); + registryMC.add("h2dGenXiPlusVsMultMC", "h2dGenXiPlusVsMultMC", HistType::kTH2D, {axisNch, ptAxis}); // Histograms for omega (mc) - registryMC.add("h2dGenOmegaMinusVsMultMC_RecoedEvt", "h2dGenOmegaMinusVsMultMC_RecoedEvt", HistType::kTH2F, {axisNch, ptAxis}); - registryMC.add("h2dGenOmegaPlusVsMultMC_RecoedEvt", "h2dGenOmegaPlusVsMultMC_RecoedEvt", HistType::kTH2F, {axisNch, ptAxis}); - registryMC.add("h2dGenOmegaMinusVsMultMC", "h2dGenOmegaMinusVsMultMC", HistType::kTH2F, {axisNch, ptAxis}); - registryMC.add("h2dGenOmegaPlusVsMultMC", "h2dGenOmegaPlusVsMultMC", HistType::kTH2F, {axisNch, ptAxis}); + registryMC.add("h2dGenOmegaMinusVsMultMC_RecoedEvt", "h2dGenOmegaMinusVsMultMC_RecoedEvt", HistType::kTH2D, {axisNch, ptAxis}); + registryMC.add("h2dGenOmegaPlusVsMultMC_RecoedEvt", "h2dGenOmegaPlusVsMultMC_RecoedEvt", HistType::kTH2D, {axisNch, ptAxis}); + registryMC.add("h2dGenOmegaMinusVsMultMC", "h2dGenOmegaMinusVsMultMC", HistType::kTH2D, {axisNch, ptAxis}); + registryMC.add("h2dGenOmegaPlusVsMultMC", "h2dGenOmegaPlusVsMultMC", HistType::kTH2D, {axisNch, ptAxis}); // Histograms for event loss/splitting - registryMC.add("hGenEvents", "hGenEvents", HistType::kTH2F, {{axisNch}, {2, -0.5f, +1.5f}}); + registryMC.add("hGenEvents", "hGenEvents", HistType::kTH2D, {{axisNch}, {2, -0.5f, +1.5f}}); registryMC.get(HIST("hGenEvents"))->GetYaxis()->SetBinLabel(1, "All gen. events"); registryMC.get(HIST("hGenEvents"))->GetYaxis()->SetBinLabel(2, "Gen. with at least 1 rec. events"); registryMC.add("hGenEventCentrality", "hGenEventCentrality", kTH1D, {{101, 0.0f, 101.0f}}); - registryMC.add("hCentralityVsNcoll_beforeEvSel", "hCentralityVsNcoll_beforeEvSel", HistType::kTH2F, {centAxis, {50, -0.5f, 49.5f}}); - registryMC.add("hCentralityVsNcoll_afterEvSel", "hCentralityVsNcoll_afterEvSel", HistType::kTH2F, {centAxis, {50, -0.5f, 49.5f}}); + registryMC.add("hCentralityVsNcoll_beforeEvSel", "hCentralityVsNcoll_beforeEvSel", HistType::kTH2D, {centAxis, {50, -0.5f, 49.5f}}); + registryMC.add("hCentralityVsNcoll_afterEvSel", "hCentralityVsNcoll_afterEvSel", HistType::kTH2D, {centAxis, {50, -0.5f, 49.5f}}); - registryMC.add("hCentralityVsMultMC", "hCentralityVsMultMC", HistType::kTH2F, {{101, 0.0f, 101.0f}, axisNch}); + registryMC.add("hCentralityVsMultMC", "hCentralityVsMultMC", HistType::kTH2D, {{101, 0.0f, 101.0f}, axisNch}); } } @@ -704,73 +730,84 @@ struct CascadeAnalysisLightIonsDerivedData { // Initialize CCDB objects using the BC info initCCDB(collision); + // Define the event centrality using different estimators + float centrality = -1.0f; + float multiplicity = -1.0f; + + if (centralityEstimator == Option::kFT0C) { + centrality = collision.centFT0C(); + multiplicity = collision.multFT0C(); + } + if (centralityEstimator == Option::kFT0M) { + centrality = collision.centFT0M(); + multiplicity = collision.multFT0C() + collision.multFT0A(); + } + if (centralityEstimator == Option::kFV0A) { + centrality = collision.centFV0A(); + multiplicity = collision.multFV0A(); + } + if (centralityEstimator == Option::kNGlobal) { + centrality = collision.centNGlobal(); + multiplicity = collision.multNTracksGlobal(); + } + // event selections if (applySel8 && !collision.sel8()) return; registryData.fill(HIST("number_of_events_data"), 1); + registryData.fill(HIST("number_of_events_data_vs_centrality"), 1, centrality); + if (applyVtxZ && std::fabs(collision.posZ()) > zVtx) return; registryData.fill(HIST("number_of_events_data"), 2); + registryData.fill(HIST("number_of_events_data_vs_centrality"), 2, centrality); if (rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { return; } registryData.fill(HIST("number_of_events_data"), 3 /* Not at ITS ROF border */); + registryData.fill(HIST("number_of_events_data_vs_centrality"), 3, centrality); if (rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { return; } registryData.fill(HIST("number_of_events_data"), 4 /* Not at TF border */); + registryData.fill(HIST("number_of_events_data_vs_centrality"), 4, centrality); if (requireVertexITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { return; } registryData.fill(HIST("number_of_events_data"), 5 /* Contains at least one ITS-TPC track */); + registryData.fill(HIST("number_of_events_data_vs_centrality"), 5, centrality); if (requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { return; } registryData.fill(HIST("number_of_events_data"), 6 /* PV position consistency check */); + registryData.fill(HIST("number_of_events_data_vs_centrality"), 6, centrality); if (requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { return; } registryData.fill(HIST("number_of_events_data"), 7 /* PV with at least one contributor matched with TOF */); + registryData.fill(HIST("number_of_events_data_vs_centrality"), 7, centrality); if (requireIsVertexTRDmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { return; } registryData.fill(HIST("number_of_events_data"), 8 /* PV with at least one contributor matched with TRD */); + registryData.fill(HIST("number_of_events_data_vs_centrality"), 8, centrality); if (rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { return; } registryData.fill(HIST("number_of_events_data"), 9 /* Not at same bunch pile-up */); + registryData.fill(HIST("number_of_events_data_vs_centrality"), 9, centrality); // Store the Zvtx - registryQC.fill(HIST("hVertexZdata"), std::fabs(collision.posZ())); - - // Store the event centrality using different estimators - float centrality = -1.0f; - float multiplicity = -1.0f; - - if (centralityEstimator == Option::kFT0C) { - centrality = collision.centFT0C(); - multiplicity = collision.multFT0C(); - } - if (centralityEstimator == Option::kFT0M) { - centrality = collision.centFT0M(); - multiplicity = collision.multFT0C() + collision.multFT0A(); - } - if (centralityEstimator == Option::kFV0A) { - centrality = collision.centFV0A(); - multiplicity = collision.multFV0A(); - } - if (centralityEstimator == Option::kNGlobal) { - centrality = collision.centNGlobal(); - multiplicity = collision.multNTracksGlobal(); - } + registryQC.fill(HIST("hVertexZdata"), collision.posZ()); + // Store the event centrality registryData.fill(HIST("hCentEstimator"), centrality); registryData.fill(HIST("hCentralityVsNch"), centrality, collision.multNTracksPVeta1()); registryData.fill(HIST("hCentralityVsMultiplicity"), centrality, multiplicity); @@ -835,74 +872,84 @@ struct CascadeAnalysisLightIonsDerivedData { // Initialize CCDB objects using the BC info initCCDB(RecCol); + // Define the event centrality using different estimators + float centralityMcRec = -1.0f; + float multiplicityMcRec = -1.0f; + + if (centralityEstimator == Option::kFT0C) { + centralityMcRec = RecCol.centFT0C(); + multiplicityMcRec = RecCol.multFT0C(); + } + if (centralityEstimator == Option::kFT0M) { + centralityMcRec = RecCol.centFT0M(); + multiplicityMcRec = RecCol.multFT0C() + RecCol.multFT0A(); + } + if (centralityEstimator == Option::kFV0A) { + centralityMcRec = RecCol.centFV0A(); + multiplicityMcRec = RecCol.multFV0A(); + } + if (centralityEstimator == Option::kNGlobal) { + centralityMcRec = RecCol.centNGlobal(); + multiplicityMcRec = RecCol.multNTracksGlobal(); + } + // event selections if (applySel8 && !RecCol.sel8()) continue; registryMC.fill(HIST("number_of_events_mc_rec"), 1); + registryMC.fill(HIST("number_of_events_mc_rec_vs_centrality"), 1, centralityMcRec); if (applyVtxZ && std::fabs(RecCol.posZ()) > zVtx) continue; registryMC.fill(HIST("number_of_events_mc_rec"), 2); + registryMC.fill(HIST("number_of_events_mc_rec_vs_centrality"), 2, centralityMcRec); if (rejectITSROFBorder && !RecCol.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { continue; } registryMC.fill(HIST("number_of_events_mc_rec"), 3 /* Not at ITS ROF border */); + registryMC.fill(HIST("number_of_events_mc_rec_vs_centrality"), 3, centralityMcRec); if (rejectTFBorder && !RecCol.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { continue; } registryMC.fill(HIST("number_of_events_mc_rec"), 4 /* Not at TF border */); + registryMC.fill(HIST("number_of_events_mc_rec_vs_centrality"), 4, centralityMcRec); if (requireVertexITSTPC && !RecCol.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { continue; } registryMC.fill(HIST("number_of_events_mc_rec"), 5 /* Contains at least one ITS-TPC track */); + registryMC.fill(HIST("number_of_events_mc_rec_vs_centrality"), 5, centralityMcRec); if (requireIsGoodZvtxFT0VsPV && !RecCol.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { continue; } registryMC.fill(HIST("number_of_events_mc_rec"), 6 /* PV position consistency check */); + registryMC.fill(HIST("number_of_events_mc_rec_vs_centrality"), 6, centralityMcRec); if (requireIsVertexTOFmatched && !RecCol.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { continue; } registryMC.fill(HIST("number_of_events_mc_rec"), 7 /* PV with at least one contributor matched with TOF */); + registryMC.fill(HIST("number_of_events_mc_rec_vs_centrality"), 7, centralityMcRec); if (requireIsVertexTRDmatched && !RecCol.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { continue; } registryMC.fill(HIST("number_of_events_mc_rec"), 8 /* PV with at least one contributor matched with TRD */); + registryMC.fill(HIST("number_of_events_mc_rec_vs_centrality"), 8, centralityMcRec); if (rejectSameBunchPileup && !RecCol.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { continue; } registryMC.fill(HIST("number_of_events_mc_rec"), 9 /* Not at same bunch pile-up */); + registryMC.fill(HIST("number_of_events_mc_rec_vs_centrality"), 9, centralityMcRec); // Store the Zvtx registryQC.fill(HIST("hVertexZRec"), RecCol.posZ()); - // Store the event centrality using different estimators - float centralityMcRec = -1.0f; - float multiplicityMcRec = -1.0f; - - if (centralityEstimator == Option::kFT0C) { - centralityMcRec = RecCol.centFT0C(); - multiplicityMcRec = RecCol.multFT0C(); - } - if (centralityEstimator == Option::kFT0M) { - centralityMcRec = RecCol.centFT0M(); - multiplicityMcRec = RecCol.multFT0C() + RecCol.multFT0A(); - } - if (centralityEstimator == Option::kFV0A) { - centralityMcRec = RecCol.centFV0A(); - multiplicityMcRec = RecCol.multFV0A(); - } - if (centralityEstimator == Option::kNGlobal) { - centralityMcRec = RecCol.centNGlobal(); - multiplicityMcRec = RecCol.multNTracksGlobal(); - } - + // Store the event centrality registryMC.fill(HIST("hCentEstimator_truerec"), centralityMcRec); registryMC.fill(HIST("hCentralityVsNch_truerec"), centralityMcRec, RecCol.multNTracksPVeta1()); registryMC.fill(HIST("hCentralityVsMultiplicity_truerec"), centralityMcRec, multiplicityMcRec); From 66543c61ebc1c3bd8d7c056c224d94be12225d80 Mon Sep 17 00:00:00 2001 From: Jaideep Tanwar <141036812+jtanwar2212@users.noreply.github.com> Date: Tue, 16 Sep 2025 19:39:30 +0530 Subject: [PATCH 415/986] [PWGLF] added event loss information. (#12992) --- PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx | 97 +++++++++++++++++++++------- 1 file changed, 75 insertions(+), 22 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx b/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx index 1eff338cec8..06bfc07ec27 100644 --- a/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx +++ b/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx @@ -124,7 +124,7 @@ struct NucleitpcPbPb { Configurable cfgCutEta{"cfgCutEta", 0.9f, "Eta range for tracks"}; Configurable cfgetaRequire{"cfgetaRequire", true, "eta cut require"}; Configurable cfgetaRequireMC{"cfgetaRequireMC", true, "eta cut require for generated particles"}; - Configurable cfgrapidityRequireMC{"cfgrapidityRequireMC", true, "rapidity cut require for generated particles"}; + Configurable cfgRapidityRequireMC{"cfgRapidityRequireMC", true, "rapidity cut require for generated particles"}; Configurable cfgUsePVcontributors{"cfgUsePVcontributors", true, "use tracks that are PV contibutors"}; Configurable cfgITSrequire{"cfgITSrequire", true, "Additional cut on ITS require"}; Configurable cfgTPCrequire{"cfgTPCrequire", true, "Additional cut on TPC require"}; @@ -146,6 +146,7 @@ struct NucleitpcPbPb { Configurable cfgDCAwithptRequire{"cfgDCAwithptRequire", true, "Require DCA cuts with pt dependance"}; Configurable cfgRequirebetaplot{"cfgRequirebetaplot", true, "Require beta plot"}; Configurable cfgIncludeMaterialInEfficiency{"cfgIncludeMaterialInEfficiency", true, "Require from material in efficiency"}; + Configurable cfgMasscut{"cfgMasscut", true, "Require mass cut on He4 particles"}; Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {kBetheBlochDefault[0], nParticles, nBetheParams, particleNames, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for light nuclei"}; Configurable> cfgTrackPIDsettings{"cfgTrackPIDsettings", {kTrackPIDSettings[0], nParticles, nTrkSettings, particleNames, trackPIDsettingsNames}, "track selection and PID criteria"}; @@ -155,7 +156,7 @@ struct NucleitpcPbPb { Configurable cfgFillmassnsigma{"cfgFillmassnsigma", true, "Fill mass vs nsigma histograms"}; Configurable centcut{"centcut", 80.0f, "centrality cut"}; Configurable cfgCutRapidity{"cfgCutRapidity", 0.5f, "Rapidity range"}; - Configurable cfgtpcNClsFindable{"cfgtpcNClsFindable", 0.8f, "tpcNClsFindable over crossedRows"}; ///////////// + Configurable cfgtpcNClsFindable{"cfgtpcNClsFindable", 0.8f, "tpcNClsFindable over crossedRows"}; Configurable cfgZvertex{"cfgZvertex", 10, "Min Z Vertex"}; Configurable cfgZvertexRequire{"cfgZvertexRequire", true, "Pos Z cut require"}; Configurable cfgZvertexRequireMC{"cfgZvertexRequireMC", true, "Pos Z cut require for generated particles"}; @@ -179,7 +180,7 @@ struct NucleitpcPbPb { ConfigurableAxis speciesTrackingAxis{"speciesTrackingAxis", {11, -0.5, 10.5}, "particle type 0: pion, 1: proton, 2: deuteron, 3: triton, 4:He3, 5:He4"}; ConfigurableAxis axisDCA{"axisDCA", {400, -10., 10.}, "DCA axis"}; ConfigurableAxis particleAntiAxis{"particleAntiAxis", {2, 0, 2}, "Particle/Anti-particle"}; // 0 = particle, 1 = anti-particle - ConfigurableAxis decayTypeAxis{"decayTypeAxis", {3, 0, 3}, "Decay type"}; // 0 = primary, 1 = from decay + ConfigurableAxis decayTypeAxis{"decayTypeAxis", {3, -0.5, 2.5}, "Decay type"}; // 0 = primary, 1 = from decay, 2 = material // CCDB Service ccdb; @@ -281,6 +282,8 @@ struct NucleitpcPbPb { histomc.add("histPIDtrackanti", " delta pt vs pt rec", HistType::kTH2F, {{1000, 0, 10, "p_{T}(reco)"}, {9, -0.5, 8.5, "p_{T}(reco) - p_{T}(gen)"}}); histomc.add("histPIDtrackhe4", " delta pt vs pt rec", HistType::kTH2F, {{1000, 0, 10, "p_{T}(reco)"}, {9, -0.5, 8.5, "p_{T}(reco) - p_{T}(gen)"}}); histomc.add("histPIDtrackantihe4", " delta pt vs pt rec", HistType::kTH2F, {{1000, 0, 10, "p_{T}(reco)"}, {9, -0.5, 8.5, "p_{T}(reco) - p_{T}(gen)"}}); + histomc.add("hEventLossDenom", "Event loss denominator", kTH1F, {axisCent}); + histomc.add("hEventLossNumer", "Event loss numerator", kTH1F, {axisCent}); histomc.add("histWeakDecayPtHe3", "Pt distribution of He3 from weak decays", kTH2F, {ptAxis, axisCent}); histomc.add("histWeakDecayPtAntiHe3", "Pt distribution of Anti-He3 from weak decays", kTH2F, {ptAxis, axisCent}); @@ -296,8 +299,6 @@ struct NucleitpcPbPb { histomc.add("histProcess23Details", "Process 23 details", kTH2F, {{4, 0.5, 4.5, "particle type"}, {100, 0, 10, "p_{T}"}}); histomc.add("histAllMaterialSecondariesGen", "All material secondaries (gen)", kTH3F, {{100, 0, 10, "p_{T}"}, {20, -1, 1, "y"}, {5, -0.5, 4.5, "type"}}); histomc.add("histAllMaterialSecondariesReco", "All material secondaries (reco)", kTH3F, {{100, 0, 10, "p_{T}"}, {20, -1, 1, "y"}, {5, -0.5, 4.5, "type"}}); - - // Add axis labels for type: 0=unknown, 1=He3, 2=anti-He3, 3=He4, 4=anti-He4 } } //---------------------------------------------------------------------------------------------------------------- @@ -435,20 +436,50 @@ struct NucleitpcPbPb { mcCollInfos.clear(); mcCollInfos.resize(mcCollisions.size()); + + // Store centrality regardless of cuts FIRST for (auto const& collision : collisions) { int mcCollIdx = collision.mcCollisionId(); if (mcCollIdx < 0 || mcCollIdx >= static_cast(mcCollisions.size())) { continue; } - if (std::abs(collision.posZ()) > cfgZvertex) + // STORE CENTRALITY WITHOUT ANY CUTS + mcCollInfos[mcCollIdx].centrality = collision.centFT0C(); + } + + // FILL DENOMINATOR: ONCE per MC collision + for (size_t i = 0; i < mcCollInfos.size(); i++) { + if (mcCollInfos[i].centrality >= 0) { // Only if we found a matching collision + histomc.fill(HIST("hEventLossDenom"), mcCollInfos[i].centrality); + } + } + + for (auto const& collision : collisions) { + int mcCollIdx = collision.mcCollisionId(); + if (mcCollIdx < 0 || mcCollIdx >= static_cast(mcCollisions.size())) { continue; - if (!collision.sel8()) + } + if (std::abs(collision.posZ()) > cfgZvertex && cfgZvertexRequireMC) + continue; + if (!collision.sel8() && cfgsel8Require) continue; if (collision.centFT0C() > centcut) continue; + // Additional cuts + if (removeITSROFrameBorder && !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) + continue; + if (removeNoSameBunchPileup && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) + continue; + if (requireIsGoodZvtxFT0vsPV && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) + continue; + if (requireIsVertexITSTPC && !collision.selection_bit(aod::evsel::kIsVertexITSTPC)) + continue; + if (removeNoTimeFrameBorder && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) + continue; + mcCollInfos[mcCollIdx].passedEvSel = true; - mcCollInfos[mcCollIdx].centrality = collision.centFT0C(); + histomc.fill(HIST("hEventLossNumer"), mcCollInfos[mcCollIdx].centrality); } for (auto const& mcCollision : mcCollisions) { size_t idx = mcCollision.globalIndex(); @@ -464,10 +495,20 @@ struct NucleitpcPbPb { int pdgCode = mcParticle.pdgCode(); bool isHe3 = (std::abs(pdgCode) == particlePdgCodes.at(4)); bool isHe4 = (std::abs(pdgCode) == particlePdgCodes.at(5)); - - if (std::abs(mcParticle.eta()) > cfgCutEta) + if (mcParticle.isPhysicalPrimary()) { + if (pdgCode == particlePdgCodes.at(4)) { + histomc.fill(HIST("histPtgenHe3"), mcParticle.pt()); + } else if (pdgCode == -particlePdgCodes.at(4)) { + histomc.fill(HIST("histPtgenAntiHe3"), mcParticle.pt()); + } else if (pdgCode == particlePdgCodes.at(5)) { + histomc.fill(HIST("histPtgenHe4"), mcParticle.pt()); + } else if (pdgCode == -particlePdgCodes.at(5)) { + histomc.fill(HIST("histPtgenAntiHe4"), mcParticle.pt()); + } + } + if (std::abs(mcParticle.eta()) > cfgCutEta && cfgetaRequireMC) continue; - if (std::abs(mcParticle.y()) > cfgCutRapidity) + if (std::abs(mcParticle.y()) > cfgCutRapidity && cfgRapidityRequireMC) continue; bool isMaterialSecondary = false; if (!mcParticle.isPhysicalPrimary() && (isHe3 || isHe4)) { @@ -543,7 +584,7 @@ struct NucleitpcPbPb { particleType = he4; if (particleType >= 0) { - float centrality = mcCollInfos[idx].passedEvSel ? mcCollInfos[idx].centrality : -1.0f; + float centrality = mcCollInfos[idx].centrality; // Always use actual centrality histomc.fill(HIST("hDenomSignalLoss"), particleType, mcParticle.pt(), mcParticle.y(), centrality, particleAnti, decayType); if (mcCollInfos[idx].passedEvSel) { @@ -563,15 +604,6 @@ struct NucleitpcPbPb { histomc.fill(HIST("histWeakDecayPtAntiHe4"), mcParticle.pt(), centrality); } } - if (pdgCode == particlePdgCodes.at(4)) { - histomc.fill(HIST("histPtgenHe3"), mcParticle.pt()); - } else if (pdgCode == -particlePdgCodes.at(4)) { - histomc.fill(HIST("histPtgenAntiHe3"), mcParticle.pt()); - } else if (pdgCode == particlePdgCodes.at(5)) { - histomc.fill(HIST("histPtgenHe4"), mcParticle.pt()); - } else if (pdgCode == -particlePdgCodes.at(5)) { - histomc.fill(HIST("histPtgenAntiHe4"), mcParticle.pt()); - } } } for (auto const& mcCollision : mcCollisions) { @@ -933,6 +965,7 @@ struct NucleitpcPbPb { { if (!track.hasTOF() || !cfgFillmass) return; + float beta{o2::pid::tof::Beta::GetBeta(track)}; const float eps = 1e-6f; if (beta < eps || beta > 1.0f - eps) @@ -942,7 +975,16 @@ struct NucleitpcPbPb { float massTOF = p * charge * std::sqrt(1.f / (beta * beta) - 1.f); // get PDG mass float pdgMass = particleMasses[species]; - float massDiff = massTOF - pdgMass; + float massDiff = 0.0; + if (species != he4) { + massDiff = massTOF - pdgMass; + } + if (species == he4) { + if (cfgMasscut && (massTOF * massTOF > 6.5 && massTOF * massTOF < 9.138)) + return; + massDiff = massTOF - pdgMass; + } + float ptMomn; setTrackParCov(track, mTrackParCov); mTrackParCov.setPID(track.pidForTracking()); @@ -966,8 +1008,19 @@ struct NucleitpcPbPb { float charge = (species == he3 || species == he4) ? 2.f : 1.f; float p = getRigidity(track); float massTOF = p * charge * std::sqrt(1.f / (beta * beta) - 1.f); + // get PDG mass float masssquare = massTOF * massTOF; + + if (species != he4) { + masssquare = massTOF * massTOF; + } + if (species == he4) { + if (cfgMasscut && (massTOF * massTOF > 6.5 && massTOF * massTOF < 9.138)) + return; + masssquare = massTOF * massTOF; + } + if (track.sign() > 0) { hmassnsigma[2 * species]->Fill(sigma, masssquare); } else if (track.sign() < 0) { From 6d2a94895a0646d36650b97a423af0a78a8af133 Mon Sep 17 00:00:00 2001 From: ariedel-cern <85537041+ariedel-cern@users.noreply.github.com> Date: Tue, 16 Sep 2025 16:27:20 +0200 Subject: [PATCH 416/986] [PWGCF] Finish CollisionBuilder (#12996) --- PWGCF/Femto/Core/baseSelection.h | 35 +- PWGCF/Femto/Core/cascadeBuilder.h | 54 +-- PWGCF/Femto/Core/collisionBuilder.h | 314 ++++++++++-------- PWGCF/Femto/Core/dataTypes.h | 3 + PWGCF/Femto/Core/modes.h | 2 - PWGCF/Femto/Core/selectionContainer.h | 7 +- PWGCF/Femto/Core/trackBuilder.h | 90 ++--- PWGCF/Femto/Core/twoTrackResonanceBuilder.h | 102 +++--- PWGCF/Femto/Core/v0Builder.h | 54 +-- PWGCF/Femto/DataModel/FemtoTables.h | 7 + PWGCF/Femto/TableProducer/CMakeLists.txt | 2 +- PWGCF/Femto/TableProducer/femtoProducer.cxx | 14 +- PWGCF/Femto/Tasks/femtoCascadeQa.cxx | 2 +- PWGCF/Femto/Tasks/femtoTrackQa.cxx | 2 +- .../Femto/Tasks/femtoTwotrackresonanceQa.cxx | 2 +- PWGCF/Femto/Tasks/femtoV0Qa.cxx | 2 +- 16 files changed, 389 insertions(+), 303 deletions(-) diff --git a/PWGCF/Femto/Core/baseSelection.h b/PWGCF/Femto/Core/baseSelection.h index f452db10e21..e64f5d05665 100644 --- a/PWGCF/Femto/Core/baseSelection.h +++ b/PWGCF/Femto/Core/baseSelection.h @@ -110,17 +110,48 @@ class BaseSelection mSelectionContainers.at(observableIndex) = SelectionContainer(baseName, lowerLimit, upperLimit, selectionValues, limitType, skipMostPermissiveBit, isMinimalCut); } + /// \brief Add a boolean based selection for a specific observable. + /// \param mode Whether the selection is not applied, minimal or optional cut + /// \param observableIndex Index of the observable. + void addSelection(int mode, int observableIndex) + { + if (static_cast(observableIndex) >= NumObservables) { + LOG(fatal) << "Observable is not valid. Observable (index) has to be smaller than " << NumObservables; + } + switch (mode) { + case -1: // cut is optional and we store bit for the cut + mNSelections += 1; + mHasOptionalSelection = true; + mSelectionContainers.at(observableIndex) = SelectionContainer(std::vector{1}, limits::LimitType::kEqual, false, false); + break; + case 0: // cut is not applied, initalize with empty vector, so we bail out later + mSelectionContainers.at(observableIndex) = SelectionContainer(std::vector{}, limits::LimitType::kEqual, false, false); + break; + case 1: // cut is added as mininal selection (since it is only one value, not extra bit is stored) + mSelectionContainers.at(observableIndex) = SelectionContainer(std::vector{1}, limits::LimitType::kEqual, true, true); + break; + default: + LOG(fatal) << "Invalid switch for boolean selection"; + } + if (mNSelections >= sizeof(BitmaskType) * CHAR_BIT) { + LOG(fatal) << "Too many selections. At most " << sizeof(BitmaskType) * CHAR_BIT << " are supported"; + } + } + /// \brief Update the limits of a function-based selection for a specific observable. /// \param observable Index of the observable. /// \param value Value at which to evaluate the selection functions. - void updateLimits(int observable, T value) { mSelectionContainers.at(observable).updateLimits(value); } + void updateLimits(int observable, T value) + { + mSelectionContainers.at(observable).updateLimits(value); + } /// \brief Reset the internal bitmask and evaluation flags before evaluating a new event. void reset() { mFinalBitmask.reset(); mPassesMinimalSelections = true; - // will be true if no optional cut as been defined and + // will be true if no optional cut has been defined and // will be set to false if we have optional cuts (but will be set to true in the case at least one optional cut succeeds) mPassesOptionalSelections = !mHasOptionalSelection; } diff --git a/PWGCF/Femto/Core/cascadeBuilder.h b/PWGCF/Femto/Core/cascadeBuilder.h index 637bbce5f3d..b7342c3516f 100644 --- a/PWGCF/Femto/Core/cascadeBuilder.h +++ b/PWGCF/Femto/Core/cascadeBuilder.h @@ -337,23 +337,23 @@ class CascadeBuilder template void init(T1& config, T2& filter, T3& table, T4& initContext) { - cascadeSelection.configure(config, filter); + mCascadeSelection.configure(config, filter); if constexpr (modes::isEqual(cascadeType, modes::Cascade::kXi)) { LOG(info) << "Initialize femto Xi builder..."; - produceXis = utils::enableTable("FXis_001", table.produceXis.value, initContext); - produceXiMasks = utils::enableTable("FXiMasks_001", table.produceXiMasks.value, initContext); - produceXiExtras = utils::enableTable("FXiExtras_001", table.produceXiExtras.value, initContext); + mProduceXis = utils::enableTable("FXis_001", table.produceXis.value, initContext); + mProduceXiMasks = utils::enableTable("FXiMasks_001", table.produceXiMasks.value, initContext); + mProduceXiExtras = utils::enableTable("FXiExtras_001", table.produceXiExtras.value, initContext); } if constexpr (modes::isEqual(cascadeType, modes::Cascade::kOmega)) { LOG(info) << "Initialize femto Omega builder..."; - produceOmegas = utils::enableTable("FOmegas_001", table.produceOmegas.value, initContext); - produceOmegaMasks = utils::enableTable("FOmegaMasks_001", table.produceOmegaMasks.value, initContext); - produceOmegaExtras = utils::enableTable("FOmegaExtras_001", table.produceOmegaExtras.value, initContext); + mProduceOmegas = utils::enableTable("FOmegas_001", table.produceOmegas.value, initContext); + mProduceOmegaMasks = utils::enableTable("FOmegaMasks_001", table.produceOmegaMasks.value, initContext); + mProduceOmegaExtras = utils::enableTable("FOmegaExtras_001", table.produceOmegaExtras.value, initContext); } - if (produceXis || produceXiExtras || produceXiMasks || produceOmegas || produceOmegaMasks || produceOmegaExtras) { + if (mProduceXis || mProduceXiExtras || mProduceXiMasks || mProduceOmegas || mProduceOmegaMasks || mProduceOmegaExtras) { mFillAnyTable = true; - cascadeSelection.printSelections(cascadeSelsName, cascadeSelsToString); + mCascadeSelection.printSelections(cascadeSelsName, cascadeSelsToString); } else { LOG(info) << "No tables configured"; } @@ -371,11 +371,11 @@ class CascadeBuilder int64_t posDaughterIndex = 0; int64_t negDaughterIndex = 0; for (const auto& cascade : fullCascades) { - if (!cascadeSelection.checkFilters(cascade)) { + if (!mCascadeSelection.checkFilters(cascade)) { continue; } - cascadeSelection.applySelections(cascade, fullTracks, col); - if (cascadeSelection.passesAllRequiredSelections() && cascadeSelection.checkHypothesis(cascade)) { + mCascadeSelection.applySelections(cascade, fullTracks, col); + if (mCascadeSelection.passesAllRequiredSelections() && mCascadeSelection.checkHypothesis(cascade)) { auto bachelor = cascade.template bachelor_as(); auto posDaughter = cascade.template posTrack_as(); @@ -394,7 +394,7 @@ class CascadeBuilder void fillCascade(T1& collisionProducts, T2& cascadeProducts, T3 const& cascade, T4 const& col, int bachelorIndex, int posDaughterIndex, int negDaughterIndex) { if constexpr (modes::isEqual(cascadeType, modes::Cascade::kXi)) { - if (produceXis) { + if (mProduceXis) { cascadeProducts.producedXis(collisionProducts.producedCollision.lastIndex(), cascade.sign() * cascade.pt(), cascade.eta(), @@ -404,10 +404,10 @@ class CascadeBuilder posDaughterIndex, negDaughterIndex); } - if (produceXiMasks) { - cascadeProducts.producedXiMasks(cascadeSelection.getBitmask()); + if (mProduceXiMasks) { + cascadeProducts.producedXiMasks(mCascadeSelection.getBitmask()); } - if (produceXiExtras) { + if (mProduceXiExtras) { cascadeProducts.producedXiExtras( cascade.mOmega(), cascade.casccosPA(col.posX(), col.posY(), col.posZ()), @@ -420,7 +420,7 @@ class CascadeBuilder } } if constexpr (modes::isEqual(cascadeType, modes::Cascade::kOmega)) { - if (produceOmegas) { + if (mProduceOmegas) { cascadeProducts.producedOmegas(collisionProducts.producedCollision.lastIndex(), cascade.sign() * cascade.pt(), cascade.eta(), @@ -430,10 +430,10 @@ class CascadeBuilder posDaughterIndex, negDaughterIndex); } - if (produceOmegaMasks) { - cascadeProducts.producedOmegaMasks(cascadeSelection.getBitmask()); + if (mProduceOmegaMasks) { + cascadeProducts.producedOmegaMasks(mCascadeSelection.getBitmask()); } - if (produceOmegaExtras) { + if (mProduceOmegaExtras) { cascadeProducts.producedOmegaExtras( cascade.mXi(), cascade.casccosPA(col.posX(), col.posY(), col.posZ()), @@ -450,14 +450,14 @@ class CascadeBuilder bool fillAnyTable() { return mFillAnyTable; } private: - CascadeSelection cascadeSelection; + CascadeSelection mCascadeSelection; bool mFillAnyTable = false; - bool produceXis = false; - bool produceXiMasks = false; - bool produceXiExtras = false; - bool produceOmegas = false; - bool produceOmegaMasks = false; - bool produceOmegaExtras = false; + bool mProduceXis = false; + bool mProduceXiMasks = false; + bool mProduceXiExtras = false; + bool mProduceOmegas = false; + bool mProduceOmegaMasks = false; + bool mProduceOmegaExtras = false; }; } // namespace cascadebuilder diff --git a/PWGCF/Femto/Core/collisionBuilder.h b/PWGCF/Femto/Core/collisionBuilder.h index a11a4071721..b33619dcf6f 100644 --- a/PWGCF/Femto/Core/collisionBuilder.h +++ b/PWGCF/Femto/Core/collisionBuilder.h @@ -16,11 +16,13 @@ #ifndef PWGCF_FEMTO_CORE_COLLISIONBUILDER_H_ #define PWGCF_FEMTO_CORE_COLLISIONBUILDER_H_ +#include "PWGCF/Femto/Core/baseSelection.h" #include "PWGCF/Femto/Core/femtoUtils.h" #include "PWGCF/Femto/Core/modes.h" #include "PWGCF/Femto/DataModel/FemtoTables.h" #include "Common/CCDB/EventSelectionParams.h" +#include "EventFiltering/Zorro.h" #include "Framework/AnalysisHelpers.h" #include "Framework/Configurable.h" @@ -29,6 +31,7 @@ #include #include +#include namespace o2::analysis::femto { @@ -36,7 +39,7 @@ namespace collisionbuilder { // configurables for collision selection -struct ConfCollisionFilter : o2::framework::ConfigurableGroup { +struct ConfCollisionFilters : o2::framework::ConfigurableGroup { std::string prefix = std::string("CollisionFilter"); o2::framework::Configurable vtxZMin{"vtxZMin", -10.f, "Minimum vertex Z position (cm)"}; o2::framework::Configurable vtxZMax{"vtxZMax", 10.f, "Maximum vertex Z position (cm)"}; @@ -52,48 +55,75 @@ struct ConfCollisionFilter : o2::framework::ConfigurableGroup { o2::framework::Configurable magFieldMax{"magFieldMax", 1.f, "Maximum magnetic field strength (T)"}; }; -struct ConfCollisionFlags : o2::framework::ConfigurableGroup { - o2::framework::Configurable sel8{"sel8", true, "Use sel8 (Should suffice for pp, for PbPb the other flags are more important)"}; - o2::framework::Configurable noSameBunchPileup{"noSameBunchPileup", false, "Reject collisions in case of pileup with another collision in the same foundBC"}; - o2::framework::Configurable isVertexItsTpc{"isVertexItsTpc", false, "At least one ITS-TPC track found for the vertex"}; - o2::framework::Configurable isGoodZvtxFt0VsPv{"isGoodZvtxFt0VsPv", false, "small difference between z-vertex from PV and from FT0"}; - o2::framework::Configurable noCollInTimeRangeNarrow{"noCollInTimeRangeNarrow", false, "no other collisions in specified time range (narrower than Strict)"}; - o2::framework::Configurable noCollInTimeRangeStrict{"noCollInTimeRangeStrict", false, "no other collisions in specified time range"}; - o2::framework::Configurable noCollInTimeRangeStandard{"noCollInTimeRangeStandard", false, "no other collisions in specified time range with per-collision multiplicity above threshold"}; - o2::framework::Configurable noCollInRofStrict{"noCollInRofStrict", false, "no other collisions in this Readout Frame"}; - o2::framework::Configurable noCollInRofStandard{"noCollInRofStandard", false, "no other collisions in this Readout Frame with per-collision multiplicity above threshold"}; - o2::framework::Configurable noHighMultCollInPrevRof{"noHighMultCollInPrevRof", false, "veto an event if FT0C amplitude in previous ITS ROF is above threshold"}; - o2::framework::Configurable isGoodItsLayer3{"isGoodItsLayer3", false, "number of inactive chips on ITS layer 3 is below maximum allowed value"}; - o2::framework::Configurable isGoodItsLayer0123{"isGoodItsLayer0123", false, "numbers of inactive chips on ITS layers 0-3 are below maximum allowed values"}; - o2::framework::Configurable isGoodItsLayersAll{"isGoodItsLayersAll", false, "numbers of inactive chips on all ITS layers are below maximum allowed values"}; +struct ConfCollisionBits : o2::framework::ConfigurableGroup { + std::string prefix = std::string("CollisionBits"); + o2::framework::Configurable sel8{"sel8", 1, "Use sel8 (-1: stored in bitmaks; 0 off; 1 on)"}; + o2::framework::Configurable noSameBunchPileup{"noSameBunchPileup", 0, "Reject collisions in case of pileup with another collision in the same foundBC (-1: stored in bitmaks; 0 off; 1 on)"}; + o2::framework::Configurable isVertexItsTpc{"isVertexItsTpc", 0, "At least one ITS-TPC track found for the vertex (-1: stored in bitmaks; 0 off; 1 on)"}; + o2::framework::Configurable isGoodZvtxFt0VsPv{"isGoodZvtxFt0VsPv", 0, "small difference between z-vertex from PV and from FT0 (-1: stored in bitmaks; 0 off; 1 on)"}; + o2::framework::Configurable noCollInTimeRangeNarrow{"noCollInTimeRangeNarrow", 0, "no other collisions in specified time range (narrower than Strict)(-1: stored in bitmaks; 0 off; 1 on)"}; + o2::framework::Configurable noCollInTimeRangeStrict{"noCollInTimeRangeStrict", 0, "no other collisions in specified time range strict (-1: stored in bitmaks; 0 off; 1 on)"}; + o2::framework::Configurable noCollInTimeRangeStandard{"noCollInTimeRangeStandard", 0, "no other collisions in specified time range with per-collision multiplicity above threshold (-1: stored in bitmaks; 0 off; 1 on)"}; + o2::framework::Configurable noCollInRofStrict{"noCollInRofStrict", 0, "no other collisions in this Readout Frame strict (-1: stored in bitmaks; 0 off; 1 on)"}; + o2::framework::Configurable noCollInRofStandard{"noCollInRofStandard", 0, "no other collisions in this Readout Frame with per-collision multiplicity above threshold (-1: stored in bitmaks; 0 off; 1 on)"}; + o2::framework::Configurable noHighMultCollInPrevRof{"noHighMultCollInPrevRof", 0, "veto an event if FT0C amplitude in previous ITS ROF is above threshold (-1: stored in bitmaks; 0 off; 1 on)"}; + o2::framework::Configurable isGoodItsLayer3{"isGoodItsLayer3", 0, "number of inactive chips on ITS layer 3 is below maximum allowed value (-1: stored in bitmaks; 0 off; 1 on)"}; + o2::framework::Configurable isGoodItsLayer0123{"isGoodItsLayer0123", 0, "numbers of inactive chips on ITS layers 0-3 are below maximum allowed values (-1: stored in bitmaks; 0 off; 1 on)"}; + o2::framework::Configurable isGoodItsLayersAll{"isGoodItsLayersAll", 0, "numbers of inactive chips on all ITS layers are below maximum allowed values (-1: stored in bitmaks; 0 off; 1 on)"}; }; -/// \class FemtoDreamTrackCuts -/// \brief Cut class to contain and execute all cuts applied to tracks -class CollisionSelection +struct ConfCollisionTriggers : o2::framework::ConfigurableGroup { + std::string prefix = std::string("CollisionTriggers"); + o2::framework::Configurable useTrigger{"useTrigger", false, "Set to true to only selected triggered collisions"}; + o2::framework::Configurable ccdbPath{"ccdbPath", std::string("EventFiltering/Zorro/"), "CCDB path for trigger information"}; + o2::framework::Configurable triggers{"triggers", std::string("fPPP,fPPL"), "Comma seperated list of all triggers to be used"}; +}; + +/// enum for all collision selections +enum CollisionSels { + // collsion selection flags + kSel8, ///< Sel8 + kNoSameBunchPileUp, ///< Reject collisions in case of pileup with another collision in the same foundBC + kIsVertexItsTpc, ///< At least one ITS-TPC track found for the vertex + kIsGoodZvtxFt0VsPv, ///< small difference between z-vertex from PV and from FT0 + kNoCollInTimeRangeNarrow, ///< no other collisions in specified time range (narrower than Strict) + kNoCollInTimeRangeStrict, ///< no other collisions in specified time range strict + kNoCollInTimeRangeStandard, ///< no other collisions in specified time range + kNoCollInRofStrict, ///< no other collisions in this Readout Frame strict + kNoCollInRofStandard, ///< no other collisions in this Readout Frame + kNoHighMultCollInPrevRof, ///< veto an event if FT0C amplitude in previous ITS ROF is above threshold + kIsGoodItsLayer3, ///< number of inactive chips on ITS layer 3 is below maximum allowed value + kIsGoodItsLayer0123, ///< numbers of inactive chips on ITS layers 0-3 are below maximum allowed values + kIsGoodItsLayersAll, ///< numbers of inactive chips on all ITS layers are below maximum allowed values + + kCollisionSelsMax +}; + +const char colSelsName[] = "Collision Selection Object"; +const std::unordered_map colSelsToString = { + {kSel8, "Sel8"}, + {kNoSameBunchPileUp, "No same bunch pileup"}, + {kIsVertexItsTpc, "Is vertex ITS TPC"}, + {kIsGoodZvtxFt0VsPv, "Is good zvtx FT0 vs PV"}, + {kNoCollInTimeRangeNarrow, "No collision in time range narrow"}, + {kNoCollInTimeRangeStrict, "No collision in time range strict"}, + {kNoCollInTimeRangeStandard, "No collission in time range standard"}, + {kNoCollInRofStrict, "No collsion in ROF strict"}, + {kNoCollInRofStandard, "No collision in ROF standard"}, + {kNoHighMultCollInPrevRof, "No high mult collsions in previous ROF"}, + {kIsGoodItsLayer3, "Is good ITS layer 3"}, + {kIsGoodItsLayer0123, "Is good ITS layer 0-3"}, + {kIsGoodItsLayersAll, "Is good ITS layer all"}}; + +class CollisionSelection : public BaseSelection { public: CollisionSelection() {} virtual ~CollisionSelection() = default; template - void configure(T1 const& filter, T2 const& flags) + void configure(T1 const& filter, T2 const& config) { - // flags - mSel8 = flags.sel8.value; - mNoSameBunchPileup = flags.noSameBunchPileup.value; - mIsVertexItsTpc = flags.isVertexItsTpc.value; - mIsGoodZvtxFt0VsPv = flags.isGoodZvtxFt0VsPv.value; - mNoCollInTimeRangeNarrow = flags.noCollInTimeRangeNarrow.value; - mNoCollInTimeRangeStrict = flags.noCollInTimeRangeStrict.value; - mNoCollInTimeRangeStandard = flags.noCollInTimeRangeStandard.value; - mNoCollInRofStrict = flags.noCollInRofStrict.value; - mNoCollInRofStandard = flags.noCollInRofStandard.value; - mNoHighMultCollInPrevRof = flags.noHighMultCollInPrevRof.value; - mIsGoodItsLayer3 = flags.isGoodItsLayer3.value; - mIsGoodItsLayer0123 = flags.isGoodItsLayer0123.value; - mIsGoodItsLayersAll = flags.isGoodItsLayersAll.value; - // cuts mVtxZMin = filter.vtxZMin.value; mVtxZMax = filter.vtxZMax.value; @@ -107,6 +137,20 @@ class CollisionSelection mSphericityMax = filter.spherMax.value; mOccupancyMin = filter.occupancyMin.value; mOccupancyMax = filter.occupancyMax.value; + + // flags + this->addSelection(config.sel8.value, kSel8); + this->addSelection(config.noSameBunchPileup.value, kNoSameBunchPileUp); + this->addSelection(config.isGoodZvtxFt0VsPv.value, kIsGoodZvtxFt0VsPv); + this->addSelection(config.noCollInTimeRangeNarrow.value, kNoCollInTimeRangeNarrow); + this->addSelection(config.noCollInTimeRangeStrict.value, kNoCollInTimeRangeStrict); + this->addSelection(config.noCollInTimeRangeStandard.value, kNoCollInTimeRangeStandard); + this->addSelection(config.noCollInRofStrict.value, kNoCollInRofStrict); + this->addSelection(config.noCollInRofStandard.value, kNoCollInRofStandard); + this->addSelection(config.noHighMultCollInPrevRof.value, kNoHighMultCollInPrevRof); + this->addSelection(config.isGoodItsLayer3.value, kIsGoodItsLayer3); + this->addSelection(config.isGoodItsLayer0123.value, kIsGoodItsLayer0123); + this->addSelection(config.isGoodItsLayersAll.value, kIsGoodItsLayersAll); }; void setMagneticField(float MagField) @@ -139,56 +183,26 @@ class CollisionSelection } float getCentrality() const { return mCentrality; } - template - bool checkCuts(T const& col) + template + void setMultiplicity(const T& col) { - - // flags - if (mSel8 && !col.sel8()) { // might change in the future, but sel8 checks TVXTrigger and cuts out time frame border and ITS readout frame border - return false; - } - if (mNoSameBunchPileup && !col.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - return false; - } - if (mIsVertexItsTpc && !col.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { - return false; - } - if (mIsGoodZvtxFt0VsPv && !col.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { - return false; - } - if (mNoCollInTimeRangeNarrow && !col.selection_bit(aod::evsel::kNoCollInTimeRangeNarrow)) { - return false; - } - if (mNoCollInTimeRangeStrict && !col.selection_bit(aod::evsel::kNoCollInTimeRangeStrict)) { - return false; - } - if (mNoCollInTimeRangeStandard && !col.selection_bit(aod::evsel::kNoCollInTimeRangeStandard)) { - return false; - } - if (mNoCollInRofStrict && !col.selection_bit(aod::evsel::kNoCollInRofStrict)) { - return false; - } - if (mNoCollInRofStandard && !col.selection_bit(aod::evsel::kNoCollInRofStandard)) { - return false; - } - if (mNoHighMultCollInPrevRof && !col.selection_bit(aod::evsel::kNoHighMultCollInPrevRof)) { - return false; - } - if (mIsGoodItsLayer3 && !col.selection_bit(aod::evsel::kIsGoodITSLayer3)) { - return false; - } - if (mIsGoodItsLayer0123 && !col.selection_bit(aod::evsel::kIsGoodITSLayer0123)) { - return false; + if constexpr (modes::isFlagSet(system, modes::System::kPP)) { + mMultiplicity = col.multNTracksPV(); } - if (mIsGoodItsLayersAll && !col.selection_bit(aod::evsel::kIsGoodITSLayersAll)) { - return false; + if constexpr (modes::isFlagSet(system, modes::System::kPbPb)) { + // change multiplicity estimator for PbPb? + mMultiplicity = col.multNTracksPV(); } + } + float getMultiplicity() const { return mMultiplicity; } - // cuts + template + bool checkFilters(T const& col) const + { if (col.posZ() < mVtxZMin || col.posZ() > mVtxZMax) { return false; } - if (col.multNTracksPV() < mMultMin || col.multNTracksPV() > mMultMax) { + if (mMultiplicity < mMultMin || mMultiplicity > mMultMax) { return false; } if (mCentrality < mCentMin || mCentrality > mCentMax) { @@ -200,28 +214,38 @@ class CollisionSelection if (mSphericity < mSphericityMin || mSphericity > mSphericityMax) { return false; } + if (col.trackOccupancyInTimeRange() < mOccupancyMin || col.trackOccupancyInTimeRange() > mOccupancyMax) { + return false; + } return true; } - private: - float mCentrality = 0.f; + template + void applySelections(T const& col) + { + this->reset(); + + // casting bool to float gurantees + // false -> 0 + // true -> 1 + this->evaluateObservable(kSel8, static_cast(col.sel8())); + this->evaluateObservable(kNoSameBunchPileUp, static_cast(col.selection_bit(o2::aod::evsel::kNoSameBunchPileup))); + this->evaluateObservable(kIsVertexItsTpc, static_cast(col.selection_bit(o2::aod::evsel::kIsVertexITSTPC))); + this->evaluateObservable(kIsGoodZvtxFt0VsPv, static_cast(col.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV))); + this->evaluateObservable(kNoCollInTimeRangeNarrow, static_cast(col.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow))); + this->evaluateObservable(kNoCollInTimeRangeStrict, static_cast(col.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStrict))); + this->evaluateObservable(kNoCollInRofStrict, static_cast(col.selection_bit(o2::aod::evsel::kNoCollInRofStrict))); + this->evaluateObservable(kNoCollInRofStandard, static_cast(col.selection_bit(o2::aod::evsel::kNoCollInRofStandard))); + this->evaluateObservable(kNoHighMultCollInPrevRof, static_cast(col.selection_bit(o2::aod::evsel::kNoHighMultCollInPrevRof))); + this->evaluateObservable(kIsGoodItsLayer3, static_cast(col.selection_bit(o2::aod::evsel::kIsGoodITSLayer3))); + this->evaluateObservable(kIsGoodItsLayer0123, static_cast(col.selection_bit(o2::aod::evsel::kIsGoodITSLayer0123))); + this->evaluateObservable(kIsGoodItsLayersAll, static_cast(col.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll))); + + this->assembleBitmask(); + }; - // flags - bool mSel8 = false; - bool mNoSameBunchPileup = false; - bool mIsVertexItsTpc = false; - bool mIsGoodZvtxFt0VsPv = false; - bool mNoCollInTimeRangeNarrow = false; - bool mNoCollInTimeRangeStrict = false; - bool mNoCollInTimeRangeStandard = false; - bool mNoCollInRofStrict = false; - bool mNoCollInRofStandard = false; - bool mNoHighMultCollInPrevRof = false; - bool mIsGoodItsLayer3 = false; - bool mIsGoodItsLayer0123 = false; - bool mIsGoodItsLayersAll = false; - - // cuts + protected: + // filter cuts float mVtxZMin = -12.f; float mVtxZMax = -12.f; float mSphericityMin = 0.f; @@ -237,10 +261,13 @@ class CollisionSelection float mMagField = 0.f; float mSphericity = 0.f; + float mCentrality = 0.f; + float mMultiplicity = 0.f; }; struct CollisionBuilderProducts : o2::framework::ProducesGroup { o2::framework::Produces producedCollision; + o2::framework::Produces produceCollisionMask; o2::framework::Produces producedOccupancy; o2::framework::Produces producedQns; o2::framework::Produces producedPositions; @@ -251,6 +278,7 @@ struct CollisionBuilderProducts : o2::framework::ProducesGroup { struct ConfCollisionTables : o2::framework::ConfigurableGroup { std::string prefix = std::string("CollisionTables"); o2::framework::Configurable produceCollisions{"produceCollisions", -1, "Produce Collisions (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceCollisionMasks{"produceCollisionMasks", -1, "Produce Collision Masks (-1: auto; 0 off; 1 on)"}; o2::framework::Configurable produceOccupancy{"produceOccupancy", -1, "Produce Occupancy (-1: auto; 0 off; 1 on)"}; o2::framework::Configurable produceQns{"produceQns", -1, "Produce Qn (-1: auto; 0 off; 1 on)"}; o2::framework::Configurable producePositions{"producePositions", -1, "Produce Positions (-1: auto; 0 off; 1 on)"}; @@ -264,62 +292,80 @@ class CollisionBuilder CollisionBuilder() {} virtual ~CollisionBuilder() = default; - template - void init(T1& filter, T2& flags, T3& table, T4& initContext) + template + void init(T1& filter, T2& config, T3& table, T4& trigger, T5& initContext) { - collisionSelection.configure(filter, flags); + mCollisionSelection.configure(filter, config); + if (trigger.useTrigger.value) { + mUseTrigger = true; + mTriggerNames = trigger.triggers.value; + mZorro.setBaseCCDBPath(trigger.ccdbPath.value); + } LOG(info) << "Initialize femto collision builder..."; - producedCollisions = utils::enableTable("FCols_001", table.produceCollisions.value, initContext); - produceOccupancy = utils::enableTable("FColOccs_001", table.produceOccupancy.value, initContext); - produceQns = utils::enableTable("FColQnBins_001", table.produceQns.value, initContext); - producedPositions = utils::enableTable("FColPos_001", table.producePositions.value, initContext); - producedMultiplicities = utils::enableTable("FColMults_001", table.produceMults.value, initContext); - producedCentralities = utils::enableTable("FColCents_001", table.produceCents.value, initContext); - if (producedCollisions || producedPositions || producedMultiplicities || producedCentralities) { - fillAnyTable = true; + mProducedCollisions = utils::enableTable("FCols_001", table.produceCollisions.value, initContext); + mProducedCollisionMasks = utils::enableTable("FColMasks_001", table.produceCollisionMasks.value, initContext); + mProduceOccupancy = utils::enableTable("FColOccs_001", table.produceOccupancy.value, initContext); + mProduceQns = utils::enableTable("FColQnBins_001", table.produceQns.value, initContext); + mProducedPositions = utils::enableTable("FColPos_001", table.producePositions.value, initContext); + mProducedMultiplicities = utils::enableTable("FColMults_001", table.produceMults.value, initContext); + mProducedCentralities = utils::enableTable("FColCents_001", table.produceCents.value, initContext); + if (mProducedCollisions || mProducedCollisionMasks || mProducedPositions || mProducedMultiplicities || mProducedCentralities) { + mFillAnyTable = true; + mCollisionSelection.printSelections(colSelsName, colSelsToString); } else { LOG(info) << "No tables configured"; } LOG(info) << "Initialization done..."; } - template - void buildCollision(T1& col, T2 tracks, float magField) + template + void buildCollision(T1& bc, T2& col, T3& tracks, T4& ccdb, float magField) { - collisionSelection.setMagneticField(magField); - collisionSelection.setSphericity(tracks); - collisionSelection.setCentrality(col); + if (mUseTrigger) { + mZorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), mTriggerNames); + } + mCollisionSelection.setMagneticField(magField); + mCollisionSelection.setSphericity(tracks); + mCollisionSelection.setMultiplicity(col); + mCollisionSelection.setCentrality(col); + + mCollisionSelection.applySelections(col); } - template - bool checkCuts(T const& col) + template + bool checkCollision(T1 const& bc, T2 const& col) { - return collisionSelection.checkCuts(col); + if (mUseTrigger) { + return mZorro.isSelected(bc.globalBC()) && mCollisionSelection.checkFilters(col) && mCollisionSelection.passesAllRequiredSelections(); + } else { + + return mCollisionSelection.checkFilters(col) && mCollisionSelection.passesAllRequiredSelections(); + } } template void fillCollision(T1& collisionProducts, T2 const& col) { - if (!fillAnyTable) { + if (!mFillAnyTable) { return; } - if (producedCollisions) { + if (mProducedCollisions) { collisionProducts.producedCollision(col.posZ(), col.multNTracksPV(), - collisionSelection.getCentrality(), - collisionSelection.getSphericity(), - collisionSelection.getMagneticField()); + mCollisionSelection.getCentrality(), + mCollisionSelection.getSphericity(), + mCollisionSelection.getMagneticField()); } - if (produceOccupancy) { + if (mProduceOccupancy) { collisionProducts.producedOccupancy(col.trackOccupancyInTimeRange()); } - if (producedPositions) { + if (mProducedPositions) { collisionProducts.producedPositions(col.posX(), col.posY()); } - if (producedMultiplicities) { + if (mProducedMultiplicities) { collisionProducts.producedMultiplicityEstimators( col.multFT0A(), col.multFT0C(), @@ -328,7 +374,7 @@ class CollisionBuilder col.trackOccupancyInTimeRange(), col.ft0cOccupancyInTimeRange()); } - if (producedCentralities) { + if (mProducedCentralities) { collisionProducts.producedCentralityEstimators( col.centFT0A(), col.centFT0C()); @@ -336,21 +382,25 @@ class CollisionBuilder // PbPb specific columns if constexpr (modes::isFlagSet(system, modes::System::kPbPb)) { - if (produceQns) { + if (mProduceQns) { collisionProducts.producedQns(utils::qn(col)); } } } private: - CollisionSelection collisionSelection; - bool fillAnyTable = false; - bool producedCollisions = false; - bool produceOccupancy = false; - bool produceQns = false; - bool producedPositions = false; - bool producedMultiplicities = false; - bool producedCentralities = false; + CollisionSelection mCollisionSelection; + Zorro mZorro; + bool mUseTrigger = false; + std::string mTriggerNames = std::string(""); + bool mFillAnyTable = false; + bool mProducedCollisions = false; + bool mProducedCollisionMasks = false; + bool mProduceOccupancy = false; + bool mProduceQns = false; + bool mProducedPositions = false; + bool mProducedMultiplicities = false; + bool mProducedCentralities = false; }; }; // namespace collisionbuilder }; // namespace o2::analysis::femto diff --git a/PWGCF/Femto/Core/dataTypes.h b/PWGCF/Femto/Core/dataTypes.h index ade9456f068..2fa1273dbcc 100644 --- a/PWGCF/Femto/Core/dataTypes.h +++ b/PWGCF/Femto/Core/dataTypes.h @@ -24,6 +24,9 @@ namespace femtodatatypes { // Note: Length of the bitmask is the limit of how many selections can be configured +// datatypes for collsions +using CollsionsMaskType = uint64_t; + // datatypes for tracks using TrackMaskType = uint64_t; using TrackType = uint16_t; diff --git a/PWGCF/Femto/Core/modes.h b/PWGCF/Femto/Core/modes.h index 83a230672ff..dccd9ac8559 100644 --- a/PWGCF/Femto/Core/modes.h +++ b/PWGCF/Femto/Core/modes.h @@ -59,10 +59,8 @@ enum class System : uint32_t { kMC = BIT(2), kRun3 = BIT(3), kRun2 = BIT(4), - kNoCentCal = BIT(5), kPP_Run3 = kPP | kRun3, kPP_Run2 = kPP | kRun2, - kPP_NoCentCal_Run3 = kPP | kRun3 | kNoCentCal, kPbPb_Run3 = kPbPb | kRun3, kPbPb_Run2 = kPbPb | kRun2, }; diff --git a/PWGCF/Femto/Core/selectionContainer.h b/PWGCF/Femto/Core/selectionContainer.h index 8b050a4b700..420af6554d6 100644 --- a/PWGCF/Femto/Core/selectionContainer.h +++ b/PWGCF/Femto/Core/selectionContainer.h @@ -86,10 +86,6 @@ class SelectionContainer if (mSelectionValues.size() > sizeof(BitmaskType) * CHAR_BIT) { LOG(fatal) << "Too many selections for single a observable. Limit is " << sizeof(BitmaskType) * CHAR_BIT; } - // for kEqual we can never skip the last bit - if (limitType == limits::kEqual) { - mSkipMostPermissiveBit = false; - } // values for selection are not necessarily ordered correctly sortSelections(); } @@ -226,7 +222,7 @@ class SelectionContainer break; case (limits::kEqual): // special case for kEqual since here we cannot really establish an order so we need to check all cases explicitly and we cannot bail early - if (std::abs(value - mSelectionValues.at(i)) < constants::math::Epsilon) { + if (std::fabs(value - mSelectionValues.at(i)) < constants::math::Epsilon) { mBitmask.set(i); } break; @@ -246,7 +242,6 @@ class SelectionContainer std::bitset getBitmask() const { // if we do not skip the last bit, return full bitmask - // in the constructor we ensure that for kEqual we do not skip the most permissive bit if (mSkipMostPermissiveBit == false) { return mBitmask; } else { diff --git a/PWGCF/Femto/Core/trackBuilder.h b/PWGCF/Femto/Core/trackBuilder.h index ae3331226b1..9a784acee35 100644 --- a/PWGCF/Femto/Core/trackBuilder.h +++ b/PWGCF/Femto/Core/trackBuilder.h @@ -449,24 +449,24 @@ class TrackBuilder template void init(T1& config, T2& filter, T3& table, T4& initContext) { - trackSelection.configure(config, filter); + mTrackSelection.configure(config, filter); LOG(info) << "Initialize femto track builder..."; - produceTracks = utils::enableTable("FTracks_001", table.produceTracks.value, initContext); - produceTrackMasks = utils::enableTable("FTrackMasks_001", table.produceTrackMasks.value, initContext); - produceTrackDcas = utils::enableTable("FTrackDcas_001", table.produceTrackDcas.value, initContext); - produceTrackExtras = utils::enableTable("FTrackExtras_001", table.produceTrackExtras.value, initContext); - produceElectronPids = utils::enableTable("FElectronPids_001", table.produceElectronPids.value, initContext); - producePionPids = utils::enableTable("FPionPids_001", table.producePionPids.value, initContext); - produceKaonPids = utils::enableTable("FKaonPids_001", table.produceKaonPids.value, initContext); - produceProtonPids = utils::enableTable("FProtonPids_001", table.produceProtonPids.value, initContext); - produceDeuteronPids = utils::enableTable("FDeuteronPids_001", table.produceDeuteronPids.value, initContext); - produceTritonPids = utils::enableTable("FTritonPids_001", table.produceTritonPids.value, initContext); - produceHeliumPids = utils::enableTable("FHeliumPids_001", table.produceHeliumPids.value, initContext); - - if (produceTracks || produceTrackMasks || produceTrackDcas || produceTrackExtras || produceElectronPids || producePionPids || produceKaonPids || produceProtonPids || produceDeuteronPids || produceTritonPids || produceHeliumPids) { - fillAnyTable = true; - trackSelection.printSelections(trackSelsName, trackSelsToString); + mProduceTracks = utils::enableTable("FTracks_001", table.produceTracks.value, initContext); + mProduceTrackMasks = utils::enableTable("FTrackMasks_001", table.produceTrackMasks.value, initContext); + mProduceTrackDcas = utils::enableTable("FTrackDcas_001", table.produceTrackDcas.value, initContext); + mProduceTrackExtras = utils::enableTable("FTrackExtras_001", table.produceTrackExtras.value, initContext); + mProduceElectronPids = utils::enableTable("FElectronPids_001", table.produceElectronPids.value, initContext); + mProducePionPids = utils::enableTable("FPionPids_001", table.producePionPids.value, initContext); + mProduceKaonPids = utils::enableTable("FKaonPids_001", table.produceKaonPids.value, initContext); + mProduceProtonPids = utils::enableTable("FProtonPids_001", table.produceProtonPids.value, initContext); + mProduceDeuteronPids = utils::enableTable("FDeuteronPids_001", table.produceDeuteronPids.value, initContext); + mProduceTritonPids = utils::enableTable("FTritonPids_001", table.produceTritonPids.value, initContext); + mProduceHeliumPids = utils::enableTable("FHeliumPids_001", table.produceHeliumPids.value, initContext); + + if (mProduceTracks || mProduceTrackMasks || mProduceTrackDcas || mProduceTrackExtras || mProduceElectronPids || mProducePionPids || mProduceKaonPids || mProduceProtonPids || mProduceDeuteronPids || mProduceTritonPids || mProduceHeliumPids) { + mFillAnyTable = true; + mTrackSelection.printSelections(trackSelsName, trackSelsToString); } else { LOG(info) << "No tables configured"; } @@ -476,15 +476,15 @@ class TrackBuilder template void fillTracks(T1 const& tracks, T2& trackProducts, T3& collisionProducts, T4& indexMap) { - if (!fillAnyTable) { + if (!mFillAnyTable) { return; } for (const auto& track : tracks) { - if (!trackSelection.checkFilters(track) || !trackSelection.hasTofAboveThreshold(track)) { + if (!mTrackSelection.checkFilters(track) || !mTrackSelection.hasTofAboveThreshold(track)) { continue; } - trackSelection.applySelections(track); - if (!trackSelection.passesAllRequiredSelections()) { + mTrackSelection.applySelections(track); + if (!mTrackSelection.passesAllRequiredSelections()) { continue; } this->fillTrack(track, trackProducts, collisionProducts, indexMap); @@ -494,25 +494,25 @@ class TrackBuilder template void fillTrack(T1 const& track, T2& trackProducts, T3& collisionProducts, T4& indexMap) { - if (produceTracks) { + if (mProduceTracks) { trackProducts.producedTracks(collisionProducts.producedCollision.lastIndex(), track.pt() * track.sign(), track.eta(), track.phi()); } - if (produceTrackMasks) { + if (mProduceTrackMasks) { if constexpr (type == modes::Track::kPrimaryTrack) { - trackProducts.producedTrackMasks(trackSelection.getBitmask()); + trackProducts.producedTrackMasks(mTrackSelection.getBitmask()); } else { trackProducts.producedTrackMasks(static_cast(0u)); } } - if (produceTrackDcas) { + if (mProduceTrackDcas) { trackProducts.producedTrackDcas(track.dcaXY(), track.dcaZ()); } - if (produceTrackExtras) { + if (mProduceTrackExtras) { trackProducts.producedTrackExtras(track.isPVContributor(), track.itsNCls(), track.itsNClsInnerBarrel(), @@ -527,49 +527,49 @@ class TrackBuilder track.mass()); } - if (produceElectronPids) { + if (mProduceElectronPids) { if constexpr (type == modes::Track::kPrimaryTrack) { trackProducts.producedElectronPids(track.itsNSigmaEl(), track.tpcNSigmaEl(), track.tofNSigmaEl()); } else { trackProducts.producedElectronPids(0, track.tpcNSigmaEl(), track.tofNSigmaEl()); } } - if (producePionPids) { + if (mProducePionPids) { if constexpr (type == modes::Track::kPrimaryTrack) { trackProducts.producedPionPids(track.itsNSigmaPi(), track.tpcNSigmaPi(), track.tofNSigmaPi()); } else { trackProducts.producedPionPids(0, track.tpcNSigmaPi(), track.tofNSigmaPi()); } } - if (produceKaonPids) { + if (mProduceKaonPids) { if constexpr (type == modes::Track::kPrimaryTrack) { trackProducts.producedKaonPids(track.itsNSigmaKa(), track.tpcNSigmaKa(), track.tofNSigmaKa()); } else { trackProducts.producedKaonPids(0, track.tpcNSigmaKa(), track.tofNSigmaKa()); } } - if (produceProtonPids) { + if (mProduceProtonPids) { if constexpr (type == modes::Track::kPrimaryTrack) { trackProducts.producedProtonPids(track.itsNSigmaPr(), track.tpcNSigmaPr(), track.tofNSigmaPr()); } else { trackProducts.producedProtonPids(0, track.tpcNSigmaPr(), track.tofNSigmaPr()); } } - if (produceDeuteronPids) { + if (mProduceDeuteronPids) { if constexpr (type == modes::Track::kPrimaryTrack) { trackProducts.producedDeuteronPids(track.itsNSigmaDe(), track.tpcNSigmaDe(), track.tofNSigmaDe()); } else { trackProducts.producedDeuteronPids(0, track.tpcNSigmaDe(), track.tofNSigmaDe()); } } - if (produceTritonPids) { + if (mProduceTritonPids) { if constexpr (type == modes::Track::kPrimaryTrack) { trackProducts.producedTritonPids(track.itsNSigmaTr(), track.tpcNSigmaTr(), track.tofNSigmaTr()); } else { trackProducts.producedTritonPids(0, track.tpcNSigmaTr(), track.tofNSigmaTr()); } } - if (produceHeliumPids) { + if (mProduceHeliumPids) { if constexpr (type == modes::Track::kPrimaryTrack) { trackProducts.producedHeliumPids(track.itsNSigmaHe(), track.tpcNSigmaHe(), track.tofNSigmaHe()); } else { @@ -594,19 +594,19 @@ class TrackBuilder } private: - TrackSelection trackSelection; - bool fillAnyTable = false; - bool produceTracks = false; - bool produceTrackMasks = false; - bool produceTrackDcas = false; - bool produceTrackExtras = false; - bool produceElectronPids = false; - bool producePionPids = false; - bool produceKaonPids = false; - bool produceProtonPids = false; - bool produceDeuteronPids = false; - bool produceTritonPids = false; - bool produceHeliumPids = false; + TrackSelection mTrackSelection; + bool mFillAnyTable = false; + bool mProduceTracks = false; + bool mProduceTrackMasks = false; + bool mProduceTrackDcas = false; + bool mProduceTrackExtras = false; + bool mProduceElectronPids = false; + bool mProducePionPids = false; + bool mProduceKaonPids = false; + bool mProduceProtonPids = false; + bool mProduceDeuteronPids = false; + bool mProduceTritonPids = false; + bool mProduceHeliumPids = false; }; } // namespace trackbuilder diff --git a/PWGCF/Femto/Core/twoTrackResonanceBuilder.h b/PWGCF/Femto/Core/twoTrackResonanceBuilder.h index 9b44d628af6..c1f944ed51d 100644 --- a/PWGCF/Femto/Core/twoTrackResonanceBuilder.h +++ b/PWGCF/Femto/Core/twoTrackResonanceBuilder.h @@ -469,11 +469,11 @@ class TwoTrackResonanceBuilder template void init(T1& config, T2& filter, T3& daughterFilter, T4& table, T5 initContext) { - twoTrackResonanceSelection.configure(config, filter, daughterFilter); + mTwoTrackResonanceSelection.configure(config, filter, daughterFilter); if constexpr (modes::isEqual(resoType, modes::TwoTrackResonance::kPhi)) { LOG(info) << "Initialize femto Phi builder..."; - producePhis = utils::enableTable("FPhis_001", table.producePhis.value, initContext); - producePhiMasks = utils::enableTable("FPhiMasks_001", table.producePhiMasks.value, initContext); + mProducePhis = utils::enableTable("FPhis_001", table.producePhis.value, initContext); + mProducePhiMasks = utils::enableTable("FPhiMasks_001", table.producePhiMasks.value, initContext); } if constexpr (modes::isEqual(resoType, modes::TwoTrackResonance::kKstar0) || modes::isEqual(resoType, modes::TwoTrackResonance::kKstar0Bar)) { if constexpr (modes::isEqual(resoType, modes::TwoTrackResonance::kKstar0)) { @@ -482,18 +482,18 @@ class TwoTrackResonanceBuilder if constexpr (modes::isEqual(resoType, modes::TwoTrackResonance::kKstar0Bar)) { LOG(info) << "Initialize femto Kstar0Bar builder..."; } - produceKstar0s = utils::enableTable("FKstar0s_001", table.produceKstar0s.value, initContext); - produceKstar0Masks = utils::enableTable("FKstar0Masks_001", table.produceKstar0Masks.value, initContext); + mProduceKstar0s = utils::enableTable("FKstar0s_001", table.produceKstar0s.value, initContext); + mProduceKstar0Masks = utils::enableTable("FKstar0Masks_001", table.produceKstar0Masks.value, initContext); } if constexpr (modes::isEqual(resoType, modes::TwoTrackResonance::kRho0)) { LOG(info) << "Initialize femto Rho0 builder..."; - produceRho0s = utils::enableTable("FRho0s_001", table.produceRho0s.value, initContext); - produceRho0Masks = utils::enableTable("FRho0Masks_001", table.produceRho0Masks.value, initContext); + mProduceRho0s = utils::enableTable("FRho0s_001", table.produceRho0s.value, initContext); + mProduceRho0Masks = utils::enableTable("FRho0Masks_001", table.produceRho0Masks.value, initContext); } - if (producePhis || producePhiMasks || produceKstar0s || produceKstar0Masks || produceRho0s || produceRho0Masks) { - fillAnyTable = true; - twoTrackResonanceSelection.printSelections(twoTrackResonanceSelsName, twoTrackResonanceSelsToString); + if (mProducePhis || mProducePhiMasks || mProduceKstar0s || mProduceKstar0Masks || mProduceRho0s || mProduceRho0Masks) { + mFillAnyTable = true; + mTwoTrackResonanceSelection.printSelections(twoTrackResonanceSelsName, twoTrackResonanceSelsToString); } else { LOG(info) << "No tables configured"; } @@ -503,7 +503,7 @@ class TwoTrackResonanceBuilder template void fillResonances(T1& collisionProducts, T2& trackProducts, T3& resonanceProducts, T4& groupPositiveTracks, T5& groupNegativeTracks, T6& trackBuilder, T7& indexMap) { - if (!fillAnyTable) { + if (!mFillAnyTable) { return; } for (auto const& positiveTrack : groupPositiveTracks) { @@ -517,12 +517,12 @@ class TwoTrackResonanceBuilder void fillResonance(T1& collisionProducts, T2& trackProducts, T3& resonanceProducts, T4 const& posDaughter, T4 const& negDaughter, T5& trackBuilder, T6& indexMap) { - twoTrackResonanceSelection.applySelections(posDaughter, negDaughter); // for resonances selection are only applied to daughter tracks - if (!twoTrackResonanceSelection.hasTofAboveThreshold(posDaughter, negDaughter) || !twoTrackResonanceSelection.passesAllRequiredSelections()) { + mTwoTrackResonanceSelection.applySelections(posDaughter, negDaughter); // for resonances selection are only applied to daughter tracks + if (!mTwoTrackResonanceSelection.hasTofAboveThreshold(posDaughter, negDaughter) || !mTwoTrackResonanceSelection.passesAllRequiredSelections()) { return; } - twoTrackResonanceSelection.reconstructResonance(posDaughter, negDaughter); - if (!twoTrackResonanceSelection.checkFilters() || !twoTrackResonanceSelection.checkHypothesis()) { + mTwoTrackResonanceSelection.reconstructResonance(posDaughter, negDaughter); + if (!mTwoTrackResonanceSelection.checkFilters() || !mTwoTrackResonanceSelection.checkHypothesis()) { return; } int64_t posDaughterIndex = 0; @@ -531,76 +531,76 @@ class TwoTrackResonanceBuilder negDaughterIndex = trackBuilder.template getDaughterIndex(negDaughter, trackProducts, collisionProducts, indexMap); if constexpr (modes::isEqual(resoType, modes::TwoTrackResonance::kRho0)) { - if (produceRho0s) { + if (mProduceRho0s) { resonanceProducts.producedRhos( collisionProducts.producedCollision.lastIndex(), - twoTrackResonanceSelection.getPt(), - twoTrackResonanceSelection.getEta(), - twoTrackResonanceSelection.getPhi(), - twoTrackResonanceSelection.getMass(), + mTwoTrackResonanceSelection.getPt(), + mTwoTrackResonanceSelection.getEta(), + mTwoTrackResonanceSelection.getPhi(), + mTwoTrackResonanceSelection.getMass(), posDaughterIndex, negDaughterIndex); } - if (produceRho0Masks) { - resonanceProducts.producedRhoMasks(twoTrackResonanceSelection.getBitmask()); + if (mProduceRho0Masks) { + resonanceProducts.producedRhoMasks(mTwoTrackResonanceSelection.getBitmask()); } } if constexpr (modes::isEqual(resoType, modes::TwoTrackResonance::kPhi)) { - if (producePhis) { + if (mProducePhis) { resonanceProducts.producedPhis( collisionProducts.producedCollision.lastIndex(), - twoTrackResonanceSelection.getPt(), - twoTrackResonanceSelection.getEta(), - twoTrackResonanceSelection.getPhi(), - twoTrackResonanceSelection.getMass(), + mTwoTrackResonanceSelection.getPt(), + mTwoTrackResonanceSelection.getEta(), + mTwoTrackResonanceSelection.getPhi(), + mTwoTrackResonanceSelection.getMass(), posDaughterIndex, negDaughterIndex); } - if (producePhiMasks) { - resonanceProducts.producedPhiMasks(twoTrackResonanceSelection.getBitmask()); + if (mProducePhiMasks) { + resonanceProducts.producedPhiMasks(mTwoTrackResonanceSelection.getBitmask()); } } if constexpr (modes::isEqual(resoType, modes::TwoTrackResonance::kKstar0)) { - if (produceKstar0s) { + if (mProduceKstar0s) { resonanceProducts.producedKstars( collisionProducts.producedCollision.lastIndex(), - twoTrackResonanceSelection.getPt(), - twoTrackResonanceSelection.getEta(), - twoTrackResonanceSelection.getPhi(), - twoTrackResonanceSelection.getMass(), + mTwoTrackResonanceSelection.getPt(), + mTwoTrackResonanceSelection.getEta(), + mTwoTrackResonanceSelection.getPhi(), + mTwoTrackResonanceSelection.getMass(), posDaughterIndex, negDaughterIndex); } - if (produceKstar0Masks) { - resonanceProducts.producedKstarMasks(twoTrackResonanceSelection.getBitmask()); + if (mProduceKstar0Masks) { + resonanceProducts.producedKstarMasks(mTwoTrackResonanceSelection.getBitmask()); } } if constexpr (modes::isEqual(resoType, modes::TwoTrackResonance::kKstar0Bar)) { - if (produceKstar0s) { + if (mProduceKstar0s) { resonanceProducts.producedKstars( collisionProducts.producedCollision.lastIndex(), - -1.f * twoTrackResonanceSelection.getPt(), - twoTrackResonanceSelection.getEta(), - twoTrackResonanceSelection.getPhi(), - twoTrackResonanceSelection.getMass(), + -1.f * mTwoTrackResonanceSelection.getPt(), + mTwoTrackResonanceSelection.getEta(), + mTwoTrackResonanceSelection.getPhi(), + mTwoTrackResonanceSelection.getMass(), posDaughterIndex, negDaughterIndex); } - if (produceKstar0Masks) { - resonanceProducts.producedKstarMasks(twoTrackResonanceSelection.getBitmask()); + if (mProduceKstar0Masks) { + resonanceProducts.producedKstarMasks(mTwoTrackResonanceSelection.getBitmask()); } } } private: - TwoTrackResonanceSelection twoTrackResonanceSelection; - bool fillAnyTable = false; - bool producePhis = false; - bool producePhiMasks = false; - bool produceKstar0s = false; - bool produceKstar0Masks = false; - bool produceRho0s = false; - bool produceRho0Masks = false; + TwoTrackResonanceSelection mTwoTrackResonanceSelection; + bool mFillAnyTable = false; + bool mProducePhis = false; + bool mProducePhiMasks = false; + bool mProduceKstar0s = false; + bool mProduceKstar0Masks = false; + bool mProduceRho0s = false; + bool mProduceRho0Masks = false; }; // namespace twotrackresonancebuilder } // namespace twotrackresonancebuilder diff --git a/PWGCF/Femto/Core/v0Builder.h b/PWGCF/Femto/Core/v0Builder.h index 300a996c05e..8f1faf319a2 100644 --- a/PWGCF/Femto/Core/v0Builder.h +++ b/PWGCF/Femto/Core/v0Builder.h @@ -332,7 +332,7 @@ class V0Builder template void init(T1& config, T2& filter, T3& table, T4& initContext) { - v0Selection.configure(config, filter); + mV0Selection.configure(config, filter); if constexpr (modes::isEqual(v0Type, modes::V0::kLambda) || modes::isEqual(v0Type, modes::V0::kAntiLambda)) { if constexpr (modes::isEqual(v0Type, modes::V0::kLambda)) { LOG(info) << "Initialize femto Lambda builder..."; @@ -340,19 +340,19 @@ class V0Builder if constexpr (modes::isEqual(v0Type, modes::V0::kAntiLambda)) { LOG(info) << "Initialize femto AntiLambda builder..."; } - produceLambdas = utils::enableTable("FLambdas_001", table.produceLambdas.value, initContext); - produceLambdaMasks = utils::enableTable("FLambdaMasks_001", table.produceLambdaMasks.value, initContext); - produceLambdaExtras = utils::enableTable("FLambdaExtras_001", table.produceLambdaExtras.value, initContext); + mProduceLambdas = utils::enableTable("FLambdas_001", table.produceLambdas.value, initContext); + mProduceLambdaMasks = utils::enableTable("FLambdaMasks_001", table.produceLambdaMasks.value, initContext); + mProduceLambdaExtras = utils::enableTable("FLambdaExtras_001", table.produceLambdaExtras.value, initContext); } if constexpr (modes::isEqual(v0Type, modes::V0::kK0short)) { LOG(info) << "Initialize femto K0short builder..."; - produceK0shorts = utils::enableTable("FK0shorts_001", table.produceK0shorts.value, initContext); - produceK0shortMasks = utils::enableTable("FK0shortMasks_001", table.produceK0shortMasks.value, initContext); - produceK0shortExtras = utils::enableTable("FK0shortExtras_001", table.produceK0shortExtras.value, initContext); + mProduceK0shorts = utils::enableTable("FK0shorts_001", table.produceK0shorts.value, initContext); + mProduceK0shortMasks = utils::enableTable("FK0shortMasks_001", table.produceK0shortMasks.value, initContext); + mProduceK0shortExtras = utils::enableTable("FK0shortExtras_001", table.produceK0shortExtras.value, initContext); } - if (produceLambdas || produceLambdaMasks || produceLambdaExtras || produceK0shorts || produceK0shortMasks || produceK0shortExtras) { + if (mProduceLambdas || mProduceLambdaMasks || mProduceLambdaExtras || mProduceK0shorts || mProduceK0shortMasks || mProduceK0shortExtras) { mFillAnyTable = true; - v0Selection.printSelections(v0SelsName, v0SelsToStrings); + mV0Selection.printSelections(v0SelsName, v0SelsToStrings); } else { LOG(info) << "No tables configured"; } @@ -368,11 +368,11 @@ class V0Builder int64_t posDaughterIndex = 0; int64_t negDaughterIndex = 0; for (const auto& v0 : v0s) { - if (!v0Selection.checkFilters(v0)) { + if (!mV0Selection.checkFilters(v0)) { continue; } - v0Selection.applySelections(v0, tracks); - if (v0Selection.passesAllRequiredSelections() && v0Selection.checkHypothesis(v0)) { + mV0Selection.applySelections(v0, tracks); + if (mV0Selection.passesAllRequiredSelections() && mV0Selection.checkHypothesis(v0)) { auto posDaughter = v0.template posTrack_as(); auto negDaughter = v0.template negTrack_as(); posDaughterIndex = trackBuilder.template getDaughterIndex(posDaughter, trackProducts, collisionProducts, indexMap); @@ -401,7 +401,7 @@ class V0Builder mass = v0.mAntiLambda(); massAnti = v0.mLambda(); } - if (produceLambdas) { + if (mProduceLambdas) { v0products.producedLambdas(collisionProducts.producedCollision.lastIndex(), sign * v0.pt(), v0.eta(), @@ -410,10 +410,10 @@ class V0Builder posDaughterIndex, negDaughterIndex); } - if (produceLambdaMasks) { - v0products.producedLambdaMasks(v0Selection.getBitmask()); + if (mProduceLambdaMasks) { + v0products.producedLambdaMasks(mV0Selection.getBitmask()); } - if (produceLambdaExtras) { + if (mProduceLambdaExtras) { v0products.producedLambdaExtras( massAnti, v0.mK0Short(), @@ -429,7 +429,7 @@ class V0Builder template void fillK0short(T1& collisionProducts, T2& v0products, T3 const& v0, int posDaughterIndex, int negDaughterIndex) { - if (produceK0shorts) { + if (mProduceK0shorts) { v0products.producedK0shorts(collisionProducts.producedCollision.lastIndex(), v0.pt(), v0.eta(), @@ -438,10 +438,10 @@ class V0Builder posDaughterIndex, negDaughterIndex); } - if (produceK0shortMasks) { - v0products.producedK0shortMasks(v0Selection.getBitmask()); + if (mProduceK0shortMasks) { + v0products.producedK0shortMasks(mV0Selection.getBitmask()); } - if (produceK0shortExtras) { + if (mProduceK0shortExtras) { v0products.producedK0shortExtras( v0.mLambda(), v0.mAntiLambda(), @@ -457,14 +457,14 @@ class V0Builder bool fillAnyTable() { return mFillAnyTable; } private: - V0Selection v0Selection; + V0Selection mV0Selection; bool mFillAnyTable = false; - bool produceLambdas = false; - bool produceLambdaMasks = false; - bool produceLambdaExtras = false; - bool produceK0shorts = false; - bool produceK0shortMasks = false; - bool produceK0shortExtras = false; + bool mProduceLambdas = false; + bool mProduceLambdaMasks = false; + bool mProduceLambdaExtras = false; + bool mProduceK0shorts = false; + bool mProduceK0shortMasks = false; + bool mProduceK0shortExtras = false; }; } // namespace v0builder } // namespace o2::analysis::femto diff --git a/PWGCF/Femto/DataModel/FemtoTables.h b/PWGCF/Femto/DataModel/FemtoTables.h index e96708d657d..1708ba66ba7 100644 --- a/PWGCF/Femto/DataModel/FemtoTables.h +++ b/PWGCF/Femto/DataModel/FemtoTables.h @@ -34,6 +34,8 @@ namespace o2::aod namespace femtocollisions { +DECLARE_SOA_COLUMN(CollisionMask, collisionMask, femtodatatypes::CollsionsMaskType); //! Bitmask for collision selections + DECLARE_SOA_COLUMN(PosX, posX, float); //! x coordinate of vertex DECLARE_SOA_COLUMN(PosY, posY, float); //! y coordinate of vertex DECLARE_SOA_COLUMN(PosZ, posZ, float); //! z coordinate of vertex @@ -55,6 +57,11 @@ DECLARE_SOA_TABLE_STAGED_VERSIONED(FCols_001, "FCOL", 1, //! femto collisions femtocollisions::MagField); using FCols = FCols_001; +// table for collisions selections +DECLARE_SOA_TABLE_STAGED_VERSIONED(FColMasks_001, "FCOLMASK", 1, //! track masks + femtocollisions::CollisionMask); +using FColMasks = FColMasks_001; + // table for occupancy DECLARE_SOA_TABLE_STAGED_VERSIONED(FColOccs_001, "FCOLOCC", 1, //! occupancy femtocollisions::Occupancy); diff --git a/PWGCF/Femto/TableProducer/CMakeLists.txt b/PWGCF/Femto/TableProducer/CMakeLists.txt index e5808562f51..81829ec83a1 100644 --- a/PWGCF/Femto/TableProducer/CMakeLists.txt +++ b/PWGCF/Femto/TableProducer/CMakeLists.txt @@ -11,5 +11,5 @@ o2physics_add_dpl_workflow(femto-producer SOURCES femtoProducer.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) diff --git a/PWGCF/Femto/TableProducer/femtoProducer.cxx b/PWGCF/Femto/TableProducer/femtoProducer.cxx index 0f69056e11d..205ca34a986 100644 --- a/PWGCF/Femto/TableProducer/femtoProducer.cxx +++ b/PWGCF/Femto/TableProducer/femtoProducer.cxx @@ -85,8 +85,9 @@ struct FemtoProducer { // collision builder collisionbuilder::CollisionBuilderProducts collisionBuilderProducts; collisionbuilder::ConfCollisionTables confCollisionTables; - collisionbuilder::ConfCollisionFilter confCollisionFilter; - collisionbuilder::ConfCollisionFlags confCollisionFlags; + collisionbuilder::ConfCollisionFilters confCollisionFilters; + collisionbuilder::ConfCollisionBits confCollisionBits; + collisionbuilder::ConfCollisionTriggers confCollisionTriggers; collisionbuilder::CollisionBuilder collisionBuilder; // track builder @@ -180,7 +181,7 @@ struct FemtoProducer { ccdb->setCreatedNotAfter(now); // collision selection - collisionBuilder.init(confCollisionFilter, confCollisionFlags, confCollisionTables, context); + collisionBuilder.init(confCollisionFilters, confCollisionBits, confCollisionTables, confCollisionTriggers, context); // configure track builder trackBuilder.init(confTrackBits, confTrackFilters, confTrackTables, context); @@ -212,9 +213,10 @@ struct FemtoProducer { template void processTracks(T1 const& col, T2 const& /* bcs*/, T3 const& tracks, T4 const& tracksWithItsPid) { - initFromCcdb(col.template bc_as()); - collisionBuilder.buildCollision(col, tracks, magField); - if (!collisionBuilder.checkCuts(col)) { + auto bc = col.template bc_as(); + initFromCcdb(bc); + collisionBuilder.buildCollision(bc, col, tracks, ccdb, magField); + if (!collisionBuilder.checkCollision(bc, col)) { return; } collisionBuilder.fillCollision(collisionBuilderProducts, col); diff --git a/PWGCF/Femto/Tasks/femtoCascadeQa.cxx b/PWGCF/Femto/Tasks/femtoCascadeQa.cxx index b447d31633b..1de5aef92ec 100644 --- a/PWGCF/Femto/Tasks/femtoCascadeQa.cxx +++ b/PWGCF/Femto/Tasks/femtoCascadeQa.cxx @@ -61,7 +61,7 @@ struct FemtoCascadeQa { // setup collisions colhistmanager::CollisionHistManager colHistManager; colhistmanager::ConfCollisionBinning confCollisionBinning; - collisionbuilder::ConfCollisionFilter collisionSelection; + collisionbuilder::ConfCollisionFilters collisionSelection; Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); // setup for xis diff --git a/PWGCF/Femto/Tasks/femtoTrackQa.cxx b/PWGCF/Femto/Tasks/femtoTrackQa.cxx index 4963b54f9dc..a111111f6b0 100644 --- a/PWGCF/Femto/Tasks/femtoTrackQa.cxx +++ b/PWGCF/Femto/Tasks/femtoTrackQa.cxx @@ -54,7 +54,7 @@ struct FemtoTrackQa { SliceCache cache; // setup collisions - collisionbuilder::ConfCollisionFilter collisionSelection; + collisionbuilder::ConfCollisionFilters collisionSelection; Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); colhistmanager::ConfCollisionBinning confCollisionBinning; colhistmanager::CollisionHistManager colHistManager; diff --git a/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx b/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx index 3ea287908d5..83b28842469 100644 --- a/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx +++ b/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx @@ -60,7 +60,7 @@ struct FemtoTwotrackresonanceQa { // setup for collisions colhistmanager::CollisionHistManager colHistManager; colhistmanager::ConfCollisionBinning confCollisionBinning; - collisionbuilder::ConfCollisionFilter collisionSelection; + collisionbuilder::ConfCollisionFilters collisionSelection; Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); // setup for phis diff --git a/PWGCF/Femto/Tasks/femtoV0Qa.cxx b/PWGCF/Femto/Tasks/femtoV0Qa.cxx index c7ae9a8d786..1b75bcd24ea 100644 --- a/PWGCF/Femto/Tasks/femtoV0Qa.cxx +++ b/PWGCF/Femto/Tasks/femtoV0Qa.cxx @@ -46,7 +46,7 @@ using namespace o2::analysis::femto; struct FemtoV0Qa { // setup for collisions - collisionbuilder::ConfCollisionFilter collisionSelection; + collisionbuilder::ConfCollisionFilters collisionSelection; Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); colhistmanager::CollisionHistManager colHistManager; From 33a836d0b8e389cff5095d57bed4169774fb6a9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Tue, 16 Sep 2025 16:50:08 +0200 Subject: [PATCH 417/986] [Common] Add unique label making utility to metadata (#12938) --- Common/Core/MetadataHelper.cxx | 16 +++++ Common/Core/MetadataHelper.h | 9 ++- Common/Core/macros/testMetadataHelper.C | 84 +++++++++++++++++++++++++ 3 files changed, 106 insertions(+), 3 deletions(-) create mode 100644 Common/Core/macros/testMetadataHelper.C diff --git a/Common/Core/MetadataHelper.cxx b/Common/Core/MetadataHelper.cxx index 79aa051a64f..b025c5df7a1 100644 --- a/Common/Core/MetadataHelper.cxx +++ b/Common/Core/MetadataHelper.cxx @@ -124,3 +124,19 @@ bool MetadataHelper::isInitialized() const } return mIsInitialized; } + +std::string MetadataHelper::makeMetadataLabel() const +{ + if (!mIsInitialized) { + LOG(fatal) << "Metadata not initialized"; + } + std::string label = get("DataType"); + label += "_" + get("LPMProductionTag"); + if (isMC()) { + label += "_" + get("AnchorPassName"); + label += "_" + get("AnchorProduction"); + } else { + label += "_" + get("RecoPassName"); + } + return label; +} diff --git a/Common/Core/MetadataHelper.h b/Common/Core/MetadataHelper.h index bab7b1f7eb0..3854820bd84 100644 --- a/Common/Core/MetadataHelper.h +++ b/Common/Core/MetadataHelper.h @@ -8,10 +8,10 @@ // 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 TableHelper.h + +/// \file MetadataHelper.h +/// \brief Utility to handle the metadata from the AOD /// \author Nicolò Jacazio nicolo.jacazio@cern.ch -/// \brief Utility to handle the metadata from the AOD -/// #ifndef COMMON_CORE_METADATAHELPER_H_ #define COMMON_CORE_METADATAHELPER_H_ @@ -61,6 +61,9 @@ struct MetadataHelper { /// @return true if the key is defined, false otherwise. Throws an exception if the key is not found bool isKeyDefined(const std::string& key) const; + /// @brief Function to create a label with the metadata information, useful e.g. for histogram naming + std::string makeMetadataLabel() const; + private: std::map mMetadata; /// < The metadata map bool mIsInitialized = false; /// < Flag to check if the metadata has been initialized diff --git a/Common/Core/macros/testMetadataHelper.C b/Common/Core/macros/testMetadataHelper.C new file mode 100644 index 00000000000..30c109f7840 --- /dev/null +++ b/Common/Core/macros/testMetadataHelper.C @@ -0,0 +1,84 @@ +// 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 testMetadataHelper.C +/// \author Nicolò Jacazio nicolo.jacazio@cern.ch +/// \brief Test the MetadataHelper functionality + +#include "Common/Core/MetadataHelper.h" + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +// Taken from O2/Framework/AnalysisSupport/src/Plugin.cxx +auto readMetadata(std::unique_ptr& currentFile) -> std::vector +{ + // Get the metadata, if any + auto m = (TMap*)currentFile->Get("metaData"); + if (!m) { + return {}; + } + std::vector results; + auto it = m->MakeIterator(); + + // Serialise metadata into a ; separated string with : separating key and value + bool first = true; + while (auto obj = it->Next()) { + if (first) { + LOGP(info, "Metadata for file \"{}\":", currentFile->GetName()); + first = false; + } + auto objString = (TObjString*)m->GetValue(obj); + std::string key = "aod-metadata-" + std::string(obj->GetName()); + LOGP(info, "- {}: {} goes into key {}", obj->GetName(), objString->String().Data(), key); + char const* value = strdup(objString->String()); + results.push_back(o2::framework::ConfigParamSpec{key, o2::framework::VariantType::String, value, {"Metadata in AOD"}}); + } + return results; +} + +void testMetadataHelper(std::string aod = "/tmp/AO2D.root") +{ + + TFile* file = TFile::Open(aod.c_str()); + if (!file || file->IsZombie()) { + LOG(fatal) << "Could not open file " << aod; + } + std::unique_ptr currentFile{file}; + std::vector specs = readMetadata(currentFile); + + std::vector> retrievers; + auto paramStore = std::make_unique(specs, std::move(retrievers)); + paramStore->preload(); + paramStore->activate(); + o2::framework::ConfigParamRegistry paramRegistry(std::move(paramStore)); + o2::framework::ServiceRegistry serviceRegistry; + o2::framework::ServiceRegistryRef services(serviceRegistry); + o2::framework::ConfigContext aodCfg(paramRegistry, services, 0, nullptr); + LOG(info) << "Loaded " << aodCfg.options().specs().size() << " configuration entries from file " << aod; + aodCfg.options().get("aod-metadata-DataType"); + o2::common::core::MetadataHelper metadataInfo; + metadataInfo.initMetadata(aodCfg); + metadataInfo.print(); + LOG(info) << "Metadata label: " << metadataInfo.makeMetadataLabel(); +} From b979cda7b3fff1d975ffae5f5a2393ba94e3793a Mon Sep 17 00:00:00 2001 From: shreyasiacharya <34233706+shreyasiacharya@users.noreply.github.com> Date: Tue, 16 Sep 2025 18:23:17 +0200 Subject: [PATCH 418/986] [PWGDQ] Adding FT0 and multiplicity in one table (#12995) --- PWGDQ/Tasks/tableReader_withAssoc.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index 28c98566251..df9ceb3d9e5 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -150,6 +150,9 @@ DECLARE_SOA_COLUMN(LxyeePoleMass, lxyJPsi2eePoleMass, float); DECLARE_SOA_COLUMN(Lzee, lzJPsi2ee, float); DECLARE_SOA_COLUMN(AmbiguousInBunchPairs, AmbiguousJpsiPairsInBunch, bool); DECLARE_SOA_COLUMN(AmbiguousOutOfBunchPairs, AmbiguousJpsiPairsOutOfBunch, bool); +DECLARE_SOA_COLUMN(MultiplicityFT0A, multiplicityFT0AJPsi2ee, float); +DECLARE_SOA_COLUMN(MultiplicityFT0C, multiplicityFT0CJPsi2ee, float); +DECLARE_SOA_COLUMN(MultiplicityNContrib, multiplicityNContribJPsi2ee, float); // Candidate columns for JPsi/muon correlations DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); @@ -182,7 +185,7 @@ DECLARE_SOA_TABLE(BmesonCandidates, "AOD", "DQBMESONSA", DECLARE_SOA_TABLE(JPsiMuonCandidates, "AOD", "DQJPSIMUONA", dqanalysisflags::DeltaEta, dqanalysisflags::DeltaPhi, dqanalysisflags::MassDileptonCandidate, dqanalysisflags::Ptpair, dqanalysisflags::Etapair, dqanalysisflags::Ptassoc, dqanalysisflags::Etaassoc); -DECLARE_SOA_TABLE(JPsieeCandidates, "AOD", "DQPSEUDOPROPER", dqanalysisflags::Massee, dqanalysisflags::Ptee, dqanalysisflags::Lxyee, dqanalysisflags::LxyeePoleMass, dqanalysisflags::Lzee, dqanalysisflags::AmbiguousInBunchPairs, dqanalysisflags::AmbiguousOutOfBunchPairs); +DECLARE_SOA_TABLE(JPsieeCandidates, "AOD", "DQPSEUDOPROPER", dqanalysisflags::Massee, dqanalysisflags::Ptee, dqanalysisflags::Lxyee, dqanalysisflags::LxyeePoleMass, dqanalysisflags::Lzee, dqanalysisflags::AmbiguousInBunchPairs, dqanalysisflags::AmbiguousOutOfBunchPairs, dqanalysisflags::MultiplicityFT0A, dqanalysisflags::MultiplicityFT0C, dqanalysisflags::MultiplicityNContrib); } // namespace o2::aod // Declarations of various short names @@ -1978,7 +1981,7 @@ struct AnalysisSameEventPairing { } } if (sign1 * sign2 < 0) { - PromptNonPromptSepTable(VarManager::fgValues[VarManager::kMass], VarManager::fgValues[VarManager::kPt], VarManager::fgValues[VarManager::kVertexingTauxyProjected], VarManager::fgValues[VarManager::kVertexingTauxyProjectedPoleJPsiMass], VarManager::fgValues[VarManager::kVertexingTauzProjected], isAmbiInBunch, isAmbiOutOfBunch); + PromptNonPromptSepTable(VarManager::fgValues[VarManager::kMass], VarManager::fgValues[VarManager::kPt], VarManager::fgValues[VarManager::kVertexingTauxyProjected], VarManager::fgValues[VarManager::kVertexingTauxyProjectedPoleJPsiMass], VarManager::fgValues[VarManager::kVertexingTauzProjected], isAmbiInBunch, isAmbiOutOfBunch, VarManager::fgValues[VarManager::kMultFT0A], VarManager::fgValues[VarManager::kMultFT0C], VarManager::fgValues[VarManager::kVtxNcontrib]); if constexpr (TPairType == VarManager::kDecayToMuMu) { fHistMan->FillHistClass(histNames[icut][0].Data(), VarManager::fgValues); if (isAmbiInBunch) { From 7ba8538ca8cf9127b44561b188b5b6c34bd8359c Mon Sep 17 00:00:00 2001 From: nkaratze Date: Tue, 16 Sep 2025 22:49:07 +0200 Subject: [PATCH 419/986] [PWGLF] Added switches and debugging (#12999) Co-authored-by: nkaratze --- PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx | 251 +++++++++---------- 1 file changed, 121 insertions(+), 130 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx b/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx index 367b4e2f9b3..c5494975dd2 100644 --- a/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx +++ b/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx @@ -95,6 +95,7 @@ struct V0PtInvMassPlots { Configurable doitsMinHits{"doitsMinHits", true, "Enable ITS Minimum hits"}; // Configurables switches for K0sh selection + Configurable dotruthk0sh{"dotruthk0sh", true, "Enable K0sh MC Matching"}; Configurable doK0shTPCPID{"doK0shTPCPID", true, "Enable K0sh TPC PID"}; Configurable doK0shcomptmasscut{"doK0shcomptmasscut", true, "Enable K0sh Competitive V0 Mass Cut"}; Configurable doK0shMaxct{"doK0shMaxct", true, "Enable K0sh Max ct Cut"}; @@ -106,6 +107,7 @@ struct V0PtInvMassPlots { Configurable doK0shdcanegdautopv{"doK0shdcanegdautopv", true, "Enable K0sh DCA neg daughter to PV Topological Cut"}; // Configurables switches for Lambda selection + Configurable dotruthLambda{"dotruthLambda", true, "Enable Lambda MC Matching"}; Configurable doLambdaTPCPID{"doLambdaTPCPID", true, "Enable Lambda TPC PID"}; Configurable doLambdacomptmasscut{"doLambdacomptmasscut", true, "Enable Lambda Competitive V0 Mass Cut"}; Configurable doLambdaMaxct{"doLambdaMaxct", true, "Enable Lambda Max ct Cut"}; @@ -117,6 +119,7 @@ struct V0PtInvMassPlots { Configurable doLambdadcanegdautopv{"doLambdadcanegdautopv", true, "Enable Lambda DCA neg daughter to PV Topological Cut"}; // Configurables switches for Lambda selection + Configurable dotruthAntilambda{"dotruthAntilambda", true, "Enable Antilambda MC Matching"}; Configurable doAntilambdaTPCPID{"doAntilambdaTPCPID", true, "Enable Antilambda TPC PID"}; Configurable doAntilambdacomptmasscut{"doAntilambdacomptmasscut", true, "Enable Antilambda Competitive V0 Mass Cut"}; Configurable doAntilambdaMaxct{"doAntilambdaMaxct", true, "Enable Antilambda Max ct Cut"}; @@ -231,7 +234,7 @@ struct V0PtInvMassPlots { rPtAnalysis.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexZAxis}}); rPtAnalysis.add("hArmenterosPodolanskiPlot", "hArmenterosPodolanskiPlot", {HistType::kTH2F, {{armenterosasymAxis}, {armenterosQtAxis}}}); rPtAnalysis.add("hV0EtaDaughters", "hV0EtaDaughters", {HistType::kTH1F, {{nBins, -1.2f, 1.2f}}}); - rPtAnalysis.add("V0Rapidity", "V0Rapidity", {HistType::kTH1F, {{nBins, -10.0f, 10.0f}}}); + rPtAnalysis.add("V0Rapidity", "V0Rapidity", {HistType::kTH1F, {{nBins, -1.0f, 1.0f}}}); // Adding Kzerosh Histograms to registry if (kzeroAnalysis == true) { @@ -338,22 +341,22 @@ struct V0PtInvMassPlots { } rPtAnalysis.fill(HIST("hNEvents"), 1.5); rPtAnalysis.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(2, "sel 8"); - if (doNoTimeFrameBorder && collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + if (doNoTimeFrameBorder && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { return false; } rPtAnalysis.fill(HIST("hNEvents"), 2.5); rPtAnalysis.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(3, "NoTimeFrameBorder"); - if (doNoITSROFrameBorder && collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + if (doNoITSROFrameBorder && !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { return false; } rPtAnalysis.fill(HIST("hNEvents"), 3.5); rPtAnalysis.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(4, "NoITSROFrameBorder"); - if (doIsTriggerTVX && collision.selection_bit(aod::evsel::kIsTriggerTVX)) { + if (doIsTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { return false; } rPtAnalysis.fill(HIST("hNEvents"), 4.5); rPtAnalysis.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(5, "IsTriggerTVX"); - if (docutZVertex && std::abs(collision.posZ()) < cutZVertex) { + if (docutZVertex && !(std::abs(collision.posZ()) < cutZVertex)) { return false; } rPtAnalysis.fill(HIST("hNEvents"), 5.5); @@ -363,25 +366,24 @@ struct V0PtInvMassPlots { } rPtAnalysis.fill(HIST("hNEvents"), 6.5); rPtAnalysis.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(7, "IsVertexTOFmatched"); - if (doNoSameBunchPileup && collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { + if (doNoSameBunchPileup && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { return false; } rPtAnalysis.fill(HIST("hNEvents"), 7.5); rPtAnalysis.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(8, "NoSameBunchPileup"); - if (doIsVertexITSTPC && collision.selection_bit(aod::evsel::kIsVertexITSTPC)) { + if (doIsVertexITSTPC && !collision.selection_bit(aod::evsel::kIsVertexITSTPC)) { return false; } rPtAnalysis.fill(HIST("hNEvents"), 8.5); rPtAnalysis.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(9, "IsVertexITSTPC"); - if (doisInelGt0 && collision.isInelGt0()) { + if (doisInelGt0 && !collision.isInelGt0()) { return false; } rPtAnalysis.fill(HIST("hNEvents"), 9.5); rPtAnalysis.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(10, "isInelGt0"); - return true; - // Cut Plots rPtAnalysis.fill(HIST("hVertexZRec"), collision.posZ()); + return true; } // V0 selection function @@ -393,7 +395,7 @@ struct V0PtInvMassPlots { rPtAnalysis.fill(HIST("hNV0s"), 0.5); rPtAnalysis.get(HIST("hNV0s"))->GetXaxis()->SetBinLabel(1, "All V0s"); - if (doDaughterPseudorapidityCut && (std::abs(posDaughterTrack.eta()) > etadau && std::abs(negDaughterTrack.eta()) > etadau)) { // Daughters Pseudorapidity Cut + if (doDaughterPseudorapidityCut && !(std::abs(posDaughterTrack.eta()) < etadau && std::abs(negDaughterTrack.eta()) < etadau)) { // Daughters Pseudorapidity Cut return false; } rPtAnalysis.fill(HIST("hNV0s"), 1.5); @@ -403,15 +405,15 @@ struct V0PtInvMassPlots { } rPtAnalysis.fill(HIST("hNV0s"), 2.5); rPtAnalysis.get(HIST("hNV0s"))->GetXaxis()->SetBinLabel(3, "ITS Afterburner"); - if (doitsMinHits && posDaughterTrack.itsNCls() <= itsMinHits && negDaughterTrack.itsNCls() <= itsMinHits) { // Minimum hits in the ITS + if (doitsMinHits && !(posDaughterTrack.itsNCls() >= itsMinHits && negDaughterTrack.itsNCls() >= itsMinHits)) { // Minimum hits in the ITS return false; - rPtAnalysis.fill(HIST("hNV0s"), 3.5); - rPtAnalysis.get(HIST("hNV0s"))->GetXaxis()->SetBinLabel(4, "ITS Min Hits"); - // Cut Plots - rPtAnalysis.fill(HIST("hV0EtaDaughters"), v0.template posTrack_as().eta()); - rPtAnalysis.fill(HIST("hV0EtaDaughters"), v0.template negTrack_as().eta()); - rPtAnalysis.fill(HIST("hArmenterosPodolanskiPlot"), v0.alpha(), v0.qtarm()); } + rPtAnalysis.fill(HIST("hNV0s"), 3.5); + rPtAnalysis.get(HIST("hNV0s"))->GetXaxis()->SetBinLabel(4, "ITS Min Hits"); + // Cut Plots + rPtAnalysis.fill(HIST("hV0EtaDaughters"), v0.template posTrack_as().eta()); + rPtAnalysis.fill(HIST("hV0EtaDaughters"), v0.template negTrack_as().eta()); + rPtAnalysis.fill(HIST("hArmenterosPodolanskiPlot"), v0.alpha(), v0.qtarm()); return true; } @@ -426,61 +428,61 @@ struct V0PtInvMassPlots { rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(1, "All"); rPtAnalysis.fill(HIST("hMassK0ShortvsCuts"), 0.5, v0.mK0Short()); - if (doRapidityCut && std::abs(v0.rapidity(0)) > rapidityCut) { // V0 Rapidity Cut + if (doRapidityCut && (std::abs(v0.rapidity(0)) > rapidityCut)) { // V0 Rapidity Cut return false; } rPtAnalysis.fill(HIST("hNK0sh"), 1.5); rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(2, "Rapidity"); rPtAnalysis.fill(HIST("hMassK0ShortvsCuts"), 1.5, v0.mK0Short()); - if (doK0shTPCPID && (std::abs(posDaughterTrack.tpcNSigmaPi()) > nSigmaTPCPion && std::abs(negDaughterTrack.tpcNSigmaPi()) > nSigmaTPCPion)) { // TPC PID for two pions + if (doK0shTPCPID && (std::abs(posDaughterTrack.tpcNSigmaPi()) > nSigmaTPCPion || std::abs(negDaughterTrack.tpcNSigmaPi()) > nSigmaTPCPion)) { // TPC PID for two pions return false; } rPtAnalysis.fill(HIST("hNK0sh"), 2.5); rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(3, "TPC_PID"); rPtAnalysis.fill(HIST("hMassK0ShortvsCuts"), 2.5, v0.mK0Short()); - if (doK0shcomptmasscut && std::abs(v0.mLambda() - o2::constants::physics::MassLambda0) < compv0masscut && std::abs(v0.mAntiLambda() - o2::constants::physics::MassLambda0) < compv0masscut) { // Kzero competitive v0 mass cut (cut out Lambdas and Anti-Lambdas) + if (doK0shcomptmasscut && ((std::abs(v0.mLambda() - o2::constants::physics::MassLambda0) < compv0masscut) || (std::abs(v0.mAntiLambda() - o2::constants::physics::MassLambda0) < compv0masscut))) { // Kzero competitive v0 mass cut (cut out Lambdas and Anti-Lambdas) return false; } rPtAnalysis.fill(HIST("hNK0sh"), 3.5); rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(4, "Compt_Mass"); rPtAnalysis.fill(HIST("hMassK0ShortvsCuts"), 3.5, v0.mK0Short()); - if (doK0shMaxct && v0.v0radius() > kaonshmaxct) { // K0sh max ct + if (doK0shMaxct && (v0.v0radius() > kaonshmaxct)) { // K0sh max ct return false; } rPtAnalysis.fill(HIST("hNK0sh"), 4.5); rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(5, "Max_ct"); rPtAnalysis.fill(HIST("hMassK0ShortvsCuts"), 4.5, v0.mK0Short()); - if (doK0shArmenterosCut && v0.qtarm() < (k0shparamArmenterosCut * std::abs(v0.alpha()))) { // K0sh Armenteros Cut + if (doK0shArmenterosCut && (v0.qtarm() < (k0shparamArmenterosCut * std::abs(v0.alpha())))) { // K0sh Armenteros Cut return false; } rPtAnalysis.fill(HIST("hNK0sh"), 5.5); rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(6, "Armenteros"); rPtAnalysis.fill(HIST("hMassK0ShortvsCuts"), 5.5, v0.mK0Short()); - if (doK0shcosPACut && v0.v0cosPA() < kaonshSettingcosPA) { // K0sh cosPA Topological Cut + if (doK0shcosPACut && (v0.v0cosPA() < kaonshSettingcosPA)) { // K0sh cosPA Topological Cut return false; } rPtAnalysis.fill(HIST("hNK0sh"), 6.5); rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(7, "cosPA"); rPtAnalysis.fill(HIST("hMassK0ShortvsCuts"), 6.5, v0.mK0Short()); - if (doK0shDCAdauCut && v0.dcaV0daughters() > kaonshSettingdcav0dau) { // K0sh DCAdaughters Topological Cut + if (doK0shDCAdauCut && (v0.dcaV0daughters() > kaonshSettingdcav0dau)) { // K0sh DCAdaughters Topological Cut return false; } rPtAnalysis.fill(HIST("hNK0sh"), 7.5); rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(8, "DCAdau"); rPtAnalysis.fill(HIST("hMassK0ShortvsCuts"), 7.5, v0.mK0Short()); - if (doK0shv0radiusCut && v0.v0radius() < kaonshSettingradius) { // K0sh v0radius Topological Cut + if (doK0shv0radiusCut && (v0.v0radius() < kaonshSettingradius)) { // K0sh v0radius Topological Cut return false; } rPtAnalysis.fill(HIST("hNK0sh"), 8.5); rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(9, "v0radius"); rPtAnalysis.fill(HIST("hMassK0ShortvsCuts"), 8.5, v0.mK0Short()); - if (doK0shdcaposdautopv && std::abs(v0.dcapostopv()) < kaonshSettingdcapostopv) { // K0sh DCAPosDaughterToPV Topological Cut + if (doK0shdcaposdautopv && (std::abs(v0.dcapostopv()) < kaonshSettingdcapostopv)) { // K0sh DCAPosDaughterToPV Topological Cut return false; } rPtAnalysis.fill(HIST("hNK0sh"), 9.5); rPtAnalysis.get(HIST("hNK0sh"))->GetXaxis()->SetBinLabel(10, "DCAPosDautoPV"); rPtAnalysis.fill(HIST("hMassK0ShortvsCuts"), 9.5, v0.mK0Short()); - if (doK0shdcanegdautopv && std::abs(v0.dcanegtopv()) < kaonshSettingdcanegtopv) { // K0sh DCANegDaughterToPV Topological Cut + if (doK0shdcanegdautopv && (std::abs(v0.dcanegtopv()) < kaonshSettingdcanegtopv)) { // K0sh DCANegDaughterToPV Topological Cut return false; } rPtAnalysis.fill(HIST("hNK0sh"), 10.5); @@ -511,25 +513,25 @@ struct V0PtInvMassPlots { rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(1, "All"); rPtAnalysis.fill(HIST("hMassLambdavsCuts"), 0.5, v0.mLambda()); - if (doRapidityCut && std::abs(v0.rapidity(1)) > rapidityCut) { // V0 Rapidity Cut + if (doRapidityCut && (std::abs(v0.rapidity(1)) > rapidityCut)) { // V0 Rapidity Cut return false; } rPtAnalysis.fill(HIST("hNLambda"), 1.5); rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(2, "Rapidity"); rPtAnalysis.fill(HIST("hMassLambdavsCuts"), 1.5, v0.mLambda()); - if (doLambdaTPCPID && std::abs(posDaughterTrack.tpcNSigmaPr()) > nSigmaTPCProton && std::abs(negDaughterTrack.tpcNSigmaPi()) > nSigmaTPCPion) { // TPC PID on daughter pion and proton for Lambda + if (doLambdaTPCPID && ((std::abs(posDaughterTrack.tpcNSigmaPr()) > nSigmaTPCProton) || (std::abs(negDaughterTrack.tpcNSigmaPi()) > nSigmaTPCPion))) { // TPC PID on daughter pion and proton for Lambda return false; } rPtAnalysis.fill(HIST("hNLambda"), 2.5); rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(3, "TPC_PID"); rPtAnalysis.fill(HIST("hMassLambdavsCuts"), 2.5, v0.mLambda()); - if (doLambdacomptmasscut && std::abs(v0.mK0Short() - o2::constants::physics::MassK0Short) < compv0masscut) { // Lambda competitive v0 mass cut (cut out Kaons) + if (doLambdacomptmasscut && ((std::abs(v0.mK0Short() - o2::constants::physics::MassK0Short) < compv0masscut) || (std::abs(v0.mAntiLambda() - o2::constants::physics::MassLambda0) < compv0masscut))) { // Lambda competitive v0 mass cut (cut out Kaons) return false; } rPtAnalysis.fill(HIST("hNLambda"), 3.5); rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(4, "Compt_Mass"); rPtAnalysis.fill(HIST("hMassLambdavsCuts"), 3.5, v0.mLambda()); - if (doLambdaMaxct && v0.v0radius() > lambdamaxct) { // Lambda max ct + if (doLambdaMaxct && (v0.v0radius() > lambdamaxct)) { // Lambda max ct return false; } rPtAnalysis.fill(HIST("hNLambda"), 4.5); @@ -541,31 +543,31 @@ struct V0PtInvMassPlots { rPtAnalysis.fill(HIST("hNLambda"), 5.5); rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(6, "Armenteros"); rPtAnalysis.fill(HIST("hMassLambdavsCuts"), 5.5, v0.mLambda()); - if (doLambdacosPACut && v0.v0cosPA() < lambdaSettingcosPA) { // Lambda cosPA Topological Cut + if (doLambdacosPACut && (v0.v0cosPA() < lambdaSettingcosPA)) { // Lambda cosPA Topological Cut return false; } rPtAnalysis.fill(HIST("hNLambda"), 6.5); rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(7, "cosPA"); rPtAnalysis.fill(HIST("hMassLambdavsCuts"), 6.5, v0.mLambda()); - if (doLambdaDCAdauCut && v0.dcaV0daughters() > lambdaSettingdcav0dau) { // Lambda DCAdaughters Topological Cut + if (doLambdaDCAdauCut && (v0.dcaV0daughters() > lambdaSettingdcav0dau)) { // Lambda DCAdaughters Topological Cut return false; } rPtAnalysis.fill(HIST("hNLambda"), 7.5); rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(8, "DCAdau"); rPtAnalysis.fill(HIST("hMassLambdavsCuts"), 7.5, v0.mLambda()); - if (doLambdav0radiusCut && v0.v0radius() < lambdaSettingradius) { // Lambda v0radius Topological Cut + if (doLambdav0radiusCut && (v0.v0radius() < lambdaSettingradius)) { // Lambda v0radius Topological Cut return false; } rPtAnalysis.fill(HIST("hNLambda"), 8.5); rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(9, "v0radius"); rPtAnalysis.fill(HIST("hMassLambdavsCuts"), 8.5, v0.mLambda()); - if (doLambdadcaposdautopv && std::abs(v0.dcapostopv()) < lambdaSettingdcapostopv) { // Lambda DCAPosDaughterToPV Topological Cut + if (doLambdadcaposdautopv && (std::abs(v0.dcapostopv()) < lambdaSettingdcapostopv)) { // Lambda DCAPosDaughterToPV Topological Cut return false; } rPtAnalysis.fill(HIST("hNLambda"), 9.5); rPtAnalysis.get(HIST("hNLambda"))->GetXaxis()->SetBinLabel(10, "DCAPosDautoPV"); rPtAnalysis.fill(HIST("hMassLambdavsCuts"), 9.5, v0.mLambda()); - if (doLambdadcanegdautopv && std::abs(v0.dcanegtopv()) < lambdaSettingdcanegtopv) { // Lambda DCANegDaughterToPV Topological Cut + if (doLambdadcanegdautopv && (std::abs(v0.dcanegtopv()) < lambdaSettingdcanegtopv)) { // Lambda DCANegDaughterToPV Topological Cut return false; } rPtAnalysis.fill(HIST("hNLambda"), 10.5); @@ -596,61 +598,61 @@ struct V0PtInvMassPlots { rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(1, "All"); rPtAnalysis.fill(HIST("hMassAntilambdavsCuts"), 0.5, v0.mAntiLambda()); - if (doRapidityCut && std::abs(v0.rapidity(2)) > rapidityCut) { // V0 Rapidity Cut + if (doRapidityCut && (std::abs(v0.rapidity(2)) > rapidityCut)) { // V0 Rapidity Cut return false; } rPtAnalysis.fill(HIST("hNAntilambda"), 1.5); rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(2, "Rapidity"); rPtAnalysis.fill(HIST("hMassAntilambdavsCuts"), 1.5, v0.mAntiLambda()); - if (doAntilambdaTPCPID && std::abs(negDaughterTrack.tpcNSigmaPr()) > nSigmaTPCProton && std::abs(posDaughterTrack.tpcNSigmaPi()) > nSigmaTPCPion) { // TPC PID on daughter pion and proton for AntiLambda + if (doAntilambdaTPCPID && (std::abs(negDaughterTrack.tpcNSigmaPr()) > nSigmaTPCProton || std::abs(posDaughterTrack.tpcNSigmaPi()) > nSigmaTPCPion)) { // TPC PID on daughter pion and proton for AntiLambda return false; } rPtAnalysis.fill(HIST("hNAntilambda"), 2.5); rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(3, "TPC_PID"); rPtAnalysis.fill(HIST("hMassAntilambdavsCuts"), 2.5, v0.mAntiLambda()); - if (doAntilambdacomptmasscut && std::abs(v0.mK0Short() - o2::constants::physics::MassK0Short) < compv0masscut) { // Antilambda competitive v0 mass cut (cut out Kaons) + if (doAntilambdacomptmasscut && ((std::abs(v0.mK0Short() - o2::constants::physics::MassK0Short) < compv0masscut) || (std::abs(v0.mLambda() - o2::constants::physics::MassLambda0) < compv0masscut))) { // Antilambda competitive v0 mass cut (cut out Kaons) return false; } rPtAnalysis.fill(HIST("hNAntilambda"), 3.5); rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(4, "Compt_Mass"); rPtAnalysis.fill(HIST("hMassAntilambdavsCuts"), 3.5, v0.mAntiLambda()); - if (doAntilambdaMaxct && v0.v0radius() > antilambdamaxct) { // Antilambda max ct + if (doAntilambdaMaxct && (v0.v0radius() > antilambdamaxct)) { // Antilambda max ct return false; } rPtAnalysis.fill(HIST("hNAntilambda"), 4.5); rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(5, "Max_ct"); rPtAnalysis.fill(HIST("hMassAntilambdavsCuts"), 4.5, v0.mAntiLambda()); - if (doAntilambdaArmenterosCut && v0.qtarm() < (antilambdaparamArmenterosCut * std::abs(v0.alpha()))) { // Antilambda Armenteros Cut + if (doAntilambdaArmenterosCut && (v0.qtarm() < (antilambdaparamArmenterosCut * std::abs(v0.alpha())))) { // Antilambda Armenteros Cut return false; } rPtAnalysis.fill(HIST("hNAntilambda"), 5.5); rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(6, "Armenteros"); rPtAnalysis.fill(HIST("hMassAntilambdavsCuts"), 5.5, v0.mAntiLambda()); - if (doAntilambdacosPACut && v0.v0cosPA() < antilambdaSettingcosPA) { // Antilambda cosPA Topological Cut + if (doAntilambdacosPACut && (v0.v0cosPA() < antilambdaSettingcosPA)) { // Antilambda cosPA Topological Cut return false; } rPtAnalysis.fill(HIST("hNAntilambda"), 6.5); rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(7, "cosPA"); rPtAnalysis.fill(HIST("hMassAntilambdavsCuts"), 6.5, v0.mAntiLambda()); - if (doAntilambdaDCAdauCut && v0.dcaV0daughters() > antilambdaSettingdcav0dau) { // Antilambda DCAdaughters Topological Cut + if (doAntilambdaDCAdauCut && (v0.dcaV0daughters() > antilambdaSettingdcav0dau)) { // Antilambda DCAdaughters Topological Cut return false; } rPtAnalysis.fill(HIST("hNAntilambda"), 7.5); rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(8, "DCAdau"); rPtAnalysis.fill(HIST("hMassAntilambdavsCuts"), 7.5, v0.mAntiLambda()); - if (doAntilambdav0radiusCut && v0.v0radius() < antilambdaSettingradius) { // Antilambda v0radius Topological Cut + if (doAntilambdav0radiusCut && (v0.v0radius() < antilambdaSettingradius)) { // Antilambda v0radius Topological Cut return false; } rPtAnalysis.fill(HIST("hNAntilambda"), 8.5); rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(9, "v0radius"); rPtAnalysis.fill(HIST("hMassAntilambdavsCuts"), 8.5, v0.mAntiLambda()); - if (doAntilambdadcaposdautopv && std::abs(v0.dcapostopv()) < antilambdaSettingdcapostopv) { // Antilambda DCAPosDaughterToPV Topological Cut + if (doAntilambdadcaposdautopv && (std::abs(v0.dcapostopv()) < antilambdaSettingdcapostopv)) { // Antilambda DCAPosDaughterToPV Topological Cut return false; } rPtAnalysis.fill(HIST("hNAntilambda"), 9.5); rPtAnalysis.get(HIST("hNAntilambda"))->GetXaxis()->SetBinLabel(10, "DCAPosDautoPV"); rPtAnalysis.fill(HIST("hMassAntilambdavsCuts"), 9.5, v0.mAntiLambda()); - if (doAntilambdadcanegdautopv && std::abs(v0.dcanegtopv()) < antilambdaSettingdcanegtopv) { // Antilambda DCANegDaughterToPV Topological Cut + if (doAntilambdadcanegdautopv && (std::abs(v0.dcanegtopv()) < antilambdaSettingdcanegtopv)) { // Antilambda DCANegDaughterToPV Topological Cut return false; } rPtAnalysis.fill(HIST("hNAntilambda"), 10.5); @@ -795,25 +797,23 @@ struct V0PtInvMassPlots { } // kzero analysis if (kzeroAnalysis == true) { - if (v0mcParticle.pdgCode() == kK0Short) { // kzero matched - if (!acceptK0sh(v0)) { // K0sh Selection - continue; - } - - if (v0mcParticle.isPhysicalPrimary()) { - for (int i = 0; i < nmaxHistograms; i++) { - if (kaonptedgevalues[i] <= v0.pt() && v0.pt() < kaonptedgevalues[i + 1]) { // finding v0s with pt within the range of our bin edges - pthistos::kaonPt[i]->Fill(v0.mK0Short()); // filling the k0s namespace histograms + if (dotruthk0sh && (v0mcParticle.pdgCode() == kK0Short)) { // kzero matched + if (acceptK0sh(v0)) { // K0sh Selection + if (v0mcParticle.isPhysicalPrimary()) { + for (int i = 0; i < nmaxHistograms; i++) { + if (kaonptedgevalues[i] <= v0.pt() && v0.pt() < kaonptedgevalues[i + 1]) { // finding v0s with pt within the range of our bin edges + pthistos::kaonPt[i]->Fill(v0.mK0Short()); // filling the k0s namespace histograms + } } } - } - if (!v0mcParticle.isPhysicalPrimary()) { - auto v0mothers = v0mcParticle.mothers_as(); // Get mothers - if (!v0mothers.empty()) { - auto& v0mcParticleMother = v0mothers.front(); // First mother - rFeeddownMatrices.fill(HIST("hK0shFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt()); - if (v0mcParticleMother.pdgCode() == kPhi) { // Phi Mother Matched - rFeeddownMatrices.fill(HIST("hK0shPhiFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt()); + if (!v0mcParticle.isPhysicalPrimary()) { + auto v0mothers = v0mcParticle.mothers_as(); // Get mothers + if (!v0mothers.empty()) { + auto& v0mcParticleMother = v0mothers.front(); // First mother + rFeeddownMatrices.fill(HIST("hK0shFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt()); + if (v0mcParticleMother.pdgCode() == kPhi) { // Phi Mother Matched + rFeeddownMatrices.fill(HIST("hK0shPhiFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt()); + } } } } @@ -821,32 +821,29 @@ struct V0PtInvMassPlots { } // lambda analysis if (lambdaAnalysis == true) { - if (v0mcParticle.pdgCode() == kLambda0) { // lambda matched - - if (!acceptLambda(v0)) { // Lambda Selections - continue; - } - - if (v0mcParticle.isPhysicalPrimary()) { - for (int i = 0; i < nmaxHistograms; i++) { - if (lambdaptedgevalues[i] <= v0.pt() && v0.pt() < lambdaptedgevalues[i + 1]) { - pthistos::lambdaPt[i]->Fill(v0.mLambda()); + if (dotruthLambda && (v0mcParticle.pdgCode() == kLambda0)) { // lambda matched + if (acceptLambda(v0)) { // Lambda Selections + if (v0mcParticle.isPhysicalPrimary()) { + for (int i = 0; i < nmaxHistograms; i++) { + if (lambdaptedgevalues[i] <= v0.pt() && v0.pt() < lambdaptedgevalues[i + 1]) { + pthistos::lambdaPt[i]->Fill(v0.mLambda()); + } } } - } - if (!v0mcParticle.isPhysicalPrimary()) { - auto v0mothers = v0mcParticle.mothers_as(); // Get mothers - if (!v0mothers.empty()) { - auto& v0mcParticleMother = v0mothers.front(); // First mother - rFeeddownMatrices.fill(HIST("hLambdaFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt()); - if (v0mcParticleMother.pdgCode() == kXiMinus) { // Xi Minus Mother Matched - rFeeddownMatrices.fill(HIST("hLambdaXiMinusFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt()); - } - if (v0mcParticleMother.pdgCode() == kXi0) { // Xi Zero Mother Matched - rFeeddownMatrices.fill(HIST("hLambdaXiZeroFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt()); - } - if (v0mcParticleMother.pdgCode() == kOmegaMinus) { // Omega Mother Matched - rFeeddownMatrices.fill(HIST("hLambdaOmegaFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt()); + if (!v0mcParticle.isPhysicalPrimary()) { + auto v0mothers = v0mcParticle.mothers_as(); // Get mothers + if (!v0mothers.empty()) { + auto& v0mcParticleMother = v0mothers.front(); // First mother + rFeeddownMatrices.fill(HIST("hLambdaFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt()); + if (v0mcParticleMother.pdgCode() == kXiMinus) { // Xi Minus Mother Matched + rFeeddownMatrices.fill(HIST("hLambdaXiMinusFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt()); + } + if (v0mcParticleMother.pdgCode() == kXi0) { // Xi Zero Mother Matched + rFeeddownMatrices.fill(HIST("hLambdaXiZeroFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt()); + } + if (v0mcParticleMother.pdgCode() == kOmegaMinus) { // Omega Mother Matched + rFeeddownMatrices.fill(HIST("hLambdaOmegaFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt()); + } } } } @@ -854,32 +851,29 @@ struct V0PtInvMassPlots { } // antilambda analysis if (antiLambdaAnalysis == true) { - if (v0mcParticle.pdgCode() == kLambda0Bar) { // antilambda matched - - if (!acceptAntilambda(v0)) { // Antilambda Selections - continue; - } - - if (v0mcParticle.isPhysicalPrimary()) { - for (int i = 0; i < nmaxHistograms; i++) { - if (antilambdaPtedgevalues[i] <= v0.pt() && v0.pt() < antilambdaPtedgevalues[i + 1]) { - pthistos::antilambdaPt[i]->Fill(v0.mAntiLambda()); + if (dotruthAntilambda && (v0mcParticle.pdgCode() == kLambda0Bar)) { // antilambda matched + if (acceptAntilambda(v0)) { // Antilambda Selections + if (v0mcParticle.isPhysicalPrimary()) { + for (int i = 0; i < nmaxHistograms; i++) { + if (antilambdaPtedgevalues[i] <= v0.pt() && v0.pt() < antilambdaPtedgevalues[i + 1]) { + pthistos::antilambdaPt[i]->Fill(v0.mAntiLambda()); + } } } - } - if (!v0mcParticle.isPhysicalPrimary()) { - auto v0mothers = v0mcParticle.mothers_as(); // Get mothers - if (!v0mothers.empty()) { - auto& v0mcParticleMother = v0mothers.front(); // First mother - rFeeddownMatrices.fill(HIST("hAntiLambdaFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt()); - if (v0mcParticleMother.pdgCode() == kXiPlusBar) { // Xi Plus Mother Matched - rFeeddownMatrices.fill(HIST("hAntiLambdaXiPlusFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt()); - } - if (v0mcParticleMother.pdgCode() == -kXi0) { // Anti-Xi Zero Mother Matched - rFeeddownMatrices.fill(HIST("hAntiLambdaAntiXiZeroFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt()); - } - if (v0mcParticleMother.pdgCode() == kOmegaPlusBar) { // Anti-Omega (minus) Mother Matched - rFeeddownMatrices.fill(HIST("hAntiLambdaAntiOmegaFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt()); + if (!v0mcParticle.isPhysicalPrimary()) { + auto v0mothers = v0mcParticle.mothers_as(); // Get mothers + if (!v0mothers.empty()) { + auto& v0mcParticleMother = v0mothers.front(); // First mother + rFeeddownMatrices.fill(HIST("hAntiLambdaFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt()); + if (v0mcParticleMother.pdgCode() == kXiPlusBar) { // Xi Plus Mother Matched + rFeeddownMatrices.fill(HIST("hAntiLambdaXiPlusFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt()); + } + if (v0mcParticleMother.pdgCode() == -kXi0) { // Anti-Xi Zero Mother Matched + rFeeddownMatrices.fill(HIST("hAntiLambdaAntiXiZeroFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt()); + } + if (v0mcParticleMother.pdgCode() == kOmegaPlusBar) { // Anti-Omega (minus) Mother Matched + rFeeddownMatrices.fill(HIST("hAntiLambdaAntiOmegaFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt()); + } } } } @@ -919,34 +913,31 @@ struct V0PtInvMassPlots { } // kzero analysis if (kzeroAnalysis == true) { - if (!acceptK0sh(v0)) { // K0sh Selection - continue; - } - for (int i = 0; i < nmaxHistograms; i++) { - if (kaonptedgevalues[i] <= v0.pt() && v0.pt() < kaonptedgevalues[i + 1]) { // finding v0s with pt within the range of our bin edges - pthistos::kaonPt[i]->Fill(v0.mK0Short()); // filling the k0s namespace histograms + if (acceptK0sh(v0)) { // K0sh Selection + for (int i = 0; i < nmaxHistograms; i++) { + if (kaonptedgevalues[i] <= v0.pt() && v0.pt() < kaonptedgevalues[i + 1]) { // finding v0s with pt within the range of our bin edges + pthistos::kaonPt[i]->Fill(v0.mK0Short()); // filling the k0s namespace histograms + } } } } // lambda analysis if (lambdaAnalysis == true) { - if (!acceptLambda(v0)) { // Lambda Selection - continue; - } - for (int i = 0; i < nmaxHistograms; i++) { - if (lambdaptedgevalues[i] <= v0.pt() && v0.pt() < lambdaptedgevalues[i + 1]) { - pthistos::lambdaPt[i]->Fill(v0.mLambda()); + if (acceptLambda(v0)) { // Lambda Selection + for (int i = 0; i < nmaxHistograms; i++) { + if (lambdaptedgevalues[i] <= v0.pt() && v0.pt() < lambdaptedgevalues[i + 1]) { + pthistos::lambdaPt[i]->Fill(v0.mLambda()); + } } } } // anti-lambda analysis if (antiLambdaAnalysis == true) { - if (!acceptAntilambda(v0)) { // Antilambda Selection - continue; - } - for (int i = 0; i < nmaxHistograms; i++) { - if (lambdaptedgevalues[i] <= v0.pt() && v0.pt() < lambdaptedgevalues[i + 1]) { - pthistos::antilambdaPt[i]->Fill(v0.mAntiLambda()); + if (acceptAntilambda(v0)) { // Antilambda Selection + for (int i = 0; i < nmaxHistograms; i++) { + if (lambdaptedgevalues[i] <= v0.pt() && v0.pt() < lambdaptedgevalues[i + 1]) { + pthistos::antilambdaPt[i]->Fill(v0.mAntiLambda()); + } } } } From 76d80e1ce60f157126a86301ae749ef802f0f21d Mon Sep 17 00:00:00 2001 From: Noor Koster <82090643+cnkoster@users.noreply.github.com> Date: Wed, 17 Sep 2025 01:02:32 +0200 Subject: [PATCH 420/986] [PWGCF] zdcQVectors: fix typo in shift correction (#12997) Co-authored-by: ALICE Action Bot --- PWGCF/Flow/TableProducer/zdcQVectors.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/PWGCF/Flow/TableProducer/zdcQVectors.cxx b/PWGCF/Flow/TableProducer/zdcQVectors.cxx index 14206f7b732..2afc85d23f5 100644 --- a/PWGCF/Flow/TableProducer/zdcQVectors.cxx +++ b/PWGCF/Flow/TableProducer/zdcQVectors.cxx @@ -956,15 +956,17 @@ struct ZdcQVectors { int binshiftxZDCA = cal.shiftprofileA->FindBin(centrality, 0.5, ishift - 0.5); int binshiftyZDCA = cal.shiftprofileA->FindBin(centrality, 1.5, ishift - 0.5); - if (binshiftxZDCC > 0 && binshiftyZDCC > 0 && binshiftxZDCA > 0 && binshiftyZDCA > 0) { + if (binshiftxZDCC > 0) coeffshiftxZDCC = cal.shiftprofileC->GetBinContent(binshiftxZDCC); + if (binshiftyZDCC > 0) coeffshiftyZDCC = cal.shiftprofileC->GetBinContent(binshiftyZDCC); + if (binshiftxZDCA > 0) coeffshiftxZDCA = cal.shiftprofileA->GetBinContent(binshiftxZDCA); + if (binshiftyZDCA > 0) coeffshiftyZDCA = cal.shiftprofileA->GetBinContent(binshiftyZDCA); - } - deltaPsiZDCC += deltaPsiZDCC + ((2 / (1.0 * ishift)) * (-coeffshiftxZDCC * std::cos(ishift * 1.0 * psiZDCC) + coeffshiftyZDCC * std::sin(ishift * 1.0 * psiZDCC))); - deltaPsiZDCA += deltaPsiZDCA + ((2 / (1.0 * ishift)) * (-coeffshiftxZDCA * std::cos(ishift * 1.0 * psiZDCA) + coeffshiftyZDCA * std::sin(ishift * 1.0 * psiZDCA))); } + deltaPsiZDCC += ((2 / (1.0 * ishift)) * (-coeffshiftxZDCC * std::cos(ishift * 1.0 * psiZDCC) + coeffshiftyZDCC * std::sin(ishift * 1.0 * psiZDCC))); + deltaPsiZDCA += ((2 / (1.0 * ishift)) * (-coeffshiftxZDCA * std::cos(ishift * 1.0 * psiZDCA) + coeffshiftyZDCA * std::sin(ishift * 1.0 * psiZDCA))); } psiZDCCshift += deltaPsiZDCC; From 4bc7f949c7b253633ea7ff39a1f50d114089419d Mon Sep 17 00:00:00 2001 From: sashingo Date: Wed, 17 Sep 2025 09:46:58 +0900 Subject: [PATCH 421/986] [PWGHF] Added additional parameters in Z->ee QA histograms (#12983) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Vít Kučera --- PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx | 61 +++++++++++++++++------ 1 file changed, 45 insertions(+), 16 deletions(-) diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx index baca2b26b99..068cac4030c 100644 --- a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -136,13 +136,15 @@ struct HfTaskElectronWeakBoson { // QA for Z->ee Configurable enableZeeRecoQA{"enableZeeRecoQA", false, "Enable QA for Z->ee reconstruction"}; + Configurable massZMinQA{"massZMinQA", 0.1, "minimum mass cut for Zee Reco QA"}; // CCDB service object Service ccdb; struct HfElectronCandidate { - float pt, eta, phi, eop, energyIso, momIso, ntrackIso; - HfElectronCandidate(float ptr, float e, float ph, float ep, float eiso, float piso, int ntrkiso) - : pt(ptr), eta(e), phi(ph), eop(ep), energyIso(eiso), momIso(piso), ntrackIso(ntrkiso) {} + float pt, eta, phi, dcaxyTrk, dcazTrk, eop, energyIso, momIso; + int ntrackIso, nclusterTPC, nclusterITS; + HfElectronCandidate(float ptr, float e, float ph, float dcaxy, float dcaz, float ep, float eiso, float piso, int ntrkiso, int nclstpc, int nclsits) + : pt(ptr), eta(e), phi(ph), dcaxyTrk(dcaxy), dcazTrk(dcaz), eop(ep), energyIso(eiso), momIso(piso), ntrackIso(ntrkiso), nclusterTPC(nclstpc), nclusterITS(nclsits) {} }; std::vector selectedElectronsIso; std::vector selectedPositronsIso; @@ -212,8 +214,18 @@ struct HfTaskElectronWeakBoson { const AxisSpec axisEta{20, -1.0, 1.0, "#eta"}; const AxisSpec axisPt{nBinsPt, 0, binPtmax, "p_{T}"}; const AxisSpec axisPtZee{60, 20, 80, "p_{T}"}; - const AxisSpec axisPtZele{60, 20, 80, "p_{T,ele} (GeV/c)"}; + const AxisSpec axisPtZneg{60, 20, 80, "p_{T,neg} (GeV/c)"}; const AxisSpec axisPtZpos{60, 20, 80, "p_{T,pos} (GeV/c)"}; + const AxisSpec axisDCAxyneg{150, 0, 0.3, "DCAxy_{neg}"}; + const AxisSpec axisDCAxypos{150, 0, 0.3, "DCAxy_{pos}"}; + const AxisSpec axisDCAzneg{150, 0, 0.3, "DCAz_{neg}"}; + const AxisSpec axisDCAzpos{150, 0, 0.3, "DCAz_{neg}"}; + const AxisSpec axisNclsTPCneg{20, 79.5, 159.5, "nClsTpc_{neg}"}; + const AxisSpec axisNclsTPCpos{20, 79.5, 159.5, "nClsTpc_{neg}"}; + const AxisSpec axisNclsITSneg{9, -0.5, 8.5, "nClsIts_{neg}"}; + const AxisSpec axisNclsITSpos{9, -0.5, 8.5, "nClsIts_{neg}"}; + const AxisSpec axisSectorTPCneg{360, 0, 18, "TPCsector_{neg}"}; + const AxisSpec axisSectorTPCpos{360, 0, 18, "TPCsector_{pos}"}; const AxisSpec axisNsigma{100, -5, 5, "N#sigma"}; const AxisSpec axisDedx{150, 0, 150, "dEdx"}; const AxisSpec axisE{nBinsE, 0, binEmax, "Energy"}; @@ -224,20 +236,20 @@ struct HfTaskElectronWeakBoson { const AxisSpec axisNcell{50, 0.0, 50.0, "Ncell"}; const AxisSpec axisPhi{350, 0, 7, "Phi"}; const AxisSpec axisEop{200, 0, 2, "E/p"}; - const AxisSpec axisEopZele{200, 0, 2, "E/p electon"}; - const AxisSpec axisEopZpos{200, 0, 2, "E/p positron"}; + const AxisSpec axisEopZneg{200, 0, 2, "E/p neg"}; + const AxisSpec axisEopZpos{200, 0, 2, "E/p pos"}; const AxisSpec axisChi2{250, 0.0, 25.0, "#chi^{2}"}; const AxisSpec axisCluster{100, 0.0, 200.0, "counts"}; const AxisSpec axisITSNCls{10, 0.0, 10, "counts"}; const AxisSpec axisEMCtime{100, -50.0, 50, "EMC time"}; const AxisSpec axisIsoEnergy{100, 0, 1.0, "E_{iso}"}; - const AxisSpec axisIsoEnergyZele{100, 0, 1.0, "E_{iso,ele}"}; + const AxisSpec axisIsoEnergyZneg{100, 0, 1.0, "E_{iso,neg}"}; const AxisSpec axisIsoEnergyZpos{100, 0, 1.0, "E_{iso,pos}"}; const AxisSpec axisIsoMomentum{100, 0, 10.0, "Isolation momentum(GeV/C)"}; - const AxisSpec axisIsoMomentumZele{100, 0, 10.0, "p_{iso,ele}"}; + const AxisSpec axisIsoMomentumZneg{100, 0, 10.0, "p_{iso,neg}"}; const AxisSpec axisIsoMomentumZpos{100, 0, 10.0, "p_{iso,pos}"}; const AxisSpec axisIsoTrack{25, -0.5, 24.5, "Isolation Track"}; - const AxisSpec axisIsoTrackZele{25, -0.5, 24.5, "N_{isotrk,ele}"}; + const AxisSpec axisIsoTrackZneg{25, -0.5, 24.5, "N_{isotrk,neg}"}; const AxisSpec axisIsoTrackZpos{25, -0.5, 24.5, "N_{isotrk,pos}"}; const AxisSpec axisInvMassZgamma{150, 0, 150, "M_{ee} (GeV/c^{2})"}; const AxisSpec axisInvMassZ{130, 20, 150, "M_{ee} (GeV/c^{2})"}; @@ -276,7 +288,7 @@ struct HfTaskElectronWeakBoson { registry.add("hIsolationEnergy", "Isolation Energy", kTH2F, {{axisE}, {axisIsoEnergy}}); registry.add("hInvMassZee", "invariant mass for Z ULS pair", HistType::kTHnSparseF, {axisCentrality, axisSign, axisPt, axisInvMassZgamma}); registry.add("hKfInvMassZee", "invariant mass for Z ULS pair KFp", HistType::kTHnSparseF, {axisCentrality, axisSign, axisPt, axisInvMassZgamma}); - registry.add("hInvMassZeeQA", "QA for invariant mass for Z", HistType::kTHnSparseF, {axisInvMassZ, axisPtZele, axisPtZpos, axisEopZele, axisEopZpos, axisIsoEnergyZele, axisIsoEnergyZpos, axisIsoMomentumZele, axisIsoMomentumZpos, axisIsoTrackZele, axisIsoTrackZpos}); + registry.add("hInvMassZeeQA", "QA for invariant mass for Z", HistType::kTHnSparseF, {axisInvMassZ, axisPtZneg, axisPtZpos, axisDCAxyneg, axisDCAxypos, axisDCAzpos, axisNclsTPCneg, axisNclsTPCpos, axisNclsITSneg, axisNclsITSpos, axisSectorTPCneg, axisSectorTPCneg, axisEopZneg, axisEopZpos, axisIsoEnergyZneg, axisIsoEnergyZpos, axisIsoMomentumZneg, axisIsoMomentumZpos, axisIsoTrackZneg, axisIsoTrackZpos}); registry.add("hTHnElectrons", "electron info", HistType::kTHnSparseF, {axisPt, axisNsigma, axisM02, axisEop, axisIsoEnergy, axisIsoTrack, axisEta, axisDedx}); registry.add("hTHnTrMatch", "Track EMC Match", HistType::kTHnSparseF, {axisPt, axisdPhi, axisdEta}); @@ -539,10 +551,14 @@ struct HfTaskElectronWeakBoson { track.pt(), track.eta(), track.phi(), + track.dcaXY(), + track.dcaZ(), eop, isoEnergy, isoMomentum, - trackCount); + trackCount, + track.tpcNClsCrossedRows(), + track.itsNCls()); } if (track.pt() < ptMin) { @@ -663,19 +679,27 @@ struct HfTaskElectronWeakBoson { track.pt(), track.eta(), track.phi(), + track.dcaXY(), + track.dcaZ(), eop, isoEnergy, isoMomentum, - trackCount); + trackCount, + track.tpcNClsFound(), + track.itsNCls()); } else { selectedPositronsIso.emplace_back( track.pt(), track.eta(), track.phi(), + track.dcaXY(), + track.dcaZ(), eop, isoEnergy, isoMomentum, - trackCount); + trackCount, + track.tpcNClsFound(), + track.itsNCls()); } } @@ -710,13 +734,18 @@ struct HfTaskElectronWeakBoson { auto child1 = RecoDecayPtEtaPhi::pVector(trackEle.pt, trackEle.eta, trackEle.phi); auto child2 = RecoDecayPtEtaPhi::pVector(trackPos.pt, trackPos.eta, trackPos.phi); double invMass = RecoDecay::m(std::array{child1, child2}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}); - registry.fill(HIST("hInvMassZeeQA"), invMass, trackEle.pt, trackPos.pt, trackEle.eop, trackPos.eop, trackEle.energyIso, trackPos.energyIso, trackEle.momIso, trackPos.momIso, trackEle.ntrackIso, trackPos.ntrackIso); + if (invMass > massZMinQA) { + float sectorneg = trackEle.phi / o2::constants::math::SectorSpanRad; + float sectorpos = trackPos.phi / o2::constants::math::SectorSpanRad; + // LOG(info) << "TPC sector= " << sectorneg << " ; " << sectorpos; + registry.fill(HIST("hInvMassZeeQA"), invMass, trackEle.pt, trackPos.pt, trackEle.dcaxyTrk, trackPos.dcaxyTrk, trackPos.dcazTrk, trackEle.nclusterTPC, trackPos.nclusterTPC, trackEle.nclusterITS, trackPos.nclusterITS, sectorneg, sectorpos, trackEle.eop, trackPos.eop, trackEle.energyIso, trackPos.energyIso, trackEle.momIso, trackPos.momIso, trackEle.ntrackIso, trackPos.ntrackIso); + } } } } } // end of Z->ee QA - } -}; + } // process +}; // struct HfTaskElectronWeakBoson WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { From b5f68248a840584029ff4a33f37165f736b7810a Mon Sep 17 00:00:00 2001 From: wenyaCern <31894577+wenyaCern@users.noreply.github.com> Date: Wed, 17 Sep 2025 11:07:35 +0200 Subject: [PATCH 422/986] [PWGCF] Add functions for flow and qn in femto dream (#12946) Co-authored-by: ALICE Action Bot --- PWGCF/DataModel/FemtoDerived.h | 8 + .../Core/femtoDreamCollisionSelection.h | 256 +++++++++++++++++- PWGCF/FemtoDream/Core/femtoDreamContainer.h | 87 ++++++ .../TableProducer/femtoDreamProducerTask.cxx | 119 +++++++- .../Tasks/femtoDreamPairTaskTrackTrack.cxx | 179 ++++++++++-- 5 files changed, 615 insertions(+), 34 deletions(-) diff --git a/PWGCF/DataModel/FemtoDerived.h b/PWGCF/DataModel/FemtoDerived.h index 6bcd3432daf..911f55ab294 100644 --- a/PWGCF/DataModel/FemtoDerived.h +++ b/PWGCF/DataModel/FemtoDerived.h @@ -35,6 +35,7 @@ enum CollisionBinning { kMult, //! Bin collision in number of charged tracks for mixing kMultPercentile, //! Bin collision in multiplicity percentile for mixing kMultMultPercentile, //! Bin collision in number of charged tracks and multiplicity percentile for mixing + kMultPercentileQn, //! Bin collision in multiplicity percentile an qn value for mixing kNCollisionBinning }; @@ -50,6 +51,9 @@ DECLARE_SOA_COLUMN(BitMaskTrackTwo, bitmaskTrackTwo, BitMaskType); //! Bit f DECLARE_SOA_COLUMN(BitMaskTrackThree, bitmaskTrackThree, BitMaskType); //! Bit for track three DECLARE_SOA_COLUMN(Downsample, downsample, bool); //! Flag for downsampling + +DECLARE_SOA_COLUMN(QnVal, qnVal, int); //! qn values for dividing events +DECLARE_SOA_COLUMN(Occupancy, occupancy, int); //! Occupancy of the event } // namespace femtodreamcollision DECLARE_SOA_TABLE_STAGED(FDCollisions, "FDCOLLISION", @@ -61,6 +65,10 @@ DECLARE_SOA_TABLE_STAGED(FDCollisions, "FDCOLLISION", femtodreamcollision::MagField); using FDCollision = FDCollisions::iterator; +DECLARE_SOA_TABLE(FDExtQnCollisions, "AOD", "FDEXTQNCOLLISION", + femtodreamcollision::QnVal, + femtodreamcollision::Occupancy); + DECLARE_SOA_TABLE(FDColMasks, "AOD", "FDCOLMASK", femtodreamcollision::BitMaskTrackOne, femtodreamcollision::BitMaskTrackTwo, diff --git a/PWGCF/FemtoDream/Core/femtoDreamCollisionSelection.h b/PWGCF/FemtoDream/Core/femtoDreamCollisionSelection.h index 73350e81c6c..c8a3947b141 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamCollisionSelection.h +++ b/PWGCF/FemtoDream/Core/femtoDreamCollisionSelection.h @@ -16,13 +16,18 @@ #ifndef PWGCF_FEMTODREAM_CORE_FEMTODREAMCOLLISIONSELECTION_H_ #define PWGCF_FEMTODREAM_CORE_FEMTODREAMCOLLISIONSELECTION_H_ -#include -#include #include "Common/CCDB/TriggerAliases.h" +#include "Common/Core/EventPlaneHelper.h" #include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Qvectors.h" + #include "Framework/HistogramRegistry.h" #include "Framework/Logger.h" +#include +#include +#include + using namespace o2::framework; namespace o2::analysis::femtoDream @@ -156,6 +161,36 @@ class FemtoDreamCollisionSelection return true; } + /// Pile-up selection of PbPb collisions + /// \tparam T type of the collision + /// \param col Collision + /// \return whether or not the collisions fulfills the specified selections + template + bool isPileUpCollisionPbPb(C const& col, + bool noSameBunchPileup, bool isGoodITSLayersAll) + { + if ((noSameBunchPileup && !col.selection_bit(aod::evsel::kNoSameBunchPileup)) || (isGoodITSLayersAll && !col.selection_bit(aod::evsel::kIsGoodITSLayersAll))) { + return false; + } + + return true; + } + + /// occupancy selection + /// \tparam T type of the collision + /// \param col Collision + /// \return whether or not the collisions fulfills the specified selections + template + bool occupancySelection(C const& col, + int tpcOccupancyMin, int tpcOccupancyMax) + { + const auto occupancy = col.trackOccupancyInTimeRange(); + if ((occupancy < tpcOccupancyMin || occupancy > tpcOccupancyMax)) { + return false; + } + return true; + } + /// Some basic QA of the event /// \tparam T type of the collision /// \param col Collision @@ -175,6 +210,49 @@ class FemtoDreamCollisionSelection } } + /// Initializes histograms for qn bin + /// \param registry Histogram registry to be passed + void initQn(HistogramRegistry* registry, int mumQnBins = 10) + { + mHistogramQn = registry; + mHistogramQn->add("Event/centFT0CBefore", "; cent", kTH1F, {{10, 0, 100}}); + mHistogramQn->add("Event/centFT0CAfter", "; cent", kTH1F, {{10, 0, 100}}); + mHistogramQn->add("Event/centVsqn", "; cent; qn", kTH2F, {{10, 0, 100}, {100, 0, 1000}}); + mHistogramQn->add("Event/centVsqnVsSpher", "; cent; qn; Sphericity", kTH3F, {{10, 0, 100}, {100, 0, 1000}, {100, 0, 1}}); + mHistogramQn->add("Event/qnBin", "; qnBin; entries", kTH1F, {{20, 0, 20}}); + + for (int iqn(0); iqn < mumQnBins; ++iqn) { + qnMults.push_back(mHistogramQn->add(("Qn/mult_" + std::to_string(iqn)).c_str(), "; cent; c22", kTH1F, {{100, 0, 3500}})); + } + return; + } + + /// Initializes histograms for the flow calculation + /// \param registry Histogram registry to be passed + void initFlow(HistogramRegistry* registry, bool doQnSeparation, int mumQnBins = 10, int binPt = 100, int binEta = 32) + { + if (!mCutsSet) { + LOGF(error, "Event selection not set - quitting!"); + } + mReQthisEvt = new TH2D("ReQthisEvt", "", binPt, 0., 5., binEta, -0.8, 0.8); + mImQthisEvt = new TH2D("ImQthisEvt", "", binPt, 0., 5., binEta, -0.8, 0.8); + mReQ2thisEvt = new TH2D("ReQ2thisEvt", "", binPt, 0., 5., binEta, -0.8, 0.8); + mImQ2thisEvt = new TH2D("ImQ2thisEvt", "", binPt, 0., 5., binEta, -0.8, 0.8); + mMQthisEvt = new TH2D("MQthisEvt", "", binPt, 0., 5., binEta, -0.8, 0.8); + mMQWeightthisEvt = new TH2D("MQWeightthisEvt", "", binPt, 0., 5., binEta, -0.8, 0.8); + + mHistogramQn = registry; + mHistogramQn->add("Event/profileC22", "; cent; c22", kTProfile, {{10, 0, 100}}); + mHistogramQn->add("Event/profileC24", "; cent; c24", kTProfile, {{10, 0, 100}}); + + if (doQnSeparation) { + for (int iqn(0); iqn < mumQnBins; ++iqn) { + profilesC22.push_back(mHistogramQn->add(("Qn/profileC22_" + std::to_string(iqn)).c_str(), "; cent; c22", kTProfile, {{10, 0, 100}})); + } + } + return; + } + /// \todo to be implemented! /// Compute the sphericity of an event /// Important here is that the filter on tracks does not interfere here! @@ -246,6 +324,170 @@ class FemtoDreamCollisionSelection return spt; } + /// \todo to be implemented! + /// Compute the qn-vector(FT0C) of an event + /// \tparam T type of the collision + /// \param col Collision + /// \return value of the qn-vector of FT0C of the event + template + float computeqnVec(T const& col) + { + double qn = std::sqrt(col.qvecFT0CReVec()[0] * col.qvecFT0CReVec()[0] + col.qvecFT0CImVec()[0] * col.qvecFT0CImVec()[0]) * std::sqrt(col.sumAmplFT0C()); + return qn; + } + + /// \todo to be implemented! + /// \return the 1-d qn-vector separator to 2-d + std::vector> getQnBinSeparator2D(std::vector flat, const int numQnBins = 10) + { + size_t nBins = numQnBins + 1; + + if (flat.empty() || flat.size() % nBins != 0) { + LOGP(error, "ConfQnBinSeparator size = {} is not divisible by {}", + flat.size(), nBins); + return {{-999, -999}}; + } + + size_t nCent = flat.size() / nBins; + std::vector> res(nCent, std::vector(nBins)); + + for (size_t i = 0; i < nCent; ++i) { + for (size_t j = 0; j < nBins; ++j) { + res[i][j] = flat[i * nBins + j]; + } + } + return res; + } + + /// \todo to be implemented! + /// Get the bin number of qn-vector(FT0C) of an event + /// \param centBinWidth centrality bin width, example: per 1%, per 10% ... + /// \return bin number of qn-vector of the event + int myqnBin(float centrality, float centMax, std::vector qnBinSeparator, bool doFillHisto, float fSpher, float qn, const int numQnBins, float mult, float centBinWidth = 1.f) + { + auto twoDSeparator = getQnBinSeparator2D(qnBinSeparator, numQnBins); + if (twoDSeparator.empty() || twoDSeparator[0][0] == -999.) { + LOGP(warning, "ConfQnBinSeparator not set, using default fallback!"); + return -999; // safe fallback + } + + if (doFillHisto) + mHistogramQn->fill(HIST("Event/centFT0CBefore"), centrality); + + int qnBin = -999; + int mycentBin = static_cast(centrality / centBinWidth); + if (mycentBin >= static_cast(centMax / centBinWidth)) + return qnBin; + + if (mycentBin > static_cast(twoDSeparator.size()) - 1) + return qnBin; + + for (int iqn(0); iqn < static_cast(twoDSeparator[mycentBin].size()) - 1; ++iqn) { + if (qn > twoDSeparator[mycentBin][iqn] && qn <= twoDSeparator[mycentBin][iqn + 1]) { + qnBin = iqn; + break; + } else { + continue; + } + } + + mQnBin = qnBin; + + if (doFillHisto) { + mHistogramQn->fill(HIST("Event/centFT0CAfter"), centrality); + mHistogramQn->fill(HIST("Event/centVsqn"), centrality, qn); + mHistogramQn->fill(HIST("Event/centVsqnVsSpher"), centrality, qn, fSpher); + mHistogramQn->fill(HIST("Event/qnBin"), qnBin); + if (qnBin >= 0 && qnBin < numQnBins) { + std::get>(qnMults[qnBin])->Fill(mult); + } + } + + return qnBin; + } + + /// \todo to be implemented! + /// Fill cumulants histo for flow calculation + /// Reset hists event-by-event + /// \tparam T1 type of the collision + /// \tparam T2 type of the tracks + /// \param tracks All tracks + template + bool fillCumulants(T1 const& col, T2 const& tracks, float fHarmonic = 2.f) + { + int numOfTracks = col.numContrib(); + if (numOfTracks < 3) + return false; + + mReQthisEvt->Reset(); + mImQthisEvt->Reset(); + mReQ2thisEvt->Reset(); + mImQ2thisEvt->Reset(); + mMQthisEvt->Reset(); + mMQWeightthisEvt->Reset(); + + for (auto const& track : tracks) { + double weight = 1; // Will implement NUA&NUE correction + double phi = track.phi(); + double pt = track.pt(); + double eta = track.eta(); + double cosnphi = weight * TMath::Cos(fHarmonic * phi); + double sinnphi = weight * TMath::Sin(fHarmonic * phi); + double cos2nphi = weight * TMath::Cos(2 * fHarmonic * phi); + double sin2nphi = weight * TMath::Sin(2 * fHarmonic * phi); + mReQthisEvt->Fill(pt, eta, cosnphi); + mImQthisEvt->Fill(pt, eta, sinnphi); + mReQ2thisEvt->Fill(pt, eta, cos2nphi); + mImQ2thisEvt->Fill(pt, eta, sin2nphi); + mMQthisEvt->Fill(pt, eta); + mMQWeightthisEvt->Fill(pt, eta, weight); + } + return true; + } + + /// \todo to be implemented! + /// Do cumulants for flow calculation + /// \tparam T type of the collision + /// \param doQnSeparation to fill flow in divied qn bins + /// \param qnBin should be in 0-9 + /// \param fEtaGap eta gap for flow cumulant + template + void doCumulants(T1 const& col, T2 const& tracks, float centrality, bool doQnSeparation = false, int numQnBins = 10, float fEtaGap = 0.3f, int binPt = 100, int binEta = 32) + { + if (!fillCumulants(col, tracks)) + return; + + if (mMQthisEvt->Integral(1, binPt, 1, binEta) < 2) + return; + + double allReQ = mReQthisEvt->Integral(1, binPt, 1, binEta); + double allImQ = mImQthisEvt->Integral(1, binPt, 1, binEta); + TComplex Q(allReQ, allImQ); + TComplex QStar = TComplex::Conjugate(Q); + + double posEtaRe = mReQthisEvt->Integral(1, binPt, mReQthisEvt->GetYaxis()->FindBin(fEtaGap + 1e-6), binEta); + double posEtaIm = mImQthisEvt->Integral(1, binPt, mImQthisEvt->GetYaxis()->FindBin(fEtaGap + 1e-6), binEta); + if (mMQthisEvt->Integral(1, binPt, mMQthisEvt->GetYaxis()->FindBin(fEtaGap + 1e-6), binEta) < 2) + return; + float posEtaMQ = mMQWeightthisEvt->Integral(1, binPt, mMQthisEvt->GetYaxis()->FindBin(fEtaGap + 1e-6), binEta); + TComplex posEtaQ = TComplex(posEtaRe, posEtaIm); + TComplex posEtaQStar = TComplex::Conjugate(posEtaQ); + + double negEtaRe = mReQthisEvt->Integral(1, binPt, 1, mReQthisEvt->GetYaxis()->FindBin(-1 * fEtaGap - 1e-6)); + double negEtaIm = mImQthisEvt->Integral(1, binPt, 1, mImQthisEvt->GetYaxis()->FindBin(-1 * fEtaGap - 1e-6)); + if (mMQthisEvt->Integral(1, binPt, 1, mMQthisEvt->GetYaxis()->FindBin(-1 * fEtaGap - 1e-6)) < 2) + return; + float negEtaMQ = mMQWeightthisEvt->Integral(1, binPt, 1, mMQthisEvt->GetYaxis()->FindBin(-1 * fEtaGap - 1e-6)); + TComplex negEtaQ = TComplex(negEtaRe, negEtaIm); + TComplex negEtaQStar = TComplex::Conjugate(negEtaQ); + + mHistogramQn->get(HIST("Event/profileC22"))->Fill(centrality, (negEtaQ * posEtaQStar).Re() / (negEtaMQ * posEtaMQ), (negEtaMQ * posEtaMQ)); + if (doQnSeparation && mQnBin >= 0 && mQnBin < numQnBins) { + std::get>(profilesC22[mQnBin])->Fill(centrality, (negEtaQ * posEtaQStar).Re() / (negEtaMQ * posEtaMQ), (negEtaMQ * posEtaMQ)); + } + return; + } + private: HistogramRegistry* mHistogramRegistry = nullptr; ///< For QA output bool mCutsSet = false; ///< Protection against running without cuts @@ -257,6 +499,16 @@ class FemtoDreamCollisionSelection float mZvtxMax = 999.f; ///< Maximal deviation from nominal z-vertex (cm) float mMinSphericity = 0.f; float mSphericityPtmin = 0.f; + int mQnBin = -999; + HistogramRegistry* mHistogramQn = nullptr; ///< For flow cumulant output + std::vector qnMults; /// Histograms of multiplicity (TH1F) per Qn bin. Stored as HistPtr (variant of shared_ptr) from HistogramManager. + std::vector profilesC22; /// Pofile Histograms of c22 per Qn bin + TH2D* mReQthisEvt = nullptr; ///< For flow cumulant in an event + TH2D* mImQthisEvt = nullptr; ///< For flow cumulant in an event + TH2D* mReQ2thisEvt = nullptr; ///< For flow cumulant in an event + TH2D* mImQ2thisEvt = nullptr; ///< For flow cumulant in an event + TH2D* mMQthisEvt = nullptr; ///< For flow cumulant in an event + TH2D* mMQWeightthisEvt = nullptr; ///< For flow cumulant in an event }; } // namespace o2::analysis::femtoDream diff --git a/PWGCF/FemtoDream/Core/femtoDreamContainer.h b/PWGCF/FemtoDream/Core/femtoDreamContainer.h index 3d95fc08311..4e8300c5c9e 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamContainer.h +++ b/PWGCF/FemtoDream/Core/femtoDreamContainer.h @@ -180,6 +180,43 @@ class FemtoDreamContainer } } + /// Initialize the histograms for pairs in divided qn bins + template + void init_base_qn(std::string folderName, std::string femtoObs, + T& femtoObsAxis, T& mTAxi4D, T& multPercentileAxis4D, T& qnAxis4D) + { + mHistogramRegistry->add((folderName + "/relPairkstarmTMultMultPercentileQn").c_str(), ("; " + femtoObs + "; #it{m}_{T} (GeV/#it{c}); Centrality; qn").c_str(), kTHnSparseF, {femtoObsAxis, mTAxi4D, multPercentileAxis4D, qnAxis4D}); + } + + template + void init_qn(HistogramRegistry* registry, + T& kstarBins4D, T& mTBins4D, T& multPercentileBins4D, + bool isMC, float highkstarCut, ConfigurableAxis qnBins4D = {"qnBins4D", {10, 0, 10}, "qn binning"}) + { + mHistogramRegistry = registry; + std::string femtoObs; + if constexpr (mFemtoObs == femtoDreamContainer::Observable::kstar) { + femtoObs = "#it{k*} (GeV/#it{c})"; + } + mHighkstarCut = highkstarCut; + + framework::AxisSpec kstarAxis4D = {kstarBins4D, femtoObs}; + framework::AxisSpec mTAxis4D = {mTBins4D, "#it{m}_{T} (GeV/#it{c})"}; + framework::AxisSpec multPercentileAxis4D = {multPercentileBins4D, "Centralty(%)"}; + framework::AxisSpec qnAxis4D = {qnBins4D, "qn"}; + + std::string folderName = static_cast(mFolderSuffix[mEventType]) + static_cast(o2::aod::femtodreamMCparticle::MCTypeName[o2::aod::femtodreamMCparticle::MCType::kRecon]) + static_cast("_qn"); + + init_base_qn(folderName, femtoObs, + kstarAxis4D, mTAxis4D, multPercentileAxis4D, qnAxis4D); + + if (isMC) { + folderName = static_cast(mFolderSuffix[mEventType]) + static_cast(o2::aod::femtodreamMCparticle::MCTypeName[o2::aod::femtodreamMCparticle::MCType::kTruth]) + static_cast("_qn"); + init_base_qn(folderName, femtoObs, + kstarAxis4D, mTAxis4D, multPercentileAxis4D, qnAxis4D); + } + } + /// Set the PDG codes of the two particles involved /// \param pdg1 PDG code of particle one /// \param pdg2 PDG code of particle two @@ -317,6 +354,56 @@ class FemtoDreamContainer } } + /// Pass a pair to the container and compute all the relevant observables in divided qn bins + template + void setPair_qn_base(const float femtoObs, const float mT, const float multPercentile, const int myQnBin, const int numQnBins = 10) + { + if (myQnBin >= 0 && myQnBin < numQnBins) { + mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("_qn") + HIST("/relPairkstarmTMultMultPercentileQn"), femtoObs, mT, multPercentile, myQnBin); + } else { + return; + } + } + + template + void setPair_qn(T1 const& part1, T2 const& part2, const float multPercentile, const int myQnBin, const int numQnBins = 10) + { + float femtoObs, femtoObsMC; + // Calculate femto observable and the mT with reconstructed information + if constexpr (mFemtoObs == femtoDreamContainer::Observable::kstar) { + femtoObs = FemtoDreamMath::getkstar(part1, mMassOne, part2, mMassTwo); + } + if (mHighkstarCut > 0) { + if (femtoObs > mHighkstarCut) { + return; + } + } + const float mT = FemtoDreamMath::getmT(part1, mMassOne, part2, mMassTwo); + + if (mHistogramRegistry) { + setPair_qn_base(femtoObs, mT, multPercentile, myQnBin, numQnBins); + + if constexpr (isMC) { + if (part1.has_fdMCParticle() && part2.has_fdMCParticle()) { + // calculate the femto observable and the mT with MC truth information + if constexpr (mFemtoObs == femtoDreamContainer::Observable::kstar) { + femtoObsMC = FemtoDreamMath::getkstar(part1.fdMCParticle(), mMassOne, part2.fdMCParticle(), mMassTwo); + } + const float mTMC = FemtoDreamMath::getmT(part1.fdMCParticle(), mMassOne, part2.fdMCParticle(), mMassTwo); + + if (abs(part1.fdMCParticle().pdgMCTruth()) == mPDGOne && abs(part2.fdMCParticle().pdgMCTruth()) == mPDGTwo) { // Note: all pair-histogramms are filled with MC truth information ONLY in case of non-fake candidates + setPair_qn_base(femtoObsMC, mTMC, multPercentile, myQnBin, numQnBins); + } else { + mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[o2::aod::femtodreamMCparticle::MCType::kTruth]) + HIST("/hFakePairsCounter"), 0); + } + + } else { + mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[o2::aod::femtodreamMCparticle::MCType::kTruth]) + HIST("/hNoMCtruthPairsCounter"), 0); + } + } + } + } + protected: HistogramRegistry* mHistogramRegistry = nullptr; ///< For QA output static constexpr std::string_view mFolderSuffix[2] = {"SameEvent", "MixedEvent"}; ///< Folder naming for the output according to mEventType diff --git a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx index 2103cf6f305..900e33127df 100644 --- a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx +++ b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx @@ -60,6 +60,7 @@ namespace o2::aod using FemtoFullCollision = soa::Join::iterator; using FemtoFullCollision_noCent = soa::Join::iterator; using FemtoFullCollision_CentPbPb = soa::Join::iterator; +using FemtoFullCollision_CentPbPb_qvec = soa::Join::iterator; using FemtoFullCollisionMC = soa::Join::iterator; using FemtoFullCollision_noCent_MC = soa::Join::iterator; using FemtoFullCollisionMC_CentPbPb = soa::Join::iterator; @@ -100,6 +101,7 @@ struct femtoDreamProducerTask { Zorro zorro; Produces outputCollision; + Produces outputExtQnCollision; Produces outputMCCollision; Produces outputCollsMCLabels; Produces outputParts; @@ -261,7 +263,8 @@ struct femtoDreamProducerTask { Configurable ConfTrkMaxChi2PerClusterITS{"ConfTrkMaxChi2PerClusterITS", 1000.0f, "Minimal track selection: max allowed chi2 per ITS cluster"}; // 36.0 is default Configurable ConfTrkTPCRefit{"ConfTrkTPCRefit", false, "True: require TPC refit"}; Configurable ConfTrkITSRefit{"ConfTrkITSRefit", false, "True: require ITS refit"}; - + Configurable ConfCutTPCFracSharedCls{"ConfCutTPCFracSharedCls", false, "Cut fraction of shared TPC clusters"}; + Configurable ConfTPCFracSharedClsMax{"ConfTPCFracSharedClsMax", 1000.f, "Maximum value for fraction of shared TPC clusters"}; } OptionTrackSpecialSelections; struct : o2::framework::ConfigurableGroup { @@ -270,11 +273,34 @@ struct femtoDreamProducerTask { Configurable cfgEvtRCTFlagCheckerLimitAcceptAsBad{"cfgEvtRCTFlagCheckerLimitAcceptAsBad", true, "Evt sel: RCT flag checker treat Limited Acceptance As Bad"}; } rctCut; + struct : o2::framework::ConfigurableGroup { + std::string prefix = std::string("qnCal"); + Configurable ConfFlowCalculate{"ConfFlowCalculate", false, "Evt sel: Cumulant of flow"}; // To do + Configurable ConfQnSeparation{"ConfQnSeparation", false, "Evt sel: Qn of event"}; + Configurable> ConfQnBinSeparator{"ConfQnBinSeparator", std::vector{-999.f, -999.f, -999.f}, "Qn bin separator"}; + Configurable ConfdoFillHisto{"ConfdoFillHisto", false, "Fill histos for Qn and sphericity and mult "}; + Configurable ConfCentralityMax{"ConfCentralityMax", 80.f, "Evt sel: Maximum Centrality cut"}; + Configurable ConfCentBinWidth{"ConfCentBinWidth", 1.f, "Centrality bin length for qn separator"}; + Configurable ConfQnBinMin{"ConfQnBinMin", 0, "Minimum qn bin"}; + Configurable ConfNumQnBins{"ConfNumQnBins", 10, "Number of qn bins"}; + } qnCal; + + struct : o2::framework::ConfigurableGroup { + std::string prefix = std::string("OptionEvtSpecialSelections"); + Configurable ConfIsUsePileUpPbPb{"ConfIsUsePileUpPbPb", false, "Required for choosing whether to run the pile-up cuts"}; + Configurable ConfEvNoSameBunchPileup{"ConfEvNoSameBunchPileup", false, "Require kNoSameBunchPileup selection on Events."}; + Configurable ConfEvIsGoodITSLayersAll{"ConfEvIsGoodITSLayersAll", false, "Require kIsGoodITSLayersAll selection on Events."}; + Configurable ConfIsUseOccupancy{"ConfIsUseOccupancy", false, "Required for choosing whether to run the pile-up cuts"}; + Configurable ConfTPCOccupancyMin{"ConfTPCOccupancyMin", 0, "Minimum value for TPC Occupancy selection"}; + Configurable ConfTPCOccupancyMax{"ConfTPCOccupancyMax", 5000, "Maximum value for TPC Occupancy selection"}; + } OptionEvtSpecialSelections; + HistogramRegistry qaRegistry{"QAHistos", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry TrackRegistry{"Tracks", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry V0Registry{"V0", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry ResoRegistry{"Reso", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry CascadeRegistry{"Cascade", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry FlowRegistry{"Qn", {}, OutputObjHandlingPolicy::AnalysisObject}; int mRunNumber; float mMagField; @@ -284,10 +310,10 @@ struct femtoDreamProducerTask { void init(InitContext&) { - if (doprocessData == false && doprocessData_noCentrality == false && doprocessData_CentPbPb == false && doprocessMC == false && doprocessMC_noCentrality == false && doprocessMC_CentPbPb == false) { + if (doprocessData == false && doprocessData_noCentrality == false && doprocessData_CentPbPb == false && doprocessData_CentPbPb_qvec == false && doprocessMC == false && doprocessMC_noCentrality == false && doprocessMC_CentPbPb == false) { LOGF(fatal, "Neither processData nor processMC enabled. Please choose one."); } - if ((doprocessData == true && doprocessMC == true) || (doprocessData == true && doprocessMC_noCentrality == true) || (doprocessMC == true && doprocessMC_noCentrality == true) || (doprocessData_noCentrality == true && doprocessData == true) || (doprocessData_noCentrality == true && doprocessMC == true) || (doprocessData_noCentrality == true && doprocessMC_noCentrality == true) || (doprocessData_CentPbPb == true && doprocessData == true) || (doprocessData_CentPbPb == true && doprocessData_noCentrality == true) || (doprocessData_CentPbPb == true && doprocessMC == true) || (doprocessData_CentPbPb == true && doprocessMC_noCentrality == true) || (doprocessData_CentPbPb == true && doprocessMC_CentPbPb == true)) { + if ((doprocessData == true && doprocessMC == true) || (doprocessData == true && doprocessMC_noCentrality == true) || (doprocessMC == true && doprocessMC_noCentrality == true) || (doprocessData_noCentrality == true && doprocessData == true) || (doprocessData_noCentrality == true && doprocessMC == true) || (doprocessData_noCentrality == true && doprocessMC_noCentrality == true) || (doprocessData_CentPbPb == true && doprocessData == true) || (doprocessData_CentPbPb == true && doprocessData_noCentrality == true) || (doprocessData_CentPbPb == true && doprocessMC == true) || (doprocessData_CentPbPb == true && doprocessMC_noCentrality == true) || (doprocessData_CentPbPb == true && doprocessMC_CentPbPb == true) || (doprocessData_CentPbPb_qvec == true && doprocessData == true) || (doprocessData_CentPbPb_qvec == true && doprocessData_noCentrality == true) || (doprocessData_CentPbPb_qvec == true && doprocessMC == true) || (doprocessData_CentPbPb_qvec == true && doprocessMC_noCentrality == true) || (doprocessData_CentPbPb_qvec == true && doprocessMC_CentPbPb == true) || (doprocessData_CentPbPb_qvec == true && doprocessData_CentPbPb == true)) { LOGF(fatal, "Cannot enable more than one process switch at the same time. " "Please choose one."); @@ -439,6 +465,12 @@ struct femtoDreamProducerTask { } } + if (qnCal.ConfFlowCalculate) { + colCuts.initFlow(&FlowRegistry, qnCal.ConfQnSeparation); + if (qnCal.ConfQnSeparation) + colCuts.initQn(&FlowRegistry, qnCal.ConfNumQnBins); + } + mRunNumber = 0; mMagField = 0.0; /// Initializing CCDB @@ -675,7 +707,7 @@ struct femtoDreamProducerTask { outputCollsMCLabels(-1); } } - template + template void fillCollisionsAndTracksAndV0AndCascade(CollisionType const& col, TrackType const& tracks, TrackTypeWithItsPid const& tracksWithItsPid, V0Type const& fullV0s, CascadeType const& fullCascades) { // If triggering is enabled, select only events which were triggered wit our triggers @@ -733,11 +765,27 @@ struct femtoDreamProducerTask { return; } + // Pileup rejection in PbPb data + if constexpr (analysePbPb) { + if (OptionEvtSpecialSelections.ConfIsUsePileUpPbPb && + !colCuts.isPileUpCollisionPbPb(col, OptionEvtSpecialSelections.ConfEvNoSameBunchPileup, OptionEvtSpecialSelections.ConfEvIsGoodITSLayersAll)) { + return; + } + if (OptionEvtSpecialSelections.ConfIsUseOccupancy && + !colCuts.occupancySelection(col, OptionEvtSpecialSelections.ConfTPCOccupancyMin, OptionEvtSpecialSelections.ConfTPCOccupancyMax)) { + return; + } + } + outputCollision(vtxZ, mult, multNtr, spher, mMagField); if constexpr (isMC) { fillMCCollision(col); } + if constexpr (doFlow) { + fillCollisionsFlow(col, tracks, mult, spher, multNtr); + } + std::vector childIDs = {0, 0}; // these IDs are necessary to keep track of the children std::vector cascadechildIDs = {0, 0, 0}; // these IDs are necessary to keep track of the children std::vector tmpIDtrack; // this vector keeps track of the matching of the primary track table row <-> aod::track table global index @@ -762,6 +810,12 @@ struct femtoDreamProducerTask { continue; } + if constexpr (analysePbPb) { + if (OptionTrackSpecialSelections.ConfCutTPCFracSharedCls && track.tpcFractionSharedCls() > OptionTrackSpecialSelections.ConfTPCFracSharedClsMax) { + continue; + } + } + TrackRegistry.fill(HIST("AnalysisQA/Chi2ITSTPCperCluster"), track.itsChi2NCl(), track.tpcChi2NCl()); TrackRegistry.fill(HIST("AnalysisQA/RefitITSTPC"), track.hasITS(), track.hasTPC()); @@ -1080,6 +1134,25 @@ struct femtoDreamProducerTask { } } + template + void fillCollisionsFlow(CollisionType const& col, TrackType const& tracks, float mult, float spher, float multNtr) + { + float myqn = -999.; + // Calculate and fill qn values + if (qnCal.ConfQnSeparation) { + myqn = colCuts.computeqnVec(col); + outputExtQnCollision(myqn, col.trackOccupancyInTimeRange()); + } + // Calculate flow via cumulant + if (qnCal.ConfFlowCalculate) { + int qnBin = colCuts.myqnBin(mult, qnCal.ConfCentralityMax, qnCal.ConfQnBinSeparator, qnCal.ConfdoFillHisto, spher, myqn, qnCal.ConfNumQnBins, multNtr, qnCal.ConfCentBinWidth); + if (qnBin < qnCal.ConfQnBinMin || qnBin > qnCal.ConfNumQnBins) { + qnBin = -999; + } + colCuts.doCumulants(col, tracks, mult, qnCal.ConfQnSeparation); + } + } + void processData(aod::FemtoFullCollision const& col, aod::BCsWithTimestamps const&, @@ -1093,9 +1166,9 @@ struct femtoDreamProducerTask { auto tracksWithItsPid = soa::Attach(tracks); if (ConfUseItsPid.value) { - fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracksWithItsPid, fullV0s, fullCascades); + fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracksWithItsPid, fullV0s, fullCascades); } else { - fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracks, fullV0s, fullCascades); + fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracks, fullV0s, fullCascades); } } PROCESS_SWITCH(femtoDreamProducerTask, processData, @@ -1114,9 +1187,9 @@ struct femtoDreamProducerTask { auto tracksWithItsPid = soa::Attach(tracks); if (ConfUseItsPid.value) { - fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracksWithItsPid, fullV0s, fullCascades); + fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracksWithItsPid, fullV0s, fullCascades); } else { - fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracks, fullV0s, fullCascades); + fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracks, fullV0s, fullCascades); } } PROCESS_SWITCH(femtoDreamProducerTask, processData_noCentrality, @@ -1134,14 +1207,34 @@ struct femtoDreamProducerTask { auto tracksWithItsPid = soa::Attach(tracks); if (ConfUseItsPid.value) { - fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracksWithItsPid, fullV0s, fullCascades); + fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracksWithItsPid, fullV0s, fullCascades); } else { - fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracks, fullV0s, fullCascades); + fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracks, fullV0s, fullCascades); } } PROCESS_SWITCH(femtoDreamProducerTask, processData_CentPbPb, "Provide experimental data with centrality information for PbPb collisions", false); + void processData_CentPbPb_qvec(aod::FemtoFullCollision_CentPbPb_qvec const& col, + aod::BCsWithTimestamps const&, + aod::FemtoFullTracks const& tracks, + o2::aod::V0Datas const& fullV0s, + o2::aod::CascDatas const& fullCascades) + { + // get magnetic field for run + initCCDB_Mag_Trig(col.bc_as()); + // fill the tables + auto tracksWithItsPid = soa::Attach(tracks); + if (ConfUseItsPid.value) { + fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracksWithItsPid, fullV0s, fullCascades); + } else { + fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracks, fullV0s, fullCascades); + } + } + PROCESS_SWITCH(femtoDreamProducerTask, processData_CentPbPb_qvec, + "Provide experimental data with centrality and q-vector table for PbPb collisions", false); + void processMC(aod::FemtoFullCollisionMC const& col, aod::BCsWithTimestamps const&, soa::Join const& tracks, @@ -1153,7 +1246,7 @@ struct femtoDreamProducerTask { // get magnetic field for run initCCDB_Mag_Trig(col.bc_as()); // fill the tables - fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracks, fullV0s, fullCascades); + fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracks, fullV0s, fullCascades); } PROCESS_SWITCH(femtoDreamProducerTask, processMC, "Provide MC data", false); @@ -1168,7 +1261,7 @@ struct femtoDreamProducerTask { // get magnetic field for run initCCDB_Mag_Trig(col.bc_as()); // fill the tables - fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracks, fullV0s, fullCascades); + fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracks, fullV0s, fullCascades); } PROCESS_SWITCH(femtoDreamProducerTask, processMC_noCentrality, "Provide MC data without requiring a centrality calibration", false); @@ -1183,7 +1276,7 @@ struct femtoDreamProducerTask { // get magnetic field for run initCCDB_Mag_Trig(col.bc_as()); // fill the tables - fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracks, fullV0s, fullCascades); + fillCollisionsAndTracksAndV0AndCascade(col, tracks, tracks, fullV0s, fullCascades); } PROCESS_SWITCH(femtoDreamProducerTask, processMC_CentPbPb, "Provide MC data with centrality information for PbPb collisions", false); }; diff --git a/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackTrack.cxx b/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackTrack.cxx index 6f45f0c2672..beaf7dc471d 100644 --- a/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackTrack.cxx +++ b/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackTrack.cxx @@ -15,28 +15,31 @@ /// \author Georgios Mantzaridis, TU München, georgios.mantzaridis@tum.de /// \author Anton Riedel, TU München, anton.riedel@tum.de -#include -#include -#include -#include -#include "TRandom3.h" +#include "PWGCF/DataModel/FemtoDerived.h" +#include "PWGCF/FemtoDream/Core/femtoDreamCollisionSelection.h" +#include "PWGCF/FemtoDream/Core/femtoDreamContainer.h" +#include "PWGCF/FemtoDream/Core/femtoDreamDetaDphiStar.h" +#include "PWGCF/FemtoDream/Core/femtoDreamEventHisto.h" +#include "PWGCF/FemtoDream/Core/femtoDreamPairCleaner.h" +#include "PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h" +#include "PWGCF/FemtoDream/Core/femtoDreamUtils.h" + +#include "Framework/ASoAHelpers.h" #include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" +#include "Framework/Configurable.h" +#include "Framework/Expressions.h" #include "Framework/HistogramRegistry.h" -#include "Framework/ASoAHelpers.h" +#include "Framework/O2DatabasePDGPlugin.h" #include "Framework/RunningWorkflowInfo.h" #include "Framework/StepTHn.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "Framework/Configurable.h" -#include "Framework/Expressions.h" +#include "Framework/runDataProcessing.h" -#include "PWGCF/DataModel/FemtoDerived.h" -#include "PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h" -#include "PWGCF/FemtoDream/Core/femtoDreamEventHisto.h" -#include "PWGCF/FemtoDream/Core/femtoDreamPairCleaner.h" -#include "PWGCF/FemtoDream/Core/femtoDreamContainer.h" -#include "PWGCF/FemtoDream/Core/femtoDreamDetaDphiStar.h" -#include "PWGCF/FemtoDream/Core/femtoDreamUtils.h" +#include "TRandom3.h" + +#include +#include +#include +#include using namespace o2::aod; using namespace o2::soa; @@ -82,10 +85,26 @@ struct femtoDreamPairTaskTrackTrack { Filter EventMultiplicity = aod::femtodreamcollision::multNtr >= EventSel.MultMin && aod::femtodreamcollision::multNtr <= EventSel.MultMax && aod::femtodreamcollision::sphericity >= EventSel.SphericityMin; Filter EventMultiplicityPercentile = aod::femtodreamcollision::multV0M >= EventSel.MultPercentileMin && aod::femtodreamcollision::multV0M <= EventSel.MultPercentileMax; + /// qn-separator + FemtoDreamCollisionSelection qnBinCalculator; + struct : ConfigurableGroup { + std::string prefix = std::string("qnCal"); + Configurable doQnSeparation{"doQnSeparation", false, "Do qn separation"}; + Configurable> qnBinSeparator{"qnBinSeparator", std::vector{-999.f, -999.f, -999.f}, "Qn bin separator"}; + Configurable doFillHisto{"doFillHisto", false, "Fill histos for Qn and sphericity and mult "}; + Configurable storeEvtTrkInfo{"storeEvtTrkInfo", false, "Fill info of track1 and track2 while pariing in divided qn bins"}; + Configurable numQnBins{"numQnBins", 10, "Number of qn bins"}; + Configurable qnBinMin{"qnBinMin", 0, "Number of qn bins"}; + Configurable centMax{"centMax", 80.f, "Evt sel: Maximum Centrality cut"}; + Configurable centBinWidth{"centBinWidth", 1.f, "Centrality bin length for qn separator"}; + } qnCal; + using FilteredCollisions = soa::Filtered; using FilteredCollision = FilteredCollisions::iterator; using FilteredMCCollisions = soa::Filtered>; using FilteredMCCollision = FilteredMCCollisions::iterator; + using FilteredQnCollisions = soa::Filtered>; + using FilteredQnCollision = FilteredQnCollisions::iterator; using FilteredMaskedCollisions = soa::Filtered>; using FilteredMaskedCollision = FilteredMaskedCollisions::iterator; @@ -213,19 +232,25 @@ struct femtoDreamPairTaskTrackTrack { ConfigurableAxis MultMixBins{"MultMixBins", {VARIABLE_WIDTH, 0.0f, 4.0f, 8.0f, 12.0f, 16.0f, 20.0f, 24.0f, 28.0f, 32.0f, 36.0f, 40.0f, 44.0f, 48.0f, 52.0f, 56.0f, 60.0f, 64.0f, 68.0f, 72.0f, 76.0f, 80.0f, 84.0f, 88.0f, 92.0f, 96.0f, 100.0f, 200.0f}, "Mixing bins - multiplicity"}; ConfigurableAxis MultPercentileMixBins{"MultPercentileMixBins", {VARIABLE_WIDTH, 0.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.0f}, "Mixing bins - multiplicity percentile"}; ConfigurableAxis VztxMixBins{"VztxMixBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; + ConfigurableAxis QnMixBins{"QnMixBins", {VARIABLE_WIDTH, 0.50f, 68.50f, 100.50f, 126.50f, 151.50f, 176.50f, 203.50f, 232.50f, 269.50f, 322.50f, 833.50f}, "Mixing bins - qn-value"}; Configurable Depth{"Depth", 5, "Number of events for mixing"}; - Configurable Policy{"Policy", 0, "Binning policy for mixing - 0: multiplicity, 1: multipliciy percentile, 2: both"}; + Configurable Policy{"Policy", 0, "Binning policy for mixing - 0: multiplicity, 1: multipliciy percentile, 2: both, 3: multipliciy percentile and qn value"}; } Mixing; ColumnBinningPolicy colBinningMult{{Mixing.VztxMixBins, Mixing.MultMixBins}, true}; ColumnBinningPolicy colBinningMultPercentile{{Mixing.VztxMixBins, Mixing.MultPercentileMixBins}, true}; ColumnBinningPolicy colBinningMultMultPercentile{{Mixing.VztxMixBins, Mixing.MultMixBins, Mixing.MultPercentileMixBins}, true}; + ColumnBinningPolicy colBinningMultPercentileqn{{Mixing.VztxMixBins, Mixing.MultPercentileMixBins, Mixing.QnMixBins}, true}; FemtoDreamContainer sameEventCont; FemtoDreamContainer mixedEventCont; FemtoDreamPairCleaner pairCleaner; FemtoDreamDetaDphiStar pairCloseRejectionSE; FemtoDreamDetaDphiStar pairCloseRejectionME; + + // Container for correlation functions in devided qn bins + FemtoDreamContainer sameEventQnCont; + /// Histogram output HistogramRegistry Registry{"Output", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -238,6 +263,7 @@ struct femtoDreamPairTaskTrackTrack { colBinningMult = {{Mixing.VztxMixBins, Mixing.MultMixBins}, true}; colBinningMultPercentile = {{Mixing.VztxMixBins, Mixing.MultPercentileMixBins}, true}; colBinningMultMultPercentile = {{Mixing.VztxMixBins, Mixing.MultMixBins, Mixing.MultPercentileMixBins}, true}; + colBinningMultPercentileqn = {{Mixing.VztxMixBins, Mixing.MultPercentileMixBins, Mixing.QnMixBins}, true}; if (Option.RandomizePair.value) { random = new TRandom3(0); @@ -268,6 +294,15 @@ struct femtoDreamPairTaskTrackTrack { pairCloseRejectionME.init(&Registry, &Registry, Option.CPRdeltaPhiMax.value, Option.CPRdeltaEtaMax.value, Option.CPRPlotPerRadii.value, 2, Option.CPROld.value); } + if (qnCal.doQnSeparation) { + sameEventQnCont.init_qn(&Registry, + Binning4D.kstar, Binning4D.mT, Binning4D.multPercentile, + Option.IsMC, Option.HighkstarCut); + if (qnCal.doFillHisto) { + qnBinCalculator.initQn(&Registry, qnCal.numQnBins); + } + } + // get bit for the collision mask std::bitset<8 * sizeof(femtodreamcollision::BitMaskType)> mask; int index = 0; @@ -307,7 +342,11 @@ struct femtoDreamPairTaskTrackTrack { } } if ((doprocessSameEvent && doprocessSameEventMasked) || + (doprocessSameEvent && doprocessSameEventQn) || + (doprocessSameEventMasked && doprocessSameEventQn) || (doprocessMixedEvent && doprocessMixedEventMasked) || + (doprocessMixedEvent && doprocessMixedEventQn) || + (doprocessMixedEventMasked && doprocessMixedEventQn) || (doprocessSameEventMC && doprocessSameEventMCMasked) || (doprocessMixedEventMC && doprocessMixedEventMCMasked)) { LOG(fatal) << "Normal and masked processing cannot be activated simultaneously!"; @@ -618,8 +657,110 @@ struct femtoDreamPairTaskTrackTrack { } } PROCESS_SWITCH(femtoDreamPairTaskTrackTrack, processMixedEventMCMasked, "Enable processing mixed events MC with masked collisions", false); -}; + /// This function processes the same event in divided qn bins + /// col.multV0M() get the event centrality from ft0c for PbPb data + template + void doSameEventQn(PartitionType SliceTrk1, PartitionType SliceTrk2, PartType parts, Collision col) + { + if (qnCal.storeEvtTrkInfo) { + for (auto& part : SliceTrk1) { + trackHistoPartOne.fillQA(part, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + } + + if (!Option.SameSpecies.value) { + for (auto& part : SliceTrk2) { + trackHistoPartTwo.fillQA(part, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + } + } + } + + auto myqnBin = qnBinCalculator.myqnBin(col.multV0M(), qnCal.centMax, qnCal.qnBinSeparator, qnCal.doFillHisto, col.sphericity(), col.qnVal(), qnCal.numQnBins, col.multNtr(), qnCal.centBinWidth); + if (myqnBin < qnCal.qnBinMin || myqnBin > qnCal.numQnBins) { + myqnBin = -999; + } + + /// Now build the combinations + float rand = 0.; + if (Option.SameSpecies.value) { + for (auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(SliceTrk1, SliceTrk2))) { + if (Option.CPROn.value) { + if (pairCloseRejectionSE.isClosePair(p1, p2, parts, col.magField())) { + continue; + } + } + // track cleaning + if (!pairCleaner.isCleanPair(p1, p2, parts)) { + continue; + } + if (Option.RandomizePair.value) { + rand = random->Rndm(); + } + if (rand <= 0.5) { + sameEventQnCont.setPair_qn(p1, p2, col.multV0M(), myqnBin, qnCal.numQnBins); + } else { + sameEventQnCont.setPair_qn(p2, p1, col.multV0M(), myqnBin, qnCal.numQnBins); + } + } + } else { + for (auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(SliceTrk1, SliceTrk2))) { + if (Option.CPROn.value) { + if (pairCloseRejectionSE.isClosePair(p1, p2, parts, col.magField())) { + continue; + } + } + // track cleaning + if (!pairCleaner.isCleanPair(p1, p2, parts)) { + continue; + } + sameEventQnCont.setPair_qn(p1, p2, col.multV0M(), myqnBin, qnCal.numQnBins); + } + } + } + + /// process function for to call doSameEventQn with Data + /// \param col subscribe to the collision table (Data) + /// \param parts subscribe to the femtoDreamParticleTable + void processSameEventQn(FilteredQnCollision& col, o2::aod::FDParticles& parts) + { + if (qnCal.storeEvtTrkInfo) { + fillCollision(col); + } + auto SliceTrk1 = PartitionTrk1->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); + auto SliceTrk2 = PartitionTrk2->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); + if (SliceTrk1.size() == 0 && SliceTrk2.size() == 0) { + return; + } + if (qnCal.doQnSeparation) { + doSameEventQn(SliceTrk1, SliceTrk2, parts, col); + } + } + PROCESS_SWITCH(femtoDreamPairTaskTrackTrack, processSameEventQn, "Enable processing same event in divided qn bins", false); + + /// process function for to call doMixedEvent with Data + /// @param cols subscribe to the collisions table (Data) + /// @param parts subscribe to the femtoDreamParticleTable + void processMixedEventQn(FilteredQnCollisions& cols, o2::aod::FDParticles& parts) + { + switch (Mixing.Policy.value) { + case femtodreamcollision::kMult: + doMixedEvent_NotMasked(cols, parts, PartitionTrk1, PartitionTrk2, colBinningMult); + break; + case femtodreamcollision::kMultPercentile: + doMixedEvent_NotMasked(cols, parts, PartitionTrk1, PartitionTrk2, colBinningMultPercentile); + break; + case femtodreamcollision::kMultMultPercentile: + doMixedEvent_NotMasked(cols, parts, PartitionTrk1, PartitionTrk2, colBinningMultMultPercentile); + break; + case femtodreamcollision::kMultPercentileQn: + doMixedEvent_NotMasked(cols, parts, PartitionTrk1, PartitionTrk2, colBinningMultPercentileqn); + break; + default: + LOG(fatal) << "Invalid binning policiy specifed. Breaking..."; + } + } + PROCESS_SWITCH(femtoDreamPairTaskTrackTrack, processMixedEventQn, "Enable processing mixed events", false); +}; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { WorkflowSpec workflow{ From 3cc06fda0dccdbdba5382d10e440f0d9159e5f48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= <26327373+vkucera@users.noreply.github.com> Date: Wed, 17 Sep 2025 13:27:05 +0200 Subject: [PATCH 423/986] [PWGHF] Improve skimming code (#12998) --- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 710 +++++++++--------- 1 file changed, 357 insertions(+), 353 deletions(-) diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index 8bfd706500a..dcd13a07c01 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -77,8 +77,9 @@ #include #include // std::distance #include -#include // std::string -#include // std::vector +#include // std::string +#include // std::forward +#include // std::vector using namespace o2; using namespace o2::analysis; @@ -133,13 +134,13 @@ struct HfTrackIndexSkimCreatorTagSelCollisions { void init(InitContext const&) { - std::array doProcess = {doprocessTrigAndCentFT0ASel, doprocessTrigAndCentFT0CSel, doprocessTrigAndCentFT0MSel, doprocessTrigAndCentFV0ASel, doprocessTrigSel, doprocessNoTrigSel, doprocessUpcSel}; + const std::array doProcess = {doprocessTrigAndCentFT0ASel, doprocessTrigAndCentFT0CSel, doprocessTrigAndCentFT0MSel, doprocessTrigAndCentFV0ASel, doprocessTrigSel, doprocessNoTrigSel, doprocessUpcSel}; if (std::accumulate(doProcess.begin(), doProcess.end(), 0) != 1) { LOGP(fatal, "One and only one process function for collision selection can be enabled at a time!"); } // set numerical value of the Run 2 trigger class - auto triggerAlias = std::find(aliasLabels, aliasLabels + kNaliases, triggerClassName.value.data()); + const auto triggerAlias = std::find(aliasLabels, aliasLabels + kNaliases, triggerClassName.value.data()); if (triggerAlias != aliasLabels + kNaliases) { hfEvSel.triggerClass.value = std::distance(aliasLabels, triggerAlias); } @@ -148,7 +149,7 @@ struct HfTrackIndexSkimCreatorTagSelCollisions { hfEvSel.addHistograms(registry); // collision monitoring if (doprocessTrigAndCentFT0ASel || doprocessTrigAndCentFT0CSel || doprocessTrigAndCentFT0MSel || doprocessTrigAndCentFV0ASel) { - AxisSpec axisCentrality{200, 0., 100., "centrality percentile"}; + const AxisSpec axisCentrality{200, 0., 100., "centrality percentile"}; registry.add("hCentralitySelected", "Centrality percentile of selected events in the centrality interval; centrality percentile;entries", {HistType::kTH1D, {axisCentrality}}); registry.add("hCentralityRejected", "Centrality percentile of selected events outside the centrality interval; centrality percentile;entries", {HistType::kTH1D, {axisCentrality}}); } @@ -158,13 +159,14 @@ struct HfTrackIndexSkimCreatorTagSelCollisions { /// Collision selection /// \param collision collision table with template - void selectCollision(const Col& collision, const BCsType& bcs) + void selectCollision(const Col& collision, + const BCsType& bcs) { - float centrality = -1.f; + float centrality{-1.f}; o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; if constexpr (applyUpcSel) { - rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc( + rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc( collision, centrality, ccdb, registry, bcs); } else { rejectionMask = hfEvSel.getHfCollisionRejectionMask( @@ -259,6 +261,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { Produces tabPvRefitTrack; struct : ConfigurableGroup { + double etaMinDefault{-99999.}; Configurable isRun2{"isRun2", false, "enable Run 2 or Run 3 GRP objects for magnetic field"}; Configurable doPvRefit{"doPvRefit", false, "do PV refit excluding the considered track"}; Configurable fillHistograms{"fillHistograms", true, "fill histograms"}; @@ -274,29 +277,29 @@ struct HfTrackIndexSkimCreatorTagSelTracks { // 2-prong cuts Configurable ptMinTrack2Prong{"ptMinTrack2Prong", -1., "min. track pT for 2 prong candidate"}; Configurable> cutsTrack2Prong{"cutsTrack2Prong", {hf_cuts_single_track::CutsTrack[0], hf_cuts_single_track::NBinsPtTrack, hf_cuts_single_track::NCutVarsTrack, hf_cuts_single_track::labelsPtTrack, hf_cuts_single_track::labelsCutVarTrack}, "Single-track selections per pT bin for 2-prong candidates"}; - Configurable etaMinTrack2Prong{"etaMinTrack2Prong", -99999., "min. pseudorapidity for 2 prong candidate"}; + Configurable etaMinTrack2Prong{"etaMinTrack2Prong", std::forward(etaMinDefault), "min. pseudorapidity for 2 prong candidate"}; Configurable etaMaxTrack2Prong{"etaMaxTrack2Prong", 4., "max. pseudorapidity for 2 prong candidate"}; // 3-prong cuts Configurable ptMinTrack3Prong{"ptMinTrack3Prong", -1., "min. track pT for 3 prong candidate"}; Configurable> cutsTrack3Prong{"cutsTrack3Prong", {hf_cuts_single_track::CutsTrack[0], hf_cuts_single_track::NBinsPtTrack, hf_cuts_single_track::NCutVarsTrack, hf_cuts_single_track::labelsPtTrack, hf_cuts_single_track::labelsCutVarTrack}, "Single-track selections per pT bin for 3-prong candidates"}; - Configurable etaMinTrack3Prong{"etaMinTrack3Prong", -99999., "min. pseudorapidity for 3 prong candidate"}; + Configurable etaMinTrack3Prong{"etaMinTrack3Prong", std::forward(etaMinDefault), "min. pseudorapidity for 3 prong candidate"}; Configurable etaMaxTrack3Prong{"etaMaxTrack3Prong", 4., "max. pseudorapidity for 3 prong candidate"}; // bachelor cuts (V0 + bachelor decays) Configurable ptMinTrackBach{"ptMinTrackBach", 0.3, "min. track pT for bachelor in cascade candidate"}; // 0.5 for PbPb 2015? Configurable> cutsTrackBach{"cutsTrackBach", {hf_cuts_single_track::CutsTrack[0], hf_cuts_single_track::NBinsPtTrack, hf_cuts_single_track::NCutVarsTrack, hf_cuts_single_track::labelsPtTrack, hf_cuts_single_track::labelsCutVarTrack}, "Single-track selections per pT bin for the bachelor of V0-bachelor candidates"}; - Configurable etaMinTrackBach{"etaMinTrackBach", -99999., "min. pseudorapidity for bachelor in cascade candidate"}; + Configurable etaMinTrackBach{"etaMinTrackBach", std::forward(etaMinDefault), "min. pseudorapidity for bachelor in cascade candidate"}; Configurable etaMaxTrackBach{"etaMaxTrackBach", 0.8, "max. pseudorapidity for bachelor in cascade candidate"}; // bachelor cuts (cascade + bachelor decays) Configurable ptMinTrackBachLfCasc{"ptMinTrackBachLfCasc", 0.1, "min. track pT for bachelor in cascade + bachelor decays"}; // 0.5 for PbPb 2015? Configurable> cutsTrackBachLfCasc{"cutsTrackBachLfCasc", {hf_cuts_single_track::CutsTrack[0], hf_cuts_single_track::NBinsPtTrack, hf_cuts_single_track::NCutVarsTrack, hf_cuts_single_track::labelsPtTrack, hf_cuts_single_track::labelsCutVarTrack}, "Single-track selections per pT bin for the bachelor in cascade + bachelor decays"}; - Configurable etaMinTrackBachLfCasc{"etaMinTrackBachLfCasc", -99999., "min. pseudorapidity for bachelor in cascade + bachelor decays"}; + Configurable etaMinTrackBachLfCasc{"etaMinTrackBachLfCasc", std::forward(etaMinDefault), "min. pseudorapidity for bachelor in cascade + bachelor decays"}; Configurable etaMaxTrackBachLfCasc{"etaMaxTrackBachLfCasc", 1.1, "max. pseudorapidity for bachelor in cascade + bachelor decays"}; Configurable useIsGlobalTrackForBachLfCasc{"useIsGlobalTrackForBachLfCasc", false, "check isGlobalTrack status for bachelor in cascade + bachelor decays"}; Configurable useIsGlobalTrackWoDCAForBachLfCasc{"useIsGlobalTrackWoDCAForBachLfCasc", false, "check isGlobalTrackWoDCA status for bachelor in cascade + bachelor decays"}; Configurable useIsQualityTrackITSForBachLfCasc{"useIsQualityTrackITSForBachLfCasc", true, "check isQualityTrackITS status for bachelor in cascade + bachelor decays"}; // soft pion cuts for D* Configurable ptMinSoftPionForDstar{"ptMinSoftPionForDstar", 0.05, "min. track pT for soft pion in D* candidate"}; - Configurable etaMinSoftPionForDstar{"etaMinSoftPionForDstar", -99999., "min. pseudorapidity for soft pion in D* candidate"}; + Configurable etaMinSoftPionForDstar{"etaMinSoftPionForDstar", std::forward(etaMinDefault), "min. pseudorapidity for soft pion in D* candidate"}; Configurable etaMaxSoftPionForDstar{"etaMaxSoftPionForDstar", 0.8, "max. pseudorapidity for soft pion in D* candidate"}; Configurable> cutsTrackDstar{"cutsTrackDstar", {hf_cuts_single_track::CutsTrackPrimary[0], hf_cuts_single_track::NBinsPtTrack, hf_cuts_single_track::NCutVarsTrack, hf_cuts_single_track::labelsPtTrack, hf_cuts_single_track::labelsCutVarTrack}, "Single-track selections per pT bin for the soft pion of D* candidates"}; Configurable useIsGlobalTrackForSoftPion{"useIsGlobalTrackForSoftPion", false, "check isGlobalTrack status for soft pion tracks"}; @@ -330,9 +333,9 @@ struct HfTrackIndexSkimCreatorTagSelTracks { // single-track cuts static const int nCuts = 4; // array of 2-prong and 3-prong cuts - std::array, CandidateType::NCandidateTypes> cutsSingleTrack; + std::array, CandidateType::NCandidateTypes> cutsSingleTrack{}; // proton PID, if enabled - std::array selectorProton; + std::array selectorProton{}; TrackSelectorKa selectorKaon; Partition pvContributors = ((aod::track::flags & static_cast(aod::track::PVContributor)) == static_cast(aod::track::PVContributor)); @@ -349,26 +352,26 @@ struct HfTrackIndexSkimCreatorTagSelTracks { void init(InitContext const&) { - std::array doProcess = {doprocessNoPid, doprocessProtonPidTpc, doprocessProtonPidTof, doprocessProtonPidTpcOrTof, doprocessProtonPidTpcAndTof}; + const std::array doProcess = {doprocessNoPid, doprocessProtonPidTpc, doprocessProtonPidTof, doprocessProtonPidTpcOrTof, doprocessProtonPidTpcAndTof}; if (std::accumulate(doProcess.begin(), doProcess.end(), 0) != 1) { LOGP(fatal, "One and only one process function for the different PID selection strategies can be enabled at a time!"); } cutsSingleTrack = {config.cutsTrack2Prong, config.cutsTrack3Prong, config.cutsTrackBach, config.cutsTrackDstar, config.cutsTrackBachLfCasc}; - if (config.etaMinTrack2Prong == -99999.) { + if (config.etaMinTrack2Prong == config.etaMinDefault) { config.etaMinTrack2Prong.value = -config.etaMaxTrack2Prong; } - if (config.etaMinTrack3Prong == -99999.) { + if (config.etaMinTrack3Prong == config.etaMinDefault) { config.etaMinTrack3Prong.value = -config.etaMaxTrack3Prong; } - if (config.etaMinTrackBach == -99999.) { + if (config.etaMinTrackBach == config.etaMinDefault) { config.etaMinTrackBach.value = -config.etaMaxTrackBach; } - if (config.etaMinSoftPionForDstar == -99999.) { + if (config.etaMinSoftPionForDstar == config.etaMinDefault) { config.etaMinSoftPionForDstar.value = -config.etaMaxSoftPionForDstar; } - if (config.etaMinTrackBachLfCasc == -99999.) { + if (config.etaMinTrackBachLfCasc == config.etaMinDefault) { config.etaMinTrackBachLfCasc.value = -config.etaMaxTrackBachLfCasc; } @@ -398,8 +401,8 @@ struct HfTrackIndexSkimCreatorTagSelTracks { registry.add("hDCAToPrimXYVsPtCutsCascadeBachelor", "tracks selected for cascade-bachelor vertexing;#it{p}_{T}^{track} (GeV/#it{c});DCAxy to prim. vtx. (cm);entries", {HistType::kTH2D, {{360, 0., 36.}, {400, -2., 2.}}}); registry.add("hEtaCutsCascadeBachelor", "tracks selected for cascade-bachelor vertexing;#it{#eta};entries", {HistType::kTH1D, {{static_cast(0.6 * (config.etaMaxTrackBachLfCasc - config.etaMinTrackBachLfCasc) * 100), -1.2 * config.etaMinTrackBachLfCasc, 1.2 * config.etaMaxTrackBachLfCasc}}}); - std::string cutNames[nCuts + 1] = {"selected", "rej pT", "rej eta", "rej track quality", "rej dca"}; - std::string candNames[CandidateType::NCandidateTypes] = {"2-prong", "3-prong", "bachelor", "dstar", "lfCascBachelor"}; + const std::string cutNames[nCuts + 1] = {"selected", "rej pT", "rej eta", "rej track quality", "rej dca"}; + const std::string candNames[CandidateType::NCandidateTypes] = {"2-prong", "3-prong", "bachelor", "dstar", "lfCascBachelor"}; for (int iCandType = 0; iCandType < CandidateType::NCandidateTypes; iCandType++) { for (int iCut = 0; iCut < nCuts + 1; iCut++) { registry.get(HIST("hRejTracks"))->GetXaxis()->SetBinLabel((nCuts + 1) * iCandType + iCut + 1, Form("%s %s", candNames[iCandType].data(), cutNames[iCut].data())); @@ -410,16 +413,16 @@ struct HfTrackIndexSkimCreatorTagSelTracks { // Needed for PV refitting if (config.doPvRefit) { if (config.fillHistograms) { - AxisSpec axisCollisionX{100, -20.f, 20.f, "X (cm)"}; - AxisSpec axisCollisionY{100, -20.f, 20.f, "Y (cm)"}; - AxisSpec axisCollisionZ{100, -20.f, 20.f, "Z (cm)"}; - AxisSpec axisCollisionXOriginal{100, -2.f, 2.f, "X original PV (cm)"}; - AxisSpec axisCollisionYOriginal{100, -2.f, 2.f, "Y original PV (cm)"}; - AxisSpec axisCollisionZOriginal{100, -2.f, 2.f, "Z original PV (cm)"}; - AxisSpec axisCollisionNContrib{1000, 0, 1000, "Number of contributors"}; - AxisSpec axisCollisionDeltaX{axisPvRefitDeltaX, "#Delta x_{PV} (cm)"}; - AxisSpec axisCollisionDeltaY{axisPvRefitDeltaY, "#Delta y_{PV} (cm)"}; - AxisSpec axisCollisionDeltaZ{axisPvRefitDeltaZ, "#Delta z_{PV} (cm)"}; + const AxisSpec axisCollisionX{100, -20.f, 20.f, "X (cm)"}; + const AxisSpec axisCollisionY{100, -20.f, 20.f, "Y (cm)"}; + const AxisSpec axisCollisionZ{100, -20.f, 20.f, "Z (cm)"}; + const AxisSpec axisCollisionXOriginal{100, -2.f, 2.f, "X original PV (cm)"}; + const AxisSpec axisCollisionYOriginal{100, -2.f, 2.f, "Y original PV (cm)"}; + const AxisSpec axisCollisionZOriginal{100, -2.f, 2.f, "Z original PV (cm)"}; + const AxisSpec axisCollisionNContrib{1000, 0, 1000, "Number of contributors"}; + const AxisSpec axisCollisionDeltaX{axisPvRefitDeltaX, "#Delta x_{PV} (cm)"}; + const AxisSpec axisCollisionDeltaY{axisPvRefitDeltaY, "#Delta y_{PV} (cm)"}; + const AxisSpec axisCollisionDeltaZ{axisPvRefitDeltaZ, "#Delta z_{PV} (cm)"}; registry.add("PvRefit/hVerticesPerTrack", "", kTH1D, {{3, 0.5f, 3.5f, ""}}); registry.get(HIST("PvRefit/hVerticesPerTrack"))->GetXaxis()->SetBinLabel(1, "All PV"); @@ -464,7 +467,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { template uint8_t isSelectedPid(const T& hfTrack) { - std::array statusPid = {TrackSelectorPID::Accepted, TrackSelectorPID::Accepted, TrackSelectorPID::Accepted, TrackSelectorPID::Accepted}; + std::array statusPid{TrackSelectorPID::Accepted, TrackSelectorPID::Accepted, TrackSelectorPID::Accepted, TrackSelectorPID::Accepted}; if constexpr (pidStrategy == ProtonPidStrategy::PidTofOnly) { if (hfTrack.hasTOF()) { for (auto iChannel{0u}; iChannel < ChannelsProtonPid::NChannelsProtonPid; ++iChannel) { @@ -600,7 +603,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { hasGoodQuality = false; } } else { - UChar_t clustermap = hfTrack.itsClusterMap(); + const auto clustermap = hfTrack.itsClusterMap(); if (!(hfTrack.tpcNClsFound() >= config.tpcNClsFoundMin.value && // is this the number of TPC clusters? It should not be used TESTBIT(hfTrack.flags(), o2::aod::track::ITSrefit) && (TESTBIT(clustermap, 0) || TESTBIT(clustermap, 1)))) { @@ -636,7 +639,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { hasGoodQuality = false; } } else { // selections for Run2 converted data - UChar_t clustermap = hfTrack.itsClusterMap(); + const auto clustermap = hfTrack.itsClusterMap(); if (!(TESTBIT(hfTrack.flags(), o2::aod::track::ITSrefit) && (TESTBIT(clustermap, 0) || TESTBIT(clustermap, 1)))) { hasGoodQuality = false; } @@ -665,7 +668,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { hasGoodQuality = false; } } else { // selections for Run2 converted data - UChar_t clustermap = hfTrack.itsClusterMap(); + const auto clustermap = hfTrack.itsClusterMap(); if (!(TESTBIT(hfTrack.flags(), o2::aod::track::ITSrefit) && (TESTBIT(clustermap, 0) || TESTBIT(clustermap, 1)))) { hasGoodQuality = false; } @@ -739,8 +742,8 @@ struct HfTrackIndexSkimCreatorTagSelTracks { template void performPvRefitTrack(aod::Collision const& collision, aod::BCsWithTimestamps const&, - std::vector vecPvContributorGlobId, - std::vector vecPvContributorTrackParCov, + std::vector const& vecPvContributorGlobId, + std::vector const& vecPvContributorTrackParCov, TTrack const& trackToRemove, std::array& pvCoord, std::array& pvCovMatrix, @@ -750,7 +753,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { /// Prepare the vertex refitting // set the magnetic field from CCDB - auto bc = collision.bc_as(); + const auto bc = collision.bc_as(); initCCDB(bc, runNumber, ccdb, config.isRun2 ? config.ccdbPathGrp : config.ccdbPathGrpMag, lut, config.isRun2); /*if (runNumber != bc.runNumber()) { @@ -787,7 +790,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { o2::vertexing::PVertexer vertexer; o2::conf::ConfigurableParam::updateFromString("pvertexer.useMeanVertexConstraint=false"); /// remove diamond constraint (let's keep it at the moment...) vertexer.init(); - bool pvRefitDoable = vertexer.prepareVertexRefit(vecPvContributorTrackParCov, primVtx); + const bool pvRefitDoable = vertexer.prepareVertexRefit(vecPvContributorTrackParCov, primVtx); if (!pvRefitDoable) { LOG(info) << "Not enough tracks accepted for the refit"; if (config.doPvRefit && config.fillHistograms) { @@ -809,7 +812,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { bool recalcImpPar = false; if (config.doPvRefit && pvRefitDoable) { recalcImpPar = true; - auto trackIterator = std::find(vecPvContributorGlobId.begin(), vecPvContributorGlobId.end(), trackToRemove.globalIndex()); /// track global index + const auto trackIterator = std::find(vecPvContributorGlobId.begin(), vecPvContributorGlobId.end(), trackToRemove.globalIndex()); /// track global index if (trackIterator != vecPvContributorGlobId.end()) { /// this track contributed to the PV fit: let's do the refit without it @@ -817,7 +820,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { vecPvRefitContributorUsed[entry] = false; /// remove the track from the PV refitting - auto primVtxRefitted = vertexer.refitVertex(vecPvRefitContributorUsed, primVtx); // vertex refit + const auto primVtxRefitted = vertexer.refitVertex(vecPvRefitContributorUsed, primVtx); // vertex refit // LOG(info) << "refit " << cnt << "/" << ntr << " result = " << primVtxRefitted.asString(); if (config.debugPvRefit) { LOG(info) << "refit for track with global index " << static_cast(trackToRemove.globalIndex()) << " " << primVtxRefitted.asString(); @@ -870,7 +873,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { /// Track propagation to the PV refit considering also the material budget /// Mandatory for tracks updated at most only to the innermost ITS layer auto trackPar = getTrackPar(trackToRemove); - std::array dcaInfo{-999., -999.}; + std::array dcaInfo{-999.f, -999.f}; if (o2::base::Propagator::Instance()->propagateToDCABxByBz({primVtxBaseRecalc.getX(), primVtxBaseRecalc.getY(), primVtxBaseRecalc.getZ()}, trackPar, 2.f, noMatCorr, &dcaInfo)) { pvCoord[0] = primVtxBaseRecalc.getX(); pvCoord[1] = primVtxBaseRecalc.getY(); @@ -907,20 +910,17 @@ struct HfTrackIndexSkimCreatorTagSelTracks { // // TODO: add DCAxy and DCAz uncertainties? // } } - - return; } /// end of performPvRefitTrack function /// Selection tag for tracks + /// \tparam TTracks is the type of the track table /// \param collision is the collision iterator - /// \param tracks is the entire track table /// \param trackIndicesCollision are the track indices associated to this collision (from track-to-collision-associator) /// \param pvContrCollision are the PV contributors of this collision /// \param bcWithTimeStamps is the bc with timestamp for PVrefit /// \param pvRefitDcaPerTrack is a vector to be filled with track dcas after PV refit /// \param pvRefitPvCoordPerTrack is a vector to be filled with PV coordinates after PV refit /// \param pvRefitPvCovMatrixPerTrack is a vector to be filled with PV coordinate covariances after PV refit - /// \return true if the track is compatible with a proton hypothesis template void runTagSelTracks(aod::Collision const& collision, TTracks const&, @@ -931,17 +931,16 @@ struct HfTrackIndexSkimCreatorTagSelTracks { std::vector>& pvRefitPvCoordPerTrack, std::vector>& pvRefitPvCovMatrixPerTrack) { - auto thisCollId = collision.globalIndex(); + const auto thisCollId = collision.globalIndex(); for (const auto& trackId : trackIndicesCollision) { int statusProng = BIT(CandidateType::NCandidateTypes) - 1; // all bits on - auto track = trackId.template track_as(); - auto trackIdx = track.globalIndex(); + const auto track = trackId.template track_as(); float trackPt = track.pt(); float trackEta = track.eta(); - std::array pvRefitDcaXYDcaZ{track.dcaXY(), track.dcaZ()}; - std::array pvRefitPvCoord{0.f, 0.f, 0.f}; - std::array pvRefitPvCovMatrix{1e10f, 1e10f, 1e10f, 1e10f, 1e10f, 1e10f}; + std::array pvRefitDcaXYDcaZ{track.dcaXY(), track.dcaZ()}; + std::array pvRefitPvCoord{0.f, 0.f, 0.f}; + std::array pvRefitPvCovMatrix{1e10f, 1e10f, 1e10f, 1e10f, 1e10f, 1e10f}; // PV refit and DCA recalculation only for tracks with an assigned collision if (config.doPvRefit && track.has_collision() && track.collisionId() == thisCollId && track.isPVContributor()) { @@ -949,8 +948,8 @@ struct HfTrackIndexSkimCreatorTagSelTracks { pvRefitPvCovMatrix = {collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()}; /// retrieve PV contributors for the current collision - std::vector vecPvContributorGlobId = {}; - std::vector vecPvContributorTrackParCov = {}; + std::vector vecPvContributorGlobId{}; + std::vector vecPvContributorTrackParCov{}; for (const auto& contributor : pvContrCollision) { vecPvContributorGlobId.push_back(contributor.globalIndex()); @@ -966,14 +965,15 @@ struct HfTrackIndexSkimCreatorTagSelTracks { } performPvRefitTrack(collision, bcWithTimeStamps, vecPvContributorGlobId, vecPvContributorTrackParCov, track, pvRefitPvCoord, pvRefitPvCovMatrix, pvRefitDcaXYDcaZ); // we subtract the offset since trackIdx is the global index referred to the total track table + const auto trackIdx = track.globalIndex(); pvRefitDcaPerTrack[trackIdx] = pvRefitDcaXYDcaZ; pvRefitPvCoordPerTrack[trackIdx] = pvRefitPvCoord; pvRefitPvCovMatrixPerTrack[trackIdx] = pvRefitPvCovMatrix; } else if (track.collisionId() != thisCollId) { - auto bc = collision.bc_as(); + const auto bc = collision.bc_as(); initCCDB(bc, runNumber, ccdb, config.isRun2 ? config.ccdbPathGrp : config.ccdbPathGrpMag, lut, config.isRun2); auto trackPar = getTrackPar(track); - std::array dcaInfo{-999., -999.}; + std::array dcaInfo{-999.f, -999.f}; o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackPar, 2.f, noMatCorr, &dcaInfo); trackPt = trackPar.getPt(); trackEta = trackPar.getEta(); @@ -991,20 +991,19 @@ struct HfTrackIndexSkimCreatorTagSelTracks { // } isSelectedTrack(track, trackPt, trackEta, pvRefitDcaXYDcaZ, statusProng); - int8_t isIdentifiedPid = isSelectedPid(track); - bool isPositive = track.sign() > 0; + const int8_t isIdentifiedPid = isSelectedPid(track); + const bool isPositive = track.sign() > 0; rowSelectedTrack(statusProng, isIdentifiedPid, isPositive); } } /// Helper function to fill PVrefit table - /// \param pvRefitDcaPerTrack is a vector to be filled with track dcas after PV refit - /// \param pvRefitPvCoordPerTrack is a vector to be filled with PV coordinates after PV refit - /// \param pvRefitPvCovMatrixPerTrack is a vector to be filled with PV coordinate covariances after PV refit - /// \return true if the track is compatible with a proton hypothesis - void fillPvRefitTable(std::vector>& pvRefitDcaPerTrack, - std::vector>& pvRefitPvCoordPerTrack, - std::vector>& pvRefitPvCovMatrixPerTrack) + /// \param pvRefitDcaPerTrack is a vector filled with track dcas after PV refit + /// \param pvRefitPvCoordPerTrack is a vector filled with PV coordinates after PV refit + /// \param pvRefitPvCovMatrixPerTrack is a vector filled with PV coordinate covariances after PV refit + void fillPvRefitTable(std::vector> const& pvRefitDcaPerTrack, + std::vector> const& pvRefitPvCoordPerTrack, + std::vector> const& pvRefitPvCovMatrixPerTrack) { for (auto iTrack{0u}; iTrack < pvRefitDcaPerTrack.size(); ++iTrack) { tabPvRefitTrack(pvRefitPvCoordPerTrack[iTrack][0], pvRefitPvCoordPerTrack[iTrack][1], pvRefitPvCoordPerTrack[iTrack][2], @@ -1024,7 +1023,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { std::vector> pvRefitPvCoordPerTrack{}; std::vector> pvRefitPvCovMatrixPerTrack{}; if (config.doPvRefit) { - auto numTracks = tracks.size(); + const auto numTracks = tracks.size(); pvRefitDcaPerTrack.resize(numTracks); pvRefitPvCoordPerTrack.resize(numTracks); pvRefitPvCovMatrixPerTrack.resize(numTracks); @@ -1032,9 +1031,9 @@ struct HfTrackIndexSkimCreatorTagSelTracks { } for (const auto& collision : collisions) { - auto thisCollId = collision.globalIndex(); - auto groupedTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto pvContrCollision = pvContributors->sliceByCached(aod::track::collisionId, thisCollId, cache); + const auto thisCollId = collision.globalIndex(); + const auto groupedTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + const auto pvContrCollision = pvContributors->sliceByCached(aod::track::collisionId, thisCollId, cache); runTagSelTracks(collision, tracks, groupedTrackIndices, pvContrCollision, bcWithTimeStamps, pvRefitDcaPerTrack, pvRefitPvCoordPerTrack, pvRefitPvCovMatrixPerTrack); } @@ -1055,7 +1054,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { std::vector> pvRefitPvCoordPerTrack{}; std::vector> pvRefitPvCovMatrixPerTrack{}; if (config.doPvRefit) { - auto numTracks = tracks.size(); + const auto numTracks = tracks.size(); pvRefitDcaPerTrack.resize(numTracks); pvRefitPvCoordPerTrack.resize(numTracks); pvRefitPvCovMatrixPerTrack.resize(numTracks); @@ -1063,9 +1062,9 @@ struct HfTrackIndexSkimCreatorTagSelTracks { } for (const auto& collision : collisions) { - auto thisCollId = collision.globalIndex(); - auto groupedTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto pvContrCollision = pvContributorsWithPidTpc->sliceByCached(aod::track::collisionId, thisCollId, cache); + const auto thisCollId = collision.globalIndex(); + const auto groupedTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + const auto pvContrCollision = pvContributorsWithPidTpc->sliceByCached(aod::track::collisionId, thisCollId, cache); runTagSelTracks(collision, tracks, groupedTrackIndices, pvContrCollision, bcWithTimeStamps, pvRefitDcaPerTrack, pvRefitPvCoordPerTrack, pvRefitPvCovMatrixPerTrack); } @@ -1086,7 +1085,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { std::vector> pvRefitPvCoordPerTrack{}; std::vector> pvRefitPvCovMatrixPerTrack{}; if (config.doPvRefit) { - auto numTracks = tracks.size(); + const auto numTracks = tracks.size(); pvRefitDcaPerTrack.resize(numTracks); pvRefitPvCoordPerTrack.resize(numTracks); pvRefitPvCovMatrixPerTrack.resize(numTracks); @@ -1094,9 +1093,9 @@ struct HfTrackIndexSkimCreatorTagSelTracks { } for (const auto& collision : collisions) { - auto thisCollId = collision.globalIndex(); - auto groupedTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto pvContrCollision = pvContributorsWithPidTof->sliceByCached(aod::track::collisionId, thisCollId, cache); + const auto thisCollId = collision.globalIndex(); + const auto groupedTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + const auto pvContrCollision = pvContributorsWithPidTof->sliceByCached(aod::track::collisionId, thisCollId, cache); runTagSelTracks(collision, tracks, groupedTrackIndices, pvContrCollision, bcWithTimeStamps, pvRefitDcaPerTrack, pvRefitPvCoordPerTrack, pvRefitPvCovMatrixPerTrack); } @@ -1117,7 +1116,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { std::vector> pvRefitPvCoordPerTrack{}; std::vector> pvRefitPvCovMatrixPerTrack{}; if (config.doPvRefit) { - auto numTracks = tracks.size(); + const auto numTracks = tracks.size(); pvRefitDcaPerTrack.resize(numTracks); pvRefitPvCoordPerTrack.resize(numTracks); pvRefitPvCovMatrixPerTrack.resize(numTracks); @@ -1125,9 +1124,9 @@ struct HfTrackIndexSkimCreatorTagSelTracks { } for (const auto& collision : collisions) { - auto thisCollId = collision.globalIndex(); - auto groupedTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto pvContrCollision = pvContributorsWithPidTpcTof->sliceByCached(aod::track::collisionId, thisCollId, cache); + const auto thisCollId = collision.globalIndex(); + const auto groupedTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + const auto pvContrCollision = pvContributorsWithPidTpcTof->sliceByCached(aod::track::collisionId, thisCollId, cache); runTagSelTracks(collision, tracks, groupedTrackIndices, pvContrCollision, bcWithTimeStamps, pvRefitDcaPerTrack, pvRefitPvCoordPerTrack, pvRefitPvCovMatrixPerTrack); } @@ -1148,7 +1147,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { std::vector> pvRefitPvCoordPerTrack{}; std::vector> pvRefitPvCovMatrixPerTrack{}; if (config.doPvRefit) { - auto numTracks = tracks.size(); + const auto numTracks = tracks.size(); pvRefitDcaPerTrack.resize(numTracks); pvRefitPvCoordPerTrack.resize(numTracks); pvRefitPvCovMatrixPerTrack.resize(numTracks); @@ -1156,9 +1155,9 @@ struct HfTrackIndexSkimCreatorTagSelTracks { } for (const auto& collision : collisions) { - auto thisCollId = collision.globalIndex(); - auto groupedTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto pvContrCollision = pvContributorsWithPidTpcTof->sliceByCached(aod::track::collisionId, thisCollId, cache); + const auto thisCollId = collision.globalIndex(); + const auto groupedTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + const auto pvContrCollision = pvContributorsWithPidTpcTof->sliceByCached(aod::track::collisionId, thisCollId, cache); runTagSelTracks(collision, tracks, groupedTrackIndices, pvContrCollision, bcWithTimeStamps, pvRefitDcaPerTrack, pvRefitPvCoordPerTrack, pvRefitPvCovMatrixPerTrack); } @@ -1188,7 +1187,7 @@ struct HfTrackIndexSkimCreator { struct : ConfigurableGroup { Configurable isRun2{"isRun2", false, "enable Run 2 or Run 3 GRP objects for magnetic field"}; - Configurable do3Prong{"do3Prong", 0, "do 3 prong"}; + Configurable do3Prong{"do3Prong", false, "do 3 prong"}; Configurable doDstar{"doDstar", false, "do D* candidates"}; Configurable debug{"debug", false, "debug mode"}; Configurable debugPvRefit{"debugPvRefit", false, "debug lines for primary vertex refit"}; @@ -1275,17 +1274,17 @@ struct HfTrackIndexSkimCreator { static constexpr int kNCuts2Prong[kN2ProngDecays] = {hf_cuts_presel_2prong::NCutVars, hf_cuts_presel_2prong::NCutVars, hf_cuts_presel_2prong::NCutVars}; // how many different selections are made on 2-prongs static constexpr int kNCuts3Prong[kN3ProngDecays] = {hf_cuts_presel_3prong::NCutVars, hf_cuts_presel_3prong::NCutVars + 1, hf_cuts_presel_ds::NCutVars, hf_cuts_presel_3prong::NCutVars + 1}; // how many different selections are made on 3-prongs (Lc and Xic have also PID potentially) static constexpr int kNCutsDstar = 3; // how many different selections are made on Dstars - std::array, 2>, kN2ProngDecays> arrMass2Prong; - std::array, 2>, kN3ProngDecays> arrMass3Prong; + std::array, 2>, kN2ProngDecays> arrMass2Prong{}; + std::array, 2>, kN3ProngDecays> arrMass3Prong{}; // arrays of 2-prong and 3-prong cuts - std::array, kN2ProngDecays> cut2Prong; - std::array, kN2ProngDecays> pTBins2Prong; - std::array, kN3ProngDecays> cut3Prong; - std::array, kN3ProngDecays> pTBins3Prong; + std::array, kN2ProngDecays> cut2Prong{}; + std::array, kN2ProngDecays> binsPt2Prong{}; + std::array, kN3ProngDecays> cut3Prong{}; + std::array, kN3ProngDecays> binsPt3Prong{}; // ML response - o2::analysis::MlResponse hfMlResponse2Prongs; // only D0 - std::array, kN3ProngDecays> hfMlResponse3Prongs; // D+, Lc, Ds, Xic + o2::analysis::MlResponse hfMlResponse2Prongs; // only D0 + std::array, kN3ProngDecays> hfMlResponse3Prongs{}; // D+, Lc, Ds, Xic std::array hasMlModel3Prong{false}; o2::ccdb::CcdbApi ccdbApi; @@ -1344,10 +1343,10 @@ struct HfTrackIndexSkimCreator { // cuts for 2-prong decays retrieved by json. the order must be then one in hf_cand_2prong::DecayType cut2Prong = {config.cutsD0ToPiK, config.cutsJpsiToEE, config.cutsJpsiToMuMu}; - pTBins2Prong = {config.binsPtD0ToPiK, config.binsPtJpsiToEE, config.binsPtJpsiToMuMu}; + binsPt2Prong = {config.binsPtD0ToPiK, config.binsPtJpsiToEE, config.binsPtJpsiToMuMu}; // cuts for 3-prong decays retrieved by json. the order must be then one in hf_cand_3prong::DecayType cut3Prong = {config.cutsDplusToPiKPi, config.cutsLcToPKPi, config.cutsDsToKKPi, config.cutsXicToPKPi}; - pTBins3Prong = {config.binsPtDplusToPiKPi, config.binsPtLcToPKPi, config.binsPtDsToKKPi, config.binsPtXicToPKPi}; + binsPt3Prong = {config.binsPtDplusToPiKPi, config.binsPtLcToPKPi, config.binsPtDsToKKPi, config.binsPtXicToPKPi}; df2.setPropagateToPCA(config.propagateToPCA); df2.setMaxR(config.maxR); @@ -1372,8 +1371,8 @@ struct HfTrackIndexSkimCreator { runNumber = 0; if (config.fillHistograms) { - AxisSpec axisNumTracks{500, -0.5f, 499.5f, "Number of tracks"}; - AxisSpec axisNumCands{1000, -0.5f, 999.5f, "Number of candidates"}; + const AxisSpec axisNumTracks{500, -0.5f, 499.5f, "Number of tracks"}; + const AxisSpec axisNumCands{1000, -0.5f, 999.5f, "Number of candidates"}; registry.add("hNTracks", "Number of selected tracks;# of selected tracks;entries", {HistType::kTH1D, {axisNumTracks}}); // 2-prong histograms registry.add("hVtx2ProngX", "2-prong candidates;#it{x}_{sec. vtx.} (cm);entries", {HistType::kTH1D, {{1000, -2., 2.}}}); @@ -1398,16 +1397,16 @@ struct HfTrackIndexSkimCreator { // needed for PV refitting if (doprocess2And3ProngsWithPvRefit || doprocess2And3ProngsWithPvRefitWithPidForHfFiltersBdt) { - AxisSpec axisCollisionX{100, -20.f, 20.f, "X (cm)"}; - AxisSpec axisCollisionY{100, -20.f, 20.f, "Y (cm)"}; - AxisSpec axisCollisionZ{100, -20.f, 20.f, "Z (cm)"}; - AxisSpec axisCollisionXOriginal{1000, -20.f, 20.f, "X original PV (cm)"}; - AxisSpec axisCollisionYOriginal{1000, -20.f, 20.f, "Y original PV (cm)"}; - AxisSpec axisCollisionZOriginal{1000, -20.f, 20.f, "Z original PV (cm)"}; - AxisSpec axisCollisionNContrib{1000, 0, 1000, "Number of contributors"}; - AxisSpec axisCollisionDeltaX{axisPvRefitDeltaX, "#Delta x_{PV} (cm)"}; - AxisSpec axisCollisionDeltaY{axisPvRefitDeltaY, "#Delta y_{PV} (cm)"}; - AxisSpec axisCollisionDeltaZ{axisPvRefitDeltaZ, "#Delta z_{PV} (cm)"}; + const AxisSpec axisCollisionX{100, -20.f, 20.f, "X (cm)"}; + const AxisSpec axisCollisionY{100, -20.f, 20.f, "Y (cm)"}; + const AxisSpec axisCollisionZ{100, -20.f, 20.f, "Z (cm)"}; + const AxisSpec axisCollisionXOriginal{1000, -20.f, 20.f, "X original PV (cm)"}; + const AxisSpec axisCollisionYOriginal{1000, -20.f, 20.f, "Y original PV (cm)"}; + const AxisSpec axisCollisionZOriginal{1000, -20.f, 20.f, "Z original PV (cm)"}; + const AxisSpec axisCollisionNContrib{1000, 0, 1000, "Number of contributors"}; + const AxisSpec axisCollisionDeltaX{axisPvRefitDeltaX, "#Delta x_{PV} (cm)"}; + const AxisSpec axisCollisionDeltaY{axisPvRefitDeltaY, "#Delta y_{PV} (cm)"}; + const AxisSpec axisCollisionDeltaZ{axisPvRefitDeltaZ, "#Delta z_{PV} (cm)"}; registry.add("PvRefit/verticesPerCandidate", "", kTH1D, {{6, 0.5f, 6.5f, ""}}); registry.get(HIST("PvRefit/verticesPerCandidate"))->GetXaxis()->SetBinLabel(1, "All PV"); registry.get(HIST("PvRefit/verticesPerCandidate"))->GetXaxis()->SetBinLabel(2, "PV refit doable"); @@ -1427,7 +1426,7 @@ struct HfTrackIndexSkimCreator { } if (config.applyMlForHfFilters) { - AxisSpec axisBdtScore{100, 0.f, 1.f}; + const AxisSpec axisBdtScore{100, 0.f, 1.f}; registry.add("ML/hMlScoreBkgD0", "Bkg ML score for D^{0} candidates;Bkg ML score;entries", kTH1D, {axisBdtScore}); registry.add("ML/hMlScorePromptD0", "Prompt ML score for D^{0} candidates;Prompt ML score;entries", kTH1D, {axisBdtScore}); registry.add("ML/hMlScoreNonpromptD0", "Non-prompt ML score for D^{0} candidates;Non-prompt ML score;entries", kTH1D, {axisBdtScore}); @@ -1447,13 +1446,13 @@ struct HfTrackIndexSkimCreator { } if (config.applyMlForHfFilters) { - const std::vector onnxFileNames2Prongs = {config.onnxFileNames->get(0u, 0u)}; - const std::array, kN3ProngDecays> onnxFileNames3Prongs = {std::vector{config.onnxFileNames->get(1u, 0u)}, std::vector{config.onnxFileNames->get(2u, 0u)}, std::vector{config.onnxFileNames->get(3u, 0u)}, std::vector{config.onnxFileNames->get(4u, 0u)}}; - const std::vector mlModelPathCcdb2Prongs = {config.mlModelPathCCDB.value + "D0"}; - const std::array, kN3ProngDecays> mlModelPathCcdb3Prongs = {std::vector{config.mlModelPathCCDB.value + "Dplus"}, std::vector{config.mlModelPathCCDB.value + "Lc"}, std::vector{config.mlModelPathCCDB.value + "Ds"}, std::vector{config.mlModelPathCCDB.value + "Xic"}}; - const std::vector ptBinsMl = {0., 1.e10}; - const std::vector cutDirMl = {o2::cuts_ml::CutDirection::CutGreater, o2::cuts_ml::CutDirection::CutSmaller, o2::cuts_ml::CutDirection::CutSmaller}; - const std::array, kN3ProngDecays> thresholdMlScore3Prongs = {config.thresholdMlScoreDplusToPiKPi, config.thresholdMlScoreLcToPiKP, config.thresholdMlScoreDsToPiKK, config.thresholdMlScoreXicToPiKP}; + const std::vector onnxFileNames2Prongs{config.onnxFileNames->get(0u, 0u)}; + const std::array, kN3ProngDecays> onnxFileNames3Prongs{std::vector{config.onnxFileNames->get(1u, 0u)}, std::vector{config.onnxFileNames->get(2u, 0u)}, std::vector{config.onnxFileNames->get(3u, 0u)}, std::vector{config.onnxFileNames->get(4u, 0u)}}; + const std::vector mlModelPathCcdb2Prongs{config.mlModelPathCCDB.value + "D0"}; + const std::array, kN3ProngDecays> mlModelPathCcdb3Prongs{std::vector{config.mlModelPathCCDB.value + "Dplus"}, std::vector{config.mlModelPathCCDB.value + "Lc"}, std::vector{config.mlModelPathCCDB.value + "Ds"}, std::vector{config.mlModelPathCCDB.value + "Xic"}}; + const std::vector ptBinsMl{0., 1.e10}; + const std::vector cutDirMl{o2::cuts_ml::CutDirection::CutGreater, o2::cuts_ml::CutDirection::CutSmaller, o2::cuts_ml::CutDirection::CutSmaller}; + const std::array, kN3ProngDecays> thresholdMlScore3Prongs{config.thresholdMlScoreDplusToPiKPi, config.thresholdMlScoreLcToPiKP, config.thresholdMlScoreDsToPiKK, config.thresholdMlScoreXicToPiKP}; // initialise 2-prong ML response hfMlResponse2Prongs.configure(ptBinsMl, config.thresholdMlScoreD0ToKPi, cutDirMl, 3); @@ -1493,20 +1492,19 @@ struct HfTrackIndexSkimCreator { /// \param isSelected is a bitmap with selection outcome /// \param pt2Prong is the pt of the 2-prong candidate template - void applyPreselection2Prong(T1 const& pVecTrack0, T1 const& pVecTrack1, T2 const& dcaTrack0, T2 const& dcaTrack1, T3& cutStatus, T4& whichHypo, int& isSelected, float& pt2Prong) + void applyPreselection2Prong(T1 const& pVecTrack0, T1 const& pVecTrack1, T2 const& dcaTrack0, T2 const& dcaTrack1, T3& cutStatus, T4& whichHypo, auto& isSelected, float& pt2Prong) { whichHypo[kN2ProngDecays] = 0; // D0 for D* - auto arrMom = std::array{pVecTrack0, pVecTrack1}; pt2Prong = RecoDecay::pt(pVecTrack0, pVecTrack1); - auto pT = pt2Prong + config.ptTolerance; // add tolerance because of no reco decay vertex + const auto pt = pt2Prong + config.ptTolerance; // add tolerance because of no reco decay vertex for (int iDecay2P = 0; iDecay2P < kN2ProngDecays; iDecay2P++) { // pT - auto pTBin = findBin(&pTBins2Prong[iDecay2P], pT); + const auto binPt = findBin(&binsPt2Prong[iDecay2P], pt); // return immediately if it is outside the defined pT bins - if (pTBin == -1) { + if (binPt == -1) { CLRBIT(isSelected, iDecay2P); if (config.debug) { cutStatus[iDecay2P][0] = false; @@ -1515,34 +1513,37 @@ struct HfTrackIndexSkimCreator { } // invariant mass - double massHypos[2] = {0.f, 0.f}; - whichHypo[iDecay2P] = 3; - double minMass = cut2Prong[iDecay2P].get(pTBin, 0u); - double maxMass = cut2Prong[iDecay2P].get(pTBin, 1u); - double min2 = minMass * minMass; - double max2 = maxMass * maxMass; - - if ((config.debug || TESTBIT(isSelected, iDecay2P)) && minMass >= 0. && maxMass > 0.) { - massHypos[0] = RecoDecay::m2(arrMom, arrMass2Prong[iDecay2P][0]); - massHypos[1] = (iDecay2P == hf_cand_2prong::DecayType::D0ToPiK) ? RecoDecay::m2(arrMom, arrMass2Prong[iDecay2P][1]) : massHypos[0]; - if (massHypos[0] < min2 || massHypos[0] >= max2) { - CLRBIT(whichHypo[iDecay2P], 0); - } - if (massHypos[1] < min2 || massHypos[1] >= max2) { - CLRBIT(whichHypo[iDecay2P], 1); - } - if (whichHypo[iDecay2P] == 0) { - CLRBIT(isSelected, iDecay2P); - if (config.debug) { - cutStatus[iDecay2P][1] = false; + double massHypos[2] = {0., 0.}; + whichHypo[iDecay2P] = 3; // 2 bits on + + if (config.debug || TESTBIT(isSelected, iDecay2P)) { + const double minMass = cut2Prong[iDecay2P].get(binPt, 0u); + const double maxMass = cut2Prong[iDecay2P].get(binPt, 1u); + if (minMass >= 0. && maxMass > 0.) { + const std::array arrMom{pVecTrack0, pVecTrack1}; + massHypos[0] = RecoDecay::m2(arrMom, arrMass2Prong[iDecay2P][0]); + massHypos[1] = (iDecay2P == hf_cand_2prong::DecayType::D0ToPiK) ? RecoDecay::m2(arrMom, arrMass2Prong[iDecay2P][1]) : massHypos[0]; + const double min2 = minMass * minMass; + const double max2 = maxMass * maxMass; + if (massHypos[0] < min2 || massHypos[0] >= max2) { + CLRBIT(whichHypo[iDecay2P], 0); + } + if (massHypos[1] < min2 || massHypos[1] >= max2) { + CLRBIT(whichHypo[iDecay2P], 1); + } + if (whichHypo[iDecay2P] == 0) { + CLRBIT(isSelected, iDecay2P); + if (config.debug) { + cutStatus[iDecay2P][1] = false; + } } } } // imp. par. product cut if (config.debug || TESTBIT(isSelected, iDecay2P)) { - auto impParProduct = dcaTrack0 * dcaTrack1; - if (impParProduct > cut2Prong[iDecay2P].get(pTBin, 3u)) { + const auto impParProduct = dcaTrack0 * dcaTrack1; + if (impParProduct > cut2Prong[iDecay2P].get(binPt, 3u)) { CLRBIT(isSelected, iDecay2P); if (config.debug) { cutStatus[iDecay2P][2] = false; @@ -1552,10 +1553,10 @@ struct HfTrackIndexSkimCreator { // additional check for D0 to be used in D* finding if (iDecay2P == hf_cand_2prong::DecayType::D0ToPiK && config.doDstar && TESTBIT(isSelected, iDecay2P)) { - auto pTBinDstar = findBin(config.binsPtDstarToD0Pi, pT * 1.2); // assuming the D* pT about 20% higher than the one of the D0 to be safe - if (pTBinDstar >= 0) { + const auto binPtDstar = findBin(config.binsPtDstarToD0Pi, pt * 1.2); // assuming the D* pT about 20% higher than the one of the D0 to be safe + if (binPtDstar >= 0) { whichHypo[kN2ProngDecays] = whichHypo[hf_cand_2prong::DecayType::D0ToPiK]; - double deltaMass = config.cutsDstarToD0Pi->get(pTBinDstar, 1u); + const double deltaMass = config.cutsDstarToD0Pi->get(binPtDstar, 1u); if (TESTBIT(whichHypo[iDecay2P], 0) && (massHypos[0] > (MassD0 + deltaMass) * (MassD0 + deltaMass) || massHypos[0] < (MassD0 - deltaMass) * (MassD0 - deltaMass))) { CLRBIT(whichHypo[kN2ProngDecays], 0); @@ -1569,7 +1570,7 @@ struct HfTrackIndexSkimCreator { } /// Method to perform selections on difference from nominal mass for phi decay - /// \param pTBin pt bin for the cuts + /// \param binPt pt bin for the cuts /// \param pVecTrack0 is the momentum array of the first daughter track /// \param pVecTrack1 is the momentum array of the second daughter track /// \param pVecTrack2 is the momentum array of the third daughter track @@ -1577,22 +1578,21 @@ struct HfTrackIndexSkimCreator { /// \param whichHypo information of the mass hypoteses that were selected /// \param isSelected is a bitmap with selection outcome template - void applyPreselectionPhiDecay(int& pTBin, T1 const& pVecTrack0, T1 const& pVecTrack1, T1 const& pVecTrack2, T2& cutStatus, T3& whichHypo, int& isSelected) + void applyPreselectionPhiDecay(const int binPt, T1 const& pVecTrack0, T1 const& pVecTrack1, T1 const& pVecTrack2, T2& cutStatus, T3& whichHypo, auto& isSelected) { - double deltaMassMax = cut3Prong[hf_cand_3prong::DecayType::DsToKKPi].get(pTBin, 4u); + const double deltaMassMax = cut3Prong[hf_cand_3prong::DecayType::DsToKKPi].get(binPt, 4u); if (TESTBIT(whichHypo[hf_cand_3prong::DecayType::DsToKKPi], 0)) { - double mass2PhiKKPi = RecoDecay::m2(std::array{pVecTrack0, pVecTrack1}, std::array{arrMass3Prong[hf_cand_3prong::DecayType::DsToKKPi][0][0], arrMass3Prong[hf_cand_3prong::DecayType::DsToKKPi][0][1]}); + const double mass2PhiKKPi = RecoDecay::m2(std::array{pVecTrack0, pVecTrack1}, std::array{arrMass3Prong[hf_cand_3prong::DecayType::DsToKKPi][0][0], arrMass3Prong[hf_cand_3prong::DecayType::DsToKKPi][0][1]}); if (mass2PhiKKPi > (MassPhi + deltaMassMax) * (MassPhi + deltaMassMax) || mass2PhiKKPi < (MassPhi - deltaMassMax) * (MassPhi - deltaMassMax)) { CLRBIT(whichHypo[hf_cand_3prong::DecayType::DsToKKPi], 0); } } if (TESTBIT(whichHypo[hf_cand_3prong::DecayType::DsToKKPi], 1)) { - double mass2PhiPiKK = RecoDecay::m2(std::array{pVecTrack1, pVecTrack2}, std::array{arrMass3Prong[hf_cand_3prong::DecayType::DsToKKPi][1][1], arrMass3Prong[hf_cand_3prong::DecayType::DsToKKPi][1][2]}); + const double mass2PhiPiKK = RecoDecay::m2(std::array{pVecTrack1, pVecTrack2}, std::array{arrMass3Prong[hf_cand_3prong::DecayType::DsToKKPi][1][1], arrMass3Prong[hf_cand_3prong::DecayType::DsToKKPi][1][2]}); if (mass2PhiPiKK > (MassPhi + deltaMassMax) * (MassPhi + deltaMassMax) || mass2PhiPiKK < (MassPhi - deltaMassMax) * (MassPhi - deltaMassMax)) { CLRBIT(whichHypo[hf_cand_3prong::DecayType::DsToKKPi], 1); } } - if (whichHypo[hf_cand_3prong::DecayType::DsToKKPi] == 0) { CLRBIT(isSelected, hf_cand_3prong::DecayType::DsToKKPi); if (config.debug) { @@ -1611,16 +1611,14 @@ struct HfTrackIndexSkimCreator { /// \param whichHypo information of the mass hypoteses that were selected /// \param isSelected is a bitmap with selection outcome template - void applyPreselection3Prong(T1 const& pVecTrack0, T1 const& pVecTrack1, T1 const& pVecTrack2, int8_t& isIdentifiedPidTrack0, int8_t& isIdentifiedPidTrack2, T2& cutStatus, T3& whichHypo, int& isSelected) + void applyPreselection3Prong(T1 const& pVecTrack0, T1 const& pVecTrack1, T1 const& pVecTrack2, const auto isIdentifiedPidTrack0, const auto isIdentifiedPidTrack2, T2& cutStatus, T3& whichHypo, auto& isSelected) { - - auto arrMom = std::array{pVecTrack0, pVecTrack1, pVecTrack2}; - auto pT = RecoDecay::pt(pVecTrack0, pVecTrack1, pVecTrack2) + config.ptTolerance; // add tolerance because of no reco decay vertex + const auto pt = RecoDecay::pt(pVecTrack0, pVecTrack1, pVecTrack2) + config.ptTolerance; // add tolerance because of no reco decay vertex for (int iDecay3P = 0; iDecay3P < kN3ProngDecays; iDecay3P++) { // check proton PID for Lc and Xic - whichHypo[iDecay3P] = 3; + whichHypo[iDecay3P] = 3; // 2 bits on if ((iDecay3P == hf_cand_3prong::DecayType::LcToPKPi && config.applyProtonPidForLcToPKPi) || (iDecay3P == hf_cand_3prong::DecayType::XicToPKPi && config.applyProtonPidForXicToPKPi)) { if ((iDecay3P == hf_cand_3prong::DecayType::LcToPKPi && !TESTBIT(isIdentifiedPidTrack0, ChannelsProtonPid::LcToPKPi)) || (iDecay3P == hf_cand_3prong::DecayType::XicToPKPi && !TESTBIT(isIdentifiedPidTrack0, ChannelsProtonPid::XicToPKPi))) { CLRBIT(whichHypo[iDecay3P], 0); @@ -1638,9 +1636,9 @@ struct HfTrackIndexSkimCreator { } // pT - auto pTBin = findBin(&pTBins3Prong[iDecay3P], pT); + const auto binPt = findBin(&binsPt3Prong[iDecay3P], pt); // return immediately if it is outside the defined pT bins - if (pTBin == -1) { + if (binPt == -1) { CLRBIT(isSelected, iDecay3P); whichHypo[iDecay3P] = 0; if (config.debug) { @@ -1650,31 +1648,33 @@ struct HfTrackIndexSkimCreator { } // invariant mass - double massHypos[2]; - double minMass = cut3Prong[iDecay3P].get(pTBin, 0u); - double maxMass = cut3Prong[iDecay3P].get(pTBin, 1u); - double min2 = minMass * minMass; - double max2 = maxMass * maxMass; - - if ((config.debug || TESTBIT(isSelected, iDecay3P)) && minMass >= 0. && maxMass > 0.) { // no need to check isSelected but to avoid mistakes - massHypos[0] = RecoDecay::m2(arrMom, arrMass3Prong[iDecay3P][0]); - massHypos[1] = (iDecay3P != hf_cand_3prong::DecayType::DplusToPiKPi) ? RecoDecay::m2(arrMom, arrMass3Prong[iDecay3P][1]) : massHypos[0]; - if (massHypos[0] < min2 || massHypos[0] >= max2) { - CLRBIT(whichHypo[iDecay3P], 0); - } - if (massHypos[1] < min2 || massHypos[1] >= max2) { - CLRBIT(whichHypo[iDecay3P], 1); - } - if (whichHypo[iDecay3P] == 0) { - CLRBIT(isSelected, iDecay3P); - if (config.debug) { - cutStatus[iDecay3P][1] = false; + if ((config.debug || TESTBIT(isSelected, iDecay3P))) { + const double minMass = cut3Prong[iDecay3P].get(binPt, 0u); + const double maxMass = cut3Prong[iDecay3P].get(binPt, 1u); + if (minMass >= 0. && maxMass > 0.) { // no need to check isSelected but to avoid mistakes + double massHypos[2] = {0., 0.}; + const std::array arrMom{pVecTrack0, pVecTrack1, pVecTrack2}; + const double min2 = minMass * minMass; + const double max2 = maxMass * maxMass; + massHypos[0] = RecoDecay::m2(arrMom, arrMass3Prong[iDecay3P][0]); + massHypos[1] = (iDecay3P != hf_cand_3prong::DecayType::DplusToPiKPi) ? RecoDecay::m2(arrMom, arrMass3Prong[iDecay3P][1]) : massHypos[0]; + if (massHypos[0] < min2 || massHypos[0] >= max2) { + CLRBIT(whichHypo[iDecay3P], 0); + } + if (massHypos[1] < min2 || massHypos[1] >= max2) { + CLRBIT(whichHypo[iDecay3P], 1); + } + if (whichHypo[iDecay3P] == 0) { + CLRBIT(isSelected, iDecay3P); + if (config.debug) { + cutStatus[iDecay3P][1] = false; + } } } } if ((config.debug || TESTBIT(isSelected, iDecay3P)) && iDecay3P == hf_cand_3prong::DecayType::DsToKKPi) { - applyPreselectionPhiDecay(pTBin, pVecTrack0, pVecTrack1, pVecTrack2, cutStatus, whichHypo, isSelected); + applyPreselectionPhiDecay(binPt, pVecTrack0, pVecTrack1, pVecTrack2, cutStatus, whichHypo, isSelected); } } } @@ -1686,15 +1686,15 @@ struct HfTrackIndexSkimCreator { /// \param cutStatus is a 2D array with outcome of each selection (filled only in debug mode) /// \param isSelected ia s bitmap with selection outcome template - void applySelection2Prong(const T1& pVecCand, const T2& secVtx, const T3& primVtx, T4& cutStatus, int& isSelected) + void applySelection2Prong(const T1& pVecCand, const T2& secVtx, const T3& primVtx, T4& cutStatus, auto& isSelected) { if (config.debug || isSelected > 0) { for (int iDecay2P = 0; iDecay2P < kN2ProngDecays; iDecay2P++) { // pT - auto pTBin = findBin(&pTBins2Prong[iDecay2P], RecoDecay::pt(pVecCand)); - if (pTBin == -1) { // cut if it is outside the defined pT bins + const auto binPt = findBin(&binsPt2Prong[iDecay2P], RecoDecay::pt(pVecCand)); + if (binPt == -1) { // cut if it is outside the defined pT bins CLRBIT(isSelected, iDecay2P); if (config.debug) { cutStatus[iDecay2P][0] = false; @@ -1702,10 +1702,10 @@ struct HfTrackIndexSkimCreator { continue; } - // cosp + // cos of pointing angle if (config.debug || TESTBIT(isSelected, iDecay2P)) { - auto cpa = RecoDecay::cpa(primVtx, secVtx, pVecCand); - if (cpa < cut2Prong[iDecay2P].get(pTBin, 2u)) { // 2u == "cospIndex[iDecay2P]" + const auto cpa = RecoDecay::cpa(primVtx, secVtx, pVecCand); + if (cpa < cut2Prong[iDecay2P].get(binPt, 2u)) { // 2u == "cospIndex[iDecay2P]" CLRBIT(isSelected, iDecay2P); if (config.debug) { cutStatus[iDecay2P][3] = false; @@ -1720,13 +1720,13 @@ struct HfTrackIndexSkimCreator { /// \param featuresCand is the vector with the candidate features /// \param outputScores is the vector with the output scores to be filled /// \param isSelected ia s bitmap with selection outcome - void applyMlSelectionForHfFilters2Prong(std::vector featuresCand, std::vector& outputScores, int& isSelected) + void applyMlSelectionForHfFilters2Prong(std::vector featuresCand, std::vector& outputScores, auto& isSelected) { if (!TESTBIT(isSelected, hf_cand_2prong::DecayType::D0ToPiK)) { return; } const float ptDummy = 1.; // dummy pT value (only one pT bin) - bool isSelMl = hfMlResponse2Prongs.isSelectedMl(featuresCand, ptDummy, outputScores); + const bool isSelMl = hfMlResponse2Prongs.isSelectedMl(featuresCand, ptDummy, outputScores); if (config.fillHistograms) { registry.fill(HIST("ML/hMlScoreBkgD0"), outputScores[0]); registry.fill(HIST("ML/hMlScorePromptD0"), outputScores[1]); @@ -1748,7 +1748,7 @@ struct HfTrackIndexSkimCreator { if (dcaFitter.getChi2AtPCACandidate() > config.maxTwoTrackChi2PcaFor3Prongs) { return false; } - auto decLen = RecoDecay::distance(primVtx, secVtx); + const auto decLen = RecoDecay::distance(primVtx, secVtx); if (decLen < config.minTwoTrackDecayLengthFor3Prongs) { return false; } @@ -1763,16 +1763,16 @@ struct HfTrackIndexSkimCreator { /// \param cutStatus is a 2D array with outcome of each selection (filled only in debug mode) /// \param isSelected ia s bitmap with selection outcome template - void applySelection3Prong(const T1& pVecCand, const T2& secVtx, const T3& primVtx, T4& cutStatus, int& isSelected) + void applySelection3Prong(const T1& pVecCand, const T2& secVtx, const T3& primVtx, T4& cutStatus, auto& isSelected) { if (config.debug || isSelected > 0) { - auto pT = RecoDecay::pt(pVecCand); + const auto pt = RecoDecay::pt(pVecCand); for (int iDecay3P = 0; iDecay3P < kN3ProngDecays; iDecay3P++) { // pT - auto pTBin = findBin(&pTBins3Prong[iDecay3P], pT); - if (pTBin == -1) { // cut if it is outside the defined pT bins + const auto binPt = findBin(&binsPt3Prong[iDecay3P], pt); + if (binPt == -1) { // cut if it is outside the defined pT bins CLRBIT(isSelected, iDecay3P); if (config.debug) { cutStatus[iDecay3P][0] = false; @@ -1780,10 +1780,10 @@ struct HfTrackIndexSkimCreator { continue; } - // cosp - if ((config.debug || TESTBIT(isSelected, iDecay3P))) { - auto cpa = RecoDecay::cpa(primVtx, secVtx, pVecCand); - if (cpa < cut3Prong[iDecay3P].get(pTBin, 2u)) { // 2u == cospIndex[iDecay3P] + // cos of pointing angle + if (config.debug || TESTBIT(isSelected, iDecay3P)) { + const auto cpa = RecoDecay::cpa(primVtx, secVtx, pVecCand); + if (cpa < cut3Prong[iDecay3P].get(binPt, 2u)) { // 2u == cospIndex[iDecay3P] CLRBIT(isSelected, iDecay3P); if (config.debug) { cutStatus[iDecay3P][2] = false; @@ -1793,8 +1793,8 @@ struct HfTrackIndexSkimCreator { // decay length if ((config.debug || TESTBIT(isSelected, iDecay3P))) { - auto decayLength = RecoDecay::distance(primVtx, secVtx); - if (decayLength < cut3Prong[iDecay3P].get(pTBin, 3u)) { // 3u == decLenIndex[iDecay3P] + const auto decayLength = RecoDecay::distance(primVtx, secVtx); + if (decayLength < cut3Prong[iDecay3P].get(binPt, 3u)) { // 3u == decLenIndex[iDecay3P] CLRBIT(isSelected, iDecay3P); if (config.debug) { cutStatus[iDecay3P][3] = false; @@ -1806,19 +1806,19 @@ struct HfTrackIndexSkimCreator { } /// Method to perform ML selections for 2-prong candidates after the rectangular selections + /// \tparam usePidForHfFiltersBdt is the flag to determine whether to use also the PID features for the Lc BDT /// \param featuresCand is the vector with the candidate features /// \param featuresCandPid is the vector with the candidate PID features /// \param outputScores is the array of vectors with the output scores to be filled /// \param isSelected ia s bitmap with selection outcome - /// \param usePidForHfFiltersBdt is the flag to determine whether to use also the PID features for the Lc BDT - template - void applyMlSelectionForHfFilters3Prong(std::vector featuresCand, std::vector featuresCandPid, std::array, kN3ProngDecays>& outputScores, int& isSelected) + template + void applyMlSelectionForHfFilters3Prong(std::vector featuresCand, std::vector featuresCandPid, std::array, kN3ProngDecays>& outputScores, auto& isSelected) { if (isSelected == 0) { return; } - const float ptDummy = 1.; // dummy pT value (only one pT bin) + const float ptDummy = 1.f; // dummy pT value (only one pT bin) for (int iDecay3P{0}; iDecay3P < kN3ProngDecays; ++iDecay3P) { if (TESTBIT(isSelected, iDecay3P) && hasMlModel3Prong[iDecay3P]) { bool isMlSel = false; @@ -1826,7 +1826,7 @@ struct HfTrackIndexSkimCreator { if (iDecay3P != hf_cand_3prong::DecayType::LcToPKPi && iDecay3P != hf_cand_3prong::DecayType::XicToPKPi) { isMlSel = hfMlResponse3Prongs[iDecay3P].isSelectedMl(featuresCand, ptDummy, outputScores[iDecay3P]); } else { - std::vector featuresCandWithPid = featuresCand; + std::vector featuresCandWithPid{featuresCand}; featuresCandWithPid.insert(featuresCandWithPid.end(), featuresCandPid.begin(), featuresCandPid.end()); isMlSel = hfMlResponse3Prongs[iDecay3P].isSelectedMl(featuresCandWithPid, ptDummy, outputScores[iDecay3P]); } @@ -1879,14 +1879,14 @@ struct HfTrackIndexSkimCreator { uint8_t applySelectionDstar(T1 const& pVecTrack0, T1 const& pVecTrack1, T1 const& pVecTrack2, uint8_t& cutStatus, T2& deltaMass) { uint8_t isSelected{1}; - auto arrMom = std::array{pVecTrack0, pVecTrack1, pVecTrack2}; - auto arrMomD0 = std::array{pVecTrack0, pVecTrack1}; - auto pT = RecoDecay::pt(pVecTrack0, pVecTrack1, pVecTrack2) + config.ptTolerance; // add tolerance because of no reco decay vertex + const std::array arrMom{pVecTrack0, pVecTrack1, pVecTrack2}; + const std::array arrMomD0{pVecTrack0, pVecTrack1}; + const auto pt = RecoDecay::pt(pVecTrack0, pVecTrack1, pVecTrack2) + config.ptTolerance; // add tolerance because of no reco decay vertex // pT - auto pTBin = findBin(config.binsPtDstarToD0Pi, pT); + const auto binPt = findBin(config.binsPtDstarToD0Pi, pt); // return immediately if it is outside the defined pT bins - if (pTBin == -1) { + if (binPt == -1) { isSelected = 0; if (config.debug) { CLRBIT(cutStatus, 0); @@ -1896,8 +1896,8 @@ struct HfTrackIndexSkimCreator { } // D0 mass - double deltaMassD0 = config.cutsDstarToD0Pi->get(pTBin, 1u); // 1u == deltaMassD0Index - double invMassD0 = RecoDecay::m(arrMomD0, std::array{MassPiPlus, MassKPlus}); + const double deltaMassD0 = config.cutsDstarToD0Pi->get(binPt, 1u); // 1u == deltaMassD0Index + const double invMassD0 = RecoDecay::m(arrMomD0, std::array{MassPiPlus, MassKPlus}); if (std::abs(invMassD0 - MassD0) > deltaMassD0) { isSelected = 0; if (config.debug) { @@ -1907,8 +1907,8 @@ struct HfTrackIndexSkimCreator { } // D*+ mass - double maxDeltaMass = config.cutsDstarToD0Pi->get(pTBin, 0u); // 0u == deltaMassIndex - double invMassDstar = RecoDecay::m(arrMom, std::array{MassPiPlus, MassKPlus, MassPiPlus}); + const double maxDeltaMass = config.cutsDstarToD0Pi->get(binPt, 0u); // 0u == deltaMassIndex + const double invMassDstar = RecoDecay::m(arrMom, std::array{MassPiPlus, MassKPlus, MassPiPlus}); deltaMass = invMassDstar - invMassD0; if (deltaMass > maxDeltaMass) { isSelected = 0; @@ -1931,8 +1931,8 @@ struct HfTrackIndexSkimCreator { /// \param pvCovMatrix is a vector where to store the covariance matrix values of refitted PV void performPvRefitCandProngs(SelectedCollisions::iterator const& collision, aod::BCsWithTimestamps const&, - std::vector vecPvContributorGlobId, - std::vector vecPvContributorTrackParCov, + std::vector const& vecPvContributorGlobId, + std::vector const& vecPvContributorTrackParCov, std::vector vecCandPvContributorGlobId, std::array& pvCoord, std::array& pvCovMatrix) @@ -1941,7 +1941,7 @@ struct HfTrackIndexSkimCreator { /// Prepare the vertex refitting // set the magnetic field from CCDB - auto bc = collision.bc_as(); + const auto bc = collision.bc_as(); initCCDB(bc, runNumber, ccdb, config.isRun2 ? config.ccdbPathGrp : config.ccdbPathGrpMag, lut, config.isRun2); // build the VertexBase to initialize the vertexer @@ -1954,7 +1954,7 @@ struct HfTrackIndexSkimCreator { o2::vertexing::PVertexer vertexer; o2::conf::ConfigurableParam::updateFromString("pvertexer.useMeanVertexConstraint=false"); /// remove diamond constraint (let's keep it at the moment...) vertexer.init(); - bool pvRefitDoable = vertexer.prepareVertexRefit(vecPvContributorTrackParCov, primVtx); + const bool pvRefitDoable = vertexer.prepareVertexRefit(vecPvContributorTrackParCov, primVtx); if (!pvRefitDoable) { LOG(info) << "Not enough tracks accepted for the refit"; if ((doprocess2And3ProngsWithPvRefit || doprocess2And3ProngsWithPvRefitWithPidForHfFiltersBdt) && config.fillHistograms) { @@ -1974,7 +1974,7 @@ struct HfTrackIndexSkimCreator { } recalcPvRefit = true; int nCandContr = 0; - for (uint64_t myGlobalID : vecCandPvContributorGlobId) { // o2-linter: disable=const-ref-in-for-loop (small type) + for (const uint64_t myGlobalID : vecCandPvContributorGlobId) { // o2-linter: disable=const-ref-in-for-loop (small type) auto trackIterator = std::find(vecPvContributorGlobId.begin(), vecPvContributorGlobId.end(), myGlobalID); /// track global index if (trackIterator != vecPvContributorGlobId.end()) { /// this is a contributor, let's remove it for the PV refit @@ -2057,7 +2057,7 @@ struct HfTrackIndexSkimCreator { return; } /// end of performPvRefitCandProngs function - template + template void run2And3Prongs(SelectedCollisions const& collisions, aod::BCsWithTimestamps const& bcWithTimeStamps, FilteredTrackAssocSel const&, @@ -2112,13 +2112,13 @@ struct HfTrackIndexSkimCreator { // auto centrality = collision.centV0M(); //FIXME add centrality when option for variations to the process function appears - int n2ProngBit = BIT(kN2ProngDecays) - 1; // bit value for 2-prong candidates where each candidate is one bit and they are all set to 1 - int n3ProngBit = BIT(kN3ProngDecays) - 1; // bit value for 3-prong candidates where each candidate is one bit and they are all set to 1 + const auto n2ProngBit = BIT(kN2ProngDecays) - 1; // bit value for 2-prong candidates where each candidate is one bit and they are all set to 1 + const auto n3ProngBit = BIT(kN3ProngDecays) - 1; // bit value for 3-prong candidates where each candidate is one bit and they are all set to 1 - std::array, kN2ProngDecays> cutStatus2Prong; - std::array, kN3ProngDecays> cutStatus3Prong; - bool nCutStatus2ProngBit[kN2ProngDecays]; // bit value for selection status for each 2-prong candidate where each selection is one bit and they are all set to 1 - bool nCutStatus3ProngBit[kN3ProngDecays]; // bit value for selection status for each 3-prong candidate where each selection is one bit and they are all set to 1 + std::array, kN2ProngDecays> cutStatus2Prong{}; + std::array, kN3ProngDecays> cutStatus3Prong{}; + uint8_t nCutStatus2ProngBit[kN2ProngDecays]; // bit value for selection status for each 2-prong candidate where each selection is one bit and they are all set to 1 + uint8_t nCutStatus3ProngBit[kN3ProngDecays]; // bit value for selection status for each 3-prong candidate where each selection is one bit and they are all set to 1 for (int iDecay2P = 0; iDecay2P < kN2ProngDecays; iDecay2P++) { nCutStatus2ProngBit[iDecay2P] = BIT(kNCuts2Prong[iDecay2P]) - 1; @@ -2133,7 +2133,7 @@ struct HfTrackIndexSkimCreator { int whichHypo3Prong[kN3ProngDecays]; // set the magnetic field from CCDB - auto bc = collision.bc_as(); + const auto bc = collision.bc_as(); initCCDB(bc, runNumber, ccdb, config.isRun2 ? config.ccdbPathGrp : config.ccdbPathGrpMag, lut, config.isRun2); df2.setBz(o2::base::Propagator::Instance()->getNominalBz()); df3.setBz(o2::base::Propagator::Instance()->getNominalBz()); @@ -2147,46 +2147,46 @@ struct HfTrackIndexSkimCreator { // return; //} - auto thisCollId = collision.globalIndex(); + const auto thisCollId = collision.globalIndex(); // first loop over positive tracks - auto groupedTrackIndicesPos1 = positiveFor2And3Prongs->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + const auto groupedTrackIndicesPos1 = positiveFor2And3Prongs->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); int lastFilledD0 = -1; // index to be filled in table for D* mesons for (auto trackIndexPos1 = groupedTrackIndicesPos1.begin(); trackIndexPos1 != groupedTrackIndicesPos1.end(); ++trackIndexPos1) { - auto trackPos1 = trackIndexPos1.template track_as(); + const auto trackPos1 = trackIndexPos1.template track_as(); // retrieve the selection flag that corresponds to this collision - auto isSelProngPos1 = trackIndexPos1.isSelProng(); - bool sel2ProngStatusPos = TESTBIT(isSelProngPos1, CandidateType::Cand2Prong); - bool sel3ProngStatusPos1 = TESTBIT(isSelProngPos1, CandidateType::Cand3Prong); + const auto isSelProngPos1 = trackIndexPos1.isSelProng(); + const bool sel2ProngStatusPos = TESTBIT(isSelProngPos1, CandidateType::Cand2Prong); + const bool sel3ProngStatusPos1 = TESTBIT(isSelProngPos1, CandidateType::Cand3Prong); auto trackParVarPos1 = getTrackParCov(trackPos1); - std::array pVecTrackPos1{trackPos1.pVector()}; - std::array dcaInfoPos1{trackPos1.dcaXY(), trackPos1.dcaZ()}; + std::array pVecTrackPos1{trackPos1.pVector()}; + std::array dcaInfoPos1{trackPos1.dcaXY(), trackPos1.dcaZ()}; if (thisCollId != trackPos1.collisionId()) { // this is not the "default" collision for this track, we have to re-propagate it o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParVarPos1, 2.f, noMatCorr, &dcaInfoPos1); getPxPyPz(trackParVarPos1, pVecTrackPos1); } // first loop over negative tracks - auto groupedTrackIndicesNeg1 = negativeFor2And3Prongs->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + const auto groupedTrackIndicesNeg1 = negativeFor2And3Prongs->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); for (auto trackIndexNeg1 = groupedTrackIndicesNeg1.begin(); trackIndexNeg1 != groupedTrackIndicesNeg1.end(); ++trackIndexNeg1) { - auto trackNeg1 = trackIndexNeg1.template track_as(); + const auto trackNeg1 = trackIndexNeg1.template track_as(); // retrieve the selection flag that corresponds to this collision - auto isSelProngNeg1 = trackIndexNeg1.isSelProng(); - bool sel2ProngStatusNeg = TESTBIT(isSelProngNeg1, CandidateType::Cand2Prong); - bool sel3ProngStatusNeg1 = TESTBIT(isSelProngNeg1, CandidateType::Cand3Prong); + const auto isSelProngNeg1 = trackIndexNeg1.isSelProng(); + const bool sel2ProngStatusNeg = TESTBIT(isSelProngNeg1, CandidateType::Cand2Prong); + const bool sel3ProngStatusNeg1 = TESTBIT(isSelProngNeg1, CandidateType::Cand3Prong); auto trackParVarNeg1 = getTrackParCov(trackNeg1); - std::array pVecTrackNeg1{trackNeg1.pVector()}; - std::array dcaInfoNeg1{trackNeg1.dcaXY(), trackNeg1.dcaZ()}; + std::array pVecTrackNeg1{trackNeg1.pVector()}; + std::array dcaInfoNeg1{trackNeg1.dcaXY(), trackNeg1.dcaZ()}; if (thisCollId != trackNeg1.collisionId()) { // this is not the "default" collision for this track, we have to re-propagate it o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParVarNeg1, 2.f, noMatCorr, &dcaInfoNeg1); getPxPyPz(trackParVarNeg1, pVecTrackNeg1); } - int isSelected2ProngCand = n2ProngBit; // bitmap for checking status of two-prong candidates (1 is true, 0 is rejected) + uint isSelected2ProngCand = n2ProngBit; // bitmap for checking status of two-prong candidates (1 is true, 0 is rejected) if (config.debug) { for (int iDecay2P = 0; iDecay2P < kN2ProngDecays; iDecay2P++) { @@ -2197,8 +2197,8 @@ struct HfTrackIndexSkimCreator { } // initialise PV refit coordinates and cov matrix for 2-prongs already here for D* - std::array pvRefitCoord2Prong = {collision.posX(), collision.posY(), collision.posZ()}; /// initialize to the original PV - std::array pvRefitCovMatrix2Prong = getPrimaryVertex(collision).getCov(); /// initialize to the original PV + std::array pvRefitCoord2Prong = {collision.posX(), collision.posY(), collision.posZ()}; /// initialize to the original PV + std::array pvRefitCovMatrix2Prong = getPrimaryVertex(collision).getCov(); /// initialize to the original PV // 2-prong vertex reconstruction float pt2Prong{-1.}; @@ -2221,8 +2221,8 @@ struct HfTrackIndexSkimCreator { // get secondary vertex const auto& secondaryVertex2 = df2.getPCACandidate(); // get track momenta - std::array pvec0; - std::array pvec1; + std::array pvec0{}; + std::array pvec1{}; df2.getTrack(0).getPxPyPzGlo(pvec0); df2.getTrack(1).getPxPyPzGlo(pvec1); @@ -2252,7 +2252,7 @@ struct HfTrackIndexSkimCreator { nCandContr--; isTrackSecondContr = false; } - if (nCandContr == 2) { + if (nCandContr == 2) { // o2-linter: disable="magic-number" (see comment below) /// Both the daughter tracks were used for the original PV refit, let's refit it after excluding them if (config.debugPvRefit) { LOG(info) << "### [2 Prong] Calling performPvRefitCandProngs for HF 2 prong candidate"; @@ -2286,24 +2286,24 @@ struct HfTrackIndexSkimCreator { } } - auto pVecCandProng2 = RecoDecay::pVec(pvec0, pvec1); + const auto pVecCandProng2 = RecoDecay::pVec(pvec0, pvec1); // 2-prong selections after secondary vertex - std::array pvCoord2Prong = {collision.posX(), collision.posY(), collision.posZ()}; + std::array pvCoord2Prong = {collision.posX(), collision.posY(), collision.posZ()}; if constexpr (doPvRefit) { pvCoord2Prong[0] = pvRefitCoord2Prong[0]; pvCoord2Prong[1] = pvRefitCoord2Prong[1]; pvCoord2Prong[2] = pvRefitCoord2Prong[2]; } applySelection2Prong(pVecCandProng2, secondaryVertex2, pvCoord2Prong, cutStatus2Prong, isSelected2ProngCand); - if (is2ProngCandidateGoodFor3Prong && config.do3Prong == 1) { + if (is2ProngCandidateGoodFor3Prong && config.do3Prong) { is2ProngCandidateGoodFor3Prong = isTwoTrackVertexSelectedFor3Prongs(secondaryVertex2, pvCoord2Prong, df2); } std::vector mlScoresD0{}; if (config.applyMlForHfFilters) { - auto trackParVarPcaPos1 = df2.getTrack(0); - auto trackParVarPcaNeg1 = df2.getTrack(1); - std::vector inputFeatures{trackParVarPcaPos1.getPt(), dcaInfoPos1[0], dcaInfoPos1[1], trackParVarPcaNeg1.getPt(), dcaInfoNeg1[0], dcaInfoNeg1[1]}; + const auto trackParVarPcaPos1 = df2.getTrack(0); + const auto trackParVarPcaNeg1 = df2.getTrack(1); + const std::vector inputFeatures{trackParVarPcaPos1.getPt(), dcaInfoPos1[0], dcaInfoPos1[1], trackParVarPcaNeg1.getPt(), dcaInfoNeg1[0], dcaInfoNeg1[1]}; applyMlSelectionForHfFilters2Prong(inputFeatures, mlScoresD0, isSelected2ProngCand); } @@ -2324,7 +2324,7 @@ struct HfTrackIndexSkimCreator { } if (config.debug) { - int prong2CutStatus[kN2ProngDecays]; + uint8_t prong2CutStatus[kN2ProngDecays]; for (int iDecay2P = 0; iDecay2P < kN2ProngDecays; iDecay2P++) { prong2CutStatus[iDecay2P] = nCutStatus2ProngBit[iDecay2P]; for (int iCut = 0; iCut < kNCuts2Prong[iDecay2P]; iCut++) { @@ -2341,11 +2341,11 @@ struct HfTrackIndexSkimCreator { registry.fill(HIST("hVtx2ProngX"), secondaryVertex2[0]); registry.fill(HIST("hVtx2ProngY"), secondaryVertex2[1]); registry.fill(HIST("hVtx2ProngZ"), secondaryVertex2[2]); - std::array, 2> arrMom = {pvec0, pvec1}; + const std::array arrMom{pvec0, pvec1}; for (int iDecay2P = 0; iDecay2P < kN2ProngDecays; iDecay2P++) { if (TESTBIT(isSelected2ProngCand, iDecay2P)) { if (TESTBIT(whichHypo2Prong[iDecay2P], 0)) { - auto mass2Prong = RecoDecay::m(arrMom, arrMass2Prong[iDecay2P][0]); + const auto mass2Prong = RecoDecay::m(arrMom, arrMass2Prong[iDecay2P][0]); switch (iDecay2P) { case hf_cand_2prong::DecayType::D0ToPiK: registry.fill(HIST("hMassD0ToPiK"), mass2Prong); @@ -2359,7 +2359,7 @@ struct HfTrackIndexSkimCreator { } } if (TESTBIT(whichHypo2Prong[iDecay2P], 1)) { - auto mass2Prong = RecoDecay::m(arrMom, arrMass2Prong[iDecay2P][1]); + const auto mass2Prong = RecoDecay::m(arrMom, arrMass2Prong[iDecay2P][1]); if (iDecay2P == hf_cand_2prong::DecayType::D0ToPiK) { registry.fill(HIST("hMassD0ToPiK"), mass2Prong); } @@ -2377,25 +2377,25 @@ struct HfTrackIndexSkimCreator { } // if the cut on the decay length of 3-prongs computed with the first two tracks is enabled and the vertex was not computed for the D0, we compute it now - if (config.do3Prong == 1 && is2ProngCandidateGoodFor3Prong && (config.minTwoTrackDecayLengthFor3Prongs > 0.f || config.maxTwoTrackChi2PcaFor3Prongs < 1.e9f) && nVtxFrom2ProngFitter == 0) { + if (config.do3Prong && is2ProngCandidateGoodFor3Prong && (config.minTwoTrackDecayLengthFor3Prongs > 0.f || config.maxTwoTrackChi2PcaFor3Prongs < 1.e9f) && nVtxFrom2ProngFitter == 0) { // o2-linter: disable="magic-number" (default maxTwoTrackChi2PcaFor3Prongs is 1.e10) try { nVtxFrom2ProngFitter = df2.process(trackParVarPos1, trackParVarNeg1); } catch (...) { } if (nVtxFrom2ProngFitter > 0) { const auto& secondaryVertex2 = df2.getPCACandidate(); - std::array pvCoord2Prong = {collision.posX(), collision.posY(), collision.posZ()}; + const std::array pvCoord2Prong{collision.posX(), collision.posY(), collision.posZ()}; is2ProngCandidateGoodFor3Prong = isTwoTrackVertexSelectedFor3Prongs(secondaryVertex2, pvCoord2Prong, df2); } else { is2ProngCandidateGoodFor3Prong = false; } } - if (config.do3Prong == 1 && is2ProngCandidateGoodFor3Prong) { // if 3 prongs are enabled and the first 2 tracks are selected for the 3-prong channels + if (config.do3Prong && is2ProngCandidateGoodFor3Prong) { // if 3 prongs are enabled and the first 2 tracks are selected for the 3-prong channels // second loop over positive tracks for (auto trackIndexPos2 = trackIndexPos1 + 1; trackIndexPos2 != groupedTrackIndicesPos1.end(); ++trackIndexPos2) { - int isSelected3ProngCand = n3ProngBit; + uint isSelected3ProngCand = n3ProngBit; if (!TESTBIT(trackIndexPos2.isSelProng(), CandidateType::Cand3Prong)) { // continue immediately if (!config.debug) { continue; @@ -2412,13 +2412,13 @@ struct HfTrackIndexSkimCreator { } } - auto trackPos2 = trackIndexPos2.template track_as(); + const auto trackPos2 = trackIndexPos2.template track_as(); auto trackParVarPos2 = getTrackParCov(trackPos2); - std::array dcaInfoPos2{trackPos2.dcaXY(), trackPos2.dcaZ()}; + std::array dcaInfoPos2{trackPos2.dcaXY(), trackPos2.dcaZ()}; // preselection of 3-prong candidates if (isSelected3ProngCand) { - std::array pVecTrackPos2{trackPos2.pVector()}; + std::array pVecTrackPos2{trackPos2.pVector()}; if (thisCollId != trackPos2.collisionId()) { // this is not the "default" collision for this track and we still did not re-propagate it, we have to re-propagate it o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParVarPos2, 2.f, noMatCorr, &dcaInfoPos2); getPxPyPz(trackParVarPos2, pVecTrackPos2); @@ -2433,8 +2433,8 @@ struct HfTrackIndexSkimCreator { } // 3-prong preselections - int8_t isIdentifiedPidTrackPos1 = trackIndexPos1.isIdentifiedPid(); - int8_t isIdentifiedPidTrackPos2 = trackIndexPos2.isIdentifiedPid(); + const auto isIdentifiedPidTrackPos1 = trackIndexPos1.isIdentifiedPid(); + const auto isIdentifiedPidTrackPos2 = trackIndexPos2.isIdentifiedPid(); applyPreselection3Prong(pVecTrackPos1, pVecTrackNeg1, pVecTrackPos2, isIdentifiedPidTrackPos1, isIdentifiedPidTrackPos2, cutStatus3Prong, whichHypo3Prong, isSelected3ProngCand); if (!config.debug && isSelected3ProngCand == 0) { continue; @@ -2442,8 +2442,8 @@ struct HfTrackIndexSkimCreator { } /// PV refit excluding the candidate daughters, if contributors - std::array pvRefitCoord3Prong2Pos1Neg = {collision.posX(), collision.posY(), collision.posZ()}; /// initialize to the original PV - std::array pvRefitCovMatrix3Prong2Pos1Neg = getPrimaryVertex(collision).getCov(); /// initialize to the original PV + std::array pvRefitCoord3Prong2Pos1Neg{collision.posX(), collision.posY(), collision.posZ()}; /// initialize to the original PV + std::array pvRefitCovMatrix3Prong2Pos1Neg{getPrimaryVertex(collision).getCov()}; /// initialize to the original PV if constexpr (doPvRefit) { if (config.fillHistograms) { registry.fill(HIST("PvRefit/verticesPerCandidate"), 1); @@ -2492,7 +2492,7 @@ struct HfTrackIndexSkimCreator { vecCandPvContributorGlobId.push_back(trackPos2.globalIndex()); } - if (nCandContr == 3 || nCandContr == 2) { + if (nCandContr == 3 || nCandContr == 2) { // o2-linter: disable="magic-number" (see comment below) /// At least two of the daughter tracks were used for the original PV refit, let's refit it after excluding them if (config.debugPvRefit) { LOG(info) << "### [3 prong] Calling performPvRefitCandProngs for HF 3 prong candidate, removing " << nCandContr << " daughters"; @@ -2544,23 +2544,23 @@ struct HfTrackIndexSkimCreator { // get secondary vertex const auto& secondaryVertex3 = df3.getPCACandidate(); // get track momenta - std::array pvec0; - std::array pvec1; - std::array pvec2; - auto trackParVarPcaPos1 = df3.getTrack(0); - auto trackParVarPcaNeg1 = df3.getTrack(1); - auto trackParVarPcaPos2 = df3.getTrack(2); + std::array pvec0{}; + std::array pvec1{}; + std::array pvec2{}; + const auto trackParVarPcaPos1 = df3.getTrack(0); + const auto trackParVarPcaNeg1 = df3.getTrack(1); + const auto trackParVarPcaPos2 = df3.getTrack(2); trackParVarPcaPos1.getPxPyPzGlo(pvec0); trackParVarPcaNeg1.getPxPyPzGlo(pvec1); trackParVarPcaPos2.getPxPyPzGlo(pvec2); - auto pVecCandProng3Pos = RecoDecay::pVec(pvec0, pvec1, pvec2); + const auto pVecCandProng3Pos = RecoDecay::pVec(pvec0, pvec1, pvec2); // 3-prong selections after secondary vertex applySelection3Prong(pVecCandProng3Pos, secondaryVertex3, pvRefitCoord3Prong2Pos1Neg, cutStatus3Prong, isSelected3ProngCand); std::array, kN3ProngDecays> mlScores3Prongs; if (config.applyMlForHfFilters) { - std::vector inputFeatures{trackParVarPcaPos1.getPt(), dcaInfoPos1[0], dcaInfoPos1[1], trackParVarPcaNeg1.getPt(), dcaInfoNeg1[0], dcaInfoNeg1[1], trackParVarPcaPos2.getPt(), dcaInfoPos2[0], dcaInfoPos2[1]}; + const std::vector inputFeatures{trackParVarPcaPos1.getPt(), dcaInfoPos1[0], dcaInfoPos1[1], trackParVarPcaNeg1.getPt(), dcaInfoNeg1[0], dcaInfoNeg1[1], trackParVarPcaPos2.getPt(), dcaInfoPos2[0], dcaInfoPos2[1]}; std::vector inputFeaturesLcPid{}; if constexpr (usePidForHfFiltersBdt) { inputFeaturesLcPid.push_back(trackPos1.tpcNSigmaPr()); @@ -2588,7 +2588,7 @@ struct HfTrackIndexSkimCreator { } if (config.debug) { - int prong3CutStatus[kN3ProngDecays]; + uint8_t prong3CutStatus[kN3ProngDecays]; for (int iDecay3P = 0; iDecay3P < kN3ProngDecays; iDecay3P++) { prong3CutStatus[iDecay3P] = nCutStatus3ProngBit[iDecay3P]; for (int iCut = 0; iCut < kNCuts3Prong[iDecay3P]; iCut++) { @@ -2605,11 +2605,11 @@ struct HfTrackIndexSkimCreator { registry.fill(HIST("hVtx3ProngX"), secondaryVertex3[0]); registry.fill(HIST("hVtx3ProngY"), secondaryVertex3[1]); registry.fill(HIST("hVtx3ProngZ"), secondaryVertex3[2]); - std::array, 3> arr3Mom = {pvec0, pvec1, pvec2}; + const std::array arr3Mom{pvec0, pvec1, pvec2}; for (int iDecay3P = 0; iDecay3P < kN3ProngDecays; iDecay3P++) { if (TESTBIT(isSelected3ProngCand, iDecay3P)) { if (TESTBIT(whichHypo3Prong[iDecay3P], 0)) { - auto mass3Prong = RecoDecay::m(arr3Mom, arrMass3Prong[iDecay3P][0]); + const auto mass3Prong = RecoDecay::m(arr3Mom, arrMass3Prong[iDecay3P][0]); switch (iDecay3P) { case hf_cand_3prong::DecayType::DplusToPiKPi: registry.fill(HIST("hMassDPlusToPiKPi"), mass3Prong); @@ -2626,7 +2626,7 @@ struct HfTrackIndexSkimCreator { } } if (TESTBIT(whichHypo3Prong[iDecay3P], 1)) { - auto mass3Prong = RecoDecay::m(arr3Mom, arrMass3Prong[iDecay3P][1]); + const auto mass3Prong = RecoDecay::m(arr3Mom, arrMass3Prong[iDecay3P][1]); switch (iDecay3P) { case hf_cand_3prong::DecayType::DsToKKPi: registry.fill(HIST("hMassDsToKKPi"), mass3Prong); @@ -2666,11 +2666,11 @@ struct HfTrackIndexSkimCreator { auto trackNeg2 = trackIndexNeg2.template track_as(); auto trackParVarNeg2 = getTrackParCov(trackNeg2); - std::array dcaInfoNeg2{trackNeg2.dcaXY(), trackNeg2.dcaZ()}; + std::array dcaInfoNeg2{trackNeg2.dcaXY(), trackNeg2.dcaZ()}; // preselection of 3-prong candidates if (isSelected3ProngCand) { - std::array pVecTrackNeg2{trackNeg2.pVector()}; + std::array pVecTrackNeg2{trackNeg2.pVector()}; if (thisCollId != trackNeg2.collisionId()) { // this is not the "default" collision for this track and we still did not re-propagate it, we have to re-propagate it o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParVarNeg2, 2.f, noMatCorr, &dcaInfoNeg2); getPxPyPz(trackParVarNeg2, pVecTrackNeg2); @@ -2694,8 +2694,8 @@ struct HfTrackIndexSkimCreator { } /// PV refit excluding the candidate daughters, if contributors - std::array pvRefitCoord3Prong1Pos2Neg = {collision.posX(), collision.posY(), collision.posZ()}; /// initialize to the original PV - std::array pvRefitCovMatrix3Prong1Pos2Neg = getPrimaryVertex(collision).getCov(); /// initialize to the original PV + std::array pvRefitCoord3Prong1Pos2Neg{collision.posX(), collision.posY(), collision.posZ()}; /// initialize to the original PV + std::array pvRefitCovMatrix3Prong1Pos2Neg{getPrimaryVertex(collision).getCov()}; /// initialize to the original PV if constexpr (doPvRefit) { if (config.fillHistograms) { registry.fill(HIST("PvRefit/verticesPerCandidate"), 1); @@ -2744,7 +2744,7 @@ struct HfTrackIndexSkimCreator { vecCandPvContributorGlobId.push_back(trackNeg2.globalIndex()); } - if (nCandContr == 3 || nCandContr == 2) { + if (nCandContr == 3 || nCandContr == 2) { // o2-linter: disable="magic-number" (see comment below) /// At least two of the daughter tracks were used for the original PV refit, let's refit it after excluding them if (config.debugPvRefit) { LOG(info) << "### [3 prong] Calling performPvRefitCandProngs for HF 3 prong candidate, removing " << nCandContr << " daughters"; @@ -2796,24 +2796,24 @@ struct HfTrackIndexSkimCreator { // get secondary vertex const auto& secondaryVertex3 = df3.getPCACandidate(); // get track momenta - std::array pvec0; - std::array pvec1; - std::array pvec2; - auto trackParVarPcaNeg1 = df3.getTrack(0); - auto trackParVarPcaPos1 = df3.getTrack(1); - auto trackParVarPcaNeg2 = df3.getTrack(2); + std::array pvec0{}; + std::array pvec1{}; + std::array pvec2{}; + const auto trackParVarPcaNeg1 = df3.getTrack(0); + const auto trackParVarPcaPos1 = df3.getTrack(1); + const auto trackParVarPcaNeg2 = df3.getTrack(2); trackParVarPcaNeg1.getPxPyPzGlo(pvec0); trackParVarPcaPos1.getPxPyPzGlo(pvec1); trackParVarPcaNeg2.getPxPyPzGlo(pvec2); - auto pVecCandProng3Neg = RecoDecay::pVec(pvec0, pvec1, pvec2); + const auto pVecCandProng3Neg = RecoDecay::pVec(pvec0, pvec1, pvec2); // 3-prong selections after secondary vertex applySelection3Prong(pVecCandProng3Neg, secondaryVertex3, pvRefitCoord3Prong1Pos2Neg, cutStatus3Prong, isSelected3ProngCand); - std::array, kN3ProngDecays> mlScores3Prongs; + std::array, kN3ProngDecays> mlScores3Prongs{}; if (config.applyMlForHfFilters) { - std::vector inputFeatures{trackParVarPcaNeg1.getPt(), dcaInfoNeg1[0], dcaInfoNeg1[1], trackParVarPcaPos1.getPt(), dcaInfoPos1[0], dcaInfoPos1[1], trackParVarPcaNeg2.getPt(), dcaInfoNeg2[0], dcaInfoNeg2[1]}; + const std::vector inputFeatures{trackParVarPcaNeg1.getPt(), dcaInfoNeg1[0], dcaInfoNeg1[1], trackParVarPcaPos1.getPt(), dcaInfoPos1[0], dcaInfoPos1[1], trackParVarPcaNeg2.getPt(), dcaInfoNeg2[0], dcaInfoNeg2[1]}; std::vector inputFeaturesLcPid{}; if constexpr (usePidForHfFiltersBdt) { inputFeaturesLcPid.push_back(trackNeg1.tpcNSigmaPr()); @@ -2834,8 +2834,8 @@ struct HfTrackIndexSkimCreator { if (config.applyMlForHfFilters) { rowTrackIndexMlScoreProng3(mlScores3Prongs[0], mlScores3Prongs[1], mlScores3Prongs[2], mlScores3Prongs[3]); } - // fill table row of coordinates of PV refit if constexpr (doPvRefit) { + // fill table row of coordinates of PV refit rowProng3PVrefit(pvRefitCoord3Prong1Pos2Neg[0], pvRefitCoord3Prong1Pos2Neg[1], pvRefitCoord3Prong1Pos2Neg[2], pvRefitCovMatrix3Prong1Pos2Neg[0], pvRefitCovMatrix3Prong1Pos2Neg[1], pvRefitCovMatrix3Prong1Pos2Neg[2], pvRefitCovMatrix3Prong1Pos2Neg[3], pvRefitCovMatrix3Prong1Pos2Neg[4], pvRefitCovMatrix3Prong1Pos2Neg[5]); } @@ -2858,11 +2858,11 @@ struct HfTrackIndexSkimCreator { registry.fill(HIST("hVtx3ProngX"), secondaryVertex3[0]); registry.fill(HIST("hVtx3ProngY"), secondaryVertex3[1]); registry.fill(HIST("hVtx3ProngZ"), secondaryVertex3[2]); - std::array, 3> arr3Mom = {pvec0, pvec1, pvec2}; + const std::array arr3Mom{pvec0, pvec1, pvec2}; for (int iDecay3P = 0; iDecay3P < kN3ProngDecays; iDecay3P++) { if (TESTBIT(isSelected3ProngCand, iDecay3P)) { if (TESTBIT(whichHypo3Prong[iDecay3P], 0)) { - auto mass3Prong = RecoDecay::m(arr3Mom, arrMass3Prong[iDecay3P][0]); + const auto mass3Prong = RecoDecay::m(arr3Mom, arrMass3Prong[iDecay3P][0]); switch (iDecay3P) { case hf_cand_3prong::DecayType::DplusToPiKPi: registry.fill(HIST("hMassDPlusToPiKPi"), mass3Prong); @@ -2879,7 +2879,7 @@ struct HfTrackIndexSkimCreator { } } if (TESTBIT(whichHypo3Prong[iDecay3P], 1)) { - auto mass3Prong = RecoDecay::m(arr3Mom, arrMass3Prong[iDecay3P][1]); + const auto mass3Prong = RecoDecay::m(arr3Mom, arrMass3Prong[iDecay3P][1]); switch (iDecay3P) { case hf_cand_3prong::DecayType::DsToKKPi: registry.fill(HIST("hMassDsToKKPi"), mass3Prong); @@ -2898,7 +2898,8 @@ struct HfTrackIndexSkimCreator { } } - if (config.doDstar && TESTBIT(isSelected2ProngCand, hf_cand_2prong::DecayType::D0ToPiK) && (pt2Prong + config.ptTolerance) * 1.2 > config.binsPtDstarToD0Pi->at(0) && whichHypo2Prong[kN2ProngDecays] != 0) { // if D* enabled and pt of the D0 is larger than the minimum of the D* one within 20% (D* and D0 momenta are very similar, always within 20% according to PYTHIA8) + if (config.doDstar && TESTBIT(isSelected2ProngCand, hf_cand_2prong::DecayType::D0ToPiK) && (pt2Prong + config.ptTolerance) * 1.2 > config.binsPtDstarToD0Pi->at(0) && whichHypo2Prong[kN2ProngDecays] != 0) { // o2-linter: disable="magic-number" (see comment below) + // if D* enabled and pt of the D0 is larger than the minimum of the D* one within 20% (D* and D0 momenta are very similar, always within 20% according to PYTHIA8) // second loop over positive tracks if (TESTBIT(whichHypo2Prong[kN2ProngDecays], 0) && (!config.applyKaonPidIn3Prongs || TESTBIT(trackIndexNeg1.isIdentifiedPid(), ChannelKaonPid))) { // only for D0 candidates; moreover if kaon PID enabled, apply to the negative track auto groupedTrackIndicesSoftPionsPos = positiveSoftPions->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); @@ -2907,10 +2908,10 @@ struct HfTrackIndexSkimCreator { continue; } auto trackPos2 = trackIndexPos2.template track_as(); - std::array pVecTrackPos2{trackPos2.pVector()}; + std::array pVecTrackPos2{trackPos2.pVector()}; if (thisCollId != trackPos2.collisionId()) { // this is not the "default" collision for this track, we have to re-propagate it auto trackParVarPos2 = getTrackParCov(trackPos2); - std::array dcaInfoPos2{trackPos2.dcaXY(), trackPos2.dcaZ()}; + std::array dcaInfoPos2{trackPos2.dcaXY(), trackPos2.dcaZ()}; o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParVarPos2, 2.f, noMatCorr, &dcaInfoPos2); getPxPyPz(trackParVarPos2, pVecTrackPos2); } @@ -2944,10 +2945,10 @@ struct HfTrackIndexSkimCreator { continue; } auto trackNeg2 = trackIndexNeg2.template track_as(); - std::array pVecTrackNeg2{trackNeg2.pVector()}; + std::array pVecTrackNeg2{trackNeg2.pVector()}; if (thisCollId != trackNeg2.collisionId()) { // this is not the "default" collision for this track, we have to re-propagate it auto trackParVarNeg2 = getTrackParCov(trackNeg2); - std::array dcaInfoNeg2{trackNeg2.dcaXY(), trackNeg2.dcaZ()}; + std::array dcaInfoNeg2{trackNeg2.dcaXY(), trackNeg2.dcaZ()}; o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParVarNeg2, 2.f, noMatCorr, &dcaInfoNeg2); getPxPyPz(trackParVarNeg2, pVecTrackNeg2); } @@ -2976,7 +2977,7 @@ struct HfTrackIndexSkimCreator { } } - int nTracks = 0; + const int nTracks = 0; // auto nTracks = trackIndicesPerCollision.lastIndex() - trackIndicesPerCollision.firstIndex(); // number of tracks passing 2 and 3 prong selection in this collision nCand2 = rowTrackIndexProng2.lastIndex() - nCand2; // number of 2-prong candidates in this collision nCand3 = rowTrackIndexProng3.lastIndex() - nCand3; // number of 3-prong candidates in this collision @@ -3003,7 +3004,7 @@ struct HfTrackIndexSkimCreator { FilteredTrackAssocSel const& trackIndices, TracksWithPVRefitAndDCA const& tracks) { - run2And3Prongs(collisions, bcWithTimeStamps, trackIndices, tracks); + run2And3Prongs(collisions, bcWithTimeStamps, trackIndices, tracks); } PROCESS_SWITCH(HfTrackIndexSkimCreator, process2And3ProngsWithPvRefit, "Process 2-prong and 3-prong skim with PV refit", false); @@ -3013,7 +3014,7 @@ struct HfTrackIndexSkimCreator { FilteredTrackAssocSel const& trackIndices, aod::TracksWCovDcaExtra const& tracks) { - run2And3Prongs(collisions, bcWithTimeStamps, trackIndices, tracks); + run2And3Prongs(collisions, bcWithTimeStamps, trackIndices, tracks); } PROCESS_SWITCH(HfTrackIndexSkimCreator, process2And3ProngsNoPvRefit, "Process 2-prong and 3-prong skim without PV refit", true); @@ -3051,6 +3052,7 @@ struct HfTrackIndexSkimCreatorCascades { Produces rowTrackIndexCasc; struct : ConfigurableGroup { + double etaMinDefault{-99999.}; Configurable isRun2{"isRun2", false, "enable Run 2 or Run 3 GRP objects for magnetic field"}; Configurable fillHistograms{"fillHistograms", true, "fill histograms"}; // vertexing @@ -3063,7 +3065,7 @@ struct HfTrackIndexSkimCreatorCascades { Configurable useAbsDCA{"useAbsDCA", true, "Minimise abs. distance rather than chi2"}; Configurable useWeightedFinalPCA{"useWeightedFinalPCA", true, "Recalculate vertex position using track covariances, effective only if useAbsDCA is true"}; // track cuts for V0 daughters - Configurable etaMinV0Daugh{"etaMinV0Daugh", -99999., "min. pseudorapidity V0 daughters"}; + Configurable etaMinV0Daugh{"etaMinV0Daugh", std::forward(etaMinDefault), "min. pseudorapidity V0 daughters"}; Configurable etaMaxV0Daugh{"etaMaxV0Daugh", 1.1, "max. pseudorapidity V0 daughters"}; Configurable ptMinV0Daugh{"ptMinV0Daugh", 0.05, "min. pT V0 daughters"}; // v0 cuts @@ -3109,7 +3111,7 @@ struct HfTrackIndexSkimCreatorCascades { return; } - if (config.etaMinV0Daugh == -99999.) { + if (config.etaMinV0Daugh == config.etaMinDefault) { config.etaMinV0Daugh.value = -config.etaMaxV0Daugh; } @@ -3150,7 +3152,7 @@ struct HfTrackIndexSkimCreatorCascades { { // set the magnetic field from CCDB for (const auto& collision : collisions) { - auto bc = collision.bc_as(); + const auto bc = collision.bc_as(); initCCDB(bc, runNumber, ccdb, config.isRun2 ? config.ccdbPathGrp : config.ccdbPathGrpMag, lut, config.isRun2); if (config.useDCAFitter) { df2.setBz(o2::base::Propagator::Instance()->getNominalBz()); @@ -3158,17 +3160,17 @@ struct HfTrackIndexSkimCreatorCascades { } const auto thisCollId = collision.globalIndex(); - auto groupedBachTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto groupedV0s = v0s.sliceBy(v0sPerCollision, thisCollId); + const auto groupedBachTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + const auto groupedV0s = v0s.sliceBy(v0sPerCollision, thisCollId); // fist we loop over the bachelor candidate for (const auto& bachIdx : groupedBachTrackIndices) { - auto bach = bachIdx.track_as(); - std::array pVecBach{bach.pVector()}; + const auto bach = bachIdx.track_as(); + std::array pVecBach{bach.pVector()}; auto trackBach = getTrackParCov(bach); if (thisCollId != bach.collisionId()) { // this is not the "default" collision for this track, we have to re-propagate it - std::array dcaInfoBach{bach.dcaXY(), bach.dcaZ()}; + std::array dcaInfoBach{bach.dcaXY(), bach.dcaZ()}; o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackBach, 2.f, noMatCorr, &dcaInfoBach); getPxPyPz(trackBach, pVecBach); } @@ -3184,18 +3186,18 @@ struct HfTrackIndexSkimCreatorCascades { continue; } - std::array pVecPos = {v0.pxpos(), v0.pypos(), v0.pzpos()}; - std::array pVecNeg = {v0.pxneg(), v0.pyneg(), v0.pzneg()}; + const std::array pVecPos{v0.pxpos(), v0.pypos(), v0.pzpos()}; + const std::array pVecNeg{v0.pxneg(), v0.pyneg(), v0.pzneg()}; - float ptPos = RecoDecay::pt(pVecPos); - float ptNeg = RecoDecay::pt(pVecNeg); + const float ptPos = RecoDecay::pt(pVecPos); + const float ptNeg = RecoDecay::pt(pVecNeg); if (ptPos < config.ptMinV0Daugh || // to the filters? I can't for now, it is not in the tables ptNeg < config.ptMinV0Daugh) { continue; } - float etaPos = RecoDecay::eta(pVecPos); - float etaNeg = RecoDecay::eta(pVecNeg); + const float etaPos = RecoDecay::eta(pVecPos); + const float etaNeg = RecoDecay::eta(pVecNeg); if ((etaPos > config.etaMaxV0Daugh || etaPos < config.etaMinV0Daugh) || // to the filters? I can't for now, it is not in the tables (etaNeg > config.etaMaxV0Daugh || etaNeg < config.etaMinV0Daugh)) { continue; @@ -3211,7 +3213,7 @@ struct HfTrackIndexSkimCreatorCascades { continue; } - std::array pVecV0 = {v0.px(), v0.py(), v0.pz()}; + std::array pVecV0{v0.px(), v0.py(), v0.pz()}; // invariant-mass cut: we do it here, before updating the momenta of bach and V0 during the fitting to save CPU // TODO: but one should better check that the value here and after the fitter do not change significantly!!! @@ -3223,11 +3225,12 @@ struct HfTrackIndexSkimCreatorCascades { // now we find the DCA between the V0 and the bachelor, for the cascade if (config.useDCAFitter) { - const std::array vertexV0 = {v0.x(), v0.y(), v0.z()}; + const std::array vertexV0{v0.x(), v0.y(), v0.z()}; // we build the neutral track to then build the cascade - std::array covV = {0.}; - constexpr int MomInd[6] = {9, 13, 14, 18, 19, 20}; // cov matrix elements for momentum component - for (int i = 0; i < 6; i++) { + std::array covV{}; + constexpr std::size_t NIndicesMom{6u}; + constexpr std::size_t MomInd[NIndicesMom] = {9, 13, 14, 18, 19, 20}; // cov matrix elements for momentum component + for (std::size_t i = 0; i < NIndicesMom; i++) { covV[MomInd[i]] = v0.momentumCovMat()[i]; covV[i] = v0.positionCovMat()[i]; } @@ -3251,7 +3254,7 @@ struct HfTrackIndexSkimCreatorCascades { } // cascade candidate pT cut - auto ptCascCand = RecoDecay::pt(pVecBach, pVecV0); + const auto ptCascCand = RecoDecay::pt(pVecBach, pVecV0); if (ptCascCand < config.ptCascCandMin) { continue; } @@ -3259,10 +3262,10 @@ struct HfTrackIndexSkimCreatorCascades { // invariant mass // re-calculate invariant masses with updated momenta, to fill the histogram mass2K0sP = RecoDecay::m(std::array{pVecBach, pVecV0}, std::array{MassProton, MassK0Short}); - std::array posCasc = {0., 0., 0.}; + std::array posCasc{0., 0., 0.}; if (config.useDCAFitter) { const auto& cascVtx = df2.getPCACandidate(); - for (int iCoord{0}; iCoord < 3; ++iCoord) { + for (int iCoord{0}; iCoord < 3; ++iCoord) { // o2-linter: disable="magic-number" ({x, y, z} coordinates}) posCasc[iCoord] = cascVtx[iCoord]; } } @@ -3355,8 +3358,8 @@ struct HfTrackIndexSkimCreatorLfCascades { // array of PDG masses of possible charm baryon daughters static constexpr int kN2ProngDecays = hf_cand_casc_lf::DecayType2Prong::N2ProngDecays; // number of 2-prong hadron types static constexpr int kN3ProngDecays = hf_cand_casc_lf::DecayType3Prong::N3ProngDecays; // number of 3-prong hadron types - std::array, kN2ProngDecays> arrMass2Prong; - std::array, kN3ProngDecays> arrMass3Prong; + std::array, kN2ProngDecays> arrMass2Prong{}; + std::array, kN3ProngDecays> arrMass3Prong{}; using SelectedCollisions = soa::Filtered>; using SelectedHfTrackAssoc = soa::Filtered>; @@ -3399,9 +3402,9 @@ struct HfTrackIndexSkimCreatorLfCascades { runNumber = 0; if (config.fillHistograms) { - AxisSpec ptAxis = {400, 0.0f, 20.0f, "it{p}_{T} (GeV/c)"}; - AxisSpec massAxisXi = {200, 1.222f, 1.422f, "Inv. Mass (GeV/c^{2})"}; - AxisSpec massAxisOmega = {200, 1.572f, 1.772f, "Inv. Mass (GeV/c^{2})"}; + const AxisSpec ptAxis = {400, 0.0f, 20.0f, "it{p}_{T} (GeV/c)"}; + const AxisSpec massAxisXi = {200, 1.222f, 1.422f, "Inv. Mass (GeV/c^{2})"}; + const AxisSpec massAxisOmega = {200, 1.572f, 1.772f, "Inv. Mass (GeV/c^{2})"}; registry.add("hCandidateCounter", "hCandidateCounter", {HistType::kTH1D, {{10, 0.0f, 10.0f}}}); @@ -3501,7 +3504,7 @@ struct HfTrackIndexSkimCreatorLfCascades { template bool isPreselectedCandidateXic(T1 const& pVecXi, T1 const& pVecPi1, T1 const& pVecPi2) { - // pt + // pT if (config.ptMinXicplusLfCasc > 0.f) { const auto pt = RecoDecay::pt(pVecXi, pVecPi1, pVecPi2) + config.ptTolerance; // add tolerance because of no reco decay vertex if (pt < config.ptMinXicplusLfCasc) { @@ -3531,7 +3534,7 @@ struct HfTrackIndexSkimCreatorLfCascades { template bool isSelectedCandidateXic(const T1& pVecCand, const T2& secVtx, const T3& primVtx) { - // pt + // pT if (config.ptMinXicplusLfCasc > 0.f) { const auto pt = RecoDecay::pt(pVecCand); if (pt < config.ptMinXicplusLfCasc) { @@ -3619,11 +3622,12 @@ struct HfTrackIndexSkimCreatorLfCascades { continue; } - const std::array vertexCasc = {casc.x(), casc.y(), casc.z()}; - const std::array pVecCasc = {casc.px(), casc.py(), casc.pz()}; - std::array covCasc = {0.}; - constexpr int MomInd[6] = {9, 13, 14, 18, 19, 20}; // cov matrix elements for momentum component - for (int i = 0; i < 6; i++) { + const std::array vertexCasc{casc.x(), casc.y(), casc.z()}; + const std::array pVecCasc{casc.px(), casc.py(), casc.pz()}; + std::array covCasc{}; + constexpr std::size_t NIndicesMom{6u}; + constexpr std::size_t MomInd[NIndicesMom] = {9, 13, 14, 18, 19, 20}; // cov matrix elements for momentum component + for (std::size_t i = 0; i < NIndicesMom; i++) { covCasc[MomInd[i]] = casc.momentumCovMat()[i]; covCasc[i] = casc.positionCovMat()[i]; } @@ -3689,14 +3693,14 @@ struct HfTrackIndexSkimCreatorLfCascades { df2.propagateTracksToVertex(); if (df2.isPropagateTracksToVertexDone()) { - std::array pVecXi = {0.}; - std::array pVecPion1XiHyp = {0.}; + std::array pVecXi{}; + std::array pVecPion1XiHyp{}; df2.getTrack(0).getPxPyPzGlo(pVecXi); df2.getTrack(1).getPxPyPzGlo(pVecPion1XiHyp); - float ptXic = RecoDecay::pt(pVecXi, pVecPion1XiHyp); + const float ptXic = RecoDecay::pt(pVecXi, pVecPion1XiHyp); - std::array, 2> arrMomToXi = {pVecXi, pVecPion1XiHyp}; - auto mass2ProngXiHyp = RecoDecay::m(arrMomToXi, arrMass2Prong[hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi]); + const std::array arrMomToXi{pVecXi, pVecPion1XiHyp}; + const auto mass2ProngXiHyp = RecoDecay::m(arrMomToXi, arrMass2Prong[hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi]); if ((std::abs(casc.mXi() - MassXiMinus) < config.cascadeMassWindow) && (mass2ProngXiHyp >= config.massXiPiMin) && (mass2ProngXiHyp <= config.massXiPiMax)) { registry.fill(HIST("hRejpTStatusXicZeroOmegacZeroToXiPi"), 0); @@ -3736,15 +3740,15 @@ struct HfTrackIndexSkimCreatorLfCascades { if (df2.isPropagateTracksToVertexDone()) { - std::array pVecOmega = {0.}; - std::array pVecCharmBachelor1OmegaHyp = {0.}; + std::array pVecOmega{}; + std::array pVecCharmBachelor1OmegaHyp{}; df2.getTrack(0).getPxPyPzGlo(pVecOmega); df2.getTrack(1).getPxPyPzGlo(pVecCharmBachelor1OmegaHyp); - float ptOmegac = RecoDecay::pt(pVecOmega, pVecCharmBachelor1OmegaHyp); + const float ptOmegac = RecoDecay::pt(pVecOmega, pVecCharmBachelor1OmegaHyp); - std::array, 2> arrMomToOmega = {pVecOmega, pVecCharmBachelor1OmegaHyp}; - auto mass2ProngOmegaPiHyp = RecoDecay::m(arrMomToOmega, arrMass2Prong[hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi]); - auto mass2ProngOmegaKHyp = RecoDecay::m(arrMomToOmega, arrMass2Prong[hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaK]); + const std::array arrMomToOmega{pVecOmega, pVecCharmBachelor1OmegaHyp}; + const auto mass2ProngOmegaPiHyp = RecoDecay::m(arrMomToOmega, arrMass2Prong[hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi]); + const auto mass2ProngOmegaKHyp = RecoDecay::m(arrMomToOmega, arrMass2Prong[hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaK]); if (std::abs(casc.mOmega() - MassOmegaMinus) < config.cascadeMassWindow) { if ((mass2ProngOmegaPiHyp >= config.massOmegaCharmBachelorMin) && (mass2ProngOmegaPiHyp <= config.massOmegaCharmBachelorMax)) { From e691fd3661e445b4ae2e520fbee7c4fbf9fbafca Mon Sep 17 00:00:00 2001 From: Francesco Mazzaschi <43742195+fmazzasc@users.noreply.github.com> Date: Wed, 17 Sep 2025 15:55:16 +0200 Subject: [PATCH 424/986] [PWGLF] Fix process function (#12993) Co-authored-by: Francesco Mazzaschi --- PWGLF/Tasks/Strangeness/xiLambdaCorr.cxx | 66 ++++++++++++------------ 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/xiLambdaCorr.cxx b/PWGLF/Tasks/Strangeness/xiLambdaCorr.cxx index 18a07e19926..6e737616695 100644 --- a/PWGLF/Tasks/Strangeness/xiLambdaCorr.cxx +++ b/PWGLF/Tasks/Strangeness/xiLambdaCorr.cxx @@ -9,27 +9,15 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include "PWGLF/DataModel/LFDoubleCascTables.h" +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" #include "PWGLF/DataModel/LFStrangenessTables.h" -#include "Common/Core/PID/TPCPIDResponse.h" #include "Common/Core/RecoDecay.h" -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/PIDResponse.h" -#include "Common/DataModel/TrackSelectionTables.h" - -#include "DataFormatsParameters/GRPMagField.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DetectorsBase/GeometryManager.h" -#include "DetectorsBase/Propagator.h" + #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/Track.h" #include "TDatabasePDG.h" #include @@ -42,21 +30,22 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -using Collisions = soa::Join::iterator; -using FullCascades = aod::CascDataExt; -using FullV0s = aod::V0Datas; -using TracksFull = soa::Join; +using Collisions = soa::Join::iterator; +using FullV0s = soa::Join; +using FullCascades = soa::Join; +using TracksFull = soa::Join; + struct xiLambdaCorr { - ConfigurableAxis centAxis{"centAxis", {106, 0, 106}, "binning for the centrality"}; ConfigurableAxis zVtxAxis{"zVtxBins", {100, -20.f, 20.f}, "Binning for the vertex z in cm"}; // binning of (anti)lambda mass QA histograms - ConfigurableAxis massLambdaAxis{"massLambdaAxis", {200, o2::constants::physics::MassLambda - 0.05f, o2::constants::physics::MassLambda + 0.05f}, "binning for the lambda invariant-mass"}; - ConfigurableAxis massXiAxis{"massXiAxis", {200, o2::constants::physics::MassXiMinus - 0.05f, o2::constants::physics::MassXiMinus + 0.05f}, "binning for the Xi invariant-mass"}; + ConfigurableAxis massLambdaAxis{"massLambdaAxis", {100, o2::constants::physics::MassLambda - 0.05f, o2::constants::physics::MassLambda + 0.05f}, "binning for the lambda invariant-mass"}; + ConfigurableAxis massXiAxis{"massXiAxis", {100, o2::constants::physics::MassXiMinus - 0.05f, o2::constants::physics::MassXiMinus + 0.05f}, "binning for the Xi invariant-mass"}; ConfigurableAxis massXiLambdaAxis{"massXiLambdaAxis", {200, o2::constants::physics::MassXiMinus + o2::constants::physics::MassLambda, o2::constants::physics::MassXiMinus + o2::constants::physics::MassLambda + 0.1f}, "binning for the Xi+Lambda invariant-mass"}; + ConfigurableAxis cosPAxis{"cosPAxis", {10, 0.99f, 1.f}, "binning for the cosine of the pointing angle"}; Configurable zVtxMax{"zVtxMax", 10.0f, "maximum z position of the primary vertex"}; Configurable etaMax{"etaMax", 0.9f, "maximum eta"}; - ConfigurableAxis momAxis{"momAxisFine", {5.e2, 0.f, 5.f}, "momentum axis binning"}; + ConfigurableAxis momAxis{"momAxisFine", {50, 0.f, 10.f}, "momentum axis binning"}; ConfigurableAxis mixTypeAxis{"mixTypeAxis", {4, -0.5f, 3.5f}, "mixing type axis"}; // xi - lambda , xi - anti-lambda, anti-xi - lambda, anti-xi - anti-lambda Configurable cascPtMin{"cascPtMin", 1.f, "minimum (anti)casc pT (GeV/c)"}; @@ -83,9 +72,6 @@ struct xiLambdaCorr { template bool selectTrack(T const& track) { - if (std::abs(track.eta()) > etaMax) { - return false; - } if (track.tpcNClsFound() < minNTPCClus) { return false; } @@ -98,16 +84,20 @@ struct xiLambdaCorr { histos.add("QA/zVtx", ";#it{z}_{vtx} (cm);Entries", HistType::kTH1F, {zVtxAxis}); histos.add("QA/massLambda", ";#it{p}_{T} (GeV/#it{c});#it{m}_{#Lambda} (GeV/#it{c}^{2})", HistType::kTH2F, {momAxis, massLambdaAxis}); histos.add("QA/massXi", ";#it{p}_{T} (GeV/#it{c});#it{m}_{#Xi} (GeV/#it{c}^{2})", HistType::kTH2F, {momAxis, massXiAxis}); - histos.add("xiMinusLambda", "", {HistType::kTHnSparseF, {massXiLambdaAxis, momAxis, mixTypeAxis}}); + histos.add("xiMinusLambda", "", {HistType::kTHnSparseF, {massXiLambdaAxis, momAxis, massXiAxis, massLambdaAxis, cosPAxis, cosPAxis, mixTypeAxis}}); } template bool isSelectedCasc(C const& collision, T const&, FullCascades::iterator const& casc) { - auto bachelor = casc.bachelor_as(); - auto posDau = casc.posTrack_as(); - auto negDau = casc.negTrack_as(); + if (std::abs(casc.positiveeta()) > 0.9 || std::abs(casc.negativeeta()) > 0.9 || std::abs(casc.bacheloreta()) > 0.9) { + return false; + } + + auto bachelor = casc.bachTrackExtra_as(); + auto posDau = casc.posTrackExtra_as(); + auto negDau = casc.negTrackExtra_as(); if (!selectTrack(bachelor) || !selectTrack(posDau) || !selectTrack(negDau)) { return false; @@ -138,6 +128,7 @@ struct xiLambdaCorr { if (casc.mXi() > o2::constants::physics::MassXiMinus - mXiWindow && casc.mXi() < o2::constants::physics::MassXiMinus + mXiWindow) { massInWindow = true; } + if (!massInWindow) { return false; } @@ -148,8 +139,12 @@ struct xiLambdaCorr { template bool isSelectedLambda(T const&, FullV0s::iterator const& v0) { - auto posDau = v0.posTrack_as(); - auto negDau = v0.negTrack_as(); + auto posDau = v0.posTrackExtra_as(); + auto negDau = v0.negTrackExtra_as(); + + if (std::abs(v0.positiveeta()) > 0.9 || std::abs(v0.negativeeta()) > 0.9) { + return false; + } if (!selectTrack(posDau) || !selectTrack(negDau)) { return false; @@ -198,7 +193,7 @@ struct xiLambdaCorr { if (!isSelectedLambda(tracks, v0)) { continue; } - if (casc.posTrackId() == v0.posTrackId() || casc.posTrackId() == v0.negTrackId()) { + if (casc.posTrackExtraId() == v0.posTrackExtraId() || casc.posTrackExtraId() == v0.negTrackExtraId()) { continue; } @@ -216,7 +211,11 @@ struct xiLambdaCorr { ROOT::Math::LorentzVector> cascMom4D(casc.px(), casc.py(), casc.pz(), o2::constants::physics::MassXiMinus); ROOT::Math::LorentzVector> lambdaMom4D{v0.px(), v0.py(), v0.pz(), o2::constants::physics::MassLambda}; auto xiLambdaMom4D = cascMom4D + lambdaMom4D; - histos.fill(HIST("xiMinusLambda"), xiLambdaMom4D.M(), xiLambdaMom4D.Pt(), mixType); + float massLambda = v0.alpha() > 0 ? v0.mLambda() : v0.mAntiLambda(); + float massXi = casc.mXi(); + float cosPAxi = casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ()); + float cosPAlambda = v0.v0cosPA(); + histos.fill(HIST("xiMinusLambda"), xiLambdaMom4D.M(), xiLambdaMom4D.Pt(), massXi, massLambda, cosPAxi, cosPAlambda, mixType); } } }; @@ -236,6 +235,7 @@ struct xiLambdaCorr { histos.fill(HIST("QA/zVtx"), collision.posZ()); fillXiLambda(collision, tracks, v0s, cascades); } + PROCESS_SWITCH(xiLambdaCorr, processData, "Process data", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 2edd75a249d6d587c858d8fe9af302c7453e6fff Mon Sep 17 00:00:00 2001 From: Giovanni Malfattore <89481844+giovannimalfattore@users.noreply.github.com> Date: Wed, 17 Sep 2025 17:19:45 +0200 Subject: [PATCH 425/986] [PWGLF] NucleiTask - Change pdgMothers axis (#13011) --- PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx | 457 +++++++++++++------------- 1 file changed, 220 insertions(+), 237 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx b/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx index 3e365e0991d..00b45796326 100644 --- a/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx +++ b/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx @@ -265,7 +265,7 @@ struct LFNucleiBATask { "^{3}_{#Lambda}H", "He4"}; - static constexpr int kMaxNumMom = 4; // X: 0..4, overflow=5 + static constexpr int kMaxNumMom = 2; // X: 0..4, overflow=5 template float averageClusterSizeTrk(const TrackType& track) @@ -652,20 +652,13 @@ struct LFNucleiBATask { histos.add("tracks/triton/h1antiTritonSpectra", "#it{p}_{T} (#bar{t})", HistType::kTH1F, {ptAxis}); } if (enableHe) { - // histos.add("tracks/helium/h1HeliumSpectra", "#it{p}_{T}/z (He)", HistType::kTH1F, {ptZHeAxis}); - // histos.add("tracks/helium/h1antiHeliumSpectra", "#it{p}_{T}/z (#bar{He})", HistType::kTH1F, {ptZHeAxis}); - - // histos.add("tracks/helium/h2HeliumYvsPt", "#it{y} vs #it{p}_{T}/z (He)", HistType::kTH2F, {{96, -1.2, 1.2}, {ptZHeAxis}}); histos.add("tracks/helium/h2HeliumYvsPt_Z2", "#it{y} vs #it{p}_{T} (He)", HistType::kTH2F, {{96, -1.2, 1.2}, {ptHeAxis}}); - // histos.add("tracks/helium/h2HeliumEtavsPt", "#it{#eta} vs #it{p}_{T}/z (He)", HistType::kTH2F, {{96, -1.2, 1.2}, {ptZHeAxis}}); histos.add("tracks/helium/h2HeliumEtavsPt_Z2", "#it{#eta} vs #it{p}_{T} (He)", HistType::kTH2F, {{96, -1.2, 1.2}, {ptHeAxis}}); histos.add("tracks/helium/h1HeliumSpectra_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); histos.add("tracks/helium/h1antiHeliumSpectra_Z2", "#it{p}_{T} (#bar{He})", HistType::kTH1F, {ptHeAxis}); - // histos.add("tracks/helium/h2antiHeliumYvsPt", "#it{y} vs #it{p}_{T}/z (#bar{He})", HistType::kTH2F, {{96, -1.2, 1.2}, {ptZHeAxis}}); histos.add("tracks/helium/h2antiHeliumYvsPt_Z2", "#it{y} vs #it{p}_{T} (#bar{He})", HistType::kTH2F, {{96, -1.2, 1.2}, {ptHeAxis}}); - // histos.add("tracks/helium/h2antiHeliumEtavsPt", "#it{#eta} vs #it{p}_{T}/z (#bar{He})", HistType::kTH2F, {{96, -1.2, 1.2}, {ptZHeAxis}}); histos.add("tracks/helium/h2antiHeliumEtavsPt_Z2", "#it{#eta} vs #it{p}_{T} (#bar{He})", HistType::kTH2F, {{96, -1.2, 1.2}, {ptHeAxis}}); } if (enableAl) { @@ -673,6 +666,13 @@ struct LFNucleiBATask { histos.add("tracks/alpha/h1antiAlphaSpectra", "#it{p}_{T} (#bar{#alpha})", HistType::kTH1F, {ptAxis}); } if (doprocessMCReco || doprocessMCRecoLfPid || doprocessMCRecoFiltered || doprocessMCRecoFilteredLight) { + + histos.add("hItsDeHeChecker", "d and {}^{3}He counters", HistType::kTH1F, {{4, -0.5, 3.5}}); + histos.get(HIST("hItsDeHeChecker"))->GetXaxis()->SetBinLabel(1, "totDe"); + histos.get(HIST("hItsDeHeChecker"))->GetXaxis()->SetBinLabel(2, "totHe"); + histos.get(HIST("hItsDeHeChecker"))->GetXaxis()->SetBinLabel(3, "keptDe"); + histos.get(HIST("hItsDeHeChecker"))->GetXaxis()->SetBinLabel(4, "keptHe"); + // inclusive production if (enableTrackingEff) { debugHistos.add("tracks/trackingEff/h1_its", "#it{p}_{T} (p)", HistType::kTH1F, {ptAxis}); @@ -909,14 +909,29 @@ struct LFNucleiBATask { histos.add("tracks/proton/dca/before/hDCAxyVsPtProtonTruePrim", "DCAxy vs Pt (p); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/proton/dca/before/hDCAxyVsPtProtonTrueSec", "DCAxy vs Pt (p); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/proton/dca/before/hDCAxyVsPtProtonTrueMaterial", "DCAxy vs Pt (p); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/proton/dca/before/hDCAxyVsPtProtonTrueTransport", "DCAxy vs Pt (p); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); + + histos.add("tracks/proton/dca/before/hNumMothers", "N mothers per particle; N mothers;counts", HistType::kTH1I, {{7, 1.0, 8.0}}); + histos.add("tracks/proton/dca/before/hMomTrueMaterial", "MC mothers;mother index;mother type; mother #it{p}_{T}", HistType::kTH3F, {{2, -2.0, 2.0}, {kNumMotherList + 2, -1.5, static_cast(kNumMotherList) + 0.5}, {150, 0.0, 15.0}}); + + std::shared_ptr hTempPr = histos.get(HIST("tracks/proton/dca/before/hMomTrueMaterial")); + TH3* hPdgPr = hTempPr.get(); + + TAxis* axPdgPr = hPdgPr->GetXaxis(); + axPdgPr->SetBinLabel(1, "antiparticles"); + axPdgPr->SetBinLabel(2, "particles"); + + TAxis* ayPdgPr = hPdgPr->GetYaxis(); + ayPdgPr->SetBinLabel(1, "undef."); + ayPdgPr->SetBinLabel(2, "other"); + for (int i = 0; i < kNumMotherList; i++) { + ayPdgPr->SetBinLabel(i + 3, kMotherNames[i]); + } histos.add("tracks/proton/dca/before/hDCAxyVsPtantiProtonTrue", "DCAxy vs Pt (#bar{p}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/proton/dca/before/hDCAxyVsPtantiProtonTruePrim", "DCAxy vs Pt (#bar{p}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/proton/dca/before/hDCAxyVsPtantiProtonTrueSec", "DCAxy vs Pt (#bar{p}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/proton/dca/before/hDCAxyVsPtantiProtonTrueMaterial", "DCAxy vs Pt (#bar{p}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/proton/dca/before/hDCAxyVsPtantiProtonTrueTransport", "DCAxy vs Pt (#bar{p}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); if (outFlagOptions.doTOFplots) { histos.add("tracks/proton/dca/before/TOF/hDCAxyVsPtProtonTrue", "DCAxy vs Pt (p); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); @@ -924,28 +939,24 @@ struct LFNucleiBATask { histos.add("tracks/proton/dca/before/TOF/hDCAxyVsPtProtonTruePrim", "DCAxy vs Pt (p); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/proton/dca/before/TOF/hDCAxyVsPtProtonTrueSec", "DCAxy vs Pt (p); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/proton/dca/before/TOF/hDCAxyVsPtProtonTrueMaterial", "DCAxy vs Pt (p); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/proton/dca/before/TOF/hDCAxyVsPtProtonTrueTransport", "DCAxy vs Pt (p); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/proton/dca/before/TOF/hDCAxyVsPtantiProtonTrue", "DCAxy vs Pt (#bar{p}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/proton/dca/before/TOF/hDCAxyVsPtantiProtonTruePrim", "DCAxy vs Pt (#bar{p}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/proton/dca/before/TOF/hDCAxyVsPtantiProtonTrueSec", "DCAxy vs Pt (#bar{p}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/proton/dca/before/TOF/hDCAxyVsPtantiProtonTrueMaterial", "DCAxy vs Pt (#bar{p}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/proton/dca/before/TOF/hDCAxyVsPtantiProtonTrueTransport", "DCAxy vs Pt (#bar{p}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/proton/dca/before/TOF/hDCAzVsPtProtonTrue", "DCAz vs Pt (p); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/proton/dca/before/TOF/hDCAzVsPtProtonTruePrim", "DCAz vs Pt (p); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/proton/dca/before/TOF/hDCAzVsPtProtonTrueSec", "DCAz vs Pt (p); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/proton/dca/before/TOF/hDCAzVsPtProtonTrueMaterial", "DCAz vs Pt (p); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/proton/dca/before/TOF/hDCAzVsPtProtonTrueTransport", "DCAz vs Pt (p); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/proton/dca/before/TOF/hDCAzVsPtantiProtonTrue", "DCAz vs Pt (#bar{p}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/proton/dca/before/TOF/hDCAzVsPtantiProtonTruePrim", "DCAz vs Pt (#bar{p}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/proton/dca/before/TOF/hDCAzVsPtantiProtonTrueSec", "DCAz vs Pt (#bar{p}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/proton/dca/before/TOF/hDCAzVsPtantiProtonTrueMaterial", "DCAz vs Pt (#bar{p}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/proton/dca/before/TOF/hDCAzVsPtantiProtonTrueTransport", "DCAz vs Pt (#bar{p}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); } } @@ -972,16 +983,14 @@ struct LFNucleiBATask { histos.add("tracks/deuteron/dca/before/hDCAxyVsPtDeuteronTrueMaterial", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/hNumMothers", "N mothers per particle; N mothers;counts", HistType::kTH1I, {{7, 1.0, 8.0}}); - histos.add("tracks/deuteron/dca/before/hMomTrueMaterial", "MC mothers;mother index;mother type; mother #it{p}_{T}", HistType::kTH3F, {{kMaxNumMom + 2, -0.5, static_cast(kMaxNumMom) + 1.5}, {kNumMotherList + 2, -1.5, static_cast(kNumMotherList) + 0.5}, {250, 0.0, 10.0}}); + histos.add("tracks/deuteron/dca/before/hMomTrueMaterial", "MC mothers;mother index;mother type; mother #it{p}_{T}", HistType::kTH3F, {{2, -2.0, 2.0}, {kNumMotherList + 2, -1.5, static_cast(kNumMotherList) + 0.5}, {150, 0.0, 15.0}}); std::shared_ptr hTempDe = histos.get(HIST("tracks/deuteron/dca/before/hMomTrueMaterial")); TH3* hPdgDe = hTempDe.get(); TAxis* axPdgDe = hPdgDe->GetXaxis(); - for (int i = 0; i <= kMaxNumMom; i++) { - axPdgDe->SetBinLabel(i + 1, Form("%d", i)); - } - axPdgDe->SetBinLabel(kMaxNumMom + 2, ">=5"); + axPdgDe->SetBinLabel(1, "antiparticles"); + axPdgDe->SetBinLabel(2, "particles"); TAxis* ayPdgDe = hPdgDe->GetYaxis(); ayPdgDe->SetBinLabel(1, "undef."); @@ -990,14 +999,11 @@ struct LFNucleiBATask { ayPdgDe->SetBinLabel(i + 3, kMotherNames[i]); } - histos.add("tracks/deuteron/dca/before/hDCAxyVsPtDeuteronTrueTransport", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/deuteron/dca/before/hDCAxyVsPtantiDeuteronTrue", "DCAxy vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/hDCAxyVsPtantiDeuteronTruePrim", "DCAxy vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/hDCAxyVsPtantiDeuteronTrueSec", "DCAxy vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/hDCAxyVsPtantiDeuteronTrueMaterial", "DCAxy vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/deuteron/dca/before/hDCAxyVsPtantiDeuteronTrueTransport", "DCAxy vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); // Fake & wrong histos if (outFlagOptions.makeFakeTracksPlots) { @@ -1005,14 +1011,12 @@ struct LFNucleiBATask { histos.add("tracks/deuteron/dca/before/fake/hDCAxyVsPtDeuteronTruePrim", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/fake/hDCAxyVsPtDeuteronTrueSec", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/deuteron/dca/before/fake/hDCAxyVsPtDeuteronTrueTransport", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/fake/hDCAxyVsPtDeuteronTrueMaterial", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/fake/hDCAxyVsPtantiDeuteronTrue", "DCAxy vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/fake/hDCAxyVsPtantiDeuteronTruePrim", "DCAxy vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/fake/hDCAxyVsPtantiDeuteronTrueSec", "DCAxy vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/deuteron/dca/before/fake/hDCAxyVsPtantiDeuteronTrueTransport", "DCAxy vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/fake/hDCAxyVsPtantiDeuteronTrueMaterial", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); } @@ -1022,42 +1026,36 @@ struct LFNucleiBATask { histos.add("tracks/deuteron/dca/before/TOF/hDCAxyVsPtDeuteronTruePrim", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/TOF/hDCAxyVsPtDeuteronTrueSec", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/TOF/hDCAxyVsPtDeuteronTrueMaterial", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/deuteron/dca/before/TOF/hDCAxyVsPtDeuteronTrueTransport", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/TOF/hDCAxyVsPtantiDeuteronTrue", "DCAxy vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/TOF/hDCAxyVsPtantiDeuteronTruePrim", "DCAxy vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/TOF/hDCAxyVsPtantiDeuteronTrueSec", "DCAxy vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/TOF/hDCAxyVsPtantiDeuteronTrueMaterial", "DCAxy vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/deuteron/dca/before/TOF/hDCAxyVsPtantiDeuteronTrueTransport", "DCAxy vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/TOF/hDCAzVsPtDeuteronTrue", "DCAz vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/deuteron/dca/before/TOF/hDCAzVsPtDeuteronTruePrim", "DCAz vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/deuteron/dca/before/TOF/hDCAzVsPtDeuteronTrueSec", "DCAz vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/deuteron/dca/before/TOF/hDCAzVsPtDeuteronTrueMaterial", "DCAz vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/deuteron/dca/before/TOF/hDCAzVsPtDeuteronTrueTransport", "DCAz vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/deuteron/dca/before/TOF/hDCAzVsPtantiDeuteronTrue", "DCAz vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/deuteron/dca/before/TOF/hDCAzVsPtantiDeuteronTruePrim", "DCAz vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/deuteron/dca/before/TOF/hDCAzVsPtantiDeuteronTrueSec", "DCAz vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/deuteron/dca/before/TOF/hDCAzVsPtantiDeuteronTrueMaterial", "DCAz vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/deuteron/dca/before/TOF/hDCAzVsPtantiDeuteronTrueTransport", "DCAz vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); if (outFlagOptions.makeFakeTracksPlots) { histos.add("tracks/deuteron/dca/before/fake/TOF/hDCAxyVsPtDeuteronTrue", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/fake/TOF/hDCAxyVsPtDeuteronTruePrim", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/fake/TOF/hDCAxyVsPtDeuteronTrueSec", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/deuteron/dca/before/fake/TOF/hDCAxyVsPtDeuteronTrueTransport", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/fake/TOF/hDCAxyVsPtDeuteronTrueMaterial", "DCAxy vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/fake/TOF/hDCAxyVsPtantiDeuteronTrue", "DCAxy vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/fake/TOF/hDCAxyVsPtantiDeuteronTruePrim", "DCAxy vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/fake/TOF/hDCAxyVsPtantiDeuteronTrueSec", "DCAxy vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/deuteron/dca/before/fake/TOF/hDCAxyVsPtantiDeuteronTrueTransport", "DCAxy vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/fake/TOF/hDCAxyVsPtantiDeuteronTrueMaterial", "DCAxy vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/deuteron/dca/before/fake/TOF/hDCAzVsPtDeuteronTrue", "DCAz vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); @@ -1098,14 +1096,12 @@ struct LFNucleiBATask { histos.add("tracks/triton/dca/before/hDCAxyVsPtTritonTruePrim", "DCAxy vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/triton/dca/before/hDCAxyVsPtTritonTrueSec", "DCAxy vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/triton/dca/before/hDCAxyVsPtTritonTrueMaterial", "DCAxy vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/triton/dca/before/hDCAxyVsPtTritonTrueTransport", "DCAxy vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/triton/dca/before/hDCAxyVsPtantiTritonTrue", "DCAxy vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/triton/dca/before/hDCAxyVsPtantiTritonTruePrim", "DCAxy vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/triton/dca/before/hDCAxyVsPtantiTritonTrueSec", "DCAxy vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/triton/dca/before/hDCAxyVsPtTritonTrueMaterial", "DCAxy vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/triton/dca/before/hDCAxyVsPtTritonTrueTransport", "DCAxy vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); + histos.add("tracks/triton/dca/before/hDCAxyVsPtantiTritonTrueMaterial", "DCAxy vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); if (outFlagOptions.doTOFplots) { histos.add("tracks/triton/dca/before/TOF/hDCAxyVsPtTritonTrue", "DCAxy vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); @@ -1113,28 +1109,27 @@ struct LFNucleiBATask { histos.add("tracks/triton/dca/before/TOF/hDCAxyVsPtTritonTruePrim", "DCAxy vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/triton/dca/before/TOF/hDCAxyVsPtTritonTrueSec", "DCAxy vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/triton/dca/before/TOF/hDCAxyVsPtTritonTrueMaterial", "DCAxy vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/triton/dca/before/TOF/hDCAxyVsPtTritonTrueTransport", "DCAxy vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/triton/dca/before/TOF/hDCAxyVsPtantiTritonTrue", "DCAxy vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/triton/dca/before/TOF/hDCAxyVsPtantiTritonTruePrim", "DCAxy vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/triton/dca/before/TOF/hDCAxyVsPtantiTritonTrueSec", "DCAxy vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/triton/dca/before/TOF/hDCAxyVsPtantiTritonTrueMaterial", "DCAxy vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/triton/dca/before/TOF/hDCAxyVsPtantiTritonTrueTransport", "DCAxy vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/triton/dca/before/TOF/hDCAzVsPtTritonTrue", "DCAz vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); + // Unused histograms + // histos.add("tracks/triton/dca/before/TOF/hDCAzVsPtTritonTrue", "DCAz vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/triton/dca/before/TOF/hDCAzVsPtTritonTruePrim", "DCAz vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/triton/dca/before/TOF/hDCAzVsPtTritonTrueSec", "DCAz vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/triton/dca/before/TOF/hDCAzVsPtTritonTrueMaterial", "DCAz vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/triton/dca/before/TOF/hDCAzVsPtTritonTrueTransport", "DCAz vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); + // histos.add("tracks/triton/dca/before/TOF/hDCAzVsPtTritonTruePrim", "DCAz vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); + // histos.add("tracks/triton/dca/before/TOF/hDCAzVsPtTritonTrueSec", "DCAz vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); + // histos.add("tracks/triton/dca/before/TOF/hDCAzVsPtTritonTrueMaterial", "DCAz vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); + // histos.add("tracks/triton/dca/before/TOF/hDCAzVsPtTritonTrueTransport", "DCAz vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/triton/dca/before/TOF/hDCAzVsPtantiTritonTrue", "DCAz vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); + // histos.add("tracks/triton/dca/before/TOF/hDCAzVsPtantiTritonTrue", "DCAz vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/triton/dca/before/TOF/hDCAzVsPtantiTritonTruePrim", "DCAz vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/triton/dca/before/TOF/hDCAzVsPtantiTritonTrueSec", "DCAz vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/triton/dca/before/TOF/hDCAzVsPtantiTritonTrueMaterial", "DCAz vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/triton/dca/before/TOF/hDCAzVsPtantiTritonTrueTransport", "DCAz vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); + // histos.add("tracks/triton/dca/before/TOF/hDCAzVsPtantiTritonTruePrim", "DCAz vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); + // histos.add("tracks/triton/dca/before/TOF/hDCAzVsPtantiTritonTrueSec", "DCAz vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); + // histos.add("tracks/triton/dca/before/TOF/hDCAzVsPtantiTritonTrueMaterial", "DCAz vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); + // histos.add("tracks/triton/dca/before/TOF/hDCAzVsPtantiTritonTrueTransport", "DCAz vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); } } @@ -1151,31 +1146,32 @@ struct LFNucleiBATask { histos.add("tracks/triton/dca/after/hDCAxyVsPtantiTritonTrueSec", "DCAxy vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/triton/dca/after/hDCAxyVsPtantiTritonTrueTransport", "DCAxy vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - if (outFlagOptions.doTOFplots) { - histos.add("tracks/triton/dca/after/TOF/hDCAxyVsPtTritonTrue", "DCAxy vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); + // Unused histograms + // if (outFlagOptions.doTOFplots) { + // histos.add("tracks/triton/dca/after/TOF/hDCAxyVsPtTritonTrue", "DCAxy vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/triton/dca/after/TOF/hDCAxyVsPtTritonTruePrim", "DCAxy vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/triton/dca/after/TOF/hDCAxyVsPtTritonTrueSec", "DCAxy vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/triton/dca/after/TOF/hDCAxyVsPtTritonTrueTransport", "DCAxy vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); + // histos.add("tracks/triton/dca/after/TOF/hDCAxyVsPtTritonTruePrim", "DCAxy vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); + // histos.add("tracks/triton/dca/after/TOF/hDCAxyVsPtTritonTrueSec", "DCAxy vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); + // histos.add("tracks/triton/dca/after/TOF/hDCAxyVsPtTritonTrueTransport", "DCAxy vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/triton/dca/after/TOF/hDCAxyVsPtantiTritonTrue", "DCAxy vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); + // histos.add("tracks/triton/dca/after/TOF/hDCAxyVsPtantiTritonTrue", "DCAxy vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/triton/dca/after/TOF/hDCAxyVsPtantiTritonTruePrim", "DCAxy vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/triton/dca/after/TOF/hDCAxyVsPtantiTritonTrueSec", "DCAxy vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/triton/dca/after/TOF/hDCAxyVsPtantiTritonTrueTransport", "DCAxy vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); + // histos.add("tracks/triton/dca/after/TOF/hDCAxyVsPtantiTritonTruePrim", "DCAxy vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); + // histos.add("tracks/triton/dca/after/TOF/hDCAxyVsPtantiTritonTrueSec", "DCAxy vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); + // histos.add("tracks/triton/dca/after/TOF/hDCAxyVsPtantiTritonTrueTransport", "DCAxy vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/triton/dca/after/TOF/hDCAzVsPtTritonTrue", "DCAz vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); + // histos.add("tracks/triton/dca/after/TOF/hDCAzVsPtTritonTrue", "DCAz vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/triton/dca/after/TOF/hDCAzVsPtTritonTruePrim", "DCAz vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/triton/dca/after/TOF/hDCAzVsPtTritonTrueSec", "DCAz vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/triton/dca/after/TOF/hDCAzVsPtTritonTrueTransport", "DCAz vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); + // histos.add("tracks/triton/dca/after/TOF/hDCAzVsPtTritonTruePrim", "DCAz vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); + // histos.add("tracks/triton/dca/after/TOF/hDCAzVsPtTritonTrueSec", "DCAz vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); + // histos.add("tracks/triton/dca/after/TOF/hDCAzVsPtTritonTrueTransport", "DCAz vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/triton/dca/after/TOF/hDCAzVsPtantiTritonTrue", "DCAz vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); + // histos.add("tracks/triton/dca/after/TOF/hDCAzVsPtantiTritonTrue", "DCAz vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/triton/dca/after/TOF/hDCAzVsPtantiTritonTruePrim", "DCAz vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/triton/dca/after/TOF/hDCAzVsPtantiTritonTrueSec", "DCAz vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/triton/dca/after/TOF/hDCAzVsPtantiTritonTrueTransport", "DCAz vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - } + // histos.add("tracks/triton/dca/after/TOF/hDCAzVsPtantiTritonTruePrim", "DCAz vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); + // histos.add("tracks/triton/dca/after/TOF/hDCAzVsPtantiTritonTrueSec", "DCAz vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); + // histos.add("tracks/triton/dca/after/TOF/hDCAzVsPtantiTritonTrueTransport", "DCAz vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); + // } } } if (enableHe) { @@ -1188,17 +1184,15 @@ struct LFNucleiBATask { histos.add("tracks/helium/dca/before/hDCAxyVsPtHeliumTrueMaterial", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/hNumMothers", "N mothers per particle; N mothers;counts", HistType::kTH1I, {{7, 1.0, 8.0}}); - histos.add("tracks/helium/dca/before/hMomTrueMaterial", "MC mothers;mother index;mother type; mother #it{p}_{T}", HistType::kTH3F, {{kMaxNumMom + 2, -0.5, static_cast(kMaxNumMom) + 1.5}, {kNumMotherList + 2, -1.5, static_cast(kNumMotherList) + 0.5}, {250, 0.0, 10.0}}); + histos.add("tracks/helium/dca/before/hMomTrueMaterial", "MC mothers;mother index;mother type; mother #it{p}_{T}", HistType::kTH3F, {{2, -2.0, 2.0}, {kNumMotherList + 2, -1.5, static_cast(kNumMotherList) + 0.5}, {150, 0.0, 15.0}}); // Fix for getting TH3 pointer std::shared_ptr hTempHe = histos.get(HIST("tracks/helium/dca/before/hMomTrueMaterial")); TH3* hPdgHe = hTempHe.get(); TAxis* axPdgHe = hPdgHe->GetXaxis(); - for (int i = 0; i <= kMaxNumMom; i++) { - axPdgHe->SetBinLabel(i + 1, Form("%d", i)); - } - axPdgHe->SetBinLabel(kMaxNumMom + 2, ">=5"); + axPdgHe->SetBinLabel(1, "antiparticles"); + axPdgHe->SetBinLabel(2, "particles"); TAxis* ayPdgHe = hPdgHe->GetYaxis(); ayPdgHe->SetBinLabel(1, "undef."); @@ -1207,28 +1201,23 @@ struct LFNucleiBATask { ayPdgHe->SetBinLabel(i + 3, kMotherNames[i]); } - histos.add("tracks/helium/dca/before/hDCAxyVsPtHeliumTrueTransport", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); - histos.add("tracks/helium/dca/before/hDCAxyVsPtantiHeliumTrue", "DCAxy vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/hDCAxyVsPtantiHeliumTruePrim", "DCAxy vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/hDCAxyVsPtantiHeliumTrueSec", "DCAxy vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/hDCAxyVsPtantiHeliumTrueMaterial", "DCAxy vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); - histos.add("tracks/helium/dca/before/hDCAxyVsPtantiHeliumTrueTransport", "DCAxy vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/hDCAzVsPtHeliumTrue", "DCAz vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcazAxis}}); histos.add("tracks/helium/dca/before/hDCAzVsPtHeliumTruePrim", "DCAz vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcazAxis}}); histos.add("tracks/helium/dca/before/hDCAzVsPtHeliumTrueSec", "DCAz vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcazAxis}}); histos.add("tracks/helium/dca/before/hDCAzVsPtHeliumTrueMaterial", "DCAz vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcazAxis}}); - histos.add("tracks/helium/dca/before/hDCAzVsPtHeliumTrueTransport", "DCAz vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcazAxis}}); histos.add("tracks/helium/dca/before/hDCAzVsPtantiHeliumTrue", "DCAz vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcazAxis}}); histos.add("tracks/helium/dca/before/hDCAzVsPtantiHeliumTruePrim", "DCAz vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcazAxis}}); histos.add("tracks/helium/dca/before/hDCAzVsPtantiHeliumTrueSec", "DCAz vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcazAxis}}); histos.add("tracks/helium/dca/before/hDCAzVsPtantiHeliumTrueMaterial", "DCAz vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcazAxis}}); - histos.add("tracks/helium/dca/before/hDCAzVsPtantiHeliumTrueTransport", "DCAz vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcazAxis}}); if (outFlagOptions.doTOFplots) { histos.add("tracks/helium/dca/before/TOF/hDCAxyVsPtHeliumTrue", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); @@ -1236,28 +1225,24 @@ struct LFNucleiBATask { histos.add("tracks/helium/dca/before/TOF/hDCAxyVsPtHeliumTruePrim", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/TOF/hDCAxyVsPtHeliumTrueSec", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/TOF/hDCAxyVsPtHeliumTrueMaterial", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); - histos.add("tracks/helium/dca/before/TOF/hDCAxyVsPtHeliumTrueTransport", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/TOF/hDCAxyVsPtantiHeliumTrue", "DCAxy vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/TOF/hDCAxyVsPtantiHeliumTruePrim", "DCAxy vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/TOF/hDCAxyVsPtantiHeliumTrueSec", "DCAxy vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/TOF/hDCAxyVsPtantiHeliumTrueMaterial", "DCAxy vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); - histos.add("tracks/helium/dca/before/TOF/hDCAxyVsPtantiHeliumTrueTransport", "DCAxy vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/TOF/hDCAzVsPtHeliumTrue", "DCAz vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcazAxis}}); histos.add("tracks/helium/dca/before/TOF/hDCAzVsPtHeliumTruePrim", "DCAz vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcazAxis}}); histos.add("tracks/helium/dca/before/TOF/hDCAzVsPtHeliumTrueSec", "DCAz vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcazAxis}}); histos.add("tracks/helium/dca/before/TOF/hDCAzVsPtHeliumTrueMaterial", "DCAz vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcazAxis}}); - histos.add("tracks/helium/dca/before/TOF/hDCAzVsPtHeliumTrueTransport", "DCAz vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcazAxis}}); histos.add("tracks/helium/dca/before/TOF/hDCAzVsPtantiHeliumTrue", "DCAz vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcazAxis}}); histos.add("tracks/helium/dca/before/TOF/hDCAzVsPtantiHeliumTruePrim", "DCAz vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcazAxis}}); histos.add("tracks/helium/dca/before/TOF/hDCAzVsPtantiHeliumTrueSec", "DCAz vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcazAxis}}); histos.add("tracks/helium/dca/before/TOF/hDCAzVsPtantiHeliumTrueMaterial", "DCAz vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcazAxis}}); - histos.add("tracks/helium/dca/before/TOF/hDCAzVsPtantiHeliumTrueTransport", "DCAz vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcazAxis}}); } // Fake & wrong histos @@ -1267,14 +1252,12 @@ struct LFNucleiBATask { histos.add("tracks/helium/dca/before/fake/hDCAxyVsPtHeliumTruePrim", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/fake/hDCAxyVsPtHeliumTrueSec", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/fake/hDCAxyVsPtHeliumTrueMaterial", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); - histos.add("tracks/helium/dca/before/fake/hDCAxyVsPtHeliumTrueTransport", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/fake/hDCAxyVsPtantiHeliumTrue", "DCAxy vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/fake/hDCAxyVsPtantiHeliumTruePrim", "DCAxy vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/fake/hDCAxyVsPtantiHeliumTrueSec", "DCAxy vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/fake/hDCAxyVsPtantiHeliumTrueMaterial", "DCAxy vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); - histos.add("tracks/helium/dca/before/fake/hDCAxyVsPtantiHeliumTrueTransport", "DCAxy vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/fake/hDCAzVsPtHeliumTrue", "DCAz vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcazAxis}}); @@ -1320,13 +1303,13 @@ struct LFNucleiBATask { histos.add("tracks/helium/dca/before/fake/TOF/hDCAxyVsPtHeliumTruePrim", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/fake/TOF/hDCAxyVsPtHeliumTrueSec", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); - histos.add("tracks/helium/dca/before/fake/TOF/hDCAxyVsPtHeliumTrueTransport", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); + histos.add("tracks/helium/dca/before/fake/TOF/hDCAxyVsPtHeliumTrueMaterial", "DCAxy vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/fake/TOF/hDCAxyVsPtantiHeliumTrue", "DCAxy vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/fake/TOF/hDCAxyVsPtantiHeliumTruePrim", "DCAxy vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/fake/TOF/hDCAxyVsPtantiHeliumTrueSec", "DCAxy vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); - histos.add("tracks/helium/dca/before/fake/TOF/hDCAxyVsPtantiHeliumTrueTransport", "DCAxy vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); + histos.add("tracks/helium/dca/before/fake/TOF/hDCAxyVsPtantiHeliumTrueMaterial", "DCAxy vs Pt (#bar{He}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcaxyAxis}}); histos.add("tracks/helium/dca/before/fake/TOF/hDCAzVsPtHeliumTrue", "DCAz vs Pt (He); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptZHeAxis}, {dcazAxis}}); @@ -1428,14 +1411,12 @@ struct LFNucleiBATask { histos.add("tracks/alpha/dca/before/hDCAxyVsPtAlphaTruePrim", "DCAxy vs Pt (#alpha); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/alpha/dca/before/hDCAxyVsPtAlphaTrueSec", "DCAxy vs Pt (#alpha); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/alpha/dca/before/hDCAxyVsPtAlphaTrueMaterial", "DCAxy vs Pt (#alpha); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/alpha/dca/before/hDCAxyVsPtAlphaTrueTransport", "DCAxy vs Pt (#alpha); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/alpha/dca/before/hDCAxyVsPtantiAlphaTrue", "DCAxy vs Pt (#bar{#alpha}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/alpha/dca/before/hDCAxyVsPtantiAlphaTruePrim", "DCAxy vs Pt (#bar{#alpha}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/alpha/dca/before/hDCAxyVsPtantiAlphaTrueSec", "DCAxy vs Pt (#bar{#alpha}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/alpha/dca/before/hDCAxyVsPtantiAlphaTrueMaterial", "DCAxy vs Pt (#bar{#alpha}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/alpha/dca/before/hDCAxyVsPtantiAlphaTrueTransport", "DCAxy vs Pt (#bar{#alpha}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); } if (outFlagOptions.makeDCAAfterCutPlots) { @@ -1443,14 +1424,14 @@ struct LFNucleiBATask { histos.add("tracks/alpha/dca/after/hDCAxyVsPtAlphaTruePrim", "DCAxy vs Pt (#alpha); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/alpha/dca/after/hDCAxyVsPtAlphaTrueSec", "DCAxy vs Pt (#alpha); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/alpha/dca/after/hDCAxyVsPtAlphaTrueMaterial", "DCAxy vs Pt (#alpha); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); + // histos.add("tracks/alpha/dca/after/hDCAxyVsPtAlphaTrueMaterial", "DCAxy vs Pt (#alpha); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/alpha/dca/after/hDCAxyVsPtAlphaTrueTransport", "DCAxy vs Pt (#alpha); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/alpha/dca/after/hDCAxyVsPtantiAlphaTrue", "DCAxy vs Pt (#bar{#alpha}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/alpha/dca/after/hDCAxyVsPtantiAlphaTruePrim", "DCAxy vs Pt (#bar{#alpha}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/alpha/dca/after/hDCAxyVsPtantiAlphaTrueSec", "DCAxy vs Pt (#bar{#alpha}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); - histos.add("tracks/alpha/dca/after/hDCAxyVsPtantiAlphaTrueMaterial", "DCAxy vs Pt (#bar{#alpha}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); + // histos.add("tracks/alpha/dca/after/hDCAxyVsPtantiAlphaTrueMaterial", "DCAxy vs Pt (#bar{#alpha}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/alpha/dca/after/hDCAxyVsPtantiAlphaTrueTransport", "DCAxy vs Pt (#bar{#alpha}); #it{p}_{T} (GeV/#it{c}); DCAxy (cm)", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); } } @@ -1462,14 +1443,12 @@ struct LFNucleiBATask { histos.add("tracks/proton/dca/before/hDCAzVsPtProtonTruePrim", "DCAz vs Pt (p); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/proton/dca/before/hDCAzVsPtProtonTrueSec", "DCAz vs Pt (p); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/proton/dca/before/hDCAzVsPtProtonTrueMaterial", "DCAz vs Pt (p); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/proton/dca/before/hDCAzVsPtProtonTrueTransport", "DCAz vs Pt (p); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/proton/dca/before/hDCAzVsPtantiProtonTrue", "DCAz vs Pt (#bar{p}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/proton/dca/before/hDCAzVsPtantiProtonTruePrim", "DCAz vs Pt (#bar{p}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/proton/dca/before/hDCAzVsPtantiProtonTrueSec", "DCAz vs Pt (#bar{p}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/proton/dca/before/hDCAzVsPtantiProtonTrueMaterial", "DCAz vs Pt (#bar{p}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/proton/dca/before/hDCAzVsPtantiProtonTrueTransport", "DCAz vs Pt (#bar{p}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); } if (outFlagOptions.makeDCAAfterCutPlots) { histos.add("tracks/proton/dca/after/hDCAzVsPtProtonTrue", "DCAz vs Pt (p); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); @@ -1492,14 +1471,12 @@ struct LFNucleiBATask { histos.add("tracks/deuteron/dca/before/hDCAzVsPtDeuteronTruePrim", "DCAz vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/deuteron/dca/before/hDCAzVsPtDeuteronTrueSec", "DCAz vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/deuteron/dca/before/hDCAzVsPtDeuteronTrueMaterial", "DCAz vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/deuteron/dca/before/hDCAzVsPtDeuteronTrueTransport", "DCAz vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/deuteron/dca/before/hDCAzVsPtantiDeuteronTrue", "DCAz vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/deuteron/dca/before/hDCAzVsPtantiDeuteronTruePrim", "DCAz vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/deuteron/dca/before/hDCAzVsPtantiDeuteronTrueSec", "DCAz vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/deuteron/dca/before/hDCAzVsPtantiDeuteronTrueMaterial", "DCAz vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/deuteron/dca/before/hDCAzVsPtantiDeuteronTrueTransport", "DCAz vs Pt (#bar{d}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); if (outFlagOptions.makeFakeTracksPlots) { histos.add("tracks/deuteron/dca/before/fake/hDCAzVsPtDeuteronTrue", "DCAz vs Pt (d); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); @@ -1539,14 +1516,12 @@ struct LFNucleiBATask { histos.add("tracks/triton/dca/before/hDCAzVsPtTritonTruePrim", "DCAz vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/triton/dca/before/hDCAzVsPtTritonTrueSec", "DCAz vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/triton/dca/before/hDCAzVsPtTritonTrueMaterial", "DCAz vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/triton/dca/before/hDCAzVsPtTritonTrueTransport", "DCAz vs Pt (t); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/triton/dca/before/hDCAzVsPtantiTritonTrue", "DCAz vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/triton/dca/before/hDCAzVsPtantiTritonTruePrim", "DCAz vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/triton/dca/before/hDCAzVsPtantiTritonTrueSec", "DCAz vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/triton/dca/before/hDCAzVsPtantiTritonTrueMaterial", "DCAz vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/triton/dca/before/hDCAzVsPtantiTritonTrueTransport", "DCAz vs Pt (#bar{t}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); } if (outFlagOptions.makeDCAAfterCutPlots) { @@ -1571,14 +1546,12 @@ struct LFNucleiBATask { histos.add("tracks/alpha/dca/before/hDCAzVsPtAlphaTruePrim", "DCAz vs Pt (#alpha); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/alpha/dca/before/hDCAzVsPtAlphaTrueSec", "DCAz vs Pt (#alpha); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/alpha/dca/before/hDCAzVsPtAlphaTrueMaterial", "DCAz vs Pt (#alpha); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/alpha/dca/before/hDCAzVsPtAlphaTrueTransport", "DCAz vs Pt (#alpha); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/alpha/dca/before/hDCAzVsPtantiAlphaTrue", "DCAz vs Pt (#bar{#alpha}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/alpha/dca/before/hDCAzVsPtantiAlphaTruePrim", "DCAz vs Pt (#bar{#alpha}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/alpha/dca/before/hDCAzVsPtantiAlphaTrueSec", "DCAz vs Pt (#bar{#alpha}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); histos.add("tracks/alpha/dca/before/hDCAzVsPtantiAlphaTrueMaterial", "DCAz vs Pt (#bar{#alpha}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); - histos.add("tracks/alpha/dca/before/hDCAzVsPtantiAlphaTrueTransport", "DCAz vs Pt (#bar{#alpha}); #it{p}_{T} (GeV/#it{c}); DCAz (cm)", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); } if (outFlagOptions.makeDCAAfterCutPlots) { @@ -2302,11 +2275,9 @@ struct LFNucleiBATask { if ((track.itsChi2NCl() < itsChi2NclRange[0]) || (track.itsChi2NCl() > itsChi2NclRange[1])) continue; - // p cut - if (std::abs(track.tpcInnerParam()) < kinemOptions.cfgMomentumCut) - continue; - // eta cut - if (std::abs(track.eta()) > kinemOptions.cfgEtaCut) + // p & eta cut + if (std::abs(track.tpcInnerParam()) < kinemOptions.cfgMomentumCut || + std::abs(track.eta()) > kinemOptions.cfgEtaCut) continue; if (outFlagOptions.enablePIDplot) { @@ -2386,11 +2357,9 @@ struct LFNucleiBATask { break; } - // float nITSDe_Table = 99.f; float nITSDe = 99.f; float nITSTr = 99.f; float nITSHe = 99.f; - // o2::aod::ITSResponse itsResponse; if (!IsFilteredData) { nITSDe = track.itsNSigmaDe(); @@ -2559,6 +2528,14 @@ struct LFNucleiBATask { isDe = isDeuteron && track.sign() > 0; isAntiDe = isDeuteron && track.sign() < 0; + if constexpr (IsMC && !IsFilteredData) { + int pdgCheck = track.mcParticle().pdgCode(); + if (std::abs(pdgCheck) == PDGDeuteron) + histos.fill(HIST("hItsDeHeChecker"), 0); + if (std::abs(pdgCheck) == PDGHelium) + histos.fill(HIST("hItsDeHeChecker"), 1); + } + // nSigmaITSHe cut if (nsigmaITSvar.useITSDeCut && (nITSDe <= nsigmaITSvar.nsigmaITSDe)) { continue; @@ -2568,6 +2545,14 @@ struct LFNucleiBATask { continue; } + if constexpr (IsMC && !IsFilteredData) { + int pdgCheck = track.mcParticle().pdgCode(); + if (std::abs(pdgCheck) == PDGDeuteron) + histos.fill(HIST("hItsDeHeChecker"), 2); + if (std::abs(pdgCheck) == PDGHelium) + histos.fill(HIST("hItsDeHeChecker"), 3); + } + isHe = isHelium && track.sign() > 0; isAntiHe = isHelium && track.sign() < 0; @@ -2688,7 +2673,6 @@ struct LFNucleiBATask { } if constexpr (IsMC) { - // auto const& mcParticles = particles; bool isPhysPrim = false; bool isProdByGen = false; bool isWeakDecay = false; @@ -2725,17 +2709,17 @@ struct LFNucleiBATask { } } if (!isPhysPrim && !isProdByGen) { - histos.fill(HIST("tracks/proton/dca/before/hDCAzVsPtProtonTrueTransport"), track.pt(), track.dcaZ()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/proton/dca/before/hDCAzVsPtProtonTrueSec"), track.pt(), track.dcaZ()); - else + } else { histos.fill(HIST("tracks/proton/dca/before/hDCAzVsPtProtonTrueMaterial"), track.pt(), track.dcaZ()); + } if (track.hasTOF() && outFlagOptions.doTOFplots) { - histos.fill(HIST("tracks/proton/dca/before/TOF/hDCAzVsPtProtonTrueTransport"), track.pt(), track.dcaZ()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/proton/dca/before/TOF/hDCAzVsPtProtonTrueSec"), track.pt(), track.dcaZ()); - else + } else { histos.fill(HIST("tracks/proton/dca/before/TOF/hDCAzVsPtProtonTrueMaterial"), track.pt(), track.dcaZ()); + } } } } @@ -2753,17 +2737,17 @@ struct LFNucleiBATask { } } if (!isPhysPrim && !isProdByGen) { - histos.fill(HIST("tracks/proton/dca/before/hDCAzVsPtantiProtonTrueTransport"), track.pt(), track.dcaZ()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/proton/dca/before/hDCAzVsPtantiProtonTrueSec"), track.pt(), track.dcaZ()); - else + } else { histos.fill(HIST("tracks/proton/dca/before/hDCAzVsPtantiProtonTrueMaterial"), track.pt(), track.dcaZ()); + } if (track.hasTOF() && outFlagOptions.doTOFplots) { - histos.fill(HIST("tracks/proton/dca/before/TOF/hDCAzVsPtantiProtonTrueTransport"), hePt, track.dcaZ()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/proton/dca/before/TOF/hDCAzVsPtantiProtonTrueSec"), hePt, track.dcaZ()); - else + } else { histos.fill(HIST("tracks/proton/dca/before/TOF/hDCAzVsPtantiProtonTrueMaterial"), hePt, track.dcaZ()); + } } } } @@ -2781,17 +2765,17 @@ struct LFNucleiBATask { } } if (!isPhysPrim && !isProdByGen) { - histos.fill(HIST("tracks/deuteron/dca/before/hDCAzVsPtDeuteronTrueTransport"), DPt, track.dcaZ()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/deuteron/dca/before/hDCAzVsPtDeuteronTrueSec"), DPt, track.dcaZ()); - else + } else { histos.fill(HIST("tracks/deuteron/dca/before/hDCAzVsPtDeuteronTrueMaterial"), DPt, track.dcaZ()); + } if (track.hasTOF() && outFlagOptions.doTOFplots) { - histos.fill(HIST("tracks/deuteron/dca/before/TOF/hDCAzVsPtDeuteronTrueTransport"), DPt, track.dcaZ()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/deuteron/dca/before/TOF/hDCAzVsPtDeuteronTrueSec"), DPt, track.dcaZ()); - else + } else { histos.fill(HIST("tracks/deuteron/dca/before/TOF/hDCAzVsPtDeuteronTrueMaterial"), DPt, track.dcaZ()); + } } } } @@ -2809,17 +2793,17 @@ struct LFNucleiBATask { } } if (!isPhysPrim && !isProdByGen) { - histos.fill(HIST("tracks/deuteron/dca/before/hDCAzVsPtantiDeuteronTrueTransport"), antiDPt, track.dcaZ()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/deuteron/dca/before/hDCAzVsPtantiDeuteronTrueSec"), antiDPt, track.dcaZ()); - else + } else { histos.fill(HIST("tracks/deuteron/dca/before/hDCAzVsPtantiDeuteronTrueMaterial"), antiDPt, track.dcaZ()); + } if (track.hasTOF() && outFlagOptions.doTOFplots) { - histos.fill(HIST("tracks/deuteron/dca/before/TOF/hDCAzVsPtantiDeuteronTrueTransport"), antiDPt, track.dcaZ()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/deuteron/dca/before/TOF/hDCAzVsPtantiDeuteronTrueSec"), antiDPt, track.dcaZ()); - else + } else { histos.fill(HIST("tracks/deuteron/dca/before/TOF/hDCAzVsPtantiDeuteronTrueMaterial"), antiDPt, track.dcaZ()); + } } } } @@ -2831,11 +2815,11 @@ struct LFNucleiBATask { histos.fill(HIST("tracks/triton/dca/before/hDCAzVsPtTritonTruePrim"), track.pt(), track.dcaZ()); } if (!isPhysPrim && !isProdByGen) { - histos.fill(HIST("tracks/triton/dca/before/hDCAzVsPtTritonTrueTransport"), track.pt(), track.dcaZ()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/triton/dca/before/hDCAzVsPtTritonTrueSec"), track.pt(), track.dcaZ()); - else + } else { histos.fill(HIST("tracks/triton/dca/before/hDCAzVsPtTritonTrueMaterial"), track.pt(), track.dcaZ()); + } } } break; @@ -2846,11 +2830,11 @@ struct LFNucleiBATask { histos.fill(HIST("tracks/triton/dca/before/hDCAzVsPtantiTritonTruePrim"), track.pt(), track.dcaZ()); } if (!isPhysPrim && !isProdByGen) { - histos.fill(HIST("tracks/triton/dca/before/hDCAzVsPtantiTritonTrueTransport"), track.pt(), track.dcaZ()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/triton/dca/before/hDCAzVsPtantiTritonTrueSec"), track.pt(), track.dcaZ()); - else + } else { histos.fill(HIST("tracks/triton/dca/before/hDCAzVsPtantiTritonTrueMaterial"), track.pt(), track.dcaZ()); + } } } break; @@ -2867,17 +2851,17 @@ struct LFNucleiBATask { } } if (!isPhysPrim && !isProdByGen) { - histos.fill(HIST("tracks/helium/dca/before/hDCAzVsPtHeliumTrueTransport"), hePt, track.dcaZ()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/helium/dca/before/hDCAzVsPtHeliumTrueSec"), hePt, track.dcaZ()); - else + } else { histos.fill(HIST("tracks/helium/dca/before/hDCAzVsPtHeliumTrueMaterial"), hePt, track.dcaZ()); + } if (track.hasTOF() && outFlagOptions.doTOFplots) { - histos.fill(HIST("tracks/helium/dca/before/TOF/hDCAzVsPtHeliumTrueTransport"), hePt, track.dcaZ()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/helium/dca/before/TOF/hDCAzVsPtHeliumTrueSec"), hePt, track.dcaZ()); - else + } else { histos.fill(HIST("tracks/helium/dca/before/TOF/hDCAzVsPtHeliumTrueMaterial"), hePt, track.dcaZ()); + } } } } @@ -2923,17 +2907,17 @@ struct LFNucleiBATask { } } if (!isPhysPrim && !isProdByGen) { - histos.fill(HIST("tracks/helium/dca/before/hDCAzVsPtantiHeliumTrueTransport"), antihePt, track.dcaZ()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/helium/dca/before/hDCAzVsPtantiHeliumTrueSec"), antihePt, track.dcaZ()); - else + } else { histos.fill(HIST("tracks/helium/dca/before/hDCAzVsPtantiHeliumTrueMaterial"), antihePt, track.dcaZ()); + } if (track.hasTOF() && outFlagOptions.doTOFplots) { - histos.fill(HIST("tracks/helium/dca/before/TOF/hDCAzVsPtantiHeliumTrueTransport"), antihePt, track.dcaZ()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/helium/dca/before/TOF/hDCAzVsPtantiHeliumTrueSec"), antihePt, track.dcaZ()); - else + } else { histos.fill(HIST("tracks/helium/dca/before/TOF/hDCAzVsPtantiHeliumTrueMaterial"), antihePt, track.dcaZ()); + } } } } @@ -2974,11 +2958,11 @@ struct LFNucleiBATask { histos.fill(HIST("tracks/alpha/dca/before/hDCAzVsPtAlphaTruePrim"), track.pt(), track.dcaZ()); } if (!isPhysPrim && !isProdByGen) { - histos.fill(HIST("tracks/alpha/dca/before/hDCAzVsPtAlphaTrueTransport"), track.pt(), track.dcaZ()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/alpha/dca/before/hDCAzVsPtAlphaTrueSec"), track.pt(), track.dcaZ()); - else + } else { histos.fill(HIST("tracks/alpha/dca/before/hDCAzVsPtAlphaTrueMaterial"), track.pt(), track.dcaZ()); + } } } break; @@ -2989,11 +2973,11 @@ struct LFNucleiBATask { histos.fill(HIST("tracks/alpha/dca/before/hDCAzVsPtantiAlphaTruePrim"), track.pt(), track.dcaZ()); } if (!isPhysPrim && !isProdByGen) { - histos.fill(HIST("tracks/alpha/dca/before/hDCAzVsPtantiAlphaTrueTransport"), track.pt(), track.dcaZ()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/alpha/dca/before/hDCAzVsPtantiAlphaTrueSec"), track.pt(), track.dcaZ()); - else + } else { histos.fill(HIST("tracks/alpha/dca/before/hDCAzVsPtantiAlphaTrueMaterial"), track.pt(), track.dcaZ()); + } } } break; @@ -3281,17 +3265,38 @@ struct LFNucleiBATask { } } if (!isPhysPrim && !isProdByGen) { - histos.fill(HIST("tracks/proton/dca/before/hDCAxyVsPtProtonTrueTransport"), track.pt(), track.dcaXY()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/proton/dca/before/hDCAxyVsPtProtonTrueSec"), track.pt(), track.dcaXY()); - else + } else { histos.fill(HIST("tracks/proton/dca/before/hDCAxyVsPtProtonTrueMaterial"), track.pt(), track.dcaXY()); + if constexpr (!IsFilteredData) { + histos.fill(HIST("tracks/proton/dca/before/hNumMothers"), nSaved); + if (nSaved > 0) { + for (int iMom = 0; iMom < nSaved; iMom++) { + int pdgMom = pdgMomList[iMom]; + float pdgSign = (pdgMom > 0) ? 1.0 : -1.0; + float ptMom = ptMomList[iMom]; + int motherSpeciesBin = -1; + if (pdgMom != -1) { + motherSpeciesBin = 0; + for (int j = 0; j < kNumMotherList; j++) { + if (std::abs(kPdgMotherList[j]) == std::abs(pdgMom)) { + motherSpeciesBin = j + 1; + break; + } + } + } + histos.fill(HIST("tracks/proton/dca/before/hMomTrueMaterial"), pdgSign, motherSpeciesBin, ptMom); + } + } + } + } if (track.hasTOF() && outFlagOptions.doTOFplots) { - histos.fill(HIST("tracks/proton/dca/before/TOF/hDCAxyVsPtProtonTrueTransport"), track.pt(), track.dcaXY()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/proton/dca/before/TOF/hDCAxyVsPtProtonTrueSec"), track.pt(), track.dcaXY()); - else + } else { histos.fill(HIST("tracks/proton/dca/before/TOF/hDCAxyVsPtProtonTrueMaterial"), track.pt(), track.dcaXY()); + } } } } @@ -3309,17 +3314,17 @@ struct LFNucleiBATask { } } if (!isPhysPrim && !isProdByGen) { - histos.fill(HIST("tracks/proton/dca/before/hDCAxyVsPtantiProtonTrueTransport"), track.pt(), track.dcaXY()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/proton/dca/before/hDCAxyVsPtantiProtonTrueSec"), track.pt(), track.dcaXY()); - else + } else { histos.fill(HIST("tracks/proton/dca/before/hDCAxyVsPtantiProtonTrueMaterial"), track.pt(), track.dcaXY()); + } if (track.hasTOF() && outFlagOptions.doTOFplots) { - histos.fill(HIST("tracks/proton/dca/before/TOF/hDCAxyVsPtantiProtonTrueTransport"), track.pt(), track.dcaXY()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/proton/dca/before/TOF/hDCAxyVsPtantiProtonTrueSec"), track.pt(), track.dcaXY()); - else + } else { histos.fill(HIST("tracks/proton/dca/before/TOF/hDCAxyVsPtantiProtonTrueMaterial"), track.pt(), track.dcaXY()); + } } } } @@ -3357,7 +3362,6 @@ struct LFNucleiBATask { } if (!isPhysPrim && !isProdByGen) { if (outFlagOptions.makeDCABeforeCutPlots) { - histos.fill(HIST("tracks/deuteron/dca/before/hDCAxyVsPtDeuteronTrueTransport"), DPt, track.dcaXY()); if (isWeakDecay) { histos.fill(HIST("tracks/deuteron/dca/before/hDCAxyVsPtDeuteronTrueSec"), DPt, track.dcaXY()); } else { @@ -3366,30 +3370,30 @@ struct LFNucleiBATask { histos.fill(HIST("tracks/deuteron/dca/before/hNumMothers"), nSaved); if (nSaved > 0) { for (int iMom = 0; iMom < nSaved; iMom++) { - int motherIndexBin = (iMom <= kMaxNumMom) ? iMom : (kMaxNumMom + 1); int pdgMom = pdgMomList[iMom]; + float pdgSign = (pdgMom > 0) ? 1.0 : -1.0; float ptMom = ptMomList[iMom]; int motherSpeciesBin = -1; if (pdgMom != -1) { motherSpeciesBin = 0; for (int j = 0; j < kNumMotherList; j++) { - if (kPdgMotherList[j] == pdgMom) { + if (std::abs(kPdgMotherList[j]) == std::abs(pdgMom)) { motherSpeciesBin = j + 1; break; } } } - histos.fill(HIST("tracks/deuteron/dca/before/hMomTrueMaterial"), motherIndexBin, motherSpeciesBin, ptMom); + histos.fill(HIST("tracks/deuteron/dca/before/hMomTrueMaterial"), pdgSign, motherSpeciesBin, ptMom); } } } } if (track.hasTOF() && outFlagOptions.doTOFplots) { - histos.fill(HIST("tracks/deuteron/dca/before/TOF/hDCAxyVsPtDeuteronTrueTransport"), DPt, track.dcaXY()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/deuteron/dca/before/TOF/hDCAxyVsPtDeuteronTrueSec"), DPt, track.dcaXY()); - else + } else { histos.fill(HIST("tracks/deuteron/dca/before/TOF/hDCAxyVsPtDeuteronTrueMaterial"), DPt, track.dcaXY()); + } } } } @@ -3428,17 +3432,17 @@ struct LFNucleiBATask { } if (!isPhysPrim && !isProdByGen) { if (outFlagOptions.makeDCABeforeCutPlots) { - histos.fill(HIST("tracks/deuteron/dca/before/hDCAxyVsPtantiDeuteronTrueTransport"), antiDPt, track.dcaXY()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/deuteron/dca/before/hDCAxyVsPtantiDeuteronTrueSec"), antiDPt, track.dcaXY()); - else + } else { histos.fill(HIST("tracks/deuteron/dca/before/hDCAxyVsPtantiDeuteronTrueMaterial"), antiDPt, track.dcaXY()); + } if (track.hasTOF() && outFlagOptions.doTOFplots) { - histos.fill(HIST("tracks/deuteron/dca/before/TOF/hDCAxyVsPtantiDeuteronTrueTransport"), antiDPt, track.dcaXY()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/deuteron/dca/before/TOF/hDCAxyVsPtantiDeuteronTrueSec"), antiDPt, track.dcaXY()); - else + } else { histos.fill(HIST("tracks/deuteron/dca/before/TOF/hDCAxyVsPtantiDeuteronTrueMaterial"), antiDPt, track.dcaXY()); + } } } } @@ -3457,10 +3461,6 @@ struct LFNucleiBATask { } } if (!isPhysPrim && !isProdByGen) { - histos.fill(HIST("tracks/triton/dca/before/hDCAxyVsPtTritonTrueTransport"), track.pt(), track.dcaXY()); - if (track.hasTOF() && outFlagOptions.doTOFplots) { - histos.fill(HIST("tracks/triton/dca/before/TOF/hDCAxyVsPtTritonTrueTransport"), track.pt(), track.dcaXY()); - } if (isWeakDecay) { histos.fill(HIST("tracks/triton/dca/before/hDCAxyVsPtTritonTrueSec"), track.pt(), track.dcaXY()); if (track.hasTOF() && outFlagOptions.doTOFplots) { @@ -3492,10 +3492,6 @@ struct LFNucleiBATask { // } if (!isPhysPrim && !isProdByGen) { - histos.fill(HIST("tracks/triton/dca/before/hDCAxyVsPtantiTritonTrueTransport"), track.pt(), track.dcaXY()); - if (track.hasTOF() && outFlagOptions.doTOFplots) { - histos.fill(HIST("tracks/triton/dca/before/TOF/hDCAxyVsPtantiTritonTrueTransport"), track.pt(), track.dcaXY()); - } if (isWeakDecay) { histos.fill(HIST("tracks/triton/dca/before/hDCAxyVsPtantiTritonTrueSec"), track.pt(), track.dcaXY()); if (track.hasTOF() && outFlagOptions.doTOFplots) { @@ -3538,7 +3534,6 @@ struct LFNucleiBATask { } } if (!isPhysPrim && !isProdByGen && outFlagOptions.makeDCABeforeCutPlots) { - histos.fill(HIST("tracks/helium/dca/before/hDCAxyVsPtHeliumTrueTransport"), hePt, track.dcaXY()); if (isWeakDecay) { histos.fill(HIST("tracks/helium/dca/before/hDCAxyVsPtHeliumTrueSec"), hePt, track.dcaXY()); } else { @@ -3547,30 +3542,30 @@ struct LFNucleiBATask { histos.fill(HIST("tracks/helium/dca/before/hNumMothers"), nSaved); if (nSaved > 0) { for (int iMom = 0; iMom < nSaved; iMom++) { - int motherIndexBin = (iMom <= kMaxNumMom) ? iMom : (kMaxNumMom + 1); int pdgMom = pdgMomList[iMom]; + float pdgSign = (pdgMom > 0) ? 1.0 : -1.0; float ptMom = ptMomList[iMom]; int motherSpeciesBin = -1; if (pdgMom != -1) { motherSpeciesBin = 0; for (int j = 0; j < kNumMotherList; j++) { - if (kPdgMotherList[j] == pdgMom) { + if (std::abs(kPdgMotherList[j]) == std::abs(pdgMom)) { motherSpeciesBin = j + 1; break; } } } - histos.fill(HIST("tracks/helium/dca/before/hMomTrueMaterial"), motherIndexBin, motherSpeciesBin, ptMom); + histos.fill(HIST("tracks/helium/dca/before/hMomTrueMaterial"), pdgSign, motherSpeciesBin, ptMom); } } } } if (track.hasTOF() && outFlagOptions.doTOFplots) { - histos.fill(HIST("tracks/helium/dca/before/TOF/hDCAxyVsPtHeliumTrueTransport"), hePt, track.dcaXY()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/helium/dca/before/TOF/hDCAxyVsPtHeliumTrueSec"), hePt, track.dcaXY()); - else + } else { histos.fill(HIST("tracks/helium/dca/before/TOF/hDCAxyVsPtHeliumTrueMaterial"), hePt, track.dcaXY()); + } } } } @@ -3631,18 +3626,17 @@ struct LFNucleiBATask { } } if (!isPhysPrim && !isProdByGen && outFlagOptions.makeDCABeforeCutPlots) { - histos.fill(HIST("tracks/helium/dca/before/hDCAxyVsPtantiHeliumTrueTransport"), antihePt, track.dcaXY()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/helium/dca/before/hDCAxyVsPtantiHeliumTrueSec"), antihePt, track.dcaXY()); - else + } else { histos.fill(HIST("tracks/helium/dca/before/hDCAxyVsPtantiHeliumTrueMaterial"), antihePt, track.dcaXY()); - + } if (track.hasTOF() && outFlagOptions.doTOFplots) { - histos.fill(HIST("tracks/helium/dca/before/TOF/hDCAxyVsPtantiHeliumTrueTransport"), antihePt, track.dcaXY()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/helium/dca/before/TOF/hDCAxyVsPtantiHeliumTrueSec"), antihePt, track.dcaXY()); - else + } else { histos.fill(HIST("tracks/helium/dca/before/TOF/hDCAxyVsPtantiHeliumTrueMaterial"), antihePt, track.dcaXY()); + } } } } @@ -3682,11 +3676,11 @@ struct LFNucleiBATask { histos.fill(HIST("tracks/alpha/dca/before/hDCAxyVsPtAlphaTruePrim"), track.pt(), track.dcaXY()); } if (!isPhysPrim && !isProdByGen) { - histos.fill(HIST("tracks/alpha/dca/before/hDCAxyVsPtAlphaTrueTransport"), track.pt(), track.dcaXY()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/alpha/dca/before/hDCAxyVsPtAlphaTrueSec"), track.pt(), track.dcaXY()); - else + } else { histos.fill(HIST("tracks/alpha/dca/before/hDCAxyVsPtAlphaTrueMaterial"), track.pt(), track.dcaXY()); + } } } break; @@ -3697,11 +3691,11 @@ struct LFNucleiBATask { histos.fill(HIST("tracks/alpha/dca/before/hDCAxyVsPtantiAlphaTruePrim"), track.pt(), track.dcaXY()); } if (!isPhysPrim && !isProdByGen) { - histos.fill(HIST("tracks/alpha/dca/before/hDCAxyVsPtantiAlphaTrueTransport"), track.pt(), track.dcaXY()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/alpha/dca/before/hDCAxyVsPtantiAlphaTrueSec"), track.pt(), track.dcaXY()); - else + } else { histos.fill(HIST("tracks/alpha/dca/before/hDCAxyVsPtantiAlphaTrueMaterial"), track.pt(), track.dcaXY()); + } } } break; @@ -3730,17 +3724,17 @@ struct LFNucleiBATask { } if (!isPhysPrim && !isProdByGen) { if (outFlagOptions.makeDCABeforeCutPlots) { - histos.fill(HIST("tracks/deuteron/dca/before/fake/hDCAxyVsPtDeuteronTrueTransport"), DPt, track.dcaXY()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/deuteron/dca/before/fake/hDCAxyVsPtDeuteronTrueSec"), DPt, track.dcaXY()); - else + } else { histos.fill(HIST("tracks/deuteron/dca/before/fake/hDCAxyVsPtDeuteronTrueMaterial"), DPt, track.dcaXY()); + } if (track.hasTOF() && outFlagOptions.doTOFplots) { - histos.fill(HIST("tracks/deuteron/dca/before/fake/TOF/hDCAxyVsPtDeuteronTrueTransport"), DPt, track.dcaXY()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/deuteron/dca/before/fake/TOF/hDCAxyVsPtDeuteronTrueSec"), DPt, track.dcaXY()); - else + } else { histos.fill(HIST("tracks/deuteron/dca/before/fake/TOF/hDCAxyVsPtDeuteronTrueMaterial"), DPt, track.dcaXY()); + } } } } @@ -3762,17 +3756,17 @@ struct LFNucleiBATask { } if (!isPhysPrim && !isProdByGen) { if (outFlagOptions.makeDCABeforeCutPlots) { - histos.fill(HIST("tracks/deuteron/dca/before/fake/hDCAxyVsPtantiDeuteronTrueTransport"), antiDPt, track.dcaXY()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/deuteron/dca/before/fake/hDCAxyVsPtantiDeuteronTrueSec"), antiDPt, track.dcaXY()); - else + } else { histos.fill(HIST("tracks/deuteron/dca/before/fake/hDCAxyVsPtantiDeuteronTrueMaterial"), antiDPt, track.dcaXY()); + } if (track.hasTOF() && outFlagOptions.doTOFplots) { - histos.fill(HIST("tracks/deuteron/dca/before/fake/TOF/hDCAxyVsPtantiDeuteronTrueTransport"), antiDPt, track.dcaXY()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/deuteron/dca/before/fake/TOF/hDCAxyVsPtantiDeuteronTrueSec"), antiDPt, track.dcaXY()); - else + } else { histos.fill(HIST("tracks/deuteron/dca/before/fake/TOF/hDCAxyVsPtantiDeuteronTrueMaterial"), antiDPt, track.dcaXY()); + } } } } @@ -3798,17 +3792,17 @@ struct LFNucleiBATask { } } if (!isPhysPrim && !isProdByGen) { - histos.fill(HIST("tracks/helium/dca/before/fake/hDCAxyVsPtHeliumTrueTransport"), hePt, track.dcaXY()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/helium/dca/before/fake/hDCAxyVsPtHeliumTrueSec"), hePt, track.dcaXY()); - else + } else { histos.fill(HIST("tracks/helium/dca/before/fake/hDCAxyVsPtHeliumTrueMaterial"), hePt, track.dcaXY()); + } if (track.hasTOF() && outFlagOptions.doTOFplots) { - histos.fill(HIST("tracks/helium/dca/before/fake/TOF/hDCAxyVsPtHeliumTrueTransport"), hePt, track.dcaXY()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/helium/dca/before/fake/TOF/hDCAxyVsPtHeliumTrueSec"), hePt, track.dcaXY()); - else + } else { histos.fill(HIST("tracks/helium/dca/before/fake/TOF/hDCAxyVsPtHeliumTrueMaterial"), hePt, track.dcaXY()); + } } } } @@ -3826,17 +3820,17 @@ struct LFNucleiBATask { } } if (!isPhysPrim && !isProdByGen) { - histos.fill(HIST("tracks/helium/dca/before/fake/hDCAxyVsPtantiHeliumTrueTransport"), antihePt, track.dcaXY()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/helium/dca/before/fake/hDCAxyVsPtantiHeliumTrueSec"), antihePt, track.dcaXY()); - else + } else { histos.fill(HIST("tracks/helium/dca/before/fake/hDCAxyVsPtantiHeliumTrueMaterial"), antihePt, track.dcaXY()); + } if (track.hasTOF() && outFlagOptions.doTOFplots) { - histos.fill(HIST("tracks/helium/dca/before/fake/TOF/hDCAxyVsPtantiHeliumTrueTransport"), antihePt, track.dcaXY()); - if (isWeakDecay) + if (isWeakDecay) { histos.fill(HIST("tracks/helium/dca/before/fake/TOF/hDCAxyVsPtantiHeliumTrueSec"), antihePt, track.dcaXY()); - else + } else { histos.fill(HIST("tracks/helium/dca/before/fake/TOF/hDCAxyVsPtantiHeliumTrueMaterial"), antihePt, track.dcaXY()); + } } } } @@ -5729,9 +5723,7 @@ struct LFNucleiBATask { } if (!isPhysPrim && !isProdByGen) { - // histos.fill(HIST("tracks/helium/h1HeliumSpectraTrueTransport"), hePt); histos.fill(HIST("tracks/helium/h1HeliumSpectraTrueTransport_Z2"), 2 * hePt); - if (outFlagOptions.makeDCAAfterCutPlots) { histos.fill(HIST("tracks/helium/dca/after/hDCAxyVsPtHeliumTrueTransport"), hePt, track.dcaXY()); histos.fill(HIST("tracks/helium/dca/after/hDCAzVsPtHeliumTrueTransport"), hePt, track.dcaZ()); @@ -5741,9 +5733,7 @@ struct LFNucleiBATask { } } if (isWeakDecay) { - // histos.fill(HIST("tracks/helium/h1HeliumSpectraTrueSec"), hePt); histos.fill(HIST("tracks/helium/h1HeliumSpectraTrueSec_Z2"), 2 * hePt); - if (outFlagOptions.makeDCAAfterCutPlots) { histos.fill(HIST("tracks/helium/dca/after/hDCAxyVsPtHeliumTrueSec"), hePt, track.dcaXY()); histos.fill(HIST("tracks/helium/dca/after/hDCAzVsPtHeliumTrueSec"), hePt, track.dcaZ()); @@ -5758,9 +5748,7 @@ struct LFNucleiBATask { break; case -PDGHelium: if (isHelium && passDCAzCutAntiHe && passDCAxyCutAntiHe) { - // histos.fill(HIST("tracks/helium/h1antiHeliumSpectraTrue"), antihePt); histos.fill(HIST("tracks/helium/h1antiHeliumSpectraTrue_Z2"), 2 * antihePt); - if (outFlagOptions.makeDCAAfterCutPlots) { histos.fill(HIST("tracks/helium/dca/after/hDCAxyVsPtantiHeliumTrue"), antihePt, track.dcaXY()); histos.fill(HIST("tracks/helium/dca/after/hDCAzVsPtantiHeliumTrue"), antihePt, track.dcaZ()); @@ -5770,7 +5758,6 @@ struct LFNucleiBATask { } } if (std::abs(track.tpcNSigmaHe()) < nsigmaTPCvar.nsigmaTPCHe) { - // histos.fill(HIST("tracks/helium/h1antiHeliumSpectraTrueWPID"), antihePt); histos.fill(HIST("tracks/helium/h1antiHeliumSpectraTrueWPID_Z2"), 2 * antihePt); if (outFlagOptions.enableEffPlots) { histos.fill(HIST("tracks/eff/helium/hPtantiHeTrue_Z2"), 2 * antihePt); @@ -5799,9 +5786,7 @@ struct LFNucleiBATask { } } if (!isPhysPrim && !isProdByGen) { - // histos.fill(HIST("tracks/helium/h1antiHeliumSpectraTrueTransport"), antihePt); histos.fill(HIST("tracks/helium/h1antiHeliumSpectraTrueTransport_Z2"), 2 * antihePt); - if (outFlagOptions.makeDCAAfterCutPlots) { histos.fill(HIST("tracks/helium/dca/after/hDCAxyVsPtantiHeliumTrueTransport"), antihePt, track.dcaXY()); histos.fill(HIST("tracks/helium/dca/after/hDCAzVsPtantiHeliumTrueTransport"), antihePt, track.dcaZ()); @@ -5812,9 +5797,7 @@ struct LFNucleiBATask { } if (isWeakDecay) { - // histos.fill(HIST("tracks/helium/h1antiHeliumSpectraTrueSec"), antihePt); histos.fill(HIST("tracks/helium/h1antiHeliumSpectraTrueSec_Z2"), 2 * antihePt); - if (outFlagOptions.makeDCAAfterCutPlots) { histos.fill(HIST("tracks/helium/dca/after/hDCAxyVsPtantiHeliumTrueSec"), antihePt, track.dcaXY()); histos.fill(HIST("tracks/helium/dca/after/hDCAzVsPtantiHeliumTrueSec"), antihePt, track.dcaZ()); From dfc407d52a88064ff3798fd6526f0d46b60a67d5 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Wed, 17 Sep 2025 19:33:12 +0200 Subject: [PATCH 426/986] [PWGEM/Dilepton] update mlpid (#13013) --- PWGEM/Dilepton/Core/Dilepton.h | 2 +- PWGEM/Dilepton/Core/SingleTrackQC.h | 14 ++++---------- .../TableProducer/treeCreatorElectronMLDDA.cxx | 6 ++++-- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 9477a2aee56..61ef5dab390 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -428,7 +428,7 @@ struct Dilepton { fRegistry.addClone("Event/before/hCollisionCounter", "Event/norm/hCollisionCounter"); } if (doprocessTriggerAnalysis) { - LOGF(info, "Trigger analysis is enabled. Desired trigger name = %s", cfg_swt_name.value); + LOGF(info, "Trigger analysis is enabled. Desired trigger name = %s", cfg_swt_name.value.data()); fRegistry.add("NormTrigger/hInspectedTVX", "inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true); fRegistry.add("NormTrigger/hScalers", "trigger counter before DS;run number;counter", kTProfile, {{80000, 520000.5, 600000.5}}, true); fRegistry.add("NormTrigger/hSelections", "trigger counter after DS;run number;counter", kTProfile, {{80000, 520000.5, 600000.5}}, true); diff --git a/PWGEM/Dilepton/Core/SingleTrackQC.h b/PWGEM/Dilepton/Core/SingleTrackQC.h index 1af8b9f48fa..06f3514948d 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQC.h @@ -327,7 +327,7 @@ struct SingleTrackQC { fRegistry.addClone("Event/before/hCollisionCounter", "Event/norm/hCollisionCounter"); } if (doprocessQC_TriggeredData) { - LOGF(info, "Trigger analysis is enabled. Desired trigger name = %s", cfg_swt_name.value); + LOGF(info, "Trigger analysis is enabled. Desired trigger name = %s", cfg_swt_name.value.data()); fRegistry.add("NormTrigger/hInspectedTVX", "inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true); fRegistry.add("NormTrigger/hScalers", "trigger counter before DS;run number;counter", kTProfile, {{80000, 520000.5, 600000.5}}, true); fRegistry.add("NormTrigger/hSelections", "trigger counter after DS;run number;counter", kTProfile, {{80000, 520000.5, 600000.5}}, true); @@ -346,7 +346,7 @@ struct SingleTrackQC { } } - template + template void initCCDB(TCollision const& collision) { if (mRunNumber == collision.runNumber()) { @@ -354,12 +354,6 @@ struct SingleTrackQC { } mRunNumber = collision.runNumber(); - - if constexpr (isTriggerAnalysis) { - LOGF(info, "Trigger analysis is enabled. Desired trigger name = %s", cfg_swt_name.value); - // LOGF(info, "total inspected TVX events = %d in run number %d", collision.nInspectedTVX(), collision.runNumber()); - // fRegistry.fill(HIST("Event/hNInspectedTVX"), collision.runNumber(), collision.nInspectedTVX()); - } } void DefineEMEventCut() @@ -641,7 +635,7 @@ struct SingleTrackQC { void runQC(TCollisions const& collisions, TTracks const& tracks, TPreslice const& perCollision, TCut const& cut) { for (const auto& collision : collisions) { - initCCDB(collision); + initCCDB(collision); float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; @@ -700,7 +694,7 @@ struct SingleTrackQC { std::vector passed_trackIds; passed_trackIds.reserve(tracks.size()); for (const auto& collision : collisions) { - initCCDB(collision); + initCCDB(collision); float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx index eb0d33e4208..5e34bcdf1ba 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx @@ -195,6 +195,7 @@ struct TreeCreatorElectronMLDDA { Configurable cfg_min_ncluster_itsib{"cfg_min_ncluster_itsib", 0, "min ncluster itsib"}; Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 5.0, "max chi2/NclsTPC"}; Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; + Configurable cfg_min_chi2its{"cfg_min_chi2its", 0.0, "min chi2/NclsITS"}; // remove ITS afterburner Configurable cfg_min_dcaxy_v0leg{"cfg_min_dcaxy_v0leg", 0.1, "min dca XY to PV for v0 legs in cm"}; Configurable cfg_includeITSsa{"cfg_includeITSsa", false, "Flag to include ITSsa tracks"}; Configurable cfg_max_pt_itssa{"cfg_max_pt_itssa", 0.15, "mix pt for ITSsa track"}; @@ -229,6 +230,7 @@ struct TreeCreatorElectronMLDDA { Configurable cfg_min_ncluster_itsib{"cfg_min_ncluster_itsib", 0, "min ncluster itsib"}; Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; Configurable cfg_max_chi2its{"cfg_max_chi2its", 5.0, "max chi2/NclsITS"}; + Configurable cfg_min_chi2its{"cfg_min_chi2its", 0.0, "min chi2/NclsITS"}; // remove ITS afterburner Configurable cfg_max_chi2tof{"cfg_max_chi2tof", 1e+10, "max chi2 TOF"}; // distance in cm Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2, "min n sigma e in TPC for pc->ee"}; @@ -399,7 +401,7 @@ struct TreeCreatorElectronMLDDA { if (track.itsNClsInnerBarrel() < v0cuts.cfg_min_ncluster_itsib) { return false; } - if (track.itsChi2NCl() > v0cuts.cfg_max_chi2its) { + if (track.itsChi2NCl() < v0cuts.cfg_min_chi2its || v0cuts.cfg_max_chi2its < track.itsChi2NCl()) { return false; } @@ -465,7 +467,7 @@ struct TreeCreatorElectronMLDDA { if (track.itsNClsInnerBarrel() < tightv0cuts.cfg_min_ncluster_itsib) { return false; } - if (tightv0cuts.cfg_max_chi2its < track.itsChi2NCl()) { + if (track.itsChi2NCl() < tightv0cuts.cfg_min_chi2its || tightv0cuts.cfg_max_chi2its < track.itsChi2NCl()) { return false; } From 57b4bffa38cc2cbcd91da7ac9234661010a0d604 Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Wed, 17 Sep 2025 23:25:10 +0530 Subject: [PATCH 427/986] [PWGLF] Added Collins Soper frame and renamed some configurables (#13005) Co-authored-by: Sawan Sawan --- .../Tasks/Resonances/higherMassResonances.cxx | 93 ++++++++++++++----- 1 file changed, 68 insertions(+), 25 deletions(-) diff --git a/PWGLF/Tasks/Resonances/higherMassResonances.cxx b/PWGLF/Tasks/Resonances/higherMassResonances.cxx index 535c3007195..9d8e43ff1e3 100644 --- a/PWGLF/Tasks/Resonances/higherMassResonances.cxx +++ b/PWGLF/Tasks/Resonances/higherMassResonances.cxx @@ -154,10 +154,11 @@ struct HigherMassResonances { std::vector pdgCodes = {10331, 335, 115, 10221, 9030221}; // output THnSparses - Configurable activateTHnSparseCosThStarHelicity{"activateTHnSparseCosThStarHelicity", false, "Activate the THnSparse with cosThStar w.r.t. helicity axis"}; - Configurable activateTHnSparseCosThStarProduction{"activateTHnSparseCosThStarProduction", false, "Activate the THnSparse with cosThStar w.r.t. production axis"}; - Configurable activateTHnSparseCosThStarBeam{"activateTHnSparseCosThStarBeam", true, "Activate the THnSparse with cosThStar w.r.t. beam axis (Gottified jackson frame)"}; - Configurable activateTHnSparseCosThStarRandom{"activateTHnSparseCosThStarRandom", false, "Activate the THnSparse with cosThStar w.r.t. random axis"}; + Configurable activateHelicityFrame{"activateHelicityFrame", false, "Activate the THnSparse with cosThStar w.r.t. helicity axis"}; + Configurable activateCollinsSoperFrame{"activateCollinsSoperFrame", false, "Activate the THnSparse with cosThStar w.r.t. Collins soper axis"}; + Configurable activateProductionFrame{"activateProductionFrame", false, "Activate the THnSparse with cosThStar w.r.t. production axis"}; + Configurable activateBeamAxisFrame{"activateBeamAxisFrame", true, "Activate the THnSparse with cosThStar w.r.t. beam axis (Gottified jackson frame)"}; + Configurable activateRandomFrame{"activateRandomFrame", false, "Activate the THnSparse with cosThStar w.r.t. random axis"}; Configurable cRotations{"cRotations", 3, "Number of random rotations in the rotational background"}; // Other cuts on Ks and glueball @@ -195,7 +196,7 @@ struct HigherMassResonances { ROOT::Math::XYZVector zBeam; // ẑ: beam direction in lab frame ROOT::Math::PxPyPzEVector beam1{0., 0., -config.beamMomentum, 13600. / 2.}; ROOT::Math::PxPyPzEVector beam2{0., 0., config.beamMomentum, 13600. / 2.}; - ROOT::Math::XYZVectorF beam1CM, beam2CM; + ROOT::Math::XYZVectorF beam1CM, beam2CM, zAxisCS, yAxisCS, xAxisCS; // const double massK0s = o2::constants::physics::MassK0Short; bool isMix = false; @@ -214,21 +215,24 @@ struct HigherMassResonances { AxisSpec thnAxisPhi = {config.configThnAxisPhi, "Configurabel phi axis"}; // 0 to 2pi // THnSparses - std::array sparses = {config.activateTHnSparseCosThStarHelicity, config.activateTHnSparseCosThStarProduction, config.activateTHnSparseCosThStarBeam, config.activateTHnSparseCosThStarRandom}; + std::array sparses = {config.activateHelicityFrame, config.activateCollinsSoperFrame, config.activateProductionFrame, config.activateBeamAxisFrame, config.activateRandomFrame}; if (std::accumulate(sparses.begin(), sparses.end(), 0) == 0) { LOGP(fatal, "No output THnSparses enabled"); } else { - if (config.activateTHnSparseCosThStarHelicity) { + if (config.activateHelicityFrame) { LOGP(info, "THnSparse with cosThStar w.r.t. helicity axis active."); } - if (config.activateTHnSparseCosThStarProduction) { + if (config.activateCollinsSoperFrame) { + LOGP(info, "THnSparse with cosThStar w.r.t. Collins Soper axis active."); + } + if (config.activateProductionFrame) { LOGP(info, "THnSparse with cosThStar w.r.t. production axis active."); } - if (config.activateTHnSparseCosThStarBeam) { + if (config.activateBeamAxisFrame) { LOGP(info, "THnSparse with cosThStar w.r.t. beam axis active. (Gottified jackson frame)"); } - if (config.activateTHnSparseCosThStarRandom) { + if (config.activateRandomFrame) { LOGP(info, "THnSparse with cosThStar w.r.t. random axis active."); } } @@ -679,6 +683,7 @@ struct HigherMassResonances { beam1CM = ROOT::Math::XYZVectorF((boost(beam1).Vect()).Unit()); beam2CM = ROOT::Math::XYZVectorF((boost(beam2).Vect()).Unit()); + //========================Helicity and Production frame calculation========================== // define y = zBeam x z: Normal to the production plane // ẑ: mother direction in lab, boosted into mother's rest frame @@ -696,12 +701,13 @@ struct HigherMassResonances { // // Calculate φ in [-π, π] // auto anglePhi = std::atan2(p_proj_y, p_proj_x); // φ in radians + //============================================================================================= v1CM = ROOT::Math::XYZVectorF(boost(daughter1).Vect()).Unit(); // ROOT::Math::XYZVectorF v2_CM{(boost(daughter1).Vect()).Unit()}; // using positive sign convention for the first track // ROOT::Math::XYZVectorF v_CM = (t1.sign() > 0 ? v1CM : v2_CM); // here selected decay daughter momentum is intested. here you can choose one decay daughter no need to check both case as it is neutral particle for our case - // Helicity frame + // Helicity Frame zaxisHE = ROOT::Math::XYZVectorF(mother.Vect()).Unit(); yaxisHE = ROOT::Math::XYZVectorF(beam1CM.Cross(beam2CM)).Unit(); xaxisHE = ROOT::Math::XYZVectorF(yaxisHE.Cross(zaxisHE)).Unit(); @@ -714,8 +720,16 @@ struct HigherMassResonances { // anglePhi += o2::constants::math::TwoPI; // ensure phi is in [0, 2pi] // } + // CS Frame + zAxisCS = ROOT::Math::XYZVectorF((beam1CM.Unit() - beam2CM.Unit())).Unit(); + yAxisCS = ROOT::Math::XYZVectorF(beam1CM.Cross(beam2CM)).Unit(); + xAxisCS = ROOT::Math::XYZVectorF(yAxisCS.Cross(zAxisCS)).Unit(); + double cosThetaStarCS = zAxisCS.Dot(v1CM); + auto phiCS = std::atan2(yAxisCS.Dot(v1CM), xAxisCS.Dot(v1CM)); + phiCS = RecoDecay::constrainAngle(phiCS, 0.0); + // if (std::abs(mother.Rapidity()) < config.rapidityMotherData) { - if (config.activateTHnSparseCosThStarHelicity) { + if (config.activateHelicityFrame) { // helicityVec = mother.Vect(); // 3 vector of mother in COM frame // auto cosThetaStarHelicity = helicityVec.Dot(threeVecDauCM) / (std::sqrt(threeVecDauCM.Mag2()) * std::sqrt(helicityVec.Mag2())); auto cosThetaStarHelicity = mother.Vect().Dot(fourVecDauCM.Vect()) / (std::sqrt(fourVecDauCM.Vect().Mag2()) * std::sqrt(mother.Vect().Mag2())); @@ -735,34 +749,64 @@ struct HigherMassResonances { daughterRotCM = boost2(daughterRot); auto cosThetaStarHelicityRot = motherRot.Vect().Dot(daughterRotCM.Vect()) / (std::sqrt(daughterRotCM.Vect().Mag2()) * std::sqrt(motherRot.Vect().Mag2())); + auto phiHelicityRot = std::atan2(yaxisHE.Dot(daughterRotCM.Vect().Unit()), xaxisHE.Dot(daughterRotCM.Vect().Unit())); + phiHelicityRot = RecoDecay::constrainAngle(phiHelicityRot, 0.0); if (motherRot.Rapidity() < config.rapidityMotherData) - hglue.fill(HIST("h3glueInvMassRot"), multiplicity, motherRot.Pt(), motherRot.M(), cosThetaStarHelicityRot, anglePhi); + hglue.fill(HIST("h3glueInvMassRot"), multiplicity, motherRot.Pt(), motherRot.M(), cosThetaStarHelicityRot, phiHelicityRot); } } else { if (std::abs(mother.Rapidity()) < config.rapidityMotherData) { hglue.fill(HIST("h3glueInvMassME"), multiplicity, mother.Pt(), mother.M(), cosThetaStarHelicity, anglePhi); } } - } else if (config.activateTHnSparseCosThStarProduction) { + } else if (config.activateCollinsSoperFrame) { + if (!isMix) { + if (std::abs(mother.Rapidity()) < config.rapidityMotherData) { + hglue.fill(HIST("h3glueInvMassDS"), multiplicity, mother.Pt(), mother.M(), cosThetaStarCS, phiCS); + } + + for (int i = 0; i < config.cRotations; i++) { + theta2 = rn->Uniform(o2::constants::math::PI - o2::constants::math::PI / config.rotationalCut, o2::constants::math::PI + o2::constants::math::PI / config.rotationalCut); + + daughterRot = ROOT::Math::PxPyPzMVector(daughter1.Px() * std::cos(theta2) - daughter1.Py() * std::sin(theta2), daughter1.Px() * std::sin(theta2) + daughter1.Py() * std::cos(theta2), daughter1.Pz(), daughter1.M()); + + motherRot = daughterRot + daughter2; + + ROOT::Math::Boost boost2{motherRot.BoostToCM()}; + daughterRotCM = boost2(daughterRot); + + auto cosThetaStarCSrot = zAxisCS.Dot(daughterRotCM.Vect()) / std::sqrt(daughterRotCM.Vect().Mag2()); + auto phiCSrot = std::atan2(yAxisCS.Dot(daughterRotCM.Vect().Unit()), xAxisCS.Dot(daughterRotCM.Vect().Unit())); + phiCSrot = RecoDecay::constrainAngle(phiCSrot, 0.0); + + if (motherRot.Rapidity() < config.rapidityMotherData) + hglue.fill(HIST("h3glueInvMassRot"), multiplicity, motherRot.Pt(), motherRot.M(), cosThetaStarCSrot, phiCSrot); + } + } else { + if (std::abs(mother.Rapidity()) < config.rapidityMotherData) { + hglue.fill(HIST("h3glueInvMassME"), multiplicity, mother.Pt(), mother.M(), cosThetaStarCS, phiCS); + } + } + } else if (config.activateProductionFrame) { normalVec = ROOT::Math::XYZVector(mother.Py(), -mother.Px(), 0.f); - auto cosThetaStarProduction = normalVec.Dot(fourVecDauCM.Vect()) / (std::sqrt(fourVecDauCM.Vect().Mag2()) * std::sqrt(normalVec.Mag2())); + auto cosThetaProduction = normalVec.Dot(fourVecDauCM.Vect()) / (std::sqrt(fourVecDauCM.Vect().Mag2()) * std::sqrt(normalVec.Mag2())); if (!isMix) { if (std::abs(mother.Rapidity()) < config.rapidityMotherData) { - hglue.fill(HIST("h3glueInvMassDS"), multiplicity, mother.Pt(), mother.M(), cosThetaStarProduction, anglePhi); + hglue.fill(HIST("h3glueInvMassDS"), multiplicity, mother.Pt(), mother.M(), cosThetaProduction, anglePhi); } for (int i = 0; i < config.cRotations; i++) { theta2 = rn->Uniform(o2::constants::math::PI - o2::constants::math::PI / config.rotationalCut, o2::constants::math::PI + o2::constants::math::PI / config.rotationalCut); motherRot = ROOT::Math::PxPyPzMVector(mother.Px() * std::cos(theta2) - mother.Py() * std::sin(theta2), mother.Px() * std::sin(theta2) + mother.Py() * std::cos(theta2), mother.Pz(), mother.M()); if (std::abs(motherRot.Rapidity()) < config.rapidityMotherData) { - hglue.fill(HIST("h3glueInvMassRot"), multiplicity, motherRot.Pt(), motherRot.M(), cosThetaStarProduction, anglePhi); + hglue.fill(HIST("h3glueInvMassRot"), multiplicity, motherRot.Pt(), motherRot.M(), cosThetaProduction, anglePhi); } } } else { if (std::abs(mother.Rapidity()) < config.rapidityMotherData) { - hglue.fill(HIST("h3glueInvMassME"), multiplicity, mother.Pt(), mother.M(), cosThetaStarProduction, anglePhi); + hglue.fill(HIST("h3glueInvMassME"), multiplicity, mother.Pt(), mother.M(), cosThetaProduction, anglePhi); } } - } else if (config.activateTHnSparseCosThStarBeam) { + } else if (config.activateBeamAxisFrame) { beamVec = ROOT::Math::XYZVector(0.f, 0.f, 1.f); auto cosThetaStarBeam = beamVec.Dot(fourVecDauCM.Vect()) / std::sqrt(fourVecDauCM.Vect().Mag2()); if (!isMix) { @@ -781,7 +825,7 @@ struct HigherMassResonances { hglue.fill(HIST("h3glueInvMassME"), multiplicity, mother.Pt(), mother.M(), cosThetaStarBeam, anglePhi); } } - } else if (config.activateTHnSparseCosThStarRandom) { + } else if (config.activateRandomFrame) { auto phiRandom = gRandom->Uniform(0.f, constants::math::TwoPI); auto thetaRandom = gRandom->Uniform(0.f, constants::math::PI); @@ -789,18 +833,18 @@ struct HigherMassResonances { auto cosThetaStarRandom = randomVec.Dot(fourVecDauCM.Vect()) / std::sqrt(fourVecDauCM.Vect().Mag2()); if (!isMix) { if (std::abs(mother.Rapidity()) < config.rapidityMotherData) { - hglue.fill(HIST("h3glueInvMassDS"), multiplicity, mother.Pt(), mother.M(), cosThetaStarRandom, anglePhi); + hglue.fill(HIST("h3glueInvMassDS"), multiplicity, mother.Pt(), mother.M(), cosThetaStarRandom, phiRandom); } for (int i = 0; i < config.cRotations; i++) { theta2 = rn->Uniform(o2::constants::math::PI - o2::constants::math::PI / config.rotationalCut, o2::constants::math::PI + o2::constants::math::PI / config.rotationalCut); motherRot = ROOT::Math::PxPyPzMVector(mother.Px() * std::cos(theta2) - mother.Py() * std::sin(theta2), mother.Px() * std::sin(theta2) + mother.Py() * std::cos(theta2), mother.Pz(), mother.M()); if (std::abs(motherRot.Rapidity()) < config.rapidityMotherData) { - hglue.fill(HIST("h3glueInvMassRot"), multiplicity, motherRot.Pt(), motherRot.M(), cosThetaStarRandom, anglePhi); + hglue.fill(HIST("h3glueInvMassRot"), multiplicity, motherRot.Pt(), motherRot.M(), cosThetaStarRandom, phiRandom); } } } else { if (std::abs(mother.Rapidity()) < config.rapidityMotherData) { - hglue.fill(HIST("h3glueInvMassME"), multiplicity, mother.Pt(), mother.M(), cosThetaStarRandom, anglePhi); + hglue.fill(HIST("h3glueInvMassME"), multiplicity, mother.Pt(), mother.M(), cosThetaStarRandom, phiRandom); } } } @@ -1444,6 +1488,5 @@ struct HigherMassResonances { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{ - adaptAnalysisTask(cfgc)}; + return WorkflowSpec{adaptAnalysisTask(cfgc)}; } From f887e36f0cc39d5d579b8e554740b85a63363bb9 Mon Sep 17 00:00:00 2001 From: Joachim Carlo Kristian Bjerg Hansen <50103987+joachimckh@users.noreply.github.com> Date: Wed, 17 Sep 2025 21:45:03 +0200 Subject: [PATCH 428/986] [PWGCF] Add gain eq to FIT for the long range correlations (#13009) --- .../Tasks/longRangeDihadronCor.cxx | 45 ++++++++++++++++++- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx b/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx index ae3a3056bad..c8524d0507f 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx @@ -11,7 +11,7 @@ /// \file longRangeDihadronCor.cxx /// \brief long range di-hadron correlation for O-O, Pb-Pb collisions -/// \author Zhiyong Lu (zhiyong.lu@cern.ch) +/// \author Zhiyong Lu (zhiyong.lu@cern.ch), Joachim Hansen (joachim.hansen@cern.ch) /// \since Sep/10/2025 #include "PWGCF/Core/CorrelationContainer.h" @@ -150,15 +150,21 @@ struct LongRangeDihadronCor { ConfigurableAxis axisAmplitudeFt0a{"axisAmplitudeFt0a", {5000, 0, 1000}, "FT0A amplitude"}; ConfigurableAxis axisChannelFt0aAxis{"axisChannelFt0aAxis", {96, 0.0, 96.0}, "FT0A channel"}; + Configurable cfgGainEqPath{"cfgGainEqPath", "Analysis/EventPlane/GainEq", "CCDB path for gain equalization constants"}; + Configurable cfgCorrLevel{"cfgCorrLevel", 1, "calibration step: 0 = no corr, 1 = gain corr"}; + ConfigurableAxis cfgaxisFITamp{"cfgaxisFITamp", {1000, 0, 5000}, ""}; + AxisSpec axisFit{cfgaxisFITamp, "fit amplitude"}; + AxisSpec axisChID = {220, 0, 220}; // make the filters and cuts. Filter collisionFilter = (nabs(aod::collision::posZ) < cfgCutVtxZ); - Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls) && (nabs(aod::track::dcaZ) < cfgCutDCAz); + Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == static_cast(true))) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls) && (nabs(aod::track::dcaZ) < cfgCutDCAz); using FilteredCollisions = soa::Filtered>; using FilteredTracks = soa::Filtered>; // FT0 geometry o2::ft0::Geometry ft0Det; std::vector* offsetFT0; + std::vector cstFT0RelGain{}; // Corrections TH3D* mEfficiency = nullptr; @@ -272,6 +278,8 @@ struct LongRangeDihadronCor { registry.add("Trig_hist", "", {HistType::kTHnSparseF, {{axisSample, axisVertex, axisPtTrigger}}}); registry.add("Assoc_amp_same", "", {HistType::kTH2D, {axisChannelFt0aAxis, axisAmplitudeFt0a}}); registry.add("Assoc_amp_mixed", "", {HistType::kTH2D, {axisChannelFt0aAxis, axisAmplitudeFt0a}}); + registry.add("FT0Amp", "", {HistType::kTH2F, {axisChID, axisFit}}); + registry.add("FT0AmpCorr", "", {HistType::kTH2F, {axisChID, axisFit}}); } registry.add("eventcount", "bin", {HistType::kTH1F, {{4, 0, 4, "bin"}}}); // histogram to see how many events are in the same and mixed event @@ -354,6 +362,32 @@ struct LongRangeDihadronCor { } } + void loadGain(aod::BCsWithTimestamps::iterator const& bc) + { + cstFT0RelGain.clear(); + cstFT0RelGain = {}; + std::string fullPath; + + auto timestamp = bc.timestamp(); + constexpr int ChannelsFT0 = 208; + if (cfgCorrLevel == 0) { + for (auto i{0u}; i < ChannelsFT0; i++) { + cstFT0RelGain.push_back(1.); + } + } else { + fullPath = cfgGainEqPath; + fullPath += "/FT0"; + const auto objft0Gain = ccdb->getForTimeStamp>(fullPath, timestamp); + if (!objft0Gain) { + for (auto i{0u}; i < ChannelsFT0; i++) { + cstFT0RelGain.push_back(1.); + } + } else { + cstFT0RelGain = *(objft0Gain); + } + } + } + void loadCorrection(uint64_t timestamp) { if (correctionsLoaded) { @@ -434,15 +468,21 @@ struct LongRangeDihadronCor { void getChannel(TFT0s const& ft0, std::size_t const& iCh, int& id, float& ampl) { int switchCor = cfgSwitchCor; + int rID{0}; if (switchCor == kFT0C) { id = ft0.channelC()[iCh]; + rID = id + 96; ampl = ft0.amplitudeC()[iCh]; } else if (switchCor == kFT0A) { id = ft0.channelA()[iCh]; + rID = id; ampl = ft0.amplitudeA()[iCh]; } else { LOGF(fatal, "Cor Index %d out of range", switchCor); } + registry.fill(HIST("FT0Amp"), rID, ampl); + ampl = ampl / cstFT0RelGain[iCh]; + registry.fill(HIST("FT0AmpCorr"), rID, ampl); } template @@ -613,6 +653,7 @@ struct LongRangeDihadronCor { if (!collision.has_foundFT0()) return; loadAlignParam(bc.timestamp()); + loadGain(bc); loadCorrection(bc.timestamp()); if (!cfgCentTableUnavailable) { getCentralityWeight(weightCent, cent); From 79cee8ed6fee7a90da2e54d383236fbdb62e2335 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Wed, 17 Sep 2025 22:09:15 +0200 Subject: [PATCH 429/986] [PWGLF] extra QA plots for TOF PID (#13008) Co-authored-by: ALICE Builder --- .../Strangeness/strangenesstofpid.cxx | 237 +++++++++++++++++- PWGLF/Utils/strangenessBuilderModule.h | 6 + 2 files changed, 231 insertions(+), 12 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx index 12234489158..09a468e3880 100644 --- a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx @@ -100,6 +100,12 @@ struct strangenesstofpid { Configurable calculateV0s{"calculateV0s", -1, "calculate V0-related TOF PID (0: no, 1: yes, -1: auto)"}; Configurable calculateCascades{"calculateCascades", -1, "calculate cascade-related TOF PID (0: no, 1: yes, -1: auto)"}; + // auxiliary / debug tables as desired + Configurable calculateV0TOFPIDs{"calculateV0TOFPIDs", -1, "calculate V0TOFPIDs table (0: no, 1: yes, -1: auto)"}; + Configurable calculateV0TOFBetas{"calculateV0TOFBetas", -1, "calculate V0TOFBetas table (0: no, 1: yes, -1: auto)"}; + Configurable calculateV0TOFDebugs{"calculateV0TOFDebugs", -1, "calculate V0TOFDebugs table (0: no, 1: yes, -1: auto)"}; + Configurable calculateCascTOFPIDs{"calculateCascTOFPIDs", -1, "calculate CascTOFPIDs table (0: no, 1: yes, -1: auto)"}; + // Operation and minimisation criteria struct : ConfigurableGroup { Configurable d_bz_input{"d_bz", -999, "bz field, -999 is automatic"}; @@ -149,6 +155,7 @@ struct strangenesstofpid { ConfigurableAxis axisPosition{"axisPosition", {400, -400.f, +400.f}, "position (cm)"}; ConfigurableAxis axisEta{"axisEta", {20, -1.0f, +1.0f}, "#eta"}; ConfigurableAxis axisDeltaTime{"axisDeltaTime", {2000, -1000.0f, +1000.0f}, "delta-time (ps)"}; + ConfigurableAxis axisDeltaTimeVsPrimaryCalculation{"axisDeltaTimeVsPrimaryCalculation", {500, -500.0f, +500.0f}, "delta-time (ps)"}; ConfigurableAxis axisTime{"axisTime", {400, 10000.0f, +50000.0f}, "T (ps)"}; ConfigurableAxis axisNSigma{"axisNSigma", {200, -10.0f, +10.0f}, "N(#sigma)"}; ConfigurableAxis axisRatioMethods{"axisRatioMethods", {400, 0.9f, 1.9f}, "T_{method 1}/T_{method 0}"}; @@ -335,6 +342,34 @@ struct strangenesstofpid { LOGF(info, "Strangeness TOF PID: Cascade calculations enabled automatically"); } } + if (calculateV0TOFPIDs.value < 0) { + // check if TOF information is required, enable if so + calculateV0TOFPIDs.value = isTableRequiredInWorkflow(initContext, "V0TOFPIDs"); + if (calculateV0TOFPIDs.value > 0) { + LOGF(info, "Strangeness TOF PID: V0TOFPIDs calculations enabled automatically"); + } + } + if (calculateV0TOFBetas.value < 0) { + // check if TOF information is required, enable if so + calculateV0TOFBetas.value = isTableRequiredInWorkflow(initContext, "V0TOFBetas"); + if (calculateV0TOFBetas.value > 0) { + LOGF(info, "Strangeness TOF PID: V0TOFBetas calculations enabled automatically"); + } + } + if (calculateV0TOFDebugs.value < 0) { + // check if TOF information is required, enable if so + calculateV0TOFDebugs.value = isTableRequiredInWorkflow(initContext, "V0TOFDebugs"); + if (calculateV0TOFDebugs.value > 0) { + LOGF(info, "Strangeness TOF PID: V0TOFDebugs calculations enabled automatically"); + } + } + if (calculateCascTOFPIDs.value < 0) { + // check if TOF information is required, enable if so + calculateCascTOFPIDs.value = isTableRequiredInWorkflow(initContext, "CascTOFPIDs"); + if (calculateCascTOFPIDs.value > 0) { + LOGF(info, "Strangeness TOF PID: CascTOFPIDs calculations enabled automatically"); + } + } nSigmaCalibLoaded = false; nSigmaCalibObjects = nullptr; @@ -376,6 +411,22 @@ struct strangenesstofpid { histos.add("h2dDeltaTimeNegativeLambdaPr", "h2dDeltaTimeNegativeLambdaPr", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); histos.add("h2dDeltaTimePositiveK0ShortPi", "h2dDeltaTimePositiveK0ShortPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); histos.add("h2dDeltaTimeNegativeK0ShortPi", "h2dDeltaTimeNegativeK0ShortPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); + + // delta time with respect to primary-like calculation + histos.add("h2dDiffFromPrimCalcPositiveLambdaPi", "h2dDiffFromPrimCalcPositiveLambdaPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dDiffFromPrimCalcNegativeLambdaPi", "h2dDiffFromPrimCalcNegativeLambdaPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dDiffFromPrimCalcPositiveLambdaPr", "h2dDiffFromPrimCalcPositiveLambdaPr", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dDiffFromPrimCalcNegativeLambdaPr", "h2dDiffFromPrimCalcNegativeLambdaPr", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dDiffFromPrimCalcPositiveK0ShortPi", "h2dDiffFromPrimCalcPositiveK0ShortPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dDiffFromPrimCalcNegativeK0ShortPi", "h2dDiffFromPrimCalcNegativeK0ShortPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); + + // QA collision reassociation fraction (from track -> V0/cascade coll index) + histos.add("h2dCorrectAssocPositiveLambdaPi", "h2dCorrectAssocPositiveLambdaPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dCorrectAssocNegativeLambdaPi", "h2dCorrectAssocNegativeLambdaPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dCorrectAssocPositiveLambdaPr", "h2dCorrectAssocPositiveLambdaPr", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dCorrectAssocNegativeLambdaPr", "h2dCorrectAssocNegativeLambdaPr", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dCorrectAssocPositiveK0ShortPi", "h2dCorrectAssocPositiveK0ShortPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dCorrectAssocNegativeK0ShortPi", "h2dCorrectAssocNegativeK0ShortPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); } if (calculateCascades.value > 0) { @@ -390,6 +441,32 @@ struct strangenesstofpid { histos.add("h2dnegDeltaTimeAsOmPi", "h2dnegDeltaTimeAsOmPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); histos.add("h2dnegDeltaTimeAsOmPr", "h2dnegDeltaTimeAsOmPr", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); histos.add("h2dbachDeltaTimeAsOmKa", "h2dbachDeltaTimeAsOmKa", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); + + // delta time with respect to primary-like calculation + histos.add("h2dposDiffFromPrimCalcAsXiPi", "h2dposDiffFromPrimCalcAsXiPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dposDiffFromPrimCalcAsXiPr", "h2dposDiffFromPrimCalcAsXiPr", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dnegDiffFromPrimCalcAsXiPi", "h2dnegDiffFromPrimCalcAsXiPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dnegDiffFromPrimCalcAsXiPr", "h2dnegDiffFromPrimCalcAsXiPr", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dbachDiffFromPrimCalcAsXiPi", "h2dbachDiffFromPrimCalcAsXiPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); + + histos.add("h2dposDiffFromPrimCalcAsOmPi", "h2dposDiffFromPrimCalcAsOmPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dposDiffFromPrimCalcAsOmPr", "h2dposDiffFromPrimCalcAsOmPr", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dnegDiffFromPrimCalcAsOmPi", "h2dnegDiffFromPrimCalcAsOmPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dnegDiffFromPrimCalcAsOmPr", "h2dnegDiffFromPrimCalcAsOmPr", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dbachDiffFromPrimCalcAsOmKa", "h2dbachDiffFromPrimCalcAsOmKa", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); + + // QA collision reassociation fraction (from track -> V0/cascade coll index) + histos.add("h2dposCorrectAssocAsXiPi", "h2dposCorrectAssocAsXiPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dposCorrectAssocAsXiPr", "h2dposCorrectAssocAsXiPr", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dnegCorrectAssocAsXiPi", "h2dnegCorrectAssocAsXiPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dnegCorrectAssocAsXiPr", "h2dnegCorrectAssocAsXiPr", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dbachCorrectAssocAsXiPi", "h2dbachCorrectAssocAsXiPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); + + histos.add("h2dposCorrectAssocAsOmPi", "h2dposCorrectAssocAsOmPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dposCorrectAssocAsOmPr", "h2dposCorrectAssocAsOmPr", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dnegCorrectAssocAsOmPi", "h2dnegCorrectAssocAsOmPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dnegCorrectAssocAsOmPr", "h2dnegCorrectAssocAsOmPr", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dbachCorrectAssocAsOmKa", "h2dbachCorrectAssocAsOmKa", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); } histos.add("h2dPositiveTOFProperties", "h2dPositiveTOFProperties", {HistType::kTH2F, {axisP, {4, -0.5, 3.5f}}}); @@ -554,11 +631,18 @@ struct strangenesstofpid { // structs to hold information struct v0TofInfo { // holds processed information regarding TOF for V0s + float timeK0Short = o2::aod::v0data::kNoTOFValue; + float timeLambda = o2::aod::v0data::kNoTOFValue; float timePositivePr = o2::aod::v0data::kNoTOFValue; float timePositivePi = o2::aod::v0data::kNoTOFValue; float timeNegativePr = o2::aod::v0data::kNoTOFValue; float timeNegativePi = o2::aod::v0data::kNoTOFValue; + float timeAsPrimaryPositivePr = o2::aod::v0data::kNoTOFValue; + float timeAsPrimaryPositivePi = o2::aod::v0data::kNoTOFValue; + float timeAsPrimaryNegativePr = o2::aod::v0data::kNoTOFValue; + float timeAsPrimaryNegativePi = o2::aod::v0data::kNoTOFValue; + float deltaTimePositiveLambdaPi = o2::aod::v0data::kNoTOFValue; float deltaTimeNegativeLambdaPi = o2::aod::v0data::kNoTOFValue; float deltaTimePositiveLambdaPr = o2::aod::v0data::kNoTOFValue; @@ -572,6 +656,15 @@ struct strangenesstofpid { float nSigmaNegativeLambdaPr = o2::aod::v0data::kNoTOFValue; float nSigmaPositiveK0ShortPi = o2::aod::v0data::kNoTOFValue; float nSigmaNegativeK0ShortPi = o2::aod::v0data::kNoTOFValue; + + // extra auxiliary variables + float deltaDecayTimeLambda = o2::aod::v0data::kNoTOFValue; + float deltaDecayTimeAntiLambda = o2::aod::v0data::kNoTOFValue; + float deltaDecayTimeK0Short = o2::aod::v0data::kNoTOFValue; + + float betaLambda = o2::aod::v0data::kNoTOFValue; + float betaAntiLambda = o2::aod::v0data::kNoTOFValue; + float betaK0Short = o2::aod::v0data::kNoTOFValue; }; // structs to hold information @@ -583,6 +676,13 @@ struct strangenesstofpid { float bachFlightPi = o2::aod::cascdata::kNoTOFValue; float bachFlightKa = o2::aod::cascdata::kNoTOFValue; + float posFlightAsPrimaryPi = o2::aod::cascdata::kNoTOFValue; + float posFlightAsPrimaryPr = o2::aod::cascdata::kNoTOFValue; + float negFlightAsPrimaryPi = o2::aod::cascdata::kNoTOFValue; + float negFlightAsPrimaryPr = o2::aod::cascdata::kNoTOFValue; + float bachFlightAsPrimaryPi = o2::aod::cascdata::kNoTOFValue; + float bachFlightAsPrimaryKa = o2::aod::cascdata::kNoTOFValue; + float posDeltaTimeAsXiPi = o2::aod::cascdata::kNoTOFValue, posDeltaTimeAsXiPr = o2::aod::cascdata::kNoTOFValue; float negDeltaTimeAsXiPi = o2::aod::cascdata::kNoTOFValue, negDeltaTimeAsXiPr = o2::aod::cascdata::kNoTOFValue; float bachDeltaTimeAsXiPi = o2::aod::cascdata::kNoTOFValue; @@ -635,8 +735,8 @@ struct strangenesstofpid { float lengthV0 = std::hypot(v0.x() - collision.posX(), v0.y() - collision.posY(), v0.z() - collision.posZ()); float velocityK0Short = velocity(v0.p(), o2::constants::physics::MassKaonNeutral); float velocityLambda = velocity(v0.p(), o2::constants::physics::MassLambda); - float timeK0Short = lengthV0 / velocityK0Short; // in picoseconds - float timeLambda = lengthV0 / velocityLambda; // in picoseconds + v0tof.timeK0Short = lengthV0 / velocityK0Short; // in picoseconds + v0tof.timeLambda = lengthV0 / velocityLambda; // in picoseconds //_____________________________________________________________________________________________ // define simple checks @@ -678,13 +778,17 @@ struct strangenesstofpid { lengthPositive = pTof.length - ltIntegral.getL(); v0tof.timePositivePr = o2::framework::pid::tof::MassToExpTime(pTof.tofExpMom, lengthPositive, o2::constants::physics::MassProton * o2::constants::physics::MassProton); v0tof.timePositivePi = o2::framework::pid::tof::MassToExpTime(pTof.tofExpMom, lengthPositive, o2::constants::physics::MassPionCharged * o2::constants::physics::MassPionCharged); + + // as primary + v0tof.timeAsPrimaryPositivePr = o2::framework::pid::tof::MassToExpTime(pTof.tofExpMom, pTof.length, o2::constants::physics::MassProton * o2::constants::physics::MassProton); + v0tof.timeAsPrimaryPositivePi = o2::framework::pid::tof::MassToExpTime(pTof.tofExpMom, pTof.length, o2::constants::physics::MassPionCharged * o2::constants::physics::MassPionCharged); } } } if (lengthPositive > 0.0f) { - v0tof.deltaTimePositiveLambdaPr = (pTof.tofSignal - pTof.tofEvTime) - (timeLambda + v0tof.timePositivePr); - v0tof.deltaTimePositiveLambdaPi = (pTof.tofSignal - pTof.tofEvTime) - (timeLambda + v0tof.timePositivePi); - v0tof.deltaTimePositiveK0ShortPi = (pTof.tofSignal - pTof.tofEvTime) - (timeK0Short + v0tof.timePositivePi); + v0tof.deltaTimePositiveLambdaPr = (pTof.tofSignal - pTof.tofEvTime) - (v0tof.timeLambda + v0tof.timePositivePr); + v0tof.deltaTimePositiveLambdaPi = (pTof.tofSignal - pTof.tofEvTime) - (v0tof.timeLambda + v0tof.timePositivePi); + v0tof.deltaTimePositiveK0ShortPi = (pTof.tofSignal - pTof.tofEvTime) - (v0tof.timeK0Short + v0tof.timePositivePi); // de facto nsigma if (nSigmaCalibLoaded) { @@ -698,12 +802,18 @@ struct strangenesstofpid { if (passesQAcuts) { if (lambdaCandidate) { histos.fill(HIST("h2dDeltaTimePositiveLambdaPr"), v0.p(), v0.eta(), v0tof.deltaTimePositiveLambdaPr); + histos.fill(HIST("h2dCorrectAssocPositiveLambdaPr"), v0.p(), static_cast(collisionId == pTof.collisionId)); + histos.fill(HIST("h2dDiffFromPrimCalcPositiveLambdaPr"), v0.p(), (pTof.tofSignal - pTof.tofEvTime) - v0tof.timeAsPrimaryPositivePr); } if (antiLambdaCandidate) { histos.fill(HIST("h2dDeltaTimePositiveLambdaPi"), v0.p(), v0.eta(), v0tof.deltaTimePositiveLambdaPi); + histos.fill(HIST("h2dCorrectAssocPositiveLambdaPi"), v0.p(), static_cast(collisionId == pTof.collisionId)); + histos.fill(HIST("h2dDiffFromPrimCalcPositiveLambdaPi"), v0.p(), (pTof.tofSignal - pTof.tofEvTime) - v0tof.timeAsPrimaryPositivePi); } if (k0ShortCandidate) { histos.fill(HIST("h2dDeltaTimePositiveK0ShortPi"), v0.p(), v0.eta(), v0tof.deltaTimePositiveK0ShortPi); + histos.fill(HIST("h2dCorrectAssocPositiveK0ShortPi"), v0.p(), static_cast(collisionId == pTof.collisionId)); + histos.fill(HIST("h2dDiffFromPrimCalcPositiveK0ShortPi"), v0.p(), (pTof.tofSignal - pTof.tofEvTime) - v0tof.timeAsPrimaryPositivePi); } } } @@ -732,15 +842,19 @@ struct strangenesstofpid { bool successPropag = o2::base::Propagator::Instance()->propagateToDCA(trackVertex, negTrack, d_bz, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrNONE, nullptr, <Integral); if (successPropag) { lengthNegative = nTof.length - ltIntegral.getL(); - v0tof.timeNegativePr = o2::framework::pid::tof::MassToExpTime(nTof.tofExpMom, nTof.length - ltIntegral.getL(), o2::constants::physics::MassProton * o2::constants::physics::MassProton); - v0tof.timeNegativePi = o2::framework::pid::tof::MassToExpTime(nTof.tofExpMom, nTof.length - ltIntegral.getL(), o2::constants::physics::MassPionCharged * o2::constants::physics::MassPionCharged); + v0tof.timeNegativePr = o2::framework::pid::tof::MassToExpTime(nTof.tofExpMom, lengthNegative, o2::constants::physics::MassProton * o2::constants::physics::MassProton); + v0tof.timeNegativePi = o2::framework::pid::tof::MassToExpTime(nTof.tofExpMom, lengthNegative, o2::constants::physics::MassPionCharged * o2::constants::physics::MassPionCharged); + + // as primary + v0tof.timeAsPrimaryNegativePr = o2::framework::pid::tof::MassToExpTime(nTof.tofExpMom, nTof.length, o2::constants::physics::MassProton * o2::constants::physics::MassProton); + v0tof.timeAsPrimaryNegativePi = o2::framework::pid::tof::MassToExpTime(nTof.tofExpMom, nTof.length, o2::constants::physics::MassPionCharged * o2::constants::physics::MassPionCharged); } } } if (lengthNegative > 0.0f) { - v0tof.deltaTimeNegativeLambdaPr = (nTof.tofSignal - nTof.tofEvTime) - (timeLambda + v0tof.timeNegativePr); - v0tof.deltaTimeNegativeLambdaPi = (nTof.tofSignal - nTof.tofEvTime) - (timeLambda + v0tof.timeNegativePi); - v0tof.deltaTimeNegativeK0ShortPi = (nTof.tofSignal - nTof.tofEvTime) - (timeK0Short + v0tof.timeNegativePi); + v0tof.deltaTimeNegativeLambdaPr = (nTof.tofSignal - nTof.tofEvTime) - (v0tof.timeLambda + v0tof.timeNegativePr); + v0tof.deltaTimeNegativeLambdaPi = (nTof.tofSignal - nTof.tofEvTime) - (v0tof.timeLambda + v0tof.timeNegativePi); + v0tof.deltaTimeNegativeK0ShortPi = (nTof.tofSignal - nTof.tofEvTime) - (v0tof.timeK0Short + v0tof.timeNegativePi); // de facto nsigma if (nSigmaCalibLoaded) { @@ -754,16 +868,39 @@ struct strangenesstofpid { if (passesQAcuts) { if (lambdaCandidate) { histos.fill(HIST("h2dDeltaTimeNegativeLambdaPi"), v0.p(), v0.eta(), v0tof.deltaTimeNegativeLambdaPi); + histos.fill(HIST("h2dCorrectAssocNegativeLambdaPi"), v0.p(), static_cast(collisionId == nTof.collisionId)); + histos.fill(HIST("h2dDiffFromPrimCalcNegativeLambdaPi"), v0.p(), (nTof.tofSignal - nTof.tofEvTime) - v0tof.timeAsPrimaryNegativePi); } if (antiLambdaCandidate) { histos.fill(HIST("h2dDeltaTimeNegativeLambdaPr"), v0.p(), v0.eta(), v0tof.deltaTimeNegativeLambdaPr); + histos.fill(HIST("h2dCorrectAssocNegativeLambdaPr"), v0.p(), static_cast(collisionId == nTof.collisionId)); + histos.fill(HIST("h2dDiffFromPrimCalcNegativeLambdaPr"), v0.p(), (nTof.tofSignal - nTof.tofEvTime) - v0tof.timeAsPrimaryNegativePr); } if (k0ShortCandidate) { histos.fill(HIST("h2dDeltaTimeNegativeK0ShortPi"), v0.p(), v0.eta(), v0tof.deltaTimeNegativeK0ShortPi); + histos.fill(HIST("h2dCorrectAssocNegativeK0ShortPi"), v0.p(), static_cast(collisionId == nTof.collisionId)); + histos.fill(HIST("h2dDiffFromPrimCalcNegativeK0ShortPi"), v0.p(), (nTof.tofSignal - nTof.tofEvTime) - v0tof.timeAsPrimaryNegativePi); } } } } + + // calculation of delta-decay-time (no reliance on event time) + if (nTof.hasTOF && pTof.hasTOF > 0) { // does not depend on event time + v0tof.deltaDecayTimeLambda = (pTof.tofSignal - v0tof.timePositivePr) - (nTof.tofSignal - v0tof.timeNegativePi); + v0tof.deltaDecayTimeAntiLambda = (pTof.tofSignal - v0tof.timePositivePi) - (nTof.tofSignal - v0tof.timeNegativePr); + v0tof.deltaDecayTimeK0Short = (pTof.tofSignal - v0tof.timePositivePi) - (nTof.tofSignal - v0tof.timeNegativePi); + + float evTimeMean = 0.5f * (pTof.tofEvTime + nTof.tofEvTime); + float decayTimeLambda = 0.5f * ((pTof.tofSignal - v0tof.timePositivePr) + (nTof.tofSignal - v0tof.timeNegativePi)) - evTimeMean; + float decayTimeAntiLambda = 0.5f * ((pTof.tofSignal - v0tof.timePositivePi) + (nTof.tofSignal - v0tof.timeNegativePr)) - evTimeMean; + float decayTimeK0Short = 0.5f * ((pTof.tofSignal - v0tof.timePositivePi) + (nTof.tofSignal - v0tof.timeNegativePi)) - evTimeMean; + + constexpr float lightSpeed = 0.0299792458; // in cm/ps + v0tof.betaLambda = (lengthV0 / decayTimeLambda) / lightSpeed; + v0tof.betaAntiLambda = (lengthV0 / decayTimeAntiLambda) / lightSpeed; + v0tof.betaK0Short = (lengthV0 / decayTimeK0Short) / lightSpeed; + } } return v0tof; @@ -869,6 +1006,10 @@ struct strangenesstofpid { lengthPositive = pTof.length - ltIntegral.getL(); casctof.posFlightPr = o2::framework::pid::tof::MassToExpTime(pTof.tofExpMom, pTof.length - ltIntegral.getL(), o2::constants::physics::MassProton * o2::constants::physics::MassProton); casctof.posFlightPi = o2::framework::pid::tof::MassToExpTime(pTof.tofExpMom, pTof.length - ltIntegral.getL(), o2::constants::physics::MassPionCharged * o2::constants::physics::MassPionCharged); + + // as primary + casctof.posFlightAsPrimaryPr = o2::framework::pid::tof::MassToExpTime(pTof.tofExpMom, pTof.length, o2::constants::physics::MassProton * o2::constants::physics::MassProton); + casctof.posFlightAsPrimaryPi = o2::framework::pid::tof::MassToExpTime(pTof.tofExpMom, pTof.length, o2::constants::physics::MassPionCharged * o2::constants::physics::MassPionCharged); } } } @@ -894,15 +1035,23 @@ struct strangenesstofpid { if (passesQAcuts) { if (xiMinusCandidate) { histos.fill(HIST("h2dposDeltaTimeAsXiPr"), cascade.p(), cascade.eta(), casctof.posDeltaTimeAsXiPr); + histos.fill(HIST("h2dposCorrectAssocAsXiPr"), cascade.p(), static_cast(collisionId == pTof.collisionId)); + histos.fill(HIST("h2dposDiffFromPrimCalcAsXiPr"), cascade.p(), (pTof.tofSignal - pTof.tofEvTime) - casctof.posFlightAsPrimaryPr); } if (xiPlusCandidate) { histos.fill(HIST("h2dposDeltaTimeAsXiPi"), cascade.p(), cascade.eta(), casctof.posDeltaTimeAsXiPi); + histos.fill(HIST("h2dposCorrectAssocAsXiPi"), cascade.p(), static_cast(collisionId == pTof.collisionId)); + histos.fill(HIST("h2dposDiffFromPrimCalcAsXiPi"), cascade.p(), (pTof.tofSignal - pTof.tofEvTime) - casctof.posFlightAsPrimaryPi); } if (omegaMinusCandidate) { histos.fill(HIST("h2dposDeltaTimeAsOmPr"), cascade.p(), cascade.eta(), casctof.posDeltaTimeAsOmPr); + histos.fill(HIST("h2dposCorrectAssocAsOmPr"), cascade.p(), static_cast(collisionId == pTof.collisionId)); + histos.fill(HIST("h2dposDiffFromPrimCalcAsOmPr"), cascade.p(), (pTof.tofSignal - pTof.tofEvTime) - casctof.posFlightAsPrimaryPr); } if (omegaPlusCandidate) { histos.fill(HIST("h2dposDeltaTimeAsOmPi"), cascade.p(), cascade.eta(), casctof.posDeltaTimeAsOmPi); + histos.fill(HIST("h2dposCorrectAssocAsOmPi"), cascade.p(), static_cast(collisionId == pTof.collisionId)); + histos.fill(HIST("h2dposDiffFromPrimCalcAsOmPi"), cascade.p(), (pTof.tofSignal - pTof.tofEvTime) - casctof.posFlightAsPrimaryPi); } } } @@ -934,6 +1083,10 @@ struct strangenesstofpid { lengthNegative = nTof.length - ltIntegral.getL(); casctof.negFlightPr = o2::framework::pid::tof::MassToExpTime(nTof.tofExpMom, nTof.length - ltIntegral.getL(), o2::constants::physics::MassProton * o2::constants::physics::MassProton); casctof.negFlightPi = o2::framework::pid::tof::MassToExpTime(nTof.tofExpMom, nTof.length - ltIntegral.getL(), o2::constants::physics::MassPionCharged * o2::constants::physics::MassPionCharged); + + // as primary + casctof.negFlightAsPrimaryPr = o2::framework::pid::tof::MassToExpTime(nTof.tofExpMom, nTof.length, o2::constants::physics::MassProton * o2::constants::physics::MassProton); + casctof.negFlightAsPrimaryPi = o2::framework::pid::tof::MassToExpTime(nTof.tofExpMom, nTof.length, o2::constants::physics::MassPionCharged * o2::constants::physics::MassPionCharged); } } } @@ -959,15 +1112,23 @@ struct strangenesstofpid { if (passesQAcuts) { if (xiMinusCandidate) { histos.fill(HIST("h2dnegDeltaTimeAsXiPi"), cascade.p(), cascade.eta(), casctof.negDeltaTimeAsXiPi); + histos.fill(HIST("h2dnegCorrectAssocAsXiPi"), cascade.p(), static_cast(collisionId == nTof.collisionId)); + histos.fill(HIST("h2dnegDiffFromPrimCalcAsXiPi"), cascade.p(), (nTof.tofSignal - nTof.tofEvTime) - casctof.negFlightAsPrimaryPi); } if (xiPlusCandidate) { histos.fill(HIST("h2dnegDeltaTimeAsXiPr"), cascade.p(), cascade.eta(), casctof.negDeltaTimeAsXiPr); + histos.fill(HIST("h2dnegCorrectAssocAsXiPr"), cascade.p(), static_cast(collisionId == nTof.collisionId)); + histos.fill(HIST("h2dnegDiffFromPrimCalcAsXiPr"), cascade.p(), (nTof.tofSignal - nTof.tofEvTime) - casctof.negFlightAsPrimaryPr); } if (omegaMinusCandidate) { histos.fill(HIST("h2dnegDeltaTimeAsOmPi"), cascade.p(), cascade.eta(), casctof.negDeltaTimeAsOmPi); + histos.fill(HIST("h2dnegCorrectAssocAsOmPi"), cascade.p(), static_cast(collisionId == nTof.collisionId)); + histos.fill(HIST("h2dnegDiffFromPrimCalcAsOmPi"), cascade.p(), (nTof.tofSignal - nTof.tofEvTime) - casctof.negFlightAsPrimaryPi); } if (omegaPlusCandidate) { histos.fill(HIST("h2dnegDeltaTimeAsOmPr"), cascade.p(), cascade.eta(), casctof.negDeltaTimeAsOmPr); + histos.fill(HIST("h2dnegCorrectAssocAsOmPr"), cascade.p(), static_cast(collisionId == nTof.collisionId)); + histos.fill(HIST("h2dnegDiffFromPrimCalcAsOmPr"), cascade.p(), (nTof.tofSignal - nTof.tofEvTime) - casctof.negFlightAsPrimaryPr); } } } @@ -999,6 +1160,10 @@ struct strangenesstofpid { lengthBachelor = bTof.length - ltIntegral.getL(); casctof.bachFlightPi = o2::framework::pid::tof::MassToExpTime(bTof.tofExpMom, bTof.length - ltIntegral.getL(), o2::constants::physics::MassPionCharged * o2::constants::physics::MassPionCharged); casctof.bachFlightKa = o2::framework::pid::tof::MassToExpTime(bTof.tofExpMom, bTof.length - ltIntegral.getL(), o2::constants::physics::MassKaonCharged * o2::constants::physics::MassKaonCharged); + + // as primary + casctof.bachFlightAsPrimaryPi = o2::framework::pid::tof::MassToExpTime(bTof.tofExpMom, bTof.length, o2::constants::physics::MassPionCharged * o2::constants::physics::MassPionCharged); + casctof.bachFlightAsPrimaryKa = o2::framework::pid::tof::MassToExpTime(bTof.tofExpMom, bTof.length, o2::constants::physics::MassKaonCharged * o2::constants::physics::MassKaonCharged); } } } @@ -1022,15 +1187,23 @@ struct strangenesstofpid { if (passesQAcuts) { if (xiMinusCandidate) { histos.fill(HIST("h2dbachDeltaTimeAsXiPi"), cascade.p(), cascade.eta(), casctof.bachDeltaTimeAsXiPi); + histos.fill(HIST("h2dbachCorrectAssocAsXiPi"), cascade.p(), static_cast(collisionId == bTof.collisionId)); + histos.fill(HIST("h2dbachDiffFromPrimCalcAsXiPi"), cascade.p(), (bTof.tofSignal - bTof.tofEvTime) - casctof.bachFlightAsPrimaryPi); } if (xiPlusCandidate) { histos.fill(HIST("h2dbachDeltaTimeAsXiPi"), cascade.p(), cascade.eta(), casctof.bachDeltaTimeAsXiPi); + histos.fill(HIST("h2dbachCorrectAssocAsXiPi"), cascade.p(), static_cast(collisionId == bTof.collisionId)); + histos.fill(HIST("h2dbachDiffFromPrimCalcAsXiPi"), cascade.p(), (bTof.tofSignal - bTof.tofEvTime) - casctof.bachFlightAsPrimaryPi); } if (omegaMinusCandidate) { histos.fill(HIST("h2dbachDeltaTimeAsOmKa"), cascade.p(), cascade.eta(), casctof.bachDeltaTimeAsOmKa); + histos.fill(HIST("h2dbachCorrectAssocAsOmKa"), cascade.p(), static_cast(collisionId == bTof.collisionId)); + histos.fill(HIST("h2dbachDiffFromPrimCalcAsOmKa"), cascade.p(), (bTof.tofSignal - bTof.tofEvTime) - casctof.bachFlightAsPrimaryKa); } if (omegaPlusCandidate) { histos.fill(HIST("h2dbachDeltaTimeAsOmKa"), cascade.p(), cascade.eta(), casctof.bachDeltaTimeAsOmKa); + histos.fill(HIST("h2dbachCorrectAssocAsOmKa"), cascade.p(), static_cast(collisionId == bTof.collisionId)); + histos.fill(HIST("h2dbachDiffFromPrimCalcAsOmKa"), cascade.p(), (bTof.tofSignal - bTof.tofEvTime) - casctof.bachFlightAsPrimaryKa); } } } @@ -1107,6 +1280,20 @@ struct strangenesstofpid { v0tof.nSigmaNegativeLambdaPr, v0tof.nSigmaPositiveLambdaPi, v0tof.nSigmaPositiveK0ShortPi, v0tof.nSigmaNegativeK0ShortPi); } + if (calculateV0TOFPIDs.value) { + v0tofpid(v0tof.deltaTimePositiveLambdaPi, v0tof.deltaTimePositiveLambdaPr, + v0tof.deltaTimeNegativeLambdaPi, v0tof.deltaTimeNegativeLambdaPr, + v0tof.deltaTimePositiveK0ShortPi, v0tof.deltaTimeNegativeK0ShortPi, + v0tof.deltaDecayTimeLambda, v0tof.deltaDecayTimeAntiLambda, v0tof.deltaDecayTimeK0Short); + } + if (calculateV0TOFBetas.value) { + v0tofbeta(v0tof.betaLambda, v0tof.betaAntiLambda, v0tof.betaK0Short); + } + if (calculateV0TOFDebugs.value) { + v0tofdebugs(v0tof.timeLambda, v0tof.timeK0Short, + v0tof.timePositivePr, v0tof.timePositivePi, + v0tof.timeNegativePr, v0tof.timeNegativePi); + } } } @@ -1158,6 +1345,13 @@ struct strangenesstofpid { casctof.nSigmaXiLaPi, casctof.nSigmaXiLaPr, casctof.nSigmaXiPi, casctof.nSigmaOmLaPi, casctof.nSigmaOmLaPr, casctof.nSigmaOmKa); } + if (calculateCascTOFPIDs.value) { + casctofpids( + casctof.posDeltaTimeAsXiPi, casctof.posDeltaTimeAsXiPr, + casctof.negDeltaTimeAsXiPi, casctof.negDeltaTimeAsXiPr, casctof.bachDeltaTimeAsXiPi, + casctof.posDeltaTimeAsOmPi, casctof.posDeltaTimeAsOmPr, + casctof.negDeltaTimeAsOmPi, casctof.negDeltaTimeAsOmPr, casctof.bachDeltaTimeAsOmKa); + } } } } @@ -1171,8 +1365,6 @@ struct strangenesstofpid { auto firstTOFPID = dauTrackTOFPIDs.rawIteratorAt(0); bool isNewTOFFormat = firstTOFPID.straCollisionId() < 0 ? false : true; - LOGF(info, "Processing derived data. Is this the new TOF info format? %i", isNewTOFFormat); - if (!isNewTOFFormat && calculationMethod.value > 0) { LOGF(fatal, "Using the old derived data format with the new calculation method is not viable due to lack of needed info! Crashing."); } @@ -1242,6 +1434,20 @@ struct strangenesstofpid { v0tof.nSigmaNegativeLambdaPr, v0tof.nSigmaPositiveLambdaPi, v0tof.nSigmaPositiveK0ShortPi, v0tof.nSigmaNegativeK0ShortPi); } + if (calculateV0TOFPIDs.value) { + v0tofpid(v0tof.deltaTimePositiveLambdaPi, v0tof.deltaTimePositiveLambdaPr, + v0tof.deltaTimeNegativeLambdaPi, v0tof.deltaTimeNegativeLambdaPr, + v0tof.deltaTimePositiveK0ShortPi, v0tof.deltaTimeNegativeK0ShortPi, + v0tof.deltaDecayTimeLambda, v0tof.deltaDecayTimeAntiLambda, v0tof.deltaDecayTimeK0Short); + } + if (calculateV0TOFBetas.value) { + v0tofbeta(v0tof.betaLambda, v0tof.betaAntiLambda, v0tof.betaK0Short); + } + if (calculateV0TOFDebugs.value) { + v0tofdebugs(v0tof.timeLambda, v0tof.timeK0Short, + v0tof.timePositivePr, v0tof.timePositivePi, + v0tof.timeNegativePr, v0tof.timeNegativePi); + } } } @@ -1303,6 +1509,13 @@ struct strangenesstofpid { casctof.nSigmaXiLaPi, casctof.nSigmaXiLaPr, casctof.nSigmaXiPi, casctof.nSigmaOmLaPi, casctof.nSigmaOmLaPr, casctof.nSigmaOmKa); } + if (calculateCascTOFPIDs.value) { + casctofpids( + casctof.posDeltaTimeAsXiPi, casctof.posDeltaTimeAsXiPr, + casctof.negDeltaTimeAsXiPi, casctof.negDeltaTimeAsXiPr, casctof.bachDeltaTimeAsXiPi, + casctof.posDeltaTimeAsOmPi, casctof.posDeltaTimeAsOmPr, + casctof.negDeltaTimeAsOmPi, casctof.negDeltaTimeAsOmPr, casctof.bachDeltaTimeAsOmKa); + } } } } diff --git a/PWGLF/Utils/strangenessBuilderModule.h b/PWGLF/Utils/strangenessBuilderModule.h index e5ed9214869..e49ed71f14b 100644 --- a/PWGLF/Utils/strangenessBuilderModule.h +++ b/PWGLF/Utils/strangenessBuilderModule.h @@ -277,6 +277,9 @@ struct coreConfigurables : o2::framework::ConfigurableGroup { o2::framework::Configurable useV0BufferForCascades{"useV0BufferForCascades", false, "store array of V0s for cascades or not. False (default): save RAM, use more CPU; true: save CPU, use more RAM"}; o2::framework::Configurable mc_findableMode{"mc_findableMode", 0, "0: disabled; 1: add findable-but-not-found to existing V0s from AO2D; 2: reset V0s and generate only findable-but-not-found"}; + + // test the possibility of refitting with material corrections (DCA Fitter option) + o2::framework::Configurable refitWithMaterialCorrection{"refitWithMaterialCorrection", false, "do refit after material corrections were applied"}; }; // strangenessBuilder: V0 building options @@ -697,6 +700,9 @@ class BuilderModule straHelper.cascadeselections.dcacascdau = cascadeBuilderOpts.dcacascdau; straHelper.cascadeselections.lambdaMassWindow = cascadeBuilderOpts.lambdaMassWindow; straHelper.cascadeselections.maxDaughterEta = cascadeBuilderOpts.maxDaughterEta; + + // Set option to refit with material corrections + straHelper.fitter.setRefitWithMatCorr(baseOpts.refitWithMaterialCorrection.value); } // for sorting From 235ce9dd9e4d4377efae9fbee05e1e746efd1591 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Wed, 17 Sep 2025 22:50:43 +0200 Subject: [PATCH 430/986] [ALICE3] Support CCDB fetching of LUTs (#13016) --- ALICE3/Core/DelphesO2TrackSmearer.cxx | 31 +++++++++++- ALICE3/Core/DelphesO2TrackSmearer.h | 47 ++++++++++++++---- ALICE3/TableProducer/OTF/onTheFlyTracker.cxx | 52 ++++++++------------ 3 files changed, 89 insertions(+), 41 deletions(-) diff --git a/ALICE3/Core/DelphesO2TrackSmearer.cxx b/ALICE3/Core/DelphesO2TrackSmearer.cxx index f4ea4ebdf3c..2c6b23e8e83 100644 --- a/ALICE3/Core/DelphesO2TrackSmearer.cxx +++ b/ALICE3/Core/DelphesO2TrackSmearer.cxx @@ -36,6 +36,8 @@ #include "ALICE3/Core/DelphesO2TrackSmearer.h" +#include + namespace o2 { namespace delphes @@ -45,11 +47,38 @@ namespace delphes bool TrackSmearer::loadTable(int pdg, const char* filename, bool forceReload) { - auto ipdg = getIndexPDG(pdg); + if (!filename || filename[0] == '\0') { + LOG(info) << " --- No LUT file provided for PDG " << pdg << ". Skipping load."; + return false; + } + const auto ipdg = getIndexPDG(pdg); + LOGF(info, "Will load %s lut file ..: '%s'", getParticleName(pdg), filename); if (mLUTHeader[ipdg] && !forceReload) { std::cout << " --- LUT table for PDG " << pdg << " has been already loaded with index " << ipdg << std::endl; return false; } + if (strncmp(filename, "ccdb:", 5) == 0) { // Check if filename starts with "ccdb:" + LOG(info) << " --- LUT file source identified as CCDB."; + std::string path = std::string(filename).substr(5); // Remove "ccdb:" prefix + const std::string outPath = "/tmp/LUTs/"; + filename = Form("%s/%s/snapshot.root", outPath.c_str(), path.c_str()); + std::ifstream checkFile(filename); // Check if file already exists + if (!checkFile.is_open()) { // File does not exist, retrieve from CCDB + LOG(info) << " --- CCDB source detected for PDG " << pdg << ": " << path; + if (!mCcdbManager) { + LOG(fatal) << " --- CCDB manager not set. Please set it before loading LUT from CCDB."; + } + std::map metadata; + mCcdbManager->getCCDBAccessor().retrieveBlob(path, outPath, metadata, 1); + // Add CCDB handling logic here if needed + LOG(info) << " --- Now retrieving LUT file from CCDB to: " << filename; + } else { // File exists, proceed to load + LOG(info) << " --- LUT file already exists: " << filename << ". Skipping download."; + checkFile.close(); + } + return loadTable(pdg, filename, forceReload); + } + mLUTHeader[ipdg] = new lutHeader_t; std::ifstream lutFile(filename, std::ifstream::binary); diff --git a/ALICE3/Core/DelphesO2TrackSmearer.h b/ALICE3/Core/DelphesO2TrackSmearer.h index 1e0fd873e2c..2e2198bd68f 100644 --- a/ALICE3/Core/DelphesO2TrackSmearer.h +++ b/ALICE3/Core/DelphesO2TrackSmearer.h @@ -24,12 +24,14 @@ #ifndef ALICE3_CORE_DELPHESO2TRACKSMEARER_H_ #define ALICE3_CORE_DELPHESO2TRACKSMEARER_H_ -#include -#include -#include +#include +#include -#include "TRandom.h" -#include "ReconstructionDataFormats/Track.h" +#include + +#include +#include +#include /////////////////////////////// /// DelphesO2/src/lutCovm.hh // @@ -85,7 +87,7 @@ struct map_t { if (bin > nbins - 1) return nbins - 1; return bin; - } //; + } //; void print() { printf("nbins = %d, min = %f, max = %f, log = %s \n", nbins, min, max, log ? "on" : "off"); } //; }; @@ -214,10 +216,34 @@ class TrackSmearer return 7; // Helium3 default: return 2; // Default: pion - } //; - } //; + } + } - void setdNdEta(float val) { mdNdEta = val; } //; + const char* getParticleName(int pdg) + { + switch (abs(pdg)) { + case 11: + return "electron"; + case 13: + return "muon"; + case 211: + return "pion"; + case 321: + return "kaon"; + case 2212: + return "proton"; + case 1000010020: + return "deuteron"; + case 1000010030: + return "triton"; + case 1000020030: + return "helium3"; + default: + return "pion"; // Default: pion + } + } + void setdNdEta(float val) { mdNdEta = val; } //; + void setCcdbManager(o2::ccdb::BasicCCDBManager* mgr) { mCcdbManager = mgr; } //; protected: static constexpr unsigned int nLUTs = 8; // Number of LUT available @@ -228,6 +254,9 @@ class TrackSmearer bool mSkipUnreconstructed = true; // don't smear tracks that are not reco'ed int mWhatEfficiency = 1; float mdNdEta = 1600.; + + private: + o2::ccdb::BasicCCDBManager* mCcdbManager = nullptr; }; } // namespace delphes diff --git a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx index c858f5a753e..2005969d239 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx @@ -239,42 +239,32 @@ struct OnTheFlyTracker { // For TGenPhaseSpace seed TRandom3 rand; + Service ccdb; void init(o2::framework::InitContext&) { + + ccdb->setURL("http://alice-ccdb.cern.ch"); + ccdb->setTimestamp(-1); + if (enableLUT) { - std::map mapPdgLut; - const char* lutElChar = lutEl->c_str(); - const char* lutMuChar = lutMu->c_str(); - const char* lutPiChar = lutPi->c_str(); - const char* lutKaChar = lutKa->c_str(); - const char* lutPrChar = lutPr->c_str(); - - LOGF(info, "Will load electron lut file ..: %s", lutElChar); - LOGF(info, "Will load muon lut file ......: %s", lutMuChar); - LOGF(info, "Will load pion lut file ......: %s", lutPiChar); - LOGF(info, "Will load kaon lut file ......: %s", lutKaChar); - LOGF(info, "Will load proton lut file ....: %s", lutPrChar); - - mapPdgLut.insert(std::make_pair(11, lutElChar)); - mapPdgLut.insert(std::make_pair(13, lutMuChar)); - mapPdgLut.insert(std::make_pair(211, lutPiChar)); - mapPdgLut.insert(std::make_pair(321, lutKaChar)); - mapPdgLut.insert(std::make_pair(2212, lutPrChar)); - - if (enableNucleiSmearing) { - const char* lutDeChar = lutDe->c_str(); - const char* lutTrChar = lutTr->c_str(); - const char* lutHe3Char = lutHe3->c_str(); - mapPdgLut.insert(std::make_pair(1000010020, lutDeChar)); - mapPdgLut.insert(std::make_pair(1000010030, lutTrChar)); - mapPdgLut.insert(std::make_pair(1000020030, lutHe3Char)); - } - for (const auto& e : mapPdgLut) { - if (!mSmearer.loadTable(e.first, e.second)) { - LOG(fatal) << "Having issue with loading the LUT " << e.first << " " << e.second; + mSmearer.setCcdbManager(ccdb.operator->()); + + auto loadLUT = [&](int pdg, const std::string& lutFile) { + bool success = mSmearer.loadTable(pdg, lutFile.c_str()); + if (!success && !lutFile.empty()) { + LOG(fatal) << "Having issue with loading the LUT " << pdg << " " << lutFile; } - } + }; + loadLUT(11, lutEl.value); + loadLUT(13, lutMu.value); + loadLUT(211, lutPi.value); + loadLUT(321, lutKa.value); + loadLUT(2212, lutPr.value); + loadLUT(1000010020, lutDe.value); + loadLUT(1000010030, lutTr.value); + loadLUT(1000020030, lutHe3.value); + // interpolate efficiencies if requested to do so mSmearer.interpolateEfficiency(static_cast(interpolateLutEfficiencyVsNch)); From ea90c513989d78e72902315c4e04ae5d841b3a6d Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Thu, 18 Sep 2025 02:37:54 +0200 Subject: [PATCH 431/986] [PWGEM/Dilepton] update phiv range (#12961) --- PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx | 2 +- PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx index 4e1706aac6f..4942072d412 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx @@ -876,7 +876,7 @@ struct prefilterPrimaryElectron { fRegistry.add("Track/hEtaPhi", "#eta vs. #varphi;#varphi (rad.);#eta", kTH2F, {{90, 0, 2 * M_PI}, {80, -2.0f, 2.0f}}, false); fRegistry.add("Track/hTPCNsigmaEl", "loose track TPC PID", kTH2F, {{1000, 0.f, 10}, {100, -5, +5}}); fRegistry.add("Pair/before/uls/hMvsPt", "mass vs. pT;m_{ee} (GeV/c^{2});p_{T,ee} (GeV/c)", kTH2F, {{500, 0, 0.5}, {100, 0, 1}}); - fRegistry.add("Pair/before/uls/hMvsPhiV", "mass vs. phiv;#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", kTH2F, {{90, 0.f, M_PI}, {100, 0, 0.1}}); + fRegistry.add("Pair/before/uls/hMvsPhiV", "mass vs. phiv;#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", kTH2F, {{90, 0.f, M_PI}, {100, 0, 1.0}}); fRegistry.addClone("Pair/before/uls/", "Pair/before/lspp/"); fRegistry.addClone("Pair/before/uls/", "Pair/before/lsmm/"); fRegistry.addClone("Pair/before/", "Pair/after/"); diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx index fd8d783c910..2ba072058dc 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx @@ -188,7 +188,7 @@ struct skimmerPrimaryElectronQC { fRegistry.add("Track/hMeanClusterSizeITSib", "mean cluster size ITSib;p_{pv} (GeV/c); #times cos(#lambda)", kTH2F, {{1000, 0, 10}, {150, 0, 15}}, false); fRegistry.add("Track/hMeanClusterSizeITSob", "mean cluster size ITSob;p_{pv} (GeV/c); #times cos(#lambda)", kTH2F, {{1000, 0, 10}, {150, 0, 15}}, false); fRegistry.add("Track/hProbElBDT", "probability to be e from BDT;p_{in} (GeV/c);BDT score;", kTH2F, {{1000, 0, 10}, {100, 0, 1}}, false); - fRegistry.add("Pair/hMvsPhiV", "m_{ee} vs. #varphi_{V} ULS;#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", kTH2F, {{180, 0.f, M_PI}, {100, 0, 0.1}}); + fRegistry.add("Pair/hMvsPhiV", "m_{ee} vs. #varphi_{V} ULS;#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", kTH2F, {{90, 0.f, M_PI}, {100, 0, 1.0}}); // this is dummy comment. } if (usePIDML) { From 06b10978684d6c7a63ad8bec2ff13572c24fd44e Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Thu, 18 Sep 2025 04:15:19 +0200 Subject: [PATCH 432/986] [PWGEM/Dilepton] change acceptance histograms (#13021) --- PWGEM/Dilepton/Core/Dilepton.h | 22 +- PWGEM/Dilepton/Core/DileptonMC.h | 518 ++++++++++++++++--------------- PWGEM/Dilepton/Core/PhotonHBT.h | 9 +- 3 files changed, 281 insertions(+), 268 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 61ef5dab390..bdb158296d5 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -183,7 +183,6 @@ struct Dilepton { Configurable cfg_min_phiv{"cfg_min_phiv", 0.0, "min phiv (constant)"}; Configurable cfg_max_phiv{"cfg_max_phiv", 3.2, "max phiv (constant)"}; Configurable cfg_apply_detadphi{"cfg_apply_detadphi", false, "flag to apply deta-dphi elliptic cut at PV"}; - Configurable cfg_apply_detadphiposition{"cfg_apply_detadphiposition", false, "flag to apply deta-dphi elliptic cut at certain radius"}; Configurable cfg_min_deta{"cfg_min_deta", 0.02, "min deta between 2 electrons (elliptic cut)"}; Configurable cfg_min_dphi{"cfg_min_dphi", 0.2, "min dphi between 2 electrons (elliptic cut)"}; Configurable cfg_min_opang{"cfg_min_opang", 0.0, "min opening angle"}; @@ -219,7 +218,6 @@ struct Dilepton { Configurable cfg_max_its_cluster_size{"cfg_max_its_cluster_size", 16.f, "max ITS cluster size"}; Configurable cfg_min_rel_diff_pin{"cfg_min_rel_diff_pin", -1e+10, "min rel. diff. between pin and ppv"}; Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; - Configurable cfgRefR{"cfgRefR", 1.2, "reference R (in m) for extrapolation"}; // https://cds.cern.ch/record/1419204 Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif : 4, kPIDML : 5, kTPChadrejORTOFreq_woTOFif : 6]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; @@ -306,7 +304,7 @@ struct Dilepton { o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; - static constexpr std::string_view event_cut_types[2] = {"before/", "after/"}; + // static constexpr std::string_view event_cut_types[2] = {"before/", "after/"}; static constexpr std::string_view event_pair_types[2] = {"same/", "mix/"}; std::vector cent_bin_edges; @@ -558,7 +556,6 @@ struct Dilepton { if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kQC)) { fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y}, true); fRegistry.add("Pair/same/uls/hDeltaEtaDeltaPhi", "#Delta#eta-#Delta#varphi between 2 tracks;#Delta#varphi (rad.);#Delta#eta;", kTH2D, {{180, -M_PI, M_PI}, {400, -2, +2}}, true); - fRegistry.add("Pair/same/uls/hDeltaEtaDeltaPhiPosition", "#Delta#eta-#Delta#varphi^{*} between 2 tracks;#Delta#varphi^{*} (rad.);#Delta#eta;", kTH2D, {{180, -M_PI, M_PI}, {400, -2, +2}}, true); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.add("Pair/same/uls/hMvsPhiV", "m_{ee} vs. #varphi_{V};#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", kTH2D, {{90, 0, M_PI}, {100, 0.0f, 1.0f}}, true); // phiv is only for dielectron @@ -679,7 +676,7 @@ struct Dilepton { fDielectronCut.SetPairDCARange(dielectroncuts.cfg_min_pair_dca3d, dielectroncuts.cfg_max_pair_dca3d); // in sigma fDielectronCut.SetMaxMeePhiVDep([&](float phiv) { return dielectroncuts.cfg_phiv_intercept + phiv * dielectroncuts.cfg_phiv_slope; }, dielectroncuts.cfg_min_phiv, dielectroncuts.cfg_max_phiv); fDielectronCut.ApplyPhiV(dielectroncuts.cfg_apply_phiv); - fDielectronCut.SetMindEtadPhi(dielectroncuts.cfg_apply_detadphi, dielectroncuts.cfg_apply_detadphiposition, dielectroncuts.cfg_min_deta, dielectroncuts.cfg_min_dphi); + fDielectronCut.SetMindEtadPhi(dielectroncuts.cfg_apply_detadphi, false, dielectroncuts.cfg_min_deta, dielectroncuts.cfg_min_dphi); fDielectronCut.SetPairOpAng(dielectroncuts.cfg_min_opang, dielectroncuts.cfg_max_opang); fDielectronCut.SetRequireDifferentSides(dielectroncuts.cfg_require_diff_sides); @@ -876,7 +873,7 @@ struct Dilepton { } if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - if (!cut.IsSelectedPair(t1, t2, d_bz, dielectroncuts.cfgRefR)) { + if (!cut.IsSelectedPair(t1, t2, d_bz, 0.f)) { return false; } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { @@ -928,21 +925,12 @@ struct Dilepton { float dphi = t1.sign() * v1.Pt() > t2.sign() * v2.Pt() ? v1.Phi() - v2.Phi() : v2.Phi() - v1.Phi(); o2::math_utils::bringToPMPi(dphi); - float phiPosition1 = t1.phi() + std::asin(t1.sign() * 0.30282 * (d_bz * 0.1) * dielectroncuts.cfgRefR / (2.f * t1.pt())); - float phiPosition2 = t2.phi() + std::asin(t2.sign() * 0.30282 * (d_bz * 0.1) * dielectroncuts.cfgRefR / (2.f * t2.pt())); - - phiPosition1 = RecoDecay::constrainAngle(phiPosition1, 0, 1); // 0-2pi - phiPosition2 = RecoDecay::constrainAngle(phiPosition2, 0, 1); // 0-2pi - float dphiPosition = t1.sign() * v1.Pt() > t2.sign() * v2.Pt() ? phiPosition1 - phiPosition2 : phiPosition2 - phiPosition1; - o2::math_utils::bringToPMPi(dphiPosition); - float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz(), t1.sign(), t2.sign(), d_bz); float opAng = o2::aod::pwgem::dilepton::utils::pairutil::getOpeningAngle(t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz()); if (t1.sign() * t2.sign() < 0) { // ULS fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hDeltaEtaDeltaPhi"), dphi, deta, weight); - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hDeltaEtaDeltaPhiPosition"), dphiPosition, deta, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hMvsPhiV"), phiv, v12.M(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hMvsOpAng"), opAng, v12.M(), weight); @@ -955,7 +943,6 @@ struct Dilepton { } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hDeltaEtaDeltaPhi"), dphi, deta, weight); - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hDeltaEtaDeltaPhiPosition"), dphiPosition, deta, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hMvsPhiV"), phiv, v12.M(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hMvsOpAng"), opAng, v12.M(), weight); @@ -968,7 +955,6 @@ struct Dilepton { } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hDeltaEtaDeltaPhi"), dphi, deta, weight); - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hDeltaEtaDeltaPhiPosition"), dphiPosition, deta, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hMvsPhiV"), phiv, v12.M(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hMvsOpAng"), opAng, v12.M(), weight); @@ -1421,7 +1407,7 @@ struct Dilepton { } if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - if (!cut.IsSelectedPair(t1, t2, d_bz, dielectroncuts.cfgRefR)) { + if (!cut.IsSelectedPair(t1, t2, d_bz, 0.0)) { return false; } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index 0f924be57f4..8552e617a32 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -105,6 +105,8 @@ struct DileptonMC { Configurable cfgDCAType{"cfgDCAType", 0, "type of DCA for output. 0:3D, 1:XY, 2:Z, else:3D"}; Configurable cfgFillUnfolding{"cfgFillUnfolding", false, "flag to fill histograms for unfolding"}; Configurable cfgRequireTrueAssociation{"cfgRequireTrueAssociation", false, "flag to require true mc collision association"}; + Configurable cfgFillAllCharm{"cfgFillAllCharm", false, "flag to fill histograms for charm hadrons separatedly"}; + Configurable cfgFillAllGen{"cfgFillAllGen", false, "flag to fill histograms for all generated also outside of acceptance."}; ConfigurableAxis ConfMllBins{"ConfMllBins", {VARIABLE_WIDTH, 0.00, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.50, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.70, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.80, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.00, 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.10, 2.20, 2.30, 2.40, 2.50, 2.60, 2.70, 2.75, 2.80, 2.85, 2.90, 2.95, 3.00, 3.05, 3.10, 3.15, 3.20, 3.25, 3.30, 3.35, 3.40, 3.45, 3.50, 3.55, 3.60, 3.65, 3.70, 3.75, 3.80, 3.85, 3.90, 3.95, 4.00}, "mll bins for output histograms"}; ConfigurableAxis ConfPtllBins{"ConfPtllBins", {VARIABLE_WIDTH, 0.00, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.50, 3.00, 3.50, 4.00, 4.50, 5.00, 6.00, 7.00, 8.00, 9.00, 10.00}, "pTll bins for output histograms"}; @@ -178,7 +180,6 @@ struct DileptonMC { Configurable cfg_min_phiv{"cfg_min_phiv", 0.0, "min phiv (constant)"}; Configurable cfg_max_phiv{"cfg_max_phiv", 3.2, "max phiv (constant)"}; Configurable cfg_apply_detadphi{"cfg_apply_detadphi", false, "flag to apply deta-dphi elliptic cut at PV"}; - Configurable cfg_apply_detadphiposition{"cfg_apply_detadphiposition", false, "flag to apply deta-dphi elliptic cut at certain radius"}; Configurable cfg_min_deta{"cfg_min_deta", 0.02, "min deta between 2 electrons (elliptic cut)"}; Configurable cfg_min_dphi{"cfg_min_dphi", 0.2, "min dphi between 2 electrons (elliptic cut)"}; Configurable cfg_min_opang{"cfg_min_opang", 0.0, "min opening angle"}; @@ -214,7 +215,6 @@ struct DileptonMC { Configurable cfg_max_its_cluster_size{"cfg_max_its_cluster_size", 16.f, "max ITS cluster size"}; Configurable cfg_min_rel_diff_pin{"cfg_min_rel_diff_pin", -1e+10, "min rel. diff. between pin and ppv"}; Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; - Configurable cfgRefR{"cfgRefR", 1.2, "reference R (in m) for extrapolation"}; // https://cds.cern.ch/record/1419204 Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif = 4, kPIDML = 5]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; @@ -310,7 +310,8 @@ struct DileptonMC { } mctrackcuts; HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; - static constexpr std::string_view event_cut_types[2] = {"before/", "after/"}; + // static constexpr std::string_view event_cut_types[2] = {"before/", "after/"}; + static constexpr std::string_view acc_types[2] = {"all/", "inAcc/"}; ~DileptonMC() {} @@ -371,33 +372,30 @@ struct DileptonMC { const AxisSpec axis_aco{cfg_nbin_aco, 0, 1.f, "#alpha = 1 - #frac{|#varphi_{l^{+}} - #varphi_{l^{-}}|}{#pi}"}; // for kUPC const AxisSpec axis_asym_pt{cfg_nbin_asym_pt, 0, 1.f, "A = #frac{|p_{T,l^{+}} - p_{T,l^{-}}|}{|p_{T,l^{+}} + p_{T,l^{-}}|}"}; // for kUPC const AxisSpec axis_dphi_e_ee{cfg_nbin_dphi_e_ee, 0, M_PI, "#Delta#varphi = #varphi_{l} - #varphi_{ll} (rad.)"}; // for kUPC - const AxisSpec axis_isInAcc{2, -0.5, 1.5, "is in acc"}; // in acc or not (bool) // generated info - fRegistry.add("Generated/sm/PromptPi0/hs", "generated dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_isInAcc}, true); - fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/NonPromptPi0/"); - fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/Eta/"); - fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/EtaPrime/"); - fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/Rho/"); - fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/Omega/"); - fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/Omega2ll/"); - fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/Phi/"); - fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/Phi2ll/"); - fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/PromptJPsi/"); - fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/NonPromptJPsi/"); - fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/PromptPsi2S/"); - fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/NonPromptPsi2S/"); - fRegistry.add("Generated/sm/Omega2ll/hPtY", "pT of #omega meson", kTH2D, {axis_y, axis_pt_meson}, true); - fRegistry.add("Generated/sm/Phi2ll/hPtY", "pT of #phi meson", kTH2D, {axis_y, axis_pt_meson}, true); - - fRegistry.add("Generated/ccbar/c2l_c2l/hadron_hadron/hs", "generated dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_isInAcc}, true); - fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", "Generated/ccbar/c2l_c2l/meson_meson/"); - fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", "Generated/ccbar/c2l_c2l/baryon_baryon/"); - fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", "Generated/ccbar/c2l_c2l/meson_baryon/"); - fRegistry.addClone("Generated/ccbar/c2l_c2l/", "Generated/bbbar/b2l_b2l/"); - fRegistry.addClone("Generated/ccbar/c2l_c2l/", "Generated/bbbar/b2c2l_b2c2l/"); - fRegistry.addClone("Generated/ccbar/c2l_c2l/", "Generated/bbbar/b2c2l_b2l_sameb/"); - fRegistry.addClone("Generated/ccbar/c2l_c2l/", "Generated/bbbar/b2c2l_b2l_diffb/"); // LS + fRegistry.add("Generated/inAcc/sm/PromptPi0/hs", "generated dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_aco, axis_asym_pt, axis_dphi_e_ee}, true); + fRegistry.addClone("Generated/inAcc/sm/PromptPi0/", "Generated/inAcc/sm/NonPromptPi0/"); + fRegistry.addClone("Generated/inAcc/sm/PromptPi0/", "Generated/inAcc/sm/Eta/"); + fRegistry.addClone("Generated/inAcc/sm/PromptPi0/", "Generated/inAcc/sm/EtaPrime/"); + fRegistry.addClone("Generated/inAcc/sm/PromptPi0/", "Generated/inAcc/sm/Rho/"); + fRegistry.addClone("Generated/inAcc/sm/PromptPi0/", "Generated/inAcc/sm/Omega/"); + fRegistry.addClone("Generated/inAcc/sm/PromptPi0/", "Generated/inAcc/sm/Omega2ll/"); + fRegistry.addClone("Generated/inAcc/sm/PromptPi0/", "Generated/inAcc/sm/Phi/"); + fRegistry.addClone("Generated/inAcc/sm/PromptPi0/", "Generated/inAcc/sm/Phi2ll/"); + fRegistry.addClone("Generated/inAcc/sm/PromptPi0/", "Generated/inAcc/sm/PromptJPsi/"); + fRegistry.addClone("Generated/inAcc/sm/PromptPi0/", "Generated/inAcc/sm/NonPromptJPsi/"); + fRegistry.addClone("Generated/inAcc/sm/PromptPi0/", "Generated/inAcc/sm/PromptPsi2S/"); + fRegistry.addClone("Generated/inAcc/sm/PromptPi0/", "Generated/inAcc/sm/NonPromptPsi2S/"); + + fRegistry.add("Generated/inAcc/ccbar/c2l_c2l/hadron_hadron/hs", "generated dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_aco, axis_asym_pt, axis_dphi_e_ee}, true); + fRegistry.addClone("Generated/inAcc/ccbar/c2l_c2l/hadron_hadron/", "Generated/inAcc/ccbar/c2l_c2l/meson_meson/"); + fRegistry.addClone("Generated/inAcc/ccbar/c2l_c2l/hadron_hadron/", "Generated/inAcc/ccbar/c2l_c2l/baryon_baryon/"); + fRegistry.addClone("Generated/inAcc/ccbar/c2l_c2l/hadron_hadron/", "Generated/inAcc/ccbar/c2l_c2l/meson_baryon/"); + fRegistry.addClone("Generated/inAcc/ccbar/c2l_c2l/", "Generated/inAcc/bbbar/b2l_b2l/"); + fRegistry.addClone("Generated/inAcc/ccbar/c2l_c2l/", "Generated/inAcc/bbbar/b2c2l_b2c2l/"); + fRegistry.addClone("Generated/inAcc/ccbar/c2l_c2l/", "Generated/inAcc/bbbar/b2c2l_b2l_sameb/"); + fRegistry.addClone("Generated/inAcc/ccbar/c2l_c2l/", "Generated/inAcc/bbbar/b2c2l_b2l_diffb/"); // LS // for charmed hadrons // create 28 combinations static constexpr std::string_view charmed_mesons[] = {"Dplus", "D0", "Dsplus"}; // 411, 421, 431 @@ -409,26 +407,37 @@ struct DileptonMC { static constexpr std::string_view sum_charmed_mesons[] = {"Dpm", "D0", "Dspm"}; static constexpr std::string_view sum_charmed_baryons[] = {"Lcpm", "Xicpm", "Xic0", "Omegac0"}; - for (int im = 0; im < nm; im++) { - fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", Form("Generated/ccbar/c2l_c2l/%s_%s/", charmed_mesons[im].data(), anti_charmed_mesons[im].data())); - } - for (int ib = 0; ib < nb; ib++) { - fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", Form("Generated/ccbar/c2l_c2l/%s_%s/", charmed_baryons[ib].data(), anti_charmed_baryons[ib].data())); - } - for (int im1 = 0; im1 < nm - 1; im1++) { - for (int im2 = im1 + 1; im2 < nm; im2++) { - fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", Form("Generated/ccbar/c2l_c2l/%s_%s/", sum_charmed_mesons[im1].data(), sum_charmed_mesons[im2].data())); - } - } - for (int ib1 = 0; ib1 < nb - 1; ib1++) { - for (int ib2 = ib1 + 1; ib2 < nb; ib2++) { - fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", Form("Generated/ccbar/c2l_c2l/%s_%s/", sum_charmed_baryons[ib1].data(), sum_charmed_baryons[ib2].data())); + if (cfgFillAllCharm) { + for (int im = 0; im < nm; im++) { + fRegistry.addClone("Generated/inAcc/ccbar/c2l_c2l/hadron_hadron/", Form("Generated/inAcc/ccbar/c2l_c2l/%s_%s/", charmed_mesons[im].data(), anti_charmed_mesons[im].data())); } - } - for (int im = 0; im < nm; im++) { for (int ib = 0; ib < nb; ib++) { - fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", Form("Generated/ccbar/c2l_c2l/%s_%s/", sum_charmed_mesons[im].data(), sum_charmed_baryons[ib].data())); + fRegistry.addClone("Generated/inAcc/ccbar/c2l_c2l/hadron_hadron/", Form("Generated/inAcc/ccbar/c2l_c2l/%s_%s/", charmed_baryons[ib].data(), anti_charmed_baryons[ib].data())); + } + for (int im1 = 0; im1 < nm - 1; im1++) { + for (int im2 = im1 + 1; im2 < nm; im2++) { + fRegistry.addClone("Generated/inAcc/ccbar/c2l_c2l/hadron_hadron/", Form("Generated/inAcc/ccbar/c2l_c2l/%s_%s/", sum_charmed_mesons[im1].data(), sum_charmed_mesons[im2].data())); + } } + for (int ib1 = 0; ib1 < nb - 1; ib1++) { + for (int ib2 = ib1 + 1; ib2 < nb; ib2++) { + fRegistry.addClone("Generated/inAcc/ccbar/c2l_c2l/hadron_hadron/", Form("Generated/inAcc/ccbar/c2l_c2l/%s_%s/", sum_charmed_baryons[ib1].data(), sum_charmed_baryons[ib2].data())); + } + } + for (int im = 0; im < nm; im++) { + for (int ib = 0; ib < nb; ib++) { + fRegistry.addClone("Generated/inAcc/ccbar/c2l_c2l/hadron_hadron/", Form("Generated/inAcc/ccbar/c2l_c2l/%s_%s/", sum_charmed_mesons[im].data(), sum_charmed_baryons[ib].data())); + } + } + } + + if (cfgFillAllGen) { + fRegistry.addClone("Generated/inAcc/", "Generated/all/"); + } + + if (doprocessGen_VM) { + fRegistry.add("Generated/all/sm/Omega2ll/hPtY", "pT of #omega meson", kTH2D, {axis_y, axis_pt_meson}, true); + fRegistry.add("Generated/all/sm/Phi2ll/hPtY", "pT of #phi meson", kTH2D, {axis_y, axis_pt_meson}, true); } // reconstructed pair info @@ -469,25 +478,27 @@ struct DileptonMC { fRegistry.addClone("Pair/ccbar/c2l_c2l/", "Pair/bbbar/b2c2l_b2l_sameb/"); fRegistry.addClone("Pair/ccbar/c2l_c2l/", "Pair/bbbar/b2c2l_b2l_diffb/"); // LS - for (int im = 0; im < nm; im++) { - fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", Form("Pair/ccbar/c2l_c2l/%s_%s/", charmed_mesons[im].data(), anti_charmed_mesons[im].data())); - } - for (int ib = 0; ib < nb; ib++) { - fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", Form("Pair/ccbar/c2l_c2l/%s_%s/", charmed_baryons[ib].data(), anti_charmed_baryons[ib].data())); - } - for (int im1 = 0; im1 < nm - 1; im1++) { - for (int im2 = im1 + 1; im2 < nm; im2++) { - fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", Form("Pair/ccbar/c2l_c2l/%s_%s/", sum_charmed_mesons[im1].data(), sum_charmed_mesons[im2].data())); - } - } - for (int ib1 = 0; ib1 < nb - 1; ib1++) { - for (int ib2 = ib1 + 1; ib2 < nb; ib2++) { - fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", Form("Pair/ccbar/c2l_c2l/%s_%s/", sum_charmed_baryons[ib1].data(), sum_charmed_baryons[ib2].data())); + if (cfgFillAllCharm) { + for (int im = 0; im < nm; im++) { + fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", Form("Pair/ccbar/c2l_c2l/%s_%s/", charmed_mesons[im].data(), anti_charmed_mesons[im].data())); } - } - for (int im = 0; im < nm; im++) { for (int ib = 0; ib < nb; ib++) { - fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", Form("Pair/ccbar/c2l_c2l/%s_%s/", sum_charmed_mesons[im].data(), sum_charmed_baryons[ib].data())); + fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", Form("Pair/ccbar/c2l_c2l/%s_%s/", charmed_baryons[ib].data(), anti_charmed_baryons[ib].data())); + } + for (int im1 = 0; im1 < nm - 1; im1++) { + for (int im2 = im1 + 1; im2 < nm; im2++) { + fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", Form("Pair/ccbar/c2l_c2l/%s_%s/", sum_charmed_mesons[im1].data(), sum_charmed_mesons[im2].data())); + } + } + for (int ib1 = 0; ib1 < nb - 1; ib1++) { + for (int ib2 = ib1 + 1; ib2 < nb; ib2++) { + fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", Form("Pair/ccbar/c2l_c2l/%s_%s/", sum_charmed_baryons[ib1].data(), sum_charmed_baryons[ib2].data())); + } + } + for (int im = 0; im < nm; im++) { + for (int ib = 0; ib < nb; ib++) { + fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", Form("Pair/ccbar/c2l_c2l/%s_%s/", sum_charmed_mesons[im].data(), sum_charmed_baryons[ib].data())); + } } } @@ -666,7 +677,7 @@ struct DileptonMC { fDielectronCut.SetPairDCARange(dielectroncuts.cfg_min_pair_dca3d, dielectroncuts.cfg_max_pair_dca3d); // in sigma fDielectronCut.SetMaxMeePhiVDep([&](float phiv) { return dielectroncuts.cfg_phiv_intercept + phiv * dielectroncuts.cfg_phiv_slope; }, dielectroncuts.cfg_min_phiv, dielectroncuts.cfg_max_phiv); fDielectronCut.ApplyPhiV(dielectroncuts.cfg_apply_phiv); - fDielectronCut.SetMindEtadPhi(dielectroncuts.cfg_apply_detadphi, dielectroncuts.cfg_apply_detadphiposition, dielectroncuts.cfg_min_deta, dielectroncuts.cfg_min_dphi); + fDielectronCut.SetMindEtadPhi(dielectroncuts.cfg_apply_detadphi, false, dielectroncuts.cfg_min_deta, dielectroncuts.cfg_min_dphi); fDielectronCut.SetPairOpAng(dielectroncuts.cfg_min_opang, dielectroncuts.cfg_max_opang); fDielectronCut.SetRequireDifferentSides(dielectroncuts.cfg_require_diff_sides); @@ -855,7 +866,7 @@ struct DileptonMC { return false; } } - if (!cut.IsSelectedPair(t1, t2, d_bz, dielectroncuts.cfgRefR)) { + if (!cut.IsSelectedPair(t1, t2, d_bz, 0.0)) { return false; } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { @@ -1123,68 +1134,74 @@ struct DileptonMC { fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if (isCharmMeson(mp1) && isCharmMeson(mp2)) { fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - if (std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 411) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dplus_Dminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if (std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 421) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_D0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if (std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 431) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dsplus_Dsminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 421) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 421)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_D0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 431)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 431)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + if (cfgFillAllCharm) { + if (std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 411) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dplus_Dminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if (std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 421) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_D0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if (std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 431) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dsplus_Dsminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 421) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 421)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_D0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 431)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 431)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } } } else if (isCharmBaryon(mp1) && isCharmBaryon(mp2)) { fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - if (std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4122) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcplus_Lcminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if (std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4232) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicplus_Xicminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if (std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4132) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xic0_Xic0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if (std::abs(mp1.pdgCode()) == 4332 && std::abs(mp2.pdgCode()) == 4332) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Omegac0_Omegac0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4132 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xic0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + if (cfgFillAllCharm) { + if (std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4122) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcplus_Lcminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if (std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4232) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicplus_Xicminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if (std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4132) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xic0_Xic0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if (std::abs(mp1.pdgCode()) == 4332 && std::abs(mp2.pdgCode()) == 4332) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Omegac0_Omegac0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4232)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4132)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4332)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4132)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4332)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4132 && std::abs(mp1.pdgCode()) == 4332)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xic0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } } } else { fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + if (cfgFillAllCharm) { + if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4122)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4232)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4132)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4332)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4122)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4232)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4132)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4332)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4122)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4232)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4132)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4332)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } } } break; @@ -1330,7 +1347,7 @@ struct DileptonMC { } // end of collision loop } - template + template void runGenInfo(TCollisions const& collisions, TMCCollisions const& mccollisions, TMCLeptons const& posTracksMC, TMCLeptons const& negTracksMC, TMCParticles const& mcparticles) { for (const auto& mccollision : mccollisions) { @@ -1457,54 +1474,57 @@ struct DileptonMC { } o2::math_utils::bringToPMPi(phiPol); - bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); + if constexpr (accType == 1) { + if (!isInAcceptance(t1) || !isInAcceptance(t2)) { + continue; + } + } if (mother_id > -1) { auto mcmother = mcparticles.iteratorAt(mother_id); if (mcmother.isPhysicalPrimary() || mcmother.producedByGenerator()) { - switch (std::abs(mcmother.pdgCode())) { case 111: if (IsFromCharm(mcmother, mcparticles) < 0 && IsFromBeauty(mcmother, mcparticles) < 0) { // prompt pi0 - fRegistry.fill(HIST("Generated/sm/PromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("sm/PromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else { // non-prompt pi0 - fRegistry.fill(HIST("Generated/sm/NonPromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("sm/NonPromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } break; case 221: - fRegistry.fill(HIST("Generated/sm/Eta/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("sm/Eta/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); break; case 331: - fRegistry.fill(HIST("Generated/sm/EtaPrime/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("sm/EtaPrime/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); break; case 113: - fRegistry.fill(HIST("Generated/sm/Rho/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("sm/Rho/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); break; case 223: - fRegistry.fill(HIST("Generated/sm/Omega/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("sm/Omega/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); if (mcmother.daughtersIds().size() == 2) { // omega->ee - fRegistry.fill(HIST("Generated/sm/Omega2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("sm/Omega2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } break; case 333: - fRegistry.fill(HIST("Generated/sm/Phi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("sm/Phi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); if (mcmother.daughtersIds().size() == 2) { // phi->ee - fRegistry.fill(HIST("Generated/sm/Phi2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("sm/Phi2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } break; case 443: { if (IsFromBeauty(mcmother, mcparticles) > 0) { - fRegistry.fill(HIST("Generated/sm/NonPromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("sm/NonPromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/sm/PromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("sm/PromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } break; } case 100443: { if (IsFromBeauty(mcmother, mcparticles) > 0) { - fRegistry.fill(HIST("Generated/sm/NonPromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("sm/NonPromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/sm/PromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("sm/PromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } break; } @@ -1517,105 +1537,111 @@ struct DileptonMC { auto mp2 = mcparticles.iteratorAt(t2.mothersIds()[0]); switch (hfee_type) { case static_cast(EM_HFeeType::kCe_Ce): { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); if (isCharmMeson(mp1) && isCharmMeson(mp2)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - if (std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 411) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dplus_Dminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - } else if (std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 421) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_D0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - } else if (std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 431) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dsplus_Dsminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 421) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 421)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_D0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 431)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 431)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + if (cfgFillAllCharm) { + if (std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 411) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Dplus_Dminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } else if (std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 421) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/D0_D0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } else if (std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 431) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Dsplus_Dsminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 421) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 421)) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Dpm_D0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 431)) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Dpm_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 431)) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/D0_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } } } else if (isCharmBaryon(mp1) && isCharmBaryon(mp2)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - if (std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4122) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcplus_Lcminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - } else if (std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4232) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicplus_Xicminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - } else if (std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4132) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xic0_Xic0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - } else if (std::abs(mp1.pdgCode()) == 4332 && std::abs(mp2.pdgCode()) == 4332) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Omegac0_Omegac0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - } else if ((std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4132 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xic0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + if (cfgFillAllCharm) { + if (std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4122) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Lcplus_Lcminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } else if (std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4232) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Xicplus_Xicminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } else if (std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4132) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Xic0_Xic0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } else if (std::abs(mp1.pdgCode()) == 4332 && std::abs(mp2.pdgCode()) == 4332) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Omegac0_Omegac0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4232)) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Lcpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4132)) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Lcpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4332)) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Lcpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4132)) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Xicpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4332)) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Xicpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } else if ((std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4132 && std::abs(mp1.pdgCode()) == 4332)) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Xic0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } } } else { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); - } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + if (cfgFillAllCharm) { + if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4122)) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Dpm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4232)) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Dpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4132)) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Dpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4332)) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Dpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4122)) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/D0_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4232)) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/D0_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4132)) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/D0_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4332)) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/D0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4122)) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Dspm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4232)) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Dspm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4132)) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Dspm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4332)) { + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Dspm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + } } } break; } case static_cast(EM_HFeeType::kBe_Be): { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2l_b2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); if (isBeautyMeson(mp1) && isBeautyMeson(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if (isBeautyBaryon(mp1) && isBeautyBaryon(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } break; } case static_cast(EM_HFeeType::kBCe_BCe): { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2c2l_b2c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); if (isCharmMeson(mp1) && isCharmMeson(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if (isCharmBaryon(mp1) && isCharmBaryon(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } break; } case static_cast(EM_HFeeType::kBCe_Be_SameB): { // ULS - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2c2l_b2l_sameb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2c2l_b2l_sameb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2c2l_b2l_sameb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2c2l_b2l_sameb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } break; } @@ -1709,16 +1735,6 @@ struct DileptonMC { // } } - // if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - // if (v12.Rapidity() < dielectroncuts.cfg_min_pair_y || dielectroncuts.cfg_max_pair_y < v12.Rapidity()) { - // continue; - // } - // } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - // if (v12.Rapidity() < dimuoncuts.cfg_min_pair_y || dimuoncuts.cfg_max_pair_y < v12.Rapidity()) { - // continue; - // } - // } - float aco = 1.f - std::fabs(dphi) / M_PI; float asym = std::fabs(v1.Pt() - v2.Pt()) / (v1.Pt() + v2.Pt()); float dphi_e_ee = v1.Phi() - v12.Phi(); @@ -1734,7 +1750,12 @@ struct DileptonMC { o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, -t1.pdgCode() / pdg_lepton, cos_thetaPol, phiPol); } o2::math_utils::bringToPMPi(phiPol); - bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); + + if constexpr (accType == 1) { + if (!isInAcceptance(t1) || !isInAcceptance(t2)) { + continue; + } + } if (hfee_type > -1) { auto mp1 = mcparticles.iteratorAt(t1.mothersIds()[0]); @@ -1753,13 +1774,13 @@ struct DileptonMC { LOGF(info, "You should not see kBCe_Be_SameB in LS++. Good luck."); break; case static_cast(EM_HFeeType::kBCe_Be_DiffB): { // LS - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } break; } @@ -1850,16 +1871,6 @@ struct DileptonMC { // } } - // if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - // if (v12.Rapidity() < dielectroncuts.cfg_min_pair_y || dielectroncuts.cfg_max_pair_y < v12.Rapidity()) { - // continue; - // } - // } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - // if (v12.Rapidity() < dimuoncuts.cfg_min_pair_y || dimuoncuts.cfg_max_pair_y < v12.Rapidity()) { - // continue; - // } - // } - float aco = 1.f - std::fabs(dphi) / M_PI; float asym = std::fabs(v1.Pt() - v2.Pt()) / (v1.Pt() + v2.Pt()); float dphi_e_ee = v1.Phi() - v12.Phi(); @@ -1875,7 +1886,12 @@ struct DileptonMC { o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, -t1.pdgCode() / pdg_lepton, cos_thetaPol, phiPol); } o2::math_utils::bringToPMPi(phiPol); - bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); + + if constexpr (accType == 1) { + if (!isInAcceptance(t1) || !isInAcceptance(t2)) { + continue; + } + } if (hfee_type > -1) { auto mp1 = mcparticles.iteratorAt(t1.mothersIds()[0]); @@ -1894,13 +1910,13 @@ struct DileptonMC { LOGF(info, "You should not see kBCe_Be_SameB in LS--. Good luck."); break; case static_cast(EM_HFeeType::kBCe_Be_DiffB): { // LS - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } break; } @@ -1938,7 +1954,7 @@ struct DileptonMC { } if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - if (!cut.template IsSelectedPair(t1, t2, d_bz, dielectroncuts.cfgRefR)) { + if (!cut.template IsSelectedPair(t1, t2, d_bz, 0.0)) { return false; } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { @@ -2426,7 +2442,10 @@ struct DileptonMC { fillPairWeightMap(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut, leptons, mccollisions, mcparticles); } runTruePairing(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut, leptons, mccollisions, mcparticles); - runGenInfo(collisions, mccollisions, positive_electronsMC, negative_electronsMC, mcparticles); + runGenInfo(collisions, mccollisions, positive_electronsMC, negative_electronsMC, mcparticles); + if (cfgFillAllGen) { + runGenInfo(collisions, mccollisions, positive_electronsMC, negative_electronsMC, mcparticles); // always false + } if (cfgFillUnfolding) { fillUnfolding(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut, leptons, mccollisions, mcparticles); } @@ -2435,7 +2454,10 @@ struct DileptonMC { fillPairWeightMap(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut, leptons, mccollisions, mcparticles); } runTruePairing(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut, leptons, mccollisions, mcparticles); - runGenInfo(collisions, mccollisions, positive_muonsMC, negative_muonsMC, mcparticles); + runGenInfo(collisions, mccollisions, positive_muonsMC, negative_muonsMC, mcparticles); + if (cfgFillAllGen) { + runGenInfo(collisions, mccollisions, positive_electronsMC, negative_electronsMC, mcparticles); // always false + } if (cfgFillUnfolding) { fillUnfolding(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut, leptons, mccollisions, mcparticles); } @@ -2457,7 +2479,10 @@ struct DileptonMC { fillPairWeightMap(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut, leptons, mccollisions, mcparticles_smeared); } runTruePairing(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut, leptons, mccollisions, mcparticles_smeared); - runGenInfo(collisions, mccollisions, positive_electronsMC_smeared, negative_electronsMC_smeared, mcparticles_smeared); + runGenInfo(collisions, mccollisions, positive_electronsMC_smeared, negative_electronsMC_smeared, mcparticles_smeared); + if (cfgFillAllGen) { + runGenInfo(collisions, mccollisions, positive_electronsMC_smeared, negative_electronsMC_smeared, mcparticles_smeared); // always false + } if (cfgFillUnfolding) { fillUnfolding(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut, leptons, mccollisions, mcparticles_smeared); } @@ -2466,7 +2491,10 @@ struct DileptonMC { fillPairWeightMap(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut, leptons, mccollisions, mcparticles_smeared); } runTruePairing(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut, leptons, mccollisions, mcparticles_smeared); - runGenInfo(collisions, mccollisions, positive_muonsMC_smeared, negative_muonsMC_smeared, mcparticles_smeared); + runGenInfo(collisions, mccollisions, positive_muonsMC_smeared, negative_muonsMC_smeared, mcparticles_smeared); + if (cfgFillAllGen) { + runGenInfo(collisions, mccollisions, positive_electronsMC_smeared, negative_electronsMC_smeared, mcparticles_smeared); // always false + } if (cfgFillUnfolding) { fillUnfolding(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut, leptons, mccollisions, mcparticles_smeared); } @@ -2514,10 +2542,10 @@ struct DileptonMC { switch (std::abs(mctrack.pdgCode())) { case 223: - fRegistry.fill(HIST("Generated/sm/Omega2ll/hPtY"), mctrack.y(), mctrack.pt(), 1.f / mctrack.dsf()); + fRegistry.fill(HIST("Generated/all/sm/Omega2ll/hPtY"), mctrack.y(), mctrack.pt(), 1.f / mctrack.dsf()); break; case 333: - fRegistry.fill(HIST("Generated/sm/Phi2ll/hPtY"), mctrack.y(), mctrack.pt(), 1.f / mctrack.dsf()); + fRegistry.fill(HIST("Generated/all/sm/Phi2ll/hPtY"), mctrack.y(), mctrack.pt(), 1.f / mctrack.dsf()); break; default: break; diff --git a/PWGEM/Dilepton/Core/PhotonHBT.h b/PWGEM/Dilepton/Core/PhotonHBT.h index 9948eac03a2..39938df8f0d 100644 --- a/PWGEM/Dilepton/Core/PhotonHBT.h +++ b/PWGEM/Dilepton/Core/PhotonHBT.h @@ -212,7 +212,6 @@ struct PhotonHBT { Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; Configurable cfg_require_itsib_any{"cfg_require_itsib_any", false, "flag to require ITS ib any hits"}; Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", true, "flag to require ITS ib 1st hit"}; - Configurable cfgRefR{"cfgRefR", 1.2, "reference R (in m) for extrapolation"}; // https://cds.cern.ch/record/1419204 Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif = 4, kPIDML = 5]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; @@ -866,7 +865,7 @@ struct PhotonHBT { continue; } } - if (!cut1.IsSelectedPair(pos1, ele1, d_bz, dielectroncuts.cfgRefR)) { + if (!cut1.IsSelectedPair(pos1, ele1, d_bz, 0.0)) { continue; } @@ -894,7 +893,7 @@ struct PhotonHBT { continue; } } - if (!cut2.IsSelectedPair(pos2, ele2, d_bz, dielectroncuts.cfgRefR)) { + if (!cut2.IsSelectedPair(pos2, ele2, d_bz, 0.0)) { continue; } @@ -1012,7 +1011,7 @@ struct PhotonHBT { continue; } } - if (!cut2.IsSelectedPair(pos2, ele2, d_bz, dielectroncuts.cfgRefR)) { + if (!cut2.IsSelectedPair(pos2, ele2, d_bz, 0.0)) { continue; } @@ -1380,7 +1379,7 @@ struct PhotonHBT { continue; } } - if (!cut.IsSelectedPair(pos, ele, d_bz, dielectroncuts.cfgRefR)) { + if (!cut.IsSelectedPair(pos, ele, d_bz, 0.0)) { continue; } passed_pairIds.emplace_back(std::make_pair(pos.globalIndex(), ele.globalIndex())); From 4b691a2df4db8421cb6855c5c1f992dd4d482aa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Thu, 18 Sep 2025 07:27:59 +0200 Subject: [PATCH 433/986] [ALICE3] Linter fixes (#13017) --- ALICE3/Core/DelphesO2TrackSmearer.cxx | 158 +++++++++++++++----------- 1 file changed, 93 insertions(+), 65 deletions(-) diff --git a/ALICE3/Core/DelphesO2TrackSmearer.cxx b/ALICE3/Core/DelphesO2TrackSmearer.cxx index 2c6b23e8e83..af72d0cf8b0 100644 --- a/ALICE3/Core/DelphesO2TrackSmearer.cxx +++ b/ALICE3/Core/DelphesO2TrackSmearer.cxx @@ -10,14 +10,14 @@ // or submit itself to any jurisdiction. /// -/// @file DelphesO2TrackSmearer.cxx -/// @brief Porting to O2Physics of DelphesO2 code. +/// \file DelphesO2TrackSmearer.cxx +/// \author Roberto Preghenella +/// \brief Porting to O2Physics of DelphesO2 code. /// Minimal changes have been made to the original code for adaptation purposes, formatting and commented parts have been considered. /// Relevant sources: /// DelphesO2/src/lutCovm.hh https://github.com/AliceO2Group/DelphesO2/blob/master/src/lutCovm.hh /// DelphesO2/src/TrackSmearer.cc https://github.com/AliceO2Group/DelphesO2/blob/master/src/TrackSmearer.cc /// DelphesO2/src/TrackSmearer.hh https://github.com/AliceO2Group/DelphesO2/blob/master/src/TrackSmearer.hh -/// @author: Roberto Preghenella /// @email: preghenella@bo.infn.it /// @@ -36,8 +36,12 @@ #include "ALICE3/Core/DelphesO2TrackSmearer.h" +#include #include +#include +#include + namespace o2 { namespace delphes @@ -54,7 +58,7 @@ bool TrackSmearer::loadTable(int pdg, const char* filename, bool forceReload) const auto ipdg = getIndexPDG(pdg); LOGF(info, "Will load %s lut file ..: '%s'", getParticleName(pdg), filename); if (mLUTHeader[ipdg] && !forceReload) { - std::cout << " --- LUT table for PDG " << pdg << " has been already loaded with index " << ipdg << std::endl; + LOG(info) << " --- LUT table for PDG " << pdg << " has been already loaded with index " << ipdg << std::endl; return false; } if (strncmp(filename, "ccdb:", 5) == 0) { // Check if filename starts with "ccdb:" @@ -83,26 +87,26 @@ bool TrackSmearer::loadTable(int pdg, const char* filename, bool forceReload) std::ifstream lutFile(filename, std::ifstream::binary); if (!lutFile.is_open()) { - std::cout << " --- cannot open covariance matrix file for PDG " << pdg << ": " << filename << std::endl; + LOG(info) << " --- cannot open covariance matrix file for PDG " << pdg << ": " << filename << std::endl; delete mLUTHeader[ipdg]; mLUTHeader[ipdg] = nullptr; return false; } lutFile.read(reinterpret_cast(mLUTHeader[ipdg]), sizeof(lutHeader_t)); if (lutFile.gcount() != sizeof(lutHeader_t)) { - std::cout << " --- troubles reading covariance matrix header for PDG " << pdg << ": " << filename << std::endl; + LOG(info) << " --- troubles reading covariance matrix header for PDG " << pdg << ": " << filename << std::endl; delete mLUTHeader[ipdg]; mLUTHeader[ipdg] = nullptr; return false; } if (mLUTHeader[ipdg]->version != LUTCOVM_VERSION) { - std::cout << " --- LUT header version mismatch: expected/detected = " << LUTCOVM_VERSION << "/" << mLUTHeader[ipdg]->version << std::endl; + LOG(info) << " --- LUT header version mismatch: expected/detected = " << LUTCOVM_VERSION << "/" << mLUTHeader[ipdg]->version << std::endl; delete mLUTHeader[ipdg]; mLUTHeader[ipdg] = nullptr; return false; } if (mLUTHeader[ipdg]->pdg != pdg) { - std::cout << " --- LUT header PDG mismatch: expected/detected = " << pdg << "/" << mLUTHeader[ipdg]->pdg << std::endl; + LOG(info) << " --- LUT header PDG mismatch: expected/detected = " << pdg << "/" << mLUTHeader[ipdg]->pdg << std::endl; delete mLUTHeader[ipdg]; mLUTHeader[ipdg] = nullptr; return false; @@ -122,14 +126,14 @@ bool TrackSmearer::loadTable(int pdg, const char* filename, bool forceReload) mLUTEntry[ipdg][inch][irad][ieta][ipt] = new lutEntry_t; lutFile.read(reinterpret_cast(mLUTEntry[ipdg][inch][irad][ieta][ipt]), sizeof(lutEntry_t)); if (lutFile.gcount() != sizeof(lutEntry_t)) { - std::cout << " --- troubles reading covariance matrix entry for PDG " << pdg << ": " << filename << std::endl; + LOG(info) << " --- troubles reading covariance matrix entry for PDG " << pdg << ": " << filename << std::endl; return false; } } } } } - std::cout << " --- read covariance matrix table for PDG " << pdg << ": " << filename << std::endl; + LOG(info) << " --- read covariance matrix table for PDG " << pdg << ": " << filename << std::endl; mLUTHeader[ipdg]->print(); lutFile.close(); @@ -152,43 +156,58 @@ lutEntry_t* // Interpolate if requested auto fraction = mLUTHeader[ipdg]->nchmap.fracPositionWithinBin(nch); if (mInterpolateEfficiency) { - if (fraction > 0.5) { - if (mWhatEfficiency == 1) { - if (inch < mLUTHeader[ipdg]->nchmap.nbins - 1) { - interpolatedEff = (1.5f - fraction) * mLUTEntry[ipdg][inch][irad][ieta][ipt]->eff + (-0.5f + fraction) * mLUTEntry[ipdg][inch + 1][irad][ieta][ipt]->eff; - } else { - interpolatedEff = mLUTEntry[ipdg][inch][irad][ieta][ipt]->eff; - } - } - if (mWhatEfficiency == 2) { - if (inch < mLUTHeader[ipdg]->nchmap.nbins - 1) { - interpolatedEff = (1.5f - fraction) * mLUTEntry[ipdg][inch][irad][ieta][ipt]->eff2 + (-0.5f + fraction) * mLUTEntry[ipdg][inch + 1][irad][ieta][ipt]->eff2; - } else { - interpolatedEff = mLUTEntry[ipdg][inch][irad][ieta][ipt]->eff2; - } + static constexpr float kFractionThreshold = 0.5f; + if (fraction > kFractionThreshold) { + switch (mWhatEfficiency) { + case 1: + if (inch < mLUTHeader[ipdg]->nchmap.nbins - 1) { + interpolatedEff = (1.5f - fraction) * mLUTEntry[ipdg][inch][irad][ieta][ipt]->eff + (-0.5f + fraction) * mLUTEntry[ipdg][inch + 1][irad][ieta][ipt]->eff; + } else { + interpolatedEff = mLUTEntry[ipdg][inch][irad][ieta][ipt]->eff; + } + break; + case 2: + if (inch < mLUTHeader[ipdg]->nchmap.nbins - 1) { + interpolatedEff = (1.5f - fraction) * mLUTEntry[ipdg][inch][irad][ieta][ipt]->eff2 + (-0.5f + fraction) * mLUTEntry[ipdg][inch + 1][irad][ieta][ipt]->eff2; + } else { + interpolatedEff = mLUTEntry[ipdg][inch][irad][ieta][ipt]->eff2; + } + break; + default: + LOG(fatal) << " --- getLUTEntry: unknown efficiency type " << mWhatEfficiency; } } else { - float comparisonValue = mLUTHeader[ipdg]->nchmap.log ? log10(nch) : nch; - if (mWhatEfficiency == 1) { - if (inch > 0 && comparisonValue < mLUTHeader[ipdg]->nchmap.max) { - interpolatedEff = (0.5f + fraction) * mLUTEntry[ipdg][inch][irad][ieta][ipt]->eff + (0.5f - fraction) * mLUTEntry[ipdg][inch - 1][irad][ieta][ipt]->eff; - } else { - interpolatedEff = mLUTEntry[ipdg][inch][irad][ieta][ipt]->eff; - } - } - if (mWhatEfficiency == 2) { - if (inch > 0 && comparisonValue < mLUTHeader[ipdg]->nchmap.max) { - interpolatedEff = (0.5f + fraction) * mLUTEntry[ipdg][inch][irad][ieta][ipt]->eff2 + (0.5f - fraction) * mLUTEntry[ipdg][inch - 1][irad][ieta][ipt]->eff2; - } else { - interpolatedEff = mLUTEntry[ipdg][inch][irad][ieta][ipt]->eff2; - } + float comparisonValue = mLUTHeader[ipdg]->nchmap.log ? std::log10(nch) : nch; + switch (mWhatEfficiency) { + case 1: + if (inch > 0 && comparisonValue < mLUTHeader[ipdg]->nchmap.max) { + interpolatedEff = (0.5f + fraction) * mLUTEntry[ipdg][inch][irad][ieta][ipt]->eff + (0.5f - fraction) * mLUTEntry[ipdg][inch - 1][irad][ieta][ipt]->eff; + } else { + interpolatedEff = mLUTEntry[ipdg][inch][irad][ieta][ipt]->eff; + } + break; + case 2: + if (inch > 0 && comparisonValue < mLUTHeader[ipdg]->nchmap.max) { + interpolatedEff = (0.5f + fraction) * mLUTEntry[ipdg][inch][irad][ieta][ipt]->eff2 + (0.5f - fraction) * mLUTEntry[ipdg][inch - 1][irad][ieta][ipt]->eff2; + } else { + interpolatedEff = mLUTEntry[ipdg][inch][irad][ieta][ipt]->eff2; + } + break; + default: + LOG(fatal) << " --- getLUTEntry: unknown efficiency type " << mWhatEfficiency; } } } else { - if (mWhatEfficiency == 1) - interpolatedEff = mLUTEntry[ipdg][inch][irad][ieta][ipt]->eff; - if (mWhatEfficiency == 2) - interpolatedEff = mLUTEntry[ipdg][inch][irad][ieta][ipt]->eff2; + switch (mWhatEfficiency) { + case 1: + interpolatedEff = mLUTEntry[ipdg][inch][irad][ieta][ipt]->eff; + break; + case 2: + interpolatedEff = mLUTEntry[ipdg][inch][irad][ieta][ipt]->eff2; + break; + default: + LOG(fatal) << " --- getLUTEntry: unknown efficiency type " << mWhatEfficiency; + } } return mLUTEntry[ipdg][inch][irad][ieta][ipt]; } //; @@ -201,10 +220,14 @@ bool TrackSmearer::smearTrack(O2Track& o2track, lutEntry_t* lutEntry, float inte // generate efficiency if (mUseEfficiency) { auto eff = 0.; - if (mWhatEfficiency == 1) - eff = lutEntry->eff; - if (mWhatEfficiency == 2) - eff = lutEntry->eff2; + switch (mWhatEfficiency) { + case 1: + eff = lutEntry->eff; + break; + case 2: + eff = lutEntry->eff2; + break; + } if (mInterpolateEfficiency) eff = interpolatedEff; if (gRandom->Uniform() > eff) @@ -216,26 +239,28 @@ bool TrackSmearer::smearTrack(O2Track& o2track, lutEntry_t* lutEntry, float inte return false; // transform params vector and smear - double params_[5]; - for (int i = 0; i < 5; ++i) { + static constexpr int kParSize = 5; + double params[kParSize]; + for (int i = 0; i < kParSize; ++i) { double val = 0.; - for (int j = 0; j < 5; ++j) + for (int j = 0; j < kParSize; ++j) val += lutEntry->eigvec[j][i] * o2track.getParam(j); - params_[i] = gRandom->Gaus(val, sqrt(lutEntry->eigval[i])); + params[i] = gRandom->Gaus(val, std::sqrt(lutEntry->eigval[i])); } // transform back params vector - for (int i = 0; i < 5; ++i) { + for (int i = 0; i < kParSize; ++i) { double val = 0.; - for (int j = 0; j < 5; ++j) - val += lutEntry->eiginv[j][i] * params_[j]; + for (int j = 0; j < kParSize; ++j) + val += lutEntry->eiginv[j][i] * params[j]; o2track.setParam(val, i); } // should make a sanity check that par[2] sin(phi) is in [-1, 1] - if (fabs(o2track.getParam(2)) > 1.) { - std::cout << " --- smearTrack failed sin(phi) sanity check: " << o2track.getParam(2) << std::endl; + if (std::fabs(o2track.getParam(2)) > 1.) { + LOG(info) << " --- smearTrack failed sin(phi) sanity check: " << o2track.getParam(2) << std::endl; } // set covariance matrix - for (int i = 0; i < 15; ++i) + static constexpr int kCovMatSize = 15; + for (int i = 0; i < kCovMatSize; ++i) o2track.setCov(lutEntry->covm[i], i); return isReconstructed; } @@ -246,8 +271,11 @@ bool TrackSmearer::smearTrack(O2Track& o2track, int pdg, float nch) { auto pt = o2track.getPt(); - if (abs(pdg) == 1000020030) { - pt *= 2.f; + switch (pdg) { + case o2::constants::physics::kHelium3: + case -o2::constants::physics::kHelium3: + pt *= 2.f; + break; } auto eta = o2track.getEta(); float interpolatedEff = 0.0f; @@ -263,7 +291,7 @@ double TrackSmearer::getPtRes(int pdg, float nch, float eta, float pt) { float dummy = 0.0f; auto lutEntry = getLUTEntry(pdg, nch, 0., eta, pt, dummy); - auto val = sqrt(lutEntry->covm[14]) * lutEntry->pt; + auto val = std::sqrt(lutEntry->covm[14]) * lutEntry->pt; return val; } @@ -273,9 +301,9 @@ double TrackSmearer::getEtaRes(int pdg, float nch, float eta, float pt) { float dummy = 0.0f; auto lutEntry = getLUTEntry(pdg, nch, 0., eta, pt, dummy); - auto sigmatgl = sqrt(lutEntry->covm[9]); // sigmatgl2 - auto etaRes = fabs(sin(2.0 * atan(exp(-eta)))) * sigmatgl; // propagate tgl to eta uncertainty - etaRes /= lutEntry->eta; // relative uncertainty + auto sigmatgl = std::sqrt(lutEntry->covm[9]); // sigmatgl2 + auto etaRes = std::fabs(std::sin(2.0 * std::atan(std::exp(-eta)))) * sigmatgl; // propagate tgl to eta uncertainty + etaRes /= lutEntry->eta; // relative uncertainty return etaRes; } /*****************************************************************/ @@ -284,7 +312,7 @@ double TrackSmearer::getAbsPtRes(int pdg, float nch, float eta, float pt) { float dummy = 0.0f; auto lutEntry = getLUTEntry(pdg, nch, 0., eta, pt, dummy); - auto val = sqrt(lutEntry->covm[14]) * pow(lutEntry->pt, 2); + auto val = std::sqrt(lutEntry->covm[14]) * lutEntry->pt * lutEntry->pt; return val; } @@ -294,8 +322,8 @@ double TrackSmearer::getAbsEtaRes(int pdg, float nch, float eta, float pt) { float dummy = 0.0f; auto lutEntry = getLUTEntry(pdg, nch, 0., eta, pt, dummy); - auto sigmatgl = sqrt(lutEntry->covm[9]); // sigmatgl2 - auto etaRes = fabs(sin(2.0 * atan(exp(-eta)))) * sigmatgl; // propagate tgl to eta uncertainty + auto sigmatgl = std::sqrt(lutEntry->covm[9]); // sigmatgl2 + auto etaRes = std::fabs(std::sin(2.0 * std::atan(std::exp(-eta)))) * sigmatgl; // propagate tgl to eta uncertainty return etaRes; } /*****************************************************************/ From 7350a70c3754b33d08806017e4a9c8f0a4b5e5fa Mon Sep 17 00:00:00 2001 From: omvazque Date: Thu, 18 Sep 2025 00:44:48 -0500 Subject: [PATCH 434/986] [PWGLF] Separate methods for Eta and Eta Plateau Cal. (#13019) --- PWGLF/Tasks/Nuspex/piKpRAA.cxx | 105 ++++++++++++++++++++------------- 1 file changed, 64 insertions(+), 41 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/piKpRAA.cxx b/PWGLF/Tasks/Nuspex/piKpRAA.cxx index c64467b7c6d..98b11a39bf7 100644 --- a/PWGLF/Tasks/Nuspex/piKpRAA.cxx +++ b/PWGLF/Tasks/Nuspex/piKpRAA.cxx @@ -165,6 +165,7 @@ struct PiKpRAA { // Phi cut Configurable applyPhiCut{"applyPhiCut", false, "Apply geometrical cut?"}; Configurable applyEtaCal{"applyEtaCal", false, "Apply eta calibration?"}; + Configurable applyPlateauSel{"applyPlateauSel", false, "Apply eta calibration?"}; Configurable usePinPhiSelection{"usePinPhiSelection", true, "Uses Phi selection as a function of P or Pt?"}; Configurable applyNclSel{"applyNclSel", false, "Apply Min. found Ncl in TPC?"}; } v0Selections; @@ -262,7 +263,8 @@ struct PiKpRAA { struct ConfigEtaCalib { TProfile* pEtaCal = nullptr; TProfile* pEtaCalPlateau = nullptr; - bool isCalLoaded = false; + bool isMIPCalLoaded = false; + bool isCalPlateauLoaded = false; } etaCal; TrackSelection trkSelDaugthers; @@ -387,6 +389,8 @@ struct PiKpRAA { registry.add("dEdxVsEtaElMIPV0", "e^{+} + e^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; dE/dx", kTH2F, {{{axisEta}, {100, 0, 100}}}); registry.add("dEdxVsEtaElMIPV0p", "e^{+} + e^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; #LTdE/dx#GT", kTProfile, {axisEta}); + registry.add("pTVsCent", "", kTH2F, {axisPt, axisCent}); + for (int i = 0; i < kNEtaHists; ++i) { dEdx[i] = registry.add(Form("dEdx_%s", endingEta[i]), Form("%s;Momentum (GeV/#it{c});dE/dx;", latexEta[i]), kTH3F, {axisPt, axisdEdx, axisCent}); pTVsP[i] = registry.add(Form("pTVsP_%s", endingEta[i]), Form("%s;Momentum (GeV/#it{c});#it{p}_{T} (GeV/#it{c});", latexEta[i]), kTH2F, {axisPt, axisPt}); @@ -450,10 +454,15 @@ struct PiKpRAA { if (v0Selections.applyEtaCal) { LOG(info) << "\tLoading Eta Cal!"; LOG(info) << "\tpathEtaCal=" << pathEtaCal.value; - LOG(info) << "\tpathEtaCalPlateau=" << pathEtaCalPlateau.value; loadEtaCalibration(); } + if (v0Selections.applyPlateauSel) { + LOG(info) << "\tLoading Eta Plateau Cal!"; + LOG(info) << "\tpathEtaCalPlateau=" << pathEtaCalPlateau.value; + loadEtaPlateauCalibration(); + } + if (v0Selections.applyNclSel) LOG(info) << "\t minNcl=" << v0Selections.minNcl; } @@ -573,7 +582,7 @@ struct PiKpRAA { continue; } - if (v0Selections.applyEtaCal) { + if (v0Selections.applyEtaCal && etaCal.isMIPCalLoaded) { const double dedxCal{etaCal.pEtaCal->GetBinContent(etaCal.pEtaCal->FindBin(eta))}; if (dedxCal > kMindEdxMIP && dedxCal < kMaxdEdxMIP) dedx *= (50.0 / dedxCal); @@ -618,6 +627,7 @@ struct PiKpRAA { pTVsP[indexEta]->Fill(momentum, pt); nClVsP[indexEta]->Fill(pOrPt, ncl); nClVsPp[indexEta]->Fill(pOrPt, ncl); + registry.fill(HIST("pTVsCent"), pt, centrality); registry.fill(HIST("dcaVsPt"), pt, track.dcaXY()); registry.fill(HIST("EtaVsPhi"), eta, track.phi()); registry.fill(HIST("NclVsEta"), eta, nclFound); @@ -697,7 +707,7 @@ struct PiKpRAA { if (v0Selections.applyNclSel && !(posNcl >= v0Selections.minNcl && negNcl >= v0Selections.minNcl)) continue; - if (v0Selections.applyEtaCal) { + if (v0Selections.applyEtaCal && etaCal.isMIPCalLoaded) { const double dedxCal{etaCal.pEtaCal->GetBinContent(etaCal.pEtaCal->FindBin(posTrkEta))}; if (dedxCal > kMindEdxMIP && dedxCal < kMaxdEdxMIP) posTrkdEdx *= (50.0 / dedxCal); @@ -705,7 +715,7 @@ struct PiKpRAA { continue; } - if (v0Selections.applyEtaCal) { + if (v0Selections.applyEtaCal && etaCal.isMIPCalLoaded) { const double dedxCal{etaCal.pEtaCal->GetBinContent(etaCal.pEtaCal->FindBin(negTrkEta))}; if (dedxCal > kMindEdxMIP && dedxCal < kMaxdEdxMIP) negTrkdEdx *= (50.0 / dedxCal); @@ -849,37 +859,41 @@ struct PiKpRAA { if (v0Selections.applyInvMassSel && dMassK0s > v0Selections.dMassSel && dMassL > v0Selections.dMassSel && dMassAL > v0Selections.dMassSel && dMassG < v0Selections.dMassSel) { if (passesGammaSelection(collision, v0)) { if (std::abs(alpha) < v0Selections.armAlphaSel && qT < v0Selections.qTSel) { - const double posDedxCal{etaCal.pEtaCalPlateau->GetBinContent(etaCal.pEtaCalPlateau->FindBin(posTrkEta))}; - const double negDedxCal{etaCal.pEtaCalPlateau->GetBinContent(etaCal.pEtaCalPlateau->FindBin(negTrkEta))}; - if (std::abs(posTrkdEdx - posDedxCal) < v0Selections.dEdxPlateauSel && std::abs(negTrkdEdx - negDedxCal) < v0Selections.dEdxPlateauSel) { - registry.fill(HIST("V0sCounter"), V0sCounter::Gamma); - registry.fill(HIST("ArmG"), alpha, qT); - registry.fill(HIST("MassGVsPt"), v0.pt(), v0.mGamma()); - registry.fill(HIST("nSigElFromG"), negTrkPt, negTrack.tpcNSigmaEl()); - registry.fill(HIST("nSigElFromG"), posTrkPt, posTrack.tpcNSigmaEl()); - registry.fill(HIST("NclVsEtaElV0"), posTrkEta, posNcl); - registry.fill(HIST("NclVsEtaElV0p"), posTrkEta, posNcl); - registry.fill(HIST("NclVsEtaElV0"), negTrkEta, negNcl); - registry.fill(HIST("NclVsEtaElV0p"), negTrkEta, negNcl); - nClVsPElV0[negIndexEta]->Fill(negPorPt, negNcl); - nClVsPpElV0[negIndexEta]->Fill(negPorPt, negNcl); - nClVsPElV0[posIndexEta]->Fill(posPorPt, posNcl); - nClVsPpElV0[posIndexEta]->Fill(posPorPt, posNcl); - nClVsdEdxElV0[negIndexEta]->Fill(negNcl, negTrkdEdx); - nClVsdEdxpElV0[negIndexEta]->Fill(negNcl, negTrkdEdx); - nClVsdEdxElV0[posIndexEta]->Fill(posNcl, posTrkdEdx); - nClVsdEdxpElV0[posIndexEta]->Fill(posNcl, posTrkdEdx); - if (posTrkP > kMinPMIP && posTrkP < kMaxPMIP) { - registry.fill(HIST("dEdxVsEtaElMIPV0"), posTrkEta, posTrkdEdx); - registry.fill(HIST("dEdxVsEtaElMIPV0p"), posTrkEta, posTrkdEdx); - } - if (negTrkP > kMinPMIP && negTrkP < kMaxPMIP) { - registry.fill(HIST("dEdxVsEtaElMIPV0"), negTrkEta, negTrkdEdx); - registry.fill(HIST("dEdxVsEtaElMIPV0p"), negTrkEta, negTrkdEdx); - } - dEdxElV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); - dEdxElV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); + + if (v0Selections.applyPlateauSel && etaCal.isCalPlateauLoaded) { + const double posDedxCal{etaCal.pEtaCalPlateau->GetBinContent(etaCal.pEtaCalPlateau->FindBin(posTrkEta))}; + const double negDedxCal{etaCal.pEtaCalPlateau->GetBinContent(etaCal.pEtaCalPlateau->FindBin(negTrkEta))}; + if (!(std::abs(posTrkdEdx - posDedxCal) < v0Selections.dEdxPlateauSel && std::abs(negTrkdEdx - negDedxCal) < v0Selections.dEdxPlateauSel)) + continue; + } + + registry.fill(HIST("V0sCounter"), V0sCounter::Gamma); + registry.fill(HIST("ArmG"), alpha, qT); + registry.fill(HIST("MassGVsPt"), v0.pt(), v0.mGamma()); + registry.fill(HIST("nSigElFromG"), negTrkPt, negTrack.tpcNSigmaEl()); + registry.fill(HIST("nSigElFromG"), posTrkPt, posTrack.tpcNSigmaEl()); + registry.fill(HIST("NclVsEtaElV0"), posTrkEta, posNcl); + registry.fill(HIST("NclVsEtaElV0p"), posTrkEta, posNcl); + registry.fill(HIST("NclVsEtaElV0"), negTrkEta, negNcl); + registry.fill(HIST("NclVsEtaElV0p"), negTrkEta, negNcl); + nClVsPElV0[negIndexEta]->Fill(negPorPt, negNcl); + nClVsPpElV0[negIndexEta]->Fill(negPorPt, negNcl); + nClVsPElV0[posIndexEta]->Fill(posPorPt, posNcl); + nClVsPpElV0[posIndexEta]->Fill(posPorPt, posNcl); + nClVsdEdxElV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + nClVsdEdxpElV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + nClVsdEdxElV0[posIndexEta]->Fill(posNcl, posTrkdEdx); + nClVsdEdxpElV0[posIndexEta]->Fill(posNcl, posTrkdEdx); + if (posTrkP > kMinPMIP && posTrkP < kMaxPMIP) { + registry.fill(HIST("dEdxVsEtaElMIPV0"), posTrkEta, posTrkdEdx); + registry.fill(HIST("dEdxVsEtaElMIPV0p"), posTrkEta, posTrkdEdx); } + if (negTrkP > kMinPMIP && negTrkP < kMaxPMIP) { + registry.fill(HIST("dEdxVsEtaElMIPV0"), negTrkEta, negTrkdEdx); + registry.fill(HIST("dEdxVsEtaElMIPV0p"), negTrkEta, negTrkdEdx); + } + dEdxElV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); + dEdxElV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); } } } @@ -1100,14 +1114,14 @@ struct PiKpRAA { bool passesPhiSelection(const float& pt, const float& phi) { - bool isSelected{false}; + bool isSelected{true}; if (phiCut.isPhiCutLoaded) { const int binLow{phiCut.hPhiCutLow->FindBin(pt)}; const int binHigh{phiCut.hPhiCutHigh->FindBin(pt)}; const double phiCutLow{phiCut.hPhiCutLow->GetBinContent(binLow)}; const double phiCutHigh{phiCut.hPhiCutHigh->GetBinContent(binHigh)}; - if (phi < phiCutLow || phi > phiCutHigh) - isSelected = true; + if (phi >= phiCutLow && phi <= phiCutHigh) + isSelected = false; } return isSelected; } @@ -1263,16 +1277,25 @@ struct PiKpRAA { { if (pathEtaCal.value.empty() == false) { etaCal.pEtaCal = ccdb->getForTimeStamp(pathEtaCal, ccdbNoLaterThan.value); - etaCal.pEtaCalPlateau = ccdb->getForTimeStamp(pathEtaCalPlateau, ccdbNoLaterThan.value); if (etaCal.pEtaCal == nullptr) LOGF(fatal, "Could not load pEtaCal from %s", pathEtaCal.value.c_str()); + } + + if (etaCal.pEtaCal) + etaCal.isMIPCalLoaded = true; + } + + void loadEtaPlateauCalibration() + { + if (pathEtaCalPlateau.value.empty() == false) { + etaCal.pEtaCalPlateau = ccdb->getForTimeStamp(pathEtaCalPlateau, ccdbNoLaterThan.value); if (etaCal.pEtaCalPlateau == nullptr) LOGF(fatal, "Could not load pEtaCalPlateau from %s", pathEtaCalPlateau.value.c_str()); } - if (etaCal.pEtaCal && etaCal.pEtaCalPlateau) - etaCal.isCalLoaded = true; + if (etaCal.pEtaCalPlateau) + etaCal.isCalPlateauLoaded = true; } }; From 2209fb33dada055c2dd3f3361d89c0b93e2b4b76 Mon Sep 17 00:00:00 2001 From: blacwovie Date: Thu, 18 Sep 2025 14:33:19 +0800 Subject: [PATCH 435/986] [PWGCF] pi-hypertriton ME process (#13006) Co-authored-by: blacw Co-authored-by: ALICE Action Bot --- .../TableProducer/PiNucleiFemto.cxx | 216 +++++++++++++++++- 1 file changed, 204 insertions(+), 12 deletions(-) diff --git a/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx b/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx index c7272ad3e30..7cb1864593e 100644 --- a/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx +++ b/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx @@ -63,6 +63,7 @@ #include #include #include +#include #include // std::prev #include #include @@ -204,12 +205,13 @@ struct PiNucleiFemto { PresliceUnsorted hypPerCol = o2::aod::hyperrec::collisionId; // binning for EM background - ConfigurableAxis axisVertex{"axisVertex", {30, -10, 10}, "Binning for multiplicity"}; + ConfigurableAxis axisVertex{"axisVertex", {30, -10, 10}, "Binning for vtxz"}; ConfigurableAxis axisCentrality{"axisCentrality", {40, 0, 100}, "Binning for centrality"}; using BinningType = ColumnBinningPolicy; BinningType binningPolicy{{axisVertex, axisCentrality}, true}; SliceCache cache; SameKindPair mPair{binningPolicy, settingNoMixedEvents, -1, &cache}; + // Pair hyperPair{binningPolicy, settingNoMixedEvents, -1, &cache}; std::array mBBparamsDe; @@ -229,6 +231,7 @@ struct PiNucleiFemto { "QA", {{"hVtxZ", "Vertex distribution in Z;Z (cm)", {HistType::kTH1F, {{400, -20.0, 20.0}}}}, {"hNcontributor", "Number of primary vertex contributor", {HistType::kTH1F, {{2000, 0.0f, 2000.0f}}}}, + {"hCentrality", "Centrality", {HistType::kTH1F, {{200, 0.0f, 100.0f}}}}, {"hTrackSel", "Accepted tracks", {HistType::kTH1F, {{Selections::kAll, -0.5, static_cast(Selections::kAll) - 0.5}}}}, {"hEvents", "; Events;", {HistType::kTH1F, {{3, -0.5, 2.5}}}}, {"hEmptyPool", "svPoolCreator did not find track pairs false/true", {HistType::kTH1F, {{2, -0.5, 1.5}}}}, @@ -240,6 +243,9 @@ struct PiNucleiFemto { {"hNuPitInvMass", "; M(Nu + p) (GeV/#it{c}^{2})", {HistType::kTH1F, {{300, 3.74f, 4.34f}}}}, {"hNuPt", "#it{p}_{T} distribution; #it{p}_{T} (GeV/#it{c})", {HistType::kTH1F, {{240, -6.0f, 6.0f}}}}, {"hPiPt", "Pt distribution; #it{p}_{T} (GeV/#it{c})", {HistType::kTH1F, {{120, -3.0f, 3.0f}}}}, + {"hHe3TPCnsigma", "NsigmaHe3 TPC distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}(He3)", {HistType::kTH2F, {{100, -2.0f, 2.0f}, {200, -5.0f, 5.0f}}}}, + {"hHe3P", "Pin distribution; p (GeV/#it{c})", {HistType::kTH1F, {{120, -3.0f, 3.0f}}}}, + {"hHe3P_preselected", "Pin distribution_preselected; p (GeV/#it{c})", {HistType::kTH1F, {{120, -3.0f, 3.0f}}}}, {"hNuEta", "eta distribution; #eta(Nu)", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}}, {"hPiEta", "eta distribution; #eta(#pi)", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}}, {"hNuPhi", "phi distribution; phi(Nu)", {HistType::kTH1F, {{600, -4.0f, 4.0f}}}}, @@ -268,6 +274,52 @@ struct PiNucleiFemto { false, true}; + int numOfCentBins = 40; + int numOfVertexZBins = 30; + float Vz_low = -10.0f; + float Vz_high = 10.0f; + float Vz_step = (Vz_high - Vz_low) / numOfVertexZBins; + + struct EventRef { + int64_t collisionId; + }; + + struct PoolBin { + std::deque events; + }; + + std::vector All_Event_pool; + bool isInitialized = false; + + int nPoolBins() const { return numOfVertexZBins * numOfCentBins; } + + void initializePools() + { + All_Event_pool.clear(); + All_Event_pool.resize(nPoolBins()); + isInitialized = true; + } + + int where_pool(float vz, float v0Centr) const + { + float CentBinWidth = 100.0 / numOfCentBins; // = 2.5 + + int iy = static_cast(std::floor(v0Centr / CentBinWidth)); + if (iy < 0) + iy = 0; + if (iy >= numOfCentBins) + iy = numOfCentBins - 1; + + int ix = static_cast(std::floor((vz - Vz_low) / Vz_step)); + if (ix < 0) + ix = 0; + if (ix >= numOfVertexZBins) + ix = numOfVertexZBins - 1; + + int bin = ix + numOfVertexZBins * iy; + return bin; + } + void init(o2::framework::InitContext&) { mZorroSummary.setObject(mZorro.getZorroSummary()); @@ -488,6 +540,41 @@ struct PiNucleiFemto { return false; } + float averageClusterSizeCosl(uint32_t itsClusterSizes, float eta) + { + float average = 0; + int nclusters = 0; + const float cosl = 1. / std::cosh(eta); + const int nlayerITS = 7; + + for (int layer = 0; layer < nlayerITS; layer++) { + if ((itsClusterSizes >> (layer * 4)) & 0xf) { + nclusters++; + average += (itsClusterSizes >> (layer * 4)) & 0xf; + } + } + if (nclusters == 0) { + return 0; + } + return average * cosl / nclusters; + }; + + bool selectionPIDHyper(const aod::DataHypCandsWColl::iterator& V0Hyper) + { + mQaRegistry.fill(HIST("hHe3P_preselected"), V0Hyper.tpcMomHe()); + float averClusSizeHe = averageClusterSizeCosl(V0Hyper.itsClusterSizesHe(), V0Hyper.etaHe3()); + if (averClusSizeHe <= 4) { + return false; + } + if (V0Hyper.tpcChi2He() <= 0.5) { + return false; + } + mQaRegistry.fill(HIST("hHe3P"), V0Hyper.tpcMomHe()); + mQaRegistry.fill(HIST("hHe3TPCnsigma"), V0Hyper.nSigmaHe()); + + return true; + } + // ================================================================================================================== template @@ -720,21 +807,23 @@ struct PiNucleiFemto { template void pairTracksSameEventHyper(const Ttrack& piTracks, const Thypers& V0Hypers) { - for (const auto& piTrack : piTracks) { - - mQaRegistry.fill(HIST("hTrackSel"), Selections::kNoCuts); - - if (!selectTrack(piTrack)) { + for (const auto& V0Hyper : V0Hypers) { + if (!selectionPIDHyper(V0Hyper)) { continue; } - mQaRegistry.fill(HIST("hTrackSel"), Selections::kTrackCuts); + for (const auto& piTrack : piTracks) { - if (!selectionPIDPion(piTrack)) { - continue; - } - mQaRegistry.fill(HIST("hTrackSel"), Selections::kPID); + mQaRegistry.fill(HIST("hTrackSel"), Selections::kNoCuts); - for (const auto& V0Hyper : V0Hypers) { + if (!selectTrack(piTrack)) { + continue; + } + mQaRegistry.fill(HIST("hTrackSel"), Selections::kTrackCuts); + + if (!selectionPIDPion(piTrack)) { + continue; + } + mQaRegistry.fill(HIST("hTrackSel"), Selections::kPID); SVCand pair; pair.tr0Idx = piTrack.globalIndex(); @@ -770,6 +859,29 @@ struct PiNucleiFemto { } } + template + void pairHyperEventMixing(T1& pionCands, T2& hypCands) + { + for (const auto& hypCand : hypCands) { + if (!selectionPIDHyper(hypCand)) { + continue; + } + for (const auto& pionCand : pionCands) { + if (!selectTrack(pionCand) || !selectionPIDPion(pionCand)) { + continue; + } + + SVCand pair; + pair.tr0Idx = hypCand.globalIndex(); + pair.tr1Idx = pionCand.globalIndex(); + const int collIdx = hypCand.collisionId(); + CollBracket collBracket{collIdx, collIdx}; + pair.collBracket = collBracket; + mTrackHypPairs.push_back(pair); + } + } + } + template void fillTable(const PiNucandidate& piNucand, const Tcoll& collision) { @@ -977,6 +1089,15 @@ struct PiNucleiFemto { if (!fillCandidateInfoHyper(v0hyper, piTrack, piNucand, isMixedEvent)) { continue; } + mQaRegistry.fill(HIST("hNuPt"), piNucand.recoPtNu()); + mQaRegistry.fill(HIST("hPiPt"), piNucand.recoPtPi()); + mQaRegistry.fill(HIST("hNuEta"), piNucand.recoEtaNu()); + mQaRegistry.fill(HIST("hPiEta"), piNucand.recoEtaPi()); + mQaRegistry.fill(HIST("hNuPhi"), piNucand.recoPhiNu()); + mQaRegistry.fill(HIST("hPiPhi"), piNucand.recoPhiPi()); + mQaRegistry.fill(HIST("hNuPitInvMass"), piNucand.invMass); + mQaRegistry.fill(HIST("hNClsPiITS"), piNucand.nClsItsPi); + mQaRegistry.fill(HIST("hisBkgEM"), piNucand.isBkgEM); auto collision = collisions.rawIteratorAt(piNucand.collisionID); @@ -1021,6 +1142,7 @@ struct PiNucleiFemto { { mGoodCollisions.clear(); mGoodCollisions.resize(collisions.size(), false); + // LOG(info) << "Number of hyperCandidates read = " << V0Hypers.size(); for (const auto& collision : collisions) { @@ -1068,6 +1190,76 @@ struct PiNucleiFemto { fillPairs(collisions, tracks, /*isMixedEvent*/ true); } PROCESS_SWITCH(PiNucleiFemto, processMixedEvent, "Process Mixed event", false); + + /*void processMixedEventHyper(const CollisionsFull& collisions, o2::aod::DataHypCandsWColl const& V0Hypers, const TrackCandidates& pitracks) + { + LOG(debug) << "Processing mixed event for hypertriton"; + mTrackHypPairs.clear(); + + for (const auto& [c1, tracks1, c2, V0Hypers2] : hyperPair) { + if (!c1.sel8() || !c2.sel8()) { + continue; + } + + mQaRegistry.fill(HIST("hNcontributor"), c2.numContrib()); + //mQaRegistry.fill(HIST("hCentrality"), c2.centFT0C()); + mQaRegistry.fill(HIST("hVtxZ"), c2.posZ()); + + pairHyperEventMixing(tracks1, V0Hypers2); + } +} +PROCESS_SWITCH(PiNucleiFemto, processMixedEventHyper, "Process Mixed event", false);*/ + + void processMixedEventHyperPool(const CollisionsFull& collisions, o2::aod::DataHypCandsWColl const& V0Hypers, const TrackCandidates& pitracks) + { + LOG(info) << "Processing mixed event for hypertriton"; + + mTrackHypPairs.clear(); + if (!isInitialized) { + initializePools(); + LOG(info) << "Initialized event pool with size = " << All_Event_pool.size(); + } + for (auto const& collision : collisions) { + int poolIndexPi = where_pool(collision.posZ(), collision.centFT0C()); + auto& pool = All_Event_pool[poolIndexPi]; + + if (poolIndexPi < 0 || static_cast(poolIndexPi) >= All_Event_pool.size()) { + continue; + } + + for (auto const& storedEvent : pool.events) { + auto c1 = collisions.iteratorAt(storedEvent.collisionId); + const auto& c2 = collision; + if (!c1.sel8() || !c2.sel8()) + continue; + + std::vector tracks1; + for (auto const& t : pitracks) { + if (t.collisionId() == c1.globalIndex()) { + tracks1.push_back(t); + } + } + + std::vector hypers2; + for (auto const& h : V0Hypers) { + if (h.collisionId() != c2.globalIndex()) + continue; + int poolIndexHyp = where_pool(h.zPrimVtx(), h.centralityFT0C()); + if (poolIndexHyp != poolIndexPi) + continue; + hypers2.push_back(h); + } + pairHyperEventMixing(tracks1, hypers2); + } + fillPairsHyper(collisions, pitracks, V0Hypers, /*isMixedEvent*/ true); + + if (static_cast(pool.events.size()) >= settingNoMixedEvents) { + pool.events.pop_front(); + } + pool.events.push_back({collision.globalIndex()}); + } + } + PROCESS_SWITCH(PiNucleiFemto, processMixedEventHyperPool, "Process Mixed event", false); }; WorkflowSpec defineDataProcessing(const ConfigContext& cfgc) From 0629b9541401fbc0e974ed6f7490fad7c4fc558f Mon Sep 17 00:00:00 2001 From: Kaare Endrup Iversen <69893472+kaareendrup@users.noreply.github.com> Date: Thu, 18 Sep 2025 11:15:56 +0200 Subject: [PATCH 436/986] [PWGDQ] Add columns to J/Psi-muon table (#13014) Co-authored-by: ALICE Action Bot --- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 13 +++++++++++-- PWGDQ/Tasks/tableReader_withAssoc.cxx | 12 ++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index b9ddcf2fb0d..99ab1c29153 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -97,12 +97,17 @@ DECLARE_SOA_COLUMN(GlobalIndexleg2, globalIndexleg2, uint64_t); DECLARE_SOA_COLUMN(Ptassoc, ptassoc, float); DECLARE_SOA_COLUMN(PINassoc, pINassoc, float); DECLARE_SOA_COLUMN(Etaassoc, etaassoc, float); +DECLARE_SOA_COLUMN(Phiassoc, phiassoc, float); DECLARE_SOA_COLUMN(Ptpair, ptpair, float); DECLARE_SOA_COLUMN(Etapair, etapair, float); +DECLARE_SOA_COLUMN(Ptleg1, ptleg1, float); DECLARE_SOA_COLUMN(PINleg1, pINleg1, float); DECLARE_SOA_COLUMN(Etaleg1, etaleg1, float); +DECLARE_SOA_COLUMN(Phileg1, phileg1, float); +DECLARE_SOA_COLUMN(Ptleg2, ptleg2, float); DECLARE_SOA_COLUMN(PINleg2, pINleg2, float); DECLARE_SOA_COLUMN(Etaleg2, etaleg2, float); +DECLARE_SOA_COLUMN(Phileg2, phileg2, float); DECLARE_SOA_COLUMN(TPCnsigmaKaassoc, tpcnsigmaKaassoc, float); DECLARE_SOA_COLUMN(TPCnsigmaPiassoc, tpcnsigmaPiassoc, float); DECLARE_SOA_COLUMN(TPCnsigmaPrassoc, tpcnsigmaPrassoc, float); @@ -171,7 +176,8 @@ DECLARE_SOA_TABLE(BmesonCandidates, "AOD", "DQBMESONS", dqanalysisflags::IsJpsiFromBSelected, dqanalysisflags::IsBarrelSelected, dqanalysisflags::McFlag); DECLARE_SOA_TABLE(JPsiMuonCandidates, "AOD", "DQJPSIMUONA", dqanalysisflags::DeltaEta, dqanalysisflags::DeltaPhi, - dqanalysisflags::MassDileptonCandidate, dqanalysisflags::Ptpair, dqanalysisflags::Etapair, dqanalysisflags::Ptassoc, dqanalysisflags::Etaassoc, + dqanalysisflags::MassDileptonCandidate, dqanalysisflags::Ptpair, dqanalysisflags::Etapair, dqanalysisflags::Ptassoc, dqanalysisflags::Etaassoc, dqanalysisflags::Phiassoc, + dqanalysisflags::Ptleg1, dqanalysisflags::Etaleg1, dqanalysisflags::Phileg1, dqanalysisflags::Ptleg2, dqanalysisflags::Etaleg2, dqanalysisflags::Phileg2, dqanalysisflags::McFlag); DECLARE_SOA_TABLE(JPsieeCandidates, "AOD", "DQPSEUDOPROPER", dqanalysisflags::Massee, dqanalysisflags::Ptee, dqanalysisflags::Lxyee, dqanalysisflags::LxyeePoleMass, dqanalysisflags::Lzee, dqanalysisflags::AmbiguousInBunchPairs, dqanalysisflags::AmbiguousOutOfBunchPairs, dqanalysisflags::Corrassoc); } // namespace o2::aod @@ -3870,7 +3876,10 @@ struct AnalysisDileptonTrack { } } // Fill table for correlation analysis - DileptonTrackTable(fValuesHadron[VarManager::kDeltaEta], fValuesHadron[VarManager::kDeltaPhi], dilepton.mass(), dilepton.pt(), dilepton.eta(), track.pt(), track.eta(), mcDecision); + DileptonTrackTable(fValuesHadron[VarManager::kDeltaEta], fValuesHadron[VarManager::kDeltaPhi], + dilepton.mass(), dilepton.pt(), dilepton.eta(), track.pt(), track.eta(), track.phi(), + lepton1.pt(), lepton1.eta(), lepton1.phi(), lepton2.pt(), lepton2.eta(), lepton2.phi(), + mcDecision); } // Fill histograms for the triplets diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index df9ceb3d9e5..0efc92a54cf 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -107,12 +107,17 @@ DECLARE_SOA_COLUMN(GlobalIndexleg2, globalIndexleg2, uint64_t); DECLARE_SOA_COLUMN(Ptassoc, ptassoc, float); DECLARE_SOA_COLUMN(PINassoc, pINassoc, float); DECLARE_SOA_COLUMN(Etaassoc, etaassoc, float); +DECLARE_SOA_COLUMN(Phiassoc, phiassoc, float); DECLARE_SOA_COLUMN(Ptpair, ptpair, float); DECLARE_SOA_COLUMN(Etapair, etapair, float); +DECLARE_SOA_COLUMN(Ptleg1, ptleg1, float); DECLARE_SOA_COLUMN(PINleg1, pINleg1, float); DECLARE_SOA_COLUMN(Etaleg1, etaleg1, float); +DECLARE_SOA_COLUMN(Phileg1, phileg1, float); +DECLARE_SOA_COLUMN(Ptleg2, ptleg2, float); DECLARE_SOA_COLUMN(PINleg2, pINleg2, float); DECLARE_SOA_COLUMN(Etaleg2, etaleg2, float); +DECLARE_SOA_COLUMN(Phileg2, phileg2, float); DECLARE_SOA_COLUMN(TPCnsigmaKaassoc, tpcnsigmaKaassoc, float); DECLARE_SOA_COLUMN(TPCnsigmaPiassoc, tpcnsigmaPiassoc, float); DECLARE_SOA_COLUMN(TPCnsigmaPrassoc, tpcnsigmaPrassoc, float); @@ -184,7 +189,8 @@ DECLARE_SOA_TABLE(BmesonCandidates, "AOD", "DQBMESONSA", dqanalysisflags::IsJpsiFromBSelected, dqanalysisflags::IsBarrelSelected); DECLARE_SOA_TABLE(JPsiMuonCandidates, "AOD", "DQJPSIMUONA", dqanalysisflags::DeltaEta, dqanalysisflags::DeltaPhi, - dqanalysisflags::MassDileptonCandidate, dqanalysisflags::Ptpair, dqanalysisflags::Etapair, dqanalysisflags::Ptassoc, dqanalysisflags::Etaassoc); + dqanalysisflags::MassDileptonCandidate, dqanalysisflags::Ptpair, dqanalysisflags::Etapair, dqanalysisflags::Ptassoc, dqanalysisflags::Etaassoc, dqanalysisflags::Phiassoc, + dqanalysisflags::Ptleg1, dqanalysisflags::Etaleg1, dqanalysisflags::Phileg1, dqanalysisflags::Ptleg2, dqanalysisflags::Etaleg2, dqanalysisflags::Phileg2); DECLARE_SOA_TABLE(JPsieeCandidates, "AOD", "DQPSEUDOPROPER", dqanalysisflags::Massee, dqanalysisflags::Ptee, dqanalysisflags::Lxyee, dqanalysisflags::LxyeePoleMass, dqanalysisflags::Lzee, dqanalysisflags::AmbiguousInBunchPairs, dqanalysisflags::AmbiguousOutOfBunchPairs, dqanalysisflags::MultiplicityFT0A, dqanalysisflags::MultiplicityFT0C, dqanalysisflags::MultiplicityNContrib); } // namespace o2::aod @@ -3515,7 +3521,9 @@ struct AnalysisDileptonTrack { VarManager::FillDileptonHadron(dilepton, track, fValuesHadron); VarManager::FillDileptonTrackVertexing(event, lepton1, lepton2, track, fValuesHadron); // Fill table for correlation analysis - DileptonTrackTable(fValuesHadron[VarManager::kDeltaEta], fValuesHadron[VarManager::kDeltaPhi], dilepton.mass(), dilepton.pt(), dilepton.eta(), track.pt(), track.eta()); + DileptonTrackTable(fValuesHadron[VarManager::kDeltaEta], fValuesHadron[VarManager::kDeltaPhi], + dilepton.mass(), dilepton.pt(), dilepton.eta(), track.pt(), track.eta(), track.phi(), + lepton1.pt(), lepton1.eta(), lepton1.phi(), lepton2.pt(), lepton2.eta(), lepton2.phi()); } // Fill histograms for the triplets From 5e5df95be7cf60a852d03bc6e32d343fe3b369d0 Mon Sep 17 00:00:00 2001 From: CyF1rmiana <3326561594@qq.com> Date: Thu, 18 Sep 2025 18:13:44 +0800 Subject: [PATCH 437/986] [PWGCF] Add files for v2 check (#13023) --- PWGCF/Flow/Tasks/flowEseTask.cxx | 117 ++++++++++++++++++++----------- 1 file changed, 75 insertions(+), 42 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowEseTask.cxx b/PWGCF/Flow/Tasks/flowEseTask.cxx index 99569afbe0f..827b9d9cd84 100644 --- a/PWGCF/Flow/Tasks/flowEseTask.cxx +++ b/PWGCF/Flow/Tasks/flowEseTask.cxx @@ -18,6 +18,7 @@ #include "PWGLF/DataModel/LFStrangenessTables.h" #include "PWGMM/Mult/DataModel/Index.h" // for Particles2Tracks table +#include "Common/Core/EventPlaneHelper.h" #include "Common/Core/RecoDecay.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/trackUtilities.h" @@ -68,7 +69,7 @@ using namespace o2::constants::physics; struct FlowEseTask { // using EventCandidates = soa::Filtered>; using EventCandidates = soa::Join; - using TrackCandidates = soa::Join; + using TrackCandidates = soa::Join; using V0TrackCandidate = aod::V0Datas; HistogramRegistry histos{ @@ -104,6 +105,9 @@ struct FlowEseTask { Configurable cfgV0EtaMax{"cfgV0EtaMax", 0.5, "maximum rapidity"}; Configurable cfgV0LifeTime{"cfgV0LifeTime", 30., "maximum lambda lifetime"}; + Configurable cfgMinPt{"cfgMinPt", 0.15, "Minimum transverse momentum for track"}; + Configurable cfgMaxEta{"cfgMaxEta", 0.8, "Maximum pseudorapidiy for charged track"}; + Configurable cfgQAv0{"cfgQAv0", false, "QA plot"}; Configurable cfgDaughTPCnclsMin{"cfgDaughTPCnclsMin", 70, "minimum fired crossed rows"}; @@ -143,13 +147,14 @@ struct FlowEseTask { ConfigurableAxis massAxis{"massAxis", {30, 1.1, 1.13}, "Invariant mass axis"}; ConfigurableAxis ptAxis{"ptAxis", {VARIABLE_WIDTH, 0.2, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 6.5, 8.0, 10.0, 100.0}, "Transverse momentum bins"}; + ConfigurableAxis ptFullAxis{"ptFullAxis", {VARIABLE_WIDTH, -5.0, -4.0, -3.0, -2.5, -2.0, -1.5, -1.0, -0.5, -0.2, 0, 0.2, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0}, "Transverse momentum bins"}; ConfigurableAxis centAxis{"centAxis", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 100}, "Centrality interval"}; ConfigurableAxis cosAxis{"cosAxis", {110, -1.05, 1.05}, "Cosine axis"}; ConfigurableAxis rapAxis{"rapAxis", {10, -0.5, 0.5}, "Rapidity axis"}; ConfigurableAxis qqAxis{"qqAxis", {100, -0.1, 0.1}, "qq axis"}; ConfigurableAxis lowerQAxis{"lowerQAxis", {800, 0, 800}, "result of q2"}; ConfigurableAxis multNumAxis{"multNumAxis", {300, 0, 2700}, "mult num"}; - ConfigurableAxis qvecAxis{"qvecAxis", {300, -1, 1}, "range of Qvector"}; + ConfigurableAxis qvecAxis{"qvecAxis", {300, -1, 1}, "range of Qvector component"}; ConfigurableAxis qvec2Axis{"qvec2Axis", {600, 0, 600}, "range of Qvector Module"}; static constexpr float kMinAmplitudeThreshold = 1e-5f; @@ -158,11 +163,11 @@ struct FlowEseTask { static constexpr std::array kCorrLevel = {2, 3, 4, 1}; static constexpr std::array kCentBoundaries = {0.0f, 3.49f, 4.93f, 6.98f, 8.55f, 9.87f, 11.0f, 12.1f, 13.1f, 14.0f}; static constexpr std::array kCentValues = {2.5f, 7.5f, 15.0f, 25.0f, 35.0f, 45.0f, 55.0f, 65.0f, 75.0f}; - static constexpr std::array kCentrality = {0, 10, 20, 30, 40, 50, 60, 70, 80}; static constexpr std::array, 8> kLowQvec = {{{121, 196}, {110, 172}, {93, 143}, {74, 117}, {58, 92}, {43, 70}, {31, 50}, {21, 34}}}; static constexpr float kEtaAcceptance = 0.8f; static constexpr float kCentUpperLimit = 80.0f; - static constexpr int kCentNum = 8; + + EventPlaneHelper helperEP; TF1* fMultPVCutLow = nullptr; TF1* fMultPVCutHigh = nullptr; @@ -219,6 +224,7 @@ struct FlowEseTask { AxisSpec epQaAxis = {100, -1.0 * o2::constants::math::PI, o2::constants::math::PI}; AxisSpec pidAxis = {100, -10, 10}; + AxisSpec vertexAxis = {100, -20, 20}; AxisSpec shiftAxis = {10, 0, 10, "shift"}; AxisSpec basisAxis = {20, 0, 20, "basis"}; @@ -226,10 +232,13 @@ struct FlowEseTask { histos.add(Form("histQvecV2"), "", {HistType::kTH3F, {qvecAxis, qvecAxis, centAxis}}); histos.add(Form("histMult_Cent"), "", {HistType::kTH2F, {multNumAxis, centAxis}}); histos.add(Form("histQvecCent"), "", {HistType::kTH2F, {lowerQAxis, centAxis}}); - histos.add(Form("histPrPtCent"), "", {HistType::kTHnSparseF, {ptAxis, ptAxis, ptAxis, centAxis}}); - histos.add(Form("histPiPtCent"), "", {HistType::kTHnSparseF, {ptAxis, ptAxis, ptAxis, centAxis}}); - histos.add(Form("histPrBoostedPtCent"), "", {HistType::kTHnSparseF, {ptAxis, ptAxis, ptAxis, centAxis}}); - + histos.add(Form("histPrPtCent"), "", {HistType::kTHnSparseF, {ptFullAxis, ptFullAxis, ptFullAxis, centAxis}}); + histos.add(Form("histPiPtCent"), "", {HistType::kTHnSparseF, {ptFullAxis, ptFullAxis, ptFullAxis, centAxis}}); + histos.add(Form("histPrBoostedPtCent"), "", {HistType::kTHnSparseF, {ptFullAxis, ptFullAxis, ptFullAxis, centAxis}}); + histos.add(Form("histVertex"), "", {HistType::kTHnSparseF, {vertexAxis, vertexAxis, vertexAxis, centAxis}}); + histos.add(Form("histV2"), "", {HistType::kTHnSparseF, {centAxis, ptAxis, cosAxis, qvec2Axis}}); + histos.add(Form("histV2_lambda"), "", {HistType::kTHnSparseF, {centAxis, ptAxis, cosAxis, qvec2Axis, massAxis}}); + histos.add(Form("histV2_alambda"), "", {HistType::kTHnSparseF, {centAxis, ptAxis, cosAxis, qvec2Axis, massAxis}}); for (auto i = 2; i < cfgnMods + 2; i++) { histos.add(Form("psi%d/h_lambda_cos", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis, epAxis}}); histos.add(Form("psi%d/h_alambda_cos", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis, epAxis}}); @@ -238,10 +247,6 @@ struct FlowEseTask { histos.add(Form("psi%d/h_lambda_cos2_q2", i), "", {HistType::kTH3F, {centAxis, qvec2Axis, cosAxis}}); histos.add(Form("psi%d/h_alambda_cos2_q2", i), "", {HistType::kTH3F, {centAxis, qvec2Axis, cosAxis}}); - histos.add(Form("psi%d/h_lambda_cos2_left", i), "", {HistType::kTH2F, {centAxis, cosAxis}}); - histos.add(Form("psi%d/h_lambda_cos2_mid", i), "", {HistType::kTH2F, {centAxis, cosAxis}}); - histos.add(Form("psi%d/h_lambda_cos2_right", i), "", {HistType::kTH2F, {centAxis, cosAxis}}); - if (cfgRapidityDep) { histos.add(Form("psi%d/h_lambda_cos2_rap", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis, rapAxis}}); histos.add(Form("psi%d/h_alambda_cos2_rap", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis, rapAxis}}); @@ -249,9 +254,6 @@ struct FlowEseTask { histos.add(Form("psi%d/h_lambda_cossin", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); histos.add(Form("psi%d/h_alambda_cossin", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); - histos.add(Form("psi%d/h_lambda_cossin_left", i), "", {HistType::kTH2F, {centAxis, cosAxis}}); - histos.add(Form("psi%d/h_lambda_cossin_mid", i), "", {HistType::kTH2F, {centAxis, cosAxis}}); - histos.add(Form("psi%d/h_lambda_cossin_right", i), "", {HistType::kTH2F, {centAxis, cosAxis}}); histos.add(Form("psi%d/h_lambda_cossin_q2", i), "", {HistType::kTH3F, {centAxis, qvec2Axis, cosAxis}}); histos.add(Form("psi%d/h_alambda_cossin_q2", i), "", {HistType::kTH3F, {centAxis, qvec2Axis, cosAxis}}); @@ -526,6 +528,31 @@ struct FlowEseTask { return -o2::constants::math::PIHalf; } + template + bool selectionTrack(TrackType const& track) + { + if (track.pt() < cfgMinPt) + return false; + if (std::abs(track.eta()) > cfgMaxEta) + return false; + if (!track.passedITSNCls()) + return false; + if (!track.passedITSChi2NDF()) + return false; + if (!track.passedITSHits()) + return false; + if (!track.passedTPCCrossedRowsOverNCls()) + return false; + if (!track.passedTPCChi2NDF()) + return false; + if (!track.passedDCAxy()) + return false; + if (!track.passedDCAz()) + return false; + + return true; + } + template void fillShiftCorrection(TCollision const& collision, int nmode) { @@ -676,13 +703,29 @@ struct FlowEseTask { } } - template - void fillHistograms(TCollision const& collision, V0 const& V0s, int nmode) + template + void fillHistograms(TCollision const& collision, V0 const& V0s, TrackType const& track, int nmode) { qvecDetInd = detId * 4 + 3 + (nmode - 2) * cfgNQvec * 4; qvecRefAInd = refAId * 4 + 3 + (nmode - 2) * cfgNQvec * 4; qvecRefBInd = refBId * 4 + 3 + (nmode - 2) * cfgNQvec * 4; + for (const auto& trk : track) { + if (!selectionTrack(trk)) { + continue; + } + if (nmode == kCorrLevel[0]) { + histos.fill(HIST("histV2"), collision.centFT0C(), trk.pt(), + std::cos(static_cast(nmode) * (trk.phi() - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode))), + std::sqrt(collision.qvecFT0CReVec()[0] * collision.qvecFT0CReVec()[0] + collision.qvecFT0CImVec()[0] * collision.qvecFT0CImVec()[0]) * std::sqrt(collision.sumAmplFT0C())); + } + } + + histos.fill(HIST("histQvecCent"), std::sqrt(collision.qvecFT0CReVec()[0] * collision.qvecFT0CReVec()[0] + collision.qvecFT0CImVec()[0] * collision.qvecFT0CImVec()[0]) * std::sqrt(collision.sumAmplFT0C()), centrality); + histos.fill(HIST("histQvecV2"), collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], collision.centFT0C()); + histos.fill(HIST("histMult_Cent"), collision.sumAmplFT0C(), collision.centFT0C()); + histos.fill(HIST("histVertex"), collision.posX(), collision.posY(), collision.posZ(), collision.centFT0C()); + for (const auto& v0 : V0s) { auto postrack = v0.template posTrack_as(); auto negtrack = v0.template negTrack_as(); @@ -720,10 +763,18 @@ struct FlowEseTask { if (lambdaTag) { protonVec = ROOT::Math::PxPyPzMVector(v0.pxpos(), v0.pypos(), v0.pzpos(), massPr); pionVec = ROOT::Math::PxPyPzMVector(v0.pxneg(), v0.pyneg(), v0.pzneg(), massPi); + histos.fill(HIST("histV2_lambda"), collision.centFT0C(), v0.pt(), + std::cos(static_cast(nmode) * (v0.phi() - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode))), + std::sqrt(collision.qvecFT0CReVec()[0] * collision.qvecFT0CReVec()[0] + collision.qvecFT0CImVec()[0] * collision.qvecFT0CImVec()[0]) * std::sqrt(collision.sumAmplFT0C()), + v0.mLambda()); } if (aLambdaTag) { protonVec = ROOT::Math::PxPyPzMVector(v0.pxneg(), v0.pyneg(), v0.pzneg(), massPr); pionVec = ROOT::Math::PxPyPzMVector(v0.pxpos(), v0.pypos(), v0.pzpos(), massPi); + histos.fill(HIST("histV2_alambda"), collision.centFT0C(), v0.pt(), + std::cos(static_cast(nmode) * (v0.phi() - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode))), + std::sqrt(collision.qvecFT0CReVec()[0] * collision.qvecFT0CReVec()[0] + collision.qvecFT0CImVec()[0] * collision.qvecFT0CImVec()[0]) * std::sqrt(collision.sumAmplFT0C()), + v0.mAntiLambda()); } LambdaVec = protonVec + pionVec; LambdaVec.SetM(massLambda); @@ -790,37 +841,19 @@ struct FlowEseTask { qvecMag *= std::sqrt(std::pow(collision.qvecIm()[3 + (nmode - 2) * 28], 2) + std::pow(collision.qvecRe()[3 + (nmode - 2) * 28], 2)); if (nmode == kCorrLevel[0]) { //////////// + double q2 = std::sqrt(collision.qvecFT0CReVec()[0] * collision.qvecFT0CReVec()[0] + collision.qvecFT0CImVec()[0] * collision.qvecFT0CImVec()[0]) * std::sqrt(collision.sumAmplFT0C()); if (lambdaTag) { - double q2 = std::sqrt(collision.qvecFT0CReVec()[0] * collision.qvecFT0CReVec()[0] + collision.qvecFT0CImVec()[0] * collision.qvecFT0CImVec()[0]) * std::sqrt(collision.sumAmplFT0C()); histos.fill(HIST("psi2/h_lambda_cos"), v0.mLambda(), v0.pt(), angle * weight, centrality, relphi); histos.fill(HIST("psi2/h_lambda_cos2"), v0.mLambda(), v0.pt(), angle * angle, centrality, relphi); histos.fill(HIST("psi2/h_lambda_cossin"), v0.mLambda(), v0.pt(), angle * std::sin(relphi) * weight, centrality); histos.fill(HIST("psi2/h_lambda_vncos"), v0.mLambda(), v0.pt(), qvecMag * std::cos(relphi) * weight, centrality); histos.fill(HIST("psi2/h_lambda_vnsin"), v0.mLambda(), v0.pt(), std::sin(relphi), centrality); - histos.fill(HIST("psi2/h_lambda_cos2_q2"), centrality, std::sqrt(collision.qvecFT0CReVec()[0] * collision.qvecFT0CReVec()[0] + collision.qvecFT0CImVec()[0] * collision.qvecFT0CImVec()[0]) * std::sqrt(collision.sumAmplFT0C()), angle * angle); - histos.fill(HIST("psi2/h_lambda_cossin_q2"), centrality, std::sqrt(collision.qvecFT0CReVec()[0] * collision.qvecFT0CReVec()[0] + collision.qvecFT0CImVec()[0] * collision.qvecFT0CImVec()[0]) * std::sqrt(collision.sumAmplFT0C()), angle * std::sin(relphi) * weight); + histos.fill(HIST("psi2/h_lambda_cos2_q2"), centrality, q2, angle * angle); + histos.fill(HIST("psi2/h_lambda_cossin_q2"), centrality, q2, angle * std::sin(relphi) * weight); histos.fill(HIST("psi2/h_lambda_cossin_cov"), v0.pt(), angle * angle * angle * std::sin(relphi) * weight, centrality); - histos.fill(HIST("histQvecCent"), std::sqrt(collision.qvecFT0CReVec()[0] * collision.qvecFT0CReVec()[0] + collision.qvecFT0CImVec()[0] * collision.qvecFT0CImVec()[0]) * std::sqrt(collision.sumAmplFT0C()), centrality); - histos.fill(HIST("histQvecV2"), collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], collision.centFT0C()); - histos.fill(HIST("histMult_Cent"), collision.sumAmplFT0C(), collision.centFT0C()); - - for (int i = 0; i < kCentNum; i++) { - if (centrality >= kCentrality[i] && centrality < kCentrality[i + 1]) { - if (q2 < kLowQvec[i][0]) { - histos.fill(HIST("psi2/h_lambda_cos2_left"), centrality, angle * angle); - histos.fill(HIST("psi2/h_lambda_cossin_left"), centrality, angle * std::sin(relphi) * weight); - } else if (q2 >= kLowQvec[i][1]) { - histos.fill(HIST("psi2/h_lambda_cos2_right"), centrality, angle * angle); - histos.fill(HIST("psi2/h_lambda_cossin_right"), centrality, angle * std::sin(relphi) * weight); - } else { - histos.fill(HIST("psi2/h_lambda_cos2_mid"), centrality, angle * angle); - histos.fill(HIST("psi2/h_lambda_cossin_mid"), centrality, angle * std::sin(relphi) * weight); - } - } - } if (cfgRapidityDep) { histos.fill(HIST("psi2/h_lambda_cos2_rap"), v0.mLambda(), v0.pt(), angle * angle, centrality, v0.yLambda(), weight); } @@ -870,8 +903,8 @@ struct FlowEseTask { histos.fill(HIST("psi2/h_alambda_vncos"), v0.mAntiLambda(), v0.pt(), qvecMag * std::cos(relphi) * weight, centrality); histos.fill(HIST("psi2/h_alambda_vnsin"), v0.mAntiLambda(), v0.pt(), std::sin(relphi), centrality); - histos.fill(HIST("psi2/h_alambda_cos2_q2"), centrality, std::sqrt(collision.qvecFT0CReVec()[0] * collision.qvecFT0CReVec()[0] + collision.qvecFT0CImVec()[0] * collision.qvecFT0CImVec()[0]) * std::sqrt(collision.sumAmplFT0C()), angle * angle); - histos.fill(HIST("psi2/h_alambda_cossin_q2"), centrality, std::sqrt(collision.qvecFT0CReVec()[0] * collision.qvecFT0CReVec()[0] + collision.qvecFT0CImVec()[0] * collision.qvecFT0CImVec()[0]) * std::sqrt(collision.sumAmplFT0C()), angle * std::sin(relphi) * weight); + histos.fill(HIST("psi2/h_alambda_cos2_q2"), centrality, q2, angle * angle); + histos.fill(HIST("psi2/h_alambda_cossin_q2"), centrality, q2, angle * std::sin(relphi) * weight); histos.fill(HIST("psi2/h_alambda_cossin_cov"), v0.pt(), angle * angle * angle * std::sin(relphi) * weight, centrality); if (cfgRapidityDep) { @@ -983,7 +1016,7 @@ struct FlowEseTask { } void processData(EventCandidates::iterator const& collision, - TrackCandidates const& /*tracks*/, aod::V0Datas const& V0s, + TrackCandidates const& tracks, aod::V0Datas const& V0s, aod::BCsWithTimestamps const&) { if (cfgCentEst == kCorrLevel[3]) { @@ -1024,7 +1057,7 @@ struct FlowEseTask { if (cfgQAv0) { fillEPQA(collision, i); } - fillHistograms(collision, V0s, i); + fillHistograms(collision, V0s, tracks, i); } // FIXME: need to fill different histograms for different harmonic } PROCESS_SWITCH(FlowEseTask, processData, "Process Event for data", true); From 649891b3031fd68e7ecac0414f952c63253d35bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Thu, 18 Sep 2025 13:17:27 +0200 Subject: [PATCH 438/986] [DPG] Add run info option and reorganize includes (#13025) --- DPG/Tasks/AOTTrack/qaEventTrack.cxx | 35 ++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/DPG/Tasks/AOTTrack/qaEventTrack.cxx b/DPG/Tasks/AOTTrack/qaEventTrack.cxx index 144e41af1a0..50c1fea9909 100644 --- a/DPG/Tasks/AOTTrack/qaEventTrack.cxx +++ b/DPG/Tasks/AOTTrack/qaEventTrack.cxx @@ -23,19 +23,23 @@ #include "qaEventTrack.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "ReconstructionDataFormats/DCA.h" +#include "Common/Core/MetadataHelper.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/TrackSelectionDefaults.h" #include "Common/Core/trackUtilities.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/TrackSelectionDefaults.h" #include "Common/TableProducer/PID/pidTOFBase.h" +#include +#include +#include +#include +#include +#include + +#include + #include #include @@ -44,6 +48,8 @@ using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::dataformats; +o2::common::core::MetadataHelper metadataInfo; + // TODO: add PID wagons as dependency + include impact parameter studies (same or separate task in workflow??) //-------------------------------------------------------------------------------------------------- @@ -68,6 +74,9 @@ struct qaEventTrack { // option to apply a timeframe cut Configurable tfCut{"tfCut", false, "applies timeframe cut"}; + // option to add run info to the histograms + Configurable addRunInfo{"addRunInfo", true, "add run info (pass, data) to the histograms"}; + // options to select only specific tracks Configurable trackSelection{"trackSelection", 1, "Track selection: 0 -> No Cut, 1 -> kGlobalTrack, 2 -> kGlobalTrackWoPtEta, 3 -> kGlobalTrackWoDCA, 4 -> kQualityTracks, 5 -> kInAcceptanceTracks"}; Configurable selectCharge{"selectCharge", 0, "select charge +1 or -1 (0 means no selection)"}; @@ -166,6 +175,14 @@ struct qaEventTrack { } } + if (addRunInfo) { + auto hRunInfo = histos.add("hRunInfo", "Run info", kTH1D, {{1, 0.5, 1.5, "Run info"}}); + // hRunInfo->SetBit(TH1::kCanRebin); // allow dynamic bin creation based on label + if (metadataInfo.isFullyDefined()) { + hRunInfo->Fill(metadataInfo.makeMetadataLabel().c_str(), 1.0); + } + } + // // Next section setups overwrite of configurableAxis if overwriteAxisRangeForPbPb is used. // @@ -1153,6 +1170,8 @@ struct qaEventTrack { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { + // Parse the metadata + metadataInfo.initMetadata(cfgc); return WorkflowSpec{adaptAnalysisTask(cfgc)}; } From 5c7513eb8078a90b51cdd516aa8cd374f6d6afcd Mon Sep 17 00:00:00 2001 From: Noor Koster <82090643+cnkoster@users.noreply.github.com> Date: Thu, 18 Sep 2025 15:41:30 +0200 Subject: [PATCH 439/986] [PWGCF] zdcQvectors: add cent dimension to Psi profile histograms (#13026) Co-authored-by: ALICE Action Bot --- PWGCF/Flow/TableProducer/zdcQVectors.cxx | 37 ++++++++++++------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/PWGCF/Flow/TableProducer/zdcQVectors.cxx b/PWGCF/Flow/TableProducer/zdcQVectors.cxx index 2afc85d23f5..ac108c7098c 100644 --- a/PWGCF/Flow/TableProducer/zdcQVectors.cxx +++ b/PWGCF/Flow/TableProducer/zdcQVectors.cxx @@ -148,7 +148,6 @@ struct ZdcQVectors { O2_DEFINE_CONFIGURABLE(cfgEvSelsCentMin, float, 0, "Minimum cenrality for selected events"); O2_DEFINE_CONFIGURABLE(cfgEvSelsCentMax, float, 90, "Maximum cenrality for selected events"); - O2_DEFINE_CONFIGURABLE(cfgUseShift, bool, false, "Use shift for PsiA and PsiC ZDC"); O2_DEFINE_CONFIGURABLE(cfgCCDBdir_Shift, std::string, "Users/c/ckoster/ZDC/LHC23_PbPb_pass5/Shift", "CCDB directory for Shift ZDC"); // define my..... @@ -258,10 +257,10 @@ struct ZdcQVectors { registry.add("QA/ZNA_Energy", "ZNA_Energy", kTProfile, {{8, 0, 8}}); registry.add("QA/ZNC_Energy", "ZNC_Energy", kTProfile, {{8, 0, 8}}); - registry.add("QA/psiZDCA", "psiZDCA", kTH1D, {{100, -4, 4}}); - registry.add("QA/psiZDCA_shift", "psiZDCA_shift", kTH1D, {{100, -4, 4}}); - registry.add("QA/psiZDCC", "psiZDCC", kTH1D, {{100, -4, 4}}); - registry.add("QA/psiZDCC_shift", "psiZDCC_shift", kTH1D, {{100, -4, 4}}); + registry.add("QA/psiZDCA", "psiZDCA", kTH2D, {{100, -4, 4}, {100, 0, 100}}); + registry.add("QA/psiZDCA_shift", "psiZDCA_shift", kTH2D, {{100, -4, 4}, {100, 0, 100}}); + registry.add("QA/psiZDCC", "psiZDCC", kTH2D, {{100, -4, 4}, {100, 0, 100}}); + registry.add("QA/psiZDCC_shift", "psiZDCC_shift", kTH2D, {{100, -4, 4}, {100, 0, 100}}); registry.add("QA/before/ZNA_pmC", "ZNA_pmC", kTProfile, {{1, 0, 1.}}); registry.add("QA/before/ZNA_pm1", "ZNA_pm1", kTProfile, {{1, 0, 1.}}); @@ -923,7 +922,7 @@ struct ZdcQVectors { double deltaPsiZDCA = 0; double deltaPsiZDCC = 0; - if (cfgUseShift && !cfgCCDBdir_Shift.value.empty()) { + if (!cfgCCDBdir_Shift.value.empty()) { if (lastRunNumber != runnumber) { cal.isShiftProfileFound = false; LOGF(info, "Getting shift profile from CCDB for runnumber: %d", runnumber); @@ -939,19 +938,21 @@ struct ZdcQVectors { } } - float coeffshiftxZDCC = 0.0; - float coeffshiftyZDCC = 0.0; - float coeffshiftxZDCA = 0.0; - float coeffshiftyZDCA = 0.0; - for (int ishift = 1; ishift <= nshift; ishift++) { registry.fill(HIST("shift/ShiftZDCC"), centrality, 0.5, ishift - 0.5, std::sin(ishift * 1.0 * psiZDCC)); registry.fill(HIST("shift/ShiftZDCC"), centrality, 1.5, ishift - 0.5, std::cos(ishift * 1.0 * psiZDCC)); registry.fill(HIST("shift/ShiftZDCA"), centrality, 0.5, ishift - 0.5, std::sin(ishift * 1.0 * psiZDCA)); registry.fill(HIST("shift/ShiftZDCA"), centrality, 1.5, ishift - 0.5, std::cos(ishift * 1.0 * psiZDCA)); + } + float coeffshiftxZDCC = 0.0; + float coeffshiftyZDCC = 0.0; + float coeffshiftxZDCA = 0.0; + float coeffshiftyZDCA = 0.0; + + for (int ishift = 1; ishift <= nshift; ishift++) { if (cal.isShiftProfileFound) { - int binshiftxZDCC = cal.shiftprofileC->FindBin(centrality, 0.5, ishift - 0.5); + int binshiftxZDCC = cal.shiftprofileC->FindBin(centrality, 0.5, ishift - 0.5); // bin 0.5 int binshiftyZDCC = cal.shiftprofileC->FindBin(centrality, 1.5, ishift - 0.5); int binshiftxZDCA = cal.shiftprofileA->FindBin(centrality, 0.5, ishift - 0.5); int binshiftyZDCA = cal.shiftprofileA->FindBin(centrality, 1.5, ishift - 0.5); @@ -965,8 +966,8 @@ struct ZdcQVectors { if (binshiftyZDCA > 0) coeffshiftyZDCA = cal.shiftprofileA->GetBinContent(binshiftyZDCA); } - deltaPsiZDCC += ((2 / (1.0 * ishift)) * (-coeffshiftxZDCC * std::cos(ishift * 1.0 * psiZDCC) + coeffshiftyZDCC * std::sin(ishift * 1.0 * psiZDCC))); - deltaPsiZDCA += ((2 / (1.0 * ishift)) * (-coeffshiftxZDCA * std::cos(ishift * 1.0 * psiZDCA) + coeffshiftyZDCA * std::sin(ishift * 1.0 * psiZDCA))); + deltaPsiZDCC += ((2 / (1.0 * ishift)) * (-1.0 * coeffshiftxZDCC * std::cos(ishift * 1.0 * psiZDCC) + coeffshiftyZDCC * std::sin(ishift * 1.0 * psiZDCC))); + deltaPsiZDCA += ((2 / (1.0 * ishift)) * (-1.0 * coeffshiftxZDCA * std::cos(ishift * 1.0 * psiZDCA) + coeffshiftyZDCA * std::sin(ishift * 1.0 * psiZDCA))); } psiZDCCshift += deltaPsiZDCC; @@ -977,10 +978,10 @@ struct ZdcQVectors { psiZDCAshift = std::atan2(std::sin(psiZDCAshift), std::cos(psiZDCAshift)); if (cfgFillCommonRegistry) { - registry.fill(HIST("QA/psiZDCA"), psiZDCA); - registry.fill(HIST("QA/psiZDCC"), psiZDCC); - registry.fill(HIST("QA/psiZDCA_shift"), psiZDCAshift); - registry.fill(HIST("QA/psiZDCC_shift"), psiZDCCshift); + registry.fill(HIST("QA/psiZDCA"), psiZDCA, centrality); + registry.fill(HIST("QA/psiZDCC"), psiZDCC, centrality); + registry.fill(HIST("QA/psiZDCA_shift"), psiZDCAshift, centrality); + registry.fill(HIST("QA/psiZDCC_shift"), psiZDCCshift, centrality); } double qXaShift = std::hypot(qRec[1], qRec[0]) * std::cos(psiZDCAshift); From 308301509320c7d8d3f3168300723b06bc41b81a Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Thu, 18 Sep 2025 16:35:19 +0200 Subject: [PATCH 440/986] [PWGEM] Revert "[PWGEM/Dilepton] change acceptance histograms" (#13028) --- PWGEM/Dilepton/Core/Dilepton.h | 22 +- PWGEM/Dilepton/Core/DileptonMC.h | 518 +++++++++++++++---------------- PWGEM/Dilepton/Core/PhotonHBT.h | 9 +- 3 files changed, 268 insertions(+), 281 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index bdb158296d5..61ef5dab390 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -183,6 +183,7 @@ struct Dilepton { Configurable cfg_min_phiv{"cfg_min_phiv", 0.0, "min phiv (constant)"}; Configurable cfg_max_phiv{"cfg_max_phiv", 3.2, "max phiv (constant)"}; Configurable cfg_apply_detadphi{"cfg_apply_detadphi", false, "flag to apply deta-dphi elliptic cut at PV"}; + Configurable cfg_apply_detadphiposition{"cfg_apply_detadphiposition", false, "flag to apply deta-dphi elliptic cut at certain radius"}; Configurable cfg_min_deta{"cfg_min_deta", 0.02, "min deta between 2 electrons (elliptic cut)"}; Configurable cfg_min_dphi{"cfg_min_dphi", 0.2, "min dphi between 2 electrons (elliptic cut)"}; Configurable cfg_min_opang{"cfg_min_opang", 0.0, "min opening angle"}; @@ -218,6 +219,7 @@ struct Dilepton { Configurable cfg_max_its_cluster_size{"cfg_max_its_cluster_size", 16.f, "max ITS cluster size"}; Configurable cfg_min_rel_diff_pin{"cfg_min_rel_diff_pin", -1e+10, "min rel. diff. between pin and ppv"}; Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; + Configurable cfgRefR{"cfgRefR", 1.2, "reference R (in m) for extrapolation"}; // https://cds.cern.ch/record/1419204 Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif : 4, kPIDML : 5, kTPChadrejORTOFreq_woTOFif : 6]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; @@ -304,7 +306,7 @@ struct Dilepton { o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; - // static constexpr std::string_view event_cut_types[2] = {"before/", "after/"}; + static constexpr std::string_view event_cut_types[2] = {"before/", "after/"}; static constexpr std::string_view event_pair_types[2] = {"same/", "mix/"}; std::vector cent_bin_edges; @@ -556,6 +558,7 @@ struct Dilepton { if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kQC)) { fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y}, true); fRegistry.add("Pair/same/uls/hDeltaEtaDeltaPhi", "#Delta#eta-#Delta#varphi between 2 tracks;#Delta#varphi (rad.);#Delta#eta;", kTH2D, {{180, -M_PI, M_PI}, {400, -2, +2}}, true); + fRegistry.add("Pair/same/uls/hDeltaEtaDeltaPhiPosition", "#Delta#eta-#Delta#varphi^{*} between 2 tracks;#Delta#varphi^{*} (rad.);#Delta#eta;", kTH2D, {{180, -M_PI, M_PI}, {400, -2, +2}}, true); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.add("Pair/same/uls/hMvsPhiV", "m_{ee} vs. #varphi_{V};#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", kTH2D, {{90, 0, M_PI}, {100, 0.0f, 1.0f}}, true); // phiv is only for dielectron @@ -676,7 +679,7 @@ struct Dilepton { fDielectronCut.SetPairDCARange(dielectroncuts.cfg_min_pair_dca3d, dielectroncuts.cfg_max_pair_dca3d); // in sigma fDielectronCut.SetMaxMeePhiVDep([&](float phiv) { return dielectroncuts.cfg_phiv_intercept + phiv * dielectroncuts.cfg_phiv_slope; }, dielectroncuts.cfg_min_phiv, dielectroncuts.cfg_max_phiv); fDielectronCut.ApplyPhiV(dielectroncuts.cfg_apply_phiv); - fDielectronCut.SetMindEtadPhi(dielectroncuts.cfg_apply_detadphi, false, dielectroncuts.cfg_min_deta, dielectroncuts.cfg_min_dphi); + fDielectronCut.SetMindEtadPhi(dielectroncuts.cfg_apply_detadphi, dielectroncuts.cfg_apply_detadphiposition, dielectroncuts.cfg_min_deta, dielectroncuts.cfg_min_dphi); fDielectronCut.SetPairOpAng(dielectroncuts.cfg_min_opang, dielectroncuts.cfg_max_opang); fDielectronCut.SetRequireDifferentSides(dielectroncuts.cfg_require_diff_sides); @@ -873,7 +876,7 @@ struct Dilepton { } if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - if (!cut.IsSelectedPair(t1, t2, d_bz, 0.f)) { + if (!cut.IsSelectedPair(t1, t2, d_bz, dielectroncuts.cfgRefR)) { return false; } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { @@ -925,12 +928,21 @@ struct Dilepton { float dphi = t1.sign() * v1.Pt() > t2.sign() * v2.Pt() ? v1.Phi() - v2.Phi() : v2.Phi() - v1.Phi(); o2::math_utils::bringToPMPi(dphi); + float phiPosition1 = t1.phi() + std::asin(t1.sign() * 0.30282 * (d_bz * 0.1) * dielectroncuts.cfgRefR / (2.f * t1.pt())); + float phiPosition2 = t2.phi() + std::asin(t2.sign() * 0.30282 * (d_bz * 0.1) * dielectroncuts.cfgRefR / (2.f * t2.pt())); + + phiPosition1 = RecoDecay::constrainAngle(phiPosition1, 0, 1); // 0-2pi + phiPosition2 = RecoDecay::constrainAngle(phiPosition2, 0, 1); // 0-2pi + float dphiPosition = t1.sign() * v1.Pt() > t2.sign() * v2.Pt() ? phiPosition1 - phiPosition2 : phiPosition2 - phiPosition1; + o2::math_utils::bringToPMPi(dphiPosition); + float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz(), t1.sign(), t2.sign(), d_bz); float opAng = o2::aod::pwgem::dilepton::utils::pairutil::getOpeningAngle(t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz()); if (t1.sign() * t2.sign() < 0) { // ULS fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hDeltaEtaDeltaPhi"), dphi, deta, weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hDeltaEtaDeltaPhiPosition"), dphiPosition, deta, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hMvsPhiV"), phiv, v12.M(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hMvsOpAng"), opAng, v12.M(), weight); @@ -943,6 +955,7 @@ struct Dilepton { } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hDeltaEtaDeltaPhi"), dphi, deta, weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hDeltaEtaDeltaPhiPosition"), dphiPosition, deta, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hMvsPhiV"), phiv, v12.M(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hMvsOpAng"), opAng, v12.M(), weight); @@ -955,6 +968,7 @@ struct Dilepton { } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hDeltaEtaDeltaPhi"), dphi, deta, weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hDeltaEtaDeltaPhiPosition"), dphiPosition, deta, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hMvsPhiV"), phiv, v12.M(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hMvsOpAng"), opAng, v12.M(), weight); @@ -1407,7 +1421,7 @@ struct Dilepton { } if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - if (!cut.IsSelectedPair(t1, t2, d_bz, 0.0)) { + if (!cut.IsSelectedPair(t1, t2, d_bz, dielectroncuts.cfgRefR)) { return false; } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index 8552e617a32..0f924be57f4 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -105,8 +105,6 @@ struct DileptonMC { Configurable cfgDCAType{"cfgDCAType", 0, "type of DCA for output. 0:3D, 1:XY, 2:Z, else:3D"}; Configurable cfgFillUnfolding{"cfgFillUnfolding", false, "flag to fill histograms for unfolding"}; Configurable cfgRequireTrueAssociation{"cfgRequireTrueAssociation", false, "flag to require true mc collision association"}; - Configurable cfgFillAllCharm{"cfgFillAllCharm", false, "flag to fill histograms for charm hadrons separatedly"}; - Configurable cfgFillAllGen{"cfgFillAllGen", false, "flag to fill histograms for all generated also outside of acceptance."}; ConfigurableAxis ConfMllBins{"ConfMllBins", {VARIABLE_WIDTH, 0.00, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.50, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.70, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.80, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.00, 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.10, 2.20, 2.30, 2.40, 2.50, 2.60, 2.70, 2.75, 2.80, 2.85, 2.90, 2.95, 3.00, 3.05, 3.10, 3.15, 3.20, 3.25, 3.30, 3.35, 3.40, 3.45, 3.50, 3.55, 3.60, 3.65, 3.70, 3.75, 3.80, 3.85, 3.90, 3.95, 4.00}, "mll bins for output histograms"}; ConfigurableAxis ConfPtllBins{"ConfPtllBins", {VARIABLE_WIDTH, 0.00, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.50, 3.00, 3.50, 4.00, 4.50, 5.00, 6.00, 7.00, 8.00, 9.00, 10.00}, "pTll bins for output histograms"}; @@ -180,6 +178,7 @@ struct DileptonMC { Configurable cfg_min_phiv{"cfg_min_phiv", 0.0, "min phiv (constant)"}; Configurable cfg_max_phiv{"cfg_max_phiv", 3.2, "max phiv (constant)"}; Configurable cfg_apply_detadphi{"cfg_apply_detadphi", false, "flag to apply deta-dphi elliptic cut at PV"}; + Configurable cfg_apply_detadphiposition{"cfg_apply_detadphiposition", false, "flag to apply deta-dphi elliptic cut at certain radius"}; Configurable cfg_min_deta{"cfg_min_deta", 0.02, "min deta between 2 electrons (elliptic cut)"}; Configurable cfg_min_dphi{"cfg_min_dphi", 0.2, "min dphi between 2 electrons (elliptic cut)"}; Configurable cfg_min_opang{"cfg_min_opang", 0.0, "min opening angle"}; @@ -215,6 +214,7 @@ struct DileptonMC { Configurable cfg_max_its_cluster_size{"cfg_max_its_cluster_size", 16.f, "max ITS cluster size"}; Configurable cfg_min_rel_diff_pin{"cfg_min_rel_diff_pin", -1e+10, "min rel. diff. between pin and ppv"}; Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; + Configurable cfgRefR{"cfgRefR", 1.2, "reference R (in m) for extrapolation"}; // https://cds.cern.ch/record/1419204 Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif = 4, kPIDML = 5]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; @@ -310,8 +310,7 @@ struct DileptonMC { } mctrackcuts; HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; - // static constexpr std::string_view event_cut_types[2] = {"before/", "after/"}; - static constexpr std::string_view acc_types[2] = {"all/", "inAcc/"}; + static constexpr std::string_view event_cut_types[2] = {"before/", "after/"}; ~DileptonMC() {} @@ -372,30 +371,33 @@ struct DileptonMC { const AxisSpec axis_aco{cfg_nbin_aco, 0, 1.f, "#alpha = 1 - #frac{|#varphi_{l^{+}} - #varphi_{l^{-}}|}{#pi}"}; // for kUPC const AxisSpec axis_asym_pt{cfg_nbin_asym_pt, 0, 1.f, "A = #frac{|p_{T,l^{+}} - p_{T,l^{-}}|}{|p_{T,l^{+}} + p_{T,l^{-}}|}"}; // for kUPC const AxisSpec axis_dphi_e_ee{cfg_nbin_dphi_e_ee, 0, M_PI, "#Delta#varphi = #varphi_{l} - #varphi_{ll} (rad.)"}; // for kUPC + const AxisSpec axis_isInAcc{2, -0.5, 1.5, "is in acc"}; // in acc or not (bool) // generated info - fRegistry.add("Generated/inAcc/sm/PromptPi0/hs", "generated dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_aco, axis_asym_pt, axis_dphi_e_ee}, true); - fRegistry.addClone("Generated/inAcc/sm/PromptPi0/", "Generated/inAcc/sm/NonPromptPi0/"); - fRegistry.addClone("Generated/inAcc/sm/PromptPi0/", "Generated/inAcc/sm/Eta/"); - fRegistry.addClone("Generated/inAcc/sm/PromptPi0/", "Generated/inAcc/sm/EtaPrime/"); - fRegistry.addClone("Generated/inAcc/sm/PromptPi0/", "Generated/inAcc/sm/Rho/"); - fRegistry.addClone("Generated/inAcc/sm/PromptPi0/", "Generated/inAcc/sm/Omega/"); - fRegistry.addClone("Generated/inAcc/sm/PromptPi0/", "Generated/inAcc/sm/Omega2ll/"); - fRegistry.addClone("Generated/inAcc/sm/PromptPi0/", "Generated/inAcc/sm/Phi/"); - fRegistry.addClone("Generated/inAcc/sm/PromptPi0/", "Generated/inAcc/sm/Phi2ll/"); - fRegistry.addClone("Generated/inAcc/sm/PromptPi0/", "Generated/inAcc/sm/PromptJPsi/"); - fRegistry.addClone("Generated/inAcc/sm/PromptPi0/", "Generated/inAcc/sm/NonPromptJPsi/"); - fRegistry.addClone("Generated/inAcc/sm/PromptPi0/", "Generated/inAcc/sm/PromptPsi2S/"); - fRegistry.addClone("Generated/inAcc/sm/PromptPi0/", "Generated/inAcc/sm/NonPromptPsi2S/"); - - fRegistry.add("Generated/inAcc/ccbar/c2l_c2l/hadron_hadron/hs", "generated dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_aco, axis_asym_pt, axis_dphi_e_ee}, true); - fRegistry.addClone("Generated/inAcc/ccbar/c2l_c2l/hadron_hadron/", "Generated/inAcc/ccbar/c2l_c2l/meson_meson/"); - fRegistry.addClone("Generated/inAcc/ccbar/c2l_c2l/hadron_hadron/", "Generated/inAcc/ccbar/c2l_c2l/baryon_baryon/"); - fRegistry.addClone("Generated/inAcc/ccbar/c2l_c2l/hadron_hadron/", "Generated/inAcc/ccbar/c2l_c2l/meson_baryon/"); - fRegistry.addClone("Generated/inAcc/ccbar/c2l_c2l/", "Generated/inAcc/bbbar/b2l_b2l/"); - fRegistry.addClone("Generated/inAcc/ccbar/c2l_c2l/", "Generated/inAcc/bbbar/b2c2l_b2c2l/"); - fRegistry.addClone("Generated/inAcc/ccbar/c2l_c2l/", "Generated/inAcc/bbbar/b2c2l_b2l_sameb/"); - fRegistry.addClone("Generated/inAcc/ccbar/c2l_c2l/", "Generated/inAcc/bbbar/b2c2l_b2l_diffb/"); // LS + fRegistry.add("Generated/sm/PromptPi0/hs", "generated dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_isInAcc}, true); + fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/NonPromptPi0/"); + fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/Eta/"); + fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/EtaPrime/"); + fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/Rho/"); + fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/Omega/"); + fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/Omega2ll/"); + fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/Phi/"); + fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/Phi2ll/"); + fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/PromptJPsi/"); + fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/NonPromptJPsi/"); + fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/PromptPsi2S/"); + fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/NonPromptPsi2S/"); + fRegistry.add("Generated/sm/Omega2ll/hPtY", "pT of #omega meson", kTH2D, {axis_y, axis_pt_meson}, true); + fRegistry.add("Generated/sm/Phi2ll/hPtY", "pT of #phi meson", kTH2D, {axis_y, axis_pt_meson}, true); + + fRegistry.add("Generated/ccbar/c2l_c2l/hadron_hadron/hs", "generated dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_isInAcc}, true); + fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", "Generated/ccbar/c2l_c2l/meson_meson/"); + fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", "Generated/ccbar/c2l_c2l/baryon_baryon/"); + fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", "Generated/ccbar/c2l_c2l/meson_baryon/"); + fRegistry.addClone("Generated/ccbar/c2l_c2l/", "Generated/bbbar/b2l_b2l/"); + fRegistry.addClone("Generated/ccbar/c2l_c2l/", "Generated/bbbar/b2c2l_b2c2l/"); + fRegistry.addClone("Generated/ccbar/c2l_c2l/", "Generated/bbbar/b2c2l_b2l_sameb/"); + fRegistry.addClone("Generated/ccbar/c2l_c2l/", "Generated/bbbar/b2c2l_b2l_diffb/"); // LS // for charmed hadrons // create 28 combinations static constexpr std::string_view charmed_mesons[] = {"Dplus", "D0", "Dsplus"}; // 411, 421, 431 @@ -407,37 +409,26 @@ struct DileptonMC { static constexpr std::string_view sum_charmed_mesons[] = {"Dpm", "D0", "Dspm"}; static constexpr std::string_view sum_charmed_baryons[] = {"Lcpm", "Xicpm", "Xic0", "Omegac0"}; - if (cfgFillAllCharm) { - for (int im = 0; im < nm; im++) { - fRegistry.addClone("Generated/inAcc/ccbar/c2l_c2l/hadron_hadron/", Form("Generated/inAcc/ccbar/c2l_c2l/%s_%s/", charmed_mesons[im].data(), anti_charmed_mesons[im].data())); - } - for (int ib = 0; ib < nb; ib++) { - fRegistry.addClone("Generated/inAcc/ccbar/c2l_c2l/hadron_hadron/", Form("Generated/inAcc/ccbar/c2l_c2l/%s_%s/", charmed_baryons[ib].data(), anti_charmed_baryons[ib].data())); - } - for (int im1 = 0; im1 < nm - 1; im1++) { - for (int im2 = im1 + 1; im2 < nm; im2++) { - fRegistry.addClone("Generated/inAcc/ccbar/c2l_c2l/hadron_hadron/", Form("Generated/inAcc/ccbar/c2l_c2l/%s_%s/", sum_charmed_mesons[im1].data(), sum_charmed_mesons[im2].data())); - } - } - for (int ib1 = 0; ib1 < nb - 1; ib1++) { - for (int ib2 = ib1 + 1; ib2 < nb; ib2++) { - fRegistry.addClone("Generated/inAcc/ccbar/c2l_c2l/hadron_hadron/", Form("Generated/inAcc/ccbar/c2l_c2l/%s_%s/", sum_charmed_baryons[ib1].data(), sum_charmed_baryons[ib2].data())); - } - } - for (int im = 0; im < nm; im++) { - for (int ib = 0; ib < nb; ib++) { - fRegistry.addClone("Generated/inAcc/ccbar/c2l_c2l/hadron_hadron/", Form("Generated/inAcc/ccbar/c2l_c2l/%s_%s/", sum_charmed_mesons[im].data(), sum_charmed_baryons[ib].data())); - } + for (int im = 0; im < nm; im++) { + fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", Form("Generated/ccbar/c2l_c2l/%s_%s/", charmed_mesons[im].data(), anti_charmed_mesons[im].data())); + } + for (int ib = 0; ib < nb; ib++) { + fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", Form("Generated/ccbar/c2l_c2l/%s_%s/", charmed_baryons[ib].data(), anti_charmed_baryons[ib].data())); + } + for (int im1 = 0; im1 < nm - 1; im1++) { + for (int im2 = im1 + 1; im2 < nm; im2++) { + fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", Form("Generated/ccbar/c2l_c2l/%s_%s/", sum_charmed_mesons[im1].data(), sum_charmed_mesons[im2].data())); } } - - if (cfgFillAllGen) { - fRegistry.addClone("Generated/inAcc/", "Generated/all/"); + for (int ib1 = 0; ib1 < nb - 1; ib1++) { + for (int ib2 = ib1 + 1; ib2 < nb; ib2++) { + fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", Form("Generated/ccbar/c2l_c2l/%s_%s/", sum_charmed_baryons[ib1].data(), sum_charmed_baryons[ib2].data())); + } } - - if (doprocessGen_VM) { - fRegistry.add("Generated/all/sm/Omega2ll/hPtY", "pT of #omega meson", kTH2D, {axis_y, axis_pt_meson}, true); - fRegistry.add("Generated/all/sm/Phi2ll/hPtY", "pT of #phi meson", kTH2D, {axis_y, axis_pt_meson}, true); + for (int im = 0; im < nm; im++) { + for (int ib = 0; ib < nb; ib++) { + fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", Form("Generated/ccbar/c2l_c2l/%s_%s/", sum_charmed_mesons[im].data(), sum_charmed_baryons[ib].data())); + } } // reconstructed pair info @@ -478,27 +469,25 @@ struct DileptonMC { fRegistry.addClone("Pair/ccbar/c2l_c2l/", "Pair/bbbar/b2c2l_b2l_sameb/"); fRegistry.addClone("Pair/ccbar/c2l_c2l/", "Pair/bbbar/b2c2l_b2l_diffb/"); // LS - if (cfgFillAllCharm) { - for (int im = 0; im < nm; im++) { - fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", Form("Pair/ccbar/c2l_c2l/%s_%s/", charmed_mesons[im].data(), anti_charmed_mesons[im].data())); - } - for (int ib = 0; ib < nb; ib++) { - fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", Form("Pair/ccbar/c2l_c2l/%s_%s/", charmed_baryons[ib].data(), anti_charmed_baryons[ib].data())); - } - for (int im1 = 0; im1 < nm - 1; im1++) { - for (int im2 = im1 + 1; im2 < nm; im2++) { - fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", Form("Pair/ccbar/c2l_c2l/%s_%s/", sum_charmed_mesons[im1].data(), sum_charmed_mesons[im2].data())); - } + for (int im = 0; im < nm; im++) { + fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", Form("Pair/ccbar/c2l_c2l/%s_%s/", charmed_mesons[im].data(), anti_charmed_mesons[im].data())); + } + for (int ib = 0; ib < nb; ib++) { + fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", Form("Pair/ccbar/c2l_c2l/%s_%s/", charmed_baryons[ib].data(), anti_charmed_baryons[ib].data())); + } + for (int im1 = 0; im1 < nm - 1; im1++) { + for (int im2 = im1 + 1; im2 < nm; im2++) { + fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", Form("Pair/ccbar/c2l_c2l/%s_%s/", sum_charmed_mesons[im1].data(), sum_charmed_mesons[im2].data())); } - for (int ib1 = 0; ib1 < nb - 1; ib1++) { - for (int ib2 = ib1 + 1; ib2 < nb; ib2++) { - fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", Form("Pair/ccbar/c2l_c2l/%s_%s/", sum_charmed_baryons[ib1].data(), sum_charmed_baryons[ib2].data())); - } + } + for (int ib1 = 0; ib1 < nb - 1; ib1++) { + for (int ib2 = ib1 + 1; ib2 < nb; ib2++) { + fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", Form("Pair/ccbar/c2l_c2l/%s_%s/", sum_charmed_baryons[ib1].data(), sum_charmed_baryons[ib2].data())); } - for (int im = 0; im < nm; im++) { - for (int ib = 0; ib < nb; ib++) { - fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", Form("Pair/ccbar/c2l_c2l/%s_%s/", sum_charmed_mesons[im].data(), sum_charmed_baryons[ib].data())); - } + } + for (int im = 0; im < nm; im++) { + for (int ib = 0; ib < nb; ib++) { + fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", Form("Pair/ccbar/c2l_c2l/%s_%s/", sum_charmed_mesons[im].data(), sum_charmed_baryons[ib].data())); } } @@ -677,7 +666,7 @@ struct DileptonMC { fDielectronCut.SetPairDCARange(dielectroncuts.cfg_min_pair_dca3d, dielectroncuts.cfg_max_pair_dca3d); // in sigma fDielectronCut.SetMaxMeePhiVDep([&](float phiv) { return dielectroncuts.cfg_phiv_intercept + phiv * dielectroncuts.cfg_phiv_slope; }, dielectroncuts.cfg_min_phiv, dielectroncuts.cfg_max_phiv); fDielectronCut.ApplyPhiV(dielectroncuts.cfg_apply_phiv); - fDielectronCut.SetMindEtadPhi(dielectroncuts.cfg_apply_detadphi, false, dielectroncuts.cfg_min_deta, dielectroncuts.cfg_min_dphi); + fDielectronCut.SetMindEtadPhi(dielectroncuts.cfg_apply_detadphi, dielectroncuts.cfg_apply_detadphiposition, dielectroncuts.cfg_min_deta, dielectroncuts.cfg_min_dphi); fDielectronCut.SetPairOpAng(dielectroncuts.cfg_min_opang, dielectroncuts.cfg_max_opang); fDielectronCut.SetRequireDifferentSides(dielectroncuts.cfg_require_diff_sides); @@ -866,7 +855,7 @@ struct DileptonMC { return false; } } - if (!cut.IsSelectedPair(t1, t2, d_bz, 0.0)) { + if (!cut.IsSelectedPair(t1, t2, d_bz, dielectroncuts.cfgRefR)) { return false; } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { @@ -1134,74 +1123,68 @@ struct DileptonMC { fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if (isCharmMeson(mp1) && isCharmMeson(mp2)) { fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - if (cfgFillAllCharm) { - if (std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 411) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dplus_Dminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if (std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 421) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_D0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if (std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 431) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dsplus_Dsminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 421) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 421)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_D0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 431)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 431)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } + if (std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 411) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dplus_Dminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if (std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 421) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_D0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if (std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 431) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dsplus_Dsminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 421) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 421)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_D0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 431)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 431)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } } else if (isCharmBaryon(mp1) && isCharmBaryon(mp2)) { fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - if (cfgFillAllCharm) { - if (std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4122) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcplus_Lcminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if (std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4232) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicplus_Xicminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if (std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4132) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xic0_Xic0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if (std::abs(mp1.pdgCode()) == 4332 && std::abs(mp2.pdgCode()) == 4332) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Omegac0_Omegac0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4132 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xic0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } + if (std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4122) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcplus_Lcminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if (std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4232) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicplus_Xicminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if (std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4132) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xic0_Xic0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if (std::abs(mp1.pdgCode()) == 4332 && std::abs(mp2.pdgCode()) == 4332) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Omegac0_Omegac0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4232)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4132)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4332)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4132)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4332)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4132 && std::abs(mp1.pdgCode()) == 4332)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xic0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } } else { fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - if (cfgFillAllCharm) { - if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } + if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4122)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4232)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4132)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4332)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4122)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4232)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4132)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4332)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4122)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4232)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4132)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4332)) { + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } } break; @@ -1347,7 +1330,7 @@ struct DileptonMC { } // end of collision loop } - template + template void runGenInfo(TCollisions const& collisions, TMCCollisions const& mccollisions, TMCLeptons const& posTracksMC, TMCLeptons const& negTracksMC, TMCParticles const& mcparticles) { for (const auto& mccollision : mccollisions) { @@ -1474,57 +1457,54 @@ struct DileptonMC { } o2::math_utils::bringToPMPi(phiPol); - if constexpr (accType == 1) { - if (!isInAcceptance(t1) || !isInAcceptance(t2)) { - continue; - } - } + bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); if (mother_id > -1) { auto mcmother = mcparticles.iteratorAt(mother_id); if (mcmother.isPhysicalPrimary() || mcmother.producedByGenerator()) { + switch (std::abs(mcmother.pdgCode())) { case 111: if (IsFromCharm(mcmother, mcparticles) < 0 && IsFromBeauty(mcmother, mcparticles) < 0) { // prompt pi0 - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("sm/PromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/PromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else { // non-prompt pi0 - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("sm/NonPromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/NonPromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; case 221: - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("sm/Eta/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/Eta/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); break; case 331: - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("sm/EtaPrime/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/EtaPrime/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); break; case 113: - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("sm/Rho/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/Rho/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); break; case 223: - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("sm/Omega/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/Omega/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); if (mcmother.daughtersIds().size() == 2) { // omega->ee - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("sm/Omega2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/Omega2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; case 333: - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("sm/Phi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/Phi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); if (mcmother.daughtersIds().size() == 2) { // phi->ee - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("sm/Phi2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/Phi2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; case 443: { if (IsFromBeauty(mcmother, mcparticles) > 0) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("sm/NonPromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/NonPromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("sm/PromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/PromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; } case 100443: { if (IsFromBeauty(mcmother, mcparticles) > 0) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("sm/NonPromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/NonPromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("sm/PromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/PromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; } @@ -1537,111 +1517,105 @@ struct DileptonMC { auto mp2 = mcparticles.iteratorAt(t2.mothersIds()[0]); switch (hfee_type) { case static_cast(EM_HFeeType::kCe_Ce): { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); if (isCharmMeson(mp1) && isCharmMeson(mp2)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - if (cfgFillAllCharm) { - if (std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 411) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Dplus_Dminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } else if (std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 421) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/D0_D0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } else if (std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 431) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Dsplus_Dsminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 421) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 421)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Dpm_D0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 431)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Dpm_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 431)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/D0_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + if (std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 411) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dplus_Dminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + } else if (std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 421) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_D0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + } else if (std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 431) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dsplus_Dsminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 421) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 421)) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_D0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 431)) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 431)) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } } else if (isCharmBaryon(mp1) && isCharmBaryon(mp2)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - if (cfgFillAllCharm) { - if (std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4122) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Lcplus_Lcminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } else if (std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4232) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Xicplus_Xicminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } else if (std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4132) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Xic0_Xic0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } else if (std::abs(mp1.pdgCode()) == 4332 && std::abs(mp2.pdgCode()) == 4332) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Omegac0_Omegac0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Lcpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Lcpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Lcpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Xicpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Xicpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4132 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Xic0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + if (std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4122) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcplus_Lcminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + } else if (std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4232) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicplus_Xicminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + } else if (std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4132) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xic0_Xic0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + } else if (std::abs(mp1.pdgCode()) == 4332 && std::abs(mp2.pdgCode()) == 4332) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Omegac0_Omegac0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4232)) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4132)) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4332)) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4132)) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4332)) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + } else if ((std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4132 && std::abs(mp1.pdgCode()) == 4332)) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xic0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } } else { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - if (cfgFillAllCharm) { - if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Dpm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Dpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Dpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Dpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/D0_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/D0_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/D0_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/D0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Dspm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Dspm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Dspm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("ccbar/c2l_c2l/Dspm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); - } + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4122)) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4232)) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4132)) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4332)) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4122)) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4232)) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4132)) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4332)) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4122)) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4232)) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4132)) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4332)) { + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } } break; } case static_cast(EM_HFeeType::kBe_Be): { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2l_b2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); if (isBeautyMeson(mp1) && isBeautyMeson(mp2)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if (isBeautyBaryon(mp1) && isBeautyBaryon(mp2)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; } case static_cast(EM_HFeeType::kBCe_BCe): { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2c2l_b2c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); if (isCharmMeson(mp1) && isCharmMeson(mp2)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if (isCharmBaryon(mp1) && isCharmBaryon(mp2)) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; } case static_cast(EM_HFeeType::kBCe_Be_SameB): { // ULS - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2c2l_b2l_sameb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2c2l_b2l_sameb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2c2l_b2l_sameb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2c2l_b2l_sameb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; } @@ -1735,6 +1709,16 @@ struct DileptonMC { // } } + // if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { + // if (v12.Rapidity() < dielectroncuts.cfg_min_pair_y || dielectroncuts.cfg_max_pair_y < v12.Rapidity()) { + // continue; + // } + // } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { + // if (v12.Rapidity() < dimuoncuts.cfg_min_pair_y || dimuoncuts.cfg_max_pair_y < v12.Rapidity()) { + // continue; + // } + // } + float aco = 1.f - std::fabs(dphi) / M_PI; float asym = std::fabs(v1.Pt() - v2.Pt()) / (v1.Pt() + v2.Pt()); float dphi_e_ee = v1.Phi() - v12.Phi(); @@ -1750,12 +1734,7 @@ struct DileptonMC { o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, -t1.pdgCode() / pdg_lepton, cos_thetaPol, phiPol); } o2::math_utils::bringToPMPi(phiPol); - - if constexpr (accType == 1) { - if (!isInAcceptance(t1) || !isInAcceptance(t2)) { - continue; - } - } + bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); if (hfee_type > -1) { auto mp1 = mcparticles.iteratorAt(t1.mothersIds()[0]); @@ -1774,13 +1753,13 @@ struct DileptonMC { LOGF(info, "You should not see kBCe_Be_SameB in LS++. Good luck."); break; case static_cast(EM_HFeeType::kBCe_Be_DiffB): { // LS - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; } @@ -1871,6 +1850,16 @@ struct DileptonMC { // } } + // if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { + // if (v12.Rapidity() < dielectroncuts.cfg_min_pair_y || dielectroncuts.cfg_max_pair_y < v12.Rapidity()) { + // continue; + // } + // } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { + // if (v12.Rapidity() < dimuoncuts.cfg_min_pair_y || dimuoncuts.cfg_max_pair_y < v12.Rapidity()) { + // continue; + // } + // } + float aco = 1.f - std::fabs(dphi) / M_PI; float asym = std::fabs(v1.Pt() - v2.Pt()) / (v1.Pt() + v2.Pt()); float dphi_e_ee = v1.Phi() - v12.Phi(); @@ -1886,12 +1875,7 @@ struct DileptonMC { o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, -t1.pdgCode() / pdg_lepton, cos_thetaPol, phiPol); } o2::math_utils::bringToPMPi(phiPol); - - if constexpr (accType == 1) { - if (!isInAcceptance(t1) || !isInAcceptance(t2)) { - continue; - } - } + bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); if (hfee_type > -1) { auto mp1 = mcparticles.iteratorAt(t1.mothersIds()[0]); @@ -1910,13 +1894,13 @@ struct DileptonMC { LOGF(info, "You should not see kBCe_Be_SameB in LS--. Good luck."); break; case static_cast(EM_HFeeType::kBCe_Be_DiffB): { // LS - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } else { - fRegistry.fill(HIST("Generated/") + HIST(acc_types[accType]) + HIST("bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); } break; } @@ -1954,7 +1938,7 @@ struct DileptonMC { } if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - if (!cut.template IsSelectedPair(t1, t2, d_bz, 0.0)) { + if (!cut.template IsSelectedPair(t1, t2, d_bz, dielectroncuts.cfgRefR)) { return false; } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { @@ -2442,10 +2426,7 @@ struct DileptonMC { fillPairWeightMap(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut, leptons, mccollisions, mcparticles); } runTruePairing(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut, leptons, mccollisions, mcparticles); - runGenInfo(collisions, mccollisions, positive_electronsMC, negative_electronsMC, mcparticles); - if (cfgFillAllGen) { - runGenInfo(collisions, mccollisions, positive_electronsMC, negative_electronsMC, mcparticles); // always false - } + runGenInfo(collisions, mccollisions, positive_electronsMC, negative_electronsMC, mcparticles); if (cfgFillUnfolding) { fillUnfolding(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut, leptons, mccollisions, mcparticles); } @@ -2454,10 +2435,7 @@ struct DileptonMC { fillPairWeightMap(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut, leptons, mccollisions, mcparticles); } runTruePairing(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut, leptons, mccollisions, mcparticles); - runGenInfo(collisions, mccollisions, positive_muonsMC, negative_muonsMC, mcparticles); - if (cfgFillAllGen) { - runGenInfo(collisions, mccollisions, positive_electronsMC, negative_electronsMC, mcparticles); // always false - } + runGenInfo(collisions, mccollisions, positive_muonsMC, negative_muonsMC, mcparticles); if (cfgFillUnfolding) { fillUnfolding(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut, leptons, mccollisions, mcparticles); } @@ -2479,10 +2457,7 @@ struct DileptonMC { fillPairWeightMap(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut, leptons, mccollisions, mcparticles_smeared); } runTruePairing(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut, leptons, mccollisions, mcparticles_smeared); - runGenInfo(collisions, mccollisions, positive_electronsMC_smeared, negative_electronsMC_smeared, mcparticles_smeared); - if (cfgFillAllGen) { - runGenInfo(collisions, mccollisions, positive_electronsMC_smeared, negative_electronsMC_smeared, mcparticles_smeared); // always false - } + runGenInfo(collisions, mccollisions, positive_electronsMC_smeared, negative_electronsMC_smeared, mcparticles_smeared); if (cfgFillUnfolding) { fillUnfolding(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut, leptons, mccollisions, mcparticles_smeared); } @@ -2491,10 +2466,7 @@ struct DileptonMC { fillPairWeightMap(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut, leptons, mccollisions, mcparticles_smeared); } runTruePairing(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut, leptons, mccollisions, mcparticles_smeared); - runGenInfo(collisions, mccollisions, positive_muonsMC_smeared, negative_muonsMC_smeared, mcparticles_smeared); - if (cfgFillAllGen) { - runGenInfo(collisions, mccollisions, positive_electronsMC_smeared, negative_electronsMC_smeared, mcparticles_smeared); // always false - } + runGenInfo(collisions, mccollisions, positive_muonsMC_smeared, negative_muonsMC_smeared, mcparticles_smeared); if (cfgFillUnfolding) { fillUnfolding(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut, leptons, mccollisions, mcparticles_smeared); } @@ -2542,10 +2514,10 @@ struct DileptonMC { switch (std::abs(mctrack.pdgCode())) { case 223: - fRegistry.fill(HIST("Generated/all/sm/Omega2ll/hPtY"), mctrack.y(), mctrack.pt(), 1.f / mctrack.dsf()); + fRegistry.fill(HIST("Generated/sm/Omega2ll/hPtY"), mctrack.y(), mctrack.pt(), 1.f / mctrack.dsf()); break; case 333: - fRegistry.fill(HIST("Generated/all/sm/Phi2ll/hPtY"), mctrack.y(), mctrack.pt(), 1.f / mctrack.dsf()); + fRegistry.fill(HIST("Generated/sm/Phi2ll/hPtY"), mctrack.y(), mctrack.pt(), 1.f / mctrack.dsf()); break; default: break; diff --git a/PWGEM/Dilepton/Core/PhotonHBT.h b/PWGEM/Dilepton/Core/PhotonHBT.h index 39938df8f0d..9948eac03a2 100644 --- a/PWGEM/Dilepton/Core/PhotonHBT.h +++ b/PWGEM/Dilepton/Core/PhotonHBT.h @@ -212,6 +212,7 @@ struct PhotonHBT { Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; Configurable cfg_require_itsib_any{"cfg_require_itsib_any", false, "flag to require ITS ib any hits"}; Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", true, "flag to require ITS ib 1st hit"}; + Configurable cfgRefR{"cfgRefR", 1.2, "reference R (in m) for extrapolation"}; // https://cds.cern.ch/record/1419204 Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif = 4, kPIDML = 5]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; @@ -865,7 +866,7 @@ struct PhotonHBT { continue; } } - if (!cut1.IsSelectedPair(pos1, ele1, d_bz, 0.0)) { + if (!cut1.IsSelectedPair(pos1, ele1, d_bz, dielectroncuts.cfgRefR)) { continue; } @@ -893,7 +894,7 @@ struct PhotonHBT { continue; } } - if (!cut2.IsSelectedPair(pos2, ele2, d_bz, 0.0)) { + if (!cut2.IsSelectedPair(pos2, ele2, d_bz, dielectroncuts.cfgRefR)) { continue; } @@ -1011,7 +1012,7 @@ struct PhotonHBT { continue; } } - if (!cut2.IsSelectedPair(pos2, ele2, d_bz, 0.0)) { + if (!cut2.IsSelectedPair(pos2, ele2, d_bz, dielectroncuts.cfgRefR)) { continue; } @@ -1379,7 +1380,7 @@ struct PhotonHBT { continue; } } - if (!cut.IsSelectedPair(pos, ele, d_bz, 0.0)) { + if (!cut.IsSelectedPair(pos, ele, d_bz, dielectroncuts.cfgRefR)) { continue; } passed_pairIds.emplace_back(std::make_pair(pos.globalIndex(), ele.globalIndex())); From 907006cd296f5980f5256dfe194fcce999b5b173 Mon Sep 17 00:00:00 2001 From: Mario Ciacco Date: Thu, 18 Sep 2025 17:23:33 +0200 Subject: [PATCH 441/986] [PWGLF] enable LS counting for +ve and -ve (#13000) --- PWGLF/TableProducer/Nuspex/ebyeMaker.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/ebyeMaker.cxx b/PWGLF/TableProducer/Nuspex/ebyeMaker.cxx index 8c1c58e272a..c7f015fce80 100644 --- a/PWGLF/TableProducer/Nuspex/ebyeMaker.cxx +++ b/PWGLF/TableProducer/Nuspex/ebyeMaker.cxx @@ -158,6 +158,12 @@ enum PartTypes { kPhysPrim = BIT(22) }; +enum TracksCharge { + kAll = 0, + kNegative = 1, + kPositive = 2 +}; + struct EbyeMaker { Produces collisionEbyeTable; Produces miniCollTable; @@ -201,7 +207,7 @@ struct EbyeMaker { Configurable etaMaxV0dau{"etaMaxV0dau", 0.8f, "maximum eta V0 daughters"}; Configurable outerPIDMin{"outerPIDMin", -4.f, "minimum outer PID"}; - Configurable countOnlyNegTrk{"countOnlyNegTrk", false, "count only negative tracks in Ntracks"}; + Configurable countOnlyLSTrk{"countOnlyLSTrk", 0, "count only like sign tracks in Ntracks: 0 -> +ve and -ve; 1 -> -ve; 2 -> +ve"}; Configurable useAllEvSel{"useAllEvSel", false, "use additional event selections fo run 3 analyses"}; Configurable triggerCut{"triggerCut", 0x0, "trigger cut to select"}; Configurable kINT7Intervals{"kINT7Intervals", false, "toggle kINT7 trigger selection in the 10-30% and 50-90% centrality intervals (2018 Pb-Pb)"}; @@ -571,7 +577,7 @@ struct EbyeMaker { continue; } histos.fill(HIST("QA/tpcSignal"), track.tpcInnerParam(), track.tpcSignal()); - if (trackPt > ptMin[0] && trackPt < ptMax[0] && ((track.sign() < 0 && countOnlyNegTrk) || !countOnlyNegTrk)) + if (trackPt > ptMin[0] && trackPt < ptMax[0] && ((track.sign() < 0 && countOnlyLSTrk == TracksCharge::kNegative) || (track.sign() > 0 && countOnlyLSTrk == TracksCharge::kPositive) || (countOnlyLSTrk == TracksCharge::kAll))) nTracksColl++; for (int iP{0}; iP < kNpart; ++iP) { @@ -856,7 +862,7 @@ struct EbyeMaker { auto genPt = std::hypot(mcPart.px(), mcPart.py()); if ((std::abs(pdgCode) == PDG_t::kPiPlus || std::abs(pdgCode) == PDG_t::kElectron || std::abs(pdgCode) == PDG_t::kMuonMinus || std::abs(pdgCode) == PDG_t::kKPlus || std::abs(pdgCode) == PDG_t::kProton) && mcPart.isPhysicalPrimary() && genPt > ptMin[0] && genPt < ptMax[0]) { int ch = (pdgCode == PDG_t::kPiPlus || pdgCode == -PDG_t::kElectron || pdgCode == -PDG_t::kMuonMinus || pdgCode == PDG_t::kKPlus || pdgCode == PDG_t::kProton) ? 1 : -1; - if ((ch < 0 && countOnlyNegTrk) || !countOnlyNegTrk) + if ((ch < 0 && countOnlyLSTrk == TracksCharge::kNegative) || (ch > 0 && countOnlyLSTrk == TracksCharge::kPositive) || (countOnlyLSTrk == TracksCharge::kAll)) nChPartGen++; } if (std::abs(pdgCode) == PDG_t::kLambda0) { From 47603e516720b38c2e0ed86fd0d3f83ee8df7d8a Mon Sep 17 00:00:00 2001 From: hernasab Date: Thu, 18 Sep 2025 19:31:46 +0200 Subject: [PATCH 442/986] [PWGCF] removed obsolete process function and added zdc function without association (#13030) Co-authored-by: Sabrina Hernandez --- PWGCF/Flow/Tasks/flowZdcTask.cxx | 238 ++++++++++++++++--------------- 1 file changed, 121 insertions(+), 117 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowZdcTask.cxx b/PWGCF/Flow/Tasks/flowZdcTask.cxx index 80844482e83..e09bfb5e9df 100644 --- a/PWGCF/Flow/Tasks/flowZdcTask.cxx +++ b/PWGCF/Flow/Tasks/flowZdcTask.cxx @@ -70,6 +70,7 @@ struct FlowZdcTask { Configurable nBinsNch{"nBinsNch", 2501, "N bins Nch (|eta|<0.8)"}; Configurable nBinsAmpFT0{"nBinsAmpFT0", 100, "N bins FT0 amp"}; Configurable maxAmpFT0{"maxAmpFT0", 2500, "Max FT0 amp"}; + Configurable maxAmpFT0M{"maxAmpFT0M", 2500, "Max FT0M amp"}; Configurable nBinsAmpFV0{"nBinsAmpFV0", 100, "N bins FV0 amp"}; Configurable maxAmpFV0{"maxAmpFV0", 2000, "Max FV0 amp"}; Configurable nBinsZDC{"nBinsZDC", 400, "nBinsZDC"}; @@ -77,7 +78,6 @@ struct FlowZdcTask { Configurable nBinsZP{"nBinsZP", 160, "N bins ZP"}; Configurable minNch{"minNch", 0, "Min Nch (|eta|<0.8)"}; Configurable maxNch{"maxNch", 2500, "Max Nch (|eta|<0.8)"}; - Configurable oneNeutron{"oneNeutron", 1.0, "one neutron, energy or integer"}; Configurable nBinsTDC{"nBinsTDC", 150, "nbinsTDC"}; Configurable minTdc{"minTdc", -15.0, "minimum TDC"}; Configurable maxTdc{"maxTdc", 15.0, "maximum TDC"}; @@ -92,23 +92,20 @@ struct FlowZdcTask { Configurable isOccupancyCut{"isOccupancyCut", true, "Occupancy cut?"}; Configurable isApplyFT0CbasedOccupancy{"isApplyFT0CbasedOccupancy", false, "T0C Occu cut?"}; Configurable isTDCcut{"isTDCcut", false, "Use TDC cut?"}; - Configurable isZEMcut{"isZEMcut", false, "Use ZEM cut?"}; Configurable useMidRapNchSel{"useMidRapNchSel", false, "Use mid-rapidity Nch selection"}; Configurable applyEff{"applyEff", true, "Apply track-by-track efficiency correction"}; Configurable applyFD{"applyFD", false, "Apply track-by-track feed down correction"}; Configurable correctNch{"correctNch", true, "Correct also Nch"}; - Configurable isOneNeutronFound{"isOneNeutronFound", true, "Require at least 1 neutron in ZNA/ZNC to fill ZPA/ZPC"}; Configurable nSigmaNchCut{"nSigmaNchCut", 1., "nSigma Nch selection"}; Configurable minNchSel{"minNchSel", 5., "min Nch Selection"}; - Configurable znBasedCut{"znBasedCut", 100, "ZN-based cut"}; - Configurable zemCut{"zemCut", 1000., "ZEM cut"}; Configurable tdcCut{"tdcCut", 1., "TDC cut"}; Configurable minOccCut{"minOccCut", 0, "min Occu cut"}; Configurable maxOccCut{"maxOccCut", 500, "max Occu cut"}; Configurable minPt{"minPt", 0.1, "minimum pt of the tracks"}; Configurable maxPt{"maxPt", 3., "maximum pt of the tracks"}; Configurable maxPtSpectra{"maxPtSpectra", 50., "maximum pt of the tracks"}; + Configurable zemCut{"zemCut", 100., "ZEM cut"}; // axis configs ConfigurableAxis axisPhi{"axisPhi", {60, 0.0, constants::math::TwoPI}, "phi axis for histograms"}; ConfigurableAxis axisMultiplicity{"axisMultiplicity", {3500, 0, 3500}, "centrality axis for histograms"}; @@ -239,7 +236,6 @@ struct FlowZdcTask { xAxis->SetBinLabel(14, "has ZDC?"); xAxis->SetBinLabel(15, "has T0?"); xAxis->SetBinLabel(16, "Within TDC cut?"); - xAxis->SetBinLabel(17, "Within ZEM cut?"); if (doprocessZdcCollAssoc) { // Check if the process function for ZDCCollAssoc is enabled histos.add("ZNAcoll", "ZNAcoll; ZNA amplitude; Entries", {HistType::kTH1F, {{nBinsAmp, -0.5, maxZn}}}); @@ -267,7 +263,7 @@ struct FlowZdcTask { if (doprocessQA) { histos.add("ZNVsFT0A", ";T0A (#times 1/100);ZNA+ZNC;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZn}}}); histos.add("ZNVsFT0C", ";T0C (#times 1/100);ZNA+ZNC;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZn}}}); - histos.add("ZNVsFT0M", ";T0A+T0C (#times 1/100);ZNA+ZNC;", kTH2F, {{{nBinsAmpFT0, 0., 3000.}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZNVsFT0M", ";T0A+T0C (#times 1/100);ZNA+ZNC;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0M}, {nBinsZDC, -0.5, maxZn}}}); histos.add("ZN", ";ZNA+ZNC;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); histos.add("ZNA", ";ZNA Amplitude;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); histos.add("ZPA", ";ZPA Amplitude;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZp}}); @@ -299,11 +295,14 @@ struct FlowZdcTask { histos.add("debunch", ";t_{ZDC}-t_{ZDA};t_{ZDC}+t_{ZDA}", kTH2F, {{{nBinsTDC, minTdc, maxTdc}, {nBinsTDC, minTdc, maxTdc}}}); histos.add("GlbTracks", "Nch", kTH1F, {{nBinsNch, minNch, maxNch}}); + histos.add("ampFT0C", ";T0C (#times 1/100);", kTH1F, {{nBinsAmpFT0, 0., maxAmpFT0}}); + histos.add("ampFT0A", ";T0A (#times 1/100);", kTH1F, {{nBinsAmpFT0, 0., maxAmpFT0}}); + histos.add("ampFT0M", ";T0A+T0C (#times 1/100);", kTH1F, {{nBinsAmpFT0, 0., maxAmpFT0M}}); + histos.add("ampFV0A", ";V0A (#times 1/100);", kTH1F, {{nBinsAmpFV0, 0., maxAmpFV0}}); histos.add("NchVsFT0C", ";T0C (#times 1/100, -3.3 < #eta < -2.1);#it{N}_{ch} (|#eta|<0.8);", kTH2F, {{{nBinsAmpFT0, 0., 950.}, {nBinsNch, minNch, maxNch}}}); - histos.add("NchVsFT0M", ";T0A+T0C (#times 1/100, -3.3 < #eta < -2.1 and 3.5 < #eta < 4.9);#it{N}_{ch} (|#eta|<0.8);", kTH2F, {{{nBinsAmpFT0, 0., 3000.}, {nBinsNch, minNch, maxNch}}}); + histos.add("NchVsFT0M", ";T0A+T0C (#times 1/100, -3.3 < #eta < -2.1 and 3.5 < #eta < 4.9);#it{N}_{ch} (|#eta|<0.8);", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0M}, {nBinsNch, minNch, maxNch}}}); histos.add("NchVsFT0A", ";T0A (#times 1/100, 3.5 < #eta < 4.9);#it{N}_{ch} (|#eta|<0.8);", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsNch, minNch, maxNch}}}); histos.add("NchVsFV0A", ";V0A (#times 1/100, 2.2 < #eta < 5);#it{N}_{ch} (|#eta|<0.8);", kTH2F, {{{nBinsAmpFV0, 0., maxAmpFV0}, {nBinsNch, minNch, maxNch}}}); - histos.add("NchVsEt", ";#it{E}_{T} (|#eta|<0.8);#LTITS+TPC tracks#GT (|#eta|<0.8);", kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsNch, minNch, maxNch}}}); histos.add("NchVsMeanPt", ";#it{N}_{ch} (|#eta|<0.8);#LT[#it{p}_{T}]#GT (|#eta|<0.8);", kTProfile, {{nBinsNch, minNch, maxNch}}); histos.add("NchVsNPV", ";#it{N}_{PV} (|#eta|<1);ITS+TPC tracks (|#eta|<0.8);", kTH2F, {{{300, -0.5, 5999.5}, {nBinsNch, minNch, maxNch}}}); @@ -319,6 +318,20 @@ struct FlowZdcTask { histos.add("pZPAvsGlbTrack", ";Global Tracks (ITS + TPC);ZPA Amplitude", kTProfile, {{nBinsNch, minNch, maxNch}}); histos.add("pZPCvsGlbTrack", ";Global Tracks (ITS + TPC);ZPC Amplitude", kTProfile, {{nBinsNch, minNch, maxNch}}); } + if (doprocessZdc) { + histos.add("commonZna", ";ZNA Common Energy;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); + histos.add("commonZpa", ";ZPA Common Energy;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZp}}); + histos.add("commonZnc", ";ZNC Common Energy;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); + histos.add("commonZpc", ";ZPC Common Energy;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZp}}); + histos.add("sectorZna", ";ZNA;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); + histos.add("sectorZpa", ";ZPA;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZp}}); + histos.add("sectorZnc", ";ZNC;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); + histos.add("sectorZpc", ";ZPC;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZp}}); + histos.add("ampZna", ";ZNA Amplitude;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); + histos.add("ampZpa", ";ZPA Amplitude;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZp}}); + histos.add("ampZnc", ";ZNC Amplitude;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); + histos.add("ampZpc", ";ZPC Amplitude;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZp}}); + } ccdb->setURL("http://alice-ccdb.cern.ch"); // Enabling object caching, otherwise each call goes to the CCDB server @@ -442,8 +455,6 @@ struct FlowZdcTask { for (const auto& amplitude : foundBC.fv0a().amplitude()) { aV0A += amplitude; } - } else { - aV0A = -999.; } float tZNA{zdc.timeZNA()}; float tZNC{zdc.timeZNC()}; @@ -466,6 +477,10 @@ struct FlowZdcTask { float tZEM1{zdc.timeZEM1()}; float tZEM2{zdc.timeZEM2()}; float sumZNs{znA + znC}; + float sumZNC = ((zdc.energySectorZNC())[0] + (zdc.energySectorZNC())[1] + (zdc.energySectorZNC())[2] + (zdc.energySectorZNC())[3]) / cfgCollisionEnergy; + float sumZNA = ((zdc.energySectorZNA())[0] + (zdc.energySectorZNA())[1] + (zdc.energySectorZNA())[2] + (zdc.energySectorZNA())[3]) / cfgCollisionEnergy; + float sumZPC = ((zdc.energySectorZPC())[0] + (zdc.energySectorZPC())[1] + (zdc.energySectorZPC())[2] + (zdc.energySectorZPC())[3]) / cfgCollisionEnergy; + float sumZPA = ((zdc.energySectorZPA())[0] + (zdc.energySectorZPA())[1] + (zdc.energySectorZPA())[2] + (zdc.energySectorZPA())[3]) / cfgCollisionEnergy; // TDC cut if (isTDCcut) { @@ -475,23 +490,10 @@ struct FlowZdcTask { histos.fill(HIST("hEventCounter"), EvCutLabel::Tdc); } - // ZEM cut - if (isZEMcut) { - if (sumZEMs < zemCut) { - return; - } - histos.fill(HIST("hEventCounter"), EvCutLabel::Zem); - } - - float sumZNC = (zdc.energySectorZNC())[0] + (zdc.energySectorZNC())[1] + (zdc.energySectorZNC())[2] + (zdc.energySectorZNC())[3]; - float sumZNA = (zdc.energySectorZNA())[0] + (zdc.energySectorZNA())[1] + (zdc.energySectorZNA())[2] + (zdc.energySectorZNA())[3]; - float sumZPC = (zdc.energySectorZPC())[0] + (zdc.energySectorZPC())[1] + (zdc.energySectorZPC())[2] + (zdc.energySectorZPC())[3]; - float sumZPA = (zdc.energySectorZPA())[0] + (zdc.energySectorZPA())[1] + (zdc.energySectorZPA())[2] + (zdc.energySectorZPA())[3]; - float et = 0., meanpt = 0.; int itsTracks = 0, glbTracks = 0; for (const auto& track : tracks) { - if (track.hasITS()) { + if (track.hasITS() && ((track.eta() > minEta) && (track.eta() < maxEta))) { itsTracks++; } // Track Selection @@ -501,6 +503,9 @@ struct FlowZdcTask { if ((track.pt() < minPt) || (track.pt() > maxPt)) { continue; } + if ((track.eta() < minEta) || (track.eta() > maxEta)) { + continue; + } glbTracks++; } bool skipEvent{false}; @@ -542,7 +547,9 @@ struct FlowZdcTask { if ((track.pt() < minPt) || (track.pt() > maxPtSpectra)) { continue; } - + if ((track.eta() < minEta) || (track.eta() > maxEta)) { + continue; + } histos.fill(HIST("ZposVsEta"), collision.posZ(), track.eta()); histos.fill(HIST("EtaVsPhi"), track.eta(), track.phi()); histos.fill(HIST("dcaXYvspT"), track.dcaXY(), track.pt()); @@ -551,76 +558,69 @@ struct FlowZdcTask { } histos.fill(HIST("zPos"), collision.posZ()); histos.fill(HIST("T0Ccent"), collision.centFT0C()); - histos.fill(HIST("ZNCcvsZNCsum"), sumZNC / cfgCollisionEnergy, zdc.energyCommonZNC() / cfgCollisionEnergy); - histos.fill(HIST("ZNAcvsZNAsum"), sumZNA / cfgCollisionEnergy, zdc.energyCommonZNA() / cfgCollisionEnergy); - histos.fill(HIST("ZPCcvsZPCsum"), sumZPC / cfgCollisionEnergy, zdc.energyCommonZPC() / cfgCollisionEnergy); - histos.fill(HIST("ZPAcvsZPAsum"), sumZPA / cfgCollisionEnergy, zdc.energyCommonZPA() / cfgCollisionEnergy); histos.fill(HIST("GlbTracks"), glbTracks); - // Neutron ZDC - histos.fill(HIST("ZNA"), znA); - histos.fill(HIST("ZNC"), znC); - histos.fill(HIST("ZNACommon"), commonSumZna); - histos.fill(HIST("ZNCCommon"), commonSumZnc); - histos.fill(HIST("ZNASector"), sumZNA / cfgCollisionEnergy); - histos.fill(HIST("ZNCSector"), sumZNC / cfgCollisionEnergy); - histos.fill(HIST("ZN"), znA + znC); - histos.fill(HIST("ZNVsZEM"), sumZEMs, sumZNs); - histos.fill(HIST("ZNCVstdc"), tZNC, znC); - histos.fill(HIST("ZNAVstdc"), tZNA, znA); - histos.fill(HIST("ZPCVstdc"), tZPC, zpC); - histos.fill(HIST("ZNVsFT0A"), aT0A / 100., sumZNs); - histos.fill(HIST("ZNVsFT0C"), aT0C / 100., sumZNs); - histos.fill(HIST("ZNVsFT0M"), (aT0A + aT0C) / 100., sumZNs); - - // Proton ZDC - if (!isOneNeutronFound || znA >= oneNeutron) { + if (sumZEMs > zemCut) { + histos.fill(HIST("ZNA"), znA); + histos.fill(HIST("ZNC"), znC); + histos.fill(HIST("ZNACommon"), commonSumZna); + histos.fill(HIST("ZNCCommon"), commonSumZnc); + histos.fill(HIST("ZNASector"), sumZNA); + histos.fill(HIST("ZNCSector"), sumZNC); + histos.fill(HIST("ZN"), znA + znC); + histos.fill(HIST("ZNVsZEM"), sumZEMs, sumZNs); + histos.fill(HIST("ZNCVstdc"), tZNC, znC); + histos.fill(HIST("ZNAVstdc"), tZNA, znA); + histos.fill(HIST("ZPCVstdc"), tZPC, zpC); + histos.fill(HIST("ZNVsFT0A"), aT0A / 100., sumZNs); + histos.fill(HIST("ZNVsFT0C"), aT0C / 100., sumZNs); + histos.fill(HIST("ZNVsFT0M"), (aT0A + aT0C) / 100., sumZNs); histos.fill(HIST("ZPA"), zpA); histos.fill(HIST("ZPACommon"), commonSumZpa); - histos.fill(HIST("ZPASector"), sumZPA / cfgCollisionEnergy); + histos.fill(HIST("ZPASector"), sumZPA); histos.fill(HIST("ZPAVstdc"), tZPA, zpA); histos.fill(HIST("ZPAvsCent"), cent, zpA); - if (std::isfinite(zpA) && !std::isnan(zpA) && - cent >= minT0CcentCut && cent < maxT0CcentCut && glbTracks >= minNch && glbTracks < maxNch) { - histos.fill(HIST("pZPAvsFT0Ccent"), cent, zpA); - histos.fill(HIST("pZPAvsGlbTrack"), glbTracks, zpA); - } - } - if (!isOneNeutronFound || znC >= oneNeutron) { histos.fill(HIST("ZPC"), zpC); histos.fill(HIST("ZPCCommon"), commonSumZpc); - histos.fill(HIST("ZPCSector"), sumZPC / cfgCollisionEnergy); + histos.fill(HIST("ZPCSector"), sumZPC); histos.fill(HIST("ZPCvsCent"), cent, zpC); - if (std::isfinite(zpC) && !std::isnan(zpC) && - cent >= minT0CcentCut && cent < maxT0CcentCut && glbTracks >= minNch && glbTracks < maxNch) { + histos.fill(HIST("debunch"), tZDCdif, tZDCsum); + if (std::isfinite(zpA) && !std::isnan(zpA) && cent >= minT0CcentCut && cent < maxT0CcentCut && glbTracks >= minNch && glbTracks < maxNch) { + histos.fill(HIST("pZPAvsFT0Ccent"), cent, zpA); + histos.fill(HIST("pZPAvsGlbTrack"), glbTracks, zpA); + } + if (std::isfinite(zpC) && !std::isnan(zpC) && cent >= minT0CcentCut && cent < maxT0CcentCut && glbTracks >= minNch && glbTracks < maxNch) { histos.fill(HIST("pZPCvsFT0Ccent"), cent, zpC); histos.fill(HIST("pZPCvsGlbTrack"), glbTracks, zpC); } - } - - // ZDC Correlations - histos.fill(HIST("ZNAVsZNC"), znC, znA); - histos.fill(HIST("ZNAVsZPA"), zpA, znA); - histos.fill(HIST("ZNCVsZPC"), zpC, znC); - histos.fill(HIST("ZPAVsZPC"), zpC, zpA); - histos.fill(HIST("ZEM1Vstdc"), tZEM1, aZEM1); - histos.fill(HIST("ZEM2Vstdc"), tZEM2, aZEM2); - histos.fill(HIST("debunch"), tZDCdif, tZDCsum); - - if (sumZNs > znBasedCut) { - return; - } + // ZDC Correlations + histos.fill(HIST("ZNAVsZNC"), znC, znA); + histos.fill(HIST("ZNAVsZPA"), zpA, znA); + histos.fill(HIST("ZNCVsZPC"), zpC, znC); + histos.fill(HIST("ZPAVsZPC"), zpC, zpA); + histos.fill(HIST("ZEM1Vstdc"), tZEM1, aZEM1); + histos.fill(HIST("ZEM2Vstdc"), tZEM2, aZEM2); + histos.fill(HIST("ZNAVsNch"), glbTracks, znA); + histos.fill(HIST("ZNCVsNch"), glbTracks, znC); + histos.fill(HIST("ZNVsNch"), glbTracks, sumZNs); + histos.fill(HIST("ZNDifVsNch"), glbTracks, znA - znC); + histos.fill(HIST("ZNCcvsZNCsum"), sumZNC, zdc.energyCommonZNC()); + histos.fill(HIST("ZNAcvsZNAsum"), sumZNA, zdc.energyCommonZNA()); + histos.fill(HIST("ZPCcvsZPCsum"), sumZPC, zdc.energyCommonZPC()); + histos.fill(HIST("ZPAcvsZPAsum"), sumZPA, zdc.energyCommonZPA()); + } + + histos.fill(HIST("ampFT0C"), aT0C / 100.); + histos.fill(HIST("ampFT0A"), aT0A / 100.); + histos.fill(HIST("ampFT0M"), (aT0A + aT0C) / 100.); + histos.fill(HIST("ampFV0A"), aV0A / 100.); + // charged particle correlations histos.fill(HIST("NchVsFV0A"), aV0A / 100., glbTracks); histos.fill(HIST("NchVsFT0A"), aT0A / 100., glbTracks); histos.fill(HIST("NchVsFT0C"), aT0C / 100., glbTracks); histos.fill(HIST("NchVsFT0M"), (aT0A + aT0C) / 100., glbTracks); - histos.fill(HIST("NchVsEt"), et, glbTracks); histos.fill(HIST("NchVsITStracks"), itsTracks, glbTracks); - histos.fill(HIST("ZNAVsNch"), glbTracks, znA); - histos.fill(HIST("ZNCVsNch"), glbTracks, znC); - histos.fill(HIST("ZNVsNch"), glbTracks, sumZNs); - histos.fill(HIST("ZNDifVsNch"), glbTracks, znA - znC); if (glbTracks >= minNchSel) { histos.fill(HIST("NchVsMeanPt"), glbTracks, meanpt / glbTracks); } @@ -658,26 +658,22 @@ struct FlowZdcTask { const auto cent = collision.centFT0C(); // ZDC data and histogram filling - float znA = zdcread.amplitudeZNA(); - float znC = zdcread.amplitudeZNC(); - float zpA = zdcread.amplitudeZPA(); - float zpC = zdcread.amplitudeZPC(); + float znA = zdcread.amplitudeZNA() / cfgCollisionEnergy; + float znC = zdcread.amplitudeZNC() / cfgCollisionEnergy; + float zpA = zdcread.amplitudeZPA() / cfgCollisionEnergy; + float zpC = zdcread.amplitudeZPC() / cfgCollisionEnergy; float tZNA{zdcread.timeZNA()}; float tZNC{zdcread.timeZNC()}; float tZPA{zdcread.timeZPA()}; float tZPC{zdcread.timeZPC()}; float tZDCdif{tZNC + tZPC - tZNA - tZPA}; float tZDCsum{tZNC + tZPC + tZNA + tZPA}; - float sumZNC = (zdcread.energySectorZNC())[0] + (zdcread.energySectorZNC())[1] + (zdcread.energySectorZNC())[2] + (zdcread.energySectorZNC())[3]; - float sumZNA = (zdcread.energySectorZNA())[0] + (zdcread.energySectorZNA())[1] + (zdcread.energySectorZNA())[2] + (zdcread.energySectorZNA())[3]; - float sumZPC = (zdcread.energySectorZPC())[0] + (zdcread.energySectorZPC())[1] + (zdcread.energySectorZPC())[2] + (zdcread.energySectorZPC())[3]; - float sumZPA = (zdcread.energySectorZPA())[0] + (zdcread.energySectorZPA())[1] + (zdcread.energySectorZPA())[2] + (zdcread.energySectorZPA())[3]; + float sumZNC = ((zdcread.energySectorZNC())[0] + (zdcread.energySectorZNC())[1] + (zdcread.energySectorZNC())[2] + (zdcread.energySectorZNC())[3]) / cfgCollisionEnergy; + float sumZNA = ((zdcread.energySectorZNA())[0] + (zdcread.energySectorZNA())[1] + (zdcread.energySectorZNA())[2] + (zdcread.energySectorZNA())[3]) / cfgCollisionEnergy; + float sumZPC = ((zdcread.energySectorZPC())[0] + (zdcread.energySectorZPC())[1] + (zdcread.energySectorZPC())[2] + (zdcread.energySectorZPC())[3]) / cfgCollisionEnergy; + float sumZPA = ((zdcread.energySectorZPA())[0] + (zdcread.energySectorZPA())[1] + (zdcread.energySectorZPA())[2] + (zdcread.energySectorZPA())[3]) / cfgCollisionEnergy; float sumZDC = sumZPA + sumZPC + sumZNA + sumZNC; float sumZEM = zdcread.amplitudeZEM1() + zdcread.amplitudeZEM2(); - znA /= cfgCollisionEnergy; - znC /= cfgCollisionEnergy; - zpA /= cfgCollisionEnergy; - zpC /= cfgCollisionEnergy; float sumZNs{znA + znC}; float sumZPs{zpA + zpC}; // TDC cut @@ -687,17 +683,11 @@ struct FlowZdcTask { } histos.fill(HIST("hEventCounter"), EvCutLabel::Tdc); } - // ZEM cut - if (isZEMcut) { - if (sumZEM < zemCut) { - return; - } - } // common energies - float commonSumZnc = (zdcread.energyCommonZNC()); - float commonSumZna = (zdcread.energyCommonZNA()); - float commonSumZpc = (zdcread.energyCommonZPC()); - float commonSumZpa = (zdcread.energyCommonZPA()); + float commonSumZnc = zdcread.energyCommonZNC() / cfgCollisionEnergy; + float commonSumZna = zdcread.energyCommonZNA() / cfgCollisionEnergy; + float commonSumZpc = zdcread.energyCommonZPC() / cfgCollisionEnergy; + float commonSumZpa = zdcread.energyCommonZPA() / cfgCollisionEnergy; float sumZN = (sumZNC) + (sumZNA); float sumZP = (sumZPC) + (sumZPA); @@ -816,28 +806,42 @@ struct FlowZdcTask { histos.get(HIST("ZDC_energy_vs_ZEM"))->Fill(sumZEM, sumZDC); } - void processCorrelation(CollisionDataTable::iterator const& collision, FilTrackDataTable const& tracks) + void processZdc(aod::Zdc const& zdc) { - if (!isEventSelected(collision)) { - return; - } - if (std::abs(collision.posZ()) >= vtxRange) { - return; - } - histos.fill(HIST("VtxZHist"), collision.posZ()); - auto nchTracks = 0; - for (const auto& track : tracks) { - if (std::abs(track.eta()) >= etaRange) { - continue; - } - nchTracks++; + auto znA = zdc.amplitudeZNA() / cfgCollisionEnergy; + auto znC = zdc.amplitudeZNC() / cfgCollisionEnergy; + auto zpA = zdc.amplitudeZPA() / cfgCollisionEnergy; + auto zpC = zdc.amplitudeZPC() / cfgCollisionEnergy; + float sumZNC = ((zdc.energySectorZNC())[0] + (zdc.energySectorZNC())[1] + (zdc.energySectorZNC())[2] + (zdc.energySectorZNC())[3]) / cfgCollisionEnergy; + float sumZNA = ((zdc.energySectorZNA())[0] + (zdc.energySectorZNA())[1] + (zdc.energySectorZNA())[2] + (zdc.energySectorZNA())[3]) / cfgCollisionEnergy; + float sumZPC = ((zdc.energySectorZPC())[0] + (zdc.energySectorZPC())[1] + (zdc.energySectorZPC())[2] + (zdc.energySectorZPC())[3]) / cfgCollisionEnergy; + float sumZPA = ((zdc.energySectorZPA())[0] + (zdc.energySectorZPA())[1] + (zdc.energySectorZPA())[2] + (zdc.energySectorZPA())[3]) / cfgCollisionEnergy; + float commonSumZnc = zdc.energyCommonZNC() / cfgCollisionEnergy; + float commonSumZna = zdc.energyCommonZNA() / cfgCollisionEnergy; + float commonSumZpc = zdc.energyCommonZPC() / cfgCollisionEnergy; + float commonSumZpa = zdc.energyCommonZPA() / cfgCollisionEnergy; + float aZEM1 = zdc.amplitudeZEM1(); + float aZEM2 = zdc.amplitudeZEM2(); + float sumZEMs = aZEM1 + aZEM2; + if (sumZEMs > zemCut) { + histos.fill(HIST("ampZna"), znA); + histos.fill(HIST("ampZnc"), znC); + histos.fill(HIST("commonZna"), commonSumZna); + histos.fill(HIST("commonZnc"), commonSumZnc); + histos.fill(HIST("sectorZna"), sumZNA); + histos.fill(HIST("sectorZnc"), sumZNC); + // fill histos for proton zdc + histos.fill(HIST("ampZpa"), zpA); + histos.fill(HIST("commonZpa"), commonSumZpa); + histos.fill(HIST("sectorZpa"), sumZPA); + histos.fill(HIST("ampZpc"), zpC); + histos.fill(HIST("commonZpc"), commonSumZpc); + histos.fill(HIST("sectorZpc"), sumZPC); } - histos.fill(HIST("GlobalMult_vs_FT0C"), nchTracks, collision.multFT0C()); } - PROCESS_SWITCH(FlowZdcTask, processZdcCollAssoc, "Processing ZDC w. collision association", false); PROCESS_SWITCH(FlowZdcTask, processQA, "Process QA", true); - PROCESS_SWITCH(FlowZdcTask, processCorrelation, "Process correlations", true); + PROCESS_SWITCH(FlowZdcTask, processZdc, "Process ZDC without corrections or associations", true); }; // end of struct function From a4d6a4fed8985ee8a6c963fbf412019ebd197eaa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 18 Sep 2025 20:19:26 +0200 Subject: [PATCH 443/986] [Infrastructure] Bump actions/labeler from 5 to 6 (#12894) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/labeler.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 3f8fa9bc1b6..6ea6ff04aed 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Label the PR id: labeler - uses: actions/labeler@v5 + uses: actions/labeler@v6 with: repo-token: ${{ secrets.GITHUB_TOKEN }} sync-labels: true From 077210de9542867663f8e08197cb91666cc74745 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Thu, 18 Sep 2025 20:45:52 +0200 Subject: [PATCH 444/986] [PWGLF] Address linter warnings (#13020) Co-authored-by: ALICE Builder --- .../Strangeness/strangenesstofpid.cxx | 2 + PWGLF/Utils/strangenessBuilderModule.h | 80 ++++++++++--------- 2 files changed, 43 insertions(+), 39 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx index 09a468e3880..d665eb6756c 100644 --- a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx @@ -57,7 +57,9 @@ #include #include #include +#include #include +#include using namespace o2; using namespace o2::framework; diff --git a/PWGLF/Utils/strangenessBuilderModule.h b/PWGLF/Utils/strangenessBuilderModule.h index e49ed71f14b..7319e29c04e 100644 --- a/PWGLF/Utils/strangenessBuilderModule.h +++ b/PWGLF/Utils/strangenessBuilderModule.h @@ -13,12 +13,12 @@ /// \brief strangeness builder module /// \author ALICE -// simple checkers, but ensure 8 bit integers -#define BITSET(var, nbit) ((var) |= (static_cast(1) << static_cast(nbit))) - #ifndef PWGLF_UTILS_STRANGENESSBUILDERMODULE_H_ #define PWGLF_UTILS_STRANGENESSBUILDERMODULE_H_ +// simple checkers, but ensure 8 bit integers +#define BITSET(var, nbit) ((var) |= (static_cast(1) << static_cast(nbit))) + #include "TableHelper.h" #include "PWGLF/DataModel/LFStrangenessTables.h" @@ -39,6 +39,7 @@ #include #include #include +#include //__________________________________________ // strangeness builder module @@ -531,7 +532,8 @@ class BuilderModule nEnabledTables = 0; - TString listOfRequestors[nTables]; + constexpr int kTablesConst = nTables; // silence warning + TString listOfRequestors[kTablesConst]; for (int i = 0; i < nTables; i++) { int f = baseOpts.enabledTables->get(tableNames[i].c_str(), "enable"); if (f == 1) { @@ -986,10 +988,10 @@ class BuilderModule bool trackIsInteresting = false; if ( - (originParticle.pdgCode() == 310 && v0BuilderOpts.mc_addGeneratedK0Short.value > 0) || - (originParticle.pdgCode() == 3122 && v0BuilderOpts.mc_addGeneratedLambda.value > 0) || - (originParticle.pdgCode() == -3122 && v0BuilderOpts.mc_addGeneratedAntiLambda.value > 0) || - (originParticle.pdgCode() == 22 && v0BuilderOpts.mc_addGeneratedGamma.value > 0)) { + (originParticle.pdgCode() == PDG_t::kK0Short && v0BuilderOpts.mc_addGeneratedK0Short.value > 0) || + (originParticle.pdgCode() == PDG_t::kLambda0 && v0BuilderOpts.mc_addGeneratedLambda.value > 0) || + (originParticle.pdgCode() == PDG_t::kLambda0Bar && v0BuilderOpts.mc_addGeneratedAntiLambda.value > 0) || + (originParticle.pdgCode() == PDG_t::kGamma && v0BuilderOpts.mc_addGeneratedGamma.value > 0)) { trackIsInteresting = true; } if (!trackIsInteresting) { @@ -1039,7 +1041,7 @@ class BuilderModule currentV0Entry.pdgCode = positiveTrackIndex.pdgCode; currentV0Entry.particleId = positiveTrackIndex.originId; currentV0Entry.isCollinearV0 = false; - if (v0BuilderOpts.mc_addGeneratedGammaMakeCollinear.value && currentV0Entry.pdgCode == 22) { + if (v0BuilderOpts.mc_addGeneratedGammaMakeCollinear.value && currentV0Entry.pdgCode == PDG_t::kGamma) { currentV0Entry.isCollinearV0 = true; } currentV0Entry.found = false; @@ -1061,7 +1063,7 @@ class BuilderModule currentV0Entry.pdgCode = positiveTrackIndex.pdgCode; currentV0Entry.particleId = positiveTrackIndex.originId; currentV0Entry.isCollinearV0 = false; - if (v0BuilderOpts.mc_addGeneratedGammaMakeCollinear.value && currentV0Entry.pdgCode == 22) { + if (v0BuilderOpts.mc_addGeneratedGammaMakeCollinear.value && currentV0Entry.pdgCode == PDG_t::kGamma) { currentV0Entry.isCollinearV0 = true; } currentV0Entry.found = false; @@ -1137,10 +1139,10 @@ class BuilderModule bool trackIsInteresting = false; if ( - (originParticle.pdgCode() == 3312 && cascadeBuilderOpts.mc_addGeneratedXiMinus.value > 0) || - (originParticle.pdgCode() == -3312 && cascadeBuilderOpts.mc_addGeneratedXiPlus.value > 0) || - (originParticle.pdgCode() == 3334 && cascadeBuilderOpts.mc_addGeneratedOmegaMinus.value > 0) || - (originParticle.pdgCode() == -3334 && cascadeBuilderOpts.mc_addGeneratedOmegaPlus.value > 0)) { + (originParticle.pdgCode() == PDG_t::kXiMinus && cascadeBuilderOpts.mc_addGeneratedXiMinus.value > 0) || + (originParticle.pdgCode() == PDG_t::kXiPlusBar && cascadeBuilderOpts.mc_addGeneratedXiPlus.value > 0) || + (originParticle.pdgCode() == PDG_t::kOmegaMinus && cascadeBuilderOpts.mc_addGeneratedOmegaMinus.value > 0) || + (originParticle.pdgCode() == PDG_t::kOmegaPlusBar && cascadeBuilderOpts.mc_addGeneratedOmegaPlus.value > 0)) { trackIsInteresting = true; } if (!trackIsInteresting) { @@ -1160,7 +1162,7 @@ class BuilderModule for (size_t v0i = 0; v0i < v0List.size(); v0i++) { auto v0 = v0List[sorted_v0[v0i]]; - if (std::abs(v0.pdgCode) != 3122) { + if (std::abs(v0.pdgCode) != PDG_t::kLambda0) { continue; // this V0 isn't a lambda, can't come from a cascade: skip } if (v0.particleId < 0) { @@ -1182,7 +1184,7 @@ class BuilderModule } auto v0OriginParticle = mcParticles.rawIteratorAt(v0OriginParticleIndex); - if (std::abs(v0OriginParticle.pdgCode()) != 3312 && std::abs(v0OriginParticle.pdgCode()) != 3334) { + if (std::abs(v0OriginParticle.pdgCode()) != PDG_t::kXiMinus && std::abs(v0OriginParticle.pdgCode()) != PDG_t::kOmegaMinus) { continue; // this V0 does not come from any particle of interest, don't try } for (const auto& bachelorTrackIndex : bachelorTrackArray) { @@ -1693,10 +1695,10 @@ class BuilderModule continue; // skip secondary MC V0s if ( - (v0BuilderOpts.mc_addGeneratedK0Short && mcParticle.pdgCode() == 310) || - (v0BuilderOpts.mc_addGeneratedLambda && mcParticle.pdgCode() == 3122) || - (v0BuilderOpts.mc_addGeneratedAntiLambda && mcParticle.pdgCode() == -3122) || - (v0BuilderOpts.mc_addGeneratedGamma && mcParticle.pdgCode() == 22)) { + (v0BuilderOpts.mc_addGeneratedK0Short && mcParticle.pdgCode() == PDG_t::kK0Short) || + (v0BuilderOpts.mc_addGeneratedLambda && mcParticle.pdgCode() == PDG_t::kLambda0) || + (v0BuilderOpts.mc_addGeneratedAntiLambda && mcParticle.pdgCode() == PDG_t::kLambda0Bar) || + (v0BuilderOpts.mc_addGeneratedGamma && mcParticle.pdgCode() == PDG_t::kGamma)) { thisInfo.pdgCode = mcParticle.pdgCode(); thisInfo.isPhysicalPrimary = mcParticle.isPhysicalPrimary(); thisInfo.label = mcParticle.globalIndex(); @@ -1719,7 +1721,7 @@ class BuilderModule auto const& daughters = mcParticle.template daughters_as(); for (const auto& dau : daughters) { - if (dau.getProcess() != 4) + if (dau.getProcess() != TMCProcess::kPDecay) continue; if (dau.pdgCode() > 0) { @@ -2137,13 +2139,13 @@ class BuilderModule bool bbTag = false; if (bachTrack.has_mcParticle()) { auto bachelorParticle = bachTrack.template mcParticle_as(); - if (bachelorParticle.pdgCode() == 211) { // pi+, look for antiproton in negative prong + if (bachelorParticle.pdgCode() == PDG_t::kPiPlus) { // pi+, look for antiproton in negative prong if (negTrack.has_mcParticle()) { auto baryonParticle = negTrack.template mcParticle_as(); - if (baryonParticle.has_mothers() && bachelorParticle.has_mothers() && baryonParticle.pdgCode() == -2212) { + if (baryonParticle.has_mothers() && bachelorParticle.has_mothers() && baryonParticle.pdgCode() == PDG_t::kProtonBar) { for (const auto& baryonMother : baryonParticle.template mothers_as()) { for (const auto& pionMother : bachelorParticle.template mothers_as()) { - if (baryonMother.globalIndex() == pionMother.globalIndex() && baryonMother.pdgCode() == -3122) { + if (baryonMother.globalIndex() == pionMother.globalIndex() && baryonMother.pdgCode() == PDG_t::kLambda0Bar) { bbTag = true; } } @@ -2151,13 +2153,13 @@ class BuilderModule } } } // end if-pion - if (bachelorParticle.pdgCode() == -211) { // pi-, look for proton in positive prong + if (bachelorParticle.pdgCode() == PDG_t::kPiMinus) { // pi-, look for proton in positive prong if (posTrack.has_mcParticle()) { auto baryonParticle = posTrack.template mcParticle_as(); - if (baryonParticle.has_mothers() && bachelorParticle.has_mothers() && baryonParticle.pdgCode() == 2212) { + if (baryonParticle.has_mothers() && bachelorParticle.has_mothers() && baryonParticle.pdgCode() == PDG_t::kProton) { for (const auto& baryonMother : baryonParticle.template mothers_as()) { for (const auto& pionMother : bachelorParticle.template mothers_as()) { - if (baryonMother.globalIndex() == pionMother.globalIndex() && baryonMother.pdgCode() == 3122) { + if (baryonMother.globalIndex() == pionMother.globalIndex() && baryonMother.pdgCode() == PDG_t::kLambda0) { bbTag = true; } } @@ -2207,10 +2209,10 @@ class BuilderModule continue; // skip secondary MC cascades if ( - (cascadeBuilderOpts.mc_addGeneratedXiMinus && mcParticle.pdgCode() == 3312) || - (cascadeBuilderOpts.mc_addGeneratedXiPlus && mcParticle.pdgCode() == -3312) || - (cascadeBuilderOpts.mc_addGeneratedOmegaMinus && mcParticle.pdgCode() == 3334) || - (cascadeBuilderOpts.mc_addGeneratedOmegaPlus && mcParticle.pdgCode() == -3334)) { + (cascadeBuilderOpts.mc_addGeneratedXiMinus && mcParticle.pdgCode() == PDG_t::kXiMinus) || + (cascadeBuilderOpts.mc_addGeneratedXiPlus && mcParticle.pdgCode() == PDG_t::kXiPlusBar) || + (cascadeBuilderOpts.mc_addGeneratedOmegaMinus && mcParticle.pdgCode() == PDG_t::kOmegaMinus) || + (cascadeBuilderOpts.mc_addGeneratedOmegaPlus && mcParticle.pdgCode() == PDG_t::kOmegaPlusBar)) { thisCascInfo.pdgCode = mcParticle.pdgCode(); thisCascInfo.isPhysicalPrimary = mcParticle.isPhysicalPrimary(); @@ -2225,10 +2227,10 @@ class BuilderModule if (mcParticle.has_daughters()) { auto const& daughters = mcParticle.template daughters_as(); for (const auto& dau : daughters) { - if (dau.getProcess() != 4) // check whether the daughter comes from a decay + if (dau.getProcess() != TMCProcess::kPDecay) // check whether the daughter comes from a decay continue; - if (std::abs(dau.pdgCode()) == 211 || std::abs(dau.pdgCode()) == 321) { + if (std::abs(dau.pdgCode()) == PDG_t::kPiPlus || std::abs(dau.pdgCode()) == PDG_t::kKPlus) { thisCascInfo.pdgCodeBachelor = dau.pdgCode(); thisCascInfo.bachP[0] = dau.px(); thisCascInfo.bachP[1] = dau.py(); @@ -2238,11 +2240,11 @@ class BuilderModule thisCascInfo.xyz[2] = dau.vz(); thisCascInfo.mcParticleBachelor = dau.globalIndex(); } - if (std::abs(dau.pdgCode()) == 2212) { + if (std::abs(dau.pdgCode()) == PDG_t::kProton) { thisCascInfo.pdgCodeV0 = dau.pdgCode(); for (const auto& v0Dau : dau.template daughters_as()) { - if (v0Dau.getProcess() != 4) + if (v0Dau.getProcess() != TMCProcess::kPDecay) continue; if (v0Dau.pdgCode() > 0) { @@ -2476,10 +2478,10 @@ class BuilderModule interlinks.cascadeToTraCascCores.push_back(products.tracascdata.lastIndex()); } if (baseOpts.mEnabledTables[kCascCovs]) { - std::array traCovMat = {0.}; + std::array traCovMat = {0.}; strangeTrackParCov.getCovXYZPxPyPzGlo(traCovMat); - float traCovMatArray[21]; - for (int ii = 0; ii < 21; ii++) { + float traCovMatArray[o2::track::kLabCovMatSize]; + for (int ii = 0; ii < o2::track::kLabCovMatSize; ii++) { traCovMatArray[ii] = traCovMat[ii]; } products.tracasccovs(traCovMatArray); @@ -2512,7 +2514,7 @@ class BuilderModule auto const& motherList = part.template mothers_as(); if (motherList.size() == 1) { for (const auto& mother : motherList) { - if (std::abs(part.pdgCode()) == 13 && treatPiToMuDecays) { + if (std::abs(part.pdgCode()) == PDG_t::kMuonMinus && treatPiToMuDecays) { // muon decay, de-ref mother twice if (mother.has_mothers()) { auto grandMotherList = mother.template mothers_as(); From 0374ef4aa61e2c610221b972787c4b15c34d03c5 Mon Sep 17 00:00:00 2001 From: blacwovie Date: Fri, 19 Sep 2025 02:49:36 +0800 Subject: [PATCH 445/986] [PWGLF] add kstar function (#13015) --- PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx | 97 ++++++++++++++++++- 1 file changed, 95 insertions(+), 2 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx b/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx index 975572e927e..74c37c05518 100644 --- a/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx +++ b/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx @@ -15,6 +15,7 @@ /// \author Your Name (your.email@cern.ch) /// \since April 2025 +#include "PWGCF/FemtoWorld/Core/FemtoWorldMath.h" #include "PWGLF/DataModel/EPCalibrationTables.h" #include "PWGLF/DataModel/LFhe3HadronTables.h" #include "PWGLF/Utils/svPoolCreator.h" @@ -181,6 +182,8 @@ struct He3HadCandidate { // collision information int32_t collisionID = 0; + + float kstarfem = 1.f; }; struct he3HadronFemto { @@ -195,10 +198,12 @@ struct he3HadronFemto { Configurable settingCutRigidityMinHe3{"settingCutRigidityMinHe3", 0.8f, "Minimum rigidity for He3"}; Configurable settingCutEta{"settingCutEta", 0.9f, "Eta cut on daughter track"}; Configurable settingCutDCAxy{"settingCutDCAxy", 2.0f, "DCAxy range for tracks"}; - Configurable settingCutDCAz{"settingCutDCAz", 2.0f, "DCAz range for tracks"}; + Configurable settingCutDCAz{"settingCutDCAz", 3.0f, "DCAz range for tracks"}; Configurable settingCutChi2tpcLow{"settingCutChi2tpcLow", 0.5f, "Low cut on TPC chi2"}; Configurable settingCutInvMass{"settingCutInvMass", 0.0f, "Invariant mass upper limit"}; Configurable settingCutPtMinhe3Had{"settingCutPtMinhe3Had", 0.0f, "Minimum PT cut on he3Had4"}; + Configurable settingCutPtMinHad{"settingCutPtMinHad", 0.0f, "Minimum PT cut on Hadron"}; + Configurable settingCutPtMaxHad{"settingCutPtMaxHad", 0.0f, "Maximum PT cut on Hadron"}; Configurable settingCutClSizeItsHe3{"settingCutClSizeItsHe3", 4.0f, "Minimum ITS cluster size for He3"}; Configurable settingCutNCls{"settingCutNCls", 5.0f, "Minimum ITS Ncluster for tracks"}; Configurable settingCutChi2NClITS{"settingCutChi2NClITS", 36.f, "Maximum ITS Chi2 for tracks"}; @@ -287,6 +292,14 @@ struct he3HadronFemto { {"h2NsigmaHadronTPC_preselection", "NsigmaHe3 TPC distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}(had)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {400, -10.0f, 10.0f}}}}, {"h2NsigmaHadronTOF", "NsigmaHadron TOF distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}(had)", {HistType::kTH2F, {{20, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}}}, {"h2NsigmaHadronTOF_preselection", "NsigmaHadron TOF distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}(had)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {400, -10.0f, 10.0f}}}}, + {"hKstarLSmatter", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}}, + {"hKstarLSantimatter", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}}, + {"hKstarUSmatter", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}}, + {"hKstarUSantimatter", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}}, + {"hKstarLSmatter_femto", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}}, + {"hKstarLSantimatter_femto", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}}, + {"hKstarUSmatter_femto", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}}, + {"hKstarUSantimatter_femto", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}}, }, OutputObjHandlingPolicy::AnalysisObject, false, @@ -427,7 +440,8 @@ struct he3HadronFemto { candidate.tpcNClsCrossedRows() < crossedRowsToFindableRatio * candidate.tpcNClsFindable() || candidate.tpcChi2NCl() > maxChi2NCl || candidate.tpcChi2NCl() < settingCutChi2tpcLow || - candidate.itsChi2NCl() > settingCutChi2NClITS) { + candidate.itsChi2NCl() > settingCutChi2NClITS || candidate.dcaXY() > settingCutDCAxy || + candidate.dcaZ() > settingCutDCAz) { return false; } @@ -608,6 +622,9 @@ struct he3HadronFemto { return false; } + if (he3Hadcand.recoPtHad() < settingCutPtMinHad || he3Hadcand.recoPtHad() > settingCutPtMaxHad) + return false; + he3Hadcand.signHe3 = trackHe3.sign(); he3Hadcand.signHad = trackHad.sign(); if (!settingEnableDCAfitter) { @@ -676,6 +693,7 @@ struct he3HadronFemto { beta = std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked he3Hadcand.massTOFHad = trackHad.tpcInnerParam() * std::sqrt(1.f / (beta * beta) - 1.f); } + he3Hadcand.kstarfem = o2::analysis::femtoWorld::FemtoWorldMath::getkstar(trackHad, o2::constants::physics::MassPiPlus, trackHe3, o2::constants::physics::MassHelium3); return true; } @@ -839,6 +857,80 @@ struct he3HadronFemto { } // ================================================================================================================== + double computePrTPCnsig(double InnerParamTPCHad, double SignalTPCHad) + { + double m_BBparamsProton[6] = {-54.42066571222577, 0.2857381250239097, 1.247140602468868, 0.6297483918147729, 2.985438833884555, 0.09}; + + float TPCinnerParam = InnerParamTPCHad; + float expTPCSignal = o2::tpc::BetheBlochAleph((TPCinnerParam / 0.9382721), m_BBparamsProton[0], m_BBparamsProton[1], m_BBparamsProton[2], m_BBparamsProton[3], m_BBparamsProton[4]); + double resoTPC{expTPCSignal * m_BBparamsProton[5]}; + return ((SignalTPCHad - expTPCSignal) / resoTPC); + } + + double tofNSigmaCalculation(double MassTOFHad, double ptHad) + { + double fExpTOFMassHad = 0.9487; // Proton mass in TOF + const float kp0 = 1.22204e-02; + const float kp1 = 7.48467e-01; + + double fSigmaTOFMassHad = (kp0 * TMath::Exp(kp1 * TMath::Abs(ptHad))) * fExpTOFMassHad; + double fNSigmaTOFHad = (MassTOFHad - fExpTOFMassHad) / fSigmaTOFMassHad; + return fNSigmaTOFHad; + } + + static float computeKstar(const He3HadCandidate& he3Hadcand) + { + const float massHe = o2::constants::physics::MassHelium3; + const float massHad = o2::constants::physics::MassPiPlus; + + const ROOT::Math::PtEtaPhiMVector He(std::abs(he3Hadcand.recoPtHe3()), he3Hadcand.recoEtaHe3(), he3Hadcand.recoPhiHe3(), massHe); + const ROOT::Math::PtEtaPhiMVector Had(std::abs(he3Hadcand.recoPtHad()), he3Hadcand.recoEtaHad(), he3Hadcand.recoPhiHad(), massHad); + const ROOT::Math::PtEtaPhiMVector trackSum = He + Had; + + const float beta = trackSum.Beta(); + const float betax = beta * std::cos(trackSum.Phi()) * std::sin(trackSum.Theta()); + const float betay = beta * std::sin(trackSum.Phi()) * std::sin(trackSum.Theta()); + const float betaz = beta * std::cos(trackSum.Theta()); + + ROOT::Math::PxPyPzMVector HeCMS(He); + ROOT::Math::PxPyPzMVector HadCMS(Had); + + const ROOT::Math::Boost boostPRF = ROOT::Math::Boost(-betax, -betay, -betaz); + HeCMS = boostPRF(HeCMS); + HadCMS = boostPRF(HadCMS); + + const ROOT::Math::PxPyPzMVector RelKstar = HeCMS - HadCMS; + return 0.5 * RelKstar.P(); + } + + void fillKstar(const He3HadCandidate& he3Hadcand) + { + double PrTPCnsigma = computePrTPCnsig(he3Hadcand.momHadTPC, he3Hadcand.tpcSignalHad); + double PrTOFnsigma = tofNSigmaCalculation(he3Hadcand.massTOFHad, he3Hadcand.recoPtHad()); + if (abs(PrTPCnsigma) < 3) + return; + if (abs(PrTOFnsigma) < 3) + return; + + float kstar = computeKstar(he3Hadcand); + if (he3Hadcand.isBkgUS == 0) { + if (he3Hadcand.recoPtHe3() > 0) { + mQaRegistry.fill(HIST("hKstarLSmatter"), kstar); + mQaRegistry.fill(HIST("hKstarLSmatter_femto"), he3Hadcand.kstarfem); + } else { + mQaRegistry.fill(HIST("hKstarLSantimatter"), kstar); + mQaRegistry.fill(HIST("hKstarLSantimatter_femto"), he3Hadcand.kstarfem); + } + } else { + if (he3Hadcand.recoPtHe3() > 0) { + mQaRegistry.fill(HIST("hKstarUSmatter"), kstar); + mQaRegistry.fill(HIST("hKstarUSmatter_femto"), he3Hadcand.kstarfem); + } else { + mQaRegistry.fill(HIST("hKstarUSantimatter"), kstar); + mQaRegistry.fill(HIST("hKstarUSantimatter_femto"), he3Hadcand.kstarfem); + } + } + } template void fillPairs(const Tcollisions& collisions, const Ttracks& tracks, const bool isMixedEvent) @@ -853,6 +945,7 @@ struct he3HadronFemto { if (!fillCandidateInfo(heTrack, hadTrack, collBracket, collisions, he3Hadcand, tracks, isMixedEvent)) { continue; } + fillKstar(he3Hadcand); fillHistograms(he3Hadcand); auto collision = collisions.rawIteratorAt(he3Hadcand.collisionID); fillTable(he3Hadcand, collision, /*isMC*/ false); From baa39ec5ae88b1074870b4fef3b0dfd31bdcc5f9 Mon Sep 17 00:00:00 2001 From: Roberta Ferioli <142217183+Roberta-Ferioli@users.noreply.github.com> Date: Thu, 18 Sep 2025 20:50:07 +0200 Subject: [PATCH 446/986] [PWGLF] PWGLF:Add cut to nCluster in ITS InnerBarrel (#13027) --- PWGLF/Tasks/Nuspex/nucleiFromHypertritonMap.cxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/PWGLF/Tasks/Nuspex/nucleiFromHypertritonMap.cxx b/PWGLF/Tasks/Nuspex/nucleiFromHypertritonMap.cxx index 2d959f9488d..5976288f147 100644 --- a/PWGLF/Tasks/Nuspex/nucleiFromHypertritonMap.cxx +++ b/PWGLF/Tasks/Nuspex/nucleiFromHypertritonMap.cxx @@ -56,6 +56,8 @@ struct nucleiFromHypertritonMap { // Track Parameters Configurable min_ITS_nClusters{"min_ITS_nClusters", 7, "minimum number of found ITS clusters"}; + Configurable min_ITS_InnerBarrel_nClusters{"min_ITS_InnerBarrel_nClusters", 1, "minimum number of found ITS Inner Barrel clusters"}; + Configurable max_ITS_InnerBarrel_nClusters{"max_ITS_InnerBarrel_nClusters", 3, "maximum number of found ITS Inner Barrel clusters"}; Configurable min_TPC_nClusters{"min_TPC_nClusters", 100, "minimum number of found TPC clusters"}; Configurable min_TPC_nCrossedRows{"min_TPC_nCrossedRows", 70, "minimum number of TPC crossed pad rows"}; Configurable max_chi2_TPC{"max_chi2_TPC", 4.0f, "maximum TPC chi^2/Ncls"}; @@ -82,12 +84,15 @@ struct nucleiFromHypertritonMap { registryMC.add("hypertritonPtGen", "hypertritonPtGen", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}}); if (saveHelium) { registryMC.add("he3SecPtRec_from_hypertriton", "he3SecPtRec_from_hypertriton", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}}); + registryMC.add("he3SecPtGen_from_hypertriton", "he3SecPtGen_from_hypertriton", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}}); registryMC.add("hyperHe4PtGen", "hyperHe4PtGen", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}}); registryMC.add("he3SecPtRec_from_hyperHe4", "he3SecPtRec_from_hyperHe4", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}}); + registryMC.add("he3SecPtGen_from_hyperHe4", "he3SecPtGen_from_hyperHe4", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}}); registryMC.add("he3PtRec", "he3PtRec", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}}); registryMC.add("he3PtGen", "he3PtGen", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}}); } else { registryMC.add("deutSecPtRec_from_hypertriton", "deutSecPtRec_from_hypertriton", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}}); + registryMC.add("deutSecPtGen_from_hypertriton", "deutSecPtGen_from_hypertriton", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}}); registryMC.add("deutPtRec", "deutPtRec", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}}); registryMC.add("deutPtGen", "deutPtGen", HistType::kTH1F, {{nbin_pt, min_pt, max_pt, "p_{T} (GeV/c)"}}); } @@ -108,6 +113,11 @@ struct nucleiFromHypertritonMap { for (auto& daughter : mcparticle.daughters_as()) { if (daughter.pdgCode() == selectedPDG) { registryMC.fill(HIST("hypertritonPtGen"), mcparticle.pt()); + if (saveHelium) { + registryMC.fill(HIST("he3SecPtGen_from_hypertriton"), daughter.pt()); + } else { + registryMC.fill(HIST("deutSecPtGen_from_hypertriton"), daughter.pt()); + } } } } @@ -115,6 +125,9 @@ struct nucleiFromHypertritonMap { for (auto& daughter : mcparticle.daughters_as()) { if (daughter.pdgCode() == selectedPDG) { registryMC.fill(HIST("hyperHe4PtGen"), mcparticle.pt()); + if (saveHelium) { + registryMC.fill(HIST("he3SecPtGen_from_hyperHe4"), daughter.pt()); + } } } } @@ -137,6 +150,8 @@ struct nucleiFromHypertritonMap { } if (track.itsNCls() < min_ITS_nClusters || + track.itsNClsInnerBarrel() < min_ITS_InnerBarrel_nClusters || + track.itsNClsInnerBarrel() > max_ITS_InnerBarrel_nClusters || track.tpcNClsFound() < min_TPC_nClusters || track.tpcNClsCrossedRows() < min_TPC_nCrossedRows || track.tpcNClsCrossedRows() < 0.8 * track.tpcNClsFindable() || From 4a9edebdaeae32e95a489e804473e2f586bc42eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Eduardo=20Mu=C3=B1oz=20M=C3=A9ndez?= <56033627+jmunozme@users.noreply.github.com> Date: Thu, 18 Sep 2025 17:00:40 -0600 Subject: [PATCH 447/986] [PWGLF] Add track analysis function (#12920) --- PWGMM/UE/Tasks/uecharged.cxx | 997 ++++++++++++++++++++++++----------- 1 file changed, 681 insertions(+), 316 deletions(-) diff --git a/PWGMM/UE/Tasks/uecharged.cxx b/PWGMM/UE/Tasks/uecharged.cxx index 9cfaeb96022..1e17615ca8a 100644 --- a/PWGMM/UE/Tasks/uecharged.cxx +++ b/PWGMM/UE/Tasks/uecharged.cxx @@ -8,39 +8,45 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +// /// \author Antonio Ortiz (antonio.ortiz@nucleares.unam.mx) +/// \file uecharged.cxx +/// \brief Underlying event analysis task /// \since November 2021 -/// \last update: July 2024 +/// \last update: September 2025 -#include -#include +#include "Common/Core/TrackSelection.h" +#include "Common/Core/TrackSelectionDefaults.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/TrackSelectionTables.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" #include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" -#include "Framework/StaticFor.h" #include "Framework/O2DatabasePDGPlugin.h" - +#include "Framework/StaticFor.h" +#include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/Track.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/TrackSelectionDefaults.h" #include "TDatabasePDG.h" +#include #include #include -#include #include -// TODO: implement 50% stat for MC closure vs 50% for testing, add flag for weak decays +#include +#include + +// TODO: implement 50% stat for MC closure vs 50% for testing, add flag for weak +// decays using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +using BCsRun3 = soa::Join; struct ueCharged { @@ -57,7 +63,7 @@ struct ueCharged { selectedTracks.SetMaxChi2PerClusterTPC(4.f); selectedTracks.SetRequireHitsInITSLayers(1, {0, 1}); // one hit in any SPD layer selectedTracks.SetMaxChi2PerClusterITS(36.f); - selectedTracks.SetMaxDcaXYPtDep([](float pt) { return 0.0105f + 0.0350f / pow(pt, 1.1f); }); + selectedTracks.SetMaxDcaXYPtDep([](float pt) { return 0.0105f + 0.0350f / std::pow(pt, 1.1f); }); selectedTracks.SetMaxDcaZ(2.f); return selectedTracks; } @@ -74,7 +80,8 @@ struct ueCharged { selectedTracks.SetMaxChi2PerClusterTPC(4.f); selectedTracks.SetRequireHitsInITSLayers(1, {0, 1}); // one hit in any SPD layer selectedTracks.SetMaxChi2PerClusterITS(36.f); - // selectedTracks.SetMaxDcaXYPtDep([](float pt) { return 0.0105f + 0.0350f / pow(pt, 1.1f); }); + // selectedTracks.SetMaxDcaXYPtDep([](float pt) { return 0.0105f + 0.0350f / + // pow(pt, 1.1f); }); selectedTracks.SetMaxDcaZ(2.f); return selectedTracks; } @@ -83,47 +90,67 @@ struct ueCharged { TrackSelection mySelectionOpenDCA; Service pdg; - float DeltaPhi(float phia, float phib, float rangeMin, float rangeMax); + float deltaPhi(float phia, float phib, float rangeMin, float rangeMax); // Configurable for event selection Configurable isRun3{"isRun3", true, "is Run3 dataset"}; Configurable piluprejection{"piluprejection", true, "Pileup rejection"}; - Configurable goodzvertex{"goodzvertex", true, "removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference."}; + Configurable goodzvertex{"goodzvertex", true, "removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference"}; Configurable sel8{"sel8", true, "Apply the sel8 event selection"}; Configurable removeITSROFBorder{"removeITSROFBorder", false, "Remove ITS Read-Out Frame border and only apply kIsTriggerTVX & kNoTimeFrameBorder (recommended for MC)"}; - Configurable manuallyApplysel8{"manuallyApplysel8", false, "Apply manually the event selection criteria considered in sel8, ie. kIsTriggerTVX & kNoTimeFrameBorder & kNoITSROFrameBorder"}; + Configurable analyzeEvandTracksel{"analyzeEvandTracksel", true, "Analyze the event and track selection"}; // acceptance cuts Configurable cfgTrkEtaCut{"cfgTrkEtaCut", 0.8f, "Eta range for tracks"}; Configurable cfgTrkLowPtCut{"cfgTrkLowPtCut", 0.15f, "Minimum constituent pT"}; HistogramRegistry ue; - static constexpr std::string_view pNumDenMeasuredPS[3] = {"pNumDenMeasuredPS_NS", "pNumDenMeasuredPS_AS", "pNumDenMeasuredPS_TS"}; - static constexpr std::string_view pSumPtMeasuredPS[3] = {"pSumPtMeasuredPS_NS", "pSumPtMeasuredPS_AS", "pSumPtMeasuredPS_TS"}; + static constexpr std::string_view pNumDenMeasuredPS[3] = { + "pNumDenMeasuredPS_NS", "pNumDenMeasuredPS_AS", "pNumDenMeasuredPS_TS"}; + static constexpr std::string_view pSumPtMeasuredPS[3] = { + "pSumPtMeasuredPS_NS", "pSumPtMeasuredPS_AS", "pSumPtMeasuredPS_TS"}; static constexpr std::string_view hPhi[3] = {"hPhi_NS", "hPhi_AS", "hPhi_TS"}; // data driven correction - static constexpr std::string_view hNumDenMCDd[3] = {"hNumDenMCDd_NS", "hNumDenMCDd_AS", "hNumDenMCDd_TS"}; - static constexpr std::string_view hSumPtMCDd[3] = {"hSumPtMCDd_NS", "hSumPtMCDd_AS", "hSumPtMCDd_TS"}; - static constexpr std::string_view hNumDenMCMatchDd[3] = {"hNumDenMCMatchDd_NS", "hNumDenMCMatchDd_AS", "hNumDenMCMatchDd_TS"}; - static constexpr std::string_view hSumPtMCMatchDd[3] = {"hSumPtMCMatchDd_NS", "hSumPtMCMatchDd_AS", "hSumPtMCMatchDd_TS"}; + static constexpr std::string_view hNumDenMCDd[3] = { + "hNumDenMCDd_NS", "hNumDenMCDd_AS", "hNumDenMCDd_TS"}; + static constexpr std::string_view hSumPtMCDd[3] = { + "hSumPtMCDd_NS", "hSumPtMCDd_AS", "hSumPtMCDd_TS"}; + static constexpr std::string_view hNumDenMCMatchDd[3] = { + "hNumDenMCMatchDd_NS", "hNumDenMCMatchDd_AS", "hNumDenMCMatchDd_TS"}; + static constexpr std::string_view hSumPtMCMatchDd[3] = { + "hSumPtMCMatchDd_NS", "hSumPtMCMatchDd_AS", "hSumPtMCMatchDd_TS"}; // hist data for corrections - static constexpr std::string_view hPtVsPtLeadingData[3] = {"hPtVsPtLeadingData_NS", "hPtVsPtLeadingData_AS", "hPtVsPtLeadingData_TS"}; - static constexpr std::string_view pNumDenData[3] = {"pNumDenData_NS", "pNumDenData_AS", "pNumDenData_TS"}; - static constexpr std::string_view pSumPtData[3] = {"pSumPtData_NS", "pSumPtData_AS", "pSumPtData_TS"}; + static constexpr std::string_view hPtVsPtLeadingData[3] = { + "hPtVsPtLeadingData_NS", "hPtVsPtLeadingData_AS", + "hPtVsPtLeadingData_TS"}; + static constexpr std::string_view pNumDenData[3] = { + "pNumDenData_NS", "pNumDenData_AS", "pNumDenData_TS"}; + static constexpr std::string_view pSumPtData[3] = { + "pSumPtData_NS", "pSumPtData_AS", "pSumPtData_TS"}; // hist data true - static constexpr std::string_view hPtVsPtLeadingTrue[3] = {"hPtVsPtLeadingTrue_NS", "hPtVsPtLeadingTrue_AS", "hPtVsPtLeadingTrue_TS"}; + static constexpr std::string_view hPtVsPtLeadingTrue[3] = { + "hPtVsPtLeadingTrue_NS", "hPtVsPtLeadingTrue_AS", + "hPtVsPtLeadingTrue_TS"}; // all wo detector effects - static constexpr std::string_view pNumDenTrueAll[3] = {"pNumDenTrueAll_NS", "pNumDenTrueAll_AS", "pNumDenTrueAll_TS"}; - static constexpr std::string_view pSumPtTrueAll[3] = {"pSumPtTrueAll_NS", "pSumPtTrueAll_AS", "pSumPtTrueAll_TS"}; + static constexpr std::string_view pNumDenTrueAll[3] = { + "pNumDenTrueAll_NS", "pNumDenTrueAll_AS", "pNumDenTrueAll_TS"}; + static constexpr std::string_view pSumPtTrueAll[3] = { + "pSumPtTrueAll_NS", "pSumPtTrueAll_AS", "pSumPtTrueAll_TS"}; // true, 50% - static constexpr std::string_view pNumDenTrue[3] = {"pNumDenTrue_NS", "pNumDenTrue_AS", "pNumDenTrue_TS"}; - static constexpr std::string_view pSumPtTrue[3] = {"pSumPtTrue_NS", "pSumPtTrue_AS", "pSumPtTrue_TS"}; - - // this must have all event selection effects, but it has not been implemented 50% - static constexpr std::string_view pNumDenTruePS[3] = {"pNumDenTruePS_NS", "pNumDenTruePS_AS", "pNumDenTruePS_TS"}; - static constexpr std::string_view pSumPtTruePS[3] = {"pSumPtTruePS_NS", "pSumPtTruePS_AS", "pSumPtTruePS_TS"}; - static constexpr std::string_view hPhiTrue[3] = {"hPhiTrue_NS", "hPhiTrue_AS", "hPhiTrue_TS"}; - - OutputObj f_Eff{"fpara"}; + static constexpr std::string_view pNumDenTrue[3] = { + "pNumDenTrue_NS", "pNumDenTrue_AS", "pNumDenTrue_TS"}; + static constexpr std::string_view pSumPtTrue[3] = { + "pSumPtTrue_NS", "pSumPtTrue_AS", "pSumPtTrue_TS"}; + + // this must have all event selection effects, but it has not been implemented + // 50% + static constexpr std::string_view pNumDenTruePS[3] = { + "pNumDenTruePS_NS", "pNumDenTruePS_AS", "pNumDenTruePS_TS"}; + static constexpr std::string_view pSumPtTruePS[3] = { + "pSumPtTruePS_NS", "pSumPtTruePS_AS", "pSumPtTruePS_TS"}; + static constexpr std::string_view hPhiTrue[3] = {"hPhiTrue_NS", "hPhiTrue_AS", + "hPhiTrue_TS"}; + + OutputObj fEff{"fpara"}; void init(InitContext const&); template @@ -135,24 +162,47 @@ struct ueCharged { template void processTrue(const C& mcCollision, const P& particles); - Filter trackFilter = (nabs(aod::track::eta) < cfgTrkEtaCut) && (aod::track::pt > cfgTrkLowPtCut); + template + void analyzeEventAndTrackSelection(const C& collision, const T& tracks); + + Filter trackFilter = (nabs(aod::track::eta) < cfgTrkEtaCut) && + (aod::track::pt > cfgTrkLowPtCut); using CollisionTableMCTrue = aod::McCollisions; - using CollisionTableMC = soa::SmallGroups>; - using TrackTableMC = soa::Filtered>; + using CollisionTableMC = + soa::SmallGroups>; + using TrackTableMC = + soa::Filtered>; using ParticleTableMC = aod::McParticles; Preslice perCollision = aod::track::collisionId; - void processMC(CollisionTableMCTrue::iterator const& mcCollision, CollisionTableMC const& collisions, TrackTableMC const& tracks, ParticleTableMC const& particles); + void processMC(CollisionTableMCTrue::iterator const& mcCollision, + CollisionTableMC const& collisions, TrackTableMC const& tracks, + ParticleTableMC const& particles, aod::FT0s const&, + BCsRun3 const&); PROCESS_SWITCH(ueCharged, processMC, "process MC", false); - using CollisionTableMCData = soa::Join; - using TrackTableMCData = soa::Filtered>; - void processDataMC(CollisionTableMCData::iterator const& collision, TrackTableMCData const& tracks, ParticleTableMC const& particles, aod::McCollisions const& mcCollisions); + using CollisionTableMCData = + soa::Join; + using TrackTableMCData = + soa::Filtered>; + void processDataMC(CollisionTableMCData::iterator const& collision, + TrackTableMCData const& tracks, + ParticleTableMC const& particles, + aod::McCollisions const& mcCollisions); PROCESS_SWITCH(ueCharged, processDataMC, "process data MC", false); - using CollisionTableData = soa::Join; - using TrackTableData = soa::Filtered>; - void processData(CollisionTableData::iterator const& collision, TrackTableData const& tracks); + using CollisionTableData = + soa::Join; + using TrackTableData = + soa::Filtered>; + void processData(CollisionTableData::iterator const& collision, + TrackTableData const& tracks, aod::FT0s const&, + BCsRun3 const&); PROCESS_SWITCH(ueCharged, processData, "process data", false); // add new method @@ -164,26 +214,28 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) return workflow; } // implementation -float ueCharged::DeltaPhi(float phia, float phib, - float rangeMin = -M_PI / 2.0, float rangeMax = 3.0 * M_PI / 2.0) +float ueCharged::deltaPhi(float phia, float phib, + float rangeMin = -o2::constants::math::PI / 2.0, + float rangeMax = 3.0 * o2::constants::math::PI / + 2.0) { float dphi = -999; if (phia < 0) { - phia += 2 * M_PI; - } else if (phia > 2 * M_PI) { - phia -= 2 * M_PI; + phia += 2 * o2::constants::math::PI; + } else if (phia > 2 * o2::constants::math::PI) { + phia -= 2 * o2::constants::math::PI; } if (phib < 0) { - phib += 2 * M_PI; - } else if (phib > 2 * M_PI) { - phib -= 2 * M_PI; + phib += 2 * o2::constants::math::PI; + } else if (phib > 2 * o2::constants::math::PI) { + phib -= 2 * o2::constants::math::PI; } dphi = phib - phia; if (dphi < rangeMin) { - dphi += 2 * M_PI; + dphi += 2 * o2::constants::math::PI; } else if (dphi > rangeMax) { - dphi -= 2 * M_PI; + dphi -= 2 * o2::constants::math::PI; } return dphi; @@ -195,32 +247,60 @@ void ueCharged::init(InitContext const&) mySelectionPrim = myTrackSelectionPrim(); mySelectionOpenDCA = myTrackSelectionOpenDCA(); - ConfigurableAxis ptBinningt{"ptBinningt", {0, 0.15, 0.50, 1.00, 1.50, 2.00, 2.50, 3.00, 3.50, 4.00, 4.50, 5.00, 6.00, 7.00, 8.00, 9.00, 10.0, 12.0, 14.0, 16.0, 18.0, 20.0, 25.0, 30.0, 40.0, 50.0}, "pTtrig bin limits"}; + ConfigurableAxis ptBinningt{"ptBinningt", + {0, 0.15, 0.50, 1.00, 1.50, 2.00, 2.50, + 3.00, 3.50, 4.00, 4.50, 5.00, 6.00, 7.00, + 8.00, 9.00, 10.0, 12.0, 14.0, 16.0, 18.0, + 20.0, 25.0, 30.0, 40.0, 50.0}, + "pTtrig bin limits"}; AxisSpec ptAxist = {ptBinningt, "#it{p}_{T}^{trig} (GeV/#it{c})"}; - ConfigurableAxis ptBinning{"ptBinning", {0, 0.0, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 12.0, 14.0, 16.0, 18.0, 20.0, 25.0, 30.0, 40.0, 50.0}, "pTassoc bin limits"}; + ConfigurableAxis ptBinning{ + "ptBinning", + {0, 0.0, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, + 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, + 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.2, 2.4, 2.6, 2.8, + 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, + 12.0, 14.0, 16.0, 18.0, 20.0, 25.0, 30.0, 40.0, 50.0}, + "pTassoc bin limits"}; AxisSpec ptAxis = {ptBinning, "#it{p}_{T}^{assoc} (GeV/#it{c})"}; - f_Eff.setObject(new TF1("fpara", "(x<0.3)*((0.283781)+x*(3.0492)+x*x*(-6.17018)) + (x>=0.3&&x<1.8)*((0.597121)+(0.200737)*x+(-0.11255)*x*x+(0.0242807)*x*x*x) + (x>=1.8&&x<14.)*((0.729892)+(0.0018516)*x+(0.000257896)*x*x+(-2.05202e-05)*x*x*x) + (x>=14)*(0.749313)", 0., 1e5)); + fEff.setObject(new TF1("fpara", + "(x<0.3)*((0.315318)+x*(2.38596)+x*x*(-4.388)) +" + "(x>=0.3&&x<1.8)*((0.604051)+(0.154763)*x+(-0.103004)*" + "x*x+(0.0266487)*x*x*x) +" + "(x>=1.8&&x<14.)*((0.700444)+(-0.00115506)*x+(0." + "000667608)*x*x+(-3.82915e-05)*x*x*x) +" + "(x>=14)*((0.731778)+(-0.000994634)*x)", + 0., 1e5)); if (doprocessMC) { ue.add("hPtOut", "pT all rec; pT; Nch", HistType::kTH1D, {ptAxis}); ue.add("hPtInPrim", "pT mc prim; pT; Nch", HistType::kTH1D, {ptAxis}); - ue.add("hPtInPrimGen", "pT mc prim all gen; pT; Nch", HistType::kTH1D, {ptAxis}); + ue.add("hPtInPrimGen", "pT mc prim all gen; pT; Nch", HistType::kTH1D, + {ptAxis}); ue.add("hPtOutPrim", "pT rec prim; pT; Nch", HistType::kTH1D, {ptAxis}); ue.add("hPtOutSec", "pT rec sec; pT; Nch", HistType::kTH1D, {ptAxis}); - ue.add("hPtDCAall", "all MC; DCA_xy; Nch", HistType::kTH2D, {{ptAxis}, {121, -3.025, 3.025, "#it{DCA}_{xy} (cm)"}}); - ue.add("hPtDCAPrimary", "primary; DCA_xy; Nch", HistType::kTH2D, {{ptAxis}, {121, -3.025, 3.025, "#it{DCA}_{xy} (cm)"}}); - ue.add("hPtDCAWeak", "Weak decays; DCA_xy; Nch", HistType::kTH2D, {{ptAxis}, {121, -3.025, 3.025, "#it{DCA}_{xy} (cm)"}}); - ue.add("hPtDCAMat", "Material; DCA_xy; Nch", HistType::kTH2D, {{ptAxis}, {121, -3.025, 3.025, "#it{DCA}_{xy} (cm)"}}); - - ue.add("hmultTrue", "mult true", HistType::kTH1F, {{200, -0.5, 199.5, " "}}); - ue.add("hmultTrueGen", "mult true all Gen", HistType::kTH1F, {{200, -0.5, 199.5, " "}}); + ue.add("hPtDCAall", "all MC; DCA_xy; Nch", HistType::kTH2D, + {{ptAxis}, {121, -3.025, 3.025, "#it{DCA}_{xy} (cm)"}}); + ue.add("hPtDCAPrimary", "primary; DCA_xy; Nch", HistType::kTH2D, + {{ptAxis}, {121, -3.025, 3.025, "#it{DCA}_{xy} (cm)"}}); + ue.add("hPtDCAWeak", "Weak decays; DCA_xy; Nch", HistType::kTH2D, + {{ptAxis}, {121, -3.025, 3.025, "#it{DCA}_{xy} (cm)"}}); + ue.add("hPtDCAMat", "Material; DCA_xy; Nch", HistType::kTH2D, + {{ptAxis}, {121, -3.025, 3.025, "#it{DCA}_{xy} (cm)"}}); + + ue.add("hmultTrue", "mult true", HistType::kTH1F, + {{200, -0.5, 199.5, " "}}); + ue.add("hmultTrueGen", "mult true all Gen", HistType::kTH1F, + {{200, -0.5, 199.5, " "}}); ue.add("hvtxZmc", "vtxZ mctrue", HistType::kTH1F, {{40, -20.0, 20.0, " "}}); - ue.add("hPtLeadingTrue", "true pTleading after physics selection", HistType::kTH1D, {ptAxist}); + ue.add("hPtLeadingTrue", "true pTleading after physics selection", + HistType::kTH1D, {ptAxist}); for (int i = 0; i < 3; ++i) { - ue.add(hPtVsPtLeadingTrue[i].data(), " ", HistType::kTH2D, {{ptAxist}, {ptAxis}}); + ue.add(hPtVsPtLeadingTrue[i].data(), " ", HistType::kTH2D, + {{ptAxist}, {ptAxis}}); ue.add(pNumDenTrueAll[i].data(), "", HistType::kTProfile, {ptAxist}); ue.add(pSumPtTrueAll[i].data(), "", HistType::kTProfile, {ptAxist}); ue.add(pNumDenTrue[i].data(), "", HistType::kTProfile, {ptAxist}); @@ -229,64 +309,203 @@ void ueCharged::init(InitContext const&) ue.add(pSumPtTruePS[i].data(), "", HistType::kTProfile, {ptAxist}); } for (int i = 0; i < 3; ++i) { - ue.add(hPhiTrue[i].data(), "all charged true; #Delta#phi; Counts", HistType::kTH1D, {{64, -M_PI / 2.0, 3.0 * M_PI / 2.0, ""}}); + ue.add(hPhiTrue[i].data(), "all charged true; #Delta#phi; Counts", + HistType::kTH1D, + {{64, -o2::constants::math::PI / 2.0, + 3.0 * o2::constants::math::PI / 2.0, ""}}); } } + ue.add("hStat", "TotalEvents", HistType::kTH1F, {{1, 0.5, 1.5, " "}}); ue.add("hmultRec", "mult rec", HistType::kTH1F, {{200, -0.5, 199.5, " "}}); ue.add("hdNdeta", "dNdeta", HistType::kTH1F, {{50, -2.5, 2.5, " "}}); - ue.add("vtxZEta", ";#eta;vtxZ", HistType::kTH2F, {{50, -2.5, 2.5, " "}, {60, -30, 30, " "}}); - ue.add("phiEta", ";#eta;#varphi", HistType::kTH2F, {{50, -2.5, 2.5}, {200, 0., 2 * M_PI, " "}}); + ue.add("vtxZEta", ";#eta;vtxZ", HistType::kTH2F, + {{50, -2.5, 2.5, " "}, {60, -30, 30, " "}}); + ue.add("phiEta", ";#eta;#varphi", HistType::kTH2F, + {{50, -2.5, 2.5}, {200, 0., 2 * o2::constants::math::PI, " "}}); ue.add("hvtxZ", "vtxZ", HistType::kTH1F, {{40, -20.0, 20.0, " "}}); ue.add("hCounter", "Counter; sel; Nev", HistType::kTH1D, {{7, 0, 7, " "}}); - ue.add("hPtLeadingRecPS", "rec pTleading after physics selection", HistType::kTH1D, {ptAxist}); - ue.add("hPtLeadingMeasured", "measured pTleading after physics selection", HistType::kTH1D, {ptAxist}); + ue.add("hPtLeadingRecPS", "rec pTleading after physics selection", + HistType::kTH1D, {ptAxist}); + ue.add("hPtLeadingMeasured", "measured pTleading after physics selection", + HistType::kTH1D, {ptAxist}); + ue.add("hPtLeadingVsTracks", "", HistType::kTProfile, {{ptAxist}}); for (int i = 0; i < 3; ++i) { - ue.add(pNumDenMeasuredPS[i].data(), "Number Density; ; #LT #it{N}_{trk} #GT", HistType::kTProfile, {ptAxist}); - ue.add(pSumPtMeasuredPS[i].data(), "Total #it{p}_{T}; ; #LT#sum#it{p}_{T}#GT", HistType::kTProfile, {ptAxist}); - ue.add(hPhi[i].data(), "all charged; #Delta#phi; Counts", HistType::kTH1D, {{64, -M_PI / 2.0, 3.0 * M_PI / 2.0, ""}}); + ue.add(pNumDenMeasuredPS[i].data(), + "Number Density; ; #LT #it{N}_{trk} #GT", HistType::kTProfile, + {ptAxist}); + ue.add(pSumPtMeasuredPS[i].data(), + "Total #it{p}_{T}; ; #LT#sum#it{p}_{T}#GT", HistType::kTProfile, + {ptAxist}); + ue.add(hPhi[i].data(), "all charged; #Delta#phi; Counts", HistType::kTH1D, + {{64, -o2::constants::math::PI / 2.0, + 3.0 * o2::constants::math::PI / 2.0, ""}}); } // Data driven for (int i = 0; i < 3; ++i) { - ue.add(hNumDenMCDd[i].data(), " ", HistType::kTH2D, {{ptAxist}, {100, -0.5, 99.5, "#it{N}_{trk}"}}); + ue.add(hNumDenMCDd[i].data(), " ", HistType::kTH2D, + {{ptAxist}, {100, -0.5, 99.5, "#it{N}_{trk}"}}); ue.add(hSumPtMCDd[i].data(), " ", HistType::kTH2D, {{ptAxist}, {ptAxis}}); - ue.add(hNumDenMCMatchDd[i].data(), " ", HistType::kTH2D, {{ptAxist}, {100, -0.5, 99.5, "#it{N}_{trk}"}}); - ue.add(hSumPtMCMatchDd[i].data(), " ", HistType::kTH2D, {{ptAxist}, {ptAxis}}); + ue.add(hNumDenMCMatchDd[i].data(), " ", HistType::kTH2D, + {{ptAxist}, {100, -0.5, 99.5, "#it{N}_{trk}"}}); + ue.add(hSumPtMCMatchDd[i].data(), " ", HistType::kTH2D, + {{ptAxist}, {ptAxis}}); } for (int i = 0; i < 3; ++i) { - ue.add(hPtVsPtLeadingData[i].data(), " ", HistType::kTH2D, {{ptAxist}, {ptAxis}}); + ue.add(hPtVsPtLeadingData[i].data(), " ", HistType::kTH2D, + {{ptAxist}, {ptAxis}}); ue.add(pNumDenData[i].data(), "", HistType::kTProfile, {ptAxist}); ue.add(pSumPtData[i].data(), "", HistType::kTProfile, {ptAxist}); } ue.add("hPtLeadingData", " ", HistType::kTH1D, {{ptAxist}}); - ue.add("hPTVsDCAData", " ", HistType::kTH2D, {{ptAxis}, {121, -3.025, 3.025, "#it{DCA}_{xy} (cm)"}}); - ue.add("hEtaLeadingVsPtLeading", " ", HistType::kTH2D, {{ptAxist}, {50, -2.5, 2.5, "#eta"}}); + ue.add("hPTVsDCAData", " ", HistType::kTH2D, + {{ptAxis}, {121, -3.025, 3.025, "#it{DCA}_{xy} (cm)"}}); + ue.add("hEtaLeadingVsPtLeading", " ", HistType::kTH2D, + {{ptAxist}, {50, -2.5, 2.5, "#eta"}}); + + if (analyzeEvandTracksel) { + + const AxisSpec axisVtxZ{500, -25., 25., ""}; + ue.add("hVtxFT0VsVtxCol", " ", HistType::kTH2D, + {{axisVtxZ}, {axisVtxZ}}); // FT0-vertex vs z-vertex from collisions + ue.add("hVtxFT0VsVtxCol_afterSel8", " ", HistType::kTH2D, + {{axisVtxZ}, {axisVtxZ}}); + ue.add("hVtxFT0VsVtxCol_afterPile", " ", HistType::kTH2D, + {{axisVtxZ}, {axisVtxZ}}); + ue.add("hVtxFT0VsVtxCol_afterGoodZvtx", " ", HistType::kTH2D, + {{axisVtxZ}, {axisVtxZ}}); + ue.add("hvtxZ_before", "vtxZ befer ev selection", HistType::kTH1F, + {{40, -20.0, 20.0, " "}}); + ue.add("hvtxZ_after", "vtxZ befer ev after", HistType::kTH1F, + {{40, -20.0, 20.0, " "}}); + + const AxisSpec axisMultT0M{1000, 0., 8000., "T0M multiplicity"}; + ue.add("hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, + {{axisVtxZ}, {axisMultT0M}}); // FT0-vertex minus z-vertex from + // collisions vs multiplicity + ue.add("postselection_track/hT0MVsTracks", "", HistType::kTH2D, + {{axisMultT0M}, {200, 0., 200.}}); + ue.add("postselection_track/hVtxFT0VsTracks", "", HistType::kTH2D, + {{axisVtxZ}, {200, 0., 200.}}); + ue.add("postselection_track/hVtxVsTracks", "", HistType::kTH2D, + {{axisVtxZ}, {200, 0., 200.}}); + + // its histograms + ue.add("preselection_track/ITS/itsNCls", + "number of found ITS clusters;# clusters ITS", kTH1D, + {{8, -0.5, 7.5}}); + ue.add("preselection_track/ITS/itsChi2NCl", + "chi2 per ITS cluster;chi2 / cluster ITS", kTH1D, {{100, 0, 40}}); + ue.add("preselection_track/ITS/itsClusterMap", "ITS cluster map", kTH1D, + {{128, -0.5, 127.5}}); + ue.add("postselection_track/ITS/itsNCls", + "number of found ITS clusters;# clusters ITS", kTH1D, + {{8, -0.5, 7.5}}); + ue.add("postselection_track/ITS/itsChi2NCl", + "chi2 per ITS cluster;chi2 / cluster ITS", kTH1D, {{100, 0, 40}}); + ue.add("postselection_track/ITS/itsClusterMap", "ITS cluster map", kTH1D, + {{128, -0.5, 127.5}}); + + // tpc histograms + ue.add("preselection_track/TPC/tpcNClsFindable", + "number of findable TPC clusters;# findable clusters TPC", kTH1D, + {{165, -0.5, 164.5}}); + ue.add("preselection_track/TPC/tpcNClsFound", + "number of found TPC clusters;# clusters TPC", kTH1D, + {{165, -0.5, 164.5}}); + ue.add("preselection_track/TPC/tpcNClsShared", + "number of shared TPC clusters;# shared clusters TPC", kTH1D, + {{165, -0.5, 164.5}}); + ue.add("preselection_track/TPC/tpcCrossedRows", + "number of crossed TPC rows;# crossed rows TPC", kTH1D, + {{165, -0.5, 164.5}}); + ue.add("preselection_track/TPC/tpcFractionSharedCls", + "fraction of shared TPC clusters;fraction shared clusters TPC", + kTH1D, {{100, 0., 1.}}); + ue.add("preselection_track/TPC/tpcCrossedRowsOverFindableCls", + "crossed TPC rows over findable clusters;crossed rows / findable " + "clusters TPC", + kTH1D, {{60, 0.7, 1.3}}); + ue.add("preselection_track/TPC/tpcChi2NCl", + "chi2 per cluster in TPC;chi2 / cluster TPC", kTH1D, {{100, 0, 10}}); + ue.add("postselection_track/TPC/tpcNClsFindable", + "number of findable TPC clusters;# findable clusters TPC", kTH1D, + {{165, -0.5, 164.5}}); + ue.add("postselection_track/TPC/tpcNClsFound", + "number of found TPC clusters;# clusters TPC", kTH1D, + {{165, -0.5, 164.5}}); + ue.add("postselection_track/TPC/tpcNClsShared", + "number of shared TPC clusters;# shared clusters TPC", kTH1D, + {{165, -0.5, 164.5}}); + ue.add("postselection_track/TPC/tpcCrossedRows", + "number of crossed TPC rows;# crossed rows TPC", kTH1D, + {{165, -0.5, 164.5}}); + ue.add("postselection_track/TPC/tpcFractionSharedCls", + "fraction of shared TPC clusters;fraction shared clusters TPC", + kTH1D, {{100, 0., 1.}}); + ue.add("postselection_track/TPC/tpcCrossedRowsOverFindableCls", + "crossed TPC rows over findable clusters;crossed rows / findable " + "clusters TPC", + kTH1D, {{60, 0.7, 1.3}}); + ue.add("postselection_track/TPC/tpcChi2NCl", + "chi2 per cluster in TPC;chi2 / cluster TPC", kTH1D, {{100, 0, 10}}); + + // general + ue.add("preselection_track/hvtxZ", "vtxZ before track selection", + HistType::kTH1D, {{40, -20.0, 20.0, " "}}); + ue.add("preselection_track/hvtxXY", "vtxXY before track selection", + HistType::kTH1D, {{121, -3.025, 3.025, "#it{DCA}_{xy} (cm)"}}); + ue.add("preselection_track/htracks", "tracks before track selection", + HistType::kTH1D, {{100, 0., 100., "N_{tracks}"}}); + ue.add("postselection_track/hvtxZ", "vtxZ after track selection", + HistType::kTH1D, {{40, -20.0, 20.0, "#it{DCA}_{z} (cm) "}}); + ue.add("postselection_track/hvtxXY", "vtxXY after track selection", + HistType::kTH1D, {{121, -3.025, 3.025, "#it{DCA}_{xy} (cm)"}}); + ue.add("postselection_track/htracks", "tracks after track selection", + HistType::kTH1D, {{100, 0., 100., "N_{tracks}"}}); + } } -void ueCharged::processMC(CollisionTableMCTrue::iterator const& mcCollision, CollisionTableMC const& collisions, TrackTableMC const& tracks, ParticleTableMC const& particles) +void ueCharged::processMC(CollisionTableMCTrue::iterator const& mcCollision, + CollisionTableMC const& collisions, + TrackTableMC const& tracks, + ParticleTableMC const& particles, aod::FT0s const&, + BCsRun3 const&) { if (collisions.size() != 0) { - for (auto& collision : collisions) { + for (const auto& collision : collisions) { auto curTracks = tracks.sliceBy(perCollision, collision.globalIndex()); processMeasMC(collision, curTracks, particles); + if (analyzeEvandTracksel) { + analyzeEventAndTrackSelection(collision, curTracks); + } break; // for now look only at first collision... } } processTrue(mcCollision, particles); } -void ueCharged::processDataMC(CollisionTableMCData::iterator const& collision, TrackTableMCData const& tracks, ParticleTableMC const& particles, aod::McCollisions const& /*mcCollisions*/) +void ueCharged::processDataMC(CollisionTableMCData::iterator const& collision, + TrackTableMCData const& tracks, + ParticleTableMC const& particles, + aod::McCollisions const& /*mcCollisions*/) { processMeasMC(collision, tracks, particles); } -void ueCharged::processData(CollisionTableData::iterator const& collision, TrackTableData const& tracks) + +void ueCharged::processData(CollisionTableData::iterator const& collision, + TrackTableData const& tracks, aod::FT0s const&, + BCsRun3 const&) { processMeas(collision, tracks); + if (analyzeEvandTracksel) { + analyzeEventAndTrackSelection(collision, tracks); + } } template @@ -294,7 +513,7 @@ void ueCharged::processTrue(const C& mcCollision, const P& particles) { int multTrue = 0; int multTrueINEL = 0; - for (auto& particle : particles) { + for (const auto& particle : particles) { auto pdgParticle = pdg->GetParticle(particle.pdgCode()); if (!pdgParticle || pdgParticle->Charge() == 0.) { continue; @@ -325,7 +544,7 @@ void ueCharged::processTrue(const C& mcCollision, const P& particles) double flPhiTrue = 0; int flIndexTrue = 0; - for (auto& particle : particles) { + for (const auto& particle : particles) { auto pdgParticle = pdg->GetParticle(particle.pdgCode()); if (!pdgParticle || pdgParticle->Charge() == 0.) { continue; @@ -350,19 +569,19 @@ void ueCharged::processTrue(const C& mcCollision, const P& particles) } } ue.fill(HIST("hPtLeadingTrue"), flPtTrue); - std::vector ue_true; - ue_true.clear(); - int nchm_toptrue[3]; - double sumptm_toptrue[3]; + std::vector ueTrue; + ueTrue.clear(); + int nchmTopTrue[3]; + double sumptmTopTrue[3]; for (int i = 0; i < 3; ++i) { - nchm_toptrue[i] = 0; - sumptm_toptrue[i] = 0; + nchmTopTrue[i] = 0; + sumptmTopTrue[i] = 0; } - std::vector ptArrayTrue; - std::vector phiArrayTrue; + std::vector ptArrayTrue; + std::vector phiArrayTrue; std::vector indexArrayTrue; - for (auto& particle : particles) { + for (const auto& particle : particles) { auto pdgParticle = pdg->GetParticle(particle.pdgCode()); if (!pdgParticle || pdgParticle->Charge() == 0.) { @@ -381,76 +600,80 @@ void ueCharged::processTrue(const C& mcCollision, const P& particles) if (flIndexTrue == particle.globalIndex()) { continue; } - double DPhi = DeltaPhi(particle.phi(), flPhiTrue); + double dPhi = deltaPhi(particle.phi(), flPhiTrue); // definition of the topological regions - if (TMath::Abs(DPhi) < M_PI / 3.0) { // near side - ue.fill(HIST(hPhiTrue[0]), DPhi); + if (std::abs(dPhi) < o2::constants::math::PI / 3.0) { // near side + ue.fill(HIST(hPhiTrue[0]), dPhi); ue.fill(HIST(hPtVsPtLeadingTrue[0]), flPtTrue, particle.pt()); - nchm_toptrue[0]++; - sumptm_toptrue[0] += particle.pt(); - } else if (TMath::Abs(DPhi - M_PI) < M_PI / 3.0) { // away side - ue.fill(HIST(hPhiTrue[1]), DPhi); + nchmTopTrue[0]++; + sumptmTopTrue[0] += particle.pt(); + } else if (std::abs(dPhi - o2::constants::math::PI) < + o2::constants::math::PI / 3.0) { // away side + ue.fill(HIST(hPhiTrue[1]), dPhi); ue.fill(HIST(hPtVsPtLeadingTrue[1]), flPtTrue, particle.pt()); - nchm_toptrue[1]++; - sumptm_toptrue[1] += particle.pt(); + nchmTopTrue[1]++; + sumptmTopTrue[1] += particle.pt(); } else { // transverse side - ue.fill(HIST(hPhiTrue[2]), DPhi); + ue.fill(HIST(hPhiTrue[2]), dPhi); ue.fill(HIST(hPtVsPtLeadingTrue[2]), flPtTrue, particle.pt()); - nchm_toptrue[2]++; - sumptm_toptrue[2] += particle.pt(); + nchmTopTrue[2]++; + sumptmTopTrue[2] += particle.pt(); } } for (int i_reg = 0; i_reg < 3; ++i_reg) { - ue_true.push_back(1.0 * nchm_toptrue[i_reg]); + ueTrue.push_back(1.0 * nchmTopTrue[i_reg]); } for (int i_reg = 0; i_reg < 3; ++i_reg) { - ue_true.push_back(sumptm_toptrue[i_reg]); + ueTrue.push_back(sumptmTopTrue[i_reg]); } - ue.fill(HIST(pNumDenTrueAll[0]), flPtTrue, ue_true[0]); - ue.fill(HIST(pSumPtTrueAll[0]), flPtTrue, ue_true[3]); + ue.fill(HIST(pNumDenTrueAll[0]), flPtTrue, ueTrue[0]); + ue.fill(HIST(pSumPtTrueAll[0]), flPtTrue, ueTrue[3]); - ue.fill(HIST(pNumDenTrueAll[1]), flPtTrue, ue_true[1]); - ue.fill(HIST(pSumPtTrueAll[1]), flPtTrue, ue_true[4]); + ue.fill(HIST(pNumDenTrueAll[1]), flPtTrue, ueTrue[1]); + ue.fill(HIST(pSumPtTrueAll[1]), flPtTrue, ueTrue[4]); - ue.fill(HIST(pNumDenTrueAll[2]), flPtTrue, ue_true[2]); - ue.fill(HIST(pSumPtTrueAll[2]), flPtTrue, ue_true[5]); + ue.fill(HIST(pNumDenTrueAll[2]), flPtTrue, ueTrue[2]); + ue.fill(HIST(pSumPtTrueAll[2]), flPtTrue, ueTrue[5]); ptArrayTrue.clear(); phiArrayTrue.clear(); indexArrayTrue.clear(); } + template void ueCharged::processMeas(const C& collision, const T& tracks) { ue.fill(HIST("hCounter"), 0); - if (sel8 && !collision.sel8()) { - return; - } + ue.fill(HIST("hCounter"), 1); - if (removeITSROFBorder && (!collision.selection_bit(o2::aod::evsel::kIsTriggerTVX) || !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder))) { + if (sel8 && !collision.sel8()) { return; } - if (manuallyApplysel8 && (!collision.selection_bit(o2::aod::evsel::kIsTriggerTVX) || !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder))) { + if (removeITSROFBorder && + (!collision.selection_bit(o2::aod::evsel::kIsTriggerTVX) || + !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder))) { return; } - ue.fill(HIST("hCounter"), 1); + ue.fill(HIST("hCounter"), 2); - if (piluprejection && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + if (piluprejection && + !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { return; } - ue.fill(HIST("hCounter"), 2); - if (goodzvertex && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + ue.fill(HIST("hCounter"), 3); + if (goodzvertex && + !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { return; } - ue.fill(HIST("hCounter"), 3); + ue.fill(HIST("hCounter"), 4); ue.fill(HIST("hStat"), collision.size()); auto vtxZ = collision.posZ(); @@ -459,7 +682,7 @@ void ueCharged::processMeas(const C& collision, const T& tracks) return; } - ue.fill(HIST("hCounter"), 4); + ue.fill(HIST("hCounter"), 5); ue.fill(HIST("hvtxZ"), vtxZ); @@ -469,11 +692,12 @@ void ueCharged::processMeas(const C& collision, const T& tracks) double flEta = 0; int flIndex = 0; int multRec = 0; - for (auto& track : tracks) { + int track_multiplicity = 0; + for (const auto& track : tracks) { if (!mySelectionPrim.IsSelected(track)) { continue; } - + track_multiplicity++; ue.fill(HIST("hdNdeta"), track.eta()); ue.fill(HIST("vtxZEta"), track.eta(), vtxZ); ue.fill(HIST("phiEta"), track.eta(), track.phi()); @@ -490,20 +714,21 @@ void ueCharged::processMeas(const C& collision, const T& tracks) ue.fill(HIST("hPtLeadingMeasured"), flPt); ue.fill(HIST("hPtLeadingRecPS"), flPt); ue.fill(HIST("hEtaLeadingVsPtLeading"), flPt, flEta); + ue.fill(HIST("hPtLeadingVsTracks"), flPt, track_multiplicity); - std::vector ue_rec; - ue_rec.clear(); - int nchm_top[3]; - double sumptm_top[3]; + std::vector ueRec; + ueRec.clear(); + int nchmTop[3]; + double sumptmTop[3]; for (int i = 0; i < 3; ++i) { - nchm_top[i] = 0; - sumptm_top[i] = 0; + nchmTop[i] = 0; + sumptmTop[i] = 0; } - std::vector ptArray; - std::vector phiArray; + std::vector ptArray; + std::vector phiArray; std::vector indexArray; - for (auto& track : tracks) { + for (const auto& track : tracks) { if (mySelectionOpenDCA.IsSelected(track)) { ue.fill(HIST("hPTVsDCAData"), track.pt(), track.dcaXY()); @@ -511,7 +736,7 @@ void ueCharged::processMeas(const C& collision, const T& tracks) if (mySelectionPrim.IsSelected(track)) { // applying the efficiency twice for the misrec of leading particle - if (f_Eff->Eval(track.pt()) > gRandom->Uniform(0, 1)) { + if (fEff->Eval(track.pt()) > gRandom->Uniform(0, 1)) { ptArray.push_back(track.pt()); phiArray.push_back(track.phi()); indexArray.push_back(track.globalIndex()); @@ -522,55 +747,56 @@ void ueCharged::processMeas(const C& collision, const T& tracks) continue; } - double DPhi = DeltaPhi(track.phi(), flPhi); + double dPhi = deltaPhi(track.phi(), flPhi); // definition of the topological regions - if (TMath::Abs(DPhi) < M_PI / 3.0) { // near side - ue.fill(HIST(hPhi[0]), DPhi); + if (std::abs(dPhi) < o2::constants::math::PI / 3.0) { // near side + ue.fill(HIST(hPhi[0]), dPhi); ue.fill(HIST(hPtVsPtLeadingData[0]), flPt, track.pt()); - nchm_top[0]++; - sumptm_top[0] += track.pt(); - } else if (TMath::Abs(DPhi - M_PI) < M_PI / 3.0) { // away side - ue.fill(HIST(hPhi[1]), DPhi); + nchmTop[0]++; + sumptmTop[0] += track.pt(); + } else if (std::abs(dPhi - o2::constants::math::PI) < + o2::constants::math::PI / 3.0) { // away side + ue.fill(HIST(hPhi[1]), dPhi); ue.fill(HIST(hPtVsPtLeadingData[1]), flPt, track.pt()); - nchm_top[1]++; - sumptm_top[1] += track.pt(); + nchmTop[1]++; + sumptmTop[1] += track.pt(); } else { // transverse side - ue.fill(HIST(hPhi[2]), DPhi); + ue.fill(HIST(hPhi[2]), dPhi); ue.fill(HIST(hPtVsPtLeadingData[2]), flPt, track.pt()); - nchm_top[2]++; - sumptm_top[2] += track.pt(); + nchmTop[2]++; + sumptmTop[2] += track.pt(); } } } for (int i_reg = 0; i_reg < 3; ++i_reg) { - ue_rec.push_back(1.0 * nchm_top[i_reg]); + ueRec.push_back(1.0 * nchmTop[i_reg]); } for (int i_reg = 0; i_reg < 3; ++i_reg) { - ue_rec.push_back(sumptm_top[i_reg]); + ueRec.push_back(sumptmTop[i_reg]); } // add flags for Vtx, PS, ev sel - ue.fill(HIST(pNumDenMeasuredPS[0]), flPt, ue_rec[0]); - ue.fill(HIST(pNumDenData[0]), flPt, ue_rec[0]); - ue.fill(HIST(pSumPtMeasuredPS[0]), flPt, ue_rec[3]); - ue.fill(HIST(pSumPtData[0]), flPt, ue_rec[3]); + ue.fill(HIST(pNumDenMeasuredPS[0]), flPt, ueRec[0]); + ue.fill(HIST(pNumDenData[0]), flPt, ueRec[0]); + ue.fill(HIST(pSumPtMeasuredPS[0]), flPt, ueRec[3]); + ue.fill(HIST(pSumPtData[0]), flPt, ueRec[3]); - ue.fill(HIST(pNumDenMeasuredPS[1]), flPt, ue_rec[1]); - ue.fill(HIST(pNumDenData[1]), flPt, ue_rec[1]); - ue.fill(HIST(pSumPtMeasuredPS[1]), flPt, ue_rec[4]); - ue.fill(HIST(pSumPtData[1]), flPt, ue_rec[4]); + ue.fill(HIST(pNumDenMeasuredPS[1]), flPt, ueRec[1]); + ue.fill(HIST(pNumDenData[1]), flPt, ueRec[1]); + ue.fill(HIST(pSumPtMeasuredPS[1]), flPt, ueRec[4]); + ue.fill(HIST(pSumPtData[1]), flPt, ueRec[4]); - ue.fill(HIST(pNumDenMeasuredPS[2]), flPt, ue_rec[2]); - ue.fill(HIST(pNumDenData[2]), flPt, ue_rec[2]); - ue.fill(HIST(pSumPtMeasuredPS[2]), flPt, ue_rec[5]); - ue.fill(HIST(pSumPtData[2]), flPt, ue_rec[5]); + ue.fill(HIST(pNumDenMeasuredPS[2]), flPt, ueRec[2]); + ue.fill(HIST(pNumDenData[2]), flPt, ueRec[2]); + ue.fill(HIST(pSumPtMeasuredPS[2]), flPt, ueRec[5]); + ue.fill(HIST(pSumPtData[2]), flPt, ueRec[5]); ue.fill(HIST("hPtLeadingData"), flPt); // Compute data driven (DD) missidentification correction - Float_t flPtdd = 0; // leading pT - Float_t flPhidd = 0; + float flPtdd = 0; // leading pT + float flPhidd = 0; int flIndexdd = 0; int ntrkdd = ptArray.size(); @@ -581,47 +807,48 @@ void ueCharged::processMeas(const C& collision, const T& tracks) flIndexdd = indexArray[i]; } } - int nchm_topdd[3]; - double sumptm_topdd[3]; + int nchmTopdd[3]; + double sumptmTopdd[3]; for (int i = 0; i < 3; ++i) { - nchm_topdd[i] = 0; - sumptm_topdd[i] = 0; + nchmTopdd[i] = 0; + sumptmTopdd[i] = 0; } for (int i = 0; i < ntrkdd; ++i) { if (indexArray[i] == flIndexdd) { continue; } - double DPhi = DeltaPhi(phiArray[i], flPhidd); - if (TMath::Abs(DPhi) < M_PI / 3.0) { // near side - nchm_topdd[0]++; - sumptm_topdd[0] += ptArray[i]; - } else if (TMath::Abs(DPhi - M_PI) < M_PI / 3.0) { // away side - nchm_topdd[1]++; - sumptm_topdd[1] += ptArray[i]; + double dPhi = deltaPhi(phiArray[i], flPhidd); + if (std::abs(dPhi) < o2::constants::math::PI / 3.0) { // near side + nchmTopdd[0]++; + sumptmTopdd[0] += ptArray[i]; + } else if (std::abs(dPhi - o2::constants::math::PI) < + o2::constants::math::PI / 3.0) { // away side + nchmTopdd[1]++; + sumptmTopdd[1] += ptArray[i]; } else { // transverse side - nchm_topdd[2]++; - sumptm_topdd[2] += ptArray[i]; + nchmTopdd[2]++; + sumptmTopdd[2] += ptArray[i]; } } - ue.fill(HIST(hNumDenMCDd[0]), flPtdd, nchm_topdd[0]); - ue.fill(HIST(hSumPtMCDd[0]), flPtdd, sumptm_topdd[0]); + ue.fill(HIST(hNumDenMCDd[0]), flPtdd, nchmTopdd[0]); + ue.fill(HIST(hSumPtMCDd[0]), flPtdd, sumptmTopdd[0]); - ue.fill(HIST(hNumDenMCDd[1]), flPtdd, nchm_topdd[1]); - ue.fill(HIST(hSumPtMCDd[1]), flPtdd, sumptm_topdd[1]); + ue.fill(HIST(hNumDenMCDd[1]), flPtdd, nchmTopdd[1]); + ue.fill(HIST(hSumPtMCDd[1]), flPtdd, sumptmTopdd[1]); - ue.fill(HIST(hNumDenMCDd[2]), flPtdd, nchm_topdd[2]); - ue.fill(HIST(hSumPtMCDd[2]), flPtdd, sumptm_topdd[2]); + ue.fill(HIST(hNumDenMCDd[2]), flPtdd, nchmTopdd[2]); + ue.fill(HIST(hSumPtMCDd[2]), flPtdd, sumptmTopdd[2]); if (flIndexdd == flIndex) { - ue.fill(HIST(hNumDenMCMatchDd[0]), flPtdd, nchm_topdd[0]); - ue.fill(HIST(hSumPtMCMatchDd[0]), flPtdd, sumptm_topdd[0]); + ue.fill(HIST(hNumDenMCMatchDd[0]), flPtdd, nchmTopdd[0]); + ue.fill(HIST(hSumPtMCMatchDd[0]), flPtdd, sumptmTopdd[0]); - ue.fill(HIST(hNumDenMCMatchDd[1]), flPtdd, nchm_topdd[1]); - ue.fill(HIST(hSumPtMCMatchDd[1]), flPtdd, sumptm_topdd[1]); + ue.fill(HIST(hNumDenMCMatchDd[1]), flPtdd, nchmTopdd[1]); + ue.fill(HIST(hSumPtMCMatchDd[1]), flPtdd, sumptmTopdd[1]); - ue.fill(HIST(hNumDenMCMatchDd[2]), flPtdd, nchm_topdd[2]); - ue.fill(HIST(hSumPtMCMatchDd[2]), flPtdd, sumptm_topdd[2]); + ue.fill(HIST(hNumDenMCMatchDd[2]), flPtdd, nchmTopdd[2]); + ue.fill(HIST(hSumPtMCMatchDd[2]), flPtdd, sumptmTopdd[2]); } ptArray.clear(); phiArray.clear(); @@ -629,11 +856,10 @@ void ueCharged::processMeas(const C& collision, const T& tracks) } template -void ueCharged::processMeasMC(const C& collision, const T& tracks, const P& particles) +void ueCharged::processMeasMC(const C& collision, const T& tracks, + const P& particles) { - ue.fill(HIST("hCounter"), 0); - ue.fill(HIST("hStat"), collision.size()); auto vtxZ = collision.posZ(); @@ -642,7 +868,7 @@ void ueCharged::processMeasMC(const C& collision, const T& tracks, const P& part double flPhiTrue = 0; int flIndexTrue = 0; - for (auto& particle : particles) { + for (const auto& particle : particles) { auto pdgParticle = pdg->GetParticle(particle.pdgCode()); if (!pdgParticle || pdgParticle->Charge() == 0.) { continue; @@ -665,19 +891,19 @@ void ueCharged::processMeasMC(const C& collision, const T& tracks, const P& part } } // ue.fill(HIST("hmultTrue"), multTrue); - std::vector ue_true; - ue_true.clear(); - int nchm_toptrue[3]; - double sumptm_toptrue[3]; + std::vector ueTrue; + ueTrue.clear(); + int nchmTopTrue[3]; + double sumptmTopTrue[3]; for (int i = 0; i < 3; ++i) { - nchm_toptrue[i] = 0; - sumptm_toptrue[i] = 0; + nchmTopTrue[i] = 0; + sumptmTopTrue[i] = 0; } - std::vector ptArrayTrue; - std::vector phiArrayTrue; + std::vector ptArrayTrue; + std::vector phiArrayTrue; std::vector indexArrayTrue; - for (auto& particle : particles) { + for (const auto& particle : particles) { auto pdgParticle = pdg->GetParticle(particle.pdgCode()); if (!pdgParticle || pdgParticle->Charge() == 0.) { @@ -696,86 +922,89 @@ void ueCharged::processMeasMC(const C& collision, const T& tracks, const P& part if (flIndexTrue == particle.globalIndex()) { continue; } - double DPhi = DeltaPhi(particle.phi(), flPhiTrue); + double dPhi = deltaPhi(particle.phi(), flPhiTrue); // definition of the topological regions - if (TMath::Abs(DPhi) < M_PI / 3.0) { // near side - nchm_toptrue[0]++; - sumptm_toptrue[0] += particle.pt(); - } else if (TMath::Abs(DPhi - M_PI) < M_PI / 3.0) { // away side - nchm_toptrue[1]++; - sumptm_toptrue[1] += particle.pt(); + if (std::abs(dPhi) < o2::constants::math::PI / 3.0) { // near side + nchmTopTrue[0]++; + sumptmTopTrue[0] += particle.pt(); + } else if (std::abs(dPhi - o2::constants::math::PI) < + o2::constants::math::PI / 3.0) { // away side + nchmTopTrue[1]++; + sumptmTopTrue[1] += particle.pt(); } else { // transverse side - nchm_toptrue[2]++; - sumptm_toptrue[2] += particle.pt(); + nchmTopTrue[2]++; + sumptmTopTrue[2] += particle.pt(); } } for (int i_reg = 0; i_reg < 3; ++i_reg) { - ue_true.push_back(1.0 * nchm_toptrue[i_reg]); + ueTrue.push_back(1.0 * nchmTopTrue[i_reg]); } for (int i_reg = 0; i_reg < 3; ++i_reg) { - ue_true.push_back(sumptm_toptrue[i_reg]); + ueTrue.push_back(sumptmTopTrue[i_reg]); } - ue.fill(HIST(pNumDenTrue[0]), flPtTrue, ue_true[0]); - ue.fill(HIST(pSumPtTrue[0]), flPtTrue, ue_true[3]); + ue.fill(HIST(pNumDenTrue[0]), flPtTrue, ueTrue[0]); + ue.fill(HIST(pSumPtTrue[0]), flPtTrue, ueTrue[3]); - ue.fill(HIST(pNumDenTrue[1]), flPtTrue, ue_true[1]); - ue.fill(HIST(pSumPtTrue[1]), flPtTrue, ue_true[4]); + ue.fill(HIST(pNumDenTrue[1]), flPtTrue, ueTrue[1]); + ue.fill(HIST(pSumPtTrue[1]), flPtTrue, ueTrue[4]); - ue.fill(HIST(pNumDenTrue[2]), flPtTrue, ue_true[2]); - ue.fill(HIST(pSumPtTrue[2]), flPtTrue, ue_true[5]); + ue.fill(HIST(pNumDenTrue[2]), flPtTrue, ueTrue[2]); + ue.fill(HIST(pSumPtTrue[2]), flPtTrue, ueTrue[5]); ptArrayTrue.clear(); phiArrayTrue.clear(); indexArrayTrue.clear(); - if (sel8 && !collision.sel8()) { - return; - } + ue.fill(HIST("hCounter"), 0); + + ue.fill(HIST("hCounter"), 1); - if (removeITSROFBorder && (!collision.selection_bit(o2::aod::evsel::kIsTriggerTVX) || !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder))) { + if (sel8 && !collision.sel8()) { return; } - if (manuallyApplysel8 && (!collision.selection_bit(o2::aod::evsel::kIsTriggerTVX) || !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder))) { + if (removeITSROFBorder && + (!collision.selection_bit(o2::aod::evsel::kIsTriggerTVX) || + !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder))) { return; } - ue.fill(HIST("hCounter"), 1); + ue.fill(HIST("hCounter"), 2); - if (piluprejection && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + if (piluprejection && + !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { return; } - ue.fill(HIST("hCounter"), 2); + ue.fill(HIST("hCounter"), 3); - if (goodzvertex && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + if (goodzvertex && + !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { return; } - ue.fill(HIST("hCounter"), 3); + ue.fill(HIST("hCounter"), 4); // only PS if ((std::abs(collision.posZ()) >= 10.f)) { return; } - ue.fill(HIST("hCounter"), 4); - - ue.fill(HIST(pNumDenTruePS[0]), flPtTrue, ue_true[0]); - ue.fill(HIST(pSumPtTruePS[0]), flPtTrue, ue_true[3]); + ue.fill(HIST("hCounter"), 5); - ue.fill(HIST(pNumDenTruePS[1]), flPtTrue, ue_true[1]); - ue.fill(HIST(pSumPtTruePS[1]), flPtTrue, ue_true[4]); + ue.fill(HIST(pNumDenTruePS[0]), flPtTrue, ueTrue[0]); + ue.fill(HIST(pSumPtTruePS[0]), flPtTrue, ueTrue[3]); - ue.fill(HIST(pNumDenTruePS[2]), flPtTrue, ue_true[2]); - ue.fill(HIST(pSumPtTruePS[2]), flPtTrue, ue_true[5]); + ue.fill(HIST(pNumDenTruePS[1]), flPtTrue, ueTrue[1]); + ue.fill(HIST(pSumPtTruePS[1]), flPtTrue, ueTrue[4]); - // ue.fill(HIST("hCounter"), 2); + ue.fill(HIST(pNumDenTruePS[2]), flPtTrue, ueTrue[2]); + ue.fill(HIST(pSumPtTruePS[2]), flPtTrue, ueTrue[5]); ue.fill(HIST("hvtxZ"), vtxZ); // loop over MC true particles int multTrue = 0; - for (auto& particle : particles) { + for (const auto& particle : particles) { auto pdgParticle = pdg->GetParticle(particle.pdgCode()); if (!pdgParticle || pdgParticle->Charge() == 0.) { continue; @@ -799,11 +1028,13 @@ void ueCharged::processMeasMC(const C& collision, const T& tracks, const P& part double flPhi = 0; int flIndex = 0; int multRec = 0; - for (auto& track : tracks) { + int track_multiplicity = 0; + + for (const auto& track : tracks) { if (!mySelectionPrim.IsSelected(track)) { continue; } - + track_multiplicity++; ue.fill(HIST("hdNdeta"), track.eta()); ue.fill(HIST("vtxZEta"), track.eta(), vtxZ); ue.fill(HIST("phiEta"), track.eta(), track.phi()); @@ -815,22 +1046,24 @@ void ueCharged::processMeasMC(const C& collision, const T& tracks, const P& part flIndex = track.globalIndex(); } } + + ue.fill(HIST("hPtLeadingVsTracks"), flPt, track_multiplicity); ue.fill(HIST("hmultRec"), multRec); ue.fill(HIST("hPtLeadingMeasured"), flPt); ue.fill(HIST("hPtLeadingRecPS"), flPt); - std::vector ue_rec; - ue_rec.clear(); - int nchm_top[3]; - double sumptm_top[3]; + std::vector ueRec; + ueRec.clear(); + int nchmTop[3]; + double sumptmTop[3]; for (int i = 0; i < 3; ++i) { - nchm_top[i] = 0; - sumptm_top[i] = 0; + nchmTop[i] = 0; + sumptmTop[i] = 0; } - std::vector ptArray; - std::vector phiArray; + std::vector ptArray; + std::vector phiArray; std::vector indexArray; - for (auto& track : tracks) { + for (const auto& track : tracks) { if (mySelectionOpenDCA.IsSelected(track)) { // TODO: set cuts w/o DCA cut ue.fill(HIST("hPTVsDCAData"), track.pt(), track.dcaXY()); @@ -843,7 +1076,7 @@ void ueCharged::processMeasMC(const C& collision, const T& tracks, const P& part if (mySelectionOpenDCA.IsSelected(track)) { ue.fill(HIST("hPtDCAall"), track.pt(), track.dcaXY()); } - const auto& particle = track.template mcParticle_as(); + const auto& particle = track.mcParticle(); if (particle.isPhysicalPrimary()) { if (mySelectionPrim.IsSelected(track)) { @@ -859,7 +1092,8 @@ void ueCharged::processMeasMC(const C& collision, const T& tracks, const P& part ue.fill(HIST("hPtOutSec"), track.pt()); } if (mySelectionOpenDCA.IsSelected(track)) { - if (particle.producedByGenerator()) { // i guess these are from decays + if (particle + .producedByGenerator()) { // i guess these are from decays ue.fill(HIST("hPtDCAWeak"), track.pt(), track.dcaXY()); } else { //// i guess these are from material ue.fill(HIST("hPtDCAMat"), track.pt(), track.dcaXY()); @@ -871,7 +1105,7 @@ void ueCharged::processMeasMC(const C& collision, const T& tracks, const P& part if (mySelectionPrim.IsSelected(track)) { // applying the efficiency twice for the misrec of leading particle - if (f_Eff->Eval(track.pt()) > gRandom->Uniform(0, 1)) { + if (fEff->Eval(track.pt()) > gRandom->Uniform(0, 1)) { ptArray.push_back(track.pt()); phiArray.push_back(track.phi()); indexArray.push_back(track.globalIndex()); @@ -882,55 +1116,56 @@ void ueCharged::processMeasMC(const C& collision, const T& tracks, const P& part continue; } - double DPhi = DeltaPhi(track.phi(), flPhi); + double dPhi = deltaPhi(track.phi(), flPhi); // definition of the topological regions - if (TMath::Abs(DPhi) < M_PI / 3.0) { // near side - ue.fill(HIST(hPhi[0]), DPhi); + if (std::abs(dPhi) < o2::constants::math::PI / 3.0) { // near side + ue.fill(HIST(hPhi[0]), dPhi); ue.fill(HIST(hPtVsPtLeadingData[0]), flPt, track.pt()); - nchm_top[0]++; - sumptm_top[0] += track.pt(); - } else if (TMath::Abs(DPhi - M_PI) < M_PI / 3.0) { // away side - ue.fill(HIST(hPhi[1]), DPhi); + nchmTop[0]++; + sumptmTop[0] += track.pt(); + } else if (std::abs(dPhi - o2::constants::math::PI) < + o2::constants::math::PI / 3.0) { // away side + ue.fill(HIST(hPhi[1]), dPhi); ue.fill(HIST(hPtVsPtLeadingData[1]), flPt, track.pt()); - nchm_top[1]++; - sumptm_top[1] += track.pt(); + nchmTop[1]++; + sumptmTop[1] += track.pt(); } else { // transverse side - ue.fill(HIST(hPhi[2]), DPhi); + ue.fill(HIST(hPhi[2]), dPhi); ue.fill(HIST(hPtVsPtLeadingData[2]), flPt, track.pt()); - nchm_top[2]++; - sumptm_top[2] += track.pt(); + nchmTop[2]++; + sumptmTop[2] += track.pt(); } } } for (int i_reg = 0; i_reg < 3; ++i_reg) { - ue_rec.push_back(1.0 * nchm_top[i_reg]); + ueRec.push_back(1.0 * nchmTop[i_reg]); } for (int i_reg = 0; i_reg < 3; ++i_reg) { - ue_rec.push_back(sumptm_top[i_reg]); + ueRec.push_back(sumptmTop[i_reg]); } // add flags for Vtx, PS, ev sel - ue.fill(HIST(pNumDenMeasuredPS[0]), flPt, ue_rec[0]); - ue.fill(HIST(pNumDenData[0]), flPt, ue_rec[0]); - ue.fill(HIST(pSumPtMeasuredPS[0]), flPt, ue_rec[3]); - ue.fill(HIST(pSumPtData[0]), flPt, ue_rec[3]); + ue.fill(HIST(pNumDenMeasuredPS[0]), flPt, ueRec[0]); + ue.fill(HIST(pNumDenData[0]), flPt, ueRec[0]); + ue.fill(HIST(pSumPtMeasuredPS[0]), flPt, ueRec[3]); + ue.fill(HIST(pSumPtData[0]), flPt, ueRec[3]); - ue.fill(HIST(pNumDenMeasuredPS[1]), flPt, ue_rec[1]); - ue.fill(HIST(pNumDenData[1]), flPt, ue_rec[1]); - ue.fill(HIST(pSumPtMeasuredPS[1]), flPt, ue_rec[4]); - ue.fill(HIST(pSumPtData[1]), flPt, ue_rec[4]); + ue.fill(HIST(pNumDenMeasuredPS[1]), flPt, ueRec[1]); + ue.fill(HIST(pNumDenData[1]), flPt, ueRec[1]); + ue.fill(HIST(pSumPtMeasuredPS[1]), flPt, ueRec[4]); + ue.fill(HIST(pSumPtData[1]), flPt, ueRec[4]); - ue.fill(HIST(pNumDenMeasuredPS[2]), flPt, ue_rec[2]); - ue.fill(HIST(pNumDenData[2]), flPt, ue_rec[2]); - ue.fill(HIST(pSumPtMeasuredPS[2]), flPt, ue_rec[5]); - ue.fill(HIST(pSumPtData[2]), flPt, ue_rec[5]); + ue.fill(HIST(pNumDenMeasuredPS[2]), flPt, ueRec[2]); + ue.fill(HIST(pNumDenData[2]), flPt, ueRec[2]); + ue.fill(HIST(pSumPtMeasuredPS[2]), flPt, ueRec[5]); + ue.fill(HIST(pSumPtData[2]), flPt, ueRec[5]); ue.fill(HIST("hPtLeadingData"), flPt); // Compute data driven (DD) missidentification correction - Float_t flPtdd = 0; // leading pT - Float_t flPhidd = 0; + float flPtdd = 0; // leading pT + float flPhidd = 0; int flIndexdd = 0; int ntrkdd = ptArray.size(); @@ -941,49 +1176,179 @@ void ueCharged::processMeasMC(const C& collision, const T& tracks, const P& part flIndexdd = indexArray[i]; } } - int nchm_topdd[3]; - double sumptm_topdd[3]; + int nchmTopdd[3]; + double sumptmTopdd[3]; for (int i = 0; i < 3; ++i) { - nchm_topdd[i] = 0; - sumptm_topdd[i] = 0; + nchmTopdd[i] = 0; + sumptmTopdd[i] = 0; } for (int i = 0; i < ntrkdd; ++i) { if (indexArray[i] == flIndexdd) { continue; } - double DPhi = DeltaPhi(phiArray[i], flPhidd); - if (TMath::Abs(DPhi) < M_PI / 3.0) { // near side - nchm_topdd[0]++; - sumptm_topdd[0] += ptArray[i]; - } else if (TMath::Abs(DPhi - M_PI) < M_PI / 3.0) { // away side - nchm_topdd[1]++; - sumptm_topdd[1] += ptArray[i]; + double dPhi = deltaPhi(phiArray[i], flPhidd); + if (std::abs(dPhi) < o2::constants::math::PI / 3.0) { // near side + nchmTopdd[0]++; + sumptmTopdd[0] += ptArray[i]; + } else if (std::abs(dPhi - o2::constants::math::PI) < + o2::constants::math::PI / 3.0) { // away side + nchmTopdd[1]++; + sumptmTopdd[1] += ptArray[i]; } else { // transverse side - nchm_topdd[2]++; - sumptm_topdd[2] += ptArray[i]; + nchmTopdd[2]++; + sumptmTopdd[2] += ptArray[i]; } } - ue.fill(HIST(hNumDenMCDd[0]), flPtdd, nchm_topdd[0]); - ue.fill(HIST(hSumPtMCDd[0]), flPtdd, sumptm_topdd[0]); + ue.fill(HIST(hNumDenMCDd[0]), flPtdd, nchmTopdd[0]); + ue.fill(HIST(hSumPtMCDd[0]), flPtdd, sumptmTopdd[0]); - ue.fill(HIST(hNumDenMCDd[1]), flPtdd, nchm_topdd[1]); - ue.fill(HIST(hSumPtMCDd[1]), flPtdd, sumptm_topdd[1]); + ue.fill(HIST(hNumDenMCDd[1]), flPtdd, nchmTopdd[1]); + ue.fill(HIST(hSumPtMCDd[1]), flPtdd, sumptmTopdd[1]); - ue.fill(HIST(hNumDenMCDd[2]), flPtdd, nchm_topdd[2]); - ue.fill(HIST(hSumPtMCDd[2]), flPtdd, sumptm_topdd[2]); + ue.fill(HIST(hNumDenMCDd[2]), flPtdd, nchmTopdd[2]); + ue.fill(HIST(hSumPtMCDd[2]), flPtdd, sumptmTopdd[2]); if (flIndexdd == flIndex) { - ue.fill(HIST(hNumDenMCMatchDd[0]), flPtdd, nchm_topdd[0]); - ue.fill(HIST(hSumPtMCMatchDd[0]), flPtdd, sumptm_topdd[0]); + ue.fill(HIST(hNumDenMCMatchDd[0]), flPtdd, nchmTopdd[0]); + ue.fill(HIST(hSumPtMCMatchDd[0]), flPtdd, sumptmTopdd[0]); - ue.fill(HIST(hNumDenMCMatchDd[1]), flPtdd, nchm_topdd[1]); - ue.fill(HIST(hSumPtMCMatchDd[1]), flPtdd, sumptm_topdd[1]); + ue.fill(HIST(hNumDenMCMatchDd[1]), flPtdd, nchmTopdd[1]); + ue.fill(HIST(hSumPtMCMatchDd[1]), flPtdd, sumptmTopdd[1]); - ue.fill(HIST(hNumDenMCMatchDd[2]), flPtdd, nchm_topdd[2]); - ue.fill(HIST(hSumPtMCMatchDd[2]), flPtdd, sumptm_topdd[2]); + ue.fill(HIST(hNumDenMCMatchDd[2]), flPtdd, nchmTopdd[2]); + ue.fill(HIST(hSumPtMCMatchDd[2]), flPtdd, sumptmTopdd[2]); } ptArray.clear(); phiArray.clear(); indexArray.clear(); } + +template +void ueCharged::analyzeEventAndTrackSelection(const C& collision, + const T& tracks) +{ + + // z-vertex from FT0 vs PV analysis + + const auto& foundBC = collision.template foundBC_as(); + + if (foundBC.has_ft0()) { + ue.fill(HIST("hVtxFT0VsVtxCol"), foundBC.ft0().posZ(), collision.posZ()); + } + + ue.fill(HIST("hvtxZ_before"), collision.posZ()); + + if (sel8 && !collision.sel8()) { + return; + } + + if (removeITSROFBorder && + (!collision.selection_bit(o2::aod::evsel::kIsTriggerTVX) || + !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder))) { + return; + } + + if (foundBC.has_ft0()) { + ue.fill(HIST("hVtxFT0VsVtxCol_afterSel8"), foundBC.ft0().posZ(), + collision.posZ()); + } + + if (piluprejection && + !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + return; + } + + if (foundBC.has_ft0()) { + ue.fill(HIST("hVtxFT0VsVtxCol_afterPile"), foundBC.ft0().posZ(), + collision.posZ()); + } + + if (goodzvertex && + !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + return; + } + + if (foundBC.has_ft0()) { + ue.fill(HIST("hVtxFT0VsVtxCol_afterGoodZvtx"), foundBC.ft0().posZ(), + collision.posZ()); + } + + ue.fill(HIST("hvtxZ_after"), collision.posZ()); + + // analysis of the track selection + + int tracks_before = 0; + int tracks_after = 0; + + for (auto& track : tracks) { + + if (track.hasITS() && track.hasTPC()) { + ue.fill(HIST("preselection_track/ITS/itsNCls"), track.itsNCls()); + ue.fill(HIST("preselection_track/ITS/itsChi2NCl"), track.itsChi2NCl()); + ue.fill(HIST("preselection_track/ITS/itsClusterMap"), + track.itsClusterMap()); + ue.fill(HIST("preselection_track/TPC/tpcNClsFindable"), + track.tpcNClsFindable()); + ue.fill(HIST("preselection_track/TPC/tpcNClsFound"), + track.tpcNClsFound()); + ue.fill(HIST("preselection_track/TPC/tpcNClsShared"), + track.tpcNClsShared()); + ue.fill(HIST("preselection_track/TPC/tpcCrossedRows"), + track.tpcNClsCrossedRows()); + ue.fill(HIST("preselection_track/TPC/tpcCrossedRowsOverFindableCls"), + track.tpcCrossedRowsOverFindableCls()); + ue.fill(HIST("preselection_track/TPC/tpcFractionSharedCls"), + track.tpcFractionSharedCls()); + ue.fill(HIST("preselection_track/TPC/tpcChi2NCl"), track.tpcChi2NCl()); + ue.fill(HIST("preselection_track/hvtxZ"), track.dcaZ()); + ue.fill(HIST("preselection_track/hvtxXY"), track.dcaXY()); + tracks_before++; + } + + if (mySelectionPrim.IsSelected(track)) { + if (track.hasITS() && track.hasTPC()) { + ue.fill(HIST("postselection_track/ITS/itsNCls"), track.itsNCls()); + ue.fill(HIST("postselection_track/ITS/itsChi2NCl"), track.itsChi2NCl()); + ue.fill(HIST("postselection_track/ITS/itsClusterMap"), + track.itsClusterMap()); + ue.fill(HIST("postselection_track/TPC/tpcNClsFindable"), + track.tpcNClsFindable()); + ue.fill(HIST("postselection_track/TPC/tpcNClsFound"), + track.tpcNClsFound()); + ue.fill(HIST("postselection_track/TPC/tpcNClsShared"), + track.tpcNClsShared()); + ue.fill(HIST("postselection_track/TPC/tpcCrossedRows"), + track.tpcNClsCrossedRows()); + ue.fill(HIST("postselection_track/TPC/tpcCrossedRowsOverFindableCls"), + track.tpcCrossedRowsOverFindableCls()); + ue.fill(HIST("postselection_track/TPC/tpcFractionSharedCls"), + track.tpcFractionSharedCls()); + ue.fill(HIST("postselection_track/TPC/tpcChi2NCl"), track.tpcChi2NCl()); + ue.fill(HIST("postselection_track/hvtxZ"), track.dcaZ()); + ue.fill(HIST("postselection_track/hvtxXY"), track.dcaXY()); + tracks_after++; + } + } + } + + ue.fill(HIST("postselection_track/htracks"), tracks_after); + ue.fill(HIST("preselection_track/htracks"), tracks_before); + + // FT0 + float multT0A = foundBC.has_ft0() ? foundBC.ft0().sumAmpA() : -999.f; + float multT0C = foundBC.has_ft0() ? foundBC.ft0().sumAmpC() : -999.f; + + // z-vertex from FT0 vs PV + if (foundBC.has_ft0()) { + ue.fill(HIST("hVtxFT0MinusVtxColVsMultT0M"), + foundBC.ft0().posZ() - collision.posZ(), multT0A + multT0C); + } + + ue.fill(HIST("postselection_track/hT0MVsTracks"), multT0A + multT0C, + tracks_after); + ue.fill(HIST("postselection_track/hVtxFT0VsTracks"), foundBC.ft0().posZ(), + tracks_after); + ue.fill(HIST("postselection_track/hVtxVsTracks"), collision.posZ(), + tracks_after); +} From 63624ac1bd4ffaeaa800231d0398dcfa96ec6ef5 Mon Sep 17 00:00:00 2001 From: ArkaprabhaSaha001 Date: Fri, 19 Sep 2025 02:16:08 +0200 Subject: [PATCH 448/986] [PWGLF] Add new task for nuclei analysis in light ions. (#13018) Co-authored-by: arkaprabha Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Nuspex/CMakeLists.txt | 5 + PWGLF/Tasks/Nuspex/antinucleiTask.cxx | 172 ++++++++++++++++++++++++++ 2 files changed, 177 insertions(+) create mode 100644 PWGLF/Tasks/Nuspex/antinucleiTask.cxx diff --git a/PWGLF/Tasks/Nuspex/CMakeLists.txt b/PWGLF/Tasks/Nuspex/CMakeLists.txt index 8f134d60175..38d5704f683 100644 --- a/PWGLF/Tasks/Nuspex/CMakeLists.txt +++ b/PWGLF/Tasks/Nuspex/CMakeLists.txt @@ -119,6 +119,11 @@ o2physics_add_dpl_workflow(nuclei-ebye PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(anti-nuclei-hist + SOURCES antinucleiTask.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(nuclei-toward-transv SOURCES nuclei_in_toward_transv_regions.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore diff --git a/PWGLF/Tasks/Nuspex/antinucleiTask.cxx b/PWGLF/Tasks/Nuspex/antinucleiTask.cxx new file mode 100644 index 00000000000..7cf38de948f --- /dev/null +++ b/PWGLF/Tasks/Nuspex/antinucleiTask.cxx @@ -0,0 +1,172 @@ +// 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 antinucleiTask.cxx +/// \brief A task to analyse Anti-nuclei +/// \author Arkaprabha Saha + +#include "Common/Core/PID/TPCPIDResponse.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/TrackSelectionDefaults.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "DataFormatsTPC/BetheBlochAleph.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" + +#include + +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using CollisionWithEvSel = soa::Join; +using TotalTracks = soa::Join; + +namespace +{ +static const std::vector particleName{"d"}; +static const double kBetheBlochDefault[6]{-1.e32, -1.e32, -1.e32, -1.e32, -1.e32, -1.e32}; +static const std::vector betheBlochParNames{"p0", "p1", "p2", "p3", "p4", "resolution"}; +static const float maxEtaCut = 0.8f; +static const int minTpcCrossedRowsCut = 70; +static const float maxVertexZCut = 10.f; +} // namespace + +struct antinucleiTask { + // Histogram registry: for holding histograms + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // Configurable track cuts + Configurable trackNclusTPCcut{"trackNclusTPCcut", 70.0f, "min number of TPC clusters"}; + Configurable trackNclusITScut{"trackNclusITScut", 4.0f, "min number of ITS clusters"}; + Configurable chi2TPC{"chi2TPC", 4.0f, "max chi2 per cluster TPC"}; + Configurable chi2ITS{"chi2ITS", 36.0f, "max chi2 per cluster ITS"}; + Configurable trackDCAz{"trackDCAz", 0.1f, "maxDCAz"}; + Configurable trackDCAxy{"trackDCAxy", 0.1f, "maxDCAxy"}; + Configurable tpcNSigmaCut{"tpcNSigmaCut", 3.0f, "tpcNSigmaCut"}; + Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {kBetheBlochDefault, 1, 6, particleName, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for deuteron"}; + + void init(InitContext const&) + { // Defining the Histogram Axes + ConfigurableAxis etaAxis{"etaAxis", {16, -0.8, +0.8}, "#eta"}; + ConfigurableAxis phiAxis{"phiAxis", {70, 0.f, 7.f}, "#phi"}; + ConfigurableAxis zVtxAxis{"zVtxAxis", {100, -20.f, 20.f}, "Primary Vertex z (cm)"}; + ConfigurableAxis nSigmaAxis{"nSigmaAxis", {50, -5.f, 5.f}, "N_{#sigma}"}; + ConfigurableAxis ptAxis{"ptAxis", {100, -5.0f, 5.0f}, "p_{T} (GeV/c)"}; + ConfigurableAxis centAxis{"centAxis", {100, 0, 100.0f}, "Centrality"}; + ConfigurableAxis momAxis{"momAxis", {5.e2, 0.f, 5.f}, "momentum axis binning"}; + ConfigurableAxis tpcAxis{"tpcAxis", {4.e2, 0.f, 4.e3f}, "tpc signal axis binning"}; + + // Creating histograms + histos.add("RawzVtx", "RawzVtx", kTH1F, {{zVtxAxis, "Primary Vertex z (cm)"}}); + histos.add("zVtx", "zVtx", kTH1F, {{zVtxAxis, "Primary Vertex z (cm)"}}); + histos.add("RawEta", "RawEta", kTH1F, {{etaAxis, "#eta"}}); + histos.add("Eta", "Eta", kTH1F, {{etaAxis, "#eta"}}); + histos.add("RawPhi", "RawPhi", kTH1F, {{phiAxis, "#phi (rad)"}}); + histos.add("Phi", "Phi", kTH1F, {{phiAxis, "#phi (rad)"}}); + histos.add("RawPt", "RawPt", kTH1F, {{ptAxis, "#it{p}_{T} (GeV/#it{c})"}}); + histos.add("Pt", "Pt", kTH1F, {{ptAxis, "#it{p}_{T} (GeV/#it{c})"}}); + histos.add("TpcSignal", "TpcSignal", kTH2F, {{momAxis, "#it{p}_{TPC} (GeV/#it{c})"}, {tpcAxis, "d#it{E}/d#it{x}_{TPC}"}}); + histos.add("RawtpcNSigma", "RawtpcNSigma", kTH3F, {{centAxis, "Centrality"}, {ptAxis, "#it{p}_{T} (GeV/#it{c})"}, {nSigmaAxis, "N_{#sigma}"}}); + histos.add("tpcNSigma", "tpcNSigma", kTH3F, {{centAxis, "Centrality"}, {ptAxis, "#it{p}_{T} (GeV/#it{c})"}, {nSigmaAxis, "N_{#sigma}"}}); + histos.add("RawtofNSigma", "RawtofNSigma", kTH3F, {{centAxis, "Centrality"}, {ptAxis, "#it{p}_{T} (GeV/#it{c})"}, {nSigmaAxis, "N_{#sigma}"}}); + histos.add("tofNSigma", "tofNSigma", kTH3F, {{centAxis, "Centrality"}, {ptAxis, "#it{p}_{T} (GeV/#it{c})"}, {nSigmaAxis, "N_{#sigma}"}}); + } + + // Function to apply track cuts + template + bool isGoodTrack(const T& track) + { + if (track.eta() > maxEtaCut) + return false; + if (track.tpcNClsFound() < trackNclusTPCcut) + return false; + if (track.tpcNClsCrossedRows() < minTpcCrossedRowsCut) + return false; + if (track.itsNCls() < trackNclusITScut) + return false; + if (track.tpcChi2NCl() > chi2TPC) + return false; + if (track.itsChi2NCl() > chi2ITS) + return false; + if (std::abs(track.dcaXY()) > trackDCAxy) + return false; + if (std::abs(track.dcaZ()) > trackDCAz) + return false; + + return true; + } + + // The process function + void process(CollisionWithEvSel::iterator const& collision, TotalTracks const& tracks) + { + // Event Selection + if (std::abs(collision.posZ()) > maxVertexZCut) { + return; + } + + // Filling the z-vertex histogram before the event selection cuts. + histos.fill(HIST("RawzVtx"), collision.posZ()); + + // Applying the built-in O2 event selection (sel8). + if (!collision.sel8()) { + return; + } + + // Filling the z-vertex histogram after the event selection cuts. + histos.fill(HIST("zVtx"), collision.posZ()); + + // Track Selection + for (const auto& track : tracks) { + + double expBethe{tpc::BetheBlochAleph(static_cast(track.tpcInnerParam() / o2::constants::physics::MassDeuteron), cfgBetheBlochParams->get("p0"), cfgBetheBlochParams->get("p1"), cfgBetheBlochParams->get("p2"), cfgBetheBlochParams->get("p3"), cfgBetheBlochParams->get("p4"))}; + double expSigma{expBethe * cfgBetheBlochParams->get("resolution")}; + float tpcNSigmaDeuteron = static_cast((track.tpcSignal() - expBethe) / expSigma); + + float pt = track.sign() > 0 ? track.pt() : -track.pt(); + // Filling histograms with track data before applying any cuts. + histos.fill(HIST("RawEta"), track.eta()); + histos.fill(HIST("RawPhi"), track.phi()); + histos.fill(HIST("RawPt"), pt); + histos.fill(HIST("RawtpcNSigma"), collision.centFT0C(), pt, tpcNSigmaDeuteron); + histos.fill(HIST("RawtofNSigma"), collision.centFT0C(), pt, track.tofNSigmaDe()); + + // If the track is good, fill the "after cuts" histograms. + if (isGoodTrack(track)) { + histos.fill(HIST("Eta"), track.eta()); + histos.fill(HIST("Phi"), track.phi()); + histos.fill(HIST("Pt"), pt); + histos.fill(HIST("tpcNSigma"), collision.centFT0C(), pt, tpcNSigmaDeuteron); + histos.fill(HIST("TpcSignal"), track.tpcInnerParam(), track.tpcSignal()); + + if (std::abs(tpcNSigmaDeuteron) < tpcNSigmaCut) { + histos.fill(HIST("tofNSigma"), collision.centFT0C(), pt, track.tofNSigmaDe()); + } + } + } + } + + PROCESS_SWITCH(antinucleiTask, process, "process", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} From c5f6ac3db54f19dbf059b935ef80d0c4cfb80cf9 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 19 Sep 2025 02:36:39 +0200 Subject: [PATCH 449/986] [PWGEM/Dilepton] remove acc axis in Gen (#13032) --- PWGEM/Dilepton/Core/Dilepton.h | 20 +--- PWGEM/Dilepton/Core/DileptonMC.h | 160 ++++++++++++++++--------------- PWGEM/Dilepton/Core/PhotonHBT.h | 9 +- 3 files changed, 91 insertions(+), 98 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 61ef5dab390..cdb9867f7e0 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -183,7 +183,6 @@ struct Dilepton { Configurable cfg_min_phiv{"cfg_min_phiv", 0.0, "min phiv (constant)"}; Configurable cfg_max_phiv{"cfg_max_phiv", 3.2, "max phiv (constant)"}; Configurable cfg_apply_detadphi{"cfg_apply_detadphi", false, "flag to apply deta-dphi elliptic cut at PV"}; - Configurable cfg_apply_detadphiposition{"cfg_apply_detadphiposition", false, "flag to apply deta-dphi elliptic cut at certain radius"}; Configurable cfg_min_deta{"cfg_min_deta", 0.02, "min deta between 2 electrons (elliptic cut)"}; Configurable cfg_min_dphi{"cfg_min_dphi", 0.2, "min dphi between 2 electrons (elliptic cut)"}; Configurable cfg_min_opang{"cfg_min_opang", 0.0, "min opening angle"}; @@ -219,7 +218,6 @@ struct Dilepton { Configurable cfg_max_its_cluster_size{"cfg_max_its_cluster_size", 16.f, "max ITS cluster size"}; Configurable cfg_min_rel_diff_pin{"cfg_min_rel_diff_pin", -1e+10, "min rel. diff. between pin and ppv"}; Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; - Configurable cfgRefR{"cfgRefR", 1.2, "reference R (in m) for extrapolation"}; // https://cds.cern.ch/record/1419204 Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif : 4, kPIDML : 5, kTPChadrejORTOFreq_woTOFif : 6]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; @@ -558,7 +556,6 @@ struct Dilepton { if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kQC)) { fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y}, true); fRegistry.add("Pair/same/uls/hDeltaEtaDeltaPhi", "#Delta#eta-#Delta#varphi between 2 tracks;#Delta#varphi (rad.);#Delta#eta;", kTH2D, {{180, -M_PI, M_PI}, {400, -2, +2}}, true); - fRegistry.add("Pair/same/uls/hDeltaEtaDeltaPhiPosition", "#Delta#eta-#Delta#varphi^{*} between 2 tracks;#Delta#varphi^{*} (rad.);#Delta#eta;", kTH2D, {{180, -M_PI, M_PI}, {400, -2, +2}}, true); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.add("Pair/same/uls/hMvsPhiV", "m_{ee} vs. #varphi_{V};#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", kTH2D, {{90, 0, M_PI}, {100, 0.0f, 1.0f}}, true); // phiv is only for dielectron @@ -679,7 +676,7 @@ struct Dilepton { fDielectronCut.SetPairDCARange(dielectroncuts.cfg_min_pair_dca3d, dielectroncuts.cfg_max_pair_dca3d); // in sigma fDielectronCut.SetMaxMeePhiVDep([&](float phiv) { return dielectroncuts.cfg_phiv_intercept + phiv * dielectroncuts.cfg_phiv_slope; }, dielectroncuts.cfg_min_phiv, dielectroncuts.cfg_max_phiv); fDielectronCut.ApplyPhiV(dielectroncuts.cfg_apply_phiv); - fDielectronCut.SetMindEtadPhi(dielectroncuts.cfg_apply_detadphi, dielectroncuts.cfg_apply_detadphiposition, dielectroncuts.cfg_min_deta, dielectroncuts.cfg_min_dphi); + fDielectronCut.SetMindEtadPhi(dielectroncuts.cfg_apply_detadphi, false, dielectroncuts.cfg_min_deta, dielectroncuts.cfg_min_dphi); fDielectronCut.SetPairOpAng(dielectroncuts.cfg_min_opang, dielectroncuts.cfg_max_opang); fDielectronCut.SetRequireDifferentSides(dielectroncuts.cfg_require_diff_sides); @@ -876,7 +873,7 @@ struct Dilepton { } if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - if (!cut.IsSelectedPair(t1, t2, d_bz, dielectroncuts.cfgRefR)) { + if (!cut.IsSelectedPair(t1, t2, d_bz, 0)) { return false; } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { @@ -928,21 +925,12 @@ struct Dilepton { float dphi = t1.sign() * v1.Pt() > t2.sign() * v2.Pt() ? v1.Phi() - v2.Phi() : v2.Phi() - v1.Phi(); o2::math_utils::bringToPMPi(dphi); - float phiPosition1 = t1.phi() + std::asin(t1.sign() * 0.30282 * (d_bz * 0.1) * dielectroncuts.cfgRefR / (2.f * t1.pt())); - float phiPosition2 = t2.phi() + std::asin(t2.sign() * 0.30282 * (d_bz * 0.1) * dielectroncuts.cfgRefR / (2.f * t2.pt())); - - phiPosition1 = RecoDecay::constrainAngle(phiPosition1, 0, 1); // 0-2pi - phiPosition2 = RecoDecay::constrainAngle(phiPosition2, 0, 1); // 0-2pi - float dphiPosition = t1.sign() * v1.Pt() > t2.sign() * v2.Pt() ? phiPosition1 - phiPosition2 : phiPosition2 - phiPosition1; - o2::math_utils::bringToPMPi(dphiPosition); - float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz(), t1.sign(), t2.sign(), d_bz); float opAng = o2::aod::pwgem::dilepton::utils::pairutil::getOpeningAngle(t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz()); if (t1.sign() * t2.sign() < 0) { // ULS fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hDeltaEtaDeltaPhi"), dphi, deta, weight); - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hDeltaEtaDeltaPhiPosition"), dphiPosition, deta, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hMvsPhiV"), phiv, v12.M(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hMvsOpAng"), opAng, v12.M(), weight); @@ -955,7 +943,6 @@ struct Dilepton { } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hDeltaEtaDeltaPhi"), dphi, deta, weight); - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hDeltaEtaDeltaPhiPosition"), dphiPosition, deta, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hMvsPhiV"), phiv, v12.M(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hMvsOpAng"), opAng, v12.M(), weight); @@ -968,7 +955,6 @@ struct Dilepton { } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hDeltaEtaDeltaPhi"), dphi, deta, weight); - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hDeltaEtaDeltaPhiPosition"), dphiPosition, deta, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hMvsPhiV"), phiv, v12.M(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hMvsOpAng"), opAng, v12.M(), weight); @@ -1421,7 +1407,7 @@ struct Dilepton { } if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - if (!cut.IsSelectedPair(t1, t2, d_bz, dielectroncuts.cfgRefR)) { + if (!cut.IsSelectedPair(t1, t2, d_bz, 0.0)) { return false; } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index 0f924be57f4..5e4a1a44590 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -178,7 +178,6 @@ struct DileptonMC { Configurable cfg_min_phiv{"cfg_min_phiv", 0.0, "min phiv (constant)"}; Configurable cfg_max_phiv{"cfg_max_phiv", 3.2, "max phiv (constant)"}; Configurable cfg_apply_detadphi{"cfg_apply_detadphi", false, "flag to apply deta-dphi elliptic cut at PV"}; - Configurable cfg_apply_detadphiposition{"cfg_apply_detadphiposition", false, "flag to apply deta-dphi elliptic cut at certain radius"}; Configurable cfg_min_deta{"cfg_min_deta", 0.02, "min deta between 2 electrons (elliptic cut)"}; Configurable cfg_min_dphi{"cfg_min_dphi", 0.2, "min dphi between 2 electrons (elliptic cut)"}; Configurable cfg_min_opang{"cfg_min_opang", 0.0, "min opening angle"}; @@ -214,7 +213,6 @@ struct DileptonMC { Configurable cfg_max_its_cluster_size{"cfg_max_its_cluster_size", 16.f, "max ITS cluster size"}; Configurable cfg_min_rel_diff_pin{"cfg_min_rel_diff_pin", -1e+10, "min rel. diff. between pin and ppv"}; Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; - Configurable cfgRefR{"cfgRefR", 1.2, "reference R (in m) for extrapolation"}; // https://cds.cern.ch/record/1419204 Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif = 4, kPIDML = 5]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; @@ -371,10 +369,9 @@ struct DileptonMC { const AxisSpec axis_aco{cfg_nbin_aco, 0, 1.f, "#alpha = 1 - #frac{|#varphi_{l^{+}} - #varphi_{l^{-}}|}{#pi}"}; // for kUPC const AxisSpec axis_asym_pt{cfg_nbin_asym_pt, 0, 1.f, "A = #frac{|p_{T,l^{+}} - p_{T,l^{-}}|}{|p_{T,l^{+}} + p_{T,l^{-}}|}"}; // for kUPC const AxisSpec axis_dphi_e_ee{cfg_nbin_dphi_e_ee, 0, M_PI, "#Delta#varphi = #varphi_{l} - #varphi_{ll} (rad.)"}; // for kUPC - const AxisSpec axis_isInAcc{2, -0.5, 1.5, "is in acc"}; // in acc or not (bool) // generated info - fRegistry.add("Generated/sm/PromptPi0/hs", "generated dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_isInAcc}, true); + fRegistry.add("Generated/sm/PromptPi0/hs", "generated dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_aco, axis_asym_pt, axis_dphi_e_ee}, true); fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/NonPromptPi0/"); fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/Eta/"); fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/EtaPrime/"); @@ -390,7 +387,7 @@ struct DileptonMC { fRegistry.add("Generated/sm/Omega2ll/hPtY", "pT of #omega meson", kTH2D, {axis_y, axis_pt_meson}, true); fRegistry.add("Generated/sm/Phi2ll/hPtY", "pT of #phi meson", kTH2D, {axis_y, axis_pt_meson}, true); - fRegistry.add("Generated/ccbar/c2l_c2l/hadron_hadron/hs", "generated dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_isInAcc}, true); + fRegistry.add("Generated/ccbar/c2l_c2l/hadron_hadron/hs", "generated dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_aco, axis_asym_pt, axis_dphi_e_ee}, true); fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", "Generated/ccbar/c2l_c2l/meson_meson/"); fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", "Generated/ccbar/c2l_c2l/baryon_baryon/"); fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", "Generated/ccbar/c2l_c2l/meson_baryon/"); @@ -666,7 +663,7 @@ struct DileptonMC { fDielectronCut.SetPairDCARange(dielectroncuts.cfg_min_pair_dca3d, dielectroncuts.cfg_max_pair_dca3d); // in sigma fDielectronCut.SetMaxMeePhiVDep([&](float phiv) { return dielectroncuts.cfg_phiv_intercept + phiv * dielectroncuts.cfg_phiv_slope; }, dielectroncuts.cfg_min_phiv, dielectroncuts.cfg_max_phiv); fDielectronCut.ApplyPhiV(dielectroncuts.cfg_apply_phiv); - fDielectronCut.SetMindEtadPhi(dielectroncuts.cfg_apply_detadphi, dielectroncuts.cfg_apply_detadphiposition, dielectroncuts.cfg_min_deta, dielectroncuts.cfg_min_dphi); + fDielectronCut.SetMindEtadPhi(dielectroncuts.cfg_apply_detadphi, false, dielectroncuts.cfg_min_deta, dielectroncuts.cfg_min_dphi); fDielectronCut.SetPairOpAng(dielectroncuts.cfg_min_opang, dielectroncuts.cfg_max_opang); fDielectronCut.SetRequireDifferentSides(dielectroncuts.cfg_require_diff_sides); @@ -855,7 +852,7 @@ struct DileptonMC { return false; } } - if (!cut.IsSelectedPair(t1, t2, d_bz, dielectroncuts.cfgRefR)) { + if (!cut.IsSelectedPair(t1, t2, d_bz, 0.0)) { return false; } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { @@ -1457,7 +1454,10 @@ struct DileptonMC { } o2::math_utils::bringToPMPi(phiPol); - bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); + // bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); + if (!isInAcceptance(t1) || !isInAcceptance(t2)) { + continue; + } if (mother_id > -1) { auto mcmother = mcparticles.iteratorAt(mother_id); @@ -1466,45 +1466,45 @@ struct DileptonMC { switch (std::abs(mcmother.pdgCode())) { case 111: if (IsFromCharm(mcmother, mcparticles) < 0 && IsFromBeauty(mcmother, mcparticles) < 0) { // prompt pi0 - fRegistry.fill(HIST("Generated/sm/PromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/sm/PromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else { // non-prompt pi0 - fRegistry.fill(HIST("Generated/sm/NonPromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/sm/NonPromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } break; case 221: - fRegistry.fill(HIST("Generated/sm/Eta/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/sm/Eta/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); break; case 331: - fRegistry.fill(HIST("Generated/sm/EtaPrime/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/sm/EtaPrime/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); break; case 113: - fRegistry.fill(HIST("Generated/sm/Rho/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/sm/Rho/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); break; case 223: - fRegistry.fill(HIST("Generated/sm/Omega/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/sm/Omega/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); if (mcmother.daughtersIds().size() == 2) { // omega->ee - fRegistry.fill(HIST("Generated/sm/Omega2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/sm/Omega2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } break; case 333: - fRegistry.fill(HIST("Generated/sm/Phi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/sm/Phi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); if (mcmother.daughtersIds().size() == 2) { // phi->ee - fRegistry.fill(HIST("Generated/sm/Phi2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/sm/Phi2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } break; case 443: { if (IsFromBeauty(mcmother, mcparticles) > 0) { - fRegistry.fill(HIST("Generated/sm/NonPromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/sm/NonPromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/sm/PromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/sm/PromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } break; } case 100443: { if (IsFromBeauty(mcmother, mcparticles) > 0) { - fRegistry.fill(HIST("Generated/sm/NonPromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/sm/NonPromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/sm/PromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/sm/PromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } break; } @@ -1517,105 +1517,105 @@ struct DileptonMC { auto mp2 = mcparticles.iteratorAt(t2.mothersIds()[0]); switch (hfee_type) { case static_cast(EM_HFeeType::kCe_Ce): { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); if (isCharmMeson(mp1) && isCharmMeson(mp2)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); if (std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 411) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dplus_Dminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dplus_Dminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if (std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 421) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_D0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_D0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if (std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 431) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dsplus_Dsminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dsplus_Dsminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 421) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 421)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_D0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_D0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 431)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 431)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } } else if (isCharmBaryon(mp1) && isCharmBaryon(mp2)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); if (std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4122) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcplus_Lcminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcplus_Lcminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if (std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4232) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicplus_Xicminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicplus_Xicminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if (std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4132) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xic0_Xic0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xic0_Xic0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if (std::abs(mp1.pdgCode()) == 4332 && std::abs(mp2.pdgCode()) == 4332) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Omegac0_Omegac0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Omegac0_Omegac0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4132 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xic0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xic0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } } else { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } } break; } case static_cast(EM_HFeeType::kBe_Be): { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); if (isBeautyMeson(mp1) && isBeautyMeson(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if (isBeautyBaryon(mp1) && isBeautyBaryon(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } break; } case static_cast(EM_HFeeType::kBCe_BCe): { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); if (isCharmMeson(mp1) && isCharmMeson(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if (isCharmBaryon(mp1) && isCharmBaryon(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } break; } case static_cast(EM_HFeeType::kBCe_Be_SameB): { // ULS - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } break; } @@ -1734,7 +1734,11 @@ struct DileptonMC { o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, -t1.pdgCode() / pdg_lepton, cos_thetaPol, phiPol); } o2::math_utils::bringToPMPi(phiPol); - bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); + + // bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); + if (!isInAcceptance(t1) || !isInAcceptance(t2)) { + continue; + } if (hfee_type > -1) { auto mp1 = mcparticles.iteratorAt(t1.mothersIds()[0]); @@ -1753,13 +1757,13 @@ struct DileptonMC { LOGF(info, "You should not see kBCe_Be_SameB in LS++. Good luck."); break; case static_cast(EM_HFeeType::kBCe_Be_DiffB): { // LS - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } break; } @@ -1875,7 +1879,11 @@ struct DileptonMC { o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, -t1.pdgCode() / pdg_lepton, cos_thetaPol, phiPol); } o2::math_utils::bringToPMPi(phiPol); - bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); + + // bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); + if (!isInAcceptance(t1) || !isInAcceptance(t2)) { + continue; + } if (hfee_type > -1) { auto mp1 = mcparticles.iteratorAt(t1.mothersIds()[0]); @@ -1894,13 +1902,13 @@ struct DileptonMC { LOGF(info, "You should not see kBCe_Be_SameB in LS--. Good luck."); break; case static_cast(EM_HFeeType::kBCe_Be_DiffB): { // LS - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), isInAcc); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); } break; } @@ -1938,7 +1946,7 @@ struct DileptonMC { } if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - if (!cut.template IsSelectedPair(t1, t2, d_bz, dielectroncuts.cfgRefR)) { + if (!cut.template IsSelectedPair(t1, t2, d_bz, 0.0)) { return false; } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { diff --git a/PWGEM/Dilepton/Core/PhotonHBT.h b/PWGEM/Dilepton/Core/PhotonHBT.h index 9948eac03a2..39938df8f0d 100644 --- a/PWGEM/Dilepton/Core/PhotonHBT.h +++ b/PWGEM/Dilepton/Core/PhotonHBT.h @@ -212,7 +212,6 @@ struct PhotonHBT { Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; Configurable cfg_require_itsib_any{"cfg_require_itsib_any", false, "flag to require ITS ib any hits"}; Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", true, "flag to require ITS ib 1st hit"}; - Configurable cfgRefR{"cfgRefR", 1.2, "reference R (in m) for extrapolation"}; // https://cds.cern.ch/record/1419204 Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif = 4, kPIDML = 5]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; @@ -866,7 +865,7 @@ struct PhotonHBT { continue; } } - if (!cut1.IsSelectedPair(pos1, ele1, d_bz, dielectroncuts.cfgRefR)) { + if (!cut1.IsSelectedPair(pos1, ele1, d_bz, 0.0)) { continue; } @@ -894,7 +893,7 @@ struct PhotonHBT { continue; } } - if (!cut2.IsSelectedPair(pos2, ele2, d_bz, dielectroncuts.cfgRefR)) { + if (!cut2.IsSelectedPair(pos2, ele2, d_bz, 0.0)) { continue; } @@ -1012,7 +1011,7 @@ struct PhotonHBT { continue; } } - if (!cut2.IsSelectedPair(pos2, ele2, d_bz, dielectroncuts.cfgRefR)) { + if (!cut2.IsSelectedPair(pos2, ele2, d_bz, 0.0)) { continue; } @@ -1380,7 +1379,7 @@ struct PhotonHBT { continue; } } - if (!cut.IsSelectedPair(pos, ele, d_bz, dielectroncuts.cfgRefR)) { + if (!cut.IsSelectedPair(pos, ele, d_bz, 0.0)) { continue; } passed_pairIds.emplace_back(std::make_pair(pos.globalIndex(), ele.globalIndex())); From 6f74b409fd536f6cfa7432a0f4e3d3ec4e82d705 Mon Sep 17 00:00:00 2001 From: Sandeep Dudi <69388148+sdudi123@users.noreply.github.com> Date: Fri, 19 Sep 2025 04:37:14 +0200 Subject: [PATCH 450/986] [PWGLF] Multiplicity and QA plots are added (#13035) Co-authored-by: sandeep dudi --- PWGLF/Tasks/Nuspex/spectraKinkPiKa.cxx | 244 ++++++++++++++++++++----- 1 file changed, 198 insertions(+), 46 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/spectraKinkPiKa.cxx b/PWGLF/Tasks/Nuspex/spectraKinkPiKa.cxx index 1b3c900fc35..4d8f6db1d26 100644 --- a/PWGLF/Tasks/Nuspex/spectraKinkPiKa.cxx +++ b/PWGLF/Tasks/Nuspex/spectraKinkPiKa.cxx @@ -63,8 +63,8 @@ using namespace o2::constants::physics; using VBracket = o2::math_utils::Bracket; using TracksFull = soa::Join; -using CollisionsFull = soa::Join; -using CollisionsFullMC = soa::Join; +using CollisionsFull = soa::Join; +using CollisionsFullMC = soa::Join; namespace { constexpr std::array LayerRadii{2.33959f, 3.14076f, 3.91924f, 19.6213f, 24.5597f, 34.388f, 39.3329f}; @@ -95,15 +95,16 @@ struct kinkBuilder { Produces outputDataTable; Service ccdb; // Selection criteria - Configurable maxDCAMothToPV{"maxDCAMothToPV", 0.1, "Max DCA of the mother to the PV"}; + Configurable maxDCAMothToPV{"maxDCAMothToPV", 0.2, "Max DCA of the mother to the PV"}; Configurable minDCADaugToPV{"minDCADaugToPV", 0., "Min DCA of the daughter to the PV"}; - Configurable minPtMoth{"minPtMoth", 0.5, "Minimum pT of the hypercandidate"}; + Configurable minPtMoth{"minPtMoth", 0.15, "Minimum pT of the hypercandidate"}; Configurable maxZDiff{"maxZDiff", 20., "Max z difference between the kink daughter and the mother"}; Configurable maxPhiDiff{"maxPhiDiff", 100, "Max phi difference between the kink daughter and the mother"}; Configurable timeMarginNS{"timeMarginNS", 600, "Additional time res tolerance in ns"}; - Configurable etaMax{"etaMax", 1., "eta daughter"}; + Configurable etaMaxDaug{"etaMaxDaug", 1., "eta max daughter"}; + Configurable etaMaxMoth{"etaMaxMoth", 1., "eta max Mother"}; Configurable nTPCClusMinDaug{"nTPCClusMinDaug", 30, "mother NTPC clusters cut"}; - Configurable itsChi2cut{"itsChi2cut", 30, "mother itsChi2 cut"}; + Configurable itsChi2cut{"itsChi2cut", 36, "mother itsChi2 cut"}; Configurable askTOFforDaug{"askTOFforDaug", false, "If true, ask for TOF signal"}; Configurable kaontopologhy{"kaontopologhy", true, "If true, selected mother have both ITS+TPC "}; @@ -215,14 +216,17 @@ struct kinkBuilder { svCreator.fillBC2Coll(collisions, bcs); for (const auto& track : tracks) { - if (std::abs(track.eta()) > etaMax) - continue; bool isDaug = selectDaugTrack(track); bool isMoth = selectMothTrack(track); if (!isDaug && !isMoth) continue; + if (isDaug && std::abs(track.eta()) > etaMaxDaug) + continue; + + if (isMoth && std::abs(track.eta()) > etaMaxMoth) + continue; int pdgHypo = isMoth ? 1 : 0; svCreator.appendTrackCand(track, collisions, pdgHypo, ambiguousTracks, bcs); @@ -362,6 +366,7 @@ struct spectraKinkPiKa { Configurable cutNSigmaPi{"cutNSigmaPi", 4, "NSigmaTPCPion"}; Configurable cutNSigmaKa{"cutNSigmaKa", 4, "NSigmaTPCKaon"}; Configurable cutNSigmaMu{"cutNSigmaMu", 4, "cutNSigmaMu"}; + Configurable etaCut{"etaCut", 0.8, "etaCut"}; Configurable rapCut{"rapCut", 0.8, "rapCut"}; Configurable kinkanglecut{"kinkanglecut", 2.0, "kinkanglecut"}; Configurable minradius{"minradius", 130.0, "minradiuscut"}; @@ -369,10 +374,11 @@ struct spectraKinkPiKa { Configurable dcaXYcut{"dcaXYcut", 0.2, "dcaXYcut"}; Configurable dcaZcut{"dcaZcut", 0.2, "dcaZcut"}; Configurable tpcChi2Cut{"tpcChi2Cut", 4.0, "tpcChi2Cut"}; - + Configurable centestimator{"centestimator", 0, "Select multiplicity estimator: 0 - FT0C, 1 - FT0A, 2 - FT0M, 3 - FV0A, 4 - PVTracks"}; Configurable pid{"pidMother", 321, ""}; Configurable dpid{"pidDaughter", 13, ""}; Configurable d0pid{"dopid", 0, ""}; + Configurable dptCut{"dptCut", 0, ""}; Preslice mPerCol = aod::track::collisionId; Preslice mtPerCol = aod::track::collisionId; @@ -387,37 +393,54 @@ struct spectraKinkPiKa { const AxisSpec vertexAxis{1200, -300., 300., "vrtx [cm]"}; const AxisSpec radiusAxis{600, 0., 300., "vrtx [cm]"}; const AxisSpec massAxis{600, 0.1, 0.7, "Inv mass (GeV/#it{c}^{2})"}; + const AxisSpec multAxis{120, 0, 120, "Multiplicity"}; // Event selection rEventSelection.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexAxis}}); + rEventSelection.add("hMultiplicity", "hMultiplicity", {HistType::kTH1F, {multAxis}}); - rpiKkink.add("h2_dau_pt_vs_eta_rec", "pt_vs_eta_dau", {HistType::kTH2F, {ptAxis, etaAxis}}); - rpiKkink.add("h2_moth_pt_vs_eta_rec", "pt_vs_eta_moth", {HistType::kTH2F, {ptAxis, etaAxis}}); + rpiKkink.add("h2_dau_pt_vs_eta_rec", "pt_vs_eta_dau", {HistType::kTH3F, {ptAxis, etaAxis, multAxis}}); + rpiKkink.add("h2_moth_pt_vs_eta_rec", "pt_vs_eta_moth", {HistType::kTH3F, {ptAxis, etaAxis, multAxis}}); rpiKkink.add("h2_pt_moth_vs_dau_rec", "pt_moth_vs_dau", {HistType::kTH2F, {ptAxis, ptAxis}}); rpiKkink.add("h2_qt", "qt", {HistType::kTH1F, {qtAxis}}); rpiKkink.add("h2_qt_vs_pt", "qt_pt", {HistType::kTH2F, {qtAxis, ptAxis}}); - - rpiKkink.add("h2_kink_angle", "kink angle", {HistType::kTH1F, {kinkAxis}}); + rpiKkink.add("h2_kink_angle", "kink angle", {HistType::kTH2F, {kinkAxis, multAxis}}); // pion - rpiKkink.add("h2_dau_pt_vs_eta_rec_pion", "pt_vs_eta_dau", {HistType::kTH2F, {ptAxis, etaAxis}}); - rpiKkink.add("h2_moth_pt_vs_eta_rec_pion", "pt_vs_eta_moth", {HistType::kTH2F, {ptAxis, etaAxis}}); + rpiKkink.add("h2_dau_pt_vs_eta_rec_pion", "pt_vs_eta_dau", {HistType::kTH3F, {ptAxis, etaAxis, multAxis}}); + rpiKkink.add("h2_moth_pt_vs_eta_rec_pion", "pt_vs_eta_moth", {HistType::kTH3F, {ptAxis, etaAxis, multAxis}}); rpiKkink.add("h2_pt_moth_vs_dau_rec_pion", "pt_moth_vs_dau", {HistType::kTH2F, {ptAxis, ptAxis}}); + rpiKkink.add("h2_qt_pion", "qt", {HistType::kTH1F, {qtAxis}}); + rpiKkink.add("h2_qt_vs_ptpion", "qt_pt", {HistType::kTH2F, {qtAxis, ptAxis}}); + rpiKkink.add("h2_kink_angle_pion", "kink angle", {HistType::kTH2F, {kinkAxis, multAxis}}); + // inv mass rpiKkink.add("h2_invmass_kaon", "Inv mass vs Pt", {HistType::kTH3F, {massAxis, ptAxis, ptAxis}}); rpiKkink.add("h2_invmass_pion", "Inv mass vs Pt", {HistType::kTH3F, {massAxis, ptAxis, ptAxis}}); - rpiKkink.add("h2_qt_pion", "qt", {HistType::kTH1F, {qtAxis}}); - rpiKkink.add("h2_qt_vs_ptpion", "qt_pt", {HistType::kTH2F, {qtAxis, ptAxis}}); - rpiKkink.add("h2_kink_angle_pion", "kink angle", {HistType::kTH1F, {kinkAxis}}); + rpiKkink.add("h2_kaon_data", "h2_kaon_data", HistType::kTHnSparseF, {massAxis, ptAxis, etaAxis, qtAxis, multAxis}, true); + rpiKkink.add("h2_pion_data", "h2_pion_data", HistType::kTHnSparseF, {massAxis, ptAxis, etaAxis, qtAxis, multAxis}, true); // track qa - rpiKkink.add("h2_kinkradius_vs_vz", "kink radius_vz", {HistType::kTH2F, {vertexAxis, radiusAxis}}); rpiKkink.add("h2_kink_vx_vs_vy", "kink vx vs vz ", {HistType::kTH2F, {vertexAxis, vertexAxis}}); + rpiKkink.add("tpc_dedx", "p vs dE/dx", {HistType::kTH2F, {{500, 0.0, 10.0}, {5000, 0.0, 5000.0}}}); + rpiKkink.add("tpc_nsigma_kaon", "p#k n#sigma", {HistType::kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}}); + rpiKkink.add("tpc_nsigma_pion", "p#pi n#sigma", {HistType::kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}}); + + rpiKkink.add("tr_dcaxyM", "dcaxym", {HistType::kTH1F, {{1000, -5.0, 5.0}}}); + rpiKkink.add("tr_dcaxyD", "dcaxyd", {HistType::kTH1F, {{1000, -5.0, 5.0}}}); + rpiKkink.add("tr_dcaxykink_topo", "tr_dcaxykink_topo", {HistType::kTH1F, {{1000, -5.0, 5.0}}}); + + rpiKkink.add("tr_chi2nclM", "chi2nclm", {HistType::kTH1F, {{100, 0.0, 100.0}}}); + rpiKkink.add("tr_chi2nclD", "chi2ncld", {HistType::kTH1F, {{100, 0.0, 100.0}}}); + rpiKkink.add("tr_tpcnclfindM", "tpcnclfindm", {HistType::kTH1F, {{300, 0.0, 300.0}}}); + rpiKkink.add("tr_tpcnclfindD", "tpcnclfindd", {HistType::kTH1F, {{300, 0.0, 300.0}}}); + rpiKkink.add("tr_itsChi2NClM", "itsChi2NClm", {HistType::kTH1F, {{200, 0.0, 200.0}}}); + if (doprocessMC) { rpiKkink.add("h2_dau_pt_vs_eta_gen", "pt_vs_eta_dau", {HistType::kTH2F, {ptAxis, etaAxis}}); rpiKkink.add("h2_moth_pt_vs_eta_gen", "pt_vs_eta_moth", {HistType::kTH2F, {ptAxis, etaAxis}}); @@ -426,6 +449,34 @@ struct spectraKinkPiKa { rpiKkink.add("h2_qt_gen", "qt", {HistType::kTH1F, {qtAxis}}); rpiKkink.add("h2_qt_rec", "qt", {HistType::kTH1F, {qtAxis}}); rpiKkink.add("h2_kink_angle_gen", "kink angle", {HistType::kTH1F, {kinkAxis}}); + + rpiKkink.add("h2_kaon_mc_gen", "h2_kaon_mc_gen", HistType::kTHnSparseF, {massAxis, ptAxis, etaAxis, qtAxis}, true); + rpiKkink.add("h2_kaon_mc_rec", "h2_kaon_mc_rec", HistType::kTHnSparseF, {massAxis, ptAxis, etaAxis, qtAxis, multAxis}, true); + + // qa + rpiKkink.add("h2_kinkradius_vs_vz_m", "kink radius_vz", {HistType::kTH2F, {vertexAxis, radiusAxis}}); + rpiKkink.add("h2_kink_vx_vs_vy_m", "kink vx vs vz ", {HistType::kTH2F, {vertexAxis, vertexAxis}}); + + rpiKkink.add("h2_dau_pt_vs_eta_rec_m", "pt_vs_eta_dau", {HistType::kTH3F, {ptAxis, etaAxis, multAxis}}); + rpiKkink.add("h2_moth_pt_vs_eta_rec_m", "pt_vs_eta_moth", {HistType::kTH3F, {ptAxis, etaAxis, multAxis}}); + rpiKkink.add("h2_pt_moth_vs_dau_rec_m", "pt_moth_vs_dau", {HistType::kTH2F, {ptAxis, ptAxis}}); + rpiKkink.add("h2_kink_angle_m", "kink angle", {HistType::kTH2F, {kinkAxis, multAxis}}); + rpiKkink.add("h2_invmass_kaon_m", "Inv mass vs Pt", {HistType::kTH3F, {massAxis, ptAxis, ptAxis}}); + rpiKkink.add("h2_kaon_mc_rec_m", "h2_kaon_mc_rec_m", HistType::kTHnSparseF, {massAxis, ptAxis, etaAxis, qtAxis, multAxis}, true); + + rpiKkink.add("tpc_dedx_m", "p vs dE/dx", {HistType::kTH2F, {{500, 0.0, 10.0}, {5000, 0.0, 5000.0}}}); + rpiKkink.add("tpc_nsigma_kaon_m", "p#k n#sigma", {HistType::kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}}); + rpiKkink.add("tpc_nsigma_pion_m", "p#pi n#sigma", {HistType::kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}}); + + rpiKkink.add("tr_dcaxyM_m", "dcaxym", {HistType::kTH1F, {{1000, -5.0, 5.0}}}); + rpiKkink.add("tr_dcaxyD_m", "dcaxyd", {HistType::kTH1F, {{1000, -5.0, 5.0}}}); + rpiKkink.add("tr_dcaxykink_topo_m", "tr_dcaxykink_topo", {HistType::kTH1F, {{1000, -5.0, 5.0}}}); + + rpiKkink.add("tr_chi2nclM_m", "chi2nclm", {HistType::kTH1F, {{100, 0.0, 100.0}}}); + rpiKkink.add("tr_chi2nclD_m", "chi2ncld", {HistType::kTH1F, {{100, 0.0, 100.0}}}); + rpiKkink.add("tr_tpcnclfindM_m", "tpcnclfindm", {HistType::kTH1F, {{300, 0.0, 300.0}}}); + rpiKkink.add("tr_tpcnclfindD_m", "tpcnclfindd", {HistType::kTH1F, {{300, 0.0, 300.0}}}); + rpiKkink.add("tr_itsChi2NClM_m", "itsChi2NClm", {HistType::kTH1F, {{200, 0.0, 200.0}}}); } } @@ -460,7 +511,25 @@ struct spectraKinkPiKa { if (!collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { return; } + + float multiplicity{-1}; + const int kCentFT0C = 0; + const int kCentFT0A = 1; + const int kCentFT0M = 2; + const int kCentFV0A = 3; + + if (centestimator == kCentFT0C) { + multiplicity = collision.centFT0C(); + } else if (centestimator == kCentFT0A) { + multiplicity = collision.centFT0A(); + } else if (centestimator == kCentFT0M) { + multiplicity = collision.centFT0M(); + } else if (centestimator == kCentFV0A) { + multiplicity = collision.centFV0A(); + } + rEventSelection.fill(HIST("hVertexZRec"), collision.posZ()); + rEventSelection.fill(HIST("hMultiplicity"), multiplicity); for (const auto& kinkCand : KinkCands) { auto dauTrack = kinkCand.trackDaug_as(); auto mothTrack = kinkCand.trackMoth_as(); @@ -473,14 +542,28 @@ struct spectraKinkPiKa { if (mothTrack.collisionId() != dauTrack.collisionId()) { continue; // skip mismatched collision tracks } + if (dauTrack.sign() != mothTrack.sign()) { + LOG(info) << "Skipping kink candidate with opposite sign daughter and mother: " << kinkCand.globalIndex(); + continue; // Skip if the daughter has the opposite sign as the mother + } bool kaon = false; bool pion = false; - /* - if (mothTrack.dcaXY() > dcaXYcut) - continue; - if (mothTrack.dcaZ() > dcaZcut) - continue; - */ + + v0.SetCoordinates(mothTrack.px(), mothTrack.py(), mothTrack.pz(), o2::constants::physics::MassKaonCharged); + v1.SetCoordinates(dauTrack.px(), dauTrack.py(), dauTrack.pz(), o2::constants::physics::MassMuon); + + if (dptCut && v1.Pt() > v0.Pt()) + continue; + rpiKkink.fill(HIST("tpc_dedx"), v0.P(), mothTrack.tpcSignal()); + rpiKkink.fill(HIST("tpc_nsigma_kaon"), v0.Pt(), mothTrack.tpcNSigmaKa()); + rpiKkink.fill(HIST("tpc_nsigma_pion"), v0.Pt(), mothTrack.tpcNSigmaPi()); + + rpiKkink.fill(HIST("tr_chi2nclM"), mothTrack.tpcChi2NCl()); + rpiKkink.fill(HIST("tr_chi2nclD"), dauTrack.tpcChi2NCl()); + rpiKkink.fill(HIST("tr_tpcnclfindM"), mothTrack.tpcNClsFindable()); + rpiKkink.fill(HIST("tr_tpcnclfindD"), dauTrack.tpcNClsFindable()); + rpiKkink.fill(HIST("tr_itsChi2NClM"), mothTrack.itsChi2NCl()); + if (mothTrack.tpcChi2NCl() > tpcChi2Cut) continue; if (std::abs(mothTrack.tpcNSigmaKa()) < cutNSigmaKa) { @@ -498,12 +581,14 @@ struct spectraKinkPiKa { double radiusxy = std::sqrt(kinkCand.xDecVtx() * kinkCand.xDecVtx() + kinkCand.yDecVtx() * kinkCand.yDecVtx()); if (radiusxy < minradius || radiusxy > maxradius) continue; + // dcaXYmoth kinkCand.decVtx[0], kinkCand.decVtx[1], kinkCand.decVtx[2], + rpiKkink.fill(HIST("tr_dcaxyM"), kinkCand.dcaMothPv()); + rpiKkink.fill(HIST("tr_dcaxyD"), kinkCand.dcaDaugPv()); + rpiKkink.fill(HIST("tr_dcaxykink_topo"), kinkCand.dcaKinkTopo()); + rpiKkink.fill(HIST("h2_kinkradius_vs_vz"), kinkCand.zDecVtx(), radiusxy); rpiKkink.fill(HIST("h2_kink_vx_vs_vy"), kinkCand.xDecVtx(), kinkCand.yDecVtx()); - v0.SetCoordinates(mothTrack.px(), mothTrack.py(), mothTrack.pz(), o2::constants::physics::MassPionCharged); - v1.SetCoordinates(dauTrack.px(), dauTrack.py(), dauTrack.pz(), o2::constants::physics::MassMuon); - float pMoth = v0.P(); float pDaug = v1.P(); float spKink = mothTrack.px() * dauTrack.px() + mothTrack.py() * dauTrack.py() + mothTrack.pz() * dauTrack.pz(); @@ -513,16 +598,16 @@ struct spectraKinkPiKa { continue; if (kaon) { - rpiKkink.fill(HIST("h2_moth_pt_vs_eta_rec"), v0.Pt(), v0.Eta()); - rpiKkink.fill(HIST("h2_dau_pt_vs_eta_rec"), v1.Pt(), v1.Eta()); + rpiKkink.fill(HIST("h2_moth_pt_vs_eta_rec"), v0.Pt(), v0.Eta(), multiplicity); + rpiKkink.fill(HIST("h2_dau_pt_vs_eta_rec"), v1.Pt(), v1.Eta(), multiplicity); rpiKkink.fill(HIST("h2_pt_moth_vs_dau_rec"), v0.Pt(), v1.Pt()); - rpiKkink.fill(HIST("h2_kink_angle"), kinkangle); + rpiKkink.fill(HIST("h2_kink_angle"), kinkangle, multiplicity); } if (pion) { - rpiKkink.fill(HIST("h2_moth_pt_vs_eta_rec_pion"), v0.Pt(), v0.Eta()); - rpiKkink.fill(HIST("h2_dau_pt_vs_eta_rec_pion"), v1.Pt(), v1.Eta()); + rpiKkink.fill(HIST("h2_moth_pt_vs_eta_rec_pion"), v0.Pt(), v0.Eta(), multiplicity); + rpiKkink.fill(HIST("h2_dau_pt_vs_eta_rec_pion"), v1.Pt(), v1.Eta(), multiplicity); rpiKkink.fill(HIST("h2_pt_moth_vs_dau_rec_pion"), v0.Pt(), v1.Pt()); - rpiKkink.fill(HIST("h2_kink_angle_pion"), kinkangle); + rpiKkink.fill(HIST("h2_kink_angle_pion"), kinkangle, multiplicity); } TVector3 pdlab(v1.Px(), v1.Py(), v1.Pz()); // Compute transverse component @@ -535,6 +620,7 @@ struct spectraKinkPiKa { rpiKkink.fill(HIST("h2_qt"), ptd); rpiKkink.fill(HIST("h2_qt_vs_pt"), ptd, v1.Pt()); rpiKkink.fill(HIST("h2_invmass_kaon"), mass, v0.Pt(), ptd); + rpiKkink.fill(HIST("h2_kaon_data"), mass, v0.Pt(), v0.Eta(), ptd, multiplicity); } if (pion) { v0.SetCoordinates(mothTrack.px(), mothTrack.py(), mothTrack.pz(), o2::constants::physics::MassPionCharged); @@ -542,6 +628,7 @@ struct spectraKinkPiKa { rpiKkink.fill(HIST("h2_qt_pion"), ptd); rpiKkink.fill(HIST("h2_qt_vs_ptpion"), ptd, v1.Pt()); rpiKkink.fill(HIST("h2_invmass_pion"), mass, v0.Pt(), ptd); + rpiKkink.fill(HIST("h2_pion_data"), mass, v0.Pt(), v0.Eta(), ptd, multiplicity); } } } @@ -559,7 +646,24 @@ struct spectraKinkPiKa { continue; } + float multiplicity{-1}; + const int kCentFT0C = 0; + const int kCentFT0A = 1; + const int kCentFT0M = 2; + const int kCentFV0A = 3; + + if (centestimator == kCentFT0C) { + multiplicity = collision.centFT0C(); + } else if (centestimator == kCentFT0A) { + multiplicity = collision.centFT0A(); + } else if (centestimator == kCentFT0M) { + multiplicity = collision.centFT0M(); + } else if (centestimator == kCentFV0A) { + multiplicity = collision.centFV0A(); + } rEventSelection.fill(HIST("hVertexZRec"), collision.posZ()); + rEventSelection.fill(HIST("hMultiplicity"), multiplicity); + auto kinkCandPerColl = KinkCands.sliceBy(mPerCol, collision.globalIndex()); for (const auto& kinkCand : kinkCandPerColl) { auto dauTrack = kinkCand.trackDaug_as(); @@ -568,23 +672,40 @@ struct spectraKinkPiKa { LOG(info) << "Skipping kink candidate with opposite sign daughter and mother: " << kinkCand.globalIndex(); continue; // Skip if the daughter has the opposite sign as the mother } + + v0.SetCoordinates(mothTrack.px(), mothTrack.py(), mothTrack.pz(), o2::constants::physics::MassKaonCharged); + v1.SetCoordinates(dauTrack.px(), dauTrack.py(), dauTrack.pz(), o2::constants::physics::MassMuon); + + rpiKkink.fill(HIST("tpc_dedx"), v0.P(), mothTrack.tpcSignal()); + rpiKkink.fill(HIST("tpc_nsigma_kaon"), v0.Pt(), mothTrack.tpcNSigmaKa()); + rpiKkink.fill(HIST("tpc_nsigma_pion"), v0.Pt(), mothTrack.tpcNSigmaPi()); + + rpiKkink.fill(HIST("tr_chi2nclM"), mothTrack.tpcChi2NCl()); + rpiKkink.fill(HIST("tr_chi2nclD"), dauTrack.tpcChi2NCl()); + rpiKkink.fill(HIST("tr_tpcnclfindM"), mothTrack.tpcNClsFindable()); + rpiKkink.fill(HIST("tr_tpcnclfindD"), dauTrack.tpcNClsFindable()); + rpiKkink.fill(HIST("tr_itsChi2NClM"), mothTrack.itsChi2NCl()); + bool kaon = false; - bool pion = false; if (std::abs(mothTrack.tpcNSigmaKa()) < cutNSigmaKa) { kaon = true; } - if (std::abs(mothTrack.tpcNSigmaPi()) < cutNSigmaPi) { - pion = true; - } - if (!kaon && !pion) + + if (dptCut && v1.Pt() > v0.Pt()) + continue; + + if (!kaon) continue; double radiusxy = std::sqrt(kinkCand.xDecVtx() * kinkCand.xDecVtx() + kinkCand.yDecVtx() * kinkCand.yDecVtx()); if (radiusxy < minradius || radiusxy > maxradius) continue; + + rpiKkink.fill(HIST("tr_dcaxyM"), kinkCand.dcaMothPv()); + rpiKkink.fill(HIST("tr_dcaxyD"), kinkCand.dcaDaugPv()); + rpiKkink.fill(HIST("tr_dcaxykink_topo"), kinkCand.dcaKinkTopo()); + rpiKkink.fill(HIST("h2_kinkradius_vs_vz"), kinkCand.zDecVtx(), radiusxy); rpiKkink.fill(HIST("h2_kink_vx_vs_vy"), kinkCand.xDecVtx(), kinkCand.yDecVtx()); - v0.SetCoordinates(mothTrack.px(), mothTrack.py(), mothTrack.pz(), o2::constants::physics::MassPionCharged); - v1.SetCoordinates(dauTrack.px(), dauTrack.py(), dauTrack.pz(), o2::constants::physics::MassMuon); float pMoth = v0.P(); float pDaug = v1.P(); @@ -594,10 +715,10 @@ struct spectraKinkPiKa { if (kinkangle * radToDeg < kinkanglecut) continue; - rpiKkink.fill(HIST("h2_moth_pt_vs_eta_rec"), v0.Pt(), v0.Eta()); - rpiKkink.fill(HIST("h2_dau_pt_vs_eta_rec"), v1.Pt(), v1.Eta()); + rpiKkink.fill(HIST("h2_moth_pt_vs_eta_rec"), v0.Pt(), v0.Eta(), multiplicity); + rpiKkink.fill(HIST("h2_dau_pt_vs_eta_rec"), v1.Pt(), v1.Eta(), multiplicity); rpiKkink.fill(HIST("h2_pt_moth_vs_dau_rec"), v0.Pt(), v1.Pt()); - rpiKkink.fill(HIST("h2_kink_angle"), kinkangle); + rpiKkink.fill(HIST("h2_kink_angle"), kinkangle, multiplicity); TVector3 pdlab(v1.Px(), v1.Py(), v1.Pz()); // Compute transverse component @@ -606,6 +727,10 @@ struct spectraKinkPiKa { rpiKkink.fill(HIST("h2_qt"), ptd); + double mass = computeMotherMass(v0, v1); + rpiKkink.fill(HIST("h2_invmass_kaon"), mass, v0.Pt(), ptd); + + rpiKkink.fill(HIST("h2_kaon_mc_rec"), mass, v0.Pt(), v0.Eta(), ptd, multiplicity); // do MC association auto mcLabMoth = trackLabelsMC.rawIteratorAt(mothTrack.globalIndex()); auto mcLabDau = trackLabelsMC.rawIteratorAt(dauTrack.globalIndex()); @@ -624,19 +749,44 @@ struct spectraKinkPiKa { if (std::abs(mcTrackMoth.pdgCode()) != pid || std::abs(mcTrackDau.pdgCode()) != dpid) { continue; } + rpiKkink.fill(HIST("h2_kinkradius_vs_vz_m"), kinkCand.zDecVtx(), radiusxy); + rpiKkink.fill(HIST("h2_kink_vx_vs_vy_m"), kinkCand.xDecVtx(), kinkCand.yDecVtx()); + + rpiKkink.fill(HIST("h2_moth_pt_vs_eta_rec_m"), v0.Pt(), v0.Eta(), multiplicity); + rpiKkink.fill(HIST("h2_dau_pt_vs_eta_rec_m"), v1.Pt(), v1.Eta(), multiplicity); + rpiKkink.fill(HIST("h2_pt_moth_vs_dau_rec_m"), v0.Pt(), v1.Pt()); + rpiKkink.fill(HIST("h2_kink_angle_m"), kinkangle, multiplicity); + rpiKkink.fill(HIST("h2_invmass_kaon_m"), mass, v0.Pt(), ptd); rpiKkink.fill(HIST("h2_qt_rec"), ptd); + rpiKkink.fill(HIST("h2_kaon_mc_rec_m"), mass, v0.Pt(), v0.Eta(), ptd, multiplicity); + + rpiKkink.fill(HIST("tpc_dedx_m"), v0.P(), mothTrack.tpcSignal()); + rpiKkink.fill(HIST("tpc_nsigma_kaon_m"), v0.Pt(), mothTrack.tpcNSigmaKa()); + rpiKkink.fill(HIST("tpc_nsigma_pion_m"), v0.Pt(), mothTrack.tpcNSigmaPi()); + + rpiKkink.fill(HIST("tr_chi2nclM_m"), mothTrack.tpcChi2NCl()); + rpiKkink.fill(HIST("tr_chi2nclD_m"), dauTrack.tpcChi2NCl()); + rpiKkink.fill(HIST("tr_tpcnclfindM_m"), mothTrack.tpcNClsFindable()); + rpiKkink.fill(HIST("tr_tpcnclfindD_m"), dauTrack.tpcNClsFindable()); + rpiKkink.fill(HIST("tr_itsChi2NClM_m"), mothTrack.itsChi2NCl()); + + rpiKkink.fill(HIST("tr_dcaxyM_m"), kinkCand.dcaMothPv()); + rpiKkink.fill(HIST("tr_dcaxyD_m"), kinkCand.dcaDaugPv()); + rpiKkink.fill(HIST("tr_dcaxykink_topo_m"), kinkCand.dcaKinkTopo()); } } } } + for (const auto& mcPart : particlesMC) { ROOT::Math::PxPyPzMVector v0; ROOT::Math::PxPyPzMVector v1; - if (!d0pid && (std::abs(mcPart.pdgCode()) != pid || std::abs(mcPart.eta()) > rapCut)) { + + if (!d0pid && (std::abs(mcPart.pdgCode()) != pid || std::abs(mcPart.eta()) > etaCut)) { continue; } bool isDmeson = std::abs(mcPart.pdgCode()) == kD0 || std::abs(mcPart.pdgCode()) == kDPlus || std::abs(mcPart.pdgCode()) == kDStar; - if (d0pid && (!isDmeson || std::abs(mcPart.eta()) > rapCut)) { + if (d0pid && (!isDmeson || std::abs(mcPart.eta()) > etaCut)) { continue; } if (!mcPart.has_daughters()) { @@ -679,6 +829,8 @@ struct spectraKinkPiKa { TVector3 motherDir(v0.Px(), v0.Py(), v0.Pz()); double ptd = pdlab.Perp(motherDir); // or p_d_lab.Mag() * sin(theta) rpiKkink.fill(HIST("h2_qt_gen"), ptd); + double mass = computeMotherMass(v0, v1); + rpiKkink.fill(HIST("h2_kaon_mc_gen"), mass, v0.Pt(), v0.Eta(), ptd); } } PROCESS_SWITCH(spectraKinkPiKa, processMC, "MC processing", false); From dc5990a280306968606a349c554f90bf342c5d29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Fri, 19 Sep 2025 07:43:10 +0200 Subject: [PATCH 451/986] [PWGLF] Replace TMath::Abs with std::abs in etaChargeConditionFunc, add include (#13036) --- PWGLF/Utils/inelGt.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PWGLF/Utils/inelGt.h b/PWGLF/Utils/inelGt.h index 70c3de8ab4f..04cd2351d1d 100644 --- a/PWGLF/Utils/inelGt.h +++ b/PWGLF/Utils/inelGt.h @@ -23,6 +23,7 @@ #include "TParticlePDG.h" +#include #include namespace o2 @@ -69,7 +70,7 @@ bool isINELgtNmc(TMcParticles particles, int nChToSatisfySelection, pdgDatabase ParticlesEtaAndCharge.resize(nParticles); auto etaChargeConditionFunc = [](EtaCharge elem) { - return ((TMath::Abs(elem.eta) < 1.0) && (TMath::Abs(elem.charge) > 0.001)); + return ((std::abs(elem.eta) < 1.0) && (std::abs(elem.charge) > 0.001)); }; if (std::count_if(ParticlesEtaAndCharge.begin(), ParticlesEtaAndCharge.end(), etaChargeConditionFunc) > nChToSatisfySelection) { From deb7708bfeb69df2d98d6fde2cbecd5edbbe8b57 Mon Sep 17 00:00:00 2001 From: JimunLee Date: Fri, 19 Sep 2025 15:04:44 +0900 Subject: [PATCH 452/986] [PWGLF] Fixed and added some options about QA in KstarInOO.cxx (#13022) Co-authored-by: jimun_lee --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 147 ++++++++++++++------------- 1 file changed, 79 insertions(+), 68 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index bfd8bc8ee0b..24ba298e3c9 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -15,8 +15,7 @@ #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/PIDResponseTOF.h" -#include "Common/DataModel/PIDResponseTPC.h" +#include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" #include "CommonConstants/PhysicsConstants.h" @@ -72,9 +71,10 @@ struct kstarInOO { // Track Selection // General Configurable cfgTrackMinPt{"cfgTrackMinPt", 0.15, "set track min pT"}; - Configurable cfgTrackMaxEta{"cfgTrackMaxEta", 0.9, "set track max Eta"}; + Configurable cfgTrackMaxEta{"cfgTrackMaxEta", 0.8, "set track max Eta"}; Configurable cfgTrackMaxDCArToPVcut{"cfgTrackMaxDCArToPVcut", 0.5, "Track DCAr cut to PV Maximum"}; Configurable cfgTrackMaxDCAzToPVcut{"cfgTrackMaxDCAzToPVcut", 2.0, "Track DCAz cut to PV Maximum"}; + Configurable cfgTrackGlobalSel{"cfgTrackGlobalSel", true, "Global track selection"}; Configurable cfgTrackPrimaryTrack{"cfgTrackPrimaryTrack", true, "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz Configurable cfgTrackConnectedToPV{"cfgTrackConnectedToPV", true, "PV contributor track selection"}; // PV Contriuibutor Configurable cfgTrackGlobalWoDCATrack{"cfgTrackGlobalWoDCATrack", true, "Global track selection without DCA"}; // kQualityTracks (kTrackType | kTPCNCls | kTPCCrossedRows | kTPCCrossedRowsOverNCls | kTPCChi2NDF | kTPCRefit | kITSNCls | kITSChi2NDF | kITSRefit | kITSHits) | kInAcceptanceTracks (kPtRange | kEtaRange) @@ -188,6 +188,12 @@ struct kstarInOO { histos.add("hMC_LSS_Mix", "hMC_LSS_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); histos.add("hMC_USS_True", "hMC_USS_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); histos.add("hMC_kstar_True", "hMC_kstar_True", kTHnSparseF, {cfgCentAxis, ptAxis}); + + histos.add("hMC_USS_pion", "hMC_USS_pion", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_LSS_pion", "hMC_LSS_pion", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_USS_Mix_pion", "hMC_USS_Mix_pion", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_LSS_Mix_pion", "hMC_LSS_Mix_pion", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_USS_pion_True", "hMC_USS_pion_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); } } // end of init @@ -244,9 +250,9 @@ struct kstarInOO { }; template - bool trackSelection(const TracksType track) + bool trackSelection(const TracksType track, const bool QA) { - if (cfgTrackCutQA) { + if (cfgTrackCutQA && QA) { histos.fill(HIST("hDCArToPv_BC"), track.dcaXY()); histos.fill(HIST("hDCAzToPv_BC"), track.dcaZ()); histos.fill(HIST("hIsPrim_BC"), track.isPrimaryTrack()); @@ -258,7 +264,7 @@ struct kstarInOO { histos.fill(HIST("hTPCChi2_BC"), track.tpcChi2NCl()); histos.fill(HIST("QA_track_pT_BC"), track.pt()); } - if (!track.isGlobalTrack()) + if (cfgTrackGlobalSel && !track.isGlobalTrack()) return false; if (track.pt() < cfgTrackMinPt) return false; @@ -285,7 +291,7 @@ struct kstarInOO { if (cfgTrackConnectedToPV && !track.isPVContributor()) return false; - if (cfgTrackCutQA) { + if (cfgTrackCutQA && QA) { histos.fill(HIST("hDCArToPv_AC"), track.dcaXY()); histos.fill(HIST("hDCAzToPv_AC"), track.dcaZ()); histos.fill(HIST("hIsPrim_AC"), track.isPrimaryTrack()); @@ -301,15 +307,16 @@ struct kstarInOO { }; template - bool trackPIDKaon(const TrackPID& candidate) + bool trackPIDKaon(const TrackPID& candidate, const bool QA) { - bool tpcPIDPassed{false}, tofPIDPassed{false}; - // TPC - if (cfgTrackCutQA) { + if (cfgTrackCutQA && QA) { histos.fill(HIST("QA_nSigma_kaon_TPC_BC"), candidate.pt(), candidate.tpcNSigmaKa()); histos.fill(HIST("QA_nSigma_kaon_TOF_BC"), candidate.pt(), candidate.tofNSigmaKa()); histos.fill(HIST("QA_kaon_TPC_TOF_BC"), candidate.tpcNSigmaKa(), candidate.tofNSigmaKa()); } + + bool tpcPIDPassed{false}, tofPIDPassed{false}; + // TPC if (std::abs(candidate.tpcNSigmaKa()) < cfgTrackTPCPIDnSig) tpcPIDPassed = true; // TOF @@ -322,7 +329,7 @@ struct kstarInOO { } // TPC & TOF if (tpcPIDPassed && tofPIDPassed) { - if (cfgTrackCutQA) { + if (cfgTrackCutQA && QA) { histos.fill(HIST("QA_nSigma_kaon_TPC_AC"), candidate.pt(), candidate.tpcNSigmaKa()); histos.fill(HIST("QA_nSigma_kaon_TOF_AC"), candidate.pt(), candidate.tofNSigmaKa()); histos.fill(HIST("QA_kaon_TPC_TOF_AC"), candidate.tpcNSigmaKa(), candidate.tofNSigmaKa()); @@ -333,15 +340,15 @@ struct kstarInOO { } template - bool trackPIDPion(const TrackPID& candidate) + bool trackPIDPion(const TrackPID& candidate, const bool QA) { - bool tpcPIDPassed{false}, tofPIDPassed{false}; - // TPC - if (cfgTrackCutQA) { + if (cfgTrackCutQA && QA) { histos.fill(HIST("QA_nSigma_pion_TPC_BC"), candidate.pt(), candidate.tpcNSigmaPi()); histos.fill(HIST("QA_nSigma_pion_TOF_BC"), candidate.pt(), candidate.tofNSigmaPi()); histos.fill(HIST("QA_pion_TPC_TOF_BC"), candidate.tpcNSigmaPi(), candidate.tofNSigmaPi()); } + bool tpcPIDPassed{false}, tofPIDPassed{false}; + // TPC if (std::abs(candidate.tpcNSigmaPi()) < cfgTrackTPCPIDnSig) tpcPIDPassed = true; if (candidate.hasTOF()) { @@ -353,7 +360,7 @@ struct kstarInOO { } // TPC & TOF if (tpcPIDPassed && tofPIDPassed) { - if (cfgTrackCutQA) { + if (cfgTrackCutQA && QA) { histos.fill(HIST("QA_nSigma_pion_TPC_AC"), candidate.pt(), candidate.tpcNSigmaPi()); histos.fill(HIST("QA_nSigma_pion_TOF_AC"), candidate.pt(), candidate.tofNSigmaPi()); histos.fill(HIST("QA_pion_TPC_TOF_AC"), candidate.tpcNSigmaPi(), candidate.tofNSigmaPi()); @@ -364,30 +371,33 @@ struct kstarInOO { } template - void TrackSlicing(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool IsMix) + void TrackSlicing(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool IsMix, const bool QA) { auto tracks1 = kaon->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); auto tracks2 = pion->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); auto centrality = collision1.centFT0C(); for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - auto [KstarPt, Minv] = minvReconstruction(trk1, trk2); - if (Minv < 0) + if (std::fabs(trk1.signed1Pt()) <= 0.f || std::fabs(trk2.signed1Pt()) <= 0.f) continue; + auto [KstarPt, Minv] = minvReconstruction(trk1, trk2, QA); + double conjugate = trk1.sign() * trk2.sign(); if (cfgDataHistos) { - if (!IsMix) { - if (conjugate < 0) { - histos.fill(HIST("hUSS"), centrality, KstarPt, Minv); - } else if (conjugate > 0) { - histos.fill(HIST("hLSS"), centrality, KstarPt, Minv); - } - } else { - if (conjugate < 0) { - histos.fill(HIST("hUSS_Mix"), centrality, KstarPt, Minv); - } else if (conjugate > 0) { - histos.fill(HIST("hLSS_Mix"), centrality, KstarPt, Minv); + if (Minv > 0) { + if (!IsMix) { + if (conjugate < 0) { + histos.fill(HIST("hUSS"), centrality, KstarPt, Minv); + } else if (conjugate > 0) { + histos.fill(HIST("hLSS"), centrality, KstarPt, Minv); + } + } else { + if (conjugate < 0) { + histos.fill(HIST("hUSS_Mix"), centrality, KstarPt, Minv); + } else if (conjugate > 0) { + histos.fill(HIST("hLSS_Mix"), centrality, KstarPt, Minv); + } } } } // cfgDataHistos @@ -395,39 +405,39 @@ struct kstarInOO { } // TrackSlicing template - void TrackSlicingMC(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool IsMix) + void TrackSlicingMC(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool IsMix, const bool QA) { auto tracks1 = kaonMC->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); auto tracks2 = pionMC->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); auto centrality = collision1.centFT0C(); for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - auto [KstarPt, Minv] = minvReconstruction(trk1, trk2); - if (Minv < 0) + if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) + continue; + if (std::fabs(trk1.signed1Pt()) <= 0.f || std::fabs(trk2.signed1Pt()) <= 0.f) continue; + auto [KstarPt_Kpi, Minv_Kpi] = minvReconstruction(trk1, trk2, QA); double conjugate = trk1.sign() * trk2.sign(); if (cfgMcHistos) { - if (!IsMix) { - if (conjugate < 0) { - histos.fill(HIST("hMC_USS"), centrality, KstarPt, Minv); - } else if (conjugate > 0) { - histos.fill(HIST("hMC_LSS"), centrality, KstarPt, Minv); - } - } else { - if (conjugate < 0) { - histos.fill(HIST("hMC_USS_Mix"), centrality, KstarPt, Minv); - } else if (conjugate > 0) { - histos.fill(HIST("hMC_LSS_Mix"), centrality, KstarPt, Minv); + if (Minv_Kpi > 0) { + if (!IsMix) { + if (conjugate < 0) { + histos.fill(HIST("hMC_USS"), centrality, KstarPt_Kpi, Minv_Kpi); + } else if (conjugate > 0) { + histos.fill(HIST("hMC_LSS"), centrality, KstarPt_Kpi, Minv_Kpi); + } + } else { + if (conjugate < 0) { + histos.fill(HIST("hMC_USS_Mix"), centrality, KstarPt_Kpi, Minv_Kpi); + } else if (conjugate > 0) { + histos.fill(HIST("hMC_LSS_Mix"), centrality, KstarPt_Kpi, Minv_Kpi); + } } } - } // cfgMcHistos - + } //====================== // Gen MC - if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) - continue; - auto particle1 = trk1.mcParticle(); auto particle2 = trk2.mcParticle(); if (std::fabs(particle1.pdgCode()) != 321) @@ -435,11 +445,9 @@ struct kstarInOO { if (std::fabs(particle2.pdgCode()) != 211) continue; // Not Pion - if (!particle1.has_mothers()) { + if (!particle1.has_mothers() || !particle2.has_mothers()) { continue; } - if (!particle2.has_mothers()) - continue; std::vector mothers1{}; std::vector mothers1PDG{}; @@ -464,24 +472,24 @@ struct kstarInOO { continue; // Kaon and pion not from the same K*0 if (cfgMcHistos) { - histos.fill(HIST("hMC_USS_True"), centrality, KstarPt, Minv); + histos.fill(HIST("hMC_USS_True"), centrality, KstarPt_Kpi, Minv_Kpi); } //====================== } // for } // TrackSlicingMC template - std::pair minvReconstruction(const TracksType& trk1, const TracksType& trk2) + std::pair minvReconstruction(const TracksType& trk1, const TracksType& trk2, const bool QA) { - TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; - - if (!trackSelection(trk1) || !trackSelection(trk2)) + if (!trackSelection(trk1, false) || !trackSelection(trk2, false)) return {-1.0, -1.0}; - if (!trackPIDKaon(trk1) || !trackPIDPion(trk2)) + if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA)) return {-1.0, -1.0}; - if (trk1.globalIndex() == trk2.globalIndex()) { - return {-1.0, -1.0}; // For Kstar, we need to run (0,1), (1,0) pairs as well. but same id pairs are not need. - } + if (trk1.globalIndex() == trk2.globalIndex()) + return {-1.0, -1.0}; + + TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; + lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa); lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massPi); lResonance = lDecayDaughter1 + lDecayDaughter2; @@ -515,7 +523,7 @@ struct kstarInOO { bool INELgt0 = false; for (const auto& track : tracks) { - if (!trackSelection(track)) + if (!trackSelection(track, true)) continue; if (std::fabs(track.eta()) < cfgTrackMaxEta) { INELgt0 = true; @@ -527,7 +535,7 @@ struct kstarInOO { if (cfgDataHistos) { histos.fill(HIST("nEvents"), 1.5); } - TrackSlicing(collision, tracks, collision, tracks, false); + TrackSlicing(collision, tracks, collision, tracks, false, true); } // processSameEvents PROCESS_SWITCH(kstarInOO, processDataSameEvent, "process Data Same Event", false); @@ -556,7 +564,7 @@ struct kstarInOO { if (!goodEv1 || !goodEv2) continue; - TrackSlicing(collision1, tracks1, collision2, tracks2, false); + TrackSlicing(collision1, tracks1, collision2, tracks2, true, false); } } PROCESS_SWITCH(kstarInOO, processDataMixedEvent, "process DATA Mixed Event", false); @@ -586,6 +594,8 @@ struct kstarInOO { bool INELgt0 = false; for (const auto& track : tracks) { + if (!trackSelection(track, true)) + continue; if (std::fabs(track.eta()) < cfgTrackMaxEta) { INELgt0 = true; } @@ -596,7 +606,7 @@ struct kstarInOO { if (cfgMcHistos) { histos.fill(HIST("nEvents_MC"), 1.5); } - TrackSlicingMC(collision, tracks, collision, tracks, false); + TrackSlicingMC(collision, tracks, collision, tracks, false, true); } // processSameEvents_MC PROCESS_SWITCH(kstarInOO, processSameEventMC, "process Same Event MC", true); @@ -620,10 +630,11 @@ struct kstarInOO { } auto goodEv1 = eventSelection(collision1); auto goodEv2 = eventSelection(collision2); - if (!goodEv1 || !goodEv2) + if (!goodEv1 || !goodEv2) { continue; + } - TrackSlicingMC(collision1, tracks1, collision2, tracks2, true); + TrackSlicingMC(collision1, tracks1, collision2, tracks2, true, false); } // mixing } // processMixedEvent_MC PROCESS_SWITCH(kstarInOO, processMixedEventMC, "process Mixed Event MC", false); From eb337308858e51289bfb9137565fabf6b2943cb1 Mon Sep 17 00:00:00 2001 From: Oleksii Lubynets Date: Fri, 19 Sep 2025 10:46:17 +0200 Subject: [PATCH 453/986] [PWGHF] Add proper lifetime into THnSparse at taskLc (#12902) --- PWGHF/D2H/Tasks/taskLc.cxx | 170 +++++++++++++++++++++++-------------- 1 file changed, 108 insertions(+), 62 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskLc.cxx b/PWGHF/D2H/Tasks/taskLc.cxx index 85eee1bb213..f1fdc7ef961 100644 --- a/PWGHF/D2H/Tasks/taskLc.cxx +++ b/PWGHF/D2H/Tasks/taskLc.cxx @@ -65,6 +65,17 @@ struct HfTaskLc { Configurable fillTHn{"fillTHn", false, "fill THn"}; Configurable storeOccupancy{"storeOccupancy", true, "Flag to store occupancy information"}; Configurable occEstimator{"occEstimator", 2, "Occupancy estimation (None: 0, ITS: 1, FT0C: 2)"}; + Configurable storeProperLifetime{"storeProperLifetime", false, "Flag to store proper lifetime"}; + + constexpr static float CtToProperLifetimePs = 1.f / o2::constants::physics::LightSpeedCm2PS; + constexpr static float NanoToPico = 1000.f; + + enum MlClasses : int { + MlClassBackground = 0, + MlClassPrompt, + MlClassNonPrompt, + NumberOfMlClasses + }; HfHelper hfHelper; SliceCache cache; @@ -100,6 +111,7 @@ struct HfTaskLc { ConfigurableAxis thnConfigAxisGenPtB{"thnConfigAxisGenPtB", {1000, 0, 100}, "Gen Pt B"}; ConfigurableAxis thnConfigAxisNumPvContr{"thnConfigAxisNumPvContr", {200, -0.5, 199.5}, "Number of PV contributors"}; ConfigurableAxis thnConfigAxisOccupancy{"thnConfigAxisOccupancy", {14, 0, 14000}, "axis for centrality"}; + ConfigurableAxis thnConfigAxisProperLifetime{"thnConfigAxisProperLifetime", {200, 0, 2}, "Proper lifetime, ps"}; HistogramRegistry registry{ "registry", @@ -317,6 +329,7 @@ struct HfTaskLc { const AxisSpec thnAxisPtB{thnConfigAxisGenPtB, "#it{p}_{T}^{B} (GeV/#it{c})"}; const AxisSpec thnAxisTracklets{thnConfigAxisNumPvContr, "Number of PV contributors"}; const AxisSpec thnAxisOccupancy{thnConfigAxisOccupancy, "Occupancy"}; + const AxisSpec thnAxisProperLifetime{thnConfigAxisProperLifetime, "T_{proper} (ps)"}; bool isDataWithMl = doprocessDataWithMl || doprocessDataWithMlWithFT0C || doprocessDataWithMlWithFT0M; bool isMcWithMl = doprocessMcWithMl || doprocessMcWithMlWithFT0C || doprocessMcWithMlWithFT0M; @@ -342,12 +355,18 @@ struct HfTaskLc { } if (storeOccupancy) { - if (!axesWithBdt.empty()) - axesWithBdt.push_back(thnAxisOccupancy); - if (!axesStd.empty()) - axesStd.push_back(thnAxisOccupancy); - if (!axesGen.empty()) - axesGen.push_back(thnAxisOccupancy); + for (const auto& axes : std::array*, 3>{&axesWithBdt, &axesStd, &axesGen}) { + if (!axes->empty()) { + axes->push_back(thnAxisOccupancy); + } + } + } + if (storeProperLifetime) { + for (const auto& axes : std::array*, 3>{&axesWithBdt, &axesStd, &axesGen}) { + if (!axes->empty()) { + axes->push_back(thnAxisProperLifetime); + } + } } if (isDataWithMl) { @@ -542,55 +561,63 @@ struct HfTaskLc { } double massLc(-1); double outputBkg(-1), outputPrompt(-1), outputFD(-1); + const float properLifetime = hfHelper.ctLc(candidate) * CtToProperLifetimePs; if ((candidate.isSelLcToPKPi() >= selectionFlagLc) && pdgCodeProng0 == kProton) { massLc = hfHelper.invMassLcToPKPi(candidate); if constexpr (fillMl) { - if (candidate.mlProbLcToPKPi().size() == 3) { - outputBkg = candidate.mlProbLcToPKPi()[0]; /// bkg score - outputPrompt = candidate.mlProbLcToPKPi()[1]; /// prompt score - outputFD = candidate.mlProbLcToPKPi()[2]; /// non-prompt score + if (candidate.mlProbLcToPKPi().size() == NumberOfMlClasses) { + outputBkg = candidate.mlProbLcToPKPi()[MlClassBackground]; /// bkg score + outputPrompt = candidate.mlProbLcToPKPi()[MlClassPrompt]; /// prompt score + outputFD = candidate.mlProbLcToPKPi()[MlClassNonPrompt]; /// non-prompt score } /// Fill the ML outputScores and variables of candidate + std::vector valuesToFill{massLc, pt, cent, outputBkg, outputPrompt, outputFD, static_cast(numPvContributors), ptRecB, static_cast(originType)}; if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) { - registry.get(HIST("hnLcVarsWithBdt"))->Fill(massLc, pt, cent, outputBkg, outputPrompt, outputFD, numPvContributors, ptRecB, originType, occ); - } else { - registry.get(HIST("hnLcVarsWithBdt"))->Fill(massLc, pt, cent, outputBkg, outputPrompt, outputFD, numPvContributors, ptRecB, originType); + valuesToFill.push_back(occ); } - + if (storeProperLifetime) { + valuesToFill.push_back(properLifetime); + } + registry.get(HIST("hnLcVarsWithBdt"))->Fill(valuesToFill.data()); } else { - + std::vector valuesToFill{massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, static_cast(numPvContributors), ptRecB, static_cast(originType)}; if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) { - registry.get(HIST("hnLcVars"))->Fill(massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, numPvContributors, ptRecB, originType, occ); - - } else { - - registry.get(HIST("hnLcVars"))->Fill(massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, numPvContributors, ptRecB, originType); + valuesToFill.push_back(occ); + } + if (storeProperLifetime) { + valuesToFill.push_back(properLifetime); } + registry.get(HIST("hnLcVars"))->Fill(valuesToFill.data()); } } if ((candidate.isSelLcToPiKP() >= selectionFlagLc) && pdgCodeProng0 == kPiPlus) { massLc = hfHelper.invMassLcToPiKP(candidate); if constexpr (fillMl) { - if (candidate.mlProbLcToPiKP().size() == 3) { - outputBkg = candidate.mlProbLcToPiKP()[0]; /// bkg score - outputPrompt = candidate.mlProbLcToPiKP()[1]; /// prompt score - outputFD = candidate.mlProbLcToPiKP()[2]; /// non-prompt score + if (candidate.mlProbLcToPiKP().size() == NumberOfMlClasses) { + outputBkg = candidate.mlProbLcToPiKP()[MlClassBackground]; /// bkg score + outputPrompt = candidate.mlProbLcToPiKP()[MlClassPrompt]; /// prompt score + outputFD = candidate.mlProbLcToPiKP()[MlClassNonPrompt]; /// non-prompt score } /// Fill the ML outputScores and variables of candidate (todo: add multiplicity) + std::vector valuesToFill{massLc, pt, cent, outputBkg, outputPrompt, outputFD, static_cast(numPvContributors), ptRecB, static_cast(originType)}; if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) { - registry.get(HIST("hnLcVarsWithBdt"))->Fill(massLc, pt, cent, outputBkg, outputPrompt, outputFD, numPvContributors, ptRecB, originType, occ); - - } else { - registry.get(HIST("hnLcVarsWithBdt"))->Fill(massLc, pt, cent, outputBkg, outputPrompt, outputFD, numPvContributors, ptRecB, originType); + valuesToFill.push_back(occ); + } + if (storeProperLifetime) { + valuesToFill.push_back(properLifetime); } + registry.get(HIST("hnLcVarsWithBdt"))->Fill(valuesToFill.data()); } else { + std::vector valuesToFill{massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, static_cast(numPvContributors), ptRecB, static_cast(originType)}; if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) { - registry.get(HIST("hnLcVars"))->Fill(massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, numPvContributors, ptRecB, originType, occ); - } else { - registry.get(HIST("hnLcVars"))->Fill(massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, numPvContributors, ptRecB, originType); + valuesToFill.push_back(occ); } + if (storeProperLifetime) { + valuesToFill.push_back(properLifetime); + } + registry.get(HIST("hnLcVars"))->Fill(valuesToFill.data()); } } } @@ -624,6 +651,11 @@ struct HfTaskLc { occ = o2::hf_occupancy::getOccupancyGenColl(recoCollsPerMcColl, occEstimator); } + const auto mcDaughter0 = particle.template daughters_as>().begin(); + const float p2m = particle.p() / o2::constants::physics::MassLambdaCPlus; + const float gamma = std::sqrt(1 + p2m * p2m); // mother's particle Lorentz factor + const float properLifetime = mcDaughter0.vt() * NanoToPico / gamma; // from ns to ps * from lab time to proper time + registry.fill(HIST("MC/generated/signal/hPtGen"), ptGen); registry.fill(HIST("MC/generated/signal/hEtaGen"), particle.eta()); registry.fill(HIST("MC/generated/signal/hYGen"), yGen); @@ -634,12 +666,14 @@ struct HfTaskLc { if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { if (fillTHn) { + std::vector valuesToFill{ptGen, cent, yGen, static_cast(numPvContributors), ptGenB, static_cast(originType)}; if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) { - registry.get(HIST("hnLcVarsGen"))->Fill(ptGen, cent, yGen, numPvContributors, ptGenB, originType, occ); - - } else { - registry.get(HIST("hnLcVarsGen"))->Fill(ptGen, cent, yGen, numPvContributors, ptGenB, originType); + valuesToFill.push_back(occ); + } + if (storeProperLifetime) { + valuesToFill.push_back(properLifetime); } + registry.get(HIST("hnLcVarsGen"))->Fill(valuesToFill.data()); } registry.fill(HIST("MC/generated/prompt/hPtGenPrompt"), ptGen); registry.fill(HIST("MC/generated/prompt/hEtaGenPrompt"), particle.eta()); @@ -652,12 +686,14 @@ struct HfTaskLc { if (particle.originMcGen() == RecoDecay::OriginType::NonPrompt) { ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt(); if (fillTHn) { + std::vector valuesToFill{ptGen, cent, yGen, static_cast(numPvContributors), ptGenB, static_cast(originType)}; if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) { - registry.get(HIST("hnLcVarsGen"))->Fill(ptGen, cent, yGen, numPvContributors, ptGenB, originType, occ); - - } else { - registry.get(HIST("hnLcVarsGen"))->Fill(ptGen, cent, yGen, numPvContributors, ptGenB, originType); + valuesToFill.push_back(occ); } + if (storeProperLifetime) { + valuesToFill.push_back(properLifetime); + } + registry.get(HIST("hnLcVarsGen"))->Fill(valuesToFill.data()); } registry.fill(HIST("MC/generated/nonprompt/hPtGenNonPrompt"), ptGen); registry.fill(HIST("MC/generated/nonprompt/hEtaGenNonPrompt"), particle.eta()); @@ -748,53 +784,63 @@ struct HfTaskLc { } double massLc(-1); double outputBkg(-1), outputPrompt(-1), outputFD(-1); + const float properLifetime = hfHelper.ctLc(candidate) * CtToProperLifetimePs; if (candidate.isSelLcToPKPi() >= selectionFlagLc) { massLc = hfHelper.invMassLcToPKPi(candidate); if constexpr (fillMl) { - if (candidate.mlProbLcToPKPi().size() == 3) { - outputBkg = candidate.mlProbLcToPKPi()[0]; /// bkg score - outputPrompt = candidate.mlProbLcToPKPi()[1]; /// prompt score - outputFD = candidate.mlProbLcToPKPi()[2]; /// non-prompt score + if (candidate.mlProbLcToPKPi().size() == NumberOfMlClasses) { + outputBkg = candidate.mlProbLcToPKPi()[MlClassBackground]; /// bkg score + outputPrompt = candidate.mlProbLcToPKPi()[MlClassPrompt]; /// prompt score + outputFD = candidate.mlProbLcToPKPi()[MlClassNonPrompt]; /// non-prompt score } /// Fill the ML outputScores and variables of candidate + std::vector valuesToFill{massLc, pt, cent, outputBkg, outputPrompt, outputFD, static_cast(numPvContributors)}; if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) { - registry.get(HIST("hnLcVarsWithBdt"))->Fill(massLc, pt, cent, outputBkg, outputPrompt, outputFD, numPvContributors, occ); - - } else { - registry.get(HIST("hnLcVarsWithBdt"))->Fill(massLc, pt, cent, outputBkg, outputPrompt, outputFD, numPvContributors); + valuesToFill.push_back(occ); + } + if (storeProperLifetime) { + valuesToFill.push_back(properLifetime); } + registry.get(HIST("hnLcVarsWithBdt"))->Fill(valuesToFill.data()); } else { + std::vector valuesToFill{massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, static_cast(numPvContributors)}; if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) { - - registry.get(HIST("hnLcVars"))->Fill(massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, numPvContributors, occ); - } else { - - registry.get(HIST("hnLcVars"))->Fill(massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, numPvContributors); + valuesToFill.push_back(occ); + } + if (storeProperLifetime) { + valuesToFill.push_back(properLifetime); } + registry.get(HIST("hnLcVars"))->Fill(valuesToFill.data()); } } if (candidate.isSelLcToPiKP() >= selectionFlagLc) { massLc = hfHelper.invMassLcToPiKP(candidate); if constexpr (fillMl) { - if (candidate.mlProbLcToPiKP().size() == 3) { - outputBkg = candidate.mlProbLcToPiKP()[0]; /// bkg score - outputPrompt = candidate.mlProbLcToPiKP()[1]; /// prompt score - outputFD = candidate.mlProbLcToPiKP()[2]; /// non-prompt score + if (candidate.mlProbLcToPiKP().size() == NumberOfMlClasses) { + outputBkg = candidate.mlProbLcToPiKP()[MlClassBackground]; /// bkg score + outputPrompt = candidate.mlProbLcToPiKP()[MlClassPrompt]; /// prompt score + outputFD = candidate.mlProbLcToPiKP()[MlClassNonPrompt]; /// non-prompt score } /// Fill the ML outputScores and variables of candidate + std::vector valuesToFill{massLc, pt, cent, outputBkg, outputPrompt, outputFD, static_cast(numPvContributors)}; if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) { - registry.get(HIST("hnLcVarsWithBdt"))->Fill(massLc, pt, cent, outputBkg, outputPrompt, outputFD, numPvContributors, occ); - } else { - registry.get(HIST("hnLcVarsWithBdt"))->Fill(massLc, pt, cent, outputBkg, outputPrompt, outputFD, numPvContributors); + valuesToFill.push_back(occ); + } + if (storeProperLifetime) { + valuesToFill.push_back(properLifetime); } + registry.get(HIST("hnLcVarsWithBdt"))->Fill(valuesToFill.data()); } else { + std::vector valuesToFill{massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, static_cast(numPvContributors)}; if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) { - registry.get(HIST("hnLcVars"))->Fill(massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, numPvContributors, occ); - } else { - registry.get(HIST("hnLcVars"))->Fill(massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, numPvContributors); + valuesToFill.push_back(occ); + } + if (storeProperLifetime) { + valuesToFill.push_back(properLifetime); } + registry.get(HIST("hnLcVars"))->Fill(valuesToFill.data()); } } } From ef72c9b1665b9c820d1cf76fcbdf563cbd6c0d50 Mon Sep 17 00:00:00 2001 From: gitchrishub-oss Date: Fri, 19 Sep 2025 11:59:24 +0200 Subject: [PATCH 454/986] [PWGCF] Implementation of Phi and K0Short (#12738) Co-authored-by: Christopher Klumm Co-authored-by: ALICE Action Bot --- PWGCF/DataModel/FemtoDerived.h | 35 +- .../Core/femtoDreamObjectSelection.h | 27 +- .../FemtoDream/Core/femtoDreamResoSelection.h | 453 +++++++ .../Core/femtoDreamTrackSelection.h | 14 +- PWGCF/FemtoDream/Core/femtoDreamUtils.h | 10 +- .../Core/femtoDreamV0SelectionK0Short.h | 772 ++++++++++++ PWGCF/FemtoDream/TableProducer/CMakeLists.txt | 7 +- .../femtoDreamProducerTaskReso.cxx | 1114 +++++++++++++++++ 8 files changed, 2397 insertions(+), 35 deletions(-) create mode 100644 PWGCF/FemtoDream/Core/femtoDreamResoSelection.h create mode 100644 PWGCF/FemtoDream/Core/femtoDreamV0SelectionK0Short.h create mode 100644 PWGCF/FemtoDream/TableProducer/femtoDreamProducerTaskReso.cxx diff --git a/PWGCF/DataModel/FemtoDerived.h b/PWGCF/DataModel/FemtoDerived.h index 911f55ab294..80bdd64539f 100644 --- a/PWGCF/DataModel/FemtoDerived.h +++ b/PWGCF/DataModel/FemtoDerived.h @@ -8,22 +8,24 @@ // 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. - #ifndef PWGCF_DATAMODEL_FEMTODERIVED_H_ #define PWGCF_DATAMODEL_FEMTODERIVED_H_ -#include -#include "Framework/ASoA.h" -#include "MathUtils/Utils.h" -#include "Framework/DataTypes.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" + #include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "Framework/ASoA.h" #include "Framework/AnalysisDataModel.h" +#include "Framework/DataTypes.h" #include "Framework/Expressions.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/PIDResponse.h" +#include "MathUtils/Utils.h" + +#include namespace o2::aod { @@ -96,7 +98,7 @@ DECLARE_SOA_TABLE_STAGED(FDMCCollLabels, "FDMCCollLabel", mcfdcolllabel::FDMCCol /// FemtoDreamTrack namespace femtodreamparticle { -/// Distinuishes the different particle types +/// Distinguishes the different particle types enum ParticleType { kTrack, //! Track kV0, //! V0 @@ -104,9 +106,15 @@ enum ParticleType { kCascade, //! Cascade kCascadeV0, kCascadeV0Child, - kCascadeBachelor, //! Bachelor track of a cascade - kCharmHadron, //! Bachelor track of a cascade - kNParticleTypes //! Number of particle types + kCascadeBachelor, //! Bachelor track of a cascade + kCharmHadron, //! Bachelor track of a cascade + kReso, //! Resonances (phi) + kResoChild, // Child track of a Resonance + kResoPosdaughTPC_NegdaughTPC, // cases for Phi-daughters for TPC or TOF combinations + kResoPosdaughTPC_NegdaughTOF, + kResoPosdaughTOF_NegdaughTPC, + kResoPosdaughTOF_NegdaughTOF, + kNParticleTypes //! Number of particle types }; enum MomentumType { @@ -115,8 +123,9 @@ enum MomentumType { kPtpc //! momentum at the inner wall of the TPC (useful for PID plots) }; -static constexpr std::string_view ParticleTypeName[kNParticleTypes] = {"Tracks", "V0", "V0Child", "Cascade", "CascadeV0", "CascadeV0Child", "CascadeBachelor", "CharmHadron"}; //! Naming of the different particle types -static constexpr std::string_view TempFitVarName[kNParticleTypes] = {"/hDCAxy", "/hCPA", "/hDCAxy", "/hCPA", "/hCPA", "/hDCAxy", "/hDCAxy", "/hCPA"}; +static constexpr std::string_view ParticleTypeName[kNParticleTypes] = {"Track", "V0", "V0Child", "Cascade", "CascadeV0", "CascadeV0Child", "CascadeBachelor", "CharmHadron", "Reso", "ResoChild", "ResoPosdaughTPC_NegdaughTPC", "ResoPosdaughTPC_NegdaughTOF", "ResoPosdaughTOF_NegdaughTPC", "ResoPosdaughTOF_NegdaughTOF"}; //! Naming of the different particle types + +static constexpr std::string_view TempFitVarName[kNParticleTypes] = {"/hDCAxy", "/hCPA", "/hDCAxy", "/hCPA", "/hCPA", "/hDCAxy", "/hDCAxy", "/hCPA", "/hDCAxy", "/hDCAxy", "/hDCAxy", "/hDCAxy", "/hDCAxy", "/hDCAxy"}; using cutContainerType = uint32_t; //! Definition of the data type for the bit-wise container for the different selection criteria diff --git a/PWGCF/FemtoDream/Core/femtoDreamObjectSelection.h b/PWGCF/FemtoDream/Core/femtoDreamObjectSelection.h index d01ce564f66..ef77ff8a7df 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamObjectSelection.h +++ b/PWGCF/FemtoDream/Core/femtoDreamObjectSelection.h @@ -1,4 +1,4 @@ -// Copyright 2019-2025 CERN and copyright holders of ALICE O2. +// Copyright 2019-2022 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. // @@ -16,15 +16,16 @@ #ifndef PWGCF_FEMTODREAM_CORE_FEMTODREAMOBJECTSELECTION_H_ #define PWGCF_FEMTODREAM_CORE_FEMTODREAMOBJECTSELECTION_H_ +#include "PWGCF/DataModel/FemtoDerived.h" +#include "PWGCF/FemtoDream/Core/femtoDreamSelection.h" + +#include "Framework/HistogramRegistry.h" +#include "ReconstructionDataFormats/PID.h" + #include #include #include -#include "PWGCF/FemtoDream/Core/femtoDreamSelection.h" -#include "ReconstructionDataFormats/PID.h" -#include "Framework/HistogramRegistry.h" -#include "PWGCF/DataModel/FemtoDerived.h" - using namespace o2; using namespace o2::framework; @@ -69,7 +70,7 @@ class FemtoDreamObjectSelection { std::vector tmpSelVals = selVals; // necessary due to some features of the Configurable std::vector> tempVec; - for (const selValDataType selVal : tmpSelVals) { + for (const selValDataType& selVal : tmpSelVals) { tempVec.push_back(FemtoDreamSelection(selVal, selVar, selType)); } setSelection(tempVec); @@ -97,7 +98,7 @@ class FemtoDreamObjectSelection } /// Then, the sorted selections are added to the overall container of cuts - for (auto& sel : sels) { + for (const auto& sel : sels) { mSelections.push_back(sel); } } @@ -121,7 +122,7 @@ class FemtoDreamObjectSelection break; } - for (auto sel : mSelections) { + for (auto& sel : mSelections) { if (sel.getSelectionVariable() == selVar) { switch (sel.getSelectionType()) { case (femtoDreamSelection::SelectionType::kUpperLimit): @@ -164,7 +165,7 @@ class FemtoDreamObjectSelection std::vector> getSelections(selVariable selVar) { std::vector> selValVec; - for (auto it : mSelections) { + for (auto& it : mSelections) { if (it.getSelectionVariable() == selVar) { selValVec.push_back(it); } @@ -177,9 +178,11 @@ class FemtoDreamObjectSelection std::vector getSelectionVariables() { std::vector selVarVec; - for (auto it : mSelections) { + for (auto& it : mSelections) { auto selVar = it.getSelectionVariable(); - if (std::none_of(selVarVec.begin(), selVarVec.end(), [selVar](selVariable a) { return a == selVar; })) { + if (std::none_of(selVarVec.begin(), + selVarVec.end(), + [selVar](selVariable a) { return a == selVar; })) { selVarVec.push_back(selVar); } } diff --git a/PWGCF/FemtoDream/Core/femtoDreamResoSelection.h b/PWGCF/FemtoDream/Core/femtoDreamResoSelection.h new file mode 100644 index 00000000000..7ec3bbb9505 --- /dev/null +++ b/PWGCF/FemtoDream/Core/femtoDreamResoSelection.h @@ -0,0 +1,453 @@ +// Copyright 2019-2025 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 femtoDreamResoSelection.h +/// \brief Definition of the FemtoDreamResoSelection +/// \author Christopher Klumm, TU München, christopher.klumm@cern.ch +/// \author Nils Fabian Konert, TU München, nils.fabian.konert@cern.ch + +#ifndef PWGCF_FEMTODREAM_CORE_FEMTODREAMRESOSELECTION_H_ +#define PWGCF_FEMTODREAM_CORE_FEMTODREAMRESOSELECTION_H_ + +#include "PWGCF/DataModel/FemtoDerived.h" +#include "PWGCF/FemtoDream/Core/femtoDreamObjectSelection.h" +#include "PWGCF/FemtoDream/Core/femtoDreamSelection.h" +#include "PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h" + +#include "Common/Core/RecoDecay.h" + +#include "Framework/HistogramRegistry.h" +#include "ReconstructionDataFormats/PID.h" + +#include "Math/Vector4D.h" +#include "TMath.h" + +#include +#include +#include +#include +#include + +namespace o2::analysis::femtoDream // o2-linter: disable=name/namespace (Previously defined namespace) +{ +namespace femto_dream_reso_selection +{ + +enum ResoSel { + kResoSign +}; +/// If you add a new selection, adjust kNresoSelection + +enum Daughtertype { + kPosdaugh, + kNegdaugh +}; + +enum ResoMothers { + kPhi, + kKStar +}; +} // namespace femto_dream_reso_selection + +class FemtoDreamResoSelection + : public FemtoDreamObjectSelection +{ + + public: + FemtoDreamResoSelection() /// initialization currently kind of random change this!!! + : mDaughPTPCThr{99.f, 99.f}, mPIDoffsetTPC(0.f), mPIDoffsetTOF(0.f), mSigmaPIDMax(99.f) + { + } + + virtual ~FemtoDreamResoSelection() = default; + + template + uint32_t getType(V const& track1, V const& track2); + + /// assigns value from configurbale to private class member + template + void assign(V& selVals) + { + mDaughPTPCThr = selVals; + }; + + template + size_t numBitsUsed(V const& origvalue); + + template + void init(HistogramRegistry* QAregistry, HistogramRegistry* Registry); + + template + void fillQA(T const& track1, T const& track2); + + template + void setDaughterCuts(femto_dream_reso_selection::Daughtertype child, T selVal, + V selVar, femtoDreamSelection::SelectionType selType); + + template + void setDaughterPIDSpecies(T const& daugh, V& pids); + + template + bool daughterSelectionPos(V const& track1); + + template + bool daughterSelectionNeg(V const& track2); + + template + bool isSelectedMinimalPIDPos(V const& track1, T const& pids); + + template + bool isSelectedMinimalPIDNeg(V const& track2, T const& pids); + + template + std::array getCutContainer(V const& track1, V const& track2, float sign); + + template + std::pair checkCombination(T const& PosTrack, T const& NegTrack, femto_dream_reso_selection::ResoMothers mother); + + std::pair getPIDPairFromMother(femto_dream_reso_selection::ResoMothers mother); + + template + bool checkPID(T const& Track, float nSigTPC, float nSigTOF, float nSig2TPC, float nSig2TOF, float PTPCThrvalue); + + void updateThreshold() + { + mSigmaPIDMax = posDaughTrack.getMinimalSelection(o2::analysis::femtoDream::femtoDreamTrackSelection::kPIDnSigmaMax, femtoDreamSelection::kAbsUpperLimit); // the same for pos and neg + }; + + void setDaughternSigmaPIDOffset(femto_dream_reso_selection::Daughtertype daugh, float offsetTPC, float offsetTOF) + { + if (daugh == femto_dream_reso_selection::kPosdaugh) { + posDaughTrack.setnSigmaPIDOffset(offsetTPC, offsetTOF); + } else if (daugh == femto_dream_reso_selection::kNegdaugh) { + negDaughTrack.setnSigmaPIDOffset(offsetTPC, offsetTOF); + } + mPIDoffsetTPC = offsetTPC; + mPIDoffsetTOF = offsetTOF; + }; + + float getMass(o2::track::PID::ID pid) + { + switch (pid) { + case (o2::track::PID::Kaon): + return o2::constants::physics::MassKPlus; + case (o2::track::PID::Pion): + return o2::constants::physics::MassPiPlus; + default: + LOG(warn) << "PID not implemented in femto_dream_reso_selection.getMass"; + return 0.; + } + } + + std::pair getMassDaughters(femto_dream_reso_selection::ResoMothers mother); + + /// The following functions might not be needed, as right now there is only one ResoSel (sign). + /// However all the other selections are implemented this way (also in the CutCulator). + /// So for now this is implemented analogous (migth also be beneficial if further ResoSels want to be implemented). + + /// Helper function to obtain the name of a given selection criterion for consistent naming of the configurables + /// \param iSel Reso selection variable to be examined + /// \param prefix Additional prefix for the name of the configurable + /// \param suffix Additional suffix for the name of the configurable + static std::string getSelectionName(femto_dream_reso_selection::ResoSel iSel, + std::string_view prefix = "", + std::string_view suffix = "") + { + std::string outString = static_cast(prefix); + outString += static_cast(kSelectionNames[iSel]); + outString += suffix; + return outString; + } + + /// Helper function to obtain the index of a given selection variable for consistent naming of the configurables + /// \param obs Reso selection variable (together with prefix) got from file + /// \param prefix Additional prefix for the output of the configurable + static int findSelectionIndex(std::string_view obs, + std::string_view prefix = "") + { + for (int index = 0; index < kNresoSelection; index++) { + std::string comp = static_cast(prefix) + + static_cast(kSelectionNames[index]); + std::string_view cmp{comp}; + if (obs.compare(cmp) == 0) + return index; + } + LOGF(info, "Variable %s not found", obs); + return -1; + } + + /// Helper function to obtain the type of a given selection variable for consistent naming of the configurables + /// \param iSel Reso selection variable whose type is returned + static femtoDreamSelection::SelectionType // o2-linter: disable=name/function-variable (defined with UpperCamelCase in femtoDreamSelection) + getSelectionType(femto_dream_reso_selection::ResoSel iSel) + { + return kSelectionTypes[iSel]; + } + + /// for consistent description of the configurables + /// \param iSel Track selection variable to be examined + /// \param prefix Additional prefix for the output of the configurable + static std::string getSelectionHelper(femto_dream_reso_selection::ResoSel iSel, + std::string_view prefix = "") + { + std::string outString = static_cast(prefix); + outString += static_cast(kSelectionHelper[iSel]); + return outString; + } + + private: + std::vector mDaughPTPCThr; + float mPIDoffsetTPC; + float mPIDoffsetTOF; + float mSigmaPIDMax; + + FemtoDreamTrackSelection posDaughTrack; + FemtoDreamTrackSelection negDaughTrack; + + static constexpr int kNresoSelection = 1; + + static constexpr std::string_view kSelectionNames[kNresoSelection] = {"Sign"}; + + static constexpr femtoDreamSelection::SelectionType kSelectionTypes[kNresoSelection]{ + femtoDreamSelection::kEqual}; + + static constexpr std::string_view kSelectionHelper[kNresoSelection] = { + "+1 for Reso, -1 for AntiReso"}; + +}; // namespace femtoDream + +template +uint32_t FemtoDreamResoSelection::getType(V const& track1, V const& track2) +{ + if (track1.pt() <= mDaughPTPCThr[0] && track2.pt() <= mDaughPTPCThr[1]) { + return aod::femtodreamparticle::kResoPosdaughTPC_NegdaughTPC; + } + if (track1.pt() <= mDaughPTPCThr[0] && track2.pt() > mDaughPTPCThr[1]) { + return aod::femtodreamparticle::kResoPosdaughTPC_NegdaughTOF; + } + if (track1.pt() > mDaughPTPCThr[0] && track2.pt() <= mDaughPTPCThr[1]) { + return aod::femtodreamparticle::kResoPosdaughTOF_NegdaughTPC; + } + if (track1.pt() > mDaughPTPCThr[0] && track2.pt() > mDaughPTPCThr[1]) { + return aod::femtodreamparticle::kResoPosdaughTOF_NegdaughTOF; + } + return 255; // as error filler +} + +template +size_t FemtoDreamResoSelection::numBitsUsed(V const& origvalue) +{ + size_t bits = 0; + auto value = origvalue; + while (value != 0) { + ++bits; + value >>= 1; + } + return bits; +} + +template +void FemtoDreamResoSelection::init(HistogramRegistry* QAregistry, HistogramRegistry* Registry) +{ + if (QAregistry && Registry) { + this->mHistogramRegistry = Registry; + this->mQAHistogramRegistry = QAregistry; + + posDaughTrack.init( + mQAHistogramRegistry, mHistogramRegistry); + + negDaughTrack.init( + mQAHistogramRegistry, mHistogramRegistry); + } +} + +template +void FemtoDreamResoSelection::fillQA(T const& track1, T const& track2) +{ + posDaughTrack.fillQA(track1); + negDaughTrack.fillQA(track2); +} + +template +void FemtoDreamResoSelection::setDaughterCuts(femto_dream_reso_selection::Daughtertype daugh, T selVal, + V selVar, femtoDreamSelection::SelectionType selType) +{ + if (daugh == femto_dream_reso_selection::kPosdaugh) { + posDaughTrack.setSelection(selVal, selVar, selType); + } + if (daugh == femto_dream_reso_selection::kNegdaugh) { + negDaughTrack.setSelection(selVal, selVar, selType); + } +} + +template +void FemtoDreamResoSelection::setDaughterPIDSpecies(T const& daugh, V& pids) +{ + if (daugh == femto_dream_reso_selection::kPosdaugh) { + posDaughTrack.setPIDSpecies(pids); + } + if (daugh == femto_dream_reso_selection::kNegdaugh) { + negDaughTrack.setPIDSpecies(pids); + } +} + +template +bool FemtoDreamResoSelection::daughterSelectionPos(V const& track1) +{ + return posDaughTrack.isSelectedMinimal(track1); +} + +template +bool FemtoDreamResoSelection::daughterSelectionNeg(V const& track2) +{ + return negDaughTrack.isSelectedMinimal(track2); +} + +template +bool FemtoDreamResoSelection::isSelectedMinimalPIDPos(V const& track1, T const& pid) +{ + float pidTPC = posDaughTrack.getNsigmaTPC(track1, pid); // pids[0] for pos track + float pidTOF = posDaughTrack.getNsigmaTOF(track1, pid); + + bool pass = false; + if (track1.pt() < mDaughPTPCThr[0]) { + pass = std::fabs(pidTPC) < mSigmaPIDMax; + } else { + pass = std::sqrt(pidTPC * pidTPC + pidTOF * pidTOF) < mSigmaPIDMax; + } + + return pass; +} + +template +bool FemtoDreamResoSelection::isSelectedMinimalPIDNeg(V const& track2, T const& pid) +{ + float pidTPC = negDaughTrack.getNsigmaTPC(track2, pid); // pids[1] for neg track + float pidTOF = negDaughTrack.getNsigmaTOF(track2, pid); + + bool pass = false; + if (track2.pt() < mDaughPTPCThr[1]) { + pass = std::fabs(pidTPC) < mSigmaPIDMax; + } else { + pass = std::sqrt(pidTPC * pidTPC + pidTOF * pidTOF) < mSigmaPIDMax; + } + + return pass; +} + +template +std::pair FemtoDreamResoSelection::checkCombination(T const& PosTrack, T const& NegTrack, femto_dream_reso_selection::ResoMothers mother) +{ + /// first bool: normal or anti + /// second bool: is not a valid combination + + auto [part1, part2] = getPIDPairFromMother(mother); + + float nSigPosTPC1 = o2::aod::pidutils::tpcNSigma(part1, PosTrack) - mPIDoffsetTPC; + float nSigPosTOF1 = posDaughTrack.getNsigmaTOF(PosTrack, part1) - mPIDoffsetTOF; /// for TOF use function in TrackSelection, because it also checks hasTOF() + float nSigPosTPC2 = o2::aod::pidutils::tpcNSigma(part2, PosTrack) - mPIDoffsetTPC; + float nSigPosTOF2 = posDaughTrack.getNsigmaTOF(PosTrack, part2) - mPIDoffsetTOF; + float nSigNegTPC1 = o2::aod::pidutils::tpcNSigma(part1, NegTrack) - mPIDoffsetTPC; + float nSigNegTOF1 = negDaughTrack.getNsigmaTOF(NegTrack, part1) - mPIDoffsetTOF; + float nSigNegTPC2 = o2::aod::pidutils::tpcNSigma(part2, NegTrack) - mPIDoffsetTPC; + float nSigNegTOF2 = negDaughTrack.getNsigmaTOF(NegTrack, part2) - mPIDoffsetTOF; + + if (checkPID(PosTrack, nSigPosTPC1, nSigPosTOF1, nSigPosTPC2, nSigPosTOF2, mDaughPTPCThr[0]) && checkPID(NegTrack, nSigNegTPC2, nSigNegTOF2, nSigNegTPC1, nSigNegTOF1, mDaughPTPCThr[1])) { + return {true, false}; + } else if (checkPID(PosTrack, nSigPosTPC2, nSigPosTOF2, nSigPosTPC1, nSigPosTOF1, mDaughPTPCThr[0]) && checkPID(NegTrack, nSigNegTPC1, nSigNegTOF1, nSigNegTPC2, nSigNegTOF2, mDaughPTPCThr[1])) { + return {false, false}; + } else { + return {false, true}; + } +} + +template +bool FemtoDreamResoSelection::checkPID(T const& Track, float nSig1TPC, float nSig1TOF, float nSig2TPC, float nSig2TOF, float PTPCThrvalue) +{ + if (Track.pt() < PTPCThrvalue) { + return (std::abs(nSig1TPC) <= std::abs(nSig2TPC)); + } else { + return (std::sqrt(nSig1TPC * nSig1TPC + nSig1TOF * nSig1TOF) <= std::sqrt(nSig2TPC * nSig2TPC + nSig2TOF * nSig2TOF)); + } +} + +std::pair FemtoDreamResoSelection::getPIDPairFromMother(femto_dream_reso_selection::ResoMothers mother) +{ + /// return is structured this way: + /// The mother particle is assumed to be normal (not antiparticle). Then: + /// 1. return value is positive daughter + /// 2. return value is negative daughter + switch (mother) { + case (femto_dream_reso_selection::kPhi): + return {o2::track::PID::Kaon, o2::track::PID::Kaon}; + case (femto_dream_reso_selection::kKStar): + return {o2::track::PID::Kaon, o2::track::PID::Pion}; + default: + LOG(warn) << "MotherPID not implemented in femto_dream_reso_selection.getPIDPairFromMother"; + return {o2::track::PID::Kaon, o2::track::PID::Kaon}; + } +} + +std::pair FemtoDreamResoSelection::getMassDaughters(femto_dream_reso_selection::ResoMothers mother) +{ + switch (mother) { + case (femto_dream_reso_selection::kPhi): + return {o2::constants::physics::MassKPlus, o2::constants::physics::MassKPlus}; + case (femto_dream_reso_selection::kKStar): + return {o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}; + default: + LOG(warn) << "MotherPID not implemented in femto_dream_reso_selection.getMassDauhters"; + return {o2::constants::physics::MassKPlus, o2::constants::physics::MassKPlus}; + } +} + +//// new getCutContainer +template +std::array FemtoDreamResoSelection::getCutContainer(V const& track1, V const& track2, float sign) +{ + cutContainerType outputSign = 0; + cutContainerType outputPID = 0; + size_t counter = 0; + for (auto& sel : mSelections) { // o2-linter: disable=const-ref-in-for-loop (femtoDreamObjectSelection has no const getter) + const auto selVariable = sel.getSelectionVariable(); + if (selVariable == femto_dream_reso_selection::kResoSign) { + sel.checkSelectionSetBit(sign, outputSign, counter, nullptr); + } + } + + const auto dCA1 = std::sqrt(track1.dcaXY() * track1.dcaXY() + track1.dcaZ() * track1.dcaZ()); + const auto dCA2 = std::sqrt(track2.dcaXY() * track2.dcaXY() + track2.dcaZ() * track2.dcaZ()); + + auto outputPosTrack = posDaughTrack.getCutContainer(track1, track1.pt(), track1.eta(), dCA1); // false for useItsPid + auto outputNegTrack = negDaughTrack.getCutContainer(track2, track2.pt(), track2.eta(), dCA2); + + const auto shiftvalue = numBitsUsed(outputSign); + outputPID = (outputNegTrack.at(femtoDreamTrackSelection::TrackContainerPosition::kPID) << shiftvalue) | outputSign; + + std::array bitmask = {outputPID, + outputPosTrack.at(femtoDreamTrackSelection::TrackContainerPosition::kCuts), + outputPosTrack.at(femtoDreamTrackSelection::TrackContainerPosition::kPID), + outputNegTrack.at(femtoDreamTrackSelection::TrackContainerPosition::kCuts), + outputNegTrack.at(femtoDreamTrackSelection::TrackContainerPosition::kPID)}; + return bitmask; +} +} // namespace o2::analysis::femtoDream + +#endif // PWGCF_FEMTODREAM_CORE_FEMTODREAMRESOSELECTION_H_ diff --git a/PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h b/PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h index 13d1ba5280b..b0041a2e12d 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h +++ b/PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h @@ -1,4 +1,4 @@ -// Copyright 2019-2025 CERN and copyright holders of ALICE O2. +// Copyright 2019-2022 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. // @@ -30,7 +30,6 @@ #include "ReconstructionDataFormats/PID.h" #include -#include #include #include @@ -113,7 +112,7 @@ class FemtoDreamTrackSelection : public FemtoDreamObjectSelection tmpPids = pids; /// necessary due to some features of the configurable - for (o2::track::PID pid : tmpPids) { + for (const o2::track::PID pid : tmpPids) { mPIDspecies.push_back(pid); } } @@ -146,7 +145,7 @@ class FemtoDreamTrackSelection : public FemtoDreamObjectSelection + template bool isSelectedMinimal(T const& track); /// Obtain the bit-wise container for the selections @@ -438,7 +437,7 @@ bool FemtoDreamTrackSelection::isSelectedMinimal(T const& track) const auto dca = track.dcaXY(); // Accordingly to FemtoDream in AliPhysics as well as LF analysis, // only dcaXY should be checked; NOT std::sqrt(pow(dcaXY, 2.) + pow(dcaZ, 2.)) std::vector pidTPC, pidTOF; - for (auto it : mPIDspecies) { + for (const auto& it : mPIDspecies) { pidTPC.push_back(getNsigmaTPC(track, it)); pidTOF.push_back(getNsigmaTOF(track, it)); } @@ -495,6 +494,7 @@ bool FemtoDreamTrackSelection::isSelectedMinimal(T const& track) return isFulfilled; } } + return true; } @@ -518,7 +518,7 @@ std::array FemtoDreamTrackSelection::getCutContainer(T cons const auto dca = Dca; std::vector pidTPC, pidTOF, pidITS; - for (auto it : mPIDspecies) { + for (const auto& it : mPIDspecies) { pidTPC.push_back(getNsigmaTPC(track, it)); pidTOF.push_back(getNsigmaTOF(track, it)); if constexpr (useItsPid) { @@ -528,7 +528,7 @@ std::array FemtoDreamTrackSelection::getCutContainer(T cons float observable = 0.; for (auto& sel : mSelections) { - const auto selVariable = sel.getSelectionVariable(); + auto selVariable = sel.getSelectionVariable(); if (selVariable == femtoDreamTrackSelection::kPIDnSigmaMax) { /// PID needsgetNsigmaITSto be handled a bit differently since we may need more than one species for (size_t i = 0; i < mPIDspecies.size(); ++i) { diff --git a/PWGCF/FemtoDream/Core/femtoDreamUtils.h b/PWGCF/FemtoDream/Core/femtoDreamUtils.h index 3030a1b45ef..53cd9e6a36b 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamUtils.h +++ b/PWGCF/FemtoDream/Core/femtoDreamUtils.h @@ -73,6 +73,12 @@ inline float getMass(int pdgCode) case kOmegaMinus: mass = o2::constants::physics::MassOmegaMinus; break; + case o2::constants::physics::Pdg::kK0Star892: + mass = o2::constants::physics::MassK0Star892; + break; + case 310: /// K0Short is not implemented in o2::physics::constants::Pdg + mass = o2::constants::physics::MassK0Short; + break; default: LOG(fatal) << "PDG code is not supported"; } @@ -83,7 +89,7 @@ inline int checkDaughterType(o2::aod::femtodreamparticle::ParticleType partType, { int partOrigin = 0; if (partType == o2::aod::femtodreamparticle::ParticleType::kTrack) { - switch (abs(motherPDG)) { + switch (std::abs(motherPDG)) { case kLambda0: partOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kSecondaryDaughterLambda; break; @@ -95,7 +101,7 @@ inline int checkDaughterType(o2::aod::femtodreamparticle::ParticleType partType, } // switch } else if (partType == o2::aod::femtodreamparticle::ParticleType::kV0) { - switch (abs(motherPDG)) { + switch (std::abs(motherPDG)) { case kSigma0: partOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kSecondaryDaughterSigma0; break; diff --git a/PWGCF/FemtoDream/Core/femtoDreamV0SelectionK0Short.h b/PWGCF/FemtoDream/Core/femtoDreamV0SelectionK0Short.h new file mode 100644 index 00000000000..5fe33ac79df --- /dev/null +++ b/PWGCF/FemtoDream/Core/femtoDreamV0SelectionK0Short.h @@ -0,0 +1,772 @@ +// Copyright 2019-2025 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 femtoDreamV0SelectionK0Short.h +/// \brief Definition of the FemtoDreamV0Selection +/// \author Valentina Mantovani Sarti, TU München valentina.mantovani-sarti@tum.de +/// \author Andi Mathis, TU München, andreas.mathis@ph.tum.de +/// \author Luca Barioglio, TU München, luca.barioglio@cern.ch +/// \author Christopher Klumm, TU München, christopher.klumm@cern.ch +/// \author Nils Fabian Konert, TU München, nils.fabian.konert@cern.ch + +#ifndef PWGCF_FEMTODREAM_CORE_FEMTODREAMV0SELECTIONK0SHORT_H_ +#define PWGCF_FEMTODREAM_CORE_FEMTODREAMV0SELECTIONK0SHORT_H_ + +#include "PWGCF/FemtoDream/Core/femtoDreamObjectSelection.h" +#include "PWGCF/FemtoDream/Core/femtoDreamSelection.h" +#include "PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h" + +#include "Common/Core/RecoDecay.h" + +#include "Framework/HistogramRegistry.h" +#include "ReconstructionDataFormats/PID.h" + +#include +#include + +namespace o2::analysis::femtoDream +{ + +namespace femto_dream_v0_selection +{ +/// The different selections this task is capable of doing +enum V0Sel { + kV0Sign, ///< +1 particle, -1 antiparticle + kV0pTMin, + kV0pTMax, + kV0etaMax, + kV0DCADaughMax, + kV0CPAMin, + kV0TranRadMin, + kV0TranRadMax, + kV0DecVtxMax, +}; + +enum ChildTrackType { kPosTrack, + kNegTrack }; + +enum V0ContainerPosition { + kV0, + kPosCuts, + kPosPID, + kNegCuts, + kNegPID, +}; /// Position in the full VO cut container + +} // namespace femto_dream_v0_selection + +/// \class FemtoDreamV0Selection +/// \brief Cut class to contain and execute all cuts applied to V0s +class FemtoDreamV0Selection + : public FemtoDreamObjectSelection +{ + public: + FemtoDreamV0Selection() + : nPtV0MinSel(0), nPtV0MaxSel(0), nEtaV0MaxSel(0), nDCAV0DaughMax(0), nCPAV0Min(0), nTranRadV0Min(0), nTranRadV0Max(0), nDecVtxMax(0), pTV0Min(9999999.), pTV0Max(-9999999.), etaV0Max(-9999999.), dCAV0DaughMax(-9999999.), cPAV0Min(9999999.), tranRadV0Min(9999999.), tranRadV0Max(-9999999.), decVtxMax(-9999999.), fInvMassLowLimit(1.05), fInvMassUpLimit(1.3), fRejectKaon(false), fRejectLambda(false), fInvMassKaonLowLimit(0.48), fInvMassKaonUpLimit(0.515), nSigmaPIDOffsetTPC(0.), fMotherIsLambda(true) {} + + /// Initializes histograms for the task + template + void init(HistogramRegistry* QAregistry, HistogramRegistry* Registry); + + template + bool isSelectedMinimal(C const& col, V const& v0, T const& posTrack, + T const& negTrack); + + template + void fillLambdaQA(C const& col, V const& v0, T const& posTrack, + T const& negTrack); + + /// \todo for the moment the PID of the tracks is factored out into a separate + /// field, hence 5 values in total \\ASK: what does it mean? + template + std::array getCutContainer(C const& col, V const& v0, + T const& posTrack, + T const& negTrack); + + template + void fillQA(C const& col, V const& v0, T const& posTrack, T const& negTrack); + + template + void setChildCuts(femto_dream_v0_selection::ChildTrackType child, T1 selVal, T2 selVar, femtoDreamSelection::SelectionType selType) + { + if (child == femto_dream_v0_selection::kPosTrack) { + posDaughTrack.setSelection(selVal, selVar, selType); + } else if (child == femto_dream_v0_selection::kNegTrack) { + negDaughTrack.setSelection(selVal, selVar, selType); + } + } + + template + void setChildPIDSpecies(femto_dream_v0_selection::ChildTrackType child, T& pids) + { + if (child == femto_dream_v0_selection::kPosTrack) { + posDaughTrack.setPIDSpecies(pids); + } else if (child == femto_dream_v0_selection::kNegTrack) { + negDaughTrack.setPIDSpecies(pids); + } + } + + /// Helper function to obtain the name of a given selection criterion for consistent naming of the configurables + /// \param iSel Track selection variable to be examined + /// \param prefix Additional prefix for the name of the configurable + /// \param suffix Additional suffix for the name of the configurable + static std::string getSelectionName(femto_dream_v0_selection::V0Sel iSel, std::string_view prefix = "", std::string_view suffix = "") + { + std::string outString = static_cast(prefix); + outString += static_cast(SelectionNames[iSel]); + outString += suffix; + return outString; + } + + /// Helper function to obtain the index of a given selection variable for consistent naming of the configurables + /// \param obs V0 selection variable (together with prefix) got from file + /// \param prefix Additional prefix for the output of the configurable + static int findSelectionIndex(const std::string_view& obs, + std::string_view prefix = "") + { + for (int index = 0; index < kNv0Selection; index++) { + std::string comp = static_cast(prefix) + + static_cast(SelectionNames[index]); + std::string_view cmp{comp}; + if (obs.compare(cmp) == 0) + return index; + } + LOGF(info, "Variable %s not found", obs); + return -1; + } + + /// Helper function to obtain the type of a given selection variable for consistent naming of the configurables + /// \param iSel V0 selection variable whose type is returned + static femtoDreamSelection::SelectionType getSelectionType(femto_dream_v0_selection::V0Sel iSel) + { // o2-linter: disable=name/function-variable (defined with UpperCamelCase in femtoDreamSelection) + return mSelectionTypes[iSel]; + } + + /// Helper function to obtain the helper string of a given selection criterion + /// for consistent description of the configurables + /// \param iSel Track selection variable to be examined + /// \param prefix Additional prefix for the output of the configurable + static std::string getSelectionHelper(femto_dream_v0_selection::V0Sel iSel, + std::string_view prefix = "") + { + std::string outString = static_cast(prefix); + outString += static_cast(SelectionHelper[iSel]); + return outString; + } + + /// Set limit for the selection on the invariant mass + /// \param lowLimit Lower limit for the invariant mass distribution + /// \param upLimit Upper limit for the invariant mass distribution + void setInvMassLimits(float lowLimit, float upLimit) + { + fInvMassLowLimit = lowLimit; + fInvMassUpLimit = upLimit; + } + + /// Set limit for the kaon rejection on the invariant mass + /// \param lowLimit Lower limit for the invariant mass distribution + /// \param upLimit Upper limit for the invariant mass distribution + void setKaonInvMassLimits(float lowLimit, float upLimit) + { + fRejectKaon = true; + fInvMassKaonLowLimit = lowLimit; + fInvMassKaonUpLimit = upLimit; + } + + void setnSigmaPIDOffsetTPC(float offsetTPC) + { + nSigmaPIDOffsetTPC = offsetTPC; + } + + void setChildRejectNotPropagatedTracks(femto_dream_v0_selection::ChildTrackType child, bool reject) + { + if (child == femto_dream_v0_selection::kPosTrack) { + posDaughTrack.setRejectNotPropagatedTracks(reject); + } else if (child == femto_dream_v0_selection::kNegTrack) { + negDaughTrack.setRejectNotPropagatedTracks(reject); + } + } + + void setChildnSigmaPIDOffset(femto_dream_v0_selection::ChildTrackType child, float offsetTPC, float offsetTOF) + { + if (child == femto_dream_v0_selection::kPosTrack) { + posDaughTrack.setnSigmaPIDOffset(offsetTPC, offsetTOF); + } else if (child == femto_dream_v0_selection::kNegTrack) { + negDaughTrack.setnSigmaPIDOffset(offsetTPC, offsetTOF); + } + } + + void setIsMother(bool IsMother) + { + fMotherIsLambda = IsMother; + } + + void setRejectLambda(bool reject) + { + fRejectLambda = reject; + } + + private: + int nPtV0MinSel; + int nPtV0MaxSel; + int nEtaV0MaxSel; + int nDCAV0DaughMax; + int nCPAV0Min; + int nTranRadV0Min; + int nTranRadV0Max; + int nDecVtxMax; + float pTV0Min; + float pTV0Max; + float etaV0Max; + float dCAV0DaughMax; + float cPAV0Min; + float tranRadV0Min; + float tranRadV0Max; + float decVtxMax; + + float fInvMassLowLimit; + float fInvMassUpLimit; + + bool fRejectKaon; + bool fRejectLambda; + float fInvMassKaonLowLimit; + float fInvMassKaonUpLimit; + + float nSigmaPIDOffsetTPC; + + bool fMotherIsLambda; + + FemtoDreamTrackSelection posDaughTrack; + FemtoDreamTrackSelection negDaughTrack; + + static constexpr int kNv0Selection = 9; + + static constexpr std::string_view SelectionNames[kNv0Selection] = { + "Sign", "PtMin", "PtMax", "EtaMax", "DCAdaughMax", "CPAMin", + "TranRadMin", "TranRadMax", "DecVecMax"}; ///< Name of the different + ///< selections + + static constexpr femtoDreamSelection::SelectionType + mSelectionTypes[kNv0Selection]{ + femtoDreamSelection::kEqual, + femtoDreamSelection::kLowerLimit, + femtoDreamSelection::kUpperLimit, + femtoDreamSelection::kUpperLimit, + femtoDreamSelection::kUpperLimit, + femtoDreamSelection::kLowerLimit, + femtoDreamSelection::kLowerLimit, + femtoDreamSelection::kUpperLimit, + femtoDreamSelection::kUpperLimit}; ///< Map to match a variable with + ///< its type + + static constexpr std::string_view SelectionHelper[kNv0Selection] = { + "+1 for lambda, -1 for antilambda", + "Minimum pT (GeV/c)", + "Maximum pT (GeV/c)", + "Maximum |Eta|", + "Maximum DCA between daughters (cm)", + "Minimum Cosine of Pointing Angle", + "Minimum transverse radius (cm)", + "Maximum transverse radius (cm)", + "Maximum distance from primary vertex"}; ///< Helper information for the + ///< different selections + +}; // namespace femtoDream + +template +void FemtoDreamV0Selection::init(HistogramRegistry* QAregistry, HistogramRegistry* Registry) +{ + if (QAregistry && Registry) { + mHistogramRegistry = Registry; + mQAHistogramRegistry = QAregistry; + fillSelectionHistogram(); + fillSelectionHistogram(); + + AxisSpec massAxisLambda = {600, 0.0f, 3.0f, "m_{#Lambda} (GeV/#it{c}^{2})"}; /// paramters for K0Short + AxisSpec massAxisAntiLambda = {600, 0.0f, 3.0f, + "m_{#bar{#Lambda}} (GeV/#it{c}^{2})"}; + + /// \todo this should be an automatic check in the parent class, and the + /// return type should be templated + size_t nSelections = getNSelections(); + if (nSelections > 8 * sizeof(cutContainerType)) { // o2-linter: disable=magic-number (number represents bitsize) + LOG(fatal) << "FemtoDreamV0Cuts: Number of selections to large for your " + "container - quitting!"; + } + + std::string folderName = static_cast( + o2::aod::femtodreamparticle::ParticleTypeName[part]); + /// \todo initialize histograms for children tracks of v0s + mQAHistogramRegistry->add((folderName + "/hPt").c_str(), + "; #it{p}_{T} (GeV/#it{c}); Entries", kTH1F, + {{1000, 0, 10}}); + mQAHistogramRegistry->add((folderName + "/hEta").c_str(), "; #eta; Entries", + kTH1F, {{1000, -1, 1}}); + mQAHistogramRegistry->add((folderName + "/hPhi").c_str(), "; #phi; Entries", + kTH1F, {{1000, 0, o2::constants::math::TwoPI}}); + mQAHistogramRegistry->add((folderName + "/hDaughDCA").c_str(), + "; DCA^{daugh} (cm); Entries", kTH1F, + {{1000, 0, 10}}); + mQAHistogramRegistry->add((folderName + "/hTransRadius").c_str(), + "; #it{r}_{xy} (cm); Entries", kTH1F, + {{1500, 0, 150}}); + mQAHistogramRegistry->add((folderName + "/hDecayVtxX").c_str(), + "; #it{Vtx}_{x} (cm); Entries", kTH1F, + {{2000, 0, 200}}); + mQAHistogramRegistry->add((folderName + "/hDecayVtxY").c_str(), + "; #it{Vtx}_{y} (cm)); Entries", kTH1F, + {{2000, 0, 200}}); + mQAHistogramRegistry->add((folderName + "/hDecayVtxZ").c_str(), + "; #it{Vtx}_{z} (cm); Entries", kTH1F, + {{2000, 0, 200}}); + mQAHistogramRegistry->add((folderName + "/hCPA").c_str(), + "; #it{cos #theta_{p}}; Entries", kTH1F, + {{1000, 0.9, 1.}}); + mQAHistogramRegistry->add((folderName + "/hCPAvsPt").c_str(), + "; #it{p}_{T} (GeV/#it{c}); #it{cos #theta_{p}}", + kTH2F, {{8, 0.3, 4.3}, {1000, 0.9, 1.}}); + mQAHistogramRegistry->add((folderName + "/hInvMassLambda").c_str(), "", kTH1F, + {massAxisLambda}); + mQAHistogramRegistry->add((folderName + "/hInvMassAntiLambda").c_str(), "", + kTH1F, {massAxisAntiLambda}); + mQAHistogramRegistry->add((folderName + "/hInvMassLambdaAntiLambda").c_str(), + "", kTH2F, {massAxisLambda, massAxisAntiLambda}); + + posDaughTrack.init( + mQAHistogramRegistry, mHistogramRegistry); + negDaughTrack.init( + mQAHistogramRegistry, mHistogramRegistry); + + mQAHistogramRegistry->add("LambdaQA/hInvMassLambdaNoCuts", "No cuts", kTH1F, + {massAxisLambda}); + mQAHistogramRegistry->add("LambdaQA/hInvMassLambdaInvMassCut", + "Invariant mass cut", kTH1F, {massAxisLambda}); + mQAHistogramRegistry->add("LambdaQA/hInvMassLambdaPtMin", "Minimum Pt cut", + kTH1F, {massAxisLambda}); + mQAHistogramRegistry->add("LambdaQA/hInvMassLambdaPtMax", "Maximum Pt cut", + kTH1F, {massAxisLambda}); + mQAHistogramRegistry->add("LambdaQA/hInvMassLambdaEtaMax", "Maximum Eta cut", + kTH1F, {massAxisLambda}); + mQAHistogramRegistry->add("LambdaQA/hInvMassLambdaDCAV0Daugh", + "V0-daughters DCA cut", kTH1F, {massAxisLambda}); + mQAHistogramRegistry->add("LambdaQA/hInvMassLambdaCPA", "CPA cut", kTH1F, + {massAxisLambda}); + mQAHistogramRegistry->add("LambdaQA/hInvMassLambdaTranRadMin", + "Minimum transverse radius cut", kTH1F, + {massAxisLambda}); + mQAHistogramRegistry->add("LambdaQA/hInvMassLambdaTranRadMax", + "Maximum transverse radius cut", kTH1F, + {massAxisLambda}); + mQAHistogramRegistry->add("LambdaQA/hInvMassLambdaDecVtxMax", + "Maximum distance on decay vertex cut", kTH1F, + {massAxisLambda}); + } + + /// check whether the most open cuts are fulfilled - most of this should have + /// already be done by the filters + nPtV0MinSel = getNSelections(femto_dream_v0_selection::kV0pTMin); + nPtV0MaxSel = getNSelections(femto_dream_v0_selection::kV0pTMax); + nEtaV0MaxSel = getNSelections(femto_dream_v0_selection::kV0etaMax); + nDCAV0DaughMax = getNSelections(femto_dream_v0_selection::kV0DCADaughMax); + nCPAV0Min = getNSelections(femto_dream_v0_selection::kV0CPAMin); + nTranRadV0Min = getNSelections(femto_dream_v0_selection::kV0TranRadMin); + nTranRadV0Max = getNSelections(femto_dream_v0_selection::kV0TranRadMax); + nDecVtxMax = getNSelections(femto_dream_v0_selection::kV0DecVtxMax); + + pTV0Min = getMinimalSelection(femto_dream_v0_selection::kV0pTMin, + femtoDreamSelection::kLowerLimit); + pTV0Max = getMinimalSelection(femto_dream_v0_selection::kV0pTMax, + femtoDreamSelection::kUpperLimit); + etaV0Max = getMinimalSelection(femto_dream_v0_selection::kV0etaMax, + femtoDreamSelection::kAbsUpperLimit); + dCAV0DaughMax = getMinimalSelection(femto_dream_v0_selection::kV0DCADaughMax, + femtoDreamSelection::kUpperLimit); + cPAV0Min = getMinimalSelection(femto_dream_v0_selection::kV0CPAMin, + femtoDreamSelection::kLowerLimit); + tranRadV0Min = getMinimalSelection(femto_dream_v0_selection::kV0TranRadMin, + femtoDreamSelection::kLowerLimit); + tranRadV0Max = getMinimalSelection(femto_dream_v0_selection::kV0TranRadMax, + femtoDreamSelection::kUpperLimit); + decVtxMax = getMinimalSelection(femto_dream_v0_selection::kV0DecVtxMax, + femtoDreamSelection::kAbsUpperLimit); +} + +template +bool FemtoDreamV0Selection::isSelectedMinimal(C const& /*col*/, V const& v0, + T const& posTrack, + T const& negTrack) +{ + const auto signPos = posTrack.sign(); + const auto signNeg = negTrack.sign(); + if (signPos < 0 || signNeg > 0) { + LOG(warn) << "Something wrong in isSelectedMinimal"; + LOG(warn) << "ERROR - Wrong sign for V0 daughters"; + } + // asfaf + const float pT = v0.pt(); + const float eta = v0.eta(); + const std::vector decVtx = {v0.x(), v0.y(), v0.z()}; + const float tranRad = v0.v0radius(); + const float dcaDaughv0 = v0.dcaV0daughters(); + const float cpav0 = v0.v0cosPA(); + + const float invMassLambda = v0.mLambda(); + const float invMassAntiLambda = v0.mAntiLambda(); + + const float invMassKaon = v0.mK0Short(); + + if (fMotherIsLambda) { /// Lambda + if ((invMassLambda < fInvMassLowLimit || invMassLambda > fInvMassUpLimit) && + (invMassAntiLambda < fInvMassLowLimit || + invMassAntiLambda > fInvMassUpLimit)) { + return false; + } + if (fRejectKaon) { + if (invMassKaon > fInvMassKaonLowLimit && + invMassKaon < fInvMassKaonUpLimit) { + return false; + } + } + } else { /// K0Short + if ((invMassKaon < fInvMassKaonLowLimit || invMassKaon > fInvMassKaonUpLimit)) { + return false; + } + if (fRejectLambda) { + if ((invMassLambda > fInvMassLowLimit && + invMassLambda < fInvMassUpLimit) || + (invMassAntiLambda > fInvMassLowLimit && + invMassAntiLambda < fInvMassUpLimit)) { + return false; + } + } + } + + if (nPtV0MinSel > 0 && pT < pTV0Min) { + return false; + } + if (nPtV0MaxSel > 0 && pT > pTV0Max) { + return false; + } + if (nEtaV0MaxSel > 0 && std::abs(eta) > etaV0Max) { + return false; + } + if (nDCAV0DaughMax > 0 && dcaDaughv0 > dCAV0DaughMax) { + return false; + } + if (nCPAV0Min > 0 && cpav0 < cPAV0Min) { + return false; + } + if (nTranRadV0Min > 0 && tranRad < tranRadV0Min) { + return false; + } + if (nTranRadV0Max > 0 && tranRad > tranRadV0Max) { + return false; + } + for (size_t i = 0; i < decVtx.size(); i++) { + if (nDecVtxMax > 0 && decVtx.at(i) > decVtxMax) { + return false; + } + } + if (!posDaughTrack.isSelectedMinimal(posTrack)) { + return false; + } + if (!negDaughTrack.isSelectedMinimal(negTrack)) { + return false; + } + + // check that track combinations for V0 or antiV0 would be fulfilling PID + int nSigmaPIDMax = posDaughTrack.getSigmaPIDMax(); + if (fMotherIsLambda) { /// Lambda + // antiV0 + auto nSigmaPrNeg = negTrack.tpcNSigmaPr(); + auto nSigmaPiPos = posTrack.tpcNSigmaPi(); + // v0 + auto nSigmaPiNeg = negTrack.tpcNSigmaPi(); + auto nSigmaPrPos = posTrack.tpcNSigmaPr(); + if (!(std::abs(nSigmaPrNeg - nSigmaPIDOffsetTPC) < nSigmaPIDMax && + std::abs(nSigmaPiPos - nSigmaPIDOffsetTPC) < nSigmaPIDMax) && + !(std::abs(nSigmaPrPos - nSigmaPIDOffsetTPC) < nSigmaPIDMax && + std::abs(nSigmaPiNeg - nSigmaPIDOffsetTPC) < nSigmaPIDMax)) { + return false; + } + } else { /// K0SHort + auto nSigmaPiNeg = negTrack.tpcNSigmaPi(); + auto nSigmaPiPos = posTrack.tpcNSigmaPi(); + if (!(std::abs(nSigmaPiPos - nSigmaPIDOffsetTPC) < nSigmaPIDMax && + std::abs(nSigmaPiNeg - nSigmaPIDOffsetTPC) < nSigmaPIDMax)) { + return false; + } + } + + return true; +} + +template +void FemtoDreamV0Selection::fillLambdaQA(C const& /*col*/, V const& v0, + T const& posTrack, T const& negTrack) +{ + const auto signPos = posTrack.sign(); + const auto signNeg = negTrack.sign(); + if (signPos < 0 || signNeg > 0) { + LOG(warn) << "Something wrong in isSelectedMinimal"; + LOG(warn) << "ERROR - Wrong sign for V0 daughters"; + } + const float pT = v0.pt(); + const float eta = v0.eta(); + const std::vector decVtx = {v0.x(), v0.y(), v0.z()}; + const float tranRad = v0.v0radius(); + const float dcaDaughv0 = v0.dcaV0daughters(); + const float cpav0 = v0.v0cosPA(); + + const float invMassLambda = v0.mLambda(); + const float invMassKaon = v0.mK0Short(); + + float fillMass = 0.; + if (fMotherIsLambda) { + fillMass = v0.mLambda(); + } else { + fillMass = v0.mK0Short(); + } + + mQAHistogramRegistry->fill(HIST("LambdaQA/hInvMassLambdaNoCuts"), fillMass); + + if (fMotherIsLambda) { /// Lambda + if (invMassLambda > fInvMassLowLimit && invMassLambda < fInvMassUpLimit) { + mQAHistogramRegistry->fill(HIST("LambdaQA/hInvMassLambdaInvMassCut"), + v0.mLambda()); + } + } else { /// K0Short + if (invMassKaon > fInvMassKaonLowLimit && invMassKaon < fInvMassKaonUpLimit) { + mQAHistogramRegistry->fill(HIST("LambdaQA/hInvMassLambdaInvMassCut"), + v0.mK0Short()); + } + } + + if (pT > pTV0Min) { + mQAHistogramRegistry->fill(HIST("LambdaQA/hInvMassLambdaPtMin"), + fillMass); + } + if (pT < pTV0Max) { + mQAHistogramRegistry->fill(HIST("LambdaQA/hInvMassLambdaPtMax"), + fillMass); + } + if (std::abs(eta) < etaV0Max) { + mQAHistogramRegistry->fill(HIST("LambdaQA/hInvMassLambdaEtaMax"), + fillMass); + } + if (dcaDaughv0 < dCAV0DaughMax) { + mQAHistogramRegistry->fill(HIST("LambdaQA/hInvMassLambdaDCAV0Daugh"), + fillMass); + } + if (cpav0 > cPAV0Min) { + mQAHistogramRegistry->fill(HIST("LambdaQA/hInvMassLambdaCPA"), fillMass); + } + if (tranRad > tranRadV0Min) { + mQAHistogramRegistry->fill(HIST("LambdaQA/hInvMassLambdaTranRadMin"), + fillMass); + } + if (tranRad < tranRadV0Max) { + mQAHistogramRegistry->fill(HIST("LambdaQA/hInvMassLambdaTranRadMax"), + fillMass); + } + bool write = true; + for (size_t i = 0; i < decVtx.size(); i++) { + write = write && (decVtx.at(i) < decVtxMax); + } + if (write) { + mQAHistogramRegistry->fill(HIST("LambdaQA/hInvMassLambdaDecVtxMax"), + fillMass); + } +} + +/// the CosPA of V0 needs as argument the posXYZ of collisions vertex so we need +/// to pass the collsion as well +template +std::array + FemtoDreamV0Selection::getCutContainer(C const& /*col*/, V const& v0, T const& posTrack, T const& negTrack) +{ + auto outputPosTrack = posDaughTrack.getCutContainer(posTrack, v0.positivept(), v0.positiveeta(), v0.dcapostopv()); + auto outputNegTrack = negDaughTrack.getCutContainer(negTrack, v0.negativept(), v0.negativeeta(), v0.dcanegtopv()); + cutContainerType output = 0; + size_t counter = 0; + + float sign = 0.; + /// Lambda + if (fMotherIsLambda) { + auto lambdaMassNominal = o2::constants::physics::MassLambda; + auto lambdaMassHypothesis = v0.mLambda(); + auto antiLambdaMassHypothesis = v0.mAntiLambda(); + auto diffLambda = std::abs(lambdaMassNominal - lambdaMassHypothesis); + auto diffAntiLambda = std::abs(antiLambdaMassHypothesis - lambdaMassHypothesis); + + int nSigmaPIDMax = posDaughTrack.getSigmaPIDMax(); + auto nSigmaPrNeg = negTrack.tpcNSigmaPr(); + auto nSigmaPiPos = posTrack.tpcNSigmaPi(); + auto nSigmaPiNeg = negTrack.tpcNSigmaPi(); + auto nSigmaPrPos = posTrack.tpcNSigmaPr(); + // check the mass and the PID of daughters + if (std::abs(nSigmaPrNeg - nSigmaPIDOffsetTPC) < nSigmaPIDMax && std::abs(nSigmaPiPos - nSigmaPIDOffsetTPC) < nSigmaPIDMax && diffAntiLambda > diffLambda) { + sign = -1.; + } else if (std::abs(nSigmaPrPos - nSigmaPIDOffsetTPC) < nSigmaPIDMax && std::abs(nSigmaPiNeg - nSigmaPIDOffsetTPC) < nSigmaPIDMax && diffAntiLambda < diffLambda) { + sign = 1.; + } else { + // if it happens that none of these are true, ignore the invariant mass + if (std::abs(nSigmaPrNeg - nSigmaPIDOffsetTPC) < nSigmaPIDMax && std::abs(nSigmaPiPos - nSigmaPIDOffsetTPC) < nSigmaPIDMax) { + sign = -1.; + } else if (std::abs(nSigmaPrPos - nSigmaPIDOffsetTPC) < nSigmaPIDMax && std::abs(nSigmaPiNeg - nSigmaPIDOffsetTPC) < nSigmaPIDMax) { + sign = 1.; + } + } + } else { + sign = 1.; // for the K0Short arbitrarily set the sign to 1 + } + + const auto pT = v0.pt(); + const auto eta = v0.eta(); + const auto tranRad = v0.v0radius(); + const auto dcaDaughv0 = v0.dcaV0daughters(); + const auto cpav0 = v0.v0cosPA(); + const std::vector decVtx = {v0.x(), v0.y(), v0.z()}; + + float observable = 0.; + for (auto& sel : mSelections) { // o2-linter: disable=const-ref-in-for-loop (femtoDreamObjectSelection has no const getter) + const auto selVariable = sel.getSelectionVariable(); + if (selVariable == femto_dream_v0_selection::kV0DecVtxMax) { + for (size_t i = 0; i < decVtx.size(); ++i) { + auto decVtxValue = decVtx.at(i); + sel.checkSelectionSetBit(decVtxValue, output, counter, nullptr); + } + } else { + switch (selVariable) { + case (femto_dream_v0_selection::kV0Sign): + observable = sign; + break; + case (femto_dream_v0_selection::kV0pTMin): + observable = pT; + break; + case (femto_dream_v0_selection::kV0pTMax): + observable = pT; + break; + case (femto_dream_v0_selection::kV0etaMax): + observable = eta; + break; + case (femto_dream_v0_selection::kV0DCADaughMax): + observable = dcaDaughv0; + break; + case (femto_dream_v0_selection::kV0CPAMin): + observable = cpav0; + break; + case (femto_dream_v0_selection::kV0TranRadMin): + observable = tranRad; + break; + case (femto_dream_v0_selection::kV0TranRadMax): + observable = tranRad; + break; + case (femto_dream_v0_selection::kV0DecVtxMax): + break; + } + sel.checkSelectionSetBit(observable, output, counter, nullptr); + } + } + return { + output, + outputPosTrack.at(femtoDreamTrackSelection::TrackContainerPosition::kCuts), + outputPosTrack.at(femtoDreamTrackSelection::TrackContainerPosition::kPID), + outputNegTrack.at(femtoDreamTrackSelection::TrackContainerPosition::kCuts), + outputNegTrack.at(femtoDreamTrackSelection::TrackContainerPosition::kPID)}; +} + +template +void FemtoDreamV0Selection::fillQA(C const& /*col*/, V const& v0, T const& posTrack, + T const& negTrack) +{ + if (mQAHistogramRegistry) { + mQAHistogramRegistry->fill( + HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + + HIST("/hPt"), + v0.pt()); + mQAHistogramRegistry->fill( + HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + + HIST("/hEta"), + v0.eta()); + mQAHistogramRegistry->fill( + HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + + HIST("/hPhi"), + v0.phi()); + mQAHistogramRegistry->fill( + HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + + HIST("/hDaughDCA"), + v0.dcaV0daughters()); + mQAHistogramRegistry->fill( + HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + + HIST("/hTransRadius"), + v0.v0radius()); + mQAHistogramRegistry->fill( + HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + + HIST("/hDecayVtxX"), + v0.x()); + mQAHistogramRegistry->fill( + HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + + HIST("/hDecayVtxY"), + v0.y()); + mQAHistogramRegistry->fill( + HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + + HIST("/hDecayVtxZ"), + v0.z()); + mQAHistogramRegistry->fill( + HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + + HIST("/hCPA"), + v0.v0cosPA()); + mQAHistogramRegistry->fill( + HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + + HIST("/hCPAvsPt"), + v0.pt(), v0.v0cosPA()); + + if (fMotherIsLambda) { /// Lambda + mQAHistogramRegistry->fill( + HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + + HIST("/hInvMassLambda"), + v0.mLambda()); + mQAHistogramRegistry->fill( + HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + + HIST("/hInvMassAntiLambda"), + v0.mAntiLambda()); + mQAHistogramRegistry->fill( + HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + + HIST("/hInvMassLambdaAntiLambda"), + v0.mLambda(), v0.mAntiLambda()); + } else { /// K0Short + mQAHistogramRegistry->fill( + HIST(o2::aod::femtodreamparticle::ParticleTypeName[part]) + + HIST("/hInvMassLambda"), + v0.mK0Short()); + } + } + + posDaughTrack.fillQA(posTrack); + negDaughTrack.fillQA(negTrack); +} + +} // namespace o2::analysis::femtoDream + +#endif // PWGCF_FEMTODREAM_CORE_FEMTODREAMV0SELECTIONK0SHORT_H_ diff --git a/PWGCF/FemtoDream/TableProducer/CMakeLists.txt b/PWGCF/FemtoDream/TableProducer/CMakeLists.txt index 6085904e73e..7984fd632b7 100644 --- a/PWGCF/FemtoDream/TableProducer/CMakeLists.txt +++ b/PWGCF/FemtoDream/TableProducer/CMakeLists.txt @@ -14,6 +14,11 @@ o2physics_add_dpl_workflow(femtodream-producer PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(femto-dream-producer-task-reso + SOURCES femtoDreamProducerTaskReso.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(femtodream-producer-reduced SOURCES femtoDreamProducerReducedTask.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore @@ -22,4 +27,4 @@ o2physics_add_dpl_workflow(femtodream-producer-reduced o2physics_add_dpl_workflow(femtodream-producer-for-specific-analysis SOURCES femtoDreamProducerTaskForSpecificAnalysis.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore - COMPONENT_NAME Analysis) \ No newline at end of file + COMPONENT_NAME Analysis) diff --git a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTaskReso.cxx b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTaskReso.cxx new file mode 100644 index 00000000000..fa2680acbf2 --- /dev/null +++ b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTaskReso.cxx @@ -0,0 +1,1114 @@ +// Copyright 2019-2022 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 femtoDreamProducerTaskReso.cxx +/// \brief Tasks that produces the track tables used for the pairing +/// \author Laura Serksnyte, TU München, laura.serksnyte@tum.de + +#include "PWGCF/DataModel/FemtoDerived.h" +#include "PWGCF/FemtoDream/Core/femtoDreamCascadeSelection.h" +#include "PWGCF/FemtoDream/Core/femtoDreamCollisionSelection.h" +#include "PWGCF/FemtoDream/Core/femtoDreamResoSelection.h" +#include "PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h" +#include "PWGCF/FemtoDream/Core/femtoDreamUtils.h" +#include "PWGCF/FemtoDream/Core/femtoDreamV0SelectionK0Short.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" + +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseITS.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "EventFiltering/Zorro.h" + +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/Expressions.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" +#include + +#include "Math/Vector4D.h" +#include "TMath.h" + +#include + +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::aod::rctsel; +using namespace o2::analysis::femtoDream; + +namespace o2::aod +{ +using FemtoFullCollision = soa::Join::iterator; +using FemtoFullCollisionNoCent = soa::Join::iterator; +using FemtoFullCollisionCentPbPb = soa::Join::iterator; +using FemtoFullCollisionMC = soa::Join::iterator; +using FemtoFullCollisionNoCentMC = soa::Join::iterator; +using FemtoFullCollisionMCCentPbPb = soa::Join::iterator; +using FemtoFullMCgenCollisions = soa::Join; +using FemtoFullMCgenCollision = FemtoFullMCgenCollisions::iterator; + +using FemtoFullTracks = + soa::Join; + +} // namespace o2::aod + +namespace software_triggers +{ +static const int nTriggers = 6; +static const std::vector triggerNames{"fPPP", "fPPL", "fPLL", "fLLL", "fPD", "fLD"}; +static const float triggerSwitches[1][nTriggers]{ + {0, 0, 0, 0, 0, 0}}; +} // namespace software_triggers + +template +int getRowDaughters(int daughID, T const& vecID) +{ + int rowInPrimaryTrackTableDaugh = -1; + for (size_t i = 0; i < vecID.size(); i++) { + if (vecID.at(i) == daughID) { + rowInPrimaryTrackTableDaugh = i; + break; + } + } + return rowInPrimaryTrackTableDaugh; +} + +struct FemtoDreamProducerTaskReso { + + SliceCache cache; // o2::framework, included in ASoAHelpers.h + Preslice perCol = aod::track::collisionId; // o2::framework included in ASoAHelpers.h + Partition daughter1 = aod::track::signed1Pt > 0.f; // o2::framework included in AnalysisHelper.h + Partition daughter2 = aod::track::signed1Pt < 0.f; // o2::framework included in AnalysisHelper.h + + Zorro zorro; + + Produces outputCollision; + Produces outputMCCollision; + Produces outputCollsMCLabels; + Produces outputParts; + Produces outputPartsMC; + Produces outputDebugParts; + Produces outputPartsMCLabels; + Produces outputDebugPartsMC; + Produces outputPartsExtMCLabels; + + Configurable confIsDebug{"confIsDebug", true, "Enable Debug tables"}; + Configurable confUseItsPid{"confUseItsPid", false, "Enable Debug tables"}; + Configurable confIsRun3{"confIsRun3", false, "Running on Run3 or pilot"}; // true? + Configurable confIsForceGRP{"confIsForceGRP", false, "Set true if the magnetic field configuration is not available in the usual CCDB directory (e.g. for Run 2 converted data or unanchorad Monte Carlo)"}; + /// Event cuts + FemtoDreamCollisionSelection colCuts; + // Event cuts - Triggers + Configurable confEnableTriggerSelection{"confEnableTriggerSelection", false, "Should the trigger selection be enabled for collisions?"}; + Configurable> confTriggerSwitches{"confTriggerSwitches", {software_triggers::triggerSwitches[0], 1, software_triggers::nTriggers, std::vector{"Switch"}, software_triggers::triggerNames}, "Turn on which trigger should be checked for recorded events to pass selection"}; + Configurable confBaseCCDBPathForTriggers{"confBaseCCDBPathForTriggers", "Users/m/mpuccio/EventFiltering/OTS/Chunked/", "Provide ccdb path for trigger table; default - trigger coordination"}; + + // Event cuts - usual selection criteria + Configurable confEvtZvtx{"confEvtZvtx", 10.f, "Evt sel: Max. z-Vertex (cm)"}; + Configurable confEvtTriggerCheck{"confEvtTriggerCheck", true, "Evt sel: check for trigger"}; + Configurable confEvtTriggerSel{"confEvtTriggerSel", kINT7, "Evt sel: trigger"}; + Configurable confEvtOfflineCheck{"confEvtOfflineCheck", false, "Evt sel: check for offline selection"}; + Configurable confEvtAddOfflineCheck{"confEvtAddOfflineCheck", false, "Evt sel: additional checks for offline selection (not part of sel8 yet)"}; + Configurable confIsActivateV0{"confIsActivateV0", true, "Activate filling of V0 into femtodream tables"}; + Configurable confIsActivateReso{"confIsActivateReso", true, "Activate filling of sl Resonances into femtodream tables"}; + Configurable confIsActivatePhi{"confIsActivatePhi", true, "Activates cuts on Phi's and fills tables"}; + Configurable confIsActivateCascade{"confIsActivateCascade", false, "Activate filling of Cascades into femtodream tables"}; + Configurable confEvtMinSphericity{"confEvtMinSphericity", 0.0f, "Evt sel: Min. sphericity of event"}; + Configurable confEvtSphericityPtmin{"confEvtSphericityPtmin", 0.0f, "Evt sel: Min. Pt for sphericity calculation"}; + + Configurable confTrkRejectNotPropagated{"confTrkRejectNotPropagated", false, "True: reject not propagated tracks"}; + // Configurable confRejectITSHitandTOFMissing{ "confRejectITSHitandTOFMissing", false, "True: reject if neither ITS hit nor TOF timing satisfied"}; + Configurable confTrkPDGCode{"confTrkPDGCode", 2212, "PDG code of the selected track for Monte Carlo truth"}; + FemtoDreamTrackSelection trackCuts; + struct : ConfigurableGroup { + std::string prefix = std::string("Track"); + Configurable> confTrkCharge{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kSign, "confTrk"), std::vector{-1, 1}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kSign, "Track selection: ")}; + Configurable> confTrkPtmin{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kpTMin, "confTrk"), std::vector{0.1f, 0.15f, 0.2f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kpTMin, "Track selection: ")}; + Configurable> confTrkPtmax{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kpTMax, "confTrk"), std::vector{4.4f, 4.6f, 4.5f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kpTMax, "Track selection: ")}; + Configurable> confTrkEta{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kEtaMax, "confTrk"), std::vector{0.8f, 0.85f, 0.9f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kEtaMax, "Track selection: ")}; + Configurable> confTrkTPCnclsMin{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kTPCnClsMin, "confTrk"), std::vector{80.f, 90.f, 100.f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kTPCnClsMin, "Track selection: ")}; + Configurable> confTrkTPCfCls{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kTPCfClsMin, "confTrk"), std::vector{0.7f, 0.83f, 0.9f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kTPCfClsMin, "Track selection: ")}; + Configurable> confTrkTPCcRowsMin{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kTPCcRowsMin, "confTrk"), std::vector{70.f, 60.f, 80.f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kTPCcRowsMin, "Track selection: ")}; + Configurable> confTrkTPCsCls{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kTPCsClsMax, "confTrk"), std::vector{0.1f, 160.f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kTPCsClsMax, "Track selection: ")}; + Configurable> confTrkITSnclsMin{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kITSnClsMin, "confTrk"), std::vector{-1.f, 2.f, 4.f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kITSnClsMin, "Track selection: ")}; + Configurable> confTrkITSnclsIbMin{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kITSnClsIbMin, "confTrk"), std::vector{-1.f, 1.f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kITSnClsIbMin, "Track selection: ")}; + Configurable> confTrkDCAxyMax{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kDCAxyMax, "confTrk"), std::vector{0.2f, 0.5f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kDCAxyMax, "Track selection: ")}; + Configurable> confTrkDCAzMax{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kDCAzMax, "confTrk"), std::vector{0.2f, 0.5f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kDCAzMax, "Track selection: ")}; + Configurable> confTrkPIDnSigmaMax{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kPIDnSigmaMax, "confTrk"), std::vector{3.5f, 3.f, 2.5f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kPIDnSigmaMax, "Track selection: ")}; + Configurable confTrkPIDnSigmaOffsetTPC{"confTrkPIDnSigmaOffsetTPC", 0., "Offset for TPC nSigma because of bad calibration"}; // set to zero for run3 or so + Configurable confTrkPIDnSigmaOffsetTOF{"confTrkPIDnSigmaOffsetTOF", 0., "Offset for TOF nSigma because of bad calibration"}; + Configurable> confTrkPIDspecies{"confTrkPIDspecies", std::vector{o2::track::PID::Pion, o2::track::PID::Kaon, o2::track::PID::Proton, o2::track::PID::Deuteron}, "Trk sel: Particles species for PID"}; + // missing DCA Configurable?? because implemented in TrackSelection.h + } Track; + + FemtoDreamV0Selection v0Cuts; + Configurable> confV0Sign{FemtoDreamV0Selection::getSelectionName(femto_dream_v0_selection::kV0Sign, "confV0"), std::vector{-1, 1}, FemtoDreamV0Selection::getSelectionHelper(femto_dream_v0_selection::kV0Sign, "V0 selection: ")}; + Configurable> confV0PtMin{FemtoDreamV0Selection::getSelectionName(femto_dream_v0_selection::kV0pTMin, "confV0"), std::vector{0.3f, 0.4f, 0.5f}, FemtoDreamV0Selection::getSelectionHelper(femto_dream_v0_selection::kV0pTMin, "V0 selection: ")}; + Configurable> confV0PtMax{FemtoDreamV0Selection::getSelectionName(femto_dream_v0_selection::kV0pTMax, "confV0"), std::vector{3.3f, 3.4f, 3.5f}, FemtoDreamV0Selection::getSelectionHelper(femto_dream_v0_selection::kV0pTMax, "V0 selection: ")}; + Configurable> confV0EtaMax{FemtoDreamV0Selection::getSelectionName(femto_dream_v0_selection::kV0etaMax, "confV0"), std::vector{0.8f, 0.7f, 0.9f}, FemtoDreamV0Selection::getSelectionHelper(femto_dream_v0_selection::kV0etaMax, "V0 selection: ")}; + Configurable> confV0DCADaughMax{FemtoDreamV0Selection::getSelectionName(femto_dream_v0_selection::kV0DCADaughMax, "confV0"), std::vector{1.2f, 1.5f}, FemtoDreamV0Selection::getSelectionHelper(femto_dream_v0_selection::kV0DCADaughMax, "V0 selection: ")}; + Configurable> confV0CPAMin{FemtoDreamV0Selection::getSelectionName(femto_dream_v0_selection::kV0CPAMin, "confV0"), std::vector{0.99f, 0.995f}, FemtoDreamV0Selection::getSelectionHelper(femto_dream_v0_selection::kV0CPAMin, "V0 selection: ")}; + Configurable> confV0TranRadMin{FemtoDreamV0Selection::getSelectionName(femto_dream_v0_selection::kV0TranRadMin, "confV0"), std::vector{0.2f}, FemtoDreamV0Selection::getSelectionHelper(femto_dream_v0_selection::kV0TranRadMin, "V0 selection: ")}; + Configurable> confV0TranRadMax{FemtoDreamV0Selection::getSelectionName(femto_dream_v0_selection::kV0TranRadMax, "confV0"), std::vector{100.f}, FemtoDreamV0Selection::getSelectionHelper(femto_dream_v0_selection::kV0TranRadMax, "V0 selection: ")}; + Configurable> confV0DecVtxMax{FemtoDreamV0Selection::getSelectionName(femto_dream_v0_selection::kV0DecVtxMax, "confV0"), std::vector{100.f}, FemtoDreamV0Selection::getSelectionHelper(femto_dream_v0_selection::kV0DecVtxMax, "V0 selection: ")}; + + Configurable confV0InvMassLowLimit{"confV0InvMassLowLimit", 1.05, "Lower limit of the V0 invariant mass"}; + Configurable confV0InvMassUpLimit{"confV0InvMassUpLimit", 1.30, "Upper limit of the V0 invariant mass"}; + Configurable confV0RejectKaons{"confV0RejectKaons", false, "Switch to reject kaons"}; + Configurable confV0RejectLambdas{"confV0RejectLambdas", false, "Switch to reject lambdas (if mother is kaon)"}; + Configurable confV0InvKaonMassLowLimit{"confV0InvKaonMassLowLimit", 0.48, "Lower limit of the V0 invariant mass for Kaon rejection"}; + Configurable confV0InvKaonMassUpLimit{"confV0InvKaonMassUpLimit", 0.515, "Upper limit of the V0 invariant mass for Kaon rejection"}; + Configurable confV0MotherIsLambda{"confV0MotherIsLambda", true, "True: Lambda, False: K0Short"}; + + Configurable> confChildCharge{"confChildCharge", std::vector{-1, 1}, "V0 Child sel: Charge"}; + Configurable> confChildEtaMax{"confChildEtaMax", std::vector{0.8f}, "V0 Child sel: max eta"}; + Configurable> confChildTPCnClsMin{"confChildTPCnClsMin", std::vector{80.f, 70.f, 60.f}, "V0 Child sel: Min. nCls TPC"}; + Configurable> confChildDCAMin{"confChildDCAMin", std::vector{0.05f, 0.06f}, "V0 Child sel: Max. DCA Daugh to PV (cm)"}; + Configurable> confChildPIDnSigmaMax{"confChildPIDnSigmaMax", std::vector{5.f, 4.f}, "V0 Child sel: Max. PID nSigma TPC"}; + Configurable> confChildPIDspecies{"confChildPIDspecies", std::vector{o2::track::PID::Pion, o2::track::PID::Proton}, "V0 Child sel: Particles species for PID"}; + + // Resonances + FemtoDreamResoSelection resoCuts; + struct : ConfigurableGroup { + std::string prefix = std::string("Resonance"); + + Configurable confResoInvMassLowLimit{"confResoInvMassLowLimit", 0.9, "Lower limit of the Reso invariant mass"}; // 1.011461 + Configurable confResoInvMassUpLimit{"confResoInvMassUpLimit", 1.15, "Upper limit of the Reso invariant mass"}; // 1.027461 + Configurable> confResoSign{"confResoSign", std::vector{-1., 1.}, "Reso Sign selection"}; + Configurable confResoMotherID{"confResoMotherID", static_cast(femto_dream_reso_selection::kPhi), "ResoID of Mother [0: Phi, 1: KStar]"}; + + Configurable> confDaughterCharge{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kSign, "confDaughter"), std::vector{-1, 1}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kSign, "Reso selection: ")}; + Configurable> confDaughterPtMin{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kpTMin, "confDaughter"), std::vector{0.1, 0.15, 0.2}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kpTMin, "Reso selection: ")}; + Configurable> confDaughterPtMax{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kpTMax, "confDaughter"), std::vector{5.0, 4.0}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kpTMax, "Reso selection: ")}; + Configurable> confDaughterEtaMax{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kEtaMax, "confDaughter"), std::vector{0.8, 0.85, 0.9}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kEtaMax, "Reso selection: ")}; + Configurable> confDaughterTPCnClsMin{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kTPCnClsMin, "confDaughter"), std::vector{75, 85, 100}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kTPCnClsMin, "Reso selection: ")}; + Configurable> confDaughterTPCfClsMin{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kTPCfClsMin, "confDaughter"), std::vector{0.7, 0.8, 0.9}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kTPCfClsMin, "Reso selection: ")}; + Configurable> confDaughterTPCcRowsMin{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kTPCcRowsMin, "confDaughter"), std::vector{75, 85, 100}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kTPCcRowsMin, "Reso selection: ")}; + Configurable> confDaughterDCAxyMax{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kDCAxyMax, "confDaughter"), std::vector{0.2, 0.15, 0.1}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kDCAxyMax, "Reso selection: ")}; + Configurable> confDaughterDCAzMax{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kDCAzMax, "confDaughter"), std::vector{0.2, 0.15, 0.1}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kDCAzMax, "Reso selection: ")}; + Configurable> confDaughterPIDnSigmaMax{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kPIDnSigmaMax, "confDaughter"), std::vector{3.0, 2.5, 2.0}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kPIDnSigmaMax, "Reso selection: ")}; + // Configurable confResoMassUp{"confResoMassUp", 0.52, "Upper limit for the mass selection of the daughters"}; + // Configurable confResoMassLow{"confResoMassLow", 0.48, "Lower limit for the mass selection of the daughters"}; + Configurable> confDaughterPIDspecies{"confDaughterPIDspecies", std::vector{o2::track::PID::Kaon, o2::track::PID::Kaon}, "Reso Daughter sel: Particles species for PID"}; + Configurable> confDaughterPTPCThr{"confDaughterPTPCThr", std::vector{0.5, 0.5}, "p_T (GeV/c) & pid dependent Thresholds for case distinction between TPC/TPCTOF"}; + } Resonance; + + /// \todo should we add filter on min value pT/eta of V0 and daughters? + /*Filter v0Filter = (nabs(aod::v0data::x) < V0DecVtxMax.value) && + (nabs(aod::v0data::y) < V0DecVtxMax.value) && + (nabs(aod::v0data::z) < V0DecVtxMax.value);*/ + // (aod::v0data::v0radius > V0TranRadV0Min.value); to be added, not working + // for now do not know why + + /// General options + struct : o2::framework::ConfigurableGroup { + Configurable confTrkMinChi2PerClusterTPC{"confTrkMinChi2PerClusterTPC", 0.f, "Lower limit for chi2 of TPC; currently for testing only"}; + Configurable confTrkMaxChi2PerClusterTPC{"confTrkMaxChi2PerClusterTPC", 1000.f, "Upper limit for chi2 of TPC; currently for testing only"}; + Configurable confTrkMaxChi2PerClusterITS{"confTrkMaxChi2PerClusterITS", 1000.0f, "Minimal track selection: max allowed chi2 per ITS cluster"}; // 36.0 is default + Configurable confTrkTPCRefit{"confTrkTPCRefit", false, "True: require TPC refit"}; + Configurable confTrkITSRefit{"confTrkITSRefit", false, "True: require ITS refit"}; + + } OptionTrackSpecialSelections; + + struct : o2::framework::ConfigurableGroup { + Configurable requireRCTFlagChecker{"requireRCTFlagChecker", true, "Check event quality in run condition table"}; + Configurable cfgEvtRCTFlagCheckerLabel{"cfgEvtRCTFlagCheckerLabel", "CBT_hadronPID", "Evt sel: RCT flag checker label"}; + Configurable cfgEvtRCTFlagCheckerLimitAcceptAsBad{"cfgEvtRCTFlagCheckerLimitAcceptAsBad", true, "Evt sel: RCT flag checker treat Limited Acceptance As Bad"}; + } rctCut; + + HistogramRegistry qaRegistry{"QAHistos", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry trackRegistry{"Tracks", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry v0Registry{"V0", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry resoRegistry{"Reso", {}, OutputObjHandlingPolicy::AnalysisObject}; + + int mRunNumber; + float mMagField; + std::string zorroTriggerNames = ""; + Service ccdb; /// Accessing the CCDB + RCTFlagsChecker rctChecker; + + void init(InitContext&) + { + if (doprocessData == false && doprocessData_noCentrality == false && doprocessData_CentPbPb == false && doprocessMC == false && doprocessMC_noCentrality == false && doprocessMC_CentPbPb == false) { + LOGF(fatal, "Neither processData nor processMC enabled. Please choose one."); + } + if ((doprocessData == true && doprocessMC == true) || (doprocessData == true && doprocessMC_noCentrality == true) || (doprocessMC == true && doprocessMC_noCentrality == true) || (doprocessData_noCentrality == true && doprocessData == true) || (doprocessData_noCentrality == true && doprocessMC == true) || (doprocessData_noCentrality == true && doprocessMC_noCentrality == true) || (doprocessData_CentPbPb == true && doprocessData == true) || (doprocessData_CentPbPb == true && doprocessData_noCentrality == true) || (doprocessData_CentPbPb == true && doprocessMC == true) || (doprocessData_CentPbPb == true && doprocessMC_noCentrality == true) || (doprocessData_CentPbPb == true && doprocessMC_CentPbPb == true)) { + LOGF(fatal, + "Cannot enable more than one process switch at the same time. " + "Please choose one."); + } + + int cutBits = 8 * sizeof(o2::aod::femtodreamparticle::cutContainerType); + trackRegistry.add("AnalysisQA/CutCounter", "; Bit; Counter", kTH1F, {{cutBits + 1, -0.5, cutBits + 0.5}}); + trackRegistry.add("AnalysisQA/Chi2ITSTPCperCluster", "; ITS_Chi2; TPC_Chi2", kTH2F, {{100, 0, 50}, {100, 0, 20}}); + trackRegistry.add("AnalysisQA/RefitITSTPC", "; ITS_Refit; TPC_Refit", kTH2F, {{2, 0, 2}, {2, 0, 2}}); + trackRegistry.add("AnalysisQA/getGenStatusCode", "; Bit; Entries", kTH1F, {{200, 0, 200}}); + trackRegistry.add("AnalysisQA/getProcess", "; Bit; Entries", kTH1F, {{200, 0, 200}}); + trackRegistry.add("AnalysisQA/Mother", "; Bit; Entries", kTH1F, {{4000, -4000, 4000}}); + trackRegistry.add("AnalysisQA/Particle", "; Bit; Entries", kTH1F, {{4000, -4000, 4000}}); + v0Registry.add("AnalysisQA/CutCounter", "; Bit; Counter", kTH1F, {{cutBits + 1, -0.5, cutBits + 0.5}}); + + resoRegistry.add("AnalysisQA/Reso/InvMass", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.65, 1.5}}); + resoRegistry.add("AnalysisQA/Reso/InvMassAnti", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.65, 1.5}}); + resoRegistry.add("AnalysisQA/Reso/InvMass_phi_selected", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.65, 1.5}}); + resoRegistry.add("AnalysisQA/Reso/InvMassAnti_phi_selected", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.65, 1.5}}); + + resoRegistry.add("AnalysisQA/Reso/Daughter1/Pt", "Transverse momentum of all tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); + resoRegistry.add("AnalysisQA/Reso/Daughter1/Eta", "Pseudorapidity of all tracks;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); + resoRegistry.add("AnalysisQA/Reso/Daughter1/Phi", "Azimuthal angle of all tracks;#phi;Entries", HistType::kTH1F, {{720, 0, o2::constants::math::TwoPI}}); + resoRegistry.add("AnalysisQA/Reso/Daughter1/DcaXY", "dcaXY of all tracks;d_{XY} (cm);Entries", HistType::kTH1F, {{1000, 0, 1}}); // check if cm is correct here + resoRegistry.add("AnalysisQA/Reso/Daughter1/DcaZ", "dcaZ of all tracks;d_{Z} (cm);Entries", HistType::kTH1F, {{1000, 0, 1}}); // check if cm is correct here + resoRegistry.add("AnalysisQA/Reso/Daughter2/Pt", "Transverse momentum of all tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); + resoRegistry.add("AnalysisQA/Reso/Daughter2/Eta", "Pseudorapidity of all tracks;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); + resoRegistry.add("AnalysisQA/Reso/Daughter2/Phi", "Azimuthal angle of all tracks;#phi;Entries", HistType::kTH1F, {{720, 0, o2::constants::math::TwoPI}}); + resoRegistry.add("AnalysisQA/Reso/Daughter2/DcaXY", "dcaXY of all tracks;d_{XY} (cm);Entries", HistType::kTH1F, {{1000, 0, 1}}); // check if cm is correct here + resoRegistry.add("AnalysisQA/Reso/Daughter2/DcaZ", "dcaZ of all tracks;d_{Z} (cm);Entries", HistType::kTH1F, {{1000, 0, 1}}); // check if cm is correct here + + resoRegistry.add("AnalysisQA/Reso/Pt_posdaughter_selected", "Transverse momentum of all processed tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); + resoRegistry.add("AnalysisQA/Reso/Eta_posdaughter_selected", "Pseudorapidity of all processed tracks;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); + resoRegistry.add("AnalysisQA/Reso/Phi_posdaughter_selected", "Azimuthal angle of all processed tracks;#phi;Entries", HistType::kTH1F, {{720, 0, o2::constants::math::TwoPI}}); + resoRegistry.add("AnalysisQA/Reso/DCAxy_posdaughter_selected", "dcaXY of all processed tracks;d_{XY} (cm);Entries", HistType::kTH1F, {{1000, 0, 1}}); // check if cm is correct here + resoRegistry.add("AnalysisQA/Reso/DCAz_posdaughter_selected", "dcaZ of all processed tracks;d_{Z} (cm);Entries", HistType::kTH1F, {{1000, 0, 1}}); // check if cm is correct here + resoRegistry.add("AnalysisQA/Reso/Eta_negdaughter_selected", "Pseudorapidity of all processed tracks;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); + resoRegistry.add("AnalysisQA/Reso/Phi_negdaughter_selected", "Azimuthal angle of all processed tracks;#phi;Entries", HistType::kTH1F, {{720, 0, o2::constants::math::TwoPI}}); + resoRegistry.add("AnalysisQA/Reso/Pt_negdaughter_selected", "Transverse momentum of all processed tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); + resoRegistry.add("AnalysisQA/Reso/DCAxy_negdaughter_selected", "dcaXY of all processed tracks;d_{XY} (cm);Entries", HistType::kTH1F, {{1000, 0, 1}}); // check if cm is correct here + resoRegistry.add("AnalysisQA/Reso/DCAz_negdaughter_selected", "dcaZ of all processed tracks;d_{Z} (cm);Entries", HistType::kTH1F, {{1000, 0, 1}}); // check if cm is correct here + + if (confEnableTriggerSelection) { + for (const auto& triggerName : software_triggers::triggerNames) { + if (confTriggerSwitches->get("Switch", triggerName.c_str())) { + zorroTriggerNames += triggerName + ","; + } + } + zorroTriggerNames.pop_back(); + } + + rctChecker.init(rctCut.cfgEvtRCTFlagCheckerLabel, false, rctCut.cfgEvtRCTFlagCheckerLimitAcceptAsBad); + + colCuts.setCuts(confEvtZvtx.value, confEvtTriggerCheck.value, confEvtTriggerSel.value, confEvtOfflineCheck.value, confEvtAddOfflineCheck.value, confIsRun3.value, confEvtMinSphericity.value, confEvtSphericityPtmin.value); + colCuts.init(&qaRegistry); + + trackCuts.setSelection(Track.confTrkCharge, femtoDreamTrackSelection::kSign, femtoDreamSelection::kEqual); + trackCuts.setSelection(Track.confTrkPtmin, femtoDreamTrackSelection::kpTMin, femtoDreamSelection::kLowerLimit); + trackCuts.setSelection(Track.confTrkPtmax, femtoDreamTrackSelection::kpTMax, femtoDreamSelection::kUpperLimit); + trackCuts.setSelection(Track.confTrkEta, femtoDreamTrackSelection::kEtaMax, femtoDreamSelection::kAbsUpperLimit); + trackCuts.setSelection(Track.confTrkTPCnclsMin, femtoDreamTrackSelection::kTPCnClsMin, femtoDreamSelection::kLowerLimit); + trackCuts.setSelection(Track.confTrkTPCfCls, femtoDreamTrackSelection::kTPCfClsMin, femtoDreamSelection::kLowerLimit); + trackCuts.setSelection(Track.confTrkTPCcRowsMin, femtoDreamTrackSelection::kTPCcRowsMin, femtoDreamSelection::kLowerLimit); + trackCuts.setSelection(Track.confTrkTPCsCls, femtoDreamTrackSelection::kTPCsClsMax, femtoDreamSelection::kUpperLimit); + trackCuts.setSelection(Track.confTrkITSnclsMin, femtoDreamTrackSelection::kITSnClsMin, femtoDreamSelection::kLowerLimit); + trackCuts.setSelection(Track.confTrkITSnclsIbMin, femtoDreamTrackSelection::kITSnClsIbMin, femtoDreamSelection::kLowerLimit); + trackCuts.setSelection(Track.confTrkDCAxyMax, femtoDreamTrackSelection::kDCAxyMax, femtoDreamSelection::kAbsUpperLimit); + trackCuts.setSelection(Track.confTrkDCAzMax, femtoDreamTrackSelection::kDCAzMax, femtoDreamSelection::kAbsUpperLimit); + trackCuts.setSelection(Track.confTrkPIDnSigmaMax, femtoDreamTrackSelection::kPIDnSigmaMax, femtoDreamSelection::kAbsUpperLimit); + trackCuts.setPIDSpecies(Track.confTrkPIDspecies); + trackCuts.setnSigmaPIDOffset(Track.confTrkPIDnSigmaOffsetTPC, Track.confTrkPIDnSigmaOffsetTOF); + trackCuts.init(&qaRegistry, &trackRegistry); + + /// \todo fix how to pass array to setSelection, getRow() passing a + /// different type! + // v0Cuts.setSelection(confV0Selection->getRow(0), + // femto_dream_v0_selection::kDecVtxMax, femtoDreamSelection::kAbsUpperLimit); + if (confIsActivateV0) { + v0Cuts.setSelection(confV0Sign, femto_dream_v0_selection::kV0Sign, femtoDreamSelection::kEqual); + v0Cuts.setSelection(confV0PtMin, femto_dream_v0_selection::kV0pTMin, femtoDreamSelection::kLowerLimit); + v0Cuts.setSelection(confV0PtMax, femto_dream_v0_selection::kV0pTMax, femtoDreamSelection::kUpperLimit); + v0Cuts.setSelection(confV0EtaMax, femto_dream_v0_selection::kV0etaMax, femtoDreamSelection::kAbsUpperLimit); + v0Cuts.setSelection(confV0DCADaughMax, femto_dream_v0_selection::kV0DCADaughMax, femtoDreamSelection::kUpperLimit); + v0Cuts.setSelection(confV0CPAMin, femto_dream_v0_selection::kV0CPAMin, femtoDreamSelection::kLowerLimit); + v0Cuts.setSelection(confV0TranRadMin, femto_dream_v0_selection::kV0TranRadMin, femtoDreamSelection::kLowerLimit); + v0Cuts.setSelection(confV0TranRadMax, femto_dream_v0_selection::kV0TranRadMax, femtoDreamSelection::kUpperLimit); + v0Cuts.setSelection(confV0DecVtxMax, femto_dream_v0_selection::kV0DecVtxMax, femtoDreamSelection::kUpperLimit); + v0Cuts.setChildCuts(femto_dream_v0_selection::kPosTrack, confChildCharge, femtoDreamTrackSelection::kSign, femtoDreamSelection::kEqual); + v0Cuts.setChildCuts(femto_dream_v0_selection::kPosTrack, confChildEtaMax, femtoDreamTrackSelection::kEtaMax, femtoDreamSelection::kAbsUpperLimit); + v0Cuts.setChildCuts(femto_dream_v0_selection::kPosTrack, confChildTPCnClsMin, femtoDreamTrackSelection::kTPCnClsMin, femtoDreamSelection::kLowerLimit); + v0Cuts.setChildCuts(femto_dream_v0_selection::kPosTrack, confChildDCAMin, femtoDreamTrackSelection::kDCAMin, femtoDreamSelection::kAbsLowerLimit); + v0Cuts.setChildCuts(femto_dream_v0_selection::kPosTrack, confChildPIDnSigmaMax, femtoDreamTrackSelection::kPIDnSigmaMax, femtoDreamSelection::kAbsUpperLimit); + + v0Cuts.setChildCuts(femto_dream_v0_selection::kNegTrack, confChildCharge, femtoDreamTrackSelection::kSign, femtoDreamSelection::kEqual); + v0Cuts.setChildCuts(femto_dream_v0_selection::kNegTrack, confChildEtaMax, femtoDreamTrackSelection::kEtaMax, femtoDreamSelection::kAbsUpperLimit); + v0Cuts.setChildCuts(femto_dream_v0_selection::kNegTrack, confChildTPCnClsMin, femtoDreamTrackSelection::kTPCnClsMin, femtoDreamSelection::kLowerLimit); + v0Cuts.setChildCuts(femto_dream_v0_selection::kNegTrack, confChildDCAMin, femtoDreamTrackSelection::kDCAMin, femtoDreamSelection::kAbsLowerLimit); + v0Cuts.setChildCuts(femto_dream_v0_selection::kNegTrack, confChildPIDnSigmaMax, femtoDreamTrackSelection::kPIDnSigmaMax, femtoDreamSelection::kAbsUpperLimit); + v0Cuts.setChildPIDSpecies(femto_dream_v0_selection::kPosTrack, confChildPIDspecies); + v0Cuts.setChildPIDSpecies(femto_dream_v0_selection::kNegTrack, confChildPIDspecies); + v0Cuts.init(&qaRegistry, &v0Registry); + v0Cuts.setInvMassLimits(confV0InvMassLowLimit, confV0InvMassUpLimit); + v0Cuts.setIsMother(confV0MotherIsLambda); + + v0Cuts.setChildRejectNotPropagatedTracks(femto_dream_v0_selection::kPosTrack, confTrkRejectNotPropagated); + v0Cuts.setChildRejectNotPropagatedTracks(femto_dream_v0_selection::kNegTrack, confTrkRejectNotPropagated); + + v0Cuts.setnSigmaPIDOffsetTPC(Track.confTrkPIDnSigmaOffsetTPC); + v0Cuts.setChildnSigmaPIDOffset(femto_dream_v0_selection::kPosTrack, Track.confTrkPIDnSigmaOffsetTPC, Track.confTrkPIDnSigmaOffsetTOF); + v0Cuts.setChildnSigmaPIDOffset(femto_dream_v0_selection::kNegTrack, Track.confTrkPIDnSigmaOffsetTPC, Track.confTrkPIDnSigmaOffsetTOF); + + if (confV0RejectKaons) { + v0Cuts.setKaonInvMassLimits(confV0InvKaonMassLowLimit, confV0InvKaonMassUpLimit); + } + v0Cuts.setRejectLambda(confV0RejectLambdas); + } + + if (confIsActivateReso.value) { + resoCuts.setDaughterCuts(femto_dream_reso_selection::kPosdaugh, Resonance.confDaughterCharge, femtoDreamTrackSelection::kSign, femtoDreamSelection::kEqual); + resoCuts.setDaughterCuts(femto_dream_reso_selection::kPosdaugh, Resonance.confDaughterPtMin, femtoDreamTrackSelection::kpTMin, femtoDreamSelection::kLowerLimit); + resoCuts.setDaughterCuts(femto_dream_reso_selection::kPosdaugh, Resonance.confDaughterPtMax, femtoDreamTrackSelection::kpTMax, femtoDreamSelection::kUpperLimit); + resoCuts.setDaughterCuts(femto_dream_reso_selection::kPosdaugh, Resonance.confDaughterEtaMax, femtoDreamTrackSelection::kEtaMax, femtoDreamSelection::kAbsUpperLimit); + resoCuts.setDaughterCuts(femto_dream_reso_selection::kPosdaugh, Resonance.confDaughterTPCnClsMin, femtoDreamTrackSelection::kTPCnClsMin, femtoDreamSelection::kLowerLimit); + resoCuts.setDaughterCuts(femto_dream_reso_selection::kPosdaugh, Resonance.confDaughterTPCfClsMin, femtoDreamTrackSelection::kTPCfClsMin, femtoDreamSelection::kLowerLimit); + resoCuts.setDaughterCuts(femto_dream_reso_selection::kPosdaugh, Resonance.confDaughterTPCcRowsMin, femtoDreamTrackSelection::kTPCcRowsMin, femtoDreamSelection::kLowerLimit); + resoCuts.setDaughterCuts(femto_dream_reso_selection::kPosdaugh, Resonance.confDaughterDCAxyMax, femtoDreamTrackSelection::kDCAxyMax, femtoDreamSelection::kAbsUpperLimit); + resoCuts.setDaughterCuts(femto_dream_reso_selection::kPosdaugh, Resonance.confDaughterDCAzMax, femtoDreamTrackSelection::kDCAzMax, femtoDreamSelection::kAbsUpperLimit); + resoCuts.setDaughterCuts(femto_dream_reso_selection::kPosdaugh, Resonance.confDaughterPIDnSigmaMax, femtoDreamTrackSelection::kPIDnSigmaMax, femtoDreamSelection::kAbsUpperLimit); + + resoCuts.setDaughterCuts(femto_dream_reso_selection::kNegdaugh, Resonance.confDaughterCharge, femtoDreamTrackSelection::kSign, femtoDreamSelection::kEqual); + resoCuts.setDaughterCuts(femto_dream_reso_selection::kNegdaugh, Resonance.confDaughterPtMin, femtoDreamTrackSelection::kpTMin, femtoDreamSelection::kLowerLimit); + resoCuts.setDaughterCuts(femto_dream_reso_selection::kNegdaugh, Resonance.confDaughterPtMax, femtoDreamTrackSelection::kpTMax, femtoDreamSelection::kUpperLimit); + resoCuts.setDaughterCuts(femto_dream_reso_selection::kNegdaugh, Resonance.confDaughterEtaMax, femtoDreamTrackSelection::kEtaMax, femtoDreamSelection::kAbsUpperLimit); + resoCuts.setDaughterCuts(femto_dream_reso_selection::kNegdaugh, Resonance.confDaughterTPCnClsMin, femtoDreamTrackSelection::kTPCnClsMin, femtoDreamSelection::kLowerLimit); + resoCuts.setDaughterCuts(femto_dream_reso_selection::kNegdaugh, Resonance.confDaughterTPCfClsMin, femtoDreamTrackSelection::kTPCfClsMin, femtoDreamSelection::kLowerLimit); + resoCuts.setDaughterCuts(femto_dream_reso_selection::kNegdaugh, Resonance.confDaughterTPCcRowsMin, femtoDreamTrackSelection::kTPCcRowsMin, femtoDreamSelection::kLowerLimit); + resoCuts.setDaughterCuts(femto_dream_reso_selection::kNegdaugh, Resonance.confDaughterDCAxyMax, femtoDreamTrackSelection::kDCAxyMax, femtoDreamSelection::kAbsUpperLimit); + resoCuts.setDaughterCuts(femto_dream_reso_selection::kNegdaugh, Resonance.confDaughterDCAzMax, femtoDreamTrackSelection::kDCAzMax, femtoDreamSelection::kAbsUpperLimit); + resoCuts.setDaughterCuts(femto_dream_reso_selection::kNegdaugh, Resonance.confDaughterPIDnSigmaMax, femtoDreamTrackSelection::kPIDnSigmaMax, femtoDreamSelection::kAbsUpperLimit); + + resoCuts.init(&qaRegistry, &v0Registry); + + resoCuts.assign(Resonance.confDaughterPTPCThr); // assigns Configurable value to class member + resoCuts.setDaughterPIDSpecies(femto_dream_reso_selection::kPosdaugh, Resonance.confDaughterPIDspecies); + resoCuts.setDaughterPIDSpecies(femto_dream_reso_selection::kNegdaugh, Resonance.confDaughterPIDspecies); + resoCuts.setDaughternSigmaPIDOffset(femto_dream_reso_selection::kPosdaugh, 0.f, 0.f); + resoCuts.setDaughternSigmaPIDOffset(femto_dream_reso_selection::kNegdaugh, 0.f, 0.f); + + resoCuts.setSelection(Resonance.confResoSign, femto_dream_reso_selection::kResoSign, femtoDreamSelection::kEqual); + + // resoCuts.init<>(); + } + + mRunNumber = 0; + mMagField = 0.0; + /// Initializing CCDB + ccdb->setURL("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + + int64_t now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); + ccdb->setCreatedNotAfter(now); + } + + /// Function to retrieve the nominal magnetic field in kG (0.1T) and convert it directly to T + void initCcdbMagTrig(aod::BCsWithTimestamps::iterator bc) + { + // TODO done only once (and not per run). Will be replaced by CCDBConfigurable + // get magnetic field for run + if (mRunNumber == bc.runNumber()) + return; + auto timestamp = bc.timestamp(); + float output = -999; + + if (confIsRun3 && !confIsForceGRP) { + static o2::parameters::GRPMagField* grpo = nullptr; + grpo = ccdb->getForTimeStamp("GLO/Config/GRPMagField", timestamp); + if (grpo == nullptr) { + LOGF(fatal, "GRP object not found for timestamp %llu", timestamp); + return; + } + LOGF(info, "Retrieved GRP for timestamp %llu with L3 ", timestamp, grpo->getL3Current()); + // taken from GRP onject definition of getnominalL3Field; update later to something smarter (mnominalL3Field = std::lround(5.f * mL3Current / 30000.f);) + auto nominalL3Field = std::lround(5.f * grpo->getL3Current() / 30000.f); + output = 0.1 * (nominalL3Field); + + } else { + + static o2::parameters::GRPObject* grpo = nullptr; + grpo = ccdb->getForTimeStamp("GLO/GRP/GRP", timestamp); + if (grpo == nullptr) { + LOGF(fatal, "GRP object not found for timestamp %llu", timestamp); + return; + } + LOGF(info, "Retrieved GRP for timestamp %llu with magnetic field of %d kG", timestamp, grpo->getNominalL3Field()); + output = 0.1 * (grpo->getNominalL3Field()); + } + mMagField = output; + mRunNumber = bc.runNumber(); + + // Init for zorro to get trigger flags + if (confEnableTriggerSelection) { + zorro.setCCDBpath(confBaseCCDBPathForTriggers); + zorro.initCCDB(ccdb.service, mRunNumber, timestamp, zorroTriggerNames); + } + } + + template + void fillDebugParticle(ParticleType const& particle) + { + if constexpr (isTrackOrV0) { + if constexpr (hasItsPid) { + outputDebugParts(particle.sign(), + (uint8_t)particle.tpcNClsFound(), + particle.tpcNClsFindable(), + (uint8_t)particle.tpcNClsCrossedRows(), + particle.tpcNClsShared(), + particle.tpcInnerParam(), + particle.itsNCls(), + particle.itsNClsInnerBarrel(), + particle.dcaXY(), + particle.dcaZ(), + particle.tpcSignal(), + particle.tpcNSigmaEl(), + particle.tpcNSigmaPi(), + particle.tpcNSigmaKa(), + particle.tpcNSigmaPr(), + particle.tpcNSigmaDe(), + particle.tpcNSigmaTr(), + particle.tpcNSigmaHe(), + particle.tofNSigmaEl(), + particle.tofNSigmaPi(), + particle.tofNSigmaKa(), + particle.tofNSigmaPr(), + particle.tofNSigmaDe(), + particle.tofNSigmaTr(), + particle.tofNSigmaHe(), + o2::analysis::femtoDream::itsSignal(particle), + particle.itsNSigmaEl(), + particle.itsNSigmaPi(), + particle.itsNSigmaKa(), + particle.itsNSigmaPr(), + particle.itsNSigmaDe(), + particle.itsNSigmaTr(), + particle.itsNSigmaHe(), + -999., -999., -999., -999., -999., -999., + -999., -999., -999., -999., -999., -999., -999.); + } else { + outputDebugParts(particle.sign(), + (uint8_t)particle.tpcNClsFound(), + particle.tpcNClsFindable(), + (uint8_t)particle.tpcNClsCrossedRows(), + particle.tpcNClsShared(), + particle.tpcInnerParam(), + particle.itsNCls(), + particle.itsNClsInnerBarrel(), + particle.dcaXY(), + particle.dcaZ(), + particle.tpcSignal(), + particle.tpcNSigmaEl(), + particle.tpcNSigmaPi(), + particle.tpcNSigmaKa(), + particle.tpcNSigmaPr(), + particle.tpcNSigmaDe(), + particle.tpcNSigmaTr(), + particle.tpcNSigmaHe(), + particle.tofNSigmaEl(), + particle.tofNSigmaPi(), + particle.tofNSigmaKa(), + particle.tofNSigmaPr(), + particle.tofNSigmaDe(), + particle.tofNSigmaTr(), + particle.tofNSigmaHe(), + -999., -999., -999., -999., -999., -999., -999., -999., + -999., -999., -999., -999., -999., -999., + -999., -999., -999., -999., -999., -999., -999.); + } + } else if constexpr (isReso) { + outputDebugParts(-999., -999., -999., -999., -999., -999., -999., -999., -999., -999., // for the moment + -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., + -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., + -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., + -999., -999., -999., -999., -999., -999.); + } else { + outputDebugParts(-999., // sign + -999., -999., -999., -999., -999., -999., -999., -999., -999., // track properties (DCA, NCls, crossed rows, etc.) + -999., -999., -999., -999., -999., -999., -999., -999., // TPC PID (TPC signal + particle hypothesis) + -999., -999., -999., -999., -999., -999., -999., // TOF PID + -999., -999., -999., -999., -999., -999., -999., -999., // ITS PID + particle.dcaV0daughters(), + particle.v0radius(), + particle.x(), + particle.y(), + particle.z(), + particle.mK0Short(), + -999., -999., -999., -999., -999., -999., -999.); // Cascade properties + } + } + + template + void fillMCParticle(CollisionType const& col, ParticleType const& particle, o2::aod::femtodreamparticle::ParticleType fdparttype) + { + if (particle.has_mcParticle()) { + + constexpr int kProcessDirectMother = 4; + constexpr int kProcessInelasticHadronic = 23; + constexpr int kGenStatusTransport = -1; + + // get corresponding MC particle and its info + auto particleMC = particle.mcParticle(); + auto pdgCode = particleMC.pdgCode(); + trackRegistry.fill(HIST("AnalysisQA/Particle"), pdgCode); + int particleOrigin = 99; + int pdgCodeMother = -1; + // get list of mothers, but it could be empty (for example in case of injected light nuclei) + auto motherparticlesMC = particleMC.template mothers_as(); + // check pdg code + trackRegistry.fill(HIST("AnalysisQA/getGenStatusCode"), particleMC.getGenStatusCode()); + trackRegistry.fill(HIST("AnalysisQA/getProcess"), particleMC.getProcess()); + // if this fails, the particle is a fake + if (std::abs(pdgCode) == std::abs(confTrkPDGCode.value)) { + // check first if particle is from pile up + // check if the collision associated with the particle is the same as the analyzed collision by checking their Ids + if ((col.has_mcCollision() && (particleMC.mcCollisionId() != col.mcCollisionId())) || !col.has_mcCollision()) { + particleOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kWrongCollision; + // check if particle is primary + } else if (particleMC.isPhysicalPrimary()) { + particleOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kPrimary; + // check if particle is secondary + // particle is from a decay -> getProcess() == 4 + // particle is generated during transport -> getGenStatusCode() == -1 + // list of mothers is not empty + } else if (particleMC.getProcess() == kProcessDirectMother && particleMC.getGenStatusCode() == kGenStatusTransport && !motherparticlesMC.empty()) { + // get direct mother + auto motherparticleMC = motherparticlesMC.front(); + pdgCodeMother = motherparticleMC.pdgCode(); + trackRegistry.fill(HIST("AnalysisQA/Mother"), pdgCodeMother); + particleOrigin = checkDaughterType(fdparttype, motherparticleMC.pdgCode()); + // check if particle is material + // particle is from inelastic hadronic interaction -> getProcess() == 23 + // particle is generated during transport -> getGenStatusCode() == -1 + } else if (particleMC.getProcess() == kProcessInelasticHadronic && particleMC.getGenStatusCode() == kGenStatusTransport) { + particleOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kMaterial; + // cross check to see if we missed a case + } else { + particleOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kElse; + } + // if pdg code is wrong, particle is fake + } else { + particleOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kFake; + } + + outputPartsMC(particleOrigin, pdgCode, particleMC.pt(), particleMC.eta(), particleMC.phi()); + outputPartsMCLabels(outputPartsMC.lastIndex()); + if (confIsDebug) { + outputPartsExtMCLabels(outputPartsMC.lastIndex()); + outputDebugPartsMC(pdgCodeMother); + } + } else { + outputPartsMCLabels(-1); + if (confIsDebug) { + outputPartsExtMCLabels(-1); + } + } + } + + template + void fillMCCollision(CollisionType const& col) + { + if (col.has_mcCollision()) { + auto genMCcol = col.template mcCollision_as(); + outputMCCollision(genMCcol.multMCNParticlesEta08()); + outputCollsMCLabels(outputMCCollision.lastIndex()); + } else { + outputCollsMCLabels(-1); + } + } + template + void fillCollisionsAndTracksAndV0(CollisionType const& col, TrackType const& tracks, TrackTypeWithItsPid const& tracksWithItsPid, V0Type const& fullV0s) + { + // If triggering is enabled, select only events which were triggered wit our triggers + if (confEnableTriggerSelection) { + bool zorroSelected = zorro.isSelected(col.template bc_as().globalBC()); /// check if event was selected by triggers of interest + if (!zorroSelected) { + return; + } + } + + const auto vtxZ = col.posZ(); + const auto spher = colCuts.computeSphericity(col, tracks); + float mult = 0; + int multNtr = 0; + if (confIsRun3) { + if constexpr (useCentrality) { + if constexpr (analysePbPb) { + mult = col.centFT0C(); + } else { + mult = col.centFT0M(); + } + } else { + mult = 0; + } + multNtr = col.multNTracksPV(); + } else { + mult = 1; // multiplicity percentile is know in Run 2 + multNtr = col.multTracklets(); + } + + colCuts.fillQA(col, mult); + + // check whether the basic event selection criteria are fulfilled + // that included checking if there is at least on usable track or V0 + if (!colCuts.isSelectedCollision(col)) { + return; + } + + if (confIsActivateV0.value) { + if (colCuts.isEmptyCollision(col, tracks, trackCuts) && colCuts.isEmptyCollision(col, fullV0s, v0Cuts, tracks)) { + return; + } + } else { + if (colCuts.isEmptyCollision(col, tracks, trackCuts)) { + return; + } + } + + if (rctCut.requireRCTFlagChecker && !rctChecker(col)) { + return; + } + + outputCollision(vtxZ, mult, multNtr, spher, mMagField); + if constexpr (isMC) { + fillMCCollision(col); + } + + std::vector childIDs = {0, 0}; // these IDs are necessary to keep track of the children + std::vector tmpIDtrack; // this vector keeps track of the matching of the primary track table row <-> aod::track table global index + + for (const auto& track : tracksWithItsPid) { + + /// if the most open selection criteria are not fulfilled there is no + /// point looking further at the track + trackCuts.fillQA(track); + + if (track.tpcChi2NCl() < OptionTrackSpecialSelections.confTrkMinChi2PerClusterTPC || track.tpcChi2NCl() > OptionTrackSpecialSelections.confTrkMaxChi2PerClusterTPC) { + continue; + } + if (track.itsChi2NCl() > OptionTrackSpecialSelections.confTrkMaxChi2PerClusterITS) { + continue; + } + if ((OptionTrackSpecialSelections.confTrkTPCRefit && !track.hasTPC()) || (OptionTrackSpecialSelections.confTrkITSRefit && !track.hasITS())) { + continue; + } + + if (!trackCuts.isSelectedMinimal(track)) { + continue; + } + + trackRegistry.fill(HIST("AnalysisQA/Chi2ITSTPCperCluster"), track.itsChi2NCl(), track.tpcChi2NCl()); + trackRegistry.fill(HIST("AnalysisQA/RefitITSTPC"), track.hasITS(), track.hasTPC()); + + trackCuts.fillQA(track); + // the bit-wise container of the systematic variations is obtained + std::array cutContainer; + cutContainer = trackCuts.getCutContainer(track, track.pt(), track.eta(), sqrtf(powf(track.dcaXY(), 2.f) + powf(track.dcaZ(), 2.f))); + + // now the table is filled + outputParts(outputCollision.lastIndex(), + track.pt(), + track.eta(), + track.phi(), + aod::femtodreamparticle::ParticleType::kTrack, + cutContainer.at(femtoDreamTrackSelection::TrackContainerPosition::kCuts), + cutContainer.at(femtoDreamTrackSelection::TrackContainerPosition::kPID), + track.dcaXY(), childIDs, 0, 0); + tmpIDtrack.push_back(track.globalIndex()); + if (confIsDebug.value) { + fillDebugParticle(track); + } + + if constexpr (isMC) { + fillMCParticle(col, track, o2::aod::femtodreamparticle::ParticleType::kTrack); + } + } + + if (confIsActivateV0.value) { + for (const auto& v0 : fullV0s) { + + auto postrack = v0.template posTrack_as(); + auto negtrack = v0.template negTrack_as(); + ///\tocheck funnily enough if we apply the filter the + /// sign of Pos and Neg track is always negative + // const auto dcaXYpos = postrack.dcaXY(); + // const auto dcaZpos = postrack.dcaZ(); + // const auto dcapos = std::sqrt(pow(dcaXYpos, 2.) + pow(dcaZpos, 2.)); + v0Cuts.fillLambdaQA(col, v0, postrack, negtrack); + + if (!v0Cuts.isSelectedMinimal(col, v0, postrack, negtrack)) { + continue; + } + + // if (confRejectITSHitandTOFMissing) { + // Uncomment only when TOF timing is solved + // bool itsHit = o2PhysicsTrackSelection->IsSelected(postrack, + // TrackSelection::TrackCuts::kITSHits); bool itsHit = + // o2PhysicsTrackSelection->IsSelected(negtrack, + // TrackSelection::TrackCuts::kITSHits); + // } + + v0Cuts.fillQA(col, v0, postrack, negtrack); ///\todo fill QA also for daughters + auto cutContainerV0 = v0Cuts.getCutContainer(col, v0, postrack, negtrack); + + int postrackID = v0.posTrackId(); + int rowInPrimaryTrackTablePos = -1; + rowInPrimaryTrackTablePos = getRowDaughters(postrackID, tmpIDtrack); + childIDs[0] = rowInPrimaryTrackTablePos; + childIDs[1] = 0; + outputParts(outputCollision.lastIndex(), + v0.positivept(), v0.positiveeta(), v0.positivephi(), + aod::femtodreamparticle::ParticleType::kV0Child, + cutContainerV0.at(femto_dream_v0_selection::V0ContainerPosition::kPosCuts), + cutContainerV0.at(femto_dream_v0_selection::V0ContainerPosition::kPosPID), + postrack.dcaXY(), + childIDs, + 0, + 0); + const int rowOfPosTrack = outputParts.lastIndex(); + if constexpr (isMC) { + fillMCParticle(col, postrack, o2::aod::femtodreamparticle::ParticleType::kV0Child); + } + int negtrackID = v0.negTrackId(); + int rowInPrimaryTrackTableNeg = -1; + rowInPrimaryTrackTableNeg = getRowDaughters(negtrackID, tmpIDtrack); + childIDs[0] = 0; + childIDs[1] = rowInPrimaryTrackTableNeg; + outputParts(outputCollision.lastIndex(), + v0.negativept(), + v0.negativeeta(), + v0.negativephi(), + aod::femtodreamparticle::ParticleType::kV0Child, + cutContainerV0.at(femto_dream_v0_selection::V0ContainerPosition::kNegCuts), + cutContainerV0.at(femto_dream_v0_selection::V0ContainerPosition::kNegPID), + negtrack.dcaXY(), + childIDs, + 0, + 0); + const int rowOfNegTrack = outputParts.lastIndex(); + if constexpr (isMC) { + fillMCParticle(col, negtrack, o2::aod::femtodreamparticle::ParticleType::kV0Child); + } + std::vector indexChildID = {rowOfPosTrack, rowOfNegTrack}; + float fillMass = 0.; + float fillMassAnti = 0.; + if (confV0MotherIsLambda) { + fillMass = v0.mLambda(); + fillMassAnti = v0.mAntiLambda(); + } else { + fillMass = v0.mK0Short(); + fillMassAnti = fillMass; + } + outputParts(outputCollision.lastIndex(), + v0.pt(), + v0.eta(), + v0.phi(), + aod::femtodreamparticle::ParticleType::kV0, + cutContainerV0.at(femto_dream_v0_selection::V0ContainerPosition::kV0), + 0, + v0.v0cosPA(), + indexChildID, + fillMass, + fillMassAnti); + if (confIsDebug.value) { + fillDebugParticle(postrack); // QA for positive daughter + fillDebugParticle(negtrack); // QA for negative daughter + fillDebugParticle(v0); // QA for v0 + } + if constexpr (isMC) { + fillMCParticle(col, v0, o2::aod::femtodreamparticle::ParticleType::kV0); + } + } + } + + if (confIsActivatePhi.value) { + + resoCuts.updateThreshold(); + + auto slicePosdaugh = daughter1.sliceByCached(aod::track::collisionId, col.globalIndex(), cache); // o2::framework defined in AnalysisHelper.h + auto sliceNegdaugh = daughter2.sliceByCached(aod::track::collisionId, col.globalIndex(), cache); + + for (const auto& track1 : slicePosdaugh) { + if (!resoCuts.daughterSelectionPos(track1) || !resoCuts.isSelectedMinimalPIDPos(track1, Resonance.confDaughterPIDspecies.value[0])) { + continue; + } + + for (const auto& track2 : sliceNegdaugh) { + if (!resoCuts.daughterSelectionNeg(track2) || !resoCuts.isSelectedMinimalPIDNeg(track2, Resonance.confDaughterPIDspecies.value[1])) { + continue; /// loosest cuts for track2 + } + + bool resoIsNotAnti = true; /// bool for differentianting between particle/antiparticle + float resoSign = 1.; + if ((Resonance.confDaughterPIDspecies->size() > 1) && (Resonance.confDaughterPIDspecies.value[0] != Resonance.confDaughterPIDspecies.value[1])) { + auto [isNormal, WrongCombination] = resoCuts.checkCombination(track1, track2, static_cast(Resonance.confResoMotherID.value)); + if (WrongCombination) { + continue; + } + if (!isNormal) { + resoSign = -1.; + } + resoIsNotAnti = isNormal; + } + /// Resos, where both daughters have the same PID are defaulted to sign 1. and resoIsNotAnti = true + + resoRegistry.fill(HIST("AnalysisQA/Reso/Daughter1/Pt"), track1.pt()); + resoRegistry.fill(HIST("AnalysisQA/Reso/Daughter2/Pt"), track2.pt()); + resoRegistry.fill(HIST("AnalysisQA/Reso/Daughter1/Eta"), track1.eta()); + resoRegistry.fill(HIST("AnalysisQA/Reso/Daughter2/Eta"), track2.eta()); + resoRegistry.fill(HIST("AnalysisQA/Reso/Daughter1/DcaXY"), track1.dcaXY()); + resoRegistry.fill(HIST("AnalysisQA/Reso/Daughter2/DcaXY"), track2.dcaXY()); + resoRegistry.fill(HIST("AnalysisQA/Reso/Daughter1/DcaZ"), track1.dcaZ()); + resoRegistry.fill(HIST("AnalysisQA/Reso/Daughter2/DcaZ"), track2.dcaZ()); + resoRegistry.fill(HIST("AnalysisQA/Reso/Daughter1/Phi"), track1.phi()); + resoRegistry.fill(HIST("AnalysisQA/Reso/Daughter2/Phi"), track2.phi()); + + /// Get masses for calculating invariant Mass + /// This only works for the case where the mass of opposite charged particles are the same (for example K+/K- have same mass) + auto [MassPart1, MassPart2] = resoCuts.getMassDaughters(static_cast(Resonance.confResoMotherID.value)); + + /// Resonance + ROOT::Math::PtEtaPhiMVector tempD1(track1.pt(), track1.eta(), track1.phi(), MassPart1); + ROOT::Math::PtEtaPhiMVector tempD2(track2.pt(), track2.eta(), track2.phi(), MassPart2); + ROOT::Math::PtEtaPhiMVector tempReso = tempD1 + tempD2; + /// Anti-resonance + ROOT::Math::PtEtaPhiMVector tempDA1(track1.pt(), track1.eta(), track1.phi(), MassPart2); + ROOT::Math::PtEtaPhiMVector tempDA2(track2.pt(), track2.eta(), track2.phi(), MassPart1); + ROOT::Math::PtEtaPhiMVector tempAntiReso = tempDA1 + tempDA2; + + if (resoIsNotAnti) { + resoRegistry.fill(HIST("AnalysisQA/Reso/InvMass"), tempReso.M()); + if (!(tempReso.M() > Resonance.confResoInvMassLowLimit.value && tempReso.M() < Resonance.confResoInvMassUpLimit.value)) + continue; /// MassCut + resoRegistry.fill(HIST("AnalysisQA/Reso/InvMass_phi_selected"), tempReso.M()); + } else { + resoRegistry.fill(HIST("AnalysisQA/Reso/InvMassAnti"), tempAntiReso.M()); + if (!(tempAntiReso.M() > Resonance.confResoInvMassLowLimit.value && tempAntiReso.M() < Resonance.confResoInvMassUpLimit.value)) + continue; /// MassCut + resoRegistry.fill(HIST("AnalysisQA/Reso/InvMassAnti_phi_selected"), tempAntiReso.M()); + } + + resoCuts.fillQA(track1, track2); + + resoRegistry.fill(HIST("AnalysisQA/Reso/Pt_posdaughter_selected"), track1.pt()); + resoRegistry.fill(HIST("AnalysisQA/Reso/Pt_negdaughter_selected"), track2.pt()); + resoRegistry.fill(HIST("AnalysisQA/Reso/Eta_posdaughter_selected"), track1.eta()); + resoRegistry.fill(HIST("AnalysisQA/Reso/Eta_negdaughter_selected"), track2.eta()); + resoRegistry.fill(HIST("AnalysisQA/Reso/DCAxy_posdaughter_selected"), track1.dcaXY()); + resoRegistry.fill(HIST("AnalysisQA/Reso/DCAxy_negdaughter_selected"), track2.dcaXY()); + resoRegistry.fill(HIST("AnalysisQA/Reso/DCAz_posdaughter_selected"), track1.dcaZ()); + resoRegistry.fill(HIST("AnalysisQA/Reso/DCAz_negdaughter_selected"), track2.dcaZ()); + resoRegistry.fill(HIST("AnalysisQA/Reso/Phi_posdaughter_selected"), track1.phi()); + resoRegistry.fill(HIST("AnalysisQA/Reso/Phi_negdaughter_selected"), track2.phi()); + + auto type = resoCuts.getType(track1, track2); // kResoPosdaughTPC_NegdaughTPC + // kResoPosdaughTPC_NegdaughTOF + // kResoPosdaughTPC_NegdaughTPC + // kResoPosdaughTOF_NegdaughTOF as possible output + + auto bitmask = resoCuts.getCutContainer(track1, track2, resoSign); + + /// Get Variables for Output + auto outputReso = tempReso; + auto outputDaugh1 = tempD1; + auto outputDaugh2 = tempD2; + if (!resoIsNotAnti) { + outputReso = tempAntiReso; + outputDaugh1 = tempDA1; + outputDaugh2 = tempDA2; + } + + // fill FDParticles + int postrkId = track1.globalIndex(); + int rowOfPosTrack = -1; + rowOfPosTrack = getRowDaughters(postrkId, tmpIDtrack); + + childIDs[0] = rowOfPosTrack; // should give me the row + childIDs[1] = 0; + outputParts(outputCollision.lastIndex(), + track1.pt(), + track1.eta(), + track1.phi(), + aod::femtodreamparticle::ParticleType::kResoChild, + bitmask[1], + bitmask[2], + track1.dcaXY(), + childIDs, + outputDaugh1.M(), + outputDaugh2.M()); // fill tempFitVar with dcaXY? + const int rowPosTrk = outputParts.lastIndex(); + + int negtrkId = track2.globalIndex(); + int rowOfNegTrack = -1; + rowOfNegTrack = getRowDaughters(negtrkId, tmpIDtrack); + + childIDs[0] = 0; + childIDs[1] = rowOfNegTrack; + outputParts(outputCollision.lastIndex(), + track2.pt(), + track2.eta(), + track2.phi(), + aod::femtodreamparticle::ParticleType::kResoChild, + bitmask[3], + bitmask[4], + track2.dcaXY(), + childIDs, + outputDaugh2.M(), + outputDaugh1.M()); // maybe CPA instead of dcaXY()? as tempFitVar? + const int rowNegTrk = outputParts.lastIndex(); + + // Reso + std::vector indexChildIds = {rowPosTrk, rowNegTrk}; + outputParts(outputCollision.lastIndex(), + outputReso.pt(), + outputReso.eta(), + outputReso.phi(), + type, + bitmask[0], // PIDBit of neg_daugh merged with sign cutBit + bitmask[2], // PIDBit of pos_daugh + -999.f, + indexChildIds, + tempReso.M(), + tempAntiReso.M()); // no TempFitVar !! + // needed? + if (confIsDebug.value) { + fillDebugParticle(track1); // QA for positive daughter + fillDebugParticle(track2); // QA for negative daughter + fillDebugParticle(outputReso); + } + } + } + } + } + + void + processData(aod::FemtoFullCollision const& col, + aod::BCsWithTimestamps const&, + aod::FemtoFullTracks const& tracks, + o2::aod::V0Datas const& fullV0s) + { + // get magnetic field for run + initCcdbMagTrig(col.bc_as()); + // fill the tables + auto tracksWithItsPid = soa::Attach(tracks); + + if (confUseItsPid.value) { + fillCollisionsAndTracksAndV0(col, tracks, tracksWithItsPid, fullV0s); + } else { + fillCollisionsAndTracksAndV0(col, tracks, tracks, fullV0s); + } + } + PROCESS_SWITCH(FemtoDreamProducerTaskReso, processData, + "Provide experimental data", true); + + void + processData_noCentrality(aod::FemtoFullCollisionNoCent const& col, + aod::BCsWithTimestamps const&, + aod::FemtoFullTracks const& tracks, + o2::aod::V0Datas const& fullV0s) + { + // get magnetic field for run + initCcdbMagTrig(col.bc_as()); + // fill the tables + auto tracksWithItsPid = soa::Attach(tracks); + + if (confUseItsPid.value) { + fillCollisionsAndTracksAndV0(col, tracks, tracksWithItsPid, fullV0s); + } else { + fillCollisionsAndTracksAndV0(col, tracks, tracks, fullV0s); + } + } + PROCESS_SWITCH(FemtoDreamProducerTaskReso, processData_noCentrality, + "Provide experimental data without centrality information", false); + + void processData_CentPbPb(aod::FemtoFullCollisionCentPbPb const& col, // o2-linter: disable=name/function-variable (UpperCamelCase defined soa::JOIN) + aod::BCsWithTimestamps const&, + aod::FemtoFullTracks const& tracks, + o2::aod::V0Datas const& fullV0s) + { + // get magnetic field for run + initCcdbMagTrig(col.bc_as()); + // fill the tables + auto tracksWithItsPid = soa::Attach(tracks); + + if (confUseItsPid.value) { + fillCollisionsAndTracksAndV0(col, tracks, tracksWithItsPid, fullV0s); + } else { + fillCollisionsAndTracksAndV0(col, tracks, tracks, fullV0s); + } + } + PROCESS_SWITCH(FemtoDreamProducerTaskReso, processData_CentPbPb, + "Provide experimental data with centrality information for PbPb collisions", false); + + void processMC(aod::FemtoFullCollisionMC const& col, + aod::BCsWithTimestamps const&, + soa::Join const& tracks, + aod::FemtoFullMCgenCollisions const&, + aod::McParticles const&, + soa::Join const& fullV0s) /// \todo with FilteredFullV0s + { + // get magnetic field for run + initCcdbMagTrig(col.bc_as()); + // fill the tables + fillCollisionsAndTracksAndV0(col, tracks, tracks, fullV0s); + } + PROCESS_SWITCH(FemtoDreamProducerTaskReso, processMC, "Provide MC data", false); + + void processMC_noCentrality(aod::FemtoFullCollisionNoCentMC const& col, // o2-linter: disable=name/function-variable (UpperCamelCase defined soa::JOIN) + aod::BCsWithTimestamps const&, + soa::Join const& tracks, + aod::FemtoFullMCgenCollisions const&, + aod::McParticles const&, + soa::Join const& fullV0s) /// \todo with FilteredFullV0s + { + // get magnetic field for run + initCcdbMagTrig(col.bc_as()); + // fill the tables + fillCollisionsAndTracksAndV0(col, tracks, tracks, fullV0s); + } + PROCESS_SWITCH(FemtoDreamProducerTaskReso, processMC_noCentrality, "Provide MC data without requiring a centrality calibration", false); + + void processMC_CentPbPb(aod::FemtoFullCollisionMCCentPbPb const& col, // o2-linter: disable=name/function-variable (UpperCamelCase defined soa::JOIN) + aod::BCsWithTimestamps const&, + soa::Join const& tracks, + aod::FemtoFullMCgenCollisions const&, + aod::McParticles const&, + soa::Join const& fullV0s) /// \todo with FilteredFullV0s + { + // get magnetic field for run + initCcdbMagTrig(col.bc_as()); + // fill the tables + fillCollisionsAndTracksAndV0(col, tracks, tracks, fullV0s); + } + PROCESS_SWITCH(FemtoDreamProducerTaskReso, processMC_CentPbPb, "Provide MC data with centrality information for PbPb collisions", false); +}; +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{adaptAnalysisTask(cfgc)}; + return workflow; +} From 6fe602b83e258b3350fe5895c7e3d8a1889f5840 Mon Sep 17 00:00:00 2001 From: sarjeetagami <162087855+sarjeetagami@users.noreply.github.com> Date: Fri, 19 Sep 2025 15:43:46 +0530 Subject: [PATCH 455/986] [PWGLF] optimized phi analysis task (#13040) Co-authored-by: sarjeeta gami --- .../Tasks/Resonances/phianalysisrun3_PbPb.cxx | 309 ++++++++++++------ 1 file changed, 201 insertions(+), 108 deletions(-) diff --git a/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx b/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx index 8afb4e0ab5a..0b5a8ffc4f4 100644 --- a/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx +++ b/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx @@ -8,13 +8,9 @@ // 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. -// Preliminary QA analysis task for resonances -// (1) For Run3 -// (2) Event and track selection need to be optimized -// (3) particle = 0 --> phi -// (4) particle = 1 --> kstar -// (5) particle = 2 --> lambdastar -// (6) 4 process function (a) Data same event (b) Data mixed event (c) MC generated (d) MC reconstructed +/// \file phianalysisrun3_PbPb.cxx +/// \brief Code for phi resonance without resonance initializer +/// \author Sarjeeta Gami #include "PWGLF/DataModel/EPCalibrationTables.h" @@ -89,6 +85,7 @@ struct phianalysisrun3_PbPb { Configurable cfgNoMixedEvents{"cfgNoMixedEvents", 5, "Number of mixed events per event"}; Configurable fillOccupancy{"fillOccupancy", true, "fill Occupancy"}; Configurable isNoTOF{"isNoTOF", false, "isNoTOF"}; + Configurable pid{"pid", 0, "pid"}; Configurable additionalEvSel1{"additionalEvSel1", true, "Additional evsel1"}; Configurable additionalEvSel2{"additionalEvSel2", true, "Additional evsel2"}; Configurable additionalEvSel3{"additionalEvSel3", true, "Additional evsel3"}; @@ -96,6 +93,8 @@ struct phianalysisrun3_PbPb { Configurable additionalEvSel5{"additionalEvSel5", true, "Additional evsel5"}; Configurable additionalEvSel6{"additionalEvSel6", true, "Additional evsel6"}; Configurable cfgMultFT0{"cfgMultFT0", true, "cfgMultFT0"}; + Configurable cfgCutTOFBeta{"cfgCutTOFBeta", 0.0, "cut TOF beta"}; + Configurable useGlobalTrack{"useGlobalTrack", false, "use Global track"}; Configurable iscustomDCAcut{"iscustomDCAcut", false, "iscustomDCAcut"}; Configurable ismanualDCAcut{"ismanualDCAcut", true, "ismanualDCAcut"}; Configurable ispTdepPID{"ispTdepPID", true, "pT dependent PID"}; @@ -108,13 +107,16 @@ struct phianalysisrun3_PbPb { Configurable cfgDeepAngle{"cfgDeepAngle", 0.04, "Deep Angle cut value"}; Configurable nBkgRotations{"nBkgRotations", 3, "Number of rotated copies (background) per each original candidate"}; Configurable fillRotation{"fillRotation", true, "fill rotation"}; - Configurable confMinRot{"confMinRot", 5.0f * TMath::Pi() / 6.0f, "Minimum of rotation"}; - Configurable confMaxRot{"confMaxRot", 7.0f * TMath::Pi() / 6.0f, "Maximum of rotation"}; + Configurable cfgTPCcluster{"cfgTPCcluster", 70, "Number of TPC cluster"}; + Configurable cfgTPCSharedcluster{"cfgTPCSharedcluster", 0.4, "Maximum Number of TPC shared cluster"}; + Configurable confMinRot{"confMinRot", 5.0f * 3.14159265f / 6.0f, "Minimum of rotation"}; + Configurable confMaxRot{"confMaxRot", 7.0f * 3.14159265f / 6.0f, "Maximum of rotation"}; Configurable pdgcheck{"pdgcheck", true, "pdgcheck"}; Configurable reco{"reco", true, "reco"}; - ConfigurableAxis ptAxiphi{"ptAxisphi", {200, 0.0f, 30.0f}, "phi pT axis"}; - ConfigurableAxis centAxiphi{"centAxisphi", {200, 0.0, 200.0}, "phi pT axis"}; - ConfigurableAxis massAxiphi{"massAxisphi", {200, 0.9, 1.1}, "phi pT axis"}; + ConfigurableAxis ptAxisphi{"ptAxisphi", {200, 0.0f, 20.0f}, "phi pT axis"}; + ConfigurableAxis centAxisphi{"centAxisphi", {200, 0.0, 200.0}, "phi centrality axis"}; + ConfigurableAxis massAxisphi{"massAxisphi", {200, 0.9, 1.1}, "phi mass axis"}; + ConfigurableAxis binsImpactPar{"binsImpactPar", {VARIABLE_WIDTH, 0, 3.5, 5.67, 7.45, 8.85, 10.0, 11.21, 12.26, 13.28, 14.23, 15.27}, "Binning of the impact parameter axis"}; ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 10.0, 12.0}, "Binning of the pT axis"}; ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"}; @@ -132,17 +134,17 @@ struct phianalysisrun3_PbPb { AxisSpec ptAxis = {binsPt, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec centAxis = {binsCent, "V0M (%)"}; if (!isMC) { - histos.add("hCentrality", "Centrality distribution", kTH1F, {centAxiphi}); + histos.add("hCentrality", "Centrality distribution", kTH1F, {centAxisphi}); histos.add("hVtxZ", "Vertex distribution in Z;Z (cm)", kTH1F, {{400, -20.0, 20.0}}); histos.add("hOccupancy", "Occupancy distribution", kTH1F, {{500, 0, 50000}}); histos.add("hEvtSelInfo", "hEvtSelInfo", kTH1F, {{10, 0, 10.0}}); - histos.add("h3PhiInvMassUnlikeSign", "Invariant mass of Phi meson Unlike Sign", kTH3F, {centAxiphi, ptAxiphi, massAxiphi}); - histos.add("h3PhiInvMassMixed", "Invariant mass of Phi meson Mixed", kTH3F, {centAxiphi, ptAxiphi, massAxiphi}); - histos.add("h3PhiInvMassRot", "Invariant mass of Phi meson Rotation", kTH3F, {centAxiphi, ptAxiphi, massAxiphi}); - histos.add("h3PhiInvMassSame", "Invariant mass of Phi meson same", kTH3F, {centAxiphi, ptAxiphi, massAxiphi}); - histos.add("h2PhiRapidity", "phi meson Rapidity", kTH2F, {ptAxiphi, {200, -4, 4}}); - histos.add("hEta", "eta of kaon track candidates", HistType::kTH2F, {{200, -1.0f, 1.0f}, ptAxiphi}); - histos.add("hPhi", "phi of kaon track candidates", HistType::kTH2F, {{65, 0, 6.5}, ptAxiphi}); + histos.add("h3PhiInvMassUnlikeSign", "Invariant mass of Phi meson Unlike Sign", kTH3F, {centAxisphi, ptAxisphi, massAxisphi}); + histos.add("h3PhiInvMassMixed", "Invariant mass of Phi meson Mixed", kTH3F, {centAxisphi, ptAxisphi, massAxisphi}); + histos.add("h3PhiInvMassRot", "Invariant mass of Phi meson Rotation", kTH3F, {centAxisphi, ptAxisphi, massAxisphi}); + histos.add("h3PhiInvMassSame", "Invariant mass of Phi meson same", kTH3F, {centAxisphi, ptAxisphi, massAxisphi}); + histos.add("h2PhiRapidity", "phi meson Rapidity", kTH2F, {ptAxisphi, {200, -4, 4}}); + histos.add("hEta", "eta of kaon track candidates", HistType::kTH2F, {{200, -1.0f, 1.0f}, ptAxisphi}); + histos.add("hPhi", "phi of kaon track candidates", HistType::kTH2F, {{65, 0, 6.5}, ptAxisphi}); // DCA QA // DCA histograms: separate for positive and negative kaons, range [-1.0, 1.0] @@ -151,39 +153,39 @@ struct phianalysisrun3_PbPb { histos.add("QAbefore/trkDCAz_pos", "DCAz distribution of positive kaon track candidates", HistType::kTH1F, {{150, -1.0f, 1.0f}}); histos.add("QAbefore/trkDCAz_neg", "DCAz distribution of negative kaon track candidates", HistType::kTH1F, {{150, -1.0f, 1.0f}}); - histos.add("QAbefore/trkDCAxypt_pos", "DCAxy distribution of positive kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, ptAxiphi}); - histos.add("QAbefore/trkDCAxypt_neg", "DCAxy distribution of negative kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, ptAxiphi}); - histos.add("QAbefore/trkDCAzpt_pos", "DCAz distribution of positive kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, ptAxiphi}); - histos.add("QAbefore/trkDCAzpt_neg", "DCAz distribution of negative kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, ptAxiphi}); + histos.add("QAbefore/trkDCAxypt_pos", "DCAxy distribution of positive kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, ptAxisphi}); + histos.add("QAbefore/trkDCAxypt_neg", "DCAxy distribution of negative kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, ptAxisphi}); + histos.add("QAbefore/trkDCAzpt_pos", "DCAz distribution of positive kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, ptAxisphi}); + histos.add("QAbefore/trkDCAzpt_neg", "DCAz distribution of negative kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, ptAxisphi}); histos.add("QAafter/trkDCAxy_pos", "DCAxy distribution of positive kaon track candidates", HistType::kTH1F, {{150, -1.0f, 1.0f}}); histos.add("QAafter/trkDCAxy_neg", "DCAxy distribution of negative kaon track candidates", HistType::kTH1F, {{150, -1.0f, 1.0f}}); histos.add("QAafter/trkDCAz_pos", "DCAz distribution of positive kaon track candidates", HistType::kTH1F, {{150, -1.0f, 1.0f}}); histos.add("QAafter/trkDCAz_neg", "DCAz distribution of negative kaon track candidates", HistType::kTH1F, {{150, -1.0f, 1.0f}}); - histos.add("QAafter/trkDCAxypt_pos", "DCAxy distribution of positive kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, ptAxiphi}); - histos.add("QAafter/trkDCAxypt_neg", "DCAxy distribution of negative kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, ptAxiphi}); - histos.add("QAafter/trkDCAzpt_pos", "DCAz distribution of positive kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, ptAxiphi}); - histos.add("QAafter/trkDCAzpt_neg", "DCAz distribution of negative kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, ptAxiphi}); + histos.add("QAafter/trkDCAxypt_pos", "DCAxy distribution of positive kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, ptAxisphi}); + histos.add("QAafter/trkDCAxypt_neg", "DCAxy distribution of negative kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, ptAxisphi}); + histos.add("QAafter/trkDCAzpt_pos", "DCAz distribution of positive kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, ptAxisphi}); + histos.add("QAafter/trkDCAzpt_neg", "DCAz distribution of negative kaon track candidates", HistType::kTH2F, {{150, -1.0f, 1.0f}, ptAxisphi}); // PID QA before cuts histos.add("QAbefore/TOF_TPC_Mapka_all_pos", "TOF + TPC Combined PID for positive Kaon;#sigma_{TOF}^{K^{+}};#sigma_{TPC}^{K^{+}}", {HistType::kTH2D, {{100, -6, 6}, {100, -6, 6}}}); histos.add("QAbefore/TOF_TPC_Mapka_all_neg", "TOF + TPC Combined PID for negative Kaon;#sigma_{TOF}^{K^{-}};#sigma_{TPC}^{K^{-}}", {HistType::kTH2D, {{100, -6, 6}, {100, -6, 6}}}); - histos.add("QAbefore/TOF_Nsigma_all_pos", "TOF NSigma for positive Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{K^{+}}", {HistType::kTH3D, {{200, -12, 12}, centAxiphi, ptAxiphi}}); - histos.add("QAbefore/TOF_Nsigma_all_neg", "TOF NSigma for negative Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{K^{-}}", {HistType::kTH3D, {{200, -12, 12}, centAxiphi, ptAxiphi}}); + histos.add("QAbefore/TOF_Nsigma_all_pos", "TOF NSigma for positive Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{K^{+}}", {HistType::kTH3D, {{200, -12, 12}, centAxisphi, ptAxisphi}}); + histos.add("QAbefore/TOF_Nsigma_all_neg", "TOF NSigma for negative Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{K^{-}}", {HistType::kTH3D, {{200, -12, 12}, centAxisphi, ptAxisphi}}); - histos.add("QAbefore/TPC_Nsigma_all_pos", "TPC NSigma for positive Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{K^{+}}", {HistType::kTH3D, {{200, -12, 12}, centAxiphi, ptAxiphi}}); - histos.add("QAbefore/TPC_Nsigma_all_neg", "TPC NSigma for negative Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{K^{-}}", {HistType::kTH3D, {{200, -12, 12}, centAxiphi, ptAxiphi}}); + histos.add("QAbefore/TPC_Nsigma_all_pos", "TPC NSigma for positive Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{K^{+}}", {HistType::kTH3D, {{200, -12, 12}, centAxisphi, ptAxisphi}}); + histos.add("QAbefore/TPC_Nsigma_all_neg", "TPC NSigma for negative Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{K^{-}}", {HistType::kTH3D, {{200, -12, 12}, centAxisphi, ptAxisphi}}); // PID QA after cuts histos.add("QAafter/TOF_TPC_Mapka_all_pos", "TOF + TPC Combined PID for positive Kaon;#sigma_{TOF}^{K^{+}};#sigma_{TPC}^{K^{+}}", {HistType::kTH2D, {{100, -6, 6}, {100, -6, 6}}}); histos.add("QAafter/TOF_TPC_Mapka_all_neg", "TOF + TPC Combined PID for negative Kaon;#sigma_{TOF}^{K^{-}};#sigma_{TPC}^{K^{-}}", {HistType::kTH2D, {{100, -6, 6}, {100, -6, 6}}}); - histos.add("QAafter/TOF_Nsigma_all_pos", "TOF NSigma for positive Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{K^{+}}", {HistType::kTH3D, {{200, -12, 12}, centAxiphi, ptAxiphi}}); - histos.add("QAafter/TOF_Nsigma_all_neg", "TOF NSigma for negative Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{K^{-}}", {HistType::kTH3D, {{200, -12, 12}, centAxiphi, ptAxiphi}}); + histos.add("QAafter/TOF_Nsigma_all_pos", "TOF NSigma for positive Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{K^{+}}", {HistType::kTH3D, {{200, -12, 12}, centAxisphi, ptAxisphi}}); + histos.add("QAafter/TOF_Nsigma_all_neg", "TOF NSigma for negative Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{K^{-}}", {HistType::kTH3D, {{200, -12, 12}, centAxisphi, ptAxisphi}}); - histos.add("QAafter/TPC_Nsigma_all_pos", "TPC NSigma for positive Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{K^{+}}", {HistType::kTH3D, {{200, -12, 12}, centAxiphi, ptAxiphi}}); - histos.add("QAafter/TPC_Nsigma_all_neg", "TPC NSigma for negative Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{K^{-}}", {HistType::kTH3D, {{200, -12, 12}, centAxiphi, ptAxiphi}}); + histos.add("QAafter/TPC_Nsigma_all_pos", "TPC NSigma for positive Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{K^{+}}", {HistType::kTH3D, {{200, -12, 12}, centAxisphi, ptAxisphi}}); + histos.add("QAafter/TPC_Nsigma_all_neg", "TPC NSigma for negative Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{K^{-}}", {HistType::kTH3D, {{200, -12, 12}, centAxisphi, ptAxisphi}}); } else if (isMC) { histos.add("hMC", "MC Event statistics", kTH1F, {{15, 0.0f, 15.0f}}); histos.add("EL1", "MC Event statistics", kTH1F, {impactParAxis}); @@ -192,52 +194,54 @@ struct phianalysisrun3_PbPb { histos.add("ES3", "MC Event statistics", kTH1F, {impactParAxis}); histos.add("ES2", "MC Event statistics", kTH1F, {centAxis}); histos.add("ES4", "MC Event statistics", kTH1F, {centAxis}); - histos.add("h1PhiGen", "Phi meson Gen", kTH1F, {ptAxiphi}); - histos.add("h1PhiGen1", "Phi meson Gen", kTH1F, {ptAxiphi}); - histos.add("h1PhiRecsplit", "Phi meson Rec split", kTH1F, {ptAxiphi}); - histos.add("Centrec", "MC Centrality", kTH1F, {centAxiphi}); - histos.add("Centgen", "MC Centrality", kTH1F, {centAxiphi}); + histos.add("h1PhiGen", "Phi meson Gen", kTH1F, {ptAxisphi}); + histos.add("h1PhiGen1", "Phi meson Gen", kTH1F, {ptAxisphi}); + histos.add("h1PhiRecsplit", "Phi meson Rec split", kTH1F, {ptAxisphi}); + histos.add("Centrec", "MC Centrality", kTH1F, {centAxisphi}); + histos.add("Centgen", "MC Centrality", kTH1F, {centAxisphi}); histos.add("hVtxZgen", "Vertex distribution in Z;Z (cm)", kTH1F, {{400, -20.0, 20.0}}); histos.add("hVtxZrec", "Vertex distribution in Z;Z (cm)", kTH1F, {{400, -20.0, 20.0}}); - histos.add("h2PhiRec2", "Phi meson Rec", kTH2F, {ptAxiphi, centAxiphi}); - histos.add("h3PhiRec3", "Phi meson Rec", kTH3F, {ptAxiphi, centAxiphi, massAxiphi}); - histos.add("h3Phi1Rec3", "Phi meson Rec", kTH3F, {ptAxiphi, centAxiphi, massAxiphi}); - histos.add("h3PhiGen3", "Phi meson Gen", kTH3F, {ptAxiphi, centAxiphi, massAxiphi}); - histos.add("h3PhiInvMassMixedMC", "Invariant mass of Phi meson Mixed", kTH3F, {centAxiphi, ptAxiphi, massAxiphi}); - histos.add("h3PhiInvMassSameMC", "Invariant mass of Phi meson same", kTH3F, {centAxiphi, ptAxiphi, massAxiphi}); - histos.add("h3PhiInvMassRotMC", "Invariant mass of Phi meson Rotation", kTH3F, {centAxiphi, ptAxiphi, massAxiphi}); - histos.add("h2PhiGen2", "Phi meson gen", kTH2F, {ptAxiphi, centAxiphi}); + histos.add("h2PhiRec2", "Phi meson Rec", kTH2F, {ptAxisphi, centAxisphi}); + histos.add("h3PhiRec3", "Phi meson Rec", kTH3F, {ptAxisphi, centAxisphi, massAxisphi}); + histos.add("h3Phi1Rec3", "Phi meson Rec", kTH3F, {ptAxisphi, centAxisphi, massAxisphi}); + histos.add("h3PhiGen3", "Phi meson Gen", kTH3F, {ptAxisphi, centAxisphi, massAxisphi}); + histos.add("h3PhiInvMassMixedMC", "Invariant mass of Phi meson Mixed", kTH3F, {centAxisphi, ptAxisphi, massAxisphi}); + histos.add("h3PhiInvMassSameMC", "Invariant mass of Phi meson same", kTH3F, {centAxisphi, ptAxisphi, massAxisphi}); + histos.add("h3PhiInvMassSameMC1", "Invariant mass of Phi meson same", kTH3F, {centAxisphi, ptAxisphi, massAxisphi}); + histos.add("h3PhiInvMassRotMC", "Invariant mass of Phi meson Rotation", kTH3F, {centAxisphi, ptAxisphi, massAxisphi}); + histos.add("h2PhiGen2", "Phi meson gen", kTH2F, {ptAxisphi, centAxisphi}); histos.add("h2PhiGen1", "Phi meson gen", kTH2F, {ptAxis, impactParAxis}); - histos.add("h1PhiRec1", "Phi meson Rec", kTH1F, {ptAxiphi}); - histos.add("h1Phimassgen", "Phi meson gen", kTH1F, {massAxiphi}); - histos.add("h1Phimassrec", "Phi meson Rec", kTH1F, {massAxiphi}); - histos.add("h1Phimasssame", "Phi meson Rec", kTH1F, {massAxiphi}); - histos.add("h1Phimassmix", "Phi meson Rec", kTH1F, {massAxiphi}); - histos.add("h1Phimassrot", "Phi meson Rec", kTH1F, {massAxiphi}); - histos.add("h1Phi1massrec", "Phi meson Rec", kTH1F, {massAxiphi}); - histos.add("h1Phipt", "Phi meson Rec", kTH1F, {ptAxiphi}); + histos.add("h1PhiRec1", "Phi meson Rec", kTH1F, {ptAxisphi}); + histos.add("h1Phimassgen", "Phi meson gen", kTH1F, {massAxisphi}); + histos.add("h1Phimassrec", "Phi meson Rec", kTH1F, {massAxisphi}); + histos.add("h1Phimasssame", "Phi meson Rec", kTH1F, {massAxisphi}); + histos.add("h1Phimassmix", "Phi meson Rec", kTH1F, {massAxisphi}); + histos.add("h1Phimassrot", "Phi meson Rec", kTH1F, {massAxisphi}); + histos.add("h1Phi1massrec", "Phi meson Rec", kTH1F, {massAxisphi}); + histos.add("h1Phipt", "Phi meson Rec", kTH1F, {ptAxisphi}); histos.add("hOccupancy1", "Occupancy distribution", kTH1F, {{500, 0, 50000}}); - histos.add("h1PhifinalRec", "Phi meson Rec", kTH1F, {ptAxiphi}); - histos.add("h1Phifinalgenmass", "Phi meson gen mass", kTH1F, {massAxiphi}); - histos.add("h3PhifinalRec", "Phi meson Rec", kTH3F, {ptAxiphi, centAxiphi, massAxiphi}); - histos.add("h1PhifinalGen", "Phi meson Gen", kTH1F, {ptAxiphi}); - histos.add("h2PhifinalGen", "Phi meson Gen", kTH2F, {ptAxiphi, centAxiphi}); + histos.add("h1PhifinalRec", "Phi meson Rec", kTH1F, {ptAxisphi}); + histos.add("h1Phifinalgenmass", "Phi meson gen mass", kTH1F, {massAxisphi}); + histos.add("h3PhifinalRec", "Phi meson Rec", kTH3F, {ptAxisphi, centAxisphi, massAxisphi}); + histos.add("h1PhifinalGen", "Phi meson Gen", kTH1F, {ptAxisphi}); + histos.add("h2PhifinalGen", "Phi meson Gen", kTH2F, {ptAxisphi, centAxisphi}); histos.add("hMC1", "MC Event statistics", kTH1F, {{15, 0.0f, 15.0f}}); - histos.add("Centrec1", "MC Centrality", kTH1F, {centAxiphi}); - histos.add("Centsame", "MC Centrality", kTH1F, {centAxiphi}); - histos.add("Centmix", "MC Centrality", kTH1F, {centAxiphi}); - histos.add("Centgen1", "MC Centrality", kTH1F, {centAxiphi}); - histos.add("h1PhiRecsplit1", "Phi meson Rec split", kTH1F, {ptAxiphi}); + histos.add("Centrec1", "MC Centrality", kTH1F, {centAxisphi}); + histos.add("Centsame", "MC Centrality", kTH1F, {centAxisphi}); + histos.add("Centmc", "MC Centrality", kTH1F, {centAxisphi}); + histos.add("Centmix", "MC Centrality", kTH1F, {centAxisphi}); + histos.add("Centgen1", "MC Centrality", kTH1F, {centAxisphi}); + histos.add("h1PhiRecsplit1", "Phi meson Rec split", kTH1F, {ptAxisphi}); histos.add("hImpactParameterGen", "Impact parameter of generated MC events", kTH1F, {impactParAxis}); histos.add("hImpactParameterRec", "Impact parameter of generated MC events", kTH1F, {impactParAxis}); histos.add("hImpactParameterGenCen", "Impact parameter of generated MC events", kTH2F, {impactParAxis, centAxis}); histos.add("hImpactParameterRecCen", "Impact parameter of generated MC events", kTH2F, {impactParAxis, centAxis}); - histos.add("TOF_Nsigma_MC", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, centAxiphi, ptAxiphi}}); - histos.add("TPC_Nsigma_MC", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, centAxiphi, ptAxiphi}}); - histos.add("TOF_Nsigma1_MC", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, centAxiphi, ptAxiphi}}); - histos.add("TPC_Nsigma1_MC", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, centAxiphi, ptAxiphi}}); - histos.add("trkDCAxy", "DCAxy distribution of positive kaon track candidates", HistType::kTH3F, {{150, -1.0f, 1.0f}, centAxiphi, ptAxiphi}); - histos.add("trkDCAz", "DCAxy distribution of negative kaon track candidates", HistType::kTH3F, {{150, -1.0f, 1.0f}, centAxiphi, ptAxiphi}); + histos.add("TOF_Nsigma_MC", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, centAxisphi, ptAxisphi}}); + histos.add("TPC_Nsigma_MC", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, centAxisphi, ptAxisphi}}); + histos.add("TOF_Nsigma1_MC", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, centAxisphi, ptAxisphi}}); + histos.add("TPC_Nsigma1_MC", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, centAxisphi, ptAxisphi}}); + histos.add("trkDCAxy", "DCAxy distribution of positive kaon track candidates", HistType::kTH3F, {{150, -1.0f, 1.0f}, centAxisphi, ptAxisphi}); + histos.add("trkDCAz", "DCAxy distribution of negative kaon track candidates", HistType::kTH3F, {{150, -1.0f, 1.0f}, centAxisphi, ptAxisphi}); if (doprocessEvtLossSigLossMC) { histos.add("QAevent/hImpactParameterGen", "Impact parameter of generated MC events", kTH1F, {impactParAxis}); histos.add("QAevent/hImpactParameterRec", "Impact parameter of selected MC events", kTH1F, {impactParAxis}); @@ -267,6 +271,9 @@ struct phianalysisrun3_PbPb { if (ismanualDCAcut && !(candidate.isGlobalTrackWoDCA() && candidate.isPVContributor() && std::abs(candidate.dcaXY()) < cfgCutDCAxy && std::abs(candidate.dcaZ()) < cfgCutDCAz && candidate.itsNCls() > cfgITScluster)) { return false; } + if (useGlobalTrack && !(candidate.isGlobalTrack() && candidate.isPVContributor() && candidate.itsNCls() > cfgITScluster && candidate.tpcNClsCrossedRows() > cfgTPCcluster && candidate.tpcFractionSharedCls() < cfgTPCSharedcluster)) { + return false; + } return true; } @@ -285,16 +292,35 @@ struct phianalysisrun3_PbPb { return false; } template - bool selectionPIDpTdependent(const T& candidate) + bool selectionPIDpTdependent(const T& candidate, int pid) { - if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < nsigmacutTPC) { - return true; - } - if (candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < nsigmacutTPC && std::abs(candidate.tofNSigmaKa()) < nsigmacutTOF) { - return true; + if (pid == 0) { + if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < nsigmacutTPC) { + return true; + } + if (candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < nsigmacutTPC && + std::abs(candidate.tofNSigmaKa()) < nsigmacutTOF) { + return true; + } + return false; + + } else if (pid == 1) { + constexpr double kPtThresholdForTOF = 0.5; + if (candidate.pt() < kPtThresholdForTOF && std::abs(candidate.tpcNSigmaKa()) < nsigmacutTPC) { + return true; + } + if (candidate.pt() >= kPtThresholdForTOF && candidate.hasTOF() && candidate.beta() > cfgCutTOFBeta && + std::abs(candidate.tpcNSigmaKa()) < nsigmacutTPC && std::abs(candidate.tofNSigmaKa()) < nsigmacutTOF) { + return true; + } + if (!useGlobalTrack && !candidate.hasTPC()) { + return true; + } + return false; } return false; } + template bool myEventSelections(const CollType& collision) { @@ -382,17 +408,17 @@ struct phianalysisrun3_PbPb { Filter dcacutFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz); using EventCandidates = soa::Filtered>; - using TrackCandidates = soa::Filtered>; + using TrackCandidates = soa::Filtered>; // using EventCandidatesMC = soa::Join; using EventCandidatesMC = soa::Join; using TrackCandidatesMC = soa::Filtered>; + aod::McTrackLabels, aod::pidTOFbeta>>; using CollisionMCTrueTable = aod::McCollisions; using TrackMCTrueTable = aod::McParticles; using CollisionMCRecTableCentFT0C = soa::SmallGroups>; - using TrackMCRecTable = soa::Join; + using TrackMCRecTable = soa::Join; using FilTrackMCRecTable = soa::Filtered; ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for bin"}; @@ -530,7 +556,9 @@ struct phianalysisrun3_PbPb { fillinvMass(track1, track2, multiplicity, unlike, mix, massKa, massKa); } - if (ispTdepPID && selectionPIDpTdependent(track1) && selectionPIDpTdependent(track2)) { + if (ispTdepPID && + (selectionPIDpTdependent(track1, 0) || selectionPIDpTdependent(track1, 1)) && + (selectionPIDpTdependent(track2, 0) || selectionPIDpTdependent(track2, 1))) { int track1Sign = track1.sign(); // Same assumption as above if (track1Sign > 0) { // Positive kaon @@ -618,7 +646,9 @@ struct phianalysisrun3_PbPb { if (!ispTdepPID && selectionPID(t1) && selectionPID(t2)) { fillinvMass(t1, t2, multiplicity, unlike, mix, massKa, massKa); } - if (ispTdepPID && selectionPIDpTdependent(t1) && selectionPIDpTdependent(t2)) { + if (ispTdepPID && + (selectionPIDpTdependent(t1, 0) || selectionPIDpTdependent(t1, 1)) && + (selectionPIDpTdependent(t2, 0) || selectionPIDpTdependent(t2, 1))) { fillinvMass(t1, t2, multiplicity, unlike, mix, massKa, massKa); } } @@ -685,7 +715,9 @@ struct phianalysisrun3_PbPb { if (!ispTdepPID && selectionPID(t1) && selectionPID(t2)) { fillinvMass(t1, t2, multiplicity, unlike, mix, massKa, massKa); } - if (ispTdepPID && selectionPIDpTdependent(t1) && selectionPIDpTdependent(t2)) { + if (ispTdepPID && + (selectionPIDpTdependent(t1, 0) || selectionPIDpTdependent(t1, 1)) && + (selectionPIDpTdependent(t2, 0) || selectionPIDpTdependent(t2, 1))) { fillinvMass(t1, t2, multiplicity, unlike, mix, massKa, massKa); } } @@ -753,7 +785,9 @@ struct phianalysisrun3_PbPb { if (!ispTdepPID && selectionPID(t1) && selectionPID(t2)) { fillinvMass(t1, t2, multiplicity, unlike, mix, massKa, massKa); } - if (ispTdepPID && selectionPIDpTdependent(t1) && selectionPIDpTdependent(t2)) { + if (ispTdepPID && + (selectionPIDpTdependent(t1, 0) || selectionPIDpTdependent(t1, 1)) && + (selectionPIDpTdependent(t2, 0) || selectionPIDpTdependent(t2, 1))) { fillinvMass(t1, t2, multiplicity, unlike, mix, massKa, massKa); } } @@ -821,7 +855,9 @@ struct phianalysisrun3_PbPb { if (!ispTdepPID && selectionPID(t1) && selectionPID(t2)) { fillinvMass(t1, t2, multiplicity, unlike, mix, massKa, massKa); } - if (ispTdepPID && selectionPIDpTdependent(t1) && selectionPIDpTdependent(t2)) { + if (ispTdepPID && + (selectionPIDpTdependent(t1, 0) || selectionPIDpTdependent(t1, 1)) && + (selectionPIDpTdependent(t2, 0) || selectionPIDpTdependent(t2, 1))) { fillinvMass(t1, t2, multiplicity, unlike, mix, massKa, massKa); } } @@ -876,9 +912,12 @@ struct phianalysisrun3_PbPb { if (!ispTdepPID && (!selectionPID(track1) || !selectionPID(track2))) { continue; } - if (ispTdepPID && (!selectionPIDpTdependent(track1) || !selectionPIDpTdependent(track2))) { + if (ispTdepPID && + (selectionPIDpTdependent(track1, 0) || selectionPIDpTdependent(track1, 1)) && + (selectionPIDpTdependent(track2, 0) || selectionPIDpTdependent(track2, 1))) { continue; } + if (track1.sign() * track2.sign() < 0) { kaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); kaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); @@ -923,7 +962,7 @@ struct phianalysisrun3_PbPb { histos.fill(HIST("hMC"), 2); return; } - for (auto& RecCollision : RecCollisions) { + for (const auto& RecCollision : RecCollisions) { histos.fill(HIST("hMC"), 3); if (!RecCollision.sel8() || std::abs(RecCollision.posZ()) > cfgCutVertex) { continue; @@ -972,27 +1011,26 @@ struct phianalysisrun3_PbPb { } else if (centestimator == kCentFV0A) { centrality = RecCollision.centFV0A(); } - + histos.fill(HIST("Centmc"), centrality); auto oldindex = -999; auto rectrackspart = RecTracks.sliceBy(perCollision, RecCollision.globalIndex()); // loop over reconstructed particle - int ntrack1 = 0; - for (auto& track1 : rectrackspart) { + for (const auto& track1 : rectrackspart) { if (!selectionTrack(track1)) { continue; } if (!ispTdepPID && !selectionPID(track1)) { continue; } - if (ispTdepPID && !selectionPIDpTdependent(track1)) { + if (ispTdepPID && !(selectionPIDpTdependent(track1, 0) || selectionPIDpTdependent(track1, 1))) { + continue; } if (!track1.has_mcParticle()) { continue; } auto track1ID = track1.index(); - ntrack1 = ntrack1 + 1; - for (auto& track2 : rectrackspart) { + for (const auto& track2 : rectrackspart) { auto track2ID = track2.index(); if (track2ID <= track1ID) { continue; @@ -1003,7 +1041,8 @@ struct phianalysisrun3_PbPb { if (!ispTdepPID && !selectionPID(track2)) { continue; } - if (ispTdepPID && !selectionPIDpTdependent(track2)) { + if (ispTdepPID && !(selectionPIDpTdependent(track2, 0) || selectionPIDpTdependent(track2, 1))) { + continue; } if (!track2.has_mcParticle()) { @@ -1017,14 +1056,23 @@ struct phianalysisrun3_PbPb { } const auto mctrack1 = track1.mcParticle(); const auto mctrack2 = track2.mcParticle(); - int track1PDG = std::abs(mctrack1.pdgCode()); - int track2PDG = std::abs(mctrack2.pdgCode()); if (!mctrack1.isPhysicalPrimary()) { continue; } if (!mctrack2.isPhysicalPrimary()) { continue; } + if (track1.sign() * track2.sign() < 0) { + kaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); + kaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); + } + phiMesonMother = kaonPlus + kaonMinus; + if (std::abs(phiMesonMother.Rapidity()) > confRapidity) { + continue; + } + histos.fill(HIST("h3PhiInvMassSameMC1"), centrality, phiMesonMother.pt(), phiMesonMother.M()); + int track1PDG = std::abs(mctrack1.pdgCode()); + int track2PDG = std::abs(mctrack2.pdgCode()); if (!(track1PDG == PDG_t::kKPlus && track2PDG == PDG_t::kKPlus)) { continue; } @@ -1287,7 +1335,10 @@ struct phianalysisrun3_PbPb { if (!ispTdepPID && (!selectionPID(track1) || !selectionPID(track2))) { continue; } - if (ispTdepPID && (!selectionPIDpTdependent(track1) || !selectionPIDpTdependent(track2))) { + if (ispTdepPID && + (selectionPIDpTdependent(track1, 0) || selectionPIDpTdependent(track1, 1)) && + (selectionPIDpTdependent(track2, 0) || selectionPIDpTdependent(track2, 1))) { + continue; } @@ -1352,22 +1403,47 @@ struct phianalysisrun3_PbPb { if (!selectionTrack(track1)) { continue; } - auto track1ID = track1.globalIndex(); + if (!ispTdepPID && !selectionPID(track1)) { + continue; + } + if (ispTdepPID && !(selectionPIDpTdependent(track1, 0) || selectionPIDpTdependent(track1, 1))) { + + continue; + } + if (!track1.has_mcParticle()) { + continue; + } + auto track1ID = track1.index(); for (const auto& track2 : tracks) { + auto track2ID = track2.index(); + if (track2ID <= track1ID) { + continue; + } if (!selectionTrack(track2)) { continue; } - auto track2ID = track2.globalIndex(); - if (track2ID <= track1ID) { + if (!ispTdepPID && !selectionPID(track2)) { + continue; + } + if (ispTdepPID && !(selectionPIDpTdependent(track2, 0) || selectionPIDpTdependent(track2, 1))) { + + continue; + } + if (!track2.has_mcParticle()) { continue; } if (!selectionPair(track1, track2)) { continue; } - if (!ispTdepPID && (!selectionPID(track1) || !selectionPID(track2))) { + if (track1.sign() * track2.sign() > 0) { continue; } - if (ispTdepPID && (!selectionPIDpTdependent(track1) || !selectionPIDpTdependent(track2))) { + const auto mctrack1 = track1.mcParticle(); + const auto mctrack2 = track2.mcParticle(); + if (!mctrack1.isPhysicalPrimary()) { + continue; + } + if (!mctrack2.isPhysicalPrimary()) { continue; } if (track1.sign() * track2.sign() < 0) { @@ -1448,7 +1524,6 @@ struct phianalysisrun3_PbPb { auto multiplicity = c1.centFT0C(); histos.fill(HIST("Centmix"), multiplicity); for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - histos.fill(HIST("hMC"), 6.5); if (!selectionTrack(t1)) { continue; } @@ -1461,7 +1536,19 @@ struct phianalysisrun3_PbPb { if (!ispTdepPID && (!selectionPID(t1) || !selectionPID(t2))) { continue; } - if (ispTdepPID && (!selectionPIDpTdependent(t1) || !selectionPIDpTdependent(t2))) { + if (ispTdepPID && + (selectionPIDpTdependent(t1, 0) || selectionPIDpTdependent(t1, 1)) && + (selectionPIDpTdependent(t2, 0) || selectionPIDpTdependent(t2, 1))) { + + continue; + } + if (!t1.has_mcParticle() || !t2.has_mcParticle()) { + continue; + } + const auto mctrack1 = t1.mcParticle(); + const auto mctrack2 = t2.mcParticle(); + + if (!mctrack1.isPhysicalPrimary() || !mctrack2.isPhysicalPrimary()) { continue; } if (t1.sign() * t2.sign() < 0) { @@ -1687,7 +1774,13 @@ struct phianalysisrun3_PbPb { if (std::abs(mothertrack1.pdgCode()) != o2::constants::physics::kPhi) { continue; } - if (!(selectionPID(track1) && selectionPID(track2))) { + if (!ispTdepPID && (!selectionPID(track1) || !selectionPID(track2))) { + continue; + } + if (ispTdepPID && + (selectionPIDpTdependent(track1, 0) || selectionPIDpTdependent(track1, 1)) && + (selectionPIDpTdependent(track2, 0) || selectionPIDpTdependent(track2, 1))) { + continue; } histos.fill(HIST("TPC_Nsigma1_MC"), track1.tpcNSigmaKa(), multiplicity, track1.pt()); @@ -1706,7 +1799,7 @@ struct phianalysisrun3_PbPb { auto motherP = mothertrack1.p(); auto motherE = mothertrack1.e(); genMass = std::sqrt(motherE * motherE - motherP * motherP); - recMass = RecoDecay::m(arrMomrec, array{massKa, massKa}); + recMass = RecoDecay::m(arrMomrec, std::array{massKa, massKa}); histos.fill(HIST("h1PhifinalRec"), mothertrack1.pt()); histos.fill(HIST("h3PhifinalRec"), mothertrack1.pt(), multiplicity, recMass); From 1016b753f1631726c344b32ef52f3eee41221380 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 19 Sep 2025 13:32:11 +0200 Subject: [PATCH 456/986] [Infrastructure] Bump actions/stale from 9 to 10 (#12895) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index d96f541d14a..06a7786e58b 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -13,7 +13,7 @@ jobs: stale: runs-on: ubuntu-latest steps: - - uses: actions/stale@v9 + - uses: actions/stale@v10 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-pr-message: 'This PR has not been updated in the last 30 days. Is it still needed? Unless further action is taken, it will be closed in 5 days.' From ef81b8cebd82cd499a03a0235acfea18eddfd248 Mon Sep 17 00:00:00 2001 From: Jesper Karlsson Gumprecht <113693781+jesgum@users.noreply.github.com> Date: Fri, 19 Sep 2025 16:03:13 +0200 Subject: [PATCH 457/986] [ALICE3] Update a3 geo in fasttracker (#13042) --- ALICE3/Core/FastTracker.cxx | 39 ++++++++++++++------ ALICE3/Core/FastTracker.h | 2 +- ALICE3/TableProducer/OTF/onTheFlyTracker.cxx | 25 +++++++++---- 3 files changed, 46 insertions(+), 20 deletions(-) diff --git a/ALICE3/Core/FastTracker.cxx b/ALICE3/Core/FastTracker.cxx index 8d59501d3be..74ed147b8af 100644 --- a/ALICE3/Core/FastTracker.cxx +++ b/ALICE3/Core/FastTracker.cxx @@ -144,27 +144,42 @@ void FastTracker::AddSiliconALICE3v2(std::vector pixelResolution) AddLayer("B10", 80., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); } -void FastTracker::AddSiliconALICE3(std::vector pixelResolution) +void FastTracker::AddSiliconALICE3(float scaleX0VD, std::vector pixelResolution) { - float x0IT = 0.001; // 0.1% + float x0Pipe0 = 0.001592; // 200 um AlBe + float x0VDL0 = 0.00076; // 30 um Si + 50 um glue + carbon foam 0.03% + float x0VDL1 = 0.00096; // 30 um Si + 50 um glue + carbon foam 0.05% + float x0VDL2 = 0.00167; // 30 um Si + 50 um glue + carbon foam 0.05% + 0.07% Be case + float x0Coldplate = 0.02f; // (1.5 mm Al2O3 2%) + float x0Pipe1 = 0.0023f; // 800 um Be float x0OT = 0.01; // 1.0% - float xrhoIB = 2.3292e-02; // 100 mum Si - float xrhoOT = 2.3292e-01; // 1000 mum Si - float eff = 1.00; + float x0iTOF = x0OT * 3.; - float resRPhiIT = pixelResolution[0]; - float resZIT = pixelResolution[1]; + float resRPhiVD = pixelResolution[0]; + float resZVD = pixelResolution[1]; float resRPhiOT = pixelResolution[2]; float resZOT = pixelResolution[3]; - AddLayer("bpipe0", 0.48, 250, 0.00042, 2.772e-02, 0.0f, 0.0f, 0.0f, 0); // 150 mum Be - AddLayer("B00", 0.5, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1); - AddLayer("B01", 1.2, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1); - AddLayer("B02", 2.5, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1); - AddLayer("bpipe1", 3.7, 250, 0.0014, 9.24e-02, 0.0f, 0.0f, 0.0f, 0); // 500 mum Be + float xrhoPipe0 = 0; + float xrhoVDL0 = 0; + float xrhoVDL1 = 0; + float xrhoVDL2 = 0; + float xrhoColdplate = 0; + float xrhoPipe1 = 0; + float xrhoOT = 2.3292e-01; + float xrhoiTOF = 0.03; + float eff = 1.00; + + AddLayer("bpipe0", 0.48, 250, x0Pipe0, xrhoPipe0, 0.0f, 0.0f, 0.0f, 0); + AddLayer("B00", 0.5, 250, x0VDL0 * scaleX0VD, xrhoVDL0, resRPhiVD, resZVD, eff, 1); + AddLayer("B01", 1.2, 250, x0VDL1 * scaleX0VD, xrhoVDL1, resRPhiVD, resZVD, eff, 1); + AddLayer("B02", 2.5, 250, x0VDL2 * scaleX0VD, xrhoVDL2, resRPhiVD, resZVD, eff, 1); + AddLayer("coldplate", 2.6, 250, x0Coldplate, xrhoColdplate, 0.0f, 0.0f, 0.0f, 0); + AddLayer("bpipe1", 5.7, 250, x0Pipe1, xrhoPipe1, 0.0f, 0.0f, 0.0f, 0); AddLayer("B03", 7., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); AddLayer("B04", 9., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); AddLayer("B05", 12., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); + AddLayer("iTOF", 19, 250, x0iTOF, xrhoiTOF, resRPhiOT, resZOT, eff, 0); AddLayer("B06", 20., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); AddLayer("B07", 30., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); AddLayer("B08", 45., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); diff --git a/ALICE3/Core/FastTracker.h b/ALICE3/Core/FastTracker.h index c65c3206618..7ab682713c1 100644 --- a/ALICE3/Core/FastTracker.h +++ b/ALICE3/Core/FastTracker.h @@ -59,7 +59,7 @@ class FastTracker void AddSiliconALICE3v4(std::vector pixelResolution); void AddSiliconALICE3v2(std::vector pixelResolution); - void AddSiliconALICE3(std::vector pixelResolution); + void AddSiliconALICE3(float scaleX0VD, std::vector pixelResolution); void AddTPC(float phiResMean, float zResMean); void Print(); diff --git a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx index 2005969d239..0f785534159 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx @@ -138,11 +138,12 @@ struct OnTheFlyTracker { Configurable minSiliconHits{"minSiliconHits", 6, "minimum number of silicon hits to accept track"}; Configurable minSiliconHitsIfTPCUsed{"minSiliconHitsIfTPCUsed", 2, "minimum number of silicon hits to accept track in case TPC info is present"}; Configurable minTPCClusters{"minTPCClusters", 70, "minimum number of TPC hits necessary to consider minSiliconHitsIfTPCUsed"}; - Configurable alice3detector{"alice3detector", 0, "0: ALICE 3 v1, 1: ALICE 3 v4"}; + Configurable alice3detector{"alice3detector", 2, "0: ALICE 3 v1, 1: ALICE 3 v4, 2: ALICE 3 Sep 2025"}; Configurable applyZacceptance{"applyZacceptance", false, "apply z limits to detector layers or not"}; Configurable applyMSCorrection{"applyMSCorrection", true, "apply ms corrections for secondaries or not"}; Configurable applyElossCorrection{"applyElossCorrection", true, "apply eloss corrections for secondaries or not"}; Configurable applyEffCorrection{"applyEffCorrection", true, "apply efficiency correction or not"}; + Configurable scaleVD{"scaleVD", 1, "scale x0 and xrho in VD layers"}; Configurable> pixelRes{"pixelRes", {0.00025, 0.00025, 0.001, 0.001}, "RPhiIT, ZIT, RPhiOT, ZOT"}; } fastTrackerSettings; // allows for gap between peak and bg in case someone wants to @@ -412,12 +413,22 @@ struct OnTheFlyTracker { fastTracker.SetApplyMSCorrection(fastTrackerSettings.applyMSCorrection); fastTracker.SetApplyElossCorrection(fastTrackerSettings.applyElossCorrection); - if (fastTrackerSettings.alice3detector == 0) { - fastTracker.AddSiliconALICE3v2(fastTrackerSettings.pixelRes); - } - if (fastTrackerSettings.alice3detector == 1) { - fastTracker.AddSiliconALICE3v4(fastTrackerSettings.pixelRes); - fastTracker.AddTPC(0.1, 0.1); + switch (fastTrackerSettings.alice3detector) { + case 0: + fastTracker.AddSiliconALICE3v2(fastTrackerSettings.pixelRes); + break; + + case 1: + fastTracker.AddSiliconALICE3v4(fastTrackerSettings.pixelRes); + fastTracker.AddTPC(0.1, 0.1); + break; + + case 2: + fastTracker.AddSiliconALICE3(fastTrackerSettings.scaleVD, fastTrackerSettings.pixelRes); + break; + + default: + break; } // print fastTracker settings From e6a1d6efb72608fed61fd503d38ce57bb48d28ee Mon Sep 17 00:00:00 2001 From: blacwovie Date: Fri, 19 Sep 2025 22:05:08 +0800 Subject: [PATCH 458/986] [PWGLF] fix absolute value bug for dca and pt cut (#13038) --- PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx b/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx index 74c37c05518..b626b1ce386 100644 --- a/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx +++ b/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx @@ -440,8 +440,8 @@ struct he3HadronFemto { candidate.tpcNClsCrossedRows() < crossedRowsToFindableRatio * candidate.tpcNClsFindable() || candidate.tpcChi2NCl() > maxChi2NCl || candidate.tpcChi2NCl() < settingCutChi2tpcLow || - candidate.itsChi2NCl() > settingCutChi2NClITS || candidate.dcaXY() > settingCutDCAxy || - candidate.dcaZ() > settingCutDCAz) { + candidate.itsChi2NCl() > settingCutChi2NClITS || std::abs(candidate.dcaXY()) > settingCutDCAxy || + std::abs(candidate.dcaZ()) > settingCutDCAz) { return false; } @@ -622,7 +622,7 @@ struct he3HadronFemto { return false; } - if (he3Hadcand.recoPtHad() < settingCutPtMinHad || he3Hadcand.recoPtHad() > settingCutPtMaxHad) + if (std::abs(he3Hadcand.recoPtHad()) < settingCutPtMinHad || std::abs(he3Hadcand.recoPtHad()) > settingCutPtMaxHad) return false; he3Hadcand.signHe3 = trackHe3.sign(); @@ -907,9 +907,9 @@ struct he3HadronFemto { { double PrTPCnsigma = computePrTPCnsig(he3Hadcand.momHadTPC, he3Hadcand.tpcSignalHad); double PrTOFnsigma = tofNSigmaCalculation(he3Hadcand.massTOFHad, he3Hadcand.recoPtHad()); - if (abs(PrTPCnsigma) < 3) + if (std::abs(PrTPCnsigma) < 3) return; - if (abs(PrTOFnsigma) < 3) + if (std::abs(PrTOFnsigma) < 3) return; float kstar = computeKstar(he3Hadcand); From 3dd04aad3c596090b15fbf7c2ba08a0ebab15598 Mon Sep 17 00:00:00 2001 From: creetz16 <79141119+creetz16@users.noreply.github.com> Date: Fri, 19 Sep 2025 18:13:54 +0200 Subject: [PATCH 459/986] [PWGLF] Switch to KFParticle for decay3body daughter DCA computation (#13024) --- PWGLF/DataModel/Vtx3BodyTables.h | 26 ++++-- .../Nuspex/decay3bodybuilder.cxx | 20 +++-- PWGLF/Utils/decay3bodyBuilderHelper.h | 83 ++++++++++++++----- 3 files changed, 93 insertions(+), 36 deletions(-) diff --git a/PWGLF/DataModel/Vtx3BodyTables.h b/PWGLF/DataModel/Vtx3BodyTables.h index 55bdea60789..a6ed064a763 100644 --- a/PWGLF/DataModel/Vtx3BodyTables.h +++ b/PWGLF/DataModel/Vtx3BodyTables.h @@ -59,12 +59,18 @@ DECLARE_SOA_COLUMN(PyTrackDe, pyTrackDe, float); //! track2 py at min DECLARE_SOA_COLUMN(PzTrackDe, pzTrackDe, float); //! track2 pz at min // DCAs to PV -DECLARE_SOA_COLUMN(DCAXYTrackPrToPV, dcaXYtrackPrToPv, float); //! DCAXY of proton to PV -DECLARE_SOA_COLUMN(DCAXYTrackPiToPV, dcaXYtrackPiToPv, float); //! DCAXY of pion to PV -DECLARE_SOA_COLUMN(DCAXYTrackDeToPV, dcaXYtrackDeToPv, float); //! DCAXY of deuteron to PV -DECLARE_SOA_COLUMN(DCAZTrackPrToPV, dcaZtrackPrToPv, float); //! DCAZ of proton to PV -DECLARE_SOA_COLUMN(DCAZTrackPiToPV, dcaZtrackPiToPv, float); //! DCAZ of pion to PV -DECLARE_SOA_COLUMN(DCAZTrackDeToPV, dcaZtrackDeToPv, float); //! DCAZ of deuteron to PV +DECLARE_SOA_COLUMN(DCAXYTrackPrToPV, dcaXYtrackPrToPv, float); //! DCAXY of proton to PV (computed with KFParticle) +DECLARE_SOA_COLUMN(DCAXYTrackPiToPV, dcaXYtrackPiToPv, float); //! DCAXY of pion to PV (computed with KFParticle) +DECLARE_SOA_COLUMN(DCAXYTrackDeToPV, dcaXYtrackDeToPv, float); //! DCAXY of deuteron to PV (computed with KFParticle) +DECLARE_SOA_COLUMN(DCATrackPrToPV, dcaTrackPrToPv, float); //! DCA of proton to PV (computed with KFParticle) +DECLARE_SOA_COLUMN(DCATrackPiToPV, dcaTrackPiToPv, float); //! DCA of pion to PV (computed with KFParticle) +DECLARE_SOA_COLUMN(DCATrackDeToPV, dcaTrackDeToPv, float); //! DCA of deuteron to PV (computed with KFParticle) +DECLARE_SOA_COLUMN(DCAXYTrackPrToPVProp, dcaXYtrackPrToPvProp, float); //! DCAXY of proton to PV (propagated with O2 Propagator) +DECLARE_SOA_COLUMN(DCAXYTrackPiToPVProp, dcaXYtrackPiToPvProp, float); //! DCAXY of pion to PV (propagated with O2 Propagator) +DECLARE_SOA_COLUMN(DCAXYTrackDeToPVProp, dcaXYtrackDeToPvProp, float); //! DCAXY of deuteron to PV (propagated with O2 Propagator) +DECLARE_SOA_COLUMN(DCATrackPrToPVProp, dcaTrackPrToPvProp, float); //! DCA of proton to PV (propagated with O2 Propagator) +DECLARE_SOA_COLUMN(DCATrackPiToPVProp, dcaTrackPiToPvProp, float); //! DCA of pion to PV (propagated with O2 Propagator) +DECLARE_SOA_COLUMN(DCATrackDeToPVProp, dcaTrackDeToPvProp, float); //! DCA of deuteron to PV (propagated with O2 Propagator) // DCAs to SV DECLARE_SOA_COLUMN(DCATrackPrToSV, dcaTrackPrToSv, float); //! DCA of proton to SV @@ -209,7 +215,9 @@ DECLARE_SOA_TABLE(Vtx3BodyDatas, "AOD", "VTX3BODYDATA", //! vtx3body::PxTrackPi, vtx3body::PyTrackPi, vtx3body::PzTrackPi, vtx3body::PxTrackDe, vtx3body::PyTrackDe, vtx3body::PzTrackDe, vtx3body::DCAXYTrackPrToPV, vtx3body::DCAXYTrackPiToPV, vtx3body::DCAXYTrackDeToPV, - vtx3body::DCAZTrackPrToPV, vtx3body::DCAZTrackPiToPV, vtx3body::DCAZTrackDeToPV, + vtx3body::DCATrackPrToPV, vtx3body::DCATrackPiToPV, vtx3body::DCATrackDeToPV, + vtx3body::DCAXYTrackPrToPVProp, vtx3body::DCAXYTrackPiToPVProp, vtx3body::DCAXYTrackDeToPVProp, + vtx3body::DCATrackPrToPVProp, vtx3body::DCATrackPiToPVProp, vtx3body::DCATrackDeToPVProp, vtx3body::DCATrackPrToSV, vtx3body::DCATrackPiToSV, vtx3body::DCATrackDeToSV, vtx3body::DCAVtxToDaughtersAv, vtx3body::CosPA, vtx3body::Ct, @@ -258,7 +266,9 @@ DECLARE_SOA_TABLE(McVtx3BodyDatas, "AOD", "MC3BODYDATA", //! vtx3body::PxTrackPi, vtx3body::PyTrackPi, vtx3body::PzTrackPi, vtx3body::PxTrackDe, vtx3body::PyTrackDe, vtx3body::PzTrackDe, vtx3body::DCAXYTrackPrToPV, vtx3body::DCAXYTrackPiToPV, vtx3body::DCAXYTrackDeToPV, - vtx3body::DCAZTrackPrToPV, vtx3body::DCAZTrackPiToPV, vtx3body::DCAZTrackDeToPV, + vtx3body::DCATrackPrToPV, vtx3body::DCATrackPiToPV, vtx3body::DCATrackDeToPV, + vtx3body::DCAXYTrackPrToPVProp, vtx3body::DCAXYTrackPiToPVProp, vtx3body::DCAXYTrackDeToPVProp, + vtx3body::DCATrackPrToPVProp, vtx3body::DCATrackPiToPVProp, vtx3body::DCATrackDeToPVProp, vtx3body::DCATrackPrToSV, vtx3body::DCATrackPiToSV, vtx3body::DCATrackDeToSV, vtx3body::DCAVtxToDaughtersAv, vtx3body::CosPA, vtx3body::Ct, diff --git a/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx b/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx index 633dd9dbb96..eec46c963e2 100644 --- a/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx +++ b/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx @@ -907,7 +907,9 @@ struct decay3bodyBuilder { -1., -1., -1., // momPion -1., -1., -1., // momDeuteron -1., -1., -1., // trackDCAxyToPV: 0 - proton, 1 - pion, 2 - deuteron - -1., -1., -1., // trackDCAzToPV: 0 - proton, 1 - pion, 2 - deuteron + -1., -1., -1., // trackDCAToPV: 0 - proton, 1 - pion, 2 - deuteron + -1., -1., -1., // trackDCAxyToPVprop: 0 - proton, 1 - pion, 2 - deuteron + -1., -1., -1., // trackDCAToPVprop: 0 - proton, 1 - pion, 2 - deuteron -1., -1., -1., // daughterDCAtoSV: 0 - proton, 1 - pion, 2 - deuteron -1., // daughterDCAtoSVaverage -1., -1., // cosPA, ctau @@ -1065,9 +1067,11 @@ struct decay3bodyBuilder { helper.decay3body.momProton[0], helper.decay3body.momProton[1], helper.decay3body.momProton[2], helper.decay3body.momPion[0], helper.decay3body.momPion[1], helper.decay3body.momPion[2], helper.decay3body.momDeuteron[0], helper.decay3body.momDeuteron[1], helper.decay3body.momDeuteron[2], - helper.decay3body.trackDCAxyToPV[0], helper.decay3body.trackDCAxyToPV[1], helper.decay3body.trackDCAxyToPV[2], // 0 - proton, 1 - pion, 2 - deuteron - helper.decay3body.trackDCAzToPV[0], helper.decay3body.trackDCAzToPV[1], helper.decay3body.trackDCAzToPV[2], // 0 - proton, 1 - pion, 2 - deuteron - helper.decay3body.daughterDCAtoSV[0], helper.decay3body.daughterDCAtoSV[1], helper.decay3body.daughterDCAtoSV[2], // 0 - proton, 1 - pion, 2 - deuteron + helper.decay3body.trackDCAxyToPV[0], helper.decay3body.trackDCAxyToPV[1], helper.decay3body.trackDCAxyToPV[2], // 0 - proton, 1 - pion, 2 - deuteron + helper.decay3body.trackDCAToPV[0], helper.decay3body.trackDCAToPV[1], helper.decay3body.trackDCAToPV[2], // 0 - proton, 1 - pion, 2 - deuteron + helper.decay3body.trackDCAxyToPVprop[0], helper.decay3body.trackDCAxyToPVprop[1], helper.decay3body.trackDCAxyToPVprop[2], // 0 - proton, 1 - pion, 2 - deuteron + helper.decay3body.trackDCAToPVprop[0], helper.decay3body.trackDCAToPVprop[1], helper.decay3body.trackDCAToPVprop[2], // 0 - proton, 1 - pion, 2 - deuteron + helper.decay3body.daughterDCAtoSV[0], helper.decay3body.daughterDCAtoSV[1], helper.decay3body.daughterDCAtoSV[2], // 0 - proton, 1 - pion, 2 - deuteron helper.decay3body.daughterDCAtoSVaverage, helper.decay3body.cosPA, helper.decay3body.ctau, helper.decay3body.tpcNsigma[0], helper.decay3body.tpcNsigma[1], helper.decay3body.tpcNsigma[2], helper.decay3body.tpcNsigma[2], // 0 - proton, 1 - pion, 2 - deuteron, 3 - bach with pion hyp @@ -1094,9 +1098,11 @@ struct decay3bodyBuilder { helper.decay3body.momProton[0], helper.decay3body.momProton[1], helper.decay3body.momProton[2], helper.decay3body.momPion[0], helper.decay3body.momPion[1], helper.decay3body.momPion[2], helper.decay3body.momDeuteron[0], helper.decay3body.momDeuteron[1], helper.decay3body.momDeuteron[2], - helper.decay3body.trackDCAxyToPV[0], helper.decay3body.trackDCAxyToPV[1], helper.decay3body.trackDCAxyToPV[2], // 0 - proton, 1 - pion, 2 - deuteron - helper.decay3body.trackDCAzToPV[0], helper.decay3body.trackDCAzToPV[1], helper.decay3body.trackDCAzToPV[2], // 0 - proton, 1 - pion, 2 - deuteron - helper.decay3body.daughterDCAtoSV[0], helper.decay3body.daughterDCAtoSV[1], helper.decay3body.daughterDCAtoSV[2], // 0 - proton, 1 - pion, 2 - deuteron + helper.decay3body.trackDCAxyToPV[0], helper.decay3body.trackDCAxyToPV[1], helper.decay3body.trackDCAxyToPV[2], // 0 - proton, 1 - pion, 2 - deuteron + helper.decay3body.trackDCAToPV[0], helper.decay3body.trackDCAToPV[1], helper.decay3body.trackDCAToPV[2], // 0 - proton, 1 - pion, 2 - deuteron + helper.decay3body.trackDCAxyToPVprop[0], helper.decay3body.trackDCAxyToPVprop[1], helper.decay3body.trackDCAxyToPVprop[2], // 0 - proton, 1 - pion, 2 - deuteron + helper.decay3body.trackDCAToPVprop[0], helper.decay3body.trackDCAToPVprop[1], helper.decay3body.trackDCAToPVprop[2], // 0 - proton, 1 - pion, 2 - deuteron + helper.decay3body.daughterDCAtoSV[0], helper.decay3body.daughterDCAtoSV[1], helper.decay3body.daughterDCAtoSV[2], // 0 - proton, 1 - pion, 2 - deuteron helper.decay3body.daughterDCAtoSVaverage, helper.decay3body.cosPA, helper.decay3body.ctau, helper.decay3body.tpcNsigma[0], helper.decay3body.tpcNsigma[1], helper.decay3body.tpcNsigma[2], helper.decay3body.tpcNsigma[2], // 0 - proton, 1 - pion, 2 - deuteron, 3 - bach with pion hyp diff --git a/PWGLF/Utils/decay3bodyBuilderHelper.h b/PWGLF/Utils/decay3bodyBuilderHelper.h index 49131c16040..285085b8c80 100644 --- a/PWGLF/Utils/decay3bodyBuilderHelper.h +++ b/PWGLF/Utils/decay3bodyBuilderHelper.h @@ -60,9 +60,11 @@ struct decay3bodyCandidate { std::array posProton = {0.0f, 0.0f, 0.0f}; std::array posPion = {0.0f, 0.0f, 0.0f}; std::array posDeuteron = {0.0f, 0.0f, 0.0f}; - std::array trackDCAxyToPV = {0.0f, 0.0f, 0.0f}; // 0 - proton, 1 - pion, 2 - deuteron - std::array trackDCAzToPV = {0.0f, 0.0f, 0.0f}; // 0 - proton, 1 - pion, 2 - deuteron - std::array tpcNsigma = {0.0f, 0.0f, 0.0f, 0.0f}; // 0 - proton, 1 - pion, 2 - deuteron, 3 - bach with pion hyp + std::array trackDCAxyToPV = {0.0f, 0.0f, 0.0f}; // 0 - proton, 1 - pion, 2 - deuteron + std::array trackDCAToPV = {0.0f, 0.0f, 0.0f}; // 0 - proton, 1 - pion, 2 - deuteron + std::array trackDCAxyToPVprop = {0.0f, 0.0f, 0.0f}; // 0 - proton, 1 - pion, 2 - deuteron + std::array trackDCAToPVprop = {0.0f, 0.0f, 0.0f}; // 0 - proton, 1 - pion, 2 - deuteron + std::array tpcNsigma = {0.0f, 0.0f, 0.0f, 0.0f}; // 0 - proton, 1 - pion, 2 - deuteron, 3 - bach with pion hyp double tofNsigmaDeuteron = 0.0f; std::array averageITSClSize = {0.0f, 0.0f, 0.0f}; // 0 - proton, 1 - pion, 2 - deuteron std::array tpcNCl = {0.0f, 0.0f, 0.0f}; // 0 - proton, 1 - pion, 2 - deuteron @@ -134,6 +136,9 @@ class decay3bodyBuilderHelper float minDCAProtonToPV; float minDCAPionToPV; float minDCADeuteronToPV; + float minDCAProtonToPVprop; + float minDCAPionToPVprop; + float minDCADeuteronToPVprop; float minPtProton; float minPtPion; float minPtDeuteron; @@ -281,44 +286,80 @@ class decay3bodyBuilderHelper } // end of selections //_______________________________________________________________________ - // daughter track DCA to PV associated with decay3body - o2::dataformats::VertexBase mPV; - o2::dataformats::DCA mDcaInfoCov; + // daughter track DCA to PV associated with decay3body --> computed with KFParticle + float pvXY[2] = {pvX, pvY}; + float pv[3] = {pvX, pvY, pvZ}; auto trackParCovProtonCopy = trackParCovProton; auto trackParCovPionCopy = trackParCovPion; auto trackParCovDeuteronCopy = trackParCovDeuteron; + KFParticle kfproton = createKFParticleFromTrackParCov(trackParCovProtonCopy, trackProton.sign(), constants::physics::MassProton); + KFParticle kfpion = createKFParticleFromTrackParCov(trackParCovPionCopy, trackPion.sign(), constants::physics::MassPionCharged); + KFParticle kfdeuteron = createKFParticleFromTrackParCov(trackParCovDeuteronCopy, trackDeuteron.sign(), constants::physics::MassDeuteron); + + // proton DCA to PV + decay3body.trackDCAxyToPV[0] = kfproton.GetDistanceFromVertexXY(pvXY); + decay3body.trackDCAToPV[0] = kfproton.GetDistanceFromVertex(pv); + // pion DCA to PV + decay3body.trackDCAxyToPV[1] = kfpion.GetDistanceFromVertexXY(pvXY); + decay3body.trackDCAToPV[1] = kfpion.GetDistanceFromVertex(pv); + // deuteron DCA to PV + decay3body.trackDCAxyToPV[2] = kfdeuteron.GetDistanceFromVertexXY(pvXY); + decay3body.trackDCAToPV[2] = kfdeuteron.GetDistanceFromVertex(pv); + // selection + if (useSelections) { + if (decay3body.trackDCAToPV[0] < decay3bodyselections.minDCAProtonToPV) { + decay3body = {}; + return false; + } + if (decay3body.trackDCAToPV[1] < decay3bodyselections.minDCAPionToPV) { + decay3body = {}; + return false; + } + if (decay3body.trackDCAToPV[2] < decay3bodyselections.minDCADeuteronToPV) { + decay3body = {}; + return false; + } + } + + //_______________________________________________________________________ + // daughter track DCA to PV associated with decay3body --> with O2 Propagator + o2::dataformats::VertexBase mPV; + o2::dataformats::DCA mDcaInfoCov; + auto trackParCovProtonCopyProp = trackParCovProton; + auto trackParCovPionCopyProp = trackParCovPion; + auto trackParCovDeuteronCopyProp = trackParCovDeuteron; mPV.setPos({pvX, pvY, pvZ}); mPV.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); // proton track - o2::base::Propagator::Instance()->propagateToDCABxByBz(mPV, trackParCovProtonCopy, 2.f, fitter3body.getMatCorrType(), &mDcaInfoCov); - decay3body.trackDCAxyToPV[0] = mDcaInfoCov.getY(); - decay3body.trackDCAzToPV[0] = mDcaInfoCov.getZ(); - auto trackProtonDCAToPV = std::sqrt(decay3body.trackDCAxyToPV[0] * decay3body.trackDCAxyToPV[0] + decay3body.trackDCAzToPV[0] * decay3body.trackDCAzToPV[0]); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mPV, trackParCovProtonCopyProp, 2.f, fitter3body.getMatCorrType(), &mDcaInfoCov); + decay3body.trackDCAxyToPVprop[0] = mDcaInfoCov.getY(); + auto trackProtonDCAzToPVprop = mDcaInfoCov.getZ(); + decay3body.trackDCAToPVprop[0] = std::sqrt(decay3body.trackDCAxyToPVprop[0] * decay3body.trackDCAxyToPVprop[0] + trackProtonDCAzToPVprop * trackProtonDCAzToPVprop); if (useSelections) { - if (trackProtonDCAToPV < decay3bodyselections.minDCAProtonToPV) { + if (decay3body.trackDCAToPVprop[0] < decay3bodyselections.minDCAProtonToPVprop) { decay3body = {}; return false; } } // pion track - o2::base::Propagator::Instance()->propagateToDCABxByBz(mPV, trackParCovPionCopy, 2.f, fitter3body.getMatCorrType(), &mDcaInfoCov); - decay3body.trackDCAxyToPV[1] = mDcaInfoCov.getY(); - decay3body.trackDCAzToPV[1] = mDcaInfoCov.getZ(); - auto trackPionDCAToPV = std::sqrt(decay3body.trackDCAxyToPV[1] * decay3body.trackDCAxyToPV[1] + decay3body.trackDCAzToPV[1] * decay3body.trackDCAzToPV[1]); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mPV, trackParCovPionCopyProp, 2.f, fitter3body.getMatCorrType(), &mDcaInfoCov); + decay3body.trackDCAxyToPVprop[1] = mDcaInfoCov.getY(); + auto trackPionDCAzToPVprop = mDcaInfoCov.getZ(); + decay3body.trackDCAToPVprop[1] = std::sqrt(decay3body.trackDCAxyToPVprop[1] * decay3body.trackDCAxyToPVprop[1] + trackPionDCAzToPVprop * trackPionDCAzToPVprop); if (useSelections) { - if (trackPionDCAToPV < decay3bodyselections.minDCAPionToPV) { + if (decay3body.trackDCAToPVprop[1] < decay3bodyselections.minDCAPionToPVprop) { decay3body = {}; return false; } } // deuteron track - o2::base::Propagator::Instance()->propagateToDCABxByBz(mPV, trackParCovDeuteronCopy, 2.f, fitter3body.getMatCorrType(), &mDcaInfoCov); - decay3body.trackDCAxyToPV[2] = mDcaInfoCov.getY(); - decay3body.trackDCAzToPV[2] = mDcaInfoCov.getZ(); - auto trackDeuteronDCAToPV = std::sqrt(decay3body.trackDCAxyToPV[2] * decay3body.trackDCAxyToPV[2] + decay3body.trackDCAzToPV[2] * decay3body.trackDCAzToPV[2]); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mPV, trackParCovDeuteronCopyProp, 2.f, fitter3body.getMatCorrType(), &mDcaInfoCov); + decay3body.trackDCAxyToPVprop[2] = mDcaInfoCov.getY(); + auto trackDeuteronDCAzToPVprop = mDcaInfoCov.getZ(); + decay3body.trackDCAToPVprop[2] = std::sqrt(decay3body.trackDCAxyToPVprop[2] * decay3body.trackDCAxyToPVprop[2] + trackDeuteronDCAzToPVprop * trackDeuteronDCAzToPVprop); if (useSelections) { - if (trackDeuteronDCAToPV < decay3bodyselections.minDCADeuteronToPV) { + if (decay3body.trackDCAToPVprop[2] < decay3bodyselections.minDCADeuteronToPVprop) { decay3body = {}; return false; } From 29d5b02ceb8e6ff22db97be35b9dcb3c1c5b42da Mon Sep 17 00:00:00 2001 From: Chiara Pinto <48326672+chiarapinto@users.noreply.github.com> Date: Fri, 19 Sep 2025 18:20:04 +0200 Subject: [PATCH 460/986] [PWGLF] added histos for reweighting (#13041) --- PWGLF/Tasks/Nuspex/antinucleiInJets.cxx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx index e2b2459bc2b..20d48d727d0 100644 --- a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx +++ b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx @@ -338,6 +338,13 @@ struct AntinucleiInJets { registryMC.add("helium3_rec_tpc_ue", "helium3_rec_tpc_ue", HistType::kTH1F, {{nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}}); registryMC.add("antihelium3_rec_tpc_jet", "antihelium3_rec_tpc_jet", HistType::kTH1F, {{nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}}); registryMC.add("antihelium3_rec_tpc_ue", "antihelium3_rec_tpc_ue", HistType::kTH1F, {{nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}}); + + // Generated spectra needed for reweighting + registryMC.add("protonBar", "protonBar", HistType::kTH1F, {{5000, 0, 5, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("lambdaBar", "lambdaBar", HistType::kTH1F, {{5000, 0, 5, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("xiBar", "xiBar", HistType::kTH1F, {{5000, 0, 5, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("omegaBar", "omegaBar", HistType::kTH1F, {{5000, 0, 5, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("sigmaBar", "sigmaBar", HistType::kTH1F, {{5000, 0, 5, "#it{p}_{T} (GeV/#it{c})"}}); } // Systematic uncertainties (Data) @@ -1261,6 +1268,7 @@ struct AntinucleiInJets { case PDG_t::kProtonBar: registryMC.fill(HIST("antip_gen_jet"), particle.pt()); registryMC.fill(HIST("antip_gen_ue"), particle.pt()); + registryMC.fill(HIST("protonBar"), particle.pt()); break; case o2::constants::physics::Pdg::kDeuteron: registryMC.fill(HIST("deuteron_gen_jet"), particle.pt()); @@ -1278,6 +1286,19 @@ struct AntinucleiInJets { registryMC.fill(HIST("antihelium3_gen_jet"), particle.pt()); registryMC.fill(HIST("antihelium3_gen_ue"), particle.pt()); break; + // Histograms for re-weighting + case PDG_t::kLambda0Bar: + registryMC.fill(HIST("lambdaBar"), particle.pt()); + break; + case PDG_t::kXiPlusBar: + registryMC.fill(HIST("xiBar"), particle.pt()); + break; + case PDG_t::kOmegaPlusBar: + registryMC.fill(HIST("omegaBar"), particle.pt()); + break; + case PDG_t::kSigmaBarMinus: + registryMC.fill(HIST("sigmaBar"), particle.pt()); + break; } } From 444459715a3a7eee4ea1479d0a3c1a3f4cd715df Mon Sep 17 00:00:00 2001 From: mcoquet642 <74600025+mcoquet642@users.noreply.github.com> Date: Fri, 19 Sep 2025 19:20:08 +0200 Subject: [PATCH 461/986] [PWGDQ] Usage of ML models for MFT-Muon matching (#13048) Co-authored-by: Maurice Coquet Co-authored-by: ALICE Action Bot --- PWGDQ/Core/MuonMatchingMlResponse.h | 377 ++++++++++++++++++ .../TableProducer/tableMakerMC_withAssoc.cxx | 91 +++-- 2 files changed, 439 insertions(+), 29 deletions(-) create mode 100644 PWGDQ/Core/MuonMatchingMlResponse.h diff --git a/PWGDQ/Core/MuonMatchingMlResponse.h b/PWGDQ/Core/MuonMatchingMlResponse.h new file mode 100644 index 00000000000..1c36f26ab5d --- /dev/null +++ b/PWGDQ/Core/MuonMatchingMlResponse.h @@ -0,0 +1,377 @@ +// 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 MuonMatchingMlResponse.h +/// \brief Class to compute the ML response for MFT-Muon matching +/// \author Maurice Coquet + +#ifndef PWGDQ_CORE_MUONMATCHINGMLRESPONSE_H_ +#define PWGDQ_CORE_MUONMATCHINGMLRESPONSE_H_ + +#include "Tools/ML/MlResponse.h" + +#include +#include +#include + +// Fill the map of available input features +// the key is the feature's name (std::string) +// the value is the corresponding value in EnumInputFeatures +#define FILL_MAP_MFTMUON_MATCH(FEATURE) \ + { \ + #FEATURE, static_cast(InputFeaturesMFTMuonMatch::FEATURE) \ + } + +// Check if the index of mCachedIndices (index associated to a FEATURE) +// matches the entry in EnumInputFeatures associated to this FEATURE +// if so, the inputFeatures vector is filled with the FEATURE's value +// by calling the corresponding GETTER=FEATURE from track +#define CHECK_AND_FILL_MUON_TRACK(FEATURE, GETTER) \ + case static_cast(InputFeaturesMFTMuonMatch::FEATURE): { \ + inputFeature = muon.GETTER(); \ + break; \ + } + +// Check if the index of mCachedIndices (index associated to a FEATURE) +// matches the entry in EnumInputFeatures associated to this FEATURE +// if so, the inputFeatures vector is filled with the FEATURE's value +// by calling the corresponding GETTER=FEATURE from track +#define CHECK_AND_FILL_MFT_TRACK(FEATURE, GETTER) \ + case static_cast(InputFeaturesMFTMuonMatch::FEATURE): { \ + inputFeature = mft.GETTER(); \ + break; \ + } + +// Check if the index of mCachedIndices (index associated to a FEATURE) +// matches the entry in EnumInputFeatures associated to this FEATURE +// if so, the inputFeatures vector is filled with the FEATURE's value +// by calling the corresponding GETTER=FEATURE from track +#define CHECK_AND_FILL_MUON_COV(FEATURE, GETTER) \ + case static_cast(InputFeaturesMFTMuonMatch::FEATURE): { \ + inputFeature = muoncov.GETTER(); \ + break; \ + } + +// Check if the index of mCachedIndices (index associated to a FEATURE) +// matches the entry in EnumInputFeatures associated to this FEATURE +// if so, the inputFeatures vector is filled with the FEATURE's value +// by calling the corresponding GETTER=FEATURE from track +#define CHECK_AND_FILL_MFT_COV(FEATURE, GETTER) \ + case static_cast(InputFeaturesMFTMuonMatch::FEATURE): { \ + inputFeature = mftcov.GETTER(); \ + break; \ + } + +// Check if the index of mCachedIndices (index associated to a FEATURE) +// matches the entry in EnumInputFeatures associated to this FEATURE +// if so, the inputFeatures vector is filled with the FEATURE's value +// by calling the corresponding GETTER1 and GETTER2 from track. +#define CHECK_AND_FILL_MFTMUON_DIFF(FEATURE, GETTER1, GETTER2) \ + case static_cast(InputFeaturesMFTMuonMatch::FEATURE): { \ + inputFeature = (mft.GETTER2() - muon.GETTER1()); \ + break; \ + } + +// Check if the index of mCachedIndices (index associated to a FEATURE) +// matches the entry in EnumInputFeatures associated to this FEATURE +// if so, the inputFeatures vector is filled with the FEATURE's value +// by calling the corresponding GETTER=FEATURE from collision +#define CHECK_AND_FILL_MFTMUON_COLLISION(GETTER) \ + case static_cast(InputFeaturesMFTMuonMatch::GETTER): { \ + inputFeature = collision.GETTER(); \ + break; \ + } + +namespace o2::analysis +{ +// possible input features for ML +enum class InputFeaturesMFTMuonMatch : uint8_t { + zMatching, + xMFT, + yMFT, + qOverptMFT, + tglMFT, + phiMFT, + dcaXY, + dcaZ, + chi2MFT, + nClustersMFT, + xMCH, + yMCH, + qOverptMCH, + tglMCH, + phiMCH, + nClustersMCH, + chi2MCH, + pdca, + cXXMFT, + cXYMFT, + cYYMFT, + cPhiYMFT, + cPhiXMFT, + cPhiPhiMFT, + cTglYMFT, + cTglXMFT, + cTglPhiMFT, + cTglTglMFT, + c1PtYMFT, + c1PtXMFT, + c1PtPhiMFT, + c1PtTglMFT, + c1Pt21Pt2MFT, + cXXMCH, + cXYMCH, + cYYMCH, + cPhiYMCH, + cPhiXMCH, + cPhiPhiMCH, + cTglYMCH, + cTglXMCH, + cTglPhiMCH, + cTglTglMCH, + c1PtYMCH, + c1PtXMCH, + c1PtPhiMCH, + c1PtTglMCH, + c1Pt21Pt2MCH, + deltaX, + deltaY, + deltaPhi, + deltaEta, + deltaPt, + posX, + posY, + posZ, + numContrib, + trackOccupancyInTimeRange, + ft0cOccupancyInTimeRange, + multFT0A, + multFT0C, + multNTracksPV, + multNTracksPVeta1, + multNTracksPVetaHalf, + isInelGt0, + isInelGt1, + multFT0M, + centFT0M, + centFT0A, + centFT0C, + chi2MCHMFT +}; + +template +class MlResponseMFTMuonMatch : public MlResponse +{ + public: + /// Default constructor + MlResponseMFTMuonMatch() = default; + /// Default destructor + virtual ~MlResponseMFTMuonMatch() = default; + + template + float returnFeature(uint8_t idx, T1 const& muon, T2 const& mft, C1 const& muoncov, C2 const& mftcov, U const& collision) + { + float inputFeature = 0.; + switch (idx) { + CHECK_AND_FILL_MFT_TRACK(zMatching, z); + CHECK_AND_FILL_MFT_TRACK(xMFT, x); + CHECK_AND_FILL_MFT_TRACK(yMFT, y); + CHECK_AND_FILL_MFT_TRACK(qOverptMFT, signed1Pt); + CHECK_AND_FILL_MFT_TRACK(tglMFT, tgl); + CHECK_AND_FILL_MFT_TRACK(phiMFT, phi); + CHECK_AND_FILL_MFT_TRACK(chi2MFT, chi2); + CHECK_AND_FILL_MFT_TRACK(nClustersMFT, nClusters); + CHECK_AND_FILL_MUON_TRACK(dcaXY, fwddcaXY); + CHECK_AND_FILL_MUON_TRACK(dcaZ, fwddcaz); + CHECK_AND_FILL_MUON_TRACK(xMCH, x); + CHECK_AND_FILL_MUON_TRACK(yMCH, y); + CHECK_AND_FILL_MUON_TRACK(qOverptMCH, signed1Pt); + CHECK_AND_FILL_MUON_TRACK(tglMCH, tgl); + CHECK_AND_FILL_MUON_TRACK(phiMCH, phi); + CHECK_AND_FILL_MUON_TRACK(nClustersMCH, nClusters); + CHECK_AND_FILL_MUON_TRACK(chi2MCH, chi2); + CHECK_AND_FILL_MUON_TRACK(pdca, pDca); + CHECK_AND_FILL_MFT_COV(cXXMFT, cXX); + CHECK_AND_FILL_MFT_COV(cXYMFT, cXY); + CHECK_AND_FILL_MFT_COV(cYYMFT, cYY); + CHECK_AND_FILL_MFT_COV(cPhiYMFT, cPhiY); + CHECK_AND_FILL_MFT_COV(cPhiXMFT, cPhiX); + CHECK_AND_FILL_MFT_COV(cPhiPhiMFT, cPhiPhi); + CHECK_AND_FILL_MFT_COV(cTglYMFT, cTglY); + CHECK_AND_FILL_MFT_COV(cTglXMFT, cTglX); + CHECK_AND_FILL_MFT_COV(cTglPhiMFT, cTglPhi); + CHECK_AND_FILL_MFT_COV(cTglTglMFT, cTglTgl); + CHECK_AND_FILL_MFT_COV(c1PtYMFT, c1PtY); + CHECK_AND_FILL_MFT_COV(c1PtXMFT, c1PtX); + CHECK_AND_FILL_MFT_COV(c1PtPhiMFT, c1PtPhi); + CHECK_AND_FILL_MFT_COV(c1PtTglMFT, c1PtTgl); + CHECK_AND_FILL_MFT_COV(c1Pt21Pt2MFT, c1Pt21Pt2); + CHECK_AND_FILL_MUON_COV(cXXMCH, cXX); + CHECK_AND_FILL_MUON_COV(cXYMCH, cXY); + CHECK_AND_FILL_MUON_COV(cYYMCH, cYY); + CHECK_AND_FILL_MUON_COV(cPhiYMCH, cPhiY); + CHECK_AND_FILL_MUON_COV(cPhiXMCH, cPhiX); + CHECK_AND_FILL_MUON_COV(cPhiPhiMCH, cPhiPhi); + CHECK_AND_FILL_MUON_COV(cTglYMCH, cTglY); + CHECK_AND_FILL_MUON_COV(cTglXMCH, cTglX); + CHECK_AND_FILL_MUON_COV(cTglPhiMCH, cTglPhi); + CHECK_AND_FILL_MUON_COV(cTglTglMCH, cTglTgl); + CHECK_AND_FILL_MUON_COV(c1PtYMCH, c1PtY); + CHECK_AND_FILL_MUON_COV(c1PtXMCH, c1PtX); + CHECK_AND_FILL_MUON_COV(c1PtPhiMCH, c1PtPhi); + CHECK_AND_FILL_MUON_COV(c1PtTglMCH, c1PtTgl); + CHECK_AND_FILL_MUON_COV(c1Pt21Pt2MCH, c1Pt21Pt2); + CHECK_AND_FILL_MFTMUON_COLLISION(posX); + CHECK_AND_FILL_MFTMUON_COLLISION(posY); + CHECK_AND_FILL_MFTMUON_COLLISION(posZ); + CHECK_AND_FILL_MFTMUON_COLLISION(numContrib); + CHECK_AND_FILL_MFTMUON_COLLISION(trackOccupancyInTimeRange); + CHECK_AND_FILL_MFTMUON_COLLISION(ft0cOccupancyInTimeRange); + CHECK_AND_FILL_MFTMUON_COLLISION(multFT0A); + CHECK_AND_FILL_MFTMUON_COLLISION(multFT0C); + CHECK_AND_FILL_MFTMUON_COLLISION(multNTracksPV); + CHECK_AND_FILL_MFTMUON_COLLISION(multNTracksPVeta1); + CHECK_AND_FILL_MFTMUON_COLLISION(multNTracksPVetaHalf); + CHECK_AND_FILL_MFTMUON_COLLISION(isInelGt0); + CHECK_AND_FILL_MFTMUON_COLLISION(isInelGt1); + CHECK_AND_FILL_MFTMUON_COLLISION(multFT0M); + CHECK_AND_FILL_MFTMUON_COLLISION(centFT0M); + CHECK_AND_FILL_MFTMUON_COLLISION(centFT0A); + CHECK_AND_FILL_MFTMUON_COLLISION(centFT0C); + CHECK_AND_FILL_MUON_TRACK(chi2MCHMFT, chi2MatchMCHMFT); + } + return inputFeature; + } + + template + float returnFeatureTest(uint8_t idx, T1 const& muon) + { + float inputFeature = 0.; + switch (idx) { + CHECK_AND_FILL_MUON_TRACK(chi2MCHMFT, chi2MatchMCHMFT); + } + return inputFeature; + } + + /// Method to get the input features vector needed for ML inference + /// \param track is the single track, \param collision is the collision + /// \return inputFeatures vector + template + std::vector getInputFeatures(T1 const& muon, T2 const& mft, C1 const& muoncov, C2 const& mftcov, U const& collision) + { + std::vector inputFeatures; + for (const auto& idx : MlResponse::mCachedIndices) { + float inputFeature = returnFeature(idx, muon, mft, muoncov, mftcov, collision); + inputFeatures.emplace_back(inputFeature); + } + return inputFeatures; + } + + template + std::vector getInputFeaturesTest(T1 const& muon) + { + std::vector inputFeatures; + for (const auto& idx : MlResponse::mCachedIndices) { + float inputFeature = returnFeatureTest(idx, muon); + inputFeatures.emplace_back(inputFeature); + } + return inputFeatures; + } + + /// Method to get the value of variable chosen for binning + /// \param track is the single track, \param collision is the collision + /// \return binning variable + template + float getBinningFeature(T1 const& muon, T2 const& mft, C1 const& muoncov, C2 const& mftcov, U const& collision) + { + return returnFeature(mCachedIndexBinning, muon, mft, muoncov, mftcov, collision); + } + + void cacheBinningIndex(std::string const& cfgBinningFeature) + { + setAvailableInputFeatures(); + if (MlResponse::mAvailableInputFeatures.count(cfgBinningFeature)) { + mCachedIndexBinning = MlResponse::mAvailableInputFeatures[cfgBinningFeature]; + } else { + LOG(fatal) << "Binning feature " << cfgBinningFeature << " not available! Please check your configurables."; + } + } + + protected: + /// Method to fill the map of available input features + void setAvailableInputFeatures() + { + MlResponse::mAvailableInputFeatures = { + FILL_MAP_MFTMUON_MATCH(zMatching), + FILL_MAP_MFTMUON_MATCH(xMFT), + FILL_MAP_MFTMUON_MATCH(yMFT), + FILL_MAP_MFTMUON_MATCH(qOverptMFT), + FILL_MAP_MFTMUON_MATCH(tglMFT), + FILL_MAP_MFTMUON_MATCH(phiMFT), + FILL_MAP_MFTMUON_MATCH(dcaXY), + FILL_MAP_MFTMUON_MATCH(dcaZ), + FILL_MAP_MFTMUON_MATCH(chi2MFT), + FILL_MAP_MFTMUON_MATCH(nClustersMFT), + FILL_MAP_MFTMUON_MATCH(xMCH), + FILL_MAP_MFTMUON_MATCH(yMCH), + FILL_MAP_MFTMUON_MATCH(qOverptMCH), + FILL_MAP_MFTMUON_MATCH(tglMCH), + FILL_MAP_MFTMUON_MATCH(phiMCH), + FILL_MAP_MFTMUON_MATCH(nClustersMCH), + FILL_MAP_MFTMUON_MATCH(chi2MCH), + FILL_MAP_MFTMUON_MATCH(pdca), + FILL_MAP_MFTMUON_MATCH(cXXMFT), + FILL_MAP_MFTMUON_MATCH(cXYMFT), + FILL_MAP_MFTMUON_MATCH(cYYMFT), + FILL_MAP_MFTMUON_MATCH(cPhiYMFT), + FILL_MAP_MFTMUON_MATCH(cPhiXMFT), + FILL_MAP_MFTMUON_MATCH(cPhiPhiMFT), + FILL_MAP_MFTMUON_MATCH(cTglYMFT), + FILL_MAP_MFTMUON_MATCH(cTglXMFT), + FILL_MAP_MFTMUON_MATCH(cTglPhiMFT), + FILL_MAP_MFTMUON_MATCH(cTglTglMFT), + FILL_MAP_MFTMUON_MATCH(c1PtYMFT), + FILL_MAP_MFTMUON_MATCH(c1PtXMFT), + FILL_MAP_MFTMUON_MATCH(c1PtPhiMFT), + FILL_MAP_MFTMUON_MATCH(c1PtTglMFT), + FILL_MAP_MFTMUON_MATCH(c1Pt21Pt2MFT), + FILL_MAP_MFTMUON_MATCH(cXXMCH), + FILL_MAP_MFTMUON_MATCH(cXYMCH), + FILL_MAP_MFTMUON_MATCH(cYYMCH), + FILL_MAP_MFTMUON_MATCH(cPhiYMCH), + FILL_MAP_MFTMUON_MATCH(cPhiXMCH), + FILL_MAP_MFTMUON_MATCH(cPhiPhiMCH), + FILL_MAP_MFTMUON_MATCH(cTglYMCH), + FILL_MAP_MFTMUON_MATCH(cTglXMCH), + FILL_MAP_MFTMUON_MATCH(cTglPhiMCH), + FILL_MAP_MFTMUON_MATCH(cTglTglMCH), + FILL_MAP_MFTMUON_MATCH(c1PtYMCH), + FILL_MAP_MFTMUON_MATCH(c1PtXMCH), + FILL_MAP_MFTMUON_MATCH(c1PtPhiMCH), + FILL_MAP_MFTMUON_MATCH(c1PtTglMCH), + FILL_MAP_MFTMUON_MATCH(c1Pt21Pt2MCH), + FILL_MAP_MFTMUON_MATCH(chi2MCHMFT)}; + } + + uint8_t mCachedIndexBinning; // index correspondance between configurable and available input features +}; + +} // namespace o2::analysis + +#undef FILL_MAP_MFTMUON_MAP +#undef CHECK_AND_FILL_MUON_TRACK +#undef CHECK_AND_FILL_MFT_TRACK +#undef CHECK_AND_FILL_MUON_COV +#undef CHECK_AND_FILL_MFT_COV +#undef CHECK_AND_FILL_MFTMUON_DIFF +#undef CHECK_AND_FILL_MFTMUON_COLLISION + +#endif // PWGDQ_CORE_MUONMATCHINGMLRESPONSE_H_ diff --git a/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx b/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx index a3c257652fd..cd38a312311 100644 --- a/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx +++ b/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx @@ -16,45 +16,50 @@ // The skimmed MC stack includes the MC truth particles corresponding to the list of user specified MC signals (see MCsignal.h) // and the MC truth particles corresponding to the reconstructed tracks selected by the specified track cuts on reconstructed data. -#include -#include -#include -#include -#include -#include -#include -#include -#include "TList.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/ASoA.h" -#include "Framework/DataTypes.h" -#include "Framework/runDataProcessing.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Centrality.h" -#include "Common/CCDB/TriggerAliases.h" -#include "PWGDQ/DataModel/ReducedInfoTables.h" -#include "PWGDQ/Core/VarManager.h" -#include "PWGDQ/Core/HistogramManager.h" -#include "PWGDQ/Core/AnalysisCut.h" #include "PWGDQ/Core/AnalysisCompositeCut.h" -#include "PWGDQ/Core/HistogramsLibrary.h" +#include "PWGDQ/Core/AnalysisCut.h" #include "PWGDQ/Core/CutsLibrary.h" +#include "PWGDQ/Core/HistogramManager.h" +#include "PWGDQ/Core/HistogramsLibrary.h" #include "PWGDQ/Core/MCSignal.h" #include "PWGDQ/Core/MCSignalLibrary.h" +#include "PWGDQ/Core/MuonMatchingMlResponse.h" +#include "PWGDQ/Core/VarManager.h" +#include "PWGDQ/DataModel/ReducedInfoTables.h" + +#include "Common/CCDB/TriggerAliases.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/FwdTrackReAlignTables.h" +#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/FwdTrackReAlignTables.h" -#include "Common/DataModel/CollisionAssociationTables.h" + +#include "CCDB/BasicCCDBManager.h" #include "DataFormatsParameters/GRPMagField.h" #include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" #include "Field/MagneticField.h" +#include "Framework/ASoA.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/DataTypes.h" +#include "Framework/runDataProcessing.h" + #include "TGeoGlobalMagField.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "CCDB/BasicCCDBManager.h" +#include "TList.h" + +#include +#include +#include +#include +#include +#include +#include +#include using std::cout; using std::endl; @@ -199,6 +204,7 @@ struct TableMakerMC { Configurable fGeoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; Configurable fGrpMagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; Configurable fGrpMagPathRun2{"grpmagPathRun2", "GLO/GRP/GRP", "CCDB path of the GRPObject (Usage for Run 2)"}; + Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"}; } fConfigCCDB; struct : ConfigurableGroup { @@ -208,8 +214,12 @@ struct TableMakerMC { Configurable fPropMuon{"cfgPropMuon", true, "Propagate muon tracks through absorber (do not use if applying pairing)"}; Configurable fRefitGlobalMuon{"cfgRefitGlobalMuon", true, "Correct global muon parameters"}; Configurable fKeepBestMatch{"cfgKeepBestMatch", false, "Keep only the best match global muons in the skimming"}; + Configurable fUseML{"cfgUseML", false, "Import ONNX model from ccdb to decide which matching candidates to keep"}; Configurable fMuonMatchEtaMin{"cfgMuonMatchEtaMin", -4.0f, "Definition of the acceptance of muon tracks to be matched with MFT"}; Configurable fMuonMatchEtaMax{"cfgMuonMatchEtaMax", -2.5f, "Definition of the acceptance of muon tracks to be matched with MFT"}; + Configurable> fModelPathsCCDB{"fModelPathsCCDB", std::vector{"Users/m/mcoquet/MLTest"}, "Paths of models on CCDB"}; + Configurable> fInputFeatures{"cfgInputFeatures", std::vector{"chi2MCHMFT"}, "Names of ML model input features"}; + Configurable> fModelNames{"cfgModelNames", std::vector{"model.onnx"}, "ONNX file names for each pT bin (if not from CCDB full path)"}; } fConfigVariousOptions; Service fCCDB; @@ -240,6 +250,11 @@ struct TableMakerMC { std::map fBestMatch; std::unordered_map map_mfttrackcovs; + o2::analysis::MlResponseMFTMuonMatch matchingMlResponse; + std::vector binsPtMl; + std::array cutValues; + std::vector cutDirMl; + void init(o2::framework::InitContext& context) { // Check whether barrel or muon are enabled @@ -364,6 +379,18 @@ struct TableMakerMC { fCCDB->get(fConfigCCDB.fGeoPath); } fCCDBApi.init(fConfigCCDB.fConfigCcdbUrl.value); + + if (fConfigVariousOptions.fUseML.value) { + // TODO : for now we use hard coded values since the current models use 1 pT bin + binsPtMl = {-1e-6, 1000.0}; + cutValues = {0.0}; + cutDirMl = {cuts_ml::CutNot}; + o2::framework::LabeledArray mycutsMl(cutValues.data(), 1, 1, std::vector{"pT bin 0"}, std::vector{"score"}); + matchingMlResponse.configure(binsPtMl, mycutsMl, cutDirMl, 1); + matchingMlResponse.setModelPathsCCDB(fConfigVariousOptions.fModelNames.value, fCCDBApi, fConfigVariousOptions.fModelPathsCCDB.value, fConfigCCDB.timestampCCDB.value); + matchingMlResponse.cacheInputFeaturesIndices(fConfigVariousOptions.fInputFeatures.value); + matchingMlResponse.init(); + } } void DefineCuts() @@ -882,6 +909,12 @@ struct TableMakerMC { if (static_cast(muon.trackType()) < 2) { auto muonID = muon.matchMCHTrackId(); auto chi2 = muon.chi2MatchMCHMFT(); + if (fConfigVariousOptions.fUseML.value) { + std::vector output; + std::vector inputML = matchingMlResponse.getInputFeaturesTest(muon); + matchingMlResponse.isSelectedMl(inputML, 0, output); + chi2 = output[0]; + } if (mCandidates.find(muonID) == mCandidates.end()) { mCandidates[muonID] = {chi2, muon.globalIndex()}; } else { From 5de386c82614258fbb843f0d737df51b30b52e0d Mon Sep 17 00:00:00 2001 From: Victor Gonzalez Date: Fri, 19 Sep 2025 22:01:23 +0200 Subject: [PATCH 462/986] [PWGCF] DptDpt - Consistent access to CCDB per period (#13054) Co-authored-by: Victor --- PWGCF/TableProducer/dptDptFilter.cxx | 53 ++++++++++++++-------------- PWGCF/TableProducer/dptDptFilter.h | 28 +++++++++++---- PWGCF/Tasks/dptDptCorrelations.cxx | 15 ++++---- 3 files changed, 55 insertions(+), 41 deletions(-) diff --git a/PWGCF/TableProducer/dptDptFilter.cxx b/PWGCF/TableProducer/dptDptFilter.cxx index dcdfec15498..25f54b5bdc8 100644 --- a/PWGCF/TableProducer/dptDptFilter.cxx +++ b/PWGCF/TableProducer/dptDptFilter.cxx @@ -108,7 +108,7 @@ enum BeforeAfter { }; static const std::vector beforeAfterName = {"before", "before outliers exclusion", ""}; -static const std::vector beforeAfterSufix = {"B", "BO", "A"}; +static const std::vector beforeAfterSuffix = {"B", "BO", "A"}; /* helpers for the multiplicity axes definition */ static constexpr float MultiplicityUpperLimitBase[11][8] = { @@ -538,9 +538,10 @@ struct DptDptFilter { struct : ConfigurableGroup { std::string prefix = "cfgCCDB"; Configurable url{"url", "http://ccdb-test.cern.ch:8080", "The CCDB url for the input file"}; - Configurable pathName{"pathName", "", "The CCDB path for the input file. Default \"\", i.e. don't load from CCDB"}; + Configurable pathNameCorrections{"pathNameCorrections", "", "The CCDB path for the corrections file. Default \"\", i.e. don't load from CCDB"}; + Configurable pathNamePID{"pathNamePID", "", "The CCDB path for the PID adjusts file. Default \"\", i.e. don't load from CCDB"}; Configurable date{"date", "20220307", "The CCDB date for the input file"}; - Configurable period{"period", "LHC22o", "The CCDB dataset period for the input file"}; + Configurable suffix{"suffix", "", "Dataset period suffix for metadata discrimination"}; } cfginputfile; Configurable cfgFullDerivedData{"cfgFullDerivedData", false, "Produce the full derived data for external storage. Default false"}; Configurable cfgCentMultEstimator{"cfgCentMultEstimator", "V0M", "Centrality/multiplicity estimator detector: V0M,CL0,CL1,FV0A,FT0M,FT0A,FT0C,NTPV,NOCM: none. Default V0M"}; @@ -683,23 +684,23 @@ struct DptDptFilter { if (cfgEventSelection.fillQc) { /* the quality control histograms */ for (int i = 0; i < BeforeAfterNOOFTIMES; ++i) { - fhMultiplicityVsCentrality[i] = new TH2F(TString::Format("MultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);Global tracks", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); - fhMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsT0cMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0C Multiplicity;Global tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0C), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); - fhMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsT0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0A Multiplicity;Global tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0A), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); - fhMultiplicityVsV0aMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsV0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;V0A Multiplicity;Global tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceV0A), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); - fhMultiplicityVsPvMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsPvMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;PV contributors;Global tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); - fhPvMultiplicityVsCentrality[i] = new TH2F(TString::Format("PvMultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);PV contributors", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); - fhPvMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("PvMultiplicityVsT0cMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0C multiplicity;PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0C), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); - fhPvMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("PvMultiplicityVsT0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0A multiplicity;PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0A), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); - fhPvMultiplicityVsV0aMultiplicity[i] = new TH2F(TString::Format("PvMultiplicityVsV0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;V0A multiplicity;PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceV0A), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); - fhV0aMultiplicityVsCentrality[i] = new TH2F(TString::Format("V0aMultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);V0A multiplicity", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourceV0A)); - fhV0aMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("V0aMultiplicityVsT0cMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0C multiplicity;V0A multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0C), DPTDPTMULTIPLICITYAXIS(MultSourceV0A)); - fhV0aMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("V0aMultiplicityVsT0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0A multiplicity;V0A multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0A), DPTDPTMULTIPLICITYAXIS(MultSourceV0A)); - fhT0cMultiplicityVsCentrality[i] = new TH2F(TString::Format("T0cMultiplicityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);T0C multiplicity", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourceT0C)); - fhT0cMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("T0cMultiplicityVsT0aMultiplicity%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;T0A multiplicity;T0C multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0A), DPTDPTMULTIPLICITYAXIS(MultSourceT0C)); - fhT0CentralityVsCentrality[i] = new TH2F(TString::Format("T0CentralityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);T0 centrality(%%)", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTCENTRALITYAXIS); - fhV0aCentralityVsCentrality[i] = new TH2F(TString::Format("V0aCentralityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);V0A centrality (%%)", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTCENTRALITYAXIS); - fhNtpvCentralityVsCentrality[i] = new TH2F(TString::Format("NtpvCentralityVsCentrality%s", beforeAfterSufix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);NTPV centrality (%%)", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTCENTRALITYAXIS); + fhMultiplicityVsCentrality[i] = new TH2F(TString::Format("MultiplicityVsCentrality%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);Global tracks", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); + fhMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsT0cMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;T0C Multiplicity;Global tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0C), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); + fhMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsT0aMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;T0A Multiplicity;Global tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0A), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); + fhMultiplicityVsV0aMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsV0aMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;V0A Multiplicity;Global tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceV0A), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); + fhMultiplicityVsPvMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsPvMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;PV contributors;Global tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); + fhPvMultiplicityVsCentrality[i] = new TH2F(TString::Format("PvMultiplicityVsCentrality%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);PV contributors", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); + fhPvMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("PvMultiplicityVsT0cMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;T0C multiplicity;PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0C), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); + fhPvMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("PvMultiplicityVsT0aMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;T0A multiplicity;PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0A), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); + fhPvMultiplicityVsV0aMultiplicity[i] = new TH2F(TString::Format("PvMultiplicityVsV0aMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;V0A multiplicity;PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceV0A), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); + fhV0aMultiplicityVsCentrality[i] = new TH2F(TString::Format("V0aMultiplicityVsCentrality%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);V0A multiplicity", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourceV0A)); + fhV0aMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("V0aMultiplicityVsT0cMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;T0C multiplicity;V0A multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0C), DPTDPTMULTIPLICITYAXIS(MultSourceV0A)); + fhV0aMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("V0aMultiplicityVsT0aMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;T0A multiplicity;V0A multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0A), DPTDPTMULTIPLICITYAXIS(MultSourceV0A)); + fhT0cMultiplicityVsCentrality[i] = new TH2F(TString::Format("T0cMultiplicityVsCentrality%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);T0C multiplicity", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourceT0C)); + fhT0cMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("T0cMultiplicityVsT0aMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;T0A multiplicity;T0C multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0A), DPTDPTMULTIPLICITYAXIS(MultSourceT0C)); + fhT0CentralityVsCentrality[i] = new TH2F(TString::Format("T0CentralityVsCentrality%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);T0 centrality(%%)", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTCENTRALITYAXIS); + fhV0aCentralityVsCentrality[i] = new TH2F(TString::Format("V0aCentralityVsCentrality%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);V0A centrality (%%)", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTCENTRALITYAXIS); + fhNtpvCentralityVsCentrality[i] = new TH2F(TString::Format("NtpvCentralityVsCentrality%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);NTPV centrality (%%)", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTCENTRALITYAXIS); } } @@ -1099,9 +1100,8 @@ struct DptDptFilterTracks { bool storedccdbinfo = false; std::string cfgCCDBUrl{"http://ccdb-test.cern.ch:8080"}; - std::string cfgCCDBPathName{""}; + std::string cfgCCDBPathNamePID{""}; std::string cfgCCDBDate{"20220307"}; - std::string cfgCCDBPeriod{"LHC22o"}; Configurable cfgOutDebugInfo{"cfgOutDebugInfo", false, "Out detailed debug information per track into a text file. Default false"}; Configurable cfgFullDerivedData{"cfgFullDerivedData", false, "Produce the full derived data for external storage. Default false"}; @@ -1171,9 +1171,8 @@ struct DptDptFilterTracks { } /* self configure the CCDB access to the input file */ getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.url", cfgCCDBUrl, false); - getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.pathName", cfgCCDBPathName, false); + getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.pathNamePID", cfgCCDBPathNamePID, false); getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.date", cfgCCDBDate, false); - getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.period", cfgCCDBPeriod, false); /* create the output list which will own the task histograms */ TList* fOutputList = new TList(); @@ -1440,9 +1439,9 @@ struct DptDptFilterTracks { using namespace analysis::dptdptfilter; /* let's get a potential PID adjustment */ - if (cfgCCDBPathName.length() > 0 && !storedccdbinfo) { - LOGF(info, "Getting information for PID adjustment from %s, at %s, for %s", cfgCCDBPathName.c_str(), cfgCCDBDate.c_str(), cfgCCDBPeriod.c_str()); - TList* pidinfo = getCCDBInput(ccdb, cfgCCDBPathName.c_str(), cfgCCDBDate.c_str(), cfgCCDBPeriod.c_str()); + if ((cfgCCDBDate.length() > 0) && (cfgCCDBPathNamePID.length() > 0) && !storedccdbinfo) { + LOGF(info, "Getting information for PID adjustment from %s, at %s", cfgCCDBPathNamePID.c_str(), cfgCCDBDate.c_str()); + TList* pidinfo = getCCDBInput(ccdb, cfgCCDBPathNamePID.c_str(), cfgCCDBDate.c_str()); if (pidinfo != nullptr) { pidselector.storePIDAdjustments(pidinfo); } diff --git a/PWGCF/TableProducer/dptDptFilter.h b/PWGCF/TableProducer/dptDptFilter.h index 5e1a479631e..5af712a2ec7 100644 --- a/PWGCF/TableProducer/dptDptFilter.h +++ b/PWGCF/TableProducer/dptDptFilter.h @@ -804,7 +804,7 @@ struct DptDptTrackSelection { bool requirePvContributor = false; }; -inline TList* getCCDBInput(auto& ccdb, const char* ccdbpath, const char* ccdbdate, const char* period = "") +inline TList* getCCDBInput(auto& ccdb, const char* ccdbpath, const char* ccdbdate, bool periodInPath = false, const std::string& suffix = "") { std::tm cfgtm = {}; std::stringstream ss(ccdbdate); @@ -812,13 +812,27 @@ inline TList* getCCDBInput(auto& ccdb, const char* ccdbpath, const char* ccdbdat cfgtm.tm_hour = 12; int64_t timestamp = std::mktime(&cfgtm) * 1000; - TList* lst = nullptr; - if (std::strlen(period) != 0) { - std::map metadata{{"Period", period}}; - lst = ccdb->template getSpecific(ccdbpath, timestamp, metadata); - } else { - lst = ccdb->template getForTimeStamp(ccdbpath, timestamp); + auto cleanPeriod = [](const auto& str) { + std::string tmpStr = str; + size_t pos = tmpStr.find('_'); + if (pos != std::string::npos) { + tmpStr.erase(pos); + } + return tmpStr; + }; + + std::string actualPeriod = cleanPeriod(metadataInfo.get("LPMProductionTag")); + std::string actualPath = ccdbpath; + if (periodInPath) { + actualPath = actualPath + "/" + actualPeriod; + } + if (suffix.length() > 0) { + actualPeriod = actualPeriod + "_" + suffix; } + + TList* lst = nullptr; + std::map metadata{{"Period", actualPeriod}}; + lst = ccdb->template getSpecific(actualPath, timestamp, metadata); if (lst != nullptr) { LOGF(info, "Correctly loaded CCDB input object"); } else { diff --git a/PWGCF/Tasks/dptDptCorrelations.cxx b/PWGCF/Tasks/dptDptCorrelations.cxx index ffe62250ca9..3b5877a9966 100644 --- a/PWGCF/Tasks/dptDptCorrelations.cxx +++ b/PWGCF/Tasks/dptDptCorrelations.cxx @@ -908,9 +908,9 @@ struct DptDptCorrelations { TList* ccdblst = nullptr; bool loadfromccdb = false; std::string cfgCCDBUrl{"http://ccdb-test.cern.ch:8080"}; - std::string cfgCCDBPathName{""}; + std::string cfgCCDBPathNameCorrections{""}; std::string cfgCCDBDate{"20220307"}; - std::string cfgCCDBPeriod{"LHC22o"}; + std::string cfgCCDBSuffix{""}; /* pair conversion suppression defaults */ static constexpr float kCfgPairCutDefaults[1][5] = {{-1, -1, -1, -1, -1}}; @@ -972,10 +972,10 @@ struct DptDptCorrelations { /* self configure the CCDB access to the input file */ getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.url", cfgCCDBUrl, false); - getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.pathName", cfgCCDBPathName, false); + getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.pathNameCorrections", cfgCCDBPathNameCorrections, false); getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.date", cfgCCDBDate, false); - getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.period", cfgCCDBPeriod, false); - loadfromccdb = cfgCCDBPathName.length() > 0; + getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.suffix", cfgCCDBSuffix, false); + loadfromccdb = (cfgCCDBDate.length() > 0) && (cfgCCDBPathNameCorrections.length() > 0); /* update the potential binning change */ etabinwidth = (etaup - etalow) / static_cast(etabins); @@ -1230,7 +1230,7 @@ struct DptDptCorrelations { if (ccdblst == nullptr) { if (loadfromccdb) { - ccdblst = getCCDBInput(ccdb, cfgCCDBPathName.c_str(), cfgCCDBDate.c_str()); + ccdblst = getCCDBInput(ccdb, cfgCCDBPathNameCorrections.c_str(), cfgCCDBDate.c_str(), true, cfgCCDBSuffix); } } @@ -1326,7 +1326,7 @@ struct DptDptCorrelations { if (ccdblst == nullptr) { if (loadfromccdb) { - ccdblst = getCCDBInput(ccdb, cfgCCDBPathName.c_str(), cfgCCDBDate.c_str()); + ccdblst = getCCDBInput(ccdb, cfgCCDBPathNameCorrections.c_str(), cfgCCDBDate.c_str(), true, cfgCCDBSuffix); } } @@ -1646,6 +1646,7 @@ struct DptDptCorrelations { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { + o2::analysis::dptdptfilter::metadataInfo.initMetadata(cfgc); WorkflowSpec workflow{ adaptAnalysisTask(cfgc, TaskName{"DptDptCorrelationsRec"}, SetDefaultProcesses{{{"processRecLevel", true}, {"processRecLevelMixed", false}, {"processCleaner", false}}}), // o2-linter: disable=name/o2-task (It is adapted multiple times) adaptAnalysisTask(cfgc, TaskName{"DptDptCorrelationsGen"}, SetDefaultProcesses{{{"processGenLevel", false}, {"processGenLevelMixed", false}, {"processCleaner", true}}})}; // o2-linter: disable=name/o2-task (It is adapted multiple times) From 89f10b1315952229a3103ba44f8a3b5496ed3771 Mon Sep 17 00:00:00 2001 From: abmodak <67369858+abmodak@users.noreply.github.com> Date: Fri, 19 Sep 2025 22:05:25 +0200 Subject: [PATCH 463/986] [PWGCF] Update longrangeCorrelation task (#13053) Co-authored-by: ALICE Action Bot --- .../Tasks/longrangeCorrelation.cxx | 334 +++++------------- 1 file changed, 94 insertions(+), 240 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx index fdf69531056..6d6b811b66b 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx @@ -83,13 +83,12 @@ enum KindOfEvntType { enum KindOfCorrType { kFT0AGLOBAL, kFT0CGLOBAL, - kFV0GLOBAL, kMFTGLOBAL, - kFV0MFT, - kFT0AMFT + kFT0AMFT, + kFT0AFT0C }; -static constexpr std::string_view kCorrType[] = {"Ft0aGlobal/", "Ft0cGlobal/", "Fv0Global/", "MftGlobal/", "Fv0Mft/", "Ft0aMft/"}; +static constexpr std::string_view kCorrType[] = {"Ft0aGlobal/", "Ft0cGlobal/", "MftGlobal/", "Ft0aMft/", "Ft0aFt0c"}; static constexpr std::string_view kEvntType[] = {"SE/", "ME/"}; AxisSpec axisEvent{10, 0.5, 9.5, "#Event", "EventAxis"}; @@ -105,7 +104,6 @@ struct LongrangeCorrelation { Service ccdb; o2::ccdb::CcdbApi ccdbApi; std::vector* offsetFT0; - std::vector* offsetFV0; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; Configurable cfgVtxCut{"cfgVtxCut", 10.0f, "Vertex Z range to consider"}; Configurable cfgEtaCut{"cfgEtaCut", 1.0f, "Eta range to consider"}; @@ -146,9 +144,7 @@ struct LongrangeCorrelation { using MftTrkTable = soa::Filtered; Preslice perColGlobal = aod::track::collisionId; Preslice perColMft = aod::fwdtrack::collisionId; - o2::ft0::Geometry ft0Det; - o2::fv0::Geometry* fv0Det; OutputObj sameFt0aGlobal{Form("sameEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; OutputObj mixedFt0aGlobal{Form("mixedEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; @@ -156,12 +152,10 @@ struct LongrangeCorrelation { OutputObj mixedFt0cGlobal{Form("mixedEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; OutputObj sameMftGlobal{Form("sameEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; OutputObj mixedMftGlobal{Form("mixedEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; - OutputObj sameFv0Global{Form("sameEventFv0Global_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; - OutputObj mixedFv0Global{Form("mixedEventFv0Global_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; - OutputObj sameFv0Mft{Form("sameEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; - OutputObj mixedFv0Mft{Form("mixedEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; OutputObj sameFt0aMft{Form("sameEventFt0aMft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; OutputObj mixedFt0aMft{Form("mixedEventFt0aMft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; + OutputObj sameFt0aFt0c{Form("sameEventFt0aFt0c_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; + OutputObj mixedFt0aFt0c{Form("mixedEventFt0aFt0c_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; template void addHistos() @@ -189,11 +183,8 @@ struct LongrangeCorrelation { ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); LOGF(info, "Getting alignment offsets from the CCDB..."); offsetFT0 = ccdb->getForTimeStamp>("FT0/Calib/Align", cfgCcdbParam.noLaterThan.value); - offsetFV0 = ccdb->getForTimeStamp>("FV0/Calib/Align", cfgCcdbParam.noLaterThan.value); LOGF(info, "Offset for FT0A: x = %.3f y = %.3f z = %.3f\n", (*offsetFT0)[0].getX(), (*offsetFT0)[0].getY(), (*offsetFT0)[0].getZ()); LOGF(info, "Offset for FT0C: x = %.3f y = %.3f z = %.3f\n", (*offsetFT0)[1].getX(), (*offsetFT0)[1].getY(), (*offsetFT0)[1].getZ()); - LOGF(info, "Offset for FV0-left: x = %.3f y = %.3f z = %.3f\n", (*offsetFV0)[0].getX(), (*offsetFV0)[0].getY(), (*offsetFV0)[0].getZ()); - LOGF(info, "Offset for FV0-right: x = %.3f y = %.3f z = %.3f\n", (*offsetFV0)[1].getX(), (*offsetFV0)[1].getY(), (*offsetFV0)[1].getZ()); std::vector corrAxis = {{axisSample, "Sample"}, {axisVtxZ, "z-vtx (cm)"}, @@ -207,8 +198,6 @@ struct LongrangeCorrelation { std::vector userAxis; - fv0Det = o2::fv0::Geometry::instance(o2::fv0::Geometry::eUninitialized); - if (doprocessEventStat) { histos.add("QA/EventHist", "events", kTH1F, {axisEvent}, false); histos.add("QA/VtxZHist", "v_{z} (cm)", kTH1F, {axisVtxZ}, false); @@ -236,13 +225,6 @@ struct LongrangeCorrelation { mixedFt0cGlobal.setObject(new CorrelationContainer(Form("mixedEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); } - if (doprocessFv0GlobalSE || doprocessFv0GlobalME) { - addHistos(); - addHistos(); - sameFv0Global.setObject(new CorrelationContainer(Form("sameEventFv0Global_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFv0Global_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); - mixedFv0Global.setObject(new CorrelationContainer(Form("mixedEventFv0Global_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFv0Global_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); - } - if (doprocessMftGlobalSE || doprocessMftGlobalME) { addHistos(); addHistos(); @@ -250,19 +232,19 @@ struct LongrangeCorrelation { mixedMftGlobal.setObject(new CorrelationContainer(Form("mixedEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); } - if (doprocessFv0MftSE || doprocessFv0MftME) { - addHistos(); - addHistos(); - sameFv0Mft.setObject(new CorrelationContainer(Form("sameEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); - mixedFv0Mft.setObject(new CorrelationContainer(Form("mixedEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); - } - if (doprocessFt0aMftSE || doprocessFt0aMftME) { addHistos(); addHistos(); sameFt0aMft.setObject(new CorrelationContainer(Form("sameEventFt0aMft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFt0aMft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); mixedFt0aMft.setObject(new CorrelationContainer(Form("mixedEventFt0aMft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFt0aMft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); } + + if (doprocessFt0aFt0cSE || doprocessFt0aFt0cME) { + addHistos(); + addHistos(); + sameFt0aFt0c.setObject(new CorrelationContainer(Form("sameEventFt0aFt0c_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFt0aFt0c_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); + mixedFt0aFt0c.setObject(new CorrelationContainer(Form("mixedEventFt0aFt0c_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFt0aFt0c_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); + } } Filter fTrackSelectionITS = ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) && @@ -285,27 +267,6 @@ struct LongrangeCorrelation { return RecoDecay::phi(chPos.X() + (*offsetFT0)[i].getX(), chPos.Y() + (*offsetFT0)[i].getY()); } - double getPhiFV0(uint chno) - { - int cellsInLeft[] = {0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27, 32, 40, 33, 41, 34, 42, 35, 43}; - bool isChnoInLeft = std::find(std::begin(cellsInLeft), std::end(cellsInLeft), chno) != std::end(cellsInLeft); - float offsetX, offsetY; - if (isChnoInLeft) { - offsetX = (*offsetFV0)[0].getX(); - offsetY = (*offsetFV0)[0].getY(); - } else { - offsetX = (*offsetFV0)[1].getX(); - offsetY = (*offsetFV0)[1].getY(); - } - - o2::fv0::Point3Dsimple chPos; - if (isReadoutCenter) - chPos = fv0Det->getReadoutCenter(chno); - else - chPos = fv0Det->getCellCenter(chno); - return RecoDecay::phi(chPos.x + offsetX, chPos.y + offsetY); - } - double getEtaFT0(uint chno, int i) { ft0Det.calculateChannelCenter(); @@ -318,35 +279,6 @@ struct LongrangeCorrelation { return -std::log(std::tan(0.5 * theta)); } - double getEtaFV0(uint chno) - { - int cellsInLeft[] = {0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27, 32, 40, 33, 41, 34, 42, 35, 43}; - bool isChnoInLeft = std::find(std::begin(cellsInLeft), std::end(cellsInLeft), chno) != std::end(cellsInLeft); - float offsetX, offsetY, offsetZ; - if (isChnoInLeft) { - offsetX = (*offsetFV0)[0].getX(); - offsetY = (*offsetFV0)[0].getY(); - offsetZ = (*offsetFV0)[0].getZ(); - } else { - offsetX = (*offsetFV0)[1].getX(); - offsetY = (*offsetFV0)[1].getY(); - offsetZ = (*offsetFV0)[1].getZ(); - } - - o2::fv0::Point3Dsimple chPos; - if (isReadoutCenter) - chPos = fv0Det->getReadoutCenter(chno); - else - chPos = fv0Det->getCellCenter(chno); - - auto x = chPos.x + offsetX; - auto y = chPos.y + offsetY; - auto z = chPos.z + offsetZ; - auto r = std::sqrt(x * x + y * y); - auto theta = std::atan2(r, z); - return -std::log(std::tan(0.5 * theta)); - } - template bool isEventSelected(CheckCol const& col) { @@ -380,7 +312,7 @@ struct LongrangeCorrelation { histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("hMult"), tracks.size()); for (auto const& iTrk : tracks) { auto phi = iTrk.phi(); - if constexpr (corrType == kFV0MFT || corrType == kFT0AMFT) { + if constexpr (corrType == kFT0AMFT) { o2::math_utils::bringTo02Pi(phi); } histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_etavsphi"), phi, iTrk.eta()); @@ -443,7 +375,7 @@ struct LongrangeCorrelation { histos.fill(HIST("Ft0cGlobal/SE/Trig_hist"), fSampleIndex, vz, triggerTrack.pt()); for (std::size_t iCh = 0; iCh < ft0.channelC().size(); iCh++) { - auto chanelid = ft0.channelC()[iCh]; + auto chanelid = ft0.channelC()[iCh] + 96; float ampl = ft0.amplitudeC()[iCh]; if (mixing) @@ -510,97 +442,6 @@ struct LongrangeCorrelation { } // trigger tracks } // fillCorrMftGlobal - template - void fillCorrFv0Global(TTarget target, TTriggers const& triggers, TFV0s const& fv0, bool mixing, float vz) - { - int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); - if (!mixing) - histos.fill(HIST("Fv0Global/SE/hMult_used"), triggers.size()); - for (auto const& triggerTrack : triggers) { - if (!mixing) - histos.fill(HIST("Fv0Global/SE/Trig_hist"), fSampleIndex, vz, triggerTrack.pt()); - - for (std::size_t iCh = 0; iCh < fv0.channel().size(); iCh++) { - auto chanelid = fv0.channel()[iCh]; - float ampl = fv0.amplitude()[iCh]; - - if (mixing) - histos.fill(HIST("Fv0Global/ME/Assoc_amp"), chanelid, ampl); - else - histos.fill(HIST("Fv0Global/SE/Assoc_amp"), chanelid, ampl); - - auto phi = getPhiFV0(chanelid); - auto eta = getEtaFV0(chanelid); - - if (mixing) { - histos.fill(HIST("Fv0Global/ME/Assoc_eta"), eta); - histos.fill(HIST("Fv0Global/ME/Assoc_phi"), phi); - histos.fill(HIST("Fv0Global/ME/Assoc_etavsphi"), phi, eta); - } else { - histos.fill(HIST("Fv0Global/SE/Assoc_eta"), eta); - histos.fill(HIST("Fv0Global/SE/Assoc_phi"), phi); - histos.fill(HIST("Fv0Global/SE/Assoc_etavsphi"), phi, eta); - } - float deltaPhi = RecoDecay::constrainAngle(triggerTrack.phi() - phi, -PIHalf); - float deltaEta = triggerTrack.eta() - eta; - if (mixing) - histos.fill(HIST("Fv0Global/ME/deltaEta_deltaPhi"), deltaPhi, deltaEta); - else - histos.fill(HIST("Fv0Global/SE/deltaEta_deltaPhi"), deltaPhi, deltaEta); - target->getPairHist()->Fill(step, fSampleIndex, vz, triggerTrack.pt(), triggerTrack.pt(), deltaPhi, deltaEta); - } // associated fv0 tracks - } // trigger tracks - } // fillCorrFv0Global - - template - void fillCorrFv0Mft(TTarget target, TTracks const& tracks, TTriggers const& triggers, TFV0s const& fv0, bool mixing, float vz) - { - int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); - if (!mixing) - histos.fill(HIST("Fv0Mft/SE/hMult_used"), tracks.size()); - for (auto const& triggerTrack : triggers) { - if (!isMftTrackSelected(triggerTrack)) { - continue; - } - if (!mixing) - histos.fill(HIST("Fv0Mft/SE/Trig_hist"), fSampleIndex, vz, triggerTrack.pt()); - - auto trigphi = triggerTrack.phi(); - o2::math_utils::bringTo02Pi(trigphi); - - for (std::size_t iCh = 0; iCh < fv0.channel().size(); iCh++) { - auto chanelid = fv0.channel()[iCh]; - float ampl = fv0.amplitude()[iCh]; - - if (mixing) - histos.fill(HIST("Fv0Mft/ME/Assoc_amp"), chanelid, ampl); - else - histos.fill(HIST("Fv0Mft/SE/Assoc_amp"), chanelid, ampl); - - auto phi = getPhiFV0(chanelid); - auto eta = getEtaFV0(chanelid); - - if (mixing) { - histos.fill(HIST("Fv0Mft/ME/Assoc_eta"), eta); - histos.fill(HIST("Fv0Mft/ME/Assoc_phi"), phi); - histos.fill(HIST("Fv0Mft/ME/Assoc_etavsphi"), phi, eta); - } else { - histos.fill(HIST("Fv0Mft/SE/Assoc_eta"), eta); - histos.fill(HIST("Fv0Mft/SE/Assoc_phi"), phi); - histos.fill(HIST("Fv0Mft/SE/Assoc_etavsphi"), phi, eta); - } - - float deltaPhi = RecoDecay::constrainAngle(trigphi - phi, -PIHalf); - float deltaEta = triggerTrack.eta() - eta; - if (mixing) - histos.fill(HIST("Fv0Mft/ME/deltaEta_deltaPhi"), deltaPhi, deltaEta); - else - histos.fill(HIST("Fv0Mft/SE/deltaEta_deltaPhi"), deltaPhi, deltaEta); - target->getPairHist()->Fill(step, fSampleIndex, vz, triggerTrack.pt(), triggerTrack.pt(), deltaPhi, deltaEta); - } // associated fv0 tracks - } // trigger tracks - } // fillCorrFv0Mft - template void fillCorrFt0aMft(TTarget target, TTracks const& tracks, TTriggers const& triggers, TFT0s const& ft0, bool mixing, float vz) { @@ -650,6 +491,64 @@ struct LongrangeCorrelation { } // trigger tracks } // fillCorrFt0aMft + template + void fillCorrFt0aFt0c(TTarget target, TTriggers const& triggers, TFT0As const& ft0a, TFT0Cs const& ft0c, bool mixing, float vz) + { + int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); + if (!mixing) + histos.fill(HIST("Ft0aFt0c/SE/hMult_used"), triggers.size()); + + for (std::size_t iChA = 0; iChA < ft0a.channelA().size(); iChA++) { + if (!mixing) + histos.fill(HIST("Ft0aFt0c/SE/Trig_hist"), fSampleIndex, vz, -1); + + auto chanelidA = ft0a.channelA()[iChA]; + auto phiA = getPhiFT0(chanelidA, 0); + auto etaA = getEtaFT0(chanelidA, 0); + + if (mixing) { + histos.fill(HIST("Ft0aFt0c/ME/Trig_eta"), etaA); + histos.fill(HIST("Ft0aFt0c/ME/Trig_phi"), phiA); + histos.fill(HIST("Ft0aFt0c/ME/Trig_etavsphi"), phiA, etaA); + } else { + histos.fill(HIST("Ft0aFt0c/SE/Trig_eta"), etaA); + histos.fill(HIST("Ft0aFt0c/SE/Trig_phi"), phiA); + histos.fill(HIST("Ft0aFt0c/SE/Trig_etavsphi"), phiA, etaA); + } + + for (std::size_t iChC = 0; iChC < ft0c.channelC().size(); iChC++) { + + auto chanelidC = ft0c.channelC()[iChC] + 96; + float ampl = ft0c.amplitudeC()[iChC]; + auto phiC = getPhiFT0(chanelidC, 1); + auto etaC = getEtaFT0(chanelidC, 1); + + if (mixing) + histos.fill(HIST("Ft0aFt0c/ME/Assoc_amp"), chanelidC, ampl); + else + histos.fill(HIST("Ft0aFt0c/SE/Assoc_amp"), chanelidC, ampl); + + if (mixing) { + histos.fill(HIST("Ft0aFt0c/ME/Assoc_eta"), etaC); + histos.fill(HIST("Ft0aFt0c/ME/Assoc_phi"), phiC); + histos.fill(HIST("Ft0aFt0c/ME/Assoc_etavsphi"), phiC, etaC); + } else { + histos.fill(HIST("Ft0aFt0c/SE/Assoc_eta"), etaC); + histos.fill(HIST("Ft0aFt0c/SE/Assoc_phi"), phiC); + histos.fill(HIST("Ft0aFt0c/SE/Assoc_etavsphi"), phiC, etaC); + } + + float deltaPhi = RecoDecay::constrainAngle(phiA - phiC, -PIHalf); + float deltaEta = etaA - etaC; + if (mixing) + histos.fill(HIST("Ft0aFt0c/ME/deltaEta_deltaPhi"), deltaPhi, deltaEta); + else + histos.fill(HIST("Ft0aFt0c/SE/deltaEta_deltaPhi"), deltaPhi, deltaEta); + target->getPairHist()->Fill(step, fSampleIndex, vz, -1, -1, deltaPhi, deltaEta); + } // associated ft0 tracks + } // trigger tracks + } // fillCorrFt0aFt0c + void processEventStat(CollTable::iterator const& col) { histos.fill(HIST("QA/EventHist"), 1); @@ -714,48 +613,33 @@ struct LongrangeCorrelation { fillCorrMftGlobal(sameMftGlobal, tracks, mfttracks, false, col.posZ()); } // same event - void processFv0GlobalSE(CollTable::iterator const& col, aod::FV0As const&, TrksTable const& tracks) - { - if (!isEventSelected(col)) { - return; - } - if (col.has_foundFV0()) { - fillYield(tracks); - const auto& fv0 = col.foundFV0(); - if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { - return; - } - fillCorrFv0Global(sameFv0Global, tracks, fv0, false, col.posZ()); - } - } // same event - - void processFv0MftSE(CollTable::iterator const& col, aod::FV0As const&, TrksTable const& tracks, MftTrkTable const& mfttracks) + void processFt0aMftSE(CollTable::iterator const& col, aod::FT0s const&, TrksTable const& tracks, MftTrkTable const& mfttracks) { if (!isEventSelected(col)) { return; } - if (col.has_foundFV0()) { - fillYield(mfttracks); - const auto& fv0 = col.foundFV0(); + if (col.has_foundFT0()) { + fillYield(mfttracks); + const auto& ft0 = col.foundFT0(); if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { return; } - fillCorrFv0Mft(sameFv0Mft, tracks, mfttracks, fv0, false, col.posZ()); + fillCorrFt0aMft(sameFt0aMft, tracks, mfttracks, ft0, false, col.posZ()); } } // same event - void processFt0aMftSE(CollTable::iterator const& col, aod::FT0s const&, TrksTable const& tracks, MftTrkTable const& mfttracks) + void processFt0aFt0cSE(CollTable::iterator const& col, aod::FT0s const&, TrksTable const& tracks) { if (!isEventSelected(col)) { return; } if (col.has_foundFT0()) { - fillYield(mfttracks); + histos.fill(HIST("Ft0aFt0c/SE/hMult"), tracks.size()); const auto& ft0 = col.foundFT0(); if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { return; } - fillCorrFt0aMft(sameFt0aMft, tracks, mfttracks, ft0, false, col.posZ()); + fillCorrFt0aFt0c(sameFt0aFt0c, tracks, ft0, ft0, false, col.posZ()); } } // same event @@ -837,35 +721,7 @@ struct LongrangeCorrelation { } } // mixed event - void processFv0GlobalME(CollTable const& col, aod::FV0As const&, TrksTable const& tracks) - { - auto getTracksSize = [&tracks, this](CollTable::iterator const& collision) { - auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), this->cache); - return associatedTracks.size(); - }; - - using MixedBinning = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getTracksSize)>; - MixedBinning binningOnVtxAndMult{{getTracksSize}, {axisVtxZME, axisMultME}, true}; - for (auto const& [col1, col2] : soa::selfCombinations(binningOnVtxAndMult, mixingParameter, -1, col, col)) { - if (!isEventSelected(col1) || !isEventSelected(col2)) { - continue; - } - if (col1.globalIndex() == col2.globalIndex()) { - continue; - } - if (col1.has_foundFV0() && col2.has_foundFV0()) { - auto slicedTriggerTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); - fillYield(slicedTriggerTracks); - const auto& fv0 = col2.foundFV0(); - if (slicedTriggerTracks.size() < cfgMinMult || slicedTriggerTracks.size() >= cfgMaxMult) { - continue; - } - fillCorrFv0Global(mixedFv0Global, slicedTriggerTracks, fv0, true, col1.posZ()); - } - } - } // mixed event - - void processFv0MftME(CollTable const& col, aod::FV0As const&, TrksTable const& tracks, MftTrkTable const& mfttracks) + void processFt0aMftME(CollTable const& col, aod::FT0s const&, TrksTable const& tracks, MftTrkTable const& mfttracks) { auto getTracksSize = [&tracks, this](CollTable::iterator const& collision) { auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), this->cache); @@ -881,20 +737,20 @@ struct LongrangeCorrelation { if (col1.globalIndex() == col2.globalIndex()) { continue; } - if (col1.has_foundFV0() && col2.has_foundFV0()) { + if (col1.has_foundFT0() && col2.has_foundFT0()) { auto slicedGlobalTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); auto slicedTriggerMftTracks = mfttracks.sliceBy(perColMft, col1.globalIndex()); - fillYield(slicedTriggerMftTracks); - const auto& fv0 = col2.foundFV0(); + fillYield(slicedTriggerMftTracks); + const auto& ft0 = col2.foundFT0(); if (slicedGlobalTracks.size() < cfgMinMult || slicedGlobalTracks.size() >= cfgMaxMult) { continue; } - fillCorrFv0Mft(mixedFv0Mft, slicedGlobalTracks, slicedTriggerMftTracks, fv0, true, col1.posZ()); + fillCorrFt0aMft(mixedFt0aMft, slicedGlobalTracks, slicedTriggerMftTracks, ft0, true, col1.posZ()); } } } // mixed event - void processFt0aMftME(CollTable const& col, aod::FT0s const&, TrksTable const& tracks, MftTrkTable const& mfttracks) + void processFt0aFt0cME(CollTable const& col, aod::FT0s const&, TrksTable const& tracks) { auto getTracksSize = [&tracks, this](CollTable::iterator const& collision) { auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), this->cache); @@ -911,14 +767,14 @@ struct LongrangeCorrelation { continue; } if (col1.has_foundFT0() && col2.has_foundFT0()) { - auto slicedGlobalTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); - auto slicedTriggerMftTracks = mfttracks.sliceBy(perColMft, col1.globalIndex()); - fillYield(slicedTriggerMftTracks); - const auto& ft0 = col2.foundFT0(); - if (slicedGlobalTracks.size() < cfgMinMult || slicedGlobalTracks.size() >= cfgMaxMult) { + auto slicedTriggerTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); + histos.fill(HIST("Ft0aFt0c/ME/hMult"), slicedTriggerTracks.size()); + const auto& ft0a = col1.foundFT0(); + const auto& ft0c = col2.foundFT0(); + if (slicedTriggerTracks.size() < cfgMinMult || slicedTriggerTracks.size() >= cfgMaxMult) { continue; } - fillCorrFt0aMft(mixedFt0aMft, slicedGlobalTracks, slicedTriggerMftTracks, ft0, true, col1.posZ()); + fillCorrFt0aFt0c(mixedFt0aFt0c, slicedTriggerTracks, ft0a, ft0c, true, col1.posZ()); } } } // mixed event @@ -930,12 +786,10 @@ struct LongrangeCorrelation { PROCESS_SWITCH(LongrangeCorrelation, processFt0cGlobalME, "mixed event FT0c vs global", false); PROCESS_SWITCH(LongrangeCorrelation, processMftGlobalSE, "same event MFT vs global", false); PROCESS_SWITCH(LongrangeCorrelation, processMftGlobalME, "mixed event MFT vs global", false); - PROCESS_SWITCH(LongrangeCorrelation, processFv0GlobalSE, "same event FV0 vs global", false); - PROCESS_SWITCH(LongrangeCorrelation, processFv0GlobalME, "mixed event FV0 vs global", false); - PROCESS_SWITCH(LongrangeCorrelation, processFv0MftSE, "same event FV0 vs MFT", false); - PROCESS_SWITCH(LongrangeCorrelation, processFv0MftME, "mixed event FV0 vs MFT", false); PROCESS_SWITCH(LongrangeCorrelation, processFt0aMftSE, "same event FT0a vs MFT", false); PROCESS_SWITCH(LongrangeCorrelation, processFt0aMftME, "mixed event FT0a vs MFT", false); + PROCESS_SWITCH(LongrangeCorrelation, processFt0aFt0cSE, "same event FT0a vs FT0c", false); + PROCESS_SWITCH(LongrangeCorrelation, processFt0aFt0cME, "mixed event FT0a vs FT0c", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From a50034ca22ec3e0e29fd8323767b9a0f38f1b0c2 Mon Sep 17 00:00:00 2001 From: Gyula Bencedi Date: Fri, 19 Sep 2025 23:38:13 +0200 Subject: [PATCH 464/986] [PWGLF] Updated dEdx calibration objects (#13045) --- .../GlobalEventProperties/flattenictyPikp.cxx | 172 ++++++++++++++---- 1 file changed, 141 insertions(+), 31 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx b/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx index 21784752a8e..c6bc03db737 100644 --- a/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx @@ -63,6 +63,7 @@ #include #include +using std::string; using namespace o2; using namespace o2::framework; using namespace o2::constants::math; @@ -216,6 +217,7 @@ struct FlattenictyPikp { Configurable applyCalibGain{"applyCalibGain", false, "equalize detector amplitudes"}; Configurable applyCalibVtx{"applyCalibVtx", false, "equalize Amp vs vtx"}; Configurable applyCalibDeDx{"applyCalibDeDx", false, "calibration of dedx signal"}; + Configurable applyCalibDeDxFromCCDB{"applyCalibDeDxFromCCDB", false, "use CCDB-based calibration of dedx signal"}; Configurable cfgFillTrackQaHist{"cfgFillTrackQaHist", false, "fill track QA histograms"}; Configurable cfgFilldEdxCalibHist{"cfgFilldEdxCalibHist", false, "fill dEdx calibration histograms"}; Configurable cfgFilldEdxQaHist{"cfgFilldEdxQaHist", false, "fill dEdx QA histograms"}; @@ -225,8 +227,12 @@ struct FlattenictyPikp { Configurable> paramsFuncMIPpos{"paramsFuncMIPpos", std::vector{-1.f}, "parameters of pol2"}; Configurable> paramsFuncMIPneg{"paramsFuncMIPneg", std::vector{-1.f}, "parameters of pol2"}; Configurable> paramsFuncMIPall{"paramsFuncMIPall", std::vector{-1.f}, "parameters of pol2"}; + Configurable> paramsFuncPlateaUpos{"paramsFuncPlateaUpos", std::vector{-1.f}, "parameters of pol2"}; + Configurable> paramsFuncPlateaUneg{"paramsFuncPlateaUneg", std::vector{-1.f}, "parameters of pol2"}; + Configurable> paramsFuncPlateaUall{"paramsFuncPlateaUall", std::vector{-1.f}, "parameters of pol2"}; Configurable cfgGainEqCcdbPath{"cfgGainEqCcdbPath", "Users/g/gbencedi/flattenicity/GainEq", "CCDB path for gain equalization constants"}; Configurable cfgVtxEqCcdbPath{"cfgVtxEqCcdbPath", "Users/g/gbencedi/flattenicity/ZvtxEq", "CCDB path for z-vertex equalization constants"}; + Configurable cfgDeDxCalibCcdbPath{"cfgDeDxCalibCcdbPath", "Users/g/gbencedi/flattenicity/dEdxCalib", "CCDB path for dEdx calibration"}; Configurable cfgUseCcdbForRun{"cfgUseCcdbForRun", true, "Get ccdb object based on run number instead of timestamp"}; Configurable cfgStoreThnSparse{"cfgStoreThnSparse", false, "Store histograms as THnSparse"}; @@ -301,9 +307,6 @@ struct FlattenictyPikp { Configurable cfgNsigmaPrTOF{"cfgNsigmaPrTOF", 3.0, "max nsigma of TOF for proton"}; ConfigurableAxis axisArmPodAlpha{"axisArmPodAlpha", {200, -1.0, 1.0}, "Armenteros-Podolanski alpha"}; ConfigurableAxis axisArmPodqT{"axisArmPodqT", {600, 0.0f, 0.3f}, "Armenteros-Podolanski qT"}; - //!! >>>>>>>> - // Configurable cfgV0DaughterTpcMomMax{"cfgV0DaughterTpcMomMax", 0.6f, "Maximum momentum of V0 daughter tracks in TPC"}; - //!! >>>>>>>> // standad parameters for V0 selection Configurable cfgV0etamax{"cfgV0etamax", 0.8f, "max eta of V0s"}; Configurable cfgTPCnClsmin{"cfgTPCnClsmin", 70.0f, "cfgTPCnClsmin"}; @@ -331,6 +334,7 @@ struct FlattenictyPikp { Configurable cfgArmPodGammasalpha{"cfgArmPodGammasalpha", 0.45f, "Armenteros-Podolanski alpha cut for Gammas"}; Configurable cfgArmPodGammasqT{"cfgArmPodGammasqT", 0.01f, "Armenteros-Podolanski qT cut for Gammas"}; ConfigurableAxis axisGammaMass{"axisGammaMass", {200, 0.0f, 0.5f}, "Gamma mass binning"}; + Configurable cfgdEdxPlateauSel{"cfgdEdxPlateauSel", 5, "dEdx selection sensitivity for electrons"}; } v0SelOpt; Service ccdb; @@ -341,6 +345,17 @@ struct FlattenictyPikp { Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; } ccdbConf; + struct DeDxCalib { + TList* lCalibObjects = nullptr; + TH1F* hMIPcalibPos = nullptr; + TH1F* hMIPcalibNeg = nullptr; + TH1F* hMIPcalibAll = nullptr; + TH1F* hPlateauCalibPos = nullptr; + TH1F* hPlateauCalibNeg = nullptr; + TH1F* hPlateauCalibAll = nullptr; + bool lCalibLoaded = false; + } dedxcalib; + TrackSelection selTrkGlobal; Configurable isCustomTracks{"isCustomTracks", true, "Use custom track cuts"}; Configurable requirePt{"requirePt", 0.15f, "Set minimum pT of tracks"}; @@ -373,26 +388,44 @@ struct FlattenictyPikp { TF1* fPhiCutHigh = nullptr; std::vector> fDeDxVsEta; - std::vector> vecParams; + std::vector> vecParamsMIP; + std::vector> fEDeDxVsEta; + std::vector> vecParamsPLA; void init(InitContext&) { auto vecParamsMIPpos = (std::vector)paramsFuncMIPpos; auto vecParamsMIPneg = (std::vector)paramsFuncMIPneg; auto vecParamsMIPall = (std::vector)paramsFuncMIPall; - - auto addVec = [&](std::vector>& targetVec, const std::string& name) { - targetVec.emplace_back(vecParamsMIPpos); - targetVec.emplace_back(vecParamsMIPneg); - targetVec.emplace_back(vecParamsMIPall); - if (!vecParams.size()) { - LOG(info) << "size of " << name << "is zero."; + auto vecParamsPLApos = (std::vector)paramsFuncPlateaUpos; + auto vecParamsPLAneg = (std::vector)paramsFuncPlateaUneg; + auto vecParamsPLAall = (std::vector)paramsFuncPlateaUall; + + auto addVec = [&](std::vector>& targetVec, const std::string& name, bool isMIP) { + if (isMIP) { + targetVec.emplace_back(vecParamsMIPpos); + targetVec.emplace_back(vecParamsMIPneg); + targetVec.emplace_back(vecParamsMIPall); + if (!vecParamsMIP.size()) { + LOG(info) << "size of " << name << "is zero."; + } + } else { + targetVec.emplace_back(vecParamsPLApos); + targetVec.emplace_back(vecParamsPLAneg); + targetVec.emplace_back(vecParamsPLAall); + if (!vecParamsPLA.size()) { + LOG(info) << "size of " << name << "is zero."; + } } }; - addVec(vecParams, "vecParams"); - for (const auto& params : vecParams) { + addVec(vecParamsMIP, "vecParamsMIP", true); + for (const auto& params : vecParamsMIP) { fDeDxVsEta.emplace_back(setFuncPars(params)); } + addVec(vecParamsPLA, "vecParamsPLA", false); + for (const auto& params : vecParamsPLA) { + fEDeDxVsEta.emplace_back(setFuncPars(params)); + } ccdb->setURL(ccdbConf.ccdbUrl.value); ccdb->setCaching(true); @@ -607,8 +640,8 @@ struct FlattenictyPikp { flatchrg.add({"Tracks/CleanV0/pos/hPiV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {kTHnSparseF, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); flatchrg.add({"Tracks/CleanV0/pos/hPV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {kTHnSparseF, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); } else { - flatchrg.add("Tracks/CleanTof/hBetaVsP", ";Momentum (GeV/#it{c}); #beta", kTH2F, {{{ptAxisV0s}, {120, 0., 1.2}}}); - flatchrg.add("Tracks/CleanTof/hTofExpPi", ";Momentum (GeV/#it{c});#it{t}^{#pi}_{Exp}/#it{t}_{TOF}", kTH2F, {{{ptAxisV0s}, {100, 0.2, 1.2}}}); + flatchrg.add("Tracks/CleanTof/all/hBetaVsP", ";Momentum (GeV/#it{c}); #beta", kTH2F, {{{ptAxisV0s}, {120, 0., 1.2}}}); + flatchrg.add("Tracks/CleanTof/all/hTofExpPi", ";Momentum (GeV/#it{c});#it{t}^{#pi}_{Exp}/#it{t}_{TOF}", kTH2F, {{{ptAxisV0s}, {100, 0.2, 1.2}}}); flatchrg.add({"Tracks/CleanTof/all/hPiTof", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {kTH3F, {etaAxis, pAxis, dEdxAxis}}}); flatchrg.add({"Tracks/CleanV0/pos/hEV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {kTH3F, {etaAxis, pAxis, dEdxAxis}}}); flatchrg.add({"Tracks/CleanV0/pos/hPiV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {kTH3F, {etaAxis, pAxis, dEdxAxis}}}); @@ -723,6 +756,8 @@ struct FlattenictyPikp { fv0AmplCorr = {}; std::string fullPathCalibGain; std::string fullPathCalibVtx; + std::string fullPathCalibDeDxMip; + std::string fullPathCalibDeDxPlateau; auto timestamp = bc.timestamp(); auto runnumber = bc.runNumber(); @@ -752,6 +787,46 @@ struct FlattenictyPikp { fullPathCalibVtx += "/FV0"; zVtxMap = getForTsOrRun(fullPathCalibVtx, timestamp, runnumber); } + + if (applyCalibDeDxFromCCDB) { + fullPathCalibDeDxMip = cfgDeDxCalibCcdbPath; + fullPathCalibDeDxMip += "/MIP"; + fullPathCalibDeDxPlateau = cfgDeDxCalibCcdbPath; + fullPathCalibDeDxPlateau += "/Plateau"; + if (fullPathCalibDeDxMip.empty() == false) { + dedxcalib.lCalibObjects = getForTsOrRun(fullPathCalibDeDxMip, timestamp, runnumber); + if (dedxcalib.lCalibObjects) { + LOG(info) << "CCDB objects loaded successfully"; + dedxcalib.hMIPcalibPos = static_cast(dedxcalib.lCalibObjects->FindObject("hMIPcalibPos")); + dedxcalib.hMIPcalibNeg = static_cast(dedxcalib.lCalibObjects->FindObject("hMIPcalibNeg")); + dedxcalib.hMIPcalibAll = static_cast(dedxcalib.lCalibObjects->FindObject("hMIPcalibAll")); + dedxcalib.lCalibLoaded = true; + if (!dedxcalib.hMIPcalibPos || !dedxcalib.hMIPcalibNeg || !dedxcalib.hMIPcalibAll) { + LOGF(error, "Problem loading CCDB objects! Please check"); + dedxcalib.lCalibLoaded = false; + } + } else { + LOGF(fatal, "Could not load hMIPcalib from %s", fullPathCalibDeDxMip.c_str()); + dedxcalib.lCalibLoaded = false; + } + } + if (fullPathCalibDeDxPlateau.empty() == false) { + dedxcalib.lCalibObjects = getForTsOrRun(fullPathCalibDeDxPlateau, timestamp, runnumber); + if (dedxcalib.lCalibObjects) { + LOG(info) << "CCDB objects loaded successfully"; + dedxcalib.hPlateauCalibPos = static_cast(dedxcalib.lCalibObjects->FindObject("hPlateauCalibPos")); + dedxcalib.hPlateauCalibNeg = static_cast(dedxcalib.lCalibObjects->FindObject("hPlateauCalibNeg")); + dedxcalib.hPlateauCalibAll = static_cast(dedxcalib.lCalibObjects->FindObject("hPlateauCalibAll")); + dedxcalib.lCalibLoaded = true; + if (!dedxcalib.hPlateauCalibPos || !dedxcalib.hPlateauCalibNeg || !dedxcalib.hPlateauCalibAll) { + LOGF(error, "Problem loading CCDB objects! Please check"); + dedxcalib.lCalibLoaded = false; + } + } else { + LOGF(fatal, "Could not load hPlateauCalib from %s", fullPathCalibDeDxPlateau.c_str()); + } + } + } } using MyCollisions = soa::Join; @@ -796,7 +871,7 @@ struct FlattenictyPikp { track.passedTPCRefit()); } - template + template bool selTOFPi(T const& track) { if (track.hasTOF() && track.goodTOFMatch()) { @@ -804,9 +879,9 @@ struct FlattenictyPikp { const float trkLength = track.length(); const float tExpPiTOF = track.tofExpSignalPi(tTOF); if (track.p() >= trkSelOpt.cfgMomSelPiTOF && trkLength > kNull && tTOF > kNull) { - flatchrg.fill(HIST("Tracks/CleanTof/hTofExpPi"), track.p(), tExpPiTOF / tTOF); + flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[kAll]) + HIST("hTofExpPi"), track.p(), tExpPiTOF / tTOF); if (std::abs((tExpPiTOF / tTOF) - kOne) < trkSelOpt.cfgTofBetaPiMax) { - flatchrg.fill(HIST("Tracks/CleanTof/hBetaVsP"), track.p(), track.beta()); + flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[kAll]) + HIST("hBetaVsP"), track.p(), track.beta()); // if (std::abs(track.tpcNSigmaPi()) < v0SelOpt.cfgNsigmaPiTPC && std::abs(track.tofNSigmaPi()) < v0SelOpt.cfgNsigmaPiTOF) { return true; // } @@ -866,16 +941,31 @@ struct FlattenictyPikp { } if (applyCalibDeDx) { if (cfgFillChrgType) { - dEdx *= (50.0 / getCalibration(fDeDxVsEta, track)); - if (cfgFilldEdxQaHist) { - if (track.sign() * track.tpcInnerParam() > kNull) { + if (track.sign() * track.tpcInnerParam() > kNull) { + if (applyCalibDeDxFromCCDB) { + dEdx *= (50.0 / dedxcalib.hMIPcalibPos->GetBinContent(dedxcalib.hMIPcalibPos->FindBin(track.eta()))); + } else { + dEdx *= (50.0 / getCalibration(fDeDxVsEta, track)); + } + if (cfgFilldEdxQaHist) { filldEdxQA(track, collision, dEdx); + } + } else { + if (applyCalibDeDxFromCCDB) { + dEdx *= (50.0 / dedxcalib.hMIPcalibNeg->GetBinContent(dedxcalib.hMIPcalibNeg->FindBin(track.eta()))); } else { + dEdx *= (50.0 / getCalibration(fDeDxVsEta, track)); + } + if (cfgFilldEdxQaHist) { filldEdxQA(track, collision, dEdx); } } } else { - dEdx *= (50.0 / getCalibration(fDeDxVsEta, track)); + if (applyCalibDeDxFromCCDB) { + dEdx *= (50.0 / dedxcalib.hMIPcalibAll->GetBinContent(dedxcalib.hMIPcalibAll->FindBin(track.eta()))); + } else { + dEdx *= (50.0 / getCalibration(fDeDxVsEta, track)); + } if (cfgFilldEdxQaHist) { filldEdxQA(track, collision, dEdx); } @@ -895,7 +985,7 @@ struct FlattenictyPikp { // TOF pions if (cfgFillV0Hist) { - if (selTOFPi(track)) { + if (selTOFPi(track)) { if (cfgFillChrgType) { if (track.sign() * track.tpcInnerParam() > kNull) { if (cfgStoreThnSparse) { @@ -937,11 +1027,31 @@ struct FlattenictyPikp { float dEdxNeg = negTrack.tpcSignal(); if (applyCalibDeDx) { - dEdxPos *= (50.0 / getCalibration(fDeDxVsEta, posTrack)); - dEdxNeg *= (50.0 / getCalibration(fDeDxVsEta, negTrack)); + if (applyCalibDeDxFromCCDB) { + dEdxPos *= (50.0 / dedxcalib.hMIPcalibAll->GetBinContent(dedxcalib.hMIPcalibAll->FindBin(posTrack.eta()))); + dEdxNeg *= (50.0 / dedxcalib.hMIPcalibAll->GetBinContent(dedxcalib.hMIPcalibAll->FindBin(negTrack.eta()))); + } else { + dEdxPos *= (50.0 / getCalibration(fDeDxVsEta, posTrack)); + dEdxNeg *= (50.0 / getCalibration(fDeDxVsEta, negTrack)); + } } if (selectTypeV0s(collision, v0, posTrack, negTrack) == kGa) { // Gamma selection + if (applyCalibDeDx) { + if (applyCalibDeDxFromCCDB) { + const float dEdxPosGa = dedxcalib.hPlateauCalibAll->GetBinContent(dedxcalib.hPlateauCalibAll->FindBin(posTrack.eta())); + const float dEdxNegGa = dedxcalib.hPlateauCalibAll->GetBinContent(dedxcalib.hPlateauCalibAll->FindBin(negTrack.eta())); + if (std::abs(dEdxPos - dEdxPosGa) >= v0SelOpt.cfgdEdxPlateauSel || std::abs(dEdxNeg - dEdxNegGa) >= v0SelOpt.cfgdEdxPlateauSel) { + continue; + } + } else { + const float dEdxPosGa = getCalibration(fEDeDxVsEta, posTrack); + const float dEdxNegGa = getCalibration(fEDeDxVsEta, negTrack); + if (std::abs(dEdxPos - dEdxPosGa) >= v0SelOpt.cfgdEdxPlateauSel || std::abs(dEdxNeg - dEdxNegGa) >= v0SelOpt.cfgdEdxPlateauSel) { + continue; + } + } + } if (cfgStoreThnSparse) { flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kPos]) + HIST("hEV0"), posTrack.eta(), mult, flat, posTrack.sign() * posTrack.tpcInnerParam(), dEdxPos); flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kNeg]) + HIST("hEV0"), negTrack.eta(), mult, flat, negTrack.sign() * negTrack.tpcInnerParam(), dEdxNeg); @@ -1090,12 +1200,12 @@ struct FlattenictyPikp { if (v0.mGamma() < v0SelOpt.cfgdmassG) { // inv mass cut if (std::abs(yGamma) < v0SelOpt.cfgV0Ymax) { // rapidity cut if (std::abs(v0.alpha()) < v0SelOpt.cfgArmPodGammasalpha && v0.qtarm() < v0SelOpt.cfgArmPodGammasqT) { // - if (/*postrk.tpcInnerParam() < v0SelOpt.cfgV0DaughterTpcMomMax &&*/ postrk.hasTPC() && std::abs(postrk.tpcNSigmaEl()) < v0SelOpt.cfgNsigmaElTPC) { + if (postrk.hasTPC() && std::abs(postrk.tpcNSigmaEl()) < v0SelOpt.cfgNsigmaElTPC) { if (postrk.hasTOF() && std::abs(postrk.tofNSigmaEl()) < v0SelOpt.cfgNsigmaElTOF) { return kGa; } } - if (/*negtrk.tpcInnerParam() < v0SelOpt.cfgV0DaughterTpcMomMax &&*/ negtrk.hasTPC() && std::abs(negtrk.tpcNSigmaEl()) < v0SelOpt.cfgNsigmaElTPC) { + if (negtrk.hasTPC() && std::abs(negtrk.tpcNSigmaEl()) < v0SelOpt.cfgNsigmaElTPC) { if (negtrk.hasTOF() && std::abs(negtrk.tofNSigmaEl()) < v0SelOpt.cfgNsigmaElTOF) { return kGa; } @@ -1114,12 +1224,12 @@ struct FlattenictyPikp { if (std::abs(v0.yK0Short()) < v0SelOpt.cfgV0Ymax) { // rapidity cut if (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < v0SelOpt.cfgcTauK0s) { // ctau cut if (v0.v0cosPA() >= v0SelOpt.cfgCosPAK0s && v0.v0radius() >= v0SelOpt.cfgV0radiusK0s && v0.qtarm() * v0SelOpt.cfgArmPodK0s > std::abs(v0.alpha())) { // - if (/*postrk.tpcInnerParam() < v0SelOpt.cfgV0DaughterTpcMomMax &&*/ postrk.hasTPC() && std::abs(postrk.tpcNSigmaPi()) < v0SelOpt.cfgNsigmaPiTPC) { + if (postrk.hasTPC() && std::abs(postrk.tpcNSigmaPi()) < v0SelOpt.cfgNsigmaPiTPC) { if (postrk.hasTOF() && std::abs(postrk.tofNSigmaPi()) < v0SelOpt.cfgNsigmaPiTOF) { return kKz; } } - if (/*negtrk.tpcInnerParam() < v0SelOpt.cfgV0DaughterTpcMomMax &&*/ negtrk.hasTPC() && std::abs(negtrk.tpcNSigmaPi()) < v0SelOpt.cfgNsigmaPiTPC) { + if (negtrk.hasTPC() && std::abs(negtrk.tpcNSigmaPi()) < v0SelOpt.cfgNsigmaPiTPC) { if (negtrk.hasTOF() && std::abs(negtrk.tofNSigmaPi()) < v0SelOpt.cfgNsigmaPiTOF) { return kKz; } @@ -1139,7 +1249,7 @@ struct FlattenictyPikp { if (std::abs(v0.yLambda()) < v0SelOpt.cfgV0Ymax) { // rapidity cut if (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 < v0SelOpt.cfgcTauLambda) { // ctau cut if (v0.v0cosPA() >= v0SelOpt.cfgCosPALambda && v0.v0radius() >= v0SelOpt.cfgV0radiusLambda) { // - if (/*postrk.tpcInnerParam() < v0SelOpt.cfgV0DaughterTpcMomMax &&*/ postrk.hasTPC() && std::abs(postrk.tpcNSigmaPr()) < v0SelOpt.cfgNsigmaPrTPC && negtrk.hasTPC() && std::abs(negtrk.tpcNSigmaPi()) < v0SelOpt.cfgNsigmaPiTPC) { + if (postrk.hasTPC() && std::abs(postrk.tpcNSigmaPr()) < v0SelOpt.cfgNsigmaPrTPC && negtrk.hasTPC() && std::abs(negtrk.tpcNSigmaPi()) < v0SelOpt.cfgNsigmaPiTPC) { if (postrk.hasTOF() && std::abs(postrk.tofNSigmaPr()) < v0SelOpt.cfgNsigmaPrTOF && negtrk.hasTOF() && std::abs(negtrk.tofNSigmaPi()) < v0SelOpt.cfgNsigmaPiTOF) { return kLam; } @@ -1159,7 +1269,7 @@ struct FlattenictyPikp { if (std::abs(v0.yLambda()) < v0SelOpt.cfgV0Ymax) { // rapidity cut if (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 < v0SelOpt.cfgcTauLambda) { // ctau cut if (v0.v0cosPA() >= v0SelOpt.cfgCosPALambda && v0.v0radius() >= v0SelOpt.cfgV0radiusLambda) { // - if (/*postrk.tpcInnerParam() < v0SelOpt.cfgV0DaughterTpcMomMax &&*/ postrk.hasTPC() && std::abs(postrk.tpcNSigmaPi()) < v0SelOpt.cfgNsigmaPiTPC && negtrk.hasTPC() && std::abs(negtrk.tpcNSigmaPr()) < v0SelOpt.cfgNsigmaPrTPC) { + if (postrk.hasTPC() && std::abs(postrk.tpcNSigmaPi()) < v0SelOpt.cfgNsigmaPiTPC && negtrk.hasTPC() && std::abs(negtrk.tpcNSigmaPr()) < v0SelOpt.cfgNsigmaPrTPC) { if (postrk.hasTOF() && std::abs(postrk.tofNSigmaPi()) < v0SelOpt.cfgNsigmaPiTOF && negtrk.hasTOF() && std::abs(negtrk.tofNSigmaPr()) < v0SelOpt.cfgNsigmaPrTOF) { return kaLam; } From bdfab256fd859e3e3323568dd4fd096cb8247b8b Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sat, 20 Sep 2025 01:52:35 +0200 Subject: [PATCH 465/986] [PWGLF] Missing has_collision check (#13046) --- PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx index d665eb6756c..3848c92ddaa 100644 --- a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx @@ -1232,7 +1232,7 @@ struct strangenesstofpid { std::vector collisionEventTime(collisions.size(), 0.0); std::vector collisionNtracks(collisions.size(), 0); for (const auto& track : tracks) { - if (track.hasTOF()) { + if (track.hasTOF() && track.has_collision()) { collisionEventTime[track.collisionId()] += track.tofEvTime(); collisionNtracks[track.collisionId()]++; } From 8ab692a354c6ba739505eab0d27c46100d4702f1 Mon Sep 17 00:00:00 2001 From: Preet-Bhanjan Date: Sat, 20 Sep 2025 04:08:13 +0200 Subject: [PATCH 466/986] [PWGCF] Addition of Nch analysis (#13047) Co-authored-by: Preet Pati Co-authored-by: ALICE Action Bot --- PWGCF/Flow/Tasks/flowPbpbPikp.cxx | 59 +++++++++++++------------------ 1 file changed, 25 insertions(+), 34 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowPbpbPikp.cxx b/PWGCF/Flow/Tasks/flowPbpbPikp.cxx index c022cad77c2..f03644c0a84 100644 --- a/PWGCF/Flow/Tasks/flowPbpbPikp.cxx +++ b/PWGCF/Flow/Tasks/flowPbpbPikp.cxx @@ -107,6 +107,7 @@ struct FlowPbpbPikp { O2_DEFINE_CONFIGURABLE(cfgV0AT0Acut, int, 5, "V0AT0A cut") O2_DEFINE_CONFIGURABLE(cfgUseAsymmetricPID, bool, false, "Use asymmetric PID cuts") O2_DEFINE_CONFIGURABLE(cfgUseItsPID, bool, true, "Use ITS PID for particle identification") + O2_DEFINE_CONFIGURABLE(cfgUseNch, bool, true, "Use Nch for multiplicity selection instead of centrality") Configurable> cfgTrackDensityP0{"cfgTrackDensityP0", std::vector{0.7217476707, 0.7384792571, 0.7542625668, 0.7640680200, 0.7701951667, 0.7755299053, 0.7805901710, 0.7849446786, 0.7957356586, 0.8113039262, 0.8211968966, 0.8280558878, 0.8329342135}, "parameter 0 for track density efficiency correction"}; Configurable> cfgTrackDensityP1{"cfgTrackDensityP1", std::vector{-2.169488e-05, -2.191913e-05, -2.295484e-05, -2.556538e-05, -2.754463e-05, -2.816832e-05, -2.846502e-05, -2.843857e-05, -2.705974e-05, -2.477018e-05, -2.321730e-05, -2.203315e-05, -2.109474e-05}, "parameter 1 for track density efficiency correction"}; @@ -129,6 +130,7 @@ struct FlowPbpbPikp { ConfigurableAxis axisParticles{"axisParticles", {3, 0, 3}, "axis for different hadrons"}; ConfigurableAxis axisTPCsignal{"axisTPCsignal", {10000, 0, 1000}, "axis for TPC signal"}; ConfigurableAxis axisTOFbeta{"axisTOFbeta", {200, 0, 2}, "axis for TOF beta"}; + ConfigurableAxis axisNch{"axisNch", {200, 2000, 4000}, "N_{ch}"}; std::vector tofNsigmaCut; std::vector itsNsigmaCut; @@ -232,6 +234,8 @@ struct FlowPbpbPikp { regions.Print(); configs.Print(); + const AxisSpec axisCentForQA{100, 0, 100, "centrality (%)"}; + histos.add("hVtxZ", "", {HistType::kTH1D, {axisVertex}}); histos.add("hMult", "", {HistType::kTH1D, {{3000, 0.5, 3000.5}}}); histos.add("hCent", "", {HistType::kTH1D, {{90, 0, 90}}}); @@ -240,25 +244,13 @@ struct FlowPbpbPikp { histos.add("hEta", "", {HistType::kTH1D, {axisEta}}); histos.add("hPt", "", {HistType::kTH1D, {axisPt}}); histos.add("c22_full_ch", "", {HistType::kTProfile, {axisMultiplicity}}); - histos.add("c22_full_pi", "", {HistType::kTProfile, {axisMultiplicity}}); - histos.add("c22_full_ka", "", {HistType::kTProfile, {axisMultiplicity}}); - histos.add("c22_full_pr", "", {HistType::kTProfile, {axisMultiplicity}}); - histos.add("c22_gap08F_ch", "", {HistType::kTProfile, {axisMultiplicity}}); - histos.add("c22_gap08F_pi", "", {HistType::kTProfile, {axisMultiplicity}}); - histos.add("c22_gap08F_ka", "", {HistType::kTProfile, {axisMultiplicity}}); - histos.add("c22_gap08F_pr", "", {HistType::kTProfile, {axisMultiplicity}}); - histos.add("c22_gap08B_ch", "", {HistType::kTProfile, {axisMultiplicity}}); - histos.add("c22_gap08B_pi", "", {HistType::kTProfile, {axisMultiplicity}}); - histos.add("c22_gap08B_ka", "", {HistType::kTProfile, {axisMultiplicity}}); - histos.add("c22_gap08B_pr", "", {HistType::kTProfile, {axisMultiplicity}}); - histos.add("c24_full_ch", "", {HistType::kTProfile, {axisMultiplicity}}); - histos.add("c24_full_pi", "", {HistType::kTProfile, {axisMultiplicity}}); - histos.add("c24_full_ka", "", {HistType::kTProfile, {axisMultiplicity}}); - histos.add("c24_full_pr", "", {HistType::kTProfile, {axisMultiplicity}}); + histos.add("c22_full_ch_Nch", "", {HistType::kTProfile, {axisNch}}); histos.add("TpcdEdx", "", {HistType::kTH2D, {axisPt, axisTPCsignal}}); histos.add("TofBeta", "", {HistType::kTH2D, {axisPt, axisTOFbeta}}); + histos.add("globalTracks_centT0C", "after cut;Centrality T0C;mulplicity global tracks", {HistType::kTH2D, {axisCentForQA, axisNch}}); + histos.add("TofTpcNsigma_before", "", {HistType::kTHnSparseD, {{axisParticles, axisNsigmaTPC, axisNsigmaTOF, axisPt}}}); if (!cfgUseItsPID) histos.add("TofTpcNsigma_after", "", {HistType::kTHnSparseD, {{axisParticles, axisNsigmaTPC, axisNsigmaTOF, axisPt}}}); @@ -360,7 +352,13 @@ struct FlowPbpbPikp { fFC->SetName("FlowContainer"); fFC->SetXAxis(fPtAxis); - fFC->Initialize(oba, axisMultiplicity, cfgNbootstrap); + + if (!cfgUseNch) { + fFC->Initialize(oba, axisMultiplicity, cfgNbootstrap); + } else { + fFC->Initialize(oba, axisNch, cfgNbootstrap); + } + delete oba; if (eventCuts[kUseMultCorrCut]) { @@ -898,6 +896,7 @@ struct FlowPbpbPikp { histos.fill(HIST("hVtxZ"), vtxz); histos.fill(HIST("hMult"), nTot); histos.fill(HIST("hCent"), cent); + histos.fill(HIST("globalTracks_centT0C"), cent, nTot); fGFW->Clear(); float weff = 1; @@ -1008,24 +1007,16 @@ struct FlowPbpbPikp { // Filling cumulants with ROOT TProfile fillProfile(corrconfigs.at(0), HIST("c22_full_ch"), cent); - fillProfile(corrconfigs.at(1), HIST("c22_full_pi"), cent); - fillProfile(corrconfigs.at(2), HIST("c22_full_ka"), cent); - fillProfile(corrconfigs.at(3), HIST("c22_full_pr"), cent); - fillProfile(corrconfigs.at(4), HIST("c22_gap08F_ch"), cent); - fillProfile(corrconfigs.at(5), HIST("c22_gap08F_pi"), cent); - fillProfile(corrconfigs.at(6), HIST("c22_gap08F_ka"), cent); - fillProfile(corrconfigs.at(7), HIST("c22_gap08F_pr"), cent); - fillProfile(corrconfigs.at(8), HIST("c22_gap08B_ch"), cent); - fillProfile(corrconfigs.at(9), HIST("c22_gap08B_pi"), cent); - fillProfile(corrconfigs.at(10), HIST("c22_gap08B_ka"), cent); - fillProfile(corrconfigs.at(11), HIST("c22_gap08B_pr"), cent); - fillProfile(corrconfigs.at(12), HIST("c24_full_ch"), cent); - fillProfile(corrconfigs.at(13), HIST("c24_full_pi"), cent); - fillProfile(corrconfigs.at(14), HIST("c24_full_ka"), cent); - fillProfile(corrconfigs.at(15), HIST("c24_full_pr"), cent); - - for (uint l_ind = 0; l_ind < corrconfigs.size(); l_ind++) { - fillFC(corrconfigs.at(l_ind), cent, lRandom); + fillProfile(corrconfigs.at(0), HIST("c22_full_ch_Nch"), nTot); + + if (!cfgUseNch) { + for (uint l_ind = 0; l_ind < corrconfigs.size(); l_ind++) { + fillFC(corrconfigs.at(l_ind), cent, lRandom); + } + } else { + for (uint l_ind = 0; l_ind < corrconfigs.size(); l_ind++) { + fillFC(corrconfigs.at(l_ind), nTot, lRandom); + } } } // end of process From 1ea2e443c02858565682afcae63c8fb687c3c8ac Mon Sep 17 00:00:00 2001 From: blacwovie Date: Sat, 20 Sep 2025 15:10:20 +0800 Subject: [PATCH 467/986] [PWGCF] loose hypertriton PID cut (#13055) --- PWGCF/Femto/FemtoNuclei/DataModel/PionNucleiTables.h | 4 ++++ .../FemtoNuclei/TableProducer/PiNucleiFemto.cxx | 12 ++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/PWGCF/Femto/FemtoNuclei/DataModel/PionNucleiTables.h b/PWGCF/Femto/FemtoNuclei/DataModel/PionNucleiTables.h index 8900fcfbcd6..6b94b6a105c 100644 --- a/PWGCF/Femto/FemtoNuclei/DataModel/PionNucleiTables.h +++ b/PWGCF/Femto/FemtoNuclei/DataModel/PionNucleiTables.h @@ -112,12 +112,16 @@ DECLARE_SOA_TABLE(PionHyperTable, "AOD", "PIHYPERTABLE", pion_nuclei_tables::DcaxyPi, pion_nuclei_tables::DcazPi, pion_nuclei_tables::SignalTPCPi, + pion_nuclei_tables::SignalTPCNu, pion_nuclei_tables::InnerParamTPCPi, pion_nuclei_tables::NSigmaTPCPi, + pion_nuclei_tables::NSigmaTPCNu, pion_nuclei_tables::Chi2TPCPi, + pion_nuclei_tables::Chi2TPCNu, pion_nuclei_tables::MassTOFPi, pion_nuclei_tables::PidTrkPi, pion_nuclei_tables::ItsClusterSizePi, + pion_nuclei_tables::ItsClusterSizeNu, pion_nuclei_tables::SharedClustersPi, pion_nuclei_tables::IsBkgUS, pion_nuclei_tables::IsBkgEM) diff --git a/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx b/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx index 7cb1864593e..74f0746732c 100644 --- a/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx +++ b/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx @@ -562,7 +562,7 @@ struct PiNucleiFemto { bool selectionPIDHyper(const aod::DataHypCandsWColl::iterator& V0Hyper) { mQaRegistry.fill(HIST("hHe3P_preselected"), V0Hyper.tpcMomHe()); - float averClusSizeHe = averageClusterSizeCosl(V0Hyper.itsClusterSizesHe(), V0Hyper.etaHe3()); + /*float averClusSizeHe = averageClusterSizeCosl(V0Hyper.itsClusterSizesHe(), V0Hyper.etaHe3()); if (averClusSizeHe <= 4) { return false; } @@ -570,7 +570,7 @@ struct PiNucleiFemto { return false; } mQaRegistry.fill(HIST("hHe3P"), V0Hyper.tpcMomHe()); - mQaRegistry.fill(HIST("hHe3TPCnsigma"), V0Hyper.nSigmaHe()); + mQaRegistry.fill(HIST("hHe3TPCnsigma"), V0Hyper.nSigmaHe());*/ return true; } @@ -735,11 +735,15 @@ struct PiNucleiFemto { piHypercand.dcaxyPi = trackPi.dcaXY(); piHypercand.dcazPi = trackPi.dcaZ(); piHypercand.tpcSignalPi = trackPi.tpcSignal(); + piHypercand.tpcSignalNu = V0Hyper.tpcSignalHe(); piHypercand.momPiTPC = trackPi.tpcInnerParam(); piHypercand.nSigmaPi = trackPi.tpcNSigmaPi(); + piHypercand.nSigmaNu = V0Hyper.nSigmaHe(); piHypercand.chi2TPCPi = trackPi.tpcChi2NCl(); + piHypercand.chi2TPCNu = V0Hyper.tpcChi2He(); piHypercand.pidTrkPi = trackPi.pidForTracking(); piHypercand.itsClSizePi = trackPi.itsClusterSizes(); + piHypercand.itsClSizeNu = V0Hyper.itsClusterSizesHe(); piHypercand.nClsItsPi = trackPi.itsNCls(); piHypercand.sharedClustersPi = trackPi.tpcNClsShared(); @@ -938,12 +942,16 @@ struct PiNucleiFemto { piNucand.dcaxyPi, piNucand.dcazPi, piNucand.tpcSignalPi, + piNucand.tpcSignalNu, piNucand.momPiTPC, piNucand.nSigmaPi, + piNucand.nSigmaNu, piNucand.chi2TPCPi, + piNucand.chi2TPCNu, piNucand.massTOFPi, piNucand.pidTrkPi, piNucand.itsClSizePi, + piNucand.itsClSizeNu, piNucand.sharedClustersPi, piNucand.isBkgUS, piNucand.isBkgEM); From f70c989607602454d2cdf9dbaf4697d92f63b391 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sat, 20 Sep 2025 09:15:51 +0200 Subject: [PATCH 468/986] [PWGEM/Dilepton] update ML PID (#13051) --- PWGEM/Dilepton/Core/DielectronCut.h | 14 ++++++++++---- PWGEM/Dilepton/Core/SingleTrackQC.h | 6 +++--- PWGEM/Dilepton/Core/SingleTrackQCMC.h | 4 ++-- .../TableProducer/skimmerPrimaryElectron.cxx | 2 +- .../TableProducer/skimmerPrimaryElectronQC.cxx | 2 +- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/PWGEM/Dilepton/Core/DielectronCut.h b/PWGEM/Dilepton/Core/DielectronCut.h index 6b4930a0db1..c92ebb2880f 100644 --- a/PWGEM/Dilepton/Core/DielectronCut.h +++ b/PWGEM/Dilepton/Core/DielectronCut.h @@ -71,7 +71,7 @@ class DielectronCut : public TNamed }; enum class PIDSchemes : int { - kUnDef = -1, + kNoPID = -1, kTOFreq = 0, kTPChadrej = 1, kTPChadrejORTOFreq = 2, @@ -262,6 +262,12 @@ class DielectronCut : public TNamed template bool PassPIDML(TTrack const& track) const { + bool is_el_included_TPC = mMinTPCNsigmaEl < track.tpcNSigmaEl() && track.tpcNSigmaEl() < mMaxTPCNsigmaEl; + bool is_el_included_TOF = track.hasTOF() ? (mMinTOFNsigmaEl < track.tofNSigmaEl() && track.tofNSigmaEl() < mMaxTOFNsigmaEl) : true; + if (!is_el_included_TPC || !is_el_included_TOF) { // outside of trained range + return false; + } + int pbin = lower_bound(mMLBins.begin(), mMLBins.end(), track.tpcInnerParam()) - mMLBins.begin() - 1; if (pbin < 0) { pbin = 0; @@ -300,7 +306,7 @@ class DielectronCut : public TNamed case static_cast(PIDSchemes::kTPChadrejORTOFreq_woTOFif): return PassTPConlyhadrej(track) || PassTOFreq(track); - case static_cast(PIDSchemes::kUnDef): + case static_cast(PIDSchemes::kNoPID): return true; default: @@ -338,7 +344,7 @@ class DielectronCut : public TNamed bool is_pi_excluded_TPC = track.tpcInnerParam() < mMaxPinForPionRejectionTPC ? (track.tpcNSigmaPi() < mMinTPCNsigmaPi || mMaxTPCNsigmaPi < track.tpcNSigmaPi()) : true; bool is_ka_excluded_TPC = track.tpcNSigmaKa() < mMinTPCNsigmaKa || mMaxTPCNsigmaKa < track.tpcNSigmaKa(); bool is_pr_excluded_TPC = track.tpcNSigmaPr() < mMinTPCNsigmaPr || mMaxTPCNsigmaPr < track.tpcNSigmaPr(); - bool is_el_included_TOF = track.hasTOF() ? (mMinTOFNsigmaEl < track.tofNSigmaEl() && track.tofNSigmaEl() < mMaxTOFNsigmaEl && track.tofChi2() < mMaxChi2TOF) : true; + bool is_el_included_TOF = track.hasTOF() ? (mMinTOFNsigmaEl < track.tofNSigmaEl() && track.tofNSigmaEl() < mMaxTOFNsigmaEl) : true; // bool is_ka_excluded_ITS = (mMinP_ITSNsigmaKa < track.p() && track.p() < mMaxP_ITSNsigmaKa) ? (track.itsNSigmaKa() < mMinITSNsigmaKa || mMaxITSNsigmaKa < track.itsNSigmaKa()) : true; // bool is_pr_excluded_ITS = (mMinP_ITSNsigmaPr < track.p() && track.p() < mMaxP_ITSNsigmaPr) ? (track.itsNSigmaPr() < mMinITSNsigmaPr || mMaxITSNsigmaPr < track.itsNSigmaPr()) : true; return is_el_included_TPC && is_pi_excluded_TPC && is_ka_excluded_TPC && is_pr_excluded_TPC && is_el_included_TOF; @@ -371,7 +377,7 @@ class DielectronCut : public TNamed { bool is_el_included_TPC = mMinTPCNsigmaEl < track.tpcNSigmaEl() && track.tpcNSigmaEl() < mMaxTPCNsigmaEl; bool is_pi_excluded_TPC = track.tpcInnerParam() < mMaxPinForPionRejectionTPC ? (track.tpcNSigmaPi() < mMinTPCNsigmaPi || mMaxTPCNsigmaPi < track.tpcNSigmaPi()) : true; - bool is_el_included_TOF = track.hasTOF() ? (mMinTOFNsigmaEl < track.tofNSigmaEl() && track.tofNSigmaEl() < mMaxTOFNsigmaEl && track.tofChi2() < mMaxChi2TOF) : true; + bool is_el_included_TOF = track.hasTOF() ? (mMinTOFNsigmaEl < track.tofNSigmaEl() && track.tofNSigmaEl() < mMaxTOFNsigmaEl) : true; // bool is_ka_excluded_ITS = (mMinP_ITSNsigmaKa < track.p() && track.p() < mMaxP_ITSNsigmaKa) ? (track.itsNSigmaKa() < mMinITSNsigmaKa || mMaxITSNsigmaKa < track.itsNSigmaKa()) : true; // bool is_pr_excluded_ITS = (mMinP_ITSNsigmaPr < track.p() && track.p() < mMaxP_ITSNsigmaPr) ? (track.itsNSigmaPr() < mMinITSNsigmaPr || mMaxITSNsigmaPr < track.itsNSigmaPr()) : true; return is_el_included_TPC && is_pi_excluded_TPC && is_el_included_TOF; diff --git a/PWGEM/Dilepton/Core/SingleTrackQC.h b/PWGEM/Dilepton/Core/SingleTrackQC.h index 06f3514948d..e9c4b031e15 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQC.h @@ -237,11 +237,11 @@ struct SingleTrackQC { // track info fRegistry.add("Track/positive/hs", "rec. single electron", kTHnSparseD, {axis_pt, axis_eta, axis_phi, axis_dca3D, axis_dcaXY, axis_dcaZ}, true); - fRegistry.add("Track/positive/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{2000, -5, 5}}, false); + fRegistry.add("Track/positive/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{4000, -20, 20}}, false); fRegistry.add("Track/positive/hDCAxyz", "DCA xy vs. z;DCA_{xy} (cm);DCA_{z} (cm)", kTH2F, {{200, -1.0f, 1.0f}, {200, -1.f, 1.f}}, false); fRegistry.add("Track/positive/hDCAxyzSigma", "DCA xy vs. z;DCA_{xy} (#sigma);DCA_{z} (#sigma)", kTH2F, {{400, -20.0f, 20.0f}, {400, -20.0f, 20.0f}}, false); fRegistry.add("Track/positive/hDCAxyRes_Pt", "DCA_{xy} resolution vs. pT;p_{T} (GeV/c);DCA_{xy} resolution (#mum)", kTH2F, {{200, 0, 10}, {500, 0., 500}}, false); - fRegistry.add("Track/positive/hDCAzRes_Pt", "DCA_{z} resolution vs. pT;p_{T} (GeV/c);DCA_{z} resolution (#mum)", kTH2F, {{200, 0, 10}, {500, 0., 400}}, false); + fRegistry.add("Track/positive/hDCAzRes_Pt", "DCA_{z} resolution vs. pT;p_{T} (GeV/c);DCA_{z} resolution (#mum)", kTH2F, {{200, 0, 10}, {500, 0., 500}}, false); fRegistry.add("Track/positive/hDCA3dRes_Pt", "DCA_{3D} resolution vs. pT;p_{T} (GeV/c);DCA_{3D} resolution (#mum)", kTH2F, {{200, 0, 10}, {500, 0., 500}}, false); fRegistry.add("Track/positive/hNclsTPC_Pt", "number of TPC clusters;p_{T,e} (GeV/c);TPC N_{cls}", kTH2F, {axis_pt, {161, -0.5, 160.5}}, false); fRegistry.add("Track/positive/hNcrTPC_Pt", "number of TPC crossed rows;p_{T,e} (GeV/c);TPC N_{CR}", kTH2F, {axis_pt, {161, -0.5, 160.5}}, false); @@ -290,7 +290,7 @@ struct SingleTrackQC { fRegistry.add("Track/positive/hs", "rec. single muon", kTHnSparseD, {axis_pt, axis_eta, axis_phi, axis_dca}, true); fRegistry.add("Track/positive/hEtaPhi_MatchMCHMID", "#eta vs. #varphi of matched MCHMID", kTH2F, {{180, 0, 2.f * M_PI}, {100, -6, -1}}, false); fRegistry.add("Track/positive/hdEtadPhi", "#Delta#eta vs. #Delta#varphi between MFT-MCH-MID and MCH-MID;#varphi_{sa} - #varphi_{gl} (rad.);#eta_{sa} - #eta_{gl}", kTH2F, {{90, -M_PI / 4, M_PI / 4}, {100, -0.5, +0.5}}, false); - fRegistry.add("Track/positive/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{400, -20, 20}}, false); + fRegistry.add("Track/positive/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{1000, -5, 5}}, false); fRegistry.add("Track/positive/hTrackType", "track type", kTH1F, {{6, -0.5f, 5.5}}, false); fRegistry.add("Track/positive/hDCAxy", "DCA x vs. y;DCA_{x} (cm);DCA_{y} (cm)", kTH2F, {{200, -0.5f, 0.5f}, {200, -0.5f, 0.5f}}, false); fRegistry.add("Track/positive/hDCAxySigma", "DCA x vs. y;DCA_{x} (#sigma);DCA_{y} (#sigma)", kTH2F, {{200, -10.0f, 10.0f}, {200, -10.0f, 10.0f}}, false); diff --git a/PWGEM/Dilepton/Core/SingleTrackQCMC.h b/PWGEM/Dilepton/Core/SingleTrackQCMC.h index df7f1c78726..97408d7c25c 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQCMC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQCMC.h @@ -272,7 +272,7 @@ struct SingleTrackQCMC { fRegistry.add("Track/lf/positive/hsGenRec", "rec. single electron", kTHnSparseD, {axis_pt, axis_eta, axis_phi, axis_dca3D, axis_dcaXY, axis_dcaZ, axis_charge_gen}, true); } if (cfgFillQA) { - fRegistry.add("Track/lf/positive/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{400, -20, 20}}, false); + fRegistry.add("Track/lf/positive/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{4000, -20, 20}}, false); fRegistry.add("Track/lf/positive/hDCAxyz", "DCA xy vs. z;DCA_{xy} (cm);DCA_{z} (cm)", kTH2F, {{200, -1.0f, 1.0f}, {200, -1.f, 1.f}}, false); fRegistry.add("Track/lf/positive/hDCAxyzSigma", "DCA xy vs. z;DCA_{xy} (#sigma);DCA_{z} (#sigma)", kTH2F, {{400, -20.0f, 20.0f}, {400, -20.0f, 20.0f}}, false); fRegistry.add("Track/lf/positive/hDCAxyRes_Pt", "DCA_{xy} resolution vs. pT;p_{T} (GeV/c);DCA_{xy} resolution (#mum)", kTH2F, {{200, 0, 10}, {500, 0., 500}}, false); @@ -355,7 +355,7 @@ struct SingleTrackQCMC { if (cfgFillQA) { fRegistry.add("Track/lf/positive/hEtaPhi_MatchMCHMID", "#eta vs. #varphi of matched MCHMID", kTH2F, {{180, 0, 2.f * M_PI}, {100, -6, -1}}, false); fRegistry.add("Track/lf/positive/hdEtadPhi", "#Delta#eta vs. #Delta#varphi between MFT-MCH-MID and MCH-MID;#varphi_{sa} - #varphi_{gl} (rad.);#eta_{sa} - #eta_{gl}", kTH2F, {{90, -M_PI / 4, M_PI / 4}, {100, -0.5, +0.5}}, false); - fRegistry.add("Track/lf/positive/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{400, -20, 20}}, false); + fRegistry.add("Track/lf/positive/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{1000, -5, 5}}, false); fRegistry.add("Track/lf/positive/hTrackType", "track type", kTH1F, {{6, -0.5f, 5.5}}, false); fRegistry.add("Track/lf/positive/hDCAxy", "DCA x vs. y;DCA_{x} (cm);DCA_{y} (cm)", kTH2F, {{200, -0.5f, 0.5f}, {200, -0.5f, 0.5f}}, false); fRegistry.add("Track/lf/positive/hDCAxySigma", "DCA x vs. y;DCA_{x} (#sigma);DCA_{y} (#sigma)", kTH2F, {{200, -10.0f, 10.0f}, {200, -10.0f, 10.0f}}, false); diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx index 4942072d412..3abbebc3897 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx @@ -142,7 +142,7 @@ struct skimmerPrimaryElectron { if (fillQAHistogram) { fRegistry.add("Track/hPt", "pT;p_{T} (GeV/c)", kTH1F, {{1000, 0.0f, 10}}, false); - fRegistry.add("Track/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{400, -20, 20}}, false); + fRegistry.add("Track/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{4000, -20, 20}}, false); fRegistry.add("Track/hEtaPhi", "#eta vs. #varphi;#varphi (rad.);#eta", kTH2F, {{180, 0, 2 * M_PI}, {20, -1.0f, 1.0f}}, false); fRegistry.add("Track/hDCAxyz", "DCA xy vs. z;DCA_{xy} (cm);DCA_{z} (cm)", kTH2F, {{200, -1.0f, 1.0f}, {200, -1.0f, 1.0f}}, false); fRegistry.add("Track/hDCAxyzSigma", "DCA xy vs. z;DCA_{xy} (#sigma);DCA_{z} (#sigma)", kTH2F, {{200, -10.0f, 10.0f}, {200, -10.0f, 10.0f}}, false); diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx index 2ba072058dc..58cc23c5606 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx @@ -157,7 +157,7 @@ struct skimmerPrimaryElectronQC { if (fillQAHistogram) { fRegistry.add("Track/hPt", "pT;p_{T} (GeV/c)", kTH1F, {{1000, 0.0f, 10}}, false); - fRegistry.add("Track/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{400, -20, 20}}, false); + fRegistry.add("Track/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{4000, -20, 20}}, false); fRegistry.add("Track/hEtaPhi", "#eta vs. #varphi;#varphi (rad.);#eta", kTH2F, {{180, 0, 2 * M_PI}, {20, -1.0f, 1.0f}}, false); fRegistry.add("Track/hDCAxyz", "DCA xy vs. z;DCA_{xy} (cm);DCA_{z} (cm)", kTH2F, {{200, -1.0f, 1.0f}, {200, -1.0f, 1.0f}}, false); fRegistry.add("Track/hDCAxyzSigma", "DCA xy vs. z;DCA_{xy} (#sigma);DCA_{z} (#sigma)", kTH2F, {{200, -10.0f, 10.0f}, {200, -10.0f, 10.0f}}, false); From ce4ee83d81d6a4be2e80e9a317039959220b2682 Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Sat, 20 Sep 2025 11:30:39 +0200 Subject: [PATCH 469/986] [PWGLF] Add mixed event combinatorial background (#13052) --- .../Tasks/Resonances/f1protoncorrelation.cxx | 231 +++++++++++------- 1 file changed, 143 insertions(+), 88 deletions(-) diff --git a/PWGLF/Tasks/Resonances/f1protoncorrelation.cxx b/PWGLF/Tasks/Resonances/f1protoncorrelation.cxx index 177f4b6a5dd..035418143bf 100644 --- a/PWGLF/Tasks/Resonances/f1protoncorrelation.cxx +++ b/PWGLF/Tasks/Resonances/f1protoncorrelation.cxx @@ -82,6 +82,7 @@ struct f1protoncorrelation { Configurable nRot{"nRot", 4, "Number of rotational bkg"}; // Event Mixing Configurable nEvtMixing{"nEvtMixing", 10, "Number of events to mix"}; + Configurable nEvtMixingBkg{"nEvtMixingBkg", 5, "Number of events to mix for background reconstruction"}; ConfigurableAxis CfgVtxBins{"CfgVtxBins", {10, -10, 10}, "Mixing bins - z-vertex"}; ConfigurableAxis CfgMultBins{"CfgMultBins", {VARIABLE_WIDTH, 0.0, 40.0, 80.0, 500.0}, "Mixing bins - number of contributor"}; @@ -108,10 +109,11 @@ struct f1protoncorrelation { const AxisSpec thnAxisCharge{configThnAxisCharge, "Charge"}; // register histograms - histos.add("hPhaseSpaceProtonKaonSame", "hPhaseSpaceProtonKaonSame", kTH2F, {{200, -2.0f, 2.0f}, {360, -4.0 * TMath::Pi(), 4.0 * TMath::Pi()}}); - histos.add("hPhaseSpaceProtonPionSame", "hPhaseSpaceProtonPionSame", kTH2F, {{200, -2.0f, 2.0f}, {360, -4.0 * TMath::Pi(), 4.0 * TMath::Pi()}}); - histos.add("hPhaseSpaceProtonKaonMix", "hPhaseSpaceProtonKaonMix", kTH2F, {{200, -2.0f, 2.0f}, {360, -4.0 * TMath::Pi(), 4.0 * TMath::Pi()}}); - histos.add("hPhaseSpaceProtonPionMix", "hPhaseSpaceProtonPionMix", kTH2F, {{200, -2.0f, 2.0f}, {360, -4.0 * TMath::Pi(), 4.0 * TMath::Pi()}}); + histos.add("hPhaseSpaceProtonKaonSame", "hPhaseSpaceProtonKaonSame", kTH3F, {{40, -2.0f, 2.0f}, {180, -2.0 * TMath::Pi(), 2.0 * TMath::Pi()}, {100, 0.0, 1.0}}); + histos.add("hPhaseSpaceProtonPionSame", "hPhaseSpaceProtonPionSame", kTH3F, {{40, -2.0f, 2.0f}, {180, -2.0 * TMath::Pi(), 2.0 * TMath::Pi()}, {100, 0.0, 1.0}}); + histos.add("hPhaseSpaceProtonKaonMix", "hPhaseSpaceProtonKaonMix", kTH3F, {{40, -2.0f, 2.0f}, {180, -2.0 * TMath::Pi(), 2.0 * TMath::Pi()}, {100, 0.0, 1.0}}); + histos.add("hPhaseSpaceProtonPionMix", "hPhaseSpaceProtonPionMix", kTH3F, {{40, -2.0f, 2.0f}, {180, -2.0 * TMath::Pi(), 2.0 * TMath::Pi()}, {100, 0.0, 1.0}}); + histos.add("hNsigmaProtonTPC", "Nsigma Proton TPC distribution", kTH2F, {{100, -5.0f, 5.0f}, {100, 0.0f, 10.0f}}); histos.add("hNsigmaKaonTPC", "Nsigma Kaon TPC distribution", kTH2F, {{100, -5.0f, 5.0f}, {100, 0.0f, 10.0f}}); histos.add("hNsigmaPionTPC", "Nsigma Pion TPC distribution", kTH2F, {{100, -5.0f, 5.0f}, {100, 0.0f, 10.0f}}); @@ -126,6 +128,9 @@ struct f1protoncorrelation { histos.add("h2MixEventInvariantMassLike_mass", "Like Sign Invariant mass of f1 mix event", kTHnSparseF, {thnAxisKstar, thnAxisPt, thnAxisInvMass, thnAxisCharge}); histos.add("h2MixEventInvariantMassRot_mass", "Rotational Sign Invariant mass of f1 mix event", kTHnSparseF, {thnAxisKstar, thnAxisPt, thnAxisInvMass, thnAxisCharge}); + histos.add("h2MixEventInvariantMassUnlike_mass_SEFP", "Unlike-sign invariant mass of f1 mix event (SE-F1P: π mixed, p same event)", kTHnSparseF, {thnAxisKstar, thnAxisPt, thnAxisInvMass, thnAxisCharge}); + histos.add("h2MixEventInvariantMassUnlike_mass_DEFP", "Unlike-sign invariant mass of f1 mix event (DE-F1P: π + p mixed)", kTHnSparseF, {thnAxisKstar, thnAxisPt, thnAxisInvMass, thnAxisCharge}); + if (fillSparse) { histos.add("SEMassUnlike", "SEMassUnlike", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisPtProton, thnAxisKstar, thnAxisNsigma, thnAxisCharge}); histos.add("SEMassLike", "SEMassLike", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisPtProton, thnAxisKstar, thnAxisNsigma, thnAxisCharge}); @@ -311,8 +316,8 @@ struct f1protoncorrelation { pionCharge = 1; kaonCharge = -1; } - histos.fill(HIST("hPhaseSpaceProtonKaonSame"), Proton.Eta() - Kaon.Eta(), PhiAtSpecificRadiiTPC(Proton, Kaon, protontrack.protonCharge(), kaonCharge, bz, bz)); // Phase Space Proton kaon - histos.fill(HIST("hPhaseSpaceProtonPionSame"), Proton.Eta() - Kaon.Eta(), PhiAtSpecificRadiiTPC(Proton, Pion, protontrack.protonCharge(), pionCharge, bz, bz)); // Phase Space Proton Pion + histos.fill(HIST("hPhaseSpaceProtonKaonSame"), Proton.Eta() - Kaon.Eta(), PhiAtSpecificRadiiTPC(Proton, Kaon, protontrack.protonCharge(), kaonCharge, bz, bz), relative_momentum); // Phase Space Proton kaon + histos.fill(HIST("hPhaseSpaceProtonPionSame"), Proton.Eta() - Kaon.Eta(), PhiAtSpecificRadiiTPC(Proton, Pion, protontrack.protonCharge(), pionCharge, bz, bz), relative_momentum); // Phase Space Proton Pion histos.fill(HIST("h2SameEventInvariantMassUnlike_mass"), relative_momentum, F1.Pt(), F1.M(), pairCharge); // F1 sign = 1 unlike, F1 sign = -1 like if (fillSparse) { histos.fill(HIST("SEMassUnlike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC, pairCharge); @@ -354,113 +359,163 @@ struct f1protoncorrelation { BinningType colBinning{{CfgVtxBins, CfgMultBins}, true}; Preslice tracksPerCollisionPresliceF1 = aod::f1protondaughter::redF1PEventId; Preslice tracksPerCollisionPresliceP = aod::f1protondaughter::redF1PEventId; - void processME(aod::RedF1PEvents& collisions, aod::F1Tracks& f1tracks, aod::ProtonTracks& protontracks) + void processME(aod::RedF1PEvents& collisions, + aod::F1Tracks& f1tracks, + aod::ProtonTracks& protontracks) { - for (auto& [collision1, collision2] : selfCombinations(colBinning, nEvtMixing, -1, collisions, collisions)) { - // LOGF(info, "Mixed event collisions: (%d, %d)", collision1.index(), collision2.index()); - if (collision1.index() == collision2.index()) { + for (auto const& [collision1, collision2] : + selfCombinations(colBinning, nEvtMixingBkg, -1, collisions, collisions)) { + if (collision1.index() == collision2.index()) continue; - } - if (f1tracks.size() == 0 || protontracks.size() == 0) { - continue; - } - auto groupF1 = f1tracks.sliceBy(tracksPerCollisionPresliceF1, collision1.globalIndex()); - auto groupProton = protontracks.sliceBy(tracksPerCollisionPresliceP, collision2.globalIndex()); - // auto groupF1 = f1tracks.sliceByCached(aod::f1protondaughter::redF1PEventId, collision1.globalIndex(), cache); - // auto groupProton = protontracks.sliceByCached(aod::f1protondaughter::redF1PEventId, collision2.globalIndex(), cache); - for (auto& [t1, t2] : soa::combinations(o2::soa::CombinationsFullIndexPolicy(groupF1, groupProton))) { - if (t1.f1MassKaonKshort() > maxKKS0Mass) { + + // Preslices + auto f1_c1 = f1tracks.sliceBy(tracksPerCollisionPresliceF1, collision1.globalIndex()); + auto f1_c2 = f1tracks.sliceBy(tracksPerCollisionPresliceF1, collision2.globalIndex()); + auto p_c1 = protontracks.sliceBy(tracksPerCollisionPresliceP, collision1.globalIndex()); + auto p_c2 = protontracks.sliceBy(tracksPerCollisionPresliceP, collision2.globalIndex()); + + // ------------------------------- + // CASE 1: SE-F1P (π mixed from c2, K+K0s from c1, proton from c1) + // ------------------------------- + for (auto const& t1 : f1_c1) { + if (t1.f1MassKaonKshort() > maxKKS0Mass) continue; - } - F1.SetXYZM(t1.f1Px(), t1.f1Py(), t1.f1Pz(), t1.f1Mass()); - Pion.SetXYZM(t1.f1d1Px(), t1.f1d1Py(), t1.f1d1Pz(), 0.139); + Kaon.SetXYZM(t1.f1d2Px(), t1.f1d2Py(), t1.f1d2Pz(), 0.493); Kshort.SetXYZM(t1.f1d3Px(), t1.f1d3Py(), t1.f1d3Pz(), 0.497); KaonKshortPair = Kaon + Kshort; - if (Pion.Pt() > maxMomentumPion || Kaon.Pt() > maxMomentumKaon) { + + if (Kaon.Pt() > maxMomentumKaon) continue; - } if (pdepPID) { - if (Kaon.Pt() <= 0.5 && (t1.f1d2TPC() < -2.5 || t1.f1d2TPC() > 2.5)) { + if (Kaon.Pt() <= 0.5 && (t1.f1d2TPC() < -2.5 || t1.f1d2TPC() > 2.5)) continue; - } - if (Kaon.Pt() > 0.5 && Kaon.Pt() <= 0.7 && (t1.f1d2TPC() < -1.5 || t1.f1d2TPC() > 2.5)) { + if (Kaon.Pt() > 0.5 && Kaon.Pt() <= 0.7 && (t1.f1d2TPC() < -1.5 || t1.f1d2TPC() > 2.5)) continue; - } - if (Kaon.Pt() > 0.7 && Kaon.Pt() <= 1.0 && (t1.f1d2TPC() < -1.0 || t1.f1d2TPC() > 2.5)) { + if (Kaon.Pt() > 0.7 && Kaon.Pt() <= 1.0 && (t1.f1d2TPC() < -1.0 || t1.f1d2TPC() > 2.5)) continue; - } - if (Kaon.Pt() > 1.0 && (t1.f1d2TPC() < -2.5 || t1.f1d2TPC() > 2.5)) { + if (Kaon.Pt() > 1.0 && (t1.f1d2TPC() < -2.5 || t1.f1d2TPC() > 2.5)) continue; - } - if (Pion.Pt() < 2.0 && (t1.f1d1TPC() < -2.5 || t1.f1d1TPC() > 2.5)) { + } + if (strategyPIDKaon == 1 && + Kaon.Pt() > momentumTOFKaonMin && Kaon.Pt() <= momentumTOFKaonMax && + t1.f1d2TOFHit() != 1) + continue; + + for (auto const& t2 : p_c1) { // proton from c1 + Proton.SetXYZM(t2.protonPx(), t2.protonPy(), t2.protonPz(), 0.938); + if (Proton.Pt() > momentumProtonMax) continue; - } - if (Pion.Pt() > 2.0 && (t1.f1d1TPC() < -2.5 || t1.f1d1TPC() > 2.5)) { + if (Proton.P() < momentumTOFProton && TMath::Abs(t2.protonNsigmaTPC()) > 2.5) + continue; + if (Proton.P() >= momentumTOFProton && (t2.protonTOFHit() != 1 || TMath::Abs(t2.protonNsigmaTOF()) > 2.5)) continue; + + for (auto const& t3 : f1_c2) { // pion source from c2 + Pion.SetXYZM(t3.f1d1Px(), t3.f1d1Py(), t3.f1d1Pz(), 0.139); + if (Pion.Pt() > maxMomentumPion) + continue; + if (pdepPID) { + if (Pion.Pt() < 2.0 && (t3.f1d1TPC() < -2.5 || t3.f1d1TPC() > 2.5)) + continue; + if (Pion.Pt() >= 2.0 && (t3.f1d1TPC() < -2.5 || t3.f1d1TPC() > 2.5)) + continue; + } + if (strategyPIDPion == 1 && + Pion.Pt() > momentumTOFPionMin && Pion.Pt() <= momentumTOFPionMax && + t3.f1d1TOFHit() != 1) + continue; + + // Fake f1: π(mixed) + (K+K0s from c1) + F1 = Pion + KaonKshortPair; + + // keep only unlike-sign branch + if (t1.f1SignalStat() <= 0) + continue; + + int f1Charge = t1.f1SignalStat(); + float pairQ = f1Charge * t2.protonCharge(); + + auto kstar = getkstar(F1, Proton); + + histos.fill(HIST("h2MixEventInvariantMassUnlike_mass_SEFP"), + kstar, F1.Pt(), F1.M(), pairQ); } } - if (strategyPIDPion == 1 && Pion.Pt() > momentumTOFPionMin && Pion.Pt() <= momentumTOFPionMax && t1.f1d1TOFHit() != 1) { - continue; - } - if (strategyPIDKaon == 1 && Kaon.Pt() > momentumTOFKaonMin && Kaon.Pt() <= momentumTOFKaonMax && t1.f1d2TOFHit() != 1) { - continue; - } - if (typeofCombined == 0) { - combinedTPC = TMath::Sqrt(t1.f1d1TPC() * t1.f1d1TPC() + t1.f1d2TPC() * t1.f1d2TPC()); - } - if (typeofCombined == 1) { - combinedTPC = (t1.f1d1TPC() - t1.f1d2TPC()) / (t1.f1d1TPC() + t1.f1d2TPC()); - } - Proton.SetXYZM(t2.protonPx(), t2.protonPy(), t2.protonPz(), 0.938); - if (Proton.Pt() > momentumProtonMax) { + } + + // ------------------------------- + // CASE 2: DE-F1P (π mixed from c2, K+K0s from c1, proton from c2) + // ------------------------------- + for (auto const& t1 : f1_c1) { + if (t1.f1MassKaonKshort() > maxKKS0Mass) continue; - } - if (Proton.P() < momentumTOFProton && TMath::Abs(t2.protonNsigmaTPC()) > 2.5) { + + Kaon.SetXYZM(t1.f1d2Px(), t1.f1d2Py(), t1.f1d2Pz(), 0.493); + Kshort.SetXYZM(t1.f1d3Px(), t1.f1d3Py(), t1.f1d3Pz(), 0.497); + KaonKshortPair = Kaon + Kshort; + + if (Kaon.Pt() > maxMomentumKaon) continue; + if (pdepPID) { + if (Kaon.Pt() <= 0.5 && (t1.f1d2TPC() < -2.5 || t1.f1d2TPC() > 2.5)) + continue; + if (Kaon.Pt() > 0.5 && Kaon.Pt() <= 0.7 && (t1.f1d2TPC() < -1.5 || t1.f1d2TPC() > 2.5)) + continue; + if (Kaon.Pt() > 0.7 && Kaon.Pt() <= 1.0 && (t1.f1d2TPC() < -1.0 || t1.f1d2TPC() > 2.5)) + continue; + if (Kaon.Pt() > 1.0 && (t1.f1d2TPC() < -2.5 || t1.f1d2TPC() > 2.5)) + continue; } - if (Proton.P() >= momentumTOFProton && (t2.protonTOFHit() != 1 || TMath::Abs(t2.protonNsigmaTOF()) > 2.5)) { + if (strategyPIDKaon == 1 && + Kaon.Pt() > momentumTOFKaonMin && Kaon.Pt() <= momentumTOFKaonMax && + t1.f1d2TOFHit() != 1) continue; - } - auto relative_momentum = getkstar(F1, Proton); - if (t1.f1SignalStat() > 0) { - histos.fill(HIST("h2MixEventInvariantMassUnlike_mass"), relative_momentum, F1.Pt(), F1.M(), 1.0); // F1 sign = 1 unlike, F1 sign = -1 like - if (fillSparse) { - histos.fill(HIST("MEMassUnlike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC, 1.0); - } - } - if (t1.f1SignalStat() == -1) { - histos.fill(HIST("h2MixEventInvariantMassLike_mass"), relative_momentum, F1.Pt(), F1.M(), 1.0); - if (fillSparse) { - histos.fill(HIST("MEMassLike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC, 1.0); - } - } - if (fillRotation) { - for (int nrotbkg = 0; nrotbkg < nRot; nrotbkg++) { - auto anglestart = 5.0 * TMath::Pi() / 6.0; - auto angleend = 7.0 * TMath::Pi() / 6.0; - auto anglestep = (angleend - anglestart) / (1.0 * (9.0 - 1.0)); - auto rotangle = anglestart + nrotbkg * anglestep; - auto rotPionPx = Pion.Px() * std::cos(rotangle) - Pion.Py() * std::sin(rotangle); - auto rotPionPy = Pion.Px() * std::sin(rotangle) + Pion.Py() * std::cos(rotangle); - PionRot.SetXYZM(rotPionPx, rotPionPy, Pion.Pz(), Pion.M()); - F1Rot = PionRot + KaonKshortPair; - if (F1Rot.Pt() < 1.0) { + + for (auto const& t2 : p_c2) { // proton from c2 + Proton.SetXYZM(t2.protonPx(), t2.protonPy(), t2.protonPz(), 0.938); + if (Proton.Pt() > momentumProtonMax) + continue; + if (Proton.P() < momentumTOFProton && TMath::Abs(t2.protonNsigmaTPC()) > 2.5) + continue; + if (Proton.P() >= momentumTOFProton && (t2.protonTOFHit() != 1 || TMath::Abs(t2.protonNsigmaTOF()) > 2.5)) + continue; + + for (auto const& t3 : f1_c2) { // pion from c2 + Pion.SetXYZM(t3.f1d1Px(), t3.f1d1Py(), t3.f1d1Pz(), 0.139); + if (Pion.Pt() > maxMomentumPion) continue; + if (pdepPID) { + if (Pion.Pt() < 2.0 && (t3.f1d1TPC() < -2.5 || t3.f1d1TPC() > 2.5)) + continue; + if (Pion.Pt() >= 2.0 && (t3.f1d1TPC() < -2.5 || t3.f1d1TPC() > 2.5)) + continue; } - auto relative_momentum_rot = getkstar(F1Rot, Proton); - if (t1.f1SignalStat() > 0) { - histos.fill(HIST("h2MixEventInvariantMassRot_mass"), relative_momentum_rot, F1Rot.Pt(), F1Rot.M(), 1.0); - if (fillSparse) { - histos.fill(HIST("MEMassRot"), F1Rot.M(), F1Rot.Pt(), Proton.Pt(), relative_momentum_rot, combinedTPC, 1.0); - } - } + if (strategyPIDPion == 1 && + Pion.Pt() > momentumTOFPionMin && Pion.Pt() <= momentumTOFPionMax && + t3.f1d1TOFHit() != 1) + continue; + + F1 = Pion + KaonKshortPair; + + if (t1.f1SignalStat() <= 0) + continue; + + int f1Charge = t1.f1SignalStat(); + float pairQ = f1Charge * t2.protonCharge(); + + auto kstar = getkstar(F1, Proton); + + histos.fill(HIST("h2MixEventInvariantMassUnlike_mass_DEFP"), + kstar, F1.Pt(), F1.M(), pairQ); } } } } } - PROCESS_SWITCH(f1protoncorrelation, processME, "Process EventMixing for combinatorial background", false); + + PROCESS_SWITCH(f1protoncorrelation, processME, "Process EventMixing for combinatorial background (SE-F1P & DE-F1P, minimal)", false); + void processMEOpti(aod::RedF1PEvents& collisions, aod::F1Tracks& f1tracks, aod::ProtonTracks& protontracks) { // for (auto const& [collision1, collision2] : combinations(soa::CombinationsBlockFullIndexPolicy(colBinningFemto, nEvtMixing, -1, collisions, collisions))){ @@ -544,8 +599,8 @@ struct f1protoncorrelation { kaonCharge = -1; } histos.fill(HIST("h2MixEventInvariantMassUnlike_mass"), relative_momentum, F1.Pt(), F1.M(), pairCharge); // F1 sign = 1 unlike, F1 sign = -1 like - histos.fill(HIST("hPhaseSpaceProtonKaonMix"), Proton.Eta() - Kaon.Eta(), PhiAtSpecificRadiiTPC(Proton, Kaon, t2.protonCharge(), kaonCharge, bz, bz2)); // Phase Space Proton kaon - histos.fill(HIST("hPhaseSpaceProtonPionMix"), Proton.Eta() - Kaon.Eta(), PhiAtSpecificRadiiTPC(Proton, Pion, t2.protonCharge(), pionCharge, bz, bz2)); // Phase Space Proton Pion + histos.fill(HIST("hPhaseSpaceProtonKaonMix"), Proton.Eta() - Kaon.Eta(), PhiAtSpecificRadiiTPC(Proton, Kaon, t2.protonCharge(), kaonCharge, bz, bz2), relative_momentum); // Phase Space Proton kaon + histos.fill(HIST("hPhaseSpaceProtonPionMix"), Proton.Eta() - Kaon.Eta(), PhiAtSpecificRadiiTPC(Proton, Pion, t2.protonCharge(), pionCharge, bz, bz2), relative_momentum); // Phase Space Proton Pion if (fillSparse) { histos.fill(HIST("MEMassUnlike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC, pairCharge); } From 55e84d79687fd59166595cf49003990ddc979277 Mon Sep 17 00:00:00 2001 From: tutripat <73981392+tutripat@users.noreply.github.com> Date: Sat, 20 Sep 2025 14:49:45 +0100 Subject: [PATCH 470/986] [PWGLF] Update to add processReassociation3d and dca information (#12904) Co-authored-by: ALICE Action Bot --- .../GlobalEventProperties/dndeta-mft-pp.cxx | 115 ++++++++++++++++-- 1 file changed, 102 insertions(+), 13 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/dndeta-mft-pp.cxx b/PWGLF/Tasks/GlobalEventProperties/dndeta-mft-pp.cxx index a37b4f8c368..e75c5e32371 100644 --- a/PWGLF/Tasks/GlobalEventProperties/dndeta-mft-pp.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/dndeta-mft-pp.cxx @@ -53,7 +53,8 @@ AxisSpec DeltaZAxis = {61, -6.1, 6.1}; AxisSpec ZAxis = {301, -30.1, 30.1}; AxisSpec PhiAxis = {629, 0, o2::constants::math::TwoPI, "Rad", "phi axis"}; // AxisSpec EtaAxis = {18, -4.6, -1.}; -AxisSpec DCAxyAxis = {100, -1, 10}; +AxisSpec DCAxyAxis = {5000, -1, 500}; +AxisSpec DCAzAxis = {5000, -251, 250}; AxisSpec CentAxis = {{0, 10, 20, 30, 40, 50, 60, 70, 80, 100}}; static constexpr TrackSelectionFlags::flagtype trackSelectionITS = @@ -93,6 +94,8 @@ struct PseudorapidityDensityMFT { Configurable usePhiCut{"usePhiCut", true, "use azimuthal angle cut"}; Configurable useDCAxyCut{"useDCAxyCut", false, "use DCAxy cut"}; + Configurable useDCAzCut{"useDCAzCut", false, "use DCAz cut"}; + Configurable cfgPhiCut{"cfgPhiCut", 0.1f, "Cut on azimuthal angle of MFT tracks"}; Configurable cfgPhiCut1{"cfgPhiCut1", 0.0f, @@ -111,6 +114,7 @@ struct PseudorapidityDensityMFT { "Cut on eta1"}; Configurable cfgChi2NDFMax{"cfgChi2NDFMax", 2000.0f, "Max allowed chi2/NDF for MFT tracks"}; Configurable maxDCAxy{"maxDCAxy", 2.0f, "Cut on dcaXY"}; + Configurable maxDCAz{"maxDCAz", 2.0f, "Cut on dcaZ"}; HistogramRegistry registry{ "registry", @@ -143,11 +147,12 @@ struct PseudorapidityDensityMFT { { if (static_cast(doprocessMult) + static_cast(doprocessMultReassoc) + + static_cast(doprocessMultReassoc3d) + static_cast(doprocessCountingCentrality) > 1) { LOGP(fatal, "Exactly one process function between processMult, " - "processMultReassoc and processCountingCentrality should be " + "processMultReassoc, processMultReassoc3d and processCountingCentrality should be " "enabled!"); } AxisSpec MultAxis = {multBinning, "N_{trk}"}; @@ -251,7 +256,7 @@ struct PseudorapidityDensityMFT { x->SetBinLabel(5, "Selected INEL>0"); } - if (doprocessMultReassoc) { + if (doprocessMultReassoc || doprocessMultReassoc3d) { registry.add({"Tracks/Control/DeltaZ", " ; #it{z_{orig}}-#it{z_{reass}}", {HistType::kTH1F, {ZAxis}}}); @@ -321,6 +326,9 @@ struct PseudorapidityDensityMFT { registry.add({"Tracks/Control/amb/EtaZvtxAmb_gt0", "; #eta; #it{z}_{vtx} (cm); tracks", {HistType::kTH2F, {EtaAxis, ZAxis}}}); // + registry.add({"Tracks/Control/amb/DCAxy_amb", " ; DCA_{xy} (cm) ambiguous", + // {HistType::kTH1F,{{100000, 0.5, 100000.0}}}}); // + {HistType::kTH1F, {DCAxyAxis}}}); // registry.add({"Tracks/Control/nonamb/nonAmbTracksEtaZvtx", "; #eta; #it{z}_{vtx} (cm); tracks", @@ -335,6 +343,9 @@ struct PseudorapidityDensityMFT { registry.add({"Tracks/Control/nonamb/EtaZvtxNonAmb_gt0", "; #eta; #it{z}_{vtx} (cm); tracks", {HistType::kTH2F, {EtaAxis, ZAxis}}}); // + registry.add({"Tracks/Control/nonamb/DCAxy_nonamb", " ; DCA_{xy}(cm) non-ambiguous", + // {HistType::kTH1F,{{100000, 0.5, 100000.0}}}}); // + {HistType::kTH1F, {{DCAxyAxis}}}}); // registry.add({"Tracks/Control/woOrp/woOrpTracksEtaZvtx", "; #eta; #it{z}_{vtx} (cm); tracks", @@ -360,6 +371,26 @@ struct PseudorapidityDensityMFT { registry.add({"Tracks/Control/woOrp/woOrpVertexCorr", "; #it{z}_{vtx}^{orig} (cm); #it{z}_{vtx}^{re} (cm)", {HistType::kTH2F, {ZAxis, ZAxis}}}); // + registry.add({"Tracks/Control/woOrp/DCAxy_woOrp", " ; DCA_{xy}(cm) w/o orphan", + // {HistType::kTH1F,{{100000, 0.5, 100000.0}}}}); // + {HistType::kTH1F, {{DCAxyAxis}}}}); // + + if (doprocessMultReassoc3d) { + // DCAz histograms analogous to DCAxy, only for 3D reassociation + registry.add({"Tracks/Control/DCAZ", + " ; DCA_{Z} (cm)", + {HistType::kTH1F, {DCAzAxis}}}); + registry.add({"Tracks/Control/amb/DCAz_amb", + " ; DCA_{z} (cm) ambiguous", + {HistType::kTH1F, {DCAzAxis}}}); + registry.add({"Tracks/Control/nonamb/DCAz_nonamb", + " ; DCA_{z}(cm) non-ambiguous", + {HistType::kTH1F, {DCAzAxis}}}); + registry.add({"Tracks/Control/woOrp/DCAz_woOrp", + " ; DCA_{z}(cm) w/o orphan", + {HistType::kTH1F, {DCAzAxis}}}); + } + registry.add({"collisionID", " ; Collision ID", // {HistType::kTH1F,{{100000, 0.5, 100000.0}}}}); // {HistType::kTH1F, {{100000, -50000.0, 50000.0}}}}); // @@ -567,10 +598,12 @@ struct PseudorapidityDensityMFT { PROCESS_SWITCH(PseudorapidityDensityMFT, processMult, "Process reco or data info", true); - void processMultReassoc(CollwEv::iterator const& collision, - o2::aod::MFTTracks const&, - soa::SmallGroups const& retracks, - FiCentralTracks const& midtracks, aod::Tracks const&) + // Common implementation for both BestCollisionsFwd and BestCollisionsFwd3d + template + void processMultReassocCommon(CollwEv::iterator const& collision, + o2::aod::MFTTracks const&, + RetracksT const& retracks, + FiCentralTracks const& midtracks, aod::Tracks const&) { registry.fill(HIST("EventSelection"), 1.); auto perCollisionSample = sampleCentral->sliceByCached( @@ -596,6 +629,13 @@ struct PseudorapidityDensityMFT { if (dcaxy_cut > maxDCAxy) continue; } + if constexpr (std::is_same_v>) { + float dcaz_cut = retrack.bestDCAZ(); + if (useDCAzCut) { + if (dcaz_cut > maxDCAz) + continue; + } + } if ((cfgnEta1 < track.eta()) && (track.eta() < cfgnEta2) && track.nClusters() >= cfgnCluster && retrack.ambDegree() > 0 && chi2ndf < cfgChi2NDFMax && (phi > cfgPhiCut1 && phi < cfgPhiCut2)) { registry.fill(HIST("Tracks/2Danalysis/EtaZvtx"), track.eta(), z); } @@ -641,6 +681,13 @@ struct PseudorapidityDensityMFT { if (dcaxy_cut > maxDCAxy) continue; } + if constexpr (std::is_same_v>) { + float dcaz_cut = retrack.bestDCAZ(); + if (useDCAzCut) { + if (dcaz_cut > maxDCAz) + continue; + } + } if ((cfgnEta1 < track.eta()) && (track.eta() < cfgnEta2) && track.nClusters() >= cfgnCluster && retrack.ambDegree() > 0 && chi2ndf < cfgChi2NDFMax && (phi > cfgPhiCut1 && phi < cfgPhiCut2)) { registry.fill(HIST("Tracks/Control/Chi2NDF"), chi2ndf); registry.fill(HIST("Tracks/2Danalysis/EtaZvtx_sel8"), track.eta(), z); @@ -661,6 +708,7 @@ struct PseudorapidityDensityMFT { float phi = track.phi(); float dcaxy_cut = retrack.bestDCAXY(); o2::math_utils::bringTo02Pi(phi); + // Declare dcaz_cut only if needed below. if ((cfgnEta1 < track.eta()) && (track.eta() < cfgnEta2) && track.nClusters() >= cfgnCluster && chi2ndf < cfgChi2NDFMax && (phi > cfgPhiCut1 && phi < cfgPhiCut2)) { if (usePhiCut) { if ((phi <= 0.02) || ((phi >= 3.10) && (phi <= 3.23)) || (phi >= 6.21)) @@ -670,6 +718,13 @@ struct PseudorapidityDensityMFT { if (dcaxy_cut > maxDCAxy) continue; } + if constexpr (std::is_same_v>) { + float dcaz_cut = retrack.bestDCAZ(); + if (useDCAzCut) { + if (dcaz_cut > maxDCAz) + continue; + } + } registry.fill(HIST("TracksEtaZvtx"), track.eta(), z); if (midtracks.size() > 0 && retrack.ambDegree() > 0) { registry.fill(HIST("Tracks/EtaZvtx_gt0"), track.eta(), z); @@ -701,10 +756,10 @@ struct PseudorapidityDensityMFT { registry.fill(HIST("Tracks/Control/ReassignedTracksPhiEta"), phi, track.eta()); registry.fill(HIST("Tracks/Control/ReassignedVertexCorr"), - track.collision_as().posZ(), z); + track.template collision_as().posZ(), z); registry.fill(HIST("Tracks/Control/DeltaZ"), - track.collision_as().posZ() - + track.template collision_as().posZ() - collision.posZ()); registry.fill(HIST("Tracks/Control/TrackCount"), 1); } @@ -714,13 +769,16 @@ struct PseudorapidityDensityMFT { registry.fill(HIST("Tracks/Control/notReassignedTracksPhiEta"), phi, track.eta()); registry.fill(HIST("Tracks/Control/notReassignedVertexCorr"), - track.collision_as().posZ(), z); + track.template collision_as().posZ(), z); registry.fill(HIST("Tracks/Control/TrackCount"), 2); } registry.fill(HIST("Tracks/Control/TrackAmbDegree"), retrack.ambDegree()); registry.fill(HIST("Tracks/Control/DCAXY"), retrack.bestDCAXY()); + if constexpr (std::is_same_v>) { + registry.fill(HIST("Tracks/Control/DCAZ"), retrack.bestDCAZ()); + } int isAmbiguous = 0; if (retrack.ambDegree() > 1 && retrack.ambDegree() != 0) { @@ -734,7 +792,11 @@ struct PseudorapidityDensityMFT { registry.fill(HIST("Tracks/Control/amb/AmbTracksPhiEta"), phi, track.eta()); registry.fill(HIST("Tracks/Control/amb/AmbVertexCorr"), - track.collision_as().posZ(), z); + track.template collision_as().posZ(), z); + registry.fill(HIST("Tracks/Control/amb/DCAxy_amb"), retrack.bestDCAXY()); + if constexpr (std::is_same_v>) { + registry.fill(HIST("Tracks/Control/amb/DCAz_amb"), retrack.bestDCAZ()); + } registry.fill(HIST("Tracks/Control/TrackCount"), 3); if (track.collisionId() == retrack.bestCollisionId()) { registry.fill(HIST("Tracks/Control/TrackCount"), 5); @@ -754,7 +816,11 @@ struct PseudorapidityDensityMFT { registry.fill(HIST("Tracks/Control/nonamb/nonAmbTracksPhiEta"), phi, track.eta()); registry.fill(HIST("Tracks/Control/nonamb/nonAmbVertexCorr"), - track.collision_as().posZ(), z); + track.template collision_as().posZ(), z); + registry.fill(HIST("Tracks/Control/nonamb/DCAxy_nonamb"), retrack.bestDCAXY()); + if constexpr (std::is_same_v>) { + registry.fill(HIST("Tracks/Control/nonamb/DCAz_nonamb"), retrack.bestDCAZ()); + } registry.fill(HIST("Tracks/Control/TrackCount"), 4); if (track.collisionId() == retrack.bestCollisionId()) { registry.fill(HIST("Tracks/Control/TrackCount"), 6); @@ -772,8 +838,12 @@ struct PseudorapidityDensityMFT { registry.fill(HIST("Tracks/Control/woOrp/woOrpTracksPhiEta"), phi, track.eta()); registry.fill(HIST("Tracks/Control/woOrp/woOrpVertexCorr"), - track.collision_as().posZ(), z); + track.template collision_as().posZ(), z); registry.fill(HIST("Tracks/Control/TrackCount"), 9); // without orphan + registry.fill(HIST("Tracks/Control/woOrp/DCAxy_woOrp"), retrack.bestDCAXY()); + if constexpr (std::is_same_v>) { + registry.fill(HIST("Tracks/Control/woOrp/DCAz_woOrp"), retrack.bestDCAZ()); + } } } } @@ -792,9 +862,28 @@ struct PseudorapidityDensityMFT { registry.fill(HIST("EventSelection"), 7); } } + + void processMultReassoc(CollwEv::iterator const& collision, + o2::aod::MFTTracks const& mft, + soa::SmallGroups const& retracks, + FiCentralTracks const& midtracks, aod::Tracks const& trk) + { + processMultReassocCommon(collision, mft, retracks, midtracks, trk); + } + + void processMultReassoc3d(CollwEv::iterator const& collision, + o2::aod::MFTTracks const& mft, + soa::SmallGroups const& retracks, + FiCentralTracks const& midtracks, aod::Tracks const& trk) + { + processMultReassocCommon(collision, mft, retracks, midtracks, trk); + } PROCESS_SWITCH(PseudorapidityDensityMFT, processMultReassoc, "Process reco or data info", false); + PROCESS_SWITCH(PseudorapidityDensityMFT, processMultReassoc3d, + "Process reco or data info (3d)", false); + using ExColsCent = soa::Join; void processCountingCentrality(ExColsCent::iterator const& collision, From 50bd8fe272de08eae085ed1b30fcbcb4299db075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Sat, 20 Sep 2025 17:29:41 +0200 Subject: [PATCH 471/986] [PWGLF] Re-add references to str in jet (#13061) --- PWGLF/Tasks/Strangeness/strangenessInJets.cxx | 388 +++++++++++------- 1 file changed, 247 insertions(+), 141 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/strangenessInJets.cxx b/PWGLF/Tasks/Strangeness/strangenessInJets.cxx index d909030b2d7..ee6d3846a39 100644 --- a/PWGLF/Tasks/Strangeness/strangenessInJets.cxx +++ b/PWGLF/Tasks/Strangeness/strangenessInJets.cxx @@ -97,7 +97,7 @@ struct StrangenessInJets { HistogramRegistry registryQC{"registryQC", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; // Global analysis parameters - Configurable particleOfInterest{"particleOfInterest", 0, "0 = K0 and Lambda, 1 = Xi and Omega"}; + Configurable particleOfInterest{"particleOfInterest", 0, "0 = K0 and Lambda, 1 = Xi and Omega, 2 = pion, 3 = kaon, 4 = proton"}; Configurable minJetPt{"minJetPt", 10.0, "Minimum reconstructed pt of the jet (GeV/c)"}; Configurable rJet{"rJet", 0.3, "Jet resolution parameter (R)"}; Configurable zVtx{"zVtx", 10.0, "Maximum z-vertex position"}; @@ -143,9 +143,18 @@ struct StrangenessInJets { Configurable deltaMassOmega{"deltaMassOmega", 0.02f, "Mass window for Omega rejection"}; Configurable deltaMassLambda{"deltaMassLambda", 0.02f, "Mass window for Lambda inclusion"}; + struct : ConfigurableGroup { + ConfigurableAxis longLivedBinsNsigma{"longLivedBinsNsigma", {200, -10.f, 10.f}, "Binning of nSigma axis"}; + ConfigurableAxis longLivedBinsPt{"longLivedBinsPt", {VARIABLE_WIDTH, -5.0, -4.8, -4.6, -4.4, -4.2, -4.0, -3.8, -3.6, -3.4, -3.2, -3.0, -2.8, -2.6, -2.4, -2.2, -2.0, -1.9, -1.8, -1.7, -1.6, -1.5, -1.4, -1.3, -1.2, -1.1, -1.0, -0.95, -0.9, -0.85, -0.8, -0.75, -0.7, -0.65, -0.6, -0.55, -0.5, -0.45, -0.4, -0.35, -0.3, -0.25, -0.2, -0.18, -0.16, -0.14, -0.12, -0.1, 0.0, 0.1, 0.12, 0.14, 0.16, 0.18, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8, 5.0}, "Binning of the pT axis"}; + ConfigurableAxis longLivedBinsDca{"longLivedBinsDca", {VARIABLE_WIDTH, -3.0, -2.95, -2.9, -2.85, -2.8, -2.75, -2.7, -2.65, -2.6, -2.55, -2.5, -2.45, -2.4, -2.35, -2.3, -2.25, -2.2, -2.15, -2.1, -2.05, -2.0, -1.975, -1.95, -1.925, -1.9, -1.875, -1.85, -1.825, -1.8, -1.775, -1.75, -1.725, -1.7, -1.675, -1.65, -1.625, -1.6, -1.575, -1.55, -1.525, -1.5, -1.475, -1.45, -1.425, -1.4, -1.375, -1.35, -1.325, -1.3, -1.275, -1.25, -1.225, -1.2, -1.175, -1.15, -1.125, -1.1, -1.075, -1.05, -1.025, -1.0, -0.99, -0.98, -0.97, -0.96, -0.95, -0.94, -0.93, -0.92, -0.91, -0.9, -0.89, -0.88, -0.87, -0.86, -0.85, -0.84, -0.83, -0.82, -0.81, -0.8, -0.79, -0.78, -0.77, -0.76, -0.75, -0.74, -0.73, -0.72, -0.71, -0.7, -0.69, -0.68, -0.67, -0.66, -0.65, -0.64, -0.63, -0.62, -0.61, -0.6, -0.59, -0.58, -0.57, -0.56, -0.55, -0.54, -0.53, -0.52, -0.51, -0.5, -0.49, -0.48, -0.47, -0.46, -0.45, -0.44, -0.43, -0.42, -0.41, -0.4, -0.396, -0.392, -0.388, -0.384, -0.38, -0.376, -0.372, -0.368, -0.364, -0.36, -0.356, -0.352, -0.348, -0.344, -0.34, -0.336, -0.332, -0.328, -0.324, -0.32, -0.316, -0.312, -0.308, -0.304, -0.3, -0.296, -0.292, -0.288, -0.284, -0.28, -0.276, -0.272, -0.268, -0.264, -0.26, -0.256, -0.252, -0.248, -0.244, -0.24, -0.236, -0.232, -0.228, -0.224, -0.22, -0.216, -0.212, -0.208, -0.204, -0.2, -0.198, -0.196, -0.194, -0.192, -0.19, -0.188, -0.186, -0.184, -0.182, -0.18, -0.178, -0.176, -0.174, -0.172, -0.17, -0.168, -0.166, -0.164, -0.162, -0.16, -0.158, -0.156, -0.154, -0.152, -0.15, -0.148, -0.146, -0.144, -0.142, -0.14, -0.138, -0.136, -0.134, -0.132, -0.13, -0.128, -0.126, -0.124, -0.122, -0.12, -0.118, -0.116, -0.114, -0.112, -0.11, -0.108, -0.106, -0.104, -0.102, -0.1, -0.099, -0.098, -0.097, -0.096, -0.095, -0.094, -0.093, -0.092, -0.091, -0.09, -0.089, -0.088, -0.087, -0.086, -0.085, -0.084, -0.083, -0.082, -0.081, -0.08, -0.079, -0.078, -0.077, -0.076, -0.075, -0.074, -0.073, -0.072, -0.071, -0.07, -0.069, -0.068, -0.067, -0.066, -0.065, -0.064, -0.063, -0.062, -0.061, -0.06, -0.059, -0.058, -0.057, -0.056, -0.055, -0.054, -0.053, -0.052, -0.051, -0.05, -0.049, -0.048, -0.047, -0.046, -0.045, -0.044, -0.043, -0.042, -0.041, -0.04, -0.039, -0.038, -0.037, -0.036, -0.035, -0.034, -0.033, -0.032, -0.031, -0.03, -0.029, -0.028, -0.027, -0.026, -0.025, -0.024, -0.023, -0.022, -0.021, -0.02, -0.019, -0.018, -0.017, -0.016, -0.015, -0.014, -0.013, -0.012, -0.011, -0.01, -0.009, -0.008, -0.007, -0.006, -0.005, -0.004, -0.003, -0.002, -0.001, -0.0, 0.001, 0.002, 0.003, 0.004, 0.005, 0.006, 0.007, 0.008, 0.009, 0.01, 0.011, 0.012, 0.013, 0.014, 0.015, 0.016, 0.017, 0.018, 0.019, 0.02, 0.021, 0.022, 0.023, 0.024, 0.025, 0.026, 0.027, 0.028, 0.029, 0.03, 0.031, 0.032, 0.033, 0.034, 0.035, 0.036, 0.037, 0.038, 0.039, 0.04, 0.041, 0.042, 0.043, 0.044, 0.045, 0.046, 0.047, 0.048, 0.049, 0.05, 0.051, 0.052, 0.053, 0.054, 0.055, 0.056, 0.057, 0.058, 0.059, 0.06, 0.061, 0.062, 0.063, 0.064, 0.065, 0.066, 0.067, 0.068, 0.069, 0.07, 0.071, 0.072, 0.073, 0.074, 0.075, 0.076, 0.077, 0.078, 0.079, 0.08, 0.081, 0.082, 0.083, 0.084, 0.085, 0.086, 0.087, 0.088, 0.089, 0.09, 0.091, 0.092, 0.093, 0.094, 0.095, 0.096, 0.097, 0.098, 0.099, 0.1, 0.102, 0.104, 0.106, 0.108, 0.11, 0.112, 0.114, 0.116, 0.118, 0.12, 0.122, 0.124, 0.126, 0.128, 0.13, 0.132, 0.134, 0.136, 0.138, 0.14, 0.142, 0.144, 0.146, 0.148, 0.15, 0.152, 0.154, 0.156, 0.158, 0.16, 0.162, 0.164, 0.166, 0.168, 0.17, 0.172, 0.174, 0.176, 0.178, 0.18, 0.182, 0.184, 0.186, 0.188, 0.19, 0.192, 0.194, 0.196, 0.198, 0.2, 0.204, 0.208, 0.212, 0.216, 0.22, 0.224, 0.228, 0.232, 0.236, 0.24, 0.244, 0.248, 0.252, 0.256, 0.26, 0.264, 0.268, 0.272, 0.276, 0.28, 0.284, 0.288, 0.292, 0.296, 0.3, 0.304, 0.308, 0.312, 0.316, 0.32, 0.324, 0.328, 0.332, 0.336, 0.34, 0.344, 0.348, 0.352, 0.356, 0.36, 0.364, 0.368, 0.372, 0.376, 0.38, 0.384, 0.388, 0.392, 0.396, 0.4, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.5, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.6, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.7, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.8, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.9, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.0, 1.025, 1.05, 1.075, 1.1, 1.125, 1.15, 1.175, 1.2, 1.225, 1.25, 1.275, 1.3, 1.325, 1.35, 1.375, 1.4, 1.425, 1.45, 1.475, 1.5, 1.525, 1.55, 1.575, 1.6, 1.625, 1.65, 1.675, 1.7, 1.725, 1.75, 1.775, 1.8, 1.825, 1.85, 1.875, 1.9, 1.925, 1.95, 1.975, 2.0, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65, 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3.0}, "Binning of DCA xy and z axis"}; + } longLivedOptions; + // List of Particles - enum Option { kV0Particles, - kCascades }; + enum ParticleOfInterest { kV0Particles, + kCascades, + kPions, + kKaons, + kProtons }; // Instantiate utility class for jet background subtraction JetBkgSubUtils backgroundSub; @@ -173,6 +182,10 @@ struct StrangenessInJets { const AxisSpec invMassLambdaAxis{200, 1.09, 1.14, "m_{p#pi} (GeV/#it{c}^{2})"}; const AxisSpec invMassXiAxis{200, 1.28, 1.36, "m_{p#pi#pi} (GeV/#it{c}^{2})"}; const AxisSpec invMassOmegaAxis{200, 1.63, 1.71, "m_{p#piK} (GeV/#it{c}^{2})"}; + const AxisSpec ptAxisLongLived{longLivedOptions.longLivedBinsPt, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec nsigmaTOFAxis{longLivedOptions.longLivedBinsNsigma, "n#sigma_{TOF}"}; + const AxisSpec nsigmaTPCAxis{longLivedOptions.longLivedBinsNsigma, "n#sigma_{TPC}"}; + const AxisSpec dcaAxis{longLivedOptions.longLivedBinsDca, "DCA_{xy} (cm)"}; // Histograms for real data if (doprocessData) { @@ -183,7 +196,7 @@ struct StrangenessInJets { // Histograms for analysis of strange hadrons switch (particleOfInterest) { - case kV0Particles: + case ParticleOfInterest::kV0Particles: registryData.add("Lambda_in_jet", "Lambda_in_jet", HistType::kTH3F, {multBinning, ptAxis, invMassLambdaAxis}); registryData.add("AntiLambda_in_jet", "AntiLambda_in_jet", HistType::kTH3F, {multBinning, ptAxis, invMassLambdaAxis}); registryData.add("Lambda_in_ue", "Lambda_in_ue", HistType::kTH3F, {multBinning, ptAxis, invMassLambdaAxis}); @@ -191,7 +204,7 @@ struct StrangenessInJets { registryData.add("K0s_in_jet", "K0s_in_jet", HistType::kTH3F, {multBinning, ptAxis, invMassK0sAxis}); registryData.add("K0s_in_ue", "K0s_in_ue", HistType::kTH3F, {multBinning, ptAxis, invMassK0sAxis}); break; - case kCascades: + case ParticleOfInterest::kCascades: registryData.add("XiPos_in_jet", "XiPos_in_jet", HistType::kTH3F, {multBinning, ptAxis, invMassXiAxis}); registryData.add("XiPos_in_ue", "XiPos_in_ue", HistType::kTH3F, {multBinning, ptAxis, invMassXiAxis}); registryData.add("XiNeg_in_jet", "XiNeg_in_jet", HistType::kTH3F, {multBinning, ptAxis, invMassXiAxis}); @@ -201,6 +214,12 @@ struct StrangenessInJets { registryData.add("OmegaNeg_in_jet", "OmegaNeg_in_jet", HistType::kTH3F, {multBinning, ptAxis, invMassOmegaAxis}); registryData.add("OmegaNeg_in_ue", "OmegaNeg_in_ue", HistType::kTH3F, {multBinning, ptAxis, invMassOmegaAxis}); break; + case ParticleOfInterest::kPions: + case ParticleOfInterest::kKaons: + case ParticleOfInterest::kProtons: + registryData.add("ll_in_jet", "ll_in_jet", HistType::kTHnSparseF, {multBinning, ptAxisLongLived, nsigmaTPCAxis, nsigmaTOFAxis, dcaAxis}); + registryData.add("ll_in_ue", "ll_in_ue", HistType::kTHnSparseF, {multBinning, ptAxisLongLived, nsigmaTPCAxis, nsigmaTOFAxis, dcaAxis}); + break; default: LOG(fatal) << "Cannot interpret particle " << particleOfInterest; break; @@ -214,20 +233,34 @@ struct StrangenessInJets { registryMC.add("number_of_events_mc_gen", "number of gen events in mc", HistType::kTH1D, {{10, 0, 10, "Event Cuts"}}); // Histograms for analysis - registryMC.add("K0s_generated_jet", "K0s_generated_jet", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("K0s_generated_ue", "K0s_generated_ue", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("Lambda_generated_jet", "Lambda_generated_jet", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("Lambda_generated_ue", "Lambda_generated_ue", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("AntiLambda_generated_jet", "AntiLambda_generated_jet", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("AntiLambda_generated_ue", "AntiLambda_generated_ue", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("XiPos_generated_jet", "XiPos_generated_jet", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("XiPos_generated_ue", "XiPos_generated_ue", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("XiNeg_generated_jet", "XiNeg_generated_jet", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("XiNeg_generated_ue", "XiNeg_generated_ue", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("OmegaPos_generated_jet", "OmegaPos_generated_jet", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("OmegaPos_generated_ue", "OmegaPos_generated_ue", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("OmegaNeg_generated_jet", "OmegaNeg_generated_jet", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("OmegaNeg_generated_ue", "OmegaNeg_generated_ue", HistType::kTH2F, {multBinning, ptAxis}); + switch (particleOfInterest) { + case ParticleOfInterest::kV0Particles: + registryMC.add("K0s_generated_jet", "K0s_generated_jet", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("K0s_generated_ue", "K0s_generated_ue", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("Lambda_generated_jet", "Lambda_generated_jet", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("Lambda_generated_ue", "Lambda_generated_ue", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("AntiLambda_generated_jet", "AntiLambda_generated_jet", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("AntiLambda_generated_ue", "AntiLambda_generated_ue", HistType::kTH2F, {multBinning, ptAxis}); + break; + case ParticleOfInterest::kCascades: + registryMC.add("XiPos_generated_jet", "XiPos_generated_jet", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("XiPos_generated_ue", "XiPos_generated_ue", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("XiNeg_generated_jet", "XiNeg_generated_jet", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("XiNeg_generated_ue", "XiNeg_generated_ue", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("OmegaPos_generated_jet", "OmegaPos_generated_jet", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("OmegaPos_generated_ue", "OmegaPos_generated_ue", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("OmegaNeg_generated_jet", "OmegaNeg_generated_jet", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("OmegaNeg_generated_ue", "OmegaNeg_generated_ue", HistType::kTH2F, {multBinning, ptAxis}); + break; + case ParticleOfInterest::kPions: + case ParticleOfInterest::kKaons: + case ParticleOfInterest::kProtons: + registryMC.add("ll_generated_in_jet", "ll_generated_in_jet", HistType::kTH2F, {multBinning, ptAxisLongLived}); + registryMC.add("ll_generated_in_ue", "ll_generated_in_ue", HistType::kTH2F, {multBinning, ptAxisLongLived}); + break; + default: + LOG(fatal) << "Cannot interpret particle " << particleOfInterest; + } } // Histograms for mc reconstructed @@ -237,28 +270,41 @@ struct StrangenessInJets { registryMC.add("number_of_events_mc_rec", "number of rec events in mc", HistType::kTH1D, {{10, 0, 10, "Event Cuts"}}); // Histograms for analysis - registryMC.add("K0s_reconstructed_jet", "K0s_reconstructed_jet", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("K0s_reconstructed_ue", "K0s_reconstructed_ue", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("Lambda_reconstructed_jet", "Lambda_reconstructed_jet", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("Lambda_reconstructed_ue", "Lambda_reconstructed_ue", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("AntiLambda_reconstructed_jet", "AntiLambda_reconstructed_jet", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("AntiLambda_reconstructed_ue", "AntiLambda_reconstructed_ue", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("XiPos_reconstructed_jet", "XiPos_reconstructed_jet", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("XiPos_reconstructed_ue", "XiPos_reconstructed_ue", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("XiNeg_reconstructed_jet", "XiNeg_reconstructed_jet", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("XiNeg_reconstructed_ue", "XiNeg_reconstructed_ue", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("OmegaPos_reconstructed_jet", "OmegaPos_reconstructed_jet", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("OmegaPos_reconstructed_ue", "OmegaPos_reconstructed_ue", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("OmegaNeg_reconstructed_jet", "OmegaNeg_reconstructed_jet", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("OmegaNeg_reconstructed_ue", "OmegaNeg_reconstructed_ue", HistType::kTH2F, {multBinning, ptAxis}); - - // Histograms for secondary hadrons - registryMC.add("K0s_reconstructed_jet_incl", "K0s_reconstructed_jet_incl", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("K0s_reconstructed_ue_incl", "K0s_reconstructed_ue_incl", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("Lambda_reconstructed_jet_incl", "Lambda_reconstructed_jet_incl", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("Lambda_reconstructed_ue_incl", "Lambda_reconstructed_ue_incl", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("AntiLambda_reconstructed_jet_incl", "AntiLambda_reconstructed_jet_incl", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("AntiLambda_reconstructed_ue_incl", "AntiLambda_reconstructed_ue_incl", HistType::kTH2F, {multBinning, ptAxis}); + switch (particleOfInterest) { + case ParticleOfInterest::kV0Particles: + registryMC.add("K0s_reconstructed_jet", "K0s_reconstructed_jet", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("K0s_reconstructed_ue", "K0s_reconstructed_ue", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("Lambda_reconstructed_jet", "Lambda_reconstructed_jet", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("Lambda_reconstructed_ue", "Lambda_reconstructed_ue", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("AntiLambda_reconstructed_jet", "AntiLambda_reconstructed_jet", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("AntiLambda_reconstructed_ue", "AntiLambda_reconstructed_ue", HistType::kTH2F, {multBinning, ptAxis}); + // Histograms for secondary hadrons + registryMC.add("K0s_reconstructed_jet_incl", "K0s_reconstructed_jet_incl", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("K0s_reconstructed_ue_incl", "K0s_reconstructed_ue_incl", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("Lambda_reconstructed_jet_incl", "Lambda_reconstructed_jet_incl", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("Lambda_reconstructed_ue_incl", "Lambda_reconstructed_ue_incl", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("AntiLambda_reconstructed_jet_incl", "AntiLambda_reconstructed_jet_incl", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("AntiLambda_reconstructed_ue_incl", "AntiLambda_reconstructed_ue_incl", HistType::kTH2F, {multBinning, ptAxis}); + break; + case ParticleOfInterest::kCascades: + registryMC.add("XiPos_reconstructed_jet", "XiPos_reconstructed_jet", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("XiPos_reconstructed_ue", "XiPos_reconstructed_ue", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("XiNeg_reconstructed_jet", "XiNeg_reconstructed_jet", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("XiNeg_reconstructed_ue", "XiNeg_reconstructed_ue", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("OmegaPos_reconstructed_jet", "OmegaPos_reconstructed_jet", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("OmegaPos_reconstructed_ue", "OmegaPos_reconstructed_ue", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("OmegaNeg_reconstructed_jet", "OmegaNeg_reconstructed_jet", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("OmegaNeg_reconstructed_ue", "OmegaNeg_reconstructed_ue", HistType::kTH2F, {multBinning, ptAxis}); + break; + case ParticleOfInterest::kPions: + case ParticleOfInterest::kKaons: + case ParticleOfInterest::kProtons: + registryMC.add("ll_reconstructed_in_jet", "ll_reconstructed_in_jet", HistType::kTH2F, {multBinning, ptAxisLongLived}); + registryMC.add("ll_reconstructed_in_ue", "ll_reconstructed_in_ue", HistType::kTH2F, {multBinning, ptAxisLongLived}); + break; + default: + LOG(fatal) << "Cannot interpret particle " << particleOfInterest; + } } } @@ -269,9 +315,9 @@ struct StrangenessInJets { double ux(0), uy(0), uz(0); // components of vector p - double px = p.X(); - double py = p.Y(); - double pz = p.Z(); + const double px = p.X(); + const double py = p.Y(); + const double pz = p.Z(); // protection 1 if (px == 0 && py != 0) { @@ -292,10 +338,10 @@ struct StrangenessInJets { } // equation parameters - double a = px * px + py * py; - double b = 2.0 * px * pz * pz; - double c = pz * pz * pz * pz - py * py * py * py - px * px * py * py; - double delta = b * b - 4.0 * a * c; + const double a = px * px + py * py; + const double b = 2.0 * px * pz * pz; + const double c = pz * pz * pz * pz - py * py * py * py - px * px * py * py; + const double delta = b * b - 4.0 * a * c; // protection agains delta<0 if (delta < 0) { @@ -858,115 +904,156 @@ struct StrangenessInJets { // Loop over selected jets for (int i = 0; i < static_cast(selectedJet.size()); i++) { + switch (particleOfInterest) { + case ParticleOfInterest::kV0Particles: // V0s + for (const auto& v0 : fullV0s) { - // kV0Particles - if (particleOfInterest == Option::kV0Particles) { - for (const auto& v0 : fullV0s) { - - // Get V0 daughters - const auto& pos = v0.posTrack_as(); - const auto& neg = v0.negTrack_as(); - TVector3 v0dir(v0.px(), v0.py(), v0.pz()); - - // Calculate distance from jet and UE axes - float deltaEtaJet = v0dir.Eta() - selectedJet[i].Eta(); - float deltaPhiJet = getDeltaPhi(v0dir.Phi(), selectedJet[i].Phi()); - float deltaRjet = std::sqrt(deltaEtaJet * deltaEtaJet + deltaPhiJet * deltaPhiJet); - float deltaEtaUe1 = v0dir.Eta() - ue1[i].Eta(); - float deltaPhiUe1 = getDeltaPhi(v0dir.Phi(), ue1[i].Phi()); - float deltaRue1 = std::sqrt(deltaEtaUe1 * deltaEtaUe1 + deltaPhiUe1 * deltaPhiUe1); - float deltaEtaUe2 = v0dir.Eta() - ue2[i].Eta(); - float deltaPhiUe2 = getDeltaPhi(v0dir.Phi(), ue2[i].Phi()); - float deltaRue2 = std::sqrt(deltaEtaUe2 * deltaEtaUe2 + deltaPhiUe2 * deltaPhiUe2); - - // K0s - if (passedK0ShortSelection(v0, pos, neg)) { - if (deltaRjet < rJet) { - registryData.fill(HIST("K0s_in_jet"), multiplicity, v0.pt(), v0.mK0Short()); - } - if (deltaRue1 < rJet || deltaRue2 < rJet) { - registryData.fill(HIST("K0s_in_ue"), multiplicity, v0.pt(), v0.mK0Short()); - } - } - // Lambda - if (passedLambdaSelection(v0, pos, neg)) { - if (deltaRjet < rJet) { - registryData.fill(HIST("Lambda_in_jet"), multiplicity, v0.pt(), v0.mLambda()); - } - if (deltaRue1 < rJet || deltaRue2 < rJet) { - registryData.fill(HIST("Lambda_in_ue"), multiplicity, v0.pt(), v0.mLambda()); + // Get V0 daughters + const auto& pos = v0.posTrack_as(); + const auto& neg = v0.negTrack_as(); + TVector3 v0dir(v0.px(), v0.py(), v0.pz()); + + // Calculate distance from jet and UE axes + const float deltaEtaJet = v0dir.Eta() - selectedJet[i].Eta(); + const float deltaPhiJet = getDeltaPhi(v0dir.Phi(), selectedJet[i].Phi()); + const float deltaRjet = std::sqrt(deltaEtaJet * deltaEtaJet + deltaPhiJet * deltaPhiJet); + const float deltaEtaUe1 = v0dir.Eta() - ue1[i].Eta(); + const float deltaPhiUe1 = getDeltaPhi(v0dir.Phi(), ue1[i].Phi()); + const float deltaRue1 = std::sqrt(deltaEtaUe1 * deltaEtaUe1 + deltaPhiUe1 * deltaPhiUe1); + const float deltaEtaUe2 = v0dir.Eta() - ue2[i].Eta(); + const float deltaPhiUe2 = getDeltaPhi(v0dir.Phi(), ue2[i].Phi()); + const float deltaRue2 = std::sqrt(deltaEtaUe2 * deltaEtaUe2 + deltaPhiUe2 * deltaPhiUe2); + + // K0s + if (passedK0ShortSelection(v0, pos, neg)) { + if (deltaRjet < rJet) { + registryData.fill(HIST("K0s_in_jet"), multiplicity, v0.pt(), v0.mK0Short()); + } + if (deltaRue1 < rJet || deltaRue2 < rJet) { + registryData.fill(HIST("K0s_in_ue"), multiplicity, v0.pt(), v0.mK0Short()); + } } - } - // AntiLambda - if (passedAntiLambdaSelection(v0, pos, neg)) { - if (deltaRjet < rJet) { - registryData.fill(HIST("AntiLambda_in_jet"), multiplicity, v0.pt(), v0.mAntiLambda()); + // Lambda + if (passedLambdaSelection(v0, pos, neg)) { + if (deltaRjet < rJet) { + registryData.fill(HIST("Lambda_in_jet"), multiplicity, v0.pt(), v0.mLambda()); + } + if (deltaRue1 < rJet || deltaRue2 < rJet) { + registryData.fill(HIST("Lambda_in_ue"), multiplicity, v0.pt(), v0.mLambda()); + } } - if (deltaRue1 < rJet || deltaRue2 < rJet) { - registryData.fill(HIST("AntiLambda_in_ue"), multiplicity, v0.pt(), v0.mAntiLambda()); + // AntiLambda + if (passedAntiLambdaSelection(v0, pos, neg)) { + if (deltaRjet < rJet) { + registryData.fill(HIST("AntiLambda_in_jet"), multiplicity, v0.pt(), v0.mAntiLambda()); + } + if (deltaRue1 < rJet || deltaRue2 < rJet) { + registryData.fill(HIST("AntiLambda_in_ue"), multiplicity, v0.pt(), v0.mAntiLambda()); + } } } - } - } + break; + case ParticleOfInterest::kCascades: // Cascades + for (const auto& casc : Cascades) { + // Get cascade daughters + const auto& bach = casc.bachelor_as(); + const auto& pos = casc.posTrack_as(); + const auto& neg = casc.negTrack_as(); + TVector3 cascadeDir(casc.px(), casc.py(), casc.pz()); - // Cascades - if (particleOfInterest == Option::kCascades) { - for (const auto& casc : Cascades) { - - // Get cascade daughters - auto bach = casc.bachelor_as(); - auto pos = casc.posTrack_as(); - auto neg = casc.negTrack_as(); - TVector3 cascadeDir(casc.px(), casc.py(), casc.pz()); - - // Calculate distance from jet and UE axes - double deltaEtaJet = cascadeDir.Eta() - selectedJet[i].Eta(); - double deltaPhiJet = getDeltaPhi(cascadeDir.Phi(), selectedJet[i].Phi()); - double deltaRjet = std::sqrt(deltaEtaJet * deltaEtaJet + deltaPhiJet * deltaPhiJet); - double deltaEtaUe1 = cascadeDir.Eta() - ue1[i].Eta(); - double deltaPhiUe1 = getDeltaPhi(cascadeDir.Phi(), ue1[i].Phi()); - double deltaRue1 = std::sqrt(deltaEtaUe1 * deltaEtaUe1 + deltaPhiUe1 * deltaPhiUe1); - double deltaEtaUe2 = cascadeDir.Eta() - ue2[i].Eta(); - double deltaPhiUe2 = getDeltaPhi(cascadeDir.Phi(), ue2[i].Phi()); - double deltaRue2 = std::sqrt(deltaEtaUe2 * deltaEtaUe2 + deltaPhiUe2 * deltaPhiUe2); - - // Xi+ - if (passedXiSelection(casc, pos, neg, bach, collision) && bach.sign() > 0) { - if (deltaRjet < rJet) { - registryData.fill(HIST("XiPos_in_jet"), multiplicity, casc.pt(), casc.mXi()); + // Calculate distance from jet and UE axes + const double deltaEtaJet = cascadeDir.Eta() - selectedJet[i].Eta(); + const double deltaPhiJet = getDeltaPhi(cascadeDir.Phi(), selectedJet[i].Phi()); + const double deltaRjet = std::sqrt(deltaEtaJet * deltaEtaJet + deltaPhiJet * deltaPhiJet); + const double deltaEtaUe1 = cascadeDir.Eta() - ue1[i].Eta(); + const double deltaPhiUe1 = getDeltaPhi(cascadeDir.Phi(), ue1[i].Phi()); + const double deltaRue1 = std::sqrt(deltaEtaUe1 * deltaEtaUe1 + deltaPhiUe1 * deltaPhiUe1); + const double deltaEtaUe2 = cascadeDir.Eta() - ue2[i].Eta(); + const double deltaPhiUe2 = getDeltaPhi(cascadeDir.Phi(), ue2[i].Phi()); + const double deltaRue2 = std::sqrt(deltaEtaUe2 * deltaEtaUe2 + deltaPhiUe2 * deltaPhiUe2); + + // Xi+ + if (passedXiSelection(casc, pos, neg, bach, collision) && bach.sign() > 0) { + if (deltaRjet < rJet) { + registryData.fill(HIST("XiPos_in_jet"), multiplicity, casc.pt(), casc.mXi()); + } + if (deltaRue1 < rJet || deltaRue2 < rJet) { + registryData.fill(HIST("XiPos_in_ue"), multiplicity, casc.pt(), casc.mXi()); + } } - if (deltaRue1 < rJet || deltaRue2 < rJet) { - registryData.fill(HIST("XiPos_in_ue"), multiplicity, casc.pt(), casc.mXi()); + // Xi- + if (passedXiSelection(casc, pos, neg, bach, collision) && bach.sign() < 0) { + if (deltaRjet < rJet) { + registryData.fill(HIST("XiNeg_in_jet"), multiplicity, casc.pt(), casc.mXi()); + } + if (deltaRue1 < rJet || deltaRue2 < rJet) { + registryData.fill(HIST("XiNeg_in_ue"), multiplicity, casc.pt(), casc.mXi()); + } } - } - // Xi- - if (passedXiSelection(casc, pos, neg, bach, collision) && bach.sign() < 0) { - if (deltaRjet < rJet) { - registryData.fill(HIST("XiNeg_in_jet"), multiplicity, casc.pt(), casc.mXi()); + // Omega+ + if (passedOmegaSelection(casc, pos, neg, bach, collision) && bach.sign() > 0) { + if (deltaRjet < rJet) { + registryData.fill(HIST("OmegaPos_in_jet"), multiplicity, casc.pt(), casc.mOmega()); + } + if (deltaRue1 < rJet || deltaRue2 < rJet) { + registryData.fill(HIST("OmegaPos_in_ue"), multiplicity, casc.pt(), casc.mOmega()); + } } - if (deltaRue1 < rJet || deltaRue2 < rJet) { - registryData.fill(HIST("XiNeg_in_ue"), multiplicity, casc.pt(), casc.mXi()); + // Omega- + if (passedOmegaSelection(casc, pos, neg, bach, collision) && bach.sign() < 0) { + if (deltaRjet < rJet) { + registryData.fill(HIST("OmegaNeg_in_jet"), multiplicity, casc.pt(), casc.mOmega()); + } + if (deltaRue1 < rJet || deltaRue2 < rJet) { + registryData.fill(HIST("OmegaNeg_in_ue"), multiplicity, casc.pt(), casc.mOmega()); + } } } - // Omega+ - if (passedOmegaSelection(casc, pos, neg, bach, collision) && bach.sign() > 0) { - if (deltaRjet < rJet) { - registryData.fill(HIST("OmegaPos_in_jet"), multiplicity, casc.pt(), casc.mOmega()); + break; + case ParticleOfInterest::kPions: + case ParticleOfInterest::kKaons: + case ParticleOfInterest::kProtons: + for (const auto& trk : tracks) { + + if (!passedSingleTrackSelection(trk)) { + continue; } - if (deltaRue1 < rJet || deltaRue2 < rJet) { - registryData.fill(HIST("OmegaPos_in_ue"), multiplicity, casc.pt(), casc.mOmega()); + + const double deltaEtaJet = trk.eta() - selectedJet[i].Eta(); + const double deltaPhiJet = getDeltaPhi(trk.phi(), selectedJet[i].Phi()); + const double deltaRjet = std::sqrt(deltaEtaJet * deltaEtaJet + deltaPhiJet * deltaPhiJet); + const double deltaEtaUe1 = trk.eta() - ue1[i].Eta(); + const double deltaPhiUe1 = getDeltaPhi(trk.phi(), ue1[i].Phi()); + const double deltaRue1 = std::sqrt(deltaEtaUe1 * deltaEtaUe1 + deltaPhiUe1 * deltaPhiUe1); + const double deltaEtaUe2 = trk.eta() - ue2[i].Eta(); + const double deltaPhiUe2 = getDeltaPhi(trk.phi(), ue2[i].Phi()); + const double deltaRue2 = std::sqrt(deltaEtaUe2 * deltaEtaUe2 + deltaPhiUe2 * deltaPhiUe2); + + float nsigmaTPC = 0.f; + float nsigmaTOF = 0.f; + switch (particleOfInterest) { + case ParticleOfInterest::kPions: + nsigmaTPC = trk.tpcNSigmaPi(); + nsigmaTOF = trk.tofNSigmaPi(); + break; + case ParticleOfInterest::kKaons: + nsigmaTPC = trk.tpcNSigmaKa(); + nsigmaTOF = trk.tofNSigmaKa(); + break; + case ParticleOfInterest::kProtons: + nsigmaTPC = trk.tpcNSigmaPr(); + nsigmaTOF = trk.tofNSigmaPr(); + break; } - } - // Omega- - if (passedOmegaSelection(casc, pos, neg, bach, collision) && bach.sign() < 0) { + if (deltaRjet < rJet) { - registryData.fill(HIST("OmegaNeg_in_jet"), multiplicity, casc.pt(), casc.mOmega()); + registryData.fill(HIST("ll_in_jet"), multiplicity, trk.pt() * trk.sign(), nsigmaTPC, nsigmaTOF, trk.dcaXY()); } if (deltaRue1 < rJet || deltaRue2 < rJet) { - registryData.fill(HIST("OmegaNeg_in_ue"), multiplicity, casc.pt(), casc.mOmega()); + registryData.fill(HIST("ll_in_ue"), multiplicity, trk.pt() * trk.sign(), nsigmaTPC, nsigmaTOF, trk.dcaXY()); } } - } + break; } } } @@ -1108,6 +1195,16 @@ struct StrangenessInJets { case kOmegaPlusBar: registryMC.fill(HIST("OmegaPos_generated_jet"), genMultiplicity, hadron.Pt()); break; + case kPiPlus: + case kKPlus: + case ParticleOfInterest::kProtons: + registryMC.fill(HIST("ll_generated_in_jet"), genMultiplicity, hadron.Pt()); + break; + case kPiMinus: + case kKMinus: + case kProtonBar: + registryMC.fill(HIST("ll_generated_in_jet"), genMultiplicity, hadron.Pt() * -1.f); + break; default: break; } @@ -1137,6 +1234,15 @@ struct StrangenessInJets { case kOmegaPlusBar: registryMC.fill(HIST("OmegaPos_generated_ue"), genMultiplicity, hadron.Pt()); break; + case kPiPlus: + case kKPlus: + case ParticleOfInterest::kProtons: + registryMC.fill(HIST("ll_generated_in_ue"), genMultiplicity, hadron.Pt()); + break; + case kPiMinus: + case kKMinus: + case kProtonBar: + registryMC.fill(HIST("ll_generated_in_ue"), genMultiplicity, hadron.Pt() * -1.f); default: break; } @@ -1239,7 +1345,7 @@ struct StrangenessInJets { for (int i = 0; i < static_cast(selectedJet.size()); i++) { // V0 particles - if (particleOfInterest == Option::kV0Particles) { + if (particleOfInterest == ParticleOfInterest::kV0Particles) { for (const auto& v0 : v0sPerColl) { const auto& pos = v0.posTrack_as(); const auto& neg = v0.negTrack_as(); @@ -1338,7 +1444,7 @@ struct StrangenessInJets { } // Cascades - if (particleOfInterest == Option::kCascades) { + if (particleOfInterest == ParticleOfInterest::kCascades) { for (const auto& casc : cascPerColl) { auto bach = casc.bachelor_as(); auto pos = casc.posTrack_as(); From ea5681192d5d73cdf45cf152b1f415fa4a7d9078 Mon Sep 17 00:00:00 2001 From: abmodak <67369858+abmodak@users.noreply.github.com> Date: Sat, 20 Sep 2025 18:52:00 +0200 Subject: [PATCH 472/986] [PWGCF] Fix variable initialization (#13057) Co-authored-by: ALICE Action Bot --- .../TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx index 6d6b811b66b..0d93030b56c 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx @@ -88,9 +88,9 @@ enum KindOfCorrType { kFT0AFT0C }; -static constexpr std::string_view kCorrType[] = {"Ft0aGlobal/", "Ft0cGlobal/", "MftGlobal/", "Ft0aMft/", "Ft0aFt0c"}; +static constexpr std::string_view kCorrType[] = {"Ft0aGlobal/", "Ft0cGlobal/", "MftGlobal/", "Ft0aMft/", "Ft0aFt0c/"}; static constexpr std::string_view kEvntType[] = {"SE/", "ME/"}; - +auto static constexpr kMinFt0cCell = 96; AxisSpec axisEvent{10, 0.5, 9.5, "#Event", "EventAxis"}; struct LongrangeCorrelation { @@ -274,6 +274,8 @@ struct LongrangeCorrelation { auto x = chPos.X() + (*offsetFT0)[i].getX(); auto y = chPos.Y() + (*offsetFT0)[i].getY(); auto z = chPos.Z() + (*offsetFT0)[i].getZ(); + if (chno >= kMinFt0cCell) + z = -z; auto r = std::sqrt(x * x + y * y); auto theta = std::atan2(r, z); return -std::log(std::tan(0.5 * theta)); From 15ad32c442dda3131a955a107f13ac5956960473 Mon Sep 17 00:00:00 2001 From: hfribert Date: Sat, 20 Sep 2025 20:58:21 +0200 Subject: [PATCH 473/986] [PWGCF] add Sigma particles to femto framework (#13050) Co-authored-by: Henrik Fribert --- PWGCF/Femto/Core/dataTypes.h | 4 + PWGCF/Femto/Core/kinkBuilder.h | 421 ++++++++++++++++++++ PWGCF/Femto/Core/kinkHistManager.h | 289 ++++++++++++++ PWGCF/Femto/Core/modes.h | 13 +- PWGCF/Femto/Core/partitions.h | 12 + PWGCF/Femto/Core/trackHistManager.h | 8 + PWGCF/Femto/DataModel/FemtoTables.h | 51 +++ PWGCF/Femto/TableProducer/femtoProducer.cxx | 75 +++- PWGCF/Femto/Tasks/CMakeLists.txt | 5 + PWGCF/Femto/Tasks/femtoKinkQa.cxx | 120 ++++++ 10 files changed, 990 insertions(+), 8 deletions(-) create mode 100644 PWGCF/Femto/Core/kinkBuilder.h create mode 100644 PWGCF/Femto/Core/kinkHistManager.h create mode 100644 PWGCF/Femto/Tasks/femtoKinkQa.cxx diff --git a/PWGCF/Femto/Core/dataTypes.h b/PWGCF/Femto/Core/dataTypes.h index 2fa1273dbcc..f8e349a77d3 100644 --- a/PWGCF/Femto/Core/dataTypes.h +++ b/PWGCF/Femto/Core/dataTypes.h @@ -35,6 +35,10 @@ using TrackType = uint16_t; using V0MaskType = uint16_t; using V0Type = uint8_t; +// datatypes for kinks +using KinkMaskType = uint32_t; +using KinkType = uint8_t; + // datatypes for two track resonances using TwoTrackResonanceMaskType = uint32_t; // two track resonance types diff --git a/PWGCF/Femto/Core/kinkBuilder.h b/PWGCF/Femto/Core/kinkBuilder.h new file mode 100644 index 00000000000..33a843dee0a --- /dev/null +++ b/PWGCF/Femto/Core/kinkBuilder.h @@ -0,0 +1,421 @@ +// Copyright 2019-2025 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 kinkBuilder.h +/// \brief kink builder +/// \author Anton Riedel, TU München, anton.riedel@cern.ch +/// \author Henrik Fribert, TU München, henrik.fribert@cern.ch + +#ifndef PWGCF_FEMTO_CORE_KINKBUILDER_H_ +#define PWGCF_FEMTO_CORE_KINKBUILDER_H_ + +#include "PWGCF/Femto/Core/baseSelection.h" +#include "PWGCF/Femto/Core/dataTypes.h" +#include "PWGCF/Femto/Core/femtoUtils.h" +#include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/selectionContainer.h" +#include "PWGCF/Femto/DataModel/FemtoTables.h" + +#include "Common/Core/RecoDecay.h" + +#include "CommonConstants/MathConstants.h" +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/AnalysisHelpers.h" +#include "Framework/Configurable.h" + +#include "fairlogger/Logger.h" + +#include +#include +#include +#include +#include +#include +#include + +namespace o2::analysis::femto +{ +namespace kinkbuilder +{ + +// filters applied in the producer task +struct ConfKinkFilters : o2::framework::ConfigurableGroup { + std::string prefix = std::string("KinkFilters"); + o2::framework::Configurable ptMin{"ptMin", 0.f, "Minimum pT"}; + o2::framework::Configurable ptMax{"ptMax", 99.f, "Maximum pT"}; + o2::framework::Configurable etaMin{"etaMin", -10.f, "Minimum eta"}; + o2::framework::Configurable etaMax{"etaMax", 10.f, "Maximum eta"}; + o2::framework::Configurable phiMin{"phiMin", 0.f, "Minimum phi"}; + o2::framework::Configurable phiMax{"phiMax", 1.f * o2::constants::math::TwoPI, "Maximum phi"}; + o2::framework::Configurable massMinSigma{"massMinSigma", 1.1f, "Minimum mass for Sigma hypothesis"}; + o2::framework::Configurable massMaxSigma{"massMaxSigma", 1.3f, "Maximum mass for Sigma hypothesis"}; +}; + +// selections bits for all kinks +#define KINK_DEFAULT_BITS \ + o2::framework::Configurable> kinkTopoDcaMax{"kinkTopoDcaMax", {2.0f}, "Maximum kink topological DCA"}; \ + o2::framework::Configurable> transRadMin{"transRadMin", {0.2f}, "Minimum transverse radius (cm)"}; \ + o2::framework::Configurable> transRadMax{"transRadMax", {100.f}, "Maximum transverse radius (cm)"}; \ + o2::framework::Configurable> dauAbsEtaMax{"dauAbsEtaMax", {0.8f}, "Maximum absolute pseudorapidity for daughter track"}; \ + o2::framework::Configurable> dauDcaPvMin{"dauDcaPvMin", {0.0f}, "Minimum DCA of daughter from primary vertex (cm)"}; \ + o2::framework::Configurable> mothDcaPvMax{"mothDcaPvMax", {1.0f}, "Maximum DCA of mother from primary vertex (cm)"}; \ + o2::framework::Configurable> alphaAPMax{"alphaAPMax", {0.0f}, "Maximum Alpha_AP for Sigma candidates"}; \ + o2::framework::Configurable> qtAPMin{"qtAPMin", {0.15f}, "Minimum qT_AP for Sigma candidates"}; \ + o2::framework::Configurable> qtAPMax{"qtAPMax", {0.2f}, "Maximum qT_AP for Sigma candidates"}; \ + o2::framework::Configurable> cosPointingAngleMin{"cosPointingAngleMin", {0.0f}, "Minimum cosine of pointing angle"}; + +// derived selection bits for sigma +struct ConfSigmaBits : o2::framework::ConfigurableGroup { + std::string prefix = std::string("SigmaBits"); + KINK_DEFAULT_BITS + o2::framework::Configurable> chaDauTpcPion{"chaDauTpcPion", {5.f}, "Maximum |nsigma_Pion| TPC for charged daughter tracks"}; +}; + +#undef KINK_DEFAULT_BITS + +// base selection for analysis task for kinks +#define KINK_DEFAULT_SELECTIONS(defaultMassMin, defaultMassMax, defaultPdgCode) \ + o2::framework::Configurable pdgCode{"pdgCode", defaultPdgCode, "Kink PDG code"}; \ + o2::framework::Configurable ptMin{"ptMin", 0.f, "Minimum pT"}; \ + o2::framework::Configurable ptMax{"ptMax", 999.f, "Maximum pT"}; \ + o2::framework::Configurable etaMin{"etaMin", -10.f, "Minimum eta"}; \ + o2::framework::Configurable etaMax{"etaMax", 10.f, "Maximum eta"}; \ + o2::framework::Configurable phiMin{"phiMin", 0.f, "Minimum phi"}; \ + o2::framework::Configurable phiMax{"phiMax", 1.f * o2::constants::math::TwoPI, "Maximum phi"}; \ + o2::framework::Configurable massMin{"massMin", defaultMassMin, "Minimum invariant mass for Sigma"}; \ + o2::framework::Configurable massMax{"massMax", defaultMassMax, "Maximum invariant mass for Sigma"}; \ + o2::framework::Configurable mask{"mask", 0, "Bitmask for kink selection"}; + +// base selection for analysis task for sigmas +template +struct ConfSigmaSelection : o2::framework::ConfigurableGroup { + std::string prefix = Prefix; + KINK_DEFAULT_SELECTIONS(1.1, 1.3, 3112) + o2::framework::Configurable sign{"sign", 1, "Sign of the Sigma mother track (e.g. -1 for Sigma- or +1 for AntiSigma-)"}; +}; + +#undef KINK_DEFAULT_SELECTIONS + +constexpr const char PrefixSigmaSelection1[] = "SigmaSelection1"; +using ConfSigmaSelection1 = ConfSigmaSelection; + +/// The different selections for kinks +enum KinkSeles { + kKinkTopoDcaMax, + kTransRadMin, + kTransRadMax, + + kDauAbsEtaMax, + kDauDcaPvMin, + kMothDcaPvMax, + + kChaDaughTpcPion, + + kAlphaAPMax, + kQtAPMin, + kQtAPMax, + kCosPointingAngleMin, + + kKinkSelsMax +}; + +const char kinkSelsName[] = "Kink selection object"; +const std::unordered_map kinkSelsToStrings = { + {kKinkTopoDcaMax, "kinkTopoDcaMax"}, + {kTransRadMin, "transRadMin"}, + {kTransRadMax, "transRadMax"}, + {kDauAbsEtaMax, "dauAbsEtaMax"}, + {kDauDcaPvMin, "dauDcaPvMin"}, + {kMothDcaPvMax, "mothDcaPvMax"}, + {kChaDaughTpcPion, "chaDauTpcPion"}, + {kAlphaAPMax, "alphaAPMax"}, + {kQtAPMin, "qtAPMin"}, + {kQtAPMax, "qtAPMax"}, + {kCosPointingAngleMin, "cosPointingAngleMin"}}; + +/// \class KinkCuts +/// \brief Cut class to contain and execute all cuts applied to kinks +template +class KinkSelection : public BaseSelection +{ + public: + KinkSelection() {} + virtual ~KinkSelection() = default; + + template + void configure(T1& config, T2& filter) + { + mPtMin = filter.ptMin.value; + mPtMax = filter.ptMax.value; + mEtaMin = filter.etaMin.value; + mEtaMax = filter.etaMax.value; + mPhiMin = filter.phiMin.value; + mPhiMax = filter.phiMax.value; + + if constexpr (modes::isEqual(kinkType, modes::Kink::kSigma)) { + mMassSigmaLowerLimit = filter.massMinSigma.value; + mMassSigmaUpperLimit = filter.massMaxSigma.value; + // Only add PID selection if we need it - will be checked at runtime + this->addSelection(config.chaDauTpcPion.value, kChaDaughTpcPion, limits::kAbsUpperLimit, true, true); + } + + this->addSelection(config.kinkTopoDcaMax.value, kKinkTopoDcaMax, limits::kUpperLimit, true, true); + this->addSelection(config.transRadMin.value, kTransRadMin, limits::kLowerLimit, true, true); + this->addSelection(config.transRadMax.value, kTransRadMax, limits::kUpperLimit, true, true); + this->addSelection(config.dauAbsEtaMax.value, kDauAbsEtaMax, limits::kAbsUpperLimit, true, true); + this->addSelection(config.dauDcaPvMin.value, kDauDcaPvMin, limits::kLowerLimit, true, true); + this->addSelection(config.mothDcaPvMax.value, kMothDcaPvMax, limits::kUpperLimit, true, true); + this->addSelection(config.alphaAPMax.value, kAlphaAPMax, limits::kUpperLimit, true, true); + this->addSelection(config.qtAPMin.value, kQtAPMin, limits::kLowerLimit, true, true); + this->addSelection(config.qtAPMax.value, kQtAPMax, limits::kUpperLimit, true, true); + this->addSelection(config.cosPointingAngleMin.value, kCosPointingAngleMin, limits::kLowerLimit, true, true); + }; + + template + void applySelections(T1 const& kinkCand, T2 const& /*tracks*/) + { + this->reset(); + // kink selections + std::array momMother = {kinkCand.pxMoth(), kinkCand.pyMoth(), kinkCand.pzMoth()}; + std::array momDaughter = {kinkCand.pxDaug(), kinkCand.pyDaug(), kinkCand.pzDaug()}; + + // Alpha_AP + std::array momMissing = {momMother[0] - momDaughter[0], momMother[1] - momDaughter[1], momMother[2] - momDaughter[2]}; + float lQlP = std::inner_product(momMother.begin(), momMother.end(), momDaughter.begin(), 0.f); + float lQlN = std::inner_product(momMother.begin(), momMother.end(), momMissing.begin(), 0.f); + float alphaAP = (lQlP + lQlN != 0.f) ? (lQlP - lQlN) / (lQlP + lQlN) : 0.f; + this->evaluateObservable(kAlphaAPMax, alphaAP); + + // qT_AP + float dp = lQlP; + float p2V0 = std::inner_product(momMother.begin(), momMother.end(), momMother.begin(), 0.f); + float p2A = std::inner_product(momDaughter.begin(), momDaughter.end(), momDaughter.begin(), 0.f); + float qtAP = std::sqrt(std::max(0.f, p2A - dp * dp / p2V0)); + this->evaluateObservable(kQtAPMin, qtAP); + this->evaluateObservable(kQtAPMax, qtAP); + + std::array vMother = {kinkCand.xDecVtx(), kinkCand.yDecVtx(), kinkCand.zDecVtx()}; + float pMother = std::sqrt(std::inner_product(momMother.begin(), momMother.end(), momMother.begin(), 0.f)); + float vMotherNorm = std::sqrt(std::inner_product(vMother.begin(), vMother.end(), vMother.begin(), 0.f)); + float cosPointingAngle = (vMotherNorm > 0.f && pMother > 0.f) ? (std::inner_product(momMother.begin(), momMother.end(), vMother.begin(), 0.f)) / (pMother * vMotherNorm) : 0.f; + this->evaluateObservable(kCosPointingAngleMin, cosPointingAngle); + + this->evaluateObservable(kKinkTopoDcaMax, kinkCand.dcaKinkTopo()); + + // Compute transRadius + float transRadius = std::hypot(kinkCand.xDecVtx(), kinkCand.yDecVtx()); + this->evaluateObservable(kTransRadMin, transRadius); + this->evaluateObservable(kTransRadMax, transRadius); + + // Compute daughter eta + float pxDaug = kinkCand.pxDaug(); + float pyDaug = kinkCand.pyDaug(); + float pzDaug = kinkCand.pzDaug(); + float pDaug = std::sqrt(pxDaug * pxDaug + pyDaug * pyDaug + pzDaug * pzDaug); + float etaDaug = (pDaug > 0.f) ? 0.5f * std::log((pDaug + pzDaug) / (pDaug - pzDaug)) : 0.f; + this->evaluateObservable(kDauAbsEtaMax, std::fabs(etaDaug)); + + this->evaluateObservable(kDauDcaPvMin, std::abs(kinkCand.dcaDaugPv())); + this->evaluateObservable(kMothDcaPvMax, std::abs(kinkCand.dcaMothPv())); + + auto chaDaughter = kinkCand.template trackDaug_as(); + this->evaluateObservable(kChaDaughTpcPion, chaDaughter.tpcNSigmaPi()); + + this->assembleBitmask(); + }; + + template + bool checkFilters(const T& kink) const + { + // Compute mother eta and phi + float px = kink.pxMoth(); + float py = kink.pyMoth(); + float pz = kink.pzMoth(); + float pt = std::hypot(px, py); + float p = std::sqrt(px * px + py * py + pz * pz); + float eta = (p > 0.f) ? 0.5f * std::log((p + pz) / (p - pz)) : 0.f; + float phi = std::atan2(py, px); + + return ((pt > mPtMin && pt < mPtMax) && + (eta > mEtaMin && eta < mEtaMax) && + (phi > mPhiMin && phi < mPhiMax)); + } + + template + bool checkHypothesis(T const& kinkCand) const + { + if constexpr (modes::isEqual(kinkType, modes::Kink::kSigma)) { + // Compute mass + float pxmoth = kinkCand.pxMoth(); + float pymoth = kinkCand.pyMoth(); + float pzmoth = kinkCand.pzMoth(); + float pxch = kinkCand.pxDaug(); + float pych = kinkCand.pyDaug(); + float pzch = kinkCand.pzDaug(); + float pxneut = pxmoth - pxch; + float pyneut = pymoth - pych; + float pzneut = pzmoth - pzch; + + float sigmaMass = RecoDecay::m( + std::array{std::array{pxch, pych, pzch}, std::array{pxneut, pyneut, pzneut}}, + std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassNeutron}); + + return (sigmaMass > mMassSigmaLowerLimit && sigmaMass < mMassSigmaUpperLimit); + } + return false; + } + + protected: + float mMassSigmaLowerLimit = 1.15f; + float mMassSigmaUpperLimit = 1.25f; + + // kinematic filters + float mPtMin = 0.f; + float mPtMax = 6.f; + float mEtaMin = -1.f; + float mEtaMax = 1.f; + float mPhiMin = 0.f; + float mPhiMax = o2::constants::math::TwoPI; +}; + +struct KinkBuilderProducts : o2::framework::ProducesGroup { + o2::framework::Produces producedSigmas; + o2::framework::Produces producedSigmaMasks; + o2::framework::Produces producedSigmaExtras; +}; + +struct ConfKinkTables : o2::framework::ConfigurableGroup { + std::string prefix = std::string("KinkTables"); + o2::framework::Configurable produceSigmas{"produceSigmas", -1, "Produce Sigmas (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceSigmaMasks{"produceSigmaMasks", -1, "Produce SigmaMasks (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceSigmaExtras{"produceSigmaExtras", -1, "Produce SigmaExtras (-1: auto; 0 off; 1 on)"}; +}; + +template +class KinkBuilder +{ + public: + KinkBuilder() {} + virtual ~KinkBuilder() = default; + + template + void init(T1& config, T2& filter, T3& table, T4& initContext) + { + mKinkSelection.configure(config, filter); + if constexpr (modes::isEqual(kinkType, modes::Kink::kSigma)) { + LOG(info) << "Initialize femto Sigma builder..."; + mProduceSigmas = utils::enableTable("FSigmas_001", table.produceSigmas.value, initContext); + mProduceSigmaMasks = utils::enableTable("FSigmaMasks_001", table.produceSigmaMasks.value, initContext); + mProduceSigmaExtras = utils::enableTable("FSigmaExtras_001", table.produceSigmaExtras.value, initContext); + } + + if (mProduceSigmas || mProduceSigmaMasks || mProduceSigmaExtras) { + mFillAnyTable = true; + mKinkSelection.printSelections(kinkSelsName, kinkSelsToStrings); + } + } + + template + void fillKinks(T1& collisionProducts, T2& trackProducts, T3& kinkProducts, T4 const& kinks, T5 const& tracks, T6& trackBuilder, T7& indexMap) + { + if (!mFillAnyTable) { + return; + } + int64_t daughterIndex = 0; + for (const auto& kink : kinks) { + if (!mKinkSelection.checkFilters(kink)) { + continue; + } + mKinkSelection.applySelections(kink, tracks); + if (mKinkSelection.passesAllRequiredSelections() && mKinkSelection.checkHypothesis(kink)) { + auto daughter = kink.template trackDaug_as(); + daughterIndex = trackBuilder.template getDaughterIndex(daughter, trackProducts, collisionProducts, indexMap); + if constexpr (modes::isEqual(kinkType, modes::Kink::kSigma)) { + fillSigma(collisionProducts, kinkProducts, kink, daughterIndex); + } + } + } + } + + template + void fillSigma(T1& collisionProducts, T2& kinkProducts, T3 const& kink, int daughterIndex) + { + // Compute mass + float pxmoth = kink.pxMoth(); + float pymoth = kink.pyMoth(); + float pzmoth = kink.pzMoth(); + float pxch = kink.pxDaug(); + float pych = kink.pyDaug(); + float pzch = kink.pzDaug(); + float pxneut = pxmoth - pxch; + float pyneut = pymoth - pych; + float pzneut = pzmoth - pzch; + + float mass = RecoDecay::m( + std::array{std::array{pxch, pych, pzch}, std::array{pxneut, pyneut, pzneut}}, + std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassNeutron}); + + if (mProduceSigmas) { + // Compute mother eta and phi + float px = kink.pxMoth(); + float py = kink.pyMoth(); + float pz = kink.pzMoth(); + float pt = std::hypot(px, py); + float p = std::sqrt(px * px + py * py + pz * pz); + float eta = (p > 0.f) ? 0.5f * std::log((p + pz) / (p - pz)) : 0.f; + float phi = std::atan2(py, px); + + kinkProducts.producedSigmas(collisionProducts.producedCollision.lastIndex(), + kink.mothSign() * pt, + eta, + phi, + mass, + daughterIndex); + } + if (mProduceSigmaMasks) { + kinkProducts.producedSigmaMasks(mKinkSelection.getBitmask()); + } + if (mProduceSigmaExtras) { + // Compute kink angle and transRadius + float pMoth = std::sqrt(pxmoth * pxmoth + pymoth * pymoth + pzmoth * pzmoth); + float pDaug = std::sqrt(pxch * pxch + pych * pych + pzch * pzch); + float kinkAngle = 0.f; + if (pMoth > 0.f && pDaug > 0.f) { + float dotProduct = pxmoth * pxch + pymoth * pych + pzmoth * pzch; + float cosAngle = dotProduct / (pMoth * pDaug); + cosAngle = std::max(-1.0f, std::min(1.0f, cosAngle)); // Clamp + kinkAngle = std::acos(cosAngle); + } + + float transRadius = std::hypot(kink.xDecVtx(), kink.yDecVtx()); + + kinkProducts.producedSigmaExtras( + kinkAngle, + kink.dcaDaugPv(), + kink.dcaMothPv(), + kink.xDecVtx(), + kink.yDecVtx(), + kink.zDecVtx(), + transRadius); + } + } + bool fillAnyTable() { return mFillAnyTable; } + + private: + KinkSelection mKinkSelection; + bool mFillAnyTable = false; + bool mProduceSigmas = false; + bool mProduceSigmaMasks = false; + bool mProduceSigmaExtras = false; +}; +} // namespace kinkbuilder +} // namespace o2::analysis::femto +#endif // PWGCF_FEMTO_CORE_KINKBUILDER_H_ diff --git a/PWGCF/Femto/Core/kinkHistManager.h b/PWGCF/Femto/Core/kinkHistManager.h new file mode 100644 index 00000000000..8371a78d5e3 --- /dev/null +++ b/PWGCF/Femto/Core/kinkHistManager.h @@ -0,0 +1,289 @@ +// Copyright 2019-2025 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 kinkHistManager.h +/// \brief histogram manager for kink histograms +/// \author Anton Riedel, TU München, anton.riedel@cern.ch +/// \author Henrik Fribert, TU München, henrik.fribert@cern.ch + +#ifndef PWGCF_FEMTO_CORE_KINKHISTMANAGER_H_ +#define PWGCF_FEMTO_CORE_KINKHISTMANAGER_H_ + +#include "PWGCF/Femto/Core/histManager.h" +#include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/trackHistManager.h" + +#include "CommonConstants/MathConstants.h" +#include "Framework/Configurable.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/HistogramSpec.h" + +#include +#include +#include +#include +#include + +namespace o2::analysis::femto +{ +namespace kinkhistmanager +{ +// enum for kink histograms +enum KinkHist { + // analysis + kPt, + kEta, + kPhi, + kMass, + kSign, + // qa variables + kKinkAngle, + kDcaMothToPV, + kDcaDaugToPV, + kDecayVtxX, + kDecayVtxY, + kDecayVtxZ, + kDecayVtx, + kTransRadius, + // 2d qa + kPtVsEta, + kPtVsPhi, + kPhiVsEta, + kPtVsKinkAngle, + kPtVsDecayRadius, + kKinkHistLast +}; + +#define KINK_DEFAULT_BINNING(defaultMassMin, defaultMassMax) \ + o2::framework::ConfigurableAxis pt{"pt", {{600, 0, 6}}, "Pt"}; \ + o2::framework::ConfigurableAxis eta{"eta", {{300, -1.5, 1.5}}, "Eta"}; \ + o2::framework::ConfigurableAxis phi{"phi", {{720, 0, 1.f * o2::constants::math::TwoPI}}, "Phi"}; \ + o2::framework::ConfigurableAxis mass{"mass", {{200, defaultMassMin, defaultMassMax}}, "Mass"}; \ + o2::framework::ConfigurableAxis sign{"sign", {{3, -1.5, 1.5}}, "Sign"}; + +template +struct ConfSigmaBinning : o2::framework::ConfigurableGroup { + std::string prefix = Prefix; + KINK_DEFAULT_BINNING(1.1, 1.3) +}; +#undef KINK_DEFAULT_BINNING + +constexpr const char PrefixSigmaBinning1[] = "SigmaBinning1"; +using ConfSigmaBinning1 = ConfSigmaBinning; + +template +struct ConfKinkQaBinning : o2::framework::ConfigurableGroup { + std::string prefix = Prefix; + o2::framework::ConfigurableAxis kinkAngle{"kinkAngle", {{100, 0, 3.15}}, "Kink Angle (rad)"}; + o2::framework::ConfigurableAxis dcaMothToPV{"dcaMothToPV", {{150, 0, 1.5}}, "Mother DCA to PV (cm)"}; + o2::framework::ConfigurableAxis dcaDaugToPV{"dcaDaugToPV", {{1000, 0, 100}}, "Daughter DCA to PV (cm)"}; + o2::framework::ConfigurableAxis decayVertex{"decayVertex", {{100, 0, 100}}, "Decay vertex position (cm)"}; + o2::framework::ConfigurableAxis transRadius{"transRadius", {{100, 0, 100}}, "Transverse radius (cm)"}; +}; + +constexpr const char PrefixSigmaQaBinning1[] = "SigmaQaBinning1"; +using ConfSigmaQaBinning1 = ConfKinkQaBinning; + +// must be in sync with enum KinkHist +// the enum gives the correct index in the array +constexpr std::array, kKinkHistLast> HistTable = { + {{kPt, o2::framework::kTH1F, "hPt", "Transverse Momentum; p_{T} (GeV/#it{c}); Entries"}, + {kEta, o2::framework::kTH1F, "hEta", "Pseudorapidity; #eta; Entries"}, + {kPhi, o2::framework::kTH1F, "hPhi", "Azimuthal angle; #varphi; Entries"}, + {kMass, o2::framework::kTH1F, "hMass", "Invariant Mass; m_{Inv} (GeV/#it{c}^{2}); Entries"}, + {kSign, o2::framework::kTH1F, "hSign", "Sign; sign; Entries"}, + {kKinkAngle, o2::framework::kTH1F, "hKinkAngle", "Kink Angle; Angle (rad); Entries"}, + {kDcaMothToPV, o2::framework::kTH1F, "hDcaMothToPV", "Mother DCA to PV; DCA (cm); Entries"}, + {kDcaDaugToPV, o2::framework::kTH1F, "hDcaDaugToPV", "Daughter DCA to PV; DCA (cm); Entries"}, + {kDecayVtxX, o2::framework::kTH1F, "hDecayVtxX", "Decay Vertex X; x (cm); Entries"}, + {kDecayVtxY, o2::framework::kTH1F, "hDecayVtxY", "Decay Vertex Y; y (cm); Entries"}, + {kDecayVtxZ, o2::framework::kTH1F, "hDecayVtxZ", "Decay Vertex Z; z (cm); Entries"}, + {kDecayVtx, o2::framework::kTH1F, "hDecayVtx", "Decay Distance from PV; r (cm); Entries"}, + {kTransRadius, o2::framework::kTH1F, "hTransRadius", "Transverse Decay Radius; r_{xy} (cm); Entries"}, + {kPtVsEta, o2::framework::kTH2F, "hPtVsEta", "p_{T} vs #eta; p_{T} (GeV/#it{c}); #eta"}, + {kPtVsPhi, o2::framework::kTH2F, "hPtVsPhi", "p_{T} vs #varphi; p_{T} (GeV/#it{c}); #varphi"}, + {kPhiVsEta, o2::framework::kTH2F, "hPhiVsEta", "#varphi vs #eta; #varphi; #eta"}, + {kPtVsKinkAngle, o2::framework::kTH2F, "hPtVsKinkAngle", "p_{T} vs kink angle; p_{T} (GeV/#it{c}); kink angle (rad)"}, + {kPtVsDecayRadius, o2::framework::kTH2F, "hPtVsDecayRadius", "p_{T} vs transverse decay radius; p_{T} (GeV/#it{c}); r_{xy} (cm)"}}}; + +template +auto makeKinkHistSpecMap(const T& confBinningAnalysis) +{ + return std::map>{ + {kPt, {confBinningAnalysis.pt}}, + {kEta, {confBinningAnalysis.eta}}, + {kPhi, {confBinningAnalysis.phi}}, + {kMass, {confBinningAnalysis.mass}}, + {kSign, {confBinningAnalysis.sign}}}; +} + +template +std::map> makeKinkQaHistSpecMap(T1 const& confBinningAnalysis, T2 const& confBinningQa) +{ + return std::map>{ + {kPt, {confBinningAnalysis.pt}}, + {kEta, {confBinningAnalysis.eta}}, + {kPhi, {confBinningAnalysis.phi}}, + {kMass, {confBinningAnalysis.mass}}, + {kSign, {confBinningAnalysis.sign}}, + {kKinkAngle, {confBinningQa.kinkAngle}}, + {kDcaMothToPV, {confBinningQa.dcaMothToPV}}, + {kDcaDaugToPV, {confBinningQa.dcaDaugToPV}}, + {kDecayVtxX, {confBinningQa.decayVertex}}, + {kDecayVtxY, {confBinningQa.decayVertex}}, + {kDecayVtxZ, {confBinningQa.decayVertex}}, + {kDecayVtx, {confBinningQa.decayVertex}}, + {kTransRadius, {confBinningQa.transRadius}}, + {kPtVsEta, {confBinningAnalysis.pt, confBinningAnalysis.eta}}, + {kPtVsPhi, {confBinningAnalysis.pt, confBinningAnalysis.phi}}, + {kPhiVsEta, {confBinningAnalysis.phi, confBinningAnalysis.eta}}, + {kPtVsKinkAngle, {confBinningAnalysis.pt, confBinningQa.kinkAngle}}, + {kPtVsDecayRadius, {confBinningAnalysis.pt, confBinningQa.transRadius}}}; +} + +constexpr char PrefixSigmaQa[] = "SigmaQA/"; +constexpr char PrefixSigma[] = "Sigma/"; +constexpr char PrefixKinkChaDaughter[] = "KinkChaDau/"; +constexpr char PrefixKinkChaDaughterQa[] = "KinkChaDauQa/"; + +constexpr std::string_view AnalysisDir = "Kinematics/"; +constexpr std::string_view QaDir = "QA/"; + +/// \class KinkHistManager +/// \brief Class for histogramming event properties +// template +template +class KinkHistManager +{ + public: + /// Destructor + virtual ~KinkHistManager() = default; + + /// Initializes histograms for the task + /// \param registry Histogram registry to be passed + /// + void init(o2::framework::HistogramRegistry* registry, + std::map> KinkSpecs, + std::map> ChaDauSpecs) + { + mHistogramRegistry = registry; + mChaDauManager.init(registry, ChaDauSpecs); + + if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { + std::string analysisDir = std::string(kinkPrefix) + std::string(AnalysisDir); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kPt, HistTable), GetHistDesc(kPt, HistTable), GetHistType(kPt, HistTable), {KinkSpecs[kPt]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kEta, HistTable), GetHistDesc(kEta, HistTable), GetHistType(kEta, HistTable), {KinkSpecs[kEta]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kPhi, HistTable), GetHistDesc(kPhi, HistTable), GetHistType(kPhi, HistTable), {KinkSpecs[kPhi]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kMass, HistTable), GetHistDesc(kMass, HistTable), GetHistType(kMass, HistTable), {KinkSpecs[kMass]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kSign, HistTable), GetHistDesc(kSign, HistTable), GetHistType(kSign, HistTable), {KinkSpecs[kSign]}); + } + + if constexpr (isFlagSet(mode, modes::Mode::kQa)) { + std::string qaDir = std::string(kinkPrefix) + std::string(QaDir); + + // Basic kinematic histograms + mHistogramRegistry->add(qaDir + GetHistNamev2(kPt, HistTable), GetHistDesc(kPt, HistTable), GetHistType(kPt, HistTable), {KinkSpecs[kPt]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kEta, HistTable), GetHistDesc(kEta, HistTable), GetHistType(kEta, HistTable), {KinkSpecs[kEta]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPhi, HistTable), GetHistDesc(kPhi, HistTable), GetHistType(kPhi, HistTable), {KinkSpecs[kPhi]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kMass, HistTable), GetHistDesc(kMass, HistTable), GetHistType(kMass, HistTable), {KinkSpecs[kMass]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kSign, HistTable), GetHistDesc(kSign, HistTable), GetHistType(kSign, HistTable), {KinkSpecs[kSign]}); + + // Kink-specific QA histograms + mHistogramRegistry->add(qaDir + GetHistNamev2(kKinkAngle, HistTable), GetHistDesc(kKinkAngle, HistTable), GetHistType(kKinkAngle, HistTable), {KinkSpecs[kKinkAngle]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kDcaMothToPV, HistTable), GetHistDesc(kDcaMothToPV, HistTable), GetHistType(kDcaMothToPV, HistTable), {KinkSpecs[kDcaMothToPV]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kDcaDaugToPV, HistTable), GetHistDesc(kDcaDaugToPV, HistTable), GetHistType(kDcaDaugToPV, HistTable), {KinkSpecs[kDcaDaugToPV]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kDecayVtxX, HistTable), GetHistDesc(kDecayVtxX, HistTable), GetHistType(kDecayVtxX, HistTable), {KinkSpecs[kDecayVtxX]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kDecayVtxY, HistTable), GetHistDesc(kDecayVtxY, HistTable), GetHistType(kDecayVtxY, HistTable), {KinkSpecs[kDecayVtxY]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kDecayVtxZ, HistTable), GetHistDesc(kDecayVtxZ, HistTable), GetHistType(kDecayVtxZ, HistTable), {KinkSpecs[kDecayVtxZ]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kDecayVtx, HistTable), GetHistDesc(kDecayVtx, HistTable), GetHistType(kDecayVtx, HistTable), {KinkSpecs[kDecayVtx]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kTransRadius, HistTable), GetHistDesc(kTransRadius, HistTable), GetHistType(kTransRadius, HistTable), {KinkSpecs[kTransRadius]}); + + // 2D QA histograms + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsEta, HistTable), GetHistDesc(kPtVsEta, HistTable), GetHistType(kPtVsEta, HistTable), {KinkSpecs[kPtVsEta]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsPhi, HistTable), GetHistDesc(kPtVsPhi, HistTable), GetHistType(kPtVsPhi, HistTable), {KinkSpecs[kPtVsPhi]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPhiVsEta, HistTable), GetHistDesc(kPhiVsEta, HistTable), GetHistType(kPhiVsEta, HistTable), {KinkSpecs[kPhiVsEta]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsKinkAngle, HistTable), GetHistDesc(kPtVsKinkAngle, HistTable), GetHistType(kPtVsKinkAngle, HistTable), {KinkSpecs[kPtVsKinkAngle]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsDecayRadius, HistTable), GetHistDesc(kPtVsDecayRadius, HistTable), GetHistType(kPtVsDecayRadius, HistTable), {KinkSpecs[kPtVsDecayRadius]}); + } + } + + /// Fill histograms for kink candidates + /// \param kinkcandidate Kink candidate to fill histograms for + template + void fill(T const& kinkcandidate) + { + if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(GetHistName(kPt, HistTable)), kinkcandidate.pt()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(GetHistName(kEta, HistTable)), kinkcandidate.eta()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(GetHistName(kPhi, HistTable)), kinkcandidate.phi()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(GetHistName(kMass, HistTable)), kinkcandidate.mass()); + + if constexpr (isEqual(kink, modes::Kink::kSigma)) { + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(GetHistName(kSign, HistTable)), kinkcandidate.sign()); + } + } + + if constexpr (isFlagSet(mode, modes::Mode::kQa)) { + // Basic kinematic histograms + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kPt, HistTable)), kinkcandidate.pt()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kEta, HistTable)), kinkcandidate.eta()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kPhi, HistTable)), kinkcandidate.phi()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kMass, HistTable)), kinkcandidate.mass()); + + if constexpr (isEqual(kink, modes::Kink::kSigma)) { + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kSign, HistTable)), kinkcandidate.sign()); + } + + // Kink-specific QA histograms + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kKinkAngle, HistTable)), kinkcandidate.kinkAngle()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kDcaMothToPV, HistTable)), kinkcandidate.dcaMothToPV()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kDcaDaugToPV, HistTable)), kinkcandidate.dcaDaugToPV()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kDecayVtxX, HistTable)), kinkcandidate.decayVtxX()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kDecayVtxY, HistTable)), kinkcandidate.decayVtxY()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kDecayVtxZ, HistTable)), kinkcandidate.decayVtxZ()); + + // Calculate decay distance from PV + float decayDistance = std::sqrt(kinkcandidate.decayVtxX() * kinkcandidate.decayVtxX() + + kinkcandidate.decayVtxY() * kinkcandidate.decayVtxY() + + kinkcandidate.decayVtxZ() * kinkcandidate.decayVtxZ()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kDecayVtx, HistTable)), decayDistance); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kTransRadius, HistTable)), kinkcandidate.transRadius()); + + // 2D QA histograms + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kPtVsEta, HistTable)), kinkcandidate.pt(), kinkcandidate.eta()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kPtVsPhi, HistTable)), kinkcandidate.pt(), kinkcandidate.phi()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kPhiVsEta, HistTable)), kinkcandidate.phi(), kinkcandidate.eta()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kPtVsKinkAngle, HistTable)), kinkcandidate.pt(), kinkcandidate.kinkAngle()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kPtVsDecayRadius, HistTable)), kinkcandidate.pt(), kinkcandidate.transRadius()); + } + } + + /// Fill histograms for kink candidates - overload with track table argument + /// \param kinkcandidate Kink candidate to fill histograms for + /// \param tracks Track table for daughter access + template + void fill(T1 const& kinkcandidate, T2 const& /*tracks*/) + { + auto chaDaughter = kinkcandidate.template chaDau_as(); + mChaDauManager.fill(chaDaughter); + fill(kinkcandidate); + } + + private: + o2::framework::HistogramRegistry* mHistogramRegistry; + trackhistmanager::TrackHistManager mChaDauManager; +}; +}; // namespace kinkhistmanager +}; // namespace o2::analysis::femto +#endif // PWGCF_FEMTO_CORE_KINKHISTMANAGER_H_ diff --git a/PWGCF/Femto/Core/modes.h b/PWGCF/Femto/Core/modes.h index dccd9ac8559..012442bb3f1 100644 --- a/PWGCF/Femto/Core/modes.h +++ b/PWGCF/Femto/Core/modes.h @@ -69,7 +69,8 @@ enum class Track : o2::aod::femtodatatypes::TrackType { kPrimaryTrack, kV0Daughter, kCascadeBachelor, - kResonanceDaughter + kResonanceDaughter, + kKinkDaughter }; enum class V0 : o2::aod::femtodatatypes::V0Type { @@ -78,6 +79,10 @@ enum class V0 : o2::aod::femtodatatypes::V0Type { kK0short }; +enum class Kink : o2::aod::femtodatatypes::KinkType { + kSigma +}; + enum class Cascade : o2::aod::femtodatatypes::CascadeType { kXi, kOmega @@ -95,14 +100,16 @@ enum class Pairs : o2::aod::femtodatatypes::PairType { kTrackTrack, kTrackV0, kTrackResonance, - kTrackCascade + kTrackCascade, + kTrackKink }; enum class TrackPairs : o2::aod::femtodatatypes::PairType { kTrackTrack, kTrackPosDaughter, kTrackNegDaughter, - kTrackBachelor + kTrackBachelor, + kTrackChaDaughter }; }; // namespace modes diff --git a/PWGCF/Femto/Core/partitions.h b/PWGCF/Femto/Core/partitions.h index adbac4d2213..ffbdf6fd214 100644 --- a/PWGCF/Femto/Core/partitions.h +++ b/PWGCF/Femto/Core/partitions.h @@ -110,4 +110,16 @@ (femtobase::stored::mass < selection.massMax) && \ ncheckbit(femtocascades::mask, selection.mask) +#define MAKE_SIGMA_PARTITION(selection) \ + ifnode(selection.sign.node() > 0, femtobase::stored::signedPt > 0.f, femtobase::stored::signedPt < 0.f) && \ + (nabs(femtobase::stored::signedPt) > selection.ptMin) && \ + (nabs(femtobase::stored::signedPt) < selection.ptMax) && \ + (femtobase::stored::eta > selection.etaMin) && \ + (femtobase::stored::eta < selection.etaMax) && \ + (femtobase::stored::phi > selection.phiMin) && \ + (femtobase::stored::phi < selection.phiMax) && \ + (femtobase::stored::mass > selection.massMin) && \ + (femtobase::stored::mass < selection.massMax) && \ + ncheckbit(femtokinks::mask, selection.mask) + #endif // PWGCF_FEMTO_CORE_PARTITIONS_H_ diff --git a/PWGCF/Femto/Core/trackHistManager.h b/PWGCF/Femto/Core/trackHistManager.h index 3f22459ac5b..677e88e5487 100644 --- a/PWGCF/Femto/Core/trackHistManager.h +++ b/PWGCF/Femto/Core/trackHistManager.h @@ -129,6 +129,7 @@ constexpr const char PrefixV0NegDauBinning[] = "V0NegDauBinning"; constexpr const char PrefixCascadePosDauBinning[] = "CascadePosDauBinning"; constexpr const char PrefixCascadeNegDauBinning[] = "CascadeNegDauBinning"; constexpr const char PrefixCascadeBachelorBinning[] = "CascadeBachelorBinning"; +constexpr const char PrefixKinkChaDauBinning[] = "KinkChaDauBinning"; using ConfTrackBinning1 = ConfTrackBinning; using ConfTrackBinning2 = ConfTrackBinning; @@ -136,9 +137,11 @@ using ConfResonancePosDauBinning = ConfTrackBinning; using ConfV0PosDauBinning = ConfTrackBinning; using ConfV0NegDauBinning = ConfTrackBinning; +using ConfKinkChaDauBinning = ConfTrackBinning; using ConfCascadePosDauBinning = ConfTrackBinning; using ConfCascadeNegDauBinning = ConfTrackBinning; using ConfCascadeBachelorBinning = ConfTrackBinning; +using ConfKinkChaDauBinning = ConfTrackBinning; template struct ConfTrackQaBinning : o2::framework::ConfigurableGroup { @@ -203,6 +206,7 @@ constexpr const char PrefixV0NegDauQaBinning[] = "V0NegDauQaBinning"; constexpr const char PrefixCascadePosDauQaBinning[] = "CascadePosDauQaBinning"; constexpr const char PrefixCascadeNegDauQaBinning[] = "CascadeNegDauQaBinning"; constexpr const char PrefixCascadeBachelorQaBinning[] = "CascadeBachelorQaBinning"; +constexpr const char PrefixKinkChaDauQaBinning[] = "KinkChaDauQaBinning"; using ConfTrackQaBinning1 = ConfTrackQaBinning; using ConfTrackQaBinning2 = ConfTrackQaBinning; @@ -213,6 +217,7 @@ using ConfV0NegDauQaBinning = ConfTrackQaBinning; using ConfCascadePosDauQaBinning = ConfTrackQaBinning; using ConfCascadeNegDauQaBinning = ConfTrackQaBinning; using ConfCascadeBachelorQaBinning = ConfTrackQaBinning; +using ConfKinkChaDauQaBinning = ConfTrackQaBinning; // must be in sync with enum TrackVariables // the enum gives the correct index in the array @@ -374,6 +379,9 @@ constexpr char PrefixCascadePosDaughterQa[] = "CascadePosDauQa/"; constexpr char PrefixCascadeNegDaughterQa[] = "CascadeNegDauQa/"; constexpr char PrefixCascadeBachelorQa[] = "CascadeBachelorQa/"; +constexpr char PrefixKinkChaDaughter[] = "KinkChaDau/"; +constexpr char PrefixKinkChaDaughterQa[] = "KinkChaDauQa/"; + constexpr std::string_view AnalysisDir = "Kinematics/"; constexpr std::string_view QaDir = "QA/"; constexpr std::string_view PidDir = "PID/"; diff --git a/PWGCF/Femto/DataModel/FemtoTables.h b/PWGCF/Femto/DataModel/FemtoTables.h index 1708ba66ba7..c7bc8334c52 100644 --- a/PWGCF/Femto/DataModel/FemtoTables.h +++ b/PWGCF/Femto/DataModel/FemtoTables.h @@ -488,6 +488,57 @@ DECLARE_SOA_TABLE_STAGED_VERSIONED(FK0shortExtras_001, "FK0SHORTEXTRA", 1, //! k using FK0shortExtras = FK0shortExtras_001; +namespace femtokinks +{ +// columns for bit masks +DECLARE_SOA_COLUMN(Mask, mask, femtodatatypes::KinkMaskType); //! Bitmask for kink selections + +// columns for debug information +DECLARE_SOA_COLUMN(KinkAngle, kinkAngle, float); //! Kink angle between mother and charged daughter at decay vertex +DECLARE_SOA_COLUMN(DcaMothToPV, dcaMothToPV, float); //! DCA of the mother track to the primary vertex +DECLARE_SOA_COLUMN(DcaDaugToPV, dcaDaugToPV, float); //! DCA of the charged daughter track to the primary vertex +DECLARE_SOA_COLUMN(DecayVtxX, decayVtxX, float); //! x coordinate of decay vertex (relative to PV) +DECLARE_SOA_COLUMN(DecayVtxY, decayVtxY, float); //! y coordinate of decay vertex (relative to PV) +DECLARE_SOA_COLUMN(DecayVtxZ, decayVtxZ, float); //! z coordinate of decay vertex (relative to PV) +DECLARE_SOA_COLUMN(TransRadius, transRadius, float); //! Transverse decay radius from PV + +// id column for charged daughter track +DECLARE_SOA_INDEX_COLUMN_FULL(ChaDau, chaDau, int32_t, FTracks, "_ChaDau"); //! +} // namespace femtokinks + +// table for basic sigma minus information +DECLARE_SOA_TABLE_STAGED_VERSIONED(FSigmas_001, "FSIGMA", 1, + o2::soa::Index<>, + femtobase::stored::CollisionId, // use sign to differentiate between sigma minus (-1) and anti sigma minus (+1) + femtobase::stored::SignedPt, + femtobase::stored::Eta, + femtobase::stored::Phi, + femtobase::stored::Mass, + femtokinks::ChaDauId, + femtobase::dynamic::Sign, + femtobase::dynamic::Pt, + femtobase::dynamic::P, + femtobase::dynamic::Px, + femtobase::dynamic::Py, + femtobase::dynamic::Pz, + femtobase::dynamic::Theta); +using FSigmas = FSigmas_001; + +DECLARE_SOA_TABLE_STAGED_VERSIONED(FSigmaMasks_001, "FSIGMAMASKS", 1, + femtokinks::Mask); +using FSigmaMasks = FSigmaMasks_001; + +DECLARE_SOA_TABLE_STAGED_VERSIONED(FSigmaExtras_001, "FSIGMAEXTRAS", 1, + femtokinks::KinkAngle, + femtokinks::DcaDaugToPV, + femtokinks::DcaMothToPV, + femtokinks::DecayVtxX, + femtokinks::DecayVtxY, + femtokinks::DecayVtxZ, + femtokinks::TransRadius); + +using FSigmaExtras = FSigmaExtras_001; + namespace femtocascades { // columns for cascade bit masks diff --git a/PWGCF/Femto/TableProducer/femtoProducer.cxx b/PWGCF/Femto/TableProducer/femtoProducer.cxx index 205ca34a986..c5140fb5855 100644 --- a/PWGCF/Femto/TableProducer/femtoProducer.cxx +++ b/PWGCF/Femto/TableProducer/femtoProducer.cxx @@ -15,10 +15,12 @@ #include "PWGCF/Femto/Core/cascadeBuilder.h" #include "PWGCF/Femto/Core/collisionBuilder.h" +#include "PWGCF/Femto/Core/kinkBuilder.h" #include "PWGCF/Femto/Core/modes.h" #include "PWGCF/Femto/Core/trackBuilder.h" #include "PWGCF/Femto/Core/twoTrackResonanceBuilder.h" #include "PWGCF/Femto/Core/v0Builder.h" +#include "PWGLF/DataModel/LFKinkDecayTables.h" #include "PWGLF/DataModel/LFStrangenessTables.h" #include "Common/DataModel/Centrality.h" @@ -70,6 +72,8 @@ using Run3PpVzeros = V0Datas; using Run3PpCascades = CascDatas; +using Run3PpKinks = KinkCands; + } // namespace consumeddata } // namespace o2::analysis::femto @@ -116,6 +120,13 @@ struct FemtoProducer { cascadebuilder::ConfOmegaBits confOmegaBits; cascadebuilder::CascadeBuilder omegaBuilder; + // kink builder + kinkbuilder::KinkBuilderProducts kinkBuilderProducts; + kinkbuilder::ConfKinkTables confKinkTables; + kinkbuilder::ConfKinkFilters confKinkFilters; + kinkbuilder::ConfSigmaBits confSigmaBits; + kinkbuilder::KinkBuilder sigmaBuilder; + // resonance daughter filters and partitions twotrackresonancebuilder::ConfTwoTrackResonanceDaughterFilters confResonanceDaughterFilters; // caching and preslicing @@ -191,6 +202,9 @@ struct FemtoProducer { lambdaBuilder.init(confLambdaBits, confV0Filters, confV0Tables, context); antilambdaBuilder.init(confLambdaBits, confV0Filters, confV0Tables, context); + // configure kink builder + sigmaBuilder.init(confSigmaBits, confKinkFilters, confKinkTables, context); + // cascade selections xiBuilder.init(confXiBits, confCascadeFilters, confCascadeTables, context); omegaBuilder.init(confOmegaBits, confCascadeFilters, confCascadeTables, context); @@ -201,11 +215,14 @@ struct FemtoProducer { kstar0Builder.init(confKstar0Bits, confKstarFilters, confResonanceDaughterFilters, confTwoTrackResonanceTables, context); kstar0barBuilder.init(confKstar0Bits, confKstarFilters, confResonanceDaughterFilters, confTwoTrackResonanceTables, context); - if ((xiBuilder.fillAnyTable() || omegaBuilder.fillAnyTable()) && !doprocessTracksV0sCascadesRun3pp) { - LOG(fatal) << "At least one cascade tabel is enabled, but wrong process function is enabled. Breaking..."; + if ((xiBuilder.fillAnyTable() || omegaBuilder.fillAnyTable()) && (!doprocessTracksV0sCascadesRun3pp && !doprocessTracksV0sCascadesKinksRun3pp)) { + LOG(fatal) << "At least one cascade table is enabled, but wrong process function is enabled. Breaking..."; + } + if ((lambdaBuilder.fillAnyTable() || antilambdaBuilder.fillAnyTable() || k0shortBuilder.fillAnyTable()) && (!doprocessTracksV0sCascadesRun3pp && !doprocessTracksV0sRun3pp && !doprocessTracksV0sCascadesKinksRun3pp)) { + LOG(info) << "At least one v0 table is enabled, but wrong process function is enabled. Breaking..."; } - if ((lambdaBuilder.fillAnyTable() || antilambdaBuilder.fillAnyTable() || k0shortBuilder.fillAnyTable()) && (!doprocessTracksV0sCascadesRun3pp && !doprocessTracksV0sRun3pp)) { - LOG(info) << "At least one v0 tabel is enbaled, but wrong process function is enabled. Breaking..."; + if (sigmaBuilder.fillAnyTable() && !doprocessTracksKinksRun3pp && !doprocessTracksV0sCascadesKinksRun3pp) { + LOG(fatal) << "At least one kink table is enabled, but wrong process function is enabled. Breaking..."; } } @@ -244,6 +261,14 @@ struct FemtoProducer { k0shortBuilder.fillV0s(collisionBuilderProducts, trackBuilderProducts, v0builderProducts, v0s, tracks, trackBuilder, indexMapTracks); } + // add kinks + template + void processTracksKinks(T1 const& col, T2 const& bcs, T3 const& tracks, T4 const& tracksWithItsPid, T5 const& kinks) + { + processTracks(col, bcs, tracks, tracksWithItsPid); + sigmaBuilder.fillKinks(collisionBuilderProducts, trackBuilderProducts, kinkBuilderProducts, kinks, tracks, trackBuilder, indexMapTracks); + } + // add cascades template void processTracksV0sCascades(T1 const& col, T2 const& bcs, T3 const& tracks, T4 const& tracksWithItsPid, T5 const& v0s, T6 const& cascades) @@ -255,6 +280,18 @@ struct FemtoProducer { cascades, tracks, col, trackBuilder, indexMapTracks); } + // add kinks + template + void processTracksV0sCascadesKinks(T1 const& col, T2 const& bcs, T3 const& tracks, T4 const& tracksWithItsPid, T5 const& v0s, T6 const& cascades, T7 const& kinks) + { + processTracksV0s(col, bcs, tracks, tracksWithItsPid, v0s); + sigmaBuilder.fillKinks(collisionBuilderProducts, trackBuilderProducts, kinkBuilderProducts, kinks, tracks, trackBuilder, indexMapTracks); + xiBuilder.fillCascades(collisionBuilderProducts, trackBuilderProducts, cascadeBuilderProducts, + cascades, tracks, col, trackBuilder, indexMapTracks); + omegaBuilder.fillCascades(collisionBuilderProducts, trackBuilderProducts, cascadeBuilderProducts, + cascades, tracks, col, trackBuilder, indexMapTracks); + } + // proccess functions void processTracksRun3pp(consumeddata::Run3PpCollisions::iterator const& col, BCsWithTimestamps const& bcs, @@ -280,7 +317,20 @@ struct FemtoProducer { }; PROCESS_SWITCH(FemtoProducer, processTracksV0sRun3pp, "Process tracks and v0s", false); - // process tracks, v0s and casacades + // process tracks and kinks + void processTracksKinksRun3pp(consumeddata::Run3PpCollisions::iterator const& col, + BCsWithTimestamps const& bcs, + consumeddata::Run3FullPidTracks const& tracks, + consumeddata::Run3PpKinks const& kinks) + { + // its pid information is generated dynamically, so we need to add it here + auto tracksWithItsPid = o2::soa::Attach(tracks); + processTracksKinks(col, bcs, tracks, tracksWithItsPid, kinks); + } + PROCESS_SWITCH(FemtoProducer, processTracksKinksRun3pp, "Process tracks and kinks", false); + + // process tracks, v0s and cascades void processTracksV0sCascadesRun3pp(consumeddata::Run3PpCollisions::iterator const& col, BCsWithTimestamps const& bcs, consumeddata::Run3FullPidTracks const& tracks, @@ -293,6 +343,21 @@ struct FemtoProducer { processTracksV0sCascades(col, bcs, tracks, tracksWithItsPid, v0s, cascades); } PROCESS_SWITCH(FemtoProducer, processTracksV0sCascadesRun3pp, "Provide Tracks, V0s and Cascades for Run3", false); + + // process tracks, v0s, cascades and kinks + void processTracksV0sCascadesKinksRun3pp(consumeddata::Run3PpCollisions::iterator const& col, + BCsWithTimestamps const& bcs, + consumeddata::Run3FullPidTracks const& tracks, + consumeddata::Run3PpVzeros const& v0s, + consumeddata::Run3PpCascades const& cascades, + consumeddata::Run3PpKinks const& kinks) + { + // its pid information is generated dynamically, so we need to add it here + auto tracksWithItsPid = o2::soa::Attach(tracks); + processTracksV0sCascadesKinks(col, bcs, tracks, tracksWithItsPid, v0s, cascades, kinks); + } + PROCESS_SWITCH(FemtoProducer, processTracksV0sCascadesKinksRun3pp, "Provide Tracks, V0s and Cascades for Run3", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGCF/Femto/Tasks/CMakeLists.txt b/PWGCF/Femto/Tasks/CMakeLists.txt index eb16171c62b..7ed493cc309 100644 --- a/PWGCF/Femto/Tasks/CMakeLists.txt +++ b/PWGCF/Femto/Tasks/CMakeLists.txt @@ -24,6 +24,11 @@ o2physics_add_dpl_workflow(femto-v0-qa PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(femto-kink-qa + SOURCES femtoKinkQa.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(femto-cascade-qa SOURCES femtoCascadeQa.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore diff --git a/PWGCF/Femto/Tasks/femtoKinkQa.cxx b/PWGCF/Femto/Tasks/femtoKinkQa.cxx new file mode 100644 index 00000000000..1fdb4e58693 --- /dev/null +++ b/PWGCF/Femto/Tasks/femtoKinkQa.cxx @@ -0,0 +1,120 @@ +// Copyright 2019-2025 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 femtoKinkQa.cxx +/// \brief QA task for kinks +/// \author Anton Riedel, TU München, anton.riedel@cern.ch +/// \author Henrik Fribert, TU München, henrik.fribert@cern.ch + +#include "PWGCF/Femto/Core/collisionBuilder.h" +#include "PWGCF/Femto/Core/collisionHistManager.h" +#include "PWGCF/Femto/Core/kinkBuilder.h" +#include "PWGCF/Femto/Core/kinkHistManager.h" +#include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/partitions.h" +#include "PWGCF/Femto/Core/trackHistManager.h" +#include "PWGCF/Femto/DataModel/FemtoTables.h" +#include "PWGLF/DataModel/LFKinkDecayTables.h" + +#include "Framework/ASoA.h" +#include "Framework/AnalysisHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/Configurable.h" +#include "Framework/Expressions.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/InitContext.h" +#include "Framework/OutputObjHeader.h" +#include "Framework/runDataProcessing.h" + +#include +#include +#include + +using namespace o2; +using namespace o2::aod; +using namespace o2::soa; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::analysis::femto; + +struct FemtoKinkQa { + + // setup for collisions + collisionbuilder::ConfCollisionFilters collisionSelection; + Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); + + colhistmanager::CollisionHistManager colHistManager; + colhistmanager::ConfCollisionBinning confCollisionBinning; + + // using Collisions = o2::soa::Join; + using Collisions = FCols; + using Collision = Collisions::iterator; + + using FilteredCollisions = o2::soa::Filtered; + using FilteredCollision = FilteredCollisions::iterator; + + // Define kink/sigma tables (joining tables for comprehensive information) + using Sigmas = o2::soa::Join; + using Tracks = o2::soa::Join; + + SliceCache cache; + + // setup for sigmas + kinkbuilder::ConfSigmaSelection1 confSigmaSelection; + + Partition sigmaPartition = MAKE_SIGMA_PARTITION(confSigmaSelection); + Preslice perColSigmas = aod::femtobase::stored::collisionId; + + kinkhistmanager::ConfSigmaBinning1 confSigmaBinning; + kinkhistmanager::ConfSigmaQaBinning1 confSigmaQaBinning; + kinkhistmanager::KinkHistManager< + kinkhistmanager::PrefixSigmaQa, + trackhistmanager::PrefixKinkChaDaughterQa, + modes::Mode::kAnalysis_Qa, + modes::Kink::kSigma> + sigmaHistManager; + + // setup for daughters + trackhistmanager::ConfKinkChaDauBinning confKinkChaDaughterBinning; + trackhistmanager::ConfKinkChaDauQaBinning confKinkChaDaughterQaBinning; + + HistogramRegistry hRegistry{"FemtoKinkQa", {}, OutputObjHandlingPolicy::AnalysisObject}; + + void init(InitContext&) + { + auto sigmaHistSpec = kinkhistmanager::makeKinkQaHistSpecMap(confSigmaBinning, confSigmaQaBinning); + auto chaDauHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confKinkChaDaughterBinning, confKinkChaDaughterQaBinning); + + sigmaHistManager.init(&hRegistry, sigmaHistSpec, chaDauHistSpec); + + auto collisionHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); + colHistManager.init(&hRegistry, collisionHistSpec); + }; + + // Process function for sigma particles from femto tables + void processSigma(FilteredCollision const& col, Sigmas const& /*sigmas*/, Tracks const& tracks) + { + colHistManager.fill(col); + auto sigmaSlice = sigmaPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + for (auto const& sigma : sigmaSlice) { + sigmaHistManager.fill(sigma, tracks); + } + } + PROCESS_SWITCH(FemtoKinkQa, processSigma, "Process sigmas", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{ + adaptAnalysisTask(cfgc), + }; + return workflow; +} From 91acb9ef4fc7f438eded47bddbcf3ebb1d106f67 Mon Sep 17 00:00:00 2001 From: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Date: Sat, 20 Sep 2025 23:21:47 +0200 Subject: [PATCH 474/986] [PWGCF] add FT0A-FT0C correlation (#13049) --- .../Tasks/longRangeDihadronCor.cxx | 391 +++++++++++++++--- 1 file changed, 342 insertions(+), 49 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx b/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx index c8524d0507f..bcd248c223c 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx @@ -99,7 +99,6 @@ struct LongRangeDihadronCor { O2_DEFINE_CONFIGURABLE(cfgCentralityWeight, std::string, "", "CCDB path to centrality weight object") O2_DEFINE_CONFIGURABLE(cfgLocalEfficiency, bool, false, "Use local efficiency object") O2_DEFINE_CONFIGURABLE(cfgUseEventWeights, bool, false, "Use event weights for mixed event") - O2_DEFINE_CONFIGURABLE(cfgSwitchCor, int, 0, "0:TPC-FT0A; 1:TPC-FT0C") struct : ConfigurableGroup { O2_DEFINE_CONFIGURABLE(cfgMultCentHighCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x + 10.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); O2_DEFINE_CONFIGURABLE(cfgMultCentLowCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x - 3.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); @@ -137,7 +136,9 @@ struct LongRangeDihadronCor { ConfigurableAxis axisMultiplicity{"axisMultiplicity", {VARIABLE_WIDTH, 0, 10, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260}, "multiplicity axis for histograms"}; ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.2, 0.5, 1, 1.5, 2, 3, 4, 6, 10}, "pt axis for histograms"}; ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -PIHalf, PIHalf * 3}, "delta phi axis for histograms"}; - ConfigurableAxis axisDeltaEta{"axisDeltaEta", {32, -5.8, -2.6}, "delta eta axis, -5.8~-2.6 for TPC-FT0A, 1.2~4.2 for TPC-FT0C"}; + ConfigurableAxis axisDeltaEtaTpcFt0a{"axisDeltaEtaTpcFt0a", {32, -5.8, -2.6}, "delta eta axis, -5.8~-2.6 for TPC-FT0A,"}; + ConfigurableAxis axisDeltaEtaTpcFt0c{"axisDeltaEtaTpcFt0c", {32, 1.2, 4.2}, "delta eta axis, 1.2~4.2 for TPC-FT0C"}; + ConfigurableAxis axisDeltaEtaFt0aFt0c{"axisDeltaEtaFt0aFt0c", {32, -1.5, 3.0}, "delta eta axis"}; ConfigurableAxis axisPtTrigger{"axisPtTrigger", {VARIABLE_WIDTH, 0.2, 0.5, 1, 1.5, 2, 3, 4, 6, 10}, "pt trigger axis for histograms"}; ConfigurableAxis axisPtAssoc{"axisPtAssoc", {VARIABLE_WIDTH, 0.2, 0.5, 1, 1.5, 2, 3, 4, 6, 10}, "pt associated axis for histograms"}; ConfigurableAxis axisVtxMix{"axisVtxMix", {VARIABLE_WIDTH, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, "vertex axis for mixed event histograms"}; @@ -172,8 +173,12 @@ struct LongRangeDihadronCor { bool correctionsLoaded = false; // Define the outputs - OutputObj same{"sameEvent"}; - OutputObj mixed{"mixedEvent"}; + OutputObj sameTpcFt0a{"sameEvent_TPC_FT0A"}; + OutputObj mixedTpcFt0a{"mixedEvent_TPC_FT0A"}; + OutputObj sameTpcFt0c{"sameEvent_TPC_FT0C"}; + OutputObj mixedTpcFt0c{"mixedEvent_TPC_FT0C"}; + OutputObj sameFt0aFt0c{"sameEvent_FT0A_FT0C"}; + OutputObj mixedFt0aFt0c{"mixedEvent_FT0A_FT0C"}; HistogramRegistry registry{"registry"}; // define global variables @@ -211,7 +216,7 @@ struct LongRangeDihadronCor { LOGF(info, "Starting init"); // Event Counter - if (doprocessSame && cfgUseAdditionalEventCut) { + if ((doprocessSameTpcFt0a || doprocessSameTpcFt0c || doprocessSameFt0aFt0c) && cfgUseAdditionalEventCut) { registry.add("hEventCountSpecific", "Number of Event;; Count", {HistType::kTH1D, {{12, 0, 12}}}); registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(1, "after sel8"); registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(2, "kNoSameBunchPileup"); @@ -260,9 +265,7 @@ struct LongRangeDihadronCor { std::string hCentTitle = "Centrality distribution, Estimator " + std::to_string(cfgCentEstimator); // Make histograms to check the distributions after cuts - if (doprocessSame) { - registry.add("deltaEta_deltaPhi_same", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEta}}); // check to see the delta eta and delta phi distribution - registry.add("deltaEta_deltaPhi_mixed", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEta}}); + if (doprocessSameTpcFt0a || doprocessSameTpcFt0c || doprocessSameFt0aFt0c) { registry.add("Phi", "Phi", {HistType::kTH1D, {axisPhi}}); registry.add("Eta", "Eta", {HistType::kTH1D, {axisEta}}); registry.add("EtaCorrected", "EtaCorrected", {HistType::kTH1D, {axisEta}}); @@ -276,30 +279,68 @@ struct LongRangeDihadronCor { registry.add("zVtx", "zVtx", {HistType::kTH1D, {axisVertex}}); registry.add("zVtx_used", "zVtx_used", {HistType::kTH1D, {axisVertex}}); registry.add("Trig_hist", "", {HistType::kTHnSparseF, {{axisSample, axisVertex, axisPtTrigger}}}); - registry.add("Assoc_amp_same", "", {HistType::kTH2D, {axisChannelFt0aAxis, axisAmplitudeFt0a}}); - registry.add("Assoc_amp_mixed", "", {HistType::kTH2D, {axisChannelFt0aAxis, axisAmplitudeFt0a}}); registry.add("FT0Amp", "", {HistType::kTH2F, {axisChID, axisFit}}); - registry.add("FT0AmpCorr", "", {HistType::kTH2F, {axisChID, axisFit}}); + registry.add("FT0AmpCorrect", "", {HistType::kTH2F, {axisChID, axisFit}}); + registry.add("FT0Cmp", "", {HistType::kTH2F, {axisChID, axisFit}}); + registry.add("FT0CmpCorrect", "", {HistType::kTH2F, {axisChID, axisFit}}); + } + if (doprocessSameTpcFt0a) { + registry.add("deltaEta_deltaPhi_same_TPC_FT0A", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEtaTpcFt0a}}); // check to see the delta eta and delta phi distribution + registry.add("deltaEta_deltaPhi_mixed_TPC_FT0A", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEtaTpcFt0a}}); + registry.add("Assoc_amp_same_TPC_FT0A", "", {HistType::kTH2D, {axisChannelFt0aAxis, axisAmplitudeFt0a}}); + registry.add("Assoc_amp_mixed_TPC_FT0A", "", {HistType::kTH2D, {axisChannelFt0aAxis, axisAmplitudeFt0a}}); + } + if (doprocessSameTpcFt0c) { + registry.add("deltaEta_deltaPhi_same_TPC_FT0C", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEtaTpcFt0c}}); // check to see the delta eta and delta phi distribution + registry.add("deltaEta_deltaPhi_mixed_TPC_FT0C", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEtaTpcFt0c}}); + registry.add("Assoc_amp_same_TPC_FT0C", "", {HistType::kTH2D, {axisChannelFt0aAxis, axisAmplitudeFt0a}}); + registry.add("Assoc_amp_mixed_TPC_FT0C", "", {HistType::kTH2D, {axisChannelFt0aAxis, axisAmplitudeFt0a}}); + } + if (doprocessSameFt0aFt0c) { + registry.add("deltaEta_deltaPhi_same_FT0A_FT0C", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEtaFt0aFt0c}}); // check to see the delta eta and delta phi distribution + registry.add("deltaEta_deltaPhi_mixed_FT0A_FT0C", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEtaFt0aFt0c}}); } registry.add("eventcount", "bin", {HistType::kTH1F, {{4, 0, 4, "bin"}}}); // histogram to see how many events are in the same and mixed event LOGF(info, "Initializing correlation container"); - std::vector corrAxis = {{axisSample, "Sample"}, - {axisVertex, "z-vtx (cm)"}, - {axisPtTrigger, "p_{T} (GeV/c)"}, - {axisPtAssoc, "p_{T} (GeV/c)"}, - {axisDeltaPhi, "#Delta#varphi (rad)"}, - {axisDeltaEta, "#Delta#eta"}}; + std::vector corrAxisTpcFt0a = {{axisSample, "Sample"}, + {axisVertex, "z-vtx (cm)"}, + {axisPtTrigger, "p_{T} (GeV/c)"}, + {axisPtAssoc, "p_{T} (GeV/c)"}, + {axisDeltaPhi, "#Delta#varphi (rad)"}, + {axisDeltaEtaTpcFt0a, "#Delta#eta"}}; std::vector effAxis = { {axisEtaEfficiency, "#eta"}, {axisPtEfficiency, "p_{T} (GeV/c)"}, {axisVertexEfficiency, "z-vtx (cm)"}, }; std::vector userAxis; - - same.setObject(new CorrelationContainer("sameEvent", "sameEvent", corrAxis, effAxis, userAxis)); - mixed.setObject(new CorrelationContainer("mixedEvent", "mixedEvent", corrAxis, effAxis, userAxis)); + std::vector corrAxisTpcFt0c = {{axisSample, "Sample"}, + {axisVertex, "z-vtx (cm)"}, + {axisPtTrigger, "p_{T} (GeV/c)"}, + {axisPtAssoc, "p_{T} (GeV/c)"}, + {axisDeltaPhi, "#Delta#varphi (rad)"}, + {axisDeltaEtaTpcFt0c, "#Delta#eta"}}; + std::vector corrAxisFt0aFt0c = {{axisSample, "Sample"}, + {axisVertex, "z-vtx (cm)"}, + {axisPtTrigger, "p_{T} (GeV/c)"}, + {axisPtAssoc, "p_{T} (GeV/c)"}, + {axisDeltaPhi, "#Delta#varphi (rad)"}, + {axisDeltaEtaFt0aFt0c, "#Delta#eta"}}; + + if (doprocessSameTpcFt0a) { + sameTpcFt0a.setObject(new CorrelationContainer("sameEvent_TPC_FT0A", "sameEvent_TPC_FT0A", corrAxisTpcFt0a, effAxis, userAxis)); + mixedTpcFt0a.setObject(new CorrelationContainer("mixedEvent_TPC_FT0A", "mixedEvent_TPC_FT0A", corrAxisTpcFt0a, effAxis, userAxis)); + } + if (doprocessSameTpcFt0c) { + sameTpcFt0c.setObject(new CorrelationContainer("sameEvent_TPC_FT0C", "sameEvent_TPC_FT0C", corrAxisTpcFt0c, effAxis, userAxis)); + mixedTpcFt0c.setObject(new CorrelationContainer("mixedEvent_TPC_FT0C", "mixedEvent_TPC_FT0C", corrAxisTpcFt0c, effAxis, userAxis)); + } + if (doprocessSameFt0aFt0c) { + sameFt0aFt0c.setObject(new CorrelationContainer("sameEvent_FT0A_FT0C", "sameEvent_FT0A_FT0C", corrAxisFt0aFt0c, effAxis, userAxis)); + mixedFt0aFt0c.setObject(new CorrelationContainer("mixedEvent_FT0A_FT0C", "mixedEvent_FT0A_FT0C", corrAxisFt0aFt0c, effAxis, userAxis)); + } LOGF(info, "End of init"); } @@ -307,6 +348,9 @@ struct LongRangeDihadronCor { double getPhiFT0(uint64_t chno, int i) { // offsetFT0[0]: FT0A, offsetFT0[1]: FT0C + if (i > 1 || i < 0) { + LOGF(fatal, "kFIT Index %d out of range", i); + } ft0Det.calculateChannelCenter(); auto chPos = ft0Det.getChannelCenter(chno); return RecoDecay::phi(chPos.X() + (*offsetFT0)[i].getX(), chPos.Y() + (*offsetFT0)[i].getY()); @@ -315,6 +359,9 @@ struct LongRangeDihadronCor { double getEtaFT0(uint64_t chno, int i) { // offsetFT0[0]: FT0A, offsetFT0[1]: FT0C + if (i > 1 || i < 0) { + LOGF(fatal, "kFIT Index %d out of range", i); + } ft0Det.calculateChannelCenter(); auto chPos = ft0Det.getChannelCenter(chno); auto x = chPos.X() + (*offsetFT0)[i].getX(); @@ -465,28 +512,30 @@ struct LongRangeDihadronCor { } template - void getChannel(TFT0s const& ft0, std::size_t const& iCh, int& id, float& ampl) + void getChannel(TFT0s const& ft0, std::size_t const& iCh, int& id, float& ampl, int fitType) { - int switchCor = cfgSwitchCor; int rID{0}; - if (switchCor == kFT0C) { + if (fitType == kFT0C) { id = ft0.channelC()[iCh]; rID = id + 96; ampl = ft0.amplitudeC()[iCh]; - } else if (switchCor == kFT0A) { + registry.fill(HIST("FT0Cmp"), rID, ampl); + ampl = ampl / cstFT0RelGain[iCh]; + registry.fill(HIST("FT0CmpCorrect"), rID, ampl); + } else if (fitType == kFT0A) { id = ft0.channelA()[iCh]; rID = id; ampl = ft0.amplitudeA()[iCh]; + registry.fill(HIST("FT0Amp"), rID, ampl); + ampl = ampl / cstFT0RelGain[iCh]; + registry.fill(HIST("FT0AmpCorrect"), rID, ampl); } else { - LOGF(fatal, "Cor Index %d out of range", switchCor); + LOGF(fatal, "Cor Index %d out of range", fitType); } - registry.fill(HIST("FT0Amp"), rID, ampl); - ampl = ampl / cstFT0RelGain[iCh]; - registry.fill(HIST("FT0AmpCorr"), rID, ampl); } template - void fillCorrelations(TTracks tracks1, TFT0s const& ft0, float posZ, int system, float cent, float eventWeight) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms + void fillCorrelationsTPCFT0(TTracks tracks1, TFT0s const& ft0, float posZ, int system, int corType, float cent, float eventWeight) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms { if (system == SameEvent) { if (!cfgCentTableUnavailable) @@ -509,31 +558,79 @@ struct LongRangeDihadronCor { } std::size_t channelSize = 0; - int switchCor = cfgSwitchCor; - if (switchCor == kFT0C) { + if (corType == kFT0C) { channelSize = ft0.channelC().size(); - } else if (switchCor == kFT0A) { + } else if (corType == kFT0A) { channelSize = ft0.channelA().size(); } else { - LOGF(fatal, "Cor Index %d out of range", switchCor); + LOGF(fatal, "Cor Index %d out of range", corType); } for (std::size_t iCh = 0; iCh < channelSize; iCh++) { int chanelid = 0; float ampl = 0.; - getChannel(ft0, iCh, chanelid, ampl); - auto phi = getPhiFT0(chanelid, switchCor); - auto eta = getEtaFT0(chanelid, switchCor); + getChannel(ft0, iCh, chanelid, ampl, corType); + auto phi = getPhiFT0(chanelid, corType); + auto eta = getEtaFT0(chanelid, corType); float deltaPhi = RecoDecay::constrainAngle(track1.phi() - phi, -PIHalf); float deltaEta = track1.eta() - eta; // fill the right sparse and histograms if (system == SameEvent) { - registry.fill(HIST("Assoc_amp_same"), chanelid, ampl); - same->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track1.pt(), deltaPhi, deltaEta, eventWeight * triggerWeight); - registry.fill(HIST("deltaEta_deltaPhi_same"), deltaPhi, deltaEta, eventWeight * triggerWeight); + if (corType == kFT0A) { + registry.fill(HIST("Assoc_amp_same_TPC_FT0A"), chanelid, ampl); + sameTpcFt0a->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track1.pt(), deltaPhi, deltaEta, eventWeight * triggerWeight); + registry.fill(HIST("deltaEta_deltaPhi_same_TPC_FT0A"), deltaPhi, deltaEta, eventWeight * triggerWeight); + } else if (corType == kFT0C) { + registry.fill(HIST("Assoc_amp_same_TPC_FT0C"), chanelid, ampl); + sameTpcFt0c->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track1.pt(), deltaPhi, deltaEta, eventWeight * triggerWeight); + registry.fill(HIST("deltaEta_deltaPhi_same_TPC_FT0C"), deltaPhi, deltaEta, eventWeight * triggerWeight); + } + } else if (system == MixedEvent) { + if (corType == kFT0A) { + registry.fill(HIST("Assoc_amp_mixed_TPC_FT0A"), chanelid, ampl); + mixedTpcFt0a->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track1.pt(), deltaPhi, deltaEta, eventWeight * triggerWeight); + registry.fill(HIST("deltaEta_deltaPhi_mixed_TPC_FT0A"), deltaPhi, deltaEta, eventWeight * triggerWeight); + } else if (corType == kFT0C) { + registry.fill(HIST("Assoc_amp_mixed_TPC_FT0C"), chanelid, ampl); + mixedTpcFt0c->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track1.pt(), deltaPhi, deltaEta, eventWeight * triggerWeight); + registry.fill(HIST("deltaEta_deltaPhi_mixed_TPC_FT0C"), deltaPhi, deltaEta, eventWeight * triggerWeight); + } + } + } + } + } + + template + void fillCorrelationsFT0AFT0C(TFT0s const& ft0, float posZ, int system, float eventWeight) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms + { + int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); + + float triggerWeight = 1.0f; + std::size_t channelASize = ft0.channelA().size(); + std::size_t channelCSize = ft0.channelC().size(); + // loop over all tracks + for (std::size_t iChA = 0; iChA < channelASize; iChA++) { + + int chanelAid = 0; + float amplA = 0.; + getChannel(ft0, iChA, chanelAid, amplA, kFT0A); + auto phiA = getPhiFT0(chanelAid, kFT0A); + auto etaA = getEtaFT0(chanelAid, kFT0A); + + for (std::size_t iChC = 0; iChC < channelCSize; iChC++) { + int chanelCid = 0; + float amplC = 0.; + getChannel(ft0, iChC, chanelCid, amplC, kFT0C); + auto phiC = getPhiFT0(chanelCid, kFT0C); + auto etaC = getEtaFT0(chanelCid, kFT0C); + float deltaPhi = RecoDecay::constrainAngle(phiA - phiC, -PIHalf); + float deltaEta = etaA - etaC; + // fill the right sparse and histograms + if (system == SameEvent) { + sameFt0aFt0c->getPairHist()->Fill(step, fSampleIndex, posZ, 0., 0., deltaPhi, deltaEta, eventWeight * triggerWeight); + registry.fill(HIST("deltaEta_deltaPhi_same_FT0A_FT0C"), deltaPhi, deltaEta, eventWeight * triggerWeight); } else if (system == MixedEvent) { - registry.fill(HIST("Assoc_amp_mixed"), chanelid, ampl); - mixed->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track1.pt(), deltaPhi, deltaEta, eventWeight * triggerWeight); - registry.fill(HIST("deltaEta_deltaPhi_mixed"), deltaPhi, deltaEta, eventWeight * triggerWeight); + mixedFt0aFt0c->getPairHist()->Fill(step, fSampleIndex, posZ, 0., 0., deltaPhi, deltaEta, eventWeight * triggerWeight); + registry.fill(HIST("deltaEta_deltaPhi_mixed_FT0A_FT0C"), deltaPhi, deltaEta, eventWeight * triggerWeight); } } } @@ -638,7 +735,112 @@ struct LongRangeDihadronCor { return 1; } - void processSame(FilteredCollisions::iterator const& collision, FilteredTracks const& tracks, aod::FT0s const&, aod::BCsWithTimestamps const&) + void processSameTpcFt0a(FilteredCollisions::iterator const& collision, FilteredTracks const& tracks, aod::FT0s const&, aod::BCsWithTimestamps const&) + { + if (!collision.sel8()) + return; + auto bc = collision.bc_as(); + float cent = -1.; + float weightCent = 1.0f; + if (!cfgCentTableUnavailable) { + cent = getCentrality(collision); + } + if (cfgUseAdditionalEventCut && !eventSelected(collision, tracks.size(), cent, true)) + return; + if (!collision.has_foundFT0()) + return; + loadAlignParam(bc.timestamp()); + loadGain(bc); + loadCorrection(bc.timestamp()); + if (!cfgCentTableUnavailable) { + getCentralityWeight(weightCent, cent); + registry.fill(HIST("Centrality"), cent); + registry.fill(HIST("CentralityWeighted"), cent, weightCent); + } + registry.fill(HIST("Nch"), tracks.size()); + registry.fill(HIST("zVtx"), collision.posZ()); + + if (cfgSelCollByNch && (tracks.size() < cfgCutMultMin || tracks.size() >= cfgCutMultMax)) { + return; + } + if (!cfgSelCollByNch && !cfgCentTableUnavailable && (cent < cfgCutCentMin || cent >= cfgCutCentMax)) { + return; + } + + registry.fill(HIST("eventcount"), SameEvent); // because its same event i put it in the 1 bin + fillYield(collision, tracks); + + sameTpcFt0a->fillEvent(tracks.size(), CorrelationContainer::kCFStepReconstructed); + const auto& ft0 = collision.foundFT0(); + fillCorrelationsTPCFT0(tracks, ft0, collision.posZ(), SameEvent, kFT0A, cent, weightCent); + } + PROCESS_SWITCH(LongRangeDihadronCor, processSameTpcFt0a, "Process same event for TPC-FT0 correlation", true); + + // the process for filling the mixed events + void processMixedTpcFt0a(FilteredCollisions const& collisions, FilteredTracks const& tracks, aod::FT0s const&, aod::BCsWithTimestamps const&) + { + + auto getTracksSize = [&tracks, this](FilteredCollisions::iterator const& collision) { + auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), this->cache); + auto mult = associatedTracks.size(); + return mult; + }; + + using MixedBinning = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getTracksSize)>; + + MixedBinning binningOnVtxAndMult{{getTracksSize}, {axisVtxMix, axisMultMix}, true}; + + auto tracksTuple = std::make_tuple(tracks, tracks); + Pair pairs{binningOnVtxAndMult, cfgMixEventNumMin, -1, collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip + for (auto it = pairs.begin(); it != pairs.end(); it++) { + auto& [collision1, tracks1, collision2, tracks2] = *it; + if (!collision1.sel8() || !collision2.sel8()) + continue; + + if (cfgSelCollByNch && (tracks1.size() < cfgCutMultMin || tracks1.size() >= cfgCutMultMax)) + continue; + + if (cfgSelCollByNch && (tracks2.size() < cfgCutMultMin || tracks2.size() >= cfgCutMultMax)) + continue; + + float cent1 = -1; + float cent2 = -1; + if (!cfgCentTableUnavailable) { + cent1 = getCentrality(collision1); + cent2 = getCentrality(collision2); + } + if (cfgUseAdditionalEventCut && !eventSelected(collision1, tracks1.size(), cent1, false)) + continue; + if (cfgUseAdditionalEventCut && !eventSelected(collision2, tracks2.size(), cent2, false)) + continue; + + if (!cfgSelCollByNch && !cfgCentTableUnavailable && (cent1 < cfgCutCentMin || cent1 >= cfgCutCentMax)) + continue; + + if (!cfgSelCollByNch && !cfgCentTableUnavailable && (cent2 < cfgCutCentMin || cent2 >= cfgCutCentMax)) + continue; + + if (!(collision1.has_foundFT0() && collision2.has_foundFT0())) + continue; + + registry.fill(HIST("eventcount"), MixedEvent); // fill the mixed event in the 3 bin + auto bc = collision1.bc_as(); + loadAlignParam(bc.timestamp()); + loadCorrection(bc.timestamp()); + float eventWeight = 1.0f; + if (cfgUseEventWeights) { + eventWeight = 1.0f / it.currentWindowNeighbours(); + } + float weightCent = 1.0f; + if (!cfgCentTableUnavailable) + getCentralityWeight(weightCent, cent1); + const auto& ft0 = collision2.foundFT0(); + fillCorrelationsTPCFT0(tracks1, ft0, collision1.posZ(), MixedEvent, kFT0A, cent1, eventWeight * weightCent); + } + } + PROCESS_SWITCH(LongRangeDihadronCor, processMixedTpcFt0a, "Process mixed events for TPC-FT0A correlation", true); + + void processSameTpcFt0c(FilteredCollisions::iterator const& collision, FilteredTracks const& tracks, aod::FT0s const&, aod::BCsWithTimestamps const&) { if (!collision.sel8()) return; @@ -673,14 +875,14 @@ struct LongRangeDihadronCor { registry.fill(HIST("eventcount"), SameEvent); // because its same event i put it in the 1 bin fillYield(collision, tracks); - same->fillEvent(tracks.size(), CorrelationContainer::kCFStepReconstructed); + sameTpcFt0c->fillEvent(tracks.size(), CorrelationContainer::kCFStepReconstructed); const auto& ft0 = collision.foundFT0(); - fillCorrelations(tracks, ft0, collision.posZ(), SameEvent, cent, weightCent); + fillCorrelationsTPCFT0(tracks, ft0, collision.posZ(), SameEvent, kFT0C, cent, weightCent); } - PROCESS_SWITCH(LongRangeDihadronCor, processSame, "Process same event", true); + PROCESS_SWITCH(LongRangeDihadronCor, processSameTpcFt0c, "Process same event for TPC-FT0C correlation", false); // the process for filling the mixed events - void processMixed(FilteredCollisions const& collisions, FilteredTracks const& tracks, aod::FT0s const&, aod::BCsWithTimestamps const&) + void processMixedTpcFt0c(FilteredCollisions const& collisions, FilteredTracks const& tracks, aod::FT0s const&, aod::BCsWithTimestamps const&) { auto getTracksSize = [&tracks, this](FilteredCollisions::iterator const& collision) { @@ -738,11 +940,102 @@ struct LongRangeDihadronCor { if (!cfgCentTableUnavailable) getCentralityWeight(weightCent, cent1); const auto& ft0 = collision2.foundFT0(); - fillCorrelations(tracks1, ft0, collision1.posZ(), MixedEvent, cent1, eventWeight * weightCent); + fillCorrelationsTPCFT0(tracks1, ft0, collision1.posZ(), MixedEvent, kFT0C, cent1, eventWeight * weightCent); } } + PROCESS_SWITCH(LongRangeDihadronCor, processMixedTpcFt0c, "Process mixed events for TPC-FT0C correlation", false); - PROCESS_SWITCH(LongRangeDihadronCor, processMixed, "Process mixed events", true); + void processSameFt0aFt0c(FilteredCollisions::iterator const& collision, FilteredTracks const& tracks, aod::FT0s const&, aod::BCsWithTimestamps const&) + { + if (!collision.sel8()) + return; + auto bc = collision.bc_as(); + float cent = -1.; + float weightCent = 1.0f; + if (!cfgCentTableUnavailable) { + cent = getCentrality(collision); + } + if (cfgUseAdditionalEventCut && !eventSelected(collision, tracks.size(), cent, true)) + return; + if (!collision.has_foundFT0()) + return; + loadAlignParam(bc.timestamp()); + loadGain(bc); + loadCorrection(bc.timestamp()); + + // should have the same event to TPC-FT0A/C correlations + if (cfgSelCollByNch && (tracks.size() < cfgCutMultMin || tracks.size() >= cfgCutMultMax)) { + return; + } + if (!cfgSelCollByNch && !cfgCentTableUnavailable && (cent < cfgCutCentMin || cent >= cfgCutCentMax)) { + return; + } + + sameFt0aFt0c->fillEvent(tracks.size(), CorrelationContainer::kCFStepReconstructed); + const auto& ft0 = collision.foundFT0(); + fillCorrelationsFT0AFT0C(ft0, collision.posZ(), SameEvent, weightCent); + } + PROCESS_SWITCH(LongRangeDihadronCor, processSameFt0aFt0c, "Process same event for FT0A-FT0C correlation", false); + + // the process for filling the mixed events + void processMixedFt0aFt0c(FilteredCollisions const& collisions, FilteredTracks const& tracks, aod::FT0s const&, aod::BCsWithTimestamps const&) + { + + auto getTracksSize = [&tracks, this](FilteredCollisions::iterator const& collision) { + auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), this->cache); + auto mult = associatedTracks.size(); + return mult; + }; + + using MixedBinning = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getTracksSize)>; + + MixedBinning binningOnVtxAndMult{{getTracksSize}, {axisVtxMix, axisMultMix}, true}; + + auto tracksTuple = std::make_tuple(tracks, tracks); + Pair pairs{binningOnVtxAndMult, cfgMixEventNumMin, -1, collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip + for (auto it = pairs.begin(); it != pairs.end(); it++) { + auto& [collision1, tracks1, collision2, tracks2] = *it; + + // should have the same event to TPC-FT0A/C correlations + if (!collision1.sel8() || !collision2.sel8()) + continue; + if (cfgSelCollByNch && (tracks1.size() < cfgCutMultMin || tracks1.size() >= cfgCutMultMax)) + continue; + if (cfgSelCollByNch && (tracks2.size() < cfgCutMultMin || tracks2.size() >= cfgCutMultMax)) + continue; + float cent1 = -1; + float cent2 = -1; + if (!cfgCentTableUnavailable) { + cent1 = getCentrality(collision1); + cent2 = getCentrality(collision2); + } + if (cfgUseAdditionalEventCut && !eventSelected(collision1, tracks1.size(), cent1, false)) + continue; + if (cfgUseAdditionalEventCut && !eventSelected(collision2, tracks2.size(), cent2, false)) + continue; + if (!cfgSelCollByNch && !cfgCentTableUnavailable && (cent1 < cfgCutCentMin || cent1 >= cfgCutCentMax)) + continue; + if (!cfgSelCollByNch && !cfgCentTableUnavailable && (cent2 < cfgCutCentMin || cent2 >= cfgCutCentMax)) + continue; + + if (!(collision1.has_foundFT0() && collision2.has_foundFT0())) + continue; + + auto bc = collision1.bc_as(); + loadAlignParam(bc.timestamp()); + loadCorrection(bc.timestamp()); + float eventWeight = 1.0f; + if (cfgUseEventWeights) { + eventWeight = 1.0f / it.currentWindowNeighbours(); + } + float weightCent = 1.0f; + if (!cfgCentTableUnavailable) + getCentralityWeight(weightCent, cent1); + const auto& ft0 = collision2.foundFT0(); + fillCorrelationsFT0AFT0C(ft0, collision1.posZ(), MixedEvent, eventWeight * weightCent); + } + } + PROCESS_SWITCH(LongRangeDihadronCor, processMixedFt0aFt0c, "Process mixed events for FT0A-FT0C correlation", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 417fd1b5a8f1698582ef42bdd887e11951c744b2 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sun, 21 Sep 2025 01:36:50 +0200 Subject: [PATCH 475/986] [PWGEM/Dilepton] update skimerPrimaryElectron.cxx (#13059) --- .../TableProducer/skimmerPrimaryElectron.cxx | 46 +++++++++---------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx index 3abbebc3897..c96c0233baa 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx @@ -353,19 +353,17 @@ struct skimmerPrimaryElectron { return false; } - if (track.hasITS() && !track.hasTPC() && !track.hasTRD() && !track.hasTOF()) { - int total_cluster_size = 0, nl = 0; - for (unsigned int layer = 0; layer < 7; layer++) { - int cluster_size_per_layer = track.itsClsSizeInLayer(layer); - if (cluster_size_per_layer > 0) { - nl++; - } - total_cluster_size += cluster_size_per_layer; + int total_cluster_size = 0, nl = 0; + for (unsigned int layer = 0; layer < 7; layer++) { + int cluster_size_per_layer = track.itsClsSizeInLayer(layer); + if (cluster_size_per_layer > 0) { + nl++; } + total_cluster_size += cluster_size_per_layer; + } - if (maxMeanITSClusterSize < static_cast(total_cluster_size) / static_cast(nl) * std::cos(std::atan(trackParCov.getTgl()))) { - return false; - } + if (maxMeanITSClusterSize < static_cast(total_cluster_size) / static_cast(nl) * std::cos(std::atan(trackParCov.getTgl()))) { + return false; } return true; @@ -823,8 +821,8 @@ struct prefilterPrimaryElectron { Configurable d_bz_input{"d_bz", -999, "bz field, -999 is automatic"}; Configurable fillQAHistogram{"fillQAHistogram", false, "flag to fill QA histograms"}; - Configurable max_dcaxy{"max_dcaxy", 0.3, "DCAxy To PV for loose track sample"}; - Configurable max_dcaz{"max_dcaz", 0.3, "DCAz To PV for loose track sample"}; + Configurable max_dcaxy{"max_dcaxy", 1.0, "DCAxy To PV for loose track sample"}; + Configurable max_dcaz{"max_dcaz", 1.0, "DCAz To PV for loose track sample"}; Configurable minpt{"minpt", 0.1, "min pt for ITS-TPC track"}; Configurable maxeta{"maxeta", 1.2, "eta acceptance for loose track sample"}; Configurable min_ncluster_tpc{"min_ncluster_tpc", 0, "min ncluster tpc"}; @@ -832,7 +830,7 @@ struct prefilterPrimaryElectron { Configurable max_frac_shared_clusters_tpc{"max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; Configurable min_tpc_cr_findable_ratio{"min_tpc_cr_findable_ratio", 0.8, "min. TPC Ncr/Nf ratio"}; Configurable maxchi2tpc{"maxchi2tpc", 5.0, "max chi2/NclsTPC"}; - Configurable maxchi2its{"maxchi2its", 6.0, "max chi2/NclsITS"}; + Configurable maxchi2its{"maxchi2its", 36.0, "max chi2/NclsITS"}; Configurable min_ncluster_its{"min_ncluster_its", 4, "min ncluster its"}; Configurable min_ncluster_itsib{"min_ncluster_itsib", 1, "min ncluster itsib"}; Configurable minTPCNsigmaEl{"minTPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; @@ -998,19 +996,17 @@ struct prefilterPrimaryElectron { return false; } - if (track.hasITS() && !track.hasTPC() && !track.hasTOF() && !track.hasTRD()) { - int total_cluster_size = 0, nl = 0; - for (unsigned int layer = 0; layer < 7; layer++) { - int cluster_size_per_layer = track.itsClsSizeInLayer(layer); - if (cluster_size_per_layer > 0) { - nl++; - } - total_cluster_size += cluster_size_per_layer; + int total_cluster_size = 0, nl = 0; + for (unsigned int layer = 0; layer < 7; layer++) { + int cluster_size_per_layer = track.itsClsSizeInLayer(layer); + if (cluster_size_per_layer > 0) { + nl++; } + total_cluster_size += cluster_size_per_layer; + } - if (maxMeanITSClusterSize < static_cast(total_cluster_size) / static_cast(nl) * std::cos(std::atan(trackParCov.getTgl()))) { - return false; - } + if (maxMeanITSClusterSize < static_cast(total_cluster_size) / static_cast(nl) * std::cos(std::atan(trackParCov.getTgl()))) { + return false; } return true; From b63b89700a035e57bd9ab14af405ce6c16380c90 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sun, 21 Sep 2025 03:52:00 +0200 Subject: [PATCH 476/986] [PWGEM/Dilepton] update treeCreatorElectronMLDDA.cxx (#13060) --- PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx index 5e34bcdf1ba..d19c073aff1 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx @@ -230,7 +230,7 @@ struct TreeCreatorElectronMLDDA { Configurable cfg_min_ncluster_itsib{"cfg_min_ncluster_itsib", 0, "min ncluster itsib"}; Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; Configurable cfg_max_chi2its{"cfg_max_chi2its", 5.0, "max chi2/NclsITS"}; - Configurable cfg_min_chi2its{"cfg_min_chi2its", 0.0, "min chi2/NclsITS"}; // remove ITS afterburner + Configurable cfg_min_chi2its{"cfg_min_chi2its", -1e+10, "min chi2/NclsITS"}; // remove ITS afterburner Configurable cfg_max_chi2tof{"cfg_max_chi2tof", 1e+10, "max chi2 TOF"}; // distance in cm Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2, "min n sigma e in TPC for pc->ee"}; From bf129cca0f01f2c213880b603942d285cdcc95b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Sun, 21 Sep 2025 19:09:16 +0200 Subject: [PATCH 477/986] [PWGLF] Fix histogram filling (#13065) --- PWGLF/Tasks/Strangeness/strangenessInJets.cxx | 147 +++++++++++++----- 1 file changed, 108 insertions(+), 39 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/strangenessInJets.cxx b/PWGLF/Tasks/Strangeness/strangenessInJets.cxx index ee6d3846a39..9402ce67b7f 100644 --- a/PWGLF/Tasks/Strangeness/strangenessInJets.cxx +++ b/PWGLF/Tasks/Strangeness/strangenessInJets.cxx @@ -69,7 +69,6 @@ using namespace o2::soa; using namespace o2::aod; using namespace o2::framework; using namespace o2::framework::expressions; -using namespace o2::constants::physics; using namespace o2::constants::math; using std::array; @@ -591,10 +590,10 @@ struct StrangenessInJets { // Require that V0 is compatible with Lambda ROOT::Math::PxPyPzMVector pProton; ROOT::Math::PxPyPzMVector pPion; - pProton.SetCoordinates(ntrack.px(), ntrack.py(), ntrack.pz(), MassProton); - pPion.SetCoordinates(ptrack.px(), ptrack.py(), ptrack.pz(), MassPionCharged); + pProton.SetCoordinates(ntrack.px(), ntrack.py(), ntrack.pz(), o2::constants::physics::MassProton); + pPion.SetCoordinates(ptrack.px(), ptrack.py(), ptrack.pz(), o2::constants::physics::MassPionCharged); double mLambda = (pProton + pPion).M(); - if (std::fabs(mLambda - MassLambda0) > deltaMassLambda) + if (std::fabs(mLambda - o2::constants::physics::MassLambda0) > deltaMassLambda) return false; } @@ -622,10 +621,10 @@ struct StrangenessInJets { // Require that V0 is compatible with Lambda ROOT::Math::PxPyPzMVector pProton; ROOT::Math::PxPyPzMVector pPion; - pProton.SetCoordinates(ptrack.px(), ptrack.py(), ptrack.pz(), MassProton); - pPion.SetCoordinates(ntrack.px(), ntrack.py(), ntrack.pz(), MassPionCharged); - double mLambda = (pProton + pPion).M(); - if (std::fabs(mLambda - MassLambda0) > deltaMassLambda) + pProton.SetCoordinates(ptrack.px(), ptrack.py(), ptrack.pz(), o2::constants::physics::MassProton); + pPion.SetCoordinates(ntrack.px(), ntrack.py(), ntrack.pz(), o2::constants::physics::MassPionCharged); + const double mLambda = (pProton + pPion).M(); + if (std::fabs(mLambda - o2::constants::physics::MassLambda0) > deltaMassLambda) return false; } @@ -664,7 +663,7 @@ struct StrangenessInJets { } // Reject candidates compatible with Omega - if (std::fabs(casc.mOmega() - MassOmegaMinus) < deltaMassOmega) + if (std::fabs(casc.mOmega() - o2::constants::physics::MassOmegaMinus) < deltaMassOmega) return false; return true; } @@ -705,10 +704,10 @@ struct StrangenessInJets { // Require that V0 is compatible with Lambda ROOT::Math::PxPyPzMVector pProton; ROOT::Math::PxPyPzMVector pPion; - pProton.SetCoordinates(ntrack.px(), ntrack.py(), ntrack.pz(), MassProton); - pPion.SetCoordinates(ptrack.px(), ptrack.py(), ptrack.pz(), MassPionCharged); + pProton.SetCoordinates(ntrack.px(), ntrack.py(), ntrack.pz(), o2::constants::physics::MassProton); + pPion.SetCoordinates(ptrack.px(), ptrack.py(), ptrack.pz(), o2::constants::physics::MassPionCharged); double mLambda = (pProton + pPion).M(); - if (std::fabs(mLambda - MassLambda0) > deltaMassLambda) + if (std::fabs(mLambda - o2::constants::physics::MassLambda0) > deltaMassLambda) return false; } @@ -736,10 +735,10 @@ struct StrangenessInJets { // Require that V0 is compatible with Lambda ROOT::Math::PxPyPzMVector pProton; ROOT::Math::PxPyPzMVector pPion; - pProton.SetCoordinates(ptrack.px(), ptrack.py(), ptrack.pz(), MassProton); - pPion.SetCoordinates(ntrack.px(), ntrack.py(), ntrack.pz(), MassPionCharged); + pProton.SetCoordinates(ptrack.px(), ptrack.py(), ptrack.pz(), o2::constants::physics::MassProton); + pPion.SetCoordinates(ntrack.px(), ntrack.py(), ntrack.pz(), o2::constants::physics::MassPionCharged); double mLambda = (pProton + pPion).M(); - if (std::fabs(mLambda - MassLambda0) > deltaMassLambda) + if (std::fabs(mLambda - o2::constants::physics::MassLambda0) > deltaMassLambda) return false; } @@ -778,7 +777,7 @@ struct StrangenessInJets { } // Reject candidates compatible with Xi - if (std::fabs(casc.mXi() - MassXiMinus) < deltaMassXi) + if (std::fabs(casc.mXi() - o2::constants::physics::MassXiMinus) < deltaMassXi) return false; return true; } @@ -842,7 +841,7 @@ struct StrangenessInJets { continue; // 4-momentum representation of a particle - fastjet::PseudoJet fourMomentum(track.px(), track.py(), track.pz(), track.energy(MassPionCharged)); + fastjet::PseudoJet fourMomentum(track.px(), track.py(), track.pz(), track.energy(o2::constants::physics::MassPionCharged)); fjParticles.emplace_back(fourMomentum); } @@ -1103,7 +1102,8 @@ struct StrangenessInJets { continue; // Build 4-momentum assuming charged pion mass - double energy = std::sqrt(particle.p() * particle.p() + MassPionCharged * MassPionCharged); + static constexpr float kMassPionChargedSquared = o2::constants::physics::MassPionCharged * o2::constants::physics::MassPionCharged; + const double energy = std::sqrt(particle.p() * particle.p() + kMassPionChargedSquared); fastjet::PseudoJet fourMomentum(particle.px(), particle.py(), particle.pz(), energy); fourMomentum.set_user_index(particle.pdgCode()); fjParticles.emplace_back(fourMomentum); @@ -1175,35 +1175,69 @@ struct StrangenessInJets { if (deltaRJet < coneRadius) { switch (pdg[index]) { case kK0Short: - registryMC.fill(HIST("K0s_generated_jet"), genMultiplicity, hadron.Pt()); + if (particleOfInterest == ParticleOfInterest::kV0Particles) { + registryMC.fill(HIST("K0s_generated_jet"), genMultiplicity, hadron.Pt()); + } break; case kLambda0: - registryMC.fill(HIST("Lambda_generated_jet"), genMultiplicity, hadron.Pt()); + if (particleOfInterest == ParticleOfInterest::kV0Particles) { + registryMC.fill(HIST("Lambda_generated_jet"), genMultiplicity, hadron.Pt()); + } break; case kLambda0Bar: - registryMC.fill(HIST("AntiLambda_generated_jet"), genMultiplicity, hadron.Pt()); + if (particleOfInterest == ParticleOfInterest::kV0Particles) { + registryMC.fill(HIST("AntiLambda_generated_jet"), genMultiplicity, hadron.Pt()); + } break; case kXiMinus: - registryMC.fill(HIST("XiNeg_generated_jet"), genMultiplicity, hadron.Pt()); + if (particleOfInterest == ParticleOfInterest::kCascades) { + registryMC.fill(HIST("XiNeg_generated_jet"), genMultiplicity, hadron.Pt()); + } break; case kXiPlusBar: - registryMC.fill(HIST("XiPos_generated_jet"), genMultiplicity, hadron.Pt()); + if (particleOfInterest == ParticleOfInterest::kCascades) { + registryMC.fill(HIST("XiPos_generated_jet"), genMultiplicity, hadron.Pt()); + } break; case kOmegaMinus: - registryMC.fill(HIST("OmegaNeg_generated_jet"), genMultiplicity, hadron.Pt()); + if (particleOfInterest == ParticleOfInterest::kCascades) { + registryMC.fill(HIST("OmegaNeg_generated_jet"), genMultiplicity, hadron.Pt()); + } break; case kOmegaPlusBar: - registryMC.fill(HIST("OmegaPos_generated_jet"), genMultiplicity, hadron.Pt()); + if (particleOfInterest == ParticleOfInterest::kCascades) { + registryMC.fill(HIST("OmegaPos_generated_jet"), genMultiplicity, hadron.Pt()); + } break; case kPiPlus: + if (particleOfInterest == ParticleOfInterest::kPions) { + registryMC.fill(HIST("ll_generated_in_jet"), genMultiplicity, hadron.Pt()); + } + break; case kKPlus: - case ParticleOfInterest::kProtons: - registryMC.fill(HIST("ll_generated_in_jet"), genMultiplicity, hadron.Pt()); + if (particleOfInterest == ParticleOfInterest::kKaons) { + registryMC.fill(HIST("ll_generated_in_jet"), genMultiplicity, hadron.Pt()); + } + break; + case kProton: + if (particleOfInterest == ParticleOfInterest::kProtons) { + registryMC.fill(HIST("ll_generated_in_jet"), genMultiplicity, hadron.Pt()); + } break; case kPiMinus: + if (particleOfInterest == ParticleOfInterest::kPions) { + registryMC.fill(HIST("ll_generated_in_jet"), genMultiplicity, hadron.Pt() * -1.f); + } + break; case kKMinus: + if (particleOfInterest == ParticleOfInterest::kKaons) { + registryMC.fill(HIST("ll_generated_in_jet"), genMultiplicity, hadron.Pt() * -1.f); + } + break; case kProtonBar: - registryMC.fill(HIST("ll_generated_in_jet"), genMultiplicity, hadron.Pt() * -1.f); + if (particleOfInterest == ParticleOfInterest::kProtons) { + registryMC.fill(HIST("ll_generated_in_jet"), genMultiplicity, hadron.Pt() * -1.f); + } break; default: break; @@ -1214,35 +1248,70 @@ struct StrangenessInJets { if (deltaRUe1 < coneRadius || deltaRUe2 < coneRadius) { switch (pdg[index]) { case kK0Short: - registryMC.fill(HIST("K0s_generated_ue"), genMultiplicity, hadron.Pt()); + if (particleOfInterest == ParticleOfInterest::kV0Particles) { + registryMC.fill(HIST("K0s_generated_ue"), genMultiplicity, hadron.Pt()); + } break; case kLambda0: - registryMC.fill(HIST("Lambda_generated_ue"), genMultiplicity, hadron.Pt()); + if (particleOfInterest == ParticleOfInterest::kV0Particles) { + registryMC.fill(HIST("Lambda_generated_ue"), genMultiplicity, hadron.Pt()); + } break; case kLambda0Bar: - registryMC.fill(HIST("AntiLambda_generated_ue"), genMultiplicity, hadron.Pt()); + if (particleOfInterest == ParticleOfInterest::kV0Particles) { + registryMC.fill(HIST("AntiLambda_generated_ue"), genMultiplicity, hadron.Pt()); + } break; case kXiMinus: - registryMC.fill(HIST("XiNeg_generated_ue"), genMultiplicity, hadron.Pt()); + if (particleOfInterest == ParticleOfInterest::kCascades) { + registryMC.fill(HIST("XiNeg_generated_ue"), genMultiplicity, hadron.Pt()); + } break; case kXiPlusBar: - registryMC.fill(HIST("XiPos_generated_ue"), genMultiplicity, hadron.Pt()); + if (particleOfInterest == ParticleOfInterest::kCascades) { + registryMC.fill(HIST("XiPos_generated_ue"), genMultiplicity, hadron.Pt()); + } break; case kOmegaMinus: - registryMC.fill(HIST("OmegaNeg_generated_ue"), genMultiplicity, hadron.Pt()); + if (particleOfInterest == ParticleOfInterest::kCascades) { + registryMC.fill(HIST("OmegaNeg_generated_ue"), genMultiplicity, hadron.Pt()); + } break; case kOmegaPlusBar: - registryMC.fill(HIST("OmegaPos_generated_ue"), genMultiplicity, hadron.Pt()); + if (particleOfInterest == ParticleOfInterest::kCascades) { + registryMC.fill(HIST("OmegaPos_generated_ue"), genMultiplicity, hadron.Pt()); + } break; case kPiPlus: + if (particleOfInterest == ParticleOfInterest::kPions) { + registryMC.fill(HIST("ll_generated_in_ue"), genMultiplicity, hadron.Pt()); + } + break; case kKPlus: - case ParticleOfInterest::kProtons: - registryMC.fill(HIST("ll_generated_in_ue"), genMultiplicity, hadron.Pt()); + if (particleOfInterest == ParticleOfInterest::kKaons) { + registryMC.fill(HIST("ll_generated_in_ue"), genMultiplicity, hadron.Pt()); + } + break; + case kProton: + if (particleOfInterest == ParticleOfInterest::kProtons) { + registryMC.fill(HIST("ll_generated_in_ue"), genMultiplicity, hadron.Pt()); + } break; case kPiMinus: + if (particleOfInterest == ParticleOfInterest::kPions) { + registryMC.fill(HIST("ll_generated_in_ue"), genMultiplicity, hadron.Pt() * -1.f); + } + break; case kKMinus: + if (particleOfInterest == ParticleOfInterest::kKaons) { + registryMC.fill(HIST("ll_generated_in_ue"), genMultiplicity, hadron.Pt() * -1.f); + } + break; case kProtonBar: - registryMC.fill(HIST("ll_generated_in_ue"), genMultiplicity, hadron.Pt() * -1.f); + if (particleOfInterest == ParticleOfInterest::kProtons) { + registryMC.fill(HIST("ll_generated_in_ue"), genMultiplicity, hadron.Pt() * -1.f); + } + break; default: break; } @@ -1288,7 +1357,7 @@ struct StrangenessInJets { continue; // 4-momentum representation of a particle - fastjet::PseudoJet fourMomentum(track.px(), track.py(), track.pz(), track.energy(MassPionCharged)); + fastjet::PseudoJet fourMomentum(track.px(), track.py(), track.pz(), track.energy(o2::constants::physics::MassPionCharged)); fjParticles.emplace_back(fourMomentum); } From cf6012c76ffe36f2c8fb33cf5a7e1f1addfe4e9c Mon Sep 17 00:00:00 2001 From: Francesca Ercolessi Date: Sun, 21 Sep 2025 19:24:35 +0200 Subject: [PATCH 478/986] [PWGLF] V0 analysis pp: add armenteros cut (#13068) --- PWGLF/Tasks/Strangeness/v0postprocessing.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/v0postprocessing.cxx b/PWGLF/Tasks/Strangeness/v0postprocessing.cxx index 946cef56144..20acbb82f8b 100644 --- a/PWGLF/Tasks/Strangeness/v0postprocessing.cxx +++ b/PWGLF/Tasks/Strangeness/v0postprocessing.cxx @@ -54,7 +54,8 @@ struct v0postprocessing { Configurable hasTOF2Leg{"hasTOF2Leg", 0, "hasTOF2Leg"}; Configurable hasTOF1Leg{"hasTOF1Leg", 0, "hasTOF1Leg"}; Configurable paramArmenterosCut{"paramArmenterosCut", 0.2, "parameter Armenteros Cut"}; - Configurable doArmenterosCut{"doArmenterosCut", 1, "do Armenteros Cut"}; + Configurable doArmenterosCut{"doArmenterosCut", 1, "do Armenteros Cut for K0s"}; + Configurable doArmenterosCutLam{"doArmenterosCutLam", 1, "do Armenteros Cut for Lam"}; Configurable doQA{"doQA", 1, "fill QA histograms"}; HistogramRegistry registry{"registry"}; @@ -404,7 +405,7 @@ struct v0postprocessing { std::abs(candidate.masslambda() - o2::constants::physics::MassLambda0) > v0rejK0s && std::abs(candidate.ntpcsigmanegpi()) <= ntpcsigma && std::abs(candidate.ntpcsigmapospi()) <= ntpcsigma && - (doArmenterosCut && candidate.qtarm() > (paramArmenterosCut * std::abs(candidate.alpha())))) { + (!doArmenterosCut || candidate.qtarm() > (paramArmenterosCut * std::abs(candidate.alpha())))) { registry.fill(HIST("hMassK0Short"), candidate.massk0short()); registry.fill(HIST("hMassVsPtK0Short"), candidate.v0pt(), candidate.massk0short()); @@ -444,7 +445,8 @@ struct v0postprocessing { if (std::abs(candidate.ntpcsigmanegpi()) <= ntpcsigma && std::abs(candidate.ntpcsigmapospr()) <= ntpcsigma && candidate.ctaulambda() < ctauLambda && - std::abs(candidate.masslambda() - o2::constants::physics::MassLambda0) < 0.075) { + std::abs(candidate.masslambda() - o2::constants::physics::MassLambda0) < 0.075 && + (!doArmenterosCutLam || candidate.qtarm() < (paramArmenterosCut * std::abs(candidate.alpha())))) { registry.fill(HIST("hMassLambda"), candidate.masslambda()); registry.fill(HIST("hMassVsPtLambda"), candidate.v0pt(), candidate.masslambda()); @@ -482,7 +484,8 @@ struct v0postprocessing { if (std::abs(candidate.ntpcsigmanegpr()) <= ntpcsigma && std::abs(candidate.ntpcsigmapospi()) <= ntpcsigma && candidate.ctauantilambda() < ctauLambda && - std::abs(candidate.massantilambda() - o2::constants::physics::MassLambda0) < 0.075) { + std::abs(candidate.massantilambda() - o2::constants::physics::MassLambda0) < 0.075 && + (!doArmenterosCutLam || candidate.qtarm() < (paramArmenterosCut * std::abs(candidate.alpha())))) { registry.fill(HIST("hMassAntiLambda"), candidate.massantilambda()); registry.fill(HIST("hMassVsPtAntiLambda"), candidate.v0pt(), candidate.massantilambda()); From 0d8691e11060865d1e667021edc56e6236915ddc Mon Sep 17 00:00:00 2001 From: JStaa <39123272+JStaa@users.noreply.github.com> Date: Sun, 21 Sep 2025 20:30:47 +0200 Subject: [PATCH 479/986] [PWGCF] Applied a correction factor to the spectra of charged tracks (#13069) Co-authored-by: ALICE Action Bot --- .../Tasks/threeParticleCorrelations.cxx | 88 +++++++++++++------ 1 file changed, 61 insertions(+), 27 deletions(-) diff --git a/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx b/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx index b4cdb1f8531..1d48979d432 100644 --- a/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx +++ b/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx @@ -133,6 +133,7 @@ struct ThreeParticleCorrelations { // Process configurables Configurable confBfieldSwitch{"confBfieldSwitch", 0, "Switch for the detector magnetic field (1 if Pos, -1 if Neg, 0 if both)"}; + Configurable confRatioCorrectionSwitch{"confRatioCorrectionSwitch", false, "Switch for correcting the negative spectra back to the positive spectra"}; Configurable confFakeV0Switch{"confFakeV0Switch", false, "Switch for the fakeV0Filter function"}; Configurable confRDSwitch{"confRDSwitch", true, "Switch for the radialDistanceFilter function"}; @@ -142,6 +143,11 @@ struct ThreeParticleCorrelations { TH3D** hEffProtons = new TH3D*[2]; TH3D** hEffLambdas = new TH3D*[2]; + // Spectra correction histograms + TH2D** hCorrectionPions = new TH2D*[2]; + TH2D** hCorrectionKaons = new TH2D*[2]; + TH2D** hCorrectionProtons = new TH2D*[2]; + // Correlation variables int triggSign, assocSign; double v0Efficiency; @@ -323,6 +329,14 @@ struct ThreeParticleCorrelations { hEffProtons[1] = static_cast(effListChargedParticles->FindObject("hEfficiencyProtonN")); hEffLambdas[0] = static_cast(effListLambdas->FindObject("hEfficiencyLambdaP")); hEffLambdas[1] = static_cast(effListLambdas->FindObject("hEfficiencyLambdaN")); + + TList* correctionListChargedParticles = ccdb->getForTimeStamp("Users/j/jstaa/SpectraRatios/ChargedParticles", 1); + hCorrectionPions[0] = static_cast(correctionListChargedParticles->FindObject("h2DRatioPionP")); + hCorrectionPions[1] = static_cast(correctionListChargedParticles->FindObject("h2DRatioPionN")); + hCorrectionKaons[0] = static_cast(correctionListChargedParticles->FindObject("h2DRatioKaonP")); + hCorrectionKaons[1] = static_cast(correctionListChargedParticles->FindObject("h2DRatioKaonN")); + hCorrectionProtons[0] = static_cast(correctionListChargedParticles->FindObject("h2DRatioProtonP")); + hCorrectionProtons[1] = static_cast(correctionListChargedParticles->FindObject("h2DRatioProtonN")); } //========================================================================================================================================================================================================================================================================== @@ -367,17 +381,17 @@ struct ThreeParticleCorrelations { rQARegistry.fill(HIST("hBeta"), track.sign() * track.pt(), track.beta()); if (assocPID[0] == pionID) { // Pions rQARegistry.fill(HIST("hPtPion_Uncorrected"), track.pt(), collision.centFT0C(), track.sign()); - rQARegistry.fill(HIST("hPtPion_Corrected"), track.pt(), collision.centFT0C(), track.sign(), 1. / trackEff(hEffPions, track, collision.centFT0C())); + rQARegistry.fill(HIST("hPtPion_Corrected"), track.pt(), collision.centFT0C(), track.sign(), ratioCorrection(hCorrectionPions, track, collision.centFT0C()) / trackEff(hEffPions, track, collision.centFT0C())); rQARegistry.fill(HIST("hdEdxPion"), track.sign() * track.pt(), track.tpcSignal()); rQARegistry.fill(HIST("hBetaPion"), track.sign() * track.pt(), track.beta()); } else if (assocPID[0] == kaonID) { // Kaons rQARegistry.fill(HIST("hPtKaon_Uncorrected"), track.pt(), collision.centFT0C(), track.sign()); - rQARegistry.fill(HIST("hPtKaon_Corrected"), track.pt(), collision.centFT0C(), track.sign(), 1. / trackEff(hEffKaons, track, collision.centFT0C())); + rQARegistry.fill(HIST("hPtKaon_Corrected"), track.pt(), collision.centFT0C(), track.sign(), ratioCorrection(hCorrectionKaons, track, collision.centFT0C()) / trackEff(hEffKaons, track, collision.centFT0C())); rQARegistry.fill(HIST("hdEdxKaon"), track.sign() * track.pt(), track.tpcSignal()); rQARegistry.fill(HIST("hBetaKaon"), track.sign() * track.pt(), track.beta()); } else if (assocPID[0] == protonID) { // Protons rQARegistry.fill(HIST("hPtProton_Uncorrected"), track.pt(), collision.centFT0C(), track.sign()); - rQARegistry.fill(HIST("hPtProton_Corrected"), track.pt(), collision.centFT0C(), track.sign(), 1. / trackEff(hEffProtons, track, collision.centFT0C())); + rQARegistry.fill(HIST("hPtProton_Corrected"), track.pt(), collision.centFT0C(), track.sign(), ratioCorrection(hCorrectionProtons, track, collision.centFT0C()) / trackEff(hEffProtons, track, collision.centFT0C())); rQARegistry.fill(HIST("hdEdxProton"), track.sign() * track.pt(), track.tpcSignal()); rQARegistry.fill(HIST("hBetaProton"), track.sign() * track.pt(), track.beta()); } @@ -412,36 +426,36 @@ struct ThreeParticleCorrelations { if (candMass >= MassLambda0 - 4 * dGaussSigma && candMass <= MassLambda0 + 4 * dGaussSigma) { if (assocPID[0] == pionID) { // Pions - rSECorrRegistry.fill(HIST("hSameLambdaPion_SGNL"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), 1. / (trackEff(hEffPions, associate, collision.centFT0C()) * v0Efficiency)); + rSECorrRegistry.fill(HIST("hSameLambdaPion_SGNL"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionPions, associate, collision.centFT0C()) / (trackEff(hEffPions, associate, collision.centFT0C()) * v0Efficiency)); } else if (assocPID[0] == kaonID) { // Kaons - rSECorrRegistry.fill(HIST("hSameLambdaKaon_SGNL"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), 1. / (trackEff(hEffKaons, associate, collision.centFT0C()) * v0Efficiency)); + rSECorrRegistry.fill(HIST("hSameLambdaKaon_SGNL"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionKaons, associate, collision.centFT0C()) / (trackEff(hEffKaons, associate, collision.centFT0C()) * v0Efficiency)); } else if (assocPID[0] == protonID) { // Protons - rSECorrRegistry.fill(HIST("hSameLambdaProton_SGNL"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), 1. / (trackEff(hEffProtons, associate, collision.centFT0C()) * v0Efficiency)); + rSECorrRegistry.fill(HIST("hSameLambdaProton_SGNL"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionProtons, associate, collision.centFT0C()) / (trackEff(hEffProtons, associate, collision.centFT0C()) * v0Efficiency)); } } else if (candMass >= MassLambda0 - 8 * dGaussSigma && candMass <= MassLambda0 + 8 * dGaussSigma) { if (assocPID[0] == pionID) { // Pions - rSECorrRegistry.fill(HIST("hSameLambdaPion_SB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), 1. / (trackEff(hEffPions, associate, collision.centFT0C()) * v0Efficiency)); + rSECorrRegistry.fill(HIST("hSameLambdaPion_SB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionPions, associate, collision.centFT0C()) / (trackEff(hEffPions, associate, collision.centFT0C()) * v0Efficiency)); if (candMass >= MassLambda0 - 8 * dGaussSigma && candMass < MassLambda0 - 4 * dGaussSigma) { - rSECorrRegistry.fill(HIST("hSameLambdaPion_leftSB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), 1. / (trackEff(hEffPions, associate, collision.centFT0C()) * v0Efficiency)); + rSECorrRegistry.fill(HIST("hSameLambdaPion_leftSB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionPions, associate, collision.centFT0C()) / (trackEff(hEffPions, associate, collision.centFT0C()) * v0Efficiency)); } else if (candMass > MassLambda0 + 4 * dGaussSigma && candMass <= MassLambda0 + 8 * dGaussSigma) { - rSECorrRegistry.fill(HIST("hSameLambdaPion_rightSB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), 1. / (trackEff(hEffPions, associate, collision.centFT0C()) * v0Efficiency)); + rSECorrRegistry.fill(HIST("hSameLambdaPion_rightSB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionPions, associate, collision.centFT0C()) / (trackEff(hEffPions, associate, collision.centFT0C()) * v0Efficiency)); } } else if (assocPID[0] == kaonID) { // Kaons - rSECorrRegistry.fill(HIST("hSameLambdaKaon_SB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), 1. / (trackEff(hEffKaons, associate, collision.centFT0C()) * v0Efficiency)); + rSECorrRegistry.fill(HIST("hSameLambdaKaon_SB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionKaons, associate, collision.centFT0C()) / (trackEff(hEffKaons, associate, collision.centFT0C()) * v0Efficiency)); if (candMass >= MassLambda0 - 8 * dGaussSigma && candMass < MassLambda0 - 4 * dGaussSigma) { - rSECorrRegistry.fill(HIST("hSameLambdaKaon_leftSB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), 1. / (trackEff(hEffKaons, associate, collision.centFT0C()) * v0Efficiency)); + rSECorrRegistry.fill(HIST("hSameLambdaKaon_leftSB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionKaons, associate, collision.centFT0C()) / (trackEff(hEffKaons, associate, collision.centFT0C()) * v0Efficiency)); } else if (candMass > MassLambda0 + 4 * dGaussSigma && candMass <= MassLambda0 + 8 * dGaussSigma) { - rSECorrRegistry.fill(HIST("hSameLambdaKaon_rightSB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), 1. / (trackEff(hEffKaons, associate, collision.centFT0C()) * v0Efficiency)); + rSECorrRegistry.fill(HIST("hSameLambdaKaon_rightSB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionKaons, associate, collision.centFT0C()) / (trackEff(hEffKaons, associate, collision.centFT0C()) * v0Efficiency)); } } else if (assocPID[0] == protonID) { // Protons - rSECorrRegistry.fill(HIST("hSameLambdaProton_SB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), 1. / (trackEff(hEffProtons, associate, collision.centFT0C()) * v0Efficiency)); + rSECorrRegistry.fill(HIST("hSameLambdaProton_SB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionProtons, associate, collision.centFT0C()) / (trackEff(hEffProtons, associate, collision.centFT0C()) * v0Efficiency)); if (candMass >= MassLambda0 - 8 * dGaussSigma && candMass < MassLambda0 - 4 * dGaussSigma) { - rSECorrRegistry.fill(HIST("hSameLambdaProton_leftSB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), 1. / (trackEff(hEffProtons, associate, collision.centFT0C()) * v0Efficiency)); + rSECorrRegistry.fill(HIST("hSameLambdaProton_leftSB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionProtons, associate, collision.centFT0C()) / (trackEff(hEffProtons, associate, collision.centFT0C()) * v0Efficiency)); } else if (candMass > MassLambda0 + 4 * dGaussSigma && candMass <= MassLambda0 + 8 * dGaussSigma) { - rSECorrRegistry.fill(HIST("hSameLambdaProton_rightSB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), 1. / (trackEff(hEffProtons, associate, collision.centFT0C()) * v0Efficiency)); + rSECorrRegistry.fill(HIST("hSameLambdaProton_rightSB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionProtons, associate, collision.centFT0C()) / (trackEff(hEffProtons, associate, collision.centFT0C()) * v0Efficiency)); } } } @@ -489,36 +503,36 @@ struct ThreeParticleCorrelations { if (candMass >= MassLambda0 - 4 * dGaussSigma && candMass <= MassLambda0 + 4 * dGaussSigma) { if (assocPID[0] == pionID) { // Pions - rMECorrRegistry.fill(HIST("hMixLambdaPion_SGNL"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), 1. / (trackEff(hEffPions, associate, coll_1.centFT0C()) * v0Efficiency)); + rMECorrRegistry.fill(HIST("hMixLambdaPion_SGNL"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionPions, associate, coll_1.centFT0C()) / (trackEff(hEffPions, associate, coll_1.centFT0C()) * v0Efficiency)); } else if (assocPID[0] == kaonID) { // Kaons - rMECorrRegistry.fill(HIST("hMixLambdaKaon_SGNL"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), 1. / (trackEff(hEffKaons, associate, coll_1.centFT0C()) * v0Efficiency)); + rMECorrRegistry.fill(HIST("hMixLambdaKaon_SGNL"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionKaons, associate, coll_1.centFT0C()) / (trackEff(hEffKaons, associate, coll_1.centFT0C()) * v0Efficiency)); } else if (assocPID[0] == protonID) { // Protons - rMECorrRegistry.fill(HIST("hMixLambdaProton_SGNL"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), 1. / (trackEff(hEffProtons, associate, coll_1.centFT0C()) * v0Efficiency)); + rMECorrRegistry.fill(HIST("hMixLambdaProton_SGNL"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionProtons, associate, coll_1.centFT0C()) / (trackEff(hEffProtons, associate, coll_1.centFT0C()) * v0Efficiency)); } } else if (candMass >= MassLambda0 - 8 * dGaussSigma && candMass <= MassLambda0 + 8 * dGaussSigma) { if (assocPID[0] == pionID) { // Pions - rMECorrRegistry.fill(HIST("hMixLambdaPion_SB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), 1. / (trackEff(hEffPions, associate, coll_1.centFT0C()) * v0Efficiency)); + rMECorrRegistry.fill(HIST("hMixLambdaPion_SB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionPions, associate, coll_1.centFT0C()) / (trackEff(hEffPions, associate, coll_1.centFT0C()) * v0Efficiency)); if (candMass >= MassLambda0 - 8 * dGaussSigma && candMass < MassLambda0 - 4 * dGaussSigma) { - rMECorrRegistry.fill(HIST("hMixLambdaPion_leftSB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), 1. / (trackEff(hEffPions, associate, coll_1.centFT0C()) * v0Efficiency)); + rMECorrRegistry.fill(HIST("hMixLambdaPion_leftSB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionPions, associate, coll_1.centFT0C()) / (trackEff(hEffPions, associate, coll_1.centFT0C()) * v0Efficiency)); } else if (candMass > MassLambda0 + 4 * dGaussSigma && candMass <= MassLambda0 + 8 * dGaussSigma) { - rMECorrRegistry.fill(HIST("hMixLambdaPion_rightSB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), 1. / (trackEff(hEffPions, associate, coll_1.centFT0C()) * v0Efficiency)); + rMECorrRegistry.fill(HIST("hMixLambdaPion_rightSB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionPions, associate, coll_1.centFT0C()) / (trackEff(hEffPions, associate, coll_1.centFT0C()) * v0Efficiency)); } } else if (assocPID[0] == kaonID) { // Kaons - rMECorrRegistry.fill(HIST("hMixLambdaKaon_SB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), 1. / (trackEff(hEffKaons, associate, coll_1.centFT0C()) * v0Efficiency)); + rMECorrRegistry.fill(HIST("hMixLambdaKaon_SB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionKaons, associate, coll_1.centFT0C()) / (trackEff(hEffKaons, associate, coll_1.centFT0C()) * v0Efficiency)); if (candMass >= MassLambda0 - 8 * dGaussSigma && candMass < MassLambda0 - 4 * dGaussSigma) { - rMECorrRegistry.fill(HIST("hMixLambdaKaon_leftSB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), 1. / (trackEff(hEffKaons, associate, coll_1.centFT0C()) * v0Efficiency)); + rMECorrRegistry.fill(HIST("hMixLambdaKaon_leftSB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionKaons, associate, coll_1.centFT0C()) / (trackEff(hEffKaons, associate, coll_1.centFT0C()) * v0Efficiency)); } else if (candMass > MassLambda0 + 4 * dGaussSigma && candMass <= MassLambda0 + 8 * dGaussSigma) { - rMECorrRegistry.fill(HIST("hMixLambdaKaon_rightSB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), 1. / (trackEff(hEffKaons, associate, coll_1.centFT0C()) * v0Efficiency)); + rMECorrRegistry.fill(HIST("hMixLambdaKaon_rightSB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionKaons, associate, coll_1.centFT0C()) / (trackEff(hEffKaons, associate, coll_1.centFT0C()) * v0Efficiency)); } } else if (assocPID[0] == protonID) { // Protons - rMECorrRegistry.fill(HIST("hMixLambdaProton_SB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), 1. / (trackEff(hEffProtons, associate, coll_1.centFT0C()) * v0Efficiency)); + rMECorrRegistry.fill(HIST("hMixLambdaProton_SB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionProtons, associate, coll_1.centFT0C()) / (trackEff(hEffProtons, associate, coll_1.centFT0C()) * v0Efficiency)); if (candMass >= MassLambda0 - 8 * dGaussSigma && candMass < MassLambda0 - 4 * dGaussSigma) { - rMECorrRegistry.fill(HIST("hMixLambdaProton_leftSB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), 1. / (trackEff(hEffProtons, associate, coll_1.centFT0C()) * v0Efficiency)); + rMECorrRegistry.fill(HIST("hMixLambdaProton_leftSB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionProtons, associate, coll_1.centFT0C()) / (trackEff(hEffProtons, associate, coll_1.centFT0C()) * v0Efficiency)); } else if (candMass > MassLambda0 + 4 * dGaussSigma && candMass <= MassLambda0 + 8 * dGaussSigma) { - rMECorrRegistry.fill(HIST("hMixLambdaProton_rightSB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), 1. / (trackEff(hEffProtons, associate, coll_1.centFT0C()) * v0Efficiency)); + rMECorrRegistry.fill(HIST("hMixLambdaProton_rightSB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionProtons, associate, coll_1.centFT0C()) / (trackEff(hEffProtons, associate, coll_1.centFT0C()) * v0Efficiency)); } } } @@ -881,6 +895,26 @@ struct ThreeParticleCorrelations { } } + template + double ratioCorrection(TH2D** ratios, const TrackCand& track, double centrality) + { + + double ratioCorrection = 1.0; + if (confRatioCorrectionSwitch) { + + int index = -999; + if (track.sign() > 0) { + index = 0; + } else if (track.sign() < 0) { + index = 1; + } + + ratioCorrection = ratios[index]->GetBinContent(ratios[index]->FindBin(track.pt(), centrality)); + } + + return ratioCorrection; + } + template int v0Sign(const V0Cand& v0) { From c8e9ec53b032d8be579483476568c05a9ef571d5 Mon Sep 17 00:00:00 2001 From: Subhadeep Mandal <147193283+5ub-Man@users.noreply.github.com> Date: Mon, 22 Sep 2025 00:19:44 +0530 Subject: [PATCH 480/986] [PWGUD] Added some QA plots and optimised code (#13044) --- PWGUD/Tasks/sginclusivePhiKstarSD.cxx | 897 ++++++++++++++++---------- 1 file changed, 543 insertions(+), 354 deletions(-) diff --git a/PWGUD/Tasks/sginclusivePhiKstarSD.cxx b/PWGUD/Tasks/sginclusivePhiKstarSD.cxx index 4e139f0b763..5b122b713da 100644 --- a/PWGUD/Tasks/sginclusivePhiKstarSD.cxx +++ b/PWGUD/Tasks/sginclusivePhiKstarSD.cxx @@ -14,29 +14,31 @@ /// \author Sandeep Dudi, sandeep.dudi3@gmail.com /// \since May 2024 -#include -#include -#include -#include -#include "Math/Vector4D.h" -#include "Math/Vector3D.h" -#include "Math/GenVector/Boost.h" -#include "TPDGCode.h" +#include "PWGUD/Core/SGSelector.h" +#include "PWGUD/Core/SGTrackSelector.h" +#include "PWGUD/Core/UPCHelpers.h" +#include "PWGUD/DataModel/UDTables.h" + +#include "Common/DataModel/PIDResponse.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" #include "Framework/ASoA.h" #include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" #include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/Vertex.h" -#include "PWGUD/DataModel/UDTables.h" -#include "PWGUD/Core/SGSelector.h" -#include "PWGUD/Core/SGTrackSelector.h" -#include "PWGUD/Core/UPCHelpers.h" +#include "Math/GenVector/Boost.h" +#include "Math/Vector3D.h" +#include "Math/Vector4D.h" +#include "TPDGCode.h" +#include +#include -#include "Common/DataModel/PIDResponse.h" +#include +#include +#include using namespace std; using namespace o2; @@ -45,11 +47,17 @@ using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::constants::physics; +// GapSide enum +using o2::aod::sgselector::DoubleGap; +using o2::aod::sgselector::SingleGapA; +using o2::aod::sgselector::SingleGapC; + struct SginclusivePhiKstarSD { SGSelector sgSelector; Service pdg; HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry rQA{"QA", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; Configurable cutRCTflag{"cutRCTflag", 0, {"0 = off, 1 = CBT, 2 = CBT+ZDC, 3 = CBThadron, 4 = CBThadron+ZDC"}}; Configurable fv0Cut{"fv0Cut", 50., "FV0A threshold"}; @@ -102,7 +110,8 @@ struct SginclusivePhiKstarSD { Configurable ccut{"ccut", true, "TPC + TOF PID"}; Configurable kaoncut{"kaoncut", true, " kaon slection cut for kstar "}; - Configurable qa{"qa", true, ""}; + Configurable qa{"qa", true, "QA plots for Data (turn qaMC to 0)"}; + Configurable qaMC{"qaMC", false, "QA plots for MC (turn qa for data to 0)"}; Configurable rapidityGap{"rapidityGap", true, ""}; Configurable exclusive{"exclusive", false, "for double gap side "}; @@ -122,24 +131,29 @@ struct SginclusivePhiKstarSD { Configurable reconstruction{"reconstruction", true, ""}; Configurable generatedId{"generatedId", 31, ""}; - // Configurable axes for histogram - ConfigurableAxis dcaAxisConfig{"dcaAxisConfig", {600, -0.3f, 0.3f}, "DCAxy & DCAz axis"}; - ConfigurableAxis etaAxisConfig{"etaAxisConfig", {400, -1.0f, 1.0f}, "Pseudorapidity & Rapidity axis"}; - ConfigurableAxis vrtxXAxisConfig{"vrtxXAxisConfig", {400, -0.1f, 0.1f}, "Vertex X axis"}; - ConfigurableAxis vrtxYAxisConfig{"vrtxYAxisConfig", {200, -0.05f, 0.05f}, "Vertex Y axis"}; - ConfigurableAxis vrtxZAxisConfig{"vrtxZAxisConfig", {600, -15.0f, 15.0f}, "Vertex Z axis"}; - // ConfigurableAxis VrtxZAxisConfig{"VrtxZAxisConfig", {600, -15.0f, 15.0f}, "Vertex Z axis"}; + int numTwoTracks = 2; + int numFourTracks = 4; void init(InitContext const& context) { - // Axes - AxisSpec dcaxyAxis = {dcaAxisConfig, "DCAxy (cm)"}; - AxisSpec dcazAxis = {dcaAxisConfig, "DCAz (cm)"}; - AxisSpec etaAxis = {etaAxisConfig, "#eta"}; - AxisSpec rapAxis = {etaAxisConfig, "y"}; - AxisSpec VrtxXAxis = {vrtxXAxisConfig, "Vertex X (cm)"}; - AxisSpec VrtxYAxis = {vrtxYAxisConfig, "Vertex Y (cm)"}; - AxisSpec VrtxZAxis = {vrtxZAxisConfig, "Vertex Z (cm)"}; + registry.add("hEventCutFlow", "No. of events after event cuts", kTH1F, {{20, 0, 20}}); + std::shared_ptr hCutFlow = registry.get(HIST("hEventCutFlow")); + hCutFlow->GetXaxis()->SetBinLabel(1, "All Events"); + hCutFlow->GetXaxis()->SetBinLabel(2, "Gapside (0 to 2)"); + hCutFlow->GetXaxis()->SetBinLabel(3, "|Vz| < cut"); + hCutFlow->GetXaxis()->SetBinLabel(4, "Occupancy"); + hCutFlow->GetXaxis()->SetBinLabel(5, "Hadronic Rate"); + hCutFlow->GetXaxis()->SetBinLabel(6, "kNoCollInTimeRangeStandard"); + hCutFlow->GetXaxis()->SetBinLabel(7, "kNoCollInRofStandard"); + hCutFlow->GetXaxis()->SetBinLabel(8, "kNoHighMultCollInPrevRof"); + hCutFlow->GetXaxis()->SetBinLabel(9, "kNoTimeFrameBorder"); + hCutFlow->GetXaxis()->SetBinLabel(10, "kNoITSROFrameBorder"); + hCutFlow->GetXaxis()->SetBinLabel(11, "kNoSameBunchPileup"); + hCutFlow->GetXaxis()->SetBinLabel(12, "kIsGoodZvtxFT0vsPV"); + hCutFlow->GetXaxis()->SetBinLabel(13, "kIsVertexITSTPC"); + hCutFlow->GetXaxis()->SetBinLabel(14, "RCTFlag"); + hCutFlow->GetXaxis()->SetBinLabel(15, "upcFlag"); + hCutFlow->GetXaxis()->SetBinLabel(16, "numContrib (min track < mult < max track)"); registry.add("GapSide", "Gap Side; Entries", kTH1F, {{4, -1.5, 2.5}}); registry.add("TrueGapSide", "Gap Side; Entries", kTH1F, {{4, -1.5, 2.5}}); @@ -191,66 +205,74 @@ struct SginclusivePhiKstarSD { } // qa plots if (qa) { - registry.add("tpc_dedx", "p vs dE/dx", kTH2F, {{500, 0.0, 10.0}, {5000, 0.0, 5000.0}}); - registry.add("tof_beta", "p vs beta", kTH2F, {{500, 0.0, 10.0}, {500, 0.0, 1.0}}); - - registry.add("tpc_dedx_kaon", "p#k dE/dx", kTH2F, {{500, 0.0, 10.0}, {5000, 0.0, 5000.0}}); - registry.add("tpc_dedx_pion", "p#pi dE/dx", kTH2F, {{500, 0.0, 10.0}, {5000, 0.0, 5000.0}}); - registry.add("tpc_dedx_kaon_1", "tpc+tof pid cut p#k dE/dx", kTH2F, {{500, 0.0, 10.0}, {5000, 0.0, 5000.0}}); - registry.add("tpc_dedx_kaon_2", "tpc+tof pid cut1 p#k dE/dx", kTH2F, {{500, 0.0, 10.0}, {5000, 0.0, 5000.0}}); - registry.add("tpc_dedx_pion_1", "tpc+tof pid cut p#pi dE/dx", kTH2F, {{500, 0.0, 10.0}, {5000, 0.0, 5000.0}}); - registry.add("tpc_nsigma_kaon", "p#k n#sigma", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); - registry.add("tpc_nsigma_pion", "p#pi n#sigma", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); - registry.add("tpc_tof_nsigma_kaon", "p#k n#sigma TPC vs TOF", kTH2F, {{100, -10.0, 10.0}, {100, -10.0, 10.0}}); - registry.add("tpc_tof_nsigma_pion", "p#pi n#sigma TPC vs TOF", kTH2F, {{100, -10.0, 10.0}, {100, -10.0, 10.0}}); - - registry.add("tof_nsigma_kaon", "p#k n#sigma", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); - registry.add("tof_nsigma_pion", "p#pi n#sigma", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); - registry.add("tof_nsigma_kaon_f", "p#k n#sigma", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); - registry.add("tof_nsigma_pion_f", "p#pi n#sigma", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); - registry.add("tpc_nsigma_kaon_f", "p#k n#sigma", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); - registry.add("tpc_nsigma_pion_f", "p#pi n#sigma", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); - - registry.add("FT0A", "T0A amplitude", kTH1F, {{500, 0.0, 500.0}}); - registry.add("FT0A_0", "T0A amplitude", kTH1F, {{500, 0.0, 500.0}}); - registry.add("FT0A_1", "T0A amplitude", kTH1F, {{20000, 0.0, 20000.0}}); - registry.add("FT0C", "T0C amplitude", kTH1F, {{500, 0.0, 500.0}}); - registry.add("FT0C_0", "T0C amplitude", kTH1F, {{20000, 0.0, 20000.0}}); - registry.add("FT0C_1", "T0C amplitude", kTH1F, {{500, 0.0, 500.0}}); - registry.add("ZDC_A", "ZDC amplitude", kTH1F, {{2000, 0.0, 1000.0}}); - registry.add("ZDC_A_0", "ZDC amplitude", kTH1F, {{2000, 0.0, 1000.0}}); - registry.add("ZDC_A_1", "ZDC amplitude", kTH1F, {{2000, 0.0, 1000.0}}); - registry.add("ZDC_C", "ZDC amplitude", kTH1F, {{2000, 0.0, 1000.0}}); - registry.add("ZDC_C_0", "ZDC amplitude", kTH1F, {{2000, 0.0, 1000.0}}); - registry.add("ZDC_C_1", "ZDC amplitude", kTH1F, {{2000, 0.0, 1000.0}}); - registry.add("V0A", "V0A amplitude", kTH1F, {{1000, 0.0, 1000.0}}); - registry.add("V0A_0", "V0A amplitude", kTH1F, {{1000, 0.0, 1000.0}}); - registry.add("V0A_1", "V0A amplitude", kTH1F, {{1000, 0.0, 1000.0}}); - - registry.add("hDcaxy_all_before", "DCAxy Distribution of all tracks before track selection; DCAxy (cm); Counts", kTH1F, {dcaxyAxis}); - registry.add("hDcaz_all_before", "DCAz Distribution of all tracks before track selection; DCAz (cm); Counts", kTH1F, {dcazAxis}); - - registry.add("hDcaxy_all_after", "DCAxy Distribution of all tracks after track selection; DCAxy (cm); Counts", kTH1F, {dcaxyAxis}); - registry.add("hDcaz_all_after", "DCAz Distribution of all tracks after track selection; DCAz (cm); Counts", kTH1F, {dcazAxis}); - - registry.add("hDcaxy_pi", "DCAxy Distribution of selected pions; DCAxy (cm); Counts", kTH1F, {dcaxyAxis}); - registry.add("hDcaz_pi", "DCAz Distribution of selected pions; DCAz (cm); Counts", kTH1F, {dcazAxis}); - - registry.add("hDcaxy_ka", "DCAxy Distribution of selected kaons; DCAxy (cm); Counts", kTH1F, {dcaxyAxis}); - registry.add("hDcaz_ka", "DCAz Distribution of selected kaons; DCAz (cm); Counts", kTH1F, {dcazAxis}); - - registry.add("hVertexX", "Vertex X distribution; Vertex X (cm); Counts", kTH1F, {VrtxXAxis}); - registry.add("hVertexY", "Vertex Y distribution; Vertex Y (cm); Counts", kTH1F, {VrtxYAxis}); - registry.add("hVertexZ", "VertexZ distribution; Vertex Z (cm); Counts", kTH1F, {VrtxZAxis}); - - registry.add("hEta_all_after", "Pseudorapidity of all tracks after track selection; #eta; Counts", kTH1F, {etaAxis}); - registry.add("hRap_all_after", "Rapidity of all tracks after track selection; y; Counts", kTH1F, {rapAxis}); - - registry.add("hEta_pi", "Pseudorapidity of selected Pions; #eta; Counts", kTH1F, {etaAxis}); - registry.add("hRap_pi", "Rapidity of selected Pions; y; Counts", kTH1F, {rapAxis}); - - registry.add("hEta_ka", "Pseudorapidity of selected Kaons; #eta; Counts", kTH1F, {etaAxis}); - registry.add("hRap_ka", "Rapidity of selected Kaons; y; Counts", kTH1F, {rapAxis}); + // Occupancy + rQA.add("hOcc_before", "Occupancy distribution before event cuts", kTH1F, {{1000, 0, 15000}}); + rQA.add("hOcc_after", "Occupancy distribution after all event cuts", kTH1F, {{1000, 0, 15000}}); + + // DCA + rQA.add("hDcaxy_all_before", "DCAxy Distribution of all tracks before track selection; DCAxy (cm); Counts", kTH1F, {{400, -0.2, 0.2}}); + rQA.add("hDcaz_all_before", "DCAz Distribution of all tracks before track selection; DCAz (cm); Counts", kTH1F, {{400, -0.2, 0.2}}); + + rQA.add("hDcaxy_all_after", "DCAxy Distribution of all tracks after track selection; DCAxy (cm); Counts", kTH1F, {{400, -0.2, 0.2}}); + rQA.add("hDcaz_all_after", "DCAz Distribution of all tracks after track selection; DCAz (cm); Counts", kTH1F, {{400, -0.2, 0.2}}); + + rQA.add("hDcaxy_pi", "DCAxy Distribution of selected pions; DCAxy (cm); Counts", kTH1F, {{400, -0.2, 0.2}}); + rQA.add("hDcaz_pi", "DCAz Distribution of selected pions; DCAz (cm); Counts", kTH1F, {{400, -0.2, 0.2}}); + + rQA.add("hDcaxy_ka", "DCAxy Distribution of selected kaons; DCAxy (cm); Counts", kTH1F, {{400, -0.2, 0.2}}); + rQA.add("hDcaz_ka", "DCAz Distribution of selected kaons; DCAz (cm); Counts", kTH1F, {{400, -0.2, 0.2}}); + + // Vx, Vy, Vz + rQA.add("hVertexX", "Vertex X distribution; Vertex X (cm); Counts", kTH1F, {{400, -0.1, 0.1}}); + rQA.add("hVertexY", "Vertex Y distribution; Vertex Y (cm); Counts", kTH1F, {{200, -0.05, 0.05}}); + rQA.add("hVertexZ", "VertexZ distribution; Vertex Z (cm); Counts", kTH1F, {{600, -15.0, 15.0}}); + + // TPC, TOF PID + rQA.add("tpc_dedx", "p vs dE/dx of all particles; #it{p} (GeV/#it{c}); TPC dE/dx (a.u.)", kTH2F, {{500, 0.0, 10.0}, {5000, 0.0, 5000.0}}); + rQA.add("tpc_dedx_kaon", "p vs dE/dx of selected kaons; #it{p} (GeV/#it{c}); TPC dE/dx (a.u.)", kTH2F, {{500, 0.0, 10.0}, {5000, 0.0, 5000.0}}); + rQA.add("tpc_dedx_pion", "p vs dE/dx of selected pions; #it{p} (GeV/#it{c}); TPC dE/dx (a.u.)", kTH2F, {{500, 0.0, 10.0}, {5000, 0.0, 5000.0}}); + rQA.add("tof_beta", "p vs #beta of all particles; #it{p} (GeV/#it{c}); TOF #beta", kTH2F, {{500, 0.0, 10.0}, {500, 0.0, 1.0}}); + rQA.add("tof_beta_kaon", "p vs #beta of selected kaons; #it{p} (GeV/#it{c}); TOF #beta", kTH2F, {{500, 0.0, 10.0}, {500, 0.0, 1.0}}); + rQA.add("tof_beta_pion", "p vs #beta of selected pions; #it{p} (GeV/#it{c}); TOF #beta", kTH2F, {{500, 0.0, 10.0}, {500, 0.0, 1.0}}); + + rQA.add("tpc_nsigma_kaon_all", "Kaon n#sigma_{TPC} of all tracks; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}^{K}", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); + rQA.add("tpc_nsigma_pion_all", "Pion n#sigma_{TPC} of all tracks; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}^{#pi}", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); + rQA.add("tpc_nsigma_kaon", "Kaon n#sigma_{TPC} of selected kaons; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}^{K}", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); + rQA.add("tpc_nsigma_pion", "Pion n#sigma_{TPC} of selected pions; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}^{#pi}", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); + + rQA.add("tof_nsigma_kaon_all", "Kaon n#sigma_{TOF} of all tracks; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}^{K}", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); + rQA.add("tof_nsigma_pion_all", "Pion n#sigma_{TOF} of all tracks; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}^{#pi}", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); + rQA.add("tof_nsigma_kaon", "Kaon n#sigma_{TOF} of selected kaons; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}^{K}", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); + rQA.add("tof_nsigma_pion", "Pion n#sigma_{TPC} of selected pions; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}^{#pi}", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); + + rQA.add("tpc_tof_nsigma_kaon", "n#sigma TPC vs TOF; n#sigma_{TPC}^{K}; n#sigma_{TOF}^{K}", kTH2F, {{100, -10.0, 10.0}, {100, -10.0, 10.0}}); + rQA.add("tpc_tof_nsigma_pion", "n#sigma TPC vs TOF; n#sigma_{TPC}^{#pi}; n#sigma_{TOF}^{#pi}", kTH2F, {{100, -10.0, 10.0}, {100, -10.0, 10.0}}); + + // Rapidity, pseudorapisdity + rQA.add("hEta_all_after", "Pseudorapidity of all tracks after track selection; #eta; Counts", kTH1F, {{400, -1.0, 1.0}}); + + rQA.add("hEta_ka", "Pseudorapidity of selected Kaons; #eta; Counts", kTH1F, {{400, -1.0, 1.0}}); + rQA.add("hRap_ka", "Rapidity of selected Kaons; y; Counts", kTH1F, {{400, -1.0, 1.0}}); + + rQA.add("hEta_pi", "Pseudorapidity of selected Pions; #eta; Counts", kTH1F, {{400, -1.0, 1.0}}); + rQA.add("hRap_pi", "Rapidity of selected Pions; y; Counts", kTH1F, {{400, -1.0, 1.0}}); + + // Detector Signals + rQA.add("FT0A_2", "T0A amplitude", kTH1F, {{500, 0.0, 500.0}}); + rQA.add("FT0A_0", "T0A amplitude", kTH1F, {{500, 0.0, 500.0}}); + rQA.add("FT0A_1", "T0A amplitude", kTH1F, {{20000, 0.0, 20000.0}}); + rQA.add("FT0C_2", "T0C amplitude", kTH1F, {{500, 0.0, 500.0}}); + rQA.add("FT0C_0", "T0C amplitude", kTH1F, {{20000, 0.0, 20000.0}}); + rQA.add("FT0C_1", "T0C amplitude", kTH1F, {{500, 0.0, 500.0}}); + rQA.add("ZDC_A_2", "ZDC amplitude", kTH1F, {{2000, 0.0, 1000.0}}); + rQA.add("ZDC_A_0", "ZDC amplitude", kTH1F, {{2000, 0.0, 1000.0}}); + rQA.add("ZDC_A_1", "ZDC amplitude", kTH1F, {{2000, 0.0, 1000.0}}); + rQA.add("ZDC_C_2", "ZDC amplitude", kTH1F, {{2000, 0.0, 1000.0}}); + rQA.add("ZDC_C_0", "ZDC amplitude", kTH1F, {{2000, 0.0, 1000.0}}); + rQA.add("ZDC_C_1", "ZDC amplitude", kTH1F, {{2000, 0.0, 1000.0}}); + rQA.add("V0A_2", "V0A amplitude", kTH1F, {{1000, 0.0, 1000.0}}); + rQA.add("V0A_0", "V0A amplitude", kTH1F, {{1000, 0.0, 1000.0}}); + rQA.add("V0A_1", "V0A amplitude", kTH1F, {{1000, 0.0, 1000.0}}); if (rapidityGap) { registry.add("event_rap_gap", "rap_gap", kTH1F, {{15, 0, 15.0}}); @@ -341,60 +363,80 @@ struct SginclusivePhiKstarSD { registry.add("MC/recCols", "Number of reconstructed collisions; Number of reconstructed collisions; Entries", {HistType::kTH1F, {{31, -0.5, 30.5}}}); registry.add("MC/nParts", "Number of McParticles per collision; Number of McParticles; Entries", {HistType::kTH1F, {{1001, -0.5, 1000.5}}}); registry.add("MC/nRecTracks", "Number of reconstructed tracks per McParticle; Number of reconstructed tracks per McParticle; Entries", {HistType::kTH1F, {{11, -0.5, 10.5}}}); - registry.add("MC/genEtaPt", "Generated events; eta (1); Pt (GeV/c)", {HistType::kTH2F, {{60, -1.5, 1.5}, {250, 0.0, 5.0}}}); + registry.add("MC/genEtaPt", "Generated events; eta (1); #it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{60, -1.5, 1.5}, {250, 0.0, 5.0}}}); registry.add("MC/genRap", "Generated events; Rapidity (1)", {HistType::kTH1F, {{60, -1.5, 1.5}}}); - registry.add("MC/genMPt", "Generated events; Mass (GeV/c^2); Pt (GeV/c)", {HistType::kTH2F, {{220, 0.98, 1.2}, {200, 0.0, 10.0}}}); - registry.add("MC/genM", "Generated events; Mass (GeV/c^2)", {HistType::kTH1F, {{220, 0.98, 1.2}}}); - registry.add("MC/genM_1", "Generated events; Mass (GeV/c^2)", {HistType::kTH1F, {{220, 0.98, 1.2}}}); + registry.add("MC/genMPt", "Generated events; Mass (GeV/#it{c}^2); #it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{220, 0.98, 1.2}, {200, 0.0, 10.0}}}); + registry.add("MC/genM", "Generated events; Mass (GeV/#it{c}^2)", {HistType::kTH1F, {{220, 0.98, 1.2}}}); + registry.add("MC/genM_1", "Generated events; Mass (GeV/#it{c}^2)", {HistType::kTH1F, {{220, 0.98, 1.2}}}); - registry.add("MC/accMPtRap_phi_G", "Generated Phi; Mass (GeV/c^2); Pt (GeV/c)", {HistType::kTH3F, {{220, 0.98, 1.20}, {200, 0.0, 10.0}, {60, -1.5, 1.5}}}); + registry.add("MC/accMPtRap_phi_G", "Generated Phi; Mass (GeV/#it{c}^2); #it{p}_{T} (GeV/#it{c})", {HistType::kTH3F, {{220, 0.98, 1.20}, {200, 0.0, 10.0}, {60, -1.5, 1.5}}}); - registry.add("MC/accEtaPt", "Generated events in acceptance; eta (1); Pt (GeV/c)", {HistType::kTH2F, {{60, -1.5, 1.5}, {250, 0.0, 5.0}}}); + registry.add("MC/accEtaPt", "Generated events in acceptance; eta (1); #it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{60, -1.5, 1.5}, {250, 0.0, 5.0}}}); registry.add("MC/accRap", "Generated events in acceptance; Rapidity (1)", {HistType::kTH1F, {{60, -1.5, 1.5}}}); - registry.add("MC/accMPt", "Generated events in acceptance; Mass (GeV/c^2); Pt (GeV/c)", {HistType::kTH2F, {{220, 0.98, 1.20}, {200, 0.0, 10.0}}}); - registry.add("MC/accMPtRap", "Generated events in acceptance; Mass (GeV/c^2); Pt (GeV/c)", {HistType::kTH3F, {{220, 0.98, 1.20}, {200, 0.0, 10.0}, {60, -1.5, 1.5}}}); - registry.add("MC/accM", "Generated events in acceptance; Mass (GeV/c^2)", {HistType::kTH1F, {{220, 0.98, 1.20}}}); + registry.add("MC/accMPt", "Generated events in acceptance; Mass (GeV/#it{c}^2); #it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{220, 0.98, 1.20}, {200, 0.0, 10.0}}}); + registry.add("MC/accMPtRap", "Generated events in acceptance; Mass (GeV/#it{c}^2); #it{p}_{T} (GeV/#it{c})", {HistType::kTH3F, {{220, 0.98, 1.20}, {200, 0.0, 10.0}, {60, -1.5, 1.5}}}); + registry.add("MC/accM", "Generated events in acceptance; Mass (GeV/#it{c}^2)", {HistType::kTH1F, {{220, 0.98, 1.20}}}); registry.add("MC/selRap", "Selected events in acceptance; Rapidity (1)", {HistType::kTH1F, {{60, -1.5, 1.5}}}); - registry.add("MC/selMPt", "Selected events in acceptance; Mass (GeV/c^2); Pt (GeV/c)", {HistType::kTH2F, {{250, 2.5, 5.0}, {100, 0.0, 1.0}}}); + registry.add("MC/selMPt", "Selected events in acceptance; Mass (GeV/#it{c}^2); #it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{250, 2.5, 5.0}, {100, 0.0, 1.0}}}); registry.add("MC/pDiff", "McTruth - reconstructed track momentum; McTruth - reconstructed track momentum; Entries", {HistType::kTH2F, {{240, -6., 6.}, {3, -1.5, 1.5}}}); // K*0 - registry.add("MC/accMPtRap_kstar_G", "Generated K*0; Mass (GeV/c^2); Pt (GeV/c)", {HistType::kTH3F, {{400, 0., 2.0}, {200, 0.0, 10.0}, {60, -1.5, 1.5}}}); - registry.add("MC/genEtaPt_k", "Generated events; eta (1); Pt (GeV/c)", {HistType::kTH2F, {{60, -1.5, 1.5}, {250, 0.0, 5.0}}}); + registry.add("MC/accMPtRap_kstar_G", "Generated K*0; Mass (GeV/#it{c}^2); #it{p}_{T} (GeV/#it{c})", {HistType::kTH3F, {{400, 0., 2.0}, {200, 0.0, 10.0}, {60, -1.5, 1.5}}}); + registry.add("MC/genEtaPt_k", "Generated events; eta (1); #it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{60, -1.5, 1.5}, {250, 0.0, 5.0}}}); registry.add("MC/genRap_k", "Generated events; Rapidity (1)", {HistType::kTH1F, {{60, -1.5, 1.5}}}); - registry.add("MC/genMPt_k", "Generated events; Mass (GeV/c^2); Pt (GeV/c)", {HistType::kTH2F, {{400, 0., 2.0}, {200, 0.0, 10.0}}}); - registry.add("MC/genM_k", "Generated events; Mass (GeV/c^2)", {HistType::kTH1F, {{400, 0., 2.0}}}); - registry.add("MC/genM_1_k", "Generated events; Mass (GeV/c^2)", {HistType::kTH1F, {{400, 0., 2.0}}}); + registry.add("MC/genMPt_k", "Generated events; Mass (GeV/#it{c}^2); #it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{400, 0., 2.0}, {200, 0.0, 10.0}}}); + registry.add("MC/genM_k", "Generated events; Mass (GeV/#it{c}^2)", {HistType::kTH1F, {{400, 0., 2.0}}}); + registry.add("MC/genM_1_k", "Generated events; Mass (GeV/#it{c}^2)", {HistType::kTH1F, {{400, 0., 2.0}}}); - registry.add("MC/accEtaPt_k", "Generated events in acceptance; eta (1); Pt (GeV/c)", {HistType::kTH2F, {{60, -1.5, 1.5}, {250, 0.0, 5.0}}}); + registry.add("MC/accEtaPt_k", "Generated events in acceptance; eta (1); #it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{60, -1.5, 1.5}, {250, 0.0, 5.0}}}); registry.add("MC/accRap_k", "Generated events in acceptance; Rapidity (1)", {HistType::kTH1F, {{60, -1.5, 1.5}}}); - registry.add("MC/accMPt_k", "Generated events in acceptance; Mass (GeV/c^2); Pt (GeV/c)", {HistType::kTH2F, {{400, 0., 2.0}, {200, 0.0, 10.0}}}); - registry.add("MC/accMPtRap_k", "Generated events in acceptance; Mass (GeV/c^2); Pt (GeV/c)", {HistType::kTH3F, {{400, 0., 2.0}, {200, 0.0, 10.0}, {60, -1.5, 1.5}}}); - registry.add("MC/accM_k", "Generated events in acceptance; Mass (GeV/c^2)", {HistType::kTH1F, {{400, 0., 2.0}}}); + registry.add("MC/accMPt_k", "Generated events in acceptance; Mass (GeV/#it{c}^2); #it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{400, 0., 2.0}, {200, 0.0, 10.0}}}); + registry.add("MC/accMPtRap_k", "Generated events in acceptance; Mass (GeV/#it{c}^2); #it{p}_{T} (GeV/#it{c})", {HistType::kTH3F, {{400, 0., 2.0}, {200, 0.0, 10.0}, {60, -1.5, 1.5}}}); + registry.add("MC/accM_k", "Generated events in acceptance; Mass (GeV/#it{c}^2)", {HistType::kTH1F, {{400, 0., 2.0}}}); } if (context.mOptions.get("processReco")) { + registry.add("Reco/hEventCutFlowMC", "No. of events after event cuts in MC", kTH1F, {{20, 0, 20}}); + std::shared_ptr hCutFlowMC = registry.get(HIST("Reco/hEventCutFlowMC")); + hCutFlowMC->GetXaxis()->SetBinLabel(1, "All Events"); + hCutFlowMC->GetXaxis()->SetBinLabel(2, "has_udMcCollision"); + hCutFlowMC->GetXaxis()->SetBinLabel(3, "generatorsID"); + hCutFlowMC->GetXaxis()->SetBinLabel(4, "GapsideMC"); + hCutFlowMC->GetXaxis()->SetBinLabel(5, "|Vz| < cut"); + hCutFlowMC->GetXaxis()->SetBinLabel(6, "Occupancy"); + hCutFlowMC->GetXaxis()->SetBinLabel(7, "Hadronic Rate"); + hCutFlowMC->GetXaxis()->SetBinLabel(8, "kNoCollInTimeRangeStandard"); + hCutFlowMC->GetXaxis()->SetBinLabel(9, "kNoCollInRofStandard"); + hCutFlowMC->GetXaxis()->SetBinLabel(10, "kNoHighMultCollInPrevRof"); + hCutFlowMC->GetXaxis()->SetBinLabel(11, "kNoTimeFrameBorder"); + hCutFlowMC->GetXaxis()->SetBinLabel(12, "kNoITSROFrameBorder"); + hCutFlowMC->GetXaxis()->SetBinLabel(13, "kNoSameBunchPileup"); + hCutFlowMC->GetXaxis()->SetBinLabel(14, "kIsGoodZvtxFT0vsPV"); + hCutFlowMC->GetXaxis()->SetBinLabel(15, "kIsVertexITSTPC"); + hCutFlowMC->GetXaxis()->SetBinLabel(16, "RCTFlag"); + hCutFlowMC->GetXaxis()->SetBinLabel(17, "upcFlag"); + registry.add("Reco/Stat", "Count reconstruted events; ; Entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}); registry.add("Reco/nPVContributors", "Number of PV contributors per collision; Number of PV contributors; Entries", {HistType::kTH1F, {{51, -0.5, 50.5}}}); registry.add("Reco/selRap", "Selected events in acceptance; Rapidity (1)", {HistType::kTH1F, {{60, -1.5, 1.5}}}); - registry.add("Reco/selMPt", "Reconstructed events in acceptance; Mass (GeV/c^2); Pt (GeV/c)", {HistType::kTH2F, {{220, 0.98, 1.20}, {200, 0.0, 10.0}}}); - registry.add("Reco/selMPtRap", "Reconstructed events in acceptance; Mass (GeV/c^2); Pt (GeV/c)", {HistType::kTH3F, {{220, 0.98, 1.20}, {200, 0.0, 10.0}, {60, -1.5, 1.5}}}); - registry.add("Reco/selMPtRap_gen", "Reconstructed(gen) events in acceptance; Mass (GeV/c^2); Pt (GeV/c)", {HistType::kTH3F, {{220, 0.98, 1.20}, {200, 0.0, 10.0}, {60, -1.5, 1.5}}}); - registry.add("MC/accMPtRap_phi_T", "Reconstrcted Phi; Mass (GeV/c^2); Pt (GeV/c)", {HistType::kTH3F, {{220, 0.98, 1.20}, {200, 0.0, 10.0}, {60, -1.5, 1.5}}}); - registry.add("MC/accMPtRap_kstar_T", "Reconstructed K*0; Mass (GeV/c^2); Pt (GeV/c)", {HistType::kTH3F, {{400, 0., 2.0}, {200, 0.0, 10.0}, {60, -1.5, 1.5}}}); - - registry.add("Reco/selPt", "Reconstructed events in acceptance;Pt (GeV/c)", {HistType::kTH1F, {{200, 0.0, 10.0}}}); - registry.add("Reco/selM", "Reconstructed events in acceptance; Mass (GeV/c^2); ", {HistType::kTH1F, {{220, 0.98, 1.20}}}); - registry.add("Reco/mcEtaPt", "Generated events in acceptance; eta (1); Pt (GeV/c)", {HistType::kTH2F, {{60, -1.5, 1.5}, {250, 0.0, 5.0}}}); + registry.add("Reco/selMPt", "Reconstructed events in acceptance; Mass (GeV/#it{c}^2); #it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{220, 0.98, 1.20}, {200, 0.0, 10.0}}}); + registry.add("Reco/selMPtRap", "Reconstructed events in acceptance; Mass (GeV/#it{c}^2); #it{p}_{T} (GeV/#it{c})", {HistType::kTH3F, {{220, 0.98, 1.20}, {200, 0.0, 10.0}, {60, -1.5, 1.5}}}); + registry.add("Reco/selMPtRap_gen", "Reconstructed(gen) events in acceptance; Mass (GeV/#it{c}^2); #it{p}_{T} (GeV/#it{c})", {HistType::kTH3F, {{220, 0.98, 1.20}, {200, 0.0, 10.0}, {60, -1.5, 1.5}}}); + registry.add("MC/accMPtRap_phi_T", "Reconstrcted Phi; Mass (GeV/#it{c}^2); #it{p}_{T} (GeV/#it{c})", {HistType::kTH3F, {{220, 0.98, 1.20}, {200, 0.0, 10.0}, {60, -1.5, 1.5}}}); + registry.add("MC/accMPtRap_kstar_T", "Reconstructed K*0; Mass (GeV/#it{c}^2); #it{p}_{T} (GeV/#it{c})", {HistType::kTH3F, {{400, 0., 2.0}, {200, 0.0, 10.0}, {60, -1.5, 1.5}}}); + + registry.add("Reco/selPt", "Reconstructed events in acceptance;#it{p}_{T} (GeV/#it{c})", {HistType::kTH1F, {{200, 0.0, 10.0}}}); + registry.add("Reco/selM", "Reconstructed events in acceptance; Mass (GeV/#it{c}^2); ", {HistType::kTH1F, {{220, 0.98, 1.20}}}); + registry.add("Reco/mcEtaPt", "Generated events in acceptance; eta (1); #it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{60, -1.5, 1.5}, {250, 0.0, 5.0}}}); registry.add("Reco/mcRap", "Generated events in acceptance; Rapidity (1)", {HistType::kTH1F, {{60, -1.5, 1.5}}}); - registry.add("Reco/mcMPt", "Generated events in acceptance; Mass (GeV/c^2); Pt (GeV/c)", {HistType::kTH2F, {{250, 2.5, 5.0}, {100, 0.0, 1.0}}}); + registry.add("Reco/mcMPt", "Generated events in acceptance; Mass (GeV/#it{c}^2); #it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{250, 2.5, 5.0}, {100, 0.0, 1.0}}}); registry.add("Reco/pDiff", "McTruth - reconstructed track momentum; McTruth - reconstructed track momentum; Entries", {HistType::kTH2F, {{240, -6., 6.}, {3, -1.5, 1.5}}}); registry.add("Reco/selRap_k", "Selected events in acceptance; Rapidity (1)", {HistType::kTH1F, {{60, -1.5, 1.5}}}); - registry.add("Reco/selMPt_k", "Reconstructed events in acceptance; Mass (GeV/c^2); Pt (GeV/c)", {HistType::kTH2F, {{400, 0., 2.0}, {200, 0.0, 10.0}}}); - registry.add("Reco/selMPtRap_k", "Reconstructed events in acceptance; Mass (GeV/c^2); Pt (GeV/c)", {HistType::kTH3F, {{400, 0., 2.0}, {200, 0.0, 10.0}, {60, -1.5, 1.5}}}); - registry.add("Reco/selMPtRap_k_gen", "Reconstructed(gen) events in acceptance; Mass (GeV/c^2); Pt (GeV/c)", {HistType::kTH3F, {{400, 0., 2.0}, {200, 0.0, 10.0}, {60, -1.5, 1.5}}}); - registry.add("Reco/selPt_k", "Reconstructed events in acceptance;Pt (GeV/c)", {HistType::kTH1F, {{200, 0.0, 10.0}}}); - registry.add("Reco/selM_k", "Reconstructed events in acceptance; Mass (GeV/c^2); ", {HistType::kTH1F, {{400, 0., 2.0}}}); - registry.add("Reco/selM_k_K", "Reconstructed events in acceptance; Mass (GeV/c^2); ", {HistType::kTH1F, {{400, 0., 2.0}}}); + registry.add("Reco/selMPt_k", "Reconstructed events in acceptance; Mass (GeV/#it{c}^2); #it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{400, 0., 2.0}, {200, 0.0, 10.0}}}); + registry.add("Reco/selMPtRap_k", "Reconstructed events in acceptance; Mass (GeV/#it{c}^2); #it{p}_{T} (GeV/#it{c})", {HistType::kTH3F, {{400, 0., 2.0}, {200, 0.0, 10.0}, {60, -1.5, 1.5}}}); + registry.add("Reco/selMPtRap_k_gen", "Reconstructed(gen) events in acceptance; Mass (GeV/#it{c}^2); #it{p}_{T} (GeV/#it{c})", {HistType::kTH3F, {{400, 0., 2.0}, {200, 0.0, 10.0}, {60, -1.5, 1.5}}}); + registry.add("Reco/selPt_k", "Reconstructed events in acceptance;#it{p}_{T} (GeV/#it{c})", {HistType::kTH1F, {{200, 0.0, 10.0}}}); + registry.add("Reco/selM_k", "Reconstructed events in acceptance; Mass (GeV/#it{c}^2); ", {HistType::kTH1F, {{400, 0., 2.0}}}); + registry.add("Reco/selM_k_K", "Reconstructed events in acceptance; Mass (GeV/#it{c}^2); ", {HistType::kTH1F, {{400, 0., 2.0}}}); registry.add("Reco/nTracks", "Number of reconstructed tracks per collision; Number of reconstructed tracks; Entries", {HistType::kTH1F, {{101, -0.5, 100.5}}}); registry.add("Reco/treta_k", "track kaon eta", {HistType::kTH1F, {{200, -5.0, 5.0}}}); @@ -414,36 +456,72 @@ struct SginclusivePhiKstarSD { registry.add("Reco/tr_tpcnclfind_2", "tpcnclfind", {HistType::kTH1F, {{300, 0.0, 300.0}}}); registry.add("Reco/tr_itsChi2NCl_2", "itsChi2NCl", {HistType::kTH1F, {{200, 0.0, 200.0}}}); - // qa - registry.add("tpc_dedx_mc", "p vs dE/dx", kTH2F, {{100, 0.0, 10.0}, {5000, 0.0, 5000.0}}); - registry.add("tof_beta_mc", "p vs beta", kTH2F, {{100, 0.0, 10.0}, {5000, 0.0, 5000.0}}); - - registry.add("tpc_dedx_kaon_mc", "p#k dE/dx", kTH2F, {{100, 0.0, 10.0}, {5000, 0.0, 5000.0}}); - registry.add("tpc_dedx_pion_mc", "p#pi dE/dx", kTH2F, {{100, 0.0, 10.0}, {5000, 0.0, 5000.0}}); - registry.add("tpc_nsigma_kaon_mc", "p#k n#sigma", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); - registry.add("tpc_nsigma_pion_mc", "p#pi n#sigma", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); - - registry.add("tpc_tof_nsigma_kaon_mc", "p#k n#sigma TPC vs TOF", kTH2F, {{100, -10.0, 10.0}, {100, -10.0, 10.0}}); - registry.add("tpc_tof_nsigma_pion_mc", "p#pi n#sigma TPC vs TOF", kTH2F, {{100, -10.0, 10.0}, {100, -10.0, 10.0}}); - - registry.add("tof_nsigma_kaon_mc", "p#k n#sigma", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); - registry.add("tof_nsigma_pion_mc", "p#pi n#sigma", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); - registry.add("tof_nsigma_kaon_f_mc", "p#k n#sigma", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); - registry.add("tof_nsigma_pion_f_mc", "p#pi n#sigma", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); - - registry.add("tpc_nsigma_kaon_f_mc", "p#k n#sigma", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); - registry.add("tpc_nsigma_pion_f_mc", "p#pi n#sigma", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); - - registry.add("FT0A_0_mc", "T0A amplitude", kTH1F, {{500, 0.0, 500.0}}); - registry.add("FT0A_1_mc", "T0A amplitude", kTH1F, {{20000, 0.0, 20000.0}}); - registry.add("FT0C_0_mc", "T0C amplitude", kTH1F, {{20000, 0.0, 20000.0}}); - registry.add("FT0C_1_mc", "T0C amplitude", kTH1F, {{500, 0.0, 500.0}}); - registry.add("ZDC_A_0_mc", "ZDC amplitude", kTH1F, {{2000, 0.0, 1000.0}}); - registry.add("ZDC_A_1_mc", "ZDC amplitude", kTH1F, {{2000, 0.0, 1000.0}}); - registry.add("ZDC_C_0_mc", "ZDC amplitude", kTH1F, {{2000, 0.0, 1000.0}}); - registry.add("ZDC_C_1_mc", "ZDC amplitude", kTH1F, {{2000, 0.0, 1000.0}}); - registry.add("V0A_0_mc", "V0A amplitude", kTH1F, {{1000, 0.0, 1000.0}}); - registry.add("V0A_1_mc", "V0A amplitude", kTH1F, {{1000, 0.0, 1000.0}}); + // QA plots + if (qaMC) { + // Occupancy + rQA.add("hOcc_before_mc", "Occupancy distribution before event cuts", kTH1F, {{1000, 0, 15000}}); + rQA.add("hOcc_after_mc", "Occupancy distribution after all event cuts", kTH1F, {{1000, 0, 15000}}); + + // DCA + rQA.add("hDcaxy_all_before_mc", "DCAxy Distribution of all tracks before track selection; DCAxy (cm); Counts", kTH1F, {{400, -0.2, 0.2}}); + rQA.add("hDcaz_all_before_mc", "DCAz Distribution of all tracks before track selection; DCAz (cm); Counts", kTH1F, {{400, -0.2, 0.2}}); + + rQA.add("hDcaxy_all_after_mc", "DCAxy Distribution of all tracks after track selection; DCAxy (cm); Counts", kTH1F, {{400, -0.2, 0.2}}); + rQA.add("hDcaz_all_after_mc", "DCAz Distribution of all tracks after track selection; DCAz (cm); Counts", kTH1F, {{400, -0.2, 0.2}}); + + rQA.add("hDcaxy_pi_mc", "DCAxy Distribution of selected pions; DCAxy (cm); Counts", kTH1F, {{400, -0.2, 0.2}}); + rQA.add("hDcaz_pi_mc", "DCAz Distribution of selected pions; DCAz (cm); Counts", kTH1F, {{400, -0.2, 0.2}}); + + rQA.add("hDcaxy_ka_mc", "DCAxy Distribution of selected kaons; DCAxy (cm); Counts", kTH1F, {{400, -0.2, 0.2}}); + rQA.add("hDcaz_ka_mc", "DCAz Distribution of selected kaons; DCAz (cm); Counts", kTH1F, {{400, -0.2, 0.2}}); + + // Vx, Vy, Vz + rQA.add("hVertexX_mc", "Vertex X distribution; Vertex X (cm); Counts", kTH1F, {{400, -0.1, 0.1}}); + rQA.add("hVertexY_mc", "Vertex Y distribution; Vertex Y (cm); Counts", kTH1F, {{200, -0.05, 0.05}}); + rQA.add("hVertexZ_mc", "VertexZ distribution; Vertex Z (cm); Counts", kTH1F, {{600, -15.0, 15.0}}); + + // TPC, TOF PID + rQA.add("tpc_dedx_mc", "p vs dE/dx of all particles; #it{p} (GeV/#it{c}); TPC dE/dx (a.u.)", kTH2F, {{500, 0.0, 10.0}, {5000, 0.0, 5000.0}}); + rQA.add("tpc_dedx_kaon_mc", "p vs dE/dx of selected kaons; #it{p} (GeV/#it{c}); TPC dE/dx (a.u.)", kTH2F, {{500, 0.0, 10.0}, {5000, 0.0, 5000.0}}); + rQA.add("tpc_dedx_pion_mc", "p vs dE/dx of selected pions; #it{p} (GeV/#it{c}); TPC dE/dx (a.u.)", kTH2F, {{500, 0.0, 10.0}, {5000, 0.0, 5000.0}}); + rQA.add("tof_beta_mc", "p vs #beta of all particles; #it{p} (GeV/#it{c}); TOF #beta", kTH2F, {{500, 0.0, 10.0}, {500, 0.0, 1.0}}); + rQA.add("tof_beta_kaon_mc", "p vs #beta of selected kaons; #it{p} (GeV/#it{c}); TOF #beta", kTH2F, {{500, 0.0, 10.0}, {500, 0.0, 1.0}}); + rQA.add("tof_beta_pion_mc", "p vs #beta of selected pions; #it{p} (GeV/#it{c}); TOF #beta", kTH2F, {{500, 0.0, 10.0}, {500, 0.0, 1.0}}); + + rQA.add("tpc_nsigma_kaon_all_mc", "Kaon n#sigma_{TPC} of all tracks; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}^{K}", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); + rQA.add("tpc_nsigma_pion_all_mc", "Pion n#sigma_{TPC} of all tracks; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}^{#pi}", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); + rQA.add("tpc_nsigma_kaon_mc", "Kaon n#sigma_{TPC} of selected kaons; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}^{K}", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); + rQA.add("tpc_nsigma_pion_mc", "Pion n#sigma_{TPC} of selected pions; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}^{#pi}", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); + + rQA.add("tof_nsigma_kaon_all_mc", "Kaon n#sigma_{TOF} of all tracks; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}^{K}", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); + rQA.add("tof_nsigma_pion_all_mc", "Pion n#sigma_{TOF} of all tracks; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}^{#pi}", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); + rQA.add("tof_nsigma_kaon_mc", "Kaon n#sigma_{TOF} of selected kaons; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}^{K}", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); + rQA.add("tof_nsigma_pion_mc", "Pion n#sigma_{TPC} of selected pions; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}^{#pi}", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); + + rQA.add("tpc_tof_nsigma_kaon_mc", "n#sigma TPC vs TOF; n#sigma_{TPC}^{K}; n#sigma_{TOF}^{K}", kTH2F, {{100, -10.0, 10.0}, {100, -10.0, 10.0}}); + rQA.add("tpc_tof_nsigma_pion_mc", "n#sigma TPC vs TOF; n#sigma_{TPC}^{#pi}; n#sigma_{TOF}^{#pi}", kTH2F, {{100, -10.0, 10.0}, {100, -10.0, 10.0}}); + + // Rapidity, pseudorapisdity + rQA.add("hEta_all_after_mc", "Pseudorapidity of all tracks after track selection; #eta; Counts", kTH1F, {{400, -1.0, 1.0}}); + + rQA.add("hEta_ka_mc", "Pseudorapidity of selected Kaons; #eta; Counts", kTH1F, {{400, -1.0, 1.0}}); + rQA.add("hRap_ka_mc", "Rapidity of selected Kaons; y; Counts", kTH1F, {{400, -1.0, 1.0}}); + + rQA.add("hEta_pi_mc", "Pseudorapidity of selected Pions; #eta; Counts", kTH1F, {{400, -1.0, 1.0}}); + rQA.add("hRap_pi_mc", "Rapidity of selected Pions; y; Counts", kTH1F, {{400, -1.0, 1.0}}); + + // Detector signals + rQA.add("FT0A_0_mc", "T0A amplitude", kTH1F, {{500, 0.0, 500.0}}); + rQA.add("FT0A_1_mc", "T0A amplitude", kTH1F, {{20000, 0.0, 20000.0}}); + rQA.add("FT0C_0_mc", "T0C amplitude", kTH1F, {{20000, 0.0, 20000.0}}); + rQA.add("FT0C_1_mc", "T0C amplitude", kTH1F, {{500, 0.0, 500.0}}); + rQA.add("ZDC_A_0_mc", "ZDC amplitude", kTH1F, {{2000, 0.0, 1000.0}}); + rQA.add("ZDC_A_1_mc", "ZDC amplitude", kTH1F, {{2000, 0.0, 1000.0}}); + rQA.add("ZDC_C_0_mc", "ZDC amplitude", kTH1F, {{2000, 0.0, 1000.0}}); + rQA.add("ZDC_C_1_mc", "ZDC amplitude", kTH1F, {{2000, 0.0, 1000.0}}); + rQA.add("V0A_0_mc", "V0A amplitude", kTH1F, {{1000, 0.0, 1000.0}}); + rQA.add("V0A_1_mc", "V0A amplitude", kTH1F, {{1000, 0.0, 1000.0}}); + } } } } @@ -477,6 +555,35 @@ struct SginclusivePhiKstarSD { return cosThetaCs; } + double phiCollinsSoperFrame(ROOT::Math::PxPyPzMVector pair1, ROOT::Math::PxPyPzMVector pair2, ROOT::Math::PxPyPzMVector fourpion) + { + // Half of the energy per pair of the colliding nucleons. + double halfSqrtSnn = 2680.; + double massOfLead208 = 193.6823; + double momentumBeam = std::sqrt(halfSqrtSnn * halfSqrtSnn * 208 * 208 - massOfLead208 * massOfLead208); + + ROOT::Math::PxPyPzEVector pProjCM(0., 0., -momentumBeam, halfSqrtSnn * 208); // projectile + ROOT::Math::PxPyPzEVector pTargCM(0., 0., momentumBeam, halfSqrtSnn * 208); // target + + ROOT::Math::PxPyPzMVector v1 = ROOT::Math::PxPyPzMVector(pair1.Px(), pair1.Py(), pair1.Pz(), pair1.M()); + ROOT::Math::PxPyPzMVector v2 = ROOT::Math::PxPyPzMVector(pair2.Px(), pair2.Py(), pair2.Pz(), pair2.M()); + ROOT::Math::PxPyPzMVector v12 = ROOT::Math::PxPyPzMVector(fourpion.Px(), fourpion.Py(), fourpion.Pz(), fourpion.M()); + + // Boost to center of mass frame + ROOT::Math::Boost boostv12{v12.BoostToCM()}; + ROOT::Math::XYZVectorF v1Cm{(boostv12(v1).Vect()).Unit()}; + ROOT::Math::XYZVectorF v2Cm{(boostv12(v2).Vect()).Unit()}; + ROOT::Math::XYZVectorF beam1Cm{(boostv12(pProjCM).Vect()).Unit()}; + ROOT::Math::XYZVectorF beam2Cm{(boostv12(pTargCM).Vect()).Unit()}; + // Axes + ROOT::Math::XYZVectorF zaxisCs{((beam1Cm.Unit() - beam2Cm.Unit()).Unit())}; + ROOT::Math::XYZVectorF yaxisCs{(beam1Cm.Cross(beam2Cm)).Unit()}; + ROOT::Math::XYZVectorF xaxisCs{(yaxisCs.Cross(zaxisCs)).Unit()}; + + double phi = std::atan2(yaxisCs.Dot(v1Cm), xaxisCs.Dot(v1Cm)); + return phi; + } + template bool isGoodRCTflag(C const& coll) { @@ -554,34 +661,6 @@ struct SginclusivePhiKstarSD { } //------------------------------------------------------------------------------------------------------ - double phiCollinsSoperFrame(ROOT::Math::PxPyPzMVector pair1, ROOT::Math::PxPyPzMVector pair2, ROOT::Math::PxPyPzMVector fourpion) - { - // Half of the energy per pair of the colliding nucleons. - double halfSqrtSnn = 2680.; - double massOfLead208 = 193.6823; - double momentumBeam = std::sqrt(halfSqrtSnn * halfSqrtSnn * 208 * 208 - massOfLead208 * massOfLead208); - - ROOT::Math::PxPyPzEVector pProjCM(0., 0., -momentumBeam, halfSqrtSnn * 208); // projectile - ROOT::Math::PxPyPzEVector pTargCM(0., 0., momentumBeam, halfSqrtSnn * 208); // target - - ROOT::Math::PxPyPzMVector v1 = ROOT::Math::PxPyPzMVector(pair1.Px(), pair1.Py(), pair1.Pz(), pair1.M()); - ROOT::Math::PxPyPzMVector v2 = ROOT::Math::PxPyPzMVector(pair2.Px(), pair2.Py(), pair2.Pz(), pair2.M()); - ROOT::Math::PxPyPzMVector v12 = ROOT::Math::PxPyPzMVector(fourpion.Px(), fourpion.Py(), fourpion.Pz(), fourpion.M()); - - // Boost to center of mass frame - ROOT::Math::Boost boostv12{v12.BoostToCM()}; - ROOT::Math::XYZVectorF v1Cm{(boostv12(v1).Vect()).Unit()}; - ROOT::Math::XYZVectorF v2Cm{(boostv12(v2).Vect()).Unit()}; - ROOT::Math::XYZVectorF beam1Cm{(boostv12(pProjCM).Vect()).Unit()}; - ROOT::Math::XYZVectorF beam2Cm{(boostv12(pTargCM).Vect()).Unit()}; - // Axes - ROOT::Math::XYZVectorF zaxisCs{((beam1Cm.Unit() - beam2Cm.Unit()).Unit())}; - ROOT::Math::XYZVectorF yaxisCs{(beam1Cm.Cross(beam2Cm)).Unit()}; - ROOT::Math::XYZVectorF xaxisCs{(yaxisCs.Cross(zaxisCs)).Unit()}; - - double phi = std::atan2(yaxisCs.Dot(v1Cm), xaxisCs.Dot(v1Cm)); - return phi; - } using UDtracksfull = soa::Join; using UDCollisionsFull = soa::Join; // @@ -589,6 +668,11 @@ struct SginclusivePhiKstarSD { void process(UDCollisionFull const& collision, UDtracksfull const& tracks) { + registry.fill(HIST("hEventCutFlow"), 0); + + if (qa) + rQA.fill(HIST("hOcc_before"), collision.occupancyInTime()); + ROOT::Math::PxPyPzMVector v0; ROOT::Math::PxPyPzMVector v1; ROOT::Math::PxPyPzMVector v01; @@ -597,6 +681,14 @@ struct SginclusivePhiKstarSD { std::vector parameters = {pvCut, dcazCut, dcaxyCut, tpcChi2Cut, tpcNClsFindableCut, itsChi2Cut, etaCut, ptCut}; int truegapSide = sgSelector.trueGap(collision, fitCut[0], fitCut[1], fitCut[2], zdcCut); + registry.fill(HIST("GapSide"), gapSide); + registry.fill(HIST("TrueGapSide"), truegapSide); + gapSide = truegapSide; + + if (gapSide < SingleGapA || gapSide > DoubleGap) + return; + registry.fill(HIST("hEventCutFlow"), 1); + ROOT::Math::PxPyPzMVector phiv; ROOT::Math::PxPyPzMVector phiv1; @@ -609,50 +701,75 @@ struct SginclusivePhiKstarSD { std::vector onlyPionTracksn; std::vector rawPionTracksn; - registry.fill(HIST("GapSide"), gapSide); - registry.fill(HIST("TrueGapSide"), truegapSide); - gapSide = truegapSide; - if (gapSide < 0 || gapSide > 2) - return; if (std::abs(collision.posZ()) > vzCut) return; + registry.fill(HIST("hEventCutFlow"), 2); + if (std::abs(collision.occupancyInTime()) > occCut) return; + registry.fill(HIST("hEventCutFlow"), 3); + if (std::abs(collision.hadronicRate()) > hadronicRate) return; + registry.fill(HIST("hEventCutFlow"), 4); if (useTrs != -1 && collision.trs() != useTrs) return; + registry.fill(HIST("hEventCutFlow"), 5); + if (useTrofs != -1 && collision.trofs() != useTrofs) return; + registry.fill(HIST("hEventCutFlow"), 6); + if (useHmpr != -1 && collision.hmpr() != useHmpr) return; + registry.fill(HIST("hEventCutFlow"), 7); + if (useTfb != -1 && collision.tfb() != useTfb) return; + registry.fill(HIST("hEventCutFlow"), 8); + if (useItsrofb != -1 && collision.itsROFb() != useItsrofb) return; + registry.fill(HIST("hEventCutFlow"), 9); + if (useSbp != -1 && collision.sbp() != useSbp) return; + registry.fill(HIST("hEventCutFlow"), 10); + if (useZvtxftovpv != -1 && collision.zVtxFT0vPV() != useZvtxftovpv) return; + registry.fill(HIST("hEventCutFlow"), 11); + if (useVtxItsTpc != -1 && collision.vtxITSTPC() != useVtxItsTpc) return; + registry.fill(HIST("hEventCutFlow"), 12); + if (!isGoodRCTflag(collision)) return; + registry.fill(HIST("hEventCutFlow"), 13); + if (upcflag != -1 && collision.flags() != upcflag) return; + registry.fill(HIST("hEventCutFlow"), 14); + int mult = collision.numContrib(); - if (gapSide == 0) { + if (gapSide == SingleGapA) { registry.fill(HIST("gap_mult0"), mult); } - if (gapSide == 1) { + if (gapSide == SingleGapC) { registry.fill(HIST("gap_mult1"), mult); } - if (gapSide == 2) { + if (gapSide == DoubleGap) { registry.fill(HIST("gap_mult2"), mult); } if (mult < mintrack || mult > maxtrack) return; + registry.fill(HIST("hEventCutFlow"), 15); + + if (qa) + rQA.fill(HIST("hOcc_after"), collision.occupancyInTime()); + int mult0 = 0; int mult1 = 0; int mult2 = 0; @@ -663,25 +780,25 @@ struct SginclusivePhiKstarSD { int trackextraDG = 0; if (qa) { - registry.fill(HIST("hVertexX"), collision.posX()); - registry.fill(HIST("hVertexY"), collision.posY()); - registry.fill(HIST("hVertexZ"), collision.posZ()); + rQA.fill(HIST("hVertexX"), collision.posX()); + rQA.fill(HIST("hVertexY"), collision.posY()); + rQA.fill(HIST("hVertexZ"), collision.posZ()); } /* Partition pvContributors1 = aod::udtrack::isPVContributor == true; pvContributors1.bindTable(tracks); - if (gapSide == 0) { + if (gapSide == SingleGapA) { registry.get(HIST("nPVContributors_data"))->Fill(pvContributors1.size(), 1.); } - if (gapSide == 1) { + if (gapSide == SingleGapC) { registry.get(HIST("nPVContributors_data_1"))->Fill(pvContributors1.size(), 1.); } */ for (const auto& track1 : tracks) { if (qa) { - registry.fill(HIST("hDcaxy_all_before"), track1.dcaXY()); - registry.fill(HIST("hDcaz_all_before"), track1.dcaZ()); + rQA.fill(HIST("hDcaxy_all_before"), track1.dcaXY()); + rQA.fill(HIST("hDcaz_all_before"), track1.dcaZ()); } if (!trackselector(track1, parameters)) @@ -690,10 +807,9 @@ struct SginclusivePhiKstarSD { v0.SetCoordinates(track1.px(), track1.py(), track1.pz(), o2::constants::physics::MassPionCharged); if (qa) { - registry.fill(HIST("hDcaxy_all_after"), track1.dcaXY()); - registry.fill(HIST("hDcaz_all_after"), track1.dcaZ()); - registry.fill(HIST("hEta_all_after"), v0.Eta()); - registry.fill(HIST("hRap_all_after"), v0.Rapidity()); + rQA.fill(HIST("hDcaxy_all_after"), track1.dcaXY()); + rQA.fill(HIST("hDcaz_all_after"), track1.dcaZ()); + rQA.fill(HIST("hEta_all_after"), v0.Eta()); } if (selectionPIDPion1(track1)) { @@ -708,13 +824,13 @@ struct SginclusivePhiKstarSD { rawPionTracksn.push_back(track1); } } - if (gapSide == 0) { + if (gapSide == SingleGapA) { mult0++; } - if (gapSide == 1) { + if (gapSide == SingleGapC) { mult1++; } - if (gapSide == 2) { + if (gapSide == DoubleGap) { mult2++; } if (std::abs(v0.Eta()) < etaDG) { @@ -734,106 +850,108 @@ struct SginclusivePhiKstarSD { } if (qa) { - registry.fill(HIST("tpc_dedx"), v0.P(), track1.tpcSignal()); - registry.fill(HIST("tof_beta"), v0.P(), track1.beta()); - registry.fill(HIST("tof_nsigma_kaon_f"), v0.Pt(), track1.tofNSigmaKa()); - registry.fill(HIST("tof_nsigma_pion_f"), v0.Pt(), track1.tofNSigmaPi()); - registry.fill(HIST("tpc_nsigma_kaon_f"), v0.Pt(), track1.tpcNSigmaKa()); - registry.fill(HIST("tpc_nsigma_pion_f"), v0.Pt(), track1.tpcNSigmaPi()); + rQA.fill(HIST("tpc_dedx"), v0.P(), track1.tpcSignal()); + rQA.fill(HIST("tof_beta"), v0.P(), track1.beta()); + rQA.fill(HIST("tof_nsigma_kaon_all"), v0.Pt(), track1.tofNSigmaKa()); + rQA.fill(HIST("tof_nsigma_pion_all"), v0.Pt(), track1.tofNSigmaPi()); + rQA.fill(HIST("tpc_nsigma_kaon_all"), v0.Pt(), track1.tpcNSigmaKa()); + rQA.fill(HIST("tpc_nsigma_pion_all"), v0.Pt(), track1.tpcNSigmaPi()); if (selectionPIDKaon1(track1)) { - registry.fill(HIST("tpc_dedx_kaon_1"), v0.P(), track1.tpcSignal()); - registry.fill(HIST("tpc_nsigma_kaon"), v0.Pt(), track1.tpcNSigmaKa()); - registry.fill(HIST("tof_nsigma_kaon"), v0.Pt(), track1.tofNSigmaKa()); - registry.fill(HIST("tpc_tof_nsigma_kaon"), track1.tpcNSigmaKa(), track1.tofNSigmaKa()); - registry.fill(HIST("hEta_ka"), v0.Eta()); - registry.fill(HIST("hRap_ka"), v0.Rapidity()); - registry.fill(HIST("hDcaxy_ka"), track1.dcaXY()); - registry.fill(HIST("hDcaz_ka"), track1.dcaZ()); + rQA.fill(HIST("tpc_dedx_kaon"), v0.P(), track1.tpcSignal()); + rQA.fill(HIST("tof_beta_kaon"), v0.P(), track1.beta()); + rQA.fill(HIST("tpc_nsigma_kaon"), v0.Pt(), track1.tpcNSigmaKa()); + rQA.fill(HIST("tof_nsigma_kaon"), v0.Pt(), track1.tofNSigmaKa()); + rQA.fill(HIST("tpc_tof_nsigma_kaon"), track1.tpcNSigmaKa(), track1.tofNSigmaKa()); + rQA.fill(HIST("hEta_ka"), v0.Eta()); + rQA.fill(HIST("hRap_ka"), v0.Rapidity()); + rQA.fill(HIST("hDcaxy_ka"), track1.dcaXY()); + rQA.fill(HIST("hDcaz_ka"), track1.dcaZ()); } if (selectionPIDPion1(track1)) { - registry.fill(HIST("tpc_dedx_pion_1"), v0.P(), track1.tpcSignal()); - registry.fill(HIST("tpc_nsigma_pion"), v0.Pt(), track1.tpcNSigmaPi()); - registry.fill(HIST("tof_nsigma_pion"), v0.Pt(), track1.tofNSigmaPi()); - registry.fill(HIST("tpc_tof_nsigma_pion"), track1.tpcNSigmaPi(), track1.tofNSigmaPi()); - registry.fill(HIST("hEta_pi"), v0.Eta()); - registry.fill(HIST("hRap_pi"), v0.Rapidity()); - registry.fill(HIST("hDcaxy_pi"), track1.dcaXY()); - registry.fill(HIST("hDcaz_pi"), track1.dcaZ()); + rQA.fill(HIST("tpc_dedx_pion"), v0.P(), track1.tpcSignal()); + rQA.fill(HIST("tof_beta_pion"), v0.P(), track1.beta()); + rQA.fill(HIST("tpc_nsigma_pion"), v0.Pt(), track1.tpcNSigmaPi()); + rQA.fill(HIST("tof_nsigma_pion"), v0.Pt(), track1.tofNSigmaPi()); + rQA.fill(HIST("tpc_tof_nsigma_pion"), track1.tpcNSigmaPi(), track1.tofNSigmaPi()); + rQA.fill(HIST("hEta_pi"), v0.Eta()); + rQA.fill(HIST("hRap_pi"), v0.Rapidity()); + rQA.fill(HIST("hDcaxy_pi"), track1.dcaXY()); + rQA.fill(HIST("hDcaz_pi"), track1.dcaZ()); } } } - if (gapSide == 0) { + if (gapSide == SingleGapA) { registry.fill(HIST("mult_0"), mult0); } - if (gapSide == 1) { + if (gapSide == SingleGapC) { registry.fill(HIST("mult_1"), mult1); } - if (gapSide == 2) { + if (gapSide == DoubleGap) { registry.fill(HIST("mult_2"), mult2); } if (qa) { - if (gapSide == 0) { - registry.fill(HIST("V0A_0"), collision.totalFV0AmplitudeA()); - registry.fill(HIST("FT0A_0"), collision.totalFT0AmplitudeA()); - registry.fill(HIST("FT0C_0"), collision.totalFT0AmplitudeC()); - registry.fill(HIST("ZDC_A_0"), collision.energyCommonZNA()); - registry.fill(HIST("ZDC_C_0"), collision.energyCommonZNC()); + if (gapSide == SingleGapA) { + rQA.fill(HIST("V0A_0"), collision.totalFV0AmplitudeA()); + rQA.fill(HIST("FT0A_0"), collision.totalFT0AmplitudeA()); + rQA.fill(HIST("FT0C_0"), collision.totalFT0AmplitudeC()); + rQA.fill(HIST("ZDC_A_0"), collision.energyCommonZNA()); + rQA.fill(HIST("ZDC_C_0"), collision.energyCommonZNC()); } - if (gapSide == 1) { - registry.fill(HIST("V0A_1"), collision.totalFV0AmplitudeA()); - registry.fill(HIST("FT0A_1"), collision.totalFT0AmplitudeA()); - registry.fill(HIST("FT0C_1"), collision.totalFT0AmplitudeC()); - registry.fill(HIST("ZDC_A_1"), collision.energyCommonZNA()); - registry.fill(HIST("ZDC_C_1"), collision.energyCommonZNC()); + if (gapSide == SingleGapC) { + rQA.fill(HIST("V0A_1"), collision.totalFV0AmplitudeA()); + rQA.fill(HIST("FT0A_1"), collision.totalFT0AmplitudeA()); + rQA.fill(HIST("FT0C_1"), collision.totalFT0AmplitudeC()); + rQA.fill(HIST("ZDC_A_1"), collision.energyCommonZNA()); + rQA.fill(HIST("ZDC_C_1"), collision.energyCommonZNC()); } - if (gapSide == 2) { - registry.fill(HIST("V0A"), collision.totalFV0AmplitudeA()); - registry.fill(HIST("FT0A"), collision.totalFT0AmplitudeA()); - registry.fill(HIST("FT0C"), collision.totalFT0AmplitudeC()); - registry.fill(HIST("ZDC_A"), collision.energyCommonZNA()); - registry.fill(HIST("ZDC_C"), collision.energyCommonZNC()); + if (gapSide == DoubleGap) { + rQA.fill(HIST("V0A_2"), collision.totalFV0AmplitudeA()); + rQA.fill(HIST("FT0A_2"), collision.totalFT0AmplitudeA()); + rQA.fill(HIST("FT0C_2"), collision.totalFT0AmplitudeC()); + rQA.fill(HIST("ZDC_A_2"), collision.energyCommonZNA()); + rQA.fill(HIST("ZDC_C_2"), collision.energyCommonZNC()); } if (rapidityGap) { if (trackgapC > 0 && trackgapA == 0 && trackextra == 0) { - if (gapSide == 0) { + if (gapSide == SingleGapA) { registry.fill(HIST("event_rap_gap"), 1); registry.fill(HIST("rap_mult1"), trackgapC); } - if (gapSide == 1) { + if (gapSide == SingleGapC) { registry.fill(HIST("event_rap_gap"), 4); registry.fill(HIST("rap1_mult1"), trackgapC); } - if (gapSide == 2) { + if (gapSide == DoubleGap) { registry.fill(HIST("event_rap_gap"), 7); registry.fill(HIST("rap2_mult1"), trackgapC); } } if (trackgapC == 0 && trackgapA > 0 && trackextra == 0) { - if (gapSide == 0) { + if (gapSide == SingleGapA) { registry.fill(HIST("event_rap_gap"), 2); registry.fill(HIST("rap_mult2"), trackgapA); } - if (gapSide == 1) { + if (gapSide == SingleGapC) { registry.fill(HIST("event_rap_gap"), 5); registry.fill(HIST("rap1_mult2"), trackgapA); } - if (gapSide == 2) { + if (gapSide == DoubleGap) { registry.fill(HIST("event_rap_gap"), 8); registry.fill(HIST("rap2_mult2"), trackgapA); } } if (trackDG > 0 && trackextraDG == 0) { - if (gapSide == 0) { + if (gapSide == SingleGapA) { registry.fill(HIST("event_rap_gap"), 3); registry.fill(HIST("rap_mult3"), trackDG); } - if (gapSide == 1) { + if (gapSide == SingleGapC) { registry.fill(HIST("event_rap_gap"), 6); registry.fill(HIST("rap1_mult3"), trackDG); } - if (gapSide == 2) { + if (gapSide == DoubleGap) { registry.fill(HIST("event_rap_gap"), 9); registry.fill(HIST("rap2_mult3"), trackDG); } @@ -853,24 +971,24 @@ struct SginclusivePhiKstarSD { v01 = v0 + v1; // Opposite sign pairs if (t0.sign() != t1.sign()) { - if (gapSide == 0) { + if (gapSide == SingleGapA) { registry.fill(HIST("os_kk_mass_rap"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 1) { + if (gapSide == SingleGapC) { registry.fill(HIST("os_kk_mass1_rap"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 2) { + if (gapSide == DoubleGap) { registry.fill(HIST("os_kk_mass2_rap"), v01.M(), v01.Rapidity(), v01.Pt()); } } if (t0.sign() == t1.sign()) { - if (gapSide == 0) { + if (gapSide == SingleGapA) { registry.fill(HIST("os_kk_ls_mass_rap"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 1) { + if (gapSide == SingleGapC) { registry.fill(HIST("os_kk_ls_mass1_rap"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 2) { + if (gapSide == DoubleGap) { registry.fill(HIST("os_kk_ls_mass2_rap"), v01.M(), v01.Rapidity(), v01.Pt()); } } @@ -888,24 +1006,24 @@ struct SginclusivePhiKstarSD { v01 = v0 + v1; // Opposite sign pairs if (t0.sign() != t1.sign()) { - if (gapSide == 0) { + if (gapSide == SingleGapA) { registry.fill(HIST("os_kp_mass_rap"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 1) { + if (gapSide == SingleGapC) { registry.fill(HIST("os_kp_mass1_rap"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 2) { + if (gapSide == DoubleGap) { registry.fill(HIST("os_kp_mass2_rap"), v01.M(), v01.Rapidity(), v01.Pt()); } } if (t0.sign() == t1.sign()) { - if (gapSide == 0) { + if (gapSide == SingleGapA) { registry.fill(HIST("os_kp_ls_mass_rap"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 1) { + if (gapSide == SingleGapC) { registry.fill(HIST("os_kp_ls_mass1_rap"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 2) { + if (gapSide == DoubleGap) { registry.fill(HIST("os_kp_ls_mass2_rap"), v01.M(), v01.Rapidity(), v01.Pt()); } } @@ -924,24 +1042,24 @@ struct SginclusivePhiKstarSD { v01 = v0 + v1; // Opposite sign pairs if (t0.sign() != t1.sign()) { - if (gapSide == 0) { + if (gapSide == SingleGapA) { registry.fill(HIST("os_kk_mass_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 1) { + if (gapSide == SingleGapC) { registry.fill(HIST("os_kk_mass1_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 2) { + if (gapSide == DoubleGap) { registry.fill(HIST("os_kk_mass2_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); } } if (t0.sign() == t1.sign()) { - if (gapSide == 0) { + if (gapSide == SingleGapA) { registry.fill(HIST("os_kk_ls_mass_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 1) { + if (gapSide == SingleGapC) { registry.fill(HIST("os_kk_ls_mass1_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 2) { + if (gapSide == DoubleGap) { registry.fill(HIST("os_kk_ls_mass2_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); } } @@ -959,24 +1077,24 @@ struct SginclusivePhiKstarSD { v01 = v0 + v1; // Opposite sign pairs if (t0.sign() != t1.sign()) { - if (gapSide == 0) { + if (gapSide == SingleGapA) { registry.fill(HIST("os_kp_mass_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 1) { + if (gapSide == SingleGapC) { registry.fill(HIST("os_kp_mass1_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 2) { + if (gapSide == DoubleGap) { registry.fill(HIST("os_kp_mass2_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); } } if (t0.sign() == t1.sign()) { - if (gapSide == 0) { + if (gapSide == SingleGapA) { registry.fill(HIST("os_kp_ls_mass_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 1) { + if (gapSide == SingleGapC) { registry.fill(HIST("os_kp_ls_mass1_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 2) { + if (gapSide == DoubleGap) { registry.fill(HIST("os_kp_ls_mass2_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); } } @@ -994,24 +1112,24 @@ struct SginclusivePhiKstarSD { v01 = v0 + v1; // Opposite sign pairs if (t0.sign() != t1.sign()) { - if (gapSide == 0) { + if (gapSide == SingleGapA) { registry.fill(HIST("os_kk_mass_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 1) { + if (gapSide == SingleGapC) { registry.fill(HIST("os_kk_mass1_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 2) { + if (gapSide == DoubleGap) { registry.fill(HIST("os_kk_mass2_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); } } if (t0.sign() == t1.sign()) { - if (gapSide == 0) { + if (gapSide == SingleGapA) { registry.fill(HIST("os_kk_ls_mass_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 1) { + if (gapSide == SingleGapC) { registry.fill(HIST("os_kk_ls_mass1_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 2) { + if (gapSide == DoubleGap) { registry.fill(HIST("os_kk_ls_mass2_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); } } @@ -1029,24 +1147,24 @@ struct SginclusivePhiKstarSD { v01 = v0 + v1; // Opposite sign pairs if (t0.sign() != t1.sign()) { - if (gapSide == 0) { + if (gapSide == SingleGapA) { registry.fill(HIST("os_kp_mass_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 1) { + if (gapSide == SingleGapC) { registry.fill(HIST("os_kp_mass1_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 2) { + if (gapSide == DoubleGap) { registry.fill(HIST("os_kp_mass2_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); } } if (t0.sign() == t1.sign()) { - if (gapSide == 0) { + if (gapSide == SingleGapA) { registry.fill(HIST("os_kp_ls_mass_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 1) { + if (gapSide == SingleGapC) { registry.fill(HIST("os_kp_ls_mass1_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 2) { + if (gapSide == DoubleGap) { registry.fill(HIST("os_kp_ls_mass2_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); } } @@ -1066,25 +1184,25 @@ struct SginclusivePhiKstarSD { v01 = v0 + v1; // Opposite sign pairs if (t0.sign() != t1.sign()) { - if (gapSide == 0) { + if (gapSide == SingleGapA) { registry.fill(HIST("os_KK_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 1) { + if (gapSide == SingleGapC) { registry.fill(HIST("os_KK_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (exclusive && gapSide == 2 && mult2 == 2) { + if (exclusive && gapSide == DoubleGap && mult2 == numTwoTracks) { registry.fill(HIST("os_KK_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); } } // samesignpair if (t0.sign() == t1.sign()) { - if (gapSide == 0) { + if (gapSide == SingleGapA) { registry.fill(HIST("os_KK_ls_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 1) { + if (gapSide == SingleGapC) { registry.fill(HIST("os_KK_ls_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (exclusive && gapSide == 2 && mult2 == 2) { + if (exclusive && gapSide == DoubleGap && mult2 == numTwoTracks) { registry.fill(HIST("os_KK_ls_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); } } @@ -1104,13 +1222,13 @@ struct SginclusivePhiKstarSD { v1.SetCoordinates(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassKaonCharged); v01 = v0 + v1; if (t0.sign() != t1.sign()) { - if (gapSide == 0) { + if (gapSide == SingleGapA) { registry.fill(HIST("os_KK_rot_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 1) { + if (gapSide == SingleGapC) { registry.fill(HIST("os_KK_rot_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (exclusive && gapSide == 2 && mult2 == 2) { + if (exclusive && gapSide == DoubleGap && mult2 == numTwoTracks) { registry.fill(HIST("os_KK_rot_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); } } @@ -1129,24 +1247,24 @@ struct SginclusivePhiKstarSD { v01 = v0 + v1; // Opposite sign pairs if (t0.sign() != t1.sign()) { - if (gapSide == 0) { + if (gapSide == SingleGapA) { registry.fill(HIST("os_pp_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 1) { + if (gapSide == SingleGapC) { registry.fill(HIST("os_pp_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (exclusive && gapSide == 2 && mult2 == 2) { + if (exclusive && gapSide == DoubleGap && mult2 == numTwoTracks) { registry.fill(HIST("os_pp_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); } } // same sign pair if (t0.sign() == t1.sign()) { - if (gapSide == 0) { + if (gapSide == SingleGapA) { registry.fill(HIST("os_pp_ls_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 1) { + if (gapSide == SingleGapC) { registry.fill(HIST("os_pp_ls_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (exclusive && gapSide == 2 && mult2 == 2) { + if (exclusive && gapSide == DoubleGap && mult2 == numTwoTracks) { registry.fill(HIST("os_pp_ls_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); } } @@ -1159,24 +1277,24 @@ struct SginclusivePhiKstarSD { v01 = v0 + v1; // Opposite sign pairs if (t0.sign() != t1.sign()) { - if (gapSide == 0) { + if (gapSide == SingleGapA) { registry.fill(HIST("os_pk_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 1) { + if (gapSide == SingleGapC) { registry.fill(HIST("os_pk_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (exclusive && gapSide == 2 && mult2 == 2) { + if (exclusive && gapSide == DoubleGap && mult2 == numTwoTracks) { registry.fill(HIST("os_pk_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); } } // same sign pair if (t0.sign() == t1.sign()) { - if (gapSide == 0) { + if (gapSide == SingleGapA) { registry.fill(HIST("os_pk_ls_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 1) { + if (gapSide == SingleGapC) { registry.fill(HIST("os_pk_ls_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (exclusive && gapSide == 2 && mult2 == 2) { + if (exclusive && gapSide == DoubleGap && mult2 == numTwoTracks) { registry.fill(HIST("os_pk_ls_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); } } @@ -1195,13 +1313,13 @@ struct SginclusivePhiKstarSD { v1.SetCoordinates(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); v01 = v0 + v1; if (t0.sign() != t1.sign()) { - if (gapSide == 0) { + if (gapSide == SingleGapA) { registry.fill(HIST("os_pk_rot_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 1) { + if (gapSide == SingleGapC) { registry.fill(HIST("os_pk_rot_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (exclusive && gapSide == 2 && mult2 == 2) { + if (exclusive && gapSide == DoubleGap && mult2 == numTwoTracks) { registry.fill(HIST("os_pk_rot_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); } } @@ -1210,9 +1328,9 @@ struct SginclusivePhiKstarSD { } } if (fourpion) { - if (gapSide == 2 && mult2 == 4) { + if (gapSide == DoubleGap && mult2 == numFourTracks) { ROOT::Math::PxPyPzMVector pair1, pair2, pair3, pair4; - if (onlyPionTracksp.size() == 2 && onlyPionTracksn.size() == 2) { + if (static_cast(onlyPionTracksp.size()) == numTwoTracks && static_cast(onlyPionTracksn.size()) == numTwoTracks) { ROOT::Math::PxPyPzMVector k1 = onlyPionTracksp.at(0); ROOT::Math::PxPyPzMVector k2 = onlyPionTracksp.at(1); ROOT::Math::PxPyPzMVector k3 = onlyPionTracksn.at(0); @@ -1238,8 +1356,8 @@ struct SginclusivePhiKstarSD { registry.fill(HIST("costheta_dis1"), costhetaPair1); registry.fill(HIST("costheta_vs_phi1"), costhetaPair1, phiPair1); } - if (onlyPionTracksp.size() != 2 && onlyPionTracksn.size() != 2) { - if (onlyPionTracksp.size() + onlyPionTracksn.size() != 4) + if (static_cast(onlyPionTracksp.size()) != numTwoTracks && static_cast(onlyPionTracksn.size()) != numTwoTracks) { + if (static_cast(onlyPionTracksp.size()) + static_cast(onlyPionTracksn.size()) != numFourTracks) return; ROOT::Math::PxPyPzMVector l1 = onlyPionTrackspm.at(0); ROOT::Math::PxPyPzMVector l2 = onlyPionTrackspm.at(1); @@ -1292,13 +1410,13 @@ struct SginclusivePhiKstarSD { v01 = v0 + v1; // Opposite sign pairs if (track1.sign() != track2.sign()) { - if (truegapSide1 == 0) { + if (truegapSide1 == SingleGapA) { registry.fill(HIST("os_KK_mix_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (truegapSide1 == 1) { + if (truegapSide1 == SingleGapC) { registry.fill(HIST("os_KK_mix_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (truegapSide1 == 2) { + if (truegapSide1 == DoubleGap) { registry.fill(HIST("os_KK_mix_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); } } @@ -1315,13 +1433,13 @@ struct SginclusivePhiKstarSD { v01 = v0 + v1; // Opposite sign pairs if (track1.sign() != track2.sign()) { - if (truegapSide1 == 0) { + if (truegapSide1 == SingleGapA) { registry.fill(HIST("os_pk_mix_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (truegapSide1 == 1) { + if (truegapSide1 == SingleGapC) { registry.fill(HIST("os_pk_mix_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (truegapSide1 == 2) { + if (truegapSide1 == DoubleGap) { registry.fill(HIST("os_pk_mix_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); } } @@ -1469,47 +1587,86 @@ struct SginclusivePhiKstarSD { // ............................................................................................................... void processReco(CC const& collision, TCs const& tracks, aod::UDMcCollisions const& /*mccollisions*/, aod::UDMcParticles const& /*McParts*/) { + registry.fill(HIST("Reco/hEventCutFlowMC"), 0); + if (!collision.has_udMcCollision()) return; + registry.fill(HIST("Reco/hEventCutFlowMC"), 1); + + if (qaMC) + rQA.fill(HIST("hOcc_before_mc"), collision.occupancyInTime()); + auto mccoll = collision.udMcCollision(); if (mccoll.generatorsID() != generatedId) return; + registry.fill(HIST("Reco/hEventCutFlowMC"), 2); + float fitCut[5] = {fv0Cut, ft0aCut, ft0cCut, fddaCut, fddcCut}; std::vector parameters = {pvCut, dcazCut, dcaxyCut, tpcChi2Cut, tpcNClsFindableCut, itsChi2Cut, etaCut, ptCut}; int truegapSide = sgSelector.trueGap(collision, fitCut[0], fitCut[1], fitCut[2], zdcCut); registry.get(HIST("Reco/Stat"))->Fill(4.0, 1.); + registry.get(HIST("Reco/Stat"))->Fill(truegapSide, 1.); + if (truegapSide != gapsideMC) + return; + registry.fill(HIST("Reco/hEventCutFlowMC"), 3); // Partition pvContributors = aod::udtrack::isPVContributor == true; // pvContributors.bindTable(tracks); + if (std::abs(collision.posZ()) > vzCut) return; + registry.fill(HIST("Reco/hEventCutFlowMC"), 4); + if (std::abs(collision.occupancyInTime()) > occCut) return; + registry.fill(HIST("Reco/hEventCutFlowMC"), 5); + if (std::abs(collision.hadronicRate()) > hadronicRate) return; + registry.fill(HIST("Reco/hEventCutFlowMC"), 6); + if (useTrs != -1 && collision.trs() != useTrs) return; + registry.fill(HIST("Reco/hEventCutFlowMC"), 7); + if (useTrofs != -1 && collision.trofs() != useTrofs) return; + registry.fill(HIST("Reco/hEventCutFlowMC"), 8); + if (useHmpr != -1 && collision.hmpr() != useHmpr) return; + registry.fill(HIST("Reco/hEventCutFlowMC"), 9); + if (useTfb != -1 && collision.tfb() != useTfb) return; + registry.fill(HIST("Reco/hEventCutFlowMC"), 10); + if (useItsrofb != -1 && collision.itsROFb() != useItsrofb) return; + registry.fill(HIST("Reco/hEventCutFlowMC"), 11); + if (useSbp != -1 && collision.sbp() != useSbp) return; + registry.fill(HIST("Reco/hEventCutFlowMC"), 12); + if (useZvtxftovpv != -1 && collision.zVtxFT0vPV() != useZvtxftovpv) return; + registry.fill(HIST("Reco/hEventCutFlowMC"), 13); + if (useVtxItsTpc != -1 && collision.vtxITSTPC() != useVtxItsTpc) return; + registry.fill(HIST("Reco/hEventCutFlowMC"), 14); + if (!isGoodRCTflag(collision)) return; + registry.fill(HIST("Reco/hEventCutFlowMC"), 15); + if (upcflag != -1 && collision.flags() != upcflag) return; + registry.fill(HIST("Reco/hEventCutFlowMC"), 16); + + if (qaMC) + rQA.fill(HIST("hOcc_after_mc"), collision.occupancyInTime()); - registry.get(HIST("Reco/Stat"))->Fill(truegapSide, 1.); - if (truegapSide != gapsideMC) - return; // registry.get(HIST("Reco/nPVContributors"))->Fill(pvContributors.size(), 1.); ROOT::Math::PxPyPzMVector vphi; ROOT::Math::PxPyPzMVector vkstar; @@ -1522,23 +1679,33 @@ struct SginclusivePhiKstarSD { ROOT::Math::PxPyPzMVector vr01g; int t1 = 0; if (truegapSide == 0) { - registry.fill(HIST("V0A_0_mc"), collision.totalFV0AmplitudeA()); - registry.fill(HIST("FT0A_0_mc"), collision.totalFT0AmplitudeA()); - registry.fill(HIST("FT0C_0_mc"), collision.totalFT0AmplitudeC()); - registry.fill(HIST("ZDC_A_0_mc"), collision.energyCommonZNA()); - registry.fill(HIST("ZDC_C_0_mc"), collision.energyCommonZNC()); + if (qaMC) { + rQA.fill(HIST("V0A_0_mc"), collision.totalFV0AmplitudeA()); + rQA.fill(HIST("FT0A_0_mc"), collision.totalFT0AmplitudeA()); + rQA.fill(HIST("FT0C_0_mc"), collision.totalFT0AmplitudeC()); + rQA.fill(HIST("ZDC_A_0_mc"), collision.energyCommonZNA()); + rQA.fill(HIST("ZDC_C_0_mc"), collision.energyCommonZNC()); + } } if (truegapSide == 1) { - registry.fill(HIST("V0A_1_mc"), collision.totalFV0AmplitudeA()); - registry.fill(HIST("FT0A_1_mc"), collision.totalFT0AmplitudeA()); - registry.fill(HIST("FT0C_1_mc"), collision.totalFT0AmplitudeC()); - registry.fill(HIST("ZDC_A_1_mc"), collision.energyCommonZNA()); - registry.fill(HIST("ZDC_C_1_mc"), collision.energyCommonZNC()); + if (qaMC) { + rQA.fill(HIST("V0A_1_mc"), collision.totalFV0AmplitudeA()); + rQA.fill(HIST("FT0A_1_mc"), collision.totalFT0AmplitudeA()); + rQA.fill(HIST("FT0C_1_mc"), collision.totalFT0AmplitudeC()); + rQA.fill(HIST("ZDC_A_1_mc"), collision.energyCommonZNA()); + rQA.fill(HIST("ZDC_C_1_mc"), collision.energyCommonZNC()); + } } for (const auto& tr1 : tracks) { if (!tr1.has_udMcParticle()) continue; auto mcPart1 = tr1.udMcParticle(); + + if (qaMC) { + rQA.fill(HIST("hDcaxy_all_before_mc"), tr1.dcaXY()); + rQA.fill(HIST("hDcaz_all_before_mc"), tr1.dcaZ()); + } + registry.get(HIST("Reco/tr_dcaz_1"))->Fill(tr1.dcaZ(), 1.); registry.get(HIST("Reco/tr_dcaxy_1"))->Fill(tr1.dcaXY(), 1.); registry.get(HIST("Reco/tr_chi2ncl_1"))->Fill(tr1.tpcChi2NCl(), 1.); @@ -1555,21 +1722,43 @@ struct SginclusivePhiKstarSD { registry.get(HIST("Reco/tr_itsChi2NCl_2"))->Fill(tr1.itsChi2NCl(), 1.); v0.SetCoordinates(tr1.px(), tr1.py(), tr1.pz(), o2::constants::physics::MassPionCharged); - registry.fill(HIST("tpc_dedx_mc"), v0.P(), tr1.tpcSignal()); - registry.fill(HIST("tof_beta_mc"), v0.P(), tr1.beta()); - registry.fill(HIST("tof_nsigma_kaon_f_mc"), v0.Pt(), tr1.tofNSigmaKa()); - registry.fill(HIST("tof_nsigma_pion_f_mc"), v0.Pt(), tr1.tofNSigmaPi()); - registry.fill(HIST("tpc_nsigma_kaon_f_mc"), v0.Pt(), tr1.tpcNSigmaKa()); - registry.fill(HIST("tpc_nsigma_pion_f_mc"), v0.Pt(), tr1.tpcNSigmaPi()); + if (qaMC) { + rQA.fill(HIST("hDcaxy_all_after_mc"), tr1.dcaXY()); + rQA.fill(HIST("hDcaz_all_after_mc"), tr1.dcaZ()); + rQA.fill(HIST("hEta_all_after_mc"), v0.Eta()); + + rQA.fill(HIST("tpc_dedx_mc"), v0.P(), tr1.tpcSignal()); + rQA.fill(HIST("tof_beta_mc"), v0.P(), tr1.beta()); + rQA.fill(HIST("tof_nsigma_kaon_all_mc"), v0.Pt(), tr1.tofNSigmaKa()); + rQA.fill(HIST("tof_nsigma_pion_all_mc"), v0.Pt(), tr1.tofNSigmaPi()); + rQA.fill(HIST("tpc_nsigma_kaon_all_mc"), v0.Pt(), tr1.tpcNSigmaKa()); + rQA.fill(HIST("tpc_nsigma_pion_all_mc"), v0.Pt(), tr1.tpcNSigmaPi()); + } if (selectionPIDKaon1(tr1)) { - registry.fill(HIST("tpc_nsigma_kaon_mc"), v0.Pt(), tr1.tpcNSigmaKa()); - registry.fill(HIST("tof_nsigma_kaon_mc"), v0.Pt(), tr1.tofNSigmaKa()); - registry.fill(HIST("tpc_tof_nsigma_kaon_mc"), tr1.tpcNSigmaKa(), tr1.tofNSigmaKa()); + if (qaMC) { + rQA.fill(HIST("tpc_dedx_kaon_mc"), v0.P(), tr1.tpcSignal()); + rQA.fill(HIST("tof_beta_kaon_mc"), v0.P(), tr1.beta()); + rQA.fill(HIST("tpc_nsigma_kaon_mc"), v0.Pt(), tr1.tpcNSigmaKa()); + rQA.fill(HIST("tof_nsigma_kaon_mc"), v0.Pt(), tr1.tofNSigmaKa()); + rQA.fill(HIST("tpc_tof_nsigma_kaon_mc"), tr1.tpcNSigmaKa(), tr1.tofNSigmaKa()); + rQA.fill(HIST("hEta_ka_mc"), v0.Eta()); + rQA.fill(HIST("hRap_ka_mc"), v0.Rapidity()); + rQA.fill(HIST("hDcaxy_ka_mc"), tr1.dcaXY()); + rQA.fill(HIST("hDcaz_ka_mc"), tr1.dcaZ()); + } } if (selectionPIDPion1(tr1)) { - registry.fill(HIST("tpc_nsigma_pion_mc"), v0.Pt(), tr1.tpcNSigmaPi()); - registry.fill(HIST("tof_nsigma_pion_mc"), v0.Pt(), tr1.tofNSigmaPi()); - registry.fill(HIST("tpc_tof_nsigma_pion_mc"), tr1.tpcNSigmaPi(), tr1.tofNSigmaPi()); + if (qaMC) { + rQA.fill(HIST("tpc_dedx_pion_mc"), v0.P(), tr1.tpcSignal()); + rQA.fill(HIST("tof_beta_pion_mc"), v0.P(), tr1.beta()); + rQA.fill(HIST("tpc_nsigma_pion_mc"), v0.Pt(), tr1.tpcNSigmaPi()); + rQA.fill(HIST("tof_nsigma_pion_mc"), v0.Pt(), tr1.tofNSigmaPi()); + rQA.fill(HIST("tpc_tof_nsigma_pion_mc"), tr1.tpcNSigmaPi(), tr1.tofNSigmaPi()); + rQA.fill(HIST("hEta_pi_mc"), v0.Eta()); + rQA.fill(HIST("hRap_pi_mc"), v0.Rapidity()); + rQA.fill(HIST("hDcaxy_pi_mc"), tr1.dcaXY()); + rQA.fill(HIST("hDcaz_pi_mc"), tr1.dcaZ()); + } } t1++; From 38cb531205e45a126974f1cc0a8043e36876bb77 Mon Sep 17 00:00:00 2001 From: Victor Gonzalez Date: Sun, 21 Sep 2025 23:39:04 +0200 Subject: [PATCH 481/986] [PWGCF] DptDpt - Independent CCDB date for PID adjustments (#13066) Co-authored-by: Victor --- PWGCF/TableProducer/dptDptFilter.cxx | 13 +++++++------ PWGCF/TableProducer/dptDptFilter.h | 2 +- PWGCF/Tasks/dptDptCorrelations.cxx | 10 +++++----- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/PWGCF/TableProducer/dptDptFilter.cxx b/PWGCF/TableProducer/dptDptFilter.cxx index 25f54b5bdc8..d0feab6ac6d 100644 --- a/PWGCF/TableProducer/dptDptFilter.cxx +++ b/PWGCF/TableProducer/dptDptFilter.cxx @@ -540,7 +540,8 @@ struct DptDptFilter { Configurable url{"url", "http://ccdb-test.cern.ch:8080", "The CCDB url for the input file"}; Configurable pathNameCorrections{"pathNameCorrections", "", "The CCDB path for the corrections file. Default \"\", i.e. don't load from CCDB"}; Configurable pathNamePID{"pathNamePID", "", "The CCDB path for the PID adjusts file. Default \"\", i.e. don't load from CCDB"}; - Configurable date{"date", "20220307", "The CCDB date for the input file"}; + Configurable dateCorrections{"dateCorrections", "20220307", "The CCDB date for the corrections input file"}; + Configurable datePID{"datePID", "20220307", "The CCDB date for the PID adjustments input file"}; Configurable suffix{"suffix", "", "Dataset period suffix for metadata discrimination"}; } cfginputfile; Configurable cfgFullDerivedData{"cfgFullDerivedData", false, "Produce the full derived data for external storage. Default false"}; @@ -1101,7 +1102,7 @@ struct DptDptFilterTracks { std::string cfgCCDBUrl{"http://ccdb-test.cern.ch:8080"}; std::string cfgCCDBPathNamePID{""}; - std::string cfgCCDBDate{"20220307"}; + std::string cfgCCDBDatePID{"20220307"}; Configurable cfgOutDebugInfo{"cfgOutDebugInfo", false, "Out detailed debug information per track into a text file. Default false"}; Configurable cfgFullDerivedData{"cfgFullDerivedData", false, "Produce the full derived data for external storage. Default false"}; @@ -1172,7 +1173,7 @@ struct DptDptFilterTracks { /* self configure the CCDB access to the input file */ getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.url", cfgCCDBUrl, false); getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.pathNamePID", cfgCCDBPathNamePID, false); - getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.date", cfgCCDBDate, false); + getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.datePID", cfgCCDBDatePID, false); /* create the output list which will own the task histograms */ TList* fOutputList = new TList(); @@ -1439,9 +1440,9 @@ struct DptDptFilterTracks { using namespace analysis::dptdptfilter; /* let's get a potential PID adjustment */ - if ((cfgCCDBDate.length() > 0) && (cfgCCDBPathNamePID.length() > 0) && !storedccdbinfo) { - LOGF(info, "Getting information for PID adjustment from %s, at %s", cfgCCDBPathNamePID.c_str(), cfgCCDBDate.c_str()); - TList* pidinfo = getCCDBInput(ccdb, cfgCCDBPathNamePID.c_str(), cfgCCDBDate.c_str()); + if ((cfgCCDBDatePID.length() > 0) && (cfgCCDBPathNamePID.length() > 0) && !storedccdbinfo) { + LOGF(info, "Getting information for PID adjustment from %s, at %s", cfgCCDBPathNamePID.c_str(), cfgCCDBDatePID.c_str()); + TList* pidinfo = getCCDBInput(ccdb, cfgCCDBPathNamePID.c_str(), cfgCCDBDatePID.c_str()); if (pidinfo != nullptr) { pidselector.storePIDAdjustments(pidinfo); } diff --git a/PWGCF/TableProducer/dptDptFilter.h b/PWGCF/TableProducer/dptDptFilter.h index 5af712a2ec7..1920505d46a 100644 --- a/PWGCF/TableProducer/dptDptFilter.h +++ b/PWGCF/TableProducer/dptDptFilter.h @@ -1163,7 +1163,7 @@ inline float extractMultiplicity(CollisionObject const& collision, CentMultEstim return collision.multFT0A(); break; case CentMultFT0C: - return collision.multFT0M(); + return collision.multFT0C(); break; case CentMultNTPV: return collision.multNTracksPV(); diff --git a/PWGCF/Tasks/dptDptCorrelations.cxx b/PWGCF/Tasks/dptDptCorrelations.cxx index 3b5877a9966..e6ee088eca0 100644 --- a/PWGCF/Tasks/dptDptCorrelations.cxx +++ b/PWGCF/Tasks/dptDptCorrelations.cxx @@ -909,7 +909,7 @@ struct DptDptCorrelations { bool loadfromccdb = false; std::string cfgCCDBUrl{"http://ccdb-test.cern.ch:8080"}; std::string cfgCCDBPathNameCorrections{""}; - std::string cfgCCDBDate{"20220307"}; + std::string cfgCCDBDateCorrections{"20220307"}; std::string cfgCCDBSuffix{""}; /* pair conversion suppression defaults */ @@ -973,9 +973,9 @@ struct DptDptCorrelations { /* self configure the CCDB access to the input file */ getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.url", cfgCCDBUrl, false); getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.pathNameCorrections", cfgCCDBPathNameCorrections, false); - getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.date", cfgCCDBDate, false); + getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.dateCorrections", cfgCCDBDateCorrections, false); getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgCCDB.suffix", cfgCCDBSuffix, false); - loadfromccdb = (cfgCCDBDate.length() > 0) && (cfgCCDBPathNameCorrections.length() > 0); + loadfromccdb = (cfgCCDBDateCorrections.length() > 0) && (cfgCCDBPathNameCorrections.length() > 0); /* update the potential binning change */ etabinwidth = (etaup - etalow) / static_cast(etabins); @@ -1230,7 +1230,7 @@ struct DptDptCorrelations { if (ccdblst == nullptr) { if (loadfromccdb) { - ccdblst = getCCDBInput(ccdb, cfgCCDBPathNameCorrections.c_str(), cfgCCDBDate.c_str(), true, cfgCCDBSuffix); + ccdblst = getCCDBInput(ccdb, cfgCCDBPathNameCorrections.c_str(), cfgCCDBDateCorrections.c_str(), true, cfgCCDBSuffix); } } @@ -1326,7 +1326,7 @@ struct DptDptCorrelations { if (ccdblst == nullptr) { if (loadfromccdb) { - ccdblst = getCCDBInput(ccdb, cfgCCDBPathNameCorrections.c_str(), cfgCCDBDate.c_str(), true, cfgCCDBSuffix); + ccdblst = getCCDBInput(ccdb, cfgCCDBPathNameCorrections.c_str(), cfgCCDBDateCorrections.c_str(), true, cfgCCDBSuffix); } } From b4a3bdf20ab1b5920f48ce5fdf6832762ad4b2a1 Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Mon, 22 Sep 2025 07:54:03 +0800 Subject: [PATCH 482/986] [PWGHF] Update list of MC productions that require TOF PID recalibration for HF (#13067) --- PWGHF/TableProducer/mcPidTof.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PWGHF/TableProducer/mcPidTof.cxx b/PWGHF/TableProducer/mcPidTof.cxx index 70e3d04f17e..3cb4d814318 100644 --- a/PWGHF/TableProducer/mcPidTof.cxx +++ b/PWGHF/TableProducer/mcPidTof.cxx @@ -755,8 +755,8 @@ struct mcPidTof { Configurable ccdbPath{"ccdbPath", "Users/f/fgrosa/RecalibmcPidTof/", "path for MC recalibration objects in CCDB"}; } mcRecalib; - // list of productions for which the postcalibrations must be turned off (FT0 digitisation fixed) - const std::vector prodNoPostCalib = {"LHC24h1c"}; + // list of productions for which the postcalibrations is needed (bug in FT0 digitisation) + const std::vector prodPostCalib = {"LHC24d3a", "LHC24d3b", "LHC24e3", "LHC24g5", "LHC24g6", "LHC24h2", "LHC24i1", "LHC24i2", "LHC24i3", "LHC24i4", "LHC24j6", "LHC24k3", "LHC24f3c", "LHC25e2", "LHC24h1b", "LHC25e4", "LHC25f5", "LHC25e8", "LHC25e9", "LHC25e10", "LHC25e11", "LHC23k4"}; bool enableMcRecalib{false}; HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -894,7 +894,7 @@ struct mcPidTof { std::map metadata; if (metadataInfo.isFullyDefined()) { metadata["RecoPassName"] = metadataInfo.get("AnchorPassName"); - if (std::find(prodNoPostCalib.begin(), prodNoPostCalib.end(), metadataInfo.get("LPMProductionTag")) != prodNoPostCalib.end()) { + if (std::find(prodPostCalib.begin(), prodPostCalib.end(), metadataInfo.get("LPMProductionTag")) == prodPostCalib.end()) { enableMcRecalib = false; LOGP(warn, "Nsigma postcalibrations turned off for {} (new MC productions have FT0 digitisation fixed)", metadataInfo.get("LPMProductionTag")); } From f239406f2ba80bcc386fb46612b4538ff603f5bb Mon Sep 17 00:00:00 2001 From: Rashi gupta <167059733+rashigupt@users.noreply.github.com> Date: Mon, 22 Sep 2025 10:48:28 +0530 Subject: [PATCH 483/986] [PWGHF] Add pT histogram in MC gen for efficiency calculation (#12955) --- .../TableProducer/correlatorHfeHadrons.cxx | 93 ++++++++++++-- .../electronSelectionWithTpcEmcal.cxx | 119 +++++++++++------- 2 files changed, 156 insertions(+), 56 deletions(-) diff --git a/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx index 0a824c1e9b5..8b3b8186e8a 100644 --- a/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx @@ -36,6 +36,8 @@ #include #include +#include + #include #include @@ -48,7 +50,7 @@ using namespace o2::aod::hf_sel_electron; std::vector zBins{VARIABLE_WIDTH, -10.0, -2.5, 2.5, 10.0}; std::vector multBins{VARIABLE_WIDTH, 0., 200., 500.0, 5000.}; std::vector multBinsMcGen{VARIABLE_WIDTH, 0., 20., 50.0, 500.}; // In MCGen multiplicity is defined by counting primaries -using BinningType = ColumnBinningPolicy>; +using BinningType = ColumnBinningPolicy>; BinningType corrBinning{{zBins, multBins}, true}; using BinningTypeMcGen = ColumnBinningPolicy; @@ -69,10 +71,20 @@ struct HfCorrelatorHfeHadrons { Configurable etaTrackMin{"etaTrackMin", -0.8f, "Eta range for associated hadron tracks"}; Configurable dcaXYTrackMax{"dcaXYTrackMax", 0.5f, "DCA XY cut"}; Configurable dcaZTrackMax{"dcaZTrackMax", 1.0f, "DCA Z cut"}; + Configurable requireEmcal{"requireEmcal", true, "Require electron to be in EMCal"}; + + // Sigma cut for non-EMCal electrons + Configurable tofNSigmaEl{"tofNSigmaEl", 3.0, "Sigma cut for electrons not in EMCal"}; + Configurable tpcNsigmaElectronMin{"tpcNsigmaElectronMin", -0.5f, "min Electron TPCnsigma"}; + Configurable tpcNsigmaElectronMax{"tpcNsigmaElectronMax", 3.0f, "max Electron TPCnsigma"}; // Electron hadron correlation condition Configurable ptCondition{"ptCondition", true, "Electron pT should be greater than associate particle pT"}; + Configurable eventFractionToAnalyze{"eventFractionToAnalyze", -1, "Fraction of events to analyze (use only for ME offline on very large samples)"}; + + TRandom3 rnd{0}; + SliceCache cache; using TableCollisions = o2::soa::Filtered>; using TableCollision = TableCollisions::iterator; @@ -87,10 +99,12 @@ struct HfCorrelatorHfeHadrons { Preslice perCol = aod::track::collisionId; Preslice perCollision = aod::hf_sel_electron::collisionId; + ConfigurableAxis binsPosZ{"binsPosZ", {100, -10., 10.}, "primary vertex z coordinate"}; ConfigurableAxis binsDeltaEta{"binsDeltaEta", {30, -1.8, 1.8}, "#it{#Delta#eta}"}; ConfigurableAxis binsDeltaPhi{"binsDeltaPhi", {32, -o2::constants::math::PIHalf, 3. * o2::constants::math::PIHalf}, "#it{#Delta#varphi}"}; ConfigurableAxis binsPt{"binsPt", {50, 0.0, 50}, "#it{p_{T}}(GeV/#it{c})"}; ConfigurableAxis binsPoolBin{"binsPoolBin", {9, 0., 9.}, "PoolBin"}; + ConfigurableAxis binsNSigma{"binsNSigma", {30, -15., 15.}, "#it{#sigma_{TPC}}"}; HistogramRegistry registry{ "registry", @@ -98,17 +112,27 @@ struct HfCorrelatorHfeHadrons { void init(InitContext&) { + AxisSpec axisPosZ = {binsPosZ, "Pos Z"}; AxisSpec axisDeltaEta = {binsDeltaEta, "#Delta #eta = #eta_{Electron}- #eta_{Hadron}"}; AxisSpec axisDeltaPhi = {binsDeltaPhi, "#Delta #varphi = #varphi_{Electron}- #varphi_{Hadron}"}; AxisSpec axisPt = {binsPt, "#it{p_{T}}(GeV/#it{c})"}; AxisSpec axisPoolBin = {binsPoolBin, "PoolBin"}; + AxisSpec axisNSigma = {binsNSigma, "it{#sigma_{TPC}}"}; + registry.add("hZvertex", "z vertex", {HistType::kTH1D, {axisPosZ}}); + registry.add("hNevents", "No of events", {HistType::kTH1D, {{3, 1, 4}}}); registry.add("hInclusiveEHCorrel", "Sparse for Delta phi and Delta eta Inclusive Electron with Hadron;p_{T}^{e} (GeV#it{/c});p_{T}^{h} (GeV#it{/c});#Delta#varphi;#Delta#eta;", {HistType::kTHnSparseF, {{axisPt}, {axisPt}, {axisDeltaPhi}, {axisDeltaEta}}}); registry.add("hLSEHCorrel", "Sparse for Delta phi and Delta eta Like sign Electron pair with Hadron;p_{T}^{e} (GeV#it{/c});p_{T}^{h} (GeV#it{/c});#Delta#varphi;#Delta#eta;", {HistType::kTHnSparseF, {{axisPt}, {axisPt}, {axisDeltaPhi}, {axisDeltaEta}}}); registry.add("hULSEHCorrel", "Sparse for Delta phi and Delta eta UnLike sign Electron pair with Hadron;p_{T}^{e} (GeV#it{/c});p_{T}^{h} (GeV#it{/c});#Delta#varphi;#Delta#eta;", {HistType::kTHnSparseF, {{axisPt}, {axisPt}, {axisDeltaPhi}, {axisDeltaEta}}}); + registry.add("hTofnSigmaVsP", " Tof nSigma info vs P; n#sigma;#it{p} (GeV#it{/c});passEMcal;", {HistType::kTH2F, {{axisNSigma}, {axisPt}}}); + registry.add("hTpcnSigmaVsP", " TPC nSigma info vs P; n#sigma;#it{p} (GeV#it{/c});passEMcal;", {HistType::kTH2F, {{axisNSigma}, {axisPt}}}); + registry.add("hMCgenNonHfEHCorrel", "Sparse for Delta phi and Delta eta for McGen Non Hf Electron with Hadron;p_{T}^{e} (GeV#it{/c});p_{T}^{h} (GeV#it{/c});#Delta#varphi;#Delta#eta;", {HistType::kTHnSparseF, {{axisPt}, {axisPt}, {axisDeltaPhi}, {axisDeltaEta}}}); registry.add("hMCgenInclusiveEHCorrl", "Sparse for Delta phi and Delta eta for McGen Electron pair with Hadron;p_{T}^{e} (GeV#it{/c});p_{T}^{h} (GeV#it{/c});#Delta#varphi;#Delta#eta;", {HistType::kTHnSparseF, {{axisPt}, {axisPt}, {axisDeltaPhi}, {axisDeltaEta}}}); registry.add("hptElectron", "hptElectron", {HistType::kTH1D, {axisPt}}); + registry.add("hptHadron", "hptHadron", {HistType::kTH1D, {axisPt}}); + registry.add("hMCgenptHadron", "hMCgenptHadron", {HistType::kTH1D, {axisPt}}); + registry.add("hMCgenptHadronprimary", "hMCgenptHadronprimary", {HistType::kTH1D, {axisPt}}); registry.add("hMixEventInclusiveEHCorrl", "Sparse for mix event Delta phi and Delta eta Inclusive Electron with Hadron;p_{T}^{e} (GeV#it{/c});p_{T}^{h} (GeV#it{/c});#Delta#varphi;#Delta#eta;", {HistType::kTHnSparseF, {{axisPt}, {axisPt}, {axisDeltaPhi}, {axisDeltaEta}}}); registry.add("hMixEventLSEHCorrel", "Sparse for mix event Delta phi and Delta eta Like sign Electron pair with Hadron;p_{T}^{e} (GeV#it{/c});p_{T}^{h} (GeV#it{/c});#Delta#varphi;#Delta#eta;", {HistType::kTHnSparseF, {{axisPt}, {axisPt}, {axisDeltaPhi}, {axisDeltaEta}}}); @@ -147,18 +171,30 @@ struct HfCorrelatorHfeHadrons { { if (!(isRun3 ? collision.sel8() : (collision.sel7() && collision.alias_bit(kINT7)))) return; - int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFV0M())); + int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFT0M())); auto bc = collision.template bc_as(); int gCollisionId = collision.globalIndex(); int64_t timeStamp = bc.timestamp(); + bool skipEventTableFilling = false; + if (eventFractionToAnalyze > 0) { + if (rnd.Uniform(0, 1) > eventFractionToAnalyze) { + skipEventTableFilling = true; + } + } + + registry.fill(HIST("hNevents"), 1); // Add hadron Table For Mix Event Electron Hadron correlation - for (const auto& hTrack : tracks) { - if (!selAssoHadron(hTrack)) { - continue; + if (!skipEventTableFilling) { + registry.fill(HIST("hZvertex"), collision.posZ()); + for (const auto& hTrack : tracks) { + if (!selAssoHadron(hTrack)) { + continue; + } + registry.fill(HIST("hTracksBin"), poolBin); + registry.fill(HIST("hptHadron"), hTrack.pt()); + entryHadron(hTrack.phi(), hTrack.eta(), hTrack.pt(), poolBin, gCollisionId, timeStamp); } - registry.fill(HIST("hTracksBin"), poolBin); - entryHadron(hTrack.phi(), hTrack.eta(), hTrack.pt(), poolBin, gCollisionId, timeStamp); } // Construct Deta Phi between electrons and hadrons @@ -171,16 +207,31 @@ struct HfCorrelatorHfeHadrons { ptElectron = eTrack.ptTrack(); phiElectron = eTrack.phiTrack(); etaElectron = eTrack.etaTrack(); + bool acceptElectron = false; double deltaPhi = -999; double deltaEta = -999; double ptHadron = -999; double etaHadron = -999; double phiHadron = -999; + // EMCal electron + if (eTrack.isEmcal() && requireEmcal) { + acceptElectron = true; + } else if (!eTrack.isEmcal() && !requireEmcal) { + + // Apply sigma cut + if (std::abs(eTrack.tofNSigmaElTrack()) < tofNSigmaEl && eTrack.tpcNSigmaElTrack() > tpcNsigmaElectronMin && + eTrack.tpcNSigmaElTrack() < tpcNsigmaElectronMax) { + registry.fill(HIST("hTofnSigmaVsP"), eTrack.tofNSigmaElTrack(), eTrack.ptTrack()); + registry.fill(HIST("hTpcnSigmaVsP"), eTrack.tpcNSigmaElTrack(), eTrack.ptTrack()); + acceptElectron = true; + } + } - if (!eTrack.isEmcal()) { - continue; + if (!acceptElectron) { + continue; // skip electron if not passing criteria } + registry.fill(HIST("hptElectron"), ptElectron); int nElectronLS = 0; int nElectronUS = 0; @@ -199,8 +250,10 @@ struct HfCorrelatorHfeHadrons { } } - registry.fill(HIST("hElectronBin"), poolBin); - entryElectron(phiElectron, etaElectron, ptElectron, nElectronLS, nElectronUS, poolBin, gCollisionId, timeStamp); + if (!skipEventTableFilling) { + registry.fill(HIST("hElectronBin"), poolBin); + entryElectron(phiElectron, etaElectron, ptElectron, nElectronLS, nElectronUS, poolBin, gCollisionId, timeStamp); + } for (const auto& hTrack : tracks) { // Apply Hadron cut @@ -260,7 +313,7 @@ struct HfCorrelatorHfeHadrons { double ptHadronMix = -999; double etaHadronMix = -999; double phiHadronMix = -999; - int poolBin = corrBinning.getBin(std::make_tuple(c2.posZ(), c2.multFV0M())); + int poolBin = corrBinning.getBin(std::make_tuple(c2.posZ(), c2.multFT0M())); for (const auto& [t1, t2] : combinations(CombinationsFullIndexPolicy(tracks1, tracks2))) { if (!t1.isEmcal()) { continue; @@ -332,9 +385,25 @@ struct HfCorrelatorHfeHadrons { BinningTypeMcGen corrBinningMcGen{{zBins, multBinsMcGen}, true}; int poolBin = corrBinningMcGen.getBin(std::make_tuple(mcCollision.posZ(), mcCollision.multMCFT0A())); + for (const auto& particleMc : mcParticles) { + if (particleMc.eta() < etaTrackMin || particleMc.eta() > etaTrackMax) { + continue; + } + if (particleMc.pt() < ptTrackMin) { + continue; + } + + registry.fill(HIST("hMCgenptHadron"), particleMc.pt()); + if (particleMc.isPhysicalPrimary()) { + + registry.fill(HIST("hMCgenptHadronprimary"), particleMc.pt()); + } + } + double ptElectron = 0; double phiElectron = 0; double etaElectron = 0; + for (const auto& electronMc : electron) { double ptHadron = 0; double phiHadron = 0; diff --git a/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx b/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx index 7dac8c0a83d..7edfc393c8f 100644 --- a/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx +++ b/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx @@ -118,6 +118,10 @@ struct HfElectronSelectionWithTpcEmcal { Configurable m20EmcClusterElectronMin{"m20EmcClusterElectronMin", 0.0f, "min Electron EMCal Cluster M20"}; Configurable tpcNsigmaElectronMin{"tpcNsigmaElectronMin", -0.5f, "min Electron TPCnsigma"}; Configurable tpcNsigmaElectronMax{"tpcNsigmaElectronMax", 3.0f, "max Electron TPCnsigma"}; + Configurable pdgCodeCharmMin{"pdgCodeCharmMin", 400, "Min Charm Hadron PdgCode"}; + Configurable pdgCodeCharmMax{"pdgCodeCharmMax", 600, "Max Charm Hadron PdgCode"}; + Configurable pdgCodeBeautyMin{"pdgCodeBeautyMin", 4000, "Min beauty Hadron PdgCode"}; + Configurable pdgCodeBeautyMax{"pdgCodeBeautyMax", 6000, "Max beauty Hadron PdgCode"}; using TableCollisions = o2::soa::Filtered>; using TableCollision = TableCollisions::iterator; @@ -550,12 +554,9 @@ struct HfElectronSelectionWithTpcEmcal { void processMcGen(McGenTableCollision const& mcCollision, aod::McParticles const& mcParticles) { - ///// electron identification bool isNonHfe = false; for (const auto& particleMc : mcParticles) { - if (!particleMc.isPhysicalPrimary()) - continue; if (!mcGensel(particleMc)) { continue; } @@ -565,63 +566,94 @@ struct HfElectronSelectionWithTpcEmcal { bool isEmbEta = false; bool isEmbPi0 = false; - if (particleMc.has_mothers()) { - // Check first mother - auto const& mother = particleMc.mothers_first_as(); + // Check first mother + auto const& mother = particleMc.mothers_first_as(); - if (std::abs(mother.pdgCode()) == kEta || std::abs(mother.pdgCode()) == kPi0 || std::abs(mother.pdgCode()) == kGamma) { - registry.fill(HIST("hMcgenAllNonHfeElectron"), particleMc.pt()); - if (mother.has_mothers()) { - auto const& gmother = mother.mothers_first_as(); - if (gmother.has_mothers()) { - auto const& ggmother = gmother.mothers_first_as(); + if (std::abs(mother.pdgCode()) == kEta || std::abs(mother.pdgCode()) == kPi0 || std::abs(mother.pdgCode()) == kGamma) { + registry.fill(HIST("hMcgenAllNonHfeElectron"), particleMc.pt()); + auto const& gmother = mother.mothers_first_as(); + auto const& ggmother = gmother.mothers_first_as(); + auto const& gggmother = ggmother.mothers_first_as(); - // cases to consider: eta->e, eta->pi0->e, eta->gamma->e, eta->pi0->gamma->e, pi0->e, pi0->gamma->e + // cases to consider: eta->e, eta->pi0->e, eta->gamma->e, eta->pi0->gamma->e, pi0->e, pi0->gamma->e - //================= eta->e ====================================== - if (std::abs(mother.pdgCode()) == kEta) { - isEmbEta = true; - } - //================= eta->pi0->e ====================================== + //================= eta->e ====================================== + if (std::abs(mother.pdgCode()) == kEta) { + if (mother.isPhysicalPrimary()) { + if ((std::abs(gmother.pdgCode()) >= pdgCodeCharmMin && std::abs(gmother.pdgCode()) < pdgCodeCharmMax) || + (std::abs(gmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(gmother.pdgCode()) < pdgCodeBeautyMax)) { + continue; + } + isEmbEta = true; + } + } + //================= eta->pi0->e ====================================== - if (std::abs(mother.pdgCode()) == kPi0) { - isEmbPi0 = true; // pi0 -> e + if (std::abs(mother.pdgCode()) == kPi0) { + if (mother.isPhysicalPrimary()) { + if ((std::abs(gmother.pdgCode()) >= pdgCodeCharmMin && std::abs(gmother.pdgCode()) < pdgCodeCharmMax) || + (std::abs(gmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(gmother.pdgCode()) < pdgCodeBeautyMax)) { + continue; + } + isEmbPi0 = true; // pi0 -> e + } - if (std::abs(gmother.pdgCode()) == kEta) { - isEmbEta = true; // eta->pi0-> e - } + if (std::abs(gmother.pdgCode()) == kEta) { + if (gmother.isPhysicalPrimary()) { + if ((std::abs(ggmother.pdgCode()) >= pdgCodeCharmMin && std::abs(ggmother.pdgCode()) < pdgCodeCharmMax) || + (std::abs(ggmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(ggmother.pdgCode()) < pdgCodeBeautyMax)) { + continue; } + isEmbEta = true; // eta->pi0-> e + } + } + } - /// ==================================== eta->gamma->e and eta->pi0->gamma->e============ - if (std::abs(mother.pdgCode()) == kGamma) { - if (std::abs(gmother.pdgCode()) == kEta) { - isEmbEta = true; // eta->gamma-> e - } - - if (std::abs(gmother.pdgCode()) == kPi0) { - isEmbPi0 = true; // pi0-> gamma-> e + /// ==================================== eta->gamma->e and eta->pi0->gamma->e============ + if (std::abs(mother.pdgCode()) == kGamma) { + if (std::abs(gmother.pdgCode()) == kEta) { + if (gmother.isPhysicalPrimary()) { + if ((std::abs(ggmother.pdgCode()) >= pdgCodeCharmMin && std::abs(ggmother.pdgCode()) < pdgCodeCharmMax) || + (std::abs(ggmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(ggmother.pdgCode()) < pdgCodeBeautyMax)) { + continue; + } + isEmbEta = true; // eta->gamma-> e + } + } - if (std::abs(ggmother.pdgCode()) == kEta) { + if (std::abs(gmother.pdgCode()) == kPi0) { + if (gmother.isPhysicalPrimary()) { + if ((std::abs(ggmother.pdgCode()) >= pdgCodeCharmMin && std::abs(ggmother.pdgCode()) < pdgCodeCharmMax) || + (std::abs(ggmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(ggmother.pdgCode()) < pdgCodeBeautyMax)) { + continue; + } + isEmbPi0 = true; // pi0-> gamma-> e + } - isEmbEta = true; // eta->pi0->gamma-> e - } + if (std::abs(ggmother.pdgCode()) == kEta) { + if (ggmother.isPhysicalPrimary()) { + if ((std::abs(gggmother.pdgCode()) >= pdgCodeCharmMin && std::abs(gggmother.pdgCode()) < pdgCodeCharmMax) || + (std::abs(gggmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(gggmother.pdgCode()) < pdgCodeBeautyMax)) { + continue; } + isEmbEta = true; // eta->pi0->gamma-> e } } } } - } - if (isEmbPi0 || isEmbEta) { - registry.fill(HIST("hMcgenNonHfeElectron"), particleMc.pt()); - isNonHfe = true; - if (isEmbPi0) { + if (isEmbPi0 || isEmbEta) { + registry.fill(HIST("hMcgenNonHfeElectron"), particleMc.pt()); + isNonHfe = true; + if (isEmbPi0) { - registry.fill(HIST("hPi0eEmbTrkPt"), particleMc.pt()); - } - if (isEmbEta) { - registry.fill(HIST("hEtaeEmbTrkPt"), particleMc.pt()); + registry.fill(HIST("hPi0eEmbTrkPt"), particleMc.pt()); + } + if (isEmbEta) { + registry.fill(HIST("hEtaeEmbTrkPt"), particleMc.pt()); + } } } + hfGenElectronSel(mcCollision.globalIndex(), particleMc.globalIndex(), particleMc.eta(), particleMc.phi(), particleMc.pt(), isNonHfe); } } @@ -629,7 +661,6 @@ struct HfElectronSelectionWithTpcEmcal { PROCESS_SWITCH(HfElectronSelectionWithTpcEmcal, processMcGen, "Process MC Gen mode", false); }; - WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; From d1959a4884594d352136771383502e9db462da59 Mon Sep 17 00:00:00 2001 From: emeninno <41640762+emeninno@users.noreply.github.com> Date: Mon, 22 Sep 2025 08:47:49 +0200 Subject: [PATCH 484/986] [PWGHF] removed unnecessary V0fcfull from the candidatecreatorcascade (#12934) --- .../TableProducer/candidateCreatorCascade.cxx | 45 +++---------------- 1 file changed, 6 insertions(+), 39 deletions(-) diff --git a/PWGHF/TableProducer/candidateCreatorCascade.cxx b/PWGHF/TableProducer/candidateCreatorCascade.cxx index 1bfe94031cb..74d78f6a00e 100644 --- a/PWGHF/TableProducer/candidateCreatorCascade.cxx +++ b/PWGHF/TableProducer/candidateCreatorCascade.cxx @@ -102,7 +102,6 @@ struct HfCandidateCreatorCascade { double bz = 0.; using V0full = soa::Join; - using V0fCfull = soa::Join; std::shared_ptr hCandidates; HistogramRegistry registry{"registry"}; @@ -169,7 +168,6 @@ struct HfCandidateCreatorCascade { aod::HfCascades const& rowsTrackIndexCasc, aod::V0sLinked const&, V0full const&, - V0fCfull const&, aod::TracksWCov const&, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) { @@ -224,42 +222,14 @@ struct HfCandidateCreatorCascade { dcaNegToPV = v0row.dcanegtopv(); v0cosPA = v0row.v0cosPA(); + int momIndSize = 6; constexpr int MomInd[6] = {9, 13, 14, 18, 19, 20}; // cov matrix elements for momentum component - for (int i = 0; i < 6; i++) { - covV[MomInd[i]] = v0row.momentumCovMat()[i]; - covV[i] = v0row.positionCovMat()[i]; - } - } else if (v0index.has_v0fCData()) { - // this V0 passes only V0-for-cascade selections, use that instead - auto v0row = v0index.template v0fCData_as(); - const auto& trackV0DaughPos = v0row.posTrack_as(); - const auto& trackV0DaughNeg = v0row.negTrack_as(); - posGlobalIndex = trackV0DaughPos.globalIndex(); - negGlobalIndex = trackV0DaughNeg.globalIndex(); - v0X = v0row.x(); - v0Y = v0row.y(); - v0Z = v0row.z(); - v0px = v0row.px(); - v0py = v0row.py(); - v0pz = v0row.pz(); - v0PosPx = v0row.pxpos(); - v0PosPy = v0row.pypos(); - v0PosPz = v0row.pzpos(); - v0NegPx = v0row.pxneg(); - v0NegPy = v0row.pyneg(); - v0NegPz = v0row.pzneg(); - dcaV0dau = v0row.dcaV0daughters(); - dcaPosToPV = v0row.dcapostopv(); - dcaNegToPV = v0row.dcanegtopv(); - v0cosPA = v0row.v0cosPA(); - - constexpr int MomInd[6] = {9, 13, 14, 18, 19, 20}; // cov matrix elements for momentum component - for (int i = 0; i < 6; i++) { + for (int i = 0; i < momIndSize; i++) { covV[MomInd[i]] = v0row.momentumCovMat()[i]; covV[i] = v0row.positionCovMat()[i]; } } else { - LOGF(warning, "V0Data/V0fCData not there for V0 %d in HF cascade %d. Skipping candidate.", casc.v0Id(), casc.globalIndex()); + LOGF(warning, "V0Data not there for V0 %d in HF cascade %d. Skipping candidate.", casc.v0Id(), casc.globalIndex()); continue; // this was inadequately linked, should not happen } @@ -363,11 +333,10 @@ struct HfCandidateCreatorCascade { aod::HfCascades const& rowsTrackIndexCasc, aod::V0sLinked const& v0sLinked, V0full const& v0Full, - V0fCfull const& v0fcFull, aod::TracksWCov const& tracks, aod::BCsWithTimestamps const& bcs) { - runCreatorCascade(collisions, rowsTrackIndexCasc, v0sLinked, v0Full, v0fcFull, tracks, bcs); + runCreatorCascade(collisions, rowsTrackIndexCasc, v0sLinked, v0Full, tracks, bcs); } PROCESS_SWITCH(HfCandidateCreatorCascade, processNoCent, " Run candidate creator w/o centrality selections", true); @@ -376,11 +345,10 @@ struct HfCandidateCreatorCascade { aod::HfCascades const& rowsTrackIndexCasc, aod::V0sLinked const& v0sLinked, V0full const& v0Full, - V0fCfull const& v0fcFull, aod::TracksWCov const& tracks, aod::BCsWithTimestamps const& bcs) { - runCreatorCascade(collisions, rowsTrackIndexCasc, v0sLinked, v0Full, v0fcFull, tracks, bcs); + runCreatorCascade(collisions, rowsTrackIndexCasc, v0sLinked, v0Full, tracks, bcs); } PROCESS_SWITCH(HfCandidateCreatorCascade, processCentFT0C, " Run candidate creator w/ centrality selection on FT0C", false); @@ -389,11 +357,10 @@ struct HfCandidateCreatorCascade { aod::HfCascades const& rowsTrackIndexCasc, aod::V0sLinked const& v0sLinked, V0full const& v0Full, - V0fCfull const& v0fcFull, aod::TracksWCov const& tracks, aod::BCsWithTimestamps const& bcs) { - runCreatorCascade(collisions, rowsTrackIndexCasc, v0sLinked, v0Full, v0fcFull, tracks, bcs); + runCreatorCascade(collisions, rowsTrackIndexCasc, v0sLinked, v0Full, tracks, bcs); } PROCESS_SWITCH(HfCandidateCreatorCascade, processCentFT0M, " Run candidate creator w/ centrality selection on FT0M", false); From b17955555874e13cb0fbb05348ccf65968f35654 Mon Sep 17 00:00:00 2001 From: wenyaCern <31894577+wenyaCern@users.noreply.github.com> Date: Mon, 22 Sep 2025 09:20:42 +0200 Subject: [PATCH 485/986] [PWGCF] Set PDG code of container (#13034) Co-authored-by: ALICE Action Bot --- PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackTrack.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackTrack.cxx b/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackTrack.cxx index beaf7dc471d..f75d924683b 100644 --- a/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackTrack.cxx +++ b/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackTrack.cxx @@ -298,6 +298,7 @@ struct femtoDreamPairTaskTrackTrack { sameEventQnCont.init_qn(&Registry, Binning4D.kstar, Binning4D.mT, Binning4D.multPercentile, Option.IsMC, Option.HighkstarCut); + sameEventQnCont.setPDGCodes(Track1.PDGCode, Track2.PDGCode); if (qnCal.doFillHisto) { qnBinCalculator.initQn(&Registry, qnCal.numQnBins); } From 6de6c7d842904bffa6b0accb706945db8739cbfe Mon Sep 17 00:00:00 2001 From: nivram-phy Date: Mon, 22 Sep 2025 10:13:48 +0200 Subject: [PATCH 486/986] [PWGUD] New Task : Incoherent JPsi Polarization with Run 3 Dataset (#12991) Co-authored-by: Niveditha Ramasubramanian Co-authored-by: Niveditha Ramasubramanian Co-authored-by: ALICE Action Bot --- PWGUD/Tasks/CMakeLists.txt | 5 + PWGUD/Tasks/upcPolarisationJpsiIncoh.cxx | 325 +++++++++++++++++++++++ 2 files changed, 330 insertions(+) create mode 100644 PWGUD/Tasks/upcPolarisationJpsiIncoh.cxx diff --git a/PWGUD/Tasks/CMakeLists.txt b/PWGUD/Tasks/CMakeLists.txt index 37811e8dd4e..89cd087ef28 100644 --- a/PWGUD/Tasks/CMakeLists.txt +++ b/PWGUD/Tasks/CMakeLists.txt @@ -9,6 +9,11 @@ # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. +o2physics_add_dpl_workflow(upc-polarisation-jpsi-incoh + SOURCES upcPolarisationJpsiIncoh.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(upc SOURCES upcAnalysis.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase diff --git a/PWGUD/Tasks/upcPolarisationJpsiIncoh.cxx b/PWGUD/Tasks/upcPolarisationJpsiIncoh.cxx new file mode 100644 index 00000000000..88d8f36d18d --- /dev/null +++ b/PWGUD/Tasks/upcPolarisationJpsiIncoh.cxx @@ -0,0 +1,325 @@ +// 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 upcPolarisationJpsiIncoh.cxx +/// \brief Workflow to analyse UPC forward events and perform J/psi polarization selections +/// \author Niveditha Ram, IP2I +/// \ingroup PWGUD +/// executable name: o2-analysis-ud-upc-polarisation-jpsiincoh + +#include "PWGUD/DataModel/UDTables.h" + +#include "Common/Core/RecoDecay.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/PhysicsConstants.h" +#include "DataFormatsParameters/GRPECSObject.h" +#include "DataFormatsParameters/GRPLHCIFData.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +#include "Math/Vector4D.h" +#include "TMath.h" +#include "TRandom3.h" +#include "TSystem.h" + +#include +#include + +using namespace ROOT::Math; + +// table for saving tree with info on data +namespace dimu +{ +// dimuon +DECLARE_SOA_COLUMN(RunNumber, runNumber, int); +DECLARE_SOA_COLUMN(M, m, float); +DECLARE_SOA_COLUMN(Pt, pt, float); +DECLARE_SOA_COLUMN(Rap, rap, float); +DECLARE_SOA_COLUMN(Phi, phi, float); +} // namespace dimu + +namespace o2::aod +{ +DECLARE_SOA_TABLE(DiMu, "AOD", "DIMU", + dimu::RunNumber, + dimu::M, dimu::Pt, dimu::Rap, dimu::Phi); +} // namespace o2::aod +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +// constants used in the track selection +const float kRAbsMin = 17.6; +const float kRAbsMax = 89.5; +const float kPDca = 200.; +float kEtaMin = -4.0; +float kEtaMax = -2.5; +const float kPtMin = 0.; +const float kMaxAmpV0A = 100.; +const int kReqMatchMIDTracks = 2; +const int kReqMatchMFTTracks = 2; +const int kMaxChi2MFTMatch = 30; +struct UpcPolarisationJpsiIncoh { + + using CandidatesFwd = soa::Join; + using ForwardTracks = soa::Join; + using CompleteFwdTracks = soa::Join; + + Produces dimuSel; + // defining histograms using histogram registry: different histos for the different process functions + HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + // CONFIGURABLES + static constexpr double Pi = o2::constants::math::PI; + // pT of muon pairs + Configurable nBinsPt{"nBinsPt", 250, "N bins in pT histo"}; + Configurable lowPt{"lowPt", 0., "lower limit in pT histo"}; + Configurable highPt{"highPt", 2, "upper limit in pT histo"}; + // mass of muon pairs + Configurable nBinsMass{"nBinsMass", 500, "N bins in mass histo"}; + Configurable lowMass{"lowMass", 0., "lower limit in mass histo"}; + Configurable highMass{"highMass", 10., "upper limit in mass histo"}; + // eta of muon pairs + Configurable nBinsEta{"nBinsEta", 600, "N bins in eta histo"}; + Configurable lowEta{"lowEta", -10., "lower limit in eta histo"}; + Configurable highEta{"highEta", -2., "upper limit in eta histo"}; + // rapidity of muon pairs + Configurable nBinsRapidity{"nBinsRapidity", 250, "N bins in rapidity histo"}; + Configurable lowRapidity{"lowRapidity", -4.5, "lower limit in rapidity histo"}; + Configurable highRapidity{"highRapidity", -2., "upper limit in rapidity histo"}; + // phi of muon pairs + Configurable nBinsPhi{"nBinsPhi", 600, "N bins in phi histo"}; + Configurable lowPhi{"lowPhi", -Pi, "lower limit in phi histo"}; + Configurable highPhi{"highPhi", Pi, "upper limit in phi histo"}; + // Analysis cuts + Configurable maxJpsiMass{"maxJpsiMass", 3.18, "Maximum of the jpsi peak for peak cut"}; + Configurable minJpsiMass{"minJpsiMass", 3.0, "Minimum of the jpsi peak for peak cut"}; + // my track type + // 0 = MCH-MID-MFT + // 1 = MCH-MID + Configurable myTrackType{"myTrackType", 1, "My track type"}; + + void init(InitContext&) + { + // axis + const AxisSpec axisPt{nBinsPt, lowPt, highPt, "#it{p}_{T} GeV/#it{c}"}; + const AxisSpec axisMass{nBinsMass, lowMass, highMass, "m_{#mu#mu} GeV/#it{c}^{2}"}; + const AxisSpec axisEta{nBinsEta, lowEta, highEta, "#eta"}; + const AxisSpec axisRapidity{nBinsRapidity, lowRapidity, highRapidity, "Rapidity"}; + const AxisSpec axisPhi{nBinsPhi, lowPhi, highPhi, "#varphi"}; + // histos + // data and reco MC + registry.add("hMass", "Invariant mass of muon pairs;;#counts", kTH1D, {axisMass}); + registry.add("hPt", "Transverse momentum of muon pairs;;#counts", kTH1D, {axisPt}); + registry.add("hEta", "Pseudorapidty of muon pairs;;#counts", kTH1D, {axisEta}); + registry.add("hRapidity", "Rapidty of muon pairs;;#counts", kTH1D, {axisRapidity}); + registry.add("hPhi", "#varphi of muon pairs;;#counts", kTH1D, {axisPhi}); + } + + // template function that fills a map with the collision id of each udcollision as key + // and a vector with the tracks + // map == (key, element) == (udCollisionId, vector of trks) + template + void collectCandIDs(std::unordered_map>& tracksPerCand, TTracks& tracks) + { + for (const auto& tr : tracks) { + int32_t candId = tr.udCollisionId(); + if (candId < 0) { + continue; + } + tracksPerCand[candId].push_back(tr.globalIndex()); + } + } + + // template function that fills a map with the collision id of each udmccollision as key + // and a vector with the tracks + // map == (key, element) == (udMcCollisionId, vector of mc particles) + template + void collectMcCandIDs(std::unordered_map>& tracksPerCand, TTracks& tracks) + { + for (const auto& tr : tracks) { + int32_t candId = tr.udMcCollisionId(); + if (candId < 0) { + continue; + } + tracksPerCand[candId].push_back(tr.globalIndex()); + } + } + + // struct used to store the ZDC info in a map + struct ZDCinfo { + float timeA; + float timeC; + float enA; + float enC; + int32_t id; + }; + + // function that fills a map with the collision id of each udcollision as key + // and a ZDCinfo struct with the ZDC information + void collectCandZDCInfo(std::unordered_map& zdcPerCand, o2::aod::UDZdcsReduced const& ZDCs) + { + + for (const auto& zdc : ZDCs) { + int32_t candId = zdc.udCollisionId(); + if (candId < 0) { + continue; + } + + zdcPerCand[candId].timeA = zdc.timeZNA(); + zdcPerCand[candId].timeC = zdc.timeZNC(); + zdcPerCand[candId].enA = zdc.energyCommonZNA(); + zdcPerCand[candId].enC = zdc.energyCommonZNC(); + + // take care of the infinity + if (std::isinf(zdcPerCand[candId].timeA)) + zdcPerCand[candId].timeA = -999; + if (std::isinf(zdcPerCand[candId].timeC)) + zdcPerCand[candId].timeC = -999; + if (std::isinf(zdcPerCand[candId].enA)) + zdcPerCand[candId].enA = -999; + if (std::isinf(zdcPerCand[candId].enC)) + zdcPerCand[candId].enC = -999; + } + } + + // function to select muon tracks + template + bool isMuonSelected(const TTracks& fwdTrack) + { + float rAbs = fwdTrack.rAtAbsorberEnd(); + float pDca = fwdTrack.pDca(); + float pt = RecoDecay::pt(fwdTrack.px(), fwdTrack.py()); + float eta = RecoDecay::eta(std::array{fwdTrack.px(), fwdTrack.py(), fwdTrack.pz()}); + if (eta < kEtaMin || eta > kEtaMax) + return false; + if (pt < kPtMin) + return false; + if (rAbs < kRAbsMin || rAbs > kRAbsMax) + return false; + if (pDca > kPDca) + return false; + return true; + } + + // function that processes the candidates: + // it applies V0 selection, trk selection, kine selection, and fills the histograms + // it also divides the data in neutron classes + // used for real data + void processCand(CandidatesFwd::iterator const& cand, + ForwardTracks::iterator const& tr1, ForwardTracks::iterator const& tr2) + { + // V0 selection + const auto& ampsV0A = cand.amplitudesV0A(); + const auto& ampsRelBCsV0A = cand.ampRelBCsV0A(); + for (unsigned int i = 0; i < ampsV0A.size(); ++i) { + if (std::abs(ampsRelBCsV0A[i]) <= 1) { + if (ampsV0A[i] > kMaxAmpV0A) + return; + } + } + + // MCH-MID match selection + int nMIDs = 0; + if (tr1.chi2MatchMCHMID() > 0) + nMIDs++; + if (tr2.chi2MatchMCHMID() > 0) + nMIDs++; + if (nMIDs != kReqMatchMIDTracks) + return; + // MFT-MID match selection (if MFT is requested by the trackType) + if (myTrackType == 0) { + // if MFT is requested check that the tracks is inside the MFT acceptance + kEtaMin = -3.6; + kEtaMax = -2.5; + + int nMFT = 0; + if (tr1.chi2MatchMCHMFT() > 0 && tr1.chi2MatchMCHMFT() < kMaxChi2MFTMatch) + nMFT++; + if (tr2.chi2MatchMCHMFT() > 0 && tr2.chi2MatchMCHMFT() < kMaxChi2MFTMatch) + nMFT++; + if (nMFT != kReqMatchMFTTracks) + return; + } + // track selection + if (!isMuonSelected(*tr1)) + return; + if (!isMuonSelected(*tr2)) + return; + + // form Lorentz vectors + auto mMu = o2::constants::physics::MassMuonMinus; + LorentzVector> p1(tr1.px(), tr1.py(), tr1.pz(), mMu); + LorentzVector> p2(tr2.px(), tr2.py(), tr2.pz(), mMu); + LorentzVector p = p1 + p2; + + // cut on pair kinematics + // select mass + if (p.M() < lowMass) + return; + if (p.M() > highMass) + return; + // select pt + if (p.Pt() < lowPt) + return; + if (p.Pt() > highPt) + return; + // select rapidity + if (p.Rapidity() < lowRapidity) + return; + if (p.Rapidity() > highRapidity) + return; + // fill the histos without looking at neutron emission + registry.fill(HIST("hMass"), p.M()); + registry.fill(HIST("hPt"), p.Pt()); + registry.fill(HIST("hEta"), p.Eta()); + registry.fill(HIST("hRapidity"), p.Rapidity()); + registry.fill(HIST("hPhi"), p.Phi()); + + dimuSel(cand.runNumber(), p.M(), p.Pt(), p.Rapidity(), p.Phi()); + } + // PROCESS FUNCTION + void processData(CandidatesFwd const& eventCandidates, + o2::aod::UDZdcsReduced const& ZDCs, + ForwardTracks const& fwdTracks) + { + + // map with the tracks + std::unordered_map> tracksPerCand; + // takes a tracks table with a coloumn of collision ID and makes it into a map of collision ID to each track. + collectCandIDs(tracksPerCand, fwdTracks); + + // map with the ZDC info + std::unordered_map zdcPerCand; + collectCandZDCInfo(zdcPerCand, ZDCs); + + // loop over the candidates + for (const auto& item : tracksPerCand) { + int32_t trId1 = item.second[0]; + int32_t trId2 = item.second[1]; + int32_t candID = item.first; + auto cand = eventCandidates.iteratorAt(candID); + auto tr1 = fwdTracks.iteratorAt(trId1); + auto tr2 = fwdTracks.iteratorAt(trId2); + processCand(cand, tr1, tr2); + } + } + + PROCESS_SWITCH(UpcPolarisationJpsiIncoh, processData, "", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc), + }; +} From 8a8884a78dcbd1f764c9483f7800c9645c1701ca Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Mon, 22 Sep 2025 13:46:57 +0530 Subject: [PATCH 487/986] [PWGLF] Added QA plots for TPC,TOF n#Sigma before PID selection (#13071) Co-authored-by: Sawan Sawan --- PWGLF/Tasks/Resonances/doublephimeson.cxx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/PWGLF/Tasks/Resonances/doublephimeson.cxx b/PWGLF/Tasks/Resonances/doublephimeson.cxx index 4e6b9918155..c9108099e5b 100644 --- a/PWGLF/Tasks/Resonances/doublephimeson.cxx +++ b/PWGLF/Tasks/Resonances/doublephimeson.cxx @@ -82,6 +82,9 @@ struct doublephimeson { void init(o2::framework::InitContext&) { // register histograms + histos.add("hnsigmaTPCKaonPlusBefore", "hnsigmaTPCKaonPlusBefore", kTH2F, {{1000, -3.0, 3.0f}, {100, 0.0f, 10.0f}}); + histos.add("hnsigmaTPCKaonMinusBefore", "hnsigmaTPCKaonMinusBefore", kTH2F, {{1000, -3.0, 3.0f}, {100, 0.0f, 10.0f}}); + histos.add("hnsigmaTPCTOFKaonBefore", "hnsigmaTPCTOFKaonBefore", kTH3F, {{500, -3.0, 3.0f}, {500, -3.0, 3.0f}, {100, 0.0f, 10.0f}}); histos.add("hnsigmaTPCKaonPlus", "hnsigmaTPCKaonPlus", kTH2F, {{1000, -3.0, 3.0f}, {100, 0.0f, 10.0f}}); histos.add("hnsigmaTPCKaonMinus", "hnsigmaTPCKaonMinus", kTH2F, {{1000, -3.0, 3.0f}, {100, 0.0f, 10.0f}}); histos.add("hnsigmaTPCTOFKaon", "hnsigmaTPCTOFKaon", kTH3F, {{500, -3.0, 3.0f}, {500, -3.0, 3.0f}, {100, 0.0f, 10.0f}}); @@ -89,6 +92,8 @@ struct doublephimeson { histos.add("hPhiMass2", "hPhiMass2", kTH2F, {{40, 1.0, 1.04f}, {40, 1.0f, 1.04f}}); histos.add("hkPlusDeltaetaDeltaPhi", "hkPlusDeltaetaDeltaPhi", kTH2F, {{400, -2.0, 2.0}, {640, -2.0 * TMath::Pi(), 2.0 * TMath::Pi()}}); histos.add("hkMinusDeltaetaDeltaPhi", "hkMinusDeltaetaDeltaPhi", kTH2F, {{400, -2.0, 2.0}, {640, -2.0 * TMath::Pi(), 2.0 * TMath::Pi()}}); + histos.add("hDeltaRkaonplus", "hDeltaRkaonplus", kTH1F, {{800, 0.0, 8.0}}); + histos.add("hDeltaRkaonminus", "hDeltaRkaonminus", kTH1F, {{800, 0.0, 8.0}}); const AxisSpec thnAxisInvMass{configThnAxisInvMass, "#it{M} (GeV/#it{c}^{2})"}; const AxisSpec thnAxisInvMassPhi{configThnAxisInvMassPhi, "#it{M} (GeV/#it{c}^{2})"}; @@ -467,6 +472,11 @@ struct doublephimeson { for (auto phitrackd1 : phitracks) { auto kaonplusd1pt = TMath::Sqrt(phitrackd1.phid1Px() * phitrackd1.phid1Px() + phitrackd1.phid1Py() * phitrackd1.phid1Py()); auto kaonminusd1pt = TMath::Sqrt(phitrackd1.phid2Px() * phitrackd1.phid2Px() + phitrackd1.phid2Py() * phitrackd1.phid2Py()); + + histos.fill(HIST("hnsigmaTPCTOFKaonBefore"), phitrackd1.phid1TPC(), phitrackd1.phid1TOF(), kaonplusd1pt); + histos.fill(HIST("hnsigmaTPCKaonPlusBefore"), phitrackd1.phid1TPC(), kaonplusd1pt); + histos.fill(HIST("hnsigmaTPCKaonMinusBefore"), phitrackd1.phid2TPC(), kaonminusd1pt); + if (kaonplusd1pt > maxKaonPt) { continue; } @@ -564,6 +574,8 @@ struct doublephimeson { auto exotic1kaonminus2 = kaonminus2.at(i5); auto deltaRkaonplus1 = TMath::Sqrt(TMath::Power(exotic1kaonplus1.Phi() - exotic1kaonplus2.Phi(), 2.0) + TMath::Power(exotic1kaonplus1.Eta() - exotic1kaonplus2.Eta(), 2.0)); auto deltaRkaonminus1 = TMath::Sqrt(TMath::Power(exotic1kaonminus1.Phi() - exotic1kaonminus2.Phi(), 2.0) + TMath::Power(exotic1kaonminus1.Eta() - exotic1kaonminus2.Eta(), 2.0)); + histos.fill(HIST("hDeltaRkaonplus"), deltaRkaonplus1); + histos.fill(HIST("hDeltaRkaonminus"), deltaRkaonminus1); auto deltam1 = TMath::Sqrt(TMath::Power(exotic1phi1.M() - 1.0192, 2.0) + TMath::Power(exotic1phi2.M() - 1.0192, 2.0)); auto deltaR1 = TMath::Sqrt(TMath::Power(exotic1phi1.Phi() - exotic1phi2.Phi(), 2.0) + TMath::Power(exotic1phi1.Eta() - exotic1phi2.Eta(), 2.0)); @@ -623,6 +635,9 @@ struct doublephimeson { auto deltam1 = TMath::Sqrt(TMath::Power(exotic1phi1.M() - 1.0192, 2.0) + TMath::Power(exotic1phi2.M() - 1.0192, 2.0)); auto deltaR1 = TMath::Sqrt(TMath::Power(exotic1phi1.Phi() - exotic1phi2.Phi(), 2.0) + TMath::Power(exotic1phi1.Eta() - exotic1phi2.Eta(), 2.0)); + histos.fill(HIST("hDeltaRkaonplus"), deltaRkaonplus1); + histos.fill(HIST("hDeltaRkaonminus"), deltaRkaonminus1); + if (deltaRkaonplus1 < daughterDeltaR) { continue; } @@ -667,6 +682,8 @@ struct doublephimeson { const ROOT::Math::PtEtaPhiMVector& kminusB) { const double dRkplus = deltaR(kplusA.Phi(), kplusA.Eta(), kplusB.Phi(), kplusB.Eta()); const double dRkminus = deltaR(kminusA.Phi(), kminusA.Eta(), kminusB.Phi(), kminusB.Eta()); + histos.fill(HIST("hDeltaRkaonplus"), dRkplus); + histos.fill(HIST("hDeltaRkaonminus"), dRkminus); return (dRkplus > daughterDeltaR) && (dRkminus > daughterDeltaR); // If later needed, make pT-aware: // const double thr = std::max(0.01, daughterDeltaR - 0.002 * std::min(10.0, exoticPt)); @@ -712,6 +729,11 @@ struct doublephimeson { // Per-φ selection for the first φ const double kplus1pt = std::hypot(t1.phid1Px(), t1.phid1Py()); const double kminus1pt = std::hypot(t1.phid2Px(), t1.phid2Py()); + + histos.fill(HIST("hnsigmaTPCTOFKaonBefore"), t1.phid1TPC(), t1.phid1TOF(), kplus1pt); + histos.fill(HIST("hnsigmaTPCKaonPlusBefore"), t1.phid1TPC(), kplus1pt); + histos.fill(HIST("hnsigmaTPCKaonMinusBefore"), t1.phid2TPC(), kminus1pt); + if (kplus1pt > maxKaonPt) continue; if (kminus1pt > maxKaonPt) From 5337d8e4d3f47e68ff7da968061b024e3dc723b4 Mon Sep 17 00:00:00 2001 From: Gianni Shigeru Setoue Liveraro <81832939+gianniliveraro@users.noreply.github.com> Date: Mon, 22 Sep 2025 05:20:28 -0300 Subject: [PATCH 488/986] [PWGLF] New histos in QA task (#13058) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/QC/strderivedGenQA.cxx | 757 +++++++++++++++-------------- 1 file changed, 393 insertions(+), 364 deletions(-) diff --git a/PWGLF/Tasks/QC/strderivedGenQA.cxx b/PWGLF/Tasks/QC/strderivedGenQA.cxx index 201dcd99ac2..669f9dfc919 100644 --- a/PWGLF/Tasks/QC/strderivedGenQA.cxx +++ b/PWGLF/Tasks/QC/strderivedGenQA.cxx @@ -108,94 +108,79 @@ struct strderivedGenQA { Configurable rapidityCut{"rapidityCut", 0.5, "rapidity"}; Configurable daughterEtaCut{"daughterEtaCut", 0.8, "max eta for daughters"}; - // Standard 5 topological criteria + // Standard topological criteria Configurable v0cospa{"v0cospa", 0.97, "min V0 CosPA"}; Configurable dcav0dau{"dcav0dau", 1.0, "max DCA V0 Daughters (cm)"}; Configurable dcanegtopv{"dcanegtopv", .05, "min DCA Neg To PV (cm)"}; Configurable dcapostopv{"dcapostopv", .05, "min DCA Pos To PV (cm)"}; - Configurable v0radius{"v0radius", 1.2, "minimum V0 radius (cm)"}; + Configurable v0radiusMin{"v0radiusMin", 1.2, "minimum V0 radius (cm)"}; Configurable v0radiusMax{"v0radiusMax", 1E5, "maximum V0 radius (cm)"}; - // Additional selection on the AP plot (exclusive for K0Short) - // original equation: lArmPt*5>TMath::Abs(lArmAlpha) - Configurable armPodCut{"armPodCut", 5.0f, "pT * (cut) > |alpha|, AP cut. Negative: no cut"}; - // Track quality Configurable minTPCrows{"minTPCrows", 70, "minimum TPC crossed rows"}; Configurable minITSclusters{"minITSclusters", -1, "minimum ITS clusters"}; - Configurable skipTPConly{"skipTPConly", false, "skip V0s comprised of at least one TPC only prong"}; - Configurable requirePosITSonly{"requirePosITSonly", false, "require that positive track is ITSonly (overrides TPC quality)"}; - Configurable requireNegITSonly{"requireNegITSonly", false, "require that negative track is ITSonly (overrides TPC quality)"}; - Configurable rejectPosITSafterburner{"rejectPosITSafterburner", false, "reject positive track formed out of afterburner ITS tracks"}; - Configurable rejectNegITSafterburner{"rejectNegITSafterburner", false, "reject negative track formed out of afterburner ITS tracks"}; - - // PID (TPC/TOF) - Configurable TpcPidNsigmaCut{"TpcPidNsigmaCut", 5, "TpcPidNsigmaCut"}; - Configurable TofPidNsigmaCutLaPr{"TofPidNsigmaCutLaPr", 1e+6, "TofPidNsigmaCutLaPr"}; - Configurable TofPidNsigmaCutLaPi{"TofPidNsigmaCutLaPi", 1e+6, "TofPidNsigmaCutLaPi"}; - Configurable TofPidNsigmaCutK0Pi{"TofPidNsigmaCutK0Pi", 1e+6, "TofPidNsigmaCutK0Pi"}; - - // PID (TOF) - Configurable maxDeltaTimeProton{"maxDeltaTimeProton", 1e+9, "check maximum allowed time"}; - Configurable maxDeltaTimePion{"maxDeltaTimePion", 1e+9, "check maximum allowed time"}; + } v0Selections; // Axis declarations - ConfigurableAxis axisPosZ{"axisPosZ", {100, -50.0f, 50.0f}, "Z Position"}; - ConfigurableAxis axisCentrality{"axisCentrality", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.0f, 110.0f}, "Centrality"}; - - // Boolean axes - ConfigurableAxis axisBool{"axisBool", {2, 0.0f, 2.0f}, "axisBool"}; - ConfigurableAxis axisFt0cOccupancyInTimeRange{"axisFt0cOccupancyInTimeRange", {50, 0, 80000}, "FT0C occupancy"}; - ConfigurableAxis axisTrackOccupancyInTimeRange{"axisTrackOccupancyInTimeRange", {50, 0, 5000}, "Track occupancy"}; - ConfigurableAxis axisMultFT0C{"axisMultFT0C", {1000, 0, 100000}, "FT0C amplitude"}; - ConfigurableAxis axisMultNTracksPVeta1{"axisMultNTracksPVeta1", {200, 0, 6000}, "Mult NTracks PV eta 1"}; - ConfigurableAxis axisMultPVTotalContributors{"axisMultPVTotalContributors", {200, 0, 6000}, "Number of PV Contributors"}; - ConfigurableAxis axisMultAllTracksTPCOnly{"axisMultAllTracksTPCOnly", {200, 0, 6000}, "Mult All Tracks TPC Only"}; - ConfigurableAxis axisMultAllTracksITSTPC{"axisMultAllTracksITSTPC", {200, 0, 6000}, "Mult All Tracks ITS TPC"}; - ConfigurableAxis axisNch{"axisNch", {500, 0.0f, +5000.0f}, "Number of charged particles"}; - ConfigurableAxis axisNumV0sPerColl{"axisNumV0sPerColl", {50000, -0.5f, 49999.5f}, "Num V0s Per Coll"}; - ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "Pt Axis"}; - ConfigurableAxis axisPt2{"axisPt2", {VARIABLE_WIDTH, -50.0f, -40.0f, -35.0f, -30.0f, -25.0f, -23.0f, -21.0f, -19.0f, -17.0f, -15.0f, -14.0f, -13.0f, -12.0f, -11.0f, -10.0f, -9.0f, -8.0f, -7.5f, -7.0f, -6.5f, -6.0f, -5.6f, -5.2f, -4.8f, -4.4f, -4.0f, -3.8f, -3.6f, -3.4f, -3.2f, -3.0f, -2.8f, -2.6f, -2.4f, -2.2f, -2.0f, -1.9f, -1.8f, -1.7f, -1.6f, -1.5f, -1.4f, -1.3f, -1.2f, -1.1f, -1.0f, -0.9f, -0.8f, -0.7f, -0.6f, -0.5f, -0.4f, -0.3f, -0.2f, -0.1f, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "Pt Axis"}; - ConfigurableAxis axisAlpha{"axisAlpha", {220, -1.1f, 1.1f}, "Alpha"}; - ConfigurableAxis axisQtarm{"axisQtarm", {220, 0.0f, 0.5f}, "Qtarm"}; - ConfigurableAxis axisCosPA{"axisCosPA", {240, 0.0f, 1.2f}, "CosPA"}; - ConfigurableAxis axisDCAdau{"axisDCAdau", {50, 0.0f, 5.0f}, "DCA V0 Daughters"}; - ConfigurableAxis axisEta{"axisEta", {100, -3.0f, 3.0f}, "Eta"}; - ConfigurableAxis axisPhi{"axisPhi", {100, 0.0f, TMath::TwoPi()}, "Phi"}; - ConfigurableAxis axisMassGamma{"axisMassGamma", {400, 0.0f, 0.5f}, "Mass Gamma"}; - ConfigurableAxis axisMassLambda{"axisMassLambda", {400, 1.0f, 1.2f}, "Mass Lambda"}; - ConfigurableAxis axisMassK0Short{"axisMassK0Short", {400, 0.4f, 0.6f}, "Mass K0Short"}; - ConfigurableAxis axisV0Type{"axisV0Type", {5, 0.0f, 5.0f}, "V0 Type"}; - ConfigurableAxis axisStraCollisionId{"axisStraCollisionId", {4000, 0.0f, 40000.0f}, "Stra Collision Id"}; - ConfigurableAxis axisGlobalIndex{"axisGlobalIndex", {4000, 0.0f, 40000.0f}, "Global Index"}; - ConfigurableAxis axisNCls{"axisNCls", {8, -0.5, 7.5}, "NCls"}; - ConfigurableAxis axisTPCrows{"axisTPCrows", {160, 0.0f, 160.0f}, "N TPC rows"}; - ConfigurableAxis axisChi2PerNcl{"axisChi2PerNcl", {100, 0, 40}, "Chi2 Per Ncl"}; - ConfigurableAxis axisTPCNSigma{"axisTPCNSigma", {100, -50.0f, 50.0f}, "TPC N Sigma"}; - ConfigurableAxis axisTPCSignal{"axisTPCSignal", {400, -100.0, 300.0}, "TPC Signal"}; - ConfigurableAxis axisTOFNSigma{"axisTOFNSigma", {100, -50.0f, 50.0f}, "TOF N Sigma"}; - ConfigurableAxis axisTOFDeltaT{"axisTOFDeltaT", {200, -1000.0f, +1000.0f}, "TOF Delta T"}; - ConfigurableAxis axisPtResolution{"axisPtResolution", {100, -1.0f, 1.0f}, "Pt Resolution"}; - ConfigurableAxis axisPDGCode{"axisPDGCode", {10001, -5000.5f, +5000.5f}, "PDG Code"}; - ConfigurableAxis axisV0Radius{"axisV0Radius", {400, 0.0f, 200.0f}, "V0 Radius"}; - ConfigurableAxis axisCascRadius{"axisCascRadius", {500, 0.0f, 50.0f}, "Casc Radius"}; - ConfigurableAxis axisDCAToPV{"axisDCAToPV", {500, -50.0f, 50.0f}, "DCA Dau to PV"}; - ConfigurableAxis axisDCAXYCascToPV{"axisDCAXYCascToPV", {1000, 0.0f, 10.0f}, "DCA XY Casc to PV"}; - ConfigurableAxis axisDCAZCascToPV{"axisDCAZCascToPV", {500, -10.0f, 10.0f}, "DCA Z Casc to PV"}; - ConfigurableAxis axisDCAV0ToPV{"axisDCAV0ToPV", {1000, -10.0f, 10.0f}, "DCA V0 to PV"}; - ConfigurableAxis axisDCAV0Dau{"axisDCAV0Dau", {1000, 0.0f, 10.0f}, "DCA V0 Daughters"}; - ConfigurableAxis axisDCACascDau{"axisDCACascDau", {1000, 0.0f, 10.0f}, "DCA Casc Daughters"}; - ConfigurableAxis axisOmegaMass{"axisOmegaMass", {400, 1.6f, 1.8f}, "Omega Mass"}; - ConfigurableAxis axisXiMass{"axisXiMass", {400, 1.2f, 1.4f}, "Xi Mass"}; - ConfigurableAxis axisTrackProperties{"axisTrackProperties", {32, -0.5, 31.5f}, "Track Properties"}; + struct : ConfigurableGroup { + ConfigurableAxis axisPosZ{"axisPosZ", {100, -50.0f, 50.0f}, "Z Position"}; + ConfigurableAxis axisCentrality{"axisCentrality", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.0f, 110.0f}, "Centrality"}; + + // Boolean axes + ConfigurableAxis axisBool{"axisBool", {2, 0.0f, 2.0f}, "axisBool"}; + ConfigurableAxis axisFt0cOccupancyInTimeRange{"axisFt0cOccupancyInTimeRange", {50, 0, 80000}, "FT0C occupancy"}; + ConfigurableAxis axisTrackOccupancyInTimeRange{"axisTrackOccupancyInTimeRange", {50, 0, 5000}, "Track occupancy"}; + ConfigurableAxis axisMultFT0C{"axisMultFT0C", {1000, 0, 100000}, "FT0C amplitude"}; + ConfigurableAxis axisMultNTracksPVeta1{"axisMultNTracksPVeta1", {200, 0, 6000}, "Mult NTracks PV eta 1"}; + ConfigurableAxis axisMultPVTotalContributors{"axisMultPVTotalContributors", {200, 0, 6000}, "Number of PV Contributors"}; + ConfigurableAxis axisMultAllTracksTPCOnly{"axisMultAllTracksTPCOnly", {200, 0, 6000}, "Mult All Tracks TPC Only"}; + ConfigurableAxis axisMultAllTracksITSTPC{"axisMultAllTracksITSTPC", {200, 0, 6000}, "Mult All Tracks ITS TPC"}; + ConfigurableAxis axisNch{"axisNch", {500, 0.0f, +5000.0f}, "Number of charged particles"}; + ConfigurableAxis axisNumV0sPerColl{"axisNumV0sPerColl", {50000, -0.5f, 49999.5f}, "Num V0s Per Coll"}; + ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "Pt Axis"}; + ConfigurableAxis axisPt2{"axisPt2", {VARIABLE_WIDTH, -50.0f, -40.0f, -35.0f, -30.0f, -25.0f, -23.0f, -21.0f, -19.0f, -17.0f, -15.0f, -14.0f, -13.0f, -12.0f, -11.0f, -10.0f, -9.0f, -8.0f, -7.5f, -7.0f, -6.5f, -6.0f, -5.6f, -5.2f, -4.8f, -4.4f, -4.0f, -3.8f, -3.6f, -3.4f, -3.2f, -3.0f, -2.8f, -2.6f, -2.4f, -2.2f, -2.0f, -1.9f, -1.8f, -1.7f, -1.6f, -1.5f, -1.4f, -1.3f, -1.2f, -1.1f, -1.0f, -0.9f, -0.8f, -0.7f, -0.6f, -0.5f, -0.4f, -0.3f, -0.2f, -0.1f, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "Pt Axis"}; + ConfigurableAxis axisAlpha{"axisAlpha", {220, -1.1f, 1.1f}, "Alpha"}; + ConfigurableAxis axisQtarm{"axisQtarm", {220, 0.0f, 0.5f}, "Qtarm"}; + ConfigurableAxis axisCosPA{"axisCosPA", {240, 0.0f, 1.2f}, "CosPA"}; + ConfigurableAxis axisPA{"axisPA", {200, 0.0f, 0.4f}, "PA"}; + ConfigurableAxis axisDCAdau{"axisDCAdau", {50, 0.0f, 5.0f}, "DCA V0 Daughters"}; + ConfigurableAxis axisEta{"axisEta", {100, -3.0f, 3.0f}, "Eta"}; + ConfigurableAxis axisPhi{"axisPhi", {100, 0.0f, TMath::TwoPi()}, "Phi"}; + ConfigurableAxis axisMassGamma{"axisMassGamma", {400, 0.0f, 0.5f}, "Mass Gamma"}; + ConfigurableAxis axisMassLambda{"axisMassLambda", {400, 1.0f, 1.2f}, "Mass Lambda"}; + ConfigurableAxis axisMassK0Short{"axisMassK0Short", {400, 0.4f, 0.6f}, "Mass K0Short"}; + ConfigurableAxis axisV0Type{"axisV0Type", {5, 0.0f, 5.0f}, "V0 Type"}; + ConfigurableAxis axisStraCollisionId{"axisStraCollisionId", {4000, 0.0f, 40000.0f}, "Stra Collision Id"}; + ConfigurableAxis axisGlobalIndex{"axisGlobalIndex", {4000, 0.0f, 40000.0f}, "Global Index"}; + ConfigurableAxis axisNCls{"axisNCls", {8, -0.5, 7.5}, "NCls"}; + ConfigurableAxis axisTPCrows{"axisTPCrows", {160, 0.0f, 160.0f}, "N TPC rows"}; + ConfigurableAxis axisChi2PerNcl{"axisChi2PerNcl", {100, 0, 40}, "Chi2 Per Ncl"}; + ConfigurableAxis axisTPCNSigma{"axisTPCNSigma", {100, -50.0f, 50.0f}, "TPC N Sigma"}; + ConfigurableAxis axisTPCSignal{"axisTPCSignal", {400, -100.0, 300.0}, "TPC Signal"}; + ConfigurableAxis axisTOFNSigma{"axisTOFNSigma", {100, -50.0f, 50.0f}, "TOF N Sigma"}; + ConfigurableAxis axisTOFDeltaT{"axisTOFDeltaT", {200, -1000.0f, +1000.0f}, "TOF Delta T"}; + ConfigurableAxis axisPtResolution{"axisPtResolution", {100, -1.0f, 1.0f}, "Pt Resolution"}; + ConfigurableAxis axisPDGCode{"axisPDGCode", {10001, -5000.5f, +5000.5f}, "PDG Code"}; + ConfigurableAxis axisV0Radius{"axisV0Radius", {400, 0.0f, 200.0f}, "V0 Radius"}; + ConfigurableAxis axisCascRadius{"axisCascRadius", {500, 0.0f, 50.0f}, "Casc Radius"}; + ConfigurableAxis axisDCAToPV{"axisDCAToPV", {500, -50.0f, 50.0f}, "DCA Dau to PV"}; + ConfigurableAxis axisDCAXYCascToPV{"axisDCAXYCascToPV", {1000, 0.0f, 10.0f}, "DCA XY Casc to PV"}; + ConfigurableAxis axisDCAZCascToPV{"axisDCAZCascToPV", {500, -10.0f, 10.0f}, "DCA Z Casc to PV"}; + ConfigurableAxis axisDCAV0ToPV{"axisDCAV0ToPV", {1000, -10.0f, 10.0f}, "DCA V0 to PV"}; + ConfigurableAxis axisDCAV0Dau{"axisDCAV0Dau", {1000, 0.0f, 10.0f}, "DCA V0 Daughters"}; + ConfigurableAxis axisDCACascDau{"axisDCACascDau", {1000, 0.0f, 10.0f}, "DCA Casc Daughters"}; + ConfigurableAxis axisOmegaMass{"axisOmegaMass", {400, 1.6f, 1.8f}, "Omega Mass"}; + ConfigurableAxis axisXiMass{"axisXiMass", {400, 1.2f, 1.4f}, "Xi Mass"}; + ConfigurableAxis axisTrackProperties{"axisTrackProperties", {32, -0.5, 31.5f}, "Track Properties"}; + } AxisConfig; PresliceUnsorted> perMcCollision = aod::v0data::straMCCollisionId; void init(InitContext const&) { // Histogram declarations (can be improved!) - histos.add("Event/hPosZ", "hPosZ", kTH1F, {axisPosZ}); + histos.add("Event/hPosZ", "hPosZ", kTH1F, {AxisConfig.axisPosZ}); // Event Counters histos.add("Event/hEventProperties", "hEventProperties", kTH1F, {{20, -0.5f, +18.5f}}); @@ -215,298 +200,324 @@ struct strderivedGenQA { histos.get(HIST("Event/hEventProperties"))->GetXaxis()->SetBinLabel(14, "kNoCollInRofStd"); histos.get(HIST("Event/hEventProperties"))->GetXaxis()->SetBinLabel(15, "kNoCollInRofStrict"); - histos.add("Event/hft0cOccupancyInTimeRange", "hft0cOccupancyInTimeRange", kTH1F, {axisFt0cOccupancyInTimeRange}); - histos.add("Event/htrackOccupancyInTimeRange", "htrackOccupancyInTimeRange", kTH1F, {axisTrackOccupancyInTimeRange}); - histos.add("Event/h2dMultFT0C", "h2dMultFT0C", kTH2F, {axisCentrality, axisMultFT0C}); - histos.add("Event/h2dMultNTracksPVeta1", "h2dMultNTracksPVeta1", kTH2F, {axisCentrality, axisMultNTracksPVeta1}); - histos.add("Event/h2dMultPVTotalContributors", "h2dMultPVTotalContributors", kTH2F, {axisCentrality, axisMultPVTotalContributors}); - histos.add("Event/h2dMultAllTracksTPCOnly", "h2dMultAllTracksTPCOnly", kTH2F, {axisCentrality, axisMultAllTracksTPCOnly}); - histos.add("Event/h2dMultAllTracksITSTPC", "h2dMultAllTracksITSTPC", kTH2F, {axisCentrality, axisMultAllTracksITSTPC}); - histos.add("Event/h2dNumV0sPerColl", "h2dNumV0sPerColl", kTH2F, {axisCentrality, axisNumV0sPerColl}); - - histos.add("V0/hpT", "hpT", kTH1F, {axisPt}); - histos.add("V0/h2dArmenterosP", "h2dArmenterosP", kTH2F, {axisAlpha, axisQtarm}); - histos.add("V0/hRadius", "hRadius", kTH1F, {axisV0Radius}); - histos.add("V0/hZ", "hZ", kTH1F, {axisPosZ}); - histos.add("V0/hCosPA", "hCosPA", kTH1F, {axisCosPA}); - histos.add("V0/hdcaDau", "hdcaDau", kTH1F, {axisDCAdau}); - histos.add("V0/hdcaNegtopv", "hdcaNegtopv", kTH1F, {axisDCAToPV}); - histos.add("V0/hdcaPostopv", "hdcaPostopv", kTH1F, {axisDCAToPV}); - histos.add("V0/h2dEtaPhi", "h2dEtaPhi", kTH2F, {axisEta, axisPhi}); - histos.add("V0/hYGamma", "hYGamma", kTH1F, {axisEta}); - histos.add("V0/hYLambda", "hYLambda", kTH1F, {axisEta}); - histos.add("V0/hYK0Short", "hYK0Short", kTH1F, {axisEta}); - histos.add("V0/hMassGamma", "hMassGamma", kTH1F, {axisMassGamma}); - histos.add("V0/hMassLambda", "hMassLambda", kTH1F, {axisMassLambda}); - histos.add("V0/hMassK0Short", "hMassK0Short", kTH1F, {axisMassK0Short}); - histos.add("V0/hV0Type", "hV0Type", kTH1F, {axisV0Type}); - histos.add("V0/h2dV0Indices", "h2dV0Indices", kTH2F, {axisStraCollisionId, axisGlobalIndex}); - - histos.add("V0/Track/h2dITSNCls", "h2dITSNCls", kTH2F, {axisPt2, axisNCls}); - histos.add("V0/Track/h2dITSChi2PerNcl", "h2dITSChi2PerNcl", kTH2F, {axisPt2, axisChi2PerNcl}); - histos.add("V0/Track/h2dTPCCrossedRows", "h2dTPCCrossedRows", kTH2F, {axisPt2, axisTPCrows}); - - histos.add("V0/Track/h2dPosTrackProperties", "h2dPosTrackProperties", kTH2F, {axisTrackProperties, axisPt}); - histos.add("V0/Track/h3dTrackPropertiesVspT", "h3dTrackPropertiesVspT", kTH3F, {axisTrackProperties, axisTrackProperties, axisPt}); - histos.add("V0/Track/h2dNegTrackProperties", "h2dNegTrackProperties", kTH2F, {axisTrackProperties, axisPt}); - - // Add histogram to the list - histos.add("V0/Track/hTrackCode", "hTrackCode", kTH1F, {axisTrackProperties}); - - // Set bin labels for all combinations - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(1, "None"); // Code 0 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(2, "TPC"); // Code 1 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(3, "ITSTracker"); // Code 2 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(4, "ITSTracker + TPC"); // Code 3 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(5, "ITSAfterburner"); // Code 4 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(6, "ITSAfterburner + TPC"); // Code 5 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(7, "ITSAfterburner + ITSTracker"); // Code 6 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(8, "ITSAfterburner + ITSTracker + TPC"); // Code 7 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(9, "TRD"); // Code 8 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(10, "TRD + TPC"); // Code 9 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(11, "TRD + ITSTracker"); // Code 10 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(12, "TRD + ITSTracker + TPC"); // Code 11 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(13, "TRD + ITSAfterburner"); // Code 12 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(14, "TRD + ITSAfterburner + TPC"); // Code 13 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(15, "TRD + ITSAfterburner + ITSTracker"); // Code 14 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(16, "TRD + ITSAfterburner + ITSTracker + TPC"); // Code 15 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(17, "TOF"); // Code 16 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(18, "TOF + TPC"); // Code 17 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(19, "TOF + ITSTracker"); // Code 18 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(20, "TOF + ITSTracker + TPC"); // Code 19 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(21, "TOF + ITSAfterburner"); // Code 20 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(22, "TOF + ITSAfterburner + TPC"); // Code 21 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(23, "TOF + ITSAfterburner + ITSTracker"); // Code 22 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(24, "TOF + ITSAfterburner + ITSTracker + TPC"); // Code 23 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(25, "TOF + TRD"); // Code 24 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(26, "TOF + TRD + TPC"); // Code 25 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(27, "TOF + TRD + ITSTracker"); // Code 26 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(28, "TOF + TRD + ITSTracker + TPC"); // Code 27 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(29, "TOF + TRD + ITSAfterburner"); // Code 28 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(30, "TOF + TRD + ITSAfterburner + TPC"); // Code 29 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(31, "TOF + TRD + ITSAfterburner + ITSTracker"); // Code 30 - histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(32, "All"); // Code 31 - - histos.add("V0/PID/h2dTPCNSigmaEl", "h2dTPCNSigmaEl", kTH2F, {axisPt2, axisTPCNSigma}); - histos.add("V0/PID/h2dTPCNSigmaPr", "h2dTPCNSigmaPr", kTH2F, {axisPt2, axisTPCNSigma}); - histos.add("V0/PID/h2dTPCNSigmaPi", "h2dTPCNSigmaPi", kTH2F, {axisPt2, axisTPCNSigma}); - histos.add("V0/PID/h2dTPCSignal", "h2dTPCSignal", kTH2F, {axisPt2, axisTPCSignal}); - - histos.add("V0/PID/h2dTOFNSigmaLaPr", "h2dTOFNSigmaLaPr", kTH2F, {axisPt, axisTOFNSigma}); - histos.add("V0/PID/h2dTOFNSigmaLaPi", "h2dTOFNSigmaLaPi", kTH2F, {axisPt, axisTOFNSigma}); - histos.add("V0/PID/h2dposTOFDeltaTLaPr", "h2dposTOFDeltaTLaPr", kTH2F, {axisPt, axisTOFDeltaT}); - histos.add("V0/PID/h2dnegTOFDeltaTLaPi", "h2dnegTOFDeltaTLaPi", kTH2F, {axisPt, axisTOFDeltaT}); - histos.add("V0/PID/h2dnegTOFDeltaTLaPr", "h2dnegTOFDeltaTLaPr", kTH2F, {axisPt, axisTOFDeltaT}); - histos.add("V0/PID/h2dposTOFDeltaTLaPi", "h2dposTOFDeltaTLaPi", kTH2F, {axisPt, axisTOFDeltaT}); - histos.add("V0/PID/h2dTOFNSigmaALaPr", "h2dTOFNSigmaALaPr", kTH2F, {axisPt, axisTOFNSigma}); - histos.add("V0/PID/h2dTOFNSigmaALaPi", "h2dTOFNSigmaALaPi", kTH2F, {axisPt, axisTOFNSigma}); - histos.add("V0/PID/h2dTOFNSigmaK0PiPlus", "h2dTOFNSigmaK0PiPlus", kTH2F, {axisPt, axisTOFNSigma}); - histos.add("V0/PID/h2dTOFNSigmaK0PiMinus", "h2dTOFNSigmaK0PiMinus", kTH2F, {axisPt, axisTOFNSigma}); - histos.add("V0/PID/h3dTPCVsTOFNSigmaLaPr", "h3dTPCVsTOFNSigmaLaPr", kTH3F, {axisTPCNSigma, axisTOFNSigma, axisPt}); - histos.add("V0/PID/h3dTPCVsTOFNSigmaLaPi", "h3dTPCVsTOFNSigmaLaPi", kTH3F, {axisTPCNSigma, axisTOFNSigma, axisPt}); - - histos.add("MCV0/hv0MCCore", "hv0MCCore", kTH1F, {axisBool}); - histos.add("MCV0/h2dPDGV0VsMother", "h2dPDGV0VsMother", kTHnSparseD, {axisPDGCode, axisPDGCode}); - histos.add("MCV0/h2dPDGV0VsPositive", "h2dPDGV0VsPositive", kTHnSparseD, {axisPDGCode, axisPDGCode}); - histos.add("MCV0/h2dPDGV0VsNegative", "h2dPDGV0VsNegative", kTHnSparseD, {axisPDGCode, axisPDGCode}); - histos.add("MCV0/h2dPDGV0VsIsPhysicalPrimary", "h2dPDGV0VsIsPhysicalPrimary", kTH2F, {axisPDGCode, axisBool}); - histos.add("MCV0/h2dArmenterosP", "h2dArmenterosP", kTH2F, {axisAlpha, axisQtarm}); - histos.add("MCV0/Gamma/h2dpTResolution", "h2dpTResolution", kTH2F, {axisPt, axisPtResolution}); - histos.add("MCV0/Gamma/h2dMass", "h2dMass", kTH2F, {axisPt, axisMassGamma}); - histos.add("MCV0/Gamma/h2dTPCNSigmaEl", "h2dTPCNSigmaEl", kTH2F, {axisPt2, axisTPCNSigma}); - histos.add("MCV0/Gamma/h2dTPCSignal", "h2dTPCSignal", kTH2F, {axisPt2, axisTPCSignal}); - histos.add("MCV0/Gamma/hRadius", "hRadius", kTH1F, {axisV0Radius}); - histos.add("MCV0/Gamma/hCosPA", "hCosPA", kTH1F, {axisCosPA}); - histos.add("MCV0/Gamma/hdcaDau", "hdcaDau", kTH1F, {axisDCAdau}); - histos.add("MCV0/Gamma/hdcaNegtopv", "hdcaNegtopv", kTH1F, {axisDCAToPV}); - histos.add("MCV0/Gamma/hdcaPostopv", "hdcaPostopv", kTH1F, {axisDCAToPV}); - histos.add("MCV0/Gamma/hZ", "hZ", kTH1F, {{240, -120.0f, 120.0f}}); - - histos.add("MCV0/Lambda/h2dpTResolution", "h2dpTResolution", kTH2F, {axisPt, axisPtResolution}); - histos.add("MCV0/Lambda/h2dMass", "h2dMass", kTH2F, {axisPt, axisMassLambda}); - histos.add("MCV0/Lambda/h2dTPCNSigmaPr", "h2dTPCNSigmaPr", kTH2F, {axisPt, axisTPCNSigma}); - histos.add("MCV0/Lambda/h2dTPCNSigmaPi", "h2dTPCNSigmaPi", kTH2F, {axisPt, axisTPCNSigma}); - histos.add("MCV0/Lambda/h2dTPCSignal", "h2dTPCSignal", kTH2F, {axisPt2, axisTPCSignal}); - histos.add("MCV0/Lambda/hRadius", "hRadius", kTH1F, {axisV0Radius}); - histos.add("MCV0/Lambda/hCosPA", "hCosPA", kTH1F, {axisCosPA}); - histos.add("MCV0/Lambda/hdcaDau", "hdcaDau", kTH1F, {axisDCAdau}); - histos.add("MCV0/Lambda/hdcaNegtopv", "hdcaNegtopv", kTH1F, {axisDCAToPV}); - histos.add("MCV0/Lambda/hdcaPostopv", "hdcaPostopv", kTH1F, {axisDCAToPV}); - - histos.add("MCV0/AntiLambda/h2dpTResolution", "h2dpTResolution", kTH2F, {axisPt, axisPtResolution}); - histos.add("MCV0/AntiLambda/h2dMass", "h2dMass", kTH2F, {axisPt, axisMassLambda}); - histos.add("MCV0/AntiLambda/h2dTPCNSigmaPr", "h2dTPCNSigmaPr", kTH2F, {axisPt, axisTPCNSigma}); - histos.add("MCV0/AntiLambda/h2dTPCNSigmaPi", "h2dTPCNSigmaPi", kTH2F, {axisPt, axisTPCNSigma}); - histos.add("MCV0/AntiLambda/h2dTPCSignal", "h2dTPCSignal", kTH2F, {axisPt2, axisTPCSignal}); - histos.add("MCV0/AntiLambda/hRadius", "hRadius", kTH1F, {axisV0Radius}); - histos.add("MCV0/AntiLambda/hCosPA", "hCosPA", kTH1F, {axisCosPA}); - histos.add("MCV0/AntiLambda/hdcaDau", "hdcaDau", kTH1F, {axisDCAdau}); - histos.add("MCV0/AntiLambda/hdcaNegtopv", "hdcaNegtopv", kTH1F, {axisDCAToPV}); - histos.add("MCV0/AntiLambda/hdcaPostopv", "hdcaPostopv", kTH1F, {axisDCAToPV}); - - histos.add("MCV0/K0Short/h2dpTResolution", "h2dpTResolution", kTH2F, {axisPt, axisPtResolution}); - histos.add("MCV0/K0Short/h2dMass", "h2dMass", kTH2F, {axisPt, axisMassK0Short}); - histos.add("MCV0/K0Short/h2dTPCNSigmaPi", "h2dTPCNSigmaPi", kTH2F, {axisPt2, axisTPCNSigma}); - histos.add("MCV0/K0Short/h2dTPCSignal", "h2dTPCSignal", kTH2F, {axisPt2, axisTPCSignal}); - histos.add("MCV0/K0Short/hRadius", "hRadius", kTH1F, {axisV0Radius}); - histos.add("MCV0/K0Short/hCosPA", "hCosPA", kTH1F, {axisCosPA}); - histos.add("MCV0/K0Short/hdcaDau", "hdcaDau", kTH1F, {axisDCAdau}); - histos.add("MCV0/K0Short/hdcaNegtopv", "hdcaNegtopv", kTH1F, {axisDCAToPV}); - histos.add("MCV0/K0Short/hdcaPostopv", "hdcaPostopv", kTH1F, {axisDCAToPV}); - - histos.add("Casc/Sign", "Sign", kTH1F, {{3, -1.5f, 1.5f}}); - histos.add("Casc/hpT", "hpT", kTH1F, {axisPt}); - histos.add("Casc/hV0Radius", "hV0Radius", kTH1F, {axisV0Radius}); - histos.add("Casc/hCascRadius", "hCascRadius", kTH1F, {axisCascRadius}); - histos.add("Casc/hV0CosPA", "hV0CosPA", kTH1F, {axisCosPA}); - histos.add("Casc/hCascCosPA", "hCascCosPA", kTH1F, {axisCosPA}); - histos.add("Casc/hDCAPosToPV", "hDCAPosToPV", kTH1F, {axisDCAToPV}); - histos.add("Casc/hDCANegToPV", "hDCANegToPV", kTH1F, {axisDCAToPV}); - histos.add("Casc/hDCABachToPV", "hDCABachToPV", kTH1F, {axisDCAToPV}); - histos.add("Casc/hDCAXYCascToPV", "hDCAXYCascToPV", kTH1F, {axisDCAXYCascToPV}); - histos.add("Casc/hDCAZCascToPV", "hDCAZCascToPV", kTH1F, {axisDCAZCascToPV}); - histos.add("Casc/hDCAV0ToPV", "hDCAV0ToPV", kTH1F, {axisDCAV0ToPV}); - histos.add("Casc/hDCAV0Dau", "hDCAV0Dau", kTH1F, {axisDCAV0Dau}); - histos.add("Casc/hDCACascDau", "hDCACascDau", kTH1F, {axisDCACascDau}); - histos.add("Casc/hLambdaMass", "hLambdaMass", kTH1F, {axisMassLambda}); - - histos.add("Casc/Track/h3dTrackProperties", "h3dTrackProperties", kTH3F, {axisTrackProperties, axisTrackProperties, axisTrackProperties}); - histos.add("Casc/Track/h2dPosTrackProperties", "h2dPosTrackProperties", kTH2F, {axisTrackProperties, axisPt}); - histos.add("Casc/Track/h2dNegTrackProperties", "h2dNegTrackProperties", kTH2F, {axisTrackProperties, axisPt}); - histos.add("Casc/Track/h2dBachTrackProperties", "h2dBachTrackProperties", kTH2F, {axisTrackProperties, axisPt}); - histos.add("Casc/Track/h2dV0ITSChi2PerNcl", "h2dV0ITSChi2PerNcl", kTH2F, {axisPt2, axisChi2PerNcl}); - histos.add("Casc/Track/h2dV0TPCCrossedRows", "h2dV0TPCCrossedRows", kTH2F, {axisPt2, axisTPCrows}); - histos.add("Casc/Track/h2dV0ITSNCls", "h2dV0ITSNCls", kTH2F, {axisPt2, axisNCls}); - - histos.add("Casc/PID/h2dV0TPCNSigmaPr", "h2dV0TPCNSigmaPr", kTH2F, {axisPt2, axisTPCNSigma}); - histos.add("Casc/PID/h2dV0TPCNSigmaPi", "h2dV0TPCNSigmaPi", kTH2F, {axisPt2, axisTPCNSigma}); - histos.add("Casc/PID/h2dV0TPCSignal", "h2dV0TPCSignal", kTH2F, {axisPt2, axisTPCSignal}); - histos.add("Casc/PID/h2dTOFNSigmaXiLaPi", "h2dTOFNSigmaXiLaPi", kTH2F, {axisPt, axisTOFNSigma}); - histos.add("Casc/PID/h2dTOFNSigmaXiLaPr", "h2dTOFNSigmaXiLaPr", kTH2F, {axisPt, axisTOFNSigma}); - histos.add("Casc/PID/h2dTOFNSigmaXiPi", "h2dTOFNSigmaXiPi", kTH2F, {axisPt, axisTOFNSigma}); - histos.add("Casc/PID/h2dTOFNSigmaOmLaPi", "h2dTOFNSigmaOmLaPi", kTH2F, {axisPt, axisTOFNSigma}); - histos.add("Casc/PID/h2dTOFNSigmaOmLaPr", "h2dTOFNSigmaOmLaPr", kTH2F, {axisPt, axisTOFNSigma}); - histos.add("Casc/PID/h2dTOFNSigmaOmKa", "h2dTOFNSigmaOmKa", kTH2F, {axisPt, axisTOFNSigma}); - - histos.add("Casc/hMassXiMinus", "hMassXiMinus", kTH1F, {axisXiMass}); - histos.add("Casc/hMassOmegaMinus", "hMassOmegaMinus", kTH1F, {axisOmegaMass}); - histos.add("Casc/hMassXiPlus", "hMassXiPlus", kTH1F, {axisXiMass}); - histos.add("Casc/hMassOmegaPlus", "hMassOmegaPlus", kTH1F, {axisOmegaMass}); - histos.add("Casc/Track/h2dBachITSNCls", "h2dBachITSNCls", kTH2F, {axisPt2, axisNCls}); - histos.add("Casc/Track/h2dBachITSChi2PerNcl", "h2dBachITSChi2PerNcl", kTH2F, {axisPt2, axisChi2PerNcl}); - histos.add("Casc/Track/h2dBachTPCCrossedRows", "h2dBachTPCCrossedRows", kTH2F, {axisPt2, axisTPCrows}); - histos.add("Casc/PID/h2dBachTPCSignal", "h2dBachTPCSignal", kTH2F, {axisPt2, axisTPCSignal}); - - histos.add("MCCasc/hcascMCCore", "hcascMCCore", kTH1F, {axisBool}); - histos.add("MCCasc/h2dPDGV0VsMother", "h2dPDGV0VsMother", kTHnSparseD, {axisPDGCode, axisPDGCode}); - histos.add("MCCasc/h2dPDGV0VsPositive", "h2dPDGV0VsPositive", kTHnSparseD, {axisPDGCode, axisPDGCode}); - histos.add("MCCasc/h2dPDGV0VsNegative", "h2dPDGV0VsNegative", kTHnSparseD, {axisPDGCode, axisPDGCode}); - histos.add("MCCasc/h2dPDGV0VsBach", "h2dPDGV0VsBach", kTHnSparseD, {axisPDGCode, axisPDGCode}); - histos.add("MCCasc/h2dPDGV0VsIsPhysicalPrimary", "h2dPDGV0VsIsPhysicalPrimary", kTH2F, {axisPDGCode, axisBool}); - - histos.add("MCCasc/XiMinus/h2dpTResolution", "h2dpTResolution", kTH2F, {axisPt, axisPtResolution}); - histos.add("MCCasc/XiMinus/h2dMass", "h2dMass", kTH2F, {axisPt, axisXiMass}); - histos.add("MCCasc/XiMinus/h2dV0TPCSignal", "h2dV0TPCSignal", kTH2F, {axisPt2, axisTPCSignal}); - histos.add("MCCasc/XiMinus/h2dBachTPCSignal", "h2dBachTPCSignal", kTH2F, {axisPt, axisTPCSignal}); - histos.add("MCCasc/XiMinus/hV0Radius", "hV0Radius", kTH1F, {axisV0Radius}); - histos.add("MCCasc/XiMinus/hCascRadius", "hCascRadius", kTH1F, {axisCascRadius}); - histos.add("MCCasc/XiMinus/hV0CosPA", "hV0CosPA", kTH1F, {axisCosPA}); - histos.add("MCCasc/XiMinus/hCascCosPA", "hCascCosPA", kTH1F, {axisCosPA}); - histos.add("MCCasc/XiMinus/hDCAPosToPV", "hDCAPosToPV", kTH1F, {axisDCAToPV}); - histos.add("MCCasc/XiMinus/hDCANegToPV", "hDCANegToPV", kTH1F, {axisDCAToPV}); - histos.add("MCCasc/XiMinus/hDCABachToPV", "hDCABachToPV", kTH1F, {axisDCAToPV}); - histos.add("MCCasc/XiMinus/hDCAXYCascToPV", "hDCAXYCascToPV", kTH1F, {axisDCAXYCascToPV}); - histos.add("MCCasc/XiMinus/hDCAZCascToPV", "hDCAZCascToPV", kTH1F, {axisDCAZCascToPV}); - histos.add("MCCasc/XiMinus/hDCAV0ToPV", "hDCAV0ToPV", kTH1F, {axisDCAV0ToPV}); - histos.add("MCCasc/XiMinus/hDCAV0Dau", "hDCAV0Dau", kTH1F, {axisDCAV0Dau}); - histos.add("MCCasc/XiMinus/hDCACascDau", "hDCACascDau", kTH1F, {axisDCACascDau}); - histos.add("MCCasc/XiMinus/hLambdaMass", "hLambdaMass", kTH1F, {axisMassLambda}); - - histos.add("MCCasc/XiPlus/h2dpTResolution", "h2dpTResolution", kTH2F, {axisPt, axisPtResolution}); - histos.add("MCCasc/XiPlus/h2dMass", "h2dMass", kTH2F, {axisPt, axisXiMass}); - histos.add("MCCasc/XiPlus/h2dV0TPCSignal", "h2dV0TPCSignal", kTH2F, {axisPt2, axisTPCSignal}); - histos.add("MCCasc/XiPlus/h2dBachTPCSignal", "h2dBachTPCSignal", kTH2F, {axisPt, axisTPCSignal}); - histos.add("MCCasc/XiPlus/hV0Radius", "hV0Radius", kTH1F, {axisV0Radius}); - histos.add("MCCasc/XiPlus/hCascRadius", "hCascRadius", kTH1F, {axisCascRadius}); - histos.add("MCCasc/XiPlus/hV0CosPA", "hV0CosPA", kTH1F, {axisCosPA}); - histos.add("MCCasc/XiPlus/hCascCosPA", "hCascCosPA", kTH1F, {axisCosPA}); - histos.add("MCCasc/XiPlus/hDCAPosToPV", "hDCAPosToPV", kTH1F, {axisDCAToPV}); - histos.add("MCCasc/XiPlus/hDCANegToPV", "hDCANegToPV", kTH1F, {axisDCAToPV}); - histos.add("MCCasc/XiPlus/hDCABachToPV", "hDCABachToPV", kTH1F, {axisDCAToPV}); - histos.add("MCCasc/XiPlus/hDCAXYCascToPV", "hDCAXYCascToPV", kTH1F, {axisDCAXYCascToPV}); - histos.add("MCCasc/XiPlus/hDCAZCascToPV", "hDCAZCascToPV", kTH1F, {axisDCAZCascToPV}); - histos.add("MCCasc/XiPlus/hDCAV0ToPV", "hDCAV0ToPV", kTH1F, {axisDCAV0ToPV}); - histos.add("MCCasc/XiPlus/hDCAV0Dau", "hDCAV0Dau", kTH1F, {axisDCAV0Dau}); - histos.add("MCCasc/XiPlus/hDCACascDau", "hDCACascDau", kTH1F, {axisDCACascDau}); - histos.add("MCCasc/XiPlus/hLambdaMass", "hLambdaMass", kTH1F, {axisMassLambda}); - - histos.add("MCCasc/OmegaMinus/h2dpTResolution", "h2dpTResolution", kTH2F, {axisPt, axisPtResolution}); - histos.add("MCCasc/OmegaMinus/h2dMass", "h2dMass", kTH2F, {axisPt, axisOmegaMass}); - histos.add("MCCasc/OmegaMinus/h2dV0TPCSignal", "h2dV0TPCSignal", kTH2F, {axisPt2, axisTPCSignal}); - histos.add("MCCasc/OmegaMinus/h2dBachTPCSignal", "h2dBachTPCSignal", kTH2F, {axisPt, axisTPCSignal}); - histos.add("MCCasc/OmegaMinus/hV0Radius", "hV0Radius", kTH1F, {axisV0Radius}); - histos.add("MCCasc/OmegaMinus/hCascRadius", "hCascRadius", kTH1F, {axisCascRadius}); - histos.add("MCCasc/OmegaMinus/hV0CosPA", "hV0CosPA", kTH1F, {axisCosPA}); - histos.add("MCCasc/OmegaMinus/hCascCosPA", "hCascCosPA", kTH1F, {axisCosPA}); - histos.add("MCCasc/OmegaMinus/hDCAPosToPV", "hDCAPosToPV", kTH1F, {axisDCAToPV}); - histos.add("MCCasc/OmegaMinus/hDCANegToPV", "hDCANegToPV", kTH1F, {axisDCAToPV}); - histos.add("MCCasc/OmegaMinus/hDCABachToPV", "hDCABachToPV", kTH1F, {axisDCAToPV}); - histos.add("MCCasc/OmegaMinus/hDCAXYCascToPV", "hDCAXYCascToPV", kTH1F, {axisDCAXYCascToPV}); - histos.add("MCCasc/OmegaMinus/hDCAZCascToPV", "hDCAZCascToPV", kTH1F, {axisDCAZCascToPV}); - histos.add("MCCasc/OmegaMinus/hDCAV0ToPV", "hDCAV0ToPV", kTH1F, {axisDCAV0ToPV}); - histos.add("MCCasc/OmegaMinus/hDCAV0Dau", "hDCAV0Dau", kTH1F, {axisDCAV0Dau}); - histos.add("MCCasc/OmegaMinus/hDCACascDau", "hDCACascDau", kTH1F, {axisDCACascDau}); - histos.add("MCCasc/OmegaMinus/hLambdaMass", "hLambdaMass", kTH1F, {axisMassLambda}); - - histos.add("MCCasc/OmegaPlus/h2dpTResolution", "h2dpTResolution", kTH2F, {axisPt, axisPtResolution}); - histos.add("MCCasc/OmegaPlus/h2dMass", "h2dMass", kTH2F, {axisPt, axisOmegaMass}); - histos.add("MCCasc/OmegaPlus/h2dV0TPCSignal", "h2dV0TPCSignal", kTH2F, {axisPt2, axisTPCSignal}); - histos.add("MCCasc/OmegaPlus/h2dBachTPCSignal", "h2dBachTPCSignal", kTH2F, {axisPt, axisTPCSignal}); - histos.add("MCCasc/OmegaPlus/hV0Radius", "hV0Radius", kTH1F, {axisV0Radius}); - histos.add("MCCasc/OmegaPlus/hCascRadius", "hCascRadius", kTH1F, {axisCascRadius}); - histos.add("MCCasc/OmegaPlus/hV0CosPA", "hV0CosPA", kTH1F, {axisCosPA}); - histos.add("MCCasc/OmegaPlus/hCascCosPA", "hCascCosPA", kTH1F, {axisCosPA}); - histos.add("MCCasc/OmegaPlus/hDCAPosToPV", "hDCAPosToPV", kTH1F, {axisDCAToPV}); - histos.add("MCCasc/OmegaPlus/hDCANegToPV", "hDCANegToPV", kTH1F, {axisDCAToPV}); - histos.add("MCCasc/OmegaPlus/hDCABachToPV", "hDCABachToPV", kTH1F, {axisDCAToPV}); - histos.add("MCCasc/OmegaPlus/hDCAXYCascToPV", "hDCAXYCascToPV", kTH1F, {axisDCAXYCascToPV}); - histos.add("MCCasc/OmegaPlus/hDCAZCascToPV", "hDCAZCascToPV", kTH1F, {axisDCAZCascToPV}); - histos.add("MCCasc/OmegaPlus/hDCAV0ToPV", "hDCAV0ToPV", kTH1F, {axisDCAV0ToPV}); - histos.add("MCCasc/OmegaPlus/hDCAV0Dau", "hDCAV0Dau", kTH1F, {axisDCAV0Dau}); - histos.add("MCCasc/OmegaPlus/hDCACascDau", "hDCACascDau", kTH1F, {axisDCACascDau}); - histos.add("MCCasc/OmegaPlus/hLambdaMass", "hLambdaMass", kTH1F, {axisMassLambda}); + histos.add("Event/hft0cOccupancyInTimeRange", "hft0cOccupancyInTimeRange", kTH1F, {AxisConfig.axisFt0cOccupancyInTimeRange}); + histos.add("Event/htrackOccupancyInTimeRange", "htrackOccupancyInTimeRange", kTH1F, {AxisConfig.axisTrackOccupancyInTimeRange}); + histos.add("Event/h2dMultFT0C", "h2dMultFT0C", kTH2F, {AxisConfig.axisCentrality, AxisConfig.axisMultFT0C}); + histos.add("Event/h2dMultNTracksPVeta1", "h2dMultNTracksPVeta1", kTH2F, {AxisConfig.axisCentrality, AxisConfig.axisMultNTracksPVeta1}); + histos.add("Event/h2dMultPVTotalContributors", "h2dMultPVTotalContributors", kTH2F, {AxisConfig.axisCentrality, AxisConfig.axisMultPVTotalContributors}); + histos.add("Event/h2dMultAllTracksTPCOnly", "h2dMultAllTracksTPCOnly", kTH2F, {AxisConfig.axisCentrality, AxisConfig.axisMultAllTracksTPCOnly}); + histos.add("Event/h2dMultAllTracksITSTPC", "h2dMultAllTracksITSTPC", kTH2F, {AxisConfig.axisCentrality, AxisConfig.axisMultAllTracksITSTPC}); + histos.add("Event/h2dNumV0sPerColl", "h2dNumV0sPerColl", kTH2F, {AxisConfig.axisCentrality, AxisConfig.axisNumV0sPerColl}); + + if (doprocessDerivedV0s) { + histos.add("V0/hpT", "hpT", kTH1F, {AxisConfig.axisPt}); + histos.add("V0/h2dArmenterosP", "h2dArmenterosP", kTH2F, {AxisConfig.axisAlpha, AxisConfig.axisQtarm}); + histos.add("V0/hRadius", "hRadius", kTH1F, {AxisConfig.axisV0Radius}); + histos.add("V0/hZ", "hZ", kTH1F, {AxisConfig.axisPosZ}); + histos.add("V0/hCosPA", "hCosPA", kTH1F, {AxisConfig.axisCosPA}); + histos.add("V0/hdcaDau", "hdcaDau", kTH1F, {AxisConfig.axisDCAdau}); + histos.add("V0/hdcaNegtopv", "hdcaNegtopv", kTH1F, {AxisConfig.axisDCAToPV}); + histos.add("V0/hdcaPostopv", "hdcaPostopv", kTH1F, {AxisConfig.axisDCAToPV}); + histos.add("V0/h2dEtaPhi", "h2dEtaPhi", kTH2F, {AxisConfig.axisEta, AxisConfig.axisPhi}); + histos.add("V0/hYGamma", "hYGamma", kTH1F, {AxisConfig.axisEta}); + histos.add("V0/hYLambda", "hYLambda", kTH1F, {AxisConfig.axisEta}); + histos.add("V0/hYK0Short", "hYK0Short", kTH1F, {AxisConfig.axisEta}); + histos.add("V0/hMassGamma", "hMassGamma", kTH1F, {AxisConfig.axisMassGamma}); + histos.add("V0/hMassLambda", "hMassLambda", kTH1F, {AxisConfig.axisMassLambda}); + histos.add("V0/hMassALambda", "hMassALambda", kTH1F, {AxisConfig.axisMassLambda}); + histos.add("V0/hMassK0Short", "hMassK0Short", kTH1F, {AxisConfig.axisMassK0Short}); + + histos.add("V0/h3dPAVsPtVsGammaMass", "h3dPAVsPtVsGammaMass", kTH3D, {AxisConfig.axisPA, AxisConfig.axisPt, AxisConfig.axisMassGamma}); + histos.add("V0/h3dPAVsPtVsLambdaMass", "h3dPAVsPtVsLambdaMass", kTH3D, {AxisConfig.axisPA, AxisConfig.axisPt, AxisConfig.axisMassLambda}); + histos.add("V0/h3dPAVsPtVsALambdaMass", "h3dPAVsPtVsALambdaMass", kTH3D, {AxisConfig.axisPA, AxisConfig.axisPt, AxisConfig.axisMassLambda}); + histos.add("V0/h3dPAVsPtVsK0SMassMass", "h3dPAVsPtVsK0SMassMass", kTH3D, {AxisConfig.axisPA, AxisConfig.axisPt, AxisConfig.axisMassK0Short}); + + histos.add("V0/hV0Type", "hV0Type", kTH1F, {AxisConfig.axisV0Type}); + histos.add("V0/h2dV0Indices", "h2dV0Indices", kTH2F, {AxisConfig.axisStraCollisionId, AxisConfig.axisGlobalIndex}); + + histos.add("V0/Track/h2dITSNCls", "h2dITSNCls", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisNCls}); + histos.add("V0/Track/h2dITSChi2PerNcl", "h2dITSChi2PerNcl", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisChi2PerNcl}); + histos.add("V0/Track/h2dTPCCrossedRows", "h2dTPCCrossedRows", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisTPCrows}); + + histos.add("V0/Track/h2dPosTrackProperties", "h2dPosTrackProperties", kTH2F, {AxisConfig.axisTrackProperties, AxisConfig.axisPt}); + histos.add("V0/Track/h3dTrackPropertiesVspT", "h3dTrackPropertiesVspT", kTH3F, {AxisConfig.axisTrackProperties, AxisConfig.axisTrackProperties, AxisConfig.axisPt}); + histos.add("V0/Track/h2dNegTrackProperties", "h2dNegTrackProperties", kTH2F, {AxisConfig.axisTrackProperties, AxisConfig.axisPt}); + + // Add histogram to the list + histos.add("V0/Track/hTrackCode", "hTrackCode", kTH1F, {AxisConfig.axisTrackProperties}); + + // Set bin labels for all combinations + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(1, "None"); // Code 0 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(2, "TPC"); // Code 1 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(3, "ITSTracker"); // Code 2 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(4, "ITSTracker + TPC"); // Code 3 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(5, "ITSAfterburner"); // Code 4 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(6, "ITSAfterburner + TPC"); // Code 5 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(7, "ITSAfterburner + ITSTracker"); // Code 6 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(8, "ITSAfterburner + ITSTracker + TPC"); // Code 7 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(9, "TRD"); // Code 8 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(10, "TRD + TPC"); // Code 9 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(11, "TRD + ITSTracker"); // Code 10 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(12, "TRD + ITSTracker + TPC"); // Code 11 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(13, "TRD + ITSAfterburner"); // Code 12 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(14, "TRD + ITSAfterburner + TPC"); // Code 13 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(15, "TRD + ITSAfterburner + ITSTracker"); // Code 14 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(16, "TRD + ITSAfterburner + ITSTracker + TPC"); // Code 15 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(17, "TOF"); // Code 16 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(18, "TOF + TPC"); // Code 17 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(19, "TOF + ITSTracker"); // Code 18 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(20, "TOF + ITSTracker + TPC"); // Code 19 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(21, "TOF + ITSAfterburner"); // Code 20 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(22, "TOF + ITSAfterburner + TPC"); // Code 21 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(23, "TOF + ITSAfterburner + ITSTracker"); // Code 22 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(24, "TOF + ITSAfterburner + ITSTracker + TPC"); // Code 23 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(25, "TOF + TRD"); // Code 24 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(26, "TOF + TRD + TPC"); // Code 25 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(27, "TOF + TRD + ITSTracker"); // Code 26 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(28, "TOF + TRD + ITSTracker + TPC"); // Code 27 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(29, "TOF + TRD + ITSAfterburner"); // Code 28 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(30, "TOF + TRD + ITSAfterburner + TPC"); // Code 29 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(31, "TOF + TRD + ITSAfterburner + ITSTracker"); // Code 30 + histos.get(HIST("V0/Track/hTrackCode"))->GetXaxis()->SetBinLabel(32, "All"); // Code 31 + + histos.add("V0/PID/h2dTPCNSigmaEl", "h2dTPCNSigmaEl", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisTPCNSigma}); + histos.add("V0/PID/h2dTPCNSigmaPr", "h2dTPCNSigmaPr", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisTPCNSigma}); + histos.add("V0/PID/h2dTPCNSigmaPi", "h2dTPCNSigmaPi", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisTPCNSigma}); + histos.add("V0/PID/h2dTPCSignal", "h2dTPCSignal", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisTPCSignal}); + + histos.add("V0/PID/h2dTOFNSigmaLaPr", "h2dTOFNSigmaLaPr", kTH2F, {AxisConfig.axisPt, AxisConfig.axisTOFNSigma}); + histos.add("V0/PID/h2dTOFNSigmaLaPi", "h2dTOFNSigmaLaPi", kTH2F, {AxisConfig.axisPt, AxisConfig.axisTOFNSigma}); + histos.add("V0/PID/h2dposTOFDeltaTLaPr", "h2dposTOFDeltaTLaPr", kTH2F, {AxisConfig.axisPt, AxisConfig.axisTOFDeltaT}); + histos.add("V0/PID/h2dnegTOFDeltaTLaPi", "h2dnegTOFDeltaTLaPi", kTH2F, {AxisConfig.axisPt, AxisConfig.axisTOFDeltaT}); + histos.add("V0/PID/h2dnegTOFDeltaTLaPr", "h2dnegTOFDeltaTLaPr", kTH2F, {AxisConfig.axisPt, AxisConfig.axisTOFDeltaT}); + histos.add("V0/PID/h2dposTOFDeltaTLaPi", "h2dposTOFDeltaTLaPi", kTH2F, {AxisConfig.axisPt, AxisConfig.axisTOFDeltaT}); + histos.add("V0/PID/h2dTOFNSigmaALaPr", "h2dTOFNSigmaALaPr", kTH2F, {AxisConfig.axisPt, AxisConfig.axisTOFNSigma}); + histos.add("V0/PID/h2dTOFNSigmaALaPi", "h2dTOFNSigmaALaPi", kTH2F, {AxisConfig.axisPt, AxisConfig.axisTOFNSigma}); + histos.add("V0/PID/h2dTOFNSigmaK0PiPlus", "h2dTOFNSigmaK0PiPlus", kTH2F, {AxisConfig.axisPt, AxisConfig.axisTOFNSigma}); + histos.add("V0/PID/h2dTOFNSigmaK0PiMinus", "h2dTOFNSigmaK0PiMinus", kTH2F, {AxisConfig.axisPt, AxisConfig.axisTOFNSigma}); + histos.add("V0/PID/h3dTPCVsTOFNSigmaLaPr", "h3dTPCVsTOFNSigmaLaPr", kTH3F, {AxisConfig.axisTPCNSigma, AxisConfig.axisTOFNSigma, AxisConfig.axisPt}); + histos.add("V0/PID/h3dTPCVsTOFNSigmaLaPi", "h3dTPCVsTOFNSigmaLaPi", kTH3F, {AxisConfig.axisTPCNSigma, AxisConfig.axisTOFNSigma, AxisConfig.axisPt}); + } + if (doprocessMCDerivedV0s) { + histos.add("MCV0/hv0MCCore", "hv0MCCore", kTH1F, {AxisConfig.axisBool}); + histos.add("MCV0/h2dPDGV0VsMother", "h2dPDGV0VsMother", kTHnSparseD, {AxisConfig.axisPDGCode, AxisConfig.axisPDGCode}); + histos.add("MCV0/h2dPDGV0VsPositive", "h2dPDGV0VsPositive", kTHnSparseD, {AxisConfig.axisPDGCode, AxisConfig.axisPDGCode}); + histos.add("MCV0/h2dPDGV0VsNegative", "h2dPDGV0VsNegative", kTHnSparseD, {AxisConfig.axisPDGCode, AxisConfig.axisPDGCode}); + histos.add("MCV0/h2dPDGV0VsIsPhysicalPrimary", "h2dPDGV0VsIsPhysicalPrimary", kTH2F, {AxisConfig.axisPDGCode, AxisConfig.axisBool}); + histos.add("MCV0/h2dArmenterosP", "h2dArmenterosP", kTH2F, {AxisConfig.axisAlpha, AxisConfig.axisQtarm}); + + histos.add("MCV0/Gamma/h2dpTResolution", "h2dpTResolution", kTH2F, {AxisConfig.axisPt, AxisConfig.axisPtResolution}); + histos.add("MCV0/Gamma/h2dMass", "h2dMass", kTH2F, {AxisConfig.axisPt, AxisConfig.axisMassGamma}); + histos.add("MCV0/Gamma/h2dTPCNSigmaEl", "h2dTPCNSigmaEl", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisTPCNSigma}); + histos.add("MCV0/Gamma/h2dTPCSignal", "h2dTPCSignal", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisTPCSignal}); + histos.add("MCV0/Gamma/hRadius", "hRadius", kTH1F, {AxisConfig.axisV0Radius}); + histos.add("MCV0/Gamma/hCosPA", "hCosPA", kTH1F, {AxisConfig.axisCosPA}); + histos.add("MCV0/Gamma/hdcaDau", "hdcaDau", kTH1F, {AxisConfig.axisDCAdau}); + histos.add("MCV0/Gamma/hdcaNegtopv", "hdcaNegtopv", kTH1F, {AxisConfig.axisDCAToPV}); + histos.add("MCV0/Gamma/hdcaPostopv", "hdcaPostopv", kTH1F, {AxisConfig.axisDCAToPV}); + histos.add("MCV0/Gamma/hZ", "hZ", kTH1F, {{240, -120.0f, 120.0f}}); + histos.add("MCV0/Gamma/h3dPAVsPtVsMass", "h3dPAVsPtVsMass", kTH3D, {AxisConfig.axisPA, AxisConfig.axisPt, AxisConfig.axisMassGamma}); + + histos.add("MCV0/Lambda/h2dpTResolution", "h2dpTResolution", kTH2F, {AxisConfig.axisPt, AxisConfig.axisPtResolution}); + histos.add("MCV0/Lambda/h2dMass", "h2dMass", kTH2F, {AxisConfig.axisPt, AxisConfig.axisMassLambda}); + histos.add("MCV0/Lambda/h2dTPCNSigmaPr", "h2dTPCNSigmaPr", kTH2F, {AxisConfig.axisPt, AxisConfig.axisTPCNSigma}); + histos.add("MCV0/Lambda/h2dTPCNSigmaPi", "h2dTPCNSigmaPi", kTH2F, {AxisConfig.axisPt, AxisConfig.axisTPCNSigma}); + histos.add("MCV0/Lambda/h2dTPCSignal", "h2dTPCSignal", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisTPCSignal}); + histos.add("MCV0/Lambda/hRadius", "hRadius", kTH1F, {AxisConfig.axisV0Radius}); + histos.add("MCV0/Lambda/hCosPA", "hCosPA", kTH1F, {AxisConfig.axisCosPA}); + histos.add("MCV0/Lambda/hdcaDau", "hdcaDau", kTH1F, {AxisConfig.axisDCAdau}); + histos.add("MCV0/Lambda/hdcaNegtopv", "hdcaNegtopv", kTH1F, {AxisConfig.axisDCAToPV}); + histos.add("MCV0/Lambda/hdcaPostopv", "hdcaPostopv", kTH1F, {AxisConfig.axisDCAToPV}); + histos.add("MCV0/Lambda/h3dPAVsPtVsMass", "h3dPAVsPtVsMass", kTH3D, {AxisConfig.axisPA, AxisConfig.axisPt, AxisConfig.axisMassLambda}); + + histos.add("MCV0/AntiLambda/h2dpTResolution", "h2dpTResolution", kTH2F, {AxisConfig.axisPt, AxisConfig.axisPtResolution}); + histos.add("MCV0/AntiLambda/h2dMass", "h2dMass", kTH2F, {AxisConfig.axisPt, AxisConfig.axisMassLambda}); + histos.add("MCV0/AntiLambda/h2dTPCNSigmaPr", "h2dTPCNSigmaPr", kTH2F, {AxisConfig.axisPt, AxisConfig.axisTPCNSigma}); + histos.add("MCV0/AntiLambda/h2dTPCNSigmaPi", "h2dTPCNSigmaPi", kTH2F, {AxisConfig.axisPt, AxisConfig.axisTPCNSigma}); + histos.add("MCV0/AntiLambda/h2dTPCSignal", "h2dTPCSignal", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisTPCSignal}); + histos.add("MCV0/AntiLambda/hRadius", "hRadius", kTH1F, {AxisConfig.axisV0Radius}); + histos.add("MCV0/AntiLambda/hCosPA", "hCosPA", kTH1F, {AxisConfig.axisCosPA}); + histos.add("MCV0/AntiLambda/hdcaDau", "hdcaDau", kTH1F, {AxisConfig.axisDCAdau}); + histos.add("MCV0/AntiLambda/hdcaNegtopv", "hdcaNegtopv", kTH1F, {AxisConfig.axisDCAToPV}); + histos.add("MCV0/AntiLambda/hdcaPostopv", "hdcaPostopv", kTH1F, {AxisConfig.axisDCAToPV}); + histos.add("MCV0/AntiLambda/h3dPAVsPtVsMass", "h3dPAVsPtVsMass", kTH3D, {AxisConfig.axisPA, AxisConfig.axisPt, AxisConfig.axisMassLambda}); + + histos.add("MCV0/K0Short/h2dpTResolution", "h2dpTResolution", kTH2F, {AxisConfig.axisPt, AxisConfig.axisPtResolution}); + histos.add("MCV0/K0Short/h2dMass", "h2dMass", kTH2F, {AxisConfig.axisPt, AxisConfig.axisMassK0Short}); + histos.add("MCV0/K0Short/h2dTPCNSigmaPi", "h2dTPCNSigmaPi", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisTPCNSigma}); + histos.add("MCV0/K0Short/h2dTPCSignal", "h2dTPCSignal", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisTPCSignal}); + histos.add("MCV0/K0Short/hRadius", "hRadius", kTH1F, {AxisConfig.axisV0Radius}); + histos.add("MCV0/K0Short/hCosPA", "hCosPA", kTH1F, {AxisConfig.axisCosPA}); + histos.add("MCV0/K0Short/hdcaDau", "hdcaDau", kTH1F, {AxisConfig.axisDCAdau}); + histos.add("MCV0/K0Short/hdcaNegtopv", "hdcaNegtopv", kTH1F, {AxisConfig.axisDCAToPV}); + histos.add("MCV0/K0Short/hdcaPostopv", "hdcaPostopv", kTH1F, {AxisConfig.axisDCAToPV}); + histos.add("MCV0/K0Short/h3dPAVsPtVsMass", "h3dPAVsPtVsMass", kTH3D, {AxisConfig.axisPA, AxisConfig.axisPt, AxisConfig.axisMassK0Short}); + } + if (doprocessDerivedCascades) { + histos.add("Casc/Sign", "Sign", kTH1F, {{3, -1.5f, 1.5f}}); + histos.add("Casc/hpT", "hpT", kTH1F, {AxisConfig.axisPt}); + histos.add("Casc/hV0Radius", "hV0Radius", kTH1F, {AxisConfig.axisV0Radius}); + histos.add("Casc/hCascRadius", "hCascRadius", kTH1F, {AxisConfig.axisCascRadius}); + histos.add("Casc/hV0CosPA", "hV0CosPA", kTH1F, {AxisConfig.axisCosPA}); + histos.add("Casc/hCascCosPA", "hCascCosPA", kTH1F, {AxisConfig.axisCosPA}); + histos.add("Casc/hDCAPosToPV", "hDCAPosToPV", kTH1F, {AxisConfig.axisDCAToPV}); + histos.add("Casc/hDCANegToPV", "hDCANegToPV", kTH1F, {AxisConfig.axisDCAToPV}); + histos.add("Casc/hDCABachToPV", "hDCABachToPV", kTH1F, {AxisConfig.axisDCAToPV}); + histos.add("Casc/hDCAXYCascToPV", "hDCAXYCascToPV", kTH1F, {AxisConfig.axisDCAXYCascToPV}); + histos.add("Casc/hDCAZCascToPV", "hDCAZCascToPV", kTH1F, {AxisConfig.axisDCAZCascToPV}); + histos.add("Casc/hDCAV0ToPV", "hDCAV0ToPV", kTH1F, {AxisConfig.axisDCAV0ToPV}); + histos.add("Casc/hDCAV0Dau", "hDCAV0Dau", kTH1F, {AxisConfig.axisDCAV0Dau}); + histos.add("Casc/hDCACascDau", "hDCACascDau", kTH1F, {AxisConfig.axisDCACascDau}); + histos.add("Casc/hLambdaMass", "hLambdaMass", kTH1F, {AxisConfig.axisMassLambda}); + + histos.add("Casc/Track/h3dTrackProperties", "h3dTrackProperties", kTH3F, {AxisConfig.axisTrackProperties, AxisConfig.axisTrackProperties, AxisConfig.axisTrackProperties}); + histos.add("Casc/Track/h2dPosTrackProperties", "h2dPosTrackProperties", kTH2F, {AxisConfig.axisTrackProperties, AxisConfig.axisPt}); + histos.add("Casc/Track/h2dNegTrackProperties", "h2dNegTrackProperties", kTH2F, {AxisConfig.axisTrackProperties, AxisConfig.axisPt}); + histos.add("Casc/Track/h2dBachTrackProperties", "h2dBachTrackProperties", kTH2F, {AxisConfig.axisTrackProperties, AxisConfig.axisPt}); + histos.add("Casc/Track/h2dV0ITSChi2PerNcl", "h2dV0ITSChi2PerNcl", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisChi2PerNcl}); + histos.add("Casc/Track/h2dV0TPCCrossedRows", "h2dV0TPCCrossedRows", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisTPCrows}); + histos.add("Casc/Track/h2dV0ITSNCls", "h2dV0ITSNCls", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisNCls}); + + histos.add("Casc/PID/h2dV0TPCNSigmaPr", "h2dV0TPCNSigmaPr", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisTPCNSigma}); + histos.add("Casc/PID/h2dV0TPCNSigmaPi", "h2dV0TPCNSigmaPi", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisTPCNSigma}); + histos.add("Casc/PID/h2dV0TPCSignal", "h2dV0TPCSignal", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisTPCSignal}); + histos.add("Casc/PID/h2dTOFNSigmaXiLaPi", "h2dTOFNSigmaXiLaPi", kTH2F, {AxisConfig.axisPt, AxisConfig.axisTOFNSigma}); + histos.add("Casc/PID/h2dTOFNSigmaXiLaPr", "h2dTOFNSigmaXiLaPr", kTH2F, {AxisConfig.axisPt, AxisConfig.axisTOFNSigma}); + histos.add("Casc/PID/h2dTOFNSigmaXiPi", "h2dTOFNSigmaXiPi", kTH2F, {AxisConfig.axisPt, AxisConfig.axisTOFNSigma}); + histos.add("Casc/PID/h2dTOFNSigmaOmLaPi", "h2dTOFNSigmaOmLaPi", kTH2F, {AxisConfig.axisPt, AxisConfig.axisTOFNSigma}); + histos.add("Casc/PID/h2dTOFNSigmaOmLaPr", "h2dTOFNSigmaOmLaPr", kTH2F, {AxisConfig.axisPt, AxisConfig.axisTOFNSigma}); + histos.add("Casc/PID/h2dTOFNSigmaOmKa", "h2dTOFNSigmaOmKa", kTH2F, {AxisConfig.axisPt, AxisConfig.axisTOFNSigma}); + + histos.add("Casc/hMassXiMinus", "hMassXiMinus", kTH1F, {AxisConfig.axisXiMass}); + histos.add("Casc/hMassOmegaMinus", "hMassOmegaMinus", kTH1F, {AxisConfig.axisOmegaMass}); + histos.add("Casc/hMassXiPlus", "hMassXiPlus", kTH1F, {AxisConfig.axisXiMass}); + histos.add("Casc/hMassOmegaPlus", "hMassOmegaPlus", kTH1F, {AxisConfig.axisOmegaMass}); + + histos.add("Casc/h3dPAVsPtVsMassXiMinus", "h3dPAVsPtVsMassXiMinus", kTH3D, {AxisConfig.axisPA, AxisConfig.axisPt, AxisConfig.axisXiMass}); + histos.add("Casc/h3dPAVsPtVsMassOmegaMinus", "h3dPAVsPtVsMassOmegaMinus", kTH3D, {AxisConfig.axisPA, AxisConfig.axisPt, AxisConfig.axisOmegaMass}); + histos.add("Casc/h3dPAVsPtVsMassXiPlus", "h3dPAVsPtVsMassXiPlus", kTH3D, {AxisConfig.axisPA, AxisConfig.axisPt, AxisConfig.axisXiMass}); + histos.add("Casc/h3dPAVsPtVsMassOmegaPlus", "h3dPAVsPtVsMassOmegaPlus", kTH3D, {AxisConfig.axisPA, AxisConfig.axisPt, AxisConfig.axisOmegaMass}); + + histos.add("Casc/Track/h2dBachITSNCls", "h2dBachITSNCls", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisNCls}); + histos.add("Casc/Track/h2dBachITSChi2PerNcl", "h2dBachITSChi2PerNcl", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisChi2PerNcl}); + histos.add("Casc/Track/h2dBachTPCCrossedRows", "h2dBachTPCCrossedRows", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisTPCrows}); + histos.add("Casc/PID/h2dBachTPCSignal", "h2dBachTPCSignal", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisTPCSignal}); + } + + if (doprocessMCDerivedCascades) { + histos.add("MCCasc/hcascMCCore", "hcascMCCore", kTH1F, {AxisConfig.axisBool}); + histos.add("MCCasc/h2dPDGV0VsMother", "h2dPDGV0VsMother", kTHnSparseD, {AxisConfig.axisPDGCode, AxisConfig.axisPDGCode}); + histos.add("MCCasc/h2dPDGV0VsPositive", "h2dPDGV0VsPositive", kTHnSparseD, {AxisConfig.axisPDGCode, AxisConfig.axisPDGCode}); + histos.add("MCCasc/h2dPDGV0VsNegative", "h2dPDGV0VsNegative", kTHnSparseD, {AxisConfig.axisPDGCode, AxisConfig.axisPDGCode}); + histos.add("MCCasc/h2dPDGV0VsBach", "h2dPDGV0VsBach", kTHnSparseD, {AxisConfig.axisPDGCode, AxisConfig.axisPDGCode}); + histos.add("MCCasc/h2dPDGV0VsIsPhysicalPrimary", "h2dPDGV0VsIsPhysicalPrimary", kTH2F, {AxisConfig.axisPDGCode, AxisConfig.axisBool}); + + histos.add("MCCasc/XiMinus/h2dpTResolution", "h2dpTResolution", kTH2F, {AxisConfig.axisPt, AxisConfig.axisPtResolution}); + histos.add("MCCasc/XiMinus/h3dPAVsPtVsMass", "h3dPAVsPtVsMass", kTH3D, {AxisConfig.axisPA, AxisConfig.axisPt, AxisConfig.axisXiMass}); + histos.add("MCCasc/XiMinus/h2dV0TPCSignal", "h2dV0TPCSignal", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisTPCSignal}); + histos.add("MCCasc/XiMinus/h2dBachTPCSignal", "h2dBachTPCSignal", kTH2F, {AxisConfig.axisPt, AxisConfig.axisTPCSignal}); + histos.add("MCCasc/XiMinus/hV0Radius", "hV0Radius", kTH1F, {AxisConfig.axisV0Radius}); + histos.add("MCCasc/XiMinus/hCascRadius", "hCascRadius", kTH1F, {AxisConfig.axisCascRadius}); + histos.add("MCCasc/XiMinus/hV0CosPA", "hV0CosPA", kTH1F, {AxisConfig.axisCosPA}); + histos.add("MCCasc/XiMinus/hCascCosPA", "hCascCosPA", kTH1F, {AxisConfig.axisCosPA}); + histos.add("MCCasc/XiMinus/hDCAPosToPV", "hDCAPosToPV", kTH1F, {AxisConfig.axisDCAToPV}); + histos.add("MCCasc/XiMinus/hDCANegToPV", "hDCANegToPV", kTH1F, {AxisConfig.axisDCAToPV}); + histos.add("MCCasc/XiMinus/hDCABachToPV", "hDCABachToPV", kTH1F, {AxisConfig.axisDCAToPV}); + histos.add("MCCasc/XiMinus/hDCAXYCascToPV", "hDCAXYCascToPV", kTH1F, {AxisConfig.axisDCAXYCascToPV}); + histos.add("MCCasc/XiMinus/hDCAZCascToPV", "hDCAZCascToPV", kTH1F, {AxisConfig.axisDCAZCascToPV}); + histos.add("MCCasc/XiMinus/hDCAV0ToPV", "hDCAV0ToPV", kTH1F, {AxisConfig.axisDCAV0ToPV}); + histos.add("MCCasc/XiMinus/hDCAV0Dau", "hDCAV0Dau", kTH1F, {AxisConfig.axisDCAV0Dau}); + histos.add("MCCasc/XiMinus/hDCACascDau", "hDCACascDau", kTH1F, {AxisConfig.axisDCACascDau}); + histos.add("MCCasc/XiMinus/hLambdaMass", "hLambdaMass", kTH1F, {AxisConfig.axisMassLambda}); + + histos.add("MCCasc/XiPlus/h2dpTResolution", "h2dpTResolution", kTH2F, {AxisConfig.axisPt, AxisConfig.axisPtResolution}); + histos.add("MCCasc/XiPlus/h3dPAVsPtVsMass", "h3dPAVsPtVsMass", kTH3D, {AxisConfig.axisPA, AxisConfig.axisPt, AxisConfig.axisXiMass}); + histos.add("MCCasc/XiPlus/h2dV0TPCSignal", "h2dV0TPCSignal", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisTPCSignal}); + histos.add("MCCasc/XiPlus/h2dBachTPCSignal", "h2dBachTPCSignal", kTH2F, {AxisConfig.axisPt, AxisConfig.axisTPCSignal}); + histos.add("MCCasc/XiPlus/hV0Radius", "hV0Radius", kTH1F, {AxisConfig.axisV0Radius}); + histos.add("MCCasc/XiPlus/hCascRadius", "hCascRadius", kTH1F, {AxisConfig.axisCascRadius}); + histos.add("MCCasc/XiPlus/hV0CosPA", "hV0CosPA", kTH1F, {AxisConfig.axisCosPA}); + histos.add("MCCasc/XiPlus/hCascCosPA", "hCascCosPA", kTH1F, {AxisConfig.axisCosPA}); + histos.add("MCCasc/XiPlus/hDCAPosToPV", "hDCAPosToPV", kTH1F, {AxisConfig.axisDCAToPV}); + histos.add("MCCasc/XiPlus/hDCANegToPV", "hDCANegToPV", kTH1F, {AxisConfig.axisDCAToPV}); + histos.add("MCCasc/XiPlus/hDCABachToPV", "hDCABachToPV", kTH1F, {AxisConfig.axisDCAToPV}); + histos.add("MCCasc/XiPlus/hDCAXYCascToPV", "hDCAXYCascToPV", kTH1F, {AxisConfig.axisDCAXYCascToPV}); + histos.add("MCCasc/XiPlus/hDCAZCascToPV", "hDCAZCascToPV", kTH1F, {AxisConfig.axisDCAZCascToPV}); + histos.add("MCCasc/XiPlus/hDCAV0ToPV", "hDCAV0ToPV", kTH1F, {AxisConfig.axisDCAV0ToPV}); + histos.add("MCCasc/XiPlus/hDCAV0Dau", "hDCAV0Dau", kTH1F, {AxisConfig.axisDCAV0Dau}); + histos.add("MCCasc/XiPlus/hDCACascDau", "hDCACascDau", kTH1F, {AxisConfig.axisDCACascDau}); + histos.add("MCCasc/XiPlus/hLambdaMass", "hLambdaMass", kTH1F, {AxisConfig.axisMassLambda}); + + histos.add("MCCasc/OmegaMinus/h2dpTResolution", "h2dpTResolution", kTH2F, {AxisConfig.axisPt, AxisConfig.axisPtResolution}); + histos.add("MCCasc/OmegaMinus/h3dPAVsPtVsMass", "h3dPAVsPtVsMass", kTH3D, {AxisConfig.axisPA, AxisConfig.axisPt, AxisConfig.axisXiMass}); + histos.add("MCCasc/OmegaMinus/h2dV0TPCSignal", "h2dV0TPCSignal", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisTPCSignal}); + histos.add("MCCasc/OmegaMinus/h2dBachTPCSignal", "h2dBachTPCSignal", kTH2F, {AxisConfig.axisPt, AxisConfig.axisTPCSignal}); + histos.add("MCCasc/OmegaMinus/hV0Radius", "hV0Radius", kTH1F, {AxisConfig.axisV0Radius}); + histos.add("MCCasc/OmegaMinus/hCascRadius", "hCascRadius", kTH1F, {AxisConfig.axisCascRadius}); + histos.add("MCCasc/OmegaMinus/hV0CosPA", "hV0CosPA", kTH1F, {AxisConfig.axisCosPA}); + histos.add("MCCasc/OmegaMinus/hCascCosPA", "hCascCosPA", kTH1F, {AxisConfig.axisCosPA}); + histos.add("MCCasc/OmegaMinus/hDCAPosToPV", "hDCAPosToPV", kTH1F, {AxisConfig.axisDCAToPV}); + histos.add("MCCasc/OmegaMinus/hDCANegToPV", "hDCANegToPV", kTH1F, {AxisConfig.axisDCAToPV}); + histos.add("MCCasc/OmegaMinus/hDCABachToPV", "hDCABachToPV", kTH1F, {AxisConfig.axisDCAToPV}); + histos.add("MCCasc/OmegaMinus/hDCAXYCascToPV", "hDCAXYCascToPV", kTH1F, {AxisConfig.axisDCAXYCascToPV}); + histos.add("MCCasc/OmegaMinus/hDCAZCascToPV", "hDCAZCascToPV", kTH1F, {AxisConfig.axisDCAZCascToPV}); + histos.add("MCCasc/OmegaMinus/hDCAV0ToPV", "hDCAV0ToPV", kTH1F, {AxisConfig.axisDCAV0ToPV}); + histos.add("MCCasc/OmegaMinus/hDCAV0Dau", "hDCAV0Dau", kTH1F, {AxisConfig.axisDCAV0Dau}); + histos.add("MCCasc/OmegaMinus/hDCACascDau", "hDCACascDau", kTH1F, {AxisConfig.axisDCACascDau}); + histos.add("MCCasc/OmegaMinus/hLambdaMass", "hLambdaMass", kTH1F, {AxisConfig.axisMassLambda}); + + histos.add("MCCasc/OmegaPlus/h2dpTResolution", "h2dpTResolution", kTH2F, {AxisConfig.axisPt, AxisConfig.axisPtResolution}); + histos.add("MCCasc/OmegaPlus/h3dPAVsPtVsMass", "h3dPAVsPtVsMass", kTH3D, {AxisConfig.axisPA, AxisConfig.axisPt, AxisConfig.axisXiMass}); + histos.add("MCCasc/OmegaPlus/h2dV0TPCSignal", "h2dV0TPCSignal", kTH2F, {AxisConfig.axisPt2, AxisConfig.axisTPCSignal}); + histos.add("MCCasc/OmegaPlus/h2dBachTPCSignal", "h2dBachTPCSignal", kTH2F, {AxisConfig.axisPt, AxisConfig.axisTPCSignal}); + histos.add("MCCasc/OmegaPlus/hV0Radius", "hV0Radius", kTH1F, {AxisConfig.axisV0Radius}); + histos.add("MCCasc/OmegaPlus/hCascRadius", "hCascRadius", kTH1F, {AxisConfig.axisCascRadius}); + histos.add("MCCasc/OmegaPlus/hV0CosPA", "hV0CosPA", kTH1F, {AxisConfig.axisCosPA}); + histos.add("MCCasc/OmegaPlus/hCascCosPA", "hCascCosPA", kTH1F, {AxisConfig.axisCosPA}); + histos.add("MCCasc/OmegaPlus/hDCAPosToPV", "hDCAPosToPV", kTH1F, {AxisConfig.axisDCAToPV}); + histos.add("MCCasc/OmegaPlus/hDCANegToPV", "hDCANegToPV", kTH1F, {AxisConfig.axisDCAToPV}); + histos.add("MCCasc/OmegaPlus/hDCABachToPV", "hDCABachToPV", kTH1F, {AxisConfig.axisDCAToPV}); + histos.add("MCCasc/OmegaPlus/hDCAXYCascToPV", "hDCAXYCascToPV", kTH1F, {AxisConfig.axisDCAXYCascToPV}); + histos.add("MCCasc/OmegaPlus/hDCAZCascToPV", "hDCAZCascToPV", kTH1F, {AxisConfig.axisDCAZCascToPV}); + histos.add("MCCasc/OmegaPlus/hDCAV0ToPV", "hDCAV0ToPV", kTH1F, {AxisConfig.axisDCAV0ToPV}); + histos.add("MCCasc/OmegaPlus/hDCAV0Dau", "hDCAV0Dau", kTH1F, {AxisConfig.axisDCAV0Dau}); + histos.add("MCCasc/OmegaPlus/hDCACascDau", "hDCACascDau", kTH1F, {AxisConfig.axisDCACascDau}); + histos.add("MCCasc/OmegaPlus/hLambdaMass", "hLambdaMass", kTH1F, {AxisConfig.axisMassLambda}); + } // MC Generated level - histos.add("GenMC/hGenEvents", "hGenEvents", kTH2F, {{axisNch}, {2, -0.5f, +1.5f}}); - histos.get(HIST("GenMC/hGenEvents"))->GetYaxis()->SetBinLabel(1, "All gen. events"); - histos.get(HIST("GenMC/hGenEvents"))->GetYaxis()->SetBinLabel(2, "Gen. with at least 1 rec. events"); - histos.add("GenMC/hGenEventCentrality", "hGenEventCentrality", kTH1F, {{101, 0.0f, 101.0f}}); - histos.add("GenMC/hCentralityVsNcoll_beforeEvSel", "hCentralityVsNcoll_beforeEvSel", kTH2F, {axisCentrality, {50, -0.5f, 49.5f}}); - histos.add("GenMC/hCentralityVsNcoll_afterEvSel", "hCentralityVsNcoll_afterEvSel", kTH2F, {axisCentrality, {50, -0.5f, 49.5f}}); - histos.add("GenMC/hCentralityVsMultMC", "hCentralityVsMultMC", kTH2F, {{101, 0.0f, 101.0f}, axisNch}); - histos.add("GenMC/h2dGenGamma", "h2dGenGamma", kTH2D, {axisCentrality, axisPt}); - histos.add("GenMC/h2dGenK0Short", "h2dGenK0Short", kTH2D, {axisCentrality, axisPt}); - histos.add("GenMC/h2dGenLambda", "h2dGenLambda", kTH2D, {axisCentrality, axisPt}); - histos.add("GenMC/h2dGenAntiLambda", "h2dGenAntiLambda", kTH2D, {axisCentrality, axisPt}); - histos.add("GenMC/h2dGenXiMinus", "h2dGenXiMinus", kTH2D, {axisCentrality, axisPt}); - histos.add("GenMC/h2dGenXiPlus", "h2dGenXiPlus", kTH2D, {axisCentrality, axisPt}); - histos.add("GenMC/h2dGenOmegaMinus", "h2dGenOmegaMinus", kTH2D, {axisCentrality, axisPt}); - histos.add("GenMC/h2dGenOmegaPlus", "h2dGenOmegaPlus", kTH2D, {axisCentrality, axisPt}); - histos.add("GenMC/h2dGenK0ShortVsMultMC_RecoedEvt", "h2dGenK0ShortVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); - histos.add("GenMC/h2dGenLambdaVsMultMC_RecoedEvt", "h2dGenLambdaVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); - histos.add("GenMC/h2dGenAntiLambdaVsMultMC_RecoedEvt", "h2dGenAntiLambdaVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); - histos.add("GenMC/h2dGenXiMinusVsMultMC_RecoedEvt", "h2dGenXiMinusVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); - histos.add("GenMC/h2dGenXiPlusVsMultMC_RecoedEvt", "h2dGenXiPlusVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); - histos.add("GenMC/h2dGenOmegaMinusVsMultMC_RecoedEvt", "h2dGenOmegaMinusVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); - histos.add("GenMC/h2dGenOmegaPlusVsMultMC_RecoedEvt", "h2dGenOmegaPlusVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt}); - histos.add("GenMC/h2dGenGammaVsMultMC", "h2dGenGammaVsMultMC", kTH2D, {axisNch, axisPt}); - histos.add("GenMC/h2dGenK0ShortVsMultMC", "h2dGenK0ShortVsMultMC", kTH2D, {axisNch, axisPt}); - histos.add("GenMC/h2dGenLambdaVsMultMC", "h2dGenLambdaVsMultMC", kTH2D, {axisNch, axisPt}); - histos.add("GenMC/h2dGenAntiLambdaVsMultMC", "h2dGenAntiLambdaVsMultMC", kTH2D, {axisNch, axisPt}); - histos.add("GenMC/h2dGenXiMinusVsMultMC", "h2dGenXiMinusVsMultMC", kTH2D, {axisNch, axisPt}); - histos.add("GenMC/h2dGenXiPlusVsMultMC", "h2dGenXiPlusVsMultMC", kTH2D, {axisNch, axisPt}); - histos.add("GenMC/h2dGenOmegaMinusVsMultMC", "h2dGenOmegaMinusVsMultMC", kTH2D, {axisNch, axisPt}); - histos.add("GenMC/h2dGenOmegaPlusVsMultMC", "h2dGenOmegaPlusVsMultMC", kTH2D, {axisNch, axisPt}); + if (doprocessGenerated) { + histos.add("GenMC/hGenEvents", "hGenEvents", kTH2F, {{AxisConfig.axisNch}, {2, -0.5f, +1.5f}}); + histos.get(HIST("GenMC/hGenEvents"))->GetYaxis()->SetBinLabel(1, "All gen. events"); + histos.get(HIST("GenMC/hGenEvents"))->GetYaxis()->SetBinLabel(2, "Gen. with at least 1 rec. events"); + histos.add("GenMC/hGenEventCentrality", "hGenEventCentrality", kTH1F, {{101, 0.0f, 101.0f}}); + histos.add("GenMC/hCentralityVsNcoll_beforeEvSel", "hCentralityVsNcoll_beforeEvSel", kTH2F, {AxisConfig.axisCentrality, {50, -0.5f, 49.5f}}); + histos.add("GenMC/hCentralityVsNcoll_afterEvSel", "hCentralityVsNcoll_afterEvSel", kTH2F, {AxisConfig.axisCentrality, {50, -0.5f, 49.5f}}); + histos.add("GenMC/hCentralityVsMultMC", "hCentralityVsMultMC", kTH2F, {{101, 0.0f, 101.0f}, AxisConfig.axisNch}); + histos.add("GenMC/h2dGenGamma", "h2dGenGamma", kTH2D, {AxisConfig.axisCentrality, AxisConfig.axisPt}); + histos.add("GenMC/h2dGenK0Short", "h2dGenK0Short", kTH2D, {AxisConfig.axisCentrality, AxisConfig.axisPt}); + histos.add("GenMC/h2dGenLambda", "h2dGenLambda", kTH2D, {AxisConfig.axisCentrality, AxisConfig.axisPt}); + histos.add("GenMC/h2dGenAntiLambda", "h2dGenAntiLambda", kTH2D, {AxisConfig.axisCentrality, AxisConfig.axisPt}); + histos.add("GenMC/h2dGenXiMinus", "h2dGenXiMinus", kTH2D, {AxisConfig.axisCentrality, AxisConfig.axisPt}); + histos.add("GenMC/h2dGenXiPlus", "h2dGenXiPlus", kTH2D, {AxisConfig.axisCentrality, AxisConfig.axisPt}); + histos.add("GenMC/h2dGenOmegaMinus", "h2dGenOmegaMinus", kTH2D, {AxisConfig.axisCentrality, AxisConfig.axisPt}); + histos.add("GenMC/h2dGenOmegaPlus", "h2dGenOmegaPlus", kTH2D, {AxisConfig.axisCentrality, AxisConfig.axisPt}); + histos.add("GenMC/h2dGenK0ShortVsMultMC_RecoedEvt", "h2dGenK0ShortVsMultMC_RecoedEvt", kTH2D, {AxisConfig.axisNch, AxisConfig.axisPt}); + histos.add("GenMC/h2dGenLambdaVsMultMC_RecoedEvt", "h2dGenLambdaVsMultMC_RecoedEvt", kTH2D, {AxisConfig.axisNch, AxisConfig.axisPt}); + histos.add("GenMC/h2dGenAntiLambdaVsMultMC_RecoedEvt", "h2dGenAntiLambdaVsMultMC_RecoedEvt", kTH2D, {AxisConfig.axisNch, AxisConfig.axisPt}); + histos.add("GenMC/h2dGenXiMinusVsMultMC_RecoedEvt", "h2dGenXiMinusVsMultMC_RecoedEvt", kTH2D, {AxisConfig.axisNch, AxisConfig.axisPt}); + histos.add("GenMC/h2dGenXiPlusVsMultMC_RecoedEvt", "h2dGenXiPlusVsMultMC_RecoedEvt", kTH2D, {AxisConfig.axisNch, AxisConfig.axisPt}); + histos.add("GenMC/h2dGenOmegaMinusVsMultMC_RecoedEvt", "h2dGenOmegaMinusVsMultMC_RecoedEvt", kTH2D, {AxisConfig.axisNch, AxisConfig.axisPt}); + histos.add("GenMC/h2dGenOmegaPlusVsMultMC_RecoedEvt", "h2dGenOmegaPlusVsMultMC_RecoedEvt", kTH2D, {AxisConfig.axisNch, AxisConfig.axisPt}); + histos.add("GenMC/h2dGenGammaVsMultMC", "h2dGenGammaVsMultMC", kTH2D, {AxisConfig.axisNch, AxisConfig.axisPt}); + histos.add("GenMC/h2dGenK0ShortVsMultMC", "h2dGenK0ShortVsMultMC", kTH2D, {AxisConfig.axisNch, AxisConfig.axisPt}); + histos.add("GenMC/h2dGenLambdaVsMultMC", "h2dGenLambdaVsMultMC", kTH2D, {AxisConfig.axisNch, AxisConfig.axisPt}); + histos.add("GenMC/h2dGenAntiLambdaVsMultMC", "h2dGenAntiLambdaVsMultMC", kTH2D, {AxisConfig.axisNch, AxisConfig.axisPt}); + histos.add("GenMC/h2dGenXiMinusVsMultMC", "h2dGenXiMinusVsMultMC", kTH2D, {AxisConfig.axisNch, AxisConfig.axisPt}); + histos.add("GenMC/h2dGenXiPlusVsMultMC", "h2dGenXiPlusVsMultMC", kTH2D, {AxisConfig.axisNch, AxisConfig.axisPt}); + histos.add("GenMC/h2dGenOmegaMinusVsMultMC", "h2dGenOmegaMinusVsMultMC", kTH2D, {AxisConfig.axisNch, AxisConfig.axisPt}); + histos.add("GenMC/h2dGenOmegaPlusVsMultMC", "h2dGenOmegaPlusVsMultMC", kTH2D, {AxisConfig.axisNch, AxisConfig.axisPt}); + } } template @@ -711,7 +722,14 @@ struct strderivedGenQA { histos.fill(HIST("V0/hYK0Short"), V0Y_K0Short); histos.fill(HIST("V0/hMassGamma"), v0.mGamma()); histos.fill(HIST("V0/hMassLambda"), v0.mLambda()); + histos.fill(HIST("V0/hMassALambda"), v0.mAntiLambda()); histos.fill(HIST("V0/hMassK0Short"), v0.mK0Short()); + + histos.fill(HIST("V0/h3dPAVsPtVsGammaMass"), TMath::ACos(v0.v0cosPA()), pT, v0.mGamma()); + histos.fill(HIST("V0/h3dPAVsPtVsLambdaMass"), TMath::ACos(v0.v0cosPA()), pT, v0.mLambda()); + histos.fill(HIST("V0/h3dPAVsPtVsALambdaMass"), TMath::ACos(v0.v0cosPA()), pT, v0.mAntiLambda()); + histos.fill(HIST("V0/h3dPAVsPtVsK0SMassMass"), TMath::ACos(v0.v0cosPA()), pT, v0.mK0Short()); + histos.fill(HIST("V0/hV0Type"), v0.v0Type()); histos.fill(HIST("V0/h2dV0Indices"), v0.straCollisionId(), coll.globalIndex()); // cross-check index correctness @@ -796,6 +814,7 @@ struct strderivedGenQA { histos.fill(HIST("MCV0/h2dArmenterosP"), v0.alpha(), v0.qtarm()); histos.fill(HIST("MCV0/Gamma/h2dpTResolution"), v0.pt(), v0.pt() - v0MC.ptMC()); histos.fill(HIST("MCV0/Gamma/h2dMass"), v0.pt(), v0.mGamma()); + histos.fill(HIST("MCV0/Gamma/h3dPAVsPtVsMass"), TMath::ACos(v0.v0cosPA()), v0.pt(), v0.mGamma()); histos.fill(HIST("MCV0/Gamma/h2dTPCNSigmaEl"), v0.positivept(), posTrack.tpcNSigmaEl()); histos.fill(HIST("MCV0/Gamma/h2dTPCNSigmaEl"), -1 * v0.negativept(), negTrack.tpcNSigmaEl()); histos.fill(HIST("MCV0/Gamma/h2dTPCSignal"), v0.positivept(), posTrack.tpcSignal()); @@ -811,6 +830,7 @@ struct strderivedGenQA { histos.fill(HIST("MCV0/h2dArmenterosP"), v0.alpha(), v0.qtarm()); histos.fill(HIST("MCV0/Lambda/h2dpTResolution"), v0.pt(), v0.pt() - v0MC.ptMC()); histos.fill(HIST("MCV0/Lambda/h2dMass"), v0.pt(), v0.mLambda()); + histos.fill(HIST("MCV0/Lambda/h3dPAVsPtVsMass"), TMath::ACos(v0.v0cosPA()), v0.pt(), v0.mLambda()); histos.fill(HIST("MCV0/Lambda/h2dTPCNSigmaPr"), v0.positivept(), posTrack.tpcNSigmaPr()); histos.fill(HIST("MCV0/Lambda/h2dTPCNSigmaPi"), v0.negativept(), negTrack.tpcNSigmaPi()); histos.fill(HIST("MCV0/Lambda/h2dTPCSignal"), v0.positivept(), posTrack.tpcSignal()); @@ -825,6 +845,7 @@ struct strderivedGenQA { histos.fill(HIST("MCV0/h2dArmenterosP"), v0.alpha(), v0.qtarm()); histos.fill(HIST("MCV0/AntiLambda/h2dpTResolution"), v0.pt(), v0.pt() - v0MC.ptMC()); histos.fill(HIST("MCV0/AntiLambda/h2dMass"), v0.pt(), v0.mAntiLambda()); + histos.fill(HIST("MCV0/AntiLambda/h3dPAVsPtVsMass"), TMath::ACos(v0.v0cosPA()), v0.pt(), v0.mAntiLambda()); histos.fill(HIST("MCV0/AntiLambda/h2dTPCNSigmaPr"), v0.negativept(), negTrack.tpcNSigmaPr()); histos.fill(HIST("MCV0/AntiLambda/h2dTPCNSigmaPi"), v0.positivept(), posTrack.tpcNSigmaPi()); histos.fill(HIST("MCV0/AntiLambda/h2dTPCSignal"), v0.positivept(), posTrack.tpcSignal()); @@ -839,6 +860,7 @@ struct strderivedGenQA { histos.fill(HIST("MCV0/h2dArmenterosP"), v0.alpha(), v0.qtarm()); histos.fill(HIST("MCV0/K0Short/h2dpTResolution"), v0.pt(), v0.pt() - v0MC.ptMC()); histos.fill(HIST("MCV0/K0Short/h2dMass"), v0.pt(), v0.mK0Short()); + histos.fill(HIST("MCV0/K0Short/h3dPAVsPtVsMass"), TMath::ACos(v0.v0cosPA()), v0.pt(), v0.mK0Short()); histos.fill(HIST("MCV0/K0Short/h2dTPCNSigmaPi"), v0.positivept(), posTrack.tpcNSigmaPi()); histos.fill(HIST("MCV0/K0Short/h2dTPCNSigmaPi"), -1 * v0.negativept(), negTrack.tpcNSigmaPi()); histos.fill(HIST("MCV0/K0Short/h2dTPCSignal"), v0.positivept(), posTrack.tpcSignal()); @@ -927,6 +949,9 @@ struct strderivedGenQA { if (casc.sign() < 0) { histos.fill(HIST("Casc/hMassXiMinus"), casc.mXi()); histos.fill(HIST("Casc/hMassOmegaMinus"), casc.mOmega()); + histos.fill(HIST("Casc/h3dPAVsPtVsMassXiMinus"), TMath::ACos(casc.v0cosPA(casc.x(), casc.y(), casc.z())), pT, casc.mXi()); + histos.fill(HIST("Casc/h3dPAVsPtVsMassOmegaMinus"), TMath::ACos(casc.v0cosPA(casc.x(), casc.y(), casc.z())), pT, casc.mOmega()); + histos.fill(HIST("Casc/Track/h2dBachITSNCls"), -1 * casc.bachelorpt(), bachTrack.itsNCls()); histos.fill(HIST("Casc/Track/h2dBachITSChi2PerNcl"), -1 * casc.bachelorpt(), bachTrack.itsChi2PerNcl()); histos.fill(HIST("Casc/Track/h2dBachTPCCrossedRows"), -1 * casc.bachelorpt(), bachTrack.tpcCrossedRows()); @@ -934,6 +959,9 @@ struct strderivedGenQA { } else { histos.fill(HIST("Casc/hMassXiPlus"), casc.mXi()); histos.fill(HIST("Casc/hMassOmegaPlus"), casc.mOmega()); + histos.fill(HIST("Casc/h3dPAVsPtVsMassXiPlus"), TMath::ACos(casc.v0cosPA(casc.x(), casc.y(), casc.z())), pT, casc.mXi()); + histos.fill(HIST("Casc/h3dPAVsPtVsMassOmegaPlus"), TMath::ACos(casc.v0cosPA(casc.x(), casc.y(), casc.z())), pT, casc.mOmega()); + histos.fill(HIST("Casc/Track/h2dBachITSNCls"), casc.bachelorpt(), bachTrack.itsNCls()); histos.fill(HIST("Casc/Track/h2dBachITSChi2PerNcl"), casc.bachelorpt(), bachTrack.itsChi2PerNcl()); histos.fill(HIST("Casc/Track/h2dBachTPCCrossedRows"), casc.bachelorpt(), bachTrack.tpcCrossedRows()); @@ -950,6 +978,7 @@ struct strderivedGenQA { histos.fill(HIST("MCCasc/hcascMCCore"), casc.has_cascMCCore()); if (!casc.has_cascMCCore()) continue; + auto cascMC = casc.cascMCCore_as>(); // General @@ -967,7 +996,7 @@ struct strderivedGenQA { // Specific analysis by species: if (cascMC.pdgCode() == 3312) { // XiMinus histos.fill(HIST("MCCasc/XiMinus/h2dpTResolution"), pT, pT - cascMC.ptMC()); - histos.fill(HIST("MCCasc/XiMinus/h2dMass"), pT, casc.mXi()); + histos.fill(HIST("MCCasc/XiMinus/h3dPAVsPtVsMass"), TMath::ACos(casc.v0cosPA(casc.x(), casc.y(), casc.z())), pT, casc.mXi()); histos.fill(HIST("MCCasc/XiMinus/h2dV0TPCSignal"), casc.positivept(), posTrack.tpcSignal()); histos.fill(HIST("MCCasc/XiMinus/h2dV0TPCSignal"), -1 * casc.negativept(), negTrack.tpcSignal()); histos.fill(HIST("MCCasc/XiMinus/h2dBachTPCSignal"), casc.bachelorpt(), bachTrack.tpcSignal()); @@ -987,7 +1016,7 @@ struct strderivedGenQA { } if (cascMC.pdgCode() == -3312) { // XiPlus histos.fill(HIST("MCCasc/XiPlus/h2dpTResolution"), pT, pT - cascMC.ptMC()); - histos.fill(HIST("MCCasc/XiPlus/h2dMass"), pT, casc.mXi()); + histos.fill(HIST("MCCasc/XiPlus/h3dPAVsPtVsMass"), TMath::ACos(casc.v0cosPA(casc.x(), casc.y(), casc.z())), pT, casc.mXi()); histos.fill(HIST("MCCasc/XiPlus/h2dV0TPCSignal"), casc.positivept(), posTrack.tpcSignal()); histos.fill(HIST("MCCasc/XiPlus/h2dV0TPCSignal"), -1 * casc.negativept(), negTrack.tpcSignal()); histos.fill(HIST("MCCasc/XiPlus/h2dBachTPCSignal"), casc.bachelorpt(), bachTrack.tpcSignal()); @@ -1007,7 +1036,7 @@ struct strderivedGenQA { } if (cascMC.pdgCode() == 3334) { // OmegaMinus histos.fill(HIST("MCCasc/OmegaMinus/h2dpTResolution"), pT, pT - cascMC.ptMC()); - histos.fill(HIST("MCCasc/OmegaMinus/h2dMass"), pT, casc.mOmega()); + histos.fill(HIST("MCCasc/OmegaMinus/h3dPAVsPtVsMass"), TMath::ACos(casc.v0cosPA(casc.x(), casc.y(), casc.z())), pT, casc.mOmega()); histos.fill(HIST("MCCasc/OmegaMinus/h2dV0TPCSignal"), casc.positivept(), posTrack.tpcSignal()); histos.fill(HIST("MCCasc/OmegaMinus/h2dV0TPCSignal"), -1 * casc.negativept(), negTrack.tpcSignal()); histos.fill(HIST("MCCasc/OmegaMinus/h2dBachTPCSignal"), casc.bachelorpt(), bachTrack.tpcSignal()); @@ -1027,7 +1056,7 @@ struct strderivedGenQA { } if (cascMC.pdgCode() == -3334) { // OmegaPlus histos.fill(HIST("MCCasc/OmegaPlus/h2dpTResolution"), pT, pT - cascMC.ptMC()); - histos.fill(HIST("MCCasc/OmegaPlus/h2dMass"), pT, casc.mOmega()); + histos.fill(HIST("MCCasc/OmegaPlus/h3dPAVsPtVsMass"), TMath::ACos(casc.v0cosPA(casc.x(), casc.y(), casc.z())), pT, casc.mOmega()); histos.fill(HIST("MCCasc/OmegaPlus/h2dV0TPCSignal"), casc.positivept(), posTrack.tpcSignal()); histos.fill(HIST("MCCasc/OmegaPlus/h2dV0TPCSignal"), -1 * casc.negativept(), negTrack.tpcSignal()); histos.fill(HIST("MCCasc/OmegaPlus/h2dBachTPCSignal"), casc.bachelorpt(), bachTrack.tpcSignal()); From 7d969d20e32719e02927012d846afb0131d410cf Mon Sep 17 00:00:00 2001 From: AlexianL <123153896+AlexianL@users.noreply.github.com> Date: Mon, 22 Sep 2025 11:36:16 +0200 Subject: [PATCH 489/986] [PWGHF] taskFlow.cxx: improve central track selection, add FT0a correlation cases (#13064) --- PWGHF/HFC/Tasks/taskFlow.cxx | 1681 +++++++++++++++++----------------- 1 file changed, 828 insertions(+), 853 deletions(-) diff --git a/PWGHF/HFC/Tasks/taskFlow.cxx b/PWGHF/HFC/Tasks/taskFlow.cxx index 3184b62e7c6..7512ff1281f 100644 --- a/PWGHF/HFC/Tasks/taskFlow.cxx +++ b/PWGHF/HFC/Tasks/taskFlow.cxx @@ -27,6 +27,7 @@ #include "Common/Core/trackUtilities.h" #include "Common/DataModel/CollisionAssociationTables.h" #include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/FT0Corrected.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/TrackSelectionTables.h" @@ -35,6 +36,7 @@ #include "CommonConstants/MathConstants.h" #include "DataFormatsParameters/GRPObject.h" #include "DetectorsCommonDataFormats/AlignParam.h" +#include "FT0Base/Geometry.h" #include "FV0Base/Geometry.h" #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" @@ -61,6 +63,7 @@ using namespace o2; using namespace o2::analysis; using namespace o2::aod::pid_tpc_tof_utils; +using namespace o2::aod::track; using namespace o2::constants::math; using namespace o2::framework; using namespace o2::framework::expressions; @@ -80,6 +83,13 @@ enum MftTrackAmbiguityStep { NMftAmbiguitySteps }; +enum MultiplicityEstimators { + MultNTracksPV = 0, + MultNumContrib, + MultFT0C, + MultFT0M +}; + enum ReassociationMftTracks { NotReassociatedMftTracks = 0, ReassociatedMftTracks, @@ -107,6 +117,8 @@ enum CorrelationCase { TpcMft, TpcFv0a, MftFv0a, + TpcFt0a, + MftFt0a }; enum CorrelatedParticles { @@ -115,57 +127,97 @@ enum CorrelatedParticles { LcChPart }; -static constexpr std::string_view WhatDataType[] = {"Data/", "MC/"}; // static constexpr std::string_view whatEventType[] = {"SameEvent/", "MixedEvent/"}; -static constexpr std::string_view WhatCorrelationCase[] = {"TpcTpc/", "TpcMft/", "TpcFv0a/", "MftFv0a/"}; +static constexpr std::string_view WhatDataType[] = {"Data/", "MC/"}; +static constexpr std::string_view WhatCorrelationCase[] = {"TpcTpc/", "TpcMft/", "TpcFv0a/", "MftFv0a/", "TpcFt0a/", "MftFt0a/"}; static constexpr std::string_view WhatParticles[] = {"ChPartChPart/", "D0ChPart/", "LcChPart/"}; +static constexpr std::string_view WhatMultiplicityEstimator[] = {"multNTracksPV", "multNumContrib", "multFT0C", "multFT0M"}; + +static constexpr TrackSelectionFlags::flagtype TrackSelectionIts = + TrackSelectionFlags::kITSNCls | TrackSelectionFlags::kITSChi2NDF | + TrackSelectionFlags::kITSHits; +static constexpr TrackSelectionFlags::flagtype TrackSelectionTpc = + TrackSelectionFlags::kTPCNCls | + TrackSelectionFlags::kTPCCrossedRowsOverNCls | + TrackSelectionFlags::kTPCChi2NDF; +static constexpr TrackSelectionFlags::flagtype TrackSelectionDca = + TrackSelectionFlags::kDCAz | TrackSelectionFlags::kDCAxy; +static constexpr TrackSelectionFlags::flagtype TrackSelectionDcaxyOnly = + TrackSelectionFlags::kDCAxy; // static constexpr float kPairCutDefaults[1][5] = {{-1, -1, -1, -1, -1}}; struct HfTaskFlow { - Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "Address of the CCDB to browse"}; - Configurable noLaterThan{"noLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "Latest acceptable timestamp of creation for the object"}; + struct : ConfigurableGroup { + std::string prefix = "ConfigCcdb_group"; + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "Address of the CCDB to browse"}; + Configurable noLaterThan{"noLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "Latest acceptable timestamp of creation for the object"}; + } configCcdb; // configurables for processing options - Configurable centralityBinsForMc{"centralityBinsForMc", false, "false = OFF, true = ON for data like multiplicity/centrality bins for MC steps"}; - Configurable mftMaxDCAxy{"mftMaxDCAxy", 2.0f, "Cut on dcaXY for MFT tracks"}; - Configurable doHeavyFlavor{"doHeavyFlavor", false, "Flag to know we in the heavy flavor case or not"}; - Configurable doReferenceFlow{"doReferenceFlow", false, "Flag to know if reference flow should be done"}; - Configurable isReadoutCenter{"isReadoutCenter", false, "Enable Readout Center"}; - // Configurable doTwoTrackCut{"doTwoTrackCut", -1, "Two track cut: -1 = off; >0 otherwise distance value (suggested: 0.02)"}; - Configurable processRun2{"processRun2", false, "Flag to run on Run 2 data"}; - Configurable processRun3{"processRun3", true, "Flag to run on Run 3 data"}; - Configurable processMc{"processMc", false, "Flag to run on MC"}; - Configurable nMixedEvents{"nMixedEvents", 5, "Number of mixed events per event"}; - // Configurable twoTrackCutMinRadius{"twoTrackCutMinRadius", 0.8f, "Two track cut : radius in m from which two tracks cuts are applied"}; + struct : ConfigurableGroup { + std::string prefix = "ConfigTask_group"; + Configurable centralityBinsForMc{"centralityBinsForMc", false, "false = OFF, true = ON for data like multiplicity/centrality bins for MC steps"}; + Configurable doHeavyFlavor{"doHeavyFlavor", false, "Flag to know we in the heavy flavor case or not"}; + Configurable doReferenceFlow{"doReferenceFlow", false, "Flag to know if reference flow should be done"}; + Configurable isReadoutCenter{"isReadoutCenter", false, "Enable Readout Center"}; + // Configurable doTwoTrackCut{"doTwoTrackCut", -1, "Two track cut: -1 = off; >0 otherwise distance value (suggested: 0.02)"}; + Configurable processMc{"processMc", false, "Flag to run on MC"}; + Configurable nMixedEvents{"nMixedEvents", 5, "Number of mixed events per event"}; + // Configurable twoTrackCutMinRadius{"twoTrackCutMinRadius", 0.8f, "Two track cut : radius in m from which two tracks cuts are applied"}; + } configTask; + // configurables for collisions - Configurable zVertexMax{"zVertexMax", 7.0f, "Accepted z-vertex range"}; - // configurables for TPC tracks - Configurable etaTpcTrackMax{"etaTpcTrackMax", 0.8f, "max. eta of TPC tracks"}; - Configurable ptTpcTrackMin{"ptTpcTrackMin", 0.5f, "min. pT of TPC tracks"}; + struct : ConfigurableGroup { + std::string prefix = "ConfigCollision_group"; + Configurable isApplyGoodZvtxFT0vsPV{"isApplyGoodZvtxFT0vsPV", false, "Enable GoodZvtxFT0vsPV cut"}; + Configurable isApplySameBunchPileup{"isApplySameBunchPileup", false, "Enable SameBunchPileup cut"}; + Configurable multiplicityEstimator{"multiplicityEstimator", 0, "0: multNTracksPV, 1: numContrib, 2: multFT0C, 3: multFT0M, 4: centFT0C, 5: centFT0CVariants1s, 6: centFT0M, 7: centFV0A, 8: centNTracksPV, 9: centNGlobal, 10: centMFT"}; + Configurable isApplyNoCollInTimeRangeStrict{"isApplyNoCollInTimeRangeStrict", false, ""}; + Configurable zVertexMax{"zVertexMax", 7.0f, "Accepted z-vertex range"}; + } configCollision; + + // configurables for central barrel tracks + struct : ConfigurableGroup { + std::string prefix = "ConfigCentralTracks_group"; + Configurable etaCentralTrackMax{"etaCentralTrackMax", 0.8f, "max. eta of central tracks"}; + Configurable ptCentralTrackMin{"ptCentralTrackMin", 0.2f, "min. pT of central tracks"}; + Configurable ptCentralTrackMax{"ptCentralTrackMax", 10.0f, "max. pT of central tracks"}; + Configurable dcaZCentralTrackMax{"dcaZCentralTrackMax", 0.2f, "max dcaZ of central tracks"}; + } configCentral; + // configurables for HF candidates - Configurable etaCandidateMax{"etaCandidateMax", 0.8f, "max. eta of HF candidate"}; - Configurable selectionFlagHf{"selectionFlagHf", 1, "Selection Flag for Hf candidates"}; - // Configurable selectionFlagD0{"selectionFlagD0", 1, "Selection Flag for D0"}; - // Configurable selectionFlagD0bar{"selectionFlagD0bar", 1, "Selection Flag for D0bar"}; - // Configurable selectionFlagLcToPKPi{"selectionFlagLcToPKPi", 1, "Selection Flag for LambdaC"}; - // Configurable selectionFlagLcToPiKP{"selectionFlagLcToPiKP", 1, "Selection Flag for LambdaC bar"}; + struct : ConfigurableGroup { + std::string prefix = "ConfigCandidates_group"; + Configurable etaCandidateMax{"etaCandidateMax", 0.8f, "max. eta of HF candidate"}; + Configurable> mcTriggerPdgs{"mcTriggerPdgs", {421, -421}, "MC PDG codes to use exclusively as trigger particles. D0= +-421, Lc = +-4122"}; + Configurable selectionFlagHf{"selectionFlagHf", 1, "Selection Flag for Hf candidates"}; + Configurable yCandGenMax{"yCandGenMax", 0.5, "max. gen particle rapidity"}; + Configurable yCandRecoMax{"yCandRecoMax", 0.8, "max. cand. rapidity"}; + } configCandidates; + // configurables for MFT tracks - Configurable etaMftTrackMax{"etaMftTrackMax", -2.4f, "Maximum value for the eta of MFT tracks"}; - Configurable etaMftTrackMin{"etaMftTrackMin", -3.36f, "Minimum value for the eta of MFT tracks"}; - Configurable> mcTriggerPdgs{"mcTriggerPdgs", {421, -421}, "MC PDG codes to use exclusively as trigger particles. D0= +-421, Lc = +-4122"}; - Configurable nClustersMftTrack{"nClustersMftTrack", 5, "Minimum number of clusters for the reconstruction of MFT tracks"}; - Configurable yCandGenMax{"yCandGenMax", 0.5, "max. gen particle rapidity"}; - Configurable yCandRecoMax{"yCandRecoMax", 0.8, "max. cand. rapidity"}; + struct : ConfigurableGroup { + std::string prefix = "ConfigMft_group"; + Configurable etaMftTrackMax{"etaMftTrackMax", -2.4f, "Maximum value for the eta of MFT tracks"}; + Configurable etaMftTrackMin{"etaMftTrackMin", -3.36f, "Minimum value for the eta of MFT tracks"}; + Configurable etaMftTrackMaxFilter{"etaMftTrackMaxFilter", -2.0f, "Maximum value for the eta of MFT tracks"}; + Configurable etaMftTrackMinFilter{"etaMftTrackMinFilter", -3.9f, "Minimum value for the eta of MFT tracks"}; + Configurable mftMaxDCAxy{"mftMaxDCAxy", 2.0f, "Cut on dcaXY for MFT tracks"}; + Configurable mftMaxDCAz{"mftMaxDCAz", 2.0f, "Cut on dcaZ for MFT tracks"}; + Configurable nClustersMftTrack{"nClustersMftTrack", 5, "Minimum number of clusters for the reconstruction of MFT tracks"}; + } configMft; HfHelper hfHelper; SliceCache cache; Service pdg; Service ccdb; + std::vector* offsetFT0; std::vector* offsetFV0; o2::ccdb::CcdbApi ccdbApi; + o2::ft0::Geometry ft0Det; o2::fv0::Geometry* fv0Det; std::vector hfIndexCache; @@ -176,21 +228,16 @@ struct HfTaskFlow { using FilteredCollisionsWSelMult = soa::Filtered>; using HfCandidatesSelD0 = soa::Filtered>; using HfCandidatesSelLc = soa::Filtered>; + using FilteredTracksWDcaSel = soa::Filtered>; - // using FilteredMftTracks = soa::Filtered; + using FilteredMftTracks = soa::Filtered; // using FilteredMftTracksWColls = soa::Filtered>; // using FilteredAndReassociatedMftTracks = soa::Filtered>; - using FilteredTracksWDcaSel = soa::Filtered>; - // ========================= // using declarations : MONTE CARLO // ========================= - // Even add McCollisions in the join ? - // Kata adds subscribes to it but do not add it in the join - // using FilteredCollisionsWSelMultMcLabels = soa::Filtered>; - using FilteredCollisionsWSelMultMcLabels = soa::Filtered>; using FilteredMcCollisions = soa::Filtered>; using HfCandidatesSelD0McRec = soa::Join; @@ -198,9 +245,9 @@ struct HfTaskFlow { using McParticles = aod::McParticles; using McParticles2ProngMatched = soa::Join; using McParticles3ProngMatched = soa::Join; - // using FilteredMftTracksWCollsMcLabels = soa::Filtered>; - using MftTracksMcLabels = soa::Join; + using MftTracksMcLabels = soa::Join; using FilteredTracksWDcaSelMC = soa::Filtered>; + // using FilteredMftTracksWCollsMcLabels = soa::Filtered>; // ========================= // Filters & partitions : DATA @@ -208,71 +255,71 @@ struct HfTaskFlow { // HF candidate filter // TODO: use Partition instead of filter - Filter candidateFilterD0 = (aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagHf) || - (aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagHf); + Filter candidateFilterD0 = (aod::hf_sel_candidate_d0::isSelD0 >= configCandidates.selectionFlagHf) || + (aod::hf_sel_candidate_d0::isSelD0bar >= configCandidates.selectionFlagHf); - Filter candidateFilterLc = (aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagHf) || - (aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagHf); + Filter candidateFilterLc = (aod::hf_sel_candidate_lc::isSelLcToPKPi >= configCandidates.selectionFlagHf) || + (aod::hf_sel_candidate_lc::isSelLcToPiKP >= configCandidates.selectionFlagHf); // Collision filters - // FIXME: The filter is applied also on the candidates! Beware! - Filter collisionVtxZFilter = nabs(aod::collision::posZ) < zVertexMax; - - Filter trackFilter = (nabs(aod::track::eta) < etaTpcTrackMax) && - (aod::track::pt > ptTpcTrackMin) && - requireGlobalTrackWoPtEtaInFilter(); + Filter collisionVtxZFilter = nabs(aod::collision::posZ) < configCollision.zVertexMax; - // Filter mftTrackEtaFilter = (aod::fwdtrack::eta < etaMftTrackMax) && - // (aod::fwdtrack::eta > etaMftTrackMin); + // Central tracks filter + Filter centralTrackEtaPtFilter = (nabs(aod::track::eta) < configCentral.etaCentralTrackMax) && (aod::track::pt > configCentral.ptCentralTrackMin); + Filter centralTrackTpcFilter = ifnode(ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC), + ncheckbit(aod::track::trackCutFlag, TrackSelectionTpc), true); + Filter centralTrackItsFilter = ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) && + ncheckbit(aod::track::trackCutFlag, TrackSelectionIts); + Filter centralTrackDcaFilter = ifnode(configCentral.dcaZCentralTrackMax.node() > 0.f, nabs(aod::track::dcaZ) <= configCentral.dcaZCentralTrackMax && ncheckbit(aod::track::trackCutFlag, TrackSelectionDcaxyOnly), + ncheckbit(aod::track::trackCutFlag, TrackSelectionDca)); - // Filter mftTrackHasCollision = aod::fwdtrack::collisionId > 0; + Filter mftTrackFilter = (aod::fwdtrack::eta < configMft.etaMftTrackMaxFilter) && + (aod::fwdtrack::eta > configMft.etaMftTrackMinFilter); // Filters below will be used for uncertainties - // Filter mftTrackCollisionIdFilter = (aod::fwdtrack::bestCollisionId >= 0); - // Filter mftTrackDcaFilter = (nabs(aod::fwdtrack::bestDCAXY) < mftMaxDCAxy); + Filter mftTrackCollisionIdFilter = (aod::fwdtrack::bestCollisionId >= 0); + Filter mftTrackDcaXYFilter = (nabs(aod::fwdtrack::bestDCAXY) < configMft.mftMaxDCAxy); + // Filter mftTrackDcaZFilter = (nabs(aod::fwdtrack::bestDCAZ) < configMft.mftMaxDCAz); // ========================= // Filters & partitions : MC // ========================= - Filter candidateFilterD0Mc = (aod::hf_sel_candidate_d0::isRecoHfFlag >= selectionFlagHf) || - (aod::hf_sel_candidate_d0::isRecoHfFlag >= selectionFlagHf); + Filter candidateFilterD0Mc = (aod::hf_sel_candidate_d0::isRecoHfFlag >= configCandidates.selectionFlagHf) || + (aod::hf_sel_candidate_d0::isRecoHfFlag >= configCandidates.selectionFlagHf); - Filter candidateFilterLcMc = (aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagHf) || - (aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagHf); + Filter candidateFilterLcMc = (aod::hf_sel_candidate_lc::isSelLcToPKPi >= configCandidates.selectionFlagHf) || + (aod::hf_sel_candidate_lc::isSelLcToPiKP >= configCandidates.selectionFlagHf); // From Katarina's code, but not sure if I use it - Filter mcCollisionFilter = nabs(aod::mccollision::posZ) < zVertexMax; + Filter mcCollisionFilter = nabs(aod::mccollision::posZ) < configCollision.zVertexMax; - // Filter mcParticlesFilter = (nabs(aod::mcparticle::eta) < etaTpcTrackMax) && - // (aod::mcparticle::pt > ptTpcTrackMin); + // Filter mcParticlesFilter = (nabs(aod::mcparticle::eta) < configCentral.etaCentralTrackMax) && + // (aod::mcparticle::pt > configCentral.ptCentralTrackMin); // I didn't manage to make partitions work with my mixed event, as I am pair my tracks BEFORE looping over collisions // I am thus not able to group tracks with sliceBy and can't use this method // For now I am fine as I am doing only TPC-MFT correlations and using only McParticles with MFT acceptance // However at some point I will have to use tracks from the other side (FV0, FT0-A) and I will have to do something about it // TO-DO : either change how I do mixed event, or implement isAcceptedTpcMcParticle, isAcceptedMftMcParticle - // Partition mcParticlesMft = (aod::mcparticle::eta > etaMftTrackMin) && (aod::mcparticle::eta < etaMftTrackMax); - // Partition mcParticlesTpc = (nabs(aod::mcparticle::eta) < etaTpcTrackMax) && - // (aod::mcparticle::pt > ptTpcTrackMin); + // Partition mcParticlesMft = (aod::mcparticle::eta > configMft.etaMftTrackMin) && (aod::mcparticle::eta < configMft.etaMftTrackMax); + // Partition mcParticlesTpc = (nabs(aod::mcparticle::eta) < configCentral.etaCentralTrackMax) && + // (aod::mcparticle::pt > configCentral.ptCentralTrackMin); // ========================= // Preslice : DATA // ========================= - Preslice perColMftTracks = o2::aod::fwdtrack::collisionId; - Preslice perColTracks = aod::track::collisionId; Preslice perColD0s = aod::track::collisionId; Preslice perColLcs = aod::track::collisionId; + Preslice perColMftTracks = o2::aod::fwdtrack::collisionId; + Preslice perColTracks = aod::track::collisionId; // ========================= // Preslice : MC // ========================= Preslice mftTracksPerCollision = aod::fwdtrack::collisionId; - // Preslice d0CandidatesPerCollision = aod::hf_cand::collisionId; - // Preslice mcPerCol = aod::mcparticle::mcCollisionId; - // PresliceUnsorted collisionsMcLabelPerMcCollision = aod::mccollisionlabel::mcCollisionId; // configurables for containers // TODO: flow of HF will need to be done vs. invariant mass, in the signal and side-band regions @@ -318,7 +365,6 @@ struct HfTaskFlow { registry.add(Form("%s%s%shEtaAssociated", WhatDataType[dataType].data(), WhatCorrelationCase[correlationCase].data(), WhatParticles[correlatedParticles].data()), "", {HistType::kTH1D, {axisEtaAssociated}}); registry.add(Form("%s%s%shPhiAssociated", WhatDataType[dataType].data(), WhatCorrelationCase[correlationCase].data(), WhatParticles[correlatedParticles].data()), "", {HistType::kTH1D, {axisPhi}}); registry.add(Form("%s%s%shEtaPhiAssociated", WhatDataType[dataType].data(), WhatCorrelationCase[correlationCase].data(), WhatParticles[correlatedParticles].data()), "", {HistType::kTH3F, {axisMultiplicity, axisEtaAssociated, axisPhi}}); - registry.add(Form("%s%s%shMultiplicity", WhatDataType[dataType].data(), WhatCorrelationCase[correlationCase].data(), WhatParticles[correlatedParticles].data()), "", {HistType::kTH1D, {axisMultiplicity}}); } // ========================= @@ -326,14 +372,16 @@ struct HfTaskFlow { // ========================= void init(InitContext&) { - // const int nBinsMix = axisMultiplicity->size() * axisVertex->size(); - ccdb->setURL(ccdbUrl); + ccdb->setURL(configCcdb.ccdbUrl); ccdbApi.init("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); LOGF(info, "Getting alignment offsets from the CCDB..."); - offsetFV0 = ccdb->getForTimeStamp>("FV0/Calib/Align", noLaterThan.value); + offsetFT0 = ccdb->getForTimeStamp>("FT0/Calib/Align", configCcdb.noLaterThan.value); + offsetFV0 = ccdb->getForTimeStamp>("FV0/Calib/Align", configCcdb.noLaterThan.value); + LOGF(info, "Offset for FT0A: x = %.3f y = %.3f z = %.3f\n", (*offsetFT0)[0].getX(), (*offsetFT0)[0].getY(), (*offsetFT0)[0].getZ()); + LOGF(info, "Offset for FT0C: x = %.3f y = %.3f z = %.3f\n", (*offsetFT0)[1].getX(), (*offsetFT0)[1].getY(), (*offsetFT0)[1].getZ()); LOGF(info, "Offset for FV0-left: x = %.3f y = %.3f z = %.3f\n", (*offsetFV0)[0].getX(), (*offsetFV0)[0].getY(), (*offsetFV0)[0].getZ()); LOGF(info, "Offset for FV0-right: x = %.3f y = %.3f z = %.3f\n", (*offsetFV0)[1].getX(), (*offsetFV0)[1].getY(), (*offsetFV0)[1].getZ()); @@ -341,6 +389,9 @@ struct HfTaskFlow { // Event histograms // ========================= + registry.add("Data/hVtxZ", "v_{z} (cm)", {HistType::kTH1D, {axisVertex}}); + registry.add(Form("Data/hMultiplicity_%s", WhatMultiplicityEstimator[configCollision.multiplicityEstimator].data()), "", {HistType::kTH1D, {axisMultiplicity}}); + registry.add("Data/hEventCounter", "hEventCounter", {HistType::kTH1D, {{EventSelectionStep::NEventSelectionSteps, -0.5, +EventSelectionStep::NEventSelectionSteps - 0.5}}}); std::string labels[EventSelectionStep::NEventSelectionSteps]; labels[EventSelectionStep::AllEvents] = "all"; @@ -351,42 +402,42 @@ struct HfTaskFlow { registry.get(HIST("Data/hEventCounter"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data()); } - registry.add("Data/TpcMft/hAmbiguityOfMftTracks", "hAmbiguityOfMftTracks", {HistType::kTH1D, {{MftTrackAmbiguityStep::NMftAmbiguitySteps, -0.5, +MftTrackAmbiguityStep::NMftAmbiguitySteps - 0.5}}}); + registry.add("Data/Mft/hAmbiguityOfMftTracks", "hAmbiguityOfMftTracks", {HistType::kTH1D, {{MftTrackAmbiguityStep::NMftAmbiguitySteps, -0.5, +MftTrackAmbiguityStep::NMftAmbiguitySteps - 0.5}}}); std::string labelsAmbiguityOfMftTracks[MftTrackAmbiguityStep::NMftAmbiguitySteps]; labelsAmbiguityOfMftTracks[MftTrackAmbiguityStep::AllMftTracks] = "all MFT tracks"; labelsAmbiguityOfMftTracks[MftTrackAmbiguityStep::AfterTrackSelection] = "MFT tracks after selection"; labelsAmbiguityOfMftTracks[MftTrackAmbiguityStep::NumberOfAmbiguousTracks] = "how much tracks are ambigous"; labelsAmbiguityOfMftTracks[MftTrackAmbiguityStep::NumberOfNonAmbiguousTracks] = "how much tracks are non-ambiguous"; - registry.get(HIST("Data/TpcMft/hAmbiguityOfMftTracks"))->SetMinimum(0); + registry.get(HIST("Data/Mft/hAmbiguityOfMftTracks"))->SetMinimum(0); for (int iBin = 0; iBin < MftTrackAmbiguityStep::NMftAmbiguitySteps; iBin++) { - registry.get(HIST("Data/TpcMft/hAmbiguityOfMftTracks"))->GetXaxis()->SetBinLabel(iBin + 1, labelsAmbiguityOfMftTracks[iBin].data()); + registry.get(HIST("Data/Mft/hAmbiguityOfMftTracks"))->GetXaxis()->SetBinLabel(iBin + 1, labelsAmbiguityOfMftTracks[iBin].data()); } - registry.add("Data/TpcMft/hMftTracksSelection", "hMftTracksSelection", {HistType::kTH1D, {{MftTrackSelectionStep::NMftTrackSelectionSteps, -0.5, +MftTrackSelectionStep::NMftTrackSelectionSteps - 0.5}}}); + registry.add("Data/Mft/hMftTracksSelection", "hMftTracksSelection", {HistType::kTH1D, {{MftTrackSelectionStep::NMftTrackSelectionSteps, -0.5, +MftTrackSelectionStep::NMftTrackSelectionSteps - 0.5}}}); std::string labelsMftTracksSelection[MftTrackSelectionStep::NMftTrackSelectionSteps]; labelsMftTracksSelection[MftTrackSelectionStep::NoSelection] = "all MFT tracks"; labelsMftTracksSelection[MftTrackSelectionStep::Eta] = "MFT tracks after eta selection"; labelsMftTracksSelection[MftTrackSelectionStep::Cluster] = "MFT tracks after clusters selection"; - registry.get(HIST("Data/TpcMft/hMftTracksSelection"))->SetMinimum(0); + registry.get(HIST("Data/Mft/hMftTracksSelection"))->SetMinimum(0); for (int iBin = 0; iBin < MftTrackSelectionStep::NMftTrackSelectionSteps; iBin++) { - registry.get(HIST("Data/TpcMft/hMftTracksSelection"))->GetXaxis()->SetBinLabel(iBin + 1, labelsMftTracksSelection[iBin].data()); + registry.get(HIST("Data/Mft/hMftTracksSelection"))->GetXaxis()->SetBinLabel(iBin + 1, labelsMftTracksSelection[iBin].data()); } - registry.add("Data/TpcMft/hReassociationMftTracks", "hReassociationMftTracks", {HistType::kTH1D, {{ReassociationMftTracks::NReassociationMftTracksSteps, -0.5, +ReassociationMftTracks::NReassociationMftTracksSteps - 0.5}}}); + registry.add("Data/Mft/hReassociationMftTracks", "hReassociationMftTracks", {HistType::kTH1D, {{ReassociationMftTracks::NReassociationMftTracksSteps, -0.5, +ReassociationMftTracks::NReassociationMftTracksSteps - 0.5}}}); std::string labelsReassociationMftTracks[ReassociationMftTracks::NReassociationMftTracksSteps]; labelsReassociationMftTracks[ReassociationMftTracks::NotReassociatedMftTracks] = "MFT tracks after track selection"; labelsReassociationMftTracks[ReassociationMftTracks::ReassociatedMftTracks] = "Reassociated MFT tracks by DCAxy method"; - registry.get(HIST("Data/TpcMft/hReassociationMftTracks"))->SetMinimum(0); + registry.get(HIST("Data/Mft/hReassociationMftTracks"))->SetMinimum(0); for (int iBin = 0; iBin < ReassociationMftTracks::NReassociationMftTracksSteps; iBin++) { - registry.get(HIST("Data/TpcMft/hReassociationMftTracks"))->GetXaxis()->SetBinLabel(iBin + 1, labelsReassociationMftTracks[iBin].data()); + registry.get(HIST("Data/Mft/hReassociationMftTracks"))->GetXaxis()->SetBinLabel(iBin + 1, labelsReassociationMftTracks[iBin].data()); } - registry.add("Data/TpcMft/hNTracks", "", {HistType::kTH1F, {axisMultiplicity}}); - registry.add("Data/TpcMft/hNMftTracks", "", {HistType::kTH1F, {axisMultiplicity}}); - registry.add("Data/TpcMft/hNBestCollisionFwd", "", {HistType::kTH1F, {axisMultiplicity}}); + registry.add("Data/Mft/hNTracks", "", {HistType::kTH1F, {axisMultiplicity}}); + registry.add("Data/Mft/hNMftTracks", "", {HistType::kTH1F, {axisMultiplicity}}); + registry.add("Data/Mft/hNBestCollisionFwd", "", {HistType::kTH1F, {axisMultiplicity}}); // ========================= // Declaration of correlation containers and their respective axis @@ -431,16 +482,17 @@ struct HfTaskFlow { // Initialization of histograms and CorrelationContainers for TpcMft cases // ========================= + // if (doprocessSameTpcMftChCh || doprocessSameTpcMftChChReassociated || doprocessSameTpcMftChChReassociated3d || doprocessSameTpcMftChChNonAmbiguous) { if (doprocessSameTpcMftChCh || doprocessSameTpcMftChChReassociated || doprocessSameTpcMftChChNonAmbiguous) { addHistograms(); // All MFT tracks - registry.add("Data/TpcMft/kCFStepAll/hEta", "eta", {HistType::kTH1D, {axisEtaAssociated}}); - registry.add("Data/TpcMft/kCFStepAll/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); + registry.add("Data/Mft/kCFStepAll/hEta", "eta", {HistType::kTH1D, {axisEtaAssociated}}); + registry.add("Data/Mft/kCFStepAll/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); // Only non-ambiguous MFT tracks - registry.add("Data/TpcMft/kCFStepTracked/hEta", "eta", {HistType::kTH1D, {axisEtaAssociated}}); - registry.add("Data/TpcMft/kCFStepTracked/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); + registry.add("Data/Mft/kCFStepTracked/hEta", "eta", {HistType::kTH1D, {axisEtaAssociated}}); + registry.add("Data/Mft/kCFStepTracked/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); sameEvent.setObject(new CorrelationContainer("sameEvent", "sameEvent", corrAxis, effAxis, {})); mixedEvent.setObject(new CorrelationContainer("mixedEvent", "mixedEvent", corrAxis, effAxis, {})); @@ -450,12 +502,12 @@ struct HfTaskFlow { addHistograms(); // All MFT tracks - registry.add("Data/TpcMft/kCFStepAll/hEta", "eta", {HistType::kTH1D, {axisEtaAssociated}}); - registry.add("Data/TpcMft/kCFStepAll/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); + registry.add("Data/Mft/kCFStepAll/hEta", "eta", {HistType::kTH1D, {axisEtaAssociated}}); + registry.add("Data/Mft/kCFStepAll/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); // Only non-ambiguous MFT tracks - registry.add("Data/TpcMft/kCFStepTracked/hEta", "eta", {HistType::kTH1D, {axisEtaAssociated}}); - registry.add("Data/TpcMft/kCFStepTracked/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); + registry.add("Data/Mft/kCFStepTracked/hEta", "eta", {HistType::kTH1D, {axisEtaAssociated}}); + registry.add("Data/Mft/kCFStepTracked/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); sameEventHf.setObject(new CorrelationContainer("sameEventHf", "sameEventHf", corrAxis, effAxis, userAxis)); mixedEventHf.setObject(new CorrelationContainer("mixedEventHf", "mixedEventHf", corrAxis, effAxis, userAxis)); @@ -465,12 +517,12 @@ struct HfTaskFlow { addHistograms(); // All MFT tracks - registry.add("Data/TpcMft/kCFStepAll/hEta", "eta", {HistType::kTH1D, {axisEtaAssociated}}); - registry.add("Data/TpcMft/kCFStepAll/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); + registry.add("Data/Mft/kCFStepAll/hEta", "eta", {HistType::kTH1D, {axisEtaAssociated}}); + registry.add("Data/Mft/kCFStepAll/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); // Only non-ambiguous MFT tracks - registry.add("Data/TpcMft/kCFStepTracked/hEta", "eta", {HistType::kTH1D, {axisEtaAssociated}}); - registry.add("Data/TpcMft/kCFStepTracked/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); + registry.add("Data/Mft/kCFStepTracked/hEta", "eta", {HistType::kTH1D, {axisEtaAssociated}}); + registry.add("Data/Mft/kCFStepTracked/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); sameEventHf.setObject(new CorrelationContainer("sameEventHf", "sameEventHf", corrAxis, effAxis, userAxis)); mixedEventHf.setObject(new CorrelationContainer("mixedEventHf", "mixedEventHf", corrAxis, effAxis, userAxis)); @@ -480,7 +532,7 @@ struct HfTaskFlow { // Initialization of histograms and CorrelationContainers for TpcFv0a cases // ========================= - if (doprocessSameTpcFv0aChCh || doprocessSameTpcFv0aChCh) { + if (doprocessSameTpcFv0aChCh) { addHistograms(); sameEvent.setObject(new CorrelationContainer("sameEvent", "sameEvent", corrAxis, effAxis, {})); @@ -505,6 +557,7 @@ struct HfTaskFlow { // Initialization of histograms and CorrelationContainers for MftFv0a cases // ========================= + // if (doprocessSameMftFv0aChCh || doprocessSameMftFv0aChChReassociated || doprocessSameMftFv0aReassociated3d || doprocessSameMftFv0aChChNonAmbiguous) { if (doprocessSameMftFv0aChCh || doprocessSameMftFv0aChChReassociated || doprocessSameMftFv0aChChNonAmbiguous) { addHistograms(); @@ -513,220 +566,79 @@ struct HfTaskFlow { } // ========================= - // Initialization of histograms and CorrelationContainers for TpcMft MONTE-CARLO cases + // Initialization of histograms and CorrelationContainers for TpcFt0a cases // ========================= - if (doprocessSameTpcMftD0ChMcGen) { - addHistograms(); - sameEventHfMc.setObject(new CorrelationContainer("sameEventHfMc", "sameEventHfMc", corrAxis, effAxis, userAxis)); - mixedEventHfMc.setObject(new CorrelationContainer("mixedEventHfMc", "mixedEventHfMc", corrAxis, effAxis, userAxis)); - } + if (doprocessSameTpcFt0aChCh) { + addHistograms(); - if (doprocessSameTpcMftLcChMcGen) { - addHistograms(); - sameEventHfMc.setObject(new CorrelationContainer("sameEventHfMc", "sameEventHfMc", corrAxis, effAxis, userAxis)); - mixedEventHfMc.setObject(new CorrelationContainer("mixedEventHfMc", "mixedEventHfMc", corrAxis, effAxis, userAxis)); + sameEvent.setObject(new CorrelationContainer("sameEvent", "sameEvent", corrAxis, effAxis, {})); + mixedEvent.setObject(new CorrelationContainer("mixedEvent", "mixedEvent", corrAxis, effAxis, {})); } - } // End of init() function - - // ========================= - // Quality Assessment plots for TpcTpc cases - // ========================= - - // ---- DATA : TPC-TPC h-h Same Event QA ---- - template - void fillTpcTpcChChSameEventQa(float multiplicity, TTrack const& track) - { - registry.fill(HIST("Data/TpcTpc/ChPartChPart/hPtTrigger"), track.pt()); - registry.fill(HIST("Data/TpcTpc/ChPartChPart/hEtaTrigger"), track.eta()); - registry.fill(HIST("Data/TpcTpc/ChPartChPart/hPhiTrigger"), track.phi()); - registry.fill(HIST("Data/TpcTpc/ChPartChPart/hYieldsTrigger"), multiplicity, track.pt(), track.eta()); - registry.fill(HIST("Data/TpcTpc/ChPartChPart/hEtaPhiTrigger"), multiplicity, track.eta(), track.phi()); - registry.fill(HIST("Data/TpcTpc/ChPartChPart/hMultiplicity"), multiplicity); - } + if (doprocessSameTpcFt0aD0Ch) { + addHistograms(); - // ---- DATA : TPC-MFT HF-h Same Event candidates QA ---- - template - void fillTpcTpcHfChSameEventCandidateQa(float multiplicity, TTrack const& track, bool isD0) - { - if (isD0) { - registry.fill(HIST("Data/TpcTpc/D0ChPart/hPtTrigger"), track.pt()); - registry.fill(HIST("Data/TpcTpc/D0ChPart/hEtaTrigger"), track.eta()); - registry.fill(HIST("Data/TpcTpc/D0ChPart/hPhiTrigger"), track.phi()); - registry.fill(HIST("Data/TpcTpc/D0ChPart/hYieldsTrigger"), multiplicity, track.pt(), track.eta()); - registry.fill(HIST("Data/TpcTpc/D0ChPart/hEtaPhiTrigger"), multiplicity, track.eta(), track.phi()); - registry.fill(HIST("Data/TpcTpc/D0ChPart/hMultiplicity"), multiplicity); - } else { - registry.fill(HIST("Data/TpcTpc/LcChPart/hPtTrigger"), track.pt()); - registry.fill(HIST("Data/TpcTpc/LcChPart/hEtaTrigger"), track.eta()); - registry.fill(HIST("Data/TpcTpc/LcChPart/hPhiTrigger"), track.phi()); - registry.fill(HIST("Data/TpcTpc/LcChPart/hYieldsTrigger"), multiplicity, track.pt(), track.eta()); - registry.fill(HIST("Data/TpcTpc/LcChPart/hEtaPhiTrigger"), multiplicity, track.eta(), track.phi()); - registry.fill(HIST("Data/TpcTpc/LcChPart/hMultiplicity"), multiplicity); + sameEventHf.setObject(new CorrelationContainer("sameEventHf", "sameEventHf", corrAxis, effAxis, userAxis)); + mixedEventHf.setObject(new CorrelationContainer("mixedEventHf", "mixedEventHf", corrAxis, effAxis, userAxis)); } - } - // ---- DATA : TPC-TPC HF-h Same Event associated tracks QA ---- - template - void fillTpcTpcHfChSameEventAssociatedQa(float multiplicity, TTrack const& track, bool isD0) - { - if (isD0) { - registry.fill(HIST("Data/TpcTpc/D0ChPart/hEtaAssociated"), track.eta()); - registry.fill(HIST("Data/TpcTpc/D0ChPart/hPhiAssociated"), track.phi()); - registry.fill(HIST("Data/TpcTpc/D0ChPart/hEtaPhiAssociated"), multiplicity, track.eta(), track.phi()); - } else { - registry.fill(HIST("Data/TpcTpc/LcChPart/hEtaAssociated"), track.eta()); - registry.fill(HIST("Data/TpcTpc/LcChPart/hPhiAssociated"), track.phi()); - registry.fill(HIST("Data/TpcTpc/LcChPart/hEtaPhiAssociated"), multiplicity, track.eta(), track.phi()); - } - } + if (doprocessSameTpcFt0aLcCh) { + addHistograms(); - // ========================= - // Quality Assessment plots for TpcMft cases - // ========================= - - // ---- DATA : TPC-MFT h-h Same Event QA ---- - template - void fillTpcMftChChSameEventQa(float multiplicity, TTrack const& track, bool isTPC) - { - float phi = track.phi(); - o2::math_utils::bringTo02Pi(phi); - - if (isTPC) { // trigger hadron from TPC - registry.fill(HIST("Data/TpcMft/ChPartChPart/hEtaTrigger"), track.eta()); - registry.fill(HIST("Data/TpcMft/ChPartChPart/hPhiTrigger"), phi); - registry.fill(HIST("Data/TpcMft/ChPartChPart/hEtaPhiTrigger"), multiplicity, track.eta(), phi); - registry.fill(HIST("Data/TpcMft/ChPartChPart/hPtTrigger"), track.pt()); - registry.fill(HIST("Data/TpcMft/ChPartChPart/hYieldsTrigger"), multiplicity, track.pt(), track.eta()); - registry.fill(HIST("Data/TpcMft/ChPartChPart/hMultiplicity"), multiplicity); - } else { // associated hadron from MFT - registry.fill(HIST("Data/TpcMft/ChPartChPart/hEtaAssociated"), track.eta()); - registry.fill(HIST("Data/TpcMft/ChPartChPart/hPhiAssociated"), phi); - registry.fill(HIST("Data/TpcMft/ChPartChPart/hEtaPhiAssociated"), multiplicity, track.eta(), phi); - } - } - - // ---- DATA : TPC-MFT HF-h Same Event associated tracks QA ---- - template - void fillTpcMftHfChSameEventCandidateQa(float multiplicity, TTrack const& track, bool isD0) - { - if (isD0) { - registry.fill(HIST("Data/TpcMft/D0ChPart/hPtTrigger"), track.pt()); - registry.fill(HIST("Data/TpcMft/D0ChPart/hEtaTrigger"), track.eta()); - registry.fill(HIST("Data/TpcMft/D0ChPart/hPhiTrigger"), track.phi()); - registry.fill(HIST("Data/TpcMft/D0ChPart/hYieldsTrigger"), multiplicity, track.pt(), track.eta()); - registry.fill(HIST("Data/TpcMft/D0ChPart/hEtaPhiTrigger"), multiplicity, track.eta(), track.phi()); - registry.fill(HIST("Data/TpcMft/D0ChPart/hMultiplicity"), multiplicity); - } else { - registry.fill(HIST("Data/TpcMft/LcChPart/hPtTrigger"), track.pt()); - registry.fill(HIST("Data/TpcMft/LcChPart/hEtaTrigger"), track.eta()); - registry.fill(HIST("Data/TpcMft/LcChPart/hPhiTrigger"), track.phi()); - registry.fill(HIST("Data/TpcMft/LcChPart/hYieldsTrigger"), multiplicity, track.pt(), track.eta()); - registry.fill(HIST("Data/TpcMft/LcChPart/hEtaPhiTrigger"), multiplicity, track.eta(), track.phi()); - registry.fill(HIST("Data/TpcMft/LcChPart/hMultiplicity"), multiplicity); + sameEventHf.setObject(new CorrelationContainer("sameEventHf", "sameEventHf", corrAxis, effAxis, userAxis)); + mixedEventHf.setObject(new CorrelationContainer("mixedEventHf", "mixedEventHf", corrAxis, effAxis, userAxis)); } - } - // ---- DATA : TPC-MFT HF-h Same Event (Candidates) QA ---- - template - void fillTpcMftHfChSameEventAssociatedQa(float multiplicity, TTrack const& track, bool isD0) - { - if (isD0) { - registry.fill(HIST("Data/TpcMft/D0ChPart/hEtaAssociated"), track.eta()); - registry.fill(HIST("Data/TpcMft/D0ChPart/hPhiAssociated"), track.phi()); - registry.fill(HIST("Data/TpcMft/D0ChPart/hEtaPhiAssociated"), multiplicity, track.eta(), track.phi()); - } else { - registry.fill(HIST("Data/TpcMft/LcChPart/hEtaAssociated"), track.eta()); - registry.fill(HIST("Data/TpcMft/LcChPart/hPhiAssociated"), track.phi()); - registry.fill(HIST("Data/TpcMft/LcChPart/hEtaPhiAssociated"), multiplicity, track.eta(), track.phi()); - } - } + // ========================= + // Initialization of histograms and CorrelationContainers for MftFt0a cases + // ========================= - // ========================= - // Quality Assessment plots for TpcFv0 cases - // ========================= + if (doprocessSameMftFt0aChCh || doprocessSameMftFt0aChChReassociated || doprocessSameMftFt0aChChNonAmbiguous) { + addHistograms(); - // ---- DATA : QA for FV0a ---- - void fillFv0aQa(float multiplicity, float const& eta, float const& phi, bool isTPC) - { - if (isTPC) { - registry.fill(HIST("Data/TpcFv0a/ChPartChPart/hEtaAssociated"), eta); - registry.fill(HIST("Data/TpcFv0a/ChPartChPart/hPhiAssociated"), phi); - registry.fill(HIST("Data/TpcFv0a/ChPartChPart/hEtaPhiAssociated"), multiplicity, eta, phi); - } else { - registry.fill(HIST("Data/MftFv0a/ChPartChPart/hEtaAssociated"), eta); - registry.fill(HIST("Data/MftFv0a/ChPartChPart/hPhiAssociated"), phi); - registry.fill(HIST("Data/MftFv0a/ChPartChPart/hEtaPhiAssociated"), multiplicity, eta, phi); + sameEvent.setObject(new CorrelationContainer("sameEvent", "sameEvent", corrAxis, effAxis, {})); + mixedEvent.setObject(new CorrelationContainer("mixedEvent", "mixedEvent", corrAxis, effAxis, {})); } - } - // ---- DATA : TPC-MFT h-h Same Event trigger QA ---- - template - void fillTpcFv0aChChSameEventTriggerQa(float multiplicity, TTrack const& track) - { - float phi = track.phi(); - o2::math_utils::bringTo02Pi(phi); - registry.fill(HIST("Data/TpcFv0a/ChPartChPart/hEtaTrigger"), track.eta()); - registry.fill(HIST("Data/TpcFv0a/ChPartChPart/hPhiTrigger"), phi); - registry.fill(HIST("Data/TpcFv0a/ChPartChPart/hEtaPhiTrigger"), multiplicity, track.eta(), phi); - registry.fill(HIST("Data/TpcFv0a/ChPartChPart/hPtTrigger"), track.pt()); - registry.fill(HIST("Data/TpcFv0a/ChPartChPart/hYieldsTrigger"), multiplicity, track.pt(), track.eta()); - registry.fill(HIST("Data/TpcFv0a/ChPartChPart/hMultiplicity"), multiplicity); - } + // ========================= + // Initialization of histograms and CorrelationContainers for TpcMft MONTE-CARLO cases + // ========================= - // ---- DATA : TPC-MFT HF-h Same Event associated tracks QA ---- - template - void fillTpcFv0aHfChSameEventCandidateQa(float multiplicity, TTrack const& track, bool isD0) - { - if (isD0) { - registry.fill(HIST("Data/TpcFv0a/D0ChPart/hPtTrigger"), track.pt()); - registry.fill(HIST("Data/TpcFv0a/D0ChPart/hEtaTrigger"), track.eta()); - registry.fill(HIST("Data/TpcFv0a/D0ChPart/hPhiTrigger"), track.phi()); - registry.fill(HIST("Data/TpcFv0a/D0ChPart/hYieldsTrigger"), multiplicity, track.pt(), track.eta()); - registry.fill(HIST("Data/TpcFv0a/D0ChPart/hEtaPhiTrigger"), multiplicity, track.eta(), track.phi()); - registry.fill(HIST("Data/TpcFv0a/D0ChPart/hMultiplicity"), multiplicity); - } else { - registry.fill(HIST("Data/TpcFv0a/LcChPart/hPtTrigger"), track.pt()); - registry.fill(HIST("Data/TpcFv0a/LcChPart/hEtaTrigger"), track.eta()); - registry.fill(HIST("Data/TpcFv0a/LcChPart/hPhiTrigger"), track.phi()); - registry.fill(HIST("Data/TpcFv0a/LcChPart/hYieldsTrigger"), multiplicity, track.pt(), track.eta()); - registry.fill(HIST("Data/TpcFv0a/LcChPart/hEtaPhiTrigger"), multiplicity, track.eta(), track.phi()); - registry.fill(HIST("Data/TpcFv0a/LcChPart/hMultiplicity"), multiplicity); + if (doprocessSameTpcMftD0ChMcGen) { + addHistograms(); + sameEventHfMc.setObject(new CorrelationContainer("sameEventHfMc", "sameEventHfMc", corrAxis, effAxis, userAxis)); + mixedEventHfMc.setObject(new CorrelationContainer("mixedEventHfMc", "mixedEventHfMc", corrAxis, effAxis, userAxis)); } - } - // ---- DATA : TPC-MFT HF-h Same Event (Candidates) QA ---- - void fillTpcFv0aHfChSameEventAssociatedQa(float multiplicity, float const& eta, float const& phi, bool isD0) - { - if (isD0) { - registry.fill(HIST("Data/TpcFv0a/D0ChPart/hEtaAssociated"), eta); - registry.fill(HIST("Data/TpcFv0a/D0ChPart/hPhiAssociated"), phi); - registry.fill(HIST("Data/TpcFv0a/D0ChPart/hEtaPhiAssociated"), multiplicity, eta, phi); - } else { - registry.fill(HIST("Data/TpcFv0a/LcChPart/hEtaAssociated"), eta); - registry.fill(HIST("Data/TpcFv0a/LcChPart/hPhiAssociated"), phi); - registry.fill(HIST("Data/TpcFv0a/LcChPart/hEtaPhiAssociated"), multiplicity, eta, phi); + if (doprocessSameTpcMftLcChMcGen) { + addHistograms(); + sameEventHfMc.setObject(new CorrelationContainer("sameEventHfMc", "sameEventHfMc", corrAxis, effAxis, userAxis)); + mixedEventHfMc.setObject(new CorrelationContainer("mixedEventHfMc", "mixedEventHfMc", corrAxis, effAxis, userAxis)); } - } + + } // End of init() function // ========================= - // Quality Assessment plots for MftFv0 cases + // Quality assessment functions // ========================= - // ---- DATA : MFT-FV0a h-h Same Event QA for MFT ---- - template - void fillMftFv0aChChSameEventQa(float multiplicity, TTrack const& track) + template + void fillTriggerQa(float multiplicity, float const& eta, float const& phi, float const& pt) { - float phi = track.phi(); - o2::math_utils::bringTo02Pi(phi); + registry.fill(HIST(WhatDataType[dataType]) + HIST(WhatCorrelationCase[correlationCase]) + HIST(WhatParticles[correlatedParticles]) + HIST("hPtTrigger"), pt); + registry.fill(HIST(WhatDataType[dataType]) + HIST(WhatCorrelationCase[correlationCase]) + HIST(WhatParticles[correlatedParticles]) + HIST("hEtaTrigger"), eta); + registry.fill(HIST(WhatDataType[dataType]) + HIST(WhatCorrelationCase[correlationCase]) + HIST(WhatParticles[correlatedParticles]) + HIST("hPhiTrigger"), phi); + registry.fill(HIST(WhatDataType[dataType]) + HIST(WhatCorrelationCase[correlationCase]) + HIST(WhatParticles[correlatedParticles]) + HIST("hYieldsTrigger"), multiplicity, pt, eta); + registry.fill(HIST(WhatDataType[dataType]) + HIST(WhatCorrelationCase[correlationCase]) + HIST(WhatParticles[correlatedParticles]) + HIST("hEtaPhiTrigger"), multiplicity, eta, phi); + } - registry.fill(HIST("Data/MftFv0a/ChPartChPart/hEtaTrigger"), track.eta()); - registry.fill(HIST("Data/MftFv0a/ChPartChPart/hPhiTrigger"), phi); - registry.fill(HIST("Data/MftFv0a/ChPartChPart/hEtaPhiTrigger"), multiplicity, track.eta(), phi); - registry.fill(HIST("Data/MftFv0a/ChPartChPart/hPtTrigger"), track.pt()); - registry.fill(HIST("Data/MftFv0a/ChPartChPart/hYieldsTrigger"), multiplicity, track.pt(), track.eta()); - registry.fill(HIST("Data/MftFv0a/ChPartChPart/hMultiplicity"), multiplicity); + template + void fillAssociatedQa(float multiplicity, float const& eta, float const& phi) + { + registry.fill(HIST(WhatDataType[dataType]) + HIST(WhatCorrelationCase[correlationCase]) + HIST(WhatParticles[correlatedParticles]) + HIST("hEtaAssociated"), eta); + registry.fill(HIST(WhatDataType[dataType]) + HIST(WhatCorrelationCase[correlationCase]) + HIST(WhatParticles[correlatedParticles]) + HIST("hPhiAssociated"), phi); + registry.fill(HIST(WhatDataType[dataType]) + HIST(WhatCorrelationCase[correlationCase]) + HIST(WhatParticles[correlatedParticles]) + HIST("hEtaPhiAssociated"), multiplicity, eta, phi); } // ========================= @@ -747,6 +659,42 @@ struct HfTaskFlow { } } + template + float getMultiplicityEstimator(TCollision collision, bool isSameEvent) + { + switch (configCollision.multiplicityEstimator) { + case MultiplicityEstimators::MultNTracksPV: + if (isSameEvent) { + registry.fill(HIST("Data/hMultiplicity_multNTracksPV"), collision.multNTracksPV()); + } + return collision.multNTracksPV(); + case MultiplicityEstimators::MultNumContrib: + if (isSameEvent) { + registry.fill(HIST("Data/hMultiplicity_multNumContrib"), collision.numContrib()); + } + return collision.numContrib(); + case MultiplicityEstimators::MultFT0C: + if (isSameEvent) { + registry.fill(HIST("Data/hMultiplicity_multFT0C"), collision.multFT0C()); + } + return collision.multFT0C(); + case MultiplicityEstimators::MultFT0M: + if (isSameEvent) { + registry.fill(HIST("Data/hMultiplicity_multFT0M"), collision.multFT0M()); + } + return collision.multFT0M(); + default: + return collision.multNTracksPV(); + } + } + + double getPhiFT0(uint chno, int i) + { + ft0Det.calculateChannelCenter(); + auto chPos = ft0Det.getChannelCenter(chno); + return RecoDecay::phi(chPos.X() + (*offsetFT0)[i].getX(), chPos.Y() + (*offsetFT0)[i].getY()); + } + double getPhiFV0(unsigned int chno) { int cellsInLeft[] = {0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27, 32, 40, 33, 41, 34, 42, 35, 43}; @@ -763,7 +711,7 @@ struct HfTaskFlow { o2::fv0::Point3Dsimple chPos; chPos = fv0Det->getReadoutCenter(chno); - // if (isReadoutCenter) + // if (configTask.isReadoutCenter) // chPos = fv0Det->getReadoutCenter(chno); // else // chPos = fv0Det->getCellCenter(chno); @@ -771,6 +719,18 @@ struct HfTaskFlow { return RecoDecay::phi(chPos.x + offsetX, chPos.y + offsetY); } + double getEtaFT0(uint chno, int i) + { + ft0Det.calculateChannelCenter(); + auto chPos = ft0Det.getChannelCenter(chno); + auto x = chPos.X() + (*offsetFT0)[i].getX(); + auto y = chPos.Y() + (*offsetFT0)[i].getY(); + auto z = chPos.Z() + (*offsetFT0)[i].getZ(); + auto r = std::sqrt(x * x + y * y); + auto theta = std::atan2(r, z); + return -std::log(std::tan(0.5 * theta)); + } + double getEtaFV0(unsigned int chno) { int cellsInLeft[] = {0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27, 32, 40, 33, 41, 34, 42, 35, 43}; @@ -788,7 +748,7 @@ struct HfTaskFlow { o2::fv0::Point3Dsimple chPos; chPos = fv0Det->getReadoutCenter(chno); - // if (isReadoutCenter) + // if (configTask.isReadoutCenter) // chPos = fv0Det->getReadoutCenter(chno); // else // chPos = fv0Det->getCellCenter(chno); @@ -813,16 +773,30 @@ struct HfTaskFlow { registry.fill(HIST("Data/hEventCounter"), EventSelectionStep::AllEvents); } - if (processMc == false) { + if (configTask.processMc == false) { if (!collision.sel8()) { return false; } } + if (configCollision.isApplySameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + return false; + } + + if (configCollision.isApplyGoodZvtxFT0vsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + return false; + } + + if (configCollision.isApplyNoCollInTimeRangeStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStrict)) { + return false; + } + if (fillHistograms) { registry.fill(HIST("Data/hEventCounter"), EventSelectionStep::AfterEventSelection); } + registry.fill(HIST("Data/hVtxZ"), collision.posZ()); + return true; } @@ -836,10 +810,10 @@ struct HfTaskFlow { if (!(candidate.hfflag() & 1 << aod::hf_cand_3prong::DecayType::LcToPKPi)) { return false; } - if (etaCandidateMax >= 0. && std::abs(etaCandidate) > etaCandidateMax) { + if (configCandidates.etaCandidateMax >= 0. && std::abs(etaCandidate) > configCandidates.etaCandidateMax) { return false; } - if (yCandRecoMax >= 0. && std::abs(hfHelper.yLc(candidate)) > yCandRecoMax) { + if (configCandidates.yCandRecoMax >= 0. && std::abs(hfHelper.yLc(candidate)) > configCandidates.yCandRecoMax) { return false; } return true; @@ -848,10 +822,10 @@ struct HfTaskFlow { if (!(candidate.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { return false; } - if (etaCandidateMax >= 0. && std::abs(etaCandidate) > etaCandidateMax) { + if (configCandidates.etaCandidateMax >= 0. && std::abs(etaCandidate) > configCandidates.etaCandidateMax) { return false; } - if (yCandRecoMax >= 0. && std::abs(hfHelper.yD0(candidate)) > yCandRecoMax) { + if (configCandidates.yCandRecoMax >= 0. && std::abs(hfHelper.yD0(candidate)) > configCandidates.yCandRecoMax) { return false; } return true; @@ -865,21 +839,21 @@ struct HfTaskFlow { bool isAcceptedMftTrack(TTrack const& mftTrack, bool fillHistograms) { // cut on the eta of MFT tracks - if (mftTrack.eta() > etaMftTrackMax || mftTrack.eta() < etaMftTrackMin) { + if (mftTrack.eta() > configMft.etaMftTrackMax || mftTrack.eta() < configMft.etaMftTrackMin) { return false; } if (fillHistograms) { - registry.fill(HIST("Data/TpcMft/hMftTracksSelection"), MftTrackSelectionStep::Eta); + registry.fill(HIST("Data/Mft/hMftTracksSelection"), MftTrackSelectionStep::Eta); } // cut on the number of clusters of the reconstructed MFT track - if (mftTrack.nClusters() < nClustersMftTrack) { + if (mftTrack.nClusters() < configMft.nClustersMftTrack) { return false; } if (fillHistograms) { - registry.fill(HIST("Data/TpcMft/hMftTracksSelection"), MftTrackSelectionStep::Cluster); + registry.fill(HIST("Data/Mft/hMftTracksSelection"), MftTrackSelectionStep::Cluster); } return true; @@ -891,13 +865,13 @@ struct HfTaskFlow { { if (mftTrack.ambDegree() > 1) { if (fillHistograms) { - registry.fill(HIST("Data/TpcMft/hAmbiguityOfMftTracks"), MftTrackAmbiguityStep::NumberOfAmbiguousTracks); + registry.fill(HIST("Data/Mft/hAmbiguityOfMftTracks"), MftTrackAmbiguityStep::NumberOfAmbiguousTracks); } return true; } if (fillHistograms) { - registry.fill(HIST("Data/TpcMft/hAmbiguityOfMftTracks"), MftTrackAmbiguityStep::NumberOfNonAmbiguousTracks); + registry.fill(HIST("Data/Mft/hAmbiguityOfMftTracks"), MftTrackAmbiguityStep::NumberOfNonAmbiguousTracks); } return false; } @@ -911,11 +885,11 @@ struct HfTaskFlow { if constexpr (std::is_same_v) { // For now, that means we do D0 if (std::abs(mcCandidate.flagMcMatchGen()) == 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) { - if (etaCandidateMax >= 0. && std::abs(etaCandidate) > etaCandidateMax) { + if (configCandidates.etaCandidateMax >= 0. && std::abs(etaCandidate) > configCandidates.etaCandidateMax) { return false; } - if (yCandGenMax >= 0. && std::abs(RecoDecay::y(mcCandidate.pVector(), o2::constants::physics::MassD0)) > yCandGenMax) { + if (configCandidates.yCandGenMax >= 0. && std::abs(RecoDecay::y(mcCandidate.pVector(), o2::constants::physics::MassD0)) > configCandidates.yCandGenMax) { return false; } @@ -927,11 +901,11 @@ struct HfTaskFlow { } else { // For now, that means we do LambdaC if (std::abs(mcCandidate.flagMcMatchGen()) == 1 << aod::hf_cand_3prong::DecayType::LcToPKPi) { - if (etaCandidateMax >= 0. && std::abs(etaCandidate) > etaCandidateMax) { + if (configCandidates.etaCandidateMax >= 0. && std::abs(etaCandidate) > configCandidates.etaCandidateMax) { return false; } - if (yCandGenMax >= 0. && std::abs(RecoDecay::y(mcCandidate.pVector(), o2::constants::physics::MassLambdaCPlus)) > yCandGenMax) { + if (configCandidates.yCandGenMax >= 0. && std::abs(RecoDecay::y(mcCandidate.pVector(), o2::constants::physics::MassLambdaCPlus)) > configCandidates.yCandGenMax) { return false; } @@ -964,7 +938,7 @@ struct HfTaskFlow { } */ - if (mcParticle.eta() > etaMftTrackMax || mcParticle.eta() < etaMftTrackMin) { + if (mcParticle.eta() > configMft.etaMftTrackMax || mcParticle.eta() < configMft.etaMftTrackMin) { return false; } @@ -994,9 +968,7 @@ struct HfTaskFlow { // I fill it only for the first trigger track of the collision auto loopCounter = 0; - // // TRIGGER PARTICLE - // for (const auto& track1 : tracks1) { loopCounter++; @@ -1004,13 +976,10 @@ struct HfTaskFlow { float eta1 = track1.eta(); float pt1 = track1.pt(); float phi1 = track1.phi(); - o2::math_utils::bringTo02Pi(phi1); // TODO: add getter for NUE trigger efficiency here // calculating inv. mass to be filled into the container below - // Note: this is needed only in case of HF-hadron correlations - // TO DO ? Add one more if condition if its MC ? bool fillingHFcontainer = false; double invmass = 0; if constexpr (std::is_same_v || std::is_same_v) { @@ -1049,42 +1018,36 @@ struct HfTaskFlow { // FILL QA PLOTS for trigger particle if (sameEvent && (step == CorrelationContainer::kCFStepReconstructed)) { - if (processMc == false) { // If DATA - if constexpr (!std::is_same_v) { // IF TPC-TPC case + if (configTask.processMc == false) { // If DATA + if constexpr (!std::is_same_v) { // IF TPC-TPC case if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-TPC D0-h - fillTpcTpcHfChSameEventCandidateQa(multiplicity, track1, true); + fillTriggerQa(multiplicity, eta1, phi1, pt1); } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-TPC Lc-h - fillTpcTpcHfChSameEventCandidateQa(multiplicity, track1, false); + fillTriggerQa(multiplicity, eta1, phi1, pt1); } else { // IF NEITHER D0 NOR LC -> TPC-TPC h-h - fillTpcTpcChChSameEventQa(multiplicity, track1); + fillTriggerQa(multiplicity, eta1, phi1, pt1); } } else { // IF TPC-MFT case if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-MFT D0-h - fillTpcMftHfChSameEventCandidateQa(multiplicity, track1, true); + fillTriggerQa(multiplicity, eta1, phi1, pt1); } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-MFT Lc-h - fillTpcMftHfChSameEventCandidateQa(multiplicity, track1, false); + fillTriggerQa(multiplicity, eta1, phi1, pt1); } else { // IF NEITHER D0 NOR LC -> TPC-MFT h-h - fillTpcMftChChSameEventQa(multiplicity, track1, true); + fillTriggerQa(multiplicity, eta1, phi1, pt1); } // end of if condition for TPC-TPC or TPC-MFT case } // Maybe I won't need it for MC (first files are way lighter in MC, but also I need to loop over all tracks in MC GEN) - } else { // If MC (add cases later) - if constexpr (!std::is_same_v) { // IF TPC-TPC case - // fillTpcTpcChChSameEventQaMc(multiplicity, track1); - } } } - // // ASSOCIATED PARTICLE - // for (const auto& track2 : tracks2) { // apply cuts for MFT tracks - if constexpr (std::is_same_v) { + if constexpr (std::is_same_v) { if (sameEvent && loopCounter == 1) { // To avoid double counting, we fill the plots only the first time - registry.fill(HIST("Data/TpcMft/hMftTracksSelection"), MftTrackSelectionStep::NoSelection); + registry.fill(HIST("Data/Mft/hMftTracksSelection"), MftTrackSelectionStep::NoSelection); if (!isAcceptedMftTrack(track2, true)) { continue; @@ -1106,7 +1069,7 @@ struct HfTaskFlow { // in case of HF-h correlations, remove candidate daughters from the pool of associated hadrons // with which the candidate is being correlated (will not have to do it for TPC-MFT case) - if constexpr (!std::is_same_v) { // if NOT TPC-MFT case -> TPC-TPC case + if constexpr (!std::is_same_v) { // if NOT TPC-MFT case -> TPC-TPC case if constexpr (std::is_same_v) { // Remove the 2 prong daughters if ((track1.prong0Id() == track2.globalIndex()) || (track1.prong1Id() == track2.globalIndex())) { continue; @@ -1120,17 +1083,13 @@ struct HfTaskFlow { } // in case of MC-generated, do additional selection on MCparticles : charge and isPhysicalPrimary - // if (processMc) { + // if (configTask.processMc) { if constexpr (std::is_same_v || std::is_same_v) { if (!isAcceptedMftMcParticle(track2)) { continue; } } - // if constexpr (std::is_same_v) { - // registry.fill(HIST("MC/Gen/TpcMft/HfHadron/SameEvent/hEtaMFT"), track2.eta()); - // } - float eta2 = track2.eta(); float pt2 = track2.pt(); float phi2 = track2.phi(); @@ -1144,7 +1103,6 @@ struct HfTaskFlow { // set range of delta phi in (-pi/2 , 3/2*pi) deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); - // IF EVERYTHING WORKS WITH THE REASSOCIATED MFT TRACKS, I WILL HAVE TO CHANGE HOW THOSE FUNCTIONS ARE FILLED TOO if (!fillingHFcontainer) { // fill pair correlations target->getPairHist()->Fill(step, eta1 - eta2, pt2, pt1, multiplicity, deltaPhi, posZ, @@ -1156,32 +1114,28 @@ struct HfTaskFlow { // FILL QA PLOTS for associated particle if (sameEvent && (loopCounter == 1) && (step == CorrelationContainer::kCFStepReconstructed)) { - // if constexpr (std::is_same_v) { // If DATA - if constexpr (!std::is_same_v) { // IF TPC-TPC case + if constexpr (!std::is_same_v) { // IF TPC-TPC case if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-TPC D0-h - fillTpcTpcHfChSameEventAssociatedQa(multiplicity, track2, true); + fillAssociatedQa(multiplicity, eta2, phi2); } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-TPC Lc-h - fillTpcTpcHfChSameEventAssociatedQa(multiplicity, track2, false); + fillAssociatedQa(multiplicity, eta2, phi2); } // No if condition if it is h-h, because it would be the same plots than for the trigger particle } else { // IF TPC-MFT case if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-MFT D0-h - fillTpcMftHfChSameEventAssociatedQa(multiplicity, track2, true); + fillAssociatedQa(multiplicity, eta2, phi2); } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-MFT Lc-h - fillTpcMftHfChSameEventAssociatedQa(multiplicity, track2, false); + fillAssociatedQa(multiplicity, eta2, phi2); } else { // IF NEITHER D0 NOR LC -> TPC-MFT h-h - fillTpcMftChChSameEventQa(multiplicity, track2, false); + fillAssociatedQa(multiplicity, eta2, phi2); } // end of if condition for TPC-TPC or TPC-MFT case } - //} else { // If MC (add cases later) - // fillTpcTpcChChSameEventQaMc(multiplicityTracks2, vz, tracks1); - //} } - if (sameEvent && (loopCounter == 1) && std::is_same_v) { + if (sameEvent && (loopCounter == 1) && std::is_same_v) { // FILL USUAL MFT DISTRIBUTIONS - registry.fill(HIST("Data/TpcMft/kCFStepAll/hEta"), eta2); - registry.fill(HIST("Data/TpcMft/kCFStepAll/hPhi"), phi2); + registry.fill(HIST("Data/Mft/kCFStepAll/hEta"), eta2); + registry.fill(HIST("Data/Mft/kCFStepAll/hPhi"), phi2); } } // end of loop over tracks2 @@ -1200,9 +1154,7 @@ struct HfTaskFlow { // I fill it only for the first trigger track of the collision auto loopCounter = 0; - // // TRIGGER PARTICLE - // for (const auto& track1 : tracks1) { loopCounter++; @@ -1210,44 +1162,21 @@ struct HfTaskFlow { float eta1 = track1.eta(); float pt1 = track1.pt(); float phi1 = track1.phi(); - o2::math_utils::bringTo02Pi(phi1); - - // TODO: add getter for NUE trigger efficiency here - // calculating inv. mass to be filled into the container below - // Note: this is needed only in case of HF-hadron correlations - // TO DO ? Add one more if condition if its MC ? bool fillingHFcontainer = false; double invmass = 0; if constexpr (std::is_same_v || std::is_same_v) { - // TODO: Check how to put this into a Filter -> Pretty sure it cannot be a filter if (!isAcceptedCandidate(track1)) { continue; } fillingHFcontainer = true; if constexpr (std::is_same_v) { // If D0 invmass = hfHelper.invMassD0ToPiK(track1); - // Should add D0 bar ? } else { // If Lc invmass = hfHelper.invMassLcToPKPi(track1); - // Should add Lc bar ? (maybe not its the same mass right ?) } } - //// Selections for MC GENERATED - // if constexpr (std::is_same_v || std::is_same_v) { - // // TODO: Check how to put this into a Filter -> Pretty sure it cannot be a filter - // if (!isAcceptedMcCandidate(track1)) { - // continue; - // } - // fillingHFcontainer = true; - // if constexpr (std::is_same_v) { // If D0 - // invmass = o2::constants::physics::MassD0; - // } else { // If Lc - // invmass = o2::constants::physics::MassLambdaCPlus; - // } - // } - // fill single-track distributions if (!fillingHFcontainer) { // if not HF-h case target->getTriggerHist()->Fill(step, pt1, multiplicity, posZ, triggerWeight); @@ -1258,28 +1187,23 @@ struct HfTaskFlow { // FILL QA PLOTS for trigger particle if (sameEvent && (cutAmbiguousTracks == false)) { if constexpr (std::is_same_v) { - fillTpcMftHfChSameEventCandidateQa(multiplicity, track1, true); + fillTriggerQa(multiplicity, eta1, phi1, pt1); } else if constexpr (std::is_same_v) { - fillTpcMftHfChSameEventCandidateQa(multiplicity, track1, false); + fillTriggerQa(multiplicity, eta1, phi1, pt1); } else { - fillTpcMftChChSameEventQa(multiplicity, track1, true); + fillTriggerQa(multiplicity, eta1, phi1, pt1); } } - // // ASSOCIATED PARTICLE - // for (const auto& track2 : tracks2) { // Fill QA plot for all MFT tracks () (only if cutAmbiguousTracks is false to avoid double counting) if (!cutAmbiguousTracks && sameEvent && (loopCounter == 1)) { - registry.fill(HIST("Data/TpcMft/hAmbiguityOfMftTracks"), MftTrackAmbiguityStep::AllMftTracks); + registry.fill(HIST("Data/Mft/hAmbiguityOfMftTracks"), MftTrackAmbiguityStep::AllMftTracks); } - // const auto& reassociatedMftTrack = track2.mfttrack(); - // No one uses const and auto& here, so I will follow - - auto reassociatedMftTrack = track2.template mfttrack_as(); + auto reassociatedMftTrack = track2.template mfttrack_as(); if (!isAcceptedMftTrack(reassociatedMftTrack, false)) { continue; @@ -1287,8 +1211,8 @@ struct HfTaskFlow { // Fill QA plot for MFT tracks after physical selection (eta + clusters) if (!cutAmbiguousTracks && sameEvent && (loopCounter == 1)) { - registry.fill(HIST("Data/TpcMft/hAmbiguityOfMftTracks"), MftTrackAmbiguityStep::AfterTrackSelection); - registry.fill(HIST("Data/TpcMft/hReassociationMftTracks"), ReassociationMftTracks::NotReassociatedMftTracks); + registry.fill(HIST("Data/Mft/hAmbiguityOfMftTracks"), MftTrackAmbiguityStep::AfterTrackSelection); + registry.fill(HIST("Data/Mft/hReassociationMftTracks"), ReassociationMftTracks::NotReassociatedMftTracks); } // We check if the track is ambiguous or non-ambiguous (QA plots are filled in isAmbiguousMftTrack) @@ -1302,18 +1226,10 @@ struct HfTaskFlow { if (reassociatedMftTrack.collisionId() != track2.bestCollisionId()) { if (sameEvent && (loopCounter == 1)) { - registry.fill(HIST("Data/TpcMft/hReassociationMftTracks"), ReassociationMftTracks::ReassociatedMftTracks); + registry.fill(HIST("Data/Mft/hReassociationMftTracks"), ReassociationMftTracks::ReassociatedMftTracks); } } - // case of h-h correlations where the two types of tracks are the same - // this avoids autocorrelations and double counting of particle pairs - // if constexpr (std::is_same_v) { - // if (track1.index() <= reassociatedMftTrack.index()) { - // continue; - // } - //} - // in case of HF-h correlations, remove candidate daughters from the pool of associated hadrons // with which the candidate is being correlated (will not have to do it for TPC-MFT case) if constexpr (std::is_same_v) { // Remove the 2 prong daughters @@ -1327,18 +1243,6 @@ struct HfTaskFlow { } } - // in case of MC-generated, do additional selection on MCparticles : charge and isPhysicalPrimary - // if (processMc) { - if constexpr (std::is_same_v || std::is_same_v) { - if (!isAcceptedMftMcParticle(reassociatedMftTrack)) { - continue; - } - } - - // if constexpr (std::is_same_v) { - // registry.fill(HIST("MC/Gen/TpcMft/HfHadron/SameEvent/hEtaMFT"), reassociatedMftTrack.eta()); - // } - float eta2 = reassociatedMftTrack.eta(); float pt2 = reassociatedMftTrack.pt(); float phi2 = reassociatedMftTrack.phi(); @@ -1352,9 +1256,7 @@ struct HfTaskFlow { // set range of delta phi in (-pi/2 , 3/2*pi) deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); - // IF EVERYTHING WORKS WITH THE REASSOCIATED MFT TRACKS, I WILL HAVE TO CHANGE HOW THOSE FUNCTIONS ARE FILLED TOO if (!fillingHFcontainer) { - // fill pair correlations target->getPairHist()->Fill(step, eta1 - eta2, pt2, pt1, multiplicity, deltaPhi, posZ, triggerWeight * associatedWeight); } else { @@ -1365,28 +1267,27 @@ struct HfTaskFlow { // FILL QA PLOTS for associated particle if (sameEvent && (loopCounter == 1) && (cutAmbiguousTracks == false)) { if constexpr (std::is_same_v) { - fillTpcMftHfChSameEventAssociatedQa(multiplicity, reassociatedMftTrack, true); + fillAssociatedQa(multiplicity, eta2, phi2); } else if constexpr (std::is_same_v) { - fillTpcMftHfChSameEventAssociatedQa(multiplicity, reassociatedMftTrack, false); + fillAssociatedQa(multiplicity, eta2, phi2); } else { - fillTpcMftChChSameEventQa(multiplicity, reassociatedMftTrack, false); + fillAssociatedQa(multiplicity, eta2, phi2); } } // QA plots for basic MFT distributions for non-ambiguous tracks only (kCFStepTracked) if (cutAmbiguousTracks && sameEvent && (loopCounter == 1)) { - // FILL USUAL MFT DISTRIBUTIONS - registry.fill(HIST("Data/TpcMft/kCFStepTracked/hEta"), eta2); - registry.fill(HIST("Data/TpcMft/kCFStepTracked/hPhi"), phi2); + registry.fill(HIST("Data/Mft/kCFStepTracked/hEta"), eta2); + registry.fill(HIST("Data/Mft/kCFStepTracked/hPhi"), phi2); } } // end of loop over tracks2 } // end of loop over tracks 1 } - template - void fillCorrelationsFV0(TTarget target, CorrelationContainer::CFStep step, - TTracksTrig const& tracks1, TTracksAssoc const& tracks2, + template + void fillCorrelationsFIT(TTarget target, CorrelationContainer::CFStep step, + TTracksTrig const& tracks1, TTracksAssoc const& tracks2, TFits const&, float multiplicity, float posZ, bool sameEvent) { auto triggerWeight = 1; @@ -1396,9 +1297,7 @@ struct HfTaskFlow { // I fill it only for the first trigger track of the collision auto loopCounter = 0; - // // TRIGGER PARTICLE - // for (auto const& track1 : tracks1) { loopCounter++; @@ -1406,17 +1305,13 @@ struct HfTaskFlow { float eta1 = track1.eta(); float pt1 = track1.pt(); float phi1 = track1.phi(); - o2::math_utils::bringTo02Pi(phi1); - - // TODO: add getter for NUE trigger efficiency here + if constexpr (std::is_same_v) { + o2::math_utils::bringTo02Pi(phi1); + } - // calculating inv. mass to be filled into the container below - // Note: this is needed only in case of HF-hadron correlations - // TO DO ? Add one more if condition if its MC ? bool fillingHFcontainer = false; double invmass = 0; if constexpr (std::is_same_v || std::is_same_v) { - // TODO: Check how to put this into a Filter -> Pretty sure it cannot be a filter if (!isAcceptedCandidate(track1)) { continue; } @@ -1428,20 +1323,6 @@ struct HfTaskFlow { } } - // Selections for MC GENERATED - if constexpr (std::is_same_v || std::is_same_v) { - // TODO: Check how to put this into a Filter -> Pretty sure it cannot be a filter - if (!isAcceptedMcCandidate(track1)) { - continue; - } - fillingHFcontainer = true; - if constexpr (std::is_same_v) { // If D0 - invmass = o2::constants::physics::MassD0; - } else { // If Lc - invmass = o2::constants::physics::MassLambdaCPlus; - } - } - // fill single-track distributions if (!fillingHFcontainer) { // if not HF-h case target->getTriggerHist()->Fill(step, pt1, multiplicity, posZ, triggerWeight); @@ -1451,81 +1332,124 @@ struct HfTaskFlow { // FILL QA PLOTS for trigger particle if (sameEvent && (step == CorrelationContainer::kCFStepReconstructed)) { - if (processMc == false) { // If DATA - if constexpr (!std::is_same_v) { // If not aod::MFTTracks as trigger -> TPC-FV0a correlations + if (configTask.processMc == false) { // If DATA + if constexpr (!std::is_same_v) { // If not FilteredMftTracks as trigger -> TPC-FV0a correlations if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-FV0a D0-h - fillTpcFv0aHfChSameEventCandidateQa(multiplicity, track1, true); + if constexpr (std::is_same_v) { // IF NEITHER D0 NOR LC -> + fillTriggerQa(multiplicity, eta1, phi1, pt1); + } else if constexpr (std::is_same_v) { + fillTriggerQa(multiplicity, eta1, phi1, pt1); + } } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-FV0a Lc-h - fillTpcFv0aHfChSameEventCandidateQa(multiplicity, track1, false); - } else { // IF NEITHER D0 NOR LC -> TPC-MFT h-h - fillTpcFv0aChChSameEventTriggerQa(multiplicity, track1); + if constexpr (std::is_same_v) { // IF NEITHER D0 NOR LC -> + fillTriggerQa(multiplicity, eta1, phi1, pt1); + } else if constexpr (std::is_same_v) { + fillTriggerQa(multiplicity, eta1, phi1, pt1); + } + } else if constexpr (std::is_same_v) { // IF NEITHER D0 NOR LC - + fillTriggerQa(multiplicity, eta1, phi1, pt1); + } else if constexpr (std::is_same_v) { + fillTriggerQa(multiplicity, eta1, phi1, pt1); + } + } else { // If FilteredMftTracks as trigger + if constexpr (std::is_same_v) { + fillTriggerQa(multiplicity, eta1, phi1, pt1); + } else if constexpr (std::is_same_v) { + fillTriggerQa(multiplicity, eta1, phi1, pt1); } - } else { // If aod::MFTTracks as trigger -> MFT-FV0a (non reassoc/ambiguous) correlations - fillMftFv0aChChSameEventQa(multiplicity, track1); - // registry.fill(HIST("Data/TpcMft/kCFStepAll/hEta"), eta2); - // registry.fill(HIST("Data/TpcMft/kCFStepAll/hPhi"), phi2); } } - //} else { // If MC (add cases later) - // if constexpr (!std::is_same_v) { // IF TPC-TPC case - // fillTpcTpcChChSameEventQaMc(multiplicity, track1); - // } } // end of if condition to fill QA plots for trigger particle - // - // ASSOCIATED PARTICLE - // - for (std::size_t indexChannel = 0; indexChannel < tracks2.channel().size(); indexChannel++) { + // ASSOCIATED PARTICLE IF USING FV0 + if constexpr (std::is_same_v) { + for (std::size_t indexChannel = 0; indexChannel < tracks2.channel().size(); indexChannel++) { - auto channelId = tracks2.channel()[indexChannel]; - // float fv0Amplitude = tracks2.amplitude()[indexChannel]; - // if (fv0Amplitude <= 0) { - // continue; - // } + auto channelId = tracks2.channel()[indexChannel]; + // float fv0Amplitude = tracks2.amplitude()[indexChannel]; + // if (fv0Amplitude <= 0) { + // continue; + // } - auto phi2 = getPhiFV0(channelId); - auto eta2 = getEtaFV0(channelId); + auto phi2 = getPhiFV0(channelId); + auto eta2 = getEtaFV0(channelId); - float deltaPhi = phi1 - phi2; - // set range of delta phi in (-pi/2 , 3/2*pi) - deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); + float deltaPhi = phi1 - phi2; + // set range of delta phi in (-pi/2 , 3/2*pi) + deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); - // IF EVERYTHING WORKS WITH THE REASSOCIATED MFT TRACKS, I WILL HAVE TO CHANGE HOW THOSE FUNCTIONS ARE FILLED TOO - if (!fillingHFcontainer) { - // fill pair correlations - target->getPairHist()->Fill(step, eta1 - eta2, pt1, pt1, multiplicity, deltaPhi, posZ, - triggerWeight * associatedWeight); - } else { - target->getPairHist()->Fill(step, eta1 - eta2, pt1, pt1, multiplicity, deltaPhi, posZ, invmass, - triggerWeight * associatedWeight); - } + if (!fillingHFcontainer) { + target->getPairHist()->Fill(step, eta1 - eta2, pt1, pt1, multiplicity, deltaPhi, posZ, + triggerWeight * associatedWeight); + } else { + target->getPairHist()->Fill(step, eta1 - eta2, pt1, pt1, multiplicity, deltaPhi, posZ, invmass, + triggerWeight * associatedWeight); + } - // FILL QA PLOTS for associated particle - if (sameEvent && (loopCounter == 1) && (step == CorrelationContainer::kCFStepReconstructed)) { - // if constexpr (std::is_same_v) { // If DATA - if constexpr (!std::is_same_v) { // If not aod::MFTTracks as trigger -> TPC-FV0a correlations - if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-FV0a D0-h - fillTpcFv0aHfChSameEventAssociatedQa(multiplicity, eta2, phi2, true); - } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-FV0a Lc-h - fillTpcFv0aHfChSameEventAssociatedQa(multiplicity, eta2, phi2, false); - } else { // IF NEITHER D0 NOR LC -> ch. part. - ch. part - fillFv0aQa(multiplicity, eta2, phi2, true); + // FILL QA PLOTS for associated particle + if (sameEvent && (loopCounter == 1) && (step == CorrelationContainer::kCFStepReconstructed)) { + if constexpr (!std::is_same_v) { // If not FilteredMftTracks as trigger -> TPC-FV0a correlations + if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-FV0a D0-h + fillAssociatedQa(multiplicity, eta2, phi2); + } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-FV0a Lc-h + fillAssociatedQa(multiplicity, eta2, phi2); + } else if constexpr (std::is_same_v) { // IF NEITHER D0 NOR LC -> ch. part. - ch. part + fillAssociatedQa(multiplicity, eta2, phi2); + } + } else { // If FilteredMftTracks as trigger -> MFT-FV0a (non reassoc/ambiguous) correlations + fillAssociatedQa(multiplicity, eta2, phi2); } - } else { // If aod::MFTTracks as trigger -> MFT-FV0a (non reassoc/ambiguous) correlations - fillFv0aQa(multiplicity, eta2, phi2, false); + } // end of if condition to fill QA plots for associated particle + } // end of loop over FV0 channel indices + } // end of if condition for FV0s + + // ASSOCIATED PARTICLE IF USING FT0 + if constexpr (std::is_same_v) { + for (std::size_t indexChannel = 0; indexChannel < tracks2.channelA().size(); indexChannel++) { + + auto channelId = tracks2.channelA()[indexChannel]; + // float fv0Amplitude = tracks2.amplitudeA()[indexChannel]; + // if (fv0Amplitude <= 0) { + // continue; + // } + + auto phi2 = getPhiFT0(channelId, 0); + auto eta2 = getEtaFT0(channelId, 0); + + float deltaPhi = phi1 - phi2; + // set range of delta phi in (-pi/2 , 3/2*pi) + deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); + + if (!fillingHFcontainer) { + target->getPairHist()->Fill(step, eta1 - eta2, pt1, pt1, multiplicity, deltaPhi, posZ, + triggerWeight * associatedWeight); + } else { + target->getPairHist()->Fill(step, eta1 - eta2, pt1, pt1, multiplicity, deltaPhi, posZ, invmass, + triggerWeight * associatedWeight); } - //} else { // If MC (add cases later) - // fillTpcTpcChChSameEventQaMc(multiplicityTracks2, vz, tracks1); - //} - } // end of if condition to fill QA plots for associated particle - } // end of loop over FV0 channel indices + // FILL QA PLOTS for associated particle + if (sameEvent && (loopCounter == 1) && (step == CorrelationContainer::kCFStepReconstructed)) { + if constexpr (!std::is_same_v) { // If not FilteredMftTracks as trigger -> TPC-Ft0a correlations + if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-FV0a D0-h + fillAssociatedQa(multiplicity, eta2, phi2); + } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-FV0a Lc-h + fillAssociatedQa(multiplicity, eta2, phi2); + } else if constexpr (std::is_same_v) { // IF NEITHER D0 NOR LC -> ch. part. - ch. part + fillAssociatedQa(multiplicity, eta2, phi2); + } + } else if constexpr (std::is_same_v) { // If FilteredMftTracks as trigger -> MFT-Ft0a (non reassoc/ambiguous) correlations + fillAssociatedQa(multiplicity, eta2, phi2); + } + } // end of if condition to fill QA plots for associated particle + } // end of loop over FT0 channel indices + } // end of if condition for FT0s } // end of loop over tracks 1 } - template - void fillCorrelationsFV0ReassociatedMftTracks(TTarget target, CorrelationContainer::CFStep step, - TTracksTrig const& tracks1, TTracksAssoc const& tracks2, + template + void fillCorrelationsFITReassociatedMftTracks(TTarget target, CorrelationContainer::CFStep step, + TTracksTrig const& tracks1, TTracksAssoc const& tracks2, TFits const&, float multiplicity, float posZ, bool sameEvent, bool cutAmbiguousTracks) { auto triggerWeight = 1; @@ -1535,31 +1459,16 @@ struct HfTaskFlow { // I fill it only for the first trigger track of the collision auto loopCounter = 0; - // // TRIGGER PARTICLE - // for (auto const& track1 : tracks1) { loopCounter++; - // TO-DO (if useful) : adapt this but or Mft-FV0a - // Fill QA plot for all MFT tracks () (only if cutAmbiguousTracks is false to avoid double counting) - // if (!cutAmbiguousTracks && sameEvent && (loopCounter == 1)) { - // registry.fill(HIST("Data/TpcMft/hAmbiguityOfMftTracks"), MftTrackAmbiguityStep::AllMftTracks); - //} - - auto reassociatedMftTrack = track1.template mfttrack_as(); + auto reassociatedMftTrack = track1.template mfttrack_as(); if (!isAcceptedMftTrack(reassociatedMftTrack, false)) { continue; } - // TO-DO (if useful) : adapt this but or Mft-FV0a - // Fill QA plot for MFT tracks after physical selection (eta + clusters) - // if (!cutAmbiguousTracks && sameEvent && (loopCounter == 1)) { - // registry.fill(HIST("Data/TpcMft/hAmbiguityOfMftTracks"), MftTrackAmbiguityStep::AfterTrackSelection); - // registry.fill(HIST("Data/TpcMft/hReassociationMftTracks"), ReassociationMftTracks::NotReassociatedMftTracks); - //} - // We check if the track is ambiguous or non-ambiguous (QA plots are filled in isAmbiguousMftTrack) // Fill plots only if cutAmbiguousTracks is false (to avoid double counting) if (isAmbiguousMftTrack(track1, false)) { @@ -1569,55 +1478,75 @@ struct HfTaskFlow { } } - // if (reassociatedMftTrack.collisionId() != track2.bestCollisionId()) { - // if (sameEvent && (loopCounter == 1)) { - // registry.fill(HIST("Data/TpcMft/hReassociationMftTracks"), ReassociationMftTracks::ReassociatedMftTracks); - // } - // } - float eta1 = reassociatedMftTrack.eta(); float pt1 = reassociatedMftTrack.pt(); float phi1 = reassociatedMftTrack.phi(); o2::math_utils::bringTo02Pi(phi1); - // TODO: add getter for NUE trigger efficiency here - target->getTriggerHist()->Fill(step, pt1, multiplicity, posZ, triggerWeight); // FILL QA PLOTS for trigger particle if (sameEvent && (step == CorrelationContainer::kCFStepReconstructed)) { - if (processMc == false) { // If DATA - fillMftFv0aChChSameEventQa(multiplicity, reassociatedMftTrack); + if constexpr (std::is_same_v) { + fillTriggerQa(multiplicity, eta1, phi1, pt1); + } else if constexpr (std::is_same_v) { + fillTriggerQa(multiplicity, eta1, phi1, pt1); } } // end of if condition to fill QA plots for trigger particle - // - // ASSOCIATED PARTICLE - // - for (std::size_t indexChannel = 0; indexChannel < tracks2.channel().size(); indexChannel++) { + // ASSOCIATED PARTICLE FOR FV0s + if constexpr (std::is_same_v) { + for (std::size_t indexChannel = 0; indexChannel < tracks2.channel().size(); indexChannel++) { - auto channelId = tracks2.channel()[indexChannel]; - // float fv0Amplitude = tracks2.amplitude()[indexChannel]; - // if (fv0Amplitude <= 0) { - // continue; - // } + auto channelId = tracks2.channel()[indexChannel]; + // float fv0Amplitude = tracks2.amplitude()[indexChannel]; + // if (fv0Amplitude <= 0) { + // continue; + // } - auto phi2 = getPhiFV0(channelId); - auto eta2 = getEtaFV0(channelId); + auto phi2 = getPhiFV0(channelId); + auto eta2 = getEtaFV0(channelId); - float deltaPhi = phi1 - phi2; - // set range of delta phi in (-pi/2 , 3/2*pi) - deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); + float deltaPhi = phi1 - phi2; + // set range of delta phi in (-pi/2 , 3/2*pi) + deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); + + target->getPairHist()->Fill(step, eta1 - eta2, pt1, pt1, multiplicity, deltaPhi, posZ, + triggerWeight * associatedWeight); - target->getPairHist()->Fill(step, eta1 - eta2, pt1, pt1, multiplicity, deltaPhi, posZ, - triggerWeight * associatedWeight); + // FILL QA PLOTS for associated particle + if (sameEvent && (loopCounter == 1) && (step == CorrelationContainer::kCFStepReconstructed)) { + fillAssociatedQa(multiplicity, eta2, phi2); + } // end of if condition to fill QA plots for associated particle + } // end of loop over FV0 channel indices + } // end of if condition for FV0s - // FILL QA PLOTS for associated particle - if (sameEvent && (loopCounter == 1) && (step == CorrelationContainer::kCFStepReconstructed)) { - fillFv0aQa(multiplicity, eta2, phi2, false); - } // end of if condition to fill QA plots for associated particle + // ASSOCIATED PARTICLE FOR FT0s + if constexpr (std::is_same_v) { + for (std::size_t indexChannel = 0; indexChannel < tracks2.channelA().size(); indexChannel++) { - } // end of loop over FV0 channel indices + auto channelId = tracks2.channelA()[indexChannel]; + // float ft0Amplitude = tracks2.amplitudeA()[indexChannel]; + // if (ft0Amplitude <= 0) { + // continue; + // } + + auto phi2 = getPhiFT0(channelId, 0); + auto eta2 = getEtaFT0(channelId, 0); + + float deltaPhi = phi1 - phi2; + // set range of delta phi in (-pi/2 , 3/2*pi) + deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); + + target->getPairHist()->Fill(step, eta1 - eta2, pt1, pt1, multiplicity, deltaPhi, posZ, + triggerWeight * associatedWeight); + + // FILL QA PLOTS for associated particle + if (sameEvent && (loopCounter == 1) && (step == CorrelationContainer::kCFStepReconstructed)) { + fillAssociatedQa(multiplicity, eta2, phi2); + } // end of if condition to fill QA plots for associated particle + } // end of loop over FT0 channel indices + } // end of if condition for FT0s } // end of loop over tracks 1 } @@ -1625,18 +1554,22 @@ struct HfTaskFlow { // mixCollisions for RECONSTRUCTED events // =============================================================================================================================================================================== - template + template void mixCollisions(TCollisions const& collisions, CorrelationContainer::CFStep step, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, - TLambda getPartsSize, OutputObj& corrContainer) { + auto getMultiplicity = [this](FilteredCollisionsWSelMult::iterator const& collision) { + auto multiplicity = getMultiplicityEstimator(collision, false); + return multiplicity; + }; + // The first one that I call "Data" should work for data and mc rec - using BinningTypeData = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getPartsSize)>; + using BinningTypeData = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getMultiplicity)>; - BinningTypeData binningWithTracksSize{{getPartsSize}, {binsMixingVertex, binsMixingMultiplicity}, true}; + BinningTypeData binningWithTracksSize{{getMultiplicity}, {binsMixingVertex, binsMixingMultiplicity}, true}; auto tracksTuple = std::make_tuple(tracks1, tracks2); - Pair pair{binningWithTracksSize, nMixedEvents, -1, collisions, tracksTuple, &cache}; + Pair pair{binningWithTracksSize, configTask.nMixedEvents, -1, collisions, tracksTuple, &cache}; for (const auto& [collision1, tracks1, collision2, tracks2] : pair) { @@ -1649,34 +1582,62 @@ struct HfTaskFlow { } } - // auto binningValues = binningWithTracksSize.getBinningValues(collision1, collisions); - // int bin = binningWithTracksSize.getBin(binningValues); + const auto multiplicity = getMultiplicityEstimator(collision1, false); + + corrContainer->fillEvent(multiplicity, step); + fillCorrelations(corrContainer, step, tracks1, tracks2, multiplicity, collision1.posZ(), false); + } + } - const auto multiplicityTracks1 = getPartsSize(collision1); + template + void mixCollisionsFIT(TCollisions const& collisions, CorrelationContainer::CFStep step, + TTracksTrig const& tracks1, TTracksAssoc const& tracks2, TPreslice const& preslice, + OutputObj& corrContainer) + { + auto getMultiplicity = [this](FilteredCollisionsWSelMult::iterator const& collision) { + auto multiplicity = getMultiplicityEstimator(collision, false); + return multiplicity; + }; - /* - if constexpr (std::is_same_v) { // If MC - registry.fill(HIST("MC/Rec/TpcTpc/ChPartChPart/MixedEvent/hEventCountMixing"), bin); - } else { // If not MC - if constexpr (std::is_same_v) { // IF TPC-MFT case - if constexpr (std::is_same_v || std::is_same_v) { // IF HF-h case -> TPC-MFT HF-h - registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hEventCountMixing"), bin); - } else { // IF h-h case -> TPC-MFT h-h case - registry.fill(HIST("Data/TpcMft/ChPartChPart/MixedEvent/hEventCountMixing"), bin); - } - } else { // IF TPC-TPC case - if constexpr (std::is_same_v || std::is_same_v) { // IF HF-h case -> TPC-TPC HF-h - registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hEventCountHFMixing"), bin); - } else { // IF h-h case -> TPC-TPC h-h case - registry.fill(HIST("Data/TpcTpc/ChPartChPart/MixedEvent/hEventCountMixing"), bin); - } - } // end of if condition for TPC-TPC or TPC-MFT case + using MixedBinning = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getMultiplicity)>; + MixedBinning binningOnVtxAndMult{{getMultiplicity}, {binsMixingVertex, binsMixingMultiplicity}, true}; + + for (auto const& [collision1, collision2] : soa::selfCombinations(binningOnVtxAndMult, configTask.nMixedEvents, -1, collisions, collisions)) { + + if (!isAcceptedCollision(collision1) || !isAcceptedCollision(collision2)) { + continue; } - */ - corrContainer->fillEvent(multiplicityTracks1, step); - fillCorrelations(corrContainer, step, tracks1, tracks2, multiplicityTracks1, collision1.posZ(), false); - } + if (collision1.globalIndex() == collision2.globalIndex()) { + continue; + } + + if constexpr (std::is_same_v) { // IF ASSOCIATED PARTICLE FROM FV0A + if (collision1.has_foundFV0() && collision2.has_foundFV0()) { + + const auto multiplicity = getMultiplicityEstimator(collision1, false); + + auto slicedTriggerTracks = tracks1.sliceBy(preslice, collision1.globalIndex()); + const auto& fv0 = collision2.foundFV0(); + + corrContainer->fillEvent(multiplicity, step); + fillCorrelationsFIT(corrContainer, step, slicedTriggerTracks, fv0, tracks2, multiplicity, collision1.posZ(), false); + } + } // end of if condition for FV0s + + if constexpr (std::is_same_v) { + if (collision1.has_foundFT0() && collision2.has_foundFT0()) { + + const auto multiplicity = getMultiplicityEstimator(collision1, false); + + auto slicedTriggerTracks = tracks1.sliceBy(preslice, collision1.globalIndex()); + const auto& ft0 = collision2.foundFT0(); + + corrContainer->fillEvent(multiplicity, step); + fillCorrelationsFIT(corrContainer, step, slicedTriggerTracks, ft0, tracks2, multiplicity, collision1.posZ(), false); + } + } // end of if condition for FT0s + } // end of for loop } /* @@ -1693,7 +1654,7 @@ struct HfTaskFlow { BinningTypeData binningWithTracksSize{{getPartsSize}, {binsMixingVertex, binsMixingMultiplicity}, true}; auto tracksTuple = std::make_tuple(tracks1, tracks2); - Pair pair{binningWithTracksSize, nMixedEvents, -1, collisions, tracksTuple, &cache}; + Pair pair{binningWithTracksSize, configTask.nMixedEvents, -1, collisions, tracksTuple, &cache}; for (const auto& [collision1, tracks1, collision2, tracks2] : pair) { @@ -1706,34 +1667,10 @@ struct HfTaskFlow { } } - auto binningValues = binningWithTracksSize.getBinningValues(collision1, collisions); - int bin = binningWithTracksSize.getBin(binningValues); - - const auto multiplicityTracks1 = getPartsSize(collision1); - - - - if constexpr (std::is_same_v) { // If MC - registry.fill(HIST("MC/Rec/TpcTpc/ChPartChPart/MixedEvent/hEventCountMixing"), bin); - } else { // If not MC - if constexpr (std::is_same_v) { // IF TPC-MFT case - if constexpr (std::is_same_v || std::is_same_v) { // IF HF-h case -> TPC-MFT HF-h - registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hEventCountMixing"), bin); - } else { // IF h-h case -> TPC-MFT h-h case - registry.fill(HIST("Data/TpcMft/ChPartChPart/MixedEvent/hEventCountMixing"), bin); - } - } else { // IF TPC-TPC case - if constexpr (std::is_same_v || std::is_same_v) { // IF HF-h case -> TPC-TPC HF-h - registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hEventCountHFMixing"), bin); - } else { // IF h-h case -> TPC-TPC h-h case - registry.fill(HIST("Data/TpcTpc/ChPartChPart/MixedEvent/hEventCountMixing"), bin); - } - } // end of if condition for TPC-TPC or TPC-MFT case - } - + const auto multiplicity = collision1.multNTracksPV(); - corrContainer->fillEvent(multiplicityTracks1, step); - fillCorrelationsReassociatedMftTracks(corrContainer, step, tracks1, tracks2, multiplicityTracks1, collision1.posZ(), false, cutAmbiguousTracks, field ); + corrContainer->fillEvent(multiplicity, step); + fillCorrelationsReassociatedMftTracks(corrContainer, step, tracks1, tracks2, true, multiplicity, collision1.posZ(), false, cutAmbiguousTracks, field ); } } */ @@ -1751,18 +1688,11 @@ struct HfTaskFlow { BinningTypeMcTruth binningWithTracksSize{{getPartsSize}, {binsMixingVertex, binsMixingMultiplicity}, true}; auto tracksTuple = std::make_tuple(tracks1, tracks2); - Pair pair{binningWithTracksSize, nMixedEvents, -1, mcCollisions, tracksTuple, &cache}; + Pair pair{binningWithTracksSize, configTask.nMixedEvents, -1, mcCollisions, tracksTuple, &cache}; for (const auto& [collision1, tracks1, collision2, tracks2] : pair) { - // auto binningValues = binningWithTracksSize.getBinningValues(collision1, mcCollisions); - // int bin = binningWithTracksSize.getBin(binningValues); - - const auto multiplicity = getPartsSize(collision1); // get multiplicity of charged hadrons, which is used for slicing in mixing - - // TO BE DONE : ADD ONE MORE IF CONDITION TO FILL THE MC CASE - // TODO : FILL NEW PLOTS FOR MCTRUTH ONLY - // registry.fill(HIST("MC/Gen/TpcTpc/ChPartChPart/MixedEvent/hEventCountMixing"), bin); + const auto multiplicity = collision1.multMCPVz(); corrContainer->fillEvent(multiplicity, CorrelationContainer::kCFStepAll); fillCorrelations(corrContainer, CorrelationContainer::CFStep::kCFStepAll, tracks1, tracks2, multiplicity, collision1.posZ(), false); @@ -1795,13 +1725,8 @@ struct HfTaskFlow { // options are ran at the same time // temporary solution, since other correlation options always have to be ran with h-h, too // TODO: rewrite it in a more intelligent way - const auto multiplicity = collision.multNTracksPV(); - // registry.fill(HIST("Data/TpcTpc/ChPartChPart/SameEvent/hMultiplicity"), multiplicity); - // registry.fill(HIST("Data/TpcTpc/ChPartChPart/SameEvent/hVtxZ"), collision.posZ()); - - BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; - // int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); - // registry.fill(HIST("Data/TpcTpc/ChPartChPart/SameEvent/hEventCountSame"), bin); + const auto multiplicity = getMultiplicityEstimator(collision, true); + // registry.fill(HIST(Form("Data/hMultiplicity_%s", WhatMultiplicityEstimator[HfTaskFlow::configCollision.multiplicityEstimator].data())), multiplicity); sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); fillCorrelations(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, tracks, multiplicity, collision.posZ(), true); @@ -1819,17 +1744,14 @@ struct HfTaskFlow { auto fillEventSelectionPlots = true; // When doing reference flow, two cases are used (HF-h, h-h) and thus eventSelectionPlots was filled twice - if (doReferenceFlow) + if (configTask.doReferenceFlow) fillEventSelectionPlots = false; if (!(isAcceptedCollision(collision, fillEventSelectionPlots))) { return; } - const auto multiplicity = collision.multNTracksPV(); - BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; - // int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); - // registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hEventCountSame"), bin); + const auto multiplicity = getMultiplicityEstimator(collision, true); sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); fillCorrelations(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, tracks, multiplicity, collision.posZ(), true); @@ -1847,17 +1769,14 @@ struct HfTaskFlow { auto fillEventSelectionPlots = true; // When doing reference flow, two cases are used (HF-h, h-h) and thus eventSelectionPlots was filled twice - if (doReferenceFlow) + if (configTask.doReferenceFlow) fillEventSelectionPlots = false; if (!(isAcceptedCollision(collision, fillEventSelectionPlots))) { return; } - const auto multiplicity = collision.multNTracksPV(); - BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; - // int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); - // registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hEventCountSame"), bin); + const auto multiplicity = getMultiplicityEstimator(collision, true); sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); fillCorrelations(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, tracks, multiplicity, collision.posZ(), true); @@ -1870,16 +1789,13 @@ struct HfTaskFlow { void processSameTpcMftChCh(FilteredCollisionsWSelMult::iterator const& collision, FilteredTracksWDcaSel const& tracks, - aod::MFTTracks const& mftTracks) + FilteredMftTracks const& mftTracks) { if (!(isAcceptedCollision(collision, true))) { return; } - const auto multiplicity = collision.multNTracksPV(); - BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; - // int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); - // registry.fill(HIST("Data/TpcMft/ChPartChPart/SameEvent/hEventCountSame"), bin); + const auto multiplicity = getMultiplicityEstimator(collision, true); // I use kCFStepAll for running my code with all MFTTracks were the reassociation process was not applied // We don't fill "normal" QA plots with these tracks, only specific plots to compare with other type of MFTTracks @@ -1891,20 +1807,18 @@ struct HfTaskFlow { void processSameTpcMftChChReassociated(FilteredCollisionsWSelMult::iterator const& collision, soa::SmallGroups const& reassociatedMftTracks, FilteredTracksWDcaSel const& tracks, - aod::MFTTracks const& mftTracks) + FilteredMftTracks const& mftTracks) { if (!(isAcceptedCollision(collision, true))) { return; } - registry.fill(HIST("Data/TpcMft/hNTracks"), tracks.size()); - registry.fill(HIST("Data/TpcMft/hNMftTracks"), mftTracks.size()); - registry.fill(HIST("Data/TpcMft/hNBestCollisionFwd"), reassociatedMftTracks.size()); + registry.fill(HIST("Data/Mft/hNTracks"), tracks.size()); + registry.fill(HIST("Data/Mft/hNMftTracks"), mftTracks.size()); + registry.fill(HIST("Data/Mft/hNBestCollisionFwd"), reassociatedMftTracks.size()); - const auto multiplicity = collision.multNTracksPV(); - BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; - // int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); - // registry.fill(HIST("Data/TpcMft/ChPartChPart/SameEvent/hEventCountSame"), bin); + // const auto multiplicity = collision.multNTracksPV(); + const auto multiplicity = getMultiplicityEstimator(collision, true); // I use the step kCFStepReconstructed for reassociatedMftTracks (most likely the ones we will use in the end) sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); @@ -1912,23 +1826,44 @@ struct HfTaskFlow { } PROCESS_SWITCH(HfTaskFlow, processSameTpcMftChChReassociated, "DATA : Process same-event correlations for TPC-MFT h-h case reassociated", false); + /* + void processSameTpcMftChChReassociated3d(FilteredCollisionsWSelMult::iterator const& collision, + soa::SmallGroups const& reassociatedMftTracks, + FilteredTracksWDcaSel const& tracks, + FilteredMftTracks const& mftTracks) + { + if (!(isAcceptedCollision(collision, true))) { + return; + } + + registry.fill(HIST("Data/Mft/hNTracks"), tracks.size()); + registry.fill(HIST("Data/Mft/hNMftTracks"), mftTracks.size()); + registry.fill(HIST("Data/Mft/hNBestCollisionFwd"), reassociatedMftTracks.size()); + + // const auto multiplicity = collision.multNTracksPV(); + const auto multiplicity = getMultiplicityEstimator(collision, true); + + // I use the step kCFStepReconstructed for reassociatedMftTracks (most likely the ones we will use in the end) + sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelationsReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, reassociatedMftTracks, multiplicity, collision.posZ(), true, false); + } + PROCESS_SWITCH(HfTaskFlow, processSameTpcMftChChReassociated3d, "DATA : Process same-event correlations for TPC-MFT h-h case 3d reassociated", false); + */ + void processSameTpcMftChChNonAmbiguous(FilteredCollisionsWSelMult::iterator const& collision, soa::SmallGroups const& reassociatedMftTracks, FilteredTracksWDcaSel const& tracks, - aod::MFTTracks const& mftTracks) + FilteredMftTracks const& mftTracks) { if (!(isAcceptedCollision(collision, true))) { return; // when process function has iterator } - registry.fill(HIST("Data/TpcMft/hNTracks"), tracks.size()); - registry.fill(HIST("Data/TpcMft/hNMftTracks"), mftTracks.size()); - registry.fill(HIST("Data/TpcMft/hNBestCollisionFwd"), reassociatedMftTracks.size()); + registry.fill(HIST("Data/Mft/hNTracks"), tracks.size()); + registry.fill(HIST("Data/Mft/hNMftTracks"), mftTracks.size()); + registry.fill(HIST("Data/Mft/hNBestCollisionFwd"), reassociatedMftTracks.size()); - const auto multiplicity = collision.multNTracksPV(); - BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; - // int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); - // registry.fill(HIST("Data/TpcMft/ChPartChPart/SameEvent/hEventCountSame"), bin); + const auto multiplicity = getMultiplicityEstimator(collision, true); // I use kCFStepTracked for running my code with only non-ambiguous MFTTracks // This is the same as running with reassociatedMftTracks, but applying one more cut in the fillCorrelations function @@ -1945,22 +1880,19 @@ struct HfTaskFlow { void processSameTpcMftD0Ch(FilteredCollisionsWSelMult::iterator const& collision, HfCandidatesSelD0 const& candidates, FilteredTracksWDcaSel const& /*tracks*/, - aod::MFTTracks const& mftTracks) + FilteredMftTracks const& mftTracks) { auto fillEventSelectionPlots = true; // When doing reference flow, two cases are used (HF-h, h-h) and thus eventSelectionPlots was filled twice - if (doReferenceFlow) + if (configTask.doReferenceFlow) fillEventSelectionPlots = false; if (!(isAcceptedCollision(collision, fillEventSelectionPlots))) { return; } - const auto multiplicity = collision.multNTracksPV(); - BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; - // int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); - // registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hEventCountSame"), bin); + const auto multiplicity = getMultiplicityEstimator(collision, true); sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); fillCorrelations(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, mftTracks, multiplicity, collision.posZ(), true); @@ -1970,13 +1902,13 @@ struct HfTaskFlow { void processSameTpcMftD0ChReassociated(FilteredCollisionsWSelMult::iterator const& collision, HfCandidatesSelD0 const& candidates, soa::SmallGroups const& reassociatedMftTracks, - aod::MFTTracks const&) + FilteredMftTracks const&) { if (!(isAcceptedCollision(collision, true))) { return; // when process function has iterator } - const auto multiplicity = collision.multNTracksPV(); + const auto multiplicity = getMultiplicityEstimator(collision, true); // I use the step kCFStepReconstructed for reassociatedMftTracks (most likely the ones we will use in the end) sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); @@ -1991,22 +1923,19 @@ struct HfTaskFlow { void processSameTpcMftLcCh(FilteredCollisionsWSelMult::iterator const& collision, HfCandidatesSelLc const& candidates, FilteredTracksWDcaSel const& /*tracks*/, - aod::MFTTracks const& mftTracks) + FilteredMftTracks const& mftTracks) { auto fillEventSelectionPlots = true; // When doing reference flow, two cases are used (HF-h, h-h) and thus eventSelectionPlots was filled twice - if (doReferenceFlow) + if (configTask.doReferenceFlow) fillEventSelectionPlots = false; if (!(isAcceptedCollision(collision, fillEventSelectionPlots))) { return; } - const auto multiplicity = collision.multNTracksPV(); - BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; - // int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); - // registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hEventCountSame"), bin); + const auto multiplicity = getMultiplicityEstimator(collision, true); sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); fillCorrelations(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, mftTracks, multiplicity, collision.posZ(), true); @@ -2016,16 +1945,13 @@ struct HfTaskFlow { void processSameTpcMftLcChReassociated(FilteredCollisionsWSelMult::iterator const& collision, HfCandidatesSelLc const& candidates, soa::SmallGroups const& reassociatedMftTracks, - aod::MFTTracks const&) + FilteredMftTracks const&) { if (!(isAcceptedCollision(collision, true))) { return; // when process function has iterator } - const auto multiplicity = collision.multNTracksPV(); - BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; - // int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); - // registry.fill(HIST("Data/TpcMft/ChPartChPart/SameEvent/hEventCountSame"), bin); + const auto multiplicity = getMultiplicityEstimator(collision, true); // I use the step kCFStepReconstructed for reassociatedMftTracks (most likely the ones we will use in the end) sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); @@ -2039,19 +1965,19 @@ struct HfTaskFlow { void processSameTpcFv0aChCh(FilteredCollisionsWSelMult::iterator const& collision, FilteredTracksWDcaSel const& tracks, - aod::FV0As const&) + aod::FV0As const& fv0as) { if (!(isAcceptedCollision(collision, true))) { return; } - const auto multiplicity = collision.multNTracksPV(); + const auto multiplicity = getMultiplicityEstimator(collision, true); if (collision.has_foundFV0()) { const auto& fv0 = collision.foundFV0(); sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelationsFV0(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, fv0, multiplicity, collision.posZ(), true); + fillCorrelationsFIT(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, fv0, fv0as, multiplicity, collision.posZ(), true); } } PROCESS_SWITCH(HfTaskFlow, processSameTpcFv0aChCh, "DATA : Process same-event correlations for TPC-FV0-A h-h case", false); @@ -2062,19 +1988,19 @@ struct HfTaskFlow { void processSameTpcFv0aD0Ch(FilteredCollisionsWSelMult::iterator const& collision, HfCandidatesSelD0 const& candidates, - aod::FV0As const&) + aod::FV0As const& fv0as) { if (!(isAcceptedCollision(collision, true))) { return; } - const auto multiplicity = collision.multNTracksPV(); + const auto multiplicity = getMultiplicityEstimator(collision, true); if (collision.has_foundFV0()) { const auto& fv0 = collision.foundFV0(); sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelationsFV0(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, fv0, multiplicity, collision.posZ(), true); + fillCorrelationsFIT(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, fv0, fv0as, multiplicity, collision.posZ(), true); } } PROCESS_SWITCH(HfTaskFlow, processSameTpcFv0aD0Ch, "DATA : Process same-event correlations for TPC-FV0-A D0-h case", false); @@ -2085,19 +2011,19 @@ struct HfTaskFlow { void processSameTpcFv0aLcCh(FilteredCollisionsWSelMult::iterator const& collision, HfCandidatesSelLc const& candidates, - aod::FV0As const&) + aod::FV0As const& fv0as) { if (!(isAcceptedCollision(collision, true))) { return; } - const auto multiplicity = collision.multNTracksPV(); + const auto multiplicity = getMultiplicityEstimator(collision, true); if (collision.has_foundFV0()) { const auto& fv0 = collision.foundFV0(); sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelationsFV0(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, fv0, multiplicity, collision.posZ(), true); + fillCorrelationsFIT(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, fv0, fv0as, multiplicity, collision.posZ(), true); } } PROCESS_SWITCH(HfTaskFlow, processSameTpcFv0aLcCh, "DATA : Process same-event correlations for TPC-FV0-A Lc-h case", false); @@ -2107,64 +2033,218 @@ struct HfTaskFlow { // ===================================== void processSameMftFv0aChCh(FilteredCollisionsWSelMult::iterator const& collision, - aod::MFTTracks const& mftTracks, - aod::FV0As const&) + FilteredMftTracks const& mftTracks, + aod::FV0As const& fv0as) { if (!(isAcceptedCollision(collision, true))) { return; } - const auto multiplicity = collision.multNTracksPV(); + const auto multiplicity = getMultiplicityEstimator(collision, true); if (collision.has_foundFV0()) { const auto& fv0 = collision.foundFV0(); sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelationsFV0(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, mftTracks, fv0, multiplicity, collision.posZ(), true); + fillCorrelationsFIT(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, mftTracks, fv0, fv0as, multiplicity, collision.posZ(), true); } } PROCESS_SWITCH(HfTaskFlow, processSameMftFv0aChCh, "DATA : Process same-event correlations for MFT-FV0-A h-h case", false); void processSameMftFv0aChChReassociated(FilteredCollisionsWSelMult::iterator const& collision, soa::SmallGroups const& reassociatedMftTracks, - aod::MFTTracks const& /*mftTracks*/, - aod::FV0As const&) + FilteredMftTracks const&, + aod::FV0As const& fv0as) { if (!(isAcceptedCollision(collision, true))) { return; } - const auto multiplicity = collision.multNTracksPV(); + const auto multiplicity = getMultiplicityEstimator(collision, true); if (collision.has_foundFV0()) { const auto& fv0 = collision.foundFV0(); sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelationsFV0ReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, reassociatedMftTracks, fv0, multiplicity, collision.posZ(), true, false); + fillCorrelationsFITReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, reassociatedMftTracks, fv0, fv0as, multiplicity, collision.posZ(), true, false); } } PROCESS_SWITCH(HfTaskFlow, processSameMftFv0aChChReassociated, "DATA : Process same-event correlations for MFT-FV0a h-h case reassociated", false); + /* + void processSameMftFv0aChChReassociated3d(FilteredCollisionsWSelMult::iterator const& collision, + soa::SmallGroups const& reassociatedMftTracks, + FilteredMftTracks const&, + aod::FV0As const& fv0as) + { + if (!(isAcceptedCollision(collision, true))) { + return; + } + + const auto multiplicity = getMultiplicityEstimator(collision, true); + + if (collision.has_foundFV0()) { + const auto& fv0 = collision.foundFV0(); + + sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelationsFITReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, reassociatedMftTracks, fv0, fv0as, multiplicity, collision.posZ(), true, false); + } + } + PROCESS_SWITCH(HfTaskFlow, processSameMftFv0aChChReassociated3d, "DATA : Process same-event correlations for MFT-FV0a h-h case 3d reassociated", false); + */ + void processSameMftFv0aChChNonAmbiguous(FilteredCollisionsWSelMult::iterator const& collision, soa::SmallGroups const& reassociatedMftTracks, - aod::MFTTracks const& /*mftTracks*/, - aod::FV0As const&) + FilteredMftTracks const&, + aod::FV0As const& fv0as) { if (!(isAcceptedCollision(collision, true))) { return; } - const auto multiplicity = collision.multNTracksPV(); + const auto multiplicity = getMultiplicityEstimator(collision, true); if (collision.has_foundFV0()) { const auto& fv0 = collision.foundFV0(); sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelationsFV0ReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, reassociatedMftTracks, fv0, multiplicity, collision.posZ(), true, true); + fillCorrelationsFITReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, reassociatedMftTracks, fv0, fv0as, multiplicity, collision.posZ(), true, true); } } PROCESS_SWITCH(HfTaskFlow, processSameMftFv0aChChNonAmbiguous, "DATA : Process same-event correlations for MFT-FV0a h-h non-ambiguous case", false); + // ===================================== + // DATA : process same event correlations: TPC-FT0A Ch. Part. - Ch. Part + // ===================================== + + void processSameTpcFt0aChCh(FilteredCollisionsWSelMult::iterator const& collision, + FilteredTracksWDcaSel const& tracks, + aod::FT0s const& ft0as) + { + if (!(isAcceptedCollision(collision, true))) { + return; + } + + const auto multiplicity = getMultiplicityEstimator(collision, true); + + if (collision.has_foundFT0()) { + const auto& ft0 = collision.foundFT0(); + + sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelationsFIT(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, ft0, ft0as, multiplicity, collision.posZ(), true); + } + } + PROCESS_SWITCH(HfTaskFlow, processSameTpcFt0aChCh, "DATA : Process same-event correlations for TPC-FT0-A h-h case", false); + + // ===================================== + // DATA : process same event correlations: TPC-FT0A Ch. Part. - Ch. Part + // ===================================== + + void processSameTpcFt0aD0Ch(FilteredCollisionsWSelMult::iterator const& collision, + HfCandidatesSelD0 const& candidates, + aod::FT0s const& ft0as) + { + if (!(isAcceptedCollision(collision, true))) { + return; + } + + const auto multiplicity = getMultiplicityEstimator(collision, true); + + if (collision.has_foundFT0()) { + const auto& ft0 = collision.foundFT0(); + + sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelationsFIT(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, ft0, ft0as, multiplicity, collision.posZ(), true); + } + } + PROCESS_SWITCH(HfTaskFlow, processSameTpcFt0aD0Ch, "DATA : Process same-event correlations for TPC-FT0-A D0-h case", false); + + // ===================================== + // DATA : process same event correlations: TPC-FT0A Ch. Part. - Ch. Part + // ===================================== + + void processSameTpcFt0aLcCh(FilteredCollisionsWSelMult::iterator const& collision, + HfCandidatesSelLc const& candidates, + aod::FT0s const& ft0as) + { + if (!(isAcceptedCollision(collision, true))) { + return; + } + + const auto multiplicity = getMultiplicityEstimator(collision, true); + + if (collision.has_foundFT0()) { + const auto& ft0 = collision.foundFT0(); + + sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelationsFIT(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, ft0, ft0as, multiplicity, collision.posZ(), true); + } + } + PROCESS_SWITCH(HfTaskFlow, processSameTpcFt0aLcCh, "DATA : Process same-event correlations for TPC-FT0-A Lc-h case", false); + + // ===================================== + // DATA : process same event correlations: TPC-FT0A Ch. Part. - Ch. Part + // ===================================== + + void processSameMftFt0aChCh(FilteredCollisionsWSelMult::iterator const& collision, + FilteredMftTracks const& mftTracks, + aod::FT0s const& ft0as) + { + if (!(isAcceptedCollision(collision, true))) { + return; + } + + const auto multiplicity = getMultiplicityEstimator(collision, true); + + if (collision.has_foundFT0()) { + const auto& ft0 = collision.foundFT0(); + + sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelationsFIT(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, mftTracks, ft0, ft0as, multiplicity, collision.posZ(), true); + } + } + PROCESS_SWITCH(HfTaskFlow, processSameMftFt0aChCh, "DATA : Process same-event correlations for MFT-FT0-A h-h case", false); + + void processSameMftFt0aChChReassociated(FilteredCollisionsWSelMult::iterator const& collision, + soa::SmallGroups const& reassociatedMftTracks, + FilteredMftTracks const&, + aod::FT0s const& ft0as) + { + if (!(isAcceptedCollision(collision, true))) { + return; + } + + const auto multiplicity = getMultiplicityEstimator(collision, true); + + if (collision.has_foundFT0()) { + const auto& ft0 = collision.foundFT0(); + + sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelationsFITReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, reassociatedMftTracks, ft0, ft0as, multiplicity, collision.posZ(), true, false); + } + } + PROCESS_SWITCH(HfTaskFlow, processSameMftFt0aChChReassociated, "DATA : Process same-event correlations for MFT-FT0-A h-h case reassociated", false); + + void processSameMftFt0aChChNonAmbiguous(FilteredCollisionsWSelMult::iterator const& collision, + soa::SmallGroups const& reassociatedMftTracks, + FilteredMftTracks const&, + aod::FT0s const& ft0as) + { + if (!(isAcceptedCollision(collision, true))) { + return; + } + + const auto multiplicity = getMultiplicityEstimator(collision, true); + + if (collision.has_foundFT0()) { + const auto& ft0 = collision.foundFT0(); + + sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelationsFITReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, reassociatedMftTracks, ft0, ft0as, multiplicity, collision.posZ(), true, true); + } + } + PROCESS_SWITCH(HfTaskFlow, processSameMftFt0aChChNonAmbiguous, "DATA : Process same-event correlations for MFT-FT0-A h-h case non ambiguous", false); + // =================================================================================================================================================================================================================================================================== // MONTE-CARLO // =================================================================================================================================================================================================================================================================== @@ -2180,8 +2260,6 @@ struct HfTaskFlow { const auto multiplicity = mcCollision.multMCPVz(); BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; - // int bin = baseBinning.getBin(std::make_tuple(mcCollision.posZ(), multiplicity)); - // registry.fill(HIST("MC/Gen/TpcMft/HfHadron/SameEvent/2Prong/hEventCountSame"), bin); sameEventHfMc->fillEvent(multiplicity, CorrelationContainer::kCFStepAll); fillCorrelations(sameEventHfMc, CorrelationContainer::CFStep::kCFStepAll, mcParticles2Prong, mcParticles, multiplicity, mcCollision.posZ(), true); @@ -2199,8 +2277,6 @@ struct HfTaskFlow { const auto multiplicity = mcCollision.multMCPVz(); BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; - // int bin = baseBinning.getBin(std::make_tuple(mcCollision.posZ(), multiplicity)); - // registry.fill(HIST("MC/Gen/TpcMft/HfHadron/SameEvent/2Prong/hEventCountSame"), bin); sameEventHfMc->fillEvent(multiplicity, CorrelationContainer::kCFStepAll); fillCorrelations(sameEventHfMc, CorrelationContainer::CFStep::kCFStepAll, mcParticles3Prong, mcParticles, multiplicity, mcCollision.posZ(), true); @@ -2224,20 +2300,7 @@ struct HfTaskFlow { void processMixedTpcTpcChCh(FilteredCollisionsWSelMult const& collisions, FilteredTracksWDcaSel const& tracks) { - // we want to group collisions based on charged-track multiplicity - // auto getTracksSize = [&tracks, this](FilteredCollisionsWSelMult::iterator const& col) { - // auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, col.globalIndex(), this->cache); // it's cached, so slicing/grouping happens only once - // auto size = associatedTracks.size(); - // return size; - // }; - - auto getMultiplicity = [](FilteredCollisionsWSelMult::iterator const& collision) { - auto multiplicity = collision.numContrib(); - return multiplicity; - }; - - // mixCollisions(collisions, tracks, tracks, getTracksSize, mixedEvent); - mixCollisions(collisions, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, tracks, getMultiplicity, mixedEvent); + mixCollisions(collisions, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, tracks, mixedEvent); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcChCh, "DATA : Process mixed-event correlations for TPC-TPC h-h case", false); @@ -2249,12 +2312,7 @@ struct HfTaskFlow { FilteredTracksWDcaSel const& tracks, HfCandidatesSelD0 const& candidates) { - auto getMultiplicity = [](FilteredCollisionsWSelMult::iterator const& collision) { - auto multiplicity = collision.numContrib(); - return multiplicity; - }; - - mixCollisions(collisions, CorrelationContainer::kCFStepReconstructed, candidates, tracks, getMultiplicity, mixedEventHf); + mixCollisions(collisions, CorrelationContainer::kCFStepReconstructed, candidates, tracks, mixedEventHf); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcD0Ch, "DATA : Process mixed-event correlations for TPC-TPC D0-h case", false); @@ -2266,12 +2324,7 @@ struct HfTaskFlow { FilteredTracksWDcaSel const& tracks, HfCandidatesSelLc const& candidates) { - auto getMultiplicity = [](FilteredCollisionsWSelMult::iterator const& collision) { - auto multiplicity = collision.numContrib(); - return multiplicity; - }; - - mixCollisions(collisions, CorrelationContainer::kCFStepReconstructed, candidates, tracks, getMultiplicity, mixedEventHf); + mixCollisions(collisions, CorrelationContainer::kCFStepReconstructed, candidates, tracks, mixedEventHf); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcLcCh, "DATA : Process mixed-event correlations for TPC-TPC Lc-h case", false); @@ -2281,14 +2334,9 @@ struct HfTaskFlow { void processMixedTpcMftChCh(FilteredCollisionsWSelMult const& collisions, FilteredTracksWDcaSel const& tracks, - aod::MFTTracks const& mftTracks) + FilteredMftTracks const& mftTracks) { - auto getMultiplicity = [](FilteredCollisionsWSelMult::iterator const& collision) { - auto multiplicity = collision.numContrib(); - return multiplicity; - }; - - mixCollisions(collisions, CorrelationContainer::kCFStepReconstructed, tracks, mftTracks, getMultiplicity, mixedEvent); + mixCollisions(collisions, CorrelationContainer::kCFStepReconstructed, tracks, mftTracks, mixedEvent); // mixCollisions(collisions, CorrelationContainer::kCFStepAll, tracks, mftTracks, getMultiplicity, mixedEvent); // The next following two lines were supposed to be used to do mixed event with the reassociated MFT tracks @@ -2307,15 +2355,10 @@ struct HfTaskFlow { void processMixedTpcMftD0Ch(FilteredCollisionsWSelMult const& collisions, HfCandidatesSelD0 const& candidates, - aod::MFTTracks const& mftTracks, + FilteredMftTracks const& mftTracks, FilteredTracksWDcaSel const& /*tracks*/) { - auto getMultiplicity = [](FilteredCollisionsWSelMult::iterator const& collision) { - auto multiplicity = collision.numContrib(); - return multiplicity; - }; - - mixCollisions(collisions, CorrelationContainer::kCFStepReconstructed, candidates, mftTracks, getMultiplicity, mixedEventHf); + mixCollisions(collisions, CorrelationContainer::kCFStepReconstructed, candidates, mftTracks, mixedEventHf); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcMftD0Ch, "DATA : Process mixed-event correlations for TPC-MFT D0-h case", false); @@ -2325,14 +2368,9 @@ struct HfTaskFlow { void processMixedTpcMftLcCh(FilteredCollisionsWSelMult const& collisions, HfCandidatesSelLc const& candidates, - aod::MFTTracks const& mftTracks) + FilteredMftTracks const& mftTracks) { - auto getMultiplicity = [](FilteredCollisionsWSelMult::iterator const& collision) { - auto multiplicity = collision.numContrib(); - return multiplicity; - }; - - mixCollisions(collisions, CorrelationContainer::kCFStepReconstructed, candidates, mftTracks, getMultiplicity, mixedEventHf); + mixCollisions(collisions, CorrelationContainer::kCFStepReconstructed, candidates, mftTracks, mixedEventHf); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcMftLcCh, "DATA : Process mixed-event correlations for TPC-MFT Lc-h case", false); @@ -2342,37 +2380,9 @@ struct HfTaskFlow { void processMixedTpcFv0aChCh(FilteredCollisionsWSelMult const& collisions, FilteredTracksWDcaSel const& tracks, - aod::FV0As const&) + aod::FV0As const& fv0as) { - auto getMultiplicity = [](FilteredCollisionsWSelMult::iterator const& collision) { - auto multiplicity = collision.numContrib(); - return multiplicity; - }; - - using MixedBinning = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getMultiplicity)>; - MixedBinning binningOnVtxAndMult{{getMultiplicity}, {binsMixingVertex, binsMixingMultiplicity}, true}; - - for (auto const& [collision1, collision2] : soa::selfCombinations(binningOnVtxAndMult, nMixedEvents, -1, collisions, collisions)) { - - if (!isAcceptedCollision(collision1) || !isAcceptedCollision(collision2)) { - continue; - } - - if (collision1.globalIndex() == collision2.globalIndex()) { - continue; - } - - if (collision1.has_foundFV0() && collision2.has_foundFV0()) { - - const auto multiplicity = getMultiplicity(collision1); - - auto slicedTriggerTracks = tracks.sliceBy(perColTracks, collision1.globalIndex()); - const auto& fv0 = collision2.foundFV0(); - - mixedEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelationsFV0(mixedEvent, CorrelationContainer::CFStep::kCFStepReconstructed, slicedTriggerTracks, fv0, multiplicity, collision1.posZ(), false); - } - } + mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, tracks, fv0as, perColTracks, mixedEvent); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcFv0aChCh, "DATA : Process mixed-event correlations for TPC-FV0-A h-h case", false); @@ -2382,37 +2392,9 @@ struct HfTaskFlow { void processMixedTpcFv0aD0Ch(FilteredCollisionsWSelMult const& collisions, HfCandidatesSelD0 const& candidates, - aod::FV0As const&) + aod::FV0As const& fv0as) { - auto getMultiplicity = [](FilteredCollisionsWSelMult::iterator const& collision) { - auto multiplicity = collision.numContrib(); - return multiplicity; - }; - - using MixedBinning = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getMultiplicity)>; - MixedBinning binningOnVtxAndMult{{getMultiplicity}, {binsMixingVertex, binsMixingMultiplicity}, true}; - - for (auto const& [collision1, collision2] : soa::selfCombinations(binningOnVtxAndMult, nMixedEvents, -1, collisions, collisions)) { - - if (!isAcceptedCollision(collision1) || !isAcceptedCollision(collision2)) { - continue; - } - - if (collision1.globalIndex() == collision2.globalIndex()) { - continue; - } - - if (collision1.has_foundFV0() && collision2.has_foundFV0()) { - - const auto multiplicity = getMultiplicity(collision1); - - auto slicedTriggerCandidates = candidates.sliceBy(perColD0s, collision1.globalIndex()); - const auto& fv0 = collision2.foundFV0(); - - mixedEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelationsFV0(mixedEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, slicedTriggerCandidates, fv0, multiplicity, collision1.posZ(), false); - } - } + mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, candidates, fv0as, perColD0s, mixedEventHf); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcFv0aD0Ch, "DATA : Process mixed-event correlations for TPC-FV0-A D0-h case", false); @@ -2422,37 +2404,9 @@ struct HfTaskFlow { void processMixedTpcFv0aLcCh(FilteredCollisionsWSelMult const& collisions, HfCandidatesSelLc const& candidates, - aod::FV0As const&) + aod::FV0As const& fv0as) { - auto getMultiplicity = [](FilteredCollisionsWSelMult::iterator const& collision) { - auto multiplicity = collision.numContrib(); - return multiplicity; - }; - - using MixedBinning = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getMultiplicity)>; - MixedBinning binningOnVtxAndMult{{getMultiplicity}, {binsMixingVertex, binsMixingMultiplicity}, true}; - - for (auto const& [collision1, collision2] : soa::selfCombinations(binningOnVtxAndMult, nMixedEvents, -1, collisions, collisions)) { - - if (!isAcceptedCollision(collision1) || !isAcceptedCollision(collision2)) { - continue; - } - - if (collision1.globalIndex() == collision2.globalIndex()) { - continue; - } - - if (collision1.has_foundFV0() && collision2.has_foundFV0()) { - - const auto multiplicity = getMultiplicity(collision1); - - auto slicedTriggerCandidates = candidates.sliceBy(perColLcs, collision1.globalIndex()); - const auto& fv0 = collision2.foundFV0(); - - mixedEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelationsFV0(mixedEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, slicedTriggerCandidates, fv0, multiplicity, collision1.posZ(), false); - } - } + mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, candidates, fv0as, perColLcs, mixedEventHf); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcFv0aLcCh, "DATA : Process mixed-event correlations for TPC-FV0-A Lc-h case", false); @@ -2461,39 +2415,60 @@ struct HfTaskFlow { // ===================================== void processMixedMftFv0aChCh(FilteredCollisionsWSelMult const& collisions, - aod::MFTTracks const& mftTracks, - aod::FV0As const&) + FilteredMftTracks const& mftTracks, + aod::FV0As const& fv0as) { - auto getMultiplicity = [](FilteredCollisionsWSelMult::iterator const& collision) { - auto multiplicity = collision.numContrib(); - return multiplicity; - }; + mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, mftTracks, fv0as, perColMftTracks, mixedEvent); + } + PROCESS_SWITCH(HfTaskFlow, processMixedMftFv0aChCh, "DATA : Process mixed-event correlations for Mft-FV0-A h-h case", false); - using MixedBinning = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getMultiplicity)>; - MixedBinning binningOnVtxAndMult{{getMultiplicity}, {binsMixingVertex, binsMixingMultiplicity}, true}; + // ===================================== + // DATA : process mixed event correlations: TPC-FT0-A ch part. - ch. part. case + // ===================================== - for (auto const& [collision1, collision2] : soa::selfCombinations(binningOnVtxAndMult, nMixedEvents, -1, collisions, collisions)) { + void processMixedTpcFt0aChCh(FilteredCollisionsWSelMult const& collisions, + FilteredTracksWDcaSel const& tracks, + aod::FT0s const& ft0s) + { + mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, tracks, ft0s, perColTracks, mixedEvent); + } + PROCESS_SWITCH(HfTaskFlow, processMixedTpcFt0aChCh, "DATA : Process mixed-event correlations for TPC-FT0-A h-h case", false); - if (!isAcceptedCollision(collision1) || !isAcceptedCollision(collision2)) { - continue; - } + // ===================================== + // DATA : process mixed event correlations: TPC-FT0-A D0 - ch. part. case + // ===================================== - if (collision1.globalIndex() == collision2.globalIndex()) { - continue; - } + void processMixedTpcFt0aD0Ch(FilteredCollisionsWSelMult const& collisions, + HfCandidatesSelD0 const& candidates, + aod::FT0s const& ft0s) + { + mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, candidates, ft0s, perColD0s, mixedEventHf); + } + PROCESS_SWITCH(HfTaskFlow, processMixedTpcFt0aD0Ch, "DATA : Process mixed-event correlations for TPC-FT0-A D0-h case", false); - if (collision1.has_foundFV0() && collision2.has_foundFV0()) { + // ===================================== + // DATA : process mixed event correlations: TPC-FT0-A Lc - ch. part. case + // ===================================== - const auto multiplicity = getMultiplicity(collision1); - auto slicedTriggerMftTracks = mftTracks.sliceBy(perColMftTracks, collision1.globalIndex()); - const auto& fv0 = collision2.foundFV0(); + void processMixedTpcFt0aLcCh(FilteredCollisionsWSelMult const& collisions, + HfCandidatesSelLc const& candidates, + aod::FT0s const& ft0s) + { + mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, candidates, ft0s, perColLcs, mixedEventHf); + } + PROCESS_SWITCH(HfTaskFlow, processMixedTpcFt0aLcCh, "DATA : Process mixed-event correlations for TPC-FT0-A Lc-h case", false); - mixedEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelationsFV0(mixedEvent, CorrelationContainer::CFStep::kCFStepReconstructed, slicedTriggerMftTracks, fv0, multiplicity, collision1.posZ(), false); - } - } + // ===================================== + // DATA : process mixed event correlations: TPC-FT0-A ch part. - ch. part. case + // ===================================== + + void processMixedMftFt0aChCh(FilteredCollisionsWSelMult const& collisions, + FilteredMftTracks const& mftTracks, + aod::FT0s const& ft0s) + { + mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, mftTracks, ft0s, perColMftTracks, mixedEvent); } - PROCESS_SWITCH(HfTaskFlow, processMixedMftFv0aChCh, "DATA : Process mixed-event correlations for Mft-FV0-A h-h case", false); + PROCESS_SWITCH(HfTaskFlow, processMixedMftFt0aChCh, "DATA : Process mixed-event correlations for MFT-FT0-A h-h case", false); // =================================================================================================================================================================================================================================================================== // MONTE-CARLO @@ -2548,7 +2523,7 @@ struct HfTaskFlow { LOGF(info, "MC collision at vtx-z = %f with %d mc particles and %d reconstructed collisions", mcCollision.posZ(), mcParticles.size(), collisionsMcLabels.size()); auto multiplicity = mcCollision.multMCPVz(); - if (centralityBinsForMc) { + if (configTask.centralityBinsForMc) { if (collisionsMcLabels.size() == 0) { return; } From 55a59ee11bfd21c9aebad058886292d2573b4dfd Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Mon, 22 Sep 2025 12:25:06 +0200 Subject: [PATCH 490/986] [PWGDQ] Speedup DQ event selection (#13043) Co-authored-by: ALICE Action Bot --- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 6 +++--- PWGDQ/Tasks/tableReader_withAssoc.cxx | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index 99ab1c29153..f0691f3cb7e 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -370,7 +370,7 @@ struct AnalysisEventSelection { // loop over the BC map, get the collision vectors and make in-bunch and out of bunch 2-event correlations for (auto bc1It = fBCCollMap.begin(); bc1It != fBCCollMap.end(); ++bc1It) { uint64_t bc1 = bc1It->first; - auto bc1Events = bc1It->second; + auto const& bc1Events = bc1It->second; // same bunch event correlations, if more than 1 collisions in this bunch if (bc1Events.size() > 1) { @@ -393,9 +393,9 @@ struct AnalysisEventSelection { for (auto bc2It = std::next(bc1It); bc2It != fBCCollMap.end(); ++bc2It) { uint64_t bc2 = bc2It->first; if ((bc2 > bc1 ? bc2 - bc1 : bc1 - bc2) > fConfigSplitCollisionsDeltaBC) { - continue; + break; } - auto bc2Events = bc2It->second; + auto const& bc2Events = bc2It->second; // loop over events in the first BC for (auto ev1It : bc1Events) { diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index 0efc92a54cf..ab3e9320b65 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -456,7 +456,7 @@ struct AnalysisEventSelection { // loop over the BC map, get the collision vectors and make in-bunch and out of bunch 2-event correlations for (auto bc1It = fBCCollMap.begin(); bc1It != fBCCollMap.end(); ++bc1It) { uint64_t bc1 = bc1It->first; - auto bc1Events = bc1It->second; + auto& bc1Events = bc1It->second; // same bunch event correlations, if more than 1 collisions in this bunch if (bc1Events.size() > 1) { @@ -483,7 +483,7 @@ struct AnalysisEventSelection { if ((bc2 > bc1 ? bc2 - bc1 : bc1 - bc2) > fConfigSplitCollisionsDeltaBC) { break; } - auto bc2Events = bc2It->second; + auto& bc2Events = bc2It->second; // loop over events in the first BC for (auto ev1It : bc1Events) { From 0754513c146ffda53abef2128eb35adad76124c4 Mon Sep 17 00:00:00 2001 From: Stefano Cannito <143754257+scannito@users.noreply.github.com> Date: Mon, 22 Sep 2025 15:36:40 +0200 Subject: [PATCH 491/986] [PWGLF] New analysis method + resonanceTreeCreator.cxx (#13056) --- PWGLF/TableProducer/Resonances/CMakeLists.txt | 5 + .../Resonances/resonanceTreeCreator.cxx | 344 ++++++++ .../Tasks/Strangeness/phik0shortanalysis.cxx | 734 ++++++++++-------- 3 files changed, 750 insertions(+), 333 deletions(-) create mode 100644 PWGLF/TableProducer/Resonances/resonanceTreeCreator.cxx diff --git a/PWGLF/TableProducer/Resonances/CMakeLists.txt b/PWGLF/TableProducer/Resonances/CMakeLists.txt index a58387288a8..a3e59673293 100644 --- a/PWGLF/TableProducer/Resonances/CMakeLists.txt +++ b/PWGLF/TableProducer/Resonances/CMakeLists.txt @@ -54,3 +54,8 @@ o2physics_add_dpl_workflow(cksspinalignment SOURCES cksspinalignment.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(resonance-tree-creator + SOURCES resonanceTreeCreator.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGLF/TableProducer/Resonances/resonanceTreeCreator.cxx b/PWGLF/TableProducer/Resonances/resonanceTreeCreator.cxx new file mode 100644 index 00000000000..3479f896595 --- /dev/null +++ b/PWGLF/TableProducer/Resonances/resonanceTreeCreator.cxx @@ -0,0 +1,344 @@ +// 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 resonanceTreeCreator.cxx +/// \brief Produces a TTree with machine learning variables for resonances in the LF group +/// \author Stefano Cannito (stefano.cannito@cern.ch) + +#include "PWGLF/DataModel/mcCentrality.h" +#include "PWGLF/Utils/inelGt.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +namespace o2::aod +{ +namespace resomlcandidates +{ +// Multiplicity class +DECLARE_SOA_COLUMN(MultClass, multClass, float); //! Event multiplicity class +// Daughter 1 +DECLARE_SOA_COLUMN(PtDaughter1, ptdaughter1, float); //! Transverse momentum of daughter1 (GeV/c) +DECLARE_SOA_COLUMN(PDaughter1, pdaughter1, float); //! Momentum of daughter1 (GeV/c) +DECLARE_SOA_COLUMN(PhiDaughter1, phiDaughter1, float); //! Azimuthal angle of daughter1 (rad) +DECLARE_SOA_COLUMN(EtaDaughter1, etaDaughter1, float); //! Pseudorapidity of daughter1 +DECLARE_SOA_COLUMN(YDaughter1, yDaughter1, float); //! Rapidity of daughter1 +DECLARE_SOA_COLUMN(DCAxyDaughter1, dcaDaughter1, float); //! DCA of daughter1 to primary vertex (cm) +DECLARE_SOA_COLUMN(DCAzDaughter1, dcaZDaughter1, float); //! DCA of daughter1 to primary vertex in z (cm) +DECLARE_SOA_COLUMN(NSigTpcPi1, nSigTpcPi1, float); //! TPC Nsigma separation for daughter1 with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcKa1, nSigTpcKa1, float); //! TPC Nsigma separation for daughter1 with kaon mass hypothesis +DECLARE_SOA_COLUMN(NSigTofPi1, nSigTofPi1, float); //! TOF Nsigma separation for daughter1 with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTofKa1, nSigTofKa1, float); //! TOF Nsigma separation for daughter1 with kaon mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofPi1, nSigTpcTofPi1, float); //! TPC and TOF combined Nsigma separation for daughter1 with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofKa1, nSigTpcTofKa1, float); //! TPC and TOF combined Nsigma separation for daughter1 with kaon mass hypothesis +// Daughter 2 +DECLARE_SOA_COLUMN(PtDaughter2, ptdaughter2, float); //! Transverse momentum of daughter2 (GeV/c) +DECLARE_SOA_COLUMN(PDaughter2, pdaughter2, float); //! Momentum of daughter2 (in GeV/c) +DECLARE_SOA_COLUMN(PhiDaughter2, phiDaughter2, float); //! Azimuthal angle of daughter2 (rad) +DECLARE_SOA_COLUMN(EtaDaughter2, etaDaughter2, float); //! Pseudorapidity of daughter2 +DECLARE_SOA_COLUMN(YDaughter2, yDaughter2, float); //! Rapidity of daughter2 +DECLARE_SOA_COLUMN(DCAxyDaughter2, dcaDaughter2, float); //! DCA of daughter2 to primary vertex (cm) +DECLARE_SOA_COLUMN(DCAzDaughter2, dcaZDaughter2, float); //! DCA of daughter2 to primary vertex in z (cm) +DECLARE_SOA_COLUMN(NSigTpcPi2, nSigTpcPi2, float); //! TPC Nsigma separation for daughter2 with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcKa2, nSigTpcKa2, float); //! TPC Nsigma separation for daughter2 with kaon mass hypothesis +DECLARE_SOA_COLUMN(NSigTofPi2, nSigTofPi2, float); //! TOF Nsigma separation for daughter2 with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTofKa2, nSigTofKa2, float); //! TOF Nsigma separation for daughter2 with kaon mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofPi2, nSigTpcTofPi2, float); //! TPC and TOF combined Nsigma separation for daughter2 with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofKa2, nSigTpcTofKa2, float); //! TPC and TOF combined Nsigma separation for daughter2 with kaon mass hypothesis +// Candidate +DECLARE_SOA_COLUMN(M, m, float); //! Invariant mass of candidate (GeV/c2) +DECLARE_SOA_COLUMN(Pt, pt, float); //! Transverse momentum of candidate (GeV/c) +DECLARE_SOA_COLUMN(P, p, float); //! Momentum of candidate (GeV/c) +DECLARE_SOA_COLUMN(Phi, phi, float); //! Azimuth angle of candidate +DECLARE_SOA_COLUMN(Eta, eta, float); //! Pseudorapidity of candidate +DECLARE_SOA_COLUMN(Y, y, float); //! Rapidity of candidate +DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! Sign of the candidate +DECLARE_SOA_COLUMN(IsTruePhi, isTruePhi, bool); //! Flag to indicate if the candidate is a phi meson +} // namespace resomlcandidates + +DECLARE_SOA_TABLE(ResoCandidates, "AOD", "RESOCANDIDATES", + resomlcandidates::M, + resomlcandidates::Pt, + resomlcandidates::P, + resomlcandidates::Phi, + resomlcandidates::Eta, + resomlcandidates::Y, + resomlcandidates::Sign, + resomlcandidates::IsTruePhi); + +DECLARE_SOA_TABLE(ResoMLCandidates, "AOD", "RESOMLCANDIDATES", + resomlcandidates::MultClass, + resomlcandidates::PtDaughter1, + resomlcandidates::PDaughter1, + resomlcandidates::PhiDaughter1, + resomlcandidates::EtaDaughter1, + resomlcandidates::YDaughter1, + resomlcandidates::DCAxyDaughter1, + resomlcandidates::DCAzDaughter1, + resomlcandidates::NSigTpcPi1, + resomlcandidates::NSigTpcKa1, + resomlcandidates::NSigTofPi1, + resomlcandidates::NSigTofKa1, + resomlcandidates::NSigTpcTofPi1, + resomlcandidates::NSigTpcTofKa1, + resomlcandidates::PtDaughter2, + resomlcandidates::PDaughter2, + resomlcandidates::PhiDaughter2, + resomlcandidates::EtaDaughter2, + resomlcandidates::YDaughter2, + resomlcandidates::DCAxyDaughter2, + resomlcandidates::DCAzDaughter2, + resomlcandidates::NSigTpcPi2, + resomlcandidates::NSigTpcKa2, + resomlcandidates::NSigTofPi2, + resomlcandidates::NSigTofKa2, + resomlcandidates::NSigTpcTofPi2, + resomlcandidates::NSigTpcTofKa2, + resomlcandidates::M, + resomlcandidates::Pt, + resomlcandidates::P, + resomlcandidates::Phi, + resomlcandidates::Eta, + resomlcandidates::Y, + resomlcandidates::Sign); + +namespace resomlselection +{ +DECLARE_SOA_COLUMN(PhiBDTScore, gammaBDTScore, float); +} // namespace resomlselection + +DECLARE_SOA_TABLE(ResoPhiMLSelection, "AOD", "RESOPHIMLSELECTION", + resomlselection::PhiBDTScore); +} // namespace o2::aod + +struct resonanceTreeCreator { + // Production of the TTree + Produces resoCandidates; + Produces resoMLCandidates; + + // Configurables for track selection + Configurable cfgCutCharge{"cfgCutCharge", 0.0f, "Cut on the signed transverse momentum to select positive or negative tracks"}; + + // Configurables for production of training samples + Configurable fillOnlySignal{"fillOnlySignal", false, "Flag to fill derived tables with signal for ML trainings"}; + Configurable fillOnlyBackground{"fillOnlyBackground", false, "Flag to fill derived tables with background for ML trainings"}; + Configurable downSampleBkgFactor{"downSampleBkgFactor", 0.5f, "Fraction of background candidates to keep for ML trainings"}; + Configurable ptMaxForDownSample{"ptMaxForDownSample", 10.0f, "Maximum pt for the application of the downsampling factor"}; + + // Defining the type of the collisions for data and MC + using SelCollisions = soa::Join; + using SimCollisions = soa::Join; + + // Defining the type of the tracks for data and MC + using FullTracks = soa::Join; + using FullMCTracks = soa::Join; + + Partition posTracks = aod::track::signed1Pt > cfgCutCharge; + Partition negTracks = aod::track::signed1Pt < cfgCutCharge; + + Partition posMCTracks = aod::track::signed1Pt > cfgCutCharge; + Partition negMCTracks = aod::track::signed1Pt < cfgCutCharge; + + Preslice perColl = aod::track::collisionId; + Preslice perMCColl = aod::mcparticle::mcCollisionId; + + // Necessary to flag INEL>0 events in GenMC + Service pdgDB; + + // Cache for manual slicing + SliceCache cache; + + enum ParticleType { + Pi, + Ka, + Pr + }; + + // Constants + double massPi = o2::constants::physics::MassPiPlus; + double massKa = o2::constants::physics::MassKPlus; + + void init(InitContext&) + { + } + + // Combine Nsigma values from TPC and TOF + template + float combineNSigma(const T& track) + { + float nSigmaTPC, nSigmaTOF; + switch (massHypo) { + case Pi: + nSigmaTPC = track.tpcNSigmaPi(); + nSigmaTOF = track.tofNSigmaPi(); + break; + case Ka: + nSigmaTPC = track.tpcNSigmaKa(); + nSigmaTOF = track.tofNSigmaKa(); + break; + case Pr: + nSigmaTPC = track.tpcNSigmaPr(); + nSigmaTOF = track.tofNSigmaPr(); + break; + default: + break; + } + + static constexpr float defaultNSigmaTolerance = .1f; + static constexpr float defaultNSigma = -999.f + defaultNSigmaTolerance; + + if (nSigmaTPC > defaultNSigma && nSigmaTOF > defaultNSigma) + return std::sqrt(0.5f * std::pow(nSigmaTPC, 2) + std::pow(nSigmaTOF, 2)); + if (nSigmaTPC > defaultNSigma) + return std::abs(nSigmaTPC); + if (nSigmaTOF > defaultNSigma) + return std::abs(nSigmaTOF); + return nSigmaTPC; + } + + // Reconstruct the candidate 4-momentum from two daughter tracks + template + ROOT::Math::PxPyPzMVector recMother(const T& track1, const T& track2, float masstrack1, float masstrack2) + { + ROOT::Math::PxPyPzMVector daughter1(track1.px(), track1.py(), track1.pz(), masstrack1); // set the daughter1 4-momentum + ROOT::Math::PxPyPzMVector daughter2(track2.px(), track2.py(), track2.pz(), masstrack2); // set the daughter2 4-momentum + ROOT::Math::PxPyPzMVector mother = daughter1 + daughter2; // calculate the mother 4-momentum + + return mother; + } + + template + void fillCandidateTree4ML(const T1& collision, const T2& track1, const T2& track2, float masstrack1, float masstrack2 + /*std::optional> mcParticles = std::nullopt*/) + { + auto tpctofPi1 = combineNSigma(track1); + auto tpctofKa1 = combineNSigma(track1); + auto tpctofPi2 = combineNSigma(track2); + auto tpctofKa2 = combineNSigma(track2); + + ROOT::Math::PxPyPzMVector recCandidate = recMother(track1, track2, masstrack1, masstrack2); + + if (downSampleBkgFactor < 1.) { + float pseudoRndm = track1.pt() * 1000. - static_cast(track1.pt() * 1000); + if (recCandidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) + return; + } + + resoMLCandidates(collision.centFT0M(), + track1.pt(), track1.p(), track1.phi(), track1.eta(), track1.rapidity(masstrack1), track1.dcaXY(), track1.dcaZ(), + track1.tpcNSigmaPi(), track1.tpcNSigmaKa(), track1.tofNSigmaPi(), track1.tofNSigmaKa(), tpctofPi1, tpctofKa1, + track2.pt(), track2.p(), track2.phi(), track2.eta(), track2.rapidity(masstrack2), track2.dcaXY(), track2.dcaZ(), + track2.tpcNSigmaPi(), track2.tpcNSigmaKa(), track2.tofNSigmaPi(), track2.tofNSigmaKa(), tpctofPi2, tpctofKa2, + recCandidate.M(), recCandidate.Pt(), recCandidate.P(), recCandidate.Phi(), + recCandidate.Eta(), recCandidate.Rapidity(), track1.sign() + track2.sign()); + } + + template + bool isMCPhi(const T& track1, const T& track2, const aod::McParticles& mcParticles) + { + if (!track1.has_mcParticle() || !track2.has_mcParticle()) + return false; // Skip filling if no MC truth is available for both tracks + + auto mcTrack1 = mcParticles.rawIteratorAt(track1.mcParticleId()); + auto mcTrack2 = mcParticles.rawIteratorAt(track2.mcParticleId()); + + if (mcTrack1.pdgCode() != PDG_t::kKPlus || !mcTrack1.isPhysicalPrimary()) + return false; // Skip filling if the first track is not a primary K+ + if (mcTrack2.pdgCode() != PDG_t::kKMinus || !mcTrack2.isPhysicalPrimary()) + return false; // Skip filling if the second track is not a primary K- + + const auto mcTrack1MotherIndexes = mcTrack1.mothersIds(); + const auto mcTrack2MotherIndexes = mcTrack2.mothersIds(); + + for (const auto& mcTrack1MotherIndex : mcTrack1MotherIndexes) { + for (const auto& mcTrack2MotherIndex : mcTrack2MotherIndexes) { + if (mcTrack1MotherIndex != mcTrack2MotherIndex) + continue; + + const auto mother = mcParticles.rawIteratorAt(mcTrack1MotherIndex); + if (mother.pdgCode() == o2::constants::physics::Pdg::kPhi) + return true; + } + } + return false; + } + + void processData4ML(SelCollisions::iterator const& collision, FullTracks const&) + { + auto posThisColl = posTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + auto negThisColl = negTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + + for (const auto& track1 : posThisColl) { + for (const auto& track2 : negThisColl) { + // Fill the ResoMLCandidates table with candidates in Data + fillCandidateTree4ML(collision, track1, track2, massKa, massKa); + } + } + } + + PROCESS_SWITCH(resonanceTreeCreator, processData4ML, "Fill ResoMLCandidates in Data", true); + + void processMC4ML(SimCollisions::iterator const& collision, FullMCTracks const&, aod::McParticles const& mcParticles) + { + auto posThisColl = posMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + auto negThisColl = negMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + + for (const auto& track1 : posThisColl) { + for (const auto& track2 : negThisColl) { + if (fillOnlySignal && !isMCPhi(track1, track2, mcParticles)) + return; // Skip filling if only signal is requested and not a phi in MC truth + if (fillOnlyBackground && isMCPhi(track1, track2, mcParticles)) + return; // Skip filling if only background is requested and a phi in MC truth + + // Fill the ResoMLCandidates table with candidates in MC + fillCandidateTree4ML(collision, track1, track2, massKa, massKa); + } + } + } + + PROCESS_SWITCH(resonanceTreeCreator, processMC4ML, "Fill ResoMLCandidates in MC", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx b/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx index 076609b91b9..047e32c8adc 100644 --- a/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx @@ -225,7 +225,6 @@ struct Phik0shortanalysis { Configurable applyEfficiency{"applyEfficiency", false, "Use efficiency for filling histograms"}; // Configurables for dN/deta with phi computation - Configurable furtherCheckonMcCollision{"furtherCheckonMcCollision", true, "Further check on MC collisions"}; Configurable filterOnGenPhi{"filterOnGenPhi", 1, "Filter on Gen Phi (0: K+K- pair like Phi, 1: proper Phi)"}; Configurable filterOnRecoPhi{"filterOnRecoPhi", 1, "Filter on Reco Phi (0: without PDG, 1: with PDG)"}; Configurable fillMcPartsForAllReco{"fillMcPartsForAllReco", false, "Fill MC particles for all associated reco collisions"}; @@ -295,8 +294,9 @@ struct Phik0shortanalysis { // Preslice for manual slicing struct : PresliceGroup { - Preslice perColl = aod::track::collisionId; - Preslice perMCColl = aod::mcparticle::mcCollisionId; + Preslice trackPerCollision = aod::track::collisionId; + Preslice mcPartPerMCCollision = aod::mcparticle::mcCollisionId; + Preslice v0PerCollision = aod::v0::collisionId; } preslices; // Positive and negative tracks partitions @@ -338,6 +338,7 @@ struct Phik0shortanalysis { AxisSpec etaAxis = {16, -trackConfigs.etaMax, trackConfigs.etaMax, "#eta"}; AxisSpec yAxis = {deltaYConfigs.nBinsY, -deltaYConfigs.cfgYAcceptance, deltaYConfigs.cfgYAcceptance, "#it{y}"}; AxisSpec deltayAxis = {deltaYConfigs.nBinsDeltaY, -1.0f, 1.0f, "#Delta#it{y}"}; + AxisSpec deltaphiAxis = {72, -o2::constants::math::PIHalf, o2::constants::math::PIHalf * 3, "#Delta#varphi"}; AxisSpec phiAxis = {629, 0, o2::constants::math::TwoPI, "#phi"}; AxisSpec multAxis = {120, 0.0f, 120.0f, "centFT0M"}; AxisSpec binnedmultAxis{(std::vector)binsMult, "centFT0M"}; @@ -399,16 +400,13 @@ struct Phik0shortanalysis { mcEventHist.add("hGenMCAssocRecoMultiplicityPercent", "GenMC AssocReco Multiplicity Percentile", kTH1F, {binnedmultAxis}); mcEventHist.add("h2GenMCAssocRecoVertexZvsMult", "GenMC AssocReco Vertex Z vs Multiplicity Percentile", kTH2F, {vertexZAxis, binnedmultAxis}); mcEventHist.add("hGenMCRecoMultiplicityPercent", "GenMCReco Multiplicity Percentile", kTH1F, {binnedmultAxis}); - mcEventHist.add("h2GenMCRecoVertexZvsMult", "GenMCReco Vertex Z vs Multiplicity Percentile", kTH2F, {vertexZAxis, binnedmultAxis}); // Eta distribution for dN/deta values estimation in MC mcEventHist.add("h6RecoMCEtaDistribution", "Eta vs multiplicity in MCReco", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, phiAxis, {6, -0.5f, 5.5f}, {3, -0.5f, 2.5f}}); - mcEventHist.add("h6RecoCheckMCEtaDistribution", "Eta vs multiplicity in MCReco Check", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, phiAxis, {6, -0.5f, 5.5f}, {3, -0.5f, 2.5f}}); mcEventHist.add("h5GenMCEtaDistribution", "Eta vs multiplicity in MCGen", kTHnSparseF, {binnedmultAxis, etaAxis, phiAxis, {6, -0.5f, 5.5f}, {3, -0.5f, 2.5f}}); - mcEventHist.add("h6GenMCEtaDistributionAssocReco", "Eta vs multiplicity in MCGen Assoc Reco", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, phiAxis, {6, -0.5f, 5.5f}, {3, -0.5f, 2.5f}}); - mcEventHist.add("h6GenMCEtaDistributionReco", "Eta vs multiplicity in MCGen Reco", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, phiAxis, {6, -0.5f, 5.5f}, {3, -0.5f, 2.5f}}); - mcEventHist.add("h6GenMCEtaDistributionRecoCheck", "Eta vs multiplicity in MCGen Reco Check", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, phiAxis, {6, -0.5f, 5.5f}, {3, -0.5f, 2.5f}}); + mcEventHist.add("h6GenMCAssocRecoEtaDistribution", "Eta vs multiplicity in MCGen Assoc Reco", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, phiAxis, {6, -0.5f, 5.5f}, {3, -0.5f, 2.5f}}); + mcEventHist.add("h6GenMCAllAssocRecoEtaDistribution", "Eta vs multiplicity in MCGen Reco", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, phiAxis, {6, -0.5f, 5.5f}, {3, -0.5f, 2.5f}}); // Phi topological/PID cuts dataPhiHist.add("h2DauTracksPhiDCAxyPreCutData", "Dcaxy distribution vs pt before DCAxy cut", kTH2F, {{100, 0.0, 5.0, "#it{p}_{T} (GeV/#it{c})"}, {2000, -0.05, 0.05, "DCA_{xy} (cm)"}}); @@ -660,6 +658,9 @@ struct Phik0shortanalysis { dataPhiK0SHist.add("h5PhiK0SDataNewProc", "2D Invariant mass of Phi and K0Short in Data", kTHnSparseF, {deltayAxis, binnedmultAxis, binnedpTK0SAxis, massK0SAxis, massPhiAxis}); dataPhiPionHist.add("h5PhiPiTPCDataNewProc", "Phi Invariant mass vs Pion nSigma TPC in Data", kTHnSparseF, {deltayAxis, binnedmultAxis, binnedpTPiAxis, nSigmaPiAxis, massPhiAxis}); dataPhiPionHist.add("h5PhiPiTOFDataNewProc", "Phi Invariant mass vs Pion nSigma TOF in Data", kTHnSparseF, {deltayAxis, binnedmultAxis, binnedpTPiAxis, nSigmaPiAxis, massPhiAxis}); + + dataPhiK0SHist.add("h5PhiK0SData2PartCorr", "Deltay vs deltaphi for Phi and K0Short in Data", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTK0SAxis, deltayAxis, deltaphiAxis}); + dataPhiPionHist.add("h5PhiPiData2PartCorr", "Deltay vs deltaphi for Phi and Pion in Data", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTPiAxis, deltayAxis, deltaphiAxis}); } if (analysisModeConfigs.isClosureNewProc) { @@ -676,26 +677,18 @@ struct Phik0shortanalysis { } if (analysisModeConfigs.isMCNewProc) { - mcPhiHist.add("h3PhiMCRecoNewProc", "Phi in MCReco", kTH3F, {binnedmultAxis, pTPhiAxis, yAxis}); - mcK0SHist.add("h3K0SMCRecoNewProc", "K0S in MCReco", kTH3F, {binnedmultAxis, pTK0SAxis, yAxis}); - mcPionHist.add("h3PiMCRecoNewProc", "Pion in MCReco", kTH3F, {binnedmultAxis, pTPiAxis, yAxis}); - mcPionHist.add("h3PiMCReco2NewProc", "Pion in MCReco", kTH3F, {binnedmultAxis, pTPiAxis, yAxis}); + mcPhiHist.add("h4PhiMCRecoNewProc", "Phi in MCReco", kTHnSparseF, {vertexZAxis, binnedmultAxis, pTPhiAxis, yAxis}); + mcK0SHist.add("h4K0SMCRecoNewProc", "K0S in MCReco", kTHnSparseF, {vertexZAxis, binnedmultAxis, pTK0SAxis, yAxis}); + mcPionHist.add("h4PiMCRecoNewProc", "Pion in MCReco", kTHnSparseF, {vertexZAxis, binnedmultAxis, pTPiAxis, yAxis}); + mcPionHist.add("h4PiMCReco2NewProc", "Pion in MCReco", kTHnSparseF, {vertexZAxis, binnedmultAxis, pTPiAxis, yAxis}); mcPhiHist.add("h3PhiMCGenNewProc", "Phi in MCGen", kTH3F, {binnedmultAxis, pTPhiAxis, yAxis}); mcK0SHist.add("h3K0SMCGenNewProc", "K0S in MCGen", kTH3F, {binnedmultAxis, pTK0SAxis, yAxis}); mcPionHist.add("h3PiMCGenNewProc", "Pion in MCGen", kTH3F, {binnedmultAxis, pTPiAxis, yAxis}); - mcPhiHist.add("h3PhiMCGenAssocRecoNewProc", "Phi in MCGen Associated MCReco", kTH3F, {binnedmultAxis, pTPhiAxis, yAxis}); - mcK0SHist.add("h3K0SMCGenAssocRecoNewProc", "K0S in MCGen Associated MCReco", kTH3F, {binnedmultAxis, pTK0SAxis, yAxis}); - mcPionHist.add("h3PiMCGenAssocRecoNewProc", "Pion in MCGen Associated MCReco", kTH3F, {binnedmultAxis, pTPiAxis, yAxis}); - - mcPhiHist.add("h3PhiMCGenRecoNewProc", "Phi in MCGen MCReco", kTH3F, {binnedmultAxis, pTPhiAxis, yAxis}); - mcK0SHist.add("h3K0SMCGenRecoNewProc", "K0S in MCGen MCReco", kTH3F, {binnedmultAxis, pTK0SAxis, yAxis}); - mcPionHist.add("h3PiMCGenRecoNewProc", "Pion in MCGen MCReco", kTH3F, {binnedmultAxis, pTPiAxis, yAxis}); - - mcPhiHist.add("h3PhiMCGenRecoCheckNewProc", "Phi in MCGen MCReco Check", kTH3F, {binnedmultAxis, pTPhiAxis, yAxis}); - mcK0SHist.add("h3K0SMCGenRecoCheckNewProc", "K0S in MCGen MCReco Check", kTH3F, {binnedmultAxis, pTK0SAxis, yAxis}); - mcPionHist.add("h3PiMCGenRecoCheckNewProc", "Pion in MCGen MCReco Check", kTH3F, {binnedmultAxis, pTPiAxis, yAxis}); + mcPhiHist.add("h4PhiMCGenAssocRecoNewProc", "Phi in MCGen Associated MCReco", kTHnSparseF, {vertexZAxis, binnedmultAxis, pTPhiAxis, yAxis}); + mcK0SHist.add("h4K0SMCGenAssocRecoNewProc", "K0S in MCGen Associated MCReco", kTHnSparseF, {vertexZAxis, binnedmultAxis, pTK0SAxis, yAxis}); + mcPionHist.add("h4PiMCGenAssocRecoNewProc", "Pion in MCGen Associated MCReco", kTHnSparseF, {vertexZAxis, binnedmultAxis, pTPiAxis, yAxis}); } // Initialize CCDB only if purity or efficiencies are requested in the task @@ -1120,7 +1113,7 @@ struct Phik0shortanalysis { } template - bool isGenParticleCharged(const T& mcParticle) + bool selectionChargedGenParticle(const T& mcParticle) { if (!mcParticle.isPhysicalPrimary() || std::abs(mcParticle.eta()) > trackConfigs.etaMax) return false; @@ -2636,67 +2629,7 @@ struct Phik0shortanalysis { PROCESS_SWITCH(Phik0shortanalysis, processdNdetaWPhiData, "Process function for dN/deta values in Data", false); - void processdNdetaWPhiMCReco(SimCollisions::iterator const& collision, FilteredMCTracks const& filteredMCTracks, MCCollisions const&, aod::McParticles const& mcParticles) - { - if (!acceptEventQA(collision, true)) - return; - if (!collision.has_mcCollision()) - return; - - const auto& mcCollision = collision.mcCollision_as(); - auto mcParticlesThisColl = mcParticles.sliceBy(preslices.perMCColl, mcCollision.globalIndex()); - - if (furtherCheckonMcCollision && (std::abs(mcCollision.posZ()) > cutZVertex || !pwglf::isINELgtNmc(mcParticlesThisColl, 0, pdgDB))) - return; - if (filterOnGenPhi && !eventHasGenPhi(mcParticlesThisColl)) - return; - - mcEventHist.fill(HIST("hRecoMCMultiplicityPercent"), mcCollision.centFT0M()); - mcEventHist.fill(HIST("h2RecoMCVertexZvsMult"), collision.posZ(), mcCollision.centFT0M()); - - for (const auto& track : filteredMCTracks) { - if (trackConfigs.applyExtraPhiCuts && ((track.phi() > trackConfigs.extraPhiCuts->at(0) && track.phi() < trackConfigs.extraPhiCuts->at(1)) || - track.phi() <= trackConfigs.extraPhiCuts->at(2) || track.phi() >= trackConfigs.extraPhiCuts->at(3))) - continue; - if (!track.has_mcParticle()) - continue; - - auto mcTrack = track.mcParticle_as(); - if (!mcTrack.isPhysicalPrimary() || std::abs(mcTrack.eta()) > trackConfigs.etaMax) - continue; - - mcEventHist.fill(HIST("h6RecoMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), kSpAll, kGlobalplusITSonly); - if (track.hasTPC()) { - mcEventHist.fill(HIST("h6RecoMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), kSpAll, kGlobalonly); - } else { - mcEventHist.fill(HIST("h6RecoMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), kSpAll, kITSonly); - } - - int pid = fromPDGToEnum(mcTrack.pdgCode()); - mcEventHist.fill(HIST("h6RecoMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), pid, kGlobalplusITSonly); - } - - for (const auto& mcParticle : mcParticlesThisColl) { - if (!isGenParticleCharged(mcParticle)) - continue; - - mcEventHist.fill(HIST("h6GenMCEtaDistributionReco"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kNoGenpTVar); - if (mcParticle.pt() < trackConfigs.cMinChargedParticlePtcut) { - mcEventHist.fill(HIST("h6GenMCEtaDistributionReco"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup, -10.0f * mcParticle.pt() + 2.0f); - mcEventHist.fill(HIST("h6GenMCEtaDistributionReco"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown, 5.0f * mcParticle.pt() + 0.5f); - } else { - mcEventHist.fill(HIST("h6GenMCEtaDistributionReco"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup); - mcEventHist.fill(HIST("h6GenMCEtaDistributionReco"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown); - } - - int pid = fromPDGToEnum(mcParticle.pdgCode()); - mcEventHist.fill(HIST("h6GenMCEtaDistributionReco"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), pid, kNoGenpTVar); - } - } - - PROCESS_SWITCH(Phik0shortanalysis, processdNdetaWPhiMCReco, "Process function for dN/deta values in MCReco", false); - - void processdNdetaWPhiMCGen(MCCollisions const& mcCollisions, SimCollisions const& collisions, FilteredMCTracks const& filteredMCTracks, aod::McParticles const& mcParticles) + void processdNdetaWPhiMC(MCCollisions const& mcCollisions, SimCollisions const& collisions, FilteredMCTracks const& filteredMCTracks, aod::McParticles const& mcParticles) { std::vector> collsGrouped(mcCollisions.size()); @@ -2708,7 +2641,7 @@ struct Phik0shortanalysis { } for (const auto& mcCollision : mcCollisions) { - auto mcParticlesThisMcColl = mcParticles.sliceBy(preslices.perMCColl, mcCollision.globalIndex()); + auto mcParticlesThisMcColl = mcParticles.sliceBy(preslices.mcPartPerMCCollision, mcCollision.globalIndex()); if (!pwglf::isINELgtNmc(mcParticlesThisMcColl, 0, pdgDB)) continue; @@ -2734,7 +2667,7 @@ struct Phik0shortanalysis { auto collision = collisions.rawIteratorAt(collisionIndex); if (acceptEventQA(collision, false)) { - auto filteredMCTracksThisColl = filteredMCTracks.sliceBy(preslices.perColl, collision.globalIndex()); + auto filteredMCTracksThisColl = filteredMCTracks.sliceBy(preslices.trackPerCollision, collision.globalIndex()); posFiltMCTracks.bindTable(filteredMCTracksThisColl); negFiltMCTracks.bindTable(filteredMCTracksThisColl); @@ -2752,8 +2685,8 @@ struct Phik0shortanalysis { break; } - mcEventHist.fill(HIST("hGenMCRecoMultiplicityPercent"), mcCollision.centFT0M()); - mcEventHist.fill(HIST("h2GenMCRecoVertexZvsMult"), collision.posZ(), mcCollision.centFT0M()); + mcEventHist.fill(HIST("hRecoMCMultiplicityPercent"), mcCollision.centFT0M()); + mcEventHist.fill(HIST("h2RecoMCVertexZvsMult"), collision.posZ(), mcCollision.centFT0M()); zVtxs.push_back(collision.posZ()); @@ -2768,33 +2701,33 @@ struct Phik0shortanalysis { if (!mcTrack.isPhysicalPrimary() || std::abs(mcTrack.eta()) > trackConfigs.etaMax) continue; - mcEventHist.fill(HIST("h6RecoCheckMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), kSpAll, kGlobalplusITSonly); + mcEventHist.fill(HIST("h6RecoMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), kSpAll, kGlobalplusITSonly); if (track.hasTPC()) { - mcEventHist.fill(HIST("h6RecoCheckMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), kSpAll, kGlobalonly); + mcEventHist.fill(HIST("h6RecoMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), kSpAll, kGlobalonly); } else { - mcEventHist.fill(HIST("h6RecoCheckMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), kSpAll, kITSonly); + mcEventHist.fill(HIST("h6RecoMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), kSpAll, kITSonly); } int pid = fromPDGToEnum(mcTrack.pdgCode()); - mcEventHist.fill(HIST("h6RecoCheckMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), pid, kGlobalplusITSonly); + mcEventHist.fill(HIST("h6RecoMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), pid, kGlobalplusITSonly); } if (fillMcPartsForAllReco) { for (const auto& mcParticle : mcParticlesThisMcColl) { - if (!isGenParticleCharged(mcParticle)) + if (!selectionChargedGenParticle(mcParticle)) continue; - mcEventHist.fill(HIST("h6GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kNoGenpTVar); + mcEventHist.fill(HIST("h6GenMCAllAssocRecoEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kNoGenpTVar); if (mcParticle.pt() < trackConfigs.cMinChargedParticlePtcut) { - mcEventHist.fill(HIST("h6GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup, -10.0f * mcParticle.pt() + 2.0f); - mcEventHist.fill(HIST("h6GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown, 5.0f * mcParticle.pt() + 0.5f); + mcEventHist.fill(HIST("h6GenMCAllAssocRecoEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup, -10.0f * mcParticle.pt() + 2.0f); + mcEventHist.fill(HIST("h6GenMCAllAssocRecoEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown, 5.0f * mcParticle.pt() + 0.5f); } else { - mcEventHist.fill(HIST("h6GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup); - mcEventHist.fill(HIST("h6GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown); + mcEventHist.fill(HIST("h6GenMCAllAssocRecoEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup); + mcEventHist.fill(HIST("h6GenMCAllAssocRecoEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown); } int pid = fromPDGToEnum(mcParticle.pdgCode()); - mcEventHist.fill(HIST("h6GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), pid, kNoGenpTVar); + mcEventHist.fill(HIST("h6GenMCAllAssocRecoEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), pid, kNoGenpTVar); } } @@ -2817,7 +2750,7 @@ struct Phik0shortanalysis { } for (const auto& mcParticle : mcParticlesThisMcColl) { - if (!isGenParticleCharged(mcParticle)) + if (!selectionChargedGenParticle(mcParticle)) continue; int pid = fromPDGToEnum(mcParticle.pdgCode()); @@ -2835,21 +2768,21 @@ struct Phik0shortanalysis { if (numberAssocColl > 0) { float zVtxRef = zVtxs[0]; - mcEventHist.fill(HIST("h6GenMCEtaDistributionAssocReco"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kNoGenpTVar); + mcEventHist.fill(HIST("h6GenMCAssocRecoEtaDistribution"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kNoGenpTVar); if (mcParticle.pt() < trackConfigs.cMinChargedParticlePtcut) { - mcEventHist.fill(HIST("h6GenMCEtaDistributionAssocReco"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup, -10.0f * mcParticle.pt() + 2.0f); - mcEventHist.fill(HIST("h6GenMCEtaDistributionAssocReco"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown, 5.0f * mcParticle.pt() + 0.5f); + mcEventHist.fill(HIST("h6GenMCAssocRecoEtaDistribution"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup, -10.0f * mcParticle.pt() + 2.0f); + mcEventHist.fill(HIST("h6GenMCAssocRecoEtaDistribution"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown, 5.0f * mcParticle.pt() + 0.5f); } else { - mcEventHist.fill(HIST("h6GenMCEtaDistributionAssocReco"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup); - mcEventHist.fill(HIST("h6GenMCEtaDistributionAssocReco"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown); + mcEventHist.fill(HIST("h6GenMCAssocRecoEtaDistribution"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup); + mcEventHist.fill(HIST("h6GenMCAssocRecoEtaDistribution"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown); } - mcEventHist.fill(HIST("h6GenMCEtaDistributionAssocReco"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), pid, kNoGenpTVar); + mcEventHist.fill(HIST("h6GenMCAssocRecoEtaDistribution"), zVtxRef, mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), pid, kNoGenpTVar); } } } } - PROCESS_SWITCH(Phik0shortanalysis, processdNdetaWPhiMCGen, "Process function for dN/deta values in MCGen", false); + PROCESS_SWITCH(Phik0shortanalysis, processdNdetaWPhiMC, "Process function for dN/deta values in MC", false); // New 2D analysis procedure void processPhiK0SPionData2D(SelCollisions::iterator const& collision, FullTracks const& fullTracks, FullV0s const& V0s, V0DauTracks const&) @@ -3091,228 +3024,7 @@ struct Phik0shortanalysis { PROCESS_SWITCH(Phik0shortanalysis, processPhiK0SPionMCClosure2D, "Process function for Phi-K0S and Phi-Pion Correlations in MCClosure2D", false); - void processAllPartMCReco(SimCollisions::iterator const& collision, FullMCTracks const& fullMCTracks, FullMCV0s const& V0s, V0DauMCTracks const&, MCCollisions const&, aod::McParticles const& mcParticles) - { - if (!acceptEventQA(collision, false)) - return; - - if (!collision.has_mcCollision()) - return; - - const auto& mcCollision = collision.mcCollision_as(); - float genmultiplicity = mcCollision.centFT0M(); - - // Defining positive and negative tracks for phi reconstruction - auto posThisColl = posMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - auto negThisColl = negMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - - for (const auto& track1 : posThisColl) { // loop over all selected tracks - if (!selectionTrackResonance(track1, false) || !selectionPIDKaonpTdependent(track1)) - continue; // topological and PID selection - - auto track1ID = track1.globalIndex(); - - if (!track1.has_mcParticle()) - continue; - auto mcTrack1 = track1.mcParticle_as(); - if (mcTrack1.pdgCode() != PDG_t::kKPlus || !mcTrack1.isPhysicalPrimary()) - continue; - - for (const auto& track2 : negThisColl) { - if (!selectionTrackResonance(track2, false) || !selectionPIDKaonpTdependent(track2)) - continue; // topological and PID selection - - auto track2ID = track2.globalIndex(); - if (track2ID == track1ID) - continue; // condition to avoid double counting of pair - - if (!track2.has_mcParticle()) - continue; - auto mcTrack2 = track2.mcParticle_as(); - if (mcTrack2.pdgCode() != PDG_t::kKMinus || !mcTrack2.isPhysicalPrimary()) - continue; - - float pTMother = -1.0f; - float yMother = -1.0f; - bool isMCMotherPhi = false; - for (const auto& motherOfMcTrack1 : mcTrack1.mothers_as()) { - for (const auto& motherOfMcTrack2 : mcTrack2.mothers_as()) { - if (motherOfMcTrack1.pdgCode() != motherOfMcTrack2.pdgCode()) - continue; - if (motherOfMcTrack1.globalIndex() != motherOfMcTrack2.globalIndex()) - continue; - if (motherOfMcTrack1.pdgCode() != o2::constants::physics::Pdg::kPhi) - continue; - - pTMother = motherOfMcTrack1.pt(); - yMother = motherOfMcTrack1.y(); - isMCMotherPhi = true; - } - } - - if (!isMCMotherPhi) - continue; - if (pTMother < phiConfigs.minPhiPt || std::abs(yMother) > deltaYConfigs.cfgYAcceptance) - continue; - - mcPhiHist.fill(HIST("h3PhiMCRecoNewProc"), genmultiplicity, pTMother, yMother); - } - } - - for (const auto& v0 : V0s) { - if (!v0.has_mcParticle()) - continue; - - auto v0mcparticle = v0.mcParticle(); - if (v0mcparticle.pdgCode() != PDG_t::kK0Short || !v0mcparticle.isPhysicalPrimary()) - continue; - - const auto& posDaughterTrack = v0.posTrack_as(); - const auto& negDaughterTrack = v0.negTrack_as(); - - if (!selectionV0(v0, posDaughterTrack, negDaughterTrack)) - continue; - if (v0Configs.cfgFurtherV0Selection && !furtherSelectionV0(v0, collision)) - continue; - if (std::abs(v0mcparticle.y()) > deltaYConfigs.cfgYAcceptance) - continue; - - mcK0SHist.fill(HIST("h3K0SMCRecoNewProc"), genmultiplicity, v0mcparticle.pt(), v0mcparticle.y()); - } - - for (const auto& track : fullMCTracks) { - // Pion selection - if (!selectionPion(track, false)) - continue; - - if (!track.has_mcParticle()) - continue; - - auto mcTrack = track.mcParticle_as(); - if (std::abs(mcTrack.pdgCode()) != PDG_t::kPiPlus) - continue; - - if (std::abs(mcTrack.y()) > deltaYConfigs.cfgYAcceptance) - continue; - - // Primary pion selection - if (mcTrack.isPhysicalPrimary()) { - mcPionHist.fill(HIST("h3RecMCDCAxyPrimPi"), track.pt(), track.dcaXY()); - } else { - if (mcTrack.getProcess() == 4) { // Selection of secondary pions from weak decay - mcPionHist.fill(HIST("h3RecMCDCAxySecWeakDecayPi"), track.pt(), track.dcaXY()); - } else { // Selection of secondary pions from material interactions - mcPionHist.fill(HIST("h3RecMCDCAxySecMaterialPi"), track.pt(), track.dcaXY()); - } - continue; - } - - mcPionHist.fill(HIST("h3PiMCRecoNewProc"), genmultiplicity, mcTrack.pt(), mcTrack.y()); - - if (track.pt() >= trackConfigs.pTToUseTOF && !track.hasTOF()) - continue; - - mcPionHist.fill(HIST("h3PiMCReco2NewProc"), genmultiplicity, mcTrack.pt(), mcTrack.y()); - } - - // Defining McParticles in the collision - auto mcParticlesThisColl = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mcCollision.globalIndex(), cache); - - for (const auto& mcParticle : mcParticlesThisColl) { - if (std::abs(mcParticle.y()) > deltaYConfigs.cfgYAcceptance) - continue; - - // Phi selection - if (mcParticle.pdgCode() == o2::constants::physics::Pdg::kPhi && mcParticle.pt() >= phiConfigs.minPhiPt) - mcPhiHist.fill(HIST("h3PhiMCGenRecoCheckNewProc"), genmultiplicity, mcParticle.pt(), mcParticle.y()); - - // K0S selection - if (mcParticle.pdgCode() == PDG_t::kK0Short && mcParticle.isPhysicalPrimary() && mcParticle.pt() >= v0Configs.v0SettingMinPt) - mcK0SHist.fill(HIST("h3K0SMCGenRecoCheckNewProc"), genmultiplicity, mcParticle.pt(), mcParticle.y()); - - // Pion selection - if (std::abs(mcParticle.pdgCode()) == PDG_t::kPiPlus && mcParticle.isPhysicalPrimary() && mcParticle.pt() >= trackConfigs.cMinPionPtcut) - mcPionHist.fill(HIST("h3PiMCGenRecoCheckNewProc"), genmultiplicity, mcParticle.pt(), mcParticle.y()); - } - } - - PROCESS_SWITCH(Phik0shortanalysis, processAllPartMCReco, "Process function for all particles in MCReco", false); - - void processAllPartMCGen(MCCollisions::iterator const& mcCollision, soa::SmallGroups const& collisions, aod::McParticles const& mcParticles) - { - if (std::abs(mcCollision.posZ()) > cutZVertex) - return; - if (!pwglf::isINELgtNmc(mcParticles, 0, pdgDB)) - return; - - float genmultiplicity = mcCollision.centFT0M(); - - uint64_t numberAssocColl = 0; - for (const auto& collision : collisions) { - if (acceptEventQA(collision, false)) { - mcEventHist.fill(HIST("hGenMCRecoMultiplicityPercent"), genmultiplicity); // Event split numerator - - for (const auto& mcParticle : mcParticles) { - // The inclusive number of particles is the signal loss denominator, - // while the number of associated particles is the signal loss numerator - if (std::abs(mcParticle.y()) > deltaYConfigs.cfgYAcceptance) - continue; - - // Phi selection - if (mcParticle.pdgCode() == o2::constants::physics::Pdg::kPhi && mcParticle.pt() >= phiConfigs.minPhiPt) - mcPhiHist.fill(HIST("h3PhiMCGenRecoNewProc"), genmultiplicity, mcParticle.pt(), mcParticle.y()); - - // K0S selection - if (mcParticle.pdgCode() == PDG_t::kK0Short && mcParticle.isPhysicalPrimary() && mcParticle.pt() >= v0Configs.v0SettingMinPt) - mcK0SHist.fill(HIST("h3K0SMCGenRecoNewProc"), genmultiplicity, mcParticle.pt(), mcParticle.y()); - - // Pion selection - if (std::abs(mcParticle.pdgCode()) == PDG_t::kPiPlus && mcParticle.isPhysicalPrimary() && mcParticle.pt() >= trackConfigs.cMinPionPtcut) - mcPionHist.fill(HIST("h3PiMCGenRecoNewProc"), genmultiplicity, mcParticle.pt(), mcParticle.y()); - } - - numberAssocColl++; - } - } - - // The inclusive number of events is the event loss denominator, - // while the number of associated events is the event loss numerator - mcEventHist.fill(HIST("hGenMCMultiplicityPercent"), genmultiplicity); - if (numberAssocColl > 0) - mcEventHist.fill(HIST("hGenMCAssocRecoMultiplicityPercent"), genmultiplicity); - - for (const auto& mcParticle : mcParticles) { - // The inclusive number of particles is the signal loss denominator, - // while the number of associated particles is the signal loss numerator - if (std::abs(mcParticle.y()) > deltaYConfigs.cfgYAcceptance) - continue; - - // Phi selection - if (mcParticle.pdgCode() == o2::constants::physics::Pdg::kPhi && mcParticle.pt() >= phiConfigs.minPhiPt) { - mcPhiHist.fill(HIST("h3PhiMCGenNewProc"), genmultiplicity, mcParticle.pt(), mcParticle.y()); - if (numberAssocColl > 0) - mcPhiHist.fill(HIST("h3PhiMCGenAssocRecoNewProc"), genmultiplicity, mcParticle.pt(), mcParticle.y()); - } - - // K0S selection - if (mcParticle.pdgCode() == PDG_t::kK0Short && mcParticle.isPhysicalPrimary() && mcParticle.pt() >= v0Configs.v0SettingMinPt) { - mcK0SHist.fill(HIST("h3K0SMCGenNewProc"), genmultiplicity, mcParticle.pt(), mcParticle.y()); - if (numberAssocColl > 0) - mcK0SHist.fill(HIST("h3K0SMCGenAssocRecoNewProc"), genmultiplicity, mcParticle.pt(), mcParticle.y()); - } - - // Pion selection - if (std::abs(mcParticle.pdgCode()) == PDG_t::kPiPlus && mcParticle.isPhysicalPrimary() && mcParticle.pt() >= trackConfigs.cMinPionPtcut) { - mcPionHist.fill(HIST("h3PiMCGenNewProc"), genmultiplicity, mcParticle.pt(), mcParticle.y()); - if (numberAssocColl > 0) - mcPionHist.fill(HIST("h3PiMCGenAssocRecoNewProc"), genmultiplicity, mcParticle.pt(), mcParticle.y()); - } - } - } - - PROCESS_SWITCH(Phik0shortanalysis, processAllPartMCGen, "Process function for all particles in MCGen", false); - - void processPhiK0SMixingEvent(SelCollisions const& collisions, FullTracks const& fullTracks, FullV0s const& V0s, V0DauTracks const&) + void processPhiK0SMixingEvent2D(SelCollisions const& collisions, FullTracks const& fullTracks, FullV0s const& V0s, V0DauTracks const&) { auto tracksV0sTuple = std::make_tuple(fullTracks, V0s); Pair pairPhiK0S{binningOnVertexAndCent, cfgNoMixedEvents, -1, collisions, tracksV0sTuple, &cache}; @@ -3361,9 +3073,9 @@ struct Phik0shortanalysis { } } - PROCESS_SWITCH(Phik0shortanalysis, processPhiK0SMixingEvent, "Process Mixed Event for Phi-K0S Analysis", false); + PROCESS_SWITCH(Phik0shortanalysis, processPhiK0SMixingEvent2D, "Process Mixed Event for Phi-K0S Analysis 2D", false); - void processPhiPionMixingEvent(SelCollisions const& collisions, FullTracks const& fullTracks) + void processPhiPionMixingEvent2D(SelCollisions const& collisions, FullTracks const& fullTracks) { auto tracksTuple = std::make_tuple(fullTracks); SameKindPair pairPhiPion{binningOnVertexAndCent, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; @@ -3409,7 +3121,363 @@ struct Phik0shortanalysis { } } - PROCESS_SWITCH(Phik0shortanalysis, processPhiPionMixingEvent, "Process Mixed Event for Phi-Pion Analysis", false); + PROCESS_SWITCH(Phik0shortanalysis, processPhiPionMixingEvent2D, "Process Mixed Event for Phi-Pion Analysis 2D", false); + + void processAllPartMC(MCCollisions const& mcCollisions, SimCollisions const& collisions, FullMCTracks const& fullMCTracks, FullMCV0s const& V0s, V0DauMCTracks const&, aod::McParticles const& mcParticles) + { + + std::vector> collsGrouped(mcCollisions.size()); + + for (const auto& collision : collisions) { + if (!collision.has_mcCollision()) + continue; + const auto& mcCollision = collision.mcCollision_as(); + collsGrouped[mcCollision.globalIndex()].push_back(collision.globalIndex()); + } + + for (const auto& mcCollision : mcCollisions) { + auto mcParticlesThisMcColl = mcParticles.sliceBy(preslices.mcPartPerMCCollision, mcCollision.globalIndex()); + + if (!pwglf::isINELgtNmc(mcParticlesThisMcColl, 0, pdgDB)) + continue; + switch (filterOnGenPhi) { + case 0: + if (!eventHasGenKPair(mcParticlesThisMcColl)) + continue; + break; + case 1: + if (!eventHasGenPhi(mcParticlesThisMcColl)) + continue; + break; + default: + break; + } + + uint64_t numberAssocColl = 0; + std::vector zVtxs; + + auto& collIndexesThisMcColl = collsGrouped[mcCollision.globalIndex()]; + + for (const auto& collisionIndex : collIndexesThisMcColl) { + auto collision = collisions.rawIteratorAt(collisionIndex); + + if (acceptEventQA(collision, false)) { + auto fullMCTracksThisColl = fullMCTracks.sliceBy(preslices.trackPerCollision, collision.globalIndex()); + auto v0sThisColl = V0s.sliceBy(preslices.v0PerCollision, collision.globalIndex()); + + posMCTracks.bindTable(fullMCTracksThisColl); + negMCTracks.bindTable(fullMCTracksThisColl); + + switch (filterOnRecoPhi) { + case 0: + if (!eventHasRecoPhi(posMCTracks, negMCTracks)) + continue; + break; + case 1: + if (!eventHasRecoPhiWPDG(posMCTracks, negMCTracks, mcParticles)) + continue; + break; + default: + break; + } + + mcEventHist.fill(HIST("hRecoMCMultiplicityPercent"), mcCollision.centFT0M()); + mcEventHist.fill(HIST("h2RecoMCVertexZvsMult"), collision.posZ(), mcCollision.centFT0M()); + + zVtxs.push_back(collision.posZ()); + + if ((filterOnGenPhi != 0 && filterOnGenPhi != 1) && (filterOnRecoPhi != 0 && filterOnRecoPhi != 1)) { + for (const auto& track1 : posMCTracks) { // loop over all selected tracks + if (!selectionTrackResonance(track1, false) || !selectionPIDKaonpTdependent(track1)) + continue; // topological and PID selection + + auto track1ID = track1.globalIndex(); + + if (!track1.has_mcParticle()) + continue; + auto mcTrack1 = mcParticles.rawIteratorAt(track1.mcParticleId()); + if (mcTrack1.pdgCode() != PDG_t::kKPlus || !mcTrack1.isPhysicalPrimary()) + continue; + + for (const auto& track2 : negMCTracks) { + if (!selectionTrackResonance(track2, false) || !selectionPIDKaonpTdependent(track2)) + continue; // topological and PID selection + + auto track2ID = track2.globalIndex(); + if (track2ID == track1ID) + continue; // condition to avoid double counting of pair + + if (!track2.has_mcParticle()) + continue; + auto mcTrack2 = mcParticles.rawIteratorAt(track2.mcParticleId()); + if (mcTrack2.pdgCode() != PDG_t::kKMinus || !mcTrack2.isPhysicalPrimary()) + continue; + + const auto mcTrack1MotherIndexes = mcTrack1.mothersIds(); + const auto mcTrack2MotherIndexes = mcTrack2.mothersIds(); + + float pTMother = -1.0f; + float yMother = -1.0f; + bool isMCMotherPhi = false; + + for (const auto& mcTrack1MotherIndex : mcTrack1MotherIndexes) { + for (const auto& mcTrack2MotherIndex : mcTrack2MotherIndexes) { + if (mcTrack1MotherIndex != mcTrack2MotherIndex) + continue; + + const auto mother = mcParticles.rawIteratorAt(mcTrack1MotherIndex); + if (mother.pdgCode() != o2::constants::physics::Pdg::kPhi) + continue; + + pTMother = mother.pt(); + yMother = mother.y(); + isMCMotherPhi = true; + } + } + + if (!isMCMotherPhi) + continue; + if (pTMother < phiConfigs.minPhiPt || std::abs(yMother) > deltaYConfigs.cfgYAcceptance) + continue; + + mcPhiHist.fill(HIST("h4PhiMCRecoNewProc"), collision.posZ(), mcCollision.centFT0M(), pTMother, yMother); + } + } + } + + for (const auto& v0 : v0sThisColl) { + if (!v0.has_mcParticle()) + continue; + + auto v0mcparticle = mcParticles.rawIteratorAt(v0.mcParticleId()); + if (v0mcparticle.pdgCode() != PDG_t::kK0Short || !v0mcparticle.isPhysicalPrimary()) + continue; + + const auto& posDaughterTrack = v0.posTrack_as(); + const auto& negDaughterTrack = v0.negTrack_as(); + + if (!selectionV0(v0, posDaughterTrack, negDaughterTrack)) + continue; + if (v0Configs.cfgFurtherV0Selection && !furtherSelectionV0(v0, collision)) + continue; + if (std::abs(v0mcparticle.y()) > deltaYConfigs.cfgYAcceptance) + continue; + + mcK0SHist.fill(HIST("h4K0SMCRecoNewProc"), collision.posZ(), mcCollision.centFT0M(), v0mcparticle.pt(), v0mcparticle.y()); + } + + for (const auto& track : fullMCTracksThisColl) { + // Pion selection + if (!selectionPion(track, false)) + continue; + + if (!track.has_mcParticle()) + continue; + + auto mcTrack = mcParticles.rawIteratorAt(track.mcParticleId()); + if (std::abs(mcTrack.pdgCode()) != PDG_t::kPiPlus) + continue; + + if (std::abs(mcTrack.y()) > deltaYConfigs.cfgYAcceptance) + continue; + + // Primary pion selection + if (mcTrack.isPhysicalPrimary()) { + mcPionHist.fill(HIST("h3RecMCDCAxyPrimPi"), track.pt(), track.dcaXY()); + } else { + if (mcTrack.getProcess() == 4) { // Selection of secondary pions from weak decay + mcPionHist.fill(HIST("h3RecMCDCAxySecWeakDecayPi"), track.pt(), track.dcaXY()); + } else { // Selection of secondary pions from material interactions + mcPionHist.fill(HIST("h3RecMCDCAxySecMaterialPi"), track.pt(), track.dcaXY()); + } + continue; + } + + mcPionHist.fill(HIST("h4PiMCRecoNewProc"), collision.posZ(), mcCollision.centFT0M(), mcTrack.pt(), mcTrack.y()); + + if (track.pt() >= trackConfigs.pTToUseTOF && !track.hasTOF()) + continue; + + mcPionHist.fill(HIST("h4PiMCReco2NewProc"), collision.posZ(), mcCollision.centFT0M(), mcTrack.pt(), mcTrack.y()); + } + + numberAssocColl++; + } + } + + mcEventHist.fill(HIST("hGenMCMultiplicityPercent"), mcCollision.centFT0M()); + + if (numberAssocColl > 0) { + float zVtxRef = zVtxs[0]; + if (zVtxs.size() > 1) { + for (size_t i = 1; i < zVtxs.size(); ++i) { + mcEventHist.fill(HIST("hSplitVertexZ"), zVtxs[i] - zVtxRef); + } + } + + mcEventHist.fill(HIST("hGenMCAssocRecoMultiplicityPercent"), mcCollision.centFT0M()); + mcEventHist.fill(HIST("h2GenMCAssocRecoVertexZvsMult"), zVtxRef, mcCollision.centFT0M()); + } + + for (const auto& mcParticle : mcParticlesThisMcColl) { + if (std::abs(mcParticle.y()) > deltaYConfigs.cfgYAcceptance) + continue; + + if (filterOnGenPhi != 0 && filterOnGenPhi != 1) { + // Phi selection + if (mcParticle.pdgCode() == o2::constants::physics::Pdg::kPhi && mcParticle.pt() >= phiConfigs.minPhiPt) { + mcPhiHist.fill(HIST("h3PhiMCGenNewProc"), mcCollision.centFT0M(), mcParticle.pt(), mcParticle.y()); + if (numberAssocColl > 0) { + float zVtxRef = zVtxs[0]; + mcPhiHist.fill(HIST("h4PhiMCGenAssocRecoNewProc"), zVtxRef, mcCollision.centFT0M(), mcParticle.pt(), mcParticle.y()); + } + } + } + + // K0S selection + if (mcParticle.pdgCode() == PDG_t::kK0Short && mcParticle.isPhysicalPrimary() && mcParticle.pt() >= v0Configs.v0SettingMinPt) { + mcK0SHist.fill(HIST("h3K0SMCGenNewProc"), mcCollision.centFT0M(), mcParticle.pt(), mcParticle.y()); + if (numberAssocColl > 0) { + float zVtxRef = zVtxs[0]; + mcK0SHist.fill(HIST("h4K0SMCGenAssocRecoNewProc"), zVtxRef, mcCollision.centFT0M(), mcParticle.pt(), mcParticle.y()); + } + } + + // Pion selection + if (std::abs(mcParticle.pdgCode()) == PDG_t::kPiPlus && mcParticle.isPhysicalPrimary() && mcParticle.pt() >= trackConfigs.cMinPionPtcut) { + mcPionHist.fill(HIST("h3PiMCGenNewProc"), mcCollision.centFT0M(), mcParticle.pt(), mcParticle.y()); + if (numberAssocColl > 0) { + float zVtxRef = zVtxs[0]; + mcPionHist.fill(HIST("h4PiMCGenAssocRecoNewProc"), zVtxRef, mcCollision.centFT0M(), mcParticle.pt(), mcParticle.y()); + } + } + } + } + } + + PROCESS_SWITCH(Phik0shortanalysis, processAllPartMC, "Process function for all particles (not for phi if triggered on it) in MC", false); + + // New 2D analysis procedure + void processPhiK0SPionDeltayDeltaphiData2D(SelCollisions::iterator const& collision, FullTracks const& fullTracks, FullV0s const& V0s, V0DauTracks const&) + { + // Check if the event selection is passed + if (!acceptEventQA(collision, true)) + return; + + float multiplicity = collision.centFT0M(); + dataEventHist.fill(HIST("hMultiplicityPercent"), multiplicity); + + // Defining positive and negative tracks for phi reconstruction + auto posThisColl = posTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + auto negThisColl = negTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + + if (!eventHasRecoPhi(posThisColl, negThisColl)) + return; + + dataEventHist.fill(HIST("hEventSelection"), 4); // at least a Phi candidate in the event + + bool isCountedPhi = false; + bool isFilledhV0 = false; + + // Loop over all positive tracks + for (const auto& track1 : posThisColl) { + if (!selectionTrackResonance(track1, true) || !selectionPIDKaonpTdependent(track1)) + continue; // topological and PID selection + + dataPhiHist.fill(HIST("hEta"), track1.eta()); + dataPhiHist.fill(HIST("hNsigmaKaonTPC"), track1.tpcInnerParam(), track1.tpcNSigmaKa()); + dataPhiHist.fill(HIST("hNsigmaKaonTOF"), track1.tpcInnerParam(), track1.tofNSigmaKa()); + + auto track1ID = track1.globalIndex(); + + // Loop over all negative tracks + for (const auto& track2 : negThisColl) { + if (!selectionTrackResonance(track2, true) || !selectionPIDKaonpTdependent(track2)) + continue; // topological and PID selection + + auto track2ID = track2.globalIndex(); + if (track2ID == track1ID) + continue; // condition to avoid double counting of pair + + ROOT::Math::PxPyPzMVector recPhi = recMother(track1, track2, massKa, massKa); + if (recPhi.Pt() < phiConfigs.minPhiPt) + continue; + if (recPhi.M() < phiConfigs.lowMPhi || recPhi.M() > phiConfigs.upMPhi) + continue; + if (std::abs(recPhi.Rapidity()) > deltaYConfigs.cfgYAcceptance) + continue; + + if (!isCountedPhi) + isCountedPhi = true; + + float efficiencyPhi = 1.0f; + if (applyEfficiency) { + efficiencyPhi = effMapPhi->Interpolate(multiplicity, recPhi.Pt(), recPhi.Rapidity()); + if (efficiencyPhi == 0) + efficiencyPhi = 1.0f; + } + float weightPhi = applyEfficiency ? 1.0f / efficiencyPhi : 1.0f; + dataPhiHist.fill(HIST("h3PhiDataNewProc"), multiplicity, recPhi.Pt(), recPhi.M(), weightPhi); + + // V0 already reconstructed by the builder + for (const auto& v0 : V0s) { + const auto& posDaughterTrack = v0.posTrack_as(); + const auto& negDaughterTrack = v0.negTrack_as(); + + // Cut on V0 dynamic columns + if (!selectionV0(v0, posDaughterTrack, negDaughterTrack)) + continue; + if (v0Configs.cfgFurtherV0Selection && !furtherSelectionV0(v0, collision)) + continue; + + if (!isFilledhV0) { + dataK0SHist.fill(HIST("hDCAV0Daughters"), v0.dcaV0daughters()); + dataK0SHist.fill(HIST("hV0CosPA"), v0.v0cosPA()); + + // Filling the PID of the V0 daughters in the region of the K0 peak + if (v0Configs.lowMK0S < v0.mK0Short() && v0.mK0Short() < v0Configs.upMK0S) { + dataK0SHist.fill(HIST("hNSigmaPosPionFromK0S"), posDaughterTrack.tpcInnerParam(), posDaughterTrack.tpcNSigmaPi()); + dataK0SHist.fill(HIST("hNSigmaNegPionFromK0S"), negDaughterTrack.tpcInnerParam(), negDaughterTrack.tpcNSigmaPi()); + } + } + + if (std::abs(v0.yK0Short()) > deltaYConfigs.cfgYAcceptance) + continue; + + float efficiencyPhiK0S = 1.0f; + if (applyEfficiency) { + efficiencyPhiK0S = effMapPhi->Interpolate(multiplicity, recPhi.Pt(), recPhi.Rapidity()) * effMapK0S->Interpolate(multiplicity, v0.pt(), v0.yK0Short()); + if (efficiencyPhiK0S == 0) + efficiencyPhiK0S = 1.0f; + } + float weightPhiK0S = applyEfficiency ? 1.0f / efficiencyPhiK0S : 1.0f; + dataPhiK0SHist.fill(HIST("h5PhiK0SData2PartCorr"), multiplicity, recPhi.Pt(), v0.pt(), recPhi.Rapidity() - v0.yK0Short(), recPhi.Phi() - v0.phi(), weightPhiK0S); + } + + isFilledhV0 = true; + + // Loop over all primary pion candidates + for (const auto& track : fullTracks) { + if (!selectionPion(track, false)) + continue; + + if (std::abs(track.rapidity(massPi)) > deltaYConfigs.cfgYAcceptance) + continue; + + float efficiencyPhiPion = 1.0f; + if (applyEfficiency) { + efficiencyPhiPion = track.pt() < trackConfigs.pTToUseTOF ? effMapPhi->Interpolate(multiplicity, recPhi.Pt(), recPhi.Rapidity()) * effMapPionTPC->Interpolate(multiplicity, track.pt(), track.rapidity(massPi)) : effMapPhi->Interpolate(multiplicity, recPhi.Pt(), recPhi.Rapidity()) * effMapPionTPCTOF->Interpolate(multiplicity, track.pt(), track.rapidity(massPi)); + if (efficiencyPhiPion == 0) + efficiencyPhiPion = 1.0f; + } + float weightPhiPion = applyEfficiency ? 1.0f / efficiencyPhiPion : 1.0f; + dataPhiPionHist.fill(HIST("h5PhiPiData2PartCorr"), multiplicity, recPhi.Pt(), track.pt(), recPhi.Rapidity() - track.rapidity(massPi), recPhi.Phi() - track.phi(), weightPhiPion); + } + } + } + } + + PROCESS_SWITCH(Phik0shortanalysis, processPhiK0SPionDeltayDeltaphiData2D, "Process function for Phi-K0S and Phi-Pion Deltay and Deltaphi 2D Correlations in Data", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 5d1318743a83946452fb36107baf497873aaf9b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Mon, 22 Sep 2025 16:26:44 +0200 Subject: [PATCH 492/986] [PWGLF] Add systematic mapping analysis task (#13075) - add prototask --- PWGLF/Tasks/QC/CMakeLists.txt | 5 + PWGLF/Tasks/QC/systematicsMapping.cxx | 152 ++++++++++++++++++++++++++ 2 files changed, 157 insertions(+) create mode 100644 PWGLF/Tasks/QC/systematicsMapping.cxx diff --git a/PWGLF/Tasks/QC/CMakeLists.txt b/PWGLF/Tasks/QC/CMakeLists.txt index 126ec29b3e5..f1f1417d9cd 100644 --- a/PWGLF/Tasks/QC/CMakeLists.txt +++ b/PWGLF/Tasks/QC/CMakeLists.txt @@ -138,4 +138,9 @@ o2physics_add_dpl_workflow(its-tpc-matching-vzeros o2physics_add_dpl_workflow(v0assoqa SOURCES v0assoqa.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter KFParticle::KFParticle O2Physics::TPCDriftManager + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(systematics-mapping + SOURCES systematicsMapping.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) \ No newline at end of file diff --git a/PWGLF/Tasks/QC/systematicsMapping.cxx b/PWGLF/Tasks/QC/systematicsMapping.cxx new file mode 100644 index 00000000000..b4e2a3a5a29 --- /dev/null +++ b/PWGLF/Tasks/QC/systematicsMapping.cxx @@ -0,0 +1,152 @@ +// 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 systematicsMapping.cxx +/// \brief Task to perform a systematics study for K0s and charged Kaons +/// \author Nicolò Jacazio, Universita del Piemonte Orientale (IT) +/// \since September 22, 2025 + +#include "PWGLF/DataModel/LFStrangenessTables.h" + +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" + +#include +#include +#include +#include +#include + +#include + +using namespace o2; +using namespace o2::framework; + +struct SystematicsMapping { + // Returns a unique index for the combination of cuts + ConfigurableAxis ptBins{"ptBins", {100, 0.f, 10.f}, "Binning for pT (GeV/c)"}; + ConfigurableAxis etaBins{"etaBins", {40, -1.0f, 1.0f}, "Binning for #eta"}; + ConfigurableAxis phiBins{"phiBins", {36, 0.f, o2::constants::math::TwoPI}, "Binning for #phi (rad)"}; + // Define the Signal axis + ConfigurableAxis invariantMassBins{"invariantMassBins", {100, -0.1f, 0.1f}, "Binning for the invariant mass (GeV/c^2)"}; + ConfigurableAxis nsigmaBins{"nsigmaBins", {100, -10.f, 10.f}, "Binning for nSigma"}; + // Selection bins + ConfigurableAxis tpcClusterBins{"tpcClusterBins", {5, 70, 100, 120, 135, 150}, "Min TPC clusters for tracks"}; + ConfigurableAxis itsClustersBins{"itsClustersBins", {5, 0, 6}, "Min ITS clusters for tracks"}; + // Selection configurables + Configurable selectionPosZ{"selectionPosZ", 10.f, "Max |z| of the primary vertex"}; + + HistogramRegistry registry{"registry"}; + + template + bool isCollisionSelected(T const& collision) + { + return collision.sel8() && std::abs(collision.posZ()) <= selectionPosZ; + } + + void init(InitContext const&) + { + const AxisSpec ptAxis{ptBins, "#it{p}_{T} (GeV/c)"}; + const AxisSpec etaAxis{etaBins, "#eta"}; + const AxisSpec phiAxis{phiBins, "#phi (rad)"}; + + if (doprocessData) { + + // First we define the histograms on which we are cutting (tpc clusters, its clusters, ..) + registry.add("K/hTPCClusters", "", HistType::kTH1F, {{100, 0, 200}}); + registry.add("K/hITSClusters", "", HistType::kTH1F, {{10, 0, 10}}); + registry.addClone("K/", "K0s/"); + + // Add the signal histograms + registry.add("K/SignalPositive", "", HistType::kTHnSparseF, {ptBins, etaBins, phiBins, nsigmaBins, tpcClusterBins, itsClustersBins}); + registry.add("K/SignalNegative", "", HistType::kTHnSparseF, {ptBins, etaBins, phiBins, nsigmaBins, tpcClusterBins, itsClustersBins}); + registry.add("K0s/Signal", "", HistType::kTHnSparseF, {ptBins, etaBins, phiBins, invariantMassBins, tpcClusterBins, itsClustersBins}); + } + + if (doprocessMc) { + registry.add("K/GeneratedPositive", "", HistType::kTHnSparseF, {ptBins, etaBins, phiBins}); + registry.add("K/GeneratedNegative", "", HistType::kTHnSparseF, {ptBins, etaBins, phiBins}); + registry.add("K0s/Generated", "", HistType::kTHnSparseF, {ptBins, etaBins, phiBins}); + } + } + + using TrackType = soa::Join; + using CollisionType = soa::Join; + + void processData(CollisionType const& collisions, + TrackType const& tracks, + aod::V0Datas const& v0s) + { + for (const auto& collision : collisions) { + if (isCollisionSelected(collision)) + continue; // MB selection + + // Kaon loop + for (const auto& track : tracks) { + if (track.collisionId() != collision.globalIndex()) + continue; + registry.fill(HIST("hTPCClusters"), track.tpcNClsFound()); + registry.fill(HIST("hITSClusters"), track.itsNCls()); + if (track.sign() > 0) + registry.fill(HIST("K/SignalPositive"), track.pt(), track.eta(), track.phi(), track.tpcNSigmaKa(), track.tpcNClsFound(), track.itsNCls()); + else + registry.fill(HIST("K/SignalNegative"), track.pt(), track.eta(), track.phi(), track.tpcNSigmaKa(), track.tpcNClsFound(), track.itsNCls()); + } + + // K0s loop + for (const auto& v0 : v0s) { + if (v0.collisionId() != collision.globalIndex()) + continue; + const auto& posTrack = v0.posTrack_as(); + const auto& negTrack = v0.negTrack_as(); + registry.fill(HIST("K0s/Signal"), v0.pt(), v0.eta(), v0.phi(), v0.mK0Short() - constants::physics::MassK0Short, std::min(posTrack.tpcNClsFound(), negTrack.tpcNClsFound()), std::min(posTrack.itsNCls(), negTrack.itsNCls())); + } + } + } + PROCESS_SWITCH(SystematicsMapping, processData, "Systematics study for K0s and charged Kaons", true); + + void processMc(soa::Join const& collisions, + aod::McParticles const& particles, + aod::McCollisions const&) + { + for (const auto& collision : collisions) { + if (!isCollisionSelected(collision)) + continue; // MB selection + if (!collision.has_mcCollision()) + continue; + const auto& mcCollision = collision.mcCollision(); + + for (const auto& particle : particles) { + if (particle.mcCollisionId() != mcCollision.globalIndex()) + continue; + if (!particle.isPhysicalPrimary()) + continue; + switch (particle.pdgCode()) { + case 321: // K+ + registry.fill(HIST("K/GeneratedPositive"), particle.pt(), particle.eta(), particle.phi()); + break; + case -321: // K- + registry.fill(HIST("K/GeneratedNegative"), particle.pt(), particle.eta(), particle.phi()); + break; + case 310: // K0s + registry.fill(HIST("K0s/Generated"), particle.pt(), particle.eta(), particle.phi()); + break; + default: + break; + } + } + } + } + PROCESS_SWITCH(SystematicsMapping, processMc, "Systematics study for K0s and charged Kaons on MC", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } From b70855b7096d4443bec1028ee69dedfae6add0e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Mon, 22 Sep 2025 18:20:49 +0200 Subject: [PATCH 493/986] [ALICE3] A3: Update LUT fetching in TOF and RICH (#13080) - remove configurable --- ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx | 114 +++++++------------ ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx | 109 +++++++----------- 2 files changed, 87 insertions(+), 136 deletions(-) diff --git a/ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx b/ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx index 79279bbc70e..9ccc09b3a5d 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx @@ -38,31 +38,31 @@ #include "Common/Core/trackUtilities.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "CCDB/BasicCCDBManager.h" -#include "CCDB/CcdbApi.h" -#include "CommonConstants/GeomConstants.h" -#include "CommonConstants/MathConstants.h" -#include "CommonConstants/PhysicsConstants.h" -#include "CommonUtils/NameConf.h" -#include "DataFormatsCalibration/MeanVertexObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DetectorsBase/GeometryManager.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsVertexing/HelixHelper.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/DCA.h" -#include "ReconstructionDataFormats/PID.h" - -#include "TRandom3.h" -#include "TString.h" -#include "TVector3.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include +#include +#include +#include #include #include @@ -80,6 +80,8 @@ struct OnTheFlyRichPid { // necessary for particle charges Service pdg; + // Necessary for LUTs + Service ccdb; // master setting: magnetic field Configurable magneticField{"magneticField", 0, "magnetic field (kilogauss) if 0, taken from the tracker task"}; @@ -131,14 +133,6 @@ struct OnTheFlyRichPid { Configurable bRICHPixelSize{"bRICHPixelSize", 0.1, "barrel RICH pixel size (cm)"}; Configurable bRichGapRefractiveIndex{"bRichGapRefractiveIndex", 1.000283, "barrel RICH gap refractive index"}; - struct : ConfigurableGroup { - Configurable lutEl{"lutEl", "inherit", "LUT for electrons (if inherit, inherits from otf tracker task)"}; - Configurable lutMu{"lutMu", "inherit", "LUT for muons (if inherit, inherits from otf tracker task)"}; - Configurable lutPi{"lutPi", "inherit", "LUT for pions (if inherit, inherits from otf tracker task)"}; - Configurable lutKa{"lutKa", "inherit", "LUT for kaons (if inherit, inherits from otf tracker task)"}; - Configurable lutPr{"lutPr", "inherit", "LUT for protons (if inherit, inherits from otf tracker task)"}; - } simConfig; - o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; // Track smearer (here used to get relative pt and eta uncertainties) @@ -304,47 +298,27 @@ struct OnTheFlyRichPid { LOG(info) << "Bz = " << magneticField.value << " T"; } - // Check if inheriting the LUT configuration - auto configLutPath = [&](Configurable& lut) { - if (lut.value != "inherit") { - return; - } - if (!getTaskOptionValue(initContext, "on-the-fly-tracker", lut, false)) { - LOG(fatal) << "Could not get " << lut.name << " from on-the-fly-tracker task"; - } - }; - configLutPath(simConfig.lutEl); - configLutPath(simConfig.lutMu); - configLutPath(simConfig.lutPi); - configLutPath(simConfig.lutKa); - configLutPath(simConfig.lutPr); - // Load LUT for pt and eta smearing if (flagIncludeTrackAngularRes && flagRICHLoadDelphesLUTs) { - std::map mapPdgLut; - const char* lutElChar = simConfig.lutEl->c_str(); - const char* lutMuChar = simConfig.lutMu->c_str(); - const char* lutPiChar = simConfig.lutPi->c_str(); - const char* lutKaChar = simConfig.lutKa->c_str(); - const char* lutPrChar = simConfig.lutPr->c_str(); - - LOGF(info, "Will load electron lut file ..: %s for RICH PID", lutElChar); - LOGF(info, "Will load muon lut file ......: %s for RICH PID", lutMuChar); - LOGF(info, "Will load pion lut file ......: %s for RICH PID", lutPiChar); - LOGF(info, "Will load kaon lut file ......: %s for RICH PID", lutKaChar); - LOGF(info, "Will load proton lut file ....: %s for RICH PID", lutPrChar); - - mapPdgLut.insert(std::make_pair(11, lutElChar)); - mapPdgLut.insert(std::make_pair(13, lutMuChar)); - mapPdgLut.insert(std::make_pair(211, lutPiChar)); - mapPdgLut.insert(std::make_pair(321, lutKaChar)); - mapPdgLut.insert(std::make_pair(2212, lutPrChar)); - - for (const auto& e : mapPdgLut) { - if (!mSmearer.loadTable(e.first, e.second)) { - LOG(fatal) << "Having issue with loading the LUT " << e.first << " " << e.second; + mSmearer.setCcdbManager(ccdb.operator->()); + auto loadLUT = [&](int pdg, const std::string& cfgNameToInherit) { + std::string lut = "none"; + if (!getTaskOptionValue(initContext, "on-the-fly-tracker", cfgNameToInherit, lut, false)) { + LOG(fatal) << "Could not get " << cfgNameToInherit << " from on-the-fly-tracker task"; } - } + bool success = mSmearer.loadTable(pdg, lut.c_str()); + if (!success && !lut.empty()) { + LOG(fatal) << "Having issue with loading the LUT " << pdg << " " << lut; + } + }; + loadLUT(11, "lutEl"); + loadLUT(13, "lutMu"); + loadLUT(211, "lutPi"); + loadLUT(321, "lutKa"); + loadLUT(2212, "lutPr"); + loadLUT(1000010020, "lutDe"); + loadLUT(1000010030, "lutTr"); + loadLUT(1000020030, "lutHe3"); } if (doQAplots) { diff --git a/ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx b/ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx index 4c062fd0e7a..b28d48d92ff 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx @@ -32,30 +32,30 @@ #include "Common/Core/trackUtilities.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "CCDB/BasicCCDBManager.h" -#include "CCDB/CcdbApi.h" -#include "CommonConstants/GeomConstants.h" -#include "CommonConstants/MathConstants.h" -#include "CommonConstants/PhysicsConstants.h" -#include "CommonUtils/NameConf.h" -#include "DataFormatsCalibration/MeanVertexObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DetectorsBase/GeometryManager.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsVertexing/HelixHelper.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/DCA.h" - -#include "TEfficiency.h" -#include "THashList.h" -#include "TRandom3.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include #include +#include #include #include @@ -81,6 +81,8 @@ struct OnTheFlyTofPid { // necessary for particle charges Service pdg; + // Necessary for LUTs + Service ccdb; // these are the settings governing the TOF layers to be used // note that there are two layers foreseen for now: inner and outer TOF @@ -97,11 +99,6 @@ struct OnTheFlyTofPid { Configurable multiplicityEtaRange{"multiplicityEtaRange", 0.800000012, "eta range to compute the multiplicity"}; Configurable flagIncludeTrackTimeRes{"flagIncludeTrackTimeRes", true, "flag to include or exclude track time resolution"}; Configurable flagTOFLoadDelphesLUTs{"flagTOFLoadDelphesLUTs", false, "flag to load Delphes LUTs for tracking correction (use recoTrack parameters if false)"}; - Configurable lutEl{"lutEl", "inherit", "LUT for electrons (if inherit, inherits from otf tracker task)"}; - Configurable lutMu{"lutMu", "inherit", "LUT for muons (if inherit, inherits from otf tracker task)"}; - Configurable lutPi{"lutPi", "inherit", "LUT for pions (if inherit, inherits from otf tracker task)"}; - Configurable lutKa{"lutKa", "inherit", "LUT for kaons (if inherit, inherits from otf tracker task)"}; - Configurable lutPr{"lutPr", "inherit", "LUT for protons (if inherit, inherits from otf tracker task)"}; } simConfig; struct : ConfigurableGroup { @@ -151,47 +148,27 @@ struct OnTheFlyTofPid { LOG(info) << "Bz = " << simConfig.magneticField.value << " T"; } - // Check if inheriting the LUT configuration - auto configLutPath = [&](Configurable& lut) { - if (lut.value != "inherit") { - return; - } - if (!getTaskOptionValue(initContext, "on-the-fly-tracker", lut, false)) { - LOG(fatal) << "Could not get " << lut.name << " from on-the-fly-tracker task"; - } - }; - configLutPath(simConfig.lutEl); - configLutPath(simConfig.lutMu); - configLutPath(simConfig.lutPi); - configLutPath(simConfig.lutKa); - configLutPath(simConfig.lutPr); - // Load LUT for pt and eta smearing if (simConfig.flagIncludeTrackTimeRes && simConfig.flagTOFLoadDelphesLUTs) { - std::map mapPdgLut; - const char* lutElChar = simConfig.lutEl->c_str(); - const char* lutMuChar = simConfig.lutMu->c_str(); - const char* lutPiChar = simConfig.lutPi->c_str(); - const char* lutKaChar = simConfig.lutKa->c_str(); - const char* lutPrChar = simConfig.lutPr->c_str(); - - LOGF(info, "Will load electron lut file ..: %s for TOF PID", lutElChar); - LOGF(info, "Will load muon lut file ......: %s for TOF PID", lutMuChar); - LOGF(info, "Will load pion lut file ......: %s for TOF PID", lutPiChar); - LOGF(info, "Will load kaon lut file ......: %s for TOF PID", lutKaChar); - LOGF(info, "Will load proton lut file ....: %s for TOF PID", lutPrChar); - - mapPdgLut.insert(std::make_pair(11, lutElChar)); - mapPdgLut.insert(std::make_pair(13, lutMuChar)); - mapPdgLut.insert(std::make_pair(211, lutPiChar)); - mapPdgLut.insert(std::make_pair(321, lutKaChar)); - mapPdgLut.insert(std::make_pair(2212, lutPrChar)); - - for (const auto& e : mapPdgLut) { - if (!mSmearer.loadTable(e.first, e.second)) { - LOG(fatal) << "Having issue with loading the LUT " << e.first << " " << e.second; + mSmearer.setCcdbManager(ccdb.operator->()); + auto loadLUT = [&](int pdg, const std::string& cfgNameToInherit) { + std::string lut = "none"; + if (!getTaskOptionValue(initContext, "on-the-fly-tracker", cfgNameToInherit, lut, false)) { + LOG(fatal) << "Could not get " << cfgNameToInherit << " from on-the-fly-tracker task"; } - } + bool success = mSmearer.loadTable(pdg, lut.c_str()); + if (!success && !lut.empty()) { + LOG(fatal) << "Having issue with loading the LUT " << pdg << " " << lut; + } + }; + loadLUT(11, "lutEl"); + loadLUT(13, "lutMu"); + loadLUT(211, "lutPi"); + loadLUT(321, "lutKa"); + loadLUT(2212, "lutPr"); + loadLUT(1000010020, "lutDe"); + loadLUT(1000010030, "lutTr"); + loadLUT(1000020030, "lutHe3"); } if (plotsConfig.doQAplots) { From de48e06b162d73bad6f7a716c546647b9fd8f50c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Mon, 22 Sep 2025 18:43:14 +0200 Subject: [PATCH 494/986] [ALICE3] Remove A3 TOF (legacy) (#13079) --- ALICE3/TableProducer/CMakeLists.txt | 5 - ALICE3/TableProducer/alice3-pidTOF.cxx | 324 ------------------------- 2 files changed, 329 deletions(-) delete mode 100644 ALICE3/TableProducer/alice3-pidTOF.cxx diff --git a/ALICE3/TableProducer/CMakeLists.txt b/ALICE3/TableProducer/CMakeLists.txt index d0b7afce076..51a74195377 100644 --- a/ALICE3/TableProducer/CMakeLists.txt +++ b/ALICE3/TableProducer/CMakeLists.txt @@ -21,11 +21,6 @@ o2physics_add_dpl_workflow(alice3-trackextension PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::ReconstructionDataFormats COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(alice3-pid-tof - SOURCES alice3-pidTOF.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::ALICE3Core - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(alice3-centrality SOURCES alice3-centrality.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore diff --git a/ALICE3/TableProducer/alice3-pidTOF.cxx b/ALICE3/TableProducer/alice3-pidTOF.cxx deleted file mode 100644 index 3e54b1f46dc..00000000000 --- a/ALICE3/TableProducer/alice3-pidTOF.cxx +++ /dev/null @@ -1,324 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// -/// \file alice3-pidTOF.cxx -/// \author Nicolò Jacazio nicolo.jacazio@cern.ch -/// \brief Task to produce PID tables for TOF split for each particle. -/// Only the tables for the mass hypotheses requested are filled, the others are sent empty. -/// - -// O2 includes -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "ReconstructionDataFormats/Track.h" -#include "CCDB/BasicCCDBManager.h" -#include "Common/DataModel/PIDResponse.h" -#include "ALICE3/Core/TOFResoALICE3.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/StaticFor.h" - -using namespace o2; -using namespace o2::framework; -using namespace o2::pid; -using namespace o2::framework::expressions; -using namespace o2::track; - -void customize(std::vector& workflowOptions) -{ - std::vector options{{"add-qa", VariantType::Int, 0, {"Produce TOF PID QA histograms"}}}; - std::swap(workflowOptions, options); -} - -#include "Framework/runDataProcessing.h" - -struct ALICE3tofSignal { /// Task that produces the TOF signal from the trackTime - Produces table; - bool enableTable = false; - - void init(o2::framework::InitContext& initContext) - { - // Checking the tables are requested in the workflow and enabling them - auto& workflows = initContext.services().get(); - for (DeviceSpec const& device : workflows.devices) { - for (auto const& input : device.inputs) { - const std::string table = "TOFSignal"; - if (input.matcher.binding == table) { - enableTable = true; - } - } - } - } - using Trks = soa::Join; - void process(Trks const& tracks) - { - if (!enableTable) { - return; - } - table.reserve(tracks.size()); - for (auto& t : tracks) { - table(t.trackTime() * 1000.f); - } - } -}; - -struct ALICE3pidTOFTask { - using Trks = soa::Join; - using Coll = aod::Collisions; - // Tables to produce - Produces tablePIDEl; - Produces tablePIDMu; - Produces tablePIDPi; - Produces tablePIDKa; - Produces tablePIDPr; - Produces tablePIDDe; - Produces tablePIDTr; - Produces tablePIDHe; - Produces tablePIDAl; - Parameters resoParameters{1}; - Service ccdb; - Configurable paramfile{"param-file", "", "Path to the parametrization object, if empty the parametrization is not taken from file"}; - Configurable sigmaname{"param-sigma", "TOFResoALICE3", "Name of the parametrization for the expected sigma, used in both file and CCDB mode"}; - Configurable url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable timestamp{"ccdb-timestamp", -1, "timestamp of the object"}; - - void init(o2::framework::InitContext&) - { - ccdb->setURL(url.value); - ccdb->setTimestamp(timestamp.value); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - // Not later than now objects - ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); - // - const std::vector p = {24.5}; - resoParameters.SetParameters(p); - const std::string fname = paramfile.value; - if (!fname.empty()) { // Loading the parametrization from file - LOG(info) << "Loading parametrization from file" << fname << ", using param: " << sigmaname; - resoParameters.LoadParamFromFile(fname.data(), sigmaname.value.data()); - } else { // Loading it from CCDB - const std::string path = "Analysis/ALICE3/PID/TOF/Parameters"; - resoParameters.SetParameters(ccdb->getForTimeStamp(path + "/" + sigmaname.value, timestamp.value)); - } - } - - template - float sigma(Trks::iterator track) - { - return o2::pid::tof::TOFResoALICE3ParamTrack(track, resoParameters); - } - template - float nsigma(Trks::iterator track) - { - if (!track.hasTOF()) { - return -999.f; - } - return ((track.trackTime() - track.collision().collisionTime()) * 1000.f - o2::pid::tof::ExpTimes::ComputeExpectedTime(track.tofExpMom() * o2::constants::physics::invLightSpeedCm2PS, - track.length())) / - sigma(track); - } - void process(Trks const& tracks, Coll const&) - { - tablePIDEl.reserve(tracks.size()); - tablePIDMu.reserve(tracks.size()); - tablePIDPi.reserve(tracks.size()); - tablePIDKa.reserve(tracks.size()); - tablePIDPr.reserve(tracks.size()); - tablePIDDe.reserve(tracks.size()); - tablePIDTr.reserve(tracks.size()); - tablePIDHe.reserve(tracks.size()); - tablePIDAl.reserve(tracks.size()); - for (auto const& trk : tracks) { - tablePIDEl(sigma(trk), nsigma(trk)); - tablePIDMu(sigma(trk), nsigma(trk)); - tablePIDPi(sigma(trk), nsigma(trk)); - tablePIDKa(sigma(trk), nsigma(trk)); - tablePIDPr(sigma(trk), nsigma(trk)); - tablePIDDe(sigma(trk), nsigma(trk)); - tablePIDTr(sigma(trk), nsigma(trk)); - tablePIDHe(sigma(trk), nsigma(trk)); - tablePIDAl(sigma(trk), nsigma(trk)); - } - } -}; - -struct ALICE3pidTOFTaskQA { - - static constexpr int Np = 9; - static constexpr const char* pT[Np] = {"e", "#mu", "#pi", "K", "p", "d", "t", "^{3}He", "#alpha"}; - static constexpr std::string_view hexpected[Np] = {"expected/El", "expected/Mu", "expected/Pi", - "expected/Ka", "expected/Pr", "expected/De", - "expected/Tr", "expected/He", "expected/Al"}; - static constexpr std::string_view hexpected_diff[Np] = {"expected_diff/El", "expected_diff/Mu", "expected_diff/Pi", - "expected_diff/Ka", "expected_diff/Pr", "expected_diff/De", - "expected_diff/Tr", "expected_diff/He", "expected_diff/Al"}; - static constexpr std::string_view hexpsigma[Np] = {"expsigma/El", "expsigma/Mu", "expsigma/Pi", - "expsigma/Ka", "expsigma/Pr", "expsigma/De", - "expsigma/Tr", "expsigma/He", "expsigma/Al"}; - static constexpr std::string_view hnsigma[Np] = {"nsigma/El", "nsigma/Mu", "nsigma/Pi", - "nsigma/Ka", "nsigma/Pr", "nsigma/De", - "nsigma/Tr", "nsigma/He", "nsigma/Al"}; - HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::QAObject}; - - Configurable logAxis{"logAxis", 1, "Flag to use a log momentum axis"}; - Configurable nBinsP{"nBinsP", 400, "Number of bins for the momentum"}; - Configurable minP{"minP", 0.01f, "Minimum momentum in range"}; - Configurable maxP{"maxP", 20.f, "Maximum momentum in range"}; - Configurable nBinsDelta{"nBinsDelta", 200, "Number of bins for the Delta"}; - Configurable minDelta{"minDelta", -1000.f, "Minimum Delta in range"}; - Configurable maxDelta{"maxDelta", 1000.f, "Maximum Delta in range"}; - Configurable nBinsExpSigma{"nBinsExpSigma", 200, "Number of bins for the ExpSigma"}; - Configurable minExpSigma{"minExpSigma", 0.f, "Minimum ExpSigma in range"}; - Configurable maxExpSigma{"maxExpSigma", 200.f, "Maximum ExpSigma in range"}; - Configurable nBinsNSigma{"nBinsNSigma", 200, "Number of bins for the NSigma"}; - Configurable minNSigma{"minNSigma", -10.f, "Minimum NSigma in range"}; - Configurable maxNSigma{"maxNSigma", 10.f, "Maximum NSigma in range"}; - Configurable minMult{"minMult", 1, "Minimum track multiplicity with TOF"}; - - template - void addParticleHistos(const AxisSpec& pAxis, const AxisSpec& /*ptAxis*/) - { - // Exp signal - const AxisSpec expAxis{1000, 0, 2e6, Form("t_{exp}(%s)", pT[i])}; - histos.add(hexpected[i].data(), "", kTH2F, {pAxis, expAxis}); - - // Signal - Expected signal - const AxisSpec deltaAxis{nBinsDelta, minDelta, maxDelta, Form("(t-t_{evt}-t_{exp}(%s))", pT[i])}; - histos.add(hexpected_diff[i].data(), "", kTH2F, {pAxis, deltaAxis}); - - // Exp Sigma - const AxisSpec expSigmaAxis{nBinsExpSigma, minExpSigma, maxExpSigma, Form("Exp_{#sigma}^{TOF}(%s)", pT[i])}; - histos.add(hexpsigma[i].data(), "", kTH2F, {pAxis, expSigmaAxis}); - - // NSigma - const AxisSpec nSigmaAxis{nBinsNSigma, minNSigma, maxNSigma, Form("N_{#sigma}^{TOF}(%s)", pT[i])}; - histos.add(hnsigma[i].data(), "", kTH2F, {pAxis, nSigmaAxis}); - } - - void init(o2::framework::InitContext&) - { - - const AxisSpec multAxis{100, 0, 100, "TOF multiplicity"}; - const AxisSpec vtxZAxis{100, -20, 20, "Vtx_{z} (cm)"}; - const AxisSpec tofAxis{10000, 0, 2e6, "TOF Signal"}; - const AxisSpec etaAxis{100, -2, 2, "#it{#eta}"}; - const AxisSpec colTimeAxis{100, -2000, 2000, "Collision time (ps)"}; - const AxisSpec colTimeResoAxis{100, 0, 1000, "#sigma_{Collision time} (ps)"}; - const AxisSpec lAxis{100, 0, 500, "Track length (cm)"}; - const AxisSpec ptResoAxis{100, 0, 0.1, "#sigma_{#it{p}_{T}}"}; - AxisSpec ptAxis{nBinsP, minP, maxP, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec pAxis{nBinsP, minP, maxP, "#it{p} (GeV/#it{c})"}; - AxisSpec pExpAxis{nBinsP, minP, maxP, "#it{p}_{Exp. TOF} (GeV/#it{c})"}; - if (logAxis) { - ptAxis.makeLogarithmic(); - pAxis.makeLogarithmic(); - pExpAxis.makeLogarithmic(); - } - - // Event properties - histos.add("event/vertexz", "", kTH1F, {vtxZAxis}); - histos.add("event/tofmultiplicity", "", kTH1F, {multAxis}); - histos.add("event/colltime", "", kTH1F, {colTimeAxis}); - histos.add("event/colltimereso", "", kTH2F, {multAxis, colTimeResoAxis}); - histos.add("event/tofsignal", "", kTH2F, {pAxis, tofAxis}); - histos.add("event/pexp", "", kTH2F, {pAxis, pExpAxis}); - histos.add("event/eta", "", kTH1F, {etaAxis}); - histos.add("event/length", "", kTH1F, {lAxis}); - histos.add("event/pt", "", kTH1F, {ptAxis}); - histos.add("event/p", "", kTH1F, {pAxis}); - histos.add("event/ptreso", "", kTH2F, {pAxis, ptResoAxis}); - - static_for<0, 8>([&](auto i) { - addParticleHistos(pAxis, ptAxis); - }); - } - - template - void fillParticleHistos(const T& t, const float& tof, const float& exp_diff, const float& expsigma) - { - histos.fill(HIST(hexpected[i]), t.p(), tof - exp_diff); - histos.fill(HIST(hexpected_diff[i]), t.p(), exp_diff); - histos.fill(HIST(hexpsigma[i]), t.p(), expsigma); - histos.fill(HIST(hnsigma[i]), t.p(), o2::aod::pidutils::tofNSigma(i, t)); - } - - void process(aod::Collision const& collision, - soa::Join const& tracks) - { - // Computing Multiplicity first - int mult = 0; - for (auto t : tracks) { - // - if (!t.hasTOF()) { // Skipping tracks without TOF - continue; - } - mult++; - } - if (mult < minMult) { // Cutting on low multiplicity events - return; - } - - const float collisionTime_ps = collision.collisionTime() * 1000.f; - histos.fill(HIST("event/vertexz"), collision.posZ()); - histos.fill(HIST("event/colltime"), collisionTime_ps); - histos.fill(HIST("event/tofmultiplicity"), mult); - histos.fill(HIST("event/colltimereso"), mult, collision.collisionTimeRes() * 1000.f); - - for (auto t : tracks) { - // - if (!t.hasTOF()) { // Skipping tracks without TOF - continue; - } - if (!t.isGlobalTrack()) { - continue; - } - - const float tofSignal = t.trackTime() * 1e3f; - // const float tof = t.tofSignal() - collisionTime_ps; - const float tof = tofSignal - collisionTime_ps; - - // - // histos.fill(HIST("event/tofsignal"), t.p(), t.tofSignal()); - histos.fill(HIST("event/tofsignal"), t.p(), tofSignal); - histos.fill(HIST("event/pexp"), t.p(), t.tofExpMom() * o2::constants::physics::invLightSpeedCm2PS); - histos.fill(HIST("event/eta"), t.eta()); - histos.fill(HIST("event/length"), t.length()); - histos.fill(HIST("event/pt"), t.pt()); - histos.fill(HIST("event/ptreso"), t.p(), t.sigma1Pt() * t.pt() * t.pt()); - // - fillParticleHistos(t, tof, t.tofExpSignalDiffEl(), t.tofExpSigmaEl()); - fillParticleHistos(t, tof, t.tofExpSignalDiffMu(), t.tofExpSigmaMu()); - fillParticleHistos(t, tof, t.tofExpSignalDiffPi(), t.tofExpSigmaPi()); - fillParticleHistos(t, tof, t.tofExpSignalDiffKa(), t.tofExpSigmaKa()); - fillParticleHistos(t, tof, t.tofExpSignalDiffPr(), t.tofExpSigmaPr()); - fillParticleHistos(t, tof, t.tofExpSignalDiffDe(), t.tofExpSigmaDe()); - fillParticleHistos(t, tof, t.tofExpSignalDiffTr(), t.tofExpSigmaTr()); - fillParticleHistos(t, tof, t.tofExpSignalDiffHe(), t.tofExpSigmaHe()); - fillParticleHistos(t, tof, t.tofExpSignalDiffAl(), t.tofExpSigmaAl()); - } - } -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - auto workflow = WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"alice3-pidTOF-task"}), - adaptAnalysisTask(cfgc, TaskName{"alice3-tof-signal-task"})}; - if (cfgc.options().get("add-qa")) { - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"alice3-pidTOFQA-task"})); - } - return workflow; -} From bf9cd9b2bdceff87f1406c19a63c81423ed0f97d Mon Sep 17 00:00:00 2001 From: Chiara De Martin <39315597+ChiaraDeMartin95@users.noreply.github.com> Date: Mon, 22 Sep 2025 20:57:27 +0200 Subject: [PATCH 495/986] [PWGLF] Fix centrality range up to 100 (#13082) Co-authored-by: Chiara De Martin --- PWGLF/TableProducer/Strangeness/cascadeflow.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx index 379a845ada5..c4eb59956d2 100644 --- a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx @@ -728,7 +728,7 @@ struct cascadeFlow { const AxisSpec ptAxisCasc{static_cast((CandidateConfigs.MaxPt - CandidateConfigs.MinPt) / 0.2), CandidateConfigs.MinPt, CandidateConfigs.MaxPt, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec ptAxisLambda{static_cast((V0Configs.MaxPtV0 - V0Configs.MinPtV0) / 0.2), V0Configs.MinPtV0, V0Configs.MaxPtV0, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec v2Axis{200, -1., 1., "#it{v}_{2}"}; - const AxisSpec CentAxis{18, 0., 90., "FT0C centrality percentile"}; + const AxisSpec CentAxis{20, 0., 100., "FT0C centrality percentile"}; TString hNEventsLabels[10] = {"All", "sel8", "z vrtx", "kNoSameBunchPileup", "kIsGoodZvtxFT0vsPV", "trackOccupancyInTimeRange", "kNoCollInTimeRange", "kNoCollInROF", "kTVXinTRD", "kIsGoodEventEP"}; TString hNEventsLabelsMC[6] = {"All", "z vtx", ">=1RecoColl", "1Reco", "2Reco", "EvSelected"}; TString hNCascLabelsMC[8] = {"All Xi", "all Omega", "Xi: has MC coll", "Om: has MC coll", "Xi: isPrimary", "Om: is Primary", "Xi: |eta|<0.8", "Om: |eta| < 0.8"}; @@ -748,7 +748,7 @@ struct cascadeFlow { histos.add("ShiftTPCL", "ShiftTPCL", kTProfile3D, {CentAxis, basisAxis, shiftAxis}); histos.add("ShiftTPCR", "ShiftTPCR", kTProfile3D, {CentAxis, basisAxis, shiftAxis}); - histos.add("hNEvents", "hNEvents", {HistType::kTH1F, {{10, 0.f, 10.f}}}); + histos.add("hNEvents", "hNEvents", {HistType::kTH1D, {{10, 0.f, 10.f}}}); for (Int_t n = 1; n <= histos.get(HIST("hNEvents"))->GetNbinsX(); n++) { histos.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(n, hNEventsLabels[n - 1]); } From ace2c2c46aa4b7fc8f4e0020a124d414bb53a40d Mon Sep 17 00:00:00 2001 From: abmodak <67369858+abmodak@users.noreply.github.com> Date: Mon, 22 Sep 2025 21:50:11 +0200 Subject: [PATCH 496/986] [PWGCF] Fix container fill for FT0A - FT0C (#13083) --- PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx index 0d93030b56c..a1eb8e9a3eb 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx @@ -502,7 +502,7 @@ struct LongrangeCorrelation { for (std::size_t iChA = 0; iChA < ft0a.channelA().size(); iChA++) { if (!mixing) - histos.fill(HIST("Ft0aFt0c/SE/Trig_hist"), fSampleIndex, vz, -1); + histos.fill(HIST("Ft0aFt0c/SE/Trig_hist"), fSampleIndex, vz, 1.0); auto chanelidA = ft0a.channelA()[iChA]; auto phiA = getPhiFT0(chanelidA, 0); @@ -546,7 +546,7 @@ struct LongrangeCorrelation { histos.fill(HIST("Ft0aFt0c/ME/deltaEta_deltaPhi"), deltaPhi, deltaEta); else histos.fill(HIST("Ft0aFt0c/SE/deltaEta_deltaPhi"), deltaPhi, deltaEta); - target->getPairHist()->Fill(step, fSampleIndex, vz, -1, -1, deltaPhi, deltaEta); + target->getPairHist()->Fill(step, fSampleIndex, vz, 1.0, 1.0, deltaPhi, deltaEta); } // associated ft0 tracks } // trigger tracks } // fillCorrFt0aFt0c From ccfd43eeabe1ff09cb29923c150b8ef8d69de974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Mon, 22 Sep 2025 22:02:31 +0200 Subject: [PATCH 497/986] [ALICE3] Add possibility to use generic geometry (#13086) --- ALICE3/Core/FastTracker.cxx | 51 +++++++++++++++++++++++++++++++++++++ ALICE3/Core/FastTracker.h | 16 ++++++++++-- 2 files changed, 65 insertions(+), 2 deletions(-) diff --git a/ALICE3/Core/FastTracker.cxx b/ALICE3/Core/FastTracker.cxx index 74ed147b8af..0f45e47291e 100644 --- a/ALICE3/Core/FastTracker.cxx +++ b/ALICE3/Core/FastTracker.cxx @@ -30,6 +30,7 @@ namespace fastsim void FastTracker::AddLayer(TString name, float r, float z, float x0, float xrho, float resRPhi, float resZ, float eff, int type) { + LOG(debug) << "Adding layer " << name << " r=" << r << " z=" << z << " x0=" << x0 << " xrho=" << xrho << " resRPhi=" << resRPhi << " resZ=" << resZ << " eff=" << eff << " type=" << type; DetLayer newLayer(name, r, z, x0, xrho, resRPhi, resZ, eff, type); // Check that efficient layers are not inert layers if (newLayer.getEfficiency() > 0.0f && newLayer.isInert()) { @@ -232,6 +233,56 @@ void FastTracker::AddTPC(float phiResMean, float zResMean) } } +void FastTracker::AddGenericDetector(std::string filename, o2::ccdb::BasicCCDBManager* ccdbManager) +{ + LOG(info) << " Adding generic detector from file " << filename; + // If the filename starts with ccdb: then take the file from the ccdb + if (filename.rfind("ccdb:", 0) == 0) { + std::string ccdbPath = filename.substr(5); // remove "ccdb:" prefix + if (ccdbManager == nullptr) { + LOG(fatal) << "CCDB manager is null, cannot retrieve file " << ccdbPath; + return; + } + const std::string outPath = "/tmp/DetGeo/"; + filename = Form("%s/%s/snapshot.root", outPath.c_str(), ccdbPath.c_str()); + std::ifstream checkFile(filename); // Check if file already exists + if (!checkFile.is_open()) { // File does not exist, retrieve from CCDB + LOG(info) << " --- CCDB source detected for detector geometry " << filename; + std::map metadata; + ccdbManager->getCCDBAccessor().retrieveBlob(ccdbPath, outPath, metadata, 1); + // Add CCDB handling logic here if needed + LOG(info) << " --- Now retrieving geometry configuration from CCDB to: " << filename; + } else { // File exists, proceed to load + LOG(info) << " --- Geometry configuration file already exists: " << filename << ". Skipping download."; + checkFile.close(); + } + AddGenericDetector(filename, nullptr); + return; + } + + std::ifstream infile(filename); + if (!infile.is_open()) { + LOG(fatal) << "Could not open detector configuration file: " << filename; + return; + } + + std::string line; + while (std::getline(infile, line)) { + if (line.empty() || line[0] == '#') + continue; // skip comments and empty lines + std::istringstream iss(line); + std::string name; + float r, z, x0, xrho, resRPhi, resZ, eff; + int type; + if (!(iss >> name >> r >> z >> x0 >> xrho >> resRPhi >> resZ >> eff >> type)) { + LOG(error) << "Malformed line in detector config: " << line; + continue; + } + AddLayer(name.c_str(), r, z, x0, xrho, resRPhi, resZ, eff, type); + } + infile.close(); +} + float FastTracker::Dist(float z, float r) { // porting of DetektorK::Dist diff --git a/ALICE3/Core/FastTracker.h b/ALICE3/Core/FastTracker.h index 7ab682713c1..ed45d140efe 100644 --- a/ALICE3/Core/FastTracker.h +++ b/ALICE3/Core/FastTracker.h @@ -14,9 +14,10 @@ #include "DetLayer.h" -#include "ReconstructionDataFormats/Track.h" +#include +#include -#include // not a system header but megalinter thinks so +#include #include #include @@ -61,6 +62,17 @@ class FastTracker void AddSiliconALICE3v2(std::vector pixelResolution); void AddSiliconALICE3(float scaleX0VD, std::vector pixelResolution); void AddTPC(float phiResMean, float zResMean); + /** + * @brief Adds a generic detector configuration from the specified file. + * + * This function loads and integrates a detector configuration into the tracker + * using the provided filename. The file should contain the necessary parameters + * and settings for the detector to be added. + * + * @param filename Path to the configuration file describing the detector. + * @param ccdbManager Pointer to a BasicCCDBManager instance for database access (if needed). + */ + void AddGenericDetector(std::string filename, o2::ccdb::BasicCCDBManager* ccdbManager = nullptr); void Print(); From 6c9697411c48b5cedb322a0f26e76fa7d5f97454 Mon Sep 17 00:00:00 2001 From: altsybee Date: Mon, 22 Sep 2025 22:51:23 +0200 Subject: [PATCH 498/986] [DPG] flag for filling ITS dead zone histograms (#13084) --- DPG/Tasks/AOTEvent/eventSelectionQa.cxx | 137 ++++++++++++------------ 1 file changed, 70 insertions(+), 67 deletions(-) diff --git a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx index e890b9fbab9..b4f2c47d834 100644 --- a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx +++ b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx @@ -53,6 +53,7 @@ struct EventSelectionQaTask { Configurable isMC{"isMC", 0, "0 - data, 1 - MC"}; Configurable nGlobalBCs{"nGlobalBCs", 100000, "number of global bcs for detailed monitoring"}; Configurable isLowFlux{"isLowFlux", 1, "1 - low flux (pp, pPb), 0 - high flux (PbPb)"}; + Configurable fillITSdeadStaveHists{"fillITSdeadStaveHists", 0, "0 - no, 1 - yes"}; Service ccdb; HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -639,78 +640,80 @@ struct EventSelectionQaTask { } // fill ITS dead maps - o2::itsmft::TimeDeadMap* itsDeadMap = ccdb->getForTimeStamp("ITS/Calib/TimeDeadMap", (tsSOR + tsEOR) / 2); - auto itsDeadMapOrbits = itsDeadMap->getEvolvingMapKeys(); // roughly every second, ~350 TFs = 350x32 orbits - if (itsDeadMapOrbits.size() > 0) { - std::vector itsDeadMapOrbitsDouble(itsDeadMapOrbits.begin(), itsDeadMapOrbits.end()); - const AxisSpec axisItsDeadMapOrbits{itsDeadMapOrbitsDouble}; - - for (int l = 0; l < o2::itsmft::ChipMappingITS::NLayers; l++) { - int nChips = o2::itsmft::ChipMappingITS::getNChipsOnLayer(l); - double idFirstChip = o2::itsmft::ChipMappingITS::getFirstChipsOnLayer(l); - // int nStaves = o2::itsmft::ChipMappingITS::getNStavesOnLr(l); - // double idFirstStave = o2::itsmft::ChipMappingITS::getFirstStavesOnLr(l); - histos.add(Form("hDeadChipsVsOrbitL%d", l), Form(";orbit; chip; Layer %d", l), kTH2C, {axisItsDeadMapOrbits, {nChips, idFirstChip, idFirstChip + nChips}}); - histos.add(Form("hNumberOfInactiveChipsVsOrbitL%d", l), Form(";orbit; Layer %d", l), kTH1I, {axisItsDeadMapOrbits}); - } + if (fillITSdeadStaveHists) { + o2::itsmft::TimeDeadMap* itsDeadMap = ccdb->getForTimeStamp("ITS/Calib/TimeDeadMap", (tsSOR + tsEOR) / 2); + auto itsDeadMapOrbits = itsDeadMap->getEvolvingMapKeys(); // roughly every second, ~350 TFs = 350x32 orbits + if (itsDeadMapOrbits.size() > 0) { + std::vector itsDeadMapOrbitsDouble(itsDeadMapOrbits.begin(), itsDeadMapOrbits.end()); + const AxisSpec axisItsDeadMapOrbits{itsDeadMapOrbitsDouble}; + + for (int l = 0; l < o2::itsmft::ChipMappingITS::NLayers; l++) { + int nChips = o2::itsmft::ChipMappingITS::getNChipsOnLayer(l); + double idFirstChip = o2::itsmft::ChipMappingITS::getFirstChipsOnLayer(l); + // int nStaves = o2::itsmft::ChipMappingITS::getNStavesOnLr(l); + // double idFirstStave = o2::itsmft::ChipMappingITS::getFirstStavesOnLr(l); + histos.add(Form("hDeadChipsVsOrbitL%d", l), Form(";orbit; chip; Layer %d", l), kTH2C, {axisItsDeadMapOrbits, {nChips, idFirstChip, idFirstChip + nChips}}); + histos.add(Form("hNumberOfInactiveChipsVsOrbitL%d", l), Form(";orbit; Layer %d", l), kTH1I, {axisItsDeadMapOrbits}); + } - std::vector vClosest; - std::bitset alwaysDeadChips; - std::bitset deadChips; - alwaysDeadChips.set(); - for (const auto& orbit : itsDeadMapOrbits) { - itsDeadMap->getMapAtOrbit(orbit, vClosest); - deadChips.reset(); - for (size_t iel = 0; iel < vClosest.size(); iel++) { - uint16_t w1 = vClosest[iel]; - bool isLastInSequence = (w1 & 0x8000) == 0; - uint16_t w2 = isLastInSequence ? w1 + 1 : vClosest[iel + 1]; - uint16_t chipId1 = w1 & 0x7FFF; - uint16_t chipId2 = w2 & 0x7FFF; - // dead chips are stored as ranges - // vClosest contains first and last chip ids in the range - // last chip id in the range is marked with 0x8000 bit set to 1 - for (int chipId = chipId1; chipId < chipId2; chipId++) { - histos.fill(HIST("hDeadChipsVsOrbitL0"), orbit, chipId, 1); - histos.fill(HIST("hDeadChipsVsOrbitL1"), orbit, chipId, 1); - histos.fill(HIST("hDeadChipsVsOrbitL2"), orbit, chipId, 1); - histos.fill(HIST("hDeadChipsVsOrbitL3"), orbit, chipId, 1); - histos.fill(HIST("hDeadChipsVsOrbitL4"), orbit, chipId, 1); - histos.fill(HIST("hDeadChipsVsOrbitL5"), orbit, chipId, 1); - histos.fill(HIST("hDeadChipsVsOrbitL6"), orbit, chipId, 1); - deadChips.set(chipId); + std::vector vClosest; + std::bitset alwaysDeadChips; + std::bitset deadChips; + alwaysDeadChips.set(); + for (const auto& orbit : itsDeadMapOrbits) { + itsDeadMap->getMapAtOrbit(orbit, vClosest); + deadChips.reset(); + for (size_t iel = 0; iel < vClosest.size(); iel++) { + uint16_t w1 = vClosest[iel]; + bool isLastInSequence = (w1 & 0x8000) == 0; + uint16_t w2 = isLastInSequence ? w1 + 1 : vClosest[iel + 1]; + uint16_t chipId1 = w1 & 0x7FFF; + uint16_t chipId2 = w2 & 0x7FFF; + // dead chips are stored as ranges + // vClosest contains first and last chip ids in the range + // last chip id in the range is marked with 0x8000 bit set to 1 + for (int chipId = chipId1; chipId < chipId2; chipId++) { + histos.fill(HIST("hDeadChipsVsOrbitL0"), orbit, chipId, 1); + histos.fill(HIST("hDeadChipsVsOrbitL1"), orbit, chipId, 1); + histos.fill(HIST("hDeadChipsVsOrbitL2"), orbit, chipId, 1); + histos.fill(HIST("hDeadChipsVsOrbitL3"), orbit, chipId, 1); + histos.fill(HIST("hDeadChipsVsOrbitL4"), orbit, chipId, 1); + histos.fill(HIST("hDeadChipsVsOrbitL5"), orbit, chipId, 1); + histos.fill(HIST("hDeadChipsVsOrbitL6"), orbit, chipId, 1); + deadChips.set(chipId); + } } + alwaysDeadChips &= deadChips; // chips active in the current orbit are set to 0 } - alwaysDeadChips &= deadChips; // chips active in the current orbit are set to 0 - } - // std::cout << alwaysDeadChips << std::endl; - - // filling histograms with number of inactive chips per layer vs orbit (ignoring always inactive) - for (const auto& orbit : itsDeadMapOrbits) { - itsDeadMap->getMapAtOrbit(orbit, vClosest); - std::vector nInactiveChips(o2::itsmft::ChipMappingITS::NLayers, 0); - for (size_t iel = 0; iel < vClosest.size(); iel++) { - uint16_t w1 = vClosest[iel]; - bool isLastInSequence = (w1 & 0x8000) == 0; - uint16_t w2 = isLastInSequence ? w1 + 1 : vClosest[iel + 1]; - uint16_t chipId1 = w1 & 0x7FFF; - uint16_t chipId2 = w2 & 0x7FFF; - for (int chipId = chipId1; chipId < chipId2; chipId++) { - if (alwaysDeadChips[chipId]) // skip always inactive chips - continue; - int32_t layer = o2::itsmft::ChipMappingITS::getLayer(chipId); - nInactiveChips[layer]++; + // std::cout << alwaysDeadChips << std::endl; + + // filling histograms with number of inactive chips per layer vs orbit (ignoring always inactive) + for (const auto& orbit : itsDeadMapOrbits) { + itsDeadMap->getMapAtOrbit(orbit, vClosest); + std::vector nInactiveChips(o2::itsmft::ChipMappingITS::NLayers, 0); + for (size_t iel = 0; iel < vClosest.size(); iel++) { + uint16_t w1 = vClosest[iel]; + bool isLastInSequence = (w1 & 0x8000) == 0; + uint16_t w2 = isLastInSequence ? w1 + 1 : vClosest[iel + 1]; + uint16_t chipId1 = w1 & 0x7FFF; + uint16_t chipId2 = w2 & 0x7FFF; + for (int chipId = chipId1; chipId < chipId2; chipId++) { + if (alwaysDeadChips[chipId]) // skip always inactive chips + continue; + int32_t layer = o2::itsmft::ChipMappingITS::getLayer(chipId); + nInactiveChips[layer]++; + } } + histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL0"), orbit, nInactiveChips[0]); + histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL1"), orbit, nInactiveChips[1]); + histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL2"), orbit, nInactiveChips[2]); + histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL3"), orbit, nInactiveChips[3]); + histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL4"), orbit, nInactiveChips[4]); + histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL5"), orbit, nInactiveChips[5]); + histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL6"), orbit, nInactiveChips[6]); } - histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL0"), orbit, nInactiveChips[0]); - histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL1"), orbit, nInactiveChips[1]); - histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL2"), orbit, nInactiveChips[2]); - histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL3"), orbit, nInactiveChips[3]); - histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL4"), orbit, nInactiveChips[4]); - histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL5"), orbit, nInactiveChips[5]); - histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL6"), orbit, nInactiveChips[6]); } - } + } // end of fill ITS dead maps } // run >= 500000 // create orbit-axis histograms on the fly with binning based on info from GRP if GRP is available @@ -736,7 +739,7 @@ struct EventSelectionQaTask { double minSec = floor(tsSOR / 1000.); double maxSec = ceil(tsEOR / 1000.); - const AxisSpec axisSeconds{maxSec - minSec < 5000 ? static_cast(maxSec - minSec) : 5000, minSec, maxSec, "seconds"}; + const AxisSpec axisSeconds{maxSec - minSec < 1000 ? static_cast(maxSec - minSec) : 1000, minSec, maxSec, "seconds"}; const AxisSpec axisBcDif{600, -300., 300., "bc difference"}; histos.add("hSecondsTVXvsBcDif", "", kTH2F, {axisSeconds, axisBcDif}); histos.add("hSecondsTVXvsBcDifAll", "", kTH2F, {axisSeconds, axisBcDif}); From 9a61952896baf56ba5ba04bc8d420a630fc72bed Mon Sep 17 00:00:00 2001 From: Maximiliano Puccio Date: Tue, 23 Sep 2025 12:05:21 +0200 Subject: [PATCH 499/986] [Infrastructure] All LF coordinators can approve PWGLF/QC tasks (#13073) --- CODEOWNERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CODEOWNERS b/CODEOWNERS index 5ad68945cbe..549ee7c12f0 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -51,6 +51,8 @@ /PWGLF/TableProducer/Resonances @alibuild @sustripathy @skundu692 @mpuccio @dmallick2 @smaff92 /PWGLF/Tasks/Strangeness @alibuild @sustripathy @skundu692 @mpuccio @ercolessi @romainschotter /PWGLF/TableProducer/Strangeness @alibuild @sustripathy @mpuccio @skundu692 @ercolessi @romainschotter +/PWGLF/TableProducer/QC @alibuild @sustripathy @skundu692 @mpuccio @gbencedi @abmodak @fmazzasc @maciacco @dmallick2 @smaff92 @ercolessi @romainschotter +/PWGLF/Tasks/QC @alibuild @sustripathy @skundu692 @mpuccio @gbencedi @abmodak @fmazzasc @maciacco @dmallick2 @smaff92 @ercolessi @romainschotter /PWGLF/Utils @alibuild @sustripathy @skundu692 @mpuccio @gbencedi @abmodak @fmazzasc @maciacco @dmallick2 @smaff92 @ercolessi @romainschotter # PWG-MM (fused with LF, LF conveners included. Directories to be merged in the future) From 1c4415924862b5a008e180967d2a3384e00203f5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 23 Sep 2025 12:05:58 +0200 Subject: [PATCH 500/986] [Infrastructure] Bump oxsecurity/megalinter from 8.8.0 to 9.0.1 (#13072) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/mega-linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mega-linter.yml b/.github/workflows/mega-linter.yml index f517255f99e..de747122fff 100644 --- a/.github/workflows/mega-linter.yml +++ b/.github/workflows/mega-linter.yml @@ -38,7 +38,7 @@ jobs: id: ml # You can override MegaLinter flavor used to have faster performances # More info at https://megalinter.io/flavors/ - uses: oxsecurity/megalinter@v8.8.0 + uses: oxsecurity/megalinter@v9.0.1 env: # All available variables are described in documentation: # https://megalinter.io/configuration/ From ba0ad42523da0465518e673ec074b3e425799bac Mon Sep 17 00:00:00 2001 From: Shyam Kumar Date: Tue, 23 Sep 2025 13:31:32 +0200 Subject: [PATCH 501/986] [PWGHF] Minor fix in the filling of numPvContr (#13087) --- PWGHF/D2H/Tasks/taskDplus.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskDplus.cxx b/PWGHF/D2H/Tasks/taskDplus.cxx index aabd95d9283..fd90c19d4af 100644 --- a/PWGHF/D2H/Tasks/taskDplus.cxx +++ b/PWGHF/D2H/Tasks/taskDplus.cxx @@ -556,20 +556,18 @@ struct HfTaskDplus { } ptBhad = candidate.ptBhadMotherPart(); flagBHad = getBHadMotherFlag(candidate.pdgBhadMotherPart()); - + auto collision = candidate.template collision_as(); if (storeCentrality || storeOccupancy) { - auto collision = candidate.template collision_as(); if (storeCentrality && centEstimator != CentralityEstimator::None) { cent = getCentralityColl(collision, centEstimator); } if (storeOccupancy && occEstimator != OccupancyEstimator::None) { occ = o2::hf_occupancy::getOccupancyColl(collision, occEstimator); } + } if (storePvContributors) { numPvContr = collision.numContrib(); } - } - fillHisto(candidate); fillHistoMCRec(candidate); fillSparseML(candidate, ptBhad, flagBHad, cent, occ, numPvContr); From 088b5542e652354c3e6dae25e19e37a876d41d94 Mon Sep 17 00:00:00 2001 From: Lucia Anna Tarasovicova Date: Tue, 23 Sep 2025 14:09:47 +0200 Subject: [PATCH 502/986] [PWGLF] Change in hStrangeCorrelation.cxx (#13093) Co-authored-by: Lucia Anna Tarasovicova --- .../Tasks/Strangeness/hStrangeCorrelation.cxx | 323 ++++++++++++------ 1 file changed, 228 insertions(+), 95 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx b/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx index 95e0671ea26..efcd44f081a 100644 --- a/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx +++ b/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx @@ -104,17 +104,19 @@ struct HStrangeCorrelation { Configurable cfgCutOccupancyLow{"cfgCutOccupancyLow", 0, "Low cut on TPC occupancy"}; // Axes - configurable for smaller sizes - ConfigurableAxis axisMult{"axisMult", {VARIABLE_WIDTH, 0.0f, 0.01f, 1.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 70.0f, 100.0f}, "Mixing bins - multiplicity"}; - ConfigurableAxis axisVtxZ{"axisVtxZ", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; - ConfigurableAxis axisPhi{"axisPhi", {72, 0, TwoPI}, "#phi"}; - ConfigurableAxis axisEta{"axisEta", {80, -0.8, +0.8}, "#eta"}; - ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -PIHalf, PIHalf * 3}, "delta #varphi axis for histograms"}; - ConfigurableAxis axisDeltaEta{"axisDeltaEta", {50, -1.6, 1.6}, "delta eta axis for histograms"}; - ConfigurableAxis axisPtAssoc{"axisPtAssoc", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 10.0}, "pt associated axis for histograms"}; - ConfigurableAxis axisPtTrigger{"axisPtTrigger", {VARIABLE_WIDTH, 0.0, 1.0, 2.0, 3.0, 100}, "pt associated axis for histograms"}; - ConfigurableAxis axisPtQA{"axisPtQA", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "pt axis for QA histograms"}; - ConfigurableAxis axisMultCount{"axisMultCount", {VARIABLE_WIDTH, 0, 200, 400, 600, 800, 1000, 1400, 1800, 2300, 2800, 3300, 4000, 5000, 6000}, "Mixing bins - multiplicity"}; - ConfigurableAxis axisMassNSigma{"axisMassNSigma", {40, -2, 2}, "Axis for mass Nsigma"}; + struct : ConfigurableGroup { + ConfigurableAxis axisMult{"axisMult", {VARIABLE_WIDTH, 0.0f, 0.01f, 1.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 70.0f, 100.0f}, "Mixing bins - multiplicity"}; + ConfigurableAxis axisVtxZ{"axisVtxZ", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; + ConfigurableAxis axisPhi{"axisPhi", {72, 0, TwoPI}, "#phi"}; + ConfigurableAxis axisEta{"axisEta", {80, -0.8, +0.8}, "#eta"}; + ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -PIHalf, PIHalf * 3}, "delta #varphi axis for histograms"}; + ConfigurableAxis axisDeltaEta{"axisDeltaEta", {50, -1.6, 1.6}, "delta eta axis for histograms"}; + ConfigurableAxis axisPtAssoc{"axisPtAssoc", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 10.0}, "pt associated axis for histograms"}; + ConfigurableAxis axisPtTrigger{"axisPtTrigger", {VARIABLE_WIDTH, 0.0, 1.0, 2.0, 3.0, 100}, "pt associated axis for histograms"}; + ConfigurableAxis axisPtQA{"axisPtQA", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "pt axis for QA histograms"}; + ConfigurableAxis axisMultCount{"axisMultCount", {VARIABLE_WIDTH, 0, 200, 400, 600, 800, 1000, 1400, 1800, 2300, 2800, 3300, 4000, 5000, 6000}, "Mixing bins - multiplicity"}; + ConfigurableAxis axisMassNSigma{"axisMassNSigma", {40, -2, 2}, "Axis for mass Nsigma"}; + } axesConfigurations; // for topo var QA struct : ConfigurableGroup { @@ -126,6 +128,7 @@ struct HStrangeCorrelation { // Implementation of on-the-spot efficiency correction Configurable applyEfficiencyCorrection{"applyEfficiencyCorrection", false, "apply efficiency correction"}; Configurable applyEfficiencyForTrigger{"applyEfficiencyForTrigger", false, "apply efficiency correction for the trigger particle"}; + Configurable applyEfficiencyPropagation{"applyEfficiencyPropagation", false, "propagate also the efficiency uncertainty"}; Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository to use"}; Configurable efficiencyCCDBPath{"efficiencyCCDBPath", "GLO/Config/GeometryAligned", "Path of the efficiency corrections"}; @@ -217,11 +220,23 @@ struct HStrangeCorrelation { TH2F* hEfficiencyOmegaPlus; TH2F* hEfficiencyHadron; TH1F* hPurityHadron; + // objects to propagate the efficiency uncertainty + TH2F* hEfficiencyUncertaintyTrigger; + TH2F* hEfficiencyUncertaintyPion; + TH2F* hEfficiencyUncertaintyK0Short; + TH2F* hEfficiencyUncertaintyLambda; + TH2F* hEfficiencyUncertaintyAntiLambda; + TH2F* hEfficiencyUncertaintyXiMinus; + TH2F* hEfficiencyUncertaintyXiPlus; + TH2F* hEfficiencyUncertaintyOmegaMinus; + TH2F* hEfficiencyUncertaintyOmegaPlus; + TH2F* hEfficiencyUncertaintyHadron; + TH1F* hPurityUncertaintyHadron; using BinningType = ColumnBinningPolicy; using BinningTypePbPb = ColumnBinningPolicy; // std::variant colBinning; - BinningType colBinning{{axisVtxZ, axisMult}, true}; // true is for 'ignore overflows' (true by default). Underflows and overflows will have bin -1. + BinningType colBinning{{axesConfigurations.axisVtxZ, axesConfigurations.axisMult}, true}; // true is for 'ignore overflows' (true by default). Underflows and overflows will have bin -1. // collision slicing for mixed events Preslice collisionSliceTracks = aod::triggerTracks::collisionId; @@ -297,6 +312,19 @@ struct HStrangeCorrelation { hEfficiencyHadron = static_cast(listEfficiencies->FindObject("hEfficiencyHadron")); hEfficiencyPion = static_cast(listEfficiencies->FindObject("hEfficiencyPion")); hPurityHadron = static_cast(listEfficiencies->FindObject("hPurityHadron")); + hEfficiencyUncertaintyTrigger = static_cast(listEfficiencies->FindObject("hEfficiencyUncertaintyTrigger")); + hEfficiencyUncertaintyK0Short = static_cast(listEfficiencies->FindObject("hEfficiencyUncertaintyK0Short")); + hEfficiencyUncertaintyLambda = static_cast(listEfficiencies->FindObject("hEfficiencyUncertaintyLambda")); + hEfficiencyUncertaintyAntiLambda = static_cast(listEfficiencies->FindObject("hEfficiencyUncertaintyAntiLambda")); + hEfficiencyUncertaintyXiMinus = static_cast(listEfficiencies->FindObject("hEfficiencyUncertaintyXiMinus")); + hEfficiencyUncertaintyXiPlus = static_cast(listEfficiencies->FindObject("hEfficiencyUncertaintyXiPlus")); + hEfficiencyUncertaintyOmegaMinus = static_cast(listEfficiencies->FindObject("hEfficiencyUncertaintyOmegaMinus")); + hEfficiencyUncertaintyOmegaPlus = static_cast(listEfficiencies->FindObject("hEfficiencyUncertaintyOmegaPlus")); + hEfficiencyUncertaintyPion = static_cast(listEfficiencies->FindObject("hEfficiencyUncertaintyPion")); + hEfficiencyUncertaintyHadron = static_cast(listEfficiencies->FindObject("hEfficiencyUncertaintyHadron")); + hPurityUncertaintyHadron = static_cast(listEfficiencies->FindObject("hPurityUncertaintyHadron")); + if (applyEfficiencyPropagation && !hEfficiencyUncertaintyTrigger) + LOG(fatal) << "Problem getting hEfficiencyUncertaintyTrigger!"; LOG(info) << "Efficiencies now loaded for " << mRunNumber; } @@ -533,6 +561,28 @@ struct HStrangeCorrelation { return dPhiStarMean; } + void fillTriggerHistogram(std::shared_ptr hist, double pt, double mult, float eff, float effUncert) + { + int binx = hist->GetXaxis()->FindBin(pt); + int biny = hist->GetYaxis()->FindBin(mult); + float previousContent = hist->GetBinContent(binx, biny); + float previousUncert = hist->GetBinError(binx, biny); + float newContent = previousContent + 1 / eff; + float newUncert = std::sqrt(previousUncert * previousUncert + 1 / std::pow(eff, 2) + std::pow(effUncert, 2) / std::pow(eff, 4)); + hist->SetBinContent(binx, biny, newContent); + hist->SetBinError(binx, biny, newUncert); + } + void fillCorrelationHistogram(std::shared_ptr hist, double binFillThn[], float etaWeight, float efficiency, float totalEffUncert, float purity, float totalPurityUncert) + { + float previousContent, previousError2, currentContent, currentError2; + int bin = hist->GetBin(binFillThn); + previousContent = hist->GetBinContent(bin); + previousError2 = hist->GetBinError2(bin); + currentContent = previousContent + etaWeight * purity / (efficiency); + currentError2 = previousError2 + std::pow(etaWeight * totalPurityUncert / (efficiency), 2) + std::pow(totalEffUncert * purity * etaWeight, 2) / std::pow(efficiency, 4); + hist->SetBinContent(bin, currentContent); + hist->SetBinError2(bin, currentError2); + } void fillCorrelationsV0(aod::TriggerTracks const& triggers, aod::AssocV0s const& assocs, bool mixing, float pvx, float pvy, float pvz, float mult, double bField) { for (auto const& triggerTrack : triggers) { @@ -544,14 +594,17 @@ struct HStrangeCorrelation { if (!mixing) { float efficiency = 1.0f; + float efficiencyError = 0.0f; if (applyEfficiencyForTrigger) { efficiency = hEfficiencyTrigger->Interpolate(trigg.pt(), trigg.eta()); + if (applyEfficiencyPropagation) + efficiencyError = hEfficiencyUncertaintyTrigger->Interpolate(trigg.pt(), trigg.eta()); if (efficiency == 0) { // check for zero efficiency, do not apply if the case efficiency = 1; + efficiencyError = 0; } } - float weight = (applyEfficiencyForTrigger) ? 1. / efficiency : 1.0f; - histos.fill(HIST("sameEvent/TriggerParticlesV0"), trigg.pt(), mult, weight); + fillTriggerHistogram(histos.get(HIST("sameEvent/TriggerParticlesV0")), trigg.pt(), mult, efficiency, efficiencyError); } double triggSign = trigg.sign(); @@ -607,6 +660,11 @@ struct HStrangeCorrelation { hEfficiencyV0[1] = hEfficiencyLambda; hEfficiencyV0[2] = hEfficiencyAntiLambda; + TH2F* hEfficiencyUncertaintyV0[3]; + hEfficiencyUncertaintyV0[0] = hEfficiencyUncertaintyK0Short; + hEfficiencyUncertaintyV0[1] = hEfficiencyUncertaintyLambda; + hEfficiencyUncertaintyV0[2] = hEfficiencyUncertaintyAntiLambda; + float etaWeight = 1; if (systCuts.doOnTheFlyFlattening) { float preWeight = 1 - std::abs(deltaeta) / 1.6; @@ -632,21 +690,35 @@ struct HStrangeCorrelation { static_for<0, 2>([&](auto i) { constexpr int Index = i.value; float efficiency = 1.0f; + float efficiencytrigg = 1.0f; + float totalEffUncert = 0.0; + float efficiencyError = 0.0f; + float triggerEfficiencyError = 0.0f; if (applyEfficiencyCorrection) { efficiency = hEfficiencyV0[Index]->Interpolate(ptassoc, assoc.eta()); + if (applyEfficiencyPropagation) + efficiencyError = hEfficiencyUncertaintyV0[Index]->Interpolate(ptassoc, assoc.eta()); } if (applyEfficiencyForTrigger) { efficiency = efficiency * hEfficiencyTrigger->Interpolate(pttrigger, trigg.eta()); + if (applyEfficiencyPropagation) + triggerEfficiencyError = hEfficiencyUncertaintyTrigger->Interpolate(pttrigger, trigg.eta()); } if (efficiency == 0) { // check for zero efficiency, do not apply if the case efficiency = 1; + efficiencyError = 0; } - - float weight = (applyEfficiencyCorrection || applyEfficiencyForTrigger) ? 1. / efficiency : 1.0f; - weight = weight * etaWeight; + if (efficiencytrigg == 0) { // check for zero efficiency, do not apply if the case + efficiencytrigg = 1; + triggerEfficiencyError = 0; + } + if (applyEfficiencyPropagation) { + totalEffUncert = std::sqrt(std::pow(efficiencytrigg * efficiencyError, 2) + std::pow(triggerEfficiencyError * efficiency, 2)); + } + double binFillThn[6] = {deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult}; if (TESTBIT(doCorrelation, Index) && (!applyEfficiencyCorrection || efficiency != 0) && (doPPAnalysis || (TESTBIT(selMap, Index) && TESTBIT(selMap, Index + 3)))) { if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && !mixing && -massWindowConfigurations.maxBgNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < -massWindowConfigurations.minBgNSigma) { - histos.fill(HIST("sameEvent/LeftBg/") + HIST(kV0names[Index]), deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult, weight); + fillCorrelationHistogram(histos.get(HIST("sameEvent/LeftBg/") + HIST(kV0names[Index])), binFillThn, etaWeight, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f); if (doDeltaPhiStarCheck) { double deltaPhiStar = calculateAverageDeltaPhiStar(triggForDeltaPhiStar, assocForDeltaPhiStar, bField); double deltaPhiStarPion = calculateAverageDeltaPhiStar(triggForDeltaPhiStar, assocForDeltaPhiStarPion, bField); @@ -664,7 +736,7 @@ struct HStrangeCorrelation { } } if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && !mixing && -massWindowConfigurations.maxPeakNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < +massWindowConfigurations.maxPeakNSigma) { - histos.fill(HIST("sameEvent/Signal/") + HIST(kV0names[Index]), deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult, weight); + fillCorrelationHistogram(histos.get(HIST("sameEvent/Signal/") + HIST(kV0names[Index])), binFillThn, etaWeight, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f); if (std::abs(deltaphi) < 0.8 && doITSClustersQA) { histos.fill(HIST("hITSClusters") + HIST(kV0names[Index]) + HIST("NegativeDaughterToward"), ptassoc, negtrack.itsNCls(), assoc.v0radius()); histos.fill(HIST("hITSClusters") + HIST(kV0names[Index]) + HIST("PositiveDaughterToward"), ptassoc, postrack.itsNCls(), assoc.v0radius()); @@ -690,7 +762,7 @@ struct HStrangeCorrelation { } } if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && !mixing && +massWindowConfigurations.minBgNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < +massWindowConfigurations.maxBgNSigma) { - histos.fill(HIST("sameEvent/RightBg/") + HIST(kV0names[Index]), deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult, weight); + fillCorrelationHistogram(histos.get(HIST("sameEvent/RightBg/") + HIST(kV0names[Index])), binFillThn, etaWeight, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f); if (doDeltaPhiStarCheck) { double deltaPhiStar = calculateAverageDeltaPhiStar(triggForDeltaPhiStar, assocForDeltaPhiStar, bField); double deltaPhiStarPion = calculateAverageDeltaPhiStar(triggForDeltaPhiStar, assocForDeltaPhiStarPion, bField); @@ -708,11 +780,11 @@ struct HStrangeCorrelation { } } if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && mixing && -massWindowConfigurations.maxBgNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < -massWindowConfigurations.minBgNSigma) - histos.fill(HIST("mixedEvent/LeftBg/") + HIST(kV0names[Index]), deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult, weight); + fillCorrelationHistogram(histos.get(HIST("mixedEvent/LeftBg/") + HIST(kV0names[Index])), binFillThn, 1, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f); if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && mixing && -massWindowConfigurations.maxPeakNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < +massWindowConfigurations.maxPeakNSigma) - histos.fill(HIST("mixedEvent/Signal/") + HIST(kV0names[Index]), deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult, weight); + fillCorrelationHistogram(histos.get(HIST("mixedEvent/Signal/") + HIST(kV0names[Index])), binFillThn, 1, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f); if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && mixing && +massWindowConfigurations.minBgNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < +massWindowConfigurations.maxBgNSigma) - histos.fill(HIST("mixedEvent/RightBg/") + HIST(kV0names[Index]), deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult, weight); + fillCorrelationHistogram(histos.get(HIST("mixedEvent/RightBg/") + HIST(kV0names[Index])), binFillThn, 1, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f); } }); } @@ -730,14 +802,17 @@ struct HStrangeCorrelation { if (!mixing) { float efficiency = 1.0f; + float efficiencyError = 0.0f; if (applyEfficiencyForTrigger) { efficiency = hEfficiencyTrigger->Interpolate(trigg.pt(), trigg.eta()); + if (applyEfficiencyPropagation) + efficiencyError = hEfficiencyUncertaintyTrigger->Interpolate(trigg.pt(), trigg.eta()); if (efficiency == 0) { // check for zero efficiency, do not apply if the case efficiency = 1; + efficiencyError = 0; } } - float weight = (applyEfficiencyForTrigger) ? 1. / efficiency : 1.0f; - histos.fill(HIST("sameEvent/TriggerParticlesCascade"), trigg.pt(), mult, weight); + fillTriggerHistogram(histos.get(HIST("sameEvent/TriggerParticlesCascade")), trigg.pt(), mult, efficiency, efficiencyError); } double triggSign = trigg.sign(); double triggForDeltaPhiStar[] = {trigg.phi(), trigg.pt(), triggSign}; @@ -812,6 +887,12 @@ struct HStrangeCorrelation { hEfficiencyCascade[2] = hEfficiencyOmegaMinus; hEfficiencyCascade[3] = hEfficiencyOmegaPlus; + TH2F* hEfficiencyUncertaintyCascade[4]; + hEfficiencyUncertaintyCascade[0] = hEfficiencyUncertaintyXiMinus; + hEfficiencyUncertaintyCascade[1] = hEfficiencyUncertaintyXiPlus; + hEfficiencyUncertaintyCascade[2] = hEfficiencyUncertaintyOmegaMinus; + hEfficiencyUncertaintyCascade[3] = hEfficiencyUncertaintyOmegaPlus; + float etaWeight = 1; if (systCuts.doOnTheFlyFlattening) { float preWeight = 1 - std::abs(deltaeta) / 1.6; @@ -821,20 +902,31 @@ struct HStrangeCorrelation { static_for<0, 3>([&](auto i) { constexpr int Index = i.value; float efficiency = 1.0f; + float efficiencytrigg = 1.0f; + float totalEffUncert = 0.0; + float efficiencyError = 0.0f; + float triggerEfficiencyError = 0.0f; if (applyEfficiencyCorrection) { efficiency = hEfficiencyCascade[Index]->Interpolate(ptassoc, assoc.eta()); + if (applyEfficiencyPropagation) + efficiencyError = hEfficiencyUncertaintyCascade[Index]->Interpolate(ptassoc, assoc.eta()); } if (applyEfficiencyForTrigger) { efficiency = efficiency * hEfficiencyTrigger->Interpolate(pttrigger, trigg.eta()); + if (applyEfficiencyPropagation) + triggerEfficiencyError = hEfficiencyUncertaintyTrigger->Interpolate(pttrigger, trigg.eta()); } if (efficiency == 0) { // check for zero efficiency, do not apply if the case efficiency = 1; + efficiencyError = 0; } - float weight = (applyEfficiencyCorrection || applyEfficiencyForTrigger) ? 1. / efficiency : 1.0f; - weight = weight * etaWeight; + if (applyEfficiencyPropagation) { + totalEffUncert = std::sqrt(std::pow(efficiencytrigg * efficiencyError, 2) + std::pow(triggerEfficiencyError * efficiency, 2)); + } + double binFillThn[6] = {deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult}; if (TESTBIT(doCorrelation, Index + 3) && (!applyEfficiencyCorrection || efficiency != 0) && (doPPAnalysis || (TESTBIT(CascselMap, Index) && TESTBIT(CascselMap, Index + 4) && TESTBIT(CascselMap, Index + 8) && TESTBIT(CascselMap, Index + 12)))) { if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && !mixing && -massWindowConfigurations.maxBgNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < -massWindowConfigurations.minBgNSigma) { - histos.fill(HIST("sameEvent/LeftBg/") + HIST(kCascadenames[Index]), deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult, weight); + fillCorrelationHistogram(histos.get(HIST("sameEvent/LeftBg/") + HIST(kCascadenames[Index])), binFillThn, etaWeight, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f); if (doDeltaPhiStarCheck) { double deltaPhiStar = calculateAverageDeltaPhiStar(triggForDeltaPhiStar, assocForDeltaPhiStar, bField); if ((Index == 0 && triggSign > 0) || (Index == 1 && triggSign < 0) || (Index == 2 && triggSign > 0) || (Index == 3 && triggSign < 0)) @@ -844,7 +936,7 @@ struct HStrangeCorrelation { } } if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && !mixing && -massWindowConfigurations.maxPeakNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < +massWindowConfigurations.maxPeakNSigma) { - histos.fill(HIST("sameEvent/Signal/") + HIST(kCascadenames[Index]), deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult, weight); + fillCorrelationHistogram(histos.get(HIST("sameEvent/Signal/") + HIST(kCascadenames[Index])), binFillThn, etaWeight, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f); if (doDeltaPhiStarCheck) { double deltaPhiStar = calculateAverageDeltaPhiStar(triggForDeltaPhiStar, assocForDeltaPhiStar, bField); if ((Index == 0 && triggSign > 0) || (Index == 1 && triggSign < 0) || (Index == 2 && triggSign > 0) || (Index == 3 && triggSign < 0)) @@ -854,7 +946,7 @@ struct HStrangeCorrelation { } } if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && !mixing && +massWindowConfigurations.minBgNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < +massWindowConfigurations.maxBgNSigma) { - histos.fill(HIST("sameEvent/RightBg/") + HIST(kCascadenames[Index]), deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult, weight); + fillCorrelationHistogram(histos.get(HIST("sameEvent/RightBg/") + HIST(kCascadenames[Index])), binFillThn, etaWeight, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f); if (doDeltaPhiStarCheck) { double deltaPhiStar = calculateAverageDeltaPhiStar(triggForDeltaPhiStar, assocForDeltaPhiStar, bField); if ((Index == 0 && triggSign > 0) || (Index == 1 && triggSign < 0) || (Index == 2 && triggSign > 0) || (Index == 3 && triggSign < 0)) @@ -864,11 +956,11 @@ struct HStrangeCorrelation { } } if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && mixing && -massWindowConfigurations.maxBgNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < -massWindowConfigurations.minBgNSigma) - histos.fill(HIST("mixedEvent/LeftBg/") + HIST(kCascadenames[Index]), deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult, weight); + fillCorrelationHistogram(histos.get(HIST("mixedEvent/LeftBg/") + HIST(kCascadenames[Index])), binFillThn, 1, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f); if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && mixing && -massWindowConfigurations.maxPeakNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < +massWindowConfigurations.maxPeakNSigma) - histos.fill(HIST("mixedEvent/Signal/") + HIST(kCascadenames[Index]), deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult, weight); + fillCorrelationHistogram(histos.get(HIST("mixedEvent/Signal/") + HIST(kCascadenames[Index])), binFillThn, 1, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f); if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && mixing && +massWindowConfigurations.minBgNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < +massWindowConfigurations.maxBgNSigma) - histos.fill(HIST("mixedEvent/RightBg/") + HIST(kCascadenames[Index]), deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult, weight); + fillCorrelationHistogram(histos.get(HIST("mixedEvent/RightBg/") + HIST(kCascadenames[Index])), binFillThn, 1, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f); } }); } @@ -887,17 +979,20 @@ struct HStrangeCorrelation { if (!mixing) { float efficiency = 1.0f; + float efficiencyError = 0.0f; if (applyEfficiencyForTrigger) { efficiency = hEfficiencyTrigger->Interpolate(trigg.pt(), trigg.eta()); + if (applyEfficiencyPropagation) + hEfficiencyUncertaintyTrigger->Interpolate(trigg.pt(), trigg.eta()); if (efficiency == 0) { // check for zero efficiency, do not apply if the case efficiency = 1; + efficiencyError = 0; } } - float weight = (applyEfficiencyForTrigger) ? 1. / efficiency : 1.0f; if constexpr (requires { triggerTrack.extra(); }) - histos.fill(HIST("sameEvent/TriggerParticlesPion"), trigg.pt(), mult, weight); + fillTriggerHistogram(histos.get(HIST("sameEvent/TriggerParticlesPion")), trigg.pt(), mult, efficiency, efficiencyError); else - histos.fill(HIST("sameEvent/TriggerParticlesHadron"), trigg.pt(), mult, weight); + fillTriggerHistogram(histos.get(HIST("sameEvent/TriggerParticlesHadron")), trigg.pt(), mult, efficiency, efficiencyError); } double triggSign = trigg.sign(); double triggForDeltaPhiStar[] = {trigg.phi(), trigg.pt(), triggSign}; @@ -943,27 +1038,54 @@ struct HStrangeCorrelation { continue; float efficiency = 1; + float efficiencyTrigg = 1.0f; float purity = 1.0f; + float purityUncertainty = 0.0f; + float purityTrigger = 1.0f; + float triggerPurityUncertainty = 0.0f; + float triggerEfficiencyUncert = 0.0f; + float totalEffUncert = 0.0; + float efficiencyUncertainty = 0.0f; + float totalPurityUncert = 0.0; if (applyEfficiencyCorrection) { if constexpr (requires { assocTrack.nSigmaTPCPi(); }) { efficiency = hEfficiencyPion->Interpolate(ptassoc, assoc.eta()); + if (applyEfficiencyPropagation) + efficiencyUncertainty = hEfficiencyUncertaintyPion->Interpolate(ptassoc, assoc.eta()); } else { efficiency = hEfficiencyHadron->Interpolate(ptassoc, assoc.eta()); purity = hPurityHadron->Interpolate(ptassoc); + if (applyEfficiencyPropagation) { + efficiencyUncertainty = hEfficiencyUncertaintyHadron->Interpolate(ptassoc, assoc.eta()); + purityUncertainty = hPurityUncertaintyHadron->Interpolate(ptassoc); + } } } if (applyEfficiencyForTrigger) { - efficiency = efficiency * hEfficiencyTrigger->Interpolate(pttrigger, trigg.eta()); - purity = purity * hPurityHadron->Interpolate(pttrigger); + efficiencyTrigg = hEfficiencyTrigger->Interpolate(pttrigger, trigg.eta()); + purityTrigger = hPurityHadron->Interpolate(pttrigger); + if (applyEfficiencyPropagation) { + triggerEfficiencyUncert = hEfficiencyUncertaintyTrigger->Interpolate(ptassoc, assoc.eta()); + triggerPurityUncertainty = hPurityUncertaintyHadron->Interpolate(ptassoc); + } } if (efficiency == 0) { // check for zero efficiency, do not apply if the case efficiency = 1; + efficiencyUncertainty = 0.0; + } + if (efficiencyTrigg == 0) { + efficiencyTrigg = 1.0; + triggerEfficiencyUncert = 0.0; + } + if (applyEfficiencyPropagation) { + totalEffUncert = std::sqrt(std::pow(efficiencyTrigg * efficiencyUncertainty, 2) + std::pow(triggerEfficiencyUncert * efficiency, 2)); + totalPurityUncert = std::sqrt(std::pow(purityTrigger * purityUncertainty, 2) + std::pow(purity * triggerPurityUncertainty, 2)); } - float weight = (applyEfficiencyCorrection || applyEfficiencyForTrigger) ? purity / efficiency : 1.0f; + double binFillThn[6] = {deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult}; double deltaPhiStar = calculateAverageDeltaPhiStar(triggForDeltaPhiStar, assocForDeltaPhiStar, bField); if (!mixing) { if constexpr (requires { assocTrack.nSigmaTPCPi(); }) { - histos.fill(HIST("sameEvent/Signal/Pion"), deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult, weight * etaWeight); + fillCorrelationHistogram(histos.get(HIST("sameEvent/Signal/Pion")), binFillThn, etaWeight, efficiency * efficiencyTrigg, totalEffUncert, purity * purityTrigger, totalPurityUncert); if (triggSign == assocSign && doDeltaPhiStarCheck) { histos.fill(HIST("sameEvent/Signal/Pion") + HIST("DeltaPhiStar"), deltaPhiStar, trigg.eta() - assoc.eta(), 0.5); } else if (doDeltaPhiStarCheck) { @@ -975,13 +1097,13 @@ struct HStrangeCorrelation { } else if (doDeltaPhiStarCheck) { histos.fill(HIST("sameEvent/Signal/Hadron") + HIST("DeltaPhiStar"), deltaPhiStar, trigg.eta() - assoc.eta(), -0.5); } - histos.fill(HIST("sameEvent/Signal/Hadron"), deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult, weight * etaWeight); + fillCorrelationHistogram(histos.get(HIST("sameEvent/Signal/Hadron")), binFillThn, etaWeight, efficiency * efficiencyTrigg, totalEffUncert, purity * purityTrigger, totalPurityUncert); } } else { if constexpr (requires { assocTrack.nSigmaTPCPi(); }) { - histos.fill(HIST("mixedEvent/Signal/Pion"), deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult, weight); + fillCorrelationHistogram(histos.get(HIST("mixedEvent/Signal/Pion")), binFillThn, 1, efficiency * efficiencyTrigg, totalEffUncert, purity * purityTrigger, totalPurityUncert); } else { - histos.fill(HIST("mixedEvent/Signal/Hadron"), deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult, weight); + fillCorrelationHistogram(histos.get(HIST("mixedEvent/Signal/Hadron")), binFillThn, 1, efficiency * efficiencyTrigg, totalEffUncert, purity * purityTrigger, totalPurityUncert); } } } @@ -1001,9 +1123,20 @@ struct HStrangeCorrelation { hEfficiencyXiPlus = 0x0; hEfficiencyOmegaMinus = 0x0; hEfficiencyOmegaPlus = 0x0; + hEfficiencyUncertaintyTrigger = 0x0; + hEfficiencyUncertaintyXiMinus = 0x0; + hEfficiencyUncertaintyXiPlus = 0x0; + hEfficiencyUncertaintyOmegaMinus = 0x0; + hEfficiencyUncertaintyOmegaPlus = 0x0; + hEfficiencyUncertaintyPion = 0x0; + hEfficiencyUncertaintyK0Short = 0x0; + hEfficiencyUncertaintyLambda = 0x0; + hEfficiencyUncertaintyAntiLambda = 0x0; hEfficiencyHadron = 0x0; hPurityHadron = 0x0; + hPurityUncertaintyHadron = 0x0; + hEfficiencyUncertaintyHadron = 0x0; // set bitmap for convenience doCorrelation = 0; @@ -1035,14 +1168,14 @@ struct HStrangeCorrelation { // --- multiplicity -> check // grab axis edge from ConfigurableAxes - const AxisSpec preAxisDeltaPhi{axisDeltaPhi, "#Delta#varphi"}; - const AxisSpec preAxisDeltaEta{axisDeltaEta, "#Delta#eta"}; - const AxisSpec preAxisPtAssoc{axisPtAssoc, "#it{p}_{T}^{assoc} (GeV/c)"}; - const AxisSpec preAxisPtTrigger{axisPtTrigger, "#it{p}_{T}^{trigger} (GeV/c)"}; - const AxisSpec preAxisVtxZ{axisVtxZ, "vertex Z (cm)"}; - const AxisSpec preAxisMult{axisMult, "mult percentile"}; - const AxisSpec axisPtLambda{axisPtAssoc, "#it{p}_{T}^{#Lambda} (GeV/c)"}; - const AxisSpec axisPtCascade{axisPtAssoc, "#it{p}_{T}^{Mother} (GeV/c)"}; + const AxisSpec preAxisDeltaPhi{axesConfigurations.axisDeltaPhi, "#Delta#varphi"}; + const AxisSpec preAxisDeltaEta{axesConfigurations.axisDeltaEta, "#Delta#eta"}; + const AxisSpec preAxisPtAssoc{axesConfigurations.axisPtAssoc, "#it{p}_{T}^{assoc} (GeV/c)"}; + const AxisSpec preAxisPtTrigger{axesConfigurations.axisPtTrigger, "#it{p}_{T}^{trigger} (GeV/c)"}; + const AxisSpec preAxisVtxZ{axesConfigurations.axisVtxZ, "vertex Z (cm)"}; + const AxisSpec preAxisMult{axesConfigurations.axisMult, "mult percentile"}; + const AxisSpec axisPtLambda{axesConfigurations.axisPtAssoc, "#it{p}_{T}^{#Lambda} (GeV/c)"}; + const AxisSpec axisPtCascade{axesConfigurations.axisPtAssoc, "#it{p}_{T}^{Mother} (GeV/c)"}; // store the original axes in specific TH1Cs for completeness histos.add("axes/hDeltaPhiAxis", "", kTH1C, {preAxisDeltaPhi}); @@ -1187,23 +1320,23 @@ struct HStrangeCorrelation { } // Some QA plots if (doprocessMCGenerated) { - histos.add("hGeneratedQAPtTrigger", "hGeneratedQAPtTrigger", kTH2F, {axisPtQA, {5, -0.5f, 4.5f}}); - histos.add("hGeneratedQAPtAssociatedK0", "hGeneratedQAPtAssociatedK0", kTH2F, {axisPtQA, {5, -0.5f, 4.5f}}); + histos.add("hGeneratedQAPtTrigger", "hGeneratedQAPtTrigger", kTH2F, {axesConfigurations.axisPtQA, {5, -0.5f, 4.5f}}); + histos.add("hGeneratedQAPtAssociatedK0", "hGeneratedQAPtAssociatedK0", kTH2F, {axesConfigurations.axisPtQA, {5, -0.5f, 4.5f}}); } if (doprocessClosureTest) { - histos.add("hClosureQAPtTrigger", "hClosureQAPtTrigger", kTH2F, {axisPtQA, {5, -0.5f, 4.5f}}); - histos.add("hClosureQAPtAssociatedK0", "hClosureQAPtAssociatedK0", kTH2F, {axisPtQA, {5, -0.5f, 4.5f}}); + histos.add("hClosureQAPtTrigger", "hClosureQAPtTrigger", kTH2F, {axesConfigurations.axisPtQA, {5, -0.5f, 4.5f}}); + histos.add("hClosureQAPtAssociatedK0", "hClosureQAPtAssociatedK0", kTH2F, {axesConfigurations.axisPtQA, {5, -0.5f, 4.5f}}); } if (doprocessMCGenerated || doprocessClosureTest) { histos.add("hClosureTestEventCounter", "hClosureTestEventCounter", kTH1F, {{10, 0, 10}}); } if (doprocessSameEventHV0s || doprocessSameEventHCascades || doprocessSameEventHPions || doprocessSameEventHHadrons) { - histos.add("hTriggerAllSelectedEtaVsPt", "hTriggerAllSelectedEtaVsPt", kTH3F, {axisPtQA, axisEta, axisMult}); + histos.add("hTriggerAllSelectedEtaVsPt", "hTriggerAllSelectedEtaVsPt", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult}); // QA and THn Histograms - histos.add("hTriggerPtResolution", ";p_{T}^{reconstructed} (GeV/c); p_{T}^{generated} (GeV/c)", kTH2F, {axisPtQA, axisPtQA}); - histos.add("hTriggerPrimaryEtaVsPt", "hTriggerPrimaryEtaVsPt", kTH3F, {axisPtQA, axisEta, axisMult}); - histos.add("hTrackEtaVsPtVsPhi", "hTrackEtaVsPtVsPhi", kTH3F, {axisPtQA, axisEta, axisPhi}); - histos.add("hAssocTrackEtaVsPtVsPhi", "hAssocTrackEtaVsPtVsPhi", kTH3F, {axisPtQA, axisEta, axisPhi}); + histos.add("hTriggerPtResolution", ";p_{T}^{reconstructed} (GeV/c); p_{T}^{generated} (GeV/c)", kTH2F, {axesConfigurations.axisPtQA, axesConfigurations.axisPtQA}); + histos.add("hTriggerPrimaryEtaVsPt", "hTriggerPrimaryEtaVsPt", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult}); + histos.add("hTrackEtaVsPtVsPhi", "hTrackEtaVsPtVsPhi", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisPhi}); + histos.add("hAssocTrackEtaVsPtVsPhi", "hAssocTrackEtaVsPtVsPhi", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisPhi}); // histos.add("hTrackAttempt", "Attempt", kTH3F, {axisPtQA, axisEta, axisPhi}); } if (doprocessSameEventHPions || doprocessSameEventHHadrons || doprocessMixedEventHPions || doprocessMixedEventHHadrons) { @@ -1226,7 +1359,7 @@ struct HStrangeCorrelation { // Event QA histos.add("EventQA/hMixingQA", "mixing QA", kTH1F, {{2, -0.5, 1.5}}); - histos.add("EventQA/hMult", "Multiplicity", kTH1F, {axisMult}); + histos.add("EventQA/hMult", "Multiplicity", kTH1F, {axesConfigurations.axisMult}); histos.add("EventQA/hPvz", ";pvz;Entries", kTH1F, {{30, -15, 15}}); histos.add("EventQA/hMultFT0vsTPC", ";centFT0M;multNTracksPVeta1", kTH2F, {{100, 0, 100}, {300, 0, 300}}); } @@ -1234,31 +1367,31 @@ struct HStrangeCorrelation { bool hStrange = false; for (int i = 0; i < 9; i++) { if (TESTBIT(doCorrelation, i)) { - histos.add(fmt::format("h{}EtaVsPtVsPhi", kParticlenames[i]).c_str(), "", kTH3F, {axisPtQA, axisEta, axisPhi}); - histos.add(fmt::format("h3d{}Spectrum", kParticlenames[i]).c_str(), fmt::format("h3d{}Spectrum", kParticlenames[i]).c_str(), kTH3F, {axisPtQA, axisMult, axisMassNSigma}); - histos.add(fmt::format("h3d{}SpectrumY", kParticlenames[i]).c_str(), fmt::format("h3d{}SpectrumY", kParticlenames[i]).c_str(), kTH3F, {axisPtQA, axisMult, axisMassNSigma}); + histos.add(fmt::format("h{}EtaVsPtVsPhi", kParticlenames[i]).c_str(), "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisPhi}); + histos.add(fmt::format("h3d{}Spectrum", kParticlenames[i]).c_str(), fmt::format("h3d{}Spectrum", kParticlenames[i]).c_str(), kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisMult, axesConfigurations.axisMassNSigma}); + histos.add(fmt::format("h3d{}SpectrumY", kParticlenames[i]).c_str(), fmt::format("h3d{}SpectrumY", kParticlenames[i]).c_str(), kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisMult, axesConfigurations.axisMassNSigma}); histos.add(fmt::format("sameEvent/Signal/{}", kParticlenames[i]).c_str(), "", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim}); if (doDeltaPhiStarCheck) { histos.add(fmt::format("sameEvent/Signal/{}DeltaPhiStar", kParticlenames[i]).c_str(), "", kTH3F, {{100, -0.3, 0.3}, {50, -0.05, 0.05}, {2, -1, 1}}); // -1 oposite charge, 1 same charge } if (i < 7) { hStrange = true; - histos.add(fmt::format("h{}EtaVsPtVsPhiBg", kParticlenames[i]).c_str(), "", kTH3F, {axisPtQA, axisEta, axisPhi}); + histos.add(fmt::format("h{}EtaVsPtVsPhiBg", kParticlenames[i]).c_str(), "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisPhi}); if (doITSClustersQA) { - histos.add(fmt::format("hITSClusters{}NegativeDaughterToward", kParticlenames[i]).c_str(), "", kTH3F, {axisPtAssoc, {8, -0.5, 7.5}, {20, 0, 10}}); - histos.add(fmt::format("hITSClusters{}PositiveDaughterToward", kParticlenames[i]).c_str(), "", kTH3F, {axisPtAssoc, {8, -0.5, 7.5}, {20, 0, 10}}); - histos.add(fmt::format("hITSClusters{}NegativeDaughterTransverse", kParticlenames[i]).c_str(), "", kTH3F, {axisPtAssoc, {8, -0.5, 7.5}, {20, 0, 10}}); - histos.add(fmt::format("hITSClusters{}PositiveDaughterTransverse", kParticlenames[i]).c_str(), "", kTH3F, {axisPtAssoc, {8, -0.5, 7.5}, {20, 0, 10}}); + histos.add(fmt::format("hITSClusters{}NegativeDaughterToward", kParticlenames[i]).c_str(), "", kTH3F, {axesConfigurations.axisPtAssoc, {8, -0.5, 7.5}, {20, 0, 10}}); + histos.add(fmt::format("hITSClusters{}PositiveDaughterToward", kParticlenames[i]).c_str(), "", kTH3F, {axesConfigurations.axisPtAssoc, {8, -0.5, 7.5}, {20, 0, 10}}); + histos.add(fmt::format("hITSClusters{}NegativeDaughterTransverse", kParticlenames[i]).c_str(), "", kTH3F, {axesConfigurations.axisPtAssoc, {8, -0.5, 7.5}, {20, 0, 10}}); + histos.add(fmt::format("hITSClusters{}PositiveDaughterTransverse", kParticlenames[i]).c_str(), "", kTH3F, {axesConfigurations.axisPtAssoc, {8, -0.5, 7.5}, {20, 0, 10}}); } } } } if (TESTBIT(doCorrelation, 8)) { - histos.add("hAsssocTrackEtaVsPtVsPhi", "", kTH3F, {axisPtQA, axisEta, axisPhi}); - histos.add("hAssocPrimaryEtaVsPt", "", kTH3F, {axisPtQA, axisEta, axisMult}); - histos.add("hAssocHadronsAllSelectedEtaVsPt", "", kTH3F, {axisPtQA, axisEta, axisMult}); - histos.add("hAssocPtResolution", ";p_{T}^{reconstructed} (GeV/c); p_{T}^{generated} (GeV/c)", kTH2F, {axisPtQA, axisPtQA}); + histos.add("hAsssocTrackEtaVsPtVsPhi", "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisPhi}); + histos.add("hAssocPrimaryEtaVsPt", "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult}); + histos.add("hAssocHadronsAllSelectedEtaVsPt", "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult}); + histos.add("hAssocPtResolution", ";p_{T}^{reconstructed} (GeV/c); p_{T}^{generated} (GeV/c)", kTH2F, {axesConfigurations.axisPtQA, axesConfigurations.axisPtQA}); } if (hStrange) { @@ -1272,40 +1405,40 @@ struct HStrangeCorrelation { histos.addClone("sameEvent/", "mixedEvent/"); } if (doprocessSameEventHHadrons) - histos.add("sameEvent/TriggerParticlesHadron", "TriggersHadron", kTH2F, {axisPtQA, axisMult}); + histos.add("sameEvent/TriggerParticlesHadron", "TriggersHadron", kTH2F, {axesConfigurations.axisPtQA, axesConfigurations.axisMult}); if (doprocessSameEventHV0s) - histos.add("sameEvent/TriggerParticlesV0", "TriggersV0", kTH2F, {axisPtQA, axisMult}); + histos.add("sameEvent/TriggerParticlesV0", "TriggersV0", kTH2F, {axesConfigurations.axisPtQA, axesConfigurations.axisMult}); if (doprocessSameEventHCascades) - histos.add("sameEvent/TriggerParticlesCascade", "TriggersCascade", kTH2F, {axisPtQA, axisMult}); + histos.add("sameEvent/TriggerParticlesCascade", "TriggersCascade", kTH2F, {axesConfigurations.axisPtQA, axesConfigurations.axisMult}); if (doprocessSameEventHPions) - histos.add("sameEvent/TriggerParticlesPion", "TriggersPion", kTH2F, {axisPtQA, axisMult}); + histos.add("sameEvent/TriggerParticlesPion", "TriggersPion", kTH2F, {axesConfigurations.axisPtQA, axesConfigurations.axisMult}); // MC generated plots if (doprocessMCGenerated) { - histos.add("Generated/hTrigger", "", kTH2F, {axisPtQA, axisEta}); + histos.add("Generated/hTrigger", "", kTH2F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta}); for (int i = 0; i < 9; i++) { - histos.add(fmt::format("Generated/h{}", kParticlenames[i]).c_str(), "", kTH2F, {axisPtQA, axisEta}); + histos.add(fmt::format("Generated/h{}", kParticlenames[i]).c_str(), "", kTH2F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta}); } histos.addClone("Generated/", "GeneratedWithPV/"); // histograms within |y|<0.5, vs multiplicity for (int i = 0; i < 8; i++) { - histos.add(fmt::format("GeneratedWithPV/h{}_MidYVsMult", kParticlenames[i]).c_str(), "", kTH2F, {axisPtQA, axisMult}); - histos.add(fmt::format("GeneratedWithPV/h{}_MidYVsMult_TwoPVsOrMore", kParticlenames[i]).c_str(), "", kTH2F, {axisPtQA, axisMult}); + histos.add(fmt::format("GeneratedWithPV/h{}_MidYVsMult", kParticlenames[i]).c_str(), "", kTH2F, {axesConfigurations.axisPtQA, axesConfigurations.axisMult}); + histos.add(fmt::format("GeneratedWithPV/h{}_MidYVsMult_TwoPVsOrMore", kParticlenames[i]).c_str(), "", kTH2F, {axesConfigurations.axisPtQA, axesConfigurations.axisMult}); } - histos.add("GeneratedWithPV/hLambdaFromXiZero", "", kTH2F, {axisPtQA, axisEta}); - histos.add("GeneratedWithPV/hLambdaFromXiMinus", "", kTH2F, {axisPtQA, axisEta}); - histos.add("GeneratedWithPV/hAntiLambdaFromXiZero", "", kTH2F, {axisPtQA, axisEta}); - histos.add("GeneratedWithPV/hAntiLambdaFromXiPlus", "", kTH2F, {axisPtQA, axisEta}); + histos.add("GeneratedWithPV/hLambdaFromXiZero", "", kTH2F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta}); + histos.add("GeneratedWithPV/hLambdaFromXiMinus", "", kTH2F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta}); + histos.add("GeneratedWithPV/hAntiLambdaFromXiZero", "", kTH2F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta}); + histos.add("GeneratedWithPV/hAntiLambdaFromXiPlus", "", kTH2F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta}); } if (doprocessClosureTest) { for (int i = 0; i < 9; i++) { if (TESTBIT(doCorrelation, i)) histos.add(fmt::format("ClosureTest/sameEvent/{}", kParticlenames[i]).c_str(), "", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim}); if (TESTBIT(doCorrelation, i)) - histos.add(fmt::format("ClosureTest/h{}", kParticlenames[i]).c_str(), "", kTH3F, {axisPtQA, axisEta, axisPhi}); + histos.add(fmt::format("ClosureTest/h{}", kParticlenames[i]).c_str(), "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisPhi}); } - histos.add("ClosureTest/hTrigger", "Trigger Tracks", kTH3F, {axisPtQA, axisEta, axisMult}); + histos.add("ClosureTest/hTrigger", "Trigger Tracks", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult}); } if (doprocessFeedDown) { histos.add("hLambdaXiMinusFeeddownMatrix", "hLambdaXiMinusFeeddownMatrix", kTH2F, {axisPtLambda, axisPtCascade}); @@ -1314,10 +1447,10 @@ struct HStrangeCorrelation { histos.add("hAntiLambdaXiPlusFeeddownMatrix", "hAntiLambdaXiPlusFeeddownMatrix", kTH2F, {axisPtLambda, axisPtCascade}); histos.add("hAntiLambdaXiZeroFeeddownMatrix", "hAntiLambdaXiZeroFeeddownMatrix", kTH2F, {axisPtLambda, axisPtCascade}); histos.add("hAntiLambdaOmegaFeeddownMatrix", "hAntiLambdaOmegaFeeddownMatrix", kTH2F, {axisPtLambda, axisPtCascade}); - histos.add("hLambdaFromXiMinusEtaVsPtVsPhi", "hLambdaFromXiMinusEtaVsPtVsPhi", kTH3F, {axisPtQA, axisEta, axisPhi}); - histos.add("hLambdaFromXiZeroEtaVsPtVsPhi", "hLambdaFromXiZeroEtaVsPtVsPhi", kTH3F, {axisPtQA, axisEta, axisPhi}); - histos.add("hAntiLambdaFromXiPlusEtaVsPtVsPhi", "hAntiLambdaFromXiPlusEtaVsPtVsPhi", kTH3F, {axisPtQA, axisEta, axisPhi}); - histos.add("hAntiLambdaFromXiZeroEtaVsPtVsPhi", "hAntiLambdaFromXiZeroEtaVsPtVsPhi", kTH3F, {axisPtQA, axisEta, axisPhi}); + histos.add("hLambdaFromXiMinusEtaVsPtVsPhi", "hLambdaFromXiMinusEtaVsPtVsPhi", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisPhi}); + histos.add("hLambdaFromXiZeroEtaVsPtVsPhi", "hLambdaFromXiZeroEtaVsPtVsPhi", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisPhi}); + histos.add("hAntiLambdaFromXiPlusEtaVsPtVsPhi", "hAntiLambdaFromXiPlusEtaVsPtVsPhi", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisPhi}); + histos.add("hAntiLambdaFromXiZeroEtaVsPtVsPhi", "hAntiLambdaFromXiZeroEtaVsPtVsPhi", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisPhi}); } // visual inspection of sizes @@ -1581,7 +1714,7 @@ struct HStrangeCorrelation { V0DatasWithoutTrackX const&, TracksComplete const&, aod::BCsWithTimestamps const&) { if (!doPPAnalysis) { - BinningTypePbPb colBinning{{axisVtxZ, axisMult}, true}; + BinningTypePbPb colBinning{{axesConfigurations.axisVtxZ, axesConfigurations.axisMult}, true}; } double cent = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); // ________________________________________________ @@ -1681,7 +1814,7 @@ struct HStrangeCorrelation { V0DatasWithoutTrackX const&, aod::CascDatas const&, TracksComplete const&, aod::BCsWithTimestamps const&) { if (!doPPAnalysis) { - BinningTypePbPb colBinning{{axisVtxZ, axisMult}, true}; + BinningTypePbPb colBinning{{axesConfigurations.axisVtxZ, axesConfigurations.axisMult}, true}; } double cent = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); // ________________________________________________ @@ -1880,7 +2013,7 @@ struct HStrangeCorrelation { V0DatasWithoutTrackX const&, TracksComplete const&, aod::BCsWithTimestamps const&) { if (!doPPAnalysis) { - BinningTypePbPb colBinning{{axisVtxZ, axisMult}, true}; + BinningTypePbPb colBinning{{axesConfigurations.axisVtxZ, axesConfigurations.axisMult}, true}; } for (auto const& [collision1, collision2] : soa::selfCombinations(colBinning, mixingParameter, -1, collisions, collisions)) { double cent1 = doPPAnalysis ? collision1.centFT0M() : collision1.centFT0C(); @@ -1928,7 +2061,7 @@ struct HStrangeCorrelation { V0DatasWithoutTrackX const&, aod::CascDatas const&, TracksComplete const&, aod::BCsWithTimestamps const&) { if (!doPPAnalysis) { - BinningTypePbPb colBinning{{axisVtxZ, axisMult}, true}; + BinningTypePbPb colBinning{{axesConfigurations.axisVtxZ, axesConfigurations.axisMult}, true}; } for (auto const& [collision1, collision2] : soa::selfCombinations(colBinning, mixingParameter, -1, collisions, collisions)) { double cent1 = doPPAnalysis ? collision1.centFT0M() : collision1.centFT0C(); From 0dcaac7eff0781086bb6f11e01f0256bd4e0bf55 Mon Sep 17 00:00:00 2001 From: gitchrishub-oss Date: Tue, 23 Sep 2025 15:41:17 +0200 Subject: [PATCH 503/986] [PWGCF] add debug-task and necessary files for Resonance implementation (#13070) Co-authored-by: Christopher Klumm --- .../FemtoDream/Core/femtoDreamParticleHisto.h | 77 ++++++++- PWGCF/FemtoDream/Tasks/CMakeLists.txt | 5 + .../FemtoDream/Tasks/femtoDreamDebugReso.cxx | 152 ++++++++++++++++++ 3 files changed, 229 insertions(+), 5 deletions(-) create mode 100644 PWGCF/FemtoDream/Tasks/femtoDreamDebugReso.cxx diff --git a/PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h b/PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h index af1caf11879..d61b719250f 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h +++ b/PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h @@ -1,4 +1,4 @@ -// Copyright 2019-2025 CERN and copyright holders of ALICE O2. +// Copyright 2019-2022 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. // @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file FemtoDreamParticleHisto.h +/// \file femtoDreamParticleHisto.h /// \brief FemtoDreamParticleHisto - Histogram class for tracks, V0s and cascades /// \author Andi Mathis, TU München, andreas.mathis@ph.tum.de /// \author Georgios Mantzaridis, TU München, georgios.mantzaridis@tum.de @@ -75,6 +75,15 @@ class FemtoDreamParticleHisto mHistogramRegistry->add((folderName + folderSuffix + "/hInvMassCascade").c_str(), "; M_{Cascade}; Entries", kTH1F, {InvMassAxis}); mHistogramRegistry->add((folderName + folderSuffix + "/hpTInvMassCascade").c_str(), "; p_{T} (GeV/#it{c{}); M_{Cascade}", kTH2F, {pTAxis, InvMassAxis}); } + if constexpr (mParticleType == o2::aod::femtodreamparticle::ParticleType::kReso) { + mHistogramRegistry->add((folderName + folderSuffix + "/hInvMassPhi").c_str(), "; M_{#Phi}; Entries", kTH1F, {InvMassAxis}); // added for Phi !! + mHistogramRegistry->add((folderName + folderSuffix + "/hpTInvMassPhi").c_str(), "; p_{T} (GeV/#it{c{}); M_{#Phi}", kTH2F, {pTAxis, InvMassAxis}); + } + if constexpr (mParticleType == o2::aod::femtodreamparticle::ParticleType::kResoChild) { + + mHistogramRegistry->add((folderName + folderSuffix + "/hInvMassPhi").c_str(), "; M_{#Phi}; Entries", kTH1F, {InvMassAxis}); // added for Phi !! + mHistogramRegistry->add((folderName + folderSuffix + "/hpTInvMassPhi").c_str(), "; p_{T} (GeV/#it{c{}); M_{#Phi}", kTH2F, {pTAxis, InvMassAxis}); + } } // comment @@ -152,6 +161,30 @@ class FemtoDreamParticleHisto mHistogramRegistry->add((folderName + folderSuffix + "/hCascDecayVtxZ").c_str(), "; #it{Vtx}_{z} (cm); Entries", kTH1F, {{2000, 0, 200}}); mHistogramRegistry->add((folderName + folderSuffix + "/hInvMassCompetingCascade").c_str(), "; M_{Competing Cascade}; Entries", kTH1F, {InvMassCompetingAxis}); mHistogramRegistry->add((folderName + folderSuffix + "/hpTInvMassCompetingCascade").c_str(), "; p_{T} (GeV/#it{c{}); M_{Competing Cascade}", kTH2F, {pTAxis, InvMassCompetingAxis}); + } else if constexpr (mParticleType == o2::aod::femtodreamparticle::ParticleType::kResoChild) { + mHistogramRegistry->add((folderName + folderSuffix + "/hCharge").c_str(), "; Charge; Entries", kTH1F, {{5, -2.5, 2.5}}); + mHistogramRegistry->add((folderName + folderSuffix + "/hTPCfindable").c_str(), "; TPC findable clusters; Entries", kTH1F, {{163, -0.5, 162.5}}); + mHistogramRegistry->add((folderName + folderSuffix + "/hTPCfound").c_str(), "; TPC found clusters; Entries", kTH1F, {{163, -0.5, 162.5}}); + mHistogramRegistry->add((folderName + folderSuffix + "/hTPCcrossedOverFindable").c_str(), "; TPC ratio findable over crossed; Entries", kTH1F, {{100, 0.5, 1.5}}); + mHistogramRegistry->add((folderName + folderSuffix + "/hTPCcrossedRows").c_str(), "; TPC crossed rows; Entries", kTH1F, {{163, -0.5, 162.5}}); + mHistogramRegistry->add((folderName + folderSuffix + "/hTPCshared").c_str(), "; TPC shared clusters; Entries", kTH1F, {{163, -0.5, 162.5}}); + mHistogramRegistry->add((folderName + folderSuffix + "/hTPCsharedOverFound").c_str(), "; TPC ratio shared over found; Entries", kTH1F, {{1000, 0, 1}}); + mHistogramRegistry->add((folderName + folderSuffix + "/hTPCfindableVsCrossed").c_str(), ";TPC findable clusters ; TPC crossed rows;", kTH2F, {{163, -0.5, 162.5}, {163, -0.5, 162.5}}); + mHistogramRegistry->add((folderName + folderSuffix + "/hTPCfoundVsShared").c_str(), ";TPC found clusters ; TPC shared clusters;", kTH2F, {{163, -0.5, 162.5}, {163, -0.5, 162.5}}); + mHistogramRegistry->add((folderName + folderSuffix + "/hITSclusters").c_str(), "; ITS clusters; Entries", kTH1F, {{10, -0.5, 9.5}}); + mHistogramRegistry->add((folderName + folderSuffix + "/hITSclustersIB").c_str(), "; ITS clusters in IB; Entries", kTH1F, {{10, -0.5, 9.5}}); + mHistogramRegistry->add((folderName + folderSuffix + "/hDCAz").c_str(), "; #it{p} (GeV/#it{c}); DCA_{z} (cm)", kTH2F, {pTAxis, dcazAxis}); + mHistogramRegistry->add((folderName + folderSuffix + "/hDCA").c_str(), "; #it{p} (GeV/#it{c}); DCA (cm)", kTH2F, {pTAxis, {300, 0., 1.5}}); + mHistogramRegistry->add((folderName + folderSuffix + "/hTPCdEdX").c_str(), "; #it{p} (GeV/#it{c}); TPC Signal", kTH2F, {{100, 0, 10}, {1000, 0, 1000}}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTPC_pi").c_str(), "n#sigma_{TPC}^{#pi}", kTH2F, {pTAxis, NsigmaTPCAxis}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTPC_K").c_str(), "n#sigma_{TPC}^{K}", kTH2F, {pTAxis, NsigmaTPCAxis}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTOF_pi").c_str(), "n#sigma_{TOF}^{#pi}", kTH2F, {pTAxis, NsigmaTOFAxis}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaTOF_K").c_str(), "n#sigma_{TOF}^{K}", kTH2F, {pTAxis, NsigmaTOFAxis}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaComb_pi").c_str(), "n#sigma_{comb}^{#pi}", kTH2F, {pTAxis, NsigmaTPCTOFAxis}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaComb_K").c_str(), "n#sigma_{comb}^{K}", kTH2F, {pTAxis, NsigmaTPCTOFAxis}); + mHistogramRegistry->add((folderName + folderSuffix + "/ITSSignal").c_str(), "x", kTH2F, {pTAxis, NsigmaITSAxis}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaITS_pi").c_str(), "n#sigma_{ITS}^{#pi}", kTH2F, {pTAxis, NsigmaITSAxis}); + mHistogramRegistry->add((folderName + folderSuffix + "/nSigmaITS_K").c_str(), "n#sigma_{ITS}^{K}", kTH2F, {pTAxis, NsigmaITSAxis}); } } @@ -259,6 +292,9 @@ class FemtoDreamParticleHisto if constexpr (mParticleType == o2::aod::femtodreamparticle::ParticleType::kTrack || mParticleType == o2::aod::femtodreamparticle::ParticleType::kV0Child || mParticleType == o2::aod::femtodreamparticle::ParticleType::kCascadeV0Child || mParticleType == o2::aod::femtodreamparticle::ParticleType::kCascadeBachelor) { /// Track histograms tempFitVarAxisTitle = "DCA_{xy} (cm)"; + } else if constexpr (mParticleType == o2::aod::femtodreamparticle::ParticleType::kResoChild || mParticleType == o2::aod::femtodreamparticle::ParticleType::kReso) { // mParticleType == o2::aod::femtodreamparticle::ParticleType::kReso || Phi has no TempFitVar!! + /// Reso histograms added!! + tempFitVarAxisTitle = "DCA_{xy} (cm)"; } else if constexpr (mParticleType == o2::aod::femtodreamparticle::ParticleType::kV0 || mParticleType == o2::aod::femtodreamparticle::ParticleType::kCascadeV0) { /// V0 histograms tempFitVarAxisTitle = "cos#alpha"; @@ -326,6 +362,14 @@ class FemtoDreamParticleHisto // mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hInvMassCascade"), part.mLambda()); // mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hpTInvMassCascade"), part.pt(), part.mLambda()); } + if constexpr (mParticleType == o2::aod::femtodreamparticle::ParticleType::kReso) { + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hInvMassPhi"), part.mLambda()); // currently no MC for Phi!! + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hpTInvMassPhi"), part.pt(), part.mLambda()); // getter from FDPArticles now!! + } + if constexpr (mParticleType == o2::aod::femtodreamparticle::ParticleType::kResoChild) { + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hInvMassPhi"), part.mLambda()); // currently no MC for Phi!! + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hpTInvMassPhi"), part.pt(), part.mLambda()); // getter from FDPArticles now!! + } } template @@ -403,7 +447,7 @@ class FemtoDreamParticleHisto float pidTPC = 0.; float pidTOF = 0.; - switch (abs(mPDG)) { + switch (std::abs(mPDG)) { case kElectron: pidTPC = part.tpcNSigmaEl(); pidTOF = part.tofNSigmaEl(); @@ -463,9 +507,32 @@ class FemtoDreamParticleHisto mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hCascDecayVtxZ"), part.cascDecayVtxZ()); mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hInvMassCompetingCascade"), part.mOmega()); mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hpTInvMassCompetingCascade"), part.pt(), part.mOmega()); + } else if constexpr (mParticleType == o2::aod::femtodreamparticle::ParticleType::kResoChild) { + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hCharge"), part.sign()); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hTPCfindable"), part.tpcNClsFindable()); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hTPCfound"), part.tpcNClsFound()); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hTPCcrossedOverFindable"), part.tpcCrossedRowsOverFindableCls()); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hTPCcrossedRows"), part.tpcNClsCrossedRows()); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hTPCfindableVsCrossed"), part.tpcNClsFindable(), part.tpcNClsCrossedRows()); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hTPCshared"), part.tpcNClsShared()); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hTPCsharedOverFound"), static_cast(part.tpcNClsShared()) / static_cast(part.tpcNClsFound())); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hTPCfoundVsShared"), part.tpcNClsFound(), part.tpcNClsShared()); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hITSclusters"), part.itsNCls()); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hITSclustersIB"), part.itsNClsInnerBarrel()); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hDCAz"), momentum, part.dcaZ()); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hDCA"), momentum, std::sqrt(std::pow(part.dcaXY(), 2.) + std::pow(part.dcaZ(), 2.))); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hTPCdEdX"), momentum, part.tpcSignal()); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaTPC_pi"), momentum, part.tpcNSigmaPi()); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaTPC_K"), momentum, part.tpcNSigmaKa()); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaTOF_pi"), momentum, part.tofNSigmaPi()); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaTOF_K"), momentum, part.tofNSigmaKa()); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaComb_pi"), momentum, std::sqrt(part.tpcNSigmaPi() * part.tpcNSigmaPi() + part.tofNSigmaPi() * part.tofNSigmaPi())); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaComb_K"), momentum, std::sqrt(part.tpcNSigmaKa() * part.tpcNSigmaKa() + part.tofNSigmaKa() * part.tofNSigmaKa())); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/ITSSignal"), momentum, part.itsSignal()); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaITS_pi"), momentum, part.itsNSigmaPi()); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/nSigmaITS_K"), momentum, part.itsNSigmaKa()); } } - /// Filling specialized histograms for Monte Carlo truth /// internal function called by init only in case of Monte Carlo truth /// \tparam T Data type of the particle @@ -486,7 +553,7 @@ class FemtoDreamParticleHisto mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST("_MC/hEta_DiffTruthReco"), MCpart.eta(), (part.eta() - MCpart.eta())); mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST("_MC/hPhi_DiffTruthReco"), MCpart.phi(), (part.phi() - MCpart.phi())); - if (abs(pdgcode) == mPDG) { // fill this histogramm only for TRUE protons (independently of their origin) for the track purity estimation + if (std::abs(pdgcode) == mPDG) { // fill this histogramm only for TRUE protons (independently of their origin) for the track purity estimation mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST("_MC/hPt_ReconNoFake"), part.pt()); } if constexpr (mParticleType == o2::aod::femtodreamparticle::ParticleType::kTrack || mParticleType == o2::aod::femtodreamparticle::ParticleType::kV0Child) { diff --git a/PWGCF/FemtoDream/Tasks/CMakeLists.txt b/PWGCF/FemtoDream/Tasks/CMakeLists.txt index a6a2aa2ed8e..1e20c22c73a 100644 --- a/PWGCF/FemtoDream/Tasks/CMakeLists.txt +++ b/PWGCF/FemtoDream/Tasks/CMakeLists.txt @@ -59,6 +59,11 @@ o2physics_add_dpl_workflow(femtodream-debug-v0 PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(femto-dream-debug-reso + SOURCES femtoDreamDebugReso.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(femtodream-debug-cascade SOURCES femtoDreamDebugCascade.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore diff --git a/PWGCF/FemtoDream/Tasks/femtoDreamDebugReso.cxx b/PWGCF/FemtoDream/Tasks/femtoDreamDebugReso.cxx new file mode 100644 index 00000000000..1a4887ea09f --- /dev/null +++ b/PWGCF/FemtoDream/Tasks/femtoDreamDebugReso.cxx @@ -0,0 +1,152 @@ +// Copyright 2019-2025 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 femtoDreamDebugReso.cxx +/// \brief Tasks that reads the particle tables and fills QA histograms for V0s +/// \author Christopher Klumm, TU München, christopher.klumm@cern.ch + +#include "PWGCF/DataModel/FemtoDerived.h" +#include "PWGCF/FemtoDream/Core/femtoDreamEventHisto.h" +#include "PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h" + +#include "DataFormatsParameters/GRPObject.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" + +#include "TVector3.h" + +#include "fairlogger/Logger.h" + +#include +#include +#include + +using namespace o2; +using namespace o2::analysis::femtoDream; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; + +struct FemtoDreamDebugReso { + SliceCache cache; + + struct : ConfigurableGroup { + std::string prefix = std::string("resonance"); + + Configurable confResoPDGCode{"confResoPDGCode", 333, "Reso - PDG code"}; + Configurable confResoChildPosPDGCode{"confResoChildPosPDGCode", 321, "Positive Child - PDG code"}; + Configurable confResoChildNegPDGCode{"confResoChildNegPDGCode", 321, "Negative Child- PDG code"}; + + ConfigurableAxis confResoTempFitVarBins{"confResoTempFitVarBins", {300, 0.95, 1.}, "Reso: binning of the TempFitVar in the pT vs. TempFitVar plot"}; + ConfigurableAxis confResoTempFitVarMomentumBins{"confResoTempFitVarMomentumBins", {20, 0.5, 4.05}, "Reso: pT binning of the pT vs. TempFitVar plot"}; + ConfigurableAxis confBinmult{"confBinmult", {1, 0, 1}, "multiplicity Binning"}; + ConfigurableAxis confDummy{"confDummy", {1, 0, 1}, "Dummy axis for inv mass"}; + + Configurable confResoTempFitVarMomentum{"confResoTempFitVarMomentum", 0, "Momentum used for binning: 0 -> pt; 1 -> preco; 2 -> ptpc"}; + ConfigurableAxis confResoInvMassBins{"confResoInvMassBins", {200, 1, 1.2}, "Reso: InvMass binning"}; + + ConfigurableAxis confResoChildTempFitVarMomentumBins{"confResoChildTempFitVarMomentumBins", {600, 0, 6}, "p binning for the p vs Nsigma TPC/TOF plot"}; + ConfigurableAxis confResoChildNsigmaTPCBins{"confResoChildNsigmaTPCBins", {1600, -8, 8}, "binning of Nsigma TPC plot"}; // TPC and TOf seperate doen't make sense really right?? + ConfigurableAxis confResoChildNsigmaTOFBins{"confResoChildNsigmaTOFBins", {3000, -15, 15}, "binning of the Nsigma TOF plot"}; + ConfigurableAxis confResoChildNsigmaTPCTOFBins{"confResoChildNsigmaTPCTOFBins", {1000, 0, 10}, "binning of the Nsigma TPC+TOF plot"}; + ConfigurableAxis confResoChildNsigmaITSBins{"confResoChildNsigmaITSBins", {600, -3, 3}, "binning of the Nsigma ITS plot"}; + + Configurable confResoChildPosCutBit{"confResoChildPosCutBit", 4860458, "Positive Child of Reso - Selection bit from cutCulator"}; + Configurable confResoChildPosTPCBit{"confResoChildPosTPCBit", 64, "Positive Child of Reso - PID bit from cutCulator"}; + Configurable confResoChildPosTPCTOFBit{"confResoChildPosTPCTOFBit", 32, "Positive Child of Reso - PID bit from cutCulator"}; + Configurable confResoChildNegCutBit{"confResoChildNegCutBit", 4860457, "Negative Child of Reso - PID bit from cutCulator"}; + Configurable confResoChildNegMergedTPCBit{"confResoChildNegMergedTPCBit", 258, "Negative Child of Reso - PID bit from cutCulator"}; // change + Configurable confResoChildNegMergedTPCTOFBit{"confResoChildNegMergedTPCTOFBit", 130, "Negative Child of Reso - PID bit from cutCulator"}; // change + ConfigurableAxis confChildTempFitVarBins{"confChildTempFitVarBins", {300, -0.15, 0.15}, "V0 child: binning of the TempFitVar in the pT vs. TempFitVar plot"}; + ConfigurableAxis confChildTempFitVarpTBins{"confChildTempFitVarpTBins", {20, 0.5, 4.05}, "V0 child: pT binning of the pT vs. TempFitVar plot"}; + } resonance; + + using FemtoFullParticles = soa::Join; + + Partition partsTwo = (ifnode(aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kResoPosdaughTPC_NegdaughTPC), ncheckbit(aod::femtodreamparticle::pidcut, resonance.confResoChildPosTPCBit) && ncheckbit(aod::femtodreamparticle::cut, resonance.confResoChildNegMergedTPCBit), false) || + ifnode(aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kResoPosdaughTOF_NegdaughTOF), ncheckbit(aod::femtodreamparticle::pidcut, resonance.confResoChildPosTPCTOFBit) && ncheckbit(aod::femtodreamparticle::cut, resonance.confResoChildNegMergedTPCTOFBit), false) || + ifnode(aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kResoPosdaughTOF_NegdaughTPC), ncheckbit(aod::femtodreamparticle::pidcut, resonance.confResoChildPosTPCTOFBit) && ncheckbit(aod::femtodreamparticle::cut, resonance.confResoChildNegMergedTPCBit), false) || + ifnode(aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kResoPosdaughTPC_NegdaughTOF), ncheckbit(aod::femtodreamparticle::pidcut, resonance.confResoChildPosTPCBit) && ncheckbit(aod::femtodreamparticle::cut, resonance.confResoChildNegMergedTPCTOFBit), false)); + + Preslice perCol = aod::femtodreamparticle::fdCollisionId; + + /// Histogramming + FemtoDreamEventHisto eventHisto; + FemtoDreamParticleHisto posResoChildHistos; + FemtoDreamParticleHisto negResoChildHistos; + FemtoDreamParticleHisto resoHistos; + + /// Histogram output + HistogramRegistry eventRegistry{"Event", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry resoRegistry{"FullResoQA", {}, OutputObjHandlingPolicy::AnalysisObject}; + + void init(InitContext&) + { + posResoChildHistos.init(&resoRegistry, resonance.confBinmult, resonance.confDummy, resonance.confResoChildTempFitVarMomentumBins, resonance.confDummy, resonance.confDummy, resonance.confChildTempFitVarBins, resonance.confResoChildNsigmaTPCBins, resonance.confResoChildNsigmaTOFBins, resonance.confResoChildNsigmaTPCTOFBins, resonance.confResoChildNsigmaITSBins, resonance.confResoInvMassBins, resonance.confDummy, false, resonance.confResoChildPosPDGCode.value, true); // isDebug == TRUE + negResoChildHistos.init(&resoRegistry, resonance.confBinmult, resonance.confDummy, resonance.confResoChildTempFitVarMomentumBins, resonance.confDummy, resonance.confDummy, resonance.confChildTempFitVarBins, resonance.confResoChildNsigmaTPCBins, resonance.confResoChildNsigmaTOFBins, resonance.confResoChildNsigmaTPCTOFBins, resonance.confResoChildNsigmaITSBins, resonance.confResoInvMassBins, resonance.confDummy, false, resonance.confResoChildNegPDGCode, true); // isDebug == TRUE + resoHistos.init(&resoRegistry, resonance.confBinmult, resonance.confDummy, resonance.confResoTempFitVarMomentumBins, resonance.confDummy, resonance.confDummy, resonance.confResoTempFitVarBins, resonance.confResoChildNsigmaTPCBins, resonance.confResoChildNsigmaTOFBins, resonance.confResoChildNsigmaTPCTOFBins, resonance.confResoChildNsigmaITSBins, resonance.confResoInvMassBins, resonance.confDummy, false, resonance.confResoPDGCode.value, true); // isDebug == TRUE, isMc ==FALSE for all + resoRegistry.add("hArmenterosPodolanski/hArmenterosPodolanskiPlot", "; #alpha; p_{T} (MeV/#it{c})", kTH2F, {{100, -1, 1}, {500, -0.3, 2}}); + } + + /// Porduce QA plots for V0 & Reso selection in FemtoDream framework + void process(o2::aod::FDCollision const& col, FemtoFullParticles const& parts) + { + + auto groupPartsTwo = partsTwo->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); // maybe . instead of -> ?? + for (const auto& part : groupPartsTwo) { + if (!part.has_children()) { + LOG(warn) << " Reso has no children"; + continue; + } + + const auto& posresoChild = parts.iteratorAt(part.index() - 2); + const auto& negresoChild = parts.iteratorAt(part.index() - 1); + if (posresoChild.globalIndex() != part.childrenIds()[0] || negresoChild.globalIndex() != part.childrenIds()[1]) { + continue; + } + if (posresoChild.partType() == uint8_t(aod::femtodreamparticle::ParticleType::kResoChild) && + (posresoChild.cut() & resonance.confResoChildPosCutBit) == resonance.confResoChildPosCutBit && + negresoChild.partType() == uint8_t(aod::femtodreamparticle::ParticleType::kResoChild) && + (negresoChild.cut() & resonance.confResoChildNegCutBit) == resonance.confResoChildNegCutBit) { + + TVector3 pparent(part.px(), part.py(), part.pz()); // Parent momentum (px, py, pz) + TVector3 pplus(posresoChild.px(), posresoChild.py(), posresoChild.pz()); // Daughter 1 momentum (px, py, pz) + TVector3 pminus(negresoChild.px(), negresoChild.py(), negresoChild.pz()); // Daughter 2 momentum (px, py, pz) + + double pLplus = pplus.Dot(pparent) / pparent.Mag(); + double pLminus = pminus.Dot(pparent) / pparent.Mag(); + float alpha = (pLplus - pLminus) / (pLplus + pLminus); + + TVector3 pperp = pplus - (pparent * (pLplus / pparent.Mag())); + double qtarm = pperp.Mag(); + + resoRegistry.fill(HIST("hArmenterosPodolanski/hArmenterosPodolanskiPlot"), alpha, qtarm); + + resoHistos.fillQA(part, static_cast(resonance.confResoTempFitVarMomentum.value), col.multNtr(), col.multV0M()); + posResoChildHistos.fillQA(posresoChild, static_cast(resonance.confResoTempFitVarMomentum.value), col.multNtr(), col.multV0M()); + negResoChildHistos.fillQA(negresoChild, static_cast(resonance.confResoTempFitVarMomentum.value), col.multNtr(), col.multV0M()); + } + } + } +}; + +WorkflowSpec + defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{ + adaptAnalysisTask(cfgc), + }; + return workflow; +} From 4b7b7831a06ab0ed45d740030a0b6ef397df74dc Mon Sep 17 00:00:00 2001 From: HANSEO PARK <53218370+hanseopark@users.noreply.github.com> Date: Tue, 23 Sep 2025 23:41:49 +0900 Subject: [PATCH 504/986] [PWGJE] Add multiplicity analysis for b-jet and reduce member of struct (#13089) --- PWGJE/Tasks/jetTaggerHFQA.cxx | 439 +++++++++++++++++++++++++--------- 1 file changed, 326 insertions(+), 113 deletions(-) diff --git a/PWGJE/Tasks/jetTaggerHFQA.cxx b/PWGJE/Tasks/jetTaggerHFQA.cxx index 555f59896df..8bb10a544b0 100644 --- a/PWGJE/Tasks/jetTaggerHFQA.cxx +++ b/PWGJE/Tasks/jetTaggerHFQA.cxx @@ -21,6 +21,8 @@ #include "PWGJE/DataModel/JetReducedData.h" #include "PWGJE/DataModel/JetTagging.h" +#include "Common/DataModel/Multiplicity.h" + #include "Framework/ASoA.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" @@ -34,6 +36,7 @@ #include #include +#include #include #include #include @@ -52,24 +55,16 @@ struct JetTaggerHFQA { Configurable fillIPxyz{"fillIPxyz", false, "process of xyz plane of dca"}; Configurable fillTrackCounting{"fillTrackCounting", false, "process of track counting method"}; Configurable fillGeneralSVQA{"fillGeneralSVQA", true, "process of general QA for sv"}; + Configurable fillSVxyz{"fillSVxyz", true, "process of decay lenngth of xyz for sv"}; // Cut configuration Configurable vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"}; - Configurable trackEtaMin{"trackEtaMin", -0.9, "minimum eta acceptance for tracks"}; - Configurable trackEtaMax{"trackEtaMax", 0.9, "maximum eta acceptance for tracks"}; - Configurable trackPtMin{"trackPtMin", 0.15, "minimum pT acceptance for tracks"}; - Configurable trackPtMax{"trackPtMax", 100.0, "maximum pT acceptance for tracks"}; + Configurable> trackCuts{"trackCuts", std::vector{0.15, 100.0, -0.9, 0.9}, "Track cuts: ptMin, ptMax, etaMin, etaMax"}; Configurable trackDcaXYMax{"trackDcaXYMax", 1, "minimum DCA xy acceptance for tracks [cm]"}; Configurable trackDcaZMax{"trackDcaZMax", 2, "minimum DCA z acceptance for tracks [cm]"}; Configurable maxDeltaR{"maxDeltaR", 0.25, "maximum distance of jet axis from flavour initiating parton"}; - Configurable jetEtaMin{"jetEtaMin", -99.0, "minimum jet pseudorapidity"}; - Configurable jetEtaMax{"jetEtaMax", 99.0, "maximum jet pseudorapidity"}; - Configurable prongChi2PCAMin{"prongChi2PCAMin", 1, "minimum Chi2 PCA of decay length of prongs"}; - Configurable prongChi2PCAMax{"prongChi2PCAMax", 100, "maximum Chi2 PCA of decay length of prongs"}; - Configurable prongsigmaLxyMax{"prongsigmaLxyMax", 100, "maximum sigma of decay length of prongs on xy plane"}; - Configurable prongsigmaLxyzMax{"prongsigmaLxyzMax", 100, "maximum sigma of decay length of prongs on xyz plane"}; - Configurable prongIPxyMin{"prongIPxyMin", 0.008, "maximum impact paramter of prongs on xy plane"}; - Configurable prongIPxyMax{"prongIPxyMax", 1, "minimum impact parmeter of prongs on xy plane"}; + Configurable> jetEtaCuts{"jetEtaCuts", std::vector{-99.0, 99.0}, "Jet cuts: etaMin, etaMax"}; + Configurable> prongCuts{"prongCuts", std::vector{1, 100, 100, 100, 0.008, 1}, "prong cuts: chi2PCAMin, chi2PCAMax, sigmaLxyMax, sigmaLxyzMax, IPxyMin, IPxyMax"}; Configurable svDispersionMax{"svDispersionMax", 0.03f, "maximum dispersion of sv"}; Configurable numFlavourSpecies{"numFlavourSpecies", 6, "number of jet flavour species"}; Configurable numOrder{"numOrder", 6, "number of ordering"}; @@ -82,10 +77,10 @@ struct JetTaggerHFQA { Configurable checkMcCollisionIsMatched{"checkMcCollisionIsMatched", false, "0: count whole MCcollisions, 1: select MCcollisions which only have their correspond collisions"}; Configurable trackOccupancyInTimeRangeMax{"trackOccupancyInTimeRangeMax", 999999, "maximum occupancy of tracks in neighbouring collisions in a given time range; only applied to reconstructed collisions (data and mcd jets), not mc collisions (mcp jets)"}; Configurable trackOccupancyInTimeRangeMin{"trackOccupancyInTimeRangeMin", -999999, "minimum occupancy of tracks in neighbouring collisions in a given time range; only applied to reconstructed collisions (data and mcd jets), not mc collisions (mcp jets)"}; - Configurable useQuarkDef{"useQuarkDef", true, "Flag whether to use quarks or hadrons for determining the jet flavor"}; Configurable eventSelections{"eventSelections", "sel8", "choose event selection"}; Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; + // Binning ConfigurableAxis binJetFlavour{"binJetFlavour", {6, -0.5, 5.5}, ""}; ConfigurableAxis binJetPt{"binJetPt", {200, 0., 200.}, ""}; @@ -152,6 +147,7 @@ struct JetTaggerHFQA { AxisSpec axisSigmaLxy = {binSigmaLxy, "#sigma_{L_{XY}} [cm]"}; AxisSpec axisSigmaLxyz = {binSigmaLxyz, "#sigma_{L_{XYZ}} [cm]"}; AxisSpec axisFracSecPt = {100, 0, 1, "#frac{#Sigma#it{p}_{T}^{secondary track}}{#it{p}_{T, jet}}"}; + AxisSpec axisMult = {3500, 0, 3500, "Multiplicity"}; if (doprocessTracksDca) { if (fillIPxy) { @@ -176,16 +172,16 @@ struct JetTaggerHFQA { registry.add("h3_jet_pt_frac_secondary_pt_per_jet_flavour", "", {HistType::kTH3F, {{axisJetPt}, {axisFracSecPt}, {axisJetFlavour}}}); } if (doprocessValFlavourDefMCD) { - registry.add("h2_flavour_dist_quark_flavour_dist_hadron", "", {HistType::kTH2F, {{axisJetFlavour}, {axisJetFlavour}}}); - registry.add("h2_flavour_const_quark_flavour_const_hadron", "", {HistType::kTH2F, {{axisJetFlavour}, {axisJetFlavour}}}); - registry.add("h2_flavour_const_hadron_flavour_dist_hadron", "", {HistType::kTH2F, {{axisJetFlavour}, {axisJetFlavour}}}); - registry.add("h2_flavour_const_quark_flavour_dist_quark", "", {HistType::kTH2F, {{axisJetFlavour}, {axisJetFlavour}}}); + registry.add("h3_jet_pt_flavour_dist_quark_flavour_dist_hadron", "", {HistType::kTH3F, {{axisJetPt}, {axisJetFlavour}, {axisJetFlavour}}}); + registry.add("h3_jet_pt_flavour_const_quark_flavour_const_hadron", "", {HistType::kTH3F, {{axisJetPt}, {axisJetFlavour}, {axisJetFlavour}}}); + registry.add("h3_jet_pt_flavour_const_hadron_flavour_dist_hadron", "", {HistType::kTH3F, {{axisJetPt}, {axisJetFlavour}, {axisJetFlavour}}}); + registry.add("h3_jet_pt_flavour_const_quark_flavour_dist_quark", "", {HistType::kTH3F, {{axisJetPt}, {axisJetFlavour}, {axisJetFlavour}}}); } if (doprocessValFlavourDefMCP) { - registry.add("h2_part_flavour_dist_quark_part_flavour_dist_hadron", "", {HistType::kTH2F, {{axisJetFlavour}, {axisJetFlavour}}}); - registry.add("h2_part_flavour_const_quark_part_flavour_const_hadron", "", {HistType::kTH2F, {{axisJetFlavour}, {axisJetFlavour}}}); - registry.add("h2_part_flavour_const_hadron_part_flavour_dist_hadron", "", {HistType::kTH2F, {{axisJetFlavour}, {axisJetFlavour}}}); - registry.add("h2_part_flavour_const_quark_part_flavour_dist_quark", "", {HistType::kTH2F, {{axisJetFlavour}, {axisJetFlavour}}}); + registry.add("h3_part_jet_pt_flavour_dist_quark_part_flavour_dist_hadron", "", {HistType::kTH3F, {{axisJetPt}, {axisJetFlavour}, {axisJetFlavour}}}); + registry.add("h3_part_jet_pt_flavour_const_quark_part_flavour_const_hadron", "", {HistType::kTH3F, {{axisJetPt}, {axisJetFlavour}, {axisJetFlavour}}}); + registry.add("h3_part_jet_pt_flavour_const_hadron_part_flavour_dist_hadron", "", {HistType::kTH3F, {{axisJetPt}, {axisJetFlavour}, {axisJetFlavour}}}); + registry.add("h3_part_jet_pt_flavour_const_quark_part_flavour_dist_quark", "", {HistType::kTH3F, {{axisJetPt}, {axisJetFlavour}, {axisJetFlavour}}}); } if (doprocessIPsData) { registry.add("h_jet_pt", "", {HistType::kTH1F, {{axisJetPt}}}); @@ -380,6 +376,17 @@ struct JetTaggerHFQA { registry.add("h2_taggedjet_pt_3prong_mass_N1", "", {HistType::kTH2F, {{axisJetPt}, {axisMass}}}); registry.add("h2_taggedjet_pt_3prong_mass_xyz_N1", "", {HistType::kTH2F, {{axisJetPt}, {axisMass}}}); } + if (doprocessSV3ProngDataMult) { + registry.add("h2_jet_pt_mult", "", {HistType::kTH2F, {{axisJetPt}, {axisMult}}}); + registry.add("h2_jet_eta_mult", "", {HistType::kTH2F, {{axisEta}, {axisMult}}}); + registry.add("h2_jet_phi_mult", "", {HistType::kTH2F, {{axisPhi}, {axisMult}}}); + if (fillGeneralSVQA) { + registry.add("h2_3prong_nprongs_mult", "", {HistType::kTH2F, {{axisNprongs}, {axisMult}}}); + registry.add("hn_jet_3prong_mult", "", {HistType::kTHnF, {{axisJetPt}, {axisLxy}, {axisSigmaLxy}, {axisSxy}, {axisLxyz}, {axisSigmaLxyz}, {axisSxyz}, {axisMult}}}); + } + registry.add("hn_jet_pt_3prong_Sxy_N1_mult", "", {HistType::kTHnF, {{axisJetPt}, {axisSxy}, {axisMass}, {axisMult}}}); + registry.add("hn_jet_pt_3prong_Sxyz_N1_mult", "", {HistType::kTHnF, {{axisJetPt}, {axisSxyz}, {axisMass}, {axisMult}}}); + } if (doprocessSV2ProngMCD || doprocessSV2ProngMCDWeighted || doprocessSV2ProngMCPMCDMatched || doprocessSV2ProngMCPMCDMatchedWeighted) { if (!(doprocessIPsMCD || doprocessIPsMCDWeighted || doprocessIPsMCPMCDMatched || doprocessIPsMCPMCDMatchedWeighted) && !(doprocessJPMCD || doprocessJPMCDWeighted || doprocessJPMCPMCDMatched || doprocessJPMCPMCDMatchedWeighted) && !(doprocessSV3ProngMCD || doprocessSV3ProngMCDWeighted || doprocessSV3ProngMCPMCDMatched || doprocessSV3ProngMCPMCDMatchedWeighted)) { registry.add("h2_jet_pt_flavour", "", {HistType::kTH2F, {{axisJetPt}, {axisJetFlavour}}}); @@ -428,9 +435,22 @@ struct JetTaggerHFQA { registry.add("h3_taggedjet_pt_3prong_mass_N1_flavour", "", {HistType::kTH3F, {{axisJetPt}, {axisMass}, {axisJetFlavour}}}); registry.add("h3_taggedjet_pt_3prong_mass_xyz_N1_flavour", "", {HistType::kTH3F, {{axisJetPt}, {axisMass}, {axisJetFlavour}}}); } + if (doprocessSV3ProngMCDMult) { + registry.add("h2_jet_pt_mult_flavour", "", {HistType::kTH3F, {{axisJetPt}, {axisJetFlavour}, {axisMult}}}); + registry.add("h2_jet_eta_mult_flavour", "", {HistType::kTH3F, {{axisEta}, {axisJetFlavour}, {axisMult}}}); + registry.add("h2_jet_phi_mult_flavour", "", {HistType::kTH3F, {{axisPhi}, {axisJetFlavour}, {axisMult}}}); + if (fillGeneralSVQA) { + registry.add("h3_3prong_nprongs_mult_flavour", "", {HistType::kTH3F, {{axisNprongs}, {axisMult}, {axisJetFlavour}}}); + registry.add("hn_jet_3prong_mult_flavour", "", {HistType::kTHnF, {{axisJetPt}, {axisLxy}, {axisSigmaLxy}, {axisSxy}, {axisLxyz}, {axisSigmaLxyz}, {axisSxyz}, {axisMult}, {axisJetFlavour}}}); + } + registry.add("hn_jet_3prong_Sxy_N1_mult_flavour", "", {HistType::kTHnF, {{axisJetPt}, {axisSxy}, {axisMass}, {axisMult}, {axisJetFlavour}}}); + registry.add("hn_jet_3prong_Sxyz_N1_mult_flavour", "", {HistType::kTHnF, {{axisJetPt}, {axisSxyz}, {axisMass}, {axisMult}, {axisJetFlavour}}}); + registry.add("hn_taggedjet_3prong_Sxy_N1_mult_flavour", "", {HistType::kTHnF, {{axisJetPt}, {axisSxy}, {axisSxyz}, {axisMass}, {axisMult}, {axisJetFlavour}}}); + registry.add("hn_taggedjet_3prong_Sxyz_N1_mult_flavour", "", {HistType::kTHnF, {{axisJetPt}, {axisSxy}, {axisSxyz}, {axisMass}, {axisMult}, {axisJetFlavour}}}); + } } - // Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax); + // Filter trackCuts = (aod::jtrack::pt >= trackCuts->at(0) && aod::jtrack::pt < trackCuts->at(1) && aod::jtrack::eta > trackCuts->at(2) && aod::jtrack::eta < trackCuts->at(3)); Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut); PresliceUnsorted> collisionsPerMCPCollision = aod::jmccollisionlb::mcCollisionId; Preslice particlesPerCollision = aod::jmcparticle::mcCollisionId; @@ -484,7 +504,7 @@ struct JetTaggerHFQA { template bool trackAcceptance(T const& track) { - if (track.pt() < trackPtMin || track.pt() > trackPtMax) + if (track.pt() < trackCuts->at(0) || track.pt() > trackCuts->at(1)) return false; return true; @@ -508,10 +528,10 @@ struct JetTaggerHFQA { } if (jetflavourDistQuark < 0 || jetflavourDistHadron < 0) return; - registry.fill(HIST("h2_flavour_dist_quark_flavour_dist_hadron"), jetflavourDistQuark, jetflavourDistHadron, eventWeight); - registry.fill(HIST("h2_flavour_const_quark_flavour_const_hadron"), jetflavourConstQuark, jetflavourConstHadron, eventWeight); - registry.fill(HIST("h2_flavour_const_hadron_flavour_dist_hadron"), jetflavourConstHadron, jetflavourDistHadron, eventWeight); - registry.fill(HIST("h2_flavour_const_quark_flavour_dist_quark"), jetflavourConstQuark, jetflavourDistQuark, eventWeight); + registry.fill(HIST("h3_jet_pt_flavour_dist_quark_flavour_dist_hadron"), mcdjet.pt(), jetflavourDistQuark, jetflavourDistHadron, eventWeight); + registry.fill(HIST("h3_jet_pt_flavour_const_quark_flavour_const_hadron"), mcdjet.pt(), jetflavourConstQuark, jetflavourConstHadron, eventWeight); + registry.fill(HIST("h3_jet_pt_flavour_const_hadron_flavour_dist_hadron"), mcdjet.pt(), jetflavourConstHadron, jetflavourDistHadron, eventWeight); + registry.fill(HIST("h3_jet_pt_flavour_const_quark_flavour_dist_quark"), mcdjet.pt(), jetflavourConstQuark, jetflavourDistQuark, eventWeight); } template @@ -525,10 +545,10 @@ struct JetTaggerHFQA { int jetflavourConstHadron = jettaggingutilities::mcpJetFromHFShower(mcpjet, particles, maxDeltaR, false); int jetflavourDistQuark = jettaggingutilities::getJetFlavor(mcpjet, particlesPerColl); int jetflavourDistHadron = jettaggingutilities::getJetFlavorHadron(mcpjet, particlesPerColl); - registry.fill(HIST("h2_part_flavour_dist_quark_part_flavour_dist_hadron"), jetflavourDistQuark, jetflavourDistHadron, eventWeight); - registry.fill(HIST("h2_part_flavour_const_quark_part_flavour_const_hadron"), jetflavourConstQuark, jetflavourConstHadron, eventWeight); - registry.fill(HIST("h2_part_flavour_const_hadron_part_flavour_dist_hadron"), jetflavourConstHadron, jetflavourDistHadron, eventWeight); - registry.fill(HIST("h2_part_flavour_const_quark_part_flavour_dist_quark"), jetflavourConstQuark, jetflavourDistQuark, eventWeight); + registry.fill(HIST("h3_part_jet_pt_flavour_dist_quark_part_flavour_dist_hadron"), mcpjet.pt(), jetflavourDistQuark, jetflavourDistHadron, eventWeight); + registry.fill(HIST("h3_part_jet_pt_flavour_const_quark_part_flavour_const_hadron"), mcpjet.pt(), jetflavourConstQuark, jetflavourConstHadron, eventWeight); + registry.fill(HIST("h3_part_jet_pt_flavour_const_hadron_part_flavour_dist_hadron"), mcpjet.pt(), jetflavourConstHadron, jetflavourDistHadron, eventWeight); + registry.fill(HIST("h3_part_jet_pt_flavour_const_quark_part_flavour_dist_quark"), mcpjet.pt(), jetflavourConstQuark, jetflavourDistQuark, eventWeight); } template @@ -891,15 +911,17 @@ struct JetTaggerHFQA { registry.fill(HIST("h_2prong_nprongs"), jet.template secondaryVertices_as().size()); for (const auto& prong : jet.template secondaryVertices_as()) { registry.fill(HIST("h2_jet_pt_2prong_Lxy"), jet.pt(), prong.decayLengthXY()); - registry.fill(HIST("h2_jet_pt_2prong_Sxy"), jet.pt(), prong.decayLengthXY() / prong.errorDecayLengthXY()); - registry.fill(HIST("h2_jet_pt_2prong_Lxyz"), jet.pt(), prong.decayLength()); - registry.fill(HIST("h2_jet_pt_2prong_Sxyz"), jet.pt(), prong.decayLength() / prong.errorDecayLength()); registry.fill(HIST("h2_jet_pt_2prong_sigmaLxy"), jet.pt(), prong.errorDecayLengthXY()); - registry.fill(HIST("h2_jet_pt_2prong_sigmaLxyz"), jet.pt(), prong.errorDecayLength()); + registry.fill(HIST("h2_jet_pt_2prong_Sxy"), jet.pt(), prong.decayLengthXY() / prong.errorDecayLengthXY()); + if (fillSVxyz) { + registry.fill(HIST("h2_jet_pt_2prong_Lxyz"), jet.pt(), prong.decayLength()); + registry.fill(HIST("h2_jet_pt_2prong_sigmaLxyz"), jet.pt(), prong.errorDecayLength()); + registry.fill(HIST("h2_jet_pt_2prong_Sxyz"), jet.pt(), prong.decayLength() / prong.errorDecayLength()); + } } } bool checkSv = false; - auto bjetCand = jettaggingutilities::jetFromProngMaxDecayLength(jet, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyMax, prongIPxyMin, prongIPxyMax, false, &checkSv); + auto bjetCand = jettaggingutilities::jetFromProngMaxDecayLength(jet, prongCuts->at(0), prongCuts->at(1), prongCuts->at(2), prongCuts->at(4), prongCuts->at(5), false, &checkSv); if (checkSv && jettaggingutilities::svAcceptance(bjetCand, svDispersionMax)) { auto maxSxy = bjetCand.decayLengthXY() / bjetCand.errorDecayLengthXY(); auto massSV = bjetCand.m(); @@ -910,15 +932,17 @@ struct JetTaggerHFQA { registry.fill(HIST("h2_taggedjet_pt_2prong_mass_N1"), jet.pt(), massSV); } } - auto bjetCandXYZ = jettaggingutilities::jetFromProngMaxDecayLength(jet, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyzMax, prongIPxyMin, prongIPxyMax, true, &checkSv); - if (checkSv && jettaggingutilities::svAcceptance(bjetCand, svDispersionMax)) { - auto maxSxyz = bjetCandXYZ.decayLength() / bjetCandXYZ.errorDecayLength(); - auto massSV = bjetCandXYZ.m(); - registry.fill(HIST("h2_jet_pt_2prong_Sxyz_N1"), jet.pt(), maxSxyz); - registry.fill(HIST("h2_jet_pt_2prong_mass_xyz_N1"), jet.pt(), massSV); - if (jet.isTagged(BJetTaggingMethod::SV3D)) { - registry.fill(HIST("h2_taggedjet_pt_2prong_Sxyz_N1"), jet.pt(), maxSxyz); - registry.fill(HIST("h2_taggedjet_pt_2prong_mass_xyz_N1"), jet.pt(), massSV); + if (fillSVxyz) { + auto bjetCandXYZ = jettaggingutilities::jetFromProngMaxDecayLength(jet, prongCuts->at(0), prongCuts->at(1), prongCuts->at(3), prongCuts->at(4), prongCuts->at(5), true, &checkSv); + if (checkSv && jettaggingutilities::svAcceptance(bjetCandXYZ, svDispersionMax)) { + auto maxSxyz = bjetCandXYZ.decayLength() / bjetCandXYZ.errorDecayLength(); + auto massSV = bjetCandXYZ.m(); + registry.fill(HIST("h2_jet_pt_2prong_Sxyz_N1"), jet.pt(), maxSxyz); + registry.fill(HIST("h2_jet_pt_2prong_mass_xyz_N1"), jet.pt(), massSV); + if (jet.isTagged(BJetTaggingMethod::SV3D)) { + registry.fill(HIST("h2_taggedjet_pt_2prong_Sxyz_N1"), jet.pt(), maxSxyz); + registry.fill(HIST("h2_taggedjet_pt_2prong_mass_xyz_N1"), jet.pt(), massSV); + } } } } @@ -942,15 +966,17 @@ struct JetTaggerHFQA { registry.fill(HIST("h_3prong_nprongs"), jet.template secondaryVertices_as().size()); for (const auto& prong : jet.template secondaryVertices_as()) { registry.fill(HIST("h2_jet_pt_3prong_Lxy"), jet.pt(), prong.decayLengthXY()); - registry.fill(HIST("h2_jet_pt_3prong_Sxy"), jet.pt(), prong.decayLengthXY() / prong.errorDecayLengthXY()); - registry.fill(HIST("h2_jet_pt_3prong_Lxyz"), jet.pt(), prong.decayLength()); - registry.fill(HIST("h2_jet_pt_3prong_Sxyz"), jet.pt(), prong.decayLength() / prong.errorDecayLength()); registry.fill(HIST("h2_jet_pt_3prong_sigmaLxy"), jet.pt(), prong.errorDecayLengthXY()); - registry.fill(HIST("h2_jet_pt_3prong_sigmaLxyz"), jet.pt(), prong.errorDecayLength()); + registry.fill(HIST("h2_jet_pt_3prong_Sxy"), jet.pt(), prong.decayLengthXY() / prong.errorDecayLengthXY()); + if (fillSVxyz) { + registry.fill(HIST("h2_jet_pt_3prong_Lxyz"), jet.pt(), prong.decayLength()); + registry.fill(HIST("h2_jet_pt_3prong_sigmaLxyz"), jet.pt(), prong.errorDecayLength()); + registry.fill(HIST("h2_jet_pt_3prong_Sxyz"), jet.pt(), prong.decayLength() / prong.errorDecayLength()); + } } } bool checkSv = false; - auto bjetCand = jettaggingutilities::jetFromProngMaxDecayLength(jet, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyMax, prongIPxyMin, prongIPxyMax, false, &checkSv); + auto bjetCand = jettaggingutilities::jetFromProngMaxDecayLength(jet, prongCuts->at(0), prongCuts->at(1), prongCuts->at(2), prongCuts->at(4), prongCuts->at(5), false, &checkSv); if (checkSv && jettaggingutilities::svAcceptance(bjetCand, svDispersionMax)) { auto maxSxy = bjetCand.decayLengthXY() / bjetCand.errorDecayLengthXY(); auto massSV = bjetCand.m(); @@ -961,15 +987,56 @@ struct JetTaggerHFQA { registry.fill(HIST("h2_taggedjet_pt_3prong_mass_N1"), jet.pt(), massSV); } } - auto bjetCandXYZ = jettaggingutilities::jetFromProngMaxDecayLength(jet, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyzMax, prongIPxyMin, prongIPxyMax, true, &checkSv); - if (checkSv && jettaggingutilities::svAcceptance(bjetCandXYZ, svDispersionMax)) { - auto maxSxyz = bjetCandXYZ.decayLength() / bjetCandXYZ.errorDecayLength(); - auto massSV = bjetCandXYZ.m(); - registry.fill(HIST("h2_jet_pt_3prong_Sxyz_N1"), jet.pt(), maxSxyz); - registry.fill(HIST("h2_jet_pt_3prong_mass_xyz_N1"), jet.pt(), massSV); - if (jet.isTagged(BJetTaggingMethod::SV3D)) { - registry.fill(HIST("h2_taggedjet_pt_3prong_Sxyz_N1"), jet.pt(), maxSxyz); - registry.fill(HIST("h2_taggedjet_pt_3prong_mass_xyz_N1"), jet.pt(), massSV); + if (fillSVxyz) { + auto bjetCandXYZ = jettaggingutilities::jetFromProngMaxDecayLength(jet, prongCuts->at(0), prongCuts->at(1), prongCuts->at(3), prongCuts->at(4), prongCuts->at(5), true, &checkSv); + if (checkSv && jettaggingutilities::svAcceptance(bjetCandXYZ, svDispersionMax)) { + auto maxSxyz = bjetCandXYZ.decayLength() / bjetCandXYZ.errorDecayLength(); + auto massSV = bjetCandXYZ.m(); + registry.fill(HIST("h2_jet_pt_3prong_Sxyz_N1"), jet.pt(), maxSxyz); + registry.fill(HIST("h2_jet_pt_3prong_mass_xyz_N1"), jet.pt(), massSV); + if (jet.isTagged(BJetTaggingMethod::SV3D)) { + registry.fill(HIST("h2_taggedjet_pt_3prong_Sxyz_N1"), jet.pt(), maxSxyz); + registry.fill(HIST("h2_taggedjet_pt_3prong_mass_xyz_N1"), jet.pt(), massSV); + } + } + } + } + + template + void fillHistogramSV3ProngDataMult(T const& collision, U const& jet, V const& /*prongs*/) + { + if (jet.template secondaryVertices_as().size() < 1) + return; + auto mult = 0.5 * (collision.multFT0A() + collision.multFT0C()); + registry.fill(HIST("h2_jet_pt_mult"), jet.pt(), mult); + registry.fill(HIST("h2_jet_eta_mult"), jet.eta(), mult); + registry.fill(HIST("h2_jet_phi_mult"), jet.phi(), mult); + if (fillGeneralSVQA) { + registry.fill(HIST("h2_3prong_nprongs_mult"), jet.template secondaryVertices_as().size(), mult); + for (const auto& prong : jet.template secondaryVertices_as()) { + registry.fill(HIST("hn_jet_3prong_mult"), jet.pt(), prong.decayLengthXY(), prong.errorDecayLengthXY(), prong.decayLengthXY() / prong.errorDecayLengthXY(), prong.decayLength(), prong.errorDecayLength(), prong.decayLength() / prong.errorDecayLengthXY(), mult); + } + } + bool checkSv = false; + auto bjetCand = jettaggingutilities::jetFromProngMaxDecayLength(jet, prongCuts->at(0), prongCuts->at(1), prongCuts->at(2), prongCuts->at(4), prongCuts->at(5), false, &checkSv); + if (checkSv && jettaggingutilities::svAcceptance(bjetCand, svDispersionMax)) { + auto maxSxy = bjetCand.decayLengthXY() / bjetCand.errorDecayLengthXY(); + auto massSV = bjetCand.m(); + registry.fill(HIST("hn_jet_pt_3prong_Sxy_N1_mult"), jet.pt(), maxSxy, massSV, mult); + if (jet.isTagged(BJetTaggingMethod::SV)) { + registry.fill(HIST("hn_taggedjet_pt_3prong_Sxy_N1_mult"), jet.pt(), maxSxy, massSV, mult); + } + } + if (fillSVxyz) { + checkSv = false; + auto bjetCandXYZ = jettaggingutilities::jetFromProngMaxDecayLength(jet, prongCuts->at(0), prongCuts->at(1), prongCuts->at(3), prongCuts->at(4), prongCuts->at(5), true, &checkSv); + if (checkSv && jettaggingutilities::svAcceptance(bjetCandXYZ, svDispersionMax)) { + auto maxSxyz = bjetCandXYZ.decayLength() / bjetCandXYZ.errorDecayLength(); + auto massSV = bjetCandXYZ.m(); + registry.fill(HIST("h2_jet_pt_3prong_Sxy_N1_mult"), jet.pt(), maxSxyz, massSV, mult); + if (jet.isTagged(BJetTaggingMethod::SV3D)) { + registry.fill(HIST("h2_taggedjet_pt_3prong_Sxyz_N1_mult"), jet.pt(), maxSxyz, massSV, mult); + } } } } @@ -993,15 +1060,17 @@ struct JetTaggerHFQA { registry.fill(HIST("h2_2prong_nprongs_flavour"), mcdjet.template secondaryVertices_as().size(), origin, eventWeight); for (const auto& prong : mcdjet.template secondaryVertices_as()) { registry.fill(HIST("h3_jet_pt_2prong_Lxy_flavour"), mcdjet.pt(), prong.decayLengthXY(), origin, eventWeight); - registry.fill(HIST("h3_jet_pt_2prong_Sxy_flavour"), mcdjet.pt(), prong.decayLengthXY() / prong.errorDecayLengthXY(), origin, eventWeight); - registry.fill(HIST("h3_jet_pt_2prong_Lxyz_flavour"), mcdjet.pt(), prong.decayLength(), origin, eventWeight); - registry.fill(HIST("h3_jet_pt_2prong_Sxyz_flavour"), mcdjet.pt(), prong.decayLength() / prong.errorDecayLength(), origin, eventWeight); registry.fill(HIST("h3_jet_pt_2prong_sigmaLxy_flavour"), mcdjet.pt(), prong.errorDecayLengthXY(), origin, eventWeight); - registry.fill(HIST("h3_jet_pt_2prong_sigmaLxyz_flavour"), mcdjet.pt(), prong.errorDecayLength(), origin, eventWeight); + registry.fill(HIST("h3_jet_pt_2prong_Sxy_flavour"), mcdjet.pt(), prong.decayLengthXY() / prong.errorDecayLengthXY(), origin, eventWeight); + if (fillSVxyz) { + registry.fill(HIST("h3_jet_pt_2prong_Lxyz_flavour"), mcdjet.pt(), prong.decayLength(), origin, eventWeight); + registry.fill(HIST("h3_jet_pt_2prong_sigmaLxyz_flavour"), mcdjet.pt(), prong.errorDecayLength(), origin, eventWeight); + registry.fill(HIST("h3_jet_pt_2prong_Sxyz_flavour"), mcdjet.pt(), prong.decayLength() / prong.errorDecayLength(), origin, eventWeight); + } } } bool checkSv = false; - auto bjetCand = jettaggingutilities::jetFromProngMaxDecayLength(mcdjet, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyMax, prongIPxyMin, prongIPxyMax, false, &checkSv); + auto bjetCand = jettaggingutilities::jetFromProngMaxDecayLength(mcdjet, prongCuts->at(0), prongCuts->at(1), prongCuts->at(2), prongCuts->at(4), prongCuts->at(5), false, &checkSv); if (checkSv && jettaggingutilities::svAcceptance(bjetCand, svDispersionMax)) { auto maxSxy = bjetCand.decayLengthXY() / bjetCand.errorDecayLengthXY(); auto massSV = bjetCand.m(); @@ -1012,15 +1081,18 @@ struct JetTaggerHFQA { registry.fill(HIST("h3_taggedjet_pt_2prong_mass_N1_flavour"), mcdjet.pt(), massSV, origin, eventWeight); } } - auto bjetCandXYZ = jettaggingutilities::jetFromProngMaxDecayLength(mcdjet, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyzMax, prongIPxyMin, prongIPxyMax, true, &checkSv); - if (checkSv && jettaggingutilities::svAcceptance(bjetCandXYZ, svDispersionMax)) { - auto maxSxyz = bjetCandXYZ.decayLength() / bjetCandXYZ.errorDecayLength(); - auto massSV = bjetCandXYZ.m(); - registry.fill(HIST("h3_jet_pt_2prong_Sxyz_N1_flavour"), mcdjet.pt(), maxSxyz, origin, eventWeight); - registry.fill(HIST("h3_jet_pt_2prong_mass_xyz_N1_flavour"), mcdjet.pt(), massSV, origin, eventWeight); - if (mcdjet.isTagged(BJetTaggingMethod::SV3D)) { - registry.fill(HIST("h3_taggedjet_pt_2prong_Sxyz_N1_flavour"), mcdjet.pt(), maxSxyz, origin, eventWeight); - registry.fill(HIST("h3_taggedjet_pt_2prong_mass_xyz_N1_flavour"), mcdjet.pt(), massSV, origin, eventWeight); + if (fillSVxyz) { + checkSv = false; + auto bjetCandXYZ = jettaggingutilities::jetFromProngMaxDecayLength(mcdjet, prongCuts->at(0), prongCuts->at(1), prongCuts->at(3), prongCuts->at(4), prongCuts->at(5), true, &checkSv); + if (checkSv && jettaggingutilities::svAcceptance(bjetCandXYZ, svDispersionMax)) { + auto maxSxyz = bjetCandXYZ.decayLength() / bjetCandXYZ.errorDecayLength(); + auto massSV = bjetCandXYZ.m(); + registry.fill(HIST("h3_jet_pt_2prong_Sxyz_N1_flavour"), mcdjet.pt(), maxSxyz, origin, eventWeight); + registry.fill(HIST("h3_jet_pt_2prong_mass_xyz_N1_flavour"), mcdjet.pt(), massSV, origin, eventWeight); + if (mcdjet.isTagged(BJetTaggingMethod::SV3D)) { + registry.fill(HIST("h3_taggedjet_pt_2prong_Sxyz_N1_flavour"), mcdjet.pt(), maxSxyz, origin, eventWeight); + registry.fill(HIST("h3_taggedjet_pt_2prong_mass_xyz_N1_flavour"), mcdjet.pt(), massSV, origin, eventWeight); + } } } } @@ -1044,15 +1116,17 @@ struct JetTaggerHFQA { registry.fill(HIST("h2_3prong_nprongs_flavour"), mcdjet.template secondaryVertices_as().size(), origin); for (const auto& prong : mcdjet.template secondaryVertices_as()) { registry.fill(HIST("h3_jet_pt_3prong_Lxy_flavour"), mcdjet.pt(), prong.decayLengthXY(), origin, eventWeight); - registry.fill(HIST("h3_jet_pt_3prong_Sxy_flavour"), mcdjet.pt(), prong.decayLengthXY() / prong.errorDecayLengthXY(), origin, eventWeight); - registry.fill(HIST("h3_jet_pt_3prong_Lxyz_flavour"), mcdjet.pt(), prong.decayLength(), origin, eventWeight); - registry.fill(HIST("h3_jet_pt_3prong_Sxyz_flavour"), mcdjet.pt(), prong.decayLength() / prong.errorDecayLength(), origin, eventWeight); registry.fill(HIST("h3_jet_pt_3prong_sigmaLxy_flavour"), mcdjet.pt(), prong.errorDecayLengthXY(), origin, eventWeight); - registry.fill(HIST("h3_jet_pt_3prong_sigmaLxyz_flavour"), mcdjet.pt(), prong.errorDecayLength(), origin, eventWeight); + registry.fill(HIST("h3_jet_pt_3prong_Sxy_flavour"), mcdjet.pt(), prong.decayLengthXY() / prong.errorDecayLengthXY(), origin, eventWeight); + if (fillSVxyz) { + registry.fill(HIST("h3_jet_pt_3prong_Lxyz_flavour"), mcdjet.pt(), prong.decayLength(), origin, eventWeight); + registry.fill(HIST("h3_jet_pt_3prong_Sxyz_flavour"), mcdjet.pt(), prong.decayLength() / prong.errorDecayLength(), origin, eventWeight); + registry.fill(HIST("h3_jet_pt_3prong_sigmaLxyz_flavour"), mcdjet.pt(), prong.errorDecayLength(), origin, eventWeight); + } } } bool checkSv = false; - auto bjetCand = jettaggingutilities::jetFromProngMaxDecayLength(mcdjet, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyMax, prongIPxyMin, prongIPxyMax, false, &checkSv); + auto bjetCand = jettaggingutilities::jetFromProngMaxDecayLength(mcdjet, prongCuts->at(0), prongCuts->at(1), prongCuts->at(2), prongCuts->at(4), prongCuts->at(5), false, &checkSv); if (checkSv && jettaggingutilities::svAcceptance(bjetCand, svDispersionMax)) { auto maxSxy = bjetCand.decayLengthXY() / bjetCand.errorDecayLengthXY(); auto massSV = bjetCand.m(); @@ -1063,15 +1137,61 @@ struct JetTaggerHFQA { registry.fill(HIST("h3_taggedjet_pt_3prong_mass_N1_flavour"), mcdjet.pt(), massSV, origin, eventWeight); } } - auto bjetCandXYZ = jettaggingutilities::jetFromProngMaxDecayLength(mcdjet, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyzMax, prongIPxyMin, prongIPxyMax, true, &checkSv); + if (fillSVxyz) { + checkSv = false; + auto bjetCandXYZ = jettaggingutilities::jetFromProngMaxDecayLength(mcdjet, prongCuts->at(0), prongCuts->at(1), prongCuts->at(3), prongCuts->at(4), prongCuts->at(5), true, &checkSv); + if (checkSv && jettaggingutilities::svAcceptance(bjetCandXYZ, svDispersionMax)) { + auto maxSxyz = bjetCandXYZ.decayLength() / bjetCandXYZ.errorDecayLength(); + auto massSV = bjetCandXYZ.m(); + registry.fill(HIST("h3_jet_pt_3prong_Sxyz_N1_flavour"), mcdjet.pt(), maxSxyz, origin, eventWeight); + registry.fill(HIST("h3_jet_pt_3prong_mass_xyz_N1_flavour"), mcdjet.pt(), massSV, origin, eventWeight); + if (mcdjet.isTagged(BJetTaggingMethod::SV3D)) { + registry.fill(HIST("h3_taggedjet_pt_3prong_Sxyz_N1_flavour"), mcdjet.pt(), maxSxyz, origin, eventWeight); + registry.fill(HIST("h3_taggedjet_pt_3prong_mass_xyz_N1_flavour"), mcdjet.pt(), massSV, origin, eventWeight); + } + } + } + } + + template + void fillHistogramSV3ProngMCDMult(T const& collision, U const& mcdjet, V const& /*prongs*/, float eventWeight = 1.0) + { + float pTHat = 10. / (std::pow(eventWeight, 1.0 / pTHatExponent)); + if (mcdjet.pt() > pTHatMaxMCD * pTHat) { + return; + } + auto origin = mcdjet.origin(); + auto mult = 0.5 * (collision.multFT0A() + collision.multFT0C()); + if (mcdjet.template secondaryVertices_as().size() < 1) + return; + registry.fill(HIST("h3_jet_pt_mult_flavour"), mcdjet.pt(), mult, origin, eventWeight); + registry.fill(HIST("h3_jet_eta_mult_flavour"), mcdjet.eta(), mult, origin, eventWeight); + registry.fill(HIST("h3_jet_phi_mult_flavour"), mcdjet.phi(), mult, origin, eventWeight); + if (fillGeneralSVQA) { + registry.fill(HIST("h3_3prong_nprongs_mult_flavour"), mcdjet.template secondaryVertices_as().size(), mult, origin); + for (const auto& prong : mcdjet.template secondaryVertices_as()) { + registry.fill(HIST("hn_jet_3prong_mult_flavour"), mcdjet.pt(), prong.decayLengthXY(), prong.errorDecayLengthXY(), prong.decayLengthXY() / prong.errorDecayLengthXY(), prong.decayLength(), prong.errorDecayLengthXY(), prong.decayLength() / prong.errorDecayLengthXY(), origin, eventWeight); + } + } + bool checkSv = false; + auto bjetCand = jettaggingutilities::jetFromProngMaxDecayLength(mcdjet, prongCuts->at(0), prongCuts->at(1), prongCuts->at(2), prongCuts->at(4), prongCuts->at(5), false, &checkSv); if (checkSv && jettaggingutilities::svAcceptance(bjetCand, svDispersionMax)) { - auto maxSxyz = bjetCandXYZ.decayLength() / bjetCandXYZ.errorDecayLength(); - auto massSV = bjetCandXYZ.m(); - registry.fill(HIST("h3_jet_pt_3prong_Sxyz_N1_flavour"), mcdjet.pt(), maxSxyz, origin, eventWeight); - registry.fill(HIST("h3_jet_pt_3prong_mass_xyz_N1_flavour"), mcdjet.pt(), massSV, origin, eventWeight); - if (mcdjet.isTagged(BJetTaggingMethod::SV3D)) { - registry.fill(HIST("h3_taggedjet_pt_3prong_Sxyz_N1_flavour"), mcdjet.pt(), maxSxyz, origin, eventWeight); - registry.fill(HIST("h3_taggedjet_pt_3prong_mass_xyz_N1_flavour"), mcdjet.pt(), massSV, origin, eventWeight); + auto maxSxy = bjetCand.decayLengthXY() / bjetCand.errorDecayLengthXY(); + auto massSV = bjetCand.m(); + registry.fill(HIST("hn_jet_3prong_Sxy_N1_mult_flavour"), mcdjet.pt(), maxSxy, massSV, mult, origin, eventWeight); + if (mcdjet.isTagged(BJetTaggingMethod::SV)) { + registry.fill(HIST("hn_taggedjet_pt_3prong_Sxy_N1_mult_flavour"), mcdjet.pt(), maxSxy, massSV, mult, origin, eventWeight); + } + } + if (fillSVxyz) { + auto bjetCandXYZ = jettaggingutilities::jetFromProngMaxDecayLength(mcdjet, prongCuts->at(0), prongCuts->at(1), prongCuts->at(3), prongCuts->at(4), prongCuts->at(5), true, &checkSv); + if (checkSv && jettaggingutilities::svAcceptance(bjetCandXYZ, svDispersionMax)) { + auto maxSxyz = bjetCandXYZ.decayLength() / bjetCandXYZ.errorDecayLength(); + auto massSV = bjetCandXYZ.m(); + registry.fill(HIST("hn_jet_3prong_Sxyz_N1_mult_flavour"), mcdjet.pt(), maxSxyz, massSV, mult, origin, eventWeight); + if (mcdjet.isTagged(BJetTaggingMethod::SV3D)) { + registry.fill(HIST("hn_taggedjet_pt_3prong_Sxyz_N1_mult_flavour"), mcdjet.pt(), maxSxyz, massSV, mult, origin, eventWeight); + } } } } @@ -1119,7 +1239,7 @@ struct JetTaggerHFQA { return; } for (auto const& jet : jets) { - if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; } if (!isAcceptedJet(jet)) { @@ -1139,7 +1259,7 @@ struct JetTaggerHFQA { return; } for (auto const& mcdjet : mcdjets) { - if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; } if (!isAcceptedJet(mcdjet)) { @@ -1180,7 +1300,7 @@ struct JetTaggerHFQA { } for (auto const& mcdjet : mcdjets) { auto const particlesPerColl = particles.sliceBy(particlesPerCollision, collision.mcCollisionId()); - if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; } if (!isAcceptedJet(mcdjet)) { @@ -1195,7 +1315,7 @@ struct JetTaggerHFQA { { for (auto const& mcpjet : mcpjets) { auto const particlesPerColl = particles.sliceBy(particlesPerCollision, mcpjet.globalIndex()); - if (!jetfindingutilities::isInEtaAcceptance(mcpjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(mcpjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; } if (!isAcceptedJet(mcpjet)) { @@ -1217,7 +1337,7 @@ struct JetTaggerHFQA { return; } for (auto const& jet : jets) { - if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; } if (!isAcceptedJet(jet)) { @@ -1234,7 +1354,7 @@ struct JetTaggerHFQA { return; } for (auto const& mcdjet : mcdjets) { - if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; } if (!isAcceptedJet(mcdjet)) { @@ -1251,7 +1371,7 @@ struct JetTaggerHFQA { return; } for (auto const& mcdjet : mcdjets) { - if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; } fillHistogramIPsMCD(mcdjet, tracks, mcdjet.eventWeight()); @@ -1262,7 +1382,7 @@ struct JetTaggerHFQA { void processIPsMCP(JetTableMCP const& mcpjets, aod::JetParticles const&, aod::JetMcCollisions const&, soa::Filtered const& collisions) { for (auto const& mcpjet : mcpjets) { - if (!jetfindingutilities::isInEtaAcceptance(mcpjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(mcpjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; } if (!isAcceptedJet(mcpjet)) { @@ -1283,7 +1403,7 @@ struct JetTaggerHFQA { void processIPsMCPWeighted(soa::Join const& mcpjets, soa::Filtered const& collisions, aod::JetParticles const&) { for (auto const& mcpjet : mcpjets) { - if (!jetfindingutilities::isInEtaAcceptance(mcpjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(mcpjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; } if (!isAcceptedJet(mcpjet)) { @@ -1308,7 +1428,7 @@ struct JetTaggerHFQA { } for (auto const& mcdjet : mcdjets) { auto const particlesPerColl = particles.sliceBy(particlesPerCollision, collision.mcCollisionId()); - if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; } if (!isAcceptedJet(mcdjet)) { @@ -1332,7 +1452,7 @@ struct JetTaggerHFQA { } for (auto const& mcdjet : mcdjets) { auto const particlesPerColl = particles.sliceBy(particlesPerCollision, collision.mcCollisionId()); - if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; } if (!isAcceptedJet(mcdjet)) { @@ -1362,7 +1482,7 @@ struct JetTaggerHFQA { return; } for (auto const& jet : jets) { - if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; } if (!isAcceptedJet(jet)) { @@ -1379,7 +1499,7 @@ struct JetTaggerHFQA { return; } for (auto const& mcdjet : mcdjets) { - if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; } if (!isAcceptedJet(mcdjet)) { @@ -1396,7 +1516,7 @@ struct JetTaggerHFQA { return; } for (auto const& mcdjet : mcdjets) { - if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; } if (!isAcceptedJet(mcdjet)) { @@ -1413,7 +1533,7 @@ struct JetTaggerHFQA { return; } for (auto const& mcdjet : mcdjets) { - if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; } if (!isAcceptedJet(mcdjet)) { @@ -1433,7 +1553,7 @@ struct JetTaggerHFQA { return; } for (auto const& mcdjet : mcdjets) { - if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; } if (!isAcceptedJet(mcdjet)) { @@ -1453,7 +1573,7 @@ struct JetTaggerHFQA { return; } for (auto const& jet : jets) { - if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; } if (!isAcceptedJet(jet)) { @@ -1470,7 +1590,7 @@ struct JetTaggerHFQA { return; } for (auto const& jet : jets) { - if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; } if (!isAcceptedJet(jet)) { @@ -1479,7 +1599,24 @@ struct JetTaggerHFQA { fillHistogramSV3ProngData(jet, prongs); } } - PROCESS_SWITCH(JetTaggerHFQA, processSV3ProngData, "Fill 2prong imformation for data jets", false); + PROCESS_SWITCH(JetTaggerHFQA, processSV3ProngData, "Fill 3prong imformation for data jets", false); + + void processSV3ProngDataMult(soa::Filtered::iterator const& collision, soa::Join const& jets, aod::DataSecondaryVertex3Prongs const& prongs) + { + if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + return; + } + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { + continue; + } + if (!isAcceptedJet(jet)) { + continue; + } + fillHistogramSV3ProngDataMult(collision, jet, prongs); + } + } + PROCESS_SWITCH(JetTaggerHFQA, processSV3ProngDataMult, "Fill 3prong imformation for data jets", false); void processSV2ProngMCD(soa::Filtered::iterator const& collision, soa::Join const& mcdjets, aod::MCDSecondaryVertex2Prongs const& prongs) { @@ -1487,7 +1624,7 @@ struct JetTaggerHFQA { return; } for (auto const& mcdjet : mcdjets) { - if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; } if (!isAcceptedJet(mcdjet)) { @@ -1504,7 +1641,7 @@ struct JetTaggerHFQA { return; } for (auto const& mcdjet : mcdjets) { - if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; } if (!isAcceptedJet(mcdjet)) { @@ -1521,7 +1658,7 @@ struct JetTaggerHFQA { return; } for (auto const& mcdjet : mcdjets) { - if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; } if (!isAcceptedJet(mcdjet)) { @@ -1542,7 +1679,7 @@ struct JetTaggerHFQA { return; } for (auto const& mcdjet : mcdjets) { - if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; } if (!isAcceptedJet(mcdjet)) { @@ -1563,7 +1700,7 @@ struct JetTaggerHFQA { return; } for (auto const& mcdjet : mcdjets) { - if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; } if (!isAcceptedJet(mcdjet)) { @@ -1580,7 +1717,7 @@ struct JetTaggerHFQA { return; } for (auto const& mcdjet : mcdjets) { - if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; } if (!isAcceptedJet(mcdjet)) { @@ -1597,7 +1734,7 @@ struct JetTaggerHFQA { return; } for (auto const& mcdjet : mcdjets) { - if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; } if (!isAcceptedJet(mcdjet)) { @@ -1618,7 +1755,7 @@ struct JetTaggerHFQA { return; } for (auto const& mcdjet : mcdjets) { - if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; } if (!isAcceptedJet(mcdjet)) { @@ -1632,6 +1769,82 @@ struct JetTaggerHFQA { } } PROCESS_SWITCH(JetTaggerHFQA, processSV3ProngMCPMCDMatchedWeighted, "Fill 3prong imformation for mcd jets", false); + + void processSV3ProngMCDMult(soa::Filtered::iterator const& collision, soa::Join const& mcdjets, aod::MCDSecondaryVertex3Prongs const& prongs) + { + if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + return; + } + for (auto const& mcdjet : mcdjets) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { + continue; + } + if (!isAcceptedJet(mcdjet)) { + continue; + } + fillHistogramSV3ProngMCDMult(collision, mcdjet, prongs); + } + } + PROCESS_SWITCH(JetTaggerHFQA, processSV3ProngMCDMult, "Fill 3prong imformation for mcd jets with multiplicity", false); + + void processSV3ProngMCDMultWeighted(soa::Filtered::iterator const& collision, soa::Join const& mcdjets, aod::MCDSecondaryVertex3Prongs const& prongs) + { + if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + return; + } + for (auto const& mcdjet : mcdjets) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { + continue; + } + if (!isAcceptedJet(mcdjet)) { + continue; + } + fillHistogramSV3ProngMCDMult(collision, mcdjet, prongs, mcdjet.eventWeight()); + } + } + PROCESS_SWITCH(JetTaggerHFQA, processSV3ProngMCDMultWeighted, "Fill 3prong imformation for mcd jets with multiplicity weighted", false); + + void processSV3ProngMCPMCDMatchedMult(soa::Filtered>::iterator const& collision, soa::Join const& mcdjets, soa::Join const& /*mcpjets*/, aod::MCDSecondaryVertex3Prongs const& prongs) + { + if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + return; + } + for (auto const& mcdjet : mcdjets) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { + continue; + } + if (!isAcceptedJet(mcdjet)) { + continue; + } + if (!mcdjet.has_matchedJetGeo()) { + continue; + } + if (!doprocessSV3ProngMCDMult) + fillHistogramSV3ProngMCDMult(collision, mcdjet, prongs); + } + } + PROCESS_SWITCH(JetTaggerHFQA, processSV3ProngMCPMCDMatchedMult, "Fill 3prong imformation for mcd jets matched with multiplicity", false); + + void processSV3ProngMCPMCDMatchedMultWeighted(soa::Filtered>::iterator const& collision, soa::Join const& mcdjets, soa::Join const& /*mcpjets*/, aod::MCDSecondaryVertex3Prongs const& prongs) + { + if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + return; + } + for (auto const& mcdjet : mcdjets) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { + continue; + } + if (!isAcceptedJet(mcdjet)) { + continue; + } + if (!mcdjet.has_matchedJetGeo()) { + continue; + } + if (!doprocessSV3ProngMCDMultWeighted) + fillHistogramSV3ProngMCDMult(collision, mcdjet, prongs, mcdjet.eventWeight()); + } + } + PROCESS_SWITCH(JetTaggerHFQA, processSV3ProngMCPMCDMatchedMultWeighted, "Fill 3prong imformation for mcd jets matched with multiplicity weightd", false); }; using JetTaggerQAChargedDataJets = soa::Join; From c68fb70a6353187893cb76b6389a68fc239d7c40 Mon Sep 17 00:00:00 2001 From: Artem Kotliarov <71133985+KotliarovAr@users.noreply.github.com> Date: Tue, 23 Sep 2025 16:43:18 +0200 Subject: [PATCH 505/986] [PWGJE] Add multiplicity selection for MC particle level (#13085) --- PWGJE/Tasks/recoilJets.cxx | 580 ++++++++++++++++++++++++------------- 1 file changed, 381 insertions(+), 199 deletions(-) diff --git a/PWGJE/Tasks/recoilJets.cxx b/PWGJE/Tasks/recoilJets.cxx index 8272b6ed539..5926c3dafba 100644 --- a/PWGJE/Tasks/recoilJets.cxx +++ b/PWGJE/Tasks/recoilJets.cxx @@ -49,28 +49,19 @@ using namespace o2::framework; using namespace o2::framework::expressions; // Shorthand notations -using FilteredColl = - soa::Filtered>::iterator; -using FilteredCollPartLevel = - soa::Filtered>::iterator; -using FilteredCollDetLevelGetWeight = - soa::Filtered>::iterator; -using FilteredEventMultiplicity = - soa::Filtered>::iterator; - -using FilteredJets = - soa::Filtered>; -using FilteredJetsDetLevel = - soa::Filtered>; -using FilteredJetsPartLevel = - soa::Filtered>; - -using FilteredMatchedJetsDetLevel = soa::Filtered>; -using FilteredMatchedJetsPartLevel = soa::Filtered>; +using FilteredColl = soa::Filtered>::iterator; +using FilteredCollPartLevel = soa::Filtered>::iterator; +using FilteredCollDetLevelGetWeight = soa::Filtered>::iterator; +using FilteredEventMultiplicity = soa::Filtered>::iterator; +using FilteredEventMultiplicityDetLevelGetWeight = soa::Filtered>::iterator; +using FilteredEventMultiplicityPartLevel = soa::Filtered>::iterator; + +using FilteredJets = soa::Filtered>; +using FilteredJetsDetLevel = soa::Filtered>; +using FilteredJetsPartLevel = soa::Filtered>; + +using FilteredMatchedJetsDetLevel = soa::Filtered>; +using FilteredMatchedJetsPartLevel = soa::Filtered>; using FilteredTracks = soa::Filtered; using FilteredParticles = soa::Filtered; @@ -88,6 +79,7 @@ struct RecoilJets { Configurable trkEtaCut{"trkEtaCut", 0.9, "Eta acceptance of TPC"}; Configurable jetR{"jetR", 0.4, "Jet cone radius"}; + Configurable maxJetConstituentPt{"maxJetConstituentPt", 100., "Remove jets with constituent above this pT cut"}; Configurable triggerMasks{"triggerMasks", "", "Relevant trigger masks: fTrackLowPt,fTrackHighPt"}; Configurable skipMBGapEvents{"skipMBGapEvents", false, @@ -98,9 +90,8 @@ struct RecoilJets { Configurable meanFT0A{"meanFT0A", -1., "Mean value of FT0A signal"}; Configurable meanFT0C{"meanFT0C", -1., "Mean value of FT0C signal"}; - // List of configurable parameters for MC - Configurable pTHatExponent{"pTHatExponent", 4.0, "Exponent of the event weight for the calculation of pTHat"}; - Configurable pTHatMax{"pTHatMax", 999.0, "Maximum fraction of hard scattering for jet acceptance in MC"}; + Configurable meanFT0APartLevel{"meanFT0APartLevel", -1., "Mean number of charged part. within FT0A acceptance"}; + Configurable meanFT0CPartLevel{"meanFT0CPartLevel", -1., "Mean number of charged part. within FT0C acceptance"}; // Parameters for recoil jet selection Configurable ptTTrefMin{"ptTTrefMin", 5., "Minimum pT of reference TT"}; @@ -108,8 +99,8 @@ struct RecoilJets { Configurable ptTTsigMin{"ptTTsigMin", 20., "Minimum pT of signal TT"}; Configurable ptTTsigMax{"ptTTsigMax", 50., "Maximum pT of signal TT"}; Configurable recoilRegion{"recoilRegion", 0.6, "Width of recoil acceptance"}; - - Configurable maxJetConstituentPt{"maxJetConstituentPt", 100., "Remove jets with constituent above this pT cut"}; + Configurable minPhiForTTSelection{"minPhiForTTSelection", 0.0, "Min rectriction of phi angle for TT if phi is non-uniform"}; + Configurable maxPhiForTTSelection{"maxPhiForTTSelection", 6.3, "Max rectriction of phi angle for TT if phi is non-uniform"}; // List of configurable parameters for histograms Configurable histJetPt{"histJetPt", 100, "Maximum value of jet pT shown in histograms"}; @@ -123,8 +114,11 @@ struct RecoilJets { AxisSpec jetArea{50, 0.0, 5., "Area_{jet}"}; AxisSpec rhoArea{60, 0.0, 60., "#it{#rho} #times Area_{jet}"}; AxisSpec rho{50, 0.0, 50., "#it{#rho}"}; - ConfigurableAxis multFT0CThresh{"multFT0CThresh", {VARIABLE_WIDTH, 0, 0.2, 0.3, 0.4, 0.6, 0.8, 1., 1.4, 1.8, 2.4, 3.6, 5., 20.}, "Percentiles of scaled FT0C: 100-90%, 90-80%, 80-70%, 70-60%, 60-50%, 50-40%, 40-30%, 30-20%, 20-10%, 10-1%, 1-0.1%"}; // to adjust the boarders - ConfigurableAxis multFT0MThresh{"multFT0MThresh", {VARIABLE_WIDTH, 0, 0.2, 0.3, 0.4, 0.6, 0.8, 1., 1.4, 1.8, 2.4, 3.6, 5., 20.}, "Percentiles of scaled FT0M: 100-90%, 90-80%, 80-70%, 70-60%, 60-50%, 50-40%, 40-30%, 30-20%, 20-10%, 10-1%, 1-0.1%"}; + ConfigurableAxis multFT0CThresh{"multFT0CThresh", {VARIABLE_WIDTH, 0.0, 0.133, 0.233, 0.367, 0.567, 0.767, 1.067, 1.4, 1.867, 2.5, 3.9, 5.4, 6.9, 20.}, "Percentiles of scaled FT0C: 100%, 90%, 80%, 70%, 60%, 50%, 40%, 30%, 20%, 10%, 1%, 0.1%, 0.01%"}; // default values for raw data + ConfigurableAxis multFT0MThresh{"multFT0MThresh", {VARIABLE_WIDTH, 0.0, 0.167, 0.267, 0.4, 0.567, 0.8, 1.067, 1.4, 1.833, 2.433, 3.667, 5.1, 6.433, 20.}, "Percentiles of scaled FT0M: 100%, 90%, 80%, 70%, 60%, 50%, 40%, 30%, 20%, 10%, 1%, 0.1%, 0.01%"}; // default values for raw data + + ConfigurableAxis multFT0CThreshPartLevel{"multFT0CThreshPartLevel", {VARIABLE_WIDTH, 0.0, 0.133, 0.233, 0.367, 0.567, 0.767, 1.067, 1.4, 1.867, 2.5, 3.9, 5.4, 6.9, 20.}, "Percentiles of scaled FT0C: 100%, 90%, 80%, 70%, 60%, 50%, 40%, 30%, 20%, 10%, 1%, 0.1%, 0.01%"}; + ConfigurableAxis multFT0MThreshPartLevel{"multFT0MThreshPartLevel", {VARIABLE_WIDTH, 0.0, 0.167, 0.267, 0.4, 0.567, 0.8, 1.067, 1.4, 1.833, 2.433, 3.667, 5.1, 6.433, 20.}, "Percentiles of scaled FT0M: 100%, 90%, 80%, 70%, 60%, 50%, 40%, 30%, 20%, 10%, 1%, 0.1%, 0.01%"}; // Auxiliary variables TRandom3* rand = new TRandom3(0); @@ -157,6 +151,8 @@ struct RecoilJets { AxisSpec scaledFT0A{histMultBins, 0.0, 20., "FT0A / #LT FT0A #GT"}; AxisSpec scaledFT0C{histMultBins, 0.0, 20., "FT0C / #LT FT0C #GT"}; AxisSpec scaledFT0M{histMultBins, 0.0, 20., "FT0M^{*}"}; + std::string nameFT0Caxis = "FT0C / #LT FT0C #GT"; + std::string nameFT0Maxis = "FT0M^{*}"; // Convert configurable strings to std::string std::string evSelToString = static_cast(evSel); @@ -168,115 +164,170 @@ struct RecoilJets { // List of raw and MC det. distributions if (doprocessData || doprocessMCDetLevel || doprocessMCDetLevelWeighted) { - spectra.add("hEventSelectionCount", "Count # of events in the analysis", kTH1F, {{3, 0.0, 3.}}); + spectra.add("hEventSelectionCount", "Count # of events in the analysis", kTH1F, {{6, 0.0, 6.}}); spectra.get(HIST("hEventSelectionCount"))->GetXaxis()->SetBinLabel(1, "Total # of events"); spectra.get(HIST("hEventSelectionCount"))->GetXaxis()->SetBinLabel(2, Form("# of events after sel. %s", evSelToString.data())); - spectra.get(HIST("hEventSelectionCount"))->GetXaxis()->SetBinLabel(3, "# of events w. outlier"); + spectra.get(HIST("hEventSelectionCount"))->GetXaxis()->SetBinLabel(3, "# of events skipMBGap"); + spectra.get(HIST("hEventSelectionCount"))->GetXaxis()->SetBinLabel(4, "# of events w. outlier"); + spectra.get(HIST("hEventSelectionCount"))->GetXaxis()->SetBinLabel(5, "# of events w/o assoc MC."); + spectra.get(HIST("hEventSelectionCount"))->GetXaxis()->SetBinLabel(6, "# of selected events"); - spectra.add("vertexZ", "Z vertex of collisions", kTH1F, {{60, -12., 12.}}); - spectra.add("hHasAssocMcCollision", "Has det. level coll. associat. MC coll.", kTH1F, {{2, 0.0, 2.}}); - spectra.get(HIST("hHasAssocMcCollision"))->GetXaxis()->SetBinLabel(1, "Yes"); - spectra.get(HIST("hHasAssocMcCollision"))->GetXaxis()->SetBinLabel(2, "No"); + spectra.add("hScaledFT0C_vertexZ", "Z vertex of collisions", kTH2F, {{multFT0CThresh, nameFT0Caxis}, {60, -12., 12., "#it{z}_{vertex}"}}); + spectra.add("hScaledFT0M_vertexZ", "Z vertex of collisions", kTH2F, {{multFT0MThresh, nameFT0Maxis}, {60, -12., 12., "#it{z}_{vertex}"}}); spectra.add("hTrackSelectionCount", "Count # of tracks in the analysis", kTH1F, {{2, 0.0, 2.}}); spectra.get(HIST("hTrackSelectionCount"))->GetXaxis()->SetBinLabel(1, "Total # of tracks"); spectra.get(HIST("hTrackSelectionCount"))->GetXaxis()->SetBinLabel(2, Form("# of tracks after sel. %s", trkSelToString.data())); - spectra.add("hTrackPtEtaPhi", "Charact. of tracks", kTH3F, {pT, pseudorap, phiAngle}); + spectra.add("hScaledFT0CTrackPtEtaPhi", "Charact. of tracks", kTHnSparseF, {{multFT0CThresh, nameFT0Caxis}, pT, pseudorap, phiAngle}); + spectra.add("hScaledFT0MTrackPtEtaPhi", "Charact. of tracks", kTHnSparseF, {{multFT0MThresh, nameFT0Maxis}, pT, pseudorap, phiAngle}); spectra.add("hTTSig_pT", "pT spectrum of all found TT_{Sig} cand.", kTH1F, {{40, 10., 50.}}); // needed to distinguish merged data from diff. wagons - spectra.add("hScaledFT0C_vs_Ntrig", "Total number of selected triggers per class vs scaled FT0C", kTH2F, {{multFT0CThresh}, {2, 0.0, 2.}}); - spectra.get(HIST("hScaledFT0C_vs_Ntrig"))->GetYaxis()->SetBinLabel(1, "TT_{ref}"); - spectra.get(HIST("hScaledFT0C_vs_Ntrig"))->GetYaxis()->SetBinLabel(2, "TT_{sig}"); + spectra.add("hScaledFT0C_Ntrig", "Total number of selected triggers per class vs scaled FT0C", kTH2F, {{multFT0CThresh, nameFT0Caxis}, {2, 0.0, 2.}}); + spectra.get(HIST("hScaledFT0C_Ntrig"))->GetYaxis()->SetBinLabel(1, "TT_{ref}"); + spectra.get(HIST("hScaledFT0C_Ntrig"))->GetYaxis()->SetBinLabel(2, "TT_{sig}"); - spectra.add("hScaledFT0M_vs_Ntrig", "Total number of selected triggers per class vs scaled FT0M", kTH2F, {{multFT0MThresh}, {2, 0.0, 2.}}); - spectra.get(HIST("hScaledFT0M_vs_Ntrig"))->GetYaxis()->SetBinLabel(1, "TT_{ref}"); - spectra.get(HIST("hScaledFT0M_vs_Ntrig"))->GetYaxis()->SetBinLabel(2, "TT_{sig}"); + spectra.add("hScaledFT0M_Ntrig", "Total number of selected triggers per class vs scaled FT0M", kTH2F, {{multFT0MThresh, nameFT0Maxis}, {2, 0.0, 2.}}); + spectra.get(HIST("hScaledFT0M_Ntrig"))->GetYaxis()->SetBinLabel(1, "TT_{ref}"); + spectra.get(HIST("hScaledFT0M_Ntrig"))->GetYaxis()->SetBinLabel(2, "TT_{sig}"); - spectra.add("hScaledFT0C_vs_TTRef_per_event", "Number of TT_{Ref} per event vs scaled FT0C", kTH2F, {{multFT0CThresh}, {15, 0.5, 15.5}}); - spectra.add("hScaledFT0M_vs_TTRef_per_event", "Number of TT_{Ref} per event vs scaled FT0M", kTH2F, {{multFT0MThresh}, {15, 0.5, 15.5}}); + spectra.add("hScaledFT0C_TTRef_per_event", "Number of TT_{Ref} per event vs scaled FT0C", kTH2F, {{multFT0CThresh, nameFT0Caxis}, {15, 0.5, 15.5, "# of TT_{Ref}"}}); + spectra.add("hScaledFT0M_TTRef_per_event", "Number of TT_{Ref} per event vs scaled FT0M", kTH2F, {{multFT0MThresh, nameFT0Maxis}, {15, 0.5, 15.5, "# of TT_{Ref}"}}); - spectra.add("hScaledFT0C_vs_TTSig_per_event", "Number of TT_{Sig} per event vs scaled FT0C", kTH2F, {{multFT0CThresh}, {10, 0.5, 10.5}}); - spectra.add("hScaledFT0M_vs_TTSig_per_event", "Number of TT_{Sig} per event vs scaled FT0M", kTH2F, {{multFT0MThresh}, {10, 0.5, 10.5}}); + spectra.add("hScaledFT0C_TTSig_per_event", "Number of TT_{Sig} per event vs scaled FT0C", kTH2F, {{multFT0CThresh, nameFT0Caxis}, {10, 0.5, 10.5, "# of TT_{Sig}"}}); + spectra.add("hScaledFT0M_TTSig_per_event", "Number of TT_{Sig} per event vs scaled FT0M", kTH2F, {{multFT0MThresh, nameFT0Maxis}, {10, 0.5, 10.5, "# of TT_{Sig}"}}); spectra.add("hJetPtEtaPhiRhoArea", "Charact. of inclusive jets", kTHnSparseF, {pT, pseudorapJets, phiAngle, rho, jetArea}); - spectra.add("hScaledFT0C_DPhi_JetPt_Corr_TTRef", "Events w. TT_{Ref}: scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0CThresh, deltaPhiAngle, jetPTcorr}); - spectra.add("hScaledFT0M_DPhi_JetPt_Corr_TTRef", "Events w. TT_{Ref}: scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0MThresh, deltaPhiAngle, jetPTcorr}); + spectra.add("hScaledFT0C_DPhi_JetPt_Corr_TTRef", "Events w. TT_{Ref}: scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {{multFT0CThresh, nameFT0Caxis}, deltaPhiAngle, jetPTcorr}); + spectra.add("hScaledFT0M_DPhi_JetPt_Corr_TTRef", "Events w. TT_{Ref}: scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {{multFT0MThresh, nameFT0Maxis}, deltaPhiAngle, jetPTcorr}); - spectra.add("hScaledFT0C_DPhi_JetPt_Corr_TTSig", "Events w. TT_{Sig}: scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0CThresh, deltaPhiAngle, jetPTcorr}); - spectra.add("hScaledFT0M_DPhi_JetPt_Corr_TTSig", "Events w. TT_{Sig}: scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0MThresh, deltaPhiAngle, jetPTcorr}); + spectra.add("hScaledFT0C_DPhi_JetPt_Corr_TTSig", "Events w. TT_{Sig}: scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {{multFT0CThresh, nameFT0Caxis}, deltaPhiAngle, jetPTcorr}); + spectra.add("hScaledFT0M_DPhi_JetPt_Corr_TTSig", "Events w. TT_{Sig}: scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {{multFT0MThresh, nameFT0Maxis}, deltaPhiAngle, jetPTcorr}); - spectra.add("hScaledFT0C_DPhi_JetPt_TTRef", "Events w. TT_{Ref}: scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0CThresh, deltaPhiAngle, pT}); - spectra.add("hScaledFT0M_DPhi_JetPt_TTRef", "Events w. TT_{Ref}: scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0MThresh, deltaPhiAngle, pT}); + spectra.add("hScaledFT0C_DPhi_JetPt_TTRef", "Events w. TT_{Ref}: scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {{multFT0CThresh, nameFT0Caxis}, deltaPhiAngle, pT}); + spectra.add("hScaledFT0M_DPhi_JetPt_TTRef", "Events w. TT_{Ref}: scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {{multFT0MThresh, nameFT0Maxis}, deltaPhiAngle, pT}); - spectra.add("hScaledFT0C_DPhi_JetPt_TTSig", "Events w. TT_{Sig}: scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0CThresh, deltaPhiAngle, pT}); - spectra.add("hScaledFT0M_DPhi_JetPt_TTSig", "Events w. TT_{Sig}: scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {multFT0MThresh, deltaPhiAngle, pT}); + spectra.add("hScaledFT0C_DPhi_JetPt_TTSig", "Events w. TT_{Sig}: scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {{multFT0CThresh, nameFT0Caxis}, deltaPhiAngle, pT}); + spectra.add("hScaledFT0M_DPhi_JetPt_TTSig", "Events w. TT_{Sig}: scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {{multFT0MThresh, nameFT0Maxis}, deltaPhiAngle, pT}); - spectra.add("hScaledFT0C_Recoil_JetPt_Corr_TTRef", "Events w. TT_{Ref}: scaled FT0C & #it{p}_{T} of recoil jets", kTH2F, {multFT0CThresh, jetPTcorr}); - spectra.add("hScaledFT0M_Recoil_JetPt_Corr_TTRef", "Events w. TT_{Ref}: scaled FT0M & #it{p}_{T} of recoil jets", kTH2F, {multFT0MThresh, jetPTcorr}); + spectra.add("hScaledFT0C_Recoil_JetPt_Corr_TTRef", "Events w. TT_{Ref}: scaled FT0C & #it{p}_{T} of recoil jets", kTH2F, {{multFT0CThresh, nameFT0Caxis}, jetPTcorr}); + spectra.add("hScaledFT0M_Recoil_JetPt_Corr_TTRef", "Events w. TT_{Ref}: scaled FT0M & #it{p}_{T} of recoil jets", kTH2F, {{multFT0MThresh, nameFT0Maxis}, jetPTcorr}); - spectra.add("hScaledFT0C_Recoil_JetPt_Corr_TTSig", "Events w. TT_{Sig}: scaled FT0C & #it{p}_{T} of recoil jets", kTH2F, {multFT0CThresh, jetPTcorr}); - spectra.add("hScaledFT0M_Recoil_JetPt_Corr_TTSig", "Events w. TT_{Sig}: scaled FT0M & #it{p}_{T} of recoil jets", kTH2F, {multFT0MThresh, jetPTcorr}); + spectra.add("hScaledFT0C_Recoil_JetPt_Corr_TTSig", "Events w. TT_{Sig}: scaled FT0C & #it{p}_{T} of recoil jets", kTH2F, {{multFT0CThresh, nameFT0Caxis}, jetPTcorr}); + spectra.add("hScaledFT0M_Recoil_JetPt_Corr_TTSig", "Events w. TT_{Sig}: scaled FT0M & #it{p}_{T} of recoil jets", kTH2F, {{multFT0MThresh, nameFT0Maxis}, jetPTcorr}); - spectra.add("hScaledFT0C_Recoil_JetPt_TTRef", "Events w. TT_{Ref}: scaled FT0C & #it{p}_{T} of recoil jets", kTH2F, {multFT0CThresh, pT}); - spectra.add("hScaledFT0M_Recoil_JetPt_TTRef", "Events w. TT_{Ref}: scaled FT0M & #it{p}_{T} of recoil jets", kTH2F, {multFT0MThresh, pT}); + spectra.add("hScaledFT0C_Recoil_JetPt_TTRef", "Events w. TT_{Ref}: scaled FT0C & #it{p}_{T} of recoil jets", kTH2F, {{multFT0CThresh, nameFT0Caxis}, pT}); + spectra.add("hScaledFT0M_Recoil_JetPt_TTRef", "Events w. TT_{Ref}: scaled FT0M & #it{p}_{T} of recoil jets", kTH2F, {{multFT0MThresh, nameFT0Maxis}, pT}); - spectra.add("hScaledFT0C_Recoil_JetPt_TTSig", "Events w. TT_{Sig}: scaled FT0C & #it{p}_{T} of recoil jets", kTH2F, {multFT0CThresh, pT}); - spectra.add("hScaledFT0M_Recoil_JetPt_TTSig", "Events w. TT_{Sig}: scaled FT0M & #it{p}_{T} of recoil jets", kTH2F, {multFT0MThresh, pT}); + spectra.add("hScaledFT0C_Recoil_JetPt_TTSig", "Events w. TT_{Sig}: scaled FT0C & #it{p}_{T} of recoil jets", kTH2F, {{multFT0CThresh, nameFT0Caxis}, pT}); + spectra.add("hScaledFT0M_Recoil_JetPt_TTSig", "Events w. TT_{Sig}: scaled FT0M & #it{p}_{T} of recoil jets", kTH2F, {{multFT0MThresh, nameFT0Maxis}, pT}); spectra.add("hJetArea_JetPt_Rho_TTRef", "Events w. TT_{Ref}: A_{jet} & jet pT & #rho", kTH3F, {jetArea, pT, rho}); spectra.add("hJetArea_JetPt_Rho_TTSig", "Events w. TT_{Sig}: A_{jet} & jet pT & #rho", kTH3F, {jetArea, pT, rho}); - spectra.add("hScaledFT0C_Rho_TTRef", "Events w. TT_{Ref}: scaled FT0C & #rho", kTH2F, {multFT0CThresh, rho}); - spectra.add("hScaledFT0M_Rho_TTRef", "Events w. TT_{Ref}: scaled FT0M & #rho", kTH2F, {multFT0MThresh, rho}); + spectra.add("hScaledFT0C_Rho", "Scaled FT0C & #rho", kTH2F, {{multFT0CThresh, nameFT0Caxis}, rho}); + spectra.add("hScaledFT0M_Rho", "Scaled FT0M & #rho", kTH2F, {{multFT0MThresh, nameFT0Maxis}, rho}); - spectra.add("hScaledFT0C_Rho_TTSig", "Events w. TT_{Sig}: scaled FT0C & #rho", kTH2F, {multFT0CThresh, rho}); - spectra.add("hScaledFT0M_Rho_TTSig", "Events w. TT_{Sig}: scaled FT0M & #rho", kTH2F, {multFT0MThresh, rho}); + spectra.add("hScaledFT0C_Rho_TTRef", "Events w. TT_{Ref}: scaled FT0C & #rho", kTH2F, {{multFT0CThresh, nameFT0Caxis}, rho}); + spectra.add("hScaledFT0M_Rho_TTRef", "Events w. TT_{Ref}: scaled FT0M & #rho", kTH2F, {{multFT0MThresh, nameFT0Maxis}, rho}); + + spectra.add("hScaledFT0C_Rho_TTSig", "Events w. TT_{Sig}: scaled FT0C & #rho", kTH2F, {{multFT0CThresh, nameFT0Caxis}, rho}); + spectra.add("hScaledFT0M_Rho_TTSig", "Events w. TT_{Sig}: scaled FT0M & #rho", kTH2F, {{multFT0MThresh, nameFT0Maxis}, rho}); spectra.add("hScaledFT0C_TTRef", "Events w. TT_{Ref}: scaled FT0C", kTH1F, {scaledFT0C}); spectra.add("hScaledFT0M_TTRef", "Events w. TT_{Ref}: scaled FT0M", kTH1F, {scaledFT0M}); spectra.add("hScaledFT0C_TTSig", "Events w. TT_{Sig}: scaled FT0C", kTH1F, {scaledFT0C}); spectra.add("hScaledFT0M_TTSig", "Events w. TT_{Sig}: scaled FT0M", kTH1F, {scaledFT0M}); + + // Rectricted phi range for TT selection + spectra.add("hScaledFT0C_DPhi_JetPt_Corr_TTRef_RectrictedPhi", Form("Events w. TT_{Ref} #in #varphi (%.2f, %.2f): scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", static_cast(minPhiForTTSelection), static_cast(maxPhiForTTSelection)), kTH3F, {{multFT0CThresh, nameFT0Caxis}, deltaPhiAngle, jetPTcorr}); + spectra.add("hScaledFT0M_DPhi_JetPt_Corr_TTRef_RectrictedPhi", Form("Events w. TT_{Ref} #in #varphi (%.2f, %.2f): scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", static_cast(minPhiForTTSelection), static_cast(maxPhiForTTSelection)), kTH3F, {{multFT0MThresh, nameFT0Maxis}, deltaPhiAngle, jetPTcorr}); + + spectra.add("hScaledFT0C_DPhi_JetPt_Corr_TTSig_RectrictedPhi", Form("Events w. TT_{Sig} #in #varphi (%.2f, %.2f): scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", static_cast(minPhiForTTSelection), static_cast(maxPhiForTTSelection)), kTH3F, {{multFT0CThresh, nameFT0Caxis}, deltaPhiAngle, jetPTcorr}); + spectra.add("hScaledFT0M_DPhi_JetPt_Corr_TTSig_RectrictedPhi", Form("Events w. TT_{Sig} #in #varphi (%.2f, %.2f): scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", static_cast(minPhiForTTSelection), static_cast(maxPhiForTTSelection)), kTH3F, {{multFT0MThresh, nameFT0Maxis}, deltaPhiAngle, jetPTcorr}); } // List of MC particle level distributions if (doprocessMCPartLevel || doprocessMCPartLevelWeighted) { - spectra.add("vertexZMC", "Z vertex of jmccollision", kTH1F, {{60, -12., 12.}}); - spectra.add("ptHat", "Distribution of pT hat", kTH1F, {{500, 0.0, 100.}}); + spectra.add("hScaledFT0C_vertexZMC", "Z vertex of MCcollision", kTH2F, {{multFT0CThreshPartLevel, nameFT0Caxis}, {60, -12., 12., "#it{z}_{vertex}"}}); + spectra.add("hScaledFT0M_vertexZMC", "Z vertex of MCcollision", kTH2F, {{multFT0MThreshPartLevel, nameFT0Maxis}, {60, -12., 12., "#it{z}_{vertex}"}}); + spectra.add("ptHat", "Distribution of pT hat", kTH1F, {{5000, 0.0, 1000.}}); - spectra.add("hEventSelectionCountPartLevel", "Count # of events in the part. level analysis", kTH1F, {{2, 0.0, 2.}}); + spectra.add("hEventSelectionCountPartLevel", "Count # of events in the part. level analysis", kTH1F, {{4, 0.0, 4.}}); spectra.get(HIST("hEventSelectionCountPartLevel"))->GetXaxis()->SetBinLabel(1, "Total # of events"); - spectra.get(HIST("hEventSelectionCountPartLevel"))->GetXaxis()->SetBinLabel(2, "# of events w. outlier"); + spectra.get(HIST("hEventSelectionCountPartLevel"))->GetXaxis()->SetBinLabel(2, "# of events skipMB gap"); + spectra.get(HIST("hEventSelectionCountPartLevel"))->GetXaxis()->SetBinLabel(3, "# of events w. outlier"); + spectra.get(HIST("hEventSelectionCountPartLevel"))->GetXaxis()->SetBinLabel(4, "# of selected events"); + + spectra.add("hScaledFT0CPartPtEtaPhi", "Charact. of particles", kTHnSparseF, {{multFT0CThreshPartLevel, nameFT0Caxis}, pT, pseudorap, phiAngle}); + spectra.add("hScaledFT0MPartPtEtaPhi", "Charact. of particles", kTHnSparseF, {{multFT0MThreshPartLevel, nameFT0Maxis}, pT, pseudorap, phiAngle}); - spectra.add("hCountNumberOutliersFrameWork", "Count # of outlier events based on flag from JE fw", kTH1F, {{1, 0.0, 1.}}); - spectra.get(HIST("hCountNumberOutliersFrameWork"))->GetXaxis()->SetBinLabel(1, "Outlier flag true"); + spectra.add("hScaledFT0C_Ntrig_Part", "Total number of selected triggers per class vs scaled FT0C", kTH2F, {{multFT0CThreshPartLevel, nameFT0Caxis}, {2, 0.0, 2.}}); + spectra.get(HIST("hScaledFT0C_Ntrig_Part"))->GetXaxis()->SetBinLabel(1, "TT_{ref}"); + spectra.get(HIST("hScaledFT0C_Ntrig_Part"))->GetXaxis()->SetBinLabel(2, "TT_{sig}"); - spectra.add("hPartPtEtaPhi", "Charact. of particles", kTH3F, {pT, pseudorap, phiAngle}); - spectra.add("hNtrig_Part", "Total number of selected triggers per class", kTH1F, {{2, 0.0, 2.}}); - spectra.get(HIST("hNtrig_Part"))->GetXaxis()->SetBinLabel(1, "TT_{ref}"); - spectra.get(HIST("hNtrig_Part"))->GetXaxis()->SetBinLabel(2, "TT_{sig}"); + spectra.add("hScaledFT0M_Ntrig_Part", "Total number of selected triggers per class vs scaled FT0M", kTH2F, {{multFT0MThreshPartLevel, nameFT0Maxis}, {2, 0.0, 2.}}); + spectra.get(HIST("hScaledFT0M_Ntrig_Part"))->GetXaxis()->SetBinLabel(1, "TT_{ref}"); + spectra.get(HIST("hScaledFT0M_Ntrig_Part"))->GetXaxis()->SetBinLabel(2, "TT_{sig}"); - spectra.add("hTTRef_per_event_Part", "Number of TT_{Ref} per event", kTH1F, {{15, 0.5, 15.5}}); - spectra.add("hTTSig_per_event_Part", "Number of TT_{Sig} per event", kTH1F, {{10, 0.5, 10.5}}); + spectra.add("hScaledFT0C_TTRef_per_event_Part", "Number of TT_{Ref} per event vs scaled FT0C", kTH2F, {{multFT0CThreshPartLevel, nameFT0Caxis}, {15, 0.5, 15.5, "# of TT_{Ref}"}}); + spectra.add("hScaledFT0M_TTRef_per_event_Part", "Number of TT_{Ref} per event vs scaled FT0M", kTH2F, {{multFT0MThreshPartLevel, nameFT0Maxis}, {15, 0.5, 15.5, "# of TT_{Ref}"}}); + + spectra.add("hScaledFT0C_TTSig_per_event_Part", "Number of TT_{Sig} per event vs scaled FT0C", kTH2F, {{multFT0CThreshPartLevel, nameFT0Caxis}, {10, 0.5, 10.5, "# of TT_{Sig}"}}); + spectra.add("hScaledFT0M_TTSig_per_event_Part", "Number of TT_{Sig} per event vs scaled FT0M", kTH2F, {{multFT0MThreshPartLevel, nameFT0Maxis}, {10, 0.5, 10.5, "# of TT_{Sig}"}}); spectra.add("hJetPtEtaPhiRhoArea_Part", "Charact. of inclusive part. level jets", kTHnSparseF, {pT, pseudorapJets, phiAngle, rho, jetArea}); - spectra.add("hDPhi_JetPt_Corr_TTRef_Part", "Events w. TT_{Ref}: #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH2F, {deltaPhiAngle, jetPTcorr}); - spectra.add("hDPhi_JetPt_Corr_TTSig_Part", "Events w. TT_{Sig}: #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH2F, {deltaPhiAngle, jetPTcorr}); - spectra.add("hDPhi_JetPt_TTRef_Part", "Events w. TT_{Ref}: #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH2F, {deltaPhiAngle, pT}); - spectra.add("hDPhi_JetPt_TTSig_Part", "Events w. TT_{Sig}: #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH2F, {deltaPhiAngle, pT}); + spectra.add("hScaledFT0C_DPhi_JetPt_Corr_TTRef_Part", "Events w. TT_{Ref}: scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {{multFT0CThreshPartLevel, nameFT0Caxis}, deltaPhiAngle, jetPTcorr}); + spectra.add("hScaledFT0M_DPhi_JetPt_Corr_TTRef_Part", "Events w. TT_{Ref}: scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {{multFT0MThreshPartLevel, nameFT0Maxis}, deltaPhiAngle, jetPTcorr}); + + spectra.add("hScaledFT0C_DPhi_JetPt_Corr_TTSig_Part", "Events w. TT_{Sig}: scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {{multFT0CThreshPartLevel, nameFT0Caxis}, deltaPhiAngle, jetPTcorr}); + spectra.add("hScaledFT0M_DPhi_JetPt_Corr_TTSig_Part", "Events w. TT_{Sig}: scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {{multFT0MThreshPartLevel, nameFT0Maxis}, deltaPhiAngle, jetPTcorr}); + + spectra.add("hScaledFT0C_DPhi_JetPt_TTRef_Part", "Events w. TT_{Ref}: scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {{multFT0CThreshPartLevel, nameFT0Caxis}, deltaPhiAngle, pT}); + spectra.add("hScaledFT0M_DPhi_JetPt_TTRef_Part", "Events w. TT_{Ref}: scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {{multFT0MThreshPartLevel, nameFT0Maxis}, deltaPhiAngle, pT}); + + spectra.add("hScaledFT0C_DPhi_JetPt_TTSig_Part", "Events w. TT_{Sig}: scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {{multFT0CThreshPartLevel, nameFT0Caxis}, deltaPhiAngle, pT}); + spectra.add("hScaledFT0M_DPhi_JetPt_TTSig_Part", "Events w. TT_{Sig}: scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH3F, {{multFT0MThreshPartLevel, nameFT0Maxis}, deltaPhiAngle, pT}); + + spectra.add("hScaledFT0C_Recoil_JetPt_Corr_TTRef_Part", "Events w. TT_{Ref}: scaled FT0C & #it{p}_{T} of recoil jets", kTH2F, {{multFT0CThreshPartLevel, nameFT0Caxis}, jetPTcorr}); + spectra.add("hScaledFT0M_Recoil_JetPt_Corr_TTRef_Part", "Events w. TT_{Ref}: scaled FT0M & #it{p}_{T} of recoil jets", kTH2F, {{multFT0MThreshPartLevel, nameFT0Maxis}, jetPTcorr}); + + spectra.add("hScaledFT0C_Recoil_JetPt_Corr_TTSig_Part", "Events w. TT_{Sig}: scaled FT0C & #it{p}_{T} of recoil jets", kTH2F, {{multFT0CThreshPartLevel, nameFT0Caxis}, jetPTcorr}); + spectra.add("hScaledFT0M_Recoil_JetPt_Corr_TTSig_Part", "Events w. TT_{Sig}: scaled FT0M & #it{p}_{T} of recoil jets", kTH2F, {{multFT0MThreshPartLevel, nameFT0Maxis}, jetPTcorr}); - spectra.add("hRecoil_JetPt_Corr_TTRef_Part", "Events w. TT_{Ref}: #it{p}_{T} of recoil jets", kTH1F, {jetPTcorr}); - spectra.add("hRecoil_JetPt_Corr_TTSig_Part", "Events w. TT_{Sig}: #it{p}_{T} of recoil jets", kTH1F, {jetPTcorr}); - spectra.add("hRecoil_JetPt_TTRef_Part", "Events w. TT_{Ref}: #it{p}_{T} of recoil jets", kTH1F, {pT}); - spectra.add("hRecoil_JetPt_TTSig_Part", "Events w. TT_{Sig}: #it{p}_{T} of recoil jets", kTH1F, {pT}); + spectra.add("hScaledFT0C_Recoil_JetPt_TTRef_Part", "Events w. TT_{Ref}: scaled FT0C & #it{p}_{T} of recoil jets", kTH2F, {{multFT0CThreshPartLevel, nameFT0Caxis}, pT}); + spectra.add("hScaledFT0M_Recoil_JetPt_TTRef_Part", "Events w. TT_{Ref}: scaled FT0M & #it{p}_{T} of recoil jets", kTH2F, {{multFT0MThreshPartLevel, nameFT0Maxis}, pT}); + + spectra.add("hScaledFT0C_Recoil_JetPt_TTSig_Part", "Events w. TT_{Sig}: scaled FT0C & #it{p}_{T} of recoil jets", kTH2F, {{multFT0CThreshPartLevel, nameFT0Caxis}, pT}); + spectra.add("hScaledFT0M_Recoil_JetPt_TTSig_Part", "Events w. TT_{Sig}: scaled FT0M & #it{p}_{T} of recoil jets", kTH2F, {{multFT0MThreshPartLevel, nameFT0Maxis}, pT}); spectra.add("hJetArea_JetPt_Rho_TTRef_Part", "Events w. TT_{Ref}: A_{jet} & jet pT & #rho", kTH3F, {jetArea, pT, rho}); spectra.add("hJetArea_JetPt_Rho_TTSig_Part", "Events w. TT_{Sig}: A_{jet} & jet pT & #rho", kTH3F, {jetArea, pT, rho}); - spectra.add("hDiffInOutlierRemove", "Difference between pT hat from code and fw", kTH1F, {{502, -0.2, 50.}}); + spectra.add("hScaledFT0C_Rho_Part", "Scaled FT0C & #rho", kTH2F, {{multFT0CThreshPartLevel, nameFT0Caxis}, rho}); + spectra.add("hScaledFT0M_Rho_Part", "Scaled FT0M & #rho", kTH2F, {{multFT0MThreshPartLevel, nameFT0Maxis}, rho}); + + spectra.add("hScaledFT0C_Rho_TTRef_Part", "Events w. TT_{Ref}: scaled FT0C & #rho", kTH2F, {{multFT0CThreshPartLevel, nameFT0Caxis}, rho}); + spectra.add("hScaledFT0M_Rho_TTRef_Part", "Events w. TT_{Ref}: scaled FT0M & #rho", kTH2F, {{multFT0MThreshPartLevel, nameFT0Maxis}, rho}); + + spectra.add("hScaledFT0C_Rho_TTSig_Part", "Events w. TT_{Sig}: scaled FT0C & #rho", kTH2F, {{multFT0CThreshPartLevel, nameFT0Caxis}, rho}); + spectra.add("hScaledFT0M_Rho_TTSig_Part", "Events w. TT_{Sig}: scaled FT0M & #rho", kTH2F, {{multFT0MThreshPartLevel, nameFT0Maxis}, rho}); + + spectra.add("hScaledFT0C_TTRef_Part", "Events w. TT_{Ref}: scaled FT0C", kTH1F, {scaledFT0C}); + spectra.add("hScaledFT0M_TTRef_Part", "Events w. TT_{Ref}: scaled FT0M", kTH1F, {scaledFT0M}); + + spectra.add("hScaledFT0C_TTSig_Part", "Events w. TT_{Sig}: scaled FT0C", kTH1F, {scaledFT0C}); + spectra.add("hScaledFT0M_TTSig_Part", "Events w. TT_{Sig}: scaled FT0M", kTH1F, {scaledFT0M}); + + // Rectricted phi range for TT selection + spectra.add("hScaledFT0C_DPhi_JetPt_Corr_TTRef_RectrictedPhi_Part", Form("Events w. TT_{Ref} #in #varphi (%.2f, %.2f): scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", static_cast(minPhiForTTSelection), static_cast(maxPhiForTTSelection)), kTH3F, {{multFT0CThreshPartLevel, nameFT0Caxis}, deltaPhiAngle, jetPTcorr}); + spectra.add("hScaledFT0M_DPhi_JetPt_Corr_TTRef_RectrictedPhi_Part", Form("Events w. TT_{Ref} #in #varphi (%.2f, %.2f): scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", static_cast(minPhiForTTSelection), static_cast(maxPhiForTTSelection)), kTH3F, {{multFT0MThreshPartLevel, nameFT0Maxis}, deltaPhiAngle, jetPTcorr}); + + spectra.add("hScaledFT0C_DPhi_JetPt_Corr_TTSig_RectrictedPhi_Part", Form("Events w. TT_{Sig} #in #varphi (%.2f, %.2f): scaled FT0C & #Delta#varphi & #it{p}_{T, jet}^{ch}", static_cast(minPhiForTTSelection), static_cast(maxPhiForTTSelection)), kTH3F, {{multFT0CThreshPartLevel, nameFT0Caxis}, deltaPhiAngle, jetPTcorr}); + spectra.add("hScaledFT0M_DPhi_JetPt_Corr_TTSig_RectrictedPhi_Part", Form("Events w. TT_{Sig} #in #varphi (%.2f, %.2f): scaled FT0M & #Delta#varphi & #it{p}_{T, jet}^{ch}", static_cast(minPhiForTTSelection), static_cast(maxPhiForTTSelection)), kTH3F, {{multFT0MThreshPartLevel, nameFT0Maxis}, deltaPhiAngle, jetPTcorr}); } // Jet matching: part. vs. det. @@ -306,7 +357,8 @@ struct RecoilJets { spectra.add("hNumberMatchedJetsPerOneBaseJet", "# of tagged jets per 1 base jet vs. jet pT", kTH2F, {{10, 0.5, 10.5}, {100, 0.0, 100.}}); } - if (doprocessMultiplicity) { + // Multiplicity for raw data and detector level MC + if (doprocessMultiplicityOO || doprocessMultiplicityMCDetLevelWeightedOO) { spectra.add("hMultFT0A", "Mult. signal from FTOA", kTH1F, {{2000, 0.0, 40000., "FT0A"}}); spectra.add("hMultFT0C", "Mult. signal from FTOC", kTH1F, {{2000, 0.0, 40000., "FT0C"}}); spectra.add("hMultFT0M", "Total mult. signal from FT0A & FTOC", kTH1F, {{3000, 0.0, 60000., "FT0M"}}); @@ -317,9 +369,16 @@ struct RecoilJets { spectra.add("hMultZNA", "Mult. signal from ZDC A-side", kTH1F, {{1000, 0.0, 5000., "ZNA"}}); spectra.add("hMultZNC", "Mult. signal from ZDC C-side", kTH1F, {{1000, 0.0, 5000., "ZNC"}}); - spectra.add("hMultZNM", "Total mult. signal from ZDCs", kTH1F, {{4000, 0.0, 8000., "ZNM"}}); + spectra.add("hMultZNM", "Total mult. signal from ZDCs for neutrons", kTH1F, {{4000, 0.0, 8000., "ZNM"}}); + + spectra.add("hMultZPA", "Mult. signal from ZDC A-side", kTH1F, {{1000, 0.0, 5000., "ZPA"}}); + spectra.add("hMultZPC", "Mult. signal from ZDC C-side", kTH1F, {{1000, 0.0, 5000., "ZPC"}}); + spectra.add("hMultZPM", "Total mult. signal from ZDCs for protons", kTH1F, {{4000, 0.0, 8000., "ZPM"}}); // Correlations + spectra.add("hZPA_vs_ZNA", "Correlation of signals ZPA vs ZNA", kTH2F, {{1000, 0.0, 5000., "ZPA"}, {1000, 0.0, 5000., "ZNA"}}); + spectra.add("hZPC_vs_ZNC", "Correlation of signals ZPC vs ZNC", kTH2F, {{1000, 0.0, 5000., "ZPC"}, {1000, 0.0, 5000., "ZNC"}}); + spectra.add("hMultFT0A_vs_ZNA", "Correlation of signals FTOA vs ZNA", kTH2F, {{2000, 0.0, 40000., "FT0A"}, {1000, 0.0, 5000., "ZNA"}}); spectra.add("hMultFT0C_vs_ZNC", "Correlation of signals FTOC vs ZNC", kTH2F, {{2000, 0.0, 40000., "FT0C"}, {1000, 0.0, 5000., "ZNC"}}); spectra.add("hMultFT0M_vs_ZNM", "Correlation of signals FTOM vs ZNM", kTH2F, {{3000, 0.0, 60000., "FT0M"}, {4000, 0.0, 8000., "ZNM"}}); @@ -327,7 +386,24 @@ struct RecoilJets { spectra.add("hScaleMultFT0A_vs_ZNA", "Correlation of signals FT0A/meanFT0A vs ZNA", kTH2F, {{scaledFT0A}, {1000, 0.0, 5000., "ZNA"}}); spectra.add("hScaleMultFT0C_vs_ZNC", "Correlation of signals FT0C/meanFT0C vs ZNC", kTH2F, {{scaledFT0C}, {1000, 0.0, 5000., "ZNC"}}); spectra.add("hScaleMultFT0M_vs_ZNM", "Correlation of signals FT0M^{*} vs ZNM", kTH2F, {{scaledFT0M}, {4000, 0.0, 8000., "ZNM"}}); + + spectra.add("hScaleMultFT0A_vs_ZPA", "Correlation of signals FT0A/meanFT0A vs ZPA", kTH2F, {{scaledFT0A}, {1000, 0.0, 5000., "ZPA"}}); + spectra.add("hScaleMultFT0C_vs_ZPC", "Correlation of signals FT0C/meanFT0C vs ZPC", kTH2F, {{scaledFT0C}, {1000, 0.0, 5000., "ZPC"}}); + spectra.add("hScaleMultFT0M_vs_ZPM", "Correlation of signals FT0M^{*} vs ZPM", kTH2F, {{scaledFT0M}, {4000, 0.0, 8000., "ZPM"}}); + spectra.add("hScaleMultFT0M_vs_ZNA_vs_ZNC", "Correlation of signals FT0M^{*} vs ZNA vs ZNC", kTH3F, {{scaledFT0M}, {600, 0.0, 3000., "ZNA"}, {600, 0.0, 3000., "ZNC"}}); + spectra.add("hScaleMultFT0M_vs_ZPA_vs_ZPC", "Correlation of signals FT0M^{*} vs ZPA vs ZPC", kTH3F, {{scaledFT0M}, {600, 0.0, 3000., "ZPA"}, {600, 0.0, 3000., "ZPC"}}); + } + + // Multiplicity for particle level MC + if (doprocessMultiplicityPartLevelMC || doprocessMultiplicityPartLevelMCWeighted) { + spectra.add("hMultFT0APartLevel", "# of primary particles within FTOA acceptance", kTH1F, {{2000, 0.0, 500., "FT0A"}}); + spectra.add("hMultFT0CPartLevel", "# of primary particles within FTOC acceptance", kTH1F, {{2000, 0.0, 500., "FT0C"}}); + spectra.add("hMultFT0MPartLevel", "Total # of primary particles from FT0A & FTOC", kTH1F, {{4000, 0.0, 1000., "FT0M"}}); + + spectra.add("hScaleMultFT0APartLevel", "Scaled # of primary particles within FTOA acceptance", kTH1F, {scaledFT0A}); + spectra.add("hScaleMultFT0CPartLevel", "Scaled # of primary particles within FTOC acceptance", kTH1F, {scaledFT0C}); + spectra.add("hScaleMultFT0MPartLevel", "Scaled total # of primary particles from FT0A & FTOC", kTH1F, {scaledFT0M}); } } @@ -340,7 +416,6 @@ struct RecoilJets { std::vector vPhiOfTT; double phiTT = 0.; int nTT = 0; - float pTHat = getPtHat(weight); float rho = collision.rho(); float multFT0A = collision.multFT0A(); float multFT0C = collision.multFT0C(); @@ -351,13 +426,11 @@ struct RecoilJets { if (dice < fracSig) bSigEv = true; - // Remove whole event if jet passes the outlier removal condition - for (const auto& jet : jets) { - if (jet.pt() > pTHatMax * pTHat) { - spectra.fill(HIST("hEventSelectionCount"), 2.5); - return; - } - } + spectra.fill(HIST("hScaledFT0C_vertexZ"), scaledFT0C, collision.posZ(), weight); + spectra.fill(HIST("hScaledFT0M_vertexZ"), scaledFT0M, collision.posZ(), weight); + + spectra.fill(HIST("hScaledFT0C_Rho"), scaledFT0C, rho, weight); + spectra.fill(HIST("hScaledFT0M_Rho"), scaledFT0M, rho, weight); for (const auto& track : tracks) { spectra.fill(HIST("hTrackSelectionCount"), 0.5); @@ -366,19 +439,21 @@ struct RecoilJets { continue; float trackPt = track.pt(); + float trackPhi = track.phi(); spectra.fill(HIST("hTrackSelectionCount"), 1.5); - spectra.fill(HIST("hTrackPtEtaPhi"), trackPt, track.eta(), track.phi(), weight); + spectra.fill(HIST("hScaledFT0CTrackPtEtaPhi"), scaledFT0C, trackPt, track.eta(), trackPhi, weight); + spectra.fill(HIST("hScaledFT0MTrackPtEtaPhi"), scaledFT0M, trackPt, track.eta(), trackPhi, weight); // Search for TT candidate if (bSigEv && (trackPt > ptTTsigMin && trackPt < ptTTsigMax)) { - vPhiOfTT.push_back(track.phi()); + vPhiOfTT.push_back(trackPhi); spectra.fill(HIST("hTTSig_pT"), trackPt, weight); ++nTT; } if (!bSigEv && (trackPt > ptTTrefMin && trackPt < ptTTrefMax)) { - vPhiOfTT.push_back(track.phi()); + vPhiOfTT.push_back(trackPhi); ++nTT; } } @@ -388,21 +463,27 @@ struct RecoilJets { phiTT = getPhiTT(vPhiOfTT); if (bSigEv) { - spectra.fill(HIST("hScaledFT0C_vs_Ntrig"), scaledFT0C, 1.5, weight); - spectra.fill(HIST("hScaledFT0M_vs_Ntrig"), scaledFT0M, 1.5, weight); - spectra.fill(HIST("hScaledFT0C_vs_TTSig_per_event"), scaledFT0C, nTT, weight); - spectra.fill(HIST("hScaledFT0M_vs_TTSig_per_event"), scaledFT0M, nTT, weight); + spectra.fill(HIST("hScaledFT0C_Ntrig"), scaledFT0C, 1.5, weight); + spectra.fill(HIST("hScaledFT0M_Ntrig"), scaledFT0M, 1.5, weight); + spectra.fill(HIST("hScaledFT0C_TTSig_per_event"), scaledFT0C, nTT, weight); + spectra.fill(HIST("hScaledFT0M_TTSig_per_event"), scaledFT0M, nTT, weight); spectra.fill(HIST("hScaledFT0C_TTSig"), scaledFT0C, weight); spectra.fill(HIST("hScaledFT0M_TTSig"), scaledFT0M, weight); + + spectra.fill(HIST("hScaledFT0C_Rho_TTSig"), scaledFT0C, rho, weight); + spectra.fill(HIST("hScaledFT0M_Rho_TTSig"), scaledFT0M, rho, weight); } else { - spectra.fill(HIST("hScaledFT0C_vs_Ntrig"), scaledFT0C, 0.5, weight); - spectra.fill(HIST("hScaledFT0M_vs_Ntrig"), scaledFT0M, 0.5, weight); - spectra.fill(HIST("hScaledFT0C_vs_TTRef_per_event"), scaledFT0C, nTT, weight); - spectra.fill(HIST("hScaledFT0M_vs_TTRef_per_event"), scaledFT0M, nTT, weight); + spectra.fill(HIST("hScaledFT0C_Ntrig"), scaledFT0C, 0.5, weight); + spectra.fill(HIST("hScaledFT0M_Ntrig"), scaledFT0M, 0.5, weight); + spectra.fill(HIST("hScaledFT0C_TTRef_per_event"), scaledFT0C, nTT, weight); + spectra.fill(HIST("hScaledFT0M_TTRef_per_event"), scaledFT0M, nTT, weight); spectra.fill(HIST("hScaledFT0C_TTRef"), scaledFT0C, weight); spectra.fill(HIST("hScaledFT0M_TTRef"), scaledFT0M, weight); + + spectra.fill(HIST("hScaledFT0C_Rho_TTRef"), scaledFT0C, rho, weight); + spectra.fill(HIST("hScaledFT0M_Rho_TTRef"), scaledFT0M, rho, weight); } } @@ -421,9 +502,6 @@ struct RecoilJets { auto [dphi, bRecoilJet] = isRecoilJet(jet, phiTT); if (bSigEv) { - spectra.fill(HIST("hScaledFT0C_Rho_TTSig"), scaledFT0C, rho, weight); - spectra.fill(HIST("hScaledFT0M_Rho_TTSig"), scaledFT0M, rho, weight); - spectra.fill(HIST("hScaledFT0C_DPhi_JetPt_Corr_TTSig"), scaledFT0C, dphi, jetPtCorr, weight); spectra.fill(HIST("hScaledFT0M_DPhi_JetPt_Corr_TTSig"), scaledFT0M, dphi, jetPtCorr, weight); @@ -431,6 +509,11 @@ struct RecoilJets { spectra.fill(HIST("hScaledFT0M_DPhi_JetPt_TTSig"), scaledFT0M, dphi, jetPt, weight); spectra.fill(HIST("hJetArea_JetPt_Rho_TTSig"), jetArea, jetPt, rho, weight); + if (phiTT > minPhiForTTSelection && phiTT < maxPhiForTTSelection) { + spectra.fill(HIST("hScaledFT0C_DPhi_JetPt_Corr_TTSig_RectrictedPhi"), scaledFT0C, dphi, jetPtCorr, weight); + spectra.fill(HIST("hScaledFT0M_DPhi_JetPt_Corr_TTSig_RectrictedPhi"), scaledFT0M, dphi, jetPtCorr, weight); + } + if (bRecoilJet) { spectra.fill(HIST("hScaledFT0C_Recoil_JetPt_Corr_TTSig"), scaledFT0C, jetPtCorr, weight); spectra.fill(HIST("hScaledFT0M_Recoil_JetPt_Corr_TTSig"), scaledFT0M, jetPtCorr, weight); @@ -438,11 +521,7 @@ struct RecoilJets { spectra.fill(HIST("hScaledFT0C_Recoil_JetPt_TTSig"), scaledFT0C, jetPt, weight); spectra.fill(HIST("hScaledFT0M_Recoil_JetPt_TTSig"), scaledFT0M, jetPt, weight); } - } else { - spectra.fill(HIST("hScaledFT0C_Rho_TTRef"), scaledFT0C, rho, weight); - spectra.fill(HIST("hScaledFT0M_Rho_TTRef"), scaledFT0M, rho, weight); - spectra.fill(HIST("hScaledFT0C_DPhi_JetPt_Corr_TTRef"), scaledFT0C, dphi, jetPtCorr, weight); spectra.fill(HIST("hScaledFT0M_DPhi_JetPt_Corr_TTRef"), scaledFT0M, dphi, jetPtCorr, weight); @@ -450,6 +529,11 @@ struct RecoilJets { spectra.fill(HIST("hScaledFT0M_DPhi_JetPt_TTRef"), scaledFT0M, dphi, jetPt, weight); spectra.fill(HIST("hJetArea_JetPt_Rho_TTRef"), jetArea, jetPt, rho, weight); + if (phiTT > minPhiForTTSelection && phiTT < maxPhiForTTSelection) { + spectra.fill(HIST("hScaledFT0C_DPhi_JetPt_Corr_TTRef_RectrictedPhi"), scaledFT0C, dphi, jetPtCorr, weight); + spectra.fill(HIST("hScaledFT0M_DPhi_JetPt_Corr_TTRef_RectrictedPhi"), scaledFT0M, dphi, jetPtCorr, weight); + } + if (bRecoilJet) { spectra.fill(HIST("hScaledFT0C_Recoil_JetPt_Corr_TTRef"), scaledFT0C, jetPtCorr, weight); spectra.fill(HIST("hScaledFT0M_Recoil_JetPt_Corr_TTRef"), scaledFT0M, jetPtCorr, weight); @@ -470,21 +554,21 @@ struct RecoilJets { std::vector vPhiOfTT; double phiTT = 0.; int nTT = 0; - float pTHat = getPtHat(weight); float rho = collision.rho(); - spectra.fill(HIST("ptHat"), pTHat, weight); + float scaledFT0A = collision.multFT0A() / meanFT0APartLevel; + float scaledFT0C = collision.multFT0C() / meanFT0CPartLevel; + float scaledFT0M = 0.5 * (scaledFT0A + scaledFT0C); auto dice = rand->Rndm(); if (dice < fracSig) bSigEv = true; - for (const auto& jet : jets) { - if (jet.pt() > pTHatMax * pTHat) { - spectra.fill(HIST("hEventSelectionCountPartLevel"), 1.5); - return; - } - } + spectra.fill(HIST("hScaledFT0C_vertexZMC"), scaledFT0C, collision.posZ(), weight); + spectra.fill(HIST("hScaledFT0M_vertexZMC"), scaledFT0M, collision.posZ(), weight); + + spectra.fill(HIST("hScaledFT0C_Rho_Part"), scaledFT0C, rho, weight); + spectra.fill(HIST("hScaledFT0M_Rho_Part"), scaledFT0M, rho, weight); for (const auto& particle : particles) { auto pdgParticle = pdg->GetParticle(particle.pdgCode()); @@ -492,23 +576,23 @@ struct RecoilJets { continue; float particlePt = particle.pt(); + float particlePhi = particle.phi(); // Need charge and physical primary particles bool bParticleNeutral = (static_cast(pdgParticle->Charge()) == 0); if (bParticleNeutral || !particle.isPhysicalPrimary()) continue; - spectra.fill(HIST("hPartPtEtaPhi"), particlePt, particle.eta(), particle.phi(), weight); + spectra.fill(HIST("hScaledFT0CPartPtEtaPhi"), scaledFT0C, particlePt, particle.eta(), particlePhi, weight); + spectra.fill(HIST("hScaledFT0MPartPtEtaPhi"), scaledFT0M, particlePt, particle.eta(), particlePhi, weight); - if (bSigEv && - (particlePt > ptTTsigMin && particlePt < ptTTsigMax)) { - vPhiOfTT.push_back(particle.phi()); + if (bSigEv && (particlePt > ptTTsigMin && particlePt < ptTTsigMax)) { + vPhiOfTT.push_back(particlePhi); ++nTT; } - if (!bSigEv && - (particlePt > ptTTrefMin && particlePt < ptTTrefMax)) { - vPhiOfTT.push_back(particle.phi()); + if (!bSigEv && (particlePt > ptTTrefMin && particlePt < ptTTrefMax)) { + vPhiOfTT.push_back(particlePhi); ++nTT; } } @@ -518,11 +602,27 @@ struct RecoilJets { phiTT = getPhiTT(vPhiOfTT); if (bSigEv) { - spectra.fill(HIST("hNtrig_Part"), 1.5, weight); - spectra.fill(HIST("hTTSig_per_event_Part"), nTT, weight); + spectra.fill(HIST("hScaledFT0C_Ntrig_Part"), scaledFT0C, 1.5, weight); + spectra.fill(HIST("hScaledFT0M_Ntrig_Part"), scaledFT0M, 1.5, weight); + spectra.fill(HIST("hScaledFT0C_TTSig_per_event_Part"), scaledFT0C, nTT, weight); + spectra.fill(HIST("hScaledFT0M_TTSig_per_event_Part"), scaledFT0M, nTT, weight); + + spectra.fill(HIST("hScaledFT0C_TTSig_Part"), scaledFT0C, weight); + spectra.fill(HIST("hScaledFT0M_TTSig_Part"), scaledFT0M, weight); + + spectra.fill(HIST("hScaledFT0C_Rho_TTSig_Part"), scaledFT0C, rho, weight); + spectra.fill(HIST("hScaledFT0M_Rho_TTSig_Part"), scaledFT0M, rho, weight); } else { - spectra.fill(HIST("hNtrig_Part"), 0.5, weight); - spectra.fill(HIST("hTTRef_per_event_Part"), nTT, weight); + spectra.fill(HIST("hScaledFT0C_Ntrig_Part"), scaledFT0C, 0.5, weight); + spectra.fill(HIST("hScaledFT0M_Ntrig_Part"), scaledFT0M, 0.5, weight); + spectra.fill(HIST("hScaledFT0C_TTRef_per_event_Part"), scaledFT0C, nTT, weight); + spectra.fill(HIST("hScaledFT0M_TTRef_per_event_Part"), scaledFT0M, nTT, weight); + + spectra.fill(HIST("hScaledFT0C_TTRef_Part"), scaledFT0C, weight); + spectra.fill(HIST("hScaledFT0M_TTRef_Part"), scaledFT0M, weight); + + spectra.fill(HIST("hScaledFT0C_Rho_TTRef_Part"), scaledFT0C, rho, weight); + spectra.fill(HIST("hScaledFT0M_Rho_TTRef_Part"), scaledFT0M, rho, weight); } } @@ -538,25 +638,48 @@ struct RecoilJets { auto [dphi, bRecoilJet] = isRecoilJet(jet, phiTT); if (bSigEv) { + spectra.fill(HIST("hScaledFT0C_DPhi_JetPt_Corr_TTSig_Part"), scaledFT0C, dphi, jetPtCorr, weight); + spectra.fill(HIST("hScaledFT0M_DPhi_JetPt_Corr_TTSig_Part"), scaledFT0M, dphi, jetPtCorr, weight); + + spectra.fill(HIST("hScaledFT0C_DPhi_JetPt_TTSig_Part"), scaledFT0C, dphi, jetPt, weight); + spectra.fill(HIST("hScaledFT0M_DPhi_JetPt_TTSig_Part"), scaledFT0M, dphi, jetPt, weight); - spectra.fill(HIST("hDPhi_JetPt_Corr_TTSig_Part"), dphi, jetPtCorr, weight); - spectra.fill(HIST("hDPhi_JetPt_TTSig_Part"), dphi, jetPt, weight); spectra.fill(HIST("hJetArea_JetPt_Rho_TTSig_Part"), jetArea, jetPt, rho, weight); + if (phiTT > minPhiForTTSelection && phiTT < maxPhiForTTSelection) { + spectra.fill(HIST("hScaledFT0C_DPhi_JetPt_Corr_TTSig_RectrictedPhi_Part"), scaledFT0C, dphi, jetPtCorr, weight); + spectra.fill(HIST("hScaledFT0M_DPhi_JetPt_Corr_TTSig_RectrictedPhi_Part"), scaledFT0M, dphi, jetPtCorr, weight); + } + if (bRecoilJet) { - spectra.fill(HIST("hRecoil_JetPt_Corr_TTSig_Part"), jetPtCorr, weight); - spectra.fill(HIST("hRecoil_JetPt_TTSig_Part"), jetPt, weight); + spectra.fill(HIST("hScaledFT0C_Recoil_JetPt_Corr_TTSig_Part"), scaledFT0C, jetPtCorr, weight); + spectra.fill(HIST("hScaledFT0M_Recoil_JetPt_Corr_TTSig_Part"), scaledFT0M, jetPtCorr, weight); + + spectra.fill(HIST("hScaledFT0C_Recoil_JetPt_TTSig_Part"), scaledFT0C, jetPt, weight); + spectra.fill(HIST("hScaledFT0M_Recoil_JetPt_TTSig_Part"), scaledFT0M, jetPt, weight); } } else { - spectra.fill(HIST("hDPhi_JetPt_Corr_TTRef_Part"), dphi, jetPtCorr, weight); - spectra.fill(HIST("hDPhi_JetPt_TTRef_Part"), dphi, jetPt, weight); + spectra.fill(HIST("hScaledFT0C_DPhi_JetPt_Corr_TTRef_Part"), scaledFT0C, dphi, jetPtCorr, weight); + spectra.fill(HIST("hScaledFT0M_DPhi_JetPt_Corr_TTRef_Part"), scaledFT0M, dphi, jetPtCorr, weight); + + spectra.fill(HIST("hScaledFT0C_DPhi_JetPt_TTRef_Part"), scaledFT0C, dphi, jetPt, weight); + spectra.fill(HIST("hScaledFT0M_DPhi_JetPt_TTRef_Part"), scaledFT0M, dphi, jetPt, weight); + spectra.fill(HIST("hJetArea_JetPt_Rho_TTRef_Part"), jetArea, jetPt, rho, weight); + if (phiTT > minPhiForTTSelection && phiTT < maxPhiForTTSelection) { + spectra.fill(HIST("hScaledFT0C_DPhi_JetPt_Corr_TTRef_RectrictedPhi_Part"), scaledFT0C, dphi, jetPtCorr, weight); + spectra.fill(HIST("hScaledFT0M_DPhi_JetPt_Corr_TTRef_RectrictedPhi_Part"), scaledFT0M, dphi, jetPtCorr, weight); + } + if (bRecoilJet) { - spectra.fill(HIST("hRecoil_JetPt_Corr_TTRef_Part"), jetPtCorr, weight); - spectra.fill(HIST("hRecoil_JetPt_TTRef_Part"), jetPt, weight); + spectra.fill(HIST("hScaledFT0C_Recoil_JetPt_Corr_TTRef_Part"), scaledFT0C, jetPtCorr, weight); + spectra.fill(HIST("hScaledFT0M_Recoil_JetPt_Corr_TTRef_Part"), scaledFT0M, jetPtCorr, weight); + + spectra.fill(HIST("hScaledFT0C_Recoil_JetPt_TTRef_Part"), scaledFT0C, jetPt, weight); + spectra.fill(HIST("hScaledFT0M_Recoil_JetPt_TTRef_Part"), scaledFT0M, jetPt, weight); } } } @@ -570,12 +693,6 @@ struct RecoilJets { { std::vector vPhiOfTT; double phiTTSig = 0.; - float pTHat = getPtHat(weight); - - for (const auto& jetBase : jetsBase) { - if (jetBase.pt() > pTHatMax * pTHat) - return; - } for (const auto& track : tracks) { if (skipTrack(track)) @@ -599,8 +716,8 @@ struct RecoilJets { } template - void fillMultiplicityHistograms(Collision const& collision, - float weight = 1.) + void fillMultiplicityHistogramsOO(Collision const& collision, + float weight = 1.) { float multFT0A = collision.multFT0A(); float multFT0C = collision.multFT0C(); @@ -613,6 +730,10 @@ struct RecoilJets { float multZNC = collision.multZNC(); float multZNM = collision.multZNA() + collision.multZNC(); + float multZPA = collision.multZPA(); + float multZPC = collision.multZPC(); + float multZPM = collision.multZPA() + collision.multZPC(); + // Individual distributions spectra.fill(HIST("hMultFT0A"), multFT0A, weight); spectra.fill(HIST("hMultFT0C"), multFT0C, weight); @@ -626,7 +747,14 @@ struct RecoilJets { spectra.fill(HIST("hMultZNC"), multZNC, weight); spectra.fill(HIST("hMultZNM"), multZNM, weight); + spectra.fill(HIST("hMultZPA"), multZPA, weight); + spectra.fill(HIST("hMultZPC"), multZPC, weight); + spectra.fill(HIST("hMultZPM"), multZPM, weight); + // Correlations + spectra.fill(HIST("hZPA_vs_ZNA"), multZPA, multZNA, weight); + spectra.fill(HIST("hZPC_vs_ZNC"), multZPC, multZNC, weight); + spectra.fill(HIST("hMultFT0A_vs_ZNA"), multFT0A, multZNA, weight); spectra.fill(HIST("hMultFT0C_vs_ZNC"), multFT0C, multZNC, weight); spectra.fill(HIST("hMultFT0M_vs_ZNM"), multFT0M, multZNM, weight); @@ -634,7 +762,26 @@ struct RecoilJets { spectra.fill(HIST("hScaleMultFT0A_vs_ZNA"), scaledFT0A, multZNA, weight); spectra.fill(HIST("hScaleMultFT0C_vs_ZNC"), scaledFT0C, multZNC, weight); spectra.fill(HIST("hScaleMultFT0M_vs_ZNM"), scaledFT0M, multZNM, weight); + + spectra.fill(HIST("hScaleMultFT0A_vs_ZPA"), scaledFT0A, multZPA, weight); + spectra.fill(HIST("hScaleMultFT0C_vs_ZPC"), scaledFT0C, multZPC, weight); + spectra.fill(HIST("hScaleMultFT0M_vs_ZPM"), scaledFT0M, multZPM, weight); + spectra.fill(HIST("hScaleMultFT0M_vs_ZNA_vs_ZNC"), scaledFT0M, multZNA, multZNC, weight); + spectra.fill(HIST("hScaleMultFT0M_vs_ZPA_vs_ZPC"), scaledFT0M, multZPA, multZPC, weight); + } + + template + void fillMultiplicityHistogramsPartLevelMC(CollisionMC const& collision, + float weight = 1.) + { + spectra.fill(HIST("hMultFT0APartLevel"), collision.multFT0A(), weight); + spectra.fill(HIST("hMultFT0CPartLevel"), collision.multFT0C(), weight); + spectra.fill(HIST("hMultFT0MPartLevel"), collision.multFT0A() + collision.multFT0C(), weight); + + spectra.fill(HIST("hScaleMultFT0APartLevel"), collision.multFT0A() / meanFT0APartLevel, weight); + spectra.fill(HIST("hScaleMultFT0CPartLevel"), collision.multFT0C() / meanFT0CPartLevel, weight); + spectra.fill(HIST("hScaleMultFT0MPartLevel"), 0.5 * ((collision.multFT0A() / meanFT0APartLevel) + (collision.multFT0C() / meanFT0CPartLevel)), weight); } //------------------------------------------------------------------------------ @@ -647,28 +794,32 @@ struct RecoilJets { if (skipEvent(collision)) return; - spectra.fill(HIST("hEventSelectionCount"), 1.5); + spectra.fill(HIST("hEventSelectionCount"), 1.5); // number of events selected for analysis - spectra.fill(HIST("vertexZ"), collision.posZ()); + // spectra.fill(HIST("vertexZ"), collision.posZ()); fillHistograms(collision, jets, tracks); } - PROCESS_SWITCH(RecoilJets, processData, "process data", true); + PROCESS_SWITCH(RecoilJets, processData, "process raw data", true); void processMCDetLevel(FilteredColl const& collision, FilteredTracks const& tracks, FilteredJetsDetLevel const& jets) { spectra.fill(HIST("hEventSelectionCount"), 0.5); - if (skipEvent(collision) || skipMBGapEvent(collision)) + if (skipEvent(collision)) return; spectra.fill(HIST("hEventSelectionCount"), 1.5); - spectra.fill(HIST("vertexZ"), collision.posZ()); + if (skipMBGapEvent(collision)) { + spectra.fill(HIST("hEventSelectionCount"), 2.5); + return; + } + + spectra.fill(HIST("hEventSelectionCount"), 5.5); // number of events selected for analysis fillHistograms(collision, jets, tracks); } - PROCESS_SWITCH(RecoilJets, processMCDetLevel, "process MC detector level", - false); + PROCESS_SWITCH(RecoilJets, processMCDetLevel, "process MC detector level data (no weight)", false); void processMCDetLevelWeighted(FilteredCollDetLevelGetWeight const& collision, aod::JetMcCollisions const&, @@ -676,37 +827,47 @@ struct RecoilJets { FilteredJetsDetLevel const& jets) { spectra.fill(HIST("hEventSelectionCount"), 0.5); - if (skipEvent(collision) || skipMBGapEvent(collision)) + if (skipEvent(collision)) return; spectra.fill(HIST("hEventSelectionCount"), 1.5); - auto weight = collision.mcCollision().weight(); - spectra.fill(HIST("vertexZ"), collision.posZ(), weight); + if (skipMBGapEvent(collision)) { + spectra.fill(HIST("hEventSelectionCount"), 2.5); + return; + } - if (collision.has_mcCollision()) { - spectra.fill(HIST("hHasAssocMcCollision"), 0.5, weight); - } else { - spectra.fill(HIST("hHasAssocMcCollision"), 1.5, weight); + if (collision.isOutlier()) { + spectra.fill(HIST("hEventSelectionCount"), 3.5); + return; } + if (!collision.has_mcCollision()) { + spectra.fill(HIST("hEventSelectionCount"), 4.5); + return; + } + + spectra.fill(HIST("hEventSelectionCount"), 5.5); // number of events selected for analysis + auto weight = collision.mcCollision().weight(); fillHistograms(collision, jets, tracks, weight); } - PROCESS_SWITCH(RecoilJets, processMCDetLevelWeighted, - "process MC detector level with event weight", false); + PROCESS_SWITCH(RecoilJets, processMCDetLevelWeighted, "process MC detector level data (weighted)", false); void processMCPartLevel(FilteredCollPartLevel const& collision, FilteredParticles const& particles, FilteredJetsPartLevel const& jets) { spectra.fill(HIST("hEventSelectionCountPartLevel"), 0.5); - if (skipMBGapEvent(collision)) + + if (skipMBGapEvent(collision)) { + spectra.fill(HIST("hEventSelectionCountPartLevel"), 1.5); return; + } - spectra.fill(HIST("vertexZMC"), collision.posZ()); + spectra.fill(HIST("hEventSelectionCountPartLevel"), 3.5); // number of events selected for analysis fillMCPHistograms(collision, jets, particles); } - PROCESS_SWITCH(RecoilJets, processMCPartLevel, "process MC particle level", + PROCESS_SWITCH(RecoilJets, processMCPartLevel, "process MC particle level data (no weight)", false); void processMCPartLevelWeighted(FilteredCollPartLevel const& collision, @@ -714,24 +875,24 @@ struct RecoilJets { FilteredJetsPartLevel const& jets) { spectra.fill(HIST("hEventSelectionCountPartLevel"), 0.5); - if (skipMBGapEvent(collision)) - return; - auto weight = collision.weight(); + if (skipMBGapEvent(collision)) { + spectra.fill(HIST("hEventSelectionCountPartLevel"), 1.5); + return; + } - auto calcPtHat = getPtHat(weight); - auto pThatFromFW = collision.ptHard(); - spectra.fill(HIST("hDiffInOutlierRemove"), calcPtHat - pThatFromFW); - if (collision.isOutlier()) - spectra.fill(HIST("hCountNumberOutliersFrameWork"), 0.5); + if (collision.isOutlier()) { + spectra.fill(HIST("hEventSelectionCountPartLevel"), 2.5); + return; + } - // LOG(debug) << "Difference between pT hat: " << calcPtHat - pThatFromFW; + spectra.fill(HIST("hEventSelectionCountPartLevel"), 3.5); // number of events selected for analysis - spectra.fill(HIST("vertexZMC"), collision.posZ(), weight); + auto weight = collision.weight(); + spectra.fill(HIST("ptHat"), collision.ptHard(), weight); fillMCPHistograms(collision, jets, particles, weight); } - PROCESS_SWITCH(RecoilJets, processMCPartLevelWeighted, - "process MC particle level with event weight", false); + PROCESS_SWITCH(RecoilJets, processMCPartLevelWeighted, "process MC particle level data (weighted)", false); void processJetsMatched(FilteredCollDetLevelGetWeight const& collision, aod::JetMcCollisions const&, @@ -739,16 +900,14 @@ struct RecoilJets { FilteredMatchedJetsDetLevel const& mcdjets, FilteredMatchedJetsPartLevel const& mcpjets) { - if (skipEvent(collision) || skipMBGapEvent(collision)) + if (skipEvent(collision) || skipMBGapEvent(collision) || collision.isOutlier()) return; - auto mcpjetsPerMCCollision = - mcpjets.sliceBy(partJetsPerCollision, collision.mcCollisionId()); + auto mcpjetsPerMCCollision = mcpjets.sliceBy(partJetsPerCollision, collision.mcCollisionId()); fillMatchedHistograms(tracks, mcpjetsPerMCCollision, mcdjets); } - PROCESS_SWITCH(RecoilJets, processJetsMatched, - "process matching of MC jets (no weight)", false); + PROCESS_SWITCH(RecoilJets, processJetsMatched, "process matching of MC jets (no weight)", false); void processJetsMatchedWeighted(FilteredCollDetLevelGetWeight const& collision, aod::JetMcCollisions const&, @@ -756,26 +915,54 @@ struct RecoilJets { FilteredMatchedJetsDetLevel const& mcdjets, FilteredMatchedJetsPartLevel const& mcpjets) { - if (skipEvent(collision) || skipMBGapEvent(collision)) + if (skipEvent(collision) || skipMBGapEvent(collision) || collision.isOutlier()) return; - auto mcpjetsPerMCCollision = - mcpjets.sliceBy(partJetsPerCollision, collision.mcCollisionId()); + auto mcpjetsPerMCCollision = mcpjets.sliceBy(partJetsPerCollision, collision.mcCollisionId()); auto weight = collision.mcCollision().weight(); fillMatchedHistograms(tracks, mcpjetsPerMCCollision, mcdjets, weight); } - PROCESS_SWITCH(RecoilJets, processJetsMatchedWeighted, - "process matching of MC jets (weighted)", false); + PROCESS_SWITCH(RecoilJets, processJetsMatchedWeighted, "process matching of MC jets (weighted)", false); - void processMultiplicity(FilteredEventMultiplicity const& collision) + //------------------------------------------------------------------------------ + void processMultiplicityOO(FilteredEventMultiplicity const& collision) { if (skipEvent(collision)) return; - fillMultiplicityHistograms(collision); + fillMultiplicityHistogramsOO(collision); + } + PROCESS_SWITCH(RecoilJets, processMultiplicityOO, "process multiplicity for OO collisions and MC detector level (no weight)", false); + + void processMultiplicityMCDetLevelWeightedOO(FilteredEventMultiplicityDetLevelGetWeight const& collision) + { + if (skipEvent(collision) || collision.isOutlier() || !collision.has_mcCollision()) + return; + + auto weight = collision.mcCollision().weight(); + fillMultiplicityHistogramsOO(collision, weight); + } + PROCESS_SWITCH(RecoilJets, processMultiplicityMCDetLevelWeightedOO, "process multiplicity for MC detector level OO collisions (weighted)", false); + + void processMultiplicityPartLevelMC(FilteredEventMultiplicityPartLevel const& collision) + { + if (skipMBGapEvent(collision)) + return; + + fillMultiplicityHistogramsPartLevelMC(collision); } - PROCESS_SWITCH(RecoilJets, processMultiplicity, "process multiplicity", false); + PROCESS_SWITCH(RecoilJets, processMultiplicityPartLevelMC, "process multiplicity for MC particle level events (no weight)", false); + + void processMultiplicityPartLevelMCWeighted(FilteredEventMultiplicityPartLevel const& collision) + { + if (skipMBGapEvent(collision) || collision.isOutlier()) + return; + + auto weight = collision.weight(); + fillMultiplicityHistogramsPartLevelMC(collision, weight); + } + PROCESS_SWITCH(RecoilJets, processMultiplicityPartLevelMCWeighted, "process multiplicity for MC particle level events (weighted)", false); //------------------------------------------------------------------------------ // Auxiliary functions @@ -811,11 +998,6 @@ struct RecoilJets { return vPhiOfTT[iTrig]; } - float getPtHat(float weight) - { - return 10. / (std::pow(weight, 1.0 / pTHatExponent)); - } - float getScaledFT0A(const float multFT0A) { return multFT0A / meanFT0A; From 26a10b05aef9246ebf512ecc4d75a68e69a1d032 Mon Sep 17 00:00:00 2001 From: arvindkhuntia <31609955+arvindkhuntia@users.noreply.github.com> Date: Tue, 23 Sep 2025 16:44:00 +0200 Subject: [PATCH 506/986] [PWGJE] Histograms added for MC and rapidity selection for rec particle (#13033) Co-authored-by: Arvind Khuntia --- PWGJE/Tasks/nucleiInJets.cxx | 87 ++++++++++++++++++++++++++++++++---- 1 file changed, 79 insertions(+), 8 deletions(-) diff --git a/PWGJE/Tasks/nucleiInJets.cxx b/PWGJE/Tasks/nucleiInJets.cxx index 37fb0764947..e60839c00f0 100644 --- a/PWGJE/Tasks/nucleiInJets.cxx +++ b/PWGJE/Tasks/nucleiInJets.cxx @@ -38,6 +38,7 @@ #include #include +#include "TDatabasePDG.h" #include #include #include @@ -495,6 +496,9 @@ struct nucleiInJets { jetHist.add("recInc/pt/PtParticleTypeTPCTOF", "Pt vs ParticleType vs Centrality (TPC+TOF)", HistType::kTH3F, {{100, 0.f, 10.f}, {14, -7, 7}, {100, 0, 100}}); jetHist.add("recInc/pt/PtParticleTypeTPCTOFVeto", "Pt vs ParticleType vs Centrality (TPC+TOF Veto)", HistType::kTH3F, {{100, 0.f, 10.f}, {14, -7, 7}, {100, 0, 100}}); jetHist.add("genInc/pt/PtParticleType", "Pt vs ParticleType vs Centrality (gen)", HistType::kTH3F, {{100, 0.f, 10.f}, {14, -7, 7}, {100, 0, 100}}); + + jetHist.add("recInc/eff/tpcTrack3D", "Pt vs ParticleType vs Centrality (tpc)", HistType::kTH3F, {{100, 0.f, 10.f}, {14, -7, 7}, {100, 0, 100}}); + jetHist.add("recInc/eff/tpcTofTrack3D", "Pt vs ParticleType vs Centrality (tpc-tof)", HistType::kTH3F, {{100, 0.f, 10.f}, {14, -7, 7}, {100, 0, 100}}); // inside jet jetHist.add("tracks/mc/proton/h3PtVsProtonNSigmaTPCVsPtJet_jet", "pT(p) vs NSigmaTPC (p) vs jet pT; #it{p}_{T} (GeV/#it{c}; NSigmaTPC; p^{jet}_{T}", HistType::kTH3F, {{PtAxis}, {200, -10, 10}, {PtJetAxis}}); jetHist.add("tracks/mc/antiProton/h3PtVsantiProtonNSigmaTPCVsPtJet_jet", "pT(#bar{p}) vs NSigmaTPC (#bar{p}) vs jet pT; #it{p}_{T} (GeV/#it{c}; NSigmaTPC; p^{jet}_{T}", HistType::kTH3F, {{PtAxis}, {200, -10, 10}, {PtJetAxis}}); @@ -1981,6 +1985,7 @@ struct nucleiInJets { centrality = -999; } jetHist.fill(HIST("recInc/vertexZ"), coll.posZ(), centrality); + for (const auto& track : tracks) { if (!isTrackSelected(track)) { continue; @@ -1989,20 +1994,85 @@ struct nucleiInJets { continue; if (std::fabs(track.eta()) > cfgtrkMaxEta) continue; + auto mcTrack = track.mcParticle_as(); if (!mcTrack.isPhysicalPrimary()) continue; - bool isTOFAndTPCPreSel(track.hasTOF() && - (std::abs(track.tpcNSigmaPr()) < cfgnTPCPIDPrTOF || std::abs(track.tpcNSigmaDe()) < cfgnTPCPIDDeTOF)); - if (mapPDGToValue(mcTrack.pdgCode()) != 0) { - jetHist.fill(HIST("recInc/pt/PtParticleTypeTPC"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); + auto mass = TDatabasePDG::Instance()->GetParticle(abs(mcTrack.pdgCode()))->Mass(); + auto rapidity = RecoDecay::y(std::array{track.px(), track.py(), track.pz()}, mass); - if (isTOFAndTPCPreSel) { + if (rapidity > cfgtrkMaxRap) + continue; + // Proton + if (std::abs(mcTrack.pdgCode()) == 2212) { // Proton + jetHist.fill(HIST("recInc/eff/tpcTrack3D"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); + if (track.hasTOF()) + jetHist.fill(HIST("recInc/eff/tpcTofTrack3D"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); + if (std::abs(track.tpcNSigmaPr()) < cfgnTPCPIDPr) { + jetHist.fill(HIST("recInc/pt/PtParticleTypeTPC"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); + } + } + // Deuteron + if (std::abs(mcTrack.pdgCode()) == Pdg::kDeuteron) { // Deuteron + jetHist.fill(HIST("recInc/eff/tpcTrack3D"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); + if (track.hasTOF()) + jetHist.fill(HIST("recInc/eff/tpcTofTrack3D"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); + if (std::abs(track.tpcNSigmaDe()) < cfgnTPCPIDDe) { + jetHist.fill(HIST("recInc/pt/PtParticleTypeTPC"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); + } + } + // Helium + if (std::abs(mcTrack.pdgCode()) == Pdg::kHelium3) { // Helium-3 + jetHist.fill(HIST("recInc/eff/tpcTrack3D"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); + if (track.hasTOF()) + jetHist.fill(HIST("recInc/eff/tpcTofTrack3D"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); + if (std::abs(track.tpcNSigmaHe()) < cfgnTPCPIDHe) { + jetHist.fill(HIST("recInc/pt/PtParticleTypeTPC"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); + } + } + + // TPCTOF and TPCTOFVeto histograms + // Proton + if (std::abs(track.tpcNSigmaPr()) < cfgnTPCPIDPr && track.hasTOF()) { + if (std::abs(mcTrack.pdgCode()) == 2212) { jetHist.fill(HIST("recInc/pt/PtParticleTypeTPCTOF"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); - jetHist.fill(HIST("recInc/pt/PtParticleTypeTPCTOFVeto"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); - } else { - jetHist.fill(HIST("recInc/pt/PtParticleTypeTPCTOFVeto"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); + if (std::abs(track.tofNSigmaPr()) < cfgnTPCPIDPrTOF) + jetHist.fill(HIST("recInc/pt/PtParticleTypeTPCTOFVeto"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); + } + } else { + if (std::abs(track.tpcNSigmaPr()) < cfgnTPCPIDPr) { + if (std::abs(mcTrack.pdgCode()) == 2212) { + jetHist.fill(HIST("recInc/pt/PtParticleTypeTPCTOFVeto"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); + } + } + } + // Deuteron + if (std::abs(track.tpcNSigmaDe()) < cfgnTPCPIDDe && track.hasTOF()) { + if (std::abs(mcTrack.pdgCode()) == Pdg::kDeuteron) { + jetHist.fill(HIST("recInc/pt/PtParticleTypeTPCTOF"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); + if (std::abs(track.tofNSigmaDe()) < cfgnTPCPIDDeTOF) + jetHist.fill(HIST("recInc/pt/PtParticleTypeTPCTOFVeto"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); + } + } else { + if (std::abs(track.tpcNSigmaDe()) < cfgnTPCPIDDe) { + if (std::abs(mcTrack.pdgCode()) == Pdg::kDeuteron) { + jetHist.fill(HIST("recInc/pt/PtParticleTypeTPCTOFVeto"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); + } + } + } + // Helium + if (std::abs(track.tpcNSigmaHe()) < cfgnTPCPIDHe && track.hasTOF()) { + if (std::abs(mcTrack.pdgCode()) == Pdg::kHelium3) { + jetHist.fill(HIST("recInc/pt/PtParticleTypeTPCTOF"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); + if (std::abs(track.tofNSigmaHe()) < cfgnTPCPIDHeTOF) + jetHist.fill(HIST("recInc/pt/PtParticleTypeTPCTOFVeto"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); + } + } else { + if (std::abs(track.tpcNSigmaHe()) < cfgnTPCPIDHe) { + if (std::abs(mcTrack.pdgCode()) == Pdg::kHelium3) { + jetHist.fill(HIST("recInc/pt/PtParticleTypeTPCTOFVeto"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); + } } } } // track @@ -2016,6 +2086,7 @@ struct nucleiInJets { continue; if (std::fabs(mcParticle.y()) > cfgtrkMaxRap) continue; + if (mapPDGToValue(mcParticle.pdgCode()) != 0) { jetHist.fill(HIST("genInc/pt/PtParticleType"), mcParticle.pt(), mapPDGToValue(mcParticle.pdgCode()), centrality); } From fbeb0628124907df91830b084f0094991d8c61b7 Mon Sep 17 00:00:00 2001 From: choich08365 <157435123+choich08365@users.noreply.github.com> Date: Tue, 23 Sep 2025 23:44:17 +0900 Subject: [PATCH 507/986] [PWGJE] Updated GNN b-jet MCP jet selection (#13029) Co-authored-by: Changhwan Choi Co-authored-by: ALICE Action Bot --- PWGJE/TableProducer/jetTaggerHF.cxx | 58 +++-- PWGJE/Tasks/bjetTaggingGnn.cxx | 333 ++++++++++++++++++++++++---- 2 files changed, 332 insertions(+), 59 deletions(-) diff --git a/PWGJE/TableProducer/jetTaggerHF.cxx b/PWGJE/TableProducer/jetTaggerHF.cxx index 6e336d9516b..70d88de3e45 100644 --- a/PWGJE/TableProducer/jetTaggerHF.cxx +++ b/PWGJE/TableProducer/jetTaggerHF.cxx @@ -119,6 +119,9 @@ struct JetTaggerHFTask { Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; // GNN configuration + Configurable jetpTMin{"jetpTMin", 5., "minimum jet pT"}; + Configurable dbMin{"dbMin", -10., "minimum GNN Db"}; + Configurable dbMax{"dbMax", 20., "maximum GNN Db"}; Configurable fC{"fC", 0.018, "Parameter f_c for D_b calculation"}; Configurable nJetFeat{"nJetFeat", 4, "Number of jet GNN input features"}; Configurable nTrkFeat{"nTrkFeat", 13, "Number of track GNN input features"}; @@ -273,23 +276,37 @@ struct JetTaggerHFTask { } } if (doprocessAlgorithmGNN) { - if constexpr (isMC) { - switch (origin) { - case 2: - registry.fill(HIST("h_db_b"), scoreML[jet.globalIndex()]); - break; - case 1: - registry.fill(HIST("h_db_c"), scoreML[jet.globalIndex()]); - break; - case 0: - case 3: - registry.fill(HIST("h_db_lf"), scoreML[jet.globalIndex()]); - break; - default: - LOGF(debug, "doprocessAlgorithmGNN, Unexpected origin value: %d (%d)", origin, jet.globalIndex()); + float dbRange; + if (jet.pt() >= jetpTMin) { + if (scoreML[jet.globalIndex()] < dbMin) { + dbRange = 0.5; // underflow + } else if (scoreML[jet.globalIndex()] >= dbMax) { + dbRange = 2.5; // overflow + } else { + dbRange = 1.5; // in range + } + registry.fill(HIST("h2_count_db"), 3.5, dbRange); // incl jet + if constexpr (isMC) { + switch (origin) { + case 2: + registry.fill(HIST("h_db_b"), scoreML[jet.globalIndex()]); + registry.fill(HIST("h2_count_db"), 0.5, dbRange); // b-jet + break; + case 1: + registry.fill(HIST("h_db_c"), scoreML[jet.globalIndex()]); + registry.fill(HIST("h2_count_db"), 1.5, dbRange); // c-jet + break; + case 0: + case 3: + registry.fill(HIST("h_db_lf"), scoreML[jet.globalIndex()]); + registry.fill(HIST("h2_count_db"), 2.5, dbRange); // lf-jet + break; + default: + LOGF(debug, "doprocessAlgorithmGNN, Unexpected origin value: %d (%d)", origin, jet.globalIndex()); + } } + registry.fill(HIST("h2_pt_db"), jet.pt(), scoreML[jet.globalIndex()]); } - registry.fill(HIST("h2_pt_db"), jet.pt(), scoreML[jet.globalIndex()]); } taggingTable(decisionNonML[jet.globalIndex()], jetProb, scoreML[jet.globalIndex()]); } @@ -508,6 +525,17 @@ struct JetTaggerHFTask { if (doprocessAlgorithmGNN) { tensorAlloc = o2::analysis::GNNBjetAllocator(nJetFeat.value, nTrkFeat.value, nClassesMl.value, nTrkOrigin.value, transformFeatureJetMean.value, transformFeatureJetStdev.value, transformFeatureTrkMean.value, transformFeatureTrkStdev.value, nJetConst); + + registry.add("h2_count_db", "#it{D}_{b} underflow/overflow;Jet flavour;#it{D}_{b} range", {HistType::kTH2F, {{4, 0., 4.}, {3, 0., 3.}}}); + auto h2CountDb = registry.get(HIST("h2_count_db")); + h2CountDb->GetXaxis()->SetBinLabel(1, "b-jet"); + h2CountDb->GetXaxis()->SetBinLabel(2, "c-jet"); + h2CountDb->GetXaxis()->SetBinLabel(3, "lf-jet"); + h2CountDb->GetXaxis()->SetBinLabel(4, "incl jet"); + h2CountDb->GetYaxis()->SetBinLabel(1, "underflow"); + h2CountDb->GetYaxis()->SetBinLabel(2, "in range"); + h2CountDb->GetYaxis()->SetBinLabel(3, "overflow"); + registry.add("h_db_b", "#it{D}_{b} b-jet;#it{D}_{b}", {HistType::kTH1F, {{50, -10., 35.}}}); registry.add("h_db_c", "#it{D}_{b} c-jet;#it{D}_{b}", {HistType::kTH1F, {{50, -10., 35.}}}); registry.add("h_db_lf", "#it{D}_{b} lf-jet;#it{D}_{b}", {HistType::kTH1F, {{50, -10., 35.}}}); diff --git a/PWGJE/Tasks/bjetTaggingGnn.cxx b/PWGJE/Tasks/bjetTaggingGnn.cxx index 4e206c43027..a71c0d7f75b 100644 --- a/PWGJE/Tasks/bjetTaggingGnn.cxx +++ b/PWGJE/Tasks/bjetTaggingGnn.cxx @@ -83,6 +83,7 @@ struct BjetTaggingGnn { Configurable trainingDatasetRatioParam{"trainingDatasetRatioParam", 0, "Parameter for splitting training/evaluation datasets by collisionId"}; std::vector eventSelectionBits; + std::vector eventSelectionBitsSel; std::vector jetRadiiValues; @@ -91,8 +92,30 @@ struct BjetTaggingGnn { jetRadiiValues = (std::vector)jetRadii; eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(static_cast(eventSelections)); + eventSelectionBitsSel = jetderiveddatautilities::initialiseEventSelectionBits("sel8"); registry.add("h_vertexZ", "Vertex Z;#it{Z} (cm)", {HistType::kTH1F, {{100, -20.0, 20.0}}}, callSumw2); + // registry.add("h_vertexZ_truth", "Vertex Z truth;#it{Z} (cm)", {HistType::kTH1F, {{100, -20.0, 20.0}}}, callSumw2); + registry.add("h_event_counter", ";Event counter", {HistType::kTH1F, {{6, 0.0, 6.0}}}, callSumw2); + auto hEventCounter = registry.get(HIST("h_event_counter")); + hEventCounter->GetXaxis()->SetBinLabel(1, "Coll+TVX"); + hEventCounter->GetXaxis()->SetBinLabel(2, "Coll+TVX+Sel8"); + hEventCounter->GetXaxis()->SetBinLabel(3, "Coll+TVX+Sel8+"); + hEventCounter->GetXaxis()->SetBinLabel(4, "McColl(INEL)"); + hEventCounter->GetXaxis()->SetBinLabel(5, "McColl(-> Coll+TVX+Sel8)"); + hEventCounter->GetXaxis()->SetBinLabel(6, "McColl(-> Coll+TVX+Sel8+)"); + registry.add("hBCCounter", "", {HistType::kTH1F, {{10, 0.0, 10.}}}, callSumw2); + auto hBCCounter = registry.get(HIST("hBCCounter")); + hBCCounter->GetXaxis()->SetBinLabel(1, "AllBC"); + hBCCounter->GetXaxis()->SetBinLabel(2, "BC+TVX"); + hBCCounter->GetXaxis()->SetBinLabel(3, "BC+TVX+NoTFB"); + hBCCounter->GetXaxis()->SetBinLabel(4, "BC+TVX+NoTFB+NoITSROFB"); + hBCCounter->GetXaxis()->SetBinLabel(5, "CollinBC"); + hBCCounter->GetXaxis()->SetBinLabel(6, "CollinBC+Sel8"); + hBCCounter->GetXaxis()->SetBinLabel(7, "CollinBC+Sel8+VtxZ"); + hBCCounter->GetXaxis()->SetBinLabel(8, "CollinBC+Sel8Full"); + hBCCounter->GetXaxis()->SetBinLabel(9, "CollinBC+Sel8Full+GoodZvtx"); + hBCCounter->GetXaxis()->SetBinLabel(10, "CollinBC+Sel8Full+VtxZ+GoodZvtx"); const AxisSpec axisJetpT{200, 0., 200., "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec axisDb{200, dbMin, dbMax, "#it{D}_{b}"}; @@ -108,6 +131,11 @@ struct BjetTaggingGnn { registry.add("h_Db", "", {HistType::kTH1F, {axisDbFine}}); registry.add("h2_jetpT_Db", "", {HistType::kTH2F, {axisJetpT, axisDb}}); + if (doprocessDataJetsSel || doprocessMCJetsSel) { + registry.add("h_jetpT_sel", "", {HistType::kTH1F, {axisJetpT}}, callSumw2); + registry.add("h_jetpT_tvx", "", {HistType::kTH1F, {axisJetpT}}, callSumw2); + } + if (doprocessMCJets) { registry.add("h_jetpT_b", "b-jet", {HistType::kTH1F, {axisJetpT}}, callSumw2); registry.add("h_jetpT_c", "c-jet", {HistType::kTH1F, {axisJetpT}}, callSumw2); @@ -122,8 +150,8 @@ struct BjetTaggingGnn { registry.add("h2_Response_DetjetpT_PartjetpT_b", "b-jet", {HistType::kTH2F, {axisJetpT, axisJetpT}}, callSumw2); registry.add("h2_Response_DetjetpT_PartjetpT_c", "c-jet", {HistType::kTH2F, {axisJetpT, axisJetpT}}, callSumw2); registry.add("h2_Response_DetjetpT_PartjetpT_lf", "lf-jet", {HistType::kTH2F, {axisJetpT, axisJetpT}, callSumw2}); - registry.add("h2_jetpT_Db_lf_none", "lf-jet (none)", {HistType::kTH2F, {axisJetpT, axisDb}}); - registry.add("h2_jetpT_Db_lf_matched", "lf-jet (matched)", {HistType::kTH2F, {axisJetpT, axisDb}}); + registry.add("h2_jetpT_Db_lf_none", "lf-jet (none)", {HistType::kTH2F, {axisJetpT, axisDb}}, callSumw2); + registry.add("h2_jetpT_Db_lf_matched", "lf-jet (matched)", {HistType::kTH2F, {axisJetpT, axisDb}}, callSumw2); registry.add("h2_jetpT_Db_npp", "NotPhysPrim", {HistType::kTH2F, {axisJetpT, axisDb}}); registry.add("h2_jetpT_Db_npp_b", "NotPhysPrim b-jet", {HistType::kTH2F, {axisJetpT, axisDb}}); registry.add("h2_jetpT_Db_npp_c", "NotPhysPrim c-jet", {HistType::kTH2F, {axisJetpT, axisDb}}); @@ -134,11 +162,24 @@ struct BjetTaggingGnn { registry.add("h_Db_npp_lf", "NotPhysPrim lf-jet", {HistType::kTH1F, {axisDbFine}}); } + if (doprocessMCJetsSel) { + registry.add("h_jetpT_b_sel", "b-jet", {HistType::kTH1F, {axisJetpT}}, callSumw2); + registry.add("h2_Response_DetjetpT_PartjetpT_sel", "", {HistType::kTH2F, {axisJetpT, axisJetpT}}, callSumw2); + registry.add("h2_Response_DetjetpT_PartjetpT_b_sel", "b-jet", {HistType::kTH2F, {axisJetpT, axisJetpT}}, callSumw2); + registry.add("h_jetpT_b_tvx", "b-jet", {HistType::kTH1F, {axisJetpT}}, callSumw2); + registry.add("h2_Response_DetjetpT_PartjetpT_tvx", "", {HistType::kTH2F, {axisJetpT, axisJetpT}}, callSumw2); + registry.add("h2_Response_DetjetpT_PartjetpT_b_tvx", "b-jet", {HistType::kTH2F, {axisJetpT, axisJetpT}}, callSumw2); + } + if (doprocessMCTruthJets) { registry.add("h_jetpT_particle", "", {HistType::kTH1F, {axisJetpT}}, callSumw2); registry.add("h_jetpT_particle_b", "particle b-jet", {HistType::kTH1F, {axisJetpT}}, callSumw2); registry.add("h_jetpT_particle_c", "particle c-jet", {HistType::kTH1F, {axisJetpT}}, callSumw2); registry.add("h_jetpT_particle_lf", "particle lf-jet", {HistType::kTH1F, {axisJetpT}}, callSumw2); + registry.add("h_jetpT_particle_sel", "", {HistType::kTH1F, {axisJetpT}}, callSumw2); + registry.add("h_jetpT_particle_b_sel", "particle b-jet", {HistType::kTH1F, {axisJetpT}}, callSumw2); + registry.add("h_jetpT_particle_tvx", "", {HistType::kTH1F, {axisJetpT}}, callSumw2); + registry.add("h_jetpT_particle_b_tvx", "particle b-jet", {HistType::kTH1F, {axisJetpT}}, callSumw2); } if (doDataDriven) { @@ -154,13 +195,23 @@ struct BjetTaggingGnn { } Filter collisionFilter = nabs(aod::jcollision::posZ) < vertexZCut; - Filter trackCuts = (aod::jtrack::pt > trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax); + Filter trackFilter = (aod::jtrack::pt > trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax); Filter jetFilter = (aod::jet::pt >= jetPtMin && aod::jet::pt <= jetPtMax && aod::jet::eta < jetEtaMax - aod::jet::r / 100.f && aod::jet::eta > jetEtaMin + aod::jet::r / 100.f); - using FilteredCollision = soa::Filtered>; - using DataJets = soa::Filtered>; + using AnalysisCollisions = soa::Join; + using FilteredCollisions = soa::Filtered; + using DataJets = soa::Join; + using FilteredDataJets = soa::Filtered; using JetTrackswID = soa::Filtered>; + + using MCDJets = soa::Join; + using FilteredMCDJets = soa::Filtered; using JetTracksMCDwID = soa::Filtered>; + + using AnalysisCollisionsMCD = soa::Join; + using FilteredCollisionsMCD = soa::Filtered; + using MCPJets = soa::Join; + using SVTable = aod::DataSecondaryVertex3Prongs; using MCDSVTable = aod::MCDSecondaryVertex3Prongs; @@ -209,16 +260,17 @@ struct BjetTaggingGnn { return *allSVs.begin(); } - void processDummy(FilteredCollision::iterator const& /*collision*/) + void processDummy(FilteredCollisions::iterator const& /*collision*/) { } PROCESS_SWITCH(BjetTaggingGnn, processDummy, "Dummy process function turned on by default", true); - void processDataJets(FilteredCollision::iterator const& collision, DataJets const& alljets, JetTrackswID const& allTracks, SVTable const& allSVs) + void processDataJets(FilteredCollisions::iterator const& collision, FilteredDataJets const& alljets, JetTrackswID const& allTracks, SVTable const& allSVs) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { return; } + registry.fill(HIST("h_event_counter"), 2.5); // Coll+TVX+Sel8+... registry.fill(HIST("h_vertexZ"), collision.posZ()); @@ -239,17 +291,12 @@ struct BjetTaggingGnn { int nTracks = analyzeJetTrackInfo(collision, analysisJet, allTracks); float mSV = -1.f; - // float eSV = -1.f; - // float slXY = -1.f; bool checkSV; - // auto sv = jettaggingutilities::jetFromProngMaxDecayLength(analysisJet, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyMax, prongIPxyMin, prongIPxyMax, false, &checkSV); auto sv = analyzeJetSVInfo(analysisJet, allSVs, checkSV); if (checkSV) { mSV = sv.m(); - // eSV = sv.e(); - // slXY = sv.decayLengthXY() / sv.errorDecayLengthXY(); } registry.fill(HIST("h_jetpT"), analysisJet.pt()); @@ -263,22 +310,64 @@ struct BjetTaggingGnn { } PROCESS_SWITCH(BjetTaggingGnn, processDataJets, "jet information in Data", false); - using MCDJetTable = soa::Filtered>; - using MCPJetTable = soa::Filtered>; - using FilteredCollisionMCD = soa::Filtered>; + void processDataJetsSel(AnalysisCollisions::iterator const& collision, FilteredDataJets const& alljets) + { + registry.fill(HIST("h_event_counter"), 0.5); // Coll+TVX + + for (const auto& analysisJet : alljets) { + + bool jetIncluded = false; + for (const auto& jetR : jetRadiiValues) { + if (analysisJet.r() == static_cast(jetR * 100)) { + jetIncluded = true; + break; + } + } + + if (!jetIncluded) { + continue; + } + + registry.fill(HIST("h_jetpT_tvx"), analysisJet.pt()); + } + + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBitsSel)) { + return; + } + registry.fill(HIST("h_event_counter"), 1.5); // Coll+TVX+Sel8 + + for (const auto& analysisJet : alljets) { - void processMCJets(FilteredCollisionMCD::iterator const& collision, MCDJetTable const& MCDjets, MCPJetTable const& /*MCPjets*/, JetTracksMCDwID const& /*allTracks*/, MCDSVTable const& allSVs, aod::JetParticles const& /*MCParticles*/) + bool jetIncluded = false; + for (const auto& jetR : jetRadiiValues) { + if (analysisJet.r() == static_cast(jetR * 100)) { + jetIncluded = true; + break; + } + } + + if (!jetIncluded) { + continue; + } + + registry.fill(HIST("h_jetpT_sel"), analysisJet.pt()); + } + } + PROCESS_SWITCH(BjetTaggingGnn, processDataJetsSel, "jet information in Data (sel8)", false); + + void processMCJets(FilteredCollisionsMCD::iterator const& collision, FilteredMCDJets const& MCDjets, MCPJets const& /*MCPjets*/, JetTracksMCDwID const& /*allTracks*/, MCDSVTable const& allSVs, aod::JetParticles const& /*MCParticles*/) { + float weightEvt = useEventWeight ? collision.weight() : 1.f; if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { return; } - // Uses only collisionId % trainingDatasetRaioParam != 0 for evaluation dataset if (trainingDatasetRatioParam && collision.collisionId() % trainingDatasetRatioParam == 0) { return; } + registry.fill(HIST("h_event_counter"), 2.5, weightEvt); - registry.fill(HIST("h_vertexZ"), collision.posZ(), useEventWeight ? collision.weight() : 1.f); + registry.fill(HIST("h_vertexZ"), collision.posZ(), weightEvt); for (const auto& analysisJet : MCDjets) { @@ -295,6 +384,7 @@ struct BjetTaggingGnn { } float weight = useEventWeight ? analysisJet.eventWeight() : 1.f; + float pTHat = 10. / (std::pow(analysisJet.eventWeight(), 1.0 / pTHatExponent)); if (analysisJet.pt() > pTHatMaxMCD * pTHat) { continue; @@ -311,27 +401,18 @@ struct BjetTaggingGnn { continue; } if (!constituent.has_mcParticle() || !constituent.template mcParticle_as().isPhysicalPrimary()) { - // registry.fill(HIST("h2_pT_dcaXY_npp"), constituent.pt(), constituent.dcaXY()); - // registry.fill(HIST("h2_pT_dcaZ_npp"), constituent.pt(), constituent.dcaZ()); ++nNppTracks; - } else { - // registry.fill(HIST("h2_pT_dcaXY_pp"), constituent.pt(), constituent.dcaXY()); - // registry.fill(HIST("h2_pT_dcaZ_pp"), constituent.pt(), constituent.dcaZ()); } ++nTracks; } float mSV = -1.f; - // float eSV = -1.f; - // float slXY = -1.f; bool checkSV; auto sv = analyzeJetSVInfo(analysisJet, allSVs, checkSV /*, jetFlavor, weight*/); if (checkSV) { mSV = sv.m(); - // eSV = sv.e(); - // slXY = sv.decayLengthXY() / sv.errorDecayLengthXY(); } registry.fill(HIST("h_jetpT"), analysisJet.pt(), weight); @@ -388,7 +469,7 @@ struct BjetTaggingGnn { } } - for (const auto& mcpjet : analysisJet.template matchedJetGeo_as()) { + for (const auto& mcpjet : analysisJet.template matchedJetGeo_as()) { if (mcpjet.pt() > pTHatMaxMCP * pTHat) { continue; } @@ -406,17 +487,16 @@ struct BjetTaggingGnn { } PROCESS_SWITCH(BjetTaggingGnn, processMCJets, "jet information in MC", false); - Filter mccollisionFilter = nabs(aod::jmccollision::posZ) < vertexZCut; - using FilteredCollisionMCP = soa::Filtered; - - void processMCTruthJets(FilteredCollisionMCP::iterator const& /*collision*/, MCPJetTable const& MCPjets, aod::JetParticles const& /*MCParticles*/) + void processMCJetsSel(AnalysisCollisionsMCD::iterator const& collision, FilteredMCDJets const& MCDjets, MCPJets const& /*MCPjets*/) { + float weightEvt = useEventWeight ? collision.weight() : 1.f; + registry.fill(HIST("h_event_counter"), 0.5, weightEvt); - for (const auto& mcpjet : MCPjets) { + for (const auto& analysisJet : MCDjets) { bool jetIncluded = false; for (const auto& jetR : jetRadiiValues) { - if (mcpjet.r() == static_cast(jetR * 100)) { + if (analysisJet.r() == static_cast(jetR * 100)) { jetIncluded = true; break; } @@ -426,26 +506,191 @@ struct BjetTaggingGnn { continue; } - float weight = useEventWeight ? mcpjet.eventWeight() : 1.0; - float pTHat = 10. / (std::pow(mcpjet.eventWeight(), 1.0 / pTHatExponent)); - if (mcpjet.pt() > pTHatMaxMCP * pTHat) { + float weight = useEventWeight ? analysisJet.eventWeight() : 1.f; + float pTHat = 10. / (std::pow(analysisJet.eventWeight(), 1.0 / pTHatExponent)); + if (analysisJet.pt() > pTHatMaxMCD * pTHat) { continue; } - int8_t jetFlavor = mcpjet.origin(); + int8_t jetFlavor = analysisJet.origin(); - registry.fill(HIST("h_jetpT_particle"), mcpjet.pt(), weight); + registry.fill(HIST("h_jetpT_tvx"), analysisJet.pt(), weight); if (jetFlavor == JetTaggingSpecies::beauty) { - registry.fill(HIST("h_jetpT_particle_b"), mcpjet.pt(), weight); - } else if (jetFlavor == JetTaggingSpecies::charm) { - registry.fill(HIST("h_jetpT_particle_c"), mcpjet.pt(), weight); - } else { - registry.fill(HIST("h_jetpT_particle_lf"), mcpjet.pt(), weight); + registry.fill(HIST("h_jetpT_b_tvx"), analysisJet.pt(), weight); + } + + for (const auto& mcpjet : analysisJet.template matchedJetGeo_as()) { + if (mcpjet.pt() > pTHatMaxMCP * pTHat) { + continue; + } + + registry.fill(HIST("h2_Response_DetjetpT_PartjetpT_tvx"), analysisJet.pt(), mcpjet.pt(), weight); + if (jetFlavor == JetTaggingSpecies::beauty) { + registry.fill(HIST("h2_Response_DetjetpT_PartjetpT_b_tvx"), analysisJet.pt(), mcpjet.pt(), weight); + } + } + } + + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBitsSel)) { + return; + } + registry.fill(HIST("h_event_counter"), 1.5, weightEvt); + + for (const auto& analysisJet : MCDjets) { + + bool jetIncluded = false; + for (const auto& jetR : jetRadiiValues) { + if (analysisJet.r() == static_cast(jetR * 100)) { + jetIncluded = true; + break; + } + } + + if (!jetIncluded) { + continue; + } + + float weight = useEventWeight ? analysisJet.eventWeight() : 1.f; + float pTHat = 10. / (std::pow(analysisJet.eventWeight(), 1.0 / pTHatExponent)); + if (analysisJet.pt() > pTHatMaxMCD * pTHat) { + continue; + } + + int8_t jetFlavor = analysisJet.origin(); + + registry.fill(HIST("h_jetpT_sel"), analysisJet.pt(), weight); + + if (jetFlavor == JetTaggingSpecies::beauty) { + registry.fill(HIST("h_jetpT_b_sel"), analysisJet.pt(), weight); + } + + for (const auto& mcpjet : analysisJet.template matchedJetGeo_as()) { + if (mcpjet.pt() > pTHatMaxMCP * pTHat) { + continue; + } + + registry.fill(HIST("h2_Response_DetjetpT_PartjetpT_sel"), analysisJet.pt(), mcpjet.pt(), weight); + if (jetFlavor == JetTaggingSpecies::beauty) { + registry.fill(HIST("h2_Response_DetjetpT_PartjetpT_b_sel"), analysisJet.pt(), mcpjet.pt(), weight); + } + } + } + } + PROCESS_SWITCH(BjetTaggingGnn, processMCJetsSel, "jet information in MC (sel8)", false); + + PresliceUnsorted collisionsPerMCPCollision = aod::jmccollisionlb::mcCollisionId; + + void processMCTruthJets(MCPJets::iterator const& mcpjet, aod::JetParticles const& /*MCParticles*/, aod::JetMcCollisions const& /*mcCollisions*/, AnalysisCollisionsMCD const& collisions) + { + bool jetIncluded = false; + for (const auto& jetR : jetRadiiValues) { + if (mcpjet.r() == static_cast(jetR * 100)) { + jetIncluded = true; + break; + } + } + + if (!jetIncluded) { + return; + } + + float weight = useEventWeight ? mcpjet.eventWeight() : 1.0; + float pTHat = 10. / (std::pow(mcpjet.eventWeight(), 1.0 / pTHatExponent)); + if (mcpjet.pt() > pTHatMaxMCP * pTHat) { + return; + } + + int8_t jetFlavor = mcpjet.origin(); + + registry.fill(HIST("h_jetpT_particle_tvx"), mcpjet.pt(), weight); + + if (jetFlavor == JetTaggingSpecies::beauty) { + registry.fill(HIST("h_jetpT_particle_b_tvx"), mcpjet.pt(), weight); + } + + auto collisionspermcpjet = collisions.sliceBy(collisionsPerMCPCollision, mcpjet.mcCollisionId()); + + if (collisionspermcpjet.size() >= 1) { + if (jetderiveddatautilities::selectCollision(collisionspermcpjet.begin(), eventSelectionBitsSel)) { + registry.fill(HIST("h_jetpT_particle_sel"), mcpjet.pt(), weight); + + if (jetFlavor == JetTaggingSpecies::beauty) { + registry.fill(HIST("h_jetpT_particle_b_sel"), mcpjet.pt(), weight); + } + } + + if (jetderiveddatautilities::selectCollision(collisionspermcpjet.begin(), eventSelectionBits) && std::fabs(collisionspermcpjet.begin().posZ()) < vertexZCut) { + registry.fill(HIST("h_jetpT_particle"), mcpjet.pt(), weight); + + if (jetFlavor == JetTaggingSpecies::beauty) { + registry.fill(HIST("h_jetpT_particle_b"), mcpjet.pt(), weight); + } else if (jetFlavor == JetTaggingSpecies::charm) { + registry.fill(HIST("h_jetpT_particle_c"), mcpjet.pt(), weight); + } else { + registry.fill(HIST("h_jetpT_particle_lf"), mcpjet.pt(), weight); + } } } } PROCESS_SWITCH(BjetTaggingGnn, processMCTruthJets, "truth jet information", false); + + void processMCCollision(aod::McCollisions::iterator const& mcCollision, AnalysisCollisionsMCD const& collisions) + { + float weightEvt = useEventWeight ? mcCollision.weight() : 1.f; + registry.fill(HIST("h_event_counter"), 3.5, weightEvt); // McColl(INEL) + auto collisionspermccollision = collisions.sliceBy(collisionsPerMCPCollision, mcCollision.globalIndex()); + if (collisionspermccollision.size() >= 1) { + if (jetderiveddatautilities::selectCollision(collisionspermccollision.begin(), eventSelectionBitsSel)) { + registry.fill(HIST("h_event_counter"), 4.5, weightEvt); // McColl(-> Coll+TVX+Sel8) + } + if (jetderiveddatautilities::selectCollision(collisionspermccollision.begin(), eventSelectionBits) && std::fabs(collisionspermccollision.begin().posZ()) < vertexZCut) { + registry.fill(HIST("h_event_counter"), 5.5, weightEvt); // McColl(-> Coll+TVX+Sel8+...) + } + } + } + PROCESS_SWITCH(BjetTaggingGnn, processMCCollision, "mc collision information", false); + + PresliceUnsorted> perFoundBC = aod::evsel::foundBCId; + + void processBCs(soa::Join const& bcs, soa::Join const& collisions) + { + if (bcs.size() == 0) { + return; + } + for (const auto& bc : bcs) { + registry.fill(HIST("hBCCounter"), 0.5); // All BC + if (bc.selection_bit(aod::evsel::kIsTriggerTVX)) { + registry.fill(HIST("hBCCounter"), 1.5); // BC+TVX + if (bc.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + registry.fill(HIST("hBCCounter"), 2.5); // BC+TVX+NoTFB + if (bc.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + registry.fill(HIST("hBCCounter"), 3.5); // BC+TVX+NoTFB+NoITSROFB ----> this goes to Lumi i.e. hLumiAfterBCcuts in eventSelection task + } + } + } + auto collisionsInBC = collisions.sliceBy(perFoundBC, bc.globalIndex()); + for (const auto& collision : collisionsInBC) { + registry.fill(HIST("hBCCounter"), 4.5); // CollinBC + if (collision.sel8()) { + registry.fill(HIST("hBCCounter"), 5.5); // CollinBC+sel8 + if (std::fabs(collision.posZ()) < vertexZCut) { + registry.fill(HIST("hBCCounter"), 6.5); // CollinBC+sel8+VtxZ + } + if (collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + registry.fill(HIST("hBCCounter"), 7.5); // CollinBC+sel8Full + if (collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + registry.fill(HIST("hBCCounter"), 8.5); // CollinBC+sel8Full+GoodZvtx + if (std::fabs(collision.posZ()) < vertexZCut) { + registry.fill(HIST("hBCCounter"), 9.5); // CollinBC+sel8Full+VtxZ+GoodZvtx ----> this goes to my analysis task for jet events selection + } + } + } + } + } // collision loop + } // bc loop + } + PROCESS_SWITCH(BjetTaggingGnn, processBCs, "BCs for 0 vertex QA", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 8e6bb6f5c88a3ecf3b9f4d8fa1c286cc32249bdb Mon Sep 17 00:00:00 2001 From: dajones2 <140733426+dajones2@users.noreply.github.com> Date: Tue, 23 Sep 2025 15:44:32 +0100 Subject: [PATCH 508/986] [PWGJE] Bug fixes (#13010) --- PWGJE/Tasks/jetHadronRecoil.cxx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/PWGJE/Tasks/jetHadronRecoil.cxx b/PWGJE/Tasks/jetHadronRecoil.cxx index 7090b4418a1..34af8f17272 100644 --- a/PWGJE/Tasks/jetHadronRecoil.cxx +++ b/PWGJE/Tasks/jetHadronRecoil.cxx @@ -196,7 +196,7 @@ struct JetHadronRecoil { registry.add("hDeltaRpTDPhiReferencePart", "jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{400, 0, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis}}, doSumw); } - if (doprocessJetsMCPMCDMatched || doprocessJetsMCPMCDMatchedWithRhoSubtraction || doprocessJetsMCPMCDMatchedWeighted || doprocessJetsMCPMCDMatchedWeightedWithRhoSubtraction || doprocessRecoilJetsMCPMCDMatched || doprocessRecoilJetsMCPMCDMatchedWeighted) { + if (doprocessJetsMCPMCDMatched || doprocessJetsMCPMCDMatchedWithRhoSubtraction || doprocessJetsMCPMCDMatchedWeighted || doprocessJetsMCPMCDMatchedWeightedWithRhoSubtraction || doprocessRecoilJetsMCPMCDMatched || doprocessRecoilJetsMCPMCDMatchedWeighted || doprocessRecoilJetsMCPMCDMatchedWeightedWithRhoSubtraction) { registry.add("hPtMatched", "p_{T} matching;p_{T,det};p_{T,part}", {HistType::kTH2F, {{500, -100, 400}, {400, 0, 400}}}, doSumw); registry.add("hPhiMatched", "#phi matching;#phi_{det};#phi_{part}", {HistType::kTH2F, {{100, 0.0, o2::constants::math::TwoPI}, {100, 0.0, o2::constants::math::TwoPI}}}, doSumw); registry.add("hDeltaRMatched", "#DeltaR matching;#DeltaR_{det};#DeltaR_{part}", {HistType::kTH2F, {dRAxisDet, dRAxisPart}}, doSumw); @@ -636,7 +636,7 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } - if (collision.has_mcCollision()) { + if (!collision.has_mcCollision()) { return; } if (collision.mcCollision().ptHard() < pTHatMinEvent) { @@ -661,7 +661,7 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } - if (collision.has_mcCollision()) { + if (!collision.has_mcCollision()) { return; } if (collision.mcCollision().ptHard() < pTHatMinEvent) { @@ -686,7 +686,7 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } - if (collision.has_mcCollision()) { + if (!collision.has_mcCollision()) { return; } if (collision.mcCollision().ptHard() < pTHatMinEvent) { @@ -711,7 +711,7 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } - if (collision.has_mcCollision()) { + if (!collision.has_mcCollision()) { return; } if (collision.mcCollision().ptHard() < pTHatMinEvent) { @@ -771,7 +771,7 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } - if (collision.has_mcCollision()) { + if (!collision.has_mcCollision()) { return; } if (collision.mcCollision().ptHard() < pTHatMinEvent) { @@ -795,7 +795,7 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } - if (collision.has_mcCollision()) { + if (!collision.has_mcCollision()) { return; } if (collision.mcCollision().ptHard() < pTHatMinEvent) { @@ -819,7 +819,7 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } - if (collision.has_mcCollision()) { + if (!collision.has_mcCollision()) { return; } if (collision.mcCollision().ptHard() < pTHatMinEvent) { @@ -843,7 +843,7 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } - if (collision.has_mcCollision()) { + if (!collision.has_mcCollision()) { return; } if (collision.mcCollision().ptHard() < pTHatMinEvent) { @@ -867,7 +867,7 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } - if (collision.has_mcCollision()) { + if (!collision.has_mcCollision()) { return; } if (collision.mcCollision().ptHard() < pTHatMinEvent) { @@ -891,7 +891,7 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } - if (collision.has_mcCollision()) { + if (!collision.has_mcCollision()) { return; } if (collision.mcCollision().ptHard() < pTHatMinEvent) { @@ -915,7 +915,7 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } - if (collision.has_mcCollision()) { + if (!collision.has_mcCollision()) { return; } if (collision.mcCollision().ptHard() < pTHatMinEvent) { From a01e2e9e4623a1a7225b58008f6010ad327fea0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Tue, 23 Sep 2025 16:44:53 +0200 Subject: [PATCH 509/986] [ALICE3] Use TEnv for config (#13088) Configurations are in the type of the ini files with TEnv ``` bpipe0.r: 0.48 bpipe0.z: 250 bpipe0.x0: 0.001592 bpipe0.xrho: 0 bpipe0.resRPhi: 0.0 bpipe0.resZ: 0.0 bpipe0.eff: 0.0 bpipe0.type: 0 ``` --- ALICE3/Core/FastTracker.cxx | 60 +++++++++++++++++++++---------- ALICE3/macros/testFastTracker.cxx | 30 ++++++++++++++++ 2 files changed, 72 insertions(+), 18 deletions(-) create mode 100644 ALICE3/macros/testFastTracker.cxx diff --git a/ALICE3/Core/FastTracker.cxx b/ALICE3/Core/FastTracker.cxx index 0f45e47291e..84fa174c224 100644 --- a/ALICE3/Core/FastTracker.cxx +++ b/ALICE3/Core/FastTracker.cxx @@ -17,7 +17,11 @@ #include "TMatrixD.h" #include "TMatrixDSymEigen.h" #include "TRandom.h" +#include +#include +#include +#include #include #include @@ -260,27 +264,47 @@ void FastTracker::AddGenericDetector(std::string filename, o2::ccdb::BasicCCDBMa return; } - std::ifstream infile(filename); - if (!infile.is_open()) { - LOG(fatal) << "Could not open detector configuration file: " << filename; - return; - } - - std::string line; - while (std::getline(infile, line)) { - if (line.empty() || line[0] == '#') - continue; // skip comments and empty lines - std::istringstream iss(line); - std::string name; - float r, z, x0, xrho, resRPhi, resZ, eff; - int type; - if (!(iss >> name >> r >> z >> x0 >> xrho >> resRPhi >> resZ >> eff >> type)) { - LOG(error) << "Malformed line in detector config: " << line; + TEnv env(filename.c_str()); + THashList* table = env.GetTable(); + std::vector layers; + for (int i = 0; i < table->GetEntries(); ++i) { + const std::string key = table->At(i)->GetName(); + // key should contain exactly one dot + if (key.find('.') == std::string::npos || key.find('.') != key.rfind('.')) { + LOG(fatal) << "Key " << key << " does not contain exactly one dot"; continue; } - AddLayer(name.c_str(), r, z, x0, xrho, resRPhi, resZ, eff, type); + const std::string firstPart = key.substr(0, key.find('.')); + if (std::find(layers.begin(), layers.end(), firstPart) == layers.end()) { + layers.push_back(firstPart); + } + } + // env.Print(); + // Layers + for (const auto& layer : layers) { + LOG(info) << " Reading layer " << layer; + + auto getKey = [&layer, &env](const std::string& name) { + std::string key = layer + "." + name; + if (!env.Defined(key.c_str())) { + LOG(warning) << "Key " << key << " not defined in configuration file, getting the default value"; + } + LOG(info) << " Getting key " << key; + return key; + }; + const float r = env.GetValue(getKey("r").c_str(), -1.0f); + LOG(info) << " Layer " << layer << " has radius " << r; + const float z = env.GetValue(getKey("z").c_str(), -1.0f); + const float x0 = env.GetValue(getKey("x0").c_str(), 0.0f); + const float xrho = env.GetValue(getKey("xrho").c_str(), 0.0f); + const float resRPhi = env.GetValue(getKey("resRPhi").c_str(), 0.0f); + const float resZ = env.GetValue(getKey("resZ").c_str(), 0.0f); + const float eff = env.GetValue(getKey("eff").c_str(), 0.0f); + const int type = env.GetValue(getKey("type").c_str(), 0); + + // void AddLayer(TString name, float r, float z, float x0, float xrho, float resRPhi = 0.0f, float resZ = 0.0f, float eff = 0.0f, int type = 0); + AddLayer(layer.c_str(), r, z, x0, xrho, resRPhi, resZ, eff, type); } - infile.close(); } float FastTracker::Dist(float z, float r) diff --git a/ALICE3/macros/testFastTracker.cxx b/ALICE3/macros/testFastTracker.cxx new file mode 100644 index 00000000000..ecca4c6de85 --- /dev/null +++ b/ALICE3/macros/testFastTracker.cxx @@ -0,0 +1,30 @@ +// 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 testFastTracker.C +/// \author Nicolò Jacazio nicolo.jacazio@cern.ch +/// \brief Test the FastTracker functionality + +#include "ALICE3/Core/FastTracker.h" + +#include "CCDB/BasicCCDBManager.h" +#include "DataFormatsParameters/GRPLHCIFData.h" + +void testFastTracker(std::string geometryFile = "a3geo.ini") +{ + + // auto& ccdb = o2::ccdb::BasicCCDBManager::instance(); + // ccdb.setURL("http://alice-ccdb.cern.ch"); + o2::fastsim::FastTracker fastTracker; + fastTracker.AddGenericDetector(geometryFile); + // fastTracker.AddGenericDetector(geometryFile, &ccdb); + fastTracker.Print(); +} From ed728ed50b0a42ea40bd7025fcd2d5aa7caf39b3 Mon Sep 17 00:00:00 2001 From: Katarzyna <116073883+kgwizdzi@users.noreply.github.com> Date: Tue, 23 Sep 2025 17:37:52 +0200 Subject: [PATCH 510/986] [PWGCF] FU D0 task update: adding D0bar cand. to SE and ME functions for SB (#13100) --- .../Tasks/femtoUniversePairTaskTrackD0.cxx | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx index 698865577b1..0c57bc7a485 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx @@ -903,8 +903,18 @@ struct FemtoUniversePairTaskTrackD0 { auto groupPartsTrack = partsTrack->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); auto groupPartsD0sFromSB = partsD0sFromSB->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + auto groupPartsD0barsFromSB = partsD0barsFromSB->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); - doSameEvent(groupPartsTrack, groupPartsD0sFromSB, parts, col.magField(), col.multNtr()); + switch (confChooseD0trackCorr) { + case 0: + doSameEvent(groupPartsTrack, groupPartsD0sFromSB, parts, col.magField(), col.multNtr()); + break; + case 1: + doSameEvent(groupPartsTrack, groupPartsD0barsFromSB, parts, col.magField(), col.multNtr()); + break; + default: + break; + } } PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processSameEventSB, "Enable processing same event", false); @@ -1060,6 +1070,7 @@ struct FemtoUniversePairTaskTrackD0 { auto groupPartsTrack = partsTrack->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); auto groupPartsD0sFromSB = partsD0sFromSB->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupPartsD0barsFromSB = partsD0barsFromSB->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); const auto& magFieldTesla1 = collision1.magField(); const auto& magFieldTesla2 = collision2.magField(); @@ -1069,8 +1080,16 @@ struct FemtoUniversePairTaskTrackD0 { } /// \todo before mixing we should check whether both collisions contain a pair of particles! // if (partsD0.size() == 0 || kNPart2Evt1 == 0 || kNPart1Evt2 == 0 || partsTrack.size() == 0 ) continue; - - doMixedEvent(groupPartsTrack, groupPartsD0sFromSB, parts, magFieldTesla1, multiplicityCol); + switch (confChooseD0trackCorr) { + case 0: + doMixedEvent(groupPartsTrack, groupPartsD0sFromSB, parts, magFieldTesla1, multiplicityCol); + break; + case 1: + doMixedEvent(groupPartsTrack, groupPartsD0barsFromSB, parts, magFieldTesla1, multiplicityCol); + break; + default: + break; + } } } PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processMixedEventSB, "Enable processing mixed events", false); From 88ae9c24f9106fa1d22957370085ba97292aec3d Mon Sep 17 00:00:00 2001 From: Chiara Pinto <48326672+chiarapinto@users.noreply.github.com> Date: Tue, 23 Sep 2025 19:51:30 +0200 Subject: [PATCH 511/986] [PWGLF] added configurable to select min TPC chi2 (#13103) --- PWGLF/Tasks/Nuspex/antinucleiInJets.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx index 20d48d727d0..672afbec1a6 100644 --- a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx +++ b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx @@ -120,6 +120,7 @@ struct AntinucleiInJets { Configurable applyItsPid{"applyItsPid", true, "apply ITS PID"}; Configurable minItsNclusters{"minItsNclusters", 5, "minimum number of ITS clusters"}; Configurable minTpcNcrossedRows{"minTpcNcrossedRows", 100, "minimum number of TPC crossed pad rows"}; + Configurable minChiSquareTpc{"minChiSquareTpc", 0.0, "minimum TPC chi^2/Ncls"}; Configurable maxChiSquareTpc{"maxChiSquareTpc", 4.0, "maximum TPC chi^2/Ncls"}; Configurable maxChiSquareIts{"maxChiSquareIts", 36.0, "maximum ITS chi^2/Ncls"}; Configurable minPt{"minPt", 0.3, "minimum pt of the tracks"}; @@ -565,6 +566,8 @@ struct AntinucleiInJets { return false; if (track.tpcNClsCrossedRows() < minTpcNcrossedRows) return false; + if (track.tpcChi2NCl() < minChiSquareTpc) + return false; if (track.tpcChi2NCl() > maxChiSquareTpc) return false; if (track.itsChi2NCl() > maxChiSquareIts) From 6dd53962a5e000a64cd6bd024dc60e77cc793f48 Mon Sep 17 00:00:00 2001 From: Samuele Cattaruzzi <124249902+scattaru@users.noreply.github.com> Date: Tue, 23 Sep 2025 21:00:45 +0200 Subject: [PATCH 512/986] [PWGHF] Added multiplicity in efficiency correction (#12939) Co-authored-by: ALICE Action Bot --- PWGHF/HFC/DataModel/CorrelationTables.h | 17 +- .../HFC/TableProducer/correlatorDsHadrons.cxx | 48 ++- .../correlatorDsHadronsReduced.cxx | 8 +- PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx | 368 +++++++++++++----- 4 files changed, 319 insertions(+), 122 deletions(-) diff --git a/PWGHF/HFC/DataModel/CorrelationTables.h b/PWGHF/HFC/DataModel/CorrelationTables.h index d453d894978..a8d729c8ee9 100644 --- a/PWGHF/HFC/DataModel/CorrelationTables.h +++ b/PWGHF/HFC/DataModel/CorrelationTables.h @@ -232,14 +232,15 @@ namespace hf_correlation_ds_hadron { DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! DeltaPhi between Ds and Hadrons DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); //! DeltaEta between Ds and Hadrons -DECLARE_SOA_COLUMN(PtD, ptD, float); //! Transverse momentum of Ds -DECLARE_SOA_COLUMN(PtHadron, ptHadron, float); //! Transverse momentum of Hadron +DECLARE_SOA_COLUMN(SignedPtD, signedPtD, float); //! Transverse momentum of Ds +DECLARE_SOA_COLUMN(SignedPtHadron, signedPtHadron, float); //! Transverse momentum of Hadron DECLARE_SOA_COLUMN(MD, mD, float); //! Invariant mass of Ds DECLARE_SOA_COLUMN(MlScoreBkg, mlScoreBkg, float); //! ML background score for Ds selection DECLARE_SOA_COLUMN(MlScorePrompt, mlScorePrompt, float); //! ML prompt score for Ds selection DECLARE_SOA_COLUMN(TrackDcaXY, trackDcaXY, float); //! DCA xy of the track DECLARE_SOA_COLUMN(TrackDcaZ, trackDcaZ, float); //! DCA z of the track DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin for the MixedEvent +DECLARE_SOA_COLUMN(NumPvContrib, numPvContrib, uint16_t); //! number PV contributors DECLARE_SOA_COLUMN(TrackTPCNClsCrossedRows, trackTPCNClsCrossedRows, int); //! Number of crossed TPC Rows DECLARE_SOA_COLUMN(TrackOrigin, trackOrigin, int); //! Number of crossed TPC Rows DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); //! Used in MC-Rec, Ds Signal @@ -251,9 +252,10 @@ DECLARE_SOA_COLUMN(IsPhysicalPrimary, isPhysicalPrimary, bool); //! U DECLARE_SOA_TABLE(DsHadronPair, "AOD", "DSHPAIR", //! Ds-Hadrons pairs Information aod::hf_correlation_ds_hadron::DeltaPhi, aod::hf_correlation_ds_hadron::DeltaEta, - aod::hf_correlation_ds_hadron::PtD, - aod::hf_correlation_ds_hadron::PtHadron, - aod::hf_correlation_ds_hadron::PoolBin); + aod::hf_correlation_ds_hadron::SignedPtD, + aod::hf_correlation_ds_hadron::SignedPtHadron, + aod::hf_correlation_ds_hadron::PoolBin, + aod::hf_correlation_ds_hadron::NumPvContrib); DECLARE_SOA_TABLE(DsHadronRecoInfo, "AOD", "DSHRECOINFO", //! Ds-Hadrons pairs Reconstructed Information aod::hf_correlation_ds_hadron::MD, @@ -271,9 +273,10 @@ DECLARE_SOA_TABLE(DsHadronMlInfo, "AOD", "DSHMLINFO", //! Ds-Hadrons pairs Machi DECLARE_SOA_TABLE(DsCandRecoInfo, "AOD", "DSCANDRECOINFO", //! Ds candidates Reconstructed Information aod::hf_correlation_ds_hadron::MD, - aod::hf_correlation_ds_hadron::PtD, + aod::hf_correlation_ds_hadron::SignedPtD, aod::hf_correlation_ds_hadron::MlScorePrompt, - aod::hf_correlation_ds_hadron::MlScoreBkg); + aod::hf_correlation_ds_hadron::MlScoreBkg, + aod::hf_correlation_ds_hadron::NumPvContrib); DECLARE_SOA_TABLE(DsCandGenInfo, "AOD", "DSCANDGENOINFO", //! Ds candidates Generated Information aod::hf_correlation_ds_hadron::IsPrompt); diff --git a/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx index c788f35dd92..95a8e003906 100644 --- a/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx @@ -216,11 +216,11 @@ struct HfCorrelatorDsHadrons { using SelCollisionsWithDs = soa::Filtered>; // collisionFilter applied // using SelCollisionsWithDsWithMc = soa::Filtered>; // collisionFilter applied using SelCollisionsMc = soa::Join; - using CandDsData = soa::Filtered>; // flagDsFilter applied - using CandDsMcReco = soa::Filtered>; // flagDsFilter applied - using CandDsMcGen = soa::Join; // flagDsFilter applied - using MyTracksData = soa::Filtered>; // trackFilter applied - using TracksWithMc = soa::Filtered>; // trackFilter applied + using CandDsData = soa::Filtered>; // flagDsFilter applied + using CandDsMcReco = soa::Filtered>; // flagDsFilter applied + using CandDsMcGen = soa::Join; // flagDsFilter applied + using MyTracksData = soa::Filtered>; // trackFilter applied + using TracksWithMc = soa::Filtered>; // trackFilter applied Filter collisionFilter = aod::hf_selection_dmeson_collision::dmesonSel == true; Filter flagDsFilter = ((o2::aod::hf_track_index::hfflag & static_cast(1 << aod::hf_cand_3prong::DecayType::DsToKKPi)) != static_cast(0)) && (aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlagDs || aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlagDs); @@ -430,13 +430,13 @@ struct HfCorrelatorDsHadrons { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDsToKKPi()[classMl->at(iclass)]; } - entryDsCandRecoInfo(hfHelper.invMassDsToKKPi(candidate), candidate.pt(), outputMl[0], outputMl[2]); + entryDsCandRecoInfo(hfHelper.invMassDsToKKPi(candidate), candidate.pt(), outputMl[0], outputMl[2], collision.numContrib()); } else if (candidate.isSelDsToPiKK() >= selectionFlagDs) { fillHistoPiKK(candidate, efficiencyWeightD); for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDsToPiKK()[classMl->at(iclass)]; } - entryDsCandRecoInfo(hfHelper.invMassDsToPiKK(candidate), candidate.pt(), outputMl[0], outputMl[2]); + entryDsCandRecoInfo(hfHelper.invMassDsToPiKK(candidate), candidate.pt(), outputMl[0], outputMl[2], collision.numContrib()); } if (candidate.isSelDsToKKPi() >= selectionFlagDs && candidate.isSelDsToPiKK() >= selectionFlagDs) { registry.fill(HIST("hCountSelectionStatusDsToKKPiAndToPiKK"), 0.); @@ -459,7 +459,8 @@ struct HfCorrelatorDsHadrons { track.eta() - candidate.eta(), candidate.pt(), track.pt(), - poolBin); + poolBin, + collision.numContrib()); entryDsHadronRecoInfo(hfHelper.invMassDsToKKPi(candidate), false, false); // entryDsHadronGenInfo(false, false, 0); entryDsHadronMlInfo(outputMl[0], outputMl[2]); @@ -469,7 +470,8 @@ struct HfCorrelatorDsHadrons { track.eta() - candidate.eta(), candidate.pt(), track.pt(), - poolBin); + poolBin, + collision.numContrib()); entryDsHadronRecoInfo(hfHelper.invMassDsToPiKK(candidate), false, false); // entryDsHadronGenInfo(false, false, 0); entryDsHadronMlInfo(outputMl[0], outputMl[2]); @@ -530,7 +532,7 @@ struct HfCorrelatorDsHadrons { registry.fill(HIST("hMassDsMcRecSig"), hfHelper.invMassDsToKKPi(candidate), candidate.pt(), efficiencyWeightD); registry.fill(HIST("hMassDsVsPtMcRec"), hfHelper.invMassDsToKKPi(candidate), candidate.pt(), efficiencyWeightD); registry.fill(HIST("hSelectionStatusDsToKKPiMcRec"), candidate.isSelDsToKKPi()); - entryDsCandRecoInfo(hfHelper.invMassDsToKKPi(candidate), candidate.pt(), outputMl[0], outputMl[2]); + entryDsCandRecoInfo(hfHelper.invMassDsToKKPi(candidate), candidate.pt(), outputMl[0], outputMl[2], collision.numContrib()); entryDsCandGenInfo(isDsPrompt); } else if (candidate.isSelDsToPiKK() >= selectionFlagDs) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { @@ -540,7 +542,7 @@ struct HfCorrelatorDsHadrons { registry.fill(HIST("hMassDsMcRecSig"), hfHelper.invMassDsToPiKK(candidate), candidate.pt(), efficiencyWeightD); registry.fill(HIST("hMassDsVsPtMcRec"), hfHelper.invMassDsToPiKK(candidate), candidate.pt(), efficiencyWeightD); registry.fill(HIST("hSelectionStatusDsToPiKKMcRec"), candidate.isSelDsToPiKK()); - entryDsCandRecoInfo(hfHelper.invMassDsToPiKK(candidate), candidate.pt(), outputMl[0], outputMl[2]); + entryDsCandRecoInfo(hfHelper.invMassDsToPiKK(candidate), candidate.pt(), outputMl[0], outputMl[2], collision.numContrib()); entryDsCandGenInfo(isDsPrompt); } } else { @@ -582,7 +584,8 @@ struct HfCorrelatorDsHadrons { track.eta() - candidate.eta(), candidate.pt(), track.pt(), - poolBin); + poolBin, + collision.numContrib()); entryDsHadronRecoInfo(hfHelper.invMassDsToKKPi(candidate), isDsSignal, isDecayChan); entryDsHadronMlInfo(outputMl[0], outputMl[2]); if (track.has_mcParticle()) { @@ -607,7 +610,8 @@ struct HfCorrelatorDsHadrons { track.eta() - candidate.eta(), candidate.pt(), track.pt(), - poolBin); + poolBin, + collision.numContrib()); entryDsHadronRecoInfo(hfHelper.invMassDsToPiKK(candidate), isDsSignal, isDecayChan); entryDsHadronMlInfo(outputMl[0], outputMl[2]); if (track.has_mcParticle()) { @@ -743,7 +747,8 @@ struct HfCorrelatorDsHadrons { particleAssoc.eta() - particle.eta(), particle.pt(), particleAssoc.pt(), - poolBin); + poolBin, + 0); entryDsHadronRecoInfo(MassDS, true, isDecayChan); entryDsHadronGenInfo(isDsPrompt, particleAssoc.isPhysicalPrimary(), trackOrigin); } @@ -847,7 +852,8 @@ struct HfCorrelatorDsHadrons { pAssoc.eta() - cand.eta(), cand.pt(), pAssoc.pt(), - poolBin); + poolBin, + c1.numContrib()); entryDsHadronRecoInfo(hfHelper.invMassDsToKKPi(cand), false, false); // entryDsHadronGenInfo(false, false, 0); for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { @@ -861,7 +867,8 @@ struct HfCorrelatorDsHadrons { pAssoc.eta() - cand.eta(), cand.pt(), pAssoc.pt(), - poolBin); + poolBin, + c1.numContrib()); entryDsHadronRecoInfo(hfHelper.invMassDsToPiKK(cand), false, false); // entryDsHadronGenInfo(false, false, 0); for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { @@ -937,7 +944,8 @@ struct HfCorrelatorDsHadrons { pAssoc.eta() - candidate.eta(), candidate.pt(), pAssoc.pt(), - poolBin); + poolBin, + c1.numContrib()); entryDsHadronRecoInfo(hfHelper.invMassDsToKKPi(candidate), isDsSignal, isDecayChan); entryDsHadronGenInfo(isDsPrompt, isPhysicalPrimary, trackOrigin); for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { @@ -950,7 +958,8 @@ struct HfCorrelatorDsHadrons { pAssoc.eta() - candidate.eta(), candidate.pt(), pAssoc.pt(), - poolBin); + poolBin, + c1.numContrib()); entryDsHadronRecoInfo(hfHelper.invMassDsToPiKK(candidate), isDsSignal, isDecayChan); entryDsHadronGenInfo(isDsPrompt, isPhysicalPrimary, trackOrigin); for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { @@ -993,7 +1002,8 @@ struct HfCorrelatorDsHadrons { particleAssoc.eta() - candidate.eta(), candidate.pt(), particleAssoc.pt(), - poolBin); + poolBin, + 0); entryDsHadronRecoInfo(MassDS, true, true); entryDsHadronGenInfo(isDsPrompt, particleAssoc.isPhysicalPrimary(), trackOrigin); } diff --git a/PWGHF/HFC/TableProducer/correlatorDsHadronsReduced.cxx b/PWGHF/HFC/TableProducer/correlatorDsHadronsReduced.cxx index 5684619dd3f..ece87ee21ad 100644 --- a/PWGHF/HFC/TableProducer/correlatorDsHadronsReduced.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDsHadronsReduced.cxx @@ -126,7 +126,7 @@ struct HfCorrelatorDsHadronsReduced { registry.fill(HIST("hDsPoolBin"), poolBin); registry.fill(HIST("hPhiVsPtCand"), RecoDecay::constrainAngle(candidate.phiCand(), -PIHalf), candidate.ptCand()); registry.fill(HIST("hEtaVsPtCand"), candidate.etaCand(), candidate.ptCand()); - entryDsCandRecoInfo(candidate.invMassDs(), candidate.ptCand(), candidate.bdtScorePrompt(), candidate.bdtScoreBkg()); + entryDsCandRecoInfo(candidate.invMassDs(), candidate.ptCand(), candidate.bdtScorePrompt(), candidate.bdtScoreBkg(), collision.numPvContrib()); for (const auto& track : tracksThisColl) { // Removing Ds daughters by checking track indices if ((candidate.prong0Id() == track.originTrackId()) || (candidate.prong1Id() == track.originTrackId()) || (candidate.prong2Id() == track.originTrackId())) { @@ -140,7 +140,8 @@ struct HfCorrelatorDsHadronsReduced { track.etaAssocTrack() - candidate.etaCand(), candidate.ptCand(), track.ptAssocTrack(), - poolBin); + poolBin, + collision.numPvContrib()); entryDsHadronRecoInfo(candidate.invMassDs(), false, false); entryDsHadronMlInfo(candidate.bdtScorePrompt(), candidate.bdtScoreBkg()); entryTrackRecoInfo(track.dcaXY(), track.dcaZ(), track.nTpcCrossedRows()); @@ -202,7 +203,8 @@ struct HfCorrelatorDsHadronsReduced { pAssoc.etaAssocTrack() - cand.etaCand(), cand.ptCand(), pAssoc.ptAssocTrack(), - poolBin); + poolBin, + c1.numPvContrib()); entryDsHadronRecoInfo(cand.invMassDs(), false, false); // entryDsHadronGenInfo(false, false, 0); } diff --git a/PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx b/PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx index 51a56e5a766..1536814e5f8 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx @@ -81,7 +81,10 @@ struct HfTaskCorrelationDsHadrons { Configurable removeCollWSplitVtx{"removeCollWSplitVtx", false, "Flag for rejecting the splitted collisions"}; Configurable loadAccXEffFromCCDB{"loadAccXEffFromCCDB", false, "Flag for loading efficiency distributions from CCDB"}; Configurable separateTrackOrigins{"separateTrackOrigins", false, "Flag to enable separation of track origins (from c or b)"}; - Configurable useHighDimHistoForEff{"useHighDimHistoForEff", false, "Flag to create higher dimension histograms in the efficiency processes"}; + Configurable useHighDimHistoForEff{"useHighDimHistoForEff", false, "Flag to create/use higher dimension histograms in the efficiency processes/correction"}; + Configurable applyDeltaPhiCorrEff{"applyDeltaPhiCorrEff", false, "Flag to use higher dimension histograms with delta phi correction in the efficiency correction"}; + Configurable doLSpair{"doLSpair", false, "Flag to evaluate correlations for like-sign pairs"}; + Configurable doULSpair{"doULSpair", false, "Flag to evaluate correlations for unlike-sign pairs"}; // Configurable doMcCollisionCheck{"doMcCollisionCheck", false, "Flag for applying the collision check and selection based on MC collision info"}; Configurable selectionFlagDs{"selectionFlagDs", 7, "Selection Flag for Ds (avoid the case of flag = 0, no outputMlScore)"}; Configurable nTpcCrossedRaws{"nTpcCrossedRaws", 70, "Number of crossed TPC Rows"}; @@ -123,6 +126,10 @@ struct HfTaskCorrelationDsHadrons { std::shared_ptr hEfficiencyD = nullptr; std::shared_ptr hEfficiencyAssociated = nullptr; + std::shared_ptr hEfficiencyDMult = nullptr; + std::shared_ptr hEfficiencyAssociatedMult = nullptr; + std::shared_ptr hEfficiencyAssociatedDeltaPhiCorr = nullptr; + const float epsilon = 1.e-8; HfHelper hfHelper; @@ -285,17 +292,39 @@ struct HfTaskCorrelationDsHadrons { ccdb->setLocalObjectValidityChecking(); ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); - hEfficiencyD = std::shared_ptr(ccdb->getForTimeStamp(promptEffCcdbPath, timestampCcdb)); - if (hEfficiencyD == nullptr) { - LOGF(fatal, "Could not load efficiency histogram for trigger particles from %s", promptEffCcdbPath.value.c_str()); - } - LOGF(info, "Loaded trigger efficiency (prompt D) histogram from %s", promptEffCcdbPath.value.c_str()); + if (useHighDimHistoForEff) { + hEfficiencyDMult = std::shared_ptr(ccdb->getForTimeStamp(promptEffCcdbPath, timestampCcdb)); + if (hEfficiencyDMult == nullptr) { + LOGF(fatal, "Could not load efficiency histogram for trigger particles from %s", promptEffCcdbPath.value.c_str()); + } + LOGF(info, "Loaded trigger efficiency (prompt D) histogram from %s", promptEffCcdbPath.value.c_str()); - hEfficiencyAssociated = std::shared_ptr(ccdb->getForTimeStamp(associatedEffCcdbPath, timestampCcdb)); - if (hEfficiencyAssociated == nullptr) { - LOGF(fatal, "Could not load efficiency histogram for associated particles from %s", associatedEffCcdbPath.value.c_str()); + if (applyDeltaPhiCorrEff) { + hEfficiencyAssociatedDeltaPhiCorr = std::shared_ptr(ccdb->getForTimeStamp(associatedEffCcdbPath, timestampCcdb)); + if (hEfficiencyAssociatedDeltaPhiCorr == nullptr) { + LOGF(fatal, "Could not load efficiency histogram for associated particles from %s", associatedEffCcdbPath.value.c_str()); + } + LOGF(info, "Loaded associated efficiency histogram from %s", associatedEffCcdbPath.value.c_str()); + } else { + hEfficiencyAssociatedMult = std::shared_ptr(ccdb->getForTimeStamp(associatedEffCcdbPath, timestampCcdb)); + if (hEfficiencyAssociatedMult == nullptr) { + LOGF(fatal, "Could not load efficiency histogram for associated particles from %s", associatedEffCcdbPath.value.c_str()); + } + LOGF(info, "Loaded associated efficiency histogram from %s", associatedEffCcdbPath.value.c_str()); + } + } else { + hEfficiencyD = std::shared_ptr(ccdb->getForTimeStamp(promptEffCcdbPath, timestampCcdb)); + if (hEfficiencyD == nullptr) { + LOGF(fatal, "Could not load efficiency histogram for trigger particles from %s", promptEffCcdbPath.value.c_str()); + } + LOGF(info, "Loaded trigger efficiency (prompt D) histogram from %s", promptEffCcdbPath.value.c_str()); + + hEfficiencyAssociated = std::shared_ptr(ccdb->getForTimeStamp(associatedEffCcdbPath, timestampCcdb)); + if (hEfficiencyAssociated == nullptr) { + LOGF(fatal, "Could not load efficiency histogram for associated particles from %s", associatedEffCcdbPath.value.c_str()); + } + LOGF(info, "Loaded associated efficiency histogram from %s", associatedEffCcdbPath.value.c_str()); } - LOGF(info, "Loaded associated efficiency histogram from %s", associatedEffCcdbPath.value.c_str()); } } @@ -310,7 +339,7 @@ struct HfTaskCorrelationDsHadrons { return (ptBinD != -1 && bdtScorePrompt >= mlOutputPromptMin->at(ptBinD) && bdtScorePrompt <= mlOutputPromptMax->at(ptBinD) && bdtScoreBkg <= mlOutputBkg->at(ptBinD)); } - double getEfficiencyWeight(float ptD, std::optional ptAssoc = std::nullopt, EfficiencyMode mode = EfficiencyMode::DsOnly) + double getEfficiencyWeight(float ptD, std::optional multPvContrib = std::nullopt, std::optional ptAssoc = std::nullopt, std::optional deltaPhi = std::nullopt, EfficiencyMode mode = EfficiencyMode::DsOnly) { if (!applyEfficiency) { return 1.; @@ -321,10 +350,17 @@ struct HfTaskCorrelationDsHadrons { switch (mode) { case EfficiencyMode::DsOnly: if (loadAccXEffFromCCDB) { - if (hEfficiencyD->GetBinContent(hEfficiencyD->FindBin(ptD)) <= epsilon) { - LOG(fatal) << "A bin content in Ds-meson efficiency histogram is zero!"; + if (useHighDimHistoForEff) { + if (hEfficiencyDMult->GetBinContent(hEfficiencyDMult->FindBin(ptD, static_cast(*multPvContrib))) <= epsilon) { + LOG(fatal) << "A bin content in Ds-meson efficiency histogram is zero!"; + } + weight = 1. / hEfficiencyDMult->GetBinContent(hEfficiencyDMult->FindBin(ptD, static_cast(*multPvContrib))); + } else { + if (hEfficiencyD->GetBinContent(hEfficiencyD->FindBin(ptD)) <= epsilon) { + LOG(fatal) << "A bin content in Ds-meson efficiency histogram is zero!"; + } + weight = 1. / hEfficiencyD->GetBinContent(hEfficiencyD->FindBin(ptD)); } - weight = 1. / hEfficiencyD->GetBinContent(hEfficiencyD->FindBin(ptD)); } else { if (efficiencyD->at(o2::analysis::findBin(binsPtEfficiencyD, ptD)) <= epsilon) { LOG(fatal) << "A bin content in Ds-meson efficiency vector is zero!"; @@ -334,11 +370,25 @@ struct HfTaskCorrelationDsHadrons { break; case EfficiencyMode::DsHadronPair: if (loadAccXEffFromCCDB) { - if (ptAssoc && hEfficiencyAssociated) { - if (hEfficiencyAssociated->GetBinContent(hEfficiencyAssociated->FindBin(*ptAssoc)) <= epsilon) { - LOG(fatal) << "A bin content in associated particle efficiency histogram is zero!"; + if (ptAssoc && (hEfficiencyAssociated || hEfficiencyAssociatedMult || hEfficiencyAssociatedDeltaPhiCorr)) { + if (useHighDimHistoForEff) { + if (applyDeltaPhiCorrEff) { + if (hEfficiencyAssociatedDeltaPhiCorr->GetBinContent(hEfficiencyAssociatedDeltaPhiCorr->FindBin(*ptAssoc, ptD, static_cast(*deltaPhi))) <= epsilon) { + LOG(fatal) << "A bin content in associated particle efficiency histogram is zero!"; + } + weight = 1. / (hEfficiencyDMult->GetBinContent(hEfficiencyDMult->FindBin(ptD, static_cast(*multPvContrib))) * hEfficiencyAssociatedDeltaPhiCorr->GetBinContent(hEfficiencyAssociatedDeltaPhiCorr->FindBin(*ptAssoc, ptD, static_cast(*deltaPhi)))); + } else { + if (hEfficiencyAssociatedMult->GetBinContent(hEfficiencyAssociatedMult->FindBin(*ptAssoc, static_cast(*multPvContrib))) <= epsilon) { + LOG(fatal) << "A bin content in associated particle efficiency histogram is zero!"; + } + weight = 1. / (hEfficiencyDMult->GetBinContent(hEfficiencyDMult->FindBin(ptD, static_cast(*multPvContrib))) * hEfficiencyAssociatedMult->GetBinContent(hEfficiencyAssociatedMult->FindBin(*ptAssoc, static_cast(*multPvContrib)))); + } + } else { + if (hEfficiencyAssociated->GetBinContent(hEfficiencyAssociated->FindBin(*ptAssoc)) <= epsilon) { + LOG(fatal) << "A bin content in associated particle efficiency histogram is zero!"; + } + weight = 1. / (hEfficiencyD->GetBinContent(hEfficiencyD->FindBin(ptD)) * hEfficiencyAssociated->GetBinContent(hEfficiencyAssociated->FindBin(*ptAssoc))); } - weight = 1. / (hEfficiencyD->GetBinContent(hEfficiencyD->FindBin(ptD)) * hEfficiencyAssociated->GetBinContent(hEfficiencyAssociated->FindBin(*ptAssoc))); } } else { if (ptAssoc) { @@ -362,18 +412,24 @@ struct HfTaskCorrelationDsHadrons { { for (const auto& candidate : candidates) { float massD = candidate.mD(); - float ptD = candidate.ptD(); + float ptD = candidate.signedPtD(); float bdtScorePrompt = candidate.mlScorePrompt(); float bdtScoreBkg = candidate.mlScoreBkg(); - int ptBinD = o2::analysis::findBin(binsPtD, ptD); + int multPvContrib = candidate.numPvContrib(); + int ptBinD = o2::analysis::findBin(binsPtD, std::abs(ptD)); if (!isSelectedCandidate(ptBinD, bdtScorePrompt, bdtScoreBkg)) { continue; } - double efficiencyWeightD = getEfficiencyWeight(ptD); + double efficiencyWeightD = 1.; + if (useHighDimHistoForEff) { + efficiencyWeightD = getEfficiencyWeight(std::abs(ptD), multPvContrib); + } else { + efficiencyWeightD = getEfficiencyWeight(std::abs(ptD)); + } - registry.fill(HIST("hMassDsVsPt"), massD, ptD, efficiencyWeightD); + registry.fill(HIST("hMassDsVsPt"), massD, std::abs(ptD), efficiencyWeightD); registry.fill(HIST("hBdtScorePrompt"), bdtScorePrompt); registry.fill(HIST("hBdtScoreBkg"), bdtScoreBkg); } @@ -382,16 +438,17 @@ struct HfTaskCorrelationDsHadrons { // define variables for widely used quantities float deltaPhi = pairEntry.deltaPhi(); float deltaEta = pairEntry.deltaEta(); - float ptD = pairEntry.ptD(); - float ptHadron = pairEntry.ptHadron(); + float ptD = pairEntry.signedPtD(); + float ptHadron = pairEntry.signedPtHadron(); float massD = pairEntry.mD(); float bdtScorePrompt = pairEntry.mlScorePrompt(); float bdtScoreBkg = pairEntry.mlScoreBkg(); float trackDcaXY = pairEntry.trackDcaXY(); float trackDcaZ = pairEntry.trackDcaZ(); + int multPvContrib = pairEntry.numPvContrib(); int trackTpcCrossedRows = pairEntry.trackTPCNClsCrossedRows(); int poolBin = pairEntry.poolBin(); - int ptBinD = o2::analysis::findBin(binsPtD, ptD); + int ptBinD = o2::analysis::findBin(binsPtD, std::abs(ptD)); if (!isSelectedCandidate(ptBinD, bdtScorePrompt, bdtScoreBkg)) { continue; @@ -401,25 +458,60 @@ struct HfTaskCorrelationDsHadrons { continue; } - double efficiencyWeight = getEfficiencyWeight(ptD, ptHadron, EfficiencyMode::DsHadronPair); + double efficiencyWeight = 1.; + if (useHighDimHistoForEff) { + efficiencyWeight = getEfficiencyWeight(std::abs(ptD), multPvContrib, std::abs(ptHadron), deltaPhi, EfficiencyMode::DsHadronPair); + } else { + efficiencyWeight = getEfficiencyWeight(std::abs(ptD), std::nullopt, std::abs(ptHadron), std::nullopt, EfficiencyMode::DsHadronPair); + } // in signal region if (massD > signalRegionInner->at(ptBinD) && massD < signalRegionOuter->at(ptBinD)) { - registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSignalRegion"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSignalRegion"), deltaPhi, efficiencyWeight); + if (doLSpair && ((ptD > 0. && ptHadron > 0.) || (ptD < 0. && ptHadron < 0.))) { // like-sign pairs + registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSignalRegion"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSignalRegion"), deltaPhi, efficiencyWeight); + } else if (doULSpair && ((ptD > 0. && ptHadron < 0.) || (ptD < 0. && ptHadron > 0.))) { // unlike-sign pairs + registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSignalRegion"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSignalRegion"), deltaPhi, efficiencyWeight); + } else { // default case + registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSignalRegion"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSignalRegion"), deltaPhi, efficiencyWeight); + } } // in sideband left region if (massD > sidebandLeftOuter->at(ptBinD) && massD < sidebandLeftInner->at(ptBinD)) { - registry.fill(HIST("hCorrel2DVsPtSidebandLeft"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSidebandLeft"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSidebandLeft"), deltaPhi, efficiencyWeight); + if (doLSpair && ((ptD > 0. && ptHadron > 0.) || (ptD < 0. && ptHadron < 0.))) { // like-sign pairs + registry.fill(HIST("hCorrel2DVsPtSidebandLeft"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSidebandLeft"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSidebandLeft"), deltaPhi, efficiencyWeight); + } else if (doULSpair && ((ptD > 0. && ptHadron < 0.) || (ptD < 0. && ptHadron > 0.))) { // unlike-sign pairs + registry.fill(HIST("hCorrel2DVsPtSidebandLeft"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSidebandLeft"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSidebandLeft"), deltaPhi, efficiencyWeight); + } else { // default case + registry.fill(HIST("hCorrel2DVsPtSidebandLeft"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSidebandLeft"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSidebandLeft"), deltaPhi, efficiencyWeight); + } } // in sideband right region if (massD > sidebandRightInner->at(ptBinD) && massD < sidebandRightOuter->at(ptBinD)) { - registry.fill(HIST("hCorrel2DVsPtSidebandRight"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSidebandRight"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSidebandRight"), deltaPhi, efficiencyWeight); + if (doLSpair && ((ptD > 0. && ptHadron > 0.) || (ptD < 0. && ptHadron < 0.))) { // like-sign pairs + registry.fill(HIST("hCorrel2DVsPtSidebandRight"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSidebandRight"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSidebandRight"), deltaPhi, efficiencyWeight); + } else if (doULSpair && ((ptD > 0. && ptHadron < 0.) || (ptD < 0. && ptHadron > 0.))) { // unlike-sign pairs + registry.fill(HIST("hCorrel2DVsPtSidebandRight"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSidebandRight"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSidebandRight"), deltaPhi, efficiencyWeight); + } else { // default case + registry.fill(HIST("hCorrel2DVsPtSidebandRight"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSidebandRight"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSidebandRight"), deltaPhi, efficiencyWeight); + } } } } @@ -431,24 +523,30 @@ struct HfTaskCorrelationDsHadrons { { for (const auto& candidate : candidates) { float massD = candidate.mD(); - float ptD = candidate.ptD(); + float ptD = candidate.signedPtD(); float bdtScorePrompt = candidate.mlScorePrompt(); float bdtScoreBkg = candidate.mlScoreBkg(); - int ptBinD = o2::analysis::findBin(binsPtD, ptD); + int ptBinD = o2::analysis::findBin(binsPtD, std::abs(ptD)); + int multPvContrib = candidate.numPvContrib(); bool isDsPrompt = candidate.isPrompt(); if (!isSelectedCandidate(ptBinD, bdtScorePrompt, bdtScoreBkg)) { continue; } - double efficiencyWeightD = getEfficiencyWeight(ptD); + double efficiencyWeightD = 1.; + if (useHighDimHistoForEff) { + efficiencyWeightD = getEfficiencyWeight(std::abs(ptD), multPvContrib); + } else { + efficiencyWeightD = getEfficiencyWeight(std::abs(ptD)); + } if (isDsPrompt) { - registry.fill(HIST("hMassPromptDsVsPt"), massD, ptD, efficiencyWeightD); + registry.fill(HIST("hMassPromptDsVsPt"), massD, std::abs(ptD), efficiencyWeightD); registry.fill(HIST("hBdtScorePrompt"), bdtScorePrompt); registry.fill(HIST("hBdtScoreBkg"), bdtScoreBkg); } else { - registry.fill(HIST("hMassNonPromptDsVsPt"), massD, ptD, efficiencyWeightD); + registry.fill(HIST("hMassNonPromptDsVsPt"), massD, std::abs(ptD), efficiencyWeightD); registry.fill(HIST("hBdtScorePrompt"), bdtScorePrompt); registry.fill(HIST("hBdtScoreBkg"), bdtScoreBkg); } @@ -458,18 +556,19 @@ struct HfTaskCorrelationDsHadrons { // define variables for widely used quantities float deltaPhi = pairEntry.deltaPhi(); float deltaEta = pairEntry.deltaEta(); - float ptD = pairEntry.ptD(); - float ptHadron = pairEntry.ptHadron(); + float ptD = pairEntry.signedPtD(); + float ptHadron = pairEntry.signedPtHadron(); float massD = pairEntry.mD(); float bdtScorePrompt = pairEntry.mlScorePrompt(); float bdtScoreBkg = pairEntry.mlScoreBkg(); float trackDcaXY = pairEntry.trackDcaXY(); float trackDcaZ = pairEntry.trackDcaZ(); + int multPvContrib = pairEntry.numPvContrib(); int trackTpcCrossedRows = pairEntry.trackTPCNClsCrossedRows(); int poolBin = pairEntry.poolBin(); int statusDsPrompt = static_cast(pairEntry.isPrompt()); int statusPromptHadron = pairEntry.trackOrigin(); - int ptBinD = o2::analysis::findBin(binsPtD, ptD); + int ptBinD = o2::analysis::findBin(binsPtD, std::abs(ptD)); bool isPhysicalPrimary = pairEntry.isPhysicalPrimary(); if (!isSelectedCandidate(ptBinD, bdtScorePrompt, bdtScoreBkg)) { @@ -480,7 +579,12 @@ struct HfTaskCorrelationDsHadrons { continue; } - double efficiencyWeight = getEfficiencyWeight(ptD, ptHadron, EfficiencyMode::DsHadronPair); + double efficiencyWeight = 1.; + if (useHighDimHistoForEff) { + efficiencyWeight = getEfficiencyWeight(std::abs(ptD), multPvContrib, std::abs(ptHadron), deltaPhi, EfficiencyMode::DsHadronPair); + } else { + efficiencyWeight = getEfficiencyWeight(std::abs(ptD), std::nullopt, std::abs(ptHadron), std::nullopt, EfficiencyMode::DsHadronPair); + } // in signal region if (massD > signalRegionInner->at(ptBinD) && massD < signalRegionOuter->at(ptBinD)) { @@ -488,26 +592,26 @@ struct HfTaskCorrelationDsHadrons { if (pairEntry.isSignal() && pairEntry.isDecayChan()) { registry.fill(HIST("hDeltaEtaPtIntSignalRegionMcRec"), deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaPhiPtIntSignalRegionMcRec"), deltaPhi, efficiencyWeight); - registry.fill(HIST("hCorrel2DVsPtSignalRegionMcRec"), deltaPhi, deltaEta, ptD, ptHadron, statusDsPrompt, poolBin, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSignalRegionMcRec"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), statusDsPrompt, poolBin, efficiencyWeight); if (isPhysicalPrimary) { - registry.fill(HIST("hCorrel2DVsPtPhysicalPrimaryMcRec"), deltaPhi, deltaEta, ptD, ptHadron, statusDsPrompt, poolBin, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtPhysicalPrimaryMcRec"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), statusDsPrompt, poolBin, efficiencyWeight); if (statusDsPrompt == 1 && statusPromptHadron == RecoDecay::OriginType::Prompt) { - registry.fill(HIST("hCorrel2DVsPtSignalRegionPromptDsPromptHadronMcRec"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSignalRegionPromptDsPromptHadronMcRec"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); } else if (statusDsPrompt == 0 && statusPromptHadron == RecoDecay::OriginType::NonPrompt) { - registry.fill(HIST("hCorrel2DVsPtSignalRegionNonPromptDsNonPromptHadronMcRec"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSignalRegionNonPromptDsNonPromptHadronMcRec"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); } } } } // in sideband left region if (massD > sidebandLeftOuter->at(ptBinD) && massD < sidebandLeftInner->at(ptBinD)) { - registry.fill(HIST("hCorrel2DVsPtSidebandLeftMcRec"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSidebandLeftMcRec"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); registry.fill(HIST("hDeltaEtaPtIntSidebandLeftMcRec"), deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaPhiPtIntSidebandLeftMcRec"), deltaPhi, efficiencyWeight); } // in sideband right region if (massD > sidebandRightInner->at(ptBinD) && massD < sidebandRightOuter->at(ptBinD)) { - registry.fill(HIST("hCorrel2DVsPtSidebandRightMcRec"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSidebandRightMcRec"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); registry.fill(HIST("hDeltaEtaPtIntSidebandRightMcRec"), deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaPhiPtIntSidebandRightMcRec"), deltaPhi, efficiencyWeight); } @@ -522,24 +626,24 @@ struct HfTaskCorrelationDsHadrons { // define variables for widely used quantities float deltaPhi = pairEntry.deltaPhi(); float deltaEta = pairEntry.deltaEta(); - float ptD = pairEntry.ptD(); - float ptHadron = pairEntry.ptHadron(); + float ptD = pairEntry.signedPtD(); + float ptHadron = pairEntry.signedPtHadron(); int poolBin = pairEntry.poolBin(); int statusPromptHadron = pairEntry.trackOrigin(); bool isDsPrompt = pairEntry.isPrompt(); - registry.fill(HIST("hCorrel2DVsPtMcGen"), deltaPhi, deltaEta, ptD, ptHadron, poolBin); + registry.fill(HIST("hCorrel2DVsPtMcGen"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin); registry.fill(HIST("hDeltaEtaPtIntMcGen"), deltaEta); registry.fill(HIST("hDeltaPhiPtIntMcGen"), deltaPhi); if (isDsPrompt) { - registry.fill(HIST("hCorrel2DVsPtMcGenPrompt"), deltaPhi, deltaEta, ptD, ptHadron, poolBin); + registry.fill(HIST("hCorrel2DVsPtMcGenPrompt"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin); if (statusPromptHadron == RecoDecay::OriginType::Prompt) { - registry.fill(HIST("hCorrel2DVsPtMcGenPromptDsPromptHadron"), deltaPhi, deltaEta, ptD, ptHadron, poolBin); + registry.fill(HIST("hCorrel2DVsPtMcGenPromptDsPromptHadron"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin); } } else { - registry.fill(HIST("hCorrel2DVsPtMcGenNonPrompt"), deltaPhi, deltaEta, ptD, ptHadron, poolBin); + registry.fill(HIST("hCorrel2DVsPtMcGenNonPrompt"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin); if (statusPromptHadron == RecoDecay::OriginType::NonPrompt) { - registry.fill(HIST("hCorrel2DVsPtMcGenNonPromptDsNonPromptHadron"), deltaPhi, deltaEta, ptD, ptHadron, poolBin); + registry.fill(HIST("hCorrel2DVsPtMcGenNonPromptDsNonPromptHadron"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin); } } } @@ -552,16 +656,17 @@ struct HfTaskCorrelationDsHadrons { // define variables for widely used quantities float deltaPhi = pairEntry.deltaPhi(); float deltaEta = pairEntry.deltaEta(); - float ptD = pairEntry.ptD(); - float ptHadron = pairEntry.ptHadron(); + float ptD = pairEntry.signedPtD(); + float ptHadron = pairEntry.signedPtHadron(); float massD = pairEntry.mD(); float bdtScorePrompt = pairEntry.mlScorePrompt(); float bdtScoreBkg = pairEntry.mlScoreBkg(); float trackDcaXY = pairEntry.trackDcaXY(); float trackDcaZ = pairEntry.trackDcaZ(); + int multPvContrib = pairEntry.numPvContrib(); int trackTpcCrossedRows = pairEntry.trackTPCNClsCrossedRows(); int poolBin = pairEntry.poolBin(); - int ptBinD = o2::analysis::findBin(binsPtD, ptD); + int ptBinD = o2::analysis::findBin(binsPtD, std::abs(ptD)); if (!isSelectedCandidate(ptBinD, bdtScorePrompt, bdtScoreBkg)) { continue; @@ -571,25 +676,60 @@ struct HfTaskCorrelationDsHadrons { continue; } - double efficiencyWeight = getEfficiencyWeight(ptD, ptHadron, EfficiencyMode::DsHadronPair); + double efficiencyWeight = 1.; + if (useHighDimHistoForEff) { + efficiencyWeight = getEfficiencyWeight(std::abs(ptD), multPvContrib, std::abs(ptHadron), deltaPhi, EfficiencyMode::DsHadronPair); + } else { + efficiencyWeight = getEfficiencyWeight(std::abs(ptD), std::nullopt, std::abs(ptHadron), std::nullopt, EfficiencyMode::DsHadronPair); + } // in signal region if (massD > signalRegionInner->at(ptBinD) && massD < signalRegionOuter->at(ptBinD)) { - registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSignalRegion"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSignalRegion"), deltaPhi, efficiencyWeight); + if (doLSpair && ((ptD > 0. && ptHadron > 0.) || (ptD < 0. && ptHadron < 0.))) { // like-sign pairs + registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSignalRegion"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSignalRegion"), deltaPhi, efficiencyWeight); + } else if (doULSpair && ((ptD > 0. && ptHadron < 0.) || (ptD < 0. && ptHadron > 0.))) { // unlike-sign pairs + registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSignalRegion"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSignalRegion"), deltaPhi, efficiencyWeight); + } else { // default case + registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSignalRegion"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSignalRegion"), deltaPhi, efficiencyWeight); + } } // in sideband left region if (massD > sidebandLeftOuter->at(ptBinD) && massD < sidebandLeftInner->at(ptBinD)) { - registry.fill(HIST("hCorrel2DVsPtSidebandLeft"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSidebandLeft"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSidebandLeft"), deltaPhi, efficiencyWeight); + if (doLSpair && ((ptD > 0. && ptHadron > 0.) || (ptD < 0. && ptHadron < 0.))) { // like-sign pairs + registry.fill(HIST("hCorrel2DVsPtSidebandLeft"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSidebandLeft"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSidebandLeft"), deltaPhi, efficiencyWeight); + } else if (doULSpair && ((ptD > 0. && ptHadron < 0.) || (ptD < 0. && ptHadron > 0.))) { // unlike-sign pairs + registry.fill(HIST("hCorrel2DVsPtSidebandLeft"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSidebandLeft"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSidebandLeft"), deltaPhi, efficiencyWeight); + } else { // default case + registry.fill(HIST("hCorrel2DVsPtSidebandLeft"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSidebandLeft"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSidebandLeft"), deltaPhi, efficiencyWeight); + } } // in sideband right region if (massD > sidebandRightInner->at(ptBinD) && massD < sidebandRightOuter->at(ptBinD)) { - registry.fill(HIST("hCorrel2DVsPtSidebandRight"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSidebandRight"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSidebandRight"), deltaPhi, efficiencyWeight); + if (doLSpair && ((ptD > 0. && ptHadron > 0.) || (ptD < 0. && ptHadron < 0.))) { // like-sign pairs + registry.fill(HIST("hCorrel2DVsPtSidebandRight"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSidebandRight"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSidebandRight"), deltaPhi, efficiencyWeight); + } else if (doULSpair && ((ptD > 0. && ptHadron < 0.) || (ptD < 0. && ptHadron > 0.))) { // unlike-sign pairs + registry.fill(HIST("hCorrel2DVsPtSidebandRight"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSidebandRight"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSidebandRight"), deltaPhi, efficiencyWeight); + } else { // default case + registry.fill(HIST("hCorrel2DVsPtSidebandRight"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSidebandRight"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSidebandRight"), deltaPhi, efficiencyWeight); + } } } } @@ -601,31 +741,67 @@ struct HfTaskCorrelationDsHadrons { // define variables for widely used quantities float deltaPhi = pairEntry.deltaPhi(); float deltaEta = pairEntry.deltaEta(); - float ptD = pairEntry.ptD(); - float ptHadron = pairEntry.ptHadron(); + float ptD = pairEntry.signedPtD(); + float ptHadron = pairEntry.signedPtHadron(); float massD = pairEntry.mD(); + int multPvContrib = pairEntry.numPvContrib(); int poolBin = pairEntry.poolBin(); - int ptBinD = o2::analysis::findBin(binsPtD, ptD); + int ptBinD = o2::analysis::findBin(binsPtD, std::abs(ptD)); - double efficiencyWeight = getEfficiencyWeight(ptD, ptHadron, EfficiencyMode::DsHadronPair); + double efficiencyWeight = 1.; + if (useHighDimHistoForEff) { + efficiencyWeight = getEfficiencyWeight(std::abs(ptD), multPvContrib, std::abs(ptHadron), deltaPhi, EfficiencyMode::DsHadronPair); + } else { + efficiencyWeight = getEfficiencyWeight(std::abs(ptD), std::nullopt, std::abs(ptHadron), std::nullopt, EfficiencyMode::DsHadronPair); + } // in signal region if (massD > signalRegionInner->at(ptBinD) && massD < signalRegionOuter->at(ptBinD)) { - registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSignalRegion"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSignalRegion"), deltaPhi, efficiencyWeight); + if (doLSpair && ((ptD > 0. && ptHadron > 0.) || (ptD < 0. && ptHadron < 0.))) { // like-sign pairs + registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSignalRegion"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSignalRegion"), deltaPhi, efficiencyWeight); + } else if (doULSpair && ((ptD > 0. && ptHadron < 0.) || (ptD < 0. && ptHadron > 0.))) { // unlike-sign pairs + registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSignalRegion"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSignalRegion"), deltaPhi, efficiencyWeight); + } else { // default case + registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSignalRegion"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSignalRegion"), deltaPhi, efficiencyWeight); + } } // in sideband left region if (massD > sidebandLeftOuter->at(ptBinD) && massD < sidebandLeftInner->at(ptBinD)) { - registry.fill(HIST("hCorrel2DVsPtSidebandLeft"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSidebandLeft"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSidebandLeft"), deltaPhi, efficiencyWeight); + if (doLSpair && ((ptD > 0. && ptHadron > 0.) || (ptD < 0. && ptHadron < 0.))) { // like-sign pairs + registry.fill(HIST("hCorrel2DVsPtSidebandLeft"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSidebandLeft"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSidebandLeft"), deltaPhi, efficiencyWeight); + } else if (doULSpair && ((ptD > 0. && ptHadron < 0.) || (ptD < 0. && ptHadron > 0.))) { // unlike-sign pairs + registry.fill(HIST("hCorrel2DVsPtSidebandLeft"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSidebandLeft"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSidebandLeft"), deltaPhi, efficiencyWeight); + } else { // default case + registry.fill(HIST("hCorrel2DVsPtSidebandLeft"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSidebandLeft"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSidebandLeft"), deltaPhi, efficiencyWeight); + } } // in sideband right region if (massD > sidebandRightInner->at(ptBinD) && massD < sidebandRightOuter->at(ptBinD)) { - registry.fill(HIST("hCorrel2DVsPtSidebandRight"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSidebandRight"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSidebandRight"), deltaPhi, efficiencyWeight); + if (doLSpair && ((ptD > 0. && ptHadron > 0.) || (ptD < 0. && ptHadron < 0.))) { // like-sign pairs + registry.fill(HIST("hCorrel2DVsPtSidebandRight"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSidebandRight"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSidebandRight"), deltaPhi, efficiencyWeight); + } else if (doULSpair && ((ptD > 0. && ptHadron < 0.) || (ptD < 0. && ptHadron > 0.))) { // unlike-sign pairs + registry.fill(HIST("hCorrel2DVsPtSidebandRight"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSidebandRight"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSidebandRight"), deltaPhi, efficiencyWeight); + } else { // default case + registry.fill(HIST("hCorrel2DVsPtSidebandRight"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + registry.fill(HIST("hDeltaEtaPtIntSidebandRight"), deltaEta, efficiencyWeight); + registry.fill(HIST("hDeltaPhiPtIntSidebandRight"), deltaPhi, efficiencyWeight); + } } } } @@ -638,18 +814,19 @@ struct HfTaskCorrelationDsHadrons { // define variables for widely used quantities float deltaPhi = pairEntry.deltaPhi(); float deltaEta = pairEntry.deltaEta(); - float ptD = pairEntry.ptD(); - float ptHadron = pairEntry.ptHadron(); + float ptD = pairEntry.signedPtD(); + float ptHadron = pairEntry.signedPtHadron(); float massD = pairEntry.mD(); float bdtScorePrompt = pairEntry.mlScorePrompt(); float bdtScoreBkg = pairEntry.mlScoreBkg(); float trackDcaXY = pairEntry.trackDcaXY(); float trackDcaZ = pairEntry.trackDcaZ(); + int multPvContrib = pairEntry.numPvContrib(); int trackTpcCrossedRows = pairEntry.trackTPCNClsCrossedRows(); int poolBin = pairEntry.poolBin(); int statusDsPrompt = static_cast(pairEntry.isPrompt()); int statusPromptHadron = pairEntry.trackOrigin(); - int ptBinD = o2::analysis::findBin(binsPtD, ptD); + int ptBinD = o2::analysis::findBin(binsPtD, std::abs(ptD)); bool isPhysicalPrimary = pairEntry.isPhysicalPrimary(); if (!isSelectedCandidate(ptBinD, bdtScorePrompt, bdtScoreBkg)) { @@ -660,7 +837,12 @@ struct HfTaskCorrelationDsHadrons { continue; } - double efficiencyWeight = getEfficiencyWeight(ptD, ptHadron, EfficiencyMode::DsHadronPair); + double efficiencyWeight = 1.; + if (useHighDimHistoForEff) { + efficiencyWeight = getEfficiencyWeight(std::abs(ptD), multPvContrib, std::abs(ptHadron), deltaPhi, EfficiencyMode::DsHadronPair); + } else { + efficiencyWeight = getEfficiencyWeight(std::abs(ptD), std::nullopt, std::abs(ptHadron), std::nullopt, EfficiencyMode::DsHadronPair); + } // in signal region if (massD > signalRegionInner->at(ptBinD) && massD < signalRegionOuter->at(ptBinD)) { @@ -668,26 +850,26 @@ struct HfTaskCorrelationDsHadrons { if (pairEntry.isSignal() && pairEntry.isDecayChan()) { registry.fill(HIST("hDeltaEtaPtIntSignalRegionMcRec"), deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaPhiPtIntSignalRegionMcRec"), deltaPhi, efficiencyWeight); - registry.fill(HIST("hCorrel2DVsPtSignalRegionMcRec"), deltaPhi, deltaEta, ptD, ptHadron, statusDsPrompt, poolBin, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSignalRegionMcRec"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), statusDsPrompt, poolBin, efficiencyWeight); if (isPhysicalPrimary) { - registry.fill(HIST("hCorrel2DVsPtPhysicalPrimaryMcRec"), deltaPhi, deltaEta, ptD, ptHadron, statusDsPrompt, poolBin, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtPhysicalPrimaryMcRec"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), statusDsPrompt, poolBin, efficiencyWeight); if (statusDsPrompt == 1 && statusPromptHadron == RecoDecay::OriginType::Prompt) { - registry.fill(HIST("hCorrel2DVsPtSignalRegionPromptDsPromptHadronMcRec"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSignalRegionPromptDsPromptHadronMcRec"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); } else if (statusDsPrompt == 0 && statusPromptHadron == RecoDecay::OriginType::NonPrompt) { - registry.fill(HIST("hCorrel2DVsPtSignalRegionNonPromptDsNonPromptHadronMcRec"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSignalRegionNonPromptDsNonPromptHadronMcRec"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); } } } } // in sideband left region if (massD > sidebandLeftOuter->at(ptBinD) && massD < sidebandLeftInner->at(ptBinD)) { - registry.fill(HIST("hCorrel2DVsPtSidebandLeftMcRec"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSidebandLeftMcRec"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); registry.fill(HIST("hDeltaEtaPtIntSidebandLeftMcRec"), deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaPhiPtIntSidebandLeftMcRec"), deltaPhi, efficiencyWeight); } // in sideband right region if (massD > sidebandRightInner->at(ptBinD) && massD < sidebandRightOuter->at(ptBinD)) { - registry.fill(HIST("hCorrel2DVsPtSidebandRightMcRec"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSidebandRightMcRec"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); registry.fill(HIST("hDeltaEtaPtIntSidebandRightMcRec"), deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaPhiPtIntSidebandRightMcRec"), deltaPhi, efficiencyWeight); } From 27a41da35ddd68820a3a1cf17f18efe2e678b2d8 Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Tue, 23 Sep 2025 22:10:17 +0200 Subject: [PATCH 513/986] [PWGLF] Fix spin correlation definition (#13106) --- .../Strangeness/lambdaspincorrderived.cxx | 100 +++++++++++++++++- 1 file changed, 97 insertions(+), 3 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx index c8a3b5f729a..7382a32c860 100644 --- a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx @@ -35,6 +35,7 @@ #include +#include #include // for std::fabs #include #include @@ -96,6 +97,7 @@ struct lambdaspincorrderived { Configurable v0eta{"v0eta", 0.8, "Eta cut on lambda"}; // Event Mixing + Configurable cosDef{"cosDef", 1, "Defination of cos"}; Configurable nEvtMixing{"nEvtMixing", 10, "Number of events to mix"}; ConfigurableAxis CfgVtxBins{"CfgVtxBins", {10, -10, 10}, "Mixing bins - z-vertex"}; ConfigurableAxis CfgMultBins{"CfgMultBins", {8, 0.0, 80}, "Mixing bins - centrality"}; @@ -271,10 +273,102 @@ struct lambdaspincorrderived { auto proton1LambdaRF = boostLambda1ToCM(proton1pairCM); auto proton2LambdaRF = boostLambda2ToCM(proton2pairCM); - auto cosThetaDiff = -999.0; - cosThetaDiff = proton1LambdaRF.Vect().Unit().Dot(proton2LambdaRF.Vect().Unit()); + TVector3 zhat(lambda1CM.Px(), lambda1CM.Py(), lambda1CM.Pz()); + if (zhat.Mag2() == 0) + zhat = TVector3(0, 0, 1); + zhat = zhat.Unit(); + + // pick a reference not collinear with ẑ (beam z works) + TVector3 ref(0., 0., 1.); + if (std::abs(zhat.Dot(ref)) > 0.999) + ref = TVector3(1., 0., 0.); + + // build transverse axes + TVector3 xhat = (ref - (ref.Dot(zhat)) * zhat).Unit(); + TVector3 yhat = (zhat.Cross(xhat)).Unit(); + + // proton unit vectors in their Λ rest frames + TVector3 n1(proton1LambdaRF.Px(), proton1LambdaRF.Py(), proton1LambdaRF.Pz()); + n1 = n1.Unit(); + TVector3 n2(proton2LambdaRF.Px(), proton2LambdaRF.Py(), proton2LambdaRF.Pz()); + n2 = n2.Unit(); + + // cosθ* (Λ2 measured along −ẑ) + double c1 = n1.Dot(zhat); + double c2 = -n2.Dot(zhat); + + // sinθ* + double s1 = std::sqrt(std::max(0.0, 1.0 - c1 * c1)); + double s2 = std::sqrt(std::max(0.0, 1.0 - c2 * c2)); + + // φ1*, φ2* in common convention (flip axes for Λ2) + double phi1 = std::atan2(n1.Dot(yhat), n1.Dot(xhat)); + double phi2 = std::atan2(n2.Dot(-yhat), n2.Dot(-xhat)); + + // helicity spin-correlation + double cosDelta = c1 * c2 + s1 * s2 * std::cos(phi1 - phi2); + // clamp for safety + if (cosDelta > 1.0) + cosDelta = 1.0; + if (cosDelta < -1.0) + cosDelta = -1.0; + + // + // --- (B) Beam-based correlation (common z_B = beam; axes transported into each Λ rest frame) --- + // + TVector3 zB(0., 0., 1.); // beam axis in pair–CM coordinates + + // x_B: projection of Λ1 direction onto plane ⟂ z_B; y_B completes RH basis + TVector3 L1dir(lambda1CM.Px(), lambda1CM.Py(), lambda1CM.Pz()); + L1dir = L1dir.Unit(); + TVector3 xB = L1dir - (L1dir.Dot(zB)) * zB; + if (xB.Mag2() < 1e-12) + xB = TVector3(1., 0., 0.); // fallback if Λ1 ∥ beam + xB = xB.Unit(); + TVector3 yB = (zB.Cross(xB)).Unit(); + + // helper to transport an axis into a Λ rest frame (from pair–CM) + auto transport = [](const TVector3& v, const ROOT::Math::Boost& B) -> TVector3 { + ROOT::Math::PxPyPzEVector a(v.X(), v.Y(), v.Z(), 0.0); // spacelike 4-vector (t=0) + ROOT::Math::PxPyPzEVector ar = B(a); // boost into that Λ rest frame + TVector3 out(ar.Px(), ar.Py(), ar.Pz()); + if (out.Mag2() == 0) + return out; + return out.Unit(); + }; + + // transport beam triad to each Λ rest frame + TVector3 zB1 = transport(zB, boostLambda1ToCM); + TVector3 xB1 = transport(xB, boostLambda1ToCM); + TVector3 yB1 = transport(yB, boostLambda1ToCM); + + TVector3 zB2 = transport(zB, boostLambda2ToCM); + TVector3 xB2 = transport(xB, boostLambda2ToCM); + TVector3 yB2 = transport(yB, boostLambda2ToCM); + + // angles w.r.t. beam triad (same z_B convention for both Λ’s; no flips) + double c1B = n1.Dot(zB1), c2B = n2.Dot(zB2); + double s1B = std::sqrt(std::max(0.0, 1.0 - c1B * c1B)); + double s2B = std::sqrt(std::max(0.0, 1.0 - c2B * c2B)); + double phi1B = std::atan2(n1.Dot(yB1), n1.Dot(xB1)); + double phi2B = std::atan2(n2.Dot(yB2), n2.Dot(xB2)); + + // beam correlation + double cosDeltaBeam = c1B * c2B + s1B * s2B * std::cos(phi1B - phi2B); + if (cosDeltaBeam > 1.0) + cosDeltaBeam = 1.0; + if (cosDeltaBeam < -1.0) + cosDeltaBeam = -1.0; - auto costhetaz1costhetaz2 = (proton1LambdaRF.Pz() * proton2LambdaRF.Pz()) / (proton1LambdaRF.P() * proton2LambdaRF.P()); + auto cosThetaDiff = -999.0; + auto costhetaz1costhetaz2 = -999.0; + if (cosDef == 0) { + cosThetaDiff = proton1LambdaRF.Vect().Unit().Dot(proton2LambdaRF.Vect().Unit()); + costhetaz1costhetaz2 = (proton1LambdaRF.Pz() * proton2LambdaRF.Pz()) / (proton1LambdaRF.P() * proton2LambdaRF.P()); + } else { + cosThetaDiff = cosDelta; + costhetaz1costhetaz2 = cosDeltaBeam; + } double deltaPhi = std::abs(RecoDecay::constrainAngle(particle1Dummy.Phi(), 0.0F, harmonic) - RecoDecay::constrainAngle(particle2Dummy.Phi(), 0.0F, harmonic)); double deltaEta = particle1Dummy.Eta() - particle2Dummy.Eta(); From bd636ac04c2df156a957957c901a9d8b5088a544 Mon Sep 17 00:00:00 2001 From: Nicolas Strangmann <77485327+nstrangm@users.noreply.github.com> Date: Tue, 23 Sep 2025 23:22:47 +0200 Subject: [PATCH 514/986] [PWGEM/PhotonMeson] Add FT0 QC and FT0C centrality estimator to BC wise GG (#13104) Co-authored-by: Nicolas Strangmann --- PWGEM/PhotonMeson/DataModel/bcWiseTables.h | 43 +++++----- .../TableProducer/bcWiseClusterSkimmer.cxx | 62 ++++++++++---- .../Tasks/emcalBcWiseGammaGamma.cxx | 85 +++++++++++-------- 3 files changed, 115 insertions(+), 75 deletions(-) diff --git a/PWGEM/PhotonMeson/DataModel/bcWiseTables.h b/PWGEM/PhotonMeson/DataModel/bcWiseTables.h index a306d5645ce..efd3f9a2007 100644 --- a/PWGEM/PhotonMeson/DataModel/bcWiseTables.h +++ b/PWGEM/PhotonMeson/DataModel/bcWiseTables.h @@ -36,7 +36,7 @@ enum Observable { kNCells, kM02, kTime, - kFT0MCent, + kCent, kZVtx, kFT0Amp, kpT, @@ -54,7 +54,7 @@ const float downscalingFactors[nObservables]{ 1E0, // Number of cells 1E4, // M02 1E2, // Cluster time - 2E0, // FT0M centrality + 2E0, // FT0 centrality 1E3, // Z-vertex position 1E-1, // FT0M amplitude 1E3, // MC pi0 pt @@ -64,37 +64,36 @@ const float downscalingFactors[nObservables]{ namespace bcwisebc { -DECLARE_SOA_COLUMN(HasFT0, hasFT0, bool); //! has_foundFT0() -DECLARE_SOA_COLUMN(HasTVX, hasTVX, bool); //! has the TVX trigger flag -DECLARE_SOA_COLUMN(HaskTVXinEMC, haskTVXinEMC, bool); //! kTVXinEMC -DECLARE_SOA_COLUMN(HasEMCCell, hasEMCCell, bool); //! at least one EMCal cell in the BC -DECLARE_SOA_COLUMN(StoredCentrality, storedCentrality, uint8_t); //! FT0M centrality (0-100) (x2) -DECLARE_SOA_COLUMN(StoredFT0MAmplitude, storedFT0MAmplitude, uint16_t); //! ft0a+c amplitude -DECLARE_SOA_COLUMN(StoredMu, storedMu, uint16_t); //! probability of TVX collision per BC (x1000) -DECLARE_SOA_COLUMN(StoredTimeSinceSOF, storedTimeSinceSOF, uint16_t); //! time since decreation of ADJUST in seconds (x2) - -DECLARE_SOA_DYNAMIC_COLUMN(Centrality, centrality, [](uint8_t storedcentrality) -> float { return std::nextafter(storedcentrality / emdownscaling::downscalingFactors[emdownscaling::kFT0MCent], std::numeric_limits::infinity()); }); //! Centrality (0-100) -DECLARE_SOA_DYNAMIC_COLUMN(FT0MAmplitude, ft0Amplitude, [](uint16_t storedFT0MAmplitude) -> float { return std::nextafter(storedFT0MAmplitude / emdownscaling::downscalingFactors[emdownscaling::kFT0Amp], std::numeric_limits::infinity()); }); //! FT0M amplitude -DECLARE_SOA_DYNAMIC_COLUMN(Mu, mu, [](uint16_t storedMu) -> float { return std::nextafter(storedMu / emdownscaling::downscalingFactors[emdownscaling::kMu], std::numeric_limits::infinity()); }); //! probability of TVX collision per BC +DECLARE_SOA_COLUMN(HasFT0, hasFT0, bool); //! has_foundFT0() +DECLARE_SOA_COLUMN(HasTVX, hasTVX, bool); //! has the TVX trigger flag +DECLARE_SOA_COLUMN(HaskTVXinEMC, haskTVXinEMC, bool); //! kTVXinEMC +DECLARE_SOA_COLUMN(HasEMCCell, hasEMCCell, bool); //! at least one EMCal cell in the BC +DECLARE_SOA_COLUMN(StoredFT0CCentrality, storedFt0CCentrality, uint8_t); //! FT0C centrality (0-100) (x2) +DECLARE_SOA_COLUMN(StoredFT0MCentrality, storedFT0MCentrality, uint8_t); //! FT0M centrality (0-100) (x2) +DECLARE_SOA_COLUMN(StoredFT0MAmplitude, storedFT0MAmplitude, uint16_t); //! ft0a+c amplitude +DECLARE_SOA_COLUMN(StoredMu, storedMu, uint16_t); //! probability of TVX collision per BC (x1000) +DECLARE_SOA_COLUMN(StoredTimeSinceSOF, storedTimeSinceSOF, uint16_t); //! time since decreation of ADJUST in seconds (x2) + +DECLARE_SOA_DYNAMIC_COLUMN(FT0CCentrality, ft0cCentrality, [](uint8_t storedft0ccentrality) -> float { return std::nextafter(storedft0ccentrality / emdownscaling::downscalingFactors[emdownscaling::kCent], std::numeric_limits::infinity()); }); //! Centrality (0-100) +DECLARE_SOA_DYNAMIC_COLUMN(FT0MCentrality, ft0mCentrality, [](uint8_t storedft0mcentrality) -> float { return std::nextafter(storedft0mcentrality / emdownscaling::downscalingFactors[emdownscaling::kCent], std::numeric_limits::infinity()); }); //! Centrality (0-100) +DECLARE_SOA_DYNAMIC_COLUMN(FT0MAmplitude, ft0Amplitude, [](uint16_t storedFT0MAmplitude) -> float { return std::nextafter(storedFT0MAmplitude / emdownscaling::downscalingFactors[emdownscaling::kFT0Amp], std::numeric_limits::infinity()); }); //! FT0M amplitude +DECLARE_SOA_DYNAMIC_COLUMN(Mu, mu, [](uint16_t storedMu) -> float { return std::nextafter(storedMu / emdownscaling::downscalingFactors[emdownscaling::kMu], std::numeric_limits::infinity()); }); //! probability of TVX collision per BC DECLARE_SOA_DYNAMIC_COLUMN(TimeSinceSOF, timeSinceSOF, [](uint16_t storedTimeSinceSOF) -> float { return std::nextafter(storedTimeSinceSOF / emdownscaling::downscalingFactors[emdownscaling::kTimeSinceSOF], std::numeric_limits::infinity()); }); //! probability of TVX collision per BC } // namespace bcwisebc DECLARE_SOA_TABLE(BCWiseBCs, "AOD", "BCWISEBC", //! table of bc wise centrality estimation and event selection input - o2::soa::Index<>, bcwisebc::HasFT0, bcwisebc::HasTVX, bcwisebc::HaskTVXinEMC, bcwisebc::HasEMCCell, bcwisebc::StoredCentrality, - bcwisebc::StoredFT0MAmplitude, bcwisebc::StoredMu, bcwisebc::StoredTimeSinceSOF, bcwisebc::Centrality, bcwisebc::FT0MAmplitude, bcwisebc::Mu, bcwisebc::TimeSinceSOF); + o2::soa::Index<>, bcwisebc::HasFT0, bcwisebc::HasTVX, bcwisebc::HaskTVXinEMC, bcwisebc::HasEMCCell, bcwisebc::StoredFT0CCentrality, bcwisebc::StoredFT0MCentrality, + bcwisebc::StoredFT0MAmplitude, bcwisebc::StoredMu, bcwisebc::StoredTimeSinceSOF, bcwisebc::FT0CCentrality, bcwisebc::FT0MCentrality, bcwisebc::FT0MAmplitude, bcwisebc::Mu, bcwisebc::TimeSinceSOF); DECLARE_SOA_INDEX_COLUMN(BCWiseBC, bcWiseBC); //! bunch crossing ID used as index namespace bcwisecollision { -DECLARE_SOA_COLUMN(StoredCentrality, storedCentrality, uint8_t); //! FT0M centrality (0-100) (x2) -DECLARE_SOA_COLUMN(StoredZVtx, storedZVtx, int16_t); //! Z-vertex position (x1000) +DECLARE_SOA_COLUMN(StoredZVtx, storedZVtx, int16_t); //! Z-vertex position (x1000) -DECLARE_SOA_DYNAMIC_COLUMN(Centrality, centrality, [](uint8_t storedcentrality) -> float { return std::nextafter(storedcentrality / emdownscaling::downscalingFactors[emdownscaling::kFT0MCent], std::numeric_limits::infinity()); }); //! Centrality (0-100) -DECLARE_SOA_DYNAMIC_COLUMN(ZVtx, zVtx, [](int16_t storedzvtx) -> float { return storedzvtx / emdownscaling::downscalingFactors[emdownscaling::kZVtx]; }); //! Centrality (0-100) +DECLARE_SOA_DYNAMIC_COLUMN(ZVtx, zVtx, [](int16_t storedzvtx) -> float { return storedzvtx / emdownscaling::downscalingFactors[emdownscaling::kZVtx]; }); //! Z-Vertex } // namespace bcwisecollision DECLARE_SOA_TABLE(BCWiseCollisions, "AOD", "BCWISECOLL", //! table of skimmed EMCal clusters - o2::soa::Index<>, BCWiseBCId, bcwisecollision::StoredCentrality, bcwisecollision::StoredZVtx, - bcwisecollision::Centrality, bcwisecollision::ZVtx); + o2::soa::Index<>, BCWiseBCId, bcwisecollision::StoredZVtx, bcwisecollision::ZVtx); namespace bcwisecluster { diff --git a/PWGEM/PhotonMeson/TableProducer/bcWiseClusterSkimmer.cxx b/PWGEM/PhotonMeson/TableProducer/bcWiseClusterSkimmer.cxx index ab6bba76b3e..b193c642175 100644 --- a/PWGEM/PhotonMeson/TableProducer/bcWiseClusterSkimmer.cxx +++ b/PWGEM/PhotonMeson/TableProducer/bcWiseClusterSkimmer.cxx @@ -41,9 +41,9 @@ using namespace o2::aod::emdownscaling; using namespace o2::framework; using namespace o2::framework::expressions; -using MyCollisions = soa::Join; -using MyMCCollisions = soa::Join; -using MyBCs = soa::Join; +using MyCollisions = soa::Join; +using MyMCCollisions = soa::Join; +using MyBCs = soa::Join; using SelectedUniqueClusters = soa::Filtered; // Clusters from collisions with only one collision in the BC using SelectedUniqueMCClusters = soa::Filtered>; // Clusters from collisions with only one collision in the BC @@ -98,12 +98,20 @@ struct bcWiseClusterSkimmer { { const int nEventBins = 6; mHistManager.add("nBCs", "Number of BCs;;#bf{#it{N}_{BCs}}", HistType::kTH1F, {{nEventBins, -0.5, 5.5}}); - const TString binLabels[nEventBins] = {"All", "FT0", "TVX", "kTVXinEMC", "Cell", "NoBorder"}; + const TString binLabels[nEventBins] = {"All", "FT0", "TVX", "kTVXinEMC", "Cell", "HasMCColl"}; for (int iBin = 0; iBin < nEventBins; iBin++) mHistManager.get(HIST("nBCs"))->GetXaxis()->SetBinLabel(iBin + 1, binLabels[iBin]); mHistManager.add("CentralityVsGenMultiplicity", "Centrality vs number of generated MC particles;Centrality;#bf{#it{N}_{gen}}", HistType::kTH2F, {{102, 0., 102}, cfgMultiplicityBinning}); + mHistManager.add("CentralityFT0CVsM", "Centrality of FT0C vs FT0M;FT0C Cent;FT0M Cent", HistType::kTH2F, {{102, 0., 102}, {102, 0., 102}}); mHistManager.add("BCCentVsCollCent", "Centrality of the BC vs Centrality of the collision;BC Centrality;Collision Centrality", HistType::kTH2F, {{102, 0., 102}, {102, 0., 102}}); + mHistManager.add("BCHasFT0FoundFT0", "BCHasFT0FoundFT0;BC has FT0;BC has found FT0", HistType::kTH2F, {{1000, -2., 50000}, {1000, -2., 50000}}); + mHistManager.add("BCFoundFT0Diff", "BCFoundFT0Diff;BC_{ID}^{found FT0} - BC_{ID}^{FT0}", HistType::kTH1F, {{200001, -100000.5, 100000.5}}); + mHistManager.add("BCIDOfMCColl", "BCIDOfMCColl;BCID", HistType::kTH1F, {{4001, -0.5, 4000.5}}); + mHistManager.add("BCIDOfMCCollButNoFT0", "BCIDOfMCCollButNoFT0;BCID", HistType::kTH1F, {{4001, -0.5, 4000.5}}); + + mHistManager.add("MCZVtx", "Vertex position of MC collision;#bf{z_{vtx}^{MC} (cm)};#bf{#it{N}_{BCs}}", HistType::kTH1F, {{2000, -100, 100}}); + mHistManager.add("MCZVtx_TVX", "Vertex position of MC collision;#bf{z_{vtx}^{MC} (cm)};#bf{#it{N}_{BCs}}", HistType::kTH1F, {{2000, -100, 100}}); LOG(info) << "BC wise cluster skimmer cuts:"; LOG(info) << "------------------------------------"; @@ -233,14 +241,29 @@ struct bcWiseClusterSkimmer { return mu; } - void processEventProperties(const auto& bc, const auto& collisionsInBC, const auto& cellsInBC) + void processEventProperties(const auto& bc, const auto& collisionsInBC, const auto& cellsInBC, const bool hasMCCollision = false) { - bool hasFT0 = bc.has_foundFT0(); + bool hasFT0 = bc.has_ft0(); + bool hasFoundFT0 = bc.has_foundFT0(); + int foundFT0ID = hasFoundFT0 ? bc.foundFT0().bcId() : -1; + int FT0ID = hasFT0 ? bc.ft0().bcId() : -1; + mHistManager.fill(HIST("BCHasFT0FoundFT0"), static_cast(FT0ID), static_cast(foundFT0ID)); + mHistManager.fill(HIST("BCFoundFT0Diff"), static_cast(foundFT0ID - FT0ID)); + + auto bcIDInOrbit = bc.globalBC() % 3564; + + if (hasMCCollision) { + mHistManager.fill(HIST("BCIDOfMCColl"), static_cast(bcIDInOrbit)); + if (!hasFoundFT0) { + mHistManager.fill(HIST("BCIDOfMCCollButNoFT0"), static_cast(bcIDInOrbit)); + } + } + bool hasTVX = bc.selection_bit(aod::evsel::kIsTriggerTVX); bool haskTVXinEMC = bc.alias_bit(kTVXinEMC); bool hasEMCCell = cellsInBC.size() > 0; mHistManager.fill(HIST("nBCs"), 0); - if (hasFT0) + if (hasFoundFT0) mHistManager.fill(HIST("nBCs"), 1); if (hasTVX) mHistManager.fill(HIST("nBCs"), 2); @@ -248,23 +271,26 @@ struct bcWiseClusterSkimmer { mHistManager.fill(HIST("nBCs"), 3); if (hasEMCCell) mHistManager.fill(HIST("nBCs"), 4); + if (hasMCCollision) + mHistManager.fill(HIST("nBCs"), 5); if (cfgStoreMu || cfgStoreTime) setLHCIFData(bc); double mu = cfgStoreMu ? calculateMu(bc) : 0.; float timeSinceSOF = cfgStoreTime ? (bc.timestamp() - mLHCIFdata->getFillNumberTime()) / 1e3 : 0.; // Convert to seconds - float ft0Amp = hasFT0 ? bc.foundFT0().sumAmpA() + bc.foundFT0().sumAmpC() : 0.; + float ft0Amp = hasFoundFT0 ? bc.foundFT0().sumAmpA() + bc.foundFT0().sumAmpC() : 0.; double centralityOfCollision = 101.5; if (collisionsInBC.size() > 0) - centralityOfCollision = collisionsInBC.iteratorAt(0).centFT0M(); - double centralityOfBC = bc.centFT0M(); + centralityOfCollision = collisionsInBC.iteratorAt(0).centFT0C(); + double centralityOfBC = bc.centFT0C(); mHistManager.fill(HIST("BCCentVsCollCent"), centralityOfBC, centralityOfCollision); + mHistManager.fill(HIST("CentralityFT0CVsM"), centralityOfBC, bc.centFT0M()); - bcTable(hasFT0, hasTVX, haskTVXinEMC, hasEMCCell, convertForStorage(centralityOfBC, kFT0MCent), convertForStorage(ft0Amp, kFT0Amp), convertForStorage(mu, kMu), convertForStorage(timeSinceSOF, kTimeSinceSOF)); + bcTable(hasFoundFT0, hasTVX, haskTVXinEMC, hasEMCCell, convertForStorage(centralityOfBC, kCent), convertForStorage(bc.centFT0M(), kCent), convertForStorage(ft0Amp, kFT0Amp), convertForStorage(mu, kMu), convertForStorage(timeSinceSOF, kTimeSinceSOF)); for (const auto& collision : collisionsInBC) - collisionTable(bcTable.lastIndex(), convertForStorage(collision.centFT0M(), kFT0MCent), convertForStorage(collision.posZ(), kZVtx)); + collisionTable(bcTable.lastIndex(), convertForStorage(collision.posZ(), kZVtx)); } template @@ -333,10 +359,14 @@ struct bcWiseClusterSkimmer { auto collisionsInBC = collisions.sliceBy(perFoundBC, bc.globalIndex()); auto cellsInBC = cells.sliceBy(cellsPerBC, bc.globalIndex()); - processEventProperties(bc, collisionsInBC, cellsInBC); - auto mcCollisionsBC = mcCollisions.sliceBy(mcCollperBC, bc.globalIndex()); + + processEventProperties(bc, collisionsInBC, cellsInBC, mcCollisionsBC.size() > 0); + for (const auto& mcCollision : mcCollisionsBC) { + mHistManager.fill(HIST("MCZVtx"), mcCollision.posZ()); + if (bc.selection_bit(aod::evsel::kIsTriggerTVX)) + mHistManager.fill(HIST("MCZVtx_TVX"), mcCollision.posZ()); auto mcParticlesInColl = mcParticles.sliceBy(perMcCollision, mcCollision.globalIndex()); mHistManager.fill(HIST("CentralityVsGenMultiplicity"), bc.centFT0M(), mcParticlesInColl.size()); for (const auto& mcParticle : mcParticlesInColl) { @@ -358,11 +388,11 @@ struct bcWiseClusterSkimmer { if (collisionsInBC.size() == 1) { auto clustersInBC = uClusters.sliceBy(perCol, collisionsInBC.begin().globalIndex()); processClusters(clustersInBC, bcTable.lastIndex()); - processClusterMCInfo(clustersInBC, bc.globalIndex(), mcParticles); + processClusterMCInfo(clustersInBC, bcTable.lastIndex(), mcParticles); } else { auto clustersInBC = aClusters.sliceBy(perBC, bc.globalIndex()); processClusters(clustersInBC, bcTable.lastIndex()); - processClusterMCInfo(clustersInBC, bc.globalIndex(), mcParticles); + processClusterMCInfo(clustersInBC, bcTable.lastIndex(), mcParticles); } fMapPi0Index.clear(); fMapEtaIndex.clear(); diff --git a/PWGEM/PhotonMeson/Tasks/emcalBcWiseGammaGamma.cxx b/PWGEM/PhotonMeson/Tasks/emcalBcWiseGammaGamma.cxx index 0aacd233324..efbc38d799c 100644 --- a/PWGEM/PhotonMeson/Tasks/emcalBcWiseGammaGamma.cxx +++ b/PWGEM/PhotonMeson/Tasks/emcalBcWiseGammaGamma.cxx @@ -45,6 +45,7 @@ struct EmcalBcWiseGammaGamma { Configurable cfgRequirekTVXinEMC{"cfgRequirekTVXinEMC", true, "Reconstruct mesons only in kTVXinEMC triggered BCs"}; Configurable cfgRequireEMCCell{"cfgRequireEMCCell", true, "Reconstruct mesons only in BCs containing at least one EMCal cell (workaround for kTVXinEMC trigger)"}; Configurable cfgSelectOnlyUniqueAmbiguous{"cfgSelectOnlyUniqueAmbiguous", 0, "0: all clusters, 1: only unique clusters, 2: only ambiguous clusters"}; + Configurable cfgCentralityEstimator{"cfgCentralityEstimator", 0, "0: FT0C, 1: FT0M"}; Configurable cfgClusterDefinition{"cfgClusterDefinition", 13, "Clusterizer to be selected, e.g. 13 for kV3MostSplitLowSeed"}; Configurable cfgMinClusterEnergy{"cfgMinClusterEnergy", 700, "Minimum energy of selected clusters (MeV)"}; @@ -125,6 +126,16 @@ struct EmcalBcWiseGammaGamma { } } + float getCentrality(const auto& bc) + { + if (cfgCentralityEstimator == 0) + return bc.ft0cCentrality(); + else if (cfgCentralityEstimator == 1) + return bc.ft0mCentrality(); + else + throw std::runtime_error("Unknown centrality estimator selected"); + } + /// \brief returns if cluster is too close to edge of EMCal bool isTooCloseToEdge(const int cellID, const int DistanceToBorder = 1) { @@ -143,37 +154,37 @@ struct EmcalBcWiseGammaGamma { void fillEventHists(const auto& bc, const auto& collisions, const auto& clusters) { - mHistManager.fill(HIST("Event/nBCs"), 0, bc.centrality()); + mHistManager.fill(HIST("Event/nBCs"), 0, getCentrality(bc)); float mu = bc.mu(); mHistManager.fill(HIST("Event/Mu"), mu); mHistManager.fill(HIST("Event/TimeSinceSOF"), bc.timeSinceSOF() / 60.); double p = mu > 0.001 ? mu / (1 - std::exp(-mu)) : 1.; // No pile-up for small mu (protection against division by zero) - mHistManager.fill(HIST("Event/nCollisions"), 0, bc.centrality(), p); + mHistManager.fill(HIST("Event/nCollisions"), 0, getCentrality(bc), p); if (bc.hasFT0()) { - mHistManager.fill(HIST("Event/nBCs"), 1, bc.centrality()); - mHistManager.fill(HIST("Event/nCollisions"), 1, bc.centrality(), p); + mHistManager.fill(HIST("Event/nBCs"), 1, getCentrality(bc)); + mHistManager.fill(HIST("Event/nCollisions"), 1, getCentrality(bc), p); } if (bc.hasTVX()) { - mHistManager.fill(HIST("Event/nBCs"), 2, bc.centrality()); - mHistManager.fill(HIST("Event/nCollisions"), 2, bc.centrality(), p); + mHistManager.fill(HIST("Event/nBCs"), 2, getCentrality(bc)); + mHistManager.fill(HIST("Event/nCollisions"), 2, getCentrality(bc), p); } if (bc.haskTVXinEMC()) { - mHistManager.fill(HIST("Event/nBCs"), 3, bc.centrality()); - mHistManager.fill(HIST("Event/nCollisions"), 3, bc.centrality(), p); + mHistManager.fill(HIST("Event/nBCs"), 3, getCentrality(bc)); + mHistManager.fill(HIST("Event/nCollisions"), 3, getCentrality(bc), p); } if (bc.hasEMCCell()) { - mHistManager.fill(HIST("Event/nBCs"), 4, bc.centrality()); - mHistManager.fill(HIST("Event/nCollisions"), 4, bc.centrality(), p); + mHistManager.fill(HIST("Event/nBCs"), 4, getCentrality(bc)); + mHistManager.fill(HIST("Event/nCollisions"), 4, getCentrality(bc), p); } if (clusters.size() > 0) { - mHistManager.fill(HIST("Event/nBCs"), 5, bc.centrality()); - mHistManager.fill(HIST("Event/nCollisions"), 5, bc.centrality(), p); + mHistManager.fill(HIST("Event/nBCs"), 5, getCentrality(bc)); + mHistManager.fill(HIST("Event/nCollisions"), 5, getCentrality(bc), p); } - mHistManager.fill(HIST("Event/Centrality"), bc.centrality()); - mHistManager.fill(HIST("Event/CentralityVsAmplitude"), bc.centrality(), bc.ft0Amplitude()); + mHistManager.fill(HIST("Event/Centrality"), getCentrality(bc)); + mHistManager.fill(HIST("Event/CentralityVsAmplitude"), getCentrality(bc), bc.ft0Amplitude()); - mHistManager.fill(HIST("Event/nCollPerBC"), collisions.size(), bc.centrality()); + mHistManager.fill(HIST("Event/nCollPerBC"), collisions.size(), getCentrality(bc)); if (collisions.size() == 2) { mHistManager.fill(HIST("Event/Z1VsZ2"), collisions.iteratorAt(0).zVtx(), collisions.iteratorAt(1).zVtx()); mHistManager.fill(HIST("Event/dZ"), collisions.iteratorAt(0).zVtx() - collisions.iteratorAt(1).zVtx()); @@ -205,7 +216,7 @@ struct EmcalBcWiseGammaGamma { if (openingAngle12 < cfgMinOpenAngle) continue; - mHistManager.fill(HIST("GG/invMassVsPt"), v12.M(), v12.Pt(), bc.centrality()); + mHistManager.fill(HIST("GG/invMassVsPt"), v12.M(), v12.Pt(), getCentrality(bc)); if (clusters.size() < 3) continue; @@ -241,7 +252,7 @@ struct EmcalBcWiseGammaGamma { ROOT::Math::PtEtaPhiMVector vBG = v3 + vi; - mHistManager.fill(HIST("GG/invMassVsPtBackground"), vBG.M(), vBG.Pt(), bc.centrality()); + mHistManager.fill(HIST("GG/invMassVsPtBackground"), vBG.M(), vBG.Pt(), getCentrality(bc)); } } } @@ -265,25 +276,25 @@ struct EmcalBcWiseGammaGamma { if (!g1.isEta()) { const auto& mcPi0 = mcPi0s.iteratorAt(g1.mesonID() - mcPi0s.offset()); - mHistManager.fill(HIST("True/pi0_PtRecVsPtTrue"), v12.Pt(), mcPi0.pt(), bc.centrality()); + mHistManager.fill(HIST("True/pi0_PtRecVsPtTrue"), v12.Pt(), mcPi0.pt(), getCentrality(bc)); if (mcPi0.isPrimary()) - mHistManager.fill(HIST("True/pi0_invMassVsPt_Primary"), v12.M(), v12.Pt(), bc.centrality()); + mHistManager.fill(HIST("True/pi0_invMassVsPt_Primary"), v12.M(), v12.Pt(), getCentrality(bc)); else if (mcPi0.isFromWD()) - mHistManager.fill(HIST("True/pi0_invMassVsPt_Secondary"), v12.M(), v12.Pt(), bc.centrality()); + mHistManager.fill(HIST("True/pi0_invMassVsPt_Secondary"), v12.M(), v12.Pt(), getCentrality(bc)); else - mHistManager.fill(HIST("True/pi0_invMassVsPt_HadronicShower"), v12.M(), v12.Pt(), bc.centrality()); + mHistManager.fill(HIST("True/pi0_invMassVsPt_HadronicShower"), v12.M(), v12.Pt(), getCentrality(bc)); } else { const auto& mcEta = mcEtas.iteratorAt(g1.mesonID() - mcEtas.offset()); - mHistManager.fill(HIST("True/eta_PtRecVsPtTrue"), v12.Pt(), mcEta.pt(), bc.centrality()); + mHistManager.fill(HIST("True/eta_PtRecVsPtTrue"), v12.Pt(), mcEta.pt(), getCentrality(bc)); if (mcEta.isPrimary()) - mHistManager.fill(HIST("True/eta_invMassVsPt_Primary"), v12.M(), v12.Pt(), bc.centrality()); + mHistManager.fill(HIST("True/eta_invMassVsPt_Primary"), v12.M(), v12.Pt(), getCentrality(bc)); else if (mcEta.isFromWD()) - mHistManager.fill(HIST("True/eta_invMassVsPt_Secondary"), v12.M(), v12.Pt(), bc.centrality()); + mHistManager.fill(HIST("True/eta_invMassVsPt_Secondary"), v12.M(), v12.Pt(), getCentrality(bc)); else - mHistManager.fill(HIST("True/eta_invMassVsPt_HadronicShower"), v12.M(), v12.Pt(), bc.centrality()); + mHistManager.fill(HIST("True/eta_invMassVsPt_HadronicShower"), v12.M(), v12.Pt(), getCentrality(bc)); } } } @@ -307,28 +318,28 @@ struct EmcalBcWiseGammaGamma { { for (const auto& mcPi0 : mcPi0s) { if (mcPi0.isPrimary()) { - mHistManager.fill(HIST("Generated/pi0_AllBCs"), mcPi0.pt(), bc.centrality()); + mHistManager.fill(HIST("Generated/pi0_AllBCs"), mcPi0.pt(), getCentrality(bc)); if (bc.hasFT0()) - mHistManager.fill(HIST("Generated/pi0_FT0"), mcPi0.pt(), bc.centrality()); + mHistManager.fill(HIST("Generated/pi0_FT0"), mcPi0.pt(), getCentrality(bc)); if (bc.hasTVX()) - mHistManager.fill(HIST("Generated/pi0_TVX"), mcPi0.pt(), bc.centrality()); + mHistManager.fill(HIST("Generated/pi0_TVX"), mcPi0.pt(), getCentrality(bc)); if (bc.haskTVXinEMC()) - mHistManager.fill(HIST("Generated/pi0_kTVXinEMC"), mcPi0.pt(), bc.centrality()); + mHistManager.fill(HIST("Generated/pi0_kTVXinEMC"), mcPi0.pt(), getCentrality(bc)); if (mcPi0.isAccepted() && bc.haskTVXinEMC()) - mHistManager.fill(HIST("Accepted/pi0_kTVXinEMC"), mcPi0.pt(), bc.centrality()); + mHistManager.fill(HIST("Accepted/pi0_kTVXinEMC"), mcPi0.pt(), getCentrality(bc)); } } for (const auto& mcEta : mcEtas) { if (mcEta.isPrimary()) { - mHistManager.fill(HIST("Generated/eta_AllBCs"), mcEta.pt(), bc.centrality()); + mHistManager.fill(HIST("Generated/eta_AllBCs"), mcEta.pt(), getCentrality(bc)); if (bc.hasFT0()) - mHistManager.fill(HIST("Generated/eta_FT0"), mcEta.pt(), bc.centrality()); + mHistManager.fill(HIST("Generated/eta_FT0"), mcEta.pt(), getCentrality(bc)); if (bc.hasTVX()) - mHistManager.fill(HIST("Generated/eta_TVX"), mcEta.pt(), bc.centrality()); + mHistManager.fill(HIST("Generated/eta_TVX"), mcEta.pt(), getCentrality(bc)); if (bc.haskTVXinEMC()) - mHistManager.fill(HIST("Generated/eta_kTVXinEMC"), mcEta.pt(), bc.centrality()); + mHistManager.fill(HIST("Generated/eta_kTVXinEMC"), mcEta.pt(), getCentrality(bc)); if (mcEta.isAccepted() && bc.haskTVXinEMC()) - mHistManager.fill(HIST("Accepted/eta_kTVXinEMC"), mcEta.pt(), bc.centrality()); + mHistManager.fill(HIST("Accepted/eta_kTVXinEMC"), mcEta.pt(), getCentrality(bc)); } } } @@ -340,7 +351,7 @@ struct EmcalBcWiseGammaGamma { fillEventHists(bc, collisions, clusters); - fillClusterHists(clusters, bc.centrality()); + fillClusterHists(clusters, getCentrality(bc)); reconstructMesons(clusters, bc); } @@ -356,7 +367,7 @@ struct EmcalBcWiseGammaGamma { return; for (const auto& cluster : clusters) - mHistManager.fill(HIST("True/clusterERecVsETrue"), cluster.e(), cluster.trueE(), bc.centrality()); + mHistManager.fill(HIST("True/clusterERecVsETrue"), cluster.e(), cluster.trueE(), getCentrality(bc)); reconstructTrueMesons(clusters, mcPi0s, mcEtas, bc); } From 2c3a7e7c3bbb279ad32b5fc0ef5eda9d6b263112 Mon Sep 17 00:00:00 2001 From: ariedel-cern <85537041+ariedel-cern@users.noreply.github.com> Date: Tue, 23 Sep 2025 23:45:44 +0200 Subject: [PATCH 515/986] [PWGCF] add generic pair tasks (#13096) --- PWGCF/Femto/Core/baseSelection.h | 5 +- PWGCF/Femto/Core/closePairRejection.h | 265 +++++++++++++++ PWGCF/Femto/Core/collisionBuilder.h | 53 +-- PWGCF/Femto/Core/collisionHistManager.h | 23 +- PWGCF/Femto/Core/dataTypes.h | 12 +- PWGCF/Femto/Core/femtoUtils.h | 6 + PWGCF/Femto/Core/modes.h | 21 +- PWGCF/Femto/Core/pairBuilder.h | 302 +++++++++++++++++ PWGCF/Femto/Core/pairCleaner.h | 64 ++++ PWGCF/Femto/Core/pairHistManager.h | 226 +++++++++++++ PWGCF/Femto/Core/pairProcessHelpers.h | 310 ++++++++++++++++++ PWGCF/Femto/Core/partitions.h | 35 +- PWGCF/Femto/Core/trackBuilder.h | 3 +- PWGCF/Femto/Core/trackHistManager.h | 125 +++---- PWGCF/Femto/Core/v0HistManager.h | 6 +- PWGCF/Femto/DataModel/FemtoTables.h | 36 +- PWGCF/Femto/Tasks/CMakeLists.txt | 18 +- PWGCF/Femto/Tasks/femtoCascadeQa.cxx | 6 +- PWGCF/Femto/Tasks/femtoKinkQa.cxx | 4 +- PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx | 133 ++++++++ PWGCF/Femto/Tasks/femtoPairTrackV0.cxx | 198 +++++++++++ PWGCF/Femto/Tasks/femtoTrackQa.cxx | 7 +- .../Femto/Tasks/femtoTwotrackresonanceQa.cxx | 6 +- PWGCF/Femto/Tasks/femtoV0Qa.cxx | 4 +- 24 files changed, 1694 insertions(+), 174 deletions(-) create mode 100644 PWGCF/Femto/Core/closePairRejection.h create mode 100644 PWGCF/Femto/Core/pairBuilder.h create mode 100644 PWGCF/Femto/Core/pairCleaner.h create mode 100644 PWGCF/Femto/Core/pairHistManager.h create mode 100644 PWGCF/Femto/Core/pairProcessHelpers.h create mode 100644 PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx create mode 100644 PWGCF/Femto/Tasks/femtoPairTrackV0.cxx diff --git a/PWGCF/Femto/Core/baseSelection.h b/PWGCF/Femto/Core/baseSelection.h index e64f5d05665..2be9737422d 100644 --- a/PWGCF/Femto/Core/baseSelection.h +++ b/PWGCF/Femto/Core/baseSelection.h @@ -63,7 +63,7 @@ class BaseSelection if (static_cast(observableIndex) >= NumObservables) { LOG(fatal) << "Observable is not valid. Observable (index) has to be smaller than " << NumObservables; } - if (skipMostPermissiveBit) { + if (!selectionValues.empty() && skipMostPermissiveBit) { mNSelections += selectionValues.size() - 1; } else { mNSelections += selectionValues.size(); @@ -115,9 +115,6 @@ class BaseSelection /// \param observableIndex Index of the observable. void addSelection(int mode, int observableIndex) { - if (static_cast(observableIndex) >= NumObservables) { - LOG(fatal) << "Observable is not valid. Observable (index) has to be smaller than " << NumObservables; - } switch (mode) { case -1: // cut is optional and we store bit for the cut mNSelections += 1; diff --git a/PWGCF/Femto/Core/closePairRejection.h b/PWGCF/Femto/Core/closePairRejection.h new file mode 100644 index 00000000000..4a693b89267 --- /dev/null +++ b/PWGCF/Femto/Core/closePairRejection.h @@ -0,0 +1,265 @@ +// Copyright 2019-2022 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 closePairRejection.h +/// \brief Definition of ClosePairRejection class +/// \author Anton Riedel, TU München, anton.riedel@tum.de + +#ifndef PWGCF_FEMTO_CORE_CLOSEPAIRREJECTION_H_ +#define PWGCF_FEMTO_CORE_CLOSEPAIRREJECTION_H_ + +#include "PWGCF/Femto/Core/femtoUtils.h" +#include "PWGCF/Femto/Core/histManager.h" + +#include "Framework/HistogramRegistry.h" + +#include +#include +#include +#include +#include + +namespace o2::analysis::femto +{ +namespace closepairrejection +{ +// enum for track histograms +enum CprHist { + // kinemtics + kAverage, + kRadius0, + kRadius1, + kRadius2, + kRadius3, + kRadius4, + kRadius5, + kRadius6, + kRadius7, + kRadius8, + kCprHistogramLast +}; + +struct ConfCpr : o2::framework::ConfigurableGroup { + std::string prefix = std::string("ClosePairRejection"); + o2::framework::Configurable on{"on", true, "Turn on CPR"}; + o2::framework::Configurable detaMax{"detaMax", 0.01f, "Maximium deta"}; + o2::framework::Configurable dphistarMax{"dphistarMax", 0.01f, "Maximum dphistar"}; + o2::framework::ConfigurableAxis binningDeta{"binningDeta", {{500, -0.5, 0.5}}, "deta"}; + o2::framework::ConfigurableAxis binningDphistar{"binningDphistar", {{500, -0.5, 0.5}}, "dphi"}; +}; + +// tpc radii for computing phistar +constexpr int kNradii = 9; +constexpr std::array kTpcRadius = {85., 105., 125., 145., 165., 185., 205., 225., 245.}; + +// directory names +constexpr char PrefixTrackTrackSe[] = "CPR_TrackTrack/SE/"; +constexpr char PrefixTrackTrackMe[] = "CPR_TrackTrack/ME/"; +constexpr char PrefixTrackV0Se[] = "CPR_TrackV0/SE/"; +constexpr char PrefixTrackV0Me[] = "CPR_TrackV0/ME/"; + +// must be in sync with enum TrackVariables +// the enum gives the correct index in the array +constexpr std::array, kCprHistogramLast> HistTable = { + {{kAverage, o2::framework::kTH2F, "hAverage", "#Delta #eta vs #Delta #phi* (averaged over all radii); #Delta #eta; #Delta #phi*"}, + {kRadius0, o2::framework::kTH2F, "hRadius0", "Radius 0: #Delta #eta vs #Delta #phi*; #Delta #eta; #Delta #phi*"}, + {kRadius1, o2::framework::kTH2F, "hRadius1", "Radius 1: #Delta #eta vs #Delta #phi*; #Delta #eta; #Delta #phi*"}, + {kRadius2, o2::framework::kTH2F, "hRadius2", "Radius 2: #Delta #eta vs #Delta #phi*; #Delta #eta; #Delta #phi*"}, + {kRadius3, o2::framework::kTH2F, "hRadius3", "Radius 3: #Delta #eta vs #Delta #phi*; #Delta #eta; #Delta #phi*"}, + {kRadius4, o2::framework::kTH2F, "hRadius4", "Radius 4: #Delta #eta vs #Delta #phi*; #Delta #eta; #Delta #phi*"}, + {kRadius5, o2::framework::kTH2F, "hRadius5", "Radius 5: #Delta #eta vs #Delta #phi*; #Delta #eta; #Delta #phi*"}, + {kRadius6, o2::framework::kTH2F, "hRadius6", "Radius 6: #Delta #eta vs #Delta #phi*; #Delta #eta; #Delta #phi*"}, + {kRadius7, o2::framework::kTH2F, "hRadius7", "Radius 7: #Delta #eta vs #Delta #phi*; #Delta #eta; #Delta #phi*"}, + {kRadius8, o2::framework::kTH2F, "hRadius8", "Radius 8: #Delta #eta vs #Delta #phi*; #Delta #eta; #Delta #phi*"}}}; + +template +auto makeCprHistSpecMap(const T& confCpr) +{ + return std::map>{ + {kAverage, {confCpr.binningDeta, confCpr.binningDphistar}}, + {kRadius0, {confCpr.binningDeta, confCpr.binningDphistar}}, + {kRadius1, {confCpr.binningDeta, confCpr.binningDphistar}}, + {kRadius2, {confCpr.binningDeta, confCpr.binningDphistar}}, + {kRadius3, {confCpr.binningDeta, confCpr.binningDphistar}}, + {kRadius4, {confCpr.binningDeta, confCpr.binningDphistar}}, + {kRadius5, {confCpr.binningDeta, confCpr.binningDphistar}}, + {kRadius6, {confCpr.binningDeta, confCpr.binningDphistar}}, + {kRadius7, {confCpr.binningDeta, confCpr.binningDphistar}}, + {kRadius8, {confCpr.binningDeta, confCpr.binningDphistar}}}; +}; + +template +class CloseTrackRejection +{ + public: + CloseTrackRejection() = default; + virtual ~CloseTrackRejection() = default; + + void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int chargeTrack1, int chargeTrack2) + { + mDetaMax = detaMax; + mDphistarMax = dphistarMax; + + if (mDetaMax < o2::constants::math::Epsilon || mDphistarMax < o2::constants::math::Epsilon) { + LOG(fatal) << "Either DetaMax or DphistarMax are 0 or negative. Either turn off CPR or specify reasonable values. Breaking ..."; + } + mChargeTrack1 = chargeTrack1; + mChargeTrack2 = chargeTrack2; + + if (utils::sign(mChargeTrack1) != utils::sign(mChargeTrack2)) { + LOG(warn) << "CPR is truned on for tracks with opposite charge. Is this intended?"; + } + + mHistogramRegistry = registry; + + mHistogramRegistry->add(std::string(prefix) + GetHistNamev2(kAverage, HistTable), GetHistDesc(kAverage, HistTable), GetHistType(kAverage, HistTable), {specs.at(kAverage)}); + mHistogramRegistry->add(std::string(prefix) + GetHistNamev2(kRadius0, HistTable), GetHistDesc(kRadius0, HistTable), GetHistType(kRadius0, HistTable), {specs.at(kRadius0)}); + mHistogramRegistry->add(std::string(prefix) + GetHistNamev2(kRadius1, HistTable), GetHistDesc(kRadius1, HistTable), GetHistType(kRadius1, HistTable), {specs.at(kRadius1)}); + mHistogramRegistry->add(std::string(prefix) + GetHistNamev2(kRadius2, HistTable), GetHistDesc(kRadius2, HistTable), GetHistType(kRadius2, HistTable), {specs.at(kRadius2)}); + mHistogramRegistry->add(std::string(prefix) + GetHistNamev2(kRadius3, HistTable), GetHistDesc(kRadius3, HistTable), GetHistType(kRadius3, HistTable), {specs.at(kRadius3)}); + mHistogramRegistry->add(std::string(prefix) + GetHistNamev2(kRadius4, HistTable), GetHistDesc(kRadius4, HistTable), GetHistType(kRadius4, HistTable), {specs.at(kRadius4)}); + mHistogramRegistry->add(std::string(prefix) + GetHistNamev2(kRadius5, HistTable), GetHistDesc(kRadius5, HistTable), GetHistType(kRadius5, HistTable), {specs.at(kRadius5)}); + mHistogramRegistry->add(std::string(prefix) + GetHistNamev2(kRadius6, HistTable), GetHistDesc(kRadius6, HistTable), GetHistType(kRadius6, HistTable), {specs.at(kRadius6)}); + mHistogramRegistry->add(std::string(prefix) + GetHistNamev2(kRadius7, HistTable), GetHistDesc(kRadius7, HistTable), GetHistType(kRadius7, HistTable), {specs.at(kRadius7)}); + mHistogramRegistry->add(std::string(prefix) + GetHistNamev2(kRadius8, HistTable), GetHistDesc(kRadius8, HistTable), GetHistType(kRadius8, HistTable), {specs.at(kRadius8)}); + } + + void setMagField(float magField) { mMagField = magField; } + + template + void compute(const T1& track1, const T2& track2) + { + // reset values + mAverageDphistar = 0.f; + mDeta = 0.f; + mDphistar.fill(0.f); + + mDeta = track1.eta() - track2.eta(); + for (size_t i = 0; i < kTpcRadius.size(); i++) { + auto phistar1 = utils::dphistar(mMagField, kTpcRadius[i], mChargeTrack1, track1.pt(), track1.phi()); + auto phistar2 = utils::dphistar(mMagField, kTpcRadius[i], mChargeTrack2, track2.pt(), track2.phi()); + if (phistar1 && phistar2) { + // if the calculation for one phistar fails, keep the default value, which is 0 + // this makes it more likelier for the pair to be rejected sind the averave will be biased towards lower values + mDphistar.at(i) = phistar1.value() - phistar2.value(); + } + } + mAverageDphistar = std::accumulate(mDphistar.begin(), mDphistar.end(), 0.f) / mDphistar.size(); + } + + void fill() + { + // fill average hist + mHistogramRegistry->fill(HIST(prefix) + HIST(GetHistName(kAverage, HistTable)), mDeta, mAverageDphistar); + + // fill radii hists + mHistogramRegistry->fill(HIST(prefix) + HIST(GetHistName(kRadius0, HistTable)), mDeta, mDphistar.at(0)); + mHistogramRegistry->fill(HIST(prefix) + HIST(GetHistName(kRadius1, HistTable)), mDeta, mDphistar.at(1)); + mHistogramRegistry->fill(HIST(prefix) + HIST(GetHistName(kRadius2, HistTable)), mDeta, mDphistar.at(2)); + mHistogramRegistry->fill(HIST(prefix) + HIST(GetHistName(kRadius3, HistTable)), mDeta, mDphistar.at(3)); + mHistogramRegistry->fill(HIST(prefix) + HIST(GetHistName(kRadius4, HistTable)), mDeta, mDphistar.at(4)); + mHistogramRegistry->fill(HIST(prefix) + HIST(GetHistName(kRadius5, HistTable)), mDeta, mDphistar.at(5)); + mHistogramRegistry->fill(HIST(prefix) + HIST(GetHistName(kRadius6, HistTable)), mDeta, mDphistar.at(6)); + mHistogramRegistry->fill(HIST(prefix) + HIST(GetHistName(kRadius7, HistTable)), mDeta, mDphistar.at(7)); + mHistogramRegistry->fill(HIST(prefix) + HIST(GetHistName(kRadius8, HistTable)), mDeta, mDphistar.at(8)); + } + + bool isClosePair() const + { + return std::hypot(mAverageDphistar / mDphistarMax, mDeta / mDetaMax) < 1.f; + } + + private: + int mChargeTrack1 = 0; + int mChargeTrack2 = 0; + float mMagField = 0.f; + float mAverageDphistar = 0.f; + float mDeta = 0.f; + float mDetaMax = 0.f; + float mDphistarMax = 0.f; + std::array mDphistar = {0.f}; + + o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; +}; + +template +class ClosePairRejectionTrackTrack +{ + public: + void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int signTrack1, int absChargeTrack1, int signTrack2, int AbsChargeTrack2, bool isActivated) + { + mIsActivated = isActivated; + mCtr.init(registry, specs, detaMax, dphistarMax, signTrack1 * absChargeTrack1, signTrack2 * AbsChargeTrack2); + } + + void setMagField(float magField) { mCtr.setMagField(magField); } + template + void setPair(const T1& track1, const T2& track2) + { + mCtr.compute(track1, track2); + } + bool isClosePair() const { return mCtr.isClosePair(); } + void fill() { mCtr.fill(); } + bool isActivated() const { return mIsActivated; } + + private: + CloseTrackRejection mCtr; + bool mIsActivated = true; +}; + +template +class ClosePairRejectionTrackV0 // can also be used for any particle type that has pos/neg daughters, like resonances +{ + public: + void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int signTrack, int absChargeTrack, bool isActivated) + { + mIsActivated = isActivated; + mSignTrack = signTrack; + + // initialize CPR with charge of the track and the same charge for the daughter particle + // absolute charge of the daughter track will be 1, so we can pass the sign directly + mCtr.init(registry, specs, detaMax, dphistarMax, signTrack * absChargeTrack, signTrack); + } + + void setMagField(float magField) + { + mCtr.setMagField(magField); + } + template + void setPair(const T1& track, const T2& v0, const T3 /*trackTable*/) + { + if (mSignTrack == 1) { + auto daughter = v0.template posDau_as(); + mCtr.compute(track, daughter); + } else if (mSignTrack == -1) { + auto daughter = v0.template negDau_as(); + mCtr.compute(track, daughter); + } else { + LOG(fatal) << "CPR Track-V0: Wrong track sign"; + } + } + + bool isClosePair() const { return mCtr.isClosePair(); } + void fill() + { + mCtr.fill(); + } + bool isActivated() const { return mIsActivated; } + + private: + CloseTrackRejection mCtr; + int mSignTrack = 0; + bool mIsActivated = true; +}; + +}; // namespace closepairrejection +}; // namespace o2::analysis::femto +#endif // PWGCF_FEMTO_CORE_CLOSEPAIRREJECTION_H_ diff --git a/PWGCF/Femto/Core/collisionBuilder.h b/PWGCF/Femto/Core/collisionBuilder.h index b33619dcf6f..96c64645c7a 100644 --- a/PWGCF/Femto/Core/collisionBuilder.h +++ b/PWGCF/Femto/Core/collisionBuilder.h @@ -17,6 +17,7 @@ #define PWGCF_FEMTO_CORE_COLLISIONBUILDER_H_ #include "PWGCF/Femto/Core/baseSelection.h" +#include "PWGCF/Femto/Core/dataTypes.h" #include "PWGCF/Femto/Core/femtoUtils.h" #include "PWGCF/Femto/Core/modes.h" #include "PWGCF/Femto/DataModel/FemtoTables.h" @@ -49,8 +50,6 @@ struct ConfCollisionFilters : o2::framework::ConfigurableGroup { o2::framework::Configurable centMax{"centMax", 999.f, "Maximum centrality (multiplicity percentile)"}; o2::framework::Configurable spherMin{"spherMin", 0.f, "Minimum centrality (multiplicity percentile)"}; o2::framework::Configurable spherMax{"spherMax", 2.f, "Maximum centrality (multiplicity percentile)"}; - o2::framework::Configurable occupancyMin{"occupancyMin", 0.f, "Minimum occupancy (Cut works at producer level and if occupancy is stored also at consumer level)"}; - o2::framework::Configurable occupancyMax{"occupancyMax", 1e6f, "Maximum occupancy (Cut works at producer level and if occupancy is stored also at consumer level)"}; o2::framework::Configurable magFieldMin{"magFieldMin", -1.f, "Minimum magnetic field strength (T)"}; o2::framework::Configurable magFieldMax{"magFieldMax", 1.f, "Maximum magnetic field strength (T)"}; }; @@ -70,6 +69,8 @@ struct ConfCollisionBits : o2::framework::ConfigurableGroup { o2::framework::Configurable isGoodItsLayer3{"isGoodItsLayer3", 0, "number of inactive chips on ITS layer 3 is below maximum allowed value (-1: stored in bitmaks; 0 off; 1 on)"}; o2::framework::Configurable isGoodItsLayer0123{"isGoodItsLayer0123", 0, "numbers of inactive chips on ITS layers 0-3 are below maximum allowed values (-1: stored in bitmaks; 0 off; 1 on)"}; o2::framework::Configurable isGoodItsLayersAll{"isGoodItsLayersAll", 0, "numbers of inactive chips on all ITS layers are below maximum allowed values (-1: stored in bitmaks; 0 off; 1 on)"}; + o2::framework::Configurable> occupancyMin{"occupancyMin", {}, "Minimum occpancy"}; + o2::framework::Configurable> occupancyMax{"occupancyMax", {}, "Maximum occpancy"}; }; struct ConfCollisionTriggers : o2::framework::ConfigurableGroup { @@ -79,6 +80,22 @@ struct ConfCollisionTriggers : o2::framework::ConfigurableGroup { o2::framework::Configurable triggers{"triggers", std::string("fPPP,fPPL"), "Comma seperated list of all triggers to be used"}; }; +// configurables for collision selection +struct ConfCollisionSelection : o2::framework::ConfigurableGroup { + std::string prefix = std::string("CollisionSelection"); + o2::framework::Configurable vtxZMin{"vtxZMin", -10.f, "Minimum vertex Z position (cm)"}; + o2::framework::Configurable vtxZMax{"vtxZMax", 10.f, "Maximum vertex Z position (cm)"}; + o2::framework::Configurable multMin{"multMin", 0.f, "Minimum multiplicity"}; + o2::framework::Configurable multMax{"multMax", 999.f, "Maximum multiplicity"}; + o2::framework::Configurable centMin{"centMin", 0.f, "Minimum centrality (multiplicity percentile)"}; + o2::framework::Configurable centMax{"centMax", 999.f, "Maximum centrality (multiplicity percentile)"}; + o2::framework::Configurable spherMin{"spherMin", 0.f, "Minimum centrality (multiplicity percentile)"}; + o2::framework::Configurable spherMax{"spherMax", 2.f, "Maximum centrality (multiplicity percentile)"}; + o2::framework::Configurable magFieldMin{"magFieldMin", -1.f, "Minimum magnetic field strength (T)"}; + o2::framework::Configurable magFieldMax{"magFieldMax", 1.f, "Maximum magnetic field strength (T)"}; + o2::framework::Configurable collisionMask{"collisionMask", 0, "Bitmask for collision"}; +}; + /// enum for all collision selections enum CollisionSels { // collsion selection flags @@ -95,6 +112,8 @@ enum CollisionSels { kIsGoodItsLayer3, ///< number of inactive chips on ITS layer 3 is below maximum allowed value kIsGoodItsLayer0123, ///< numbers of inactive chips on ITS layers 0-3 are below maximum allowed values kIsGoodItsLayersAll, ///< numbers of inactive chips on all ITS layers are below maximum allowed values + kOccupancyMin, ///< Min. occupancy + kOccupancyMax, ///< Max. occupancy kCollisionSelsMax }; @@ -113,9 +132,11 @@ const std::unordered_map colSelsToString = { {kNoHighMultCollInPrevRof, "No high mult collsions in previous ROF"}, {kIsGoodItsLayer3, "Is good ITS layer 3"}, {kIsGoodItsLayer0123, "Is good ITS layer 0-3"}, - {kIsGoodItsLayersAll, "Is good ITS layer all"}}; + {kIsGoodItsLayersAll, "Is good ITS layer all"}, + {kOccupancyMin, "Minimum Occupancy"}, + {kOccupancyMax, "Maximum Occupancy"}}; -class CollisionSelection : public BaseSelection +class CollisionSelection : public BaseSelection { public: CollisionSelection() {} @@ -135,8 +156,6 @@ class CollisionSelection : public BaseSelectionaddSelection(config.sel8.value, kSel8); @@ -151,6 +170,8 @@ class CollisionSelection : public BaseSelectionaddSelection(config.isGoodItsLayer3.value, kIsGoodItsLayer3); this->addSelection(config.isGoodItsLayer0123.value, kIsGoodItsLayer0123); this->addSelection(config.isGoodItsLayersAll.value, kIsGoodItsLayersAll); + this->addSelection(config.occupancyMin.value, kOccupancyMin, limits::kLowerLimit, true, true); + this->addSelection(config.occupancyMax.value, kOccupancyMax, limits::kUpperLimit, true, true); }; void setMagneticField(float MagField) @@ -214,9 +235,6 @@ class CollisionSelection : public BaseSelection mSphericityMax) { return false; } - if (col.trackOccupancyInTimeRange() < mOccupancyMin || col.trackOccupancyInTimeRange() > mOccupancyMax) { - return false; - } return true; } @@ -241,6 +259,9 @@ class CollisionSelection : public BaseSelectionevaluateObservable(kIsGoodItsLayer0123, static_cast(col.selection_bit(o2::aod::evsel::kIsGoodITSLayer0123))); this->evaluateObservable(kIsGoodItsLayersAll, static_cast(col.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll))); + this->evaluateObservable(kOccupancyMin, col.trackOccupancyInTimeRange()); + this->evaluateObservable(kOccupancyMax, col.trackOccupancyInTimeRange()); + this->assembleBitmask(); }; @@ -256,8 +277,6 @@ class CollisionSelection : public BaseSelection producedCollision; - o2::framework::Produces produceCollisionMask; - o2::framework::Produces producedOccupancy; + o2::framework::Produces producedCollisionMask; o2::framework::Produces producedQns; o2::framework::Produces producedPositions; o2::framework::Produces producedMultiplicityEstimators; @@ -279,7 +297,6 @@ struct ConfCollisionTables : o2::framework::ConfigurableGroup { std::string prefix = std::string("CollisionTables"); o2::framework::Configurable produceCollisions{"produceCollisions", -1, "Produce Collisions (-1: auto; 0 off; 1 on)"}; o2::framework::Configurable produceCollisionMasks{"produceCollisionMasks", -1, "Produce Collision Masks (-1: auto; 0 off; 1 on)"}; - o2::framework::Configurable produceOccupancy{"produceOccupancy", -1, "Produce Occupancy (-1: auto; 0 off; 1 on)"}; o2::framework::Configurable produceQns{"produceQns", -1, "Produce Qn (-1: auto; 0 off; 1 on)"}; o2::framework::Configurable producePositions{"producePositions", -1, "Produce Positions (-1: auto; 0 off; 1 on)"}; o2::framework::Configurable produceMults{"produceMults", -1, "Produce Multiplicities (-1: auto; 0 off; 1 on)"}; @@ -304,7 +321,6 @@ class CollisionBuilder LOG(info) << "Initialize femto collision builder..."; mProducedCollisions = utils::enableTable("FCols_001", table.produceCollisions.value, initContext); mProducedCollisionMasks = utils::enableTable("FColMasks_001", table.produceCollisionMasks.value, initContext); - mProduceOccupancy = utils::enableTable("FColOccs_001", table.produceOccupancy.value, initContext); mProduceQns = utils::enableTable("FColQnBins_001", table.produceQns.value, initContext); mProducedPositions = utils::enableTable("FColPos_001", table.producePositions.value, initContext); mProducedMultiplicities = utils::enableTable("FColMults_001", table.produceMults.value, initContext); @@ -356,11 +372,9 @@ class CollisionBuilder mCollisionSelection.getSphericity(), mCollisionSelection.getMagneticField()); } - - if (mProduceOccupancy) { - collisionProducts.producedOccupancy(col.trackOccupancyInTimeRange()); + if (mProducedCollisionMasks) { + collisionProducts.producedCollisionMask(mCollisionSelection.getBitmask()); } - if (mProducedPositions) { collisionProducts.producedPositions(col.posX(), col.posY()); @@ -396,7 +410,6 @@ class CollisionBuilder bool mFillAnyTable = false; bool mProducedCollisions = false; bool mProducedCollisionMasks = false; - bool mProduceOccupancy = false; bool mProduceQns = false; bool mProducedPositions = false; bool mProducedMultiplicities = false; diff --git a/PWGCF/Femto/Core/collisionHistManager.h b/PWGCF/Femto/Core/collisionHistManager.h index 83c9d1ef64b..35daec9fa3a 100644 --- a/PWGCF/Femto/Core/collisionHistManager.h +++ b/PWGCF/Femto/Core/collisionHistManager.h @@ -35,12 +35,17 @@ namespace colhistmanager { enum ColHist { - kPosz, + kPosZ, kMult, kCent, kMagField, kSphericity, - // 2d qa + // qa + kPosX, + kPosY, + kPos, + kOccupancy, + // 2d kPoszVsMult, kPoszVsCent, kCentVsMult, @@ -54,11 +59,15 @@ constexpr std::string_view ColQaDir = "Collisions/QA/"; constexpr std::array, kColHistLast> HistTable = { { - {kPosz, o2::framework::kTH1F, "hPosz", "Vertex Z; V_{Z} (cm); Entries"}, + {kPosZ, o2::framework::kTH1F, "hPosZ", "Vertex Z; V_{Z} (cm); Entries"}, {kMult, o2::framework::kTH1F, "hMult", "Multiplicity; Multiplicity; Entries"}, {kCent, o2::framework::kTH1F, "hCent", "Centrality; Centrality (%); Entries"}, {kMagField, o2::framework::kTH1F, "hMagField", "Magnetic Field; B (T); Entries"}, {kSphericity, o2::framework::kTH1F, "hSphericity", "Sphericity; Sphericity; Entries"}, + {kPosX, o2::framework::kTH1F, "hPosX", "Vertex X; V_{X} (cm); Entries"}, + {kPosY, o2::framework::kTH1F, "hPosY", "Vertex Z; V_{Y} (cm); Entries"}, + {kPos, o2::framework::kTH1F, "hPos", "Primary vertex; V_{pos} (cm); Entries"}, + {kOccupancy, o2::framework::kTH1F, "hOccupancy", "Occupancy; Occupancy; Entries"}, {kPoszVsMult, o2::framework::kTH2F, "hPoszVsMult", "Vertex Z vs Multiplicity; V_{Z} (cm); Multiplicity"}, {kPoszVsCent, o2::framework::kTH2F, "hPoszVsCent", "Vertex Z vs Centrality; V_{Z} (cm); Centrality (%)"}, {kCentVsMult, o2::framework::kTH2F, "hCentVsMult", "Centrality vs Multiplicity; Centrality (%); Multiplicity"}, @@ -70,7 +79,7 @@ template auto makeColHistSpecMap(const BinningStruct& binning) { return std::map>{ - {kPosz, {binning.vtZ}}, + {kPosZ, {binning.vtZ}}, {kMult, {binning.mult}}, {kCent, {binning.cent}}, {kSphericity, {binning.spher}}, @@ -91,8 +100,6 @@ struct ConfCollisionBinning : o2::framework::ConfigurableGroup { o2::framework::ConfigurableAxis magField{"magField", {2, -1, 1}, "Magnetic field binning"}; }; -/// \class FemtoDreamEventHisto -/// \brief Class for histogramming event properties template class CollisionHistManager { @@ -106,7 +113,7 @@ class CollisionHistManager mHistogramRegistry = registry; if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { std::string analysisDir = std::string(ColAnalysisDir); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kPosz, HistTable), GetHistDesc(kPosz, HistTable), GetHistType(kPosz, HistTable), {Specs[kPosz]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kPosZ, HistTable), GetHistDesc(kPosZ, HistTable), GetHistType(kPosZ, HistTable), {Specs[kPosZ]}); mHistogramRegistry->add(analysisDir + GetHistNamev2(kMult, HistTable), GetHistDesc(kMult, HistTable), GetHistType(kMult, HistTable), {Specs[kMult]}); mHistogramRegistry->add(analysisDir + GetHistNamev2(kCent, HistTable), GetHistDesc(kCent, HistTable), GetHistType(kCent, HistTable), {Specs[kCent]}); mHistogramRegistry->add(analysisDir + GetHistNamev2(kSphericity, HistTable), GetHistDesc(kSphericity, HistTable), GetHistType(kSphericity, HistTable), {Specs[kSphericity]}); @@ -128,7 +135,7 @@ class CollisionHistManager void fill(T const& col) { if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { - mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kPosz, HistTable)), col.posZ()); + mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kPosZ, HistTable)), col.posZ()); mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kMult, HistTable)), col.mult()); mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kCent, HistTable)), col.cent()); mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kSphericity, HistTable)), col.sphericity()); diff --git a/PWGCF/Femto/Core/dataTypes.h b/PWGCF/Femto/Core/dataTypes.h index f8e349a77d3..54cef607b7b 100644 --- a/PWGCF/Femto/Core/dataTypes.h +++ b/PWGCF/Femto/Core/dataTypes.h @@ -25,15 +25,16 @@ namespace femtodatatypes // Note: Length of the bitmask is the limit of how many selections can be configured // datatypes for collsions -using CollsionsMaskType = uint64_t; +using CollisionMaskType = uint16_t; // datatypes for tracks +using MomentumType = uint16_t; using TrackMaskType = uint64_t; using TrackType = uint16_t; // datatypes for v0s using V0MaskType = uint16_t; -using V0Type = uint8_t; +using V0Type = uint16_t; // datatypes for kinks using KinkMaskType = uint32_t; @@ -42,14 +43,11 @@ using KinkType = uint8_t; // datatypes for two track resonances using TwoTrackResonanceMaskType = uint32_t; // two track resonance types -using TwoTrackResonanceType = uint8_t; +using TwoTrackResonanceType = uint16_t; // datatypes for cascades using CascadeMaskType = uint16_t; -using CascadeType = uint8_t; - -// datatypes for pairs -using PairType = uint8_t; +using CascadeType = uint16_t; } // namespace femtodatatypes diff --git a/PWGCF/Femto/Core/femtoUtils.h b/PWGCF/Femto/Core/femtoUtils.h index 10f81cf3669..13a8bfb981f 100644 --- a/PWGCF/Femto/Core/femtoUtils.h +++ b/PWGCF/Femto/Core/femtoUtils.h @@ -184,6 +184,12 @@ inline bool enableTable(const char* tableName, int userSetting, o2::framework::I return required; } +template +inline int sign(T value) +{ + return (value > 0) - (value < 0); // Returns 1 for positive, -1 for negative, 0 for zero +} + }; // namespace utils }; // namespace o2::analysis::femto #endif // PWGCF_FEMTO_CORE_FEMTOUTILS_H_ diff --git a/PWGCF/Femto/Core/modes.h b/PWGCF/Femto/Core/modes.h index 012442bb3f1..752df384b7a 100644 --- a/PWGCF/Femto/Core/modes.h +++ b/PWGCF/Femto/Core/modes.h @@ -65,6 +65,11 @@ enum class System : uint32_t { kPbPb_Run2 = kPbPb | kRun2, }; +enum class MomentumType : o2::aod::femtodatatypes::MomentumType { + kPAtPv, // momentum at primary vertex + kPt, // transverse momentum +}; + enum class Track : o2::aod::femtodatatypes::TrackType { kPrimaryTrack, kV0Daughter, @@ -96,22 +101,6 @@ enum class TwoTrackResonance : o2::aod::femtodatatypes::TwoTrackResonanceType { kKstar0Bar }; -enum class Pairs : o2::aod::femtodatatypes::PairType { - kTrackTrack, - kTrackV0, - kTrackResonance, - kTrackCascade, - kTrackKink -}; - -enum class TrackPairs : o2::aod::femtodatatypes::PairType { - kTrackTrack, - kTrackPosDaughter, - kTrackNegDaughter, - kTrackBachelor, - kTrackChaDaughter -}; - }; // namespace modes }; // namespace o2::analysis::femto #endif // PWGCF_FEMTO_CORE_MODES_H_ diff --git a/PWGCF/Femto/Core/pairBuilder.h b/PWGCF/Femto/Core/pairBuilder.h new file mode 100644 index 00000000000..2d82529ca87 --- /dev/null +++ b/PWGCF/Femto/Core/pairBuilder.h @@ -0,0 +1,302 @@ +// Copyright 2019-2025 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 pairBuilder.h +/// \brief histogram manager for pair tasks +/// \author anton.riedel@tum.de, TU München, anton.riedel@tum.de + +#ifndef PWGCF_FEMTO_CORE_PAIRBUILDER_H_ +#define PWGCF_FEMTO_CORE_PAIRBUILDER_H_ + +#include "PWGCF/Femto/Core/closePairRejection.h" +#include "PWGCF/Femto/Core/collisionHistManager.h" +#include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/pairCleaner.h" +#include "PWGCF/Femto/Core/pairHistManager.h" +#include "PWGCF/Femto/Core/pairProcessHelpers.h" +#include "PWGCF/Femto/Core/trackHistManager.h" +#include "PWGCF/Femto/Core/v0HistManager.h" +#include "PWGCF/Femto/DataModel/FemtoTables.h" + +#include "Framework/HistogramRegistry.h" + +#include +#include +#include + +namespace o2::analysis::femto +{ +namespace pairbuilder +{ + +template < + const char* prefixTrack1, + const char* prefixTrack2, + const char* prefixSe, + const char* prefixMe, + const char* prefixCprSe, + const char* prefixCprMe, + modes::Mode mode> +class PairTrackTrackBuilder +{ + public: + PairTrackTrackBuilder() = default; + + template + void init(o2::framework::HistogramRegistry* registry, + T1& confTrackSelection1, + T2& confTrackSelection2, + T3& confCpr, + T4& confMixing, + std::map>& colHistSpec, + std::map>& trackHistSpec1, + std::map>& trackHistSpec2, + std::map>& pairHistSpec, + std::map>& cprHistSpec) + { + + // check if correlate the same tracks or not + mSameSpecies = confMixing.sameSpecies.value; + + mColHistManager.init(registry, colHistSpec); + mPairHistManagerSe.init(registry, pairHistSpec); + mPairHistManagerMe.init(registry, pairHistSpec); + + if (mSameSpecies) { + mTrackHistManager1.init(registry, trackHistSpec1); + + mPairHistManagerSe.setMass(confTrackSelection1.pdgCode.value, confTrackSelection1.pdgCode.value); + mPairHistManagerSe.setCharge(confTrackSelection1.absCharge.value, confTrackSelection1.absCharge.value); + mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.sign.value, confTrackSelection1.absCharge.value, confTrackSelection1.sign.value, confTrackSelection1.absCharge.value, confCpr.on.value); + + mPairHistManagerMe.setMass(confTrackSelection1.pdgCode.value, confTrackSelection1.pdgCode.value); + mPairHistManagerMe.setCharge(confTrackSelection1.absCharge.value, confTrackSelection1.absCharge.value); + mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.sign.value, confTrackSelection1.absCharge.value, confTrackSelection1.sign.value, confTrackSelection1.absCharge.value, confCpr.on.value); + } else { + mTrackHistManager1.init(registry, trackHistSpec1); + mTrackHistManager2.init(registry, trackHistSpec2); + + mPairHistManagerSe.setMass(confTrackSelection1.pdgCode.value, confTrackSelection2.pdgCode.value); + mPairHistManagerSe.setCharge(confTrackSelection1.absCharge.value, confTrackSelection2.absCharge.value); + mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.sign.value, confTrackSelection1.absCharge.value, confTrackSelection2.sign.value, confTrackSelection2.absCharge.value, confCpr.on.value); + + mPairHistManagerMe.setMass(confTrackSelection1.pdgCode.value, confTrackSelection2.pdgCode.value); + mPairHistManagerMe.setCharge(confTrackSelection1.absCharge.value, confTrackSelection2.absCharge.value); + mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.sign.value, confTrackSelection1.absCharge.value, confTrackSelection2.sign.value, confTrackSelection2.absCharge.value, confCpr.on.value); + } + + // setup mixing + mMixingPolicy = static_cast(confMixing.policy.value); + mMixingDepth = confMixing.depth.value; + + // setup rng if necessary + if (confMixing.seed.value >= 0) { + uint64_t randomSeed = 0; + mMixIdenticalParticles = true; + if (confMixing.seed.value == 0) { + randomSeed = static_cast(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + } else { + randomSeed = static_cast(confMixing.seed.value); + } + mRng = std::mt19937(randomSeed); + } + } + + template + void processSameEvent(T1 const& col, T2& /*trackTable*/, T3& partition1, T4& partition2, T5& cache) + { + if (mSameSpecies) { + auto trackSlice1 = partition1->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + if (trackSlice1.size() == 0) { + return; + } + mColHistManager.fill(col); + mCprSe.setMagField(col.magField()); + pairprocesshelpers::processSameEvent(trackSlice1, mTrackHistManager1, mPairHistManagerSe, mCprSe, mRng, mMixIdenticalParticles); + } else { + auto trackSlice1 = partition1->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto trackSlice2 = partition2->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + if (trackSlice1.size() == 0 || trackSlice2.size() == 0) { + return; + } + mColHistManager.fill(col); + mCprSe.setMagField(col.magField()); + pairprocesshelpers::processSameEvent(trackSlice1, trackSlice2, mTrackHistManager1, mTrackHistManager2, mPairHistManagerSe, mCprSe, mPc); + } + } + + template + void processMixedEvent(T1 const& cols, T2& /*trackTable*/, T3& partition1, T4& partition2, T5& cache, T6& binsVtxMult, T7& binsVtxCent, T8& binsVtxMultCent) + { + + if (mSameSpecies) { + switch (mMixingPolicy) { + case static_cast(pairhistmanager::kVtxMult): + pairprocesshelpers::processMixedEvent(cols, partition1, cache, binsVtxMult, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + break; + case static_cast(pairhistmanager::kVtxCent): + pairprocesshelpers::processMixedEvent(cols, partition1, cache, binsVtxCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + break; + case static_cast(pairhistmanager::kVtxMultCent): + pairprocesshelpers::processMixedEvent(cols, partition1, cache, binsVtxMultCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + break; + default: + LOG(fatal) << "Invalid binning policiy specifed. Breaking..."; + } + } else { + switch (mMixingPolicy) { + case static_cast(pairhistmanager::kVtxMult): + pairprocesshelpers::processMixedEvent(cols, partition1, partition2, cache, binsVtxMult, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + break; + case static_cast(pairhistmanager::kVtxCent): + pairprocesshelpers::processMixedEvent(cols, partition1, partition2, cache, binsVtxCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + break; + case static_cast(pairhistmanager::kVtxMultCent): + pairprocesshelpers::processMixedEvent(cols, partition1, partition2, cache, binsVtxMultCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + break; + default: + LOG(fatal) << "Invalid binning policiy specifed. Breaking..."; + } + } + } + + private: + colhistmanager::CollisionHistManager mColHistManager; + trackhistmanager::TrackHistManager mTrackHistManager1; + trackhistmanager::TrackHistManager mTrackHistManager2; + pairhistmanager::PairHistManager mPairHistManagerSe; + pairhistmanager::PairHistManager mPairHistManagerMe; + closepairrejection::ClosePairRejectionTrackTrack mCprSe; + closepairrejection::ClosePairRejectionTrackTrack mCprMe; + paircleaner::TrackTrackPairCleaner mPc; + std::mt19937 mRng; + pairhistmanager::MixingPoliciy mMixingPolicy = pairhistmanager::MixingPoliciy::kVtxMult; + bool mSameSpecies = false; + int mMixingDepth = 5; + bool mMixIdenticalParticles = false; +}; + +template < + const char* prefixTrack, + const char* prefixV0, + const char* prefixPosDau, + const char* prefixNegDau, + const char* prefixSe, + const char* prefixMe, + const char* prefixCprSe, + const char* prefixCprMe, + modes::Mode mode, + modes::V0 v0Type> +class PairTrackV0Builder +{ + public: + PairTrackV0Builder() = default; + + template + void init(o2::framework::HistogramRegistry* registry, + T1& confTrackSelection, + T2& confV0Selection, + T3& confCpr, + T4& confMixing, + std::map>& colHistSpec, + std::map>& trackHistSpec, + std::map>& v0HistSpec, + std::map>& posDauHistSpec, + std::map>& negDauHistSpec, + std::map>& pairHistSpec, + std::map>& cprHistSpec) + { + mColHistManager.init(registry, colHistSpec); + + mTrackHistManager.init(registry, trackHistSpec); + mV0HistManager.init(registry, v0HistSpec, posDauHistSpec, negDauHistSpec); + + mPairHistManagerSe.init(registry, pairHistSpec); + mPairHistManagerSe.setMass(confTrackSelection.pdgCode.value, confV0Selection.pdgCode.value); + mPairHistManagerSe.setCharge(confTrackSelection.absCharge.value, 1); + mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.sign.value, confTrackSelection.absCharge.value, confCpr.on.value); + + mPairHistManagerMe.init(registry, pairHistSpec); + mPairHistManagerMe.setMass(confTrackSelection.pdgCode.value, confV0Selection.pdgCode.value); + mPairHistManagerMe.setCharge(confTrackSelection.absCharge.value, 1); + mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.sign.value, confTrackSelection.absCharge.value, confCpr.on.value); + + // setup mixing + mMixingPolicy = static_cast(confMixing.policy.value); + mMixingDepth = confMixing.depth.value; + } + + template + void processSameEvent(T1 const& col, T2& trackTable, T3& trackPartition, T4& /*v0table*/, T5& v0Partition, T6& cache) + { + auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto v0Slice = v0Partition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + if (trackSlice.size() == 0 || v0Slice.size() == 0) { + return; + } + mColHistManager.fill(col); + mCprSe.setMagField(col.magField()); + pairprocesshelpers::processSameEvent(trackSlice, v0Slice, trackTable, mTrackHistManager, mV0HistManager, mPairHistManagerSe, mCprSe, mPc); + } + + template + void processMixedEvent(T1 const& cols, T2& trackTable, T3& trackPartition, T4& v0Partition, T5& cache, T6& binsVtxMult, T7& binsVtxCent, T8& binsVtxMultCent) + { + switch (mMixingPolicy) { + case static_cast(pairhistmanager::kVtxMult): + pairprocesshelpers::processMixedEvent(cols, trackPartition, v0Partition, trackTable, cache, binsVtxMult, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + break; + case static_cast(pairhistmanager::kVtxCent): + pairprocesshelpers::processMixedEvent(cols, trackPartition, v0Partition, trackTable, cache, binsVtxCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + break; + case static_cast(pairhistmanager::kVtxMultCent): + pairprocesshelpers::processMixedEvent(cols, trackPartition, v0Partition, trackTable, cache, binsVtxMultCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + break; + default: + LOG(fatal) << "Invalid binning policiy specifed. Breaking..."; + } + } + + private: + colhistmanager::CollisionHistManager mColHistManager; + trackhistmanager::TrackHistManager mTrackHistManager; + v0histmanager::V0HistManager mV0HistManager; + pairhistmanager::PairHistManager mPairHistManagerSe; + pairhistmanager::PairHistManager mPairHistManagerMe; + closepairrejection::ClosePairRejectionTrackV0 mCprSe; + closepairrejection::ClosePairRejectionTrackV0 mCprMe; + paircleaner::TrackV0PairCleaner mPc; + pairhistmanager::MixingPoliciy mMixingPolicy = pairhistmanager::MixingPoliciy::kVtxMult; + int mMixingDepth = 5; +}; + +} // namespace pairbuilder +} // namespace o2::analysis::femto + +#endif // PWGCF_FEMTO_CORE_PAIRBUILDER_H_ diff --git a/PWGCF/Femto/Core/pairCleaner.h b/PWGCF/Femto/Core/pairCleaner.h new file mode 100644 index 00000000000..47608056acf --- /dev/null +++ b/PWGCF/Femto/Core/pairCleaner.h @@ -0,0 +1,64 @@ +// Copyright 2019-2022 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 pairCleaner.h +/// \brief pair cleaner class +/// \author anton.riedel@tum.de, TU München, anton.riedel@tum.de + +#ifndef PWGCF_FEMTO_CORE_PAIRCLEANER_H_ +#define PWGCF_FEMTO_CORE_PAIRCLEANER_H_ + +namespace o2::analysis::femto +{ +namespace paircleaner +{ + +class BasePairCleaner +{ + public: + BasePairCleaner() = default; + virtual ~BasePairCleaner() = default; + + protected: + template + bool isCleanTrackPair(const T1& track1, const T2& track2) const + { + return track1.globalIndex() != track2.globalIndex(); + }; +}; + +class TrackTrackPairCleaner : public BasePairCleaner +{ + public: + TrackTrackPairCleaner() = default; + template + bool isCleanPair(const T& track1, const T& track2) const + { + return this->isCleanTrackPair(track1, track2); + } +}; + +class TrackV0PairCleaner : public BasePairCleaner +{ + public: + TrackV0PairCleaner() = default; + template + bool isCleanPair(const T1& track, const T2& v0, const T3& /*trackTable */) const + { + auto posDaughter = v0.template posDau_as(); + auto negDaughter = v0.template negDau_as(); + return this->isCleanTrackPair(posDaughter, track) && this->isCleanTrackPair(negDaughter, track); + } +}; +} // namespace paircleaner +} // namespace o2::analysis::femto + +#endif // PWGCF_FEMTO_CORE_PAIRCLEANER_H_ diff --git a/PWGCF/Femto/Core/pairHistManager.h b/PWGCF/Femto/Core/pairHistManager.h new file mode 100644 index 00000000000..c256c09b9af --- /dev/null +++ b/PWGCF/Femto/Core/pairHistManager.h @@ -0,0 +1,226 @@ +// Copyright 2019-2025 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 pairHistManager.h +/// \brief histogram manager for pair tasks +/// \author anton.riedel@tum.de, TU München, anton.riedel@tum.de + +#ifndef PWGCF_FEMTO_CORE_PAIRHISTMANAGER_H_ +#define PWGCF_FEMTO_CORE_PAIRHISTMANAGER_H_ + +#include "PWGCF/Femto/Core/closePairRejection.h" +#include "PWGCF/Femto/Core/collisionHistManager.h" +#include "PWGCF/Femto/Core/femtoUtils.h" +#include "PWGCF/Femto/Core/histManager.h" +#include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/pairCleaner.h" +#include "PWGCF/Femto/Core/trackHistManager.h" +#include "PWGCF/Femto/DataModel/FemtoTables.h" + +#include "Framework/Configurable.h" +#include "Framework/GroupedCombinations.h" +#include "Framework/HistogramRegistry.h" + +#include "Math/Boost.h" +#include "Math/Vector4D.h" +#include "TMath.h" + +#include +#include +#include +#include +#include + +namespace o2::analysis::femto +{ +namespace pairhistmanager +{ +// enum for pair histograms +enum PairHist { + // kinemtics + kKstar, + kKt, + kMt, + // 2d qa + kPt1VsPt2, + kPt1VsKstar, + kPt2VsKstar, + kPt1VsKt, + kPt2VsKt, + kPt1VsMt, + kPt2VsMt, + kPairHistogramLast +}; + +enum MixingPoliciy { + kVtxMult, + kVtxCent, + kVtxMultCent, + kMixingPolicyLast +}; + +// Mixing configurables +struct ConfMixing : o2::framework::ConfigurableGroup { + std::string prefix = std::string("Mixing"); + o2::framework::ConfigurableAxis multBins{"multBins", {o2::framework::VARIABLE_WIDTH, 0.0f, 4.0f, 8.0f, 12.0f, 16.0f, 20.0f, 24.0f, 28.0f, 32.0f, 36.0f, 40.0f, 44.0f, 48.0f, 52.0f, 56.0f, 60.0f, 64.0f, 68.0f, 72.0f, 76.0f, 80.0f, 84.0f, 88.0f, 92.0f, 96.0f, 100.0f, 200.0f}, "Mixing bins - multiplicity"}; + o2::framework::ConfigurableAxis centBins{"centBins", {o2::framework::VARIABLE_WIDTH, 0.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.0f}, "Mixing bins - centrality"}; + o2::framework::ConfigurableAxis vtxBins{"vtxBins", {o2::framework::VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; + o2::framework::Configurable depth{"depth", 5, "Number of events for mixing"}; + o2::framework::Configurable policy{"policy", 0, "Binning policy for mixing (alywas in combination with z-vertex) -> 0: multiplicity, -> 1: centrality, -> 2: both"}; + o2::framework::Configurable sameSpecies{"sameSpecies", false, "Enable if partilce 1 and particle 2 are the same"}; + o2::framework::Configurable seed{"seed", -1, "Seed to randomize particle 1 and particle 2 (if they are identical). Set to negative value to deactivate. Set to 0 to generate unique seed in time."}; +}; + +struct ConfPairBinning : o2::framework::ConfigurableGroup { + std::string prefix = std::string("PairBinning"); + o2::framework::ConfigurableAxis kstar{"kstar", {{600, 0, 6}}, "kstar"}; + o2::framework::ConfigurableAxis kt{"kt", {{600, 0, 6}}, "kt"}; + o2::framework::ConfigurableAxis mt{"mt", {{500, 0.8, 5.8}}, "mt"}; +}; + +// the enum gives the correct index in the array +constexpr std::array, kPairHistogramLast> HistTable = { + {{kKstar, o2::framework::kTH1F, "hKstar", "k*; k* (GeV/#it{c}); Entries"}, + {kKt, o2::framework::kTH1F, "hKt", "transverse momentum; k_{T} (GeV/#it{c}); Entries"}, + {kMt, o2::framework::kTH1F, "hMt", "transverse mass; m_{T} (GeV/#it{c}^{2}); Entries"}, + {kPt1VsPt2, o2::framework::kTH2F, "hPt1VsPt2", "track1 p_{T} vs track2 p_{T}; track1 p_T (GeV/#it{c}); track2 p_{T} (GeV/#it{c})"}, + {kPt1VsKstar, o2::framework::kTH2F, "hPt1VsKstar", "p_{T,1} vs k*; p_{T,2} (GeV/#it{c}); k* (GeV/#it{c})"}, + {kPt2VsKstar, o2::framework::kTH2F, "hPt2VsKstar", "p_{T,2} vs k*; p_{T,2} (GeV/#it{c}); k* (GeV/#it{c})"}, + {kPt1VsKt, o2::framework::kTH2F, "hPt1VsKt", "p_{T,1} vs k_{T}; p_{T,1} (GeV/#it{c}); k_{T} (GeV/#it{c})"}, + {kPt2VsKt, o2::framework::kTH2F, "hPt2VsKt", "p_{T,2} vs k_{T}; p_{T,2} (GeV/#it{c}); k_{T} (GeV/#it{c})"}, + {kPt1VsMt, o2::framework::kTH2F, "hPt1VsMt", "p_{T,1} vs m_{T}; p_{T,1} (GeV/#it{c}); m_{T} (GeV/#it{c})"}, + {kPt2VsMt, o2::framework::kTH2F, "hPt2VsMt", "p_{T,2} vs m_{T}; p_{T,2} (GeV/#it{c}); m_{T} (GeV/#it{c})"}}}; + +template +auto makePairHistSpecMap(const T1& confPairBinning, const T2& confObject1Binning, const T3& confObject2Binning) +{ + return std::map>{ + {kKstar, {confPairBinning.kstar}}, + {kKt, {confPairBinning.kt}}, + {kMt, {confPairBinning.mt}}, + {kPt1VsPt2, {confObject1Binning.pt, confObject2Binning.pt}}, + {kPt1VsKstar, {confObject1Binning.pt, confPairBinning.kstar}}, + {kPt2VsKstar, {confObject2Binning.pt, confPairBinning.kstar}}, + {kPt1VsKt, {confObject1Binning.pt, confPairBinning.kt}}, + {kPt2VsKt, {confObject2Binning.pt, confPairBinning.kt}}, + {kPt1VsMt, {confObject1Binning.pt, confPairBinning.mt}}, + {kPt2VsMt, {confObject2Binning.pt, confPairBinning.mt}}}; +}; + +constexpr char PrefixTrackTrackSe[] = "TrackTrack/SE/"; +constexpr char PrefixTrackTrackMe[] = "TrackTrack/ME/"; + +constexpr char PrefixTrackV0Se[] = "TrackV0/SE/"; +constexpr char PrefixTrackV0Me[] = "TrackV0/ME/"; + +constexpr std::string_view AnalysisDir = "Analysis/"; +constexpr std::string_view QaDir = "QA/"; + +/// \class FemtoDreamEventHisto +/// \brief Class for histogramming event properties +// template +template +class PairHistManager +{ + public: + /// Destructor + virtual ~PairHistManager() = default; + void init(o2::framework::HistogramRegistry* registry, std::map> Specs) + { + mHistogramRegistry = registry; + + if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { + std::string analysisDir = std::string(prefix) + std::string(AnalysisDir); + + mHistogramRegistry->add(analysisDir + GetHistNamev2(kKstar, HistTable), GetHistDesc(kKstar, HistTable), GetHistType(kKstar, HistTable), {Specs[kKstar]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kMt, HistTable), GetHistDesc(kMt, HistTable), GetHistType(kMt, HistTable), {Specs[kMt]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kPt1VsPt2, HistTable), GetHistDesc(kPt1VsPt2, HistTable), GetHistType(kPt1VsPt2, HistTable), {Specs[kPt1VsPt2]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kPt1VsKstar, HistTable), GetHistDesc(kPt1VsKstar, HistTable), GetHistType(kPt1VsKstar, HistTable), {Specs[kPt1VsKstar]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kPt2VsKstar, HistTable), GetHistDesc(kPt2VsKstar, HistTable), GetHistType(kPt2VsKstar, HistTable), {Specs[kPt2VsKstar]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kPt1VsKt, HistTable), GetHistDesc(kPt1VsKt, HistTable), GetHistType(kPt1VsKt, HistTable), {Specs[kPt1VsKt]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kPt2VsKt, HistTable), GetHistDesc(kPt2VsKt, HistTable), GetHistType(kPt2VsKt, HistTable), {Specs[kPt2VsKt]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kPt1VsMt, HistTable), GetHistDesc(kPt1VsMt, HistTable), GetHistType(kPt1VsMt, HistTable), {Specs[kPt1VsMt]}); + mHistogramRegistry->add(analysisDir + GetHistNamev2(kPt2VsMt, HistTable), GetHistDesc(kPt2VsMt, HistTable), GetHistType(kPt2VsMt, HistTable), {Specs[kPt2VsMt]}); + } + + // if constexpr (isFlagSet(mode, modes::Mode::kQA)) { + // std::string qaDir = std::string(prefix) + std::string(QaDir); + // } + } + + void setMass(int PdgParticle1, int PdgParticle2) + { + mMass1 = o2::analysis::femto::utils::getMass(PdgParticle1); + mMass2 = o2::analysis::femto::utils::getMass(PdgParticle2); + } + void setCharge(int chargeParticle1, int chargeParticle2) + { + mAbsCharge1 = std::fabs(chargeParticle1); + mAbsCharge1 = std::fabs(chargeParticle2); + } + + template + void setPair(const T1& particle1, const T2& particle2) + { + // pt in track stable is stored from 1/signedPt from the original track table + // in case of He with Z=2, we have to rescale the pt with the absolute charge + mParticle1 = ROOT::Math::PtEtaPhiMVector{mAbsCharge1 * particle1.pt(), particle1.eta(), particle1.phi(), mMass1}; + mParticle2 = ROOT::Math::PtEtaPhiMVector{mAbsCharge2 * particle2.pt(), particle2.eta(), particle2.phi(), mMass2}; + auto partSum = mParticle1 + mParticle2; + + // set kT + mKt = partSum.Pt() / 2.f; + + // set mT + float averageMass = (mMass1 + mMass2) / 2.f; + mMt = std::hypot(mKt, averageMass); + + // Boost Track1 to the pair rest frame and calculate k* + auto track1 = ROOT::Math::PxPyPzEVector(mParticle1); + ROOT::Math::Boost boostPrf(partSum.BoostToCM()); + mKstar = boostPrf(track1).P(); + } + + void fill() + { + if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kKstar, HistTable)), mKstar); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kMt, HistTable)), mMt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kPt1VsPt2, HistTable)), mParticle1.Pt(), mParticle2.Pt()); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kPt1VsKstar, HistTable)), mParticle1.Pt(), mKstar); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kPt1VsMt, HistTable)), mParticle1.Pt(), mMt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kPt1VsKt, HistTable)), mParticle1.Pt(), mKt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kPt2VsKstar, HistTable)), mParticle2.Pt(), mKstar); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kPt2VsMt, HistTable)), mParticle2.Pt(), mMt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kPt2VsKt, HistTable)), mParticle2.Pt(), mKt); + } + + // if constexpr (isFlagSet(mode, modes::Mode::kQA)) { + // mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsDcaz, HistTable)), track.pt(), track.dcaZ()); + // } + } + + private: + o2::framework::HistogramRegistry* mHistogramRegistry; + float mMass1 = 0.f; + float mMass2 = 0.f; + float mAbsCharge1 = 1.f; + float mAbsCharge2 = 1.f; + ROOT::Math::PtEtaPhiMVector mParticle1{}; + ROOT::Math::PtEtaPhiMVector mParticle2{}; + float mKstar = 0.f; + float mKt = 0.f; + float mMt = 0.f; +}; + +}; // namespace pairhistmanager +}; // namespace o2::analysis::femto +#endif // PWGCF_FEMTO_CORE_PAIRHISTMANAGER_H_ diff --git a/PWGCF/Femto/Core/pairProcessHelpers.h b/PWGCF/Femto/Core/pairProcessHelpers.h new file mode 100644 index 00000000000..df96b056c16 --- /dev/null +++ b/PWGCF/Femto/Core/pairProcessHelpers.h @@ -0,0 +1,310 @@ +// Copyright 2019-2025 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 pairProcessHelpers.h +/// \brief process functions used in pair tasks +/// \author anton.riedel@tum.de, TU München, anton.riedel@tum.de + +#ifndef PWGCF_FEMTO_CORE_PAIRPROCESSHELPERS_H_ +#define PWGCF_FEMTO_CORE_PAIRPROCESSHELPERS_H_ + +#include "PWGCF/Femto/DataModel/FemtoTables.h" + +#include "Framework/ASoAHelpers.h" + +#include + +namespace o2::analysis::femto +{ +namespace pairprocesshelpers +{ + +// process same event for identical tracks +template +void processSameEvent(const T1& SliceParticle, + T2& ParticleHistManager, + T3& PairHistManager, + T4& CprManager, + T5& rng, + bool randomize) +{ + // Fill single particle histograms + for (auto const& part : SliceParticle) { + ParticleHistManager.fill(part); + } + + std::uniform_real_distribution dist(0.f, 1.f); + + for (auto const& [p1, p2] : o2::soa::combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(SliceParticle, SliceParticle))) { + + // Close pair rejection + if (CprManager.isActivated()) { + CprManager.setPair(p1, p2); + if (CprManager.isClosePair()) { + continue; + } + } + CprManager.fill(); + + // Randomize pair order if enabled + float threshold = 0.5f; + bool swapPair = randomize ? (dist(rng) > threshold) : false; + if (swapPair) { + PairHistManager.setPair(p2, p1); + } else { + PairHistManager.setPair(p1, p2); + } + PairHistManager.fill(); + } +} + +// process same event for non-identical tracks +template +void processSameEvent(T1& SliceParticle1, + T2& SliceParticle2, + T3& ParticleHistManager1, + T4& ParticleHistManager2, + T5& PairHistManager, + T6& CprManager, + T7& PcManager) +{ + // Fill single particle histograms + for (auto const& part : SliceParticle1) { + ParticleHistManager1.fill(part); + } + + for (auto const& part : SliceParticle2) { + ParticleHistManager2.fill(part); + } + + for (auto const& [p1, p2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(SliceParticle1, SliceParticle2))) { + // pair cleaning + if (!PcManager.isCleanPair(p1, p2)) { + continue; + } + // Close pair rejection + if (CprManager.isActivated()) { + CprManager.setPair(p1, p2); + if (CprManager.isClosePair()) { + continue; + } + } + CprManager.fill(); + PairHistManager.setPair(p1, p2); + PairHistManager.fill(); + } +} + +// process same event for tracks and particles decaying into tracks +template +void processSameEvent(T1& SliceParticle1, + T2& SliceParticle2, + T3& TrackTable, + T4& ParticleHistManager1, + T5& ParticleHistManager2, + T6& PairHistManager, + T7& CprManager, + T8& PcManager) +{ + // Fill single particle histograms + for (auto const& part : SliceParticle1) { + ParticleHistManager1.fill(part); + } + + for (auto const& part : SliceParticle2) { + ParticleHistManager2.fill(part, TrackTable); + } + + for (auto const& [p1, p2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(SliceParticle1, SliceParticle2))) { + // pair cleaning + if (!PcManager.isCleanPair(p1, p2, TrackTable)) { + continue; + } + // Close pair rejection + if (CprManager.isActivated()) { + CprManager.setPair(p1, p2, TrackTable); + if (CprManager.isClosePair()) { + continue; + } + } + CprManager.fill(); + PairHistManager.setPair(p1, p2); + PairHistManager.fill(); + } +} + +// process mixed event identical tracks +template +void processMixedEvent(T1& Collisions, + T2& Partition, + T3& cache, + T4& policy, + T5& depth, + T6& PairHistManager, + T7& CprManager, + T8& PcManager) +{ + for (auto const& [collision1, collision2] : o2::soa::selfCombinations(policy, depth, -1, Collisions, Collisions)) { + if (!(std::fabs(collision1.magField() - collision2.magField()) < o2::constants::math::Epsilon)) { + continue; + } + CprManager.setMagField(collision1.magField()); + auto sliceParticle1 = Partition->sliceByCached(o2::aod::femtobase::stored::collisionId, collision1.globalIndex(), cache); + auto sliceParticle2 = Partition->sliceByCached(o2::aod::femtobase::stored::collisionId, collision2.globalIndex(), cache); + if (sliceParticle1.size() == 0 || sliceParticle2.size() == 0) { + continue; + } + for (auto const& [p1, p2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(sliceParticle1, sliceParticle2))) { + // pair cleaning + if (!PcManager.isCleanPair(p1, p2)) { + continue; + } + // Close pair rejection + if (CprManager.isActivated()) { + CprManager.setPair(p1, p2); + if (CprManager.isClosePair()) { + continue; + } + } + CprManager.fill(); + PairHistManager.setPair(p1, p2); + PairHistManager.fill(); + } + } +} + +// process mixed event different tracks +template +void processMixedEvent(T1& Collisions, + T2& Partition1, + T3& Partition2, + T4& cache, + T5& policy, + T6& depth, + T7& PairHistManager, + T8& CprManager, + T9& PcManager) +{ + for (auto const& [collision1, collision2] : o2::soa::selfCombinations(policy, depth, -1, Collisions, Collisions)) { + if (!(std::fabs(collision1.magField() - collision2.magField()) < o2::constants::math::Epsilon)) { + continue; + } + CprManager.setMagField(collision1.magField()); + auto sliceParticle1 = Partition1->sliceByCached(o2::aod::femtobase::stored::collisionId, collision1.globalIndex(), cache); + auto sliceParticle2 = Partition2->sliceByCached(o2::aod::femtobase::stored::collisionId, collision2.globalIndex(), cache); + if (sliceParticle1.size() == 0 || sliceParticle2.size() == 0) { + continue; + } + for (auto const& [p1, p2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(sliceParticle1, sliceParticle2))) { + // pair cleaning + if (!PcManager.isCleanPair(p1, p2)) { + continue; + } + // Close pair rejection + if (CprManager.isActivated()) { + CprManager.setPair(p1, p2); + if (CprManager.isClosePair()) { + continue; + } + } + CprManager.fill(); + PairHistManager.setPair(p1, p2); + PairHistManager.fill(); + } + } +} + +// process mixed event for track and particles decaying into tracks +template +void processMixedEvent(T1& Collisions, + T2& Partition1, + T3& Partition2, + T4& TrackTable, + T5& cache, + T6& policy, + T7& depth, + T8& PairHistManager, + T9& CprManager, + T10& PcManager) +{ + for (auto const& [collision1, collision2] : o2::soa::selfCombinations(policy, depth, -1, Collisions, Collisions)) { + if (!(std::fabs(collision1.magField() - collision2.magField()) < o2::constants::math::Epsilon)) { + continue; + } + CprManager.setMagField(collision1.magField()); + auto sliceParticle1 = Partition1->sliceByCached(o2::aod::femtobase::stored::collisionId, collision1.globalIndex(), cache); + auto sliceParticle2 = Partition2->sliceByCached(o2::aod::femtobase::stored::collisionId, collision2.globalIndex(), cache); + if (sliceParticle1.size() == 0 || sliceParticle2.size() == 0) { + continue; + } + for (auto const& [p1, p2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(sliceParticle1, sliceParticle2))) { + // pair cleaning + if (!PcManager.isCleanPair(p1, p2, TrackTable)) { + continue; + } + // Close pair rejection + if (CprManager.isActivated()) { + CprManager.setPair(p1, p2, TrackTable); + if (CprManager.isClosePair()) { + continue; + } + } + CprManager.fill(); + PairHistManager.setPair(p1, p2); + PairHistManager.fill(); + } + } +} +} // namespace pairprocesshelpers +} // namespace o2::analysis::femto + +#endif // PWGCF_FEMTO_CORE_PAIRPROCESSHELPERS_H_ diff --git a/PWGCF/Femto/Core/partitions.h b/PWGCF/Femto/Core/partitions.h index ffbdf6fd214..4b4943bed44 100644 --- a/PWGCF/Femto/Core/partitions.h +++ b/PWGCF/Femto/Core/partitions.h @@ -16,25 +16,26 @@ #ifndef PWGCF_FEMTO_CORE_PARTITIONS_H_ #define PWGCF_FEMTO_CORE_PARTITIONS_H_ -// collsion filters -#define MAKE_COLLISION_FILTER(selection) \ - (femtocollisions::posZ >= (selection).vtxZMin && femtocollisions::posZ <= (selection).vtxZMax) && \ - (femtocollisions::mult >= (selection).multMin && femtocollisions::mult <= (selection).multMax) && \ - (femtocollisions::cent >= (selection).centMin && femtocollisions::cent <= (selection).centMax) && \ - (femtocollisions::sphericity >= (selection).spherMin && femtocollisions::sphericity <= (selection).spherMax) && \ - (femtocollisions::magField >= (selection).magFieldMin && femtocollisions::magField <= (selection).magFieldMax) +// collsion selection +#define MAKE_COLLISION_FILTER(selection) \ + (femtocollisions::posZ >= selection.vtxZMin && femtocollisions::posZ <= selection.vtxZMax) && \ + (femtocollisions::mult >= selection.multMin && femtocollisions::mult <= selection.multMax) && \ + (femtocollisions::cent >= selection.centMin && femtocollisions::cent <= selection.centMax) && \ + (femtocollisions::sphericity >= selection.spherMin && femtocollisions::sphericity <= selection.spherMax) && \ + (femtocollisions::magField >= selection.magFieldMin && femtocollisions::magField <= selection.magFieldMax) && \ + ncheckbit(femtocollisions::collisionMask, selection.collisionMask) // standard track partition -#define MAKE_TRACK_PARTITION(selection) \ - ifnode(selection.sign.node() > 0, femtobase::stored::signedPt > 0.f, femtobase::stored::signedPt < 0.f) && \ - (nabs(femtobase::stored::signedPt) > selection.ptMin) && \ - (nabs(femtobase::stored::signedPt) < selection.ptMax) && \ - (femtobase::stored::eta > selection.etaMin) && \ - (femtobase::stored::eta < selection.etaMax) && \ - (femtobase::stored::phi > selection.phiMin) && \ - (femtobase::stored::phi < selection.phiMax) && \ - ifnode(nabs(femtobase::stored::signedPt) * (nexp(femtobase::stored::eta) + nexp(-1.f * femtobase::stored::eta)) / 2.f <= selection.pidThres, \ - ncheckbit(femtotracks::trackMask, selection.maskLowMomentum), \ +#define MAKE_TRACK_PARTITION(selection) \ + ifnode(selection.sign.node() > 0, femtobase::stored::signedPt > 0.f, femtobase::stored::signedPt < 0.f) && \ + (nabs(femtobase::stored::signedPt) > selection.ptMin) && \ + (nabs(femtobase::stored::signedPt) < selection.ptMax) && \ + (femtobase::stored::eta > selection.etaMin) && \ + (femtobase::stored::eta < selection.etaMax) && \ + (femtobase::stored::phi > selection.phiMin) && \ + (femtobase::stored::phi < selection.phiMax) && \ + ifnode(nabs(femtobase::stored::signedPt) * (nexp(femtobase::stored::eta) + nexp(-1.f * femtobase::stored::eta)) / 2.f <= selection.pidThres, /* o2-linter: disable=magic-number (formula for cosh) */ \ + ncheckbit(femtotracks::trackMask, selection.maskLowMomentum), \ ncheckbit(femtotracks::trackMask, selection.maskHighMomentum)) // partition for phis and rhos, i.e. resonance that are their own antiparticle diff --git a/PWGCF/Femto/Core/trackBuilder.h b/PWGCF/Femto/Core/trackBuilder.h index 9a784acee35..d8e1f3251dd 100644 --- a/PWGCF/Femto/Core/trackBuilder.h +++ b/PWGCF/Femto/Core/trackBuilder.h @@ -118,6 +118,7 @@ struct ConfTrackSelection : public o2::framework::ConfigurableGroup { // configuration parameters o2::framework::Configurable pdgCode{"pdgCode", 2212, "Track PDG code"}; o2::framework::Configurable sign{"sign", 1, "Sign of the track (1 for positive tracks and -1 for negative tracks)"}; + o2::framework::Configurable absCharge{"absCharge", 1, "Absolute charge of the track (keep 1 for all tracks, except for He, it should be 2)"}; // filters for kinematics o2::framework::Configurable ptMin{"ptMin", 0.2f, "Minimum pT (GeV/c)"}; o2::framework::Configurable ptMax{"ptMax", 6.f, "Maximum pT (GeV/c)"}; @@ -443,7 +444,7 @@ struct ConfTrackTables : o2::framework::ConfigurableGroup { class TrackBuilder { public: - TrackBuilder() {} + TrackBuilder() = default; virtual ~TrackBuilder() = default; template diff --git a/PWGCF/Femto/Core/trackHistManager.h b/PWGCF/Femto/Core/trackHistManager.h index 677e88e5487..197c47983cc 100644 --- a/PWGCF/Femto/Core/trackHistManager.h +++ b/PWGCF/Femto/Core/trackHistManager.h @@ -146,6 +146,7 @@ using ConfKinkChaDauBinning = ConfTrackBinning; template struct ConfTrackQaBinning : o2::framework::ConfigurableGroup { std::string prefix = Prefix; + o2::framework::Configurable momentumType{"momentumType", 0, "Momentum on x-axis (0->Pt, 1->P at PV"}; o2::framework::ConfigurableAxis itsCluster{"itsCluster", {{8, -0.5, 7.5}}, "ITS cluster"}; o2::framework::ConfigurableAxis itsClusterIb{"itsClusterIb", {{4, -0.5, 3.5}}, "ITS cluster in inner barrel"}; o2::framework::ConfigurableAxis tpcCrossedRows{"tpcCrossedRows", {{161, -0.5, 160.5}}, "TPC cluster"}; @@ -396,9 +397,10 @@ class TrackHistManager /// Destructor virtual ~TrackHistManager() = default; - void init(o2::framework::HistogramRegistry* registry, std::map> Specs) + void init(o2::framework::HistogramRegistry* registry, std::map> Specs, float charge = 1, int momentumTypeForPid = 0) { mHistogramRegistry = registry; + mAbsCharge = std::fabs(charge); if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { std::string analysisDir = std::string(prefix) + std::string(AnalysisDir); @@ -410,6 +412,7 @@ class TrackHistManager } if constexpr (isFlagSet(mode, modes::Mode::kQa)) { + std::string qaDir = std::string(prefix) + std::string(QaDir); mHistogramRegistry->add(qaDir + GetHistNamev2(kItsCluster, HistTable), GetHistDesc(kItsCluster, HistTable), GetHistType(kItsCluster, HistTable), {Specs[kItsCluster]}); @@ -435,6 +438,8 @@ class TrackHistManager std::string pidDir = std::string(prefix) + std::string(PidDir); + mMomentumType = static_cast(momentumTypeForPid); + mHistogramRegistry->add(pidDir + GetHistNamev2(kItsSignal, HistTable), GetHistDesc(kItsSignal, HistTable), GetHistType(kItsSignal, HistTable), {Specs[kItsSignal]}); mHistogramRegistry->add(pidDir + GetHistNamev2(kItsElectron, HistTable), GetHistDesc(kItsElectron, HistTable), GetHistType(kItsElectron, HistTable), {Specs[kItsElectron]}); mHistogramRegistry->add(pidDir + GetHistNamev2(kItsPion, HistTable), GetHistDesc(kItsPion, HistTable), GetHistType(kItsPion, HistTable), {Specs[kItsPion]}); @@ -485,7 +490,7 @@ class TrackHistManager void fill(T const& track) { if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kPt, HistTable)), track.pt()); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kPt, HistTable)), mAbsCharge * track.pt()); mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kEta, HistTable)), track.eta()); mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kPhi, HistTable)), track.phi()); mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kSign, HistTable)), track.sign()); @@ -499,67 +504,77 @@ class TrackHistManager mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kTpcClusterShared, HistTable)), static_cast(track.tpcNClsShared())); mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kTpcClusterFractionShared, HistTable)), track.tpcSharedOverFound()); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsEta, HistTable)), track.pt(), track.eta()); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsPhi, HistTable)), track.pt(), track.phi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsEta, HistTable)), mAbsCharge * track.pt(), track.eta()); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsPhi, HistTable)), mAbsCharge * track.pt(), track.phi()); mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPhiVsEta, HistTable)), track.phi(), track.eta()); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsItsCluster, HistTable)), track.pt(), static_cast(track.itsNCls())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsTpcCluster, HistTable)), track.pt(), static_cast(track.tpcNClsFound())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsTpcClusterShared, HistTable)), track.pt(), static_cast(track.tpcNClsShared())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsItsCluster, HistTable)), mAbsCharge * track.pt(), static_cast(track.itsNCls())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsTpcCluster, HistTable)), mAbsCharge * track.pt(), static_cast(track.tpcNClsFound())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsTpcClusterShared, HistTable)), mAbsCharge * track.pt(), static_cast(track.tpcNClsShared())); mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kTpcClusterVsTpcClusterShared, HistTable)), static_cast(track.tpcNClsFound()), static_cast(track.tpcNClsShared())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsDcaxy, HistTable)), track.pt(), track.dcaXY()); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsDcaz, HistTable)), track.pt(), track.dcaZ()); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsDca, HistTable)), track.pt(), track.dca()); - - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsSignal, HistTable)), track.p(), o2::analysis::femto::utils::itsSignal(track)); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsElectron, HistTable)), track.p(), track.itsNSigmaEl()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsPion, HistTable)), track.p(), track.itsNSigmaPi()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsKaon, HistTable)), track.p(), track.itsNSigmaKa()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsProton, HistTable)), track.p(), track.itsNSigmaPr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsDeuteron, HistTable)), track.p(), track.itsNSigmaDe()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsTriton, HistTable)), track.p(), track.itsNSigmaTr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsHelium, HistTable)), track.p(), track.itsNSigmaHe()); - - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcSignal, HistTable)), track.p(), track.tpcSignal()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcElectron, HistTable)), track.p(), track.tpcNSigmaEl()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcPion, HistTable)), track.p(), track.tpcNSigmaPi()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcKaon, HistTable)), track.p(), track.tpcNSigmaKa()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcProton, HistTable)), track.p(), track.tpcNSigmaPr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcDeuteron, HistTable)), track.p(), track.tpcNSigmaDe()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcTriton, HistTable)), track.p(), track.tpcNSigmaTr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcHelium, HistTable)), track.p(), track.tpcNSigmaHe()); - - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofBeta, HistTable)), track.p(), track.tofBeta()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofMass, HistTable)), track.p(), track.tofMass()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofElectron, HistTable)), track.p(), track.tofNSigmaEl()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofPion, HistTable)), track.p(), track.tofNSigmaPi()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofKaon, HistTable)), track.p(), track.tofNSigmaKa()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofProton, HistTable)), track.p(), track.tofNSigmaPr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofDeuteron, HistTable)), track.p(), track.tofNSigmaDe()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofTriton, HistTable)), track.p(), track.tofNSigmaTr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofHelium, HistTable)), track.p(), track.tofNSigmaHe()); - - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsElectron, HistTable)), track.p(), track.tpcitsNSigmaEl()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsPion, HistTable)), track.p(), track.tpcitsNSigmaPi()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsKaon, HistTable)), track.p(), track.tpcitsNSigmaKa()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsProton, HistTable)), track.p(), track.tpcitsNSigmaPr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsDeuteron, HistTable)), track.p(), track.tpcitsNSigmaDe()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsTriton, HistTable)), track.p(), track.tpcitsNSigmaTr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsHelium, HistTable)), track.p(), track.tpcitsNSigmaHe()); - - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofElectron, HistTable)), track.p(), track.tpctofNSigmaEl()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofPion, HistTable)), track.p(), track.tpctofNSigmaPi()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofKaon, HistTable)), track.p(), track.tpctofNSigmaKa()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofProton, HistTable)), track.p(), track.tpctofNSigmaPr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofDeuteron, HistTable)), track.p(), track.tpctofNSigmaDe()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofTriton, HistTable)), track.p(), track.tpctofNSigmaTr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofHelium, HistTable)), track.p(), track.tpctofNSigmaHe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsDcaxy, HistTable)), mAbsCharge * track.pt(), track.dcaXY()); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsDcaz, HistTable)), mAbsCharge * track.pt(), track.dcaZ()); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsDca, HistTable)), mAbsCharge * track.pt(), track.dca()); + + float momentum = 0.f; + if (mMomentumType == modes::MomentumType::kPAtPv) { + momentum = mAbsCharge * track.p(); + } else if (mMomentumType == modes::MomentumType::kPt) { + momentum = mAbsCharge * track.pt(); + } + + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsSignal, HistTable)), momentum, o2::analysis::femto::utils::itsSignal(track)); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsElectron, HistTable)), momentum, track.itsNSigmaEl()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsPion, HistTable)), momentum, track.itsNSigmaPi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsKaon, HistTable)), momentum, track.itsNSigmaKa()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsProton, HistTable)), momentum, track.itsNSigmaPr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsDeuteron, HistTable)), momentum, track.itsNSigmaDe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsTriton, HistTable)), momentum, track.itsNSigmaTr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsHelium, HistTable)), momentum, track.itsNSigmaHe()); + + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcSignal, HistTable)), momentum, track.tpcSignal()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcElectron, HistTable)), momentum, track.tpcNSigmaEl()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcPion, HistTable)), momentum, track.tpcNSigmaPi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcKaon, HistTable)), momentum, track.tpcNSigmaKa()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcProton, HistTable)), momentum, track.tpcNSigmaPr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcDeuteron, HistTable)), momentum, track.tpcNSigmaDe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcTriton, HistTable)), momentum, track.tpcNSigmaTr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcHelium, HistTable)), momentum, track.tpcNSigmaHe()); + + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofBeta, HistTable)), momentum, track.tofBeta()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofMass, HistTable)), momentum, track.tofMass()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofElectron, HistTable)), momentum, track.tofNSigmaEl()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofPion, HistTable)), momentum, track.tofNSigmaPi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofKaon, HistTable)), momentum, track.tofNSigmaKa()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofProton, HistTable)), momentum, track.tofNSigmaPr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofDeuteron, HistTable)), momentum, track.tofNSigmaDe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofTriton, HistTable)), momentum, track.tofNSigmaTr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofHelium, HistTable)), momentum, track.tofNSigmaHe()); + + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsElectron, HistTable)), momentum, track.tpcitsNSigmaEl()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsPion, HistTable)), momentum, track.tpcitsNSigmaPi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsKaon, HistTable)), momentum, track.tpcitsNSigmaKa()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsProton, HistTable)), momentum, track.tpcitsNSigmaPr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsDeuteron, HistTable)), momentum, track.tpcitsNSigmaDe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsTriton, HistTable)), momentum, track.tpcitsNSigmaTr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsHelium, HistTable)), momentum, track.tpcitsNSigmaHe()); + + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofElectron, HistTable)), momentum, track.tpctofNSigmaEl()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofPion, HistTable)), momentum, track.tpctofNSigmaPi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofKaon, HistTable)), momentum, track.tpctofNSigmaKa()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofProton, HistTable)), momentum, track.tpctofNSigmaPr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofDeuteron, HistTable)), momentum, track.tpctofNSigmaDe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofTriton, HistTable)), momentum, track.tpctofNSigmaTr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofHelium, HistTable)), momentum, track.tpctofNSigmaHe()); } } private: - o2::framework::HistogramRegistry* mHistogramRegistry; + o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; + float mAbsCharge = 1; + modes::MomentumType mMomentumType = modes::MomentumType::kPAtPv; }; }; // namespace trackhistmanager +// aespace trackhistmanager }; // namespace o2::analysis::femto #endif // PWGCF_FEMTO_CORE_TRACKHISTMANAGER_H_ diff --git a/PWGCF/Femto/Core/v0HistManager.h b/PWGCF/Femto/Core/v0HistManager.h index 7dc732b84b1..d767791d558 100644 --- a/PWGCF/Femto/Core/v0HistManager.h +++ b/PWGCF/Femto/Core/v0HistManager.h @@ -182,9 +182,11 @@ std::map> makeV0QaHistSpecMap(T1 const& }; constexpr char PrefixLambdaQa[] = "LambdaQA/"; -constexpr char PrefixLambda[] = "Lambda/"; +constexpr char PrefixLambda1[] = "Lambda1/"; +constexpr char PrefixLambda2[] = "Lambda2/"; constexpr char PrefixK0shortQa[] = "K0shortQa/"; -constexpr char PrefixK0short[] = "K0short/"; +constexpr char PrefixK0short1[] = "K0short1/"; +constexpr char PrefixK0short2[] = "K0short2/"; constexpr char PrefixLambdaCascade[] = "LambdaCascadeQa/"; diff --git a/PWGCF/Femto/DataModel/FemtoTables.h b/PWGCF/Femto/DataModel/FemtoTables.h index c7bc8334c52..9f87b6a6d24 100644 --- a/PWGCF/Femto/DataModel/FemtoTables.h +++ b/PWGCF/Femto/DataModel/FemtoTables.h @@ -34,7 +34,7 @@ namespace o2::aod namespace femtocollisions { -DECLARE_SOA_COLUMN(CollisionMask, collisionMask, femtodatatypes::CollsionsMaskType); //! Bitmask for collision selections +DECLARE_SOA_COLUMN(CollisionMask, collisionMask, femtodatatypes::CollisionMaskType); //! Bitmask for collision selections DECLARE_SOA_COLUMN(PosX, posX, float); //! x coordinate of vertex DECLARE_SOA_COLUMN(PosY, posY, float); //! y coordinate of vertex @@ -43,7 +43,6 @@ DECLARE_SOA_COLUMN(Mult, mult, float); //! Multiplicity estimator se DECLARE_SOA_COLUMN(Cent, cent, float); //! Centrality (~= multiplicity percentile) estimator set by producer DECLARE_SOA_COLUMN(MagField, magField, float); //! Magnetic field of the event DECLARE_SOA_COLUMN(Sphericity, sphericity, float); //! Sphericity of the event -DECLARE_SOA_COLUMN(Occupancy, occupancy, float); //! occupancy of the event DECLARE_SOA_COLUMN(Qn, qn, float); //! qn bins for dividing events } // namespace femtocollisions @@ -62,11 +61,6 @@ DECLARE_SOA_TABLE_STAGED_VERSIONED(FColMasks_001, "FCOLMASK", 1, //! track masks femtocollisions::CollisionMask); using FColMasks = FColMasks_001; -// table for occupancy -DECLARE_SOA_TABLE_STAGED_VERSIONED(FColOccs_001, "FCOLOCC", 1, //! occupancy - femtocollisions::Occupancy); -using FColOccs = FColOccs_001; - // table for qn values DECLARE_SOA_TABLE_STAGED_VERSIONED(FColQns_001, "FCOLQN", 1, //! qn vector femtocollisions::Qn); @@ -274,50 +268,50 @@ DECLARE_SOA_TABLE_STAGED_VERSIONED(FElectronPids_001, "FELECTRONPID", 1, //! ful femtotracks::ItsNSigmaEl, femtotracks::TpcNSigmaEl, femtotracks::TofNSigmaEl, - femtotracks::TpcitsNSigmaEl, - femtotracks::TpctofNSigmaEl); + femtotracks::TpcitsNSigmaEl, + femtotracks::TpctofNSigmaEl); using FElectronPids = FElectronPids_001; DECLARE_SOA_TABLE_STAGED_VERSIONED(FPionPids_001, "FPIONPID", 1, //! full pion pid femtotracks::ItsNSigmaPi, femtotracks::TpcNSigmaPi, femtotracks::TofNSigmaPi, - femtotracks::TpcitsNSigmaPi, - femtotracks::TpctofNSigmaPi); + femtotracks::TpcitsNSigmaPi, + femtotracks::TpctofNSigmaPi); using FPionPids = FPionPids_001; DECLARE_SOA_TABLE_STAGED_VERSIONED(FKaonPids_001, "FKAONPID", 1, //! full kaon pid femtotracks::ItsNSigmaKa, femtotracks::TpcNSigmaKa, femtotracks::TofNSigmaKa, - femtotracks::TpcitsNSigmaKa, - femtotracks::TpctofNSigmaKa); + femtotracks::TpcitsNSigmaKa, + femtotracks::TpctofNSigmaKa); using FKaonPids = FKaonPids_001; DECLARE_SOA_TABLE_STAGED_VERSIONED(FProtonPids_001, "FPROTONPID", 1, //! full proton pid femtotracks::ItsNSigmaPr, femtotracks::TpcNSigmaPr, femtotracks::TofNSigmaPr, - femtotracks::TpcitsNSigmaPr, - femtotracks::TpctofNSigmaPr); + femtotracks::TpcitsNSigmaPr, + femtotracks::TpctofNSigmaPr); using FProtonPids = FProtonPids_001; DECLARE_SOA_TABLE_STAGED_VERSIONED(FDeuteronPids_001, "FDEUTERONPID", 1, //! full deuteron pid femtotracks::ItsNSigmaDe, femtotracks::TpcNSigmaDe, femtotracks::TofNSigmaDe, - femtotracks::TpcitsNSigmaDe, - femtotracks::TpctofNSigmaDe); + femtotracks::TpcitsNSigmaDe, + femtotracks::TpctofNSigmaDe); using FDeuteronPids = FDeuteronPids_001; DECLARE_SOA_TABLE_STAGED_VERSIONED(FTritonPids_001, "FTRITONPID", 1, //! full triton pid femtotracks::ItsNSigmaTr, femtotracks::TpcNSigmaTr, femtotracks::TofNSigmaTr, - femtotracks::TpcitsNSigmaTr, - femtotracks::TpctofNSigmaTr); + femtotracks::TpcitsNSigmaTr, + femtotracks::TpctofNSigmaTr); using FTritonPids = FTritonPids_001; DECLARE_SOA_TABLE_STAGED_VERSIONED(FHeliumPids_001, "FHELIUMPID", 1, //! full helium3 pid femtotracks::ItsNSigmaHe, femtotracks::TpcNSigmaHe, femtotracks::TofNSigmaHe, - femtotracks::TpcitsNSigmaHe, - femtotracks::TpctofNSigmaHe); + femtotracks::TpcitsNSigmaHe, + femtotracks::TpctofNSigmaHe); using FHeliumPids = FHeliumPids_001; using FTrackPids = soa::Join; diff --git a/PWGCF/Femto/Tasks/CMakeLists.txt b/PWGCF/Femto/Tasks/CMakeLists.txt index 7ed493cc309..0eacf23db6b 100644 --- a/PWGCF/Femto/Tasks/CMakeLists.txt +++ b/PWGCF/Femto/Tasks/CMakeLists.txt @@ -34,12 +34,12 @@ o2physics_add_dpl_workflow(femto-cascade-qa PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) -# o2physics_add_dpl_workflow(femtounited-pair-track-track -# SOURCES femtounitedPairTrackTrack.cxx -# PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore -# COMPONENT_NAME Analysis) -# -# o2physics_add_dpl_workflow(femtounited-pair-track-v0 -# SOURCES femtounitedPairTrackV0.cxx -# PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore -# COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(femto-pair-track-track + SOURCES femtoPairTrackTrack.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(femto-pair-track-v0 + SOURCES femtoPairTrackV0.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGCF/Femto/Tasks/femtoCascadeQa.cxx b/PWGCF/Femto/Tasks/femtoCascadeQa.cxx index 1de5aef92ec..4d1bd1953d7 100644 --- a/PWGCF/Femto/Tasks/femtoCascadeQa.cxx +++ b/PWGCF/Femto/Tasks/femtoCascadeQa.cxx @@ -46,7 +46,7 @@ using namespace o2::analysis::femto; struct FemtoCascadeQa { // setup tables - using Collisions = FCols; + using Collisions = Join; using Collision = Collisions::iterator; using FilteredCollisions = o2::soa::Filtered; @@ -59,10 +59,10 @@ struct FemtoCascadeQa { SliceCache cache; // setup collisions + collisionbuilder::ConfCollisionSelection collisionSelection; + Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); colhistmanager::CollisionHistManager colHistManager; colhistmanager::ConfCollisionBinning confCollisionBinning; - collisionbuilder::ConfCollisionFilters collisionSelection; - Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); // setup for xis cascadebuilder::ConfXiSelection confXiSelection; diff --git a/PWGCF/Femto/Tasks/femtoKinkQa.cxx b/PWGCF/Femto/Tasks/femtoKinkQa.cxx index 1fdb4e58693..a416ba5993f 100644 --- a/PWGCF/Femto/Tasks/femtoKinkQa.cxx +++ b/PWGCF/Femto/Tasks/femtoKinkQa.cxx @@ -48,14 +48,14 @@ using namespace o2::analysis::femto; struct FemtoKinkQa { // setup for collisions - collisionbuilder::ConfCollisionFilters collisionSelection; + collisionbuilder::ConfCollisionSelection collisionSelection; Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); colhistmanager::CollisionHistManager colHistManager; colhistmanager::ConfCollisionBinning confCollisionBinning; // using Collisions = o2::soa::Join; - using Collisions = FCols; + using Collisions = Join; using Collision = Collisions::iterator; using FilteredCollisions = o2::soa::Filtered; diff --git a/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx b/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx new file mode 100644 index 00000000000..b0d7f54baa3 --- /dev/null +++ b/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx @@ -0,0 +1,133 @@ +// Copyright 2019-2025 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 femtoPairTrackTrack.cxx +/// \brief Tasks that computes correlation between two tracks +/// \author Anton Riedel, TU München, anton.riedel@cern.ch + +#include "PWGCF/Femto/Core/closePairRejection.h" +#include "PWGCF/Femto/Core/collisionBuilder.h" +#include "PWGCF/Femto/Core/collisionHistManager.h" +#include "PWGCF/Femto/Core/pairBuilder.h" +#include "PWGCF/Femto/Core/partitions.h" +#include "PWGCF/Femto/Core/trackBuilder.h" +#include "PWGCF/Femto/Core/trackHistManager.h" +#include "PWGCF/Femto/DataModel/FemtoTables.h" + +#include "Framework/ASoA.h" +#include "Framework/AnalysisTask.h" +#include "Framework/Configurable.h" +#include "Framework/Expressions.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" + +#include +#include + +using namespace o2; +using namespace o2::aod; +using namespace o2::soa; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::analysis::femto; + +struct FemtoPairTrackTrack { + + // setup tables + using Collisions = Join; + using Collision = Collisions::iterator; + + using FilteredCollisions = o2::soa::Filtered; + using FilteredCollision = FilteredCollisions::iterator; + + using Tracks = o2::soa::Join; + + SliceCache cache; + + // setup collisions + collisionbuilder::ConfCollisionSelection collisionSelection; + Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); + colhistmanager::ConfCollisionBinning confCollisionBinning; + + // setup tracks + trackbuilder::ConfTrackSelection1 trackSelections1; + trackhistmanager::ConfTrackBinning1 confTrackBinning1; + trackbuilder::ConfTrackSelection2 trackSelections2; + trackhistmanager::ConfTrackBinning2 confTrackBinning2; + + Partition trackPartition1 = MAKE_TRACK_PARTITION(trackSelections1); + Partition trackPartition2 = MAKE_TRACK_PARTITION(trackSelections2); + + Preslice perColReco = aod::femtobase::stored::collisionId; + + // setup pairs + pairhistmanager::ConfPairBinning confPairBinning; + closepairrejection::ConfCpr confCpr; + + pairbuilder::PairTrackTrackBuilder< + trackhistmanager::PrefixTrack1, + trackhistmanager::PrefixTrack2, + pairhistmanager::PrefixTrackTrackSe, + pairhistmanager::PrefixTrackTrackMe, + closepairrejection::PrefixTrackTrackSe, + closepairrejection::PrefixTrackTrackMe, + modes::Mode::kAnalysis> + pairTrackTrackBuilder; + + // setup mixing + std::vector defaultVtxBins{10, -10, 10}; + std::vector defaultMultBins{50, 0, 200}; + std::vector defaultCentBins{10, 0, 100}; + ColumnBinningPolicy mixBinsVtxMult{{defaultVtxBins, defaultMultBins}, true}; + ColumnBinningPolicy mixBinsVtxCent{{defaultVtxBins, defaultCentBins}, true}; + ColumnBinningPolicy mixBinsVtxMultCent{{defaultVtxBins, defaultMultBins, defaultCentBins}, true}; + pairhistmanager::ConfMixing confMixing; + + HistogramRegistry hRegistry{"FemtoTrackTrack", {}, OutputObjHandlingPolicy::AnalysisObject}; + + void init(InitContext&) + { + // setup columnpolicy for binning + // default values are used during instantiation, so we need to explicity update them here + mixBinsVtxMult = {{confMixing.vtxBins, confMixing.multBins.value}, true}; + mixBinsVtxCent = {{confMixing.vtxBins.value, confMixing.centBins.value}, true}; + mixBinsVtxMultCent = {{confMixing.vtxBins.value, confMixing.multBins.value, confMixing.centBins.value}, true}; + + // setup histogram specs + auto colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); + auto trackHistSpec1 = trackhistmanager::makeTrackHistSpecMap(confTrackBinning1); + auto trackHistSpec2 = trackhistmanager::makeTrackHistSpecMap(confTrackBinning2); + auto pairHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning1, confTrackBinning2); + auto cprHistSpec = closepairrejection::makeCprHistSpecMap(confCpr); + + pairTrackTrackBuilder.init(&hRegistry, trackSelections1, trackSelections2, confCpr, confMixing, colHistSpec, trackHistSpec1, trackHistSpec2, pairHistSpec, cprHistSpec); + }; + + void processSameEvent(FilteredCollision const& col, Tracks const& tracks) + { + pairTrackTrackBuilder.processSameEvent(col, tracks, trackPartition1, trackPartition2, cache); + } + PROCESS_SWITCH(FemtoPairTrackTrack, processSameEvent, "Enable processing same event processing", true); + + void processMixedEvent(FilteredCollisions const& cols, Tracks const& tracks) + { + pairTrackTrackBuilder.processMixedEvent(cols, tracks, trackPartition1, trackPartition2, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + } + PROCESS_SWITCH(FemtoPairTrackTrack, processMixedEvent, "Enable processing mixed event processing", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{ + adaptAnalysisTask(cfgc), + }; + return workflow; +} diff --git a/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx b/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx new file mode 100644 index 00000000000..4ff228948f6 --- /dev/null +++ b/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx @@ -0,0 +1,198 @@ +// Copyright 2019-2025 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 femtoPairTrackV0.cxx +/// \brief Tasks that computes correlation between tracks and v0s +/// \author Anton Riedel, TU München, anton.riedel@cern.ch + +#include "PWGCF/Femto/Core/closePairRejection.h" +#include "PWGCF/Femto/Core/collisionBuilder.h" +#include "PWGCF/Femto/Core/collisionHistManager.h" +#include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/pairBuilder.h" +#include "PWGCF/Femto/Core/pairHistManager.h" +#include "PWGCF/Femto/Core/partitions.h" +#include "PWGCF/Femto/Core/trackBuilder.h" +#include "PWGCF/Femto/Core/trackHistManager.h" +#include "PWGCF/Femto/Core/v0Builder.h" +#include "PWGCF/Femto/Core/v0HistManager.h" +#include "PWGCF/Femto/DataModel/FemtoTables.h" + +#include "Framework/ASoA.h" +#include "Framework/AnalysisTask.h" +#include "Framework/Configurable.h" +#include "Framework/Expressions.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" + +#include +#include + +using namespace o2; +using namespace o2::aod; +using namespace o2::soa; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::analysis::femto; + +struct FemtoPairTrackV0 { + + // setup tables + using Collisions = Join; + using Collision = Collisions::iterator; + + using FilteredCollisions = o2::soa::Filtered; + using FilteredCollision = FilteredCollisions::iterator; + + using Tracks = o2::soa::Join; + using Lambdas = o2::soa::Join; + using K0shorts = o2::soa::Join; + + SliceCache cache; + + // setup collisions + collisionbuilder::ConfCollisionSelection collisionSelection; + Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); + colhistmanager::ConfCollisionBinning confCollisionBinning; + + // setup tracks + trackbuilder::ConfTrackSelection1 trackSelection; + trackhistmanager::ConfTrackBinning1 confTrackBinning; + Partition trackPartition = MAKE_TRACK_PARTITION(trackSelection); + Preslice perColTracks = aod::femtobase::stored::collisionId; + + // setup for daughters + trackhistmanager::ConfV0PosDauBinning confPosDauBinning; + trackhistmanager::ConfV0NegDauBinning confNegDauBinning; + + // setup lambdas + v0builder::ConfLambdaSelection1 lambdaSelection; + v0histmanager::ConfLambdaBinning1 confLambdaBinning; + Partition lambdaPartition = MAKE_LAMBDA_PARTITION(lambdaSelection); + Preslice perColLambdas = aod::femtobase::stored::collisionId; + + // setup k0shorts + v0builder::ConfK0shortSelection1 k0shortSelection; + v0histmanager::ConfK0shortBinning1 confK0shortBinning; + Partition k0shortPartition = MAKE_K0SHORT_PARTITION(k0shortSelection); + Preslice perColk0shorts = aod::femtobase::stored::collisionId; + + // setup pairs + pairhistmanager::ConfPairBinning confPairBinning; + + pairbuilder::PairTrackV0Builder< + trackhistmanager::PrefixTrack1, + v0histmanager::PrefixLambda1, + trackhistmanager::PrefixV0PosDaughter, + trackhistmanager::PrefixV0NegDaughter, + pairhistmanager::PrefixTrackV0Se, + pairhistmanager::PrefixTrackV0Me, + closepairrejection::PrefixTrackV0Se, + closepairrejection::PrefixTrackV0Me, + modes::Mode::kAnalysis, + modes::V0::kLambda> + pairTrackLambdaBuilder; + + pairbuilder::PairTrackV0Builder< + trackhistmanager::PrefixTrack1, + v0histmanager::PrefixK0short1, + trackhistmanager::PrefixV0PosDaughter, + trackhistmanager::PrefixV0NegDaughter, + pairhistmanager::PrefixTrackV0Se, + pairhistmanager::PrefixTrackV0Me, + closepairrejection::PrefixTrackV0Se, + closepairrejection::PrefixTrackV0Me, + modes::Mode::kAnalysis, + modes::V0::kK0short> + pairTrackK0shortBuilder; + + // setup mixing + std::vector defaultVtxBins{10, -10, 10}; + std::vector defaultMultBins{50, 0, 200}; + std::vector defaultCentBins{10, 0, 100}; + ColumnBinningPolicy mixBinsVtxMult{{defaultVtxBins, defaultMultBins}, true}; + ColumnBinningPolicy mixBinsVtxCent{{defaultVtxBins, defaultCentBins}, true}; + ColumnBinningPolicy mixBinsVtxMultCent{{defaultVtxBins, defaultMultBins, defaultCentBins}, true}; + pairhistmanager::ConfMixing confMixing; + + HistogramRegistry hRegistry{"FemtoTrackV0", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // setup cpr + closepairrejection::ConfCpr confCpr; + + void init(InitContext&) + { + + // setup columnpolicy for binning + // default values are used during instantiation, so we need to explicity update them here + mixBinsVtxMult = {{confMixing.vtxBins, confMixing.multBins.value}, true}; + mixBinsVtxCent = {{confMixing.vtxBins.value, confMixing.centBins.value}, true}; + mixBinsVtxMultCent = {{confMixing.vtxBins.value, confMixing.multBins.value, confMixing.centBins.value}, true}; + + // setup histograms + auto colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); + auto trackHistSpec = trackhistmanager::makeTrackHistSpecMap(confTrackBinning); + auto posDauSpec = trackhistmanager::makeTrackHistSpecMap(confPosDauBinning); + auto negDauSpec = trackhistmanager::makeTrackHistSpecMap(confNegDauBinning); + auto pairHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confLambdaBinning); + auto cprHistSpec = closepairrejection::makeCprHistSpecMap(confCpr); + + // setup for lambda + // if (doprocessLambdaSameEvent || doprocessLambdaMixedEvent) { + if (doprocessLambdaSameEvent) { + auto lambdaHistSpec = v0histmanager::makeV0HistSpecMap(confLambdaBinning); + pairTrackLambdaBuilder.init(&hRegistry, trackSelection, lambdaSelection, confCpr, confMixing, colHistSpec, trackHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairHistSpec, cprHistSpec); + } + + // if (((doprocessLambdaSameEvent || doprocessLambdaMixedEvent) + (doprocessK0shortSameEvent || doprocessK0shortMixedEvent)) > 1) { + // LOG(fatal) << "Can only process lambda-tracks Or k0short-tracks"; + // } + + // setup for k0short + // if (doprocessK0shortSameEvent || doprocessK0shortMixedEvent) { + if (doprocessK0shortSameEvent) { + auto k0shortHistSpec = v0histmanager::makeV0HistSpecMap(confK0shortBinning); + pairTrackK0shortBuilder.init(&hRegistry, trackSelection, lambdaSelection, confCpr, confMixing, colHistSpec, trackHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairHistSpec, cprHistSpec); + } + }; + + void processLambdaSameEvent(FilteredCollision const& col, Tracks const& tracks, Lambdas const& lambdas) + { + pairTrackLambdaBuilder.processSameEvent(col, tracks, trackPartition, lambdas, lambdaPartition, cache); + } + PROCESS_SWITCH(FemtoPairTrackV0, processLambdaSameEvent, "Enable processing same event processing for tracks and lambdas", true); + + void processLambdaMixedEvent(FilteredCollisions const& cols, Tracks const& tracks, Lambdas const& /*lambas*/) + { + pairTrackLambdaBuilder.processMixedEvent(cols, tracks, trackPartition, lambdaPartition, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + } + PROCESS_SWITCH(FemtoPairTrackV0, processLambdaMixedEvent, "Enable processing mixed event processing for tracks and lambdas", true); + // + void processK0shortSameEvent(FilteredCollision const& col, Tracks const& tracks, K0shorts const& k0shorts) + { + pairTrackK0shortBuilder.processSameEvent(col, tracks, trackPartition, k0shorts, k0shortPartition, cache); + } + PROCESS_SWITCH(FemtoPairTrackV0, processK0shortSameEvent, "Enable processing same event processing for tracks and k0shorts", false); + + void processK0shortMixedEvent(FilteredCollisions const& cols, Tracks const& tracks, K0shorts const& /*k0shorts*/) + { + pairTrackK0shortBuilder.processMixedEvent(cols, tracks, trackPartition, k0shortPartition, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + } + PROCESS_SWITCH(FemtoPairTrackV0, processK0shortMixedEvent, "Enable processing mixed event processing for tracks and k0shorts", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{ + adaptAnalysisTask(cfgc), + }; + return workflow; +} diff --git a/PWGCF/Femto/Tasks/femtoTrackQa.cxx b/PWGCF/Femto/Tasks/femtoTrackQa.cxx index a111111f6b0..53338a1852d 100644 --- a/PWGCF/Femto/Tasks/femtoTrackQa.cxx +++ b/PWGCF/Femto/Tasks/femtoTrackQa.cxx @@ -43,7 +43,7 @@ using namespace o2::analysis::femto; struct FemtoTrackQa { // setup tables - using Collisions = FCols; + using Collisions = o2::soa::Join; using Collision = Collisions::iterator; using FilteredCollisions = o2::soa::Filtered; @@ -54,7 +54,7 @@ struct FemtoTrackQa { SliceCache cache; // setup collisions - collisionbuilder::ConfCollisionFilters collisionSelection; + collisionbuilder::ConfCollisionSelection collisionSelection; Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); colhistmanager::ConfCollisionBinning confCollisionBinning; colhistmanager::CollisionHistManager colHistManager; @@ -76,7 +76,7 @@ struct FemtoTrackQa { auto colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); colHistManager.init(&hRegistry, colHistSpec); auto trackHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confTrackBinning, confTrackQaBinning); - trackHistManager.init(&hRegistry, trackHistSpec); + trackHistManager.init(&hRegistry, trackHistSpec, trackSelections.absCharge.value, confTrackQaBinning.momentumType.value); }; void process(FilteredCollision const& col, Tracks const& /*tracks*/) @@ -85,7 +85,6 @@ struct FemtoTrackQa { auto trackSlice = trackPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); for (auto const& track : trackSlice) { trackHistManager.fill(track); - // asdf } } }; diff --git a/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx b/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx index 83b28842469..5e7b6192ae7 100644 --- a/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx +++ b/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx @@ -44,7 +44,7 @@ using namespace o2::analysis::femto; struct FemtoTwotrackresonanceQa { // setup tables - using Collisions = FCols; + using Collisions = Join; using Collision = Collisions::iterator; using FilteredCollisions = o2::soa::Filtered; @@ -58,10 +58,10 @@ struct FemtoTwotrackresonanceQa { SliceCache cache; // setup for collisions + collisionbuilder::ConfCollisionSelection collisionSelection; + Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); colhistmanager::CollisionHistManager colHistManager; colhistmanager::ConfCollisionBinning confCollisionBinning; - collisionbuilder::ConfCollisionFilters collisionSelection; - Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); // setup for phis twotrackresonancebuilder::ConfPhiSelection confPhiSelection; diff --git a/PWGCF/Femto/Tasks/femtoV0Qa.cxx b/PWGCF/Femto/Tasks/femtoV0Qa.cxx index 1b75bcd24ea..089d2975e1d 100644 --- a/PWGCF/Femto/Tasks/femtoV0Qa.cxx +++ b/PWGCF/Femto/Tasks/femtoV0Qa.cxx @@ -46,14 +46,14 @@ using namespace o2::analysis::femto; struct FemtoV0Qa { // setup for collisions - collisionbuilder::ConfCollisionFilters collisionSelection; + collisionbuilder::ConfCollisionSelection collisionSelection; Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); colhistmanager::CollisionHistManager colHistManager; colhistmanager::ConfCollisionBinning confCollisionBinning; // using Collisions = o2::soa::Join; - using Collisions = FCols; + using Collisions = o2::soa::Join; using Collision = Collisions::iterator; using FilteredCollisions = o2::soa::Filtered; From d6652d3060177e2a4f476fc5e523bfbb5aa73b75 Mon Sep 17 00:00:00 2001 From: Maxim Virta <84773378+MaximVirta@users.noreply.github.com> Date: Wed, 24 Sep 2025 05:16:30 +0300 Subject: [PATCH 516/986] [PWGCF] CCDB access added properly for NUA and NUE corrections (#13102) Co-authored-by: ALICE Action Bot --- PWGCF/JCorran/Tasks/jflucWeightsLoader.cxx | 107 ++++++++++++++------- 1 file changed, 72 insertions(+), 35 deletions(-) diff --git a/PWGCF/JCorran/Tasks/jflucWeightsLoader.cxx b/PWGCF/JCorran/Tasks/jflucWeightsLoader.cxx index 7d15d9b2a6d..80dcea01f8f 100644 --- a/PWGCF/JCorran/Tasks/jflucWeightsLoader.cxx +++ b/PWGCF/JCorran/Tasks/jflucWeightsLoader.cxx @@ -8,9 +8,12 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \author Jasper Parkkila (jparkkil@cern.ch) +/// +/// \file jflucWeightsLoader.cxx +/// \brief Task to load the NUA and NUE weights from local files or CCDB. +/// \author Jasper Parkkila (jparkkil@cern.ch), Maxim Virta (maxim.virta@cern.ch) /// \since May 2024 -// o2-linter: disable='doc/file' +/// The weights are loaded from the local files or CCDB and stored in the JWeights table. #include "PWGCF/DataModel/CorrelationsDerived.h" #include "PWGCF/JCorran/DataModel/JCatalyst.h" @@ -43,10 +46,9 @@ using namespace o2::framework::expressions; // The standalone jfluc code expects the entire list of tracks for an event. At the same time, it expects weights together with other track attributes. // This workflow creates a table of weights that can be joined with track tables. struct JflucWeightsLoader { - O2_DEFINE_CONFIGURABLE(cfgPathPhiWeights, std::string, "http://alice-ccdb.cern.ch", "Local (local://) or CCDB path for the phi acceptance correction histogram"); - O2_DEFINE_CONFIGURABLE(cfgPathEffWeights, std::string, "", "Local (local://) or CCDB path for the efficiency correction histogram"); + O2_DEFINE_CONFIGURABLE(cfgPathPhiWeights, std::string, "Users/m/mavirta/corrections/NUA/LHC23zzh", "Local (local://) or CCDB path for the phi acceptance correction histogram"); + O2_DEFINE_CONFIGURABLE(cfgPathEffWeights, std::string, "Users/m/mavirta/corrections/NUE/LHC23zzh", "Local (local://) or CCDB path for the efficiency correction histogram"); O2_DEFINE_CONFIGURABLE(cfgForRunNumber, bool, false, "Get CCDB object by run"); - O2_DEFINE_CONFIGURABLE(cfgCCDBPath, std::string, "Users/m/mavirta/corrections/NUA/LHC23zzh", "Internal path in CCDB"); THnF* ph = 0; TFile* pf = 0; @@ -54,8 +56,12 @@ struct JflucWeightsLoader { TFile* pfeff = 0; int runNumber = 0; int timestamp = 0; - bool useCCDB = false; + bool useNUAFromCCDB = false; + bool useEffFromCCDB = false; Service ccdb; + std::string ccdbURL = "http://alice-ccdb.cern.ch"; + enum { kNUA, + kEFF }; ~JflucWeightsLoader() { @@ -73,12 +79,20 @@ struct JflucWeightsLoader { } } - void initCCDB(int runNum, int ts) + void initCCDB(int runNum, int ts, int NUAorEFF = kNUA) { if (cfgForRunNumber) { - ph = ccdb->getForRun(cfgCCDBPath, runNum); + if (NUAorEFF == kNUA) { + ph = ccdb->getForRun(cfgPathPhiWeights, runNum); + } else { + pheff = ccdb->getForRun(cfgPathEffWeights, runNum); + } } else { - ph = ccdb->getForTimeStamp(cfgCCDBPath, ts); + if (NUAorEFF == kNUA) { + ph = ccdb->getForTimeStamp(cfgPathPhiWeights, ts); + } else { + pheff = ccdb->getForTimeStamp(cfgPathEffWeights, ts); + } } } @@ -90,40 +104,48 @@ struct JflucWeightsLoader { if (doprocessLoadWeights && doprocessLoadWeightsCF) LOGF(fatal, "Only one of JTracks or CFTracks processing can be enabled at a time."); - if (cfgPathPhiWeights.value.find("ccdb") != std::string::npos) { - LOGF(info, "Using corrections from: ccdb"); - useCCDB = true; - ccdb->setURL(cfgPathPhiWeights); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - ccdb->setFatalWhenNull(false); - } else if (cfgPathPhiWeights.value.substr(0, 8) == "local://") { - LOGF(info, "Using non-uniform acceptance corrections from: %s", cfgPathPhiWeights.value.substr(8).c_str()); + + // NUA corrections from local file or CCDB + if (cfgPathPhiWeights.value.substr(0, 8) == "local://") { + LOGF(info, "Using NUA corrections locally from: %s", cfgPathPhiWeights.value.substr(8).c_str()); pf = new TFile(cfgPathPhiWeights.value.substr(8).c_str(), "read"); if (!pf->IsOpen()) { delete pf; pf = 0; LOGF(fatal, "NUA correction weights file not found: %s", cfgPathPhiWeights.value.substr(8).c_str()); } - useCCDB = false; + useNUAFromCCDB = false; } else { - LOGF(info, "Didn't find \"local://\" or \"ccdb\" for non-uniform acceptance corrections."); + LOGF(info, "Assuming NUA corrections from CCDB."); + useNUAFromCCDB = true; + ccdb->setURL(ccdbURL.data()); // default CCDB URL + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setFatalWhenNull(false); } + // Efficiency corrections from local file or CCDB if (cfgPathEffWeights.value.substr(0, 8) == "local://") { - LOGF(info, "Using efficiency corrections from: %s", cfgPathEffWeights.value.substr(8).c_str()); + LOGF(info, "Using efficiency corrections locally from: %s", cfgPathEffWeights.value.substr(8).c_str()); pfeff = new TFile(cfgPathEffWeights.value.substr(8).c_str(), "read"); if (!pfeff->IsOpen()) { delete pfeff; pfeff = 0; LOGF(fatal, "Efficiency correction weights file not found: %s", cfgPathEffWeights.value.substr(8).c_str()); - } else if (!(pheff = pfeff->Get("ccdb_object"))) { - LOGF(warning, "Efficiency correction histogram not found."); } else { LOGF(info, "Loaded efficiency correction histogram locally."); } + useEffFromCCDB = false; } else { - LOGF(info, "Didn't find \"local://\" or \"ccdb\" for efficiency corrections."); + LOGF(info, "Assuming efficiency corrections from CCDB."); + useEffFromCCDB = true; + // If NUA corrections are from CCDB, use the same CCDB URL for efficiency corrections + if (!useNUAFromCCDB) { + ccdb->setURL(ccdbURL.data()); // default CCDB URL + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setFatalWhenNull(false); + } } } @@ -133,23 +155,39 @@ struct JflucWeightsLoader { template void loadWeights(Produces& outputT, CollisionT const& collision, TrackT const& tracks) { - if (pf || useCCDB) { + if (pf || useNUAFromCCDB) { if (collision.runNumber() != runNumber) { if (ph) delete ph; - if (!useCCDB) { + if (!useNUAFromCCDB) { // Check if NUA correction can be found from a local file and load it if (!(ph = pf->Get(Form("NUAWeights_%d", collision.runNumber())))) LOGF(warning, "NUA correction histogram not found for run %d.", collision.runNumber()); else LOGF(info, "Loaded NUA correction histogram locally for run %d.", collision.runNumber()); } else { - initCCDB(collision.runNumber(), timestamp); + initCCDB(collision.runNumber(), timestamp, kNUA); LOGF(info, "Loaded NUA correction histogram from CCDB for run %d.", collision.runNumber()); } runNumber = collision.runNumber(); } } + if (pfeff) { + if (collision.runNumber() != runNumber) { + if (pheff) + delete pheff; + if (!useEffFromCCDB) { + if (!(pheff = pfeff->Get("ccdb_object"))) { + LOGF(warning, "Efficiency correction histogram not found."); + } else { + LOGF(info, "Loaded NUE correction histogram locally for run %d.", collision.runNumber()); + } + } else { + initCCDB(collision.runNumber(), timestamp, kEFF); + LOGF(info, "Loaded efficiency correction histogram from CCDB for run %d.", collision.runNumber()); + } + } + } for (const auto& track : tracks) { float phiWeight, effWeight; if (ph) { @@ -165,19 +203,18 @@ struct JflucWeightsLoader { break; } }*/ - const double coords[] = {collision.multiplicity(), static_cast(partType), track.phi(), track.eta(), collision.posZ()}; - phiWeight = ph->GetBinContent(ph->GetBin(coords)); + // NUA corrections are a function of multiplicity, partType, phi, eta, and z-vertex + const double nuaCoords[] = {collision.multiplicity(), static_cast(partType), track.phi(), track.eta(), collision.posZ()}; + phiWeight = ph->GetBinContent(ph->GetBin(nuaCoords)); } else { phiWeight = 1.0f; } if (pheff) { - const int effVars[] = { - pheff->GetAxis(0)->FindBin(track.eta()), - pheff->GetAxis(1)->FindBin(track.pt()), - pheff->GetAxis(2)->FindBin(collision.multiplicity()), - pheff->GetAxis(3)->FindBin(collision.posZ())}; - effWeight = pheff->GetBinContent(effVars); + // Efficiency corrections are a function of eta, pT, multiplicity, and z-vertex + const double nueCoords[] = {track.eta(), track.pt(), collision.multiplicity(), collision.posZ()}; + + effWeight = pheff->GetBinContent(pheff->GetBin(nueCoords)); } else { effWeight = 1.0f; } From fb21c111bead6065daa1cc5b675e86867bc886d7 Mon Sep 17 00:00:00 2001 From: blacwovie Date: Wed, 24 Sep 2025 11:14:43 +0800 Subject: [PATCH 517/986] [PWGCF] fix rigidity problem in getkstar() (#13092) Co-authored-by: ALICE Action Bot --- PWGCF/FemtoWorld/Core/FemtoWorldMath.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/PWGCF/FemtoWorld/Core/FemtoWorldMath.h b/PWGCF/FemtoWorld/Core/FemtoWorldMath.h index 6eff2f212b8..16df6773cd8 100644 --- a/PWGCF/FemtoWorld/Core/FemtoWorldMath.h +++ b/PWGCF/FemtoWorld/Core/FemtoWorldMath.h @@ -14,8 +14,8 @@ /// \author Valentina Mantovani Sarti, TU München, valentina.mantovani-sarti@tum.de, Laura Serksnyte, TU München, laura.serksnyte@cern.ch /// \author Zuzanna Chochulska, WUT Warsaw, zchochul@cern.ch -#ifndef FEMTOWORLDMATH_H_ -#define FEMTOWORLDMATH_H_ +#ifndef PWGCF_FEMTOWORLD_CORE_FEMTOWORLDMATH_H_ +#define PWGCF_FEMTOWORLD_CORE_FEMTOWORLDMATH_H_ #include "Math/Vector4D.h" #include "Math/Boost.h" @@ -39,10 +39,10 @@ class FemtoWorldMath /// \param part2 Particle 2 /// \param mass2 Mass of particle 2 template - static float getkstar(const T& part1, const float mass1, const T& part2, const float mass2) + static float getkstar(const T& part1, const float mass1, const T& part2, const float mass2, const float z1 = 1.f, const float z2 = 1.f) { - const ROOT::Math::PtEtaPhiMVector vecpart1(part1.pt(), part1.eta(), part1.phi(), mass1); - const ROOT::Math::PtEtaPhiMVector vecpart2(part2.pt(), part2.eta(), part2.phi(), mass2); + const ROOT::Math::PtEtaPhiMVector vecpart1(part1.pt() * z1, part1.eta(), part1.phi(), mass1); + const ROOT::Math::PtEtaPhiMVector vecpart2(part2.pt() * z2, part2.eta(), part2.phi(), mass2); const ROOT::Math::PtEtaPhiMVector trackSum = vecpart1 + vecpart2; const float beta = trackSum.Beta(); @@ -140,4 +140,4 @@ class FemtoWorldMath } // namespace o2::analysis::femtoWorld -#endif /* FEMTOWORLDMATH_H_ */ +#endif // PWGCF_FEMTOWORLD_CORE_FEMTOWORLDMATH_H_ From 2feaa460c206efe3d86fb50967a713d1feb63d86 Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Wed, 24 Sep 2025 08:53:11 +0200 Subject: [PATCH 518/986] [PWGCF] FemtoUniverse: Add deta constrain in CPR with fractions of separation (#13094) Co-authored-by: ALICE Action Bot --- PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h index ac5f1c9aad5..778e0c4772b 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h @@ -598,7 +598,7 @@ class FemtoUniverseDetaDphiStar return false; } } else { - if (distfrac > FracMax) { + if (((deta > cutDeltaEtaMin) && (deta < cutDeltaEtaMax)) && (distfrac > FracMax)) { return true; } else { if (ChosenEventType == femto_universe_container::EventType::same) { From 3a6bf94a1c7d6ad7113b3ab745438c5780866518 Mon Sep 17 00:00:00 2001 From: blacwovie Date: Wed, 24 Sep 2025 15:41:35 +0800 Subject: [PATCH 519/986] [PWGLF] put QA after kstar cut (#13077) Co-authored-by: ALICE Action Bot --- PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx b/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx index b626b1ce386..3d594b39d30 100644 --- a/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx +++ b/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx @@ -930,6 +930,7 @@ struct he3HadronFemto { mQaRegistry.fill(HIST("hKstarUSantimatter_femto"), he3Hadcand.kstarfem); } } + fillHistograms(he3Hadcand); } template @@ -946,7 +947,6 @@ struct he3HadronFemto { continue; } fillKstar(he3Hadcand); - fillHistograms(he3Hadcand); auto collision = collisions.rawIteratorAt(he3Hadcand.collisionID); fillTable(he3Hadcand, collision, /*isMC*/ false); } From fb54f3516ef69aab6f215074c92f0ae6c295d11f Mon Sep 17 00:00:00 2001 From: Jesper Karlsson Gumprecht <113693781+jesgum@users.noreply.github.com> Date: Wed, 24 Sep 2025 12:58:08 +0200 Subject: [PATCH 520/986] [ALICE3] Let fasttracker use the generic geometry (#13099) --- ALICE3/Core/FastTracker.cxx | 3 +- ALICE3/TableProducer/OTF/onTheFlyTracker.cxx | 33 +++++++++----------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/ALICE3/Core/FastTracker.cxx b/ALICE3/Core/FastTracker.cxx index 84fa174c224..5837d717884 100644 --- a/ALICE3/Core/FastTracker.cxx +++ b/ALICE3/Core/FastTracker.cxx @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -184,7 +185,7 @@ void FastTracker::AddSiliconALICE3(float scaleX0VD, std::vector pixelReso AddLayer("B03", 7., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); AddLayer("B04", 9., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); AddLayer("B05", 12., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); - AddLayer("iTOF", 19, 250, x0iTOF, xrhoiTOF, resRPhiOT, resZOT, eff, 0); + AddLayer("iTOF", 19, 250, x0iTOF, xrhoiTOF, resRPhiOT, resZOT, 0.0f, 0); AddLayer("B06", 20., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); AddLayer("B07", 30., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); AddLayer("B08", 45., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); diff --git a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx index 0f785534159..fddfdebd2a0 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx @@ -138,7 +138,7 @@ struct OnTheFlyTracker { Configurable minSiliconHits{"minSiliconHits", 6, "minimum number of silicon hits to accept track"}; Configurable minSiliconHitsIfTPCUsed{"minSiliconHitsIfTPCUsed", 2, "minimum number of silicon hits to accept track in case TPC info is present"}; Configurable minTPCClusters{"minTPCClusters", 70, "minimum number of TPC hits necessary to consider minSiliconHitsIfTPCUsed"}; - Configurable alice3detector{"alice3detector", 2, "0: ALICE 3 v1, 1: ALICE 3 v4, 2: ALICE 3 Sep 2025"}; + Configurable alice3geo{"alice3geo", "2", "0: ALICE 3 v1, 1: ALICE 3 v4, 2: ALICE 3 Sep 2025, or path to ccdb with a3 geo"}; Configurable applyZacceptance{"applyZacceptance", false, "apply z limits to detector layers or not"}; Configurable applyMSCorrection{"applyMSCorrection", true, "apply ms corrections for secondaries or not"}; Configurable applyElossCorrection{"applyElossCorrection", true, "apply eloss corrections for secondaries or not"}; @@ -408,31 +408,26 @@ struct OnTheFlyTracker { rand.SetSeed(seed); // configure FastTracker - fastTracker.SetMagneticField(magneticField); - fastTracker.SetApplyZacceptance(fastTrackerSettings.applyZacceptance); - fastTracker.SetApplyMSCorrection(fastTrackerSettings.applyMSCorrection); - fastTracker.SetApplyElossCorrection(fastTrackerSettings.applyElossCorrection); + if (enableSecondarySmearing) { + fastTracker.SetMagneticField(magneticField); + fastTracker.SetApplyZacceptance(fastTrackerSettings.applyZacceptance); + fastTracker.SetApplyMSCorrection(fastTrackerSettings.applyMSCorrection); + fastTracker.SetApplyElossCorrection(fastTrackerSettings.applyElossCorrection); - switch (fastTrackerSettings.alice3detector) { - case 0: + if (fastTrackerSettings.alice3geo.value == "0") { fastTracker.AddSiliconALICE3v2(fastTrackerSettings.pixelRes); - break; - - case 1: + } else if (fastTrackerSettings.alice3geo.value == "1") { fastTracker.AddSiliconALICE3v4(fastTrackerSettings.pixelRes); fastTracker.AddTPC(0.1, 0.1); - break; - - case 2: + } else if (fastTrackerSettings.alice3geo.value == "2") { fastTracker.AddSiliconALICE3(fastTrackerSettings.scaleVD, fastTrackerSettings.pixelRes); - break; + } else { + fastTracker.AddGenericDetector(fastTrackerSettings.alice3geo, ccdb.operator->()); + } - default: - break; + // print fastTracker settings + fastTracker.Print(); } - - // print fastTracker settings - fastTracker.Print(); } /// Function to decay the xi From fa7d3fe9efc8551b80f054287b9a7a2233e6c764 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= <26327373+vkucera@users.noreply.github.com> Date: Wed, 24 Sep 2025 12:58:59 +0200 Subject: [PATCH 521/986] [DPG] Fix includes (#12949) --- DPG/Tasks/AOTEvent/eventSelectionQa.cxx | 58 ++++++++++++------- DPG/Tasks/AOTEvent/rofBorderQa.cxx | 49 ++++++++++------ DPG/Tasks/AOTEvent/timeDependentQa.cxx | 46 ++++++++++----- .../AOTTrack/V0Cascades/perfK0sResolution.cxx | 44 ++++++++++---- .../V0Cascades/qaLamMomResolution.cxx | 47 ++++++++++----- .../AOTTrack/V0Cascades/qaLamMomResolution.h | 4 +- DPG/Tasks/AOTTrack/qaEfficiency.cxx | 45 +++++++++----- DPG/Tasks/AOTTrack/qaEventTrack.cxx | 23 +++++--- DPG/Tasks/AOTTrack/qaImpPar.cxx | 55 +++++++++--------- DPG/Tasks/AOTTrack/qaMatchEff.cxx | 45 ++++++++++---- DPG/Tasks/FT0/ft0AnalysisTask.cxx | 28 ++++++--- DPG/Tasks/ITS/itsImpParStudies.cxx | 57 +++++++++--------- 12 files changed, 320 insertions(+), 181 deletions(-) diff --git a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx index b4f2c47d834..68fe2b96d7c 100644 --- a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx +++ b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx @@ -14,30 +14,46 @@ /// /// \author Evgeny Kryshen and Igor Altsybeev +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/CCDB/TriggerAliases.h" +#include "Common/DataModel/EventSelection.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include #include -#include #include #include - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/CCDB/EventSelectionParams.h" -#include "CCDB/BasicCCDBManager.h" -#include "Framework/HistogramRegistry.h" -#include "CommonDataFormat/BunchFilling.h" -#include "DataFormatsParameters/GRPLHCIFData.h" -#include "DataFormatsParameters/GRPECSObject.h" -#include "DataFormatsParameters/AggregatedRunInfo.h" -#include "DataFormatsITSMFT/NoiseMap.h" // missing include in TimeDeadMap.h -#include "DataFormatsITSMFT/TimeDeadMap.h" -#include "DataFormatsITSMFT/ROFRecord.h" -#include "ReconstructionDataFormats/Vertex.h" -#include "ITSMFTBase/DPLAlpideParam.h" -#include "ITSMFTReconstruction/ChipMappingITS.h" -#include "TH1F.h" -#include "TH2F.h" +#include using namespace o2::framework; using namespace o2; diff --git a/DPG/Tasks/AOTEvent/rofBorderQa.cxx b/DPG/Tasks/AOTEvent/rofBorderQa.cxx index 83f704960b6..52b4a8228f0 100644 --- a/DPG/Tasks/AOTEvent/rofBorderQa.cxx +++ b/DPG/Tasks/AOTEvent/rofBorderQa.cxx @@ -12,29 +12,40 @@ /// \brief QA task to study ROF border effect for different event, track and particle selection parameters /// \author Igor Altsybeev, Igor.Altsybeev@cern.ch -#include -#include - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/TrackSelectionDefaults.h" -#include "Common/DataModel/PIDResponse.h" -#include "Common/DataModel/Centrality.h" +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/CCDB/TriggerAliases.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/FT0Corrected.h" #include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/CCDB/EventSelectionParams.h" - -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPECSObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "Common/DataModel/FT0Corrected.h" -#include "DataFormatsFT0/Digit.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include -using namespace std; using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; diff --git a/DPG/Tasks/AOTEvent/timeDependentQa.cxx b/DPG/Tasks/AOTEvent/timeDependentQa.cxx index 61fbb690e6c..bdb6d76fb34 100644 --- a/DPG/Tasks/AOTEvent/timeDependentQa.cxx +++ b/DPG/Tasks/AOTEvent/timeDependentQa.cxx @@ -14,26 +14,40 @@ /// /// \author Evgeny Kryshen and Igor Altsybeev -#include -#include -#include - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/HistogramRegistry.h" -#include "CCDB/BasicCCDBManager.h" -#include "Common/DataModel/EventSelection.h" #include "Common/CCDB/EventSelectionParams.h" -#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/CCDB/RCTSelectionFlags.h" #include "Common/CCDB/ctpRateFetcher.h" +#include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" -#include "TPCCalibration/TPCMShapeCorrection.h" -#include "DataFormatsParameters/AggregatedRunInfo.h" -#include "DataFormatsITSMFT/ROFRecord.h" -#include "ReconstructionDataFormats/Vertex.h" +#include "Common/DataModel/TrackSelectionTables.h" -#include "TTree.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/DPG/Tasks/AOTTrack/V0Cascades/perfK0sResolution.cxx b/DPG/Tasks/AOTTrack/V0Cascades/perfK0sResolution.cxx index 91effcc47b4..6d2c5d80df1 100644 --- a/DPG/Tasks/AOTTrack/V0Cascades/perfK0sResolution.cxx +++ b/DPG/Tasks/AOTTrack/V0Cascades/perfK0sResolution.cxx @@ -9,22 +9,44 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include +#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "ReconstructionDataFormats/Track.h" -#include "ReconstructionDataFormats/PID.h" +#include "Common/Core/RecoDecay.h" #include "Common/Core/trackUtilities.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" +#include "Common/DataModel/TrackSelectionTables.h" #include "Common/Tools/TrackTuner.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include + using namespace o2; using namespace o2::track; using namespace o2::framework; diff --git a/DPG/Tasks/AOTTrack/V0Cascades/qaLamMomResolution.cxx b/DPG/Tasks/AOTTrack/V0Cascades/qaLamMomResolution.cxx index 9ee92d0a509..4fbf9fc68c5 100644 --- a/DPG/Tasks/AOTTrack/V0Cascades/qaLamMomResolution.cxx +++ b/DPG/Tasks/AOTTrack/V0Cascades/qaLamMomResolution.cxx @@ -14,23 +14,42 @@ /// \author Carolina Reetz c.reetz@cern.ch /// \brief QA task to study momentum resolution of Lambda daughter tracks -#include +#include "DPG/Tasks/AOTTrack/V0Cascades/qaLamMomResolution.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "ReconstructionDataFormats/Track.h" -#include "ReconstructionDataFormats/PID.h" -#include "Common/Core/trackUtilities.h" #include "PWGLF/DataModel/LFStrangenessTables.h" -#include "DPG/Tasks/AOTTrack/V0Cascades/qaLamMomResolution.h" -#include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/Core/trackUtilities.h" #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" #include "Common/Tools/TrackTuner.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -540,8 +559,8 @@ struct qaLamMomResolution { } } } // end Anti-Lambda - } // end MC - } // end V0 loop + } // end MC + } // end V0 loop } PROCESS_SWITCH(qaLamMomResolution, processMC, "Process MC", true); }; diff --git a/DPG/Tasks/AOTTrack/V0Cascades/qaLamMomResolution.h b/DPG/Tasks/AOTTrack/V0Cascades/qaLamMomResolution.h index 603195404d4..7c7d135ac55 100644 --- a/DPG/Tasks/AOTTrack/V0Cascades/qaLamMomResolution.h +++ b/DPG/Tasks/AOTTrack/V0Cascades/qaLamMomResolution.h @@ -14,9 +14,7 @@ #ifndef DPG_TASKS_AOTTRACK_V0CASCADES_QALAMMOMRESOLUTION_H_ #define DPG_TASKS_AOTTRACK_V0CASCADES_QALAMMOMRESOLUTION_H_ -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Common/Core/trackUtilities.h" +#include namespace o2::aod { diff --git a/DPG/Tasks/AOTTrack/qaEfficiency.cxx b/DPG/Tasks/AOTTrack/qaEfficiency.cxx index a55d205ed57..20896f0476a 100644 --- a/DPG/Tasks/AOTTrack/qaEfficiency.cxx +++ b/DPG/Tasks/AOTTrack/qaEfficiency.cxx @@ -16,28 +16,41 @@ /// In MC the efficiency for particles is computed according to the PDG code (sign included and not charge). /// -// O2 includes -#include -#include +#include "PWGLF/DataModel/LFParticleIdentification.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/StaticFor.h" -#include "ReconstructionDataFormats/DCA.h" -#include "ReconstructionDataFormats/Track.h" +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/Core/RecoDecay.h" #include "Common/Core/TrackSelection.h" +#include "Common/Core/TrackSelectionDefaults.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" -#include "Common/Core/TrackSelectionDefaults.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "PWGLF/DataModel/LFParticleIdentification.h" -#include "Common/Core/RecoDecay.h" -// ROOT includes -#include "TPDGCode.h" -#include "TEfficiency.h" -#include "THashList.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/DPG/Tasks/AOTTrack/qaEventTrack.cxx b/DPG/Tasks/AOTTrack/qaEventTrack.cxx index 50c1fea9909..b4baddb2685 100644 --- a/DPG/Tasks/AOTTrack/qaEventTrack.cxx +++ b/DPG/Tasks/AOTTrack/qaEventTrack.cxx @@ -23,30 +23,39 @@ #include "qaEventTrack.h" +#include "Common/CCDB/EventSelectionParams.h" #include "Common/Core/MetadataHelper.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/TrackSelectionDefaults.h" -#include "Common/Core/trackUtilities.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "Common/TableProducer/PID/pidTOFBase.h" #include +#include #include +#include #include +#include +#include #include #include -#include #include - +#include +#include +#include + +#include +#include +#include +#include +#include #include #include +#include + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -using namespace o2::dataformats; o2::common::core::MetadataHelper metadataInfo; diff --git a/DPG/Tasks/AOTTrack/qaImpPar.cxx b/DPG/Tasks/AOTTrack/qaImpPar.cxx index 90c9252f5a4..7e758dd7ec2 100644 --- a/DPG/Tasks/AOTTrack/qaImpPar.cxx +++ b/DPG/Tasks/AOTTrack/qaImpPar.cxx @@ -10,29 +10,40 @@ // or submit itself to any jurisdiction. /// \author Mattia Faggin , Padova University and INFN +#include "Common/CCDB/TriggerAliases.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/trackUtilities.h" // for propagation to primary vertex #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "CCDB/BasicCCDBManager.h" -#include "CCDB/CcdbApi.h" -#include "CommonConstants/GeomConstants.h" -#include "CommonUtils/NameConf.h" -#include "DataFormatsCalibration/MeanVertexObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DetectorsBase/GeometryManager.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsVertexing/PVertexer.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/RunningWorkflowInfo.h" -#include "ReconstructionDataFormats/DCA.h" -#include "ReconstructionDataFormats/Vertex.h" - -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include #include #include #include @@ -40,14 +51,6 @@ using namespace o2::framework; using namespace o2::framework::expressions; -// void customize(std::vector& workflowOptions) -//{ -// ConfigParamSpec optionDoMC{"doMC", VariantType::Bool, false, {"Fill MC histograms."}}; -// workflowOptions.push_back(optionDoMC); -// } - -#include "Framework/runDataProcessing.h" - /// QA task for impact parameter distribution monitoring struct QaImpactPar { diff --git a/DPG/Tasks/AOTTrack/qaMatchEff.cxx b/DPG/Tasks/AOTTrack/qaMatchEff.cxx index 704d3fa89ad..4b6d3e87d13 100644 --- a/DPG/Tasks/AOTTrack/qaMatchEff.cxx +++ b/DPG/Tasks/AOTTrack/qaMatchEff.cxx @@ -19,23 +19,46 @@ // // Internal version number: 6.3 // + +#include "Common/CCDB/EventSelectionParams.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectionDefaults.h" -#include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/PIDResponse.h" -#include "CommonConstants/MathConstants.h" -#include "CCDB/BasicCCDBManager.h" -// -#include "Framework/AnalysisTask.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/runDataProcessing.h" -// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include #include #include -#include -// + namespace extConfPar { static constexpr int nParDCA = 1; diff --git a/DPG/Tasks/FT0/ft0AnalysisTask.cxx b/DPG/Tasks/FT0/ft0AnalysisTask.cxx index a7d487fbdff..0d2b0f083be 100644 --- a/DPG/Tasks/FT0/ft0AnalysisTask.cxx +++ b/DPG/Tasks/FT0/ft0AnalysisTask.cxx @@ -9,22 +9,32 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/DataModel/EventSelection.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + #include +#include #include -#include +#include #include - -#include "TH1.h" - -#include "Common/DataModel/EventSelection.h" -#include "DataFormatsFT0/Digit.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" +#include using namespace o2; using namespace o2::framework; using namespace o2::aod::evsel; + struct ft0AnalysisTask { HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; constexpr static int sNtriggers = 5; // Number of produced triggers diff --git a/DPG/Tasks/ITS/itsImpParStudies.cxx b/DPG/Tasks/ITS/itsImpParStudies.cxx index 7635ed3290a..3bbce0487e4 100644 --- a/DPG/Tasks/ITS/itsImpParStudies.cxx +++ b/DPG/Tasks/ITS/itsImpParStudies.cxx @@ -10,44 +10,45 @@ // or submit itself to any jurisdiction. /// \author Samuele Cattaruzzi +#include "Common/CCDB/TriggerAliases.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/trackUtilities.h" // for propagation to primary vertex #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "CCDB/BasicCCDBManager.h" -#include "CCDB/CcdbApi.h" -#include "CommonConstants/GeomConstants.h" -#include "CommonUtils/NameConf.h" -#include "DataFormatsCalibration/MeanVertexObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DetectorsBase/GeometryManager.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsVertexing/PVertexer.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/RunningWorkflowInfo.h" -#include "ReconstructionDataFormats/DCA.h" -#include "ReconstructionDataFormats/Vertex.h" - -#include "iostream" -#include "set" -#include "vector" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include #include +#include using namespace o2::framework; using namespace o2::framework::expressions; -// void customize(std::vector& workflowOptions) -//{ -// ConfigParamSpec optionDoMC{"doMC", VariantType::Bool, false, {"Fill MC histograms."}}; -// workflowOptions.push_back(optionDoMC); -// } - -#include "Framework/runDataProcessing.h" - /// QA task for impact parameter distribution monitoring struct ItsImpactParStudies { From e28e410327ad7ec809adbd20691d03eeba9505a4 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Wed, 24 Sep 2025 13:35:32 +0200 Subject: [PATCH 522/986] [PWGDQ] More speedup of the DQ HistogramManager (#13105) --- PWGDQ/Core/HistogramManager.cxx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/PWGDQ/Core/HistogramManager.cxx b/PWGDQ/Core/HistogramManager.cxx index fb5ce5f8d65..4882b7d84f5 100644 --- a/PWGDQ/Core/HistogramManager.cxx +++ b/PWGDQ/Core/HistogramManager.cxx @@ -757,7 +757,7 @@ void HistogramManager::FillHistClass(const char* className, Float_t* values) } // get the corresponding std::list containng identifiers to the needed variables to be filled - list varList = fVariablesMap[className]; + auto const& varList = fVariablesMap[className]; TIter next(hList); @@ -777,26 +777,26 @@ void HistogramManager::FillHistClass(const char* className, Float_t* values) for (auto varIter = varList.begin(); varIter != varList.end(); varIter++) { h = next(); // get the histogram // decode information from the vector of indices - isProfile = (varIter->at(0) == 1 ? true : false); - isTHn = (varIter->at(1) > 0 ? true : false); + isProfile = ((*varIter)[0] == 1 ? true : false); + isTHn = ((*varIter)[1] > 0 ? true : false); if (isTHn) { - dimension = varIter->at(1); + dimension = (*varIter)[1]; } else { dimension = (reinterpret_cast(h))->GetDimension(); } // get the various variable indices - varW = varIter->at(2); + varW = (*varIter)[2]; if (isTHn) { for (int i = 0; i < dimension; i++) { - fillValues[i] = values[varIter->at(3 + i)]; + fillValues[i] = values[(*varIter)[3 + i]]; } } else { - varX = varIter->at(3); - varY = varIter->at(4); - varZ = varIter->at(5); - varT = varIter->at(6); - isFillLabelx = (varIter->at(7) == 1 ? true : false); + varX = (*varIter)[3]; + varY = (*varIter)[4]; + varZ = (*varIter)[5]; + varT = (*varIter)[6]; + isFillLabelx = ((*varIter)[7] == 1 ? true : false); } if (!isTHn) { From dd19dab258cd90bd111834ed0ce3cc730bc80cad Mon Sep 17 00:00:00 2001 From: Lucia Anna Tarasovicova Date: Wed, 24 Sep 2025 14:58:58 +0200 Subject: [PATCH 523/986] [PWGLF] Change in hStrangeCorrelation.cxx (#13111) Co-authored-by: Lucia Anna Tarasovicova --- .../Tasks/Strangeness/hStrangeCorrelation.cxx | 114 ++++++++++-------- 1 file changed, 62 insertions(+), 52 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx b/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx index efcd44f081a..0d893c9d789 100644 --- a/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx +++ b/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx @@ -38,6 +38,7 @@ #include "Framework/O2DatabasePDGPlugin.h" #include "Framework/StaticFor.h" #include "Framework/runDataProcessing.h" +#include #include @@ -126,9 +127,13 @@ struct HStrangeCorrelation { } massWindowConfigurations; // allows for gap between peak and bg in case someone wants to // Implementation of on-the-spot efficiency correction - Configurable applyEfficiencyCorrection{"applyEfficiencyCorrection", false, "apply efficiency correction"}; - Configurable applyEfficiencyForTrigger{"applyEfficiencyForTrigger", false, "apply efficiency correction for the trigger particle"}; - Configurable applyEfficiencyPropagation{"applyEfficiencyPropagation", false, "propagate also the efficiency uncertainty"}; + struct : ConfigurableGroup { + Configurable applyEfficiencyCorrection{"applyEfficiencyCorrection", false, "apply efficiency correction"}; + Configurable applyEfficiencyForTrigger{"applyEfficiencyForTrigger", false, "apply efficiency correction for the trigger particle"}; + Configurable applyEfficiencyPropagation{"applyEfficiencyPropagation", false, "propagate also the efficiency uncertainty"}; + Configurable applyPurityHadron{"applyPurityHadron", false, "apply the purity correction for associated hadrons"}; + Configurable applyPurityTrigger{"applyPurityTrigger", false, "apply the purity correction for trigger particle"}; + } efficiencyFlags; Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository to use"}; Configurable efficiencyCCDBPath{"efficiencyCCDBPath", "GLO/Config/GeometryAligned", "Path of the efficiency corrections"}; @@ -323,7 +328,7 @@ struct HStrangeCorrelation { hEfficiencyUncertaintyPion = static_cast(listEfficiencies->FindObject("hEfficiencyUncertaintyPion")); hEfficiencyUncertaintyHadron = static_cast(listEfficiencies->FindObject("hEfficiencyUncertaintyHadron")); hPurityUncertaintyHadron = static_cast(listEfficiencies->FindObject("hPurityUncertaintyHadron")); - if (applyEfficiencyPropagation && !hEfficiencyUncertaintyTrigger) + if (efficiencyFlags.applyEfficiencyPropagation && !hEfficiencyUncertaintyTrigger) LOG(fatal) << "Problem getting hEfficiencyUncertaintyTrigger!"; LOG(info) << "Efficiencies now loaded for " << mRunNumber; } @@ -595,9 +600,9 @@ struct HStrangeCorrelation { if (!mixing) { float efficiency = 1.0f; float efficiencyError = 0.0f; - if (applyEfficiencyForTrigger) { + if (efficiencyFlags.applyEfficiencyForTrigger) { efficiency = hEfficiencyTrigger->Interpolate(trigg.pt(), trigg.eta()); - if (applyEfficiencyPropagation) + if (efficiencyFlags.applyEfficiencyPropagation) efficiencyError = hEfficiencyUncertaintyTrigger->Interpolate(trigg.pt(), trigg.eta()); if (efficiency == 0) { // check for zero efficiency, do not apply if the case efficiency = 1; @@ -694,14 +699,14 @@ struct HStrangeCorrelation { float totalEffUncert = 0.0; float efficiencyError = 0.0f; float triggerEfficiencyError = 0.0f; - if (applyEfficiencyCorrection) { + if (efficiencyFlags.applyEfficiencyCorrection) { efficiency = hEfficiencyV0[Index]->Interpolate(ptassoc, assoc.eta()); - if (applyEfficiencyPropagation) + if (efficiencyFlags.applyEfficiencyPropagation) efficiencyError = hEfficiencyUncertaintyV0[Index]->Interpolate(ptassoc, assoc.eta()); } - if (applyEfficiencyForTrigger) { + if (efficiencyFlags.applyEfficiencyForTrigger) { efficiency = efficiency * hEfficiencyTrigger->Interpolate(pttrigger, trigg.eta()); - if (applyEfficiencyPropagation) + if (efficiencyFlags.applyEfficiencyPropagation) triggerEfficiencyError = hEfficiencyUncertaintyTrigger->Interpolate(pttrigger, trigg.eta()); } if (efficiency == 0) { // check for zero efficiency, do not apply if the case @@ -712,11 +717,11 @@ struct HStrangeCorrelation { efficiencytrigg = 1; triggerEfficiencyError = 0; } - if (applyEfficiencyPropagation) { + if (efficiencyFlags.applyEfficiencyPropagation) { totalEffUncert = std::sqrt(std::pow(efficiencytrigg * efficiencyError, 2) + std::pow(triggerEfficiencyError * efficiency, 2)); } double binFillThn[6] = {deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult}; - if (TESTBIT(doCorrelation, Index) && (!applyEfficiencyCorrection || efficiency != 0) && (doPPAnalysis || (TESTBIT(selMap, Index) && TESTBIT(selMap, Index + 3)))) { + if (TESTBIT(doCorrelation, Index) && (!efficiencyFlags.applyEfficiencyCorrection || efficiency != 0) && (doPPAnalysis || (TESTBIT(selMap, Index) && TESTBIT(selMap, Index + 3)))) { if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && !mixing && -massWindowConfigurations.maxBgNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < -massWindowConfigurations.minBgNSigma) { fillCorrelationHistogram(histos.get(HIST("sameEvent/LeftBg/") + HIST(kV0names[Index])), binFillThn, etaWeight, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f); if (doDeltaPhiStarCheck) { @@ -803,9 +808,9 @@ struct HStrangeCorrelation { if (!mixing) { float efficiency = 1.0f; float efficiencyError = 0.0f; - if (applyEfficiencyForTrigger) { + if (efficiencyFlags.applyEfficiencyForTrigger) { efficiency = hEfficiencyTrigger->Interpolate(trigg.pt(), trigg.eta()); - if (applyEfficiencyPropagation) + if (efficiencyFlags.applyEfficiencyPropagation) efficiencyError = hEfficiencyUncertaintyTrigger->Interpolate(trigg.pt(), trigg.eta()); if (efficiency == 0) { // check for zero efficiency, do not apply if the case efficiency = 1; @@ -906,25 +911,25 @@ struct HStrangeCorrelation { float totalEffUncert = 0.0; float efficiencyError = 0.0f; float triggerEfficiencyError = 0.0f; - if (applyEfficiencyCorrection) { + if (efficiencyFlags.applyEfficiencyCorrection) { efficiency = hEfficiencyCascade[Index]->Interpolate(ptassoc, assoc.eta()); - if (applyEfficiencyPropagation) + if (efficiencyFlags.applyEfficiencyPropagation) efficiencyError = hEfficiencyUncertaintyCascade[Index]->Interpolate(ptassoc, assoc.eta()); } - if (applyEfficiencyForTrigger) { + if (efficiencyFlags.applyEfficiencyForTrigger) { efficiency = efficiency * hEfficiencyTrigger->Interpolate(pttrigger, trigg.eta()); - if (applyEfficiencyPropagation) + if (efficiencyFlags.applyEfficiencyPropagation) triggerEfficiencyError = hEfficiencyUncertaintyTrigger->Interpolate(pttrigger, trigg.eta()); } if (efficiency == 0) { // check for zero efficiency, do not apply if the case efficiency = 1; efficiencyError = 0; } - if (applyEfficiencyPropagation) { + if (efficiencyFlags.applyEfficiencyPropagation) { totalEffUncert = std::sqrt(std::pow(efficiencytrigg * efficiencyError, 2) + std::pow(triggerEfficiencyError * efficiency, 2)); } double binFillThn[6] = {deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult}; - if (TESTBIT(doCorrelation, Index + 3) && (!applyEfficiencyCorrection || efficiency != 0) && (doPPAnalysis || (TESTBIT(CascselMap, Index) && TESTBIT(CascselMap, Index + 4) && TESTBIT(CascselMap, Index + 8) && TESTBIT(CascselMap, Index + 12)))) { + if (TESTBIT(doCorrelation, Index + 3) && (!efficiencyFlags.applyEfficiencyCorrection || efficiency != 0) && (doPPAnalysis || (TESTBIT(CascselMap, Index) && TESTBIT(CascselMap, Index + 4) && TESTBIT(CascselMap, Index + 8) && TESTBIT(CascselMap, Index + 12)))) { if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && !mixing && -massWindowConfigurations.maxBgNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < -massWindowConfigurations.minBgNSigma) { fillCorrelationHistogram(histos.get(HIST("sameEvent/LeftBg/") + HIST(kCascadenames[Index])), binFillThn, etaWeight, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f); if (doDeltaPhiStarCheck) { @@ -980,9 +985,9 @@ struct HStrangeCorrelation { if (!mixing) { float efficiency = 1.0f; float efficiencyError = 0.0f; - if (applyEfficiencyForTrigger) { + if (efficiencyFlags.applyEfficiencyForTrigger) { efficiency = hEfficiencyTrigger->Interpolate(trigg.pt(), trigg.eta()); - if (applyEfficiencyPropagation) + if (efficiencyFlags.applyEfficiencyPropagation) hEfficiencyUncertaintyTrigger->Interpolate(trigg.pt(), trigg.eta()); if (efficiency == 0) { // check for zero efficiency, do not apply if the case efficiency = 1; @@ -1047,26 +1052,30 @@ struct HStrangeCorrelation { float totalEffUncert = 0.0; float efficiencyUncertainty = 0.0f; float totalPurityUncert = 0.0; - if (applyEfficiencyCorrection) { + if (efficiencyFlags.applyEfficiencyCorrection) { if constexpr (requires { assocTrack.nSigmaTPCPi(); }) { efficiency = hEfficiencyPion->Interpolate(ptassoc, assoc.eta()); - if (applyEfficiencyPropagation) + if (efficiencyFlags.applyEfficiencyPropagation) efficiencyUncertainty = hEfficiencyUncertaintyPion->Interpolate(ptassoc, assoc.eta()); } else { efficiency = hEfficiencyHadron->Interpolate(ptassoc, assoc.eta()); - purity = hPurityHadron->Interpolate(ptassoc); - if (applyEfficiencyPropagation) { + if (efficiencyFlags.applyPurityHadron) + purity = hPurityHadron->Interpolate(ptassoc); + if (efficiencyFlags.applyEfficiencyPropagation) { efficiencyUncertainty = hEfficiencyUncertaintyHadron->Interpolate(ptassoc, assoc.eta()); - purityUncertainty = hPurityUncertaintyHadron->Interpolate(ptassoc); + if (efficiencyFlags.applyPurityHadron) + purityUncertainty = hPurityUncertaintyHadron->Interpolate(ptassoc); } } } - if (applyEfficiencyForTrigger) { + if (efficiencyFlags.applyEfficiencyForTrigger) { efficiencyTrigg = hEfficiencyTrigger->Interpolate(pttrigger, trigg.eta()); - purityTrigger = hPurityHadron->Interpolate(pttrigger); - if (applyEfficiencyPropagation) { + if (efficiencyFlags.applyPurityTrigger) + purityTrigger = hPurityHadron->Interpolate(pttrigger); + if (efficiencyFlags.applyEfficiencyPropagation) { triggerEfficiencyUncert = hEfficiencyUncertaintyTrigger->Interpolate(ptassoc, assoc.eta()); - triggerPurityUncertainty = hPurityUncertaintyHadron->Interpolate(ptassoc); + if (efficiencyFlags.applyPurityTrigger) + triggerPurityUncertainty = hPurityUncertaintyHadron->Interpolate(ptassoc); } } if (efficiency == 0) { // check for zero efficiency, do not apply if the case @@ -1077,7 +1086,7 @@ struct HStrangeCorrelation { efficiencyTrigg = 1.0; triggerEfficiencyUncert = 0.0; } - if (applyEfficiencyPropagation) { + if (efficiencyFlags.applyEfficiencyPropagation) { totalEffUncert = std::sqrt(std::pow(efficiencyTrigg * efficiencyUncertainty, 2) + std::pow(triggerEfficiencyUncert * efficiency, 2)); totalPurityUncert = std::sqrt(std::pow(purityTrigger * purityUncertainty, 2) + std::pow(purity * triggerPurityUncertainty, 2)); } @@ -1458,7 +1467,7 @@ struct HStrangeCorrelation { // initialize CCDB *only* if efficiency correction requested // skip if not requested, saves a bit of time - if (applyEfficiencyCorrection) { + if (efficiencyFlags.applyEfficiencyCorrection) { ccdb->setURL(ccdburl); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); @@ -1640,7 +1649,7 @@ struct HStrangeCorrelation { auto bc = collision.bc_as(); auto bField = getMagneticField(bc.timestamp()); - if (applyEfficiencyCorrection) { + if (efficiencyFlags.applyEfficiencyCorrection) { initEfficiencyFromCCDB(bc); } @@ -1667,13 +1676,13 @@ struct HStrangeCorrelation { if (!isValidTrigger(track)) continue; float efficiency = 1.0f; - if (applyEfficiencyCorrection) { + if (efficiencyFlags.applyEfficiencyCorrection) { efficiency = hEfficiencyTrigger->Interpolate(track.pt(), track.eta()); } if (efficiency == 0) { // check for zero efficiency, do not apply if the case efficiency = 1; } - float weight = applyEfficiencyCorrection ? 1. / efficiency : 1.0f; + float weight = efficiencyFlags.applyEfficiencyCorrection ? 1. / efficiency : 1.0f; histos.fill(HIST("hTriggerAllSelectedEtaVsPt"), track.pt(), track.eta(), collision.centFT0M()); histos.fill(HIST("hTriggerPtResolution"), track.pt(), triggerTrack.mcOriginalPt()); if (doTriggPhysicalPrimary && !triggerTrack.mcPhysicalPrimary()) @@ -1687,14 +1696,15 @@ struct HStrangeCorrelation { continue; float efficiency = 1.0f; float purity = 1.0f; - if (applyEfficiencyCorrection) { + if (efficiencyFlags.applyEfficiencyCorrection) { efficiency = hEfficiencyHadron->Interpolate(assoc.pt(), assoc.eta()); - purity = hPurityHadron->Interpolate(assoc.pt()); + if (efficiencyFlags.applyPurityHadron) + purity = hPurityHadron->Interpolate(assoc.pt()); } if (efficiency == 0) { // check for zero efficiency, do not apply if the case efficiency = 1; } - float weight = applyEfficiencyCorrection ? purity / efficiency : 1.0f; + float weight = efficiencyFlags.applyEfficiencyCorrection ? purity / efficiency : 1.0f; histos.fill(HIST("hAssocHadronsAllSelectedEtaVsPt"), assoc.pt(), assoc.eta(), collision.centFT0M()); histos.fill(HIST("hAssocPtResolution"), assoc.pt(), assocTrack.mcOriginalPt()); if (doAssocPhysicalPrimary && !assocTrack.mcPhysicalPrimary()) @@ -1738,7 +1748,7 @@ struct HStrangeCorrelation { // Do basic QA auto bc = collision.bc_as(); auto bField = getMagneticField(bc.timestamp()); - if (applyEfficiencyCorrection) { + if (efficiencyFlags.applyEfficiencyCorrection) { initEfficiencyFromCCDB(bc); } TH2F* hEfficiencyV0[3]; @@ -1767,14 +1777,14 @@ struct HStrangeCorrelation { static_for<0, 2>([&](auto i) { constexpr int Index = i.value; float efficiency = 1.0f; - if (applyEfficiencyCorrection) { + if (efficiencyFlags.applyEfficiencyCorrection) { efficiency = hEfficiencyV0[Index]->Interpolate(v0Data.pt(), v0Data.eta()); } if (efficiency == 0) { // check for zero efficiency, do not apply if the case efficiency = 1; } - float weight = applyEfficiencyCorrection ? 1. / efficiency : 1.0f; - if (v0.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || v0.mcTrue(Index)) && (!doAssocPhysicalPrimary || v0.mcPhysicalPrimary()) && (!applyEfficiencyCorrection || efficiency != 0)) { + float weight = efficiencyFlags.applyEfficiencyCorrection ? 1. / efficiency : 1.0f; + if (v0.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || v0.mcTrue(Index)) && (!doAssocPhysicalPrimary || v0.mcPhysicalPrimary()) && (!efficiencyFlags.applyEfficiencyCorrection || efficiency != 0)) { if ((TESTBIT(doCorrelation, Index)) && (doPPAnalysis || (TESTBIT(selMap, Index) && TESTBIT(selMap, Index + 3)))) { histos.fill(HIST("h3d") + HIST(kV0names[Index]) + HIST("Spectrum"), v0Data.pt(), cent, v0.invMassNSigma(Index), weight); if (std::abs(v0Data.rapidity(Index)) < ySel) { @@ -1837,7 +1847,7 @@ struct HStrangeCorrelation { // Do basic QA auto bc = collision.bc_as(); auto bField = getMagneticField(bc.timestamp()); - if (applyEfficiencyCorrection) { + if (efficiencyFlags.applyEfficiencyCorrection) { initEfficiencyFromCCDB(bc); } TH2F* hEfficiencyCascade[4]; @@ -1874,14 +1884,14 @@ struct HStrangeCorrelation { static_for<0, 3>([&](auto i) { constexpr int Index = i.value; float efficiency = 1.0f; - if (applyEfficiencyCorrection) { + if (efficiencyFlags.applyEfficiencyCorrection) { efficiency = hEfficiencyCascade[Index]->Interpolate(cascData.pt(), cascData.eta()); } if (efficiency == 0) { // check for zero efficiency, do not apply if the case efficiency = 1; } - float weight = applyEfficiencyCorrection ? 1. / efficiency : 1.0f; - if (casc.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || casc.mcTrue(Index)) && (!doAssocPhysicalPrimary || casc.mcPhysicalPrimary()) && (!applyEfficiencyCorrection || efficiency != 0)) { + float weight = efficiencyFlags.applyEfficiencyCorrection ? 1. / efficiency : 1.0f; + if (casc.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || casc.mcTrue(Index)) && (!doAssocPhysicalPrimary || casc.mcPhysicalPrimary()) && (!efficiencyFlags.applyEfficiencyCorrection || efficiency != 0)) { if (TESTBIT(doCorrelation, Index + 3) && (doPPAnalysis || (TESTBIT(CascselMap, Index) && TESTBIT(CascselMap, Index + 4) && TESTBIT(CascselMap, Index + 8) && TESTBIT(CascselMap, Index + 12)))) { histos.fill(HIST("h3d") + HIST(kCascadenames[Index]) + HIST("Spectrum"), cascData.pt(), cent, casc.invMassNSigma(Index), weight); if (std::abs(cascData.rapidity(Index)) < ySel) { @@ -1925,7 +1935,7 @@ struct HStrangeCorrelation { auto bc = collision.bc_as(); auto bField = getMagneticField(bc.timestamp()); - if (applyEfficiencyCorrection) { + if (efficiencyFlags.applyEfficiencyCorrection) { initEfficiencyFromCCDB(bc); } @@ -1972,7 +1982,7 @@ struct HStrangeCorrelation { auto bc = collision1.bc_as(); auto bField = getMagneticField(bc.timestamp()); // ________________________________________________ - if (applyEfficiencyCorrection) { + if (efficiencyFlags.applyEfficiencyCorrection) { initEfficiencyFromCCDB(bc); } // ________________________________________________ @@ -2021,7 +2031,7 @@ struct HStrangeCorrelation { auto bc = collision1.bc_as(); auto bField = getMagneticField(bc.timestamp()); // ________________________________________________ - if (applyEfficiencyCorrection) { + if (efficiencyFlags.applyEfficiencyCorrection) { initEfficiencyFromCCDB(bc); } // ________________________________________________ @@ -2069,7 +2079,7 @@ struct HStrangeCorrelation { // ________________________________________________ auto bc = collision1.bc_as(); auto bField = getMagneticField(bc.timestamp()); - if (applyEfficiencyCorrection) { + if (efficiencyFlags.applyEfficiencyCorrection) { initEfficiencyFromCCDB(bc); } // ________________________________________________ @@ -2111,7 +2121,7 @@ struct HStrangeCorrelation { auto bc = collision1.bc_as(); auto bField = getMagneticField(bc.timestamp()); // ________________________________________________ - if (applyEfficiencyCorrection) { + if (efficiencyFlags.applyEfficiencyCorrection) { initEfficiencyFromCCDB(bc); } // ________________________________________________ From 9ee6f49b003917e9c40b80bedd0a2996cba40529 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Wed, 24 Sep 2025 15:13:29 +0200 Subject: [PATCH 524/986] [PWGLF] Fix filling of the histogram (#13101) --- PWGLF/Tasks/QC/systematicsMapping.cxx | 74 ++++++++++++++++++++++----- 1 file changed, 60 insertions(+), 14 deletions(-) diff --git a/PWGLF/Tasks/QC/systematicsMapping.cxx b/PWGLF/Tasks/QC/systematicsMapping.cxx index b4e2a3a5a29..ea76a528b05 100644 --- a/PWGLF/Tasks/QC/systematicsMapping.cxx +++ b/PWGLF/Tasks/QC/systematicsMapping.cxx @@ -40,10 +40,19 @@ struct SystematicsMapping { ConfigurableAxis invariantMassBins{"invariantMassBins", {100, -0.1f, 0.1f}, "Binning for the invariant mass (GeV/c^2)"}; ConfigurableAxis nsigmaBins{"nsigmaBins", {100, -10.f, 10.f}, "Binning for nSigma"}; // Selection bins - ConfigurableAxis tpcClusterBins{"tpcClusterBins", {5, 70, 100, 120, 135, 150}, "Min TPC clusters for tracks"}; + ConfigurableAxis tpcCrossedRowsBins{"tpcCrossedRowsBins", {5, 70, 100, 120, 135, 150}, "Min TPC clusters for tracks"}; ConfigurableAxis itsClustersBins{"itsClustersBins", {5, 0, 6}, "Min ITS clusters for tracks"}; + ConfigurableAxis dcaBins{"dcaBins", {100, 0.f, 5.f}, "Binning for DCA (cm)"}; + ConfigurableAxis chi2Bins{"chi2Bins", {100, 0.f, 100.f}, "Binning for chi2"}; // Selection configurables Configurable selectionPosZ{"selectionPosZ", 10.f, "Max |z| of the primary vertex"}; + // V0 selection criteria + Configurable v0cospa{"v0cospa", 0.97, "V0 CosPA"}; + Configurable dcav0dau{"dcav0dau", 10, "DCA V0 Daughters"}; + Configurable dcanegtopv{"dcanegtopv", 0.0, "DCA Neg To PV"}; + Configurable dcapostopv{"dcapostopv", 0.0, "DCA Pos To PV"}; + Configurable v0radius{"v0radius", 0.0, "Radius"}; + Configurable etadau{"etadau", 0.8, "Eta Daughters"}; HistogramRegistry registry{"registry"}; @@ -58,28 +67,41 @@ struct SystematicsMapping { const AxisSpec ptAxis{ptBins, "#it{p}_{T} (GeV/c)"}; const AxisSpec etaAxis{etaBins, "#eta"}; const AxisSpec phiAxis{phiBins, "#phi (rad)"}; + const AxisSpec invariantMassAxis{invariantMassBins, "Invariant Mass (GeV/c^{2})"}; + const AxisSpec nsigmaAxisTPC{nsigmaBins, "nSigma TPC"}; + const AxisSpec nsigmaAxisTOF{nsigmaBins, "nSigma TOF"}; + const AxisSpec tpcCrossedRowsAxis{tpcCrossedRowsBins, "TPC crossed rows"}; + const AxisSpec itsClustersAxis{itsClustersBins, "ITS clusters"}; + const AxisSpec dcaXYAxis{dcaBins, "DCAxy (cm)"}; + const AxisSpec dcaZAxis{dcaBins, "DCAz (cm)"}; + const AxisSpec chi2TPCAxis{chi2Bins, "TPC Chi2"}; + const AxisSpec chi2ITSAxis{chi2Bins, "ITS Chi2"}; if (doprocessData) { // First we define the histograms on which we are cutting (tpc clusters, its clusters, ..) - registry.add("K/hTPCClusters", "", HistType::kTH1F, {{100, 0, 200}}); + registry.add("K/hTPCCrossedRows", "", HistType::kTH1F, {{100, 0, 200}}); registry.add("K/hITSClusters", "", HistType::kTH1F, {{10, 0, 10}}); + registry.add("K/hDCAxy", "", HistType::kTH1F, {dcaBins}); + registry.add("K/hDCAz", "", HistType::kTH1F, {dcaBins}); + registry.add("K/hChi2OverNCLsTPC", "", HistType::kTH1F, {chi2Bins}); + registry.add("K/hChi2OverNCLsITS", "", HistType::kTH1F, {chi2Bins}); registry.addClone("K/", "K0s/"); // Add the signal histograms - registry.add("K/SignalPositive", "", HistType::kTHnSparseF, {ptBins, etaBins, phiBins, nsigmaBins, tpcClusterBins, itsClustersBins}); - registry.add("K/SignalNegative", "", HistType::kTHnSparseF, {ptBins, etaBins, phiBins, nsigmaBins, tpcClusterBins, itsClustersBins}); - registry.add("K0s/Signal", "", HistType::kTHnSparseF, {ptBins, etaBins, phiBins, invariantMassBins, tpcClusterBins, itsClustersBins}); + registry.add("K/SignalPositive", "", HistType::kTHnSparseF, {ptAxis, etaAxis, phiAxis, nsigmaAxisTPC, nsigmaAxisTOF, tpcCrossedRowsAxis, itsClustersAxis, dcaXYAxis, dcaZAxis, chi2TPCAxis, chi2ITSAxis}); + registry.add("K/SignalNegative", "", HistType::kTHnSparseF, {ptAxis, etaAxis, phiAxis, nsigmaAxisTPC, nsigmaAxisTOF, tpcCrossedRowsAxis, itsClustersAxis, dcaXYAxis, dcaZAxis, chi2TPCAxis, chi2ITSAxis}); + registry.add("K0s/Signal", "", HistType::kTHnSparseF, {ptAxis, etaAxis, phiAxis, invariantMassBins, nsigmaAxisTPC, nsigmaAxisTOF, tpcCrossedRowsAxis, itsClustersAxis, dcaXYAxis, dcaZAxis, chi2TPCAxis, chi2ITSAxis}); } if (doprocessMc) { - registry.add("K/GeneratedPositive", "", HistType::kTHnSparseF, {ptBins, etaBins, phiBins}); - registry.add("K/GeneratedNegative", "", HistType::kTHnSparseF, {ptBins, etaBins, phiBins}); - registry.add("K0s/Generated", "", HistType::kTHnSparseF, {ptBins, etaBins, phiBins}); + registry.add("K/GeneratedPositive", "", HistType::kTHnSparseF, {ptAxis, etaAxis, phiAxis}); + registry.add("K/GeneratedNegative", "", HistType::kTHnSparseF, {ptAxis, etaAxis, phiAxis}); + registry.add("K0s/Generated", "", HistType::kTHnSparseF, {ptAxis, etaAxis, phiAxis}); } } - using TrackType = soa::Join; + using TrackType = soa::Join; using CollisionType = soa::Join; void processData(CollisionType const& collisions, @@ -94,21 +116,45 @@ struct SystematicsMapping { for (const auto& track : tracks) { if (track.collisionId() != collision.globalIndex()) continue; - registry.fill(HIST("hTPCClusters"), track.tpcNClsFound()); - registry.fill(HIST("hITSClusters"), track.itsNCls()); + registry.fill(HIST("K/hTPCCrossedRows"), track.tpcNClsCrossedRows()); + registry.fill(HIST("K/hITSClusters"), track.itsNCls()); + registry.fill(HIST("K/hDCAxy"), track.dcaXY()); + registry.fill(HIST("K/hDCAz"), track.dcaZ()); + registry.fill(HIST("K/hChi2OverNCLsTPC"), track.tpcChi2NCl()); + registry.fill(HIST("K/hChi2OverNCLsITS"), track.itsChi2NCl()); if (track.sign() > 0) - registry.fill(HIST("K/SignalPositive"), track.pt(), track.eta(), track.phi(), track.tpcNSigmaKa(), track.tpcNClsFound(), track.itsNCls()); + registry.fill(HIST("K/SignalPositive"), track.pt(), track.eta(), track.phi(), track.tpcNSigmaKa(), track.tofNSigmaKa(), track.tpcNClsCrossedRows(), track.itsNCls(), track.dcaXY(), track.dcaZ(), track.tpcChi2NCl(), track.itsChi2NCl()); else - registry.fill(HIST("K/SignalNegative"), track.pt(), track.eta(), track.phi(), track.tpcNSigmaKa(), track.tpcNClsFound(), track.itsNCls()); + registry.fill(HIST("K/SignalNegative"), track.pt(), track.eta(), track.phi(), track.tpcNSigmaKa(), track.tofNSigmaKa(), track.tpcNClsCrossedRows(), track.itsNCls(), track.dcaXY(), track.dcaZ(), track.tpcChi2NCl(), track.itsChi2NCl()); } // K0s loop for (const auto& v0 : v0s) { if (v0.collisionId() != collision.globalIndex()) continue; + const auto& posTrack = v0.posTrack_as(); const auto& negTrack = v0.negTrack_as(); - registry.fill(HIST("K0s/Signal"), v0.pt(), v0.eta(), v0.phi(), v0.mK0Short() - constants::physics::MassK0Short, std::min(posTrack.tpcNClsFound(), negTrack.tpcNClsFound()), std::min(posTrack.itsNCls(), negTrack.itsNCls())); + if (v0.v0radius() < v0radius || + v0.v0cosPA() < v0cospa || + std::abs(posTrack.eta()) > etadau || + std::abs(negTrack.eta()) > etadau) + continue; + registry.fill(HIST("K0s/hTPCCrossedRows"), std::min(posTrack.tpcNClsCrossedRows(), negTrack.tpcNClsCrossedRows())); + registry.fill(HIST("K0s/hITSClusters"), std::min(posTrack.itsNCls(), negTrack.itsNCls())); + registry.fill(HIST("K0s/hDCAxy"), std::min(posTrack.dcaXY(), negTrack.dcaXY())); + registry.fill(HIST("K0s/hDCAz"), std::min(posTrack.dcaZ(), negTrack.dcaZ())); + registry.fill(HIST("K0s/hChi2OverNCLsTPC"), std::min(posTrack.tpcChi2NCl(), negTrack.tpcChi2NCl())); + registry.fill(HIST("K0s/hChi2OverNCLsITS"), std::min(posTrack.itsChi2NCl(), negTrack.itsChi2NCl())); + registry.fill(HIST("K0s/Signal"), v0.pt(), v0.eta(), v0.phi(), v0.mK0Short() - constants::physics::MassK0Short, + std::max(posTrack.tpcNSigmaPi(), negTrack.tpcNSigmaPi()), + std::max(posTrack.tofNSigmaPi(), negTrack.tofNSigmaPi()), + std::min(posTrack.tpcNClsCrossedRows(), negTrack.tpcNClsCrossedRows()), + std::min(posTrack.itsNCls(), negTrack.itsNCls()), + std::min(posTrack.dcaXY(), negTrack.dcaXY()), + std::min(posTrack.dcaZ(), negTrack.dcaZ()), + std::min(posTrack.tpcChi2NCl(), negTrack.tpcChi2NCl()), + std::min(posTrack.itsChi2NCl(), negTrack.itsChi2NCl())); } } } From 044d08f588c1bb976df8985f9b79e050cf780d69 Mon Sep 17 00:00:00 2001 From: Marcello Di Costanzo <96481191+Marcellocosti@users.noreply.github.com> Date: Wed, 24 Sep 2025 16:05:36 +0200 Subject: [PATCH 525/986] [PWGHF] Refactor data creator for HF correlations (#12989) Co-authored-by: ALICE Action Bot --- .../DataModel/DerivedDataCorrelationTables.h | 212 +++++-- .../correlatorFlowCharmHadronsReduced.cxx | 576 +++++++++--------- .../derivedDataCreatorCorrelationsReduced.cxx | 529 +++++++++++----- 3 files changed, 824 insertions(+), 493 deletions(-) diff --git a/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h b/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h index 40274d89cef..b0a9cf3e390 100644 --- a/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h +++ b/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h @@ -35,7 +35,7 @@ DECLARE_SOA_TABLE(HfcRedCollisions, "AOD", "HFCREDCOLLISION", //! Table with col aod::hf_collisions_reduced::NumPvContrib, aod::hf_collisions_reduced::PosZ); -DECLARE_SOA_TABLE(HfcRedFlowColls, "AOD", "HFCREDFLOWCOLL", //! Table with collision info +DECLARE_SOA_TABLE(HfcRedCorrColls, "AOD", "HFCREDCORRCOLL", //! Table with collision info soa::Index<>, aod::hf_collisions_reduced::Multiplicity, aod::hf_collisions_reduced::NumPvContrib, @@ -44,13 +44,9 @@ DECLARE_SOA_TABLE(HfcRedFlowColls, "AOD", "HFCREDFLOWCOLL", //! Table with colli using HfcRedCollision = HfcRedCollisions::iterator; -// DECLARE_SOA_TABLE(HfCandColCounts, "AOD", "HFCANDCOLCOUNT", //! Table with number of collisions which contain at least one candidate -// aod::hf_collisions_reduced::OriginalCollisionCount); - namespace hf_candidate_reduced { DECLARE_SOA_INDEX_COLUMN(HfcRedCollision, hfcRedCollision); //! ReducedCollision index -DECLARE_SOA_INDEX_COLUMN(HfcRedFlowColl, hfcRedFlowColl); //! ReducedCollision index DECLARE_SOA_COLUMN(Prong0Id, prong0Id, int); //! Prong 0 index DECLARE_SOA_COLUMN(Prong1Id, prong1Id, int); //! Prong 1 index DECLARE_SOA_COLUMN(Prong2Id, prong2Id, int); //! Prong2 index @@ -58,11 +54,8 @@ DECLARE_SOA_COLUMN(PhiCand, phiCand, float); //! Phi of the candi DECLARE_SOA_COLUMN(EtaCand, etaCand, float); //! Eta of the candidate DECLARE_SOA_COLUMN(PtCand, ptCand, float); //! Pt of the candidate DECLARE_SOA_COLUMN(InvMassDs, invMassDs, float); //! Invariant mass of Ds candidate -DECLARE_SOA_COLUMN(InvMassCand, invMassCand, float); //! Invariant mass of Charm candidate DECLARE_SOA_COLUMN(BdtScorePrompt, bdtScorePrompt, float); //! BDT output score for prompt hypothesis DECLARE_SOA_COLUMN(BdtScoreBkg, bdtScoreBkg, float); //! BDT output score for background hypothesis -DECLARE_SOA_COLUMN(BdtScore0, bdtScore0, float); //! First BDT output score -DECLARE_SOA_COLUMN(BdtScore1, bdtScore1, float); //! Second BDT output score } // namespace hf_candidate_reduced DECLARE_SOA_TABLE(DsCandReduceds, "AOD", "DSCANDREDUCED", //! Table with Ds candidate info soa::Index<>, @@ -81,23 +74,6 @@ DECLARE_SOA_TABLE(DsCandSelInfos, "AOD", "DSCANDSELINFO", //! Table with Ds cand aod::hf_candidate_reduced::BdtScorePrompt, aod::hf_candidate_reduced::BdtScoreBkg); -DECLARE_SOA_TABLE(HfcRedCharmTrigs, "AOD", "HFCREDCHARMTRIG", //! Table with charm hadron candidate info - soa::Index<>, - aod::hf_candidate_reduced::HfcRedFlowCollId, - aod::hf_candidate_reduced::PhiCand, - aod::hf_candidate_reduced::EtaCand, - aod::hf_candidate_reduced::PtCand, - aod::hf_candidate_reduced::InvMassCand, - aod::hf_candidate_reduced::Prong0Id, - aod::hf_candidate_reduced::Prong1Id, - aod::hf_candidate_reduced::Prong2Id); - -DECLARE_SOA_TABLE(HfcRedCharmMls, "AOD", "HFCREDCHARMML", //! Table with charm hadron candidate selection info - soa::Index<>, - aod::hf_candidate_reduced::HfcRedFlowCollId, - aod::hf_candidate_reduced::BdtScore0, - aod::hf_candidate_reduced::BdtScore1); - namespace hf_assoc_track_reduced { DECLARE_SOA_COLUMN(OriginTrackId, originTrackId, int); //! Original track index @@ -125,50 +101,154 @@ DECLARE_SOA_TABLE(AssocTrackSels, "AOD", "ASSOCTRACKSEL", //! Table with associa aod::hf_assoc_track_reduced::ItsClusterMap, aod::hf_assoc_track_reduced::ItsNCls, aod::hf_assoc_track_reduced::DcaXY, - aod::hf_assoc_track_reduced::DcaZ) - -DECLARE_SOA_TABLE(HfcRedTrkAssocs, "AOD", "HFCREDTRKASSOC", //! Table with associated track info - soa::Index<>, - aod::hf_candidate_reduced::HfcRedFlowCollId, - aod::hf_assoc_track_reduced::OriginTrackId, - aod::hf_assoc_track_reduced::PhiAssocTrack, - aod::hf_assoc_track_reduced::EtaAssocTrack, - aod::hf_assoc_track_reduced::PtAssocTrack); - -DECLARE_SOA_TABLE(HfcRedTrkSels, "AOD", "HFCREDTRKSEL", //! Table with associated track info - soa::Index<>, - aod::hf_candidate_reduced::HfcRedFlowCollId, - aod::hf_assoc_track_reduced::NTpcCrossedRows, - aod::hf_assoc_track_reduced::ItsClusterMap, - aod::hf_assoc_track_reduced::ItsNCls, - aod::hf_assoc_track_reduced::DcaXY, - aod::hf_assoc_track_reduced::DcaZ) + aod::hf_assoc_track_reduced::DcaZ); // definition of columns and tables for Charm-Hadron and Hadron-Hadron correlation pairs -namespace hf_correlation_charm_hadron_reduced +namespace hf_correl_charm_had_reduced { -DECLARE_SOA_INDEX_COLUMN_FULL(CharmTrig, charmTrig, int, HfcRedCharmTrigs, "_0"); //! Reduced charm trigger candidate index -DECLARE_SOA_INDEX_COLUMN_FULL(HadTrig, hadTrig, int, HfcRedTrkAssocs, "_1"); //! Reduced hadron trigger candidate index -DECLARE_SOA_INDEX_COLUMN_FULL(TrkAssoc, trkAssoc, int, HfcRedTrkAssocs, "_2"); //! Reduced associated track index -DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! DeltaPhi between charm hadron and Hadrons -DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); //! DeltaEta between charm hadron and Hadrons -DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin for the MixedEvent -} // namespace hf_correlation_charm_hadron_reduced - -DECLARE_SOA_TABLE(HfcRedChHads, "AOD", "HFCREDCHHAD", //! Charm-Hadron pairs information - aod::hf_correlation_charm_hadron_reduced::CharmTrigId, - aod::hf_correlation_charm_hadron_reduced::TrkAssocId, - aod::hf_correlation_charm_hadron_reduced::DeltaEta, - aod::hf_correlation_charm_hadron_reduced::DeltaPhi, - aod::hf_correlation_charm_hadron_reduced::PoolBin); - -DECLARE_SOA_TABLE(HfcRedHadHads, "AOD", "HFCREDHADHAD", //! Hadron-Hadron pairs information - aod::hf_correlation_charm_hadron_reduced::HadTrigId, - aod::hf_correlation_charm_hadron_reduced::TrkAssocId, - aod::hf_correlation_charm_hadron_reduced::DeltaEta, - aod::hf_correlation_charm_hadron_reduced::DeltaPhi, - aod::hf_correlation_charm_hadron_reduced::PoolBin); - +// Correlation columns +DECLARE_SOA_INDEX_COLUMN(HfcRedCorrColl, hfcRedCorrColl); //! ReducedCollision index +DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! DeltaPhi between charm hadron and Hadrons +DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); //! DeltaEta between charm hadron and Hadrons +DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin for the MixedEvent +// General trigger particle columns +DECLARE_SOA_COLUMN(PhiTrig, phiTrig, float); //! Phi of the trigger candidate +DECLARE_SOA_COLUMN(EtaTrig, etaTrig, float); //! Eta of the trigger candidate +DECLARE_SOA_COLUMN(PtTrig, ptTrig, float); //! Pt of the trigger candidate +// Charm trigger particle selection columns +DECLARE_SOA_COLUMN(InvMassTrig, invMassTrig, float); //! Invariant mass of Charm trigger candidate +DECLARE_SOA_COLUMN(BdtScore0Trig, bdtScore0Trig, float); //! First BDT output score +DECLARE_SOA_COLUMN(BdtScore1Trig, bdtScore1Trig, float); //! Second BDT output score +// Hadron trigger particle selection columns +DECLARE_SOA_COLUMN(NTpcCrossedRowsTrig, nTpcCrossedRowsTrig, int); //! Number of crossed TPC Rows +DECLARE_SOA_COLUMN(ItsClsMapTrig, itsClsMapTrig, int); //! ITS cluster map, one bit per a layer, starting from the innermost +DECLARE_SOA_COLUMN(ItsNClsTrig, itsNClsTrig, int); //! Number of ITS clusters +DECLARE_SOA_COLUMN(DcaXYTrig, dcaXYTrig, float); //! Impact parameter in XY of the track to the primary vertex +DECLARE_SOA_COLUMN(DcaZTrig, dcaZTrig, float); //! Impact parameter in Z of the track to the primary vertex +// General associated particle columns +DECLARE_SOA_COLUMN(EtaAssoc, etaAssoc, float); //! Eta of the associated candidate +DECLARE_SOA_COLUMN(PhiAssoc, phiAssoc, float); //! Phi of the associated candidate +DECLARE_SOA_COLUMN(PtAssoc, ptAssoc, float); //! Pt of the associated candidate +// Hadron associated particle selection columns +DECLARE_SOA_COLUMN(NTpcCrossedRowsAssoc, nTpcCrossedRowsAssoc, int); //! Number of crossed TPC Rows +DECLARE_SOA_COLUMN(ItsClsMapAssoc, itsClsMapAssoc, int); //! ITS cluster map, one bit per a layer, starting from the innermost +DECLARE_SOA_COLUMN(ItsNClsAssoc, itsNClsAssoc, int); //! Number of ITS clusters +DECLARE_SOA_COLUMN(DcaXYAssoc, dcaXYAssoc, float); //! Impact parameter in XY of the track to the primary vertex +DECLARE_SOA_COLUMN(DcaZAssoc, dcaZAssoc, float); //! Impact parameter in Z of the track to the primary vertex +} // namespace hf_correl_charm_had_reduced + +DECLARE_SOA_TABLE(HfcRedTrigBases, "AOD", "HFCREDTRIGBASE", //! Table with trigger candidate base info + soa::Index<>, + aod::hf_correl_charm_had_reduced::HfcRedCorrCollId, + aod::hf_correl_charm_had_reduced::PhiTrig, + aod::hf_correl_charm_had_reduced::EtaTrig, + aod::hf_correl_charm_had_reduced::PtTrig); + +DECLARE_SOA_TABLE(HfcRedTrigCharms, "AOD", "HFCREDTRIGCHARM", //! Table with Same Event Charm-Hadron pairs information + aod::hf_correl_charm_had_reduced::InvMassTrig, + aod::hf_correl_charm_had_reduced::BdtScore0Trig, + aod::hf_correl_charm_had_reduced::BdtScore1Trig); + +DECLARE_SOA_TABLE(HfcRedTrigTracks, "AOD", "HFCREDTRIGTRACK", //! Table with Same Event Charm-Hadron pairs information + aod::hf_correl_charm_had_reduced::NTpcCrossedRowsTrig, + aod::hf_correl_charm_had_reduced::ItsClsMapTrig, + aod::hf_correl_charm_had_reduced::ItsNClsTrig, + aod::hf_correl_charm_had_reduced::DcaXYTrig, + aod::hf_correl_charm_had_reduced::DcaZTrig); + +DECLARE_SOA_TABLE(HfcRedAssBases, "AOD", "HFCREDASSBASE", //! Table with associated candidate base info + soa::Index<>, + aod::hf_correl_charm_had_reduced::HfcRedCorrCollId, + aod::hf_correl_charm_had_reduced::PhiAssoc, + aod::hf_correl_charm_had_reduced::EtaAssoc, + aod::hf_correl_charm_had_reduced::PtAssoc); + +DECLARE_SOA_TABLE(HfcRedAssTracks, "AOD", "HFCREDASSTRACK", //! Table with Same Event Track Selections information + aod::hf_correl_charm_had_reduced::NTpcCrossedRowsAssoc, + aod::hf_correl_charm_had_reduced::ItsClsMapAssoc, + aod::hf_correl_charm_had_reduced::ItsNClsAssoc, + aod::hf_correl_charm_had_reduced::DcaXYAssoc, + aod::hf_correl_charm_had_reduced::DcaZAssoc); + +DECLARE_SOA_TABLE(HfcRedSEBases, "AOD", "HFCREDSEBASE", //! Table with Same Event Trig-Assoc pairs + aod::hf_correl_charm_had_reduced::HfcRedCorrCollId, + aod::hf_correl_charm_had_reduced::PtTrig, + aod::hf_correl_charm_had_reduced::PtAssoc, + aod::hf_correl_charm_had_reduced::DeltaEta, + aod::hf_correl_charm_had_reduced::DeltaPhi); + +DECLARE_SOA_TABLE(HfcRedSEChHads, "AOD", "HFCREDSECHHAD", //! Correlation pairs information Same Event + aod::hf_correl_charm_had_reduced::PoolBin, + aod::hf_correl_charm_had_reduced::PtTrig, + aod::hf_correl_charm_had_reduced::PtAssoc, + aod::hf_correl_charm_had_reduced::DeltaEta, + aod::hf_correl_charm_had_reduced::DeltaPhi, + aod::hf_correl_charm_had_reduced::InvMassTrig, + aod::hf_correl_charm_had_reduced::BdtScore0Trig, + aod::hf_correl_charm_had_reduced::BdtScore1Trig, + aod::hf_correl_charm_had_reduced::NTpcCrossedRowsAssoc, + aod::hf_correl_charm_had_reduced::ItsClsMapAssoc, + aod::hf_correl_charm_had_reduced::ItsNClsAssoc, + aod::hf_correl_charm_had_reduced::DcaXYAssoc, + aod::hf_correl_charm_had_reduced::DcaZAssoc, + soa::Marker<1>); + +DECLARE_SOA_TABLE(HfcRedMEChHads, "AOD", "HFCREDMECHHAD", //! Correlation pairs information Same Event + aod::hf_correl_charm_had_reduced::PoolBin, + aod::hf_correl_charm_had_reduced::PtTrig, + aod::hf_correl_charm_had_reduced::PtAssoc, + aod::hf_correl_charm_had_reduced::DeltaEta, + aod::hf_correl_charm_had_reduced::DeltaPhi, + aod::hf_correl_charm_had_reduced::InvMassTrig, + aod::hf_correl_charm_had_reduced::BdtScore0Trig, + aod::hf_correl_charm_had_reduced::BdtScore1Trig, + aod::hf_correl_charm_had_reduced::NTpcCrossedRowsAssoc, + aod::hf_correl_charm_had_reduced::ItsClsMapAssoc, + aod::hf_correl_charm_had_reduced::ItsNClsAssoc, + aod::hf_correl_charm_had_reduced::DcaXYAssoc, + aod::hf_correl_charm_had_reduced::DcaZAssoc, + soa::Marker<2>); + +DECLARE_SOA_TABLE(HfcRedSEHadHads, "AOD", "HFCREDSEHADHAD", //! Correlation pairs information Same Event + aod::hf_correl_charm_had_reduced::PoolBin, + aod::hf_correl_charm_had_reduced::PtTrig, + aod::hf_correl_charm_had_reduced::PtAssoc, + aod::hf_correl_charm_had_reduced::DeltaEta, + aod::hf_correl_charm_had_reduced::DeltaPhi, + aod::hf_correl_charm_had_reduced::NTpcCrossedRowsTrig, + aod::hf_correl_charm_had_reduced::ItsClsMapTrig, + aod::hf_correl_charm_had_reduced::ItsNClsTrig, + aod::hf_correl_charm_had_reduced::DcaXYTrig, + aod::hf_correl_charm_had_reduced::DcaZTrig, + aod::hf_correl_charm_had_reduced::NTpcCrossedRowsAssoc, + aod::hf_correl_charm_had_reduced::ItsClsMapAssoc, + aod::hf_correl_charm_had_reduced::ItsNClsAssoc, + aod::hf_correl_charm_had_reduced::DcaXYAssoc, + aod::hf_correl_charm_had_reduced::DcaZAssoc, + soa::Marker<1>); + +DECLARE_SOA_TABLE(HfcRedMEHadHads, "AOD", "HFCREDMEHADHAD", //! Correlation pairs information Same Event + aod::hf_correl_charm_had_reduced::PoolBin, + aod::hf_correl_charm_had_reduced::PtTrig, + aod::hf_correl_charm_had_reduced::PtAssoc, + aod::hf_correl_charm_had_reduced::DeltaEta, + aod::hf_correl_charm_had_reduced::DeltaPhi, + aod::hf_correl_charm_had_reduced::NTpcCrossedRowsTrig, + aod::hf_correl_charm_had_reduced::ItsClsMapTrig, + aod::hf_correl_charm_had_reduced::ItsNClsTrig, + aod::hf_correl_charm_had_reduced::DcaXYTrig, + aod::hf_correl_charm_had_reduced::DcaZTrig, + aod::hf_correl_charm_had_reduced::NTpcCrossedRowsAssoc, + aod::hf_correl_charm_had_reduced::ItsClsMapAssoc, + aod::hf_correl_charm_had_reduced::ItsNClsAssoc, + aod::hf_correl_charm_had_reduced::DcaXYAssoc, + aod::hf_correl_charm_had_reduced::DcaZAssoc, + soa::Marker<2>); + +DECLARE_SOA_TABLE(HfcRedCollInfos, "AOD", "HFCREDCOLLINFO", //! Table with collision info + aod::hf_collisions_reduced::Multiplicity, + aod::hf_collisions_reduced::NumPvContrib, + aod::hf_collisions_reduced::Centrality); } // namespace o2::aod #endif // PWGHF_HFC_DATAMODEL_DERIVEDDATACORRELATIONTABLES_H_ diff --git a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx index e1d1662924e..85df595a4b0 100644 --- a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx +++ b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx @@ -40,6 +40,7 @@ #include #include +#include #include #include @@ -49,17 +50,57 @@ using namespace o2::framework::expressions; using namespace o2::hf_centrality; using namespace o2::hf_evsel; -using BinningTypeDerivedCent = ColumnBinningPolicy; -using BinningTypeDerivedMult = ColumnBinningPolicy; +using BinningCentPosZ = ColumnBinningPolicy; +using BinningMultPosZ = ColumnBinningPolicy; + +/// Get charm candidate or hadron track pT +/// \param track is the candidate +template +double getPt(const TTrack& track) +{ + if constexpr (requires { track.ptAssoc(); }) { + return track.ptAssoc(); + } else { + return track.ptTrig(); + } +} + +/// Get charm candidate or hadron track eta +/// \param track is the candidate +template +double getEta(const TTrack& track) +{ + if constexpr (requires { track.etaAssoc(); }) { + return track.etaAssoc(); + } else { + return track.etaTrig(); + } +} + +/// Get charm candidate or hadron track phi +/// \param track is the candidate +template +double getPhi(const TTrack& track) +{ + if constexpr (requires { track.phiAssoc(); }) { + return track.phiAssoc(); + } else { + return track.phiTrig(); + } +} struct HfCorrelatorFlowCharmHadronsReduced { - Produces entryCharmHadPair; - Produces entryHadHadPair; + Produces rowPairSECharmHads; //! Correlation pairs information Same Event + Produces rowPairMECharmHads; //! Correlation pairs information Mixed Event + Produces rowPairSEHadHads; //! Correlation pairs information Same Event + Produces rowPairMEHadHads; //! Correlation pairs information Mixed Event + Produces rowCollInfos; //! Collision info Configurable fillSparses{"fillSparses", true, "Fill sparse histograms"}; Configurable fillTables{"fillTables", false, "Fill tables"}; Configurable numberEventsMixed{"numberEventsMixed", 5, "Number of events mixed in ME process"}; - Configurable> binsPtTrig{"binsPtTrig", std::vector{1., 3., 5., 8., 16., 36.}, "pT bin limits for trigger candidates"}; + Configurable> binsPtTrig{"binsPtTrig", std::vector{0., 3., 5., 8., 16., 36.}, "pT bin limits for trigger candidates"}; + Configurable> bkgScoresPtMaxs{"bkgScoresPtMaxs", std::vector{0.1, 0.1, 0.1, 0.1, 0.1}, "pT-differential maximum bkg scores for charm candidates"}; Configurable> binsPtAssoc{"binsPtAssoc", std::vector{0.3, 1., 2., 50.}, "pT bin limits for associated particles"}; Configurable deltaEtaAbsMin{"deltaEtaAbsMin", 0.5, "min. pair delta eta"}; Configurable deltaEtaAbsMax{"deltaEtaAbsMax", 2., "max. pair delta eta"}; @@ -67,20 +108,30 @@ struct HfCorrelatorFlowCharmHadronsReduced { Configurable dcaZTrackMax{"dcaZTrackMax", 1., "max. track DCA Z"}; Configurable tpcCrossedRowsMin{"tpcCrossedRowsMin", 1, "min. TPC crossed rows"}; Configurable itsNClsMin{"itsNClsMin", 1, "min. ITS clusters"}; + Configurable downSamplePairs{"downSamplePairs", 1., "Fraction of pairs to keep"}; + Configurable ptMaxForDownSample{"ptMaxForDownSample", 10., "Maximum pt for the application of the downsampling factor"}; + Configurable centMaxForDownSample{"centMaxForDownSample", 10., "Maximum centrality for the application of the downsampling factor"}; SliceCache cache; - using AssocTracks = soa::Filtered>; + int poolBins{0}; - Filter filterSelectTrackData = (nabs(aod::hf_assoc_track_reduced::dcaXY) < dcaXYTrackMax) && (nabs(aod::hf_assoc_track_reduced::dcaZ) < dcaZTrackMax) && (aod::hf_assoc_track_reduced::nTpcCrossedRows > tpcCrossedRowsMin) && (aod::hf_assoc_track_reduced::itsNCls > itsNClsMin); + using SameEvtPairsChHad = soa::Filtered>; + using SameEvtPairsHadHad = soa::Filtered>; + using AssocTracks = soa::Filtered>; + using TrigCharmCands = soa::Join; - Preslice tracksPerCol = aod::hf_candidate_reduced::hfcRedFlowCollId; - Preslice candsPerCol = aod::hf_candidate_reduced::hfcRedFlowCollId; + Filter filterAssocTracks = (nabs(aod::hf_correl_charm_had_reduced::dcaXYAssoc) < dcaXYTrackMax) && (nabs(aod::hf_correl_charm_had_reduced::dcaZAssoc) < dcaZTrackMax) && (aod::hf_correl_charm_had_reduced::nTpcCrossedRowsAssoc > tpcCrossedRowsMin) && (aod::hf_correl_charm_had_reduced::itsNClsAssoc > itsNClsMin); + Filter filterTrigTracks = (nabs(aod::hf_correl_charm_had_reduced::dcaXYTrig) < dcaXYTrackMax) && (nabs(aod::hf_correl_charm_had_reduced::dcaZTrig) < dcaZTrackMax) && (aod::hf_correl_charm_had_reduced::nTpcCrossedRowsTrig > tpcCrossedRowsMin) && (aod::hf_correl_charm_had_reduced::itsNClsTrig > itsNClsMin); + Filter filterSameEvtPairs = (nabs(aod::hf_correl_charm_had_reduced::deltaEta) > deltaEtaAbsMin) && (nabs(aod::hf_correl_charm_had_reduced::deltaEta) < deltaEtaAbsMax); + + Preslice assocTracksPerCol = aod::hf_correl_charm_had_reduced::hfcRedCorrCollId; + Preslice trigCharmCandsPerCol = aod::hf_correl_charm_had_reduced::hfcRedCorrCollId; ConfigurableAxis zPoolBins{"zPoolBins", {VARIABLE_WIDTH, -10.0, -2.5, 2.5, 10.0}, "Z vertex position pools"}; ConfigurableAxis multPoolBins{"multPoolBins", {VARIABLE_WIDTH, 0., 900., 1800., 6000.}, "Event multiplicity pools (FT0M)"}; - ConfigurableAxis centPoolBins{"centPoolBins", {VARIABLE_WIDTH, 0., 10., 20., 30.}, "Event centrality pools"}; - ConfigurableAxis binsInvMass{"binsInvMass", {300, 1.6, 2.2}, ""}; + ConfigurableAxis centPoolBins{"centPoolBins", {VARIABLE_WIDTH, 0., 10., 20., 30., 40., 50., 60., 70., 80., 90., 100}, "Event centrality pools"}; + ConfigurableAxis binsInvMass{"binsInvMass", {300, 1.6, 2.2}, "Invariant mass bins"}; ConfigurableAxis binsMultFT0M{"binsMultFT0M", {100, 0., 10000.}, "Multiplicity as FT0M signal amplitude"}; ConfigurableAxis binsCent{"binsCent", {100, 0., 100.}, "Centrality bins"}; ConfigurableAxis binsPosZ{"binsPosZ", {100, -10., 10.}, "Primary vertex z coordinate"}; @@ -88,33 +139,40 @@ struct HfCorrelatorFlowCharmHadronsReduced { ConfigurableAxis binsPhi{"binsPhi", {64, -o2::constants::math::PIHalf, 3. * o2::constants::math::PIHalf}, "Phi bins"}; ConfigurableAxis binsDeltaEta{"binsDeltaEta", {100, -2., 2.}, "Delta Eta bins"}; ConfigurableAxis binsDeltaPhi{"binsDeltaPhi", {64, -3., 3.}, "Delta Phi bins"}; - ConfigurableAxis binsPoolBin{"binsPoolBin", {9, 0., 9.}, "PoolBin"}; - ConfigurableAxis binsMlOne{"binsMlOne", {100, 0., 1.}, ""}; - ConfigurableAxis binsMlTwo{"binsMlTwo", {100, 0., 1.}, ""}; + ConfigurableAxis binsMlOne{"binsMlOne", {100, 0., 1.}, "ML score index 1 bins"}; + ConfigurableAxis binsMlTwo{"binsMlTwo", {100, 0., 1.}, "ML score index 2 bins"}; HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; + BinningMultPosZ binPolicyPosZMult{{zPoolBins, multPoolBins}, true}; + BinningCentPosZ binPolicyPosZCent{{zPoolBins, centPoolBins}, true}; + void init(InitContext&) { - std::array doprocess{doprocessSameEventCharmHadWCentMix, doprocessSameEventCharmHadWMultMix, doprocessMixedEventCharmHadWCentMix, doprocessMixedEventCharmHadWMultMix, - doprocessSameEventHadHadWCentMix, doprocessSameEventHadHadWMultMix, doprocessMixedEventHadHadWCentMix, doprocessMixedEventHadHadWMultMix}; - if ((std::accumulate(doprocess.begin(), doprocess.end(), 0)) > 1) { - LOGP(fatal, "Only one process function should be enabled! Please check your configuration!"); - if (!((doprocessSameEventCharmHadWCentMix && doprocessMixedEventCharmHadWCentMix) || (doprocessSameEventCharmHadWMultMix && doprocessMixedEventCharmHadWMultMix))) { - LOG(fatal) << "Different binning policies between Same Event and Mixed Event"; - } - if (!((doprocessSameEventHadHadWCentMix && doprocessMixedEventHadHadWCentMix) || (doprocessSameEventHadHadWMultMix && doprocessMixedEventHadHadWMultMix))) { - LOG(fatal) << "Different binning policies between Same Event and Mixed Event"; - } + if ((doprocessSameEventCharmHadWCentMix && doprocessMixedEventCharmHadWMultMix) || + (doprocessSameEventCharmHadWMultMix && doprocessMixedEventCharmHadWCentMix) || + (doprocessSameEventHadHadWCentMix && doprocessMixedEventHadHadWMultMix) || + (doprocessSameEventHadHadWMultMix && doprocessMixedEventHadHadWCentMix)) { + LOGP(fatal, "You cannot mix centrality and multiplicity mixing in the same processing! Please check your configuration!"); + } + if (!fillSparses && !fillTables) { + LOGP(fatal, "At least one of fillSparses or fillTables must be true!"); + } + if (binsPtTrig.value.size() != (bkgScoresPtMaxs.value.size() + 1)) { + LOGP(fatal, "The size of binsPtTrig must be the one of bkgScorePtMaxs plus one!"); + } + + if (doprocessSameEventCharmHadWCentMix || doprocessSameEventHadHadWCentMix || doprocessMixedEventCharmHadWCentMix || doprocessMixedEventHadHadWCentMix) { + poolBins = (centPoolBins->size() - 1) * (zPoolBins->size() - 1); + } else { + poolBins = (multPoolBins->size() - 1) * (zPoolBins->size() - 1); } const AxisSpec axisInvMass{binsInvMass, "Inv. mass (GeV/#it{c}^{2})"}; const AxisSpec axisCent = {binsCent, "Centrality"}; const AxisSpec axisMultFT0M = {binsMultFT0M, "MultiplicityFT0M"}; const AxisSpec axisPosZ = {binsPosZ, "PosZ"}; - const AxisSpec axisPoolBin = {binsPoolBin, "PoolBin"}; - const AxisSpec axisEta = {binsEta, "#it{#eta}"}; - const AxisSpec axisPhi = {binsPhi, "#it{#varphi}"}; + const AxisSpec axisPoolBin = {poolBins, 0., static_cast(poolBins), "PoolBin"}; const AxisSpec axisDeltaEta = {binsDeltaEta, "#Delta#it{#eta}"}; const AxisSpec axisDeltaPhi = {binsDeltaPhi, "#Delta#it{#varphi}"}; const AxisSpec axisPtTrig = {(std::vector)binsPtTrig, "#it{p}_{T} Trig (GeV/#it{c})"}; @@ -123,28 +181,29 @@ struct HfCorrelatorFlowCharmHadronsReduced { const AxisSpec axisMlTwo{binsMlTwo, "bdtScore1"}; // Histograms for data analysis - if (doprocessSameEventCharmHadWCentMix || doprocessMixedEventCharmHadWCentMix || doprocessSameEventHadHadWCentMix || doprocessMixedEventHadHadWCentMix) { - registry.add("hCent", "Centrality", {HistType::kTH2F, {{axisCent}, {axisPoolBin}}}); - } else { - registry.add("hMultFT0M", "Multiplicity FT0M", {HistType::kTH2F, {{axisMultFT0M}, {axisPoolBin}}}); + if (doprocessSameEventCharmHadWCentMix || doprocessSameEventHadHadWCentMix) { + registry.add("hCentPoolBinSE", "Centrality SE", {HistType::kTH2F, {{axisCent}, {axisPoolBin}}}); + } else if (doprocessSameEventCharmHadWMultMix || doprocessSameEventHadHadWMultMix) { + registry.add("hMultFT0MPoolBinSE", "Multiplicity FT0M SE", {HistType::kTH2F, {{axisMultFT0M}, {axisPoolBin}}}); + } else if (doprocessMixedEventCharmHadWCentMix || doprocessMixedEventHadHadWCentMix) { + registry.add("hCentPoolBinME", "Centrality ME", {HistType::kTH2F, {{axisCent}, {axisPoolBin}}}); + } else if (doprocessMixedEventCharmHadWMultMix || doprocessMixedEventHadHadWMultMix) { + registry.add("hMultFT0MPoolBinME", "Multiplicity FT0M ME", {HistType::kTH2F, {{axisMultFT0M}, {axisPoolBin}}}); } - registry.add("hZVtx", "z vertex", {HistType::kTH2F, {{axisPosZ}, {axisPoolBin}}}); - registry.add("hCollisionPoolBin", "Collision pool bin", {HistType::kTH1F, {axisPoolBin}}); - registry.add("hPoolBinTrig", "Trigger candidates pool bin", {HistType::kTH1F, {axisPoolBin}}); - registry.add("hPhiVsPtTrig", "Trigger candidates phiVsPt", {HistType::kTH2F, {{axisPhi}, {axisPtTrig}}}); - registry.add("hEtaVsPtTrig", "Trigger candidates etaVsPt", {HistType::kTH2F, {{axisEta}, {axisPtTrig}}}); - registry.add("hPoolBinAssoc", "Associated particles pool bin", {HistType::kTH1F, {axisPoolBin}}); - registry.add("hPhiVsPtAssoc", "Associated particles phiVsPt", {HistType::kTH3F, {{axisPhi}, {axisPtTrig}, {axisPtAssoc}}}); - registry.add("hEtaVsPtAssoc", "Associated particles etaVsPt", {HistType::kTH3F, {{axisEta}, {axisPtTrig}, {axisPtAssoc}}}); - + registry.add("hZVtxPoolBinSE", "z vertex SE", {HistType::kTH2F, {{axisPosZ}, {axisPoolBin}}}); + registry.add("hZVtxPoolBinME", "z vertex ME", {HistType::kTH2F, {{axisPosZ}, {axisPoolBin}}}); + registry.add("hPoolBinTrigSE", "Trigger candidates pool bin SE", {HistType::kTH1F, {axisPoolBin}}); + registry.add("hPoolBinTrigME", "Trigger candidates pool bin ME", {HistType::kTH1F, {axisPoolBin}}); + registry.add("hPoolBinAssocSE", "Associated particles pool bin SE", {HistType::kTH1F, {axisPoolBin}}); + registry.add("hPoolBinAssocME", "Associated particles pool bin ME", {HistType::kTH1F, {axisPoolBin}}); if (fillSparses) { - std::vector axes = {axisPtTrig, axisPtAssoc, axisDeltaEta, axisDeltaPhi, axisPoolBin}; + std::vector axes = {axisPoolBin, axisPtTrig, axisPtAssoc, axisDeltaEta, axisDeltaPhi}; if (doprocessSameEventHadHadWCentMix || doprocessSameEventHadHadWMultMix) { registry.add("hSparseCorrelationsSEHadHad", "THn for SE Had-Had correlations", HistType::kTHnSparseF, axes); } else if (doprocessMixedEventHadHadWCentMix || doprocessMixedEventHadHadWMultMix) { registry.add("hSparseCorrelationsMEHadHad", "THn for ME Had-Had correlations", HistType::kTHnSparseF, axes); } else { - axes.insert(axes.end(), {axisMlOne, axisMlTwo, axisInvMass}); + axes.insert(axes.end(), {axisInvMass, axisMlOne, axisMlTwo}); if (doprocessSameEventCharmHadWCentMix || doprocessSameEventCharmHadWMultMix) { registry.add("hSparseCorrelationsSECharmHad", "THn for SE Charm-Had correlations", HistType::kTHnSparseF, axes); } else if (doprocessMixedEventCharmHadWCentMix || doprocessMixedEventCharmHadWMultMix) { @@ -154,312 +213,273 @@ struct HfCorrelatorFlowCharmHadronsReduced { } } - /// Get charm candidate or hadron track pT - /// \param track is the candidate - template - double getPt(const TTrack& track) - { - if constexpr (requires { track.ptAssocTrack(); }) { - return track.ptAssocTrack(); - } else { - return track.ptCand(); - } - } - - /// Get charm candidate or hadron track eta - /// \param track is the candidate - template - double getEta(const TTrack& track) - { - if constexpr (requires { track.etaAssocTrack(); }) { - return track.etaAssocTrack(); - } else { - return track.etaCand(); - } - } - - /// Get charm candidate or hadron track phi - /// \param track is the candidate - template - double getPhi(const TTrack& track) - { - if constexpr (requires { track.phiAssocTrack(); }) { - return track.phiAssocTrack(); - } else { - return track.phiCand(); - } - } - /// Get the binning pool associated to the collision /// \param collision is the collision - /// \param corrBinning is the binning policy for the correlation - template - int getPoolBin(const TColl& collision, const TBinningType& corrBinning) + /// \param binPolicy is the binning policy for the correlation + template + int getPoolBin(const TColl& collision, const TBinningType& binPolicy) { int poolBin{0}; - if constexpr (std::is_same_v) { - poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.centrality())); - if constexpr (fillHistos) { - registry.fill(HIST("hCent"), collision.centrality(), poolBin); - } - } else if constexpr (std::is_same_v) { - poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multiplicity())); - if constexpr (fillHistos) { - registry.fill(HIST("hMultFT0M"), collision.multiplicity(), poolBin); + if constexpr (std::is_same_v) { + poolBin = binPolicy.getBin(std::make_tuple(collision.posZ(), collision.centrality())); + if constexpr (isMixedEvent) { + registry.fill(HIST("hCentPoolBinME"), collision.centrality(), poolBin); + registry.fill(HIST("hZVtxPoolBinME"), collision.posZ(), poolBin); + } else { + registry.fill(HIST("hCentPoolBinSE"), collision.centrality(), poolBin); + registry.fill(HIST("hZVtxPoolBinSE"), collision.posZ(), poolBin); } - } - return poolBin; - } - - /// Reject daughter-track pairs and same-track pairs - /// \param cand is the trigger candidate - /// \param track is the associated track - template - bool rejSameEvtPair(const TTrigPart& cand, const TTrack& track) - { - if constexpr (requires { cand.originTrackId(); }) { - // Remove same track pairs for Had-Had correlations - return (cand.originTrackId() == track.originTrackId()); - } else { - // Remove pairs with 2- and 3-prong daughters (prong2Id returns -1 for 2-prongs) - return ((cand.prong0Id() == track.originTrackId()) || (cand.prong1Id() == track.originTrackId()) || (cand.prong2Id() == track.originTrackId())); - } - } - - /// Slice trigger candidates by collision - /// \param cands are the trigger candidates - /// \param collId is the collision index - template - auto sliceTrigCands(TTrigCands const& cands, const int collId) - { - if constexpr (std::is_same_v) { - return cands.sliceBy(tracksPerCol, collId); - } else { - return cands.sliceBy(candsPerCol, collId); - } - } - - /// Fill Charm-Hadron correlation table and sparse - /// \param trigCand is the trigger charm hadron candidate - /// \param assocTrack is the associated hadron track - /// \param poolBin is the pool bin of the collision - template - void fillCharmHadInfo(TTrigCand const& trigCand, - TTrack const& assocTrack, - const int poolBin) - { - double deltaEta = getEta(assocTrack) - getEta(trigCand); - double deltaPhi = RecoDecay::constrainAngle(getPhi(assocTrack) - getPhi(trigCand), -o2::constants::math::PIHalf); - if (fillTables) { - entryCharmHadPair(trigCand.globalIndex(), assocTrack.globalIndex(), deltaEta, deltaPhi, poolBin); - } - if (fillSparses) { + } else if constexpr (std::is_same_v) { + poolBin = binPolicy.getBin(std::make_tuple(collision.posZ(), collision.multiplicity())); if constexpr (isMixedEvent) { - registry.fill(HIST("hSparseCorrelationsMECharmHad"), getPt(trigCand), getPt(assocTrack), - deltaEta, deltaPhi, poolBin, trigCand.bdtScore0(), - trigCand.bdtScore1(), trigCand.invMassCand()); + registry.fill(HIST("hMultFT0MPoolBinME"), collision.multiplicity(), poolBin); + registry.fill(HIST("hZVtxPoolBinME"), collision.posZ(), poolBin); } else { - registry.fill(HIST("hSparseCorrelationsSECharmHad"), getPt(trigCand), getPt(assocTrack), - deltaEta, deltaPhi, poolBin, trigCand.bdtScore0(), - trigCand.bdtScore1(), trigCand.invMassCand()); + registry.fill(HIST("hMultFT0MPoolBinSE"), collision.multiplicity(), poolBin); + registry.fill(HIST("hZVtxPoolBinSE"), collision.posZ(), poolBin); } } + return poolBin; } - /// Fill Hadron-Hadron correlation table and sparse - /// \param trigCand is the trigger hadron candidate - /// \param assocTrack is the associated hadron track - /// \param poolBin is the pool bin of the collision - template - void fillHadHadInfo(TCand const& trigCand, - TCand const& assocTrack, - const int poolBin) + /// Apply pT-differential ML BDT bkg score cut + /// \param ptTrig is the pT of the charm candidate + template + bool isSelBdtBkgScoreCut(TCand const& cand, + double ptTrig) { - double deltaEta = getEta(assocTrack) - getEta(trigCand); - double deltaPhi = RecoDecay::constrainAngle(getPhi(assocTrack) - getPhi(trigCand), -o2::constants::math::PIHalf); - if (fillTables) { - entryHadHadPair(trigCand.globalIndex(), assocTrack.globalIndex(), deltaEta, deltaPhi, poolBin); - } - if (fillSparses) { - if constexpr (isMixedEvent) { - registry.fill(HIST("hSparseCorrelationsMEHadHad"), getPt(trigCand), getPt(assocTrack), deltaEta, deltaPhi, poolBin); - } else { - registry.fill(HIST("hSparseCorrelationsSEHadHad"), getPt(trigCand), getPt(assocTrack), deltaEta, deltaPhi, poolBin); + for (size_t iPt = 0; iPt < binsPtTrig.value.size() - 1; iPt++) { + if (ptTrig >= binsPtTrig.value[iPt] && ptTrig < binsPtTrig.value[iPt + 1]) { + return cand.bdtScore0Trig() < bkgScoresPtMaxs.value[iPt]; } } + return false; } /// Save info for Same Event pairs /// \param collisions are the selected collisions /// \param trigCands are the selected trigger candidates /// \param assocTracks are the selected associated tracks - /// \param corrBinning is the binning policy for the correlation - template - void fillSameEvent(aod::HfcRedFlowColls const& collisions, - TTrigCands const& trigCands, - TAssocTracks const& assocTracks, - TBinningType corrBinning) + /// \param binPolicy is the binning policy for the correlation + template + void fillSameEvent(TPair const& pair, + TBinningType binPolicy) { - for (const auto& collision : collisions) { - int poolBin = getPoolBin(collision, corrBinning); - registry.fill(HIST("hCollisionPoolBin"), poolBin); - registry.fill(HIST("hZVtx"), collision.posZ(), poolBin); - - auto thisCollId = collision.globalIndex(); - auto trigCandsThisColl = sliceTrigCands(trigCands, thisCollId); - auto assocTracksThisColl = assocTracks.sliceBy(tracksPerCol, thisCollId); - - for (const auto& trigCand : trigCandsThisColl) { - registry.fill(HIST("hPoolBinTrig"), poolBin); - registry.fill(HIST("hPhiVsPtTrig"), RecoDecay::constrainAngle(getPhi(trigCand), -o2::constants::math::PIHalf), getPt(trigCand)); - registry.fill(HIST("hEtaVsPtTrig"), getEta(trigCand), getPt(trigCand)); - for (const auto& assocTrack : assocTracksThisColl) { - if (rejSameEvtPair(trigCand, assocTrack)) { - continue; - } - double deltaEta = getEta(assocTrack) - getEta(trigCand); - if (std::abs(deltaEta) < deltaEtaAbsMin || std::abs(deltaEta) > deltaEtaAbsMax) { - continue; - } - registry.fill(HIST("hPoolBinAssoc"), poolBin); - registry.fill(HIST("hPhiVsPtAssoc"), RecoDecay::constrainAngle(getPhi(assocTrack), -o2::constants::math::PIHalf), getPt(trigCand), getPt(assocTrack)); - registry.fill(HIST("hEtaVsPtAssoc"), getEta(assocTrack), getPt(trigCand), getPt(assocTrack)); - - if constexpr (std::is_same_v) { - fillHadHadInfo(trigCand, assocTrack, poolBin); - } else { - fillCharmHadInfo(trigCand, assocTrack, poolBin); - } - } + auto collision = pair.template hfcRedCorrColl_as(); + double ptTrig = pair.ptTrig(); + if constexpr (requires { pair.bdtScore0Trig(); }) { // ML selection on bkg score for Charm-Had case + if (!isSelBdtBkgScoreCut(pair, ptTrig)) { + return; + } + } + if (downSamplePairs < 1.) { + float pseudoRndm = ptTrig * 1000. - static_cast(ptTrig * 1000); + if (ptTrig < ptMaxForDownSample && collision.centrality() < centMaxForDownSample && pseudoRndm >= downSamplePairs) { + return; + } + } + int poolBin = getPoolBin(collision, binPolicy); + registry.fill(HIST("hPoolBinTrigSE"), poolBin); + registry.fill(HIST("hPoolBinAssocSE"), poolBin); + if constexpr (fillTables) { + if constexpr (requires { pair.bdtScore0Trig(); }) { // Separate Charm-Had and Had-Had cases + rowPairSECharmHads(poolBin, ptTrig, pair.ptAssoc(), pair.deltaEta(), pair.deltaPhi(), + pair.invMassTrig(), pair.bdtScore0Trig(), pair.bdtScore1Trig(), + pair.nTpcCrossedRowsAssoc(), pair.itsClsMapAssoc(), pair.itsNClsAssoc(), pair.dcaXYAssoc(), pair.dcaZAssoc()); + } else { + rowPairSEHadHads(poolBin, ptTrig, pair.ptAssoc(), pair.deltaEta(), pair.deltaPhi(), + pair.nTpcCrossedRowsTrig(), pair.itsClsMapTrig(), pair.itsNClsTrig(), pair.dcaXYTrig(), pair.dcaZTrig(), + pair.nTpcCrossedRowsAssoc(), pair.itsClsMapAssoc(), pair.itsNClsAssoc(), pair.dcaXYAssoc(), pair.dcaZAssoc()); + } + rowCollInfos(collision.multiplicity(), collision.numPvContrib(), collision.centrality()); + } + if constexpr (fillSparses) { + if constexpr (requires { pair.bdtScore0Trig(); }) { // Separate Charm-Had and Had-Had cases + registry.fill(HIST("hSparseCorrelationsSECharmHad"), poolBin, ptTrig, pair.ptAssoc(), pair.deltaEta(), + pair.deltaPhi(), pair.invMassTrig(), pair.bdtScore0Trig(), pair.bdtScore1Trig()); + } else { + registry.fill(HIST("hSparseCorrelationsSEHadHad"), poolBin, ptTrig, pair.ptAssoc(), pair.deltaEta(), pair.deltaPhi()); } } } /// Save info for Mixed Event pairs /// \param collisions are the selected collisions - /// \param trigCands are the selected trigger candidates - /// \param assocTracks are the selected associated tracks - /// \param corrBinning is the binning policy for the correlation - template - void fillMixedEvent(aod::HfcRedFlowColls const& collisions, - TTrigCands const& trigCands, - TAssocTracks const& assocTracks, - TBinningType corrBinning) + /// \param pairs are the mixed event pairs of trigger candidates and associated tracks + /// \param binPolicy is the binning policy for the correlation + template + void fillMixedEvent(TPairs const& pairs, + TBinningType binPolicy) { - for (const auto& collision : collisions) { - int poolBin = getPoolBin(collision, corrBinning); - registry.fill(HIST("hCollisionPoolBin"), poolBin); - registry.fill(HIST("hZVtx"), collision.posZ(), poolBin); - - auto thisCollId = collision.globalIndex(); - auto trigCandsThisColl = sliceTrigCands(trigCands, thisCollId); - auto assocTracksThisColl = assocTracks.sliceBy(tracksPerCol, thisCollId); - for (const auto& trigCand : trigCandsThisColl) { - registry.fill(HIST("hPoolBinTrig"), poolBin); - registry.fill(HIST("hPhiVsPtTrig"), RecoDecay::constrainAngle(getPhi(trigCand), -o2::constants::math::PIHalf), getPt(trigCand)); - registry.fill(HIST("hEtaVsPtTrig"), getEta(trigCand), getPt(trigCand)); - for (const auto& assocTrack : assocTracksThisColl) { - registry.fill(HIST("hPoolBinAssoc"), poolBin); - registry.fill(HIST("hPhiVsPtAssoc"), RecoDecay::constrainAngle(getPhi(assocTrack), -o2::constants::math::PIHalf), getPt(trigCand), getPt(assocTrack)); - registry.fill(HIST("hEtaVsPtAssoc"), getEta(assocTrack), getPt(trigCand), getPt(assocTrack)); - } - } - } - - auto pairsTuple = std::make_tuple(trigCands, assocTracks); - Pair pairData{corrBinning, numberEventsMixed, -1, collisions, pairsTuple, &cache}; - - for (const auto& [trigColl, trigCands, assocColl, assocTracks] : pairData) { + for (const auto& [trigColl, trigCands, assocColl, assocTracks] : pairs) { if (trigCands.size() == 0 || assocTracks.size() == 0) { continue; } - int poolBinCharm = getPoolBin(trigColl, corrBinning); - int poolBinAssoc = getPoolBin(assocColl, corrBinning); - if (poolBinAssoc != poolBinCharm) { + int poolBinTrig = getPoolBin(trigColl, binPolicy); + int poolBinAssoc = getPoolBin(assocColl, binPolicy); + if (poolBinAssoc != poolBinTrig) { LOGF(info, "Error, poolBins are different"); continue; } + registry.fill(HIST("hPoolBinTrigME"), poolBinTrig); + registry.fill(HIST("hPoolBinAssocME"), poolBinAssoc); for (const auto& [trigCand, assocTrack] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(trigCands, assocTracks))) { + // LOGF(info, "Mixed event tracks pair: (%d, %d) from events (%d, %d), track event: (%d, %d)", trigCand.index(), assocTrack.index(), trigColl.index(), assocColl.index(), trigCand.hfcRedFlowCollId(), assocTrack.hfcRedFlowCollId()); double deltaEta = getEta(assocTrack) - getEta(trigCand); if (std::abs(deltaEta) < deltaEtaAbsMin || std::abs(deltaEta) > deltaEtaAbsMax) { continue; } - // LOGF(info, "Mixed event tracks pair: (%d, %d) from events (%d, %d), track event: (%d, %d)", trigCand.index(), assocTrack.index(), trigColl.index(), assocColl.index(), trigCand.hfcRedFlowCollId(), assocTrack.hfcRedFlowCollId()); - if constexpr (std::is_same_v) { - fillHadHadInfo(trigCand, assocTrack, poolBinCharm); - } else { - fillCharmHadInfo(trigCand, assocTrack, poolBinCharm); + double ptTrig = getPt(trigCand); + if constexpr (requires { trigCand.bdtScore0Trig(); }) { // ML selection on bkg score for Charm-Had case + if (!isSelBdtBkgScoreCut(trigCand, ptTrig)) { + continue; + } + } + double ptAssoc = getPt(assocTrack); + if (downSamplePairs < 1.) { + float pseudoRndm = ptAssoc * 1000. - static_cast(ptAssoc * 1000); + if (ptTrig < ptMaxForDownSample && trigColl.centrality() < centMaxForDownSample && + assocColl.centrality() < centMaxForDownSample && pseudoRndm >= downSamplePairs) { + continue; + } + } + double deltaPhi = RecoDecay::constrainAngle(getPhi(assocTrack) - getPhi(trigCand), -o2::constants::math::PIHalf); + if constexpr (fillTables) { + if constexpr (requires { trigCand.bdtScore0Trig(); }) { // Separate Charm-Had and Had-Had cases + rowPairMECharmHads(poolBinTrig, ptTrig, ptAssoc, deltaEta, deltaPhi, + trigCand.invMassTrig(), trigCand.bdtScore0Trig(), trigCand.bdtScore1Trig(), + assocTrack.nTpcCrossedRowsAssoc(), assocTrack.itsClsMapAssoc(), assocTrack.itsNClsAssoc(), assocTrack.dcaXYAssoc(), assocTrack.dcaZAssoc()); + } else { + rowPairMEHadHads(poolBinTrig, ptTrig, ptAssoc, deltaEta, deltaPhi, + trigCand.nTpcCrossedRowsAssoc(), trigCand.itsClsMapAssoc(), trigCand.itsNClsAssoc(), trigCand.dcaXYAssoc(), trigCand.dcaZAssoc(), + assocTrack.nTpcCrossedRowsAssoc(), assocTrack.itsClsMapAssoc(), assocTrack.itsNClsAssoc(), assocTrack.dcaXYAssoc(), assocTrack.dcaZAssoc()); + } + rowCollInfos(trigColl.multiplicity(), trigColl.numPvContrib(), trigColl.centrality()); + } + if constexpr (fillSparses) { + if constexpr (requires { trigCand.bdtScore0Trig(); }) { // Separate Charm-Had and Had-Had cases + registry.fill(HIST("hSparseCorrelationsMECharmHad"), poolBinTrig, ptTrig, ptAssoc, deltaEta, + deltaPhi, trigCand.invMassTrig(), trigCand.bdtScore0Trig(), trigCand.bdtScore1Trig()); + } else { + registry.fill(HIST("hSparseCorrelationsMEHadHad"), poolBinTrig, ptTrig, ptAssoc, deltaEta, deltaPhi); + } } } } } - void processSameEventCharmHadWCentMix(aod::HfcRedFlowColls const& collisions, - soa::Join const& candidates, - AssocTracks const& tracks) + void processSameEventCharmHadWMultMix(SameEvtPairsChHad::iterator const& pair, + aod::HfcRedCorrColls const&) { - ColumnBinningPolicy corrBinningCent{{zPoolBins, centPoolBins}, true}; - fillSameEvent(collisions, candidates, tracks, corrBinningCent); + if (fillSparses && fillTables) { + fillSameEvent(pair, binPolicyPosZMult); + } else if (fillSparses) { + fillSameEvent(pair, binPolicyPosZMult); + } else if (fillTables) { + fillSameEvent(pair, binPolicyPosZMult); + } } - PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processSameEventCharmHadWCentMix, "Process Same Event for Charm-Had with centrality pools", true); + PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processSameEventCharmHadWMultMix, "Process Same Event for Charm-Had with multiplicity pools", true); - void processSameEventCharmHadWMultMix(aod::HfcRedFlowColls const& collisions, - soa::Join const& candidates, - AssocTracks const& tracks) + void processSameEventHadHadWMultMix(SameEvtPairsHadHad::iterator const& pair, + aod::HfcRedCorrColls const&) { - ColumnBinningPolicy corrBinningMult{{zPoolBins, multPoolBins}, true}; - fillSameEvent(collisions, candidates, tracks, corrBinningMult); + if (fillSparses && fillTables) { + fillSameEvent(pair, binPolicyPosZMult); + } else if (fillSparses) { + fillSameEvent(pair, binPolicyPosZMult); + } else if (fillTables) { + fillSameEvent(pair, binPolicyPosZMult); + } } - PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processSameEventCharmHadWMultMix, "Process Same Event for Charm-Had with multiplicity pools", false); + PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processSameEventHadHadWMultMix, "Process Same Event for Had-Had with multiplicity pools", false); - void processMixedEventCharmHadWCentMix(aod::HfcRedFlowColls const& collisions, - soa::Join const& candidates, - AssocTracks const& tracks) + void processSameEventCharmHadWCentMix(SameEvtPairsChHad::iterator const& pair, + aod::HfcRedCorrColls const&) { - ColumnBinningPolicy corrBinningCent{{zPoolBins, centPoolBins}, true}; - fillMixedEvent(collisions, candidates, tracks, corrBinningCent); + if (fillSparses && fillTables) { + fillSameEvent(pair, binPolicyPosZCent); + } else if (fillSparses) { + fillSameEvent(pair, binPolicyPosZCent); + } else if (fillTables) { + fillSameEvent(pair, binPolicyPosZCent); + } } - PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processMixedEventCharmHadWCentMix, "Process Mixed Event for Charm-Had with centrality pools", false); + PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processSameEventCharmHadWCentMix, "Process Same Event for Charm-Had with centrality pools", true); - void processMixedEventCharmHadWMultMix(aod::HfcRedFlowColls const& collisions, - soa::Join const& candidates, - AssocTracks const& tracks) + void processSameEventHadHadWCentMix(SameEvtPairsHadHad::iterator const& pair, + aod::HfcRedCorrColls const&) { - ColumnBinningPolicy corrBinningMult{{zPoolBins, multPoolBins}, true}; - fillMixedEvent(collisions, candidates, tracks, corrBinningMult); + if (fillSparses && fillTables) { + fillSameEvent(pair, binPolicyPosZCent); + } else if (fillSparses) { + fillSameEvent(pair, binPolicyPosZCent); + } else if (fillTables) { + fillSameEvent(pair, binPolicyPosZCent); + } } - PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processMixedEventCharmHadWMultMix, "Process Mixed Event for Charm-Had with multiplicity pools", false); + PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processSameEventHadHadWCentMix, "Process Same Event for Had-Had with centrality pools", false); - void processSameEventHadHadWCentMix(aod::HfcRedFlowColls const& collisions, - AssocTracks const& tracks) + void processMixedEventCharmHadWCentMix(aod::HfcRedCorrColls const& collisions, + TrigCharmCands const& candidates, + AssocTracks const& tracks) { - ColumnBinningPolicy corrBinningCent{{zPoolBins, centPoolBins}, true}; - fillSameEvent(collisions, tracks, tracks, corrBinningCent); + auto pairsTuple = std::make_tuple(candidates, tracks); + Pair pairs{binPolicyPosZCent, numberEventsMixed, -1, collisions, pairsTuple, &cache}; + if (fillSparses && fillTables) { + fillMixedEvent(pairs, binPolicyPosZCent); + } else if (fillSparses) { + fillMixedEvent(pairs, binPolicyPosZCent); + } else if (fillTables) { + fillMixedEvent(pairs, binPolicyPosZCent); + } } - PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processSameEventHadHadWCentMix, "Process Same Event for Had-Had with centrality pools", false); + PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processMixedEventCharmHadWCentMix, "Process Mixed Event for Charm-Had with centrality pools", false); - void processSameEventHadHadWMultMix(aod::HfcRedFlowColls const& collisions, - AssocTracks const& tracks) + void processMixedEventCharmHadWMultMix(aod::HfcRedCorrColls const& collisions, + TrigCharmCands const& candidates, + AssocTracks const& tracks) { - ColumnBinningPolicy corrBinningMult{{zPoolBins, multPoolBins}, true}; - fillSameEvent(collisions, tracks, tracks, corrBinningMult); + auto pairsTuple = std::make_tuple(candidates, tracks); + Pair pairs{binPolicyPosZMult, numberEventsMixed, -1, collisions, pairsTuple, &cache}; + if (fillSparses && fillTables) { + fillMixedEvent(pairs, binPolicyPosZMult); + } else if (fillSparses) { + fillMixedEvent(pairs, binPolicyPosZMult); + } else if (fillTables) { + fillMixedEvent(pairs, binPolicyPosZMult); + } } - PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processSameEventHadHadWMultMix, "Process Same Event for Had-Had with multiplicity pools", false); + PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processMixedEventCharmHadWMultMix, "Process Mixed Event for Charm-Had with multiplicity pools", false); - void processMixedEventHadHadWCentMix(aod::HfcRedFlowColls const& collisions, + void processMixedEventHadHadWCentMix(aod::HfcRedCorrColls const& collisions, AssocTracks const& tracks) { - ColumnBinningPolicy corrBinningCent{{zPoolBins, centPoolBins}, true}; - fillMixedEvent(collisions, tracks, tracks, corrBinningCent); + auto tracksTuple = std::make_tuple(tracks); + SameKindPair pairs{binPolicyPosZCent, numberEventsMixed, -1, collisions, tracksTuple, &cache}; + if (fillSparses && fillTables) { + fillMixedEvent(pairs, binPolicyPosZCent); + } else if (fillSparses) { + fillMixedEvent(pairs, binPolicyPosZCent); + } else if (fillTables) { + fillMixedEvent(pairs, binPolicyPosZCent); + } } PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processMixedEventHadHadWCentMix, "Process Mixed Event for Had-Had with centrality pools", false); - void processMixedEventHadHadWMultMix(aod::HfcRedFlowColls const& collisions, + void processMixedEventHadHadWMultMix(aod::HfcRedCorrColls const& collisions, AssocTracks const& tracks) { - ColumnBinningPolicy corrBinningMult{{zPoolBins, multPoolBins}, true}; - fillMixedEvent(collisions, tracks, tracks, corrBinningMult); + auto tracksTuple = std::make_tuple(tracks); + SameKindPair pairs{binPolicyPosZMult, numberEventsMixed, -1, collisions, tracksTuple, &cache}; + if (fillSparses && fillTables) { + fillMixedEvent(pairs, binPolicyPosZMult); + } else if (fillSparses) { + fillMixedEvent(pairs, binPolicyPosZMult); + } else if (fillTables) { + fillMixedEvent(pairs, binPolicyPosZMult); + } } PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processMixedEventHadHadWMultMix, "Process Mixed Event for Had-Had with multiplicity pools", false); }; diff --git a/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx b/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx index e5bb19f2e9e..e46a1d27bca 100644 --- a/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx +++ b/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx @@ -51,35 +51,49 @@ using namespace o2::framework::expressions; using namespace o2::hf_centrality; using namespace o2::hf_evsel; -enum DecayChannel { +enum CandType { DplusToPiKPi = 0, DsToKKPi, DsToPiKK, D0ToPiK, - D0ToKPi + D0ToKPi, + Hadron }; /// Code to select collisions with at least one Ds meson struct HfDerivedDataCreatorCorrelationsReduced { - Produces rowCollisions; - Produces rowCharmCandidates; - Produces rowCharmCandidatesMl; - Produces rowAssocTrackReduced; - Produces rowAssocTrackSelInfo; + Produces rowCollisions; // Table with reduced collision info + Produces rowSEPairs; // Table with same-event pairs info + Produces rowAssocBases; // Table with associated candidate base info + Produces rowAssocTrkSels; // Table with associated track selection info + Produces rowTrigBases; // Table with base trigger candidate info + Produces rowTrigCharms; // Table with charm trigger candidate selection info + Produces rowTrigHads; // Table with hadron trigger candidate selection info Configurable centEstimator{"centEstimator", 2, "Centrality estimation (FT0A: 1, FT0C: 2, FT0M: 3, FV0A: 4)"}; - Configurable selectionFlag{"selectionFlag", 1, "Selection Flag for hadron (e.g. 1 for skimming, 3 for topo. and kine., 7 for PID)"}; - Configurable forceCharmInCollision{"forceCharmInCollision", false, "Flag to force charm in collision"}; + Configurable selectionFlag{"selectionFlag", 15, "Selection Flag for hadron (ML score tables are required to run the task)"}; + Configurable forceCharmInCollision{"forceCharmInCollision", true, "Flag to force charm in collision"}; Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable> classMl{"classMl", {0, 2}, "Indexes of BDT scores to be stored. Two indexes max."}; Configurable yCandMax{"yCandMax", 0.8, "max. cand. rapidity"}; - Configurable ptCandMin{"ptCandMin", 1., "min. cand. pT"}; + Configurable ptCandMin{"ptCandMin", 0., "min. cand. pT"}; Configurable ptCandMax{"ptCandMax", 24., "max. cand. pT"}; - Configurable etaTrackMax{"etaTrackMax", 1., "max. track eta"}; - Configurable ptTrackMin{"ptTrackMin", 0.15, "min. track pT"}; - Configurable ptTrackMax{"ptTrackMax", 5., "max. track pT"}; - Configurable dcaXYTrackMax{"dcaXYTrackMax", 1., "max. track DCA XY"}; - Configurable dcaZTrackMax{"dcaZTrackMax", 1., "max. track DCA Z"}; + Configurable tpcNClsCrossedRowsMin{"tpcNClsCrossedRowsMin", 70, "min. TPC crossed rows for associated tracks"}; + Configurable etaTrkMax{"etaTrkMax", 1., "max. track eta"}; + Configurable ptTrkMin{"ptTrkMin", 0.2, "min. track pT"}; + Configurable ptTrkMax{"ptTrkMax", 3., "max. track pT"}; + Configurable dcaXYTrkMax{"dcaXYTrkMax", 1., "max. track DCA XY"}; + Configurable dcaZTrkMax{"dcaZTrkMax", 1., "max. track DCA Z"}; + Configurable usePtDiffDcaXYCut{"usePtDiffDcaXYCut", false, "Use pt-differential DCAxy cut for associated tracks"}; + Configurable dcaXYTrkNSigmaMax{"dcaXYTrkNSigmaMax", 7, "Cut on number of sigma deviations from expected DCA in the transverse direction"}; + Configurable dcaXYPtPrimTrkFunc{"dcaXYPtPrimTrkFunc", "(0.0026+0.005/(x^1.01))", "Functional form of pt-dependent DCAxy cut"}; + Configurable deltaEtaAbsMin{"deltaEtaAbsMin", 0.5, "min. pair delta eta"}; + Configurable deltaEtaAbsMax{"deltaEtaAbsMax", 2., "max. pair delta eta"}; + Configurable downSampleTrksFactor{"downSampleTrksFactor", 1., "Fraction of associated tracks to keep"}; + Configurable ptMaxForDownSample{"ptMaxForDownSample", 10., "Maximum pt for the application of the downsampling factor"}; + Configurable centMaxForDownSample{"centMaxForDownSample", 101., "Maximum centrality for the application of the downsampling factor"}; + Configurable> binsPtTrig{"binsPtTrig", std::vector{0., 1., 2., 3., 5., 8., 12., 24., 36.}, "pT bin limits for trigger candidates"}; + Configurable> binsPtAssoc{"binsPtAssoc", std::vector{0.2, 1., 2., 50.}, "pT bin limits for associated particles"}; HfHelper hfHelper; HfEventSelection hfEvSel; // event selection and monitoring @@ -87,38 +101,53 @@ struct HfDerivedDataCreatorCorrelationsReduced { SliceCache cache; double massCharm{0.}; + TF1* funcDcaXYPtCutPrimTrk = nullptr; using CollsWithCentMult = soa::Join; - using CandDsDataWMl = soa::Filtered>; - using CandDplusDataWMl = soa::Filtered>; - using CandD0DataWMl = soa::Filtered>; + using CandDsData = soa::Filtered>; + using CandDplusData = soa::Filtered>; + using CandD0Data = soa::Filtered>; using TracksData = soa::Filtered>; Filter filterSelectDsCandidates = aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlag || aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlag; Filter filterSelectDplusCandidates = aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= selectionFlag; Filter filterSelectD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlag || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlag; - Filter filterSelectTrackData = (nabs(aod::track::eta) < etaTrackMax) && (aod::track::pt > ptTrackMin) && (aod::track::pt < ptTrackMax) && (nabs(aod::track::dcaXY) < dcaXYTrackMax) && (nabs(aod::track::dcaZ) < dcaZTrackMax); + Filter filterSelectTrkData = (nabs(aod::track::eta) < etaTrkMax) && (aod::track::pt > ptTrkMin) && (aod::track::pt < ptTrkMax) && (nabs(aod::track::dcaXY) < dcaXYTrkMax) && (nabs(aod::track::dcaZ) < dcaZTrkMax); - Preslice candsDsPerCollWMl = aod::hf_cand::collisionId; - Preslice candsDplusPerCollWMl = aod::hf_cand::collisionId; - Preslice candsD0PerCollWMl = aod::hf_cand::collisionId; + Preslice candsDsPerColl = aod::hf_cand::collisionId; + Preslice candsDplusPerColl = aod::hf_cand::collisionId; + Preslice candsD0PerColl = aod::hf_cand::collisionId; Preslice trackIndicesPerColl = aod::track::collisionId; - Partition selectedDsToKKPiWMl = aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlag; - Partition selectedDsToPiKKWMl = aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlag; - Partition selectedD0ToPiKWMl = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlag; - Partition selectedD0ToKPiWMl = aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlag; + Partition selectedDsToKKPi = aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlag; + Partition selectedDsToPiKK = aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlag; + Partition selectedD0ToPiK = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlag; + Partition selectedD0ToKPi = aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlag; + + ConfigurableAxis binsInvMass{"binsInvMass", {300, 1.6, 2.2}, ""}; + ConfigurableAxis binsMultFT0M{"binsMultFT0M", {100, 0., 10000.}, "Multiplicity as FT0M signal amplitude"}; + ConfigurableAxis binsCent{"binsCent", {100, 0., 100.}, "Centrality bins"}; + ConfigurableAxis binsPosZ{"binsPosZ", {100, -10., 10.}, "Primary vertex z coordinate"}; + ConfigurableAxis binsEta{"binsEta", {50, -2., 2.}, "Eta bins"}; + ConfigurableAxis binsPhi{"binsPhi", {64, -o2::constants::math::PIHalf, 3. * o2::constants::math::PIHalf}, "Phi bins"}; + ConfigurableAxis binsDeltaEta{"binsDeltaEta", {100, -2., 2.}, "Delta Eta bins"}; + ConfigurableAxis binsDeltaPhi{"binsDeltaPhi", {64, -3., 3.}, "Delta Phi bins"}; + ConfigurableAxis binsMlOne{"binsMlOne", {100, 0., 1.}, ""}; + ConfigurableAxis binsMlTwo{"binsMlTwo", {100, 0., 1.}, ""}; + ConfigurableAxis binsDca{"binsDca", {200, -1., 1.}, ""}; HistogramRegistry registry{"registry", {}}; void init(InitContext&) { - if (doprocessDplusWithMl) { + if (doprocessDplusSameEvent || doprocessDplusMixedEvent) { massCharm = o2::constants::physics::MassDPlus; - } else if (doprocessDsWithMl) { + } else if (doprocessDsSameEvent || doprocessDsMixedEvent) { massCharm = o2::constants::physics::MassDS; - } else if (doprocessD0WithMl) { + } else if (doprocessD0SameEvent || doprocessD0MixedEvent) { massCharm = o2::constants::physics::MassD0; + } else if (doprocessHadronHadronSameEvent || doprocessHadronHadronMixedEvent) { + LOG(info) << "Charm mass not set, processing Hadron-Hadron case"; } else { LOG(fatal) << "No decay channel selected to process"; } @@ -127,58 +156,53 @@ struct HfDerivedDataCreatorCorrelationsReduced { ccdb->setURL(ccdbUrl); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); - }; // end init - /// Check event selections for collision and fill the collision table - /// \param collision is the collision - template - bool checkAndFillCollision(Coll const& collision) - { - float cent{-1.f}; - float mult{-1.f}; - o2::hf_evsel::HfCollisionRejectionMask collRejMask{}; - if (centEstimator == CentralityEstimator::FT0A) { - collRejMask = hfEvSel.getHfCollisionRejectionMask(collision, cent, ccdb, registry); - mult = collision.multFT0A(); - } else if (centEstimator == CentralityEstimator::FT0C) { - collRejMask = hfEvSel.getHfCollisionRejectionMask(collision, cent, ccdb, registry); - mult = collision.multFT0C(); - } else if (centEstimator == CentralityEstimator::FT0M) { - collRejMask = hfEvSel.getHfCollisionRejectionMask(collision, cent, ccdb, registry); - mult = collision.multFT0M(); - } else if (centEstimator == CentralityEstimator::FV0A) { - collRejMask = hfEvSel.getHfCollisionRejectionMask(collision, cent, ccdb, registry); - mult = collision.multFV0A(); - } else { - LOG(fatal) << "Centrality estimator not recognized for collision selection"; - std::abort(); - } - hfEvSel.fillHistograms(collision, collRejMask, cent); - if (collRejMask != 0) { - return false; + const AxisSpec axisCent = {binsCent, "Centrality"}; + const AxisSpec axisMultFT0M = {binsMultFT0M, "MultiplicityFT0M"}; + const AxisSpec axisPosZ = {binsPosZ, "PosZ"}; + const AxisSpec axisEta = {binsEta, "#it{#eta}"}; + const AxisSpec axisPhi = {binsPhi, "#it{#varphi}"}; + const AxisSpec axisPtTrig = {(std::vector)binsPtTrig, "#it{p}_{T} Trig (GeV/#it{c})"}; + const AxisSpec axisPtAssoc = {(std::vector)binsPtAssoc, "#it{p}_{T} Assoc (GeV/#it{c})"}; + const AxisSpec axisDcaXY = {binsDca, "DCA XY (cm)"}; + const AxisSpec axisDcaZ = {binsDca, "DCA Z (cm)"}; + + // Histograms for data analysis + registry.add("hPhiVsPtTrig", "Trigger candidates phiVsPt", {HistType::kTH2F, {{axisPhi}, {axisPtTrig}}}); + registry.add("hEtaVsPtTrig", "Trigger candidates etaVsPt", {HistType::kTH2F, {{axisEta}, {axisPtTrig}}}); + registry.add("hPhiVsPtTrigAssoc", "Associated particles phiVsPt", {HistType::kTH3F, {{axisPhi}, {axisPtTrig}, {axisPtAssoc}}}); + registry.add("hEtaVsPtTrigAssoc", "Associated particles etaVsPt", {HistType::kTH3F, {{axisEta}, {axisPtTrig}, {axisPtAssoc}}}); + registry.add("hPhiVsPtAssoc", "Associated particles phiVsPt", {HistType::kTH2F, {{axisPhi}, {axisPtAssoc}}}); + registry.add("hEtaVsPtAssoc", "Associated particles etaVsPt", {HistType::kTH2F, {{axisEta}, {axisPtAssoc}}}); + registry.add("hDcaXYVsPtAssoc", "Associated particles DCAxyVsPt", {HistType::kTH2F, {{axisDcaXY}, {axisPtAssoc}}}); + registry.add("hDcaZVsPtAssoc", "Associated particles DCAzVsPt", {HistType::kTH2F, {{axisDcaZ}, {axisPtAssoc}}}); + + // Setup pt-dependent DCAxy cut function + if (usePtDiffDcaXYCut) { + funcDcaXYPtCutPrimTrk = new TF1("funcDcaXYPtCutPrimTrk", Form("[0]*%s", dcaXYPtPrimTrkFunc.value.data()), 0.001, 100); + funcDcaXYPtCutPrimTrk->SetParameter(0, dcaXYTrkNSigmaMax); + LOGF(info, "DCAxy pt-dependence function: %s", Form("[0]*%s", dcaXYPtPrimTrkFunc.value.data())); } - rowCollisions(mult, collision.numContrib(), cent, collision.posZ()); - return true; - } + }; // end init /// Get charm hadron candidate mass /// \param candidate is the charm hadron candidate - template + template double getCandMass(const TCand& candidate) { - if constexpr (channel == DecayChannel::DsToKKPi) { + if constexpr (candType == CandType::DsToKKPi) { return hfHelper.invMassDsToKKPi(candidate); } - if constexpr (channel == DecayChannel::DsToPiKK) { + if constexpr (candType == CandType::DsToPiKK) { return hfHelper.invMassDsToPiKK(candidate); } - if constexpr (channel == DecayChannel::DplusToPiKPi) { + if constexpr (candType == CandType::DplusToPiKPi) { return hfHelper.invMassDplusToPiKPi(candidate); } - if constexpr (channel == DecayChannel::D0ToPiK) { + if constexpr (candType == CandType::D0ToPiK) { return hfHelper.invMassD0ToPiK(candidate); } - if constexpr (channel == DecayChannel::D0ToKPi) { + if constexpr (candType == CandType::D0ToKPi) { return hfHelper.invMassD0barToKPi(candidate); } return -1.; @@ -186,31 +210,31 @@ struct HfDerivedDataCreatorCorrelationsReduced { /// Get charm hadron bdt scores /// \param candidate is the charm hadron candidate - template - std::vector getCandMlScores(const TCand& candidate) + template + std::array getCandMlScores(const TCand& candidate) { - std::vector outputMl{-999., -999.}; - if constexpr (channel == DecayChannel::DsToKKPi) { + std::array outputMl{-999.f, -999.f}; + if constexpr (candType == CandType::DsToKKPi) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDsToKKPi()[classMl->at(iclass)]; } } - if constexpr (channel == DecayChannel::DsToPiKK) { + if constexpr (candType == CandType::DsToPiKK) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDsToPiKK()[classMl->at(iclass)]; } } - if constexpr (channel == DecayChannel::DplusToPiKPi) { + if constexpr (candType == CandType::DplusToPiKPi) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDplusToPiKPi()[classMl->at(iclass)]; } } - if constexpr (channel == DecayChannel::D0ToPiK) { + if constexpr (candType == CandType::D0ToPiK) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbD0()[classMl->at(iclass)]; } } - if constexpr (channel == DecayChannel::D0ToKPi) { + if constexpr (candType == CandType::D0ToKPi) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbD0bar()[classMl->at(iclass)]; } @@ -218,108 +242,315 @@ struct HfDerivedDataCreatorCorrelationsReduced { return outputMl; } - /// Fill charm hadron tables - /// \param candidates are the selected charm hadron candidates - template - void fillCharmHadronTables(TCand const& candidates) + /// Check event selections for collision and fill the collision table + /// \param collision is the collision + template + bool checkCollision(Coll const& collision, float& cent, float& mult) { - int indexRedColl = rowCollisions.lastIndex(); - for (const auto& candidate : candidates) { - if (std::abs(candidate.y(massCharm)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { - continue; + o2::hf_evsel::HfCollisionRejectionMask collRejMask{}; + if (centEstimator == CentralityEstimator::FT0A) { + collRejMask = hfEvSel.getHfCollisionRejectionMask(collision, cent, ccdb, registry); + mult = collision.multFT0A(); + } else if (centEstimator == CentralityEstimator::FT0C) { + collRejMask = hfEvSel.getHfCollisionRejectionMask(collision, cent, ccdb, registry); + mult = collision.multFT0C(); + } else if (centEstimator == CentralityEstimator::FT0M) { + collRejMask = hfEvSel.getHfCollisionRejectionMask(collision, cent, ccdb, registry); + mult = collision.multFT0M(); + } else if (centEstimator == CentralityEstimator::FV0A) { + collRejMask = hfEvSel.getHfCollisionRejectionMask(collision, cent, ccdb, registry); + mult = collision.multFV0A(); + } else { + LOG(fatal) << "Centrality estimator not recognized for collision selection"; + std::abort(); + } + hfEvSel.fillHistograms(collision, collRejMask, cent); + if (collRejMask != 0) { + return false; + } + return true; + } + + /// Checks if the trigger cand-associated track pair can be accepted for SE correlation + /// \param assTrk is the associated track + /// \param cand is the trigger candidate + template + bool acceptSameEvtPair(TAssocTrk const& assTrk, TCand const& cand, double deltaEta) + { + if (std::abs(deltaEta) <= deltaEtaAbsMin || std::abs(deltaEta) > deltaEtaAbsMax) { + return false; + } + + if (!assTrk.isGlobalTrackWoDCA() || assTrk.tpcNClsCrossedRows() < tpcNClsCrossedRowsMin) { + return false; + } + + int trackGlobalIndex = assTrk.globalIndex(); + if constexpr (candType == CandType::Hadron) { + if (!cand.isGlobalTrackWoDCA() || cand.tpcNClsCrossedRows() < tpcNClsCrossedRowsMin) { + return false; + } + if (trackGlobalIndex <= cand.globalIndex()) { + return false; // skip self-correlation and avoid pair duplication for hadron-hadron } - double massCand = getCandMass(candidate); - if constexpr (channel == DecayChannel::D0ToKPi || channel == DecayChannel::D0ToPiK) { - rowCharmCandidates(indexRedColl, candidate.phi(), candidate.eta(), candidate.pt(), massCand, candidate.prong0Id(), candidate.prong1Id(), -1); - } else { - rowCharmCandidates(indexRedColl, candidate.phi(), candidate.eta(), candidate.pt(), massCand, candidate.prong0Id(), candidate.prong1Id(), candidate.prong2Id()); + } else { // Remove Daughter-Cand pairs for charm-hadron correlations + if constexpr ((requires { cand.prong2Id(); })) { // Check 3-prong + if (trackGlobalIndex == cand.prong0Id() || trackGlobalIndex == cand.prong1Id() || trackGlobalIndex == cand.prong2Id()) { + return false; + } + } else { // Check 2-prong + if (trackGlobalIndex == cand.prong0Id() || trackGlobalIndex == cand.prong1Id()) { + return false; + } } - std::vector outputMl = getCandMlScores(candidate); - rowCharmCandidatesMl(indexRedColl, outputMl[0], outputMl[1]); } + return true; } - /// Fill tracks tables - /// \param tracks are the selected tracks - template - void fillTracksTables(TTrack const& tracks) + /// Fill histograms and tables for same-event correlations + /// \param trigCands are the trigger candidates + /// \param assTrks are the associated tracks + /// \param collCentrality is the collision centrality + template + void fillSameEvent(TTrigCands const& trigCands, + TAssocTrks const& assTrks, + const float collCentrality) { - int indexRedColl = rowCollisions.lastIndex(); - for (const auto& track : tracks) { - if (!track.isGlobalTrackWoDCA()) { - continue; + for (const auto& trigCand : trigCands) { + double trigCandPt = trigCand.pt(); + registry.fill(HIST("hPhiVsPtTrig"), RecoDecay::constrainAngle(trigCand.phi(), -o2::constants::math::PIHalf), trigCandPt); + registry.fill(HIST("hEtaVsPtTrig"), trigCand.eta(), trigCandPt); + for (const auto& assTrk : assTrks) { + double assTrkPt = assTrk.pt(); + if (usePtDiffDcaXYCut) { + float dcaXYTrkCut = funcDcaXYPtCutPrimTrk->Eval(assTrkPt); + if (std::fabs(assTrk.dcaXY()) > dcaXYTrkCut) { + continue; + } + } + + double deltaEta = assTrk.eta() - trigCand.eta(); + if (!acceptSameEvtPair(assTrk, trigCand, deltaEta)) { + continue; + } + if (downSampleTrksFactor < 1.) { + float pseudoRndm = assTrkPt * 1000. - static_cast(assTrkPt * 1000); + if (assTrkPt < ptMaxForDownSample && collCentrality < centMaxForDownSample && pseudoRndm >= downSampleTrksFactor) { + continue; + } + } + registry.fill(HIST("hPhiVsPtTrigAssoc"), RecoDecay::constrainAngle(assTrk.phi(), -o2::constants::math::PIHalf), trigCandPt, assTrkPt); + registry.fill(HIST("hEtaVsPtTrigAssoc"), assTrk.eta(), trigCandPt, assTrkPt); + registry.fill(HIST("hPhiVsPtAssoc"), RecoDecay::constrainAngle(assTrk.phi(), -o2::constants::math::PIHalf), assTrkPt); + registry.fill(HIST("hEtaVsPtAssoc"), assTrk.eta(), assTrkPt); + registry.fill(HIST("hDcaXYVsPtAssoc"), assTrk.dcaXY(), assTrkPt); + registry.fill(HIST("hDcaZVsPtAssoc"), assTrk.dcaZ(), assTrkPt); + + double deltaPhi = RecoDecay::constrainAngle(assTrk.phi() - trigCand.phi(), -o2::constants::math::PIHalf); + rowSEPairs(rowCollisions.lastIndex(), trigCandPt, assTrkPt, deltaEta, deltaPhi); + rowAssocTrkSels(assTrk.tpcNClsCrossedRows(), assTrk.itsClusterMap(), assTrk.itsNCls(), assTrk.dcaXY(), assTrk.dcaZ()); + if constexpr (candType == CandType::Hadron) { + rowTrigHads(trigCand.tpcNClsCrossedRows(), trigCand.itsClusterMap(), trigCand.itsNCls(), trigCand.dcaXY(), trigCand.dcaZ()); + } else { + std::array outputMl = getCandMlScores(trigCand); + rowTrigCharms(getCandMass(trigCand), outputMl[0], outputMl[1]); + } } - rowAssocTrackReduced(indexRedColl, track.globalIndex(), track.phi(), track.eta(), track.pt()); - rowAssocTrackSelInfo(indexRedColl, track.tpcNClsCrossedRows(), track.itsClusterMap(), track.itsNCls(), track.dcaXY(), track.dcaZ()); } } - // Dplus with ML selections - void processDplusWithMl(CollsWithCentMult const& colls, - CandDplusDataWMl const& candsDplus, - TracksData const& tracks) + /// Fill charm hadron tables for mixed-event + /// \param trigCands are the charm trigger candidates + template + void fillCharmMixedEvent(TTrigCands const& trigCands) + { + for (const auto& trigCand : trigCands) { + registry.fill(HIST("hPhiVsPtTrig"), RecoDecay::constrainAngle(trigCand.phi(), -o2::constants::math::PIHalf), trigCand.pt()); + registry.fill(HIST("hEtaVsPtTrig"), trigCand.eta(), trigCand.pt()); + + std::array outputMl = getCandMlScores(trigCand); + rowTrigBases(rowCollisions.lastIndex(), trigCand.phi(), trigCand.eta(), trigCand.pt()); + rowTrigCharms(getCandMass(trigCand), outputMl[0], outputMl[1]); + } + } + + /// Fill track tables for mixed-event + /// \param assTrks are the associated tracks + /// \param collCentrality is the collision centrality + template + void fillTrkMixedEvent(TAssocTrks const& assTrks, + const float collCentrality) { - for (const auto& coll : colls) { - auto thisCollId = coll.globalIndex(); - auto candsCThisColl = candsDplus.sliceBy(candsDplusPerCollWMl, thisCollId); - if (forceCharmInCollision && candsCThisColl.size() < 1) { + bool first = true; + for (const auto& assTrk : assTrks) { + if (!assTrk.isGlobalTrackWoDCA() || assTrk.tpcNClsCrossedRows() < tpcNClsCrossedRowsMin) { continue; } - if (!checkAndFillCollision(coll)) { - continue; + double assTrkPt = assTrk.pt(); + if (usePtDiffDcaXYCut) { + float dcaXYTrkCut = funcDcaXYPtCutPrimTrk->Eval(assTrkPt); + if (std::fabs(assTrk.dcaXY()) > dcaXYTrkCut) { + continue; + } } - auto trackIdsThisColl = tracks.sliceBy(trackIndicesPerColl, thisCollId); - fillCharmHadronTables(candsCThisColl); - fillTracksTables(trackIdsThisColl); + if (!first && downSampleTrksFactor < 1.) { // skip downsampling for the first track to avoid empty tables + float pseudoRndm = assTrkPt * 1000. - static_cast(assTrkPt * 1000); + if (assTrkPt < ptMaxForDownSample && collCentrality < centMaxForDownSample && pseudoRndm >= downSampleTrksFactor) { + continue; + } + } + first = false; + registry.fill(HIST("hPhiVsPtAssoc"), RecoDecay::constrainAngle(assTrk.phi(), -o2::constants::math::PIHalf), assTrkPt); + registry.fill(HIST("hEtaVsPtAssoc"), assTrk.eta(), assTrkPt); + registry.fill(HIST("hDcaXYVsPtAssoc"), assTrk.dcaXY(), assTrkPt); + registry.fill(HIST("hDcaZVsPtAssoc"), assTrk.dcaZ(), assTrkPt); + rowAssocBases(rowCollisions.lastIndex(), assTrk.phi(), assTrk.eta(), assTrkPt); + rowAssocTrkSels(assTrk.tpcNClsCrossedRows(), assTrk.itsClusterMap(), assTrk.itsNCls(), assTrk.dcaXY(), assTrk.dcaZ()); + } + } + + // Dplus with ML selections + void processDplusSameEvent(CollsWithCentMult::iterator const& coll, + CandDplusData const& candsDplus, + TracksData const& tracks) + { + if (forceCharmInCollision && candsDplus.size() < 1) { + return; + } + float cent{-1.}, mult{-1.}; + if (!checkCollision(coll, cent, mult)) { + return; + } + rowCollisions(mult, coll.numContrib(), cent, coll.posZ()); + fillSameEvent(candsDplus, tracks, cent); + } + PROCESS_SWITCH(HfDerivedDataCreatorCorrelationsReduced, processDplusSameEvent, "Process Same Event for Dplus candidates", true); + + // Dplus with ML selections + void processDplusMixedEvent(CollsWithCentMult::iterator const& coll, + CandDplusData const& candsDplus, + TracksData const& tracks) + { + if (forceCharmInCollision && candsDplus.size() < 1) { + return; + } + float cent{-1.}, mult{-1.}; + if (!checkCollision(coll, cent, mult)) { + return; } + rowCollisions(mult, coll.numContrib(), cent, coll.posZ()); + fillCharmMixedEvent(candsDplus); + fillTrkMixedEvent(tracks, cent); } - PROCESS_SWITCH(HfDerivedDataCreatorCorrelationsReduced, processDplusWithMl, "Process Dplus candidates with ML info", false); + PROCESS_SWITCH(HfDerivedDataCreatorCorrelationsReduced, processDplusMixedEvent, "Process Mixed Event for Dplus candidates", false); // Ds with ML selections - void processDsWithMl(CollsWithCentMult const& colls, - TracksData const& tracks, - CandDsDataWMl const&) + void processDsSameEvent(CollsWithCentMult::iterator const& coll, + TracksData const& tracks, + CandDsData const&) { - for (const auto& coll : colls) { - auto thisCollId = coll.globalIndex(); - auto candsDsToKKPiWMl = selectedDsToKKPiWMl->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); - auto candsDsToPiKKWMl = selectedDsToPiKKWMl->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); - if (forceCharmInCollision && candsDsToKKPiWMl.size() < 1 && candsDsToPiKKWMl.size() < 1) { - continue; - } - if (!checkAndFillCollision(coll)) { - continue; - } - auto trackIdsThisColl = tracks.sliceBy(trackIndicesPerColl, thisCollId); - fillCharmHadronTables(candsDsToPiKKWMl); - fillCharmHadronTables(candsDsToKKPiWMl); - fillTracksTables(trackIdsThisColl); + auto candsDsToPiKK = selectedDsToPiKK->sliceByCached(aod::hf_cand::collisionId, coll.globalIndex(), cache); + auto candsDsToKKPi = selectedDsToKKPi->sliceByCached(aod::hf_cand::collisionId, coll.globalIndex(), cache); + if (forceCharmInCollision && candsDsToPiKK.size() < 1 && candsDsToKKPi.size() < 1) { + return; } + float cent{-1.}, mult{-1.}; + if (!checkCollision(coll, cent, mult)) { + return; + } + rowCollisions(mult, coll.numContrib(), cent, coll.posZ()); + fillSameEvent(candsDsToPiKK, tracks, cent); + fillSameEvent(candsDsToKKPi, tracks, cent); } - PROCESS_SWITCH(HfDerivedDataCreatorCorrelationsReduced, processDsWithMl, "Process Ds candidates with ML info", false); + PROCESS_SWITCH(HfDerivedDataCreatorCorrelationsReduced, processDsSameEvent, "Process Same Event for Ds candidates", false); + + // Ds with ML selections + void processDsMixedEvent(CollsWithCentMult::iterator const& coll, + TracksData const& tracks, + CandDsData const&) + { + auto candsDsToPiKK = selectedDsToPiKK->sliceByCached(aod::hf_cand::collisionId, coll.globalIndex(), cache); + auto candsDsToKKPi = selectedDsToKKPi->sliceByCached(aod::hf_cand::collisionId, coll.globalIndex(), cache); + if (forceCharmInCollision && candsDsToPiKK.size() < 1 && candsDsToKKPi.size() < 1) { + return; + } + float cent{-1.}, mult{-1.}; + if (!checkCollision(coll, cent, mult)) { + return; + } + rowCollisions(mult, coll.numContrib(), cent, coll.posZ()); + fillCharmMixedEvent(candsDsToPiKK); + fillCharmMixedEvent(candsDsToKKPi); + fillTrkMixedEvent(tracks, cent); + } + PROCESS_SWITCH(HfDerivedDataCreatorCorrelationsReduced, processDsMixedEvent, "Process Mixed Event for Ds candidates", false); // D0 with ML selections - void processD0WithMl(CollsWithCentMult const& colls, - TracksData const& tracks, - CandD0DataWMl const&) + void processD0SameEvent(CollsWithCentMult::iterator const& coll, + TracksData const& tracks, + CandD0Data const&) { - for (const auto& coll : colls) { - auto thisCollId = coll.globalIndex(); - auto candsD0ToPiKWMl = selectedD0ToPiKWMl->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); - auto candsD0ToKPiWMl = selectedD0ToKPiWMl->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); - if (forceCharmInCollision && candsD0ToPiKWMl.size() < 1 && candsD0ToKPiWMl.size() < 1) { - continue; - } - if (!checkAndFillCollision(coll)) { - continue; - } - auto trackIdsThisColl = tracks.sliceBy(trackIndicesPerColl, thisCollId); - fillCharmHadronTables(candsD0ToPiKWMl); - fillCharmHadronTables(candsD0ToKPiWMl); - fillTracksTables(trackIdsThisColl); + auto candsD0ToPiK = selectedD0ToPiK->sliceByCached(aod::hf_cand::collisionId, coll.globalIndex(), cache); + auto candsD0ToKPi = selectedD0ToKPi->sliceByCached(aod::hf_cand::collisionId, coll.globalIndex(), cache); + if (forceCharmInCollision && candsD0ToPiK.size() < 1 && candsD0ToKPi.size() < 1) { + return; + } + float cent{-1.}, mult{-1.}; + if (!checkCollision(coll, cent, mult)) { + return; + } + rowCollisions(mult, coll.numContrib(), cent, coll.posZ()); + fillSameEvent(candsD0ToPiK, tracks, cent); + fillSameEvent(candsD0ToKPi, tracks, cent); + } + PROCESS_SWITCH(HfDerivedDataCreatorCorrelationsReduced, processD0SameEvent, "Process Same Event for D0 candidates", false); + + // D0 with ML selections + void processD0MixedEvent(CollsWithCentMult::iterator const& coll, + TracksData const& tracks, + CandD0Data const&) + { + auto candsD0ToPiK = selectedD0ToPiK->sliceByCached(aod::hf_cand::collisionId, coll.globalIndex(), cache); + auto candsD0ToKPi = selectedD0ToKPi->sliceByCached(aod::hf_cand::collisionId, coll.globalIndex(), cache); + if (forceCharmInCollision && candsD0ToPiK.size() < 1 && candsD0ToKPi.size() < 1) { + return; + } + float cent{-1.}, mult{-1.}; + if (!checkCollision(coll, cent, mult)) { + return; + } + rowCollisions(mult, coll.numContrib(), cent, coll.posZ()); + fillCharmMixedEvent(candsD0ToPiK); + fillCharmMixedEvent(candsD0ToKPi); + fillTrkMixedEvent(tracks, cent); + } + PROCESS_SWITCH(HfDerivedDataCreatorCorrelationsReduced, processD0MixedEvent, "Process Mixed Event for D0 candidates", false); + + // Hadron Hadron Same Event + void processHadronHadronSameEvent(CollsWithCentMult::iterator const& coll, + TracksData const& tracks) + { + float cent{-1.}, mult{-1.}; + if (!checkCollision(coll, cent, mult)) { + return; + } + rowCollisions(mult, coll.numContrib(), cent, coll.posZ()); + fillSameEvent(tracks, tracks, cent); + } + PROCESS_SWITCH(HfDerivedDataCreatorCorrelationsReduced, processHadronHadronSameEvent, "Process Same Event for hadron candidates", true); + + // Hadron Hadron Mixed Event + void processHadronHadronMixedEvent(CollsWithCentMult::iterator const& coll, + TracksData const& tracks) + { + float cent{-1.}, mult{-1.}; + if (!checkCollision(coll, cent, mult)) { + return; } + rowCollisions(mult, coll.numContrib(), cent, coll.posZ()); + fillTrkMixedEvent(tracks, cent); } - PROCESS_SWITCH(HfDerivedDataCreatorCorrelationsReduced, processD0WithMl, "Process D0 candidates with ML info", false); + PROCESS_SWITCH(HfDerivedDataCreatorCorrelationsReduced, processHadronHadronMixedEvent, "Process Mixed Event for hadron candidates", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 54c4a4b3ba594462b762c89691599a8e2a360f13 Mon Sep 17 00:00:00 2001 From: hfribert Date: Wed, 24 Sep 2025 21:53:56 +0200 Subject: [PATCH 526/986] [PWGCF] Add track-kink pair task (#13114) Co-authored-by: Henrik Fribert --- PWGCF/Femto/Core/closePairRejection.h | 46 +++++++ PWGCF/Femto/Core/femtoUtils.h | 3 + PWGCF/Femto/Core/kinkHistManager.h | 5 +- PWGCF/Femto/Core/pairBuilder.h | 102 +++++++++++++++ PWGCF/Femto/Core/pairCleaner.h | 12 ++ PWGCF/Femto/Core/pairHistManager.h | 3 + PWGCF/Femto/Tasks/CMakeLists.txt | 5 + PWGCF/Femto/Tasks/femtoPairTrackKink.cxx | 153 +++++++++++++++++++++++ 8 files changed, 326 insertions(+), 3 deletions(-) create mode 100644 PWGCF/Femto/Tasks/femtoPairTrackKink.cxx diff --git a/PWGCF/Femto/Core/closePairRejection.h b/PWGCF/Femto/Core/closePairRejection.h index 4a693b89267..84b60eefee9 100644 --- a/PWGCF/Femto/Core/closePairRejection.h +++ b/PWGCF/Femto/Core/closePairRejection.h @@ -65,6 +65,8 @@ constexpr char PrefixTrackTrackSe[] = "CPR_TrackTrack/SE/"; constexpr char PrefixTrackTrackMe[] = "CPR_TrackTrack/ME/"; constexpr char PrefixTrackV0Se[] = "CPR_TrackV0/SE/"; constexpr char PrefixTrackV0Me[] = "CPR_TrackV0/ME/"; +constexpr char PrefixTrackKinkSe[] = "CPR_TrackKink/SE/"; +constexpr char PrefixTrackKinkMe[] = "CPR_TrackKink/ME/"; // must be in sync with enum TrackVariables // the enum gives the correct index in the array @@ -260,6 +262,50 @@ class ClosePairRejectionTrackV0 // can also be used for any particle type that h bool mIsActivated = true; }; +template +class ClosePairRejectionTrackKink +{ + public: + void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int signTrack, int absChargeTrack, bool isActivated) + { + mIsActivated = isActivated; + mSignTrack = signTrack; + + // initialize CPR with charge of the track and the charged daughter particle + // For kinks, we compare the primary track with the charged daughter + // The charged daughter has absolute charge of 1, so we can pass the sign directly + mCtr.init(registry, specs, detaMax, dphistarMax, signTrack * absChargeTrack, mSignTrack); + } + + void setMagField(float magField) + { + mCtr.setMagField(magField); + } + + template + void setPair(const T1& track, const T2& kink, const T3 /*trackTable*/) + { + if (mSignTrack == 1 || mSignTrack == -1) { + auto daughter = kink.template chaDau_as(); + mCtr.compute(track, daughter); + } else { + LOG(warn) << "CPR Track-Kink: Wrong track sign"; + } + } + + bool isClosePair() const { return mCtr.isClosePair(); } + void fill() + { + mCtr.fill(); + } + bool isActivated() const { return mIsActivated; } + + private: + CloseTrackRejection mCtr; + int mSignTrack = 0; + bool mIsActivated = true; +}; + }; // namespace closepairrejection }; // namespace o2::analysis::femto #endif // PWGCF_FEMTO_CORE_CLOSEPAIRREJECTION_H_ diff --git a/PWGCF/Femto/Core/femtoUtils.h b/PWGCF/Femto/Core/femtoUtils.h index 13a8bfb981f..f853d5e0c4b 100644 --- a/PWGCF/Femto/Core/femtoUtils.h +++ b/PWGCF/Femto/Core/femtoUtils.h @@ -145,6 +145,9 @@ inline float getMass(int pdgCode) case o2::constants::physics::Pdg::kHelium3: mass = o2::constants::physics::MassHelium3; break; + case kSigmaMinus: + mass = o2::constants::physics::MassSigmaMinus; + break; default: LOG(fatal) << "PDG code is not suppored"; } diff --git a/PWGCF/Femto/Core/kinkHistManager.h b/PWGCF/Femto/Core/kinkHistManager.h index 8371a78d5e3..c32e23ba5dd 100644 --- a/PWGCF/Femto/Core/kinkHistManager.h +++ b/PWGCF/Femto/Core/kinkHistManager.h @@ -150,9 +150,8 @@ std::map> makeKinkQaHistSpecMap(T1 co } constexpr char PrefixSigmaQa[] = "SigmaQA/"; -constexpr char PrefixSigma[] = "Sigma/"; -constexpr char PrefixKinkChaDaughter[] = "KinkChaDau/"; -constexpr char PrefixKinkChaDaughterQa[] = "KinkChaDauQa/"; +constexpr char PrefixSigma1[] = "Sigma1/"; +constexpr char PrefixSigma2[] = "Sigma2/"; constexpr std::string_view AnalysisDir = "Kinematics/"; constexpr std::string_view QaDir = "QA/"; diff --git a/PWGCF/Femto/Core/pairBuilder.h b/PWGCF/Femto/Core/pairBuilder.h index 2d82529ca87..7e38b1ff98c 100644 --- a/PWGCF/Femto/Core/pairBuilder.h +++ b/PWGCF/Femto/Core/pairBuilder.h @@ -18,6 +18,7 @@ #include "PWGCF/Femto/Core/closePairRejection.h" #include "PWGCF/Femto/Core/collisionHistManager.h" +#include "PWGCF/Femto/Core/kinkHistManager.h" #include "PWGCF/Femto/Core/modes.h" #include "PWGCF/Femto/Core/pairCleaner.h" #include "PWGCF/Femto/Core/pairHistManager.h" @@ -296,6 +297,107 @@ class PairTrackV0Builder int mMixingDepth = 5; }; +template < + const char* prefixTrack, + const char* prefixKink, + const char* prefixChaDau, + const char* prefixSe, + const char* prefixMe, + const char* prefixCprSe, + const char* prefixCprMe, + modes::Mode mode, + modes::Kink kinkType> +class PairTrackKinkBuilder +{ + public: + PairTrackKinkBuilder() = default; + + template + void init(o2::framework::HistogramRegistry* registry, + T1& confTrackSelection, + T2& confKinkSelection, + T3& confCpr, + T4& confMixing, + std::map>& colHistSpec, + std::map>& trackHistSpec, + std::map>& kinkHistSpec, + std::map>& chaDauHistSpec, + std::map>& pairHistSpec, + std::map>& cprHistSpec) + { + mColHistManager.init(registry, colHistSpec); + + mTrackHistManager.init(registry, trackHistSpec); + mKinkHistManager.init(registry, kinkHistSpec, chaDauHistSpec); + + mPairHistManagerSe.init(registry, pairHistSpec); + mPairHistManagerSe.setMass(confTrackSelection.pdgCode.value, confKinkSelection.pdgCode.value); + mPairHistManagerSe.setCharge(confTrackSelection.absCharge.value, 1); + mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.sign.value, confTrackSelection.absCharge.value, confCpr.on.value); + + mPairHistManagerMe.init(registry, pairHistSpec); + mPairHistManagerMe.setMass(confTrackSelection.pdgCode.value, confKinkSelection.pdgCode.value); + mPairHistManagerMe.setCharge(confTrackSelection.absCharge.value, 1); + mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.sign.value, confTrackSelection.absCharge.value, confCpr.on.value); + + // setup mixing + mMixingPolicy = static_cast(confMixing.policy.value); + mMixingDepth = confMixing.depth.value; + } + + template + void processSameEvent(T1 const& col, T2& trackTable, T3& trackPartition, T4& /*kinktable*/, T5& kinkPartition, T6& cache) + { + auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto kinkSlice = kinkPartition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + if (trackSlice.size() == 0 || kinkSlice.size() == 0) { + return; + } + mColHistManager.fill(col); + mCprSe.setMagField(col.magField()); + pairprocesshelpers::processSameEvent(trackSlice, kinkSlice, trackTable, mTrackHistManager, mKinkHistManager, mPairHistManagerSe, mCprSe, mPc); + } + + template + void processMixedEvent(T1 const& cols, T2& trackTable, T3& trackPartition, T4& kinkPartition, T5& cache, T6& binsVtxMult, T7& binsVtxCent, T8& binsVtxMultCent) + { + switch (mMixingPolicy) { + case static_cast(pairhistmanager::kVtxMult): + pairprocesshelpers::processMixedEvent(cols, trackPartition, kinkPartition, trackTable, cache, binsVtxMult, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + break; + case static_cast(pairhistmanager::kVtxCent): + pairprocesshelpers::processMixedEvent(cols, trackPartition, kinkPartition, trackTable, cache, binsVtxCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + break; + case static_cast(pairhistmanager::kVtxMultCent): + pairprocesshelpers::processMixedEvent(cols, trackPartition, kinkPartition, trackTable, cache, binsVtxMultCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + break; + default: + LOG(fatal) << "Invalid binning policiy specifed. Breaking..."; + } + } + + private: + colhistmanager::CollisionHistManager mColHistManager; + trackhistmanager::TrackHistManager mTrackHistManager; + kinkhistmanager::KinkHistManager mKinkHistManager; + pairhistmanager::PairHistManager mPairHistManagerSe; + pairhistmanager::PairHistManager mPairHistManagerMe; + closepairrejection::ClosePairRejectionTrackKink mCprSe; + closepairrejection::ClosePairRejectionTrackKink mCprMe; + paircleaner::TrackKinkPairCleaner mPc; + pairhistmanager::MixingPoliciy mMixingPolicy = pairhistmanager::MixingPoliciy::kVtxMult; + int mMixingDepth = 5; +}; + } // namespace pairbuilder } // namespace o2::analysis::femto diff --git a/PWGCF/Femto/Core/pairCleaner.h b/PWGCF/Femto/Core/pairCleaner.h index 47608056acf..81e0918552b 100644 --- a/PWGCF/Femto/Core/pairCleaner.h +++ b/PWGCF/Femto/Core/pairCleaner.h @@ -58,6 +58,18 @@ class TrackV0PairCleaner : public BasePairCleaner return this->isCleanTrackPair(posDaughter, track) && this->isCleanTrackPair(negDaughter, track); } }; + +class TrackKinkPairCleaner : public BasePairCleaner +{ + public: + TrackKinkPairCleaner() = default; + template + bool isCleanPair(const T1& track, const T2& kink, const T3& /*trackTable */) const + { + auto chaDaughter = kink.template chaDau_as(); + return this->isCleanTrackPair(chaDaughter, track); + } +}; } // namespace paircleaner } // namespace o2::analysis::femto diff --git a/PWGCF/Femto/Core/pairHistManager.h b/PWGCF/Femto/Core/pairHistManager.h index c256c09b9af..5f6d8bbdf9b 100644 --- a/PWGCF/Femto/Core/pairHistManager.h +++ b/PWGCF/Femto/Core/pairHistManager.h @@ -121,6 +121,9 @@ constexpr char PrefixTrackTrackMe[] = "TrackTrack/ME/"; constexpr char PrefixTrackV0Se[] = "TrackV0/SE/"; constexpr char PrefixTrackV0Me[] = "TrackV0/ME/"; +constexpr char PrefixTrackKinkSe[] = "TrackKink/SE/"; +constexpr char PrefixTrackKinkMe[] = "TrackKink/ME/"; + constexpr std::string_view AnalysisDir = "Analysis/"; constexpr std::string_view QaDir = "QA/"; diff --git a/PWGCF/Femto/Tasks/CMakeLists.txt b/PWGCF/Femto/Tasks/CMakeLists.txt index 0eacf23db6b..1763a60b7bc 100644 --- a/PWGCF/Femto/Tasks/CMakeLists.txt +++ b/PWGCF/Femto/Tasks/CMakeLists.txt @@ -43,3 +43,8 @@ o2physics_add_dpl_workflow(femto-pair-track-v0 SOURCES femtoPairTrackV0.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(femto-pair-track-kink + SOURCES femtoPairTrackKink.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx b/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx new file mode 100644 index 00000000000..b3945633f85 --- /dev/null +++ b/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx @@ -0,0 +1,153 @@ +// Copyright 2019-2025 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 femtoPairTrackKink.cxx +/// \brief Tasks that computes correlation between tracks and kinks +/// \author Anton Riedel, TU München, anton.riedel@cern.ch +/// \author Henrik Fribert, TU München, henrik.fribert@cern.ch + +#include "PWGCF/Femto/Core/closePairRejection.h" +#include "PWGCF/Femto/Core/collisionBuilder.h" +#include "PWGCF/Femto/Core/collisionHistManager.h" +#include "PWGCF/Femto/Core/kinkBuilder.h" +#include "PWGCF/Femto/Core/kinkHistManager.h" +#include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/pairBuilder.h" +#include "PWGCF/Femto/Core/pairHistManager.h" +#include "PWGCF/Femto/Core/partitions.h" +#include "PWGCF/Femto/Core/trackBuilder.h" +#include "PWGCF/Femto/Core/trackHistManager.h" +#include "PWGCF/Femto/DataModel/FemtoTables.h" + +#include "Framework/ASoA.h" +#include "Framework/AnalysisTask.h" +#include "Framework/Configurable.h" +#include "Framework/Expressions.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" + +#include +#include + +using namespace o2; +using namespace o2::aod; +using namespace o2::soa; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::analysis::femto; + +struct FemtoPairTrackKink { + + // setup tables + using Collisions = Join; + using Collision = Collisions::iterator; + + using FilteredCollisions = o2::soa::Filtered; + using FilteredCollision = FilteredCollisions::iterator; + + using Tracks = o2::soa::Join; + using Sigmas = o2::soa::Join; + + SliceCache cache; + + // setup collisions + collisionbuilder::ConfCollisionSelection collisionSelection; + Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); + colhistmanager::ConfCollisionBinning confCollisionBinning; + + // setup tracks + trackbuilder::ConfTrackSelection1 trackSelection; + trackhistmanager::ConfTrackBinning1 confTrackBinning; + Partition trackPartition = MAKE_TRACK_PARTITION(trackSelection); + Preslice perColTracks = aod::femtobase::stored::collisionId; + + // setup for daughters + trackhistmanager::ConfKinkChaDauBinning confChaDauBinning; + + // setup sigmas + kinkbuilder::ConfSigmaSelection1 sigmaSelection; + kinkhistmanager::ConfSigmaBinning1 confSigmaBinning; + Partition sigmaPartition = MAKE_SIGMA_PARTITION(sigmaSelection); + Preslice perColSigmas = aod::femtobase::stored::collisionId; + + // setup pairs + pairhistmanager::ConfPairBinning confPairBinning; + + pairbuilder::PairTrackKinkBuilder< + trackhistmanager::PrefixTrack1, + kinkhistmanager::PrefixSigma1, + trackhistmanager::PrefixKinkChaDaughter, + pairhistmanager::PrefixTrackKinkSe, + pairhistmanager::PrefixTrackKinkMe, + closepairrejection::PrefixTrackKinkSe, + closepairrejection::PrefixTrackKinkMe, + modes::Mode::kAnalysis, + modes::Kink::kSigma> + pairTrackSigmaBuilder; + + // setup mixing + std::vector defaultVtxBins{10, -10, 10}; + std::vector defaultMultBins{50, 0, 200}; + std::vector defaultCentBins{10, 0, 100}; + ColumnBinningPolicy mixBinsVtxMult{{defaultVtxBins, defaultMultBins}, true}; + ColumnBinningPolicy mixBinsVtxCent{{defaultVtxBins, defaultCentBins}, true}; + ColumnBinningPolicy mixBinsVtxMultCent{{defaultVtxBins, defaultMultBins, defaultCentBins}, true}; + pairhistmanager::ConfMixing confMixing; + + HistogramRegistry hRegistry{"FemtoTrackKink", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // setup cpr + closepairrejection::ConfCpr confCpr; + + void init(InitContext&) + { + + // setup columnpolicy for binning + // default values are used during instantiation, so we need to explicity update them here + mixBinsVtxMult = {{confMixing.vtxBins, confMixing.multBins.value}, true}; + mixBinsVtxCent = {{confMixing.vtxBins.value, confMixing.centBins.value}, true}; + mixBinsVtxMultCent = {{confMixing.vtxBins.value, confMixing.multBins.value, confMixing.centBins.value}, true}; + + // setup histograms + auto colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); + auto trackHistSpec = trackhistmanager::makeTrackHistSpecMap(confTrackBinning); + auto chaDauSpec = trackhistmanager::makeTrackHistSpecMap(confChaDauBinning); + auto pairHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confSigmaBinning); + auto cprHistSpec = closepairrejection::makeCprHistSpecMap(confCpr); + + // setup for sigma + // if (doprocessSigmaSameEvent || doprocessSigmaMixedEvent) { + if (doprocessSigmaSameEvent) { + auto sigmaHistSpec = kinkhistmanager::makeKinkHistSpecMap(confSigmaBinning); + pairTrackSigmaBuilder.init(&hRegistry, trackSelection, sigmaSelection, confCpr, confMixing, colHistSpec, trackHistSpec, sigmaHistSpec, chaDauSpec, pairHistSpec, cprHistSpec); + } + }; + + void processSigmaSameEvent(FilteredCollision const& col, Tracks const& tracks, Sigmas const& sigmas) + { + pairTrackSigmaBuilder.processSameEvent(col, tracks, trackPartition, sigmas, sigmaPartition, cache); + } + PROCESS_SWITCH(FemtoPairTrackKink, processSigmaSameEvent, "Enable processing same event processing for tracks and sigmas", true); + + void processSigmaMixedEvent(FilteredCollisions const& cols, Tracks const& tracks, Sigmas const& /*sigmas*/) + { + pairTrackSigmaBuilder.processMixedEvent(cols, tracks, trackPartition, sigmaPartition, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + } + PROCESS_SWITCH(FemtoPairTrackKink, processSigmaMixedEvent, "Enable processing mixed event processing for tracks and sigmas", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{ + adaptAnalysisTask(cfgc), + }; + return workflow; +} From f8810125567e3a09efbd4663d4df498a45c43db2 Mon Sep 17 00:00:00 2001 From: Maxim Virta <84773378+MaximVirta@users.noreply.github.com> Date: Thu, 25 Sep 2025 01:16:21 +0300 Subject: [PATCH 527/986] [PWGCF] Minor fix and additional safeguards added (#13108) Co-authored-by: ALICE Action Bot --- PWGCF/JCorran/Tasks/jflucWeightsLoader.cxx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/PWGCF/JCorran/Tasks/jflucWeightsLoader.cxx b/PWGCF/JCorran/Tasks/jflucWeightsLoader.cxx index 80dcea01f8f..4b14c8ba049 100644 --- a/PWGCF/JCorran/Tasks/jflucWeightsLoader.cxx +++ b/PWGCF/JCorran/Tasks/jflucWeightsLoader.cxx @@ -115,6 +115,9 @@ struct JflucWeightsLoader { LOGF(fatal, "NUA correction weights file not found: %s", cfgPathPhiWeights.value.substr(8).c_str()); } useNUAFromCCDB = false; + } else if (cfgPathPhiWeights.value == "") { + LOGF(info, "No NUA corrections provided."); + useNUAFromCCDB = false; } else { LOGF(info, "Assuming NUA corrections from CCDB."); useNUAFromCCDB = true; @@ -136,6 +139,9 @@ struct JflucWeightsLoader { LOGF(info, "Loaded efficiency correction histogram locally."); } useEffFromCCDB = false; + } else if (cfgPathEffWeights.value == "") { + LOGF(info, "No efficiency corrections provided."); + useEffFromCCDB = false; } else { LOGF(info, "Assuming efficiency corrections from CCDB."); useEffFromCCDB = true; @@ -169,10 +175,9 @@ struct JflucWeightsLoader { initCCDB(collision.runNumber(), timestamp, kNUA); LOGF(info, "Loaded NUA correction histogram from CCDB for run %d.", collision.runNumber()); } - runNumber = collision.runNumber(); } } - if (pfeff) { + if (pfeff || useEffFromCCDB) { if (collision.runNumber() != runNumber) { if (pheff) delete pheff; @@ -188,6 +193,10 @@ struct JflucWeightsLoader { } } } + + // Set run number after reading corrections + runNumber = collision.runNumber(); + for (const auto& track : tracks) { float phiWeight, effWeight; if (ph) { From dbe3f30a5cce6a3d63fa3adfb06143d7ef69bd3f Mon Sep 17 00:00:00 2001 From: altsybee Date: Thu, 25 Sep 2025 01:29:13 +0200 Subject: [PATCH 528/986] [DPG] added condition on ambi tracks loop to avoid crashes (#13120) --- DPG/Tasks/AOTEvent/eventSelectionQa.cxx | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx index 68fe2b96d7c..ab9e727e72f 100644 --- a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx +++ b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx @@ -1000,17 +1000,19 @@ struct EventSelectionQaTask { auto mapAmbTrIdsIt = mapAmbTrIds.find(track.globalIndex()); int ambTrId = mapAmbTrIdsIt == mapAmbTrIds.end() ? -1 : mapAmbTrIdsIt->second; int indexBc = ambTrId < 0 ? track.collision_as().bc_as().globalIndex() : ambTracks.iteratorAt(ambTrId).bc_as().begin().globalIndex(); - auto bc = bcs.iteratorAt(indexBc); - int64_t globalBC = bc.globalBC() + floor(track.trackTime() / o2::constants::lhc::LHCBunchSpacingNS); + if (ambTrId < 0) { // temprorary limitation, to avoid crashes, in particular, on MC Pb-Pb datasets + auto bc = bcs.iteratorAt(indexBc); + int64_t globalBC = bc.globalBC() + floor(track.trackTime() / o2::constants::lhc::LHCBunchSpacingNS); - int32_t indexClosestTVX = findClosest(globalBC, mapGlobalBcWithTVX); - int bcDiff = static_cast(globalBC - vGlobalBCs[indexClosestTVX]); - if (track.hasTOF() || track.hasTRD() || !track.hasITS() || !track.hasTPC() || track.pt() < 1) - continue; - histos.fill(HIST("hTrackBcDiffVsEtaAll"), track.eta(), bcDiff); - if (track.eta() < -0.2 || track.eta() > 0.2) - continue; - histos.fill(HIST("hSecondsTVXvsBcDifAll"), bc.timestamp() / 1000., bcDiff); + int32_t indexClosestTVX = findClosest(globalBC, mapGlobalBcWithTVX); + int bcDiff = static_cast(globalBC - vGlobalBCs[indexClosestTVX]); + if (track.hasTOF() || track.hasTRD() || !track.hasITS() || !track.hasTPC() || track.pt() < 1) + continue; + histos.fill(HIST("hTrackBcDiffVsEtaAll"), track.eta(), bcDiff); + if (track.eta() < -0.2 || track.eta() > 0.2) + continue; + histos.fill(HIST("hSecondsTVXvsBcDifAll"), bc.timestamp() / 1000., bcDiff); + } } // collision-based event selection qa From c3bd1e04513dbd1cba73de99f62872ba70ab4b12 Mon Sep 17 00:00:00 2001 From: Jaideep Tanwar <141036812+jtanwar2212@users.noreply.github.com> Date: Thu, 25 Sep 2025 06:02:02 +0530 Subject: [PATCH 529/986] [PWGLF] updated cuts on He4 analysis. (#13109) --- PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx | 731 +++++++++++---------------- 1 file changed, 304 insertions(+), 427 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx b/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx index 06bfc07ec27..d1634c4f294 100644 --- a/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx +++ b/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx @@ -109,7 +109,9 @@ std::vector> hmassnsigma; } // namespace //---------------------------------------------------------------------------------------------------------------- struct NucleitpcPbPb { - Preslice perCollision = aod::track_association::collisionId; + + Preslice tracksPerCollision = aod::track::collisionId; + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry histomc{"histomc", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; Configurable cfgDebug{"cfgDebug", 1, "debug level"}; @@ -121,7 +123,6 @@ struct NucleitpcPbPb { Configurable removeNoTimeFrameBorder{"removeNoTimeFrameBorder", false, "Remove TF border"}; Configurable cfgRigidityCorrection{"cfgRigidityCorrection", false, "apply rigidity correction"}; // Track Selection Cuts - Configurable cfgCutEta{"cfgCutEta", 0.9f, "Eta range for tracks"}; Configurable cfgetaRequire{"cfgetaRequire", true, "eta cut require"}; Configurable cfgetaRequireMC{"cfgetaRequireMC", true, "eta cut require for generated particles"}; Configurable cfgRapidityRequireMC{"cfgRapidityRequireMC", true, "rapidity cut require for generated particles"}; @@ -143,10 +144,10 @@ struct NucleitpcPbPb { Configurable cfgmaxTPCnSigmaRequire{"cfgmaxTPCnSigmaRequire", true, "Require maxTPCnSigma Cut"}; Configurable cfgminGetMeanItsClsSizeRequire{"cfgminGetMeanItsClsSizeRequire", true, "Require minGetMeanItsClsSize Cut"}; Configurable cfgmaxGetMeanItsClsSizeRequire{"cfgmaxGetMeanItsClsSizeRequire", true, "Require maxGetMeanItsClsSize Cut"}; - Configurable cfgDCAwithptRequire{"cfgDCAwithptRequire", true, "Require DCA cuts with pt dependance"}; Configurable cfgRequirebetaplot{"cfgRequirebetaplot", true, "Require beta plot"}; - Configurable cfgIncludeMaterialInEfficiency{"cfgIncludeMaterialInEfficiency", true, "Require from material in efficiency"}; Configurable cfgMasscut{"cfgMasscut", true, "Require mass cut on He4 particles"}; + Configurable cfgdcaxynopt{"cfgdcaxynopt", true, "DCA xy cut without pT dependent"}; + Configurable cfgdcaznopt{"cfgdcaznopt", false, "DCA xy cut without pT dependent"}; Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {kBetheBlochDefault[0], nParticles, nBetheParams, particleNames, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for light nuclei"}; Configurable> cfgTrackPIDsettings{"cfgTrackPIDsettings", {kTrackPIDSettings[0], nParticles, nTrkSettings, particleNames, trackPIDsettingsNames}, "track selection and PID criteria"}; @@ -155,16 +156,16 @@ struct NucleitpcPbPb { Configurable cfgFillmass{"cfgFillmass", false, "Fill mass histograms"}; Configurable cfgFillmassnsigma{"cfgFillmassnsigma", true, "Fill mass vs nsigma histograms"}; Configurable centcut{"centcut", 80.0f, "centrality cut"}; + Configurable cfgCutEta{"cfgCutEta", 0.9f, "Eta range for tracks"}; Configurable cfgCutRapidity{"cfgCutRapidity", 0.5f, "Rapidity range"}; Configurable cfgtpcNClsFindable{"cfgtpcNClsFindable", 0.8f, "tpcNClsFindable over crossedRows"}; Configurable cfgZvertex{"cfgZvertex", 10, "Min Z Vertex"}; - Configurable cfgZvertexRequire{"cfgZvertexRequire", true, "Pos Z cut require"}; - Configurable cfgZvertexRequireMC{"cfgZvertexRequireMC", true, "Pos Z cut require for generated particles"}; + Configurable cfgZvertexRequireMC{"cfgZvertexRequireMC", true, "Pos Z cut in MC"}; Configurable cfgsel8Require{"cfgsel8Require", true, "sel8 cut require"}; o2::track::TrackParametrizationWithError mTrackParCov; // Binning configuration ConfigurableAxis axisMagField{"axisMagField", {10, -10., 10.}, "magnetic field"}; - ConfigurableAxis axisNev{"axisNev", {5, 0., 5.}, "Number of events"}; + ConfigurableAxis axisNev{"axisNev", {10, 0., 10.}, "Number of events"}; ConfigurableAxis axisRigidity{"axisRigidity", {4000, -10., 10.}, "#it{p}^{TPC}/#it{z}"}; ConfigurableAxis axisdEdx{"axisdEdx", {4000, 0, 4000}, "d#it{E}/d#it{x}"}; ConfigurableAxis axisCent{"axisCent", {100, 0, 100}, "centrality"}; @@ -174,13 +175,13 @@ struct NucleitpcPbPb { ConfigurableAxis axiseta{"axiseta", {100, -1, 1}, "eta"}; ConfigurableAxis axisrapidity{"axisrapidity", {100, -2, 2}, "rapidity"}; ConfigurableAxis axismass{"axismass", {100, -10, 10}, "mass"}; - ConfigurableAxis axismassnsigma{"axismassnsigma", {100, 0, 20}, "mass"}; + ConfigurableAxis axismassnsigma{"axismassnsigma", {100, 0, 20}, "nsigma mass"}; ConfigurableAxis nsigmaAxis{"nsigmaAxis", {160, -10, 10}, "n#sigma_{#pi^{+}}"}; ConfigurableAxis speciesBitAxis{"speciesBitAxis", {8, -0.5, 7.5}, "particle type 0: pion, 1: proton, 2: deuteron, 3: triton, 4:He3, 5:He4"}; ConfigurableAxis speciesTrackingAxis{"speciesTrackingAxis", {11, -0.5, 10.5}, "particle type 0: pion, 1: proton, 2: deuteron, 3: triton, 4:He3, 5:He4"}; ConfigurableAxis axisDCA{"axisDCA", {400, -10., 10.}, "DCA axis"}; - ConfigurableAxis particleAntiAxis{"particleAntiAxis", {2, 0, 2}, "Particle/Anti-particle"}; // 0 = particle, 1 = anti-particle - ConfigurableAxis decayTypeAxis{"decayTypeAxis", {3, -0.5, 2.5}, "Decay type"}; // 0 = primary, 1 = from decay, 2 = material + ConfigurableAxis particleAntiAxis{"particleAntiAxis", {2, -0.5, 1.5}, "Particle/Anti-particle"}; // 0 = particle, 1 = anti-particle + ConfigurableAxis decayTypeAxis{"decayTypeAxis", {3, -0.5, 2.5}, "Decay type"}; // 0 = primary, 1 = from decay, 2 = material // CCDB Service ccdb; @@ -194,13 +195,12 @@ struct NucleitpcPbPb { std::vector primaryParticles; std::vector primVtx, cents; - bool collHasCandidate, collPassedEvSel, collPassedEvSelMc; + bool collHasCandidate, collPassedEvSel; int mRunNumber, occupancy; - float dBz, momn; + float dBz; TRandom3 rand; float he3 = 4; float he4 = 5; - float processmaterial = 23; //---------------------------------------------------------------------------------------------------------------- void init(InitContext const&) { @@ -249,27 +249,28 @@ struct NucleitpcPbPb { if (doprocessMC) { histomc.add("hSpectramc", " ", HistType::kTHnSparseF, {speciesBitAxis, {5, -2.5, 2.5}, axisCent, ptAxis, ptAxis}); + // Efficiency x Acceptance histomc.add("hDenomEffAcc", "Denominator for Efficiency x Acceptance", {HistType::kTHnSparseF, {speciesBitAxis, ptAxis, axisrapidity, axisCent, particleAntiAxis, decayTypeAxis}}); histomc.add("hNumerEffAcc", "Numerator for Efficiency x Acceptance", {HistType::kTHnSparseF, {speciesBitAxis, ptAxis, axisrapidity, axisCent, particleAntiAxis, decayTypeAxis}}); - histomc.add("hDenomSignalLoss", "Denominator for Signal Loss", - {HistType::kTHnSparseF, {speciesBitAxis, ptAxis, axisrapidity, axisCent, particleAntiAxis, decayTypeAxis}}); - histomc.add("hNumerSignalLoss", "Numerator for Signal Loss", - {HistType::kTHnSparseF, {speciesBitAxis, ptAxis, axisrapidity, axisCent, particleAntiAxis, decayTypeAxis}}); - // Material secondary histograms - histomc.add("histSecondaryMaterialHe3", "He3 from material", HistType::kTH2F, {ptAxis, axisCent}); - histomc.add("histSecondaryMaterialAntiHe3", "Anti-He3 from material", HistType::kTH2F, {ptAxis, axisCent}); - histomc.add("histSecondaryMaterialHe4", "He4 from material", HistType::kTH2F, {ptAxis, axisCent}); - histomc.add("histSecondaryMaterialAntiHe4", "Anti-He4 from material", HistType::kTH2F, {ptAxis, axisCent}); + // The Signal loss correction + histomc.add("hHe3SignalLossDenom", "He3 Signal Loss Denominator", kTH1F, {axisCent}); + histomc.add("hHe3SignalLossNumer", "He3 Signal Loss Numerator", kTH1F, {axisCent}); + histomc.add("hHe4SignalLossDenom", "He4 Signal Loss Denominator", kTH1F, {axisCent}); + histomc.add("hHe4SignalLossNumer", "He4 Signal Loss Numerator", kTH1F, {axisCent}); + + histomc.add("haHe3SignalLossDenom", "He3 Signal Loss Denominator", kTH1F, {axisCent}); + histomc.add("haHe3SignalLossNumer", "He3 Signal Loss Numerator", kTH1F, {axisCent}); + histomc.add("haHe4SignalLossDenom", "He4 Signal Loss Denominator", kTH1F, {axisCent}); + histomc.add("haHe4SignalLossNumer", "He4 Signal Loss Numerator", kTH1F, {axisCent}); + + // The event loss correction + histomc.add("hEventLossDenom", "Event loss denominator", kTH1F, {axisCent}); + histomc.add("hEventLossNumer", "Event loss numerator", kTH1F, {axisCent}); histomc.add("histVtxZgen", "histVtxZgen", kTH1F, {axisVtxZ}); - histomc.add("histEtagen", "histEtagen", kTH1F, {axiseta}); - histomc.add("histPtgenHe3", "histPtgenHe3", kTH1F, {ptAxis}); - histomc.add("histPtgenAntiHe3", "histPtgenAntiHe3", kTH1F, {ptAxis}); - histomc.add("histPtgenHe4", "histPtgenHe4", kTH1F, {ptAxis}); - histomc.add("histPtgenAntiHe4", "histPtgenAntiHe4", kTH1F, {ptAxis}); histomc.add("histNevReco", "histNevReco", kTH1F, {axisNev}); histomc.add("histVtxZReco", "histVtxZReco", kTH1F, {axisVtxZ}); histomc.add("histCentFT0CReco", "histCentFT0CReco", kTH1F, {axisCent}); @@ -282,54 +283,47 @@ struct NucleitpcPbPb { histomc.add("histPIDtrackanti", " delta pt vs pt rec", HistType::kTH2F, {{1000, 0, 10, "p_{T}(reco)"}, {9, -0.5, 8.5, "p_{T}(reco) - p_{T}(gen)"}}); histomc.add("histPIDtrackhe4", " delta pt vs pt rec", HistType::kTH2F, {{1000, 0, 10, "p_{T}(reco)"}, {9, -0.5, 8.5, "p_{T}(reco) - p_{T}(gen)"}}); histomc.add("histPIDtrackantihe4", " delta pt vs pt rec", HistType::kTH2F, {{1000, 0, 10, "p_{T}(reco)"}, {9, -0.5, 8.5, "p_{T}(reco) - p_{T}(gen)"}}); - histomc.add("hEventLossDenom", "Event loss denominator", kTH1F, {axisCent}); - histomc.add("hEventLossNumer", "Event loss numerator", kTH1F, {axisCent}); - - histomc.add("histWeakDecayPtHe3", "Pt distribution of He3 from weak decays", kTH2F, {ptAxis, axisCent}); - histomc.add("histWeakDecayPtAntiHe3", "Pt distribution of Anti-He3 from weak decays", kTH2F, {ptAxis, axisCent}); - histomc.add("histWeakDecayPtHe4", "Pt distribution of He4 from weak decays", kTH2F, {ptAxis, axisCent}); - histomc.add("histWeakDecayPtAntiHe4", "Pt distribution of Anti-He4 from weak decays", kTH2F, {ptAxis, axisCent}); - histomc.add("histRecoWeakDecayPtHe3", "Pt distribution of reconstructed He3 from weak decays", kTH2F, {ptAxis, axisCent}); - histomc.add("histRecoWeakDecayPtHe4", "Pt distribution of reconstructed He4 from weak decays", kTH2F, {ptAxis, axisCent}); - histomc.add("histRecoSecondaryMaterialHe3", "Reco He3 from material", HistType::kTH2F, {ptAxis, axisCent}); - histomc.add("histRecoSecondaryMaterialAntiHe3", "Reco Anti-He3 from material", HistType::kTH2F, {ptAxis, axisCent}); - histomc.add("histRecoSecondaryMaterialHe4", "Reco He4 from material", HistType::kTH2F, {ptAxis, axisCent}); - histomc.add("histRecoSecondaryMaterialAntiHe4", "Reco Anti-He4 from material", HistType::kTH2F, {ptAxis, axisCent}); - histomc.add("histProcessCodeHe", "Process codes for He isotopes", kTH1F, {{100, 0, 100, "process code"}}); - histomc.add("histProcess23Details", "Process 23 details", kTH2F, {{4, 0.5, 4.5, "particle type"}, {100, 0, 10, "p_{T}"}}); - histomc.add("histAllMaterialSecondariesGen", "All material secondaries (gen)", kTH3F, {{100, 0, 10, "p_{T}"}, {20, -1, 1, "y"}, {5, -0.5, 4.5, "type"}}); - histomc.add("histAllMaterialSecondariesReco", "All material secondaries (reco)", kTH3F, {{100, 0, 10, "p_{T}"}, {20, -1, 1, "y"}, {5, -0.5, 4.5, "type"}}); } } //---------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------- - void processData(CollisionsFull const& collisions, TracksFull const& tracks, aod::BCsWithTimestamps const&, aod::TrackAssoc const& tracksColl) + void processData(CollisionsFull const& collisions, + TracksFull const& tracks, + aod::BCsWithTimestamps const&) { for (const auto& collision : collisions) { auto bc = collision.bc_as(); initCCDB(bc); initCollision(collision); + if (!collPassedEvSel) continue; if (collision.centFT0C() > centcut) continue; if (removeITSROFrameBorder && !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) continue; + histos.fill(HIST("histNev"), 2.5); if (removeNoSameBunchPileup && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) continue; + histos.fill(HIST("histNev"), 3.5); + if (requireIsGoodZvtxFT0vsPV && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) continue; + histos.fill(HIST("histNev"), 4.5); if (requireIsVertexITSTPC && !collision.selection_bit(aod::evsel::kIsVertexITSTPC)) continue; + + histos.fill(HIST("histNev"), 5.5); if (removeNoTimeFrameBorder && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) continue; + histos.fill(HIST("histNev"), 6.5); histos.fill(HIST("histCentFTOC_cut"), collision.centFT0C()); - histos.fill(HIST("histNev"), 2.5); - const uint64_t collIdx = collision.globalIndex(); - auto tracksByColl = tracksColl.sliceBy(perCollision, collIdx); - ///////////////////////////////////////////////////////////////////////////////// - for (const auto& trackId : tracksByColl) { - const auto& track = tracks.rawIteratorAt(trackId.trackId()); + + // new slicing + auto tracksInColl = tracks.sliceBy(tracksPerCollision, collision.globalIndex()); + + // loop over sliced tracks + for (const auto& track : tracksInColl) { if (!track.isPVContributor() && cfgUsePVcontributors) continue; if (!track.hasITS() && cfgITSrequire) @@ -342,24 +336,22 @@ struct NucleitpcPbPb { continue; if (std::abs(track.eta()) > cfgCutEta && cfgetaRequire) continue; - for (size_t i = 0; i < primaryParticles.size(); i++) { + for (size_t i = 0; i < primaryParticles.size(); i++) { float ptMomn; setTrackParCov(track, mTrackParCov); mTrackParCov.setPID(track.pidForTracking()); ptMomn = (i == he3 || i == he4) ? 2 * mTrackParCov.getPt() : mTrackParCov.getPt(); - int sign = 0; - if (track.sign() > 0) { - sign = 1; - } - if (track.sign() < 0) { - sign = -1; - } + + int sign = (track.sign() > 0) ? 1 : ((track.sign() < 0) ? -1 : 0); + if (std::abs(getRapidity(track, i)) > cfgCutRapidity && cfgRapidityRequire) continue; if (track.tpcNClsFound() < cfgTrackPIDsettings->get(i, "minTPCnCls") && cfgTPCNClsfoundRequire) continue; - if (((track.tpcNClsCrossedRows() < cfgTrackPIDsettings->get(i, "minTPCnClsCrossedRows")) || track.tpcNClsCrossedRows() < cfgtpcNClsFindable * track.tpcNClsFindable()) && cfgTPCNClsCrossedRowsRequire) + if (((track.tpcNClsCrossedRows() < cfgTrackPIDsettings->get(i, "minTPCnClsCrossedRows")) || + track.tpcNClsCrossedRows() < cfgtpcNClsFindable * track.tpcNClsFindable()) && + cfgTPCNClsCrossedRowsRequire) continue; if (track.tpcChi2NCl() > cfgTrackPIDsettings->get(i, "maxTPCchi2") && cfgmaxTPCchi2Require) continue; @@ -367,6 +359,7 @@ struct NucleitpcPbPb { continue; if (track.itsNCls() < cfgTrackPIDsettings->get(i, "minITSnCls") && cfgminITSnClsRequire) continue; + double cosheta = std::cosh(track.eta()); if ((track.itsNCls() / cosheta) < cfgTrackPIDsettings->get(i, "minITSnClscos") && cfgminITSnClscosRequire) continue; @@ -377,9 +370,15 @@ struct NucleitpcPbPb { if (getMeanItsClsSize(track) < cfgTrackPIDsettings->get(i, "minITSclsSize") && cfgminGetMeanItsClsSizeRequire) continue; - bool insideDCAxy = (std::abs(track.dcaXY()) <= (cfgTrackPIDsettings->get(i, "maxDcaXY") * (0.0105f + 0.0350f / std::pow(ptMomn, 1.1f)))); // o2-linter: disable=magic-number (To be checked) - if ((!(insideDCAxy) || std::abs(track.dcaZ()) > dcazSigma(ptMomn, cfgTrackPIDsettings->get(i, "maxDcaZ"))) && cfgDCAwithptRequire) + // DCA XY cut + bool insideDCAxy = cfgdcaxynopt ? (std::abs(track.dcaXY()) <= cfgTrackPIDsettings->get(i, "maxDcaXY")) : (std::abs(track.dcaXY()) <= (cfgTrackPIDsettings->get(i, "maxDcaXY") * (0.0105f + 0.0350f / std::pow(ptMomn, 1.1f)))); + + // DCA Z cut + bool insideDCAz = cfgdcaznopt ? (std::abs(track.dcaZ()) <= cfgTrackPIDsettings->get(i, "maxDcaZ")) : (std::abs(track.dcaZ()) <= dcazSigma(ptMomn, cfgTrackPIDsettings->get(i, "maxDcaZ"))); + + if ((!insideDCAxy || !insideDCAz)) { continue; + } float tpcNsigma = getTPCnSigma(track, primaryParticles.at(i)); if ((std::abs(tpcNsigma) > cfgTrackPIDsettings->get(i, "maxTPCnSigma")) && cfgmaxTPCnSigmaRequire) @@ -389,10 +388,36 @@ struct NucleitpcPbPb { continue; if (itsSigma > cfgTrackPIDsettings2->get(i, "maxITSnsigma") && cfgTrackPIDsettings2->get(i, "useITSnsigma") < 1) continue; + histos.fill(HIST("Tpcsignal"), getRigidity(track) * track.sign(), track.tpcSignal()); if (cfgFillhspectra && cfgTrackPIDsettings2->get(i, "fillsparsh") == 1) { - histos.fill(HIST("hSpectra"), i, ptMomn, tpcNsigma, sign, collision.centFT0C(), track.dcaZ(), track.dcaXY()); + + if (i != he4) { + histos.fill(HIST("hSpectra"), i, ptMomn, tpcNsigma, sign, collision.centFT0C(), track.dcaZ(), track.dcaXY()); + } else { + if (!track.hasTOF()) { + // Fill without TOF + histos.fill(HIST("hSpectra"), i, ptMomn, tpcNsigma, sign, collision.centFT0C(), track.dcaZ(), track.dcaXY()); + } else { + // Has TOF - apply mass cut + float beta = o2::pid::tof::Beta::GetBeta(track); + const float eps = 1e-6f; + if (beta < eps || beta > 1.0f - eps) + continue; + + float charge = 2.f; // he4 has charge 2 + float p = getRigidity(track); + float massTOF = p * charge * std::sqrt(1.f / (beta * beta) - 1.f); + + // Apply mass cut for he4 (mass^2 around 3.73^2 = 13.9) + if (cfgMasscut && (massTOF * massTOF > 6.5 && massTOF * massTOF < 9.138)) { + continue; // Skip if mass cut fails + } + + histos.fill(HIST("hSpectra"), i, ptMomn, tpcNsigma, sign, collision.centFT0C(), track.dcaZ(), track.dcaXY()); + } + } } fillhmassnsigma(track, i, tpcNsigma); if ((std::abs(tpcNsigma) > cfgTrackPIDsettings2->get(i, "maxTPCnsigmaTOF")) && cfgTrackPIDsettings2->get(i, "useTPCnsigmaTOF") < 1) @@ -402,11 +427,11 @@ struct NucleitpcPbPb { if (cfgRequirebetaplot) { histos.fill(HIST("Tofsignal"), getRigidity(track) * track.sign(), o2::pid::tof::Beta::GetBeta(track)); } - } + } // loop primaryParticles + histos.fill(HIST("histeta"), track.eta()); - } // track loop - /////////////////////////////////////////////// - } + } // loop sliced tracks + } // collision loop } PROCESS_SWITCH(NucleitpcPbPb, processData, "data analysis", false); @@ -416,51 +441,31 @@ struct NucleitpcPbPb { struct McCollInfo { bool passedEvSel = false; float centrality = -1.0f; + bool passedEvSelVtZ = false; }; std::vector mcCollInfos; void processMC(CollisionsFullMC const& collisions, aod::McCollisions const& mcCollisions, - TracksFull const& tracks, - aod::BCsWithTimestamps const& bcs, + soa::Join const& tracks, aod::McParticles const& particlesMC, - aod::McTrackLabels const& trackLabelsMC, - aod::McCollisionLabels const& collLabels, - aod::TrackAssoc const& tracksColl, - CollisionsFull const& colls) - { + aod::BCsWithTimestamps const&) - (void)bcs; - (void)collLabels; - (void)colls; + { mcCollInfos.clear(); mcCollInfos.resize(mcCollisions.size()); - // Store centrality regardless of cuts FIRST + // First pass: Store centrality and apply event selection for (auto const& collision : collisions) { int mcCollIdx = collision.mcCollisionId(); if (mcCollIdx < 0 || mcCollIdx >= static_cast(mcCollisions.size())) { continue; } - // STORE CENTRALITY WITHOUT ANY CUTS - mcCollInfos[mcCollIdx].centrality = collision.centFT0C(); - } - // FILL DENOMINATOR: ONCE per MC collision - for (size_t i = 0; i < mcCollInfos.size(); i++) { - if (mcCollInfos[i].centrality >= 0) { // Only if we found a matching collision - histomc.fill(HIST("hEventLossDenom"), mcCollInfos[i].centrality); - } - } + // STORE CENTRALITY WITHOUt CUTS + mcCollInfos[mcCollIdx].centrality = collision.centFT0C(); - for (auto const& collision : collisions) { - int mcCollIdx = collision.mcCollisionId(); - if (mcCollIdx < 0 || mcCollIdx >= static_cast(mcCollisions.size())) { - continue; - } - if (std::abs(collision.posZ()) > cfgZvertex && cfgZvertexRequireMC) - continue; if (!collision.sel8() && cfgsel8Require) continue; if (collision.centFT0C() > centcut) @@ -478,146 +483,75 @@ struct NucleitpcPbPb { if (removeNoTimeFrameBorder && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) continue; + // Mark this MC collision as passing event selection mcCollInfos[mcCollIdx].passedEvSel = true; - histomc.fill(HIST("hEventLossNumer"), mcCollInfos[mcCollIdx].centrality); - } - for (auto const& mcCollision : mcCollisions) { - size_t idx = mcCollision.globalIndex(); - if (idx >= mcCollInfos.size()) + // Apply event selection cuts + if (std::abs(collision.posZ()) > cfgZvertex && cfgZvertexRequireMC) continue; - for (auto const& mcParticle : particlesMC) { + mcCollInfos[mcCollIdx].passedEvSelVtZ = true; + } - if (mcParticle.mcCollisionId() != mcCollision.globalIndex()) - continue; + // FILL EVENT LOSS AND SIGNAL LOSS: Combined loop per MC collision + for (size_t i = 0; i < mcCollInfos.size(); i++) { + if (mcCollInfos[i].centrality >= 0) { // Only if we found a matching collision + // Event loss denominator + histomc.fill(HIST("hEventLossDenom"), mcCollInfos[i].centrality); - int pdgCode = mcParticle.pdgCode(); - bool isHe3 = (std::abs(pdgCode) == particlePdgCodes.at(4)); - bool isHe4 = (std::abs(pdgCode) == particlePdgCodes.at(5)); - if (mcParticle.isPhysicalPrimary()) { - if (pdgCode == particlePdgCodes.at(4)) { - histomc.fill(HIST("histPtgenHe3"), mcParticle.pt()); - } else if (pdgCode == -particlePdgCodes.at(4)) { - histomc.fill(HIST("histPtgenAntiHe3"), mcParticle.pt()); - } else if (pdgCode == particlePdgCodes.at(5)) { - histomc.fill(HIST("histPtgenHe4"), mcParticle.pt()); - } else if (pdgCode == -particlePdgCodes.at(5)) { - histomc.fill(HIST("histPtgenAntiHe4"), mcParticle.pt()); - } - } - if (std::abs(mcParticle.eta()) > cfgCutEta && cfgetaRequireMC) - continue; - if (std::abs(mcParticle.y()) > cfgCutRapidity && cfgRapidityRequireMC) - continue; - bool isMaterialSecondary = false; - if (!mcParticle.isPhysicalPrimary() && (isHe3 || isHe4)) { - if (!mcParticle.has_mothers()) { - isMaterialSecondary = true; - } else { - auto mother = mcParticle.mothers_as().front(); - float notmother = 1000000000; - if (std::abs(mother.pdgCode()) < notmother) { - isMaterialSecondary = true; - } - } - } - if (isHe3 || isHe4) { - histomc.fill(HIST("histProcessCodeHe"), mcParticle.getProcess()); - if (mcParticle.getProcess() == processmaterial) { - histomc.fill(HIST("histProcess23Details"), std::abs(pdgCode), mcParticle.pt()); - } + // Event loss numerator (if passed selection) + if (mcCollInfos[i].passedEvSel) { + histomc.fill(HIST("hEventLossNumer"), mcCollInfos[i].centrality); } - if (isMaterialSecondary) { - float centrality = mcCollInfos[idx].passedEvSel ? mcCollInfos[idx].centrality : -1.0f; - - if (pdgCode == particlePdgCodes.at(4)) { - histomc.fill(HIST("histSecondaryMaterialHe3"), mcParticle.pt(), centrality); - } else if (pdgCode == -particlePdgCodes.at(4)) { - histomc.fill(HIST("histSecondaryMaterialAntiHe3"), mcParticle.pt(), centrality); - } else if (pdgCode == particlePdgCodes.at(5)) { - histomc.fill(HIST("histSecondaryMaterialHe4"), mcParticle.pt(), centrality); - } else if (pdgCode == -particlePdgCodes.at(5)) { - histomc.fill(HIST("histSecondaryMaterialAntiHe4"), mcParticle.pt(), centrality); + // Fill signal loss for all primary particles in this MC collision + for (auto const& mcParticle : particlesMC) { + if (mcParticle.mcCollisionId() != static_cast(i)) { + continue; } - int type = 0; - if (std::abs(pdgCode) == particlePdgCodes.at(4)) - type = (pdgCode > 0) ? 1 : 2; - else if (std::abs(pdgCode) == particlePdgCodes.at(5)) - type = (pdgCode > 0) ? 3 : 4; - histomc.fill(HIST("histAllMaterialSecondariesGen"), mcParticle.pt(), mcParticle.y(), type); - } - - if (!isHe3 && !isHe4) - continue; - - int decayType = 0; - int particleAnti = (pdgCode > 0) ? 0 : 1; - - if (mcParticle.isPhysicalPrimary()) { - decayType = 0; - if (mcParticle.has_mothers()) { - for (const auto& motherparticle : mcParticle.mothers_as()) { - if (std::find(hfMothCodes.begin(), hfMothCodes.end(), - std::abs(motherparticle.pdgCode())) != hfMothCodes.end()) { - decayType = 1; - break; - } - } + if (!mcParticle.isPhysicalPrimary()) { + continue; } - } else if (mcParticle.has_mothers()) { - decayType = 1; - } else { - decayType = 2; - continue; - } - bool isFromWeakDecay = (decayType == 1); - - if (!mcParticle.isPhysicalPrimary() && !isFromWeakDecay) - continue; - - int particleType = -1; - if (std::abs(pdgCode) == particlePdgCodes.at(4)) - particleType = he3; - else if (std::abs(pdgCode) == particlePdgCodes.at(5)) - particleType = he4; - - if (particleType >= 0) { - float centrality = mcCollInfos[idx].centrality; // Always use actual centrality - histomc.fill(HIST("hDenomSignalLoss"), particleType, mcParticle.pt(), mcParticle.y(), centrality, particleAnti, decayType); - if (mcCollInfos[idx].passedEvSel) { - histomc.fill(HIST("hNumerSignalLoss"), particleType, mcParticle.pt(), mcParticle.y(), centrality, particleAnti, decayType); + // Signal loss denominator + if (mcParticle.pdgCode() == particlePdgCodes.at(4)) { // He3 + histomc.fill(HIST("hHe3SignalLossDenom"), mcCollInfos[i].centrality); + } else if (mcParticle.pdgCode() == particlePdgCodes.at(5)) { // He4 + histomc.fill(HIST("hHe4SignalLossDenom"), mcCollInfos[i].centrality); + } else if (mcParticle.pdgCode() == -particlePdgCodes.at(4)) { // anti-He3 + histomc.fill(HIST("haHe3SignalLossDenom"), mcCollInfos[i].centrality); + } else if (mcParticle.pdgCode() == -particlePdgCodes.at(5)) { // He4 + histomc.fill(HIST("haHe4SignalLossDenom"), mcCollInfos[i].centrality); } - } - if (isFromWeakDecay) { - float centrality = mcCollInfos[idx].passedEvSel ? mcCollInfos[idx].centrality : -1.0f; - if (pdgCode == particlePdgCodes.at(4)) { - histomc.fill(HIST("histWeakDecayPtHe3"), mcParticle.pt(), centrality); - } else if (pdgCode == -particlePdgCodes.at(4)) { - histomc.fill(HIST("histWeakDecayPtAntiHe3"), mcParticle.pt(), centrality); - } else if (pdgCode == particlePdgCodes.at(5)) { - histomc.fill(HIST("histWeakDecayPtHe4"), mcParticle.pt(), centrality); - } else if (pdgCode == -particlePdgCodes.at(5)) { - histomc.fill(HIST("histWeakDecayPtAntiHe4"), mcParticle.pt(), centrality); + // Signal loss numerator (if event passed selection) + if (mcCollInfos[i].passedEvSel) { + if (mcParticle.pdgCode() == particlePdgCodes.at(4)) { // He3 + histomc.fill(HIST("hHe3SignalLossNumer"), mcCollInfos[i].centrality); + } else if (mcParticle.pdgCode() == particlePdgCodes.at(5)) { // He4 + histomc.fill(HIST("hHe4SignalLossNumer"), mcCollInfos[i].centrality); + } else if (mcParticle.pdgCode() == -particlePdgCodes.at(4)) { // anti-He3 + histomc.fill(HIST("haHe3SignalLossNumer"), mcCollInfos[i].centrality); + } else if (mcParticle.pdgCode() == -particlePdgCodes.at(5)) { // anti-He4 + histomc.fill(HIST("haHe4SignalLossNumer"), mcCollInfos[i].centrality); + } } } } } + + // Process MC collisions for efficiency and reconstructed collisions for (auto const& mcCollision : mcCollisions) { size_t idx = mcCollision.globalIndex(); - if (idx >= mcCollInfos.size()) continue; - if (!mcCollInfos[idx].passedEvSel) - continue; - if (std::abs(mcCollision.posZ()) > cfgZvertex) - continue; - histomc.fill(HIST("histVtxZgen"), mcCollision.posZ()); float centrality = mcCollInfos[idx].centrality; + // bool passedEvSel = mcCollInfos[idx].passedEvSel; + bool passedEvSelVtZ = mcCollInfos[idx].passedEvSelVtZ; + + // Process generated particles for efficiency denominators + histomc.fill(HIST("histVtxZgen"), mcCollision.posZ()); for (auto const& mcParticle : particlesMC) { if (mcParticle.mcCollisionId() != mcCollision.globalIndex()) @@ -629,9 +563,10 @@ struct NucleitpcPbPb { if (!isHe3 && !isHe4) continue; - if (std::abs(mcParticle.eta()) > cfgCutEta) + + if (std::abs(mcParticle.eta()) > cfgCutEta && cfgetaRequireMC) continue; - if (std::abs(mcParticle.y()) > cfgCutRapidity) + if (std::abs(mcParticle.y()) > cfgCutRapidity && cfgRapidityRequireMC) continue; int decayType = 0; @@ -656,7 +591,8 @@ struct NucleitpcPbPb { } bool isFromWeakDecay = (decayType == 1); - if (!mcParticle.isPhysicalPrimary() && !isFromWeakDecay) + // if (!mcParticle.isPhysicalPrimary() && !isFromWeakDecay) + if (!mcParticle.isPhysicalPrimary() && isFromWeakDecay) continue; int particleType = -1; @@ -666,244 +602,185 @@ struct NucleitpcPbPb { particleType = he4; if (particleType >= 0) { - histomc.fill(HIST("hDenomEffAcc"), particleType, mcParticle.pt(), mcParticle.y(), centrality, particleAnti, decayType); + + // Efficiency x Acceptance histograms + if (passedEvSelVtZ) { + histomc.fill(HIST("hDenomEffAcc"), particleType, mcParticle.pt(), mcParticle.y(), centrality, particleAnti, decayType); + } } } - } - for (auto const& collision : collisions) { - auto mcCollIdx = collision.mcCollisionId(); - if (mcCollIdx < 0 || mcCollIdx >= static_cast(mcCollisions.size())) - continue; - auto bc = collision.bc_as(); - initCCDB(bc); - collHasCandidate = false; - histomc.fill(HIST("histNevReco"), 0.5); + // Process reconstructed collisions for this MC collision + if (passedEvSelVtZ) { + // Find the corresponding reconstructed collision + for (auto const& collision : collisions) { + if (collision.mcCollisionId() != static_cast(idx)) + continue; - if (std::abs(collision.posZ()) > cfgZvertex && cfgZvertexRequire) - continue; - collPassedEvSel = collision.sel8(); - if (!collPassedEvSel && cfgsel8Require) - continue; - histomc.fill(HIST("histNevReco"), 1.5); - histomc.fill(HIST("histVtxZReco"), collision.posZ()); - histomc.fill(HIST("histCentFT0CReco"), collision.centFT0C()); - histomc.fill(HIST("histCentFT0MReco"), collision.centFT0M()); - if (collision.centFT0C() > centcut) - continue; - histomc.fill(HIST("histNevReco"), 2.5); - if (removeITSROFrameBorder && !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) - continue; - if (removeNoSameBunchPileup && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) - continue; - if (requireIsGoodZvtxFT0vsPV && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) - continue; - if (requireIsVertexITSTPC && !collision.selection_bit(aod::evsel::kIsVertexITSTPC)) - continue; - if (removeNoTimeFrameBorder && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) - continue; - for (const auto& assoc : tracksColl) { - if (assoc.collisionId() != collision.globalIndex()) - continue; - const auto& track = tracks.rawIteratorAt(assoc.trackId()); - auto labelRow = trackLabelsMC.iteratorAt(track.globalIndex()); - int label = labelRow.mcParticleId(); - if (label < 0 || label >= static_cast(particlesMC.size())) - continue; - auto const& matchedMCParticle = particlesMC.iteratorAt(label); + auto bc = collision.bc_as(); + initCCDB(bc); - int pdg = matchedMCParticle.pdgCode(); - bool isHe3 = (std::abs(pdg) == particlePdgCodes.at(4)); - bool isHe4 = (std::abs(pdg) == particlePdgCodes.at(5)); + histomc.fill(HIST("histNevReco"), 0.5); + histomc.fill(HIST("histVtxZReco"), collision.posZ()); + histomc.fill(HIST("histCentFT0CReco"), collision.centFT0C()); + histomc.fill(HIST("histCentFT0MReco"), collision.centFT0M()); - bool isMaterialSecondary = false; - if ((isHe3 || isHe4) && !matchedMCParticle.isPhysicalPrimary()) { + auto tracksInColl = tracks.sliceBy(tracksPerCollision, collision.globalIndex()); - if (matchedMCParticle.getProcess() == processmaterial) { // kPMaterial - isMaterialSecondary = true; - } else if (!matchedMCParticle.has_mothers()) { - isMaterialSecondary = true; - } - } + for (auto const& track : tracksInColl) { + if (!track.has_mcParticle()) + continue; // skip un-matched reco tracks - if (isMaterialSecondary) { - if (pdg == particlePdgCodes.at(4)) { - histomc.fill(HIST("histRecoSecondaryMaterialHe3"), track.pt(), collision.centFT0C()); - } else if (pdg == -particlePdgCodes.at(4)) { - histomc.fill(HIST("histRecoSecondaryMaterialAntiHe3"), track.pt(), collision.centFT0C()); - } else if (pdg == particlePdgCodes.at(5)) { - histomc.fill(HIST("histRecoSecondaryMaterialHe4"), track.pt(), collision.centFT0C()); - } else if (pdg == -particlePdgCodes.at(5)) { - histomc.fill(HIST("histRecoSecondaryMaterialAntiHe4"), track.pt(), collision.centFT0C()); - } + auto const& matchedMCParticle = track.mcParticle_as(); - int type = 0; - if (std::abs(pdg) == particlePdgCodes.at(4)) - type = (pdg > 0) ? 1 : 2; - else if (std::abs(pdg) == particlePdgCodes.at(5)) - type = (pdg > 0) ? 3 : 4; - histomc.fill(HIST("histAllMaterialSecondariesReco"), track.pt(), getRapidity(track, he3), type); + // Only process particles from this MC collision + if (matchedMCParticle.mcCollisionId() != mcCollision.globalIndex()) + continue; - if (!cfgIncludeMaterialInEfficiency) { - continue; - } - } - int decayType = 0; - bool isFromWeakDecay = false; + int pdg = matchedMCParticle.pdgCode(); + bool isHe3 = (std::abs(pdg) == particlePdgCodes.at(4)); + bool isHe4 = (std::abs(pdg) == particlePdgCodes.at(5)); - if (matchedMCParticle.isPhysicalPrimary()) { - decayType = 0; - if (matchedMCParticle.has_mothers()) { - for (const auto& motherparticle : matchedMCParticle.mothers_as()) { - if (std::find(hfMothCodes.begin(), hfMothCodes.end(), - std::abs(motherparticle.pdgCode())) != hfMothCodes.end()) { - isFromWeakDecay = true; - decayType = 1; - break; + if (!isHe3 && !isHe4) + continue; + + int decayType = 0; + bool isFromWeakDecay = false; + + if (matchedMCParticle.isPhysicalPrimary()) { + decayType = 0; + if (matchedMCParticle.has_mothers()) { + for (const auto& motherparticle : matchedMCParticle.mothers_as()) { + if (std::find(hfMothCodes.begin(), hfMothCodes.end(), + std::abs(motherparticle.pdgCode())) != hfMothCodes.end()) { + isFromWeakDecay = true; + decayType = 1; + break; + } + } } + } else if (matchedMCParticle.has_mothers()) { + isFromWeakDecay = true; + decayType = 1; + } else { + decayType = 2; } - } - } else if (matchedMCParticle.has_mothers()) { - isFromWeakDecay = true; - decayType = 1; - } else { - decayType = 2; - } - if (!track.isPVContributor() && cfgUsePVcontributors) - continue; - if (!track.hasITS() && cfgITSrequire) - continue; - if (!track.hasTPC() && cfgTPCrequire) - continue; - if (!track.passedITSRefit() && cfgPassedITSRefit) - continue; - if (!track.passedTPCRefit() && cfgPassedTPCRefit) - continue; - if (std::abs(track.eta()) > cfgCutEta && cfgetaRequire) - continue; - if (!matchedMCParticle.isPhysicalPrimary() && !isFromWeakDecay && !isMaterialSecondary) - continue; + if (!track.isPVContributor() && cfgUsePVcontributors) + continue; + if (!track.hasITS() && cfgITSrequire) + continue; + if (!track.hasTPC() && cfgTPCrequire) + continue; + if (!track.passedITSRefit() && cfgPassedITSRefit) + continue; + if (!track.passedTPCRefit() && cfgPassedTPCRefit) + continue; + if (std::abs(track.eta()) > cfgCutEta && cfgetaRequire) + continue; + if (!matchedMCParticle.isPhysicalPrimary() && isFromWeakDecay) + continue; + + for (size_t i = 0; i < primaryParticles.size(); i++) { + if (std::abs(pdg) != std::abs(particlePdgCodes.at(i))) + continue; + + if (std::abs(getRapidity(track, i)) > cfgCutRapidity && cfgRapidityRequire) + continue; + + float ptReco; + setTrackParCov(track, mTrackParCov); + mTrackParCov.setPID(track.pidForTracking()); + + ptReco = (std::abs(pdg) == particlePdgCodes.at(4) || std::abs(pdg) == particlePdgCodes.at(5)) ? 2 * mTrackParCov.getPt() : mTrackParCov.getPt(); + + int particleAnti = (pdg > 0) ? 0 : 1; + + if (pdg == -particlePdgCodes.at(5) && cfgmccorrectionhe4Require) { + ptReco = ptReco + 0.00765 + 0.503791 * std::exp(-1.10517 * ptReco); + } - for (size_t i = 0; i < primaryParticles.size(); i++) { - if (std::abs(pdg) != std::abs(particlePdgCodes.at(i))) - continue; - float ptMomn; - setTrackParCov(track, mTrackParCov); - mTrackParCov.setPID(track.pidForTracking()); - ptMomn = (i == he3 || i == he4) ? 2 * mTrackParCov.getPt() : mTrackParCov.getPt(); - int sign = 0; - if (track.sign() > 0) { - sign = 1; - } - if (track.sign() < 0) { - sign = -1; - } - if (std::abs(getRapidity(track, i)) > cfgCutRapidity && cfgRapidityRequire) - continue; - if (track.tpcNClsFound() < cfgTrackPIDsettings->get(i, "minTPCnCls") && cfgTPCNClsfoundRequire) - continue; - if (((track.tpcNClsCrossedRows() < cfgTrackPIDsettings->get(i, "minTPCnClsCrossedRows")) || track.tpcNClsCrossedRows() < cfgtpcNClsFindable * track.tpcNClsFindable()) && cfgTPCNClsCrossedRowsRequire) - continue; - if (track.tpcChi2NCl() > cfgTrackPIDsettings->get(i, "maxTPCchi2") && cfgmaxTPCchi2Require) - continue; - if (track.tpcChi2NCl() < cfgTrackPIDsettings->get(i, "minTPCchi2") && cfgminTPCchi2Require) - continue; - if (track.itsNCls() < cfgTrackPIDsettings->get(i, "minITSnCls") && cfgminITSnClsRequire) - continue; - double cosheta = std::cosh(track.eta()); - if ((track.itsNCls() / cosheta) < cfgTrackPIDsettings->get(i, "minITSnClscos") && cfgminITSnClscosRequire) - continue; - if ((track.itsNClsInnerBarrel() < cfgTrackPIDsettings->get(i, "minReqClusterITSib")) && cfgminReqClusterITSibRequire) - continue; - if (track.itsChi2NCl() > cfgTrackPIDsettings->get(i, "maxITSchi2") && cfgmaxITSchi2Require) - continue; - if (getMeanItsClsSize(track) < cfgTrackPIDsettings->get(i, "minITSclsSize") && cfgminGetMeanItsClsSizeRequire) - continue; + if (pdg == -particlePdgCodes.at(4) && cfgmccorrectionhe4Require) { + int pidGuess = track.pidForTracking(); + int antitriton = 6; + if (pidGuess == antitriton) { + ptReco = ptReco - 0.464215 + 0.195771 * ptReco - 0.0183111 * ptReco * ptReco; + } + } - bool insideDCAxy = (std::abs(track.dcaXY()) <= (cfgTrackPIDsettings->get(i, "maxDcaXY") * (0.0105f + 0.0350f / std::pow(ptMomn, 1.1f)))); - if ((!(insideDCAxy) || std::abs(track.dcaZ()) > dcazSigma(ptMomn, cfgTrackPIDsettings->get(i, "maxDcaZ"))) && cfgDCAwithptRequire) - continue; + if (track.tpcNClsFound() < cfgTrackPIDsettings->get(i, "minTPCnCls") && cfgTPCNClsfoundRequire) + continue; + if (((track.tpcNClsCrossedRows() < cfgTrackPIDsettings->get(i, "minTPCnClsCrossedRows")) || track.tpcNClsCrossedRows() < cfgtpcNClsFindable * track.tpcNClsFindable()) && cfgTPCNClsCrossedRowsRequire) + continue; + if (track.tpcChi2NCl() > cfgTrackPIDsettings->get(i, "maxTPCchi2") && cfgmaxTPCchi2Require) + continue; + if (track.tpcChi2NCl() < cfgTrackPIDsettings->get(i, "minTPCchi2") && cfgminTPCchi2Require) + continue; + if (track.itsNCls() < cfgTrackPIDsettings->get(i, "minITSnCls") && cfgminITSnClsRequire) + continue; + double cosheta = std::cosh(track.eta()); + if ((track.itsNCls() / cosheta) < cfgTrackPIDsettings->get(i, "minITSnClscos") && cfgminITSnClscosRequire) + continue; + if ((track.itsNClsInnerBarrel() < cfgTrackPIDsettings->get(i, "minReqClusterITSib")) && cfgminReqClusterITSibRequire) + continue; + if (track.itsChi2NCl() > cfgTrackPIDsettings->get(i, "maxITSchi2") && cfgmaxITSchi2Require) + continue; + if (getMeanItsClsSize(track) < cfgTrackPIDsettings->get(i, "minITSclsSize") && cfgminGetMeanItsClsSizeRequire) + continue; + + // DCA XY cut + bool insideDCAxy = cfgdcaxynopt ? (std::abs(track.dcaXY()) <= cfgTrackPIDsettings->get(i, "maxDcaXY")) : (std::abs(track.dcaXY()) <= (cfgTrackPIDsettings->get(i, "maxDcaXY") * (0.0105f + 0.0350f / std::pow(ptReco, 1.1f)))); + + // DCA Z cut + bool insideDCAz = cfgdcaznopt ? (std::abs(track.dcaZ()) <= cfgTrackPIDsettings->get(i, "maxDcaZ")) : (std::abs(track.dcaZ()) <= dcazSigma(ptReco, cfgTrackPIDsettings->get(i, "maxDcaZ"))); + + if ((!insideDCAxy || !insideDCAz)) { + continue; + } - float tpcNsigma = getTPCnSigma(track, primaryParticles.at(i)); - if ((std::abs(tpcNsigma) > cfgTrackPIDsettings->get(i, "maxTPCnSigma")) && cfgmaxTPCnSigmaRequire) - continue; - float itsSigma = getITSnSigma(track, primaryParticles.at(i)); - if (itsSigma < cfgTrackPIDsettings2->get(i, "minITSnsigma") && cfgTrackPIDsettings2->get(i, "useITSnsigma") < 1) - continue; - if (itsSigma > cfgTrackPIDsettings2->get(i, "maxITSnsigma") && cfgTrackPIDsettings2->get(i, "useITSnsigma") < 1) - continue; - float ptReco; - mTrackParCov.setPID(track.pidForTracking()); - ptReco = (std::abs(pdg) == particlePdgCodes.at(4) || std::abs(pdg) == particlePdgCodes.at(5)) ? 2 * mTrackParCov.getPt() : mTrackParCov.getPt(); + if (i == he3 || i == he4) { + histomc.fill(HIST("hNumerEffAcc"), i, ptReco, matchedMCParticle.y(), collision.centFT0C(), particleAnti, decayType); + } - int particleAnti = (pdg > 0) ? 0 : 1; + float ptTOF = -1.0; // Default: no TOF + if (track.hasTOF()) { + ptTOF = ptReco; + } - if (i == he3 || i == he4) { - histomc.fill(HIST("hNumerEffAcc"), i, matchedMCParticle.pt(), matchedMCParticle.y(), collision.centFT0C(), particleAnti, decayType); - } - if (isFromWeakDecay) { - if (std::abs(pdg) == particlePdgCodes.at(4)) { - histomc.fill(HIST("histRecoWeakDecayPtHe3"), ptReco, collision.centFT0C()); - } else if (std::abs(pdg) == particlePdgCodes.at(5)) { - histomc.fill(HIST("histRecoWeakDecayPtHe4"), ptReco, collision.centFT0C()); - } - } + if (cfgTrackPIDsettings2->get(i, "fillsparsh") == 1) { + histomc.fill(HIST("hSpectramc"), i, particleAnti, collision.centFT0C(), + ptReco, ptTOF); + } - histos.fill(HIST("Tpcsignal"), getRigidity(track) * track.sign(), track.tpcSignal()); + histos.fill(HIST("Tpcsignal"), getRigidity(track) * track.sign(), track.tpcSignal()); - if (pdg == -particlePdgCodes.at(5) && cfgmccorrectionhe4Require) { - ptReco = ptReco + 0.00765 + 0.503791 * std::exp(-1.10517 * ptReco); - } + // Fill the requested histograms + float ptGen = matchedMCParticle.pt(); + float deltaPt = ptReco - ptGen; - if (pdg == -particlePdgCodes.at(4) && cfgmccorrectionhe4Require) { - int pidGuess = track.pidForTracking(); - int antitriton = 6; - if (pidGuess == antitriton) { - ptReco = ptReco - 0.464215 + 0.195771 * ptReco - 0.0183111 * ptReco * ptReco; + if (pdg == -particlePdgCodes.at(4)) { + histomc.fill(HIST("histDeltaPtVsPtGenanti"), ptReco, deltaPt); + histomc.fill(HIST("histPIDtrackanti"), ptReco, track.pidForTracking()); + } + if (pdg == particlePdgCodes.at(4)) { + histomc.fill(HIST("histDeltaPtVsPtGen"), ptReco, deltaPt); + histomc.fill(HIST("histPIDtrack"), ptReco, track.pidForTracking()); + } + if (pdg == -particlePdgCodes.at(5)) { + histomc.fill(HIST("histDeltaPtVsPtGenHe4anti"), ptReco, deltaPt); + histomc.fill(HIST("histPIDtrackantihe4"), ptReco, track.pidForTracking()); + } + if (pdg == particlePdgCodes.at(5)) { + histomc.fill(HIST("histDeltaPtVsPtGenHe4"), ptReco, deltaPt); + histomc.fill(HIST("histPIDtrackhe4"), ptReco, track.pidForTracking()); + } } } - float ptGen = matchedMCParticle.pt(); - - float deltaPt = ptReco - ptGen; - - if (pdg == -particlePdgCodes.at(4)) { - histomc.fill(HIST("histDeltaPtVsPtGenanti"), ptReco, deltaPt); - histomc.fill(HIST("histPIDtrackanti"), ptReco, track.pidForTracking()); - } - if (pdg == particlePdgCodes.at(4)) { - histomc.fill(HIST("histDeltaPtVsPtGen"), ptReco, deltaPt); - histomc.fill(HIST("histPIDtrack"), ptReco, track.pidForTracking()); - } - if (pdg == -particlePdgCodes.at(5)) { - histomc.fill(HIST("histDeltaPtVsPtGenHe4anti"), ptReco, deltaPt); - histomc.fill(HIST("histPIDtrackantihe4"), ptReco, track.pidForTracking()); - } - if (pdg == particlePdgCodes.at(5)) { - histomc.fill(HIST("histDeltaPtVsPtGenHe4"), ptReco, deltaPt); - histomc.fill(HIST("histPIDtrackhe4"), ptReco, track.pidForTracking()); - } - - // For TOF matching efficiency - float ptTOF = -1.0; // Default: no TOF - if (track.hasTOF()) { - ptTOF = ptReco; - } - - if (cfgTrackPIDsettings2->get(i, "fillsparsh") == 1) { - histomc.fill(HIST("hSpectramc"), i, sign, collision.centFT0C(), - ptReco, ptTOF); - } - - if (cfgRequirebetaplot) { - histos.fill(HIST("Tofsignal"), getRigidity(track) * track.sign(), o2::pid::tof::Beta::GetBeta(track)); - } - } // loop over primaryParticles types - histos.fill(HIST("histeta"), track.eta()); - } // TrackAssoc loop - } // Collision loop + break; // Found the matching collision, break out of collision loop + } + } + } } - PROCESS_SWITCH(NucleitpcPbPb, processMC, "MC reco+gen analysis with efficiency corrections", false); //=-=-=-==-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= void initCCDB(aod::BCsWithTimestamps::iterator const& bc) From 1a8b54efde2bce11ed69436ede1d4cfeb1a72df1 Mon Sep 17 00:00:00 2001 From: Fabio Colamaria Date: Thu, 25 Sep 2025 10:17:36 +0200 Subject: [PATCH 530/986] [PWGHF] Small bug fixes to Lc-h correlator (#13115) Co-authored-by: fcolamar --- PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx index 98d2728572a..3407c77829b 100644 --- a/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx @@ -440,7 +440,9 @@ struct HfCorrelatorLcHadrons { outputMl[iclass] = candidate.mlProbLcToPKPi()[classMl->at(iclass)]; } entryLcCandRecoInfo(hfHelper.invMassLcToPKPi(candidate), candidate.pt() * chargeLc, outputMl[0], outputMl[1]); // 0: BkgBDTScore, 1:PromptBDTScore - entryLc(candidate.phi(), candidate.eta(), candidate.pt() * chargeLc, hfHelper.invMassLcToPKPi(candidate), poolBin, gCollisionId, timeStamp); + if (!skipMixedEventTableFilling) { + entryLc(candidate.phi(), candidate.eta(), candidate.pt() * chargeLc, hfHelper.invMassLcToPKPi(candidate), poolBin, gCollisionId, timeStamp); + } } if (candidate.isSelLcToPiKP() >= selectionFlagLc) { registry.fill(HIST("hMassLcVsPtVsCent"), hfHelper.invMassLcToPiKP(candidate), candidate.pt(), cent, efficiencyWeightLc); @@ -458,6 +460,7 @@ struct HfCorrelatorLcHadrons { // Lc-Hadron correlation dedicated section // if the candidate is a Lc, search for Hadrons and evaluate correlations for (const auto& track : tracks) { + correlationStatus = false; // Remove Lc daughters by checking track indices if ((candidate.prong0Id() == track.globalIndex()) || (candidate.prong1Id() == track.globalIndex()) || (candidate.prong2Id() == track.globalIndex())) { if (!storeAutoCorrelationFlag) { @@ -695,6 +698,7 @@ struct HfCorrelatorLcHadrons { // Lc-Hadron correlation dedicated section // if the candidate is selected as Lc, search for Hadron ad evaluate correlations for (const auto& track : tracks) { + correlationStatus = false; bool isPhysicalPrimary = false; int trackOrigin = -1; // apply track selection @@ -868,6 +872,7 @@ struct HfCorrelatorLcHadrons { // if it's a Lc particle, search for Hadron and evalutate correlations registry.fill(HIST("hcountLctriggersMcGen"), 0, particle.pt()); // to count trigger Lc for normalisation for (const auto& particleAssoc : mcParticles) { + correlationStatus = false; if (std::abs(particleAssoc.eta()) > etaTrackMax || particleAssoc.pt() < ptTrackMin || particleAssoc.pt() > ptTrackMax) { continue; } From d8f90a6337b03b981de0e55c0da92c2da72c3094 Mon Sep 17 00:00:00 2001 From: Sandeep Dudi <69388148+sdudi123@users.noreply.github.com> Date: Thu, 25 Sep 2025 11:09:59 +0200 Subject: [PATCH 531/986] [PWGUD] Code optimized for memory issue (#13116) Co-authored-by: sandeep dudi --- PWGUD/Tasks/sginclusivePhiKstarSD.cxx | 467 ++++---------------------- 1 file changed, 62 insertions(+), 405 deletions(-) diff --git a/PWGUD/Tasks/sginclusivePhiKstarSD.cxx b/PWGUD/Tasks/sginclusivePhiKstarSD.cxx index 5b122b713da..626b5d832bd 100644 --- a/PWGUD/Tasks/sginclusivePhiKstarSD.cxx +++ b/PWGUD/Tasks/sginclusivePhiKstarSD.cxx @@ -92,9 +92,8 @@ struct SginclusivePhiKstarSD { Configurable pt2{"pt2", 0.4, "pid selection pt2"}; Configurable pt3{"pt3", 0.5, "pid selection pt3"}; - Configurable etaGapMin{"etaGapMin", 0.0, "Track eta min"}; - Configurable etaGapMax{"etaGapMax", 0.9, "Track eta max"}; - Configurable etaDG{"etaDG", 0.5, "Track eta DG"}; + Configurable rapiditycut{"rapiditycut", 1, "Rapidity Cut"}; + Configurable rapiditycutvalue{"rapiditycutvalue", 1, "Rapidity Cut value"}; Configurable nsigmaTpcCut1{"nsigmaTpcCut1", 3.0, "nsigma tpc cut1"}; Configurable nsigmaTpcCut2{"nsigmaTpcCut2", 3.0, "nsigma tpc cut2"}; @@ -105,14 +104,13 @@ struct SginclusivePhiKstarSD { Configurable pionNsigmaCut{"pionNsigmaCut", 3.0, "nsigma tpc cut for kaon"}; Configurable mintrack{"mintrack", 1, "min track"}; - Configurable maxtrack{"maxtrack", 50, "max track"}; + Configurable maxtrack{"maxtrack", 150, "max track"}; Configurable useTof{"useTof", true, "TOF PID"}; Configurable ccut{"ccut", true, "TPC + TOF PID"}; - Configurable kaoncut{"kaoncut", true, " kaon slection cut for kstar "}; + Configurable kaoncut{"kaoncut", false, " kaon slection cut for kstar "}; - Configurable qa{"qa", true, "QA plots for Data (turn qaMC to 0)"}; + Configurable qa{"qa", false, "QA plots for Data (turn qaMC to 0)"}; Configurable qaMC{"qaMC", false, "QA plots for MC (turn qa for data to 0)"}; - Configurable rapidityGap{"rapidityGap", true, ""}; Configurable exclusive{"exclusive", false, "for double gap side "}; Configurable phi{"phi", true, ""}; @@ -131,6 +129,12 @@ struct SginclusivePhiKstarSD { Configurable reconstruction{"reconstruction", true, ""}; Configurable generatedId{"generatedId", 31, ""}; + ConfigurableAxis axisphimass{"axisphimass", {220, 0.98, 1.2}, ""}; + ConfigurableAxis axiskstarmass{"axiskstarmass", {400, 0.0, 2.0}, ""}; + ConfigurableAxis axisrhomass{"axisrhomass", {200, 1.0, 2.0}, ""}; + ConfigurableAxis axispt{"axispt", {200, 0.0, 20.0}, ""}; + ConfigurableAxis axisrapdity{"axisrapdity", {40, -2.0, 2.0}, ""}; + int numTwoTracks = 2; int numFourTracks = 4; @@ -161,45 +165,45 @@ struct SginclusivePhiKstarSD { registry.add("nPVContributors_data_1", "Multiplicity_dist_before track cut gap C", kTH1F, {{110, 0, 110}}); if (phi) { - registry.add("os_KK_pT_0", "pt kaon pair", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_KK_pT_1", "pt kaon pair", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_KK_pT_2", "pt kaon pair", kTH3F, {{305, 0.98, 2.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_KK_ls_pT_0", "kaon pair like sign", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_KK_ls_pT_1", "kaon pair like sign", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_KK_ls_pT_2", "kaon pair like sign", kTH3F, {{305, 0.98, 2.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - - registry.add("os_KK_mix_pT_0", "kaon pair mix event", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_KK_mix_pT_1", "kaon pair mix event", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_KK_mix_pT_2", "kaon pair mix event", kTH3F, {{305, 0.98, 2.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - - registry.add("os_KK_rot_pT_0", "kaon pair mix event", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_KK_rot_pT_1", "kaon pair mix event", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_KK_rot_pT_2", "kaon pair mix event", kTH3F, {{305, 0.98, 2.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_KK_pT_0", "pt kaon pair", kTH3F, {axisphimass, axisrapdity, axispt}); + registry.add("os_KK_pT_1", "pt kaon pair", kTH3F, {axisphimass, axisrapdity, axispt}); + registry.add("os_KK_pT_2", "pt kaon pair", kTH3F, {axisphimass, axisrapdity, axispt}); + registry.add("os_KK_ls_pT_0", "kaon pair like sign", kTH3F, {axisphimass, axisrapdity, axispt}); + registry.add("os_KK_ls_pT_1", "kaon pair like sign", kTH3F, {axisphimass, axisrapdity, axispt}); + registry.add("os_KK_ls_pT_2", "kaon pair like sign", kTH3F, {axisphimass, axisrapdity, axispt}); + + registry.add("os_KK_mix_pT_0", "kaon pair mix event", kTH3F, {axisphimass, axisrapdity, axispt}); + registry.add("os_KK_mix_pT_1", "kaon pair mix event", kTH3F, {axisphimass, axisrapdity, axispt}); + registry.add("os_KK_mix_pT_2", "kaon pair mix event", kTH3F, {axisphimass, axisrapdity, axispt}); + + registry.add("os_KK_rot_pT_0", "kaon pair mix event", kTH3F, {axisphimass, axisrapdity, axispt}); + registry.add("os_KK_rot_pT_1", "kaon pair mix event", kTH3F, {axisphimass, axisrapdity, axispt}); + registry.add("os_KK_rot_pT_2", "kaon pair mix event", kTH3F, {axisphimass, axisrapdity, axispt}); } if (rho) { - registry.add("os_pp_pT_0", "pt pion pair", kTH3F, {{200, 1.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_pp_pT_1", "pt pion pair", kTH3F, {{200, 1.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_pp_pT_2", "pt pion pair", kTH3F, {{200, 1.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_pp_ls_pT_0", "pion pair like sign", kTH3F, {{200, 1.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_pp_ls_pT_1", "pion pair like sign", kTH3F, {{200, 1.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_pp_ls_pT_2", "pion pair like sign", kTH3F, {{200, 1.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_pp_pT_0", "pt pion pair", kTH3F, {axisrhomass, axisrapdity, axispt}); + registry.add("os_pp_pT_1", "pt pion pair", kTH3F, {axisrhomass, axisrapdity, axispt}); + registry.add("os_pp_pT_2", "pt pion pair", kTH3F, {axisrhomass, axisrapdity, axispt}); + registry.add("os_pp_ls_pT_0", "pion pair like sign", kTH3F, {axisrhomass, axisrapdity, axispt}); + registry.add("os_pp_ls_pT_1", "pion pair like sign", kTH3F, {axisrhomass, axisrapdity, axispt}); + registry.add("os_pp_ls_pT_2", "pion pair like sign", kTH3F, {axisrhomass, axisrapdity, axispt}); } if (kstar) { - registry.add("os_pk_pT_0", "pion-kaon pair", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_pk_pT_1", "pion-kaon pair", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_pk_pT_2", "pion-kaon pair", kTH3F, {{600, 0.0, 3.0}, {80, -2.0, 2.0}, {1000, 0, 10}}); + registry.add("os_pk_pT_0", "pion-kaon pair", kTH3F, {axiskstarmass, axisrapdity, axispt}); + registry.add("os_pk_pT_1", "pion-kaon pair", kTH3F, {axiskstarmass, axisrapdity, axispt}); + registry.add("os_pk_pT_2", "pion-kaon pair", kTH3F, {axiskstarmass, axisrapdity, axispt}); - registry.add("os_pk_mix_pT_0", "pion-kaon mix pair", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_pk_mix_pT_1", "pion-kaon mix pair", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_pk_mix_pT_2", "pion-kaon mix pair", kTH3F, {{600, 0.0, 3.0}, {80, -2.0, 2.0}, {1000, 0, 10}}); + registry.add("os_pk_mix_pT_0", "pion-kaon mix pair", kTH3F, {axiskstarmass, axisrapdity, axispt}); + registry.add("os_pk_mix_pT_1", "pion-kaon mix pair", kTH3F, {axiskstarmass, axisrapdity, axispt}); + registry.add("os_pk_mix_pT_2", "pion-kaon mix pair", kTH3F, {axiskstarmass, axisrapdity, axispt}); - registry.add("os_pk_rot_pT_0", "pion-kaon rotional pair", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_pk_rot_pT_1", "pion-kaon rotional pair", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_pk_rot_pT_2", "pion-kaon rotional pair", kTH3F, {{600, 0.0, 3.0}, {80, -2.0, 2.0}, {1000, 0, 10}}); + registry.add("os_pk_rot_pT_0", "pion-kaon rotional pair", kTH3F, {axiskstarmass, axisrapdity, axispt}); + registry.add("os_pk_rot_pT_1", "pion-kaon rotional pair", kTH3F, {axiskstarmass, axisrapdity, axispt}); + registry.add("os_pk_rot_pT_2", "pion-kaon rotional pair", kTH3F, {axiskstarmass, axisrapdity, axispt}); - registry.add("os_pk_ls_pT_0", "pion-kaon pair like sign", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_pk_ls_pT_1", "pion-kaon like sign", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_pk_ls_pT_2", "pion-kaon like sign", kTH3F, {{600, 0.0, 3.0}, {80, -2.0, 2.0}, {1000, 0, 10}}); + registry.add("os_pk_ls_pT_0", "pion-kaon pair like sign", kTH3F, {axiskstarmass, axisrapdity, axispt}); + registry.add("os_pk_ls_pT_1", "pion-kaon like sign", kTH3F, {axiskstarmass, axisrapdity, axispt}); + registry.add("os_pk_ls_pT_2", "pion-kaon like sign", kTH3F, {axiskstarmass, axisrapdity, axispt}); registry.add("hRotation", "hRotation", kTH1F, {{360, 0.0, o2::constants::math::TwoPI}}); } @@ -273,19 +277,6 @@ struct SginclusivePhiKstarSD { rQA.add("V0A_2", "V0A amplitude", kTH1F, {{1000, 0.0, 1000.0}}); rQA.add("V0A_0", "V0A amplitude", kTH1F, {{1000, 0.0, 1000.0}}); rQA.add("V0A_1", "V0A amplitude", kTH1F, {{1000, 0.0, 1000.0}}); - - if (rapidityGap) { - registry.add("event_rap_gap", "rap_gap", kTH1F, {{15, 0, 15.0}}); - registry.add("rap_mult1", "rap_mult1", kTH1F, {{150, 0, 150}}); - registry.add("rap_mult2", "rap_mult2", kTH1F, {{150, 0, 150}}); - registry.add("rap_mult3", "rap_mult3", kTH1F, {{150, 0, 150}}); - registry.add("rap1_mult1", "rap1_mult1", kTH1F, {{150, 0, 150}}); - registry.add("rap1_mult2", "rap1_mult2", kTH1F, {{150, 0, 150}}); - registry.add("rap1_mult3", "rap1_mult3", kTH1F, {{150, 0, 150}}); - registry.add("rap2_mult1", "rap2_mult1", kTH1F, {{150, 0, 150}}); - registry.add("rap2_mult2", "rap2_mult2", kTH1F, {{150, 0, 150}}); - registry.add("rap2_mult3", "rap2_mult3", kTH1F, {{150, 0, 150}}); - } } registry.add("gap_mult0", "Mult 0", kTH1F, {{100, 0.0, 100.0}}); registry.add("gap_mult1", "Mult 1", kTH1F, {{100, 0.0, 100.0}}); @@ -295,53 +286,6 @@ struct SginclusivePhiKstarSD { registry.add("mult_1", "mult1", kTH1F, {{150, 0, 150}}); registry.add("mult_2", "mult2", kTH1F, {{150, 0, 150}}); - // Multiplicity plot - if (rapidityGap && phi) { - registry.add("os_kk_mass_rap", "phi mass1", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_mass_rap1", "phi mass2", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_mass_rap2", "phi mass3", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_mass1_rap", "phi mass1 gap1", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_mass1_rap1", "phi mass2 gap1", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_mass1_rap2", "phi mass3 gap1", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_mass2_rap", "phi mass1 DG", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_mass2_rap1", "phi mass2 DG", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_mass2_rap2", "phi mass3 DG", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - - // like sign bkg - registry.add("os_kk_ls_mass_rap", "phi ls mass1", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_ls_mass_rap1", "phi ls mass2", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_ls_mass_rap2", "phi ls mass3", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_ls_mass1_rap", "phi ls mass1 gap1", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_ls_mass1_rap1", "phi ls mass2 gap1", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_ls_mass1_rap2", "phi ls mass3 gap1", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_ls_mass2_rap", "phi ls mass1 DG", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_ls_mass2_rap1", "phi ls mass2 DG", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_ls_mass2_rap2", "phi ls mass3 DG", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - } - - if (rapidityGap && kstar) { - registry.add("os_kp_mass_rap", "kstar mass1", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kp_mass_rap1", "kstar mass2", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kp_mass_rap2", "kstar mass3", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kp_mass1_rap", "kstar mass1 gap1", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kp_mass1_rap1", "kstar mass2 gap1", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kp_mass1_rap2", "kstar mass3 gap1", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kp_mass2_rap", "kstar mass1 DG", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kp_mass2_rap1", "kstar mass2 DG", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kp_mass2_rap2", "kstar mass3 DG", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - - // like sign bkg - - registry.add("os_kp_ls_mass_rap", "kstar ls mass1", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kp_ls_mass_rap1", "kstar ls mass2", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kp_ls_mass_rap2", "kstar ls mass3", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kp_ls_mass1_rap", "kstar ls mass1 gap1", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kp_ls_mass1_rap1", "kstar ls mass2 gap1", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kp_ls_mass1_rap2", "kstar ls mass3 gap1", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kp_ls_mass2_rap", "kstar ls mass1 DG", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kp_ls_mass2_rap1", "kstar ls mass2 DG", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kp_ls_mass2_rap2", "kstar ls mass3 DG", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - } if (fourpion) { registry.add("os_pppp_pT_2", "4 pion pair", kTH3F, {{800, 0.5, 4.5}, {250, 0.0, 5.0}, {30, -1.5, 1.5}}); registry.add("os_pppp_pT_2_ls", "4 pion pair", kTH3F, {{800, 0.5, 4.5}, {250, 0.0, 5.0}, {30, -1.5, 1.5}}); @@ -773,29 +717,13 @@ struct SginclusivePhiKstarSD { int mult0 = 0; int mult1 = 0; int mult2 = 0; - int trackgapA = 0; - int trackgapC = 0; - int trackDG = 0; - int trackextra = 0; - int trackextraDG = 0; - if (qa) { rQA.fill(HIST("hVertexX"), collision.posX()); rQA.fill(HIST("hVertexY"), collision.posY()); rQA.fill(HIST("hVertexZ"), collision.posZ()); } - /* Partition pvContributors1 = aod::udtrack::isPVContributor == true; - pvContributors1.bindTable(tracks); - if (gapSide == SingleGapA) { - registry.get(HIST("nPVContributors_data"))->Fill(pvContributors1.size(), 1.); - } - if (gapSide == SingleGapC) { - registry.get(HIST("nPVContributors_data_1"))->Fill(pvContributors1.size(), 1.); - } - */ for (const auto& track1 : tracks) { - if (qa) { rQA.fill(HIST("hDcaxy_all_before"), track1.dcaXY()); rQA.fill(HIST("hDcaz_all_before"), track1.dcaZ()); @@ -833,21 +761,6 @@ struct SginclusivePhiKstarSD { if (gapSide == DoubleGap) { mult2++; } - if (std::abs(v0.Eta()) < etaDG) { - trackDG++; - } - if (v0.Eta() > etaGapMin && v0.Eta() < etaGapMax) { - trackgapA++; - } - if (v0.Eta() < etaGapMin && v0.Eta() > -etaGapMax) { - trackgapC++; - } - if (std::abs(v0.Eta()) > etaGapMax || std::abs(v0.Eta()) < etaGapMin) { - trackextra++; - } - if (std::abs(v0.Eta()) > etaDG) { - trackextraDG++; - } if (qa) { rQA.fill(HIST("tpc_dedx"), v0.P(), track1.tpcSignal()); @@ -888,9 +801,6 @@ struct SginclusivePhiKstarSD { if (gapSide == SingleGapC) { registry.fill(HIST("mult_1"), mult1); } - if (gapSide == DoubleGap) { - registry.fill(HIST("mult_2"), mult2); - } if (qa) { if (gapSide == SingleGapA) { rQA.fill(HIST("V0A_0"), collision.totalFV0AmplitudeA()); @@ -906,273 +816,7 @@ struct SginclusivePhiKstarSD { rQA.fill(HIST("ZDC_A_1"), collision.energyCommonZNA()); rQA.fill(HIST("ZDC_C_1"), collision.energyCommonZNC()); } - if (gapSide == DoubleGap) { - rQA.fill(HIST("V0A_2"), collision.totalFV0AmplitudeA()); - rQA.fill(HIST("FT0A_2"), collision.totalFT0AmplitudeA()); - rQA.fill(HIST("FT0C_2"), collision.totalFT0AmplitudeC()); - rQA.fill(HIST("ZDC_A_2"), collision.energyCommonZNA()); - rQA.fill(HIST("ZDC_C_2"), collision.energyCommonZNC()); - } - if (rapidityGap) { - if (trackgapC > 0 && trackgapA == 0 && trackextra == 0) { - if (gapSide == SingleGapA) { - registry.fill(HIST("event_rap_gap"), 1); - registry.fill(HIST("rap_mult1"), trackgapC); - } - if (gapSide == SingleGapC) { - registry.fill(HIST("event_rap_gap"), 4); - registry.fill(HIST("rap1_mult1"), trackgapC); - } - if (gapSide == DoubleGap) { - registry.fill(HIST("event_rap_gap"), 7); - registry.fill(HIST("rap2_mult1"), trackgapC); - } - } - if (trackgapC == 0 && trackgapA > 0 && trackextra == 0) { - if (gapSide == SingleGapA) { - registry.fill(HIST("event_rap_gap"), 2); - registry.fill(HIST("rap_mult2"), trackgapA); - } - if (gapSide == SingleGapC) { - registry.fill(HIST("event_rap_gap"), 5); - registry.fill(HIST("rap1_mult2"), trackgapA); - } - if (gapSide == DoubleGap) { - registry.fill(HIST("event_rap_gap"), 8); - registry.fill(HIST("rap2_mult2"), trackgapA); - } - } - if (trackDG > 0 && trackextraDG == 0) { - if (gapSide == SingleGapA) { - registry.fill(HIST("event_rap_gap"), 3); - registry.fill(HIST("rap_mult3"), trackDG); - } - if (gapSide == SingleGapC) { - registry.fill(HIST("event_rap_gap"), 6); - registry.fill(HIST("rap1_mult3"), trackDG); - } - if (gapSide == DoubleGap) { - registry.fill(HIST("event_rap_gap"), 9); - registry.fill(HIST("rap2_mult3"), trackDG); - } - } - } - } - - if (rapidityGap) { - if (trackgapC > 0 && trackgapA == 0 && trackextra == 0) { - for (const auto& [t0, t1] : combinations(tracks, tracks)) { - if (!trackselector(t0, parameters) || !trackselector(t1, parameters)) - continue; - if (phi && selectionPIDKaon1(t0) && selectionPIDKaon1(t1)) { - // Apply kaon hypothesis and create pairs - v0.SetCoordinates(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); - v1.SetCoordinates(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassKaonCharged); - v01 = v0 + v1; - // Opposite sign pairs - if (t0.sign() != t1.sign()) { - if (gapSide == SingleGapA) { - registry.fill(HIST("os_kk_mass_rap"), v01.M(), v01.Rapidity(), v01.Pt()); - } - if (gapSide == SingleGapC) { - registry.fill(HIST("os_kk_mass1_rap"), v01.M(), v01.Rapidity(), v01.Pt()); - } - if (gapSide == DoubleGap) { - registry.fill(HIST("os_kk_mass2_rap"), v01.M(), v01.Rapidity(), v01.Pt()); - } - } - if (t0.sign() == t1.sign()) { - if (gapSide == SingleGapA) { - registry.fill(HIST("os_kk_ls_mass_rap"), v01.M(), v01.Rapidity(), v01.Pt()); - } - if (gapSide == SingleGapC) { - registry.fill(HIST("os_kk_ls_mass1_rap"), v01.M(), v01.Rapidity(), v01.Pt()); - } - if (gapSide == DoubleGap) { - registry.fill(HIST("os_kk_ls_mass2_rap"), v01.M(), v01.Rapidity(), v01.Pt()); - } - } - } - } - for (const auto& [t0, t1] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks, tracks))) { - if (!trackselector(t0, parameters) || !trackselector(t1, parameters)) - continue; - if (t0.globalIndex() == t1.globalIndex()) - continue; - if (kstar && selectionPIDKaon1(t0) && selectionPIDPion1(t1)) { - // Apply kaon hypothesis and create pairs - v0.SetCoordinates(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); - v1.SetCoordinates(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); - v01 = v0 + v1; - // Opposite sign pairs - if (t0.sign() != t1.sign()) { - if (gapSide == SingleGapA) { - registry.fill(HIST("os_kp_mass_rap"), v01.M(), v01.Rapidity(), v01.Pt()); - } - if (gapSide == SingleGapC) { - registry.fill(HIST("os_kp_mass1_rap"), v01.M(), v01.Rapidity(), v01.Pt()); - } - if (gapSide == DoubleGap) { - registry.fill(HIST("os_kp_mass2_rap"), v01.M(), v01.Rapidity(), v01.Pt()); - } - } - if (t0.sign() == t1.sign()) { - if (gapSide == SingleGapA) { - registry.fill(HIST("os_kp_ls_mass_rap"), v01.M(), v01.Rapidity(), v01.Pt()); - } - if (gapSide == SingleGapC) { - registry.fill(HIST("os_kp_ls_mass1_rap"), v01.M(), v01.Rapidity(), v01.Pt()); - } - if (gapSide == DoubleGap) { - registry.fill(HIST("os_kp_ls_mass2_rap"), v01.M(), v01.Rapidity(), v01.Pt()); - } - } - } - } - } - - if (trackgapC == 0 && trackgapA > 0 && trackextra == 0) { - for (const auto& [t0, t1] : combinations(tracks, tracks)) { - if (!trackselector(t0, parameters) || !trackselector(t1, parameters)) - continue; - if (phi && selectionPIDKaon1(t0) && selectionPIDKaon1(t1)) { - // Apply kaon hypothesis and create pairs - v0.SetCoordinates(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); - v1.SetCoordinates(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassKaonCharged); - v01 = v0 + v1; - // Opposite sign pairs - if (t0.sign() != t1.sign()) { - if (gapSide == SingleGapA) { - registry.fill(HIST("os_kk_mass_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); - } - if (gapSide == SingleGapC) { - registry.fill(HIST("os_kk_mass1_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); - } - if (gapSide == DoubleGap) { - registry.fill(HIST("os_kk_mass2_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); - } - } - if (t0.sign() == t1.sign()) { - if (gapSide == SingleGapA) { - registry.fill(HIST("os_kk_ls_mass_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); - } - if (gapSide == SingleGapC) { - registry.fill(HIST("os_kk_ls_mass1_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); - } - if (gapSide == DoubleGap) { - registry.fill(HIST("os_kk_ls_mass2_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); - } - } - } - } - for (const auto& [t0, t1] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks, tracks))) { - if (!trackselector(t0, parameters) || !trackselector(t1, parameters)) - continue; - if (t0.globalIndex() == t1.globalIndex()) - continue; - if (kstar && selectionPIDKaon1(t0) && selectionPIDPion1(t1)) { - // Apply kaon hypothesis and create pairs - v0.SetCoordinates(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); - v1.SetCoordinates(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); - v01 = v0 + v1; - // Opposite sign pairs - if (t0.sign() != t1.sign()) { - if (gapSide == SingleGapA) { - registry.fill(HIST("os_kp_mass_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); - } - if (gapSide == SingleGapC) { - registry.fill(HIST("os_kp_mass1_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); - } - if (gapSide == DoubleGap) { - registry.fill(HIST("os_kp_mass2_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); - } - } - if (t0.sign() == t1.sign()) { - if (gapSide == SingleGapA) { - registry.fill(HIST("os_kp_ls_mass_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); - } - if (gapSide == SingleGapC) { - registry.fill(HIST("os_kp_ls_mass1_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); - } - if (gapSide == DoubleGap) { - registry.fill(HIST("os_kp_ls_mass2_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); - } - } - } - } - } - if (trackDG > 0 && trackextraDG == 0) { - for (const auto& [t0, t1] : combinations(tracks, tracks)) { - if (!trackselector(t0, parameters) || !trackselector(t1, parameters)) - continue; - if (phi && selectionPIDKaon1(t0) && selectionPIDKaon1(t1)) { - // Apply kaon hypothesis and create pairs - v0.SetCoordinates(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); - v1.SetCoordinates(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassKaonCharged); - v01 = v0 + v1; - // Opposite sign pairs - if (t0.sign() != t1.sign()) { - if (gapSide == SingleGapA) { - registry.fill(HIST("os_kk_mass_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); - } - if (gapSide == SingleGapC) { - registry.fill(HIST("os_kk_mass1_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); - } - if (gapSide == DoubleGap) { - registry.fill(HIST("os_kk_mass2_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); - } - } - if (t0.sign() == t1.sign()) { - if (gapSide == SingleGapA) { - registry.fill(HIST("os_kk_ls_mass_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); - } - if (gapSide == SingleGapC) { - registry.fill(HIST("os_kk_ls_mass1_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); - } - if (gapSide == DoubleGap) { - registry.fill(HIST("os_kk_ls_mass2_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); - } - } - } - } - for (const auto& [t0, t1] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks, tracks))) { - if (!trackselector(t0, parameters) || !trackselector(t1, parameters)) - continue; - if (t0.globalIndex() == t1.globalIndex()) - continue; - if (kstar && selectionPIDKaon1(t0) && selectionPIDPion1(t1)) { - // Apply kaon hypothesis and create pairs - v0.SetCoordinates(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); - v1.SetCoordinates(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); - v01 = v0 + v1; - // Opposite sign pairs - if (t0.sign() != t1.sign()) { - if (gapSide == SingleGapA) { - registry.fill(HIST("os_kp_mass_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); - } - if (gapSide == SingleGapC) { - registry.fill(HIST("os_kp_mass1_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); - } - if (gapSide == DoubleGap) { - registry.fill(HIST("os_kp_mass2_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); - } - } - if (t0.sign() == t1.sign()) { - if (gapSide == SingleGapA) { - registry.fill(HIST("os_kp_ls_mass_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); - } - if (gapSide == SingleGapC) { - registry.fill(HIST("os_kp_ls_mass1_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); - } - if (gapSide == DoubleGap) { - registry.fill(HIST("os_kp_ls_mass2_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); - } - } - } - } - } } - for (const auto& [t0, t1] : combinations(tracks, tracks)) { if (!trackselector(t0, parameters) || !trackselector(t1, parameters)) continue; @@ -1182,6 +826,9 @@ struct SginclusivePhiKstarSD { v0.SetCoordinates(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); v1.SetCoordinates(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassKaonCharged); v01 = v0 + v1; + if (rapiditycut && std::abs(v01.Rapidity()) > rapiditycutvalue) + continue; + // Opposite sign pairs if (t0.sign() != t1.sign()) { if (gapSide == SingleGapA) { @@ -1221,6 +868,9 @@ struct SginclusivePhiKstarSD { v0.SetCoordinates(rotkaonPx, rotkaonPy, t0.pz(), o2::constants::physics::MassKaonCharged); v1.SetCoordinates(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassKaonCharged); v01 = v0 + v1; + if (rapiditycut && std::abs(v01.Rapidity()) > rapiditycutvalue) + continue; + if (t0.sign() != t1.sign()) { if (gapSide == SingleGapA) { registry.fill(HIST("os_KK_rot_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); @@ -1245,6 +895,9 @@ struct SginclusivePhiKstarSD { v0.SetCoordinates(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassProton); v1.SetCoordinates(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassKaonCharged); v01 = v0 + v1; + if (rapiditycut && std::abs(v01.Rapidity()) > rapiditycutvalue) + continue; + // Opposite sign pairs if (t0.sign() != t1.sign()) { if (gapSide == SingleGapA) { @@ -1275,6 +928,9 @@ struct SginclusivePhiKstarSD { v0.SetCoordinates(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); v1.SetCoordinates(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); v01 = v0 + v1; + if (rapiditycut && std::abs(v01.Rapidity()) > rapiditycutvalue) + continue; + // Opposite sign pairs if (t0.sign() != t1.sign()) { if (gapSide == SingleGapA) { @@ -1312,6 +968,9 @@ struct SginclusivePhiKstarSD { v0.SetCoordinates(rotkaonPx, rotkaonPy, t0.pz(), o2::constants::physics::MassKaonCharged); v1.SetCoordinates(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); v01 = v0 + v1; + if (rapiditycut && std::abs(v01.Rapidity()) > rapiditycutvalue) + continue; + if (t0.sign() != t1.sign()) { if (gapSide == SingleGapA) { registry.fill(HIST("os_pk_rot_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); @@ -1408,6 +1067,8 @@ struct SginclusivePhiKstarSD { v0.SetCoordinates(track1.px(), track1.py(), track1.pz(), o2::constants::physics::MassKaonCharged); v1.SetCoordinates(track2.px(), track2.py(), track2.pz(), o2::constants::physics::MassKaonCharged); v01 = v0 + v1; + if (rapiditycut && std::abs(v01.Rapidity()) > rapiditycutvalue) + continue; // Opposite sign pairs if (track1.sign() != track2.sign()) { if (truegapSide1 == SingleGapA) { @@ -1416,9 +1077,6 @@ struct SginclusivePhiKstarSD { if (truegapSide1 == SingleGapC) { registry.fill(HIST("os_KK_mix_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (truegapSide1 == DoubleGap) { - registry.fill(HIST("os_KK_mix_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); - } } } } @@ -1431,6 +1089,8 @@ struct SginclusivePhiKstarSD { v0.SetCoordinates(track1.px(), track1.py(), track1.pz(), o2::constants::physics::MassKaonCharged); v1.SetCoordinates(track2.px(), track2.py(), track2.pz(), o2::constants::physics::MassPionCharged); v01 = v0 + v1; + if (rapiditycut && std::abs(v01.Rapidity()) > rapiditycutvalue) + continue; // Opposite sign pairs if (track1.sign() != track2.sign()) { if (truegapSide1 == SingleGapA) { @@ -1439,9 +1099,6 @@ struct SginclusivePhiKstarSD { if (truegapSide1 == SingleGapC) { registry.fill(HIST("os_pk_mix_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (truegapSide1 == DoubleGap) { - registry.fill(HIST("os_pk_mix_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); - } } } } From b32abdcf44410761d566458711ff04d0355bcb3a Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Thu, 25 Sep 2025 11:28:51 +0200 Subject: [PATCH 532/986] [PWGHF] Add deuterons in HF MC TOF PID task (#13117) Co-authored-by: ALICE Action Bot --- PWGHF/TableProducer/mcPidTof.cxx | 37 ++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/PWGHF/TableProducer/mcPidTof.cxx b/PWGHF/TableProducer/mcPidTof.cxx index 3cb4d814318..a310175c789 100644 --- a/PWGHF/TableProducer/mcPidTof.cxx +++ b/PWGHF/TableProducer/mcPidTof.cxx @@ -12,7 +12,7 @@ /// /// \file mcPidTof.cxx /// \author Fabrizio Grosa fabrizio.grosa@cern.ch -/// \brief Task to produce PID tables for TOF split for pi, K, p, copied from https://github.com/AliceO2Group/O2Physics/blob/master/Common/TableProducer/PID/pidTofMerge.cxx +/// \brief Task to produce PID tables for TOF split for pi, K, p, de, copied from https://github.com/AliceO2Group/O2Physics/blob/master/Common/TableProducer/PID/pidTofMerge.cxx /// It works only for MC and adds the possibility to apply postcalibrations for MC. /// @@ -722,6 +722,7 @@ struct tofEventTime { static constexpr int idxPi = 2; static constexpr int idxKa = 3; static constexpr int idxPr = 4; +static constexpr int idxDe = 5; /// Task to produce the response table struct mcPidTof { @@ -729,11 +730,13 @@ struct mcPidTof { Produces tablePIDPi; Produces tablePIDKa; Produces tablePIDPr; + Produces tablePIDDe; // Tables to produce (full) Produces tablePIDFullPi; Produces tablePIDFullKa; Produces tablePIDFullPr; + Produces tablePIDFullDe; // Detector response parameters o2::pid::tof::TOFResoParamsV3 mRespParamsV3; @@ -768,7 +771,7 @@ struct mcPidTof { { mTOFCalibConfig.inheritFromBaseTask(initContext); // Checking the tables are requested in the workflow and enabling them (only pi, K, p) - std::array supportedSpecies = {idxPi, idxKa, idxPr}; + std::array supportedSpecies = {idxPi, idxKa, idxPr, idxDe}; for (auto iSpecie{0u}; iSpecie < supportedSpecies.size(); ++iSpecie) { // First checking tiny int flag = -1; @@ -881,6 +884,14 @@ struct mcPidTof { tablePIDPr); } break; + case idxDe: + if (fullTable) { + tablePIDFullDe(-999.f, -999.f); + } else { + aod::pidutils::packInTable(-999.f, + tablePIDDe); + } + break; default: LOG(fatal) << "Wrong particle ID in makeTableEmpty() for " << (fullTable ? "full" : "tiny") << " tables"; break; @@ -960,6 +971,7 @@ struct mcPidTof { constexpr auto responsePi = ResponseImplementation(); constexpr auto responseKa = ResponseImplementation(); constexpr auto responsePr = ResponseImplementation(); + constexpr auto responseDe = ResponseImplementation(); mTOFCalibConfig.processSetup(mRespParamsV3, ccdb, bcs.iteratorAt(0)); // Update the calibration parameters @@ -1026,6 +1038,16 @@ struct mcPidTof { aod::pidutils::packInTable(nSigma, tablePIDPr); break; } + case idxDe: { + nSigma = responseDe.GetSeparation(mRespParamsV3, trk); + if (enableMcRecalib && trk.has_mcParticle()) { + if (std::abs(trk.mcParticle().pdgCode()) == o2::constants::physics::kDeuteron) { // we rescale only true signal + nSigma = applyMcRecalib(idxPr, trk.pt(), nSigma); // FIXME: currently postcalibrations for protons applied to deuterons, to be checked + } + } + aod::pidutils::packInTable(nSigma, tablePIDDe); + break; + } default: LOG(fatal) << "Wrong particle ID for standard tables"; break; @@ -1070,6 +1092,17 @@ struct mcPidTof { tablePIDFullPr(resolution, nSigma); break; } + case idxDe: { + resolution = responseDe.GetExpectedSigma(mRespParamsV3, trk); + nSigma = responseDe.GetSeparation(mRespParamsV3, trk, resolution); + if (enableMcRecalib && trk.has_mcParticle()) { + if (std::abs(trk.mcParticle().pdgCode()) == o2::constants::physics::kDeuteron) { // we rescale only true signal + nSigma = applyMcRecalib(idxPr, trk.pt(), nSigma); // FIXME: currently postcalibrations for protons applied to deuterons, to be checked + } + } + tablePIDFullDe(resolution, nSigma); + break; + } default: LOG(fatal) << "Wrong particle ID for full tables"; break; From bee859d3c7300cd6cfa1ced28661453d212292fd Mon Sep 17 00:00:00 2001 From: blacwovie Date: Thu, 25 Sep 2025 17:36:12 +0800 Subject: [PATCH 533/986] [PWGCF] fix ME bug and add He3 column (#13112) Co-authored-by: ALICE Action Bot --- .../FemtoNuclei/DataModel/PionNucleiTables.h | 4 ++ .../TableProducer/PiNucleiFemto.cxx | 38 ++++++++++--------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/PWGCF/Femto/FemtoNuclei/DataModel/PionNucleiTables.h b/PWGCF/Femto/FemtoNuclei/DataModel/PionNucleiTables.h index 6b94b6a105c..eb99608b5b8 100644 --- a/PWGCF/Femto/FemtoNuclei/DataModel/PionNucleiTables.h +++ b/PWGCF/Femto/FemtoNuclei/DataModel/PionNucleiTables.h @@ -30,7 +30,9 @@ DECLARE_SOA_COLUMN(PtNu, ptNu, float); DECLARE_SOA_COLUMN(EtaNu, etaNu, float); DECLARE_SOA_COLUMN(PhiNu, phiNu, float); DECLARE_SOA_COLUMN(PtHyp, ptHyp, float); +DECLARE_SOA_COLUMN(PtHe3, ptHe3, float); DECLARE_SOA_COLUMN(EtaHyp, etaHyp, float); +DECLARE_SOA_COLUMN(EtaHe3, etaHe3, float); DECLARE_SOA_COLUMN(PhiHyp, phiHyp, float); DECLARE_SOA_COLUMN(PtPi, ptPi, float); DECLARE_SOA_COLUMN(EtaPi, etaPi, float); @@ -105,6 +107,8 @@ DECLARE_SOA_TABLE(PionNucleiTable, "AOD", "PINUCLEITABLE", DECLARE_SOA_TABLE(PionHyperTable, "AOD", "PIHYPERTABLE", pion_nuclei_tables::PtHyp, pion_nuclei_tables::EtaHyp, + pion_nuclei_tables::PtHe3, + pion_nuclei_tables::EtaHe3, pion_nuclei_tables::PhiHyp, pion_nuclei_tables::PtPi, pion_nuclei_tables::EtaPi, diff --git a/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx b/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx index 74f0746732c..77bc5ae2c0e 100644 --- a/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx +++ b/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx @@ -104,6 +104,8 @@ struct PiNucandidate { std::array momNu = {99.f, 99.f, 99.f}; std::array momPi = {99.f, 99.f, 99.f}; + float ptHe3 = 1.f; + float etaHe3 = 1.f; float signNu = 1.f; float signPi = 1.f; float invMass = -10.f; @@ -159,6 +161,8 @@ struct PiNucleiFemto { Configurable settingCutPtMinDePi{"settingCutPtMinDePi", 0.0f, "Minimum PT cut on DePi4"}; Configurable settingCutClSizeItsDe{"settingCutClSizeItsDe", 4.0f, "Minimum ITS cluster size for De"}; Configurable settingCutNCls{"settingCutNCls", 5.0f, "Minimum ITS Ncluster for tracks"}; + Configurable settingCutTPCChi2He{"settingCutTPCChi2He", 0.0f, "Minimum tpcChi2He for Hyper He3"}; + Configurable settingCutAverClsSizeHe{"settingCutAverClsSizeHe", 0.0f, "Minimum averClusSizeHe for Hyper He3"}; Configurable settingCutChi2NClITS{"settingCutChi2NClITS", 999.f, "Maximum ITS Chi2 for tracks"}; Configurable settingCutNsigmaTPCPi{"settingCutNsigmaTPCPi", 3.0f, "Value of the TPC Nsigma cut on Pi"}; Configurable settingCutNsigmaTPCDe{"settingCutNsigmaTPCDe", 2.5f, "Value of the TPC Nsigma cut on De"}; @@ -231,7 +235,7 @@ struct PiNucleiFemto { "QA", {{"hVtxZ", "Vertex distribution in Z;Z (cm)", {HistType::kTH1F, {{400, -20.0, 20.0}}}}, {"hNcontributor", "Number of primary vertex contributor", {HistType::kTH1F, {{2000, 0.0f, 2000.0f}}}}, - {"hCentrality", "Centrality", {HistType::kTH1F, {{200, 0.0f, 100.0f}}}}, + {"hCentrality", "Centrality", {HistType::kTH1F, {{100, 0.0f, 100.0f}}}}, {"hTrackSel", "Accepted tracks", {HistType::kTH1F, {{Selections::kAll, -0.5, static_cast(Selections::kAll) - 0.5}}}}, {"hEvents", "; Events;", {HistType::kTH1F, {{3, -0.5, 2.5}}}}, {"hEmptyPool", "svPoolCreator did not find track pairs false/true", {HistType::kTH1F, {{2, -0.5, 1.5}}}}, @@ -562,15 +566,15 @@ struct PiNucleiFemto { bool selectionPIDHyper(const aod::DataHypCandsWColl::iterator& V0Hyper) { mQaRegistry.fill(HIST("hHe3P_preselected"), V0Hyper.tpcMomHe()); - /*float averClusSizeHe = averageClusterSizeCosl(V0Hyper.itsClusterSizesHe(), V0Hyper.etaHe3()); - if (averClusSizeHe <= 4) { + float averClusSizeHe = averageClusterSizeCosl(V0Hyper.itsClusterSizesHe(), V0Hyper.etaHe3()); + if (averClusSizeHe <= settingCutAverClsSizeHe) { return false; } - if (V0Hyper.tpcChi2He() <= 0.5) { + if (V0Hyper.tpcChi2He() <= settingCutTPCChi2He) { return false; } mQaRegistry.fill(HIST("hHe3P"), V0Hyper.tpcMomHe()); - mQaRegistry.fill(HIST("hHe3TPCnsigma"), V0Hyper.nSigmaHe());*/ + mQaRegistry.fill(HIST("hHe3TPCnsigma"), V0Hyper.ptHe3(), V0Hyper.nSigmaHe()); return true; } @@ -720,10 +724,6 @@ struct PiNucleiFemto { if (settingCutInvMass > 0 && invMass > settingCutInvMass) { return false; } - float ptDePi = std::hypot(piHypercand.momNu[0] + piHypercand.momPi[0], piHypercand.momNu[1] + piHypercand.momPi[1]); - if (ptDePi < settingCutPtMinDePi) { - return false; - } piHypercand.signPi = trackPi.sign(); if (V0Hyper.isMatter()) { @@ -731,7 +731,8 @@ struct PiNucleiFemto { } else { piHypercand.signNu = -1; } - + piHypercand.etaHe3 = V0Hyper.etaHe3(); + piHypercand.ptHe3 = V0Hyper.ptHe3(); piHypercand.dcaxyPi = trackPi.dcaXY(); piHypercand.dcazPi = trackPi.dcaZ(); piHypercand.tpcSignalPi = trackPi.tpcSignal(); @@ -830,8 +831,8 @@ struct PiNucleiFemto { mQaRegistry.fill(HIST("hTrackSel"), Selections::kPID); SVCand pair; - pair.tr0Idx = piTrack.globalIndex(); - pair.tr1Idx = V0Hyper.globalIndex(); + pair.tr0Idx = V0Hyper.globalIndex(); + pair.tr1Idx = piTrack.globalIndex(); const int collIdx = V0Hyper.collisionId(); CollBracket collBracket{collIdx, collIdx}; pair.collBracket = collBracket; @@ -935,6 +936,8 @@ struct PiNucleiFemto { mOutputHyperDataTable( piNucand.recoPtNu(), piNucand.recoEtaNu(), + piNucand.ptHe3, + piNucand.etaHe3, piNucand.recoPhiNu(), piNucand.recoPtPi(), piNucand.recoEtaPi(), @@ -1089,14 +1092,15 @@ struct PiNucleiFemto { { for (const auto& trackPair : mTrackHypPairs) { - auto v0hyper = V0Hypers.rawIteratorAt(trackPair.tr1Idx); - auto piTrack = piTracks.rawIteratorAt(trackPair.tr0Idx); + auto v0hyper = V0Hypers.rawIteratorAt(trackPair.tr0Idx); + auto piTrack = piTracks.rawIteratorAt(trackPair.tr1Idx); // auto collBracket = trackPair.collBracket; PiNucandidate piNucand; if (!fillCandidateInfoHyper(v0hyper, piTrack, piNucand, isMixedEvent)) { continue; } + mQaRegistry.fill(HIST("hNuPt"), piNucand.recoPtNu()); mQaRegistry.fill(HIST("hPiPt"), piNucand.recoPtPi()); mQaRegistry.fill(HIST("hNuEta"), piNucand.recoEtaNu()); @@ -1220,14 +1224,15 @@ PROCESS_SWITCH(PiNucleiFemto, processMixedEventHyper, "Process Mixed event", fal void processMixedEventHyperPool(const CollisionsFull& collisions, o2::aod::DataHypCandsWColl const& V0Hypers, const TrackCandidates& pitracks) { - LOG(info) << "Processing mixed event for hypertriton"; - mTrackHypPairs.clear(); if (!isInitialized) { initializePools(); LOG(info) << "Initialized event pool with size = " << All_Event_pool.size(); } for (auto const& collision : collisions) { + mQaRegistry.fill(HIST("hNcontributor"), collision.numContrib()); + mQaRegistry.fill(HIST("hCentrality"), collision.centFT0C()); + mQaRegistry.fill(HIST("hVtxZ"), collision.posZ()); int poolIndexPi = where_pool(collision.posZ(), collision.centFT0C()); auto& pool = All_Event_pool[poolIndexPi]; @@ -1247,7 +1252,6 @@ PROCESS_SWITCH(PiNucleiFemto, processMixedEventHyper, "Process Mixed event", fal tracks1.push_back(t); } } - std::vector hypers2; for (auto const& h : V0Hypers) { if (h.collisionId() != c2.globalIndex()) From 6a63dffd3d119026caf929f07dd2570b6f0856a2 Mon Sep 17 00:00:00 2001 From: Lucia Anna Tarasovicova Date: Thu, 25 Sep 2025 12:43:05 +0200 Subject: [PATCH 534/986] [PWGLF] PWGLF change in hStrangeCorrelation.cxx (#13122) Co-authored-by: Lucia Anna Tarasovicova --- PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx b/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx index 0d893c9d789..2d0508cbe09 100644 --- a/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx +++ b/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx @@ -584,7 +584,7 @@ struct HStrangeCorrelation { previousContent = hist->GetBinContent(bin); previousError2 = hist->GetBinError2(bin); currentContent = previousContent + etaWeight * purity / (efficiency); - currentError2 = previousError2 + std::pow(etaWeight * totalPurityUncert / (efficiency), 2) + std::pow(totalEffUncert * purity * etaWeight, 2) / std::pow(efficiency, 4); + currentError2 = previousError2 + std::pow(etaWeight * purity / (efficiency), 2) + std::pow(etaWeight * totalPurityUncert / (efficiency), 2) + std::pow(totalEffUncert * purity * etaWeight, 2) / std::pow(efficiency, 4); hist->SetBinContent(bin, currentContent); hist->SetBinError2(bin, currentError2); } From c749b9e5fdc8ff77b904e28adceed6db0c22405b Mon Sep 17 00:00:00 2001 From: Chiara De Martin <39315597+ChiaraDeMartin95@users.noreply.github.com> Date: Thu, 25 Sep 2025 13:44:26 +0200 Subject: [PATCH 535/986] [PWGLF] increase number of bins in resolution plots (#13118) Co-authored-by: Chiara De Martin --- .../TableProducer/Strangeness/cascadeflow.cxx | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx index c4eb59956d2..30c5ece7267 100644 --- a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx @@ -729,20 +729,21 @@ struct cascadeFlow { const AxisSpec ptAxisLambda{static_cast((V0Configs.MaxPtV0 - V0Configs.MinPtV0) / 0.2), V0Configs.MinPtV0, V0Configs.MaxPtV0, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec v2Axis{200, -1., 1., "#it{v}_{2}"}; const AxisSpec CentAxis{20, 0., 100., "FT0C centrality percentile"}; + const AxisSpec CentAxisPerCent{100, 0., 100., "Percent FT0C centrality percentile"}; TString hNEventsLabels[10] = {"All", "sel8", "z vrtx", "kNoSameBunchPileup", "kIsGoodZvtxFT0vsPV", "trackOccupancyInTimeRange", "kNoCollInTimeRange", "kNoCollInROF", "kTVXinTRD", "kIsGoodEventEP"}; TString hNEventsLabelsMC[6] = {"All", "z vtx", ">=1RecoColl", "1Reco", "2Reco", "EvSelected"}; TString hNCascLabelsMC[8] = {"All Xi", "all Omega", "Xi: has MC coll", "Om: has MC coll", "Xi: isPrimary", "Om: is Primary", "Xi: |eta|<0.8", "Om: |eta| < 0.8"}; - resolution.add("QVectorsT0CTPCA", "QVectorsT0CTPCA", HistType::kTH2F, {axisQVs, CentAxis}); - resolution.add("QVectorsT0CTPCC", "QVectorsT0CTPCC", HistType::kTH2F, {axisQVs, CentAxis}); - resolution.add("QVectorsTPCAC", "QVectorsTPCAC", HistType::kTH2F, {axisQVs, CentAxis}); - resolution.add("QVectorsNormT0CTPCA", "QVectorsNormT0CTPCA", HistType::kTH2F, {axisQVsNorm, CentAxis}); - resolution.add("QVectorsNormT0CTPCC", "QVectorsNormT0CTPCC", HistType::kTH2F, {axisQVsNorm, CentAxis}); - resolution.add("QVectorsNormTPCAC", "QVectorsNormTPCCB", HistType::kTH2F, {axisQVsNorm, CentAxis}); - resolution.add("QVectorsSpecPlane", "QVectorsSpecPlane", HistType::kTH2F, {axisQVsNorm, CentAxis}); - resolution.add("QVectorsT0CTPCA_Shifted", "QVectorsT0CTPCA_Shifted", HistType::kTH2F, {axisQVs, CentAxis}); - resolution.add("QVectorsT0CTPCC_Shifted", "QVectorsT0CTPCC_Shifted", HistType::kTH2F, {axisQVs, CentAxis}); - resolution.add("QVectorsTPCAC_Shifted", "QVectorsTPCAC_Shifted", HistType::kTH2F, {axisQVs, CentAxis}); + resolution.add("QVectorsT0CTPCA", "QVectorsT0CTPCA", HistType::kTH2F, {axisQVs, CentAxisPerCent}); + resolution.add("QVectorsT0CTPCC", "QVectorsT0CTPCC", HistType::kTH2F, {axisQVs, CentAxisPerCent}); + resolution.add("QVectorsTPCAC", "QVectorsTPCAC", HistType::kTH2F, {axisQVs, CentAxisPerCent}); + resolution.add("QVectorsNormT0CTPCA", "QVectorsNormT0CTPCA", HistType::kTH2F, {axisQVsNorm, CentAxisPerCent}); + resolution.add("QVectorsNormT0CTPCC", "QVectorsNormT0CTPCC", HistType::kTH2F, {axisQVsNorm, CentAxisPerCent}); + resolution.add("QVectorsNormTPCAC", "QVectorsNormTPCCB", HistType::kTH2F, {axisQVsNorm, CentAxisPerCent}); + resolution.add("QVectorsSpecPlane", "QVectorsSpecPlane", HistType::kTH2F, {axisQVsNorm, CentAxisPerCent}); + resolution.add("QVectorsT0CTPCA_Shifted", "QVectorsT0CTPCA_Shifted", HistType::kTH2F, {axisQVs, CentAxisPerCent}); + resolution.add("QVectorsT0CTPCC_Shifted", "QVectorsT0CTPCC_Shifted", HistType::kTH2F, {axisQVs, CentAxisPerCent}); + resolution.add("QVectorsTPCAC_Shifted", "QVectorsTPCAC_Shifted", HistType::kTH2F, {axisQVs, CentAxisPerCent}); histos.add("ShiftFT0C", "ShiftFT0C", kTProfile3D, {CentAxis, basisAxis, shiftAxis}); histos.add("ShiftTPCL", "ShiftTPCL", kTProfile3D, {CentAxis, basisAxis, shiftAxis}); From 369184db0b1679de790560ebeb0258696c6a8dd3 Mon Sep 17 00:00:00 2001 From: Noor Koster <82090643+cnkoster@users.noreply.github.com> Date: Thu, 25 Sep 2025 15:02:39 +0200 Subject: [PATCH 536/986] =?UTF-8?q?[PWGCF]=20zdcQVectors:=20Change=20proce?= =?UTF-8?q?dure=20for=20getting=20shift=20correction=20from=20CCDB=20?= =?UTF-8?q?=E2=80=A6=20(#13123)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: ALICE Action Bot --- PWGCF/Flow/TableProducer/zdcQVectors.cxx | 36 +++++++++++++----------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/PWGCF/Flow/TableProducer/zdcQVectors.cxx b/PWGCF/Flow/TableProducer/zdcQVectors.cxx index ac108c7098c..a69de55ff13 100644 --- a/PWGCF/Flow/TableProducer/zdcQVectors.cxx +++ b/PWGCF/Flow/TableProducer/zdcQVectors.cxx @@ -191,7 +191,6 @@ struct ZdcQVectors { TProfile3D* shiftprofileC = nullptr; TProfile3D* shiftprofileA = nullptr; - bool isShiftProfileFound = false; } cal; @@ -640,6 +639,10 @@ struct ZdcQVectors { cal.calibfilesLoaded[2] = false; cal.calibList[2] = nullptr; + + cal.isShiftProfileFound = false; + cal.shiftprofileC = nullptr; + cal.shiftprofileA = nullptr; } const auto& zdcCol = foundBC.zdc(); @@ -922,19 +925,17 @@ struct ZdcQVectors { double deltaPsiZDCA = 0; double deltaPsiZDCC = 0; - if (!cfgCCDBdir_Shift.value.empty()) { - if (lastRunNumber != runnumber) { + if (!cfgCCDBdir_Shift.value.empty() && cal.isShiftProfileFound == false) { + LOGF(info, "Getting shift profile from CCDB for runnumber: %d", runnumber); + TList* hcorrList = ccdb->getForTimeStamp(cfgCCDBdir_Shift.value, foundBC.timestamp()); + cal.shiftprofileC = reinterpret_cast(hcorrList->FindObject("ShiftZDCC")); + cal.shiftprofileA = reinterpret_cast(hcorrList->FindObject("ShiftZDCA")); + if (!cal.shiftprofileC || !cal.shiftprofileA) { + LOGF(error, "Shift profile not found in CCDB for runnumber: %d", runnumber); cal.isShiftProfileFound = false; - LOGF(info, "Getting shift profile from CCDB for runnumber: %d", runnumber); - TList* hcorrList = ccdb->getForTimeStamp(cfgCCDBdir_Shift.value, foundBC.timestamp()); - cal.shiftprofileC = reinterpret_cast(hcorrList->FindObject("ShiftZDCC")); - cal.shiftprofileA = reinterpret_cast(hcorrList->FindObject("ShiftZDCA")); - if (!cal.shiftprofileC || !cal.shiftprofileA) { - LOGF(error, "Shift profile not found in CCDB for runnumber: %d", runnumber); - } else { - LOGF(error, "Shift profile found in CCDB for runnumber: %d", runnumber); - cal.isShiftProfileFound = true; - } + } else { + LOGF(info, "Shift profile found in CCDB for runnumber: %d", runnumber); + cal.isShiftProfileFound = true; } } @@ -950,8 +951,8 @@ struct ZdcQVectors { float coeffshiftxZDCA = 0.0; float coeffshiftyZDCA = 0.0; - for (int ishift = 1; ishift <= nshift; ishift++) { - if (cal.isShiftProfileFound) { + if (cal.isShiftProfileFound) { + for (int ishift = 1; ishift <= nshift; ishift++) { int binshiftxZDCC = cal.shiftprofileC->FindBin(centrality, 0.5, ishift - 0.5); // bin 0.5 int binshiftyZDCC = cal.shiftprofileC->FindBin(centrality, 1.5, ishift - 0.5); int binshiftxZDCA = cal.shiftprofileA->FindBin(centrality, 0.5, ishift - 0.5); @@ -965,9 +966,10 @@ struct ZdcQVectors { coeffshiftxZDCA = cal.shiftprofileA->GetBinContent(binshiftxZDCA); if (binshiftyZDCA > 0) coeffshiftyZDCA = cal.shiftprofileA->GetBinContent(binshiftyZDCA); + + deltaPsiZDCC += ((2 / (1.0 * ishift)) * (-1.0 * coeffshiftxZDCC * std::cos(ishift * 1.0 * psiZDCC) + coeffshiftyZDCC * std::sin(ishift * 1.0 * psiZDCC))); + deltaPsiZDCA += ((2 / (1.0 * ishift)) * (-1.0 * coeffshiftxZDCA * std::cos(ishift * 1.0 * psiZDCA) + coeffshiftyZDCA * std::sin(ishift * 1.0 * psiZDCA))); } - deltaPsiZDCC += ((2 / (1.0 * ishift)) * (-1.0 * coeffshiftxZDCC * std::cos(ishift * 1.0 * psiZDCC) + coeffshiftyZDCC * std::sin(ishift * 1.0 * psiZDCC))); - deltaPsiZDCA += ((2 / (1.0 * ishift)) * (-1.0 * coeffshiftxZDCA * std::cos(ishift * 1.0 * psiZDCA) + coeffshiftyZDCA * std::sin(ishift * 1.0 * psiZDCA))); } psiZDCCshift += deltaPsiZDCC; From 66b051fab7a7ef79fedb6b2871c76d6f5cddf461 Mon Sep 17 00:00:00 2001 From: mcoquet642 <74600025+mcoquet642@users.noreply.github.com> Date: Thu, 25 Sep 2025 16:46:09 +0200 Subject: [PATCH 537/986] [PWGDQ] New muon ML method and implementation in tableMaker (#13107) Co-authored-by: Maurice Coquet Co-authored-by: Maurice Coquet Co-authored-by: ALICE Action Bot --- PWGDQ/Core/MuonMatchingMlResponse.h | 56 +++++++- PWGDQ/Core/VarManager.cxx | 7 +- PWGDQ/Core/VarManager.h | 131 ++++++++---------- .../TableProducer/tableMakerMC_withAssoc.cxx | 41 +++++- PWGDQ/TableProducer/tableMaker_withAssoc.cxx | 67 ++++++++- 5 files changed, 220 insertions(+), 82 deletions(-) diff --git a/PWGDQ/Core/MuonMatchingMlResponse.h b/PWGDQ/Core/MuonMatchingMlResponse.h index 1c36f26ab5d..a77deb53397 100644 --- a/PWGDQ/Core/MuonMatchingMlResponse.h +++ b/PWGDQ/Core/MuonMatchingMlResponse.h @@ -40,6 +40,16 @@ break; \ } +// Check if the index of mCachedIndices (index associated to a FEATURE) +// matches the entry in EnumInputFeatures associated to this FEATURE +// if so, the inputFeatures vector is filled with the FEATURE's value +// by calling the corresponding GETTER=FEATURE from track +#define CHECK_AND_FILL_MUONGLOB_TRACK(FEATURE, GETTER) \ + case static_cast(InputFeaturesMFTMuonMatch::FEATURE): { \ + inputFeature = muonglob.GETTER(); \ + break; \ + } + // Check if the index of mCachedIndices (index associated to a FEATURE) // matches the entry in EnumInputFeatures associated to this FEATURE // if so, the inputFeatures vector is filled with the FEATURE's value @@ -112,6 +122,7 @@ enum class InputFeaturesMFTMuonMatch : uint8_t { nClustersMCH, chi2MCH, pdca, + Rabs, cXXMFT, cXYMFT, cYYMFT, @@ -164,7 +175,8 @@ enum class InputFeaturesMFTMuonMatch : uint8_t { centFT0M, centFT0A, centFT0C, - chi2MCHMFT + chi2MCHMFT, + chi2GlobMUON }; template @@ -251,6 +263,33 @@ class MlResponseMFTMuonMatch : public MlResponse return inputFeature; } + template + float returnFeatureGlob(uint8_t idx, T1 const& muonglob, T2 const& muon, T3 const& mft, C1 const& mftcov, U const& collision) + { + float inputFeature = 0.; + switch (idx) { + CHECK_AND_FILL_MFT_TRACK(xMFT, getX); + CHECK_AND_FILL_MFT_TRACK(yMFT, getY); + CHECK_AND_FILL_MFT_TRACK(qOverptMFT, getInvQPt); + CHECK_AND_FILL_MFT_TRACK(tglMFT, getTanl); + CHECK_AND_FILL_MFT_TRACK(phiMFT, getPhi); + CHECK_AND_FILL_MFT_TRACK(chi2MFT, getTrackChi2); + CHECK_AND_FILL_MUON_TRACK(xMCH, getX); + CHECK_AND_FILL_MUON_TRACK(yMCH, getY); + CHECK_AND_FILL_MUON_TRACK(qOverptMCH, getInvQPt); + CHECK_AND_FILL_MUON_TRACK(tglMCH, getTanl); + CHECK_AND_FILL_MUON_TRACK(phiMCH, getPhi); + CHECK_AND_FILL_MUON_TRACK(chi2MCH, getTrackChi2); + CHECK_AND_FILL_MUONGLOB_TRACK(chi2MCHMFT, chi2MatchMCHMFT); + CHECK_AND_FILL_MUONGLOB_TRACK(chi2GlobMUON, chi2); + CHECK_AND_FILL_MUONGLOB_TRACK(Rabs, rAtAbsorberEnd); + // Below are dummy files to remove warning of unused parameters + CHECK_AND_FILL_MFTMUON_COLLISION(posZ); + CHECK_AND_FILL_MFT_COV(cXXMFT, cXX); + } + return inputFeature; + } + template float returnFeatureTest(uint8_t idx, T1 const& muon) { @@ -286,6 +325,17 @@ class MlResponseMFTMuonMatch : public MlResponse return inputFeatures; } + template + std::vector getInputFeaturesGlob(T1 const& muonglob, T2 const& muon, T3 const& mft, C1 const& mftcov, U const& collision) + { + std::vector inputFeatures; + for (const auto& idx : MlResponse::mCachedIndices) { + float inputFeature = returnFeatureGlob(idx, muonglob, muon, mft, mftcov, collision); + inputFeatures.emplace_back(inputFeature); + } + return inputFeatures; + } + /// Method to get the value of variable chosen for binning /// \param track is the single track, \param collision is the collision /// \return binning variable @@ -328,6 +378,7 @@ class MlResponseMFTMuonMatch : public MlResponse FILL_MAP_MFTMUON_MATCH(nClustersMCH), FILL_MAP_MFTMUON_MATCH(chi2MCH), FILL_MAP_MFTMUON_MATCH(pdca), + FILL_MAP_MFTMUON_MATCH(Rabs), FILL_MAP_MFTMUON_MATCH(cXXMFT), FILL_MAP_MFTMUON_MATCH(cXYMFT), FILL_MAP_MFTMUON_MATCH(cYYMFT), @@ -358,7 +409,8 @@ class MlResponseMFTMuonMatch : public MlResponse FILL_MAP_MFTMUON_MATCH(c1PtPhiMCH), FILL_MAP_MFTMUON_MATCH(c1PtTglMCH), FILL_MAP_MFTMUON_MATCH(c1Pt21Pt2MCH), - FILL_MAP_MFTMUON_MATCH(chi2MCHMFT)}; + FILL_MAP_MFTMUON_MATCH(chi2MCHMFT), + FILL_MAP_MFTMUON_MATCH(chi2GlobMUON)}; } uint8_t mCachedIndexBinning; // index correspondance between configurable and available input features diff --git a/PWGDQ/Core/VarManager.cxx b/PWGDQ/Core/VarManager.cxx index eb263b73373..4a5769e0560 100644 --- a/PWGDQ/Core/VarManager.cxx +++ b/PWGDQ/Core/VarManager.cxx @@ -27,6 +27,7 @@ std::map VarManager::fgVarNamesMap; bool VarManager::fgUsedVars[VarManager::kNVars] = {false}; bool VarManager::fgUsedKF = false; float VarManager::fgMagField = 0.5; +float VarManager::fgzMatching = -77.5; float VarManager::fgValues[VarManager::kNVars] = {0.0f}; float VarManager::fgTPCInterSectorBoundary = 1.0; // cm int VarManager::fgITSROFbias = 0; @@ -241,7 +242,7 @@ double VarManager::ComputePIDcalibration(int species, double nSigmaValue) default: LOG(fatal) << "Invalid species for PID calibration: " << species; return -999.0; // Return zero if species is invalid - }; + } TH3F* calibMeanHist = reinterpret_cast(fgCalibs[calibMean]); TH3F* calibSigmaHist = reinterpret_cast(fgCalibs[calibSigma]); @@ -291,7 +292,7 @@ double VarManager::ComputePIDcalibration(int species, double nSigmaValue) default: LOG(fatal) << "Invalid species for PID calibration: " << species; return -999.0; // Return zero if species is invalid - }; + } THnF* calibMeanHist = reinterpret_cast(fgCalibs[calibMean]); THnF* calibSigmaHist = reinterpret_cast(fgCalibs[calibSigma]); @@ -345,7 +346,7 @@ double VarManager::ComputePIDcalibration(int species, double nSigmaValue) default: return nSigmaValue; // unknown status, return the original nSigma value break; - }; + } } else { // unknown calibration type, return the original nSigma value LOG(fatal) << "Unknown calibration type: " << fgCalibrationType; diff --git a/PWGDQ/Core/VarManager.h b/PWGDQ/Core/VarManager.h index f5b7b67f16c..1f5f7d0c59c 100644 --- a/PWGDQ/Core/VarManager.h +++ b/PWGDQ/Core/VarManager.h @@ -891,7 +891,8 @@ class VarManager : public TObject // Index used to set different options for Muon propagation kToVertex = 0, // propagtion to vertex by default kToDCA, - kToRabs + kToRabs, + kToMatching }; static TString fgVariableNames[kNVars]; // variable names @@ -938,6 +939,17 @@ class VarManager : public TObject fgMagField = magField; } + // Setup plane position for MFT-MCH matching + static void SetMatchingPlane(float z) + { + fgzMatching = z; + } + + static float GetMatchingPlane() + { + return fgzMatching; + } + // Setup the 2 prong KFParticle static void SetupTwoProngKFParticle(float magField) { @@ -1047,8 +1059,12 @@ class VarManager : public TObject return deltaPsi; } + template + static o2::track::TrackParCovFwd FwdToTrackPar(const T& track, const C& cov); template static o2::dataformats::GlobalFwdTrack PropagateMuon(const T& muon, const C& collision, int endPoint = kToVertex); + template + static o2::track::TrackParCovFwd PropagateFwd(const T& track, const C& cov, float z); template static void FillMuonPDca(const T& muon, const C& collision, float* values = nullptr); template @@ -1208,6 +1224,7 @@ class VarManager : public TObject static void SetVariableDependencies(); // toggle those variables on which other used variables might depend static float fgMagField; + static float fgzMatching; static float fgCenterOfMassEnergy; // collision energy static float fgMassofCollidingParticle; // mass of the colliding particle static float fgTPCInterSectorBoundary; // TPC inter-sector border size at the TPC outer radius, in cm @@ -1252,6 +1269,19 @@ class VarManager : public TObject ClassDef(VarManager, 4); }; +template +o2::track::TrackParCovFwd VarManager::FwdToTrackPar(const T& track, const C& cov) +{ + double chi2 = track.chi2(); + SMatrix5 tpars(track.x(), track.y(), track.phi(), track.tgl(), track.signed1Pt()); + std::vector v1{cov.cXX(), cov.cXY(), cov.cYY(), cov.cPhiX(), cov.cPhiY(), + cov.cPhiPhi(), cov.cTglX(), cov.cTglY(), cov.cTglPhi(), cov.cTglTgl(), + cov.c1PtX(), cov.c1PtY(), cov.c1PtPhi(), cov.c1PtTgl(), cov.c1Pt21Pt2()}; + SMatrix55 tcovs(v1.begin(), v1.end()); + o2::track::TrackParCovFwd trackparCov{track.z(), tpars, tcovs, chi2}; + return trackparCov; +} + template auto VarManager::getRotatedCovMatrixXX(const T& matrix, U phi, V theta) { @@ -1300,13 +1330,7 @@ KFPTrack VarManager::createKFPTrackFromTrack(const T& track) template KFPTrack VarManager::createKFPFwdTrackFromFwdTrack(const T& muon) { - double chi2 = muon.chi2(); - SMatrix5 tpars(muon.x(), muon.y(), muon.phi(), muon.tgl(), muon.signed1Pt()); - std::vector v1{muon.cXX(), muon.cXY(), muon.cYY(), muon.cPhiX(), muon.cPhiY(), - muon.cPhiPhi(), muon.cTglX(), muon.cTglY(), muon.cTglPhi(), muon.cTglTgl(), - muon.c1PtX(), muon.c1PtY(), muon.c1PtPhi(), muon.c1PtTgl(), muon.c1Pt21Pt2()}; - SMatrix55 tcovs(v1.begin(), v1.end()); - o2::track::TrackParCovFwd trackparCov{muon.z(), tpars, tcovs, chi2}; + o2::track::TrackParCovFwd trackparCov = FwdToTrackPar(muon, muon); std::array trk_cov; trackparCov.getCovXYZPxPyPzGlo(trk_cov); @@ -1321,7 +1345,7 @@ KFPTrack VarManager::createKFPFwdTrackFromFwdTrack(const T& muon) kfpTrack.SetCovarianceMatrix(trkcov_KF); kfpTrack.SetCharge(muon.sign()); kfpTrack.SetNDF(muon.nClusters() - 5); - kfpTrack.SetChi2(chi2); + kfpTrack.SetChi2(muon.chi2()); return kfpTrack; } @@ -1340,19 +1364,13 @@ KFPVertex VarManager::createKFPVertexFromCollision(const T& collision) template o2::dataformats::GlobalFwdTrack VarManager::PropagateMuon(const T& muon, const C& collision, const int endPoint) { - double chi2 = muon.chi2(); - SMatrix5 tpars(muon.x(), muon.y(), muon.phi(), muon.tgl(), muon.signed1Pt()); - std::vector v1{muon.cXX(), muon.cXY(), muon.cYY(), muon.cPhiX(), muon.cPhiY(), - muon.cPhiPhi(), muon.cTglX(), muon.cTglY(), muon.cTglPhi(), muon.cTglTgl(), - muon.c1PtX(), muon.c1PtY(), muon.c1PtPhi(), muon.c1PtTgl(), muon.c1Pt21Pt2()}; - SMatrix55 tcovs(v1.begin(), v1.end()); - o2::track::TrackParCovFwd fwdtrack{muon.z(), tpars, tcovs, chi2}; + o2::track::TrackParCovFwd fwdtrack = FwdToTrackPar(muon, muon); o2::dataformats::GlobalFwdTrack propmuon; if (static_cast(muon.trackType()) > 2) { o2::dataformats::GlobalFwdTrack track; - track.setParameters(tpars); + track.setParameters(fwdtrack.getParameters()); track.setZ(fwdtrack.getZ()); - track.setCovariances(tcovs); + track.setCovariances(fwdtrack.getCovariances()); auto mchTrack = mMatching.FwdtoMCH(track); if (endPoint == kToVertex) { @@ -1364,6 +1382,9 @@ o2::dataformats::GlobalFwdTrack VarManager::PropagateMuon(const T& muon, const C if (endPoint == kToRabs) { o2::mch::TrackExtrap::extrapToZ(mchTrack, -505.); } + if (endPoint == kToMatching) { + o2::mch::TrackExtrap::extrapToVertexWithoutBranson(mchTrack, fgzMatching); + } auto proptrack = mMatching.MCHtoFwd(mchTrack); propmuon.setParameters(proptrack.getParameters()); @@ -1384,6 +1405,14 @@ o2::dataformats::GlobalFwdTrack VarManager::PropagateMuon(const T& muon, const C return propmuon; } +template +o2::track::TrackParCovFwd VarManager::PropagateFwd(const T& track, const C& cov, float z) +{ + o2::track::TrackParCovFwd fwdtrack = FwdToTrackPar(track, cov); + fwdtrack.propagateToZhelix(z, fgMagField); + return fwdtrack; +} + template void VarManager::FillMuonPDca(const T& muon, const C& collision, float* values) { @@ -1491,12 +1520,7 @@ void VarManager::FillGlobalMuonRefitCov(T1 const& muontrack, T2 const& mfttrack, if constexpr ((MuonfillMap & MuonCov) > 0) { if constexpr ((MFTfillMap & MFTCov) > 0) { o2::dataformats::GlobalFwdTrack propmuon = PropagateMuon(muontrack, collision); - SMatrix5 tpars(mfttrack.x(), mfttrack.y(), mfttrack.phi(), mfttrack.tgl(), mfttrack.signed1Pt()); - std::vector v1{mftcov.cXX(), mftcov.cXY(), mftcov.cYY(), mftcov.cPhiX(), mftcov.cPhiY(), - mftcov.cPhiPhi(), mftcov.cTglX(), mftcov.cTglY(), mftcov.cTglPhi(), mftcov.cTglTgl(), - mftcov.c1PtX(), mftcov.c1PtY(), mftcov.c1PtPhi(), mftcov.c1PtTgl(), mftcov.c1Pt21Pt2()}; - SMatrix55 tcovs(v1.begin(), v1.end()); - o2::track::TrackParCovFwd mft{mfttrack.z(), tpars, tcovs, mfttrack.chi2()}; + o2::track::TrackParCovFwd mft = FwdToTrackPar(mfttrack, mftcov); o2::dataformats::GlobalFwdTrack globalRefit = o2::aod::fwdtrackutils::refitGlobalMuonCov(propmuon, mft); values[kX] = globalRefit.getX(); @@ -3685,20 +3709,8 @@ void VarManager::FillPairVertexing(C const& collision, T const& t1, T const& t2, procCode = fgFitterTwoProngBarrel.process(pars1, pars2); } else if constexpr ((pairType == kDecayToMuMu) && muonHasCov) { // Initialize track parameters for forward - double chi21 = t1.chi2(); - double chi22 = t2.chi2(); - SMatrix5 t1pars(t1.x(), t1.y(), t1.phi(), t1.tgl(), t1.signed1Pt()); - std::vector v1{t1.cXX(), t1.cXY(), t1.cYY(), t1.cPhiX(), t1.cPhiY(), - t1.cPhiPhi(), t1.cTglX(), t1.cTglY(), t1.cTglPhi(), t1.cTglTgl(), - t1.c1PtX(), t1.c1PtY(), t1.c1PtPhi(), t1.c1PtTgl(), t1.c1Pt21Pt2()}; - SMatrix55 t1covs(v1.begin(), v1.end()); - o2::track::TrackParCovFwd pars1{t1.z(), t1pars, t1covs, chi21}; - SMatrix5 t2pars(t2.x(), t2.y(), t2.phi(), t2.tgl(), t2.signed1Pt()); - std::vector v2{t2.cXX(), t2.cXY(), t2.cYY(), t2.cPhiX(), t2.cPhiY(), - t2.cPhiPhi(), t2.cTglX(), t2.cTglY(), t2.cTglPhi(), t2.cTglTgl(), - t2.c1PtX(), t2.c1PtY(), t2.c1PtPhi(), t2.c1PtTgl(), t2.c1Pt21Pt2()}; - SMatrix55 t2covs(v2.begin(), v2.end()); - o2::track::TrackParCovFwd pars2{t2.z(), t2pars, t2covs, chi22}; + o2::track::TrackParCovFwd pars1 = FwdToTrackPar(t1, t1); + o2::track::TrackParCovFwd pars2 = FwdToTrackPar(t2, t2); procCode = fgFitterTwoProngFwd.process(pars1, pars2); } else { return; @@ -3960,20 +3972,8 @@ void VarManager::FillPairVertexing(C const& collision, T const& t1, T const& t2, } if (propToSV) { if constexpr ((pairType == kDecayToMuMu) && muonHasCov) { - double chi21 = t1.chi2(); - double chi22 = t2.chi2(); - SMatrix5 t1pars(t1.x(), t1.y(), t1.phi(), t1.tgl(), t1.signed1Pt()); - std::vector c1{t1.cXX(), t1.cXY(), t1.cYY(), t1.cPhiX(), t1.cPhiY(), - t1.cPhiPhi(), t1.cTglX(), t1.cTglY(), t1.cTglPhi(), t1.cTglTgl(), - t1.c1PtX(), t1.c1PtY(), t1.c1PtPhi(), t1.c1PtTgl(), t1.c1Pt21Pt2()}; - SMatrix55 t1covs(c1.begin(), c1.end()); - o2::track::TrackParCovFwd pars1{t1.z(), t1pars, t1covs, chi21}; - SMatrix5 t2pars(t2.x(), t2.y(), t2.phi(), t2.tgl(), t2.signed1Pt()); - std::vector c2{t2.cXX(), t2.cXY(), t2.cYY(), t2.cPhiX(), t2.cPhiY(), - t2.cPhiPhi(), t2.cTglX(), t2.cTglY(), t2.cTglPhi(), t2.cTglTgl(), - t2.c1PtX(), t2.c1PtY(), t2.c1PtPhi(), t2.c1PtTgl(), t2.c1Pt21Pt2()}; - SMatrix55 t2covs(c2.begin(), c2.end()); - o2::track::TrackParCovFwd pars2{t2.z(), t2pars, t2covs, chi22}; + o2::track::TrackParCovFwd pars1 = FwdToTrackPar(t1, t1); + o2::track::TrackParCovFwd pars2 = FwdToTrackPar(t2, t2); auto geoMan1 = o2::base::GeometryManager::meanMaterialBudget(t1.x(), t1.y(), t1.z(), KFGeoTwoProng.GetX(), KFGeoTwoProng.GetY(), KFGeoTwoProng.GetZ()); auto geoMan2 = o2::base::GeometryManager::meanMaterialBudget(t2.x(), t2.y(), t2.z(), KFGeoTwoProng.GetX(), KFGeoTwoProng.GetY(), KFGeoTwoProng.GetZ()); @@ -4282,29 +4282,10 @@ void VarManager::FillDileptonTrackVertexing(C const& collision, T1 const& lepton mlepton2 = o2::constants::physics::MassMuon; mtrack = o2::constants::physics::MassMuon; - double chi21 = lepton1.chi2(); - double chi22 = lepton2.chi2(); - double chi23 = track.chi2(); - SMatrix5 t1pars(lepton1.x(), lepton1.y(), lepton1.phi(), lepton1.tgl(), lepton1.signed1Pt()); - std::vector v1{lepton1.cXX(), lepton1.cXY(), lepton1.cYY(), lepton1.cPhiX(), lepton1.cPhiY(), - lepton1.cPhiPhi(), lepton1.cTglX(), lepton1.cTglY(), lepton1.cTglPhi(), lepton1.cTglTgl(), - lepton1.c1PtX(), lepton1.c1PtY(), lepton1.c1PtPhi(), lepton1.c1PtTgl(), lepton1.c1Pt21Pt2()}; - SMatrix55 t1covs(v1.begin(), v1.end()); - o2::track::TrackParCovFwd pars1{lepton1.z(), t1pars, t1covs, chi21}; - - SMatrix5 t2pars(lepton2.x(), lepton2.y(), lepton2.phi(), lepton2.tgl(), lepton2.signed1Pt()); - std::vector v2{lepton2.cXX(), lepton2.cXY(), lepton2.cYY(), lepton2.cPhiX(), lepton2.cPhiY(), - lepton2.cPhiPhi(), lepton2.cTglX(), lepton2.cTglY(), lepton2.cTglPhi(), lepton2.cTglTgl(), - lepton2.c1PtX(), lepton2.c1PtY(), lepton2.c1PtPhi(), lepton2.c1PtTgl(), lepton2.c1Pt21Pt2()}; - SMatrix55 t2covs(v2.begin(), v2.end()); - o2::track::TrackParCovFwd pars2{lepton2.z(), t2pars, t2covs, chi22}; - - SMatrix5 t3pars(track.x(), track.y(), track.phi(), track.tgl(), track.signed1Pt()); - std::vector v3{track.cXX(), track.cXY(), track.cYY(), track.cPhiX(), track.cPhiY(), - track.cPhiPhi(), track.cTglX(), track.cTglY(), track.cTglPhi(), track.cTglTgl(), - track.c1PtX(), track.c1PtY(), track.c1PtPhi(), track.c1PtTgl(), track.c1Pt21Pt2()}; - SMatrix55 t3covs(v3.begin(), v3.end()); - o2::track::TrackParCovFwd pars3{track.z(), t3pars, t3covs, chi23}; + o2::track::TrackParCovFwd pars1 = FwdToTrackPar(lepton1, lepton1); + o2::track::TrackParCovFwd pars2 = FwdToTrackPar(lepton2, lepton2); + o2::track::TrackParCovFwd pars3 = FwdToTrackPar(track, track); + procCode = VarManager::fgFitterThreeProngFwd.process(pars1, pars2, pars3); procCodeJpsi = VarManager::fgFitterTwoProngFwd.process(pars1, pars2); } else if constexpr ((candidateType == kBtoJpsiEEK || candidateType == kDstarToD0KPiPi) && trackHasCov) { diff --git a/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx b/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx index cd38a312311..23cfd2d9042 100644 --- a/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx +++ b/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx @@ -217,6 +217,7 @@ struct TableMakerMC { Configurable fUseML{"cfgUseML", false, "Import ONNX model from ccdb to decide which matching candidates to keep"}; Configurable fMuonMatchEtaMin{"cfgMuonMatchEtaMin", -4.0f, "Definition of the acceptance of muon tracks to be matched with MFT"}; Configurable fMuonMatchEtaMax{"cfgMuonMatchEtaMax", -2.5f, "Definition of the acceptance of muon tracks to be matched with MFT"}; + Configurable fzMatching{"cfgzMatching", -77.5f, "Plane for MFT-MCH matching"}; Configurable> fModelPathsCCDB{"fModelPathsCCDB", std::vector{"Users/m/mcoquet/MLTest"}, "Paths of models on CCDB"}; Configurable> fInputFeatures{"cfgInputFeatures", std::vector{"chi2MCHMFT"}, "Names of ML model input features"}; Configurable> fModelNames{"cfgModelNames", std::vector{"model.onnx"}, "ONNX file names for each pT bin (if not from CCDB full path)"}; @@ -379,6 +380,7 @@ struct TableMakerMC { fCCDB->get(fConfigCCDB.fGeoPath); } fCCDBApi.init(fConfigCCDB.fConfigCcdbUrl.value); + VarManager::SetMatchingPlane(fConfigVariousOptions.fzMatching.value); if (fConfigVariousOptions.fUseML.value) { // TODO : for now we use hard coded values since the current models use 1 pT bin @@ -929,6 +931,36 @@ struct TableMakerMC { } } + template + void skimBestMuonMatchesML(TMuons const& muons, TMFTTracks const& /*mfttracks*/, TMFTCovs const& mfCovs, TEvent const& collision) + { + std::unordered_map> mCandidates; + for (const auto& muon : muons) { + if (static_cast(muon.trackType()) < 2) { + auto muonID = muon.matchMCHTrackId(); + auto muontrack = muon.template matchMCHTrack_as(); + auto muonprop = VarManager::PropagateMuon(muontrack, collision, VarManager::kToMatching); + auto mfttrack = muon.template matchMFTTrack_as(); + auto const& mfttrackcov = mfCovs.rawIteratorAt(map_mfttrackcovs[mfttrack.globalIndex()]); + o2::track::TrackParCovFwd mftprop = VarManager::PropagateFwd(mfttrack, mfttrackcov, VarManager::GetMatchingPlane()); + std::vector output; + std::vector inputML = matchingMlResponse.getInputFeaturesGlob(muon, muonprop, mftprop, mfttrackcov, collision); + matchingMlResponse.isSelectedMl(inputML, 0, output); + float score = output[0]; + if (mCandidates.find(muonID) == mCandidates.end()) { + mCandidates[muonID] = {score, muon.globalIndex()}; + } else { + if (score < mCandidates[muonID].first) { + mCandidates[muonID] = {score, muon.globalIndex()}; + } + } + } + } + for (auto& pairCand : mCandidates) { + fBestMatch[pairCand.second.second] = true; + } + } + template void skimMuons(TEvent const& collision, TMuons const& muons, FwdTrackAssoc const& muonAssocs, aod::McParticles const& mcTracks, TMFTTracks const& /*mftTracks*/, TMFTCovs const& mfCovs) { @@ -1154,6 +1186,7 @@ struct TableMakerMC { fGrpMag = fCCDB->getForTimeStamp(fConfigCCDB.fGrpMagPath, bcs.begin().timestamp()); if (fGrpMag != nullptr) { o2::base::Propagator::initFieldFromGRP(fGrpMag); + VarManager::SetMagneticField(fGrpMag->getNominalL3Field()); } if (fConfigVariousOptions.fPropMuon) { VarManager::SetupMuonMagField(); @@ -1244,7 +1277,13 @@ struct TableMakerMC { if constexpr (static_cast(TMFTFillMap)) { auto groupedMuonIndices = fwdTrackAssocs.sliceBy(fwdtrackIndicesPerCollision, origIdx); if (fConfigVariousOptions.fKeepBestMatch) { - skimBestMuonMatches(muons); + if constexpr (static_cast(TMFTFillMap & VarManager::ObjTypes::MFTCov)) { + if (fConfigVariousOptions.fUseML.value) { + skimBestMuonMatchesML(muons, mftTracks, mftCovs, collision); + } + } else { + skimBestMuonMatches(muons); + } } if constexpr (static_cast(TMFTFillMap & VarManager::ObjTypes::MFTCov)) { skimMuons(collision, muons, groupedMuonIndices, mcParticles, mftTracks, mftCovs); diff --git a/PWGDQ/TableProducer/tableMaker_withAssoc.cxx b/PWGDQ/TableProducer/tableMaker_withAssoc.cxx index 97cf93bfd87..415c237d3ad 100644 --- a/PWGDQ/TableProducer/tableMaker_withAssoc.cxx +++ b/PWGDQ/TableProducer/tableMaker_withAssoc.cxx @@ -21,6 +21,8 @@ #include #include #include +#include +#include #include // other includes #include "PWGDQ/Core/AnalysisCompositeCut.h" @@ -28,6 +30,7 @@ #include "PWGDQ/Core/CutsLibrary.h" #include "PWGDQ/Core/HistogramManager.h" #include "PWGDQ/Core/HistogramsLibrary.h" +#include "PWGDQ/Core/MuonMatchingMlResponse.h" #include "PWGDQ/Core/VarManager.h" #include "PWGDQ/DataModel/ReducedInfoTables.h" @@ -255,8 +258,13 @@ struct TableMaker { Configurable fPropMuon{"cfgPropMuon", true, "Propagate muon tracks through absorber (do not use if applying pairing)"}; Configurable fRefitGlobalMuon{"cfgRefitGlobalMuon", true, "Correct global muon parameters"}; Configurable fKeepBestMatch{"cfgKeepBestMatch", false, "Keep only the best match global muons in the skimming"}; + Configurable fUseML{"cfgUseML", false, "Import ONNX model from ccdb to decide which matching candidates to keep"}; Configurable fMuonMatchEtaMin{"cfgMuonMatchEtaMin", -4.0f, "Definition of the acceptance of muon tracks to be matched with MFT"}; Configurable fMuonMatchEtaMax{"cfgMuonMatchEtaMax", -2.5f, "Definition of the acceptance of muon tracks to be matched with MFT"}; + Configurable fzMatching{"cfgzMatching", -77.5f, "Plane for MFT-MCH matching"}; + Configurable> fModelPathsCCDB{"fModelPathsCCDB", std::vector{"Users/m/mcoquet/MLTest"}, "Paths of models on CCDB"}; + Configurable> fInputFeatures{"cfgInputFeatures", std::vector{"chi2MCHMFT"}, "Names of ML model input features"}; + Configurable> fModelNames{"cfgModelNames", std::vector{"model.onnx"}, "ONNX file names for each pT bin (if not from CCDB full path)"}; // TPC occupancy related variables Configurable fTPCShortPast{"cfgTPCShortPast", 8.0f, "Time in short past to look for occupancy (micro-seconds)"}; @@ -289,6 +297,12 @@ struct TableMaker { std::map fBestMatch; std::unordered_map map_mfttrackcovs; + + o2::analysis::MlResponseMFTMuonMatch matchingMlResponse; + std::vector binsPtMl; + std::array cutValues; + std::vector cutDirMl; + // FIXME: For now, the skimming is done using the Common track-collision association task, which does not allow to use // our own Filtered tracks. If the filter is very selective, then it may be worth to run the association in this workflow // using the Common/CollisionAssociation class @@ -423,6 +437,20 @@ struct TableMaker { } VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill fOutputList.setObject(fHistMan->GetMainHistogramList()); + + VarManager::SetMatchingPlane(fConfigVariousOptions.fzMatching.value); + + if (fConfigVariousOptions.fUseML.value) { + // TODO : for now we use hard coded values since the current models use 1 pT bin + binsPtMl = {-1e-6, 1000.0}; + cutValues = {0.0}; + cutDirMl = {cuts_ml::CutNot}; + o2::framework::LabeledArray mycutsMl(cutValues.data(), 1, 1, std::vector{"pT bin 0"}, std::vector{"score"}); + matchingMlResponse.configure(binsPtMl, mycutsMl, cutDirMl, 1); + matchingMlResponse.setModelPathsCCDB(fConfigVariousOptions.fModelNames.value, fCCDBApi, fConfigVariousOptions.fModelPathsCCDB.value, fConfigCCDB.fConfigNoLaterThan.value); + matchingMlResponse.cacheInputFeaturesIndices(fConfigVariousOptions.fInputFeatures.value); + matchingMlResponse.init(); + } } void DefineCuts() @@ -1157,6 +1185,36 @@ struct TableMaker { } } + template + void skimBestMuonMatchesML(TMuons const& muons, TMFTTracks const& /*mfttracks*/, TMFTCovs const& mfCovs, TEvent const& collision) + { + std::unordered_map> mCandidates; + for (const auto& muon : muons) { + if (static_cast(muon.trackType()) < 2) { + auto muonID = muon.matchMCHTrackId(); + auto muontrack = muon.template matchMCHTrack_as(); + auto muonprop = VarManager::PropagateMuon(muontrack, collision, VarManager::kToMatching); + auto mfttrack = muon.template matchMFTTrack_as(); + auto const& mfttrackcov = mfCovs.rawIteratorAt(map_mfttrackcovs[mfttrack.globalIndex()]); + o2::track::TrackParCovFwd mftprop = VarManager::PropagateFwd(mfttrack, mfttrackcov, VarManager::GetMatchingPlane()); + std::vector output; + std::vector inputML = matchingMlResponse.getInputFeaturesGlob(muon, muonprop, mftprop, mfttrackcov, collision); + matchingMlResponse.isSelectedMl(inputML, 0, output); + float score = output[0]; + if (mCandidates.find(muonID) == mCandidates.end()) { + mCandidates[muonID] = {score, muon.globalIndex()}; + } else { + if (score < mCandidates[muonID].first) { + mCandidates[muonID] = {score, muon.globalIndex()}; + } + } + } + } + for (auto& pairCand : mCandidates) { + fBestMatch[pairCand.second.second] = true; + } + } + template void skimMuons(TEvent const& collision, TBCs const& /*bcs*/, TMuons const& muons, FwdTrackAssoc const& muonAssocs, TMFTTracks const& /*mftTracks*/, TMFTCovs const& mfCovs) { @@ -1368,6 +1426,7 @@ struct TableMaker { fGrpMag = fCCDB->getForTimeStamp(fConfigCCDB.fConfigGrpMagPath, bcs.begin().timestamp()); if (fGrpMag != nullptr) { o2::base::Propagator::initFieldFromGRP(fGrpMag); + VarManager::SetMagneticField(fGrpMag->getNominalL3Field()); } if (fConfigVariousOptions.fPropMuon) { VarManager::SetupMuonMagField(); @@ -1445,7 +1504,13 @@ struct TableMaker { if constexpr (static_cast(TMFTFillMap)) { auto groupedMuonIndices = fwdTrackAssocs.sliceBy(fwdtrackIndicesPerCollision, origIdx); if (fConfigVariousOptions.fKeepBestMatch) { - skimBestMuonMatches(muons); + if constexpr (static_cast(TMFTFillMap & VarManager::ObjTypes::MFTCov)) { + if (fConfigVariousOptions.fUseML.value) { + skimBestMuonMatchesML(muons, mftTracks, mftCovs, collision); + } + } else { + skimBestMuonMatches(muons); + } } if constexpr (static_cast(TMFTFillMap & VarManager::ObjTypes::MFTCov)) { skimMuons(collision, bcs, muons, groupedMuonIndices, mftTracks, mftCovs); From 56d6d99315ed9c0646cf3c700096c342078c742b Mon Sep 17 00:00:00 2001 From: blacwovie Date: Fri, 26 Sep 2025 01:10:57 +0800 Subject: [PATCH 538/986] [PWGLF] input particle charge in getkstar() (#13121) --- PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx b/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx index 3d594b39d30..3aae88bc3f7 100644 --- a/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx +++ b/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx @@ -693,7 +693,7 @@ struct he3HadronFemto { beta = std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked he3Hadcand.massTOFHad = trackHad.tpcInnerParam() * std::sqrt(1.f / (beta * beta) - 1.f); } - he3Hadcand.kstarfem = o2::analysis::femtoWorld::FemtoWorldMath::getkstar(trackHad, o2::constants::physics::MassPiPlus, trackHe3, o2::constants::physics::MassHelium3); + he3Hadcand.kstarfem = o2::analysis::femtoWorld::FemtoWorldMath::getkstar(trackHad, o2::constants::physics::MassPiPlus, trackHe3, o2::constants::physics::MassHelium3, 1, 2); return true; } From ee4bfed0d53469b634b3fbadada05f225aed3910 Mon Sep 17 00:00:00 2001 From: Roman Lietava Date: Thu, 25 Sep 2025 19:25:01 +0200 Subject: [PATCH 539/986] [PWGLF] Omega: allowing split runs (#13129) --- PWGLF/Tasks/Strangeness/nonPromptCascade.cxx | 39 ++++++++++---------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx b/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx index d5e93102df0..d5ada008d62 100644 --- a/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx +++ b/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx @@ -213,11 +213,11 @@ struct NonPromptCascadeTask { o2::vertexing::DCAFitterN<2> mDCAFitter; std::array mProcessCounter = {0, 0}; // {Tracked, All} std::map mToiMap; - std::unordered_set mRuns; - std::shared_ptr mHistPointer1; - std::shared_ptr mHistPointer2; - std::shared_ptr mHistPointer3; - std::shared_ptr mHistPointer4; + std::unordered_map> mHistsPerRunMultVsCent; + std::unordered_map> mHistsPerRunMultVsCentZoom; + std::unordered_map> mHistsPerRunNtracktVsCent; + std::unordered_map> mHistsPerRunNtracktVsCentZoom; + AxisSpec multAxis = {10000, 0, 10000, "Multiplicity FT0M"}; AxisSpec centAxis = {2021, -0.025, 101.025, "Centrality"}; AxisSpec centAxisZoom = {2000, -0.0025, 10.0025, "Centrality"}; @@ -338,22 +338,21 @@ struct NonPromptCascadeTask { { // std::cout << "Filling mult histos" << std::endl; for (const auto& coll : collisions) { - if (!mRuns.count(mRunNumber)) { - std::string histName = "mult/hMultVsCent_run" + std::to_string(mRunNumber); - mHistPointer1 = std::get>(mRegistry.add(histName.c_str(), histName.c_str(), HistType::kTH2F, {centAxis, multAxis})); - histName = "mult/hMultVsCentZoom_run" + std::to_string(mRunNumber); - mHistPointer2 = std::get>(mRegistry.add(histName.c_str(), histName.c_str(), HistType::kTH2F, {centAxisZoom, multAxisZoom})); - histName = "mult/hNTracksVsCent_run" + std::to_string(mRunNumber); - mHistPointer3 = std::get>(mRegistry.add(histName.c_str(), histName.c_str(), HistType::kTH2F, {centAxis, nTracksAxis})); - histName = "mult/hNTracksVsCentZoom_run" + std::to_string(mRunNumber); - mHistPointer4 = std::get>(mRegistry.add(histName.c_str(), histName.c_str(), HistType::kTH2F, {centAxisZoom, nTracksAxis})); - mRuns.insert(mRunNumber); + std::string histNameMvC = "mult/hMultVsCent_run" + std::to_string(mRunNumber); + std::string histNameMvCZ = "mult/hMultVsCentZoom_run" + std::to_string(mRunNumber); + std::string histNameTvC = "mult/hNTracksVsCent_run" + std::to_string(mRunNumber); + std::string histNameTvCZ = "mult/hNTracksVsCentZoom_run" + std::to_string(mRunNumber); + if (!mHistsPerRunMultVsCent.contains(histNameMvC)) { + mHistsPerRunMultVsCent[histNameMvC] = std::get>(mRegistry.add(histNameMvC.c_str(), histNameMvC.c_str(), HistType::kTH2F, {centAxis, multAxis})); + mHistsPerRunMultVsCentZoom[histNameMvCZ] = std::get>(mRegistry.add(histNameMvCZ.c_str(), histNameMvCZ.c_str(), HistType::kTH2F, {centAxisZoom, multAxisZoom})); + mHistsPerRunNtracktVsCent[histNameTvC] = std::get>(mRegistry.add(histNameTvC.c_str(), histNameTvC.c_str(), HistType::kTH2F, {centAxis, nTracksAxis})); + mHistsPerRunNtracktVsCentZoom[histNameTvCZ] = std::get>(mRegistry.add(histNameTvCZ.c_str(), histNameTvCZ.c_str(), HistType::kTH2F, {centAxisZoom, nTracksAxis})); } - mHistPointer1->Fill(coll.centFT0M(), coll.multFT0M()); - mHistPointer2->Fill(coll.centFT0M(), coll.multFT0M()); - mHistPointer3->Fill(coll.centFT0M(), coll.multNTracksGlobal()); - mHistPointer4->Fill(coll.centFT0M(), coll.multNTracksGlobal()); - + mHistsPerRunMultVsCent[histNameMvC]->Fill(coll.centFT0M(), coll.multFT0M()); + mHistsPerRunMultVsCentZoom[histNameMvCZ]->Fill(coll.centFT0M(), coll.multFT0M()); + mHistsPerRunNtracktVsCent[histNameTvC]->Fill(coll.centFT0M(), coll.multNTracksGlobal()); + mHistsPerRunNtracktVsCentZoom[histNameTvCZ]->Fill(coll.centFT0M(), coll.multNTracksGlobal()); + // run integrated histos mRegistry.fill(HIST("hMultVsCent"), coll.centFT0M(), coll.multFT0M()); mRegistry.fill(HIST("hMultVsCentZoom"), coll.centFT0M(), coll.multFT0M()); mRegistry.fill(HIST("hNTracksVsCent"), coll.centFT0M(), (float)coll.multNTracksGlobal()); From 929f0a6bbbc161503f1d676e57eb91fecdf35d59 Mon Sep 17 00:00:00 2001 From: ariedel-cern <85537041+ariedel-cern@users.noreply.github.com> Date: Thu, 25 Sep 2025 20:33:51 +0200 Subject: [PATCH 540/986] [PWGCF] adding generic pair tasks (#13130) --- PWGCF/Femto/Core/cascadeBuilder.h | 4 +- PWGCF/Femto/Core/cascadeHistManager.h | 2 +- PWGCF/Femto/Core/closePairRejection.h | 88 +++++-- PWGCF/Femto/Core/collisionBuilder.h | 54 ++-- PWGCF/Femto/Core/dataTypes.h | 1 + PWGCF/Femto/Core/femtoUtils.h | 6 + PWGCF/Femto/Core/pairBuilder.h | 245 ++++++++++++++++-- PWGCF/Femto/Core/pairCleaner.h | 18 +- PWGCF/Femto/Core/pairHistManager.h | 12 +- PWGCF/Femto/Core/partitions.h | 22 +- PWGCF/Femto/Core/trackBuilder.h | 25 +- PWGCF/Femto/Core/trackHistManager.h | 28 +- PWGCF/Femto/Core/twoTrackResonanceBuilder.h | 11 +- .../Femto/Core/twoTrackResonanceHistManager.h | 2 +- PWGCF/Femto/DataModel/FemtoTables.h | 1 + PWGCF/Femto/TableProducer/femtoProducer.cxx | 3 +- PWGCF/Femto/Tasks/CMakeLists.txt | 10 + PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx | 202 +++++++++++++++ .../Tasks/femtoPairTrackTwoTrackResonance.cxx | 239 +++++++++++++++++ PWGCF/Femto/Tasks/femtoPairTrackV0.cxx | 21 +- PWGCF/Femto/Tasks/femtoTrackQa.cxx | 2 +- 21 files changed, 890 insertions(+), 106 deletions(-) create mode 100644 PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx create mode 100644 PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx diff --git a/PWGCF/Femto/Core/cascadeBuilder.h b/PWGCF/Femto/Core/cascadeBuilder.h index b7342c3516f..5f43ecf6ab9 100644 --- a/PWGCF/Femto/Core/cascadeBuilder.h +++ b/PWGCF/Femto/Core/cascadeBuilder.h @@ -92,7 +92,7 @@ struct ConfOmegaBits : o2::framework::ConfigurableGroup { #define CASCADE_DEFAULT_SELECTION(defaultMassMin, defaultMassMax, defaultPdgCode) \ o2::framework::Configurable pdgCode{"pdgCode", defaultPdgCode, "Track PDG code"}; \ - o2::framework::Configurable sign{"sign", 1, "Sign of the Lambda (+1 for Lambda and -1 for Antilambda"}; \ + o2::framework::Configurable sign{"sign", 1, "Sign of the charge of the Cascade "}; \ o2::framework::Configurable ptMin{"ptMin", 0.f, "Minimum pT"}; \ o2::framework::Configurable ptMax{"ptMax", 999.f, "Maximum pT"}; \ o2::framework::Configurable etaMin{"etaMin", -10.f, "Minimum eta"}; \ @@ -105,7 +105,7 @@ struct ConfOmegaBits : o2::framework::ConfigurableGroup { struct ConfXiSelection : o2::framework::ConfigurableGroup { std::string prefix = std::string("XiSelection"); - CASCADE_DEFAULT_SELECTION(1.22, 1.42, 3212) + CASCADE_DEFAULT_SELECTION(1.22, 1.42, 3312) }; struct ConfOmegaSelection : o2::framework::ConfigurableGroup { diff --git a/PWGCF/Femto/Core/cascadeHistManager.h b/PWGCF/Femto/Core/cascadeHistManager.h index 19c0f9f0d97..91b2413ff08 100644 --- a/PWGCF/Femto/Core/cascadeHistManager.h +++ b/PWGCF/Femto/Core/cascadeHistManager.h @@ -113,7 +113,7 @@ constexpr std::array, kCascadeHistLast> HistT {kMassXiVsMassOmega, o2::framework::kTH2F, "hMassXiVsMassOmega", "mass #Xi vs mass #Omega; m_{#Lambda#pi} (GeV/#it{c}^{2}); m_{#LambdaK} (GeV/#it{c}^{2})"}}}; template -auto makeCascadeAnalysisHistSpecMap(const T& confBinningAnalysis) +auto makeCascadeHistSpecMap(const T& confBinningAnalysis) { return std::map>{ {kPt, {confBinningAnalysis.pt}}, diff --git a/PWGCF/Femto/Core/closePairRejection.h b/PWGCF/Femto/Core/closePairRejection.h index 84b60eefee9..3c21f953ad1 100644 --- a/PWGCF/Femto/Core/closePairRejection.h +++ b/PWGCF/Femto/Core/closePairRejection.h @@ -58,13 +58,17 @@ struct ConfCpr : o2::framework::ConfigurableGroup { // tpc radii for computing phistar constexpr int kNradii = 9; -constexpr std::array kTpcRadius = {85., 105., 125., 145., 165., 185., 205., 225., 245.}; +constexpr std::array kTpcRadius = {85., 105., 125., 145., 165., 185., 205., 225., 245.}; // in cm // directory names constexpr char PrefixTrackTrackSe[] = "CPR_TrackTrack/SE/"; constexpr char PrefixTrackTrackMe[] = "CPR_TrackTrack/ME/"; -constexpr char PrefixTrackV0Se[] = "CPR_TrackV0/SE/"; -constexpr char PrefixTrackV0Me[] = "CPR_TrackV0/ME/"; +constexpr char PrefixTrackV0Se[] = "CPR_TrackV0Daughter/SE/"; +constexpr char PrefixTrackV0Me[] = "CPR_TrackV0Daughter/ME/"; +constexpr char PrefixTrackTwoTrackResonanceSe[] = "CPR_TrackResonanceDaughter/SE/"; +constexpr char PrefixTrackTwoTrackResonnaceMe[] = "CPR_TrackResonanceDaughter/ME/"; +constexpr char PrefixTrackCascadeSe[] = "CPR_TrackCascadeBachelor/SE/"; +constexpr char PrefixTrackCascadeMe[] = "CPR_TrackCascadeBachelor/ME/"; constexpr char PrefixTrackKinkSe[] = "CPR_TrackKink/SE/"; constexpr char PrefixTrackKinkMe[] = "CPR_TrackKink/ME/"; @@ -117,7 +121,7 @@ class CloseTrackRejection mChargeTrack2 = chargeTrack2; if (utils::sign(mChargeTrack1) != utils::sign(mChargeTrack2)) { - LOG(warn) << "CPR is truned on for tracks with opposite charge. Is this intended?"; + LOG(warn) << "CPR is turned on for tracks with opposite charge. Is this intended?"; } mHistogramRegistry = registry; @@ -196,10 +200,12 @@ template class ClosePairRejectionTrackTrack { public: - void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int signTrack1, int absChargeTrack1, int signTrack2, int AbsChargeTrack2, bool isActivated) + void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int chargeTrack1, int chargeTrack2, bool isActivated) { mIsActivated = isActivated; - mCtr.init(registry, specs, detaMax, dphistarMax, signTrack1 * absChargeTrack1, signTrack2 * AbsChargeTrack2); + if (mIsActivated) { + mCtr.init(registry, specs, detaMax, dphistarMax, chargeTrack1, chargeTrack2); + } } void setMagField(float magField) { mCtr.setMagField(magField); } @@ -221,14 +227,16 @@ template class ClosePairRejectionTrackV0 // can also be used for any particle type that has pos/neg daughters, like resonances { public: - void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int signTrack, int absChargeTrack, bool isActivated) + void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int chargeTrack, bool isActivated) { mIsActivated = isActivated; - mSignTrack = signTrack; + mChargeTrack = chargeTrack; // initialize CPR with charge of the track and the same charge for the daughter particle - // absolute charge of the daughter track will be 1, so we can pass the sign directly - mCtr.init(registry, specs, detaMax, dphistarMax, signTrack * absChargeTrack, signTrack); + // absolute charge of the daughter track will be 1, so we just pass the sign + if (mIsActivated) { + mCtr.init(registry, specs, detaMax, dphistarMax, mChargeTrack, utils::sign(mChargeTrack)); + } } void setMagField(float magField) @@ -238,14 +246,14 @@ class ClosePairRejectionTrackV0 // can also be used for any particle type that h template void setPair(const T1& track, const T2& v0, const T3 /*trackTable*/) { - if (mSignTrack == 1) { + if (mChargeTrack > 0) { auto daughter = v0.template posDau_as(); mCtr.compute(track, daughter); - } else if (mSignTrack == -1) { + } else if (mChargeTrack < 0) { auto daughter = v0.template negDau_as(); mCtr.compute(track, daughter); } else { - LOG(fatal) << "CPR Track-V0: Wrong track sign"; + LOG(fatal) << "CPR Track-V0: Sign of the track is 0!"; } } @@ -258,23 +266,58 @@ class ClosePairRejectionTrackV0 // can also be used for any particle type that h private: CloseTrackRejection mCtr; - int mSignTrack = 0; + int mChargeTrack = 0; bool mIsActivated = true; }; template -class ClosePairRejectionTrackKink +class ClosePairRejectionTrackCascade // can also be used for any particle type that has pos/neg daughters, like resonances { public: - void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int signTrack, int absChargeTrack, bool isActivated) + void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int chargeTrack, int chargeCascade, bool isActivated) { mIsActivated = isActivated; - mSignTrack = signTrack; + if (mIsActivated) { + mCtr.init(registry, specs, detaMax, dphistarMax, chargeTrack, chargeCascade); + } + } + + void setMagField(float magField) + { + mCtr.setMagField(magField); + } + template + void setPair(const T1& track, const T2& cascade, const T3 /*trackTable*/) + { + auto bachelor = cascade.template posDau_as(); + mCtr.compute(track, bachelor); + } + bool isClosePair() const { return mCtr.isClosePair(); } + void fill() + { + mCtr.fill(); + } + bool isActivated() const { return mIsActivated; } + + private: + CloseTrackRejection mCtr; + bool mIsActivated = true; +}; + +template +class ClosePairRejectionTrackKink +{ + public: + void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int chargeTrack, int signKinkCandidate, bool isActivated) + { + mIsActivated = isActivated; // initialize CPR with charge of the track and the charged daughter particle // For kinks, we compare the primary track with the charged daughter // The charged daughter has absolute charge of 1, so we can pass the sign directly - mCtr.init(registry, specs, detaMax, dphistarMax, signTrack * absChargeTrack, mSignTrack); + if (mIsActivated) { + mCtr.init(registry, specs, detaMax, dphistarMax, chargeTrack, signKinkCandidate); + } } void setMagField(float magField) @@ -285,12 +328,8 @@ class ClosePairRejectionTrackKink template void setPair(const T1& track, const T2& kink, const T3 /*trackTable*/) { - if (mSignTrack == 1 || mSignTrack == -1) { - auto daughter = kink.template chaDau_as(); - mCtr.compute(track, daughter); - } else { - LOG(warn) << "CPR Track-Kink: Wrong track sign"; - } + auto daughter = kink.template chaDau_as(); + mCtr.compute(track, daughter); } bool isClosePair() const { return mCtr.isClosePair(); } @@ -302,7 +341,6 @@ class ClosePairRejectionTrackKink private: CloseTrackRejection mCtr; - int mSignTrack = 0; bool mIsActivated = true; }; diff --git a/PWGCF/Femto/Core/collisionBuilder.h b/PWGCF/Femto/Core/collisionBuilder.h index 96c64645c7a..091dc6ec237 100644 --- a/PWGCF/Femto/Core/collisionBuilder.h +++ b/PWGCF/Femto/Core/collisionBuilder.h @@ -80,6 +80,14 @@ struct ConfCollisionTriggers : o2::framework::ConfigurableGroup { o2::framework::Configurable triggers{"triggers", std::string("fPPP,fPPL"), "Comma seperated list of all triggers to be used"}; }; +struct ConfCollisionRctFlags : o2::framework::ConfigurableGroup { + std::string prefix = std::string("CollisionRctFlags"); + o2::framework::Configurable useRctFlags{"useRctFlags", true, "Set to true to use RCT flags"}; + o2::framework::Configurable label{"label", std::string("CBT_hadronPID"), "Which RCT flag to check"}; + o2::framework::Configurable useZdc{"useZdc", false, "Whether to use ZDC (only use for PbPb)"}; + o2::framework::Configurable treatLimitedAcceptanceAsBad{"treatLimitedAcceptanceAsBad", false, "Whether to treat limited acceptance as bad or not"}; +}; + // configurables for collision selection struct ConfCollisionSelection : o2::framework::ConfigurableGroup { std::string prefix = std::string("CollisionSelection"); @@ -309,22 +317,27 @@ class CollisionBuilder CollisionBuilder() {} virtual ~CollisionBuilder() = default; - template - void init(T1& filter, T2& config, T3& table, T4& trigger, T5& initContext) + template + void init(T1& confFilter, T2& confBits, T3& confRct, T4& confTrigger, T5& confTable, T6& initContext) { - mCollisionSelection.configure(filter, config); - if (trigger.useTrigger.value) { + mCollisionSelection.configure(confFilter, confBits); + if (confTrigger.useTrigger.value) { mUseTrigger = true; - mTriggerNames = trigger.triggers.value; - mZorro.setBaseCCDBPath(trigger.ccdbPath.value); + mTriggerNames = confTrigger.triggers.value; + mZorro.setBaseCCDBPath(confTrigger.ccdbPath.value); + } + if (confRct.useRctFlags.value) { + mUseRctFlags = true; + mRctFlagsChecker.init(confRct.label.value, confRct.useZdc.value, confRct.treatLimitedAcceptanceAsBad.value); } + LOG(info) << "Initialize femto collision builder..."; - mProducedCollisions = utils::enableTable("FCols_001", table.produceCollisions.value, initContext); - mProducedCollisionMasks = utils::enableTable("FColMasks_001", table.produceCollisionMasks.value, initContext); - mProduceQns = utils::enableTable("FColQnBins_001", table.produceQns.value, initContext); - mProducedPositions = utils::enableTable("FColPos_001", table.producePositions.value, initContext); - mProducedMultiplicities = utils::enableTable("FColMults_001", table.produceMults.value, initContext); - mProducedCentralities = utils::enableTable("FColCents_001", table.produceCents.value, initContext); + mProducedCollisions = utils::enableTable("FCols_001", confTable.produceCollisions.value, initContext); + mProducedCollisionMasks = utils::enableTable("FColMasks_001", confTable.produceCollisionMasks.value, initContext); + mProduceQns = utils::enableTable("FColQnBins_001", confTable.produceQns.value, initContext); + mProducedPositions = utils::enableTable("FColPos_001", confTable.producePositions.value, initContext); + mProducedMultiplicities = utils::enableTable("FColMults_001", confTable.produceMults.value, initContext); + mProducedCentralities = utils::enableTable("FColCents_001", confTable.produceCents.value, initContext); if (mProducedCollisions || mProducedCollisionMasks || mProducedPositions || mProducedMultiplicities || mProducedCentralities) { mFillAnyTable = true; mCollisionSelection.printSelections(colSelsName, colSelsToString); @@ -351,12 +364,17 @@ class CollisionBuilder template bool checkCollision(T1 const& bc, T2 const& col) { - if (mUseTrigger) { - return mZorro.isSelected(bc.globalBC()) && mCollisionSelection.checkFilters(col) && mCollisionSelection.passesAllRequiredSelections(); - } else { - - return mCollisionSelection.checkFilters(col) && mCollisionSelection.passesAllRequiredSelections(); + // First: if triggers are enabled, the object must be selected + if (mUseTrigger && !mZorro.isSelected(bc.globalBC())) { + return false; + } + // Then: if RCT flags are enabled, check them + if (mUseRctFlags && !mRctFlagsChecker(col)) { + return false; } + // Finally: do the expensive checks + return mCollisionSelection.checkFilters(col) && + mCollisionSelection.passesAllRequiredSelections(); } template @@ -406,6 +424,8 @@ class CollisionBuilder CollisionSelection mCollisionSelection; Zorro mZorro; bool mUseTrigger = false; + aod::rctsel::RCTFlagsChecker mRctFlagsChecker; + bool mUseRctFlags = false; std::string mTriggerNames = std::string(""); bool mFillAnyTable = false; bool mProducedCollisions = false; diff --git a/PWGCF/Femto/Core/dataTypes.h b/PWGCF/Femto/Core/dataTypes.h index 54cef607b7b..39ae9fc9ae8 100644 --- a/PWGCF/Femto/Core/dataTypes.h +++ b/PWGCF/Femto/Core/dataTypes.h @@ -25,6 +25,7 @@ namespace femtodatatypes // Note: Length of the bitmask is the limit of how many selections can be configured // datatypes for collsions +using CollisionTagType = uint64_t; using CollisionMaskType = uint16_t; // datatypes for tracks diff --git a/PWGCF/Femto/Core/femtoUtils.h b/PWGCF/Femto/Core/femtoUtils.h index f853d5e0c4b..fb082ae96fa 100644 --- a/PWGCF/Femto/Core/femtoUtils.h +++ b/PWGCF/Femto/Core/femtoUtils.h @@ -148,6 +148,12 @@ inline float getMass(int pdgCode) case kSigmaMinus: mass = o2::constants::physics::MassSigmaMinus; break; + case kXiMinus: + mass = o2::constants::physics::MassXiMinus; + break; + case kOmegaMinus: + mass = o2::constants::physics::MassOmegaMinus; + break; default: LOG(fatal) << "PDG code is not suppored"; } diff --git a/PWGCF/Femto/Core/pairBuilder.h b/PWGCF/Femto/Core/pairBuilder.h index 7e38b1ff98c..1af5a169e24 100644 --- a/PWGCF/Femto/Core/pairBuilder.h +++ b/PWGCF/Femto/Core/pairBuilder.h @@ -16,6 +16,7 @@ #ifndef PWGCF_FEMTO_CORE_PAIRBUILDER_H_ #define PWGCF_FEMTO_CORE_PAIRBUILDER_H_ +#include "PWGCF/Femto/Core/cascadeHistManager.h" #include "PWGCF/Femto/Core/closePairRejection.h" #include "PWGCF/Femto/Core/collisionHistManager.h" #include "PWGCF/Femto/Core/kinkHistManager.h" @@ -24,6 +25,7 @@ #include "PWGCF/Femto/Core/pairHistManager.h" #include "PWGCF/Femto/Core/pairProcessHelpers.h" #include "PWGCF/Femto/Core/trackHistManager.h" +#include "PWGCF/Femto/Core/twoTrackResonanceHistManager.h" #include "PWGCF/Femto/Core/v0HistManager.h" #include "PWGCF/Femto/DataModel/FemtoTables.h" @@ -83,23 +85,23 @@ class PairTrackTrackBuilder mTrackHistManager1.init(registry, trackHistSpec1); mPairHistManagerSe.setMass(confTrackSelection1.pdgCode.value, confTrackSelection1.pdgCode.value); - mPairHistManagerSe.setCharge(confTrackSelection1.absCharge.value, confTrackSelection1.absCharge.value); - mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.sign.value, confTrackSelection1.absCharge.value, confTrackSelection1.sign.value, confTrackSelection1.absCharge.value, confCpr.on.value); + mPairHistManagerSe.setCharge(confTrackSelection1.charge.value, confTrackSelection1.charge.value); + mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.charge.value, confTrackSelection1.charge.value, confCpr.on.value); mPairHistManagerMe.setMass(confTrackSelection1.pdgCode.value, confTrackSelection1.pdgCode.value); - mPairHistManagerMe.setCharge(confTrackSelection1.absCharge.value, confTrackSelection1.absCharge.value); - mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.sign.value, confTrackSelection1.absCharge.value, confTrackSelection1.sign.value, confTrackSelection1.absCharge.value, confCpr.on.value); + mPairHistManagerMe.setCharge(confTrackSelection1.charge.value, confTrackSelection1.charge.value); + mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.charge.value, confTrackSelection1.charge.value, confCpr.on.value); } else { mTrackHistManager1.init(registry, trackHistSpec1); mTrackHistManager2.init(registry, trackHistSpec2); mPairHistManagerSe.setMass(confTrackSelection1.pdgCode.value, confTrackSelection2.pdgCode.value); - mPairHistManagerSe.setCharge(confTrackSelection1.absCharge.value, confTrackSelection2.absCharge.value); - mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.sign.value, confTrackSelection1.absCharge.value, confTrackSelection2.sign.value, confTrackSelection2.absCharge.value, confCpr.on.value); + mPairHistManagerSe.setCharge(confTrackSelection1.charge.value, confTrackSelection2.charge.value); + mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.charge.value, confTrackSelection2.charge.value, confCpr.on.value); mPairHistManagerMe.setMass(confTrackSelection1.pdgCode.value, confTrackSelection2.pdgCode.value); - mPairHistManagerMe.setCharge(confTrackSelection1.absCharge.value, confTrackSelection2.absCharge.value); - mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.sign.value, confTrackSelection1.absCharge.value, confTrackSelection2.sign.value, confTrackSelection2.absCharge.value, confCpr.on.value); + mPairHistManagerMe.setCharge(confTrackSelection1.charge.value, confTrackSelection2.charge.value); + mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.charge.value, confTrackSelection2.charge.value, confCpr.on.value); } // setup mixing @@ -240,13 +242,13 @@ class PairTrackV0Builder mPairHistManagerSe.init(registry, pairHistSpec); mPairHistManagerSe.setMass(confTrackSelection.pdgCode.value, confV0Selection.pdgCode.value); - mPairHistManagerSe.setCharge(confTrackSelection.absCharge.value, 1); - mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.sign.value, confTrackSelection.absCharge.value, confCpr.on.value); + mPairHistManagerSe.setCharge(confTrackSelection.charge.value, 1); + mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.charge.value, confCpr.on.value); mPairHistManagerMe.init(registry, pairHistSpec); mPairHistManagerMe.setMass(confTrackSelection.pdgCode.value, confV0Selection.pdgCode.value); - mPairHistManagerMe.setCharge(confTrackSelection.absCharge.value, 1); - mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.sign.value, confTrackSelection.absCharge.value, confCpr.on.value); + mPairHistManagerMe.setCharge(confTrackSelection.charge.value, 1); + mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.charge.value, confCpr.on.value); // setup mixing mMixingPolicy = static_cast(confMixing.policy.value); @@ -297,6 +299,110 @@ class PairTrackV0Builder int mMixingDepth = 5; }; +template < + const char* prefixTrack, + const char* prefixResonance, + const char* prefixPosDau, + const char* prefixNegDau, + const char* prefixSe, + const char* prefixMe, + const char* prefixCprSe, + const char* prefixCprMe, + modes::Mode mode, + modes::TwoTrackResonance resonanceType> +class PairTrackTwoTrackResonanceBuilder +{ + public: + PairTrackTwoTrackResonanceBuilder() = default; + + template + void init(o2::framework::HistogramRegistry* registry, + T1& confTrackSelection, + T2& confResonanceSelection, + T3& confCpr, + T4& confMixing, + std::map>& colHistSpec, + std::map>& trackHistSpec, + std::map>& resonanceHistSpec, + std::map>& posDauHistSpec, + std::map>& negDauHistSpec, + std::map>& pairHistSpec, + std::map>& cprHistSpec) + { + mColHistManager.init(registry, colHistSpec); + + mTrackHistManager.init(registry, trackHistSpec); + mResonanceHistManager.init(registry, resonanceHistSpec, posDauHistSpec, negDauHistSpec); + + mPairHistManagerSe.init(registry, pairHistSpec); + mPairHistManagerSe.setMass(confTrackSelection.pdgCode.value, confResonanceSelection.pdgCode.value); + mPairHistManagerSe.setCharge(confTrackSelection.charge.value, 1); + mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.charge.value, confCpr.on.value); + + mPairHistManagerMe.init(registry, pairHistSpec); + mPairHistManagerMe.setMass(confTrackSelection.pdgCode.value, confResonanceSelection.pdgCode.value); + mPairHistManagerMe.setCharge(confTrackSelection.charge.value, 1); + mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.charge.value, confCpr.on.value); + + // setup mixing + mMixingPolicy = static_cast(confMixing.policy.value); + mMixingDepth = confMixing.depth.value; + } + + template + void processSameEvent(T1 const& col, T2& trackTable, T3& trackPartition, T4& /*resonanceTable*/, T5& resonancePartition, T6& cache) + { + auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto v0Slice = resonancePartition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + if (trackSlice.size() == 0 || v0Slice.size() == 0) { + return; + } + mColHistManager.fill(col); + mCprSe.setMagField(col.magField()); + pairprocesshelpers::processSameEvent(trackSlice, v0Slice, trackTable, mTrackHistManager, mResonanceHistManager, mPairHistManagerSe, mCprSe, mPc); + } + + template + void processMixedEvent(T1 const& cols, T2& trackTable, T3& trackPartition, T4& resonancePartition, T5& cache, T6& binsVtxMult, T7& binsVtxCent, T8& binsVtxMultCent) + { + switch (mMixingPolicy) { + case static_cast(pairhistmanager::kVtxMult): + pairprocesshelpers::processMixedEvent(cols, trackPartition, resonancePartition, trackTable, cache, binsVtxMult, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + break; + case static_cast(pairhistmanager::kVtxCent): + pairprocesshelpers::processMixedEvent(cols, trackPartition, resonancePartition, trackTable, cache, binsVtxCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + break; + case static_cast(pairhistmanager::kVtxMultCent): + pairprocesshelpers::processMixedEvent(cols, trackPartition, resonancePartition, trackTable, cache, binsVtxMultCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + break; + default: + LOG(fatal) << "Invalid binning policiy specifed. Breaking..."; + } + } + + private: + colhistmanager::CollisionHistManager mColHistManager; + trackhistmanager::TrackHistManager mTrackHistManager; + twotrackresonancehistmanager::TwoTrackResonanceHistManager mResonanceHistManager; + pairhistmanager::PairHistManager mPairHistManagerSe; + pairhistmanager::PairHistManager mPairHistManagerMe; + closepairrejection::ClosePairRejectionTrackV0 mCprSe; // cpr for twotrackresonances and v0 work the same way + closepairrejection::ClosePairRejectionTrackV0 mCprMe; // cpr for twotrackresonances and v0 work the same way + paircleaner::TrackV0PairCleaner mPc; // pc for twotrackresonances and v0 work the same way + pairhistmanager::MixingPoliciy mMixingPolicy = pairhistmanager::MixingPoliciy::kVtxMult; + int mMixingDepth = 5; +}; + template < const char* prefixTrack, const char* prefixKink, @@ -341,13 +447,13 @@ class PairTrackKinkBuilder mPairHistManagerSe.init(registry, pairHistSpec); mPairHistManagerSe.setMass(confTrackSelection.pdgCode.value, confKinkSelection.pdgCode.value); - mPairHistManagerSe.setCharge(confTrackSelection.absCharge.value, 1); - mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.sign.value, confTrackSelection.absCharge.value, confCpr.on.value); + mPairHistManagerSe.setCharge(confTrackSelection.charge.value, confKinkSelection.sign.value); + mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.charge.value, confKinkSelection.sign.value, confCpr.on.value); mPairHistManagerMe.init(registry, pairHistSpec); mPairHistManagerMe.setMass(confTrackSelection.pdgCode.value, confKinkSelection.pdgCode.value); - mPairHistManagerMe.setCharge(confTrackSelection.absCharge.value, 1); - mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.sign.value, confTrackSelection.absCharge.value, confCpr.on.value); + mPairHistManagerMe.setCharge(confTrackSelection.charge.value, confKinkSelection.sign.value); + mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.charge.value, confKinkSelection.sign.value, confCpr.on.value); // setup mixing mMixingPolicy = static_cast(confMixing.policy.value); @@ -398,6 +504,113 @@ class PairTrackKinkBuilder int mMixingDepth = 5; }; +template < + const char* prefixTrack, + const char* prefixCascade, + const char* prefixBachelor, + const char* prefixPosDau, + const char* prefixNegDau, + const char* prefixSe, + const char* prefixMe, + const char* prefixCprSe, + const char* prefixCprMe, + modes::Mode mode, + modes::Cascade cascadeType> +class PairTrackCascadeBuilder +{ + public: + PairTrackCascadeBuilder() = default; + + template + void init(o2::framework::HistogramRegistry* registry, + T1& confTrackSelection, + T2& confCascadeSelection, + T3& confCpr, + T4& confMixing, + std::map>& colHistSpec, + std::map>& trackHistSpec, + std::map>& cascadeHistSpec, + std::map>& bachelorHistSpec, + std::map>& posDauHistSpec, + std::map>& negDauHistSpec, + std::map>& pairHistSpec, + std::map>& cprHistSpec) + { + mColHistManager.init(registry, colHistSpec); + + mTrackHistManager.init(registry, trackHistSpec); + mCascadeHistManager.init(registry, cascadeHistSpec, bachelorHistSpec, posDauHistSpec, negDauHistSpec); + + mPairHistManagerSe.init(registry, pairHistSpec); + mPairHistManagerSe.setMass(confTrackSelection.pdgCode.value, confCascadeSelection.pdgCode.value); + mPairHistManagerSe.setCharge(confTrackSelection.charge.value, confCascadeSelection.sign.value); + mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.charge.value, confCascadeSelection.sign.value, confCpr.on.value); + + mPairHistManagerMe.init(registry, pairHistSpec); + mPairHistManagerMe.setMass(confTrackSelection.pdgCode.value, confCascadeSelection.pdgCode.value); + mPairHistManagerMe.setCharge(confTrackSelection.charge.value, confCascadeSelection.sign.value); + mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.charge.value, confCascadeSelection.sign.value, confCpr.on.value); + + // setup mixing + mMixingPolicy = static_cast(confMixing.policy.value); + mMixingDepth = confMixing.depth.value; + } + + template + void processSameEvent(T1 const& col, T2& trackTable, T3& trackPartition, T4& /*cascadeTable*/, T5& v0Partition, T6& cache) + { + auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto v0Slice = v0Partition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + if (trackSlice.size() == 0 || v0Slice.size() == 0) { + return; + } + mColHistManager.fill(col); + mCprSe.setMagField(col.magField()); + pairprocesshelpers::processSameEvent(trackSlice, v0Slice, trackTable, mTrackHistManager, mCascadeHistManager, mPairHistManagerSe, mCprSe, mPc); + } + + template + void processMixedEvent(T1 const& cols, T2& trackTable, T3& trackPartition, T4& v0Partition, T5& cache, T6& binsVtxMult, T7& binsVtxCent, T8& binsVtxMultCent) + { + switch (mMixingPolicy) { + case static_cast(pairhistmanager::kVtxMult): + pairprocesshelpers::processMixedEvent(cols, trackPartition, v0Partition, trackTable, cache, binsVtxMult, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + break; + case static_cast(pairhistmanager::kVtxCent): + pairprocesshelpers::processMixedEvent(cols, trackPartition, v0Partition, trackTable, cache, binsVtxCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + break; + case static_cast(pairhistmanager::kVtxMultCent): + pairprocesshelpers::processMixedEvent(cols, trackPartition, v0Partition, trackTable, cache, binsVtxMultCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + break; + default: + LOG(fatal) << "Invalid binning policiy specifed. Breaking..."; + } + } + + private: + colhistmanager::CollisionHistManager mColHistManager; + trackhistmanager::TrackHistManager mTrackHistManager; + cascadehistmanager::CascadeHistManager mCascadeHistManager; + pairhistmanager::PairHistManager mPairHistManagerSe; + pairhistmanager::PairHistManager mPairHistManagerMe; + closepairrejection::ClosePairRejectionTrackCascade mCprSe; + closepairrejection::ClosePairRejectionTrackCascade mCprMe; + paircleaner::TrackCascadePairCleaner mPc; + pairhistmanager::MixingPoliciy mMixingPolicy = pairhistmanager::MixingPoliciy::kVtxMult; + int mMixingDepth = 5; +}; + } // namespace pairbuilder } // namespace o2::analysis::femto diff --git a/PWGCF/Femto/Core/pairCleaner.h b/PWGCF/Femto/Core/pairCleaner.h index 81e0918552b..7a72b187d6a 100644 --- a/PWGCF/Femto/Core/pairCleaner.h +++ b/PWGCF/Femto/Core/pairCleaner.h @@ -46,7 +46,7 @@ class TrackTrackPairCleaner : public BasePairCleaner } }; -class TrackV0PairCleaner : public BasePairCleaner +class TrackV0PairCleaner : public BasePairCleaner // also works for particles decaying into a positive and negative daughter, like resonances { public: TrackV0PairCleaner() = default; @@ -55,7 +55,7 @@ class TrackV0PairCleaner : public BasePairCleaner { auto posDaughter = v0.template posDau_as(); auto negDaughter = v0.template negDau_as(); - return this->isCleanTrackPair(posDaughter, track) && this->isCleanTrackPair(negDaughter, track); + return (this->isCleanTrackPair(posDaughter, track) && this->isCleanTrackPair(negDaughter, track)); } }; @@ -70,6 +70,20 @@ class TrackKinkPairCleaner : public BasePairCleaner return this->isCleanTrackPair(chaDaughter, track); } }; + +class TrackCascadePairCleaner : public BasePairCleaner +{ + public: + TrackCascadePairCleaner() = default; + template + bool isCleanPair(const T1& track, const T2& cascade, const T3& /*trackTable */) const + { + auto bachelor = cascade.template bachelor_as(); + auto posDaughter = cascade.template posDau_as(); + auto negDaughter = cascade.template negDau_as(); + return (this->isCleanTrackPair(bachelor, track) && this->isCleanTrackPair(posDaughter, track) && this->isCleanTrackPair(negDaughter, track)); + } +}; } // namespace paircleaner } // namespace o2::analysis::femto diff --git a/PWGCF/Femto/Core/pairHistManager.h b/PWGCF/Femto/Core/pairHistManager.h index 5f6d8bbdf9b..8b5856ad208 100644 --- a/PWGCF/Femto/Core/pairHistManager.h +++ b/PWGCF/Femto/Core/pairHistManager.h @@ -121,6 +121,12 @@ constexpr char PrefixTrackTrackMe[] = "TrackTrack/ME/"; constexpr char PrefixTrackV0Se[] = "TrackV0/SE/"; constexpr char PrefixTrackV0Me[] = "TrackV0/ME/"; +constexpr char PrefixTrackResonanceSe[] = "TrackResonance/SE/"; +constexpr char PrefixTrackResonanceMe[] = "TrackResonance/ME/"; + +constexpr char PrefixTrackCascadeSe[] = "TrackCascade/SE/"; +constexpr char PrefixTrackCascadeMe[] = "TrackCascade/ME/"; + constexpr char PrefixTrackKinkSe[] = "TrackKink/SE/"; constexpr char PrefixTrackKinkMe[] = "TrackKink/ME/"; @@ -166,8 +172,10 @@ class PairHistManager } void setCharge(int chargeParticle1, int chargeParticle2) { - mAbsCharge1 = std::fabs(chargeParticle1); - mAbsCharge1 = std::fabs(chargeParticle2); + // the pt stored is actually pt/z, so in case of particles with z > 1, we have to rescale the pt (this is so far only for He3 the case) + // similarly, for neutral particles, no reason to rescale so we just set absolute charge to 1 + mAbsCharge1 = std::abs(chargeParticle1 == 0 ? 1 : chargeParticle1); + mAbsCharge2 = std::abs(chargeParticle2 == 0 ? 1 : chargeParticle2); } template diff --git a/PWGCF/Femto/Core/partitions.h b/PWGCF/Femto/Core/partitions.h index 4b4943bed44..7cc40b5ffdf 100644 --- a/PWGCF/Femto/Core/partitions.h +++ b/PWGCF/Femto/Core/partitions.h @@ -26,16 +26,16 @@ ncheckbit(femtocollisions::collisionMask, selection.collisionMask) // standard track partition -#define MAKE_TRACK_PARTITION(selection) \ - ifnode(selection.sign.node() > 0, femtobase::stored::signedPt > 0.f, femtobase::stored::signedPt < 0.f) && \ - (nabs(femtobase::stored::signedPt) > selection.ptMin) && \ - (nabs(femtobase::stored::signedPt) < selection.ptMax) && \ - (femtobase::stored::eta > selection.etaMin) && \ - (femtobase::stored::eta < selection.etaMax) && \ - (femtobase::stored::phi > selection.phiMin) && \ - (femtobase::stored::phi < selection.phiMax) && \ - ifnode(nabs(femtobase::stored::signedPt) * (nexp(femtobase::stored::eta) + nexp(-1.f * femtobase::stored::eta)) / 2.f <= selection.pidThres, /* o2-linter: disable=magic-number (formula for cosh) */ \ - ncheckbit(femtotracks::trackMask, selection.maskLowMomentum), \ +#define MAKE_TRACK_PARTITION(selection) \ + ifnode(selection.charge.node() > 0, femtobase::stored::signedPt > 0.f, femtobase::stored::signedPt < 0.f) && \ + (nabs(selection.charge.node() * femtobase::stored::signedPt) > selection.ptMin) && \ + (nabs(selection.charge.node() * femtobase::stored::signedPt) < selection.ptMax) && \ + (femtobase::stored::eta > selection.etaMin) && \ + (femtobase::stored::eta < selection.etaMax) && \ + (femtobase::stored::phi > selection.phiMin) && \ + (femtobase::stored::phi < selection.phiMax) && \ + ifnode(nabs(selection.charge.node() * femtobase::stored::signedPt) * (nexp(femtobase::stored::eta) + nexp(-1.f * femtobase::stored::eta)) / (2.f) <= selection.pidThres, \ + ncheckbit(femtotracks::trackMask, selection.maskLowMomentum), \ ncheckbit(femtotracks::trackMask, selection.maskHighMomentum)) // partition for phis and rhos, i.e. resonance that are their own antiparticle @@ -55,7 +55,7 @@ ncheckbit(femtotwotrackresonances::mask, selection.negDauMaskAboveThres), \ ncheckbit(femtotwotrackresonances::mask, selection.negDauMaskBelowThres)) -// partition for kstars, they have distince antiparticle +// partition for kstars, they have distinct antiparticle #define MAKE_RESONANCE_1_PARTITON(selection) \ ifnode(selection.sign.node() > 0, femtobase::stored::signedPt > 0.f, femtobase::stored::signedPt < 0.f) && \ (nabs(femtobase::stored::signedPt) > selection.ptMin) && \ diff --git a/PWGCF/Femto/Core/trackBuilder.h b/PWGCF/Femto/Core/trackBuilder.h index d8e1f3251dd..e179e520c29 100644 --- a/PWGCF/Femto/Core/trackBuilder.h +++ b/PWGCF/Femto/Core/trackBuilder.h @@ -56,6 +56,7 @@ struct ConfTrackBits : o2::framework::ConfigurableGroup { // track quality cuts o2::framework::Configurable> tpcClustersMin{"tpcClustersMin", {90.f}, "Minimum number of clusters in TPC"}; o2::framework::Configurable> tpcCrossedRowsMin{"tpcCrossedRowsMin", {80.f}, "Minimum number of crossed rows in TPC"}; + o2::framework::Configurable> tpcClustersOverCrossedRows{"tpcClustersOverCrossedRows", {0.83f}, "Minimum fraction of clusters over crossed rows in TPC"}; o2::framework::Configurable> tpcSharedClustersMax{"tpcSharedClustersMax", {160.f}, "Maximum number of shared clusters in TPC"}; o2::framework::Configurable> tpcSharedClusterFractionMax{"tpcSharedClusterFractionMax", {1.f}, "Maximum fraction of shared clusters in TPC"}; o2::framework::Configurable> itsClustersMin{"itsClustersMin", {5.f}, "Minimum number of clusters in ITS"}; @@ -117,8 +118,7 @@ struct ConfTrackSelection : public o2::framework::ConfigurableGroup { std::string prefix = Prefix; // Unique prefix based on the template argument // configuration parameters o2::framework::Configurable pdgCode{"pdgCode", 2212, "Track PDG code"}; - o2::framework::Configurable sign{"sign", 1, "Sign of the track (1 for positive tracks and -1 for negative tracks)"}; - o2::framework::Configurable absCharge{"absCharge", 1, "Absolute charge of the track (keep 1 for all tracks, except for He, it should be 2)"}; + o2::framework::Configurable charge{"charge", 1, "Charge of the track (use +/-1 for positive/negative tracks, except He3 needs +/-2)"}; // filters for kinematics o2::framework::Configurable ptMin{"ptMin", 0.2f, "Minimum pT (GeV/c)"}; o2::framework::Configurable ptMax{"ptMax", 6.f, "Maximum pT (GeV/c)"}; @@ -146,14 +146,15 @@ using ConfTrackSelection3 = ConfTrackSelection; /// enum for all track selections enum TrackSels { // track quality cuts - kTPCnClsMin, ///< Min. number of TPC clusters - kTPCcRowsMin, ///< Min. number of crossed TPC rows - kTPCsClsMax, ///< Max. number of shared TPC clusters - kTPCsClsFracMax, ///< Max. fractions of shared TPC clusters - kITSnClsMin, ///< Min. number of ITS clusters - kITSnClsIbMin, ///< Min. number of ITS clusters in the inner barrel - kDCAxyMax, ///< Max. |DCA_xy| (cm) as a function of pT - kDCAzMax, ///< Max. |DCA_z| (cm) as a function of pT + kTPCnClsMin, ///< Min. number of TPC clusters + kTPCcRowsMin, ///< Min. number of crossed TPC rows + kTPCnClsOvercRowsMin, ///< Min. fraction of TPC clusters of TPC crossed rows + kTPCsClsMax, ///< Max. number of shared TPC clusters + kTPCsClsFracMax, ///< Max. fractions of shared TPC clusters + kITSnClsMin, ///< Min. number of ITS clusters + kITSnClsIbMin, ///< Min. number of ITS clusters in the inner barrel + kDCAxyMax, ///< Max. |DCA_xy| (cm) as a function of pT + kDCAzMax, ///< Max. |DCA_z| (cm) as a function of pT /// track pid cuts kItsElectron, ///< ITS Electon PID @@ -203,6 +204,8 @@ const char trackSelsName[] = "Track Selection Object"; const std::unordered_map trackSelsToString = { {kTPCnClsMin, "Min. number of TPC clusters"}, {kTPCcRowsMin, "Min. number of crossed TPC rows"}, + {kTPCnClsOvercRowsMin, "Min. fraction of TPC clusters over TPC crossed rows"}, + {kTPCsClsMax, "Max. number of shared TPC clusters"}, {kTPCsClsMax, "Max. number of shared TPC clusters"}, {kTPCsClsFracMax, "Max. fractions of shared TPC clusters"}, {kITSnClsMin, "Min. number of ITS clusters"}, @@ -272,6 +275,7 @@ class TrackSelection : public BaseSelectionaddSelection(config.tpcClustersMin.value, kTPCnClsMin, limits::kLowerLimit, true, true); this->addSelection(config.tpcCrossedRowsMin.value, kTPCcRowsMin, limits::kLowerLimit, true, true); + this->addSelection(config.tpcClustersOverCrossedRows.value, kTPCnClsOvercRowsMin, limits::kLowerLimit, true, true); this->addSelection(config.tpcSharedClustersMax.value, kTPCsClsMax, limits::kUpperLimit, true, true); this->addSelection(config.tpcSharedClusterFractionMax.value, kTPCsClsFracMax, limits::kUpperLimit, true, true); this->addSelection(config.itsClustersMin.value, kITSnClsMin, limits::kLowerLimit, true, true); @@ -342,6 +346,7 @@ class TrackSelection : public BaseSelectionreset(); this->evaluateObservable(kTPCnClsMin, Track.tpcNClsFound()); this->evaluateObservable(kTPCcRowsMin, Track.tpcNClsCrossedRows()); + this->evaluateObservable(kTPCnClsOvercRowsMin, static_cast(Track.tpcNClsFound()) / static_cast(Track.tpcNClsCrossedRows())); this->evaluateObservable(kTPCsClsMax, Track.tpcNClsShared()); this->evaluateObservable(kTPCsClsFracMax, static_cast(Track.tpcNClsShared()) / static_cast(Track.tpcNClsFound())); this->evaluateObservable(kITSnClsMin, Track.itsNCls()); diff --git a/PWGCF/Femto/Core/trackHistManager.h b/PWGCF/Femto/Core/trackHistManager.h index 197c47983cc..f77bf9a029f 100644 --- a/PWGCF/Femto/Core/trackHistManager.h +++ b/PWGCF/Femto/Core/trackHistManager.h @@ -48,6 +48,7 @@ enum TrackHist { kItsClusterIb, kTpcCrossedRows, kTpcCluster, + kTpcClusterOverCrossedRows, kTpcClusterShared, kTpcClusterFractionShared, // kDcaxy, @@ -59,7 +60,11 @@ enum TrackHist { kPhiVsEta, kPtVsItsCluster, kPtVsTpcCluster, + kPtVsTpcCrossedRows, + kPtVsTpcClusterOverCrossedRows, kPtVsTpcClusterShared, + kPtVsTpcClusterFractionShared, + kTpcClusterVsTpcCrossedRows, kTpcClusterVsTpcClusterShared, kPtVsDcaxy, kPtVsDcaz, @@ -151,6 +156,7 @@ struct ConfTrackQaBinning : o2::framework::ConfigurableGroup { o2::framework::ConfigurableAxis itsClusterIb{"itsClusterIb", {{4, -0.5, 3.5}}, "ITS cluster in inner barrel"}; o2::framework::ConfigurableAxis tpcCrossedRows{"tpcCrossedRows", {{161, -0.5, 160.5}}, "TPC cluster"}; o2::framework::ConfigurableAxis tpcCluster{"tpcCluster", {{161, -0.5, 160.5}}, "TPC cluster"}; + o2::framework::ConfigurableAxis tpcClusterOverCrossedRows{"tpcClusterOverCrossedRows", {{75, 0, 1.5}}, "TPC cluster over TPC crossed rows"}; o2::framework::ConfigurableAxis tpcClusterShared{"tpcClusterShared", {{161, -0.5, 160.5}}, "TPC cluster shared"}; o2::framework::ConfigurableAxis tpcClusterFractionShared{"tpcClusterFractionShared", {{60, 0, 1.2}}, "TPC cluster fraction shared"}; o2::framework::ConfigurableAxis dcaXy{"dcaXy", {{300, -0.3, 0.3}}, "DCA_xy"}; @@ -231,6 +237,7 @@ constexpr std::array, kTrackHistLast> HistTable {kItsClusterIb, o2::framework::kTH1F, "hItsClusterIb", "ITS cluster in inner barrel; ITS IB cluster; Entries"}, {kTpcCrossedRows, o2::framework::kTH1F, "hTpcCrossedRows", "TPC crossed rows; TPC crossed rows; Entries"}, {kTpcCluster, o2::framework::kTH1F, "hTpcCluster", "TPC cluster found; TPC cluster found; Entries"}, + {kTpcClusterOverCrossedRows, o2::framework::kTH1F, "hTpcClusterOverCrossedRows", "TPC cluster found over TPC crossed rows; TPC cluster found / Tpc crossed rows; Entries"}, {kTpcClusterShared, o2::framework::kTH1F, "hTpcClusterShared", "TPC cluster shared; TPC cluster shared ; Entries"}, {kTpcClusterFractionShared, o2::framework::kTH1F, "hTpcClusterFractionShared", "TPC cluster fraction shared; TPC cluster found / TPC cluster shared ; Entries"}, {kPtVsEta, o2::framework::kTH2F, "hPtVsEta", "p_{T} vs #eta; p_{T} (GeV/#it{c}) ; #eta"}, @@ -238,7 +245,11 @@ constexpr std::array, kTrackHistLast> HistTable {kPhiVsEta, o2::framework::kTH2F, "hPhiVsEta", "#varphi vs #eta; #varphi ; #eta"}, {kPtVsItsCluster, o2::framework::kTH2F, "hPtVsItsCluster", "p_{T} vs ITS cluster; p_{T} (GeV/#it{c}) ; ITS cluster"}, {kPtVsTpcCluster, o2::framework::kTH2F, "hPtVsTpcCluster", "p_{T} vs TPC cluster found; p_{T} (GeV/#it{c}) ; TPC cluster found"}, + {kPtVsTpcCrossedRows, o2::framework::kTH2F, "hPtVsTpcCrossedRows", "p_{T} vs TPC crossed rows; p_{T} (GeV/#it{c}) ; TPC crossed rows"}, + {kPtVsTpcClusterOverCrossedRows, o2::framework::kTH2F, "hPtVsTpcClusterOverCrossedRows", "p_{T} vs TPC cluster found over crossed rows; p_{T} (GeV/#it{c}) ; TPC cluster found / TPC crossed rows"}, {kPtVsTpcClusterShared, o2::framework::kTH2F, "hPtVsTpcClusterShared", "p_{T} vs TPC cluster shared; p_{T} (GeV/#it{c}) ; TPC cluster shared"}, + {kPtVsTpcClusterFractionShared, o2::framework::kTH2F, "hPtVsTpcClusterSharedFraction", "p_{T} vs TPC cluster shared over TPC cluster found; p_{T} (GeV/#it{c}) ; TPC cluster shared / TPC cluster found"}, + {kTpcClusterVsTpcCrossedRows, o2::framework::kTH2F, "hTpcClusterVsTpcCrossedRows", "TPC cluster found vs TPC crossed rows; TPC cluster found; TPC crossed rows"}, {kTpcClusterVsTpcClusterShared, o2::framework::kTH2F, "hTpcClusterVsTpcClusterShared", "TPC cluster found vs TPC cluster shared; TPC cluster found; TPC cluster shared"}, {kPtVsDcaxy, o2::framework::kTH2F, "hPtVsDcaxy", "p_{T} vs DCA_{XY}; p_{T} (GeV/#it{c}); DCA_{XY} (cm)"}, {kPtVsDcaz, o2::framework::kTH2F, "hPtVsDcaz", "p_{T} vs DCA_{Z}; p_{T} (GeV/#it{c}); DCA_{Z} (cm)"}, @@ -308,10 +319,15 @@ auto makeTrackQaHistSpecMap(const T1& confBinningAnalysis, const T2 confiBinning {kPhiVsEta, {confBinningAnalysis.phi, confBinningAnalysis.eta}}, {kPtVsItsCluster, {confBinningAnalysis.pt, confiBinningQa.itsCluster}}, {kPtVsTpcCluster, {confBinningAnalysis.pt, confiBinningQa.tpcCluster}}, + {kPtVsTpcCrossedRows, {confBinningAnalysis.pt, confiBinningQa.tpcCrossedRows}}, + {kPtVsTpcClusterOverCrossedRows, {confBinningAnalysis.pt, confiBinningQa.tpcClusterOverCrossedRows}}, {kPtVsTpcClusterShared, {confBinningAnalysis.pt, confiBinningQa.tpcClusterShared}}, + {kPtVsTpcClusterFractionShared, {confBinningAnalysis.pt, confiBinningQa.tpcClusterFractionShared}}, + {kTpcClusterVsTpcCrossedRows, {confiBinningQa.tpcCluster, confiBinningQa.tpcCrossedRows}}, {kTpcClusterVsTpcClusterShared, {confiBinningQa.tpcCluster, confiBinningQa.tpcClusterShared}}, {kTpcCrossedRows, {confiBinningQa.tpcCrossedRows}}, {kTpcCluster, {confiBinningQa.tpcCluster}}, + {kTpcClusterOverCrossedRows, {confiBinningQa.tpcClusterOverCrossedRows}}, {kTpcClusterShared, {confiBinningQa.tpcClusterShared}}, {kTpcClusterFractionShared, {confiBinningQa.tpcClusterFractionShared}}, {kPtVsDcaxy, {confBinningAnalysis.pt, confiBinningQa.dcaXy}}, @@ -400,7 +416,7 @@ class TrackHistManager void init(o2::framework::HistogramRegistry* registry, std::map> Specs, float charge = 1, int momentumTypeForPid = 0) { mHistogramRegistry = registry; - mAbsCharge = std::fabs(charge); + mAbsCharge = std::fabs(charge); // stored absolute charge of the track to scale the momentum in case of Z!=1 (case only for He3) if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { std::string analysisDir = std::string(prefix) + std::string(AnalysisDir); @@ -419,6 +435,7 @@ class TrackHistManager mHistogramRegistry->add(qaDir + GetHistNamev2(kItsClusterIb, HistTable), GetHistDesc(kItsClusterIb, HistTable), GetHistType(kItsClusterIb, HistTable), {Specs[kItsClusterIb]}); mHistogramRegistry->add(qaDir + GetHistNamev2(kTpcCrossedRows, HistTable), GetHistDesc(kTpcCrossedRows, HistTable), GetHistType(kTpcCrossedRows, HistTable), {Specs[kTpcCrossedRows]}); mHistogramRegistry->add(qaDir + GetHistNamev2(kTpcCluster, HistTable), GetHistDesc(kTpcCluster, HistTable), GetHistType(kTpcCluster, HistTable), {Specs[kTpcCluster]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kTpcClusterOverCrossedRows, HistTable), GetHistDesc(kTpcClusterOverCrossedRows, HistTable), GetHistType(kTpcClusterOverCrossedRows, HistTable), {Specs[kTpcClusterOverCrossedRows]}); mHistogramRegistry->add(qaDir + GetHistNamev2(kTpcClusterShared, HistTable), GetHistDesc(kTpcClusterShared, HistTable), GetHistType(kTpcClusterShared, HistTable), {Specs[kTpcClusterShared]}); mHistogramRegistry->add(qaDir + GetHistNamev2(kTpcClusterFractionShared, HistTable), GetHistDesc(kTpcClusterFractionShared, HistTable), GetHistType(kTpcClusterFractionShared, HistTable), {Specs[kTpcClusterFractionShared]}); @@ -428,7 +445,11 @@ class TrackHistManager mHistogramRegistry->add(qaDir + GetHistNamev2(kPhiVsEta, HistTable), GetHistDesc(kPhiVsEta, HistTable), GetHistType(kPhiVsEta, HistTable), {Specs[kPhiVsEta]}); mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsItsCluster, HistTable), GetHistDesc(kPtVsItsCluster, HistTable), GetHistType(kPtVsItsCluster, HistTable), {Specs[kPtVsItsCluster]}); mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsTpcCluster, HistTable), GetHistDesc(kPtVsTpcCluster, HistTable), GetHistType(kPtVsTpcCluster, HistTable), {Specs[kPtVsTpcCluster]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsTpcCrossedRows, HistTable), GetHistDesc(kPtVsTpcCrossedRows, HistTable), GetHistType(kPtVsTpcCrossedRows, HistTable), {Specs[kPtVsTpcCrossedRows]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsTpcClusterOverCrossedRows, HistTable), GetHistDesc(kPtVsTpcClusterOverCrossedRows, HistTable), GetHistType(kPtVsTpcClusterOverCrossedRows, HistTable), {Specs[kPtVsTpcClusterOverCrossedRows]}); mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsTpcClusterShared, HistTable), GetHistDesc(kPtVsTpcClusterShared, HistTable), GetHistType(kPtVsTpcClusterShared, HistTable), {Specs[kPtVsTpcClusterShared]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsTpcClusterFractionShared, HistTable), GetHistDesc(kPtVsTpcClusterFractionShared, HistTable), GetHistType(kPtVsTpcClusterFractionShared, HistTable), {Specs[kPtVsTpcClusterFractionShared]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kTpcClusterVsTpcCrossedRows, HistTable), GetHistDesc(kTpcClusterVsTpcCrossedRows, HistTable), GetHistType(kTpcClusterVsTpcCrossedRows, HistTable), {Specs[kTpcClusterVsTpcCrossedRows]}); mHistogramRegistry->add(qaDir + GetHistNamev2(kTpcClusterVsTpcClusterShared, HistTable), GetHistDesc(kTpcClusterVsTpcClusterShared, HistTable), GetHistType(kTpcClusterVsTpcClusterShared, HistTable), {Specs[kTpcClusterVsTpcClusterShared]}); // dca @@ -501,6 +522,7 @@ class TrackHistManager mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kItsClusterIb, HistTable)), static_cast(track.itsNClsInnerBarrel())); mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kTpcCrossedRows, HistTable)), static_cast(track.tpcNClsCrossedRows())); mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kTpcCluster, HistTable)), static_cast(track.tpcNClsFound())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kTpcClusterOverCrossedRows, HistTable)), static_cast(track.tpcNClsFound()) / static_cast(track.tpcNClsCrossedRows())); mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kTpcClusterShared, HistTable)), static_cast(track.tpcNClsShared())); mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kTpcClusterFractionShared, HistTable)), track.tpcSharedOverFound()); @@ -509,7 +531,11 @@ class TrackHistManager mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPhiVsEta, HistTable)), track.phi(), track.eta()); mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsItsCluster, HistTable)), mAbsCharge * track.pt(), static_cast(track.itsNCls())); mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsTpcCluster, HistTable)), mAbsCharge * track.pt(), static_cast(track.tpcNClsFound())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsTpcCrossedRows, HistTable)), mAbsCharge * track.pt(), static_cast(track.tpcNClsCrossedRows())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsTpcClusterOverCrossedRows, HistTable)), mAbsCharge * track.pt(), static_cast(track.tpcNClsFound()) / static_cast(track.tpcNClsCrossedRows())); mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsTpcClusterShared, HistTable)), mAbsCharge * track.pt(), static_cast(track.tpcNClsShared())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsTpcClusterFractionShared, HistTable)), mAbsCharge * track.pt(), static_cast(track.tpcNClsShared()) / static_cast(track.tpcNClsFound())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kTpcClusterVsTpcCrossedRows, HistTable)), static_cast(track.tpcNClsFound()), static_cast(track.tpcNClsCrossedRows())); mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kTpcClusterVsTpcClusterShared, HistTable)), static_cast(track.tpcNClsFound()), static_cast(track.tpcNClsShared())); mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsDcaxy, HistTable)), mAbsCharge * track.pt(), track.dcaXY()); diff --git a/PWGCF/Femto/Core/twoTrackResonanceBuilder.h b/PWGCF/Femto/Core/twoTrackResonanceBuilder.h index c1f944ed51d..e9bbeb0c245 100644 --- a/PWGCF/Femto/Core/twoTrackResonanceBuilder.h +++ b/PWGCF/Femto/Core/twoTrackResonanceBuilder.h @@ -127,7 +127,8 @@ struct ConfKstar0Bits : o2::framework::ConfigurableGroup { #undef TWOTRACKRESONANCE_KAONPID_BITS #undef TWOTRACKRESONANCE_PIONPID_BITS -#define TWOTRACKRESONANCE_DEFAULT_SELECTION(defaultMassMin, defaultMassMax) \ +#define TWOTRACKRESONANCE_DEFAULT_SELECTION(defaultPdgCode, defaultMassMin, defaultMassMax) \ + o2::framework::Configurable pdgCode{"pdgCode", defaultPdgCode, "Resonance PDG code"}; \ o2::framework::Configurable ptMin{"ptMin", 0.f, "Minimum pT"}; \ o2::framework::Configurable ptMax{"ptMax", 6.f, "Maximum pT"}; \ o2::framework::Configurable etaMin{"etaMin", -0.9f, "Minimum eta"}; \ @@ -145,18 +146,18 @@ struct ConfKstar0Bits : o2::framework::ConfigurableGroup { struct ConfPhiSelection : o2::framework::ConfigurableGroup { std::string prefix = std::string("PhiSelection"); - TWOTRACKRESONANCE_DEFAULT_SELECTION(0.95f, 1.05f) + TWOTRACKRESONANCE_DEFAULT_SELECTION(333, 0.95f, 1.05f) }; struct ConfRho0Selection : o2::framework::ConfigurableGroup { - std::string prefix = std::string("RhoSelection"); - TWOTRACKRESONANCE_DEFAULT_SELECTION(0.7f, 0.84f) + std::string prefix = std::string("Rho0Selection"); + TWOTRACKRESONANCE_DEFAULT_SELECTION(113, 0.7f, 0.84f) }; struct ConfKstar0Selection : o2::framework::ConfigurableGroup { std::string prefix = std::string("Kstar0Selection"); o2::framework::Configurable sign{"sign", 1, "Sign (+1 for Kstar0 and -1 for Kstar0Bar) "}; - TWOTRACKRESONANCE_DEFAULT_SELECTION(0.8f, 1.0f) + TWOTRACKRESONANCE_DEFAULT_SELECTION(313, 0.8f, 1.0f) }; #undef TWOTRACKRESONANCE_DEFAULT_SELECTION diff --git a/PWGCF/Femto/Core/twoTrackResonanceHistManager.h b/PWGCF/Femto/Core/twoTrackResonanceHistManager.h index b6e429b434a..1df3af003a4 100644 --- a/PWGCF/Femto/Core/twoTrackResonanceHistManager.h +++ b/PWGCF/Femto/Core/twoTrackResonanceHistManager.h @@ -93,7 +93,7 @@ std::map> makeTwoTrackRe {kEta, {confBinningAnalysis.eta}}, {kPhi, {confBinningAnalysis.phi}}, {kMass, {confBinningAnalysis.mass}}, - {kSign, {confBinningAnalysis.sing}}}; + {kSign, {confBinningAnalysis.sign}}}; }; template diff --git a/PWGCF/Femto/DataModel/FemtoTables.h b/PWGCF/Femto/DataModel/FemtoTables.h index 9f87b6a6d24..0756e3a91e1 100644 --- a/PWGCF/Femto/DataModel/FemtoTables.h +++ b/PWGCF/Femto/DataModel/FemtoTables.h @@ -35,6 +35,7 @@ namespace o2::aod namespace femtocollisions { DECLARE_SOA_COLUMN(CollisionMask, collisionMask, femtodatatypes::CollisionMaskType); //! Bitmask for collision selections +DECLARE_SOA_COLUMN(CollisionTag, collisionTag, femtodatatypes::CollisionTagType); //! Bitmask for collision selections DECLARE_SOA_COLUMN(PosX, posX, float); //! x coordinate of vertex DECLARE_SOA_COLUMN(PosY, posY, float); //! y coordinate of vertex diff --git a/PWGCF/Femto/TableProducer/femtoProducer.cxx b/PWGCF/Femto/TableProducer/femtoProducer.cxx index c5140fb5855..54b42aa8693 100644 --- a/PWGCF/Femto/TableProducer/femtoProducer.cxx +++ b/PWGCF/Femto/TableProducer/femtoProducer.cxx @@ -91,6 +91,7 @@ struct FemtoProducer { collisionbuilder::ConfCollisionTables confCollisionTables; collisionbuilder::ConfCollisionFilters confCollisionFilters; collisionbuilder::ConfCollisionBits confCollisionBits; + collisionbuilder::ConfCollisionRctFlags confCollisionRctFlags; collisionbuilder::ConfCollisionTriggers confCollisionTriggers; collisionbuilder::CollisionBuilder collisionBuilder; @@ -192,7 +193,7 @@ struct FemtoProducer { ccdb->setCreatedNotAfter(now); // collision selection - collisionBuilder.init(confCollisionFilters, confCollisionBits, confCollisionTables, confCollisionTriggers, context); + collisionBuilder.init(confCollisionFilters, confCollisionBits, confCollisionRctFlags, confCollisionTriggers, confCollisionTables, context); // configure track builder trackBuilder.init(confTrackBits, confTrackFilters, confTrackTables, context); diff --git a/PWGCF/Femto/Tasks/CMakeLists.txt b/PWGCF/Femto/Tasks/CMakeLists.txt index 1763a60b7bc..8fdc9dacae4 100644 --- a/PWGCF/Femto/Tasks/CMakeLists.txt +++ b/PWGCF/Femto/Tasks/CMakeLists.txt @@ -44,6 +44,16 @@ o2physics_add_dpl_workflow(femto-pair-track-v0 PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(femto-pair-track-two-track-resonance + SOURCES femtoPairTrackTwoTrackResonance.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(femto-pair-track-cascade + SOURCES femtoPairTrackCascade.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(femto-pair-track-kink SOURCES femtoPairTrackKink.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore diff --git a/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx b/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx new file mode 100644 index 00000000000..7621d88fc65 --- /dev/null +++ b/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx @@ -0,0 +1,202 @@ +// Copyright 2019-2025 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 femtoPairTrackCascade.cxx +/// \brief Tasks that computes correlation between tracks and cascades +/// \author Anton Riedel, TU München, anton.riedel@cern.ch + +#include "PWGCF/Femto/Core/cascadeBuilder.h" +#include "PWGCF/Femto/Core/cascadeHistManager.h" +#include "PWGCF/Femto/Core/closePairRejection.h" +#include "PWGCF/Femto/Core/collisionBuilder.h" +#include "PWGCF/Femto/Core/collisionHistManager.h" +#include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/pairBuilder.h" +#include "PWGCF/Femto/Core/pairHistManager.h" +#include "PWGCF/Femto/Core/partitions.h" +#include "PWGCF/Femto/Core/trackBuilder.h" +#include "PWGCF/Femto/Core/trackHistManager.h" +#include "PWGCF/Femto/DataModel/FemtoTables.h" + +#include "Framework/ASoA.h" +#include "Framework/AnalysisTask.h" +#include "Framework/Configurable.h" +#include "Framework/Expressions.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" + +#include +#include + +using namespace o2; +using namespace o2::aod; +using namespace o2::soa; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::analysis::femto; + +struct FemtoPairTrackCascade { + + // setup tables + using Collisions = Join; + using Collision = Collisions::iterator; + + using FilteredCollisions = o2::soa::Filtered; + using FilteredCollision = FilteredCollisions::iterator; + + using Tracks = o2::soa::Join; + using Xis = o2::soa::Join; + using Omegas = o2::soa::Join; + + SliceCache cache; + + // setup collisions + collisionbuilder::ConfCollisionSelection collisionSelection; + Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); + colhistmanager::ConfCollisionBinning confCollisionBinning; + + // setup tracks + trackbuilder::ConfTrackSelection1 trackSelection; + trackhistmanager::ConfTrackBinning1 confTrackBinning; + Partition trackPartition = MAKE_TRACK_PARTITION(trackSelection); + Preslice perColTracks = aod::femtobase::stored::collisionId; + + // setup for daughters/bachelor + trackhistmanager::ConfCascadePosDauBinning confPosDauBinning; + trackhistmanager::ConfCascadeNegDauBinning confNegDauBinning; + trackhistmanager::ConfCascadeBachelorBinning confBachelorBinning; + + // setup xis + cascadebuilder::ConfXiSelection xiSelection; + cascadehistmanager::ConfXiBinning confXiBinning; + Partition xiPartition = MAKE_CASCADE_PARTITION(xiSelection); + Preslice perColXis = aod::femtobase::stored::collisionId; + + // setup omegas + cascadebuilder::ConfOmegaSelection omegaSelection; + cascadehistmanager::ConfOmegaBinning confOmegaBinning; + Partition omegaPartition = MAKE_CASCADE_PARTITION(omegaSelection); + Preslice perColOmegas = aod::femtobase::stored::collisionId; + + // setup pairs + pairhistmanager::ConfPairBinning confPairBinning; + + pairbuilder::PairTrackCascadeBuilder< + trackhistmanager::PrefixTrack1, + cascadehistmanager::PrefixXi, + trackhistmanager::PrefixCascadeBachelor, + trackhistmanager::PrefixCascadePosDaughter, + trackhistmanager::PrefixCascadeNegDaughter, + pairhistmanager::PrefixTrackCascadeSe, + pairhistmanager::PrefixTrackCascadeMe, + closepairrejection::PrefixTrackCascadeSe, + closepairrejection::PrefixTrackCascadeMe, + modes::Mode::kAnalysis, + modes::Cascade::kXi> + pairTrackXiBuilder; + + pairbuilder::PairTrackCascadeBuilder< + trackhistmanager::PrefixTrack1, + cascadehistmanager::PrefixOmega, + trackhistmanager::PrefixCascadeBachelor, + trackhistmanager::PrefixCascadePosDaughter, + trackhistmanager::PrefixCascadeNegDaughter, + pairhistmanager::PrefixTrackCascadeSe, + pairhistmanager::PrefixTrackCascadeMe, + closepairrejection::PrefixTrackCascadeSe, + closepairrejection::PrefixTrackCascadeMe, + modes::Mode::kAnalysis, + modes::Cascade::kOmega> + pairTrackOmegaBuilder; + + // setup mixing + std::vector defaultVtxBins{10, -10, 10}; + std::vector defaultMultBins{50, 0, 200}; + std::vector defaultCentBins{10, 0, 100}; + ColumnBinningPolicy mixBinsVtxMult{{defaultVtxBins, defaultMultBins}, true}; + ColumnBinningPolicy mixBinsVtxCent{{defaultVtxBins, defaultCentBins}, true}; + ColumnBinningPolicy mixBinsVtxMultCent{{defaultVtxBins, defaultMultBins, defaultCentBins}, true}; + pairhistmanager::ConfMixing confMixing; + + HistogramRegistry hRegistry{"FemtoTrackCascade", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // setup cpr + closepairrejection::ConfCpr confCpr; + + void init(InitContext&) + { + + // setup columnpolicy for binning + // default values are used during instantiation, so we need to explicity update them here + mixBinsVtxMult = {{confMixing.vtxBins, confMixing.multBins.value}, true}; + mixBinsVtxCent = {{confMixing.vtxBins.value, confMixing.centBins.value}, true}; + mixBinsVtxMultCent = {{confMixing.vtxBins.value, confMixing.multBins.value, confMixing.centBins.value}, true}; + + // setup histograms + auto colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); + auto trackHistSpec = trackhistmanager::makeTrackHistSpecMap(confTrackBinning); + auto bachelorHistSpec = trackhistmanager::makeTrackHistSpecMap(confBachelorBinning); + auto posDauSpec = trackhistmanager::makeTrackHistSpecMap(confPosDauBinning); + auto negDauSpec = trackhistmanager::makeTrackHistSpecMap(confNegDauBinning); + auto pairHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confXiBinning); + auto cprHistSpec = closepairrejection::makeCprHistSpecMap(confCpr); + + // setup for xis + if (doprocessXiSameEvent || doprocessXiMixedEvent) { + auto xiHistSpec = cascadehistmanager::makeCascadeHistSpecMap(confXiBinning); + auto pairTrackXiHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confXiBinning); + pairTrackXiBuilder.init(&hRegistry, trackSelection, xiSelection, confCpr, confMixing, colHistSpec, trackHistSpec, xiHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackXiHistSpec, cprHistSpec); + } + + // setup for omegas + if (doprocessOmegaSameEvent || doprocessOmegaMixedEvent) { + auto omegaHistSpec = cascadehistmanager::makeCascadeHistSpecMap(confOmegaBinning); + auto pairTrackOmegaHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confOmegaBinning); + pairTrackOmegaBuilder.init(&hRegistry, trackSelection, omegaSelection, confCpr, confMixing, colHistSpec, trackHistSpec, omegaHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackOmegaHistSpec, cprHistSpec); + } + + if (((doprocessXiSameEvent || doprocessXiMixedEvent) + (doprocessOmegaSameEvent || doprocessOmegaMixedEvent)) > 1) { + LOG(fatal) << "Can only process xi-tracks Or omega-tracks"; + } + }; + + void processXiSameEvent(FilteredCollision const& col, Tracks const& tracks, Xis const& xis) + { + pairTrackXiBuilder.processSameEvent(col, tracks, trackPartition, xis, xiPartition, cache); + } + PROCESS_SWITCH(FemtoPairTrackCascade, processXiSameEvent, "Enable processing same event processing for tracks and xis", true); + + void processXiMixedEvent(FilteredCollisions const& cols, Tracks const& tracks, Xis const& /*xis*/) + { + pairTrackXiBuilder.processMixedEvent(cols, tracks, trackPartition, xiPartition, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + } + PROCESS_SWITCH(FemtoPairTrackCascade, processXiMixedEvent, "Enable processing mixed event processing for tracks and xis", true); + + void processOmegaSameEvent(FilteredCollision const& col, Tracks const& tracks, Omegas const& omegas) + { + pairTrackOmegaBuilder.processSameEvent(col, tracks, trackPartition, omegas, omegaPartition, cache); + } + PROCESS_SWITCH(FemtoPairTrackCascade, processOmegaSameEvent, "Enable processing same event processing for tracks and omegas", false); + + void processOmegaMixedEvent(FilteredCollisions const& cols, Tracks const& tracks, Omegas const& /*omegas*/) + { + pairTrackOmegaBuilder.processMixedEvent(cols, tracks, trackPartition, omegaPartition, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + } + PROCESS_SWITCH(FemtoPairTrackCascade, processOmegaMixedEvent, "Enable processing mixed event processing for tracks and omegas", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{ + adaptAnalysisTask(cfgc), + }; + return workflow; +} diff --git a/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx b/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx new file mode 100644 index 00000000000..f85cdfa03bb --- /dev/null +++ b/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx @@ -0,0 +1,239 @@ +// Copyright 2019-2025 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 femtoPairTrackTwoTrackResonance.cxx +/// \brief Tasks that computes correlation between tracks and resonances decaying into two tracks +/// \author Anton Riedel, TU München, anton.riedel@cern.ch + +#include "PWGCF/Femto/Core/closePairRejection.h" +#include "PWGCF/Femto/Core/collisionBuilder.h" +#include "PWGCF/Femto/Core/collisionHistManager.h" +#include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/pairBuilder.h" +#include "PWGCF/Femto/Core/pairHistManager.h" +#include "PWGCF/Femto/Core/partitions.h" +#include "PWGCF/Femto/Core/trackBuilder.h" +#include "PWGCF/Femto/Core/trackHistManager.h" +#include "PWGCF/Femto/Core/twoTrackResonanceBuilder.h" +#include "PWGCF/Femto/Core/twoTrackResonanceHistManager.h" +#include "PWGCF/Femto/DataModel/FemtoTables.h" + +#include "Framework/ASoA.h" +#include "Framework/AnalysisTask.h" +#include "Framework/Configurable.h" +#include "Framework/Expressions.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" + +#include +#include + +using namespace o2; +using namespace o2::aod; +using namespace o2::soa; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::analysis::femto; + +struct FemtoPairTrackTwoTrackResonance { + + // setup tables + using Collisions = Join; + using Collision = Collisions::iterator; + + using FilteredCollisions = o2::soa::Filtered; + using FilteredCollision = FilteredCollisions::iterator; + + using Tracks = o2::soa::Join; + using Phis = o2::soa::Join; + using Kstar0s = o2::soa::Join; + using Rho0s = o2::soa::Join; + + SliceCache cache; + + // setup collisions + collisionbuilder::ConfCollisionSelection collisionSelection; + Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); + colhistmanager::ConfCollisionBinning confCollisionBinning; + + // setup tracks + trackbuilder::ConfTrackSelection1 trackSelection; + trackhistmanager::ConfTrackBinning1 confTrackBinning; + Partition trackPartition = MAKE_TRACK_PARTITION(trackSelection); + Preslice perColTracks = aod::femtobase::stored::collisionId; + + // setup for daughters + trackhistmanager::ConfResonancePosDauBinning confPosDauBinning; + trackhistmanager::ConfResonanceNegDauBinning confNegDauBinning; + + // setup phis + twotrackresonancebuilder::ConfPhiSelection phiSelection; + twotrackresonancehistmanager::ConfPhiBinning confPhiBinning; + Partition phiPartition = MAKE_RESONANCE_0_PARTITON(phiSelection); + Preslice perColPhis = aod::femtobase::stored::collisionId; + + // setup kstar0 + twotrackresonancebuilder::ConfKstar0Selection kstar0Selection; + twotrackresonancehistmanager::ConfKstar0Binning confKstar0Binning; + Partition kstar0Partition = MAKE_RESONANCE_1_PARTITON(kstar0Selection); + Preslice perColKstar0s = aod::femtobase::stored::collisionId; + + // rho0s + twotrackresonancebuilder::ConfRho0Selection rho0Selection; + twotrackresonancehistmanager::ConfRho0Binning confRho0Binning; + Partition rho0Partition = MAKE_RESONANCE_0_PARTITON(rho0Selection); + Preslice perColRho0s = aod::femtobase::stored::collisionId; + + // setup pairs + pairhistmanager::ConfPairBinning confPairBinning; + + // setup for track-phi pairs + pairbuilder::PairTrackTwoTrackResonanceBuilder< + trackhistmanager::PrefixTrack1, + twotrackresonancehistmanager::PrefixPhi, + trackhistmanager::PrefixResonancePosDaughter, + trackhistmanager::PrefixResonanceNegDaughter, + pairhistmanager::PrefixTrackResonanceSe, + pairhistmanager::PrefixTrackResonanceMe, + closepairrejection::PrefixTrackV0Se, + closepairrejection::PrefixTrackV0Me, + modes::Mode::kAnalysis, + modes::TwoTrackResonance::kPhi> + pairTrackPhiBuilder; + + // setup for track-kstar0 pairs + pairbuilder::PairTrackTwoTrackResonanceBuilder< + trackhistmanager::PrefixTrack1, + twotrackresonancehistmanager::PrefixKstar, + trackhistmanager::PrefixResonancePosDaughter, + trackhistmanager::PrefixResonanceNegDaughter, + pairhistmanager::PrefixTrackResonanceSe, + pairhistmanager::PrefixTrackResonanceMe, + closepairrejection::PrefixTrackV0Se, + closepairrejection::PrefixTrackV0Me, + modes::Mode::kAnalysis, + modes::TwoTrackResonance::kKstar0> + pairTrackKstar0Builder; + + // setup for track-rho0 pairs + pairbuilder::PairTrackTwoTrackResonanceBuilder< + trackhistmanager::PrefixTrack1, + twotrackresonancehistmanager::PrefixRho, + trackhistmanager::PrefixResonancePosDaughter, + trackhistmanager::PrefixResonanceNegDaughter, + pairhistmanager::PrefixTrackResonanceSe, + pairhistmanager::PrefixTrackResonanceMe, + closepairrejection::PrefixTrackV0Se, + closepairrejection::PrefixTrackV0Me, + modes::Mode::kAnalysis, + modes::TwoTrackResonance::kRho0> + pairTrackRho0Builder; + + // setup mixing + std::vector defaultVtxBins{10, -10, 10}; + std::vector defaultMultBins{50, 0, 200}; + std::vector defaultCentBins{10, 0, 100}; + ColumnBinningPolicy mixBinsVtxMult{{defaultVtxBins, defaultMultBins}, true}; + ColumnBinningPolicy mixBinsVtxCent{{defaultVtxBins, defaultCentBins}, true}; + ColumnBinningPolicy mixBinsVtxMultCent{{defaultVtxBins, defaultMultBins, defaultCentBins}, true}; + pairhistmanager::ConfMixing confMixing; + + HistogramRegistry hRegistry{"FemtoTrackTwoTrackResonance", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // setup cpr + closepairrejection::ConfCpr confCpr; + + void init(InitContext&) + { + + if (((doprocessPhiSameEvent || doprocessPhiMixedEvent) + (doprocessKstar0SameEvent || doprocessKstar0MixedEvent)) + (doprocessRho0SameEvent || doprocessRho0MixedEvent) > 1) { + LOG(fatal) << "Can only process lambda-tracks Or k0short-tracks"; + } + + // setup columnpolicy for binning + // default values are used during instantiation, so we need to explicity update them here + mixBinsVtxMult = {{confMixing.vtxBins, confMixing.multBins.value}, true}; + mixBinsVtxCent = {{confMixing.vtxBins.value, confMixing.centBins.value}, true}; + mixBinsVtxMultCent = {{confMixing.vtxBins.value, confMixing.multBins.value, confMixing.centBins.value}, true}; + + // setup histograms + auto colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); + auto trackHistSpec = trackhistmanager::makeTrackHistSpecMap(confTrackBinning); + auto posDauSpec = trackhistmanager::makeTrackHistSpecMap(confPosDauBinning); + auto negDauSpec = trackhistmanager::makeTrackHistSpecMap(confNegDauBinning); + auto cprHistSpec = closepairrejection::makeCprHistSpecMap(confCpr); + + // setup for phi + if (doprocessPhiSameEvent || doprocessPhiMixedEvent) { + auto phiHistSpec = twotrackresonancehistmanager::makeTwoTrackResonanceHistSpecMap(confPhiBinning); + auto pairTrackPhiHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confPhiBinning); + pairTrackPhiBuilder.init(&hRegistry, trackSelection, phiSelection, confCpr, confMixing, colHistSpec, trackHistSpec, phiHistSpec, posDauSpec, negDauSpec, pairTrackPhiHistSpec, cprHistSpec); + } + + // setup for kstar0 + if (doprocessKstar0SameEvent || doprocessKstar0MixedEvent) { + auto kstar0HistSpec = twotrackresonancehistmanager::makeTwoTrackResonanceHistSpecMap(confKstar0Binning); + auto pairTrackKstar0HistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confKstar0Binning); + pairTrackKstar0Builder.init(&hRegistry, trackSelection, kstar0Selection, confCpr, confMixing, colHistSpec, trackHistSpec, kstar0HistSpec, posDauSpec, negDauSpec, pairTrackKstar0HistSpec, cprHistSpec); + } + + // setup for kstar0 + if (doprocessRho0SameEvent || doprocessRho0MixedEvent) { + auto rho0HistSpec = twotrackresonancehistmanager::makeTwoTrackResonanceHistSpecMap(confRho0Binning); + auto pairTrackRho0HistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confRho0Binning); + pairTrackRho0Builder.init(&hRegistry, trackSelection, rho0Selection, confCpr, confMixing, colHistSpec, trackHistSpec, rho0HistSpec, posDauSpec, negDauSpec, pairTrackRho0HistSpec, cprHistSpec); + } + }; + + void processPhiSameEvent(FilteredCollision const& col, Tracks const& tracks, Phis const& phis) + { + pairTrackPhiBuilder.processSameEvent(col, tracks, trackPartition, phis, phiPartition, cache); + } + PROCESS_SWITCH(FemtoPairTrackTwoTrackResonance, processPhiSameEvent, "Enable processing same event processing for tracks and phis", true); + + void processPhiMixedEvent(FilteredCollisions const& cols, Tracks const& tracks, Phis const& /*phis*/) + { + pairTrackPhiBuilder.processMixedEvent(cols, tracks, trackPartition, phiPartition, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + } + PROCESS_SWITCH(FemtoPairTrackTwoTrackResonance, processPhiMixedEvent, "Enable processing mixed event processing for tracks and phis", true); + + void processKstar0SameEvent(FilteredCollision const& col, Tracks const& tracks, Kstar0s const& kstar0s) + { + pairTrackKstar0Builder.processSameEvent(col, tracks, trackPartition, kstar0s, kstar0Partition, cache); + } + PROCESS_SWITCH(FemtoPairTrackTwoTrackResonance, processKstar0SameEvent, "Enable processing same event processing for tracks and kstar0s", false); + + void processKstar0MixedEvent(FilteredCollisions const& cols, Tracks const& tracks, Kstar0s const& /*kstar0s*/) + { + pairTrackKstar0Builder.processMixedEvent(cols, tracks, trackPartition, kstar0Partition, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + } + PROCESS_SWITCH(FemtoPairTrackTwoTrackResonance, processKstar0MixedEvent, "Enable processing mixed event processing for tracks and kstar0s", false); + + void processRho0SameEvent(FilteredCollision const& col, Tracks const& tracks, Rho0s const& rho0s) + { + pairTrackRho0Builder.processSameEvent(col, tracks, trackPartition, rho0s, rho0Partition, cache); + } + PROCESS_SWITCH(FemtoPairTrackTwoTrackResonance, processRho0SameEvent, "Enable processing same event processing for tracks and rho0s", false); + + void processRho0MixedEvent(FilteredCollisions const& cols, Tracks const& tracks, Rho0s const& /*rho0s*/) + { + pairTrackRho0Builder.processMixedEvent(cols, tracks, trackPartition, rho0Partition, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + } + PROCESS_SWITCH(FemtoPairTrackTwoTrackResonance, processRho0MixedEvent, "Enable processing mixed event processing for tracks and rho0s", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{ + adaptAnalysisTask(cfgc), + }; + return workflow; +} diff --git a/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx b/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx index 4ff228948f6..e72c7f64ac2 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx @@ -142,25 +142,24 @@ struct FemtoPairTrackV0 { auto trackHistSpec = trackhistmanager::makeTrackHistSpecMap(confTrackBinning); auto posDauSpec = trackhistmanager::makeTrackHistSpecMap(confPosDauBinning); auto negDauSpec = trackhistmanager::makeTrackHistSpecMap(confNegDauBinning); - auto pairHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confLambdaBinning); auto cprHistSpec = closepairrejection::makeCprHistSpecMap(confCpr); // setup for lambda - // if (doprocessLambdaSameEvent || doprocessLambdaMixedEvent) { - if (doprocessLambdaSameEvent) { + if (doprocessLambdaSameEvent || doprocessLambdaMixedEvent) { auto lambdaHistSpec = v0histmanager::makeV0HistSpecMap(confLambdaBinning); - pairTrackLambdaBuilder.init(&hRegistry, trackSelection, lambdaSelection, confCpr, confMixing, colHistSpec, trackHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairHistSpec, cprHistSpec); + auto pairTrackLambdaHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confLambdaBinning); + pairTrackLambdaBuilder.init(&hRegistry, trackSelection, lambdaSelection, confCpr, confMixing, colHistSpec, trackHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairTrackLambdaHistSpec, cprHistSpec); } - // if (((doprocessLambdaSameEvent || doprocessLambdaMixedEvent) + (doprocessK0shortSameEvent || doprocessK0shortMixedEvent)) > 1) { - // LOG(fatal) << "Can only process lambda-tracks Or k0short-tracks"; - // } - // setup for k0short - // if (doprocessK0shortSameEvent || doprocessK0shortMixedEvent) { - if (doprocessK0shortSameEvent) { + if (doprocessK0shortSameEvent || doprocessK0shortMixedEvent) { auto k0shortHistSpec = v0histmanager::makeV0HistSpecMap(confK0shortBinning); - pairTrackK0shortBuilder.init(&hRegistry, trackSelection, lambdaSelection, confCpr, confMixing, colHistSpec, trackHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairHistSpec, cprHistSpec); + auto pairTrackK0shortHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confLambdaBinning); + pairTrackK0shortBuilder.init(&hRegistry, trackSelection, lambdaSelection, confCpr, confMixing, colHistSpec, trackHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairTrackK0shortHistSpec, cprHistSpec); + } + + if (((doprocessLambdaSameEvent || doprocessLambdaMixedEvent) + (doprocessK0shortSameEvent || doprocessK0shortMixedEvent)) > 1) { + LOG(fatal) << "Can only process lambda-tracks Or k0short-tracks"; } }; diff --git a/PWGCF/Femto/Tasks/femtoTrackQa.cxx b/PWGCF/Femto/Tasks/femtoTrackQa.cxx index 53338a1852d..6398257a98d 100644 --- a/PWGCF/Femto/Tasks/femtoTrackQa.cxx +++ b/PWGCF/Femto/Tasks/femtoTrackQa.cxx @@ -76,7 +76,7 @@ struct FemtoTrackQa { auto colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); colHistManager.init(&hRegistry, colHistSpec); auto trackHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confTrackBinning, confTrackQaBinning); - trackHistManager.init(&hRegistry, trackHistSpec, trackSelections.absCharge.value, confTrackQaBinning.momentumType.value); + trackHistManager.init(&hRegistry, trackHistSpec, trackSelections.charge.value, confTrackQaBinning.momentumType.value); }; void process(FilteredCollision const& col, Tracks const& /*tracks*/) From f2e614f02c5a1d978570ec2e58d0186529423380 Mon Sep 17 00:00:00 2001 From: vbarbaso <146095385+vbarbaso@users.noreply.github.com> Date: Thu, 25 Sep 2025 21:42:54 +0200 Subject: [PATCH 541/986] [PWGLF] Add rotational background support to phianalysisTHnSparse.cxx and rsnOutput.h (#13132) Signed-off-by: Veronika Barbasova Co-authored-by: Veronika Barbasova --- .../Tasks/Resonances/phianalysisTHnSparse.cxx | 225 ++++++------------ PWGLF/Utils/rsnOutput.h | 53 ++--- 2 files changed, 98 insertions(+), 180 deletions(-) diff --git a/PWGLF/Tasks/Resonances/phianalysisTHnSparse.cxx b/PWGLF/Tasks/Resonances/phianalysisTHnSparse.cxx index 5d16db9af39..14994cd0c16 100644 --- a/PWGLF/Tasks/Resonances/phianalysisTHnSparse.cxx +++ b/PWGLF/Tasks/Resonances/phianalysisTHnSparse.cxx @@ -43,9 +43,11 @@ struct PhianalysisTHnSparse { struct : ConfigurableGroup { Configurable produceQA{"produceQA", false, "Produce qa histograms."}; + Configurable produceStats{"produceStats", false, "Produce statistics histograms."}; Configurable produceTrue{"produceTrue", false, "Produce True and Gen histograms."}; Configurable produceLikesign{"produceLikesign", false, "Produce Like sign histograms."}; Configurable eventMixing{"eventMixing", "none", "Produce Event Mixing histograms of type."}; + Configurable produceRotational{"produceRotational", false, "Produce Rotational histograms."}; } produce; Configurable daughterPos{"daughterPos", 3, "Particle type of the positive dauther according to ReconstructionDataFormats/PID.h (Default = Kaon)"}; @@ -62,7 +64,6 @@ struct PhianalysisTHnSparse { Configurable ptTOFThreshold{"ptTOFThreshold", 0.5f, "Threshold for applying TOF."}; Configurable rapidity{"rapidity", 0.5f, "Rapidity cut (maximum)."}; Configurable etatrack{"etatrack", 0.8f, "Eta cut for track."}; - Configurable etapair{"etapair", 0.5f, "Eta cut for pair."}; Configurable pt{"pt", 0.15f, "Cut: Minimal value of tracks pt."}; Configurable dcaXY{"dcaXY", 1.0f, "Cut: Maximal value of tracks DCA XY."}; Configurable dcaZ{"dcaZ", 1.0f, "Cut: Maximal value of tracks DCA Z."}; @@ -97,6 +98,9 @@ struct PhianalysisTHnSparse { ConfigurableAxis axisMultiplicityMixing{"axisMultiplicityMixing", {5, 0, 5000}, "TPC multiplicity for bin"}; ConfigurableAxis axisCentralityMixing{"axisCentralityMixing", {10, 0, 100}, "Multiplicity percentil binning for mixing"}; + // rotational + Configurable numberofRotations{"numberofRotations", 1, "Number of rotations for rotational background estimation."}; + // Axes specifications AxisSpec posZaxis = {400, -20., 20., "V_{z} (cm)"}; AxisSpec dcaXYaxis = {800, -2.0, 2.0, "DCA_{xy} (cm)"}; @@ -115,7 +119,7 @@ struct PhianalysisTHnSparse { double* pointPair = nullptr; double* pointSys = nullptr; ROOT::Math::PxPyPzMVector d1, d2, mother; - bool produceQA, dataQA, MCTruthQA, globalTrack, tpcPidOnly = false; + bool produceTrue, produceLikesign, produceQA, produceStats, produceRotational, dataQA, MCTruthQA, globalTrack, tpcPidOnly = false; float tpcnSigmaPos = 100.0f; float tpcnSigmaNeg = 100.0f; float combinedNSigma = 100.0f; @@ -178,7 +182,11 @@ struct PhianalysisTHnSparse { std::vector allAxesSys = {tpcNClsFoundAxis}; produceQA = static_cast(produce.produceQA); + produceStats = static_cast(produce.produceStats); + produceTrue = static_cast(produce.produceTrue); + produceLikesign = static_cast(produce.produceLikesign); mixingType = rsn::mixingTypeName(static_cast(produce.eventMixing)); + produceRotational = static_cast(produce.produceRotational); tpcnSigmaPos = static_cast(cut.tpcnSigmaPos); tpcnSigmaNeg = static_cast(cut.tpcnSigmaNeg); tpcNClsFound = static_cast(cut.tpcNClsFound); @@ -190,11 +198,12 @@ struct PhianalysisTHnSparse { pointPair = new double[static_cast(o2::analysis::rsn::PairAxisType::unknown)]; pointSys = new double[static_cast(o2::analysis::rsn::SystematicsAxisType::unknown)]; rsnOutput = new o2::analysis::rsn::OutputSparse(); - rsnOutput->init(sparseAxes, allAxes, sysAxes, allAxesSys, static_cast(produce.produceTrue), mixingType, static_cast(produce.produceLikesign), ®istry); + rsnOutput->init(sparseAxes, allAxes, sysAxes, allAxesSys, produceTrue, mixingType, produceLikesign, produceRotational, ®istry); // Print summary of configuration LOGF(info, "=== PhianalysisTHnSparse configuration summary ==="); LOGF(info, "produceQA: %s", produceQA ? "true" : "false"); + LOGF(info, "produceStats: %s", produceStats ? "true" : "false"); LOGF(info, "produceTrue: %s", static_cast(produce.produceTrue) ? "true" : "false"); LOGF(info, "produceLikesign: %s", static_cast(produce.produceLikesign) ? "true" : "false"); LOGF(info, "eventMixing: %s", static_cast(produce.eventMixing).c_str()); @@ -208,7 +217,6 @@ struct PhianalysisTHnSparse { LOGF(info, "ptTOFThreshold: %.2f", ptTOFThreshold); LOGF(info, "rapidity: %.2f", static_cast(cut.rapidity)); LOGF(info, "etatrack: %.2f", static_cast(cut.etatrack)); - LOGF(info, "etapair: %.2f", static_cast(cut.etapair)); LOGF(info, "pt (min): %.2f", static_cast(cut.pt)); LOGF(info, "dcaXY: %.2f", static_cast(cut.dcaXY)); LOGF(info, "dcaZ: %.2f", static_cast(cut.dcaZ)); @@ -216,6 +224,7 @@ struct PhianalysisTHnSparse { LOGF(info, "tpcNClsFound: %d", tpcNClsFound); LOGF(info, "mixingType: %d", static_cast(mixingType)); LOGF(info, "numberofMixedEvents: %d", static_cast(numberofMixedEvents)); + LOGF(info, "numberofRotations: %d", static_cast(numberofRotations)); LOGF(info, "sparseAxes: "); for (const auto& axis : static_cast>(sparseAxes)) { LOGF(info, " %s", axis.c_str()); @@ -240,18 +249,17 @@ struct PhianalysisTHnSparse { registry.add("QAEvent/hMult", "Multiplicity (amplitude of non-zero channels in the FV0A + FV0C) ", kTH1F, {{300, 0., 30000.}}); // Track QA - registry.add("QATrack/hSelection", "Tracks statistics", kTH1D, {{10, 0.0f, 10.0f}}); + registry.add("QATrack/hSelection", "Tracks statistics", kTH1D, {{9, 0.0f, 9.0f}}); auto hTrack = registry.get(HIST("QATrack/hSelection")); hTrack->GetXaxis()->SetBinLabel(1, "all tracks"); hTrack->GetXaxis()->SetBinLabel(2, "passed pT cut"); hTrack->GetXaxis()->SetBinLabel(3, "passed eta cut"); hTrack->GetXaxis()->SetBinLabel(4, "passed DCA cut"); hTrack->GetXaxis()->SetBinLabel(5, "passed PID cut"); - hTrack->GetXaxis()->SetBinLabel(6, "passed rapidity cut"); - hTrack->GetXaxis()->SetBinLabel(7, "passed tpcNClsFound cut"); - hTrack->GetXaxis()->SetBinLabel(8, "passed isPrimaryTrack cut"); - hTrack->GetXaxis()->SetBinLabel(9, "passed isPVContributor cut"); - hTrack->GetXaxis()->SetBinLabel(10, "passed all cuts"); + hTrack->GetXaxis()->SetBinLabel(6, "passed tpcNClsFound cut"); + hTrack->GetXaxis()->SetBinLabel(7, "passed isPrimaryTrack cut"); + hTrack->GetXaxis()->SetBinLabel(8, "passed isPVContributor cut"); + hTrack->GetXaxis()->SetBinLabel(9, "passed all cuts"); hTrack->SetMinimum(0.1); registry.add("QATrack/hRapidity", "Rapidity distribution of K^{+} and K^{-}", kTH1F, {{200, -1, 1}}); @@ -369,18 +377,11 @@ struct PhianalysisTHnSparse { if (produceQA && dataQA) registry.fill(HIST("QATrack/hSelection"), 4.5); - // Apply rapidity cut - if (std::abs(track.rapidity(isPositive ? massPos : massNeg)) > static_cast(cut.rapidity)) { - return false; - } - if (produceQA && dataQA) - registry.fill(HIST("QATrack/hSelection"), 5.5); - // Apply tpcNClsFound cut if (track.tpcNClsFound() < tpcNClsFound) return false; if (produceQA && dataQA) - registry.fill(HIST("QATrack/hSelection"), 6.5); + registry.fill(HIST("QATrack/hSelection"), 5.5); if (globalTrack) { // Apply Global track cuts @@ -392,16 +393,16 @@ struct PhianalysisTHnSparse { return false; } if (produceQA && dataQA) - registry.fill(HIST("QATrack/hSelection"), 7.5); + registry.fill(HIST("QATrack/hSelection"), 6.5); // Apply PV Contributor cuts if (!track.isPVContributor()) return false; if (produceQA && dataQA) - registry.fill(HIST("QATrack/hSelection"), 8.5); + registry.fill(HIST("QATrack/hSelection"), 7.5); if (produceQA && dataQA) - registry.fill(HIST("QATrack/hSelection"), 9.5); + registry.fill(HIST("QATrack/hSelection"), 8.5); return true; } @@ -412,7 +413,7 @@ struct PhianalysisTHnSparse { d2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massNeg); mother = d1 + d2; - if (std::abs(mother.Eta()) > static_cast(cut.etapair)) + if (std::abs(mother.Rapidity()) > static_cast(cut.rapidity)) return false; return true; @@ -458,15 +459,16 @@ struct PhianalysisTHnSparse { registry.fill(HIST("QAEvent/hVtxZ"), collision.posZ()); registry.fill(HIST("QAEvent/hMult"), getMultiplicity(collision)); registry.fill(HIST("QAEvent/hCent"), getCentrality(collision)); - - dataQA = true; - for (const auto& track : posDaughters) { - selectedTrack(track, true); - } - for (const auto& track : negDaughters) { - selectedTrack(track, false); + if (produceStats) { + dataQA = true; + for (const auto& track : posDaughters) { + selectedTrack(track, true); + } + for (const auto& track : negDaughters) { + selectedTrack(track, false); + } + dataQA = false; } - dataQA = false; } if (static_cast(verbose.verboselevel) > 0 && static_cast(verbose.refresh) > 0 && collision.globalIndex() % static_cast(verbose.refresh) == static_cast(verbose.refreshIndex)) @@ -526,14 +528,15 @@ struct PhianalysisTHnSparse { 0); rsnOutput->fillUnlikepm(pointPair); - if (produceQA) + if (produceQA) { registry.fill(HIST("QAEvent/hSelection"), 2.5); - if (n == 0) - registry.fill(HIST("QAEvent/hSelection"), 1.5); + if (n == 0) + registry.fill(HIST("QAEvent/hSelection"), 1.5); + } n = n + 1; } - if (static_cast(produce.produceLikesign)) { + if (produceLikesign) { for (const auto& [track1, track2] : combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(posDaughters, posDaughters))) { if (!selectedTrack(track1, true)) // both positive @@ -591,6 +594,46 @@ struct PhianalysisTHnSparse { rsnOutput->fillLikemm(pointPair); } } + + if (produceRotational) { + for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(posDaughters, negDaughters))) { + + if (!selectedTrack(track1, true)) + continue; + if (!selectedTrack(track2, false)) + continue; + + d1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massPos); + d2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massNeg); + mother = d1 + d2; + + if (std::abs(mother.Rapidity()) > static_cast(cut.rapidity)) + continue; + + for (int i = 1; i <= static_cast(numberofRotations); i++) { + float angle = i * (360.0f / (static_cast(numberofRotations) + 1)); + float px2new = track2.px() * std::cos(angle * TMath::DegToRad()) - track2.py() * std::sin(angle * TMath::DegToRad()); + float py2new = track2.px() * std::sin(angle * TMath::DegToRad()) + track2.py() * std::cos(angle * TMath::DegToRad()); + d2 = ROOT::Math::PxPyPzMVector(px2new, py2new, track2.pz(), massNeg); + mother = d1 + d2; + + pointPair = fillPointPair(mother.M(), + mother.Pt(), + getMultiplicity(collision), + getCentrality(collision), + track1.tpcNSigmaKa(), + track2.tpcNSigmaKa(), + mother.Eta(), + mother.Rapidity(), + collision.posZ(), + 0, + 0, + 0); + + rsnOutput->fillRotationpm(pointPair); + } + } + } } PROCESS_SWITCH(PhianalysisTHnSparse, processData, "Process Event for Data", true); @@ -772,10 +815,10 @@ struct PhianalysisTHnSparse { auto tracksTuple = std::make_tuple(tracks); BinningTypeVzCe binningVzCe{{axisVertexMixing, axisCentralityMixing}, true}; - SameKindPair pairVzCe{binningVzCe, numberofMixedEvents, -1, collisions, tracksTuple, &cache}; + SameKindPair pairVzCe{binningVzCe, static_cast(numberofMixedEvents), -1, collisions, tracksTuple, &cache}; BinningTypeVzMu binningVzMu{{axisVertexMixing, axisMultiplicityMixing}, true}; - SameKindPair pairVzMu{binningVzMu, numberofMixedEvents, -1, collisions, tracksTuple, &cache}; + SameKindPair pairVzMu{binningVzMu, static_cast(numberofMixedEvents), -1, collisions, tracksTuple, &cache}; if (mixingType == rsn::MixingType::ce) { for (const auto& [c1, tracks1, c2, tracks2] : pairVzCe) { @@ -819,60 +862,6 @@ struct PhianalysisTHnSparse { rsnOutput->fillMixingpm(pointPair); } - if (static_cast(produce.produceLikesign)) { - - for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(posDaughtersc1, posDaughtersc2))) { - - if (!selectedTrack(track1, true)) // track1 is positive - continue; - if (!selectedTrack(track2, true)) // track2 is positive - continue; - - if (!selectedPair(mother, track1, track2)) - continue; - - pointPair = fillPointPair(mother.M(), - mother.Pt(), - getMultiplicity(c1), - getCentrality(c1), - track1.tpcNSigmaKa(), - track2.tpcNSigmaKa(), - mother.Eta(), - mother.Rapidity(), - c1.posZ(), - getMultiplicity(c2), - getCentrality(c2), - c2.posZ()); - - rsnOutput->fillMixingpp(pointPair); - } - - for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(negDaughtersc1, negDaughtersc2))) { - - if (!selectedTrack(track1, false)) - continue; - if (!selectedTrack(track2, false)) - continue; - - if (!selectedPair(mother, track1, track2)) - continue; - pointPair = fillPointPair(mother.M(), - mother.Pt(), - getMultiplicity(c1), - getCentrality(c1), - track1.tpcNSigmaKa(), - track2.tpcNSigmaKa(), - mother.Eta(), - mother.Rapidity(), - c1.posZ(), - getMultiplicity(c2), - getCentrality(c2), - c2.posZ()); - - rsnOutput->fillMixingmm(pointPair); - } - } - for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(posDaughtersc2, negDaughtersc1))) { if (!selectedTrack(track1, true)) // track1 is positive @@ -943,62 +932,6 @@ struct PhianalysisTHnSparse { rsnOutput->fillMixingpm(pointPair); } - if (static_cast(produce.produceLikesign)) { - - for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(posDaughtersc1, posDaughtersc2))) { - - if (!selectedTrack(track1, true)) // track1 is positive - - continue; - if (!selectedTrack(track2, true)) // track2 is positive - continue; - - if (!selectedPair(mother, track1, track2)) - continue; - - pointPair = fillPointPair(mother.M(), - mother.Pt(), - getMultiplicity(c1), - getCentrality(c1), - track1.tpcNSigmaKa(), - track2.tpcNSigmaKa(), - mother.Eta(), - mother.Rapidity(), - c1.posZ(), - getMultiplicity(c2), - getCentrality(c2), - c2.posZ()); - - rsnOutput->fillMixingpp(pointPair); - } - - for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(negDaughtersc1, negDaughtersc2))) { - - if (!selectedTrack(track1, false)) - - continue; - if (!selectedTrack(track2, false)) - continue; - - if (!selectedPair(mother, track1, track2)) - continue; - pointPair = fillPointPair(mother.M(), - mother.Pt(), - getMultiplicity(c1), - getCentrality(c1), - track1.tpcNSigmaKa(), - track2.tpcNSigmaKa(), - mother.Eta(), - mother.Rapidity(), - c1.posZ(), - getMultiplicity(c2), - getCentrality(c2), - c2.posZ()); - - rsnOutput->fillMixingmm(pointPair); - } - } - for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(posDaughtersc2, negDaughtersc1))) { if (!selectedTrack(track1, true)) diff --git a/PWGLF/Utils/rsnOutput.h b/PWGLF/Utils/rsnOutput.h index 592eaef40cc..f6540cd6d48 100644 --- a/PWGLF/Utils/rsnOutput.h +++ b/PWGLF/Utils/rsnOutput.h @@ -16,13 +16,13 @@ #ifndef PWGLF_UTILS_RSNOUTPUT_H_ #define PWGLF_UTILS_RSNOUTPUT_H_ -#include -#include -#include - #include "Framework/HistogramRegistry.h" #include "Framework/Logger.h" +#include +#include +#include + namespace o2::analysis { namespace rsn @@ -48,9 +48,8 @@ enum class PairType { unlikegen, unlikegenold, mixingpm, - mixingpp, - mixingmm, mixingmp, + rotationpm, all }; @@ -105,7 +104,7 @@ class Output public: virtual ~Output() = default; - virtual void init(std::vector const& sparseAxes, std::vector const& allAxes, std::vector const& sysAxes, std::vector const& allAxes_sys, bool /*produceTrue*/ = false, MixingType /*eventMixing*/ = MixingType::none, bool /*produceLikesign*/ = false, o2::framework::HistogramRegistry* registry = nullptr) + virtual void init(std::vector const& sparseAxes, std::vector const& allAxes, std::vector const& sysAxes, std::vector const& allAxes_sys, bool /*produceTrue*/ = false, MixingType /*eventMixing*/ = MixingType::none, bool /*produceLikesign*/ = false, bool /*produceRotational*/ = false, o2::framework::HistogramRegistry* registry = nullptr) { mHistogramRegistry = registry; if (mHistogramRegistry == nullptr) @@ -209,9 +208,8 @@ class Output virtual void fillUnlikegen(double* point) = 0; virtual void fillUnlikegenOld(double* point) = 0; virtual void fillMixingpm(double* point) = 0; - virtual void fillMixingpp(double* point) = 0; - virtual void fillMixingmm(double* point) = 0; virtual void fillMixingmp(double* point) = 0; + virtual void fillRotationpm(double* point) = 0; virtual void fillSystematics(double* point) = 0; PairAxisType type(std::string name) @@ -265,12 +263,11 @@ class Output class OutputSparse : public Output { public: - virtual void init(std::vector const& sparseAxes, std::vector const& allAxes, std::vector const& sysAxes, std::vector const& allAxes_sys, bool produceTrue = false, MixingType eventMixing = MixingType::none, bool produceLikesign = false, o2::framework::HistogramRegistry* registry = nullptr) + virtual void init(std::vector const& sparseAxes, std::vector const& allAxes, std::vector const& sysAxes, std::vector const& allAxes_sys, bool produceTrue = false, MixingType eventMixing = MixingType::none, bool produceLikesign = false, bool produceRotational = false, o2::framework::HistogramRegistry* registry = nullptr) { - Output::init(sparseAxes, allAxes, sysAxes, allAxes_sys, produceTrue, eventMixing, produceLikesign, registry); + Output::init(sparseAxes, allAxes, sysAxes, allAxes_sys, produceTrue, eventMixing, produceLikesign, produceRotational, registry); mHistogramRegistry->add("unlikepm", "Unlike pm", *mPairHisto); - // mHistogramRegistry->add("unlikemp", "Unlike mp", *mPairHisto); if (produceLikesign) { mHistogramRegistry->add("likepp", "Like PP", *mPairHisto); mHistogramRegistry->add("likemm", "Like MM", *mPairHisto); @@ -282,13 +279,11 @@ class OutputSparse : public Output } if (eventMixing != MixingType::none) { mHistogramRegistry->add("mixingpm", "Event Mixing pm", *mPairHisto); - if (produceLikesign) { - mHistogramRegistry->add("mixingpp", "Event Mixing pp", *mPairHisto); - mHistogramRegistry->add("mixingmm", "Event Mixing mm", *mPairHisto); - } mHistogramRegistry->add("mixingmp", "Event Mixing mp", *mPairHisto); } - + if (produceRotational) { + mHistogramRegistry->add("rotationpm", "Rotational pm", *mPairHisto); + } mHistogramRegistry->add("Mapping/systematics", "Systematics mapping", *mPairHistoSys); } @@ -331,15 +326,12 @@ class OutputSparse : public Output case PairType::mixingpm: fillMixingpm(point); break; - case PairType::mixingpp: - fillMixingpp(point); - break; - case PairType::mixingmm: - fillMixingmm(point); - break; case PairType::mixingmp: fillMixingmp(point); break; + case PairType::rotationpm: + fillRotationpm(point); + break; default: break; } @@ -357,17 +349,14 @@ class OutputSparse : public Output { fillSparse(HIST("likepp"), point); } - virtual void fillLikemm(double* point) { fillSparse(HIST("likemm"), point); } - virtual void fillUnliketrue(double* point) { fillSparse(HIST("unliketrue"), point); } - virtual void fillUnlikegen(double* point) { fillSparse(HIST("unlikegen"), point); @@ -380,18 +369,14 @@ class OutputSparse : public Output { fillSparse(HIST("mixingpm"), point); } - virtual void fillMixingpp(double* point) - { - fillSparse(HIST("mixingpp"), point); - } - virtual void fillMixingmm(double* point) - { - fillSparse(HIST("mixingmm"), point); - } virtual void fillMixingmp(double* point) { fillSparse(HIST("mixingmp"), point); } + virtual void fillRotationpm(double* point) + { + fillSparse(HIST("rotationpm"), point); + } virtual void fillSystematics(double* point) { fillSparse(HIST("Mapping/systematics"), point); From 33a0d5a52af765b39a596e739542b61c8078f262 Mon Sep 17 00:00:00 2001 From: lucamicheletti93 <38209984+lucamicheletti93@users.noreply.github.com> Date: Fri, 26 Sep 2025 00:01:45 +0200 Subject: [PATCH 542/986] [PWGDQ] Fixing issues in miniTreeGen (#13138) Co-authored-by: Lucamicheletti93 --- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index f0691f3cb7e..6216733cbbe 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -2232,6 +2232,8 @@ struct AnalysisSameEventPairing { VarManager::FillTrackMC(mcTracks, track); auto track_raw = mcTracks.rawIteratorAt(track.globalIndex()); // auto track_raw = groupedMCTracks.rawIteratorAt(track.globalIndex()); + mcDecision = 0; + isig = 0; for (auto& sig : fGenMCSignals) { if (sig->CheckSignal(true, track_raw)) { mcDecision |= (static_cast(1) << isig); @@ -2241,8 +2243,8 @@ struct AnalysisSameEventPairing { dileptonMiniTreeGen(mcDecision, mcEvent.impactParameter(), track_raw.pt(), track_raw.eta(), track_raw.phi(), -999, -999, -999); } } + isig++; } - isig++; } } // end loop over reconstructed events if (fHasTwoProngGenMCsignals) { From d7b231a5fe125fe231e11640f0585b8042a5e3b2 Mon Sep 17 00:00:00 2001 From: Chiara De Martin <39315597+ChiaraDeMartin95@users.noreply.github.com> Date: Fri, 26 Sep 2025 04:33:53 +0200 Subject: [PATCH 543/986] [PWGLF] Add lambda eta in tree and add info of event plane (#13131) Co-authored-by: Chiara De Martin Co-authored-by: ALICE Action Bot --- PWGLF/DataModel/cascqaanalysis.h | 2 +- .../TableProducer/Strangeness/cascadeflow.cxx | 27 ++++++++++++++++--- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/PWGLF/DataModel/cascqaanalysis.h b/PWGLF/DataModel/cascqaanalysis.h index be74e5241bd..4cb9176f99e 100644 --- a/PWGLF/DataModel/cascqaanalysis.h +++ b/PWGLF/DataModel/cascqaanalysis.h @@ -181,7 +181,7 @@ DECLARE_SOA_TABLE(CascAnalysis, "AOD", "CascAnalysis", o2::soa::Index<>, cascadesflow::CentFT0C, cascadesflow::IsNoCollInTimeRange, cascadesflow::IsNoCollInRof, cascadesflow::HasEventPlane, cascadesflow::HasSpectatorPlane, cascadesflow::Sign, cascadesflow::Pt, cascadesflow::Eta, cascadesflow::Phi, cascadesflow::MassLambda, cascadesflow::MassXi, cascadesflow::MassOmega, cascadesflow::V2CSP, cascadesflow::V2CEP, cascadesflow::V1SPzdcA, cascadesflow::V1SPzdcC, cascadesflow::PsiT0C, cascadesflow::BDTResponseXi, cascadesflow::BDTResponseOmega, cascadesflow::CosThetaStarLambdaFromOmega, cascadesflow::CosThetaStarLambdaFromXi, cascadesflow::CosThetaStarProton, mycascades::McPdgCode); DECLARE_SOA_TABLE(LambdaAnalysis, "AOD", "LambdaAnalysis", o2::soa::Index<>, - cascadesflow::CentFT0C, cascadesflow::HasEventPlane, cascadesflow::HasSpectatorPlane, cascadesflow::Sign, cascadesflow::Pt, cascadesflow::Phi, cascadesflow::MassLambda, cascadesflow::V0Radius, cascadesflow::DcaPosToPV, cascadesflow::DcaNegToPV, cascadesflow::V0CosPA, cascadesflow::DcaV0Daughters, cascadesflow::V2CEP, cascadesflow::PsiT0C, cascadesflow::Pzs2Lambda, cascadesflow::Cos2ThetaLambda, cascadesflow::CosThetaLambda); + cascadesflow::CentFT0C, cascadesflow::HasEventPlane, cascadesflow::HasSpectatorPlane, cascadesflow::Sign, cascadesflow::Pt, cascadesflow::Phi, cascadesflow::Eta, cascadesflow::MassLambda, cascadesflow::V0Radius, cascadesflow::DcaPosToPV, cascadesflow::DcaNegToPV, cascadesflow::V0CosPA, cascadesflow::DcaV0Daughters, cascadesflow::V2CEP, cascadesflow::PsiT0C, cascadesflow::Pzs2Lambda, cascadesflow::Cos2ThetaLambda, cascadesflow::CosThetaLambda); namespace myMCcascades { diff --git a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx index 30c5ece7267..40201f4a47d 100644 --- a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx @@ -47,7 +47,7 @@ using std::array; using DauTracks = soa::Join; using CollEventPlane = soa::Join::iterator; -using CollEventPlaneCentralFW = soa::Join::iterator; +using CollEventPlaneCentralFW = soa::Join::iterator; using CollEventAndSpecPlane = soa::Join::iterator; using CollEventAndSpecPlaneCentralFW = soa::Join::iterator; using MCCollisionsStra = soa::Join; @@ -153,6 +153,10 @@ static const std::vector labelsCutScore = {"Background score", "Sig struct cascadeFlow { + Configurable isQVecT0C{"isQVecT0C", 1, ""}; + Configurable isQVecT0M{"isQVecT0M", 0, ""}; + Configurable isQVecV0A{"isQVecV0A", 0, ""}; + // Output filling criteria struct : ConfigurableGroup { Configurable isFillTree{"isFillTree", 1, ""}; @@ -660,6 +664,7 @@ struct cascadeFlow { chargeIndex, v0.pt(), v0.phi(), + v0.eta(), invMassLambda, v0.v0radius(), v0.dcapostopv(), @@ -1652,9 +1657,23 @@ struct cascadeFlow { return; } + double qvecRe = 0; + double qvecIm = 0; + + if (isQVecT0C) { + qvecRe = coll.qvecFT0CRe(); + qvecIm = coll.qvecFT0CIm(); + } else if (isQVecT0M) { + qvecRe = coll.qvecFT0MRe(); + qvecIm = coll.qvecFT0MIm(); + } else if (isQVecV0A) { + qvecRe = coll.qvecFV0ARe(); + qvecIm = coll.qvecFV0AIm(); + } + // select only events used for the calibration of the event plane if (isGoodEventEP) { - if (std::abs(coll.qvecFT0CRe()) > 990 || std::abs(coll.qvecFT0CIm()) > 990 || std::abs(coll.qvecBNegRe()) > 990 || std::abs(coll.qvecBNegIm()) > 990 || std::abs(coll.qvecBPosRe()) > 990 || std::abs(coll.qvecBPosIm()) > 990) { + if (std::abs(qvecRe) > 990 || std::abs(qvecIm) > 990 || std::abs(coll.qvecBNegRe()) > 990 || std::abs(coll.qvecBNegIm()) > 990 || std::abs(coll.qvecBPosRe()) > 990 || std::abs(coll.qvecBPosIm()) > 990) { return; } } @@ -1670,11 +1689,11 @@ struct cascadeFlow { histos.fill(HIST("hEventCentrality"), coll.centFT0C()); histos.fill(HIST("hEventVertexZ"), coll.posZ()); - ROOT::Math::XYZVector eventplaneVecT0C{coll.qvecFT0CRe(), coll.qvecFT0CIm(), 0}; + ROOT::Math::XYZVector eventplaneVecT0C{qvecRe, qvecIm, 0}; ROOT::Math::XYZVector eventplaneVecTPCA{coll.qvecBPosRe(), coll.qvecBPosIm(), 0}; ROOT::Math::XYZVector eventplaneVecTPCC{coll.qvecBNegRe(), coll.qvecBNegIm(), 0}; - const float psiT0C = std::atan2(coll.qvecFT0CIm(), coll.qvecFT0CRe()) * 0.5f; + const float psiT0C = std::atan2(qvecIm, qvecRe) * 0.5f; const float psiTPCA = std::atan2(coll.qvecBPosIm(), coll.qvecBPosRe()) * 0.5f; const float psiTPCC = std::atan2(coll.qvecBNegIm(), coll.qvecBNegRe()) * 0.5f; float psiT0CCorr = psiT0C; From 6d8d857c2fb8b948af8d4cd57668f9cfcbad7b34 Mon Sep 17 00:00:00 2001 From: Rik Spijkers <78484875+rspijkers@users.noreply.github.com> Date: Fri, 26 Sep 2025 09:44:45 +0200 Subject: [PATCH 544/986] [PWGLF] use cent instead of mult + bugfixes (#13135) --- .../Tasks/Strangeness/cascadecorrelations.cxx | 92 ++++++++++--------- 1 file changed, 50 insertions(+), 42 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx b/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx index c062c2f1a0d..05d7c23b63d 100644 --- a/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx +++ b/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx @@ -59,10 +59,10 @@ using namespace o2::framework::expressions; using std::array; // use parameters + cov mat non-propagated, aux info + (extension propagated) -using FullTracksExt = soa::Join; -using FullTracksExtIU = soa::Join; -using FullTracksExtWithPID = soa::Join; -using FullTracksExtIUWithPID = soa::Join; +using FullTracksExt = soa::Join; +using FullTracksExtIU = soa::Join; +using FullTracksExtWithPID = soa::Join; +using FullTracksExtIUWithPID = soa::Join; Zorro zorro; @@ -80,7 +80,7 @@ using CascDataExtSelected = soa::Join; } // namespace o2::aod using MyCollisions = soa::Join; -using MyCollisionsMult = soa::Join; +using MyCollisionsMult = soa::Join; using MyCascades = soa::Filtered; using LabeledCascades = soa::Join; @@ -261,36 +261,44 @@ struct CascadeSelector { } template - bool eventSelection(TCollision const& collision) + bool eventSelection(TCollision const& collision, bool fillHistos) { if (useTrigger) { auto bc = collision.template bc_as(); zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), triggerList); bool eventTrigger = zorro.isSelected(bc.globalBC()); if (eventTrigger) { - registry.fill(HIST("hTriggerQA"), 1); + if (fillHistos) + registry.fill(HIST("hTriggerQA"), 1); } else { - registry.fill(HIST("hTriggerQA"), 0); + if (fillHistos) + registry.fill(HIST("hTriggerQA"), 0); return false; } } // fill event selection based on which selection criteria are applied and passed - registry.fill(HIST("hEventSel"), 0); + if (fillHistos) + registry.fill(HIST("hEventSel"), 0); if (doSel8 && !collision.sel8()) { - registry.fill(HIST("hEventSel"), 1); + if (fillHistos) + registry.fill(HIST("hEventSel"), 1); return false; } else if (collision.multNTracksPVeta1() <= INEL) { - registry.fill(HIST("hEventSel"), 2); + if (fillHistos) + registry.fill(HIST("hEventSel"), 2); return false; } else if (std::abs(collision.posZ()) > maxVertexZ) { - registry.fill(HIST("hEventSel"), 3); + if (fillHistos) + registry.fill(HIST("hEventSel"), 3); return false; } else if (doNoSameBunchPileUp && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { - registry.fill(HIST("hEventSel"), 4); + if (fillHistos) + registry.fill(HIST("hEventSel"), 4); return false; } // passes all selections - registry.fill(HIST("hEventSel"), 5); + if (fillHistos) + registry.fill(HIST("hEventSel"), 5); return true; } @@ -528,7 +536,7 @@ struct CascadeSelector { bool evSel = false; // will be true if at least one rec. collision passes evsel for (auto const& collision : collisions) { // can be more than 1 rec. collisions due to event splitting - evSel = eventSelection(collision); + evSel = eventSelection(collision, false); if (evSel) // exit loop if we find 1 rec. event that passes evsel break; } @@ -564,7 +572,7 @@ struct CascadeSelector { // wrappers for data/MC processes on reco level void processRecData(MyCollisions::iterator const& collision, aod::CascDataExt const& Cascades, FullTracksExtIUWithPID const&, aod::BCsWithTimestamps const&) { - bool evSel = eventSelection(collision); + bool evSel = eventSelection(collision, true); // do not skip the collision if event selection fails - this will lead to the cascadeFlag table having less entries than the Cascade table, and therefor not joinable. for (auto const& casc : Cascades) { if (!evSel) { @@ -578,7 +586,7 @@ struct CascadeSelector { void processRecMC(MyCollisions::iterator const& collision, LabeledCascades const& Cascades, FullTracksExtIUWithPID const&, aod::BCsWithTimestamps const&, aod::McParticles const&) { - bool evSel = eventSelection(collision); + bool evSel = eventSelection(collision, true); // do not skip the collision if event selection fails - this will lead to the cascadeFlag table having less entries than the Cascade table, and therefor not joinable. for (auto const& casc : Cascades) { if (!evSel) { @@ -620,7 +628,7 @@ struct CascadeCorrelations { ConfigurableAxis ptAxis = {"ptAxis", {150, 0, 15}, "#it{p}_{T}"}; ConfigurableAxis vertexAxis = {"vertexAxis", {200, -10.0f, 10.0f}, "cm"}; ConfigurableAxis dcaAxis = {"dcaAxis", {100, 0.0f, 2.0f}, "cm"}; - ConfigurableAxis multiplicityAxis{"multiplicityAxis", {100, 0, 100}, "Multiplicity (MultFT0M?)"}; + ConfigurableAxis multiplicityAxis{"multiplicityAxis", {100, 0, 100}, "Multiplicity (centFT0M?)"}; ConfigurableAxis invLambdaMassAxis{"invLambdaMassAxis", {100, 1.07f, 1.17f}, "Inv. Mass (GeV/c^{2})"}; AxisSpec signAxis{3, -1.5, 1.5, "sign of cascade"}; AxisSpec deltaYAxis{40, -2.f, 2.f, "#Delta y"}; @@ -686,10 +694,10 @@ struct CascadeCorrelations { "registry", { // inv mass - {"hMassXiMinus", "hMassXiMinus", {HistType::kTH2F, {invMassAxis, ptAxis}}}, - {"hMassXiPlus", "hMassXiPlus", {HistType::kTH2F, {invMassAxis, ptAxis}}}, - {"hMassOmegaMinus", "hMassOmegaMinus", {HistType::kTH2F, {invMassAxis, ptAxis}}}, - {"hMassOmegaPlus", "hMassOmegaPlus", {HistType::kTH2F, {invMassAxis, ptAxis}}}, + {"hMassXiMinus", "hMassXiMinus", {HistType::kTH3F, {{200, 1.24, 1.44, "Inv. Mass (GeV/c^{2})"}, ptAxis, rapidityAxis}}}, + {"hMassXiPlus", "hMassXiPlus", {HistType::kTH3F, {{200, 1.24, 1.44, "Inv. Mass (GeV/c^{2})"}, ptAxis, rapidityAxis}}}, + {"hMassOmegaMinus", "hMassOmegaMinus", {HistType::kTH3F, {{200, 1.6, 1.8, "Inv. Mass (GeV/c^{2})"}, ptAxis, rapidityAxis}}}, + {"hMassOmegaPlus", "hMassOmegaPlus", {HistType::kTH3F, {{200, 1.6, 1.8, "Inv. Mass (GeV/c^{2})"}, ptAxis, rapidityAxis}}}, // efficiency corrected inv mass {"hMassXiEffCorrected", "hMassXiEffCorrected", {HistType::kTHnSparseF, {invMassAxis, signAxis, ptAxis, rapidityAxis, vertexAxis, multiplicityAxis}}, true}, {"hMassOmegaEffCorrected", "hMassOmegaEffCorrected", {HistType::kTHnSparseF, {invMassAxis, signAxis, ptAxis, rapidityAxis, vertexAxis, multiplicityAxis}}, true}, @@ -769,7 +777,7 @@ struct CascadeCorrelations { SliceCache cache; ConfigurableAxis axisVtxZ{"axisVtxZ", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; // ConfigurableAxis axisMult{"axisMult", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 100, 1000}, "Mixing bins - multiplicity"}; - // using BinningType = ColumnBinningPolicy>; + // using BinningType = ColumnBinningPolicy; // BinningType colBinning{{axisVtxZ, axisMult}, true}; // true is for 'ignore overflows' (true by default). Underflows and overflows will have bin -1. using BinningType = ColumnBinningPolicy; BinningType colBinning{{axisVtxZ}, true}; // true is for 'ignore overflows' (true by default). Underflows and overflows will have bin -1. @@ -793,25 +801,25 @@ struct CascadeCorrelations { for (auto const& casc : Cascades) { if (casc.isSelected() <= 2) { // not exclusively an Omega --> consistent with Xi or both if (casc.sign() < 0) { - registry.fill(HIST("hMassXiMinus"), casc.mXi(), casc.pt()); - weight = getEfficiency(hEffXiMin, casc.pt()); + registry.fill(HIST("hMassXiMinus"), casc.mXi(), casc.pt(), casc.yXi()); + weight = getEfficiency(hEffXiMin, casc.pt(), casc.yXi()); } else { - registry.fill(HIST("hMassXiPlus"), casc.mXi(), casc.pt()); - weight = getEfficiency(hEffXiPlus, casc.pt()); + registry.fill(HIST("hMassXiPlus"), casc.mXi(), casc.pt(), casc.yXi()); + weight = getEfficiency(hEffXiPlus, casc.pt(), casc.yXi()); } // LOGF(info, "casc pt %f, weight %f", casc.pt(), weight); - registry.fill(HIST("hMassXiEffCorrected"), casc.mXi(), casc.sign(), casc.pt(), casc.yXi(), collision.posZ(), collision.multFT0M(), weight); + registry.fill(HIST("hMassXiEffCorrected"), casc.mXi(), casc.sign(), casc.pt(), casc.yXi(), collision.posZ(), collision.centFT0M(), weight); registry.fill(HIST("hRapidityXi"), casc.yXi()); } if (casc.isSelected() >= 2) { // consistent with Omega or both if (casc.sign() < 0) { - registry.fill(HIST("hMassOmegaMinus"), casc.mOmega(), casc.pt()); - weight = getEfficiency(hEffOmegaMin, casc.pt()); + registry.fill(HIST("hMassOmegaMinus"), casc.mOmega(), casc.pt(), casc.yOmega()); + weight = getEfficiency(hEffOmegaMin, casc.pt(), casc.yOmega()); } else { - registry.fill(HIST("hMassOmegaPlus"), casc.mOmega(), casc.pt()); - weight = getEfficiency(hEffOmegaPlus, casc.pt()); + registry.fill(HIST("hMassOmegaPlus"), casc.mOmega(), casc.pt(), casc.yOmega()); + weight = getEfficiency(hEffOmegaPlus, casc.pt(), casc.yOmega()); } - registry.fill(HIST("hMassOmegaEffCorrected"), casc.mOmega(), casc.sign(), casc.pt(), casc.yOmega(), collision.posZ(), collision.multFT0M(), weight); + registry.fill(HIST("hMassOmegaEffCorrected"), casc.mOmega(), casc.sign(), casc.pt(), casc.yOmega(), collision.posZ(), collision.centFT0M(), weight); registry.fill(HIST("hRapidityOmega"), casc.yOmega()); } registry.fill(HIST("hV0Radius"), casc.v0radius()); @@ -870,12 +878,12 @@ struct CascadeCorrelations { if (assoc.isSelected() <= 2 && std::abs(assoc.yXi()) < maxRapidity) { // assoc Xi if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? getEfficiency(hEffXiMin, assoc.pt()) : getEfficiency(hEffXiPlus, assoc.pt()); - registry.fill(HIST("hXiXi"), dphi, trigger.yXi() - assoc.yXi(), trigger.sign(), assoc.sign(), trigger.pt(), assoc.pt(), invMassXiTrigg, invMassXiAssoc, collision.posZ(), collision.multFT0M(), weightTrigg * weightAssoc); + registry.fill(HIST("hXiXi"), dphi, trigger.yXi() - assoc.yXi(), trigger.sign(), assoc.sign(), trigger.pt(), assoc.pt(), invMassXiTrigg, invMassXiAssoc, collision.posZ(), collision.centFT0M(), weightTrigg * weightAssoc); } if (assoc.isSelected() >= 2 && std::abs(assoc.yOmega()) < maxRapidity) { // assoc Omega if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? getEfficiency(hEffOmegaMin, assoc.pt()) : getEfficiency(hEffOmegaPlus, assoc.pt()); - registry.fill(HIST("hXiOm"), dphi, trigger.yXi() - assoc.yOmega(), trigger.sign(), assoc.sign(), trigger.pt(), assoc.pt(), invMassXiTrigg, invMassOmAssoc, collision.posZ(), collision.multFT0M(), weightTrigg * weightAssoc); + registry.fill(HIST("hXiOm"), dphi, trigger.yXi() - assoc.yOmega(), trigger.sign(), assoc.sign(), trigger.pt(), assoc.pt(), invMassXiTrigg, invMassOmAssoc, collision.posZ(), collision.centFT0M(), weightTrigg * weightAssoc); } } if (trigger.isSelected() >= 2 && std::abs(trigger.yOmega()) < maxRapidity) { // trigger Omega @@ -885,12 +893,12 @@ struct CascadeCorrelations { if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? getEfficiency(hEffXiMin, assoc.pt()) : getEfficiency(hEffXiPlus, assoc.pt()); // if Omega-Xi, fill the Xi-Omega histogram (flip the trigger/assoc and dphy,dy signs) - registry.fill(HIST("hXiOm"), RecoDecay::constrainAngle(assoc.phi() - trigger.phi(), -PIHalf), -(trigger.yOmega() - assoc.yXi()), assoc.sign(), trigger.sign(), assoc.pt(), trigger.pt(), invMassXiAssoc, invMassOmTrigg, collision.posZ(), collision.multFT0M(), weightTrigg * weightAssoc); + registry.fill(HIST("hXiOm"), RecoDecay::constrainAngle(assoc.phi() - trigger.phi(), -PIHalf), -(trigger.yOmega() - assoc.yXi()), assoc.sign(), trigger.sign(), assoc.pt(), trigger.pt(), invMassXiAssoc, invMassOmTrigg, collision.posZ(), collision.centFT0M(), weightTrigg * weightAssoc); } if (assoc.isSelected() >= 2 && std::abs(assoc.yOmega()) < maxRapidity) { // assoc Omega if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? getEfficiency(hEffOmegaMin, assoc.pt()) : getEfficiency(hEffOmegaPlus, assoc.pt()); - registry.fill(HIST("hOmOm"), dphi, trigger.yOmega() - assoc.yOmega(), trigger.sign(), assoc.sign(), trigger.pt(), assoc.pt(), invMassOmTrigg, invMassOmAssoc, collision.posZ(), collision.multFT0M(), weightTrigg * weightAssoc); + registry.fill(HIST("hOmOm"), dphi, trigger.yOmega() - assoc.yOmega(), trigger.sign(), assoc.sign(), trigger.pt(), assoc.pt(), invMassOmTrigg, invMassOmAssoc, collision.posZ(), collision.centFT0M(), weightTrigg * weightAssoc); } } @@ -956,12 +964,12 @@ struct CascadeCorrelations { if (assoc.isSelected() <= 2 && std::abs(assoc.yXi()) < maxRapidity) { // assoc Xi if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? getEfficiency(hEffXiMin, assoc.pt()) : getEfficiency(hEffXiPlus, assoc.pt()); - registry.fill(HIST("MixedEvents/hMEXiXi"), dphi, trigger.yXi() - assoc.yXi(), trigger.sign(), assoc.sign(), trigger.pt(), assoc.pt(), invMassXiTrigg, invMassXiAssoc, col1.posZ(), col1.multFT0M(), weightTrigg * weightAssoc); + registry.fill(HIST("MixedEvents/hMEXiXi"), dphi, trigger.yXi() - assoc.yXi(), trigger.sign(), assoc.sign(), trigger.pt(), assoc.pt(), invMassXiTrigg, invMassXiAssoc, col1.posZ(), col1.centFT0M(), weightTrigg * weightAssoc); } if (assoc.isSelected() >= 2 && std::abs(assoc.yOmega()) < maxRapidity) { // assoc Omega if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? getEfficiency(hEffOmegaMin, assoc.pt()) : getEfficiency(hEffOmegaPlus, assoc.pt()); - registry.fill(HIST("MixedEvents/hMEXiOm"), dphi, trigger.yXi() - assoc.yOmega(), trigger.sign(), assoc.sign(), trigger.pt(), assoc.pt(), invMassXiTrigg, invMassOmAssoc, col1.posZ(), col1.multFT0M(), weightTrigg * weightAssoc); + registry.fill(HIST("MixedEvents/hMEXiOm"), dphi, trigger.yXi() - assoc.yOmega(), trigger.sign(), assoc.sign(), trigger.pt(), assoc.pt(), invMassXiTrigg, invMassOmAssoc, col1.posZ(), col1.centFT0M(), weightTrigg * weightAssoc); } } if (trigger.isSelected() >= 2 && std::abs(trigger.yOmega()) < maxRapidity) { // trigger Omega @@ -971,12 +979,12 @@ struct CascadeCorrelations { if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? getEfficiency(hEffXiMin, assoc.pt()) : getEfficiency(hEffXiPlus, assoc.pt()); // if Omega-Xi, fill the Xi-Omega histogram (flip the trigger/assoc and dphy,dy signs) - registry.fill(HIST("MixedEvents/hMEXiOm"), RecoDecay::constrainAngle(assoc.phi() - trigger.phi(), -PIHalf), -(trigger.yOmega() - assoc.yXi()), assoc.sign(), trigger.sign(), assoc.pt(), trigger.pt(), invMassXiAssoc, invMassOmTrigg, col1.posZ(), col1.multFT0M(), weightTrigg * weightAssoc); + registry.fill(HIST("MixedEvents/hMEXiOm"), RecoDecay::constrainAngle(assoc.phi() - trigger.phi(), -PIHalf), -(trigger.yOmega() - assoc.yXi()), assoc.sign(), trigger.sign(), assoc.pt(), trigger.pt(), invMassXiAssoc, invMassOmTrigg, col1.posZ(), col1.centFT0M(), weightTrigg * weightAssoc); } if (assoc.isSelected() >= 2 && std::abs(assoc.yOmega()) < maxRapidity) { // assoc Omega if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? getEfficiency(hEffOmegaMin, assoc.pt()) : getEfficiency(hEffOmegaPlus, assoc.pt()); - registry.fill(HIST("MixedEvents/hMEOmOm"), dphi, trigger.yOmega() - assoc.yOmega(), trigger.sign(), assoc.sign(), trigger.pt(), assoc.pt(), invMassOmTrigg, invMassOmAssoc, col1.posZ(), col1.multFT0M(), weightTrigg * weightAssoc); + registry.fill(HIST("MixedEvents/hMEOmOm"), dphi, trigger.yOmega() - assoc.yOmega(), trigger.sign(), assoc.sign(), trigger.pt(), assoc.pt(), invMassOmTrigg, invMassOmAssoc, col1.posZ(), col1.centFT0M(), weightTrigg * weightAssoc); } } @@ -1006,7 +1014,7 @@ struct CascadeCorrelations { registry.fill(HIST("MC/hSplitEvents"), 1); registry.fill(HIST("MC/hGenMultOneReco"), mCounter.countFT0A(mcParticles) + mCounter.countFT0C(mcParticles)); for (auto const& collision : collisions) { // not really a loop, as there is only one collision - FT0mult = collision.multFT0M(); + FT0mult = collision.centFT0M(); vtxz = collision.posZ(); } } else if (collisions.size() > 1) { From 3e9044610a79557640f022c496a9b4b331bfbef2 Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Fri, 26 Sep 2025 12:02:05 +0200 Subject: [PATCH 545/986] [PWGLF] Add new definition of spin correlation same as STAR to compare (#13136) --- .../Strangeness/lambdaspincorrderived.cxx | 184 ++++++++++-------- 1 file changed, 103 insertions(+), 81 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx index 7382a32c860..daeefca4adc 100644 --- a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx @@ -273,101 +273,123 @@ struct lambdaspincorrderived { auto proton1LambdaRF = boostLambda1ToCM(proton1pairCM); auto proton2LambdaRF = boostLambda2ToCM(proton2pairCM); - TVector3 zhat(lambda1CM.Px(), lambda1CM.Py(), lambda1CM.Pz()); - if (zhat.Mag2() == 0) - zhat = TVector3(0, 0, 1); - zhat = zhat.Unit(); - - // pick a reference not collinear with ẑ (beam z works) - TVector3 ref(0., 0., 1.); - if (std::abs(zhat.Dot(ref)) > 0.999) - ref = TVector3(1., 0., 0.); - - // build transverse axes - TVector3 xhat = (ref - (ref.Dot(zhat)) * zhat).Unit(); - TVector3 yhat = (zhat.Cross(xhat)).Unit(); - - // proton unit vectors in their Λ rest frames - TVector3 n1(proton1LambdaRF.Px(), proton1LambdaRF.Py(), proton1LambdaRF.Pz()); - n1 = n1.Unit(); - TVector3 n2(proton2LambdaRF.Px(), proton2LambdaRF.Py(), proton2LambdaRF.Pz()); - n2 = n2.Unit(); - - // cosθ* (Λ2 measured along −ẑ) - double c1 = n1.Dot(zhat); - double c2 = -n2.Dot(zhat); - - // sinθ* - double s1 = std::sqrt(std::max(0.0, 1.0 - c1 * c1)); - double s2 = std::sqrt(std::max(0.0, 1.0 - c2 * c2)); - - // φ1*, φ2* in common convention (flip axes for Λ2) - double phi1 = std::atan2(n1.Dot(yhat), n1.Dot(xhat)); - double phi2 = std::atan2(n2.Dot(-yhat), n2.Dot(-xhat)); - - // helicity spin-correlation - double cosDelta = c1 * c2 + s1 * s2 * std::cos(phi1 - phi2); - // clamp for safety - if (cosDelta > 1.0) - cosDelta = 1.0; - if (cosDelta < -1.0) - cosDelta = -1.0; - - // - // --- (B) Beam-based correlation (common z_B = beam; axes transported into each Λ rest frame) --- - // - TVector3 zB(0., 0., 1.); // beam axis in pair–CM coordinates - - // x_B: projection of Λ1 direction onto plane ⟂ z_B; y_B completes RH basis + // =================== Opening-angle correlator: cos(Δθ) for helicity-z and beam-z =================== + + // Proton unit directions in Λ rest frames + TVector3 k1(proton1LambdaRF.Px(), proton1LambdaRF.Py(), proton1LambdaRF.Pz()); + k1 = k1.Unit(); + TVector3 k2(proton2LambdaRF.Px(), proton2LambdaRF.Py(), proton2LambdaRF.Pz()); + k2 = k2.Unit(); + + // Helper: boost a spacelike axis (t=0) from PRF into a Λ rest frame + auto transport = [](const TVector3& v, const ROOT::Math::Boost& B) -> TVector3 { + ROOT::Math::PxPyPzEVector a(v.X(), v.Y(), v.Z(), 0.0); + auto ar = B(a); + TVector3 out(ar.Px(), ar.Py(), ar.Pz()); + return (out.Mag2() > 0) ? out.Unit() : out; + }; + + // ----------------------------- (1) Helicity-z construction ----------------------------- + // z along Λ1 in PRF + TVector3 zPRF(lambda1CM.Px(), lambda1CM.Py(), lambda1CM.Pz()); + if (zPRF.Mag2() == 0) + zPRF = TVector3(0, 0, 1); + zPRF = zPRF.Unit(); + + // transverse axes in PRF + TVector3 ref(0, 0, 1); + if (std::abs(zPRF.Dot(ref)) > 0.999) + ref = TVector3(1, 0, 0); + TVector3 xPRF = (ref - (ref.Dot(zPRF)) * zPRF).Unit(); + TVector3 yPRF = (zPRF.Cross(xPRF)).Unit(); + + // carry PRF triad to Λ rest frames (flip triad for Λ2 to keep same PRF-handedness) + TVector3 z1_h = transport(zPRF, boostLambda1ToCM); + TVector3 x1_h = transport(xPRF, boostLambda1ToCM); + TVector3 y1_h = transport(yPRF, boostLambda1ToCM); + + TVector3 z2_h = transport(-zPRF, boostLambda2ToCM); + TVector3 x2_h = transport(-xPRF, boostLambda2ToCM); + TVector3 y2_h = transport(-yPRF, boostLambda2ToCM); + + // angles and cosΔθ (helicity) + double c1_h = k1.Dot(z1_h); + double s1_h = std::sqrt(std::max(0.0, 1.0 - c1_h * c1_h)); + double phi1_h = std::atan2(k1.Dot(y1_h), k1.Dot(x1_h)); + + double c2_h = k2.Dot(z2_h); + double s2_h = std::sqrt(std::max(0.0, 1.0 - c2_h * c2_h)); + double phi2_h = std::atan2(k2.Dot(y2_h), k2.Dot(x2_h)); + + double cosDeltaTheta_hel = c1_h * c2_h + s1_h * s2_h * std::cos(phi1_h - phi2_h); + if (cosDeltaTheta_hel > 1.0) + cosDeltaTheta_hel = 1.0; + if (cosDeltaTheta_hel < -1.0) + cosDeltaTheta_hel = -1.0; + + // ------------------------------- (2) Beam-z construction ------------------------------- + // z along beam in PRF; choose x by projecting Λ1 onto the ⟂ plane to fix azimuth zero + TVector3 zB(0, 0, 1); TVector3 L1dir(lambda1CM.Px(), lambda1CM.Py(), lambda1CM.Pz()); L1dir = L1dir.Unit(); TVector3 xB = L1dir - (L1dir.Dot(zB)) * zB; if (xB.Mag2() < 1e-12) - xB = TVector3(1., 0., 0.); // fallback if Λ1 ∥ beam + xB = TVector3(1, 0, 0); xB = xB.Unit(); TVector3 yB = (zB.Cross(xB)).Unit(); - // helper to transport an axis into a Λ rest frame (from pair–CM) - auto transport = [](const TVector3& v, const ROOT::Math::Boost& B) -> TVector3 { - ROOT::Math::PxPyPzEVector a(v.X(), v.Y(), v.Z(), 0.0); // spacelike 4-vector (t=0) - ROOT::Math::PxPyPzEVector ar = B(a); // boost into that Λ rest frame - TVector3 out(ar.Px(), ar.Py(), ar.Pz()); - if (out.Mag2() == 0) - return out; - return out.Unit(); - }; + // carry beam triad to Λ rest frames (no flip for a common external axis) + TVector3 z1_b = transport(zB, boostLambda1ToCM); + TVector3 x1_b = transport(xB, boostLambda1ToCM); + TVector3 y1_b = transport(yB, boostLambda1ToCM); + + TVector3 z2_b = transport(zB, boostLambda2ToCM); + TVector3 x2_b = transport(xB, boostLambda2ToCM); + TVector3 y2_b = transport(yB, boostLambda2ToCM); + + // angles and cosΔθ (beam) + double c1_b = k1.Dot(z1_b); + double s1_b = std::sqrt(std::max(0.0, 1.0 - c1_b * c1_b)); + double phi1_b = std::atan2(k1.Dot(y1_b), k1.Dot(x1_b)); + + double c2_b = k2.Dot(z2_b); + double s2_b = std::sqrt(std::max(0.0, 1.0 - c2_b * c2_b)); + double phi2_b = std::atan2(k2.Dot(y2_b), k2.Dot(x2_b)); + + double cosDeltaTheta_beam = c1_b * c2_b + s1_b * s2_b * std::cos(phi1_b - phi2_b); + if (cosDeltaTheta_beam > 1.0) + cosDeltaTheta_beam = 1.0; + if (cosDeltaTheta_beam < -1.0) + cosDeltaTheta_beam = -1.0; + + // --- STAR-style Δθ (as written: dot product of proton directions in their own Λ RFs) --- + + // Boost each proton into its parent's rest frame + ROOT::Math::Boost boostL1_LabToRF{particle1Dummy.BoostToCM()}; // Λ1 velocity in lab + ROOT::Math::Boost boostL2_LabToRF{particle2Dummy.BoostToCM()}; // Λ2 velocity in lab + + auto p1_LRF = boostL1_LabToRF(daughpart1); + auto p2_LRF = boostL2_LabToRF(daughpart2); + + // Unit 3-vectors (in different rest frames!) + TVector3 u1 = TVector3(p1_LRF.Px(), p1_LRF.Py(), p1_LRF.Pz()).Unit(); + TVector3 u2 = TVector3(p2_LRF.Px(), p2_LRF.Py(), p2_LRF.Pz()).Unit(); - // transport beam triad to each Λ rest frame - TVector3 zB1 = transport(zB, boostLambda1ToCM); - TVector3 xB1 = transport(xB, boostLambda1ToCM); - TVector3 yB1 = transport(yB, boostLambda1ToCM); - - TVector3 zB2 = transport(zB, boostLambda2ToCM); - TVector3 xB2 = transport(xB, boostLambda2ToCM); - TVector3 yB2 = transport(yB, boostLambda2ToCM); - - // angles w.r.t. beam triad (same z_B convention for both Λ’s; no flips) - double c1B = n1.Dot(zB1), c2B = n2.Dot(zB2); - double s1B = std::sqrt(std::max(0.0, 1.0 - c1B * c1B)); - double s2B = std::sqrt(std::max(0.0, 1.0 - c2B * c2B)); - double phi1B = std::atan2(n1.Dot(yB1), n1.Dot(xB1)); - double phi2B = std::atan2(n2.Dot(yB2), n2.Dot(xB2)); - - // beam correlation - double cosDeltaBeam = c1B * c2B + s1B * s2B * std::cos(phi1B - phi2B); - if (cosDeltaBeam > 1.0) - cosDeltaBeam = 1.0; - if (cosDeltaBeam < -1.0) - cosDeltaBeam = -1.0; + // STAR-style cosΔθ definition + double cosDeltaTheta_STAR_naive = u1.Dot(u2); + if (cosDeltaTheta_STAR_naive > 1.0) + cosDeltaTheta_STAR_naive = 1.0; + if (cosDeltaTheta_STAR_naive < -1.0) + cosDeltaTheta_STAR_naive = -1.0; auto cosThetaDiff = -999.0; auto costhetaz1costhetaz2 = -999.0; if (cosDef == 0) { - cosThetaDiff = proton1LambdaRF.Vect().Unit().Dot(proton2LambdaRF.Vect().Unit()); + cosThetaDiff = cosDeltaTheta_STAR_naive; costhetaz1costhetaz2 = (proton1LambdaRF.Pz() * proton2LambdaRF.Pz()) / (proton1LambdaRF.P() * proton2LambdaRF.P()); } else { - cosThetaDiff = cosDelta; - costhetaz1costhetaz2 = cosDeltaBeam; + cosThetaDiff = cosDeltaTheta_hel; + costhetaz1costhetaz2 = cosDeltaTheta_beam; } double deltaPhi = std::abs(RecoDecay::constrainAngle(particle1Dummy.Phi(), 0.0F, harmonic) - RecoDecay::constrainAngle(particle2Dummy.Phi(), 0.0F, harmonic)); From e4a38e5f5ebafa90754e2aa706eee68b6835a4b4 Mon Sep 17 00:00:00 2001 From: amaringarcia Date: Fri, 26 Sep 2025 12:55:03 +0200 Subject: [PATCH 546/986] [Common] Bug fix for NN version 3 development (#13128) Co-authored-by: Ana Marin --- Common/TableProducer/PID/pidTPC.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/Common/TableProducer/PID/pidTPC.cxx b/Common/TableProducer/PID/pidTPC.cxx index c59785b5247..ebb66f8934a 100644 --- a/Common/TableProducer/PID/pidTPC.cxx +++ b/Common/TableProducer/PID/pidTPC.cxx @@ -409,6 +409,7 @@ struct tpcPid { track_properties[counter_track_props + 6] = trk.has_collision() ? collisions.iteratorAt(trk.collisionId()).ft0cOccupancyInTimeRange() / 60000. : 1.; } if (input_dimensions == 8 && networkVersion == "3") { + track_properties[counter_track_props + 6] = trk.has_collision() ? collisions.iteratorAt(trk.collisionId()).ft0cOccupancyInTimeRange() / 60000. : 1.; if (trk.has_collision()) { auto trk_bc = (collisions.iteratorAt(trk.collisionId())).template bc_as(); float hadronicRate = mRateFetcher.fetch(ccdb.service, trk_bc.timestamp(), trk_bc.runNumber(), irSource) * 1.e-3; From f3a506cf931593e5edbf52a992203672bfca6935 Mon Sep 17 00:00:00 2001 From: wenyaCern <31894577+wenyaCern@users.noreply.github.com> Date: Fri, 26 Sep 2025 14:17:43 +0200 Subject: [PATCH 547/986] [PWGCF] Add centrality cut to the debug track source file (#13137) Co-authored-by: ALICE Action Bot --- PWGCF/FemtoDream/Tasks/femtoDreamDebugTrack.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/PWGCF/FemtoDream/Tasks/femtoDreamDebugTrack.cxx b/PWGCF/FemtoDream/Tasks/femtoDreamDebugTrack.cxx index 68fab988fb9..4c7e08cb7e7 100644 --- a/PWGCF/FemtoDream/Tasks/femtoDreamDebugTrack.cxx +++ b/PWGCF/FemtoDream/Tasks/femtoDreamDebugTrack.cxx @@ -66,6 +66,10 @@ struct femtoDreamDebugTrack { Configurable ConfTempFitVarMomentum{"ConfTempFitVarMomentum", 0, "Momentum used for binning: 0 -> pt; 1 -> preco; 2 -> ptpc"}; ConfigurableAxis ConfDummy{"ConfDummy", {1, 0, 1}, "Dummy axis for inv mass"}; + Configurable ConfdoCentCut{"ConfdoCentCut", false, "Enable centrality cut"}; + Configurable ConfCentMax{"ConfCentMax", 100., "Upper limit of centrality cut"}; + Configurable ConfCentMin{"ConfCentMin", 0., "Lower limit of centrality cut"}; + using FemtoMCCollisions = Join; using FemtoMCCollision = FemtoMCCollisions::iterator; @@ -110,6 +114,11 @@ struct femtoDreamDebugTrack { void FillDebugHistos(CollisionType& col, PartitionType& groupPartsOne) { eventHisto.fillQA(col); + + if (ConfdoCentCut.value && (col.multV0M() > ConfCentMax || col.multV0M() < ConfCentMin)) { + return; + } + for (auto& part : groupPartsOne) { trackHisto.fillQA(part, static_cast(ConfTempFitVarMomentum.value), col.multNtr(), col.multV0M(), ConfOptCorrelatedPlots); } From 528f7d8e3bb5da6b5256683ba05374cd612839cf Mon Sep 17 00:00:00 2001 From: Chiara Pinto <48326672+chiarapinto@users.noreply.github.com> Date: Fri, 26 Sep 2025 15:04:25 +0200 Subject: [PATCH 548/986] [PWGLF] added custom nsigma calibration for He3 (#13143) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Nuspex/antinucleiInJets.cxx | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx index 672afbec1a6..6b699b6fff6 100644 --- a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx +++ b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx @@ -32,6 +32,7 @@ #include "CCDB/BasicCCDBManager.h" #include "CCDB/CcdbApi.h" +#include "DataFormatsTPC/BetheBlochAleph.h" #include "Framework/ASoA.h" #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" @@ -138,6 +139,8 @@ struct AntinucleiInJets { Configurable nSigmaItsMin{"nSigmaItsMin", -3.0, "nSigmaITS min"}; Configurable nSigmaItsMax{"nSigmaItsMax", +3.0, "nSigmaITS max"}; Configurable setMCDefaultItsParams{"setMCDefaultItsParams", false, "set MC default parameters"}; + Configurable cfgCompensatePIDinTracking{"cfgCompensatePIDinTracking", false, "If true, divide tpcInnerParam by the electric charge"}; + Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {0.6539, 1.591, 0.8225, 2.363, 0.09}, "TPC Bethe-Bloch parameterisation for He3"}; // CCDB manager service for accessing condition data Service ccdb; @@ -246,6 +249,11 @@ struct AntinucleiInJets { // nsigmaITS for antiproton candidates registryData.add("antiproton_nsigma_its_data", "antiproton_nsigma_its_data", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{ITS}"}}); + + // custom nsigma for He3 - needed for 24 pp data + registryData.add("tpcsignal_data", "Specific energy loss", HistType::kTH2F, {{600, -6., 6., "#it{p} (GeV/#it{c})"}, {1400, 0, 1400, "d#it{E} / d#it{X} (a. u.)"}}); + registryData.add("antihelium3_jet_tpc_custom", "antihelium3_jet_tpc_custom", HistType::kTH2F, {{nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC} custom"}}); + registryData.add("antihelium3_ue_tpc_custom", "antihelium3_ue_tpc_custom", HistType::kTH2F, {{nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC} custom"}}); } // Generated antiproton spectra in jets and UE from MC truth @@ -783,6 +791,11 @@ struct AntinucleiInJets { fastjet::PseudoJet fourMomentum(track.px(), track.py(), track.pz(), track.energy(MassPionCharged)); fourMomentum.set_user_index(id); fjParticles.emplace_back(fourMomentum); + + // Fill TPC signal vs p*sign for PID calibration + bool heliumPID = track.pidForTracking() == o2::track::PID::Helium3; + float correctedTpcInnerParam = (heliumPID && cfgCompensatePIDinTracking) ? track.tpcInnerParam() / 2 : track.tpcInnerParam(); + registryData.fill(HIST("tpcsignal_data"), correctedTpcInnerParam * track.sign(), track.tpcSignal()); } // Reject empty events @@ -893,6 +906,12 @@ struct AntinucleiInJets { } if (passedItsPidHel) { registryData.fill(HIST("antihelium3_jet_tpc"), 2.0 * pt, nsigmaTPCHe); + // custom nsigma He3 based on bethe bloch fit of TPC signal + double tpcSignal = track.tpcSignal(); + double expectedSignalHe3 = tpc::BetheBlochAleph(static_cast(track.tpcInnerParam() * 2. / o2::constants::physics::MassHelium3), cfgBetheBlochParams.value[0], cfgBetheBlochParams.value[1], cfgBetheBlochParams.value[2], cfgBetheBlochParams.value[3], cfgBetheBlochParams.value[4]); + double sigmaHe3 = expectedSignalHe3 * cfgBetheBlochParams.value[4]; + double nSigmaTPCHe3Custom = (tpcSignal - expectedSignalHe3) / sigmaHe3; + registryData.fill(HIST("antihelium3_jet_tpc_custom"), 2.0 * pt, nSigmaTPCHe3Custom); } } @@ -983,6 +1002,12 @@ struct AntinucleiInJets { } if (passedItsPidHel) { registryData.fill(HIST("antihelium3_ue_tpc"), 2.0 * pt, nsigmaTPCHe); + // custom nsigma He3 based on bethe bloch fit of TPC signal + double tpcSignal = track.tpcSignal(); + double expectedSignalHe3 = tpc::BetheBlochAleph(static_cast(track.tpcInnerParam() * 2. / o2::constants::physics::MassHelium3), cfgBetheBlochParams.value[0], cfgBetheBlochParams.value[1], cfgBetheBlochParams.value[2], cfgBetheBlochParams.value[3], cfgBetheBlochParams.value[4]); + double sigmaHe3 = expectedSignalHe3 * cfgBetheBlochParams.value[4]; + double nSigmaTPCHe3Custom = (tpcSignal - expectedSignalHe3) / sigmaHe3; + registryData.fill(HIST("antihelium3_ue_tpc_custom"), 2.0 * pt, nSigmaTPCHe3Custom); } } From 06f892bef3d12d64d0aed2d815df580af4c004ad Mon Sep 17 00:00:00 2001 From: hernasab Date: Fri, 26 Sep 2025 15:19:00 +0200 Subject: [PATCH 549/986] [PWGCF] added ZDC correlation histograms (#13134) Co-authored-by: Sabrina Hernandez --- PWGCF/Flow/Tasks/flowZdcTask.cxx | 85 ++++++++++++++++++++------------ 1 file changed, 54 insertions(+), 31 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowZdcTask.cxx b/PWGCF/Flow/Tasks/flowZdcTask.cxx index e09bfb5e9df..4bd2d179a1a 100644 --- a/PWGCF/Flow/Tasks/flowZdcTask.cxx +++ b/PWGCF/Flow/Tasks/flowZdcTask.cxx @@ -64,8 +64,6 @@ struct FlowZdcTask { Configurable nBinsAmp{"nBinsAmp", 1025, "nbinsAmp"}; Configurable nBinsCent{"nBinsCent", 90, "nBinsCent"}; Configurable maxZn{"maxZn", 125.5, "Max ZN signal"}; - Configurable vtxRange{"vtxRange", 10.0f, "Vertex Z range to consider"}; - Configurable etaRange{"etaRange", 1.0f, "Eta range to consider"}; // configs for process QA Configurable nBinsNch{"nBinsNch", 2501, "N bins Nch (|eta|<0.8)"}; Configurable nBinsAmpFT0{"nBinsAmpFT0", 100, "N bins FT0 amp"}; @@ -74,8 +72,6 @@ struct FlowZdcTask { Configurable nBinsAmpFV0{"nBinsAmpFV0", 100, "N bins FV0 amp"}; Configurable maxAmpFV0{"maxAmpFV0", 2000, "Max FV0 amp"}; Configurable nBinsZDC{"nBinsZDC", 400, "nBinsZDC"}; - Configurable nBinsZN{"nBinsZN", 400, "N bins ZN"}; - Configurable nBinsZP{"nBinsZP", 160, "N bins ZP"}; Configurable minNch{"minNch", 0, "Min Nch (|eta|<0.8)"}; Configurable maxNch{"maxNch", 2500, "Max Nch (|eta|<0.8)"}; Configurable nBinsTDC{"nBinsTDC", 150, "nbinsTDC"}; @@ -94,7 +90,6 @@ struct FlowZdcTask { Configurable isTDCcut{"isTDCcut", false, "Use TDC cut?"}; Configurable useMidRapNchSel{"useMidRapNchSel", false, "Use mid-rapidity Nch selection"}; Configurable applyEff{"applyEff", true, "Apply track-by-track efficiency correction"}; - Configurable applyFD{"applyFD", false, "Apply track-by-track feed down correction"}; Configurable correctNch{"correctNch", true, "Correct also Nch"}; Configurable nSigmaNchCut{"nSigmaNchCut", 1., "nSigma Nch selection"}; @@ -107,16 +102,10 @@ struct FlowZdcTask { Configurable maxPtSpectra{"maxPtSpectra", 50., "maximum pt of the tracks"}; Configurable zemCut{"zemCut", 100., "ZEM cut"}; // axis configs - ConfigurableAxis axisPhi{"axisPhi", {60, 0.0, constants::math::TwoPI}, "phi axis for histograms"}; ConfigurableAxis axisMultiplicity{"axisMultiplicity", {3500, 0, 3500}, "centrality axis for histograms"}; ConfigurableAxis axisZN{"axisZN", {5000, 0, 500}, "axisZN"}; ConfigurableAxis axisZP{"axisZP", {5000, 0, 500}, "axisZP"}; - ConfigurableAxis axisFT0CAmp{"axisFT0CAmp", {5000, 0, 5000}, "axisFT0CAmp"}; - ConfigurableAxis axisFT0AAmp{"axisFT0AAmp", {5000, 0, 5000}, "axisFT0AAmp"}; - ConfigurableAxis axisFT0MAmp{"axisFT0MAmp", {10000, 0, 10000}, "axisFT0MAmp"}; - ConfigurableAxis multHistBin{"multHistBin", {501, -0.5, 500.5}, ""}; ConfigurableAxis axisCent{"axisCent", {10, 0, 100}, "axisCent"}; - ConfigurableAxis ft0cMultHistBin{"ft0cMultHistBin", {501, -0.5, 500.5}, ""}; ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.12}, "pT binning"}; Configurable posZcut{"posZcut", +10.0, "z-vertex position cut"}; Configurable minEta{"minEta", -0.8, "minimum eta"}; @@ -176,21 +165,16 @@ struct FlowZdcTask { void init(InitContext const&) { // define axes - const AxisSpec axisCounter{1, 0, +1, ""}; const AxisSpec axisEvent{18, 0.5, 18.5, ""}; const AxisSpec axisZpos{48, -12., 12., "Vtx_{z} (cm)"}; const AxisSpec axisEta{40, -1., +1., "#eta"}; const AxisSpec axisPt{binsPt, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec axisVtxZ{40, -20, 20, "Vertex Z", "VzAxis"}; - AxisSpec axisMult = {multHistBin, "Mult", "MultAxis"}; - AxisSpec axisFT0CMult = {ft0cMultHistBin, "ft0c", "FT0CMultAxis"}; // create histograms histos.add("hEventCounter", "Event counter", kTH1F, {axisEvent}); histos.add("zPos", ";;Entries;", kTH1F, {axisZpos}); - - histos.add("eventCounter", "eventCounter", kTH1F, {axisCounter}); histos.add("hZNvsFT0Ccent", "ZN Energy vs FT0C Centrality", kTH2F, @@ -204,17 +188,13 @@ struct FlowZdcTask { {{{nBinsNch, -0.5, maxNch}, {nBinsNch, -0.5, maxNch}}}); histos.add("T0Ccent", ";;Entries", kTH1F, {axisCent}); histos.add("NchUncorrected", ";#it{N}_{ch} (|#eta| < 0.8);Entries;", kTH1F, {{300, 0., 3000.}}); - histos.add("ZNamp", ";ZNA+ZNC;Entries;", kTH1F, {{nBinsZN, -0.5, maxZn}}); + histos.add("ZNamp", ";ZNA+ZNC;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); histos.add("ExcludedEvtVsFT0M", ";T0A+T0C (#times 1/100, -3.3 < #eta < -2.1 and 3.5 < #eta < 4.9);Entries;", kTH1F, {{nBinsAmpFT0, 0., maxAmpFT0}}); histos.add("ExcludedEvtVsNch", ";#it{N}_{ch} (|#eta|<0.8);Entries;", kTH1F, {{300, 0, 3000}}); histos.add("Nch", ";#it{N}_{ch} (|#eta| < 0.8, Corrected);", kTH1F, {{nBinsNch, minNch, maxNch}}); - histos.add("NchVsOneParCorr", ";#it{N}_{ch} (|#eta| < 0.8, Corrected);#LT[#it{p}_{T}^{(1)}]#GT (GeV/#it{c})", kTProfile, {{nBinsNch, minNch, maxNch}}); histos.add("EtaVsPhi", ";#eta;#varphi", kTH2F, {{{axisEta}, {100, -0.1 * PI, +2.1 * PI}}}); histos.add("ZposVsEta", "", kTProfile, {axisZpos}); - histos.add("sigma1Pt", ";;#sigma(p_{T})/p_{T};", kTProfile, {axisPt}); histos.add("dcaXYvspT", ";DCA_{xy} (cm);;", kTH2F, {{{50, -1., 1.}, {axisPt}}}); - histos.add("GlobalMult_vs_FT0C", "GlobalMult_vs_FT0C", kTH2F, {axisMult, axisFT0CMult}); - histos.add("VtxZHist", "VtxZHist", kTH1D, {axisVtxZ}); // event selection steps histos.add("eventSelectionSteps", "eventSelectionSteps", kTH1D, {axisEvent}); @@ -254,16 +234,31 @@ struct FlowZdcTask { histos.add("ZPAenergy", "common sum ZP energy side a", kTH1F, {axisZP}); histos.add("ZNenergy", "common sum zn (a + c sides) energy", kTH1F, {axisZN}); histos.add("ZPenergy", "common sum zp energy (a + c sides)", kTH1F, {axisZP}); - histos.add("hZNvsFT0CAmp", "ZN Energy vs FT0C Amplitude", kTH2F, {axisFT0CAmp, axisZN}); - histos.add("hZPvsFT0CAmp", "ZP Energy vs FT0C Amplitude", kTH2F, {axisFT0CAmp, axisZP}); + histos.add("hZNvsFT0CAmp", "ZN Energy vs FT0C Amplitude", kTH2F, {{nBinsAmpFT0, 0., maxAmpFT0}, axisZN}); + histos.add("hZPvsFT0CAmp", "ZP Energy vs FT0C Amplitude", kTH2F, {{nBinsAmpFT0, 0., maxAmpFT0}, axisZP}); histos.add("hZNvsMult", "ZN Energy vs Multiplicity", kTH2F, {axisMultiplicity, axisZN}); histos.add("hZPvsMult", "ZP Energy vs Multiplicity", kTH2F, {axisMultiplicity, axisZP}); } if (doprocessQA) { - histos.add("ZNVsFT0A", ";T0A (#times 1/100);ZNA+ZNC;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZn}}}); - histos.add("ZNVsFT0C", ";T0C (#times 1/100);ZNA+ZNC;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZn}}}); - histos.add("ZNVsFT0M", ";T0A+T0C (#times 1/100);ZNA+ZNC;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0M}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZNVsFT0A", ";T0A (#times 1/100);ZNA+ZNC Sector Energy;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZNVsFT0C", ";T0C (#times 1/100);ZNA+ZNC Sector Energy;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZNVsFT0M", ";T0A+T0C (#times 1/100);ZNA+ZNC Sector Energy;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0M}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZPVsFT0A", ";T0A (#times 1/100);ZPA+ZPC Sector Energy;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("ZPVsFT0C", ";T0C (#times 1/100);ZPA+ZPC Sector Energy;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("ZPVsFT0M", ";T0A+T0C (#times 1/100);ZPA+ZPC Sector Energy;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0M}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("ZNAVsFT0A", ";T0A (#times 1/100);ZNA Sector;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZNAVsFT0C", ";T0C (#times 1/100);ZNA Sector;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZNAVsFT0M", ";T0A+T0C (#times 1/100);ZNA Sector;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0M}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZNCVsFT0A", ";T0A (#times 1/100);ZNC Sector;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZNCVsFT0C", ";T0C (#times 1/100);ZNC Sector;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZNCVsFT0M", ";T0A+T0C (#times 1/100);ZNC Sector;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0M}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZPAVsFT0A", ";T0A (#times 1/100);ZPA Sector;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("ZPAVsFT0C", ";T0C (#times 1/100);ZPA Sector;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("ZPAVsFT0M", ";T0A+T0C (#times 1/100);ZPA Sector;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0M}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("ZPCVsFT0A", ";T0A (#times 1/100);ZPC Sector;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("ZPCVsFT0C", ";T0C (#times 1/100);ZPC Sector;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("ZPCVsFT0M", ";T0A+T0C (#times 1/100);ZPC Sector;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0M}, {nBinsZDC, -0.5, maxZp}}}); histos.add("ZN", ";ZNA+ZNC;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); histos.add("ZNA", ";ZNA Amplitude;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); histos.add("ZPA", ";ZPA Amplitude;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZp}}); @@ -293,7 +288,6 @@ struct FlowZdcTask { histos.add("ZEM1Vstdc", ";t_{ZEM1};ZEM1;", kTH2F, {{{30, -15., 15.}, {30, -0.5, 2000.5}}}); histos.add("ZEM2Vstdc", ";t_{ZEM2};ZEM2;", kTH2F, {{{30, -15., 15.}, {30, -0.5, 2000.5}}}); histos.add("debunch", ";t_{ZDC}-t_{ZDA};t_{ZDC}+t_{ZDA}", kTH2F, {{{nBinsTDC, minTdc, maxTdc}, {nBinsTDC, minTdc, maxTdc}}}); - histos.add("GlbTracks", "Nch", kTH1F, {{nBinsNch, minNch, maxNch}}); histos.add("ampFT0C", ";T0C (#times 1/100);", kTH1F, {{nBinsAmpFT0, 0., maxAmpFT0}}); histos.add("ampFT0A", ";T0A (#times 1/100);", kTH1F, {{nBinsAmpFT0, 0., maxAmpFT0}}); @@ -317,6 +311,12 @@ struct FlowZdcTask { histos.add("pZPCvsFT0Ccent", ";FT0C centrality;ZPC Amplitude", kTProfile, {{nBinsCent, minT0CcentCut, maxT0CcentCut}}); histos.add("pZPAvsGlbTrack", ";Global Tracks (ITS + TPC);ZPA Amplitude", kTProfile, {{nBinsNch, minNch, maxNch}}); histos.add("pZPCvsGlbTrack", ";Global Tracks (ITS + TPC);ZPC Amplitude", kTProfile, {{nBinsNch, minNch, maxNch}}); + histos.add("hZPASectorvsGlbTrack", ";Global Tracks (ITS + TPC);ZPA Sector Energy", kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsZDC, minNch, maxZp}}}); + histos.add("hZPCSectorvsGlbTrack", ";Global Tracks (ITS + TPC);ZPC Sector Energy", kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsZDC, minNch, maxZp}}}); + histos.add("hZNASectorvsGlbTrack", ";Global Tracks (ITS + TPC);ZNA Sector Energy", kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsZDC, minNch, maxZn}}}); + histos.add("hZNCSectorvsGlbTrack", ";Global Tracks (ITS + TPC);ZNC Sector Energy", kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsZDC, minNch, maxZn}}}); + histos.add("hZPSectorvsGlbTrack", ";Global Tracks (ITS + TPC);(ZPA + ZPC) Sector Energy", kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsZDC, minNch, maxZp}}}); + histos.add("hZNSectorvsGlbTrack", ";Global Tracks (ITS + TPC);(ZNA + ZNC) Sector Energy", kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsZDC, minNch, maxZn}}}); } if (doprocessZdc) { histos.add("commonZna", ";ZNA Common Energy;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); @@ -481,6 +481,8 @@ struct FlowZdcTask { float sumZNA = ((zdc.energySectorZNA())[0] + (zdc.energySectorZNA())[1] + (zdc.energySectorZNA())[2] + (zdc.energySectorZNA())[3]) / cfgCollisionEnergy; float sumZPC = ((zdc.energySectorZPC())[0] + (zdc.energySectorZPC())[1] + (zdc.energySectorZPC())[2] + (zdc.energySectorZPC())[3]) / cfgCollisionEnergy; float sumZPA = ((zdc.energySectorZPA())[0] + (zdc.energySectorZPA())[1] + (zdc.energySectorZPA())[2] + (zdc.energySectorZPA())[3]) / cfgCollisionEnergy; + float sumSectZN = (sumZNC + sumZNA); + float sumSectZP = (sumZPC + sumZPA); // TDC cut if (isTDCcut) { @@ -572,9 +574,24 @@ struct FlowZdcTask { histos.fill(HIST("ZNCVstdc"), tZNC, znC); histos.fill(HIST("ZNAVstdc"), tZNA, znA); histos.fill(HIST("ZPCVstdc"), tZPC, zpC); - histos.fill(HIST("ZNVsFT0A"), aT0A / 100., sumZNs); - histos.fill(HIST("ZNVsFT0C"), aT0C / 100., sumZNs); - histos.fill(HIST("ZNVsFT0M"), (aT0A + aT0C) / 100., sumZNs); + histos.fill(HIST("ZNVsFT0A"), aT0A / 100., sumSectZN); + histos.fill(HIST("ZNVsFT0C"), aT0C / 100., sumSectZN); + histos.fill(HIST("ZNVsFT0M"), (aT0A + aT0C) / 100., sumSectZN); + histos.fill(HIST("ZPVsFT0A"), aT0A / 100., sumSectZP); + histos.fill(HIST("ZPVsFT0C"), aT0C / 100., sumSectZP); + histos.fill(HIST("ZPVsFT0M"), (aT0A + aT0C) / 100., sumSectZP); + histos.fill(HIST("ZPAVsFT0A"), aT0A / 100., sumZPA); + histos.fill(HIST("ZPAVsFT0C"), aT0C / 100., sumZPA); + histos.fill(HIST("ZPAVsFT0M"), (aT0A + aT0C) / 100., sumZPA); + histos.fill(HIST("ZPCVsFT0A"), aT0A / 100., sumZPC); + histos.fill(HIST("ZPCVsFT0C"), aT0C / 100., sumZPC); + histos.fill(HIST("ZPCVsFT0M"), (aT0A + aT0C) / 100., sumZPC); + histos.fill(HIST("ZNCVsFT0A"), aT0A / 100., sumZNC); + histos.fill(HIST("ZNCVsFT0C"), aT0C / 100., sumZNC); + histos.fill(HIST("ZNCVsFT0M"), (aT0A + aT0C) / 100., sumZNC); + histos.fill(HIST("ZNAVsFT0A"), aT0A / 100., sumZNA); + histos.fill(HIST("ZNAVsFT0C"), aT0C / 100., sumZNA); + histos.fill(HIST("ZNAVsFT0M"), (aT0A + aT0C) / 100., sumZNA); histos.fill(HIST("ZPA"), zpA); histos.fill(HIST("ZPACommon"), commonSumZpa); histos.fill(HIST("ZPASector"), sumZPA); @@ -588,11 +605,17 @@ struct FlowZdcTask { if (std::isfinite(zpA) && !std::isnan(zpA) && cent >= minT0CcentCut && cent < maxT0CcentCut && glbTracks >= minNch && glbTracks < maxNch) { histos.fill(HIST("pZPAvsFT0Ccent"), cent, zpA); histos.fill(HIST("pZPAvsGlbTrack"), glbTracks, zpA); + histos.fill(HIST("hZPASectorvsGlbTrack"), glbTracks, sumZPA); } if (std::isfinite(zpC) && !std::isnan(zpC) && cent >= minT0CcentCut && cent < maxT0CcentCut && glbTracks >= minNch && glbTracks < maxNch) { histos.fill(HIST("pZPCvsFT0Ccent"), cent, zpC); histos.fill(HIST("pZPCvsGlbTrack"), glbTracks, zpC); + histos.fill(HIST("hZPCSectorvsGlbTrack"), glbTracks, sumZPC); } + histos.fill(HIST("hZNASectorvsGlbTrack"), glbTracks, sumZNA); + histos.fill(HIST("hZNCSectorvsGlbTrack"), glbTracks, sumZNC); + histos.fill(HIST("hZPSectorvsGlbTrack"), glbTracks, sumSectZP); + histos.fill(HIST("hZNSectorvsGlbTrack"), glbTracks, sumSectZN); // ZDC Correlations histos.fill(HIST("ZNAVsZNC"), znC, znA); histos.fill(HIST("ZNAVsZPA"), zpA, znA); @@ -619,6 +642,7 @@ struct FlowZdcTask { histos.fill(HIST("NchVsFT0A"), aT0A / 100., glbTracks); histos.fill(HIST("NchVsFT0C"), aT0C / 100., glbTracks); histos.fill(HIST("NchVsFT0M"), (aT0A + aT0C) / 100., glbTracks); + histos.fill(HIST("hNchvsNPV"), collision.multNTracksPVeta1(), tracks.size()); histos.fill(HIST("NchVsEt"), et, glbTracks); histos.fill(HIST("NchVsITStracks"), itsTracks, glbTracks); if (glbTracks >= minNchSel) { @@ -786,7 +810,6 @@ struct FlowZdcTask { histos.fill(HIST("hZPvsFT0CAmp"), ft0cAmp, sumZP); histos.fill(HIST("hZNvsMult"), nTot, sumZN); histos.fill(HIST("hZPvsMult"), nTot, sumZP); - histos.fill(HIST("hNchvsNPV"), collision.multNTracksPVeta1(), nTot); histos.fill(HIST("Nch"), nchMult); histos.fill(HIST("ZNamp"), sumZNs); histos.fill(HIST("NchVsZN"), nchMult, sumZNs); From 71cc8fc80d585ab8fcca0995f50151ec50f60ba1 Mon Sep 17 00:00:00 2001 From: Marcello Di Costanzo <96481191+Marcellocosti@users.noreply.github.com> Date: Fri, 26 Sep 2025 17:09:26 +0200 Subject: [PATCH 550/986] [PWGHF] Avoid filling trigger particle info table for each SE pair (#13141) Co-authored-by: ALICE Action Bot --- .../DataModel/DerivedDataCorrelationTables.h | 32 ++++++++--- .../correlatorFlowCharmHadronsReduced.cxx | 55 +++++++++++-------- .../derivedDataCreatorCorrelationsReduced.cxx | 32 ++++++----- 3 files changed, 74 insertions(+), 45 deletions(-) diff --git a/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h b/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h index b0a9cf3e390..c32049c3976 100644 --- a/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h +++ b/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h @@ -141,21 +141,42 @@ DECLARE_SOA_TABLE(HfcRedTrigBases, "AOD", "HFCREDTRIGBASE", //! Table with trigg soa::Index<>, aod::hf_correl_charm_had_reduced::HfcRedCorrCollId, aod::hf_correl_charm_had_reduced::PhiTrig, - aod::hf_correl_charm_had_reduced::EtaTrig, - aod::hf_correl_charm_had_reduced::PtTrig); + aod::hf_correl_charm_had_reduced::EtaTrig); DECLARE_SOA_TABLE(HfcRedTrigCharms, "AOD", "HFCREDTRIGCHARM", //! Table with Same Event Charm-Hadron pairs information + aod::hf_correl_charm_had_reduced::PtTrig, aod::hf_correl_charm_had_reduced::InvMassTrig, aod::hf_correl_charm_had_reduced::BdtScore0Trig, aod::hf_correl_charm_had_reduced::BdtScore1Trig); DECLARE_SOA_TABLE(HfcRedTrigTracks, "AOD", "HFCREDTRIGTRACK", //! Table with Same Event Charm-Hadron pairs information + aod::hf_correl_charm_had_reduced::PtTrig, aod::hf_correl_charm_had_reduced::NTpcCrossedRowsTrig, aod::hf_correl_charm_had_reduced::ItsClsMapTrig, aod::hf_correl_charm_had_reduced::ItsNClsTrig, aod::hf_correl_charm_had_reduced::DcaXYTrig, aod::hf_correl_charm_had_reduced::DcaZTrig); +namespace hf_correl_charm_had_reduced +{ +DECLARE_SOA_INDEX_COLUMN(HfcRedTrigCharm, hfcRedTrigCharm); //! Same Event pair index +DECLARE_SOA_INDEX_COLUMN(HfcRedTrigTrack, hfcRedTrigTrack); //! Same Event pair index +} // namespace hf_correl_charm_had_reduced + +DECLARE_SOA_TABLE(HfcRedSEChBases, "AOD", "HFCREDSECHBASE", //! Table with Same Event Trig-Assoc pairs + aod::hf_correl_charm_had_reduced::HfcRedCorrCollId, + aod::hf_correl_charm_had_reduced::HfcRedTrigCharmId, + aod::hf_correl_charm_had_reduced::PtAssoc, + aod::hf_correl_charm_had_reduced::DeltaEta, + aod::hf_correl_charm_had_reduced::DeltaPhi); + +DECLARE_SOA_TABLE(HfcRedSEHadBases, "AOD", "HFCREDSEHADBASE", //! Table with Same Event Trig-Assoc pairs + aod::hf_correl_charm_had_reduced::HfcRedCorrCollId, + aod::hf_correl_charm_had_reduced::HfcRedTrigTrackId, + aod::hf_correl_charm_had_reduced::PtAssoc, + aod::hf_correl_charm_had_reduced::DeltaEta, + aod::hf_correl_charm_had_reduced::DeltaPhi); + DECLARE_SOA_TABLE(HfcRedAssBases, "AOD", "HFCREDASSBASE", //! Table with associated candidate base info soa::Index<>, aod::hf_correl_charm_had_reduced::HfcRedCorrCollId, @@ -170,13 +191,6 @@ DECLARE_SOA_TABLE(HfcRedAssTracks, "AOD", "HFCREDASSTRACK", //! Table with Same aod::hf_correl_charm_had_reduced::DcaXYAssoc, aod::hf_correl_charm_had_reduced::DcaZAssoc); -DECLARE_SOA_TABLE(HfcRedSEBases, "AOD", "HFCREDSEBASE", //! Table with Same Event Trig-Assoc pairs - aod::hf_correl_charm_had_reduced::HfcRedCorrCollId, - aod::hf_correl_charm_had_reduced::PtTrig, - aod::hf_correl_charm_had_reduced::PtAssoc, - aod::hf_correl_charm_had_reduced::DeltaEta, - aod::hf_correl_charm_had_reduced::DeltaPhi); - DECLARE_SOA_TABLE(HfcRedSEChHads, "AOD", "HFCREDSECHHAD", //! Correlation pairs information Same Event aod::hf_correl_charm_had_reduced::PoolBin, aod::hf_correl_charm_had_reduced::PtTrig, diff --git a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx index 85df595a4b0..bb3c7c34b0a 100644 --- a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx +++ b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx @@ -116,8 +116,8 @@ struct HfCorrelatorFlowCharmHadronsReduced { int poolBins{0}; - using SameEvtPairsChHad = soa::Filtered>; - using SameEvtPairsHadHad = soa::Filtered>; + using SameEvtPairsChHad = soa::Filtered>; + using SameEvtPairsHadHad = soa::Filtered>; using AssocTracks = soa::Filtered>; using TrigCharmCands = soa::Join; @@ -261,14 +261,15 @@ struct HfCorrelatorFlowCharmHadronsReduced { /// \param trigCands are the selected trigger candidates /// \param assocTracks are the selected associated tracks /// \param binPolicy is the binning policy for the correlation - template + template void fillSameEvent(TPair const& pair, + TTrigCand const& trigCand, TBinningType binPolicy) { auto collision = pair.template hfcRedCorrColl_as(); - double ptTrig = pair.ptTrig(); - if constexpr (requires { pair.bdtScore0Trig(); }) { // ML selection on bkg score for Charm-Had case - if (!isSelBdtBkgScoreCut(pair, ptTrig)) { + double ptTrig = trigCand.ptTrig(); + if constexpr (requires { trigCand.bdtScore0Trig(); }) { // ML selection on bkg score for Charm-Had case + if (!isSelBdtBkgScoreCut(trigCand, ptTrig)) { return; } } @@ -282,21 +283,21 @@ struct HfCorrelatorFlowCharmHadronsReduced { registry.fill(HIST("hPoolBinTrigSE"), poolBin); registry.fill(HIST("hPoolBinAssocSE"), poolBin); if constexpr (fillTables) { - if constexpr (requires { pair.bdtScore0Trig(); }) { // Separate Charm-Had and Had-Had cases + if constexpr (requires { trigCand.bdtScore0Trig(); }) { // Separate Charm-Had and Had-Had cases rowPairSECharmHads(poolBin, ptTrig, pair.ptAssoc(), pair.deltaEta(), pair.deltaPhi(), - pair.invMassTrig(), pair.bdtScore0Trig(), pair.bdtScore1Trig(), + trigCand.invMassTrig(), trigCand.bdtScore0Trig(), trigCand.bdtScore1Trig(), pair.nTpcCrossedRowsAssoc(), pair.itsClsMapAssoc(), pair.itsNClsAssoc(), pair.dcaXYAssoc(), pair.dcaZAssoc()); } else { rowPairSEHadHads(poolBin, ptTrig, pair.ptAssoc(), pair.deltaEta(), pair.deltaPhi(), - pair.nTpcCrossedRowsTrig(), pair.itsClsMapTrig(), pair.itsNClsTrig(), pair.dcaXYTrig(), pair.dcaZTrig(), + trigCand.nTpcCrossedRowsTrig(), trigCand.itsClsMapTrig(), trigCand.itsNClsTrig(), trigCand.dcaXYTrig(), trigCand.dcaZTrig(), pair.nTpcCrossedRowsAssoc(), pair.itsClsMapAssoc(), pair.itsNClsAssoc(), pair.dcaXYAssoc(), pair.dcaZAssoc()); } rowCollInfos(collision.multiplicity(), collision.numPvContrib(), collision.centrality()); } if constexpr (fillSparses) { - if constexpr (requires { pair.bdtScore0Trig(); }) { // Separate Charm-Had and Had-Had cases + if constexpr (requires { trigCand.bdtScore0Trig(); }) { // Separate Charm-Had and Had-Had cases registry.fill(HIST("hSparseCorrelationsSECharmHad"), poolBin, ptTrig, pair.ptAssoc(), pair.deltaEta(), - pair.deltaPhi(), pair.invMassTrig(), pair.bdtScore0Trig(), pair.bdtScore1Trig()); + pair.deltaPhi(), trigCand.invMassTrig(), trigCand.bdtScore0Trig(), trigCand.bdtScore1Trig()); } else { registry.fill(HIST("hSparseCorrelationsSEHadHad"), poolBin, ptTrig, pair.ptAssoc(), pair.deltaEta(), pair.deltaPhi()); } @@ -370,53 +371,61 @@ struct HfCorrelatorFlowCharmHadronsReduced { } void processSameEventCharmHadWMultMix(SameEvtPairsChHad::iterator const& pair, + aod::HfcRedTrigCharms const&, aod::HfcRedCorrColls const&) { + auto trigCand = pair.template hfcRedTrigCharm_as(); if (fillSparses && fillTables) { - fillSameEvent(pair, binPolicyPosZMult); + fillSameEvent(pair, trigCand, binPolicyPosZMult); } else if (fillSparses) { - fillSameEvent(pair, binPolicyPosZMult); + fillSameEvent(pair, trigCand, binPolicyPosZMult); } else if (fillTables) { - fillSameEvent(pair, binPolicyPosZMult); + fillSameEvent(pair, trigCand, binPolicyPosZMult); } } PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processSameEventCharmHadWMultMix, "Process Same Event for Charm-Had with multiplicity pools", true); void processSameEventHadHadWMultMix(SameEvtPairsHadHad::iterator const& pair, + aod::HfcRedTrigTracks const&, aod::HfcRedCorrColls const&) { + auto trigCand = pair.template hfcRedTrigTrack_as(); if (fillSparses && fillTables) { - fillSameEvent(pair, binPolicyPosZMult); + fillSameEvent(pair, trigCand, binPolicyPosZMult); } else if (fillSparses) { - fillSameEvent(pair, binPolicyPosZMult); + fillSameEvent(pair, trigCand, binPolicyPosZMult); } else if (fillTables) { - fillSameEvent(pair, binPolicyPosZMult); + fillSameEvent(pair, trigCand, binPolicyPosZMult); } } PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processSameEventHadHadWMultMix, "Process Same Event for Had-Had with multiplicity pools", false); void processSameEventCharmHadWCentMix(SameEvtPairsChHad::iterator const& pair, + aod::HfcRedTrigCharms const&, aod::HfcRedCorrColls const&) { + auto trigCand = pair.template hfcRedTrigCharm_as(); if (fillSparses && fillTables) { - fillSameEvent(pair, binPolicyPosZCent); + fillSameEvent(pair, trigCand, binPolicyPosZCent); } else if (fillSparses) { - fillSameEvent(pair, binPolicyPosZCent); + fillSameEvent(pair, trigCand, binPolicyPosZCent); } else if (fillTables) { - fillSameEvent(pair, binPolicyPosZCent); + fillSameEvent(pair, trigCand, binPolicyPosZCent); } } PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processSameEventCharmHadWCentMix, "Process Same Event for Charm-Had with centrality pools", true); void processSameEventHadHadWCentMix(SameEvtPairsHadHad::iterator const& pair, + aod::HfcRedTrigTracks const&, aod::HfcRedCorrColls const&) { + auto trigCand = pair.template hfcRedTrigTrack_as(); if (fillSparses && fillTables) { - fillSameEvent(pair, binPolicyPosZCent); + fillSameEvent(pair, trigCand, binPolicyPosZCent); } else if (fillSparses) { - fillSameEvent(pair, binPolicyPosZCent); + fillSameEvent(pair, trigCand, binPolicyPosZCent); } else if (fillTables) { - fillSameEvent(pair, binPolicyPosZCent); + fillSameEvent(pair, trigCand, binPolicyPosZCent); } } PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processSameEventHadHadWCentMix, "Process Same Event for Had-Had with centrality pools", false); diff --git a/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx b/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx index e46a1d27bca..0ccbc065dd9 100644 --- a/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx +++ b/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx @@ -62,13 +62,14 @@ enum CandType { /// Code to select collisions with at least one Ds meson struct HfDerivedDataCreatorCorrelationsReduced { - Produces rowCollisions; // Table with reduced collision info - Produces rowSEPairs; // Table with same-event pairs info - Produces rowAssocBases; // Table with associated candidate base info - Produces rowAssocTrkSels; // Table with associated track selection info - Produces rowTrigBases; // Table with base trigger candidate info - Produces rowTrigCharms; // Table with charm trigger candidate selection info - Produces rowTrigHads; // Table with hadron trigger candidate selection info + Produces rowCollisions; // Table with reduced collision info + Produces rowSECharmHadPairs; // Table with same-event pairs info + Produces rowSEHadHadPairs; // Table with same-event pairs info + Produces rowAssocBases; // Table with associated candidate base info + Produces rowAssocTrkSels; // Table with associated track selection info + Produces rowTrigBases; // Table with base trigger candidate info + Produces rowTrigCharms; // Table with charm trigger candidate selection info + Produces rowTrigHads; // Table with hadron trigger candidate selection info Configurable centEstimator{"centEstimator", 2, "Centrality estimation (FT0A: 1, FT0C: 2, FT0M: 3, FV0A: 4)"}; Configurable selectionFlag{"selectionFlag", 15, "Selection Flag for hadron (ML score tables are required to run the task)"}; @@ -320,6 +321,13 @@ struct HfDerivedDataCreatorCorrelationsReduced { double trigCandPt = trigCand.pt(); registry.fill(HIST("hPhiVsPtTrig"), RecoDecay::constrainAngle(trigCand.phi(), -o2::constants::math::PIHalf), trigCandPt); registry.fill(HIST("hEtaVsPtTrig"), trigCand.eta(), trigCandPt); + if constexpr (candType == CandType::Hadron) { + rowTrigHads(trigCandPt, trigCand.tpcNClsCrossedRows(), trigCand.itsClusterMap(), trigCand.itsNCls(), trigCand.dcaXY(), trigCand.dcaZ()); + } else { + std::array outputMl = getCandMlScores(trigCand); + rowTrigCharms(trigCandPt, getCandMass(trigCand), outputMl[0], outputMl[1]); + } + for (const auto& assTrk : assTrks) { double assTrkPt = assTrk.pt(); if (usePtDiffDcaXYCut) { @@ -347,13 +355,11 @@ struct HfDerivedDataCreatorCorrelationsReduced { registry.fill(HIST("hDcaZVsPtAssoc"), assTrk.dcaZ(), assTrkPt); double deltaPhi = RecoDecay::constrainAngle(assTrk.phi() - trigCand.phi(), -o2::constants::math::PIHalf); - rowSEPairs(rowCollisions.lastIndex(), trigCandPt, assTrkPt, deltaEta, deltaPhi); rowAssocTrkSels(assTrk.tpcNClsCrossedRows(), assTrk.itsClusterMap(), assTrk.itsNCls(), assTrk.dcaXY(), assTrk.dcaZ()); if constexpr (candType == CandType::Hadron) { - rowTrigHads(trigCand.tpcNClsCrossedRows(), trigCand.itsClusterMap(), trigCand.itsNCls(), trigCand.dcaXY(), trigCand.dcaZ()); + rowSEHadHadPairs(rowCollisions.lastIndex(), rowTrigHads.lastIndex(), assTrkPt, deltaEta, deltaPhi); } else { - std::array outputMl = getCandMlScores(trigCand); - rowTrigCharms(getCandMass(trigCand), outputMl[0], outputMl[1]); + rowSECharmHadPairs(rowCollisions.lastIndex(), rowTrigCharms.lastIndex(), assTrkPt, deltaEta, deltaPhi); } } } @@ -369,8 +375,8 @@ struct HfDerivedDataCreatorCorrelationsReduced { registry.fill(HIST("hEtaVsPtTrig"), trigCand.eta(), trigCand.pt()); std::array outputMl = getCandMlScores(trigCand); - rowTrigBases(rowCollisions.lastIndex(), trigCand.phi(), trigCand.eta(), trigCand.pt()); - rowTrigCharms(getCandMass(trigCand), outputMl[0], outputMl[1]); + rowTrigBases(rowCollisions.lastIndex(), trigCand.phi(), trigCand.eta()); + rowTrigCharms(trigCand.pt(), getCandMass(trigCand), outputMl[0], outputMl[1]); } } From 61e9d670ff2fcb7759dc271d658793c0a32db1c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Fri, 26 Sep 2025 19:55:11 +0200 Subject: [PATCH 551/986] [ALICE3] Add method to specify dead phi region in layer (#13119) --- ALICE3/Core/DetLayer.cxx | 65 ++++++++++++++++++- ALICE3/Core/DetLayer.h | 29 ++++++++- ALICE3/Core/FastTracker.cxx | 60 +++++++++++++++-- ALICE3/Core/FastTracker.h | 8 ++- ...{testFastTracker.cxx => testFastTracker.C} | 8 ++- 5 files changed, 155 insertions(+), 15 deletions(-) rename ALICE3/macros/{testFastTracker.cxx => testFastTracker.C} (85%) diff --git a/ALICE3/Core/DetLayer.cxx b/ALICE3/Core/DetLayer.cxx index 25e61e6e6d5..b9757de2d2f 100644 --- a/ALICE3/Core/DetLayer.cxx +++ b/ALICE3/Core/DetLayer.cxx @@ -16,11 +16,14 @@ /// \brief Basic struct to hold information regarding a detector layer to be used in fast simulation /// -#include -#include - #include "DetLayer.h" +#include +#include + +#include +#include + namespace o2::fastsim { @@ -51,6 +54,62 @@ DetLayer::DetLayer(const DetLayer& other) { } +void DetLayer::addDeadPhiRegion(float phiStart, float phiEnd) +{ + static constexpr float kDefaultValue = 2.f; + static constexpr float kPhiTolerance = 1e-4f; + if (mDeadPhiRegions == nullptr) { + mDeadPhiRegions = new TGraph(); + mDeadPhiRegions->SetNameTitle(Form("deadPhiRegions_%s", name.Data()), Form("Dead phi regions for layer %s", name.Data())); + mDeadPhiRegions->AddPoint(0, kDefaultValue); + mDeadPhiRegions->AddPoint(o2::constants::math::TwoPI, kDefaultValue); + } + if (phiStart < 0 || phiStart >= o2::constants::math::TwoPI || phiEnd < 0 || phiEnd >= o2::constants::math::TwoPI) { + LOG(fatal) << "Cannot add dead phi region with invalid range [" << phiStart << ", " << phiEnd << "] to layer " << name; + return; + } + mDeadPhiRegions->AddPoint(phiStart, kDefaultValue); + mDeadPhiRegions->AddPoint(phiEnd, kDefaultValue); + mDeadPhiRegions->AddPoint(phiStart + kPhiTolerance, 0.f); + mDeadPhiRegions->AddPoint(phiEnd - kPhiTolerance, 0.f); + mDeadPhiRegions->Sort(); +} + +void DetLayer::setDeadPhiRegions(TGraph* graph) +{ + LOG(debug) << "Setting dead phi regions for layer " << name << " with graph " << (graph ? graph->GetName() : "nullptr"); + if (mDeadPhiRegions != nullptr) { + LOG(warning) << "Overriding existing dead phi regions for layer " << name; + delete mDeadPhiRegions; + } + mDeadPhiRegions = graph; + if (mDeadPhiRegions->GetN() == 0) { + LOG(warning) << "Dead phi regions graph for layer " << name << " is empty, clearing dead regions"; + mDeadPhiRegions = nullptr; + return; // cleared the dead regions + } + // Check sanity of the graph + if (mDeadPhiRegions != nullptr) { + for (int i = 0; i < mDeadPhiRegions->GetN(); i++) { + const float x = mDeadPhiRegions->GetX()[i]; + const float y = mDeadPhiRegions->GetY()[i]; + // First point has to be at 0, last point has to be at 2PI + if ((i == 0 && x != 0.f) || (i == mDeadPhiRegions->GetN() - 1 && x != o2::constants::math::TwoPI)) { + LOG(fatal) << "Dead phi regions graph for layer " << name << " has invalid x value " << x << " at point " << i << ", first point should be 0 and last point should be 2PI"; + } + LOG(debug) << "Point " << i << ": (" << x << ", " << y << ")"; + if (x < 0 || x > o2::constants::math::TwoPI) { + LOG(fatal) << "Dead phi regions graph for layer " << name << " has invalid x value " << x << " at point " << i; + } + if (y != 0.f && y != 2.f) { + LOG(fatal) << "Dead phi regions graph for layer " << name << " has invalid y value " << y << " at point " << i << ", should be 0 or 2"; + } + } + } else { + LOG(info) << "Cleared dead phi regions for layer " << name; + } +} + std::string DetLayer::toString() const { std::string out = ""; diff --git a/ALICE3/Core/DetLayer.h b/ALICE3/Core/DetLayer.h index 2577c73e42d..1efc730c0d5 100644 --- a/ALICE3/Core/DetLayer.h +++ b/ALICE3/Core/DetLayer.h @@ -19,9 +19,10 @@ #ifndef ALICE3_CORE_DETLAYER_H_ #define ALICE3_CORE_DETLAYER_H_ -#include +#include +#include -#include "TString.h" +#include namespace o2::fastsim { @@ -47,6 +48,17 @@ struct DetLayer { void setEfficiency(float eff_) { eff = eff_; } void setType(int type_) { type = type_; } + // Dead areas + + /// @brief Add a dead region in phi for this layer + /// @param phiStart starting angle in radians of the dead region + /// @param phiEnd ending angle in radians of the dead region + void addDeadPhiRegion(float phiStart, float phiEnd); + + /// @brief Set the dead regions in phi for this layer with a TGraph containing all regions. The graph should have y=2 for dead regions and y=0 for alive regions. + /// @param graph graph of the dead regions. Can be nullptr to clear the dead regions. + void setDeadPhiRegions(TGraph* graph); + // Getters float getRadius() const { return r; } float getZ() const { return z; } @@ -57,6 +69,7 @@ struct DetLayer { float getEfficiency() const { return eff; } int getType() const { return type; } const TString& getName() const { return name; } + const TGraph* getDeadPhiRegions() const { return mDeadPhiRegions; } // Check layer type bool isInert() const { return type == layerInert; } @@ -70,6 +83,15 @@ struct DetLayer { os << layer.toString(); return os; } + /// @brief Check if a given phi angle is in a dead region + /// @param phi The phi angle to check + /// @return True if the phi angle is in a dead region, false otherwise + bool isInDeadPhiRegion(float phi) const + { + if (mDeadPhiRegions == nullptr) + return false; + return mDeadPhiRegions->Eval(phi) > 1.f; + }; private: // TString for holding name @@ -90,6 +112,9 @@ struct DetLayer { // efficiency float eff; // detection efficiency + // dead regions in phi (in radians) + TGraph* mDeadPhiRegions = nullptr; + // layer type int type; // 0: undefined/inert, 1: silicon, 2: gas/tpc static constexpr int layerInert = 0; // inert/undefined layer diff --git a/ALICE3/Core/FastTracker.cxx b/ALICE3/Core/FastTracker.cxx index 5837d717884..b03a58e6c9e 100644 --- a/ALICE3/Core/FastTracker.cxx +++ b/ALICE3/Core/FastTracker.cxx @@ -22,7 +22,6 @@ #include #include -#include #include #include @@ -33,7 +32,7 @@ namespace fastsim // +-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+ -void FastTracker::AddLayer(TString name, float r, float z, float x0, float xrho, float resRPhi, float resZ, float eff, int type) +DetLayer* FastTracker::AddLayer(TString name, float r, float z, float x0, float xrho, float resRPhi, float resZ, float eff, int type) { LOG(debug) << "Adding layer " << name << " r=" << r << " z=" << z << " x0=" << x0 << " xrho=" << xrho << " resRPhi=" << resRPhi << " resZ=" << resZ << " eff=" << eff << " type=" << type; DetLayer newLayer(name, r, z, x0, xrho, resRPhi, resZ, eff, type); @@ -53,6 +52,18 @@ void FastTracker::AddLayer(TString name, float r, float z, float x0, float xrho, } // Add the new layer to the layers vector layers.push_back(newLayer); + // Return the last added layer + return &layers.back(); +} + +void FastTracker::addDeadPhiRegionInLayer(const std::string& layerName, float phiStart, float phiEnd) +{ + const int layerIdx = GetLayerIndex(layerName); + if (layerIdx < 0) { + LOG(fatal) << "Cannot add dead phi region to non-existing layer " << layerName; + return; + } + layers[layerIdx].addDeadPhiRegion(phiStart, phiEnd); } DetLayer FastTracker::GetLayer(int layer, bool ignoreBarrelLayers) const @@ -185,7 +196,7 @@ void FastTracker::AddSiliconALICE3(float scaleX0VD, std::vector pixelReso AddLayer("B03", 7., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); AddLayer("B04", 9., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); AddLayer("B05", 12., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); - AddLayer("iTOF", 19, 250, x0iTOF, xrhoiTOF, resRPhiOT, resZOT, 0.0f, 0); + AddLayer("iTOF", 19, 250, x0iTOF, xrhoiTOF, resRPhiOT, resZOT, eff, 0); AddLayer("B06", 20., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); AddLayer("B07", 30., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); AddLayer("B08", 45., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); @@ -285,12 +296,15 @@ void FastTracker::AddGenericDetector(std::string filename, o2::ccdb::BasicCCDBMa for (const auto& layer : layers) { LOG(info) << " Reading layer " << layer; - auto getKey = [&layer, &env](const std::string& name) { + auto getKey = [&layer, &env](const std::string& name, const bool required = true) { std::string key = layer + "." + name; if (!env.Defined(key.c_str())) { - LOG(warning) << "Key " << key << " not defined in configuration file, getting the default value"; + if (required) { + LOG(fatal) << "Key " << key << " not defined in configuration file"; + } + LOG(debug) << "Key " << key << " not defined in configuration file, getting the default value"; } - LOG(info) << " Getting key " << key; + LOG(debug) << " Getting key " << key << " from configuration file"; return key; }; const float r = env.GetValue(getKey("r").c_str(), -1.0f); @@ -302,9 +316,36 @@ void FastTracker::AddGenericDetector(std::string filename, o2::ccdb::BasicCCDBMa const float resZ = env.GetValue(getKey("resZ").c_str(), 0.0f); const float eff = env.GetValue(getKey("eff").c_str(), 0.0f); const int type = env.GetValue(getKey("type").c_str(), 0); + const char* deadPhiRegions = env.GetValue(getKey("deadPhiRegions", false).c_str(), ""); // void AddLayer(TString name, float r, float z, float x0, float xrho, float resRPhi = 0.0f, float resZ = 0.0f, float eff = 0.0f, int type = 0); - AddLayer(layer.c_str(), r, z, x0, xrho, resRPhi, resZ, eff, type); + LOG(info) << " Adding layer " << layer << " r=" << r << " z=" << z << " x0=" << x0 << " xrho=" << xrho << " resRPhi=" << resRPhi << " resZ=" << resZ << " eff=" << eff << " type=" << type << " deadPhiRegions=" << deadPhiRegions; + + DetLayer* addedLayer = AddLayer(layer.c_str(), r, z, x0, xrho, resRPhi, resZ, eff, type); + if (strlen(deadPhiRegions) > 0) { // Taking it as ccdb path or local file + // Check if it begins with ccdb: + if (std::string(deadPhiRegions).rfind("ccdb:", 0) == 0) { + std::string ccdbPath = std::string(deadPhiRegions).substr(5); // remove "ccdb:" prefix + if (ccdbManager == nullptr) { + LOG(fatal) << "CCDB manager is null, cannot retrieve file " << ccdbPath; + return; + } + TGraph* g = ccdbManager->getForTimeStamp(ccdbPath, -1); + addedLayer->setDeadPhiRegions(g); + } else { + // Taking it as local file + TFile infile(deadPhiRegions, "READ"); + if (!infile.IsOpen()) { + LOG(fatal) << "Cannot open dead phi regions file " << deadPhiRegions; + return; + } + TGraph* g = (TGraph*)infile.Get(infile.GetListOfKeys()->At(0)->GetName()); + infile.Close(); + addedLayer->setDeadPhiRegions(g); + } + } else { + LOG(debug) << " No dead phi regions for layer " << layer; + } } } @@ -493,6 +534,11 @@ int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa continue; // inert layer, skip } + if (layers[il].isInDeadPhiRegion(inputTrack.getPhi())) { + LOGF(debug, "Track is in dead region of layer %d", il); + continue; // dead region, skip + } + // layer is reached if (firstLayerReached < 0) { LOGF(debug, "First layer reached: %d", il); diff --git a/ALICE3/Core/FastTracker.h b/ALICE3/Core/FastTracker.h index ed45d140efe..dd88d381424 100644 --- a/ALICE3/Core/FastTracker.h +++ b/ALICE3/Core/FastTracker.h @@ -41,7 +41,13 @@ class FastTracker virtual ~FastTracker() {} // Layer and layer configuration - void AddLayer(TString name, float r, float z, float x0, float xrho, float resRPhi = 0.0f, float resZ = 0.0f, float eff = 0.0f, int type = 0); + DetLayer* AddLayer(TString name, float r, float z, float x0, float xrho, float resRPhi = 0.0f, float resZ = 0.0f, float eff = 0.0f, int type = 0); + + /// Add a dead region in phi for a specific layer + /// \param layerName Name of the layer to modify + /// \param phiStart Start angle of the dead region (in radians) + /// \param phiEnd End angle of the dead region (in radians) + void addDeadPhiRegionInLayer(const std::string& layerName, float phiStart, float phiEnd); DetLayer GetLayer(const int layer, bool ignoreBarrelLayers = true) const; std::vector GetLayers() const { return layers; } int GetLayerIndex(const std::string& name) const; diff --git a/ALICE3/macros/testFastTracker.cxx b/ALICE3/macros/testFastTracker.C similarity index 85% rename from ALICE3/macros/testFastTracker.cxx rename to ALICE3/macros/testFastTracker.C index ecca4c6de85..f9ec72e0765 100644 --- a/ALICE3/macros/testFastTracker.cxx +++ b/ALICE3/macros/testFastTracker.C @@ -15,12 +15,16 @@ #include "ALICE3/Core/FastTracker.h" -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPLHCIFData.h" +#include +#include + +#include void testFastTracker(std::string geometryFile = "a3geo.ini") { + fair::Logger::SetConsoleSeverity(fair::Severity::debug); + // auto& ccdb = o2::ccdb::BasicCCDBManager::instance(); // ccdb.setURL("http://alice-ccdb.cern.ch"); o2::fastsim::FastTracker fastTracker; From 5c4a66d48bbc3ead93af14138d6a5481f9f9accb Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Fri, 26 Sep 2025 20:02:44 +0200 Subject: [PATCH 552/986] [PWGLF] Add switch to activate sel8 trigger for QC check (#13148) --- PWGLF/Tasks/Resonances/phianalysisrun3.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/PWGLF/Tasks/Resonances/phianalysisrun3.cxx b/PWGLF/Tasks/Resonances/phianalysisrun3.cxx index a865482393a..7cd608e955c 100644 --- a/PWGLF/Tasks/Resonances/phianalysisrun3.cxx +++ b/PWGLF/Tasks/Resonances/phianalysisrun3.cxx @@ -56,6 +56,7 @@ struct phianalysisrun3 { SliceCache cache; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; // events + Configurable applyEvsel{"applyEvsel", false, "applyEvsel"}; Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; // track Configurable cfgCutPT{"cfgCutPT", 0.2, "PT cut on daughter track"}; @@ -252,7 +253,7 @@ struct phianalysisrun3 { void processSameEvent(EventCandidates::iterator const& collision, TrackCandidates const& tracks, aod::BCs const&) { - if (!collision.sel8()) { + if (applyEvsel && !collision.sel8()) { return; } if (timFrameEvsel && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { @@ -309,10 +310,10 @@ struct phianalysisrun3 { BinningTypeVertexContributor binningOnPositions{{axisVertex, axisMultiplicity}, true}; SameKindPair pair{binningOnPositions, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; for (auto& [c1, tracks1, c2, tracks2] : pair) { - if (!c1.sel8()) { + if (applyEvsel && !c1.sel8()) { continue; } - if (!c2.sel8()) { + if (applyEvsel && !c2.sel8()) { continue; } if (timFrameEvsel && (!c1.selection_bit(aod::evsel::kNoTimeFrameBorder) || !c2.selection_bit(aod::evsel::kNoTimeFrameBorder) || !c1.selection_bit(aod::evsel::kNoITSROFrameBorder) || !c2.selection_bit(aod::evsel::kNoITSROFrameBorder))) { From 448700347d6afb16e7a65b034c8740aba134648f Mon Sep 17 00:00:00 2001 From: GijsvWeelden <55794847+GijsvWeelden@users.noreply.github.com> Date: Sat, 27 Sep 2025 08:50:59 +0200 Subject: [PATCH 553/986] [PWGJE] V0 Jet Framework update (#13063) --- PWGJE/Core/JetV0Utilities.h | 8 ++++++-- PWGJE/JetFinders/jetFinderV0.cxx | 13 +++++++++---- PWGJE/TableProducer/derivedDataProducer.cxx | 3 ++- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/PWGJE/Core/JetV0Utilities.h b/PWGJE/Core/JetV0Utilities.h index e7495242e01..107b67c0ee8 100644 --- a/PWGJE/Core/JetV0Utilities.h +++ b/PWGJE/Core/JetV0Utilities.h @@ -138,9 +138,13 @@ auto slicedPerV0Candidate(T const& table, U const& candidate, V const& perV0Cand } template -bool isV0Particle(T const& particles, U const& particle) +bool isV0Particle(T const& particles, U const& particle, bool v0ChargedDecaysOnly) { - return RecoDecay::isMatchedMCGen(particles, particle, +kK0Short, std::array{+kPiPlus, -kPiPlus}, true) || RecoDecay::isMatchedMCGen(particles, particle, +kLambda0, std::array{+kProton, -kPiPlus}, true) || RecoDecay::isMatchedMCGen(particles, particle, -kLambda0, std::array{-kProton, +kPiPlus}, true); + if (v0ChargedDecaysOnly) { + return RecoDecay::isMatchedMCGen(particles, particle, +kK0Short, std::array{+kPiPlus, -kPiPlus}, true) || RecoDecay::isMatchedMCGen(particles, particle, +kLambda0, std::array{+kProton, -kPiPlus}, true) || RecoDecay::isMatchedMCGen(particles, particle, -kLambda0, std::array{-kProton, +kPiPlus}, true); + } else { + return RecoDecay::isMatchedMCGen(particles, particle, +kK0Short, std::array{+kPiPlus, -kPiPlus}, true) || RecoDecay::isMatchedMCGen(particles, particle, +kK0Short, std::array{+kPi0, +kPi0}, true) || RecoDecay::isMatchedMCGen(particles, particle, +kLambda0, std::array{+kProton, -kPiPlus}, true) || RecoDecay::isMatchedMCGen(particles, particle, +kLambda0, std::array{+kNeutron, +kPi0}, true) || RecoDecay::isMatchedMCGen(particles, particle, -kLambda0, std::array{-kProton, +kPiPlus}, true) || RecoDecay::isMatchedMCGen(particles, particle, -kLambda0, std::array{+kNeutron, +kPi0}, true); + } } enum JV0ParticleDecays { diff --git a/PWGJE/JetFinders/jetFinderV0.cxx b/PWGJE/JetFinders/jetFinderV0.cxx index ef4aaba93ab..69e9f5680ee 100644 --- a/PWGJE/JetFinders/jetFinderV0.cxx +++ b/PWGJE/JetFinders/jetFinderV0.cxx @@ -93,6 +93,7 @@ struct JetFinderV0Task { Configurable fillTHnSparse{"fillTHnSparse", true, "switch to fill the THnSparse"}; Configurable jetExtraParam{"jetExtraParam", -99.0, "sets the _extra_param in fastjet"}; Configurable useV0SignalFlags{"useV0SignalFlags", true, "use V0 signal flags table"}; + Configurable saveJetsWithCandidatesOnly{"saveJetsWithCandidatesOnly", true, "only save jets if they contain a V0"}; Service pdgDatabase; int trackSelection = -1; @@ -171,7 +172,9 @@ struct JetFinderV0Task { } inputParticles.clear(); if (!jetfindingutilities::analyseV0s(inputParticles, candidates, candPtMin, candPtMax, candYMin, candYMax, candIndex, useV0SignalFlags)) { - return; + if (saveJetsWithCandidatesOnly) { + return; + } } /* @@ -183,7 +186,7 @@ struct JetFinderV0Task { */ jetfindingutilities::analyseTracksMultipleCandidates(inputParticles, tracks, trackSelection, trackingEfficiency, candidates); - jetfindingutilities::findJets(jetFinder, inputParticles, minJetPt, maxJetPt, jetRadius, jetAreaFractionMin, collision, jetsTableInput, constituentsTableInput, registry.get(HIST("hJet")), fillTHnSparse, true); + jetfindingutilities::findJets(jetFinder, inputParticles, minJetPt, maxJetPt, jetRadius, jetAreaFractionMin, collision, jetsTableInput, constituentsTableInput, registry.get(HIST("hJet")), fillTHnSparse, saveJetsWithCandidatesOnly); } template @@ -192,10 +195,12 @@ struct JetFinderV0Task { inputParticles.clear(); if (!jetfindingutilities::analyseV0s(inputParticles, candidates, candPtMin, candPtMax, candYMin, candYMax, candIndex, useV0SignalFlags)) { - return; + if (saveJetsWithCandidatesOnly) { + return; + } } jetfindingutilities::analyseParticles(inputParticles, particleSelection, jetTypeParticleLevel, particles, pdgDatabase, &candidates); - jetfindingutilities::findJets(jetFinder, inputParticles, minJetPt, maxJetPt, jetRadius, jetAreaFractionMin, collision, jetsTable, constituentsTable, registry.get(HIST("hJetMCP")), fillTHnSparse, true); + jetfindingutilities::findJets(jetFinder, inputParticles, minJetPt, maxJetPt, jetRadius, jetAreaFractionMin, collision, jetsTable, constituentsTable, registry.get(HIST("hJetMCP")), fillTHnSparse, saveJetsWithCandidatesOnly); } void processDummy(aod::JetCollisions const&) diff --git a/PWGJE/TableProducer/derivedDataProducer.cxx b/PWGJE/TableProducer/derivedDataProducer.cxx index c3de10e5e90..1f736f6b064 100644 --- a/PWGJE/TableProducer/derivedDataProducer.cxx +++ b/PWGJE/TableProducer/derivedDataProducer.cxx @@ -147,6 +147,7 @@ struct JetDerivedDataProducerTask { Configurable ccdbURL{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable includeTriggers{"includeTriggers", false, "fill the collision information with software trigger decisions"}; Configurable includeHadronicRate{"includeHadronicRate", true, "fill the collision information with the hadronic rate"}; + Configurable v0ChargedDecaysOnly{"v0ChargedDecaysOnly", true, "store V0s (at particle-level) only if they decay to charged particles"}; Preslice perClusterCells = aod::emcalclustercell::emcalclusterId; Preslice perClusterTracks = aod::emcalclustercell::emcalclusterId; @@ -764,7 +765,7 @@ struct JetDerivedDataProducerTask { { // can loop over McV0Labels tables if we want to only store matched V0Particles bool filledV0McCollisionTable = false; for (auto const& particle : particles) { - if (jetv0utilities::isV0Particle(particles, particle)) { + if (jetv0utilities::isV0Particle(particles, particle, v0ChargedDecaysOnly)) { if (!filledV0McCollisionTable) { products.jV0McCollisionsTable(mcCollision.posX(), mcCollision.posY(), mcCollision.posZ()); products.jV0McCollisionIdsTable(mcCollision.globalIndex()); From be0644984d3ede2ae7f3a0c913a4914c5d1296a8 Mon Sep 17 00:00:00 2001 From: navneetkumar231295 <71565461+navneetkumar231295@users.noreply.github.com> Date: Sat, 27 Sep 2025 15:09:24 +0530 Subject: [PATCH 554/986] [PWGLF] To solve the issue of V0Indices (#13144) Co-authored-by: Navneet --- PWGLF/Tasks/Resonances/chargedkstaranalysis.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PWGLF/Tasks/Resonances/chargedkstaranalysis.cxx b/PWGLF/Tasks/Resonances/chargedkstaranalysis.cxx index 536d7a2d030..e6cab64be57 100644 --- a/PWGLF/Tasks/Resonances/chargedkstaranalysis.cxx +++ b/PWGLF/Tasks/Resonances/chargedkstaranalysis.cxx @@ -75,8 +75,6 @@ using namespace o2::soa; using namespace o2::constants::physics; struct chargedkstaranalysis { - SliceCache cache; - Preslice perCollision = aod::track::collisionId; using EventCandidates = soa::Join; // using EventCandidates = soa::Join; @@ -899,12 +897,15 @@ struct chargedkstaranalysis { } PROCESS_SWITCH(chargedkstaranalysis, processDataSE, "Process Event for data without Partitioning", true); + SliceCache cache; using BinningTypeVtxZT0M = ColumnBinningPolicy; // using BinningTypeVtxZT0M = ColumnBinningPolicy>; BinningTypeVtxZT0M colBinning{{cfgvtxbins, cfgmultbins}, true}; void processDataME(EventCandidates const& collisions, TrackCandidates const& tracks, V0Candidates const& v0s) { + Preslice perCollision = aod::track::collisionId; + Preslice perCollisionV0 = aod::v0::collisionId; auto tracksV0sTuple = std::make_tuple(tracks, v0s); Pair pair{colBinning, nEvtMixing, -1, collisions, tracksV0sTuple, &cache}; From 449dba6413f1e10a3b8c455f0a07ce3e9f06fdf3 Mon Sep 17 00:00:00 2001 From: Giovanni Malfattore <89481844+giovannimalfattore@users.noreply.github.com> Date: Sat, 27 Sep 2025 15:42:00 +0200 Subject: [PATCH 555/986] [PWGLF] NucleiTask - Fix efficiency and signal loss separation (#13146) --- PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx | 563 ++++++++++++-------------- 1 file changed, 267 insertions(+), 296 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx b/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx index 00b45796326..527723ec9b0 100644 --- a/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx +++ b/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx @@ -47,6 +47,7 @@ #include #include #include +#include using namespace o2; using namespace o2::framework; @@ -58,6 +59,11 @@ struct LFNucleiBATask { Zorro zorro; OutputObj zorroSummary{"zorroSummary"}; + // Efficiency configurator + std::unordered_set effEvtSet; + bool effEvtSetReady = false; + Configurable enableEffEvtSet{"enableEffEvtSet", true, "If true, MCGen uses the event-set built by MCReco; if false, MCGen runs stand-alone."}; + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry spectraGen{"spectraGen", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; HistogramRegistry debugHistos{"debugHistos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -298,6 +304,9 @@ struct LFNucleiBATask { zorroSummary.setObject(zorro.getZorroSummary()); } + effEvtSet.clear(); + effEvtSetReady = false; + const AxisSpec pAxis{binsPt, "#it{p} (GeV/#it{c})"}; const AxisSpec ptAxis{binsPt, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec ptHeAxis{binsPtHe, "#it{p}_{T} (GeV/#it{c})"}; @@ -333,28 +342,30 @@ struct LFNucleiBATask { evLossHistos.add("evLoss/pt/hAntiDeuteronTriggeredSel8", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{100, 0., 5.}}); evLossHistos.add("evLoss/pt/hAntiDeuteronGen", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{100, 0., 5.}}); } - spectraGen.add("LfEv/pT_nocut", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); - spectraGen.add("LfEv/pT_TVXtrigger", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); - spectraGen.add("LfEv/pT_TFrameBorder", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); - spectraGen.add("LfEv/pT_ITSROFBorder", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); - spectraGen.add("LfEv/pT_sel8", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); - spectraGen.add("LfEv/pT_MCsel8", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); - - spectraGen.add("LfEv/helium/pT_nocut_He", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); - spectraGen.add("LfEv/helium/pT_TVXtrigger_He", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); - spectraGen.add("LfEv/helium/pT_TFrameBorder_He", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); - spectraGen.add("LfEv/helium/pT_ITSROFBorder_He", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); - spectraGen.add("LfEv/helium/pT_sel8_He", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); - spectraGen.add("LfEv/helium/pT_MCsel8_He", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); - spectraGen.add("LfEv/helium/pT_MCsel8_HePrim", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); - - spectraGen.add("LfEv/helium/pT_nocut_antiHe", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); - spectraGen.add("LfEv/helium/pT_TVXtrigger_antiHe", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); - spectraGen.add("LfEv/helium/pT_TFrameBorder_antiHe", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); - spectraGen.add("LfEv/helium/pT_ITSROFBorder_antiHe", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); - spectraGen.add("LfEv/helium/pT_sel8_antiHe", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); - spectraGen.add("LfEv/helium/pT_MCsel8_antiHe", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); - spectraGen.add("LfEv/helium/pT_MCsel8_antiHePrim", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + if (doprocessMCRecoLfPidEv) { + spectraGen.add("LfEv/pT_nocut", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/pT_TVXtrigger", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/pT_TFrameBorder", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/pT_ITSROFBorder", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/pT_sel8", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/pT_MCsel8", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + + spectraGen.add("LfEv/helium/pT_nocut_He", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/helium/pT_TVXtrigger_He", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/helium/pT_TFrameBorder_He", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/helium/pT_ITSROFBorder_He", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/helium/pT_sel8_He", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/helium/pT_MCsel8_He", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/helium/pT_MCsel8_HePrim", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + + spectraGen.add("LfEv/helium/pT_nocut_antiHe", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/helium/pT_TVXtrigger_antiHe", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/helium/pT_TFrameBorder_antiHe", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/helium/pT_ITSROFBorder_antiHe", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/helium/pT_sel8_antiHe", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/helium/pT_MCsel8_antiHe", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/helium/pT_MCsel8_antiHePrim", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + } if (enableDebug) { debugHistos.add("qa/h1VtxZ_nocut", "V_{z};V_{z} (in cm); counts", HistType::kTH1F, {{1500, -15, 15}}); @@ -2612,31 +2623,25 @@ struct LFNucleiBATask { histos.fill(HIST("tracks/dca/before/hDCAz"), track.dcaZ()); histos.fill(HIST("tracks/dca/before/hDCAzVsPt"), track.pt(), track.dcaZ()); - if (enablePr && prRapCut) { - if (std::abs(track.tpcNSigmaPr()) < nsigmaTPCvar.nsigmaTPCPr) { - if (track.sign() > 0) { - histos.fill(HIST("tracks/proton/dca/before/hDCAzVsPtProton"), track.pt(), track.dcaZ()); - } else { - histos.fill(HIST("tracks/proton/dca/before/hDCAzVsPtantiProton"), track.pt(), track.dcaZ()); - } + if (enablePr && prRapCut && (std::abs(track.tpcNSigmaPr()) < nsigmaTPCvar.nsigmaTPCPr)) { + if (track.sign() > 0) { + histos.fill(HIST("tracks/proton/dca/before/hDCAzVsPtProton"), track.pt(), track.dcaZ()); + } else { + histos.fill(HIST("tracks/proton/dca/before/hDCAzVsPtantiProton"), track.pt(), track.dcaZ()); } } - if (enableTr && trRapCut) { - if (isTritonTPCpid) { - if (track.sign() > 0) { - histos.fill(HIST("tracks/triton/dca/before/hDCAzVsPtTriton"), track.pt(), track.dcaZ()); - } else { - histos.fill(HIST("tracks/triton/dca/before/hDCAzVsPtantiTriton"), track.pt(), track.dcaZ()); - } + if (enableTr && trRapCut && isTritonTPCpid) { + if (track.sign() > 0) { + histos.fill(HIST("tracks/triton/dca/before/hDCAzVsPtTriton"), track.pt(), track.dcaZ()); + } else { + histos.fill(HIST("tracks/triton/dca/before/hDCAzVsPtantiTriton"), track.pt(), track.dcaZ()); } } - if (enableAl && alRapCut) { - if (std::abs(track.tpcNSigmaAl()) < nsigmaTPCvar.nsigmaTPCAl) { - if (track.sign() > 0) { - histos.fill(HIST("tracks/alpha/dca/before/hDCAzVsPtAlpha"), track.pt(), track.dcaZ()); - } else { - histos.fill(HIST("tracks/alpha/dca/before/hDCAzVsPtantiAlpha"), track.pt(), track.dcaZ()); - } + if (enableAl && alRapCut && (std::abs(track.tpcNSigmaAl()) < nsigmaTPCvar.nsigmaTPCAl)) { + if (track.sign() > 0) { + histos.fill(HIST("tracks/alpha/dca/before/hDCAzVsPtAlpha"), track.pt(), track.dcaZ()); + } else { + histos.fill(HIST("tracks/alpha/dca/before/hDCAzVsPtantiAlpha"), track.pt(), track.dcaZ()); } } } @@ -2949,7 +2954,6 @@ struct LFNucleiBATask { } } } - break; case PDGAlpha: if (enableAl && alRapCut && passDCAxyCut) { @@ -3859,7 +3863,6 @@ struct LFNucleiBATask { } if (outFlagOptions.makeDCAAfterCutPlots) { - if (isHeWTPCpid) { histos.fill(HIST("tracks/helium/dca/after/hDCAxyVsDCAzVsPtHelium"), track.dcaXY(), track.dcaZ(), hePt); histos.fill(HIST("tracks/helium/dca/after/h3DCAvsPtHelium"), track.dcaXY(), track.dcaZ(), hePt); @@ -3881,37 +3884,31 @@ struct LFNucleiBATask { histos.fill(HIST("tracks/dca/after/hDCAxyVsPt"), track.pt(), track.dcaXY()); histos.fill(HIST("tracks/dca/after/hDCAzVsPt"), track.pt(), track.dcaZ()); - if (enablePr && prRapCut) { - if (std::abs(track.tpcNSigmaPr()) < nsigmaTPCvar.nsigmaTPCPr) { - if (track.sign() > 0) { - histos.fill(HIST("tracks/proton/dca/after/hDCAxyVsPtProton"), track.pt(), track.dcaXY()); - histos.fill(HIST("tracks/proton/dca/after/hDCAzVsPtProton"), track.pt(), track.dcaZ()); - } else { - histos.fill(HIST("tracks/proton/dca/after/hDCAxyVsPtantiProton"), track.pt(), track.dcaXY()); - histos.fill(HIST("tracks/proton/dca/after/hDCAzVsPtantiProton"), track.pt(), track.dcaZ()); - } + if (enablePr && prRapCut && (std::abs(track.tpcNSigmaPr()) < nsigmaTPCvar.nsigmaTPCPr)) { + if (track.sign() > 0) { + histos.fill(HIST("tracks/proton/dca/after/hDCAxyVsPtProton"), track.pt(), track.dcaXY()); + histos.fill(HIST("tracks/proton/dca/after/hDCAzVsPtProton"), track.pt(), track.dcaZ()); + } else { + histos.fill(HIST("tracks/proton/dca/after/hDCAxyVsPtantiProton"), track.pt(), track.dcaXY()); + histos.fill(HIST("tracks/proton/dca/after/hDCAzVsPtantiProton"), track.pt(), track.dcaZ()); } } - if (enableTr && trRapCut) { - if (isTritonTPCpid) { - if (track.sign() > 0) { - histos.fill(HIST("tracks/triton/dca/after/hDCAxyVsPtTriton"), track.pt(), track.dcaXY()); - histos.fill(HIST("tracks/triton/dca/after/hDCAzVsPtTriton"), track.pt(), track.dcaZ()); - } else { - histos.fill(HIST("tracks/triton/dca/after/hDCAxyVsPtantiTriton"), track.pt(), track.dcaXY()); - histos.fill(HIST("tracks/triton/dca/after/hDCAzVsPtantiTriton"), track.pt(), track.dcaZ()); - } + if (enableTr && trRapCut && isTritonTPCpid) { + if (track.sign() > 0) { + histos.fill(HIST("tracks/triton/dca/after/hDCAxyVsPtTriton"), track.pt(), track.dcaXY()); + histos.fill(HIST("tracks/triton/dca/after/hDCAzVsPtTriton"), track.pt(), track.dcaZ()); + } else { + histos.fill(HIST("tracks/triton/dca/after/hDCAxyVsPtantiTriton"), track.pt(), track.dcaXY()); + histos.fill(HIST("tracks/triton/dca/after/hDCAzVsPtantiTriton"), track.pt(), track.dcaZ()); } } - if (enableAl && alRapCut) { - if (std::abs(track.tpcNSigmaAl()) < nsigmaTPCvar.nsigmaTPCAl) { - if (track.sign() > 0) { - histos.fill(HIST("tracks/alpha/dca/after/hDCAxyVsPtAlpha"), track.pt(), track.dcaXY()); - histos.fill(HIST("tracks/alpha/dca/after/hDCAzVsPtAlpha"), track.pt(), track.dcaZ()); - } else { - histos.fill(HIST("tracks/alpha/dca/after/hDCAxyVsPtantiAlpha"), track.pt(), track.dcaXY()); - histos.fill(HIST("tracks/alpha/dca/after/hDCAzVsPtantiAlpha"), track.pt(), track.dcaZ()); - } + if (enableAl && alRapCut && (std::abs(track.tpcNSigmaAl()) < nsigmaTPCvar.nsigmaTPCAl)) { + if (track.sign() > 0) { + histos.fill(HIST("tracks/alpha/dca/after/hDCAxyVsPtAlpha"), track.pt(), track.dcaXY()); + histos.fill(HIST("tracks/alpha/dca/after/hDCAzVsPtAlpha"), track.pt(), track.dcaZ()); + } else { + histos.fill(HIST("tracks/alpha/dca/after/hDCAxyVsPtantiAlpha"), track.pt(), track.dcaXY()); + histos.fill(HIST("tracks/alpha/dca/after/hDCAzVsPtantiAlpha"), track.pt(), track.dcaZ()); } } } @@ -3946,8 +3943,6 @@ struct LFNucleiBATask { } if (passDCAxyzCut) { - // LOG(info)<<"\n collisionId ============>"< 0) { - if (outFlagOptions.enableEffPlots) - histos.fill(HIST("tracks/eff/triton/hPtTrTOF"), track.pt()); - histos.fill(HIST("tracks/triton/h2TOFmassTritonVsPt"), massTOF, track.pt()); - histos.fill(HIST("tracks/triton/h2TOFmass2TritonVsPt"), massTOF * massTOF - MassTritonVal * MassTritonVal, track.pt()); - if (outFlagOptions.enableBetaCut && (track.beta() > cfgBetaCut)) { - histos.fill(HIST("tracks/triton/h2TOFmassTritonVsPt_BetaCut"), massTOF, track.pt()); - histos.fill(HIST("tracks/triton/h2TOFmass2TritonVsPt_BetaCut"), massTOF * massTOF - MassTritonVal * MassTritonVal, track.pt()); - } - } else { - if (outFlagOptions.enableEffPlots) - histos.fill(HIST("tracks/eff/triton/hPtantiTrTOF"), track.pt()); - histos.fill(HIST("tracks/triton/h2TOFmassantiTritonVsPt"), massTOF, track.pt()); - histos.fill(HIST("tracks/triton/h2TOFmass2antiTritonVsPt"), massTOF * massTOF - MassTritonVal * MassTritonVal, track.pt()); - if (outFlagOptions.enableBetaCut && (track.beta() > cfgBetaCut)) { - histos.fill(HIST("tracks/triton/h2TOFmassantiTritonVsPt_BetaCut"), massTOF, track.pt()); - histos.fill(HIST("tracks/triton/h2TOFmass2antiTritonVsPt_BetaCut"), massTOF * massTOF - MassTritonVal * MassTritonVal, track.pt()); - } + if (enableTr && isTritonTPCpid && trRapCut) { + const float m2diff = massTOF * massTOF - MassTritonVal * MassTritonVal; + if (track.sign() > 0) { + if (outFlagOptions.enableEffPlots) + histos.fill(HIST("tracks/eff/triton/hPtTrTOF"), track.pt()); + histos.fill(HIST("tracks/triton/h2TOFmassTritonVsPt"), massTOF, track.pt()); + histos.fill(HIST("tracks/triton/h2TOFmass2TritonVsPt"), m2diff, track.pt()); + if (outFlagOptions.enableBetaCut && (track.beta() > cfgBetaCut)) { + histos.fill(HIST("tracks/triton/h2TOFmassTritonVsPt_BetaCut"), massTOF, track.pt()); + histos.fill(HIST("tracks/triton/h2TOFmass2TritonVsPt_BetaCut"), m2diff, track.pt()); + } + } else { + if (outFlagOptions.enableEffPlots) + histos.fill(HIST("tracks/eff/triton/hPtantiTrTOF"), track.pt()); + histos.fill(HIST("tracks/triton/h2TOFmassantiTritonVsPt"), massTOF, track.pt()); + histos.fill(HIST("tracks/triton/h2TOFmass2antiTritonVsPt"), m2diff, track.pt()); + if (outFlagOptions.enableBetaCut && (track.beta() > cfgBetaCut)) { + histos.fill(HIST("tracks/triton/h2TOFmassantiTritonVsPt_BetaCut"), massTOF, track.pt()); + histos.fill(HIST("tracks/triton/h2TOFmass2antiTritonVsPt_BetaCut"), m2diff, track.pt()); } } } @@ -5680,7 +5668,6 @@ struct LFNucleiBATask { break; case PDGHelium: if (isHelium && passDCAzCutHe && passDCAxyCutHe) { - // histos.fill(HIST("tracks/helium/h1HeliumSpectraTrue"), hePt); histos.fill(HIST("tracks/helium/h1HeliumSpectraTrue_Z2"), 2 * hePt); if (outFlagOptions.makeDCAAfterCutPlots) { @@ -5693,7 +5680,6 @@ struct LFNucleiBATask { } } if (std::abs(track.tpcNSigmaHe()) < nsigmaTPCvar.nsigmaTPCHe) { - // histos.fill(HIST("tracks/helium/h1HeliumSpectraTrueWPID"), hePt); histos.fill(HIST("tracks/helium/h1HeliumSpectraTrueWPID_Z2"), 2 * hePt); if (outFlagOptions.enableEffPlots) { histos.fill(HIST("tracks/eff/helium/hPtHeTrue_Z2"), 2 * hePt); @@ -5703,7 +5689,6 @@ struct LFNucleiBATask { } } if (isPhysPrim) { - // histos.fill(HIST("tracks/helium/h1HeliumSpectraTruePrim"), hePt); histos.fill(HIST("tracks/helium/h1HeliumSpectraTruePrim_Z2"), 2 * hePt); if (std::abs(track.tpcNSigmaHe()) < nsigmaTPCvar.nsigmaTPCHe) { @@ -5767,7 +5752,6 @@ struct LFNucleiBATask { } } if (isPhysPrim) { - // histos.fill(HIST("tracks/helium/h1antiHeliumSpectraTruePrim"), antihePt); histos.fill(HIST("tracks/helium/h1antiHeliumSpectraTruePrim_Z2"), 2 * antihePt); if (std::abs(track.tpcNSigmaHe()) < nsigmaTPCvar.nsigmaTPCHe) { @@ -5960,6 +5944,10 @@ struct LFNucleiBATask { aod::McParticles const& mcParticles, o2::aod::BCsWithTimestamps const&) { + if (event.mcCollisionId() >= 0) { + effEvtSet.insert(event.mcCollisionId()); + effEvtSetReady = true; + } fillHistograms(event, tracks, mcParticles); } // CLOSING PROCESS MC RECO PROCESS_SWITCH(LFNucleiBATask, processMCReco, "process mc reco", false); @@ -5971,6 +5959,10 @@ struct LFNucleiBATask { aod::McParticles const& mcParticles, o2::aod::BCsWithTimestamps const&) { + if (event.mcCollisionId() >= 0) { + effEvtSet.insert(event.mcCollisionId()); + effEvtSetReady = true; + } fillHistograms(event, tracks, mcParticles); } // CLOSING PROCESS MC RECO PROCESS_SWITCH(LFNucleiBATask, processMCRecoLfPid, "process mc reco with LfPid", false); @@ -5984,107 +5976,80 @@ struct LFNucleiBATask { aod::McCollisions const&) { for (const auto& collision : collisions) { - if (!collision.has_mcCollision()) { + if (!collision.has_mcCollision()) continue; - } + const auto& particlesInCollision = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, collision.mcCollision().globalIndex(), cache); + const bool hasTVX = collision.selection_bit(aod::evsel::kIsTriggerTVX); + const bool hasNoTFB = collision.selection_bit(aod::evsel::kNoTimeFrameBorder); + const bool hasNoItsRofFB = collision.selection_bit(aod::evsel::kNoITSROFrameBorder); + const bool hasSel8 = collision.sel8(); + for (const auto& mcParticle : particlesInCollision) { - if (mcParticle.y() > kinemOptions.cfgRapidityCutHigh || mcParticle.y() < kinemOptions.cfgRapidityCutLow) { + const float rapidity = mcParticle.y(); + if (rapidity > kinemOptions.cfgRapidityCutHigh || rapidity < kinemOptions.cfgRapidityCutLow) continue; - } - spectraGen.fill(HIST("LfEv/pT_nocut"), mcParticle.pt()); - if (mcParticle.pdgCode() == PDGHelium) { - spectraGen.fill(HIST("LfEv/helium/pT_nocut_He"), mcParticle.pt()); - } - if (mcParticle.pdgCode() == -PDGHelium) { - spectraGen.fill(HIST("LfEv/helium/pT_nocut_antiHe"), mcParticle.pt()); - } - } - if (collision.selection_bit(aod::evsel::kIsTriggerTVX)) { - for (const auto& mcParticle : particlesInCollision) { - if (mcParticle.y() > kinemOptions.cfgRapidityCutHigh || mcParticle.y() < kinemOptions.cfgRapidityCutLow) { - continue; - } - spectraGen.fill(HIST("LfEv/pT_TVXtrigger"), mcParticle.pt()); - if (mcParticle.pdgCode() == PDGHelium) { - spectraGen.fill(HIST("LfEv/helium/pT_TVXtrigger_He"), mcParticle.pt()); - } - if (mcParticle.pdgCode() == -PDGHelium) { - spectraGen.fill(HIST("LfEv/helium/pT_TVXtrigger_antiHe"), mcParticle.pt()); - } - } - } - if (collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { - for (const auto& mcParticle : particlesInCollision) { - if (mcParticle.y() > kinemOptions.cfgRapidityCutHigh || mcParticle.y() < kinemOptions.cfgRapidityCutLow) { - continue; - } - - spectraGen.fill(HIST("LfEv/pT_TFrameBorder"), mcParticle.pt()); - if (mcParticle.pdgCode() == PDGHelium) { - spectraGen.fill(HIST("LfEv/helium/pT_TFrameBorder_He"), mcParticle.pt()); - } - if (mcParticle.pdgCode() == -PDGHelium) { - spectraGen.fill(HIST("LfEv/helium/pT_TFrameBorder_antiHe"), mcParticle.pt()); - } - } - } - if (collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { - for (const auto& mcParticle : particlesInCollision) { - if (mcParticle.y() > kinemOptions.cfgRapidityCutHigh || mcParticle.y() < kinemOptions.cfgRapidityCutLow) { - continue; - } - - spectraGen.fill(HIST("LfEv/pT_ITSROFBorder"), mcParticle.pt()); - if (mcParticle.pdgCode() == PDGHelium) { - spectraGen.fill(HIST("LfEv/helium/pT_ITSROFBorder_He"), mcParticle.pt()); - } - if (mcParticle.pdgCode() == -PDGHelium) { - spectraGen.fill(HIST("LfEv/helium/pT_ITSROFBorder_antiHe"), mcParticle.pt()); - } - } - } - if ((collision.selection_bit(aod::evsel::kIsTriggerTVX)) && (collision.selection_bit(aod::evsel::kNoTimeFrameBorder))) { - for (const auto& mcParticle : particlesInCollision) { - if (mcParticle.y() > kinemOptions.cfgRapidityCutHigh || mcParticle.y() < kinemOptions.cfgRapidityCutLow) { - continue; - } - - bool isPhysPrim = mcParticle.isPhysicalPrimary(); - - spectraGen.fill(HIST("LfEv/pT_MCsel8"), mcParticle.pt()); - if (mcParticle.pdgCode() == PDGHelium) { - spectraGen.fill(HIST("LfEv/helium/pT_MCsel8_He"), mcParticle.pt()); + const int pdg = mcParticle.pdgCode(); + const float pt = mcParticle.pt(); + bool isPhysPrim = mcParticle.isPhysicalPrimary(); + + // No cut + spectraGen.fill(HIST("LfEv/pT_nocut"), pt); + if (pdg == PDGHelium) + spectraGen.fill(HIST("LfEv/helium/pT_nocut_He"), pt); + if (pdg == -PDGHelium) + spectraGen.fill(HIST("LfEv/helium/pT_nocut_antiHe"), pt); + // Trigger TVX + if (hasTVX) { + spectraGen.fill(HIST("LfEv/pT_TVXtrigger"), pt); + if (pdg == PDGHelium) + spectraGen.fill(HIST("LfEv/helium/pT_TVXtrigger_He"), pt); + if (pdg == -PDGHelium) + spectraGen.fill(HIST("LfEv/helium/pT_TVXtrigger_antiHe"), pt); + } + // No Time Frame Border + if (hasNoTFB) { + spectraGen.fill(HIST("LfEv/pT_TFrameBorder"), pt); + if (pdg == PDGHelium) + spectraGen.fill(HIST("LfEv/helium/pT_TFrameBorder_He"), pt); + if (pdg == -PDGHelium) + spectraGen.fill(HIST("LfEv/helium/pT_TFrameBorder_antiHe"), pt); + } + // No ITS ROF Frame Border + if (hasNoItsRofFB) { + spectraGen.fill(HIST("LfEv/pT_ITSROFBorder"), pt); + if (pdg == PDGHelium) + spectraGen.fill(HIST("LfEv/helium/pT_ITSROFBorder_He"), pt); + if (pdg == -PDGHelium) + spectraGen.fill(HIST("LfEv/helium/pT_ITSROFBorder_antiHe"), pt); + } + // Sel8 MC + if (hasTVX && hasNoTFB) { + spectraGen.fill(HIST("LfEv/pT_MCsel8"), pt); + if (pdg == PDGHelium) { + spectraGen.fill(HIST("LfEv/helium/pT_MCsel8_He"), pt); if (isPhysPrim) - spectraGen.fill(HIST("LfEv/helium/pT_MCsel8_HePrim"), mcParticle.pt()); + spectraGen.fill(HIST("LfEv/helium/pT_MCsel8_HePrim"), pt); } - if (mcParticle.pdgCode() == -PDGHelium) { - spectraGen.fill(HIST("LfEv/helium/pT_MCsel8_antiHe"), mcParticle.pt()); + if (pdg == -PDGHelium) { + spectraGen.fill(HIST("LfEv/helium/pT_MCsel8_antiHe"), pt); if (isPhysPrim) - spectraGen.fill(HIST("LfEv/helium/pT_MCsel8_antiHePrim"), mcParticle.pt()); + spectraGen.fill(HIST("LfEv/helium/pT_MCsel8_antiHePrim"), pt); } } - } - if (collision.sel8()) { - for (const auto& mcParticle : particlesInCollision) { - if (mcParticle.y() > kinemOptions.cfgRapidityCutHigh || mcParticle.y() < kinemOptions.cfgRapidityCutLow) { - continue; - } - - spectraGen.fill(HIST("LfEv/pT_sel8"), mcParticle.pt()); - if (mcParticle.pdgCode() == PDGHelium) { - spectraGen.fill(HIST("LfEv/helium/pT_sel8_He"), mcParticle.pt()); - } - if (mcParticle.pdgCode() == -PDGHelium) { - spectraGen.fill(HIST("LfEv/helium/pT_sel8_antiHe"), mcParticle.pt()); - } + // Sel8 tag + if (hasSel8) { + spectraGen.fill(HIST("LfEv/pT_sel8"), pt); + if (pdg == PDGHelium) + spectraGen.fill(HIST("LfEv/helium/pT_sel8_He"), pt); + if (pdg == -PDGHelium) + spectraGen.fill(HIST("LfEv/helium/pT_sel8_antiHe"), pt); } } } } - // CLOSING PROCESS MC RECO PROCESS_SWITCH(LFNucleiBATask, processMCRecoLfPidEv, "process mc reco with LfPid w/ Event", false); @@ -6113,174 +6078,184 @@ struct LFNucleiBATask { void processMCGen(soa::Join::iterator const& mcCollision, aod::McParticles const& mcParticles) { + // Only events that are reconstructed + if (enableEffEvtSet) { + if (!effEvtSetReady) + return; + if (!effEvtSet.count(mcCollision.globalIndex())) + return; + } + spectraGen.fill(HIST("histGenVetxZ"), mcCollision.posZ()); if (mcCollision.centFT0M() < cfgMultCutLow || mcCollision.centFT0M() > cfgMultCutHigh) return; - for (auto const& mcParticleGen : mcParticles) { // NOLINT - if (mcParticleGen.y() > kinemOptions.cfgRapidityCutHigh || mcParticleGen.y() < kinemOptions.cfgRapidityCutLow) { + + for (auto const& mcParticleGen : mcParticles) { + if (mcParticleGen.y() > kinemOptions.cfgRapidityCutHigh || mcParticleGen.y() < kinemOptions.cfgRapidityCutLow) continue; - } bool isPhysPrim = mcParticleGen.isPhysicalPrimary(); bool isProdByGen = mcParticleGen.producedByGenerator(); bool isWeakDecay = (mcParticleGen.getProcess() == TMCProcess::kPDecay); - if (mcParticleGen.pdgCode() == PDGPion) { - spectraGen.fill(HIST("pion/histGenPtPion"), mcParticleGen.pt()); + const int pdgCode = mcParticleGen.pdgCode(); + const float ptMC = mcParticleGen.pt(); + + if (pdgCode == PDGPion) { + spectraGen.fill(HIST("pion/histGenPtPion"), ptMC); if (isPhysPrim) - spectraGen.fill(HIST("pion/histGenPtPionPrim"), mcParticleGen.pt()); + spectraGen.fill(HIST("pion/histGenPtPionPrim"), ptMC); if (!isPhysPrim && isProdByGen) { // } if (!isPhysPrim && !isProdByGen) { - spectraGen.fill(HIST("pion/histSecTransportPtPion"), mcParticleGen.pt()); + spectraGen.fill(HIST("pion/histSecTransportPtPion"), ptMC); if (isWeakDecay) { - spectraGen.fill(HIST("pion/histGenPtPionSec"), mcParticleGen.pt()); + spectraGen.fill(HIST("pion/histGenPtPionSec"), ptMC); } } } - if (mcParticleGen.pdgCode() == -PDGPion) { - spectraGen.fill(HIST("pion/histGenPtantiPion"), mcParticleGen.pt()); + if (pdgCode == -PDGPion) { + spectraGen.fill(HIST("pion/histGenPtantiPion"), ptMC); if (isPhysPrim) - spectraGen.fill(HIST("pion/histGenPtantiPionPrim"), mcParticleGen.pt()); + spectraGen.fill(HIST("pion/histGenPtantiPionPrim"), ptMC); if (!isPhysPrim && isProdByGen) { // } if (!isPhysPrim && !isProdByGen) { - spectraGen.fill(HIST("pion/histSecTransportPtantiPion"), mcParticleGen.pt()); + spectraGen.fill(HIST("pion/histSecTransportPtantiPion"), ptMC); if (isWeakDecay) { - spectraGen.fill(HIST("pion/histGenPtantiPionSec"), mcParticleGen.pt()); + spectraGen.fill(HIST("pion/histGenPtantiPionSec"), ptMC); } } } - if (mcParticleGen.pdgCode() == PDGKaon) { - spectraGen.fill(HIST("kaon/histGenPtKaon"), mcParticleGen.pt()); + if (pdgCode == PDGKaon) { + spectraGen.fill(HIST("kaon/histGenPtKaon"), ptMC); if (isPhysPrim) - spectraGen.fill(HIST("kaon/histGenPtKaonPrim"), mcParticleGen.pt()); + spectraGen.fill(HIST("kaon/histGenPtKaonPrim"), ptMC); if (!isPhysPrim && isProdByGen) { // } if (!isPhysPrim && !isProdByGen) { - spectraGen.fill(HIST("kaon/histSecTransportPtKaon"), mcParticleGen.pt()); + spectraGen.fill(HIST("kaon/histSecTransportPtKaon"), ptMC); if (isWeakDecay) { - spectraGen.fill(HIST("kaon/histGenPtKaonSec"), mcParticleGen.pt()); + spectraGen.fill(HIST("kaon/histGenPtKaonSec"), ptMC); } } } - if (mcParticleGen.pdgCode() == -PDGKaon) { - spectraGen.fill(HIST("kaon/histGenPtantiKaon"), mcParticleGen.pt()); + if (pdgCode == -PDGKaon) { + spectraGen.fill(HIST("kaon/histGenPtantiKaon"), ptMC); if (isPhysPrim) - spectraGen.fill(HIST("kaon/histGenPtantiKaonPrim"), mcParticleGen.pt()); + spectraGen.fill(HIST("kaon/histGenPtantiKaonPrim"), ptMC); if (!isPhysPrim && isProdByGen) { // } if (!isPhysPrim && !isProdByGen) { - spectraGen.fill(HIST("kaon/histSecTransportPtantiKaon"), mcParticleGen.pt()); + spectraGen.fill(HIST("kaon/histSecTransportPtantiKaon"), ptMC); if (isWeakDecay) { - spectraGen.fill(HIST("kaon/histGenPtantiKaonSec"), mcParticleGen.pt()); + spectraGen.fill(HIST("kaon/histGenPtantiKaonSec"), ptMC); } } } if (enablePr) { - if (mcParticleGen.pdgCode() == PDGProton) { - spectraGen.fill(HIST("proton/histGenPtProton"), mcParticleGen.pt()); + if (pdgCode == PDGProton) { + spectraGen.fill(HIST("proton/histGenPtProton"), ptMC); if (isPhysPrim) { - spectraGen.fill(HIST("proton/histGenPtProtonPrim"), mcParticleGen.pt()); - spectraGen.fill(HIST("proton/histGenPtProtonPrim_Y"), mcParticleGen.y(), mcParticleGen.pt()); + spectraGen.fill(HIST("proton/histGenPtProtonPrim"), ptMC); + spectraGen.fill(HIST("proton/histGenPtProtonPrim_Y"), mcParticleGen.y(), ptMC); } if (!isPhysPrim && isProdByGen) { // } if (!isPhysPrim && !isProdByGen) { - spectraGen.fill(HIST("proton/histSecTransportPtProton"), mcParticleGen.pt()); + spectraGen.fill(HIST("proton/histSecTransportPtProton"), ptMC); if (isWeakDecay) { - spectraGen.fill(HIST("proton/histGenPtProtonSec"), mcParticleGen.pt()); + spectraGen.fill(HIST("proton/histGenPtProtonSec"), ptMC); } } } - if (mcParticleGen.pdgCode() == -PDGProton) { - spectraGen.fill(HIST("proton/histGenPtantiProton"), mcParticleGen.pt()); + if (pdgCode == -PDGProton) { + spectraGen.fill(HIST("proton/histGenPtantiProton"), ptMC); if (isPhysPrim) { - spectraGen.fill(HIST("proton/histGenPtantiProtonPrim"), mcParticleGen.pt()); - spectraGen.fill(HIST("proton/histGenPtantiProtonPrim_Y"), mcParticleGen.y(), mcParticleGen.pt()); + spectraGen.fill(HIST("proton/histGenPtantiProtonPrim"), ptMC); + spectraGen.fill(HIST("proton/histGenPtantiProtonPrim_Y"), mcParticleGen.y(), ptMC); } if (!isPhysPrim && isProdByGen) { // } if (!isPhysPrim && !isProdByGen) { - spectraGen.fill(HIST("proton/histSecTransportPtantiProton"), mcParticleGen.pt()); + spectraGen.fill(HIST("proton/histSecTransportPtantiProton"), ptMC); if (isWeakDecay) { - spectraGen.fill(HIST("proton/histGenPtantiProtonSec"), mcParticleGen.pt()); + spectraGen.fill(HIST("proton/histGenPtantiProtonSec"), ptMC); } } } } if (enableDe) { - if (mcParticleGen.pdgCode() == PDGDeuteron) { - spectraGen.fill(HIST("deuteron/histGenPtD"), mcParticleGen.pt()); + if (pdgCode == PDGDeuteron) { + spectraGen.fill(HIST("deuteron/histGenPtD"), ptMC); if (isPhysPrim) - spectraGen.fill(HIST("deuteron/histGenPtDPrim"), mcParticleGen.pt()); + spectraGen.fill(HIST("deuteron/histGenPtDPrim"), ptMC); if (!isPhysPrim && isProdByGen) { // } if (!isPhysPrim && !isProdByGen) { - spectraGen.fill(HIST("deuteron/histSecTransportPtD"), mcParticleGen.pt()); + spectraGen.fill(HIST("deuteron/histSecTransportPtD"), ptMC); if (isWeakDecay) { - spectraGen.fill(HIST("deuteron/histGenPtDSec"), mcParticleGen.pt()); + spectraGen.fill(HIST("deuteron/histGenPtDSec"), ptMC); } } } - if (mcParticleGen.pdgCode() == -PDGDeuteron) { - spectraGen.fill(HIST("deuteron/histGenPtantiD"), mcParticleGen.pt()); + if (pdgCode == -PDGDeuteron) { + spectraGen.fill(HIST("deuteron/histGenPtantiD"), ptMC); if (isPhysPrim) - spectraGen.fill(HIST("deuteron/histGenPtantiDPrim"), mcParticleGen.pt()); + spectraGen.fill(HIST("deuteron/histGenPtantiDPrim"), ptMC); if (!isPhysPrim && isProdByGen) { // } if (!isPhysPrim && !isProdByGen) { - spectraGen.fill(HIST("deuteron/histSecTransportPtantiD"), mcParticleGen.pt()); + spectraGen.fill(HIST("deuteron/histSecTransportPtantiD"), ptMC); if (isWeakDecay) { - spectraGen.fill(HIST("deuteron/histGenPtantiDSec"), mcParticleGen.pt()); + spectraGen.fill(HIST("deuteron/histGenPtantiDSec"), ptMC); } } } } if (enableTr) { - if (mcParticleGen.pdgCode() == PDGTriton) { - spectraGen.fill(HIST("triton/histGenPtT"), mcParticleGen.pt()); + if (pdgCode == PDGTriton) { + spectraGen.fill(HIST("triton/histGenPtT"), ptMC); if (isPhysPrim) - spectraGen.fill(HIST("triton/histGenPtTPrim"), mcParticleGen.pt()); + spectraGen.fill(HIST("triton/histGenPtTPrim"), ptMC); if (!isPhysPrim && isProdByGen) { // } if (!isPhysPrim && !isProdByGen) { - spectraGen.fill(HIST("triton/histSecTransportPtT"), mcParticleGen.pt()); + spectraGen.fill(HIST("triton/histSecTransportPtT"), ptMC); if (isWeakDecay) { - spectraGen.fill(HIST("triton/histGenPtTSec"), mcParticleGen.pt()); + spectraGen.fill(HIST("triton/histGenPtTSec"), ptMC); } } } - if (mcParticleGen.pdgCode() == -PDGTriton) { - spectraGen.fill(HIST("triton/histGenPtantiT"), mcParticleGen.pt()); + if (pdgCode == -PDGTriton) { + spectraGen.fill(HIST("triton/histGenPtantiT"), ptMC); if (isPhysPrim) - spectraGen.fill(HIST("triton/histGenPtantiTPrim"), mcParticleGen.pt()); + spectraGen.fill(HIST("triton/histGenPtantiTPrim"), ptMC); if (!isPhysPrim && isProdByGen) { // } if (!isPhysPrim && !isProdByGen) { - spectraGen.fill(HIST("triton/histSecTransportPtantiT"), mcParticleGen.pt()); + spectraGen.fill(HIST("triton/histSecTransportPtantiT"), ptMC); if (isWeakDecay) { - spectraGen.fill(HIST("triton/histGenPtantiTSec"), mcParticleGen.pt()); + spectraGen.fill(HIST("triton/histGenPtantiTSec"), ptMC); } } } } if (enableHe) { - if (mcParticleGen.pdgCode() == PDGHelium) { - spectraGen.fill(HIST("helium/histGenPtHe"), mcParticleGen.pt()); + if (pdgCode == PDGHelium) { + spectraGen.fill(HIST("helium/histGenPtHe"), ptMC); if (isPhysPrim) { - // LOG(info) << "I AM POSITIVE HELIUM and PRIMARY, get process output is: " << mcParticleGen.getProcess(); - spectraGen.fill(HIST("helium/histGenPtHePrim"), mcParticleGen.pt()); + spectraGen.fill(HIST("helium/histGenPtHePrim"), ptMC); } if (!isPhysPrim && isProdByGen) { { @@ -6288,18 +6263,16 @@ struct LFNucleiBATask { } } if (!isPhysPrim && !isProdByGen) { - spectraGen.fill(HIST("helium/histSecTransportPtHe"), mcParticleGen.pt()); - // LOG(info) << "I AM POSITIVE HELIUM and SECONDARY, get process output is: " << mcParticleGen.getProcess(); + spectraGen.fill(HIST("helium/histSecTransportPtHe"), ptMC); if (isWeakDecay) { - spectraGen.fill(HIST("helium/histGenPtHeSec"), mcParticleGen.pt()); - // LOG(info) << "I AM POSITIVE HELIUM and SECONDARY FROM MATERIAL, get process output is: " << mcParticleGen.getProcess(); + spectraGen.fill(HIST("helium/histGenPtHeSec"), ptMC); } } } - if (mcParticleGen.pdgCode() == -PDGHelium) { - spectraGen.fill(HIST("helium/histGenPtantiHe"), mcParticleGen.pt()); + if (pdgCode == -PDGHelium) { + spectraGen.fill(HIST("helium/histGenPtantiHe"), ptMC); if (isPhysPrim) { - spectraGen.fill(HIST("helium/histGenPtantiHePrim"), mcParticleGen.pt()); + spectraGen.fill(HIST("helium/histGenPtantiHePrim"), ptMC); } if (!isPhysPrim && isProdByGen) { { @@ -6307,39 +6280,39 @@ struct LFNucleiBATask { } } if (!isPhysPrim && !isProdByGen) { - spectraGen.fill(HIST("helium/histSecTransportPtantiHe"), mcParticleGen.pt()); + spectraGen.fill(HIST("helium/histSecTransportPtantiHe"), ptMC); if (isWeakDecay) { - spectraGen.fill(HIST("helium/histGenPtantiHeSec"), mcParticleGen.pt()); + spectraGen.fill(HIST("helium/histGenPtantiHeSec"), ptMC); } } } } if (enableAl) { - if (mcParticleGen.pdgCode() == PDGAlpha) { - spectraGen.fill(HIST("alpha/histGenPtAl"), mcParticleGen.pt()); + if (pdgCode == PDGAlpha) { + spectraGen.fill(HIST("alpha/histGenPtAl"), ptMC); if (isPhysPrim) - spectraGen.fill(HIST("alpha/histGenPtAlPrim"), mcParticleGen.pt()); + spectraGen.fill(HIST("alpha/histGenPtAlPrim"), ptMC); if (!isPhysPrim && isProdByGen) { // } if (!isPhysPrim && !isProdByGen) { - spectraGen.fill(HIST("alpha/histSecTransportPtAl"), mcParticleGen.pt()); + spectraGen.fill(HIST("alpha/histSecTransportPtAl"), ptMC); if (isWeakDecay) { - spectraGen.fill(HIST("alpha/histGenPtAlSec"), mcParticleGen.pt()); + spectraGen.fill(HIST("alpha/histGenPtAlSec"), ptMC); } } } - if (mcParticleGen.pdgCode() == -PDGAlpha) { - spectraGen.fill(HIST("alpha/histGenPtantiAl"), mcParticleGen.pt()); + if (pdgCode == -PDGAlpha) { + spectraGen.fill(HIST("alpha/histGenPtantiAl"), ptMC); if (isPhysPrim) - spectraGen.fill(HIST("alpha/histGenPtantiAlPrim"), mcParticleGen.pt()); + spectraGen.fill(HIST("alpha/histGenPtantiAlPrim"), ptMC); if (!isPhysPrim && isProdByGen) { // } if (!isPhysPrim && !isProdByGen) { - spectraGen.fill(HIST("alpha/histSecTransportPtantiAl"), mcParticleGen.pt()); + spectraGen.fill(HIST("alpha/histSecTransportPtantiAl"), ptMC); if (isWeakDecay) { - spectraGen.fill(HIST("alpha/histGenPtantiAlSec"), mcParticleGen.pt()); + spectraGen.fill(HIST("alpha/histGenPtantiAlSec"), ptMC); } } } @@ -6347,13 +6320,13 @@ struct LFNucleiBATask { } } // Close processMCGen PROCESS_SWITCH(LFNucleiBATask, processMCGen, "process MC Generated", true); + void processEvSgLossMC(soa::Join::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& recoColls) { - if (std::abs(mcCollision.posZ()) < cfgVzCutHigh) { + if (std::abs(mcCollision.posZ()) < cfgVzCutHigh) evLossHistos.fill(HIST("evLoss/hEvent"), 0.5); - } bool isSel8Event = false; bool isTvxEvent = false; @@ -6362,20 +6335,18 @@ struct LFNucleiBATask { for (const auto& recoColl : recoColls) { if (std::abs(recoColl.posZ()) > cfgVzCutHigh) continue; - if (recoColl.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { + if (recoColl.selection_bit(o2::aod::evsel::kIsTriggerTVX)) isTvxEvent = true; - } - if (recoColl.sel8()) { + if (recoColl.sel8()) isSel8Event = true; - } + if (isTvxEvent && isSel8Event) + break; // Optimize loop } - if (isTvxEvent) { + if (isTvxEvent) evLossHistos.fill(HIST("evLoss/hEvent"), 1.5); - } - if (isSel8Event) { + if (isSel8Event) evLossHistos.fill(HIST("evLoss/hEvent"), 2.5); - } // Loop over all the Generated level particles for (const auto& mcPart : mcParticles) { @@ -6383,27 +6354,27 @@ struct LFNucleiBATask { continue; if (std::abs(mcPart.y()) >= kCfgTpcClasses[0]) continue; - if (mcPart.pdgCode() == PDGDeuteron) { - evLossHistos.fill(HIST("evLoss/pt/hDeuteronGen"), mcPart.pt()); - if (isTvxEvent) { - evLossHistos.fill(HIST("evLoss/pt/hDeuteronTriggeredTVX"), mcPart.pt()); - } - if (isSel8Event) { - evLossHistos.fill(HIST("evLoss/pt/hDeuteronTriggeredSel8"), mcPart.pt()); - } + + const float pt = mcPart.pt(); + const int pdg = mcPart.pdgCode(); + + if (pdg == PDGDeuteron) { + evLossHistos.fill(HIST("evLoss/pt/hDeuteronGen"), pt); + if (isTvxEvent) + evLossHistos.fill(HIST("evLoss/pt/hDeuteronTriggeredTVX"), pt); + if (isSel8Event) + evLossHistos.fill(HIST("evLoss/pt/hDeuteronTriggeredSel8"), pt); } - if (mcPart.pdgCode() == -PDGDeuteron) { - evLossHistos.fill(HIST("evLoss/pt/hAntiDeuteronGen"), mcPart.pt()); - if (isTvxEvent) { - evLossHistos.fill(HIST("evLoss/pt/hAntiDeuteronTriggeredTVX"), mcPart.pt()); - } - if (isSel8Event) { - evLossHistos.fill(HIST("evLoss/pt/hAntiDeuteronTriggeredSel8"), mcPart.pt()); - } + if (pdg == -PDGDeuteron) { + evLossHistos.fill(HIST("evLoss/pt/hAntiDeuteronGen"), pt); + if (isTvxEvent) + evLossHistos.fill(HIST("evLoss/pt/hAntiDeuteronTriggeredTVX"), pt); + if (isSel8Event) + evLossHistos.fill(HIST("evLoss/pt/hAntiDeuteronTriggeredSel8"), pt); } - } // MC particles + } } - PROCESS_SWITCH(LFNucleiBATask, processEvSgLossMC, "process MC Sig Event", false); + PROCESS_SWITCH(LFNucleiBATask, processEvSgLossMC, "process MC SignLoss", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From f8fb960545298803bed180f3a3828f5188c8a20b Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sat, 27 Sep 2025 18:47:55 +0200 Subject: [PATCH 556/986] [PWGEM/Dilepton] update createResolutionMap.cxx (#13157) --- PWGEM/Dilepton/Tasks/createResolutionMap.cxx | 95 +++++++++++--------- 1 file changed, 55 insertions(+), 40 deletions(-) diff --git a/PWGEM/Dilepton/Tasks/createResolutionMap.cxx b/PWGEM/Dilepton/Tasks/createResolutionMap.cxx index e77aefc7ae9..49b3b521640 100644 --- a/PWGEM/Dilepton/Tasks/createResolutionMap.cxx +++ b/PWGEM/Dilepton/Tasks/createResolutionMap.cxx @@ -71,7 +71,6 @@ struct CreateResolutionMap { Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; Configurable cfg_require_true_mc_collision_association{"cfg_require_true_mc_collision_association", false, "flag to require true mc collision association"}; Configurable cfg_reject_fake_match_its_tpc{"cfg_reject_fake_match_its_tpc", false, "flag to reject fake match between ITS-TPC"}; - // Configurable cfg_reject_fake_match_its_tpc_tof{"cfg_reject_fake_match_its_tpc_tof", false, "flag to reject fake match between ITS-TPC-TOF"}; Configurable cfg_reject_fake_match_mft_mch{"cfg_reject_fake_match_mft_mch", false, "flag to reject fake match between MFT-MCH"}; ConfigurableAxis ConfPtGenBins{"ConfPtGenBins", {VARIABLE_WIDTH, 0.00, 0.05, 0.06, 0.07, 0.08, 0.09, 0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.50, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.70, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.80, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.10, 2.20, 2.30, 2.40, 2.50, 2.60, 2.70, 2.80, 2.90, 3.00, 3.10, 3.20, 3.30, 3.40, 3.50, 3.60, 3.70, 3.80, 3.90, 4.00, 4.10, 4.20, 4.30, 4.40, 4.50, 4.60, 4.70, 4.80, 4.90, 5.00, 5.50, 6.00, 6.50, 7.00, 7.50, 8.00, 8.50, 9.00, 9.50, 10.00, 11.00, 12.00, 13.00, 14.00, 15.00, 16.00, 17.00, 18.00, 19.00, 20.00}, "gen. pT bins for output histograms"}; @@ -79,7 +78,10 @@ struct CreateResolutionMap { ConfigurableAxis ConfEtaCBGenBins{"ConfEtaCBGenBins", {30, -1.5, +1.5}, "gen. eta bins at midrapidity for output histograms"}; ConfigurableAxis ConfEtaFWDGenBins{"ConfEtaFWDGenBins", {40, -5.5, -1.5}, "gen. eta bins at forward rapidity for output histograms"}; - ConfigurableAxis ConfPhiGenBins{"ConfPhiGenBins", {72, 0, 2.f * M_PI}, "gen. eta bins at forward rapidity for output histograms"}; + ConfigurableAxis ConfPhiGenBins{"ConfPhiGenBins", {72, 0, 2.f * M_PI}, "gen. phi bins at forward rapidity for output histograms"}; + ConfigurableAxis ConfPhiPositionCBGenBins{"ConfPhiPositionCBGenBins", {VARIABLE_WIDTH, 2.3 - M_PI, 0.85, 2.3, 0.85 + M_PI, 2.3 + M_PI}, "gen. phi psotion bins at forward rapidity for output histograms"}; // default is adjusted at R = 0.50 m + ConfigurableAxis ConfPhiPositionFWDGenBins{"ConfPhiPositionFWDGenBins", {1, 0, 2 * M_PI}, "gen. phi psotion bins at forward rapidity for output histograms"}; + Configurable cfgRefR{"cfgRefR", 0.50, "ref. radius (m) for calculating phi position"}; // 0.50 +/- 0.06 can be syst. unc. ConfigurableAxis ConfRelDeltaPtBins{"ConfRelDeltaPtBins", {200, -1.f, +1.f}, "rel. dpt for output histograms"}; ConfigurableAxis ConfDeltaEtaCBBins{"ConfDeltaEtaCBBins", {200, -0.5f, +0.5f}, "deta bins for output histograms"}; @@ -184,6 +186,13 @@ struct CreateResolutionMap { o2::dataformats::VertexBase mVtx; const o2::dataformats::MeanVertexObject* mMeanVtx = nullptr; o2::base::MatLayerCylSet* lut = nullptr; + std::vector phiPosition_bin_edges; + + ~CreateResolutionMap() + { + phiPosition_bin_edges.clear(); + phiPosition_bin_edges.shrink_to_fit(); + } void init(o2::framework::InitContext&) { @@ -207,6 +216,23 @@ struct CreateResolutionMap { mRunNumber = 0; d_bz = 0; + if (ConfPhiPositionCBGenBins.value[0] == VARIABLE_WIDTH) { + phiPosition_bin_edges = std::vector(ConfPhiPositionCBGenBins.value.begin(), ConfPhiPositionCBGenBins.value.end()); + phiPosition_bin_edges.erase(phiPosition_bin_edges.begin()); + // for (const auto& edge : phiPosition_bin_edges) { + // LOGF(info, "VARIABLE_WIDTH: phiPosition_bin_edges = %f", edge); + // } + } else { // FIXED bin width + int nbins = static_cast(ConfPhiPositionCBGenBins.value[0]); + float xmin = static_cast(ConfPhiPositionCBGenBins.value[1]); + float xmax = static_cast(ConfPhiPositionCBGenBins.value[2]); + phiPosition_bin_edges.resize(nbins + 1); + for (int i = 0; i < nbins + 1; i++) { + phiPosition_bin_edges[i] = (xmax - xmin) / (nbins)*i + xmin; + // LOGF(info, "FIXED_WIDTH: phiPosition_bin_edges[%d] = %f", i, phiPosition_bin_edges[i]); + } + } + const AxisSpec axis_cent{ConfCentBins, "centrality (%)"}; const AxisSpec axis_pt_gen{ConfPtGenBins, "p_{T,l}^{gen} (GeV/c)"}; const AxisSpec axis_eta_cb_gen{ConfEtaCBGenBins, "#eta_{l}^{gen}"}; @@ -217,6 +243,8 @@ struct CreateResolutionMap { const AxisSpec axis_deta_fwd{ConfDeltaEtaFWDBins, "#eta_{l}^{gen} - #eta_{l}^{rec}"}; const AxisSpec axis_dphi{ConfDeltaPhiBins, "#varphi_{l}^{gen} - #varphi_{l}^{rec} (rad.)"}; const AxisSpec axis_charge_gen{3, -1.5, +1.5, "true sign"}; + const AxisSpec axis_phiPositionCB_gen{ConfPhiPositionCBGenBins, Form("#varphi^{*, gen} (rad.) at r_{xy} = %3.2f m", cfgRefR.value)}; + const AxisSpec axis_phiPositionFWD_gen{ConfPhiPositionFWDGenBins, "#varphi^{*, gen} (rad.)"}; // registry.add("Event/Electron/hImpPar_Centrality", "true imapact parameter vs. estimated centrality;impact parameter (fm);centrality (%)", kTH2F, {{200, 0, 20}, {110, 0, 110}}, true); // registry.add("Event/Electron/hImpPar_Centrality", "true imapact parameter vs. estimated centrality;impact parameter (fm);centrality (%)", kTH2F, {{200, 0, 20}, {110, 0, 110}}, true); @@ -241,9 +269,9 @@ struct CreateResolutionMap { } if (cfgFillTHnSparse) { - registry.add("Electron/hs_reso", "8D resolution", kTHnSparseF, {axis_cent, axis_pt_gen, axis_eta_cb_gen, axis_phi_gen, axis_charge_gen, axis_dpt, axis_deta_cb, axis_dphi}, true); - registry.add("StandaloneMuon/hs_reso", "8D resolution", kTHnSparseF, {axis_cent, axis_pt_gen, axis_eta_fwd_gen, axis_phi_gen, axis_charge_gen, axis_dpt, axis_deta_fwd, axis_dphi}, true); - registry.add("GlobalMuon/hs_reso", "8D resolution", kTHnSparseF, {axis_cent, axis_pt_gen, axis_eta_fwd_gen, axis_phi_gen, axis_charge_gen, axis_dpt, axis_deta_fwd, axis_dphi}, true); + registry.add("Electron/hs_reso", "9D resolution", kTHnSparseF, {axis_cent, axis_pt_gen, axis_eta_cb_gen, axis_phi_gen, axis_phiPositionCB_gen, axis_charge_gen, axis_dpt, axis_deta_cb, axis_dphi}, true); + registry.add("StandaloneMuon/hs_reso", "9D resolution", kTHnSparseF, {axis_cent, axis_pt_gen, axis_eta_fwd_gen, axis_phi_gen, axis_phiPositionFWD_gen, axis_charge_gen, axis_dpt, axis_deta_fwd, axis_dphi}, true); + registry.add("GlobalMuon/hs_reso", "9D resolution", kTHnSparseF, {axis_cent, axis_pt_gen, axis_eta_fwd_gen, axis_phi_gen, axis_phiPositionFWD_gen, axis_charge_gen, axis_dpt, axis_deta_fwd, axis_dphi}, true); } } @@ -474,19 +502,17 @@ struct CreateResolutionMap { return false; } - if (track.hasITS() && !track.hasTPC() && !track.hasTOF() && !track.hasTRD()) { // only for ITSsa - int total_cluster_size = 0, nl = 0; - for (unsigned int layer = 0; layer < 7; layer++) { - int cluster_size_per_layer = track.itsClsSizeInLayer(layer); - if (cluster_size_per_layer > 0) { - nl++; - } - total_cluster_size += cluster_size_per_layer; + int total_cluster_size = 0, nl = 0; + for (unsigned int layer = 0; layer < 7; layer++) { + int cluster_size_per_layer = track.itsClsSizeInLayer(layer); + if (cluster_size_per_layer > 0) { + nl++; } + total_cluster_size += cluster_size_per_layer; + } - if (electroncuts.maxMeanITSClusterSize < static_cast(total_cluster_size) / static_cast(nl) * std::cos(std::atan(tgl))) { - return false; - } + if (electroncuts.maxMeanITSClusterSize < static_cast(total_cluster_size) / static_cast(nl) * std::cos(std::atan(tgl))) { + return false; } return true; @@ -609,7 +635,7 @@ struct CreateResolutionMap { return; } if (cfgFillTHnSparse) { - registry.fill(HIST("StandaloneMuon/hs_reso"), centrality, mcparticle.pt(), mcparticle.eta(), mcparticle.phi(), -mcparticle.pdgCode() / 13, (mcparticle.pt() - pt) / mcparticle.pt(), mcparticle.eta() - eta, mcparticle.phi() - phi); + registry.fill(HIST("StandaloneMuon/hs_reso"), centrality, mcparticle.pt(), mcparticle.eta(), mcparticle.phi(), 1.f, -mcparticle.pdgCode() / 13, (mcparticle.pt() - pt) / mcparticle.pt(), mcparticle.eta() - eta, mcparticle.phi() - phi); } if (cfgFillTH2) { @@ -628,7 +654,7 @@ struct CreateResolutionMap { return; } if (cfgFillTHnSparse) { - registry.fill(HIST("GlobalMuon/hs_reso"), centrality, mcparticle.pt(), mcparticle.eta(), mcparticle.phi(), -mcparticle.pdgCode() / 13, (mcparticle.pt() - pt) / mcparticle.pt(), mcparticle.eta() - eta, mcparticle.phi() - phi); + registry.fill(HIST("GlobalMuon/hs_reso"), centrality, mcparticle.pt(), mcparticle.eta(), mcparticle.phi(), 1.f, -mcparticle.pdgCode() / 13, (mcparticle.pt() - pt) / mcparticle.pt(), mcparticle.eta() - eta, mcparticle.phi() - phi); } if (cfgFillTH2) { registry.fill(HIST("GlobalMuon/hPt"), pt); @@ -699,7 +725,7 @@ struct CreateResolutionMap { } SliceCache cache; - Preslice perCollision_mid = o2::aod::track::collisionId; + Preslice perCollision_mid = o2::aod::track::collisionId; Preslice perCollision_fwd = o2::aod::fwdtrack::collisionId; using MyCollisions = Join; @@ -720,7 +746,7 @@ struct CreateResolutionMap { if (cfgRequireGoodRCT && !rctCheckerCB.checkTable(collision)) { return; } - auto mcparticle = track.template mcParticle_as(); + const auto& mcparticle = track.template mcParticle_as(); if (std::abs(mcparticle.pdgCode()) != 11 || !(mcparticle.isPhysicalPrimary() || mcparticle.producedByGenerator())) { return; @@ -751,12 +777,15 @@ struct CreateResolutionMap { float phi = trackParCov.getPhi(); o2::math_utils::bringTo02Pi(phi); + float phiPosition = mcparticle.phi() + std::asin(-0.30282 * (-mcparticle.pdgCode() / 11) * (d_bz * 0.1) * cfgRefR / (2.f * mcparticle.pt())); + phiPosition = RecoDecay::constrainAngle(phiPosition, phiPosition_bin_edges[0], 1U); + if (!isSelectedTrackWithKine(track, pt, eta, trackParCov.getTgl(), dcaXY, dcaZ)) { return; } if (cfgFillTHnSparse) { - registry.fill(HIST("Electron/hs_reso"), centrality, mcparticle.pt(), mcparticle.eta(), mcparticle.phi(), -mcparticle.pdgCode() / 11, (mcparticle.pt() - pt) / mcparticle.pt(), mcparticle.eta() - eta, mcparticle.phi() - phi); + registry.fill(HIST("Electron/hs_reso"), centrality, mcparticle.pt(), mcparticle.eta(), mcparticle.phi(), phiPosition, -mcparticle.pdgCode() / 11, (mcparticle.pt() - pt) / mcparticle.pt(), mcparticle.eta() - eta, mcparticle.phi() - phi); } if (cfgFillTH2) { registry.fill(HIST("Electron/hPt"), pt); @@ -843,10 +872,10 @@ struct CreateResolutionMap { } PROCESS_SWITCH(CreateResolutionMap, processElectronTTCA, "create resolution map for electron at midrapidity", false); - Partition sa_muons = o2::aod::fwdtrack::trackType == uint8_t(o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack); // MCH-MID - Partition global_muons = o2::aod::fwdtrack::trackType == uint8_t(o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack); // MFT-MCH-MID + // Partition sa_muons = o2::aod::fwdtrack::trackType == uint8_t(o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack); // MCH-MID + // Partition global_muons = o2::aod::fwdtrack::trackType == uint8_t(o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack); // MFT-MCH-MID - void processMuonSA(MyCollisions const& collisions, aod::BCsWithTimestamps const&, MyFwdTracks const&, MyMFTTracks const&, aod::McCollisions const&, aod::McParticles const&) + void processMuonSA(MyCollisions const& collisions, aod::BCsWithTimestamps const&, MyFwdTracks const& fwdtracks, MyMFTTracks const&, aod::McCollisions const&, aod::McParticles const&) { for (const auto& collision : collisions) { auto bc = collision.template foundBC_as(); @@ -864,10 +893,8 @@ struct CreateResolutionMap { // auto mccollision = collision.template mcCollision_as(); // registry.fill(HIST("Event/Muon/hImpPar_Centrality"), mccollision.impactParameter(), centrality); - auto sa_muons_per_coll = sa_muons->sliceByCached(o2::aod::fwdtrack::collisionId, collision.globalIndex(), cache); - auto global_muons_per_coll = global_muons->sliceByCached(o2::aod::fwdtrack::collisionId, collision.globalIndex(), cache); - - for (const auto& muon : sa_muons_per_coll) { + const auto& fwdtracks_per_coll = fwdtracks.sliceBy(perCollision_fwd, collision.globalIndex()); + for (const auto& muon : fwdtracks_per_coll) { if (!muon.has_mcParticle()) { continue; } @@ -880,18 +907,6 @@ struct CreateResolutionMap { fillMuon(collision, muon, centrality); } // end of standalone muon loop - for (const auto& muon : global_muons_per_coll) { - if (!muon.has_mcParticle()) { - continue; - } - auto mctrack = muon.template mcParticle_as(); - auto mccollision_from_mctrack = mctrack.template mcCollision_as(); - if (cfgEventGeneratorType >= 0 && mccollision_from_mctrack.getSubGeneratorId() != cfgEventGeneratorType) { - continue; - } - fillMuon(collision, muon, centrality); - } // end of global muon loop - } // end of collision loop } PROCESS_SWITCH(CreateResolutionMap, processMuonSA, "create resolution map for muon at forward rapidity", true); From 43d64afcc740c5b3169ba442a3521300680c4a47 Mon Sep 17 00:00:00 2001 From: hfribert Date: Sat, 27 Sep 2025 20:49:27 +0200 Subject: [PATCH 557/986] [ALICE3] Implementation of tracker PID with ToT (#13113) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Henrik Fribert Co-authored-by: Henrik Fribert Co-authored-by: Nicolò Jacazio Co-authored-by: ALICE Action Bot --- ALICE3/Core/DelphesO2TrackSmearer.cxx | 13 +- ALICE3/Core/DelphesO2TrackSmearer.h | 7 +- ALICE3/DataModel/OTFPIDTrk.h | 48 +- ALICE3/TableProducer/OTF/onTheFlyTracker.cxx | 18 +- .../TableProducer/OTF/onTheFlyTrackerPid.cxx | 719 +++++++++++++++--- 5 files changed, 683 insertions(+), 122 deletions(-) diff --git a/ALICE3/Core/DelphesO2TrackSmearer.cxx b/ALICE3/Core/DelphesO2TrackSmearer.cxx index af72d0cf8b0..0002160a49b 100644 --- a/ALICE3/Core/DelphesO2TrackSmearer.cxx +++ b/ALICE3/Core/DelphesO2TrackSmearer.cxx @@ -105,7 +105,18 @@ bool TrackSmearer::loadTable(int pdg, const char* filename, bool forceReload) mLUTHeader[ipdg] = nullptr; return false; } - if (mLUTHeader[ipdg]->pdg != pdg) { + bool specialPdgCase = false; + switch (pdg) { // Handle special cases + case o2::constants::physics::kAlpha: // Special case: Allow Alpha particles to use He3 LUT + specialPdgCase = (mLUTHeader[ipdg]->pdg == o2::constants::physics::kHelium3); + if (specialPdgCase) + LOG(info) + << " --- Alpha particles (PDG " << pdg << ") will use He3 LUT data (PDG " << mLUTHeader[ipdg]->pdg << ")" << std::endl; + break; + default: + break; + } + if (mLUTHeader[ipdg]->pdg != pdg && !specialPdgCase) { LOG(info) << " --- LUT header PDG mismatch: expected/detected = " << pdg << "/" << mLUTHeader[ipdg]->pdg << std::endl; delete mLUTHeader[ipdg]; mLUTHeader[ipdg] = nullptr; diff --git a/ALICE3/Core/DelphesO2TrackSmearer.h b/ALICE3/Core/DelphesO2TrackSmearer.h index 2e2198bd68f..770b51e75a6 100644 --- a/ALICE3/Core/DelphesO2TrackSmearer.h +++ b/ALICE3/Core/DelphesO2TrackSmearer.h @@ -29,6 +29,7 @@ #include +#include #include #include #include @@ -214,6 +215,8 @@ class TrackSmearer return 6; // Triton case 1000020030: return 7; // Helium3 + case 1000020040: + return 8; // Alphas default: return 2; // Default: pion } @@ -238,6 +241,8 @@ class TrackSmearer return "triton"; case 1000020030: return "helium3"; + case 1000020040: + return "alpha"; default: return "pion"; // Default: pion } @@ -246,7 +251,7 @@ class TrackSmearer void setCcdbManager(o2::ccdb::BasicCCDBManager* mgr) { mCcdbManager = mgr; } //; protected: - static constexpr unsigned int nLUTs = 8; // Number of LUT available + static constexpr unsigned int nLUTs = 9; // Number of LUT available lutHeader_t* mLUTHeader[nLUTs] = {nullptr}; lutEntry_t***** mLUTEntry[nLUTs] = {nullptr}; bool mUseEfficiency = true; diff --git a/ALICE3/DataModel/OTFPIDTrk.h b/ALICE3/DataModel/OTFPIDTrk.h index b10923a892b..ce8a5d07a4f 100644 --- a/ALICE3/DataModel/OTFPIDTrk.h +++ b/ALICE3/DataModel/OTFPIDTrk.h @@ -11,7 +11,6 @@ /// /// \file OTFPIDTrk.h -/// \author Berkin Ulukutlu TUM /// \author Henrik Fribert TUM /// \author Nicolò Jacazio Università del Piemonte Orientale /// \since May 22, 2025 @@ -29,16 +28,18 @@ namespace o2::aod namespace upgrade::trk { -DECLARE_SOA_COLUMN(TimeOverThresholdBarrel, timeOverThresholdBarrel, float); //! Time over threshold for the barrel layers -DECLARE_SOA_COLUMN(ClusterSizeBarrel, clusterSizeBarrel, float); //! Cluster size for the barrel layers +DECLARE_SOA_COLUMN(TimeOverThresholdBarrel, timeOverThresholdBarrel, float); //! Time over threshold for the Barrel layers DECLARE_SOA_COLUMN(TimeOverThresholdForward, timeOverThresholdForward, float); //! Time over threshold for the Forward layers -DECLARE_SOA_COLUMN(ClusterSizeForward, clusterSizeForward, float); //! Cluster size for the barrel layers -DECLARE_SOA_COLUMN(NSigmaTrkEl, nSigmaEl, float); //! NSigma electron from the tracker layers -DECLARE_SOA_COLUMN(NSigmaTrkMu, nSigmaMu, float); //! NSigma muon from the tracker layers -DECLARE_SOA_COLUMN(NSigmaTrkPi, nSigmaPi, float); //! NSigma pion from the tracker layers -DECLARE_SOA_COLUMN(NSigmaTrkKa, nSigmaKa, float); //! NSigma kaon from the tracker layers -DECLARE_SOA_COLUMN(NSigmaTrkPr, nSigmaPr, float); //! NSigma proton from the tracker layers +DECLARE_SOA_COLUMN(NSigmaTrkEl, nSigmaTrkEl, float); //! NSigma electron from the tracker layers +DECLARE_SOA_COLUMN(NSigmaTrkMu, nSigmaTrkMu, float); //! NSigma muon from the tracker layers +DECLARE_SOA_COLUMN(NSigmaTrkPi, nSigmaTrkPi, float); //! NSigma pion from the tracker layers +DECLARE_SOA_COLUMN(NSigmaTrkKa, nSigmaTrkKa, float); //! NSigma kaon from the tracker layers +DECLARE_SOA_COLUMN(NSigmaTrkPr, nSigmaTrkPr, float); //! NSigma proton from the tracker layers +DECLARE_SOA_COLUMN(NSigmaTrkDe, nSigmaTrkDe, float); //! NSigma deuteron from the tracker layers +DECLARE_SOA_COLUMN(NSigmaTrkTr, nSigmaTrkTr, float); //! NSigma triton from the tracker layers +DECLARE_SOA_COLUMN(NSigmaTrkHe, nSigmaTrkHe, float); //! NSigma helium-3 from the tracker layers +DECLARE_SOA_COLUMN(NSigmaTrkAl, nSigmaTrkAl, float); //! NSigma alpha from the tracker layers DECLARE_SOA_DYNAMIC_COLUMN(NSigmaTrk, nSigmaTrk, //! General function to get the nSigma for the tracker layers [](const float el, @@ -46,6 +47,10 @@ DECLARE_SOA_DYNAMIC_COLUMN(NSigmaTrk, nSigmaTrk, //! General function to get the const float pi, const float ka, const float pr, + const float de, + const float tr, + const float he, + const float al, const int id) -> float { switch (std::abs(id)) { case 0: @@ -58,8 +63,16 @@ DECLARE_SOA_DYNAMIC_COLUMN(NSigmaTrk, nSigmaTrk, //! General function to get the return ka; case 4: return pr; + case 5: + return de; + case 6: + return tr; + case 7: + return he; + case 8: + return al; default: - LOG(fatal) << "Unrecognized PDG code for InnerTOF"; + LOG(fatal) << "Unrecognized PDG code"; return 999.f; } }); @@ -67,20 +80,29 @@ DECLARE_SOA_DYNAMIC_COLUMN(NSigmaTrk, nSigmaTrk, //! General function to get the } // namespace upgrade::trk DECLARE_SOA_TABLE(UpgradeTrkPidSignals, "AOD", "UPGRADETRKSIG", - upgrade::trk::TimeOverThresholdBarrel, - upgrade::trk::ClusterSizeBarrel); + o2::soa::Index<>, + upgrade::trk::TimeOverThresholdBarrel); DECLARE_SOA_TABLE(UpgradeTrkPids, "AOD", "UPGRADETRKPID", + o2::soa::Index<>, upgrade::trk::NSigmaTrkEl, upgrade::trk::NSigmaTrkMu, upgrade::trk::NSigmaTrkPi, upgrade::trk::NSigmaTrkKa, upgrade::trk::NSigmaTrkPr, + upgrade::trk::NSigmaTrkDe, + upgrade::trk::NSigmaTrkTr, + upgrade::trk::NSigmaTrkHe, + upgrade::trk::NSigmaTrkAl, upgrade::trk::NSigmaTrk); + upgrade::trk::NSigmaTrkPr, + upgrade::trk::NSigmaTrkDe, + upgrade::trk::NSigmaTrkTr, + upgrade::trk::NSigmaTrkHe, + upgrade::trk::NSigmaTrkAl>); using UpgradeTrkPidSignal = UpgradeTrkPidSignals::iterator; using UpgradeTrkPid = UpgradeTrkPids::iterator; diff --git a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx index fddfdebd2a0..f2d11253b25 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx @@ -113,6 +113,7 @@ struct OnTheFlyTracker { Configurable lutDe{"lutDe", "lutCovm.de.dat", "LUT for deuterons"}; Configurable lutTr{"lutTr", "lutCovm.tr.dat", "LUT for tritons"}; Configurable lutHe3{"lutHe3", "lutCovm.he3.dat", "LUT for Helium-3"}; + Configurable lutAl{"lutAl", "lutCovm.he3.dat", "LUT for Alphas"}; struct : ConfigurableGroup { ConfigurableAxis axisMomentum{"axisMomentum", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "#it{p} (GeV/#it{c})"}; @@ -265,6 +266,7 @@ struct OnTheFlyTracker { loadLUT(1000010020, lutDe.value); loadLUT(1000010030, lutTr.value); loadLUT(1000020030, lutHe3.value); + loadLUT(1000020040, lutAl.value); // interpolate efficiencies if requested to do so mSmearer.interpolateEfficiency(static_cast(interpolateLutEfficiencyVsNch)); @@ -501,6 +503,16 @@ struct OnTheFlyTracker { auto ir = irSampler.generateCollisionTime(); const float eventCollisionTime = ir.timeInBCNS; + constexpr std::array longLivedHandledPDGs = {kElectron, + kMuonMinus, + kPiPlus, + kKPlus, + kProton, + o2::constants::physics::kDeuteron, + o2::constants::physics::kTriton, + o2::constants::physics::kHelium3, + o2::constants::physics::kAlpha}; + // First we compute the number of charged particles in the event dNdEta = 0.f; for (const auto& mcParticle : mcParticles) { @@ -511,7 +523,8 @@ struct OnTheFlyTracker { continue; } const auto pdg = std::abs(mcParticle.pdgCode()); - if (pdg != kElectron && pdg != kMuonMinus && pdg != kPiPlus && pdg != kKPlus && pdg != kProton) { + const bool longLivedToBeHandled = std::find(longLivedHandledPDGs.begin(), longLivedHandledPDGs.end(), pdg) != longLivedHandledPDGs.end(); + if (!longLivedToBeHandled) { if (!cascadeDecaySettings.decayXi) { continue; } else if (pdg != 3312) { @@ -558,7 +571,8 @@ struct OnTheFlyTracker { continue; } } - if (pdg != kElectron && pdg != kMuonMinus && pdg != kPiPlus && pdg != kKPlus && pdg != kProton) { + const bool longLivedToBeHandled = std::find(longLivedHandledPDGs.begin(), longLivedHandledPDGs.end(), pdg) != longLivedHandledPDGs.end(); + if (!longLivedToBeHandled) { if (!cascadeDecaySettings.decayXi) { continue; } else if (pdg != 3312) { diff --git a/ALICE3/TableProducer/OTF/onTheFlyTrackerPid.cxx b/ALICE3/TableProducer/OTF/onTheFlyTrackerPid.cxx index 42d2bcc5252..6ab9df2443e 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyTrackerPid.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyTrackerPid.cxx @@ -11,165 +11,674 @@ /// /// \file onTheFlyTrackerPid.cxx /// -/// \brief This task produces the PID information that can be obtained from the tracker layers (i.e. cluster size and ToT). -/// It currently contemplates 5 particle types: electrons, muons, pions, kaons and protons. +/// \brief This task produces the PID information that can be obtained from the tracker layers (i.e. ToT and possibly cluster size). +/// So far only ToT implemented. It currently contemplates 5 (9) particle types: electrons, muons, pions, kaons and +/// protons (as well as deuterons, tritons, helium-3 and alphas/helium-4 if added via the event generator). /// -/// \author Berkin Ulukutlu TUM /// \author Henrik Fribert TUM /// \author Nicolò Jacazio Università del Piemonte Orientale /// \since May 22, 2025 /// -#include -#include -#include -#include -#include - -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "Framework/ASoAHelpers.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/Core/trackUtilities.h" -#include "ALICE3/Core/TrackUtilities.h" -#include "ReconstructionDataFormats/DCA.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "CommonUtils/NameConf.h" -#include "CCDB/CcdbApi.h" -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DataFormatsCalibration/MeanVertexObject.h" -#include "CommonConstants/GeomConstants.h" -#include "CommonConstants/PhysicsConstants.h" -#include "TRandom3.h" -#include "TF1.h" -#include "TH2F.h" -#include "TVector3.h" -#include "TString.h" -#include "ALICE3/DataModel/OTFRICH.h" -#include "DetectorsVertexing/HelixHelper.h" #include "TableHelper.h" + #include "ALICE3/Core/DelphesO2TrackSmearer.h" +#include "ALICE3/Core/TrackUtilities.h" #include "ALICE3/DataModel/OTFPIDTrk.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; +static constexpr std::array kTrackerRadii = {0.5f, 1.2f, 2.5f, 3.75f, 7.0f, 12.0f, 20.0f, 30.0f, 45.0f, 60.0f, 80.0f}; + +// Constants for magic numbers +static constexpr int kMinEntriesForProjection = 10; +static constexpr double kMinMomentumForLogBins = 0.05; +static constexpr double kMaxMomentumForLogBins = 10.0; +static constexpr int kMinLayerForTruncation = 3; + +// Constants for validation conditions +static constexpr size_t kMinValidHits = 1; +static constexpr size_t kLowValidHits = 2; +static constexpr size_t kMidLowValidHits = 3; +static constexpr size_t kMidHighValidHits = 4; +static constexpr size_t kHighValidHits1 = 5; +static constexpr size_t kHighValidHits2 = 6; +static constexpr size_t kMaxValidHits = 7; + +// Constants for truncated mean calculation +static constexpr size_t kMaxValidHitsForTruncation7Plus = 4; +static constexpr size_t kMaxValidHitsForTruncation56 = 3; +static constexpr size_t kMaxValidHitsForTruncation34 = 2; +static constexpr size_t kMaxValidHitsForTruncation12 = 1; + +class ToTLUT +{ + public: + ToTLUT(float truncationFractionVal, int maxLayers, int etaBins, float etaMin, float etaMax, int ptBins, float ptMin, float ptMax) + : mTruncationFraction(truncationFractionVal), + mMaxLayers(maxLayers), + mEtaBins(etaBins), + mEtaMin(etaMin), + mEtaMax(etaMax), + mPtBins(ptBins), + mPtMin(ptMin), + mPtMax(ptMax), + mEtaBinWidth((etaMax - etaMin) / etaBins), + mPtBinWidth((ptMax - ptMin) / ptBins) + { + mPdgToIndexMap.reserve(10); + mIndexToPdgMap.reserve(10); + } + ToTLUT() = delete; + + ~ToTLUT() + { + for (const auto& hist_ptr : mLUTHistogramFlat) { + if (hist_ptr) { + delete hist_ptr; + } + } + } + + void setCcdbManager(o2::ccdb::BasicCCDBManager* mgr) { mCcdbManager = mgr; } + + bool load(int pdg, const std::string& filename) + { + if (!filename.empty() && strncmp(filename.c_str(), "ccdb:", 5) == 0) { + std::string basePath = std::string(filename).substr(5); + std::string path = basePath + "/PDG_" + std::to_string(pdg); + const std::string outPath = "/tmp/ToTLUTs/"; + + std::string localFilename = Form("%s/lut_tot_%d.root", outPath.c_str(), pdg); + std::ifstream checkFile(localFilename); + if (!checkFile.is_open()) { + if (!mCcdbManager) { + LOG(fatal) << "CCDB manager not set. Please set it before loading LUT from CCDB."; + } + std::map metadata; + mCcdbManager->getCCDBAccessor().retrieveBlob(path, outPath, metadata, 1); + + std::string foundFile = Form("%s/%s/snapshot.root", outPath.c_str(), path.c_str()); + std::ifstream testFile(foundFile); + if (!testFile.is_open()) { + LOG(error) << "Could not find downloaded CCDB file for PDG " << pdg; + return false; + } + testFile.close(); + + return load(pdg, foundFile); + } else { + checkFile.close(); + return load(pdg, localFilename); + } + } + + TFile* f = TFile::Open(filename.c_str()); + if (!f || f->IsZombie()) { + LOG(error) << "Failed to open LUT file: " << filename; + return false; + } + + int currentPdgIdx; + auto it = mPdgToIndexMap.find(pdg); + if (it == mPdgToIndexMap.end()) { + currentPdgIdx = mIndexToPdgMap.size(); + mPdgToIndexMap[pdg] = currentPdgIdx; + mIndexToPdgMap.push_back(pdg); + + size_t totalSize = (currentPdgIdx + 1) * mMaxLayers * mEtaBins * mPtBins; + if (mLUTHistogramFlat.size() < totalSize) { + mLUTHistogramFlat.resize(totalSize, nullptr); + } + } else { + currentPdgIdx = it->second; + } + + bool success = true; + for (int layer = 0; layer < mMaxLayers; ++layer) { + for (int etaBin = 0; etaBin < mEtaBins; ++etaBin) { + float etaMinBin = mEtaMin + etaBin * mEtaBinWidth; + float etaMaxBin = etaMinBin + mEtaBinWidth; + for (int ptBin = 0; ptBin < mPtBins; ++ptBin) { + float ptMinBin = mPtMin + ptBin * mPtBinWidth; + float ptMaxBin = ptMinBin + mPtBinWidth; + TString histName = Form("tot_%d_barrel%d_eta%.2f-%.2f_pt%.2f-%.2f", pdg, layer, etaMinBin, etaMaxBin, ptMinBin, ptMaxBin); + + TH1F* histFromFile = dynamic_cast(f->Get(histName)); + if (histFromFile) { + TH1F* clonedHist = static_cast(histFromFile->Clone()); + clonedHist->SetDirectory(nullptr); + + size_t flatIdx = getFlatIndex(currentPdgIdx, layer, etaBin, ptBin); + mLUTHistogramFlat[flatIdx] = clonedHist; + } else { + size_t flatIdx = getFlatIndex(currentPdgIdx, layer, etaBin, ptBin); + mLUTHistogramFlat[flatIdx] = nullptr; + success = false; + } + } + } + } + + f->Close(); + delete f; + return success; + } + + TH1F* getHistogramForSampling(int pdgIdx, int layer, int etaBin, int ptBin) const + { + if (pdgIdx < 0 || static_cast(pdgIdx) >= getNumPdgTypes() || + layer < 0 || layer >= mMaxLayers || + etaBin < 0 || etaBin >= mEtaBins || ptBin < 0 || ptBin >= mPtBins) { + return nullptr; + } + size_t flatIdx = getFlatIndex(pdgIdx, layer, etaBin, ptBin); + return (flatIdx < mLUTHistogramFlat.size()) ? mLUTHistogramFlat[flatIdx] : nullptr; + } + + int getPdgIndex(int pdgCode) const + { + auto it = mPdgToIndexMap.find(pdgCode); + if (it != mPdgToIndexMap.end()) { + return it->second; + } + return -1; + } + + inline int getEtaBin(float eta) const + { + const float clampedEta = std::max(mEtaMin, std::min(eta, mEtaMax - 1e-6f)); + return std::min(static_cast((clampedEta - mEtaMin) / mEtaBinWidth), mEtaBins - 1); + } + + inline int getPtBin(float pt) const + { + const float clampedPt = std::max(mPtMin, std::min(pt, mPtMax - 1e-6f)); + return std::min(static_cast((clampedPt - mPtMin) / mPtBinWidth), mPtBins - 1); + } + + inline size_t getFlatIndex(int pdgIdx, int layer, int etaBin, int ptBin) const + { + return ((pdgIdx * mMaxLayers + layer) * mEtaBins + etaBin) * mPtBins + ptBin; + } + + size_t getNumPdgTypes() const + { + return mIndexToPdgMap.size(); + } + + std::vector mLUTHistogramFlat; + + std::unordered_map mPdgToIndexMap; + std::vector mIndexToPdgMap; + + float mTruncationFraction; + int mMaxLayers; + int mEtaBins; + float mEtaMin; + float mEtaMax; + int mPtBins; + float mPtMin; + float mPtMax; + + float mEtaBinWidth; + float mPtBinWidth; + + private: + o2::ccdb::BasicCCDBManager* mCcdbManager = nullptr; +}; + +static constexpr int kNumHypothesisParticles = 9; +std::array, kNumHypothesisParticles>, kNumHypothesisParticles> h2dBarrelNsigmaTrue; +std::array, kNumHypothesisParticles> h2dHitsPerTrackVsP; +std::array, kNumHypothesisParticles> h2dToTvsPperParticle; + struct OnTheFlyTrackerPid { + + float calculateNsigma(float measuredToT, float expectedToT, float resolution) + { + if (resolution <= 0) + return 999.f; + return (measuredToT - expectedToT) / resolution; + } + + float getToTMeanFromMomentumSlice(std::shared_ptr hist, float momentum) + { + if (!hist) + return -1.f; + int binX = hist->GetXaxis()->FindBin(momentum); + TH1D* proj = hist->ProjectionY("temp", binX, binX); + if (proj->GetEntries() < kMinEntriesForProjection) { + delete proj; + return -1.f; + } + float mean = proj->GetMean(); + delete proj; + return mean; + } + + float getToTResolutionFromMomentumSlice(std::shared_ptr hist, float momentum) + { + if (!hist) + return -1.f; + int binX = hist->GetXaxis()->FindBin(momentum); + TH1D* proj = hist->ProjectionY("temp", binX, binX); + if (proj->GetEntries() < kMinEntriesForProjection) { + delete proj; + return -1.f; + } + float stddev = proj->GetStdDev(); + delete proj; + return stddev; + } + + float computeTrackLength(o2::track::TrackParCov track, float radius, float magneticField) + { + float length = -100; + o2::math_utils::CircleXYf_t trcCircle; + float sna, csa; + track.getCircleParams(magneticField, trcCircle, sna, csa); + + const float centerDistance = std::hypot(trcCircle.xC, trcCircle.yC); + + if (centerDistance < trcCircle.rC + radius && centerDistance > std::fabs(trcCircle.rC - radius)) { + length = 0.0f; + const float ux = trcCircle.xC / centerDistance; + const float uy = trcCircle.yC / centerDistance; + const float vx = -uy; + const float vy = +ux; + const float radical = (centerDistance * centerDistance - trcCircle.rC * trcCircle.rC + radius * radius) / (2.0f * centerDistance); + const float displace = (0.5f / centerDistance) * std::sqrt( + (-centerDistance + trcCircle.rC - radius) * + (-centerDistance - trcCircle.rC + radius) * + (-centerDistance + trcCircle.rC + radius) * + (centerDistance + trcCircle.rC + radius)); + + const float point1[2] = {radical * ux + displace * vx, radical * uy + displace * vy}; + const float point2[2] = {radical * ux - displace * vx, radical * uy - displace * vy}; + + std::array mom; + track.getPxPyPzGlo(mom); + const float scalarProduct1 = point1[0] * mom[0] + point1[1] * mom[1]; + const float scalarProduct2 = point2[0] * mom[0] + point2[1] * mom[1]; + + std::array startPoint; + track.getXYZGlo(startPoint); + + float cosAngle = -1000, modulus = -1000; + + if (scalarProduct1 > scalarProduct2) { + modulus = std::hypot(point1[0] - trcCircle.xC, point1[1] - trcCircle.yC) * std::hypot(startPoint[0] - trcCircle.xC, startPoint[1] - trcCircle.yC); + cosAngle = (point1[0] - trcCircle.xC) * (startPoint[0] - trcCircle.xC) + (point1[1] - trcCircle.yC) * (startPoint[1] - trcCircle.yC); + } else { + modulus = std::hypot(point2[0] - trcCircle.xC, point2[1] - trcCircle.yC) * std::hypot(startPoint[0] - trcCircle.xC, startPoint[1] - trcCircle.yC); + cosAngle = (point2[0] - trcCircle.xC) * (startPoint[0] - trcCircle.xC) + (point2[1] - trcCircle.yC) * (startPoint[1] - trcCircle.yC); + } + cosAngle /= modulus; + length = trcCircle.rC * std::acos(cosAngle); + length *= std::sqrt(1.0f + track.getTgl() * track.getTgl()); + } + return length; + } + Produces tableUpgradeTrkPidSignals; Produces tableUpgradeTrkPids; - // necessary for particle charges Service pdg; + Service ccdb; + std::unique_ptr mToTLUT; + + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - static constexpr int kMaxBarrelLayers = 8; - static constexpr int kMaxForwardLayers = 9; + Configurable lutTotEl{"lutTotEl", "ccdb:Users/h/hfribert/ToT_LUTs", "ToT LUT for electrons"}; + Configurable lutTotMu{"lutTotMu", "ccdb:Users/h/hfribert/ToT_LUTs", "ToT LUT for muons"}; + Configurable lutTotPi{"lutTotPi", "ccdb:Users/h/hfribert/ToT_LUTs", "ToT LUT for pions"}; + Configurable lutTotKa{"lutTotKa", "ccdb:Users/h/hfribert/ToT_LUTs", "ToT LUT for kaons"}; + Configurable lutTotPr{"lutTotPr", "ccdb:Users/h/hfribert/ToT_LUTs", "ToT LUT for protons"}; + Configurable lutTotDe{"lutTotDe", "ccdb:Users/h/hfribert/ToT_LUTs", "ToT LUT for deuteron"}; + Configurable lutTotTr{"lutTotTr", "ccdb:Users/h/hfribert/ToT_LUTs", "ToT LUT for triton"}; + Configurable lutTotHe{"lutTotHe", "ccdb:Users/h/hfribert/ToT_LUTs", "ToT LUT for helium-3"}; + Configurable lutTotAl{"lutTotAl", "ccdb:Users/h/hfribert/ToT_LUTs", "ToT LUT for alphas"}; - struct : ConfigurableGroup { - Configurable efficiencyFormula{"efficiencyFormula", "1.0/(1.0+exp(-(x-0.01)/0.2))", "ROOT TF1 formula for efficiency"}; - Configurable landauFormula{"landauFormula", "TMath::Landau(x, 1, 1, true)", "ROOT TF1 formula for Landau distribution (e.g. ToT response)"}; - Configurable averageMethod{"averageMethod", 0, "Method to average the ToT and cluster size. 0: truncated mean"}; - } simConfig; + Configurable truncationFraction{"truncationFraction", 0.80f, "Fraction of lower entries to consider for truncated standard deviation"}; + Configurable dBz{"dBz", 20, "magnetic field (kilogauss) for track propagation"}; + Configurable maxBarrelLayers{"maxBarrelLayers", 11, "Maximum number of barrel layers"}; + Configurable etaBins{"etaBins", 50, "Number of eta bins for LUTs and histograms"}; + Configurable etaMin{"etaMin", -2.5f, "Minimum eta value"}; + Configurable etaMax{"etaMax", 2.5f, "Maximum eta value"}; + Configurable ptBins{"ptBins", 500, "Number of pT bins for LUTs (LUTs are pT-based)"}; + Configurable ptMin{"ptMin", 0.0f, "Minimum pT value for LUT binning"}; + Configurable ptMax{"ptMax", 10.0f, "Maximum pT value for LUT binning"}; + Configurable numLogBins{"numLogBins", 200, "Number of logarithmic momentum bins"}; - TF1* mEfficiency = nullptr; - static constexpr int kEtaBins = 50; - static constexpr float kEtaMin = -2.5; - static constexpr float kEtaMax = 2.5; - static constexpr int kPtBins = 200; - static constexpr float kPtMin = 0.0; - static constexpr float kPtMax = 20.0; + std::vector mLogBins; - std::array, kEtaBins> mElossPi; + std::array mHypothesisPdgCodes = { + 11, // Electron + 13, // Muon + 211, // Pion + 321, // Kaon + 2212, // Proton + 1000010020, // Deuteron + 1000010030, // Triton + 1000020030, // Helium-3 + 1000020040 // Alpha + }; void init(o2::framework::InitContext&) { + ccdb->setURL("http://alice-ccdb.cern.ch"); + ccdb->setTimestamp(-1); + + if (static_cast(maxBarrelLayers.value) > kTrackerRadii.size()) { + LOG(fatal) << "Configured maxBarrelLayers (" << maxBarrelLayers.value + << ") exceeds the size of kTrackerRadii (" << kTrackerRadii.size() + << "). Please adjust maxBarrelLayers."; + } + + mToTLUT = std::make_unique(truncationFraction.value, maxBarrelLayers.value, + etaBins.value, etaMin.value, etaMax.value, + ptBins.value, ptMin.value, ptMax.value); + + mToTLUT->setCcdbManager(ccdb.operator->()); + + bool loaded = true; + loaded &= mToTLUT->load(11, lutTotEl.value); + loaded &= mToTLUT->load(13, lutTotMu.value); + loaded &= mToTLUT->load(211, lutTotPi.value); + loaded &= mToTLUT->load(321, lutTotKa.value); + loaded &= mToTLUT->load(2212, lutTotPr.value); + loaded &= mToTLUT->load(1000010020, lutTotDe.value); + loaded &= mToTLUT->load(1000010030, lutTotTr.value); + loaded &= mToTLUT->load(1000020030, lutTotHe.value); + loaded &= mToTLUT->load(1000020040, lutTotAl.value); + + if (!loaded) { + LOG(warning) << "Failed to load one or more ToT LUTs. PID results might be incomplete."; + } + + // Logarithmic momentum bins + mLogBins.clear(); + double pMin = kMinMomentumForLogBins; + double pMax = kMaxMomentumForLogBins; + double logMin = std::log10(pMin); + double logMax = std::log10(pMax); + double dLog = (logMax - logMin) / numLogBins.value; + for (int i = 0; i <= numLogBins.value; ++i) { + mLogBins.push_back(std::pow(10, logMin + i * dLog)); + } + + const AxisSpec axisMomentum{mLogBins, "#it{p/z} (GeV/#it{c})"}; + const AxisSpec axisToT{600, 0., 300., "ToT (#mus/10#mum)"}; + const AxisSpec axisNsigma{200, -10., 10., "N#sigma"}; + const AxisSpec axisLayer{maxBarrelLayers.value, -0.5, static_cast(maxBarrelLayers.value) - 0.5, "Layer"}; + const AxisSpec axisHitsPerTrack{maxBarrelLayers.value + 1, -0.5, static_cast(maxBarrelLayers.value) + 0.5, "# Hits per track"}; + + histos.add("hToTvsP", "ToT vs #it{p/z}; #it{p/z} (GeV/#it{c}); ToT (#mus/10#mum)", kTH2F, {axisMomentum, axisToT}); + histos.add("hToTvsPt", "ToT vs #it{p}; #it{p} (GeV/#it{c}); ToT (#mus/10#mum)", kTH2F, {mLogBins, axisToT}); + histos.add("hHitLayers", "Number of hits on each detector layer;Layer;Counts", kTH1F, {axisLayer}); + histos.add("hHitMultiplicity", "Hit multiplicity along the track; # Hits per track;Counts", kTH1F, {axisHitsPerTrack}); + + std::vector> particleInfo = { + {11, "Elec"}, {13, "Muon"}, {211, "Pion"}, {321, "Kaon"}, {2212, "Prot"}, {1000010020, "Deut"}, {1000010030, "Trit"}, {1000020030, "He3"}, {1000020040, "Al"}}; - for (int i = 0; i < kEtaBins; i++) { - for (int j = 0; j < kPtBins; j++) { - mElossPi[i][j] = new TF1(Form("mElossPi_%d_%d", i, j), simConfig.landauFormula.value.c_str(), 0, 20); + for (size_t iTrue = 0; iTrue < particleInfo.size(); ++iTrue) { + std::string trueName = particleInfo[iTrue].second; + std::string trueNamePretty = trueName; // Fallback + if (trueName == "Elec") + trueNamePretty = "#it{e}"; + else if (trueName == "Muon") + trueNamePretty = "#it{#mu}"; + else if (trueName == "Pion") + trueNamePretty = "#it{#pi}"; + else if (trueName == "Kaon") + trueNamePretty = "#it{K}"; + else if (trueName == "Prot") + trueNamePretty = "#it{p}"; + else if (trueName == "Deut") + trueNamePretty = "#it{d}"; + else if (trueName == "Trit") + trueNamePretty = "#it{t}"; + else if (trueName == "He3") + trueNamePretty = "#it{^{3}He}"; + else if (trueName == "Al") + trueNamePretty = "#it{^{4}He}"; + + std::string hitsVsPName = "HitsPerTrack/hHitsPerTrackVsP_" + trueName; + std::string hitsVsPTitle = "N_hits vs #it{p/z} for " + trueNamePretty + "; #it{p/z} (GeV/#it{c}); N_hits"; + h2dHitsPerTrackVsP[iTrue] = histos.add(hitsVsPName.c_str(), hitsVsPTitle.c_str(), kTH2F, {axisMomentum, axisHitsPerTrack}); + + std::string totVsPName = "ToTvsP/hToTvsP_" + trueName; + std::string totVsPTitle = "ToT vs #it{p/z} for " + trueNamePretty + "; #it{p/z} (GeV/#it{c}); ToT (#mus/10#mum)"; + h2dToTvsPperParticle[iTrue] = histos.add(totVsPName.c_str(), totVsPTitle.c_str(), kTH2F, {axisMomentum, axisToT}); + + for (size_t iHyp = 0; iHyp < particleInfo.size(); ++iHyp) { + std::string hypName = particleInfo[iHyp].second; + std::string hypNamePretty = hypName; // Fallback + if (hypName == "Elec") + hypNamePretty = "#it{e}"; + else if (hypName == "Muon") + hypNamePretty = "#it{#mu}"; + else if (hypName == "Pion") + hypNamePretty = "#it{#pi}"; + else if (hypName == "Kaon") + hypNamePretty = "#it{K}"; + else if (hypName == "Prot") + hypNamePretty = "#it{p}"; + else if (hypName == "Deut") + hypNamePretty = "#it{d}"; + else if (hypName == "Trit") + hypNamePretty = "#it{t}"; + else if (hypName == "He3") + hypNamePretty = "#it{^{3}He}"; + else if (hypName == "Al") + hypNamePretty = "#it{^{4}He}"; + + std::string histName = "NSigma/BarrelNsigmaTrue" + trueName + "Vs" + hypName + "Hypothesis"; + std::string histTitle = "Nsigma (True " + trueNamePretty + " vs Hyp " + hypNamePretty + "); #it{p/z} (GeV/#it{c}); N#sigma"; + h2dBarrelNsigmaTrue[iTrue][iHyp] = histos.add(histName.c_str(), histTitle.c_str(), kTH2F, {axisMomentum, axisNsigma}); } } - mEfficiency = new TF1("mEfficiency", simConfig.efficiencyFormula.value.c_str(), 0, 20); } - void process(soa::Join::iterator const&, + void process(soa::Join::iterator const& collision, soa::Join const& tracks, - aod::McParticles const&, - aod::McCollisions const&) + aod::McParticles const& /*mcParticles*/, + aod::McCollisions const& /*mcCollisions*/) { - std::array timeOverThresholdBarrel; - std::array clusterSizeBarrel; - // std::array timeOverThresholdForward; - // std::array clusterSizeForward; - auto noSignalTrack = [&]() { - tableUpgradeTrkPidSignals(0.f, 0.f); // no PID information - tableUpgradeTrkPids(0.f, 0.f, 0.f, 0.f, 0.f); // no PID information - }; + o2::dataformats::VertexBase mcPvVtx({0.0f, 0.0f, 0.0f}, {0.}); + + if (collision.has_mcCollision()) { + const auto& mcCollisionObject = collision.mcCollision(); + mcPvVtx.setX(mcCollisionObject.posX()); + mcPvVtx.setY(mcCollisionObject.posY()); + mcPvVtx.setZ(mcCollisionObject.posZ()); + } for (const auto& track : tracks) { + float truncatedMeanToT = -1.0f; + std::array nSigmaValues; + nSigmaValues.fill(999.f); + if (!track.has_mcParticle()) { - noSignalTrack(); + tableUpgradeTrkPidSignals(truncatedMeanToT); + tableUpgradeTrkPids(nSigmaValues[0], nSigmaValues[1], nSigmaValues[2], nSigmaValues[3], + nSigmaValues[4], nSigmaValues[5], nSigmaValues[6], nSigmaValues[7], nSigmaValues[8]); continue; } + const auto& mcParticle = track.mcParticle(); + const auto& pdgInfo = pdg->GetParticle(mcParticle.pdgCode()); if (!pdgInfo) { - LOG(warning) << "PDG code " << mcParticle.pdgCode() << " not found in the database"; - noSignalTrack(); + tableUpgradeTrkPidSignals(truncatedMeanToT); + tableUpgradeTrkPids(nSigmaValues[0], nSigmaValues[1], nSigmaValues[2], nSigmaValues[3], + nSigmaValues[4], nSigmaValues[5], nSigmaValues[6], nSigmaValues[7], nSigmaValues[8]); continue; } + const float pt = mcParticle.pt(); + const float p = mcParticle.p(); const float eta = mcParticle.eta(); + const int truePdgCode = std::abs(mcParticle.pdgCode()); - const int binnedPt = static_cast((pt - kPtMin) / kPtBins); - const int binnedEta = static_cast((eta - kEtaMin) / kEtaBins); - if (binnedPt < 0 || binnedPt >= kPtBins || binnedEta < 0 || binnedEta >= kEtaBins) { - noSignalTrack(); + float rigidity = p; + if (pdgInfo) { + const float trueCharge = std::abs(pdgInfo->Charge()) / 3.0f; + if (trueCharge > 0) { + rigidity = p / trueCharge; + } + } + + int truePdgIdx = mToTLUT->getPdgIndex(truePdgCode); + if (truePdgIdx == -1) { + tableUpgradeTrkPidSignals(truncatedMeanToT); + tableUpgradeTrkPids(nSigmaValues[0], nSigmaValues[1], nSigmaValues[2], nSigmaValues[3], + nSigmaValues[4], nSigmaValues[5], nSigmaValues[6], nSigmaValues[7], nSigmaValues[8]); continue; } - for (int i = 0; i < kMaxBarrelLayers; i++) { - timeOverThresholdBarrel[i] = -1; - clusterSizeBarrel[i] = -1; - - // Check if layer is efficient - if (mEfficiency->Eval(pt) > gRandom->Uniform(0, 1)) { - timeOverThresholdBarrel[i] = mElossPi[binnedEta][binnedPt]->GetRandom(); // Simulate ToT - clusterSizeBarrel[i] = mElossPi[binnedEta][binnedPt]->GetRandom(); // Simulate cluster size + + const int binnedPt = mToTLUT->getPtBin(pt); + const int binnedEta = mToTLUT->getEtaBin(std::abs(eta)); + + uint16_t hitMap = 0; + int nHitLayers = 0; + o2::track::TrackParCov o2track = o2::upgrade::convertMCParticleToO2Track(mcParticle, pdg); + + float xPv = -100.f; + static constexpr float kTrkXThreshold = -99.f; + if (o2track.propagateToDCA(mcPvVtx, dBz)) { + xPv = o2track.getX(); + } + + if (xPv > kTrkXThreshold) { + for (int layer = 0; layer < maxBarrelLayers.value; ++layer) { + float layerRadius = kTrackerRadii[layer]; + float trackLength = computeTrackLength(o2track, layerRadius, dBz); + + if (trackLength > 0) { + hitMap |= (1 << layer); + histos.fill(HIST("hHitLayers"), layer); + nHitLayers++; + } + } + } + + histos.fill(HIST("hHitMultiplicity"), nHitLayers); + h2dHitsPerTrackVsP[truePdgIdx]->Fill(rigidity, nHitLayers); + + std::vector validToTs; + + for (int layer = kMinLayerForTruncation; layer < maxBarrelLayers.value; ++layer) { + if ((hitMap >> layer) & 0x1) { + TH1F* totHist = mToTLUT->getHistogramForSampling(truePdgIdx, layer, binnedEta, binnedPt); + + if (totHist && totHist->GetEntries() > 1) { + float sampledToT = totHist->GetRandom(); + validToTs.push_back(sampledToT); + } + } + } + + truncatedMeanToT = -1.0f; + const size_t nValid = validToTs.size(); + size_t nUse = 0; + + if (nValid == kMidLowValidHits || nValid == kMidHighValidHits) + nUse = kMaxValidHitsForTruncation34; + else if (nValid == kMinValidHits || nValid == kLowValidHits) + nUse = kMaxValidHitsForTruncation12; + else if (nValid == kHighValidHits1 || nValid == kHighValidHits2) + nUse = kMaxValidHitsForTruncation56; + else if (nValid >= kMaxValidHits) + nUse = kMaxValidHitsForTruncation7Plus; + + if (nUse > 0 && nValid >= nUse) { + std::sort(validToTs.begin(), validToTs.end()); + float sum = 0.0f; + for (size_t i = 0; i < nUse; ++i) { + sum += validToTs[i]; } + truncatedMeanToT = sum / static_cast(nUse); + + histos.fill(HIST("hToTvsPt"), p, truncatedMeanToT); + histos.fill(HIST("hToTvsP"), rigidity, truncatedMeanToT); + h2dToTvsPperParticle[truePdgIdx]->Fill(rigidity, truncatedMeanToT); } - // Now we do the average - switch (simConfig.averageMethod) { - case 0: { // truncated mean - float meanToT = 0; - float meanClusterSize = 0; - // Order them by ToT - std::sort(timeOverThresholdBarrel.begin(), timeOverThresholdBarrel.end()); - std::sort(clusterSizeBarrel.begin(), clusterSizeBarrel.end()); - static constexpr int kTruncatedMean = 5; - // Take the mean of the first 5 values - for (int i = 0; i < kTruncatedMean; i++) { - meanToT += timeOverThresholdBarrel[i]; - meanClusterSize += clusterSizeBarrel[i]; + nSigmaValues.fill(999.f); + + if (truncatedMeanToT > 0) { + for (size_t iHyp = 0; iHyp < mHypothesisPdgCodes.size(); ++iHyp) { + int hypPdgCode = mHypothesisPdgCodes[iHyp]; + int hypPdgIdx = mToTLUT->getPdgIndex(hypPdgCode); + + if (hypPdgIdx == -1) { + nSigmaValues[iHyp] = 999.f; + continue; } - meanToT /= kTruncatedMean; - meanClusterSize /= kTruncatedMean; - // Fill the table - tableUpgradeTrkPidSignals(meanToT, meanClusterSize); - } break; - - default: - LOG(fatal) << "Unknown average method " << simConfig.averageMethod; - break; + + float expectedToT = getToTMeanFromMomentumSlice(h2dToTvsPperParticle[hypPdgIdx], rigidity); + float resolution = getToTResolutionFromMomentumSlice(h2dToTvsPperParticle[hypPdgIdx], rigidity); + + if (expectedToT > 0 && resolution > 0) { + nSigmaValues[iHyp] = calculateNsigma(truncatedMeanToT, expectedToT, resolution); + h2dBarrelNsigmaTrue[truePdgIdx][iHyp]->Fill(rigidity, nSigmaValues[iHyp]); + } else { + nSigmaValues[iHyp] = 999.f; + } + } } + + tableUpgradeTrkPidSignals(truncatedMeanToT); + tableUpgradeTrkPids(nSigmaValues[0], nSigmaValues[1], nSigmaValues[2], nSigmaValues[3], + nSigmaValues[4], nSigmaValues[5], nSigmaValues[6], nSigmaValues[7], nSigmaValues[8]); } } }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From 8c87eadc46c358612d4a41599e53998be04bb6ed Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sun, 28 Sep 2025 04:14:22 +0200 Subject: [PATCH 558/986] [PWGLF] Bugfix: missing std::fabs (#13151) --- PWGLF/Tasks/QC/strangepidqa.cxx | 38 ++++++++++++++++----------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/PWGLF/Tasks/QC/strangepidqa.cxx b/PWGLF/Tasks/QC/strangepidqa.cxx index 08e502b87f5..43600cad4da 100644 --- a/PWGLF/Tasks/QC/strangepidqa.cxx +++ b/PWGLF/Tasks/QC/strangepidqa.cxx @@ -164,7 +164,7 @@ struct strangepidqa { void processReal(soa::Join::iterator const& coll, soa::Join const& v0s, soa::Join const&) { - for (auto& lambda : v0s) { // selecting photons from Sigma0 + for (auto& lambda : v0s) { if (TMath::Abs(lambda.eta()) > 0.5) continue; @@ -285,16 +285,16 @@ struct strangepidqa { auto posExtra = lambda.posTrack_as>(); bool primaryTOFcompatible_Lambda = - (!posExtra.hasTOF() || (posExtra.tofNSigmaPr() < tofNsigmaCompatibilityCascades.value)) && - (!negExtra.hasTOF() || (negExtra.tofNSigmaPi() < tofNsigmaCompatibilityCascades.value)); + (!posExtra.hasTOF() || (std::fabs(posExtra.tofNSigmaPr()) < tofNsigmaCompatibilityCascades.value)) && + (!negExtra.hasTOF() || (std::fabs(negExtra.tofNSigmaPi()) < tofNsigmaCompatibilityCascades.value)); bool primaryTOFcompatible_AntiLambda = - (!posExtra.hasTOF() || (posExtra.tofNSigmaPi() < tofNsigmaCompatibilityCascades.value)) && - (!negExtra.hasTOF() || (negExtra.tofNSigmaPr() < tofNsigmaCompatibilityCascades.value)); + (!posExtra.hasTOF() || (std::fabs(posExtra.tofNSigmaPi()) < tofNsigmaCompatibilityCascades.value)) && + (!negExtra.hasTOF() || (std::fabs(negExtra.tofNSigmaPr()) < tofNsigmaCompatibilityCascades.value)); bool primaryTOFcompatible_K0Short = - (!posExtra.hasTOF() || (posExtra.tofNSigmaPi() < tofNsigmaCompatibilityCascades.value)) && - (!negExtra.hasTOF() || (negExtra.tofNSigmaPi() < tofNsigmaCompatibilityCascades.value)); + (!posExtra.hasTOF() || (std::fabs(posExtra.tofNSigmaPi()) < tofNsigmaCompatibilityCascades.value)) && + (!negExtra.hasTOF() || (std::fabs(negExtra.tofNSigmaPi()) < tofNsigmaCompatibilityCascades.value)); if (TMath::Abs(posExtra.tpcNSigmaPr()) < tpcNsigmaProton && TMath::Abs(negExtra.tpcNSigmaPi()) < tpcNsigmaPion) { // lambda case @@ -369,24 +369,24 @@ struct strangepidqa { } bool primaryTOFcompatible_XiMinus = - (!posExtra.hasTOF() || (posExtra.tofNSigmaPr() < tofNsigmaCompatibilityCascades.value)) && - (!negExtra.hasTOF() || (negExtra.tofNSigmaPi() < tofNsigmaCompatibilityCascades.value)) && - (!bachExtra.hasTOF() || (bachExtra.tofNSigmaPi() < tofNsigmaCompatibilityCascades.value)); + (!posExtra.hasTOF() || (std::fabs(posExtra.tofNSigmaPr()) < tofNsigmaCompatibilityCascades.value)) && + (!negExtra.hasTOF() || (std::fabs(negExtra.tofNSigmaPi()) < tofNsigmaCompatibilityCascades.value)) && + (!bachExtra.hasTOF() || (std::fabs(bachExtra.tofNSigmaPi()) < tofNsigmaCompatibilityCascades.value)); bool primaryTOFcompatible_XiPlus = - (!posExtra.hasTOF() || (posExtra.tofNSigmaPi() < tofNsigmaCompatibilityCascades.value)) && - (!negExtra.hasTOF() || (negExtra.tofNSigmaPr() < tofNsigmaCompatibilityCascades.value)) && - (!bachExtra.hasTOF() || (bachExtra.tofNSigmaPi() < tofNsigmaCompatibilityCascades.value)); + (!posExtra.hasTOF() || (std::fabs(posExtra.tofNSigmaPi()) < tofNsigmaCompatibilityCascades.value)) && + (!negExtra.hasTOF() || (std::fabs(negExtra.tofNSigmaPr()) < tofNsigmaCompatibilityCascades.value)) && + (!bachExtra.hasTOF() || (std::fabs(bachExtra.tofNSigmaPi()) < tofNsigmaCompatibilityCascades.value)); bool primaryTOFcompatible_OmegaMinus = - (!posExtra.hasTOF() || (posExtra.tofNSigmaPr() < tofNsigmaCompatibilityCascades.value)) && - (!negExtra.hasTOF() || (negExtra.tofNSigmaPi() < tofNsigmaCompatibilityCascades.value)) && - (!bachExtra.hasTOF() || (bachExtra.tofNSigmaKa() < tofNsigmaCompatibilityCascades.value)); + (!posExtra.hasTOF() || (std::fabs(posExtra.tofNSigmaPr()) < tofNsigmaCompatibilityCascades.value)) && + (!negExtra.hasTOF() || (std::fabs(negExtra.tofNSigmaPi()) < tofNsigmaCompatibilityCascades.value)) && + (!bachExtra.hasTOF() || (std::fabs(bachExtra.tofNSigmaKa()) < tofNsigmaCompatibilityCascades.value)); bool primaryTOFcompatible_OmegaPlus = - (!posExtra.hasTOF() || (posExtra.tofNSigmaPi() < tofNsigmaCompatibilityCascades.value)) && - (!negExtra.hasTOF() || (negExtra.tofNSigmaPr() < tofNsigmaCompatibilityCascades.value)) && - (!bachExtra.hasTOF() || (bachExtra.tofNSigmaKa() < tofNsigmaCompatibilityCascades.value)); + (!posExtra.hasTOF() || (std::fabs(posExtra.tofNSigmaPi()) < tofNsigmaCompatibilityCascades.value)) && + (!negExtra.hasTOF() || (std::fabs(negExtra.tofNSigmaPr()) < tofNsigmaCompatibilityCascades.value)) && + (!bachExtra.hasTOF() || (std::fabs(bachExtra.tofNSigmaKa()) < tofNsigmaCompatibilityCascades.value)); if (casc.sign() < 0) { if (TMath::Abs(posExtra.tpcNSigmaPr()) < tpcNsigmaProton && TMath::Abs(negExtra.tpcNSigmaPi()) < tpcNsigmaPion && TMath::Abs(bachExtra.tpcNSigmaPi()) < tpcNsigmaBachelor) { From e66b9a45e59cff9517007174a648e5273cb8cf44 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sun, 28 Sep 2025 07:09:38 +0200 Subject: [PATCH 559/986] [PWGLF] Optimize de-duplication and DCAtoPV calculation (#13031) Co-authored-by: ALICE Builder --- PWGLF/Utils/strangenessBuilderHelper.h | 82 ++++++++++++++++++-------- PWGLF/Utils/strangenessBuilderModule.h | 5 +- 2 files changed, 59 insertions(+), 28 deletions(-) diff --git a/PWGLF/Utils/strangenessBuilderHelper.h b/PWGLF/Utils/strangenessBuilderHelper.h index c4adf1c2874..23be7279c56 100644 --- a/PWGLF/Utils/strangenessBuilderHelper.h +++ b/PWGLF/Utils/strangenessBuilderHelper.h @@ -266,7 +266,10 @@ class strangenessBuilderHelper //_______________________________________________________________________ // standard build V0 function. Populates ::v0 object // ::v0 will be initialized to defaults if build fails - template + // --- useSelections: meant to maximize recovery, but beware high cost in CPU + // --- calculateProngDCAtoPV: optionally don't propagate prongs to PV, saves + // CPU, of interest when dealing with de-duplication (variable not checked) + template bool buildV0Candidate(int collisionIndex, float pvX, float pvY, float pvZ, TTrack const& positiveTrack, @@ -277,6 +280,8 @@ class strangenessBuilderHelper bool calculateCovariance = false, bool acceptTPCOnly = false) { + v0 = {}; // safe initialization: start new + if constexpr (useSelections) { // verify track quality if (positiveTrack.tpcNClsCrossedRows() < v0selections.minCrossedRows) { @@ -296,41 +301,50 @@ class strangenessBuilderHelper v0 = {}; return false; } - if (!acceptTPCOnly && !positiveTrack.hasITS()) { + if (!acceptTPCOnly && !positiveTrack.hasITS() && !negativeTrack.hasTRD() && !negativeTrack.hasTOF()) { v0 = {}; return false; } - if (!acceptTPCOnly && !negativeTrack.hasITS()) { + if (!acceptTPCOnly && !negativeTrack.hasITS() && !negativeTrack.hasTRD() && !negativeTrack.hasTOF()) { v0 = {}; return false; } } - // Calculate DCA with respect to the collision associated to the V0 - std::array dcaInfo; + if constexpr (calculateProngDCAtoPV) { + // Calculate DCA with respect to the collision associated to the V0 + std::array dcaInfo; - // do DCA to PV on copies instead of originals - auto positiveTrackParamCopy = positiveTrackParam; - auto negativeTrackParamCopy = negativeTrackParam; + // do DCA to PV on TrackPar copies and not TrackParCov + // TrackPar preferred: don't calculate multiple scattering / CovMat changes + // Spares CPU since variables not checked + o2::track::TrackPar positiveTrackParamCopy(positiveTrackParam); + o2::track::TrackPar negativeTrackParamCopy(negativeTrackParam); - o2::base::Propagator::Instance()->propagateToDCABxByBz({pvX, pvY, pvZ}, positiveTrackParamCopy, 2.f, fitter.getMatCorrType(), &dcaInfo); - v0.positiveDCAxy = dcaInfo[0]; + dcaInfo[0] = dcaInfo[1] = 999.0f; // by default, take large value to make sure candidate accepted + o2::base::Propagator::Instance()->propagateToDCABxByBz({pvX, pvY, pvZ}, positiveTrackParamCopy, 2.f, fitter.getMatCorrType(), &dcaInfo); + v0.positiveDCAxy = dcaInfo[0]; - if constexpr (useSelections) { - if (std::fabs(v0.positiveDCAxy) < v0selections.dcanegtopv) { - v0 = {}; - return false; + if constexpr (useSelections) { + if (std::fabs(v0.positiveDCAxy) < v0selections.dcapostopv) { + v0 = {}; + return false; + } } - } - o2::base::Propagator::Instance()->propagateToDCABxByBz({pvX, pvY, pvZ}, negativeTrackParamCopy, 2.f, fitter.getMatCorrType(), &dcaInfo); - v0.negativeDCAxy = dcaInfo[0]; + dcaInfo[0] = dcaInfo[1] = 999.0f; // by default, take large value to make sure candidate accepted + o2::base::Propagator::Instance()->propagateToDCABxByBz({pvX, pvY, pvZ}, negativeTrackParamCopy, 2.f, fitter.getMatCorrType(), &dcaInfo); + v0.negativeDCAxy = dcaInfo[0]; - if constexpr (useSelections) { - if (std::fabs(v0.negativeDCAxy) < v0selections.dcanegtopv) { - v0 = {}; - return false; + if constexpr (useSelections) { + if (std::fabs(v0.negativeDCAxy) < v0selections.dcanegtopv) { + v0 = {}; + return false; + } } + } else { + v0.positiveDCAxy = 0.0f; // default invalid + v0.negativeDCAxy = 0.0f; // default invalid } // Perform DCA fit @@ -340,10 +354,12 @@ class strangenessBuilderHelper nCand = fitter.process(positiveTrackParam, negativeTrackParam); } catch (...) { v0 = {}; + fitter.setCollinear(false); // even if returned, reset return false; } if (nCand == 0) { v0 = {}; + fitter.setCollinear(false); // even if returned, reset return false; } fitter.setCollinear(false); // proper cleaning: when exiting this loop, always reset to not collinear @@ -354,6 +370,7 @@ class strangenessBuilderHelper std::array dcaV0Info; // propagate to collision vertex + dcaV0Info[0] = dcaV0Info[1] = 999.0f; // default DCA: large, use with care if propagation fails o2::base::Propagator::Instance()->propagateToDCABxByBz({pvX, pvY, pvZ}, V0Temp, 2.f, fitter.getMatCorrType(), &dcaV0Info); v0.v0DCAToPVxy = dcaV0Info[0]; v0.v0DCAToPVz = dcaV0Info[1]; @@ -499,10 +516,13 @@ class strangenessBuilderHelper // Calculate DCA with respect to the collision associated to the V0 std::array dcaInfo; - // do DCA to PV on copies instead of originals - auto positiveTrackParamCopy = positiveTrackParam; - auto negativeTrackParamCopy = negativeTrackParam; + // do DCA to PV on TrackPar copies and not TrackParCov + // TrackPar preferred: don't calculate multiple scattering / CovMat changes + // Spares CPU since variables not checked + o2::track::TrackPar positiveTrackParamCopy(positiveTrackParam); + o2::track::TrackPar negativeTrackParamCopy(negativeTrackParam); + dcaInfo[0] = dcaInfo[1] = 999.0f; // by default, take large value to make sure candidate accepted o2::base::Propagator::Instance()->propagateToDCABxByBz({pvX, pvY, pvZ}, positiveTrackParamCopy, 2.f, fitter.getMatCorrType(), &dcaInfo); v0.positiveDCAxy = dcaInfo[0]; @@ -511,6 +531,7 @@ class strangenessBuilderHelper return false; } + dcaInfo[0] = dcaInfo[1] = 999.0f; // reset to default value o2::base::Propagator::Instance()->propagateToDCABxByBz({pvX, pvY, pvZ}, negativeTrackParamCopy, 2.f, fitter.getMatCorrType(), &dcaInfo); v0.negativeDCAxy = dcaInfo[0]; @@ -672,6 +693,8 @@ class strangenessBuilderHelper bool useCascadeMomentumAtPV = false, bool processCovariances = false) { + cascade = {}; // initialize / empty (extra safety) + // verify track quality if (positiveTrack.tpcNClsCrossedRows() < cascadeselections.minCrossedRows) { cascade = {}; @@ -726,6 +749,7 @@ class strangenessBuilderHelper // bachelor DCA track to PV // Calculate DCA with respect to the collision associated to the V0, not individual tracks std::array dcaInfo; + dcaInfo[0] = dcaInfo[1] = 999.0f; // by default, take large value to make sure candidate accepted auto bachTrackPar = getTrackPar(bachelorTrack); o2::base::Propagator::Instance()->propagateToDCABxByBz({pvX, pvY, pvZ}, bachTrackPar, 2.f, fitter.getMatCorrType(), &dcaInfo); @@ -902,6 +926,8 @@ class strangenessBuilderHelper bool kfDoDCAFitterPreMinimV0 = false, bool kfDoDCAFitterPreMinimCasc = false) { + cascade = {}; // initialize / empty (extra safety) + //*>~<*>~<*>~<*>~<*>~<*>~<*>~<*>~<*>~<* // KF particle based rebuilding // dispenses prior V0 generation, uses constrained (re-)fit based on bachelor charge @@ -950,13 +976,18 @@ class strangenessBuilderHelper // bachelor DCA track to PV // Calculate DCA with respect to the collision associated to the V0, not individual tracks std::array dcaInfo; + dcaInfo[0] = dcaInfo[1] = 999.0f; // by default, take large value to make sure candidate accepted auto bachTrackPar = getTrackPar(bachelorTrack); o2::base::Propagator::Instance()->propagateToDCABxByBz({pvX, pvY, pvZ}, bachTrackPar, 2.f, fitter.getMatCorrType(), &dcaInfo); cascade.bachelorDCAxy = dcaInfo[0]; + + dcaInfo[0] = dcaInfo[1] = 999.0f; // by default, take large value to make sure candidate accepted o2::track::TrackParCov posTrackParCovForDCA = getTrackParCov(positiveTrack); o2::base::Propagator::Instance()->propagateToDCABxByBz({pvX, pvY, pvZ}, posTrackParCovForDCA, 2.f, fitter.getMatCorrType(), &dcaInfo); cascade.positiveDCAxy = dcaInfo[0]; + + dcaInfo[0] = dcaInfo[1] = 999.0f; // by default, take large value to make sure candidate accepted o2::track::TrackParCov negTrackParCovForDCA = getTrackParCov(negativeTrack); o2::base::Propagator::Instance()->propagateToDCABxByBz({pvX, pvY, pvZ}, negTrackParCovForDCA, 2.f, fitter.getMatCorrType(), &dcaInfo); cascade.negativeDCAxy = dcaInfo[0]; @@ -1272,8 +1303,7 @@ class strangenessBuilderHelper o2::track::TrackPar wrongV0 = fitter.createParentTrackPar(); wrongV0.setAbsCharge(0); // charge zero std::array dcaInfo; - dcaInfo[0] = 999; - dcaInfo[1] = 999; + dcaInfo[0] = dcaInfo[1] = 999.0f; // by default, take large value // bachelor-baryon DCAxy to PV o2::base::Propagator::Instance()->propagateToDCABxByBz({pvX, pvY, pvZ}, wrongV0, 2.f, fitter.getMatCorrType(), &dcaInfo); diff --git a/PWGLF/Utils/strangenessBuilderModule.h b/PWGLF/Utils/strangenessBuilderModule.h index 7319e29c04e..0220453a238 100644 --- a/PWGLF/Utils/strangenessBuilderModule.h +++ b/PWGLF/Utils/strangenessBuilderModule.h @@ -916,9 +916,10 @@ class BuilderModule } // end TPC drift treatment // process candidate with helper, generate properties for consulting - // : do not apply selections: do as much as possible to preserve + // first 'false' : do not apply selections: do as much as possible to preserve + // second 'false': do not calculate prong DCA to PV, unnecessary, costly if XIU = 83.1f // candidate at this level and do not select with topo selections - if (straHelper.buildV0Candidate(v0tableGrouped[iV0].collisionIds[ic], collision.posX(), collision.posY(), collision.posZ(), pTrack, nTrack, posTrackPar, negTrackPar, true, false, true)) { + if (straHelper.buildV0Candidate(v0tableGrouped[iV0].collisionIds[ic], collision.posX(), collision.posY(), collision.posZ(), pTrack, nTrack, posTrackPar, negTrackPar, true, false, true)) { // candidate built, check pointing angle if (straHelper.v0.pointingAngle < bestPointingAngle) { bestPointingAngle = straHelper.v0.pointingAngle; From ed22a051c5675cddf97e33e98c8d6971326ebe4d Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sun, 28 Sep 2025 09:26:50 +0200 Subject: [PATCH 560/986] [PWGEM/Dilepton] remove fabs from polarization (#13152) --- PWGEM/Dilepton/Core/Dilepton.h | 25 +-- PWGEM/Dilepton/Core/DileptonMC.h | 300 ++++++++++++++++--------------- 2 files changed, 167 insertions(+), 158 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index cdb9867f7e0..21e2f3c250a 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -131,8 +131,9 @@ struct Dilepton { // ConfigurableAxis ConfMmumuBins{"ConfMmumuBins", {VARIABLE_WIDTH, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.50, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.70, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.80, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.00, 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.10, 1.11,1.12,1.13,1.14,1.15,1.16,1.17,1.18,1.19, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.10, 2.20, 2.30, 2.40, 2.50, 2.60, 2.70, 2.75, 2.80, 2.85, 2.90, 2.95, 3.00, 3.05, 3.10, 3.15, 3.20, 3.25, 3.30, 3.35, 3.40, 3.45, 3.50, 3.55, 3.60, 3.65, 3.70, 3.75, 3.80, 3.85, 3.90, 3.95, 4.00, 4.10, 4.20, 4.30, 4.40, 4.50, 4.60, 4.70, 4.80, 4.90, 5.00, 5.10, 5.20, 5.30, 5.40, 5.50, 5.60, 5.70, 5.80, 5.90, 6.00, 6.10, 6.20, 6.30, 6.40, 6.50, 6.60, 6.70, 6.80, 6.90, 7.00, 7.10, 7.20, 7.30, 7.40, 7.50, 7.60, 7.70, 7.80, 7.90, 8.00, 8.10, 8.20, 8.30, 8.40, 8.50, 8.60, 8.70, 8.80, 8.90, 9.00, 9.10, 9.20, 9.30, 9.40, 9.50, 9.60, 9.70, 9.80, 9.90, 10.00, 10.10, 10.20, 10.30, 10.40, 10.50, 10.60, 10.70, 10.80, 10.90, 11.00, 11.50, 12.00}, "mmumu bins for output histograms"}; // for dimuon. one can copy bins here to hyperloop page. ConfigurableAxis ConfSPBins{"ConfSPBins", {200, -5, 5}, "SP bins for flow analysis"}; - ConfigurableAxis ConfPolarizationPhiBins{"ConfPolarizationPhiBins", {6, 0.f, M_PI}, "phi bins for polarization analysis"}; - ConfigurableAxis ConfPolarizationCosThetaBins{"ConfPolarizationCosThetaBins", {5, 0.f, 1.f}, "phi bins for polarization analysis"}; + ConfigurableAxis ConfPolarizationPhiBins{"ConfPolarizationPhiBins", {1, 0.f, 2 * M_PI}, "phi bins for polarization analysis"}; + ConfigurableAxis ConfPolarizationCosThetaBins{"ConfPolarizationCosThetaBins", {20, -1.f, 1.f}, "cos(theta) bins for polarization analysis"}; + ConfigurableAxis ConfPolarizationQuadMomBins{"ConfPolarizationQuadMomBins", {15, -0.5, 1}, "quadrupole moment bins for polarization analysis"}; // quardrupole moment <(3 x cos^2(theta) -1)/2> EMEventCut fEMEventCut; struct : ConfigurableGroup { @@ -612,7 +613,8 @@ struct Dilepton { const AxisSpec axis_cos_theta{ConfPolarizationCosThetaBins, Form("|cos(#theta^{%s})|", frameName.data())}; const AxisSpec axis_phi{ConfPolarizationPhiBins, Form("|#varphi^{%s}| (rad.)", frameName.data())}; - fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y, axis_cos_theta, axis_phi}, true); + const AxisSpec axis_quadmom{ConfPolarizationQuadMomBins, Form("#frac{3 cos^{2}(#theta^{%s}) -1}{2}", frameName.data())}; + fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y, axis_cos_theta, axis_phi, axis_quadmom}, true); fRegistry.addClone("Pair/same/uls/", "Pair/same/lspp/"); fRegistry.addClone("Pair/same/uls/", "Pair/same/lsmm/"); fRegistry.addClone("Pair/same/", "Pair/mix/"); @@ -979,14 +981,14 @@ struct Dilepton { } else if (cfgPolarizationFrame == 1) { o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(std::array{t1.px(), t1.py(), t1.pz(), leptonM1}, std::array{t2.px(), t2.py(), t2.pz(), leptonM2}, beamE1, beamE2, beamP1, beamP2, t1.sign(), cos_thetaPol, phiPol); } - o2::math_utils::bringToPMPi(phiPol); + o2::math_utils::bringTo02Pi(phiPol); if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), aco, asym, std::fabs(dphi_e_ee), std::fabs(cos_thetaPol), weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), aco, asym, std::fabs(dphi_e_ee), cos_thetaPol, weight); } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), aco, asym, std::fabs(dphi_e_ee), std::fabs(cos_thetaPol), weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), aco, asym, std::fabs(dphi_e_ee), cos_thetaPol, weight); } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), aco, asym, std::fabs(dphi_e_ee), std::fabs(cos_thetaPol), weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), aco, asym, std::fabs(dphi_e_ee), cos_thetaPol, weight); } } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kFlowV2) || cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kFlowV3)) { std::array q2ft0m = {collision.q2xft0m(), collision.q2yft0m()}; @@ -1036,14 +1038,15 @@ struct Dilepton { } else if (cfgPolarizationFrame == 1) { o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(std::array{t1.px(), t1.py(), t1.pz(), leptonM1}, std::array{t2.px(), t2.py(), t2.pz(), leptonM2}, beamE1, beamE2, beamP1, beamP2, t1.sign(), cos_thetaPol, phiPol); } - o2::math_utils::bringToPMPi(phiPol); + o2::math_utils::bringTo02Pi(phiPol); + float quadmom = (3.f * std::pow(cos_thetaPol, 2) - 1.f) / 2.f; if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), std::fabs(cos_thetaPol), std::fabs(phiPol), weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), cos_thetaPol, phiPol, quadmom, weight); } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), std::fabs(cos_thetaPol), std::fabs(phiPol), weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), cos_thetaPol, phiPol, quadmom, weight); } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), std::fabs(cos_thetaPol), std::fabs(phiPol), weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), cos_thetaPol, phiPol, quadmom, weight); } } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kHFll)) { float dphi = v1.Phi() - v2.Phi(); diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index 5e4a1a44590..5a186d01f4e 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -125,9 +125,10 @@ struct DileptonMC { Configurable cfg_nbin_aco{"cfg_nbin_aco", 1, "number of bins for acoplanarity"}; // 10 Configurable cfg_nbin_asym_pt{"cfg_nbin_asym_pt", 1, "number of bins for pt asymmetry"}; // 10 Configurable cfg_nbin_dphi_e_ee{"cfg_nbin_dphi_e_ee", 1, "number of bins for dphi_ee_e"}; // 18 - ConfigurableAxis ConfPolarizationPhiBins{"ConfPolarizationPhiBins", {6, 0.f, M_PI}, "phi bins for polarization analysis"}; - ConfigurableAxis ConfPolarizationCosThetaBins{"ConfPolarizationCosThetaBins", {5, 0.f, 1.f}, "phi bins for polarization analysis"}; + ConfigurableAxis ConfPolarizationPhiBins{"ConfPolarizationPhiBins", {1, 0.f, 2 * M_PI}, "phi bins for polarization analysis"}; + ConfigurableAxis ConfPolarizationCosThetaBins{"ConfPolarizationCosThetaBins", {1, -1.f, 1.f}, "cos(theta) bins for polarization analysis"}; Configurable cfgPolarizationFrame{"cfgPolarizationFrame", 0, "frame of polarization. 0:CS, 1:HX, else:FATAL"}; + ConfigurableAxis ConfPolarizationQuadMomBins{"ConfPolarizationQuadMomBins", {1, -0.5, 1}, "quadrupole moment bins for polarization analysis"}; // quardrupole moment <(3 x cos^2(theta) -1)/2> EMEventCut fEMEventCut; struct : ConfigurableGroup { @@ -366,12 +367,13 @@ struct DileptonMC { const AxisSpec axis_deta_ee{cfg_nbin_deta_ee, -2., 2., "#Delta#eta = #eta_{l1} - #eta_{l2}"}; // for kHFll const AxisSpec axis_cos_theta_pol{ConfPolarizationCosThetaBins, Form("|cos(#theta^{%s})|", frameName.data())}; // for kPolarization, kUPC const AxisSpec axis_phi_pol{ConfPolarizationPhiBins, Form("|#varphi^{%s}| (rad.)", frameName.data())}; // for kPolarization + const AxisSpec axis_quadmom{ConfPolarizationQuadMomBins, Form("#frac{3 cos^{2}(#theta^{%s}) -1}{2}", frameName.data())}; // for kPolarization const AxisSpec axis_aco{cfg_nbin_aco, 0, 1.f, "#alpha = 1 - #frac{|#varphi_{l^{+}} - #varphi_{l^{-}}|}{#pi}"}; // for kUPC const AxisSpec axis_asym_pt{cfg_nbin_asym_pt, 0, 1.f, "A = #frac{|p_{T,l^{+}} - p_{T,l^{-}}|}{|p_{T,l^{+}} + p_{T,l^{-}}|}"}; // for kUPC const AxisSpec axis_dphi_e_ee{cfg_nbin_dphi_e_ee, 0, M_PI, "#Delta#varphi = #varphi_{l} - #varphi_{ll} (rad.)"}; // for kUPC // generated info - fRegistry.add("Generated/sm/PromptPi0/hs", "generated dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_aco, axis_asym_pt, axis_dphi_e_ee}, true); + fRegistry.add("Generated/sm/PromptPi0/hs", "generated dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_quadmom, axis_aco, axis_asym_pt, axis_dphi_e_ee}, true); fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/NonPromptPi0/"); fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/Eta/"); fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/EtaPrime/"); @@ -387,7 +389,7 @@ struct DileptonMC { fRegistry.add("Generated/sm/Omega2ll/hPtY", "pT of #omega meson", kTH2D, {axis_y, axis_pt_meson}, true); fRegistry.add("Generated/sm/Phi2ll/hPtY", "pT of #phi meson", kTH2D, {axis_y, axis_pt_meson}, true); - fRegistry.add("Generated/ccbar/c2l_c2l/hadron_hadron/hs", "generated dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_aco, axis_asym_pt, axis_dphi_e_ee}, true); + fRegistry.add("Generated/ccbar/c2l_c2l/hadron_hadron/hs", "generated dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_quadmom, axis_aco, axis_asym_pt, axis_dphi_e_ee}, true); fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", "Generated/ccbar/c2l_c2l/meson_meson/"); fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", "Generated/ccbar/c2l_c2l/baryon_baryon/"); fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", "Generated/ccbar/c2l_c2l/meson_baryon/"); @@ -429,7 +431,7 @@ struct DileptonMC { } // reconstructed pair info - fRegistry.add("Pair/sm/Photon/hs", "rec. dilepton signal", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_dca}, true); + fRegistry.add("Pair/sm/Photon/hs", "rec. dilepton signal", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_quadmom, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_dca}, true); fRegistry.addClone("Pair/sm/Photon/", "Pair/sm/PromptPi0/"); fRegistry.addClone("Pair/sm/Photon/", "Pair/sm/NonPromptPi0/"); fRegistry.addClone("Pair/sm/Photon/", "Pair/sm/Eta/"); @@ -457,7 +459,7 @@ struct DileptonMC { fRegistry.add("Pair/sm/PromptJPsi/hDCAz1vsDCAz2", "DCA_{z,1} vs DCA_{z,2}", kTH2F, {axis_dca_track1, axis_dca_track2}, true); } - fRegistry.add("Pair/ccbar/c2l_c2l/hadron_hadron/hs", "hs pair", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_dca}, true); + fRegistry.add("Pair/ccbar/c2l_c2l/hadron_hadron/hs", "hs pair", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_quadmom, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_dca}, true); fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", "Pair/ccbar/c2l_c2l/meson_meson/"); fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", "Pair/ccbar/c2l_c2l/baryon_baryon/"); fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", "Pair/ccbar/c2l_c2l/meson_baryon/"); @@ -489,7 +491,7 @@ struct DileptonMC { } // for correlated bkg due to mis-identified hadrons, and true combinatorial bkg - fRegistry.add("Pair/corr_bkg_lh/uls/hs", "rec. bkg", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_dca}, true); + fRegistry.add("Pair/corr_bkg_lh/uls/hs", "rec. bkg", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_quadmom, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_dca}, true); fRegistry.addClone("Pair/corr_bkg_lh/uls/", "Pair/corr_bkg_lh/lspp/"); fRegistry.addClone("Pair/corr_bkg_lh/uls/", "Pair/corr_bkg_lh/lsmm/"); fRegistry.addClone("Pair/corr_bkg_lh/", "Pair/corr_bkg_hh/"); @@ -977,35 +979,36 @@ struct DileptonMC { } else if (cfgPolarizationFrame == 1) { o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, t1.sign(), cos_thetaPol, phiPol); } - o2::math_utils::bringToPMPi(phiPol); + o2::math_utils::bringTo02Pi(phiPol); + float quadmom = (3.f * std::pow(cos_thetaPol, 2) - 1.f) / 2.f; if ((FindCommonMotherFrom2ProngsWithoutPDG(t1mc, t2mc) > 0 || IsHF(t1mc, t2mc, mcparticles) > 0) && is_pair_from_same_mcevent) { // for bkg study if (std::abs(t1mc.pdgCode()) != pdg_lepton || std::abs(t2mc.pdgCode()) != pdg_lepton) { // hh or lh correlated bkg if (std::abs(t1mc.pdgCode()) != pdg_lepton && std::abs(t2mc.pdgCode()) != pdg_lepton) { // hh correlated bkg if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("Pair/corr_bkg_hh/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/corr_bkg_hh/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("Pair/corr_bkg_hh/lspp/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/corr_bkg_hh/lspp/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - fRegistry.fill(HIST("Pair/corr_bkg_hh/lsmm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/corr_bkg_hh/lsmm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } } else { // lh correlated bkg if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("Pair/corr_bkg_lh/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/corr_bkg_lh/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("Pair/corr_bkg_lh/lspp/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/corr_bkg_lh/lspp/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - fRegistry.fill(HIST("Pair/corr_bkg_lh/lsmm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/corr_bkg_lh/lsmm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } } } } else { // true combinatorial bkg if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("Pair/comb_bkg/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/comb_bkg/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("Pair/comb_bkg/lspp/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/comb_bkg/lspp/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - fRegistry.fill(HIST("Pair/comb_bkg/lsmm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/comb_bkg/lsmm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } } @@ -1034,14 +1037,14 @@ struct DileptonMC { switch (std::abs(mcmother.pdgCode())) { case 111: if (IsFromCharm(mcmother, mcparticles) < 0 && IsFromBeauty(mcmother, mcparticles) < 0) { // prompt pi0 - fRegistry.fill(HIST("Pair/sm/PromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/PromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/sm/PromptPi0/hDeltaPtvsDCA"), pair_dca, deltaPt1 + deltaPt2); fRegistry.fill(HIST("Pair/sm/PromptPi0/hMvsPhiV"), phiv, v12.M()); fRegistry.fill(HIST("Pair/sm/PromptPi0/hDCAz1vsDCAz2"), dcaZinSigma(t1), dcaZinSigma(t2)); } } else { // non-prompt pi0 - fRegistry.fill(HIST("Pair/sm/NonPromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/NonPromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/sm/NonPromptPi0/hDeltaPtvsDCA"), pair_dca, deltaPt1 + deltaPt2); fRegistry.fill(HIST("Pair/sm/NonPromptPi0/hMvsPhiV"), phiv, v12.M()); @@ -1049,34 +1052,34 @@ struct DileptonMC { } break; case 221: - fRegistry.fill(HIST("Pair/sm/Eta/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/Eta/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); break; case 331: - fRegistry.fill(HIST("Pair/sm/EtaPrime/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/EtaPrime/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); break; case 113: - fRegistry.fill(HIST("Pair/sm/Rho/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/Rho/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); break; case 223: - fRegistry.fill(HIST("Pair/sm/Omega/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/Omega/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if (mcmother.daughtersIds().size() == 2) { // omeag->ee - fRegistry.fill(HIST("Pair/sm/Omega2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/Omega2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } break; case 333: - fRegistry.fill(HIST("Pair/sm/Phi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/Phi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if (mcmother.daughtersIds().size() == 2) { // phi->ee - fRegistry.fill(HIST("Pair/sm/Phi2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/Phi2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } break; case 443: { if (IsFromBeauty(mcmother, mcparticles) > 0) { - fRegistry.fill(HIST("Pair/sm/NonPromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/NonPromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/sm/NonPromptJPsi/hDeltaPtvsDCA"), pair_dca, deltaPt1 + deltaPt2); } } else { - fRegistry.fill(HIST("Pair/sm/PromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/PromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/sm/PromptJPsi/hDeltaPtvsDCA"), pair_dca, deltaPt1 + deltaPt2); fRegistry.fill(HIST("Pair/sm/PromptJPsi/hDCAz1vsDCAz2"), dcaZinSigma(t1), dcaZinSigma(t2)); @@ -1086,9 +1089,9 @@ struct DileptonMC { } case 100443: { if (IsFromBeauty(mcmother, mcparticles) > 0) { - fRegistry.fill(HIST("Pair/sm/NonPromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/NonPromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else { - fRegistry.fill(HIST("Pair/sm/PromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/PromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } break; } @@ -1098,7 +1101,7 @@ struct DileptonMC { } else if (!(t1mc.isPhysicalPrimary() || t1mc.producedByGenerator()) && !(t2mc.isPhysicalPrimary() || t2mc.producedByGenerator())) { switch (std::abs(mcmother.pdgCode())) { case 22: - fRegistry.fill(HIST("Pair/sm/Photon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/Photon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/sm/Photon/hMvsPhiV"), phiv, v12.M()); float rxy_gen = std::sqrt(std::pow(t1mc.vx(), 2) + std::pow(t1mc.vy(), 2)); @@ -1117,105 +1120,105 @@ struct DileptonMC { if (t1mc.pdgCode() * t2mc.pdgCode() < 0) { // ULS switch (hfee_type) { case static_cast(EM_HFeeType::kCe_Ce): { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if (isCharmMeson(mp1) && isCharmMeson(mp2)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if (std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 411) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dplus_Dminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dplus_Dminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if (std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 421) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_D0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_D0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if (std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 431) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dsplus_Dsminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dsplus_Dsminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 421) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 421)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_D0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_D0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 431)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 431)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } } else if (isCharmBaryon(mp1) && isCharmBaryon(mp2)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if (std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4122) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcplus_Lcminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcplus_Lcminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if (std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4232) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicplus_Xicminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicplus_Xicminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if (std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4132) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xic0_Xic0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xic0_Xic0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if (std::abs(mp1.pdgCode()) == 4332 && std::abs(mp2.pdgCode()) == 4332) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Omegac0_Omegac0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Omegac0_Omegac0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4132 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xic0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xic0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } } else { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } } break; } case static_cast(EM_HFeeType::kBe_Be): { - fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if (isBeautyMeson(mp1) && isBeautyMeson(mp2)) { - fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if (isBeautyBaryon(mp1) && isBeautyBaryon(mp2)) { - fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else { - fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } break; } case static_cast(EM_HFeeType::kBCe_BCe): { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if (isCharmMeson(mp1) && isCharmMeson(mp2)) { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if (isCharmBaryon(mp1) && isCharmBaryon(mp2)) { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } break; } case static_cast(EM_HFeeType::kBCe_Be_SameB): { // ULS - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } break; } @@ -1240,13 +1243,13 @@ struct DileptonMC { LOGF(info, "You should not see kBCe_Be_SameB in LS. Good luck."); break; case static_cast(EM_HFeeType::kBCe_Be_DiffB): { // LS - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } else { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); } break; } @@ -1452,7 +1455,8 @@ struct DileptonMC { } else if (cfgPolarizationFrame == 1) { o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, -t1.pdgCode() / pdg_lepton, cos_thetaPol, phiPol); } - o2::math_utils::bringToPMPi(phiPol); + o2::math_utils::bringTo02Pi(phiPol); + float quadmom = (3.f * std::pow(cos_thetaPol, 2) - 1.f) / 2.f; // bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); if (!isInAcceptance(t1) || !isInAcceptance(t2)) { @@ -1466,45 +1470,45 @@ struct DileptonMC { switch (std::abs(mcmother.pdgCode())) { case 111: if (IsFromCharm(mcmother, mcparticles) < 0 && IsFromBeauty(mcmother, mcparticles) < 0) { // prompt pi0 - fRegistry.fill(HIST("Generated/sm/PromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/PromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else { // non-prompt pi0 - fRegistry.fill(HIST("Generated/sm/NonPromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/NonPromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } break; case 221: - fRegistry.fill(HIST("Generated/sm/Eta/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/Eta/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); break; case 331: - fRegistry.fill(HIST("Generated/sm/EtaPrime/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/EtaPrime/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); break; case 113: - fRegistry.fill(HIST("Generated/sm/Rho/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/Rho/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); break; case 223: - fRegistry.fill(HIST("Generated/sm/Omega/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/Omega/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); if (mcmother.daughtersIds().size() == 2) { // omega->ee - fRegistry.fill(HIST("Generated/sm/Omega2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/Omega2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } break; case 333: - fRegistry.fill(HIST("Generated/sm/Phi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/Phi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); if (mcmother.daughtersIds().size() == 2) { // phi->ee - fRegistry.fill(HIST("Generated/sm/Phi2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/Phi2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } break; case 443: { if (IsFromBeauty(mcmother, mcparticles) > 0) { - fRegistry.fill(HIST("Generated/sm/NonPromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/NonPromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/sm/PromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/PromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } break; } case 100443: { if (IsFromBeauty(mcmother, mcparticles) > 0) { - fRegistry.fill(HIST("Generated/sm/NonPromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/NonPromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/sm/PromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/PromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } break; } @@ -1517,105 +1521,105 @@ struct DileptonMC { auto mp2 = mcparticles.iteratorAt(t2.mothersIds()[0]); switch (hfee_type) { case static_cast(EM_HFeeType::kCe_Ce): { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); if (isCharmMeson(mp1) && isCharmMeson(mp2)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); if (std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 411) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dplus_Dminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dplus_Dminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if (std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 421) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_D0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_D0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if (std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 431) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dsplus_Dsminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dsplus_Dsminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 421) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 421)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_D0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_D0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 431)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 431)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } } else if (isCharmBaryon(mp1) && isCharmBaryon(mp2)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); if (std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4122) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcplus_Lcminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcplus_Lcminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if (std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4232) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicplus_Xicminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicplus_Xicminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if (std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4132) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xic0_Xic0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xic0_Xic0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if (std::abs(mp1.pdgCode()) == 4332 && std::abs(mp2.pdgCode()) == 4332) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Omegac0_Omegac0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Omegac0_Omegac0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4132 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xic0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xic0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } } else { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } } break; } case static_cast(EM_HFeeType::kBe_Be): { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); if (isBeautyMeson(mp1) && isBeautyMeson(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if (isBeautyBaryon(mp1) && isBeautyBaryon(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } break; } case static_cast(EM_HFeeType::kBCe_BCe): { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); if (isCharmMeson(mp1) && isCharmMeson(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if (isCharmBaryon(mp1) && isCharmBaryon(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } break; } case static_cast(EM_HFeeType::kBCe_Be_SameB): { // ULS - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } break; } @@ -1733,7 +1737,8 @@ struct DileptonMC { } else if (cfgPolarizationFrame == 1) { o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, -t1.pdgCode() / pdg_lepton, cos_thetaPol, phiPol); } - o2::math_utils::bringToPMPi(phiPol); + o2::math_utils::bringTo02Pi(phiPol); + float quadmom = (3.f * std::pow(cos_thetaPol, 2) - 1.f) / 2.f; // bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); if (!isInAcceptance(t1) || !isInAcceptance(t2)) { @@ -1757,13 +1762,13 @@ struct DileptonMC { LOGF(info, "You should not see kBCe_Be_SameB in LS++. Good luck."); break; case static_cast(EM_HFeeType::kBCe_Be_DiffB): { // LS - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } break; } @@ -1878,7 +1883,8 @@ struct DileptonMC { } else if (cfgPolarizationFrame == 1) { o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, -t1.pdgCode() / pdg_lepton, cos_thetaPol, phiPol); } - o2::math_utils::bringToPMPi(phiPol); + o2::math_utils::bringTo02Pi(phiPol); + float quadmom = (3.f * std::pow(cos_thetaPol, 2) - 1.f) / 2.f; // bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); if (!isInAcceptance(t1) || !isInAcceptance(t2)) { @@ -1902,13 +1908,13 @@ struct DileptonMC { LOGF(info, "You should not see kBCe_Be_SameB in LS--. Good luck."); break; case static_cast(EM_HFeeType::kBCe_Be_DiffB): { // LS - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaPol), std::fabs(phiPol), aco, asym, std::fabs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); } break; } From 34e45a7b15369184cb71c39f1d4895bdf0639c36 Mon Sep 17 00:00:00 2001 From: Gyula Bencedi Date: Sun, 28 Sep 2025 19:01:30 +0200 Subject: [PATCH 561/986] [PWGLF] Added extra track selection (#13162) --- .../GlobalEventProperties/flattenictyPikp.cxx | 98 +++++++++++++------ 1 file changed, 66 insertions(+), 32 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx b/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx index c6bc03db737..29334ce4009 100644 --- a/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx @@ -138,7 +138,8 @@ enum TrkSel { trkSelPt, trkSelDCA, trkNRowsTPC, - trkSelNCls, + trkSelNClsFound, + trkSelNClsPID, trkSelTPCBndr, nTrkSel }; @@ -148,6 +149,7 @@ enum V0Sel { v0SelEta, v0SelDaughters, v0SelTPCnClsFound, + v0SelTPCnClsPID, v0SelRejectV0sAtTPCSector, v0SelRejectSameSign, v0SelDCAv0daughter, @@ -277,7 +279,9 @@ struct FlattenictyPikp { Configurable cfgTrkEtaMax{"cfgTrkEtaMax", 0.8f, "Eta range for tracks"}; Configurable cfgRapMax{"cfgRapMax", 0.5f, "Maximum range of rapidity for tracks"}; Configurable cfgTrkPtMin{"cfgTrkPtMin", 0.15f, "Minimum pT of tracks"}; - Configurable cfgNclTPCMin{"cfgNclTPCMin", 100.0f, "Minimum of number of TPC clusters"}; + Configurable cfgNclTPCMin{"cfgNclTPCMin", 80.0f, "Minimum of number of TPC found clusters"}; + Configurable cfgApplyNclPID{"cfgApplyNclPID", true, "Apply cut on TPC PID clusters"}; + Configurable cfgNclPidTPCMin{"cfgNclPidTPCMin", 130.0f, "Minimum of number of TPC PID clusters"}; Configurable cfgPhiCutPtMin{"cfgPhiCutPtMin", 2.0f, "Minimum pT for phi cut"}; Configurable cfgTOFBetaPion{"cfgTOFBetaPion", 1.0f, "Minimum beta for TOF pions"}; Configurable cfgTofBetaPiMax{"cfgTofBetaPiMax", 5E-5, "Maximum beta for TOF pion selection"}; @@ -309,7 +313,9 @@ struct FlattenictyPikp { ConfigurableAxis axisArmPodqT{"axisArmPodqT", {600, 0.0f, 0.3f}, "Armenteros-Podolanski qT"}; // standad parameters for V0 selection Configurable cfgV0etamax{"cfgV0etamax", 0.8f, "max eta of V0s"}; - Configurable cfgTPCnClsmin{"cfgTPCnClsmin", 70.0f, "cfgTPCnClsmin"}; + Configurable cfgTPCnClsmin{"cfgTPCnClsmin", 80.0f, "Minimum of number of TPC found clusters"}; + Configurable cfgApplyV0sNclPID{"cfgApplyV0sNclPID", true, "Apply cut on TPC PID clusters"}; + Configurable cfgTPCnClsPidmin{"cfgTPCnClsPidmin", 130.0f, "Minimum of number of TPC PID clusters"}; Configurable cfgDCAv0daughter{"cfgDCAv0daughter", 1.0, "max DCA of V0 daughter tracks (cm)"}; Configurable cfgv0cospa{"cfgv0cospa", 0.995, "min V0 CosPA"}; Configurable cfgDCAposToPV{"cfgDCAposToPV", 0.05f, "min DCA Pos To PV (cm)"}; @@ -509,7 +515,8 @@ struct FlattenictyPikp { flatchrg.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelPt + 1, "Pt"); flatchrg.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelDCA + 1, "DCA"); flatchrg.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkNRowsTPC + 1, "trkNRowsTPC"); - flatchrg.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelNCls + 1, "NClsTPC"); + flatchrg.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelNClsFound + 1, "NClsTPCFound"); + flatchrg.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelNClsPID + 1, "NClsTPCPid"); flatchrg.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelTPCBndr + 1, "TPC Boundary"); // V0 counter flatchrg.add("Tracks/V0qa/hV0Sel", "Number of V0s; Cut; #Tracks Passed Cut", {kTH1F, {{nV0Sel + 1, 0, nV0Sel + 1}}}); @@ -517,6 +524,7 @@ struct FlattenictyPikp { flatchrg.get(HIST("Tracks/V0qa/hV0Sel"))->GetXaxis()->SetBinLabel(v0SelEta + 1, "Eta"); flatchrg.get(HIST("Tracks/V0qa/hV0Sel"))->GetXaxis()->SetBinLabel(v0SelDaughters + 1, "V0 daughters' sel."); flatchrg.get(HIST("Tracks/V0qa/hV0Sel"))->GetXaxis()->SetBinLabel(v0SelTPCnClsFound + 1, "TPC nCls found"); + flatchrg.get(HIST("Tracks/V0qa/hV0Sel"))->GetXaxis()->SetBinLabel(v0SelTPCnClsPID + 1, "TPC nCls PID"); flatchrg.get(HIST("Tracks/V0qa/hV0Sel"))->GetXaxis()->SetBinLabel(v0SelRejectV0sAtTPCSector + 1, "Reject V0s at TPC sector"); flatchrg.get(HIST("Tracks/V0qa/hV0Sel"))->GetXaxis()->SetBinLabel(v0SelRejectSameSign + 1, "Reject same sign"); flatchrg.get(HIST("Tracks/V0qa/hV0Sel"))->GetXaxis()->SetBinLabel(v0SelDCAv0daughter + 1, "DCA v0 daughter"); @@ -544,18 +552,24 @@ struct FlattenictyPikp { flatchrg.add("Tracks/postSel/hDCAZvsPt", "", kTH2F, {ptAxis, dcaZAxis}); // tpc if (cfgStoreThnSparse) { - flatchrg.add("Tracks/postSel/hPtPhiTPCCluster", "; #it{p}_{T} (GeV/#it{c}); fmod(#varphi,#pi/9); N_{cluster}", {kTHnSparseF, {ptAxis, phiAxisMod, clTpcAxis}}); + flatchrg.add("Tracks/postSel/hPtPhiNclTPC", "; #it{p}_{T} (GeV/#it{c}); fmod(#varphi,#pi/9); N_{cluster}", {kTHnSparseF, {ptAxis, phiAxisMod, clTpcAxis}}); + flatchrg.add("Tracks/postSel/hPtPhiNclPIDTPC", "; #it{p}_{T} (GeV/#it{c}); fmod(#varphi,#pi/9); N_{PID cluster}", {kTHnSparseF, {ptAxis, phiAxisMod, clTpcAxis}}); } else { - flatchrg.add("Tracks/postSel/hPtPhiTPCCluster", "; #it{p}_{T} (GeV/#it{c}); fmod(#varphi,#pi/9); N_{cluster}", {kTH2F, {ptAxis, phiAxisMod}}); + flatchrg.add("Tracks/postSel/hPtPhiNclTPC", "; #it{p}_{T} (GeV/#it{c}); fmod(#varphi,#pi/9); N_{cluster}", {kTH3F, {ptAxis, phiAxisMod, clTpcAxis}}); + flatchrg.add("Tracks/postSel/hPtPhiNclPIDTPC", "; #it{p}_{T} (GeV/#it{c}); fmod(#varphi,#pi/9); N_{PID cluster}", {kTH3F, {ptAxis, phiAxisMod, clTpcAxis}}); } + flatchrg.add("Tracks/postSel/hPtNclTPC", "; #it{p}_{T} (GeV/#it{c}); N_{cluster}", {kTH2F, {ptAxis, clTpcAxis}}); + flatchrg.add("Tracks/postSel/pPtNclTPC", "; #it{p}_{T} (GeV/#it{c}); N_{cluster}", {kTProfile, {ptAxis}}); + flatchrg.add("Tracks/postSel/hPtNclPIDTPC", "; #it{p}_{T} (GeV/#it{c}); N_{PID cluster}", {kTH2F, {ptAxis, clTpcAxis}}); + flatchrg.add("Tracks/postSel/pPtNclPIDTPC", "; #it{p}_{T} (GeV/#it{c}); N_{PID cluster}", {kTProfile, {ptAxis}}); flatchrg.add("Tracks/postSel/hShTpcClvsPt", "", {kTH2F, {ptAxis, shCluserAxis}}); - flatchrg.add("Tracks/postSel/hCrossTPCvsPt", "", {kTH2F, {ptAxis, clTpcAxis}}); + flatchrg.add("Tracks/postSel/hNclTPCFoundvsPt", "", {kTH2F, {ptAxis, clTpcAxis}}); flatchrg.add("Tracks/postSel/hTPCCluster", "N_{cluster}", kTH1F, {clTpcAxis}); - flatchrg.add("Tracks/postSel/tpcNClsShared", " ; # shared TPC clusters TPC", kTH1F, {{165, -0.5, 164.5}}); - flatchrg.add("Tracks/postSel/tpcCrossedRows", " ; # crossed TPC rows", kTH1F, {{165, -0.5, 164.5}}); - flatchrg.add("Tracks/postSel/tpcCrossedRowsOverFindableCls", " ; crossed rows / findable TPC clusters", kTH1F, {{60, 0.7, 1.3}}); + flatchrg.add("Tracks/postSel/hTPCnClsShared", " ; # shared TPC clusters TPC", kTH1F, {{165, -0.5, 164.5}}); + flatchrg.add("Tracks/postSel/hTPCcrossedRows", " ; # crossed TPC rows", kTH1F, {{165, -0.5, 164.5}}); + flatchrg.add("Tracks/postSel/hTPCcrossedRowsOverFindableCls", " ; crossed rows / findable TPC clusters", kTH1F, {{60, 0.7, 1.3}}); // its - flatchrg.add("Tracks/postSel/itsNCls", " ; # ITS clusters", kTH1F, {{8, -0.5, 7.5}}); + flatchrg.add("Tracks/postSel/hITSnCls", " ; # ITS clusters", kTH1F, {{8, -0.5, 7.5}}); flatchrg.add("Tracks/postSel/hChi2ITSTrkSegment", "chi2ITS", kTH1F, {{100, -0.5, 99.5}}); // tof flatchrg.add("Tracks/postSel/hTOFPvsBeta", "Beta from TOF; #it{p} (GeV/#it{c}); #beta", {kTH2F, {pAxis, {120, 0.0, 1.2}}}); @@ -640,13 +654,13 @@ struct FlattenictyPikp { flatchrg.add({"Tracks/CleanV0/pos/hPiV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {kTHnSparseF, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); flatchrg.add({"Tracks/CleanV0/pos/hPV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {kTHnSparseF, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); } else { - flatchrg.add("Tracks/CleanTof/all/hBetaVsP", ";Momentum (GeV/#it{c}); #beta", kTH2F, {{{ptAxisV0s}, {120, 0., 1.2}}}); - flatchrg.add("Tracks/CleanTof/all/hTofExpPi", ";Momentum (GeV/#it{c});#it{t}^{#pi}_{Exp}/#it{t}_{TOF}", kTH2F, {{{ptAxisV0s}, {100, 0.2, 1.2}}}); flatchrg.add({"Tracks/CleanTof/all/hPiTof", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {kTH3F, {etaAxis, pAxis, dEdxAxis}}}); flatchrg.add({"Tracks/CleanV0/pos/hEV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {kTH3F, {etaAxis, pAxis, dEdxAxis}}}); flatchrg.add({"Tracks/CleanV0/pos/hPiV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {kTH3F, {etaAxis, pAxis, dEdxAxis}}}); flatchrg.add({"Tracks/CleanV0/pos/hPV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {kTH3F, {etaAxis, pAxis, dEdxAxis}}}); } + flatchrg.add("Tracks/CleanTof/all/hBetaVsP", ";Momentum (GeV/#it{c}); #beta", kTH2F, {{{ptAxisV0s}, {120, 0., 1.2}}}); + flatchrg.add("Tracks/CleanTof/all/hTofExpPi", ";Momentum (GeV/#it{c});#it{t}^{#pi}_{Exp}/#it{t}_{TOF}", kTH2F, {{{ptAxisV0s}, {100, 0.2, 1.2}}}); flatchrg.addClone("Tracks/CleanV0/pos/", "Tracks/CleanV0/neg/"); if (cfgFillChrgType) { flatchrg.addClone("Tracks/CleanTof/all/", "Tracks/CleanTof/pos/"); @@ -879,9 +893,9 @@ struct FlattenictyPikp { const float trkLength = track.length(); const float tExpPiTOF = track.tofExpSignalPi(tTOF); if (track.p() >= trkSelOpt.cfgMomSelPiTOF && trkLength > kNull && tTOF > kNull) { - flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[kAll]) + HIST("hTofExpPi"), track.p(), tExpPiTOF / tTOF); + flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[chrg]) + HIST("hTofExpPi"), track.p(), tExpPiTOF / tTOF); if (std::abs((tExpPiTOF / tTOF) - kOne) < trkSelOpt.cfgTofBetaPiMax) { - flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[kAll]) + HIST("hBetaVsP"), track.p(), track.beta()); + flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[chrg]) + HIST("hBetaVsP"), track.p(), track.beta()); // if (std::abs(track.tpcNSigmaPi()) < v0SelOpt.cfgNsigmaPiTPC && std::abs(track.tofNSigmaPi()) < v0SelOpt.cfgNsigmaPiTOF) { return true; // } @@ -1138,9 +1152,15 @@ struct FlattenictyPikp { flatchrg.fill(HIST("Tracks/preSel/hPtPhi"), track.pt(), phimodn); if (track.hasTPC() && track.hasITS()) { if (cfgStoreThnSparse) { - flatchrg.fill(HIST("Tracks/preSel/hPtPhiTPCCluster"), track.pt(), phimodn, track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()); + flatchrg.fill(HIST("Tracks/preSel/hPtPhiNclTPC"), track.pt(), phimodn, track.tpcNClsFound()); + flatchrg.fill(HIST("Tracks/preSel/hPtPhiNclPIDTPC"), track.pt(), phimodn, track.tpcNClsPID()); } else { - flatchrg.fill(HIST("Tracks/preSel/hPtPhiTPCCluster"), track.pt(), phimodn); + flatchrg.fill(HIST("Tracks/preSel/hPtPhiNclTPC"), track.pt(), phimodn, track.tpcNClsFound()); + flatchrg.fill(HIST("Tracks/preSel/hPtNclTPC"), track.pt(), track.tpcNClsFound()); + flatchrg.fill(HIST("Tracks/preSel/pPtNclTPC"), track.pt(), track.tpcNClsFound()); + flatchrg.fill(HIST("Tracks/preSel/hPtPhiNclPIDTPC"), track.pt(), phimodn, track.tpcNClsPID()); + flatchrg.fill(HIST("Tracks/preSel/hPtNclPIDTPC"), track.pt(), track.tpcNClsPID()); + flatchrg.fill(HIST("Tracks/preSel/pPtNclPIDTPC"), track.pt(), track.tpcNClsPID()); } } } @@ -1151,9 +1171,15 @@ struct FlattenictyPikp { flatchrg.fill(HIST("Tracks/postSel/hPtPhi"), track.pt(), phimodn); if (track.hasTPC() && track.hasITS()) { if (cfgStoreThnSparse) { - flatchrg.fill(HIST("Tracks/postSel/hPtPhiTPCCluster"), track.pt(), phimodn, track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()); + flatchrg.fill(HIST("Tracks/postSel/hPtPhiNclTPC"), track.pt(), phimodn, track.tpcNClsFound()); + flatchrg.fill(HIST("Tracks/postSel/hPtPhiNclPIDTPC"), track.pt(), phimodn, track.tpcNClsPID()); } else { - flatchrg.fill(HIST("Tracks/postSel/hPtPhiTPCCluster"), track.pt(), phimodn); + flatchrg.fill(HIST("Tracks/postSel/hPtPhiNclTPC"), track.pt(), phimodn, track.tpcNClsFound()); + flatchrg.fill(HIST("Tracks/postSel/hPtNclTPC"), track.pt(), track.tpcNClsFound()); + flatchrg.fill(HIST("Tracks/postSel/pPtNclTPC"), track.pt(), track.tpcNClsFound()); + flatchrg.fill(HIST("Tracks/postSel/hPtPhiNclPIDTPC"), track.pt(), phimodn, track.tpcNClsPID()); + flatchrg.fill(HIST("Tracks/postSel/hPtNclPIDTPC"), track.pt(), track.tpcNClsPID()); + flatchrg.fill(HIST("Tracks/postSel/pPtNclPIDTPC"), track.pt(), track.tpcNClsPID()); } } } @@ -1180,11 +1206,15 @@ struct FlattenictyPikp { return false; } flatchrg.fill(HIST("Tracks/hTrkSel"), trkNRowsTPC); - auto nClusterTPC = track.tpcNClsFindable() - track.tpcNClsFindableMinusFound(); - if (nClusterTPC < trkSelOpt.cfgNclTPCMin) { + if (track.tpcNClsFound() < trkSelOpt.cfgNclTPCMin) { return false; } - flatchrg.fill(HIST("Tracks/hTrkSel"), trkSelNCls); + flatchrg.fill(HIST("Tracks/hTrkSel"), trkSelNClsFound); + + if (trkSelOpt.cfgApplyNclPID && track.tpcNClsPID() < trkSelOpt.cfgNclPidTPCMin) { + return false; + } + flatchrg.fill(HIST("Tracks/hTrkSel"), trkSelNClsPID); if (trkSelOpt.cfgRejectTrkAtTPCSector && !phiCut(track, magfield, fPhiCutLow, fPhiCutHigh)) { return false; } @@ -1306,6 +1336,13 @@ struct FlattenictyPikp { return false; } flatchrg.fill(HIST("Tracks/V0qa/hV0Sel"), v0SelTPCnClsFound); + + if (v0SelOpt.cfgApplyV0sNclPID) { + if (posTrack.tpcNClsPID() < v0SelOpt.cfgTPCnClsPidmin || negTrack.tpcNClsPID() < v0SelOpt.cfgTPCnClsPidmin) { + return false; + } + } + flatchrg.fill(HIST("Tracks/V0qa/hV0Sel"), v0SelTPCnClsPID); if (v0SelOpt.cfgRejectV0sAtTPCSector) { if (!(phiCut(posTrack, magfield, fPhiCutLow, fPhiCutHigh) && phiCut(negTrack, magfield, fPhiCutLow, fPhiCutHigh))) { return false; @@ -1409,17 +1446,15 @@ struct FlattenictyPikp { flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("hDCAZvsPt"), track.pt(), track.dcaZ()); if (track.hasTPC() && track.hasITS()) { - int nFindable = track.tpcNClsFindable(); - int nMinusFound = track.tpcNClsFindableMinusFound(); - int nCluster = nFindable - nMinusFound; - flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("hTPCCluster"), nCluster); + flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("hTPCCluster"), track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()); flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("hShTpcClvsPt"), track.pt(), track.tpcFractionSharedCls()); - flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("hCrossTPCvsPt"), track.pt(), track.tpcNClsFound()); - flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("tpcNClsShared"), track.tpcNClsShared()); - flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("tpcCrossedRows"), track.tpcNClsCrossedRows()); - flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("tpcCrossedRowsOverFindableCls"), track.tpcCrossedRowsOverFindableCls()); + flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("hNclTPCFoundvsPt"), track.pt(), track.tpcNClsFound()); + flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("hNClTPCPidvsPt"), track.pt(), track.tpcNClsPID()); + flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("hTPCnClsShared"), track.tpcNClsShared()); + flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("hTPCcrossedRows"), track.tpcNClsCrossedRows()); + flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("hTPCcrossedRowsOverFindableCls"), track.tpcCrossedRowsOverFindableCls()); flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("hChi2ITSTrkSegment"), track.itsChi2NCl()); - flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("itsNCls"), track.itsNCls()); + flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("hITSnCls"), track.itsNCls()); } flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("hTOFPvsBeta"), track.tpcInnerParam(), track.beta()); @@ -1441,7 +1476,6 @@ struct FlattenictyPikp { { const float mult = getMult(collision); const float flat = fillFlat(collision); - // float dEdx = track.tpcSignal(); if constexpr (fillHist) { if (track.tpcInnerParam() >= trkSelOpt.cfgMomMIPMin && track.tpcInnerParam() <= trkSelOpt.cfgMomMIPMax) { if (dEdx > trkSelOpt.cfgDeDxMIPMin && dEdx < trkSelOpt.cfgDeDxMIPMax) { // MIP pions From f07cc0120f6bdc9ef2100170b8bfe5560c3c6c26 Mon Sep 17 00:00:00 2001 From: Anantha Padmanabhan M Nair <82643666+ananthapadmanabhan18@users.noreply.github.com> Date: Sun, 28 Sep 2025 14:27:04 -0400 Subject: [PATCH 562/986] [PWGUD] Added MC truth process (#13149) --- PWGUD/Tasks/exclusiveRhoTo4Pi.cxx | 192 +++++++++++++++++------------- 1 file changed, 107 insertions(+), 85 deletions(-) diff --git a/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx b/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx index 5d9ffdb9f1c..b19fc4c2d30 100644 --- a/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx +++ b/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx @@ -58,6 +58,11 @@ struct ExclusiveRhoTo4Pi { int numPiPlus = 2; int numPiMinus = 2; double mRho0 = 0.77526; // GeV/c^2 + int rhoPrime = 30113; + // Pb-Pb at 5.36 TeV + double halfSqrtSnn = 2680.; + double massOfLead208 = 193.6823; + double momentumBeam = std::sqrt(halfSqrtSnn * halfSqrtSnn * 208 * 208 - massOfLead208 * massOfLead208); // Run Numbers static int runNos[113]; static int numRunNums; @@ -67,6 +72,7 @@ struct ExclusiveRhoTo4Pi { HistogramRegistry histosPID{"PID", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry histosKin{"Kinematics", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry histos4piKin{"Four-Pion-Kinematics", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry histosMCtruth{"MC-Truth", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; // Configurable Event parameters Configurable ifUPC{"ifUPC", 1, "Enable UPC reconstruction only"}; Configurable vZCut{"vZCut", 10., "Vertex Cut"}; @@ -150,7 +156,7 @@ struct ExclusiveRhoTo4Pi { histosQA.add("Tracks/all/dcaZ", "dcaZ; dcaZ [cm]; Counts", kTH1F, {{2000, -0.1, 0.1}}); histosQA.add("Tracks/all/itsChi2NCl", "ITS Chi2/NCl; Chi2/NCl; Counts", kTH1F, {{250, 0, 50}}); histosQA.add("Tracks/all/itsChi2", "ITS Chi2; ITS Chi2; Counts", kTH1F, {{500, 0, 50}}); - histosQA.add("Tracks/all/tpcChi2NCl", "TPC Chi2/NCl; Chi2/NCl; Counts", kTH1F, {{250, 0, 50}}); + histosQA.add("Tracks/all/tpcChi2NCl", "TPC Chi2/NCl; Chi2/NCl; Counts", kTH1F, {{250, 0, 10}}); histosQA.add("Tracks/all/tpcNClsFindable", "TPC N Cls Findable; N Cls Findable; Counts", kTH1F, {{200, 0, 200}}); // QA plots: Selected tracks in selected events histosQA.add("Tracks/selected/dcaXY", "dcaXY; dcaXY [cm]; Counts", kTH1F, {{2000, -0.1, 0.1}}); @@ -175,65 +181,71 @@ struct ExclusiveRhoTo4Pi { histosQA.add("Tracks/pions-from-4pi/tpcNClsFindable", "TPC N Cls Findable; N Cls Findable; Counts", kTH1F, {{200, 0, 200}}); // QA plots: PID- All tracks histosPID.add("all/tpcSignal", "TPC dEdx vs p; p [GeV/c]; dEdx [a.u.]", kTH2F, {{500, 0, 10}, {5000, 0.0, 5000.0}}); - histosPID.add("all/tpcNSigmaPi", "TPC nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("all/tpcNSigmaKa", "TPC nSigma Kaon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("all/tpcNSigmaPr", "TPC nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("all/tpcNSigmaEl", "TPC nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("all/tpcNSigmaMu", "TPC nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("all/tofBeta", "TOF beta vs p; p [GeV/c]; #beta", kTH2F, {{500, 0, 10}, {500, 0.0, 1.0}}); - histosPID.add("all/tofNSigmaPi", "TOF nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("all/tofNSigmaKa", "TOF nSigma Kaon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("all/tofNSigmaPr", "TOF nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("all/tofNSigmaEl", "TOF nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("all/tofNSigmaMu", "TOF nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("all/tpcNSigmaPi", "TPC nSigma Pion for all tracks in selected events; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("all/tpcNSigmaKa", "TPC nSigma Kaon for all tracks in selected events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("all/tpcNSigmaPr", "TPC nSigma Proton for all tracks in selected events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("all/tpcNSigmaEl", "TPC nSigma Electron for all tracks in selected events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("all/tpcNSigmaMu", "TPC nSigma Muon for all tracks in selected events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("all/tofBeta", "TOF beta vs p ; p [GeV/c]; #beta", kTH2F, {{500, 0, 10}, {500, 0.0, 1.0}}); + histosPID.add("all/tofNSigmaPi", "TOF nSigma Pion for all tracks in selected events; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("all/tofNSigmaKa", "TOF nSigma Kaon for all tracks in selected events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("all/tofNSigmaPr", "TOF nSigma Proton for all tracks in selected events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("all/tofNSigmaEl", "TOF nSigma Electron for all tracks in selected events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("all/tofNSigmaMu", "TOF nSigma Muon for all tracks in selected events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); // QA plots: PID- Selected tracks histosPID.add("selected/tpcSignal", "TPC dEdx vs p; p [GeV/c]; dEdx [a.u.]", kTH2F, {{500, 0, 10}, {5000, 0.0, 5000.0}}); - histosPID.add("selected/tpcNSigmaPi", "TPC nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("selected/tpcNSigmaKa", "TPC nSigma Kaon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("selected/tpcNSigmaPr", "TPC nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("selected/tpcNSigmaEl", "TPC nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("selected/tpcNSigmaMu", "TPC nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("selected/tpcNSigmaPi", "TPC nSigma Pion for all selected tracks in selected events; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("selected/tpcNSigmaKa", "TPC nSigma Kaon for all selected tracks in selected events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("selected/tpcNSigmaPr", "TPC nSigma Proton for all selected tracks in selected events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("selected/tpcNSigmaEl", "TPC nSigma Electron for all selected tracks in selected events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("selected/tpcNSigmaMu", "TPC nSigma Muon for all selected tracks in selected events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); histosPID.add("selected/tofBeta", "TOF beta vs p; p [GeV/c]; #beta", kTH2F, {{500, 0, 10}, {500, 0.0, 1.0}}); - histosPID.add("selected/tofNSigmaPi", "TOF nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("selected/tofNSigmaKa", "TOF nSigma Kaon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("selected/tofNSigmaPr", "TOF nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("selected/tofNSigmaEl", "TOF nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("selected/tofNSigmaMu", "TOF nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("selected/tofNSigmaPi", "TOF nSigma Pion for all selected tracks in selected events; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("selected/tofNSigmaKa", "TOF nSigma Kaon for all selected tracks in selected events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("selected/tofNSigmaPr", "TOF nSigma Proton for all selected tracks in selected events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("selected/tofNSigmaEl", "TOF nSigma Electron for all selected tracks in selected events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("selected/tofNSigmaMu", "TOF nSigma Muon for all selected tracks in selected events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); // QA plots: PID- Pion tracks histosPID.add("pions/tpcSignal", "TPC dEdx vs p; p [GeV/c]; dEdx [a.u.]", kTH2F, {{500, 0, 10}, {5000, 0.0, 5000.0}}); - histosPID.add("pions/tpcNSigmaPi", "TPC nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("pions/tpcNSigmaKa", "TPC nSigma Kaon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("pions/tpcNSigmaPr", "TPC nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("pions/tpcNSigmaEl", "TPC nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("pions/tpcNSigmaMu", "TPC nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions/tpcNSigmaPi", "TPC nSigma Pion for all selected pions in selected events; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions/tpcNSigmaKa", "TPC nSigma Kaon for all selected pions in selected events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions/tpcNSigmaPr", "TPC nSigma Proton for all selected pions in selected events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions/tpcNSigmaEl", "TPC nSigma Electron for all selected pions in selected events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions/tpcNSigmaMu", "TPC nSigma Muon for all selected pions in selected events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); histosPID.add("pions/tofBeta", "TOF beta vs p; p [GeV/c]; #beta", kTH2F, {{500, 0, 10}, {500, 0.0, 1.0}}); - histosPID.add("pions/tofNSigmaPi", "TOF nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("pions/tofNSigmaKa", "TOF nSigma Kaon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("pions/tofNSigmaPr", "TOF nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("pions/tofNSigmaEl", "TOF nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("pions/tofNSigmaMu", "TOF nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions/tofNSigmaPi", "TOF nSigma Pion for all selected pions in selected events; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions/tofNSigmaKa", "TOF nSigma Kaon for all selected pions in selected events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions/tofNSigmaPr", "TOF nSigma Proton for all selected pions in selected events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions/tofNSigmaEl", "TOF nSigma Electron for all selected pions in selected events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions/tofNSigmaMu", "TOF nSigma Muon for all selected pions in selected events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); // QA plots: PID- Pion tracks from 4pi events histosPID.add("pions-from-4pi/tpcSignal", "TPC dEdx vs p; p [GeV/c]; dEdx [a.u.]", kTH2F, {{500, 0, 10}, {5000, 0.0, 5000.0}}); - histosPID.add("pions-from-4pi/tpcNSigmaPi", "TPC nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("pions-from-4pi/tpcNSigmaKa", "TPC nSigma Kaon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("pions-from-4pi/tpcNSigmaPr", "TPC nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("pions-from-4pi/tpcNSigmaEl", "TPC nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("pions-from-4pi/tpcNSigmaMu", "TPC nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions-from-4pi/tpcNSigmaPi", "TPC nSigma Pion for all pions from 4-pi events; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions-from-4pi/tpcNSigmaKa", "TPC nSigma Kaon for all pions from 4-pi events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions-from-4pi/tpcNSigmaPr", "TPC nSigma Proton for all pions from 4-pi events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions-from-4pi/tpcNSigmaEl", "TPC nSigma Electron for all pions from 4-pi events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions-from-4pi/tpcNSigmaMu", "TPC nSigma Muon for all pions from 4-pi events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); histosPID.add("pions-from-4pi/tofBeta", "TOF beta vs p; p [GeV/c]; #beta", kTH2F, {{500, 0, 10}, {500, 0.0, 1.0}}); - histosPID.add("pions-from-4pi/tofNSigmaPi", "TOF nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("pions-from-4pi/tofNSigmaKa", "TOF nSigma Kaon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("pions-from-4pi/tofNSigmaPr", "TOF nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("pions-from-4pi/tofNSigmaEl", "TOF nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosPID.add("pions-from-4pi/tofNSigmaMu", "TOF nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions-from-4pi/tofNSigmaPi", "TOF nSigma Pion for all pions from 4-pi events; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions-from-4pi/tofNSigmaKa", "TOF nSigma Kaon for all pions from 4-pi eventsn; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions-from-4pi/tofNSigmaPr", "TOF nSigma Proton for all pions from 4-pi events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions-from-4pi/tofNSigmaEl", "TOF nSigma Electron for all pions from 4-pi events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); + histosPID.add("pions-from-4pi/tofNSigmaMu", "TOF nSigma for all pions from 4-pi events; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); // Kinematics for all particles histosKin.add("all", ";pT [GeV/c]; #eta;#varphi", kTH3F, {pTAxis, etaAxis, phiAxis}); histosKin.add("selected", ";pT [GeV/c]; #eta;#varphi", kTH3F, {pTAxis, etaAxis, phiAxis}); histosKin.add("pions", ";pT [GeV/c]; #eta;#varphi", kTH3F, {pTAxis, etaAxis, phiAxis}); histosKin.add("pions-from-4pi", ";pT [GeV/c]; #eta;#varphi;y ", kTHnSparseF, {pTAxis, etaAxis, phiAxis, rapidityAxis}); // Rho Prime Kinematics - histos4piKin.add("two-pion-mass", ";m_{#pi^{+}#pi^{-}} [GeV/c^2];m_{#pi^{+}#pi^{-}} [GeV/c^2];m_{#pi^{+}#pi^{-}} [GeV/c^2];m_{#pi^{+}#pi^{-}} [GeV/c^2]", kTHnSparseF, {{100, 0, 2}, {100, 0, 2}, {100, 0, 2}, {100, 0, 2}}); + histos4piKin.add("two-pion-mass", ";m_{#pi^{+}#pi^{-}} [GeV/c^2];m_{#pi^{+}#pi^{-}} [GeV/c^2];m_{#pi^{+}#pi^{-}} [GeV/c^2];m_{#pi^{+}#pi^{-}} [GeV/c^2];m_{4#pi} [GeV/c^{2}]", kTHnSparseF, {{100, 0, 2}, {100, 0, 2}, {100, 0, 2}, {100, 0, 2}, invMassAxis}); + histos4piKin.add("2PiPlusPiMinusMass", ";m_{#pi^{+}#pi^{+}#pi^{-}} [GeV/c^2];m_{#pi^{+}#pi^{+}#pi^{-}} [GeV/c^2];m_{#pi^{+}#pi^{-}#pi^{+}}#pi^{-}} [GeV/c^2]", kTHnSparseF, {{200, 0, 2.5}, {200, 0, 2.5}, invMassAxis}); + histos4piKin.add("2PiMinusPiPlusMass", ";m_{#pi^{-}#pi^{-}#pi^{+}} [GeV/c^2];m_{#pi^{-}#pi^{-}#pi^{+}} [GeV/c^2];m_{#pi^{+}#pi^{-}#pi^{+}}#pi^{-}} [GeV/c^2]", kTHnSparseF, {{200, 0, 2.5}, {200, 0, 2.5}, invMassAxis}); histos4piKin.add("zero-charge", ";pT [GeV/c]; #eta; #varphi [rad];y; m_{4#pi} [GeV/c^{2}]; Collin-Soper cos(#theta); Collin-Soper #varphi [rad];Run Number", kTHnSparseF, {pTAxis, etaAxis, phiAxis, rapidityAxis, invMassAxis, cosThetaAxis, phiAxis, {113, 0, 113}}); histos4piKin.add("non-zero-charge", ";pT [GeV/c]; #eta; #varphi [rad];y; m_{4#pi} [GeV/c^{2}];Run Number", kTHnSparseF, {pTAxis, etaAxis, phiAxis, rapidityAxis, invMassAxis, {113, 0, 113}}); + // MC truth + histosMCtruth.add("pions-from-4pi", ";pT [GeV/c]; #eta;#varphi;y ", kTHnSparseF, {pTAxis, etaAxis, phiAxis, rapidityAxis, {113, 0, 113}}); + histosMCtruth.add("Four-pion", ";pT [GeV/c]; #eta; #varphi [rad];y; m_{4#pi} [GeV/c^{2}];Run Number", kTHnSparseF, {pTAxis, etaAxis, phiAxis, rapidityAxis, invMassAxis, {113, 0, 113}}); + //___________________________________________________________________________________________________________________________ setHistBinLabels(); @@ -285,7 +297,6 @@ struct ExclusiveRhoTo4Pi { histosQA.fill(HIST("Events/selected/FDDA"), collision.totalFDDAmplitudeA()); histosQA.fill(HIST("Events/selected/FDDC"), collision.totalFDDAmplitudeC()); - std::vector selectedTracks; std::vector selectedPionTracks; std::vector selectedPionPlusTracks; std::vector selectedPionMinusTracks; @@ -295,8 +306,8 @@ struct ExclusiveRhoTo4Pi { PxPyPzMVector tVector(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassPionCharged); // QA-Tracks before selection - histosQA.fill(HIST("Tracks/all/dcaXY"), t0.tpcChi2NCl()); - histosQA.fill(HIST("Tracks/all/dcaZ"), t0.tpcChi2NCl()); + histosQA.fill(HIST("Tracks/all/dcaXY"), t0.dcaXY()); + histosQA.fill(HIST("Tracks/all/dcaZ"), t0.dcaZ()); histosQA.fill(HIST("Tracks/all/itsChi2NCl"), t0.itsChi2NCl()); histosQA.fill(HIST("Tracks/all/itsChi2"), t0.itsChi2NCl() * t0.itsNCls()); histosQA.fill(HIST("Tracks/all/tpcChi2NCl"), t0.tpcChi2NCl()); @@ -349,7 +360,6 @@ struct ExclusiveRhoTo4Pi { // Kinematics for all particles after track selection before selecting pions histosKin.fill(HIST("selected"), tVector.Pt(), tVector.Eta(), tVector.Phi()); - selectedTracks.push_back(t0); if (ifPion(t0, useTOF, nSigmaTPCcut, nSigmaTOFcut)) { selectedPionTracks.push_back(t0); @@ -460,9 +470,15 @@ struct ExclusiveRhoTo4Pi { PxPyPzMVector p14 = p1 + p4; PxPyPzMVector p23 = p2 + p3; PxPyPzMVector p24 = p2 + p4; + PxPyPzMVector p123 = p1 + p2 + p3; + PxPyPzMVector p124 = p1 + p2 + p4; + PxPyPzMVector p134 = p1 + p3 + p4; + PxPyPzMVector p234 = p2 + p3 + p4; // Two Pion Mass combinations - histos4piKin.fill(HIST("two-pion-mass"), p13.M(), p14.M(), p23.M(), p24.M()); + histos4piKin.fill(HIST("two-pion-mass"), p13.M(), p14.M(), p23.M(), p24.M(), p1234.M()); + histos4piKin.fill(HIST("2PiPlusPiMinusMass"), p123.M(), p124.M(), p1234.M()); + histos4piKin.fill(HIST("2PiMinusPiPlusMass"), p134.M(), p234.M(), p1234.M()); double fourPiPhiPair1 = collinSoperPhi(p13, p1234); double fourPiPhiPair2 = collinSoperPhi(p14, p1234); @@ -648,12 +664,8 @@ struct ExclusiveRhoTo4Pi { void processMCrec(soa::Filtered::iterator const& collision, soa::Filtered const& tracks) { - if (collision.has_udMcCollision()) { - return; - } - // Check if the Event is reconstructed in UPC mode and RCT flag - if ((collision.flags() != ifUPC) || (!sgSelector.isCBTHadronOk(collision))) { + if ((collision.flags() != ifUPC) || (!sgSelector.isCBTHadronOk(collision)) || (!collision.has_udMcCollision())) { return; } @@ -678,7 +690,6 @@ struct ExclusiveRhoTo4Pi { histosQA.fill(HIST("Events/selected/FDDA"), collision.totalFDDAmplitudeA()); histosQA.fill(HIST("Events/selected/FDDC"), collision.totalFDDAmplitudeC()); - std::vector selectedTracks; std::vector selectedPionTracks; std::vector selectedPionPlusTracks; std::vector selectedPionMinusTracks; @@ -745,7 +756,6 @@ struct ExclusiveRhoTo4Pi { // Kinematics for all particles after track selection before selecting pions histosKin.fill(HIST("selected"), tVector.Pt(), tVector.Eta(), tVector.Phi()); - selectedTracks.push_back(t0); if (ifPion(t0, useTOF, nSigmaTPCcut, nSigmaTOFcut)) { selectedPionTracks.push_back(t0); @@ -858,7 +868,7 @@ struct ExclusiveRhoTo4Pi { PxPyPzMVector p24 = p2 + p4; // Two Pion Mass combinations - histos4piKin.fill(HIST("two-pion-mass"), p13.M(), p14.M(), p23.M(), p24.M()); + histos4piKin.fill(HIST("two-pion-mass"), p13.M(), p14.M(), p23.M(), p24.M(), p1234.M()); double fourPiPhiPair1 = collinSoperPhi(p13, p1234); double fourPiPhiPair2 = collinSoperPhi(p14, p1234); @@ -897,17 +907,43 @@ struct ExclusiveRhoTo4Pi { } // End of Analysis for non 0 charge events } // End of 4 Pion Analysis Process function for Pass5 MC + void processMCgen(aod::UDMcCollisions::iterator const&, aod::UDMcParticles const& mcParticles, aod::BCs const& bcs) + { + + if (bcs.size() == 0) { + return; + } + auto bc = bcs.begin(); + int runIndex = getRunNumberIndex(bc.runNumber()); + + for (const auto& particle : mcParticles) { + PxPyPzMVector p1234; + if ((particle.pdgCode() != rhoPrime) || (particle.daughters_as().size() != numFourPionTracks)) { + continue; + } + for (const auto& daughter : particle.daughters_as()) { + PxPyPzMVector dVector(daughter.px(), daughter.py(), daughter.pz(), o2::constants::physics::MassPionCharged); + if (daughter.pdgCode() == PDG_t::kPiPlus) { + histosMCtruth.fill(HIST("pions-from-4pi"), dVector.Pt(), dVector.Eta(), dVector.Phi(), dVector.Rapidity(), runIndex); + p1234 = p1234 + dVector; + } + if (daughter.pdgCode() == PDG_t::kPiMinus) { + histosMCtruth.fill(HIST("pions-from-4pi"), dVector.Pt(), dVector.Eta(), dVector.Phi(), dVector.Rapidity(), runIndex); + p1234 = p1234 + dVector; + } + } // End of loop over daughters + histosMCtruth.fill(HIST("Four-pion"), p1234.Pt(), p1234.Eta(), p1234.Phi(), p1234.Rapidity(), p1234.M(), runIndex); + } // End of loop over MC particles + } // End of processMCgen function + PROCESS_SWITCH(ExclusiveRhoTo4Pi, processData, "Data Analysis Function", true); + PROCESS_SWITCH(ExclusiveRhoTo4Pi, processMCgen, "MC generated Analysis Function", false); PROCESS_SWITCH(ExclusiveRhoTo4Pi, processMCrec, "MC reconstructed Analysis Function", false); PROCESS_SWITCH(ExclusiveRhoTo4Pi, processEventCounter, "Event Counter Function", true); PROCESS_SWITCH(ExclusiveRhoTo4Pi, processTrackCounter, "Track Counter Function", true); double collinSoperPhi(PxPyPzMVector twoPionVector, PxPyPzMVector fourPionVector) { - // Half of the energy per pair of the colliding nucleons. - double halfSqrtSnn = 2680.; - double massOfLead208 = 193.6823; - double momentumBeam = std::sqrt(halfSqrtSnn * halfSqrtSnn * 208 * 208 - massOfLead208 * massOfLead208); PxPyPzEVector pProjCM(0., 0., -momentumBeam, halfSqrtSnn * 208); // projectile PxPyPzEVector pTargCM(0., 0., momentumBeam, halfSqrtSnn * 208); // target // Boost to center of mass frame @@ -925,10 +961,6 @@ struct ExclusiveRhoTo4Pi { double collinSoperCosTheta(PxPyPzMVector twoPionVector, PxPyPzMVector fourPionVector) { - // Half of the energy per pair of the colliding nucleons. - double halfSqrtSnn = 2680.; - double massOfLead208 = 193.6823; - double momentumBeam = std::sqrt(halfSqrtSnn * halfSqrtSnn * 208 * 208 - massOfLead208 * massOfLead208); PxPyPzEVector pProjCM(0., 0., -momentumBeam, halfSqrtSnn * 208); // projectile PxPyPzEVector pTargCM(0., 0., momentumBeam, halfSqrtSnn * 208); // target // Boost to center of mass frame @@ -1073,33 +1105,23 @@ struct ExclusiveRhoTo4Pi { auto h1 = histosDataCounter.get(HIST("EventsCounts_vs_runNo")); auto h2 = histosDataCounter.get(HIST("TracksCounts_vs_runNo")); - // auto h3 = histosDataCounter.get(HIST("fourPionCounts_0c")); - // auto h4 = histosDataCounter.get(HIST("fourPionCounts_0c_within_rap")); - // auto h5 = histosDataCounter.get(HIST("fourPionCounts_0c_selected")); - // auto h6 = histosDataCounter.get(HIST("fourPionCounts_n0c")); - // auto h7 = histosDataCounter.get(HIST("fourPionCounts_n0c_within_rap")); - // auto h8 = histosDataCounter.get(HIST("fourPionCounts_n0c_selected")); - // auto h9 = histosDataCounter.get(HIST("fourPionCounts_0c_within_mass")); - // auto h10 = histosDataCounter.get(HIST("fourPionCounts_n0c_within_mass")); - - // for (int i = 0; i < numRunNums; ++i) { - // h1->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); - // h2->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); - // h3->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); - // h4->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); - // h5->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); - // h6->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); - // h7->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); - // h8->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); - // h9->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); - // h10->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); - // } + + auto h3 = histos4piKin.get(HIST("zero-charge")); + auto h4 = histos4piKin.get(HIST("non-zero-charge")); + auto h5 = histosMCtruth.get(HIST("Four-pion")); + for (int i = 0; i < numEventCuts; ++i) { h1->GetYaxis()->SetBinLabel(i + 1, eventLabels[i].c_str()); } for (int i = 0; i < numTrackCuts; ++i) { h2->GetYaxis()->SetBinLabel(i + 1, trackLabels[i].c_str()); } + for (int i = 0; i < numRunNums; ++i) { + std::string runLabel = std::to_string(runNos[i]); + h3->GetAxis(7)->SetBinLabel(i + 1, runLabel.c_str()); + h4->GetAxis(5)->SetBinLabel(i + 1, runLabel.c_str()); + h5->GetAxis(5)->SetBinLabel(i + 1, runLabel.c_str()); + } } // end of setHistBinLabels function From 30f97835f8605a3f6185087f5431f2bd52b01ff6 Mon Sep 17 00:00:00 2001 From: Nida Malik Date: Mon, 29 Sep 2025 01:15:06 +0530 Subject: [PATCH 563/986] [PWGCF] added histograms for multiplicity correlation plots (#13161) --- .../Tasks/netchargeFluctuations.cxx | 288 ++++++++++++++---- 1 file changed, 229 insertions(+), 59 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index 8ce63ab6cf8..a2d95bd72df 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -40,12 +40,13 @@ #include "Framework/RunningWorkflowInfo.h" #include "Framework/runDataProcessing.h" +#include "TF1.h" #include "TProfile.h" #include "TProfile2D.h" #include "TRandom3.h" #include -#include // Include for std::vector +#include using namespace o2; using namespace o2::framework; @@ -53,34 +54,14 @@ using namespace o2::framework::expressions; using namespace std; using namespace o2::constants::physics; -namespace o2 -{ -namespace aod -{ -using MyCollisionsRun2 = soa::Join; -using MyCollisionRun2 = MyCollisionsRun2::iterator; -using MyCollisionsRun3 = soa::Join; -using MyCollisionRun3 = MyCollisionsRun3::iterator; -using MyTracks = soa::Join; -using MyTrack = MyTracks::iterator; - -using MyMCCollisionsRun2 = soa::Join; -using MyMCCollisionRun2 = MyMCCollisionsRun2::iterator; - -using MyMCCollisionsRun3 = soa::Join; -using MyMCCollisionRun3 = MyMCCollisionsRun3::iterator; - -using MyMCTracks = soa::Join; -using MyMCTrack = MyMCTracks::iterator; -} // namespace aod -} // namespace o2 - enum RunType { kRun3 = 0, kRun2 }; struct NetchargeFluctuations { +#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; + Service pdgService; Service ccdb; TRandom3* fRndm = new TRandom3(0); @@ -96,11 +77,11 @@ struct NetchargeFluctuations { Configurable etaCut{"etaCut", 0.8f, "Eta cut"}; Configurable ptMinCut{"ptMinCut", 0.2, "Pt min cut"}; Configurable ptMaxCut{"ptMaxCut", 5.0, "Pt max cut"}; - Configurable dcaXYCut{"dcaXYCut", 0.12, "DCA XY cut"}; - Configurable dcaZCut{"dcaZCut", 0.3, "DCA Z cut"}; - Configurable tpcCrossCut{"tpcCrossCut", 70, "TPC crossrows cut"}; - Configurable itsChiCut{"itsChiCut", 70, "ITS chi2 cluster cut"}; - Configurable tpcChiCut{"tpcChiCut", 70, "TPC chi2 cluster cut"}; + Configurable dcaXYCut{"dcaXYCut", 0.2, "DCA XY cut"}; + Configurable dcaZCut{"dcaZCut", 2.0, "DCA Z cut"}; + Configurable tpcCrossCut{"tpcCrossCut", 70., "TPC crossrows cut"}; + Configurable itsChiCut{"itsChiCut", 36., "ITS chi2 cluster cut"}; + Configurable tpcChiCut{"tpcChiCut", 4., "TPC chi2 cluster cut"}; Configurable centMin{"centMin", 0.0f, "cenrality min for delta eta"}; Configurable centMax{"centMax", 10.0f, "cenrality max for delta eta"}; Configurable cfgNSubsample{"cfgNSubsample", 30, "Number of subsamples for Error"}; @@ -108,33 +89,87 @@ struct NetchargeFluctuations { Configurable threshold{"threshold", 1e-6, "Delta eta bin count"}; // Event selections - Configurable cSel8Trig{"cSel8Trig", true, "Sel8 (T0A + T0C) Selection Run3"}; // sel8 - Configurable cInt7Trig{"cInt7Trig", true, "kINT7 MB Trigger"}; // kINT7 - Configurable cSel7Trig{"cSel7Trig", true, "Sel7 (V0A + V0C) Selection Run2"}; // sel7 - Configurable cPileupReject{"cPileupReject", false, "Pileup rejection"}; // pileup - Configurable cfgUseGoodItsLayerAllCut{"cfgUseGoodItsLayerAllCut", false, "Good ITS Layers All"}; // pileup - Configurable cDcaXy{"cDcaXy", false, "Dca XY cut"}; - Configurable cDcaZ{"cDcaZ", false, "Dca Z cut"}; - Configurable cTpcCr{"cTpcCr", false, "tpc crossrows"}; - Configurable cItsChi{"cItsChi", false, "ITS chi"}; - Configurable cTpcChi{"cTpcChi", false, "TPC chi"}; + Configurable cSel8Trig{"cSel8Trig", true, "Sel8 (T0A + T0C) Selection Run3"}; // sel8 + Configurable cInt7Trig{"cInt7Trig", true, "kINT7 MB Trigger"}; // kINT7 + Configurable cSel7Trig{"cSel7Trig", true, "Sel7 (V0A + V0C) Selection Run2"}; // sel7 + Configurable cDcaXy{"cDcaXy", true, "Dca XY cut"}; + Configurable cDcaZ{"cDcaZ", true, "Dca Z cut"}; + Configurable cTpcCr{"cTpcCr", true, "tpc crossrows"}; + Configurable cItsChi{"cItsChi", true, "ITS chi"}; + Configurable cTpcChi{"cTpcChi", true, "TPC chi"}; Configurable cFT0C{"cFT0C", true, "cent FT0C"}; Configurable cFT0M{"cFT0M", false, "cent FT0M"}; ConfigurableAxis centBining{"centBining", {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, "Centrality/Multiplicity percentile bining"}; - Configurable cTFBorder{"cTFBorder", false, "Timeframe Border Selection"}; // pileup - Configurable cNoItsROBorder{"cNoItsROBorder", false, "No ITSRO Border Cut"}; // pileup - Configurable cItsTpcVtx{"cItsTpcVtx", false, "ITS+TPC Vertex Selection"}; // pileup - Configurable cZVtxTimeDiff{"cZVtxTimeDiff", false, "z-vtx time diff selection"}; // pileup + Configurable cPileupReject{"cPileupReject", true, "Pileup rejection"}; // pileup + Configurable cfgUseGoodItsLayerAllCut{"cfgUseGoodItsLayerAllCut", true, "Good ITS Layers All"}; // pileup + Configurable cTFBorder{"cTFBorder", false, "Timeframe Border Selection"}; // pileup + Configurable cNoItsROBorder{"cNoItsROBorder", false, "No ITSRO Border Cut"}; // pileup + Configurable cItsTpcVtx{"cItsTpcVtx", true, "ITS+TPC Vertex Selection"}; // pileup + Configurable cZVtxTimeDiff{"cZVtxTimeDiff", false, "z-vtx time diff selection"}; // pileup + Configurable cPVcont{"cPVcont", true, "primary vertex contributor"}; + + O2_DEFINE_CONFIGURABLE(cfgEvSelMultCorrelation, bool, true, "Multiplicity correlation cut") + struct : ConfigurableGroup { + + O2_DEFINE_CONFIGURABLE(cfgMultPVT0CCutEnabled, bool, true, "Enable PV multiplicity vs T0C centrality cut") + O2_DEFINE_CONFIGURABLE(cfgMultGlobalFT0CCutEnabled, bool, true, "Enable globalTracks vs FT0C multiplicity cut") + O2_DEFINE_CONFIGURABLE(cfgMultGlobalPVCutEnabled, bool, false, "Enable globalTracks vs PV multiplicity cut") + + Configurable> cfgMultPVT0CCutPars{"cfgMultPVT0CCutPars", + std::vector{187.621, -5.14575, 0.0716601, -0.000586642, 2.02818e-06, 51.2929, -1.66644, 0.0354762, -0.000389809, 1.55365e-06}, + "PV multiplicity vs T0C centrality cut parameter values"}; + + Configurable> cfgMultGlobalFT0CCutPars{"cfgMultGlobalFT0CCutPars", + std::vector{135.561, -3.7818, 0.0536562, -0.000445155, 1.55429e-06, 38.2336, -1.2568, 0.0270932, -0.000301034, 1.21234e-06}, + "globalTracks vs FT0C cut parameter values"}; + + Configurable> cfgMultGlobalPVCutPars{"cfgMultGlobalPVCutPars", + std::vector{100., -2., 0.05, -0.0003, 1e-06, 30., -1.0, 0.02, -0.0002, 8e-07}, + "globalTracks vs PV cut parameter values"}; + + std::vector multPVT0CCutPars; + std::vector multGlobalFT0CPars; + std::vector multGlobalPVCutPars; + + TF1* fMultPVT0CCutLow = nullptr; + TF1* fMultPVT0CCutHigh = nullptr; + TF1* fMultGlobalFT0CCutLow = nullptr; + TF1* fMultGlobalFT0CCutHigh = nullptr; + TF1* fMultGlobalPVCutLow = nullptr; + TF1* fMultGlobalPVCutHigh = nullptr; + + } cfgFunCoeff; // CCDB efficiency histograms TH1D* efficiency = nullptr; - // Initialization + Filter collisionFilter = nabs(aod::collision::posZ) <= vertexZcut; + Filter trackFilter = (nabs(aod::track::eta) < etaCut) && (aod::track::pt > ptMinCut) && (aod::track::pt < ptMaxCut) && (requireGlobalTrackInFilter()); + + using MyCollisionsRun2 = soa::Filtered>; + using MyCollisionRun2 = MyCollisionsRun2::iterator; + + using MyCollisionsRun3 = soa::Filtered>; + using MyCollisionRun3 = MyCollisionsRun3::iterator; + + using MyTracks = soa::Filtered>; + using MyTrack = MyTracks::iterator; + + using MyMCCollisionsRun2 = soa::Filtered>; + using MyMCCollisionRun2 = MyMCCollisionsRun2::iterator; + + using MyMCCollisionsRun3 = soa::Filtered>; + using MyMCCollisionRun3 = MyMCCollisionsRun3::iterator; + + using MyMCTracks = soa::Filtered>; + using MyMCTrack = MyMCTracks::iterator; + void init(o2::framework::InitContext&) { const AxisSpec vtxzAxis = {800, -20, 20, "V_{Z} (cm)"}; const AxisSpec dcaAxis = {1000, -0.5, 0.5, "DCA_{xy} (cm)"}; const AxisSpec dcazAxis = {600, -3, 3, "DCA_{z} (cm)"}; + const AxisSpec phiAxis = {70, 0, 7, "#phi "}; const AxisSpec ptAxis = {70, 0.0, 7.0, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec etaAxis = {20, -1., 1., "#eta"}; const AxisSpec deltaEtaAxis = {9, 0, 1.8, "#eta"}; @@ -156,6 +191,7 @@ struct NetchargeFluctuations { histogramRegistry.add("QA/hVtxZ_before", "", kTH1F, {vtxzAxis}); histogramRegistry.add("QA/hDcaXY_before", "", kTH1F, {dcaAxis}); + histogramRegistry.add("QA/hphi", "", kTH1F, {phiAxis}); histogramRegistry.add("QA/hDcaZ_before", "", kTH1F, {dcazAxis}); histogramRegistry.add("QA/hTPCchi2perCluster_before", "", kTH1D, {tpcChiAxis}); histogramRegistry.add("QA/hITSchi2perCluster_before", "", kTH1D, {itsChiAxis}); @@ -276,6 +312,58 @@ struct NetchargeFluctuations { histogramRegistry.add("subsample/delta_eta/gen/neg_sq", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); histogramRegistry.add("subsample/delta_eta/gen/posneg", "", kTProfile2D, {deltaEtaAxis, subsampleAxis}); + histogramRegistry.add("QA/hCentFT0C", "", kTH1F, {centAxis}); + histogramRegistry.add("QA/hNchGlobal", "", kTH1F, {nchAxis}); + histogramRegistry.add("QA/hNchPV", "", kTH1F, {nchAxis}); + + histogramRegistry.add("MultCorrelationPlots/globalTracks_PV_bef", "", {HistType::kTH2D, {nchAxis, nchAxis}}); + histogramRegistry.add("MultCorrelationPlots/globalTracks_FT0C_bef", "", {HistType::kTH2D, {centAxis, nchAxis}}); + histogramRegistry.add("MultCorrelationPlots/PV_FT0C_bef", "", {HistType::kTH2D, {centAxis, nchAxis}}); + + histogramRegistry.add("MultCorrelationPlots/globalTracks_PV_aft", "", {HistType::kTH2D, {nchAxis, nchAxis}}); + histogramRegistry.add("MultCorrelationPlots/globalTracks_FT0C_aft", "", {HistType::kTH2D, {centAxis, nchAxis}}); + histogramRegistry.add("MultCorrelationPlots/PV_FT0C_aft", "", {HistType::kTH2D, {centAxis, nchAxis}}); + + cfgFunCoeff.multPVT0CCutPars = cfgFunCoeff.cfgMultPVT0CCutPars; + cfgFunCoeff.multGlobalFT0CPars = cfgFunCoeff.cfgMultGlobalFT0CCutPars; + cfgFunCoeff.multGlobalPVCutPars = cfgFunCoeff.cfgMultGlobalPVCutPars; + + cfgFunCoeff.fMultPVT0CCutLow = + new TF1("fMultPVT0CCutLow", + "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 2.0*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", + 0, 100); + cfgFunCoeff.fMultPVT0CCutLow->SetParameters(&(cfgFunCoeff.multPVT0CCutPars[0])); + + cfgFunCoeff.fMultPVT0CCutHigh = + new TF1("fMultPVT0CCutHigh", + "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 2.*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", + 0, 100); + cfgFunCoeff.fMultPVT0CCutHigh->SetParameters(&(cfgFunCoeff.multPVT0CCutPars[0])); + + cfgFunCoeff.fMultGlobalFT0CCutLow = + new TF1("fMultGlobalFT0CCutLow", + "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 2.*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", + 0, 100); + cfgFunCoeff.fMultGlobalFT0CCutLow->SetParameters(&(cfgFunCoeff.multGlobalFT0CPars[0])); + + cfgFunCoeff.fMultGlobalFT0CCutHigh = + new TF1("fMultGlobalFT0CCutHigh", + "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 2.*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", + 0, 100); + cfgFunCoeff.fMultGlobalFT0CCutHigh->SetParameters(&(cfgFunCoeff.multGlobalFT0CPars[0])); + + cfgFunCoeff.fMultGlobalPVCutLow = + new TF1("fMultGlobalPVCutLow", + "[0] + [1]*x - 5.*([2] + [3]*x)", + 0, 100); + cfgFunCoeff.fMultGlobalPVCutLow->SetParameters(&(cfgFunCoeff.multGlobalPVCutPars[0])); + + cfgFunCoeff.fMultGlobalPVCutHigh = + new TF1("fMultGlobalPVCutHigh", + "[0] + [1]*x + 5.*([2] + [3]*x)", + 0, 100); + cfgFunCoeff.fMultGlobalPVCutHigh->SetParameters(&(cfgFunCoeff.multGlobalPVCutPars[0])); + if (cfgLoadEff) { ccdb->setURL(cfgUrlCCDB.value); ccdb->setCaching(true); @@ -289,16 +377,45 @@ struct NetchargeFluctuations { } } + bool eventSelected(const float& globalNch, const float& pvTrack, const float& centrality) + { + if (cfgFunCoeff.cfgMultPVT0CCutEnabled) { + + if (pvTrack < cfgFunCoeff.fMultPVT0CCutLow->Eval(centrality)) + return false; + if (pvTrack > cfgFunCoeff.fMultPVT0CCutHigh->Eval(centrality)) + return false; + } + + if (cfgFunCoeff.cfgMultGlobalFT0CCutEnabled) { + + if (globalNch < cfgFunCoeff.fMultGlobalFT0CCutLow->Eval(centrality)) + return false; + if (globalNch > cfgFunCoeff.fMultGlobalFT0CCutHigh->Eval(centrality)) + return false; + } + + if (cfgFunCoeff.cfgMultGlobalPVCutEnabled) { + + if (globalNch < cfgFunCoeff.fMultGlobalPVCutLow->Eval(pvTrack)) + return false; + if (globalNch > cfgFunCoeff.fMultGlobalPVCutHigh->Eval(pvTrack)) + return false; + } + + return true; + } + template bool selCollision(C const& coll, float& cent, float& mult) { - if (std::abs(coll.posZ()) > vertexZcut) + if (std::abs(coll.posZ()) >= vertexZcut) return false; if constexpr (run == kRun3) { if (cSel8Trig && !coll.sel8()) { return false; - } // require min bias trigger + } if (cFT0M) { cent = coll.centFT0M(); // centrality for run3 using FT0M mult = coll.multFT0M(); @@ -349,6 +466,7 @@ struct NetchargeFluctuations { template void fillAfterQA(T const& track) { + histogramRegistry.fill(HIST("QA/hphi"), track.phi()); histogramRegistry.fill(HIST("QA/hDcaXY_after"), track.dcaXY()); histogramRegistry.fill(HIST("QA/hDcaZ_after"), track.dcaZ()); histogramRegistry.fill(HIST("QA/hPt"), track.pt()); @@ -366,21 +484,23 @@ struct NetchargeFluctuations { { if (!track.isGlobalTrack()) return false; + if (cPVcont && !track.isPVContributor()) + return false; if (std::fabs(track.eta()) >= etaCut) return false; if (track.pt() <= ptMinCut || track.pt() >= ptMaxCut) return false; if (track.sign() == 0) return false; - if (cDcaXy && std::fabs(track.dcaXY()) > dcaXYCut) + if (cDcaXy && std::fabs(track.dcaXY()) >= dcaXYCut) return false; - if (cDcaZ && std::fabs(track.dcaZ()) > dcaZCut) + if (cDcaZ && std::fabs(track.dcaZ()) >= dcaZCut) return false; - if (cTpcCr && track.tpcNClsCrossedRows() < tpcCrossCut) + if (cTpcCr && track.tpcNClsCrossedRows() <= tpcCrossCut) return false; - if (cItsChi && track.itsChi2NCl() > itsChiCut) + if (cItsChi && track.itsChi2NCl() >= itsChiCut) return false; - if (cTpcChi && track.tpcChi2NCl() > tpcChiCut) + if (cTpcChi && track.tpcChi2NCl() >= tpcChiCut) return false; return true; @@ -438,6 +558,24 @@ struct NetchargeFluctuations { if (!selCollision(coll, cent, mult)) { return; } + + float globalNch = tracks.size(); + float pvTrack = coll.multNTracksPV(); + + histogramRegistry.fill(HIST("QA/hCentFT0C"), cent); + histogramRegistry.fill(HIST("QA/hNchGlobal"), globalNch); + histogramRegistry.fill(HIST("QA/hNchPV"), pvTrack); + + histogramRegistry.fill(HIST("MultCorrelationPlots/globalTracks_PV_bef"), pvTrack, globalNch); + histogramRegistry.fill(HIST("MultCorrelationPlots/globalTracks_FT0C_bef"), cent, globalNch); + histogramRegistry.fill(HIST("MultCorrelationPlots/PV_FT0C_bef"), cent, pvTrack); + + if (cfgEvSelMultCorrelation && !eventSelected(globalNch, pvTrack, cent)) { + return; + } + histogramRegistry.fill(HIST("MultCorrelationPlots/globalTracks_PV_aft"), pvTrack, globalNch); + histogramRegistry.fill(HIST("MultCorrelationPlots/globalTracks_FT0C_aft"), cent, globalNch); + histogramRegistry.fill(HIST("MultCorrelationPlots/PV_FT0C_aft"), cent, pvTrack); histogramRegistry.fill(HIST("QA/hVtxZ_after"), coll.posZ()); histogramRegistry.fill(HIST("QA/hCentrality"), cent); histogramRegistry.fill(HIST("QA/hMultiplicity"), mult); @@ -477,6 +615,7 @@ struct NetchargeFluctuations { termp = fpos * (fpos - 1); termn = fneg * (fneg - 1); posneg = fpos * fneg; + histogramRegistry.fill(HIST("data/cent_nchTotal"), cent, nchTotal); histogramRegistry.fill(HIST("data/cent_nchTotalCor"), cent, nchTotalCor); histogramRegistry.fill(HIST("data/nch_nchCor"), nch, nchCor); @@ -500,6 +639,25 @@ struct NetchargeFluctuations { if (!selCollision(coll, cent, mult)) { return; } + + int globalNch = inputTracks.size(); + int pvTrack = coll.multNTracksPV(); + + histogramRegistry.fill(HIST("QA/hCentFT0C"), cent); + histogramRegistry.fill(HIST("QA/hNchGlobal"), globalNch); + histogramRegistry.fill(HIST("QA/hNchPV"), pvTrack); + + histogramRegistry.fill(HIST("MultCorrelationPlots/globalTracks_PV_bef"), pvTrack, globalNch); + histogramRegistry.fill(HIST("MultCorrelationPlots/globalTracks_FT0C_bef"), cent, globalNch); + histogramRegistry.fill(HIST("MultCorrelationPlots/PV_FT0C_bef"), cent, pvTrack); + + if (cfgEvSelMultCorrelation && !eventSelected(globalNch, pvTrack, cent)) { + return; + } + histogramRegistry.fill(HIST("MultCorrelationPlots/globalTracks_PV_aft"), pvTrack, globalNch); + histogramRegistry.fill(HIST("MultCorrelationPlots/globalTracks_FT0C_aft"), cent, globalNch); + histogramRegistry.fill(HIST("MultCorrelationPlots/PV_FT0C_aft"), cent, pvTrack); + histogramRegistry.fill(HIST("QA/hVtxZ_after"), coll.posZ()); histogramRegistry.fill(HIST("QA/hCentrality"), cent); histogramRegistry.fill(HIST("QA/hMultiplicity"), mult); @@ -547,7 +705,7 @@ struct NetchargeFluctuations { int posGen = 0, negGen = 0, posNegGen = 0, termNGen = 0, termPGen = 0, nchGen = 0; const auto& mccolgen = coll.template mcCollision_as(); - if (std::abs(mccolgen.posZ()) > vertexZcut) + if (std::abs(mccolgen.posZ()) >= vertexZcut) return; const auto& mcpartgen = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mccolgen.globalIndex(), cache); histogramRegistry.fill(HIST("gen/hVtxZ_after"), mccolgen.posZ()); @@ -620,6 +778,12 @@ struct NetchargeFluctuations { float cent = -1, mult = -1; if (!selCollision(coll, cent, mult)) return; + + int globalNch = tracks.size(); + int pvTrack = coll.multNTracksPV(); + if (cfgEvSelMultCorrelation && !eventSelected(globalNch, pvTrack, cent)) + return; + if (!(cent >= centMin && cent < centMax)) return; histogramRegistry.fill(HIST("data/delta_eta_cent"), cent); @@ -692,6 +856,12 @@ struct NetchargeFluctuations { float cent = -1, mult = -1; if (!selCollision(coll, cent, mult)) return; + + int globalNch = inputTracks.size(); + int pvTrack = coll.multNTracksPV(); + if (cfgEvSelMultCorrelation && !eventSelected(globalNch, pvTrack, cent)) + return; + if (!(cent >= centMin && cent < centMax)) return; histogramRegistry.fill(HIST("data/delta_eta_cent"), cent); @@ -745,7 +915,7 @@ struct NetchargeFluctuations { const auto& mccolgen = coll.template mcCollision_as(); - if (std::abs(mccolgen.posZ()) > vertexZcut) + if (std::abs(mccolgen.posZ()) >= vertexZcut) return; const auto& mcpartgen = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mccolgen.globalIndex(), cache); @@ -817,10 +987,10 @@ struct NetchargeFluctuations { } // void SliceCache cache; - Preslice mcTrack = o2::aod::mcparticle::mcCollisionId; + Preslice mcTrack = aod::mcparticle::mcCollisionId; // process function for Data Run3 - void processDataRun3(aod::MyCollisionRun3 const& coll, aod::MyTracks const& tracks) + void processDataRun3(MyCollisionRun3 const& coll, MyTracks const& tracks) { calculationData(coll, tracks); for (int ii = 0; ii < deltaEta; ii++) { @@ -831,10 +1001,10 @@ struct NetchargeFluctuations { } } - PROCESS_SWITCH(NetchargeFluctuations, processDataRun3, "Process for Run3 DATA", false); + PROCESS_SWITCH(NetchargeFluctuations, processDataRun3, "Process for Run3 DATA", true); // process function for Data Run2 - void processDataRun2(aod::MyCollisionRun2 const& coll, aod::MyTracks const& tracks) + void processDataRun2(MyCollisionRun2 const& coll, MyTracks const& tracks) { calculationData(coll, tracks); for (int ii = 0; ii < deltaEta; ii++) { @@ -849,7 +1019,7 @@ struct NetchargeFluctuations { // process function for MC Run3 - void processMcRun3(aod::MyMCCollisionRun3 const& coll, aod::MyMCTracks const& inputTracks, + void processMcRun3(MyMCCollisionRun3 const& coll, MyMCTracks const& inputTracks, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { calculationMc(coll, inputTracks, mcCollisions, mcParticles); @@ -859,11 +1029,11 @@ struct NetchargeFluctuations { calculationMcDeltaEta(coll, inputTracks, mcCollisions, mcParticles, etaMin, etaMax); } } - PROCESS_SWITCH(NetchargeFluctuations, processMcRun3, "Process reconstructed", true); + PROCESS_SWITCH(NetchargeFluctuations, processMcRun3, "Process reconstructed", false); // process function for MC Run2 - void processMcRun2(aod::MyMCCollisionRun2 const& coll, aod::MyMCTracks const& inputTracks, + void processMcRun2(MyMCCollisionRun2 const& coll, MyMCTracks const& inputTracks, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { calculationMc(coll, inputTracks, mcCollisions, mcParticles); From 29e869a6e6062b5fe2ca6d4187e0402ac9e4be26 Mon Sep 17 00:00:00 2001 From: shreyasiacharya <34233706+shreyasiacharya@users.noreply.github.com> Date: Mon, 29 Sep 2025 09:01:47 +0200 Subject: [PATCH 564/986] [PWGDQ] Adding some JPsi, Psi2S signals (#13163) --- PWGDQ/Core/MCSignalLibrary.cxx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/PWGDQ/Core/MCSignalLibrary.cxx b/PWGDQ/Core/MCSignalLibrary.cxx index 4d6bd11a916..701a25fc8e4 100644 --- a/PWGDQ/Core/MCSignalLibrary.cxx +++ b/PWGDQ/Core/MCSignalLibrary.cxx @@ -174,13 +174,23 @@ MCSignal* o2::aod::dqmcsignals::GetMCSignal(const char* name) signal = new MCSignal(name, "Prompt jpsi (not from beauty)", {prong}, {-1}); return signal; } + if (!nameStr.compare("eeFromNonpromptPsi2S")) { + MCProng prong(2, {11, 100443}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}, false, {503}, {false}); + signal = new MCSignal(name, "ee pairs from non-prompt psi2s decays", {prong, prong}, {1, 1}); // signal at pair level + return signal; + } + if (!nameStr.compare("eeFromPromptPsi2S")) { + MCProng prong(2, {11, 100443}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}, false, {503}, {true}); + signal = new MCSignal(name, "ee pairs from prompt psi2s decays", {prong, prong}, {1, 1}); // signal at pair level + return signal; + } if (!nameStr.compare("eFromNonpromptPsi2S")) { - MCProng prong(3, {11, 100443, 503}, {true, true, true}, {false, false, false}, {0, 0, 0}, {0, 0, 0}, {false, false, false}); + MCProng prong(2, {11, 100443}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}, false, {503}, {false}); signal = new MCSignal(name, "Electrons from beauty psi2s decays", {prong}, {-1}); return signal; } if (!nameStr.compare("eFromPromptPsi2S")) { - MCProng prong(3, {11, 100443, 503}, {true, true, true}, {false, false, true}, {0, 0, 0}, {0, 0, 0}, {false, false, false}); + MCProng prong(2, {11, 100443}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}, false, {503}, {true}); signal = new MCSignal(name, "Electrons from prompt psi2s decays", {prong}, {-1}); return signal; } @@ -190,7 +200,7 @@ MCSignal* o2::aod::dqmcsignals::GetMCSignal(const char* name) return signal; } if (!nameStr.compare("nonPromptPsi2S")) { - MCProng prong(2, {100443, 503}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}); + MCProng prong(2, {100443, 503}, {true, true}, {false, true}, {0, 0}, {0, 0}, {false, false}); signal = new MCSignal(name, "Non-prompt psi2s", {prong}, {-1}); return signal; } @@ -487,8 +497,7 @@ MCSignal* o2::aod::dqmcsignals::GetMCSignal(const char* name) return signal; } if (!nameStr.compare("eFromPromptJpsi")) { - MCProng prong(2, {11, 443}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}); - prong.SetSourceBit(0, MCProng::kPhysicalPrimary); + MCProng prong(2, {11, 443}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false}, false, {503}, {true}); signal = new MCSignal(name, "Electrons from jpsi decays", {prong}, {-1}); return signal; } From 67d38bc66a31036a2a473370a87a9d15c525f76b Mon Sep 17 00:00:00 2001 From: Bhagyarathi Sahoo Date: Mon, 29 Sep 2025 13:19:44 +0530 Subject: [PATCH 565/986] [PWGDQ] Fixing McDecision issue for two prong signal (#13142) Co-authored-by: ALICE Action Bot --- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index 6216733cbbe..6668f0bebac 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -2257,17 +2257,11 @@ struct AnalysisSameEventPairing { continue; } if (sig->CheckSignal(true, t1_raw, t2_raw)) { - mcDecision |= (static_cast(1) << isig); VarManager::FillPairMC(t1, t2); // NOTE: This feature will only work for muons fHistMan->FillHistClass(Form("MCTruthGenPair_%s", sig->GetName()), VarManager::fgValues); - if (useMiniTree.fConfigMiniTree) { - // WARNING! To be checked - dileptonMiniTreeGen(mcDecision, -999, t1.pt(), t1.eta(), t1.phi(), t2.pt(), t2.eta(), t2.phi()); - } } } } - isig++; } } // Fill Generated PAIR histograms taking into account selected collisions @@ -2290,15 +2284,22 @@ struct AnalysisSameEventPairing { auto t1_raw = mcTracks.rawIteratorAt(t1.globalIndex()); auto t2_raw = mcTracks.rawIteratorAt(t2.globalIndex()); if (t1_raw.reducedMCeventId() == t2_raw.reducedMCeventId()) { + mcDecision = 0; + isig = 0; for (auto& sig : fGenMCSignals) { if (sig->GetNProngs() != 2) { // NOTE: 2-prong signals required here continue; } if (sig->CheckSignal(true, t1_raw, t2_raw)) { - // mcDecision |= (static_cast(1) << isig); + mcDecision |= (static_cast(1) << isig); VarManager::FillPairMC(t1, t2); // NOTE: This feature will only work for muons fHistMan->FillHistClass(Form("MCTruthGenPairSel_%s", sig->GetName()), VarManager::fgValues); + if (useMiniTree.fConfigMiniTree) { + // WARNING! To be checked + dileptonMiniTreeGen(mcDecision, -999, t1.pt(), t1.eta(), t1.phi(), t2.pt(), t2.eta(), t2.phi()); + } } + isig++; } } } From bbda1aaabfd74a1cfc1070bc2615c6cd934729c6 Mon Sep 17 00:00:00 2001 From: SuJeong Ji <120470463+SuJeong-Ji@users.noreply.github.com> Date: Mon, 29 Sep 2025 17:20:07 +0900 Subject: [PATCH 566/986] [PWGLF] Added histograms for efficiency calculation in chk892pp.cxx (#13110) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Resonances/chk892pp.cxx | 511 ++++++++++++++++++++++------ 1 file changed, 399 insertions(+), 112 deletions(-) diff --git a/PWGLF/Tasks/Resonances/chk892pp.cxx b/PWGLF/Tasks/Resonances/chk892pp.cxx index 419a8ea69b6..ca235de8ff9 100644 --- a/PWGLF/Tasks/Resonances/chk892pp.cxx +++ b/PWGLF/Tasks/Resonances/chk892pp.cxx @@ -13,7 +13,7 @@ /// \brief Reconstruction of track-track decay resonance candidates /// /// -/// \author Su-Jeong Ji +/// \author Su-Jeong Ji , Bong-Hwi Lim #include #include @@ -26,6 +26,7 @@ // #include // FIXME #include "PWGLF/DataModel/LFStrangenessTables.h" #include "PWGLF/Utils/collisionCuts.h" +#include "PWGLF/Utils/inelGt.h" #include "Common/Core/RecoDecay.h" #include "Common/Core/TrackSelection.h" @@ -68,6 +69,8 @@ #include #include #include +#include +#include #include using namespace o2; @@ -77,6 +80,22 @@ using namespace o2::soa; using namespace o2::constants::physics; using namespace o2::aod::rctsel; +namespace +{ +template +inline bool getTruthK0sAndGenKinematics(V0T const& v0, double& ptgen, double& ygen) +{ + if (!v0.has_mcParticle()) + return false; + auto mcPart = v0.template mcParticle_as(); + if (mcPart.pdgCode() != kK0Short) + return false; + ptgen = mcPart.pt(); + ygen = mcPart.y(); + return true; +} +} // namespace + struct Chk892pp { enum BinType : unsigned int { kKstarP = 0, @@ -91,14 +110,19 @@ struct Chk892pp { SliceCache cache; Preslice perCollision = aod::track::collisionId; - using EventCandidates = soa::Join; - // using EventCandidates = soa::Join; + using EventCandidates = soa::Join; using TrackCandidates = soa::Join; using V0Candidates = aod::V0Datas; + // for MC reco using MCEventCandidates = soa::Join; - using MCTrackCandidates = soa::Join; + using MCTrackCandidates = soa::Join; //, aod::McParticles>; using MCV0Candidates = soa::Join; + + // for MC truth + using MCTrueEventCandidates = aod::McCollisions; + using MCTrueTrackCandidates = aod::McParticles; + using LorentzVectorSetXYZM = ROOT::Math::LorentzVector>; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -115,7 +139,7 @@ struct Chk892pp { // Configurables struct : ConfigurableGroup { ConfigurableAxis cfgBinsPt{"cfgBinsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5.0, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 6.0, 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9, 9.0, 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7, 9.8, 9.9, 10.0, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 11.0, 11.1, 11.2, 11.3, 11.4, 11.5, 11.6, 11.7, 11.8, 11.9, 12.0, 12.1, 12.2, 12.3, 12.4, 12.5, 12.6, 12.7, 12.8, 12.9, 13.0, 13.1, 13.2, 13.3, 13.4, 13.5, 13.6, 13.7, 13.8, 13.9, 14.0, 14.1, 14.2, 14.3, 14.4, 14.5, 14.6, 14.7, 14.8, 14.9, 15.0}, "Binning of the pT axis"}; - ConfigurableAxis cfgBinsPtQA{"cfgBinsPtQA", {VARIABLE_WIDTH, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8, 5.0, 5.2, 5.4, 5.6, 5.8, 6.0, 6.2, 6.4, 6.6, 6.8, 7.0, 7.2, 7.4, 7.6, 7.8, 8.0, 8.2, 8.4, 8.6, 8.8, 9.0, 9.2, 9.4, 9.6, 9.8, 10.0}, "Binning of the pT axis"}; + ConfigurableAxis cfgBinsPtQA{"cfgBinsPtQA", {VARIABLE_WIDTH, 0.0, 0.8, 1.3, 1.8, 2.3, 2.8, 3.4, 4.0, 5.0, 6.0, 7.0, 8.0}, "Binning of the pT axis"}; ConfigurableAxis cfgBinsCent{"cfgBinsCent", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"}; ConfigurableAxis cfgBinsVtxZ{"cfgBinsVtxZ", {VARIABLE_WIDTH, -10.0, -9.0, -8.0, -7.0, -6.0, -5.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, "Binning of the z-vertex axis"}; Configurable cNbinsDiv{"cNbinsDiv", 1, "Integer to divide the number of bins"}; @@ -130,14 +154,14 @@ struct Chk892pp { Configurable cfgEvtOccupancyInTimeRangeMin{"cfgEvtOccupancyInTimeRangeMin", -1, "Evt sel: minimum track occupancy"}; Configurable cfgEvtTriggerCheck{"cfgEvtTriggerCheck", false, "Evt sel: check for trigger"}; Configurable cfgEvtOfflineCheck{"cfgEvtOfflineCheck", true, "Evt sel: check for offline selection"}; - Configurable cfgEvtTriggerTVXSel{"cfgEvtTriggerTVXSel", false, "Evt sel: triggerTVX selection (MB)"}; - Configurable cfgEvtTFBorderCut{"cfgEvtTFBorderCut", false, "Evt sel: apply TF border cut"}; + Configurable cfgEvtTriggerTVXSel{"cfgEvtTriggerTVXSel", true, "Evt sel: triggerTVX selection (MB)"}; + Configurable cfgEvtTFBorderCut{"cfgEvtTFBorderCut", true, "Evt sel: apply TF border cut"}; Configurable cfgEvtUseITSTPCvertex{"cfgEvtUseITSTPCvertex", false, "Evt sel: use at lease on ITS-TPC track for vertexing"}; - Configurable cfgEvtZvertexTimedifference{"cfgEvtZvertexTimedifference", true, "Evt sel: apply Z-vertex time difference"}; - Configurable cfgEvtPileupRejection{"cfgEvtPileupRejection", true, "Evt sel: apply pileup rejection"}; - Configurable cfgEvtNoITSROBorderCut{"cfgEvtNoITSROBorderCut", false, "Evt sel: apply NoITSRO border cut"}; + Configurable cfgEvtZvertexTimedifference{"cfgEvtZvertexTimedifference", false, "Evt sel: apply Z-vertex time difference"}; + Configurable cfgEvtPileupRejection{"cfgEvtPileupRejection", false, "Evt sel: apply pileup rejection"}; + Configurable cfgEvtNoITSROBorderCut{"cfgEvtNoITSROBorderCut", true, "Evt sel: apply NoITSRO border cut"}; Configurable cfgincludeCentralityMC{"cfgincludeCentralityMC", false, "Include centrality in MC"}; - Configurable cfgEvtCollInTimeRangeStandard{"cfgEvtCollInTimeRangeStandard", true, "Evt sel: apply NoCollInTimeRangeStandard"}; + Configurable cfgEvtCollInTimeRangeStandard{"cfgEvtCollInTimeRangeStandard", false, "Evt sel: apply NoCollInTimeRangeStandard"}; Configurable cfgEventCentralityMin{"cfgEventCentralityMin", 0.0f, "Event sel: minimum centrality"}; Configurable cfgEventCentralityMax{"cfgEventCentralityMax", 80.0f, "Event sel: maximum centrality"}; Configurable cfgEvtUseRCTFlagChecker{"cfgEvtUseRCTFlagChecker", false, "Evt sel: use RCT flag checker"}; @@ -147,22 +171,16 @@ struct Chk892pp { } EventCuts; RCTFlagsChecker rctChecker; - /* - // Cuts from polarization analysis - Configurable cfgOccupancySel{"cfgOccupancySel", false, "Occupancy selection"}; - Configurable cfgMaxOccupancy{"cfgMaxOccupancy", 999999, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; - Configurable cfgMinOccupancy{"cfgMinOccupancy", -100, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; - Configurable cfgNCollinTR{"cfgNCollinTR", false, "Additional selection for the number of coll in time range"}; -*/ Configurable cfgCentEst{"cfgCentEst", 2, "Centrality estimator, 1: FT0C, 2: FT0M"}; /// PID Selections, pion struct : ConfigurableGroup { - Configurable cfgTPConly{"cfgTPConly", true, "Use only TPC for PID"}; // bool + Configurable cfgTPConly{"cfgTPConly", false, "Use only TPC for PID"}; // bool Configurable cfgMaxTPCnSigmaPion{"cfgMaxTPCnSigmaPion", 3.0, "TPC nSigma cut for Pion"}; // TPC Configurable cfgMaxTOFnSigmaPion{"cfgMaxTOFnSigmaPion", 3.0, "TOF nSigma cut for Pion"}; // TOF Configurable cfgNsigmaCutCombinedPion{"cfgNsigmaCutCombinedPion", -999, "Combined nSigma cut for Pion"}; // Combined Configurable cfgTOFVeto{"cfgTOFVeto", true, "TOF Veto, if false, TOF is nessessary for PID selection"}; // TOF Veto + Configurable cfgTOFMinPt{"cfgTOFMinPt", 0.6, "Minimum TOF pT cut for Pion"}; // TOF pT cut } PIDCuts; // Track selections @@ -174,7 +192,7 @@ struct Chk892pp { Configurable cfgGlobalTrack{"cfgGlobalTrack", false, "Global track selection"}; // kGoldenChi2 | kDCAxy | kDCAz Configurable cfgPVContributor{"cfgPVContributor", false, "PV contributor track selection"}; // PV Contriuibutor - Configurable cfgpTdepDCAxyCut{"cfgpTdepDCAxyCut", false, "pT-dependent DCAxy cut"}; + Configurable cfgpTdepDCAxyCut{"cfgpTdepDCAxyCut", true, "pT-dependent DCAxy cut"}; Configurable cfgITScluster{"cfgITScluster", 0, "Number of ITS cluster"}; Configurable cfgTPCcluster{"cfgTPCcluster", 0, "Number of TPC cluster"}; Configurable cfgRatioTPCRowsOverFindableCls{"cfgRatioTPCRowsOverFindableCls", 0.0f, "TPC Crossed Rows to Findable Clusters"}; @@ -193,22 +211,22 @@ struct Chk892pp { // Secondary Selection struct : ConfigurableGroup { - Configurable cfgReturnFlag{"cfgReturnFlag", false, "Return Flag for debugging"}; + Configurable cfgReturnFlag{"cfgReturnFlag", true, "Return Flag for debugging"}; Configurable cfgSecondaryRequire{"cfgSecondaryRequire", true, "Secondary cuts on/off"}; Configurable cfgSecondaryArmenterosCut{"cfgSecondaryArmenterosCut", true, "cut on Armenteros-Podolanski graph"}; Configurable cfgSecondaryCrossMassHypothesisCut{"cfgSecondaryCrossMassHypothesisCut", false, "Apply cut based on the lambda mass hypothesis"}; Configurable cfgByPassDauPIDSelection{"cfgByPassDauPIDSelection", true, "Bypass Daughters PID selection"}; Configurable cfgSecondaryDauDCAMax{"cfgSecondaryDauDCAMax", 1., "Maximum DCA Secondary daughters to PV"}; - Configurable cfgSecondaryDauPosDCAtoPVMin{"cfgSecondaryDauPosDCAtoPVMin", 0.0, "Minimum DCA Secondary positive daughters to PV"}; - Configurable cfgSecondaryDauNegDCAtoPVMin{"cfgSecondaryDauNegDCAtoPVMin", 0.0, "Minimum DCA Secondary negative daughters to PV"}; + Configurable cfgSecondaryDauPosDCAtoPVMin{"cfgSecondaryDauPosDCAtoPVMin", 0.1, "Minimum DCA Secondary positive daughters to PV"}; + Configurable cfgSecondaryDauNegDCAtoPVMin{"cfgSecondaryDauNegDCAtoPVMin", 0.1, "Minimum DCA Secondary negative daughters to PV"}; Configurable cfgSecondaryPtMin{"cfgSecondaryPtMin", 0.f, "Minimum transverse momentum of Secondary"}; Configurable cfgSecondaryRapidityMax{"cfgSecondaryRapidityMax", 0.8, "Maximum rapidity of Secondary"}; - Configurable cfgSecondaryRadiusMin{"cfgSecondaryRadiusMin", 1.2, "Minimum transverse radius of Secondary"}; + Configurable cfgSecondaryRadiusMin{"cfgSecondaryRadiusMin", 0, "Minimum transverse radius of Secondary"}; Configurable cfgSecondaryRadiusMax{"cfgSecondaryRadiusMax", 999.9, "Maximum transverse radius of Secondary"}; Configurable cfgSecondaryCosPAMin{"cfgSecondaryCosPAMin", 0.995, "Mininum cosine pointing angle of Secondary"}; - Configurable cfgSecondaryDCAtoPVMax{"cfgSecondaryDCAtoPVMax", 0.3, "Maximum DCA Secondary to PV"}; + Configurable cfgSecondaryDCAtoPVMax{"cfgSecondaryDCAtoPVMax", 0.4, "Maximum DCA Secondary to PV"}; Configurable cfgSecondaryProperLifetimeMax{"cfgSecondaryProperLifetimeMax", 20, "Maximum Secondary Lifetime"}; Configurable cfgSecondaryparamArmenterosCut{"cfgSecondaryparamArmenterosCut", 0.2, "parameter for Armenteros Cut"}; Configurable cfgSecondaryMassWindow{"cfgSecondaryMassWindow", 0.03, "Secondary inv mass selciton window"}; @@ -273,12 +291,29 @@ struct Chk892pp { AxisSpec pidQAAxis = {130 / AxisConfig.cNbinsDivQA, -6.5, 6.5}; AxisSpec dataTypeAxis = {9, 0, 9, "Histogram types"}; AxisSpec mcTypeAxis = {4, 0, 4, "Histogram types"}; + AxisSpec cutAxis{14, 0.5, 14.5, "Check"}; // 1..14 // THnSparse AxisSpec axisType = {BinType::kTYEnd, 0, BinType::kTYEnd, "Type of bin with charge and mix"}; AxisSpec mcLabelAxis = {5, -0.5, 4.5, "MC Label"}; - histos.add("QA/K0sCutCheck", "Check K0s cut", HistType::kTH1D, {AxisSpec{12, -0.5, 11.5, "Check"}}); + histos.add("QA/K0sCutCheck", "Check K0s cut", HistType::kTH1D, {AxisSpec{13, -0.5, 12.5, "Check"}}); + histos.add("QA/K0sCutFlow", "Check K0s cut (first-fail or pass)", HistType::kTH1F, {cutAxis}); + auto hcut = histos.get(HIST("QA/K0sCutFlow")); + hcut->GetXaxis()->SetBinLabel(1, "TOTAL"); // 총 후보 수 + hcut->GetXaxis()->SetBinLabel(2, "PASS"); // 최종 통과 + hcut->GetXaxis()->SetBinLabel(3, "DauDCA>max"); + hcut->GetXaxis()->SetBinLabel(4, "PosDCAtoPVGetXaxis()->SetBinLabel(5, "NegDCAtoPVGetXaxis()->SetBinLabel(6, "pTGetXaxis()->SetBinLabel(7, "|y|>max"); + hcut->GetXaxis()->SetBinLabel(8, "Rmax"); + hcut->GetXaxis()->SetBinLabel(9, "DCAtoPV>max"); + hcut->GetXaxis()->SetBinLabel(10, "cosPAGetXaxis()->SetBinLabel(11, "ctau>max"); + hcut->GetXaxis()->SetBinLabel(12, "qtarmGetXaxis()->SetBinLabel(13, "|M(K0s)-m0|>win"); + hcut->GetXaxis()->SetBinLabel(14, "cross-mass veto"); histos.add("QA/before/CentDist", "Centrality distribution", {HistType::kTH1D, {centAxis}}); histos.add("QA/before/VtxZ", "Centrality distribution", {HistType::kTH1D, {vtxzAxis}}); @@ -376,62 +411,30 @@ struct Chk892pp { // MC if (doprocessMC) { - histos.add("QAMC/hEvent", "Number of Events", HistType::kTH1F, {{1, 0.5, 1.5}}); - // Bachelor pion - histos.add("QAMC/trkbpionDCAxy", "DCAxy distribution of bachelor pion candidates", HistType::kTH1D, {dcaxyAxis}); - histos.add("QAMC/trkbpionDCAz", "DCAz distribution of bachelor pion candidates", HistType::kTH1D, {dcazAxis}); - histos.add("QAMC/trkbpionpT", "pT distribution of bachelor pion candidates", HistType::kTH1D, {ptAxis}); - histos.add("QAMC/trkbpionTPCPID", "TPC PID of bachelor pion candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); - histos.add("QAMC/trkbpionTOFPID", "TOF PID of bachelor pion candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); - histos.add("QAMC/trkbpionTPCTOFPID", "TPC-TOF PID map of bachelor pion candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); - - // Secondary pion 1 - histos.add("QAMC/trkppionDCAxy", "DCAxy distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {dcaxyAxis}); - histos.add("QAMC/trkppionDCAz", "DCAz distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {dcazAxis}); - histos.add("QAMC/trkppionpT", "pT distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {ptAxis}); - histos.add("QAMC/trkppionTPCPID", "TPC PID of secondary pion 1 (positive) candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); - histos.add("QAMC/trkppionTOFPID", "TOF PID of secondary pion 1 (positive) candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); - histos.add("QAMC/trkppionTPCTOFPID", "TPC-TOF PID map of secondary pion 1 (positive) candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); - - // Secondary pion 2 - histos.add("QAMC/trknpionTPCPID", "TPC PID of secondary pion 2 (negative) candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); - histos.add("QAMC/trknpionTOFPID", "TOF PID of secondary pion 2 (negative) candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); - histos.add("QAMC/trknpionTPCTOFPID", "TPC-TOF PID map of secondary pion 2 (negative) candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); - histos.add("QAMC/trknpionpT", "pT distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {ptAxis}); - histos.add("QAMC/trknpionDCAxy", "DCAxy distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {dcaxyAxis}); - histos.add("QAMC/trknpionDCAz", "DCAz distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {dcazAxis}); - - // Secondary Resonance (K0s cand) - histos.add("QAMC/hDauDCASecondary", "DCA of daughters of secondary resonance", HistType::kTH1D, {dcaAxis}); - histos.add("QAMC/hDauPosDCAtoPVSecondary", "Pos DCA to PV of daughters secondary resonance", HistType::kTH1D, {dcaAxis}); - histos.add("QAMC/hDauNegDCAtoPVSecondary", "Neg DCA to PV of daughters secondary resonance", HistType::kTH1D, {dcaAxis}); - - histos.add("QAMC/hpT_Secondary", "pT distribution of secondary resonance", HistType::kTH1D, {ptAxis}); - histos.add("QAMC/hy_Secondary", "Rapidity distribution of secondary resonance", HistType::kTH1D, {yAxis}); - histos.add("QAMC/hRadiusSecondary", "Radius distribution of secondary resonance", HistType::kTH1D, {radiusAxis}); - histos.add("QAMC/hCPASecondary", "Cosine pointing angle distribution of secondary resonance", HistType::kTH1D, {cpaAxis}); - histos.add("QAMC/hDCAtoPVSecondary", "DCA to PV distribution of secondary resonance", HistType::kTH1D, {dcaAxis}); - histos.add("QAMC/hPropTauSecondary", "Proper Lifetime distribution of secondary resonance", HistType::kTH1D, {tauAxis}); - histos.add("QAMC/hPtAsymSecondary", "pT asymmetry distribution of secondary resonance", HistType::kTH1D, {AxisSpec{100, -1, 1, "Pair asymmetry"}}); - histos.add("QAMC/hInvmassSecondary", "Invariant mass of unlike-sign secondary resonance", HistType::kTH1D, {invMassAxisK0s}); - - // K892 - histos.add("QAMC/KstarOA", "Opening angle of chK(892)", HistType::kTH1D, {AxisSpec{100, 0, 3.14, "Opening angle"}}); - histos.add("QAMC/KstarPairAsym", "Pair asymmetry of chK(892)", HistType::kTH1D, {AxisSpec{100, -1, 1, "Pair asymmetry"}}); - histos.add("QAMC/KstarRapidity", "Rapidity distribution of chK(892)", HistType::kTH1D, {yAxis}); - - histos.add("QAMC/kstarinvmass", "Invariant mass of unlike-sign chK(892)", HistType::kTH1D, {invMassAxisReso}); - histos.add("QAMC/kstarinvmass_noKstar", "Invariant mass of unlike-sign no chK(892)", HistType::kTH1D, {invMassAxisReso}); - - histos.add("hInvmass_Kstar_MC", "Invariant mass of unlike chK(892)", HistType::kTHnSparseD, {axisType, centAxis, ptAxis, invMassAxisReso}); - - ccdb->setURL(CCDBConfig.cfgURL); - ccdbApi.init("http://alice-ccdb.cern.ch"); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + histos.add("QACent_woCut", "Centrality without cut", HistType::kTH1F, {centAxis}); + histos.add("QACent_woCentCut", "Centrality without cent cut", HistType::kTH1F, {centAxis}); + histos.add("QACent_wCentCut", "Centrality with cent cut", HistType::kTH1F, {centAxis}); + histos.add("QAvtxz_woCut", "z-vertex without cut", HistType::kTH1F, {vtxzAxis}); + histos.add("QAvtxz_wVtxzCut", "z-vertex with vtxz cut", HistType::kTH1F, {vtxzAxis}); + + histos.add("EffK0s/genK0s", "Gen K0s (|y<0.8|)", HistType::kTH2F, {ptAxisQA, centAxis}); + histos.add("EffK0s/recoK0s", "Reco K0s (|y<0.8|)", HistType::kTH2F, {ptAxisQA, centAxis}); + + histos.add("EffKstar/genKstar", "Gen Kstar (|y|<0.5)", HistType::kTH2F, {ptAxisQA, centAxis}); + histos.add("EffKstar/genKstar_m", "Gen Kstar (|y|<0.5) invariant mass distribution", HistType::kTH1F, {invMassAxisReso}); + histos.add("EffKstar/recoKstar", "Kstar Reco matched (final all)", HistType::kTH2F, {ptAxisQA, centAxis}); + histos.add("EffKstar/recoKstar_m", "Kstar Reco (final all) invariant mass distribution", HistType::kTH2F, {ptAxisQA, invMassAxisReso}); + histos.add("EffKstar/recoKstar_m_rot", "Kstar Reco (final all) invariant mass distribution of Rot", HistType::kTH2F, {ptAxisQA, invMassAxisReso}); + + histos.add("EffKstar/recoKstar_m_matched", "Kstar Reco matched (final all) invariant mass distribution", HistType::kTH2F, {ptAxisQA, invMassAxisReso}); } + ccdb->setURL(CCDBConfig.cfgURL); + ccdbApi.init("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + // Print output histograms statistics LOG(info) << "Size of the histograms in chK(892) Analysis Task"; histos.print(); @@ -528,36 +531,35 @@ struct Chk892pp { template bool selectionPIDPion(TrackType const& candidate) { - bool tpcPIDPassed = std::abs(candidate.tpcNSigmaPi()) < PIDCuts.cfgMaxTPCnSigmaPion; - bool tofPIDPassed = false; - - if (PIDCuts.cfgTPConly) { - return tpcPIDPassed; - } + if (std::abs(candidate.tpcNSigmaPi()) >= PIDCuts.cfgMaxTPCnSigmaPion) + return false; + if (PIDCuts.cfgTPConly) + return true; + if (candidate.pt() <= PIDCuts.cfgTOFMinPt) + return true; if (candidate.hasTOF()) { - tofPIDPassed = std::abs(candidate.tofNSigmaPi()) < PIDCuts.cfgMaxTOFnSigmaPion || - (PIDCuts.cfgNsigmaCutCombinedPion > 0 && - candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi() + - candidate.tofNSigmaPi() * candidate.tofNSigmaPi() < - PIDCuts.cfgNsigmaCutCombinedPion * PIDCuts.cfgNsigmaCutCombinedPion); + const bool tofPIDPassed = std::abs(candidate.tofNSigmaPi()) < PIDCuts.cfgMaxTOFnSigmaPion; + const bool combo = (PIDCuts.cfgNsigmaCutCombinedPion > 0) && + (candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi() + + candidate.tofNSigmaPi() * candidate.tofNSigmaPi() < + PIDCuts.cfgNsigmaCutCombinedPion * PIDCuts.cfgNsigmaCutCombinedPion); + return tofPIDPassed || combo; } else { - tofPIDPassed = PIDCuts.cfgTOFVeto; + return PIDCuts.cfgTOFVeto; } - - return tpcPIDPassed && tofPIDPassed; } template bool selectionK0s(CollisionType const& collision, K0sType const& candidate) { - auto lDauDCA = candidate.dcaV0daughters(); - auto lDauPosDCAtoPV = candidate.dcapostopv(); - auto lDauNegDCAtoPV = candidate.dcanegtopv(); + auto lDauDCA = std::fabs(candidate.dcaV0daughters()); + auto lDauPosDCAtoPV = std::fabs(candidate.dcapostopv()); + auto lDauNegDCAtoPV = std::fabs(candidate.dcanegtopv()); auto lPt = candidate.pt(); auto lRapidity = candidate.yK0Short(); auto lRadius = candidate.v0radius(); - auto lDCAtoPV = candidate.dcav0topv(); + auto lDCAtoPV = std::fabs(candidate.dcav0topv()); auto lCPA = candidate.v0cosPA(); auto lPropTauK0s = candidate.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * MassK0Short; auto lMk0s = candidate.mK0Short(); @@ -565,11 +567,11 @@ struct Chk892pp { auto lMALambda = candidate.mAntiLambda(); auto checkCommonCuts = [&]() { - if (lDauDCA > SecondaryCuts.cfgSecondaryDauDCAMax) + if (std::fabs(lDauDCA) > SecondaryCuts.cfgSecondaryDauDCAMax) return false; - if (lDauPosDCAtoPV < SecondaryCuts.cfgSecondaryDauPosDCAtoPVMin) + if (std::fabs(lDauPosDCAtoPV) < SecondaryCuts.cfgSecondaryDauPosDCAtoPVMin) return false; - if (lDauNegDCAtoPV < SecondaryCuts.cfgSecondaryDauNegDCAtoPVMin) + if (std::fabs(lDauNegDCAtoPV) < SecondaryCuts.cfgSecondaryDauNegDCAtoPVMin) return false; if (lPt < SecondaryCuts.cfgSecondaryPtMin) return false; @@ -577,13 +579,13 @@ struct Chk892pp { return false; if (lRadius < SecondaryCuts.cfgSecondaryRadiusMin || lRadius > SecondaryCuts.cfgSecondaryRadiusMax) return false; - if (lDCAtoPV > SecondaryCuts.cfgSecondaryDCAtoPVMax) + if (std::fabs(lDCAtoPV) > SecondaryCuts.cfgSecondaryDCAtoPVMax) return false; if (lCPA < SecondaryCuts.cfgSecondaryCosPAMin) return false; if (lPropTauK0s > SecondaryCuts.cfgSecondaryProperLifetimeMax) return false; - if (candidate.qtarm() < SecondaryCuts.cfgSecondaryparamArmenterosCut * std::abs(candidate.alpha())) + if (candidate.qtarm() < SecondaryCuts.cfgSecondaryparamArmenterosCut * std::fabs(candidate.alpha())) return false; if (std::fabs(lMk0s - MassK0Short) > SecondaryCuts.cfgSecondaryMassWindow) return false; @@ -632,7 +634,7 @@ struct Chk892pp { histos.fill(HIST("QA/K0sCutCheck"), 9); returnFlag = false; } - if (candidate.qtarm() < SecondaryCuts.cfgSecondaryparamArmenterosCut * std::abs(candidate.alpha())) { + if (candidate.qtarm() < SecondaryCuts.cfgSecondaryparamArmenterosCut * std::fabs(candidate.alpha())) { histos.fill(HIST("QA/K0sCutCheck"), 10); returnFlag = false; } @@ -689,11 +691,274 @@ struct Chk892pp { return true; } + std::unordered_set allowedMcIds; + std::unordered_map centByMcIds; + + void buildAllowedMcIds(MCEventCandidates const& events) + { + allowedMcIds.clear(); + centByMcIds.clear(); + + for (const auto& coll : events) { + lCentrality = getCentrality(coll); + histos.fill(HIST("QACent_woCut"), lCentrality); + histos.fill(HIST("QAvtxz_woCut"), coll.posZ()); + + if (!colCuts.isSelected(coll)) + continue; + if (!coll.isInelGt0()) + continue; + + histos.fill(HIST("QACent_woCentCut"), lCentrality); + histos.fill(HIST("QAvtxz_wVtxzCut"), coll.posZ()); + + if (lCentrality < EventCuts.cfgEventCentralityMin || lCentrality > EventCuts.cfgEventCentralityMax) + continue; + histos.fill(HIST("QACent_wCentCut"), lCentrality); + if (!coll.has_mcCollision()) + continue; + const auto mcid = coll.mcCollisionId(); + if (mcid < 0) + continue; + allowedMcIds.insert(mcid); + centByMcIds[mcid] = lCentrality; + } + } + + void effK0sProcessGen(MCTrueTrackCandidates const& mcparts) + { + for (const auto& part : mcparts) { + const auto mcid = part.mcCollisionId(); + + if (!part.has_mcCollision()) + continue; + if (part.pdgCode() != kPDGK0s) + continue; + if (!part.isPhysicalPrimary()) + continue; + if (allowedMcIds.find(mcid) == allowedMcIds.end()) + continue; + + auto iter = centByMcIds.find(mcid); + if (iter == centByMcIds.end()) + continue; + + const float lCentrality = iter->second; + + if (std::abs(part.y()) > SecondaryCuts.cfgSecondaryRapidityMax) + continue; + + histos.fill(HIST("EffK0s/genK0s"), part.pt(), lCentrality); + } + } + + void effK0sProcessReco(MCV0Candidates const& v0s) + { + for (const auto& v0 : v0s) { + auto coll = v0.template collision_as(); + + if (!coll.has_mcCollision()) + continue; + + const auto mcid = coll.mcCollisionId(); + + if (allowedMcIds.find(mcid) == allowedMcIds.end()) + continue; + + auto iter = centByMcIds.find(mcid); + if (iter == centByMcIds.end()) + continue; + + const float lCentrality = iter->second; + + const double ptreco = v0.pt(); + const double yreco = v0.yK0Short(); + + double ptgen = -1, ygen = 0; + if (!getTruthK0sAndGenKinematics(v0, ptgen, ygen)) + continue; + if (std::abs(yreco) > SecondaryCuts.cfgSecondaryRapidityMax) + continue; + + if (!SecondaryCuts.cfgByPassDauPIDSelection) { + auto posDauTrack = v0.template posTrack_as(); + auto negDauTrack = v0.template negTrack_as(); + if (!selectionPIDPion(posDauTrack)) + continue; + if (!selectionPIDPion(negDauTrack)) + continue; + } + if (!selectionK0s(coll, v0)) + continue; + + histos.fill(HIST("EffK0s/recoK0s"), ptreco, lCentrality); + } + } // effK0sProcessReco + + template + bool matchRecoToTruthKstar(V0T const& v0, TrkT const& trk, double& ptgen, double& ygen) + { + if (!v0.has_mcParticle() || !trk.has_mcParticle()) + return false; + + auto mcK0s = v0.template mcParticle_as(); + auto mcPi = trk.template mcParticle_as(); + + if (std::abs(mcK0s.pdgCode()) != kPDGK0s) + return false; + if (std::abs(mcPi.pdgCode()) != kPiPlus) + return false; + + MCTrueTrackCandidates::iterator kstarFromPi; + bool havePiKstar = false; + for (const auto& m1 : mcPi.template mothers_as()) { + if (std::abs(m1.pdgCode()) == kKstarPlus) { + kstarFromPi = m1; + havePiKstar = true; + break; + } + } + if (!havePiKstar) { + return false; + } + + bool shareSameKstar = false; + for (const auto& m1 : mcK0s.template mothers_as()) { + if (std::abs(m1.pdgCode()) == kPDGK0) { + for (const auto& m2 : m1.template mothers_as()) { + if (m2.globalIndex() == kstarFromPi.globalIndex()) { + shareSameKstar = true; + break; + } + } + if (shareSameKstar) + break; + } + } + if (!shareSameKstar) { + return false; + } + + ptgen = kstarFromPi.pt(); + ygen = kstarFromPi.y(); + + return true; + } // matchRecoToTruthKstar + + void effKstarProcessGen(MCTrueTrackCandidates const& mcparts) + { + for (const auto& part : mcparts) { + const auto mcid = part.mcCollisionId(); + if (!part.has_mcCollision()) + continue; + if (std::abs(part.pdgCode()) != kKstarPlus) + continue; + if (allowedMcIds.find(mcid) == allowedMcIds.end()) + continue; + + auto iter = centByMcIds.find(mcid); + if (iter == centByMcIds.end()) + continue; + + const float lCentrality = iter->second; + + if (std::abs(part.y()) > KstarCuts.cfgKstarMaxRap) + continue; + + const double px = part.px(), py = part.py(), pz = part.pz(), e = part.e(); + const double mgen2 = e * e - (px * px + py * py + pz * pz); + const double mgen = (mgen2 > 0.0) ? std::sqrt(mgen2) : 0.0; + + histos.fill(HIST("EffKstar/genKstar"), part.pt(), lCentrality); + histos.fill(HIST("EffKstar/genKstar_m"), mgen); + } + } // effKstarProcessGen + + template + void effKstarProcessReco(V0RangeT const& v0s, TrkRangeT const& tracks) + { + for (const auto& v0 : v0s) { + auto coll = v0.template collision_as(); + + if (!coll.has_mcCollision()) + continue; + + const auto mcid = coll.mcCollisionId(); + + if (allowedMcIds.find(mcid) == allowedMcIds.end()) + continue; + + auto iter = centByMcIds.find(mcid); + if (iter == centByMcIds.end()) + continue; + + const float lCentrality = iter->second; + + if (!SecondaryCuts.cfgByPassDauPIDSelection) { + auto posDauTrack = v0.template posTrack_as(); + auto negDauTrack = v0.template negTrack_as(); + if (!selectionPIDPion(posDauTrack)) + continue; + if (!selectionPIDPion(negDauTrack)) + continue; + } + if (!selectionK0s(coll, v0)) + continue; + + auto trks = tracks.sliceBy(perCollision, v0.collisionId()); + for (const auto& bTrack : trks) { + if (bTrack.collisionId() != v0.collisionId()) + continue; + + if (!trackCut(bTrack)) + continue; + if (!selectionPIDPion(bTrack)) + continue; + + LorentzVectorSetXYZM lResoSecondary, lDecayDaughter_bach, lResoKstar, lDaughterRot, lResonanceRot; + + lResoSecondary = LorentzVectorSetXYZM(v0.px(), v0.py(), v0.pz(), v0.mK0Short()); + lDecayDaughter_bach = LorentzVectorSetXYZM(bTrack.px(), bTrack.py(), bTrack.pz(), MassPionCharged); + lResoKstar = lResoSecondary + lDecayDaughter_bach; + + histos.fill(HIST("EffKstar/recoKstar_m"), lResoKstar.Pt(), lResoKstar.M()); + + if (BkgEstimationConfig.cfgFillRotBkg) { + for (int i = 0; i < BkgEstimationConfig.cfgNrotBkg; i++) { + auto lRotAngle = BkgEstimationConfig.cfgMinRot + i * ((BkgEstimationConfig.cfgMaxRot - BkgEstimationConfig.cfgMinRot) / (BkgEstimationConfig.cfgNrotBkg - 1)); + + lDaughterRot = lDecayDaughter_bach; + ROOT::Math::RotationZ rot(lRotAngle); + auto p3 = rot * lDaughterRot.Vect(); + lDaughterRot = LorentzVectorSetXYZM(p3.X(), p3.Y(), p3.Z(), lDaughterRot.M()); + lResonanceRot = lDaughterRot + lResoSecondary; + + histos.fill(HIST("EffKstar/recoKstar_m_rot"), lResonanceRot.Pt(), lResonanceRot.M()); + } + } + + double ptgen = 0, ygen = 0; + if (!matchRecoToTruthKstar(v0, bTrack, ptgen, ygen)) + continue; + + const double ptreco = lResoKstar.Pt(); + const double yreco = lResoKstar.Rapidity(); + + if (std::abs(yreco) > KstarCuts.cfgKstarMaxRap) + continue; + histos.fill(HIST("EffKstar/recoKstar"), ptreco, lCentrality); + histos.fill(HIST("EffKstar/recoKstar_m_matched"), ptreco, lResoKstar.M()); + } + } + } // effKstarProcessReco + int count = 0; template void fillHistograms(const CollisionType& collision, const TracksType& dTracks1, const TracksTypeK0s& dTracks2) { + using TrackTarget = std::decay_t; + histos.fill(HIST("QA/before/CentDist"), lCentrality); LorentzVectorSetXYZM lDecayDaughter1, lDecayDaughter2, lResoSecondary, lDecayDaughter_bach, lResoKstar, lDaughterRot, lResonanceRot; @@ -738,8 +1003,10 @@ struct Chk892pp { } for (const auto& k0sCand : dTracks2) { - auto posDauTrack = k0sCand.template posTrack_as(); - auto negDauTrack = k0sCand.template negTrack_as(); + // auto posDauTrack = k0sCand.template posTrack_as(); + // auto negDauTrack = k0sCand.template negTrack_as(); + auto posDauTrack = k0sCand.template posTrack_as(); + auto negDauTrack = k0sCand.template negTrack_as(); /// Daughters // Positve pion @@ -765,6 +1032,8 @@ struct Chk892pp { auto trkkpt = k0sCand.pt(); auto trkkRadius = k0sCand.v0radius(); + lResoSecondary = LorentzVectorSetXYZM(k0sCand.px(), k0sCand.py(), k0sCand.pz(), trkkMass); + if constexpr (!IsMix) { // Seconddary QA plots histos.fill(HIST("QA/before/trkppionTPCPID"), trkppt, trkpNSigmaPiTPC); @@ -913,24 +1182,42 @@ struct Chk892pp { lCentrality = getCentrality(collision); if (lCentrality < EventCuts.cfgEventCentralityMin || lCentrality > EventCuts.cfgEventCentralityMax) return; + if (!collision.isInelGt0()) + return; colCuts.fillQA(collision); fillHistograms(collision, tracks, v0s); // second order } - PROCESS_SWITCH(Chk892pp, processData, "Process Event for data without Partitioning", true); + PROCESS_SWITCH(Chk892pp, processData, "Process Event for data without Partitioning", false); // process MC reconstructed level - void processMC(EventCandidates::iterator const& collision, + void processMC(MCTrueTrackCandidates const& mcpart, MCTrackCandidates const& tracks, - MCV0Candidates const& v0s) + MCV0Candidates const& v0s, + MCEventCandidates const& events) { + buildAllowedMcIds(events); + effK0sProcessGen(mcpart); + effK0sProcessReco(v0s); + effKstarProcessGen(mcpart); + effKstarProcessReco(v0s, tracks); + + for (auto const& collision : events) { + if (!collision.has_mcCollision()) + continue; + const auto mcid = collision.mcCollisionId(); - histos.fill(HIST("QAMC/hEvent"), 1.0); + auto it = centByMcIds.find(mcid); + if (it == centByMcIds.end()) + continue; - fillHistograms(collision, tracks, v0s); + lCentrality = it->second; + fillHistograms(collision, tracks, v0s); + } } - PROCESS_SWITCH(Chk892pp, processMC, "Process Event for MC", false); + PROCESS_SWITCH(Chk892pp, processMC, "Process Event for MC", true); }; + WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; From e8c5fc8145fd141ba0ba4947b83094779e1dbc7c Mon Sep 17 00:00:00 2001 From: aferrero2707 Date: Mon, 29 Sep 2025 10:34:04 +0200 Subject: [PATCH 567/986] [Common,DPG] Add check for RCT CCDB object validity (#13081) --- Common/CCDB/RCTSelectionFlags.h | 42 +++++++++++-- DPG/Tasks/AOTEvent/timeDependentQa.cxx | 81 +++++++++++++------------- 2 files changed, 78 insertions(+), 45 deletions(-) diff --git a/Common/CCDB/RCTSelectionFlags.h b/Common/CCDB/RCTSelectionFlags.h index eca25895962..265b201ffde 100644 --- a/Common/CCDB/RCTSelectionFlags.h +++ b/Common/CCDB/RCTSelectionFlags.h @@ -75,7 +75,15 @@ enum RCTSelectionFlags { kTPCLimAccMCRepr, kTRDBad, kZDCBad, - kNRCTSelectionFlags + kNRCTSelectionFlags, + kDummy24, + kDummy25, + kDummy26, + kDummy27, + kDummy28, + kDummy29, + kDummy30, + kCcdbObjectLoaded }; template @@ -104,9 +112,14 @@ class RCTFlagsChecker : public o2::utils::EnumFlags // The checkZDC boolean flag controls whether to iclude the ZDC quality in all the pre-defined selections (for Pb-Pb data) // The treatLimitedAcceptanceAsBad boolean flag controls whether "LimitedAcceptanceMCReproducible" flags should be // treated as Bad and the corresponding events excluded - explicit RCTFlagsChecker(const std::string& label, bool checkZDC = false, bool treatLimitedAcceptanceAsBad = false) + // The checkTableValidity boolean flag controls whether events without a corresponding valid RCT CCDB object should be + // treated as Bad and excluded + explicit RCTFlagsChecker(const std::string& label, + bool checkZDC = false, + bool treatLimitedAcceptanceAsBad = false, + bool checkTableValidity = false) { - init(label, checkZDC, treatLimitedAcceptanceAsBad); + init(label, checkZDC, treatLimitedAcceptanceAsBad, checkTableValidity); } // Initialize the object from an initializer list of RCTSelectionFlags values @@ -121,13 +134,18 @@ class RCTFlagsChecker : public o2::utils::EnumFlags // - "CBT" // - "CBT_hadronPID" // - "CBT_electronPID" - // - "CBT_calo" + // - "CCBT_calo" // - "CBT_muon" // - "CBT_muon_glo" // The checkZDC boolean flag controls whether to iclude the ZDC quality in all the pre-defined selections (for Pb-Pb data) // The treatLimitedAcceptanceAsBad boolean flag controls whether "LimitedAcceptanceMCReproducible" flags should be // treated as Bad and the corresponding events excluded - void init(const std::string& label, bool checkZDC = false, bool treatLimitedAcceptanceAsBad = false) + // The checkTableValidity boolean flag controls whether events without a corresponding valid RCT CCDB object should be + // treated as Bad and excluded + void init(const std::string& label, + bool checkZDC = false, + bool treatLimitedAcceptanceAsBad = false, + bool checkTableValidity = false) { auto setFlags = [this](std::initializer_list flags) { std::for_each(flags.begin(), @@ -182,14 +200,19 @@ class RCTFlagsChecker : public o2::utils::EnumFlags if (checkZDC) { set(kZDCBad); } + + if (checkTableValidity) { + set(kCcdbObjectLoaded); + } } // Check the RCT column of a given event selection table. // The function returns true if none of the checked flags is set in the RCT column. bool checkTable(const HasRCTFlags auto& table) { + // throw an exception if none of the bits in the checker mask is set if (!any()) { - throw std::out_of_range("RCTFlagsCheckerAlt with empty RCTSelectionFlags bits mask"); + throw std::out_of_range("RCTFlagsChecker has empty RCTSelectionFlags bits mask"); } // bitmask of the current table @@ -201,6 +224,13 @@ class RCTFlagsChecker : public o2::utils::EnumFlags return ((tableBits & flagsBits) == 0); } + // Check the validity of the RCT column of a given event selection table. + // The function returns true if the RCT CCDB object was correctly fetched (bit31 == 0). + bool isTableValid(const HasRCTFlags auto& table) + { + return (table.rct_bit(kCcdbObjectLoaded) == 0); + } + bool operator()(const HasRCTFlags auto& table) { return checkTable(table); diff --git a/DPG/Tasks/AOTEvent/timeDependentQa.cxx b/DPG/Tasks/AOTEvent/timeDependentQa.cxx index bdb6d76fb34..37feccdc7ea 100644 --- a/DPG/Tasks/AOTEvent/timeDependentQa.cxx +++ b/DPG/Tasks/AOTEvent/timeDependentQa.cxx @@ -305,39 +305,40 @@ struct TimeDependentQaTask { // ### QA RCT flags int nRctFlagsTotal = enNumRctFlagsTotal; - histos.add("hSecondsRCTflags", "", kTH2F, {axisSecondsWideBins, {nRctFlagsTotal + 1, -0.5, nRctFlagsTotal + 1 - 0.5, "Monitoring of RCT flags"}}); + histos.add("hSecondsRCTflags", "", kTH2F, {axisSecondsWideBins, {nRctFlagsTotal + 2, -0.5, nRctFlagsTotal + 2 - 0.5, "Monitoring of RCT flags"}}); axRctFlags = reinterpret_cast(histos.get(HIST("hSecondsRCTflags"))->GetYaxis()); axRctFlags->SetBinLabel(1, "NcollisionsSel8"); - axRctFlags->SetBinLabel(2 + kCPVBad, "CPVBad"); - axRctFlags->SetBinLabel(2 + kEMCBad, "EMCBad"); - axRctFlags->SetBinLabel(2 + kEMCLimAccMCRepr, "EMCLimAccMCRepr"); - axRctFlags->SetBinLabel(2 + kFDDBad, "FDDBad"); - axRctFlags->SetBinLabel(2 + kFT0Bad, "FT0Bad"); - axRctFlags->SetBinLabel(2 + kFV0Bad, "FV0Bad"); - axRctFlags->SetBinLabel(2 + kHMPBad, "HMPBad"); - axRctFlags->SetBinLabel(2 + kITSBad, "ITSBad"); - axRctFlags->SetBinLabel(2 + kITSLimAccMCRepr, "ITSLimAccMCRepr"); - axRctFlags->SetBinLabel(2 + kMCHBad, "MCHBad"); - axRctFlags->SetBinLabel(2 + kMCHLimAccMCRepr, "MCHLimAccMCRepr"); - axRctFlags->SetBinLabel(2 + kMFTBad, "MFTBad"); - axRctFlags->SetBinLabel(2 + kMFTLimAccMCRepr, "MFTLimAccMCRepr"); - axRctFlags->SetBinLabel(2 + kMIDBad, "MIDBad"); - axRctFlags->SetBinLabel(2 + kMIDLimAccMCRepr, "MIDLimAccMCRepr"); - axRctFlags->SetBinLabel(2 + kPHSBad, "PHSBad"); - axRctFlags->SetBinLabel(2 + kTOFBad, "TOFBad"); - axRctFlags->SetBinLabel(2 + kTOFLimAccMCRepr, "TOFLimAccMCRepr"); - axRctFlags->SetBinLabel(2 + kTPCBadTracking, "TPCBadTracking"); - axRctFlags->SetBinLabel(2 + kTPCBadPID, "TPCBadPID"); - axRctFlags->SetBinLabel(2 + kTPCLimAccMCRepr, "TPCLimAccMCRepr"); - axRctFlags->SetBinLabel(2 + kTRDBad, "TRDBad"); - axRctFlags->SetBinLabel(2 + kZDCBad, "ZDCBad"); + axRctFlags->SetBinLabel(2, "CcdbNotFound"); + axRctFlags->SetBinLabel(3 + kCPVBad, "CPVBad"); + axRctFlags->SetBinLabel(3 + kEMCBad, "EMCBad"); + axRctFlags->SetBinLabel(3 + kEMCLimAccMCRepr, "EMCLimAccMCRepr"); + axRctFlags->SetBinLabel(3 + kFDDBad, "FDDBad"); + axRctFlags->SetBinLabel(3 + kFT0Bad, "FT0Bad"); + axRctFlags->SetBinLabel(3 + kFV0Bad, "FV0Bad"); + axRctFlags->SetBinLabel(3 + kHMPBad, "HMPBad"); + axRctFlags->SetBinLabel(3 + kITSBad, "ITSBad"); + axRctFlags->SetBinLabel(3 + kITSLimAccMCRepr, "ITSLimAccMCRepr"); + axRctFlags->SetBinLabel(3 + kMCHBad, "MCHBad"); + axRctFlags->SetBinLabel(3 + kMCHLimAccMCRepr, "MCHLimAccMCRepr"); + axRctFlags->SetBinLabel(3 + kMFTBad, "MFTBad"); + axRctFlags->SetBinLabel(3 + kMFTLimAccMCRepr, "MFTLimAccMCRepr"); + axRctFlags->SetBinLabel(3 + kMIDBad, "MIDBad"); + axRctFlags->SetBinLabel(3 + kMIDLimAccMCRepr, "MIDLimAccMCRepr"); + axRctFlags->SetBinLabel(3 + kPHSBad, "PHSBad"); + axRctFlags->SetBinLabel(3 + kTOFBad, "TOFBad"); + axRctFlags->SetBinLabel(3 + kTOFLimAccMCRepr, "TOFLimAccMCRepr"); + axRctFlags->SetBinLabel(3 + kTPCBadTracking, "TPCBadTracking"); + axRctFlags->SetBinLabel(3 + kTPCBadPID, "TPCBadPID"); + axRctFlags->SetBinLabel(3 + kTPCLimAccMCRepr, "TPCLimAccMCRepr"); + axRctFlags->SetBinLabel(3 + kTRDBad, "TRDBad"); + axRctFlags->SetBinLabel(3 + kZDCBad, "ZDCBad"); // combined flags - axRctFlags->SetBinLabel(2 + enCBT, "CBT"); - axRctFlags->SetBinLabel(2 + enCBT_hadronPID, "CBT_hadronPID"); - axRctFlags->SetBinLabel(2 + enCBT_electronPID, "CBT_electronPID"); - axRctFlags->SetBinLabel(2 + enCBT_calo, "CBT_calo"); - axRctFlags->SetBinLabel(2 + enCBT_muon, "CBT_muon"); - axRctFlags->SetBinLabel(2 + enCBT_muon_glo, "CBT_muon_glo"); + axRctFlags->SetBinLabel(3 + enCBT, "CBT"); + axRctFlags->SetBinLabel(3 + enCBT_hadronPID, "CBT_hadronPID"); + axRctFlags->SetBinLabel(3 + enCBT_electronPID, "CBT_electronPID"); + axRctFlags->SetBinLabel(3 + enCBT_calo, "CBT_calo"); + axRctFlags->SetBinLabel(3 + enCBT_muon, "CBT_muon"); + axRctFlags->SetBinLabel(3 + enCBT_muon_glo, "CBT_muon_glo"); // QA for all tracks // const AxisSpec axisChi2ITS{40, 0., 20., "chi2/ndof"}; @@ -568,18 +569,20 @@ struct TimeDependentQaTask { // check RCT flags histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 0); // n collisions sel8 + histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 1, col.rct_bit(kCcdbObjectLoaded)); // CCDB object not loaded + LOGP(debug, "i = 1, bitValue = {}, binLabel={}, binCenter={}", col.rct_bit(kCcdbObjectLoaded), axRctFlags->GetBinLabel(2), axRctFlags->GetBinCenter(2)); for (int iFlag = 0; iFlag < kNRCTSelectionFlags; iFlag++) { - histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 1 + iFlag, col.rct_bit(iFlag)); - LOGP(debug, "i = {}, bitValue = {}, binLabel={}, binCenter={}", iFlag, col.rct_bit(iFlag), axRctFlags->GetBinLabel(2 + iFlag), axRctFlags->GetBinCenter(2 + iFlag)); + histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 2 + iFlag, col.rct_bit(iFlag)); + LOGP(debug, "i = {}, bitValue = {}, binLabel={}, binCenter={}", iFlag, col.rct_bit(iFlag), axRctFlags->GetBinLabel(3 + iFlag), axRctFlags->GetBinCenter(3 + iFlag)); } LOGP(debug, "CBT_hadronPID = {}, kFT0Bad = {}, kITSBad = {}, kTPCBadTracking = {}, kTPCBadPID = {}, kTOFBad = {}, 1 + enCBT_hadronPID = {}, binLabel={}, binCenter={}", rctCheckerCBT_hadronPID(col), - col.rct_bit(kFT0Bad), col.rct_bit(kITSBad), col.rct_bit(kTPCBadTracking), col.rct_bit(kTPCBadPID), col.rct_bit(kTOFBad), 1 + enCBT_hadronPID, axRctFlags->GetBinLabel(2 + enCBT_hadronPID), axRctFlags->GetBinCenter(2 + enCBT_hadronPID)); - histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 1 + enCBT, rctCheckerCBT(col)); - histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 1 + enCBT_hadronPID, rctCheckerCBT_hadronPID(col)); - histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 1 + enCBT_electronPID, rctCheckerCBT_electronPID(col)); - histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 1 + enCBT_calo, rctCheckerCBT_calo(col)); - histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 1 + enCBT_muon, rctCheckerCBT_muon(col)); - histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 1 + enCBT_muon_glo, rctCheckerCBT_muon_glo(col)); + col.rct_bit(kFT0Bad), col.rct_bit(kITSBad), col.rct_bit(kTPCBadTracking), col.rct_bit(kTPCBadPID), col.rct_bit(kTOFBad), 2 + enCBT_hadronPID, axRctFlags->GetBinLabel(3 + enCBT_hadronPID), axRctFlags->GetBinCenter(3 + enCBT_hadronPID)); + histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 2 + enCBT, rctCheckerCBT(col)); + histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 2 + enCBT_hadronPID, rctCheckerCBT_hadronPID(col)); + histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 2 + enCBT_electronPID, rctCheckerCBT_electronPID(col)); + histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 2 + enCBT_calo, rctCheckerCBT_calo(col)); + histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 2 + enCBT_muon, rctCheckerCBT_muon(col)); + histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 2 + enCBT_muon_glo, rctCheckerCBT_muon_glo(col)); // check hadronic rate double hadronicRate = mRateFetcher.fetch(ccdb.service, ts, runNumber, "ZNC hadronic") * 1.e-3; // kHz From 65637232209aeeb2dc1f5ceb054879dcc11caef1 Mon Sep 17 00:00:00 2001 From: blacwovie Date: Mon, 29 Sep 2025 17:02:01 +0800 Subject: [PATCH 568/986] [PWGLF] revert and add trackID in output table (#13156) --- PWGLF/DataModel/LFhe3HadronTables.h | 6 +- PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx | 103 +----------------- 2 files changed, 11 insertions(+), 98 deletions(-) diff --git a/PWGLF/DataModel/LFhe3HadronTables.h b/PWGLF/DataModel/LFhe3HadronTables.h index 07ce17853ea..01340bb0e2a 100644 --- a/PWGLF/DataModel/LFhe3HadronTables.h +++ b/PWGLF/DataModel/LFhe3HadronTables.h @@ -51,6 +51,8 @@ DECLARE_SOA_COLUMN(MassTOFHe3, massTOFHe3, float); DECLARE_SOA_COLUMN(MassTOFHad, massTOFHad, float); DECLARE_SOA_COLUMN(PIDtrkHe3, pidTrkHe3, uint32_t); DECLARE_SOA_COLUMN(PIDtrkHad, pidTrkHad, uint32_t); +DECLARE_SOA_COLUMN(TrackIDHe3, trackIDHe3, int); +DECLARE_SOA_COLUMN(TrackIDHad, trackIDHad, int); DECLARE_SOA_COLUMN(ItsClusterSizeHe3, itsClusterSizeHe3, uint32_t); DECLARE_SOA_COLUMN(ItsClusterSizeHad, itsClusterSizeHad, uint32_t); @@ -115,7 +117,9 @@ DECLARE_SOA_TABLE(he3HadronTable, "AOD", "HE3HADTABLE", he3HadronTablesNS::SharedClustersHe3, he3HadronTablesNS::SharedClustersHad, he3HadronTablesNS::IsBkgUS, - he3HadronTablesNS::IsBkgEM) + he3HadronTablesNS::IsBkgEM, + he3HadronTablesNS::TrackIDHe3, + he3HadronTablesNS::TrackIDHad) DECLARE_SOA_TABLE(he3HadronTableMC, "AOD", "HE3HADTABLEMC", he3HadronTablesNS::PtMCHe3, he3HadronTablesNS::EtaMCHe3, diff --git a/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx b/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx index 3aae88bc3f7..76c2bcb7c01 100644 --- a/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx +++ b/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx @@ -15,7 +15,6 @@ /// \author Your Name (your.email@cern.ch) /// \since April 2025 -#include "PWGCF/FemtoWorld/Core/FemtoWorldMath.h" #include "PWGLF/DataModel/EPCalibrationTables.h" #include "PWGLF/DataModel/LFhe3HadronTables.h" #include "PWGLF/Utils/svPoolCreator.h" @@ -182,8 +181,6 @@ struct He3HadCandidate { // collision information int32_t collisionID = 0; - - float kstarfem = 1.f; }; struct he3HadronFemto { @@ -198,12 +195,10 @@ struct he3HadronFemto { Configurable settingCutRigidityMinHe3{"settingCutRigidityMinHe3", 0.8f, "Minimum rigidity for He3"}; Configurable settingCutEta{"settingCutEta", 0.9f, "Eta cut on daughter track"}; Configurable settingCutDCAxy{"settingCutDCAxy", 2.0f, "DCAxy range for tracks"}; - Configurable settingCutDCAz{"settingCutDCAz", 3.0f, "DCAz range for tracks"}; + Configurable settingCutDCAz{"settingCutDCAz", 2.0f, "DCAz range for tracks"}; Configurable settingCutChi2tpcLow{"settingCutChi2tpcLow", 0.5f, "Low cut on TPC chi2"}; Configurable settingCutInvMass{"settingCutInvMass", 0.0f, "Invariant mass upper limit"}; Configurable settingCutPtMinhe3Had{"settingCutPtMinhe3Had", 0.0f, "Minimum PT cut on he3Had4"}; - Configurable settingCutPtMinHad{"settingCutPtMinHad", 0.0f, "Minimum PT cut on Hadron"}; - Configurable settingCutPtMaxHad{"settingCutPtMaxHad", 0.0f, "Maximum PT cut on Hadron"}; Configurable settingCutClSizeItsHe3{"settingCutClSizeItsHe3", 4.0f, "Minimum ITS cluster size for He3"}; Configurable settingCutNCls{"settingCutNCls", 5.0f, "Minimum ITS Ncluster for tracks"}; Configurable settingCutChi2NClITS{"settingCutChi2NClITS", 36.f, "Maximum ITS Chi2 for tracks"}; @@ -292,14 +287,6 @@ struct he3HadronFemto { {"h2NsigmaHadronTPC_preselection", "NsigmaHe3 TPC distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}(had)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {400, -10.0f, 10.0f}}}}, {"h2NsigmaHadronTOF", "NsigmaHadron TOF distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}(had)", {HistType::kTH2F, {{20, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}}}, {"h2NsigmaHadronTOF_preselection", "NsigmaHadron TOF distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}(had)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {400, -10.0f, 10.0f}}}}, - {"hKstarLSmatter", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}}, - {"hKstarLSantimatter", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}}, - {"hKstarUSmatter", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}}, - {"hKstarUSantimatter", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}}, - {"hKstarLSmatter_femto", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}}, - {"hKstarLSantimatter_femto", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}}, - {"hKstarUSmatter_femto", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}}, - {"hKstarUSantimatter_femto", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}}, }, OutputObjHandlingPolicy::AnalysisObject, false, @@ -440,8 +427,7 @@ struct he3HadronFemto { candidate.tpcNClsCrossedRows() < crossedRowsToFindableRatio * candidate.tpcNClsFindable() || candidate.tpcChi2NCl() > maxChi2NCl || candidate.tpcChi2NCl() < settingCutChi2tpcLow || - candidate.itsChi2NCl() > settingCutChi2NClITS || std::abs(candidate.dcaXY()) > settingCutDCAxy || - std::abs(candidate.dcaZ()) > settingCutDCAz) { + candidate.itsChi2NCl() > settingCutChi2NClITS) { return false; } @@ -622,9 +608,6 @@ struct he3HadronFemto { return false; } - if (std::abs(he3Hadcand.recoPtHad()) < settingCutPtMinHad || std::abs(he3Hadcand.recoPtHad()) > settingCutPtMaxHad) - return false; - he3Hadcand.signHe3 = trackHe3.sign(); he3Hadcand.signHad = trackHad.sign(); if (!settingEnableDCAfitter) { @@ -693,7 +676,6 @@ struct he3HadronFemto { beta = std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked he3Hadcand.massTOFHad = trackHad.tpcInnerParam() * std::sqrt(1.f / (beta * beta) - 1.f); } - he3Hadcand.kstarfem = o2::analysis::femtoWorld::FemtoWorldMath::getkstar(trackHad, o2::constants::physics::MassPiPlus, trackHe3, o2::constants::physics::MassHelium3, 1, 2); return true; } @@ -820,7 +802,9 @@ struct he3HadronFemto { he3Hadcand.sharedClustersHe3, he3Hadcand.sharedClustersHad, he3Hadcand.isBkgUS, - he3Hadcand.isBkgEM); + he3Hadcand.isBkgEM, + he3Hadcand.trackIDHe3, + he3Hadcand.trackIDHad); if (isMC) { outputMcTable( he3Hadcand.momHe3MC, @@ -857,81 +841,6 @@ struct he3HadronFemto { } // ================================================================================================================== - double computePrTPCnsig(double InnerParamTPCHad, double SignalTPCHad) - { - double m_BBparamsProton[6] = {-54.42066571222577, 0.2857381250239097, 1.247140602468868, 0.6297483918147729, 2.985438833884555, 0.09}; - - float TPCinnerParam = InnerParamTPCHad; - float expTPCSignal = o2::tpc::BetheBlochAleph((TPCinnerParam / 0.9382721), m_BBparamsProton[0], m_BBparamsProton[1], m_BBparamsProton[2], m_BBparamsProton[3], m_BBparamsProton[4]); - double resoTPC{expTPCSignal * m_BBparamsProton[5]}; - return ((SignalTPCHad - expTPCSignal) / resoTPC); - } - - double tofNSigmaCalculation(double MassTOFHad, double ptHad) - { - double fExpTOFMassHad = 0.9487; // Proton mass in TOF - const float kp0 = 1.22204e-02; - const float kp1 = 7.48467e-01; - - double fSigmaTOFMassHad = (kp0 * TMath::Exp(kp1 * TMath::Abs(ptHad))) * fExpTOFMassHad; - double fNSigmaTOFHad = (MassTOFHad - fExpTOFMassHad) / fSigmaTOFMassHad; - return fNSigmaTOFHad; - } - - static float computeKstar(const He3HadCandidate& he3Hadcand) - { - const float massHe = o2::constants::physics::MassHelium3; - const float massHad = o2::constants::physics::MassPiPlus; - - const ROOT::Math::PtEtaPhiMVector He(std::abs(he3Hadcand.recoPtHe3()), he3Hadcand.recoEtaHe3(), he3Hadcand.recoPhiHe3(), massHe); - const ROOT::Math::PtEtaPhiMVector Had(std::abs(he3Hadcand.recoPtHad()), he3Hadcand.recoEtaHad(), he3Hadcand.recoPhiHad(), massHad); - const ROOT::Math::PtEtaPhiMVector trackSum = He + Had; - - const float beta = trackSum.Beta(); - const float betax = beta * std::cos(trackSum.Phi()) * std::sin(trackSum.Theta()); - const float betay = beta * std::sin(trackSum.Phi()) * std::sin(trackSum.Theta()); - const float betaz = beta * std::cos(trackSum.Theta()); - - ROOT::Math::PxPyPzMVector HeCMS(He); - ROOT::Math::PxPyPzMVector HadCMS(Had); - - const ROOT::Math::Boost boostPRF = ROOT::Math::Boost(-betax, -betay, -betaz); - HeCMS = boostPRF(HeCMS); - HadCMS = boostPRF(HadCMS); - - const ROOT::Math::PxPyPzMVector RelKstar = HeCMS - HadCMS; - return 0.5 * RelKstar.P(); - } - - void fillKstar(const He3HadCandidate& he3Hadcand) - { - double PrTPCnsigma = computePrTPCnsig(he3Hadcand.momHadTPC, he3Hadcand.tpcSignalHad); - double PrTOFnsigma = tofNSigmaCalculation(he3Hadcand.massTOFHad, he3Hadcand.recoPtHad()); - if (std::abs(PrTPCnsigma) < 3) - return; - if (std::abs(PrTOFnsigma) < 3) - return; - - float kstar = computeKstar(he3Hadcand); - if (he3Hadcand.isBkgUS == 0) { - if (he3Hadcand.recoPtHe3() > 0) { - mQaRegistry.fill(HIST("hKstarLSmatter"), kstar); - mQaRegistry.fill(HIST("hKstarLSmatter_femto"), he3Hadcand.kstarfem); - } else { - mQaRegistry.fill(HIST("hKstarLSantimatter"), kstar); - mQaRegistry.fill(HIST("hKstarLSantimatter_femto"), he3Hadcand.kstarfem); - } - } else { - if (he3Hadcand.recoPtHe3() > 0) { - mQaRegistry.fill(HIST("hKstarUSmatter"), kstar); - mQaRegistry.fill(HIST("hKstarUSmatter_femto"), he3Hadcand.kstarfem); - } else { - mQaRegistry.fill(HIST("hKstarUSantimatter"), kstar); - mQaRegistry.fill(HIST("hKstarUSantimatter_femto"), he3Hadcand.kstarfem); - } - } - fillHistograms(he3Hadcand); - } template void fillPairs(const Tcollisions& collisions, const Ttracks& tracks, const bool isMixedEvent) @@ -946,7 +855,7 @@ struct he3HadronFemto { if (!fillCandidateInfo(heTrack, hadTrack, collBracket, collisions, he3Hadcand, tracks, isMixedEvent)) { continue; } - fillKstar(he3Hadcand); + fillHistograms(he3Hadcand); auto collision = collisions.rawIteratorAt(he3Hadcand.collisionID); fillTable(he3Hadcand, collision, /*isMC*/ false); } From 79ae1dae8ffb9df365fe70bd7991aa55c3289764 Mon Sep 17 00:00:00 2001 From: Oleksii Lubynets Date: Mon, 29 Sep 2025 12:59:01 +0200 Subject: [PATCH 569/986] [PWGDQ,PWGLF,DPG] TPC PID: fill clean kaon sample from Omega decay (#12947) Co-authored-by: ALICE Builder --- DPG/Tasks/TPC/tpcSkimsTableCreator.cxx | 236 +++++++++++++++--- PWGDQ/DataModel/ReducedInfoTables.h | 8 + PWGDQ/Tasks/v0selector.cxx | 332 +++++++++++++++++++------ PWGLF/DataModel/LFStrangenessTables.h | 77 +++++- 4 files changed, 546 insertions(+), 107 deletions(-) diff --git a/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx b/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx index 2a2d644e7c4..136af7ab61c 100644 --- a/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx +++ b/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx @@ -60,6 +60,7 @@ struct TreeWriterTpcV0 { using Colls = soa::Join; using MyBCTable = soa::Join; using V0sWithID = soa::Join; + using CascsWithID = soa::Join; /// Tables to be produced Produces rowTPCTree; @@ -76,13 +77,26 @@ struct TreeWriterTpcV0 { Configurable dwnSmplFactor_Pi{"dwnSmplFactor_Pi", 1., "downsampling factor for pions, default fraction to keep is 1."}; Configurable dwnSmplFactor_Pr{"dwnSmplFactor_Pr", 1., "downsampling factor for protons, default fraction to keep is 1."}; Configurable dwnSmplFactor_El{"dwnSmplFactor_El", 1., "downsampling factor for electrons, default fraction to keep is 1."}; + Configurable dwnSmplFactor_Ka{"dwnSmplFactor_Ka", 1., "downsampling factor for kaons, default fraction to keep is 1."}; Configurable sqrtSNN{"sqrt_s_NN", 0., "sqrt(s_NN), used for downsampling with the Tsallis distribution"}; Configurable downsamplingTsalisPions{"downsamplingTsalisPions", -1., "Downsampling factor to reduce the number of pions"}; Configurable downsamplingTsalisProtons{"downsamplingTsalisProtons", -1., "Downsampling factor to reduce the number of protons"}; Configurable downsamplingTsalisElectrons{"downsamplingTsalisElectrons", -1., "Downsampling factor to reduce the number of electrons"}; + Configurable downsamplingTsalisKaons{"downsamplingTsalisKaons", -1., "Downsampling factor to reduce the number of kaons"}; Configurable maxPt4dwnsmplTsalisPions{"maxPt4dwnsmplTsalisPions", 100., "Maximum Pt for applying downsampling factor of pions"}; Configurable maxPt4dwnsmplTsalisProtons{"maxPt4dwnsmplTsalisProtons", 100., "Maximum Pt for applying downsampling factor of protons"}; Configurable maxPt4dwnsmplTsalisElectrons{"maxPt4dwnsmplTsalisElectrons", 100., "Maximum Pt for applying downsampling factor of electrons"}; + Configurable maxPt4dwnsmplTsalisKaons{"maxPt4dwnsmplTsalisKaons", 100., "Maximum Pt for applying downsampling factor of kaons"}; + + enum { // Reconstructed V0 + kUndef = -1, + kGamma = 0, + kK0S = 1, + kLambda = 2, + kAntiLambda = 3, + kOmega = 4, + kAntiOmega = 5 + }; Filter trackFilter = (trackSelection.node() == 0) || ((trackSelection.node() == 1) && requireGlobalTrackInFilter()) || @@ -94,8 +108,8 @@ struct TreeWriterTpcV0 { ctpRateFetcher mRateFetcher; /// Funktion to fill skimmed tables - template - void fillSkimmedV0Table(V0 const& v0, T const& track, C const& collision, const float nSigmaTPC, const float nSigmaTOF, const float dEdxExp, const o2::track::PID::ID id, int runnumber, double dwnSmplFactor, float hadronicRate) + template + void fillSkimmedV0Table(V0Casc const& v0casc, T const& track, C const& collision, const float nSigmaTPC, const float nSigmaTOF, const float dEdxExp, const o2::track::PID::ID id, int runnumber, double dwnSmplFactor, float hadronicRate) { const double ncl = track.tpcNClsFound(); @@ -107,12 +121,12 @@ struct TreeWriterTpcV0 { auto trackocc = collision.trackOccupancyInTimeRange(); auto ft0occ = collision.ft0cOccupancyInTimeRange(); - const float alpha = v0.alpha(); - const float qt = v0.qtarm(); - const float cosPA = v0.v0cosPA(); - const float pT = v0.pt(); - const float v0radius = v0.v0radius(); - const float gammapsipair = v0.psipair(); + const float alpha = v0casc.alpha(); + const float qt = v0casc.qtarm(); + const float cosPA = GetCosPA(v0casc, collision); + const float pT = v0casc.pt(); + const float v0radius = GetRadius(v0casc); + const float gammapsipair = v0casc.psipair(); const double pseudoRndm = track.pt() * 1000. - static_cast(track.pt() * 1000); if (pseudoRndm < dwnSmplFactor) { @@ -151,8 +165,8 @@ struct TreeWriterTpcV0 { } }; - template - void fillSkimmedV0TableWithdEdxTrQA(V0 const& v0, T const& track, TQA const& trackQA, bool existTrkQA, C const& collision, const float nSigmaTPC, const float nSigmaTOF, const float dEdxExp, const o2::track::PID::ID id, int runnumber, double dwnSmplFactor, float hadronicRate) + template + void fillSkimmedV0TableWithdEdxTrQA(V0Casc const& v0casc, T const& track, TQA const& trackQA, bool existTrkQA, C const& collision, const float nSigmaTPC, const float nSigmaTOF, const float dEdxExp, const o2::track::PID::ID id, int runnumber, double dwnSmplFactor, float hadronicRate) { const double ncl = track.tpcNClsFound(); @@ -164,12 +178,12 @@ struct TreeWriterTpcV0 { auto trackocc = collision.trackOccupancyInTimeRange(); auto ft0occ = collision.ft0cOccupancyInTimeRange(); - const float alpha = v0.alpha(); - const float qt = v0.qtarm(); - const float cosPA = v0.v0cosPA(); - const float pT = v0.pt(); - const float v0radius = v0.v0radius(); - const float gammapsipair = v0.psipair(); + const float alpha = v0casc.alpha(); + const float qt = v0casc.qtarm(); + const float cosPA = GetCosPA(v0casc, collision); + const float pT = v0casc.pt(); + const float v0radius = GetRadius(v0casc); + const float gammapsipair = v0casc.psipair(); const double pseudoRndm = track.pt() * 1000. - static_cast(track.pt() * 1000); if (pseudoRndm < dwnSmplFactor) { @@ -210,8 +224,8 @@ struct TreeWriterTpcV0 { }; /// Function to fill skimmed tables - template - void fillSkimmedV0TableWithTrQA(V0 const& v0, T const& track, TQA const& trackQA, bool existTrkQA, C const& collision, const float nSigmaTPC, const float nSigmaTOF, const float dEdxExp, const o2::track::PID::ID id, int runnumber, double dwnSmplFactor, float hadronicRate, int bcGlobalIndex, int bcTimeFrameId, int bcBcInTimeFrame) + template + void fillSkimmedV0TableWithTrQA(V0Casc const& v0casc, T const& track, TQA const& trackQA, bool existTrkQA, C const& collision, const float nSigmaTPC, const float nSigmaTOF, const float dEdxExp, const o2::track::PID::ID id, int runnumber, double dwnSmplFactor, float hadronicRate, int bcGlobalIndex, int bcTimeFrameId, int bcBcInTimeFrame) { const double ncl = track.tpcNClsFound(); @@ -223,12 +237,12 @@ struct TreeWriterTpcV0 { auto trackocc = collision.trackOccupancyInTimeRange(); auto ft0occ = collision.ft0cOccupancyInTimeRange(); - const float alpha = v0.alpha(); - const float qt = v0.qtarm(); - const float cosPA = v0.v0cosPA(); - const float pT = v0.pt(); - const float v0radius = v0.v0radius(); - const float gammapsipair = v0.psipair(); + const float alpha = v0casc.alpha(); + const float qt = v0casc.qtarm(); + const float cosPA = GetCosPA(v0casc, collision); + const float pT = v0casc.pt(); + const float v0radius = GetRadius(v0casc); + const float gammapsipair = v0casc.psipair(); const double pseudoRndm = track.pt() * 1000. - static_cast(track.pt() * 1000); if (pseudoRndm < dwnSmplFactor) { @@ -335,8 +349,34 @@ struct TreeWriterTpcV0 { ccdb->setFatalWhenNull(false); } + /// Evaluate cosPA of the v0 + template + double GetCosPA(V0sWithID::iterator const& v0, CollisionType const&) + { + return v0.v0cosPA(); + } + + /// Evaluate cosPA of the cascade + template + double GetCosPA(CascsWithID::iterator const& casc, CollisionType const& collision) + { + return casc.casccosPA(collision.posX(), collision.posY(), collision.posZ()); + } + + /// Evaluate radius of the v0 + double GetRadius(V0sWithID::iterator const& v0) + { + return v0.v0radius(); + } + + /// Evaluate radius of the cascade + double GetRadius(CascsWithID::iterator const& casc) + { + return casc.cascradius(); + } + /// Apply a track quality selection with a filter! - void processStandard(Colls::iterator const& collision, soa::Filtered const& tracks, V0sWithID const& v0s, aod::BCsWithTimestamps const&) + void processStandard(Colls::iterator const& collision, soa::Filtered const& tracks, V0sWithID const& v0s, CascsWithID const& cascs, aod::BCsWithTimestamps const&) { /// Check event slection if (!isEventSelected(collision, tracks)) { @@ -396,10 +436,25 @@ struct TreeWriterTpcV0 { } } } + + /// Loop over cascade candidates + for (const auto& casc : cascs) { + auto bachTrack = casc.bachelor_as>(); + if (casc.cascaddid() == kUndef) { + continue; + } + // Omega and antiomega + if (static_cast(bachTrack.pidbit() & (1 << kOmega)) || static_cast(bachTrack.pidbit() & (1 << kAntiOmega))) { + if (downsampleTsalisCharged(bachTrack.pt(), downsamplingTsalisKaons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Kaon], maxPt4dwnsmplTsalisKaons)) { + fillSkimmedV0Table(casc, bachTrack, collision, bachTrack.tpcNSigmaKa(), bachTrack.tofNSigmaKa(), bachTrack.tpcExpSignalKa(bachTrack.tpcSignal()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka, hadronicRate); + } + } + } + } /// process Standard PROCESS_SWITCH(TreeWriterTpcV0, processStandard, "Standard V0 Samples for PID", true); - void processStandardWithCorrecteddEdx(Colls::iterator const& collision, soa::Filtered const& tracks, V0sWithID const& v0s, aod::BCsWithTimestamps const&) + void processStandardWithCorrecteddEdx(Colls::iterator const& collision, soa::Filtered const& tracks, V0sWithID const& v0s, CascsWithID const& cascs, aod::BCsWithTimestamps const&) { /// Check event slection if (!isEventSelected(collision, tracks)) { @@ -459,12 +514,27 @@ struct TreeWriterTpcV0 { } } } - } /// process Standard + + /// Loop over cascade candidates + for (const auto& casc : cascs) { + auto bachTrack = casc.bachelor_as>(); + if (casc.cascaddid() == kUndef) { + continue; + } + // Omega and antiomega + if (static_cast(bachTrack.pidbit() & (1 << kOmega)) || static_cast(bachTrack.pidbit() & (1 << kAntiOmega))) { + if (downsampleTsalisCharged(bachTrack.pt(), downsamplingTsalisKaons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Kaon], maxPt4dwnsmplTsalisKaons)) { + fillSkimmedV0Table(casc, bachTrack, collision, bachTrack.tpcNSigmaKa(), bachTrack.tofNSigmaKa(), bachTrack.tpcExpSignalKa(bachTrack.tpcSignal()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka, hadronicRate); + } + } + } + } /// process StandardWithCorrecteddEdx PROCESS_SWITCH(TreeWriterTpcV0, processStandardWithCorrecteddEdx, "Standard V0 Samples for PID with corrected dEdx", false); Preslice perCollisionTracks = aod::track::collisionId; Preslice perCollisionV0s = aod::v0data::collisionId; - void processWithdEdxTrQA(Colls const& collisions, Trks const& myTracks, V0sWithID const& myV0s, aod::BCsWithTimestamps const&, aod::TracksQAVersion const& tracksQA) + Preslice perCollisionCascs = aod::cascdata::collisionId; + void processWithdEdxTrQA(Colls const& collisions, Trks const& myTracks, V0sWithID const& myV0s, CascsWithID const& myCascs, aod::BCsWithTimestamps const&, aod::TracksQAVersion const& tracksQA) { std::vector labelTrack2TrackQA; labelTrack2TrackQA.clear(); @@ -477,6 +547,7 @@ struct TreeWriterTpcV0 { for (const auto& collision : collisions) { auto tracks = myTracks.sliceBy(perCollisionTracks, collision.globalIndex()); auto v0s = myV0s.sliceBy(perCollisionV0s, collision.globalIndex()); + auto cascs = myCascs.sliceBy(perCollisionCascs, collision.globalIndex()); /// Check event slection if (!isEventSelected(collision, tracks)) { continue; @@ -552,12 +623,37 @@ struct TreeWriterTpcV0 { } } } + + /// Loop over cascade candidates + for (const auto& casc : cascs) { + auto bachTrack = casc.bachelor_as(); + if (casc.cascaddid() == kUndef) { + continue; + } + + aod::TracksQA bachTrackQA; + bool existBachTrkQA; + if (labelTrack2TrackQA[bachTrack.globalIndex()] != -1) { + bachTrackQA = tracksQA.iteratorAt(labelTrack2TrackQA[bachTrack.globalIndex()]); + existBachTrkQA = true; + } else { + bachTrackQA = tracksQA.iteratorAt(0); + existBachTrkQA = false; + } + + // Omega and antiomega + if (static_cast(bachTrack.pidbit() & (1 << kOmega)) || static_cast(bachTrack.pidbit() & (1 << kAntiOmega))) { + if (downsampleTsalisCharged(bachTrack.pt(), downsamplingTsalisKaons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Kaon], maxPt4dwnsmplTsalisKaons)) { + fillSkimmedV0TableWithdEdxTrQA(casc, bachTrack, bachTrackQA, existBachTrkQA, collision, bachTrack.tpcNSigmaKa(), bachTrack.tofNSigmaKa(), bachTrack.tpcExpSignalKa(bachTrack.tpcSignal()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka, hadronicRate); + } + } + } } } /// process with dEdx from TrackQA PROCESS_SWITCH(TreeWriterTpcV0, processWithdEdxTrQA, "Standard V0 Samples with dEdx from Track QA for PID", false); Preslice perCollisionTracksWithNewDEdx = aod::track::collisionId; - void processWithdEdxTrQAWithCorrecteddEdx(Colls const& collisions, TrksWithDEdxCorrection const& myTracks, V0sWithID const& myV0s, aod::BCsWithTimestamps const&, aod::TracksQAVersion const& tracksQA) + void processWithdEdxTrQAWithCorrecteddEdx(Colls const& collisions, TrksWithDEdxCorrection const& myTracks, V0sWithID const& myV0s, CascsWithID const& myCascs, aod::BCsWithTimestamps const&, aod::TracksQAVersion const& tracksQA) { std::vector labelTrack2TrackQA; labelTrack2TrackQA.clear(); @@ -570,6 +666,7 @@ struct TreeWriterTpcV0 { for (const auto& collision : collisions) { auto tracks = myTracks.sliceBy(perCollisionTracksWithNewDEdx, collision.globalIndex()); auto v0s = myV0s.sliceBy(perCollisionV0s, collision.globalIndex()); + auto cascs = myCascs.sliceBy(perCollisionCascs, collision.globalIndex()); /// Check event slection if (!isEventSelected(collision, tracks)) { continue; @@ -645,11 +742,36 @@ struct TreeWriterTpcV0 { } } } + + /// Loop over cascade candidates + for (const auto& casc : cascs) { + auto bachTrack = casc.bachelor_as(); + if (casc.cascaddid() == kUndef) { + continue; + } + + aod::TracksQA bachTrackQA; + bool existBachTrkQA; + if (labelTrack2TrackQA[bachTrack.globalIndex()] != -1) { + bachTrackQA = tracksQA.iteratorAt(labelTrack2TrackQA[bachTrack.globalIndex()]); + existBachTrkQA = true; + } else { + bachTrackQA = tracksQA.iteratorAt(0); + existBachTrkQA = false; + } + + // Omega and antiomega + if (static_cast(bachTrack.pidbit() & (1 << kOmega)) || static_cast(bachTrack.pidbit() & (1 << kAntiOmega))) { + if (downsampleTsalisCharged(bachTrack.pt(), downsamplingTsalisKaons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Kaon], maxPt4dwnsmplTsalisKaons)) { + fillSkimmedV0TableWithdEdxTrQA(casc, bachTrack, bachTrackQA, existBachTrkQA, collision, bachTrack.tpcNSigmaKa(), bachTrack.tofNSigmaKa(), bachTrack.tpcExpSignalKa(bachTrack.tpcSignal()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka, hadronicRate); + } + } + } } } /// process with dEdx from TrackQA PROCESS_SWITCH(TreeWriterTpcV0, processWithdEdxTrQAWithCorrecteddEdx, "Standard V0 Samples with dEdx from Track QA for PID with corrected dEdx", false); - void processWithTrQA(Colls const& collisions, Trks const& myTracks, V0sWithID const& myV0s, MyBCTable const&, aod::TracksQAVersion const& tracksQA) + void processWithTrQA(Colls const& collisions, Trks const& myTracks, V0sWithID const& myV0s, CascsWithID const& myCascs, MyBCTable const&, aod::TracksQAVersion const& tracksQA) { std::vector labelTrack2TrackQA; labelTrack2TrackQA.clear(); @@ -662,6 +784,7 @@ struct TreeWriterTpcV0 { for (const auto& collision : collisions) { auto tracks = myTracks.sliceBy(perCollisionTracks, collision.globalIndex()); auto v0s = myV0s.sliceBy(perCollisionV0s, collision.globalIndex()); + auto cascs = myCascs.sliceBy(perCollisionCascs, collision.globalIndex()); /// Check event slection if (!isEventSelected(collision, tracks)) { continue; @@ -740,11 +863,36 @@ struct TreeWriterTpcV0 { } } } + + /// Loop over cascade candidates + for (const auto& casc : cascs) { + auto bachTrack = casc.bachelor_as(); + if (casc.cascaddid() == kUndef) { + continue; + } + + aod::TracksQA bachTrackQA; + bool existBachTrkQA; + if (labelTrack2TrackQA[bachTrack.globalIndex()] != -1) { + bachTrackQA = tracksQA.iteratorAt(labelTrack2TrackQA[bachTrack.globalIndex()]); + existBachTrkQA = true; + } else { + bachTrackQA = tracksQA.iteratorAt(0); + existBachTrkQA = false; + } + + // Omega and antiomega + if (static_cast(bachTrack.pidbit() & (1 << kOmega)) || static_cast(bachTrack.pidbit() & (1 << kAntiOmega))) { + if (downsampleTsalisCharged(bachTrack.pt(), downsamplingTsalisKaons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Kaon], maxPt4dwnsmplTsalisKaons)) { + fillSkimmedV0TableWithTrQA(casc, bachTrack, bachTrackQA, existBachTrkQA, collision, bachTrack.tpcNSigmaKa(), bachTrack.tofNSigmaKa(), bachTrack.tpcExpSignalKa(bachTrack.tpcSignal()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); + } + } + } } } /// process with TrackQA PROCESS_SWITCH(TreeWriterTpcV0, processWithTrQA, "Standard V0 Samples with Track QA for PID", false); - void processWithTrQAWithCorrecteddEdx(Colls const& collisions, TrksWithDEdxCorrection const& myTracks, V0sWithID const& myV0s, MyBCTable const&, aod::TracksQAVersion const& tracksQA) + void processWithTrQAWithCorrecteddEdx(Colls const& collisions, TrksWithDEdxCorrection const& myTracks, V0sWithID const& myV0s, CascsWithID const& myCascs, MyBCTable const&, aod::TracksQAVersion const& tracksQA) { std::vector labelTrack2TrackQA; labelTrack2TrackQA.clear(); @@ -757,6 +905,7 @@ struct TreeWriterTpcV0 { for (const auto& collision : collisions) { auto tracks = myTracks.sliceBy(perCollisionTracksWithNewDEdx, collision.globalIndex()); auto v0s = myV0s.sliceBy(perCollisionV0s, collision.globalIndex()); + auto cascs = myCascs.sliceBy(perCollisionCascs, collision.globalIndex()); /// Check event slection if (!isEventSelected(collision, tracks)) { continue; @@ -835,6 +984,31 @@ struct TreeWriterTpcV0 { } } } + + /// Loop over cascade candidates + for (const auto& casc : cascs) { + auto bachTrack = casc.bachelor_as(); + if (casc.cascaddid() == kUndef) { + continue; + } + + aod::TracksQA bachTrackQA; + bool existBachTrkQA; + if (labelTrack2TrackQA[bachTrack.globalIndex()] != -1) { + bachTrackQA = tracksQA.iteratorAt(labelTrack2TrackQA[bachTrack.globalIndex()]); + existBachTrkQA = true; + } else { + bachTrackQA = tracksQA.iteratorAt(0); + existBachTrkQA = false; + } + + // Omega and antiomega + if (static_cast(bachTrack.pidbit() & (1 << kOmega)) || static_cast(bachTrack.pidbit() & (1 << kAntiOmega))) { + if (downsampleTsalisCharged(bachTrack.pt(), downsamplingTsalisKaons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Kaon], maxPt4dwnsmplTsalisKaons)) { + fillSkimmedV0TableWithTrQA(casc, bachTrack, bachTrackQA, existBachTrkQA, collision, bachTrack.tpcNSigmaKa(), bachTrack.tofNSigmaKa(), bachTrack.tpcExpSignalKa(bachTrack.tpcSignal()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); + } + } + } } } /// process with TrackQA PROCESS_SWITCH(TreeWriterTpcV0, processWithTrQAWithCorrecteddEdx, "Standard V0 Samples with Track QA for PID with corrected dEdx", false); diff --git a/PWGDQ/DataModel/ReducedInfoTables.h b/PWGDQ/DataModel/ReducedInfoTables.h index 244a1f7417c..dd92f5a9c76 100644 --- a/PWGDQ/DataModel/ReducedInfoTables.h +++ b/PWGDQ/DataModel/ReducedInfoTables.h @@ -1124,6 +1124,14 @@ DECLARE_SOA_COLUMN(V0AddID, v0addid, int8_t); //! DECLARE_SOA_TABLE(V0MapID, "AOD", "V0MAPID", //! v0mapID::V0AddID); +namespace cascmapID +{ +DECLARE_SOA_COLUMN(CascAddID, cascaddid, int8_t); //! +} // namespace cascmapID + +DECLARE_SOA_TABLE(CascMapID, "AOD", "CASCMAPID", //! + cascmapID::CascAddID); + namespace DalBits { DECLARE_SOA_COLUMN(DALITZBits, dalitzBits, uint8_t); //! diff --git a/PWGDQ/Tasks/v0selector.cxx b/PWGDQ/Tasks/v0selector.cxx index 0c970d80c91..1af3fb2cf0e 100644 --- a/PWGDQ/Tasks/v0selector.cxx +++ b/PWGDQ/Tasks/v0selector.cxx @@ -17,35 +17,40 @@ // Comments, questions, complaints, suggestions? // Please write to: daiki.sekihata@cern.ch // -#include -#include -#include -#include -#include -#include "Math/Vector4D.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "ReconstructionDataFormats/Track.h" -#include "Common/Core/trackUtilities.h" +#include "PWGDQ/Core/HistogramManager.h" +#include "PWGDQ/Core/HistogramsLibrary.h" +#include "PWGDQ/Core/VarManager.h" +#include "PWGDQ/DataModel/ReducedInfoTables.h" #include "PWGLF/DataModel/LFStrangenessTables.h" + +#include "Common/Core/RecoDecay.h" #include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/EventSelection.h" +#include "Common/Core/trackUtilities.h" #include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" #include "Common/DataModel/PIDResponse.h" -#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CCDB/BasicCCDBManager.h" #include "DCAFitter/DCAFitterN.h" -#include "PWGDQ/DataModel/ReducedInfoTables.h" -#include "PWGDQ/Core/VarManager.h" -#include "PWGDQ/Core/HistogramManager.h" -#include "PWGDQ/Core/HistogramsLibrary.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "DataFormatsParameters/GRPObject.h" #include "DataFormatsParameters/GRPMagField.h" -#include "CCDB/BasicCCDBManager.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" + +#include "Math/Vector4D.h" + +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -85,7 +90,24 @@ struct v0selector { Configurable cutAPL1{"cutAPL1", 0.107, "cutAPL1"}; Configurable cutAPL2{"cutAPL2", -0.69, "cutAPL2"}; Configurable cutAPL3{"cutAPL3", 0.5, "cutAPL3"}; + // Omega & A-Omega cuts + Configurable cutAPOmegaUp1{"cutAPOmegaUp1", 0.25, "cutAPOmegaUp1"}; + Configurable cutAPOmegaUp2{"cutAPOmegaUp2", 0.358, "cutAPOmegaUp2"}; + Configurable cutAPOmegaUp3{"cutAPOmegaUp3", 0.35, "cutAPOmegaUp3"}; + Configurable cutAPOmegaDown1{"cutAPOmegaDown1", 0.15, "cutAPOmegaDown1"}; + Configurable cutAPOmegaDown2{"cutAPOmegaDown2", 0.358, "cutAPOmegaDown2"}; + Configurable cutAPOmegaDown3{"cutAPOmegaDown3", 0.16, "cutAPOmegaDown3"}; + Configurable cutAlphaOmegaHigh{"cutAlphaOmegaHigh", 0.358, "cutAlphaOmegaHigh"}; + Configurable cutAlphaOmegaLow{"cutAlphaOmegaLow", 0., "cutAlphaOmegaLow"}; + Configurable cutQTOmegaLowOuterArc{"cutQTOmegaLowOuterArc", 0.14, "cutQTOmegaLowOuterArc"}; + Configurable cutMassOmegaHigh{"cutMassOmegaHigh", 1.677, "cutMassOmegaHigh"}; + Configurable cutMassOmegaLow{"cutMassOmegaLow", 1.667, "cutMassOmegaLow"}; + Configurable cutMassCascV0Low{"cutMassCascV0Low", 1.110, "cutMassCascV0Low"}; + Configurable cutMassCascV0High{"cutMassCascV0High", 1.120, "cutMassCascV0High"}; + Configurable produceV0ID{"produceV0ID", false, "Produce additional V0ID table"}; + Configurable selectCascades{"selectCascades", false, "Select cascades in addition to v0s"}; + Configurable produceCascID{"produceCascID", false, "Produce additional CascID table"}; enum { // Reconstructed V0 kUndef = -1, @@ -93,11 +115,13 @@ struct v0selector { kK0S = 1, kLambda = 2, kAntiLambda = 3, - kOmega = 4 + kOmega = 4, + kAntiOmega = 5 }; Produces v0bits; Produces v0mapID; + Produces cascmapID; // int checkV0(const array& ppos, const array& pneg) int checkV0(const float alpha, const float qt) @@ -154,6 +178,29 @@ struct v0selector { return kUndef; } + int checkCascade(float alpha, float qt) + { + const bool isAlphaPos = alpha > 0; + alpha = std::fabs(alpha); + + const float qUp = std::abs(alpha - cutAPOmegaUp2) > std::abs(cutAPOmegaUp3) ? 0. : cutAPOmegaUp1 * std::sqrt(1.0f - ((alpha - cutAPOmegaUp2) * (alpha - cutAPOmegaUp2)) / (cutAPOmegaUp3 * cutAPOmegaUp3)); + const float qDown = std::abs(alpha - cutAPOmegaDown2) > std::abs(cutAPOmegaDown3) ? 0. : cutAPOmegaDown1 * std::sqrt(1.0f - ((alpha - cutAPOmegaDown2) * (alpha - cutAPOmegaDown2)) / (cutAPOmegaDown3 * cutAPOmegaDown3)); + + if (alpha < cutAlphaOmegaLow || alpha > cutAlphaOmegaHigh || qt < qDown || qt > qUp) { + return kUndef; + } + + if (alpha > cutAPOmegaUp2 && qt < cutQTOmegaLowOuterArc) { + return kUndef; + } + + if (isAlphaPos) { + return kOmega; + } else { + return kAntiOmega; + } + } + // Configurables Configurable v0max_mee{"v0max_mee", 0.1, "max mee for photon"}; Configurable maxpsipair{"maxpsipair", 1.6, "max psi_pair for photon"}; @@ -166,16 +213,28 @@ struct v0selector { Configurable mincrossedrows{"mincrossedrows", 70, "min crossed rows"}; Configurable maxchi2tpc{"maxchi2tpc", 4.0, "max chi2/NclsTPC"}; Configurable fillhisto{"fillhisto", false, "flag to fill histograms"}; - // cutNsigmaElTPC, cutNsigmaPiTPC, cutNsigmaPrTPC + // Cascade-related Configurables + Configurable cascDcaMax{"cascDcaMax", 0.3, "DCA cascade daughters"}; + Configurable cascV0DcaMax{"cascV0DcaMax", 0.3, "DCA V0 daughters of the cascade"}; + Configurable cascRadiusMin{"cascRadiusMin", 0.0, "Cascade Radius min"}; + Configurable cascRadiusMax{"cascRadiusMax", 90.0, "Cascade Radius max"}; + Configurable cascV0RadiusMin{"cascV0RadiusMin", 0.0, "V0 of the Cascade Radius min"}; + Configurable cascV0RadiusMax{"cascV0RadiusMax", 90.0, "V0 of the Cascade Radius max"}; + Configurable cascCosinePAMin{"cascCosinePAMin", 0.998, "Cascade CosPA min"}; + Configurable cascV0CosinePAMin{"cascV0CosinePAMin", 0.995, "V0 of the Cascade CosPA min"}; + Configurable cascV0CosinePAMax{"cascV0CosinePAMax", 1.000, "V0 of the Cascade CosPA max"}; + // cutNsigmaElTPC, cutNsigmaPiTPC, cutNsigmaPrTPC, cutNsigmaKaTPC Configurable cutNsigmaElTPC{"cutNsigmaElTPC", 5.0, "cutNsigmaElTPC"}; Configurable cutNsigmaPiTPC{"cutNsigmaPiTPC", 5.0, "cutNsigmaPiTPC"}; Configurable cutNsigmaPrTPC{"cutNsigmaPrTPC", 5.0, "cutNsigmaPrTPC"}; + Configurable cutNsigmaKaTPC{"cutNsigmaKaTPC", 5.0, "cutNsigmaKaTPC"}; HistogramRegistry registry{"registry"}; void init(o2::framework::InitContext&) { if (fillhisto) { registry.add("hV0Candidate", "hV0Candidate", HistType::kTH1F, {{2, 0.5f, 2.5f}}); + registry.add("hCascCandidate", "hCascCandidate", HistType::kTH1F, {{2, 0.5f, 2.5f}}); registry.add("hMassGamma", "hMassGamma", HistType::kTH2F, {{900, 0.0f, 90.0f}, {100, 0.0f, 0.1f}}); registry.add("hGammaRxy", "hGammaRxy", HistType::kTH2F, {{1800, -90.0f, 90.0f}, {1800, -90.0f, 90.0f}}); registry.add("hMassK0S", "hMassK0S", HistType::kTH2F, {{900, 0.0f, 90.0f}, {100, 0.45, 0.55}}); @@ -196,10 +255,39 @@ struct v0selector { registry.add("hV0APplot", "hV0APplot", HistType::kTH2F, {{200, -1.0f, +1.0f}, {250, 0.0f, 0.25f}}); registry.add("hV0APplotSelected", "hV0APplotSelected", HistType::kTH2F, {{200, -1.0f, +1.0f}, {250, 0.0f, 0.25f}}); registry.add("hV0Psi", "hV0Psi", HistType::kTH2F, {{100, 0, TMath::PiOver2()}, {100, 0, 0.1}}); + if (selectCascades) { + registry.add("hCascPt", "pT", HistType::kTH1F, {{100, 0.0f, 10}}); + registry.add("hCascEtaPhi", "#eta vs. #varphi", HistType::kTH2F, {{63, 0, 6.3}, {20, -1.0f, 1.0f}}); + registry.add("hCascDCAxyPosToPV", "hCascDCAxyPosToPV", HistType::kTH1F, {{1000, -5.0f, 5.0f}}); + registry.add("hCascDCAxyNegToPV", "hCascDCAxyNegToPV", HistType::kTH1F, {{1000, -5.0f, 5.0f}}); + registry.add("hCascDCAxyBachToPV", "hCascDCAxyBachToPV", HistType::kTH1F, {{1000, -5.0f, 5.0f}}); + registry.add("hCascDCAzPosToPV", "hCascDCAzPosToPV", HistType::kTH1F, {{1000, -5.0f, 5.0f}}); + registry.add("hCascDCAzNegToPV", "hCascDCAzNegToPV", HistType::kTH1F, {{1000, -5.0f, 5.0f}}); + registry.add("hCascDCAzBachToPV", "hCascDCAzBachToPV", HistType::kTH1F, {{1000, -5.0f, 5.0f}}); + registry.add("hCascAPplot", "hCascAPplot", HistType::kTH2F, {{200, -1.0f, +1.0f}, {300, 0.0f, 0.3f}}); + registry.add("hCascV0APplot", "hCascV0APplot", HistType::kTH2F, {{200, -1.0f, +1.0f}, {250, 0.0f, 0.25f}}); + registry.add("hCascAPplotSelected", "hCascAPplotSelected", HistType::kTH2F, {{200, -1.0f, +1.0f}, {300, 0.0f, 0.3f}}); + registry.add("hCascV0APplotSelected", "hCascV0APplotSelected", HistType::kTH2F, {{200, -1.0f, +1.0f}, {250, 0.0f, 0.25f}}); + registry.add("hCascRadius", "hCascRadius", HistType::kTH1F, {{1000, 0.0f, 100.0f}}); + registry.add("hCascV0Radius", "hCascV0Radius", HistType::kTH1F, {{1000, 0.0f, 100.0f}}); + registry.add("hCascCosPA", "hCascCosPA", HistType::kTH1F, {{50, 0.95f, 1.0f}}); + registry.add("hCascV0CosPA", "hCascV0CosPA", HistType::kTH1F, {{50, 0.95f, 1.0f}}); + registry.add("hMassOmega", "hMassOmega", HistType::kTH2F, {{900, 0.0f, 90.0f}, {100, 1.62f, 1.72f}}); + registry.add("hMassAntiOmega", "hMassAntiOmega", HistType::kTH2F, {{900, 0.0f, 90.0f}, {100, 1.62f, 1.72f}}); + registry.add("hCascDCADau", "hCascDCADau", HistType::kTH1F, {{1000, 0.0f, 10.0f}}); + registry.add("hCascV0DCADau", "hCascV0DCADau", HistType::kTH1F, {{1000, 0.0f, 10.0f}}); + } + } + + if (selectCascades == false && produceCascID == true) { + LOGP(error, "produceCascID is available only when selectCascades is enabled"); + } + if (cutAPOmegaUp1 < cutAPOmegaDown1) { + LOGP(error, "cutAPOmegaUp1 must be greater than cutAPOmegaDown1"); } } - void process(aod::V0Datas const& V0s, FullTracksExt const& tracks, aod::Collisions const&) + void process(aod::V0Datas const& V0s, aod::CascDatas const& Cascs, FullTracksExt const& tracks, aod::Collisions const&) { std::vector pidmap; pidmap.clear(); @@ -210,6 +298,11 @@ struct v0selector { if (produceV0ID.value) { v0pidmap.resize(V0s.size(), -1); } + std::vector cascpidmap; + cascpidmap.clear(); + if (produceCascID.value) { + cascpidmap.resize(Cascs.size(), kUndef); + } for (auto& V0 : V0s) { // if (!(V0.posTrack_as().trackType() & o2::aod::track::TPCrefit)) { // continue; @@ -222,55 +315,22 @@ struct v0selector { if (fillhisto) { registry.fill(HIST("hV0Candidate"), 1); } - if (std::fabs(V0.posTrack_as().eta()) > 0.9) { - continue; - } - if (std::fabs(V0.negTrack_as().eta()) > 0.9) { - continue; - } - if (V0.posTrack_as().tpcNClsCrossedRows() < mincrossedrows) { - continue; - } - if (V0.negTrack_as().tpcNClsCrossedRows() < mincrossedrows) { - continue; - } - if (V0.posTrack_as().tpcChi2NCl() > maxchi2tpc) { - continue; - } - if (V0.negTrack_as().tpcChi2NCl() > maxchi2tpc) { - continue; - } - if (std::fabs(V0.posTrack_as().dcaXY()) < dcamin) { - continue; - } - if (std::fabs(V0.negTrack_as().dcaXY()) < dcamin) { - continue; - } - if (std::fabs(V0.posTrack_as().dcaXY()) > dcamax) { - continue; - } - if (std::fabs(V0.negTrack_as().dcaXY()) > dcamax) { - continue; - } + const auto& posTrack = V0.posTrack_as(); + const auto& negTrack = V0.negTrack_as(); - if (V0.posTrack_as().sign() * V0.negTrack_as().sign() > 0) { // reject same sign pair - continue; + bool isRejectV0{false}; + for (const auto& prong : {posTrack, negTrack}) { + isRejectV0 = isRejectV0 || std::fabs(prong.eta()) > 0.9; + isRejectV0 = isRejectV0 || prong.tpcNClsCrossedRows() < mincrossedrows; + isRejectV0 = isRejectV0 || prong.tpcChi2NCl() > maxchi2tpc; + isRejectV0 = isRejectV0 || std::fabs(prong.dcaXY()) < dcamin; + isRejectV0 = isRejectV0 || std::fabs(prong.dcaXY()) > dcamax; } + isRejectV0 = isRejectV0 || (posTrack.sign() * negTrack.sign() > 0); - // if (V0.posTrack_as().collisionId() != V0.negTrack_as().collisionId()) { - // continue; - // } - - // if (!V0.posTrack_as().has_collision() || !V0.negTrack_as().has_collision()) { - // continue; - // } - - // auto const& collision = V0.collision_as(); - - // if (V0.collisionId() != collision.globalIndex()) { - // continue; - // } + if (isRejectV0) + continue; float V0dca = V0.dcaV0daughters(); float V0CosinePA = V0.v0cosPA(); @@ -376,6 +436,134 @@ struct v0selector { v0mapID(v0pidmap[V0.globalIndex()]); } } + + if (selectCascades) { + for (const auto& casc : Cascs) { + if (fillhisto) { + registry.fill(HIST("hCascCandidate"), 1); + } + + const auto& posTrack = casc.posTrack_as(); + const auto& negTrack = casc.negTrack_as(); + const auto& bachelor = casc.bachelor_as(); + + bool isRejectCascade{false}; + for (const auto& prong : {posTrack, negTrack, bachelor}) { + isRejectCascade = isRejectCascade || std::fabs(prong.eta()) > 0.9; + isRejectCascade = isRejectCascade || prong.tpcNClsCrossedRows() < mincrossedrows; + isRejectCascade = isRejectCascade || prong.tpcChi2NCl() > maxchi2tpc; + isRejectCascade = isRejectCascade || std::fabs(prong.dcaXY()) < dcamin; + isRejectCascade = isRejectCascade || std::fabs(prong.dcaXY()) > dcamax; + } + isRejectCascade = isRejectCascade || (posTrack.sign() * negTrack.sign() > 0); + + if (isRejectCascade) + continue; + + if (fillhisto) { + registry.fill(HIST("hCascCandidate"), 2); + } + + auto collision = casc.collision_as(); + const float collisionX = collision.posX(); + const float collisionY = collision.posY(); + const float collisionZ = collision.posZ(); + + const float cascDca = casc.dcacascdaughters(); // NOTE the name of getter is misleading. In case of no-KF this is sqrt(Chi2) + const float cascV0Dca = casc.dcaV0daughters(); // NOTE the name of getter is misleading. In case of kfDoDCAFitterPreMinimV0 this is sqrt(Chi2) + const float cascRadius = casc.cascradius(); + const float cascV0Radius = casc.dcaV0daughters(); + const float cascCosinePA = casc.casccosPA(collisionX, collisionY, collisionZ); + const float cascV0CosinePA = casc.v0cosPA(collisionX, collisionY, collisionZ); + + if (cascDca > cascDcaMax) { + continue; + } + if (cascV0Dca > cascV0DcaMax) { + continue; + } + if (cascRadius < cascRadiusMin || cascRadius > cascRadiusMax) { + continue; + } + if (cascV0Radius < cascV0RadiusMin || cascV0Radius > cascV0RadiusMax) { + continue; + } + if (cascCosinePA < cascCosinePAMin) { + continue; + } + if (cascV0CosinePA < cascV0CosinePAMin || cascV0CosinePA > cascV0CosinePAMax) { + continue; + } + + const float mOmega = casc.mOmega(); + const float mV0Lambda = casc.mLambda(); + const float alpha = casc.alpha(); + const float qt = casc.qtarm(); + const float v0Alpha = casc.v0Alpha(); + const float v0Qt = casc.v0Qtarm(); + + if (fillhisto) { + registry.fill(HIST("hCascPt"), casc.pt()); + registry.fill(HIST("hCascEtaPhi"), casc.phi(), casc.eta()); + registry.fill(HIST("hCascDCAxyPosToPV"), casc.posTrack_as().dcaXY()); + registry.fill(HIST("hCascDCAxyNegToPV"), casc.negTrack_as().dcaXY()); + registry.fill(HIST("hCascDCAxyBachToPV"), casc.bachelor_as().dcaXY()); + registry.fill(HIST("hCascDCAzPosToPV"), casc.posTrack_as().dcaZ()); + registry.fill(HIST("hCascDCAzNegToPV"), casc.negTrack_as().dcaZ()); + registry.fill(HIST("hCascDCAzBachToPV"), casc.bachelor_as().dcaZ()); + registry.fill(HIST("hCascAPplot"), alpha, qt); + registry.fill(HIST("hCascV0APplot"), v0Alpha, v0Qt); + registry.fill(HIST("hCascRadius"), cascRadius); + registry.fill(HIST("hCascV0Radius"), cascV0Radius); + registry.fill(HIST("hCascCosPA"), cascCosinePA); + registry.fill(HIST("hCascV0CosPA"), cascV0CosinePA); + registry.fill(HIST("hCascDCADau"), cascDca); + registry.fill(HIST("hCascV0DCADau"), cascV0Dca); + } + + const int cascid = checkCascade(alpha, qt); + const int v0id = checkV0(v0Alpha, v0Qt); + if (cascid < 0) { + continue; + } + if (v0id != kLambda && v0id != kAntiLambda) { + continue; + } + if (fillhisto) { + registry.fill(HIST("hCascAPplotSelected"), alpha, qt); + registry.fill(HIST("hCascV0APplotSelected"), v0Alpha, v0Qt); + } + + auto storeCascAddID = [&](auto gix, auto id) { + if (produceCascID.value) { + cascpidmap[gix] = id; + } + }; + + if (cascid == kOmega && v0id == kLambda) { + if (fillhisto) { + registry.fill(HIST("hMassOmega"), cascRadius, mOmega); + } + if (cutMassOmegaLow < mOmega && mOmega < cutMassOmegaHigh && cutMassCascV0Low < mV0Lambda && mV0Lambda < cutMassCascV0High && std::abs(casc.posTrack_as().tpcNSigmaPr()) < cutNsigmaPrTPC && std::abs(casc.negTrack_as().tpcNSigmaPi()) < cutNsigmaPiTPC && std::abs(casc.bachelor_as().tpcNSigmaKa()) < cutNsigmaKaTPC) { + pidmap[casc.bachelorId()] |= (uint8_t(1) << kOmega); + storeCascAddID(casc.globalIndex(), kOmega); + } + } else if (cascid == kAntiOmega && v0id == kAntiLambda) { + if (fillhisto) { + registry.fill(HIST("hMassAntiOmega"), cascRadius, mOmega); + } + if (cutMassOmegaLow < mOmega && mOmega < cutMassOmegaHigh && cutMassCascV0Low < mV0Lambda && mV0Lambda < cutMassCascV0High && std::abs(casc.posTrack_as().tpcNSigmaPi()) < cutNsigmaPiTPC && std::abs(casc.negTrack_as().tpcNSigmaPr()) < cutNsigmaPrTPC && std::abs(casc.bachelor_as().tpcNSigmaKa()) < cutNsigmaKaTPC) { + pidmap[casc.bachelorId()] |= (uint8_t(1) << kAntiOmega); + storeCascAddID(casc.globalIndex(), kAntiOmega); + } + } + } // end of Casc loop + if (produceCascID.value) { + for (auto& casc : Cascs) { + cascmapID(cascpidmap[casc.globalIndex()]); + } + } + } for (auto& track : tracks) { // printf("setting pidmap[%lld] = %d\n",track.globalIndex(),pidmap[track.globalIndex()]); v0bits(pidmap[track.globalIndex()]); @@ -574,7 +762,7 @@ struct trackPIDQA { } } // end of track loop - } // end of process + } // end of process void DefineHistograms(TString histClasses) { diff --git a/PWGLF/DataModel/LFStrangenessTables.h b/PWGLF/DataModel/LFStrangenessTables.h index 6da514fa64e..bc7fd7d3aaa 100644 --- a/PWGLF/DataModel/LFStrangenessTables.h +++ b/PWGLF/DataModel/LFStrangenessTables.h @@ -718,21 +718,21 @@ DECLARE_SOA_DYNAMIC_COLUMN(MLambda, mLambda, //! mass under lambda hypothesis [](int v0type, float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { if ((v0type & (0x1 << o2::dataformats::V0Index::kPhotonOnly)) != 0) { return 0.0f; // provide mass only if NOT a photon with TPC-only tracks (special handling) - }; + } return RecoDecay::m(std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged}); }); DECLARE_SOA_DYNAMIC_COLUMN(MAntiLambda, mAntiLambda, //! mass under antilambda hypothesis [](int v0type, float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { if ((v0type & (0x1 << o2::dataformats::V0Index::kPhotonOnly)) != 0) { return 0.0f; // provide mass only if NOT a photon with TPC-only tracks (special handling) - }; + } return RecoDecay::m(std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton}); }); DECLARE_SOA_DYNAMIC_COLUMN(MK0Short, mK0Short, //! mass under K0short hypothesis [](int v0type, float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { if ((v0type & (0x1 << o2::dataformats::V0Index::kPhotonOnly)) != 0) { return 0.0f; // provide mass only if NOT a photon with TPC-only tracks (special handling) - }; + } return RecoDecay::m(std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassPionCharged}); }); DECLARE_SOA_DYNAMIC_COLUMN(MLambda_unchecked, mLambda_unchecked, //! mass under lambda hypothesis without v0 type check (will include TPC only and potentially duplicates! use with care) @@ -1422,6 +1422,68 @@ DECLARE_SOA_DYNAMIC_COLUMN(Phi, phi, //! Cascade phi in the range [0, 2pi) [](float px, float py) -> float { return RecoDecay::phi(px, py); }); DECLARE_SOA_DYNAMIC_COLUMN(Eta, eta, //! Cascade pseudorapidity [](float px, float py, float pz) -> float { return RecoDecay::eta(std::array{px, py, pz}); }); + +// Armenteros-Podolanski variables +DECLARE_SOA_DYNAMIC_COLUMN(Alpha, alpha, //! Armenteros Alpha + [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg, float pxbach, float pybach, float pzbach, int sign) { + const float pxv0 = pxpos + pxneg; + const float pyv0 = pypos + pyneg; + const float pzv0 = pzpos + pzneg; + + // No need to divide by momentum of the cascade (as in the v0data namespace) since the ratio of lQl is evaluated + const float lQlBach = RecoDecay::dotProd(std::array{pxbach, pybach, pzbach}, std::array{pxv0 + pxbach, pyv0 + pybach, pzv0 + pzbach}); + const float lQlV0 = RecoDecay::dotProd(std::array{pxv0, pyv0, pzv0}, std::array{pxv0 + pxbach, pyv0 + pybach, pzv0 + pzbach}); + float alpha = (lQlBach - lQlV0) / (lQlV0 + lQlBach); // alphacascade + if (sign < 0) { + alpha = -alpha; + } + return alpha; + }); + +DECLARE_SOA_DYNAMIC_COLUMN(QtArm, qtarm, //! Armenteros Qt + [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg, float pxbach, float pybach, float pzbach) { + const float pxv0 = pxpos + pxneg; + const float pyv0 = pypos + pyneg; + const float pzv0 = pzpos + pzneg; + + const float momTot2 = RecoDecay::p2(pxv0 + pxbach, pyv0 + pybach, pzv0 + pzbach); + const float dp = RecoDecay::dotProd(std::array{pxbach, pybach, pzbach}, std::array{pxv0 + pxbach, pyv0 + pybach, pzv0 + pzbach}); + return std::sqrt(RecoDecay::p2(pxbach, pybach, pzbach) - dp * dp / momTot2); // qtarm + }); + +// Psi pair angle: angle between the plane defined by the v0 and bachelor momenta and the xy plane +DECLARE_SOA_DYNAMIC_COLUMN(PsiPair, psipair, //! psi pair angle + [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg, float pxbach, float pybach, float pzbach, int sign) { + auto clipToPM1 = [](float x) { return x < -1.f ? -1.f : (x > 1.f ? 1.f : x); }; + const float pxv0 = pxpos + pxneg; + const float pyv0 = pypos + pyneg; + const float pzv0 = pzpos + pzneg; + + const float ptot2 = RecoDecay::p2(pxbach, pybach, pzbach) * RecoDecay::p2(pxv0, pyv0, pzv0); + const float argcos = RecoDecay::dotProd(std::array{pxbach, pybach, pzbach}, std::array{pxv0, pyv0, pzv0}) / std::sqrt(ptot2); + const float thetaV0 = std::atan2(RecoDecay::sqrtSumOfSquares(pxv0, pyv0), pzv0); + const float thetaBach = std::atan2(RecoDecay::sqrtSumOfSquares(pxbach, pybach), pzbach); + float argsin = (thetaV0 - thetaBach) / std::acos(clipToPM1(argcos)); + if (sign < 0) { + argsin = -argsin; + } + return std::asin(clipToPM1(argsin)); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(V0Alpha, v0Alpha, //! Armenteros Alpha + [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) { + // No need to divide by momentum of the v0 (as in the v0data namespace) since the ratio of lQl is evaluated + const float lQlPos = RecoDecay::dotProd(std::array{pxpos, pypos, pzpos}, std::array{pxneg + pxpos, pyneg + pypos, pzneg + pzpos}); + const float lQlNeg = RecoDecay::dotProd(std::array{pxneg, pyneg, pzneg}, std::array{pxneg + pxpos, pyneg + pypos, pzneg + pzpos}); + return (lQlPos - lQlNeg) / (lQlPos + lQlNeg); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(V0QtArm, v0Qtarm, //! Armenteros Qt + [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) { + const float momTot2 = RecoDecay::p2(pxpos + pxneg, pypos + pyneg, pzpos + pzneg); + const float dp = RecoDecay::dotProd(std::array{pxneg, pyneg, pzneg}, std::array{pxpos + pxneg, pypos + pyneg, pzpos + pzneg}); + return std::sqrt(RecoDecay::p2(pxneg, pyneg, pzneg) - dp * dp / momTot2); // qtarm + }); } // namespace cascdata //______________________________________________________ @@ -1498,7 +1560,14 @@ DECLARE_SOA_TABLE(StoredCascCores, "AOD", "CASCCORE", //! core information about cascdata::PositiveEta, cascdata::PositivePhi, cascdata::BachelorEta, - cascdata::BachelorPhi); + cascdata::BachelorPhi, + + // Armenteros-Podolanski and psi-pair + cascdata::Alpha, + cascdata::QtArm, + cascdata::PsiPair, + cascdata::V0Alpha, + cascdata::V0QtArm); DECLARE_SOA_TABLE(StoredKFCascCores, "AOD", "KFCASCCORE", //! cascdata::Sign, cascdata::MXi, cascdata::MOmega, From 5e4f15a2910a9d43ddc969572d5cd5964da962a3 Mon Sep 17 00:00:00 2001 From: Marcello Di Costanzo <96481191+Marcellocosti@users.noreply.github.com> Date: Mon, 29 Sep 2025 16:46:23 +0200 Subject: [PATCH 570/986] [PWGHF] Improvements to corr. bkg. matching and to D+ and D0 trees (#13126) --- PWGHF/Core/DecayChannels.h | 1 + PWGHF/TableProducer/treeCreatorD0ToKPi.cxx | 23 +++++++------------ .../TableProducer/treeCreatorDplusToPiKPi.cxx | 2 +- PWGHF/Utils/utilsMcMatching.h | 1 + 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/PWGHF/Core/DecayChannels.h b/PWGHF/Core/DecayChannels.h index 0c0392d99e2..be813668ec6 100644 --- a/PWGHF/Core/DecayChannels.h +++ b/PWGHF/Core/DecayChannels.h @@ -127,6 +127,7 @@ enum DecayChannelResonant : HfDecayChannel { LcToPKstar0 = 24, // p anti-K*0(892) LcToDeltaplusplusK = 25, // Δ++ K− LcToL1520Pi = 26, // Λ(1520) π+ + LcToPPhi = 29, // p φ // Ξc+ XicToPKstar0 = 27, // p anti-K*0(892) XicToPPhi = 28, // p φ diff --git a/PWGHF/TableProducer/treeCreatorD0ToKPi.cxx b/PWGHF/TableProducer/treeCreatorD0ToKPi.cxx index bda20c52903..4178f66f864 100644 --- a/PWGHF/TableProducer/treeCreatorD0ToKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorD0ToKPi.cxx @@ -142,7 +142,6 @@ DECLARE_SOA_TABLE(HfCandD0Lites, "AOD", "HFCANDD0LITE", full::OriginMcRec) DECLARE_SOA_TABLE(HfCandD0Fulls, "AOD", "HFCANDD0FULL", - full::CollisionId, collision::PosX, collision::PosY, collision::PosZ, @@ -202,11 +201,9 @@ DECLARE_SOA_TABLE(HfCandD0Fulls, "AOD", "HFCANDD0FULL", full::E, full::FlagMc, full::FlagMcDecayChanRec, - full::OriginMcRec, - full::CandidateId); + full::OriginMcRec); DECLARE_SOA_TABLE(HfCandD0FullEvs, "AOD", "HFCANDD0FULLEV", - full::CollisionId, collision::NumContrib, collision::PosX, collision::PosY, @@ -215,15 +212,13 @@ DECLARE_SOA_TABLE(HfCandD0FullEvs, "AOD", "HFCANDD0FULLEV", full::RunNumber); DECLARE_SOA_TABLE(HfCandD0FullPs, "AOD", "HFCANDD0FULLP", - full::McCollisionId, full::Pt, full::Eta, full::Phi, full::Y, full::FlagMc, full::FlagMcDecayChanGen, - full::OriginMcGen, - full::McParticleId); + full::OriginMcGen); DECLARE_SOA_TABLE(HfCandD0Mls, "AOD", "HFCANDD0ML", ml::BdtOutputBkg, @@ -283,7 +278,6 @@ struct HfTreeCreatorD0ToKPi { void fillEvent(const T& collision, int isEventReject, int runNumber) { rowCandidateFullEvents( - collision.globalIndex(), collision.numContrib(), collision.posX(), collision.posY(), @@ -337,7 +331,6 @@ struct HfTreeCreatorD0ToKPi { } else { double cosThetaStar = candFlag == 0 ? hfHelper.cosThetaStarD0(candidate) : hfHelper.cosThetaStarD0bar(candidate); rowCandidateFull( - candidate.collisionId(), candidate.posX(), candidate.posY(), candidate.posZ(), @@ -397,8 +390,7 @@ struct HfTreeCreatorD0ToKPi { e, flagMc, flagMcDecay, - origin, - candidate.globalIndex()); + origin); } if constexpr (applyMl) { if (candFlag == 0) { @@ -536,7 +528,10 @@ struct HfTreeCreatorD0ToKPi { } } if constexpr (onlySig) { - if ((std::abs(candidate.flagMcMatchRec()) != o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) || (fillCorrBkgs && (candidate.flagMcMatchRec() != 0))) { + if (fillCorrBkgs && candidate.flagMcMatchRec() == 0) { + continue; + } + if (!fillCorrBkgs && std::abs(candidate.flagMcMatchRec()) != o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { continue; } } @@ -566,15 +561,13 @@ struct HfTreeCreatorD0ToKPi { for (const auto& particle : mcParticles) { if ((std::abs(particle.flagMcMatchGen()) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) || (fillCorrBkgs && particle.flagMcMatchGen() != 0)) { rowCandidateFullParticles( - particle.mcCollisionId(), particle.pt(), particle.eta(), particle.phi(), RecoDecay::y(particle.pVector(), o2::constants::physics::MassD0), particle.flagMcMatchGen(), particle.flagMcDecayChanGen(), - particle.originMcGen(), - particle.globalIndex()); + particle.originMcGen()); } } } diff --git a/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx b/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx index cc684c7003f..f0fc63623a6 100644 --- a/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx @@ -371,8 +371,8 @@ struct HfTreeCreatorDplusToPiKPi { candidate.eta(), candidate.phi(), hfHelper.yDplus(candidate), - coll.numContrib(), cent, + coll.numContrib(), flagMc, originMc, channelMc); diff --git a/PWGHF/Utils/utilsMcMatching.h b/PWGHF/Utils/utilsMcMatching.h index 55480879e1a..097c13a901e 100644 --- a/PWGHF/Utils/utilsMcMatching.h +++ b/PWGHF/Utils/utilsMcMatching.h @@ -138,6 +138,7 @@ static const std::unordered_map> {DecayChannelResonant::LcToPKstar0, {-o2::constants::physics::Pdg::kK0Star892, +PDG_t::kProton}}, {DecayChannelResonant::LcToDeltaplusplusK, {+2224, +PDG_t::kKMinus}}, {DecayChannelResonant::LcToL1520Pi, {+102134, +PDG_t::kPiPlus}}, + {DecayChannelResonant::LcToPPhi, {+PDG_t::kProton, +o2::constants::physics::Pdg::kPhi}}, }; // Ξc+ From 0b72b417dcea17d93a2dbc3201994f692c7b7d97 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Mon, 29 Sep 2025 20:03:19 +0200 Subject: [PATCH 571/986] [PWGEM/Dilepton] update treeCreatorElectronMLDDA.cxx (#13168) --- PWGEM/Dilepton/DataModel/lmeeMLTables.h | 13 ++++++++-- .../treeCreatorElectronMLDDA.cxx | 24 ++++++++++++++----- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/PWGEM/Dilepton/DataModel/lmeeMLTables.h b/PWGEM/Dilepton/DataModel/lmeeMLTables.h index 04232c50114..6beda302862 100644 --- a/PWGEM/Dilepton/DataModel/lmeeMLTables.h +++ b/PWGEM/Dilepton/DataModel/lmeeMLTables.h @@ -92,16 +92,25 @@ DECLARE_SOA_TABLE(EMTracksForMLPID, "AOD", "EMTRACKMLPID", //! emmltrack::P, track::Tgl, emmltrack::Sign, track::TPCNClsFindable, emmltrack::TPCNClsFound, emmltrack::TPCNClsCrossedRows, emmltrack::TPCNClsPID, track::TPCChi2NCl, track::TPCInnerParam, - track::TPCSignal, pidtpc::TPCNSigmaEl, pidtpc::TPCNSigmaPi, pidtpc::TPCNSigmaKa, pidtpc::TPCNSigmaPr, - pidtofbeta::Beta, pidtof::TOFNSigmaEl, pidtof::TOFNSigmaPi, pidtof::TOFNSigmaKa, pidtof::TOFNSigmaPr, + track::TPCSignal, + pidtofbeta::Beta, track::ITSClusterSizes, track::ITSChi2NCl, track::TOFChi2, track::DetectorMap, emmltrack::PIDLabel, // dynamic column emmltrack::MeanClusterSizeITS, emmltrack::MeanClusterSizeITSob); +DECLARE_SOA_TABLE(EMPIDsEl, "AOD", "EMPIDEL", pidtpc::TPCNSigmaEl, pidtof::TOFNSigmaEl); // Joinable with EMTracksForMLPID +DECLARE_SOA_TABLE(EMPIDsPi, "AOD", "EMPIDPI", pidtpc::TPCNSigmaPi, pidtof::TOFNSigmaPi); // Joinable with EMTracksForMLPID +DECLARE_SOA_TABLE(EMPIDsKa, "AOD", "EMPIDKA", pidtpc::TPCNSigmaKa, pidtof::TOFNSigmaKa); // Joinable with EMTracksForMLPID +DECLARE_SOA_TABLE(EMPIDsPr, "AOD", "EMPIDPR", pidtpc::TPCNSigmaPr, pidtof::TOFNSigmaPr); // Joinable with EMTracksForMLPID + // iterators using EMTrackForMLPID = EMTracksForMLPID::iterator; +using EMPIDEl = EMPIDsEl::iterator; +using EMPIDPi = EMPIDsPi::iterator; +using EMPIDKa = EMPIDsKa::iterator; +using EMPIDPr = EMPIDsPr::iterator; } // namespace o2::aod diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx index d19c073aff1..38bc78f9f91 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx @@ -59,13 +59,17 @@ using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; using MyTracks = soa::Join; + aod::pidTPCFullEl, aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullPr, + aod::pidTOFFullEl, aod::pidTOFFullPi, aod::pidTOFFullKa, aod::pidTOFFullPr, aod::pidTOFbeta>; using MyTrack = MyTracks::iterator; struct TreeCreatorElectronMLDDA { SliceCache cache; Produces emprimarytracks; // flat table containing collision + track information + Produces empidel; + Produces empidpi; + Produces empidka; + Produces empidpr; // Basic checks HistogramRegistry registry{ @@ -231,7 +235,7 @@ struct TreeCreatorElectronMLDDA { Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; Configurable cfg_max_chi2its{"cfg_max_chi2its", 5.0, "max chi2/NclsITS"}; Configurable cfg_min_chi2its{"cfg_min_chi2its", -1e+10, "min chi2/NclsITS"}; // remove ITS afterburner - Configurable cfg_max_chi2tof{"cfg_max_chi2tof", 1e+10, "max chi2 TOF"}; // distance in cm + Configurable cfg_max_chi2tof{"cfg_max_chi2tof", 1e+10, "max chi2 TOF"}; // distance in cm Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2, "min n sigma e in TPC for pc->ee"}; Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +2, "max n sigma e in TPC for pc->ee"}; @@ -654,9 +658,15 @@ struct TreeCreatorElectronMLDDA { trackParCov.getP(), trackParCov.getTgl(), track.sign(), track.tpcNClsFindable(), track.tpcNClsFound(), track.tpcNClsCrossedRows(), track.tpcNClsPID(), track.tpcChi2NCl(), track.tpcInnerParam(), - track.tpcSignal(), track.tpcNSigmaEl(), /*track.tpcNSigmaMu(),*/ track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), - track.beta(), track.tofNSigmaEl(), /*track.tofNSigmaMu(),*/ track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), + track.tpcSignal(), + track.beta(), track.itsClusterSizes(), track.itsChi2NCl(), track.tofChi2(), track.detectorMap(), pidlabel); + + empidel(track.tpcNSigmaEl(), track.tofNSigmaEl()); + empidpi(track.tpcNSigmaPi(), track.tofNSigmaPi()); + empidka(track.tpcNSigmaKa(), track.tofNSigmaKa()); + empidpr(track.tpcNSigmaPr(), track.tofNSigmaPr()); + stored_trackIds.emplace_back(track.globalIndex()); } } @@ -1004,7 +1014,9 @@ struct MLTrackQC { }, }; - void processQC(aod::EMTracksForMLPID const& tracks) + using MyPIDTracks = soa::Join; + + void processQC(MyPIDTracks const& tracks) { for (const auto& track : tracks) { registry.fill(HIST("hTPCdEdx_P_All"), track.tpcInnerParam(), track.tpcSignal()); From 2982a0dde257f606b7a23b054d28d24ae8c032b8 Mon Sep 17 00:00:00 2001 From: shaidlov <109801990+Edingrast@users.noreply.github.com> Date: Mon, 29 Sep 2025 21:09:26 +0200 Subject: [PATCH 572/986] [PWGUD] QC task for JPsi to 2 Muon process (#13164) --- PWGUD/AQC/CMakeLists.txt | 7 +- PWGUD/AQC/udQcMuon.cxx | 795 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 801 insertions(+), 1 deletion(-) create mode 100644 PWGUD/AQC/udQcMuon.cxx diff --git a/PWGUD/AQC/CMakeLists.txt b/PWGUD/AQC/CMakeLists.txt index d7574e1bcb1..134d2db4bfc 100644 --- a/PWGUD/AQC/CMakeLists.txt +++ b/PWGUD/AQC/CMakeLists.txt @@ -22,4 +22,9 @@ o2physics_add_dpl_workflow(fittest o2physics_add_dpl_workflow(udqcmidrap SOURCES udQCmidRap.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::DGCutparHolder - COMPONENT_NAME Analysis) \ No newline at end of file + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(ud-qc-muon + SOURCES udQcMuon.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::DGCutparHolder + COMPONENT_NAME Analysis) diff --git a/PWGUD/AQC/udQcMuon.cxx b/PWGUD/AQC/udQcMuon.cxx new file mode 100644 index 00000000000..eaa5f59bc8b --- /dev/null +++ b/PWGUD/AQC/udQcMuon.cxx @@ -0,0 +1,795 @@ +// 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 udQcMuon.cxx +/// \brief A task for Asynchronus Quality Control for Ultra-perimpheral and Diffraction (AQC-UD) +/// \author Anisa Khatun, anisa.khatun@cern.ch +/// \author Paul Buehler, paul.buehler@oeaw.ac.at +/// \author Sara Haidlova, sara.haidlova@cern.ch +/// \since 28.09.2025 + +#include "PWGUD/Core/UDHelpers.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/FT0Corrected.h" + +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/StaticFor.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/BCRange.h" + +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +struct UdQcMuon { + + SliceCache cache; + Preslice perBCzdc = aod::zdc::bcId; + Preslice perBCcalo = aod::calo::bcId; + + static constexpr std::string_view KhcFIT1s[5] = {"CleanFIT1/FV0A", "CleanFIT1/FT0A", "CleanFIT1/FT0C", "CleanFIT1/FDDA", "CleanFIT1/FDDC"}; + static constexpr std::string_view KhcFIT2s[5] = {"CleanFIT2/FV0A", "CleanFIT2/FT0A", "CleanFIT2/FT0C", "CleanFIT2/FDDA", "CleanFIT2/FDDC"}; + static constexpr std::string_view KhcRelBCs[5] = {"CleanFIT2/BCFV0A", "CleanFIT2/BCFT0A", "CleanFIT2/BCFT0C", "CleanFIT2/BCFDDA", "CleanFIT2/BCFDDC"}; + + // get a DGCutparHolder + DGCutparHolder diffCuts = DGCutparHolder(); + Configurable dgCuts{"dgCuts", {}, "DG event cuts"}; + Configurable withAmbTrackAnalysis{"withAmbTrackAnalysis", false, "with ambiguous tracks analysis"}; + Configurable withAmbFwdTrackAnalysis{"withAmbFwdTrackAnalysis", false, "with ambiguous forward tracks analysis"}; + Configurable doCleanFITBC{"doCleanFITBC", false, "Require cleanFIT in compatible BCs"}; + Configurable rapCut{"rapCut", 0.9f, "choose event in midrapidity"}; + Configurable itsNClsCut{"itsNClsCut", 4, "minimal number of ITS clusters"}; + Configurable itsChi2NCls{"itsChi2NCls", 36, "minimal Chi2/cluster for the ITS track"}; + Configurable tpcNClsCrossedRowsCut{"tpcNClsCrossedRowsCut", 70, "minimal number of crossed TPC rows"}; + Configurable tpcChi2NCls{"tpcChi2NCls", 4, "minimal Chi2/cluster for the TPC track"}; + Configurable tpcMinNCls{"tpcMinNCls", 3, "minimum number of TPC clusters"}; + + // structures to hold information about the possible BCs the ambiguous tracks/FwdTracks belong to + o2::dataformats::bcRanges abcrs = o2::dataformats::bcRanges("ambiguous_tracks"); + o2::dataformats::bcRanges afbcrs = o2::dataformats::bcRanges("ambiguous_fwdtracks"); + + // inivinitialize HistogramRegistry + HistogramRegistry registry{ + "registry", + {}}; + + // define abbreviations + using CCs = soa::Join; + using CC = CCs::iterator; + using BCs = soa::Join; + using TCs = soa::Join; + using FWs = aod::FwdTracks; + using ATs = aod::AmbiguousTracks; + using AFTs = aod::AmbiguousFwdTracks; + + Partition goodTracks = requireGlobalTrackInFilter(); + + void init(InitContext& context) + { + diffCuts = (DGCutparHolder)dgCuts; + + // add histograms for the different process functions + if (context.mOptions.get("processMain")) { + + // collisions + registry.add("collisions/Stat", "Cut statistics; Selection criterion; Collisions", {HistType::kTH1F, {{20, -0.5, 19.5}}}); + registry.add("collisions/Tracks", "Number of tracks; Number of tracks; Collisions", {HistType::kTH1F, {{300, 0.5, 300.5}}}); + registry.add("collisions/vtxTracks", "Number of vertex tracks; Number of contributors; Collisions", {HistType::kTH1F, {{300, 0.5, 300.5}}}); + registry.add("collisions/globalTracks", "Number of global tracks; Number of global tracks; Collisions", {HistType::kTH1F, {{300, 0.5, 300.5}}}); + registry.add("collisions/posxy", "Vertex position in x and y direction; V_x; V_y; Collisions", {HistType::kTH2F, {{100, -0.5, 0.5}, {100, -0.5, 0.5}}}); + registry.add("collisions/posz", "Vertex position in z direction; V_z; Collisions", {HistType::kTH1F, {{1000, -100., 100.}}}); + registry.add("collisions/netCharge", "All: net charge; Net charge; collisions with PV tracks", {HistType::kTH1F, {{21, -10.5, 10.5}}}); + registry.add("collisions/notPVTracks", "Not PV tracks; Track status bit; Not PV tracks", {HistType::kTH1F, {{17, -0.5, 16.5}}}); + registry.add("collisions/tResvsrTOFTracks", "Number of PV tracks with TOF hit versus collision time resolution; Collision time resolution [ns]; Fraction of PV tracks with TOF hit; Collisions", {HistType::kTH2F, {{1000, 0., 1.E3}, {101, -0.01, 1.01}}}); + registry.add("collisions/tResvsTOFTrkNoPV", "Number of No PV tracks with TOF hit versus collision time resolution; Collision time resolution [ns]; Fraction of No PV tracks with TOF hit; Collisions", {HistType::kTH2F, {{1000, 0., 1.E3}, {101, -0.01, 1.01}}}); + + // tracks + registry.add("tracks/Stat", "Track bits as function of pT; Track pT; Track bit; Tracks", {HistType::kTH2F, {{100, 0., 5.}, {8, 0.5, 8.5}}}); + registry.add("tracks/etapt", "eta versus pT of all tracks; eta of track; p_T of track [MeV/c^2]; Tracks", {HistType::kTH2F, {{80, -2., 2.}, {100, 0., 5.}}}); + registry.add("tracks/etapt2", "eta versus pT of all quality tracks; eta of track; p_T of track [MeV/c^2]; Tracks", {HistType::kTH2F, {{80, -2., 2.}, {100, 0., 5.}}}); + registry.add("tracks/etapt3", "eta versus pT of all global tracks; eta of track; p_T of track [MeV/c^2]; Tracks", {HistType::kTH2F, {{80, -2., 2.}, {100, 0., 5.}}}); + registry.add("tracks/etapt4", "eta versus pT of tracks with ITS Only; eta of track; p_T of track [MeV/c^2]; Tracks", {HistType::kTH2F, {{80, -2., 2.}, {100, 0., 5.}}}); + registry.add("tracks/etapt5", "eta versus pT of all tracks without TOF; eta of track; p_T of track [MeV/c^2]; Tracks", {HistType::kTH2F, {{80, -2., 2.}, {100, 0., 5.}}}); + registry.add("tracks/etapt6", "eta versus pT of tracks with TPC Only; eta of track; p_T of track [MeV/c^2]; Tracks", {HistType::kTH2F, {{80, -2., 2.}, {100, 0., 5.}}}); + registry.add("tracks/etapt7", "eta versus pT of tracks with TRD Only; eta of track; p_T of track [MeV/c^2]; Tracks", {HistType::kTH2F, {{80, -2., 2.}, {100, 0., 5.}}}); + registry.add("tracks/etapt8", "eta versus pT of tracks with TOF Only; eta of track; p_T of track [MeV/c^2]; Tracks", {HistType::kTH2F, {{80, -2., 2.}, {100, 0., 5.}}}); + + registry.add("tracks/dEdxTPC", "TPC signal versus signed track momentum; Signed track momentum [GeV/c]; TPC signal; Tracks", {HistType::kTH2F, {{120, -6., 6.}, {1000, 0., 1000.}}}); + registry.add("tracks/dEdxTOF", "TOF signal versus signed track momentum; Signed track momentum [GeV/c]; TOF signal; Tracks", {HistType::kTH2F, {{1000, 0., 10.}, {1000, 0., 10.}}}); + + // DG + registry.add("DG/PVposxy", "DG: Vertex position in x and y direction; V_x [mm]; V_y [mm]; DG collisions", {HistType::kTH2F, {{100, -0.5, 0.5}, {100, -0.5, 0.5}}}); + registry.add("DG/PVposz", "DG: Vertex position in z direction; V_z; DG collisions", {HistType::kTH1F, {{1000, -100., 100.}}}); + registry.add("DG/netCharge", "DG: net charge; Net charge; DG collisions", {HistType::kTH1F, {{21, -10.5, 10.5}}}); + registry.add("DG/TrackStat", "Track bits as function of pT; Track pT; Track bit; Tracks", {HistType::kTH2F, {{100, 0., 5.}, {10, 0.5, 10.5}}}); + + registry.add("DG/etapt", "DG: eta versus pT of all tracks; eta of track; p_T of track [GeV/c^2]; Tracks", {HistType::kTH2F, {{80, -2., 2.}, {100, 0., 5.}}}); + registry.add("DG/etapt2", "DG: eta versus pT of all quality tracks; eta of track; p_T of track [MeV/c^2]; Tracks", {HistType::kTH2F, {{80, -2., 2.}, {100, 0., 5.}}}); + registry.add("DG/etapt3", "DG: eta versus pT of all global tracks; eta of track; p_T of track [MeV/c^2]; Tracks", {HistType::kTH2F, {{80, -2., 2.}, {100, 0., 5.}}}); + registry.add("DG/etapt4", "DG: eta versus pT of all TPC clusers; eta of track; p_T of track [MeV/c^2]; Tracks", {HistType::kTH2F, {{80, -2., 2.}, {100, 0., 5.}}}); + registry.add("DG/etapt5", "DG: eta versus pT of frac.TPCSharedClusters; eta of track; p_T of track [MeV/c^2]; Tracks", {HistType::kTH2F, {{80, -2., 2.}, {100, 0., 5.}}}); + registry.add("DG/etapt6", "DG: eta versus pT of all tracks with ITS; eta of track; p_T of track [MeV/c^2]; Tracks", {HistType::kTH2F, {{80, -2., 2.}, {100, 0., 5.}}}); + registry.add("DG/etapt7", "DG: eta versus pT of all tracks with TPC; eta of track; p_T of track [MeV/c^2]; Tracks", {HistType::kTH2F, {{80, -2., 2.}, {100, 0., 5.}}}); + registry.add("DG/etapt8", "DG: eta versus pT of all tracks with TRD; eta of track; p_T of track [MeV/c^2]; Tracks", {HistType::kTH2F, {{80, -2., 2.}, {100, 0., 5.}}}); + registry.add("DG/etapt9", "DG: eta versus pT of all tracks with TOF; eta of track; p_T of track [MeV/c^2]; Tracks", {HistType::kTH2F, {{80, -2., 2.}, {100, 0., 5.}}}); + + registry.add("DG/dEdxTPC", "DG: TPC signal versus signed track momentum; Signed track momentum [GeV/c]; TPC signal; Tracks", {HistType::kTH2F, {{120, -6., 6.}, {1000, 0., 1000.}}}); + registry.add("DG/dEdxTOF", "DG: TOF signal versus signed track momentum; Signed track momentum [GeV/c]; TOF signal; Tracks", {HistType::kTH2F, {{1000, 0., 10.}, {1000, 0., 10.}}}); + registry.add("DG/IVMptSys", "DG: Invariant mass versus p_{T, system}; Invarian mass [GeV/c^2]; p_{T, system} [GeV/c]; DG collisions", {HistType::kTH2F, {{100, 0., 5.}, {400, 0., 4.0}}}); + registry.add("DG/IVMptSys2PVtrk", "DG: Invariant mass versus p_{T, system}; Invarian mass [GeV/c^2]; p_{T, system} [GeV/c]; DG collisions 2 PV tracks", {HistType::kTH2F, {{1000, 0., 10.}, {350, 0., 3.5}}}); + registry.add("DG/etaplus", "DG: eta of positive tracks; eta of track", {HistType::kTH2F, {{1000, -5., 5.}, {120, -6., 6., "#phi"}}}); + registry.add("DG/etaminus", "DG: eta of negative tracks; eta of track", {HistType::kTH2F, {{1000, -5., 5.}, {120, -6., 6., "#phi"}}}); + registry.add("DG/hMass", "DG: Invariant mass of pions; Invarian mass [GeV/c^2]", {HistType::kTH1F, {{1000, 0., 10.}}}); + registry.add("DG/trkDCAxy", "DG: Track DCA of XY; DCAxy", {HistType::kTH1F, {{100, -1., 1.}}}); + registry.add("DG/trkDCAz", "DG: Track DCA of XY; DCAz", {HistType::kTH1F, {{100, -1., 1.}}}); + } + if (context.mOptions.get("processFewProng")) { + registry.add("fpStat", "#fpStat", {HistType::kTH1F, {{2, 0.5, 2.5}}}); + registry.add("allPVC", "#allPVC", {HistType::kTH1F, {{200, 0.5, 200.5}}}); + registry.add("fpPVC", "#fpPVC", {HistType::kTH1F, {{200, 0.5, 200.5}}}); + } + if (context.mOptions.get("processCleanFIT1")) { + registry.add("CleanFIT1/cleanFIT1", "#cleanFIT1", {HistType::kTH2F, {{20, -0.5, 19.5}, {1000, -0.5, 999.5}}}); + registry.add("CleanFIT1/cF1FV0Aamp", "#cF1FV0Aamp", {HistType::kTH2F, {{20, -0.5, 19.5}, {1000, -0.5, 999.5}}}); + registry.add("CleanFIT1/cF1FT0Aamp", "#cF1FT0Aamp", {HistType::kTH2F, {{20, -0.5, 19.5}, {1000, -0.5, 999.5}}}); + registry.add("CleanFIT1/cF1FT0Camp", "#cF1FT0Camp", {HistType::kTH2F, {{20, -0.5, 19.5}, {1000, -0.5, 999.5}}}); + registry.add("CleanFIT1/cF1FDDAamp", "#cF1FDDAamp", {HistType::kTH2F, {{20, -0.5, 19.5}, {1000, -0.5, 999.5}}}); + registry.add("CleanFIT1/cF1FDDCamp", "#cF1FDDCamp", {HistType::kTH2F, {{20, -0.5, 19.5}, {1000, -0.5, 999.5}}}); + + constexpr int N = static_cast(std::size(KhcFIT1s)); + + for (auto n{0}; n < N; n++) { + registry.add(KhcFIT1s[n].data(), KhcFIT1s[n].data(), {HistType::kTH2F, {{20, -0.5, 19.5}, {2, -0.5, 1.5}}}); + } + } + if (context.mOptions.get("processCleanFIT2")) { + registry.add("CleanFIT2/cleanFIT2", "#cleanFIT2", {HistType::kTH2F, {{20, -0.5, 19.5}, {1000, -0.5, 999.5}}}); + registry.add("CleanFIT2/cF2FV0Aamp", "#cF2FV0Aamp", {HistType::kTH2F, {{20, -0.5, 19.5}, {1000, -0.5, 999.5}}}); + registry.add("CleanFIT2/cF2FT0Aamp", "#cF2FT0Aamp", {HistType::kTH2F, {{20, -0.5, 19.5}, {1000, -0.5, 999.5}}}); + registry.add("CleanFIT2/cF2FT0Camp", "#cF2FT0Camp", {HistType::kTH2F, {{20, -0.5, 19.5}, {1000, -0.5, 999.5}}}); + registry.add("CleanFIT2/cF2FDDAamp", "#cF2FDDAamp", {HistType::kTH2F, {{20, -0.5, 19.5}, {1000, -0.5, 999.5}}}); + registry.add("CleanFIT2/cF2FDDCamp", "#cF2FDDCamp", {HistType::kTH2F, {{20, -0.5, 19.5}, {1000, -0.5, 999.5}}}); + + constexpr int N_t = static_cast(std::size(KhcFIT2s)); + for (auto n{0}; n < N_t; n++) { + registry.add(KhcFIT2s[n].data(), KhcFIT2s[n].data(), {HistType::kTH2F, {{20, -0.5, 19.5}, {2, -0.5, 1.5}}}); + registry.add(KhcRelBCs[n].data(), KhcRelBCs[n].data(), {HistType::kTH1F, {{3564, -0.5, 3563.5}}}); + } + } + if (context.mOptions.get("processFV0")) { + registry.add("FV0/FV0A", "#FV0A", {HistType::kTH2F, {{48, -0.5, 47.5}, {2000, 0., 2000.}}}); + registry.add("FV0/hV0A", "Time FV0A", {HistType::kTH1F, {{500, -5.0, 5.0}}}); + } + if (context.mOptions.get("processFT0")) { + registry.add("FT0/FT0A", "#FT0A", {HistType::kTH2F, {{96, -0.5, 95.5}, {400, 0., 400.}}}); + registry.add("FT0/FT0C", "#FT0C", {HistType::kTH2F, {{112, -0.5, 111.5}, {400, 0., 400.}}}); + registry.add("FT0/hT0A", "Time FT0 A side", {HistType::kTH1F, {{500, -5.0, 5.0}}}); + registry.add("FT0/hT0C", "Time FT0 C side", {HistType::kTH1F, {{500, -5.0, 5.0}}}); + registry.add("FT0/hT0ACorr", "Corrected Time FT0 A side", {HistType::kTH1F, {{500, -5.0, 5.0}}}); + registry.add("FT0/hT0CCorr", "Corrected Time FT0 C side", {HistType::kTH1F, {{500, -5.0, 5.0}}}); + registry.add("FT0/hT0AC", "Average Time FT0", {HistType::kTH1F, {{500, -5.0, 5.0}}}); + } + if (context.mOptions.get("processFDD")) { + registry.add("FDD/FDDA", "#FDDA", {HistType::kTH2F, {{8, -0.5, 7.5}, {100, 0., 100.}}}); + registry.add("FDD/FDDC", "#FDDC", {HistType::kTH2F, {{8, -0.5, 7.5}, {100, 0., 100.}}}); + registry.add("FDD/hFDDA", " Avg Time FDD A side", {HistType::kTH1F, {{500, -5.0, 5.0}}}); + registry.add("FDD/hFDDC", " Avg Time FDD C side", {HistType::kTH1F, {{500, -5.0, 5.0}}}); + } + if (context.mOptions.get("processZDC")) { + registry.add("ZdcEnergies", "#ZdcEnergies", {HistType::kTH2F, {{22, -0.5, 21.5}, {100, 0., 1000.}}}); + } + } + + // ............................................................................................................... + void processMain(CC const& collision, BCs const& bct0s, + TCs const& tracks, FWs const& fwdtracks, ATs const& /*ambtracks*/, AFTs const& /*ambfwdtracks*/, + aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0as*/, aod::FDDs const& /*fdds*/, + aod::Zdcs& zdcs, aod::Calos& calos, + aod::V0s const& v0s, aod::Cascades const& cascades) + { + // LOGF(debug, " Start %i", abcrs.size()); + + if (!tracks.size()) + return; + if (collision.numContrib() < 1) + return; + + bool isDGcandidate = true; + registry.get(HIST("collisions/Stat"))->Fill(0., isDGcandidate * 1.); + + auto netChargeAll = 0; + for (auto const& trk : tracks) { + if (trk.isPVContributor()) { + netChargeAll += trk.sign(); + } + } + + // update collision histograms + // vertex position + registry.get(HIST("collisions/posxy"))->Fill(collision.posX(), collision.posY()); + registry.get(HIST("collisions/posz"))->Fill(collision.posZ()); + registry.get(HIST("collisions/netCharge"))->Fill(netChargeAll); + // tracks + registry.get(HIST("collisions/Tracks"))->Fill(tracks.size()); + // vertex tracks normally gives PV contributors from collisions + registry.get(HIST("collisions/vtxTracks"))->Fill(collision.numContrib()); + // global tracks + // Partition goodTracks = requireGlobalTrackInFilter(); + goodTracks.bindTable(tracks); + registry.get(HIST("collisions/globalTracks"))->Fill(goodTracks.size()); + + // loop over all tracks + float rgtrwTOF = 0.; + float norgtrwTOF = 0.; + for (auto const& track : tracks) { + // update PV track stats + if (track.isPVContributor()) { + registry.get(HIST("tracks/Stat"))->Fill(track.pt(), 1., 1.); + registry.get(HIST("tracks/Stat"))->Fill(track.pt(), 2., track.isQualityTrack() * 1.); + registry.get(HIST("tracks/Stat"))->Fill(track.pt(), 3., track.isGlobalTrack() * 1.); + registry.get(HIST("tracks/Stat"))->Fill(track.pt(), 4., (track.hasITS() && !track.hasTPC() && !track.hasTRD() && !track.hasTOF()) * 1.); // tracks with only ITS + registry.get(HIST("tracks/Stat"))->Fill(track.pt(), 5., (track.hasITS() && track.hasTPC() && track.hasTRD() && !track.hasTOF()) * 1.); // tracks without TOF + registry.get(HIST("tracks/Stat"))->Fill(track.pt(), 6., (!track.hasITS() && track.hasTPC() && !track.hasTRD() && !track.hasTOF()) * 1.); // tracks with only TPC + registry.get(HIST("tracks/Stat"))->Fill(track.pt(), 7., (!track.hasITS() && !track.hasTPC() && track.hasTRD() && !track.hasTOF()) * 1.); // tracks with only TRD + registry.get(HIST("tracks/Stat"))->Fill(track.pt(), 8., (!track.hasITS() && !track.hasTPC() && !track.hasTRD() && track.hasTOF()) * 1.); // tracks with only TOF + + // update eta vs pt histograms + registry.get(HIST("tracks/etapt"))->Fill(track.eta(), track.pt(), 1.); + registry.get(HIST("tracks/etapt2"))->Fill(track.eta(), track.pt(), track.isQualityTrack() * 1.); + registry.get(HIST("tracks/etapt3"))->Fill(track.eta(), track.pt(), track.isGlobalTrack() * 1.); + registry.get(HIST("tracks/etapt4"))->Fill(track.eta(), track.pt(), (track.hasITS() && !track.hasTPC() && !track.hasTRD() && !track.hasTOF()) * 1.); // tracks with only ITS + registry.get(HIST("tracks/etapt5"))->Fill(track.eta(), track.pt(), (track.hasITS() && track.hasTPC() && track.hasTRD() && !track.hasTOF()) * 1.); // tracks without TOF + registry.get(HIST("tracks/etapt6"))->Fill(track.eta(), track.pt(), (!track.hasITS() && track.hasTPC() && !track.hasTRD() && !track.hasTOF()) * 1.); // tracks with only TPC + registry.get(HIST("tracks/etapt7"))->Fill(track.eta(), track.pt(), (!track.hasITS() && !track.hasTPC() && track.hasTRD() && !track.hasTOF()) * 1.); // tracks with only TRD + registry.get(HIST("tracks/etapt8"))->Fill(track.eta(), track.pt(), (!track.hasITS() && !track.hasTPC() && !track.hasTRD() && track.hasTOF()) * 1.); // tracks with only TOF + + // update dEdx histograms + registry.get(HIST("tracks/dEdxTPC"))->Fill(track.tpcInnerParam() / track.sign(), track.tpcSignal()); + + // TOF hit? + if (track.hasTOF()) { + registry.get(HIST("tracks/dEdxTOF"))->Fill(track.p() / track.sign(), track.beta()); + + // No vertex track with TOF hit? + if (!track.isPVContributor()) { + norgtrwTOF += 1.; + } + + // vertex track with TOF hit? + if (track.isPVContributor()) { + rgtrwTOF += 1.; + } + } + } + } // closing track loop + + // fraction of No PV and PV tracks with TOF hit + if (collision.numContrib() > 0) { + norgtrwTOF /= collision.numContrib(); + rgtrwTOF /= collision.numContrib(); + } + + // LOGF(debug, " PV tracks with TOF: %f [1]", rgtrwTOF); + registry.get(HIST("collisions/tResvsrTOFTracks"))->Fill(collision.collisionTimeRes(), rgtrwTOF); + registry.get(HIST("collisions/tResvsTOFTrkNoPV"))->Fill(collision.collisionTimeRes(), norgtrwTOF); + + // is it a DG candidate? + // 1. DG = no FIT signal in compatible BCs + // 2. & no ZDC signal in compatible BCs + // 3. & no Calo signal in compatible BCs + // 4. & no V0s + // 5. & no Cascades + // 6. & number of forward tracks = 0 + // 7. & no global track which is not a vertex track + // 8. & no vertex track which is not a global track + // 9. & ntrMin <= number of vertex tracks <= ntrMax + isDGcandidate = true; + + // get BCrange to test for FIT signals + auto bcSlice = udhelpers::compatibleBCs(collision, diffCuts.NDtcoll(), bct0s, diffCuts.minNBCs()); + + // 1. no FIT signal in bcSlice / collision + if (doCleanFITBC) { + for (auto const& bc : bcSlice) { + if (!udhelpers::cleanFIT(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits())) { + isDGcandidate = false; + break; + } + } + } else { + if (!udhelpers::cleanFITCollision(collision, diffCuts.maxFITtime(), diffCuts.FITAmpLimits())) { + isDGcandidate = false; + } + } + registry.get(HIST("collisions/Stat"))->Fill(1., isDGcandidate * 1.); + + // 2. no Zdc signal in bcSlice + std::vector lims(10, 0.); + for (auto const& bc : bcSlice) { + if (!udhelpers::cleanZDC(bc, zdcs, lims, cache)) { + isDGcandidate = false; + break; + } + } + registry.get(HIST("collisions/Stat"))->Fill(2., isDGcandidate * 1.); + + // 3. no Calo signal in bcSlice + for (auto const& bc : bcSlice) { + if (!udhelpers::cleanCalo(bc, calos, lims, cache)) { + isDGcandidate = false; + break; + } + } + registry.get(HIST("collisions/Stat"))->Fill(3., isDGcandidate * 1.); + + // 4. no V0s + isDGcandidate &= (v0s.size() == 0); + registry.get(HIST("collisions/Stat"))->Fill(4., isDGcandidate * 1.); + + // 5. no Cascades + isDGcandidate &= (cascades.size() == 0); + registry.get(HIST("collisions/Stat"))->Fill(5., isDGcandidate * 1.); + + // 6. number of forward tracks = 0 + isDGcandidate &= (fwdtracks.size() == 0); + registry.get(HIST("collisions/Stat"))->Fill(6., isDGcandidate * 1.); + + // 7. Check for global tracks which are no vtx tracks + bool globalAndVtx = isDGcandidate; + bool vtxAndGlobal = isDGcandidate; + for (auto const& track : tracks) { + if (track.isGlobalTrack() && !track.isPVContributor()) { + globalAndVtx = false; + } + if (track.isPVContributor() && !track.isGlobalTrack()) { + vtxAndGlobal = false; + } + } + registry.get(HIST("collisions/Stat"))->Fill(7., globalAndVtx * 1.); + + // 8. check a given bc for possible ambiguous Tracks + auto noAmbTracks = isDGcandidate; + for (auto const& bc : bcSlice) { + if (abcrs.isInRange(bc.globalIndex())) { + noAmbTracks = false; + break; + } + } + registry.get(HIST("collisions/Stat"))->Fill(8., noAmbTracks * 1.); // noAmbTracks + + // 9. check a given bc for possible ambiguous FwdTracks + auto noAmbFwdTracks = isDGcandidate; + for (auto const& bc : bcSlice) { + if (afbcrs.isInRange(bc.globalIndex())) { + noAmbFwdTracks = false; + break; + } + } + registry.get(HIST("collisions/Stat"))->Fill(9., noAmbFwdTracks * 1.); // noAmbFwdTracks + + // 10. number of vertex tracks <= n not sure + isDGcandidate &= (collision.numContrib() >= diffCuts.minNTracks()); + registry.get(HIST("collisions/Stat"))->Fill(10., isDGcandidate * 1.); + isDGcandidate &= (collision.numContrib() <= diffCuts.maxNTracks()); + registry.get(HIST("collisions/Stat"))->Fill(11., isDGcandidate * 1.); + + // 11. fraction of PV tracks with TOF hit + isDGcandidate &= (rgtrwTOF >= diffCuts.minRgtrwTOF()); + registry.get(HIST("collisions/Stat"))->Fill(12., isDGcandidate * 1.); + // 8. check for vertex tracks which are no global tracks + isDGcandidate &= globalAndVtx; + if (diffCuts.globalTracksOnly()) { + isDGcandidate &= vtxAndGlobal; + } + registry.get(HIST("collisions/Stat"))->Fill(19., isDGcandidate * 1.); + + // 12. net charge and invariant mass + bool goodetas = true; + int countGT = 0; + std::vector trkIdx; + if (isDGcandidate) { + // check good quality of the tracks + for (auto const& track : tracks) { + // update histogram for rejectedTracks/notPVtracks + if (!track.isPVContributor()) { + registry.get(HIST("collisions/notPVTracks"))->Fill(0., 1.); + registry.get(HIST("collisions/notPVTracks"))->Fill(1., track.isGlobalTrackSDD() * 1.); + registry.get(HIST("collisions/notPVTracks"))->Fill(2., track.passedTrackType() * 1.); + registry.get(HIST("collisions/notPVTracks"))->Fill(3., track.passedPtRange() * 1.); + registry.get(HIST("collisions/notPVTracks"))->Fill(4., track.passedEtaRange() * 1.); + registry.get(HIST("collisions/notPVTracks"))->Fill(5., track.passedTPCNCls() * 1.); + registry.get(HIST("collisions/notPVTracks"))->Fill(6., track.passedTPCCrossedRows() * 1.); + registry.get(HIST("collisions/notPVTracks"))->Fill(7., track.passedTPCCrossedRowsOverNCls() * 1.); + registry.get(HIST("collisions/notPVTracks"))->Fill(8., track.passedTPCChi2NDF() * 1.); + registry.get(HIST("collisions/notPVTracks"))->Fill(9., track.passedTPCRefit() * 1.); + registry.get(HIST("collisions/notPVTracks"))->Fill(10., track.passedITSNCls() * 1.); + registry.get(HIST("collisions/notPVTracks"))->Fill(11., track.passedITSChi2NDF() * 1.); + registry.get(HIST("collisions/notPVTracks"))->Fill(12., track.passedITSRefit() * 1.); + registry.get(HIST("collisions/notPVTracks"))->Fill(13., track.passedITSHits() * 1.); + registry.get(HIST("collisions/notPVTracks"))->Fill(14., track.passedGoldenChi2() * 1.); + registry.get(HIST("collisions/notPVTracks"))->Fill(15., track.passedDCAxy() * 1.); + registry.get(HIST("collisions/notPVTracks"))->Fill(16., track.passedDCAz() * 1.); + continue; + } + if (RecoDecay::eta(std::array{track.px(), track.py(), track.pz()}) <= diffCuts.minEta() || RecoDecay::eta(std::array{track.px(), track.py(), track.pz()}) >= diffCuts.maxEta()) { + goodetas = false; + continue; + } + if (!track.hasITS()) { + continue; + } + if (track.itsChi2NCl() > itsChi2NCls) { + continue; + } + if (!track.hasTPC()) { + continue; + } + if (track.tpcChi2NCl() > tpcChi2NCls) { + continue; + } + if (track.tpcNClsCrossedRows() < tpcNClsCrossedRowsCut) { + continue; + } + countGT++; + trkIdx.push_back(track.index()); + } + } + isDGcandidate &= goodetas; + registry.get(HIST("collisions/Stat"))->Fill(14., isDGcandidate * 1.); + + float massMu = o2::constants::physics::MassMuonMinus; + // DGcandidates with 2 good tracks -> to be optimised for different number of candidates + int tG = 2; + if (isDGcandidate && countGT == tG) { + + auto trkDaughter1 = tracks.iteratorAt(trkIdx[0]); + auto trkDaughter2 = tracks.iteratorAt(trkIdx[1]); + + // vertex position of DG events + registry.get(HIST("DG/PVposxy"))->Fill(collision.posX(), collision.posY()); + registry.get(HIST("DG/PVposz"))->Fill(collision.posZ()); + + // tracks with opposite charges -> to be optimised for different numbers + if ((trkDaughter1.sign() * trkDaughter2.sign()) != -1) { + return; + } + + if (RecoDecay::sumOfSquares(trkDaughter1.tpcNSigmaEl(), trkDaughter2.tpcNSigmaEl()) > RecoDecay::sumOfSquares(trkDaughter1.tpcNSigmaMu(), trkDaughter2.tpcNSigmaMu())) { + std::array daughter1 = {trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()}; + std::array daughter2 = {trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()}; + + std::array mother = {trkDaughter1.px() + trkDaughter2.px(), trkDaughter1.py() + trkDaughter2.py(), trkDaughter1.pz() + trkDaughter2.pz()}; + + auto arrMom = std::array{daughter1, daughter2}; + float massJpsi = RecoDecay::m(arrMom, std::array{massMu, massMu}); + float rapJpsi = RecoDecay::y(mother, massJpsi); + + if (std::abs(rapJpsi) > rapCut) { + return; + } + + registry.get(HIST("DG/hMass"))->Fill(massJpsi); + registry.get(HIST("DG/IVMptSys2PVtrk"))->Fill(massJpsi, RecoDecay::pt(mother)); + + registry.get(HIST("DG/TrackStat"))->Fill(trkDaughter1.pt(), 1., 1.); + registry.get(HIST("DG/TrackStat"))->Fill(trkDaughter1.pt(), 2., trkDaughter1.isQualityTrack() * 1.); + registry.get(HIST("DG/TrackStat"))->Fill(trkDaughter1.pt(), 3., trkDaughter1.isGlobalTrack() * 1.); + registry.get(HIST("DG/TrackStat"))->Fill(trkDaughter1.pt(), 4., trkDaughter1.tpcNClsFound() * 1.); + registry.get(HIST("DG/TrackStat"))->Fill(trkDaughter1.pt(), 5., trkDaughter1.tpcFractionSharedCls() * 1.); + registry.get(HIST("DG/TrackStat"))->Fill(trkDaughter1.pt(), 10, trkDaughter1.dcaXY() * 1.); + registry.get(HIST("DG/TrackStat"))->Fill(trkDaughter1.pt(), 11, trkDaughter1.dcaZ() * 1.); + + registry.get(HIST("DG/TrackStat"))->Fill(trkDaughter2.pt(), 1., 1.); + registry.get(HIST("DG/TrackStat"))->Fill(trkDaughter2.pt(), 2., trkDaughter2.isQualityTrack() * 1.); + registry.get(HIST("DG/TrackStat"))->Fill(trkDaughter2.pt(), 3., trkDaughter2.isGlobalTrack() * 1.); + registry.get(HIST("DG/TrackStat"))->Fill(trkDaughter2.pt(), 4., trkDaughter2.tpcNClsFound() * 1.); + registry.get(HIST("DG/TrackStat"))->Fill(trkDaughter2.pt(), 5., trkDaughter2.tpcFractionSharedCls() * 1.); + registry.get(HIST("DG/TrackStat"))->Fill(trkDaughter2.pt(), 10, trkDaughter2.dcaXY() * 1.); + registry.get(HIST("DG/TrackStat"))->Fill(trkDaughter2.pt(), 11, trkDaughter2.dcaZ() * 1.); + + registry.get(HIST("DG/etapt"))->Fill(trkDaughter1.eta(), trkDaughter1.pt(), 1.); + registry.get(HIST("DG/etapt2"))->Fill(trkDaughter1.eta(), trkDaughter1.pt(), trkDaughter1.isQualityTrack() * 1.); + registry.get(HIST("DG/etapt3"))->Fill(trkDaughter1.eta(), trkDaughter1.pt(), trkDaughter1.isGlobalTrack() * 1.); + registry.get(HIST("DG/etapt4"))->Fill(trkDaughter1.eta(), trkDaughter1.pt(), trkDaughter1.tpcNClsFound() * 1.); + registry.get(HIST("DG/etapt5"))->Fill(trkDaughter1.eta(), trkDaughter1.pt(), trkDaughter1.tpcFractionSharedCls() * 1.); + + registry.get(HIST("DG/etapt"))->Fill(trkDaughter2.eta(), trkDaughter2.pt(), 1.); + registry.get(HIST("DG/etapt2"))->Fill(trkDaughter2.eta(), trkDaughter2.pt(), trkDaughter2.isQualityTrack() * 1.); + registry.get(HIST("DG/etapt3"))->Fill(trkDaughter2.eta(), trkDaughter2.pt(), trkDaughter2.isGlobalTrack() * 1.); + registry.get(HIST("DG/etapt4"))->Fill(trkDaughter2.eta(), trkDaughter2.pt(), trkDaughter2.tpcNClsFound() * 1.); + registry.get(HIST("DG/etapt5"))->Fill(trkDaughter2.eta(), trkDaughter2.pt(), trkDaughter2.tpcFractionSharedCls() * 1.); + + if (trkDaughter1.sign() > 0 || trkDaughter2.sign() > 0) { + registry.get(HIST("DG/etaplus"))->Fill(trkDaughter1.eta(), trkDaughter1.phi()); + registry.get(HIST("DG/etaplus"))->Fill(trkDaughter2.eta(), trkDaughter2.phi()); + } + if (trkDaughter1.sign() < 0 || trkDaughter2.sign() < 0) { + registry.get(HIST("DG/etaminus"))->Fill(trkDaughter1.eta(), trkDaughter1.phi()); + registry.get(HIST("DG/etaminus"))->Fill(trkDaughter2.eta(), trkDaughter2.phi()); + } + + registry.get(HIST("DG/dEdxTPC"))->Fill(trkDaughter1.tpcInnerParam() / trkDaughter1.sign(), trkDaughter1.tpcSignal()); + registry.get(HIST("DG/trkDCAxy"))->Fill(trkDaughter1.dcaXY()); + registry.get(HIST("DG/trkDCAz"))->Fill(trkDaughter1.dcaZ()); + + registry.get(HIST("DG/dEdxTPC"))->Fill(trkDaughter2.tpcInnerParam() / trkDaughter2.sign(), trkDaughter2.tpcSignal()); + registry.get(HIST("DG/trkDCAxy"))->Fill(trkDaughter2.dcaXY()); + registry.get(HIST("DG/trkDCAz"))->Fill(trkDaughter2.dcaZ()); + + if (trkDaughter1.hasTOF()) { + registry.get(HIST("DG/dEdxTOF"))->Fill(trkDaughter1.p() / trkDaughter1.sign(), trkDaughter1.beta()); + } + if (trkDaughter2.hasTOF()) { + registry.get(HIST("DG/dEdxTOF"))->Fill(trkDaughter2.p() / trkDaughter2.sign(), trkDaughter2.beta()); + } + } + } + } + PROCESS_SWITCH(UdQcMuon, processMain, "Process Main", true); + + // ............................................................................................................... + // Distribution of number of PV contributors for all collisions and those with empty FT0 + void processFewProng(CC const& collision, BCs const& /*bct0s*/, + aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0as*/, aod::FDDs const& /*fdds*/) + { + // count collisions + registry.get(HIST("fpStat"))->Fill(1., 1.); + registry.get(HIST("allPVC"))->Fill(collision.numContrib(), 1.); + + // check FT0 to be empty + auto bc = collision.foundBC_as(); + if (udhelpers::cleanFT0(bc, diffCuts.maxFITtime(), 0., 0.)) { + // only collisions with empty FT0 arrive here + registry.get(HIST("fpStat"))->Fill(2., 1.); + + // update #PV contributors in collisions with empty FT0 + registry.get(HIST("fpPVC"))->Fill(collision.numContrib(), 1.); + } + } + PROCESS_SWITCH(UdQcMuon, processFewProng, "Process FewProng", true); + + // ............................................................................................................................................. + void processCleanFIT1(CC const& collision, BCs const& bct0s, + aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0as*/, aod::FDDs const& /*fdds*/) + { + // LOGF(debug, "(5, 1000000.); + bool isDGcandidate = true; + int maxNDtcoll = 20; + for (int NDtcoll = 0; NDtcoll < maxNDtcoll; NDtcoll++) { + auto bcSlice = udhelpers::compatibleBCs(collision, NDtcoll, bct0s, 0); + + // do for diffCuts.FITAmpLimits + ampFV0A = ampFT0A = ampFT0C = ampFDDA = ampFDDC = 0.; + isDGcandidate = true; + for (auto const& bc : bcSlice) { + isDGcandidate &= udhelpers::cleanFIT(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits()); + + if (bc.has_foundFV0()) { + ampFV0A += udhelpers::FV0AmplitudeA(bc.foundFV0()); + } + if (bc.has_foundFT0()) { + ampFT0A += udhelpers::FT0AmplitudeA(bc.foundFT0()); + ampFT0C += udhelpers::FT0AmplitudeA(bc.foundFT0()); + } + if (bc.has_foundFDD()) { + ampFDDA += udhelpers::FDDAmplitudeA(bc.foundFDD()); + ampFDDC += udhelpers::FDDAmplitudeA(bc.foundFDD()); + } + } + registry.get(HIST("CleanFIT1/cleanFIT1"))->Fill(NDtcoll, isDGcandidate * 1.); + if (isDGcandidate) { + registry.get(HIST("CleanFIT1/cF1FV0Aamp"))->Fill(NDtcoll, ampFV0A); + registry.get(HIST("CleanFIT1/cF1FT0Aamp"))->Fill(NDtcoll, ampFT0A); + registry.get(HIST("CleanFIT1/cF1FT0Camp"))->Fill(NDtcoll, ampFT0C); + registry.get(HIST("CleanFIT1/cF1FDDAamp"))->Fill(NDtcoll, ampFDDA); + registry.get(HIST("CleanFIT1/cF1FDDCamp"))->Fill(NDtcoll, ampFDDC); + } + + // loop over single detectors + static_for<0, 4>([&](auto n) { + fitLims[n] = 0.; + isDGcandidate = true; + for (auto const& bc : bcSlice) { + isDGcandidate &= udhelpers::cleanFIT(bc, diffCuts.maxFITtime(), fitLims); + } + constexpr int Index = n.value; + registry.fill(HIST(KhcFIT1s[Index]), NDtcoll, isDGcandidate * 1.); + fitLims[n] = 1000000.; + }); + } + } + + PROCESS_SWITCH(UdQcMuon, processCleanFIT1, "Process CleanFitTest1", true); + // ............................................................................................................................................. + + void processCleanFIT2(CC const& collision, BCs const& bct0s, + aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0as*/, aod::FDDs const& /*fdds*/) + { + // LOGF(debug, "(); + bcnum = collbc.globalBC() % o2::constants::lhc::LHCMaxBunches; + } + // test influence of BCrange width using a series of nMinBC + float ampFV0A, ampFT0A, ampFT0C, ampFDDA, ampFDDC; + auto fitLims = std::vector(5, 1000000.); + bool isDGcandidate = true; + int nMaxBC = 20; + for (int nMinBC = 0; nMinBC < nMaxBC; nMinBC++) { + auto bcSlice = udhelpers::compatibleBCs(collision, 0, bct0s, nMinBC); + ampFV0A = ampFT0A = ampFT0C = ampFDDA = ampFDDC = 0.; + isDGcandidate = true; + for (auto const& bc : bcSlice) { + isDGcandidate &= udhelpers::cleanFIT(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits()); + + if (bc.has_foundFV0()) { + ampFV0A += udhelpers::FV0AmplitudeA(bc.foundFV0()); + } + if (bc.has_foundFT0()) { + ampFT0A += udhelpers::FT0AmplitudeA(bc.foundFT0()); + ampFT0C += udhelpers::FT0AmplitudeA(bc.foundFT0()); + } + if (bc.has_foundFDD()) { + ampFDDA += udhelpers::FDDAmplitudeA(bc.foundFDD()); + ampFDDC += udhelpers::FDDAmplitudeA(bc.foundFDD()); + } + } + registry.get(HIST("CleanFIT2/cleanFIT2"))->Fill(nMinBC, isDGcandidate * 1.); + + if (isDGcandidate) { + registry.get(HIST("CleanFIT2/cF2FV0Aamp"))->Fill(nMinBC, ampFV0A); + registry.get(HIST("CleanFIT2/cF2FT0Aamp"))->Fill(nMinBC, ampFT0A); + registry.get(HIST("CleanFIT2/cF2FT0Camp"))->Fill(nMinBC, ampFT0C); + registry.get(HIST("CleanFIT2/cF2FDDAamp"))->Fill(nMinBC, ampFDDA); + registry.get(HIST("CleanFIT2/cF2FDDCamp"))->Fill(nMinBC, ampFDDC); + } + + // loop over single detectors + static_for<0, 4>([&](auto n) { + fitLims[n] = 0.; + isDGcandidate = true; + for (auto const& bc : bcSlice) { + isDGcandidate &= udhelpers::cleanFIT(bc, diffCuts.maxFITtime(), fitLims); // DG + } + constexpr int Index = n.value; + registry.fill(HIST(KhcFIT2s[Index]), nMinBC, isDGcandidate * 1.); + registry.fill(HIST(KhcRelBCs[Index]), static_cast(bcnum), isDGcandidate * 1.); + fitLims[n] = 1000000.; + }); + } + } + + PROCESS_SWITCH(UdQcMuon, processCleanFIT2, "Process CleanFitTest2", true); + + // ............................................................................................................... + void processFV0(aod::FV0As const& fv0s, BCs const&) + { + // LOGF(info, " %d", fv0s.size()); + if (fv0s.size() <= 0) { + return; + } + + for (auto const& fv0 : fv0s) { + registry.get(HIST("FV0/hV0A"))->Fill(fv0.time()); + // side A + for (size_t ind = 0; ind < fv0.channel().size(); ind++) { + registry.get(HIST("FV0/FV0A"))->Fill((fv0.channel())[ind], (fv0.amplitude())[ind]); + } + } + }; + PROCESS_SWITCH(UdQcMuon, processFV0, "Process FV0", true); + + // ............................................................................................................... + void processFT0(aod::FT0s const& ft0s, aod::FT0sCorrected const& ft0scorr, BCs const&) + { + // LOGF(debug, " %d", ft0s.size()); + for (auto const& collision : ft0scorr) { + + if (collision.t0ACorrectedValid()) { + registry.get(HIST("FT0/hT0ACorr"))->Fill(collision.t0ACorrected()); + } + if (collision.t0CCorrectedValid()) { + registry.get(HIST("FT0/hT0CCorr"))->Fill(collision.t0CCorrected()); + } + + if (collision.t0CCorrectedValid() && collision.t0ACorrectedValid()) { + registry.get(HIST("FT0/hT0AC"))->Fill(collision.t0AC()); + } + } + for (auto const& ft0 : ft0s) { + registry.get(HIST("FT0/hT0A"))->Fill(ft0.timeA()); + registry.get(HIST("FT0/hT0C"))->Fill(ft0.timeC()); + + // side A + for (size_t ind = 0; ind < ft0.channelA().size(); ind++) { + registry.get(HIST("FT0/FT0A"))->Fill((ft0.channelA())[ind], (ft0.amplitudeA())[ind]); + } + + // side C + for (size_t ind = 0; ind < ft0.channelC().size(); ind++) { + registry.get(HIST("FT0/FT0C"))->Fill((ft0.channelC())[ind], (ft0.amplitudeC())[ind]); + } + } + }; + PROCESS_SWITCH(UdQcMuon, processFT0, "Process FT0", true); + + // ............................................................................................................... + void processFDD(aod::FDDs const& fdds, BCs const&) + { + // LOGF(debug, " %d", fdds.size()); + + for (auto const& fdd : fdds) { + + registry.get(HIST("FDD/hFDDA"))->Fill(fdd.timeA()); + registry.get(HIST("FDD/hFDDC"))->Fill(fdd.timeC()); + // side A + int maxInd = 8; + for (auto ind = 0; ind < maxInd; ind++) { + registry.get(HIST("FDD/FDDA"))->Fill(ind, (fdd.chargeA())[ind]); + } + + // side C + for (auto ind = 0; ind < maxInd; ind++) { + registry.get(HIST("FDD/FDDC"))->Fill(ind, (fdd.chargeC())[ind]); + } + } + }; + PROCESS_SWITCH(UdQcMuon, processFDD, "Process FDD", true); + + // ............................................................................................................... + void processZDC(aod::Zdc const& zdc) + { + // LOGF(debug, " %d", zdc.size()); + + // Zdc energies + registry.get(HIST("ZdcEnergies"))->Fill(0., zdc.energyZEM1()); + registry.get(HIST("ZdcEnergies"))->Fill(1., zdc.energyZEM2()); + registry.get(HIST("ZdcEnergies"))->Fill(2., zdc.energyCommonZNA()); + registry.get(HIST("ZdcEnergies"))->Fill(3., zdc.energyCommonZNC()); + registry.get(HIST("ZdcEnergies"))->Fill(4., zdc.energyCommonZPA()); + registry.get(HIST("ZdcEnergies"))->Fill(5., zdc.energyCommonZPC()); + registry.get(HIST("ZdcEnergies"))->Fill(6., (zdc.energySectorZNA())[0]); + registry.get(HIST("ZdcEnergies"))->Fill(7., (zdc.energySectorZNA())[1]); + registry.get(HIST("ZdcEnergies"))->Fill(8., (zdc.energySectorZNA())[2]); + registry.get(HIST("ZdcEnergies"))->Fill(9., (zdc.energySectorZNA())[3]); + registry.get(HIST("ZdcEnergies"))->Fill(10., (zdc.energySectorZNC())[0]); + registry.get(HIST("ZdcEnergies"))->Fill(11., (zdc.energySectorZNC())[1]); + registry.get(HIST("ZdcEnergies"))->Fill(12., (zdc.energySectorZNC())[2]); + registry.get(HIST("ZdcEnergies"))->Fill(13., (zdc.energySectorZNC())[3]); + registry.get(HIST("ZdcEnergies"))->Fill(14., (zdc.energySectorZPA())[0]); + registry.get(HIST("ZdcEnergies"))->Fill(15., (zdc.energySectorZPA())[1]); + registry.get(HIST("ZdcEnergies"))->Fill(16., (zdc.energySectorZPA())[2]); + registry.get(HIST("ZdcEnergies"))->Fill(17., (zdc.energySectorZPA())[3]); + registry.get(HIST("ZdcEnergies"))->Fill(18., (zdc.energySectorZPC())[0]); + registry.get(HIST("ZdcEnergies"))->Fill(19., (zdc.energySectorZPC())[1]); + registry.get(HIST("ZdcEnergies"))->Fill(20., (zdc.energySectorZPC())[2]); + registry.get(HIST("ZdcEnergies"))->Fill(21., (zdc.energySectorZPC())[3]); + }; + PROCESS_SWITCH(UdQcMuon, processZDC, "Process ZDC", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc), + }; +} From 85d2fe5769fe8dec4c876053d7f5948ca20b1fdb Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Tue, 30 Sep 2025 07:04:04 +0200 Subject: [PATCH 573/986] [PWGEM/Dilepton] add possibility to select phiPosition (#13166) --- PWGEM/Dilepton/Core/DielectronCut.cxx | 10 +++ PWGEM/Dilepton/Core/DielectronCut.h | 39 ++++++++++-- PWGEM/Dilepton/Core/Dilepton.h | 6 +- PWGEM/Dilepton/Core/DileptonMC.h | 4 ++ PWGEM/Dilepton/Core/SingleTrackQC.h | 50 ++++++++++++++- PWGEM/Dilepton/Core/SingleTrackQCMC.h | 64 ++++++++++++++++++++ PWGEM/Dilepton/Tasks/createResolutionMap.cxx | 2 +- 7 files changed, 168 insertions(+), 7 deletions(-) diff --git a/PWGEM/Dilepton/Core/DielectronCut.cxx b/PWGEM/Dilepton/Core/DielectronCut.cxx index 5d943b77651..b5ecd733985 100644 --- a/PWGEM/Dilepton/Core/DielectronCut.cxx +++ b/PWGEM/Dilepton/Core/DielectronCut.cxx @@ -100,6 +100,16 @@ void DielectronCut::SetTrackPhiRange(float minPhi, float maxPhi, bool mirror, bo mRejectTrackPhi = reject; LOG(info) << "Dielectron Cut, set track phi range (rad.): " << mMinTrackPhi << " - " << mMaxTrackPhi << " with mirror: " << mMirrorTrackPhi << " and rejection: " << mRejectTrackPhi; } +void DielectronCut::SetTrackPhiPositionRange(float minPhi, float maxPhi, float refR, float bz, bool mirror) +{ + mMinTrackPhiPosition = minPhi; + mMaxTrackPhiPosition = maxPhi; + mRefR = refR; + mBz = bz; + mMirrorTrackPhi = mirror; + LOG(info) << "Dielectron Cut, set track phi position range (rad.): " << mMinTrackPhiPosition << " - " << mMaxTrackPhiPosition << " at Rxy = " << mRefR << " with mirror: " << mMirrorTrackPhi; + LOG(info) << "Dielectron Cut, set Bz in kG: " << mBz; +} void DielectronCut::SetMinNClustersTPC(int minNClustersTPC) { mMinNClustersTPC = minNClustersTPC; diff --git a/PWGEM/Dilepton/Core/DielectronCut.h b/PWGEM/Dilepton/Core/DielectronCut.h index c92ebb2880f..d2be7327be8 100644 --- a/PWGEM/Dilepton/Core/DielectronCut.h +++ b/PWGEM/Dilepton/Core/DielectronCut.h @@ -54,6 +54,7 @@ class DielectronCut : public TNamed kTrackPtRange, kTrackEtaRange, kTrackPhiRange, + kTrackPhiPositionRange, kTPCNCls, kTPCCrossedRows, kTPCCrossedRowsOverNCls, @@ -181,6 +182,9 @@ class DielectronCut : public TNamed if (!IsSelectedTrack(track, DielectronCuts::kTrackPhiRange)) { return false; } + if (!IsSelectedTrack(track, DielectronCuts::kTrackPhiPositionRange)) { + return false; + } if (!IsSelectedTrack(track, DielectronCuts::kDCA3Dsigma)) { return false; } @@ -404,6 +408,29 @@ class DielectronCut : public TNamed return mRejectTrackPhi ? !is_in_phi_range : is_in_phi_range; } + case DielectronCuts::kTrackPhiPositionRange: { + float phiPosition = track.phi() + std::asin(-0.30282 * track.sign() * (mBz * 0.1) * mRefR / (2.f * track.pt())); + + if (mMinTrackPhiPosition < 0.f && mMaxTrackPhiPosition < M_PI) { // threshold across 0 rad. + o2::math_utils::bringToPMPi(phiPosition); + bool isInAcc = mMinTrackPhiPosition < phiPosition && phiPosition < mMaxTrackPhiPosition; + bool isInAccMirrored = false; + if (mMirrorTrackPhi) { + o2::math_utils::bringTo02Pi(phiPosition); + isInAccMirrored = mMinTrackPhiPosition + M_PI < phiPosition && phiPosition < mMaxTrackPhiPosition + M_PI; + } + return isInAcc || isInAccMirrored; + } else { + o2::math_utils::bringTo02Pi(phiPosition); + bool isInAcc = mMinTrackPhiPosition < phiPosition && phiPosition < mMaxTrackPhiPosition; + bool isInAccMirrored = false; + if (mMirrorTrackPhi) { + isInAccMirrored = mMinTrackPhiPosition + M_PI < phiPosition && phiPosition < mMaxTrackPhiPosition + M_PI; + } + return isInAcc || isInAccMirrored; + } + } + case DielectronCuts::kTPCNCls: return track.tpcNClsFound() >= mMinNClustersTPC; @@ -462,6 +489,7 @@ class DielectronCut : public TNamed void SetTrackPtRange(float minPt = 0.f, float maxPt = 1e10f); void SetTrackEtaRange(float minEta = -1e10f, float maxEta = 1e10f); void SetTrackPhiRange(float minPhi = 0.f, float maxPhi = 2.f * M_PI, bool mirror = false, bool reject = false); + void SetTrackPhiPositionRange(float minPhi, float maxPhi, float refR, float bz, bool mirror); void SetMinNClustersTPC(int minNClustersTPC); void SetMinNCrossedRowsTPC(int minNCrossedRowsTPC); void SetMinNCrossedRowsOverFindableClustersTPC(float minNCrossedRowsOverFindableClustersTPC); @@ -547,10 +575,13 @@ class DielectronCut : public TNamed bool mRequireDiffSides{false}; // flag to require 2 tracks to be from different sides. (A-C combination). If one wants 2 tracks to be in the same side (A-A or C-C), one can simply use track eta cut. // kinematic cuts - float mMinTrackPt{0.f}, mMaxTrackPt{1e10f}; // range in pT - float mMinTrackEta{-1e10f}, mMaxTrackEta{1e10f}; // range in eta - float mMinTrackPhi{0.f}, mMaxTrackPhi{2.f * M_PI}; // range in phi - bool mMirrorTrackPhi{false}, mRejectTrackPhi{false}; // phi cut mirror by Pi, rejected/accepted + float mMinTrackPt{0.f}, mMaxTrackPt{1e10f}; // range in pT + float mMinTrackEta{-1e10f}, mMaxTrackEta{1e10f}; // range in eta + float mMinTrackPhi{0.f}, mMaxTrackPhi{2.f * M_PI}; // range in phi + float mMinTrackPhiPosition{0.f}, mMaxTrackPhiPosition{2.f * M_PI}; // range in phi + bool mMirrorTrackPhi{false}, mRejectTrackPhi{false}; // phi cut mirror by Pi, rejected/accepted + float mRefR{0.5}; // reference radius in m + float mBz{0.0}; // solenoid magnetic field along Z in kG // track quality cuts int mMinNClustersTPC{0}; // min number of TPC clusters diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 21e2f3c250a..35d165aaa1b 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -219,6 +219,9 @@ struct Dilepton { Configurable cfg_max_its_cluster_size{"cfg_max_its_cluster_size", 16.f, "max ITS cluster size"}; Configurable cfg_min_rel_diff_pin{"cfg_min_rel_diff_pin", -1e+10, "min rel. diff. between pin and ppv"}; Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; + Configurable cfgRefR{"cfgRefR", 0.50, "ref. radius (m) for calculating phi position"}; // 0.50 +/- 0.06 can be syst. unc. + Configurable cfg_min_phiposition_track{"cfg_min_phiposition_track", 0.f, "min phi position for single track at certain radius"}; + Configurable cfg_max_phiposition_track{"cfg_max_phiposition_track", 6.3, "max phi position for single track at certain radius"}; Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif : 4, kPIDML : 5, kTPChadrejORTOFreq_woTOFif : 6]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; @@ -302,7 +305,7 @@ struct Dilepton { Service ccdb; int mRunNumber; float d_bz; - o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; + // o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; static constexpr std::string_view event_cut_types[2] = {"before/", "after/"}; @@ -486,6 +489,7 @@ struct Dilepton { LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kG"; } mRunNumber = collision.runNumber(); + fDielectronCut.SetTrackPhiPositionRange(dielectroncuts.cfg_min_phiposition_track, dielectroncuts.cfg_max_phiposition_track, dielectroncuts.cfgRefR, d_bz, dielectroncuts.cfg_mirror_phi_track); auto grplhcif = ccdb->getForTimeStamp("GLO/Config/GRPLHCIF", collision.timestamp()); int beamZ1 = grplhcif->getBeamZ(o2::constants::lhc::BeamC); diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index 5a186d01f4e..60745eb9917 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -214,6 +214,9 @@ struct DileptonMC { Configurable cfg_max_its_cluster_size{"cfg_max_its_cluster_size", 16.f, "max ITS cluster size"}; Configurable cfg_min_rel_diff_pin{"cfg_min_rel_diff_pin", -1e+10, "min rel. diff. between pin and ppv"}; Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; + Configurable cfgRefR{"cfgRefR", 0.50, "ref. radius (m) for calculating phi position"}; // 0.50 +/- 0.06 can be syst. unc. + Configurable cfg_min_phiposition_track{"cfg_min_phiposition_track", 0.f, "min phi position for single track at certain radius"}; + Configurable cfg_max_phiposition_track{"cfg_max_phiposition_track", 6.3, "max phi position for single track at certain radius"}; Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif = 4, kPIDML = 5]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; @@ -609,6 +612,7 @@ struct DileptonMC { LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kG"; } mRunNumber = collision.runNumber(); + fDielectronCut.SetTrackPhiPositionRange(dielectroncuts.cfg_min_phiposition_track, dielectroncuts.cfg_max_phiposition_track, dielectroncuts.cfgRefR, d_bz, dielectroncuts.cfg_mirror_phi_track); //// for muon // o2::base::Propagator::initFieldFromGRP(grpmag); diff --git a/PWGEM/Dilepton/Core/SingleTrackQC.h b/PWGEM/Dilepton/Core/SingleTrackQC.h index e9c4b031e15..b9949e7b2d3 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQC.h @@ -33,6 +33,7 @@ #include "DataFormatsParameters/GRPMagField.h" #include "DataFormatsParameters/GRPObject.h" #include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" @@ -55,7 +56,7 @@ using namespace o2::aod::pwgem::dilepton::utils::emtrackutil; using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; -using MyCollisionsWithSWT = soa::Join; +using MyCollisionsWithSWT = soa::Join; using MyCollisionWithSWT = MyCollisionsWithSWT::iterator; using MyElectrons = soa::Join; @@ -73,6 +74,10 @@ struct SingleTrackQC { // Configurables Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; + Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; + Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; Configurable cfgCentMin{"cfgCentMin", -1, "min. centrality"}; @@ -146,6 +151,9 @@ struct SingleTrackQC { Configurable cfg_max_its_cluster_size{"cfg_max_its_cluster_size", 16.f, "max ITS cluster size"}; Configurable cfg_min_rel_diff_pin{"cfg_min_rel_diff_pin", -1e+10, "min rel. diff. between pin and ppv"}; Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; + Configurable cfgRefR{"cfgRefR", 0.50, "ref. radius (m) for calculating phi position"}; // 0.50 +/- 0.06 can be syst. unc. + Configurable cfg_min_phiposition_track{"cfg_min_phiposition_track", 0.f, "min phi position for single track at certain radius"}; + Configurable cfg_max_phiposition_track{"cfg_max_phiposition_track", 6.3, "max phi position for single track at certain radius"}; Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif = 4, kPIDML = 5]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; @@ -231,12 +239,14 @@ struct SingleTrackQC { const AxisSpec axis_pt{ConfPtlBins, "p_{T,e} (GeV/c)"}; const AxisSpec axis_eta{20, -1.0, +1.0, "#eta_{e}"}; const AxisSpec axis_phi{36, 0.0, 2 * M_PI, "#varphi_{e} (rad.)"}; + const AxisSpec axis_phiposition{36, 0.0, 2 * M_PI, "#varphi_{e}^{*} (rad.)"}; const AxisSpec axis_dca3D{ConfDCA3DBins, "DCA_{e}^{3D} (#sigma)"}; const AxisSpec axis_dcaXY{ConfDCAXYBins, "DCA_{e}^{XY} (#sigma)"}; const AxisSpec axis_dcaZ{ConfDCAZBins, "DCA_{e}^{Z} (#sigma)"}; // track info fRegistry.add("Track/positive/hs", "rec. single electron", kTHnSparseD, {axis_pt, axis_eta, axis_phi, axis_dca3D, axis_dcaXY, axis_dcaZ}, true); + fRegistry.add("Track/positive/hPhiPosition", Form("phi position at r_{xy} = %3.2f m", dielectroncuts.cfgRefR.value), kTH1F, {axis_phiposition}, false); fRegistry.add("Track/positive/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{4000, -20, 20}}, false); fRegistry.add("Track/positive/hDCAxyz", "DCA xy vs. z;DCA_{xy} (cm);DCA_{z} (cm)", kTH2F, {{200, -1.0f, 1.0f}, {200, -1.f, 1.f}}, false); fRegistry.add("Track/positive/hDCAxyzSigma", "DCA xy vs. z;DCA_{xy} (#sigma);DCA_{z} (#sigma)", kTH2F, {{400, -20.0f, 20.0f}, {400, -20.0f, 20.0f}}, false); @@ -309,6 +319,7 @@ struct SingleTrackQC { } int mRunNumber; + float d_bz; void init(InitContext&) { ccdb->setURL(ccdburl); @@ -322,6 +333,7 @@ struct SingleTrackQC { DefineDimuonCut(); addhistograms(); mRunNumber = 0; + d_bz = 0; if (doprocessNorm) { fRegistry.addClone("Event/before/hCollisionCounter", "Event/norm/hCollisionCounter"); @@ -352,8 +364,40 @@ struct SingleTrackQC { if (mRunNumber == collision.runNumber()) { return; } + if (d_bz_input > -990) { + d_bz = d_bz_input; + o2::parameters::GRPMagField grpmag; + if (std::fabs(d_bz) > 1e-5) { + grpmag.setL3Current(30000.f / (d_bz / 5.0f)); + } + o2::base::Propagator::initFieldFromGRP(&grpmag); + mRunNumber = collision.runNumber(); + return; + } + + auto run3grp_timestamp = collision.timestamp(); + o2::parameters::GRPObject* grpo = 0x0; + o2::parameters::GRPMagField* grpmag = 0x0; + if (!skipGRPOquery) + grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); + if (grpo) { + o2::base::Propagator::initFieldFromGRP(grpo); + // Fetch magnetic field from ccdb for current collision + d_bz = grpo->getNominalL3Field(); + LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kG"; + } else { + grpmag = ccdb->getForTimeStamp(grpmagPath, run3grp_timestamp); + if (!grpmag) { + LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp; + } + o2::base::Propagator::initFieldFromGRP(grpmag); + // Fetch magnetic field from ccdb for current collision + d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); + LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kG"; + } mRunNumber = collision.runNumber(); + fDielectronCut.SetTrackPhiPositionRange(dielectroncuts.cfg_min_phiposition_track, dielectroncuts.cfg_max_phiposition_track, dielectroncuts.cfgRefR, d_bz, dielectroncuts.cfg_mirror_phi_track); } void DefineEMEventCut() @@ -489,9 +533,12 @@ struct SingleTrackQC { float dca3D = dca3DinSigma(track); float dcaXY = dcaXYinSigma(track); float dcaZ = dcaZinSigma(track); + float phiPosition = track.phi() + std::asin(-0.30282 * track.sign() * (d_bz * 0.1) * dielectroncuts.cfgRefR / (2.f * track.pt())); + o2::math_utils::bringTo02Pi(phiPosition); if (track.sign() > 0) { fRegistry.fill(HIST("Track/positive/hs"), track.pt(), track.eta(), track.phi(), dca3D, dcaXY, dcaZ, weight); + fRegistry.fill(HIST("Track/positive/hPhiPosition"), phiPosition); fRegistry.fill(HIST("Track/positive/hQoverPt"), track.sign() / track.pt()); fRegistry.fill(HIST("Track/positive/hDCAxyz"), track.dcaXY(), track.dcaZ()); fRegistry.fill(HIST("Track/positive/hDCAxyzSigma"), dcaXY, dcaZ); @@ -535,6 +582,7 @@ struct SingleTrackQC { // fRegistry.fill(HIST("Track/positive/hITSNsigmaPr"), track.p(), track.itsNSigmaPr()); } else { fRegistry.fill(HIST("Track/negative/hs"), track.pt(), track.eta(), track.phi(), dca3D, dcaXY, dcaZ, weight); + fRegistry.fill(HIST("Track/negative/hPhiPosition"), phiPosition); fRegistry.fill(HIST("Track/negative/hQoverPt"), track.sign() / track.pt()); fRegistry.fill(HIST("Track/negative/hDCAxyz"), track.dcaXY(), track.dcaZ()); fRegistry.fill(HIST("Track/negative/hDCAxyzSigma"), dcaXY, dcaZ); diff --git a/PWGEM/Dilepton/Core/SingleTrackQCMC.h b/PWGEM/Dilepton/Core/SingleTrackQCMC.h index 97408d7c25c..573bdc686d0 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQCMC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQCMC.h @@ -34,6 +34,7 @@ #include "DataFormatsParameters/GRPMagField.h" #include "DataFormatsParameters/GRPObject.h" #include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" @@ -79,6 +80,10 @@ struct SingleTrackQCMC { // Configurables Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; + Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; + Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; Configurable cfgEventGeneratorType{"cfgEventGeneratorType", -1, "if positive, select event generator type. i.e. gap or signal"}; Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; @@ -153,6 +158,9 @@ struct SingleTrackQCMC { Configurable cfg_max_its_cluster_size{"cfg_max_its_cluster_size", 16.f, "max ITS cluster size"}; Configurable cfg_min_rel_diff_pin{"cfg_min_rel_diff_pin", -1e+10, "min rel. diff. between pin and ppv"}; Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; + Configurable cfgRefR{"cfgRefR", 0.50, "ref. radius (m) for calculating phi position"}; // 0.50 +/- 0.06 can be syst. unc. + Configurable cfg_min_phiposition_track{"cfg_min_phiposition_track", 0.f, "min phi position for single track at certain radius"}; + Configurable cfg_max_phiposition_track{"cfg_max_phiposition_track", 6.3, "max phi position for single track at certain radius"}; Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif = 4, kPIDML = 5]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; @@ -250,6 +258,7 @@ struct SingleTrackQCMC { const AxisSpec axis_pt{ConfPtlBins, "p_{T,e} (GeV/c)"}; const AxisSpec axis_eta{20, -1.0, +1.0, "#eta_{e}"}; const AxisSpec axis_phi{36, 0.0, 2 * M_PI, "#varphi_{e} (rad.)"}; + const AxisSpec axis_phiposition{36, 0.0, 2 * M_PI, "#varphi_{e}^{*} (rad.)"}; const AxisSpec axis_charge_gen{3, -1.5, +1.5, "true charge"}; const AxisSpec axis_dca3D{ConfDCA3DBins, "DCA_{e}^{3D} (#sigma)"}; const AxisSpec axis_dcaXY{ConfDCAXYBins, "DCA_{e}^{XY} (#sigma)"}; @@ -272,6 +281,7 @@ struct SingleTrackQCMC { fRegistry.add("Track/lf/positive/hsGenRec", "rec. single electron", kTHnSparseD, {axis_pt, axis_eta, axis_phi, axis_dca3D, axis_dcaXY, axis_dcaZ, axis_charge_gen}, true); } if (cfgFillQA) { + fRegistry.add("Track/lf/positive/hPhiPosition", Form("phi position at r_{xy} = %3.2f m", dielectroncuts.cfgRefR.value), kTH1F, {axis_phiposition}, false); fRegistry.add("Track/lf/positive/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{4000, -20, 20}}, false); fRegistry.add("Track/lf/positive/hDCAxyz", "DCA xy vs. z;DCA_{xy} (cm);DCA_{z} (cm)", kTH2F, {{200, -1.0f, 1.0f}, {200, -1.f, 1.f}}, false); fRegistry.add("Track/lf/positive/hDCAxyzSigma", "DCA xy vs. z;DCA_{xy} (#sigma);DCA_{z} (#sigma)", kTH2F, {{400, -20.0f, 20.0f}, {400, -20.0f, 20.0f}}, false); @@ -397,6 +407,9 @@ struct SingleTrackQCMC { fillGenValuesForRec = true; } + mRunNumber = 0; + d_bz = 0; + ccdb->setURL(ccdburl); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); @@ -427,6 +440,51 @@ struct SingleTrackQCMC { } } + int mRunNumber; + float d_bz; + + template + void initCCDB(TCollision const& collision) + { + if (mRunNumber == collision.runNumber()) { + return; + } + if (d_bz_input > -990) { + d_bz = d_bz_input; + o2::parameters::GRPMagField grpmag; + if (std::fabs(d_bz) > 1e-5) { + grpmag.setL3Current(30000.f / (d_bz / 5.0f)); + } + o2::base::Propagator::initFieldFromGRP(&grpmag); + mRunNumber = collision.runNumber(); + return; + } + + auto run3grp_timestamp = collision.timestamp(); + o2::parameters::GRPObject* grpo = 0x0; + o2::parameters::GRPMagField* grpmag = 0x0; + if (!skipGRPOquery) + grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); + if (grpo) { + o2::base::Propagator::initFieldFromGRP(grpo); + // Fetch magnetic field from ccdb for current collision + d_bz = grpo->getNominalL3Field(); + LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kG"; + } else { + grpmag = ccdb->getForTimeStamp(grpmagPath, run3grp_timestamp); + if (!grpmag) { + LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp; + } + o2::base::Propagator::initFieldFromGRP(grpmag); + // Fetch magnetic field from ccdb for current collision + d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); + LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kG"; + } + + mRunNumber = collision.runNumber(); + fDielectronCut.SetTrackPhiPositionRange(dielectroncuts.cfg_min_phiposition_track, dielectroncuts.cfg_max_phiposition_track, dielectroncuts.cfgRefR, d_bz, dielectroncuts.cfg_mirror_phi_track); + } + void DefineEMEventCut() { fEMEventCut = EMEventCut("fEMEventCut", "fEMEventCut"); @@ -598,6 +656,8 @@ struct SingleTrackQCMC { float dca3D = dca3DinSigma(track); float dcaXY = dcaXYinSigma(track); float dcaZ = dcaZinSigma(track); + float phiPosition = track.phi() + std::asin(-0.30282 * track.sign() * (d_bz * 0.1) * dielectroncuts.cfgRefR / (2.f * track.pt())); + o2::math_utils::bringTo02Pi(phiPosition); float weight = 1.f; if (cfgApplyWeightTTCA) { @@ -615,6 +675,7 @@ struct SingleTrackQCMC { fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hsGenRec"), mctrack.pt(), mctrack.eta(), mctrack.phi(), dca3D, dcaXY, dcaZ, -mctrack.pdgCode() / pdg_lepton, weight); } if (cfgFillQA) { + fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hPhiPosition"), phiPosition); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hQoverPt"), track.sign() / track.pt()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hDCAxyz"), track.dcaXY(), track.dcaZ()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hDCAxyzSigma"), dcaXY, dcaZ); @@ -668,6 +729,7 @@ struct SingleTrackQCMC { fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hsGenRec"), mctrack.pt(), mctrack.eta(), mctrack.phi(), dca3D, dcaXY, dcaZ, -mctrack.pdgCode() / pdg_lepton, weight); } if (cfgFillQA) { + fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hPhiPosition"), phiPosition); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hQoverPt"), track.sign() / track.pt()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hDCAxyz"), track.dcaXY(), track.dcaZ()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hDCAxyzSigma"), dcaXY, dcaZ); @@ -789,6 +851,7 @@ struct SingleTrackQCMC { void runQCMC(TCollisions const& collisions, TTracks const& tracks, TPreslice const& perCollision, TCut const& cut, TMCCollisions const&, TMCParticles const& mcparticles) { for (const auto& collision : collisions) { + initCCDB(collision); float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; @@ -998,6 +1061,7 @@ struct SingleTrackQCMC { std::vector passed_trackIds; passed_trackIds.reserve(tracks.size()); for (const auto& collision : collisions) { + initCCDB(collision); float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; diff --git a/PWGEM/Dilepton/Tasks/createResolutionMap.cxx b/PWGEM/Dilepton/Tasks/createResolutionMap.cxx index 49b3b521640..482c78314ef 100644 --- a/PWGEM/Dilepton/Tasks/createResolutionMap.cxx +++ b/PWGEM/Dilepton/Tasks/createResolutionMap.cxx @@ -78,7 +78,7 @@ struct CreateResolutionMap { ConfigurableAxis ConfEtaCBGenBins{"ConfEtaCBGenBins", {30, -1.5, +1.5}, "gen. eta bins at midrapidity for output histograms"}; ConfigurableAxis ConfEtaFWDGenBins{"ConfEtaFWDGenBins", {40, -5.5, -1.5}, "gen. eta bins at forward rapidity for output histograms"}; - ConfigurableAxis ConfPhiGenBins{"ConfPhiGenBins", {72, 0, 2.f * M_PI}, "gen. phi bins at forward rapidity for output histograms"}; + ConfigurableAxis ConfPhiGenBins{"ConfPhiGenBins", {36, 0, 2.f * M_PI}, "gen. phi bins at forward rapidity for output histograms"}; ConfigurableAxis ConfPhiPositionCBGenBins{"ConfPhiPositionCBGenBins", {VARIABLE_WIDTH, 2.3 - M_PI, 0.85, 2.3, 0.85 + M_PI, 2.3 + M_PI}, "gen. phi psotion bins at forward rapidity for output histograms"}; // default is adjusted at R = 0.50 m ConfigurableAxis ConfPhiPositionFWDGenBins{"ConfPhiPositionFWDGenBins", {1, 0, 2 * M_PI}, "gen. phi psotion bins at forward rapidity for output histograms"}; Configurable cfgRefR{"cfgRefR", 0.50, "ref. radius (m) for calculating phi position"}; // 0.50 +/- 0.06 can be syst. unc. From b65a0042924d260f6360ef813fd652c22464e4eb Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Tue, 30 Sep 2025 11:56:18 +0200 Subject: [PATCH 574/986] [PWGEM/Dilepton] update electron table 005 (#13169) --- PWGEM/Dilepton/DataModel/dileptonTables.h | 35 +++- .../TableProducer/skimmerPrimaryElectron.cxx | 2 +- .../skimmerPrimaryElectronQC.cxx | 2 +- .../Dilepton/Tasks/Converters/CMakeLists.txt | 5 + .../Tasks/Converters/electronConverter5.cxx | 171 ++++++++++++++++++ 5 files changed, 212 insertions(+), 3 deletions(-) create mode 100644 PWGEM/Dilepton/Tasks/Converters/electronConverter5.cxx diff --git a/PWGEM/Dilepton/DataModel/dileptonTables.h b/PWGEM/Dilepton/DataModel/dileptonTables.h index c19b5baa653..9d03b354d77 100644 --- a/PWGEM/Dilepton/DataModel/dileptonTables.h +++ b/PWGEM/Dilepton/DataModel/dileptonTables.h @@ -599,7 +599,40 @@ DECLARE_SOA_TABLE_VERSIONED(EMPrimaryElectrons_004, "AOD", "EMPRIMARYEL", 4, //! emprimaryelectron::MeanClusterSizeITSib, emprimaryelectron::MeanClusterSizeITSob); -using EMPrimaryElectrons = EMPrimaryElectrons_004; +DECLARE_SOA_TABLE_VERSIONED(EMPrimaryElectrons_005, "AOD", "EMPRIMARYEL", 5, //! + o2::soa::Index<>, emprimaryelectron::CollisionId, + emprimaryelectron::TrackId, emprimaryelectron::Sign, + track::Pt, track::Eta, track::Phi, + track::DcaXY, track::DcaZ, aod::track::CYY, aod::track::CZY, aod::track::CZZ, + track::TPCNClsFindable, track::TPCNClsFindableMinusFound, track::TPCNClsFindableMinusPID, track::TPCNClsFindableMinusCrossedRows, track::TPCNClsShared, + track::TPCChi2NCl, track::TPCInnerParam, + track::TPCSignal, pidtpc::TPCNSigmaEl, pidtpc::TPCNSigmaPi, pidtpc::TPCNSigmaKa, pidtpc::TPCNSigmaPr, + pidtofbeta::Beta, pidtof::TOFNSigmaEl, /*pidtof::TOFNSigmaPi, pidtof::TOFNSigmaKa, pidtof::TOFNSigmaPr,*/ + track::ITSClusterSizes, track::ITSChi2NCl, track::TOFChi2, track::DetectorMap, /*track::Tgl,*/ + emprimaryelectron::IsAssociatedToMPC, emprimaryelectron::IsAmbiguous, emprimaryelectron::ProbElBDT, + mcpidtpc::DeDxTunedMc, + + // dynamic column + track::TPCNClsFound, + track::TPCNClsPID, + track::TPCNClsCrossedRows, + track::TPCCrossedRowsOverFindableCls, + track::TPCFoundOverFindableCls, + track::TPCFractionSharedCls, + track::v001::ITSClusterMap, track::v001::ITSNCls, track::v001::ITSNClsInnerBarrel, + track::HasITS, track::HasTPC, track::HasTRD, track::HasTOF, + + emprimaryelectron::Signed1Pt, + emprimaryelectron::P, + emprimaryelectron::Px, + emprimaryelectron::Py, + emprimaryelectron::Pz, + emprimaryelectron::Tgl, + emprimaryelectron::MeanClusterSizeITS, + emprimaryelectron::MeanClusterSizeITSib, + emprimaryelectron::MeanClusterSizeITSob); + +using EMPrimaryElectrons = EMPrimaryElectrons_005; // iterators using EMPrimaryElectron = EMPrimaryElectrons::iterator; diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx index c96c0233baa..d2370fe0936 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx @@ -483,7 +483,7 @@ struct skimmerPrimaryElectron { emprimaryelectrons(collision.globalIndex(), track.globalIndex(), track.sign(), pt_recalc, eta_recalc, phi_recalc, dcaXY, dcaZ, trackParCov.getSigmaY2(), trackParCov.getSigmaZY(), trackParCov.getSigmaZ2(), - track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), track.tpcNClsShared(), + track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusPID(), track.tpcNClsFindableMinusCrossedRows(), track.tpcNClsShared(), track.tpcChi2NCl(), track.tpcInnerParam(), track.tpcSignal(), track.tpcNSigmaEl(), track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), track.beta(), track.tofNSigmaEl(), /*track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(),*/ diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx index 58cc23c5606..7edde399dbe 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx @@ -481,7 +481,7 @@ struct skimmerPrimaryElectronQC { emprimaryelectrons(collision.globalIndex(), track.globalIndex(), track.sign(), pt_recalc, eta_recalc, phi_recalc, dcaXY, dcaZ, trackParCov.getSigmaY2(), trackParCov.getSigmaZY(), trackParCov.getSigmaZ2(), - track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), track.tpcNClsShared(), + track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusPID(), track.tpcNClsFindableMinusCrossedRows(), track.tpcNClsShared(), track.tpcChi2NCl(), track.tpcInnerParam(), track.tpcSignal(), track.tpcNSigmaEl(), track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), track.beta(), track.tofNSigmaEl(), /*track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(),*/ diff --git a/PWGEM/Dilepton/Tasks/Converters/CMakeLists.txt b/PWGEM/Dilepton/Tasks/Converters/CMakeLists.txt index f5f41c009cd..b41943ef7ff 100644 --- a/PWGEM/Dilepton/Tasks/Converters/CMakeLists.txt +++ b/PWGEM/Dilepton/Tasks/Converters/CMakeLists.txt @@ -35,6 +35,11 @@ o2physics_add_dpl_workflow(electron-converter4 PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(electron-converter5 + SOURCES electronConverter5.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(track-converter1 SOURCES trackConverter1.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore diff --git a/PWGEM/Dilepton/Tasks/Converters/electronConverter5.cxx b/PWGEM/Dilepton/Tasks/Converters/electronConverter5.cxx new file mode 100644 index 00000000000..58df0fce179 --- /dev/null +++ b/PWGEM/Dilepton/Tasks/Converters/electronConverter5.cxx @@ -0,0 +1,171 @@ +// 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. +// +// ======================== +// +// This code runs loop over ULS ee pars for virtual photon QC. +// Please write to: daiki.sekihata@cern.ch + +#include "PWGEM/Dilepton/DataModel/dileptonTables.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +using namespace o2; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; + +struct electronConverter5 { + Produces track_005; + + using MyElectrons002 = soa::Join; + void process002to005(MyElectrons002 const& tracks) + { + for (const auto& track : tracks) { + track_005(track.collisionId(), + track.trackId(), + track.sign(), + track.pt(), + track.eta(), + track.phi(), + track.dcaXY(), + track.dcaZ(), + track.cYY(), + track.cZY(), + track.cZZ(), + track.tpcNClsFindable(), + track.tpcNClsFindableMinusFound(), + 0, + track.tpcNClsFindableMinusCrossedRows(), + track.tpcNClsShared(), + track.tpcChi2NCl(), + track.tpcInnerParam(), + track.tpcSignal(), + track.tpcNSigmaEl(), + track.tpcNSigmaPi(), + track.tpcNSigmaKa(), + track.tpcNSigmaPr(), + track.beta(), + track.tofNSigmaEl(), + // track.tofNSigmaPi(), + // track.tofNSigmaKa(), + // track.tofNSigmaPr(), + track.itsClusterSizes(), + track.itsChi2NCl(), + track.tofChi2(), + track.detectorMap(), + // track.tgl(), + track.isAssociatedToMPC(), + false, + 0.f, + 0.f); + } // end of track loop + } + PROCESS_SWITCH(electronConverter5, process002to005, "convert from 002 into 005", false); + + using MyElectrons003 = soa::Join; + void process003to005(MyElectrons003 const& tracks) + { + for (const auto& track : tracks) { + track_005(track.collisionId(), + track.trackId(), + track.sign(), + track.pt(), + track.eta(), + track.phi(), + track.dcaXY(), + track.dcaZ(), + track.cYY(), + track.cZY(), + track.cZZ(), + track.tpcNClsFindable(), + track.tpcNClsFindableMinusFound(), + 0, + track.tpcNClsFindableMinusCrossedRows(), + track.tpcNClsShared(), + track.tpcChi2NCl(), + track.tpcInnerParam(), + track.tpcSignal(), + track.tpcNSigmaEl(), + track.tpcNSigmaPi(), + track.tpcNSigmaKa(), + track.tpcNSigmaPr(), + track.beta(), + track.tofNSigmaEl(), + // track.tofNSigmaPi(), + // track.tofNSigmaKa(), + // track.tofNSigmaPr(), + track.itsClusterSizes(), + track.itsChi2NCl(), + track.tofChi2(), + track.detectorMap(), + // track.tgl(), + track.isAssociatedToMPC(), + false, + 0.f, + track.mcTunedTPCSignal()); + } // end of track loop + } + PROCESS_SWITCH(electronConverter5, process003to005, "convert from 003 into 005", false); + + using MyElectrons004 = soa::Join; + void process004to005(MyElectrons004 const& tracks) + { + for (const auto& track : tracks) { + track_005(track.collisionId(), + track.trackId(), + track.sign(), + track.pt(), + track.eta(), + track.phi(), + track.dcaXY(), + track.dcaZ(), + track.cYY(), + track.cZY(), + track.cZZ(), + track.tpcNClsFindable(), + track.tpcNClsFindableMinusFound(), + 0, + track.tpcNClsFindableMinusCrossedRows(), + track.tpcNClsShared(), + track.tpcChi2NCl(), + track.tpcInnerParam(), + track.tpcSignal(), + track.tpcNSigmaEl(), + track.tpcNSigmaPi(), + track.tpcNSigmaKa(), + track.tpcNSigmaPr(), + track.beta(), + track.tofNSigmaEl(), + // track.tofNSigmaPi(), + // track.tofNSigmaKa(), + // track.tofNSigmaPr(), + track.itsClusterSizes(), + track.itsChi2NCl(), + track.tofChi2(), + track.detectorMap(), + // track.tgl(), + track.isAssociatedToMPC(), + track.isAmbiguous(), + track.probElBDT(), + track.mcTunedTPCSignal()); + } // end of track loop + } + PROCESS_SWITCH(electronConverter5, process004to005, "convert from 004 into 005", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"electron-converter5"})}; +} From 5f39d5944baeabd02616cb939b9fc00ebee35d08 Mon Sep 17 00:00:00 2001 From: Archita-Dash <91664849+Archita-Dash@users.noreply.github.com> Date: Tue, 30 Sep 2025 13:57:25 +0200 Subject: [PATCH 575/986] [PWGJE] Addition of deltaEta and deltaPhi columns to the EmcalMatchedTracks tables in the JE framework + fixed some bugs in the full-jet-spectra task (#12942) --- PWGJE/DataModel/JetReducedData.h | 6 +++++- PWGJE/TableProducer/derivedDataProducer.cxx | 2 +- PWGJE/TableProducer/derivedDataWriter.cxx | 2 +- .../emcalClusterHadronicCorrectionTask.cxx | 13 +++++++------ PWGJE/Tasks/fullJetSpectra.cxx | 8 ++++---- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/PWGJE/DataModel/JetReducedData.h b/PWGJE/DataModel/JetReducedData.h index fcc3d581862..f119d843c49 100644 --- a/PWGJE/DataModel/JetReducedData.h +++ b/PWGJE/DataModel/JetReducedData.h @@ -315,12 +315,16 @@ namespace jemctrack DECLARE_SOA_INDEX_COLUMN(JTrack, track); DECLARE_SOA_COLUMN(EtaEMCAL, etaEmcal, float); DECLARE_SOA_COLUMN(PhiEMCAL, phiEmcal, float); +DECLARE_SOA_COLUMN(EtaDiff, etaDiff, float); +DECLARE_SOA_COLUMN(PhiDiff, phiDiff, float); } // namespace jemctrack DECLARE_SOA_TABLE_STAGED(JEMCTracks, "JEMCTrack", jemctrack::JTrackId, jemctrack::EtaEMCAL, - jemctrack::PhiEMCAL); + jemctrack::PhiEMCAL, + jemctrack::EtaDiff, + jemctrack::PhiDiff); namespace jmcparticle { diff --git a/PWGJE/TableProducer/derivedDataProducer.cxx b/PWGJE/TableProducer/derivedDataProducer.cxx index 1f736f6b064..38d0bfd8acd 100644 --- a/PWGJE/TableProducer/derivedDataProducer.cxx +++ b/PWGJE/TableProducer/derivedDataProducer.cxx @@ -469,7 +469,7 @@ struct JetDerivedDataProducerTask { auto JClusterID = trackCollisionMapping.find({clusterTrack.trackId(), cluster.collisionId()}); // does EMCal use its own associator? clusterTrackIDs.push_back(JClusterID->second); auto emcTrack = clusterTrack.track_as>(); - products.jTracksEMCalTable(JClusterID->second, emcTrack.trackEtaEmcal(), emcTrack.trackPhiEmcal()); + products.jTracksEMCalTable(JClusterID->second, emcTrack.trackEtaEmcal(), emcTrack.trackPhiEmcal(), clusterTrack.deltaEta(), clusterTrack.deltaPhi()); } products.jClustersMatchedTracksTable(clusterTrackIDs); } diff --git a/PWGJE/TableProducer/derivedDataWriter.cxx b/PWGJE/TableProducer/derivedDataWriter.cxx index 0a73a14b24b..0ee9242ebac 100644 --- a/PWGJE/TableProducer/derivedDataWriter.cxx +++ b/PWGJE/TableProducer/derivedDataWriter.cxx @@ -512,7 +512,7 @@ struct JetDerivedDataWriter { clusterStoredJTrackIDs.push_back(trackMapping[clusterTrack.globalIndex()]); auto emcTracksPerTrack = emcTracks.sliceBy(preslices.EMCTrackPerTrack, clusterTrack.globalIndex()); auto emcTrackPerTrack = emcTracksPerTrack.iteratorAt(0); - products.storedJTracksEMCalTable(trackMapping[clusterTrack.globalIndex()], emcTrackPerTrack.etaEmcal(), emcTrackPerTrack.phiEmcal()); + products.storedJTracksEMCalTable(trackMapping[clusterTrack.globalIndex()], emcTrackPerTrack.etaEmcal(), emcTrackPerTrack.phiEmcal(), emcTrackPerTrack.etaDiff(), emcTrackPerTrack.phiDiff()); } products.storedJClustersMatchedTracksTable(clusterStoredJTrackIDs); } diff --git a/PWGJE/TableProducer/emcalClusterHadronicCorrectionTask.cxx b/PWGJE/TableProducer/emcalClusterHadronicCorrectionTask.cxx index 67672c53222..588030e132c 100644 --- a/PWGJE/TableProducer/emcalClusterHadronicCorrectionTask.cxx +++ b/PWGJE/TableProducer/emcalClusterHadronicCorrectionTask.cxx @@ -161,11 +161,12 @@ struct EmcalClusterHadronicCorrectionTask { if (matchedTrack.pt() < minTrackPt) { continue; } - double mom = abs(matchedTrack.p()); + double mom = std::abs(matchedTrack.p()); registry.fill(HIST("h_matchedtracks"), 1); // CASE 1: skip tracks with a very low pT - if (mom < 1e-6) { + constexpr double kMinMom = 1e-6; + if (mom < kMinMom) { continue; } // end CASE 1 @@ -176,8 +177,8 @@ struct EmcalClusterHadronicCorrectionTask { // Perform dEta/dPhi matching auto emcTrack = (emcTracks.sliceBy(perTrackMatchedTrack, matchedTrack.globalIndex())).iteratorAt(0); - double dEta = emcTrack.etaEmcal() - cluster.eta(); - double dPhi = TVector2::Phi_mpi_pi(emcTrack.phiEmcal() - cluster.phi()); + double dEta = emcTrack.etaDiff(); + double dPhi = emcTrack.phiDiff(); // Apply the eta and phi matching thresholds // dEta and dPhi cut : ensures that the matched track is within the desired eta/phi window @@ -188,7 +189,7 @@ struct EmcalClusterHadronicCorrectionTask { auto trackPhiHigh = +funcPtDepPhi.Eval(mom); auto trackPhiLow = -funcPtDepPhi.Eval(mom); - if ((dPhi < trackPhiHigh && dPhi > trackPhiLow) && fabs(dEta) < trackEtaMax) { + if ((dPhi < trackPhiHigh && dPhi > trackPhiLow) && std::fabs(dEta) < trackEtaMax) { if (nMatches == 0) { closestTrkP = mom; } @@ -197,7 +198,7 @@ struct EmcalClusterHadronicCorrectionTask { } } else { // Do fixed dEta/dPhi matching (non-pT dependent) - if (fabs(dEta) >= minDEta || fabs(dPhi) >= minDPhi) { + if (std::fabs(dEta) >= minDEta || std::fabs(dPhi) >= minDPhi) { continue; // Skip this track if outside the fixed cut region } diff --git a/PWGJE/Tasks/fullJetSpectra.cxx b/PWGJE/Tasks/fullJetSpectra.cxx index 80450cc1fa1..457715e679a 100644 --- a/PWGJE/Tasks/fullJetSpectra.cxx +++ b/PWGJE/Tasks/fullJetSpectra.cxx @@ -135,7 +135,7 @@ struct FullJetSpectra { // Instantiate the Zorro processor for skimmed data and define an output object Zorro zorro; OutputObj zorroSummary{"zorroSummary"}; - const bool doSumw2 = doMBGapTrigger; + bool doSumw2 = false; // Multiplicity Utilities // struct CentClass { @@ -334,7 +334,7 @@ struct FullJetSpectra { triggerMaskBits = jetderiveddatautilities::initialiseTriggerMaskBits(triggerMasks); particleSelection = static_cast(particleSelections); jetRadiiValues = (std::vector)jetRadii; - + doSumw2 = doMBGapTrigger; /* if (doMcClosure) { // randGen.SetSeed(mcSplitSeed); // randGen.SetSeed(static_cast(std::time(nullptr))); @@ -508,7 +508,7 @@ struct FullJetSpectra { registry.add("h2_full_jet_energyscaleChargedVsFullPart", "Jet Energy Scale (charged part, vs. full jet pt); p_{T,part} (GeV/c); (p_{T,det} - p_{T,part})/p_{T,part}", {HistType::kTH2F, {{400, 0., 400.}, {200, -1., 1.}}}, doSumw2); registry.add("h2_full_jet_energyscaleNeutralVsFullPart", "Jet Energy Scale (neutral part, vs. full jet pt); p_{T,part} (GeV/c); (p_{T,det} - p_{T,part})/p_{T,part}", {HistType::kTH2F, {{400, 0., 400.}, {200, -1., 1.}}}, doSumw2); registry.add("h2_full_fakemcdjets", "Fake MCD Jets; p_{T,det} (GeV/c); NCounts", {HistType::kTH2F, {{350, 0., 350.}, {100, 0., 100.}}}, doSumw2); - registry.add("h2FullfakeMcpJets", "Fake MCP Jets; p_{T,part} (GeV/c); NCounts", {HistType::kTH2F, {{350, 0., 350.}, {100, 0., 100.}}}, doSumw2); + registry.add("h2_full_fakemcpjets", "Fake MCP Jets; p_{T,part} (GeV/c); NCounts", {HistType::kTH2F, {{350, 0., 350.}, {100, 0., 100.}}}, doSumw2); registry.add("h2_full_matchedmcpjet_pt", "Matched MCP jet in EMC Fiducial Acceptance #it{p}_{T,part};#it{p}_{T,part} (GeV/c); Ncounts", {HistType::kTH2F, {{350, 0., 350.}, {10000, 0., 10000.}}}, doSumw2); // Response Matrix @@ -1740,7 +1740,7 @@ struct FullJetSpectra { // apply emcal fiducial cuts to the matched particle level jets - if the matched mcp jet lies outside of the EMCAL fiducial, flag it as a fake jet if (mcpjet.eta() > jetEtaMax || mcpjet.eta() < jetEtaMin || mcpjet.phi() > jetPhiMax || mcpjet.phi() < jetPhiMin) { fakeMcpJet++; - registry.fill(HIST("h2FullfakeMcpJets"), mcpjet.pt(), fakeMcpJet, eventWeight); + registry.fill(HIST("h2_full_fakemcpjets"), mcpjet.pt(), fakeMcpJet, eventWeight); continue; } else { NPartJetFid++; From 7ca8e13edfdd9de9194ecf121de052ced1dc21ec Mon Sep 17 00:00:00 2001 From: omvazque Date: Tue, 30 Sep 2025 07:19:02 -0500 Subject: [PATCH 576/986] [PWGLF] Added MC process function (#13171) --- PWGLF/Tasks/Nuspex/piKpRAA.cxx | 556 +++++++++++++++++++++++++++------ 1 file changed, 464 insertions(+), 92 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/piKpRAA.cxx b/PWGLF/Tasks/Nuspex/piKpRAA.cxx index 98b11a39bf7..39dfab21ec1 100644 --- a/PWGLF/Tasks/Nuspex/piKpRAA.cxx +++ b/PWGLF/Tasks/Nuspex/piKpRAA.cxx @@ -44,6 +44,7 @@ #include "ReconstructionDataFormats/Track.h" #include +#include "TMCProcess.h" #include "TPDGCode.h" #include "TVector3.h" #include @@ -68,8 +69,13 @@ using namespace o2::framework::expressions; using ColEvSels = soa::Join; using BCsRun3 = soa::Join; +using ColEvSelsMC = soa::Join; + using TracksFull = soa::Join; +using TracksMC = soa::Join; +// using SimTracks = soa::Join; + static constexpr int kNEtaHists{8}; std::array, kNEtaHists> dEdxPiV0{}; @@ -100,6 +106,7 @@ struct PiKpRAA { static constexpr float kZero{0.0f}; static constexpr float kOne{1.0f}; + static constexpr float kThree{3.0f}; static constexpr float kTenToMinusNine{1e-9}; static constexpr float kMinPtNchSel{0.1f}; static constexpr float kMaxPtNchSel{3.0f}; @@ -153,7 +160,6 @@ struct PiKpRAA { Configurable applyInvMassSel{"applyInvMassSel", false, "Select V0s close to the Inv. mass value"}; Configurable dMassSel{"dMassSel", 0.01f, "Invariant mass selection"}; Configurable dMassSelG{"dMassSelG", 0.1f, "Inv mass selection gammas"}; - Configurable dMassGcut{"dMassGcut", 0.1f, "Inv mass selection gammas"}; // PID (TPC/TOF) Configurable dEdxPlateauSel{"dEdxPlateauSel", 50, "dEdx selection for electrons"}; @@ -205,6 +211,7 @@ struct PiKpRAA { ConfigurableAxis axisGammaMass{"axisGammaMass", {150, 0.0f, 0.15f}, "Mass Gamma"}; ConfigurableAxis axisNsigmaTPC{"axisNsigmaTPC", {200, -10.0f, 10.0f}, "N sigma TPC"}; ConfigurableAxis axisdEdx{"axisdEdx", {140, 20.0, 160.0}, "dEdx binning"}; + ConfigurableAxis axisDCAxy{"axisDCAxy", {105, -1.05f, 1.05f}, "DCAxy axis"}; Configurable nBinsNch{"nBinsNch", 400, "N bins Nch (|eta|<0.8)"}; Configurable nBinsNPV{"nBinsNPV", 600, "N bins ITS tracks"}; Configurable minNch{"minNch", 0, "Min Nch (|eta|<0.8)"}; @@ -267,6 +274,7 @@ struct PiKpRAA { bool isCalPlateauLoaded = false; } etaCal; + TrackSelection trkSelGlobalOpenDCAxy; TrackSelection trkSelDaugthers; TrackSelection trkSelGlobal; TrackSelection trkSelDaugthersV0s() @@ -277,12 +285,32 @@ struct PiKpRAA { return selectedTracks; } + TrackSelection trkSelOpenDCAxy() + { + TrackSelection selectedTracks; + selectedTracks.SetTrackType(o2::aod::track::TrackTypeEnum::Track); // Run 2 track asked by default + selectedTracks.SetPtRange(0.1f, 1e10f); + selectedTracks.SetEtaRange(-0.8f, 0.8f); + selectedTracks.SetRequireITSRefit(true); + selectedTracks.SetRequireTPCRefit(true); + selectedTracks.SetRequireGoldenChi2(true); + selectedTracks.SetMinNCrossedRowsTPC(70); + selectedTracks.SetMinNCrossedRowsOverFindableClustersTPC(0.8f); + selectedTracks.SetMaxChi2PerClusterTPC(4.f); + selectedTracks.SetRequireHitsInITSLayers(1, {0, 1}); // one hit in any SPD layer + selectedTracks.SetMaxChi2PerClusterITS(36.f); + // selectedTracks.SetMaxDcaXYPtDep([](float pt) { return 0.0105f + 0.0350f / pow(pt, 1.1f); }); + selectedTracks.SetMaxDcaZ(2.f); + return selectedTracks; + } + int currentRunNumberNchSel; int currentRunNumberPhiSel; void init(InitContext const&) { currentRunNumberNchSel = -1; currentRunNumberPhiSel = -1; + trkSelGlobalOpenDCAxy = trkSelOpenDCAxy(); trkSelDaugthers = trkSelDaugthersV0s(); trkSelGlobal = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSibAny, TrackSelection::GlobalTrackRun3DCAxyCut::Default); @@ -302,6 +330,12 @@ struct PiKpRAA { const char* latexEta[kNEtaHists] = {"-0.8<#eta<-0.6", "-0.6<#eta<-0.4", "-0.4<#eta<-0.2", "-0.2<#eta<0", "0<#eta<0.2", "0.2<#eta<0.4", "0.4<#eta<0.6", "0.6<#eta<0.8"}; registry.add("EventCounter", ";;Events", kTH1F, {axisEvent}); + registry.add("zPos", ";;Entries;", kTH1F, {axisZpos}); + registry.add("T0Ccent", ";;Entries", kTH1F, {axisCent}); + registry.add("NclVsEtaPID", ";#eta;Ncl used for PID", kTH2F, {{{axisEta}, {161, -0.5, 160.5}}}); + registry.add("NclVsEtaPIDp", ";#eta;#LTNcl#GT used for PID", kTProfile, {axisEta}); + registry.add("dcaVsPtPi", "Primary pions;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm);", kTH2F, {axisPt, axisDCAxy}); + registry.add("dcaVsPtPr", "Primary protons;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm);", kTH2F, {axisPt, axisDCAxy}); auto hstat = registry.get(HIST("EventCounter")); auto* x = hstat->GetXaxis(); @@ -321,15 +355,12 @@ struct PiKpRAA { x->SetBinLabel(14, "Nch Sel."); if (doprocessCalibrationAndV0s) { - registry.add("zPos", ";;Entries;", kTH1F, {axisZpos}); - registry.add("T0Ccent", ";;Entries", kTH1F, {axisCent}); registry.add("NchVsNPV", ";Nch; NPV;", kTH2F, {{{nBinsNPV, minNpv, maxNpv}, {nBinsNch, minNch, maxNch}}}); registry.add("ExcludedEvtVsNch", ";Nch;Entries;", kTH1F, {{nBinsNch, minNch, maxNch}}); registry.add("ExcludedEvtVsNPV", ";NPV;Entries;", kTH1F, {{nBinsNPV, minNpv, maxNpv}}); registry.add("V0sCounter", ";V0 type; Entries;", kTH1F, {{4, 0.5, 4.5}}); - registry.add("dcaVsPt", "Primary particles;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm);", kTH2F, {{{axisPt}, {40, -1.0, 1.0}}}); - registry.add("dcaDauVsPt", ";V0 #it{p}_{T} (GeV/#it{c});DCA_{xy} (cm) daughters;", kTH2F, {{{axisPtV0s}, {200, -10., 10.}}}); + registry.add("dcaDauVsPt", ";V0 #it{p}_{T} (GeV/#it{c});DCA_{xy} (cm) daughters;", kTH2F, {axisPt, axisDCAxy}); registry.add("nSigPiFromK0s", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); registry.add("nSigPiFromL", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); registry.add("nSigPrFromL", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); @@ -355,9 +386,7 @@ struct PiKpRAA { registry.add("NclVsPhipAfterCut", Form("Found #LTNcl#GT TPC;%s (GeV/#it{c});#varphi", titlePorPt.data()), kTProfile2D, {{{axisXPhiCut}, {350, 0.0, 0.35}}}); registry.add("NclVsPhipAfterCutPID", Form("#LTNcl#GT used for PID;%s (GeV/#it{c});#varphi", titlePorPt.data()), kTProfile2D, {{{axisXPhiCut}, {350, 0.0, 0.35}}}); registry.add("NclVsEta", ";#eta;Found Ncl TPC", kTH2F, {{{axisEta}, {161, -0.5, 160.5}}}); - registry.add("NclVsEtaPID", ";#eta;Ncl used for PID", kTH2F, {{{axisEta}, {161, -0.5, 160.5}}}); registry.add("NclVsEtap", ";#eta;Found #LTNcl#GT TPC", kTProfile, {axisEta}); - registry.add("NclVsEtaPIDp", ";#eta;#LTNcl#GT used for PID", kTProfile, {axisEta}); registry.add("NclVsEtaPiMIP", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c}, 40 < dE/dx < 60);#eta;Ncl TPC", kTH2F, {{{axisEta}, {161, -0.5, 160.5}}}); registry.add("NclVsEtaPiMIPp", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c}, 40 < dE/dx < 60);#eta;#LTNcl#GT TPC", kTProfile, {axisEta}); @@ -415,6 +444,50 @@ struct PiKpRAA { } } + if (doprocessMC) { + + registry.add("EventCounterMC", "Event counter", kTH1F, {axisEvent}); + registry.add("zPosMC", ";;Entries;", kTH1F, {axisZpos}); + + registry.add("NclVsPhip", Form("#LTNcl#GT used for PID;%s (GeV/#it{c});#varphi", titlePorPt.data()), kTProfile2D, {{{axisXPhiCut}, {350, 0.0, 0.35}}}); + + registry.add("dcaVsPtPiDec", "Secondary pions from decays;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm);", kTH2F, {axisPt, axisDCAxy}); + registry.add("dcaVsPtPrDec", "Secondary protons from decays;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm);", kTH2F, {axisPt, axisDCAxy}); + registry.add("dcaVsPtPiMat", "Secondary pions from material interactions;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm);", kTH2F, {axisPt, axisDCAxy}); + registry.add("dcaVsPtPrMat", "Secondary protons from material interactions;#it{p}_{T} (GeV/#it{c});DCA_{xy} (cm);", kTH2F, {axisPt, axisDCAxy}); + + registry.add("PtPiVsCent", "", kTH2F, {axisPt, axisCent}); + registry.add("PtKaVsCent", "", kTH2F, {axisPt, axisCent}); + registry.add("PtPrVsCent", "", kTH2F, {axisPt, axisCent}); + + registry.add("PtPiVsCentMC", "", kTH2F, {axisPt, axisCent}); + registry.add("PtKaVsCentMC", "", kTH2F, {axisPt, axisCent}); + registry.add("PtPrVsCentMC", "", kTH2F, {axisPt, axisCent}); + + for (int i = 0; i < kNEtaHists; ++i) { + // dEdx[i] = registry.add(Form("dEdx_%s", endingEta[i]), Form("%s;Momentum (GeV/#it{c});dE/dx;", latexEta[i]), kTH3F, {axisPt, axisdEdx, axisCent}); + // pTVsP[i] = registry.add(Form("pTVsP_%s", endingEta[i]), Form("%s;Momentum (GeV/#it{c});#it{p}_{T} (GeV/#it{c});", latexEta[i]), kTH2F, {axisPt, axisPt}); + // dEdxPiV0[i] = registry.add(Form("dEdxPiV0_%s", endingEta[i]), Form("#pi^{+} + #pi^{-}, %s;Momentum (GeV/#it{c});dE/dx;", latexEta[i]), kTH3F, {axisPtV0s, axisdEdx, axisCent}); + // dEdxPrV0[i] = registry.add(Form("dEdxPrV0_%s", endingEta[i]), Form("p + #bar{p}, %s;Momentum (GeV/#it{c});dE/dx;", latexEta[i]), kTH3F, {axisPtV0s, axisdEdx, axisCent}); + // dEdxElV0[i] = registry.add(Form("dEdxElV0_%s", endingEta[i]), Form("e^{+} + e^{-}, %s;Momentum (GeV/#it{c});dE/dx;", latexEta[i]), kTH3F, {axisPtV0s, axisdEdx, axisCent}); + // dEdxPiTOF[i] = registry.add(Form("dEdxPiTOF_%s", endingEta[i]), Form("#pi^{+} + #pi^{-}, %s;Momentum (GeV/#it{c});dE/dx;", latexEta[i]), kTH3F, {axisPtV0s, axisdEdx, axisCent}); + // nClVsdEdxPiV0[i] = registry.add(Form("NclVsdEdxPiV0_%s", endingEta[i]), Form("%s;#it{N}_{cl} used for PID;dE/dx;", latexEta[i]), kTH2F, {axisNcl, axisdEdx}); + // nClVsdEdxElV0[i] = registry.add(Form("NclVsdEdxElV0_%s", endingEta[i]), Form("%s;#it{N}_{cl} used for PID;dE/dx;", latexEta[i]), kTH2F, {axisNcl, axisdEdx}); + // nClVsdEdxPrV0[i] = registry.add(Form("NclVsdEdxPrV0_%s", endingEta[i]), Form("%s;#it{N}_{cl} used for PID;dE/dx;", latexEta[i]), kTH2F, {axisNcl, axisdEdx}); + nClVsP[i] = registry.add(Form("NclVsPPrimaries_%s", endingEta[i]), Form("%s;;Ncl TPC", latexEta[i]), kTH2F, {axisPtNcl, axisNcl}); + // nClVsPElV0[i] = registry.add(Form("NclVsPElV0_%s", endingEta[i]), Form("%s;;Ncl TPC", latexEta[i]), kTH2F, {axisPtNcl, axisNcl}); + // nClVsPPiV0[i] = registry.add(Form("NclVsPPiV0_%s", endingEta[i]), Form("%s;;Ncl TPC", latexEta[i]), kTH2F, {axisPtNcl, axisNcl}); + // nClVsPPrV0[i] = registry.add(Form("NclVsPPrV0_%s", endingEta[i]), Form("%s;;Ncl TPC", latexEta[i]), kTH2F, {axisPtNcl, axisNcl}); + nClVsPp[i] = registry.add(Form("NclVsPrimariesp_%s", endingEta[i]), Form("%s;;#LT#it{N}_{cl}#GT TPC", latexEta[i]), kTProfile, {axisPtNcl}); + // nClVsPpElV0[i] = registry.add(Form("NclVsPElV0p_%s", endingEta[i]), Form("%s;;#LT#it{N}_{cl}#GT TPC", latexEta[i]), kTProfile, {axisPtNcl}); + // nClVsPpPiV0[i] = registry.add(Form("NclVsPPiV0p_%s", endingEta[i]), Form("%s;;#LT#it{N}_{cl}#GT TPC", latexEta[i]), kTProfile, {axisPtNcl}); + // nClVsPpPrV0[i] = registry.add(Form("NclVsPPrV0p_%s", endingEta[i]), Form("%s;;#LT#it{N}_{cl}#GT TPC", latexEta[i]), kTProfile, {axisPtNcl}); + // nClVsdEdxpElV0[i] = registry.add(Form("NclVsdEdxElV0p_%s", endingEta[i]), Form("%s;;#LTd#it{E}/d#it{x}#GT", latexEta[i]), kTProfile, {axisNcl}); + // nClVsdEdxpPiV0[i] = registry.add(Form("NclVsdEdxPiV0p_%s", endingEta[i]), Form("%s;;#LTd#it{E}/d#it{x}#GT", latexEta[i]), kTProfile, {axisNcl}); + // nClVsdEdxpPrV0[i] = registry.add(Form("NclVsdEdxPrV0p_%s", endingEta[i]), Form("%s;;#LTd#it{E}/d#it{x}#GT", latexEta[i]), kTProfile, {axisNcl}); + } + } + LOG(info) << "\tccdbNoLaterThan=" << ccdbNoLaterThan.value; LOG(info) << "\tapplyNchSel=" << applyNchSel.value; LOG(info) << "\tdetector4Calibration=" << detector4Calibration.value; @@ -506,6 +579,28 @@ struct PiKpRAA { nch++; } + for (const auto& track : tracks) { + // Track Selection + if (!trkSelGlobalOpenDCAxy.IsSelected(track)) { + continue; + } + if (track.pt() < kMinPtNchSel || track.pt() > kMaxPtNchSel) { + continue; + } + + const float piTPCNsigma{std::fabs(track.tpcNSigmaPi())}; + const float prTPCNsigma{std::fabs(track.tpcNSigmaPr())}; + const float piTOFNsigma{std::fabs(track.tofNSigmaPi())}; + const float prTOFNsigma{std::fabs(track.tofNSigmaPr())}; + const double piRadiusNsigma{std::sqrt(std::pow(piTPCNsigma, 2.) + std::pow(piTOFNsigma, 2.))}; + const double prRadiusNsigma{std::sqrt(std::pow(prTPCNsigma, 2.) + std::pow(prTOFNsigma, 2.))}; + + if (piRadiusNsigma < kThree) + registry.fill(HIST("dcaVsPtPi"), track.pt(), track.dcaXY()); + if (prRadiusNsigma < kThree) + registry.fill(HIST("dcaVsPtPr"), track.pt(), track.dcaXY()); + } + bool skipEvent{false}; if (applyNchSel) { if (!cfgNch.calibrationsLoaded) @@ -628,7 +723,6 @@ struct PiKpRAA { nClVsP[indexEta]->Fill(pOrPt, ncl); nClVsPp[indexEta]->Fill(pOrPt, ncl); registry.fill(HIST("pTVsCent"), pt, centrality); - registry.fill(HIST("dcaVsPt"), pt, track.dcaXY()); registry.fill(HIST("EtaVsPhi"), eta, track.phi()); registry.fill(HIST("NclVsEta"), eta, nclFound); registry.fill(HIST("NclVsEtap"), eta, nclFound); @@ -735,6 +829,9 @@ struct PiKpRAA { if (passesV0TopologicalSelection(v0)) passesTopoSel = true; + if (!passesTopoSel) + continue; + const double dMassK0s{std::abs(v0.mK0Short() - o2::constants::physics::MassK0Short)}; const double dMassL{std::abs(v0.mLambda() - o2::constants::physics::MassLambda0)}; const double dMassAL{std::abs(v0.mAntiLambda() - o2::constants::physics::MassLambda0)}; @@ -762,102 +859,114 @@ struct PiKpRAA { if (negIndexEta < kZeroInt || negIndexEta > kSevenInt) continue; - if (passesTopoSel) { - registry.fill(HIST("ArmAfterTopoSel"), alpha, qT); - registry.fill(HIST("dcaDauVsPt"), v0.pt(), v0.dcapostopv()); - registry.fill(HIST("dcaDauVsPt"), v0.pt(), v0.dcanegtopv()); - - if (v0Selections.applyInvMassSel) { // apply Inv. Mass selection? - if (dMassK0s < v0Selections.dMassSel && dMassL > v0Selections.dMassSel && dMassAL > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG) { // Mass cut - if (passesK0Selection(collision, v0)) { // nSigma TPC and y cuts - registry.fill(HIST("ArmK0NOSel"), alpha, qT); - if (v0Selections.armPodCut * qT > std::abs(alpha)) { // Armenters selection - registry.fill(HIST("V0sCounter"), V0sCounter::K0s); - registry.fill(HIST("ArmK0"), alpha, qT); - registry.fill(HIST("MassK0sVsPt"), v0.pt(), v0.mK0Short()); - registry.fill(HIST("nSigPiFromK0s"), posTrkPt, posTrack.tpcNSigmaPi()); - registry.fill(HIST("nSigPiFromK0s"), negTrkPt, negTrack.tpcNSigmaPi()); - registry.fill(HIST("NclVsEtaPiV0"), posTrkEta, posNcl); - registry.fill(HIST("NclVsEtaPiV0p"), posTrkEta, posNcl); - registry.fill(HIST("NclVsEtaPiV0"), negTrkEta, negNcl); - registry.fill(HIST("NclVsEtaPiV0p"), negTrkEta, negNcl); - nClVsPPiV0[posIndexEta]->Fill(posPorPt, posNcl); - nClVsPpPiV0[posIndexEta]->Fill(posPorPt, posNcl); - nClVsPPiV0[negIndexEta]->Fill(negPorPt, negNcl); - nClVsdEdxPiV0[negIndexEta]->Fill(negNcl, negTrkdEdx); - nClVsdEdxpPiV0[negIndexEta]->Fill(negNcl, negTrkdEdx); - nClVsdEdxPiV0[posIndexEta]->Fill(posNcl, posTrkdEdx); - nClVsdEdxpPiV0[posIndexEta]->Fill(posNcl, posTrkdEdx); - nClVsPpPiV0[negIndexEta]->Fill(negPorPt, negNcl); - dEdxPiV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); - dEdxPiV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); - - if (posTrkP > kMinPMIP && posTrkP < kMaxPMIP && posTrkdEdx > kMindEdxMIP && posTrkdEdx < kMaxdEdxMIP) { - registry.fill(HIST("dEdxVsEtaPiMIPV0"), posTrkEta, posTrkdEdx); - registry.fill(HIST("dEdxVsEtaPiMIPV0p"), posTrkEta, posTrkdEdx); - } - if (negTrkP > kMinPMIP && negTrkP < kMaxPMIP && negTrkdEdx > kMindEdxMIP && negTrkdEdx < kMaxdEdxMIP) { - registry.fill(HIST("dEdxVsEtaPiMIPV0"), negTrkEta, negTrkdEdx); - registry.fill(HIST("dEdxVsEtaPiMIPV0p"), negTrkEta, negTrkdEdx); - } - } - } - } - } + registry.fill(HIST("ArmAfterTopoSel"), alpha, qT); + registry.fill(HIST("dcaDauVsPt"), v0.pt(), v0.dcapostopv()); + registry.fill(HIST("dcaDauVsPt"), v0.pt(), v0.dcanegtopv()); - if (v0Selections.applyInvMassSel) { - if (dMassL < v0Selections.dMassSel && dMassK0s > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG) { - if (passesLambdaSelection(collision, v0)) { - registry.fill(HIST("V0sCounter"), V0sCounter::Lambda); - registry.fill(HIST("ArmL"), alpha, qT); - registry.fill(HIST("MassLVsPt"), v0.pt(), v0.mLambda()); - registry.fill(HIST("nSigPrFromL"), posTrkPt, posTrack.tpcNSigmaPr()); - registry.fill(HIST("nSigPiFromL"), negTrkPt, negTrack.tpcNSigmaPi()); - registry.fill(HIST("NclVsEtaPrV0"), posTrkEta, posNcl); - registry.fill(HIST("NclVsEtaPrV0p"), posTrkEta, posNcl); - registry.fill(HIST("NclVsEtaPiV0"), negTrkEta, negNcl); - registry.fill(HIST("NclVsEtaPiV0p"), negTrkEta, negNcl); - nClVsPPrV0[posIndexEta]->Fill(posPorPt, posNcl); - nClVsPpPrV0[posIndexEta]->Fill(posPorPt, posNcl); - nClVsPPiV0[negIndexEta]->Fill(negPorPt, negNcl); - nClVsPpPiV0[negIndexEta]->Fill(negPorPt, negNcl); - nClVsdEdxPiV0[negIndexEta]->Fill(negNcl, negTrkdEdx); - nClVsdEdxpPiV0[negIndexEta]->Fill(negNcl, negTrkdEdx); - nClVsdEdxPrV0[posIndexEta]->Fill(posNcl, posTrkdEdx); - nClVsdEdxpPrV0[posIndexEta]->Fill(posNcl, posTrkdEdx); - dEdxPrV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); - dEdxPiV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); - } - } - } + bool isMassK0s{true}; + bool isMassL{true}; + bool isMassAL{true}; + bool isMassG{true}; + if (v0Selections.applyInvMassSel) { // apply Inv. Mass selection? + if (!(dMassK0s < v0Selections.dMassSel && dMassL > v0Selections.dMassSel && dMassAL > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG)) + isMassK0s = false; + + if (!(dMassL < v0Selections.dMassSel && dMassK0s > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG)) + isMassL = false; + + if (!(dMassAL < v0Selections.dMassSel && dMassK0s > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG)) + isMassAL = false; + + if (!(dMassK0s > v0Selections.dMassSel && dMassL > v0Selections.dMassSel && dMassAL > v0Selections.dMassSel && dMassG < v0Selections.dMassSel)) + isMassG = false; + } - if (v0Selections.applyInvMassSel && dMassAL < v0Selections.dMassSel && dMassK0s > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG) { - if (passesAntiLambdaSelection(collision, v0)) { - registry.fill(HIST("V0sCounter"), V0sCounter::AntiLambda); - registry.fill(HIST("ArmAL"), alpha, qT); - registry.fill(HIST("MassALVsPt"), v0.pt(), v0.mAntiLambda()); - registry.fill(HIST("nSigPrFromAL"), negTrkPt, negTrack.tpcNSigmaPr()); - registry.fill(HIST("nSigPiFromAL"), posTrkPt, posTrack.tpcNSigmaPi()); + if (passesK0Selection(collision, v0)) { // nSigma TPC and y cuts + if (isMassK0s) { // apply Inv. Mass selection? + registry.fill(HIST("ArmK0NOSel"), alpha, qT); + if (v0Selections.armPodCut * qT > std::abs(alpha)) { // Armenters selection + registry.fill(HIST("V0sCounter"), V0sCounter::K0s); + registry.fill(HIST("ArmK0"), alpha, qT); + registry.fill(HIST("MassK0sVsPt"), v0.pt(), v0.mK0Short()); + registry.fill(HIST("nSigPiFromK0s"), posTrkPt, posTrack.tpcNSigmaPi()); + registry.fill(HIST("nSigPiFromK0s"), negTrkPt, negTrack.tpcNSigmaPi()); registry.fill(HIST("NclVsEtaPiV0"), posTrkEta, posNcl); registry.fill(HIST("NclVsEtaPiV0p"), posTrkEta, posNcl); - registry.fill(HIST("NclVsEtaPrV0"), negTrkEta, negNcl); - registry.fill(HIST("NclVsEtaPrV0p"), negTrkEta, negNcl); - nClVsPPrV0[negIndexEta]->Fill(negPorPt, negNcl); - nClVsPpPrV0[negIndexEta]->Fill(negPorPt, negNcl); + registry.fill(HIST("NclVsEtaPiV0"), negTrkEta, negNcl); + registry.fill(HIST("NclVsEtaPiV0p"), negTrkEta, negNcl); nClVsPPiV0[posIndexEta]->Fill(posPorPt, posNcl); nClVsPpPiV0[posIndexEta]->Fill(posPorPt, posNcl); - nClVsdEdxPrV0[negIndexEta]->Fill(negNcl, negTrkdEdx); - nClVsdEdxpPrV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + nClVsPPiV0[negIndexEta]->Fill(negPorPt, negNcl); + nClVsdEdxPiV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + nClVsdEdxpPiV0[negIndexEta]->Fill(negNcl, negTrkdEdx); nClVsdEdxPiV0[posIndexEta]->Fill(posNcl, posTrkdEdx); nClVsdEdxpPiV0[posIndexEta]->Fill(posNcl, posTrkdEdx); - dEdxPrV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); + nClVsPpPiV0[negIndexEta]->Fill(negPorPt, negNcl); dEdxPiV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); + dEdxPiV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); + + if (posTrkP > kMinPMIP && posTrkP < kMaxPMIP && posTrkdEdx > kMindEdxMIP && posTrkdEdx < kMaxdEdxMIP) { + registry.fill(HIST("dEdxVsEtaPiMIPV0"), posTrkEta, posTrkdEdx); + registry.fill(HIST("dEdxVsEtaPiMIPV0p"), posTrkEta, posTrkdEdx); + } + if (negTrkP > kMinPMIP && negTrkP < kMaxPMIP && negTrkdEdx > kMindEdxMIP && negTrkdEdx < kMaxdEdxMIP) { + registry.fill(HIST("dEdxVsEtaPiMIPV0"), negTrkEta, negTrkdEdx); + registry.fill(HIST("dEdxVsEtaPiMIPV0p"), negTrkEta, negTrkdEdx); + } } } } - if (v0Selections.applyInvMassSel && dMassK0s > v0Selections.dMassSel && dMassL > v0Selections.dMassSel && dMassAL > v0Selections.dMassSel && dMassG < v0Selections.dMassSel) { - if (passesGammaSelection(collision, v0)) { + if (passesLambdaSelection(collision, v0)) { + if (isMassL) { + registry.fill(HIST("V0sCounter"), V0sCounter::Lambda); + registry.fill(HIST("ArmL"), alpha, qT); + registry.fill(HIST("MassLVsPt"), v0.pt(), v0.mLambda()); + registry.fill(HIST("nSigPrFromL"), posTrkPt, posTrack.tpcNSigmaPr()); + registry.fill(HIST("nSigPiFromL"), negTrkPt, negTrack.tpcNSigmaPi()); + registry.fill(HIST("NclVsEtaPrV0"), posTrkEta, posNcl); + registry.fill(HIST("NclVsEtaPrV0p"), posTrkEta, posNcl); + registry.fill(HIST("NclVsEtaPiV0"), negTrkEta, negNcl); + registry.fill(HIST("NclVsEtaPiV0p"), negTrkEta, negNcl); + nClVsPPrV0[posIndexEta]->Fill(posPorPt, posNcl); + nClVsPpPrV0[posIndexEta]->Fill(posPorPt, posNcl); + nClVsPPiV0[negIndexEta]->Fill(negPorPt, negNcl); + nClVsPpPiV0[negIndexEta]->Fill(negPorPt, negNcl); + nClVsdEdxPiV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + nClVsdEdxpPiV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + nClVsdEdxPrV0[posIndexEta]->Fill(posNcl, posTrkdEdx); + nClVsdEdxpPrV0[posIndexEta]->Fill(posNcl, posTrkdEdx); + dEdxPrV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); + // dEdxPiV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); + } + } + + if (passesAntiLambdaSelection(collision, v0)) { + if (isMassAL) { + registry.fill(HIST("V0sCounter"), V0sCounter::AntiLambda); + registry.fill(HIST("ArmAL"), alpha, qT); + registry.fill(HIST("MassALVsPt"), v0.pt(), v0.mAntiLambda()); + registry.fill(HIST("nSigPrFromAL"), negTrkPt, negTrack.tpcNSigmaPr()); + registry.fill(HIST("nSigPiFromAL"), posTrkPt, posTrack.tpcNSigmaPi()); + registry.fill(HIST("NclVsEtaPiV0"), posTrkEta, posNcl); + registry.fill(HIST("NclVsEtaPiV0p"), posTrkEta, posNcl); + registry.fill(HIST("NclVsEtaPrV0"), negTrkEta, negNcl); + registry.fill(HIST("NclVsEtaPrV0p"), negTrkEta, negNcl); + nClVsPPrV0[negIndexEta]->Fill(negPorPt, negNcl); + nClVsPpPrV0[negIndexEta]->Fill(negPorPt, negNcl); + nClVsPPiV0[posIndexEta]->Fill(posPorPt, posNcl); + nClVsPpPiV0[posIndexEta]->Fill(posPorPt, posNcl); + nClVsdEdxPrV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + nClVsdEdxpPrV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + nClVsdEdxPiV0[posIndexEta]->Fill(posNcl, posTrkdEdx); + nClVsdEdxpPiV0[posIndexEta]->Fill(posNcl, posTrkdEdx); + dEdxPrV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); + // dEdxPiV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); + } + } + + if (passesGammaSelection(collision, v0)) { + if (isMassG) { if (std::abs(alpha) < v0Selections.armAlphaSel && qT < v0Selections.qTSel) { if (v0Selections.applyPlateauSel && etaCal.isCalPlateauLoaded) { @@ -897,10 +1006,273 @@ struct PiKpRAA { } } } - } + } // v0s } PROCESS_SWITCH(PiKpRAA, processCalibrationAndV0s, "Process QA", true); + Preslice perCollision = aod::track::collisionId; + Service pdg; + void processMC(aod::McCollisions::iterator const& mccollision, soa::SmallGroups const& collisions, BCsRun3 const& /*bcs*/, aod::FT0s const& /*ft0s*/, aod::McParticles const& mcParticles, TracksMC const& tracksMC) + { + for (const auto& collision : collisions) { + // Event selection + if (!isEventSelected(collision)) { + continue; + } + // MC collision? + if (!collision.has_mcCollision()) { + continue; + } + + registry.fill(HIST("EventCounterMC"), EvCutLabel::All); + + if (std::fabs(mccollision.posZ()) > posZcut) + continue; + + registry.fill(HIST("zPos"), collision.posZ()); + registry.fill(HIST("zPosMC"), mccollision.posZ()); + registry.fill(HIST("EventCounterMC"), EvCutLabel::VtxZ); + + const auto& foundBC = collision.foundBC_as(); + uint64_t timeStamp{foundBC.timestamp()}; + const int magField{getMagneticField(timeStamp)}; + + if (v0Selections.applyPhiCut) { + const int nextRunNumber{foundBC.runNumber()}; + if (currentRunNumberPhiSel != nextRunNumber) { + loadPhiCutSelections(timeStamp); + currentRunNumberPhiSel = nextRunNumber; + LOG(info) << "\tcurrentRunNumberPhiSel= " << currentRunNumberPhiSel << " timeStamp = " << timeStamp; + } + + // return if phi cut objects are nullptr + if (!(phiCut.hPhiCutHigh && phiCut.hPhiCutLow)) + return; + } + + // Remove collisions if reconstructed more than once + if (skipRecoColGTOne && (collisions.size() > kOne)) + continue; + + const auto& centrality{collision.centFT0C()}; + registry.fill(HIST("T0Ccent"), centrality); + + const auto& groupedTracks{tracksMC.sliceBy(perCollision, collision.globalIndex())}; + + // Track selection with Open DCAxy + for (const auto& track : groupedTracks) { + // Track Selection + if (track.eta() < v0Selections.minEtaDaughter || track.eta() > v0Selections.maxEtaDaughter) + continue; + + if (track.pt() < v0Selections.minPt || track.pt() > v0Selections.maxPt) + continue; + + if (!trkSelGlobalOpenDCAxy.IsSelected(track)) + continue; + + if (!track.has_mcParticle()) + continue; + + // Get the MC particle + const auto& particle{track.mcParticle()}; + auto charge{0.}; + auto* pdgParticle = pdg->GetParticle(particle.pdgCode()); + if (pdgParticle != nullptr) + charge = pdgParticle->Charge(); + else + continue; + + // Is it a charged particle? + if (std::abs(charge) < kMinCharge) + continue; + + float phiPrime{track.phi()}; + phiPrimeFunc(phiPrime, magField, charge); + + const float pOrPt{v0Selections.usePinPhiSelection ? track.p() : track.pt()}; + if (v0Selections.applyPhiCut) { + if (!passesPhiSelection(pOrPt, phiPrime)) + continue; + } + + const int16_t nclFound{track.tpcNClsFound()}; + const int16_t nclPID{track.tpcNClsPID()}; + const int16_t ncl = v0Selections.useNclsPID ? nclPID : nclFound; + if (v0Selections.applyNclSel && ncl < v0Selections.minNcl) + continue; + + bool isPrimary{false}; + bool isDecay{false}; + bool isMaterial{false}; + if (particle.isPhysicalPrimary()) + isPrimary = true; + else if (particle.getProcess() == TMCProcess::kPDecay) + isDecay = true; + else + isMaterial = true; + + bool isPi{false}; + bool isPr{false}; + if (particle.pdgCode() == PDG_t::kPiPlus || particle.pdgCode() == PDG_t::kPiMinus) + isPi = true; + else if (particle.pdgCode() == PDG_t::kProton || particle.pdgCode() == PDG_t::kProtonBar) + isPr = true; + else + continue; + + if (isPrimary && !isDecay && !isMaterial) { + if (isPi && !isPr) + registry.fill(HIST("dcaVsPtPi"), track.pt(), track.dcaXY()); + if (isPr && !isPi) + registry.fill(HIST("dcaVsPtPr"), track.pt(), track.dcaXY()); + } + + if (isDecay && !isPrimary && !isMaterial) { + if (isPi && !isPr) + registry.fill(HIST("dcaVsPtPiDec"), track.pt(), track.dcaXY()); + if (isPr && !isPi) + registry.fill(HIST("dcaVsPtPrDec"), track.pt(), track.dcaXY()); + } + + if (isMaterial && !isPrimary && !isDecay) { + if (isPi && !isPr) + registry.fill(HIST("dcaVsPtPiMat"), track.pt(), track.dcaXY()); + if (isPr && !isPi) + registry.fill(HIST("dcaVsPtPrMat"), track.pt(), track.dcaXY()); + } + } + + // Global track + DCAxy selections + for (const auto& track : groupedTracks) { + // Track Selection + if (track.eta() < v0Selections.minEtaDaughter || track.eta() > v0Selections.maxEtaDaughter) + continue; + + if (track.pt() < v0Selections.minPt || track.pt() > v0Selections.maxPt) + continue; + + if (!trkSelGlobal.IsSelected(track)) + continue; + + // Has MC particle? + if (!track.has_mcParticle()) + continue; + + // Get the MC particle + const auto& particle{track.mcParticle()}; + auto charge{0.}; + auto* pdgParticle = pdg->GetParticle(particle.pdgCode()); + if (pdgParticle != nullptr) + charge = pdgParticle->Charge(); + else + continue; + + // Is it a charged particle? + if (std::abs(charge) < kMinCharge) + continue; + + float phiPrime{track.phi()}; + phiPrimeFunc(phiPrime, magField, charge); + + const float pOrPt{v0Selections.usePinPhiSelection ? track.p() : track.pt()}; + if (v0Selections.applyPhiCut) { + if (!passesPhiSelection(pOrPt, phiPrime)) + continue; + } + + const int16_t nclFound{track.tpcNClsFound()}; + const int16_t nclPID{track.tpcNClsPID()}; + const int16_t ncl = v0Selections.useNclsPID ? nclPID : nclFound; + if (v0Selections.applyNclSel && ncl < v0Selections.minNcl) + continue; + + int indexEta{-999}; + const float eta{track.eta()}; + for (int i = 0; i < kNEtaHists; ++i) { + if (eta >= kLowEta[i] && eta < kHighEta[i]) { + indexEta = i; + break; + } + } + + if (indexEta < kZeroInt || indexEta > kSevenInt) + continue; + + registry.fill(HIST("NclVsPhip"), pOrPt, phiPrime, ncl); + registry.fill(HIST("NclVsEtaPID"), eta, ncl); + registry.fill(HIST("NclVsEtaPIDp"), eta, ncl); + nClVsP[indexEta]->Fill(pOrPt, ncl); + nClVsPp[indexEta]->Fill(pOrPt, ncl); + + bool isPrimary{false}; + if (particle.isPhysicalPrimary()) + isPrimary = true; + + if (!isPrimary) + continue; + + bool isPi{false}; + bool isKa{false}; + bool isPr{false}; + + if (particle.pdgCode() == PDG_t::kPiPlus || particle.pdgCode() == PDG_t::kPiMinus) + isPi = true; + else if (particle.pdgCode() == PDG_t::kKPlus || particle.pdgCode() == PDG_t::kKMinus) + isKa = true; + else if (particle.pdgCode() == PDG_t::kProton || particle.pdgCode() == PDG_t::kProtonBar) + isPr = true; + else + continue; + + if (isPi && !isKa && !isPr) + registry.fill(HIST("PtPiVsCent"), track.pt(), centrality); + if (isKa && !isPi && !isPr) + registry.fill(HIST("PtKaVsCent"), track.pt(), centrality); + if (isPr && !isPi && !isKa) + registry.fill(HIST("PtPrVsCent"), track.pt(), centrality); + } + + // Generated MC + for (const auto& particle : mcParticles) { + if (particle.eta() < v0Selections.minEtaDaughter || particle.eta() > v0Selections.maxEtaDaughter) + continue; + + if (particle.pt() < v0Selections.minPt || particle.pt() > v0Selections.maxPt) + continue; + + auto charge{0.}; + // Get the MC particle + auto* pdgParticle = pdg->GetParticle(particle.pdgCode()); + if (pdgParticle != nullptr) + charge = pdgParticle->Charge(); + else + continue; + + // Is it a charged particle? + if (std::abs(charge) < kMinCharge) + continue; + + // Is it a primary particle? + bool isPrimary{true}; + if (!particle.isPhysicalPrimary()) + isPrimary = false; + + if (isPrimary) { + if (particle.pdgCode() == PDG_t::kPiPlus || particle.pdgCode() == PDG_t::kPiMinus) // pion + registry.fill(HIST("PtPiVsCentMC"), particle.pt(), centrality); + else if (particle.pdgCode() == PDG_t::kKPlus || particle.pdgCode() == PDG_t::kKMinus) // kaon + registry.fill(HIST("PtKaVsCentMC"), particle.pt(), centrality); + else if (particle.pdgCode() == PDG_t::kProton || particle.pdgCode() == PDG_t::kProtonBar) // proton + registry.fill(HIST("PtPrVsCentMC"), particle.pt(), centrality); + else + continue; + } + } + } // Collisions + } + PROCESS_SWITCH(PiKpRAA, processMC, "Process MC closure", false); + template void getArmeterosVariables(const T& ppos, const T& pneg, U& alpha, U& qT) { From e1e742a552a998775ee3c869e30bf3f127abac8a Mon Sep 17 00:00:00 2001 From: Rashi gupta <167059733+rashigupt@users.noreply.github.com> Date: Tue, 30 Sep 2025 18:24:04 +0530 Subject: [PATCH 577/986] [PWGHF] correctly define grandmother in MC Gen (#13153) --- .../electronSelectionWithTpcEmcal.cxx | 137 +++++++++--------- 1 file changed, 72 insertions(+), 65 deletions(-) diff --git a/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx b/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx index 7edfc393c8f..e890bbe72d7 100644 --- a/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx +++ b/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx @@ -567,100 +567,107 @@ struct HfElectronSelectionWithTpcEmcal { bool isEmbPi0 = false; // Check first mother - auto const& mother = particleMc.mothers_first_as(); - - if (std::abs(mother.pdgCode()) == kEta || std::abs(mother.pdgCode()) == kPi0 || std::abs(mother.pdgCode()) == kGamma) { - registry.fill(HIST("hMcgenAllNonHfeElectron"), particleMc.pt()); - auto const& gmother = mother.mothers_first_as(); - auto const& ggmother = gmother.mothers_first_as(); - auto const& gggmother = ggmother.mothers_first_as(); - - // cases to consider: eta->e, eta->pi0->e, eta->gamma->e, eta->pi0->gamma->e, pi0->e, pi0->gamma->e - - //================= eta->e ====================================== - if (std::abs(mother.pdgCode()) == kEta) { - if (mother.isPhysicalPrimary()) { - if ((std::abs(gmother.pdgCode()) >= pdgCodeCharmMin && std::abs(gmother.pdgCode()) < pdgCodeCharmMax) || - (std::abs(gmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(gmother.pdgCode()) < pdgCodeBeautyMax)) { - continue; - } - isEmbEta = true; - } - } - //================= eta->pi0->e ====================================== + if (particleMc.has_mothers()) { + auto const& mother = particleMc.mothers_first_as(); - if (std::abs(mother.pdgCode()) == kPi0) { - if (mother.isPhysicalPrimary()) { - if ((std::abs(gmother.pdgCode()) >= pdgCodeCharmMin && std::abs(gmother.pdgCode()) < pdgCodeCharmMax) || - (std::abs(gmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(gmother.pdgCode()) < pdgCodeBeautyMax)) { - continue; - } - isEmbPi0 = true; // pi0 -> e - } + if (std::abs(mother.pdgCode()) == kEta || std::abs(mother.pdgCode()) == kPi0 || std::abs(mother.pdgCode()) == kGamma) { + + registry.fill(HIST("hMcgenAllNonHfeElectron"), particleMc.pt()); + + auto const& gmother = mother.mothers_first_as(); + // cases to consider: eta->e, eta->pi0->e, eta->gamma->e, eta->pi0->gamma->e, pi0->e, pi0->gamma->e - if (std::abs(gmother.pdgCode()) == kEta) { - if (gmother.isPhysicalPrimary()) { - if ((std::abs(ggmother.pdgCode()) >= pdgCodeCharmMin && std::abs(ggmother.pdgCode()) < pdgCodeCharmMax) || - (std::abs(ggmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(ggmother.pdgCode()) < pdgCodeBeautyMax)) { + //================= eta->e ====================================== + if (std::abs(mother.pdgCode()) == kEta) { + + if (mother.isPhysicalPrimary()) { + if ((std::abs(gmother.pdgCode()) >= pdgCodeCharmMin && std::abs(gmother.pdgCode()) < pdgCodeCharmMax) || + (std::abs(gmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(gmother.pdgCode()) < pdgCodeBeautyMax)) { continue; } - isEmbEta = true; // eta->pi0-> e + isEmbEta = true; } } - } - /// ==================================== eta->gamma->e and eta->pi0->gamma->e============ - if (std::abs(mother.pdgCode()) == kGamma) { - if (std::abs(gmother.pdgCode()) == kEta) { - if (gmother.isPhysicalPrimary()) { - if ((std::abs(ggmother.pdgCode()) >= pdgCodeCharmMin && std::abs(ggmother.pdgCode()) < pdgCodeCharmMax) || - (std::abs(ggmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(ggmother.pdgCode()) < pdgCodeBeautyMax)) { + //================= eta->pi0->e ====================================== + + if (std::abs(mother.pdgCode()) == kPi0) { + if (mother.isPhysicalPrimary()) { + if ((std::abs(gmother.pdgCode()) >= pdgCodeCharmMin && std::abs(gmother.pdgCode()) < pdgCodeCharmMax) || + (std::abs(gmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(gmother.pdgCode()) < pdgCodeBeautyMax)) { continue; } - isEmbEta = true; // eta->gamma-> e + isEmbPi0 = true; // pi0 -> e + } + if (std::abs(gmother.pdgCode()) == kEta) { + if (gmother.isPhysicalPrimary() || gmother.has_mothers()) { + auto const& ggmother = gmother.mothers_first_as(); + if ((std::abs(ggmother.pdgCode()) >= pdgCodeCharmMin && std::abs(ggmother.pdgCode()) < pdgCodeCharmMax) || + (std::abs(ggmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(ggmother.pdgCode()) < pdgCodeBeautyMax)) { + continue; + } + isEmbEta = true; // eta->pi0-> e + } } } - if (std::abs(gmother.pdgCode()) == kPi0) { - if (gmother.isPhysicalPrimary()) { - if ((std::abs(ggmother.pdgCode()) >= pdgCodeCharmMin && std::abs(ggmother.pdgCode()) < pdgCodeCharmMax) || - (std::abs(ggmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(ggmother.pdgCode()) < pdgCodeBeautyMax)) { - continue; + /// ==================================== eta->gamma->e and eta->pi0->gamma->e============ + if (std::abs(mother.pdgCode()) == kGamma) { + + if (std::abs(gmother.pdgCode()) == kEta) { + if (gmother.isPhysicalPrimary() || gmother.has_mothers()) { + auto const& ggmother = gmother.mothers_first_as(); + if ((std::abs(ggmother.pdgCode()) >= pdgCodeCharmMin && std::abs(ggmother.pdgCode()) < pdgCodeCharmMax) || + (std::abs(ggmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(ggmother.pdgCode()) < pdgCodeBeautyMax)) { + continue; + } + isEmbEta = true; // eta->gamma-> e } - isEmbPi0 = true; // pi0-> gamma-> e } - - if (std::abs(ggmother.pdgCode()) == kEta) { - if (ggmother.isPhysicalPrimary()) { - if ((std::abs(gggmother.pdgCode()) >= pdgCodeCharmMin && std::abs(gggmother.pdgCode()) < pdgCodeCharmMax) || - (std::abs(gggmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(gggmother.pdgCode()) < pdgCodeBeautyMax)) { + if (std::abs(gmother.pdgCode()) == kPi0) { + if (gmother.isPhysicalPrimary() || gmother.has_mothers()) { + auto const& ggmother = gmother.mothers_first_as(); + if ((std::abs(ggmother.pdgCode()) >= pdgCodeCharmMin && std::abs(ggmother.pdgCode()) < pdgCodeCharmMax) || + (std::abs(ggmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(ggmother.pdgCode()) < pdgCodeBeautyMax)) { continue; } - isEmbEta = true; // eta->pi0->gamma-> e + isEmbPi0 = true; // pi0-> gamma-> e + } + if (gmother.has_mothers()) { + auto const& ggmother = gmother.mothers_first_as(); + if (std::abs(ggmother.pdgCode()) == kEta) { + if (ggmother.isPhysicalPrimary() || ggmother.has_mothers()) { + auto const& gggmother = ggmother.mothers_first_as(); + if ((std::abs(gggmother.pdgCode()) >= pdgCodeCharmMin && std::abs(gggmother.pdgCode()) < pdgCodeCharmMax) || + (std::abs(gggmother.pdgCode()) >= pdgCodeBeautyMin && std::abs(gggmother.pdgCode()) < pdgCodeBeautyMax)) { + continue; + } + isEmbEta = true; // eta->pi0->gamma-> e + } + } } } } - } - if (isEmbPi0 || isEmbEta) { - registry.fill(HIST("hMcgenNonHfeElectron"), particleMc.pt()); - isNonHfe = true; - if (isEmbPi0) { + if (isEmbPi0 || isEmbEta) { + registry.fill(HIST("hMcgenNonHfeElectron"), particleMc.pt()); + isNonHfe = true; + if (isEmbPi0) { - registry.fill(HIST("hPi0eEmbTrkPt"), particleMc.pt()); - } - if (isEmbEta) { - registry.fill(HIST("hEtaeEmbTrkPt"), particleMc.pt()); + registry.fill(HIST("hPi0eEmbTrkPt"), particleMc.pt()); + } + if (isEmbEta) { + registry.fill(HIST("hEtaeEmbTrkPt"), particleMc.pt()); + } } } } - hfGenElectronSel(mcCollision.globalIndex(), particleMc.globalIndex(), particleMc.eta(), particleMc.phi(), particleMc.pt(), isNonHfe); } } } - PROCESS_SWITCH(HfElectronSelectionWithTpcEmcal, processMcGen, "Process MC Gen mode", false); }; + WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; From f44171a57df477f06fc6fa6cda1524213ea8cfb8 Mon Sep 17 00:00:00 2001 From: Samuele Cattaruzzi <124249902+scattaru@users.noreply.github.com> Date: Tue, 30 Sep 2025 14:55:18 +0200 Subject: [PATCH 578/986] [PWGHF] Added particle sepatartion ULS and LS in MC process (#13125) --- .../HFC/TableProducer/correlatorDsHadrons.cxx | 67 +++++++++++++------ 1 file changed, 47 insertions(+), 20 deletions(-) diff --git a/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx index 95a8e003906..6b171bb23df 100644 --- a/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx @@ -317,6 +317,10 @@ struct HfCorrelatorDsHadrons { registry.add("hCorrAllPrimaryKaons", "Ds-kaon correlations MC Gen", {HistType::kTH3F, {{axisPhi}, {axisPtD}, {axisPtHadron}}}); registry.add("hCorrAllPrimaryProtons", "Ds-proton correlations MC Gen", {HistType::kTH3F, {{axisPhi}, {axisPtD}, {axisPtHadron}}}); registry.add("hFakeCollision", "Fake collision counter", {HistType::kTH1F, {{1, -0.5, 0.5, "n fake coll"}}}); + if (pidTrkApplied) { + registry.add("hCorrKaonsLSPairs", "Ds-kaon correlations LS MC Gen", {HistType::kTH3F, {{axisPhi}, {axisPtD}, {axisPtHadron}}}); + registry.add("hCorrKaonsULSPairs", "Ds-kaon correlations ULS MC Gen", {HistType::kTH3F, {{axisPhi}, {axisPtD}, {axisPtHadron}}}); + } } } @@ -423,6 +427,8 @@ struct HfCorrelatorDsHadrons { if (applyEfficiency) { efficiencyWeightD = 1. / efficiencyD->at(o2::analysis::findBin(binsPtEfficiencyD, candidate.pt())); } + auto prong0 = candidate.template prong0_as(); + int chargeDs = prong0.sign(); std::vector outputMl = {-1., -1., -1.}; fillHisto(candidate); if (candidate.isSelDsToKKPi() >= selectionFlagDs) { @@ -430,13 +436,13 @@ struct HfCorrelatorDsHadrons { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDsToKKPi()[classMl->at(iclass)]; } - entryDsCandRecoInfo(hfHelper.invMassDsToKKPi(candidate), candidate.pt(), outputMl[0], outputMl[2], collision.numContrib()); + entryDsCandRecoInfo(hfHelper.invMassDsToKKPi(candidate), candidate.pt() * chargeDs, outputMl[0], outputMl[2], collision.numContrib()); } else if (candidate.isSelDsToPiKK() >= selectionFlagDs) { fillHistoPiKK(candidate, efficiencyWeightD); for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDsToPiKK()[classMl->at(iclass)]; } - entryDsCandRecoInfo(hfHelper.invMassDsToPiKK(candidate), candidate.pt(), outputMl[0], outputMl[2], collision.numContrib()); + entryDsCandRecoInfo(hfHelper.invMassDsToPiKK(candidate), candidate.pt() * chargeDs, outputMl[0], outputMl[2], collision.numContrib()); } if (candidate.isSelDsToKKPi() >= selectionFlagDs && candidate.isSelDsToPiKK() >= selectionFlagDs) { registry.fill(HIST("hCountSelectionStatusDsToKKPiAndToPiKK"), 0.); @@ -457,8 +463,8 @@ struct HfCorrelatorDsHadrons { if (candidate.isSelDsToKKPi() >= selectionFlagDs) { entryDsHadronPair(getDeltaPhi(track.phi(), candidate.phi()), track.eta() - candidate.eta(), - candidate.pt(), - track.pt(), + candidate.pt() * chargeDs, + track.pt() * track.sign(), poolBin, collision.numContrib()); entryDsHadronRecoInfo(hfHelper.invMassDsToKKPi(candidate), false, false); @@ -468,8 +474,8 @@ struct HfCorrelatorDsHadrons { } else if (candidate.isSelDsToPiKK() >= selectionFlagDs) { entryDsHadronPair(getDeltaPhi(track.phi(), candidate.phi()), track.eta() - candidate.eta(), - candidate.pt(), - track.pt(), + candidate.pt() * chargeDs, + track.pt() * track.sign(), poolBin, collision.numContrib()); entryDsHadronRecoInfo(hfHelper.invMassDsToPiKK(candidate), false, false); @@ -521,6 +527,8 @@ struct HfCorrelatorDsHadrons { } std::vector outputMl = {-1., -1., -1.}; + auto prong0 = candidate.template prong0_as(); + int chargeDs = prong0.sign(); if (isDsSignal && isDecayChan && isCorrectInvMassHypo) { fillHistoMcRecSig(candidate, multiplicityFT0M); @@ -532,7 +540,7 @@ struct HfCorrelatorDsHadrons { registry.fill(HIST("hMassDsMcRecSig"), hfHelper.invMassDsToKKPi(candidate), candidate.pt(), efficiencyWeightD); registry.fill(HIST("hMassDsVsPtMcRec"), hfHelper.invMassDsToKKPi(candidate), candidate.pt(), efficiencyWeightD); registry.fill(HIST("hSelectionStatusDsToKKPiMcRec"), candidate.isSelDsToKKPi()); - entryDsCandRecoInfo(hfHelper.invMassDsToKKPi(candidate), candidate.pt(), outputMl[0], outputMl[2], collision.numContrib()); + entryDsCandRecoInfo(hfHelper.invMassDsToKKPi(candidate), candidate.pt() * chargeDs, outputMl[0], outputMl[2], collision.numContrib()); entryDsCandGenInfo(isDsPrompt); } else if (candidate.isSelDsToPiKK() >= selectionFlagDs) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { @@ -542,7 +550,7 @@ struct HfCorrelatorDsHadrons { registry.fill(HIST("hMassDsMcRecSig"), hfHelper.invMassDsToPiKK(candidate), candidate.pt(), efficiencyWeightD); registry.fill(HIST("hMassDsVsPtMcRec"), hfHelper.invMassDsToPiKK(candidate), candidate.pt(), efficiencyWeightD); registry.fill(HIST("hSelectionStatusDsToPiKKMcRec"), candidate.isSelDsToPiKK()); - entryDsCandRecoInfo(hfHelper.invMassDsToPiKK(candidate), candidate.pt(), outputMl[0], outputMl[2], collision.numContrib()); + entryDsCandRecoInfo(hfHelper.invMassDsToPiKK(candidate), candidate.pt() * chargeDs, outputMl[0], outputMl[2], collision.numContrib()); entryDsCandGenInfo(isDsPrompt); } } else { @@ -582,8 +590,8 @@ struct HfCorrelatorDsHadrons { if (isCorrectInvMassHypo && candidate.isSelDsToKKPi() >= selectionFlagDs) { entryDsHadronPair(getDeltaPhi(track.phi(), candidate.phi()), track.eta() - candidate.eta(), - candidate.pt(), - track.pt(), + candidate.pt() * chargeDs, + track.pt() * track.sign(), poolBin, collision.numContrib()); entryDsHadronRecoInfo(hfHelper.invMassDsToKKPi(candidate), isDsSignal, isDecayChan); @@ -608,8 +616,8 @@ struct HfCorrelatorDsHadrons { } else if (isCorrectInvMassHypo && candidate.isSelDsToPiKK() >= selectionFlagDs) { entryDsHadronPair(getDeltaPhi(track.phi(), candidate.phi()), track.eta() - candidate.eta(), - candidate.pt(), - track.pt(), + candidate.pt() * chargeDs, + track.pt() * track.sign(), poolBin, collision.numContrib()); entryDsHadronRecoInfo(hfHelper.invMassDsToPiKK(candidate), isDsSignal, isDecayChan); @@ -703,11 +711,19 @@ struct HfCorrelatorDsHadrons { listDaughters.clear(); RecoDecay::getDaughters(particle, &listDaughters, arrDaughDsPDG, 2); int counterDaughters = 0; + int chargeDs = 0; if (listDaughters.size() == NDaughtersDs) { for (const auto& dauIdx : listDaughters) { // auto daughI = mcParticles.rawIteratorAt(dauIdx - mcParticles.offset()); auto daughI = groupedMcParticles.rawIteratorAt(dauIdx - groupedMcParticles.offset()); counterDaughters += 1; + if (counterDaughters == 1) { + if (daughI.pdgCode() == kKPlus) { + chargeDs = 1; + } else { + chargeDs = -1; + } + } prongsId[counterDaughters - 1] = daughI.globalIndex(); } } @@ -738,6 +754,13 @@ struct HfCorrelatorDsHadrons { registry.fill(HIST("hCorrAllPrimaryHadrons"), getDeltaPhi(particleAssoc.phi(), particle.phi()), particle.pt(), particleAssoc.pt()); registry.fill(HIST("hCorrAllPrimaryProtons"), getDeltaPhi(particleAssoc.phi(), particle.phi()), particle.pt(), particleAssoc.pt()); } + if (pidTrkApplied) { + if (((chargeDs == 1) && (particleAssoc.pdgCode() == kKPlus)) || ((chargeDs == -1) && (particleAssoc.pdgCode() == kKMinus))) { // LS pairs + registry.fill(HIST("hCorrKaonsLSPairs"), getDeltaPhi(particleAssoc.phi(), particle.phi()), particle.pt(), particleAssoc.pt()); + } else { // ULS pairs + registry.fill(HIST("hCorrKaonsULSPairs"), getDeltaPhi(particleAssoc.phi(), particle.phi()), particle.pt(), particleAssoc.pt()); + } + } } // trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, particleAssoc, true); @@ -844,14 +867,16 @@ struct HfCorrelatorDsHadrons { if (!pAssoc.isGlobalTrackWoDCA()) { continue; } + auto prong0 = cand.template prong0_as(); + int chargeDs = prong0.sign(); std::vector outputMl = {-1., -1., -1.}; // DsToKKPi and DsToPiKK division if (cand.isSelDsToKKPi() >= selectionFlagDs) { // LOGF(info, "Mixed event tracks pair: (%d, %d) from events (%d, %d), track event: (%d, %d), KKPi", cand.index(), pAssoc.index(), c1.index(), c2.index(), cand.collision().index(), pAssoc.collision().index()); entryDsHadronPair(getDeltaPhi(pAssoc.phi(), cand.phi()), pAssoc.eta() - cand.eta(), - cand.pt(), - pAssoc.pt(), + cand.pt() * chargeDs, + pAssoc.pt() * pAssoc.sign(), poolBin, c1.numContrib()); entryDsHadronRecoInfo(hfHelper.invMassDsToKKPi(cand), false, false); @@ -865,8 +890,8 @@ struct HfCorrelatorDsHadrons { // LOGF(info, "Mixed event tracks pair: (%d, %d) from events (%d, %d), track event: (%d, %d), PiKK", cand.index(), pAssoc.index(), c1.index(), c2.index(), cand.collision().index(), pAssoc.collision().index()); entryDsHadronPair(getDeltaPhi(pAssoc.phi(), cand.phi()), pAssoc.eta() - cand.eta(), - cand.pt(), - pAssoc.pt(), + cand.pt() * chargeDs, + pAssoc.pt() * pAssoc.sign(), poolBin, c1.numContrib()); entryDsHadronRecoInfo(hfHelper.invMassDsToPiKK(cand), false, false); @@ -925,6 +950,8 @@ struct HfCorrelatorDsHadrons { if (!pAssoc.isGlobalTrackWoDCA()) { continue; } + auto prong0 = candidate.template prong0_as(); + int chargeDs = prong0.sign(); std::vector outputMl = {-1., -1., -1.}; // prompt and non-prompt division isDsPrompt = candidate.originMcRec() == RecoDecay::OriginType::Prompt; @@ -942,8 +969,8 @@ struct HfCorrelatorDsHadrons { if (candidate.isSelDsToKKPi() >= selectionFlagDs) { entryDsHadronPair(getDeltaPhi(pAssoc.phi(), candidate.phi()), pAssoc.eta() - candidate.eta(), - candidate.pt(), - pAssoc.pt(), + candidate.pt() * chargeDs, + pAssoc.pt() * pAssoc.sign(), poolBin, c1.numContrib()); entryDsHadronRecoInfo(hfHelper.invMassDsToKKPi(candidate), isDsSignal, isDecayChan); @@ -956,8 +983,8 @@ struct HfCorrelatorDsHadrons { } else if (candidate.isSelDsToPiKK() >= selectionFlagDs) { entryDsHadronPair(getDeltaPhi(pAssoc.phi(), candidate.phi()), pAssoc.eta() - candidate.eta(), - candidate.pt(), - pAssoc.pt(), + candidate.pt() * chargeDs, + pAssoc.pt() * pAssoc.sign(), poolBin, c1.numContrib()); entryDsHadronRecoInfo(hfHelper.invMassDsToPiKK(candidate), isDsSignal, isDecayChan); From 1690c9ed136642cd6510a805558551e3977f16bd Mon Sep 17 00:00:00 2001 From: Ravindra Singh <56298081+singhra1994@users.noreply.github.com> Date: Tue, 30 Sep 2025 14:57:00 +0200 Subject: [PATCH 579/986] [PWGHF] added Lambda0 processes to calculate data driven efficiency (#13167) Co-authored-by: ALICE Action Bot --- .../TableProducer/correlatorLcScHadrons.cxx | 216 ++++++++++++++++++ 1 file changed, 216 insertions(+) diff --git a/PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx index 7ce63015c54..a7f0d4846d2 100644 --- a/PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx @@ -265,9 +265,32 @@ struct HfCorrelatorLcScHadrons { Configurable calEffEventWithCand{"calEffEventWithCand", true, "Calculate the efficiency of Lc candidate"}; Configurable eventFractionToAnalyze{"eventFractionToAnalyze", -1, "Fraction of events to analyze (use only for ME offline on very large samples)"}; + struct : ConfigurableGroup { + Configurable cfgDaughPrPtMax{"cfgDaughPrPtMax", 5., "max. pT Daughter Proton"}; + Configurable cfgDaughPrPtMin{"cfgDaughPrPtMin", 0.3, "min. pT Daughter Proton"}; + Configurable cfgDaughPiPtMax{"cfgDaughPiPtMax", 10., "max. pT Daughter Pion"}; + Configurable cfgDaughPiPtMin{"cfgDaughPiPtMin", 0.3, "min. pT Daughter Pion"}; + Configurable cfgDaughPIDCutsTPCPr{"cfgDaughPIDCutsTPCPr", 3., "max. TPCnSigma Proton"}; + Configurable cfgDaughPIDCutsTPCPi{"cfgDaughPIDCutsTPCPi", 2., "max. TPCnSigma Pion"}; + Configurable cfgDaughPIDCutsTOFPi{"cfgDaughPIDCutsTOFPi", 2., "max. TOFnSigma Pion"}; + + Configurable cfgV0radiusMin{"cfgV0radiusMin", 1.2, "minimum decay radius"}; + Configurable cfgDCAPosToPVMin{"cfgDCAPosToPVMin", 0.05, "minimum DCA to PV for positive track"}; + Configurable cfgDCANegToPVMin{"cfgDCANegToPVMin", 0.2, "minimum DCA to PV for negative track"}; + Configurable cfgV0CosPA{"cfgV0CosPA", 0.995, "minimum v0 cosine"}; + Configurable cfgDCAV0Dau{"cfgDCAV0Dau", 1.0, "maximum DCA between daughters"}; + Configurable cfgHypMassWindow{"cfgHypMassWindow", 0.5, "single lambda mass selection"}; + Configurable cfgV0PtMin{"cfgV0PtMin", 0, "minimum pT for lambda"}; + Configurable cfgV0LifeTime{"cfgV0LifeTime", 30., "maximum lambda lifetime"}; + Configurable cfgPV{"cfgPV", 10., "maximum z-vertex"}; + Configurable cfgMaxOccupancy{"cfgMaxOccupancy", 999999, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; + Configurable cfgMinOccupancy{"cfgMinOccupancy", 0, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; + } cfgV0; + HfHelper hfHelper; SliceCache cache; Service pdg; + double massLambda = o2::constants::physics::MassLambda; int8_t chargeCand = 3; int8_t signSoftPion = 0; int leadingIndex = 0; @@ -306,6 +329,7 @@ struct HfCorrelatorLcScHadrons { // Tracks used in Data and MC using TracksData = soa::Filtered>; // trackFilter applied using TracksWithMc = soa::Filtered>; // trackFilter applied + // Filters for ME Filter collisionFilter = aod::hf_selection_lc_collision::lcSel == true; Filter lcFilter = ((o2::aod::hf_track_index::hfflag & static_cast(1 << aod::hf_cand_3prong::DecayType::LcToPKPi)) != static_cast(0)) && (aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLc); @@ -345,6 +369,8 @@ struct HfCorrelatorLcScHadrons { AxisSpec axisPoolBin = {binsPoolBin, "PoolBin"}; AxisSpec axisRapidity = {100, -2, 2, "Rapidity"}; AxisSpec axisSign = {5, -2.5, 2.5, "Sign"}; + AxisSpec axisPtV0 = {500, 0., 50.0, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec axisMassV0 = {200, 0.9f, 1.2f, "inv. mass (p #pi) (GeV/#it{c}^{2})"}; registry.add("hPtCand", "Lc,Hadron candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPtLc}}); registry.add("hPtProng0", "Lc,Hadron candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPtLc}}); @@ -403,6 +429,17 @@ struct HfCorrelatorLcScHadrons { registry.add("hPhiMcGen", "Lc,Hadron particles - MC Gen", {HistType::kTH1F, {axisPhi}}); registry.add("hMultFT0AMcGen", "Lc,Hadron multiplicity FT0A - MC Gen", {HistType::kTH1F, {axisMultiplicity}}); + // Lambda V0 histograms + registry.add("hEventLambdaV0", "Lambda, events", {HistType::kTH1F, {{2, 0, 2}}}); + registry.add("hV0Lambda", "V0 Lambda candidates;inv. mass (p #pi) (GeV/#it{c}^{2});GeV/#it{c};GeV/#it{c}", {HistType::kTH3F, {{axisMassV0}, {axisPtV0}, {axisPtHadron}}}); + registry.add("hV0LambdaRefl", "V0 Lambda reflected candidates;inv. mass (p #pi) (GeV/#it{c}^{2});GeV/#it{c};GeV/#it{c}", {HistType::kTH3F, {{axisMassV0}, {axisPtV0}, {axisPtHadron}}}); + registry.add("hV0LambdaPiKRej", "V0 Lambda candidates with #pi K rejection;inv. mass (p #pi) (GeV/#it{c}^{2});GeV/#it{c};GeV/#it{c}", {HistType::kTH3F, {{axisMassV0}, {axisPtV0}, {axisPtHadron}}}); + registry.add("hV0LambdaReflPiKRej", "V0 Lambda reflected candidates with #pi K rejection;inv. mass (p #pi) (GeV/#it{c}^{2});GeV/#it{c};GeV/#it{c}", {HistType::kTH3F, {{axisMassV0}, {axisPtV0}, {axisPtHadron}}}); + registry.add("hV0LambdaMcRec", "McRec V0 Lambda candidates;inv. mass (p #pi) (GeV/#it{c}^{2});GeV/#it{c};GeV/#it{c}", {HistType::kTH3F, {{axisMassV0}, {axisPtV0}, {axisPtHadron}}}); + registry.add("hV0LambdaReflMcRec", "McRec V0 Lambda reflected candidates;inv. mass (p #pi) (GeV/#it{c}^{2});GeV/#it{c};GeV/#it{c}", {HistType::kTH3F, {{axisMassV0}, {axisPtV0}, {axisPtHadron}}}); + registry.add("hV0LambdaPiKRejMcRec", "McRec V0 Lambda candidates with #pi K rejection;inv. mass (p #pi) (GeV/#it{c}^{2});GeV/#it{c};GeV/#it{c}", {HistType::kTH3F, {{axisMassV0}, {axisPtV0}, {axisPtHadron}}}); + registry.add("hV0LambdaReflPiKRejMcRec", "McRec V0 Lambda reflected candidates with #pi K rejection;inv. mass (p #pi) (GeV/#it{c}^{2});GeV/#it{c};GeV/#it{c}", {HistType::kTH3F, {{axisMassV0}, {axisPtV0}, {axisPtHadron}}}); + corrBinning = {{binsZVtx, binsMultiplicity}, true}; } @@ -433,6 +470,159 @@ struct HfCorrelatorLcScHadrons { return y; } + template + bool selectionV0(TCollision const& collision, V0 const& candidate) + { + if (candidate.v0radius() < cfgV0.cfgV0radiusMin) { + return false; + } + if (std::abs(candidate.dcapostopv()) < cfgV0.cfgDCAPosToPVMin) { + return false; + } + if (std::abs(candidate.dcanegtopv()) < cfgV0.cfgDCANegToPVMin) { + return false; + } + if (candidate.v0cosPA() < cfgV0.cfgV0CosPA) { + return false; + } + if (std::abs(candidate.dcaV0daughters()) > cfgV0.cfgDCAV0Dau) { + return false; + } + if (candidate.pt() < cfgV0.cfgV0PtMin) { + return false; + } + if (std::abs(candidate.yLambda()) > yCandMax) { + return false; + } + if (candidate.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * massLambda > cfgV0.cfgV0LifeTime) { + return false; + } + + return true; + } + + template + bool isSelectedV0Daughter(T const& track, int pid) + { + // if (!track.isGlobalTrackWoDCA()) + // return false; + if (std::abs(pid) == kProton && std::abs(track.tpcNSigmaPr()) > cfgV0.cfgDaughPIDCutsTPCPr) { + return false; + } + if (std::abs(pid) == kPiPlus && std::abs(track.tpcNSigmaPi()) > cfgV0.cfgDaughPIDCutsTPCPi && std::abs(track.tofNSigmaPi()) > cfgV0.cfgDaughPIDCutsTOFPi) { + return false; + } + if (std::abs(track.eta()) > etaTrackMax) { + return false; + } + if (std::abs(pid) == kProton && track.pt() > cfgV0.cfgDaughPrPtMax) { + return false; + } + if (std::abs(pid) == kProton && track.pt() < cfgV0.cfgDaughPrPtMin) { + return false; + } + if (std::abs(pid) == kPiPlus && track.pt() > cfgV0.cfgDaughPiPtMax) { + return false; + } + if (std::abs(pid) == kPiPlus && track.pt() < cfgV0.cfgDaughPiPtMin) { + return false; + } + + return true; + } + + template + void fillV0Histograms(CollType const& collV0, V0 const& v0s, TrackType const&) + { + for (const auto& v0 : v0s) { + + if (!selectionV0(collV0, v0)) { + continue; + } + + auto posTrackV0 = v0.template posTrack_as(); + auto negTrackV0 = v0.template negTrack_as(); + + if (isSelectedV0Daughter(posTrackV0, kProton) && isSelectedV0Daughter(negTrackV0, kPiPlus)) { + if (std::abs(massLambda - v0.mLambda()) < cfgV0.cfgHypMassWindow) { + registry.fill(HIST("hV0Lambda"), v0.mLambda(), v0.pt(), posTrackV0.pt()); + registry.fill(HIST("hV0LambdaRefl"), v0.mAntiLambda(), v0.pt(), negTrackV0.pt()); + + if (passPIDSelection(posTrackV0, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) { + registry.fill(HIST("hV0LambdaPiKRej"), v0.mLambda(), v0.pt(), posTrackV0.pt()); + registry.fill(HIST("hV0LambdaReflPiKRej"), v0.mAntiLambda(), v0.pt(), negTrackV0.pt()); + } + } + } + if (isSelectedV0Daughter(negTrackV0, kProton) && isSelectedV0Daughter(posTrackV0, kPiPlus)) { + if (std::abs(massLambda - v0.mAntiLambda()) > cfgV0.cfgHypMassWindow) { + registry.fill(HIST("hV0Lambda"), v0.mAntiLambda(), v0.pt(), negTrackV0.pt()); + registry.fill(HIST("hV0LambdaRefl"), v0.mLambda(), v0.pt(), posTrackV0.pt()); + + if (passPIDSelection(negTrackV0, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) { + registry.fill(HIST("hV0LambdaPiKRej"), v0.mAntiLambda(), v0.pt(), negTrackV0.pt()); + registry.fill(HIST("hV0LambdaReflPiKRej"), v0.mLambda(), v0.pt(), posTrackV0.pt()); + } + } + } + if constexpr (isMcRec) { + if (!v0.has_mcParticle() || !posTrackV0.has_mcParticle() || !negTrackV0.has_mcParticle()) { + continue; + } + auto v0Mc = v0.mcParticle(); + auto posTrack = posTrackV0.mcParticle(); + auto negTrack = negTrackV0.mcParticle(); + + if (std::abs(v0Mc.pdgCode()) == kLambda0) { + if (std::abs(posTrack.pdgCode()) == kProton) { + registry.fill(HIST("hV0LambdaMcRec"), v0.mLambda(), v0.pt(), posTrackV0.pt()); + registry.fill(HIST("hV0LambdaReflMcRec"), v0.mAntiLambda(), v0.pt(), negTrackV0.pt()); + + if (passPIDSelection(posTrackV0, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) { + registry.fill(HIST("hV0LambdaPiKRejMcRec"), v0.mLambda(), v0.pt(), posTrackV0.pt()); + registry.fill(HIST("hV0LambdaReflPiKRejMcRec"), v0.mAntiLambda(), v0.pt(), negTrackV0.pt()); + } + } + if (std::abs(negTrack.pdgCode()) == kProton) { + registry.fill(HIST("hV0LambdaMcRec"), v0.mAntiLambda(), v0.pt(), negTrackV0.pt()); + registry.fill(HIST("hV0LambdaReflMcRec"), v0.mLambda(), v0.pt(), posTrackV0.pt()); + + if (passPIDSelection(negTrackV0, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) { + registry.fill(HIST("hV0LambdaPiKRejMcRec"), v0.mAntiLambda(), v0.pt(), negTrackV0.pt()); + registry.fill(HIST("hV0LambdaReflPiKRejMcRec"), v0.mLambda(), v0.pt(), posTrackV0.pt()); + } + } + } + } + } + } + + template + bool eventSelV0(TCollision collision) + { + if (!collision.sel8()) { + return 0; + } + + if (!collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + return 0; + } + if (!collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { + return 0; + } + if (std::abs(collision.posZ()) > cfgV0.cfgPV) { + return 0; + } + if (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return 0; + } + if (collision.trackOccupancyInTimeRange() > cfgV0.cfgMaxOccupancy || collision.trackOccupancyInTimeRange() < cfgV0.cfgMinOccupancy) { + return 0; + } + + return 1; + } // event selection V0 + template void calculateTrkEff(T1 const& trackPos1, T2 const& trackPos2, McPart const& mcParticles) { @@ -1189,6 +1379,32 @@ struct HfCorrelatorLcScHadrons { } } PROCESS_SWITCH(HfCorrelatorLcScHadrons, processMcGenMixedEvent, "Process Mixed Event McGen", false); + + void processDataLambdaV0(soa::Join::iterator const& collision, + TracksData const& tracks, aod::V0Datas const& V0s) + { + registry.fill(HIST("hEventLambdaV0"), 0.5); + if (!eventSelV0(collision)) { + return; + } + registry.fill(HIST("hEventLambdaV0"), 1.5); + + fillV0Histograms(collision, V0s, tracks); + } + PROCESS_SWITCH(HfCorrelatorLcScHadrons, processDataLambdaV0, "Data process for v0 lambda", false); + + void processMcLambdaV0(soa::Join::iterator const& collision, + TracksWithMc const& tracks, soa::Join const& V0s, aod::McParticles const&) + { + registry.fill(HIST("hEventLambdaV0"), 0.5); + if (!eventSelV0(collision)) { + return; + } + registry.fill(HIST("hEventLambdaV0"), 1.5); + + fillV0Histograms(collision, V0s, tracks); + } + PROCESS_SWITCH(HfCorrelatorLcScHadrons, processMcLambdaV0, "Mc process for v0 lambda", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 84af1bc25634aadd6c6069993ae14bef427e2caf Mon Sep 17 00:00:00 2001 From: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Date: Tue, 30 Sep 2025 16:41:22 +0200 Subject: [PATCH 580/986] [PWGCF] use amplitude as correlation weight (#13175) --- .../Tasks/longRangeDihadronCor.cxx | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx b/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx index bcd248c223c..8c9dd20ebb6 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx @@ -577,22 +577,22 @@ struct LongRangeDihadronCor { if (system == SameEvent) { if (corType == kFT0A) { registry.fill(HIST("Assoc_amp_same_TPC_FT0A"), chanelid, ampl); - sameTpcFt0a->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track1.pt(), deltaPhi, deltaEta, eventWeight * triggerWeight); - registry.fill(HIST("deltaEta_deltaPhi_same_TPC_FT0A"), deltaPhi, deltaEta, eventWeight * triggerWeight); + sameTpcFt0a->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track1.pt(), deltaPhi, deltaEta, ampl * eventWeight * triggerWeight); + registry.fill(HIST("deltaEta_deltaPhi_same_TPC_FT0A"), deltaPhi, deltaEta, ampl * eventWeight * triggerWeight); } else if (corType == kFT0C) { registry.fill(HIST("Assoc_amp_same_TPC_FT0C"), chanelid, ampl); - sameTpcFt0c->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track1.pt(), deltaPhi, deltaEta, eventWeight * triggerWeight); - registry.fill(HIST("deltaEta_deltaPhi_same_TPC_FT0C"), deltaPhi, deltaEta, eventWeight * triggerWeight); + sameTpcFt0c->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track1.pt(), deltaPhi, deltaEta, ampl * eventWeight * triggerWeight); + registry.fill(HIST("deltaEta_deltaPhi_same_TPC_FT0C"), deltaPhi, deltaEta, ampl * eventWeight * triggerWeight); } } else if (system == MixedEvent) { if (corType == kFT0A) { registry.fill(HIST("Assoc_amp_mixed_TPC_FT0A"), chanelid, ampl); - mixedTpcFt0a->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track1.pt(), deltaPhi, deltaEta, eventWeight * triggerWeight); - registry.fill(HIST("deltaEta_deltaPhi_mixed_TPC_FT0A"), deltaPhi, deltaEta, eventWeight * triggerWeight); + mixedTpcFt0a->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track1.pt(), deltaPhi, deltaEta, ampl * eventWeight * triggerWeight); + registry.fill(HIST("deltaEta_deltaPhi_mixed_TPC_FT0A"), deltaPhi, deltaEta, ampl * eventWeight * triggerWeight); } else if (corType == kFT0C) { registry.fill(HIST("Assoc_amp_mixed_TPC_FT0C"), chanelid, ampl); - mixedTpcFt0c->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track1.pt(), deltaPhi, deltaEta, eventWeight * triggerWeight); - registry.fill(HIST("deltaEta_deltaPhi_mixed_TPC_FT0C"), deltaPhi, deltaEta, eventWeight * triggerWeight); + mixedTpcFt0c->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track1.pt(), deltaPhi, deltaEta, ampl * eventWeight * triggerWeight); + registry.fill(HIST("deltaEta_deltaPhi_mixed_TPC_FT0C"), deltaPhi, deltaEta, ampl * eventWeight * triggerWeight); } } } @@ -626,11 +626,11 @@ struct LongRangeDihadronCor { float deltaEta = etaA - etaC; // fill the right sparse and histograms if (system == SameEvent) { - sameFt0aFt0c->getPairHist()->Fill(step, fSampleIndex, posZ, 0., 0., deltaPhi, deltaEta, eventWeight * triggerWeight); - registry.fill(HIST("deltaEta_deltaPhi_same_FT0A_FT0C"), deltaPhi, deltaEta, eventWeight * triggerWeight); + sameFt0aFt0c->getPairHist()->Fill(step, fSampleIndex, posZ, 0., 0., deltaPhi, deltaEta, amplA * amplC * eventWeight * triggerWeight); + registry.fill(HIST("deltaEta_deltaPhi_same_FT0A_FT0C"), deltaPhi, deltaEta, amplA * amplC * eventWeight * triggerWeight); } else if (system == MixedEvent) { - mixedFt0aFt0c->getPairHist()->Fill(step, fSampleIndex, posZ, 0., 0., deltaPhi, deltaEta, eventWeight * triggerWeight); - registry.fill(HIST("deltaEta_deltaPhi_mixed_FT0A_FT0C"), deltaPhi, deltaEta, eventWeight * triggerWeight); + mixedFt0aFt0c->getPairHist()->Fill(step, fSampleIndex, posZ, 0., 0., deltaPhi, deltaEta, amplA * amplC * eventWeight * triggerWeight); + registry.fill(HIST("deltaEta_deltaPhi_mixed_FT0A_FT0C"), deltaPhi, deltaEta, amplA * amplC * eventWeight * triggerWeight); } } } From 522436c9e0bf8b441e3f586b09a0e2509c5373c7 Mon Sep 17 00:00:00 2001 From: Gyula Bencedi Date: Tue, 30 Sep 2025 19:18:18 +0200 Subject: [PATCH 581/986] [PWGLF] Added new track selection for reassociation (#13177) --- .../ambiguousTrackPropagation.cxx | 16 + PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx | 651 +++++++++++++----- 2 files changed, 512 insertions(+), 155 deletions(-) diff --git a/PWGMM/Mult/TableProducer/ambiguousTrackPropagation.cxx b/PWGMM/Mult/TableProducer/ambiguousTrackPropagation.cxx index eebaa5595ef..69c0845e0e0 100644 --- a/PWGMM/Mult/TableProducer/ambiguousTrackPropagation.cxx +++ b/PWGMM/Mult/TableProducer/ambiguousTrackPropagation.cxx @@ -76,6 +76,7 @@ struct AmbiguousTrackPropagation { Configurable produceExtra{"produceExtra", false, "Produce table with refitted track parameters"}; Configurable produceHistos{"produceHistos", false, "Produce control histograms"}; + Configurable removeTrivialAssoc{"removeTrivialAssoc", false, "Skip trivial associations"}; ConfigurableAxis binsDCAxy{"binsDCAxy", {200, -1., 1.}, ""}; ConfigurableAxis binsDCAz{"binsDCAz", {200, -1., 1.}, ""}; @@ -108,6 +109,9 @@ struct AmbiguousTrackPropagation { registry.add({"TracksAmbDegree", " ; N_{coll}^{comp}", {HistType::kTH1D, {{41, -0.5, 40.5}}}}); registry.add({"TrackIsAmb", " ; isAmbiguous", {HistType::kTH1D, {{2, -0.5, 1.5}}}}); if (doprocessMFTReassoc3D) { + registry.add({"TracksAmbDegreeWoTrivial", " ; N_{coll}^{comp}", {HistType::kTH1F, {{41, -0.5, 40.5}}}}); + registry.add({"TracksFirstDCAXY", " ; DCA_{XY} (cm)", {HistType::kTH1F, {dcaXYAxis}}}); + registry.add({"TracksFirstDCAZ", " ; DCA_{Z} (cm)", {HistType::kTH1F, {dcaZAxis}}}); registry.add({"TracksDCAZ", " ; DCA_{Z} (cm)", {HistType::kTH1F, {dcaZAxis}}}); registry.add({"ReassignedDCAZ", " ; DCA_{Z} (cm)", {HistType::kTH1F, {dcaZAxis}}}); registry.add({"TracksOrigDCAZ", " ; DCA_{Z} (wrt orig coll) (cm)", {HistType::kTH1F, {dcaZAxis}}}); @@ -437,6 +441,16 @@ struct AmbiguousTrackPropagation { bestDCA[1] = 999.f; // minimal DCAz auto bestCol = track.has_collision() ? track.collisionId() : -1; + + if (removeTrivialAssoc) { + if (track.compatibleCollIds().empty() || (track.compatibleCollIds().size() == 1 && bestCol == track.compatibleCollIds()[0])) { + if (produceHistos) { + registry.fill(HIST("TracksAmbDegreeWoTrivial"), track.compatibleCollIds().size()); + } + continue; + } + } + auto compatibleColls = track.compatibleColl(); std::vector v1; // Temporary null vector for the computation of the covariance matrix @@ -458,6 +472,8 @@ struct AmbiguousTrackPropagation { } if ((track.collisionId() != collision.globalIndex()) && produceHistos) { registry.fill(HIST("DeltaZ"), track.collision().posZ() - collision.posZ()); // deltaZ between the 1st coll zvtx and the other compatible ones + registry.fill(HIST("TracksFirstDCAXY"), dcaInfo[0]); + registry.fill(HIST("TracksFirstDCAZ"), dcaInfo[1]); } if (produceHistos) { registry.fill(HIST("TracksDCAXY"), dcaInfo[0]); diff --git a/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx b/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx index d15ec15864d..44904fffb38 100644 --- a/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx +++ b/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx @@ -59,11 +59,10 @@ using namespace pwgmm::mult; using namespace o2::aod::rctsel; auto static constexpr kMinCharge = 3.f; +auto static constexpr kNumDecay = 4; enum TrkSel { trkSelAll, - trkSelWoAmbiguous, - trkSelNumReassoc, trkSelNCls, trkSelChi2Ncl, trkSelEta, @@ -73,6 +72,13 @@ enum TrkSel { nTrkSel }; +enum TrkAmbSel { + trkSelAmbiguousAll, + trkSelWoAmbiguous, + trkSelNumReassoc, + nTrkAmbSel +}; + struct DndetaMFTPbPb { SliceCache cache; @@ -95,6 +101,7 @@ struct DndetaMFTPbPb { Configurable cfgIRCrashOnNull{"cfgIRCrashOnNull", false, "Flag to avoid CTP RateFetcher crash"}; Configurable cfgIRSource{"cfgIRSource", "ZNC hadronic", "Estimator of the interaction rate (Pb-Pb: ZNC hadronic)"}; Configurable cfgUseTrackSel{"cfgUseTrackSel", false, "Flag to apply track selection"}; + Configurable cfgUseParticleSel{"cfgUseParticleSel", false, "Flag to apply particle selection"}; struct : ConfigurableGroup { ConfigurableAxis interactionRateBins{"interactionRateBins", {500, 0, 50}, "Binning for the interaction rate (kHz)"}; @@ -175,6 +182,11 @@ struct DndetaMFTPbPb { TH2* gCurrentHadronicRate; RCTFlagsChecker rctChecker; + std::vector ambiguousTrkIds; + std::vector reassignedTrkIds; + std::vector ambiguousTrkIdsMC; + std::vector reassignedTrkIdsMC; + /// @brief init function, definition of histograms void init(InitContext&) { @@ -276,10 +288,13 @@ struct DndetaMFTPbPb { hev->GetXaxis()->SetBinLabel(13, "Above max occup."); hev->GetXaxis()->SetBinLabel(14, "RCT Flag Checker"); + registry.add("Tracks/hAmbTrkSel", "Number of ambiguous tracks; Cut; #Tracks Passed Cut", {HistType::kTH1F, {{nTrkAmbSel, -0.5, +nTrkAmbSel - 0.5}}}); + registry.get(HIST("Tracks/hAmbTrkSel"))->GetXaxis()->SetBinLabel(trkSelAmbiguousAll + 1, "All"); + registry.get(HIST("Tracks/hAmbTrkSel"))->GetXaxis()->SetBinLabel(trkSelWoAmbiguous + 1, "No Ambiguous"); + registry.get(HIST("Tracks/hAmbTrkSel"))->GetXaxis()->SetBinLabel(trkSelNumReassoc + 1, "Reassociated"); + registry.add("Tracks/hTrkSel", "Number of tracks; Cut; #Tracks Passed Cut", {HistType::kTH1F, {{nTrkSel, -0.5, +nTrkSel - 0.5}}}); registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelAll + 1, "All"); - registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelWoAmbiguous + 1, "Ambiguity cut"); - registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelNumReassoc + 1, "Reassociated"); registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelNCls + 1, "Ncl cut"); registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelChi2Ncl + 1, "#chi^{2}/Ncl cut"); registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelEta + 1, "#eta cut"); @@ -330,6 +345,9 @@ struct DndetaMFTPbPb { qaregistry.add({"Tracks/NchSel", "; N_{ch}; occupancy", {HistType::kTH2F, {multAxis, occupancyAxis}}}); + qaregistry.add({"Tracks/NchBestSel", + "; N_{ch}; occupancy", + {HistType::kTH2F, {multAxis, occupancyAxis}}}); if (doprocessDatawBestTracksInclusive) { registry.add( @@ -422,6 +440,10 @@ struct DndetaMFTPbPb { {"Tracks/Centrality/NchSel", "; N_{ch}; centrality; occupancy", {HistType::kTHnSparseF, {multAxis, centralityAxis, occupancyAxis}}}); + qaregistry.add( + {"Tracks/Centrality/NchBestSel", + "; N_{ch}; centrality; occupancy", + {HistType::kTHnSparseF, {multAxis, centralityAxis, occupancyAxis}}}); qaregistry.add( {"Tracks/Centrality/Chi2Eta", "; #chi^{2}; #it{#eta}; centrality; occupancy", @@ -661,7 +683,7 @@ struct DndetaMFTPbPb { {ptAxis, phiAxis, etaAxis, zAxis, occupancyAxis}}}); qaregistry.add({"Tracks/hPtEffBestFakeRec", " ; p_{T} (GeV/c); occupancy", - {HistType::kTH2F, {ptAxis, occupancyAxis}}}); + {HistType::kTHnSparseF, {ptAxis, phiAxis, etaAxis, zAxis, occupancyAxis}}}); } if (doprocessTrkEffBestCentFT0C) { @@ -680,7 +702,7 @@ struct DndetaMFTPbPb { qaregistry.add( {"Tracks/Centrality/hPtEffBestFakeRec", "; p_{T} (GeV/c); centrality; occupancy", - {HistType::kTHnSparseF, {ptAxis, centralityAxis, occupancyAxis}}}); + {HistType::kTHnSparseF, {ptAxis, phiAxis, etaAxis, zAxis, centralityAxis, occupancyAxis}}}); } if (doprocessMcQAInclusive) { @@ -714,11 +736,14 @@ struct DndetaMFTPbPb { if (doprocessCheckAmbiguousMftTracksInclusive) { qaregistry.add({"Tracks/hMftTracksAmbDegree", - " ; N_{coll}^{comp}; occupancy", - {HistType::kTH2F, {{41, -0.5, 40.5}, occupancyAxis}}}); + " ; N_{coll}^{comp}", + {HistType::kTH1F, {{41, -0.5, 40.5}}}}); + qaregistry.add({"Tracks/hMftTracksAmbDegreeWoTrivial", + " ; N_{coll}^{comp}", + {HistType::kTH1F, {{41, -0.5, 40.5}}}}); qaregistry.add({"Tracks/hAmbTrackType", " ; Ambiguous track type; occupancy", - {HistType::kTH2F, {{5, -0.5, 4.5}, occupancyAxis}}}); + {HistType::kTH1F, {{5, -0.5, 4.5}}}}); qaregistry.add({"Tracks/histAmbZvtx", "#it{z}_{vtx} of collisions associated to a " "track;#it{z}_{vtx} (cm);", @@ -727,13 +752,17 @@ struct DndetaMFTPbPb { if (doprocessCheckAmbiguousMftTracksCentFT0C) { qaregistry.add({"Tracks/Centrality/hMftTracksAmbDegree", - " ; N_{coll}^{comp}; occupancy", - {HistType::kTHnSparseF, - {{41, -0.5, 40.5}, centralityAxis, occupancyAxis}}}); + " ; N_{coll}^{comp}; centrality", + {HistType::kTH2F, + {{41, -0.5, 40.5}, centralityAxis}}}); + qaregistry.add({"Tracks/Centrality/hMftTracksAmbDegreeWoTrivial", + " ; N_{coll}^{comp}; centrality", + {HistType::kTH2F, + {{41, -0.5, 40.5}, centralityAxis}}}); qaregistry.add({"Tracks/Centrality/hAmbTrackType", - " ; Ambiguous track type; occupancy", - {HistType::kTHnSparseF, - {{5, -0.5, 4.5}, centralityAxis, occupancyAxis}}}); + " ; Ambiguous track type; centrality", + {HistType::kTH2F, + {{5, -0.5, 4.5}, centralityAxis}}}); } if (doprocessEfficiencyInclusive) { @@ -765,6 +794,49 @@ struct DndetaMFTPbPb { qaregistry.add("Events/hMultMFTvsFV0A", "MultMFT_vs_FV0A", {HistType::kTH2F, {multAxis, multFV0aAxis}}); qaregistry.add("Events/hNPVtracksVsMultMFT", "NPVtracks_vs_MultMFT", {HistType::kTH2F, {pvAxis, multAxis}}); } + + if (doprocessDCAMcInlcusive) { + qaregistry.add({"Tracks/hDCAxBestGenPrim", "; DCA_{x}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); + qaregistry.add({"Tracks/hDCAyBestGenPrim", "; DCA_{y}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); + qaregistry.add({"Tracks/hDCAxyBestGenPrim", "; DCA_{xy}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); + qaregistry.add({"Tracks/hDCAzBestGenPrim", "; DCA_{z}^{gen} (cm); counts", {HistType::kTH1F, {dcazAxis}}}); + // + qaregistry.add({"Tracks/hDCAxBestGenSecWeak", "; DCA_{x}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); + qaregistry.add({"Tracks/hDCAyBestGenSecWeak", "; DCA_{y}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); + qaregistry.add({"Tracks/hDCAxyBestGenSecWeak", "; DCA_{xy}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); + qaregistry.add({"Tracks/hDCAzBestGenSecWeak", "; DCA_{z}^{gen} (cm); counts", {HistType::kTH1F, {dcazAxis}}}); + // + qaregistry.add({"Tracks/hDCAxBestGenSecMat", "; DCA_{x}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); + qaregistry.add({"Tracks/hDCAyBestGenSecMat", "; DCA_{y}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); + qaregistry.add({"Tracks/hDCAxyBestGenSecMat", "; DCA_{xy}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); + qaregistry.add({"Tracks/hDCAzBestGenSecMat", "; DCA_{z}^{gen} (cm); counts", {HistType::kTH1F, {dcazAxis}}}); + // + qaregistry.add({"Tracks/hDCAxyBestPtRec", "; p_{T} (GeV/c) ; DCA_{XY} (cm)", {HistType::kTH2F, {ptAxis, dcaxyAxis}}}); + qaregistry.add({"Tracks/hDCAzBestPtRec", "; p_{T} (GeV/c) ; DCA_{Z} (cm)", {HistType::kTH2F, {ptAxis, dcazAxis}}}); + qaregistry.add({"Tracks/hDCAxyBestRec", "; DCA_{XY} (cm)", {HistType::kTH1F, {dcaxyAxis}}}); + qaregistry.add({"Tracks/hDCAzBestRec", "; DCA_{Z} (cm)", {HistType::kTH1F, {dcazAxis}}}); + } + if (doprocessDCAMcCentFT0C) { + qaregistry.add({"Tracks/Centrality/hDCAxBestGenPrim", "; DCA_{x}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); + qaregistry.add({"Tracks/Centrality/hDCAyBestGenPrim", "; DCA_{y}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); + qaregistry.add({"Tracks/Centrality/hDCAxyBestGenPrim", "; DCA_{xy}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); + qaregistry.add({"Tracks/Centrality/hDCAzBestGenPrim", "; DCA_{z}^{gen} (cm); counts", {HistType::kTH1F, {dcazAxis}}}); + // + qaregistry.add({"Tracks/Centrality/hDCAxBestGenSecWeak", "; DCA_{x}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); + qaregistry.add({"Tracks/Centrality/hDCAyBestGenSecWeak", "; DCA_{y}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); + qaregistry.add({"Tracks/Centrality/hDCAxyBestGenSecWeak", "; DCA_{xy}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); + qaregistry.add({"Tracks/Centrality/hDCAzBestGenSecWeak", "; DCA_{z}^{gen} (cm); counts", {HistType::kTH1F, {dcazAxis}}}); + // + qaregistry.add({"Tracks/Centrality/hDCAxBestGenSecMat", "; DCA_{x}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); + qaregistry.add({"Tracks/Centrality/hDCAyBestGenSecMat", "; DCA_{y}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); + qaregistry.add({"Tracks/Centrality/hDCAxyBestGenSecMat", "; DCA_{xy}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); + qaregistry.add({"Tracks/Centrality/hDCAzBestGenSecMat", "; DCA_{z}^{gen} (cm); counts", {HistType::kTH1F, {dcazAxis}}}); + // + qaregistry.add({"Tracks/Centrality/hDCAxyBestPtRec", "; p_{T} (GeV/c) ; DCA_{XY} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, dcaxyAxis, centralityAxis}}}); + qaregistry.add({"Tracks/Centrality/hDCAzBestPtRec", "; p_{T} (GeV/c) ; DCA_{Z} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, dcazAxis, centralityAxis}}}); + qaregistry.add({"Tracks/Centrality/hDCAxyBestRec", "; DCA_{XY} (cm); centrality", {HistType::kTH2F, {dcaxyAxis, centralityAxis}}}); + qaregistry.add({"Tracks/Centrality/hDCAzBestRec", "; DCA_{Z} (cm); centrality", {HistType::kTH2F, {dcazAxis, centralityAxis}}}); + } } /// Filters - tracks @@ -775,9 +847,7 @@ struct DndetaMFTPbPb { Filter filtATrackDCAz = (nabs(aod::fwdtrack::bestDCAZ) < trackCuts.maxDCAz); /// Filters - mc particles - Filter primaries = (aod::mcparticle::flags & - (uint8_t)o2::aod::mcparticle::enums::PhysicalPrimary) == - (uint8_t)o2::aod::mcparticle::enums::PhysicalPrimary; + Filter primaries = (aod::mcparticle::flags & (uint8_t)o2::aod::mcparticle::enums::PhysicalPrimary) == (uint8_t)o2::aod::mcparticle::enums::PhysicalPrimary && (aod::mcparticle::eta < trackCuts.maxEta) && (aod::mcparticle::eta > trackCuts.minEta); /// Joined tables using FullBCs = soa::Join; @@ -795,9 +865,10 @@ struct DndetaMFTPbPb { using CollsGenCentFT0C = soa::Join; using CollGenCent = CollsGenCentFT0C::iterator; + using CollsCorr = soa::Join; + using MFTTracksLabeled = soa::Join; using MftTracksWColls = soa::Join; - using CollsCorr = soa::Join; /// Filtered tables using FiltMftTracks = soa::Filtered; @@ -805,24 +876,39 @@ struct DndetaMFTPbPb { using FiltBestTracks = soa::Filtered; using FiltParticles = soa::Filtered; - template + bool isHitAtDisk(uint16_t map, int ilayer) + { + LOGF(debug, " map %i --> %i", map, (map >> (ilayer * 6)) & 0x3F); + return (map >> (ilayer * 6)) & 0x3F; + } + + template bool isTrackSelected(const T& track) { + if constexpr (fillHis) { + registry.fill(HIST("Tracks/hTrkSel"), trkSelAll); + } if (track.nClusters() < trackCuts.minNclusterMft) { return false; } - registry.fill(HIST("Tracks/hTrkSel"), trkSelNCls); + if constexpr (fillHis) { + registry.fill(HIST("Tracks/hTrkSel"), trkSelNCls); + } if (trackCuts.useChi2Cut) { float nclMft = std::max(2.0f * track.nClusters() - 5.0f, 1.0f); float mftChi2NCl = track.chi2() / nclMft; if (mftChi2NCl > trackCuts.maxChi2NCl) return false; } - registry.fill(HIST("Tracks/hTrkSel"), trkSelChi2Ncl); + if constexpr (fillHis) { + registry.fill(HIST("Tracks/hTrkSel"), trkSelChi2Ncl); + } if (track.eta() < trackCuts.minEta || track.eta() > trackCuts.maxEta) { return false; } - registry.fill(HIST("Tracks/hTrkSel"), trkSelEta); + if constexpr (fillHis) { + registry.fill(HIST("Tracks/hTrkSel"), trkSelEta); + } if (trackCuts.usephiCut) { float phi = track.phi(); o2::math_utils::bringTo02Pi(phi); @@ -836,15 +922,21 @@ struct DndetaMFTPbPb { (phi < ((PIHalf - 0.1) * PI) + trackCuts.phiCut))) return false; } - registry.fill(HIST("Tracks/hTrkSel"), trkSelPhiCut); + if constexpr (fillHis) { + registry.fill(HIST("Tracks/hTrkSel"), trkSelPhiCut); + } if (trackCuts.usePtCut && track.pt() < trackCuts.minPt) { return false; } - registry.fill(HIST("Tracks/hTrkSel"), trkSelPt); + if constexpr (fillHis) { + registry.fill(HIST("Tracks/hTrkSel"), trkSelPt); + } if (trackCuts.requireCA && !track.isCA()) { return false; } - registry.fill(HIST("Tracks/hTrkSel"), trkSelCA); + if constexpr (fillHis) { + registry.fill(HIST("Tracks/hTrkSel"), trkSelCA); + } return true; } @@ -852,45 +944,36 @@ struct DndetaMFTPbPb { int countTracks(T const& tracks, float z, float c, float occ) { auto nTrk = 0; - if (tracks.size() > 0) { - for (auto const& track : tracks) { - if (fillHis) { - if constexpr (has_reco_cent) { - qaregistry.fill(HIST("Tracks/Centrality/Chi2Eta"), track.chi2(), - track.eta(), c, occ); - qaregistry.fill(HIST("Tracks/Centrality/Chi2"), track.chi2(), c, - occ); - qaregistry.fill(HIST("Tracks/Centrality/NclustersEta"), - track.nClusters(), track.eta(), c, occ); - } else { - qaregistry.fill(HIST("Tracks/Chi2Eta"), track.chi2(), track.eta(), - occ); - qaregistry.fill(HIST("Tracks/Chi2"), track.chi2(), occ); - qaregistry.fill(HIST("Tracks/NclustersEta"), track.nClusters(), - track.eta(), occ); - } + for (auto const& track : tracks) { + if (fillHis) { + if constexpr (has_reco_cent) { + qaregistry.fill(HIST("Tracks/Centrality/Chi2Eta"), track.chi2(), track.eta(), c, occ); + qaregistry.fill(HIST("Tracks/Centrality/Chi2"), track.chi2(), c, occ); + qaregistry.fill(HIST("Tracks/Centrality/NclustersEta"), track.nClusters(), track.eta(), c, occ); + } else { + qaregistry.fill(HIST("Tracks/Chi2Eta"), track.chi2(), track.eta(), occ); + qaregistry.fill(HIST("Tracks/Chi2"), track.chi2(), occ); + qaregistry.fill(HIST("Tracks/NclustersEta"), track.nClusters(), track.eta(), occ); } - if (!isTrackSelected(track)) { + } + if (!isTrackSelected(track)) { + continue; + } + if (fillHis) { + float phi = track.phi(); + o2::math_utils::bringTo02Pi(phi); + if (phi < 0.f || TwoPI < phi) { continue; } - if (fillHis) { - float phi = track.phi(); - o2::math_utils::bringTo02Pi(phi); - if (phi < 0.f || TwoPI < phi) { - continue; - } - if constexpr (has_reco_cent) { - registry.fill(HIST("Tracks/Centrality/EtaZvtx"), track.eta(), z, c, - occ); - registry.fill(HIST("Tracks/Centrality/PhiEta"), phi, track.eta(), c, - occ); - } else { - registry.fill(HIST("Tracks/EtaZvtx"), track.eta(), z, occ); - registry.fill(HIST("Tracks/PhiEta"), phi, track.eta(), occ); - } + if constexpr (has_reco_cent) { + registry.fill(HIST("Tracks/Centrality/EtaZvtx"), track.eta(), z, c, occ); + registry.fill(HIST("Tracks/Centrality/PhiEta"), phi, track.eta(), c, occ); + } else { + registry.fill(HIST("Tracks/EtaZvtx"), track.eta(), z, occ); + registry.fill(HIST("Tracks/PhiEta"), phi, track.eta(), occ); } - ++nTrk; } + ++nTrk; } if (fillHis) { if constexpr (has_reco_cent) { @@ -903,77 +986,114 @@ struct DndetaMFTPbPb { } template - int countBestTracks(T const& /*tracks*/, B const& besttracks, float z, + int countBestTracks(T const& tracks, B const& besttracks, float z, float c, float occ) { auto nATrk = 0; - if (besttracks.size() > 0) { - for (auto const& atrack : besttracks) { - registry.fill(HIST("Tracks/hTrkSel"), trkSelAll); - if (trackCuts.excludeAmbiguous && atrack.ambDegree() > 1) { + ambiguousTrkIds.reserve(besttracks.size()); + reassignedTrkIds.reserve(besttracks.size()); + for (auto const& atrack : besttracks) { + if (fillHis) { + registry.fill(HIST("Tracks/hAmbTrkSel"), trkSelAmbiguousAll); + } + if (trackCuts.excludeAmbiguous && atrack.ambDegree() > 1) { + continue; + } + if (fillHis) { + registry.fill(HIST("Tracks/hAmbTrkSel"), trkSelWoAmbiguous); + } + auto itrack = atrack.template mfttrack_as(); + if (!isTrackSelected(itrack)) { + continue; + } + ambiguousTrkIds.emplace_back(atrack.mfttrackId()); + ++nATrk; + if (fillHis) { + float phi = itrack.phi(); + o2::math_utils::bringTo02Pi(phi); + if (phi < 0.f || TwoPI < phi) { continue; } - registry.fill(HIST("Tracks/hTrkSel"), trkSelWoAmbiguous); - auto itrack = atrack.template mfttrack_as(); - if (itrack.collisionId() != atrack.bestCollisionId()) { - registry.fill(HIST("Tracks/hTrkSel"), trkSelNumReassoc); - } - if (!isTrackSelected(itrack)) { - continue; + if constexpr (has_reco_cent) { + registry.fill(HIST("Tracks/Centrality/EtaZvtxBest"), itrack.eta(), z, c, occ); + registry.fill(HIST("Tracks/Centrality/PhiEtaBest"), phi, itrack.eta(), c, occ); + qaregistry.fill(HIST("Tracks/Centrality/DCAXYPt"), itrack.pt(), atrack.bestDCAXY(), c, occ); + qaregistry.fill(HIST("Tracks/Centrality/DCAZPt"), itrack.pt(), atrack.bestDCAZ(), c, occ); + qaregistry.fill(HIST("Tracks/Centrality/DCAXY"), atrack.bestDCAXY(), c, occ); + qaregistry.fill(HIST("Tracks/Centrality/DCAZ"), atrack.bestDCAZ(), c, occ); + qaregistry.fill(HIST("Tracks/Centrality/NclustersEtaBest"), itrack.nClusters(), itrack.eta(), c, occ); + qaregistry.fill(HIST("Tracks/Centrality/TrackAmbDegree"), atrack.ambDegree(), c, occ); + } else { + registry.fill(HIST("Tracks/EtaZvtxBest"), itrack.eta(), z, occ); + registry.fill(HIST("Tracks/PhiEtaBest"), phi, itrack.eta(), occ); + qaregistry.fill(HIST("Tracks/DCAXYPt"), itrack.pt(), atrack.bestDCAXY(), occ); + qaregistry.fill(HIST("Tracks/DCAZPt"), itrack.pt(), atrack.bestDCAZ(), occ); + qaregistry.fill(HIST("Tracks/DCAXY"), atrack.bestDCAXY(), occ); + qaregistry.fill(HIST("Tracks/DCAZ"), atrack.bestDCAZ(), occ); + qaregistry.fill(HIST("Tracks/NclustersEtaBest"), itrack.nClusters(), itrack.eta(), occ); + qaregistry.fill(HIST("Tracks/TrackAmbDegree"), atrack.ambDegree(), occ); } + } + + if (itrack.has_collision() && itrack.collisionId() != atrack.bestCollisionId()) { + reassignedTrkIds.emplace_back(atrack.mfttrackId()); if (fillHis) { + registry.fill(HIST("Tracks/hAmbTrkSel"), trkSelNumReassoc); float phi = itrack.phi(); o2::math_utils::bringTo02Pi(phi); if (phi < 0.f || TwoPI < phi) { continue; } if constexpr (has_reco_cent) { - registry.fill(HIST("Tracks/Centrality/EtaZvtxBest"), itrack.eta(), - z, c, occ); - registry.fill(HIST("Tracks/Centrality/PhiEtaBest"), phi, - itrack.eta(), c, occ); - qaregistry.fill(HIST("Tracks/Centrality/DCAXYPt"), itrack.pt(), - atrack.bestDCAXY(), c, occ); - qaregistry.fill(HIST("Tracks/Centrality/DCAZPt"), itrack.pt(), - atrack.bestDCAZ(), c, occ); - qaregistry.fill(HIST("Tracks/Centrality/DCAXY"), atrack.bestDCAXY(), - c, occ); - qaregistry.fill(HIST("Tracks/Centrality/DCAZ"), atrack.bestDCAZ(), - c, occ); - qaregistry.fill(HIST("Tracks/Centrality/NclustersEtaBest"), - itrack.nClusters(), itrack.eta(), c, occ); - if (itrack.collisionId() != atrack.bestCollisionId()) { - qaregistry.fill(HIST("Tracks/Centrality/ReTracksEtaZvtx"), - itrack.eta(), z, c, occ); - qaregistry.fill(HIST("Tracks/Centrality/ReTracksPhiEta"), phi, - itrack.eta(), c, occ); - } - qaregistry.fill(HIST("Tracks/Centrality/TrackAmbDegree"), - atrack.ambDegree(), c, occ); + qaregistry.fill(HIST("Tracks/Centrality/ReTracksEtaZvtx"), itrack.eta(), itrack.template collision_as().posZ(), c, occ); + qaregistry.fill(HIST("Tracks/Centrality/ReTracksPhiEta"), phi, itrack.eta(), c, occ); } else { - registry.fill(HIST("Tracks/EtaZvtxBest"), itrack.eta(), z, occ); - registry.fill(HIST("Tracks/PhiEtaBest"), phi, itrack.eta(), occ); - qaregistry.fill(HIST("Tracks/DCAXYPt"), itrack.pt(), - atrack.bestDCAXY(), occ); - qaregistry.fill(HIST("Tracks/DCAZPt"), itrack.pt(), - atrack.bestDCAZ(), occ); - qaregistry.fill(HIST("Tracks/DCAXY"), atrack.bestDCAXY(), occ); - qaregistry.fill(HIST("Tracks/DCAZ"), atrack.bestDCAZ(), occ); - qaregistry.fill(HIST("Tracks/NclustersEtaBest"), itrack.nClusters(), - itrack.eta(), occ); - if (itrack.collisionId() != atrack.bestCollisionId()) { - qaregistry.fill(HIST("Tracks/ReTracksEtaZvtx"), itrack.eta(), z, - occ); - qaregistry.fill(HIST("Tracks/ReTracksPhiEta"), phi, itrack.eta(), - occ); - } - qaregistry.fill(HIST("Tracks/TrackAmbDegree"), atrack.ambDegree(), - occ); + qaregistry.fill(HIST("Tracks/ReTracksEtaZvtx"), itrack.eta(), itrack.template collision_as().posZ(), occ); + qaregistry.fill(HIST("Tracks/ReTracksPhiEta"), phi, itrack.eta(), occ); } } - ++nATrk; } } + + for (auto const& track : tracks) { + if (std::find(ambiguousTrkIds.begin(), ambiguousTrkIds.end(), track.globalIndex()) != ambiguousTrkIds.end()) { + continue; + } + if (std::find(reassignedTrkIds.begin(), reassignedTrkIds.end(), track.globalIndex()) != reassignedTrkIds.end()) { + continue; + } + if (!isTrackSelected(track)) { + continue; + } + ++nATrk; + if (fillHis) { + float phi = track.phi(); + o2::math_utils::bringTo02Pi(phi); + if (phi < 0.f || TwoPI < phi) { + continue; + } + if constexpr (has_reco_cent) { + registry.fill(HIST("Tracks/Centrality/EtaZvtxBest"), track.eta(), z, c, occ); + registry.fill(HIST("Tracks/Centrality/PhiEtaBest"), phi, track.eta(), c, occ); + qaregistry.fill(HIST("Tracks/Centrality/NclustersEtaBest"), track.nClusters(), track.eta(), c, occ); + } else { + registry.fill(HIST("Tracks/EtaZvtxBest"), track.eta(), z, occ); + registry.fill(HIST("Tracks/PhiEtaBest"), phi, track.eta(), occ); + qaregistry.fill(HIST("Tracks/NclustersEtaBest"), track.nClusters(), track.eta(), occ); + } + } + } + if (fillHis) { + if constexpr (has_reco_cent) { + qaregistry.fill(HIST("Tracks/Centrality/NchBestSel"), nATrk, c, occ); + } else { + qaregistry.fill(HIST("Tracks/NchBestSel"), nATrk, occ); + } + } + ambiguousTrkIds.clear(); + ambiguousTrkIds.shrink_to_fit(); + reassignedTrkIds.clear(); + reassignedTrkIds.shrink_to_fit(); return nATrk; } @@ -985,11 +1105,39 @@ struct DndetaMFTPbPb { if (!isChrgParticle(particle.pdgCode())) { continue; } + if (cfgUseParticleSel && !isParticleSelected(particle)) { + continue; + } + if (particle.eta() < trackCuts.minEta || particle.eta() > trackCuts.maxEta) { + continue; + } nCharged++; } return nCharged; } + template + bool isParticleSelected(P const& particle) + { + if (particle.eta() < trackCuts.minEta || particle.eta() > trackCuts.maxEta) { + return false; + } + if (trackCuts.usephiCut) { + float phi = particle.phi(); + o2::math_utils::bringTo02Pi(phi); + if (phi < trackCuts.minPhi || trackCuts.maxPhi < phi) { + return false; + } + if ((phi < trackCuts.phiCut) || + ((phi > PI - trackCuts.phiCut) && (phi < PI + trackCuts.phiCut)) || + (phi > TwoPI - trackCuts.phiCut) || + ((phi > ((PIHalf - 0.1) * PI) - trackCuts.phiCut) && + (phi < ((PIHalf - 0.1) * PI) + trackCuts.phiCut))) + return false; + } + return true; + } + template float getOccupancy(C const& collision, uint occEstimator) { @@ -1137,6 +1285,9 @@ struct DndetaMFTPbPb { if (!isChrgParticle(particle.pdgCode())) { continue; } + if (cfgUseParticleSel && !isParticleSelected(particle)) { + continue; + } float phi = particle.phi(); o2::math_utils::bringTo02Pi(phi); @@ -1434,7 +1585,7 @@ struct DndetaMFTPbPb { Preslice perCol = o2::aod::fwdtrack::collisionId; PresliceUnsorted recColPerMcCol = aod::mccollisionlabel::mcCollisionId; - Partition mcSample = nabs(aod::mcparticle::eta) < 1.0f; + Partition mcSample = (aod::mcparticle::eta < trackCuts.maxEta) && (aod::mcparticle::eta > trackCuts.minEta); /// @brief process template function to run on MC gen template @@ -1827,10 +1978,7 @@ struct DndetaMFTPbPb { false); using ParticlesI = soa::Join; - Partition primariesI = - ((aod::mcparticle::flags & - (uint8_t)o2::aod::mcparticle::enums::PhysicalPrimary) == - (uint8_t)o2::aod::mcparticle::enums::PhysicalPrimary); + Partition primariesI = (aod::mcparticle::flags & (uint8_t)o2::aod::mcparticle::enums::PhysicalPrimary) == (uint8_t)o2::aod::mcparticle::enums::PhysicalPrimary && (aod::mcparticle::eta < trackCuts.maxEta) && (aod::mcparticle::eta > trackCuts.minEta); /// @brief process template function to calculate tracking efficiency (indexed /// as particle-to-MFT-tracks) @@ -1860,6 +2008,9 @@ struct DndetaMFTPbPb { if (!isChrgParticle(particle.pdgCode())) { continue; } + if (cfgUseParticleSel && !isParticleSelected(particle)) { + continue; + } // MC gen if constexpr (has_reco_cent) { @@ -1967,7 +2118,7 @@ struct DndetaMFTPbPb { void processTrkEffBest( typename soa::Join::iterator const& collision, MC const& /*mccollisions*/, FiltParticles const& particles, - FiltMcMftTracks const& /*tracks*/, + FiltMcMftTracks const& tracks, soa::SmallGroups const& besttracks) { if (!isGoodEvent(collision)) { @@ -1987,46 +2138,92 @@ struct DndetaMFTPbPb { if (!isChrgParticle(particle.pdgCode())) { continue; } + if (cfgUseParticleSel && !isParticleSelected(particle)) { + continue; + } if constexpr (has_reco_cent) { - qaregistry.fill(HIST("Tracks/Centrality/hPtPhiEtaZvtxEffBestGen"), - particle.pt(), particle.phi(), particle.eta(), - mcCollision.posZ(), crec, occrec); + if (particle.eta() > trackCuts.minEta && particle.eta() < trackCuts.maxEta) { + qaregistry.fill(HIST("Tracks/Centrality/hPtPhiEtaZvtxEffBestGen"), particle.pt(), particle.phi(), particle.eta(), mcCollision.posZ(), crec, occrec); + } } else { - qaregistry.fill(HIST("Tracks/hPtPhiEtaZvtxEffBestGen"), particle.pt(), - particle.phi(), particle.eta(), mcCollision.posZ(), - occrec); + if (particle.eta() > trackCuts.minEta && particle.eta() < trackCuts.maxEta) { + qaregistry.fill(HIST("Tracks/hPtPhiEtaZvtxEffBestGen"), particle.pt(), particle.phi(), particle.eta(), mcCollision.posZ(), occrec); + } } } + ambiguousTrkIdsMC.reserve(besttracks.size()); + reassignedTrkIdsMC.reserve(besttracks.size()); + for (auto const& track : besttracks) { + ambiguousTrkIdsMC.emplace_back(track.mfttrackId()); if (trackCuts.excludeAmbiguous && track.ambDegree() > 1) { continue; } auto itrack = track.mfttrack_as(); - if (!isTrackSelected(itrack)) { + if (itrack.collisionId() != track.bestCollisionId()) { + reassignedTrkIdsMC.emplace_back(track.mfttrackId()); + } + if (!isTrackSelected(itrack)) { continue; } if (itrack.has_mcParticle()) { auto particle = itrack.mcParticle_as(); + if (itrack.eta() > trackCuts.minEta && itrack.eta() < trackCuts.maxEta) { + if constexpr (has_reco_cent) { + qaregistry.fill(HIST("Tracks/Centrality/hPtPhiEtaZvtxEffBestRec"), + particle.pt(), particle.phi(), particle.eta(), + mcCollision.posZ(), crec, occrec); + } else { + qaregistry.fill(HIST("Tracks/hPtPhiEtaZvtxEffBestRec"), particle.pt(), + particle.phi(), particle.eta(), mcCollision.posZ(), + occrec); + } + } + } else { if constexpr (has_reco_cent) { - qaregistry.fill(HIST("Tracks/Centrality/hPtPhiEtaZvtxEffBestRec"), - particle.pt(), itrack.phi(), itrack.eta(), - mcCollision.posZ(), crec, occrec); + qaregistry.fill(HIST("Tracks/Centrality/hPtEffBestFakeRec"), itrack.pt(), itrack.phi(), itrack.eta(), mcCollision.posZ(), crec, occrec); } else { - qaregistry.fill(HIST("Tracks/hPtPhiEtaZvtxEffBestRec"), particle.pt(), - itrack.phi(), itrack.eta(), mcCollision.posZ(), - occrec); + qaregistry.fill(HIST("Tracks/hPtEffBestFakeRec"), itrack.pt(), itrack.phi(), itrack.eta(), mcCollision.posZ(), occrec); + } + } + } + + for (auto const& track : tracks) { + if (std::find(ambiguousTrkIdsMC.begin(), ambiguousTrkIdsMC.end(), track.globalIndex()) != ambiguousTrkIdsMC.end()) { + continue; + } + if (std::find(reassignedTrkIdsMC.begin(), reassignedTrkIdsMC.end(), track.globalIndex()) != reassignedTrkIdsMC.end()) { + continue; + } + if (!isTrackSelected(track)) { + continue; + } + if (track.has_mcParticle()) { + auto particle = track.mcParticle_as(); + if (track.eta() > trackCuts.minEta && track.eta() < trackCuts.maxEta) { + if constexpr (has_reco_cent) { + qaregistry.fill(HIST("Tracks/Centrality/hPtPhiEtaZvtxEffBestRec"), + particle.pt(), particle.phi(), particle.eta(), + mcCollision.posZ(), crec, occrec); + } else { + qaregistry.fill(HIST("Tracks/hPtPhiEtaZvtxEffBestRec"), particle.pt(), + particle.phi(), particle.eta(), mcCollision.posZ(), + occrec); + } } } else { if constexpr (has_reco_cent) { - qaregistry.fill(HIST("Tracks/Centrality/hPtEffBestFakeRec"), - itrack.pt(), crec, occrec); + qaregistry.fill(HIST("Tracks/Centrality/hPtEffBestFakeRec"), track.pt(), track.phi(), track.eta(), mcCollision.posZ(), crec, occrec); } else { - qaregistry.fill(HIST("Tracks/hPtEffBestFakeRec"), itrack.pt(), - occrec); + qaregistry.fill(HIST("Tracks/hPtEffBestFakeRec"), track.pt(), track.phi(), track.eta(), mcCollision.posZ(), occrec); } } } + ambiguousTrkIdsMC.clear(); + ambiguousTrkIdsMC.shrink_to_fit(); + reassignedTrkIdsMC.clear(); + reassignedTrkIdsMC.shrink_to_fit(); } void processTrkEffBestInclusive( @@ -2080,7 +2277,7 @@ struct DndetaMFTPbPb { tracks.sliceBy(filtMcTrkperCol, collision.globalIndex()); for (auto const& track : perColTrks) { - if (!isTrackSelected(track)) { + if (!isTrackSelected(track)) { continue; } if (track.has_mcParticle()) { @@ -2138,19 +2335,34 @@ struct DndetaMFTPbPb { allC const& allcollisions, MftTracksWColls const& tracks) { - auto occ = getOccupancy(collision, eventCuts.occupancyEstimator); float c = getRecoCent(collision); - bool ambTrk = false; - int typeAmbTrk = 0; + int typeAmbTrk = -1; + + if (tracks.size() == 0) { + return; + } + for (auto const& track : tracks) { + auto trkCollId = track.has_collision() ? track.collisionId() : -1; + auto ids = track.compatibleCollIds(); + if (ids.empty() || (ids.size() == 1 && trkCollId == ids[0])) { + if constexpr (has_reco_cent) { + qaregistry.fill(HIST("Tracks/Centrality/hMftTracksAmbDegreeWoTrivial"), track.compatibleColl().size(), c); + } else { + qaregistry.fill(HIST("Tracks/hMftTracksAmbDegreeWoTrivial"), track.compatibleColl().size()); + } + continue; + } + if constexpr (has_reco_cent) { qaregistry.fill(HIST("Tracks/Centrality/hMftTracksAmbDegree"), - track.compatibleCollIds().size(), c, occ); + track.compatibleColl().size(), c); } else { qaregistry.fill(HIST("Tracks/hMftTracksAmbDegree"), - track.compatibleCollIds().size(), occ); + track.compatibleColl().size()); } + if (track.compatibleCollIds().size() > 0) { if (track.compatibleCollIds().size() == 1) { if (track.collisionId() != track.compatibleCollIds()[0]) { @@ -2168,22 +2380,22 @@ struct DndetaMFTPbPb { qaregistry.fill(HIST("Tracks/histAmbZvtx"), ambColl.posZ()); } } + } else { + typeAmbTrk = 0; } } if (ambTrk) { if constexpr (has_reco_cent) { - qaregistry.fill(HIST("Tracks/Centrality/hAmbTrackType"), typeAmbTrk, c, - occ); + qaregistry.fill(HIST("Tracks/Centrality/hAmbTrackType"), typeAmbTrk, c); } else { - qaregistry.fill(HIST("Tracks/hAmbTrackType"), typeAmbTrk, occ); + qaregistry.fill(HIST("Tracks/hAmbTrackType"), typeAmbTrk); } } else { if constexpr (has_reco_cent) { - qaregistry.fill(HIST("Tracks/Centrality/hAmbTrackType"), typeAmbTrk, c, - occ); + qaregistry.fill(HIST("Tracks/Centrality/hAmbTrackType"), typeAmbTrk, c); } else { - qaregistry.fill(HIST("Tracks/hAmbTrackType"), typeAmbTrk, occ); + qaregistry.fill(HIST("Tracks/hAmbTrackType"), typeAmbTrk); } } } @@ -2215,12 +2427,11 @@ struct DndetaMFTPbPb { /// @brief process template function for MC QA checks template - void - processMcQA(typename soa::Join const& collisions, - MFTTracksLabeled const& tracks, - aod::AmbiguousMFTTracks const& atracks, - aod::McCollisions const& mcCollisions, - FiltParticles const& /*particles*/) + void processMcQA(typename soa::Join const& collisions, + MFTTracksLabeled const& tracks, + aod::AmbiguousMFTTracks const& atracks, + aod::McCollisions const& mcCollisions, + FiltParticles const& /*particles*/) { for (const auto& collision : collisions) { float crec = getRecoCent(collision); @@ -2289,6 +2500,136 @@ struct DndetaMFTPbPb { PROCESS_SWITCH(DndetaMFTPbPb, processMcQACentFT0C, "Process MC QA checks (in FT0 centrality bins)", false); + /// @brief process template function for DCA MC checks + template + void processDCAMc(typename soa::Join::iterator const& collision, + FiltMcMftTracks const& /*tracks*/, + soa::SmallGroups const& besttracks, + MC const& /*mcCollisions*/, + aod::McParticles const& /*particles*/ + ) + { + if (!isGoodEvent(collision)) { + return; + } + if (!collision.has_mcCollision()) { + return; + } + float crec = getRecoCent(collision); + // auto mcCollision = collision.mcCollision(); + + if (besttracks.size() == 0) { + return; + } + + for (auto const& atrack : besttracks) { + auto itrack = atrack.mfttrack_as(); + if (!isTrackSelected(itrack)) { + continue; + } + if (!itrack.has_collision()) { + continue; + } + + if constexpr (has_reco_cent) { + qaregistry.fill(HIST("Tracks/Centrality/hDCAxyBestPtRec"), itrack.pt(), atrack.bestDCAXY(), crec); + qaregistry.fill(HIST("Tracks/Centrality/hDCAzBestPtRec"), itrack.pt(), atrack.bestDCAZ(), crec); + qaregistry.fill(HIST("Tracks/Centrality/hDCAxyBestRec"), atrack.bestDCAXY(), crec); + qaregistry.fill(HIST("Tracks/Centrality/hDCAzBestRec"), atrack.bestDCAZ(), crec); + } else { + qaregistry.fill(HIST("Tracks/hDCAxyBestPtRec"), itrack.pt(), atrack.bestDCAXY()); + qaregistry.fill(HIST("Tracks/hDCAzBestPtRec"), itrack.pt(), atrack.bestDCAZ()); + qaregistry.fill(HIST("Tracks/hDCAxyBestRec"), atrack.bestDCAXY()); + qaregistry.fill(HIST("Tracks/hDCAzBestRec"), atrack.bestDCAZ()); + } + + if (!itrack.has_mcParticle()) { + LOGF(warning, "No MC particle for ambiguous itrack, skip..."); + continue; + } + + // auto particle = track.mcParticle(); + auto particle = itrack.mcParticle_as(); + + if (!isChrgParticle(particle.pdgCode())) { + continue; + } + if (particle.eta() <= trackCuts.minEta || particle.eta() >= trackCuts.maxEta) { + continue; + } + if (cfgUseParticleSel && !isParticleSelected(particle)) { + continue; + } + + const auto dcaXtruth(particle.vx() - particle.mcCollision().posX()); + const auto dcaYtruth(particle.vy() - particle.mcCollision().posY()); + const auto dcaZtruth(particle.vz() - particle.mcCollision().posZ()); + auto dcaXYtruth = std::sqrt(dcaXtruth * dcaXtruth + dcaYtruth * dcaYtruth); + + if (!particle.isPhysicalPrimary()) { // Secondaries (weak decays and material) + if (particle.getProcess() == kNumDecay) { // Particles from decay + if constexpr (has_reco_cent) { + qaregistry.fill(HIST("Tracks/Centrality/hDCAxBestGenSecWeak"), dcaXtruth, crec); + qaregistry.fill(HIST("Tracks/Centrality/hDCAyBestGenSecWeak"), dcaYtruth, crec); + qaregistry.fill(HIST("Tracks/Centrality/hDCAxyBestGenSecWeak"), dcaXYtruth, crec); + qaregistry.fill(HIST("Tracks/Centrality/hDCAzBestGenSecWeak"), dcaZtruth, crec); + } else { + qaregistry.fill(HIST("Tracks/hDCAxBestGenSecWeak"), dcaXtruth); + qaregistry.fill(HIST("Tracks/hDCAyBestGenSecWeak"), dcaYtruth); + qaregistry.fill(HIST("Tracks/hDCAxyBestGenSecWeak"), dcaXYtruth); + qaregistry.fill(HIST("Tracks/hDCAzBestGenSecWeak"), dcaZtruth); + } + } else { // Particles from the material + if constexpr (has_reco_cent) { + qaregistry.fill(HIST("Tracks/Centrality/hDCAxBestGenSecMat"), dcaXtruth, crec); + qaregistry.fill(HIST("Tracks/Centrality/hDCAyBestGenSecMat"), dcaYtruth, crec); + qaregistry.fill(HIST("Tracks/Centrality/hDCAxyBestGenSecMat"), dcaXYtruth, crec); + qaregistry.fill(HIST("Tracks/Centrality/hDCAzBestGenSecMat"), dcaZtruth, crec); + } else { + qaregistry.fill(HIST("Tracks/hDCAxBestGenSecMat"), dcaXtruth); + qaregistry.fill(HIST("Tracks/hDCAyBestGenSecMat"), dcaYtruth); + qaregistry.fill(HIST("Tracks/hDCAxyBestGenSecMat"), dcaXYtruth); + qaregistry.fill(HIST("Tracks/hDCAzBestGenSecMat"), dcaZtruth); + } + } + } else { // Primaries + if constexpr (has_reco_cent) { + qaregistry.fill(HIST("Tracks/Centrality/hDCAxBestGenPrim"), dcaXtruth, crec); + qaregistry.fill(HIST("Tracks/Centrality/hDCAyBestGenPrim"), dcaYtruth, crec); + qaregistry.fill(HIST("Tracks/Centrality/hDCAxyBestGenPrim"), dcaXYtruth, crec); + qaregistry.fill(HIST("Tracks/Centrality/hDCAzBestGenPrim"), dcaZtruth, crec); + } else { + qaregistry.fill(HIST("Tracks/hDCAxBestGenPrim"), dcaXtruth); + qaregistry.fill(HIST("Tracks/hDCAyBestGenPrim"), dcaYtruth); + qaregistry.fill(HIST("Tracks/hDCAxyBestGenPrim"), dcaXYtruth); + qaregistry.fill(HIST("Tracks/hDCAzBestGenPrim"), dcaZtruth); + } + } + } + } + + void processDCAMcInlcusive(soa::Join::iterator const& collision, + FiltMcMftTracks const& tracks, + soa::SmallGroups const& besttracks, + aod::McCollisions const& mccollisions, + aod::McParticles const& particles) + { + processDCAMc(collision, tracks, besttracks, mccollisions, particles); + } + + PROCESS_SWITCH(DndetaMFTPbPb, processDCAMcInlcusive, "Process MC DCA checks (Inclusive)", false); + + void processDCAMcCentFT0C(soa::Join::iterator const& collision, + FiltMcMftTracks const& tracks, + soa::SmallGroups const& besttracks, + aod::McCollisions const& mccollisions, + aod::McParticles const& particles) + { + processDCAMc(collision, tracks, besttracks, mccollisions, particles); + } + + PROCESS_SWITCH(DndetaMFTPbPb, processDCAMcCentFT0C, "Process MC DCA checks (in FT0C centrality bins)", false); + template void processCorrelationwBestTracks(typename C::iterator const& collision, FiltMftTracks const& /*tracks*/, soa::SmallGroups const& besttracks) { @@ -2305,7 +2646,7 @@ struct DndetaMFTPbPb { if (itrack.eta() < trackCuts.minEta || itrack.eta() > trackCuts.maxEta) { continue; } - if (cfgUseTrackSel && !isTrackSelected(itrack)) { + if (cfgUseTrackSel && !isTrackSelected(itrack)) { continue; } nBestTrks++; From 64b8ebe05cedca31e1c6ee76bafe3e16eeb21149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Tue, 30 Sep 2025 21:26:24 +0200 Subject: [PATCH 582/986] [PWGLF] Modify DCA binning and add reconstructed histograms (#13176) --- PWGLF/Tasks/QC/systematicsMapping.cxx | 28 ++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/PWGLF/Tasks/QC/systematicsMapping.cxx b/PWGLF/Tasks/QC/systematicsMapping.cxx index ea76a528b05..13330e97042 100644 --- a/PWGLF/Tasks/QC/systematicsMapping.cxx +++ b/PWGLF/Tasks/QC/systematicsMapping.cxx @@ -42,7 +42,7 @@ struct SystematicsMapping { // Selection bins ConfigurableAxis tpcCrossedRowsBins{"tpcCrossedRowsBins", {5, 70, 100, 120, 135, 150}, "Min TPC clusters for tracks"}; ConfigurableAxis itsClustersBins{"itsClustersBins", {5, 0, 6}, "Min ITS clusters for tracks"}; - ConfigurableAxis dcaBins{"dcaBins", {100, 0.f, 5.f}, "Binning for DCA (cm)"}; + ConfigurableAxis dcaBins{"dcaBins", {VARIABLE_WIDTH, -3.0, -2.95, -2.9, -2.85, -2.8, -2.75, -2.7, -2.65, -2.6, -2.55, -2.5, -2.45, -2.4, -2.35, -2.3, -2.25, -2.2, -2.15, -2.1, -2.05, -2.0, -1.975, -1.95, -1.925, -1.9, -1.875, -1.85, -1.825, -1.8, -1.775, -1.75, -1.725, -1.7, -1.675, -1.65, -1.625, -1.6, -1.575, -1.55, -1.525, -1.5, -1.475, -1.45, -1.425, -1.4, -1.375, -1.35, -1.325, -1.3, -1.275, -1.25, -1.225, -1.2, -1.175, -1.15, -1.125, -1.1, -1.075, -1.05, -1.025, -1.0, -0.99, -0.98, -0.97, -0.96, -0.95, -0.94, -0.93, -0.92, -0.91, -0.9, -0.89, -0.88, -0.87, -0.86, -0.85, -0.84, -0.83, -0.82, -0.81, -0.8, -0.79, -0.78, -0.77, -0.76, -0.75, -0.74, -0.73, -0.72, -0.71, -0.7, -0.69, -0.68, -0.67, -0.66, -0.65, -0.64, -0.63, -0.62, -0.61, -0.6, -0.59, -0.58, -0.57, -0.56, -0.55, -0.54, -0.53, -0.52, -0.51, -0.5, -0.49, -0.48, -0.47, -0.46, -0.45, -0.44, -0.43, -0.42, -0.41, -0.4, -0.396, -0.392, -0.388, -0.384, -0.38, -0.376, -0.372, -0.368, -0.364, -0.36, -0.356, -0.352, -0.348, -0.344, -0.34, -0.336, -0.332, -0.328, -0.324, -0.32, -0.316, -0.312, -0.308, -0.304, -0.3, -0.296, -0.292, -0.288, -0.284, -0.28, -0.276, -0.272, -0.268, -0.264, -0.26, -0.256, -0.252, -0.248, -0.244, -0.24, -0.236, -0.232, -0.228, -0.224, -0.22, -0.216, -0.212, -0.208, -0.204, -0.2, -0.198, -0.196, -0.194, -0.192, -0.19, -0.188, -0.186, -0.184, -0.182, -0.18, -0.178, -0.176, -0.174, -0.172, -0.17, -0.168, -0.166, -0.164, -0.162, -0.16, -0.158, -0.156, -0.154, -0.152, -0.15, -0.148, -0.146, -0.144, -0.142, -0.14, -0.138, -0.136, -0.134, -0.132, -0.13, -0.128, -0.126, -0.124, -0.122, -0.12, -0.118, -0.116, -0.114, -0.112, -0.11, -0.108, -0.106, -0.104, -0.102, -0.1, -0.099, -0.098, -0.097, -0.096, -0.095, -0.094, -0.093, -0.092, -0.091, -0.09, -0.089, -0.088, -0.087, -0.086, -0.085, -0.084, -0.083, -0.082, -0.081, -0.08, -0.079, -0.078, -0.077, -0.076, -0.075, -0.074, -0.073, -0.072, -0.071, -0.07, -0.069, -0.068, -0.067, -0.066, -0.065, -0.064, -0.063, -0.062, -0.061, -0.06, -0.059, -0.058, -0.057, -0.056, -0.055, -0.054, -0.053, -0.052, -0.051, -0.05, -0.049, -0.048, -0.047, -0.046, -0.045, -0.044, -0.043, -0.042, -0.041, -0.04, -0.039, -0.038, -0.037, -0.036, -0.035, -0.034, -0.033, -0.032, -0.031, -0.03, -0.029, -0.028, -0.027, -0.026, -0.025, -0.024, -0.023, -0.022, -0.021, -0.02, -0.019, -0.018, -0.017, -0.016, -0.015, -0.014, -0.013, -0.012, -0.011, -0.01, -0.009, -0.008, -0.007, -0.006, -0.005, -0.004, -0.003, -0.002, -0.001, -0.0, 0.001, 0.002, 0.003, 0.004, 0.005, 0.006, 0.007, 0.008, 0.009, 0.01, 0.011, 0.012, 0.013, 0.014, 0.015, 0.016, 0.017, 0.018, 0.019, 0.02, 0.021, 0.022, 0.023, 0.024, 0.025, 0.026, 0.027, 0.028, 0.029, 0.03, 0.031, 0.032, 0.033, 0.034, 0.035, 0.036, 0.037, 0.038, 0.039, 0.04, 0.041, 0.042, 0.043, 0.044, 0.045, 0.046, 0.047, 0.048, 0.049, 0.05, 0.051, 0.052, 0.053, 0.054, 0.055, 0.056, 0.057, 0.058, 0.059, 0.06, 0.061, 0.062, 0.063, 0.064, 0.065, 0.066, 0.067, 0.068, 0.069, 0.07, 0.071, 0.072, 0.073, 0.074, 0.075, 0.076, 0.077, 0.078, 0.079, 0.08, 0.081, 0.082, 0.083, 0.084, 0.085, 0.086, 0.087, 0.088, 0.089, 0.09, 0.091, 0.092, 0.093, 0.094, 0.095, 0.096, 0.097, 0.098, 0.099, 0.1, 0.102, 0.104, 0.106, 0.108, 0.11, 0.112, 0.114, 0.116, 0.118, 0.12, 0.122, 0.124, 0.126, 0.128, 0.13, 0.132, 0.134, 0.136, 0.138, 0.14, 0.142, 0.144, 0.146, 0.148, 0.15, 0.152, 0.154, 0.156, 0.158, 0.16, 0.162, 0.164, 0.166, 0.168, 0.17, 0.172, 0.174, 0.176, 0.178, 0.18, 0.182, 0.184, 0.186, 0.188, 0.19, 0.192, 0.194, 0.196, 0.198, 0.2, 0.204, 0.208, 0.212, 0.216, 0.22, 0.224, 0.228, 0.232, 0.236, 0.24, 0.244, 0.248, 0.252, 0.256, 0.26, 0.264, 0.268, 0.272, 0.276, 0.28, 0.284, 0.288, 0.292, 0.296, 0.3, 0.304, 0.308, 0.312, 0.316, 0.32, 0.324, 0.328, 0.332, 0.336, 0.34, 0.344, 0.348, 0.352, 0.356, 0.36, 0.364, 0.368, 0.372, 0.376, 0.38, 0.384, 0.388, 0.392, 0.396, 0.4, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.5, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.6, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.7, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.8, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.9, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.0, 1.025, 1.05, 1.075, 1.1, 1.125, 1.15, 1.175, 1.2, 1.225, 1.25, 1.275, 1.3, 1.325, 1.35, 1.375, 1.4, 1.425, 1.45, 1.475, 1.5, 1.525, 1.55, 1.575, 1.6, 1.625, 1.65, 1.675, 1.7, 1.725, 1.75, 1.775, 1.8, 1.825, 1.85, 1.875, 1.9, 1.925, 1.95, 1.975, 2.0, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65, 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3.0}, "Binning for DCA (cm)"}; ConfigurableAxis chi2Bins{"chi2Bins", {100, 0.f, 100.f}, "Binning for chi2"}; // Selection configurables Configurable selectionPosZ{"selectionPosZ", 10.f, "Max |z| of the primary vertex"}; @@ -98,6 +98,9 @@ struct SystematicsMapping { registry.add("K/GeneratedPositive", "", HistType::kTHnSparseF, {ptAxis, etaAxis, phiAxis}); registry.add("K/GeneratedNegative", "", HistType::kTHnSparseF, {ptAxis, etaAxis, phiAxis}); registry.add("K0s/Generated", "", HistType::kTHnSparseF, {ptAxis, etaAxis, phiAxis}); + registry.add("K/ReconstructedPositive", "", HistType::kTHnSparseF, {ptAxis, etaAxis, phiAxis}); + registry.add("K/ReconstructedNegative", "", HistType::kTHnSparseF, {ptAxis, etaAxis, phiAxis}); + registry.add("K0s/Reconstructed", "", HistType::kTHnSparseF, {ptAxis, etaAxis, phiAxis}); } } @@ -161,6 +164,7 @@ struct SystematicsMapping { PROCESS_SWITCH(SystematicsMapping, processData, "Systematics study for K0s and charged Kaons", true); void processMc(soa::Join const& collisions, + soa::Join const& tracks, aod::McParticles const& particles, aod::McCollisions const&) { @@ -171,6 +175,28 @@ struct SystematicsMapping { continue; const auto& mcCollision = collision.mcCollision(); + for (const auto& track : tracks) { + if (track.collisionId() != collision.globalIndex()) + continue; + if (!track.has_mcParticle()) + continue; + const auto& mcParticle = track.mcParticle(); + if (mcParticle.mcCollisionId() != mcCollision.globalIndex()) + continue; + if (!mcParticle.isPhysicalPrimary()) + continue; + switch (mcParticle.pdgCode()) { + case 321: // K+ + registry.fill(HIST("K/ReconstructedPositive"), track.pt(), track.eta(), track.phi()); + break; + case -321: // K- + registry.fill(HIST("K/ReconstructedNegative"), track.pt(), track.eta(), track.phi()); + break; + default: + break; + } + } + for (const auto& particle : particles) { if (particle.mcCollisionId() != mcCollision.globalIndex()) continue; From 4cd832c285a87a4a766766ec9df0aa094268e08d Mon Sep 17 00:00:00 2001 From: jaelpark Date: Wed, 1 Oct 2025 08:09:01 +0800 Subject: [PATCH 583/986] [PWGCF] Outlier cut support for JCorran task (#13181) --- PWGCF/JCorran/Tasks/jflucAnalysisTask.cxx | 49 +++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/PWGCF/JCorran/Tasks/jflucAnalysisTask.cxx b/PWGCF/JCorran/Tasks/jflucAnalysisTask.cxx index 8f1244661c7..aca62b7aa82 100644 --- a/PWGCF/JCorran/Tasks/jflucAnalysisTask.cxx +++ b/PWGCF/JCorran/Tasks/jflucAnalysisTask.cxx @@ -23,7 +23,12 @@ #include "Framework/RunningWorkflowInfo.h" #include "ReconstructionDataFormats/V0.h" +#include + +#include #include +#include +#include // #include "CCDB/BasicCCDBManager.h" @@ -56,6 +61,7 @@ struct jflucAnalysisTask { O2_DEFINE_CONFIGURABLE(ptmax, float, 5.0, "Maximum pt for tracks"); O2_DEFINE_CONFIGURABLE(cfgCentBinsForMC, int, 0, "0 = OFF and 1 = ON for data like multiplicity/centrality bins for MC process"); O2_DEFINE_CONFIGURABLE(cfgMultCorrelationsMask, uint16_t, 0, "Selection bitmask for the multiplicity correlations. This should match the filter selection cfgEstimatorBitMask.") + O2_DEFINE_CONFIGURABLE(cfgMultCutFormula, std::string, "", "Multiplicity correlations cut formula. A result greater than zero results in accepted event. Parameters: [cFT0C] FT0C centrality, [mFV0A] V0A multiplicity, [mGlob] global track multiplicity, [mPV] PV track multiplicity") ConfigurableAxis axisMultiplicity{"axisMultiplicity", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 100.1}, "multiplicity / centrality axis for histograms"}; ConfigurableAxis phiAxis{"axisPhi", {50, 0.0, o2::constants::math::TwoPI}, "phi axis for histograms"}; @@ -71,6 +77,9 @@ struct jflucAnalysisTask { HistogramRegistry registry{"registry"}; + std::unique_ptr multCutFormula; + std::array multCutFormulaParamIndex; + void init(InitContext const&) { auto axisSpecMult = AxisSpec(axisMultiplicity); @@ -98,6 +107,28 @@ struct jflucAnalysisTask { } if ((doprocessCFDerivedMultSet || doprocessCFDerivedMultSetCorrected) && cfgMultCorrelationsMask == 0) LOGF(fatal, "cfgMultCorrelationsMask can not be 0 when MultSet process functions are in use."); + + if (!cfgMultCutFormula.value.empty()) { + if (cfgMultCorrelationsMask == 0) + LOGF(fatal, "cfgMultCorrelationsMask can not be 0 when outlier cuts are enabled."); + multCutFormula = std::make_unique("multCutFormula", cfgMultCutFormula.value.c_str()); + std::fill_n(multCutFormulaParamIndex.begin(), std::size(multCutFormulaParamIndex), ~0u); + std::array pars = {"cFT0C", "mFV0A", "mPV", "mGlob"}; // must correspond the order of MultiplicityEstimators + for (uint i = 0, n = multCutFormula->GetNpar(); i < n; ++i) { + auto m = std::find(pars.begin(), pars.end(), multCutFormula->GetParName(i)); + if (m == pars.end()) { + + LOGF(warning, "Unknown parameter in cfgMultCutFormula: %s", multCutFormula->GetParName(i)); + continue; + } + if ((cfgMultCorrelationsMask.value & (1u << i)) == 0) { + LOGF(warning, "The centrality/multiplicity estimator %s is not available to be used in cfgMultCutFormula. Ensure cfgMultCorrelationsMask is correct and matches the CFMultSets in derived data."); + } else { + multCutFormulaParamIndex[std::distance(pars.begin(), m)] = i; + LOGF(info, "Multiplicity cut parameter %s in use.", m->c_str()); + } + } + } } template @@ -138,6 +169,20 @@ struct jflucAnalysisTask { } } + template + bool passOutlier(CollType const& collision) + { + if (cfgMultCutFormula.value.empty()) + return true; + for (uint i = 0; i < 4; ++i) { + if ((cfgMultCorrelationsMask.value & (1u << i)) == 0 || multCutFormulaParamIndex[i] == ~0u) + continue; + auto estIndex = std::popcount(cfgMultCorrelationsMask.value & ((1u << i) - 1)); + multCutFormula->SetParameter(multCutFormulaParamIndex[i], collision.multiplicities()[estIndex]); + } + return multCutFormula->Eval() > 0.0f; + } + void processJDerived(aod::JCollision const& collision, soa::Filtered const& tracks) { analyze(collision, tracks); @@ -166,6 +211,8 @@ struct jflucAnalysisTask { { if (std::popcount(cfgMultCorrelationsMask.value) != static_cast(collision.multiplicities().size())) LOGF(fatal, "Multiplicity selections (cfgMultCorrelationsMask = 0x%x) do not match the size of the table column (%ld). The histogram filling relies on the preservation of order.", cfgMultCorrelationsMask.value, collision.multiplicities().size()); + if (!passOutlier(collision)) + return; analyze(collision, tracks); } PROCESS_SWITCH(jflucAnalysisTask, processCFDerivedMultSet, "Process CF derived data with multiplicity sets", false); @@ -174,6 +221,8 @@ struct jflucAnalysisTask { { if (std::popcount(cfgMultCorrelationsMask.value) != static_cast(collision.multiplicities().size())) LOGF(fatal, "Multiplicity selections (cfgMultCorrelationsMask = 0x%x) do not match the size of the table column (%ld). The histogram filling relies on the preservation of order.", cfgMultCorrelationsMask.value, collision.multiplicities().size()); + if (!passOutlier(collision)) + return; analyze(collision, tracks); } PROCESS_SWITCH(jflucAnalysisTask, processCFDerivedMultSetCorrected, "Process CF derived data with corrections and multiplicity sets", false); From 84a7ecdc2ed6d28f916cb4dcf8955ad466930f46 Mon Sep 17 00:00:00 2001 From: altsybee Date: Wed, 1 Oct 2025 04:24:27 +0200 Subject: [PATCH 584/986] [DPG] special check for ambTracks to avoid crashes (#13186) --- DPG/Tasks/AOTEvent/eventSelectionQa.cxx | 28 ++++++++++++++----------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx index ab9e727e72f..f66ca6a0dff 100644 --- a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx +++ b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx @@ -999,20 +999,24 @@ struct EventSelectionQaTask { for (const auto& track : tracks) { auto mapAmbTrIdsIt = mapAmbTrIds.find(track.globalIndex()); int ambTrId = mapAmbTrIdsIt == mapAmbTrIds.end() ? -1 : mapAmbTrIdsIt->second; + + // special check to avoid crashes (in particular, on some MC Pb-Pb datasets) + // (related to shifts in ambiguous tracks association to bc slices (off by 1) - see https://mattermost.web.cern.ch/alice/pl/g9yaaf3tn3g4pgn7c1yex9copy + if (ambTrId >= 0 && (ambTracks.iteratorAt(ambTrId).bcIds()[0] >= bcs.size())) + continue; + int indexBc = ambTrId < 0 ? track.collision_as().bc_as().globalIndex() : ambTracks.iteratorAt(ambTrId).bc_as().begin().globalIndex(); - if (ambTrId < 0) { // temprorary limitation, to avoid crashes, in particular, on MC Pb-Pb datasets - auto bc = bcs.iteratorAt(indexBc); - int64_t globalBC = bc.globalBC() + floor(track.trackTime() / o2::constants::lhc::LHCBunchSpacingNS); + auto bc = bcs.iteratorAt(indexBc); + int64_t globalBC = bc.globalBC() + floor(track.trackTime() / o2::constants::lhc::LHCBunchSpacingNS); - int32_t indexClosestTVX = findClosest(globalBC, mapGlobalBcWithTVX); - int bcDiff = static_cast(globalBC - vGlobalBCs[indexClosestTVX]); - if (track.hasTOF() || track.hasTRD() || !track.hasITS() || !track.hasTPC() || track.pt() < 1) - continue; - histos.fill(HIST("hTrackBcDiffVsEtaAll"), track.eta(), bcDiff); - if (track.eta() < -0.2 || track.eta() > 0.2) - continue; - histos.fill(HIST("hSecondsTVXvsBcDifAll"), bc.timestamp() / 1000., bcDiff); - } + int32_t indexClosestTVX = findClosest(globalBC, mapGlobalBcWithTVX); + int bcDiff = static_cast(globalBC - vGlobalBCs[indexClosestTVX]); + if (track.hasTOF() || track.hasTRD() || !track.hasITS() || !track.hasTPC() || track.pt() < 1) + continue; + histos.fill(HIST("hTrackBcDiffVsEtaAll"), track.eta(), bcDiff); + if (track.eta() < -0.2 || track.eta() > 0.2) + continue; + histos.fill(HIST("hSecondsTVXvsBcDifAll"), bc.timestamp() / 1000., bcDiff); } // collision-based event selection qa From f6acde1e555cb4ea5fc6e085ee72f2832034c1c2 Mon Sep 17 00:00:00 2001 From: Shyam Kumar Date: Wed, 1 Oct 2025 05:55:10 +0200 Subject: [PATCH 585/986] [PWGHF] Minor Fix in the number of contributors (#13188) --- PWGHF/D2H/Tasks/taskDplus.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/D2H/Tasks/taskDplus.cxx b/PWGHF/D2H/Tasks/taskDplus.cxx index fd90c19d4af..18e2e59b26d 100644 --- a/PWGHF/D2H/Tasks/taskDplus.cxx +++ b/PWGHF/D2H/Tasks/taskDplus.cxx @@ -636,7 +636,7 @@ struct HfTaskDplus { flagGenB = getBHadMotherFlag(bHadMother.pdgCode()); ptGenB = bHadMother.pt(); } - for (const auto& recCol : mcRecoCollisions) { + for (const auto& recCol : recoCollsPerGenMcColl) { numPvContr = std::max(numPvContr, recCol.numContrib()); } fillHistoMCGen(particle); From 956e12f03f30004ac6b4ca13efcc1863199169a5 Mon Sep 17 00:00:00 2001 From: SuJeong Ji <120470463+SuJeong-Ji@users.noreply.github.com> Date: Wed, 1 Oct 2025 13:56:00 +0900 Subject: [PATCH 586/986] [PWGLF] Small changes for microtrack in LFResonanceTable.h (#13178) Co-authored-by: ALICE Action Bot --- PWGLF/DataModel/LFResonanceTables.h | 36 ++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/PWGLF/DataModel/LFResonanceTables.h b/PWGLF/DataModel/LFResonanceTables.h index 67e1fb013c5..b8f60a6fc7a 100644 --- a/PWGLF/DataModel/LFResonanceTables.h +++ b/PWGLF/DataModel/LFResonanceTables.h @@ -351,16 +351,26 @@ struct PidNSigma { /// @brief Encode 0.2 sigma interval to 0~10 range static uint8_t encodeNSigma(float nSigma) { - float encoded = std::abs((nSigma - 1.5) / 0.2); // Convert to 0~10 range - encoded = std::min(std::max(encoded, 0.f), 10.f); // Clamp to 0~10 range - return (uint8_t)round(encoded); + const float x = std::abs(nSigma); + if (x <= 1.5) + return 0; // Return 0 when absolute nSigma is smaller than 1.5 + float t = (x - 1.5) / 0.2; + int encoded = static_cast(std::ceil(t)); // (1.5,1.7]->1, ..., (3.3,3.5]->10 + if (encoded < 1) + encoded = 1; + if (encoded > 10) + encoded = 10; + return static_cast(encoded); } /// @brief Decode 0~10 value to original 1.5~3.5 sigma range static float decodeNSigma(uint8_t encoded) { - encoded = std::min(encoded, (uint8_t)10); // Safety check, should not be needed if encode is used properly - return (encoded * 0.2) + 1.5; + if (encoded == 0) + return 1.5; + if (encoded > 10) + encoded = 10; + return 1.5 + static_cast(encoded) * 0.2; } /// @brief Check if TOF info is available @@ -416,14 +426,18 @@ struct ResoMicroTrackSelFlag { flag = (DCAxyEncoded << 4) | DCAzEncoded; // Upper 4 bits = DCAxy, Lower 4 bits = DCAz } - /// @brief Convert DCA to 1~15 steps (0 value is not used) + /// @brief Convert DCA to 1~15 steps (|DCA|<0.1 is saved in 0) static uint8_t encodeDCA(float DCA) { - for (uint8_t i = 1; i < 15; i++) { - if (DCA < i * 0.1f) - return i; - } - return 15; + float x = std::fabs(DCA); + if (x < 0.1) + return 0; + int encoded = static_cast(std::ceil((x - 0.1) / 0.1)); // (0.1, 0.2] -> 1, ..., (1.4, 1.5] -> 14 + if (encoded < 1) + encoded = 1; + if (encoded > 14) + encoded = 15; + return static_cast(encoded); } /// @brief Operator to convert to `uint8_t` (for SOA storage) From 44edb11daa411d2a53d4dba7bfc1ed97226477c9 Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Wed, 1 Oct 2025 07:27:53 +0200 Subject: [PATCH 587/986] [PWGLF] Add new weights for event mixing (#13184) --- .../Strangeness/lambdaspincorrderived.cxx | 324 ++++++++++++------ 1 file changed, 225 insertions(+), 99 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx index daeefca4adc..513acb7db8a 100644 --- a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include @@ -66,15 +67,28 @@ struct lambdaspincorrderived { // Enable access to the CCDB for the offset and correction constants and save them in dedicated variables. Service ccdb; o2::ccdb::CcdbApi ccdbApi; - TH3D* hweight1; - TH3D* hweight2; - TH3D* hweight3; - TH3D* hweight4; - - Configurable ConfWeightPathLL{"ConfWeightPathLL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; - Configurable ConfWeightPathALAL{"ConfWeightPathALAL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; - Configurable ConfWeightPathLAL{"ConfWeightPathLAL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; - Configurable ConfWeightPathALL{"ConfWeightPathALL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; + // TH3D* hweightNUAL; + // TH3D* hweightNUAAL; + // TH3D* hweight1; + // TH3D* hweight2; + // TH3D* hweight3; + // TH3D* hweight4; + // Configurable ConfWeightPathNUAL{"ConfWeightPathNUAL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; + // Configurable ConfWeightPathNUAAL{"ConfWeightPathNUAAL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; + // Configurable ConfWeightPathLL{"ConfWeightPathLL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; + // Configurable ConfWeightPathALAL{"ConfWeightPathALAL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; + // Configurable ConfWeightPathLAL{"ConfWeightPathLAL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; + // Configurable ConfWeightPathALL{"ConfWeightPathALL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; + + Configurable ConfRPathL{"ConfRPathL", "", "CCDB path to R_L (optional)"}; + Configurable ConfRPathAL{"ConfRPathAL", "", "CCDB path to R_AL (optional)"}; + Configurable ConfEffPathL{"ConfEffPathL", "", "CCDB path to Eff (optional)"}; + Configurable ConfEffPathAL{"ConfEffPathAL", "", "CCDB path to Eff (optional)"}; + + TH3D* hR_L = nullptr; + TH3D* hR_AL = nullptr; + TH3D* hEff_L = nullptr; + TH3D* hEff_AL = nullptr; // event sel///////// Configurable centMin{"centMin", 0, "Minimum Centrality"}; @@ -82,7 +96,8 @@ struct lambdaspincorrderived { // Lambda selection //////////// Configurable harmonic{"harmonic", 1, "Harmonic delta phi"}; - Configurable useweight{"useweight", 1, "Use weight"}; + Configurable useweight{"useweight", 0, "Use weight"}; + // Configurable useNUA{"useNUA", 0, "Use NUA weight"}; Configurable usePDGM{"usePDGM", 1, "Use PDG mass"}; Configurable checkDoubleStatus{"checkDoubleStatus", 0, "Check Double status"}; Configurable cosPA{"cosPA", 0.995, "Cosine Pointing Angle"}; @@ -125,15 +140,31 @@ struct lambdaspincorrderived { histos.add("ptCent", "ptCent", HistType::kTH2D, {{100, 0.0, 10.0}, {8, 0.0, 80.0}}, true); histos.add("etaCent", "etaCent", HistType::kTH2D, {{32, -0.8, 0.8}, {8, 0.0, 80.0}}, true); - histos.add("hLambdaSameForLL", "hLambdaSameForLL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - histos.add("hLambdaSameForLAL", "hLambdaSameForLAL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - histos.add("hLambdaSameForALL", "hLambdaSameForALL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - histos.add("hAntiLambdaSameForALAL", "hAntiLambdaSameForALAL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); + // --- Singles QA for data-driven MIXED reweight (one fill per candidate) --- + histos.add("hSE_L", "SE #Lambda; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); + histos.add("hSE_AL", "SE #bar{#Lambda}; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); + histos.add("hME_L", "ME #Lambda; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); + histos.add("hME_AL", "ME #bar{#Lambda}; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); + + // Attempted-for-replacement (Den) and Succeeded (Num) per SE leg kinematics + histos.add("hMatchDen_L", "Attempted #Lambda; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); + histos.add("hMatchDen_AL", "Attempted #bar{#Lambda}; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); + + histos.add("hMatchNum_L", "Succeeded #Lambda; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); + histos.add("hMatchNum_AL", "Succeeded #bar{#Lambda}; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - histos.add("hLambdaMixForLL", "hLambdaMixForLL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - histos.add("hLambdaMixForLAL", "hLambdaMixForLAL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - histos.add("hLambdaMixForALL", "hLambdaMixForALL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - histos.add("hAntiLambdaMixForALAL", "hAntiLambdaMixForALAL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); + // histos.add("hLambdaNUA", "hLambdaNUA", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); + // histos.add("hAntiLambdaNUA", "hAntiLambdaNUA", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); + + // histos.add("hLambdaSameForLL", "hLambdaSameForLL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); + // histos.add("hLambdaSameForLAL", "hLambdaSameForLAL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); + // histos.add("hLambdaSameForALL", "hLambdaSameForALL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); + // histos.add("hAntiLambdaSameForALAL", "hAntiLambdaSameForALAL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); + + // histos.add("hLambdaMixForLL", "hLambdaMixForLL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); + // histos.add("hLambdaMixForLAL", "hLambdaMixForLAL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); + // histos.add("hLambdaMixForALL", "hLambdaMixForALL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); + // histos.add("hAntiLambdaMixForALAL", "hAntiLambdaMixForALAL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); histos.add("hSparseLambdaLambda", "hSparseLambdaLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisR}, true); histos.add("hSparseLambdaAntiLambda", "hSparseLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisR}, true); @@ -172,10 +203,14 @@ struct lambdaspincorrderived { ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); LOGF(info, "Getting alignment offsets from the CCDB..."); if (useweight) { - hweight1 = ccdb->getForTimeStamp(ConfWeightPathLL.value, cfgCcdbParam.nolaterthan.value); - hweight2 = ccdb->getForTimeStamp(ConfWeightPathLAL.value, cfgCcdbParam.nolaterthan.value); - hweight3 = ccdb->getForTimeStamp(ConfWeightPathALL.value, cfgCcdbParam.nolaterthan.value); - hweight4 = ccdb->getForTimeStamp(ConfWeightPathALAL.value, cfgCcdbParam.nolaterthan.value); + hR_L = ccdb->getForTimeStamp(ConfRPathL.value, cfgCcdbParam.nolaterthan.value); + hR_AL = ccdb->getForTimeStamp(ConfRPathAL.value, cfgCcdbParam.nolaterthan.value); + hEff_L = ccdb->getForTimeStamp(ConfEffPathL.value, cfgCcdbParam.nolaterthan.value); + hEff_AL = ccdb->getForTimeStamp(ConfEffPathAL.value, cfgCcdbParam.nolaterthan.value); + // hweight1 = ccdb->getForTimeStamp(ConfWeightPathLL.value, cfgCcdbParam.nolaterthan.value); + // hweight2 = ccdb->getForTimeStamp(ConfWeightPathLAL.value, cfgCcdbParam.nolaterthan.value); + // hweight3 = ccdb->getForTimeStamp(ConfWeightPathALL.value, cfgCcdbParam.nolaterthan.value); + // hweight4 = ccdb->getForTimeStamp(ConfWeightPathALAL.value, cfgCcdbParam.nolaterthan.value); } } @@ -240,7 +275,7 @@ struct lambdaspincorrderived { void fillHistograms(int tag1, int tag2, const ROOT::Math::PtEtaPhiMVector& particle1, const ROOT::Math::PtEtaPhiMVector& particle2, const ROOT::Math::PtEtaPhiMVector& daughpart1, const ROOT::Math::PtEtaPhiMVector& daughpart2, - int datatype, float mixpairweight) + int datatype, float mixpairweight, int replacedFlag) { auto lambda1Mass = 0.0; @@ -397,6 +432,41 @@ struct lambdaspincorrderived { double deltaRap = std::abs(particle1Dummy.Rapidity() - particle2Dummy.Rapidity()); double deltaR = TMath::Sqrt(deltaEta * deltaEta + deltaPhi * deltaPhi); + double nuaWeightParticle1 = 1.0, epsWeightParticle1 = 1.0; + double nuaWeightParticle2 = 1.0, epsWeightParticle2 = 1.0; + + if (useweight && datatype == 1) { + // particle 1 + { + auto* hR = (tag1 == 0 ? hR_L : hR_AL); + auto* hEff = (tag1 == 0 ? hEff_L : hEff_AL); + + float pt = particle1.Pt(); + float eta = particle1.Eta(); + float phi = RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic); + + nuaWeightParticle1 = hR->GetBinContent(hR->FindBin(pt, eta, phi)); + if (replacedFlag == 1) { + epsWeightParticle1 = hEff->GetBinContent(hEff->FindBin(pt, eta, phi)); + } + } + + // particle 2 + { + auto* hR = (tag2 == 0 ? hR_L : hR_AL); + auto* hEff = (tag2 == 0 ? hEff_L : hEff_AL); + + float pt = particle2.Pt(); + float eta = particle2.Eta(); + float phi = RecoDecay::constrainAngle(particle2.Phi(), 0.0F, harmonic); + + nuaWeightParticle2 = hR->GetBinContent(hR->FindBin(pt, eta, phi)); + if (replacedFlag == 2) { + epsWeightParticle2 = hEff->GetBinContent(hEff->FindBin(pt, eta, phi)); + } + } + } + if (datatype == 0) { mixpairweight = 1.0; histos.fill(HIST("hPtYSame"), particle1.Pt(), particle1.Rapidity(), mixpairweight); @@ -404,59 +474,59 @@ struct lambdaspincorrderived { histos.fill(HIST("hSparseLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); histos.fill(HIST("hSparseRapLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); histos.fill(HIST("hSparsePhiLambdaLambda"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, mixpairweight); - histos.fill(HIST("hLambdaSameForLL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), mixpairweight); + // histos.fill(HIST("hLambdaSameForLL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), mixpairweight); } else if (tag1 == 0 && tag2 == 1) { histos.fill(HIST("hSparseLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); histos.fill(HIST("hSparseRapLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); histos.fill(HIST("hSparsePhiLambdaAntiLambda"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, mixpairweight); - histos.fill(HIST("hLambdaSameForLAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), mixpairweight); + // histos.fill(HIST("hLambdaSameForLAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), mixpairweight); } else if (tag1 == 1 && tag2 == 0) { histos.fill(HIST("hSparseAntiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); histos.fill(HIST("hSparseRapAntiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); histos.fill(HIST("hSparsePhiAntiLambdaLambda"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, mixpairweight); - histos.fill(HIST("hLambdaSameForALL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), mixpairweight); + // histos.fill(HIST("hLambdaSameForALL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), mixpairweight); } else if (tag1 == 1 && tag2 == 1) { histos.fill(HIST("hSparseAntiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); histos.fill(HIST("hSparseRapAntiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); histos.fill(HIST("hSparsePhiAntiLambdaAntiLambda"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, mixpairweight); - histos.fill(HIST("hAntiLambdaSameForALAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), mixpairweight); + // histos.fill(HIST("hAntiLambdaSameForALAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), mixpairweight); } } else if (datatype == 1) { - double weight1 = mixpairweight; - double weight2 = mixpairweight; - double weight3 = mixpairweight; - double weight4 = mixpairweight; - if (useweight) { - weight1 = mixpairweight * hweight1->GetBinContent(hweight1->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic))); - weight2 = mixpairweight * hweight2->GetBinContent(hweight2->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic))); - weight3 = mixpairweight * hweight3->GetBinContent(hweight3->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic))); - weight4 = mixpairweight * hweight4->GetBinContent(hweight4->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic))); - } - + // double weight1 = mixpairweight*nuaWeightParticle1*nuaWeightParticle2; + // double weight2 = mixpairweight*nuaWeightParticle1*nuaWeightParticle2; + // double weight3 = mixpairweight*nuaWeightParticle1*nuaWeightParticle2; + // double weight4 = mixpairweight*nuaWeightParticle1*nuaWeightParticle2; + // if (useweight) { + // weight1 = mixpairweight * hweight1->GetBinContent(hweight1->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic))); + // weight2 = mixpairweight * hweight2->GetBinContent(hweight2->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic))); + // weight3 = mixpairweight * hweight3->GetBinContent(hweight3->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic))); + // weight4 = mixpairweight * hweight4->GetBinContent(hweight4->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic))); + // } + double weight = mixpairweight * (nuaWeightParticle1 / epsWeightParticle1) * (nuaWeightParticle2 / epsWeightParticle2); if (tag1 == 0 && tag2 == 0) { - histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight1); - histos.fill(HIST("hSparseLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight1); - histos.fill(HIST("hSparseRapLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight1); - histos.fill(HIST("hSparsePhiLambdaLambdaMixed"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, weight1); - histos.fill(HIST("hLambdaMixForLL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), weight1); + histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight); + histos.fill(HIST("hSparseLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); + histos.fill(HIST("hSparseRapLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); + histos.fill(HIST("hSparsePhiLambdaLambdaMixed"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, weight); + // histos.fill(HIST("hLambdaMixForLL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), weight1); } else if (tag1 == 0 && tag2 == 1) { - histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight2); - histos.fill(HIST("hSparseLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight2); - histos.fill(HIST("hSparseRapLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight2); - histos.fill(HIST("hSparsePhiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, weight2); - histos.fill(HIST("hLambdaMixForLAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), weight2); + histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight); + histos.fill(HIST("hSparseLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); + histos.fill(HIST("hSparseRapLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); + histos.fill(HIST("hSparsePhiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, weight); + // histos.fill(HIST("hLambdaMixForLAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), weight2); } else if (tag1 == 1 && tag2 == 0) { - histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight3); - histos.fill(HIST("hSparseAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight3); - histos.fill(HIST("hSparseRapAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight3); - histos.fill(HIST("hSparsePhiAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, weight3); - histos.fill(HIST("hLambdaMixForALL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), weight3); + histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight); + histos.fill(HIST("hSparseAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); + histos.fill(HIST("hSparseRapAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); + histos.fill(HIST("hSparsePhiAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, weight); + // histos.fill(HIST("hLambdaMixForALL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), weight3); } else if (tag1 == 1 && tag2 == 1) { - histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight4); - histos.fill(HIST("hSparseAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight4); - histos.fill(HIST("hSparseRapAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight4); - histos.fill(HIST("hSparsePhiAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, weight4); - histos.fill(HIST("hAntiLambdaMixForALAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), weight4); + histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight); + histos.fill(HIST("hSparseAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); + histos.fill(HIST("hSparseRapAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); + histos.fill(HIST("hSparsePhiAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, weight); + // histos.fill(HIST("hAntiLambdaMixForALAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), weight4); } } } @@ -481,6 +551,14 @@ struct lambdaspincorrderived { histos.fill(HIST("etaCent"), v0.lambdaEta(), centrality); proton = ROOT::Math::PtEtaPhiMVector(v0.protonPt(), v0.protonEta(), v0.protonPhi(), o2::constants::physics::MassProton); lambda = ROOT::Math::PtEtaPhiMVector(v0.lambdaPt(), v0.lambdaEta(), v0.lambdaPhi(), v0.lambdaMass()); + + auto phiH0 = RecoDecay::constrainAngle(v0.lambdaPhi(), 0.0F, harmonic); + if (v0.v0Status() == 0) { + histos.fill(HIST("hSE_L"), v0.lambdaPt(), v0.lambdaEta(), phiH0); + } else { + histos.fill(HIST("hSE_AL"), v0.lambdaPt(), v0.lambdaEta(), phiH0); + } + for (const auto& v02 : V0s) { if (v02.index() <= v0.index()) { continue; @@ -498,16 +576,16 @@ struct lambdaspincorrderived { lambda2 = ROOT::Math::PtEtaPhiMVector(v02.lambdaPt(), v02.lambdaEta(), v02.lambdaPhi(), v02.lambdaMass()); histos.fill(HIST("deltaPhiSame"), std::abs(RecoDecay::constrainAngle(v0.lambdaPhi(), 0.0F, harmonic) - RecoDecay::constrainAngle(v02.lambdaPhi(), 0.0F, harmonic))); if (v0.v0Status() == 0 && v02.v0Status() == 0) { - fillHistograms(0, 0, lambda, lambda2, proton, proton2, 0, 1.0); + fillHistograms(0, 0, lambda, lambda2, proton, proton2, 0, 1.0, 0); } if (v0.v0Status() == 0 && v02.v0Status() == 1) { - fillHistograms(0, 1, lambda, lambda2, proton, proton2, 0, 1.0); + fillHistograms(0, 1, lambda, lambda2, proton, proton2, 0, 1.0, 0); } if (v0.v0Status() == 1 && v02.v0Status() == 0) { - fillHistograms(1, 0, lambda, lambda2, proton, proton2, 0, 1.0); + fillHistograms(1, 0, lambda, lambda2, proton, proton2, 0, 1.0, 0); } if (v0.v0Status() == 1 && v02.v0Status() == 1) { - fillHistograms(1, 1, lambda, lambda2, proton, proton2, 0, 1.0); + fillHistograms(1, 1, lambda, lambda2, proton, proton2, 0, 1.0, 0); } } } @@ -570,16 +648,16 @@ struct lambdaspincorrderived { lambda2 = ROOT::Math::PtEtaPhiMVector(t2.lambdaPt(), t2.lambdaEta(), t2.lambdaPhi(), t2.lambdaMass()); histos.fill(HIST("deltaPhiMix"), std::abs(RecoDecay::constrainAngle(t3.lambdaPhi(), 0.0F, harmonic) - RecoDecay::constrainAngle(t2.lambdaPhi(), 0.0F, harmonic))); if (t3.v0Status() == 0 && t2.v0Status() == 0) { - fillHistograms(0, 0, lambda, lambda2, proton, proton2, 1, 1.0); + fillHistograms(0, 0, lambda, lambda2, proton, proton2, 1, 1.0, 1); } if (t3.v0Status() == 0 && t2.v0Status() == 1) { - fillHistograms(0, 1, lambda, lambda2, proton, proton2, 1, 1.0); + fillHistograms(0, 1, lambda, lambda2, proton, proton2, 1, 1.0, 1); } if (t3.v0Status() == 1 && t2.v0Status() == 0) { - fillHistograms(1, 0, lambda, lambda2, proton, proton2, 1, 1.0); + fillHistograms(1, 0, lambda, lambda2, proton, proton2, 1, 1.0, 1); } if (t3.v0Status() == 1 && t2.v0Status() == 1) { - fillHistograms(1, 1, lambda, lambda2, proton, proton2, 1, 1.0); + fillHistograms(1, 1, lambda, lambda2, proton, proton2, 1, 1.0, 1); } } } // replacement track pair @@ -650,16 +728,16 @@ struct lambdaspincorrderived { histos.fill(HIST("deltaPhiMix"), dPhi, invN); if (t3.v0Status() == 0 && t2.v0Status() == 0) { - fillHistograms(0, 0, lambda, lambda2, proton, proton2, 1, invN); + fillHistograms(0, 0, lambda, lambda2, proton, proton2, 1, invN, 1); } if (t3.v0Status() == 0 && t2.v0Status() == 1) { - fillHistograms(0, 1, lambda, lambda2, proton, proton2, 1, invN); + fillHistograms(0, 1, lambda, lambda2, proton, proton2, 1, invN, 1); } if (t3.v0Status() == 1 && t2.v0Status() == 0) { - fillHistograms(1, 0, lambda, lambda2, proton, proton2, 1, invN); + fillHistograms(1, 0, lambda, lambda2, proton, proton2, 1, invN, 1); } if (t3.v0Status() == 1 && t2.v0Status() == 1) { - fillHistograms(1, 1, lambda, lambda2, proton, proton2, 1, invN); + fillHistograms(1, 1, lambda, lambda2, proton, proton2, 1, invN, 1); } } } // end mixing-event loop @@ -698,7 +776,30 @@ struct lambdaspincorrderived { if (t1.pionIndex() == t2.pionIndex()) continue; - // --- First pass over previous events in this bin: count replacements and build a list of usable pools + // --- Decide randomly which leg to replace: true=t1, false=t2 + const bool replaceFirst = (gRandom->Rndm() < 0.5); // requires or + + // Kinematics of the SE leg we attempt to replace + auto fillDen = [&](const auto& t) { + const double phiH = RecoDecay::constrainAngle(t.lambdaPhi(), 0.0F, harmonic); + if (t.v0Status() == 0) + histos.fill(HIST("hMatchDen_L"), t.lambdaPt(), t.lambdaEta(), phiH); + else + histos.fill(HIST("hMatchDen_AL"), t.lambdaPt(), t.lambdaEta(), phiH); + }; + + auto fillNum = [&](const auto& t) { + const double phiH = RecoDecay::constrainAngle(t.lambdaPhi(), 0.0F, harmonic); + if (t.v0Status() == 0) + histos.fill(HIST("hMatchNum_L"), t.lambdaPt(), t.lambdaEta(), phiH); + else + histos.fill(HIST("hMatchNum_AL"), t.lambdaPt(), t.lambdaEta(), phiH); + }; + + // Denominator: every SE leg we *try* to replace counts once + fillDen(replaceFirst ? t1 : t2); + + // --- First pass over previous events: count replacements for the chosen leg int mixes = 0; struct PoolView { AllTrackCandidates* pool; @@ -712,14 +813,14 @@ struct lambdaspincorrderived { it != eventPools[bin].rend() && mixes < nEvtMixing; ++it, ++mixes) { const int collision2idx = it->first; auto& poolB = it->second; - - // (defensive; shouldn't happen because we push the current event after mixing) if (collision2idx == collision1.index()) - continue; + continue; // safety int nRepl = 0; - for (auto& t3 : poolB) { - if (selectionV0(t3) && checkKinematics(t1, t3)) + for (auto& tX : poolB) { + if (!selectionV0(tX)) + continue; + if (replaceFirst ? checkKinematics(t1, tX) : checkKinematics(t2, tX)) ++nRepl; } if (nRepl > 0) { @@ -728,36 +829,48 @@ struct lambdaspincorrderived { } } + // Numerator: counts only if at least one replacement exists + if (totalRepl > 0) { + fillNum(replaceFirst ? t1 : t2); + } + if (totalRepl == 0) continue; - const float w = 1.0f / static_cast(totalRepl); // global normalization: sum of weights over all replacements = 1 + const float wBase = 1.0f / static_cast(totalRepl); - // --- Second pass: fill with normalized weight w + // --- Second pass: actually build mixed pairs for the chosen leg for (auto& pv : usable) { auto& poolB = *pv.pool; - for (auto& t3 : poolB) { - if (!(selectionV0(t3) && checkKinematics(t1, t3))) + for (auto& tX : poolB) { + if (!selectionV0(tX)) + continue; + if (!(replaceFirst ? checkKinematics(t1, tX) : checkKinematics(t2, tX))) continue; - // build 4-vectors for the mixed pair (t3 from prior event replaces t1; t2 stays from current event) - proton = ROOT::Math::PtEtaPhiMVector(t3.protonPt(), t3.protonEta(), t3.protonPhi(), o2::constants::physics::MassProton); - lambda = ROOT::Math::PtEtaPhiMVector(t3.lambdaPt(), t3.lambdaEta(), t3.lambdaPhi(), t3.lambdaMass()); - proton2 = ROOT::Math::PtEtaPhiMVector(t2.protonPt(), t2.protonEta(), t2.protonPhi(), o2::constants::physics::MassProton); - lambda2 = ROOT::Math::PtEtaPhiMVector(t2.lambdaPt(), t2.lambdaEta(), t2.lambdaPhi(), t2.lambdaMass()); - - float dPhi = std::fabs( - RecoDecay::constrainAngle(lambda.Phi(), 0.0F, harmonic) - - RecoDecay::constrainAngle(lambda2.Phi(), 0.0F, harmonic)); - histos.fill(HIST("deltaPhiMix"), dPhi, w); - - if (t3.v0Status() == 0 && t2.v0Status() == 0) { - fillHistograms(0, 0, lambda, lambda2, proton, proton2, 1, w); - } else if (t3.v0Status() == 0 && t2.v0Status() == 1) { - fillHistograms(0, 1, lambda, lambda2, proton, proton2, 1, w); - } else if (t3.v0Status() == 1 && t2.v0Status() == 0) { - fillHistograms(1, 0, lambda, lambda2, proton, proton2, 1, w); - } else if (t3.v0Status() == 1 && t2.v0Status() == 1) { - fillHistograms(1, 1, lambda, lambda2, proton, proton2, 1, w); + if (replaceFirst) { + // Replace t1 with tX; keep t2 + proton = ROOT::Math::PtEtaPhiMVector(tX.protonPt(), tX.protonEta(), tX.protonPhi(), o2::constants::physics::MassProton); + lambda = ROOT::Math::PtEtaPhiMVector(tX.lambdaPt(), tX.lambdaEta(), tX.lambdaPhi(), tX.lambdaMass()); + proton2 = ROOT::Math::PtEtaPhiMVector(t2.protonPt(), t2.protonEta(), t2.protonPhi(), o2::constants::physics::MassProton); + lambda2 = ROOT::Math::PtEtaPhiMVector(t2.lambdaPt(), t2.lambdaEta(), t2.lambdaPhi(), t2.lambdaMass()); + + const float dPhi = std::fabs(RecoDecay::constrainAngle(lambda.Phi(), 0.0F, harmonic) - + RecoDecay::constrainAngle(lambda2.Phi(), 0.0F, harmonic)); + histos.fill(HIST("deltaPhiMix"), dPhi, wBase); + + fillHistograms(tX.v0Status(), t2.v0Status(), lambda, lambda2, proton, proton2, 1, wBase, 1); + } else { + // Replace t2 with tX; keep t1 + proton = ROOT::Math::PtEtaPhiMVector(t1.protonPt(), t1.protonEta(), t1.protonPhi(), o2::constants::physics::MassProton); + lambda = ROOT::Math::PtEtaPhiMVector(t1.lambdaPt(), t1.lambdaEta(), t1.lambdaPhi(), t1.lambdaMass()); + proton2 = ROOT::Math::PtEtaPhiMVector(tX.protonPt(), tX.protonEta(), tX.protonPhi(), o2::constants::physics::MassProton); + lambda2 = ROOT::Math::PtEtaPhiMVector(tX.lambdaPt(), tX.lambdaEta(), tX.lambdaPhi(), tX.lambdaMass()); + + const float dPhi = std::fabs(RecoDecay::constrainAngle(lambda.Phi(), 0.0F, harmonic) - + RecoDecay::constrainAngle(lambda2.Phi(), 0.0F, harmonic)); + histos.fill(HIST("deltaPhiMix"), dPhi, wBase); + + fillHistograms(t1.v0Status(), tX.v0Status(), lambda, lambda2, proton, proton2, 1, wBase, 2); } } } @@ -765,6 +878,19 @@ struct lambdaspincorrderived { // after mixing with prior events, push current event into the pool auto sliced = V0s.sliceBy(tracksPerCollisionV0, collision1.index()); + + // --- ME singles (one fill per candidate) for this event entering the pool --- + for (auto& t : sliced) { + if (!selectionV0(t)) + continue; + const double phiH = RecoDecay::constrainAngle(t.lambdaPhi(), 0.0F, harmonic); + if (t.v0Status() == 0) { + histos.fill(HIST("hME_L"), t.lambdaPt(), t.lambdaEta(), phiH); + } else { + histos.fill(HIST("hME_AL"), t.lambdaPt(), t.lambdaEta(), phiH); + } + } + eventPools[bin].emplace_back(collision1.index(), std::move(sliced)); if (static_cast(eventPools[bin].size()) > nEvtMixing) { eventPools[bin].pop_front(); From b23b6845a7d2fb492d560253a651df5da21785d3 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Wed, 1 Oct 2025 08:19:54 +0200 Subject: [PATCH 588/986] [PWGEM/Dilepton] update MlResponse (#13190) --- PWGEM/Dilepton/Utils/MlResponseDielectronSingleTrack.h | 3 +++ PWGEM/Dilepton/Utils/MlResponseO2Track.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/PWGEM/Dilepton/Utils/MlResponseDielectronSingleTrack.h b/PWGEM/Dilepton/Utils/MlResponseDielectronSingleTrack.h index 2ed0b02fe3c..5ec9756b5a9 100644 --- a/PWGEM/Dilepton/Utils/MlResponseDielectronSingleTrack.h +++ b/PWGEM/Dilepton/Utils/MlResponseDielectronSingleTrack.h @@ -144,6 +144,7 @@ enum class InputFeaturesDielectronSingleTrack : uint8_t { tgl, isAssociatedToMPC, tpcNClsFound, + tpcNClsPID, tpcNClsCrossedRows, tpcCrossedRowsOverFindableCls, tpcFoundOverFindableCls, @@ -266,6 +267,7 @@ class MlResponseDielectronSingleTrack : public MlResponse CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tgl); CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(isAssociatedToMPC); CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tpcNClsFound); + CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tpcNClsPID); CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tpcNClsCrossedRows); CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tpcCrossedRowsOverFindableCls); CHECK_AND_FILL_DIELECTRON_SINGLE_TRACK(tpcFoundOverFindableCls); @@ -414,6 +416,7 @@ class MlResponseDielectronSingleTrack : public MlResponse FILL_MAP_DIELECTRON_SINGLE_TRACK(tgl), FILL_MAP_DIELECTRON_SINGLE_TRACK(isAssociatedToMPC), FILL_MAP_DIELECTRON_SINGLE_TRACK(tpcNClsFound), + FILL_MAP_DIELECTRON_SINGLE_TRACK(tpcNClsPID), FILL_MAP_DIELECTRON_SINGLE_TRACK(tpcNClsCrossedRows), FILL_MAP_DIELECTRON_SINGLE_TRACK(tpcCrossedRowsOverFindableCls), FILL_MAP_DIELECTRON_SINGLE_TRACK(tpcFoundOverFindableCls), diff --git a/PWGEM/Dilepton/Utils/MlResponseO2Track.h b/PWGEM/Dilepton/Utils/MlResponseO2Track.h index 5e1f2fc4226..d898d9da5f6 100644 --- a/PWGEM/Dilepton/Utils/MlResponseO2Track.h +++ b/PWGEM/Dilepton/Utils/MlResponseO2Track.h @@ -160,6 +160,7 @@ enum class InputFeaturesO2Track : uint8_t { tpctofNSigmaKa, tpctofNSigmaPr, tpcNClsFound, + tpcNClsPID, tpcNClsCrossedRows, tpcChi2NCl, hasITS, @@ -215,6 +216,7 @@ class MlResponseO2Track : public MlResponse CHECK_AND_FILL_O2_TRACK_TPCTOF(tpctofNSigmaKa, tpcNSigmaKa, tofNSigmaKa, hasTOF); CHECK_AND_FILL_O2_TRACK_TPCTOF(tpctofNSigmaPr, tpcNSigmaPr, tofNSigmaPr, hasTOF); CHECK_AND_FILL_O2_TRACK(tpcNClsFound); + CHECK_AND_FILL_O2_TRACK(tpcNClsPID); CHECK_AND_FILL_O2_TRACK(tpcNClsCrossedRows); CHECK_AND_FILL_O2_TRACK(tpcChi2NCl); CHECK_AND_FILL_O2_TRACK(hasITS); @@ -296,6 +298,7 @@ class MlResponseO2Track : public MlResponse FILL_MAP_O2_TRACK(tpctofNSigmaKa), FILL_MAP_O2_TRACK(tpctofNSigmaPr), FILL_MAP_O2_TRACK(tpcNClsFound), + FILL_MAP_O2_TRACK(tpcNClsPID), FILL_MAP_O2_TRACK(tpcNClsCrossedRows), FILL_MAP_O2_TRACK(tpcChi2NCl), FILL_MAP_O2_TRACK(hasITS), From 7fb1b68edeaee502bbab7e6d9f9460aef1c95528 Mon Sep 17 00:00:00 2001 From: Sandeep Dudi <69388148+sdudi123@users.noreply.github.com> Date: Wed, 1 Oct 2025 08:45:27 +0200 Subject: [PATCH 589/986] [PWGLF] Fine-tune the track selection criteria (#13180) Co-authored-by: sandeep dudi --- PWGLF/Tasks/Nuspex/spectraKinkPiKa.cxx | 276 +++++++++++++++---------- 1 file changed, 168 insertions(+), 108 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/spectraKinkPiKa.cxx b/PWGLF/Tasks/Nuspex/spectraKinkPiKa.cxx index 4d8f6db1d26..e522e206093 100644 --- a/PWGLF/Tasks/Nuspex/spectraKinkPiKa.cxx +++ b/PWGLF/Tasks/Nuspex/spectraKinkPiKa.cxx @@ -372,31 +372,40 @@ struct spectraKinkPiKa { Configurable minradius{"minradius", 130.0, "minradiuscut"}; Configurable maxradius{"maxradius", 200.0, "maxradiuscut"}; Configurable dcaXYcut{"dcaXYcut", 0.2, "dcaXYcut"}; + Configurable dcaXYcutkink{"dcaXYcutkink", 0.2, "dcaXYcutkink"}; Configurable dcaZcut{"dcaZcut", 0.2, "dcaZcut"}; Configurable tpcChi2Cut{"tpcChi2Cut", 4.0, "tpcChi2Cut"}; + Configurable minqt{"minqt", 0.12, "min qt for kaon"}; + Configurable maxqt{"maxqt", 0.3, "max qt for kaon"}; + Configurable centestimator{"centestimator", 0, "Select multiplicity estimator: 0 - FT0C, 1 - FT0A, 2 - FT0M, 3 - FV0A, 4 - PVTracks"}; Configurable pid{"pidMother", 321, ""}; Configurable dpid{"pidDaughter", 13, ""}; Configurable d0pid{"dopid", 0, ""}; Configurable dptCut{"dptCut", 0, ""}; + Configurable qa{"qa", 0, ""}; + Configurable maxtpcncle{"maxtpcncle", 0, "max tpc find ncle"}; + Configurable mintpcncle{"mintpcncle", 0, "min tpc find ncle"}; + Configurable onlykaon{"onlykaon", 0, "kaon"}; + Configurable onlypion{"onlypion", 0, "pion"}; + + ConfigurableAxis ptAxis{"ptAxis", {150, 0, 15}, ""}; + ConfigurableAxis qtAxis{"qtAxis", {2000, 0.0, 2.0}, ""}; + ConfigurableAxis kinkAxis{"kinkAxis", {200, 0.0, 4.0}, ""}; + ConfigurableAxis etaAxis{"etaAxis", {200, -5.0, 5.0}, ""}; + ConfigurableAxis vertexAxis{"vertexAxis", {1200, -300.0, 300.0}, ""}; + ConfigurableAxis radiusAxis{"radiusAxis", {600, 0.0, 300.0}, ""}; + ConfigurableAxis massAxis{"massAxis", {600, 0.1, 0.7}, ""}; + ConfigurableAxis multAxis{"multAxis", {120, 0.0, 120.0}, ""}; Preslice mPerCol = aod::track::collisionId; Preslice mtPerCol = aod::track::collisionId; void init(InitContext const&) { - // Axes - const AxisSpec ptAxis{100, 0, 10, "#it{p}_{T} (GeV/#it{c})"}; - const AxisSpec qtAxis{2000, 0, 2, "#it{q}_{T} (GeV/#it{c})"}; - const AxisSpec kinkAxis{200, 0, 4, "#theta"}; - const AxisSpec etaAxis{200, -5.0, 5.0, "#eta"}; - const AxisSpec vertexAxis{1200, -300., 300., "vrtx [cm]"}; - const AxisSpec radiusAxis{600, 0., 300., "vrtx [cm]"}; - const AxisSpec massAxis{600, 0.1, 0.7, "Inv mass (GeV/#it{c}^{2})"}; - const AxisSpec multAxis{120, 0, 120, "Multiplicity"}; // Event selection - rEventSelection.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexAxis}}); + rEventSelection.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {{200, -20.0, 20.0}}}); rEventSelection.add("hMultiplicity", "hMultiplicity", {HistType::kTH1F, {multAxis}}); rpiKkink.add("h2_dau_pt_vs_eta_rec", "pt_vs_eta_dau", {HistType::kTH3F, {ptAxis, etaAxis, multAxis}}); @@ -424,23 +433,44 @@ struct spectraKinkPiKa { rpiKkink.add("h2_pion_data", "h2_pion_data", HistType::kTHnSparseF, {massAxis, ptAxis, etaAxis, qtAxis, multAxis}, true); // track qa - rpiKkink.add("h2_kinkradius_vs_vz", "kink radius_vz", {HistType::kTH2F, {vertexAxis, radiusAxis}}); - rpiKkink.add("h2_kink_vx_vs_vy", "kink vx vs vz ", {HistType::kTH2F, {vertexAxis, vertexAxis}}); + if (qa) { + rpiKkink.add("h2_kinkradius_vs_pt", "kink radius_vs pt", {HistType::kTH2F, {radiusAxis, ptAxis}}); + rpiKkink.add("h2_kinkradius_vs_ncl", "kink radius_vs ncl", {HistType::kTH2F, {radiusAxis, {300, 0.0, 300.0}}}); + + rpiKkink.add("h2_kinkradius_vs_vz", "kink radius_vz", {HistType::kTH2F, {vertexAxis, radiusAxis}}); + rpiKkink.add("h2_kink_vx_vs_vy", "kink vx vs vz ", {HistType::kTH2F, {vertexAxis, vertexAxis}}); + + rpiKkink.add("tpc_dedx", "p vs dE/dx", {HistType::kTH2F, {{500, 0.0, 10.0}, {5000, 0.0, 5000.0}}}); + rpiKkink.add("tpc_nsigma_kaon", "p#k n#sigma", {HistType::kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}}); + rpiKkink.add("tpc_nsigma_pion", "p#pi n#sigma", {HistType::kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}}); + + rpiKkink.add("tr_dcaxyM", "dcaxym", {HistType::kTH1F, {{1000, -5.0, 5.0}}}); + rpiKkink.add("tr_dcaxyD", "dcaxyd", {HistType::kTH1F, {{1000, -5.0, 5.0}}}); + rpiKkink.add("tr_dcaxykink_topo", "tr_dcaxykink_topo", {HistType::kTH1F, {{1000, -5.0, 5.0}}}); - rpiKkink.add("tpc_dedx", "p vs dE/dx", {HistType::kTH2F, {{500, 0.0, 10.0}, {5000, 0.0, 5000.0}}}); - rpiKkink.add("tpc_nsigma_kaon", "p#k n#sigma", {HistType::kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}}); - rpiKkink.add("tpc_nsigma_pion", "p#pi n#sigma", {HistType::kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}}); + rpiKkink.add("tr_chi2nclM", "chi2nclm", {HistType::kTH1F, {{100, 0.0, 100.0}}}); + rpiKkink.add("tr_chi2nclD", "chi2ncld", {HistType::kTH1F, {{100, 0.0, 100.0}}}); + rpiKkink.add("tr_tpcnclfindM", "tpcnclfindm", {HistType::kTH1F, {{300, 0.0, 300.0}}}); + rpiKkink.add("tr_tpcnclfindD", "tpcnclfindd", {HistType::kTH1F, {{300, 0.0, 300.0}}}); + rpiKkink.add("tr_itsChi2NClM", "itsChi2NClm", {HistType::kTH1F, {{200, 0.0, 200.0}}}); + + rpiKkink.add("h2_kinkradius_vs_vz_m", "kink radius_vz", {HistType::kTH2F, {vertexAxis, radiusAxis}}); + rpiKkink.add("h2_kink_vx_vs_vy_m", "kink vx vs vz ", {HistType::kTH2F, {vertexAxis, vertexAxis}}); - rpiKkink.add("tr_dcaxyM", "dcaxym", {HistType::kTH1F, {{1000, -5.0, 5.0}}}); - rpiKkink.add("tr_dcaxyD", "dcaxyd", {HistType::kTH1F, {{1000, -5.0, 5.0}}}); - rpiKkink.add("tr_dcaxykink_topo", "tr_dcaxykink_topo", {HistType::kTH1F, {{1000, -5.0, 5.0}}}); + rpiKkink.add("tpc_dedx_m", "p vs dE/dx", {HistType::kTH2F, {{500, 0.0, 10.0}, {5000, 0.0, 5000.0}}}); + rpiKkink.add("tpc_nsigma_kaon_m", "p#k n#sigma", {HistType::kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}}); + rpiKkink.add("tpc_nsigma_pion_m", "p#pi n#sigma", {HistType::kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}}); - rpiKkink.add("tr_chi2nclM", "chi2nclm", {HistType::kTH1F, {{100, 0.0, 100.0}}}); - rpiKkink.add("tr_chi2nclD", "chi2ncld", {HistType::kTH1F, {{100, 0.0, 100.0}}}); - rpiKkink.add("tr_tpcnclfindM", "tpcnclfindm", {HistType::kTH1F, {{300, 0.0, 300.0}}}); - rpiKkink.add("tr_tpcnclfindD", "tpcnclfindd", {HistType::kTH1F, {{300, 0.0, 300.0}}}); - rpiKkink.add("tr_itsChi2NClM", "itsChi2NClm", {HistType::kTH1F, {{200, 0.0, 200.0}}}); + rpiKkink.add("tr_dcaxyM_m", "dcaxym", {HistType::kTH1F, {{1000, -5.0, 5.0}}}); + rpiKkink.add("tr_dcaxyD_m", "dcaxyd", {HistType::kTH1F, {{1000, -5.0, 5.0}}}); + rpiKkink.add("tr_dcaxykink_topo_m", "tr_dcaxykink_topo", {HistType::kTH1F, {{1000, -5.0, 5.0}}}); + rpiKkink.add("tr_chi2nclM_m", "chi2nclm", {HistType::kTH1F, {{100, 0.0, 100.0}}}); + rpiKkink.add("tr_chi2nclD_m", "chi2ncld", {HistType::kTH1F, {{100, 0.0, 100.0}}}); + rpiKkink.add("tr_tpcnclfindM_m", "tpcnclfindm", {HistType::kTH1F, {{300, 0.0, 300.0}}}); + rpiKkink.add("tr_tpcnclfindD_m", "tpcnclfindd", {HistType::kTH1F, {{300, 0.0, 300.0}}}); + rpiKkink.add("tr_itsChi2NClM_m", "itsChi2NClm", {HistType::kTH1F, {{200, 0.0, 200.0}}}); + } if (doprocessMC) { rpiKkink.add("h2_dau_pt_vs_eta_gen", "pt_vs_eta_dau", {HistType::kTH2F, {ptAxis, etaAxis}}); rpiKkink.add("h2_moth_pt_vs_eta_gen", "pt_vs_eta_moth", {HistType::kTH2F, {ptAxis, etaAxis}}); @@ -453,10 +483,6 @@ struct spectraKinkPiKa { rpiKkink.add("h2_kaon_mc_gen", "h2_kaon_mc_gen", HistType::kTHnSparseF, {massAxis, ptAxis, etaAxis, qtAxis}, true); rpiKkink.add("h2_kaon_mc_rec", "h2_kaon_mc_rec", HistType::kTHnSparseF, {massAxis, ptAxis, etaAxis, qtAxis, multAxis}, true); - // qa - rpiKkink.add("h2_kinkradius_vs_vz_m", "kink radius_vz", {HistType::kTH2F, {vertexAxis, radiusAxis}}); - rpiKkink.add("h2_kink_vx_vs_vy_m", "kink vx vs vz ", {HistType::kTH2F, {vertexAxis, vertexAxis}}); - rpiKkink.add("h2_dau_pt_vs_eta_rec_m", "pt_vs_eta_dau", {HistType::kTH3F, {ptAxis, etaAxis, multAxis}}); rpiKkink.add("h2_moth_pt_vs_eta_rec_m", "pt_vs_eta_moth", {HistType::kTH3F, {ptAxis, etaAxis, multAxis}}); rpiKkink.add("h2_pt_moth_vs_dau_rec_m", "pt_moth_vs_dau", {HistType::kTH2F, {ptAxis, ptAxis}}); @@ -464,19 +490,7 @@ struct spectraKinkPiKa { rpiKkink.add("h2_invmass_kaon_m", "Inv mass vs Pt", {HistType::kTH3F, {massAxis, ptAxis, ptAxis}}); rpiKkink.add("h2_kaon_mc_rec_m", "h2_kaon_mc_rec_m", HistType::kTHnSparseF, {massAxis, ptAxis, etaAxis, qtAxis, multAxis}, true); - rpiKkink.add("tpc_dedx_m", "p vs dE/dx", {HistType::kTH2F, {{500, 0.0, 10.0}, {5000, 0.0, 5000.0}}}); - rpiKkink.add("tpc_nsigma_kaon_m", "p#k n#sigma", {HistType::kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}}); - rpiKkink.add("tpc_nsigma_pion_m", "p#pi n#sigma", {HistType::kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}}); - - rpiKkink.add("tr_dcaxyM_m", "dcaxym", {HistType::kTH1F, {{1000, -5.0, 5.0}}}); - rpiKkink.add("tr_dcaxyD_m", "dcaxyd", {HistType::kTH1F, {{1000, -5.0, 5.0}}}); - rpiKkink.add("tr_dcaxykink_topo_m", "tr_dcaxykink_topo", {HistType::kTH1F, {{1000, -5.0, 5.0}}}); - - rpiKkink.add("tr_chi2nclM_m", "chi2nclm", {HistType::kTH1F, {{100, 0.0, 100.0}}}); - rpiKkink.add("tr_chi2nclD_m", "chi2ncld", {HistType::kTH1F, {{100, 0.0, 100.0}}}); - rpiKkink.add("tr_tpcnclfindM_m", "tpcnclfindm", {HistType::kTH1F, {{300, 0.0, 300.0}}}); - rpiKkink.add("tr_tpcnclfindD_m", "tpcnclfindd", {HistType::kTH1F, {{300, 0.0, 300.0}}}); - rpiKkink.add("tr_itsChi2NClM_m", "itsChi2NClm", {HistType::kTH1F, {{200, 0.0, 200.0}}}); + // qa } } @@ -554,18 +568,24 @@ struct spectraKinkPiKa { if (dptCut && v1.Pt() > v0.Pt()) continue; - rpiKkink.fill(HIST("tpc_dedx"), v0.P(), mothTrack.tpcSignal()); - rpiKkink.fill(HIST("tpc_nsigma_kaon"), v0.Pt(), mothTrack.tpcNSigmaKa()); - rpiKkink.fill(HIST("tpc_nsigma_pion"), v0.Pt(), mothTrack.tpcNSigmaPi()); + if (qa) { - rpiKkink.fill(HIST("tr_chi2nclM"), mothTrack.tpcChi2NCl()); - rpiKkink.fill(HIST("tr_chi2nclD"), dauTrack.tpcChi2NCl()); - rpiKkink.fill(HIST("tr_tpcnclfindM"), mothTrack.tpcNClsFindable()); - rpiKkink.fill(HIST("tr_tpcnclfindD"), dauTrack.tpcNClsFindable()); - rpiKkink.fill(HIST("tr_itsChi2NClM"), mothTrack.itsChi2NCl()); + rpiKkink.fill(HIST("tpc_dedx"), v0.P(), mothTrack.tpcSignal()); + rpiKkink.fill(HIST("tpc_nsigma_kaon"), v0.Pt(), mothTrack.tpcNSigmaKa()); + rpiKkink.fill(HIST("tpc_nsigma_pion"), v0.Pt(), mothTrack.tpcNSigmaPi()); + rpiKkink.fill(HIST("tr_chi2nclM"), mothTrack.tpcChi2NCl()); + rpiKkink.fill(HIST("tr_chi2nclD"), dauTrack.tpcChi2NCl()); + rpiKkink.fill(HIST("tr_tpcnclfindM"), mothTrack.tpcNClsFindable()); + rpiKkink.fill(HIST("tr_tpcnclfindD"), dauTrack.tpcNClsFindable()); + rpiKkink.fill(HIST("tr_itsChi2NClM"), mothTrack.itsChi2NCl()); + } if (mothTrack.tpcChi2NCl() > tpcChi2Cut) continue; + + if (mothTrack.tpcNClsFindable() > maxtpcncle || mothTrack.tpcNClsFindable() < mintpcncle) + continue; + if (std::abs(mothTrack.tpcNSigmaKa()) < cutNSigmaKa) { kaon = true; } @@ -582,12 +602,21 @@ struct spectraKinkPiKa { if (radiusxy < minradius || radiusxy > maxradius) continue; // dcaXYmoth kinkCand.decVtx[0], kinkCand.decVtx[1], kinkCand.decVtx[2], - rpiKkink.fill(HIST("tr_dcaxyM"), kinkCand.dcaMothPv()); - rpiKkink.fill(HIST("tr_dcaxyD"), kinkCand.dcaDaugPv()); - rpiKkink.fill(HIST("tr_dcaxykink_topo"), kinkCand.dcaKinkTopo()); + if (qa) { + rpiKkink.fill(HIST("tr_dcaxyM"), kinkCand.dcaMothPv()); + rpiKkink.fill(HIST("tr_dcaxyD"), kinkCand.dcaDaugPv()); + rpiKkink.fill(HIST("tr_dcaxykink_topo"), kinkCand.dcaKinkTopo()); - rpiKkink.fill(HIST("h2_kinkradius_vs_vz"), kinkCand.zDecVtx(), radiusxy); - rpiKkink.fill(HIST("h2_kink_vx_vs_vy"), kinkCand.xDecVtx(), kinkCand.yDecVtx()); + rpiKkink.fill(HIST("h2_kinkradius_vs_vz"), kinkCand.zDecVtx(), radiusxy); + rpiKkink.fill(HIST("h2_kink_vx_vs_vy"), kinkCand.xDecVtx(), kinkCand.yDecVtx()); + rpiKkink.fill(HIST("h2_kinkradius_vs_pt"), radiusxy, v0.Pt()); + rpiKkink.fill(HIST("h2_kinkradius_vs_ncl"), radiusxy, mothTrack.tpcNClsFindable()); + } + if (kinkCand.dcaMothPv() > dcaXYcut) + continue; + + if (kinkCand.dcaKinkTopo() > dcaXYcutkink) + continue; float pMoth = v0.P(); float pDaug = v1.P(); @@ -596,39 +625,52 @@ struct spectraKinkPiKa { float radToDeg = o2::constants::math::Rad2Deg; if (kinkangle * radToDeg < kinkanglecut) continue; + TVector3 pdlab(v1.Px(), v1.Py(), v1.Pz()); + // Compute transverse component + TVector3 motherDir(v0.Px(), v0.Py(), v0.Pz()); + double ptd = pdlab.Perp(motherDir); // or p_d_lab.Mag() * sin(theta) - if (kaon) { + if (kaon && onlykaon && std::abs(v0.Rapidity()) < rapCut) { + v0.SetCoordinates(mothTrack.px(), mothTrack.py(), mothTrack.pz(), o2::constants::physics::MassKaonCharged); rpiKkink.fill(HIST("h2_moth_pt_vs_eta_rec"), v0.Pt(), v0.Eta(), multiplicity); rpiKkink.fill(HIST("h2_dau_pt_vs_eta_rec"), v1.Pt(), v1.Eta(), multiplicity); rpiKkink.fill(HIST("h2_pt_moth_vs_dau_rec"), v0.Pt(), v1.Pt()); rpiKkink.fill(HIST("h2_kink_angle"), kinkangle, multiplicity); + double mass = computeMotherMass(v0, v1); + rpiKkink.fill(HIST("h2_qt_vs_pt"), ptd, v1.Pt()); + rpiKkink.fill(HIST("h2_kaon_data"), mass, v0.Pt(), v0.Rapidity(), ptd, multiplicity); + + if (qa && ptd > minqt && ptd < maxqt) { + rpiKkink.fill(HIST("h2_kinkradius_vs_vz_m"), kinkCand.zDecVtx(), radiusxy); + rpiKkink.fill(HIST("h2_kink_vx_vs_vy_m"), kinkCand.xDecVtx(), kinkCand.yDecVtx()); + + rpiKkink.fill(HIST("tpc_dedx_m"), v0.P(), mothTrack.tpcSignal()); + rpiKkink.fill(HIST("tpc_nsigma_kaon_m"), v0.Pt(), mothTrack.tpcNSigmaKa()); + rpiKkink.fill(HIST("tpc_nsigma_pion_m"), v0.Pt(), mothTrack.tpcNSigmaPi()); + + rpiKkink.fill(HIST("tr_chi2nclM_m"), mothTrack.tpcChi2NCl()); + rpiKkink.fill(HIST("tr_chi2nclD_m"), dauTrack.tpcChi2NCl()); + rpiKkink.fill(HIST("tr_tpcnclfindM_m"), mothTrack.tpcNClsFindable()); + rpiKkink.fill(HIST("tr_tpcnclfindD_m"), dauTrack.tpcNClsFindable()); + rpiKkink.fill(HIST("tr_itsChi2NClM_m"), mothTrack.itsChi2NCl()); + + rpiKkink.fill(HIST("tr_dcaxyM_m"), kinkCand.dcaMothPv()); + rpiKkink.fill(HIST("tr_dcaxyD_m"), kinkCand.dcaDaugPv()); + rpiKkink.fill(HIST("tr_dcaxykink_topo_m"), kinkCand.dcaKinkTopo()); + + rpiKkink.fill(HIST("h2_kinkradius_vs_pt"), radiusxy, v0.Pt()); + rpiKkink.fill(HIST("h2_kinkradius_vs_ncl"), radiusxy, mothTrack.tpcNClsFindable()); + } } - if (pion) { + if (pion && onlypion && std::abs(v0.Rapidity()) < rapCut) { rpiKkink.fill(HIST("h2_moth_pt_vs_eta_rec_pion"), v0.Pt(), v0.Eta(), multiplicity); rpiKkink.fill(HIST("h2_dau_pt_vs_eta_rec_pion"), v1.Pt(), v1.Eta(), multiplicity); rpiKkink.fill(HIST("h2_pt_moth_vs_dau_rec_pion"), v0.Pt(), v1.Pt()); rpiKkink.fill(HIST("h2_kink_angle_pion"), kinkangle, multiplicity); - } - TVector3 pdlab(v1.Px(), v1.Py(), v1.Pz()); - // Compute transverse component - TVector3 motherDir(v0.Px(), v0.Py(), v0.Pz()); - double ptd = pdlab.Perp(motherDir); // or p_d_lab.Mag() * sin(theta) - - if (kaon) { - v0.SetCoordinates(mothTrack.px(), mothTrack.py(), mothTrack.pz(), o2::constants::physics::MassKaonCharged); - double mass = computeMotherMass(v0, v1); - rpiKkink.fill(HIST("h2_qt"), ptd); - rpiKkink.fill(HIST("h2_qt_vs_pt"), ptd, v1.Pt()); - rpiKkink.fill(HIST("h2_invmass_kaon"), mass, v0.Pt(), ptd); - rpiKkink.fill(HIST("h2_kaon_data"), mass, v0.Pt(), v0.Eta(), ptd, multiplicity); - } - if (pion) { v0.SetCoordinates(mothTrack.px(), mothTrack.py(), mothTrack.pz(), o2::constants::physics::MassPionCharged); double mass = computeMotherMass(v0, v1); - rpiKkink.fill(HIST("h2_qt_pion"), ptd); rpiKkink.fill(HIST("h2_qt_vs_ptpion"), ptd, v1.Pt()); - rpiKkink.fill(HIST("h2_invmass_pion"), mass, v0.Pt(), ptd); - rpiKkink.fill(HIST("h2_pion_data"), mass, v0.Pt(), v0.Eta(), ptd, multiplicity); + rpiKkink.fill(HIST("h2_pion_data"), mass, v0.Pt(), v0.Rapidity(), ptd, multiplicity); } } } @@ -675,16 +717,22 @@ struct spectraKinkPiKa { v0.SetCoordinates(mothTrack.px(), mothTrack.py(), mothTrack.pz(), o2::constants::physics::MassKaonCharged); v1.SetCoordinates(dauTrack.px(), dauTrack.py(), dauTrack.pz(), o2::constants::physics::MassMuon); + if (qa) { + rpiKkink.fill(HIST("tpc_dedx"), v0.P(), mothTrack.tpcSignal()); + rpiKkink.fill(HIST("tpc_nsigma_kaon"), v0.Pt(), mothTrack.tpcNSigmaKa()); + rpiKkink.fill(HIST("tpc_nsigma_pion"), v0.Pt(), mothTrack.tpcNSigmaPi()); + + rpiKkink.fill(HIST("tr_chi2nclM"), mothTrack.tpcChi2NCl()); + rpiKkink.fill(HIST("tr_chi2nclD"), dauTrack.tpcChi2NCl()); + rpiKkink.fill(HIST("tr_tpcnclfindM"), mothTrack.tpcNClsFindable()); + rpiKkink.fill(HIST("tr_tpcnclfindD"), dauTrack.tpcNClsFindable()); + rpiKkink.fill(HIST("tr_itsChi2NClM"), mothTrack.itsChi2NCl()); + } + if (mothTrack.tpcChi2NCl() > tpcChi2Cut) + continue; - rpiKkink.fill(HIST("tpc_dedx"), v0.P(), mothTrack.tpcSignal()); - rpiKkink.fill(HIST("tpc_nsigma_kaon"), v0.Pt(), mothTrack.tpcNSigmaKa()); - rpiKkink.fill(HIST("tpc_nsigma_pion"), v0.Pt(), mothTrack.tpcNSigmaPi()); - - rpiKkink.fill(HIST("tr_chi2nclM"), mothTrack.tpcChi2NCl()); - rpiKkink.fill(HIST("tr_chi2nclD"), dauTrack.tpcChi2NCl()); - rpiKkink.fill(HIST("tr_tpcnclfindM"), mothTrack.tpcNClsFindable()); - rpiKkink.fill(HIST("tr_tpcnclfindD"), dauTrack.tpcNClsFindable()); - rpiKkink.fill(HIST("tr_itsChi2NClM"), mothTrack.itsChi2NCl()); + if (mothTrack.tpcNClsFindable() > maxtpcncle || mothTrack.tpcNClsFindable() < mintpcncle) + continue; bool kaon = false; if (std::abs(mothTrack.tpcNSigmaKa()) < cutNSigmaKa) { @@ -699,13 +747,22 @@ struct spectraKinkPiKa { double radiusxy = std::sqrt(kinkCand.xDecVtx() * kinkCand.xDecVtx() + kinkCand.yDecVtx() * kinkCand.yDecVtx()); if (radiusxy < minradius || radiusxy > maxradius) continue; + if (qa) { + rpiKkink.fill(HIST("tr_dcaxyM"), kinkCand.dcaMothPv()); + rpiKkink.fill(HIST("tr_dcaxyD"), kinkCand.dcaDaugPv()); + rpiKkink.fill(HIST("tr_dcaxykink_topo"), kinkCand.dcaKinkTopo()); - rpiKkink.fill(HIST("tr_dcaxyM"), kinkCand.dcaMothPv()); - rpiKkink.fill(HIST("tr_dcaxyD"), kinkCand.dcaDaugPv()); - rpiKkink.fill(HIST("tr_dcaxykink_topo"), kinkCand.dcaKinkTopo()); + rpiKkink.fill(HIST("h2_kinkradius_vs_vz"), kinkCand.zDecVtx(), radiusxy); + rpiKkink.fill(HIST("h2_kink_vx_vs_vy"), kinkCand.xDecVtx(), kinkCand.yDecVtx()); - rpiKkink.fill(HIST("h2_kinkradius_vs_vz"), kinkCand.zDecVtx(), radiusxy); - rpiKkink.fill(HIST("h2_kink_vx_vs_vy"), kinkCand.xDecVtx(), kinkCand.yDecVtx()); + rpiKkink.fill(HIST("h2_kinkradius_vs_pt"), radiusxy, v0.Pt()); + rpiKkink.fill(HIST("h2_kinkradius_vs_ncl"), radiusxy, mothTrack.tpcNClsFindable()); + } + if (kinkCand.dcaMothPv() > dcaXYcut) + continue; + + if (kinkCand.dcaKinkTopo() > dcaXYcutkink) + continue; float pMoth = v0.P(); float pDaug = v1.P(); @@ -749,30 +806,33 @@ struct spectraKinkPiKa { if (std::abs(mcTrackMoth.pdgCode()) != pid || std::abs(mcTrackDau.pdgCode()) != dpid) { continue; } - rpiKkink.fill(HIST("h2_kinkradius_vs_vz_m"), kinkCand.zDecVtx(), radiusxy); - rpiKkink.fill(HIST("h2_kink_vx_vs_vy_m"), kinkCand.xDecVtx(), kinkCand.yDecVtx()); - rpiKkink.fill(HIST("h2_moth_pt_vs_eta_rec_m"), v0.Pt(), v0.Eta(), multiplicity); rpiKkink.fill(HIST("h2_dau_pt_vs_eta_rec_m"), v1.Pt(), v1.Eta(), multiplicity); rpiKkink.fill(HIST("h2_pt_moth_vs_dau_rec_m"), v0.Pt(), v1.Pt()); rpiKkink.fill(HIST("h2_kink_angle_m"), kinkangle, multiplicity); - rpiKkink.fill(HIST("h2_invmass_kaon_m"), mass, v0.Pt(), ptd); - rpiKkink.fill(HIST("h2_qt_rec"), ptd); - rpiKkink.fill(HIST("h2_kaon_mc_rec_m"), mass, v0.Pt(), v0.Eta(), ptd, multiplicity); - - rpiKkink.fill(HIST("tpc_dedx_m"), v0.P(), mothTrack.tpcSignal()); - rpiKkink.fill(HIST("tpc_nsigma_kaon_m"), v0.Pt(), mothTrack.tpcNSigmaKa()); - rpiKkink.fill(HIST("tpc_nsigma_pion_m"), v0.Pt(), mothTrack.tpcNSigmaPi()); - - rpiKkink.fill(HIST("tr_chi2nclM_m"), mothTrack.tpcChi2NCl()); - rpiKkink.fill(HIST("tr_chi2nclD_m"), dauTrack.tpcChi2NCl()); - rpiKkink.fill(HIST("tr_tpcnclfindM_m"), mothTrack.tpcNClsFindable()); - rpiKkink.fill(HIST("tr_tpcnclfindD_m"), dauTrack.tpcNClsFindable()); - rpiKkink.fill(HIST("tr_itsChi2NClM_m"), mothTrack.itsChi2NCl()); - - rpiKkink.fill(HIST("tr_dcaxyM_m"), kinkCand.dcaMothPv()); - rpiKkink.fill(HIST("tr_dcaxyD_m"), kinkCand.dcaDaugPv()); - rpiKkink.fill(HIST("tr_dcaxykink_topo_m"), kinkCand.dcaKinkTopo()); + rpiKkink.fill(HIST("h2_kaon_mc_rec_m"), mass, v0.Pt(), v0.Rapidity(), ptd, multiplicity); + + if (qa && ptd > minqt && ptd < maxqt) { + rpiKkink.fill(HIST("h2_kinkradius_vs_vz_m"), kinkCand.zDecVtx(), radiusxy); + rpiKkink.fill(HIST("h2_kink_vx_vs_vy_m"), kinkCand.xDecVtx(), kinkCand.yDecVtx()); + + rpiKkink.fill(HIST("tpc_dedx_m"), v0.P(), mothTrack.tpcSignal()); + rpiKkink.fill(HIST("tpc_nsigma_kaon_m"), v0.Pt(), mothTrack.tpcNSigmaKa()); + rpiKkink.fill(HIST("tpc_nsigma_pion_m"), v0.Pt(), mothTrack.tpcNSigmaPi()); + + rpiKkink.fill(HIST("tr_chi2nclM_m"), mothTrack.tpcChi2NCl()); + rpiKkink.fill(HIST("tr_chi2nclD_m"), dauTrack.tpcChi2NCl()); + rpiKkink.fill(HIST("tr_tpcnclfindM_m"), mothTrack.tpcNClsFindable()); + rpiKkink.fill(HIST("tr_tpcnclfindD_m"), dauTrack.tpcNClsFindable()); + rpiKkink.fill(HIST("tr_itsChi2NClM_m"), mothTrack.itsChi2NCl()); + + rpiKkink.fill(HIST("tr_dcaxyM_m"), kinkCand.dcaMothPv()); + rpiKkink.fill(HIST("tr_dcaxyD_m"), kinkCand.dcaDaugPv()); + rpiKkink.fill(HIST("tr_dcaxykink_topo_m"), kinkCand.dcaKinkTopo()); + + rpiKkink.fill(HIST("h2_kinkradius_vs_pt_m"), radiusxy, v0.Pt()); + rpiKkink.fill(HIST("h2_kinkradius_vs_ncl_m"), radiusxy, mothTrack.tpcNClsFindable()); + } } } } @@ -830,7 +890,7 @@ struct spectraKinkPiKa { double ptd = pdlab.Perp(motherDir); // or p_d_lab.Mag() * sin(theta) rpiKkink.fill(HIST("h2_qt_gen"), ptd); double mass = computeMotherMass(v0, v1); - rpiKkink.fill(HIST("h2_kaon_mc_gen"), mass, v0.Pt(), v0.Eta(), ptd); + rpiKkink.fill(HIST("h2_kaon_mc_gen"), mass, v0.Pt(), v0.Rapidity(), ptd); } } PROCESS_SWITCH(spectraKinkPiKa, processMC, "MC processing", false); From ef5d46b533550880fd09dc9f49398bc3d6e4c445 Mon Sep 17 00:00:00 2001 From: rolavick Date: Wed, 1 Oct 2025 08:51:36 +0200 Subject: [PATCH 590/986] [Infrastructure] Update CODEOWNERS (#13189) --- CODEOWNERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index 549ee7c12f0..7b886ac2857 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -61,7 +61,7 @@ /PWGMM/Lumi @alibuild @sustripathy @skundu692 @aalkin @jgcn @gbencedi @abmodak /PWGMM/UE @alibuild @sustripathy @skundu692 @aalkin @aortizve @jgcn -/PWGUD @alibuild @pbuehler @nystrand @rolavick +/PWGUD @alibuild @amatyja @rolavick /PWGJE @alibuild @lhavener @maoyx @nzardosh @fjonasALICE @mfasDa @mhemmer-cern /Tools/PIDML @alibuild @saganatt /Tools/ML @alibuild @fcatalan92 @fmazzasc @@ -72,4 +72,4 @@ /Tutorials/PWGJE @alibuild @lhavener @maoyx @nzardosh @mfasDa @fjonasALICE /Tutorials/PWGLF @alibuild @alcaliva @lbariogl @chiarapinto @BongHwi @lbarnby @ercolessi @iravasen @njacazio @romainschotter @skundu692 /Tutorials/PWGMM @alibuild @aalkin @ddobrigk -/Tutorials/PWGUD @alibuild @pbuehler +/Tutorials/PWGUD @alibuild @pbuehler @amatyja From d086b4a8ee27f8baf12e3d79f6bd896a2973bb3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Wed, 1 Oct 2025 09:48:51 +0200 Subject: [PATCH 591/986] [ALICE3] Create a3geo.ini with ALICE3 geometry settings (#13187) --- ALICE3/macros/a3geo.ini | 148 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 ALICE3/macros/a3geo.ini diff --git a/ALICE3/macros/a3geo.ini b/ALICE3/macros/a3geo.ini new file mode 100644 index 00000000000..b9bae64b575 --- /dev/null +++ b/ALICE3/macros/a3geo.ini @@ -0,0 +1,148 @@ +# Example of the ALICE3 geometry file in TEnv format +bpipe0.r: 0.48 +bpipe0.z: 250 +bpipe0.x0: 0.001592 +bpipe0.xrho: 0 +bpipe0.resRPhi: 0.0 +bpipe0.resZ: 0.0 +bpipe0.eff: 0.0 +bpipe0.type: 0 +bpipe0.deadPhiRegions: /tmp/asd.root + +B00.r: 0.5 +B00.z: 250 +B00.x0: 0.00076 +B00.xrho: 0 +B00.resRPhi: 0.00025 +B00.resZ: 0.00025 +B00.eff: 1. +B00.type: 1 + +B01.r: 1.2 +B01.z: 250 +B01.x0: 0.00096 +B01.xrho: 0 +B01.resRPhi: 0.00025 +B01.resZ: 0.00025 +B01.eff: 1. +B01.type: 1 + +B02.r: 2.5 +B02.z: 250 +B02.x0: 0.00096 +B02.xrho: 0 +B02.resRPhi: 0.00025 +B02.resZ: 0.00025 +B02.eff: 1. +B02.type: 1 + +coldplate.r: 2.6 +coldplate.z: 250 +coldplate.x0: 0.02 +coldplate.xrho: 0 +coldplate.resRPhi: 0 +coldplate.resZ: 0 +coldplate.eff: 0 +coldplate.type: 0 + +petal.r: 3.7 +petal.z: 250 +petal.x0: 0.001592 +petal.xrho: 0 +petal.resRPhi: 0 +petal.resZ: 0 +petal.eff: 0 +petal.type: 0 + +bpipe1.r: 5.7 +bpipe1.z: 250 +bpipe1.x0: 0.0023 +bpipe1.xrho: 0 +bpipe1.resRPhi: 0.0 +bpipe1.resZ: 0.0 +bpipe1.eff: 0.0 +bpipe1.type: 0 + +B03.r: 7. +B03.z: 250 +B03.x0: 0.01 +B03.xrho: 0 +B03.resRPhi: 0.001 +B03.resZ: 0.001 +B03.eff: 1. +B03.type: 1 + +B04.r: 9. +B04.z: 250 +B04.x0: 0.01 +B04.xrho: 0 +B04.resRPhi: 0.001 +B04.resZ: 0.001 +B04.eff: 1. +B04.type: 1 + +B05.r: 12. +B05.z: 250 +B05.x0: 0.01 +B05.xrho: 0 +B05.resRPhi: 0.001 +B05.resZ: 0.001 +B05.eff: 1. +B05.type: 1 + +iTOF.r: 19. +iTOF.z: 250 +iTOF.x0: 0.03 +iTOF.xrho: 0 +iTOF.resRPhi: 0.001 +iTOF.resZ: 0.001 +iTOF.eff: 1. +iTOF.type: 0 + +B06.r: 20. +B06.z: 250 +B06.x0: 0.01 +B06.xrho: 0 +B06.resRPhi: 0.001 +B06.resZ: 0.001 +B06.eff: 1. +B06.type: 1 + +B07.r: 30. +B07.z: 250 +B07.x0: 0.01 +B07.xrho: 0 +B07.resRPhi: 0.001 +B07.resZ: 0.001 +B07.eff: 1. +B07.type: 1 + +B08.r: 45. +B08.z: 250 +B08.x0: 0.01 +B08.xrho: 0 +B08.resRPhi: 0.001 +B08.resZ: 0.001 +B08.eff: 1. +B08.type: 1 + +B09.r: 60. +B09.z: 250 +B09.x0: 0.01 +B09.xrho: 0 +B09.resRPhi: 0.001 +B09.resZ: 0.001 +B09.eff: 1. +B09.type: 1 + +B10.r: 80. +B10.z: 250 +B10.x0: 0.01 +B10.xrho: 0 +B10.resRPhi: 0.001 +B10.resZ: 0.001 +B10.eff: 1. +B10.type: 1 + + + From f2d8005044e997a48c4eeb48f77a27ac985fab32 Mon Sep 17 00:00:00 2001 From: ikantak <149821212+ikantak@users.noreply.github.com> Date: Wed, 1 Oct 2025 10:35:42 +0200 Subject: [PATCH 592/986] [PWGEM] Add Photonsphiv table (#13127) Co-authored-by: Isabel Kantak --- PWGEM/PhotonMeson/DataModel/gammaTables.h | 10 ++++++++++ .../TableProducer/photonconversionbuilder.cxx | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/PWGEM/PhotonMeson/DataModel/gammaTables.h b/PWGEM/PhotonMeson/DataModel/gammaTables.h index a6b7017f550..5f3392e1704 100644 --- a/PWGEM/PhotonMeson/DataModel/gammaTables.h +++ b/PWGEM/PhotonMeson/DataModel/gammaTables.h @@ -411,6 +411,16 @@ using EMPrimaryElectronsFromDalitz = EMPrimaryElectronsFromDalitz_001; // iterators using EMPrimaryElectronFromDalitz = EMPrimaryElectronsFromDalitz::iterator; +namespace v0photonsphiv +{ +DECLARE_SOA_INDEX_COLUMN(EMEvent, emevent); //! +DECLARE_SOA_COLUMN(PhiV, phiv, float); //! +} // namespace v0photonsphiv +DECLARE_SOA_TABLE(V0PhotonsPhiV, "AOD", "V0PHOTONPHIV", //! + o2::soa::Index<>, v0photonsphiv::PhiV); +// iterators +using V0PhotonsPhiV = V0PhotonsPhiV; + namespace dalitzee { DECLARE_SOA_INDEX_COLUMN(EMEvent, emevent); //! diff --git a/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx b/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx index a1d1eb3ee5e..770cd6ad1c3 100644 --- a/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx +++ b/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx @@ -15,6 +15,7 @@ // // \author Daiki Sekihata , Tokyo +#include "PWGEM/Dilepton/Utils/PairUtilities.h" #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" #include "PWGEM/PhotonMeson/Utils/PCMUtilities.h" #include "PWGEM/PhotonMeson/Utils/TrackSelection.h" @@ -73,6 +74,7 @@ struct PhotonConversionBuilder { Produces v0legs; Produces v0legsXYZ; Produces v0legsDeDxMC; + Produces v0photonsphiv; // Produces v0photonskfcov; // Produces events_ngpcm; @@ -166,6 +168,7 @@ struct PhotonConversionBuilder { {"V0/hRxy_minX_ITSTPC_TPC", "min trackiu X vs. R_{xy};trackiu X (cm);min trackiu X - R_{xy} (cm)", {HistType::kTH2F, {{100, 0.0f, 100.f}, {100, -50.0, 50.0f}}}}, {"V0/hRxy_minX_TPC_TPC", "min trackiu X vs. R_{xy};trackiu X (cm);min trackiu X - R_{xy} (cm)", {HistType::kTH2F, {{100, 0.0f, 100.f}, {100, -50.0, 50.0f}}}}, {"V0/hPCA_diffX", "PCA vs. trackiu X - R_{xy};distance btween 2 legs (cm);min trackiu X - R_{xy} (cm)", {HistType::kTH2F, {{500, 0.0f, 5.f}, {100, -50.0, 50.0f}}}}, + {"V0/hPhiV", "#phi_{V}; #phi_{V} (rad.)", {HistType::kTH1F, {{500, 0.0f, 2 * M_PI}}}}, {"V0Leg/hPt", "pT of leg at SV;p_{T,e} (GeV/c)", {HistType::kTH1F, {{1000, 0.0f, 10.0f}}}}, {"V0Leg/hEtaPhi", "#eta vs. #varphi of leg at SV;#varphi (rad.);#eta", {HistType::kTH2F, {{72, 0.0f, 2 * M_PI}, {200, -1, +1}}}}, {"V0Leg/hRelDeltaPt", "pT resolution;p_{T} (GeV/c);#Deltap_{T}/p_{T}", {HistType::kTH2F, {{1000, 0.f, 10.f}, {100, 0, 1}}}}, @@ -631,6 +634,8 @@ struct PhotonConversionBuilder { pca_map[std::make_tuple(v0.globalIndex(), collision.globalIndex(), pos.globalIndex(), ele.globalIndex())] = pca_kf; cospa_map[std::make_tuple(v0.globalIndex(), collision.globalIndex(), pos.globalIndex(), ele.globalIndex())] = cospa_kf; + float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pos.px(), pos.py(), pos.pz(), ele.px(), ele.py(), ele.pz(), pos.sign(), ele.sign(), d_bz); + if (filltable) { registry.fill(HIST("V0/hAP"), alpha, qt); registry.fill(HIST("V0/hConversionPointXY"), gammaKF_DecayVtx.GetX(), gammaKF_DecayVtx.GetY()); @@ -644,6 +649,7 @@ struct PhotonConversionBuilder { registry.fill(HIST("V0/hPCA_Rxy"), rxy, pca_kf); registry.fill(HIST("V0/hDCAxyz"), dca_xy_v0_to_pv, dca_z_v0_to_pv); registry.fill(HIST("V0/hPCA_diffX"), pca_kf, std::min(pTrack.getX(), nTrack.getX()) - rxy); // trackiu.x() - rxy should be positive + registry.fill(HIST("V0/hPhiV"), phiv); float cospaXY_kf = cospaXY_KF(gammaKF_DecayVtx, KFPV); float cospaRZ_kf = cospaRZ_KF(gammaKF_DecayVtx, KFPV); @@ -680,6 +686,7 @@ struct PhotonConversionBuilder { v0_sv.M(), dca_xy_v0_to_pv, dca_z_v0_to_pv, cospa_kf, cospaXY_kf, cospaRZ_kf, pca_kf, alpha, qt, chi2kf); + v0photonsphiv(phiv); // v0photonskfcov(gammaKF_PV.GetCovariance(9), gammaKF_PV.GetCovariance(14), gammaKF_PV.GetCovariance(20), gammaKF_PV.GetCovariance(13), gammaKF_PV.GetCovariance(19), gammaKF_PV.GetCovariance(18)); From ce98f6a84ecd923263f694357e1e503295e44fad Mon Sep 17 00:00:00 2001 From: shreyasiacharya <34233706+shreyasiacharya@users.noreply.github.com> Date: Wed, 1 Oct 2025 13:11:41 +0200 Subject: [PATCH 593/986] [PWGDQ] updating table for p-np JPsi separation (#13191) --- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 22 ++++++++++++++++++++-- PWGDQ/Tasks/tableReader_withAssoc.cxx | 5 +++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index 6668f0bebac..eed0429955e 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -140,15 +140,29 @@ DECLARE_SOA_COLUMN(McFlag, mcFlag, int8_t); DECLARE_SOA_BITMAP_COLUMN(IsJpsiFromBSelected, isJpsiFromBSelected, 32); // Candidate columns for prompt-non-prompt JPsi separation DECLARE_SOA_COLUMN(Massee, massee, float); +DECLARE_SOA_COLUMN(Etaee, etaee, float); +DECLARE_SOA_COLUMN(Rapee, rapee, float); +DECLARE_SOA_COLUMN(Phiee, phiee, float); DECLARE_SOA_COLUMN(Ptee, ptee, float); DECLARE_SOA_COLUMN(Lxyee, lxyee, float); DECLARE_SOA_COLUMN(LxyeePoleMass, lxyeepolemass, float); DECLARE_SOA_COLUMN(Lzee, lzee, float); +DECLARE_SOA_COLUMN(MultiplicityFT0A, multiplicityFT0AJPsi2ee, float); +DECLARE_SOA_COLUMN(MultiplicityFT0C, multiplicityFT0CJPsi2ee, float); +DECLARE_SOA_COLUMN(PercentileFT0M, percentileFT0MJPsi2ee, float); +DECLARE_SOA_COLUMN(MultiplicityNContrib, multiplicityNContribJPsi2ee, float); DECLARE_SOA_COLUMN(AmbiguousInBunchPairs, AmbiguousJpsiPairsInBunch, bool); DECLARE_SOA_COLUMN(AmbiguousOutOfBunchPairs, AmbiguousJpsiPairsOutOfBunch, bool); DECLARE_SOA_COLUMN(Corrassoc, corrassoc, bool); DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); +// Candidate columns efficiency calculation for prompt-non-prompt JPsi separation +DECLARE_SOA_COLUMN(OniaPt, oniaPt, float); +DECLARE_SOA_COLUMN(OniaY, oniaY, float); +DECLARE_SOA_COLUMN(OniaEta, oniaEta, float); +DECLARE_SOA_COLUMN(OniaPhi, oniaPhi, float); +DECLARE_SOA_COLUMN(OniaVz, oniaVz, float); +DECLARE_SOA_COLUMN(OniaVtxZ, oniaVtxZ, float); } // namespace dqanalysisflags DECLARE_SOA_TABLE(EventCuts, "AOD", "DQANAEVCUTS", dqanalysisflags::IsEventSelected); //! joinable to ReducedEvents @@ -179,7 +193,8 @@ DECLARE_SOA_TABLE(JPsiMuonCandidates, "AOD", "DQJPSIMUONA", dqanalysisflags::MassDileptonCandidate, dqanalysisflags::Ptpair, dqanalysisflags::Etapair, dqanalysisflags::Ptassoc, dqanalysisflags::Etaassoc, dqanalysisflags::Phiassoc, dqanalysisflags::Ptleg1, dqanalysisflags::Etaleg1, dqanalysisflags::Phileg1, dqanalysisflags::Ptleg2, dqanalysisflags::Etaleg2, dqanalysisflags::Phileg2, dqanalysisflags::McFlag); -DECLARE_SOA_TABLE(JPsieeCandidates, "AOD", "DQPSEUDOPROPER", dqanalysisflags::Massee, dqanalysisflags::Ptee, dqanalysisflags::Lxyee, dqanalysisflags::LxyeePoleMass, dqanalysisflags::Lzee, dqanalysisflags::AmbiguousInBunchPairs, dqanalysisflags::AmbiguousOutOfBunchPairs, dqanalysisflags::Corrassoc); +DECLARE_SOA_TABLE(JPsieeCandidates, "AOD", "DQPSEUDOPROPER", dqanalysisflags::Massee, dqanalysisflags::Ptee, dqanalysisflags::Etaee, dqanalysisflags::Rapee, dqanalysisflags::Phiee, dqanalysisflags::Lxyee, dqanalysisflags::LxyeePoleMass, dqanalysisflags::Lzee, dqanalysisflags::AmbiguousInBunchPairs, dqanalysisflags::AmbiguousOutOfBunchPairs, dqanalysisflags::Corrassoc, dqanalysisflags::MultiplicityFT0A, dqanalysisflags::MultiplicityFT0C, dqanalysisflags::PercentileFT0M, dqanalysisflags::MultiplicityNContrib); +DECLARE_SOA_TABLE(OniaMCTruth, "AOD", "MCTRUTHONIA", dqanalysisflags::OniaPt, dqanalysisflags::OniaEta, dqanalysisflags::OniaY, dqanalysisflags::OniaPhi, dqanalysisflags::OniaVz, dqanalysisflags::OniaVtxZ, dqanalysisflags::MultiplicityFT0A, dqanalysisflags::MultiplicityFT0C, dqanalysisflags::PercentileFT0M, dqanalysisflags::MultiplicityNContrib); } // namespace o2::aod // Declarations of various short names @@ -1280,6 +1295,7 @@ struct AnalysisSameEventPairing { Produces dileptonMiniTreeRec; Produces dileptonInfoList; Produces PromptNonPromptSepTable; + Produces MCTruthTableEffi; o2::base::MatLayerCylSet* fLUT = nullptr; int fCurrentRun; // needed to detect if the run changed and trigger update of calibrations etc. @@ -1956,7 +1972,7 @@ struct AnalysisSameEventPairing { fHistMan->FillHistClass(histNames[icut][0].Data(), VarManager::fgValues); // reconstructed, unmatched for (unsigned int isig = 0; isig < fRecMCSignals.size(); isig++) { // loop over MC signals if (mcDecision & (static_cast(1) << isig)) { - PromptNonPromptSepTable(VarManager::fgValues[VarManager::kMass], VarManager::fgValues[VarManager::kPt], VarManager::fgValues[VarManager::kVertexingTauxyProjected], VarManager::fgValues[VarManager::kVertexingTauxyProjectedPoleJPsiMass], VarManager::fgValues[VarManager::kVertexingTauzProjected], isAmbiInBunch, isAmbiOutOfBunch, isCorrect_pair); + PromptNonPromptSepTable(VarManager::fgValues[VarManager::kMass], VarManager::fgValues[VarManager::kPt], VarManager::fgValues[VarManager::kEta], VarManager::fgValues[VarManager::kRap], VarManager::fgValues[VarManager::kPhi], VarManager::fgValues[VarManager::kVertexingTauxyProjected], VarManager::fgValues[VarManager::kVertexingTauxyProjectedPoleJPsiMass], VarManager::fgValues[VarManager::kVertexingTauzProjected], isAmbiInBunch, isAmbiOutOfBunch, isCorrect_pair, VarManager::fgValues[VarManager::kMultFT0A], VarManager::fgValues[VarManager::kMultFT0C], VarManager::fgValues[VarManager::kCentFT0M], VarManager::fgValues[VarManager::kVtxNcontribReal]); fHistMan->FillHistClass(histNamesMC[icut * fRecMCSignals.size() + isig][0].Data(), VarManager::fgValues); // matched signal if (useMiniTree.fConfigMiniTree) { if constexpr (TPairType == VarManager::kDecayToMuMu) { @@ -2238,6 +2254,8 @@ struct AnalysisSameEventPairing { if (sig->CheckSignal(true, track_raw)) { mcDecision |= (static_cast(1) << isig); fHistMan->FillHistClass(Form("MCTruthGenSel_%s", sig->GetName()), VarManager::fgValues); + MCTruthTableEffi(VarManager::fgValues[VarManager::kMCPt], VarManager::fgValues[VarManager::kMCEta], VarManager::fgValues[VarManager::kMCY], VarManager::fgValues[VarManager::kMCPhi], VarManager::fgValues[VarManager::kMCVz], VarManager::fgValues[VarManager::kMCVtxZ], VarManager::fgValues[VarManager::kMultFT0A], VarManager::fgValues[VarManager::kMultFT0C], VarManager::fgValues[VarManager::kCentFT0M], VarManager::fgValues[VarManager::kVtxNcontribReal]); + if (useMiniTree.fConfigMiniTree) { auto mcEvent = mcEvents.rawIteratorAt(track_raw.reducedMCeventId()); dileptonMiniTreeGen(mcDecision, mcEvent.impactParameter(), track_raw.pt(), track_raw.eta(), track_raw.phi(), -999, -999, -999); diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index ab3e9320b65..e3cf391ff44 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -157,6 +157,7 @@ DECLARE_SOA_COLUMN(AmbiguousInBunchPairs, AmbiguousJpsiPairsInBunch, bool); DECLARE_SOA_COLUMN(AmbiguousOutOfBunchPairs, AmbiguousJpsiPairsOutOfBunch, bool); DECLARE_SOA_COLUMN(MultiplicityFT0A, multiplicityFT0AJPsi2ee, float); DECLARE_SOA_COLUMN(MultiplicityFT0C, multiplicityFT0CJPsi2ee, float); +DECLARE_SOA_COLUMN(PercentileFT0M, percentileFT0MJPsi2ee, float); DECLARE_SOA_COLUMN(MultiplicityNContrib, multiplicityNContribJPsi2ee, float); // Candidate columns for JPsi/muon correlations DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); @@ -191,7 +192,7 @@ DECLARE_SOA_TABLE(JPsiMuonCandidates, "AOD", "DQJPSIMUONA", dqanalysisflags::DeltaEta, dqanalysisflags::DeltaPhi, dqanalysisflags::MassDileptonCandidate, dqanalysisflags::Ptpair, dqanalysisflags::Etapair, dqanalysisflags::Ptassoc, dqanalysisflags::Etaassoc, dqanalysisflags::Phiassoc, dqanalysisflags::Ptleg1, dqanalysisflags::Etaleg1, dqanalysisflags::Phileg1, dqanalysisflags::Ptleg2, dqanalysisflags::Etaleg2, dqanalysisflags::Phileg2); -DECLARE_SOA_TABLE(JPsieeCandidates, "AOD", "DQPSEUDOPROPER", dqanalysisflags::Massee, dqanalysisflags::Ptee, dqanalysisflags::Lxyee, dqanalysisflags::LxyeePoleMass, dqanalysisflags::Lzee, dqanalysisflags::AmbiguousInBunchPairs, dqanalysisflags::AmbiguousOutOfBunchPairs, dqanalysisflags::MultiplicityFT0A, dqanalysisflags::MultiplicityFT0C, dqanalysisflags::MultiplicityNContrib); +DECLARE_SOA_TABLE(JPsieeCandidates, "AOD", "DQPSEUDOPROPER", dqanalysisflags::Massee, dqanalysisflags::Ptee, dqanalysisflags::Lxyee, dqanalysisflags::LxyeePoleMass, dqanalysisflags::Lzee, dqanalysisflags::AmbiguousInBunchPairs, dqanalysisflags::AmbiguousOutOfBunchPairs, dqanalysisflags::MultiplicityFT0A, dqanalysisflags::MultiplicityFT0C, dqanalysisflags::PercentileFT0M, dqanalysisflags::MultiplicityNContrib); } // namespace o2::aod // Declarations of various short names @@ -1987,7 +1988,7 @@ struct AnalysisSameEventPairing { } } if (sign1 * sign2 < 0) { - PromptNonPromptSepTable(VarManager::fgValues[VarManager::kMass], VarManager::fgValues[VarManager::kPt], VarManager::fgValues[VarManager::kVertexingTauxyProjected], VarManager::fgValues[VarManager::kVertexingTauxyProjectedPoleJPsiMass], VarManager::fgValues[VarManager::kVertexingTauzProjected], isAmbiInBunch, isAmbiOutOfBunch, VarManager::fgValues[VarManager::kMultFT0A], VarManager::fgValues[VarManager::kMultFT0C], VarManager::fgValues[VarManager::kVtxNcontrib]); + PromptNonPromptSepTable(VarManager::fgValues[VarManager::kMass], VarManager::fgValues[VarManager::kPt], VarManager::fgValues[VarManager::kVertexingTauxyProjected], VarManager::fgValues[VarManager::kVertexingTauxyProjectedPoleJPsiMass], VarManager::fgValues[VarManager::kVertexingTauzProjected], isAmbiInBunch, isAmbiOutOfBunch, VarManager::fgValues[VarManager::kMultFT0A], VarManager::fgValues[VarManager::kMultFT0C], VarManager::fgValues[VarManager::kCentFT0M], VarManager::fgValues[VarManager::kVtxNcontribReal]); if constexpr (TPairType == VarManager::kDecayToMuMu) { fHistMan->FillHistClass(histNames[icut][0].Data(), VarManager::fgValues); if (isAmbiInBunch) { From 70bb71cb177368fb3d2ab29c0962af93735559aa Mon Sep 17 00:00:00 2001 From: shahor02 Date: Wed, 1 Oct 2025 14:19:03 +0200 Subject: [PATCH 594/986] [ALICE3,PWGEM] Use correct include for the HelixHelper.h (#13170) --- ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx | 2 +- ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx | 2 +- ALICE3/TableProducer/OTF/onTheFlyTrackerPid.cxx | 2 +- PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx | 2 +- PWGEM/PhotonMeson/Utils/PCMUtilities.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx b/ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx index 9ccc09b3a5d..454a5ae61f6 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx @@ -48,7 +48,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx b/ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx index b28d48d92ff..77a6edafb20 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/ALICE3/TableProducer/OTF/onTheFlyTrackerPid.cxx b/ALICE3/TableProducer/OTF/onTheFlyTrackerPid.cxx index 6ab9df2443e..c711af7eae0 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyTrackerPid.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyTrackerPid.cxx @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx index fa843d22f54..0ebf6f374c8 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx @@ -44,7 +44,7 @@ #include "CCDB/BasicCCDBManager.h" #include "CommonConstants/PhysicsConstants.h" -#include "DCAFitter/HelixHelper.h" +#include "ReconstructionDataFormats/HelixHelper.h" #include "DataFormatsParameters/GRPMagField.h" #include "DataFormatsParameters/GRPObject.h" #include "DetectorsBase/GeometryManager.h" diff --git a/PWGEM/PhotonMeson/Utils/PCMUtilities.h b/PWGEM/PhotonMeson/Utils/PCMUtilities.h index e82d580cfcd..095179a24ad 100644 --- a/PWGEM/PhotonMeson/Utils/PCMUtilities.h +++ b/PWGEM/PhotonMeson/Utils/PCMUtilities.h @@ -16,7 +16,7 @@ #define PWGEM_PHOTONMESON_UTILS_PCMUTILITIES_H_ #include -#include "DCAFitter/HelixHelper.h" +#include "ReconstructionDataFormats/HelixHelper.h" #include "DetectorsBase/Propagator.h" #include "Common/Core/trackUtilities.h" #include "Common/Core/RecoDecay.h" From fa32f0114a1a60f9acbb64bbd4b21cde7a8c8bd4 Mon Sep 17 00:00:00 2001 From: Gyula Bencedi Date: Wed, 1 Oct 2025 14:30:18 +0200 Subject: [PATCH 595/986] [PWGLF] Fix histo placement (#13192) --- PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx b/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx index 29334ce4009..fc86c9cd86d 100644 --- a/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx @@ -564,6 +564,7 @@ struct FlattenictyPikp { flatchrg.add("Tracks/postSel/pPtNclPIDTPC", "; #it{p}_{T} (GeV/#it{c}); N_{PID cluster}", {kTProfile, {ptAxis}}); flatchrg.add("Tracks/postSel/hShTpcClvsPt", "", {kTH2F, {ptAxis, shCluserAxis}}); flatchrg.add("Tracks/postSel/hNclTPCFoundvsPt", "", {kTH2F, {ptAxis, clTpcAxis}}); + flatchrg.add("Tracks/postSel/hNClTPCPidvsPt", "", {kTH2F, {ptAxis, clTpcAxis}}); flatchrg.add("Tracks/postSel/hTPCCluster", "N_{cluster}", kTH1F, {clTpcAxis}); flatchrg.add("Tracks/postSel/hTPCnClsShared", " ; # shared TPC clusters TPC", kTH1F, {{165, -0.5, 164.5}}); flatchrg.add("Tracks/postSel/hTPCcrossedRows", " ; # crossed TPC rows", kTH1F, {{165, -0.5, 164.5}}); @@ -1156,9 +1157,9 @@ struct FlattenictyPikp { flatchrg.fill(HIST("Tracks/preSel/hPtPhiNclPIDTPC"), track.pt(), phimodn, track.tpcNClsPID()); } else { flatchrg.fill(HIST("Tracks/preSel/hPtPhiNclTPC"), track.pt(), phimodn, track.tpcNClsFound()); + flatchrg.fill(HIST("Tracks/preSel/hPtPhiNclPIDTPC"), track.pt(), phimodn, track.tpcNClsPID()); flatchrg.fill(HIST("Tracks/preSel/hPtNclTPC"), track.pt(), track.tpcNClsFound()); flatchrg.fill(HIST("Tracks/preSel/pPtNclTPC"), track.pt(), track.tpcNClsFound()); - flatchrg.fill(HIST("Tracks/preSel/hPtPhiNclPIDTPC"), track.pt(), phimodn, track.tpcNClsPID()); flatchrg.fill(HIST("Tracks/preSel/hPtNclPIDTPC"), track.pt(), track.tpcNClsPID()); flatchrg.fill(HIST("Tracks/preSel/pPtNclPIDTPC"), track.pt(), track.tpcNClsPID()); } @@ -1175,9 +1176,9 @@ struct FlattenictyPikp { flatchrg.fill(HIST("Tracks/postSel/hPtPhiNclPIDTPC"), track.pt(), phimodn, track.tpcNClsPID()); } else { flatchrg.fill(HIST("Tracks/postSel/hPtPhiNclTPC"), track.pt(), phimodn, track.tpcNClsFound()); + flatchrg.fill(HIST("Tracks/postSel/hPtPhiNclPIDTPC"), track.pt(), phimodn, track.tpcNClsPID()); flatchrg.fill(HIST("Tracks/postSel/hPtNclTPC"), track.pt(), track.tpcNClsFound()); flatchrg.fill(HIST("Tracks/postSel/pPtNclTPC"), track.pt(), track.tpcNClsFound()); - flatchrg.fill(HIST("Tracks/postSel/hPtPhiNclPIDTPC"), track.pt(), phimodn, track.tpcNClsPID()); flatchrg.fill(HIST("Tracks/postSel/hPtNclPIDTPC"), track.pt(), track.tpcNClsPID()); flatchrg.fill(HIST("Tracks/postSel/pPtNclPIDTPC"), track.pt(), track.tpcNClsPID()); } From 060a20e6a66c6c1a6ef052a73e4990b5adf3f99d Mon Sep 17 00:00:00 2001 From: Luca Aglietta <75362880+Luca610@users.noreply.github.com> Date: Wed, 1 Oct 2025 14:36:44 +0200 Subject: [PATCH 596/986] [PWGHF] Fixed generated invariant mass calculation (#13185) --- .../candidateCreatorCharmResoReduced.cxx | 3 ++- .../dataCreatorCharmResoReduced.cxx | 25 +++++++++++++------ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx index 052626a6ef3..baef99914fb 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx @@ -389,10 +389,11 @@ struct HfCandidateCreatorCharmResoReduced { if (TESTBIT(candV0Tr.v0Type(), V0Type::Lambda)) { invMassV0Tr = candV0Tr.invMassLambda(); signReso = candD.sign(); + isWrongSign = candD.sign() < 0 ? 1 : 0; } else if (TESTBIT(candV0Tr.v0Type(), V0Type::AntiLambda)) { invMassV0Tr = candV0Tr.invMassAntiLambda(); signReso = candD.sign(); - isWrongSign = 1; + isWrongSign = candD.sign() > 0 ? 1 : 0; } if (useDeltaMass) { invMassReso = RecoDecay::m(std::array{pVectorCharmProngs[0], pVectorCharmProngs[1], pVectorCharmProngs[2], pVecV0Tr}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassLambda}) - invMassD; diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx index c2d7d6f3047..b5bedc4e8ee 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx @@ -620,6 +620,17 @@ struct HfDataCreatorCharmResoReduced { return flagV0; // Placeholder, should return the actual flag based on matching logic } + template + float computeInvMassGen(PParticles const& particlesMc, int indexRec) + { + auto particleReso = particlesMc.iteratorAt(indexRec); + auto dau1 = particlesMc.iteratorAt(particleReso.daughtersIds().front()); + auto dau2 = particlesMc.iteratorAt(particleReso.daughtersIds().back()); + std::array, 2> pArr = {{{dau1.px(), dau1.py(), dau1.pz()}, {dau2.px(), dau2.py(), dau2.pz()}}}; + std::array mArr = {static_cast(pdg->Mass(dau1.pdgCode())), static_cast(pdg->Mass(dau2.pdgCode()))}; + return static_cast(RecoDecay::m(pArr, mArr)); + } + /// Function for filling MC reco information of DV0 candidates in the tables /// \tparam dType is the D meson type (Dstar, Dplus or D0) /// \param particlesMc is the table with MC particles @@ -690,7 +701,7 @@ struct HfDataCreatorCharmResoReduced { if (indexRec > -1) { auto particleReso = particlesMc.iteratorAt(indexRec); ptGen = particleReso.pt(); - invMassGen = RecoDecay::m(particleReso.p(), particleReso.e()); + invMassGen = computeInvMassGen(particlesMc, indexRec); } rowHfDstarV0McRecReduced(indexHfCandCharm, indexCandV0Bach, flagReso, flagCharmBach, @@ -743,7 +754,7 @@ struct HfDataCreatorCharmResoReduced { if (indexRec > -1) { auto particleReso = particlesMc.iteratorAt(indexRec); ptGen = particleReso.pt(); - invMassGen = RecoDecay::m(particleReso.p(), particleReso.e()); + invMassGen = computeInvMassGen(particlesMc, indexRec); } rowHf3PrV0McRecReduced(indexHfCandCharm, indexCandV0Bach, flagReso, flagCharmBach, @@ -784,7 +795,7 @@ struct HfDataCreatorCharmResoReduced { if (indexRec > -1) { auto particleReso = particlesMc.iteratorAt(indexRec); ptGen = particleReso.pt(); - invMassGen = RecoDecay::m(particleReso.p(), particleReso.e()); + invMassGen = computeInvMassGen(particlesMc, indexRec); } rowHf2PrV0McRecReduced(indexHfCandCharm, indexCandV0Bach, flagReso, flagCharmBach, @@ -874,7 +885,7 @@ struct HfDataCreatorCharmResoReduced { if (indexRec > -1) { auto particleReso = particlesMc.iteratorAt(indexRec); ptGen = particleReso.pt(); - invMassGen = RecoDecay::m(particleReso.p(), particleReso.e()); + invMassGen = computeInvMassGen(particlesMc, indexRec); } rowHfDstarTrkMcRecReduced(indexHfCandCharm, indexCandTrBach, flagReso, flagCharmBach, @@ -914,7 +925,7 @@ struct HfDataCreatorCharmResoReduced { if (indexRec > -1) { auto particleReso = particlesMc.iteratorAt(indexRec); ptGen = particleReso.pt(); - invMassGen = RecoDecay::m(particleReso.p(), particleReso.e()); + invMassGen = computeInvMassGen(particlesMc, indexRec); } rowHf3PrTrkMcRecReduced(indexHfCandCharm, indexCandTrBach, flagReso, flagCharmBach, @@ -961,7 +972,7 @@ struct HfDataCreatorCharmResoReduced { if (indexRec > -1) { auto particleReso = particlesMc.iteratorAt(indexRec); ptGen = particleReso.pt(); - invMassGen = RecoDecay::m(particleReso.p(), particleReso.e()); + invMassGen = computeInvMassGen(particlesMc, indexRec); } rowHf2PrTrkMcRecReduced(indexHfCandCharm, indexCandTrBach, flagReso, flagCharmBach, @@ -1679,7 +1690,7 @@ struct HfDataCreatorCharmResoReduced { origin = RecoDecay::getCharmHadronOrigin(mcParticlesPerMcColl, particle, false, &idxBhadMothers); registry.fill(HIST("hMCGenOrigin"), origin); auto ptParticle = particle.pt(); - auto invMassGen = RecoDecay::m(particle.p(), particle.e()); + auto invMassGen = computeInvMassGen(mcParticles, particle.globalIndex()); auto yParticle = RecoDecay::y(particle.pVector(), invMassGen); auto etaParticle = particle.eta(); From f4f60d5eac4aebba5cf43a2617584d61c6dcbfda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= <26327373+vkucera@users.noreply.github.com> Date: Wed, 1 Oct 2025 15:00:21 +0200 Subject: [PATCH 597/986] [PWGJE] JetMatchingUtilities: Simplify passing expressions as template arguments (#13147) --- PWGJE/Core/JetMatchingUtilities.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/PWGJE/Core/JetMatchingUtilities.h b/PWGJE/Core/JetMatchingUtilities.h index cf22cad5ff9..16f27fa4f0f 100644 --- a/PWGJE/Core/JetMatchingUtilities.h +++ b/PWGJE/Core/JetMatchingUtilities.h @@ -123,13 +123,13 @@ std::tuple, std::vector> MatchJetsGeometricallyImpl( const std::vector& jetsBaseEta, std::vector jetsBasePhiForMatching, std::vector jetsBaseEtaForMatching, - const std::vector jetMapBaseToJetIndex, + const std::vector& jetMapBaseToJetIndex, const std::vector& jetsTagPhi, const std::vector& jetsTagEta, std::vector jetsTagPhiForMatching, std::vector jetsTagEtaForMatching, - const std::vector jetMapTagToJetIndex, - double maxMatchingDistance) + const std::vector& jetMapTagToJetIndex, + const double maxMatchingDistance) { // Validation // If no jets in either collection, then return immediately. @@ -544,8 +544,10 @@ void MatchPt(T const& jetsBasePerCollision, U const& jetsTagPerCollision, std::v auto jetTagClusters = getConstituents(jetTag, clustersTag); auto jetTagCandidates = getConstituents(jetTag, candidatesTag); - ptSumBase = getPtSum < jetfindingutilities::isEMCALClusterTable() || jetfindingutilities::isEMCALClusterTable(), (jetcandidateutilities::isCandidateTable() || jetcandidateutilities::isCandidateMcTable()) && (jetcandidateutilities::isCandidateTable

() || jetcandidateutilities::isCandidateMcTable

()), jetsBaseIsMc, jetsTagIsMc > (jetBaseTracks, jetBaseCandidates, jetBaseClusters, jetTagTracks, jetTagCandidates, jetTagClusters, tracksBase, tracksTag); - ptSumTag = getPtSum < jetfindingutilities::isEMCALClusterTable() || jetfindingutilities::isEMCALClusterTable(), (jetcandidateutilities::isCandidateTable() || jetcandidateutilities::isCandidateMcTable()) && (jetcandidateutilities::isCandidateTable

() || jetcandidateutilities::isCandidateMcTable

()), jetsTagIsMc, jetsBaseIsMc > (jetTagTracks, jetTagCandidates, jetTagClusters, jetBaseTracks, jetBaseCandidates, jetBaseClusters, tracksTag, tracksBase); + constexpr bool IsEMCAL{jetfindingutilities::isEMCALClusterTable() || jetfindingutilities::isEMCALClusterTable()}; + constexpr bool IsCandidate{(jetcandidateutilities::isCandidateTable() || jetcandidateutilities::isCandidateMcTable()) && (jetcandidateutilities::isCandidateTable

() || jetcandidateutilities::isCandidateMcTable

())}; + ptSumBase = getPtSum(jetBaseTracks, jetBaseCandidates, jetBaseClusters, jetTagTracks, jetTagCandidates, jetTagClusters, tracksBase, tracksTag); + ptSumTag = getPtSum(jetTagTracks, jetTagCandidates, jetTagClusters, jetBaseTracks, jetBaseCandidates, jetBaseClusters, tracksTag, tracksBase); if (ptSumBase > jetBase.pt() * minPtFraction) { baseToTagMatchingPt[jetBase.globalIndex()].push_back(jetTag.globalIndex()); } From 578ec80a6131408356e526a390840982e2b903b1 Mon Sep 17 00:00:00 2001 From: Lucia Anna Tarasovicova Date: Wed, 1 Oct 2025 16:50:14 +0200 Subject: [PATCH 598/986] [PWGLF] Change in hStrangeCorrelation.cxx (#13194) Co-authored-by: Lucia Anna Tarasovicova --- .../Tasks/Strangeness/hStrangeCorrelation.cxx | 47 ++++++++++++++----- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx b/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx index 2d0508cbe09..de750579eea 100644 --- a/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx +++ b/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx @@ -566,14 +566,14 @@ struct HStrangeCorrelation { return dPhiStarMean; } - void fillTriggerHistogram(std::shared_ptr hist, double pt, double mult, float eff, float effUncert) + void fillTriggerHistogram(std::shared_ptr hist, double pt, double mult, float eff, float effUncert, float purity, float purityErr) { int binx = hist->GetXaxis()->FindBin(pt); int biny = hist->GetYaxis()->FindBin(mult); float previousContent = hist->GetBinContent(binx, biny); float previousUncert = hist->GetBinError(binx, biny); - float newContent = previousContent + 1 / eff; - float newUncert = std::sqrt(previousUncert * previousUncert + 1 / std::pow(eff, 2) + std::pow(effUncert, 2) / std::pow(eff, 4)); + float newContent = previousContent + purity / eff; + float newUncert = std::sqrt(previousUncert * previousUncert + std::pow(purity / eff, 2) + std::pow(purityErr / eff, 2) + std::pow(effUncert, 2) / std::pow(eff, 4)); hist->SetBinContent(binx, biny, newContent); hist->SetBinError(binx, biny, newUncert); } @@ -600,16 +600,23 @@ struct HStrangeCorrelation { if (!mixing) { float efficiency = 1.0f; float efficiencyError = 0.0f; + float purity = 1.0f; + float purityErr = 0.0; if (efficiencyFlags.applyEfficiencyForTrigger) { efficiency = hEfficiencyTrigger->Interpolate(trigg.pt(), trigg.eta()); - if (efficiencyFlags.applyEfficiencyPropagation) + if (efficiencyFlags.applyPurityTrigger) + purity = hPurityHadron->Interpolate(trigg.pt()); + if (efficiencyFlags.applyEfficiencyPropagation) { efficiencyError = hEfficiencyUncertaintyTrigger->Interpolate(trigg.pt(), trigg.eta()); + if (efficiencyFlags.applyPurityTrigger) + purityErr = hPurityHadron->Interpolate(trigg.pt()); + } if (efficiency == 0) { // check for zero efficiency, do not apply if the case efficiency = 1; efficiencyError = 0; } } - fillTriggerHistogram(histos.get(HIST("sameEvent/TriggerParticlesV0")), trigg.pt(), mult, efficiency, efficiencyError); + fillTriggerHistogram(histos.get(HIST("sameEvent/TriggerParticlesV0")), trigg.pt(), mult, efficiency, efficiencyError, purity, purityErr); } double triggSign = trigg.sign(); @@ -808,16 +815,23 @@ struct HStrangeCorrelation { if (!mixing) { float efficiency = 1.0f; float efficiencyError = 0.0f; + float purity = 1.0f; + float purityErr = 0.0f; if (efficiencyFlags.applyEfficiencyForTrigger) { efficiency = hEfficiencyTrigger->Interpolate(trigg.pt(), trigg.eta()); - if (efficiencyFlags.applyEfficiencyPropagation) + if (efficiencyFlags.applyPurityTrigger) + purity = hPurityHadron->Interpolate(trigg.pt()); + if (efficiencyFlags.applyEfficiencyPropagation) { efficiencyError = hEfficiencyUncertaintyTrigger->Interpolate(trigg.pt(), trigg.eta()); + if (efficiencyFlags.applyPurityTrigger) + purityErr = hPurityUncertaintyHadron->Interpolate(trigg.pt()); + } if (efficiency == 0) { // check for zero efficiency, do not apply if the case efficiency = 1; efficiencyError = 0; } } - fillTriggerHistogram(histos.get(HIST("sameEvent/TriggerParticlesCascade")), trigg.pt(), mult, efficiency, efficiencyError); + fillTriggerHistogram(histos.get(HIST("sameEvent/TriggerParticlesCascade")), trigg.pt(), mult, efficiency, efficiencyError, purity, purityErr); } double triggSign = trigg.sign(); double triggForDeltaPhiStar[] = {trigg.phi(), trigg.pt(), triggSign}; @@ -985,19 +999,26 @@ struct HStrangeCorrelation { if (!mixing) { float efficiency = 1.0f; float efficiencyError = 0.0f; + float purity = 1.0f; + float purityError = 0.0f; if (efficiencyFlags.applyEfficiencyForTrigger) { efficiency = hEfficiencyTrigger->Interpolate(trigg.pt(), trigg.eta()); - if (efficiencyFlags.applyEfficiencyPropagation) + if (efficiencyFlags.applyPurityTrigger) + purity = hPurityHadron->Interpolate(trigg.pt()); + if (efficiencyFlags.applyEfficiencyPropagation) { hEfficiencyUncertaintyTrigger->Interpolate(trigg.pt(), trigg.eta()); + if (efficiencyFlags.applyPurityTrigger) + purityError = hPurityUncertaintyHadron->Interpolate(trigg.pt()); + } if (efficiency == 0) { // check for zero efficiency, do not apply if the case efficiency = 1; efficiencyError = 0; } } if constexpr (requires { triggerTrack.extra(); }) - fillTriggerHistogram(histos.get(HIST("sameEvent/TriggerParticlesPion")), trigg.pt(), mult, efficiency, efficiencyError); + fillTriggerHistogram(histos.get(HIST("sameEvent/TriggerParticlesPion")), trigg.pt(), mult, efficiency, efficiencyError, purity, purityError); else - fillTriggerHistogram(histos.get(HIST("sameEvent/TriggerParticlesHadron")), trigg.pt(), mult, efficiency, efficiencyError); + fillTriggerHistogram(histos.get(HIST("sameEvent/TriggerParticlesHadron")), trigg.pt(), mult, efficiency, efficiencyError, purity, purityError); } double triggSign = trigg.sign(); double triggForDeltaPhiStar[] = {trigg.phi(), trigg.pt(), triggSign}; @@ -1073,9 +1094,9 @@ struct HStrangeCorrelation { if (efficiencyFlags.applyPurityTrigger) purityTrigger = hPurityHadron->Interpolate(pttrigger); if (efficiencyFlags.applyEfficiencyPropagation) { - triggerEfficiencyUncert = hEfficiencyUncertaintyTrigger->Interpolate(ptassoc, assoc.eta()); + triggerEfficiencyUncert = hEfficiencyUncertaintyTrigger->Interpolate(pttrigger, trigg.eta()); if (efficiencyFlags.applyPurityTrigger) - triggerPurityUncertainty = hPurityUncertaintyHadron->Interpolate(ptassoc); + triggerPurityUncertainty = hPurityUncertaintyHadron->Interpolate(pttrigger); } } if (efficiency == 0) { // check for zero efficiency, do not apply if the case @@ -2449,7 +2470,7 @@ struct HStrangeCorrelation { histos.fill(HIST("ClosureTest/hTrigger"), gpt, geta, bestCollisionFT0Mpercentile); if (doCorrelationHadron) { assocHadronIndices.emplace_back(iteratorNum); - histos.fill(HIST("ClosureTest/hHadron"), gpt, geta, bestCollisionFT0Mpercentile); + histos.fill(HIST("ClosureTest/hHadron"), gpt, geta, gphi); } } } From 353b24d7461bbc62120309d581406f78bc38923d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Wed, 1 Oct 2025 16:54:41 +0200 Subject: [PATCH 599/986] [PWGLF] Enhance histogram registration for reconstructed particles (#13196) --- PWGLF/Tasks/QC/systematicsMapping.cxx | 42 +++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/PWGLF/Tasks/QC/systematicsMapping.cxx b/PWGLF/Tasks/QC/systematicsMapping.cxx index 13330e97042..1b26b3b525a 100644 --- a/PWGLF/Tasks/QC/systematicsMapping.cxx +++ b/PWGLF/Tasks/QC/systematicsMapping.cxx @@ -98,9 +98,9 @@ struct SystematicsMapping { registry.add("K/GeneratedPositive", "", HistType::kTHnSparseF, {ptAxis, etaAxis, phiAxis}); registry.add("K/GeneratedNegative", "", HistType::kTHnSparseF, {ptAxis, etaAxis, phiAxis}); registry.add("K0s/Generated", "", HistType::kTHnSparseF, {ptAxis, etaAxis, phiAxis}); - registry.add("K/ReconstructedPositive", "", HistType::kTHnSparseF, {ptAxis, etaAxis, phiAxis}); - registry.add("K/ReconstructedNegative", "", HistType::kTHnSparseF, {ptAxis, etaAxis, phiAxis}); - registry.add("K0s/Reconstructed", "", HistType::kTHnSparseF, {ptAxis, etaAxis, phiAxis}); + registry.add("K/ReconstructedPositive", "", HistType::kTHnSparseF, {ptAxis, etaAxis, phiAxis, nsigmaAxisTPC, nsigmaAxisTOF, tpcCrossedRowsAxis, itsClustersAxis, dcaXYAxis, dcaZAxis, chi2TPCAxis, chi2ITSAxis}); + registry.add("K/ReconstructedNegative", "", HistType::kTHnSparseF, {ptAxis, etaAxis, phiAxis, nsigmaAxisTPC, nsigmaAxisTOF, tpcCrossedRowsAxis, itsClustersAxis, dcaXYAxis, dcaZAxis, chi2TPCAxis, chi2ITSAxis}); + registry.add("K0s/Reconstructed", "", HistType::kTHnSparseF, {ptAxis, etaAxis, phiAxis, invariantMassBins, nsigmaAxisTPC, nsigmaAxisTOF, tpcCrossedRowsAxis, itsClustersAxis, dcaXYAxis, dcaZAxis, chi2TPCAxis, chi2ITSAxis}); } } @@ -165,6 +165,7 @@ struct SystematicsMapping { void processMc(soa::Join const& collisions, soa::Join const& tracks, + soa::Join const& v0s, aod::McParticles const& particles, aod::McCollisions const&) { @@ -187,16 +188,47 @@ struct SystematicsMapping { continue; switch (mcParticle.pdgCode()) { case 321: // K+ - registry.fill(HIST("K/ReconstructedPositive"), track.pt(), track.eta(), track.phi()); + registry.fill(HIST("K/ReconstructedPositive"), track.pt(), track.eta(), track.phi(), track.tpcNSigmaKa(), track.tofNSigmaKa(), track.tpcNClsCrossedRows(), track.itsNCls(), track.dcaXY(), track.dcaZ(), track.tpcChi2NCl(), track.itsChi2NCl()); break; case -321: // K- - registry.fill(HIST("K/ReconstructedNegative"), track.pt(), track.eta(), track.phi()); + registry.fill(HIST("K/ReconstructedNegative"), track.pt(), track.eta(), track.phi(), track.tpcNSigmaKa(), track.tofNSigmaKa(), track.tpcNClsCrossedRows(), track.itsNCls(), track.dcaXY(), track.dcaZ(), track.tpcChi2NCl(), track.itsChi2NCl()); break; default: break; } } + for (const auto& v0 : v0s) { + if (v0.collisionId() != collision.globalIndex()) + continue; + if (!v0.has_mcParticle()) + continue; + const auto& mcParticle = v0.mcParticle(); + if (mcParticle.mcCollisionId() != mcCollision.globalIndex()) + continue; + if (!mcParticle.isPhysicalPrimary()) + continue; + if (std::abs(mcParticle.pdgCode()) != 310) + continue; + const auto& posTrack = v0.posTrack_as(); + const auto& negTrack = v0.negTrack_as(); + if (v0.v0radius() < v0radius || + v0.v0cosPA() < v0cospa || + std::abs(posTrack.eta()) > etadau || + std::abs(negTrack.eta()) > etadau) + continue; + + registry.fill(HIST("K0s/Reconstructed"), v0.pt(), v0.eta(), v0.phi(), v0.mK0Short() - constants::physics::MassK0Short, + std::max(posTrack.tpcNSigmaPi(), negTrack.tpcNSigmaPi()), + std::max(posTrack.tofNSigmaPi(), negTrack.tofNSigmaPi()), + std::min(posTrack.tpcNClsCrossedRows(), negTrack.tpcNClsCrossedRows()), + std::min(posTrack.itsNCls(), negTrack.itsNCls()), + std::min(posTrack.dcaXY(), negTrack.dcaXY()), + std::min(posTrack.dcaZ(), negTrack.dcaZ()), + std::min(posTrack.tpcChi2NCl(), negTrack.tpcChi2NCl()), + std::min(posTrack.itsChi2NCl(), negTrack.itsChi2NCl())); + } + for (const auto& particle : particles) { if (particle.mcCollisionId() != mcCollision.globalIndex()) continue; From 8f3db24586f702f6bb559d41b2fedbbdebe86344 Mon Sep 17 00:00:00 2001 From: blacwovie Date: Thu, 2 Oct 2025 00:47:18 +0800 Subject: [PATCH 600/986] [PWGCF] Pi nuclei update (#13197) Co-authored-by: ALICE Action Bot --- .../FemtoNuclei/DataModel/PionNucleiTables.h | 2 + .../TableProducer/PiNucleiFemto.cxx | 174 +++++++++--------- 2 files changed, 87 insertions(+), 89 deletions(-) diff --git a/PWGCF/Femto/FemtoNuclei/DataModel/PionNucleiTables.h b/PWGCF/Femto/FemtoNuclei/DataModel/PionNucleiTables.h index eb99608b5b8..c1e128190fd 100644 --- a/PWGCF/Femto/FemtoNuclei/DataModel/PionNucleiTables.h +++ b/PWGCF/Femto/FemtoNuclei/DataModel/PionNucleiTables.h @@ -56,6 +56,7 @@ DECLARE_SOA_COLUMN(MassTOFNu, massTOFNu, float); DECLARE_SOA_COLUMN(MassTOFPi, massTOFPi, float); DECLARE_SOA_COLUMN(PidTrkNu, pidTrkNu, uint32_t); DECLARE_SOA_COLUMN(PidTrkPi, pidTrkPi, uint32_t); +DECLARE_SOA_COLUMN(TrackIDPi, trackIDPi, int); DECLARE_SOA_COLUMN(ItsClusterSizeNu, itsClusterSizeNu, uint32_t); DECLARE_SOA_COLUMN(ItsClusterSizePi, itsClusterSizePi, uint32_t); @@ -127,6 +128,7 @@ DECLARE_SOA_TABLE(PionHyperTable, "AOD", "PIHYPERTABLE", pion_nuclei_tables::ItsClusterSizePi, pion_nuclei_tables::ItsClusterSizeNu, pion_nuclei_tables::SharedClustersPi, + pion_nuclei_tables::TrackIDPi, pion_nuclei_tables::IsBkgUS, pion_nuclei_tables::IsBkgEM) DECLARE_SOA_TABLE(PionNucleiMult, "AOD", "PINUCLEIMULT", diff --git a/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx b/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx index 77bc5ae2c0e..c2a6d595d36 100644 --- a/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx +++ b/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx @@ -16,6 +16,7 @@ /// \date 2025-04-10 #include "PWGCF/Femto/FemtoNuclei/DataModel/PionNucleiTables.h" +#include "PWGCF/FemtoWorld/Core/FemtoWorldMath.h" #include "PWGLF/DataModel/EPCalibrationTables.h" #include "PWGLF/DataModel/LFHypernucleiTables.h" #include "PWGLF/Utils/svPoolCreator.h" @@ -76,7 +77,7 @@ using std::array; using CollBracket = o2::math_utils::Bracket; using CollisionsFull = soa::Join; using CollisionsFullMC = soa::Join; -using TrackCandidates = soa::Join; +using TrackCandidates = soa::Join; namespace { @@ -125,6 +126,8 @@ struct PiNucandidate { float chi2TPCPi = -10.f; float nSigmaNu = -10.f; float nSigmaPi = -10.f; + float tpcPrnsigma = -10.f; + float tofPrnsigma = -10.f; uint32_t pidTrkNu = 0xFFFFF; // PID in tracking uint32_t pidTrkPi = 0xFFFFF; float massTOFNu = -10; @@ -141,8 +144,12 @@ struct PiNucandidate { int trackIDNu = -1; int trackIDPi = -1; + float kstar = 1.f; + float mT = 1.f; + // collision information int32_t collisionID = 0; + float cent = 1.f; }; struct PiNucleiFemto { @@ -237,6 +244,7 @@ struct PiNucleiFemto { {"hNcontributor", "Number of primary vertex contributor", {HistType::kTH1F, {{2000, 0.0f, 2000.0f}}}}, {"hCentrality", "Centrality", {HistType::kTH1F, {{100, 0.0f, 100.0f}}}}, {"hTrackSel", "Accepted tracks", {HistType::kTH1F, {{Selections::kAll, -0.5, static_cast(Selections::kAll) - 0.5}}}}, + {"hSkipReasons", "Why storedEvent skipped;Reason;Counts", {HistType::kTH1F, {{5, -0.5, 4.5}}}}, {"hEvents", "; Events;", {HistType::kTH1F, {{3, -0.5, 2.5}}}}, {"hEmptyPool", "svPoolCreator did not find track pairs false/true", {HistType::kTH1F, {{2, -0.5, 1.5}}}}, {"hdcaxyNu", ";DCA_{xy} (cm)", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}}, @@ -247,6 +255,8 @@ struct PiNucleiFemto { {"hNuPitInvMass", "; M(Nu + p) (GeV/#it{c}^{2})", {HistType::kTH1F, {{300, 3.74f, 4.34f}}}}, {"hNuPt", "#it{p}_{T} distribution; #it{p}_{T} (GeV/#it{c})", {HistType::kTH1F, {{240, -6.0f, 6.0f}}}}, {"hPiPt", "Pt distribution; #it{p}_{T} (GeV/#it{c})", {HistType::kTH1F, {{120, -3.0f, 3.0f}}}}, + {"hSingleNuPt", "#it{p}_{T} distribution; #it{p}_{T} (GeV/#it{c})", {HistType::kTH1F, {{240, -6.0f, 6.0f}}}}, + {"hSinglePiPt", "Pt distribution; #it{p}_{T} (GeV/#it{c})", {HistType::kTH1F, {{120, -3.0f, 3.0f}}}}, {"hHe3TPCnsigma", "NsigmaHe3 TPC distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}(He3)", {HistType::kTH2F, {{100, -2.0f, 2.0f}, {200, -5.0f, 5.0f}}}}, {"hHe3P", "Pin distribution; p (GeV/#it{c})", {HistType::kTH1F, {{120, -3.0f, 3.0f}}}}, {"hHe3P_preselected", "Pin distribution_preselected; p (GeV/#it{c})", {HistType::kTH1F, {{120, -3.0f, 3.0f}}}}, @@ -268,11 +278,18 @@ struct PiNucleiFemto { {"h2NsigmaPiTOF", "NsigmaPi TOF distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}(p)", {HistType::kTH2F, {{200, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}}}, {"h2NsigmaNuTOF", "NsigmaNu TOF distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}(Nu)", {HistType::kTH2F, {{200, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}}}, {"h2NsigmaPiTOF_preselection", "NsigmaPi TOF distribution; #iit{p}_{T} (GeV/#it{c}); n#sigma_{TOF}(p)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {400, -10.0f, 10.0f}}}}, + {"hkStaVsmTVsCent_LS_M", ";kStar (GeV/c);mT (GeV/#it{c}^{2});Centrality", {HistType::kTH3F, {{300, 0.0f, 3.0f}, {100, 0.2f, 3.2f}, {100, 0.0f, 100.0f}}}}, + {"hkStaVsmTVsCent_LS_A", ";kStar (GeV/c);mT (GeV/#it{c}^{2});Centrality", {HistType::kTH3F, {{300, 0.0f, 3.0f}, {100, 0.2f, 3.2f}, {100, 0.0f, 100.0f}}}}, + {"hkStaVsmTVsCent_US_M", ";kStar (GeV/c);mT (GeV/#it{c}^{2});Centrality", {HistType::kTH3F, {{300, 0.0f, 3.0f}, {100, 0.2f, 3.2f}, {100, 0.0f, 100.0f}}}}, + {"hkStaVsmTVsCent_US_A", ";kStar (GeV/c);mT (GeV/#it{c}^{2});Centrality", {HistType::kTH3F, {{300, 0.0f, 3.0f}, {100, 0.2f, 3.2f}, {100, 0.0f, 100.0f}}}}, + {"hCollIDVsCentEachPion", ";CollisionID;Centrality", {HistType::kTH2F, {{4000, 0.0f, 4000.0f}, {100, 0.0f, 100.0f}}}}, + {"hNHypsPerPrevColl", "Number of V0Hypers in previous collision used for mixing;N_{V0Hypers};Entries", {HistType::kTH2F, {{4000, 0.0f, 4000.0f}, {50, -0.5, 49.5}}}}, {"hkStar_LS_M", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}}, {"hkStar_LS_A", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}}, {"hkStar_US_M", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}}, {"hkStar_US_A", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}}, - {"hkStar_All", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}}, + {"h2NsigmaPiPrTPC", "NsigmaPi TPC distribution; #it{p}_{T}(GeV/#it{c}); n#sigma_{TPC}(p)", {HistType::kTH1F, {{200, -5.0f, 5.0f}}}}, + {"h2NsigmaPiPrTOF", "NsigmaPi TOF distribution; #it{p}_{T}(GeV/#it{c}); n#sigma_{TPC}(p)", {HistType::kTH1F, {{200, -5.0f, 5.0f}}}}, {"hisBkgEM", "; isBkgEM;", {HistType::kTH1F, {{3, -1, 2}}}}}, OutputObjHandlingPolicy::AnalysisObject, false, @@ -460,10 +477,21 @@ struct PiNucleiFemto { template bool selectionPIDPion(const Ttrack& candidate) { + if (abs(candidate.dcaXY()) > settingCutPiDCAxyMin || abs(candidate.dcaZ()) > settingCutPiDCAzMin) + return false; + auto tpcNSigmaPi = candidate.tpcNSigmaPi(); mQaRegistry.fill(HIST("h2NsigmaPiTPC_preselection"), candidate.tpcInnerParam(), tpcNSigmaPi); if (std::abs(candidate.pt()) < settingCutPiptMin || std::abs(candidate.pt()) > settingCutPiptMax) return false; + // reject protons + if (std::abs(candidate.tpcNSigmaPr()) < settingCutNsigTPCPrMin) + return false; + mQaRegistry.fill(HIST("h2NsigmaPiPrTPC"), candidate.tpcNSigmaPr()); + if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPr()) < settingCutNsigTOFPrMin) + return false; + mQaRegistry.fill(HIST("h2NsigmaPiPrTOF"), candidate.tofNSigmaPr()); + if (candidate.hasTOF() && candidate.tpcInnerParam() >= settingCutPinMinTOFPi) { auto tofNSigmaPi = candidate.tofNSigmaPi(); auto combNsigma = std::sqrt(tofNSigmaPi * tofNSigmaPi + tpcNSigmaPi * tpcNSigmaPi); @@ -500,6 +528,10 @@ struct PiNucleiFemto { float tpcInnerParam = candidate.tpcInnerParam(); mQaRegistry.fill(HIST("h2dEdx"), candidate.sign() * tpcInnerParam, candidate.tpcSignal()); + float DeDCAxyMin = 0.015 + 0.0305 / TMath::Power(candidate.pt(), 1.1); + if (abs(candidate.dcaXY()) > DeDCAxyMin || abs(candidate.dcaXY()) > settingCutDeDCAzMin) + return false; + if (std::abs(tpcInnerParam) < settingCutPinMinDe) { return false; } @@ -690,6 +722,9 @@ struct PiNucleiFemto { piNucand.massTOFPi = trackPi.tpcInnerParam() * std::sqrt(1.f / (beta * beta) - 1.f); } + piNucand.kstar = o2::analysis::femtoWorld::FemtoWorldMath::getkstar(trackPi, o2::constants::physics::MassPiPlus, trackDe, o2::constants::physics::MassDeuteron); + piNucand.mT = o2::analysis::femtoWorld::FemtoWorldMath::getmT(trackPi, o2::constants::physics::MassPiPlus, trackDe, o2::constants::physics::MassDeuteron); + return true; } @@ -763,8 +798,9 @@ struct PiNucleiFemto { } template - void pairTracksSameEvent(const Ttrack& tracks) + void pairTracksSameEvent(const Ttrack& tracks, float cent) { + bool filledAllOnce = false; // LOG(info) << "Number of tracks: " << tracks.size(); for (const auto& track0 : tracks) { @@ -779,6 +815,7 @@ struct PiNucleiFemto { continue; } mQaRegistry.fill(HIST("hTrackSel"), Selections::kPID); + mQaRegistry.fill(HIST("hSingleNuPt"), track0.pt() * track0.sign()); for (const auto& track1 : tracks) { if (track0 == track1) { @@ -798,6 +835,11 @@ struct PiNucleiFemto { continue; } + if (!filledAllOnce) { + mQaRegistry.fill(HIST("hCollIDVsCentEachPion"), track1.collisionId(), cent); + mQaRegistry.fill(HIST("hSinglePiPt"), track1.pt() * track1.sign()); + } + SVCand trackPair; trackPair.tr0Idx = track0.globalIndex(); trackPair.tr1Idx = track1.globalIndex(); @@ -806,6 +848,7 @@ struct PiNucleiFemto { trackPair.collBracket = collBracket; mTrackPairs.push_back(trackPair); } + filledAllOnce = true; } } @@ -956,6 +999,7 @@ struct PiNucleiFemto { piNucand.itsClSizePi, piNucand.itsClSizeNu, piNucand.sharedClustersPi, + piNucand.trackIDPi, piNucand.isBkgUS, piNucand.isBkgEM); if (settingFillMultiplicity) { @@ -985,80 +1029,26 @@ struct PiNucleiFemto { mQaRegistry.fill(HIST("hisBkgEM"), piNucand.isBkgEM); } - double computePrTPCnsig(double InnerParamTPCHad, double SignalTPCHad) - { - double m_BBparamsProton[6] = {-54.42066571222577, 0.2857381250239097, 1.247140602468868, 0.6297483918147729, 2.985438833884555, 0.09}; - - float TPCinnerParam = InnerParamTPCHad; - float expTPCSignal = o2::tpc::BetheBlochAleph((TPCinnerParam / 0.9382721), m_BBparamsProton[0], m_BBparamsProton[1], m_BBparamsProton[2], m_BBparamsProton[3], m_BBparamsProton[4]); - double resoTPC{expTPCSignal * m_BBparamsProton[5]}; - return ((SignalTPCHad - expTPCSignal) / resoTPC); - } - - double tofNSigmaCalculation(double MassTOFHad, double ptHad) - { - double fExpTOFMassHad = 0.9487; // Proton mass in TOF - const float kp0 = 1.22204e-02; - const float kp1 = 7.48467e-01; - - double fSigmaTOFMassHad = (kp0 * TMath::Exp(kp1 * TMath::Abs(ptHad))) * fExpTOFMassHad; - double fNSigmaTOFHad = (MassTOFHad - fExpTOFMassHad) / fSigmaTOFMassHad; - return fNSigmaTOFHad; - } - - double computeKstar(const PiNucandidate& piNucand) - { - constexpr double massDe = o2::constants::physics::MassDeuteron; - constexpr double massHad = o2::constants::physics::MassPiPlus; - - const ROOT::Math::PtEtaPhiMVector De(std::abs(piNucand.recoPtNu()), piNucand.recoEtaNu(), piNucand.recoPhiNu(), massDe); - const ROOT::Math::PtEtaPhiMVector Had(std::abs(piNucand.recoPtPi()), piNucand.recoEtaPi(), piNucand.recoPhiPi(), massHad); - const ROOT::Math::PtEtaPhiMVector trackSum = De + Had; - - const float beta = trackSum.Beta(); - const float betax = beta * std::cos(trackSum.Phi()) * std::sin(trackSum.Theta()); - const float betay = beta * std::sin(trackSum.Phi()) * std::sin(trackSum.Theta()); - const float betaz = beta * std::cos(trackSum.Theta()); - - ROOT::Math::PxPyPzMVector DeCMS(De); - ROOT::Math::PxPyPzMVector HadCMS(Had); - - const ROOT::Math::Boost boostPRF = ROOT::Math::Boost(-betax, -betay, -betaz); - DeCMS = boostPRF(DeCMS); - HadCMS = boostPRF(HadCMS); - - const ROOT::Math::PxPyPzMVector RelKstar = DeCMS - HadCMS; - return 0.5 * RelKstar.P(); - } - - void fillKstar(const PiNucandidate& piNucand) + template + void fillKstar(const PiNucandidate& piNucand, const Tcoll& collision) { - double PrTPCnsigma = computePrTPCnsig(piNucand.momPiTPC, piNucand.tpcSignalPi); - double PrTOFnsigma = tofNSigmaCalculation(piNucand.massTOFPi, piNucand.recoPtPi()); - if (abs(PrTPCnsigma) < settingCutNsigTPCPrMin) - return; - if (abs(PrTOFnsigma) < settingCutNsigTOFPrMin) - return; - float DeDCAxyMin = 0.015 + 0.0305 / TMath::Power(piNucand.recoPtNu(), 1.1); - if (abs(piNucand.dcaxyNu) > DeDCAxyMin || abs(piNucand.dcazNu) > settingCutDeDCAzMin || abs(piNucand.dcaxyPi) > settingCutPiDCAxyMin || abs(piNucand.dcazPi) > settingCutPiDCAzMin) - return; - fillHistograms(piNucand); - - double kstar = computeKstar(piNucand); if (piNucand.isBkgUS == 0) { if (piNucand.recoPtNu() > 0) { - mQaRegistry.fill(HIST("hkStar_LS_M"), kstar); + mQaRegistry.fill(HIST("hkStar_LS_M"), piNucand.kstar); + mQaRegistry.fill(HIST("hkStaVsmTVsCent_LS_M"), piNucand.kstar, piNucand.mT, collision.centFT0C()); } else { - mQaRegistry.fill(HIST("hkStar_LS_A"), kstar); + mQaRegistry.fill(HIST("hkStar_LS_A"), piNucand.kstar); + mQaRegistry.fill(HIST("hkStaVsmTVsCent_LS_A"), piNucand.kstar, piNucand.mT, collision.centFT0C()); } } else { if (piNucand.recoPtNu() > 0) { - mQaRegistry.fill(HIST("hkStar_US_M"), kstar); + mQaRegistry.fill(HIST("hkStar_US_M"), piNucand.kstar); + mQaRegistry.fill(HIST("hkStaVsmTVsCent_US_M"), piNucand.kstar, piNucand.mT, collision.centFT0C()); } else { - mQaRegistry.fill(HIST("hkStar_US_A"), kstar); + mQaRegistry.fill(HIST("hkStar_US_A"), piNucand.kstar); + mQaRegistry.fill(HIST("hkStaVsmTVsCent_US_A"), piNucand.kstar, piNucand.mT, collision.centFT0C()); } } - mQaRegistry.fill(HIST("hkStar_All"), kstar); } // ================================================================================================================== @@ -1077,9 +1067,9 @@ struct PiNucleiFemto { continue; } - fillKstar(piNucand); - auto collision = collisions.rawIteratorAt(piNucand.collisionID); + fillKstar(piNucand, collision); + fillHistograms(piNucand); if (settingFillTable) { fillTable(piNucand, collision); @@ -1139,7 +1129,7 @@ struct PiNucleiFemto { auto trackTableThisCollision = tracks.sliceBy(mPerCol, collIdx); trackTableThisCollision.bindExternalIndices(&tracks); - pairTracksSameEvent(trackTableThisCollision); + pairTracksSameEvent(trackTableThisCollision, collision.centFT0C()); if (mTrackPairs.size() == 0) { continue; @@ -1234,42 +1224,48 @@ PROCESS_SWITCH(PiNucleiFemto, processMixedEventHyper, "Process Mixed event", fal mQaRegistry.fill(HIST("hCentrality"), collision.centFT0C()); mQaRegistry.fill(HIST("hVtxZ"), collision.posZ()); int poolIndexPi = where_pool(collision.posZ(), collision.centFT0C()); - auto& pool = All_Event_pool[poolIndexPi]; if (poolIndexPi < 0 || static_cast(poolIndexPi) >= All_Event_pool.size()) { continue; } + auto& pool = All_Event_pool[poolIndexPi]; for (auto const& storedEvent : pool.events) { - auto c1 = collisions.iteratorAt(storedEvent.collisionId); - const auto& c2 = collision; - if (!c1.sel8() || !c2.sel8()) + const auto& c2 = collisions.iteratorAt(storedEvent.collisionId); + if (!collision.sel8() || !c2.sel8()) { + mQaRegistry.fill(HIST("hSkipReasons"), 0); continue; + } - std::vector tracks1; - for (auto const& t : pitracks) { - if (t.collisionId() == c1.globalIndex()) { - tracks1.push_back(t); - } + auto hypdTablepreviousCollision = V0Hypers.sliceBy(hypPerCol, c2.globalIndex()); + hypdTablepreviousCollision.bindExternalIndices(&V0Hypers); + + if (hypdTablepreviousCollision.size() == 0) { + mQaRegistry.fill(HIST("hSkipReasons"), 1); + continue; } - std::vector hypers2; - for (auto const& h : V0Hypers) { - if (h.collisionId() != c2.globalIndex()) - continue; - int poolIndexHyp = where_pool(h.zPrimVtx(), h.centralityFT0C()); - if (poolIndexHyp != poolIndexPi) - continue; - hypers2.push_back(h); + + auto firstHyp = hypdTablepreviousCollision.iteratorAt(0); + int poolIndexHyp = where_pool(firstHyp.zPrimVtx(), firstHyp.centralityFT0C()); + + if (poolIndexHyp != poolIndexPi) { + mQaRegistry.fill(HIST("hSkipReasons"), 2); + continue; } - pairHyperEventMixing(tracks1, hypers2); + + auto trackTableThisCollision = pitracks.sliceBy(mPerCol, collision.globalIndex()); + trackTableThisCollision.bindExternalIndices(&pitracks); + + mQaRegistry.fill(HIST("hNHypsPerPrevColl"), c2.globalIndex(), hypdTablepreviousCollision.size()); + pairHyperEventMixing(trackTableThisCollision, hypdTablepreviousCollision); } - fillPairsHyper(collisions, pitracks, V0Hypers, /*isMixedEvent*/ true); if (static_cast(pool.events.size()) >= settingNoMixedEvents) { pool.events.pop_front(); } pool.events.push_back({collision.globalIndex()}); } + fillPairsHyper(collisions, pitracks, V0Hypers, /*isMixedEvent*/ true); } PROCESS_SWITCH(PiNucleiFemto, processMixedEventHyperPool, "Process Mixed event", false); }; From 45347b1a28e04311054fe1d679a60de69ae693d0 Mon Sep 17 00:00:00 2001 From: Nida Malik Date: Wed, 1 Oct 2025 22:41:09 +0530 Subject: [PATCH 601/986] [PWGCF] use different polynomial for fitting multiplicity correlation plots (#13199) --- .../EbyEFluctuations/Tasks/netchargeFluctuations.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index a2d95bd72df..6414df12727 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -113,18 +113,18 @@ struct NetchargeFluctuations { O2_DEFINE_CONFIGURABLE(cfgMultPVT0CCutEnabled, bool, true, "Enable PV multiplicity vs T0C centrality cut") O2_DEFINE_CONFIGURABLE(cfgMultGlobalFT0CCutEnabled, bool, true, "Enable globalTracks vs FT0C multiplicity cut") - O2_DEFINE_CONFIGURABLE(cfgMultGlobalPVCutEnabled, bool, false, "Enable globalTracks vs PV multiplicity cut") + O2_DEFINE_CONFIGURABLE(cfgMultGlobalPVCutEnabled, bool, true, "Enable globalTracks vs PV multiplicity cut") Configurable> cfgMultPVT0CCutPars{"cfgMultPVT0CCutPars", - std::vector{187.621, -5.14575, 0.0716601, -0.000586642, 2.02818e-06, 51.2929, -1.66644, 0.0354762, -0.000389809, 1.55365e-06}, + std::vector{30.434, -0.917137, 0.0185032, -0.000198425, 7.94381e-07, 13.7406, -0.282656, 0.00556147, -6.32766e-05, 2.51648e-07}, "PV multiplicity vs T0C centrality cut parameter values"}; Configurable> cfgMultGlobalFT0CCutPars{"cfgMultGlobalFT0CCutPars", - std::vector{135.561, -3.7818, 0.0536562, -0.000445155, 1.55429e-06, 38.2336, -1.2568, 0.0270932, -0.000301034, 1.21234e-06}, + std::vector{18.9628, -0.576466, 0.0117324, -0.000126086, 5.05365e-07, 8.99921, -0.188022, 0.0037089, -4.20275e-05, 1.68234e-07}, "globalTracks vs FT0C cut parameter values"}; Configurable> cfgMultGlobalPVCutPars{"cfgMultGlobalPVCutPars", - std::vector{100., -2., 0.05, -0.0003, 1e-06, 30., -1.0, 0.02, -0.0002, 8e-07}, + std::vector{0.148031, 0.616699, 0.603083, 0.112751, -0.0013846, 8.38211e-06}, "globalTracks vs PV cut parameter values"}; std::vector multPVT0CCutPars; @@ -354,13 +354,13 @@ struct NetchargeFluctuations { cfgFunCoeff.fMultGlobalPVCutLow = new TF1("fMultGlobalPVCutLow", - "[0] + [1]*x - 5.*([2] + [3]*x)", + "[0]+[1]*x - 3.5*([2]+[3]*x+[4]*x*x+[5]*x*x*x)", 0, 100); cfgFunCoeff.fMultGlobalPVCutLow->SetParameters(&(cfgFunCoeff.multGlobalPVCutPars[0])); cfgFunCoeff.fMultGlobalPVCutHigh = new TF1("fMultGlobalPVCutHigh", - "[0] + [1]*x + 5.*([2] + [3]*x)", + "[0]+[1]*x + 3.5*([2]+[3]*x+[4]*x*x+[5]*x*x*x)", 0, 100); cfgFunCoeff.fMultGlobalPVCutHigh->SetParameters(&(cfgFunCoeff.multGlobalPVCutPars[0])); From 956eb60affbc60531d1af2db10aacb151b4f7e78 Mon Sep 17 00:00:00 2001 From: blacwovie Date: Thu, 2 Oct 2025 03:31:21 +0800 Subject: [PATCH 602/986] [PWGLF] add TPC and TOF nsigma for all hadrons in output (#13173) --- PWGLF/DataModel/LFhe3HadronTables.h | 14 +++++++++-- PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx | 25 +++++++++++++++---- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/PWGLF/DataModel/LFhe3HadronTables.h b/PWGLF/DataModel/LFhe3HadronTables.h index 01340bb0e2a..731f04f8a88 100644 --- a/PWGLF/DataModel/LFhe3HadronTables.h +++ b/PWGLF/DataModel/LFhe3HadronTables.h @@ -44,7 +44,12 @@ DECLARE_SOA_COLUMN(SignalTPCHad, signalTPCHad, float); DECLARE_SOA_COLUMN(InnerParamTPCHad, innerParamTPCHad, float); DECLARE_SOA_COLUMN(NClsTPCHe3, nClsTPCHe3, uint8_t); DECLARE_SOA_COLUMN(NSigmaTPCHe3, nSigmaTPCHe3, float); -DECLARE_SOA_COLUMN(NSigmaTPCHad, nSigmaTOFHad, float); +DECLARE_SOA_COLUMN(NSigmaTPCHadPi, nSigmaTPCHadPi, float); +DECLARE_SOA_COLUMN(NSigmaTPCHadKa, nSigmaTPCHadKa, float); +DECLARE_SOA_COLUMN(NSigmaTPCHadPr, nSigmaTPCHadPr, float); +DECLARE_SOA_COLUMN(NSigmaTOFHadPi, nSigmaTOFHadPi, float); +DECLARE_SOA_COLUMN(NSigmaTOFHadKa, nSigmaTOFHadKa, float); +DECLARE_SOA_COLUMN(NSigmaTOFHadPr, nSigmaTOFHadPr, float); DECLARE_SOA_COLUMN(Chi2TPCHe3, chi2TPCHe3, float); DECLARE_SOA_COLUMN(Chi2TPCHad, chi2TPCHad, float); DECLARE_SOA_COLUMN(MassTOFHe3, massTOFHe3, float); @@ -105,7 +110,12 @@ DECLARE_SOA_TABLE(he3HadronTable, "AOD", "HE3HADTABLE", he3HadronTablesNS::InnerParamTPCHad, he3HadronTablesNS::NClsTPCHe3, he3HadronTablesNS::NSigmaTPCHe3, - he3HadronTablesNS::NSigmaTPCHad, + he3HadronTablesNS::NSigmaTPCHadPi, + he3HadronTablesNS::NSigmaTPCHadKa, + he3HadronTablesNS::NSigmaTPCHadPr, + he3HadronTablesNS::NSigmaTOFHadPi, + he3HadronTablesNS::NSigmaTOFHadKa, + he3HadronTablesNS::NSigmaTOFHadPr, he3HadronTablesNS::Chi2TPCHe3, he3HadronTablesNS::Chi2TPCHad, he3HadronTablesNS::MassTOFHe3, diff --git a/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx b/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx index 76c2bcb7c01..1278ecb4b04 100644 --- a/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx +++ b/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx @@ -77,8 +77,8 @@ using McIter = aod::McParticles::iterator; using CollBracket = o2::math_utils::Bracket; using CollisionsFull = soa::Join; using CollisionsFullMC = soa::Join; -using TrackCandidates = soa::Join; -using TrackCandidatesMC = soa::Join; +using TrackCandidates = soa::Join; +using TrackCandidatesMC = soa::Join; namespace { @@ -147,7 +147,12 @@ struct He3HadCandidate { float chi2TPCHe3 = -10.f; float chi2TPCHad = -10.f; float nSigmaHe3 = -10.f; - float nSigmaHad = -10.f; + float nSigmaTPCHadPi = -10.f; + float nSigmaTPCHadKa = -10.f; + float nSigmaTPCHadPr = -10.f; + float nSigmaTOFHadPi = -10.f; + float nSigmaTOFHadKa = -10.f; + float nSigmaTOFHadPr = -10.f; uint32_t pidtrkHe3 = 0xFFFFF; // PID in tracking uint32_t pidtrkHad = 0xFFFFF; float massTOFHe3 = -10; @@ -637,7 +642,12 @@ struct he3HadronFemto { he3Hadcand.nTPCClustersHe3 = trackHe3.tpcNClsFound(); he3Hadcand.nSigmaHe3 = computeNSigmaHe3(trackHe3); - he3Hadcand.nSigmaHad = computeTPCNSigmaHadron(trackHad); + he3Hadcand.nSigmaTPCHadPi = trackHad.tpcNSigmaPi(); + he3Hadcand.nSigmaTPCHadKa = trackHad.tpcNSigmaKa(); + he3Hadcand.nSigmaTPCHadPr = trackHad.tpcNSigmaPr(); + he3Hadcand.nSigmaTOFHadPi = trackHad.tofNSigmaPi(); + he3Hadcand.nSigmaTOFHadKa = trackHad.tofNSigmaKa(); + he3Hadcand.nSigmaTOFHadPr = trackHad.tofNSigmaPr(); he3Hadcand.chi2TPCHe3 = trackHe3.tpcChi2NCl(); he3Hadcand.chi2TPCHad = trackHad.tpcChi2NCl(); @@ -790,7 +800,12 @@ struct he3HadronFemto { he3Hadcand.momHadTPC, he3Hadcand.nTPCClustersHe3, he3Hadcand.nSigmaHe3, - he3Hadcand.nSigmaHad, + he3Hadcand.nSigmaTPCHadPi, + he3Hadcand.nSigmaTPCHadKa, + he3Hadcand.nSigmaTPCHadPr, + he3Hadcand.nSigmaTOFHadPi, + he3Hadcand.nSigmaTOFHadKa, + he3Hadcand.nSigmaTOFHadPr, he3Hadcand.chi2TPCHe3, he3Hadcand.chi2TPCHad, he3Hadcand.massTOFHe3, From 6476525b9042f5b42ed2fb180cedfcbf5f8deab2 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Wed, 1 Oct 2025 22:35:47 +0200 Subject: [PATCH 603/986] [PWGEM/Dilepton] fix in electronConverter5 (#13203) --- PWGEM/Dilepton/Tasks/Converters/electronConverter5.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/PWGEM/Dilepton/Tasks/Converters/electronConverter5.cxx b/PWGEM/Dilepton/Tasks/Converters/electronConverter5.cxx index 58df0fce179..60ea4f0db2e 100644 --- a/PWGEM/Dilepton/Tasks/Converters/electronConverter5.cxx +++ b/PWGEM/Dilepton/Tasks/Converters/electronConverter5.cxx @@ -119,8 +119,7 @@ struct electronConverter5 { } PROCESS_SWITCH(electronConverter5, process003to005, "convert from 003 into 005", false); - using MyElectrons004 = soa::Join; - void process004to005(MyElectrons004 const& tracks) + void process004to005(aod::EMPrimaryElectrons_004 const& tracks) { for (const auto& track : tracks) { track_005(track.collisionId(), From c900173691d97f78111d4b9405d7f9744a1aadea Mon Sep 17 00:00:00 2001 From: hfribert Date: Wed, 1 Oct 2025 23:44:07 +0200 Subject: [PATCH 604/986] [ALICE3] Add nuclei to TOF & RICH + combined PID task (#13172) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Henrik Fribert Co-authored-by: Henrik Fribert Co-authored-by: Nicolò Jacazio Co-authored-by: ALICE Action Bot --- ALICE3/DataModel/OTFRICH.h | 34 +- ALICE3/DataModel/OTFTOF.h | 92 ++++- ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx | 92 ++++- ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx | 81 ++-- .../TableProducer/OTF/onTheFlyTrackerPid.cxx | 67 ++-- ALICE3/Tasks/CMakeLists.txt | 5 +- ALICE3/Tasks/alice3PidEvaluation.cxx | 371 ++++++++++++++++++ 7 files changed, 660 insertions(+), 82 deletions(-) create mode 100644 ALICE3/Tasks/alice3PidEvaluation.cxx diff --git a/ALICE3/DataModel/OTFRICH.h b/ALICE3/DataModel/OTFRICH.h index d4d9c5257ce..05771dda57b 100644 --- a/ALICE3/DataModel/OTFRICH.h +++ b/ALICE3/DataModel/OTFRICH.h @@ -31,12 +31,20 @@ DECLARE_SOA_COLUMN(NSigmaMuonRich, nSigmaMuonRich, float); //! NSigma mu DECLARE_SOA_COLUMN(NSigmaPionRich, nSigmaPionRich, float); //! NSigma pion BarrelRich DECLARE_SOA_COLUMN(NSigmaKaonRich, nSigmaKaonRich, float); //! NSigma kaon BarrelRich DECLARE_SOA_COLUMN(NSigmaProtonRich, nSigmaProtonRich, float); //! NSigma proton BarrelRich +DECLARE_SOA_COLUMN(NSigmaDeuteronRich, nSigmaDeuteronRich, float); //! NSigma deuteron BarrelRich +DECLARE_SOA_COLUMN(NSigmaTritonRich, nSigmaTritonRich, float); //! NSigma triton BarrelRich +DECLARE_SOA_COLUMN(NSigmaHelium3Rich, nSigmaHelium3Rich, float); //! NSigma helium3 BarrelRich +DECLARE_SOA_COLUMN(NSigmaAlphaRich, nSigmaAlphaRich, float); //! NSigma alpha BarrelRich DECLARE_SOA_DYNAMIC_COLUMN(NSigmaRich, nSigmaRich, //! General function to get the nSigma for the RICH [](const float el, const float mu, const float pi, const float ka, const float pr, + const float de, + const float tr, + const float he3, + const float al, const int id) -> float { switch (std::abs(id)) { case 0: @@ -49,6 +57,14 @@ DECLARE_SOA_DYNAMIC_COLUMN(NSigmaRich, nSigmaRich, //! General f return ka; case 4: return pr; + case 5: + return de; + case 6: + return tr; + case 7: + return he3; + case 8: + return al; default: LOG(fatal) << "Unrecognized PDG code for RICH"; return 999.f; @@ -62,6 +78,10 @@ DECLARE_SOA_COLUMN(HasSigMu, hasSigMu, bool); //! Has nSigma muon BarrelRi DECLARE_SOA_COLUMN(HasSigPi, hasSigPi, bool); //! Has nSigma pion BarrelRich (is pion over threshold) DECLARE_SOA_COLUMN(HasSigKa, hasSigKa, bool); //! Has nSigma kaon BarrelRich (is kaon over threshold) DECLARE_SOA_COLUMN(HasSigPr, hasSigPr, bool); //! Has nSigma proton BarrelRich (is proton over threshold) +DECLARE_SOA_COLUMN(HasSigDe, hasSigDe, bool); //! Has nSigma deuteron BarrelRich (is deuteron over threshold) +DECLARE_SOA_COLUMN(HasSigTr, hasSigTr, bool); //! Has nSigma triton BarrelRich (is triton over threshold) +DECLARE_SOA_COLUMN(HasSigHe3, hasSigHe3, bool); //! Has nSigma helium3 BarrelRich (is helium3 over threshold) +DECLARE_SOA_COLUMN(HasSigAl, hasSigAl, bool); //! Has nSigma alpha BarrelRich (is alpha over threshold) } // namespace upgrade_rich DECLARE_SOA_TABLE(UpgradeRichs, "AOD", "UPGRADERICH", @@ -70,11 +90,19 @@ DECLARE_SOA_TABLE(UpgradeRichs, "AOD", "UPGRADERICH", upgrade_rich::NSigmaPionRich, upgrade_rich::NSigmaKaonRich, upgrade_rich::NSigmaProtonRich, + upgrade_rich::NSigmaDeuteronRich, + upgrade_rich::NSigmaTritonRich, + upgrade_rich::NSigmaHelium3Rich, + upgrade_rich::NSigmaAlphaRich, upgrade_rich::NSigmaRich); + upgrade_rich::NSigmaProtonRich, + upgrade_rich::NSigmaDeuteronRich, + upgrade_rich::NSigmaTritonRich, + upgrade_rich::NSigmaHelium3Rich, + upgrade_rich::NSigmaAlphaRich>); using UpgradeRich = UpgradeRichs::iterator; @@ -85,6 +113,10 @@ DECLARE_SOA_TABLE(UpgradeRichSignals, "AOD", "UPGRADERICHSIG", upgrade_rich::HasSigPi, upgrade_rich::HasSigKa, upgrade_rich::HasSigPr, + upgrade_rich::HasSigDe, + upgrade_rich::HasSigTr, + upgrade_rich::HasSigHe3, + upgrade_rich::HasSigAl, upgrade_rich::HasSigInGas); using UpgradeRichSignal = UpgradeRichSignals::iterator; diff --git a/ALICE3/DataModel/OTFTOF.h b/ALICE3/DataModel/OTFTOF.h index f6f7c39234b..150efc91f5e 100644 --- a/ALICE3/DataModel/OTFTOF.h +++ b/ALICE3/DataModel/OTFTOF.h @@ -39,34 +39,54 @@ DECLARE_SOA_COLUMN(NSigmaMuonInnerTOF, nSigmaMuonInnerTOF, float); //! DECLARE_SOA_COLUMN(NSigmaPionInnerTOF, nSigmaPionInnerTOF, float); //! NSigma pion InnerTOF DECLARE_SOA_COLUMN(NSigmaKaonInnerTOF, nSigmaKaonInnerTOF, float); //! NSigma kaon InnerTOF DECLARE_SOA_COLUMN(NSigmaProtonInnerTOF, nSigmaProtonInnerTOF, float); //! NSigma proton InnerTOF +DECLARE_SOA_COLUMN(NSigmaDeuteronInnerTOF, nSigmaDeuteronInnerTOF, float); //! NSigma deuteron InnerTOF +DECLARE_SOA_COLUMN(NSigmaTritonInnerTOF, nSigmaTritonInnerTOF, float); //! NSigma triton InnerTOF +DECLARE_SOA_COLUMN(NSigmaHelium3InnerTOF, nSigmaHelium3InnerTOF, float); //! NSigma helium3 InnerTOF +DECLARE_SOA_COLUMN(NSigmaAlphaInnerTOF, nSigmaAlphaInnerTOF, float); //! NSigma alpha InnerTOF DECLARE_SOA_COLUMN(InnerTOFTrackTimeReco, innerTOFTrackTimeReco, float); //! Track time measured at the InnerTOF DECLARE_SOA_COLUMN(InnerTOFTrackLengthReco, innerTOFTrackLengthReco, float); //! track length for calculation of InnerTOF (reconstructed) -DECLARE_SOA_COLUMN(InnerTOFExpectedTimeEl, innerTOFExpectedTimeEl, float); //! Reconstructed expected time at the InnerTOF for the Electron mass hypotheses -DECLARE_SOA_COLUMN(InnerTOFExpectedTimeMu, innerTOFExpectedTimeMu, float); //! Reconstructed expected time at the InnerTOF for the Muon mass hypotheses -DECLARE_SOA_COLUMN(InnerTOFExpectedTimePi, innerTOFExpectedTimePi, float); //! Reconstructed expected time at the InnerTOF for the Pion mass hypotheses -DECLARE_SOA_COLUMN(InnerTOFExpectedTimeKa, innerTOFExpectedTimeKa, float); //! Reconstructed expected time at the InnerTOF for the Kaon mass hypotheses -DECLARE_SOA_COLUMN(InnerTOFExpectedTimePr, innerTOFExpectedTimePr, float); //! Reconstructed expected time at the InnerTOF for the Proton mass hypotheses +DECLARE_SOA_COLUMN(InnerTOFExpectedTimeEl, innerTOFExpectedTimeEl, float); //! Reconstructed expected time at the InnerTOF for the Electron mass hypotheses +DECLARE_SOA_COLUMN(InnerTOFExpectedTimeMu, innerTOFExpectedTimeMu, float); //! Reconstructed expected time at the InnerTOF for the Muon mass hypotheses +DECLARE_SOA_COLUMN(InnerTOFExpectedTimePi, innerTOFExpectedTimePi, float); //! Reconstructed expected time at the InnerTOF for the Pion mass hypotheses +DECLARE_SOA_COLUMN(InnerTOFExpectedTimeKa, innerTOFExpectedTimeKa, float); //! Reconstructed expected time at the InnerTOF for the Kaon mass hypotheses +DECLARE_SOA_COLUMN(InnerTOFExpectedTimePr, innerTOFExpectedTimePr, float); //! Reconstructed expected time at the InnerTOF for the Proton mass hypotheses +DECLARE_SOA_COLUMN(InnerTOFExpectedTimeDe, innerTOFExpectedTimeDe, float); //! Reconstructed expected time at the InnerTOF for the Deuteron mass hypotheses +DECLARE_SOA_COLUMN(InnerTOFExpectedTimeTr, innerTOFExpectedTimeTr, float); //! Reconstructed expected time at the InnerTOF for the Triton mass hypotheses +DECLARE_SOA_COLUMN(InnerTOFExpectedTimeHe3, innerTOFExpectedTimeHe3, float); //! Reconstructed expected time at the InnerTOF for the Helium3 mass hypotheses +DECLARE_SOA_COLUMN(InnerTOFExpectedTimeAl, innerTOFExpectedTimeAl, float); //! Reconstructed expected time at the InnerTOF for the Alpha mass hypotheses DECLARE_SOA_COLUMN(NSigmaElectronOuterTOF, nSigmaElectronOuterTOF, float); //! NSigma electron OuterTOF DECLARE_SOA_COLUMN(NSigmaMuonOuterTOF, nSigmaMuonOuterTOF, float); //! NSigma muon OuterTOF DECLARE_SOA_COLUMN(NSigmaPionOuterTOF, nSigmaPionOuterTOF, float); //! NSigma pion OuterTOF DECLARE_SOA_COLUMN(NSigmaKaonOuterTOF, nSigmaKaonOuterTOF, float); //! NSigma kaon OuterTOF DECLARE_SOA_COLUMN(NSigmaProtonOuterTOF, nSigmaProtonOuterTOF, float); //! NSigma proton OuterTOF +DECLARE_SOA_COLUMN(NSigmaDeuteronOuterTOF, nSigmaDeuteronOuterTOF, float); //! NSigma deuteron OuterTOF +DECLARE_SOA_COLUMN(NSigmaTritonOuterTOF, nSigmaTritonOuterTOF, float); //! NSigma triton OuterTOF +DECLARE_SOA_COLUMN(NSigmaHelium3OuterTOF, nSigmaHelium3OuterTOF, float); //! NSigma helium3 OuterTOF +DECLARE_SOA_COLUMN(NSigmaAlphaOuterTOF, nSigmaAlphaOuterTOF, float); //! NSigma alpha OuterTOF DECLARE_SOA_COLUMN(OuterTOFTrackTimeReco, outerTOFTrackTimeReco, float); //! Track time measured at the OuterTOF DECLARE_SOA_COLUMN(OuterTOFTrackLengthReco, outerTOFTrackLengthReco, float); //! track length for calculation of OuterTOF (reconstructed) -DECLARE_SOA_COLUMN(OuterTOFExpectedTimeEl, outerTOFExpectedTimeEl, float); //! Reconstructed expected time at the OuterTOF for the Electron mass hypotheses -DECLARE_SOA_COLUMN(OuterTOFExpectedTimeMu, outerTOFExpectedTimeMu, float); //! Reconstructed expected time at the OuterTOF for the Muon mass hypotheses -DECLARE_SOA_COLUMN(OuterTOFExpectedTimePi, outerTOFExpectedTimePi, float); //! Reconstructed expected time at the OuterTOF for the Pion mass hypotheses -DECLARE_SOA_COLUMN(OuterTOFExpectedTimeKa, outerTOFExpectedTimeKa, float); //! Reconstructed expected time at the OuterTOF for the Kaon mass hypotheses -DECLARE_SOA_COLUMN(OuterTOFExpectedTimePr, outerTOFExpectedTimePr, float); //! Reconstructed expected time at the OuterTOF for the Proton mass hypotheses -DECLARE_SOA_DYNAMIC_COLUMN(NSigmaInnerTOF, nSigmaInnerTOF, //! General function to get the nSigma for the InnerTOF +DECLARE_SOA_COLUMN(OuterTOFExpectedTimeEl, outerTOFExpectedTimeEl, float); //! Reconstructed expected time at the OuterTOF for the Electron mass hypotheses +DECLARE_SOA_COLUMN(OuterTOFExpectedTimeMu, outerTOFExpectedTimeMu, float); //! Reconstructed expected time at the OuterTOF for the Muon mass hypotheses +DECLARE_SOA_COLUMN(OuterTOFExpectedTimePi, outerTOFExpectedTimePi, float); //! Reconstructed expected time at the OuterTOF for the Pion mass hypotheses +DECLARE_SOA_COLUMN(OuterTOFExpectedTimeKa, outerTOFExpectedTimeKa, float); //! Reconstructed expected time at the OuterTOF for the Kaon mass hypotheses +DECLARE_SOA_COLUMN(OuterTOFExpectedTimePr, outerTOFExpectedTimePr, float); //! Reconstructed expected time at the OuterTOF for the Proton mass hypotheses +DECLARE_SOA_COLUMN(OuterTOFExpectedTimeDe, outerTOFExpectedTimeDe, float); //! Reconstructed expected time at the OuterTOF for the Deuteron mass hypotheses +DECLARE_SOA_COLUMN(OuterTOFExpectedTimeTr, outerTOFExpectedTimeTr, float); //! Reconstructed expected time at the OuterTOF for the Triton mass hypotheses +DECLARE_SOA_COLUMN(OuterTOFExpectedTimeHe3, outerTOFExpectedTimeHe3, float); //! Reconstructed expected time at the OuterTOF for the Helium3 mass hypotheses +DECLARE_SOA_COLUMN(OuterTOFExpectedTimeAl, outerTOFExpectedTimeAl, float); //! Reconstructed expected time at the OuterTOF for the Alpha mass hypotheses +DECLARE_SOA_DYNAMIC_COLUMN(NSigmaInnerTOF, nSigmaInnerTOF, //! General function to get the nSigma for the InnerTOF [](const float el, const float mu, const float pi, const float ka, const float pr, + const float de, + const float tr, + const float he3, + const float al, const int id) -> float { switch (std::abs(id)) { case 0: @@ -79,6 +99,14 @@ DECLARE_SOA_DYNAMIC_COLUMN(NSigmaInnerTOF, nSigmaInnerTOF, //! G return ka; case 4: return pr; + case 5: + return de; + case 6: + return tr; + case 7: + return he3; + case 8: + return al; default: LOG(fatal) << "Unrecognized PDG code for InnerTOF"; return 999.f; @@ -90,6 +118,10 @@ DECLARE_SOA_DYNAMIC_COLUMN(NSigmaOuterTOF, nSigmaOuterTOF, //! General function const float pi, const float ka, const float pr, + const float de, + const float tr, + const float he3, + const float al, const int id) -> float { switch (std::abs(id)) { case 0: @@ -102,6 +134,14 @@ DECLARE_SOA_DYNAMIC_COLUMN(NSigmaOuterTOF, nSigmaOuterTOF, //! General function return ka; case 4: return pr; + case 5: + return de; + case 6: + return tr; + case 7: + return he3; + case 8: + return al; default: LOG(fatal) << "Unrecognized PDG code for InnerTOF"; return 999.f; @@ -124,6 +164,10 @@ DECLARE_SOA_TABLE(UpgradeTofs, "AOD", "UPGRADETOF", upgrade_tof::NSigmaPionInnerTOF, upgrade_tof::NSigmaKaonInnerTOF, upgrade_tof::NSigmaProtonInnerTOF, + upgrade_tof::NSigmaDeuteronInnerTOF, + upgrade_tof::NSigmaTritonInnerTOF, + upgrade_tof::NSigmaHelium3InnerTOF, + upgrade_tof::NSigmaAlphaInnerTOF, upgrade_tof::InnerTOFTrackTimeReco, upgrade_tof::InnerTOFTrackLengthReco, upgrade_tof::NSigmaElectronOuterTOF, @@ -131,18 +175,30 @@ DECLARE_SOA_TABLE(UpgradeTofs, "AOD", "UPGRADETOF", upgrade_tof::NSigmaPionOuterTOF, upgrade_tof::NSigmaKaonOuterTOF, upgrade_tof::NSigmaProtonOuterTOF, + upgrade_tof::NSigmaDeuteronOuterTOF, + upgrade_tof::NSigmaTritonOuterTOF, + upgrade_tof::NSigmaHelium3OuterTOF, + upgrade_tof::NSigmaAlphaOuterTOF, upgrade_tof::OuterTOFTrackTimeReco, upgrade_tof::OuterTOFTrackLengthReco, upgrade_tof::NSigmaInnerTOF, + upgrade_tof::NSigmaProtonInnerTOF, + upgrade_tof::NSigmaDeuteronInnerTOF, + upgrade_tof::NSigmaTritonInnerTOF, + upgrade_tof::NSigmaHelium3InnerTOF, + upgrade_tof::NSigmaAlphaInnerTOF>, upgrade_tof::NSigmaOuterTOF); + upgrade_tof::NSigmaProtonOuterTOF, + upgrade_tof::NSigmaDeuteronOuterTOF, + upgrade_tof::NSigmaTritonOuterTOF, + upgrade_tof::NSigmaHelium3OuterTOF, + upgrade_tof::NSigmaAlphaOuterTOF>); DECLARE_SOA_TABLE(UpgradeTofExpectedTimes, "AOD", "UPGRADETOFEXPT", upgrade_tof::InnerTOFExpectedTimeEl, @@ -150,11 +206,19 @@ DECLARE_SOA_TABLE(UpgradeTofExpectedTimes, "AOD", "UPGRADETOFEXPT", upgrade_tof::InnerTOFExpectedTimePi, upgrade_tof::InnerTOFExpectedTimeKa, upgrade_tof::InnerTOFExpectedTimePr, + upgrade_tof::InnerTOFExpectedTimeDe, + upgrade_tof::InnerTOFExpectedTimeTr, + upgrade_tof::InnerTOFExpectedTimeHe3, + upgrade_tof::InnerTOFExpectedTimeAl, upgrade_tof::OuterTOFExpectedTimeEl, upgrade_tof::OuterTOFExpectedTimeMu, upgrade_tof::OuterTOFExpectedTimePi, upgrade_tof::OuterTOFExpectedTimeKa, - upgrade_tof::OuterTOFExpectedTimePr); + upgrade_tof::OuterTOFExpectedTimePr, + upgrade_tof::OuterTOFExpectedTimeDe, + upgrade_tof::OuterTOFExpectedTimeTr, + upgrade_tof::OuterTOFExpectedTimeHe3, + upgrade_tof::OuterTOFExpectedTimeAl); using UpgradeTofMC = UpgradeTofMCs::iterator; using UpgradeTof = UpgradeTofs::iterator; diff --git a/ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx b/ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx index 454a5ae61f6..ad7dccc6748 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx @@ -319,6 +319,7 @@ struct OnTheFlyRichPid { loadLUT(1000010020, "lutDe"); loadLUT(1000010030, "lutTr"); loadLUT(1000020030, "lutHe3"); + loadLUT(1000020040, "lutAl"); } if (doQAplots) { @@ -333,9 +334,9 @@ struct OnTheFlyRichPid { histos.add("h2dAngularResolutionVsEtaBarrelRICH", "h2dAngularResolutionVsEtaBarrelRICH", kTH2F, {axisEta, axisRingAngularResolution}); histos.add("hSectorID", "hSectorID", kTH1F, {axisSector}); - const int kNspec = 5; // electron, muon, pion, kaon, proton - std::string particleNames1[kNspec] = {"#it{e}", "#it{#mu}", "#it{#pi}", "#it{K}", "#it{p}"}; - std::string particleNames2[kNspec] = {"Elec", "Muon", "Pion", "Kaon", "Prot"}; + const int kNspec = 9; // electron, muon, pion, kaon, proton, deuteron, triton, helium3, alpha + std::string particleNames1[kNspec] = {"#it{e}", "#it{#mu}", "#it{#pi}", "#it{K}", "#it{p}", "#it{d}", "#it{t}", "^{3}He", "#it{#alpha}"}; + std::string particleNames2[kNspec] = {"Elec", "Muon", "Pion", "Kaon", "Prot", "Deut", "Trit", "He3", "Al"}; for (int iTrue = 0; iTrue < kNspec; iTrue++) { std::string nameTitleBarrelTrackRes = "h2dBarrelAngularResTrack" + particleNames2[iTrue] + "VsP"; std::string nameTitleBarrelTotalRes = "h2dBarrelAngularResTotal" + particleNames2[iTrue] + "VsP"; @@ -735,8 +736,8 @@ struct OnTheFlyRichPid { for (const auto& track : tracks) { auto fillDummyValues = [&](bool gasRich = false) { - upgradeRich(kErrorValue, kErrorValue, kErrorValue, kErrorValue, kErrorValue); - upgradeRichSignal(false, false, false, false, false, false, gasRich); + upgradeRich(kErrorValue, kErrorValue, kErrorValue, kErrorValue, kErrorValue, kErrorValue, kErrorValue, kErrorValue, kErrorValue); + upgradeRichSignal(false, false, false, false, false, false, false, false, false, false, gasRich); }; // first step: find precise arrival time (if any) @@ -798,21 +799,29 @@ struct OnTheFlyRichPid { } // Straight to Nsigma - static constexpr int kNspecies = 5; + static constexpr int kNspecies = 9; static constexpr int kEl = 0; static constexpr int kMu = 1; static constexpr int kPi = 2; static constexpr int kKa = 3; static constexpr int kPr = 4; - float nSigmaBarrelRich[kNspecies] = {kErrorValue, kErrorValue, kErrorValue, kErrorValue, kErrorValue}; - bool signalBarrelRich[kNspecies] = {false, false, false, false, false}; + static constexpr int kDe = 5; + static constexpr int kTr = 6; + static constexpr int kHe3 = 7; + static constexpr int kAl = 8; + float nSigmaBarrelRich[kNspecies] = {kErrorValue, kErrorValue, kErrorValue, kErrorValue, kErrorValue, kErrorValue, kErrorValue, kErrorValue, kErrorValue}; + bool signalBarrelRich[kNspecies] = {false, false, false, false, false, false, false, false, false}; float deltaThetaBarrelRich[kNspecies]; //, nSigmaBarrelRich[kNspecies]; - static constexpr int kPdgArray[kNspecies] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton}; + static constexpr int kPdgArray[kNspecies] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton, o2::constants::physics::kDeuteron, o2::constants::physics::kTriton, o2::constants::physics::kHelium3, o2::constants::physics::kAlpha}; static constexpr float kMasses[kNspecies] = {o2::track::pid_constants::sMasses[o2::track::PID::Electron], o2::track::pid_constants::sMasses[o2::track::PID::Muon], o2::track::pid_constants::sMasses[o2::track::PID::Pion], o2::track::pid_constants::sMasses[o2::track::PID::Kaon], - o2::track::pid_constants::sMasses[o2::track::PID::Proton]}; + o2::track::pid_constants::sMasses[o2::track::PID::Proton], + o2::track::pid_constants::sMasses[o2::track::PID::Deuteron], + o2::track::pid_constants::sMasses[o2::track::PID::Triton], + o2::track::pid_constants::sMasses[o2::track::PID::Helium3], + o2::track::pid_constants::sMasses[o2::track::PID::Alpha]}; for (int ii = 0; ii < kNspecies; ii++) { // Loop on the particle hypotheses @@ -874,6 +883,34 @@ struct OnTheFlyRichPid { histos.fill(HIST("h2dBarrelAngularResTotalProtVsP"), recoTrack.getP(), 1000.0 * barrelTotalAngularReso); } break; + case kPdgArray[kDe]: // Deuteron + case -kPdgArray[kDe]: // AntiDeuteron + if (ii == kDe) { + histos.fill(HIST("h2dBarrelAngularResTrackDeutVsP"), recoTrack.getP(), 1000.0 * barrelTrackAngularReso); + histos.fill(HIST("h2dBarrelAngularResTotalDeutVsP"), recoTrack.getP(), 1000.0 * barrelTotalAngularReso); + } + break; + case kPdgArray[kTr]: // Triton + case -kPdgArray[kTr]: // AntiTriton + if (ii == kTr) { + histos.fill(HIST("h2dBarrelAngularResTrackTritVsP"), recoTrack.getP(), 1000.0 * barrelTrackAngularReso); + histos.fill(HIST("h2dBarrelAngularResTotalTritVsP"), recoTrack.getP(), 1000.0 * barrelTotalAngularReso); + } + break; + case kPdgArray[kHe3]: // Helium3 + case -kPdgArray[kHe3]: // AntiHelium3 + if (ii == kHe3) { + histos.fill(HIST("h2dBarrelAngularResTrackHe3VsP"), recoTrack.getP(), 1000.0 * barrelTrackAngularReso); + histos.fill(HIST("h2dBarrelAngularResTotalHe3VsP"), recoTrack.getP(), 1000.0 * barrelTotalAngularReso); + } + break; + case kPdgArray[kAl]: // Alpha + case -kPdgArray[kAl]: // AntiAlpha + if (ii == kAl) { + histos.fill(HIST("h2dBarrelAngularResTrackAlVsP"), recoTrack.getP(), 1000.0 * barrelTrackAngularReso); + histos.fill(HIST("h2dBarrelAngularResTotalAlVsP"), recoTrack.getP(), 1000.0 * barrelTotalAngularReso); + } + break; default: break; } @@ -943,6 +980,37 @@ struct OnTheFlyRichPid { histos.fill(HIST("h2dBarrelNsigmaTrueProtVsPionHypothesis"), recoTrack.getP(), nSigmaBarrelRich[2]); histos.fill(HIST("h2dBarrelNsigmaTrueProtVsKaonHypothesis"), recoTrack.getP(), nSigmaBarrelRich[3]); histos.fill(HIST("h2dBarrelNsigmaTrueProtVsProtHypothesis"), recoTrack.getP(), nSigmaBarrelRich[4]); + histos.fill(HIST("h2dBarrelNsigmaTrueProtVsDeutHypothesis"), recoTrack.getP(), nSigmaBarrelRich[5]); + break; + case kPdgArray[kDe]: // Deuteron + case -kPdgArray[kDe]: // AntiDeuteron + histos.fill(HIST("h2dBarrelNsigmaTrueDeutVsProtHypothesis"), recoTrack.getP(), nSigmaBarrelRich[4]); + histos.fill(HIST("h2dBarrelNsigmaTrueDeutVsDeutHypothesis"), recoTrack.getP(), nSigmaBarrelRich[5]); + histos.fill(HIST("h2dBarrelNsigmaTrueDeutVsTritHypothesis"), recoTrack.getP(), nSigmaBarrelRich[6]); + histos.fill(HIST("h2dBarrelNsigmaTrueDeutVsHe3Hypothesis"), recoTrack.getP(), nSigmaBarrelRich[7]); + histos.fill(HIST("h2dBarrelNsigmaTrueDeutVsAlHypothesis"), recoTrack.getP(), nSigmaBarrelRich[8]); + break; + case kPdgArray[kTr]: // Triton + case -kPdgArray[kTr]: // AntiTriton + histos.fill(HIST("h2dBarrelNsigmaTrueTritVsProtHypothesis"), recoTrack.getP(), nSigmaBarrelRich[4]); + histos.fill(HIST("h2dBarrelNsigmaTrueTritVsDeutHypothesis"), recoTrack.getP(), nSigmaBarrelRich[5]); + histos.fill(HIST("h2dBarrelNsigmaTrueTritVsTritHypothesis"), recoTrack.getP(), nSigmaBarrelRich[6]); + histos.fill(HIST("h2dBarrelNsigmaTrueTritVsHe3Hypothesis"), recoTrack.getP(), nSigmaBarrelRich[7]); + histos.fill(HIST("h2dBarrelNsigmaTrueTritVsAlHypothesis"), recoTrack.getP(), nSigmaBarrelRich[8]); + break; + case kPdgArray[kHe3]: // Helium3 + case -kPdgArray[kHe3]: // AntiHelium3 + histos.fill(HIST("h2dBarrelNsigmaTrueHe3VsDeutHypothesis"), recoTrack.getP(), nSigmaBarrelRich[5]); + histos.fill(HIST("h2dBarrelNsigmaTrueHe3VsTritHypothesis"), recoTrack.getP(), nSigmaBarrelRich[6]); + histos.fill(HIST("h2dBarrelNsigmaTrueHe3VsHe3Hypothesis"), recoTrack.getP(), nSigmaBarrelRich[7]); + histos.fill(HIST("h2dBarrelNsigmaTrueHe3VsAlHypothesis"), recoTrack.getP(), nSigmaBarrelRich[8]); + break; + case kPdgArray[kAl]: // Alpha + case -kPdgArray[kAl]: // AntiAlpha + histos.fill(HIST("h2dBarrelNsigmaTrueAlVsDeutHypothesis"), recoTrack.getP(), nSigmaBarrelRich[5]); + histos.fill(HIST("h2dBarrelNsigmaTrueAlVsTritHypothesis"), recoTrack.getP(), nSigmaBarrelRich[6]); + histos.fill(HIST("h2dBarrelNsigmaTrueAlVsHe3Hypothesis"), recoTrack.getP(), nSigmaBarrelRich[7]); + histos.fill(HIST("h2dBarrelNsigmaTrueAlVsAlHypothesis"), recoTrack.getP(), nSigmaBarrelRich[8]); break; default: break; @@ -951,8 +1019,8 @@ struct OnTheFlyRichPid { } // Sigmas have been fully calculated. Please populate the NSigma helper table (once per track) - upgradeRich(nSigmaBarrelRich[0], nSigmaBarrelRich[1], nSigmaBarrelRich[2], nSigmaBarrelRich[3], nSigmaBarrelRich[4]); - upgradeRichSignal(expectedAngleBarrelRichOk, signalBarrelRich[0], signalBarrelRich[1], signalBarrelRich[2], signalBarrelRich[3], signalBarrelRich[4], expectedAngleBarrelGasRichOk); + upgradeRich(nSigmaBarrelRich[0], nSigmaBarrelRich[1], nSigmaBarrelRich[2], nSigmaBarrelRich[3], nSigmaBarrelRich[4], nSigmaBarrelRich[5], nSigmaBarrelRich[6], nSigmaBarrelRich[7], nSigmaBarrelRich[8]); + upgradeRichSignal(expectedAngleBarrelRichOk, signalBarrelRich[0], signalBarrelRich[1], signalBarrelRich[2], signalBarrelRich[3], signalBarrelRich[4], signalBarrelRich[5], signalBarrelRich[6], signalBarrelRich[7], signalBarrelRich[8], expectedAngleBarrelGasRichOk); } } }; diff --git a/ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx b/ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx index 77a6edafb20..f1755937566 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx @@ -65,14 +65,14 @@ using namespace o2; using namespace o2::framework; -std::array, 5> h2dInnerTimeResTrack; -std::array, 5> h2dInnerTimeResTotal; -std::array, 5> h2dOuterTimeResTrack; -std::array, 5> h2dOuterTimeResTotal; -std::array, 5>, 5> h2dInnerNsigmaTrue; -std::array, 5>, 5> h2dOuterNsigmaTrue; -std::array, 5>, 5> h2dInnerDeltaTrue; -std::array, 5>, 5> h2dOuterDeltaTrue; +std::array, 9> h2dInnerTimeResTrack; +std::array, 9> h2dInnerTimeResTotal; +std::array, 9> h2dOuterTimeResTrack; +std::array, 9> h2dOuterTimeResTotal; +std::array, 9>, 9> h2dInnerNsigmaTrue; +std::array, 9>, 9> h2dOuterNsigmaTrue; +std::array, 9>, 9> h2dInnerDeltaTrue; +std::array, 9>, 9> h2dOuterDeltaTrue; struct OnTheFlyTofPid { Produces upgradeTofMC; @@ -135,7 +135,7 @@ struct OnTheFlyTofPid { // for handling basic QA histograms if requested HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; OutputObj listEfficiency{"efficiency"}; - static constexpr int kParticles = 5; + static constexpr int kParticles = 9; void init(o2::framework::InitContext& initContext) { @@ -169,6 +169,7 @@ struct OnTheFlyTofPid { loadLUT(1000010020, "lutDe"); loadLUT(1000010030, "lutTr"); loadLUT(1000020030, "lutHe3"); + loadLUT(1000020040, "lutAl"); } if (plotsConfig.doQAplots) { @@ -184,17 +185,20 @@ struct OnTheFlyTofPid { listEfficiency->Add(new TEfficiency("effEventTime", "effEventTime", plotsConfig.nBinsMult, 0.0f, plotsConfig.maxMultRange)); const AxisSpec axisMomentum{static_cast(plotsConfig.nBinsP), 0.0f, +10.0f, "#it{p} (GeV/#it{c})"}; + const AxisSpec axisRigidity{static_cast(plotsConfig.nBinsP), 0.0f, +10.0f, "#it{p} / |#it{z}| (GeV/#it{c})"}; const AxisSpec axisMomentumSmall{static_cast(plotsConfig.nBinsP), 0.0f, +1.0f, "#it{p} (GeV/#it{c})"}; const AxisSpec axisVelocity{static_cast(plotsConfig.nBinsBeta), 0.0f, +1.1f, "Measured #beta"}; const AxisSpec axisTrackLengthInner{static_cast(plotsConfig.nBinsTrackLengthInner), 0.0f, 60.0f, "Track length (cm)"}; const AxisSpec axisTrackLengthOuter{static_cast(plotsConfig.nBinsTrackLengthOuter), 0.0f, 300.0f, "Track length (cm)"}; const AxisSpec axisTrackDeltaLength{static_cast(plotsConfig.nBinsTrackDeltaLength), 0.0f, 30.0f, "Delta Track length (cm)"}; histos.add("iTOF/h2dVelocityVsMomentumInner", "h2dVelocityVsMomentumInner", kTH2F, {axisMomentum, axisVelocity}); + histos.add("iTOF/h2dVelocityVsRigidityInner", "h2dVelocityVsRigidityInner", kTH2F, {axisRigidity, axisVelocity}); histos.add("iTOF/h2dTrackLengthInnerVsPt", "h2dTrackLengthInnerVsPt", kTH2F, {axisMomentumSmall, axisTrackLengthInner}); histos.add("iTOF/h2dTrackLengthInnerRecoVsPt", "h2dTrackLengthInnerRecoVsPt", kTH2F, {axisMomentumSmall, axisTrackLengthInner}); histos.add("iTOF/h2dDeltaTrackLengthInnerVsPt", "h2dDeltaTrackLengthInnerVsPt", kTH2F, {axisMomentumSmall, axisTrackDeltaLength}); histos.add("oTOF/h2dVelocityVsMomentumOuter", "h2dVelocityVsMomentumOuter", kTH2F, {axisMomentum, axisVelocity}); + histos.add("oTOF/h2dVelocityVsRigidityOuter", "h2dVelocityVsRigidityOuter", kTH2F, {axisRigidity, axisVelocity}); histos.add("oTOF/h2dTrackLengthOuterVsPt", "h2dTrackLengthOuterVsPt", kTH2F, {axisMomentumSmall, axisTrackLengthOuter}); histos.add("oTOF/h2dTrackLengthOuterRecoVsPt", "h2dTrackLengthOuterRecoVsPt", kTH2F, {axisMomentumSmall, axisTrackLengthOuter}); histos.add("oTOF/h2dDeltaTrackLengthOuterVsPt", "h2dDeltaTrackLengthOuterVsPt", kTH2F, {axisMomentumSmall, axisTrackDeltaLength}); @@ -206,8 +210,8 @@ struct OnTheFlyTofPid { histos.add("h2dRelativePtResolution", "h2dRelativePtResolution", kTH2F, {axisPt, axisRelativePt}); histos.add("h2dRelativeEtaResolution", "h2dRelativeEtaResolution", kTH2F, {axisEta, axisRelativeEta}); - std::string particleNames[kParticles] = {"#it{e}", "#it{#mu}", "#it{#pi}", "#it{K}", "#it{p}"}; - std::string particleNames2[kParticles] = {"Elec", "Muon", "Pion", "Kaon", "Prot"}; + std::string particleNames[kParticles] = {"#it{e}", "#it{#mu}", "#it{#pi}", "#it{K}", "#it{p}", "#it{d}", "#it{t}", "^{3}He", "#it{#alpha}"}; + std::string particleNames2[kParticles] = {"Elec", "Muon", "Pion", "Kaon", "Prot", "Deut", "Trit", "He3", "Al"}; for (int iTrue = 0; iTrue < kParticles; iTrue++) { auto addHistogram = [&](const std::string& name, const AxisSpec& axis) { return histos.add(name, "", kTH2F, {axisMomentum, axis}); @@ -579,8 +583,20 @@ struct OnTheFlyTofPid { static std::array expectedTimeInnerTOF, expectedTimeOuterTOF; static std::array deltaTimeInnerTOF, deltaTimeOuterTOF; static std::array nSigmaInnerTOF, nSigmaOuterTOF; - static constexpr int kParticlePdgs[kParticles] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton}; + static constexpr int kParticlePdgs[kParticles] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton, o2::constants::physics::kDeuteron, o2::constants::physics::kTriton, o2::constants::physics::kHelium3, o2::constants::physics::kAlpha}; float masses[kParticles]; + float momentumHypotheses[kParticles]; // Store momentum hypothesis for each particle + + auto truePdgInfo = pdg->GetParticle(mcParticle.pdgCode()); + float rigidity = momentum; // fallback to momentum if charge unknown + + // Use MC truth charge for rigidity calculation + if (truePdgInfo) { + const float trueCharge = std::abs(truePdgInfo->Charge()) / 3.0f; + if (trueCharge > 0) { + rigidity = momentum / trueCharge; + } + } if (plotsConfig.doQAplots) { // unit conversion: length in cm, time in ps @@ -588,11 +604,13 @@ struct OnTheFlyTofPid { const float outerBeta = (trackLengthOuterTOF / measuredTimeOuterTOF) / o2::constants::physics::LightSpeedCm2PS; if (trackLengthRecoInnerTOF > 0) { histos.fill(HIST("iTOF/h2dVelocityVsMomentumInner"), momentum, innerBeta); + histos.fill(HIST("iTOF/h2dVelocityVsRigidityInner"), rigidity, innerBeta); histos.fill(HIST("iTOF/h2dTrackLengthInnerVsPt"), noSmearingPt, trackLengthInnerTOF); histos.fill(HIST("iTOF/h2dTrackLengthInnerRecoVsPt"), noSmearingPt, trackLengthRecoInnerTOF); } if (trackLengthRecoOuterTOF > 0) { histos.fill(HIST("oTOF/h2dVelocityVsMomentumOuter"), momentum, outerBeta); + histos.fill(HIST("oTOF/h2dVelocityVsRigidityOuter"), rigidity, outerBeta); histos.fill(HIST("oTOF/h2dTrackLengthOuterVsPt"), noSmearingPt, trackLengthOuterTOF); histos.fill(HIST("oTOF/h2dTrackLengthOuterRecoVsPt"), noSmearingPt, trackLengthRecoOuterTOF); } @@ -608,7 +626,8 @@ struct OnTheFlyTofPid { auto pdgInfoThis = pdg->GetParticle(kParticlePdgs[ii]); masses[ii] = pdgInfoThis->Mass(); - const float v = computeParticleVelocity(momentum, masses[ii]); + momentumHypotheses[ii] = rigidity * (std::abs(pdgInfoThis->Charge()) / 3.0f); // Total momentum for this hypothesis + const float v = computeParticleVelocity(momentumHypotheses[ii], masses[ii]); expectedTimeInnerTOF[ii] = trackLengthInnerTOF / v; expectedTimeOuterTOF[ii] = trackLengthOuterTOF / v; @@ -620,27 +639,27 @@ struct OnTheFlyTofPid { float innerTotalTimeReso = simConfig.innerTOFTimeReso; float outerTotalTimeReso = simConfig.outerTOFTimeReso; if (simConfig.flagIncludeTrackTimeRes) { - double ptResolution = std::pow(momentum / std::cosh(pseudorapidity), 2) * std::sqrt(trkWithTime.mMomentum.second); + double ptResolution = std::pow(momentumHypotheses[ii] / std::cosh(pseudorapidity), 2) * std::sqrt(trkWithTime.mMomentum.second); double etaResolution = std::fabs(std::sin(2.0 * std::atan(std::exp(-pseudorapidity)))) * std::sqrt(trkWithTime.mPseudorapidity.second); if (simConfig.flagTOFLoadDelphesLUTs) { - ptResolution = mSmearer.getAbsPtRes(pdgInfoThis->PdgCode(), dNdEta, pseudorapidity, momentum / std::cosh(pseudorapidity)); - etaResolution = mSmearer.getAbsEtaRes(pdgInfoThis->PdgCode(), dNdEta, pseudorapidity, momentum / std::cosh(pseudorapidity)); + ptResolution = mSmearer.getAbsPtRes(pdgInfoThis->PdgCode(), dNdEta, pseudorapidity, momentumHypotheses[ii] / std::cosh(pseudorapidity)); + etaResolution = mSmearer.getAbsEtaRes(pdgInfoThis->PdgCode(), dNdEta, pseudorapidity, momentumHypotheses[ii] / std::cosh(pseudorapidity)); } - float innerTrackTimeReso = calculateTrackTimeResolutionAdvanced(momentum / std::cosh(pseudorapidity), pseudorapidity, ptResolution, etaResolution, masses[ii], simConfig.innerTOFRadius, simConfig.magneticField); - float outerTrackTimeReso = calculateTrackTimeResolutionAdvanced(momentum / std::cosh(pseudorapidity), pseudorapidity, ptResolution, etaResolution, masses[ii], simConfig.outerTOFRadius, simConfig.magneticField); + float innerTrackTimeReso = calculateTrackTimeResolutionAdvanced(momentumHypotheses[ii] / std::cosh(pseudorapidity), pseudorapidity, ptResolution, etaResolution, masses[ii], simConfig.innerTOFRadius, simConfig.magneticField); + float outerTrackTimeReso = calculateTrackTimeResolutionAdvanced(momentumHypotheses[ii] / std::cosh(pseudorapidity), pseudorapidity, ptResolution, etaResolution, masses[ii], simConfig.outerTOFRadius, simConfig.magneticField); innerTotalTimeReso = std::hypot(simConfig.innerTOFTimeReso, innerTrackTimeReso); outerTotalTimeReso = std::hypot(simConfig.outerTOFTimeReso, outerTrackTimeReso); if (plotsConfig.doQAplots) { if (std::fabs(mcParticle.pdgCode()) == pdg->GetParticle(kParticlePdgs[ii])->PdgCode()) { if (trackLengthRecoInnerTOF > 0) { - h2dInnerTimeResTrack[ii]->Fill(momentum, innerTrackTimeReso); - h2dInnerTimeResTotal[ii]->Fill(momentum, innerTotalTimeReso); + h2dInnerTimeResTrack[ii]->Fill(momentumHypotheses[ii], innerTrackTimeReso); + h2dInnerTimeResTotal[ii]->Fill(momentumHypotheses[ii], innerTotalTimeReso); } if (trackLengthRecoOuterTOF > 0) { - const float transverseMomentum = momentum / std::cosh(pseudorapidity); - h2dOuterTimeResTrack[ii]->Fill(momentum, outerTrackTimeReso); - h2dOuterTimeResTotal[ii]->Fill(momentum, outerTotalTimeReso); + const float transverseMomentum = momentumHypotheses[ii] / std::cosh(pseudorapidity); + h2dOuterTimeResTrack[ii]->Fill(momentumHypotheses[ii], outerTrackTimeReso); + h2dOuterTimeResTotal[ii]->Fill(momentumHypotheses[ii], outerTotalTimeReso); static constexpr int kIdPion = 2; if (ii == kIdPion) { histos.fill(HIST("h2dRelativePtResolution"), transverseMomentum, 100.0 * ptResolution / transverseMomentum); @@ -667,14 +686,14 @@ struct OnTheFlyTofPid { } if (trackLengthRecoInnerTOF > 0) { for (int iii = 0; iii < kParticles; iii++) { - h2dInnerNsigmaTrue[ii][iii]->Fill(momentum, nSigmaInnerTOF[iii]); - h2dInnerDeltaTrue[ii][iii]->Fill(momentum, deltaTimeInnerTOF[iii]); + h2dInnerNsigmaTrue[ii][iii]->Fill(momentumHypotheses[ii], nSigmaInnerTOF[iii]); + h2dInnerDeltaTrue[ii][iii]->Fill(momentumHypotheses[ii], deltaTimeInnerTOF[iii]); } } if (trackLengthRecoOuterTOF > 0) { for (int iii = 0; iii < kParticles; iii++) { - h2dOuterNsigmaTrue[ii][iii]->Fill(momentum, nSigmaOuterTOF[iii]); - h2dOuterDeltaTrue[ii][iii]->Fill(momentum, deltaTimeOuterTOF[iii]); + h2dOuterNsigmaTrue[ii][iii]->Fill(momentumHypotheses[ii], nSigmaOuterTOF[iii]); + h2dOuterDeltaTrue[ii][iii]->Fill(momentumHypotheses[ii], deltaTimeOuterTOF[iii]); } } } @@ -691,12 +710,12 @@ struct OnTheFlyTofPid { // Sigmas have been fully calculated. Please populate the NSigma helper table (once per track) upgradeTof(tzero[0], tzero[1], - nSigmaInnerTOF[0], nSigmaInnerTOF[1], nSigmaInnerTOF[2], nSigmaInnerTOF[3], nSigmaInnerTOF[4], + nSigmaInnerTOF[0], nSigmaInnerTOF[1], nSigmaInnerTOF[2], nSigmaInnerTOF[3], nSigmaInnerTOF[4], nSigmaInnerTOF[5], nSigmaInnerTOF[6], nSigmaInnerTOF[7], nSigmaInnerTOF[8], measuredTimeInnerTOF, trackLengthRecoInnerTOF, - nSigmaOuterTOF[0], nSigmaOuterTOF[1], nSigmaOuterTOF[2], nSigmaOuterTOF[3], nSigmaOuterTOF[4], + nSigmaOuterTOF[0], nSigmaOuterTOF[1], nSigmaOuterTOF[2], nSigmaOuterTOF[3], nSigmaOuterTOF[4], nSigmaOuterTOF[5], nSigmaOuterTOF[6], nSigmaOuterTOF[7], nSigmaOuterTOF[8], measuredTimeOuterTOF, trackLengthRecoOuterTOF); - upgradeTofExpectedTime(expectedTimeInnerTOF[0], expectedTimeInnerTOF[1], expectedTimeInnerTOF[2], expectedTimeInnerTOF[3], expectedTimeInnerTOF[4], - expectedTimeOuterTOF[0], expectedTimeOuterTOF[1], expectedTimeOuterTOF[2], expectedTimeOuterTOF[3], expectedTimeOuterTOF[4]); + upgradeTofExpectedTime(expectedTimeInnerTOF[0], expectedTimeInnerTOF[1], expectedTimeInnerTOF[2], expectedTimeInnerTOF[3], expectedTimeInnerTOF[4], expectedTimeInnerTOF[5], expectedTimeInnerTOF[6], expectedTimeInnerTOF[7], expectedTimeInnerTOF[8], + expectedTimeOuterTOF[0], expectedTimeOuterTOF[1], expectedTimeOuterTOF[2], expectedTimeOuterTOF[3], expectedTimeOuterTOF[4], expectedTimeOuterTOF[5], expectedTimeOuterTOF[6], expectedTimeOuterTOF[7], expectedTimeOuterTOF[8]); } if (trackWithTimeIndex != tracks.size()) { diff --git a/ALICE3/TableProducer/OTF/onTheFlyTrackerPid.cxx b/ALICE3/TableProducer/OTF/onTheFlyTrackerPid.cxx index c711af7eae0..0fa228f57f6 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyTrackerPid.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyTrackerPid.cxx @@ -91,20 +91,32 @@ static constexpr size_t kMaxValidHitsForTruncation56 = 3; static constexpr size_t kMaxValidHitsForTruncation34 = 2; static constexpr size_t kMaxValidHitsForTruncation12 = 1; +// Constants for LUT binning +// To do: Include in LUT header or similar +static constexpr int kLUTEtaBins = 50; +static constexpr float kLUTEtaMin = -2.5f; +static constexpr float kLUTEtaMax = 2.5f; +static constexpr int kLUTPtBins = 500; +static constexpr float kLUTPtMin = 0.0f; +static constexpr float kLUTPtMax = 10.0f; + class ToTLUT { public: - ToTLUT(float truncationFractionVal, int maxLayers, int etaBins, float etaMin, float etaMax, int ptBins, float ptMin, float ptMax) - : mTruncationFraction(truncationFractionVal), - mMaxLayers(maxLayers), - mEtaBins(etaBins), - mEtaMin(etaMin), - mEtaMax(etaMax), - mPtBins(ptBins), - mPtMin(ptMin), - mPtMax(ptMax), - mEtaBinWidth((etaMax - etaMin) / etaBins), - mPtBinWidth((ptMax - ptMin) / ptBins) + explicit ToTLUT(int maxLayers, float analysisEtaMinVal = 0.0f, float analysisEtaMaxVal = 1.0f, float analysisPtMinVal = 0.0f, float analysisPtMaxVal = 10.0f) + : mMaxLayers(maxLayers), + mAnalysisEtaMin(analysisEtaMinVal), + mAnalysisEtaMax(analysisEtaMaxVal), + mAnalysisPtMin(analysisPtMinVal), + mAnalysisPtMax(analysisPtMaxVal), + mEtaBins(kLUTEtaBins), + mEtaMin(kLUTEtaMin), + mEtaMax(kLUTEtaMax), + mPtBins(kLUTPtBins), + mPtMin(kLUTPtMin), + mPtMax(kLUTPtMax), + mEtaBinWidth((kLUTEtaMax - kLUTEtaMin) / kLUTEtaBins), + mPtBinWidth((kLUTPtMax - kLUTPtMin) / kLUTPtBins) { mPdgToIndexMap.reserve(10); mIndexToPdgMap.reserve(10); @@ -179,9 +191,21 @@ class ToTLUT for (int etaBin = 0; etaBin < mEtaBins; ++etaBin) { float etaMinBin = mEtaMin + etaBin * mEtaBinWidth; float etaMaxBin = etaMinBin + mEtaBinWidth; + + float etaCenter = (etaMinBin + etaMaxBin) / 2.0f; + if (std::abs(etaCenter) < mAnalysisEtaMin || std::abs(etaCenter) > mAnalysisEtaMax) { + continue; + } + for (int ptBin = 0; ptBin < mPtBins; ++ptBin) { float ptMinBin = mPtMin + ptBin * mPtBinWidth; float ptMaxBin = ptMinBin + mPtBinWidth; + float ptCenter = (ptMinBin + ptMaxBin) / 2.0f; + + if (ptCenter < mAnalysisPtMin || ptCenter >= mAnalysisPtMax) { + continue; + } + TString histName = Form("tot_%d_barrel%d_eta%.2f-%.2f_pt%.2f-%.2f", pdg, layer, etaMinBin, etaMaxBin, ptMinBin, ptMaxBin); TH1F* histFromFile = dynamic_cast(f->Get(histName)); @@ -252,8 +276,11 @@ class ToTLUT std::unordered_map mPdgToIndexMap; std::vector mIndexToPdgMap; - float mTruncationFraction; int mMaxLayers; + float mAnalysisEtaMin; + float mAnalysisEtaMax; + float mAnalysisPtMin; + float mAnalysisPtMax; int mEtaBins; float mEtaMin; float mEtaMax; @@ -380,16 +407,13 @@ struct OnTheFlyTrackerPid { Configurable lutTotHe{"lutTotHe", "ccdb:Users/h/hfribert/ToT_LUTs", "ToT LUT for helium-3"}; Configurable lutTotAl{"lutTotAl", "ccdb:Users/h/hfribert/ToT_LUTs", "ToT LUT for alphas"}; - Configurable truncationFraction{"truncationFraction", 0.80f, "Fraction of lower entries to consider for truncated standard deviation"}; Configurable dBz{"dBz", 20, "magnetic field (kilogauss) for track propagation"}; Configurable maxBarrelLayers{"maxBarrelLayers", 11, "Maximum number of barrel layers"}; - Configurable etaBins{"etaBins", 50, "Number of eta bins for LUTs and histograms"}; - Configurable etaMin{"etaMin", -2.5f, "Minimum eta value"}; - Configurable etaMax{"etaMax", 2.5f, "Maximum eta value"}; - Configurable ptBins{"ptBins", 500, "Number of pT bins for LUTs (LUTs are pT-based)"}; - Configurable ptMin{"ptMin", 0.0f, "Minimum pT value for LUT binning"}; - Configurable ptMax{"ptMax", 10.0f, "Maximum pT value for LUT binning"}; Configurable numLogBins{"numLogBins", 200, "Number of logarithmic momentum bins"}; + Configurable analysisEtaMin{"analysisEtaMin", 0.0f, "Minimum |eta| for LUT loading optimization"}; + Configurable analysisEtaMax{"analysisEtaMax", 1.0f, "Maximum |eta| for LUT loading optimization"}; + Configurable analysisPtMin{"analysisPtMin", 0.0f, "Minimum pT (GeV/c) for LUT loading optimization"}; + Configurable analysisPtMax{"analysisPtMax", 10.0f, "Maximum pT (GeV/c) for LUT loading optimization"}; std::vector mLogBins; @@ -416,9 +440,7 @@ struct OnTheFlyTrackerPid { << "). Please adjust maxBarrelLayers."; } - mToTLUT = std::make_unique(truncationFraction.value, maxBarrelLayers.value, - etaBins.value, etaMin.value, etaMax.value, - ptBins.value, ptMin.value, ptMax.value); + mToTLUT = std::make_unique(maxBarrelLayers.value, analysisEtaMin.value, analysisEtaMax.value, analysisPtMin.value, analysisPtMax.value); mToTLUT->setCcdbManager(ccdb.operator->()); @@ -526,7 +548,6 @@ struct OnTheFlyTrackerPid { aod::McParticles const& /*mcParticles*/, aod::McCollisions const& /*mcCollisions*/) { - o2::dataformats::VertexBase mcPvVtx({0.0f, 0.0f, 0.0f}, {0.}); if (collision.has_mcCollision()) { diff --git a/ALICE3/Tasks/CMakeLists.txt b/ALICE3/Tasks/CMakeLists.txt index 06864096cf5..42fb53a0a25 100644 --- a/ALICE3/Tasks/CMakeLists.txt +++ b/ALICE3/Tasks/CMakeLists.txt @@ -74,4 +74,7 @@ o2physics_add_dpl_workflow(alice3-tracking-performance PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) - +o2physics_add_dpl_workflow(alice3-pid-evaluation + SOURCES alice3PidEvaluation.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/ALICE3/Tasks/alice3PidEvaluation.cxx b/ALICE3/Tasks/alice3PidEvaluation.cxx new file mode 100644 index 00000000000..2ee64ea7623 --- /dev/null +++ b/ALICE3/Tasks/alice3PidEvaluation.cxx @@ -0,0 +1,371 @@ +// 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 alice3PidEvaluation.cxx +/// +/// \brief This task computes purity and efficiency from the OTF PID tables for multiple detectors. +/// Analyzes individual detectors (Tracker, TOF Inner, TOF Outer, RICH), +/// as well as combined detector performance using quadrature combination +/// of nSigma values. +/// +/// \author Henrik Fribert TUM +/// \since August 14, 2025 +/// + +#include "ALICE3/DataModel/OTFPIDTrk.h" +#include "ALICE3/DataModel/OTFRICH.h" +#include "ALICE3/DataModel/OTFTOF.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CommonUtils/NameConf.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/DCA.h" + +#include "TH1F.h" +#include "TH2F.h" +#include "TProfile.h" +#include "TVector3.h" + +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; + +struct Alice3PidEvaluation { + + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + static constexpr float kInvalidNSigmaValue = 999.0f; + + Configurable maxNSigmaForIdentification{"maxNSigmaForIdentification", 3.0f, "Maximum |nSigma| allowed for particle identification (closest-hypothesis rule)"}; + Configurable numLogBins{"numLogBins", 200, "Number of logarithmic momentum bins"}; + Configurable useClosestHypothesisRule{"useClosestHypothesisRule", true, "Use closest-hypothesis rule: assign track to hypothesis with smallest |nSigma|"}; + Configurable useMinimalIdentification{"useMinimalIdentification", false, "Require that only one hypothesis is within the cutoff"}; + Configurable includeTrackerInCombined{"includeTrackerInCombined", true, "Include Tracker in combined analysis"}; + Configurable includeTofInnerInCombined{"includeTofInnerInCombined", true, "Include TOF Inner in combined analysis"}; + Configurable includeTofOuterInCombined{"includeTofOuterInCombined", true, "Include TOF Outer in combined analysis"}; + Configurable includeRichInCombined{"includeRichInCombined", false, "Include RICH in combined analysis"}; + + std::vector mLogBins; + + enum PidHypothesis { kElectron, + kMuon, + kPion, + kKaon, + kProton, + kDeuteron, + kTriton, + kHelium3, + kAlpha, + kCount }; + static constexpr std::array kHypothesisPdg = {11, 13, 211, 321, 2212, 1000010020, 1000010030, 1000020030, 1000020040}; + static constexpr std::array kHypothesisNames = {"Electron", "Muon", "Pion", "Kaon", "Proton", "Deuteron", "Triton", "Helium3", "Alpha"}; + + struct DetectorHistograms { + std::array, PidHypothesis::kCount> hTotalTrue; + std::array, PidHypothesis::kCount> hEfficiency; + std::array, PidHypothesis::kCount> hPurityAsHypothesis; + }; + + std::shared_ptr hDetectorParticipation2D; + + DetectorHistograms trackerHists; + DetectorHistograms tofInnerHists; + DetectorHistograms tofOuterHists; + DetectorHistograms richHists; + DetectorHistograms combinedHists; + DetectorHistograms combinedNoTrackerHists; + void init(o2::framework::InitContext&) + { + LOG(info) << "Initializing multi-detector PID evaluation using closest-hypothesis rule"; + LOG(info) << "Maximum |nSigma| for identification: " << maxNSigmaForIdentification.value; + LOG(info) << "Closest-hypothesis rule: " << (useClosestHypothesisRule.value ? "ENABLED" : "DISABLED"); + LOG(info) << "Require unique identification: " << (useMinimalIdentification.value ? "YES" : "NO"); + LOG(info) << "Combined analysis includes: " + << (includeTrackerInCombined.value ? "Tracker " : "") + << (includeTofInnerInCombined.value ? "TOF_Inner " : "") + << (includeTofOuterInCombined.value ? "TOF_Outer " : "") + << (includeRichInCombined.value ? "RICH " : ""); + + mLogBins.clear(); + double pMin = 0.05; + double pMax = 10; + double logMin = std::log10(pMin); + double logMax = std::log10(pMax); + double dLog = (logMax - logMin) / numLogBins.value; + for (int i = 0; i <= numLogBins.value; ++i) { + mLogBins.push_back(std::pow(10, logMin + i * dLog)); + } + const AxisSpec axisMomentum{mLogBins, "#it{p} (GeV/#it{c})"}; + + auto createDetectorHistograms = [&](DetectorHistograms& detHists, const std::string& detectorName) { + for (int trueIdx = 0; trueIdx < PidHypothesis::kCount; ++trueIdx) { + const auto& trueName = kHypothesisNames[trueIdx]; + detHists.hTotalTrue[trueIdx] = histos.add(Form("%s/hTotalTrue%s", detectorName.c_str(), trueName), + Form("%s: Total True %s; #it{p} (GeV/#it{c})", detectorName.c_str(), trueName), + kTH1F, {axisMomentum}); + detHists.hEfficiency[trueIdx] = histos.add(Form("%s/hEfficiency%s", detectorName.c_str(), trueName), + Form("%s: PID Efficiency for %s; #it{p} (GeV/#it{c}); Efficiency", detectorName.c_str(), trueName), + kTProfile, {axisMomentum}); + } + + for (int hypIdx = 0; hypIdx < PidHypothesis::kCount; ++hypIdx) { + const auto& hypName = kHypothesisNames[hypIdx]; + detHists.hPurityAsHypothesis[hypIdx] = histos.add(Form("%s/hPurityAs%s", detectorName.c_str(), hypName), + Form("%s: Purity when selecting as %s; #it{p} (GeV/#it{c}); Purity", detectorName.c_str(), hypName), + kTProfile, {axisMomentum}); + } + }; + + createDetectorHistograms(trackerHists, "Tracker"); + createDetectorHistograms(tofInnerHists, "TOF_Inner"); + createDetectorHistograms(tofOuterHists, "TOF_Outer"); + createDetectorHistograms(richHists, "RICH"); + createDetectorHistograms(combinedHists, "Combined"); + createDetectorHistograms(combinedNoTrackerHists, "Combined_NoTracker"); + + const AxisSpec axisDetectorCount{5, -0.5, 4.5, "Number of detectors"}; + hDetectorParticipation2D = histos.add("Combined/hDetectorParticipation2D", + "Detector participation vs momentum; #it{p} (GeV/#it{c}); Number of detectors", + kTH2F, {axisMomentum, axisDetectorCount}); + } + + void process(soa::Join const& tracks, + aod::McParticles const& /*mcParticles*/) + { + + auto isValidNSigma = [](float nSigma) -> bool { + return (nSigma < kInvalidNSigmaValue && nSigma > -kInvalidNSigmaValue); + }; + + auto computeCombinedNSigma = [&](const std::vector>& detectorNSigmas, float p) -> std::array { + std::array combinedNSigma; + int totalValidDetectors = 0; + for (const auto& detNSigma : detectorNSigmas) { + bool detectorHasValidMeasurement = false; + for (int hypIdx = 0; hypIdx < PidHypothesis::kCount; ++hypIdx) { + if (isValidNSigma(detNSigma[hypIdx])) { + detectorHasValidMeasurement = true; + break; + } + } + if (detectorHasValidMeasurement) { + totalValidDetectors++; + } + } + + for (int hypIdx = 0; hypIdx < PidHypothesis::kCount; ++hypIdx) { + float sumSquares = 0.0f; + int validDetectors = 0; + + for (const auto& detNSigma : detectorNSigmas) { + if (isValidNSigma(detNSigma[hypIdx])) { + sumSquares += detNSigma[hypIdx] * detNSigma[hypIdx]; + validDetectors++; + } + } + + if (validDetectors > 0) { + combinedNSigma[hypIdx] = std::sqrt(sumSquares); + } else { + combinedNSigma[hypIdx] = kInvalidNSigmaValue; + } + } + if (totalValidDetectors > 0) { + hDetectorParticipation2D->Fill(p, totalValidDetectors); + } + + return combinedNSigma; + }; + + auto analyzeDetector = [&](DetectorHistograms& detHists, const std::array& nSigmaValues, + int trueParticleIndex, float p) { + detHists.hTotalTrue[trueParticleIndex]->Fill(p); + bool hasValidNSigma = false; + for (int i = 0; i < PidHypothesis::kCount; ++i) { + if (isValidNSigma(nSigmaValues[i])) { + hasValidNSigma = true; + break; + } + } + if (!hasValidNSigma) { + return; + } + + bool correctlyIdentified = false; + int selectedHypothesis = -1; + + if (useClosestHypothesisRule.value) { + float minAbsNSigma = kInvalidNSigmaValue; + int bestHypothesis = -1; + int validHypothesesCount = 0; + + for (int hypIdx = 0; hypIdx < PidHypothesis::kCount; ++hypIdx) { + if (isValidNSigma(nSigmaValues[hypIdx])) { + float absNSigma = std::fabs(nSigmaValues[hypIdx]); + if (absNSigma < minAbsNSigma) { + minAbsNSigma = absNSigma; + bestHypothesis = hypIdx; + } + if (absNSigma < maxNSigmaForIdentification.value) { + validHypothesesCount++; + } + } + } + + if (bestHypothesis >= 0 && minAbsNSigma < maxNSigmaForIdentification.value) { + if (useMinimalIdentification.value && validHypothesesCount > 1) { + selectedHypothesis = -1; + } else { + selectedHypothesis = bestHypothesis; + } + } + correctlyIdentified = (selectedHypothesis == trueParticleIndex); + } else { + correctlyIdentified = (std::fabs(nSigmaValues[trueParticleIndex]) < maxNSigmaForIdentification.value); + for (int hypIdx = 0; hypIdx < PidHypothesis::kCount; ++hypIdx) { + if (std::fabs(nSigmaValues[hypIdx]) < maxNSigmaForIdentification.value) { + bool isCorrect = (hypIdx == trueParticleIndex); + detHists.hPurityAsHypothesis[hypIdx]->Fill(p, isCorrect ? 1.0 : 0.0); + } + } + } + + detHists.hEfficiency[trueParticleIndex]->Fill(p, correctlyIdentified ? 1.0 : 0.0); + + if (useClosestHypothesisRule.value && selectedHypothesis >= 0) { + bool isCorrect = (selectedHypothesis == trueParticleIndex); + detHists.hPurityAsHypothesis[selectedHypothesis]->Fill(p, isCorrect ? 1.0 : 0.0); + } + }; + + for (const auto& track : tracks) { + if (!track.has_mcParticle()) { + continue; + } + + const auto& mcParticle = track.mcParticle(); + const float p = mcParticle.p(); + const int truePdg = std::abs(mcParticle.pdgCode()); + + int trueParticleIndex = -1; + for (int i = 0; i < PidHypothesis::kCount; ++i) { + if (kHypothesisPdg[i] == truePdg) { + trueParticleIndex = i; + break; + } + } + if (trueParticleIndex == -1) { + continue; + } + + std::array trackerNSigma; + trackerNSigma[kElectron] = track.nSigmaTrkEl(); + trackerNSigma[kMuon] = track.nSigmaTrkMu(); + trackerNSigma[kPion] = track.nSigmaTrkPi(); + trackerNSigma[kKaon] = track.nSigmaTrkKa(); + trackerNSigma[kProton] = track.nSigmaTrkPr(); + trackerNSigma[kDeuteron] = track.nSigmaTrkDe(); + trackerNSigma[kTriton] = track.nSigmaTrkTr(); + trackerNSigma[kHelium3] = track.nSigmaTrkHe(); + trackerNSigma[kAlpha] = track.nSigmaTrkAl(); + + analyzeDetector(trackerHists, trackerNSigma, trueParticleIndex, p); + + std::array tofInnerNSigma; + tofInnerNSigma[kElectron] = track.nSigmaElectronInnerTOF(); + tofInnerNSigma[kMuon] = track.nSigmaMuonInnerTOF(); + tofInnerNSigma[kPion] = track.nSigmaPionInnerTOF(); + tofInnerNSigma[kKaon] = track.nSigmaKaonInnerTOF(); + tofInnerNSigma[kProton] = track.nSigmaProtonInnerTOF(); + tofInnerNSigma[kDeuteron] = track.nSigmaDeuteronInnerTOF(); + tofInnerNSigma[kTriton] = track.nSigmaTritonInnerTOF(); + tofInnerNSigma[kHelium3] = track.nSigmaHelium3InnerTOF(); + tofInnerNSigma[kAlpha] = track.nSigmaAlphaInnerTOF(); + + analyzeDetector(tofInnerHists, tofInnerNSigma, trueParticleIndex, p); + + std::array tofOuterNSigma; + tofOuterNSigma[kElectron] = track.nSigmaElectronOuterTOF(); + tofOuterNSigma[kMuon] = track.nSigmaMuonOuterTOF(); + tofOuterNSigma[kPion] = track.nSigmaPionOuterTOF(); + tofOuterNSigma[kKaon] = track.nSigmaKaonOuterTOF(); + tofOuterNSigma[kProton] = track.nSigmaProtonOuterTOF(); + tofOuterNSigma[kDeuteron] = track.nSigmaDeuteronOuterTOF(); + tofOuterNSigma[kTriton] = track.nSigmaTritonOuterTOF(); + tofOuterNSigma[kHelium3] = track.nSigmaHelium3OuterTOF(); + tofOuterNSigma[kAlpha] = track.nSigmaAlphaOuterTOF(); + + analyzeDetector(tofOuterHists, tofOuterNSigma, trueParticleIndex, p); + + std::array richNSigma; + richNSigma[kElectron] = track.nSigmaElectronRich(); + richNSigma[kMuon] = track.nSigmaMuonRich(); + richNSigma[kPion] = track.nSigmaPionRich(); + richNSigma[kKaon] = track.nSigmaKaonRich(); + richNSigma[kProton] = track.nSigmaProtonRich(); + richNSigma[kDeuteron] = track.nSigmaDeuteronRich(); + richNSigma[kTriton] = track.nSigmaTritonRich(); + richNSigma[kHelium3] = track.nSigmaHelium3Rich(); + richNSigma[kAlpha] = track.nSigmaAlphaRich(); + + analyzeDetector(richHists, richNSigma, trueParticleIndex, p); + + std::vector> allDetectorNSigmas; + + if (includeTrackerInCombined.value) { + allDetectorNSigmas.push_back(trackerNSigma); + } + if (includeTofInnerInCombined.value) { + allDetectorNSigmas.push_back(tofInnerNSigma); + } + if (includeTofOuterInCombined.value) { + allDetectorNSigmas.push_back(tofOuterNSigma); + } + if (includeRichInCombined.value) { + allDetectorNSigmas.push_back(richNSigma); + } + if (!allDetectorNSigmas.empty()) { + std::array combinedNSigma = computeCombinedNSigma(allDetectorNSigmas, p); + analyzeDetector(combinedHists, combinedNSigma, trueParticleIndex, p); + } + + std::vector> noTrackerDetectorNSigmas; + + if (includeTofInnerInCombined.value) { + noTrackerDetectorNSigmas.push_back(tofInnerNSigma); + } + if (includeTofOuterInCombined.value) { + noTrackerDetectorNSigmas.push_back(tofOuterNSigma); + } + if (includeRichInCombined.value) { + noTrackerDetectorNSigmas.push_back(richNSigma); + } + if (!noTrackerDetectorNSigmas.empty()) { + std::array combinedNoTrackerNSigma = computeCombinedNSigma(noTrackerDetectorNSigmas, p); + analyzeDetector(combinedNoTrackerHists, combinedNoTrackerNSigma, trueParticleIndex, p); + } + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From 618df32c8052d191b60dfd74ac87a32001d60a19 Mon Sep 17 00:00:00 2001 From: ariedel-cern <85537041+ariedel-cern@users.noreply.github.com> Date: Thu, 2 Oct 2025 01:06:04 +0200 Subject: [PATCH 605/986] [PWGCF] Update femto framework (#13205) --- PWGCF/Femto/Core/baseSelection.h | 6 +- PWGCF/Femto/Core/cascadeBuilder.h | 2 +- PWGCF/Femto/Core/closePairRejection.h | 55 +++---- PWGCF/Femto/Core/collisionBuilder.h | 106 +++++++++---- PWGCF/Femto/Core/collisionHistManager.h | 92 +++++++---- PWGCF/Femto/Core/femtoUtils.h | 4 +- PWGCF/Femto/Core/kinkBuilder.h | 2 +- PWGCF/Femto/Core/pairBuilder.h | 70 ++++----- PWGCF/Femto/Core/pairHistManager.h | 9 +- PWGCF/Femto/Core/pairProcessHelpers.h | 12 +- PWGCF/Femto/Core/partitions.h | 125 +++++++-------- PWGCF/Femto/Core/trackBuilder.h | 87 ++++++++++- PWGCF/Femto/Core/trackHistManager.h | 4 +- PWGCF/Femto/Core/twoTrackResonanceBuilder.h | 33 ++-- PWGCF/Femto/Core/v0Builder.h | 106 ++++++++++++- PWGCF/Femto/DataModel/FemtoTables.h | 88 ++++++----- PWGCF/Femto/TableProducer/CMakeLists.txt | 5 + PWGCF/Femto/TableProducer/femtoProducer.cxx | 4 +- .../femtoProducerDerivedToDerived.cxx | 146 ++++++++++++++++++ PWGCF/Femto/Tasks/femtoCascadeQa.cxx | 13 +- PWGCF/Femto/Tasks/femtoKinkQa.cxx | 6 +- PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx | 6 +- PWGCF/Femto/Tasks/femtoPairTrackKink.cxx | 4 +- PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx | 2 +- .../Tasks/femtoPairTrackTwoTrackResonance.cxx | 8 +- PWGCF/Femto/Tasks/femtoPairTrackV0.cxx | 6 +- PWGCF/Femto/Tasks/femtoTrackQa.cxx | 11 +- .../Femto/Tasks/femtoTwotrackresonanceQa.cxx | 17 +- PWGCF/Femto/Tasks/femtoV0Qa.cxx | 27 ++-- 29 files changed, 732 insertions(+), 324 deletions(-) create mode 100644 PWGCF/Femto/TableProducer/femtoProducerDerivedToDerived.cxx diff --git a/PWGCF/Femto/Core/baseSelection.h b/PWGCF/Femto/Core/baseSelection.h index 2be9737422d..c2280dc21eb 100644 --- a/PWGCF/Femto/Core/baseSelection.h +++ b/PWGCF/Femto/Core/baseSelection.h @@ -279,12 +279,12 @@ class BaseSelection line << std::setw(bitWidth) << "-> loosest minimal selection, no bit saved"; } else { const uint64_t bitmask = uint64_t{1} << globalBitIndex++; - line << std::setw(bitWidth) << ("-> bitmask: " + std::to_string(bitmask)); + std::stringstream hexStream; + hexStream << "-> bitmask: 0x" << std::uppercase << std::hex << bitmask; + line << std::setw(bitWidth) << hexStream.str(); } - LOG(info) << line.str(); } - LOG(info) << ""; // blank line between observables } LOG(info) << "Printing done"; diff --git a/PWGCF/Femto/Core/cascadeBuilder.h b/PWGCF/Femto/Core/cascadeBuilder.h index 5f43ecf6ab9..6a3a6722879 100644 --- a/PWGCF/Femto/Core/cascadeBuilder.h +++ b/PWGCF/Femto/Core/cascadeBuilder.h @@ -101,7 +101,7 @@ struct ConfOmegaBits : o2::framework::ConfigurableGroup { o2::framework::Configurable phiMax{"phiMax", 1.f * o2::constants::math::TwoPI, "Maximum phi"}; \ o2::framework::Configurable massMin{"massMin", defaultMassMin, "Minimum invariant mass for Cascade"}; \ o2::framework::Configurable massMax{"massMax", defaultMassMax, "Maximum invariant mass for Cascade"}; \ - o2::framework::Configurable mask{"mask", 0, "Bitmask for cascade selection"}; + o2::framework::Configurable mask{"mask", 0x0, "Bitmask for cascade selection"}; struct ConfXiSelection : o2::framework::ConfigurableGroup { std::string prefix = std::string("XiSelection"); diff --git a/PWGCF/Femto/Core/closePairRejection.h b/PWGCF/Femto/Core/closePairRejection.h index 3c21f953ad1..147c55fa6a1 100644 --- a/PWGCF/Femto/Core/closePairRejection.h +++ b/PWGCF/Femto/Core/closePairRejection.h @@ -109,20 +109,13 @@ class CloseTrackRejection CloseTrackRejection() = default; virtual ~CloseTrackRejection() = default; - void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int chargeTrack1, int chargeTrack2) + void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int chargeAbsTrack1, int chargeAbsTrack2) { mDetaMax = detaMax; mDphistarMax = dphistarMax; - if (mDetaMax < o2::constants::math::Epsilon || mDphistarMax < o2::constants::math::Epsilon) { - LOG(fatal) << "Either DetaMax or DphistarMax are 0 or negative. Either turn off CPR or specify reasonable values. Breaking ..."; - } - mChargeTrack1 = chargeTrack1; - mChargeTrack2 = chargeTrack2; - - if (utils::sign(mChargeTrack1) != utils::sign(mChargeTrack2)) { - LOG(warn) << "CPR is turned on for tracks with opposite charge. Is this intended?"; - } + mChargeAbsTrack1 = chargeAbsTrack1; + mChargeAbsTrack2 = chargeAbsTrack2; mHistogramRegistry = registry; @@ -150,8 +143,8 @@ class CloseTrackRejection mDeta = track1.eta() - track2.eta(); for (size_t i = 0; i < kTpcRadius.size(); i++) { - auto phistar1 = utils::dphistar(mMagField, kTpcRadius[i], mChargeTrack1, track1.pt(), track1.phi()); - auto phistar2 = utils::dphistar(mMagField, kTpcRadius[i], mChargeTrack2, track2.pt(), track2.phi()); + auto phistar1 = utils::dphistar(mMagField, kTpcRadius[i], mChargeAbsTrack1 * track1.signedPt(), track1.phi()); + auto phistar2 = utils::dphistar(mMagField, kTpcRadius[i], mChargeAbsTrack2 * track2.signedPt(), track2.phi()); if (phistar1 && phistar2) { // if the calculation for one phistar fails, keep the default value, which is 0 // this makes it more likelier for the pair to be rejected sind the averave will be biased towards lower values @@ -184,8 +177,8 @@ class CloseTrackRejection } private: - int mChargeTrack1 = 0; - int mChargeTrack2 = 0; + int mChargeAbsTrack1 = 0; + int mChargeAbsTrack2 = 0; float mMagField = 0.f; float mAverageDphistar = 0.f; float mDeta = 0.f; @@ -200,11 +193,11 @@ template class ClosePairRejectionTrackTrack { public: - void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int chargeTrack1, int chargeTrack2, bool isActivated) + void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int absChargeTrack1, int absChargeTrack2, bool isActivated) { mIsActivated = isActivated; if (mIsActivated) { - mCtr.init(registry, specs, detaMax, dphistarMax, chargeTrack1, chargeTrack2); + mCtr.init(registry, specs, detaMax, dphistarMax, absChargeTrack1, absChargeTrack2); } } @@ -227,15 +220,13 @@ template class ClosePairRejectionTrackV0 // can also be used for any particle type that has pos/neg daughters, like resonances { public: - void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int chargeTrack, bool isActivated) + void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int absChargeTrack, bool isActivated) { mIsActivated = isActivated; - mChargeTrack = chargeTrack; - // initialize CPR with charge of the track and the same charge for the daughter particle - // absolute charge of the daughter track will be 1, so we just pass the sign + // absolute charge of the daughter track will be 1, so we just pass 1 if (mIsActivated) { - mCtr.init(registry, specs, detaMax, dphistarMax, mChargeTrack, utils::sign(mChargeTrack)); + mCtr.init(registry, specs, detaMax, dphistarMax, absChargeTrack, 1); } } @@ -246,14 +237,12 @@ class ClosePairRejectionTrackV0 // can also be used for any particle type that h template void setPair(const T1& track, const T2& v0, const T3 /*trackTable*/) { - if (mChargeTrack > 0) { + if (track.signedPt() > 0) { auto daughter = v0.template posDau_as(); mCtr.compute(track, daughter); - } else if (mChargeTrack < 0) { + } else { auto daughter = v0.template negDau_as(); mCtr.compute(track, daughter); - } else { - LOG(fatal) << "CPR Track-V0: Sign of the track is 0!"; } } @@ -266,19 +255,19 @@ class ClosePairRejectionTrackV0 // can also be used for any particle type that h private: CloseTrackRejection mCtr; - int mChargeTrack = 0; bool mIsActivated = true; }; template -class ClosePairRejectionTrackCascade // can also be used for any particle type that has pos/neg daughters, like resonances +class ClosePairRejectionTrackCascade { public: - void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int chargeTrack, int chargeCascade, bool isActivated) + void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int absChargeTrack, bool isActivated) { mIsActivated = isActivated; if (mIsActivated) { - mCtr.init(registry, specs, detaMax, dphistarMax, chargeTrack, chargeCascade); + // charge of cascade is always 1 + mCtr.init(registry, specs, detaMax, dphistarMax, absChargeTrack, 1); } } @@ -309,14 +298,12 @@ template class ClosePairRejectionTrackKink { public: - void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int chargeTrack, int signKinkCandidate, bool isActivated) + void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int absChargeTrack, bool isActivated) { mIsActivated = isActivated; - // initialize CPR with charge of the track and the charged daughter particle - // For kinks, we compare the primary track with the charged daughter - // The charged daughter has absolute charge of 1, so we can pass the sign directly + // The charged daughter has absolute charge of 1, so we can pass 1 directly if (mIsActivated) { - mCtr.init(registry, specs, detaMax, dphistarMax, chargeTrack, signKinkCandidate); + mCtr.init(registry, specs, detaMax, dphistarMax, absChargeTrack, 1); } } diff --git a/PWGCF/Femto/Core/collisionBuilder.h b/PWGCF/Femto/Core/collisionBuilder.h index 091dc6ec237..adcfd40b5ee 100644 --- a/PWGCF/Femto/Core/collisionBuilder.h +++ b/PWGCF/Femto/Core/collisionBuilder.h @@ -45,13 +45,13 @@ struct ConfCollisionFilters : o2::framework::ConfigurableGroup { o2::framework::Configurable vtxZMin{"vtxZMin", -10.f, "Minimum vertex Z position (cm)"}; o2::framework::Configurable vtxZMax{"vtxZMax", 10.f, "Maximum vertex Z position (cm)"}; o2::framework::Configurable multMin{"multMin", 0.f, "Minimum multiplicity"}; - o2::framework::Configurable multMax{"multMax", 999.f, "Maximum multiplicity"}; + o2::framework::Configurable multMax{"multMax", 5000.f, "Maximum multiplicity"}; o2::framework::Configurable centMin{"centMin", 0.f, "Minimum centrality (multiplicity percentile)"}; - o2::framework::Configurable centMax{"centMax", 999.f, "Maximum centrality (multiplicity percentile)"}; - o2::framework::Configurable spherMin{"spherMin", 0.f, "Minimum centrality (multiplicity percentile)"}; - o2::framework::Configurable spherMax{"spherMax", 2.f, "Maximum centrality (multiplicity percentile)"}; - o2::framework::Configurable magFieldMin{"magFieldMin", -1.f, "Minimum magnetic field strength (T)"}; - o2::framework::Configurable magFieldMax{"magFieldMax", 1.f, "Maximum magnetic field strength (T)"}; + o2::framework::Configurable centMax{"centMax", 100.f, "Maximum centrality (multiplicity percentile)"}; + o2::framework::Configurable sphericityMin{"sphericityMin", 0.f, "Minimum sphericity"}; + o2::framework::Configurable sphericityMax{"sphericityMax", 1.f, "Maximum sphericity"}; + o2::framework::Configurable magFieldMin{"magFieldMin", -5, "Minimum magnetic field strength (kG)"}; + o2::framework::Configurable magFieldMax{"magFieldMax", 5, "Maximum magnetic field strength (kG)"}; }; struct ConfCollisionBits : o2::framework::ConfigurableGroup { @@ -71,6 +71,8 @@ struct ConfCollisionBits : o2::framework::ConfigurableGroup { o2::framework::Configurable isGoodItsLayersAll{"isGoodItsLayersAll", 0, "numbers of inactive chips on all ITS layers are below maximum allowed values (-1: stored in bitmaks; 0 off; 1 on)"}; o2::framework::Configurable> occupancyMin{"occupancyMin", {}, "Minimum occpancy"}; o2::framework::Configurable> occupancyMax{"occupancyMax", {}, "Maximum occpancy"}; + o2::framework::Configurable> sphericityMin{"sphericityMin", {}, "Minimum sphericity"}; + o2::framework::Configurable> sphericityMax{"sphericityMax", {}, "Maximum sphericity"}; }; struct ConfCollisionTriggers : o2::framework::ConfigurableGroup { @@ -94,14 +96,12 @@ struct ConfCollisionSelection : o2::framework::ConfigurableGroup { o2::framework::Configurable vtxZMin{"vtxZMin", -10.f, "Minimum vertex Z position (cm)"}; o2::framework::Configurable vtxZMax{"vtxZMax", 10.f, "Maximum vertex Z position (cm)"}; o2::framework::Configurable multMin{"multMin", 0.f, "Minimum multiplicity"}; - o2::framework::Configurable multMax{"multMax", 999.f, "Maximum multiplicity"}; + o2::framework::Configurable multMax{"multMax", 5000.f, "Maximum multiplicity"}; o2::framework::Configurable centMin{"centMin", 0.f, "Minimum centrality (multiplicity percentile)"}; - o2::framework::Configurable centMax{"centMax", 999.f, "Maximum centrality (multiplicity percentile)"}; - o2::framework::Configurable spherMin{"spherMin", 0.f, "Minimum centrality (multiplicity percentile)"}; - o2::framework::Configurable spherMax{"spherMax", 2.f, "Maximum centrality (multiplicity percentile)"}; - o2::framework::Configurable magFieldMin{"magFieldMin", -1.f, "Minimum magnetic field strength (T)"}; - o2::framework::Configurable magFieldMax{"magFieldMax", 1.f, "Maximum magnetic field strength (T)"}; - o2::framework::Configurable collisionMask{"collisionMask", 0, "Bitmask for collision"}; + o2::framework::Configurable centMax{"centMax", 100.f, "Maximum centrality (multiplicity percentile)"}; + o2::framework::Configurable magFieldMin{"magFieldMin", -5, "Minimum magnetic field strength (kG)"}; + o2::framework::Configurable magFieldMax{"magFieldMax", 5, "Maximum magnetic field strength (kG)"}; + o2::framework::Configurable collisionMask{"collisionMask", 0x0, "Bitmask for collision"}; }; /// enum for all collision selections @@ -122,6 +122,8 @@ enum CollisionSels { kIsGoodItsLayersAll, ///< numbers of inactive chips on all ITS layers are below maximum allowed values kOccupancyMin, ///< Min. occupancy kOccupancyMax, ///< Max. occupancy + kSphericityMin, ///< Min. sphericity + kSphericityMax, ///< Max. sphericity kCollisionSelsMax }; @@ -142,7 +144,11 @@ const std::unordered_map colSelsToString = { {kIsGoodItsLayer0123, "Is good ITS layer 0-3"}, {kIsGoodItsLayersAll, "Is good ITS layer all"}, {kOccupancyMin, "Minimum Occupancy"}, - {kOccupancyMax, "Maximum Occupancy"}}; + {kOccupancyMax, "Maximum Occupancy"}, + {kSphericityMin, "Minimum Sphericity"}, + {kSphericityMax, "Maximum Sphericity"} + +}; class CollisionSelection : public BaseSelection { @@ -162,8 +168,8 @@ class CollisionSelection : public BaseSelectionaddSelection(config.sel8.value, kSel8); @@ -180,9 +186,11 @@ class CollisionSelection : public BaseSelectionaddSelection(config.isGoodItsLayersAll.value, kIsGoodItsLayersAll); this->addSelection(config.occupancyMin.value, kOccupancyMin, limits::kLowerLimit, true, true); this->addSelection(config.occupancyMax.value, kOccupancyMax, limits::kUpperLimit, true, true); + this->addSelection(config.sphericityMin.value, kSphericityMin, limits::kLowerLimit, true, true); + this->addSelection(config.sphericityMax.value, kSphericityMax, limits::kUpperLimit, true, true); }; - void setMagneticField(float MagField) + void setMagneticField(int MagField) { mMagField = MagField; } @@ -269,6 +277,8 @@ class CollisionSelection : public BaseSelectionevaluateObservable(kOccupancyMin, col.trackOccupancyInTimeRange()); this->evaluateObservable(kOccupancyMax, col.trackOccupancyInTimeRange()); + this->evaluateObservable(kSphericityMin, mSphericity); + this->evaluateObservable(kSphericityMax, mSphericity); this->assembleBitmask(); }; @@ -278,15 +288,15 @@ class CollisionSelection : public BaseSelection producedCollision; o2::framework::Produces producedCollisionMask; - o2::framework::Produces producedQns; o2::framework::Produces producedPositions; + o2::framework::Produces producedSphericities; o2::framework::Produces producedMultiplicityEstimators; o2::framework::Produces producedCentralityEstimators; + o2::framework::Produces producedQns; }; struct ConfCollisionTables : o2::framework::ConfigurableGroup { std::string prefix = std::string("CollisionTables"); o2::framework::Configurable produceCollisions{"produceCollisions", -1, "Produce Collisions (-1: auto; 0 off; 1 on)"}; o2::framework::Configurable produceCollisionMasks{"produceCollisionMasks", -1, "Produce Collision Masks (-1: auto; 0 off; 1 on)"}; - o2::framework::Configurable produceQns{"produceQns", -1, "Produce Qn (-1: auto; 0 off; 1 on)"}; o2::framework::Configurable producePositions{"producePositions", -1, "Produce Positions (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceSphericities{"produceSphericities", -1, "Produce Sphericity (-1: auto; 0 off; 1 on)"}; o2::framework::Configurable produceMults{"produceMults", -1, "Produce Multiplicities (-1: auto; 0 off; 1 on)"}; o2::framework::Configurable produceCents{"produceCents", -1, "Produce Centralities (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceQns{"produceQns", -1, "Produce Qn (-1: auto; 0 off; 1 on)"}; }; class CollisionBuilder @@ -334,11 +346,12 @@ class CollisionBuilder LOG(info) << "Initialize femto collision builder..."; mProducedCollisions = utils::enableTable("FCols_001", confTable.produceCollisions.value, initContext); mProducedCollisionMasks = utils::enableTable("FColMasks_001", confTable.produceCollisionMasks.value, initContext); - mProduceQns = utils::enableTable("FColQnBins_001", confTable.produceQns.value, initContext); mProducedPositions = utils::enableTable("FColPos_001", confTable.producePositions.value, initContext); + mProducedSphericities = utils::enableTable("FColSphericities_001", confTable.produceSphericities.value, initContext); mProducedMultiplicities = utils::enableTable("FColMults_001", confTable.produceMults.value, initContext); mProducedCentralities = utils::enableTable("FColCents_001", confTable.produceCents.value, initContext); - if (mProducedCollisions || mProducedCollisionMasks || mProducedPositions || mProducedMultiplicities || mProducedCentralities) { + mProduceQns = utils::enableTable("FColQnBins_001", confTable.produceQns.value, initContext); + if (mProducedCollisions || mProducedCollisionMasks || mProducedPositions || mProducedSphericities || mProducedMultiplicities || mProducedCentralities) { mFillAnyTable = true; mCollisionSelection.printSelections(colSelsName, colSelsToString); } else { @@ -348,7 +361,7 @@ class CollisionBuilder } template - void buildCollision(T1& bc, T2& col, T3& tracks, T4& ccdb, float magField) + void buildCollision(T1& bc, T2& col, T3& tracks, T4& ccdb, int magField) { if (mUseTrigger) { mZorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), mTriggerNames); @@ -357,7 +370,6 @@ class CollisionBuilder mCollisionSelection.setSphericity(tracks); mCollisionSelection.setMultiplicity(col); mCollisionSelection.setCentrality(col); - mCollisionSelection.applySelections(col); } @@ -387,8 +399,7 @@ class CollisionBuilder collisionProducts.producedCollision(col.posZ(), col.multNTracksPV(), mCollisionSelection.getCentrality(), - mCollisionSelection.getSphericity(), - mCollisionSelection.getMagneticField()); + static_cast(mCollisionSelection.getMagneticField())); } if (mProducedCollisionMasks) { collisionProducts.producedCollisionMask(mCollisionSelection.getBitmask()); @@ -397,6 +408,9 @@ class CollisionBuilder collisionProducts.producedPositions(col.posX(), col.posY()); } + if (mProducedSphericities) { + collisionProducts.producedSphericities(mCollisionSelection.getSphericity()); + } if (mProducedMultiplicities) { collisionProducts.producedMultiplicityEstimators( col.multFT0A(), @@ -430,12 +444,36 @@ class CollisionBuilder bool mFillAnyTable = false; bool mProducedCollisions = false; bool mProducedCollisionMasks = false; - bool mProduceQns = false; bool mProducedPositions = false; + bool mProducedSphericities = false; bool mProducedMultiplicities = false; bool mProducedCentralities = false; + bool mProduceQns = false; }; -}; // namespace collisionbuilder -}; // namespace o2::analysis::femto + +struct CollisionBuilderDerivedToDerivedProducts : o2::framework::ProducesGroup { + o2::framework::Produces producedCollision; + o2::framework::Produces producedCollisionMask; +}; + +class CollisionBuilderDerivedToDerived +{ + public: + CollisionBuilderDerivedToDerived() = default; + virtual ~CollisionBuilderDerivedToDerived() = default; + + template + void processCollision(T1& col, T2& newCollisionTable) + { + newCollisionTable.producedCollision(col.posZ(), + col.mult(), + col.cent(), + col.magField()); + newCollisionTable.producedCollisionMask(col.collisionMask()); + } +}; + +} // namespace collisionbuilder +} // namespace o2::analysis::femto ; #endif // PWGCF_FEMTO_CORE_COLLISIONBUILDER_H_ diff --git a/PWGCF/Femto/Core/collisionHistManager.h b/PWGCF/Femto/Core/collisionHistManager.h index 35daec9fa3a..b08972c4202 100644 --- a/PWGCF/Femto/Core/collisionHistManager.h +++ b/PWGCF/Femto/Core/collisionHistManager.h @@ -39,12 +39,12 @@ enum ColHist { kMult, kCent, kMagField, - kSphericity, // qa kPosX, kPosY, kPos, kOccupancy, + kSphericity, // 2d kPoszVsMult, kPoszVsCent, @@ -62,11 +62,11 @@ constexpr std::array, kColHistLast> HistTable = { {kPosZ, o2::framework::kTH1F, "hPosZ", "Vertex Z; V_{Z} (cm); Entries"}, {kMult, o2::framework::kTH1F, "hMult", "Multiplicity; Multiplicity; Entries"}, {kCent, o2::framework::kTH1F, "hCent", "Centrality; Centrality (%); Entries"}, - {kMagField, o2::framework::kTH1F, "hMagField", "Magnetic Field; B (T); Entries"}, - {kSphericity, o2::framework::kTH1F, "hSphericity", "Sphericity; Sphericity; Entries"}, + {kMagField, o2::framework::kTH1F, "hMagField", "Magnetic Field; B (kG); Entries"}, {kPosX, o2::framework::kTH1F, "hPosX", "Vertex X; V_{X} (cm); Entries"}, {kPosY, o2::framework::kTH1F, "hPosY", "Vertex Z; V_{Y} (cm); Entries"}, {kPos, o2::framework::kTH1F, "hPos", "Primary vertex; V_{pos} (cm); Entries"}, + {kSphericity, o2::framework::kTH1F, "hSphericity", "Sphericity; Sphericity; Entries"}, {kOccupancy, o2::framework::kTH1F, "hOccupancy", "Occupancy; Occupancy; Entries"}, {kPoszVsMult, o2::framework::kTH2F, "hPoszVsMult", "Vertex Z vs Multiplicity; V_{Z} (cm); Multiplicity"}, {kPoszVsCent, o2::framework::kTH2F, "hPoszVsCent", "Vertex Z vs Centrality; V_{Z} (cm); Centrality (%)"}, @@ -75,29 +75,50 @@ constexpr std::array, kColHistLast> HistTable = { {kCentVsSphericity, o2::framework::kTH2F, "hCentVsSphericity", "Centrality vs Sphericity; Centrality (%); Sphericity"}, }}; -template -auto makeColHistSpecMap(const BinningStruct& binning) +template +auto makeColHistSpecMap(const T& confBinningAnalysis) { return std::map>{ - {kPosZ, {binning.vtZ}}, - {kMult, {binning.mult}}, - {kCent, {binning.cent}}, - {kSphericity, {binning.spher}}, - {kMagField, {binning.magField}}, - {kPoszVsMult, {binning.vtZ, binning.mult}}, - {kPoszVsCent, {binning.vtZ, binning.cent}}, - {kCentVsMult, {binning.cent, binning.mult}}, - {kMultVsSphericity, {binning.mult, binning.spher}}, - {kCentVsSphericity, {binning.cent, binning.spher}}}; + {kPosZ, {confBinningAnalysis.vtxZ}}, + {kMult, {confBinningAnalysis.mult}}, + {kCent, {confBinningAnalysis.cent}}, + {kMagField, {confBinningAnalysis.magField}}}; +} + +template +auto makeColQaHistSpecMap(const T1& confBinningAnalysis, const T2& confBinningQa) +{ + return std::map>{ + {kPosZ, {confBinningAnalysis.vtxZ}}, + {kMult, {confBinningAnalysis.mult}}, + {kCent, {confBinningAnalysis.cent}}, + {kMagField, {confBinningAnalysis.magField}}, + {kPosX, {confBinningQa.vtxXY}}, + {kPosY, {confBinningQa.vtxXY}}, + {kPos, {confBinningQa.vtx}}, + {kSphericity, {confBinningQa.sphericity}}, + {kOccupancy, {confBinningQa.occupancy}}, + {kPoszVsMult, {confBinningAnalysis.vtxZ, confBinningAnalysis.mult}}, + {kPoszVsCent, {confBinningAnalysis.vtxZ, confBinningAnalysis.cent}}, + {kCentVsMult, {confBinningAnalysis.cent, confBinningAnalysis.mult}}, + {kMultVsSphericity, {confBinningAnalysis.mult, confBinningQa.sphericity}}, + {kCentVsSphericity, {confBinningAnalysis.cent, confBinningQa.sphericity}}}; } struct ConfCollisionBinning : o2::framework::ConfigurableGroup { std::string prefix = std::string("CollisionBinning"); - o2::framework::ConfigurableAxis vtZ{"vtZ", {200, -10, 10}, "Vertex Z binning"}; + o2::framework::ConfigurableAxis vtxZ{"vtxZ", {200, -10, 10}, "Vertex Z binning"}; o2::framework::ConfigurableAxis mult{"mult", {200, 0, 200}, "Multiplicity binning"}; o2::framework::ConfigurableAxis cent{"cent", {100, 0.0f, 100.0f}, "Centrality (multiplicity percentile) binning"}; - o2::framework::ConfigurableAxis spher{"spher", {200, 0.0f, 2.0f}, "Sphericity binning"}; - o2::framework::ConfigurableAxis magField{"magField", {2, -1, 1}, "Magnetic field binning"}; + o2::framework::ConfigurableAxis magField{"magField", {11, -5.5, 5.5}, "Magnetic field binning"}; +}; + +struct ConfCollisionQaBinning : o2::framework::ConfigurableGroup { + std::string prefix = std::string("CollisionQaBinning"); + o2::framework::ConfigurableAxis vtx{"vtx", {120, 0.f, 12.f}, "Vertex position binning"}; + o2::framework::ConfigurableAxis vtxXY{"vtxXY", {100, -1.f, 1.f}, "Vertex X/Y binning"}; + o2::framework::ConfigurableAxis sphericity{"sphericity", {100, 0.f, 1.f}, "Spericity Binning"}; + o2::framework::ConfigurableAxis occupancy{"occupancy", {500, 0.f, 5000.f}, "Spericity Binning"}; }; template @@ -116,18 +137,22 @@ class CollisionHistManager mHistogramRegistry->add(analysisDir + GetHistNamev2(kPosZ, HistTable), GetHistDesc(kPosZ, HistTable), GetHistType(kPosZ, HistTable), {Specs[kPosZ]}); mHistogramRegistry->add(analysisDir + GetHistNamev2(kMult, HistTable), GetHistDesc(kMult, HistTable), GetHistType(kMult, HistTable), {Specs[kMult]}); mHistogramRegistry->add(analysisDir + GetHistNamev2(kCent, HistTable), GetHistDesc(kCent, HistTable), GetHistType(kCent, HistTable), {Specs[kCent]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kSphericity, HistTable), GetHistDesc(kSphericity, HistTable), GetHistType(kSphericity, HistTable), {Specs[kSphericity]}); mHistogramRegistry->add(analysisDir + GetHistNamev2(kMagField, HistTable), GetHistDesc(kMagField, HistTable), GetHistType(kMagField, HistTable), {Specs[kMagField]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kPoszVsMult, HistTable), GetHistDesc(kPoszVsMult, HistTable), GetHistType(kPoszVsMult, HistTable), {Specs[kPoszVsMult]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kPoszVsCent, HistTable), GetHistDesc(kPoszVsCent, HistTable), GetHistType(kPoszVsCent, HistTable), {Specs[kPoszVsCent]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kCentVsMult, HistTable), GetHistDesc(kCentVsMult, HistTable), GetHistType(kCentVsMult, HistTable), {Specs[kCentVsMult]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kMultVsSphericity, HistTable), GetHistDesc(kMultVsSphericity, HistTable), GetHistType(kMultVsSphericity, HistTable), {Specs[kMultVsSphericity]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kCentVsSphericity, HistTable), GetHistDesc(kCentVsSphericity, HistTable), GetHistType(kCentVsSphericity, HistTable), {Specs[kCentVsSphericity]}); } if constexpr (isFlagSet(mode, modes::Mode::kQa)) { std::string qaDir = std::string(ColQaDir); - // to be implemented + + mHistogramRegistry->add(qaDir + GetHistNamev2(kPosX, HistTable), GetHistDesc(kPosX, HistTable), GetHistType(kPosX, HistTable), {Specs[kPosX]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPosY, HistTable), GetHistDesc(kPosY, HistTable), GetHistType(kPosY, HistTable), {Specs[kPosY]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPos, HistTable), GetHistDesc(kPos, HistTable), GetHistType(kPos, HistTable), {Specs[kPos]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kSphericity, HistTable), GetHistDesc(kSphericity, HistTable), GetHistType(kSphericity, HistTable), {Specs[kSphericity]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kOccupancy, HistTable), GetHistDesc(kOccupancy, HistTable), GetHistType(kOccupancy, HistTable), {Specs[kOccupancy]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPoszVsMult, HistTable), GetHistDesc(kPoszVsMult, HistTable), GetHistType(kPoszVsMult, HistTable), {Specs[kPoszVsMult]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kPoszVsCent, HistTable), GetHistDesc(kPoszVsCent, HistTable), GetHistType(kPoszVsCent, HistTable), {Specs[kPoszVsCent]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kCentVsMult, HistTable), GetHistDesc(kCentVsMult, HistTable), GetHistType(kCentVsMult, HistTable), {Specs[kCentVsMult]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kMultVsSphericity, HistTable), GetHistDesc(kMultVsSphericity, HistTable), GetHistType(kMultVsSphericity, HistTable), {Specs[kMultVsSphericity]}); + mHistogramRegistry->add(qaDir + GetHistNamev2(kCentVsSphericity, HistTable), GetHistDesc(kCentVsSphericity, HistTable), GetHistType(kCentVsSphericity, HistTable), {Specs[kCentVsSphericity]}); } } // namespace o2::analysis::femtounited @@ -138,17 +163,20 @@ class CollisionHistManager mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kPosZ, HistTable)), col.posZ()); mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kMult, HistTable)), col.mult()); mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kCent, HistTable)), col.cent()); - mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kSphericity, HistTable)), col.sphericity()); mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kMagField, HistTable)), col.magField()); - mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kPoszVsMult, HistTable)), col.posZ(), col.mult()); - mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kPoszVsCent, HistTable)), col.posZ(), col.cent()); - mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kCentVsMult, HistTable)), col.cent(), col.mult()); - mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kMultVsSphericity, HistTable)), col.mult(), col.sphericity()); - mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kCentVsSphericity, HistTable)), col.cent(), col.sphericity()); } if constexpr (isFlagSet(mode, modes::Mode::kQa)) { - // to be implemented + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(GetHistName(kPosX, HistTable)), col.posX()); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(GetHistName(kPosY, HistTable)), col.posY()); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(GetHistName(kPos, HistTable)), std::hypot(col.posX(), col.posY(), col.posZ())); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(GetHistName(kSphericity, HistTable)), col.sphericity()); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(GetHistName(kOccupancy, HistTable)), col.trackOccupancyInTimeRange()); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(GetHistName(kPoszVsMult, HistTable)), col.posZ(), col.mult()); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(GetHistName(kPoszVsCent, HistTable)), col.posZ(), col.cent()); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(GetHistName(kCentVsMult, HistTable)), col.cent(), col.mult()); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(GetHistName(kMultVsSphericity, HistTable)), col.mult(), col.sphericity()); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(GetHistName(kCentVsSphericity, HistTable)), col.cent(), col.sphericity()); } } diff --git a/PWGCF/Femto/Core/femtoUtils.h b/PWGCF/Femto/Core/femtoUtils.h index fb082ae96fa..e13bcfdd379 100644 --- a/PWGCF/Femto/Core/femtoUtils.h +++ b/PWGCF/Femto/Core/femtoUtils.h @@ -167,9 +167,9 @@ float qn(T const& col) return qn; } -inline std::optional dphistar(float magfield, float radius, float sign, float pt, float phi) +inline std::optional dphistar(float magfield, float radius, float signedPt, float phi) { - float arg = 0.3f * sign * magfield * radius * 0.01f / (2.f * pt); + float arg = 0.3f * (0.1f * magfield) * (0.01 * radius) / (2.f * signedPt); if (std::fabs(arg) < 1.f) { return phi - std::asin(arg); } diff --git a/PWGCF/Femto/Core/kinkBuilder.h b/PWGCF/Femto/Core/kinkBuilder.h index 33a843dee0a..f9f3581da3f 100644 --- a/PWGCF/Femto/Core/kinkBuilder.h +++ b/PWGCF/Femto/Core/kinkBuilder.h @@ -92,7 +92,7 @@ struct ConfSigmaBits : o2::framework::ConfigurableGroup { o2::framework::Configurable phiMax{"phiMax", 1.f * o2::constants::math::TwoPI, "Maximum phi"}; \ o2::framework::Configurable massMin{"massMin", defaultMassMin, "Minimum invariant mass for Sigma"}; \ o2::framework::Configurable massMax{"massMax", defaultMassMax, "Maximum invariant mass for Sigma"}; \ - o2::framework::Configurable mask{"mask", 0, "Bitmask for kink selection"}; + o2::framework::Configurable mask{"mask", 0x0, "Bitmask for kink selection"}; // base selection for analysis task for sigmas template diff --git a/PWGCF/Femto/Core/pairBuilder.h b/PWGCF/Femto/Core/pairBuilder.h index 1af5a169e24..8d2e9af0641 100644 --- a/PWGCF/Femto/Core/pairBuilder.h +++ b/PWGCF/Femto/Core/pairBuilder.h @@ -85,23 +85,23 @@ class PairTrackTrackBuilder mTrackHistManager1.init(registry, trackHistSpec1); mPairHistManagerSe.setMass(confTrackSelection1.pdgCode.value, confTrackSelection1.pdgCode.value); - mPairHistManagerSe.setCharge(confTrackSelection1.charge.value, confTrackSelection1.charge.value); - mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.charge.value, confTrackSelection1.charge.value, confCpr.on.value); + mPairHistManagerSe.setCharge(confTrackSelection1.chargeAbs.value, confTrackSelection1.chargeAbs.value); + mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.chargeAbs.value, confTrackSelection1.chargeAbs.value, confCpr.on.value); mPairHistManagerMe.setMass(confTrackSelection1.pdgCode.value, confTrackSelection1.pdgCode.value); - mPairHistManagerMe.setCharge(confTrackSelection1.charge.value, confTrackSelection1.charge.value); - mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.charge.value, confTrackSelection1.charge.value, confCpr.on.value); + mPairHistManagerMe.setCharge(confTrackSelection1.chargeAbs.value, confTrackSelection1.chargeAbs.value); + mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.chargeAbs.value, confTrackSelection1.chargeAbs.value, confCpr.on.value); } else { mTrackHistManager1.init(registry, trackHistSpec1); mTrackHistManager2.init(registry, trackHistSpec2); mPairHistManagerSe.setMass(confTrackSelection1.pdgCode.value, confTrackSelection2.pdgCode.value); - mPairHistManagerSe.setCharge(confTrackSelection1.charge.value, confTrackSelection2.charge.value); - mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.charge.value, confTrackSelection2.charge.value, confCpr.on.value); + mPairHistManagerSe.setCharge(confTrackSelection1.chargeAbs.value, confTrackSelection2.chargeAbs.value); + mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.chargeAbs.value, confTrackSelection2.chargeAbs.value, confCpr.on.value); mPairHistManagerMe.setMass(confTrackSelection1.pdgCode.value, confTrackSelection2.pdgCode.value); - mPairHistManagerMe.setCharge(confTrackSelection1.charge.value, confTrackSelection2.charge.value); - mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.charge.value, confTrackSelection2.charge.value, confCpr.on.value); + mPairHistManagerMe.setCharge(confTrackSelection1.chargeAbs.value, confTrackSelection2.chargeAbs.value); + mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.chargeAbs.value, confTrackSelection2.chargeAbs.value, confCpr.on.value); } // setup mixing @@ -125,7 +125,7 @@ class PairTrackTrackBuilder void processSameEvent(T1 const& col, T2& /*trackTable*/, T3& partition1, T4& partition2, T5& cache) { if (mSameSpecies) { - auto trackSlice1 = partition1->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto trackSlice1 = partition1->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); if (trackSlice1.size() == 0) { return; } @@ -133,8 +133,8 @@ class PairTrackTrackBuilder mCprSe.setMagField(col.magField()); pairprocesshelpers::processSameEvent(trackSlice1, mTrackHistManager1, mPairHistManagerSe, mCprSe, mRng, mMixIdenticalParticles); } else { - auto trackSlice1 = partition1->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); - auto trackSlice2 = partition2->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto trackSlice1 = partition1->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto trackSlice2 = partition2->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); if (trackSlice1.size() == 0 || trackSlice2.size() == 0) { return; } @@ -242,13 +242,13 @@ class PairTrackV0Builder mPairHistManagerSe.init(registry, pairHistSpec); mPairHistManagerSe.setMass(confTrackSelection.pdgCode.value, confV0Selection.pdgCode.value); - mPairHistManagerSe.setCharge(confTrackSelection.charge.value, 1); - mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.charge.value, confCpr.on.value); + mPairHistManagerSe.setCharge(confTrackSelection.chargeAbs.value, 1); + mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); mPairHistManagerMe.init(registry, pairHistSpec); mPairHistManagerMe.setMass(confTrackSelection.pdgCode.value, confV0Selection.pdgCode.value); - mPairHistManagerMe.setCharge(confTrackSelection.charge.value, 1); - mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.charge.value, confCpr.on.value); + mPairHistManagerMe.setCharge(confTrackSelection.chargeAbs.value, 1); + mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); // setup mixing mMixingPolicy = static_cast(confMixing.policy.value); @@ -258,8 +258,8 @@ class PairTrackV0Builder template void processSameEvent(T1 const& col, T2& trackTable, T3& trackPartition, T4& /*v0table*/, T5& v0Partition, T6& cache) { - auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); - auto v0Slice = v0Partition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto v0Slice = v0Partition->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); if (trackSlice.size() == 0 || v0Slice.size() == 0) { return; } @@ -346,13 +346,13 @@ class PairTrackTwoTrackResonanceBuilder mPairHistManagerSe.init(registry, pairHistSpec); mPairHistManagerSe.setMass(confTrackSelection.pdgCode.value, confResonanceSelection.pdgCode.value); - mPairHistManagerSe.setCharge(confTrackSelection.charge.value, 1); - mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.charge.value, confCpr.on.value); + mPairHistManagerSe.setCharge(confTrackSelection.chargeAbs.value, 1); + mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); mPairHistManagerMe.init(registry, pairHistSpec); mPairHistManagerMe.setMass(confTrackSelection.pdgCode.value, confResonanceSelection.pdgCode.value); - mPairHistManagerMe.setCharge(confTrackSelection.charge.value, 1); - mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.charge.value, confCpr.on.value); + mPairHistManagerMe.setCharge(confTrackSelection.chargeAbs.value, 1); + mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); // setup mixing mMixingPolicy = static_cast(confMixing.policy.value); @@ -362,8 +362,8 @@ class PairTrackTwoTrackResonanceBuilder template void processSameEvent(T1 const& col, T2& trackTable, T3& trackPartition, T4& /*resonanceTable*/, T5& resonancePartition, T6& cache) { - auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); - auto v0Slice = resonancePartition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto v0Slice = resonancePartition->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); if (trackSlice.size() == 0 || v0Slice.size() == 0) { return; } @@ -447,13 +447,13 @@ class PairTrackKinkBuilder mPairHistManagerSe.init(registry, pairHistSpec); mPairHistManagerSe.setMass(confTrackSelection.pdgCode.value, confKinkSelection.pdgCode.value); - mPairHistManagerSe.setCharge(confTrackSelection.charge.value, confKinkSelection.sign.value); - mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.charge.value, confKinkSelection.sign.value, confCpr.on.value); + mPairHistManagerSe.setCharge(confTrackSelection.chargeAbs.value, confKinkSelection.sign.value); + mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); mPairHistManagerMe.init(registry, pairHistSpec); mPairHistManagerMe.setMass(confTrackSelection.pdgCode.value, confKinkSelection.pdgCode.value); - mPairHistManagerMe.setCharge(confTrackSelection.charge.value, confKinkSelection.sign.value); - mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.charge.value, confKinkSelection.sign.value, confCpr.on.value); + mPairHistManagerMe.setCharge(confTrackSelection.chargeAbs.value, confKinkSelection.sign.value); + mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); // setup mixing mMixingPolicy = static_cast(confMixing.policy.value); @@ -463,8 +463,8 @@ class PairTrackKinkBuilder template void processSameEvent(T1 const& col, T2& trackTable, T3& trackPartition, T4& /*kinktable*/, T5& kinkPartition, T6& cache) { - auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); - auto kinkSlice = kinkPartition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto kinkSlice = kinkPartition->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); if (trackSlice.size() == 0 || kinkSlice.size() == 0) { return; } @@ -554,13 +554,13 @@ class PairTrackCascadeBuilder mPairHistManagerSe.init(registry, pairHistSpec); mPairHistManagerSe.setMass(confTrackSelection.pdgCode.value, confCascadeSelection.pdgCode.value); - mPairHistManagerSe.setCharge(confTrackSelection.charge.value, confCascadeSelection.sign.value); - mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.charge.value, confCascadeSelection.sign.value, confCpr.on.value); + mPairHistManagerSe.setCharge(confTrackSelection.chargeAbs.value, confCascadeSelection.sign.value); + mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); mPairHistManagerMe.init(registry, pairHistSpec); mPairHistManagerMe.setMass(confTrackSelection.pdgCode.value, confCascadeSelection.pdgCode.value); - mPairHistManagerMe.setCharge(confTrackSelection.charge.value, confCascadeSelection.sign.value); - mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.charge.value, confCascadeSelection.sign.value, confCpr.on.value); + mPairHistManagerMe.setCharge(confTrackSelection.chargeAbs.value, confCascadeSelection.sign.value); + mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); // setup mixing mMixingPolicy = static_cast(confMixing.policy.value); @@ -570,8 +570,8 @@ class PairTrackCascadeBuilder template void processSameEvent(T1 const& col, T2& trackTable, T3& trackPartition, T4& /*cascadeTable*/, T5& v0Partition, T6& cache) { - auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); - auto v0Slice = v0Partition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto v0Slice = v0Partition->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); if (trackSlice.size() == 0 || v0Slice.size() == 0) { return; } diff --git a/PWGCF/Femto/Core/pairHistManager.h b/PWGCF/Femto/Core/pairHistManager.h index 8b5856ad208..0e0862499f4 100644 --- a/PWGCF/Femto/Core/pairHistManager.h +++ b/PWGCF/Femto/Core/pairHistManager.h @@ -49,7 +49,7 @@ enum PairHist { kKstar, kKt, kMt, - // 2d qa + // 2d kPt1VsPt2, kPt1VsKstar, kPt2VsKstar, @@ -58,6 +58,7 @@ enum PairHist { kPt1VsMt, kPt2VsMt, kPairHistogramLast + // more dimensions }; enum MixingPoliciy { @@ -170,12 +171,12 @@ class PairHistManager mMass1 = o2::analysis::femto::utils::getMass(PdgParticle1); mMass2 = o2::analysis::femto::utils::getMass(PdgParticle2); } - void setCharge(int chargeParticle1, int chargeParticle2) + void setCharge(int chargeAbsParticle1, int chargeAbsParticle2) { // the pt stored is actually pt/z, so in case of particles with z > 1, we have to rescale the pt (this is so far only for He3 the case) // similarly, for neutral particles, no reason to rescale so we just set absolute charge to 1 - mAbsCharge1 = std::abs(chargeParticle1 == 0 ? 1 : chargeParticle1); - mAbsCharge2 = std::abs(chargeParticle2 == 0 ? 1 : chargeParticle2); + mAbsCharge1 = chargeAbsParticle1; + mAbsCharge2 = chargeAbsParticle2; } template diff --git a/PWGCF/Femto/Core/pairProcessHelpers.h b/PWGCF/Femto/Core/pairProcessHelpers.h index df96b056c16..f2f1debbd2a 100644 --- a/PWGCF/Femto/Core/pairProcessHelpers.h +++ b/PWGCF/Femto/Core/pairProcessHelpers.h @@ -181,8 +181,8 @@ void processMixedEvent(T1& Collisions, continue; } CprManager.setMagField(collision1.magField()); - auto sliceParticle1 = Partition->sliceByCached(o2::aod::femtobase::stored::collisionId, collision1.globalIndex(), cache); - auto sliceParticle2 = Partition->sliceByCached(o2::aod::femtobase::stored::collisionId, collision2.globalIndex(), cache); + auto sliceParticle1 = Partition->sliceByCached(o2::aod::femtobase::stored::fColId, collision1.globalIndex(), cache); + auto sliceParticle2 = Partition->sliceByCached(o2::aod::femtobase::stored::fColId, collision2.globalIndex(), cache); if (sliceParticle1.size() == 0 || sliceParticle2.size() == 0) { continue; } @@ -230,8 +230,8 @@ void processMixedEvent(T1& Collisions, continue; } CprManager.setMagField(collision1.magField()); - auto sliceParticle1 = Partition1->sliceByCached(o2::aod::femtobase::stored::collisionId, collision1.globalIndex(), cache); - auto sliceParticle2 = Partition2->sliceByCached(o2::aod::femtobase::stored::collisionId, collision2.globalIndex(), cache); + auto sliceParticle1 = Partition1->sliceByCached(o2::aod::femtobase::stored::fColId, collision1.globalIndex(), cache); + auto sliceParticle2 = Partition2->sliceByCached(o2::aod::femtobase::stored::fColId, collision2.globalIndex(), cache); if (sliceParticle1.size() == 0 || sliceParticle2.size() == 0) { continue; } @@ -281,8 +281,8 @@ void processMixedEvent(T1& Collisions, continue; } CprManager.setMagField(collision1.magField()); - auto sliceParticle1 = Partition1->sliceByCached(o2::aod::femtobase::stored::collisionId, collision1.globalIndex(), cache); - auto sliceParticle2 = Partition2->sliceByCached(o2::aod::femtobase::stored::collisionId, collision2.globalIndex(), cache); + auto sliceParticle1 = Partition1->sliceByCached(o2::aod::femtobase::stored::fColId, collision1.globalIndex(), cache); + auto sliceParticle2 = Partition2->sliceByCached(o2::aod::femtobase::stored::fColId, collision2.globalIndex(), cache); if (sliceParticle1.size() == 0 || sliceParticle2.size() == 0) { continue; } diff --git a/PWGCF/Femto/Core/partitions.h b/PWGCF/Femto/Core/partitions.h index 7cc40b5ffdf..f1d3775cfd0 100644 --- a/PWGCF/Femto/Core/partitions.h +++ b/PWGCF/Femto/Core/partitions.h @@ -17,25 +17,24 @@ #define PWGCF_FEMTO_CORE_PARTITIONS_H_ // collsion selection -#define MAKE_COLLISION_FILTER(selection) \ - (femtocollisions::posZ >= selection.vtxZMin && femtocollisions::posZ <= selection.vtxZMax) && \ - (femtocollisions::mult >= selection.multMin && femtocollisions::mult <= selection.multMax) && \ - (femtocollisions::cent >= selection.centMin && femtocollisions::cent <= selection.centMax) && \ - (femtocollisions::sphericity >= selection.spherMin && femtocollisions::sphericity <= selection.spherMax) && \ - (femtocollisions::magField >= selection.magFieldMin && femtocollisions::magField <= selection.magFieldMax) && \ +#define MAKE_COLLISION_FILTER(selection) \ + (femtocollisions::posZ >= selection.vtxZMin && femtocollisions::posZ <= selection.vtxZMax) && \ + (femtocollisions::mult >= selection.multMin && femtocollisions::mult <= selection.multMax) && \ + (femtocollisions::cent >= selection.centMin && femtocollisions::cent <= selection.centMax) && \ + (femtocollisions::magField >= static_cast(selection.magFieldMin) && femtocollisions::magField <= static_cast(selection.magFieldMax)) && \ ncheckbit(femtocollisions::collisionMask, selection.collisionMask) // standard track partition -#define MAKE_TRACK_PARTITION(selection) \ - ifnode(selection.charge.node() > 0, femtobase::stored::signedPt > 0.f, femtobase::stored::signedPt < 0.f) && \ - (nabs(selection.charge.node() * femtobase::stored::signedPt) > selection.ptMin) && \ - (nabs(selection.charge.node() * femtobase::stored::signedPt) < selection.ptMax) && \ - (femtobase::stored::eta > selection.etaMin) && \ - (femtobase::stored::eta < selection.etaMax) && \ - (femtobase::stored::phi > selection.phiMin) && \ - (femtobase::stored::phi < selection.phiMax) && \ - ifnode(nabs(selection.charge.node() * femtobase::stored::signedPt) * (nexp(femtobase::stored::eta) + nexp(-1.f * femtobase::stored::eta)) / (2.f) <= selection.pidThres, \ - ncheckbit(femtotracks::trackMask, selection.maskLowMomentum), \ +#define MAKE_TRACK_PARTITION(selection) \ + ifnode(selection.chargeSign.node() != 0, ifnode(selection.chargeSign.node() > 0, femtobase::stored::signedPt > 0.f, femtobase::stored::signedPt < 0.f), true) && \ + (nabs(selection.chargeAbs.node() * femtobase::stored::signedPt) > selection.ptMin) && \ + (nabs(selection.chargeAbs.node() * femtobase::stored::signedPt) < selection.ptMax) && \ + (femtobase::stored::eta > selection.etaMin) && \ + (femtobase::stored::eta < selection.etaMax) && \ + (femtobase::stored::phi > selection.phiMin) && \ + (femtobase::stored::phi < selection.phiMax) && \ + ifnode(nabs(selection.chargeAbs.node() * femtobase::stored::signedPt) * (nexp(femtobase::stored::eta) + nexp(-1.f * femtobase::stored::eta)) / (2.f) <= selection.pidThres, \ + ncheckbit(femtotracks::trackMask, selection.maskLowMomentum), \ ncheckbit(femtotracks::trackMask, selection.maskHighMomentum)) // partition for phis and rhos, i.e. resonance that are their own antiparticle @@ -56,34 +55,36 @@ ncheckbit(femtotwotrackresonances::mask, selection.negDauMaskBelowThres)) // partition for kstars, they have distinct antiparticle -#define MAKE_RESONANCE_1_PARTITON(selection) \ - ifnode(selection.sign.node() > 0, femtobase::stored::signedPt > 0.f, femtobase::stored::signedPt < 0.f) && \ - (nabs(femtobase::stored::signedPt) > selection.ptMin) && \ - (nabs(femtobase::stored::signedPt) < selection.ptMax) && \ - (femtobase::stored::eta > selection.etaMin) && \ - (femtobase::stored::eta < selection.etaMax) && \ - (femtobase::stored::phi > selection.phiMin) && \ - (femtobase::stored::phi < selection.phiMax) && \ - (femtobase::stored::mass > selection.massMin) && \ - (femtobase::stored::mass < selection.massMax) && \ - ifnode(ncheckbit(femtotwotrackresonances::mask, selection.posDauBitForThres), \ - ncheckbit(femtotwotrackresonances::mask, selection.posDauMaskAboveThres), \ - ncheckbit(femtotwotrackresonances::mask, selection.posDauMaskBelowThres)) && \ - ifnode(ncheckbit(femtotwotrackresonances::mask, selection.negDauBitForThres), \ - ncheckbit(femtotwotrackresonances::mask, selection.negDauMaskAboveThres), \ +#define MAKE_RESONANCE_1_PARTITON(selection) \ + ifnode(selection.sign.node() != 0, \ + ifnode(selection.sign.node() > 0, femtobase::stored::signedPt > 0.f, femtobase::stored::signedPt < 0.f), true) && \ + (nabs(femtobase::stored::signedPt) > selection.ptMin) && \ + (nabs(femtobase::stored::signedPt) < selection.ptMax) && \ + (femtobase::stored::eta > selection.etaMin) && \ + (femtobase::stored::eta < selection.etaMax) && \ + (femtobase::stored::phi > selection.phiMin) && \ + (femtobase::stored::phi < selection.phiMax) && \ + (femtobase::stored::mass > selection.massMin) && \ + (femtobase::stored::mass < selection.massMax) && \ + ifnode(ncheckbit(femtotwotrackresonances::mask, selection.posDauBitForThres), \ + ncheckbit(femtotwotrackresonances::mask, selection.posDauMaskAboveThres), \ + ncheckbit(femtotwotrackresonances::mask, selection.posDauMaskBelowThres)) && \ + ifnode(ncheckbit(femtotwotrackresonances::mask, selection.negDauBitForThres), \ + ncheckbit(femtotwotrackresonances::mask, selection.negDauMaskAboveThres), \ ncheckbit(femtotwotrackresonances::mask, selection.negDauMaskBelowThres)) // partition for lambdas -#define MAKE_LAMBDA_PARTITION(selection) \ - ifnode(selection.sign.node() > 0, femtobase::stored::signedPt > 0.f, femtobase::stored::signedPt < 0.f) && \ - (nabs(femtobase::stored::signedPt) > selection.ptMin) && \ - (nabs(femtobase::stored::signedPt) < selection.ptMax) && \ - (femtobase::stored::eta > selection.etaMin) && \ - (femtobase::stored::eta < selection.etaMax) && \ - (femtobase::stored::phi > selection.phiMin) && \ - (femtobase::stored::phi < selection.phiMax) && \ - (femtobase::stored::mass > selection.massMin) && \ - (femtobase::stored::mass < selection.massMax) && \ +#define MAKE_LAMBDA_PARTITION(selection) \ + ifnode(selection.sign.node() != 0, \ + ifnode(selection.sign.node() > 0, femtobase::stored::signedPt > 0.f, femtobase::stored::signedPt < 0.f), true) && \ + (nabs(femtobase::stored::signedPt) > selection.ptMin) && \ + (nabs(femtobase::stored::signedPt) < selection.ptMax) && \ + (femtobase::stored::eta > selection.etaMin) && \ + (femtobase::stored::eta < selection.etaMax) && \ + (femtobase::stored::phi > selection.phiMin) && \ + (femtobase::stored::phi < selection.phiMax) && \ + (femtobase::stored::mass > selection.massMin) && \ + (femtobase::stored::mass < selection.massMax) && \ ncheckbit(femtov0s::mask, selection.mask) // partition for k0shorts @@ -99,28 +100,30 @@ (femtobase::stored::mass < selection.massMax) && \ ncheckbit(femtov0s::mask, selection.mask) -#define MAKE_CASCADE_PARTITION(selection) \ - ifnode(selection.sign.node() > 0, femtobase::stored::signedPt > 0.f, femtobase::stored::signedPt < 0.f) && \ - (nabs(femtobase::stored::signedPt) > selection.ptMin) && \ - (nabs(femtobase::stored::signedPt) < selection.ptMax) && \ - (femtobase::stored::eta > selection.etaMin) && \ - (femtobase::stored::eta < selection.etaMax) && \ - (femtobase::stored::phi > selection.phiMin) && \ - (femtobase::stored::phi < selection.phiMax) && \ - (femtobase::stored::mass > selection.massMin) && \ - (femtobase::stored::mass < selection.massMax) && \ +#define MAKE_CASCADE_PARTITION(selection) \ + ifnode(selection.sign.node() != 0, \ + ifnode(selection.sign.node() > 0, femtobase::stored::signedPt > 0.f, femtobase::stored::signedPt < 0.f), true) && \ + (nabs(femtobase::stored::signedPt) > selection.ptMin) && \ + (nabs(femtobase::stored::signedPt) < selection.ptMax) && \ + (femtobase::stored::eta > selection.etaMin) && \ + (femtobase::stored::eta < selection.etaMax) && \ + (femtobase::stored::phi > selection.phiMin) && \ + (femtobase::stored::phi < selection.phiMax) && \ + (femtobase::stored::mass > selection.massMin) && \ + (femtobase::stored::mass < selection.massMax) && \ ncheckbit(femtocascades::mask, selection.mask) -#define MAKE_SIGMA_PARTITION(selection) \ - ifnode(selection.sign.node() > 0, femtobase::stored::signedPt > 0.f, femtobase::stored::signedPt < 0.f) && \ - (nabs(femtobase::stored::signedPt) > selection.ptMin) && \ - (nabs(femtobase::stored::signedPt) < selection.ptMax) && \ - (femtobase::stored::eta > selection.etaMin) && \ - (femtobase::stored::eta < selection.etaMax) && \ - (femtobase::stored::phi > selection.phiMin) && \ - (femtobase::stored::phi < selection.phiMax) && \ - (femtobase::stored::mass > selection.massMin) && \ - (femtobase::stored::mass < selection.massMax) && \ +#define MAKE_SIGMA_PARTITION(selection) \ + ifnode(selection.sign.node() != 0, \ + ifnode(selection.sign.node() > 0, femtobase::stored::signedPt > 0.f, femtobase::stored::signedPt < 0.f), true) && \ + (nabs(femtobase::stored::signedPt) > selection.ptMin) && \ + (nabs(femtobase::stored::signedPt) < selection.ptMax) && \ + (femtobase::stored::eta > selection.etaMin) && \ + (femtobase::stored::eta < selection.etaMax) && \ + (femtobase::stored::phi > selection.phiMin) && \ + (femtobase::stored::phi < selection.phiMax) && \ + (femtobase::stored::mass > selection.massMin) && \ + (femtobase::stored::mass < selection.massMax) && \ ncheckbit(femtokinks::mask, selection.mask) #endif // PWGCF_FEMTO_CORE_PARTITIONS_H_ diff --git a/PWGCF/Femto/Core/trackBuilder.h b/PWGCF/Femto/Core/trackBuilder.h index e179e520c29..826ccbbc9ca 100644 --- a/PWGCF/Femto/Core/trackBuilder.h +++ b/PWGCF/Femto/Core/trackBuilder.h @@ -118,7 +118,8 @@ struct ConfTrackSelection : public o2::framework::ConfigurableGroup { std::string prefix = Prefix; // Unique prefix based on the template argument // configuration parameters o2::framework::Configurable pdgCode{"pdgCode", 2212, "Track PDG code"}; - o2::framework::Configurable charge{"charge", 1, "Charge of the track (use +/-1 for positive/negative tracks, except He3 needs +/-2)"}; + o2::framework::Configurable chargeAbs{"chargeAbs", 1, "Absolute value of charge (e.g. 1 for most tracks, 2 for He3)"}; + o2::framework::Configurable chargeSign{"chargeSign", 1, "Track charge sign: +1 for positive, -1 for negative, 0 for both"}; // filters for kinematics o2::framework::Configurable ptMin{"ptMin", 0.2f, "Minimum pT (GeV/c)"}; o2::framework::Configurable ptMax{"ptMax", 6.f, "Maximum pT (GeV/c)"}; @@ -127,8 +128,8 @@ struct ConfTrackSelection : public o2::framework::ConfigurableGroup { o2::framework::Configurable phiMin{"phiMin", 0.f, "Minimum phi"}; o2::framework::Configurable phiMax{"phiMax", 1.f * o2::constants::math::TwoPI, "Maximum phi"}; // track selection masks - o2::framework::Configurable maskLowMomentum{"maskLowMomentum", 2u, "Bitmask for selections below momentum threshold"}; - o2::framework::Configurable maskHighMomentum{"maskHighMomentum", 1u, "Bitmask for selections above momentum threshold"}; + o2::framework::Configurable maskLowMomentum{"maskLowMomentum", 0x2u, "Bitmask for selections below momentum threshold"}; + o2::framework::Configurable maskHighMomentum{"maskHighMomentum", 0x1u, "Bitmask for selections above momentum threshold"}; // momentum threshold for PID usage o2::framework::Configurable pidThres{"pidThres", 1.2f, "Momentum threshold for using TPCTOF/TOF pid for tracks with large momentum (GeV/c)"}; }; @@ -615,7 +616,87 @@ class TrackBuilder bool mProduceHeliumPids = false; }; +struct TrackBuilderDerivedToDerivedProducts : o2::framework::ProducesGroup { + o2::framework::Produces producedTracks; + o2::framework::Produces producedTrackMasks; +}; + +struct ConfTrackTablesDerivedToDerived : o2::framework::ConfigurableGroup { + std::string prefix = std::string("TrackTables"); + o2::framework::Configurable limitTrack1{"limitTrack1", 1, "At least this many tracks of type 1 need to be in the collision"}; + o2::framework::Configurable limitTrack2{"limitTrack2", 0, "At least this many tracks of type 2 need to be in the collision"}; +}; + +class TrackBuilderDerivedToDerived +{ + public: + TrackBuilderDerivedToDerived() = default; + ~TrackBuilderDerivedToDerived() = default; + + template + void init(T& config) + { + mLimitTrack1 = config.limitTrack1.value; + mLimitTrack2 = config.limitTrack2.value; + } + + template + bool collisionHasTooFewTracks(T1& col, T2& /*trackTable*/, T3& partitionTrack1, T4& partitionTrack2, T5& cache) + { + auto trackSlice1 = partitionTrack1->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto trackSlice2 = partitionTrack2->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + if (trackSlice1.size() >= mLimitTrack1 && trackSlice2.size() >= mLimitTrack2) { + return false; + } + return true; + } + + template + void processTracks(T1& col, T2& /*trackTable*/, T3& partitionTrack1, T4& partitionTrack2, T5& indexMap, T6& cache, T7& newTrackTable, T8& newCollisionTable) + { + auto trackSlice1 = partitionTrack1->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto trackSlice2 = partitionTrack2->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + + for (auto const& track : trackSlice1) { + this->fillTrack(track, newTrackTable, newCollisionTable, indexMap); + } + for (auto const& track : trackSlice2) { + this->fillTrack(track, newTrackTable, newCollisionTable, indexMap); + } + } + + template + void fillTrack(T1 const& track, T2& trackProducts, T3& collisionProducts, T4& indexMap) + { + trackProducts.producedTracks(collisionProducts.producedCollision.lastIndex(), + track.signedPt(), + track.eta(), + track.phi()); + trackProducts.producedTrackMasks(track.trackMask()); + indexMap.emplace(track.globalIndex(), trackProducts.producedTracks.lastIndex()); + } + + template + int64_t getDaughterIndex(const T1& daughter, T2& trackProducts, T3& collisionProducts, T4& indexMap) + { + auto result = utils::getIndex(daughter.globalIndex(), indexMap); + if (result) { + return result.value(); + } else { + this->fillTrack(daughter, trackProducts, collisionProducts, indexMap); + int64_t idx = trackProducts.producedTracks.lastIndex(); + indexMap.emplace(daughter.globalIndex(), idx); + return idx; + } + } + + private: + int mLimitTrack1 = 0; + int mLimitTrack2 = 0; +}; + } // namespace trackbuilder +// } // namespace o2::analysis::femto #endif // PWGCF_FEMTO_CORE_TRACKBUILDER_H_ diff --git a/PWGCF/Femto/Core/trackHistManager.h b/PWGCF/Femto/Core/trackHistManager.h index f77bf9a029f..3d3bd8ac6bb 100644 --- a/PWGCF/Femto/Core/trackHistManager.h +++ b/PWGCF/Femto/Core/trackHistManager.h @@ -413,10 +413,10 @@ class TrackHistManager /// Destructor virtual ~TrackHistManager() = default; - void init(o2::framework::HistogramRegistry* registry, std::map> Specs, float charge = 1, int momentumTypeForPid = 0) + void init(o2::framework::HistogramRegistry* registry, std::map> Specs, int absCharge = 1, int momentumTypeForPid = 0) { mHistogramRegistry = registry; - mAbsCharge = std::fabs(charge); // stored absolute charge of the track to scale the momentum in case of Z!=1 (case only for He3) + mAbsCharge = absCharge; // stored absolute charge of the track to scale the momentum in case of Z!=1 (case only for He3) if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { std::string analysisDir = std::string(prefix) + std::string(AnalysisDir); diff --git a/PWGCF/Femto/Core/twoTrackResonanceBuilder.h b/PWGCF/Femto/Core/twoTrackResonanceBuilder.h index e9bbeb0c245..69477f86666 100644 --- a/PWGCF/Femto/Core/twoTrackResonanceBuilder.h +++ b/PWGCF/Femto/Core/twoTrackResonanceBuilder.h @@ -127,22 +127,22 @@ struct ConfKstar0Bits : o2::framework::ConfigurableGroup { #undef TWOTRACKRESONANCE_KAONPID_BITS #undef TWOTRACKRESONANCE_PIONPID_BITS -#define TWOTRACKRESONANCE_DEFAULT_SELECTION(defaultPdgCode, defaultMassMin, defaultMassMax) \ - o2::framework::Configurable pdgCode{"pdgCode", defaultPdgCode, "Resonance PDG code"}; \ - o2::framework::Configurable ptMin{"ptMin", 0.f, "Minimum pT"}; \ - o2::framework::Configurable ptMax{"ptMax", 6.f, "Maximum pT"}; \ - o2::framework::Configurable etaMin{"etaMin", -0.9f, "Minimum eta"}; \ - o2::framework::Configurable etaMax{"etaMax", 0.9f, "Maximum eta"}; \ - o2::framework::Configurable phiMin{"phiMin", 0.f, "Minimum phi"}; \ - o2::framework::Configurable phiMax{"phiMax", 1.f * o2::constants::math::TwoPI, "Maximum phi"}; \ - o2::framework::Configurable massMin{"massMin", defaultMassMin, "Minimum invariant mass for Resonance"}; \ - o2::framework::Configurable massMax{"massMax", defaultMassMax, "Maximum invariant mass for Resonance"}; \ - o2::framework::Configurable posDauBitForThres{"posDauBitForThres", 32u, "Bit marking momentum threshold for positive daughter"}; \ - o2::framework::Configurable posDauMaskBelowThres{"posDauMaskBelowThres", 16u, "Bitmask for resonance selection"}; \ - o2::framework::Configurable posDauMaskAboveThres{"posDauMaskAboveThres", 8u, "Bitmask for resonance selection"}; \ - o2::framework::Configurable negDauBitForThres{"negDauBitForThres", 4u, "Bit marking resonance selection for negative daughter"}; \ - o2::framework::Configurable negDauMaskBelowThres{"negDauMaskBelowThres", 2u, "Bitmask for resonance selection"}; \ - o2::framework::Configurable negDauMaskAboveThres{"negDauMaskAboveThres", 1u, "Bitmask for resonance selection"}; +#define TWOTRACKRESONANCE_DEFAULT_SELECTION(defaultPdgCode, defaultMassMin, defaultMassMax) \ + o2::framework::Configurable pdgCode{"pdgCode", defaultPdgCode, "Resonance PDG code"}; \ + o2::framework::Configurable ptMin{"ptMin", 0.f, "Minimum pT"}; \ + o2::framework::Configurable ptMax{"ptMax", 6.f, "Maximum pT"}; \ + o2::framework::Configurable etaMin{"etaMin", -0.9f, "Minimum eta"}; \ + o2::framework::Configurable etaMax{"etaMax", 0.9f, "Maximum eta"}; \ + o2::framework::Configurable phiMin{"phiMin", 0.f, "Minimum phi"}; \ + o2::framework::Configurable phiMax{"phiMax", 1.f * o2::constants::math::TwoPI, "Maximum phi"}; \ + o2::framework::Configurable massMin{"massMin", defaultMassMin, "Minimum invariant mass for Resonance"}; \ + o2::framework::Configurable massMax{"massMax", defaultMassMax, "Maximum invariant mass for Resonance"}; \ + o2::framework::Configurable posDauBitForThres{"posDauBitForThres", 0x20u, "Bit marking momentum threshold for positive daughter"}; \ + o2::framework::Configurable posDauMaskBelowThres{"posDauMaskBelowThres", 0x10u, "Bitmask for positive daughter below threshold"}; \ + o2::framework::Configurable posDauMaskAboveThres{"posDauMaskAboveThres", 0x8u, "Bitmask for positive daughter above threshold"}; \ + o2::framework::Configurable negDauBitForThres{"negDauBitForThres", 0x4u, "Bit marking momentum threshold for negative daughter"}; \ + o2::framework::Configurable negDauMaskBelowThres{"negDauMaskBelowThres", 0x2u, "Bitmask for negative daughter below threshold"}; \ + o2::framework::Configurable negDauMaskAboveThres{"negDauMaskAboveThres", 0x1u, "Bitmask for negative daughter above threshold"}; struct ConfPhiSelection : o2::framework::ConfigurableGroup { std::string prefix = std::string("PhiSelection"); @@ -507,6 +507,7 @@ class TwoTrackResonanceBuilder if (!mFillAnyTable) { return; } + // combinations object ? for (auto const& positiveTrack : groupPositiveTracks) { for (auto const& negativeTrack : groupNegativeTracks) { this->fillResonance(collisionProducts, trackProducts, resonanceProducts, positiveTrack, negativeTrack, trackBuilder, indexMap); diff --git a/PWGCF/Femto/Core/v0Builder.h b/PWGCF/Femto/Core/v0Builder.h index 8f1faf319a2..305759070c2 100644 --- a/PWGCF/Femto/Core/v0Builder.h +++ b/PWGCF/Femto/Core/v0Builder.h @@ -110,7 +110,7 @@ template struct ConfLambdaSelection : o2::framework::ConfigurableGroup { std::string prefix = Prefix; V0_DEFAULT_SELECTIONS(1.0, 1.2, 3122) - o2::framework::Configurable sign{"sign", 1, "Sign of the Lambda (+1 for Lambda and -1 for Antilambda"}; + o2::framework::Configurable sign{"sign", 1, "Sign of the Lambda (+1: Lambda; -1: Antilambda; 0: both)"}; }; // base selection for analysis task for k0short @@ -123,9 +123,13 @@ struct ConfK0shortSelection : o2::framework::ConfigurableGroup { #undef V0_DEFAULT_SELECTIONS constexpr const char PrefixLambdaSelection1[] = "LambdaSelection1"; +constexpr const char PrefixLambdaSelection2[] = "LambdaSelection2"; using ConfLambdaSelection1 = ConfLambdaSelection; +using ConfLambdaSelection2 = ConfLambdaSelection; constexpr const char PrefixK0shortSelection1[] = "K0shortSelection1"; +constexpr const char PrefixK0shortSelection2[] = "K0shortSelection1"; using ConfK0shortSelection1 = ConfK0shortSelection; +using ConfK0shortSelection2 = ConfK0shortSelection; /// The different selections for v0s enum V0Seles { @@ -466,6 +470,106 @@ class V0Builder bool mProduceK0shortMasks = false; bool mProduceK0shortExtras = false; }; + +struct ConfV0TablesDerivedToDerived : o2::framework::ConfigurableGroup { + std::string prefix = std::string("V0Tables"); + o2::framework::Configurable limitLambda{"limitLambda", 1, "At least this many lambdas need to be in the collision"}; + o2::framework::Configurable limitK0short{"limitK0short", 0, "At least this many k0short need to be in the collision"}; +}; + +struct V0BuilderDerivedToDerivedProducts : o2::framework::ProducesGroup { + o2::framework::Produces producedLambdas; + o2::framework::Produces producedLambdaMasks; + o2::framework::Produces producedK0shorts; + o2::framework::Produces producedK0shortMasks; +}; + +class V0BuilderDerivedToDerived +{ + public: + V0BuilderDerivedToDerived() = default; + ~V0BuilderDerivedToDerived() = default; + + template + void init(T& config) + { + mLimitLambda = config.limitLambda.value; + mLimitK0short = config.limitK0short.value; + } + + template + bool collisionHasTooFewLambdas(T1& col, T2& /*lambdaTable*/, T3& partitionLambda, T4& cache) + { + auto lambdaSlice = partitionLambda->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + if (lambdaSlice.size() >= mLimitLambda) { + return false; + } + return true; + } + + template + bool collisionHasTooFewK0shorts(T1& col, T2& /*k0shortTable*/, T3& partitionK0short, T4& cache) + { + auto k0shortSlice = partitionK0short->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + if (k0shortSlice.size() >= mLimitK0short) { + return false; + } + return true; + } + + template + void processLambdas(T1& col, T2& /*lambdaTable*/, T3& /*oldTrackTable*/, T4& partitionLambda, T5& trackBuilder, T6& indexMap, T7& cache, T8& newLambdaTable, T9& newTrackTable, T10& newCollisionTable) + { + auto lambdaSlice = partitionLambda->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + + for (auto const& lambda : lambdaSlice) { + + auto posDaughter = lambda.template posDau_as(); + auto negDaughter = lambda.template negDau_as(); + + int posDaughterIndex = trackBuilder.getDaughterIndex(posDaughter, newTrackTable, newCollisionTable, indexMap); + int negDaughterIndex = trackBuilder.getDaughterIndex(negDaughter, newTrackTable, newCollisionTable, indexMap); + + newLambdaTable.producedLambdas(newCollisionTable.producedCollision.lastIndex(), + lambda.signedPt(), + lambda.eta(), + lambda.phi(), + lambda.mass(), + posDaughterIndex, + negDaughterIndex); + newLambdaTable.producedLambdaMasks(lambda.mask()); + } + } + + template + void processK0shorts(T1& col, T2& /*k0shortTable*/, T3& /*oldTrackTable*/, T4& partitionK0short, T5& trackBuilder, T6& indexMap, T7& cache, T8& newK0shortTable, T9& newTrackTable, T10& newCollisionTable) + { + auto k0shortSlice = partitionK0short->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + + for (auto const& k0short : k0shortSlice) { + + auto posDaughter = k0short.template posDau_as(); + auto negDaughter = k0short.template negDau_as(); + + int posDaughterIndex = trackBuilder.getDaughterIndex(posDaughter, newTrackTable, newCollisionTable, indexMap); + int negDaughterIndex = trackBuilder.getDaughterIndex(negDaughter, newTrackTable, newCollisionTable, indexMap); + + newK0shortTable.producedK0shorts(newCollisionTable.producedCollision.lastIndex(), + k0short.pt(), + k0short.eta(), + k0short.phi(), + k0short.mass(), + posDaughterIndex, + negDaughterIndex); + newK0shortTable.producedK0shortMasks(k0short.mask()); + } + } + + private: + int mLimitLambda = 0; + int mLimitK0short = 0; +}; + } // namespace v0builder } // namespace o2::analysis::femto #endif // PWGCF_FEMTO_CORE_V0BUILDER_H_ diff --git a/PWGCF/Femto/DataModel/FemtoTables.h b/PWGCF/Femto/DataModel/FemtoTables.h index 0756e3a91e1..2d288f13cbb 100644 --- a/PWGCF/Femto/DataModel/FemtoTables.h +++ b/PWGCF/Femto/DataModel/FemtoTables.h @@ -42,9 +42,9 @@ DECLARE_SOA_COLUMN(PosY, posY, float); //! y coordinate of vertex DECLARE_SOA_COLUMN(PosZ, posZ, float); //! z coordinate of vertex DECLARE_SOA_COLUMN(Mult, mult, float); //! Multiplicity estimator set by producer DECLARE_SOA_COLUMN(Cent, cent, float); //! Centrality (~= multiplicity percentile) estimator set by producer -DECLARE_SOA_COLUMN(MagField, magField, float); //! Magnetic field of the event +DECLARE_SOA_COLUMN(MagField, magField, int8_t); //! Magnetic field in kG (5 kG at normal configuration and 2kG in low B field configuration) DECLARE_SOA_COLUMN(Sphericity, sphericity, float); //! Sphericity of the event -DECLARE_SOA_COLUMN(Qn, qn, float); //! qn bins for dividing events +DECLARE_SOA_COLUMN(Qn, qn, float); //! qn bins for dividing eventsfemtab } // namespace femtocollisions // table for basic collision information @@ -53,14 +53,20 @@ DECLARE_SOA_TABLE_STAGED_VERSIONED(FCols_001, "FCOL", 1, //! femto collisions femtocollisions::PosZ, femtocollisions::Mult, femtocollisions::Cent, - femtocollisions::Sphericity, femtocollisions::MagField); using FCols = FCols_001; +using StoredFCols = StoredFCols_001; +using FCol = FCols::iterator; // needed so we can define the index column further down properly // table for collisions selections DECLARE_SOA_TABLE_STAGED_VERSIONED(FColMasks_001, "FCOLMASK", 1, //! track masks femtocollisions::CollisionMask); using FColMasks = FColMasks_001; +using StoredFColMasks = StoredFColMasks_001; + +DECLARE_SOA_TABLE_STAGED_VERSIONED(FColSphericities_001, "FCOLSPHERICITY", 1, //! sphericity + femtocollisions::Sphericity); +using FColSphericities = FColSphericities_001; // table for qn values DECLARE_SOA_TABLE_STAGED_VERSIONED(FColQns_001, "FCOLQN", 1, //! qn vector @@ -95,13 +101,13 @@ namespace femtobase namespace stored { // static columns -DECLARE_SOA_INDEX_COLUMN(Collision, collision); //! collision index -DECLARE_SOA_COLUMN(SignedPt, signedPt, float); //! signed pt -DECLARE_SOA_COLUMN(Pt, pt, float); //! pt -DECLARE_SOA_COLUMN(Eta, eta, float); //! eta -DECLARE_SOA_COLUMN(Phi, phi, float); //! phi -DECLARE_SOA_COLUMN(Mass, mass, float); //! mass of particle -DECLARE_SOA_COLUMN(MassAnti, massAnti, float); //! mass of antiparticle +DECLARE_SOA_INDEX_COLUMN(FCol, fCol); //! collision index of femto collision table +DECLARE_SOA_COLUMN(SignedPt, signedPt, float); //! signed pt +DECLARE_SOA_COLUMN(Pt, pt, float); //! pt +DECLARE_SOA_COLUMN(Eta, eta, float); //! eta +DECLARE_SOA_COLUMN(Phi, phi, float); //! phi +DECLARE_SOA_COLUMN(Mass, mass, float); //! mass of particle +DECLARE_SOA_COLUMN(MassAnti, massAnti, float); //! mass of antiparticle } // namespace stored namespace dynamic @@ -221,23 +227,25 @@ DECLARE_SOA_DYNAMIC_COLUMN(TpctofNSigmaHe, tpctofNSigmaHe, [](float tpc, float t // table for basic track information DECLARE_SOA_TABLE_STAGED_VERSIONED(FTracks_001, "FTRACK", 1, //! femto tracks o2::soa::Index<>, - femtobase::stored::CollisionId, + femtobase::stored::FColId, femtobase::stored::SignedPt, femtobase::stored::Eta, femtobase::stored::Phi, femtobase::dynamic::Sign, femtobase::dynamic::Pt, femtobase::dynamic::P, - femtobase::dynamic::Px, - femtobase::dynamic::Py, + femtobase::dynamic::Px, + femtobase::dynamic::Py, femtobase::dynamic::Pz, femtobase::dynamic::Theta); using FTracks = FTracks_001; +using StoredFTracks = StoredFTracks_001; // table for track selections and PID selections DECLARE_SOA_TABLE_STAGED_VERSIONED(FTrackMasks_001, "FTRACKMASK", 1, //! track masks femtotracks::TrackMask); using FTrackMasks = FTrackMasks_001; +using StoredFTrackMasks = StoredFTrackMasks_001; // table for track DCA DECLARE_SOA_TABLE_STAGED_VERSIONED(FTrackDcas_001, "FTRACKDCAS", 1, //! track dcas @@ -329,7 +337,7 @@ DECLARE_SOA_INDEX_COLUMN_FULL(NegDau, negDau, int32_t, FTracks, "_NegDau"); //! // table for phis DECLARE_SOA_TABLE_STAGED_VERSIONED(FPhis_001, "FPHI", 1, //! femto phis o2::soa::Index<>, - femtobase::stored::CollisionId, + femtobase::stored::FColId, femtobase::stored::Pt, femtobase::stored::Eta, femtobase::stored::Phi, @@ -337,8 +345,8 @@ DECLARE_SOA_TABLE_STAGED_VERSIONED(FPhis_001, "FPHI", 1, //! femto phis femtotwotrackresonances::PosDauId, femtotwotrackresonances::NegDauId, femtobase::dynamic::P, - femtobase::dynamic::Px, - femtobase::dynamic::Py, + femtobase::dynamic::Px, + femtobase::dynamic::Py, femtobase::dynamic::Pz, femtobase::dynamic::Theta); using FPhis = FPhis_001; @@ -349,7 +357,7 @@ using FPhiMasks = FPhiMasks_001; // table for kstars DECLARE_SOA_TABLE_STAGED_VERSIONED(FKstar0s_001, "FKSTAR0", 1, //! femto k0star o2::soa::Index<>, - femtobase::stored::CollisionId, + femtobase::stored::FColId, femtobase::stored::SignedPt, //! +1 for k0star and -1 for k0starbar femtobase::stored::Eta, femtobase::stored::Phi, @@ -359,8 +367,8 @@ DECLARE_SOA_TABLE_STAGED_VERSIONED(FKstar0s_001, "FKSTAR0", 1, //! femto k0star femtobase::dynamic::Sign, femtobase::dynamic::Pt, femtobase::dynamic::P, - femtobase::dynamic::Px, - femtobase::dynamic::Py, + femtobase::dynamic::Px, + femtobase::dynamic::Py, femtobase::dynamic::Pz, femtobase::dynamic::Theta); using FKstar0s = FKstar0s_001; @@ -370,7 +378,7 @@ using FKstar0Masks = FKstar0Masks_001; DECLARE_SOA_TABLE_STAGED_VERSIONED(FRho0s_001, "FRHO0", 1, //! femto rho0s o2::soa::Index<>, - femtobase::stored::CollisionId, + femtobase::stored::FColId, femtobase::stored::Pt, femtobase::stored::Eta, femtobase::stored::Phi, @@ -378,8 +386,8 @@ DECLARE_SOA_TABLE_STAGED_VERSIONED(FRho0s_001, "FRHO0", 1, //! femto rho0s femtotwotrackresonances::PosDauId, femtotwotrackresonances::NegDauId, femtobase::dynamic::P, - femtobase::dynamic::Px, - femtobase::dynamic::Py, + femtobase::dynamic::Px, + femtobase::dynamic::Py, femtobase::dynamic::Pz, femtobase::dynamic::Theta); using FRho0s = FRho0s_001; @@ -416,8 +424,8 @@ DECLARE_SOA_INDEX_COLUMN_FULL(NegDau, negDau, int32_t, FTracks, "_NegDau"); //! // table for basic lambda information DECLARE_SOA_TABLE_STAGED_VERSIONED(FLambdas_001, "FLAMBDA", 1, //! femto lambdas o2::soa::Index<>, - femtobase::stored::CollisionId, // use sign to differentiate between lambda (+1) and antilambda (-1) - femtobase::stored::SignedPt, + femtobase::stored::FColId, + femtobase::stored::SignedPt, // use sign to differentiate between lambda (+1) and antilambda (-1) femtobase::stored::Eta, femtobase::stored::Phi, femtobase::stored::Mass, // mass of the lambda/antilambda depending on the sign of the pt @@ -426,15 +434,17 @@ DECLARE_SOA_TABLE_STAGED_VERSIONED(FLambdas_001, "FLAMBDA", 1, //! femto lambdas femtobase::dynamic::Sign, femtobase::dynamic::Pt, femtobase::dynamic::P, - femtobase::dynamic::Px, - femtobase::dynamic::Py, + femtobase::dynamic::Px, + femtobase::dynamic::Py, femtobase::dynamic::Pz, femtobase::dynamic::Theta); using FLambdas = FLambdas_001; +using StoredFLambdas = StoredFLambdas_001; DECLARE_SOA_TABLE_STAGED_VERSIONED(FLambdaMasks_001, "FLAMBDAMASK", 1, //! lambda masks femtov0s::Mask); using FLambdaMasks = FLambdaMasks_001; +using StoredFLambdaMasks = StoredFLambdaMasks_001; DECLARE_SOA_TABLE_STAGED_VERSIONED(FLambdaExtras_001, "FLAMBDAEXTRA", 1, //! lambda extra information femtobase::stored::MassAnti, // put mass of antiparticle, i.e. antilambda mass for lambdas and vice versa @@ -452,7 +462,7 @@ using FLambdaExtras = FLambdaExtras_001; // table for basic k0short information DECLARE_SOA_TABLE_STAGED_VERSIONED(FK0shorts_001, "FK0SHORT", 1, //! femto k0shorts o2::soa::Index<>, - femtobase::stored::CollisionId, + femtobase::stored::FColId, femtobase::stored::Pt, femtobase::stored::Eta, femtobase::stored::Phi, @@ -460,15 +470,17 @@ DECLARE_SOA_TABLE_STAGED_VERSIONED(FK0shorts_001, "FK0SHORT", 1, //! femto k0sho femtov0s::PosDauId, femtov0s::NegDauId, femtobase::dynamic::P, - femtobase::dynamic::Px, - femtobase::dynamic::Py, + femtobase::dynamic::Px, + femtobase::dynamic::Py, femtobase::dynamic::Pz, femtobase::dynamic::Theta); using FK0shorts = FK0shorts_001; +using StoredFK0shorts = StoredFK0shorts_001; DECLARE_SOA_TABLE_STAGED_VERSIONED(FK0shortMasks_001, "FK0SHORTMASK", 1, //! k0short masks femtov0s::Mask); using FK0shortMasks = FK0shortMasks_001; +using StoredFK0shortMasks = StoredFK0shortMasks_001; DECLARE_SOA_TABLE_STAGED_VERSIONED(FK0shortExtras_001, "FK0SHORTEXTRA", 1, //! k0short extra information femtov0s::MassLambda, @@ -504,7 +516,7 @@ DECLARE_SOA_INDEX_COLUMN_FULL(ChaDau, chaDau, int32_t, FTracks, "_ChaDau"); //! // table for basic sigma minus information DECLARE_SOA_TABLE_STAGED_VERSIONED(FSigmas_001, "FSIGMA", 1, o2::soa::Index<>, - femtobase::stored::CollisionId, // use sign to differentiate between sigma minus (-1) and anti sigma minus (+1) + femtobase::stored::FColId, // use sign to differentiate between sigma minus (-1) and anti sigma minus (+1) femtobase::stored::SignedPt, femtobase::stored::Eta, femtobase::stored::Phi, @@ -513,8 +525,8 @@ DECLARE_SOA_TABLE_STAGED_VERSIONED(FSigmas_001, "FSIGMA", 1, femtobase::dynamic::Sign, femtobase::dynamic::Pt, femtobase::dynamic::P, - femtobase::dynamic::Px, - femtobase::dynamic::Py, + femtobase::dynamic::Px, + femtobase::dynamic::Py, femtobase::dynamic::Pz, femtobase::dynamic::Theta); using FSigmas = FSigmas_001; @@ -558,7 +570,7 @@ DECLARE_SOA_INDEX_COLUMN_FULL(Bachelor, bachelor, int32_t, FTracks, "_Bachelor") DECLARE_SOA_TABLE_STAGED_VERSIONED(FXis_001, "FXI", 1, //! femto xis o2::soa::Index<>, - femtobase::stored::CollisionId, + femtobase::stored::FColId, femtobase::stored::SignedPt, femtobase::stored::Eta, femtobase::stored::Phi, @@ -569,8 +581,8 @@ DECLARE_SOA_TABLE_STAGED_VERSIONED(FXis_001, "FXI", 1, //! femto xis femtobase::dynamic::Sign, femtobase::dynamic::Pt, femtobase::dynamic::P, - femtobase::dynamic::Px, - femtobase::dynamic::Py, + femtobase::dynamic::Px, + femtobase::dynamic::Py, femtobase::dynamic::Pz, femtobase::dynamic::Theta); using FXis = FXis_001; @@ -592,7 +604,7 @@ using FXiExtras = FXiExtras_001; DECLARE_SOA_TABLE_STAGED_VERSIONED(FOmegas_001, "FOMEGA", 1, //! femto omegas o2::soa::Index<>, - femtobase::stored::CollisionId, + femtobase::stored::FColId, femtobase::stored::SignedPt, femtobase::stored::Eta, femtobase::stored::Phi, @@ -603,8 +615,8 @@ DECLARE_SOA_TABLE_STAGED_VERSIONED(FOmegas_001, "FOMEGA", 1, //! femto omegas femtobase::dynamic::Sign, femtobase::dynamic::Pt, femtobase::dynamic::P, - femtobase::dynamic::Px, - femtobase::dynamic::Py, + femtobase::dynamic::Px, + femtobase::dynamic::Py, femtobase::dynamic::Pz, femtobase::dynamic::Theta); using FOmegas = FOmegas_001; diff --git a/PWGCF/Femto/TableProducer/CMakeLists.txt b/PWGCF/Femto/TableProducer/CMakeLists.txt index 81829ec83a1..fc9a5f82013 100644 --- a/PWGCF/Femto/TableProducer/CMakeLists.txt +++ b/PWGCF/Femto/TableProducer/CMakeLists.txt @@ -13,3 +13,8 @@ o2physics_add_dpl_workflow(femto-producer SOURCES femtoProducer.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(femto-producer-derived-to-derived + SOURCES ./femtoProducerDerivedToDerived.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGCF/Femto/TableProducer/femtoProducer.cxx b/PWGCF/Femto/TableProducer/femtoProducer.cxx index 54b42aa8693..207309a5781 100644 --- a/PWGCF/Femto/TableProducer/femtoProducer.cxx +++ b/PWGCF/Femto/TableProducer/femtoProducer.cxx @@ -164,7 +164,7 @@ struct FemtoProducer { // data members int runNumber = -1; - float magField = 0.f; + int magField = 0.f; Service ccdb; /// Accessing the CCDB std::unordered_map indexMapTracks; // for mapping tracks to lambdas, cascades and resonances @@ -179,7 +179,7 @@ struct FemtoProducer { LOGF(fatal, "GRP object not found for timestamp %llu", timestamp); return; } - magField = 0.1 * grpo->getNominalL3Field(); // get magnetic field in tesla + magField = static_cast(grpo->getNominalL3Field()); // get magnetic field in kG runNumber = bc.runNumber(); }; diff --git a/PWGCF/Femto/TableProducer/femtoProducerDerivedToDerived.cxx b/PWGCF/Femto/TableProducer/femtoProducerDerivedToDerived.cxx new file mode 100644 index 00000000000..13893bf3f5a --- /dev/null +++ b/PWGCF/Femto/TableProducer/femtoProducerDerivedToDerived.cxx @@ -0,0 +1,146 @@ +// Copyright 2019-2025 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 femtoProducerDerivedToDerived.cxx +/// \brief Tasks that produces the femto tables from derived data +/// \author Anton Riedel, TU München, anton.riedel@tum.de + +#include "PWGCF/Femto/Core/cascadeBuilder.h" +#include "PWGCF/Femto/Core/collisionBuilder.h" +#include "PWGCF/Femto/Core/kinkBuilder.h" +#include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/partitions.h" +#include "PWGCF/Femto/Core/trackBuilder.h" +#include "PWGCF/Femto/Core/twoTrackResonanceBuilder.h" +#include "PWGCF/Femto/Core/v0Builder.h" + +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/Configurable.h" +#include "Framework/Expressions.h" +#include "Framework/InitContext.h" +#include "Framework/runDataProcessing.h" + +#include +#include +#include + +using namespace o2::aod; +using namespace o2::soa; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::analysis::femto; + +struct FemtoProducerDerivedToDerived { + + // setup tables + using Collisions = Join; + using Collision = Collisions::iterator; + + using FilteredCollisions = o2::soa::Filtered; + using FilteredCollision = FilteredCollisions::iterator; + + using Tracks = o2::soa::Join; + using Lambdas = o2::soa::Join; + using K0shorts = o2::soa::Join; + + SliceCache cache; + + // collision builder + collisionbuilder::ConfCollisionSelection collisionSelection; + Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); + collisionbuilder::CollisionBuilderDerivedToDerivedProducts collisionBuilderProducts; + collisionbuilder::CollisionBuilderDerivedToDerived collisionBuilder; + + // track builder + trackbuilder::TrackBuilderDerivedToDerived trackBuilder; + trackbuilder::TrackBuilderDerivedToDerivedProducts trackBuilderProducts; + trackbuilder::ConfTrackTablesDerivedToDerived confTrackBuilder; + trackbuilder::ConfTrackSelection1 trackSelections1; + trackbuilder::ConfTrackSelection2 trackSelections2; + + Partition trackPartition1 = MAKE_TRACK_PARTITION(trackSelections1); + Partition trackPartition2 = MAKE_TRACK_PARTITION(trackSelections2); + Preslice perColTracks = femtobase::stored::fColId; + + // v0 builder + v0builder::V0BuilderDerivedToDerived v0Builder; + v0builder::V0BuilderDerivedToDerivedProducts v0BuilderProducts; + v0builder::ConfV0TablesDerivedToDerived confV0Builder; + + v0builder::ConfLambdaSelection1 lambdaSelection1; + Partition lambdaPartition = MAKE_LAMBDA_PARTITION(lambdaSelection1); + Preslice perColLambdas = femtobase::stored::fColId; + + v0builder::ConfK0shortSelection1 k0shortSelection1; + Partition k0shortPartition = MAKE_K0SHORT_PARTITION(k0shortSelection1); + Preslice perColK0shorts = femtobase::stored::fColId; + + std::unordered_map + indexMapTracks; // for mapping tracks to lambdas, cascades and resonances + + void init(InitContext& /*context*/) + { + trackBuilder.init(confTrackBuilder); + v0Builder.init(confV0Builder); + + if ((doprocessTracks + doprocessLambdas + doprocessK0shorts) > 1) { + LOG(fatal) << "Only one proccess function can be activated"; + } + } + + // proccess functions + void processTracks(FilteredCollision const& col, Tracks const& tracks) + { + if (trackBuilder.collisionHasTooFewTracks(col, tracks, trackPartition1, trackPartition2, cache)) { + return; + } + indexMapTracks.clear(); + collisionBuilder.processCollision(col, collisionBuilderProducts); + trackBuilder.processTracks(col, tracks, trackPartition1, trackPartition2, indexMapTracks, cache, trackBuilderProducts, collisionBuilderProducts); + } + PROCESS_SWITCH(FemtoProducerDerivedToDerived, processTracks, "Process tracks", true); + + void processLambdas(FilteredCollision const& col, Tracks const& tracks, Lambdas const& lambdas) + { + if (trackBuilder.collisionHasTooFewTracks(col, tracks, trackPartition1, trackPartition2, cache) && v0Builder.collisionHasTooFewLambdas(col, lambdas, lambdaPartition, cache)) { + return; + } + indexMapTracks.clear(); + if (trackBuilder.collisionHasTooFewTracks(col, tracks, trackPartition1, trackPartition2, cache)) { + collisionBuilder.processCollision(col, collisionBuilderProducts); + trackBuilder.processTracks(col, tracks, trackPartition1, trackPartition2, indexMapTracks, cache, trackBuilderProducts, collisionBuilderProducts); + v0Builder.processLambdas(col, lambdas, tracks, lambdaPartition, trackBuilder, indexMapTracks, cache, v0BuilderProducts, trackBuilderProducts, collisionBuilderProducts); + } + } + PROCESS_SWITCH(FemtoProducerDerivedToDerived, processLambdas, "Process lambdas and tracks", false); + + void processK0shorts(FilteredCollision const& col, Tracks const& tracks, K0shorts const& k0shorts) + { + if (trackBuilder.collisionHasTooFewTracks(col, tracks, trackPartition1, trackPartition2, cache) && v0Builder.collisionHasTooFewK0shorts(col, k0shorts, k0shortPartition, cache)) { + return; + } + indexMapTracks.clear(); + if (trackBuilder.collisionHasTooFewTracks(col, tracks, trackPartition1, trackPartition2, cache)) { + collisionBuilder.processCollision(col, collisionBuilderProducts); + trackBuilder.processTracks(col, tracks, trackPartition1, trackPartition2, indexMapTracks, cache, trackBuilderProducts, collisionBuilderProducts); + v0Builder.processK0shorts(col, k0shorts, tracks, k0shortPartition, trackBuilder, indexMapTracks, cache, v0BuilderProducts, trackBuilderProducts, collisionBuilderProducts); + } + } + PROCESS_SWITCH(FemtoProducerDerivedToDerived, processK0shorts, "Process k0short and tracks", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{adaptAnalysisTask(cfgc)}; + return workflow; +} diff --git a/PWGCF/Femto/Tasks/femtoCascadeQa.cxx b/PWGCF/Femto/Tasks/femtoCascadeQa.cxx index 4d1bd1953d7..984094e065e 100644 --- a/PWGCF/Femto/Tasks/femtoCascadeQa.cxx +++ b/PWGCF/Femto/Tasks/femtoCascadeQa.cxx @@ -46,7 +46,7 @@ using namespace o2::analysis::femto; struct FemtoCascadeQa { // setup tables - using Collisions = Join; + using Collisions = Join; using Collision = Collisions::iterator; using FilteredCollisions = o2::soa::Filtered; @@ -63,11 +63,12 @@ struct FemtoCascadeQa { Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); colhistmanager::CollisionHistManager colHistManager; colhistmanager::ConfCollisionBinning confCollisionBinning; + colhistmanager::ConfCollisionQaBinning confCollisionQaBinning; // setup for xis cascadebuilder::ConfXiSelection confXiSelection; Partition xiPartition = MAKE_CASCADE_PARTITION(confXiSelection); - Preslice preColXis = aod::femtobase::stored::collisionId; + Preslice preColXis = aod::femtobase::stored::fColId; cascadehistmanager::ConfXiBinning confXiBinning; cascadehistmanager::ConfXiQaBinning confXiQaBinning; @@ -83,7 +84,7 @@ struct FemtoCascadeQa { // setup for omegas cascadebuilder::ConfOmegaSelection confOmegaSelection; Partition omegaPartition = MAKE_CASCADE_PARTITION(confOmegaSelection); - Preslice preColOmegas = aod::femtobase::stored::collisionId; + Preslice preColOmegas = aod::femtobase::stored::fColId; cascadehistmanager::ConfOmegaBinning confOmegaBinning; cascadehistmanager::ConfOmegaQaBinning confOmegaQaBinning; @@ -109,7 +110,7 @@ struct FemtoCascadeQa { void init(InitContext&) { // create a map for histogram specs - auto colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); + auto colHistSpec = colhistmanager::makeColQaHistSpecMap(confCollisionBinning, confCollisionQaBinning); colHistManager.init(&hRegistry, colHistSpec); auto bachelorHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confBachelorBinning, confBachelorQaBinning); @@ -134,7 +135,7 @@ struct FemtoCascadeQa { void processXis(FilteredCollision const& col, Xis const& /*xis*/, Tracks const& tracks) { colHistManager.fill(col); - auto xiSlice = xiPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + auto xiSlice = xiPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); for (auto const& xi : xiSlice) { xiHistManager.fill(xi, tracks); } @@ -144,7 +145,7 @@ struct FemtoCascadeQa { void processOmegas(FilteredCollision const& col, Omegas const& /*omegas*/, Tracks const& tracks) { colHistManager.fill(col); - auto omegaSlice = omegaPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + auto omegaSlice = omegaPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); for (auto const& omega : omegaSlice) { omegaHistManager.fill(omega, tracks); } diff --git a/PWGCF/Femto/Tasks/femtoKinkQa.cxx b/PWGCF/Femto/Tasks/femtoKinkQa.cxx index a416ba5993f..febd696e3fe 100644 --- a/PWGCF/Femto/Tasks/femtoKinkQa.cxx +++ b/PWGCF/Femto/Tasks/femtoKinkQa.cxx @@ -55,7 +55,7 @@ struct FemtoKinkQa { colhistmanager::ConfCollisionBinning confCollisionBinning; // using Collisions = o2::soa::Join; - using Collisions = Join; + using Collisions = Join; using Collision = Collisions::iterator; using FilteredCollisions = o2::soa::Filtered; @@ -71,7 +71,7 @@ struct FemtoKinkQa { kinkbuilder::ConfSigmaSelection1 confSigmaSelection; Partition sigmaPartition = MAKE_SIGMA_PARTITION(confSigmaSelection); - Preslice perColSigmas = aod::femtobase::stored::collisionId; + Preslice perColSigmas = aod::femtobase::stored::fColId; kinkhistmanager::ConfSigmaBinning1 confSigmaBinning; kinkhistmanager::ConfSigmaQaBinning1 confSigmaQaBinning; @@ -103,7 +103,7 @@ struct FemtoKinkQa { void processSigma(FilteredCollision const& col, Sigmas const& /*sigmas*/, Tracks const& tracks) { colHistManager.fill(col); - auto sigmaSlice = sigmaPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + auto sigmaSlice = sigmaPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); for (auto const& sigma : sigmaSlice) { sigmaHistManager.fill(sigma, tracks); } diff --git a/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx b/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx index 7621d88fc65..8884a1edc01 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx @@ -67,7 +67,7 @@ struct FemtoPairTrackCascade { trackbuilder::ConfTrackSelection1 trackSelection; trackhistmanager::ConfTrackBinning1 confTrackBinning; Partition trackPartition = MAKE_TRACK_PARTITION(trackSelection); - Preslice perColTracks = aod::femtobase::stored::collisionId; + Preslice perColTracks = aod::femtobase::stored::fColId; // setup for daughters/bachelor trackhistmanager::ConfCascadePosDauBinning confPosDauBinning; @@ -78,13 +78,13 @@ struct FemtoPairTrackCascade { cascadebuilder::ConfXiSelection xiSelection; cascadehistmanager::ConfXiBinning confXiBinning; Partition xiPartition = MAKE_CASCADE_PARTITION(xiSelection); - Preslice perColXis = aod::femtobase::stored::collisionId; + Preslice perColXis = aod::femtobase::stored::fColId; // setup omegas cascadebuilder::ConfOmegaSelection omegaSelection; cascadehistmanager::ConfOmegaBinning confOmegaBinning; Partition omegaPartition = MAKE_CASCADE_PARTITION(omegaSelection); - Preslice perColOmegas = aod::femtobase::stored::collisionId; + Preslice perColOmegas = aod::femtobase::stored::fColId; // setup pairs pairhistmanager::ConfPairBinning confPairBinning; diff --git a/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx b/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx index b3945633f85..2c1448a6764 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx @@ -67,7 +67,7 @@ struct FemtoPairTrackKink { trackbuilder::ConfTrackSelection1 trackSelection; trackhistmanager::ConfTrackBinning1 confTrackBinning; Partition trackPartition = MAKE_TRACK_PARTITION(trackSelection); - Preslice perColTracks = aod::femtobase::stored::collisionId; + Preslice perColTracks = aod::femtobase::stored::fColId; // setup for daughters trackhistmanager::ConfKinkChaDauBinning confChaDauBinning; @@ -76,7 +76,7 @@ struct FemtoPairTrackKink { kinkbuilder::ConfSigmaSelection1 sigmaSelection; kinkhistmanager::ConfSigmaBinning1 confSigmaBinning; Partition sigmaPartition = MAKE_SIGMA_PARTITION(sigmaSelection); - Preslice perColSigmas = aod::femtobase::stored::collisionId; + Preslice perColSigmas = aod::femtobase::stored::fColId; // setup pairs pairhistmanager::ConfPairBinning confPairBinning; diff --git a/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx b/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx index b0d7f54baa3..511bd4f8c1c 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx @@ -66,7 +66,7 @@ struct FemtoPairTrackTrack { Partition trackPartition1 = MAKE_TRACK_PARTITION(trackSelections1); Partition trackPartition2 = MAKE_TRACK_PARTITION(trackSelections2); - Preslice perColReco = aod::femtobase::stored::collisionId; + Preslice perColReco = aod::femtobase::stored::fColId; // setup pairs pairhistmanager::ConfPairBinning confPairBinning; diff --git a/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx b/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx index f85cdfa03bb..a9b534c3488 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx @@ -68,7 +68,7 @@ struct FemtoPairTrackTwoTrackResonance { trackbuilder::ConfTrackSelection1 trackSelection; trackhistmanager::ConfTrackBinning1 confTrackBinning; Partition trackPartition = MAKE_TRACK_PARTITION(trackSelection); - Preslice perColTracks = aod::femtobase::stored::collisionId; + Preslice perColTracks = aod::femtobase::stored::fColId; // setup for daughters trackhistmanager::ConfResonancePosDauBinning confPosDauBinning; @@ -78,19 +78,19 @@ struct FemtoPairTrackTwoTrackResonance { twotrackresonancebuilder::ConfPhiSelection phiSelection; twotrackresonancehistmanager::ConfPhiBinning confPhiBinning; Partition phiPartition = MAKE_RESONANCE_0_PARTITON(phiSelection); - Preslice perColPhis = aod::femtobase::stored::collisionId; + Preslice perColPhis = aod::femtobase::stored::fColId; // setup kstar0 twotrackresonancebuilder::ConfKstar0Selection kstar0Selection; twotrackresonancehistmanager::ConfKstar0Binning confKstar0Binning; Partition kstar0Partition = MAKE_RESONANCE_1_PARTITON(kstar0Selection); - Preslice perColKstar0s = aod::femtobase::stored::collisionId; + Preslice perColKstar0s = aod::femtobase::stored::fColId; // rho0s twotrackresonancebuilder::ConfRho0Selection rho0Selection; twotrackresonancehistmanager::ConfRho0Binning confRho0Binning; Partition rho0Partition = MAKE_RESONANCE_0_PARTITON(rho0Selection); - Preslice perColRho0s = aod::femtobase::stored::collisionId; + Preslice perColRho0s = aod::femtobase::stored::fColId; // setup pairs pairhistmanager::ConfPairBinning confPairBinning; diff --git a/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx b/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx index e72c7f64ac2..6fc0e83060a 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx @@ -67,7 +67,7 @@ struct FemtoPairTrackV0 { trackbuilder::ConfTrackSelection1 trackSelection; trackhistmanager::ConfTrackBinning1 confTrackBinning; Partition trackPartition = MAKE_TRACK_PARTITION(trackSelection); - Preslice perColTracks = aod::femtobase::stored::collisionId; + Preslice perColTracks = aod::femtobase::stored::fColId; // setup for daughters trackhistmanager::ConfV0PosDauBinning confPosDauBinning; @@ -77,13 +77,13 @@ struct FemtoPairTrackV0 { v0builder::ConfLambdaSelection1 lambdaSelection; v0histmanager::ConfLambdaBinning1 confLambdaBinning; Partition lambdaPartition = MAKE_LAMBDA_PARTITION(lambdaSelection); - Preslice perColLambdas = aod::femtobase::stored::collisionId; + Preslice perColLambdas = aod::femtobase::stored::fColId; // setup k0shorts v0builder::ConfK0shortSelection1 k0shortSelection; v0histmanager::ConfK0shortBinning1 confK0shortBinning; Partition k0shortPartition = MAKE_K0SHORT_PARTITION(k0shortSelection); - Preslice perColk0shorts = aod::femtobase::stored::collisionId; + Preslice perColk0shorts = aod::femtobase::stored::fColId; // setup pairs pairhistmanager::ConfPairBinning confPairBinning; diff --git a/PWGCF/Femto/Tasks/femtoTrackQa.cxx b/PWGCF/Femto/Tasks/femtoTrackQa.cxx index 6398257a98d..f68141e9349 100644 --- a/PWGCF/Femto/Tasks/femtoTrackQa.cxx +++ b/PWGCF/Femto/Tasks/femtoTrackQa.cxx @@ -43,7 +43,7 @@ using namespace o2::analysis::femto; struct FemtoTrackQa { // setup tables - using Collisions = o2::soa::Join; + using Collisions = o2::soa::Join; using Collision = Collisions::iterator; using FilteredCollisions = o2::soa::Filtered; @@ -57,6 +57,7 @@ struct FemtoTrackQa { collisionbuilder::ConfCollisionSelection collisionSelection; Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); colhistmanager::ConfCollisionBinning confCollisionBinning; + colhistmanager::ConfCollisionQaBinning confCollisionQaBinning; colhistmanager::CollisionHistManager colHistManager; // setup tracks @@ -66,23 +67,23 @@ struct FemtoTrackQa { trackhistmanager::TrackHistManager trackHistManager; Partition trackPartition = MAKE_TRACK_PARTITION(trackSelections); - Preslice perColReco = aod::femtobase::stored::collisionId; + Preslice perColReco = aod::femtobase::stored::fColId; HistogramRegistry hRegistry{"FemtoTrackQA", {}, OutputObjHandlingPolicy::AnalysisObject}; void init(InitContext&) { // create a map for histogram specs - auto colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); + auto colHistSpec = colhistmanager::makeColQaHistSpecMap(confCollisionBinning, confCollisionQaBinning); colHistManager.init(&hRegistry, colHistSpec); auto trackHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confTrackBinning, confTrackQaBinning); - trackHistManager.init(&hRegistry, trackHistSpec, trackSelections.charge.value, confTrackQaBinning.momentumType.value); + trackHistManager.init(&hRegistry, trackHistSpec, trackSelections.chargeAbs.value, confTrackQaBinning.momentumType.value); }; void process(FilteredCollision const& col, Tracks const& /*tracks*/) { colHistManager.fill(col); - auto trackSlice = trackPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + auto trackSlice = trackPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); for (auto const& track : trackSlice) { trackHistManager.fill(track); } diff --git a/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx b/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx index 5e7b6192ae7..ef9121df21a 100644 --- a/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx +++ b/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx @@ -44,7 +44,7 @@ using namespace o2::analysis::femto; struct FemtoTwotrackresonanceQa { // setup tables - using Collisions = Join; + using Collisions = Join; using Collision = Collisions::iterator; using FilteredCollisions = o2::soa::Filtered; @@ -62,11 +62,12 @@ struct FemtoTwotrackresonanceQa { Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); colhistmanager::CollisionHistManager colHistManager; colhistmanager::ConfCollisionBinning confCollisionBinning; + colhistmanager::ConfCollisionQaBinning confCollisionQaBinning; // setup for phis twotrackresonancebuilder::ConfPhiSelection confPhiSelection; Partition phiPartition = MAKE_RESONANCE_0_PARTITON(confPhiSelection); - Preslice perColPhis = aod::femtobase::stored::collisionId; + Preslice perColPhis = aod::femtobase::stored::fColId; twotrackresonancehistmanager::ConfPhiBinning confPhiBinning; twotrackresonancehistmanager::TwoTrackResonanceHistManager< @@ -80,7 +81,7 @@ struct FemtoTwotrackresonanceQa { // setup for rho0s twotrackresonancebuilder::ConfRho0Selection confRho0Selection; Partition rho0Partition = MAKE_RESONANCE_0_PARTITON(confRho0Selection); - Preslice perColRhos = aod::femtobase::stored::collisionId; + Preslice perColRhos = aod::femtobase::stored::fColId; twotrackresonancehistmanager::ConfRho0Binning confRho0Binning; twotrackresonancehistmanager::TwoTrackResonanceHistManager< @@ -94,7 +95,7 @@ struct FemtoTwotrackresonanceQa { // setup for kstar0s twotrackresonancebuilder::ConfKstar0Selection confKstar0Selection; Partition kstar0Partition = MAKE_RESONANCE_1_PARTITON(confKstar0Selection); - Preslice perColKstars = aod::femtobase::stored::collisionId; + Preslice perColKstars = aod::femtobase::stored::fColId; twotrackresonancehistmanager::ConfKstar0Binning confKstar0Binning; twotrackresonancehistmanager::TwoTrackResonanceHistManager< @@ -116,7 +117,7 @@ struct FemtoTwotrackresonanceQa { void init(InitContext&) { // create a map for histogram specs - auto colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); + auto colHistSpec = colhistmanager::makeColQaHistSpecMap(confCollisionBinning, confCollisionQaBinning); colHistManager.init(&hRegistry, colHistSpec); auto posDaughterHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confPosDaughterBinning, confPosDaughterQaBinning); @@ -144,7 +145,7 @@ struct FemtoTwotrackresonanceQa { void processPhis(FilteredCollision const& col, Phis const& /*phis*/, Tracks const& tracks) { colHistManager.fill(col); - auto phiSlice = phiPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + auto phiSlice = phiPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); for (auto const& phi : phiSlice) { phiHistManager.fill(phi, tracks); } @@ -154,7 +155,7 @@ struct FemtoTwotrackresonanceQa { void processRho0s(FilteredCollision const& col, Rho0s const& /*rho0s*/, Tracks const& tracks) { colHistManager.fill(col); - auto rho0Slice = rho0Partition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + auto rho0Slice = rho0Partition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); for (auto const& rho0 : rho0Slice) { rho0HistManager.fill(rho0, tracks); } @@ -164,7 +165,7 @@ struct FemtoTwotrackresonanceQa { void processKstar0s(FilteredCollision const& col, Kstar0s const& /*kstar0s*/, Tracks const& tracks) { colHistManager.fill(col); - auto kstar0Slice = kstar0Partition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + auto kstar0Slice = kstar0Partition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); for (auto const& kstar0 : kstar0Slice) { kstar0HistManager.fill(kstar0, tracks); } diff --git a/PWGCF/Femto/Tasks/femtoV0Qa.cxx b/PWGCF/Femto/Tasks/femtoV0Qa.cxx index 089d2975e1d..2b290ee93b6 100644 --- a/PWGCF/Femto/Tasks/femtoV0Qa.cxx +++ b/PWGCF/Femto/Tasks/femtoV0Qa.cxx @@ -45,15 +45,7 @@ using namespace o2::analysis::femto; struct FemtoV0Qa { - // setup for collisions - collisionbuilder::ConfCollisionSelection collisionSelection; - Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); - - colhistmanager::CollisionHistManager colHistManager; - colhistmanager::ConfCollisionBinning confCollisionBinning; - - // using Collisions = o2::soa::Join; - using Collisions = o2::soa::Join; + using Collisions = o2::soa::Join; using Collision = Collisions::iterator; using FilteredCollisions = o2::soa::Filtered; @@ -65,11 +57,18 @@ struct FemtoV0Qa { SliceCache cache; + // setup for collisions + collisionbuilder::ConfCollisionSelection collisionSelection; + Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); + colhistmanager::CollisionHistManager colHistManager; + colhistmanager::ConfCollisionBinning confCollisionBinning; + colhistmanager::ConfCollisionQaBinning confCollisionQaBinning; + // setup for lambdas v0builder::ConfLambdaSelection1 confLambdaSelection; Partition lambdaPartition = MAKE_LAMBDA_PARTITION(confLambdaSelection); - Preslice perColLambdas = aod::femtobase::stored::collisionId; + Preslice perColLambdas = aod::femtobase::stored::fColId; v0histmanager::ConfLambdaBinning1 confLambdaBinning; v0histmanager::ConfLambdaQaBinning1 confLambdaQaBinning; @@ -85,7 +84,7 @@ struct FemtoV0Qa { v0builder::ConfK0shortSelection1 confK0shortSelection; Partition k0shortPartition = MAKE_K0SHORT_PARTITION(confK0shortSelection); - Preslice perColK0shorts = aod::femtobase::stored::collisionId; + Preslice perColK0shorts = aod::femtobase::stored::fColId; v0histmanager::ConfK0shortBinning1 confK0shortBinning; v0histmanager::ConfK0shortQaBinning1 confK0shortQaBinning; @@ -109,7 +108,7 @@ struct FemtoV0Qa { void init(InitContext&) { // create a map for histogram specs - auto colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); + auto colHistSpec = colhistmanager::makeColQaHistSpecMap(confCollisionBinning, confCollisionQaBinning); colHistManager.init(&hRegistry, colHistSpec); auto posDaughterHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confV0PosDaughterBinning, confV0PosDaughterQaBinning); @@ -133,7 +132,7 @@ struct FemtoV0Qa { void processK0short(FilteredCollision const& col, K0shorts const& /*k0shorts*/, Tracks const& tracks) { colHistManager.fill(col); - auto k0shortSlice = k0shortPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + auto k0shortSlice = k0shortPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); for (auto const& k0short : k0shortSlice) { k0shortHistManager.fill(k0short, tracks); } @@ -143,7 +142,7 @@ struct FemtoV0Qa { void processLambda(FilteredCollision const& col, Lambdas const& /*lambdas*/, Tracks const& tracks) { colHistManager.fill(col); - auto lambdaSlice = lambdaPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + auto lambdaSlice = lambdaPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); for (auto const& lambda : lambdaSlice) { lambdaHistManager.fill(lambda, tracks); } From 1667521e9476ffc483d54ebfbcb97248e2deb0d1 Mon Sep 17 00:00:00 2001 From: sashingo Date: Thu, 2 Oct 2025 10:33:48 +0200 Subject: [PATCH 606/986] [PWGHF] Updated to Z->ee trig. study (#13165) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Vít Kučera --- PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx | 121 ++++++++++++++++------ 1 file changed, 89 insertions(+), 32 deletions(-) diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx index 068cac4030c..7d06f3f525d 100644 --- a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -104,6 +104,7 @@ struct HfTaskElectronWeakBoson { Configurable rIsolation{"rIsolation", 0.3, "cone radius for isolation cut"}; Configurable energyIsolationMax{"energyIsolationMax", 0.1, "isolation cut on energy"}; + Configurable momentumIsolationMax{"momentumIsolationMax", 0.1, "isolation cut on momentum"}; Configurable trackIsolationMax{"trackIsolationMax", 3, "Maximum number of tracks in isolation cone"}; Configurable massZMin{"massZMin", 60.0, "Minimum Z mass (GeV/c^2)"}; @@ -180,6 +181,27 @@ struct HfTaskElectronWeakBoson { Preslice perClusterAmb = o2::aod::emcalclustercell::emcalambiguousclusterId; PresliceUnsorted perClusterMatchedTracks = o2::aod::emcalmatchedtrack::trackId; + // config axis + ConfigurableAxis confaxisPt{"confaxisPt", {100, 0, 100}, "p_{T}"}; + ConfigurableAxis confaxisPtZee{"confaxisPtZee", {60, 20, 80}, "p_{T}"}; + ConfigurableAxis confaxisPtZneg{"confaxisPtZneg", {60, 20, 80}, "p_{T,neg} (GeV/c)"}; + ConfigurableAxis confaxisPtZpos{"confaxisPtZpos", {60, 20, 80}, "p_{T,pos} (GeV/c)"}; + ConfigurableAxis confaxisEop{"confaxisEop", {300, -0.01, 1.49}, "E/p"}; + ConfigurableAxis confaxisEopZneg{"confaxisEopZneg", {300, -0.01, 1.49}, "E/p_{neg}"}; + ConfigurableAxis confaxisEopZpos{"confaxisEopZpos", {300, -0.01, 1.49}, "E/p_{pos}"}; + ConfigurableAxis confaxisIsoEnergy{"confaxisIsoEnergy", {255, 0, 2.0}, "E_{iso}"}; + ConfigurableAxis confaxisIsoEnergyZneg{"confaxisIsoEnergyZneg", {255, 0, 2.0}, "E_{iso,neg}"}; + ConfigurableAxis confaxisIsoEnergyZpos{"confaxisIsoEnergyZpos", {255, 0, 2.0}, "E_{iso,pos}"}; + ConfigurableAxis confaxisIsoMomentum{"confaxisIsoMomentum", {255, 0, 2.0}, "E_{iso}"}; + ConfigurableAxis confaxisIsoMomentumZneg{"confaxisIsoMomentumZneg", {255, 0, 1.5}, "E_{iso,neg}"}; + ConfigurableAxis confaxisIsoMomentumZpos{"confaxisIsoMomentumZpos", {255, 0, 1.5}, "E_{iso,pos}"}; + ConfigurableAxis confaxisIsoTrack{"confaxisIsoTrack", {25, -0.5, 24.5}, "Isolation Track"}; + ConfigurableAxis confaxisIsoTrackZneg{"confaxisIsoTrackZneg", {25, -0.5, 24.5}, "N_{isotrk,neg}"}; + ConfigurableAxis confaxisIsoTrackZpos{"confaxisIsoTrackZpos", {25, -0.5, 24.5}, "N_{isotrk,pos}"}; + ConfigurableAxis confaxisInvMassZgamma{"confaxisInvMassZgamma", {150, 0, 150}, "M_{ee} (GeV/c^{2})"}; + ConfigurableAxis confaxisInvMassZ{"confaxisInvMassZ", {130, 20, 150}, "M_{ee} (GeV/c^{2})"}; + ConfigurableAxis confaxisZfrag{"confaxisZfrag", {200, 0, 2.0}, "p_{T,h}/p_{T,Z}"}; + // Histogram registry: an object to hold your registrygrams HistogramRegistry registry{"registry"}; @@ -212,10 +234,6 @@ struct HfTaskElectronWeakBoson { const AxisSpec axisZvtx{40, -20, 20, "Zvtx"}; const AxisSpec axisCounter{1, 0, 1, "events"}; const AxisSpec axisEta{20, -1.0, 1.0, "#eta"}; - const AxisSpec axisPt{nBinsPt, 0, binPtmax, "p_{T}"}; - const AxisSpec axisPtZee{60, 20, 80, "p_{T}"}; - const AxisSpec axisPtZneg{60, 20, 80, "p_{T,neg} (GeV/c)"}; - const AxisSpec axisPtZpos{60, 20, 80, "p_{T,pos} (GeV/c)"}; const AxisSpec axisDCAxyneg{150, 0, 0.3, "DCAxy_{neg}"}; const AxisSpec axisDCAxypos{150, 0, 0.3, "DCAxy_{pos}"}; const AxisSpec axisDCAzneg{150, 0, 0.3, "DCAz_{neg}"}; @@ -235,31 +253,35 @@ struct HfTaskElectronWeakBoson { const AxisSpec axisdR{20, 0.0, 0.2, "dR"}; const AxisSpec axisNcell{50, 0.0, 50.0, "Ncell"}; const AxisSpec axisPhi{350, 0, 7, "Phi"}; - const AxisSpec axisEop{200, 0, 2, "E/p"}; - const AxisSpec axisEopZneg{200, 0, 2, "E/p neg"}; - const AxisSpec axisEopZpos{200, 0, 2, "E/p pos"}; const AxisSpec axisChi2{250, 0.0, 25.0, "#chi^{2}"}; const AxisSpec axisCluster{100, 0.0, 200.0, "counts"}; const AxisSpec axisITSNCls{10, 0.0, 10, "counts"}; const AxisSpec axisEMCtime{100, -50.0, 50, "EMC time"}; - const AxisSpec axisIsoEnergy{100, 0, 1.0, "E_{iso}"}; - const AxisSpec axisIsoEnergyZneg{100, 0, 1.0, "E_{iso,neg}"}; - const AxisSpec axisIsoEnergyZpos{100, 0, 1.0, "E_{iso,pos}"}; - const AxisSpec axisIsoMomentum{100, 0, 10.0, "Isolation momentum(GeV/C)"}; - const AxisSpec axisIsoMomentumZneg{100, 0, 10.0, "p_{iso,neg}"}; - const AxisSpec axisIsoMomentumZpos{100, 0, 10.0, "p_{iso,pos}"}; - const AxisSpec axisIsoTrack{25, -0.5, 24.5, "Isolation Track"}; - const AxisSpec axisIsoTrackZneg{25, -0.5, 24.5, "N_{isotrk,neg}"}; - const AxisSpec axisIsoTrackZpos{25, -0.5, 24.5, "N_{isotrk,pos}"}; - const AxisSpec axisInvMassZgamma{150, 0, 150, "M_{ee} (GeV/c^{2})"}; - const AxisSpec axisInvMassZ{130, 20, 150, "M_{ee} (GeV/c^{2})"}; const AxisSpec axisTrigger{3, -0.5, 2.5, "Trigger status of zorro"}; const AxisSpec axisDPhiZh{64, -o2::constants::math::PIHalf, 3 * o2::constants::math::PIHalf, "#Delta#phi(Z-h)"}; - const AxisSpec axisPtHadron{50, 0, 50, "p_{T,hadron} (GeV/c)"}; - const AxisSpec axisPtZ{150, 0, 150, "p_{T,Z} (GeV/c)"}; + const AxisSpec axisPtHadron{nBinsPt, 0, binPtmax, "p_{T,hadron} (GeV/c)"}; + const AxisSpec axisPtZ{nBinsPt, 0, binPtmax, "p_{T,Z} (GeV/c)"}; const AxisSpec axisSign{2, -2, 2, "charge sign"}; - const AxisSpec axisCentrality{centralityBins}; - const AxisSpec axisPtRatio{200, 0, 2.0, "pt ratio for h and Z"}; + const AxisSpec axisCentrality{centralityBins, "centrality"}; + const AxisSpec axisEop{confaxisEop, "E/p"}; + const AxisSpec axisEopZneg{confaxisEopZneg, "E/p_{neg}"}; + const AxisSpec axisEopZpos{confaxisEopZpos, "E/p_{[pos}"}; + const AxisSpec axisPt{confaxisPt, "p_{T}"}; + const AxisSpec axisPtZee{confaxisPtZee, "p_{T}"}; + const AxisSpec axisPtZneg{confaxisPtZneg, "p_{T,neg} (GeV/c)"}; + const AxisSpec axisPtZpos{confaxisPtZpos, "p_{T,pos} (GeV/c)"}; + const AxisSpec axisIsoEnergy{confaxisIsoEnergy, "E_{iso}"}; + const AxisSpec axisIsoEnergyZneg{confaxisIsoEnergyZneg, "E_{iso}"}; + const AxisSpec axisIsoEnergyZpos{confaxisIsoEnergyZpos, "E_{iso}"}; + const AxisSpec axisIsoMomentum{confaxisIsoMomentum, "Isolation momentum(GeV/C)"}; + const AxisSpec axisIsoMomentumZneg{confaxisIsoMomentumZneg, "Isolation momentum(GeV/C)"}; + const AxisSpec axisIsoMomentumZpos{confaxisIsoMomentumZpos, "Isolation momentum(GeV/C)"}; + const AxisSpec axisIsoTrack{confaxisIsoTrack, "Isolation Track"}; + const AxisSpec axisIsoTrackZneg{confaxisIsoTrackZneg, "N_{isotrk,neg}"}; + const AxisSpec axisIsoTrackZpos{confaxisIsoTrackZpos, "N_{isotrk,pos}"}; + const AxisSpec axisInvMassZgamma{confaxisInvMassZgamma, "M_{ee} (GeV/c^{2})"}; + const AxisSpec axisInvMassZ{confaxisInvMassZ, "M_{ee} (GeV/c^{2})"}; + const AxisSpec axisZfrag{confaxisZfrag, "p_{T,h}/p_{T,Z}"}; // create registrygrams registry.add("hZvtx", "Z vertex", kTH1D, {axisZvtx}); @@ -289,11 +311,12 @@ struct HfTaskElectronWeakBoson { registry.add("hInvMassZee", "invariant mass for Z ULS pair", HistType::kTHnSparseF, {axisCentrality, axisSign, axisPt, axisInvMassZgamma}); registry.add("hKfInvMassZee", "invariant mass for Z ULS pair KFp", HistType::kTHnSparseF, {axisCentrality, axisSign, axisPt, axisInvMassZgamma}); registry.add("hInvMassZeeQA", "QA for invariant mass for Z", HistType::kTHnSparseF, {axisInvMassZ, axisPtZneg, axisPtZpos, axisDCAxyneg, axisDCAxypos, axisDCAzpos, axisNclsTPCneg, axisNclsTPCpos, axisNclsITSneg, axisNclsITSpos, axisSectorTPCneg, axisSectorTPCneg, axisEopZneg, axisEopZpos, axisIsoEnergyZneg, axisIsoEnergyZpos, axisIsoMomentumZneg, axisIsoMomentumZpos, axisIsoTrackZneg, axisIsoTrackZpos}); - registry.add("hTHnElectrons", "electron info", HistType::kTHnSparseF, {axisPt, axisNsigma, axisM02, axisEop, axisIsoEnergy, axisIsoTrack, axisEta, axisDedx}); + registry.add("hInvMassZeeQAbg", "QA for invariant mass for Z", HistType::kTHnSparseF, {axisInvMassZ, axisPtZneg, axisPtZpos, axisDCAxyneg, axisDCAxypos, axisDCAzpos, axisNclsTPCneg, axisNclsTPCpos, axisNclsITSneg, axisNclsITSpos, axisSectorTPCneg, axisSectorTPCneg, axisEopZneg, axisEopZpos, axisIsoEnergyZneg, axisIsoEnergyZpos, axisIsoMomentumZneg, axisIsoMomentumZpos, axisIsoTrackZneg, axisIsoTrackZpos}); + registry.add("hTHnElectrons", "electron info", HistType::kTHnSparseF, {axisPt, axisNsigma, axisM02, axisEop, axisIsoEnergy, axisIsoMomentum, axisIsoTrack, axisEta, axisDedx}); registry.add("hTHnTrMatch", "Track EMC Match", HistType::kTHnSparseF, {axisPt, axisdPhi, axisdEta}); // Z-hadron correlation histograms - registry.add("hZHadronDphi", "Z-hadron #Delta#phi correlation", HistType::kTHnSparseF, {axisCentrality, axisSign, axisPtZ, axisDPhiZh, axisPtRatio, axisPtHadron}); + registry.add("hZHadronDphi", "Z-hadron #Delta#phi correlation", HistType::kTHnSparseF, {axisCentrality, axisSign, axisPtZ, axisDPhiZh, axisZfrag, axisPtHadron}); registry.add("hZptSpectrum", "Z boson p_{T} spectrum", kTH2F, {{axisSign}, {axisPtZ}}); // hisotgram for EMCal trigger @@ -390,6 +413,10 @@ struct HfTaskElectronWeakBoson { if (track.sign() > 0) { pdgAss = kPositron; } + auto [trackCount, isoMomentum] = getIsolatedTrack(track.eta(), track.phi(), track.p(), tracks); + if (isoMomentum > momentumIsolationMax) { + continue; + } KFPTrack kfpTrackAssEle = createKFPTrackFromTrack(track); KFParticle kfpAssEle(kfpTrackAssEle, pdgAss); @@ -540,7 +567,7 @@ struct HfTaskElectronWeakBoson { registry.fill(HIST("hPt"), track.pt()); registry.fill(HIST("hTPCNsigma"), track.p(), track.tpcNSigmaEl()); - float eop = 0.0; + float eop = -0.01; float isoEnergy = 1.0; // track isolation auto [trackCount, isoMomentum] = getIsolatedTrack(track.eta(), track.phi(), track.p(), tracks); @@ -631,7 +658,7 @@ struct HfTaskElectronWeakBoson { isoEnergy = getIsolatedCluster(cluster, emcClusters); if (match.track_as().pt() > ptTHnThresh && isTHnElectron) { - registry.fill(HIST("hTHnElectrons"), match.track_as().pt(), match.track_as().tpcNSigmaEl(), m02Emc, eop, isoEnergy, trackCount, track.eta(), track.tpcSignal()); + registry.fill(HIST("hTHnElectrons"), match.track_as().pt(), match.track_as().tpcNSigmaEl(), m02Emc, eop, isoEnergy, isoMomentum, trackCount, track.eta(), track.tpcSignal()); } // LOG(info) << "E/p" << eop; registry.fill(HIST("hEopNsigTPC"), match.track_as().tpcNSigmaEl(), eop); @@ -643,7 +670,7 @@ struct HfTaskElectronWeakBoson { registry.fill(HIST("hEop"), match.track_as().pt(), eop); if (eop > eopMin && eop < eopMax && isoEnergy < energyIsolationMax) isIsolated = true; - if (eop > eopMin && eop < eopMax && trackCount < trackIsolationMax) + if (eop > eopMin && eop < eopMax && trackCount < trackIsolationMax && isoMomentum < momentumIsolationMax) isIsolatedTr = true; if (isIsolated && isIsolatedTr) { @@ -729,20 +756,50 @@ struct HfTaskElectronWeakBoson { // Z->ee QA if (enableZeeRecoQA) { if (selectedElectronsIso.size() > 0 && selectedPositronsIso.size() > 0) { + // signal for (const auto& trackEle : selectedElectronsIso) { + auto child1 = RecoDecayPtEtaPhi::pVector(trackEle.pt, trackEle.eta, trackEle.phi); + float sectorneg = trackEle.phi / o2::constants::math::SectorSpanRad; for (const auto& trackPos : selectedPositronsIso) { - auto child1 = RecoDecayPtEtaPhi::pVector(trackEle.pt, trackEle.eta, trackEle.phi); auto child2 = RecoDecayPtEtaPhi::pVector(trackPos.pt, trackPos.eta, trackPos.phi); double invMass = RecoDecay::m(std::array{child1, child2}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}); + float sectorpos = trackPos.phi / o2::constants::math::SectorSpanRad; if (invMass > massZMinQA) { - float sectorneg = trackEle.phi / o2::constants::math::SectorSpanRad; - float sectorpos = trackPos.phi / o2::constants::math::SectorSpanRad; - // LOG(info) << "TPC sector= " << sectorneg << " ; " << sectorpos; registry.fill(HIST("hInvMassZeeQA"), invMass, trackEle.pt, trackPos.pt, trackEle.dcaxyTrk, trackPos.dcaxyTrk, trackPos.dcazTrk, trackEle.nclusterTPC, trackPos.nclusterTPC, trackEle.nclusterITS, trackPos.nclusterITS, sectorneg, sectorpos, trackEle.eop, trackPos.eop, trackEle.energyIso, trackPos.energyIso, trackEle.momIso, trackPos.momIso, trackEle.ntrackIso, trackPos.ntrackIso); } } } - } + // bg e-e- + for (size_t i = 0; i < selectedElectronsIso.size(); ++i) { + const auto& trackEle = selectedElectronsIso[i]; + auto child1 = RecoDecayPtEtaPhi::pVector(trackEle.pt, trackEle.eta, trackEle.phi); + float sectorneg = trackEle.phi / o2::constants::math::SectorSpanRad; + for (size_t j = i + 1; j < selectedElectronsIso.size(); ++j) { + const auto& trackEle2 = selectedElectronsIso[j]; + auto child2 = RecoDecayPtEtaPhi::pVector(trackEle2.pt, trackEle2.eta, trackEle2.phi); + float sectorpos = trackEle2.phi / o2::constants::math::SectorSpanRad; + double invMass = RecoDecay::m(std::array{child1, child2}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}); + if (invMass > massZMinQA) { + registry.fill(HIST("hInvMassZeeQAbg"), invMass, trackEle.pt, trackEle2.pt, trackEle.dcaxyTrk, trackEle2.dcaxyTrk, trackEle2.dcazTrk, trackEle.nclusterTPC, trackEle2.nclusterTPC, trackEle.nclusterITS, trackEle2.nclusterITS, sectorneg, sectorpos, trackEle.eop, trackEle2.eop, trackEle.energyIso, trackEle2.energyIso, trackEle.momIso, trackEle2.momIso, trackEle.ntrackIso, trackEle2.ntrackIso); + } + } + } + // bg e+e+ + for (size_t i = 0; i < selectedPositronsIso.size(); ++i) { + const auto& trackPos = selectedPositronsIso[i]; + auto child1 = RecoDecayPtEtaPhi::pVector(trackPos.pt, trackPos.eta, trackPos.phi); + float sectorneg = trackPos.phi / o2::constants::math::SectorSpanRad; + for (size_t j = i + 1; j < selectedPositronsIso.size(); ++j) { + const auto& trackPos2 = selectedPositronsIso[j]; + auto child2 = RecoDecayPtEtaPhi::pVector(trackPos2.pt, trackPos2.eta, trackPos2.phi); + float sectorpos = trackPos2.phi / o2::constants::math::SectorSpanRad; + double invMass = RecoDecay::m(std::array{child1, child2}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}); + if (invMass > massZMinQA) { + registry.fill(HIST("hInvMassZeeQAbg"), invMass, trackPos.pt, trackPos2.pt, trackPos.dcaxyTrk, trackPos2.dcaxyTrk, trackPos2.dcazTrk, trackPos.nclusterTPC, trackPos2.nclusterTPC, trackPos.nclusterITS, trackPos2.nclusterITS, sectorneg, sectorpos, trackPos.eop, trackPos2.eop, trackPos.energyIso, trackPos2.energyIso, trackPos.momIso, trackPos2.momIso, trackPos.ntrackIso, trackPos2.ntrackIso); + } + } + } + } // check arrays aren't empty } // end of Z->ee QA } // process }; // struct HfTaskElectronWeakBoson From 2cc7f7fc5ed3583537169b97d3e6b076038e3800 Mon Sep 17 00:00:00 2001 From: Giovanni Malfattore <89481844+giovannimalfattore@users.noreply.github.com> Date: Thu, 2 Oct 2025 11:12:30 +0200 Subject: [PATCH 607/986] [PWGLF] NucleiTask - QA plot filled after cuts (#13201) --- PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx b/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx index 527723ec9b0..0a750cc3045 100644 --- a/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx +++ b/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx @@ -6086,9 +6086,9 @@ struct LFNucleiBATask { return; } - spectraGen.fill(HIST("histGenVetxZ"), mcCollision.posZ()); if (mcCollision.centFT0M() < cfgMultCutLow || mcCollision.centFT0M() > cfgMultCutHigh) return; + spectraGen.fill(HIST("histGenVetxZ"), mcCollision.posZ()); for (auto const& mcParticleGen : mcParticles) { if (mcParticleGen.y() > kinemOptions.cfgRapidityCutHigh || mcParticleGen.y() < kinemOptions.cfgRapidityCutLow) From 8c68ee8b2d087ad356ff96630610d0d485a1d65e Mon Sep 17 00:00:00 2001 From: Francesca Ercolessi Date: Thu, 2 Oct 2025 12:55:17 +0200 Subject: [PATCH 608/986] [PWGLF] nuclei-proton correlation: fix processGen and add antip-p correlation (#13200) --- .../Tasks/Nuspex/hadronnucleicorrelation.cxx | 94 ++++++++++++------- 1 file changed, 59 insertions(+), 35 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx index fec8025339a..ee383900901 100644 --- a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx +++ b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx @@ -179,6 +179,8 @@ struct hadronnucleicorrelation { std::vector> hPIDEtaPhiGen_AntiDeAntiPr_ME; std::vector> hEtaPhiGen_AntiPrAntiPr_SE; std::vector> hEtaPhiGen_AntiPrAntiPr_ME; + std::vector> hEtaPhiGen_AntiPrPr_SE; + std::vector> hEtaPhiGen_AntiPrPr_ME; int nBinspT; TH2F* hEffpTEta_proton; @@ -264,6 +266,13 @@ struct hadronnucleicorrelation { auto htempMEGen_AntiPrAntiPr = registry.add(Form("hEtaPhiGen_AntiPrAntiPr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("Gen #Delta#eta#Delta#phi (%.1f(Form("hEtaPhiGen_AntiPrPr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), + Form("Gen #Delta#eta#Delta#phi (%.1f(Form("hEtaPhiGen_AntiPrPr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), + Form("Gen #Delta#eta#Delta#phi (%.1f - void mixMCParticles(Type const& particles1, Type const& particles2) + void mixMCParticles(Type const& particles1, Type const& particles2, bool ispap) { for (auto const& it1 : particles1) { for (auto const& it2 : particles2) { @@ -726,9 +735,15 @@ struct hadronnucleicorrelation { if (it1->pt() >= pTBins.value.at(k) && it1->pt() < pTBins.value.at(k + 1)) { // Use correct histogram based on ME flag if constexpr (ME) { - hEtaPhiGen_AntiDeAntiPr_ME[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); + if (ispap) + hEtaPhiGen_AntiPrPr_ME[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); + else + hEtaPhiGen_AntiDeAntiPr_ME[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); } else { - hEtaPhiGen_AntiDeAntiPr_SE[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); + if (ispap) + hEtaPhiGen_AntiPrPr_SE[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); + else + hEtaPhiGen_AntiDeAntiPr_SE[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); } } } @@ -1273,18 +1288,16 @@ struct hadronnucleicorrelation { bool isDe = (IsDeuteron(track, +1) && track.pdgCode() == pdgDeuteron); bool isAntiDe = (IsDeuteron(track, -1) && track.pdgCode() == -pdgDeuteron); - if (track.origin() == 1 || track.origin() == 0) { // primaries and secondaries - if (isPr) { - registry.fill(HIST("hPrimSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * +1); - if (track.origin() == 1) { // secondaries - registry.fill(HIST("hSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * +1); - } + if (isPr) { + registry.fill(HIST("hPrimSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * +1); + if (track.origin() == 1 || track.origin() == 2) { // secondaries + registry.fill(HIST("hSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * +1); } - if (isAntiPr) { - registry.fill(HIST("hPrimSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * -1); - if (track.origin() == 1) { - registry.fill(HIST("hSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * -1); - } + } + if (isAntiPr) { + registry.fill(HIST("hPrimSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * -1); + if (track.origin() == 1 || track.origin() == 2) { + registry.fill(HIST("hSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * -1); } } @@ -1769,25 +1782,10 @@ struct hadronnucleicorrelation { selectedparticlesMC_antid[particle.mcCollisionId()].push_back(std::make_shared(particle)); } if (particle.pdgCode() == pdgProton) { - if (!particle.has_daughters()) { - selectedparticlesMC_p[particle.mcCollisionId()].push_back(std::make_shared(particle)); - registry.fill(HIST("Generated/hQAProtons"), 3.5); - } else { - bool isd = false; - for (auto& dau : particle.daughters_as()) { - if (dau.pdgCode() == pdgDeuteron) { - isd = true; - } - } - if (isd) { - registry.fill(HIST("Generated/hQAProtons"), 4.5); - } - } + selectedparticlesMC_p[particle.mcCollisionId()].push_back(std::make_shared(particle)); } if (particle.pdgCode() == -pdgProton) { - if (!particle.has_daughters()) { - selectedparticlesMC_antip[particle.mcCollisionId()].push_back(std::make_shared(particle)); - } + selectedparticlesMC_antip[particle.mcCollisionId()].push_back(std::make_shared(particle)); } } @@ -1798,7 +1796,7 @@ struct hadronnucleicorrelation { // anti-d - anti-p correlation if (selectedparticlesMC_antid.find(collision1.globalIndex()) != selectedparticlesMC_antid.end()) { if (selectedparticlesMC_antip.find(collision1.globalIndex()) != selectedparticlesMC_antip.end()) { - mixMCParticles<0>(selectedparticlesMC_antid[collision1.globalIndex()], selectedparticlesMC_antip[collision1.globalIndex()]); // mixing SE + mixMCParticles<0>(selectedparticlesMC_antid[collision1.globalIndex()], selectedparticlesMC_antip[collision1.globalIndex()], 0); // mixing SE } int stop1 = 0; @@ -1814,7 +1812,7 @@ struct hadronnucleicorrelation { } if (selectedparticlesMC_antip.find(collision2.globalIndex()) != selectedparticlesMC_antip.end()) { - mixMCParticles<1>(selectedparticlesMC_antid[collision1.globalIndex()], selectedparticlesMC_antip[collision2.globalIndex()]); // mixing ME + mixMCParticles<1>(selectedparticlesMC_antid[collision1.globalIndex()], selectedparticlesMC_antip[collision2.globalIndex()], 0); // mixing ME } stop1++; @@ -1825,7 +1823,7 @@ struct hadronnucleicorrelation { if (domatterGen) { if (selectedparticlesMC_d.find(collision1.globalIndex()) != selectedparticlesMC_d.end()) { if (selectedparticlesMC_p.find(collision1.globalIndex()) != selectedparticlesMC_p.end()) { - mixMCParticles<0>(selectedparticlesMC_d[collision1.globalIndex()], selectedparticlesMC_p[collision1.globalIndex()]); // mixing SE + mixMCParticles<0>(selectedparticlesMC_d[collision1.globalIndex()], selectedparticlesMC_p[collision1.globalIndex()], 0); // mixing SE } int stop2 = 0; @@ -1841,7 +1839,7 @@ struct hadronnucleicorrelation { } if (selectedparticlesMC_p.find(collision2.globalIndex()) != selectedparticlesMC_p.end()) { - mixMCParticles<1>(selectedparticlesMC_d[collision1.globalIndex()], selectedparticlesMC_p[collision2.globalIndex()]); // mixing ME + mixMCParticles<1>(selectedparticlesMC_d[collision1.globalIndex()], selectedparticlesMC_p[collision2.globalIndex()], 0); // mixing ME } stop2++; @@ -1899,6 +1897,32 @@ struct hadronnucleicorrelation { } } } + + // p-antip correlation + if (selectedparticlesMC_p.find(collision1.globalIndex()) != selectedparticlesMC_p.end()) { + if (selectedparticlesMC_antip.find(collision1.globalIndex()) != selectedparticlesMC_antip.end()) { + mixMCParticles<0>(selectedparticlesMC_p[collision1.globalIndex()], selectedparticlesMC_antip[collision1.globalIndex()], 1); // mixing SE + } + + int stop5 = 0; + + for (auto collision2 : mcCollisions) { // nested loop on collisions + + if (collision1.globalIndex() == collision2.globalIndex()) { + continue; + } + + if (stop5 > maxmixcollsGen) { + break; + } + + if (selectedparticlesMC_antip.find(collision2.globalIndex()) != selectedparticlesMC_antip.end()) { + mixMCParticles<1>(selectedparticlesMC_p[collision1.globalIndex()], selectedparticlesMC_antip[collision2.globalIndex()], 1); // mixing ME + } + + stop5++; + } + } } // clearing up From cbd6f32a2b9638a7e641e281417ff9b3bbf07f7e Mon Sep 17 00:00:00 2001 From: abmodak <67369858+abmodak@users.noreply.github.com> Date: Thu, 2 Oct 2025 15:17:12 +0200 Subject: [PATCH 609/986] [PWGLF] Add new task for RAA analysis in light-ion collisions (#13202) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Nuspex/CMakeLists.txt | 5 + PWGLF/Tasks/Nuspex/chargedparticleRaa.cxx | 485 ++++++++++++++++++++++ 2 files changed, 490 insertions(+) create mode 100644 PWGLF/Tasks/Nuspex/chargedparticleRaa.cxx diff --git a/PWGLF/Tasks/Nuspex/CMakeLists.txt b/PWGLF/Tasks/Nuspex/CMakeLists.txt index 38d5704f683..7e7e4d99c8a 100644 --- a/PWGLF/Tasks/Nuspex/CMakeLists.txt +++ b/PWGLF/Tasks/Nuspex/CMakeLists.txt @@ -165,4 +165,9 @@ o2physics_add_dpl_workflow(pikp-raa-analysis PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(chargedparticle-raa + SOURCES chargedparticleRaa.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + endif() diff --git a/PWGLF/Tasks/Nuspex/chargedparticleRaa.cxx b/PWGLF/Tasks/Nuspex/chargedparticleRaa.cxx new file mode 100644 index 00000000000..e0155a6e514 --- /dev/null +++ b/PWGLF/Tasks/Nuspex/chargedparticleRaa.cxx @@ -0,0 +1,485 @@ +// 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 chargedparticleRaa.cxx +/// +/// \brief task for analysis of charged-particle RAA at midrapidity in light-ion collisions +/// \author Abhi Modak (abhi.modak@cern.ch) +/// \since October 01, 2025 + +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGMM/Mult/DataModel/Index.h" +#include "PWGMM/Mult/DataModel/bestCollisionTable.h" + +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/MathConstants.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/Configurable.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/GlobalTrackID.h" +#include "ReconstructionDataFormats/Track.h" + +#include + +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::aod::track; +using namespace o2::aod::evsel; + +using ColDataTablePbPb = soa::Join; +using ColDataTablepp = soa::Join; +using ColMCRecTablePbPb = soa::SmallGroups>; +using ColMCRecTablepp = soa::SmallGroups>; +using ColMCTrueTable = aod::McCollisions; +using TrackDataTable = soa::Join; +using FilTrackDataTable = soa::Filtered; +using TrackMCRecTable = soa::Join; +using FilTrackMCRecTable = soa::Filtered; +using TrackMCTrueTable = aod::McParticles; + +enum { + kTrackTypebegin = 0, + kGlobalplusITS = 1, + kGlobalonly, + kITSonly, + kTrackTypeend +}; + +static constexpr TrackSelectionFlags::flagtype TrackSelectionIts = + TrackSelectionFlags::kITSNCls | TrackSelectionFlags::kITSChi2NDF | + TrackSelectionFlags::kITSHits; +static constexpr TrackSelectionFlags::flagtype TrackSelectionTpc = + TrackSelectionFlags::kTPCNCls | + TrackSelectionFlags::kTPCCrossedRowsOverNCls | + TrackSelectionFlags::kTPCChi2NDF; +static constexpr TrackSelectionFlags::flagtype TrackSelectionDca = + TrackSelectionFlags::kDCAz | TrackSelectionFlags::kDCAxy; +static constexpr TrackSelectionFlags::flagtype TrackSelectionDcaxyOnly = + TrackSelectionFlags::kDCAxy; + +AxisSpec axisEvent{15, 0.5, 15.5, "#Event", "EventAxis"}; +AxisSpec axisVtxZ{40, -20, 20, "Vertex Z", "VzAxis"}; +AxisSpec axisEta{40, -2, 2, "#eta", "EtaAxis"}; +AxisSpec axisPhi{629, 0, o2::constants::math::TwoPI, "#phi"}; +AxisSpec axisCent{100, 0, 100, "#Cent"}; +AxisSpec axisTrackType = {kTrackTypeend - 1, +kTrackTypebegin + 0.5, +kTrackTypeend - 0.5, "", "TrackTypeAxis"}; +auto static constexpr kMinCharge = 3.f; + +struct ChargedparticleRaa { + + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + Service pdg; + Preslice perCollision = aod::track::collisionId; + Configurable etaRange{"etaRange", 1.0f, "Eta range to consider"}; + Configurable vtxRange{"vtxRange", 10.0f, "Vertex Z range to consider"}; + Configurable occuRange{"occuRange", 500.0f, "Occupancy range to consider"}; + Configurable dcaZ{"dcaZ", 0.2f, "Custom DCA Z cut (ignored if negative)"}; + Configurable cfgPtCutMin{"cfgPtCutMin", 0.15f, "minimum accepted track pT"}; + Configurable extraphicut1{"extraphicut1", 3.07666f, "Extra Phi cut 1"}; + Configurable extraphicut2{"extraphicut2", 3.12661f, "Extra Phi cut 2"}; + Configurable extraphicut3{"extraphicut3", 0.03f, "Extra Phi cut 3"}; + Configurable extraphicut4{"extraphicut4", 6.253f, "Extra Phi cut 4"}; + ConfigurableAxis ptHistBin{"ptHistBin", {200, 0., 20.}, ""}; + ConfigurableAxis centralityBinning{"centralityBinning", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, ""}; + ConfigurableAxis binsImpactPar{"binsImpactPar", {VARIABLE_WIDTH, 0.0, 3.00065, 4.28798, 6.14552, 7.6196, 8.90942, 10.0897, 11.2002, 12.2709, 13.3167, 14.4173, 23.2518}, "Binning of the impact parameter axis"}; + + Configurable isApplySameBunchPileup{"isApplySameBunchPileup", false, "Enable SameBunchPileup cut"}; + Configurable isApplyGoodZvtxFT0vsPV{"isApplyGoodZvtxFT0vsPV", false, "Enable GoodZvtxFT0vsPV cut"}; + Configurable isApplyExtraPhiCut{"isApplyExtraPhiCut", false, "Enable extra phi cut"}; + Configurable isApplyNoCollInTimeRangeStandard{"isApplyNoCollInTimeRangeStandard", true, "Enable NoCollInTimeRangeStandard cut"}; + Configurable isApplyNoCollInRofStandard{"isApplyNoCollInRofStandard", false, "Enable NoCollInRofStandard cut"}; + Configurable isApplyNoHighMultCollInPrevRof{"isApplyNoHighMultCollInPrevRof", false, "Enable NoHighMultCollInPrevRof cut"}; + Configurable isApplyFT0CbasedOccupancy{"isApplyFT0CbasedOccupancy", false, "Enable FT0CbasedOccupancy cut"}; + Configurable isApplyInelgt0{"isApplyInelgt0", false, "Enable INEL > 0 condition"}; + Configurable isApplyOccuCut{"isApplyOccuCut", false, "Enable occupancy selection"}; + + void init(InitContext const&) + { + AxisSpec centAxis = {centralityBinning, "Centrality", "CentralityAxis"}; + AxisSpec axisPt = {ptHistBin, "pT", "pTAxis"}; + AxisSpec impactParAxis = {binsImpactPar, "Impact Parameter"}; + + histos.add("EventHist", "EventHist", kTH1D, {axisEvent}, false); + histos.add("VtxZHist", "VtxZHist", kTH1D, {axisVtxZ}, false); + histos.add("CentPercentileHist", "CentPercentileHist", kTH1D, {axisCent}, false); + histos.add("CentPercentileMCRecHist", "CentPercentileMCRecHist", kTH1D, {axisCent}, false); + histos.add("PhiVsEtaHistNoCut", "PhiVsEtaHistNoCut", kTH2D, {axisPhi, axisEta}, false); + histos.add("PhiVsEtaHistWithCut", "PhiVsEtaHistWithCut", kTH2D, {axisPhi, axisEta}, false); + + if (doprocessDataPbPb) { + histos.add("hdatazvtxcent", "hdatazvtxcent", kTH2D, {axisVtxZ, centAxis}, false); + histos.add("hdatahistPbPb", "hdatahistPbPb", kTHnSparseD, {axisVtxZ, centAxis, axisPt, axisTrackType}, false); + } + + if (doprocessDatapp) { + histos.add("hdatahistpp", "hdatahistpp", kTHnSparseD, {axisVtxZ, axisPt, axisTrackType}, false); + } + + if (doprocessMCPbPb) { + histos.add("hmczvtxcent", "hmczvtxcent", kTH2D, {axisVtxZ, centAxis}, false); + histos.add("hmcrechistPbPb", "hmcrechistPbPb", kTHnSparseD, {axisVtxZ, centAxis, axisPt, axisTrackType}, false); + histos.add("hmcgenhistPbPb", "hmcgenhistPbPb", kTHnSparseD, {axisVtxZ, centAxis, axisPt}, false); + } + + if (doprocessMCpp) { + histos.add("hmcrechistpp", "hmcrechistpp", kTHnSparseD, {axisVtxZ, axisPt, axisTrackType}, false); + histos.add("hmcgenhistpp", "hmcgenhistpp", kTHnSparseD, {axisVtxZ, axisPt}, false); + } + + if (doprocessEvtLossSigLossMCpp || doprocessEvtLossSigLossMCPbPb) { + histos.add("MCEventHist", "MCEventHist", kTH1F, {axisEvent}, false); + auto hstat = histos.get(HIST("MCEventHist")); + auto* x = hstat->GetXaxis(); + x->SetBinLabel(1, "All MC events"); + x->SetBinLabel(2, "MC events with atleast one reco event"); + histos.add("hgenptBeforeEvtSel", "hgenptBeforeEvtSel", kTH1F, {axisPt}, false); + histos.add("hgenptAfterEvtSel", "hgenptAfterEvtSel", kTH1F, {axisPt}, false); + histos.add("hgenptBeforeEvtSelPbPb", "hgenptBeforeEvtSelPbPb", kTH2F, {axisPt, impactParAxis}, false); + histos.add("hgenptAfterEvtSelPbPb", "hgenptAfterEvtSelPbPb", kTH2F, {axisPt, impactParAxis}, false); + histos.add("hImpactParameterGen", "Impact parameter of generated MC events", kTH1F, {impactParAxis}); + histos.add("hImpactParameterRec", "Impact parameter of selected MC events", kTH1F, {impactParAxis}); + histos.add("hImpactParvsCentrRec", "Impact parameter of selected MC events vs centrality", kTH2F, {axisCent, impactParAxis}); + } + + auto hstat = histos.get(HIST("EventHist")); + auto* x = hstat->GetXaxis(); + x->SetBinLabel(1, "All events"); + x->SetBinLabel(2, "sel8"); + x->SetBinLabel(3, "kNoSameBunchPileup"); // reject collisions in case of pileup with another collision in the same foundBC + x->SetBinLabel(4, "kIsGoodZvtxFT0vsPV"); // small difference between z-vertex from PV and from FT0 + x->SetBinLabel(5, "ApplyNoCollInTimeRangeStandard"); + x->SetBinLabel(6, "ApplyNoCollInRofStandard"); + x->SetBinLabel(7, "ApplyNoHighMultCollInPrevRof"); + x->SetBinLabel(8, "INEL > 0"); + x->SetBinLabel(9, "|vz|<10"); + x->SetBinLabel(10, "Occupancy<500"); + } + + template + bool isEventSelected(CheckCol const& col) + { + histos.fill(HIST("EventHist"), 1); + + if (!col.sel8()) { + return false; + } + histos.fill(HIST("EventHist"), 2); + + if (isApplySameBunchPileup && !col.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + return false; + } + histos.fill(HIST("EventHist"), 3); + + if (isApplyGoodZvtxFT0vsPV && !col.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + return false; + } + histos.fill(HIST("EventHist"), 4); + + if (isApplyNoCollInTimeRangeStandard && !col.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return false; + } + histos.fill(HIST("EventHist"), 5); + + if (isApplyNoCollInRofStandard && !col.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { + return false; + } + histos.fill(HIST("EventHist"), 6); + + if (isApplyNoHighMultCollInPrevRof && !col.selection_bit(o2::aod::evsel::kNoHighMultCollInPrevRof)) { + return false; + } + histos.fill(HIST("EventHist"), 7); + + if (isApplyInelgt0 && !col.isInelGt0()) { + return false; + } + histos.fill(HIST("EventHist"), 8); + + if (std::abs(col.posZ()) >= vtxRange) { + return false; + } + histos.fill(HIST("EventHist"), 9); + + auto occu = isApplyFT0CbasedOccupancy ? col.ft0cOccupancyInTimeRange() : col.trackOccupancyInTimeRange(); + if (isApplyOccuCut && occu > occuRange) { + return false; + } + histos.fill(HIST("EventHist"), 10); + return true; + } + + template + bool isTrackSelected(CheckTrack const& track) + { + if (std::abs(track.eta()) >= etaRange) { + return false; + } + histos.fill(HIST("PhiVsEtaHistNoCut"), track.phi(), track.eta()); + if (isApplyExtraPhiCut && ((track.phi() > extraphicut1 && track.phi() < extraphicut2) || track.phi() <= extraphicut3 || track.phi() >= extraphicut4)) { + return false; + } + histos.fill(HIST("PhiVsEtaHistWithCut"), track.phi(), track.eta()); + return true; + } + + template + bool isGenTrackSelected(CheckGenTrack const& track) + { + if (!track.isPhysicalPrimary()) { + return false; + } + if (!track.producedByGenerator()) { + return false; + } + auto pdgTrack = pdg->GetParticle(track.pdgCode()); + if (pdgTrack == nullptr) { + return false; + } + if (std::abs(pdgTrack->Charge()) < kMinCharge) { + return false; + } + if (std::abs(track.eta()) >= etaRange) { + return false; + } + if (isApplyExtraPhiCut && ((track.phi() > extraphicut1 && track.phi() < extraphicut2) || track.phi() <= extraphicut3 || track.phi() >= extraphicut4)) { + return false; + } + return true; + } + + Filter fTrackSelectionITS = ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) && + ncheckbit(aod::track::trackCutFlag, TrackSelectionIts); + Filter fTrackSelectionTPC = ifnode(ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC), + ncheckbit(aod::track::trackCutFlag, TrackSelectionTpc), true); + Filter fTrackSelectionDCA = ifnode(dcaZ.node() > 0.f, nabs(aod::track::dcaZ) <= dcaZ && ncheckbit(aod::track::trackCutFlag, TrackSelectionDcaxyOnly), + ncheckbit(aod::track::trackCutFlag, TrackSelectionDca)); + Filter fTracksPt = aod::track::pt > cfgPtCutMin; + + void processDataPbPb(ColDataTablePbPb::iterator const& cols, FilTrackDataTable const& tracks) + { + if (!isEventSelected(cols)) { + return; + } + histos.fill(HIST("VtxZHist"), cols.posZ()); + histos.fill(HIST("CentPercentileHist"), cols.centFT0C()); + histos.fill(HIST("hdatazvtxcent"), cols.posZ(), cols.centFT0C()); + + for (const auto& track : tracks) { + if (!isTrackSelected(track)) { + continue; + } + histos.fill(HIST("hdatahistPbPb"), cols.posZ(), cols.centFT0C(), track.pt(), kGlobalplusITS); + if (track.hasTPC()) { + histos.fill(HIST("hdatahistPbPb"), cols.posZ(), cols.centFT0C(), track.pt(), kGlobalonly); + } else { + histos.fill(HIST("hdatahistPbPb"), cols.posZ(), cols.centFT0C(), track.pt(), kITSonly); + } + } + } + + void processDatapp(ColDataTablepp::iterator const& cols, FilTrackDataTable const& tracks) + { + if (!isEventSelected(cols)) { + return; + } + histos.fill(HIST("VtxZHist"), cols.posZ()); + + for (const auto& track : tracks) { + if (!isTrackSelected(track)) { + continue; + } + histos.fill(HIST("hdatahistpp"), cols.posZ(), track.pt(), kGlobalplusITS); + if (track.hasTPC()) { + histos.fill(HIST("hdatahistpp"), cols.posZ(), track.pt(), kGlobalonly); + } else { + histos.fill(HIST("hdatahistpp"), cols.posZ(), track.pt(), kITSonly); + } + } + } + + void processMCPbPb(ColMCTrueTable::iterator const&, ColMCRecTablePbPb const& RecCols, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks) + { + + for (const auto& RecCol : RecCols) { + if (!isEventSelected(RecCol)) { + continue; + } + histos.fill(HIST("VtxZHist"), RecCol.posZ()); + histos.fill(HIST("CentPercentileMCRecHist"), RecCol.centFT0C()); + histos.fill(HIST("hmczvtxcent"), RecCol.posZ(), RecCol.centFT0C()); + + auto recTracksPart = RecTracks.sliceBy(perCollision, RecCol.globalIndex()); + for (const auto& Rectrack : recTracksPart) { + if (!isTrackSelected(Rectrack)) { + continue; + } + histos.fill(HIST("hmcrechistPbPb"), RecCol.posZ(), RecCol.centFT0C(), Rectrack.pt(), kGlobalplusITS); + if (Rectrack.hasTPC()) { + histos.fill(HIST("hmcrechistPbPb"), RecCol.posZ(), RecCol.centFT0C(), Rectrack.pt(), kGlobalonly); + } else { + histos.fill(HIST("hmcrechistPbPb"), RecCol.posZ(), RecCol.centFT0C(), Rectrack.pt(), kITSonly); + } + } // track (mcrec) loop + + for (const auto& particle : GenParticles) { + if (!isGenTrackSelected(particle)) { + continue; + } + histos.fill(HIST("hmcgenhistPbPb"), RecCol.posZ(), RecCol.centFT0C(), particle.pt()); + } // track (mcgen) loop + } // collision loop + } + + void processMCpp(ColMCTrueTable::iterator const&, ColMCRecTablepp const& RecCols, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks) + { + + for (const auto& RecCol : RecCols) { + if (!isEventSelected(RecCol)) { + continue; + } + histos.fill(HIST("VtxZHist"), RecCol.posZ()); + + auto recTracksPart = RecTracks.sliceBy(perCollision, RecCol.globalIndex()); + for (const auto& Rectrack : recTracksPart) { + if (!isTrackSelected(Rectrack)) { + continue; + } + histos.fill(HIST("hmcrechistpp"), RecCol.posZ(), Rectrack.pt(), kGlobalplusITS); + if (Rectrack.hasTPC()) { + histos.fill(HIST("hmcrechistpp"), RecCol.posZ(), Rectrack.pt(), kGlobalonly); + } else { + histos.fill(HIST("hmcrechistpp"), RecCol.posZ(), Rectrack.pt(), kITSonly); + } + } // track (mcrec) loop + + for (const auto& particle : GenParticles) { + if (!isGenTrackSelected(particle)) { + continue; + } + histos.fill(HIST("hmcgenhistpp"), RecCol.posZ(), particle.pt()); + } // track (mcgen) loop + } // collision loop + } + + void processEvtLossSigLossMCpp(soa::Join::iterator const& mcCollision, ColMCRecTablepp const& RecCols, TrackMCTrueTable const& GenParticles) + { + if (isApplyInelgt0 && !mcCollision.isInelGt0()) { + return; + } + if (std::abs(mcCollision.posZ()) >= vtxRange) { + return; + } + // All generated events + histos.fill(HIST("MCEventHist"), 1); + + bool atLeastOne = false; + auto numcontributors = -999; + for (const auto& RecCol : RecCols) { + if (!isEventSelected(RecCol)) { + continue; + } + if (RecCol.numContrib() <= numcontributors) { + continue; + } else { + numcontributors = RecCol.numContrib(); + } + atLeastOne = true; + } + if (atLeastOne) { + histos.fill(HIST("MCEventHist"), 2); + } + for (const auto& particle : GenParticles) { + if (!isGenTrackSelected(particle)) { + continue; + } + // All generated particles + histos.fill(HIST("hgenptBeforeEvtSel"), particle.pt()); + if (atLeastOne) { + // All generated particles with at least one reconstructed collision (signal loss estimation) + histos.fill(HIST("hgenptAfterEvtSel"), particle.pt()); + } + } + } + + void processEvtLossSigLossMCPbPb(soa::Join::iterator const& mcCollision, ColMCRecTablePbPb const& RecCols, TrackMCTrueTable const& GenParticles) + { + if (isApplyInelgt0 && !mcCollision.isInelGt0()) { + return; + } + if (std::abs(mcCollision.posZ()) >= vtxRange) { + return; + } + // All generated events + histos.fill(HIST("MCEventHist"), 1); + histos.fill(HIST("hImpactParameterGen"), mcCollision.impactParameter()); + + bool atLeastOne = false; + auto centrality = -999.; + auto numcontributors = -999; + for (const auto& RecCol : RecCols) { + if (!isEventSelected(RecCol)) { + continue; + } + if (RecCol.numContrib() <= numcontributors) { + continue; + } else { + numcontributors = RecCol.numContrib(); + } + centrality = RecCol.centFT0C(); + atLeastOne = true; + } + if (atLeastOne) { + histos.fill(HIST("MCEventHist"), 2); + histos.fill(HIST("hImpactParameterRec"), mcCollision.impactParameter()); + histos.fill(HIST("hImpactParvsCentrRec"), centrality, mcCollision.impactParameter()); + } + for (const auto& particle : GenParticles) { + if (!isGenTrackSelected(particle)) { + continue; + } + // All generated particles + histos.fill(HIST("hgenptBeforeEvtSelPbPb"), particle.pt(), mcCollision.impactParameter()); + if (atLeastOne) { + // All generated particles with at least one reconstructed collision (signal loss estimation) + histos.fill(HIST("hgenptAfterEvtSelPbPb"), particle.pt(), mcCollision.impactParameter()); + } + } + } + + PROCESS_SWITCH(ChargedparticleRaa, processDataPbPb, "process data heavy-ion", false); + PROCESS_SWITCH(ChargedparticleRaa, processDatapp, "process data pp", false); + PROCESS_SWITCH(ChargedparticleRaa, processMCPbPb, "process MC heavy-ion", false); + PROCESS_SWITCH(ChargedparticleRaa, processMCpp, "process MC pp", false); + PROCESS_SWITCH(ChargedparticleRaa, processEvtLossSigLossMCpp, "process Signal Loss, Event Loss", false); + PROCESS_SWITCH(ChargedparticleRaa, processEvtLossSigLossMCPbPb, "process Signal Loss, Event Loss", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From 5d2ea8a8bd126c55a965933eaf5cd1f4ca14aace Mon Sep 17 00:00:00 2001 From: navneetkumar231295 <71565461+navneetkumar231295@users.noreply.github.com> Date: Thu, 2 Oct 2025 19:07:34 +0530 Subject: [PATCH 610/986] [PWGLF] Updated task for Event Mixing (#13174) Co-authored-by: Navneet --- .../Tasks/Resonances/chargedkstaranalysis.cxx | 57 +++++++++++++------ 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/PWGLF/Tasks/Resonances/chargedkstaranalysis.cxx b/PWGLF/Tasks/Resonances/chargedkstaranalysis.cxx index e6cab64be57..d654438456f 100644 --- a/PWGLF/Tasks/Resonances/chargedkstaranalysis.cxx +++ b/PWGLF/Tasks/Resonances/chargedkstaranalysis.cxx @@ -898,28 +898,49 @@ struct chargedkstaranalysis { PROCESS_SWITCH(chargedkstaranalysis, processDataSE, "Process Event for data without Partitioning", true); SliceCache cache; - using BinningTypeVtxZT0M = ColumnBinningPolicy; - - // using BinningTypeVtxZT0M = ColumnBinningPolicy>; - BinningTypeVtxZT0M colBinning{{cfgvtxbins, cfgmultbins}, true}; - void processDataME(EventCandidates const& collisions, TrackCandidates const& tracks, V0Candidates const& v0s) + using BinningTypeVertexContributor = ColumnBinningPolicy; + BinningTypeVertexContributor binningOnPositions{{cfgvtxbins, cfgmultbins}, true}; + Pair pair{binningOnPositions, nEvtMixing, -1, &cache}; + void processDataME(EventCandidates const& /*collisions*/, TrackCandidates const& /*tracks*/, V0Candidates const& /*V0s*/) { - Preslice perCollision = aod::track::collisionId; - Preslice perCollisionV0 = aod::v0::collisionId; - auto tracksV0sTuple = std::make_tuple(tracks, v0s); - - Pair pair{colBinning, nEvtMixing, -1, collisions, tracksV0sTuple, &cache}; - // restrk1 is a TrackCandidates table of tracks belonging to collision c1 (aod::Collision::iterator) - // resov0s2 is a V0Candidates table of V0s belonging to collision c2 (aod::Collision::iterator) - for (const auto& [c1, restrk1, c2, resov0s2] : pair) { - if (!colCuts.isSelected(c1) || !colCuts.isSelected(c2)) { - // Default event selection + for (auto& [c1, tracks1, c2, tracks2] : pair) { + + if (!colCuts.isSelected(c1)) { continue; } - colCuts.fillQA(c1); - fillHistograms(c1, restrk1, resov0s2); + if (!colCuts.isSelected(c2)) { + continue; + } + + for (auto& [t1, t2] : o2::soa::combinations( + o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { + // Here t1 corressponds to bachelor track and t2 corressponds to v0s. + if (!isTrackSelected(t1)) + continue; + if (!trackCut(t1)) + continue; + if (!selectionPIDPion(t1)) + continue; + + auto posDauTrack = t2.template posTrack_as(); + auto negDauTrack = t2.template negTrack_as(); + if (!cfgByPassDauPIDSelection && !selectionPIDPion(posDauTrack)) // Perhaps it's already applied in trackCut (need to check QA plots) + continue; + if (!cfgByPassDauPIDSelection && !selectionPIDPion(negDauTrack)) + continue; + if (!selectionK0s(c2, t2)) + continue; + + ROOT::Math::PxPyPzMVector lResoSecondary, lDecayDaughter_bach, lResoKstar; + lDecayDaughter_bach = ROOT::Math::PxPyPzMVector(t1.px(), t1.py(), t1.pz(), massPi); + lResoSecondary = ROOT::Math::PxPyPzMVector(t2.px(), t2.py(), t2.pz(), massK0s); + lResoKstar = lResoSecondary + lDecayDaughter_bach; + + if (lResoKstar.Rapidity() > cKstarMaxRap || lResoKstar.Rapidity() < cKstarMinRap) + continue; + histos.fill(HIST("hInvmass_KstarME"), c1.centFT0M(), lResoKstar.Pt(), lResoKstar.M()); + } } - // fillHistograms(collision, tracks, v0s); // second order } PROCESS_SWITCH(chargedkstaranalysis, processDataME, "Process Event for data without Partitioning", true); From 1fd80455aefb75b14922da0e814b82828bc0d242 Mon Sep 17 00:00:00 2001 From: Himanshu Sharma Date: Thu, 2 Oct 2025 23:27:25 +0200 Subject: [PATCH 611/986] [PWGHF] Update selection status `isSelXicToPKPi` and `isSelXicToPiKP` filling (#13207) --- PWGHF/TableProducer/treeCreatorXicToPKPi.cxx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/PWGHF/TableProducer/treeCreatorXicToPKPi.cxx b/PWGHF/TableProducer/treeCreatorXicToPKPi.cxx index a7e592d910e..07374fe70ad 100644 --- a/PWGHF/TableProducer/treeCreatorXicToPKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorXicToPKPi.cxx @@ -282,12 +282,16 @@ struct HfTreeCreatorXicToPKPi { } float invMassXic = 0; - if constexpr (massHypo == 0) { + int selStatusPKPi = candidate.isSelXicToPKPi(); + int selStatusPiKP = candidate.isSelXicToPiKP(); + + if constexpr (massHypo == 0) { // Xic->PKPi + selStatusPiKP *= -1; invMassXic = hfHelper.invMassXicToPKPi(candidate); - } else if constexpr (massHypo == 1) { + } else if constexpr (massHypo == 1) { // Xic->PiKP + selStatusPKPi *= -1; invMassXic = hfHelper.invMassXicToPiKP(candidate); } - if (fillCandidateLiteTable) { rowCandidateLite( candidate.chi2PCA(), @@ -316,8 +320,8 @@ struct HfTreeCreatorXicToPKPi { candidate.tpcTofNSigmaKa1(), candidate.tpcTofNSigmaPi2(), candidate.tpcTofNSigmaPr2(), - candidate.isSelXicToPKPi(), - candidate.isSelXicToPiKP(), + selStatusPKPi, + selStatusPiKP, invMassXic, candidate.pt(), candidate.cpa(), @@ -383,8 +387,8 @@ struct HfTreeCreatorXicToPKPi { candidate.tpcTofNSigmaKa1(), candidate.tpcTofNSigmaPi2(), candidate.tpcTofNSigmaPr2(), - candidate.isSelXicToPKPi(), - candidate.isSelXicToPiKP(), + selStatusPKPi, + selStatusPiKP, invMassXic, candidate.pt(), candidate.p(), From cbbbfec91225c2743174a83260cb73d7810a3204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?BiaoZhang=20=28=E5=BC=A0=E5=BD=AA=29?= <52267892+zhangbiao-phy@users.noreply.github.com> Date: Fri, 3 Oct 2025 08:13:07 +0200 Subject: [PATCH 612/986] [PWGHF] fix a small bug of configuration match for charm femto task (#13210) Co-authored-by: ALICE Action Bot --- PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx b/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx index 96af0f52f5a..7cf441c2938 100644 --- a/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx +++ b/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx @@ -23,6 +23,7 @@ #include "PWGCF/FemtoDream/Core/femtoDreamPairCleaner.h" #include "PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h" #include "PWGCF/FemtoDream/Core/femtoDreamUtils.h" +#include "PWGHF/Core/DecayChannels.h" #include "Common/Core/RecoDecay.h" @@ -54,6 +55,8 @@ using namespace o2::soa; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::analysis::femtoDream; +using namespace o2::hf_decay; +using namespace o2::hf_decay::hf_cand_3prong; inline o2::framework::expressions::Node coshEta(o2::framework::expressions::Node&& eta) { @@ -87,7 +90,7 @@ struct HfTaskCharmHadronsFemtoDream { /// Particle 2 (Charm Hadrons) Configurable charmHadBkgBDTmax{"charmHadBkgBDTmax", 1., "Maximum background bdt score for Charm Hadron (particle 2)"}; Configurable charmHadCandSel{"charmHadCandSel", 1, "candidate selection for charm hadron"}; - Configurable charmHadMcSel{"charmHadMcSel", 2, "charm hadron selection for mc, partDplusToPiKPi (1), partLcToPKPi (2), partDsToKKPi (4), partXicToPKPi (8)"}; + Configurable charmHadMcSel{"charmHadMcSel", DecayChannelMain::LcToPKPi, "charm hadron selection for mc, DplusToPiKPi = 1, LcToPKPi = 17"}; Configurable charmHadFdBDTmin{"charmHadFdBDTmin", 0., "Minimum feed-down bdt score Charm Hadron (particle 2)"}; Configurable charmHadFdBDTmax{"charmHadFdBDTmax", 1., "Maximum feed-down bdt score Charm Hadron (particle 2)"}; Configurable charmHadMaxInvMass{"charmHadMaxInvMass", 2.45, "Maximum invariant mass of Charm Hadron (particle 2)"}; From b235825c435e8e8d94c3699813841a0c080116ac Mon Sep 17 00:00:00 2001 From: ArkaprabhaSaha001 Date: Fri, 3 Oct 2025 09:31:47 +0200 Subject: [PATCH 613/986] [PWGLF] Edited my task for light nuclei analysis (#13208) Co-authored-by: arkaprabha --- PWGLF/Tasks/Nuspex/CMakeLists.txt | 2 +- .../{antinucleiTask.cxx => antiNucleiTask.cxx} | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) rename PWGLF/Tasks/Nuspex/{antinucleiTask.cxx => antiNucleiTask.cxx} (94%) diff --git a/PWGLF/Tasks/Nuspex/CMakeLists.txt b/PWGLF/Tasks/Nuspex/CMakeLists.txt index 7e7e4d99c8a..0ce50257c6f 100644 --- a/PWGLF/Tasks/Nuspex/CMakeLists.txt +++ b/PWGLF/Tasks/Nuspex/CMakeLists.txt @@ -120,7 +120,7 @@ o2physics_add_dpl_workflow(nuclei-ebye COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(anti-nuclei-hist - SOURCES antinucleiTask.cxx + SOURCES antiNucleiTask.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) diff --git a/PWGLF/Tasks/Nuspex/antinucleiTask.cxx b/PWGLF/Tasks/Nuspex/antiNucleiTask.cxx similarity index 94% rename from PWGLF/Tasks/Nuspex/antinucleiTask.cxx rename to PWGLF/Tasks/Nuspex/antiNucleiTask.cxx index 7cf38de948f..6f4070219f5 100644 --- a/PWGLF/Tasks/Nuspex/antinucleiTask.cxx +++ b/PWGLF/Tasks/Nuspex/antiNucleiTask.cxx @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file antinucleiTask.cxx +/// \file antiNucleiTask.cxx /// \brief A task to analyse Anti-nuclei /// \author Arkaprabha Saha @@ -48,14 +48,15 @@ static const int minTpcCrossedRowsCut = 70; static const float maxVertexZCut = 10.f; } // namespace -struct antinucleiTask { +struct antiNucleiTask { // Histogram registry: for holding histograms HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; // Configurable track cuts Configurable trackNclusTPCcut{"trackNclusTPCcut", 70.0f, "min number of TPC clusters"}; Configurable trackNclusITScut{"trackNclusITScut", 4.0f, "min number of ITS clusters"}; - Configurable chi2TPC{"chi2TPC", 4.0f, "max chi2 per cluster TPC"}; + Configurable maxChi2TPC{"maxChi2TPC", 4.0f, "max chi2 per cluster TPC"}; + Configurable minChi2TPC{"minChi2TPC", 0.0f, "min chi2 per cluster TPC"}; Configurable chi2ITS{"chi2ITS", 36.0f, "max chi2 per cluster ITS"}; Configurable trackDCAz{"trackDCAz", 0.1f, "maxDCAz"}; Configurable trackDCAxy{"trackDCAxy", 0.1f, "maxDCAxy"}; @@ -101,7 +102,9 @@ struct antinucleiTask { return false; if (track.itsNCls() < trackNclusITScut) return false; - if (track.tpcChi2NCl() > chi2TPC) + if (track.tpcChi2NCl() > maxChi2TPC) + return false; + if (track.tpcChi2NCl() < minChi2TPC) return false; if (track.itsChi2NCl() > chi2ITS) return false; @@ -162,11 +165,11 @@ struct antinucleiTask { } } - PROCESS_SWITCH(antinucleiTask, process, "process", true); + PROCESS_SWITCH(antiNucleiTask, process, "process", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(cfgc)}; } From d1271f4d69e781ffe8329b3f5139142f5b6397fa Mon Sep 17 00:00:00 2001 From: amaringarcia Date: Fri, 3 Oct 2025 12:10:55 +0200 Subject: [PATCH 614/986] [Common] Changes for testing TPC PID NN v3 (#13213) Co-authored-by: Ana Marin --- Common/Tools/PID/pidTPCModule.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Common/Tools/PID/pidTPCModule.h b/Common/Tools/PID/pidTPCModule.h index 36b3c54df00..3c7e555c940 100644 --- a/Common/Tools/PID/pidTPCModule.h +++ b/Common/Tools/PID/pidTPCModule.h @@ -127,6 +127,7 @@ struct pidTPCConfigurables : o2::framework::ConfigurableGroup { o2::framework::Configurable useNetworkHe{"useNetworkHe", 1, {"Switch for applying neural network on the helium3 mass hypothesis (if network enabled) (set to 0 to disable)"}}; o2::framework::Configurable useNetworkAl{"useNetworkAl", 1, {"Switch for applying neural network on the alpha mass hypothesis (if network enabled) (set to 0 to disable)"}}; o2::framework::Configurable networkBetaGammaCutoff{"networkBetaGammaCutoff", 0.45, {"Lower value of beta-gamma to override the NN application"}}; + o2::framework::Configurable irSource{"irSource", "ZNC hadronic", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"}; }; // helper getter - FIXME should be separate @@ -432,6 +433,8 @@ class pidTPCModule // Filling a std::vector to be evaluated by the network // Evaluation on single tracks brings huge overhead: Thus evaluation is done on one large vector for (int i = 0; i < 9; i++) { // Loop over particle number for which network correction is used + float hadronicRate = 0.; + uint64_t timeStamp_bcOld = 0; for (auto const& trk : tracks) { if (!trk.hasTPC()) { continue; @@ -450,6 +453,19 @@ class pidTPCModule if (input_dimensions == 7 && networkVersion == "2") { track_properties[counter_track_props + 6] = trk.has_collision() ? collisions.iteratorAt(trk.collisionId()).ft0cOccupancyInTimeRange() / 60000. : 1.; } + if (input_dimensions == 8 && networkVersion == "3") { + track_properties[counter_track_props + 6] = trk.has_collision() ? collisions.iteratorAt(trk.collisionId()).ft0cOccupancyInTimeRange() / 60000. : 1.; + if (trk.has_collision()) { + auto trk_bc = (collisions.iteratorAt(trk.collisionId())).template bc_as(); + if (trk_bc.timestamp() != timeStamp_bcOld) { + hadronicRate = mRateFetcher.fetch(ccdb.service, trk_bc.timestamp(), trk_bc.runNumber(), pidTPCopts.irSource.value) * 1.e-3; + } + timeStamp_bcOld = trk_bc.timestamp(); + track_properties[counter_track_props + 7] = hadronicRate / 50.; + } else { + track_properties[counter_track_props + 7] = 1; + } + } counter_track_props += input_dimensions; } From 5fd09e8caff0986a3afee1b2d9feba05056aea99 Mon Sep 17 00:00:00 2001 From: Lucia Anna Tarasovicova Date: Fri, 3 Oct 2025 14:00:52 +0200 Subject: [PATCH 615/986] [PWGLF] Change in hStrangeCorrelation.cxx (#13217) Co-authored-by: Lucia Anna Tarasovicova --- .../Tasks/Strangeness/hStrangeCorrelation.cxx | 152 +++++++----------- 1 file changed, 58 insertions(+), 94 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx b/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx index de750579eea..42297eb61e3 100644 --- a/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx +++ b/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx @@ -596,27 +596,26 @@ struct HStrangeCorrelation { auto trigg = triggerTrack.track_as(); if (!isValidTrigger(trigg)) continue; - + float efficiencyTrigg = 1.0f; + float efficiencyTriggError = 0.0f; + float purityTrigg = 1.0f; + float purityTriggErr = 0.0; if (!mixing) { - float efficiency = 1.0f; - float efficiencyError = 0.0f; - float purity = 1.0f; - float purityErr = 0.0; if (efficiencyFlags.applyEfficiencyForTrigger) { - efficiency = hEfficiencyTrigger->Interpolate(trigg.pt(), trigg.eta()); + efficiencyTrigg = hEfficiencyTrigger->Interpolate(trigg.pt(), trigg.eta()); if (efficiencyFlags.applyPurityTrigger) - purity = hPurityHadron->Interpolate(trigg.pt()); + purityTrigg = hPurityHadron->Interpolate(trigg.pt()); if (efficiencyFlags.applyEfficiencyPropagation) { - efficiencyError = hEfficiencyUncertaintyTrigger->Interpolate(trigg.pt(), trigg.eta()); + efficiencyTriggError = hEfficiencyUncertaintyTrigger->Interpolate(trigg.pt(), trigg.eta()); if (efficiencyFlags.applyPurityTrigger) - purityErr = hPurityHadron->Interpolate(trigg.pt()); + purityTriggErr = hPurityHadron->Interpolate(trigg.pt()); } - if (efficiency == 0) { // check for zero efficiency, do not apply if the case - efficiency = 1; - efficiencyError = 0; + if (efficiencyTrigg == 0) { // check for zero efficiency, do not apply if the case + efficiencyTrigg = 1; + efficiencyTriggError = 0; } } - fillTriggerHistogram(histos.get(HIST("sameEvent/TriggerParticlesV0")), trigg.pt(), mult, efficiency, efficiencyError, purity, purityErr); + fillTriggerHistogram(histos.get(HIST("sameEvent/TriggerParticlesV0")), trigg.pt(), mult, efficiencyTrigg, efficiencyTriggError, purityTrigg, purityTriggErr); } double triggSign = trigg.sign(); @@ -702,35 +701,24 @@ struct HStrangeCorrelation { static_for<0, 2>([&](auto i) { constexpr int Index = i.value; float efficiency = 1.0f; - float efficiencytrigg = 1.0f; float totalEffUncert = 0.0; float efficiencyError = 0.0f; - float triggerEfficiencyError = 0.0f; if (efficiencyFlags.applyEfficiencyCorrection) { efficiency = hEfficiencyV0[Index]->Interpolate(ptassoc, assoc.eta()); if (efficiencyFlags.applyEfficiencyPropagation) efficiencyError = hEfficiencyUncertaintyV0[Index]->Interpolate(ptassoc, assoc.eta()); } - if (efficiencyFlags.applyEfficiencyForTrigger) { - efficiency = efficiency * hEfficiencyTrigger->Interpolate(pttrigger, trigg.eta()); - if (efficiencyFlags.applyEfficiencyPropagation) - triggerEfficiencyError = hEfficiencyUncertaintyTrigger->Interpolate(pttrigger, trigg.eta()); - } if (efficiency == 0) { // check for zero efficiency, do not apply if the case efficiency = 1; efficiencyError = 0; } - if (efficiencytrigg == 0) { // check for zero efficiency, do not apply if the case - efficiencytrigg = 1; - triggerEfficiencyError = 0; - } if (efficiencyFlags.applyEfficiencyPropagation) { - totalEffUncert = std::sqrt(std::pow(efficiencytrigg * efficiencyError, 2) + std::pow(triggerEfficiencyError * efficiency, 2)); + totalEffUncert = std::sqrt(std::pow(efficiencyTrigg * efficiencyError, 2) + std::pow(efficiencyTriggError * efficiency, 2)); } double binFillThn[6] = {deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult}; if (TESTBIT(doCorrelation, Index) && (!efficiencyFlags.applyEfficiencyCorrection || efficiency != 0) && (doPPAnalysis || (TESTBIT(selMap, Index) && TESTBIT(selMap, Index + 3)))) { if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && !mixing && -massWindowConfigurations.maxBgNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < -massWindowConfigurations.minBgNSigma) { - fillCorrelationHistogram(histos.get(HIST("sameEvent/LeftBg/") + HIST(kV0names[Index])), binFillThn, etaWeight, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f); + fillCorrelationHistogram(histos.get(HIST("sameEvent/LeftBg/") + HIST(kV0names[Index])), binFillThn, etaWeight, efficiency * efficiencyTrigg, totalEffUncert, purityTrigg, purityTriggErr); if (doDeltaPhiStarCheck) { double deltaPhiStar = calculateAverageDeltaPhiStar(triggForDeltaPhiStar, assocForDeltaPhiStar, bField); double deltaPhiStarPion = calculateAverageDeltaPhiStar(triggForDeltaPhiStar, assocForDeltaPhiStarPion, bField); @@ -748,7 +736,7 @@ struct HStrangeCorrelation { } } if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && !mixing && -massWindowConfigurations.maxPeakNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < +massWindowConfigurations.maxPeakNSigma) { - fillCorrelationHistogram(histos.get(HIST("sameEvent/Signal/") + HIST(kV0names[Index])), binFillThn, etaWeight, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f); + fillCorrelationHistogram(histos.get(HIST("sameEvent/Signal/") + HIST(kV0names[Index])), binFillThn, etaWeight, efficiency * efficiencyTrigg, totalEffUncert, purityTrigg, purityTriggErr); if (std::abs(deltaphi) < 0.8 && doITSClustersQA) { histos.fill(HIST("hITSClusters") + HIST(kV0names[Index]) + HIST("NegativeDaughterToward"), ptassoc, negtrack.itsNCls(), assoc.v0radius()); histos.fill(HIST("hITSClusters") + HIST(kV0names[Index]) + HIST("PositiveDaughterToward"), ptassoc, postrack.itsNCls(), assoc.v0radius()); @@ -774,7 +762,7 @@ struct HStrangeCorrelation { } } if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && !mixing && +massWindowConfigurations.minBgNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < +massWindowConfigurations.maxBgNSigma) { - fillCorrelationHistogram(histos.get(HIST("sameEvent/RightBg/") + HIST(kV0names[Index])), binFillThn, etaWeight, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f); + fillCorrelationHistogram(histos.get(HIST("sameEvent/RightBg/") + HIST(kV0names[Index])), binFillThn, etaWeight, efficiency * efficiencyTrigg, totalEffUncert, purityTrigg, purityTriggErr); if (doDeltaPhiStarCheck) { double deltaPhiStar = calculateAverageDeltaPhiStar(triggForDeltaPhiStar, assocForDeltaPhiStar, bField); double deltaPhiStarPion = calculateAverageDeltaPhiStar(triggForDeltaPhiStar, assocForDeltaPhiStarPion, bField); @@ -792,11 +780,11 @@ struct HStrangeCorrelation { } } if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && mixing && -massWindowConfigurations.maxBgNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < -massWindowConfigurations.minBgNSigma) - fillCorrelationHistogram(histos.get(HIST("mixedEvent/LeftBg/") + HIST(kV0names[Index])), binFillThn, 1, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f); + fillCorrelationHistogram(histos.get(HIST("mixedEvent/LeftBg/") + HIST(kV0names[Index])), binFillThn, 1, efficiency * efficiencyTrigg, totalEffUncert, purityTrigg, purityTriggErr); if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && mixing && -massWindowConfigurations.maxPeakNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < +massWindowConfigurations.maxPeakNSigma) - fillCorrelationHistogram(histos.get(HIST("mixedEvent/Signal/") + HIST(kV0names[Index])), binFillThn, 1, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f); + fillCorrelationHistogram(histos.get(HIST("mixedEvent/Signal/") + HIST(kV0names[Index])), binFillThn, 1, efficiency * efficiencyTrigg, totalEffUncert, purityTrigg, purityTriggErr); if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && mixing && +massWindowConfigurations.minBgNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < +massWindowConfigurations.maxBgNSigma) - fillCorrelationHistogram(histos.get(HIST("mixedEvent/RightBg/") + HIST(kV0names[Index])), binFillThn, 1, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f); + fillCorrelationHistogram(histos.get(HIST("mixedEvent/RightBg/") + HIST(kV0names[Index])), binFillThn, 1, efficiency * efficiencyTrigg, totalEffUncert, purityTrigg, purityTriggErr); } }); } @@ -812,26 +800,26 @@ struct HStrangeCorrelation { if (!isValidTrigger(trigg)) continue; + float efficiencyTrigg = 1.0f; + float efficiencyTriggError = 0.0f; + float purityTrigg = 1.0f; + float purityTriggErr = 0.0f; if (!mixing) { - float efficiency = 1.0f; - float efficiencyError = 0.0f; - float purity = 1.0f; - float purityErr = 0.0f; if (efficiencyFlags.applyEfficiencyForTrigger) { - efficiency = hEfficiencyTrigger->Interpolate(trigg.pt(), trigg.eta()); + efficiencyTrigg = hEfficiencyTrigger->Interpolate(trigg.pt(), trigg.eta()); if (efficiencyFlags.applyPurityTrigger) - purity = hPurityHadron->Interpolate(trigg.pt()); + purityTrigg = hPurityHadron->Interpolate(trigg.pt()); if (efficiencyFlags.applyEfficiencyPropagation) { - efficiencyError = hEfficiencyUncertaintyTrigger->Interpolate(trigg.pt(), trigg.eta()); + efficiencyTriggError = hEfficiencyUncertaintyTrigger->Interpolate(trigg.pt(), trigg.eta()); if (efficiencyFlags.applyPurityTrigger) - purityErr = hPurityUncertaintyHadron->Interpolate(trigg.pt()); + purityTriggErr = hPurityUncertaintyHadron->Interpolate(trigg.pt()); } - if (efficiency == 0) { // check for zero efficiency, do not apply if the case - efficiency = 1; - efficiencyError = 0; + if (efficiencyTrigg == 0) { // check for zero efficiency, do not apply if the case + efficiencyTrigg = 1; + efficiencyTriggError = 0; } } - fillTriggerHistogram(histos.get(HIST("sameEvent/TriggerParticlesCascade")), trigg.pt(), mult, efficiency, efficiencyError, purity, purityErr); + fillTriggerHistogram(histos.get(HIST("sameEvent/TriggerParticlesCascade")), trigg.pt(), mult, efficiencyTrigg, efficiencyTriggError, purityTrigg, purityTriggErr); } double triggSign = trigg.sign(); double triggForDeltaPhiStar[] = {trigg.phi(), trigg.pt(), triggSign}; @@ -921,31 +909,24 @@ struct HStrangeCorrelation { static_for<0, 3>([&](auto i) { constexpr int Index = i.value; float efficiency = 1.0f; - float efficiencytrigg = 1.0f; float totalEffUncert = 0.0; float efficiencyError = 0.0f; - float triggerEfficiencyError = 0.0f; if (efficiencyFlags.applyEfficiencyCorrection) { efficiency = hEfficiencyCascade[Index]->Interpolate(ptassoc, assoc.eta()); if (efficiencyFlags.applyEfficiencyPropagation) efficiencyError = hEfficiencyUncertaintyCascade[Index]->Interpolate(ptassoc, assoc.eta()); } - if (efficiencyFlags.applyEfficiencyForTrigger) { - efficiency = efficiency * hEfficiencyTrigger->Interpolate(pttrigger, trigg.eta()); - if (efficiencyFlags.applyEfficiencyPropagation) - triggerEfficiencyError = hEfficiencyUncertaintyTrigger->Interpolate(pttrigger, trigg.eta()); - } if (efficiency == 0) { // check for zero efficiency, do not apply if the case efficiency = 1; efficiencyError = 0; } if (efficiencyFlags.applyEfficiencyPropagation) { - totalEffUncert = std::sqrt(std::pow(efficiencytrigg * efficiencyError, 2) + std::pow(triggerEfficiencyError * efficiency, 2)); + totalEffUncert = std::sqrt(std::pow(efficiencyTrigg * efficiencyError, 2) + std::pow(efficiencyTriggError * efficiency, 2)); } double binFillThn[6] = {deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult}; if (TESTBIT(doCorrelation, Index + 3) && (!efficiencyFlags.applyEfficiencyCorrection || efficiency != 0) && (doPPAnalysis || (TESTBIT(CascselMap, Index) && TESTBIT(CascselMap, Index + 4) && TESTBIT(CascselMap, Index + 8) && TESTBIT(CascselMap, Index + 12)))) { if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && !mixing && -massWindowConfigurations.maxBgNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < -massWindowConfigurations.minBgNSigma) { - fillCorrelationHistogram(histos.get(HIST("sameEvent/LeftBg/") + HIST(kCascadenames[Index])), binFillThn, etaWeight, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f); + fillCorrelationHistogram(histos.get(HIST("sameEvent/LeftBg/") + HIST(kCascadenames[Index])), binFillThn, etaWeight, efficiency * efficiencyTrigg, totalEffUncert, purityTrigg, purityTriggErr); if (doDeltaPhiStarCheck) { double deltaPhiStar = calculateAverageDeltaPhiStar(triggForDeltaPhiStar, assocForDeltaPhiStar, bField); if ((Index == 0 && triggSign > 0) || (Index == 1 && triggSign < 0) || (Index == 2 && triggSign > 0) || (Index == 3 && triggSign < 0)) @@ -955,7 +936,7 @@ struct HStrangeCorrelation { } } if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && !mixing && -massWindowConfigurations.maxPeakNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < +massWindowConfigurations.maxPeakNSigma) { - fillCorrelationHistogram(histos.get(HIST("sameEvent/Signal/") + HIST(kCascadenames[Index])), binFillThn, etaWeight, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f); + fillCorrelationHistogram(histos.get(HIST("sameEvent/Signal/") + HIST(kCascadenames[Index])), binFillThn, etaWeight, efficiency * efficiencyTrigg, totalEffUncert, purityTrigg, purityTriggErr); if (doDeltaPhiStarCheck) { double deltaPhiStar = calculateAverageDeltaPhiStar(triggForDeltaPhiStar, assocForDeltaPhiStar, bField); if ((Index == 0 && triggSign > 0) || (Index == 1 && triggSign < 0) || (Index == 2 && triggSign > 0) || (Index == 3 && triggSign < 0)) @@ -965,7 +946,7 @@ struct HStrangeCorrelation { } } if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && !mixing && +massWindowConfigurations.minBgNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < +massWindowConfigurations.maxBgNSigma) { - fillCorrelationHistogram(histos.get(HIST("sameEvent/RightBg/") + HIST(kCascadenames[Index])), binFillThn, etaWeight, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f); + fillCorrelationHistogram(histos.get(HIST("sameEvent/RightBg/") + HIST(kCascadenames[Index])), binFillThn, etaWeight, efficiency * efficiencyTrigg, totalEffUncert, purityTrigg, purityTriggErr); if (doDeltaPhiStarCheck) { double deltaPhiStar = calculateAverageDeltaPhiStar(triggForDeltaPhiStar, assocForDeltaPhiStar, bField); if ((Index == 0 && triggSign > 0) || (Index == 1 && triggSign < 0) || (Index == 2 && triggSign > 0) || (Index == 3 && triggSign < 0)) @@ -975,11 +956,11 @@ struct HStrangeCorrelation { } } if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && mixing && -massWindowConfigurations.maxBgNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < -massWindowConfigurations.minBgNSigma) - fillCorrelationHistogram(histos.get(HIST("mixedEvent/LeftBg/") + HIST(kCascadenames[Index])), binFillThn, 1, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f); + fillCorrelationHistogram(histos.get(HIST("mixedEvent/LeftBg/") + HIST(kCascadenames[Index])), binFillThn, 1, efficiency * efficiencyTrigg, totalEffUncert, purityTrigg, purityTriggErr); if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && mixing && -massWindowConfigurations.maxPeakNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < +massWindowConfigurations.maxPeakNSigma) - fillCorrelationHistogram(histos.get(HIST("mixedEvent/Signal/") + HIST(kCascadenames[Index])), binFillThn, 1, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f); + fillCorrelationHistogram(histos.get(HIST("mixedEvent/Signal/") + HIST(kCascadenames[Index])), binFillThn, 1, efficiency * efficiencyTrigg, totalEffUncert, purityTrigg, purityTriggErr); if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && mixing && +massWindowConfigurations.minBgNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < +massWindowConfigurations.maxBgNSigma) - fillCorrelationHistogram(histos.get(HIST("mixedEvent/RightBg/") + HIST(kCascadenames[Index])), binFillThn, 1, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f); + fillCorrelationHistogram(histos.get(HIST("mixedEvent/RightBg/") + HIST(kCascadenames[Index])), binFillThn, 1, efficiency * efficiencyTrigg, totalEffUncert, purityTrigg, purityTriggErr); } }); } @@ -996,29 +977,30 @@ struct HStrangeCorrelation { if (!isValidTrigger(trigg)) continue; + float efficiencyTrigger = 1.0f; + float efficiencyTriggerError = 0.0f; + float purityTrigger = 1.0f; + float purityTriggerError = 0.0f; if (!mixing) { - float efficiency = 1.0f; - float efficiencyError = 0.0f; - float purity = 1.0f; - float purityError = 0.0f; + if (efficiencyFlags.applyEfficiencyForTrigger) { - efficiency = hEfficiencyTrigger->Interpolate(trigg.pt(), trigg.eta()); + efficiencyTrigger = hEfficiencyTrigger->Interpolate(trigg.pt(), trigg.eta()); if (efficiencyFlags.applyPurityTrigger) - purity = hPurityHadron->Interpolate(trigg.pt()); + purityTrigger = hPurityHadron->Interpolate(trigg.pt()); if (efficiencyFlags.applyEfficiencyPropagation) { - hEfficiencyUncertaintyTrigger->Interpolate(trigg.pt(), trigg.eta()); + efficiencyTriggerError = hEfficiencyUncertaintyTrigger->Interpolate(trigg.pt(), trigg.eta()); if (efficiencyFlags.applyPurityTrigger) - purityError = hPurityUncertaintyHadron->Interpolate(trigg.pt()); + purityTriggerError = hPurityUncertaintyHadron->Interpolate(trigg.pt()); } - if (efficiency == 0) { // check for zero efficiency, do not apply if the case - efficiency = 1; - efficiencyError = 0; + if (efficiencyTrigger == 0) { // check for zero efficiency, do not apply if the case + efficiencyTrigger = 1; + efficiencyTriggerError = 0; } } if constexpr (requires { triggerTrack.extra(); }) - fillTriggerHistogram(histos.get(HIST("sameEvent/TriggerParticlesPion")), trigg.pt(), mult, efficiency, efficiencyError, purity, purityError); + fillTriggerHistogram(histos.get(HIST("sameEvent/TriggerParticlesPion")), trigg.pt(), mult, efficiencyTrigger, efficiencyTriggerError, purityTrigger, purityTriggerError); else - fillTriggerHistogram(histos.get(HIST("sameEvent/TriggerParticlesHadron")), trigg.pt(), mult, efficiency, efficiencyError, purity, purityError); + fillTriggerHistogram(histos.get(HIST("sameEvent/TriggerParticlesHadron")), trigg.pt(), mult, efficiencyTrigger, efficiencyTriggerError, purityTrigger, purityTriggerError); } double triggSign = trigg.sign(); double triggForDeltaPhiStar[] = {trigg.phi(), trigg.pt(), triggSign}; @@ -1064,12 +1046,8 @@ struct HStrangeCorrelation { continue; float efficiency = 1; - float efficiencyTrigg = 1.0f; float purity = 1.0f; float purityUncertainty = 0.0f; - float purityTrigger = 1.0f; - float triggerPurityUncertainty = 0.0f; - float triggerEfficiencyUncert = 0.0f; float totalEffUncert = 0.0; float efficiencyUncertainty = 0.0f; float totalPurityUncert = 0.0; @@ -1089,33 +1067,19 @@ struct HStrangeCorrelation { } } } - if (efficiencyFlags.applyEfficiencyForTrigger) { - efficiencyTrigg = hEfficiencyTrigger->Interpolate(pttrigger, trigg.eta()); - if (efficiencyFlags.applyPurityTrigger) - purityTrigger = hPurityHadron->Interpolate(pttrigger); - if (efficiencyFlags.applyEfficiencyPropagation) { - triggerEfficiencyUncert = hEfficiencyUncertaintyTrigger->Interpolate(pttrigger, trigg.eta()); - if (efficiencyFlags.applyPurityTrigger) - triggerPurityUncertainty = hPurityUncertaintyHadron->Interpolate(pttrigger); - } - } if (efficiency == 0) { // check for zero efficiency, do not apply if the case efficiency = 1; efficiencyUncertainty = 0.0; } - if (efficiencyTrigg == 0) { - efficiencyTrigg = 1.0; - triggerEfficiencyUncert = 0.0; - } if (efficiencyFlags.applyEfficiencyPropagation) { - totalEffUncert = std::sqrt(std::pow(efficiencyTrigg * efficiencyUncertainty, 2) + std::pow(triggerEfficiencyUncert * efficiency, 2)); - totalPurityUncert = std::sqrt(std::pow(purityTrigger * purityUncertainty, 2) + std::pow(purity * triggerPurityUncertainty, 2)); + totalEffUncert = std::sqrt(std::pow(efficiencyTrigger * efficiencyUncertainty, 2) + std::pow(efficiencyTriggerError * efficiency, 2)); + totalPurityUncert = std::sqrt(std::pow(purityTrigger * purityUncertainty, 2) + std::pow(purity * purityTriggerError, 2)); } double binFillThn[6] = {deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult}; double deltaPhiStar = calculateAverageDeltaPhiStar(triggForDeltaPhiStar, assocForDeltaPhiStar, bField); if (!mixing) { if constexpr (requires { assocTrack.nSigmaTPCPi(); }) { - fillCorrelationHistogram(histos.get(HIST("sameEvent/Signal/Pion")), binFillThn, etaWeight, efficiency * efficiencyTrigg, totalEffUncert, purity * purityTrigger, totalPurityUncert); + fillCorrelationHistogram(histos.get(HIST("sameEvent/Signal/Pion")), binFillThn, etaWeight, efficiency * efficiencyTrigger, totalEffUncert, purity * purityTrigger, totalPurityUncert); if (triggSign == assocSign && doDeltaPhiStarCheck) { histos.fill(HIST("sameEvent/Signal/Pion") + HIST("DeltaPhiStar"), deltaPhiStar, trigg.eta() - assoc.eta(), 0.5); } else if (doDeltaPhiStarCheck) { @@ -1127,13 +1091,13 @@ struct HStrangeCorrelation { } else if (doDeltaPhiStarCheck) { histos.fill(HIST("sameEvent/Signal/Hadron") + HIST("DeltaPhiStar"), deltaPhiStar, trigg.eta() - assoc.eta(), -0.5); } - fillCorrelationHistogram(histos.get(HIST("sameEvent/Signal/Hadron")), binFillThn, etaWeight, efficiency * efficiencyTrigg, totalEffUncert, purity * purityTrigger, totalPurityUncert); + fillCorrelationHistogram(histos.get(HIST("sameEvent/Signal/Hadron")), binFillThn, etaWeight, efficiency * efficiencyTrigger, totalEffUncert, purity * purityTrigger, totalPurityUncert); } } else { if constexpr (requires { assocTrack.nSigmaTPCPi(); }) { - fillCorrelationHistogram(histos.get(HIST("mixedEvent/Signal/Pion")), binFillThn, 1, efficiency * efficiencyTrigg, totalEffUncert, purity * purityTrigger, totalPurityUncert); + fillCorrelationHistogram(histos.get(HIST("mixedEvent/Signal/Pion")), binFillThn, 1, efficiency * efficiencyTrigger, totalEffUncert, purity * purityTrigger, totalPurityUncert); } else { - fillCorrelationHistogram(histos.get(HIST("mixedEvent/Signal/Hadron")), binFillThn, 1, efficiency * efficiencyTrigg, totalEffUncert, purity * purityTrigger, totalPurityUncert); + fillCorrelationHistogram(histos.get(HIST("mixedEvent/Signal/Hadron")), binFillThn, 1, efficiency * efficiencyTrigger, totalEffUncert, purity * purityTrigger, totalPurityUncert); } } } From d290f82927496ddd38130bfe4fd8b4e75484816f Mon Sep 17 00:00:00 2001 From: Nida Malik Date: Fri, 3 Oct 2025 18:44:38 +0530 Subject: [PATCH 616/986] [PWGCF] Removal of outliers (#13216) --- .../Tasks/netchargeFluctuations.cxx | 80 ++++++++++++++----- 1 file changed, 62 insertions(+), 18 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index 6414df12727..401833b75b5 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -59,20 +59,33 @@ enum RunType { kRun2 }; +// Structure to handle net charge fluctuation analysis struct NetchargeFluctuations { + + // Macro to define configurable parameters with default values and help text + #define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; - Service pdgService; - Service ccdb; + // Services for PDG and CCDB (Calibration and Condition Database) + Service pdgService; // Particle data group service + Service ccdb; // CCDB manager service + + // Random number generator for statistical fluctuations, initialized with seed 0 TRandom3* fRndm = new TRandom3(0); + + // Registry for histograms used in analysis HistogramRegistry histogramRegistry{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - // Configurables + // ------------------- + // Configurable parameters + // ------------------- + // CCDB related configurations Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable cfgUrlCCDB{"cfgUrlCCDB", "http://alice-ccdb.cern.ch", "url of ccdb"}; Configurable cfgPathCCDB{"cfgPathCCDB", "Users/n/nimalik/netcharge/p/Run3/LHC24f3d", "Path for ccdb-object"}; Configurable cfgLoadEff{"cfgLoadEff", true, "Load efficiency"}; + // Track and event selection cuts Configurable vertexZcut{"vertexZcut", 10.f, "Vertex Z"}; Configurable etaCut{"etaCut", 0.8f, "Eta cut"}; Configurable ptMinCut{"ptMinCut", 0.2, "Pt min cut"}; @@ -99,38 +112,49 @@ struct NetchargeFluctuations { Configurable cTpcChi{"cTpcChi", true, "TPC chi"}; Configurable cFT0C{"cFT0C", true, "cent FT0C"}; Configurable cFT0M{"cFT0M", false, "cent FT0M"}; - ConfigurableAxis centBining{"centBining", {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, "Centrality/Multiplicity percentile bining"}; - Configurable cPileupReject{"cPileupReject", true, "Pileup rejection"}; // pileup - Configurable cfgUseGoodItsLayerAllCut{"cfgUseGoodItsLayerAllCut", true, "Good ITS Layers All"}; // pileup - Configurable cTFBorder{"cTFBorder", false, "Timeframe Border Selection"}; // pileup - Configurable cNoItsROBorder{"cNoItsROBorder", false, "No ITSRO Border Cut"}; // pileup - Configurable cItsTpcVtx{"cItsTpcVtx", true, "ITS+TPC Vertex Selection"}; // pileup - Configurable cZVtxTimeDiff{"cZVtxTimeDiff", false, "z-vtx time diff selection"}; // pileup - Configurable cPVcont{"cPVcont", true, "primary vertex contributor"}; + // Centrality binning configuration + ConfigurableAxis centBining{"centBining", {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, "Centrality/Multiplicity percentile bining"}; + Configurable cPileupReject{"cPileupReject", false, "Pileup rejection"}; // pileup + Configurable cfgUseGoodItsLayerAllCut{"cfgUseGoodItsLayerAllCut", false, "Good ITS Layers All"}; // pileup + Configurable cTFBorder{"cTFBorder", false, "Timeframe Border Selection"}; // pileup + Configurable cNoItsROBorder{"cNoItsROBorder", false, "No ITSRO Border Cut"}; // pileup + Configurable cItsTpcVtx{"cItsTpcVtx", false, "ITS+TPC Vertex Selection"}; // pileup + Configurable cZVtxTimeDiff{"cZVtxTimeDiff", false, "z-vtx time diff selection"}; // pileup + Configurable cPVcont{"cPVcont", false, "primary vertex contributor"}; + + // Configurable to enable multiplicity correlation cuts O2_DEFINE_CONFIGURABLE(cfgEvSelMultCorrelation, bool, true, "Multiplicity correlation cut") + + // Struct grouping multiplicity vs centrality/vertex cuts and related parameters struct : ConfigurableGroup { + // Flags to enable specific multiplicity correlation cuts O2_DEFINE_CONFIGURABLE(cfgMultPVT0CCutEnabled, bool, true, "Enable PV multiplicity vs T0C centrality cut") O2_DEFINE_CONFIGURABLE(cfgMultGlobalFT0CCutEnabled, bool, true, "Enable globalTracks vs FT0C multiplicity cut") O2_DEFINE_CONFIGURABLE(cfgMultGlobalPVCutEnabled, bool, true, "Enable globalTracks vs PV multiplicity cut") + // Parameter values for PV multiplicity vs FT0C centrality cut (polynomial coefficients, etc.) Configurable> cfgMultPVT0CCutPars{"cfgMultPVT0CCutPars", std::vector{30.434, -0.917137, 0.0185032, -0.000198425, 7.94381e-07, 13.7406, -0.282656, 0.00556147, -6.32766e-05, 2.51648e-07}, "PV multiplicity vs T0C centrality cut parameter values"}; + // Parameter values for globalTracks vs FT0C multiplicity cut Configurable> cfgMultGlobalFT0CCutPars{"cfgMultGlobalFT0CCutPars", std::vector{18.9628, -0.576466, 0.0117324, -0.000126086, 5.05365e-07, 8.99921, -0.188022, 0.0037089, -4.20275e-05, 1.68234e-07}, "globalTracks vs FT0C cut parameter values"}; + // Parameter values for globalTracks vs PV multiplicity cut Configurable> cfgMultGlobalPVCutPars{"cfgMultGlobalPVCutPars", std::vector{0.148031, 0.616699, 0.603083, 0.112751, -0.0013846, 8.38211e-06}, "globalTracks vs PV cut parameter values"}; + // Local vectors to store the above parameters std::vector multPVT0CCutPars; std::vector multGlobalFT0CPars; std::vector multGlobalPVCutPars; + // TF1 objects to represent low/high cut functions for the above correlations TF1* fMultPVT0CCutLow = nullptr; TF1* fMultPVT0CCutHigh = nullptr; TF1* fMultGlobalFT0CCutLow = nullptr; @@ -140,9 +164,10 @@ struct NetchargeFluctuations { } cfgFunCoeff; - // CCDB efficiency histograms + // Histogram pointer for CCDB efficiency TH1D* efficiency = nullptr; + // Filters for selecting collisions and tracks Filter collisionFilter = nabs(aod::collision::posZ) <= vertexZcut; Filter trackFilter = (nabs(aod::track::eta) < etaCut) && (aod::track::pt > ptMinCut) && (aod::track::pt < ptMaxCut) && (requireGlobalTrackInFilter()); @@ -166,6 +191,9 @@ struct NetchargeFluctuations { void init(o2::framework::InitContext&) { + // ------------------------------- + // Define histogram axes specifications + // ------------------------------- const AxisSpec vtxzAxis = {800, -20, 20, "V_{Z} (cm)"}; const AxisSpec dcaAxis = {1000, -0.5, 0.5, "DCA_{xy} (cm)"}; const AxisSpec dcazAxis = {600, -3, 3, "DCA_{z} (cm)"}; @@ -185,10 +213,12 @@ struct NetchargeFluctuations { const AxisSpec nchpAxis = {50000, 0, 50000, "Nch"}; const AxisSpec cent1Axis{centBining, "Multiplicity percentile from FT0M (%)"}; + // Subsample axis (used for error estimation from subsamples) auto noSubsample = static_cast(cfgNSubsample); float maxSubsample = 1.0 * noSubsample; AxisSpec subsampleAxis = {noSubsample, 0.0, maxSubsample, "subsample no."}; + // Add QA histograms histogramRegistry.add("QA/hVtxZ_before", "", kTH1F, {vtxzAxis}); histogramRegistry.add("QA/hDcaXY_before", "", kTH1F, {dcaAxis}); histogramRegistry.add("QA/hphi", "", kTH1F, {phiAxis}); @@ -316,6 +346,7 @@ struct NetchargeFluctuations { histogramRegistry.add("QA/hNchGlobal", "", kTH1F, {nchAxis}); histogramRegistry.add("QA/hNchPV", "", kTH1F, {nchAxis}); + // QA histograms for multiplicity correlations histogramRegistry.add("MultCorrelationPlots/globalTracks_PV_bef", "", {HistType::kTH2D, {nchAxis, nchAxis}}); histogramRegistry.add("MultCorrelationPlots/globalTracks_FT0C_bef", "", {HistType::kTH2D, {centAxis, nchAxis}}); histogramRegistry.add("MultCorrelationPlots/PV_FT0C_bef", "", {HistType::kTH2D, {centAxis, nchAxis}}); @@ -328,42 +359,54 @@ struct NetchargeFluctuations { cfgFunCoeff.multGlobalFT0CPars = cfgFunCoeff.cfgMultGlobalFT0CCutPars; cfgFunCoeff.multGlobalPVCutPars = cfgFunCoeff.cfgMultGlobalPVCutPars; + // --- Initialize PV vs FT0C multiplicity cut functions --- + // Lower cut function: 4th-order polynomial minus 3.5 sigma deviation + cfgFunCoeff.fMultPVT0CCutLow = new TF1("fMultPVT0CCutLow", - "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 2.0*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", + "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); cfgFunCoeff.fMultPVT0CCutLow->SetParameters(&(cfgFunCoeff.multPVT0CCutPars[0])); + // Upper cut function: 4th-order polynomial plus 3.5 sigma deviation cfgFunCoeff.fMultPVT0CCutHigh = new TF1("fMultPVT0CCutHigh", - "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 2.*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", + "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); cfgFunCoeff.fMultPVT0CCutHigh->SetParameters(&(cfgFunCoeff.multPVT0CCutPars[0])); + // --- Initialize globalTracks vs FT0C multiplicity cut functions --- + // Lower cut function cfgFunCoeff.fMultGlobalFT0CCutLow = new TF1("fMultGlobalFT0CCutLow", - "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 2.*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", + "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); cfgFunCoeff.fMultGlobalFT0CCutLow->SetParameters(&(cfgFunCoeff.multGlobalFT0CPars[0])); + // Upper cut function cfgFunCoeff.fMultGlobalFT0CCutHigh = new TF1("fMultGlobalFT0CCutHigh", - "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 2.*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", + "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); cfgFunCoeff.fMultGlobalFT0CCutHigh->SetParameters(&(cfgFunCoeff.multGlobalFT0CPars[0])); + // --- Initialize globalTracks vs PV multiplicity cut functions --- + // Lower cut: linear + cubic term minus 3.5 sigma + cfgFunCoeff.fMultGlobalPVCutLow = new TF1("fMultGlobalPVCutLow", "[0]+[1]*x - 3.5*([2]+[3]*x+[4]*x*x+[5]*x*x*x)", 0, 100); cfgFunCoeff.fMultGlobalPVCutLow->SetParameters(&(cfgFunCoeff.multGlobalPVCutPars[0])); + // Upper cut: linear + cubic term plus 3.5 sigma cfgFunCoeff.fMultGlobalPVCutHigh = new TF1("fMultGlobalPVCutHigh", "[0]+[1]*x + 3.5*([2]+[3]*x+[4]*x*x+[5]*x*x*x)", 0, 100); cfgFunCoeff.fMultGlobalPVCutHigh->SetParameters(&(cfgFunCoeff.multGlobalPVCutPars[0])); + // --- Load efficiency histogram from CCDB if (cfgLoadEff) { ccdb->setURL(cfgUrlCCDB.value); ccdb->setCaching(true); @@ -371,6 +414,7 @@ struct NetchargeFluctuations { TList* list = ccdb->getForTimeStamp(cfgPathCCDB.value, -1); efficiency = reinterpret_cast(list->FindObject("efficiency_Run3")); + // Log fatal error if efficiency histogram is not found if (!efficiency) { LOGF(info, "FATAL!! Could not find required histograms in CCDB"); } @@ -1001,7 +1045,7 @@ struct NetchargeFluctuations { } } - PROCESS_SWITCH(NetchargeFluctuations, processDataRun3, "Process for Run3 DATA", true); + PROCESS_SWITCH(NetchargeFluctuations, processDataRun3, "Process for Run3 DATA", false); // process function for Data Run2 void processDataRun2(MyCollisionRun2 const& coll, MyTracks const& tracks) @@ -1015,7 +1059,7 @@ struct NetchargeFluctuations { } } - PROCESS_SWITCH(NetchargeFluctuations, processDataRun2, "Process for Run2 DATA", false); + PROCESS_SWITCH(NetchargeFluctuations, processDataRun2, "Process for Run2 DATA", true); // process function for MC Run3 From 224a88e12b975c970c9e65a8eb30e57deca56b43 Mon Sep 17 00:00:00 2001 From: mcoquet642 <74600025+mcoquet642@users.noreply.github.com> Date: Fri, 3 Oct 2025 17:13:48 +0200 Subject: [PATCH 617/986] [PWGDQ] Possibility to deactivate track propagation for MFT-Muon matching (#13211) Co-authored-by: Maurice Coquet Co-authored-by: ALICE Action Bot --- PWGDQ/Core/MuonMatchingMlResponse.h | 11 +++++------ PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx | 10 +++++++--- PWGDQ/TableProducer/tableMaker_withAssoc.cxx | 10 +++++++--- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/PWGDQ/Core/MuonMatchingMlResponse.h b/PWGDQ/Core/MuonMatchingMlResponse.h index a77deb53397..236a4f48329 100644 --- a/PWGDQ/Core/MuonMatchingMlResponse.h +++ b/PWGDQ/Core/MuonMatchingMlResponse.h @@ -263,8 +263,8 @@ class MlResponseMFTMuonMatch : public MlResponse return inputFeature; } - template - float returnFeatureGlob(uint8_t idx, T1 const& muonglob, T2 const& muon, T3 const& mft, C1 const& mftcov, U const& collision) + template + float returnFeatureGlob(uint8_t idx, T1 const& muonglob, T2 const& muon, T3 const& mft, U const& collision) { float inputFeature = 0.; switch (idx) { @@ -285,7 +285,6 @@ class MlResponseMFTMuonMatch : public MlResponse CHECK_AND_FILL_MUONGLOB_TRACK(Rabs, rAtAbsorberEnd); // Below are dummy files to remove warning of unused parameters CHECK_AND_FILL_MFTMUON_COLLISION(posZ); - CHECK_AND_FILL_MFT_COV(cXXMFT, cXX); } return inputFeature; } @@ -325,12 +324,12 @@ class MlResponseMFTMuonMatch : public MlResponse return inputFeatures; } - template - std::vector getInputFeaturesGlob(T1 const& muonglob, T2 const& muon, T3 const& mft, C1 const& mftcov, U const& collision) + template + std::vector getInputFeaturesGlob(T1 const& muonglob, T2 const& muon, T3 const& mft, U const& collision) { std::vector inputFeatures; for (const auto& idx : MlResponse::mCachedIndices) { - float inputFeature = returnFeatureGlob(idx, muonglob, muon, mft, mftcov, collision); + float inputFeature = returnFeatureGlob(idx, muonglob, muon, mft, collision); inputFeatures.emplace_back(inputFeature); } return inputFeatures; diff --git a/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx b/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx index 23cfd2d9042..f9be380c416 100644 --- a/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx +++ b/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx @@ -939,12 +939,16 @@ struct TableMakerMC { if (static_cast(muon.trackType()) < 2) { auto muonID = muon.matchMCHTrackId(); auto muontrack = muon.template matchMCHTrack_as(); - auto muonprop = VarManager::PropagateMuon(muontrack, collision, VarManager::kToMatching); auto mfttrack = muon.template matchMFTTrack_as(); auto const& mfttrackcov = mfCovs.rawIteratorAt(map_mfttrackcovs[mfttrack.globalIndex()]); - o2::track::TrackParCovFwd mftprop = VarManager::PropagateFwd(mfttrack, mfttrackcov, VarManager::GetMatchingPlane()); + o2::track::TrackParCovFwd mftprop = VarManager::FwdToTrackPar(mfttrack, mfttrackcov); + o2::dataformats::GlobalFwdTrack muonprop = VarManager::FwdToTrackPar(muontrack, muontrack); + if (fConfigVariousOptions.fzMatching.value < 0.) { + mftprop = VarManager::PropagateFwd(mfttrack, mfttrackcov, fConfigVariousOptions.fzMatching.value); + muonprop = VarManager::PropagateMuon(muontrack, collision, VarManager::kToMatching); + } std::vector output; - std::vector inputML = matchingMlResponse.getInputFeaturesGlob(muon, muonprop, mftprop, mfttrackcov, collision); + std::vector inputML = matchingMlResponse.getInputFeaturesGlob(muon, muonprop, mftprop, collision); matchingMlResponse.isSelectedMl(inputML, 0, output); float score = output[0]; if (mCandidates.find(muonID) == mCandidates.end()) { diff --git a/PWGDQ/TableProducer/tableMaker_withAssoc.cxx b/PWGDQ/TableProducer/tableMaker_withAssoc.cxx index 415c237d3ad..a8c39eeb184 100644 --- a/PWGDQ/TableProducer/tableMaker_withAssoc.cxx +++ b/PWGDQ/TableProducer/tableMaker_withAssoc.cxx @@ -1193,12 +1193,16 @@ struct TableMaker { if (static_cast(muon.trackType()) < 2) { auto muonID = muon.matchMCHTrackId(); auto muontrack = muon.template matchMCHTrack_as(); - auto muonprop = VarManager::PropagateMuon(muontrack, collision, VarManager::kToMatching); auto mfttrack = muon.template matchMFTTrack_as(); auto const& mfttrackcov = mfCovs.rawIteratorAt(map_mfttrackcovs[mfttrack.globalIndex()]); - o2::track::TrackParCovFwd mftprop = VarManager::PropagateFwd(mfttrack, mfttrackcov, VarManager::GetMatchingPlane()); + o2::track::TrackParCovFwd mftprop = VarManager::FwdToTrackPar(mfttrack, mfttrackcov); + o2::dataformats::GlobalFwdTrack muonprop = VarManager::FwdToTrackPar(muontrack, muontrack); + if (fConfigVariousOptions.fzMatching.value < 0.) { + mftprop = VarManager::PropagateFwd(mfttrack, mfttrackcov, fConfigVariousOptions.fzMatching.value); + muonprop = VarManager::PropagateMuon(muontrack, collision, VarManager::kToMatching); + } std::vector output; - std::vector inputML = matchingMlResponse.getInputFeaturesGlob(muon, muonprop, mftprop, mfttrackcov, collision); + std::vector inputML = matchingMlResponse.getInputFeaturesGlob(muon, muonprop, mftprop, collision); matchingMlResponse.isSelectedMl(inputML, 0, output); float score = output[0]; if (mCandidates.find(muonID) == mCandidates.end()) { From 2b16049961329c572db3585474abb34721e8105a Mon Sep 17 00:00:00 2001 From: lucamicheletti93 <38209984+lucamicheletti93@users.noreply.github.com> Date: Fri, 3 Oct 2025 18:15:20 +0200 Subject: [PATCH 618/986] [PWGDQ] Fixing issue in the filling of the minitree (#13226) Co-authored-by: Lucamicheletti93 --- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 7 ------- 1 file changed, 7 deletions(-) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index eed0429955e..fee7cc0356f 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -2003,13 +2003,6 @@ struct AnalysisSameEventPairing { t2.pt(), t2.eta(), t2.phi(), t2.pt(), t2.eta(), t2.phi()); } - dileptonMiniTreeRec(mcDecision, - VarManager::fgValues[VarManager::kMass], - VarManager::fgValues[VarManager::kPt], VarManager::fgValues[VarManager::kEta], VarManager::fgValues[VarManager::kPhi], VarManager::fgValues[VarManager::kCentFT0C], - t1.reducedMCTrack().pt(), t1.reducedMCTrack().eta(), t1.reducedMCTrack().phi(), - t2.reducedMCTrack().pt(), t2.reducedMCTrack().eta(), t2.reducedMCTrack().phi(), - VarManager::fgValues[VarManager::kPt1], VarManager::fgValues[VarManager::kEta1], VarManager::fgValues[VarManager::kPhi1], - VarManager::fgValues[VarManager::kPt2], VarManager::fgValues[VarManager::kEta2], VarManager::fgValues[VarManager::kPhi2]); } } } From f3f16f4411650c2a0ae7877f186f327f0f7728f9 Mon Sep 17 00:00:00 2001 From: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Date: Fri, 3 Oct 2025 21:38:06 +0200 Subject: [PATCH 619/986] [PWGCF] fix eta extraction for FT0 detectors (#13219) --- PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx b/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx index 8c9dd20ebb6..f06a8fa062b 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx @@ -164,6 +164,7 @@ struct LongRangeDihadronCor { // FT0 geometry o2::ft0::Geometry ft0Det; + const uint64_t ft0IndexA = 96; std::vector* offsetFT0; std::vector cstFT0RelGain{}; @@ -367,6 +368,9 @@ struct LongRangeDihadronCor { auto x = chPos.X() + (*offsetFT0)[i].getX(); auto y = chPos.Y() + (*offsetFT0)[i].getY(); auto z = chPos.Z() + (*offsetFT0)[i].getZ(); + if (chno >= ft0IndexA) { + z = -z; + } auto r = std::sqrt(x * x + y * y); auto theta = std::atan2(r, z); return -std::log(std::tan(0.5 * theta)); From 36f10e0fcef6eb50c3b5bb07ce1dc1b30267c275 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sat, 4 Oct 2025 01:34:14 +0200 Subject: [PATCH 620/986] [PWGEM/Dilepton] update eventQC.cxx (#13229) --- PWGEM/Dilepton/Tasks/eventQC.cxx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/PWGEM/Dilepton/Tasks/eventQC.cxx b/PWGEM/Dilepton/Tasks/eventQC.cxx index ee30bdd0e70..b8cb8d0c968 100644 --- a/PWGEM/Dilepton/Tasks/eventQC.cxx +++ b/PWGEM/Dilepton/Tasks/eventQC.cxx @@ -55,8 +55,8 @@ struct eventQC { using MyCollisions_Qvec = soa::Join; using MyTracks = soa::Join; + aod::pidTPCFullEl, aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullPr, + aod::pidTOFFullEl, aod::pidTOFFullPi, aod::pidTOFFullKa, aod::pidTOFFullPr, aod::pidTOFbeta>; using MyTrack = MyTracks::iterator; // Configurables @@ -71,8 +71,8 @@ struct eventQC { Configurable cfgQvecEstimator{"cfgQvecEstimator", 0, "FT0M:0, FT0A:1, FT0C:2, BTot:3, BPos:4, BNeg:5"}; Configurable cfgCentMin{"cfgCentMin", -1.f, "min. centrality"}; Configurable cfgCentMax{"cfgCentMax", 999.f, "max. centrality"}; - Configurable cfgNtracksPV08Min{"cfgNtracksPV08Min", -1, "min. multNTracksPV"}; - Configurable cfgNtracksPV08Max{"cfgNtracksPV08Max", 1000000000, "max. multNTracksPV"}; + Configurable cfgNumContribMin{"cfgNumContribMin", 0, "min. numContrib"}; + Configurable cfgNumContribMax{"cfgNumContribMax", 1000000000, "max. numContrib"}; ConfigurableAxis ConfPtBins{"ConfPtBins", {VARIABLE_WIDTH, 0.00, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.90, 0.95, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.50, 3.00, 3.50, 4.00, 4.50, 5.00, 6.00, 7.00, 8.00, 9.00, 10.00}, "pT bins for output histograms"}; Configurable cfgNbinsEta{"cfgNbinsEta", 20, "number of eta bins for output histograms"}; Configurable cfgNbinsPhi{"cfgNbinsPhi", 36, "number of phi bins for output histograms"}; @@ -360,13 +360,11 @@ struct eventQC { if (cfgFillPID) { fRegistry.add("Track/hTPCdEdx", "TPC dE/dx;p_{in} (GeV/c);TPC dE/dx (a.u.)", kTH2F, {{1000, 0, 10}, {200, 0, 200}}, false); fRegistry.add("Track/hTPCNsigmaEl", "TPC n sigma el;p_{in} (GeV/c);n #sigma_{e}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5.f, +5.f}}, false); - fRegistry.add("Track/hTPCNsigmaMu", "TPC n sigma mu;p_{in} (GeV/c);n #sigma_{#mu}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5.f, +5.f}}, false); fRegistry.add("Track/hTPCNsigmaPi", "TPC n sigma pi;p_{in} (GeV/c);n #sigma_{#pi}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5.f, +5.f}}, false); fRegistry.add("Track/hTPCNsigmaKa", "TPC n sigma ka;p_{in} (GeV/c);n #sigma_{K}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5.f, +5.f}}, false); fRegistry.add("Track/hTPCNsigmaPr", "TPC n sigma pr;p_{in} (GeV/c);n #sigma_{p}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5.f, +5.f}}, false); fRegistry.add("Track/hTOFbeta", "TOF #beta;p_{pv} (GeV/c);#beta", kTH2F, {{1000, 0, 10}, {240, 0, 1.2}}, false); fRegistry.add("Track/hTOFNsigmaEl", "TOF n sigma el;p_{pv} (GeV/c);n #sigma_{e}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hTOFNsigmaMu", "TOF n sigma mu;p_{pv} (GeV/c);n #sigma_{#mu}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/hTOFNsigmaPi", "TOF n sigma pi;p_{pv} (GeV/c);n #sigma_{#pi}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/hTOFNsigmaKa", "TOF n sigma ka;p_{pv} (GeV/c);n #sigma_{K}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/hTOFNsigmaPr", "TOF n sigma pr;p_{pv} (GeV/c);n #sigma_{p}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); @@ -401,14 +399,12 @@ struct eventQC { if (cfgFillPID) { fRegistry.fill(HIST("Track/hTPCdEdx"), track.tpcInnerParam(), track.tpcSignal()); fRegistry.fill(HIST("Track/hTPCNsigmaEl"), track.tpcInnerParam(), track.tpcNSigmaEl()); - fRegistry.fill(HIST("Track/hTPCNsigmaMu"), track.tpcInnerParam(), track.tpcNSigmaMu()); fRegistry.fill(HIST("Track/hTPCNsigmaPi"), track.tpcInnerParam(), track.tpcNSigmaPi()); fRegistry.fill(HIST("Track/hTPCNsigmaKa"), track.tpcInnerParam(), track.tpcNSigmaKa()); fRegistry.fill(HIST("Track/hTPCNsigmaPr"), track.tpcInnerParam(), track.tpcNSigmaPr()); fRegistry.fill(HIST("Track/hTOFbeta"), track.p(), track.beta()); fRegistry.fill(HIST("Track/hTOFNsigmaEl"), track.p(), track.tofNSigmaEl()); - fRegistry.fill(HIST("Track/hTOFNsigmaMu"), track.p(), track.tofNSigmaMu()); fRegistry.fill(HIST("Track/hTOFNsigmaPi"), track.p(), track.tofNSigmaPi()); fRegistry.fill(HIST("Track/hTOFNsigmaKa"), track.p(), track.tofNSigmaKa()); fRegistry.fill(HIST("Track/hTOFNsigmaPr"), track.p(), track.tofNSigmaPr()); @@ -827,7 +823,7 @@ struct eventQC { Filter collisionFilter_evsel = ifnode(eventcuts.cfgRequireSel8.node(), o2::aod::evsel::sel8 == true, true); Filter collisionFilter_zvtx = eventcuts.cfgZvtxMin < o2::aod::collision::posZ && o2::aod::collision::posZ < eventcuts.cfgZvtxMax; Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); - Filter collisionFilter_multiplicity = cfgNtracksPV08Min <= o2::aod::mult::multNTracksPV && o2::aod::mult::multNTracksPV < cfgNtracksPV08Max; + Filter collisionFilter_numContrib = cfgNumContribMin <= o2::aod::collision::numContrib && o2::aod::collision::numContrib < cfgNumContribMax; Filter collisionFilter_track_occupancy = eventcuts.cfgTrackOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgTrackOccupancyMax; Filter collisionFilter_ft0c_occupancy = eventcuts.cfgFT0COccupancyMin <= o2::aod::evsel::ft0cOccupancyInTimeRange && o2::aod::evsel::ft0cOccupancyInTimeRange < eventcuts.cfgFT0COccupancyMax; using FilteredMyCollisions = soa::Filtered; From 81492cf8cdbed44cc209d1e24520dfaea3ca3b58 Mon Sep 17 00:00:00 2001 From: Rik Spijkers <78484875+rspijkers@users.noreply.github.com> Date: Sat, 4 Oct 2025 07:30:05 +0200 Subject: [PATCH 621/986] [PWGLF] add evsel at gen level (#13223) --- PWGLF/Tasks/Strangeness/cascadecorrelations.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx b/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx index 05d7c23b63d..56354e1502f 100644 --- a/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx +++ b/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx @@ -502,9 +502,14 @@ struct CascadeSelector { } // processCandidate - void processGenMC(aod::McCollision const&, soa::SmallGroups> const& collisions, aod::McParticles const& mcParticles) + void processGenMC(aod::McCollision const& mcCollision, soa::SmallGroups> const& collisions, aod::McParticles const& mcParticles) { - // N gen events without any event selection or matched reco event + // evsel + if (INEL < 0 || pwglf::isINELgtNmc(mcParticles, INEL, pdgDB)) + return; + if (std::abs(mcCollision.posZ()) > maxVertexZ) + return; + registry.fill(HIST("gen/hNevents"), 0); for (auto const& mcPart : mcParticles) { From 852d04c96d99574e1a7c681e8f565ffdc386a7c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?BiaoZhang=20=28=E5=BC=A0=E5=BD=AA=29?= <52267892+zhangbiao-phy@users.noreply.github.com> Date: Sat, 4 Oct 2025 14:30:36 +0200 Subject: [PATCH 622/986] [PWGHF] add a flag for the tables filling into charm femto task (#13232) --- .../HFC/Tasks/taskCharmHadronsFemtoDream.cxx | 72 +++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx b/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx index 7cf441c2938..6eaf4922d9e 100644 --- a/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx +++ b/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx @@ -111,11 +111,13 @@ struct HfTaskCharmHadronsFemtoDream { Configurable smearingByOrigin{"smearingByOrigin", false, "Obtain the smearing matrix differential in the MC origin of particle 1 and particle 2. High memory consumption. Use with care!"}; Configurable use4D{"use4D", false, "Enable four dimensional histogramms (to be used only for analysis with high statistics): k* vs multiplicity vs multiplicity percentil vs mT"}; Configurable useCPR{"useCPR", false, "Close Pair Rejection"}; + Configurable fillTableWithCharm{"fillTableWithCharm", true, "Write charm/tracks/collision table only if >=1 charm hadron in this collision"}; // Mixing configurables - Configurable mixingBinPolicy{"mixingBinPolicy", 0, "Binning policy for mixing - 0: multiplicity, 1: multipliciy percentile, 2: both"}; - Configurable mixingDepth{"mixingDepth", 5, "Number of events for mixing"}; - + struct : ConfigurableGroup { + Configurable mixingBinPolicy{"mixingBinPolicy", 0, "Binning policy for mixing - 0: multiplicity, 1: multipliciy percentile, 2: both"}; + Configurable mixingDepth{"mixingDepth", 5, "Number of events for mixing"}; + } mixSetting; /// Event selection struct : ConfigurableGroup { std::string prefix = "eventSel"; @@ -126,7 +128,7 @@ struct HfTaskCharmHadronsFemtoDream { } eventSel; /// Particle 1 (track) - Configurable cutBitTrack1{"cutBitTrack1", 5542474, "Particle 1 (Track) - Selection bit from cutCulator"}; + Configurable cutBitTrack1{"cutBitTrack1", 8188, "Particle 1 (Track) - Selection bit from cutCulator"}; Configurable pdgCodeTrack1{"pdgCodeTrack1", 2212, "PDG code of Particle 1 (Track)"}; Configurable pidThresTrack1{"pidThresTrack1", 0.75, "Momentum threshold for PID selection for particle 1 (Track)"}; Configurable tpcBitTrack1{"tpcBitTrack1", 4, "PID TPC bit from cutCulator for particle 1 (Track)"}; @@ -441,7 +443,7 @@ struct HfTaskCharmHadronsFemtoDream { Partition partitionMaskedCol2 = (aod::femtodreamcollision::bitmaskTrackTwo & bitMask) == bitMask; partitionMaskedCol2.bindTable(cols); - for (auto const& [collision1, collision2] : combinations(soa::CombinationsBlockFullIndexPolicy(policy, mixingDepth.value, -1, *partitionMaskedCol1.mFiltered, *partitionMaskedCol2.mFiltered))) { + for (auto const& [collision1, collision2] : combinations(soa::CombinationsBlockFullIndexPolicy(policy, mixSetting.mixingDepth, -1, *partitionMaskedCol1.mFiltered, *partitionMaskedCol2.mFiltered))) { // make sure that tracks in the same events are not mixed if (collision1.globalIndex() == collision2.globalIndex()) { continue; @@ -532,39 +534,16 @@ struct HfTaskCharmHadronsFemtoDream { eventHisto.fillQA(col); auto sliceTrk1 = partitionTrk1->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); auto sliceCharmHad = partitionCharmHadron->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); - int64_t timeStamp = -999; + if (fillTableWithCharm.value && sliceCharmHad.size() == 0) { + return; + } - /// Filling QA histograms of the all tracks and all charm hadrons before pairing - for (auto const& part : sliceTrk1) { - allTrackHisto.fillQA(part, static_cast(confTempFitVarMomentum.value), col.multNtr(), col.multV0M()); + int64_t timeStamp = -999; - // proton track charge - float chargeTrack = 0.; - if ((part.cut() & CutBitChargePositive) == CutBitChargePositive) { - chargeTrack = PositiveCharge; - } else { - chargeTrack = NegativeCharge; - } - timeStamp = part.timeStamp(); - rowFemtoResultTrk( - col.globalIndex(), - timeStamp, - part.pt(), - part.eta(), - part.phi(), - part.trackId(), - chargeTrack, - part.tpcNClsFound(), - part.tpcNClsFindable(), - part.tpcNClsCrossedRows(), - part.tpcNSigmaPr(), - part.tofNSigmaPr()); - } for (auto const& part : sliceCharmHad) { float invMass = getCharmHadronMass(part); registryCharmHadronQa.fill(HIST("CharmHadronQA/hPtVsMass"), part.pt(), invMass); timeStamp = part.timeStamp(); - rowFemtoResultCharm( col.globalIndex(), timeStamp, @@ -581,8 +560,30 @@ struct HfTaskCharmHadronsFemtoDream { part.bdtFD()); } - if (sliceCharmHad.size() || sliceTrk1.size()) { + for (auto const& part : sliceTrk1) { + allTrackHisto.fillQA(part, + static_cast(confTempFitVarMomentum.value), + col.multNtr(), col.multV0M()); + float chargeTrack = ((part.cut() & CutBitChargePositive) == CutBitChargePositive) + ? PositiveCharge + : NegativeCharge; + timeStamp = part.timeStamp(); + rowFemtoResultTrk( + col.globalIndex(), + timeStamp, + part.pt(), + part.eta(), + part.phi(), + part.trackId(), + chargeTrack, + part.tpcNClsFound(), + part.tpcNClsFindable(), + part.tpcNClsCrossedRows(), + part.tpcNSigmaPr(), + part.tofNSigmaPr()); + } + if (!sliceCharmHad.size() || !sliceTrk1.size()) { rowFemtoResultColl( col.globalIndex(), timeStamp, @@ -591,7 +592,6 @@ struct HfTaskCharmHadronsFemtoDream { } else { return; } - doSameEvent(sliceTrk1, sliceCharmHad, parts, col); } PROCESS_SWITCH(HfTaskCharmHadronsFemtoDream, processSameEvent, "Enable processing same event", false); @@ -600,7 +600,7 @@ struct HfTaskCharmHadronsFemtoDream { FilteredFDParticles const& parts, FilteredCharmCands const&) { - switch (mixingBinPolicy.value) { + switch (mixSetting.mixingBinPolicy) { case femtodreamcollision::kMult: doMixedEvent(cols, parts, partitionTrk1, partitionCharmHadron, colBinningMult); break; @@ -656,7 +656,7 @@ struct HfTaskCharmHadronsFemtoDream { o2::aod::FDExtMCParticles const&, FilteredCharmMcCands const&) { - switch (mixingBinPolicy.value) { + switch (mixSetting.mixingBinPolicy) { case femtodreamcollision::kMult: doMixedEvent(cols, parts, partitionMcTrk1, partitionMcCharmHadron, colBinningMult); break; From c2db3616256c114158da2bf9815be46c48638ab5 Mon Sep 17 00:00:00 2001 From: alcaliva <32872606+alcaliva@users.noreply.github.com> Date: Sat, 4 Oct 2025 15:52:46 +0200 Subject: [PATCH 623/986] [DPG] Added unit test for validating reconstruction software (#12929) --- DPG/Tasks/AOTTrack/CMakeLists.txt | 5 + .../AOTTrack/unitTestForReconstruction.cxx | 102 ++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 DPG/Tasks/AOTTrack/unitTestForReconstruction.cxx diff --git a/DPG/Tasks/AOTTrack/CMakeLists.txt b/DPG/Tasks/AOTTrack/CMakeLists.txt index b125419f6d0..bd055664fd8 100644 --- a/DPG/Tasks/AOTTrack/CMakeLists.txt +++ b/DPG/Tasks/AOTTrack/CMakeLists.txt @@ -80,6 +80,11 @@ o2physics_add_dpl_workflow(qa-tracksplitting PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(unit-test-for-reconstruction + SOURCES unitTestForReconstruction.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(tag-and-probe-dmesons SOURCES tagAndProbeDmesons.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DetectorsVertexing O2Physics::MLCore diff --git a/DPG/Tasks/AOTTrack/unitTestForReconstruction.cxx b/DPG/Tasks/AOTTrack/unitTestForReconstruction.cxx new file mode 100644 index 00000000000..a5e6016d9fb --- /dev/null +++ b/DPG/Tasks/AOTTrack/unitTestForReconstruction.cxx @@ -0,0 +1,102 @@ +// 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 unitTestForReconstruction.cxx +/// +/// \brief Unit test for validating the reconstruction software +/// \author Alberto Caliva (alberto.caliva@cern.ch), Catalin-Lucian Ristea (catalin.ristea@cern.ch) +/// \since September 9, 2025 + +#include "Framework/ASoA.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/DataTypes.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/Logger.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/DCA.h" +#include "ReconstructionDataFormats/Track.h" + +#include +#include +#include +#include +#include +#include + +using namespace o2::soa; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::constants::physics; +using namespace o2::constants::math; + +struct UnitTestForReconstruction { + + // Histogram registry + HistogramRegistry registryData{"registryData", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + + // global IDs of events to be inspected + Configurable> eventNr{"eventNr", {1, 5, 12, 44, 76, 99, 102, 115, 180, 220}, "eventNr"}; + std::unordered_set eventSet; + + void init(InitContext const&) + { + // Define histogram to monitor event counts at different selection stages + registryData.add("eventCounter", "eventCounter", HistType::kTH1F, {{10, 0, 10, ""}}); + + // Define histogram for the transverse momentum spectrum of reconstructed charged tracks + registryData.add("ptChargedTracks", "ptChargedTracks", HistType::kTH2F, {{11, 0, 11, "event"}, {1000, 0, 10, "#it{p}_{T} (GeV/#it{c})"}}); + + // Fast lookup set from configurable event list + eventSet = std::unordered_set(eventNr->begin(), eventNr->end()); + } + + // Process Data + void processData(o2::aod::Collisions const& collisions, o2::aod::Tracks const& tracks) + { + // Event index + int eventIndex = 0; + static constexpr int indexAllEvts = 0; + + // Loop over reconstructed events + for (const auto& collision : collisions) { + + // Event counter: before event selection + registryData.fill(HIST("eventCounter"), 0.5); + + // Check if event global index is in the list of events to process + int ev = collision.globalIndex(); + if (eventSet.count(ev)) { + + // Increment event index + eventIndex++; + + // Fill event counter + registryData.fill(HIST("eventCounter"), 1.5); + + // Loop over reconstructed tracks + for (auto const& track : tracks) { + registryData.fill(HIST("ptChargedTracks"), indexAllEvts, track.pt()); + registryData.fill(HIST("ptChargedTracks"), eventIndex, track.pt()); + } + } + } + } + PROCESS_SWITCH(UnitTestForReconstruction, processData, "Process Data", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From aa9b01e071b16ffdf2f24b366b4862ae0513b90f Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sat, 4 Oct 2025 18:26:39 +0200 Subject: [PATCH 624/986] [PWGEM/Dilepton] quick fix in eventQC.cxx (#13233) --- PWGEM/Dilepton/Tasks/eventQC.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGEM/Dilepton/Tasks/eventQC.cxx b/PWGEM/Dilepton/Tasks/eventQC.cxx index b8cb8d0c968..dbfeb2931d4 100644 --- a/PWGEM/Dilepton/Tasks/eventQC.cxx +++ b/PWGEM/Dilepton/Tasks/eventQC.cxx @@ -71,8 +71,8 @@ struct eventQC { Configurable cfgQvecEstimator{"cfgQvecEstimator", 0, "FT0M:0, FT0A:1, FT0C:2, BTot:3, BPos:4, BNeg:5"}; Configurable cfgCentMin{"cfgCentMin", -1.f, "min. centrality"}; Configurable cfgCentMax{"cfgCentMax", 999.f, "max. centrality"}; - Configurable cfgNumContribMin{"cfgNumContribMin", 0, "min. numContrib"}; - Configurable cfgNumContribMax{"cfgNumContribMax", 1000000000, "max. numContrib"}; + Configurable cfgNumContribMin{"cfgNumContribMin", 0, "min. numContrib"}; + Configurable cfgNumContribMax{"cfgNumContribMax", 65000, "max. numContrib"}; ConfigurableAxis ConfPtBins{"ConfPtBins", {VARIABLE_WIDTH, 0.00, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.90, 0.95, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.50, 3.00, 3.50, 4.00, 4.50, 5.00, 6.00, 7.00, 8.00, 9.00, 10.00}, "pT bins for output histograms"}; Configurable cfgNbinsEta{"cfgNbinsEta", 20, "number of eta bins for output histograms"}; Configurable cfgNbinsPhi{"cfgNbinsPhi", 36, "number of phi bins for output histograms"}; From 4c1f9b2f436815d64cd93447be1a84b4fcc60b1e Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sun, 5 Oct 2025 01:51:41 +0200 Subject: [PATCH 625/986] [PWGLF] Fix autodetection of old format in strangeness tof pid (#13236) Co-authored-by: ALICE Builder --- PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx index 3848c92ddaa..5d6c360bf09 100644 --- a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx @@ -1360,12 +1360,13 @@ struct strangenesstofpid { void processDerivedData(soa::Join const& collisions, V0DerivedDatas const& V0s, CascDerivedDatas const& cascades, dauTracks const& dauTrackTable, aod::DauTrackTOFPIDs const& dauTrackTOFPIDs) { - // auto-determine if current or old generation of dauTrackTOFPIDs - if (dauTrackTOFPIDs.size() == 0) { - return; + bool isNewTOFFormat = true; // can only happen for new format + + // auto-determine if using old format + if (dauTrackTOFPIDs.size() != 0) { + auto firstTOFPID = dauTrackTOFPIDs.rawIteratorAt(0); + isNewTOFFormat = firstTOFPID.straCollisionId() < 0 ? false : true; } - auto firstTOFPID = dauTrackTOFPIDs.rawIteratorAt(0); - bool isNewTOFFormat = firstTOFPID.straCollisionId() < 0 ? false : true; if (!isNewTOFFormat && calculationMethod.value > 0) { LOGF(fatal, "Using the old derived data format with the new calculation method is not viable due to lack of needed info! Crashing."); From ee95e6386c2e7b687cb06dbd524717033e5f840f Mon Sep 17 00:00:00 2001 From: blacwovie Date: Sun, 5 Oct 2025 20:40:04 +0800 Subject: [PATCH 626/986] [PWGCF] safer ME and QA for pi-d (#13238) Co-authored-by: ALICE Action Bot --- .../TableProducer/PiNucleiFemto.cxx | 46 +++++++++++++------ 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx b/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx index c2a6d595d36..da4af042a64 100644 --- a/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx +++ b/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx @@ -164,6 +164,8 @@ struct PiNucleiFemto { Configurable settingCutEta{"settingCutEta", 0.8f, "Eta cut on daughter track"}; Configurable settingCutChi2tpcLow{"settingCutChi2tpcLow", 0.0f, "Low cut on TPC chi2"}; Configurable settingCutChi2tpcHigh{"settingCutChi2tpcHigh", 999.f, "High cut on TPC chi2"}; + Configurable settingCutChi2tpcLowPion{"settingCutChi2tpcLowPion", 0.5f, "Low cut on TPC chi2 only for pion"}; + Configurable settingCutChi2tpcHighPion{"settingCutChi2tpcHighPion", 4.f, "High cut on TPC chi2 only for pion"}; Configurable settingCutInvMass{"settingCutInvMass", 0.0f, "Invariant mass upper limit"}; Configurable settingCutPtMinDePi{"settingCutPtMinDePi", 0.0f, "Minimum PT cut on DePi4"}; Configurable settingCutClSizeItsDe{"settingCutClSizeItsDe", 4.0f, "Minimum ITS cluster size for De"}; @@ -171,6 +173,7 @@ struct PiNucleiFemto { Configurable settingCutTPCChi2He{"settingCutTPCChi2He", 0.0f, "Minimum tpcChi2He for Hyper He3"}; Configurable settingCutAverClsSizeHe{"settingCutAverClsSizeHe", 0.0f, "Minimum averClusSizeHe for Hyper He3"}; Configurable settingCutChi2NClITS{"settingCutChi2NClITS", 999.f, "Maximum ITS Chi2 for tracks"}; + Configurable settingCutChi2NClITSPion{"settingCutChi2NClITSPion", 36.f, "Maximum ITS Chi2 for tracks only for pion"}; Configurable settingCutNsigmaTPCPi{"settingCutNsigmaTPCPi", 3.0f, "Value of the TPC Nsigma cut on Pi"}; Configurable settingCutNsigmaTPCDe{"settingCutNsigmaTPCDe", 2.5f, "Value of the TPC Nsigma cut on De"}; Configurable settingCutNsigmaITSDe{"settingCutNsigmaITSDe", 2.5f, "Value of the ITD Nsigma cut on De"}; @@ -180,6 +183,7 @@ struct PiNucleiFemto { Configurable settingCutNsigmaTOFTPCPi{"settingCutNsigmaTOFTPCPi", 3.0f, "Value of the Pion TOF TPC Nsigma cut"}; Configurable settingNoMixedEvents{"settingNoMixedEvents", 5, "Number of mixed events per event"}; Configurable settingEnableBkgUS{"settingEnableBkgUS", false, "Enable US background"}; + Configurable settingSaferME{"settingSaferME", false, "For Safer ME"}; Configurable settingFillTable{"settingFillTable", false, "Enable table filling"}; Configurable settingCutPiptMin{"settingCutPiptMin", 0.14f, "Minimum PT cut on Pi"}; @@ -283,6 +287,7 @@ struct PiNucleiFemto { {"hkStaVsmTVsCent_US_M", ";kStar (GeV/c);mT (GeV/#it{c}^{2});Centrality", {HistType::kTH3F, {{300, 0.0f, 3.0f}, {100, 0.2f, 3.2f}, {100, 0.0f, 100.0f}}}}, {"hkStaVsmTVsCent_US_A", ";kStar (GeV/c);mT (GeV/#it{c}^{2});Centrality", {HistType::kTH3F, {{300, 0.0f, 3.0f}, {100, 0.2f, 3.2f}, {100, 0.0f, 100.0f}}}}, {"hCollIDVsCentEachPion", ";CollisionID;Centrality", {HistType::kTH2F, {{4000, 0.0f, 4000.0f}, {100, 0.0f, 100.0f}}}}, + {"hCollIDVsCentEachDe", ";CollisionID;Centrality", {HistType::kTH2F, {{4000, 0.0f, 4000.0f}, {100, 0.0f, 100.0f}}}}, {"hNHypsPerPrevColl", "Number of V0Hypers in previous collision used for mixing;N_{V0Hypers};Entries", {HistType::kTH2F, {{4000, 0.0f, 4000.0f}, {50, -0.5, 49.5}}}}, {"hkStar_LS_M", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}}, {"hkStar_LS_A", ";kStar (GeV/c)", {HistType::kTH1F, {{300, 0.0f, 3.0f}}}}, @@ -302,7 +307,7 @@ struct PiNucleiFemto { float Vz_step = (Vz_high - Vz_low) / numOfVertexZBins; struct EventRef { - int64_t collisionId; + uint64_t collisionId; }; struct PoolBin { @@ -477,6 +482,8 @@ struct PiNucleiFemto { template bool selectionPIDPion(const Ttrack& candidate) { + if (candidate.tpcChi2NCl() > settingCutChi2tpcHighPion || candidate.tpcChi2NCl() < settingCutChi2tpcLowPion || candidate.itsChi2NCl() > settingCutChi2NClITSPion) + return false; if (abs(candidate.dcaXY()) > settingCutPiDCAxyMin || abs(candidate.dcaZ()) > settingCutPiDCAzMin) return false; @@ -625,9 +632,11 @@ struct PiNucleiFemto { nCand = mFitter.process(trackCovDe, trackCovPi); } catch (...) { LOG(error) << "Exception caught in DCA fitter process call!"; + mQaRegistry.fill(HIST("hSkipReasons"), 0); return false; } if (nCand == 0) { + mQaRegistry.fill(HIST("hSkipReasons"), 1); return false; } @@ -650,6 +659,7 @@ struct PiNucleiFemto { } if (!mGoodCollisions[collIdxMin]) { + mQaRegistry.fill(HIST("hSkipReasons"), 2); return false; } piNucand.collisionID = collIdxMin; @@ -662,10 +672,12 @@ struct PiNucleiFemto { float invMass = 0; invMass = RecoDecay::m(std::array{piNucand.momNu, piNucand.momPi}, std::array{o2::constants::physics::MassDeuteron, o2::constants::physics::MassPiPlus}); if (settingCutInvMass > 0 && invMass > settingCutInvMass) { + mQaRegistry.fill(HIST("hSkipReasons"), 3); return false; } float ptDePi = std::hypot(piNucand.momNu[0] + piNucand.momPi[0], piNucand.momNu[1] + piNucand.momPi[1]); if (ptDePi < settingCutPtMinDePi) { + mQaRegistry.fill(HIST("hSkipReasons"), 4); return false; } @@ -816,6 +828,7 @@ struct PiNucleiFemto { } mQaRegistry.fill(HIST("hTrackSel"), Selections::kPID); mQaRegistry.fill(HIST("hSingleNuPt"), track0.pt() * track0.sign()); + mQaRegistry.fill(HIST("hCollIDVsCentEachDe"), track0.collisionId(), cent); for (const auto& track1 : tracks) { if (track0 == track1) { @@ -1220,26 +1233,35 @@ PROCESS_SWITCH(PiNucleiFemto, processMixedEventHyper, "Process Mixed event", fal LOG(info) << "Initialized event pool with size = " << All_Event_pool.size(); } for (auto const& collision : collisions) { + if (!collision.sel8()) { + mQaRegistry.fill(HIST("hSkipReasons"), 0); + continue; + } mQaRegistry.fill(HIST("hNcontributor"), collision.numContrib()); mQaRegistry.fill(HIST("hCentrality"), collision.centFT0C()); mQaRegistry.fill(HIST("hVtxZ"), collision.posZ()); - int poolIndexPi = where_pool(collision.posZ(), collision.centFT0C()); + int poolIndexPi = where_pool(collision.posZ(), collision.centFT0C()); if (poolIndexPi < 0 || static_cast(poolIndexPi) >= All_Event_pool.size()) { continue; } auto& pool = All_Event_pool[poolIndexPi]; + const uint64_t collIdxPi = collision.globalIndex(); + auto trackTableThisCollision = pitracks.sliceBy(mPerCol, collIdxPi); + trackTableThisCollision.bindExternalIndices(&pitracks); + for (auto const& storedEvent : pool.events) { - const auto& c2 = collisions.iteratorAt(storedEvent.collisionId); - if (!collision.sel8() || !c2.sel8()) { - mQaRegistry.fill(HIST("hSkipReasons"), 0); - continue; + const uint64_t collIdxHyp = storedEvent.collisionId; + if (settingSaferME) { + if (static_cast(collIdxHyp) > collisions.size()) { + mQaRegistry.fill(HIST("hSkipReasons"), 4); + continue; + } } - auto hypdTablepreviousCollision = V0Hypers.sliceBy(hypPerCol, c2.globalIndex()); + auto hypdTablepreviousCollision = V0Hypers.sliceBy(hypPerCol, collIdxHyp); hypdTablepreviousCollision.bindExternalIndices(&V0Hypers); - if (hypdTablepreviousCollision.size() == 0) { mQaRegistry.fill(HIST("hSkipReasons"), 1); continue; @@ -1247,23 +1269,19 @@ PROCESS_SWITCH(PiNucleiFemto, processMixedEventHyper, "Process Mixed event", fal auto firstHyp = hypdTablepreviousCollision.iteratorAt(0); int poolIndexHyp = where_pool(firstHyp.zPrimVtx(), firstHyp.centralityFT0C()); - if (poolIndexHyp != poolIndexPi) { mQaRegistry.fill(HIST("hSkipReasons"), 2); continue; } + mQaRegistry.fill(HIST("hNHypsPerPrevColl"), collIdxHyp, hypdTablepreviousCollision.size()); - auto trackTableThisCollision = pitracks.sliceBy(mPerCol, collision.globalIndex()); - trackTableThisCollision.bindExternalIndices(&pitracks); - - mQaRegistry.fill(HIST("hNHypsPerPrevColl"), c2.globalIndex(), hypdTablepreviousCollision.size()); pairHyperEventMixing(trackTableThisCollision, hypdTablepreviousCollision); } if (static_cast(pool.events.size()) >= settingNoMixedEvents) { pool.events.pop_front(); } - pool.events.push_back({collision.globalIndex()}); + pool.events.push_back({collIdxPi}); } fillPairsHyper(collisions, pitracks, V0Hypers, /*isMixedEvent*/ true); } From bd5363ecb866b2b7a2bf23fb57ea84fcdd729aa4 Mon Sep 17 00:00:00 2001 From: alcaliva <32872606+alcaliva@users.noreply.github.com> Date: Sun, 5 Oct 2025 15:00:46 +0200 Subject: [PATCH 627/986] [PWGLF] eta-pt distribution of antiprotons, extend pt range for reweighting, add jet aperture vs pt (#13234) --- PWGLF/Tasks/Nuspex/antinucleiInJets.cxx | 60 +++++++++++++------------ 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx index 6b699b6fff6..86ce8a1a340 100644 --- a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx +++ b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx @@ -219,6 +219,9 @@ struct AntinucleiInJets { // Jet effective area over piR^2 registryData.add("jetEffectiveAreaOverPiR2", "jet effective area / piR^2", HistType::kTH1F, {{2000, 0, 2, "Area/#piR^{2}"}}); + // angle between track and jet axis + registryData.add("theta_track_jet", "theta_track_jet", HistType::kTH2F, {{100, 0, 100, "#it{p}^{jet}_{T} (GeV/#it{c})"}, {400, 0, 20.0, "#theta_{track-jet} (deg)"}}); + // Antiprotons registryData.add("antiproton_jet_tpc", "antiproton_jet_tpc", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); registryData.add("antiproton_jet_tof", "antiproton_jet_tof", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TOF}"}}); @@ -270,6 +273,10 @@ struct AntinucleiInJets { // Normalization histogram registryMC.add("antiproton_deltay_deltaphi_jet", "antiproton_deltay_deltaphi_jet", HistType::kTH2F, {{2000, -1.0, 1.0, "#Delta#it{y}"}, {2000, 0.0, 2.0, "#Delta#phi"}}); registryMC.add("antiproton_deltay_deltaphi_ue", "antiproton_deltay_deltaphi_ue", HistType::kTH2F, {{2000, -1.0, 1.0, "#Delta#it{y}"}, {2000, 0.0, 2.0, "#Delta#phi"}}); + + // 2d kinematic distributions (eta,pt) in jets and UE + registryMC.add("antiproton_eta_pt_jet", "antiproton_eta_pt_jet", HistType::kTH2F, {{500, 0.0, 5.0, "#it{p}_{T} (GeV/#it{c})"}, {18, -0.9, 0.9, "#eta"}}); + registryMC.add("antiproton_eta_pt_ue", "antiproton_eta_pt_ue", HistType::kTH2F, {{500, 0.0, 5.0, "#it{p}_{T} (GeV/#it{c})"}, {18, -0.9, 0.9, "#eta"}}); } // Reconstructed antiproton spectra in jets and UE (MC-matched) with TPC/TOF PID @@ -297,9 +304,6 @@ struct AntinucleiInJets { registryMC.add("antiproton_all_dca_jet", "antiproton_all_dca_jet", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {200, -1, 1, "DCA_{xy} (cm)"}}); registryMC.add("antiproton_all_dca_ue", "antiproton_all_dca_ue", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {200, -1, 1, "DCA_{xy} (cm)"}}); - // nsigmaITS for antiproton candidates - registryMC.add("antiproton_nsigma_its_mc", "antiproton_nsigma_its_mc", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{ITS}"}}); - // nsigmaTOF for antiprotons registryMC.add("antiproton_nsigma_tof_jet_mc", "antiproton_nsigma_tof_jet_mc", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TOF}"}}); } @@ -349,11 +353,14 @@ struct AntinucleiInJets { registryMC.add("antihelium3_rec_tpc_ue", "antihelium3_rec_tpc_ue", HistType::kTH1F, {{nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}}); // Generated spectra needed for reweighting - registryMC.add("protonBar", "protonBar", HistType::kTH1F, {{5000, 0, 5, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("lambdaBar", "lambdaBar", HistType::kTH1F, {{5000, 0, 5, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("xiBar", "xiBar", HistType::kTH1F, {{5000, 0, 5, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("omegaBar", "omegaBar", HistType::kTH1F, {{5000, 0, 5, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("sigmaBar", "sigmaBar", HistType::kTH1F, {{5000, 0, 5, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("protonBar", "protonBar", HistType::kTH1F, {{1000, 0, 10, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("lambdaBar", "lambdaBar", HistType::kTH1F, {{1000, 0, 10, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("xiBar", "xiBar", HistType::kTH1F, {{1000, 0, 10, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("omegaBar", "omegaBar", HistType::kTH1F, {{1000, 0, 10, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("sigmaBar", "sigmaBar", HistType::kTH1F, {{1000, 0, 10, "#it{p}_{T} (GeV/#it{c})"}}); + + // nsigmaITS for antiproton candidates + registryMC.add("antiproton_nsigma_its_mc", "antiproton_nsigma_its_mc", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{ITS}"}}); } // Systematic uncertainties (Data) @@ -621,20 +628,6 @@ struct AntinucleiInJets { 47.61, 44.02, 32.15, 46.21, 34.75, 40.17, 37.14, 30.55, 45.42, 42.30, 41.79, 33.21, 39.12, 47.98, 36.52, 31.58, 49.44, 38.02, 35.56, 43.49}; - static std::vector minEtaSyst = { - -0.804, -0.844, -0.751, -0.784, -0.819, -0.823, -0.768, -0.781, -0.845, -0.787, - -0.758, -0.828, -0.776, -0.842, -0.808, -0.763, -0.849, -0.770, -0.799, -0.754, - -0.825, -0.847, -0.806, -0.783, -0.796, -0.835, -0.777, -0.752, -0.838, -0.813, - -0.785, -0.802, -0.795, -0.846, -0.780, -0.829, -0.817, -0.773, -0.765, -0.789, - -0.800, -0.839, -0.758, -0.820, -0.833, -0.762, -0.792, -0.809, -0.827, -0.751}; - - static std::vector maxEtaSyst = { - 0.804, 0.844, 0.751, 0.784, 0.819, 0.823, 0.768, 0.781, 0.845, 0.787, - 0.758, 0.828, 0.776, 0.842, 0.808, 0.763, 0.849, 0.770, 0.799, 0.754, - 0.825, 0.847, 0.806, 0.783, 0.796, 0.835, 0.777, 0.752, 0.838, 0.813, - 0.785, 0.802, 0.795, 0.846, 0.780, 0.829, 0.817, 0.773, 0.765, 0.789, - 0.800, 0.839, 0.758, 0.820, 0.833, 0.762, 0.792, 0.809, 0.827, 0.751}; - // Track Selection if (requirePvContributor && !(track.isPVContributor())) return false; @@ -650,7 +643,7 @@ struct AntinucleiInJets { return false; if (track.itsChi2NCl() > maxChiSquareItsSyst[isyst]) return false; - if (track.eta() < minEtaSyst[isyst] || track.eta() > maxEtaSyst[isyst]) + if (track.eta() < minEta || track.eta() > maxEta) return false; if (track.pt() < minPt) return false; @@ -871,6 +864,11 @@ struct AntinucleiInJets { if (std::fabs(dcaxy) > maxDcaxy || std::fabs(dcaz) > maxDcaz) continue; + // Fill angular distribution of tracks wrt jet axis + TVector3 trackDirection(track.px(), track.py(), track.pz()); + double thetaTrackJet = (180.0 / PI) * jetAxis.Angle(trackDirection); + registryData.fill(HIST("theta_track_jet"), jet.pt(), thetaTrackJet); + // Particle identification using the ITS cluster size bool passedItsPidProt(true), passedItsPidDeut(true), passedItsPidHel(true); double nSigmaITSprot = static_cast(itsResponse.nSigmaITS(track)); @@ -1374,6 +1372,11 @@ struct AntinucleiInJets { passedItsPidHel = false; } + // Fill nsigmaITS for antiproton candidates + if (track.sign() < 0 && particle.pdgCode() == PDG_t::kProtonBar && isHighPurityAntiproton(track)) { + registryMC.fill(HIST("antiproton_nsigma_its_mc"), pt, nSigmaITSprot); + } + // Fill histograms of antiprotons if (track.sign() < 0 && particle.pdgCode() == PDG_t::kProtonBar && passedItsPidProt) { if (nsigmaTPCPr > minNsigmaTpc && nsigmaTPCPr < maxNsigmaTpc) { @@ -1522,6 +1525,9 @@ struct AntinucleiInJets { // Fill histogram for generated antiprotons registryMC.fill(HIST("antiproton_gen_jet"), particle.pt()); + + // Fill 2d (pt,eta) distribution of antiprotons + registryMC.fill(HIST("antiproton_eta_pt_jet"), particle.pt(), particle.eta()); } // Set up two perpendicular cone axes for underlying event estimation @@ -1562,6 +1568,9 @@ struct AntinucleiInJets { // Fill histogram for antiprotons in the UE registryMC.fill(HIST("antiproton_gen_ue"), protonVec.Pt()); + + // Fill 2d (pt,eta) distribution of antiprotons + registryMC.fill(HIST("antiproton_eta_pt_ue"), protonVec.Pt(), protonVec.Eta()); } } if (isAtLeastOneJetSelected) { @@ -1738,11 +1747,6 @@ struct AntinucleiInJets { // nsigmaITS for antiprotons double nSigmaITSprot = static_cast(itsResponse.nSigmaITS(track)); - // Fill nsigmaITS for antiproton candidates - if (isHighPurityAntiproton(track)) { - registryMC.fill(HIST("antiproton_nsigma_its_mc"), pt, nSigmaITSprot); - } - // Particle identification using the ITS cluster size bool passedItsPidProt(true); if (applyItsPid && pt < ptMaxItsPidProt && (nSigmaITSprot < nSigmaItsMin || nSigmaITSprot > nSigmaItsMax)) { From 70cef597671fffcb856fc6776f44e829cbef8730 Mon Sep 17 00:00:00 2001 From: Giorgio Alberto Lucia <87222843+GiorgioAlbertoLucia@users.noreply.github.com> Date: Sun, 5 Oct 2025 15:01:50 +0200 Subject: [PATCH 628/986] [PWGLF] added QC task for nuclei, moved nucleiUtils.h to the appropriate folder (#13212) Co-authored-by: ALICE Action Bot --- PWGLF/DataModel/LFSlimNucleiTables.h | 15 + PWGLF/TableProducer/Nuspex/nucleiFlowTree.cxx | 48 +- PWGLF/TableProducer/Nuspex/nucleiUtils.h | 187 ------ PWGLF/TableProducer/QC/CMakeLists.txt | 5 + PWGLF/TableProducer/QC/nucleiQC.cxx | 487 +++++++++++++++ PWGLF/Utils/nucleiUtils.h | 565 ++++++++++++++++++ 6 files changed, 1093 insertions(+), 214 deletions(-) delete mode 100644 PWGLF/TableProducer/Nuspex/nucleiUtils.h create mode 100644 PWGLF/TableProducer/QC/nucleiQC.cxx create mode 100644 PWGLF/Utils/nucleiUtils.h diff --git a/PWGLF/DataModel/LFSlimNucleiTables.h b/PWGLF/DataModel/LFSlimNucleiTables.h index e1c0e0eb364..5f14cf5ab46 100644 --- a/PWGLF/DataModel/LFSlimNucleiTables.h +++ b/PWGLF/DataModel/LFSlimNucleiTables.h @@ -185,6 +185,21 @@ DECLARE_SOA_TABLE(NucleiPairTable, "AOD", "NUCLEIPAIRTABLE", NucleiPairTableNS::ClusterSizesITS2, NucleiPairTableNS::Flags2); +// Reduced table +DECLARE_SOA_TABLE(NucleiTableRed, "AOD", "NUCLEITABLERED", + NucleiTableNS::Pt, + NucleiTableNS::Eta, + NucleiTableNS::Phi, + NucleiTableNS::TPCInnerParam, + NucleiTableNS::ITSclusterSizes, + NucleiTableNS::TPCsignal, + NucleiTableNS::Beta, + NucleiTableNS::DCAxy, + NucleiTableNS::DCAz, + NucleiTableNS::Flags, + NucleiTableNS::PDGcode, + NucleiTableNS::MotherPDGcode); + } // namespace o2::aod #endif // PWGLF_DATAMODEL_LFSLIMNUCLEITABLES_H_ diff --git a/PWGLF/TableProducer/Nuspex/nucleiFlowTree.cxx b/PWGLF/TableProducer/Nuspex/nucleiFlowTree.cxx index 14192166fae..beb4da99806 100644 --- a/PWGLF/TableProducer/Nuspex/nucleiFlowTree.cxx +++ b/PWGLF/TableProducer/Nuspex/nucleiFlowTree.cxx @@ -19,54 +19,48 @@ // o2-analysis-pid-tof-base, o2-analysis-multiplicity-table, o2-analysis-event-selection // (to add flow: o2-analysis-qvector-table, o2-analysis-centrality-table) -#include -#include -#include -#include -#include - -#include "Math/Vector4D.h" - -#include "CCDB/BasicCCDBManager.h" +#include "PWGLF/DataModel/EPCalibrationTables.h" +#include "PWGLF/DataModel/LFSlimNucleiTables.h" +#include "PWGLF/Utils/nucleiUtils.h" +#include "Common/Core/EventPlaneHelper.h" +#include "Common/Core/PID/PIDTOF.h" +#include "Common/Core/RecoDecay.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/trackUtilities.h" #include "Common/DataModel/Centrality.h" -#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/PIDResponseITS.h" +#include "Common/DataModel/Qvectors.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "Common/Core/PID/PIDTOF.h" #include "Common/TableProducer/PID/pidTOFBase.h" -#include "Common/Core/EventPlaneHelper.h" -#include "Common/DataModel/Qvectors.h" #include "Common/Tools/TrackTuner.h" -#include "Common/Core/RecoDecay.h" +#include "EventFiltering/Zorro.h" +#include "EventFiltering/ZorroSummary.h" +#include "CCDB/BasicCCDBManager.h" #include "DataFormatsParameters/GRPMagField.h" #include "DataFormatsParameters/GRPObject.h" #include "DataFormatsTPC/BetheBlochAleph.h" #include "DetectorsBase/GeometryManager.h" #include "DetectorsBase/Propagator.h" - -#include "EventFiltering/Zorro.h" -#include "EventFiltering/ZorroSummary.h" - +#include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" - #include "ReconstructionDataFormats/Track.h" -#include "PWGLF/DataModel/EPCalibrationTables.h" -#include "PWGLF/DataModel/LFSlimNucleiTables.h" - +#include "Math/Vector4D.h" #include "TRandom3.h" -#include "nucleiUtils.h" +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -257,7 +251,7 @@ struct nucleiFlowTree { spectra.add("hTpcSignalDataSelected", "Specific energy loss for selected particles", HistType::kTH2F, {{600, -6., 6., "#it{p} (GeV/#it{c})"}, {1400, 0, 1400, "d#it{E} / d#it{X} (a. u.)"}}); spectra.add("hTofSignalData", "TOF beta", HistType::kTH2F, {{500, 0., 5., "#it{p} (GeV/#it{c})"}, {750, 0, 1.5, "TOF #beta"}}); - for (int iS{0}; iS < nuclei::species; ++iS) { + for (int iS{0}; iS < nuclei::Species::kNspecies; ++iS) { for (int iMax{0}; iMax < 2; ++iMax) { nuclei::pidCutTPC[iS][iMax] = cfgNsigmaTPC->get(iS, iMax); // changed pidCut to pidCutTPC so that it compiles TODO: check if it is correct } @@ -328,7 +322,7 @@ struct nucleiFlowTree { bool selectedTPC[5]{false}, goodToAnalyse{false}; std::array nSigmaTPC; - for (int iS{0}; iS < nuclei::species; ++iS) { + for (int iS{0}; iS < nuclei::Species::kNspecies; ++iS) { double expBethe{tpc::BetheBlochAleph(static_cast(correctedTpcInnerParam * bgScalings[iS][iC]), cfgBetheBlochParams->get(iS, 0u), cfgBetheBlochParams->get(iS, 1u), cfgBetheBlochParams->get(iS, 2u), cfgBetheBlochParams->get(iS, 3u), cfgBetheBlochParams->get(iS, 4u))}; @@ -371,7 +365,7 @@ struct nucleiFlowTree { if (!collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { flag |= kITSrof; } - for (int iS{0}; iS < nuclei::species; ++iS) { + for (int iS{0}; iS < nuclei::Species::kNspecies; ++iS) { bool selectedTOF{false}; if (std::abs(dcaInfo[1]) > cfgDCAcut->get(iS, 1)) { continue; diff --git a/PWGLF/TableProducer/Nuspex/nucleiUtils.h b/PWGLF/TableProducer/Nuspex/nucleiUtils.h deleted file mode 100644 index 29cd489768d..00000000000 --- a/PWGLF/TableProducer/Nuspex/nucleiUtils.h +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#ifndef PWGLF_TABLEPRODUCER_NUSPEX_NUCLEIUTILS_H_ -#define PWGLF_TABLEPRODUCER_NUSPEX_NUCLEIUTILS_H_ - -#include -#include - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; -using namespace o2::constants::physics; - -struct NucleusCandidate { - int globalIndex; - int collTrackIndex; - float pt; - float eta; - float phi; - float tpcInnerParam; - float beta; - float zVertex; - int nContrib; - float DCAxy; - float DCAz; - float TPCsignal; - float ITSchi2; - float TPCchi2; - float TOFchi2; - std::array nSigmaTPC; - std::array tofMasses; - bool fillTree; - bool fillDCAHist; - bool correctPV; - bool isSecondary; - bool fromWeakDecay; - uint16_t flags; - uint8_t TPCfindableCls; - uint8_t TPCcrossedRows; - uint8_t ITSclsMap; - uint8_t TPCnCls; - uint8_t TPCnClsShared; - uint8_t ITSnCls; - uint32_t clusterSizesITS; -}; - -struct NucleusCandidateFlow { - float centFV0A; - float centFT0M; - float centFT0A; - float centFT0C; - float psiFT0A; - float psiFT0C; - float psiTPC; - float psiTPCl; - float psiTPCr; - float qFT0A; - float qFT0C; - float qTPC; - float qTPCl; - float qTPCr; -}; - -namespace nuclei -{ -constexpr double bbMomScalingDefault[5][2]{ - {1., 1.}, - {1., 1.}, - {1., 1.}, - {1., 1.}, - {1., 1.}}; -constexpr double betheBlochDefault[5][6]{ - {-136.71, 0.441, 0.2269, 1.347, 0.8035, 0.09}, - {-136.71, 0.441, 0.2269, 1.347, 0.8035, 0.09}, - {-239.99, 1.155, 1.099, 1.137, 1.006, 0.09}, - {-321.34, 0.6539, 1.591, 0.8225, 2.363, 0.09}, - {-586.66, 1.859, 4.435, 0.282, 3.201, 0.09}}; -constexpr double nSigmaTPCdefault[5][2]{ - {-5., 5.}, - {-5., 5.}, - {-5., 5.}, - {-5., 5.}, - {-5., 5.}}; -// constexpr double nSigmaTOFdefault[5][2]{ -// {-5., 5.}, -// {-5., 5.}, -// {-5., 5.}, -// {-5., 5.}, -// {-5., 5.}}; -constexpr double DCAcutDefault[5][2]{ - {1., 1.}, - {1., 1.}, - {1., 1.}, - {1., 1.}, - {1., 1.}}; -constexpr int TreeConfigDefault[5][2]{ - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}}; -constexpr int FlowHistDefault[5][1]{ - {0}, - {0}, - {0}, - {0}, - {0}}; -constexpr int DCAHistDefault[5][2]{ - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}}; -constexpr double DownscalingDefault[5][1]{ - {1.}, - {1.}, - {1.}, - {1.}, - {1.}}; -// constexpr bool storeTreesDefault[5]{false, false, false, false, false}; -constexpr int species{5}; -constexpr float charges[5]{1.f, 1.f, 1.f, 2.f, 2.f}; -constexpr float masses[5]{MassProton, MassDeuteron, MassTriton, MassHelium3, MassAlpha}; -static const std::vector matter{"M", "A"}; -static const std::vector pidName{"TPC", "TOF"}; -static const std::vector names{"proton", "deuteron", "triton", "He3", "alpha"}; -static const std::vector treeConfigNames{"Filter trees", "Use TOF selection"}; -static const std::vector flowConfigNames{"Save flow hists"}; -static const std::vector DCAConfigNames{"Save DCA hist", "Matter/Antimatter"}; -static const std::vector nSigmaConfigName{"nsigma_min", "nsigma_max"}; -static const std::vector nDCAConfigName{"max DCAxy", "max DCAz"}; -static const std::vector DownscalingConfigName{"Fraction of kept candidates"}; -static const std::vector betheBlochParNames{"p0", "p1", "p2", "p3", "p4", "resolution"}; -static const std::vector chargeLabelNames{"Positive", "Negative"}; - -float pidCutTPC[5][2]; //[species][lower/upper limit] - -o2::base::MatLayerCylSet* lut = nullptr; - -std::vector candidates; -std::vector candidates_flow; - -enum centDetectors { - kFV0A = 0, - kFT0M = 1, - kFT0A = 2, - kFT0C = 3 -}; - -static const std::vector centDetectorNames{"FV0A", "FT0M", "FT0A", "FT0C"}; - -enum evSel { - kTVX = 0, - kZvtx, - kTFborder, - kITSROFborder, - kNoSameBunchPileup, - kIsGoodZvtxFT0vsPV, - kIsGoodITSLayersAll, - kIsEPtriggered, - kNevSels -}; - -static const std::vector eventSelectionTitle{"Event selections"}; -static const std::vector eventSelectionLabels{"TVX", "Z vtx", "TF border", "ITS ROF border", "No same-bunch pile-up", "kIsGoodZvtxFT0vsPV", "isGoodITSLayersAll", "isEPtriggered"}; - -constexpr int EvSelDefault[8][1]{ - {1}, - {1}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}}; -} // namespace nuclei - -#endif // PWGLF_TABLEPRODUCER_NUSPEX_NUCLEIUTILS_H_ diff --git a/PWGLF/TableProducer/QC/CMakeLists.txt b/PWGLF/TableProducer/QC/CMakeLists.txt index db3fdb4876b..79501158034 100644 --- a/PWGLF/TableProducer/QC/CMakeLists.txt +++ b/PWGLF/TableProducer/QC/CMakeLists.txt @@ -18,3 +18,8 @@ o2physics_add_dpl_workflow(flow-qc SOURCES flowQC.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(nucleiqc + SOURCES nucleiQC.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGLF/TableProducer/QC/nucleiQC.cxx b/PWGLF/TableProducer/QC/nucleiQC.cxx new file mode 100644 index 00000000000..739890077b7 --- /dev/null +++ b/PWGLF/TableProducer/QC/nucleiQC.cxx @@ -0,0 +1,487 @@ +// 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. +// +// Nuclei spectra analysis task +// ======================== +// +// Executable + dependencies: +// +// Data (run3): +// o2-analysis-lf-nuclei-spectra, o2-analysis-timestamp +// o2-analysis-pid-tof-base, o2-analysis-multiplicity-table, o2-analysis-event-selection +// (to add flow: o2-analysis-qvector-table, o2-analysis-centrality-table) + +#include "PWGLF/DataModel/EPCalibrationTables.h" +#include "PWGLF/DataModel/LFSlimNucleiTables.h" +#include "PWGLF/Utils/nucleiUtils.h" + +#include "Common/Core/EventPlaneHelper.h" +#include "Common/Core/PID/PIDTOF.h" +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseITS.h" +#include "Common/DataModel/Qvectors.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/TableProducer/PID/pidTOFBase.h" +#include "Common/Tools/TrackTuner.h" +#include "EventFiltering/Zorro.h" +#include "EventFiltering/ZorroSummary.h" + +#include "CCDB/BasicCCDBManager.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DataFormatsTPC/BetheBlochAleph.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/StaticFor.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" + +#include "Math/Vector4D.h" +#include "TRandom3.h" + +#include +#include +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; + +struct nucleiQC { + + using TrackCandidates = soa::Join; + using TrackCandidatesMC = soa::Join; + using Collision = soa::Join::iterator; + Preslice mMcParticlesPerCollision = o2::aod::mcparticle::mcCollisionId; + + Configurable cfgFillTable{"cfgFillTable", true, "Fill output tree"}; + Configurable cfgDoCheckPdgCode{"cfgDoCheckPdgCode", true, "Should you only select tracks associated to a mc particle with the correct PDG code?"}; + Configurable> cfgSpeciesToProcess{"cfgSpeciesToProcess", {nuclei::speciesToProcessDefault[0], nuclei::Species::kNspecies, 1, nuclei::names, {"processNucleus"}}, "Nuclei to process"}; + Configurable> cfgEventSelections{"cfgEventSelections", {nuclei::EvSelDefault[0], 8, 1, nuclei::eventSelectionLabels, nuclei::eventSelectionTitle}, "Event selections"}; + Configurable cfgCentralityEstimator{"cfgCentralityEstimator", 0, "Centrality estimator (FV0A: 0, FT0M: 1, FT0A: 2, FT0C: 3)"}; + Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {nuclei::betheBlochDefault[0], nuclei::Species::kNspecies, 6, nuclei::names, nuclei::betheBlochParNames}, "TPC Bethe-Bloch parameterisation for light nuclei"}; + Configurable> cfgUseCentralTpcCalibration{"cfgUseCentralTpcCalibration", {nuclei::useCentralTpcCalibrationDefault[0], nuclei::Species::kNspecies, 1, nuclei::names, {"UseCentralTpcCalibration"}}, "Use central TPC calibration"}; + + Configurable cfgRapidityMin{"cfgRapidityMin", -1., "Minimum rapidity value"}; + Configurable cfgRapidityMax{"cfgRapidityMax", 1., "Maximum rapidity value"}; + Configurable cfgRapidityCenterMass{"cfgRapidityCenterMass", 0.0f, "Center of mass rapidity"}; + + Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; + Configurable cfgCutEta{"cfgCutEta", 0.8f, "Eta range for tracks"}; + Configurable cfgCutTpcMom{"cfgCutTpcMom", 0.2f, "Minimum TPC momentum for tracks"}; + Configurable cfgCutNclusITS{"cfgCutNclusITS", 5, "Minimum number of ITS clusters"}; + Configurable cfgCutNclusTPC{"cfgCutNclusTPC", 70, "Minimum number of TPC clusters"}; + + Configurable> cfgNsigmaTPC{"cfgNsigmaTPC", {nuclei::nSigmaTPCdefault[0], nuclei::Species::kNspecies, 2, nuclei::names, nuclei::nSigmaConfigName}, "TPC nsigma selection for light nuclei"}; + Configurable> cfgNsigmaTOF{"cfgNsigmaTOF", {nuclei::nSigmaTOFdefault[0], nuclei::Species::kNspecies, 2, nuclei::names, nuclei::nSigmaConfigName}, "TPC nsigma selection for light nuclei"}; + + // CCDB options + Configurable cfgMaterialCorrection{"cfgMaterialCorrection", static_cast(o2::base::Propagator::MatCorrType::USEMatCorrLUT), "Type of material correction"}; + Configurable cfgCCDBurl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Service mCcdb; + int mRunNumber = 0; + float mBz = 0.f; + + HistogramRegistry mHistograms{ + "histos", + { + {"hEventSelections", "Event selections; Selection step; Counts", {HistType::kTH1D, {{nuclei::evSel::kNevSels + 1, -0.5f, static_cast(nuclei::evSel::kNevSels) + 0.5f}}}}, + {"hVtxZBefore", "Vertex distribution in Z before selections;Z (cm)", {HistType::kTH1F, {{400, -20.0, 20.0}}}}, + {"hVtxZ", "Vertex distribution in Z;Z (cm)", {HistType::kTH1F, {{400, -20.0, 20.0}}}}, + }, + OutputObjHandlingPolicy::AnalysisObject, + false, + true}; + std::vector mSpeciesToProcess; + Produces mNucleiTableRed; + + std::vector mNucleiCandidates; + std::vector mFilledMcParticleIds; + + o2::dataformats::DCA mDcaInfoCov; + o2::track::TrackParametrizationWithError mTrackParCov; + std::array(nuclei::Species::kNspecies)> mPidManagers; + + void init(o2::framework::InitContext&) + { + + mCcdb->setURL(cfgCCDBurl); + mCcdb->setCaching(true); + mCcdb->setLocalObjectValidityChecking(); + mCcdb->setFatalWhenNull(false); + nuclei::lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(mCcdb->get("GLO/Param/MatLUT")); + + for (int iSel = 0; iSel < nuclei::evSel::kNevSels; iSel++) { + mHistograms.get(HIST("hEventSelections"))->GetXaxis()->SetBinLabel(iSel + 1, nuclei::eventSelectionLabels[iSel].c_str()); + } + + for (int iSpecies = 0; iSpecies < static_cast(nuclei::Species::kNspecies); iSpecies++) { + if (cfgSpeciesToProcess->get(iSpecies) == 1) { + mSpeciesToProcess.emplace_back(iSpecies); + } + } + + static_for<0, nuclei::kNspecies - 1>([&](auto iSpecies) { + constexpr int kSpeciesCt = decltype(iSpecies)::value; + const int kSpeciesRt = kSpeciesCt; + + if (std::find(mSpeciesToProcess.begin(), mSpeciesToProcess.end(), kSpeciesCt) == mSpeciesToProcess.end()) { + return; + } + + float tpcBetheBlochParams[6]; + for (int iParam = 0; iParam < 6; iParam++) { + tpcBetheBlochParams[iParam] = cfgBetheBlochParams->get(kSpeciesRt, iParam); + } + + nuclei::createHistogramRegistryNucleus(mHistograms); + + if (cfgUseCentralTpcCalibration->get(static_cast(kSpeciesRt), static_cast(0)) == 0) { + mPidManagers[kSpeciesRt] = nuclei::PidManager(kSpeciesRt, tpcBetheBlochParams); + } else { + mPidManagers[kSpeciesRt] = nuclei::PidManager(kSpeciesRt); + } + }); + } + + void initCCDB(const aod::BCsWithTimestamps::iterator& bc) + { + if (mRunNumber == bc.runNumber()) { + return; + } + auto timestamp = bc.timestamp(); + mRunNumber = bc.runNumber(); + + o2::parameters::GRPMagField* grpmag = mCcdb->getForTimeStamp("GLO/Config/GRPMagField", timestamp); + o2::base::Propagator::initFieldFromGRP(grpmag); + o2::base::Propagator::Instance()->setMatLUT(nuclei::lut); + mBz = static_cast(grpmag->getNominalL3Field()); + LOGF(info, "Retrieved GRP for timestamp %ull (%i) with magnetic field of %1.2f kZG", timestamp, mRunNumber, mBz); + } + + template + bool trackSelection(const Ttrack& track) + { + if (std::abs(track.eta()) > cfgCutEta || + track.tpcInnerParam() < cfgCutTpcMom || + track.itsNCls() < cfgCutNclusITS || + track.tpcNClsFound() < cfgCutNclusTPC || + track.tpcNClsCrossedRows() < 70 || + track.tpcNClsCrossedRows() < 0.8 * track.tpcNClsFindable() || + track.tpcChi2NCl() > 4.f || + track.itsChi2NCl() > 36.f) { + return false; + } + return true; + } + + template + bool pidSelection(const Ttrack& track, const Tcollision& collision) + { + constexpr int kIndex = iSpecies; + if (!nuclei::checkSpeciesValidity(kIndex)) { + std::runtime_error("species contains invalid nucleus kIndex"); + } + + float centrality = nuclei::getCentrality(collision, cfgCentralityEstimator); + float nsigmaTPC = mPidManagers[kIndex].getNSigmaTPC(track); + mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3NsigmaTPC_preselectionVsCentrality"), track.pt(), nsigmaTPC, centrality); + if (std::abs(nsigmaTPC) > cfgNsigmaTPC->get(kIndex, 1)) + return false; + mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3NsigmaTPCVsCentrality"), track.pt(), nsigmaTPC, centrality); + + float nsigmaITS = mPidManagers[kIndex].getNSigmaITS(track); + mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3NsigmaITS_preselectionVsCentrality"), track.sign() * track.pt(), nsigmaITS, centrality); + // add nsigmaITS cut ? + mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3NsigmaITSVsCentrality"), track.sign() * track.pt(), nsigmaITS, centrality); + + float nsigmaTOF = mPidManagers[kIndex].getNSigmaTOF(track); + mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3NsigmaTOF_preselectionVsCentrality"), track.pt(), nsigmaTOF, centrality); + if (std::abs(nsigmaTOF) > cfgNsigmaTOF->get(kIndex, 1)) + return false; + mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3NsigmaTOFVsCentrality"), track.pt(), nsigmaTOF, centrality); + + return true; + } + + template + void fillNucleusFlagsPdgsMc(const Tparticle& particle, nuclei::SlimCandidate& candidate) + { + candidate.pdgCode = particle.pdgCode(); + + if (particle.isPhysicalPrimary()) { + candidate.flags |= nuclei::Flags::kIsPhysicalPrimary; + + // heavy flavour mother + // if (particle.has_mothers()) { + // for (const auto& motherparticle : particle.mothers_as()) { + // if (std::find(nuclei::hfMothCodes.begin(), nuclei::hfMothCodes.end(), std::abs(motherparticle.pdgCode())) != nuclei::hfMothCodes.end()) { + // flags |= kIsSecondaryFromWeakDecay; + // motherPdgCode = motherparticle.pdgCode(); + // break; + // } + // } + //} + + } else if (particle.has_mothers()) { + candidate.flags |= nuclei::Flags::kIsSecondaryFromWeakDecay; + for (const auto& motherparticle : particle.template mothers_as()) { + candidate.motherPdgCode = motherparticle.pdgCode(); + } + + } else { + candidate.flags |= nuclei::Flags::kIsSecondaryFromMaterial; + } + + mFilledMcParticleIds.emplace_back(particle.globalIndex()); + } + + template + void fillNucleusFlagsPdgs(const int iSpecies, const Tcollision& collision, const Ttrack& track, nuclei::SlimCandidate& candidate) + { + candidate.flags = static_cast((track.pidForTracking() & 0xF) << 12); + candidate.flags |= iSpecies == nuclei::Species::kPr ? nuclei::Flags::kProton : iSpecies == nuclei::Species::kDe ? nuclei::Flags::kDeuteron + : iSpecies == nuclei::Species::kTr ? nuclei::Flags::kTriton + : iSpecies == nuclei::Species::kHe ? nuclei::Flags::kHe3 + : iSpecies == nuclei::Species::kAl ? nuclei::Flags::kHe4 + : 0; + + if (track.hasTOF()) { + candidate.flags |= nuclei::Flags::kHasTOF; + } + if (track.hasTRD()) { + candidate.flags |= nuclei::Flags::kHasTRD; + } + if (!collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + candidate.flags |= nuclei::Flags::kITSrof; + } + } + + template + void fillNucleusGeneratedVariables(const Tparticle& particle, nuclei::SlimCandidate& candidate) + { + candidate.ptGenerated = particle.pt() * (particle.pdgCode() > 0 ? 1.f : -1.f); + candidate.etaGenerated = particle.eta(); + candidate.phiGenerated = particle.phi(); + } + + template + void fillDcaInformation(const Tcollision& collision, const Ttrack& track, nuclei::SlimCandidate& candidate) + { + + const o2::math_utils::Point3D collisionVertex{collision.posX(), collision.posY(), collision.posZ()}; + + mDcaInfoCov.set(999, 999, 999, 999, 999); + setTrackParCov(track, mTrackParCov); + mTrackParCov.setPID(track.pidForTracking()); + std::array dcaInfo; + o2::base::Propagator::Instance()->propagateToDCA(collisionVertex, mTrackParCov, mBz, 2.f, static_cast(cfgMaterialCorrection.value), &dcaInfo); + + candidate.DCAxy = dcaInfo[0]; + candidate.DCAz = dcaInfo[1]; + } + + template + nuclei::SlimCandidate fillCandidate(const int iSpecies, Tcollision const& collision, Ttrack const& track) + { + if (!nuclei::checkSpeciesValidity(iSpecies)) { + std::runtime_error("species contains invalid nucleus index"); + } + nuclei::SlimCandidate candidate = {.pt = track.pt() * track.sign(), + .eta = track.eta(), + .phi = track.phi(), + .tpcInnerParam = track.tpcInnerParam(), + .clusterSizesITS = track.itsClusterSizes(), + .TPCsignal = track.tpcSignal(), + .beta = mPidManagers[iSpecies].getBetaTOF(track), + .DCAxy = 0.f, + .DCAz = 0.f, + .flags = 0, + .pdgCode = 0, + .motherPdgCode = 0, + .ptGenerated = 0.f, // to be filled for mc + .etaGenerated = 0.f, + .phiGenerated = 0.f, + .centrality = nuclei::getCentrality(collision, cfgCentralityEstimator)}; + + fillDcaInformation(collision, track, candidate); + fillNucleusFlagsPdgs(iSpecies, collision, track, candidate); + + if constexpr (isMc) { + if (track.has_mcParticle()) { + + const auto& particle = track.mcParticle(); + fillNucleusFlagsPdgsMc(particle, candidate); + fillNucleusGeneratedVariables(particle, candidate); + } + } + + mNucleiCandidates.emplace_back(candidate); + return candidate; + } + + template + void dispatchFillHistograms(const int iSpecies, const nuclei::SlimCandidate& candidate) + { + switch (iSpecies) { + case nuclei::Species::kPr: + return fillHistograms(candidate); + case nuclei::Species::kDe: + return fillHistograms(candidate); + case nuclei::Species::kTr: + return fillHistograms(candidate); + case nuclei::Species::kHe: + return fillHistograms(candidate); + case nuclei::Species::kAl: + return fillHistograms(candidate); + default: + return; + } + } + + template + void fillHistograms(const nuclei::SlimCandidate& candidate) + { + constexpr int kIndex = iSpecies; + if (!nuclei::checkSpeciesValidity(kIndex)) { + std::runtime_error("species contains invalid nucleus kIndex"); + } + + if (isGenerated) { + const float ptGenerated = (kIndex == nuclei::Species::kPr || kIndex == nuclei::Species::kDe || kIndex == nuclei::Species::kTr) ? candidate.ptGenerated : candidate.ptGenerated / 2.f; + mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/hPtGenerated"), ptGenerated); + mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3PtVsEtaVsCentralityGenerated"), ptGenerated, candidate.etaGenerated, candidate.centrality); + mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3PhiVsEtaVsCentralityGenerated"), candidate.phiGenerated, candidate.etaGenerated, candidate.centrality); + } else { + mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/hPtReconstructed"), candidate.pt); + mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3PtVsEtaVsCentralityReconstructed"), candidate.pt, candidate.eta, candidate.centrality); + mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3PhiVsEtaVsCentralityReconstructed"), candidate.phi, candidate.eta, candidate.centrality); + mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3DCAxyVsPtVsCentrality"), candidate.DCAxy, candidate.pt, candidate.centrality); + mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3DCAzVsPtVsCentrality"), candidate.DCAz, candidate.pt, candidate.centrality); + mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3BetaVsPtVsCentrality"), candidate.beta, candidate.pt, candidate.centrality); + mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3dEdxVsPVsCentrality"), candidate.TPCsignal, candidate.pt, candidate.centrality); + mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3ClusterSizeVsPtVsCentrality"), mPidManagers[kIndex].getClusterSizeCosLambdaITS(candidate.clusterSizesITS, candidate.eta), candidate.pt, candidate.centrality); + } + } + + void processMc(const Collision& collision, const TrackCandidatesMC& tracks, const aod::BCsWithTimestamps&, const aod::McParticles& mcParticles) + { + mNucleiCandidates.clear(); + mFilledMcParticleIds.clear(); + + auto bc = collision.template bc_as(); + initCCDB(bc); + + if (!nuclei::eventSelection(collision, mHistograms, cfgEventSelections, cfgCutVertex)) { + return; + } + + for (const auto& track : tracks) { + + static_for<0, nuclei::kNspecies - 1>([&](auto iSpecies) { + constexpr int kSpeciesCt = decltype(iSpecies)::value; + const int kSpeciesRt = kSpeciesCt; + + if (std::find(mSpeciesToProcess.begin(), mSpeciesToProcess.end(), kSpeciesRt) == mSpeciesToProcess.end()) { + return; + } + + if (track.has_mcParticle()) { + const auto& particle = track.mcParticle(); + if (cfgDoCheckPdgCode) { + if (particle.pdgCode() != nuclei::pdgCodes[kSpeciesRt]) + return; + } + if (particle.y() - cfgRapidityCenterMass < cfgRapidityMin || particle.y() - cfgRapidityCenterMass > cfgRapidityMax) { + return; + } + } + + mHistograms.fill(HIST(nuclei::cNames[kSpeciesCt]) + HIST("/hTrackSelections"), nuclei::trackSelection::kNoCuts); + if (!trackSelection(track)) + return; + mHistograms.fill(HIST(nuclei::cNames[kSpeciesCt]) + HIST("/hTrackSelections"), nuclei::trackSelection::kTrackCuts); + + if (!pidSelection(track, collision)) + return; + mHistograms.fill(HIST(nuclei::cNames[kSpeciesCt]) + HIST("/hTrackSelections"), nuclei::trackSelection::kPidCuts); + + nuclei::SlimCandidate candidate; + if (track.has_mcParticle()) { + candidate = fillCandidate(kSpeciesCt, collision, track); + dispatchFillHistograms(kSpeciesRt, candidate); + } else { + candidate = fillCandidate(kSpeciesCt, collision, track); + } + + dispatchFillHistograms(kSpeciesRt, candidate); + }); + } + + const int mcCollisionId = collision.mcCollisionId(); + auto mcParticlesThisCollision = mcParticles.sliceBy(mMcParticlesPerCollision, mcCollisionId); + mcParticlesThisCollision.bindExternalIndices(&mcParticles); + for (const auto& particle : mcParticlesThisCollision) { + if (std::find(mFilledMcParticleIds.begin(), mFilledMcParticleIds.end(), particle.globalIndex()) != mFilledMcParticleIds.end()) { + continue; + } + int iSpecies = nuclei::getSpeciesFromPdg(particle.pdgCode()); + if (std::find(mSpeciesToProcess.begin(), mSpeciesToProcess.end(), iSpecies) == mSpeciesToProcess.end()) { + continue; + } + + nuclei::SlimCandidate candidate; + fillNucleusFlagsPdgsMc(particle, candidate); + fillNucleusGeneratedVariables(particle, candidate); + mNucleiCandidates.emplace_back(candidate); + + dispatchFillHistograms(iSpecies, candidate); + } + + if (!cfgFillTable) + return; + + for (const auto& candidate : mNucleiCandidates) { + mNucleiTableRed( + candidate.pt, + candidate.eta, + candidate.phi, + candidate.tpcInnerParam, + candidate.clusterSizesITS, + candidate.TPCsignal, + candidate.beta, + candidate.DCAxy, + candidate.DCAz, + candidate.flags, + candidate.pdgCode, + candidate.motherPdgCode); + } + } + PROCESS_SWITCH(nucleiQC, processMc, "Mc analysis", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/Utils/nucleiUtils.h b/PWGLF/Utils/nucleiUtils.h new file mode 100644 index 00000000000..967f017cbe7 --- /dev/null +++ b/PWGLF/Utils/nucleiUtils.h @@ -0,0 +1,565 @@ +// 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. + +#ifndef PWGLF_UTILS_NUCLEIUTILS_H_ +#define PWGLF_UTILS_NUCLEIUTILS_H_ + +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseITS.h" +#include "Common/TableProducer/PID/pidTOFBase.h" + +#include "DataFormatsTPC/BetheBlochAleph.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/HistogramSpec.h" + +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::constants::physics; + +struct NucleusCandidate { + int globalIndex; + int collTrackIndex; + float pt; + float eta; + float phi; + float tpcInnerParam; + float beta; + float zVertex; + int nContrib; + float DCAxy; + float DCAz; + float TPCsignal; + float ITSchi2; + float TPCchi2; + float TOFchi2; + std::array nSigmaTPC; + std::array tofMasses; + bool fillTree; + bool fillDCAHist; + bool correctPV; + bool isSecondary; + bool fromWeakDecay; + uint16_t flags; + uint8_t TPCfindableCls; + uint8_t TPCcrossedRows; + uint8_t ITSclsMap; + uint8_t TPCnCls; + uint8_t TPCnClsShared; + uint8_t ITSnCls; + uint32_t clusterSizesITS; +}; + +struct NucleusCandidateFlow { + float centFV0A; + float centFT0M; + float centFT0A; + float centFT0C; + float psiFT0A; + float psiFT0C; + float psiTPC; + float psiTPCl; + float psiTPCr; + float qFT0A; + float qFT0C; + float qTPC; + float qTPCl; + float qTPCr; +}; + +namespace nuclei +{ + +struct SlimCandidate { + float pt = -999.f; + float eta = -999.f; + float phi = -999.f; + float tpcInnerParam = -999.f; + uint32_t clusterSizesITS = 0.f; + float TPCsignal = -999.f; + float beta = -999.f; + float DCAxy = -999.f; + float DCAz = -999.f; + uint16_t flags = 0; + int pdgCode = 0; + int motherPdgCode = 0; + float ptGenerated = -999.f; + float etaGenerated = -999.f; + float phiGenerated = -999.f; + float centrality = -1.f; +}; + +enum Species { + kPr = 0, + kDe = 1, + kTr = 2, + kHe = 3, + kAl = 4, + kNspecies = 5 +}; + +enum Flags { + kProton = BIT(0), + kDeuteron = BIT(1), + kTriton = BIT(2), + kHe3 = BIT(3), + kHe4 = BIT(4), + kHasTOF = BIT(5), + kHasTRD = BIT(6), + kIsAmbiguous = BIT(7), /// just a placeholder now + kITSrof = BIT(8), + kIsPhysicalPrimary = BIT(9), /// MC flags starting from the second half of the short + kIsSecondaryFromMaterial = BIT(10), + kIsSecondaryFromWeakDecay = BIT(11) /// the last 4 bits are reserved for the PID in tracking +}; + +constexpr int getSpeciesFromPdg(int pdg) +{ + switch (std::abs(pdg)) { + case PDG_t::kProton: + return Species::kPr; + case o2::constants::physics::Pdg::kDeuteron: + return Species::kDe; + case o2::constants::physics::Pdg::kTriton: + return Species::kTr; + case o2::constants::physics::Pdg::kHelium3: + return Species::kHe; + case o2::constants::physics::Pdg::kAlpha: + return Species::kAl; + default: + return -1; + } +} + +bool checkSpeciesValidity(const int species) +{ + if (species < 0 || species > Species::kNspecies) { + return false; + } + return true; +} + +constexpr int speciesToProcessDefault[Species::kNspecies][1]{ + {0}, + {0}, + {0}, + {0}, + {0}}; +constexpr int useCentralTpcCalibrationDefault[Species::kNspecies][1]{ + {1}, + {1}, + {1}, + {1}, + {1}}; +constexpr double bbMomScalingDefault[Species::kNspecies][2]{ + {1., 1.}, + {1., 1.}, + {1., 1.}, + {1., 1.}, + {1., 1.}}; +constexpr double betheBlochDefault[Species::kNspecies][6]{ + {-136.71, 0.441, 0.2269, 1.347, 0.8035, 0.09}, + {-136.71, 0.441, 0.2269, 1.347, 0.8035, 0.09}, + {-239.99, 1.155, 1.099, 1.137, 1.006, 0.09}, + {-321.34, 0.6539, 1.591, 0.8225, 2.363, 0.09}, + {-586.66, 1.859, 4.435, 0.282, 3.201, 0.09}}; +constexpr double nSigmaTPCdefault[Species::kNspecies][2]{ + {-5., 5.}, + {-5., 5.}, + {-5., 5.}, + {-5., 5.}, + {-5., 5.}}; +constexpr double nSigmaTOFdefault[Species::kNspecies][2]{ + {-5., 5.}, + {-5., 5.}, + {-5., 5.}, + {-5., 5.}, + {-5., 5.}}; +constexpr double DCAcutDefault[Species::kNspecies][2]{ + {1., 1.}, + {1., 1.}, + {1., 1.}, + {1., 1.}, + {1., 1.}}; +constexpr int TreeConfigDefault[Species::kNspecies][2]{ + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}}; +constexpr int FlowHistDefault[Species::kNspecies][1]{ + {0}, + {0}, + {0}, + {0}, + {0}}; +constexpr int DCAHistDefault[Species::kNspecies][2]{ + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}}; +constexpr double DownscalingDefault[Species::kNspecies][1]{ + {1.}, + {1.}, + {1.}, + {1.}, + {1.}}; +// constexpr bool storeTreesDefault[Species::kNspecies]{false, false, false, false, false}; +constexpr float charges[Species::kNspecies]{1.f, 1.f, 1.f, 2.f, 2.f}; +constexpr float masses[Species::kNspecies]{MassProton, MassDeuteron, MassTriton, MassHelium3, MassAlpha}; +constexpr int pdgCodes[Species::kNspecies]{PDG_t::kProton, o2::constants::physics::Pdg::kDeuteron, o2::constants::physics::Pdg::kTriton, o2::constants::physics::Pdg::kHelium3, o2::constants::physics::Pdg::kAlpha}; +static constexpr std::string_view cNames[] = {"proton", "deuteron", "triton", "He3", "alpha"}; +static const std::vector names{"proton", "deuteron", "triton", "He3", "alpha"}; +static const std::vector matter{"M", "A"}; +static const std::vector pidName{"TPC", "TOF"}; +static const std::vector treeConfigNames{"Filter trees", "Use TOF selection"}; +static const std::vector flowConfigNames{"Save flow hists"}; +static const std::vector DCAConfigNames{"Save DCA hist", "Matter/Antimatter"}; +static const std::vector nSigmaConfigName{"nsigma_min", "nsigma_max"}; +static const std::vector nDCAConfigName{"max DCAxy", "max DCAz"}; +static const std::vector DownscalingConfigName{"Fraction of kept candidates"}; +static const std::vector betheBlochParNames{"p0", "p1", "p2", "p3", "p4", "resolution"}; +static const std::vector chargeLabelNames{"Positive", "Negative"}; + +float pidCutTPC[Species::kNspecies][2]; //[species][lower/upper limit] + +o2::base::MatLayerCylSet* lut = nullptr; + +std::vector candidates; +std::vector candidates_flow; + +enum centDetectors { + kFV0A = 0, + kFT0M = 1, + kFT0A = 2, + kFT0C = 3 +}; + +static const std::vector centDetectorNames{"FV0A", "FT0M", "FT0A", "FT0C"}; + +// Event selections + +enum evSel { + kTVX = 0, + kZvtx, + kTFborder, + kITSROFborder, + kNoSameBunchPileup, + kIsGoodZvtxFT0vsPV, + kIsGoodITSLayersAll, + kIsEPtriggered, + kNevSels +}; + +static const std::vector eventSelectionTitle{"Event selections"}; +static const std::vector eventSelectionLabels{"TVX", "Z vtx", "TF border", "ITS ROF border", "No same-bunch pile-up", "kIsGoodZvtxFT0vsPV", "isGoodITSLayersAll", "isEPtriggered"}; + +constexpr int EvSelDefault[8][1]{ + {1}, + {1}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}}; + +template // move to nucleiUtils +bool eventSelection(const Tcollision& collision, HistogramRegistry& registry, LabeledArray eventSelections, const float cutVertex) +{ + if (!registry.contains(HIST("hVtxZBefore"))) { + registry.add("hVtxZBefore", "Vertex distribution in Z before selections;Z (cm)", {HistType::kTH1F, {{400, -20.0, 20.0}}}); + } + if (!registry.contains(HIST("hVtxZ"))) { + registry.add("hVtxZ", "Vertex distribution in Z;Z (cm)", {HistType::kTH1F, {{400, -20.0, 20.0}}}); + } + if (!registry.contains(HIST("hEventSelections"))) { + registry.add("hEventSelections", "hEventSelections", {HistType::kTH1D, {{evSel::kNevSels + 1, -0.5f, static_cast(evSel::kNevSels) + 0.5f}}}); + } + registry.fill(HIST("hEventSelections"), 0); + registry.fill(HIST("hVtxZBefore"), collision.posZ()); + + if (eventSelections.get(evSel::kTVX) && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { + return false; + } + registry.fill(HIST("hEventSelections"), evSel::kTVX + 1); + + if (eventSelections.get(evSel::kZvtx) && std::abs(collision.posZ()) > cutVertex) { + return false; + } + registry.fill(HIST("hEventSelections"), evSel::kZvtx + 1); + + if (eventSelections.get(evSel::kTFborder) && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + return false; + } + registry.fill(HIST("hEventSelections"), evSel::kTFborder + 1); + + if (eventSelections.get(evSel::kITSROFborder) && !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + return false; + } + registry.fill(HIST("hEventSelections"), evSel::kITSROFborder + 1); + + if (eventSelections.get(evSel::kNoSameBunchPileup) && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { + return false; + } + registry.fill(HIST("hEventSelections"), evSel::kNoSameBunchPileup + 1); + + if (eventSelections.get(evSel::kIsGoodZvtxFT0vsPV) && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + return false; + } + registry.fill(HIST("hEventSelections"), evSel::kIsGoodZvtxFT0vsPV + 1); + + if (eventSelections.get(evSel::kIsGoodITSLayersAll) && !collision.selection_bit(aod::evsel::kIsGoodITSLayersAll)) { + return false; + } + registry.fill(HIST("hEventSelections"), evSel::kIsGoodITSLayersAll + 1); + + if constexpr ( + requires { + collision.triggereventep(); + }) { + if (eventSelections.get(evSel::kIsEPtriggered) && !collision.triggereventep()) { + return false; + } + registry.fill(HIST("hEventSelections"), evSel::kIsEPtriggered + 1); + } + registry.fill(HIST("hVtxZ"), collision.posZ()); + + return true; +} + +template +float getCentrality(Tcollision const& collision, const int centralityEstimator) +{ + if constexpr (o2::aod::HasCentrality) { + if (centralityEstimator == centDetectors::kFV0A) { + return collision.centFV0A(); + } else if (centralityEstimator == centDetectors::kFT0M) { + return collision.centFT0M(); + } else if (centralityEstimator == centDetectors::kFT0A) { + return collision.centFT0A(); + } else if (centralityEstimator == centDetectors::kFT0C) { + return collision.centFT0C(); + } else { + LOG(warning) << "Centrality estimator not valid. Possible values: (FV0A: 0, FT0M: 1, FT0A: 2, FT0C: 3). Centrality set to -1."; + } + } + return -1.f; +} + +// Track selections + +enum trackSelection { + kNoCuts = 0, + kTrackCuts = 1, + kPidCuts = 2, + kNtrackSelections = 3 +}; +static const std::array(trackSelection::kNtrackSelections)> trackSelectionLabels{"All", "Track cuts", "PID cuts"}; + +template +void createHistogramRegistryNucleus(HistogramRegistry& registry) +{ + + constexpr int index = iSpecies; + if (!checkSpeciesValidity(index)) { + std::runtime_error("species contains invalid nucleus index"); + } + + registry.add(fmt::format("{}/hTrackSelections", cNames[index]).c_str(), (fmt::format("{} track selections;", cNames[index]) + std::string("Selection step; Counts")).c_str(), HistType::kTH1D, {{trackSelection::kNtrackSelections, -0.5f, static_cast(trackSelection::kNtrackSelections) - 0.5f}}); + registry.add(fmt::format("{}/hPtReconstructed", cNames[index]).c_str(), (fmt::format("{} - reconstructed variables;", cNames[index]) + std::string("#it{p}_{T} / |#it{Z}| (GeV/#it{c}); Counts")).c_str(), HistType::kTH1F, {{240, -6.0f, 6.0f}}); + registry.add(fmt::format("{}/h3PtVsEtaVsCentralityReconstructed", cNames[index]).c_str(), (fmt::format("{} - reconstructed variables;", cNames[index]) + std::string("#it{p}_{T} / |#it{Z}| (GeV/#it{c}); #eta; CentralityFT0C (%)")).c_str(), HistType::kTH3F, {{240, -6.0f, 6.0f}, {40, -1.0f, 1.f}, {20, 0.0f, 100.0f}}); + registry.add(fmt::format("{}/h3PhiVsEtaVsCentralityReconstructed", cNames[index]).c_str(), (fmt::format("{} - reconstructed variables;", cNames[index]) + std::string("#phi (radians); #eta; CentralityFT0C (%)")).c_str(), HistType::kTH3F, {{240, -6.0f, 6.0f}, {40, 0.0f, o2::constants::math::TwoPI}, {20, 0.0f, 100.0f}}); + registry.add(fmt::format("{}/h3DCAxyVsPtVsCentrality", cNames[index]).c_str(), (fmt::format(";", cNames[index]) + std::string("#it{p}_{T} / |#it{Z}| (GeV/#it{c}); DCA_{xy} (cm); CentralityFT0C (%)")).c_str(), HistType::kTH3F, {{240, -6.0f, 6.0f}, {200, -5.0f, 5.0f}, {20, 0.0f, 100.0f}}); + registry.add(fmt::format("{}/h3DCAzVsPtVsCentrality", cNames[index]).c_str(), (fmt::format("{};", cNames[index]) + std::string("#it{p}_{T} / |#it{Z}| (GeV/#it{c}); DCA_{z} (cm); CentralityFT0C (%)")).c_str(), HistType::kTH3F, {{240, -6.0f, 6.0f}, {200, -5.0f, 5.0f}, {20, 0.0f, 100.0f}}); + registry.add(fmt::format("{}/h3NsigmaTPC_preselectionVsCentrality", cNames[index]).c_str(), (fmt::format("Nsigma{} TPC distribution;", cNames[index]) + std::string("#it{p}_{T} / |#it{Z}| (GeV/#it{c});") + fmt::format("n#sigma_{{TPC}}({}); CentralityFT0C (%)", cNames[index])).c_str(), HistType::kTH3F, {{100, -5.0f, 5.0f}, {400, -10.0f, 10.0f}, {20, 0.0f, 100.0f}}); + registry.add(fmt::format("{}/h3NsigmaTPCVsCentrality", cNames[index]).c_str(), (fmt::format("Nsigma{} TPC distribution;", cNames[index]) + std::string("#it{p}_{T} / |#it{Z}| (GeV/#it{c});") + fmt::format("n#sigma_{{TPC}}({}); Centrality FT0C (%)", cNames[index])).c_str(), HistType::kTH3F, {{20, -5.0f, 5.0f}, {200, -5.0f, 5.0f}, {20, 0.0f, 100.0f}}); + registry.add(fmt::format("{}/h3NsigmaITS_preselectionVsCentrality", cNames[index]).c_str(), (fmt::format("Nsigma{} ITS distribution;", cNames[index]) + std::string("signed #it{p}_{T} / |#it{Z}| (GeV/#it{c});") + fmt::format("n#sigma_{{ITS}}({}); Centrality FT0C (%)", cNames[index])).c_str(), HistType::kTH3F, {{50, -5.0f, 5.0f}, {120, -3.0f, 3.0f}, {20, 0.0f, 100.0f}}); + registry.add(fmt::format("{}/h3NsigmaITSVsCentrality", cNames[index]).c_str(), (fmt::format("Nsigma{} ITS distribution;", cNames[index]) + std::string("signed #it{p}_{T} / |#it{Z}| (GeV/#it{c});") + fmt::format("n#sigma_{{ITS}}({}); Centrality FT0C (%)", cNames[index])).c_str(), HistType::kTH3F, {{50, -5.0f, 5.0f}, {120, -3.0f, 3.0f}, {20, 0.0f, 100.0f}}); + registry.add(fmt::format("{}/h3NsigmaTOF_preselectionVsCentrality", cNames[index]).c_str(), (fmt::format("Nsigma{} TOF distribution;", cNames[index]) + std::string("#it{p}_{T} / |#it{Z}| (GeV/#it{c});") + fmt::format("n#sigma_{{TOF}}({}); Centrality FT0C (%)", cNames[index])).c_str(), HistType::kTH3F, {{100, -5.0f, 5.0f}, {400, -10.0f, 10.0f}, {20, 0.0f, 100.0f}}); + registry.add(fmt::format("{}/h3NsigmaTOFVsCentrality", cNames[index]).c_str(), (fmt::format("Nsigma{} TOF distribution;", cNames[index]) + std::string("#it{p}_{T} / |#it{Z}| (GeV/#it{c});") + fmt::format("n#sigma_{{TOF}}({}); Centrality FT0C (%)", cNames[index], cNames[index])).c_str(), HistType::kTH3F, {{20, -5.0f, 5.0f}, {200, -5.0f, 5.0f}, {20, 0.0f, 100.0f}}); + registry.add(fmt::format("{}/h3BetaVsPtVsCentrality", cNames[index]).c_str(), (fmt::format("{};", cNames[index]) + std::string("#it{p}_{T} / |#it{Z}| (GeV/#it{c}); #beta; CentralityFT0C (%)")).c_str(), HistType::kTH3F, {{240, -6.0f, 6.0f}, {100, 0.0f, 1.0f}, {20, 0.0f, 100.0f}}); + registry.add(fmt::format("{}/h3dEdxVsPVsCentrality", cNames[index]).c_str(), (fmt::format("dEdx distribution for {};", cNames[index]) + std::string("#it{p} (GeV/#it{c}); d#it{E}/d#it{x} (a.u.); Centrality FT0C (%)")).c_str(), HistType::kTH3F, {{200, -6.0f, 6.0f}, {100, 0.0f, 2000.0f}, {20, 0.0f, 100.0f}}); + registry.add(fmt::format("{}/h3ClusterSizeVsPtVsCentrality", cNames[index]).c_str(), (fmt::format("{};", cNames[index]) + std::string("#it{p}_{T} / |#it{Z}| (GeV/#it{c}); Cluster size ITS; CentralityFT0C (%)")).c_str(), HistType::kTH3F, {{240, -6.0f, 6.0f}, {90, 0.f, 15.f}, {20, 0.0f, 100.0f}}); + registry.add(fmt::format("{}/hPtGenerated", cNames[index]).c_str(), (fmt::format("{} - generated variables;", cNames[index]) + std::string("#it{p}_{T} / |#it{Z}| (GeV/#it{c}); Counts")).c_str(), HistType::kTH1F, {{240, -6.0f, 6.0f}}); + registry.add(fmt::format("{}/h3PtVsEtaVsCentralityGenerated", cNames[index]).c_str(), (fmt::format("{} - generated variables;", cNames[index]) + std::string("#it{p}_{T} / |#it{Z}| (GeV/#it{c}); #eta; CentralityFT0C (%)")).c_str(), HistType::kTH3F, {{240, -6.0f, 6.0f}, {40, -1.0f, 1.f}, {20, 0.0f, 100.0f}}); + registry.add(fmt::format("{}/h3PhiVsEtaVsCentralityGenerated", cNames[index]).c_str(), (fmt::format("{} - generated variables;", cNames[index]) + std::string("#phi (radians); #eta; CentralityFT0C (%)")).c_str(), HistType::kTH3F, {{240, -6.0f, 6.0f}, {40, 0.0f, o2::constants::math::TwoPI}, {20, 0.0f, 100.0f}}); + + for (size_t iSel = 0; iSel < trackSelection::kNtrackSelections; iSel++) { + registry.get(HIST(cNames[index]) + HIST("/hTrackSelections"))->GetXaxis()->SetBinLabel(iSel + 1, trackSelectionLabels[iSel].c_str()); + } +}; + +// PID manager class + +class PidManager +{ + + public: + explicit PidManager(const int species, const float* tpcBetheBlochParams = nullptr) + : mSpecies(species) + { + if (!checkSpeciesValidity(species)) { + std::runtime_error("species contains invalid nucleus index"); + } + + if (!tpcBetheBlochParams) { + mUseTpcCentralCalibration = true; + return; + } + + for (int i = 0; i < 6; i++) { + mTpcBetheBlochParams[i] = tpcBetheBlochParams[i]; + } + } + PidManager() = default; + ~PidManager() = default; + + // TOF + template + float getBetaTOF(const Ttrack& track) + { + if (!track.hasTOF()) + return -999.f; + float beta = o2::pid::tof::Beta::GetBeta(track); + return std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked + } + + template + float getMassTOF(const Ttrack& track) + { + if (!track.hasTOF()) + return -999.f; + const float charge{1.f + static_cast(mSpecies == Species::kHe || mSpecies == Species::kAl)}; + const float beta = getBetaTOF(track); + return track.tpcInnerParam() * charge * std::sqrt(1.f / (beta * beta) - 1.f); + } + + template + float getNSigmaTOF(const Ttrack& track) + { + if (!track.hasTOF()) + return -999.f; + + switch (mSpecies) { + case Species::kPr: + return track.tofNSigmaPr(); + case Species::kDe: + return track.tofNSigmaDe(); + case Species::kTr: + return track.tofNSigmaTr(); + case Species::kHe: + return track.tofNSigmaHe(); + case Species::kAl: + return track.tofNSigmaAl(); + default: + return -999.f; + } + } + + template + float getClusterSizeCosLambdaITS(const Ttrack& track) + { + return mResponseITS.averageClusterSize(track.itsClusterSizes()) / std::cosh(track.eta()); + } + + float getClusterSizeCosLambdaITS(const u_int32_t clusterSizesITS, const float eta) + { + return mResponseITS.averageClusterSize(clusterSizesITS) / std::cosh(eta); + } + + template + float getNSigmaITS(const Ttrack& track) + { + switch (mSpecies) { + case Species::kPr: + return mResponseITS.nSigmaITS(track.itsClusterSizes(), track.p(), track.eta()); + case Species::kDe: + return mResponseITS.nSigmaITS(track.itsClusterSizes(), track.p(), track.eta()); + case Species::kTr: + return mResponseITS.nSigmaITS(track.itsClusterSizes(), track.p(), track.eta()); + case Species::kHe: + return mResponseITS.nSigmaITS(track.itsClusterSizes(), 2. * track.p(), track.eta()); + case Species::kAl: + return mResponseITS.nSigmaITS(track.itsClusterSizes(), 2. * track.p(), track.eta()); + default: + return -999.f; + } + } + + // TPC + float getExpectedTPCsignal(const float p) + { + if (!mUseTpcCentralCalibration) + return -999.f; + + float pScaled = p * mMomScaling[0] + mMomScaling[1]; + float betaGamma = pScaled / masses[mSpecies]; + return tpc::BetheBlochAleph(betaGamma, + mTpcBetheBlochParams[0], + mTpcBetheBlochParams[1], + mTpcBetheBlochParams[2], + mTpcBetheBlochParams[3], + mTpcBetheBlochParams[4]); + } + + template + float getNSigmaTPC(const Ttrack& track) + { + if (!mUseTpcCentralCalibration) { + return getNSigmaTPCcentral(track); + } + float expectedSignal = getExpectedTPCsignal(track.tpcInnerParam()); + float resolution = mTpcBetheBlochParams[5]; + return (track.tpcSignal() - expectedSignal) / (expectedSignal * resolution); + } + + protected: + // TPC + template + float getNSigmaTPCcentral(const Ttrack& track) + { + switch (mSpecies) { + case Species::kPr: + return track.tpcNSigmaPr(); + case Species::kDe: + return track.tpcNSigmaDe(); + case Species::kTr: + return track.tpcNSigmaTr(); + case Species::kHe: + return track.tpcNSigmaHe(); + case Species::kAl: + return track.tpcNSigmaAl(); + default: + return -999.f; + } + } + + private: + float mTpcBetheBlochParams[6]; + bool mUseTpcCentralCalibration = true; // this just becomes a check for the null pointer in the parameters + o2::aod::ITSResponse mResponseITS; + float mMomScaling[2]{1., 0.}; + int mSpecies; +}; + +} // namespace nuclei + +#endif // PWGLF_UTILS_NUCLEIUTILS_H_ From 5e6c4cf10113373ce1ac74ea9e9125eb04dda3c2 Mon Sep 17 00:00:00 2001 From: Paola Vargas Torres <88360333+PaolaVT@users.noreply.github.com> Date: Sun, 5 Oct 2025 07:02:29 -0600 Subject: [PATCH 629/986] [PWGLF] Add centrality classes and update V0 selection cuts (#13230) Co-authored-by: Paola Vargas Torres --- PWGLF/Tasks/Nuspex/dedxPidAnalysis.cxx | 840 ++++++++++++++++--------- 1 file changed, 537 insertions(+), 303 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/dedxPidAnalysis.cxx b/PWGLF/Tasks/Nuspex/dedxPidAnalysis.cxx index 86d9030e6ff..de4be8cf34b 100644 --- a/PWGLF/Tasks/Nuspex/dedxPidAnalysis.cxx +++ b/PWGLF/Tasks/Nuspex/dedxPidAnalysis.cxx @@ -20,6 +20,7 @@ #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectionDefaults.h" #include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" @@ -31,6 +32,7 @@ #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" #include "Framework/Logger.h" #include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/Track.h" @@ -46,9 +48,13 @@ using PIDTracks = soa::Join< aod::Tracks, aod::TracksExtra, aod::TrackSelectionExtension, aod::TracksDCA, aod::TrackSelection, aod::pidTOFFullPi, aod::pidTOFFullPr, aod::pidTOFFullEl, aod::pidTOFbeta, aod::pidTPCPi, aod::pidTPCPr, aod::pidTPCEl>; -using SelectedCollisions = soa::Join; +using SelectedCollisions = soa::Join; using BCsRun3 = soa::Join; +static constexpr int kNCentHists{10}; +std::array, kNCentHists> hDedxVsMomentumVsCentPos{}; +std::array, kNCentHists> hDedxVsMomentumVsCentNeg{}; + struct DedxPidAnalysis { // dE/dx for all charged particles @@ -61,17 +67,27 @@ struct DedxPidAnalysis { // Constant values static constexpr int kEtaIntervals = 8; static constexpr int kParticlesType = 4; + static constexpr int kCentralityClasses = 10; float tpcCut = 0.6; float pionMin = 0.35; float pionMax = 0.45; float elTofCut = 0.1; float pionTofCut = 1.0; - float invMassCut = 0.01; - float invMassCutGamma = 0.0015; float pTcut = 2.0; - int v0TPC = 1; - int v0TOF = 2; - int v0TPCTOF = 3; + + bool fillHist = false; + + enum V0SelectionMode { + V0TPC = 1, + V0TOF = 2, + V0TPCTOF = 3 + + }; + + enum MomentumMode { + TpcInnerParam = 1, + TotalMomentum = 2 + }; // Event cut labels enum EvCutLabel { @@ -88,37 +104,43 @@ struct DedxPidAnalysis { AllPri = 1, SelectionPrim, PhiVarCutPri, - NTPCClCutPri, - NITSClCutPri + NClTPCFoundCutPri, + NClTPCPIDCutPri }; // Track secondary lebel enum TrkSecCutLabel { AllSec = 1, + V0Type, V0CosPA, V0DecayRadius, V0Daughters, TPCRefit, PhiVarCutSec, - NTPCClCutSec, - NITSClCutSec, + NClTPCFoundCutSec, + NClTPCPIDCutSec, AllK0s, V0RapidityK0s, V0ProperLifetimeK0s, + MassCutK0s, AllLambda, V0RapidityLambda, V0ProperLifetimeLambda, + MassCutLambda, AllAntiLambda, V0RapidityAntiLambda, V0ProperLifetimeAntiLambda, - AllGamma + MassCutAntiLambda, + AllGamma, + V0RapidityGamma, + MassCutGamma }; // Configurable Parameters // Tracks cuts - Configurable minTPCnClsFound{"minTPCnClsFound", 135.0f, + Configurable minTPCnClsFound{"minTPCnClsFound", 70.0f, "min number of found TPC clusters"}; - Configurable minITSnCls{"minITSnCls", 0.0f, - "min number of ITS clusters"}; + Configurable minTPCnClsPID{"minTPCnClsPID", 70.0f, + "min number of PID TPC clusters"}; Configurable minNCrossedRowsTPC{"minNCrossedRowsTPC", 70.0f, "min number of found TPC crossed rows"}; Configurable maxChi2TPC{"maxChi2TPC", 4.0f, "max chi2 per cluster TPC"}; @@ -142,35 +164,37 @@ struct DedxPidAnalysis { Configurable v0ProperLifetimeCutK0s{"v0ProperLifetimeCutK0s", 20.f, "V0 proper lifetime cut for K0s"}; Configurable v0ProperLifetimeCutLambda{"v0ProperLifetimeCutLambda", 30.f, "V0 proper lifetime cut for Lambda"}; Configurable nsigmaTOFmax{"nsigmaTOFmax", 3.0f, "Maximum nsigma TOF"}; - Configurable minMassK0s{"minMassK0s", 0.4f, "Minimum Mass K0s"}; - Configurable maxMassK0s{"maxMassK0s", 0.6f, "Maximum Mass K0s"}; - Configurable minMassLambda{"minMassLambda", 1.1f, - "Minimum Mass Lambda"}; - Configurable maxMassLambda{"maxMassLambda", 1.2f, - "Maximum Mass Lambda"}; - Configurable minMassGamma{"minMassGamma", 0.000922f, - "Minimum Mass Gamma"}; - Configurable maxMassGamma{"maxMassGamma", 0.002022f, - "Maximum Mass Gamma"}; + Configurable invMassCutK0s{"invMassCutK0s", 0.2f, "invariant Mass Cut for K0s"}; + Configurable invMassCutLambda{"invMassCutLambda", 0.1f, "invariant Mass Cut for Lambda"}; + Configurable invMassCutGamma{"invMassCutGamma", 0.1f, "invariant Mass Cut for Gamma"}; Configurable calibrationMode{"calibrationMode", false, "calibration mode"}; Configurable phiVarCut{"phiVarCut", true, "phi var cut"}; - Configurable nTPCClCut{"nTPCClCut", true, "number of clusters in TPC cut"}; - Configurable nITSClCut{"nITSClCut", true, "number of clusters in ITS cut"}; - Configurable v0SelectionMode{"v0SelectionMode", 1, "V0 Selection base on TPC: 1, TOF:2 ,Both:3"}; + Configurable nClTPCFoundCut{"nClTPCFoundCut", false, "number of found clusters in TPC cut"}; + Configurable nClTPCPIDCut{"nClTPCPIDCut", true, "number of PID clusters in TPC cut"}; + Configurable v0SelectionMode{"v0SelectionMode", 3, "V0 Selection base on TPC: 1, TOF:2 ,Both:3"}; + Configurable momentumMode{"momentumMode", 1, "1: TPC inner param, 2: Total momentum p"}; + Configurable v0TypeSelection{"v0TypeSelection", 1, "select on a certain V0 type (leave negative if no selection desired)"}; + Configurable lowParam1{"lowParam1", 0.119297, "First parameter for low phi cut"}; + Configurable lowParam2{"lowParam2", 0.000379693, "Second parameter for low phi cut"}; + Configurable highParam1{"highParam1", 0.16685, "First parameter for high phi cut"}; + Configurable highParam2{"highParam2", 0.00981942, "Second parameter for high phi cut"}; // Histograms names static constexpr std::string_view kDedxvsMomentumPos[kParticlesType] = {"dEdx_vs_Momentum_all_Pos", "dEdx_vs_Momentum_Pi_v0_Pos", "dEdx_vs_Momentum_Pr_v0_Pos", "dEdx_vs_Momentum_El_v0_Pos"}; static constexpr std::string_view kDedxvsMomentumNeg[kParticlesType] = {"dEdx_vs_Momentum_all_Neg", "dEdx_vs_Momentum_Pi_v0_Neg", "dEdx_vs_Momentum_Pr_v0_Neg", "dEdx_vs_Momentum_El_v0_Neg"}; + static constexpr std::string_view kDedxvsMomentumvsCentPos[kCentralityClasses] = {"dEdx_vs_Momentum_Cent0_1_Pos", "dEdx_vs_Momentum_Cent1_5_Pos", "dEdx_vs_Momentum_Cent5_10_Pos", "dEdx_vs_Momentum_Cent10_15_Pos", "dEdx_vs_Momentum_Cent15_20_Pos", "dEdx_vs_Momentum_Cent20_30_Pos", "dEdx_vs_Momentum_Cent30_40_Pos", "dEdx_vs_Momentum_Cent40_50_Pos", "dEdx_vs_Momentum_Cent50_70_Pos", "dEdx_vs_Momentum_Cent70_100_Pos"}; + static constexpr std::string_view kDedxvsMomentumvsCentNeg[kCentralityClasses] = {"dEdx_vs_Momentum_Cent0_1_Neg", "dEdx_vs_Momentum_Cent1_5_Neg", "dEdx_vs_Momentum_Cent5_10_Neg", "dEdx_vs_Momentum_Cent10_15_Neg", "dEdx_vs_Momentum_Cent15_20_Neg", "dEdx_vs_Momentum_Cent20_30_Neg", "dEdx_vs_Momentum_Cent30_40_Neg", "dEdx_vs_Momentum_Cent40_50_Neg", "dEdx_vs_Momentum_Cent50_70_Neg", "dEdx_vs_Momentum_Cent70_100_Neg"}; // Ncl TPC - static constexpr std::string_view kNclTPCDedxMomentumNegBefore[kEtaIntervals] = {"Ncl_TPC_vs_dEdx_vs_Momentum_Neg_1_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_2_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_3_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_4_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_5_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_6_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_7_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_8_Before"}; - static constexpr std::string_view kNclTPCDedxMomentumPosBefore[kEtaIntervals] = {"Ncl_TPC_vs_dEdx_vs_Momentum_Pos_1_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_2_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_3_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_4_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_5_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_6_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_7_Before", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_8_Before"}; - static constexpr std::string_view kNclTPCDedxMomentumNegAfter[kEtaIntervals] = {"Ncl_TPC_vs_dEdx_vs_Momentum_Neg_1_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_2_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_3_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_4_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_5_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_6_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_7_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Neg_8_After"}; - static constexpr std::string_view kNclTPCDedxMomentumPosAfter[kEtaIntervals] = {"Ncl_TPC_vs_dEdx_vs_Momentum_Pos_1_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_2_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_3_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_4_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_5_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_6_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_7_After", "Ncl_TPC_vs_dEdx_vs_Momentum_Pos_8_After"}; - // Ncl TPC - static constexpr std::string_view kNclITSDedxMomentumNegBefore[kEtaIntervals] = {"Ncl_ITS_vs_dEdx_vs_Momentum_Neg_1_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_2_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_3_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_4_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_5_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_6_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_7_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_8_Before"}; - static constexpr std::string_view kNclITSDedxMomentumPosBefore[kEtaIntervals] = {"Ncl_ITS_vs_dEdx_vs_Momentum_Pos_1_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_2_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_3_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_4_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_5_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_6_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_7_Before", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_8_Before"}; - static constexpr std::string_view kNclITSDedxMomentumNegAfter[kEtaIntervals] = {"Ncl_ITS_vs_dEdx_vs_Momentum_Neg_1_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_2_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_3_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_4_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_5_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_6_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_7_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Neg_8_After"}; - static constexpr std::string_view kNclITSDedxMomentumPosAfter[kEtaIntervals] = {"Ncl_ITS_vs_dEdx_vs_Momentum_Pos_1_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_2_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_3_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_4_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_5_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_6_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_7_After", "Ncl_ITS_vs_dEdx_vs_Momentum_Pos_8_After"}; + static constexpr std::string_view kNclTPCDedxMomentumNegBefore[kEtaIntervals] = {"Ncl_FoundTPC_vs_dEdx_vs_Momentum_Neg_1_Before", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Neg_2_Before", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Neg_3_Before", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Neg_4_Before", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Neg_5_Before", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Neg_6_Before", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Neg_7_Before", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Neg_8_Before"}; + static constexpr std::string_view kNclTPCDedxMomentumPosBefore[kEtaIntervals] = {"Ncl_FoundTPC_vs_dEdx_vs_Momentum_Pos_1_Before", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Pos_2_Before", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Pos_3_Before", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Pos_4_Before", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Pos_5_Before", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Pos_6_Before", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Pos_7_Before", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Pos_8_Before"}; + static constexpr std::string_view kNclTPCDedxMomentumNegAfter[kEtaIntervals] = {"Ncl_TFoundPC_vs_dEdx_vs_Momentum_Neg_1_After", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Neg_2_After", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Neg_3_After", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Neg_4_After", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Neg_5_After", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Neg_6_After", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Neg_7_After", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Neg_8_After"}; + static constexpr std::string_view kNclTPCDedxMomentumPosAfter[kEtaIntervals] = {"Ncl_FoundTPC_vs_dEdx_vs_Momentum_Pos_1_After", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Pos_2_After", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Pos_3_After", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Pos_4_After", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Pos_5_After", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Pos_6_After", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Pos_7_After", "Ncl_FoundTPC_vs_dEdx_vs_Momentum_Pos_8_After"}; + // Ncl PID TPC + static constexpr std::string_view kNclPIDTPCDedxMomentumNegBefore[kEtaIntervals] = {"Ncl_PIDTPC_vs_dEdx_vs_Momentum_Neg_1_Before", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Neg_2_Before", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Neg_3_Before", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Neg_4_Before", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Neg_5_Before", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Neg_6_Before", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Neg_7_Before", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Neg_8_Before"}; + static constexpr std::string_view kNclPIDTPCDedxMomentumPosBefore[kEtaIntervals] = {"Ncl_PIDTPC_vs_dEdx_vs_Momentum_Pos_1_Before", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Pos_2_Before", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Pos_3_Before", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Pos_4_Before", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Pos_5_Before", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Pos_6_Before", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Pos_7_Before", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Pos_8_Before"}; + static constexpr std::string_view kNclPIDTPCDedxMomentumNegAfter[kEtaIntervals] = {"Ncl_PIDTPC_vs_dEdx_vs_Momentum_Neg_1_After", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Neg_2_After", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Neg_3_After", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Neg_4_After", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Neg_5_After", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Neg_6_After", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Neg_7_After", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Neg_8_After"}; + static constexpr std::string_view kNclPIDTPCDedxMomentumPosAfter[kEtaIntervals] = {"Ncl_PIDTPC_vs_dEdx_vs_Momentum_Pos_1_After", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Pos_2_After", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Pos_3_After", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Pos_4_After", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Pos_5_After", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Pos_6_After", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Pos_7_After", "Ncl_PIDTPC_vs_dEdx_vs_Momentum_Pos_8_After"}; static constexpr double EtaCut[kEtaIntervals + 1] = {-0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6, 0.8}; + static constexpr double CentClasses[kCentralityClasses + 1] = {0.0, 0.1, 5.0, 10.0, 15.0, 20.0, 30.0, 40.0, 50.0, 70.0, 100.0}; Configurable> calibrationFactorNeg{"calibrationFactorNeg", {50.4011, 50.4764, 50.186, 49.2955, 48.8222, 49.4273, 49.9292, 50.0556}, "negative calibration factors"}; Configurable> calibrationFactorPos{"calibrationFactorPos", {50.5157, 50.6359, 50.3198, 49.3345, 48.9197, 49.4931, 50.0188, 50.1406}, "positive calibration factors"}; ConfigurableAxis binP{"binP", {VARIABLE_WIDTH, 0.1, 0.12, 0.14, 0.16, 0.18, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 18.0, 20.0}, ""}; @@ -203,20 +227,58 @@ struct DedxPidAnalysis { void init(InitContext const&) { - if (v0SelectionMode == v0TPC) { + if (v0SelectionMode == V0TPC) { LOGF(info, "V0 seleccion using TPC only"); - } else if (v0SelectionMode == v0TOF) { + } else if (v0SelectionMode == V0TOF) { LOGF(info, "V0 seleccion using TOF only"); - } else if (v0SelectionMode == v0TPCTOF) { + } else if (v0SelectionMode == V0TPCTOF) { LOGF(info, "V0 seleccion using TOF + TPC"); } + if (calibrationMode) { + LOGF(info, "Calibration mode activated"); + } else { + LOGF(info, "Running data applying calibration values"); + } + + if (phiVarCut) { + LOGF(info, "Applying phi prime cut"); + } else { + LOGF(info, "Phi prime cut disabled"); + } + + if (nClTPCFoundCut) { + LOGF(info, "Applying TPC found clusters cut"); + } else { + LOGF(info, "TPC found clusters cut disabled"); + } + + if (nClTPCPIDCut) { + LOGF(info, "Applying TPC clusters for PID cut"); + } else { + LOGF(info, "TPC clusters for PID cut disabled"); + } + if (momentumMode == TpcInnerParam) { + LOGF(info, "Using TPC inner parameter for momentum calculation"); + } else { + LOGF(info, "Using total momentum (p) for calculation"); + } + LOGF(info, "Centrality clases between %.1f - %.1f", CentClasses[0], CentClasses[10]); AxisSpec dedxAxis{100, 0.0, 100.0, "dE/dx (a. u.)"}; AxisSpec ptAxis = {binP, "pT (GeV/c)"}; AxisSpec etaAxis{8, -0.8, 0.8, "#eta"}; AxisSpec pAxis = {binP, "#it{p}/Z (GeV/c)"}; - fphiCutLow = new TF1("StandardPhiCutLow", "0.119297/x/x+pi/18.0-0.000379693", 0, 50); - fphiCutHigh = new TF1("StandardPhiCutHigh", "0.16685/x+pi/18.0+0.00981942", 0, 50); + AxisSpec pAxisTrack = {binP, "#it{p} (GeV/c)"}; + fphiCutLow = new TF1("StandardPhiCutLow", + Form("%f/x/x+pi/18.0-%f", lowParam1.value, lowParam2.value), + 0, 50); + fphiCutHigh = new TF1("StandardPhiCutHigh", + Form("%f/x+pi/18.0+%f", highParam1.value, highParam2.value), + 0, 50); + LOGF(info, "=== Phi Cut Parameters ==="); + LOGF(info, "Low cut: %.6f/x² + pi/18 - %.6f", lowParam1.value, lowParam2.value); + LOGF(info, "High cut: %.6f/x + pi/18 + %.6f", highParam1.value, highParam2.value); + if (calibrationMode) { // MIP for pions registryDeDx.add( @@ -270,18 +332,23 @@ struct DedxPidAnalysis { // pt vs p registryDeDx.add( - "heta_vs_p_vs_pt_all_Neg", "eta_vs_p_vs_pT", HistType::kTH3F, - {{etaAxis}, {ptAxis}, {pAxis}}); + "heta_vs_pt_vs_p_all_Neg", "eta_vs_pT_vs_p", HistType::kTH3F, + {{etaAxis}, {ptAxis}, {pAxisTrack}}); registryDeDx.add( - "heta_vs_p_vs_pt_all_Pos", "eta_vs_p_vs_pT", HistType::kTH3F, - {{etaAxis}, {ptAxis}, {pAxis}}); + "heta_vs_pt_vs_p_all_Pos", "eta_vs_pT_vs_p", HistType::kTH3F, + {{etaAxis}, {ptAxis}, {pAxisTrack}}); // De/Dx for ch and v0 particles for (int i = 0; i < kParticlesType; ++i) { registryDeDx.add(kDedxvsMomentumPos[i].data(), "dE/dx", HistType::kTH3F, - {{pAxis}, {dedxAxis}, {etaAxis}}); + {{pAxisTrack}, {dedxAxis}, {etaAxis}}); registryDeDx.add(kDedxvsMomentumNeg[i].data(), "dE/dx", HistType::kTH3F, - {{pAxis}, {dedxAxis}, {etaAxis}}); + {{pAxisTrack}, {dedxAxis}, {etaAxis}}); + } + + for (int i = 0; i < kCentralityClasses; ++i) { + hDedxVsMomentumVsCentPos[i] = registryDeDx.add(kDedxvsMomentumvsCentPos[i].data(), "dE/dx", HistType::kTH3F, {{pAxisTrack}, {dedxAxis}, {etaAxis}}); + hDedxVsMomentumVsCentNeg[i] = registryDeDx.add(kDedxvsMomentumvsCentNeg[i].data(), "dE/dx", HistType::kTH3F, {{pAxisTrack}, {dedxAxis}, {etaAxis}}); } } @@ -290,60 +357,159 @@ struct DedxPidAnalysis { {{100, 0.0, 6.4, "#phi"}, {dedxAxis}}); // phi cut if (phiVarCut) { - // pt + // pt for found registryDeDx.add( - "hpt_vs_phi_Ncl_TPC_After", "phi cut vs pt", HistType::kTH3F, - {{ptAxis}, {100, 0.0, 0.4, "#varphi^{'}"}, {100, 0, 160, "N_{cl}"}}); + "hpt_vs_phi_NclFound_TPC_After", "phi cut vs pt", HistType::kTH3F, + {{ptAxis}, {100, 0.0, 0.4, "#varphi^{'}"}, {100, 0, 160, "N_{cl, found}"}}); registryDeDx.add( - "hpt_vs_phi_Ncl_TPC_Before", "phi cut vs pt", HistType::kTH3F, - {{ptAxis}, {100, 0.0, 0.4, "#varphi^{'}"}, {100, 0, 160, "N_{cl}"}}); + "hpt_vs_phi_NclFound_TPC_Before", "phi cut vs pt", HistType::kTH3F, + {{ptAxis}, {100, 0.0, 0.4, "#varphi^{'}"}, {100, 0, 160, "N_{cl, found}"}}); // p registryDeDx.add( - "hp_vs_phi_Ncl_TPC_After", "phi cut vs p", HistType::kTH3F, - {{pAxis}, {100, 0.0, 0.4, "#varphi^{'}"}, {100, 0, 160, "N_{cl}"}}); + "hp_vs_phi_NclFound_TPC_After", "phi cut vs p", HistType::kTH3F, + {{pAxis}, {100, 0.0, 0.4, "#varphi^{'}"}, {100, 0, 160, "N_{cl, found}"}}); registryDeDx.add( - "hp_vs_phi_Ncl_TPC_Before", "phi cut vs p", HistType::kTH3F, - {{pAxis}, {100, 0.0, 0.4, "#varphi^{'}"}, {100, 0, 160, "N_{cl}"}}); - // eta + "hp_vs_phi_NclFound_TPC_Before", "phi cut vs p", HistType::kTH3F, + {{pAxis}, {100, 0.0, 0.4, "#varphi^{'}"}, {100, 0, 160, "N_{cl, found}"}}); + + // pt for PID registryDeDx.add( - "heta_vs_Ncl_TPC_Before", "eta and N_{cl}", HistType::kTH2F, - {{100, -0.8, 0.8, "#eta"}, {100, 0, 160, "N_{cl}"}}); + "hpt_vs_phi_NclPID_TPC_After", "phi cut vs pt", HistType::kTH3F, + {{ptAxis}, {100, 0.0, 0.4, "#varphi^{'}"}, {100, 0, 160, "N_{cl, PID}"}}); registryDeDx.add( - "heta_vs_Ncl_TPC_After", "eta and N_{cl} ", HistType::kTH2F, - {{100, -0.8, 0.8, "#eta"}, {100, 0, 160, "N_{cl}"}}); + "hpt_vs_phi_NclPID_TPC_Before", "phi cut vs pt", HistType::kTH3F, + {{ptAxis}, {100, 0.0, 0.4, "#varphi^{'}"}, {100, 0, 160, "N_{cl, PID}"}}); + // p + registryDeDx.add( + "hp_vs_phi_NclPID_TPC_After", "phi cut vs p", HistType::kTH3F, + {{pAxis}, {100, 0.0, 0.4, "#varphi^{'}"}, {100, 0, 160, "N_{cl, PID}"}}); + + registryDeDx.add( + "hp_vs_phi_NclPID_TPC_Before", "phi cut vs p", HistType::kTH3F, + {{pAxis}, {100, 0.0, 0.4, "#varphi^{'}"}, {100, 0, 160, "N_{cl, PID}"}}); } // Ncl vs de/dx TPC - if (nTPCClCut) { + if (nClTPCFoundCut) { for (int i = 0; i < kEtaIntervals; ++i) { - registryDeDx.add(kNclTPCDedxMomentumPosBefore[i].data(), "Ncl TPC vs dE/dx vs Momentum Positive before", HistType::kTH3F, - {{100, 0, 160, "N_{cl}^{TPC}"}, {dedxAxis}, {pAxis}}); - registryDeDx.add(kNclTPCDedxMomentumNegBefore[i].data(), "Ncl TPC vs dE/dx vs Momentum Negative before", HistType::kTH3F, - {{100, 0, 160, "N_{cl}^{TPC}"}, {dedxAxis}, {pAxis}}); - - registryDeDx.add(kNclTPCDedxMomentumPosAfter[i].data(), "Ncl TPC vs dE/dx vs Momentum Positive after", HistType::kTH3F, - {{100, 0, 160, "N_{cl}^{TPC}"}, {dedxAxis}, {pAxis}}); - registryDeDx.add(kNclTPCDedxMomentumNegAfter[i].data(), "Ncl TPC vs dE/dx vs Momentum Negative after", HistType::kTH3F, - {{100, 0, 160, "N_{cl}^{TPC}"}, {dedxAxis}, {pAxis}}); + registryDeDx.add(kNclTPCDedxMomentumPosBefore[i].data(), "Ncl found TPC vs dE/dx vs Momentum Positive before", HistType::kTH3F, + {{100, 0, 160, "N_{cl, found}^{TPC}"}, {dedxAxis}, {pAxis}}); + registryDeDx.add(kNclTPCDedxMomentumNegBefore[i].data(), "Ncl found TPC vs dE/dx vs Momentum Negative before", HistType::kTH3F, + {{100, 0, 160, "N_{cl, found}^{TPC}"}, {dedxAxis}, {pAxis}}); + + registryDeDx.add(kNclTPCDedxMomentumPosAfter[i].data(), "Ncl found TPC vs dE/dx vs Momentum Positive after", HistType::kTH3F, + {{100, 0, 160, "N_{cl, found}^{TPC}"}, {dedxAxis}, {pAxis}}); + registryDeDx.add(kNclTPCDedxMomentumNegAfter[i].data(), "Ncl found TPC vs dE/dx vs Momentum Negative after", HistType::kTH3F, + {{100, 0, 160, "N_{cl, found}^{TPC}"}, {dedxAxis}, {pAxis}}); } } // Ncl vs de/dx ITS - if (nITSClCut) { + if (nClTPCPIDCut) { for (int i = 0; i < kEtaIntervals; ++i) { - registryDeDx.add(kNclITSDedxMomentumPosBefore[i].data(), "Ncl ITS vs dE/dx vs Momentum Positive before", HistType::kTH3F, - {{100, 0, 160, "N_{cl}^{ITS}"}, {dedxAxis}, {pAxis}}); - registryDeDx.add(kNclITSDedxMomentumNegBefore[i].data(), "Ncl ITS vs dE/dx vs Momentum Negative before", HistType::kTH3F, - {{100, 0, 160, "N_{cl}^{ITS}"}, {dedxAxis}, {pAxis}}); - - registryDeDx.add(kNclITSDedxMomentumPosAfter[i].data(), "Ncl ITS vs dE/dx vs Momentum Positive after", HistType::kTH3F, - {{100, 0, 160, "N_{cl}^{ITS}"}, {dedxAxis}, {pAxis}}); - registryDeDx.add(kNclITSDedxMomentumNegAfter[i].data(), "Ncl ITS vs dE/dx vs Momentum Negative after", HistType::kTH3F, - {{100, 0, 160, "N_{cl}^{ITS}"}, {dedxAxis}, {pAxis}}); + registryDeDx.add(kNclPIDTPCDedxMomentumPosBefore[i].data(), "Ncl PID TPC vs dE/dx vs Momentum Positive before", HistType::kTH3F, + {{100, 0, 160, "N_{cl, PID}^{TPC}"}, {dedxAxis}, {pAxis}}); + registryDeDx.add(kNclPIDTPCDedxMomentumNegBefore[i].data(), "Ncl PID TPC vs dE/dx vs Momentum Negative before", HistType::kTH3F, + {{100, 0, 160, "N_{cl, PID}^{TPC}"}, {dedxAxis}, {pAxis}}); + + registryDeDx.add(kNclPIDTPCDedxMomentumPosAfter[i].data(), "Ncl PID TPC vs dE/dx vs Momentum Positive after", HistType::kTH3F, + {{100, 0, 160, "N_{cl, PID}^{TPC}"}, {dedxAxis}, {pAxis}}); + registryDeDx.add(kNclPIDTPCDedxMomentumNegAfter[i].data(), "Ncl PID TPC vs dE/dx vs Momentum Negative after", HistType::kTH3F, + {{100, 0, 160, "N_{cl, PID}^{TPC}"}, {dedxAxis}, {pAxis}}); } } + // eta + registryDeDx.add( + "heta_vs_NclFound_TPC_Before_Primary", "eta and N_{cl}", HistType::kTH2F, + {{100, -0.8, 0.8, "#eta"}, {100, 0, 160, "N_{cl, found}"}}); + + registryDeDx.add( + "heta_vs_NclFound_TPC_After_Primary", "eta and N_{cl} ", HistType::kTH2F, + {{100, -0.8, 0.8, "#eta"}, {100, 0, 160, "N_{cl, found}"}}); + + registryDeDx.add( + "heta_vs_NclPID_TPC_Before_Primary", "eta and N_{cl, PID}", HistType::kTH2F, + {{100, -0.8, 0.8, "#eta"}, {100, 0, 160, "N_{cl, PID}"}}); + + registryDeDx.add( + "heta_vs_NclPID_TPC_After_Primary", "eta and N_{cl, PID} ", HistType::kTH2F, + {{100, -0.8, 0.8, "#eta"}, {100, 0, 160, "N_{cl, PID}"}}); + // momentum for primaries + registryDeDx.add( + "hp_vs_NclPID_TPC_Before_Primary", "p and N_{cl, PID}", HistType::kTH2F, + {{pAxisTrack}, {100, 0, 160, "N_{cl, PID}"}}); + + registryDeDx.add( + "hp_vs_NclPID_TPC_After_Primary", "p and N_{cl, PID} ", HistType::kTH2F, + {{pAxisTrack}, {100, 0, 160, "N_{cl, PID}"}}); + + // eta for secondaries + registryDeDx.add( + "heta_vs_NclPID_TPC_Before_PionsK0s", "eta and N_{cl, PID}", HistType::kTH2F, + {{100, -0.8, 0.8, "#eta"}, {100, 0, 160, "N_{cl, PID}"}}); + + registryDeDx.add( + "heta_vs_NclPID_TPC_After_PionsK0s", "eta and N_{cl, PID} ", HistType::kTH2F, + {{100, -0.8, 0.8, "#eta"}, {100, 0, 160, "N_{cl, PID}"}}); + + registryDeDx.add( + "heta_vs_NclPID_TPC_Before_PionsLambda", "eta and N_{cl, PID}", HistType::kTH2F, + {{100, -0.8, 0.8, "#eta"}, {100, 0, 160, "N_{cl, PID}"}}); + + registryDeDx.add( + "heta_vs_NclPID_TPC_After_PionsLambda", "eta and N_{cl, PID} ", HistType::kTH2F, + {{100, -0.8, 0.8, "#eta"}, {100, 0, 160, "N_{cl, PID}"}}); + + registryDeDx.add( + "heta_vs_NclPID_TPC_Before_ProtonsLambda", "eta and N_{cl, PID}", HistType::kTH2F, + {{100, -0.8, 0.8, "#eta"}, {100, 0, 160, "N_{cl, PID}"}}); + + registryDeDx.add( + "heta_vs_NclPID_TPC_After_ProtonsLambda", "eta and N_{cl, PID} ", HistType::kTH2F, + {{100, -0.8, 0.8, "#eta"}, {100, 0, 160, "N_{cl, PID}"}}); + + registryDeDx.add( + "heta_vs_NclPID_TPC_Before_ElectronsGamma", "eta and N_{cl, PID}", HistType::kTH2F, + {{100, -0.8, 0.8, "#eta"}, {100, 0, 160, "N_{cl, PID}"}}); + + registryDeDx.add( + "heta_vs_NclPID_TPC_After_ElectronsGamma", "eta and N_{cl, PID} ", HistType::kTH2F, + {{100, -0.8, 0.8, "#eta"}, {100, 0, 160, "N_{cl, PID}"}}); + + // momentum for secondaries + registryDeDx.add( + "hp_vs_NclPID_TPC_Before_PionsK0s", "p and N_{cl, PID}", HistType::kTH2F, + {{pAxisTrack}, {100, 0, 160, "N_{cl, PID}"}}); + + registryDeDx.add( + "hp_vs_NclPID_TPC_After_PionsK0s", "p and N_{cl, PID} ", HistType::kTH2F, + {{pAxisTrack}, {100, 0, 160, "N_{cl, PID}"}}); + + registryDeDx.add( + "hp_vs_NclPID_TPC_Before_PionsLambda", "p and N_{cl, PID}", HistType::kTH2F, + {{pAxisTrack}, {100, 0, 160, "N_{cl, PID}"}}); + + registryDeDx.add( + "hp_vs_NclPID_TPC_After_PionsLambda", "p and N_{cl, PID} ", HistType::kTH2F, + {{pAxisTrack}, {100, 0, 160, "N_{cl, PID}"}}); + + registryDeDx.add( + "hp_vs_NclPID_TPC_Before_ProtonsLambda", "p and N_{cl, PID}", HistType::kTH2F, + {{pAxisTrack}, {100, 0, 160, "N_{cl, PID}"}}); + + registryDeDx.add( + "hp_vs_NclPID_TPC_After_ProtonsLambda", "p and N_{cl, PID} ", HistType::kTH2F, + {{pAxisTrack}, {100, 0, 160, "N_{cl, PID}"}}); + + registryDeDx.add( + "hp_vs_NclPID_TPC_Before_ElectronsGamma", "p and N_{cl, PID}", HistType::kTH2F, + {{pAxisTrack}, {100, 0, 160, "N_{cl, PID}"}}); + + registryDeDx.add( + "hp_vs_NclPID_TPC_After_ElectronsGamma", "p and N_{cl, PID} ", HistType::kTH2F, + {{pAxisTrack}, {100, 0, 160, "N_{cl, PID}"}}); // beta plot registryDeDx.add( @@ -368,36 +534,42 @@ struct DedxPidAnalysis { x->SetBinLabel(GoodZvtxFT0vsPV, "GoodZvtxFT0vsPV"); // Track Counter - registryDeDx.add("trackselAll", "track selected all particles", HistType::kTH1F, {{5, 0.5, 5.5, ""}}); + registryDeDx.add("trackselAll", "track selected all particles", HistType::kTH1F, {{5, 0.5, 6.5, ""}}); auto htrackAll = registryDeDx.get(HIST("trackselAll")); auto* xAll = htrackAll->GetXaxis(); xAll->SetBinLabel(AllPri, "AllPri"); xAll->SetBinLabel(SelectionPrim, "SelectionPrim"); xAll->SetBinLabel(PhiVarCutPri, "PhiVarCutPri"); - xAll->SetBinLabel(NTPCClCutPri, "NTPCClCutPri"); - xAll->SetBinLabel(NITSClCutPri, "NITSClCutPri"); + xAll->SetBinLabel(NClTPCFoundCutPri, "NClTPCFoundCutPri"); + xAll->SetBinLabel(NClTPCPIDCutPri, "NClTPCPIDCutPri"); - registryDeDx.add("trackselSec", "track selected sec particles", HistType::kTH1F, {{18, 0.5, 18.5, ""}}); + registryDeDx.add("trackselSec", "track selected sec particles", HistType::kTH1F, {{24, 0.5, 24.5, ""}}); auto htrackSec = registryDeDx.get(HIST("trackselSec")); auto* xSec = htrackSec->GetXaxis(); xSec->SetBinLabel(AllSec, "AllSec"); + xSec->SetBinLabel(V0Type, "V0Type"); xSec->SetBinLabel(V0CosPA, "V0CosPA"); xSec->SetBinLabel(V0DecayRadius, "V0DecayRadius"); xSec->SetBinLabel(V0Daughters, "V0Daughters"); xSec->SetBinLabel(TPCRefit, "TPCRefit"); xSec->SetBinLabel(PhiVarCutSec, "PhiVarCutSec"); - xSec->SetBinLabel(NTPCClCutSec, "NTPCClCutSec"); - xSec->SetBinLabel(NITSClCutSec, "NITSClCutSec"); + xSec->SetBinLabel(NClTPCFoundCutSec, "NClTPCFoundCutSec"); + xSec->SetBinLabel(NClTPCPIDCutSec, "NClTPCPIDCutSec"); xSec->SetBinLabel(AllK0s, "AllK0s"); xSec->SetBinLabel(V0RapidityK0s, "V0RapidityK0s"); xSec->SetBinLabel(V0ProperLifetimeK0s, "V0ProperLifetimeK0s"); + xSec->SetBinLabel(MassCutK0s, "MassCutK0s"); xSec->SetBinLabel(AllLambda, "AllLambda"); xSec->SetBinLabel(V0RapidityLambda, "V0RapidityLambda"); xSec->SetBinLabel(V0ProperLifetimeLambda, "V0ProperLifetimeLambda"); + xSec->SetBinLabel(MassCutLambda, "MassCutLambda"); xSec->SetBinLabel(AllAntiLambda, "AllAntiLambda"); xSec->SetBinLabel(V0RapidityAntiLambda, "V0RapidityAntiLambda"); xSec->SetBinLabel(V0ProperLifetimeAntiLambda, "V0ProperLifetimeAntiLambda"); + xSec->SetBinLabel(MassCutAntiLambda, "MassCutAntiLambda"); xSec->SetBinLabel(AllGamma, "AllGamma"); + xSec->SetBinLabel(V0RapidityGamma, "V0RapidityGamma"); + xSec->SetBinLabel(MassCutGamma, "MassCutGamma"); mySelectionPrim = myTrackSelection(); } @@ -419,6 +591,13 @@ struct DedxPidAnalysis { return true; } + // Momentum + template + float getMomentum(const T1& track) + { + return (momentumMode == TpcInnerParam) ? track.tpcInnerParam() : track.p(); + }; + // General V0 Selections template bool passedV0Selection(const T1& v0, const C& /*collision*/) @@ -451,13 +630,13 @@ struct DedxPidAnalysis { double sigmap = 0.0; double sigman = 0.0; - if (v0SelectionMode == v0TPC) { + if (v0SelectionMode == V0TPC) { sigmap = ptrack.tpcNSigmaPi(); sigman = ntrack.tpcNSigmaPi(); - } else if (v0SelectionMode == v0TOF) { + } else if (v0SelectionMode == V0TOF) { sigmap = ptrack.tofNSigmaPi(); sigman = ntrack.tofNSigmaPi(); - } else if (v0SelectionMode == v0TPCTOF) { + } else if (v0SelectionMode == V0TPCTOF) { sigmap = std::hypot(ptrack.tpcNSigmaPi(), ptrack.tofNSigmaPi()); sigman = std::hypot(ntrack.tpcNSigmaPi(), ntrack.tofNSigmaPi()); } @@ -475,10 +654,25 @@ struct DedxPidAnalysis { if (std::abs(sigman) > nsigmaTOFmax) return false; } + if (fillHist) + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::AllK0s); - // Invariant-Mass Selection - if (v0.mK0Short() < minMassK0s || v0.mK0Short() > maxMassK0s) + if (std::abs(v0.yK0Short()) > v0rapidityCut) return false; + if (fillHist) + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0RapidityK0s); + + float properLifetime = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * MassK0Short; + + if (properLifetime > v0ProperLifetimeCutK0s) + return false; + if (fillHist) + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0ProperLifetimeK0s); + + if (std::abs(v0.mK0Short() - MassK0Short) > invMassCutK0s) + return false; + if (fillHist) + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::MassCutK0s); return true; } @@ -497,13 +691,13 @@ struct DedxPidAnalysis { double sigmap = 0.0; double sigman = 0.0; - if (v0SelectionMode == v0TPC) { + if (v0SelectionMode == V0TPC) { sigmap = ptrack.tpcNSigmaPr(); sigman = ntrack.tpcNSigmaPi(); - } else if (v0SelectionMode == v0TOF) { + } else if (v0SelectionMode == V0TOF) { sigmap = ptrack.tofNSigmaPr(); sigman = ntrack.tofNSigmaPi(); - } else if (v0SelectionMode == v0TPCTOF) { + } else if (v0SelectionMode == V0TPCTOF) { sigmap = std::hypot(ptrack.tpcNSigmaPr(), ptrack.tofNSigmaPr()); sigman = std::hypot(ntrack.tpcNSigmaPi(), ntrack.tofNSigmaPi()); } @@ -521,10 +715,27 @@ struct DedxPidAnalysis { if (std::abs(sigman) > nsigmaTOFmax) return false; } + if (fillHist) + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::AllLambda); - // Invariant-Mass Selection - if (v0.mLambda() < minMassLambda || v0.mLambda() > maxMassLambda) + if (std::abs(v0.yLambda()) > v0rapidityCut) return false; + if (fillHist) + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0RapidityLambda); + + float properLifetime = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * MassLambda; + + if (properLifetime > v0ProperLifetimeCutLambda) + return false; + + if (fillHist) + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0ProperLifetimeLambda); + + if (std::abs(v0.mLambda() - MassLambda) > invMassCutLambda) { + return false; + } + if (fillHist) + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::MassCutLambda); return true; } @@ -543,13 +754,13 @@ struct DedxPidAnalysis { double sigmap = 0.0; double sigman = 0.0; - if (v0SelectionMode == v0TPC) { + if (v0SelectionMode == V0TPC) { sigmap = ptrack.tpcNSigmaPi(); sigman = ntrack.tpcNSigmaPr(); - } else if (v0SelectionMode == v0TOF) { + } else if (v0SelectionMode == V0TOF) { sigmap = ptrack.tofNSigmaPi(); sigman = ntrack.tofNSigmaPr(); - } else if (v0SelectionMode == v0TPCTOF) { + } else if (v0SelectionMode == V0TPCTOF) { sigmap = std::hypot(ptrack.tpcNSigmaPi(), ptrack.tofNSigmaPi()); sigman = std::hypot(ntrack.tpcNSigmaPr(), ntrack.tofNSigmaPr()); } @@ -566,11 +777,29 @@ struct DedxPidAnalysis { if (std::abs(sigman) > nsigmaTOFmax) return false; } + if (fillHist) + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::AllAntiLambda); + + if (std::abs(v0.yLambda()) > v0rapidityCut) + return false; + + if (fillHist) + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0RapidityAntiLambda); + + float properLifetime = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * MassLambda; - // Invariant-Mass Selection - if (v0.mAntiLambda() < minMassLambda || v0.mAntiLambda() > maxMassLambda) + if (properLifetime > v0ProperLifetimeCutLambda) return false; + if (fillHist) + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0ProperLifetimeAntiLambda); + + if (std::abs(v0.mAntiLambda() - MassLambda) > invMassCutLambda) + return false; + + if (fillHist) + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::MassCutAntiLambda); + return true; } @@ -588,13 +817,13 @@ struct DedxPidAnalysis { double sigmap = 0.0; double sigman = 0.0; - if (v0SelectionMode == v0TPC) { + if (v0SelectionMode == V0TPC) { sigmap = ptrack.tpcNSigmaEl(); sigman = ntrack.tpcNSigmaEl(); - } else if (v0SelectionMode == v0TOF) { + } else if (v0SelectionMode == V0TOF) { sigmap = ptrack.tofNSigmaEl(); sigman = ntrack.tofNSigmaEl(); - } else if (v0SelectionMode == v0TPCTOF) { + } else if (v0SelectionMode == V0TPCTOF) { sigmap = std::hypot(ptrack.tpcNSigmaEl(), ptrack.tofNSigmaEl()); sigman = std::hypot(ntrack.tpcNSigmaEl(), ntrack.tofNSigmaEl()); } @@ -612,11 +841,25 @@ struct DedxPidAnalysis { if (std::abs(sigman) > nsigmaTOFmax) return false; } + const float gammaMass = 2 * MassElectron; // GeV/c^2 + + if (fillHist) + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::AllGamma); - // Invariant-Mass Selection - if (v0.mGamma() < minMassGamma || v0.mGamma() > maxMassGamma) + const float yGamma = RecoDecay::y(std::array{v0.px(), v0.py(), v0.pz()}, MassGamma); + + if (std::abs(yGamma) > v0rapidityCut) + return false; + + if (fillHist) + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0RapidityGamma); + + if (std::abs(v0.mGamma() - gammaMass) > invMassCutGamma) return false; + if (fillHist) + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::MassCutGamma); + return true; } // Magnetic field @@ -637,12 +880,12 @@ struct DedxPidAnalysis { template bool passedPhiCutPri(const T& trk, float magField, const TF1& fphiCutLow, const TF1& fphiCutHigh) { - float p = trk.pt(); + float p = trk.p(); float pt = trk.pt(); float phi = trk.phi(); int charge = trk.sign(); - float eta = trk.eta(); auto nTPCCl = trk.tpcNClsFound(); + auto nTPCPIDCl = trk.tpcNClsPID(); if (pt < pTcut) return true; @@ -656,72 +899,74 @@ struct DedxPidAnalysis { phi += o2::constants::math::PI / 18.0f; phi = std::fmod(phi, o2::constants::math::PI / 9.0f); - registryDeDx.fill(HIST("hpt_vs_phi_Ncl_TPC_Before"), pt, phi, nTPCCl); - registryDeDx.fill(HIST("hp_vs_phi_Ncl_TPC_Before"), p, phi, nTPCCl); - registryDeDx.fill(HIST("heta_vs_Ncl_TPC_Before"), eta, nTPCCl); + registryDeDx.fill(HIST("hpt_vs_phi_NclFound_TPC_Before"), pt, phi, nTPCCl); + registryDeDx.fill(HIST("hp_vs_phi_NclFound_TPC_Before"), p, phi, nTPCCl); + registryDeDx.fill(HIST("hpt_vs_phi_NclPID_TPC_Before"), pt, phi, nTPCPIDCl); + registryDeDx.fill(HIST("hp_vs_phi_NclPID_TPC_Before"), p, phi, nTPCPIDCl); // cut phi if (phi < fphiCutHigh.Eval(pt) && phi > fphiCutLow.Eval(pt)) return false; // reject track - registryDeDx.fill(HIST("hpt_vs_phi_Ncl_TPC_After"), pt, phi, nTPCCl); - registryDeDx.fill(HIST("hp_vs_phi_Ncl_TPC_After"), p, phi, nTPCCl); - registryDeDx.fill(HIST("heta_vs_Ncl_TPC_After"), eta, nTPCCl); + registryDeDx.fill(HIST("hpt_vs_phi_NclFound_TPC_After"), pt, phi, nTPCCl); + registryDeDx.fill(HIST("hp_vs_phi_NclFound_TPC_After"), p, phi, nTPCCl); + registryDeDx.fill(HIST("hpt_vs_phi_NclPID_TPC_After"), pt, phi, nTPCPIDCl); + registryDeDx.fill(HIST("hp_vs_phi_NclPID_TPC_After"), p, phi, nTPCPIDCl); return true; } // NclCutTPC template - bool passedNTPCClCutPri(const T& trk) + bool passedNClTPCFoundCutPri(const T& trk) { float eta = trk.eta(); - float sigP = trk.sign() * trk.tpcInnerParam(); + float sigP = trk.sign() * getMomentum(trk); auto nTPCCl = trk.tpcNClsFound(); - if (eta > EtaCut[0] && eta < EtaCut[1]) { + if (eta >= EtaCut[0] && eta < EtaCut[1]) { if (sigP < 0) { registryDeDx.fill(HIST(kNclTPCDedxMomentumNegBefore[0]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { registryDeDx.fill(HIST(kNclTPCDedxMomentumPosBefore[0]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[1] && eta < EtaCut[2]) { + } else if (eta >= EtaCut[1] && eta < EtaCut[2]) { if (sigP < 0) { registryDeDx.fill(HIST(kNclTPCDedxMomentumNegBefore[1]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { registryDeDx.fill(HIST(kNclTPCDedxMomentumPosBefore[1]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[2] && eta < EtaCut[3]) { + } else if (eta >= EtaCut[2] && eta < EtaCut[3]) { if (sigP < 0) { registryDeDx.fill(HIST(kNclTPCDedxMomentumNegBefore[2]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { registryDeDx.fill(HIST(kNclTPCDedxMomentumPosBefore[2]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[3] && eta < EtaCut[4]) { + } else if (eta >= EtaCut[3] && eta < EtaCut[4]) { if (sigP < 0) { registryDeDx.fill(HIST(kNclTPCDedxMomentumNegBefore[3]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { registryDeDx.fill(HIST(kNclTPCDedxMomentumPosBefore[3]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[4] && eta < EtaCut[5]) { + } else if (eta >= EtaCut[4] && eta < EtaCut[5]) { if (sigP < 0) { registryDeDx.fill(HIST(kNclTPCDedxMomentumNegBefore[4]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { registryDeDx.fill(HIST(kNclTPCDedxMomentumPosBefore[4]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[5] && eta < EtaCut[6]) { + } else if (eta >= EtaCut[5] && eta < EtaCut[6]) { if (sigP < 0) { registryDeDx.fill(HIST(kNclTPCDedxMomentumNegBefore[5]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { registryDeDx.fill(HIST(kNclTPCDedxMomentumPosBefore[5]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[6] && eta < EtaCut[7]) { + } else if (eta >= EtaCut[6] && eta < EtaCut[7]) { if (sigP < 0) { registryDeDx.fill(HIST(kNclTPCDedxMomentumNegBefore[6]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { registryDeDx.fill(HIST(kNclTPCDedxMomentumPosBefore[6]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[7] && eta < EtaCut[8]) { + } else if (eta >= EtaCut[7] && eta < EtaCut[8]) { if (sigP < 0) { registryDeDx.fill(HIST(kNclTPCDedxMomentumNegBefore[7]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { @@ -732,49 +977,49 @@ struct DedxPidAnalysis { if (nTPCCl < minTPCnClsFound) return false; - if (eta > EtaCut[0] && eta < EtaCut[1]) { + if (eta >= EtaCut[0] && eta < EtaCut[1]) { if (sigP < 0) { registryDeDx.fill(HIST(kNclTPCDedxMomentumNegAfter[0]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { registryDeDx.fill(HIST(kNclTPCDedxMomentumPosAfter[0]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[1] && eta < EtaCut[2]) { + } else if (eta >= EtaCut[1] && eta < EtaCut[2]) { if (sigP < 0) { registryDeDx.fill(HIST(kNclTPCDedxMomentumNegAfter[1]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { registryDeDx.fill(HIST(kNclTPCDedxMomentumPosAfter[1]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[2] && eta < EtaCut[3]) { + } else if (eta >= EtaCut[2] && eta < EtaCut[3]) { if (sigP < 0) { registryDeDx.fill(HIST(kNclTPCDedxMomentumNegAfter[2]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { registryDeDx.fill(HIST(kNclTPCDedxMomentumPosAfter[2]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[3] && eta < EtaCut[4]) { + } else if (eta >= EtaCut[3] && eta < EtaCut[4]) { if (sigP < 0) { registryDeDx.fill(HIST(kNclTPCDedxMomentumNegAfter[3]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { registryDeDx.fill(HIST(kNclTPCDedxMomentumPosAfter[3]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[4] && eta < EtaCut[5]) { + } else if (eta >= EtaCut[4] && eta < EtaCut[5]) { if (sigP < 0) { registryDeDx.fill(HIST(kNclTPCDedxMomentumNegAfter[4]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { registryDeDx.fill(HIST(kNclTPCDedxMomentumPosAfter[4]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[5] && eta < EtaCut[6]) { + } else if (eta >= EtaCut[5] && eta < EtaCut[6]) { if (sigP < 0) { registryDeDx.fill(HIST(kNclTPCDedxMomentumNegAfter[5]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { registryDeDx.fill(HIST(kNclTPCDedxMomentumPosAfter[5]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[6] && eta < EtaCut[7]) { + } else if (eta >= EtaCut[6] && eta < EtaCut[7]) { if (sigP < 0) { registryDeDx.fill(HIST(kNclTPCDedxMomentumNegAfter[6]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { registryDeDx.fill(HIST(kNclTPCDedxMomentumPosAfter[6]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[7] && eta < EtaCut[8]) { + } else if (eta >= EtaCut[7] && eta < EtaCut[8]) { if (sigP < 0) { registryDeDx.fill(HIST(kNclTPCDedxMomentumNegAfter[7]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { @@ -785,114 +1030,114 @@ struct DedxPidAnalysis { return true; } - // NclCutITS + // NclPIDCutTPC template - bool passedNITSClCutPri(const T& trk) + bool passedNClTPCPIDCutPri(const T& trk) { float eta = trk.eta(); - float sigP = trk.sign() * trk.tpcInnerParam(); - auto nITSCl = trk.itsNCls(); + float sigP = trk.sign() * getMomentum(trk); + auto nTPCCl = trk.tpcNClsPID(); - if (eta > EtaCut[0] && eta < EtaCut[1]) { + if (eta >= EtaCut[0] && eta < EtaCut[1]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclITSDedxMomentumNegBefore[0]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumNegBefore[0]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclITSDedxMomentumPosBefore[0]), nITSCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumPosBefore[0]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[1] && eta < EtaCut[2]) { + } else if (eta >= EtaCut[1] && eta < EtaCut[2]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclITSDedxMomentumNegBefore[1]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumNegBefore[1]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclITSDedxMomentumPosBefore[1]), nITSCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumPosBefore[1]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[2] && eta < EtaCut[3]) { + } else if (eta >= EtaCut[2] && eta < EtaCut[3]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclITSDedxMomentumNegBefore[2]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumNegBefore[2]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclITSDedxMomentumPosBefore[2]), nITSCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumPosBefore[2]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[3] && eta < EtaCut[4]) { + } else if (eta >= EtaCut[3] && eta < EtaCut[4]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclITSDedxMomentumNegBefore[3]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumNegBefore[3]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclITSDedxMomentumPosBefore[3]), nITSCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumPosBefore[3]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[4] && eta < EtaCut[5]) { + } else if (eta >= EtaCut[4] && eta < EtaCut[5]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclITSDedxMomentumNegBefore[4]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumNegBefore[4]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclITSDedxMomentumPosBefore[4]), nITSCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumPosBefore[4]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[5] && eta < EtaCut[6]) { + } else if (eta >= EtaCut[5] && eta < EtaCut[6]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclITSDedxMomentumNegBefore[5]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumNegBefore[5]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclITSDedxMomentumPosBefore[5]), nITSCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumPosBefore[5]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[6] && eta < EtaCut[7]) { + } else if (eta >= EtaCut[6] && eta < EtaCut[7]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclITSDedxMomentumNegBefore[6]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumNegBefore[6]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclITSDedxMomentumPosBefore[6]), nITSCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumPosBefore[6]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[7] && eta < EtaCut[8]) { + } else if (eta >= EtaCut[7] && eta < EtaCut[8]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclITSDedxMomentumNegBefore[7]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumNegBefore[7]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclITSDedxMomentumPosBefore[7]), nITSCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumPosBefore[7]), nTPCCl, trk.tpcSignal(), sigP); } } - if (nITSCl < minITSnCls) + if (nTPCCl < minTPCnClsPID) return false; - if (eta > EtaCut[0] && eta < EtaCut[1]) { + if (eta >= EtaCut[0] && eta < EtaCut[1]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclITSDedxMomentumNegAfter[0]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumNegAfter[0]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclITSDedxMomentumPosAfter[0]), nITSCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumPosAfter[0]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[1] && eta < EtaCut[2]) { + } else if (eta >= EtaCut[1] && eta < EtaCut[2]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclITSDedxMomentumNegAfter[1]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumNegAfter[1]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclITSDedxMomentumPosAfter[1]), nITSCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumPosAfter[1]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[2] && eta < EtaCut[3]) { + } else if (eta >= EtaCut[2] && eta < EtaCut[3]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclITSDedxMomentumNegAfter[2]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumNegAfter[2]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclITSDedxMomentumPosAfter[2]), nITSCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumPosAfter[2]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[3] && eta < EtaCut[4]) { + } else if (eta >= EtaCut[3] && eta < EtaCut[4]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclITSDedxMomentumNegAfter[3]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumNegAfter[3]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclITSDedxMomentumPosAfter[3]), nITSCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumPosAfter[3]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[4] && eta < EtaCut[5]) { + } else if (eta >= EtaCut[4] && eta < EtaCut[5]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclITSDedxMomentumNegAfter[4]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumNegAfter[4]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclITSDedxMomentumPosAfter[4]), nITSCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumPosAfter[4]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[5] && eta < EtaCut[6]) { + } else if (eta >= EtaCut[5] && eta < EtaCut[6]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclITSDedxMomentumNegAfter[5]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumNegAfter[5]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclITSDedxMomentumPosAfter[5]), nITSCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumPosAfter[5]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[6] && eta < EtaCut[7]) { + } else if (eta >= EtaCut[6] && eta < EtaCut[7]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclITSDedxMomentumNegAfter[6]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumNegAfter[6]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclITSDedxMomentumPosAfter[6]), nITSCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumPosAfter[6]), nTPCCl, trk.tpcSignal(), sigP); } - } else if (eta > EtaCut[7] && eta < EtaCut[8]) { + } else if (eta >= EtaCut[7] && eta < EtaCut[8]) { if (sigP < 0) { - registryDeDx.fill(HIST(kNclITSDedxMomentumNegAfter[7]), nITSCl, trk.tpcSignal(), std::abs(sigP)); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumNegAfter[7]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); } else { - registryDeDx.fill(HIST(kNclITSDedxMomentumPosAfter[7]), nITSCl, trk.tpcSignal(), sigP); + registryDeDx.fill(HIST(kNclPIDTPCDedxMomentumPosAfter[7]), nTPCCl, trk.tpcSignal(), sigP); } } @@ -928,7 +1173,7 @@ struct DedxPidAnalysis { // NclCutTPC template - bool passedNTPCClCutSecondaries(const T& trk) + bool passedNClTPCFoundCutSecondaries(const T& trk) { auto nTPCCl = trk.tpcNClsFound(); @@ -938,13 +1183,13 @@ struct DedxPidAnalysis { return true; } - // NclCutITS primary + // NclCutPIDTPC secondary template - bool passedNITSClCutSecondaries(const T& trk) + bool passedNClTPCPIDCutSecondaries(const T& trk) { - auto nITSCl = trk.itsNCls(); + auto nTPCCl = trk.tpcNClsPID(); - if (nITSCl < minITSnCls) + if (nTPCCl < minTPCnClsPID) return false; return true; @@ -984,6 +1229,10 @@ struct DedxPidAnalysis { const uint64_t timeStamp{foundBC.timestamp()}; const int magField{getMagneticField(timeStamp)}; + float centrality = collision.centFT0C(); + if (centrality < CentClasses[0] || centrality > CentClasses[10]) + return; + for (const auto& trk : tracks) { registryDeDx.fill(HIST("trackselAll"), TrkPriCutLabel::AllPri); // track Selection @@ -998,24 +1247,29 @@ struct DedxPidAnalysis { continue; } registryDeDx.fill(HIST("trackselAll"), TrkPriCutLabel::PhiVarCutPri); - // NCl cut ITS - if (nTPCClCut) { - if (!passedNTPCClCutPri(trk)) + + // NCl cut TPC + registryDeDx.fill(HIST("heta_vs_NclFound_TPC_Before_Primary"), trk.eta(), trk.tpcNClsFound()); + if (nClTPCFoundCut) { + if (!passedNClTPCFoundCutPri(trk)) continue; } - registryDeDx.fill(HIST("trackselAll"), TrkPriCutLabel::NTPCClCutPri); + registryDeDx.fill(HIST("trackselAll"), TrkPriCutLabel::NClTPCFoundCutPri); + registryDeDx.fill(HIST("heta_vs_NclFound_TPC_After_Primary"), trk.eta(), trk.tpcNClsFound()); - // NCl cut ITS - if (nITSClCut) { - if (!passedNITSClCutPri(trk)) + // NCl cut PID TPC + registryDeDx.fill(HIST("heta_vs_NclPID_TPC_Before_Primary"), trk.eta(), trk.tpcNClsPID()); + if (nClTPCPIDCut) { + if (!passedNClTPCPIDCutPri(trk)) continue; } - registryDeDx.fill(HIST("trackselAll"), TrkPriCutLabel::NITSClCutPri); + registryDeDx.fill(HIST("trackselAll"), TrkPriCutLabel::NClTPCPIDCutPri); + registryDeDx.fill(HIST("heta_vs_NclPID_TPC_After_Primary"), trk.eta(), trk.tpcNClsPID()); - float signedP = trk.sign() * trk.tpcInnerParam(); + float signedP = trk.sign() * getMomentum(trk); // MIP calibration for pions - if (trk.tpcInnerParam() >= pionMin && trk.tpcInnerParam() <= pionMax) { + if (getMomentum(trk) >= pionMin && getMomentum(trk) <= pionMax) { if (calibrationMode) { if (signedP < 0) { registryDeDx.fill(HIST("hdEdx_vs_eta_Neg_Pi"), trk.eta(), trk.tpcSignal()); @@ -1025,7 +1279,7 @@ struct DedxPidAnalysis { } else { for (int i = 0; i < kEtaIntervals; ++i) { - if (trk.eta() > EtaCut[i] && trk.eta() < EtaCut[i + 1]) { + if (trk.eta() >= EtaCut[i] && trk.eta() < EtaCut[i + 1]) { if (signedP < 0) { registryDeDx.fill(HIST("hdEdx_vs_eta_Neg_calibrated_Pi"), trk.eta(), trk.tpcSignal() * 50 / calibrationFactorNeg->at(i)); } else { @@ -1051,7 +1305,7 @@ struct DedxPidAnalysis { } } else { for (int i = 0; i < kEtaIntervals; ++i) { - if (trk.eta() > EtaCut[i] && trk.eta() < EtaCut[i + 1]) { + if (trk.eta() >= EtaCut[i] && trk.eta() < EtaCut[i + 1]) { if (signedP < 0) { registryDeDx.fill(HIST("hdEdx_vs_eta_vs_p_Neg_calibrated_El"), trk.eta(), trk.tpcSignal() * 50 / calibrationFactorNeg->at(i), std::abs(signedP)); } else { @@ -1071,7 +1325,7 @@ struct DedxPidAnalysis { } } else { for (int i = 0; i < kEtaIntervals; ++i) { - if (trk.eta() > EtaCut[i] && trk.eta() < EtaCut[i + 1]) { + if (trk.eta() >= EtaCut[i] && trk.eta() < EtaCut[i + 1]) { if (signedP < 0) { registryDeDx.fill(HIST("hdEdx_vs_eta_vs_p_Neg_calibrated_TOF"), trk.eta(), trk.tpcSignal() * 50 / calibrationFactorNeg->at(i), std::abs(signedP)); } else { @@ -1085,14 +1339,26 @@ struct DedxPidAnalysis { registryDeDx.fill(HIST("hdEdx_vs_phi"), trk.phi(), trk.tpcSignal()); if (!calibrationMode) { + int centIndex = -1; + for (int j = 0; j < kCentralityClasses; ++j) { + if (centrality >= CentClasses[j] && centrality < CentClasses[j + 1]) { + centIndex = j; + break; + } + } + if (centIndex == -1) + continue; + for (int i = 0; i < kEtaIntervals; ++i) { - if (trk.eta() > EtaCut[i] && trk.eta() < EtaCut[i + 1]) { + if (trk.eta() >= EtaCut[i] && trk.eta() < EtaCut[i + 1]) { if (signedP > 0) { registryDeDx.fill(HIST(kDedxvsMomentumPos[0]), signedP, trk.tpcSignal() * 50 / calibrationFactorPos->at(i), trk.eta()); - registryDeDx.fill(HIST("heta_vs_p_vs_pt_all_Pos"), trk.eta(), trk.pt(), signedP); + registryDeDx.fill(HIST("heta_vs_pt_vs_p_all_Pos"), trk.eta(), trk.pt(), trk.p()); + hDedxVsMomentumVsCentPos[centIndex]->Fill(signedP, trk.tpcSignal() * 50 / calibrationFactorPos->at(i), trk.eta()); } else { registryDeDx.fill(HIST(kDedxvsMomentumNeg[0]), std::abs(signedP), trk.tpcSignal() * 50 / calibrationFactorNeg->at(i), trk.eta()); - registryDeDx.fill(HIST("heta_vs_p_vs_pt_all_Neg"), trk.eta(), trk.pt(), std::abs(signedP)); + registryDeDx.fill(HIST("heta_vs_pt_vs_p_all_Neg"), trk.eta(), trk.pt(), trk.p()); + hDedxVsMomentumVsCentNeg[centIndex]->Fill(std::abs(signedP), trk.tpcSignal() * 50 / calibrationFactorNeg->at(i), trk.eta()); } } } @@ -1105,6 +1371,13 @@ struct DedxPidAnalysis { // Standard V0 Selections registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::AllSec); + + // Select V0 type + if (v0.v0Type() != v0TypeSelection) + continue; + + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0Type); + if (!passedV0Selection(v0, collision)) { continue; } @@ -1129,63 +1402,67 @@ struct DedxPidAnalysis { } registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel ::PhiVarCutSec); - if (nTPCClCut) { - if (!passedNTPCClCutSecondaries(posTrack)) + fillHist = false; + // K0s Selection + if (passedK0Selection(v0, negTrack, posTrack, collision)) { + registryDeDx.fill(HIST("heta_vs_NclPID_TPC_Before_PionsK0s"), posTrack.eta(), posTrack.tpcNClsPID()); + registryDeDx.fill(HIST("heta_vs_NclPID_TPC_Before_PionsK0s"), negTrack.eta(), negTrack.tpcNClsPID()); + registryDeDx.fill(HIST("hp_vs_NclPID_TPC_Before_PionsK0s"), posTrack.p(), posTrack.tpcNClsPID()); + registryDeDx.fill(HIST("hp_vs_NclPID_TPC_Before_PionsK0s"), negTrack.p(), negTrack.tpcNClsPID()); + } + // Lambda Selection + if (passedLambdaSelection(v0, negTrack, posTrack, collision)) { + registryDeDx.fill(HIST("heta_vs_NclPID_TPC_Before_ProtonsLambda"), posTrack.eta(), posTrack.tpcNClsPID()); + registryDeDx.fill(HIST("heta_vs_NclPID_TPC_Before_PionsLambda"), negTrack.eta(), negTrack.tpcNClsPID()); + registryDeDx.fill(HIST("hp_vs_NclPID_TPC_Before_ProtonsLambda"), posTrack.p(), posTrack.tpcNClsPID()); + registryDeDx.fill(HIST("hp_vs_NclPID_TPC_Before_PionsLambda"), negTrack.p(), negTrack.tpcNClsPID()); + } + // AntiLambda Selection + if (passedAntiLambdaSelection(v0, negTrack, posTrack, collision)) { + registryDeDx.fill(HIST("heta_vs_NclPID_TPC_Before_PionsLambda"), posTrack.eta(), posTrack.tpcNClsPID()); + registryDeDx.fill(HIST("heta_vs_NclPID_TPC_Before_ProtonsLambda"), negTrack.eta(), negTrack.tpcNClsPID()); + registryDeDx.fill(HIST("hp_vs_NclPID_TPC_Before_PionsLambda"), posTrack.p(), posTrack.tpcNClsPID()); + registryDeDx.fill(HIST("hp_vs_NclPID_TPC_Before_ProtonsLambda"), negTrack.p(), negTrack.tpcNClsPID()); + } + // Gamma Selection + if (passedGammaSelection(v0, negTrack, posTrack, collision)) { + registryDeDx.fill(HIST("heta_vs_NclPID_TPC_Before_ElectronsGamma"), posTrack.eta(), posTrack.tpcNClsPID()); + registryDeDx.fill(HIST("heta_vs_NclPID_TPC_Before_ElectronsGamma"), negTrack.eta(), negTrack.tpcNClsPID()); + registryDeDx.fill(HIST("hp_vs_NclPID_TPC_Before_ElectronsGamma"), posTrack.p(), posTrack.tpcNClsPID()); + registryDeDx.fill(HIST("hp_vs_NclPID_TPC_Before_ElectronsGamma"), negTrack.p(), negTrack.tpcNClsPID()); + } + + if (nClTPCFoundCut) { + if (!passedNClTPCFoundCutSecondaries(posTrack)) continue; - if (!passedNTPCClCutSecondaries(negTrack)) + if (!passedNClTPCFoundCutSecondaries(negTrack)) continue; } - registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel ::NTPCClCutSec); + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel ::NClTPCFoundCutSec); - if (nITSClCut) { - if (!passedNITSClCutSecondaries(posTrack)) + if (nClTPCPIDCut) { + if (!passedNClTPCPIDCutSecondaries(posTrack)) continue; - if (!passedNITSClCutSecondaries(negTrack)) + if (!passedNClTPCPIDCutSecondaries(negTrack)) continue; } - registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel ::NITSClCutSec); - - float signedPpos = posTrack.sign() * posTrack.tpcInnerParam(); - float signedPneg = negTrack.sign() * negTrack.tpcInnerParam(); - - float pxPos = posTrack.px(); - float pyPos = posTrack.py(); - float pzPos = posTrack.pz(); + registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel ::NClTPCPIDCutSec); - float pxNeg = negTrack.px(); - float pyNeg = negTrack.py(); - float pzNeg = negTrack.pz(); + float signedPpos = posTrack.sign() * getMomentum(posTrack); + float signedPneg = negTrack.sign() * getMomentum(negTrack); - const float gammaMass = 2 * MassElectron; // GeV/c^2 + fillHist = true; // K0s Selection if (passedK0Selection(v0, negTrack, posTrack, collision)) { - registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::AllK0s); - - if (std::abs(v0.rapidity(MassK0Short)) > v0rapidityCut) - continue; - - registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0RapidityK0s); - float properLifetime = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * MassK0Short; - - if (properLifetime > v0ProperLifetimeCutK0s) - continue; - - registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0ProperLifetimeK0s); - - float ePosPi = posTrack.energy(MassPionCharged); - float eNegPi = negTrack.energy(MassPionCharged); - - float invMass = std::sqrt((eNegPi + ePosPi) * (eNegPi + ePosPi) - ((pxNeg + pxPos) * (pxNeg + pxPos) + (pyNeg + pyPos) * (pyNeg + pyPos) + (pzNeg + pzPos) * (pzNeg + pzPos))); - - if (std::abs(invMass - MassK0Short) > invMassCut) { - continue; - } - + registryDeDx.fill(HIST("heta_vs_NclPID_TPC_After_PionsK0s"), posTrack.eta(), posTrack.tpcNClsPID()); + registryDeDx.fill(HIST("heta_vs_NclPID_TPC_After_PionsK0s"), negTrack.eta(), negTrack.tpcNClsPID()); + registryDeDx.fill(HIST("hp_vs_NclPID_TPC_After_PionsK0s"), posTrack.p(), posTrack.tpcNClsPID()); + registryDeDx.fill(HIST("hp_vs_NclPID_TPC_After_PionsK0s"), negTrack.p(), negTrack.tpcNClsPID()); for (int i = 0; i < kEtaIntervals; ++i) { if (negTrack.eta() > EtaCut[i] && negTrack.eta() < EtaCut[i + 1]) { registryDeDx.fill(HIST(kDedxvsMomentumNeg[1]), std::abs(signedPneg), negTrack.tpcSignal() * 50 / calibrationFactorNeg->at(i), negTrack.eta()); @@ -1198,28 +1475,10 @@ struct DedxPidAnalysis { // Lambda Selection if (passedLambdaSelection(v0, negTrack, posTrack, collision)) { - registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::AllLambda); - - if (std::abs(v0.rapidity(MassLambda)) > v0rapidityCut) - continue; - - registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0RapidityLambda); - float properLifetime = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * MassLambda; - - if (properLifetime > v0ProperLifetimeCutLambda) - continue; - - registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0ProperLifetimeLambda); - - float ePosPr = posTrack.energy(MassProton); - float eNegPi = negTrack.energy(MassPionCharged); - - float invMass = std::sqrt((eNegPi + ePosPr) * (eNegPi + ePosPr) - ((pxNeg + pxPos) * (pxNeg + pxPos) + (pyNeg + pyPos) * (pyNeg + pyPos) + (pzNeg + pzPos) * (pzNeg + pzPos))); - - if (std::abs(invMass - MassLambda) > invMassCut) { - continue; - } - + registryDeDx.fill(HIST("heta_vs_NclPID_TPC_After_ProtonsLambda"), posTrack.eta(), posTrack.tpcNClsPID()); + registryDeDx.fill(HIST("heta_vs_NclPID_TPC_After_PionsLambda"), negTrack.eta(), negTrack.tpcNClsPID()); + registryDeDx.fill(HIST("hp_vs_NclPID_TPC_After_ProtonsLambda"), posTrack.p(), posTrack.tpcNClsPID()); + registryDeDx.fill(HIST("hp_vs_NclPID_TPC_After_PionsLambda"), negTrack.p(), negTrack.tpcNClsPID()); for (int i = 0; i < kEtaIntervals; ++i) { if (negTrack.eta() > EtaCut[i] && negTrack.eta() < EtaCut[i + 1]) { registryDeDx.fill(HIST(kDedxvsMomentumNeg[1]), std::abs(signedPneg), negTrack.tpcSignal() * 50 / calibrationFactorNeg->at(i), negTrack.eta()); @@ -1232,28 +1491,10 @@ struct DedxPidAnalysis { // AntiLambda Selection if (passedAntiLambdaSelection(v0, negTrack, posTrack, collision)) { - registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::AllAntiLambda); - - if (std::abs(v0.rapidity(MassLambda)) > v0rapidityCut) - continue; - - registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0RapidityAntiLambda); - float properLifetime = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * MassLambda; - - if (properLifetime > v0ProperLifetimeCutLambda) - continue; - - registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::V0ProperLifetimeAntiLambda); - - float ePosPi = posTrack.energy(MassPionCharged); - float eNegPr = negTrack.energy(MassProton); - - float invMass = std::sqrt((eNegPr + ePosPi) * (eNegPr + ePosPi) - ((pxNeg + pxPos) * (pxNeg + pxPos) + (pyNeg + pyPos) * (pyNeg + pyPos) + (pzNeg + pzPos) * (pzNeg + pzPos))); - - if (std::abs(invMass - MassLambda) > invMassCut) { - continue; - } - + registryDeDx.fill(HIST("heta_vs_NclPID_TPC_After_PionsLambda"), posTrack.eta(), posTrack.tpcNClsPID()); + registryDeDx.fill(HIST("heta_vs_NclPID_TPC_After_ProtonsLambda"), negTrack.eta(), negTrack.tpcNClsPID()); + registryDeDx.fill(HIST("hp_vs_NclPID_TPC_After_PionsLambda"), posTrack.p(), posTrack.tpcNClsPID()); + registryDeDx.fill(HIST("hp_vs_NclPID_TPC_After_ProtonsLambda"), negTrack.p(), negTrack.tpcNClsPID()); for (int i = 0; i < kEtaIntervals; ++i) { if (negTrack.eta() > EtaCut[i] && negTrack.eta() < EtaCut[i + 1]) { registryDeDx.fill(HIST(kDedxvsMomentumNeg[2]), std::abs(signedPneg), negTrack.tpcSignal() * 50 / calibrationFactorNeg->at(i), negTrack.eta()); @@ -1266,17 +1507,10 @@ struct DedxPidAnalysis { // Gamma Selection if (passedGammaSelection(v0, negTrack, posTrack, collision)) { - registryDeDx.fill(HIST("trackselSec"), TrkSecCutLabel::AllGamma); - - float ePosEl = posTrack.energy(MassElectron); - float eNegEl = negTrack.energy(MassElectron); - - float invMass = std::sqrt((eNegEl + ePosEl) * (eNegEl + ePosEl) - ((pxNeg + pxPos) * (pxNeg + pxPos) + (pyNeg + pyPos) * (pyNeg + pyPos) + (pzNeg + pzPos) * (pzNeg + pzPos))); - - if (std::abs(invMass - gammaMass) > invMassCutGamma) { - continue; - } - + registryDeDx.fill(HIST("heta_vs_NclPID_TPC_After_ElectronsGamma"), posTrack.eta(), posTrack.tpcNClsPID()); + registryDeDx.fill(HIST("heta_vs_NclPID_TPC_After_ElectronsGamma"), negTrack.eta(), negTrack.tpcNClsPID()); + registryDeDx.fill(HIST("hp_vs_NclPID_TPC_After_ElectronsGamma"), posTrack.p(), posTrack.tpcNClsPID()); + registryDeDx.fill(HIST("hp_vs_NclPID_TPC_After_ElectronsGamma"), negTrack.p(), negTrack.tpcNClsPID()); for (int i = 0; i < kEtaIntervals; ++i) { if (negTrack.eta() > EtaCut[i] && negTrack.eta() < EtaCut[i + 1]) { registryDeDx.fill(HIST(kDedxvsMomentumNeg[3]), std::abs(signedPneg), negTrack.tpcSignal() * 50 / calibrationFactorNeg->at(i), negTrack.eta()); From ad70bf8ede588301d7121ae5e7395572bc3c2b16 Mon Sep 17 00:00:00 2001 From: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Date: Sun, 5 Oct 2025 16:43:20 +0200 Subject: [PATCH 630/986] [PWGCF] fill trigger separately, fix FT0A-FT0C container bug (#13237) --- .../Tasks/longRangeDihadronCor.cxx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx b/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx index f06a8fa062b..7d7000a5862 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx @@ -279,7 +279,8 @@ struct LongRangeDihadronCor { registry.add("Centrality_used", hCentTitle.c_str(), {HistType::kTH1D, {{100, 0, 100}}}); // histogram to see how many events are in the same and mixed event registry.add("zVtx", "zVtx", {HistType::kTH1D, {axisVertex}}); registry.add("zVtx_used", "zVtx_used", {HistType::kTH1D, {axisVertex}}); - registry.add("Trig_hist", "", {HistType::kTHnSparseF, {{axisSample, axisVertex, axisPtTrigger}}}); + registry.add("Trig_hist_TPC_FT0A", "", {HistType::kTHnSparseF, {{axisSample, axisVertex, axisPtTrigger}}}); + registry.add("Trig_hist_TPC_FT0C", "", {HistType::kTHnSparseF, {{axisSample, axisVertex, axisPtTrigger}}}); registry.add("FT0Amp", "", {HistType::kTH2F, {axisChID, axisFit}}); registry.add("FT0AmpCorrect", "", {HistType::kTH2F, {axisChID, axisFit}}); registry.add("FT0Cmp", "", {HistType::kTH2F, {axisChID, axisFit}}); @@ -558,7 +559,11 @@ struct LongRangeDihadronCor { if (!getEfficiencyCorrection(triggerWeight, track1.eta(), track1.pt(), posZ)) continue; if (system == SameEvent) { - registry.fill(HIST("Trig_hist"), fSampleIndex, posZ, track1.pt(), eventWeight * triggerWeight); + if (corType == kFT0C) { + registry.fill(HIST("Trig_hist_TPC_FT0C"), fSampleIndex, posZ, track1.pt(), eventWeight * triggerWeight); + } else if (corType == kFT0A) { + registry.fill(HIST("Trig_hist_TPC_FT0A"), fSampleIndex, posZ, track1.pt(), eventWeight * triggerWeight); + } } std::size_t channelSize = 0; @@ -630,10 +635,10 @@ struct LongRangeDihadronCor { float deltaEta = etaA - etaC; // fill the right sparse and histograms if (system == SameEvent) { - sameFt0aFt0c->getPairHist()->Fill(step, fSampleIndex, posZ, 0., 0., deltaPhi, deltaEta, amplA * amplC * eventWeight * triggerWeight); + sameFt0aFt0c->getPairHist()->Fill(step, fSampleIndex, posZ, 0.5, 0.5, deltaPhi, deltaEta, amplA * amplC * eventWeight * triggerWeight); registry.fill(HIST("deltaEta_deltaPhi_same_FT0A_FT0C"), deltaPhi, deltaEta, amplA * amplC * eventWeight * triggerWeight); } else if (system == MixedEvent) { - mixedFt0aFt0c->getPairHist()->Fill(step, fSampleIndex, posZ, 0., 0., deltaPhi, deltaEta, amplA * amplC * eventWeight * triggerWeight); + mixedFt0aFt0c->getPairHist()->Fill(step, fSampleIndex, posZ, 0.5, 0.5, deltaPhi, deltaEta, amplA * amplC * eventWeight * triggerWeight); registry.fill(HIST("deltaEta_deltaPhi_mixed_FT0A_FT0C"), deltaPhi, deltaEta, amplA * amplC * eventWeight * triggerWeight); } } From 716ee17bc5b53d7fbcebdd88536fc720d4dcb6c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?BiaoZhang=20=28=E5=BC=A0=E5=BD=AA=29?= <52267892+zhangbiao-phy@users.noreply.github.com> Date: Sun, 5 Oct 2025 19:11:06 +0200 Subject: [PATCH 631/986] [PWGHF,PWGCF] fix the issue of int configurable caste to int8_t and add QA plot of charm mass vs pt in MC rec (#13240) --- PWGCF/DataModel/FemtoDerived.h | 10 +++++----- PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx | 12 +++++++++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/PWGCF/DataModel/FemtoDerived.h b/PWGCF/DataModel/FemtoDerived.h index 80bdd64539f..be637c38d8c 100644 --- a/PWGCF/DataModel/FemtoDerived.h +++ b/PWGCF/DataModel/FemtoDerived.h @@ -245,14 +245,14 @@ DECLARE_SOA_COLUMN(Prong2Eta, prong2Eta, float); //! Track et DECLARE_SOA_COLUMN(Prong0Phi, prong0Phi, float); //! Track phi of charm hadron prong0 DECLARE_SOA_COLUMN(Prong1Phi, prong1Phi, float); //! Track phi of charm hadron prong1 DECLARE_SOA_COLUMN(Prong2Phi, prong2Phi, float); //! Track phi of charm hadron prong2 -DECLARE_SOA_COLUMN(CandidateSelFlag, candidateSelFlag, int8_t); //! Selection of mass hypothesis for charm hadron (1 for Lc -> pkpi, 2 for Lc -> pikp, 4 for D+ -> pikpi) +DECLARE_SOA_COLUMN(CandidateSelFlag, candidateSelFlag, int); //! Selection of mass hypothesis for charm hadron (1 for Lc -> pkpi, 2 for Lc -> pikp, 4 for D+ -> pikpi) DECLARE_SOA_COLUMN(BDTBkg, bdtBkg, float); //! Background score using Boosted Decision Tree for charm hadron DECLARE_SOA_COLUMN(BDTPrompt, bdtPrompt, float); //! Prompt signal score using Boosted Decision Tree for charm hadron DECLARE_SOA_COLUMN(BDTFD, bdtFD, float); //! Feed-down score using Boosted Decision Tree for charm hadron -DECLARE_SOA_COLUMN(FlagMc, flagMc, int8_t); //! To select MC particle among charm hadrons, { DplusToPiKPi = 1, LcToPKPi = 2, DsToKKPi = 4, XicToPKP = 8, N3ProngD = 2ecays }; -DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t); //! flag for reconstruction level matching (1 for prompt, 2 for non-prompt) -DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); //! flag for generator level matching (1 for prompt, 2 for non-prompt) -DECLARE_SOA_COLUMN(IsCandidateSwapped, isCandidateSwapped, int8_t); //! swapping of the prongs order (0 for Lc -> pkpi, 1 for Lc -> pikp) +DECLARE_SOA_COLUMN(FlagMc, flagMc, int); //! To select MC particle among charm hadrons, { DplusToPiKPi = 1, LcToPKPi = 17, DsToKKPi = 6, XicToPKPi = 21, N3ProngD = 2ecays }; +DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int); //! flag for reconstruction level matching (1 for prompt, 2 for non-prompt) +DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int); //! flag for generator level matching (1 for prompt, 2 for non-prompt) +DECLARE_SOA_COLUMN(IsCandidateSwapped, isCandidateSwapped, int); //! swapping of the prongs order (0 for Lc -> pkpi, 1 for Lc -> pikp) DECLARE_SOA_COLUMN(TrkPt, trkPt, float); //! Transverse momentum of associate femto particle DECLARE_SOA_COLUMN(TrkEta, trkEta, float); //! Eta of associate femto particle DECLARE_SOA_COLUMN(TrkPhi, trkPhi, float); //! Phi of associate femto particle diff --git a/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx b/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx index 6eaf4922d9e..de58e448ca7 100644 --- a/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx +++ b/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx @@ -160,8 +160,8 @@ struct HfTaskCharmHadronsFemtoDream { Filter eventMultiplicity = aod::femtodreamcollision::multNtr >= eventSel.multMin && aod::femtodreamcollision::multNtr <= eventSel.multMax; Filter eventMultiplicityPercentile = aod::femtodreamcollision::multV0M >= eventSel.multPercentileMin && aod::femtodreamcollision::multV0M <= eventSel.multPercentileMax; - Filter hfCandSelFilter = aod::fdhf::candidateSelFlag >= static_cast(charmHadCandSel.value); - Filter hfMcSelFilter = nabs(aod::fdhf::flagMc) == static_cast(charmHadMcSel.value); + Filter hfCandSelFilter = aod::fdhf::candidateSelFlag >= charmHadCandSel; + Filter hfMcSelFilter = (nabs(aod::fdhf::flagMc) == charmHadMcSel); Filter trackEtaFilterLow = ifnode(aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack), aod::femtodreamparticle::eta < etaTrack1Max, true); Filter trackEtaFilterUp = ifnode(aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack), aod::femtodreamparticle::eta > etaTrack1Min, true); Filter trackPtFilterLow = ifnode(aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack), aod::femtodreamparticle::pt < ptTrack1Max, true); @@ -583,7 +583,7 @@ struct HfTaskCharmHadronsFemtoDream { part.tpcNSigmaPr(), part.tofNSigmaPr()); } - if (!sliceCharmHad.size() || !sliceTrk1.size()) { + if (sliceCharmHad.size() > 0 || sliceTrk1.size() > 0) { rowFemtoResultColl( col.globalIndex(), timeStamp, @@ -592,6 +592,7 @@ struct HfTaskCharmHadronsFemtoDream { } else { return; } + doSameEvent(sliceTrk1, sliceCharmHad, parts, col); } PROCESS_SWITCH(HfTaskCharmHadronsFemtoDream, processSameEvent, "Enable processing same event", false); @@ -631,6 +632,11 @@ struct HfTaskCharmHadronsFemtoDream { auto sliceMcTrk1 = partitionMcTrk1->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); auto sliceMcCharmHad = partitionMcCharmHadron->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); + if (sliceMcCharmHad.size() > 0) { + for (auto const& part : sliceMcCharmHad) { + registryCharmHadronQa.fill(HIST("CharmHadronQA/hPtVsMass"), part.pt(), getCharmHadronMass(part)); + } + } if (sliceMcTrk1.size() == 0 && sliceMcCharmHad.size() == 0) { return; } From 241e0fae251a7df30c91b71f51fdff166ccdfa10 Mon Sep 17 00:00:00 2001 From: Gyula Bencedi Date: Mon, 6 Oct 2025 00:40:19 +0200 Subject: [PATCH 632/986] [PWGLF] Added explicit track selection for reassociation (#13243) --- PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx | 91 ++++++++++++++++++++---------- 1 file changed, 61 insertions(+), 30 deletions(-) diff --git a/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx b/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx index 44904fffb38..85dd80b7bf8 100644 --- a/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx +++ b/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx @@ -60,6 +60,9 @@ using namespace o2::aod::rctsel; auto static constexpr kMinCharge = 3.f; auto static constexpr kNumDecay = 4; +auto static constexpr kIntZero = 0; +auto static constexpr kZero = 0.f; +auto static constexpr kIntOne = 1; enum TrkSel { trkSelAll, @@ -72,11 +75,14 @@ enum TrkSel { nTrkSel }; -enum TrkAmbSel { - trkSelAmbiguousAll, - trkSelWoAmbiguous, - trkSelNumReassoc, - nTrkAmbSel +enum TrkBestSel { + trkBestSelAll, + trkBestSelCollID, + trkBestSelDCAxyCut, + trkBestSelDCAzCut, + trkBestSelWoAmbiguous, + trkBestSelNumReassoc, + nTrkBestSel }; struct DndetaMFTPbPb { @@ -288,10 +294,13 @@ struct DndetaMFTPbPb { hev->GetXaxis()->SetBinLabel(13, "Above max occup."); hev->GetXaxis()->SetBinLabel(14, "RCT Flag Checker"); - registry.add("Tracks/hAmbTrkSel", "Number of ambiguous tracks; Cut; #Tracks Passed Cut", {HistType::kTH1F, {{nTrkAmbSel, -0.5, +nTrkAmbSel - 0.5}}}); - registry.get(HIST("Tracks/hAmbTrkSel"))->GetXaxis()->SetBinLabel(trkSelAmbiguousAll + 1, "All"); - registry.get(HIST("Tracks/hAmbTrkSel"))->GetXaxis()->SetBinLabel(trkSelWoAmbiguous + 1, "No Ambiguous"); - registry.get(HIST("Tracks/hAmbTrkSel"))->GetXaxis()->SetBinLabel(trkSelNumReassoc + 1, "Reassociated"); + registry.add("Tracks/hBestTrkSel", "Number of best tracks; Cut; #Tracks Passed Cut", {HistType::kTH1F, {{nTrkBestSel, -0.5, +nTrkBestSel - 0.5}}}); + registry.get(HIST("Tracks/hBestTrkSel"))->GetXaxis()->SetBinLabel(trkBestSelAll + 1, "All"); + registry.get(HIST("Tracks/hBestTrkSel"))->GetXaxis()->SetBinLabel(trkBestSelCollID + 1, "Assigned (ID>=0)"); + registry.get(HIST("Tracks/hBestTrkSel"))->GetXaxis()->SetBinLabel(trkBestSelDCAxyCut + 1, "DCA xy cut"); + registry.get(HIST("Tracks/hBestTrkSel"))->GetXaxis()->SetBinLabel(trkBestSelDCAzCut + 1, "DCA z cut"); + registry.get(HIST("Tracks/hBestTrkSel"))->GetXaxis()->SetBinLabel(trkBestSelWoAmbiguous + 1, "No Ambiguous"); + registry.get(HIST("Tracks/hBestTrkSel"))->GetXaxis()->SetBinLabel(trkBestSelNumReassoc + 1, "Reassociated"); registry.add("Tracks/hTrkSel", "Number of tracks; Cut; #Tracks Passed Cut", {HistType::kTH1F, {{nTrkSel, -0.5, +nTrkSel - 0.5}}}); registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelAll + 1, "All"); @@ -842,7 +851,7 @@ struct DndetaMFTPbPb { /// Filters - tracks Filter filtTrkEta = (aod::fwdtrack::eta < trackCuts.maxEta) && (aod::fwdtrack::eta > trackCuts.minEta); - Filter filtATrackID = (aod::fwdtrack::bestCollisionId >= 0); + Filter filtATrackID = (aod::fwdtrack::bestCollisionId >= kIntZero); Filter filtATrackDCAxy = (nabs(aod::fwdtrack::bestDCAXY) < trackCuts.maxDCAxy); Filter filtATrackDCAz = (nabs(aod::fwdtrack::bestDCAZ) < trackCuts.maxDCAz); @@ -852,6 +861,7 @@ struct DndetaMFTPbPb { /// Joined tables using FullBCs = soa::Join; using CollBCs = soa::Join; + // Collisions using Colls = soa::Join; using Coll = Colls::iterator; using CollsCentFT0C = soa::Join; @@ -866,7 +876,7 @@ struct DndetaMFTPbPb { aod::CentFT0Cs, aod::EvSels>; using CollGenCent = CollsGenCentFT0C::iterator; using CollsCorr = soa::Join; - + // Tracks using MFTTracksLabeled = soa::Join; using MftTracksWColls = soa::Join; @@ -876,10 +886,37 @@ struct DndetaMFTPbPb { using FiltBestTracks = soa::Filtered; using FiltParticles = soa::Filtered; - bool isHitAtDisk(uint16_t map, int ilayer) + template + bool isBestTrackSelected(const B& besttrack) { - LOGF(debug, " map %i --> %i", map, (map >> (ilayer * 6)) & 0x3F); - return (map >> (ilayer * 6)) & 0x3F; + if (fillHis) { + registry.fill(HIST("Tracks/hBestTrkSel"), trkBestSelAll); + } + if (besttrack.bestCollisionId() < kIntZero) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("Tracks/hBestTrkSel"), trkBestSelCollID); + } + if (std::abs(besttrack.bestDCAXY()) >= trackCuts.maxDCAxy) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("Tracks/hBestTrkSel"), trkBestSelDCAxyCut); + } + if (std::abs(besttrack.bestDCAZ()) >= trackCuts.maxDCAxy) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("Tracks/hBestTrkSel"), trkBestSelDCAzCut); + } + if (trackCuts.excludeAmbiguous && besttrack.ambDegree() > kIntOne) { + return false; + } + if (fillHis) { + registry.fill(HIST("Tracks/hBestTrkSel"), trkBestSelWoAmbiguous); + } + return true; } template @@ -962,7 +999,7 @@ struct DndetaMFTPbPb { if (fillHis) { float phi = track.phi(); o2::math_utils::bringTo02Pi(phi); - if (phi < 0.f || TwoPI < phi) { + if (phi < kZero || TwoPI < phi) { continue; } if constexpr (has_reco_cent) { @@ -993,15 +1030,9 @@ struct DndetaMFTPbPb { ambiguousTrkIds.reserve(besttracks.size()); reassignedTrkIds.reserve(besttracks.size()); for (auto const& atrack : besttracks) { - if (fillHis) { - registry.fill(HIST("Tracks/hAmbTrkSel"), trkSelAmbiguousAll); - } - if (trackCuts.excludeAmbiguous && atrack.ambDegree() > 1) { + if (!isBestTrackSelected(atrack)) { continue; } - if (fillHis) { - registry.fill(HIST("Tracks/hAmbTrkSel"), trkSelWoAmbiguous); - } auto itrack = atrack.template mfttrack_as(); if (!isTrackSelected(itrack)) { continue; @@ -1011,7 +1042,7 @@ struct DndetaMFTPbPb { if (fillHis) { float phi = itrack.phi(); o2::math_utils::bringTo02Pi(phi); - if (phi < 0.f || TwoPI < phi) { + if (phi < kZero || TwoPI < phi) { continue; } if constexpr (has_reco_cent) { @@ -1038,10 +1069,10 @@ struct DndetaMFTPbPb { if (itrack.has_collision() && itrack.collisionId() != atrack.bestCollisionId()) { reassignedTrkIds.emplace_back(atrack.mfttrackId()); if (fillHis) { - registry.fill(HIST("Tracks/hAmbTrkSel"), trkSelNumReassoc); + registry.fill(HIST("Tracks/hBestTrkSel"), trkBestSelNumReassoc); float phi = itrack.phi(); o2::math_utils::bringTo02Pi(phi); - if (phi < 0.f || TwoPI < phi) { + if (phi < kZero || TwoPI < phi) { continue; } if constexpr (has_reco_cent) { @@ -1069,7 +1100,7 @@ struct DndetaMFTPbPb { if (fillHis) { float phi = track.phi(); o2::math_utils::bringTo02Pi(phi); - if (phi < 0.f || TwoPI < phi) { + if (phi < kZero || TwoPI < phi) { continue; } if constexpr (has_reco_cent) { @@ -1291,7 +1322,7 @@ struct DndetaMFTPbPb { float phi = particle.phi(); o2::math_utils::bringTo02Pi(phi); - if (phi < 0.f || TwoPI < phi) { + if (phi < kZero || TwoPI < phi) { continue; } if constexpr (isCent) { @@ -1307,7 +1338,7 @@ struct DndetaMFTPbPb { if (gtZeroColl) { float phi = particle.phi(); o2::math_utils::bringTo02Pi(phi); - if (phi < 0.f || TwoPI < phi) { + if (phi < kZero || TwoPI < phi) { continue; } if constexpr (isCent) { @@ -2157,7 +2188,7 @@ struct DndetaMFTPbPb { for (auto const& track : besttracks) { ambiguousTrkIdsMC.emplace_back(track.mfttrackId()); - if (trackCuts.excludeAmbiguous && track.ambDegree() > 1) { + if (!isBestTrackSelected(track)) { continue; } auto itrack = track.mfttrack_as(); @@ -2639,7 +2670,7 @@ struct DndetaMFTPbPb { auto nBestTrks = 0; for (auto const& atrack : besttracks) { - if (trackCuts.excludeAmbiguous && atrack.ambDegree() > 1) { + if (cfgUseTrackSel && !isBestTrackSelected(atrack)) { continue; } auto itrack = atrack.template mfttrack_as(); From 9c92d10979cc57152c54bb3362d1dfe5d3b35573 Mon Sep 17 00:00:00 2001 From: tutripat <73981392+tutripat@users.noreply.github.com> Date: Mon, 6 Oct 2025 02:21:42 +0100 Subject: [PATCH 633/986] [PWGLF] Updates related to secondary corrections (#13244) Co-authored-by: ALICE Action Bot --- .../GlobalEventProperties/dndeta-mft-pp.cxx | 72 ++++++++++++------- 1 file changed, 48 insertions(+), 24 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/dndeta-mft-pp.cxx b/PWGLF/Tasks/GlobalEventProperties/dndeta-mft-pp.cxx index e75c5e32371..93b8625ba65 100644 --- a/PWGLF/Tasks/GlobalEventProperties/dndeta-mft-pp.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/dndeta-mft-pp.cxx @@ -118,30 +118,44 @@ struct PseudorapidityDensityMFT { HistogramRegistry registry{ "registry", - { - {"TracksEtaZvtx", - "; #eta; #it{z}_{vtx} (cm); tracks", - {HistType::kTH2F, {EtaAxis, ZAxis}}}, // - {"Tracks/EtaZvtx_gt0", - "; #eta; #it{z}_{vtx} (cm); tracks", - {HistType::kTH2F, {EtaAxis, ZAxis}}}, // - {"TracksPhiEta", - "; #varphi; #eta; tracks", - {HistType::kTH2F, {PhiAxis, EtaAxis}}}, // - {"TracksPhiZvtx", - "; #varphi; #it{z}_{vtx} (cm); tracks", - {HistType::kTH2F, {PhiAxis, ZAxis}}}, // - {"TracksPtEta", - " ; p_{T} (GeV/c); #eta", - {HistType::kTH2F, {PtAxis, EtaAxis}}}, // - {"EventSelection", - ";status;events", - {HistType::kTH1F, {{15, 0.5, 15.5}}}}, - {"EventCounts", - ";status;events", - {HistType::kTH1F, {{2, 0.5, 2.5}}}}, - {"Tracks/Control/TrackCount", ";status;Track counts", {HistType::kTH1F, {{15, 0.5, 15.5}}}}, // added - }}; + {{"TracksEtaZvtx", + "; #eta; #it{z}_{vtx} (cm); tracks", + {HistType::kTH2F, {EtaAxis, ZAxis}}}, // + {"Tracks/EtaZvtx_gt0", + "; #eta; #it{z}_{vtx} (cm); tracks", + {HistType::kTH2F, {EtaAxis, ZAxis}}}, // + {"TracksPhiEta", + "; #varphi; #eta; tracks", + {HistType::kTH2F, {PhiAxis, EtaAxis}}}, // + {"TracksPhiZvtx", + "; #varphi; #it{z}_{vtx} (cm); tracks", + {HistType::kTH2F, {PhiAxis, ZAxis}}}, // + {"TracksPtEta", + " ; p_{T} (GeV/c); #eta", + {HistType::kTH2F, {PtAxis, EtaAxis}}}, // + {"EventSelection", + ";status;events", + {HistType::kTH1F, {{15, 0.5, 15.5}}}}, + {"EventCounts", + ";status;events", + {HistType::kTH1F, {{2, 0.5, 2.5}}}}, + {"Tracks/Control/TrackCount", ";status;Track counts", {HistType::kTH1F, {{15, 0.5, 15.5}}}}, // added + // Purity-related histograms + {"Purity/SelectedAfterDCAxy/All", + ";bin;counts", + {HistType::kTH1F, {{1, 0.5, 1.5}}}}, + {"Purity/SelectedAfterDCAxy/AllEta", + ";#eta;counts", + {HistType::kTH1F, {EtaAxis}}}, + {"Purity/Gen/PrimaryEta", + ";#eta;primaries", + {HistType::kTH1F, {EtaAxis}}}, + {"Purity/Gen/All", + ";bin;counts", + {HistType::kTH1F, {{1, 0.5, 1.5}}}}, + {"Purity/Gen/AllEta", + ";#eta;counts", + {HistType::kTH1F, {EtaAxis}}}}}; void init(InitContext&) { @@ -725,6 +739,9 @@ struct PseudorapidityDensityMFT { continue; } } + // Purity denominator: all tracks that pass the DCA selection and other quality cuts + registry.fill(HIST("Purity/SelectedAfterDCAxy/All"), 1.); + registry.fill(HIST("Purity/SelectedAfterDCAxy/AllEta"), track.eta()); registry.fill(HIST("TracksEtaZvtx"), track.eta(), z); if (midtracks.size() > 0 && retrack.ambDegree() > 0) { registry.fill(HIST("Tracks/EtaZvtx_gt0"), track.eta(), z); @@ -1049,6 +1066,13 @@ struct PseudorapidityDensityMFT { continue; } if (cfgnEta1 < particle.eta() && particle.eta() < cfgnEta2 && (phi > cfgPhiCut1 && phi < cfgPhiCut2)) { + // Purity numerator reference at generator level: physical primaries in the same eta window + if (particle.isPhysicalPrimary()) { + registry.fill(HIST("Purity/Gen/PrimaryEta"), particle.eta()); + // Truth-side total counters for primaries in acceptance (for purity calculations) + registry.fill(HIST("Purity/Gen/All"), 1.); + registry.fill(HIST("Purity/Gen/AllEta"), particle.eta()); + } registry.fill(HIST("TracksEtaZvtxGen_t"), particle.eta(), mcCollision.posZ()); if (perCollisionMCSampleCentral.size() > 0) { From 4696f391e4ac20c9a53d32a3e001459f81f4e165 Mon Sep 17 00:00:00 2001 From: Bong-Hwi Lim Date: Mon, 6 Oct 2025 09:26:18 +0200 Subject: [PATCH 634/986] [PWGLF] Add resonance analyses for Omega(2012) and Xi(1820) (#13242) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Resonances/CMakeLists.txt | 10 + PWGLF/Tasks/Resonances/omega2012Analysis.cxx | 903 ++++++++++++++ PWGLF/Tasks/Resonances/xi1820Analysis.cxx | 1110 ++++++++++++++++++ 3 files changed, 2023 insertions(+) create mode 100644 PWGLF/Tasks/Resonances/omega2012Analysis.cxx create mode 100644 PWGLF/Tasks/Resonances/xi1820Analysis.cxx diff --git a/PWGLF/Tasks/Resonances/CMakeLists.txt b/PWGLF/Tasks/Resonances/CMakeLists.txt index 27aad7c24c3..d7e30e875ef 100644 --- a/PWGLF/Tasks/Resonances/CMakeLists.txt +++ b/PWGLF/Tasks/Resonances/CMakeLists.txt @@ -174,6 +174,16 @@ o2physics_add_dpl_workflow(xi1530analysisqa PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(omega2012analysis + SOURCES omega2012Analysis.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(xi1820analysis + SOURCES xi1820Analysis.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(initializereventqa SOURCES initializereventqa.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore diff --git a/PWGLF/Tasks/Resonances/omega2012Analysis.cxx b/PWGLF/Tasks/Resonances/omega2012Analysis.cxx new file mode 100644 index 00000000000..77a9b57d3b0 --- /dev/null +++ b/PWGLF/Tasks/Resonances/omega2012Analysis.cxx @@ -0,0 +1,903 @@ +// 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 omega2012Analysis.cxx +/// \brief Invariant Mass Reconstruction of Omega(2012) Resonance +/// \author Bong-Hwi Lim + +#include "PWGLF/DataModel/LFResonanceTables.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; +using namespace o2::constants::physics; + +struct Omega2012Analysis { + // Constants + static constexpr float kSmallNumber = 1e-10f; // Small number to avoid division by zero + static constexpr float kMaxDCAV0ToPV = 1.0f; // Maximum DCA of V0 to PV + static constexpr int kNumExpectedDaughters = 2; // Expected number of daughters for 2-body decay + static constexpr int kPlaceholderPdgCode = 9999999; // o2-linter: disable=pdg/explicit-code (placeholder for generator-specific Omega(2012) PDG code) + SliceCache cache; + Preslice perResoCollisionCasc = aod::resodaughter::resoCollisionId; + Preslice perResoCollisionV0 = aod::resodaughter::resoCollisionId; + Preslice perResoCollisionTrack = aod::resodaughter::resoCollisionId; + Preslice perResoCollisionMicroTrack = aod::resodaughter::resoCollisionId; + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // Axes + ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 8.0, 10.0}, "pT"}; + ConfigurableAxis binsPtQA{"binsPtQA", {VARIABLE_WIDTH, 0.0, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0}, "pT (QA)"}; + ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0., 1., 5., 10., 30., 50., 70., 100., 110.}, "Centrality"}; + + // Invariant mass range for Omega(2012) → Xi + K0s + Configurable cInvMassStart{"cInvMassStart", 1.6, "Invariant mass start (GeV/c^2)"}; + Configurable cInvMassEnd{"cInvMassEnd", 2.2, "Invariant mass end (GeV/c^2)"}; + Configurable cInvMassBins{"cInvMassBins", 600, "Invariant mass bins"}; + + // Basic pre-selections (mirroring refs) + Configurable cMinPtcut{"cMinPtcut", 0.15, "Minimum pT for candidates"}; + Configurable cMaxEtaCut{"cMaxEtaCut", 0.8, "Maximum |eta|"}; + // V0 selections (K0s) from k892pmanalysis + Configurable cV0MinCosPA{"cV0MinCosPA", 0.97, "V0 minimum pointing angle cosine"}; + Configurable cV0MaxDaughDCA{"cV0MaxDaughDCA", 1.0, "V0 daughter DCA Maximum"}; + Configurable cV0MassWindow{"cV0MassWindow", 0.0043, "Mass window for competing Lambda0 rejection"}; + Configurable cMaxV0Etacut{"cMaxV0Etacut", 0.8, "V0 maximum eta cut"}; + + // Xi (cascade) selections from xi1530Analysisqa.cxx + Configurable cDCAxyToPVByPtCascP0{"cDCAxyToPVByPtCascP0", 999., "Cascade DCAxy p0"}; + Configurable cDCAxyToPVByPtCascExp{"cDCAxyToPVByPtCascExp", 1., "Cascade DCAxy exp"}; + Configurable cDCAxyToPVAsPtForCasc{"cDCAxyToPVAsPtForCasc", true, "Use pt-dep DCAxy cut (casc)"}; + + Configurable cDCAzToPVAsPtForCasc{"cDCAzToPVAsPtForCasc", true, "Use pt-dep DCAz cut (casc)"}; + + // V0 topology inside cascade (Λ) + Configurable cDCALambdaDaugtherscut{"cDCALambdaDaugtherscut", 0.7, "Λ daughters DCA cut"}; + Configurable cDCALambdaToPVcut{"cDCALambdaToPVcut", 0.02, "Λ DCA to PV min"}; + Configurable cDCAPionToPVcut{"cDCAPionToPVcut", 0.06, "π DCA to PV min"}; + Configurable cDCAProtonToPVcut{"cDCAProtonToPVcut", 0.07, "p DCA to PV min"}; + Configurable cV0CosPACutPtDepP0{"cV0CosPACutPtDepP0", 0.25, "V0 CosPA p0"}; + Configurable cV0CosPACutPtDepP1{"cV0CosPACutPtDepP1", 0.022, "V0 CosPA p1"}; + Configurable cMaxV0radiuscut{"cMaxV0radiuscut", 200., "V0 radius max"}; + Configurable cMinV0radiuscut{"cMinV0radiuscut", 2.5, "V0 radius min"}; + Configurable cMasswindowV0cut{"cMasswindowV0cut", 0.005, "Λ mass window for cascade V0"}; + + // Cascade topology + Configurable cDCABachlorToPVcut{"cDCABachlorToPVcut", 0.06, "Bachelor DCA to PV min"}; + Configurable cDCAXiDaugthersCutPtRangeLower{"cDCAXiDaugthersCutPtRangeLower", 1., "Xi pt low boundary"}; + Configurable cDCAXiDaugthersCutPtRangeUpper{"cDCAXiDaugthersCutPtRangeUpper", 4., "Xi pt high boundary"}; + Configurable cDCAXiDaugthersCutPtDepLower{"cDCAXiDaugthersCutPtDepLower", 0.8, "Xi daugh DCA (pt cDCAXiDaugthersCutPtDepMiddle{"cDCAXiDaugthersCutPtDepMiddle", 0.5, "Xi daugh DCA (low<=pt cDCAXiDaugthersCutPtDepUpper{"cDCAXiDaugthersCutPtDepUpper", 0.2, "Xi daugh DCA (pt>=high)"}; + Configurable cCosPACascCutPtDepP0{"cCosPACascCutPtDepP0", 0.2, "Cascade CosPA p0"}; + Configurable cCosPACascCutPtDepP1{"cCosPACascCutPtDepP1", 0.022, "Cascade CosPA p1"}; + Configurable cMaxCascradiuscut{"cMaxCascradiuscut", 200., "Cascade radius max"}; + Configurable cMinCascradiuscut{"cMinCascradiuscut", 1.1, "Cascade radius min"}; + Configurable cMasswindowCasccut{"cMasswindowCasccut", 0.008, "Xi mass window"}; + Configurable cMassXiminus{"cMassXiminus", 1.32171, "Xi mass (GeV/c^2)"}; // PDG + + // Event Mixing + Configurable nEvtMixing{"nEvtMixing", 10, "Number of events to mix"}; + ConfigurableAxis cfgVtxBins{"cfgVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; + ConfigurableAxis cfgMultBins{"cfgMultBins", {VARIABLE_WIDTH, 0.0f, 1.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.0f, 110.0f}, "Mixing bins - centrality"}; + + // Enhanced K0s selections + Configurable cK0sProperLifetimeMax{"cK0sProperLifetimeMax", 20.0, "K0s proper lifetime max (cm/c)"}; + Configurable cK0sArmenterosQtMin{"cK0sArmenterosQtMin", 0.0, "K0s Armenteros qt min"}; + Configurable cK0sArmenterosAlphaMax{"cK0sArmenterosAlphaMax", 0.8, "K0s Armenteros alpha max"}; + Configurable cK0sDauPosDCAtoPVMin{"cK0sDauPosDCAtoPVMin", 0.1, "K0s positive daughter DCA to PV min"}; + Configurable cK0sDauNegDCAtoPVMin{"cK0sDauNegDCAtoPVMin", 0.1, "K0s negative daughter DCA to PV min"}; + Configurable cK0sRadiusMin{"cK0sRadiusMin", 0.5, "K0s decay radius min"}; + Configurable cK0sRadiusMax{"cK0sRadiusMax", 100.0, "K0s decay radius max"}; + Configurable cK0sCrossMassRejection{"cK0sCrossMassRejection", true, "Enable Lambda mass rejection for K0s"}; + + // Pion track selections for 3-body decay + Configurable cPionPtMin{"cPionPtMin", 0.15, "Minimum pion pT"}; + Configurable cPionEtaMax{"cPionEtaMax", 0.8, "Maximum pion |eta|"}; + Configurable cPionDCAxyMax{"cPionDCAxyMax", 0.1, "Maximum pion DCAxy to PV"}; + Configurable cPionDCAzMax{"cPionDCAzMax", 0.2, "Maximum pion DCAz to PV"}; + Configurable cPionTPCNClusMin{"cPionTPCNClusMin", 70, "Minimum TPC clusters for pion"}; + + // Pion PID selections + Configurable cPionTPCNSigmaMax{"cPionTPCNSigmaMax", 3.0, "Maximum TPC NSigma for pion"}; + Configurable cPionTOFNSigmaMax{"cPionTOFNSigmaMax", 3.0, "Maximum TOF NSigma for pion"}; + Configurable cPionUsePtDepPID{"cPionUsePtDepPID", false, "Use pT-dependent PID cuts for pion"}; + Configurable> cPionPIDPtBins{"cPionPIDPtBins", {0.0f, 0.5f, 0.8f, 2.0f, 999.0f}, "pT bin edges for pion PID cuts"}; + Configurable> cPionTPCNSigmaCuts{"cPionTPCNSigmaCuts", {3.0f, 3.0f, 2.0f, 2.0f}, "TPC NSigma cuts per pT bin (pion)"}; + Configurable> cPionTOFNSigmaCuts{"cPionTOFNSigmaCuts", {3.0f, 3.0f, 3.0f, 3.0f}, "TOF NSigma cuts per pT bin (pion)"}; + Configurable> cPionTOFRequired{"cPionTOFRequired", {0, 0, 1, 1}, "Require TOF per pT bin (pion)"}; + + // PDG masses + double massK0 = MassK0Short; + + using BinningTypeVertexContributor = ColumnBinningPolicy; + BinningTypeVertexContributor colBinning{{cfgVtxBins, cfgMultBins}, true}; + + void init(InitContext&) + { + AxisSpec centAxis = {binsCent, "V0M (%)"}; + AxisSpec ptAxis = {binsPt, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec ptAxisQA = {binsPtQA, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec invMassAxis = {cInvMassBins, cInvMassStart, cInvMassEnd, "Invariant Mass (GeV/#it{c}^{2})"}; + AxisSpec xiMassAxis = {400, 1.25, 1.65, "#Xi mass (GeV/#it{c}^{2})"}; + AxisSpec k0sMassAxis = {100, 0.4, 0.6, "K^{0}_{S} mass (GeV/#it{c}^{2})"}; + AxisSpec dcaAxis = {200, 0., 2.0, "DCA (cm)"}; + AxisSpec dcaxyAxis = {200, -1.0, 1.0, "DCA_{xy} (cm)"}; + AxisSpec dcazAxis = {200, -2.0, 2.0, "DCA_{z} (cm)"}; + AxisSpec cosPAAxis = {1000, 0.95, 1.0, "cos(PA)"}; + AxisSpec radiusAxis = {200, 0, 200, "Radius (cm)"}; + AxisSpec lifetimeAxis = {200, 0, 50, "Proper lifetime (cm/c)"}; + AxisSpec armQtAxis = {100, 0, 0.3, "q_{T} (GeV/c)"}; + AxisSpec armAlphaAxis = {100, -1.0, 1.0, "#alpha"}; + + // Event QA histograms + histos.add("Event/posZ", "Event vertex Z position", kTH1F, {{200, -20., 20., "V_{z} (cm)"}}); + histos.add("Event/centrality", "Event centrality distribution", kTH1F, {centAxis}); + histos.add("Event/posZvsCent", "Vertex Z vs Centrality", kTH2F, {{200, -20., 20., "V_{z} (cm)"}, centAxis}); + histos.add("Event/nCascades", "Number of cascades per event", kTH1F, {{100, 0., 100., "N_{cascades}"}}); + histos.add("Event/nV0s", "Number of V0s per event", kTH1F, {{200, 0., 200., "N_{V0s}"}}); + histos.add("Event/nCascadesAfterCuts", "Number of cascades per event after cuts", kTH1F, {{50, 0., 50., "N_{cascades}"}}); + histos.add("Event/nV0sAfterCuts", "Number of V0s per event after cuts", kTH1F, {{100, 0., 100., "N_{V0s}"}}); + + // Xi QA histograms + histos.add("QAbefore/xiMass", "Xi mass before cuts", kTH1F, {xiMassAxis}); + histos.add("QAbefore/xiPt", "Xi pT before cuts", kTH1F, {ptAxisQA}); + histos.add("QAbefore/xiEta", "Xi eta before cuts", kTH1F, {{100, -2.0, 2.0, "#eta"}}); + histos.add("QAbefore/xiDCAxy", "Xi DCAxy before cuts", kTH2F, {ptAxisQA, dcaxyAxis}); + histos.add("QAbefore/xiDCAz", "Xi DCAz before cuts", kTH2F, {ptAxisQA, dcazAxis}); + histos.add("QAbefore/xiV0CosPA", "Xi V0 CosPA before cuts", kTH2F, {ptAxisQA, cosPAAxis}); + histos.add("QAbefore/xiCascCosPA", "Xi Cascade CosPA before cuts", kTH2F, {ptAxisQA, cosPAAxis}); + histos.add("QAbefore/xiV0Radius", "Xi V0 radius before cuts", kTH2F, {ptAxisQA, radiusAxis}); + histos.add("QAbefore/xiCascRadius", "Xi Cascade radius before cuts", kTH2F, {ptAxisQA, radiusAxis}); + histos.add("QAbefore/xiV0DauDCA", "Xi V0 daughter DCA before cuts", kTH2F, {ptAxisQA, dcaAxis}); + histos.add("QAbefore/xiCascDauDCA", "Xi Cascade daughter DCA before cuts", kTH2F, {ptAxisQA, dcaAxis}); + + histos.add("QAafter/xiMass", "Xi mass after cuts", kTH1F, {xiMassAxis}); + histos.add("QAafter/xiPt", "Xi pT after cuts", kTH1F, {ptAxisQA}); + histos.add("QAafter/xiEta", "Xi eta after cuts", kTH1F, {{100, -2.0, 2.0, "#eta"}}); + histos.add("QAafter/xiDCAxy", "Xi DCAxy after cuts", kTH2F, {ptAxisQA, dcaxyAxis}); + histos.add("QAafter/xiDCAz", "Xi DCAz after cuts", kTH2F, {ptAxisQA, dcazAxis}); + histos.add("QAafter/xiV0CosPA", "Xi V0 CosPA after cuts", kTH2F, {ptAxisQA, cosPAAxis}); + histos.add("QAafter/xiCascCosPA", "Xi Cascade CosPA after cuts", kTH2F, {ptAxisQA, cosPAAxis}); + histos.add("QAafter/xiV0Radius", "Xi V0 radius after cuts", kTH2F, {ptAxisQA, radiusAxis}); + histos.add("QAafter/xiCascRadius", "Xi Cascade radius after cuts", kTH2F, {ptAxisQA, radiusAxis}); + histos.add("QAafter/xiV0DauDCA", "Xi V0 daughter DCA after cuts", kTH2F, {ptAxisQA, dcaAxis}); + histos.add("QAafter/xiCascDauDCA", "Xi Cascade daughter DCA after cuts", kTH2F, {ptAxisQA, dcaAxis}); + + // K0s QA histograms + histos.add("QAbefore/k0sMassPt", "K0s mass vs pT before cuts", kTH2F, {ptAxisQA, k0sMassAxis}); + histos.add("QAbefore/k0sPt", "K0s pT before cuts", kTH1F, {ptAxisQA}); + histos.add("QAbefore/k0sEta", "K0s eta before cuts", kTH1F, {{100, -2.0, 2.0, "#eta"}}); + histos.add("QAbefore/k0sCosPA", "K0s CosPA before cuts", kTH2F, {ptAxisQA, cosPAAxis}); + histos.add("QAbefore/k0sRadius", "K0s radius before cuts", kTH2F, {ptAxisQA, radiusAxis}); + histos.add("QAbefore/k0sDauDCA", "K0s daughter DCA before cuts", kTH2F, {ptAxisQA, dcaAxis}); + histos.add("QAbefore/k0sDCAtoPV", "K0s DCA to PV before cuts", kTH2F, {ptAxisQA, dcaAxis}); + histos.add("QAbefore/k0sProperLifetime", "K0s proper lifetime before cuts", kTH2F, {ptAxisQA, lifetimeAxis}); + histos.add("QAbefore/k0sArmenteros", "K0s Armenteros plot before cuts", kTH2F, {armAlphaAxis, armQtAxis}); + histos.add("QAbefore/k0sDauPosDCA", "K0s positive daughter DCA before cuts", kTH2F, {ptAxisQA, dcaAxis}); + histos.add("QAbefore/k0sDauNegDCA", "K0s negative daughter DCA before cuts", kTH2F, {ptAxisQA, dcaAxis}); + + histos.add("QAafter/k0sMassPt", "K0s mass vs pT after cuts", kTH2F, {ptAxisQA, k0sMassAxis}); + histos.add("QAafter/k0sPt", "K0s pT after cuts", kTH1F, {ptAxisQA}); + histos.add("QAafter/k0sEta", "K0s eta after cuts", kTH1F, {{100, -2.0, 2.0, "#eta"}}); + histos.add("QAafter/k0sCosPA", "K0s CosPA after cuts", kTH2F, {ptAxisQA, cosPAAxis}); + histos.add("QAafter/k0sRadius", "K0s radius after cuts", kTH2F, {ptAxisQA, radiusAxis}); + histos.add("QAafter/k0sDauDCA", "K0s daughter DCA after cuts", kTH2F, {ptAxisQA, dcaAxis}); + histos.add("QAafter/k0sDCAtoPV", "K0s DCA to PV after cuts", kTH2F, {ptAxisQA, dcaAxis}); + histos.add("QAafter/k0sProperLifetime", "K0s proper lifetime after cuts", kTH2F, {ptAxisQA, lifetimeAxis}); + histos.add("QAafter/k0sArmenteros", "K0s Armenteros plot after cuts", kTH2F, {armAlphaAxis, armQtAxis}); + histos.add("QAafter/k0sDauPosDCA", "K0s positive daughter DCA after cuts", kTH2F, {ptAxisQA, dcaAxis}); + histos.add("QAafter/k0sDauNegDCA", "K0s negative daughter DCA after cuts", kTH2F, {ptAxisQA, dcaAxis}); + + // Resonance (2-body decay: Xi + K0s) + histos.add("omega2012/invmass", "Invariant mass of Omega(2012) → Xi + K0s", kTH1F, {invMassAxis}); + histos.add("omega2012/invmass_Mix", "Mixed event Invariant mass of Omega(2012) → Xi + K0s", kTH1F, {invMassAxis}); + histos.add("omega2012/massPtCent", "Omega(2012) mass vs pT vs cent", kTH3F, {invMassAxis, ptAxis, centAxis}); + histos.add("omega2012/massPtCent_Mix", "Mixed event Omega(2012) mass vs pT vs cent", kTH3F, {invMassAxis, ptAxis, centAxis}); + + // 3-body decay: Xi + pi + K0s + histos.add("omega2012_3body/invmass", "Invariant mass of Omega(2012) → Xi + #pi + K^{0}_{S}", kTH1F, {invMassAxis}); + histos.add("omega2012_3body/massPtCent", "Omega(2012) 3-body mass vs pT vs cent", kTH3F, {invMassAxis, ptAxis, centAxis}); + + // Pion QA histograms for 3-body + AxisSpec nsigmaAxis = {100, -5.0, 5.0, "N#sigma"}; + histos.add("QAbefore/pionPt", "Pion pT before cuts", kTH1F, {ptAxisQA}); + histos.add("QAbefore/pionEta", "Pion eta before cuts", kTH1F, {{100, -2.0, 2.0, "#eta"}}); + histos.add("QAbefore/pionDCAxy", "Pion DCAxy before cuts", kTH2F, {ptAxisQA, dcaxyAxis}); + histos.add("QAbefore/pionDCAz", "Pion DCAz before cuts", kTH2F, {ptAxisQA, dcazAxis}); + histos.add("QAbefore/pionTPCNcls", "Pion TPC clusters before cuts", kTH1F, {{160, 0, 160, "N_{TPC clusters}"}}); + histos.add("QAbefore/pionTPCNSigma", "Pion TPC NSigma before cuts", kTH2F, {ptAxisQA, nsigmaAxis}); + histos.add("QAbefore/pionTOFNSigma", "Pion TOF NSigma before cuts", kTH2F, {ptAxisQA, nsigmaAxis}); + + histos.add("QAafter/pionPt", "Pion pT after cuts", kTH1F, {ptAxisQA}); + histos.add("QAafter/pionEta", "Pion eta after cuts", kTH1F, {{100, -2.0, 2.0, "#eta"}}); + histos.add("QAafter/pionDCAxy", "Pion DCAxy after cuts", kTH2F, {ptAxisQA, dcaxyAxis}); + histos.add("QAafter/pionDCAz", "Pion DCAz after cuts", kTH2F, {ptAxisQA, dcazAxis}); + histos.add("QAafter/pionTPCNcls", "Pion TPC clusters after cuts", kTH1F, {{160, 0, 160, "N_{TPC clusters}"}}); + histos.add("QAafter/pionTPCNSigma", "Pion TPC NSigma after cuts", kTH2F, {ptAxisQA, nsigmaAxis}); + histos.add("QAafter/pionTOFNSigma", "Pion TOF NSigma after cuts", kTH2F, {ptAxisQA, nsigmaAxis}); + + // MC truth histograms + AxisSpec etaAxis = {100, -2.0, 2.0, "#eta"}; + AxisSpec rapidityAxis = {100, -2.0, 2.0, "y"}; + + histos.add("MC/hMCGenOmega2012Pt", "MC Generated Omega(2012) pT", kTH1F, {ptAxis}); + histos.add("MC/hMCGenOmega2012PtEta", "MC Generated Omega(2012) pT vs eta", kTH2F, {ptAxis, etaAxis}); + histos.add("MC/hMCGenOmega2012Y", "MC Generated Omega(2012) rapidity", kTH1F, {rapidityAxis}); + histos.add("MC/hMCRecOmega2012Pt", "MC Reconstructed Omega(2012) pT", kTH1F, {ptAxis}); + histos.add("MC/hMCRecOmega2012PtEta", "MC Reconstructed Omega(2012) pT vs eta", kTH2F, {ptAxis, etaAxis}); + + // MC truth invariant mass (from MC particles) + histos.add("MC/hMCTruthInvMassXiK0s", "MC Truth Inv Mass Xi + K^{0}_{S}", kTH1F, {invMassAxis}); + histos.add("MC/hMCTruthMassPtXiK0s", "MC Truth Mass vs pT Xi + K^{0}_{S}", kTH2F, {invMassAxis, ptAxis}); + + // MC reconstruction efficiency + histos.add("MC/hMCRecXiPt", "MC Reconstructed Xi pT", kTH1F, {ptAxis}); + histos.add("MC/hMCRecK0sPt", "MC Reconstructed K0s pT", kTH1F, {ptAxis}); + histos.add("MC/hMCTrueXiPt", "MC True Xi pT", kTH1F, {ptAxis}); + histos.add("MC/hMCTrueK0sPt", "MC True K0s pT", kTH1F, {ptAxis}); + } + + // Enhanced V0 selection (K0s) with detailed criteria + template + bool v0CutEnhanced(const CollisionType& collision, const V0Type& v0) + { + // Basic kinematic cuts + if (std::abs(v0.eta()) > cMaxV0Etacut) + return false; + if (v0.pt() < cMinPtcut) + return false; + + // Topological cuts + if (v0.v0CosPA() < cV0MinCosPA) + return false; + if (v0.daughDCA() > cV0MaxDaughDCA) + return false; + + // Enhanced selections from chk892Flow + // Daughter DCA to PV cuts + if (std::abs(v0.dcapostopv()) < cK0sDauPosDCAtoPVMin) + return false; + if (std::abs(v0.dcanegtopv()) < cK0sDauNegDCAtoPVMin) + return false; + + // Radius cuts - use transRadius instead of v0radius + auto radius = v0.transRadius(); + if (radius < cK0sRadiusMin || radius > cK0sRadiusMax) + return false; + + // DCA to PV + if (std::abs(v0.dcav0topv()) > kMaxDCAV0ToPV) + return false; // max DCA to PV + + // Proper lifetime cut - calculate manually + float dx = v0.decayVtxX() - collision.posX(); + float dy = v0.decayVtxY() - collision.posY(); + float dz = v0.decayVtxZ() - collision.posZ(); + float l = std::sqrt(dx * dx + dy * dy + dz * dz); + float p = std::sqrt(v0.px() * v0.px() + v0.py() * v0.py() + v0.pz() * v0.pz()); + auto properLifetime = (l / (p + kSmallNumber)) * MassK0Short; + if (properLifetime > cK0sProperLifetimeMax) + return false; + + // Armenteros cut - skip for now as we don't have daughter momentum info in ResoV0s table + // If needed, this would require accessing daughter tracks separately or using alternative cuts + + // Mass window + if (std::abs(v0.mK0Short() - MassK0Short) > cV0MassWindow) + return false; + + // Competing V0 rejection: remove (Anti)Λ + if (cK0sCrossMassRejection) { + if (std::abs(v0.mLambda() - MassLambda) < cV0MassWindow) + return false; + if (std::abs(v0.mAntiLambda() - MassLambda) < cV0MassWindow) + return false; + } + + return true; + } + + // Original V0 selection for backward compatibility + template + bool v0Cut(const V0Type& v0) + { + if (std::abs(v0.eta()) > cMaxV0Etacut) + return false; + if (v0.v0CosPA() < cV0MinCosPA) + return false; + if (v0.daughDCA() > cV0MaxDaughDCA) + return false; + // Competing V0 rejection: remove (Anti)Λ + if (std::abs(v0.mLambda() - MassLambda) < cV0MassWindow) + return false; + if (std::abs(v0.mAntiLambda() - MassLambda) < cV0MassWindow) + return false; + return true; + } + + // Helper function to find pT bin index + int getPtBinIndex(float pt) + { + auto ptBins = static_cast>(cPionPIDPtBins); + for (size_t i = 0; i < ptBins.size() - 1; i++) { + if (pt >= ptBins[i] && pt < ptBins[i + 1]) { + return i; + } + } + return -1; + } + + // Pion PID selection + template + bool pionPidCut(const TrackType& track) + { + float pt = track.pt(); + + if constexpr (IsResoMicrotrack) { + // For ResoMicroTracks - decode PID from flags + float tpcNSigma = o2::aod::resomicrodaughter::PidNSigma::getTPCnSigma(track.pidNSigmaPiFlag()); + float tofNSigma = track.hasTOF() ? o2::aod::resomicrodaughter::PidNSigma::getTOFnSigma(track.pidNSigmaPiFlag()) : 999.f; + + if (cPionUsePtDepPID) { + int ptBin = getPtBinIndex(pt); + if (ptBin < 0) + return false; + + auto tpcCuts = static_cast>(cPionTPCNSigmaCuts); + auto tofCuts = static_cast>(cPionTOFNSigmaCuts); + auto tofRequired = static_cast>(cPionTOFRequired); + + if (ptBin >= static_cast(tpcCuts.size()) || + ptBin >= static_cast(tofCuts.size()) || + ptBin >= static_cast(tofRequired.size())) { + return false; + } + + if (std::abs(tpcNSigma) >= tpcCuts[ptBin]) + return false; + + if (tofRequired[ptBin] != 0) { + if (!track.hasTOF()) + return false; + if (std::abs(tofNSigma) >= tofCuts[ptBin]) + return false; + } else { + if (track.hasTOF() && std::abs(tofNSigma) >= tofCuts[ptBin]) + return false; + } + + return true; + } else { + bool tpcPass = std::abs(tpcNSigma) < cPionTPCNSigmaMax; + bool tofPass = track.hasTOF() ? std::abs(tofNSigma) < cPionTOFNSigmaMax : true; + return tpcPass && tofPass; + } + } else { + // For ResoTracks - direct access + float tpcNSigma = track.tpcNSigmaPi(); + float tofNSigma = track.hasTOF() ? track.tofNSigmaPi() : 999.f; + + if (cPionUsePtDepPID) { + int ptBin = getPtBinIndex(pt); + if (ptBin < 0) + return false; + + auto tpcCuts = static_cast>(cPionTPCNSigmaCuts); + auto tofCuts = static_cast>(cPionTOFNSigmaCuts); + auto tofRequired = static_cast>(cPionTOFRequired); + + if (ptBin >= static_cast(tpcCuts.size()) || + ptBin >= static_cast(tofCuts.size()) || + ptBin >= static_cast(tofRequired.size())) { + return false; + } + + if (std::abs(tpcNSigma) >= tpcCuts[ptBin]) + return false; + + if (tofRequired[ptBin] != 0) { + if (!track.hasTOF()) + return false; + if (std::abs(tofNSigma) >= tofCuts[ptBin]) + return false; + } else { + if (track.hasTOF() && std::abs(tofNSigma) >= tofCuts[ptBin]) + return false; + } + + return true; + } else { + bool tpcPass = std::abs(tpcNSigma) < cPionTPCNSigmaMax; + bool tofPass = track.hasTOF() ? std::abs(tofNSigma) < cPionTOFNSigmaMax : true; + return tpcPass && tofPass; + } + } + } + + // Pion track selection (for both ResoTracks and ResoMicroTracks) + template + bool pionCut(const TrackType& track) + { + // Basic kinematic cuts + if (track.pt() < cPionPtMin) + return false; + if (std::abs(track.eta()) > cPionEtaMax) + return false; + + // DCA cuts - different access for ResoMicroTracks + if constexpr (IsResoMicrotrack) { + if (o2::aod::resomicrodaughter::ResoMicroTrackSelFlag::decodeDCAxy(track.trackSelectionFlags()) > cPionDCAxyMax) + return false; + if (o2::aod::resomicrodaughter::ResoMicroTrackSelFlag::decodeDCAz(track.trackSelectionFlags()) > cPionDCAzMax) + return false; + } else { + if (std::abs(track.dcaXY()) > cPionDCAxyMax) + return false; + if (std::abs(track.dcaZ()) > cPionDCAzMax) + return false; + } + + // Track quality cuts - only for ResoTracks + if constexpr (!IsResoMicrotrack) { + if constexpr (requires { track.tpcNClsFound(); }) { + if (track.tpcNClsFound() < cPionTPCNClusMin) + return false; + } + } + + // PID selection + if (!pionPidCut(track)) + return false; + + return true; + } + + // Primary-level cascade kinematics + template + bool cascprimaryTrackCut(const CascT& c) + { + if (std::abs(c.eta()) > cMaxEtaCut) + return false; + if (std::abs(c.pt()) < cMinPtcut) + return false; + if (cDCAxyToPVAsPtForCasc) { + if (std::abs(c.dcaXYCascToPV()) > (cDCAxyToPVByPtCascP0 + cDCAxyToPVByPtCascExp * c.pt())) + return false; + } + if (cDCAzToPVAsPtForCasc) { + if (std::abs(c.dcaZCascToPV()) > (cDCAxyToPVByPtCascP0 + cDCAxyToPVByPtCascExp * std::pow(c.pt(), -1.1f))) + return false; + } + return true; + } + + // Cascade topological selections adapted from xi1530Analysisqa + template + bool casctopCut(const CascT& c) + { + // V0 (Λ) topology inside cascade + if (std::abs(c.daughDCA()) > cDCALambdaDaugtherscut) + return false; + if (std::abs(c.dcav0topv()) < cDCALambdaToPVcut) + return false; + + if (c.sign() < 0) { // Xi- + if (std::abs(c.dcanegtopv()) < cDCAPionToPVcut) + return false; + if (std::abs(c.dcapostopv()) < cDCAProtonToPVcut) + return false; + } else { // Anti-Xi + if (std::abs(c.dcanegtopv()) < cDCAProtonToPVcut) + return false; + if (std::abs(c.dcapostopv()) < cDCAPionToPVcut) + return false; + } + + if (c.v0CosPA() < std::cos(cV0CosPACutPtDepP0 - cV0CosPACutPtDepP1 * c.pt())) + return false; + if (c.transRadius() > cMaxV0radiuscut || c.transRadius() < cMinV0radiuscut) + return false; + if (std::abs(c.mLambda() - MassLambda) > cMasswindowV0cut) + return false; + + // Cascade-level topology + if (std::abs(c.dcabachtopv()) < cDCABachlorToPVcut) + return false; + + if (c.pt() < cDCAXiDaugthersCutPtRangeLower) { + if (c.cascDaughDCA() > cDCAXiDaugthersCutPtDepLower) + return false; + } else if (c.pt() < cDCAXiDaugthersCutPtRangeUpper) { + if (c.cascDaughDCA() > cDCAXiDaugthersCutPtDepMiddle) + return false; + } else { + if (c.cascDaughDCA() > cDCAXiDaugthersCutPtDepUpper) + return false; + } + + if (c.cascCosPA() < std::cos(cCosPACascCutPtDepP0 - cCosPACascCutPtDepP1 * c.pt())) + return false; + if (c.cascTransRadius() > cMaxCascradiuscut || c.cascTransRadius() < cMinCascradiuscut) + return false; + if (std::abs(c.mXi() - cMassXiminus) > cMasswindowCasccut) + return false; + + return true; + } + + template + void fill(const CollisionT& collision, const CascadesT& cascades, const V0sT& v0s) + { + auto cent = collision.cent(); + + // Fill event QA histograms (only for same-event) + if constexpr (!IsMix) { + histos.fill(HIST("Event/posZ"), collision.posZ()); + histos.fill(HIST("Event/centrality"), cent); + histos.fill(HIST("Event/posZvsCent"), collision.posZ(), cent); + histos.fill(HIST("Event/nCascades"), cascades.size()); + histos.fill(HIST("Event/nV0s"), v0s.size()); + } + + // Count candidates after cuts + int nCascAfterCuts = 0; + int nV0sAfterCuts = 0; + + for (const auto& xi : cascades) { + // QA before Xi cuts - detailed histograms + histos.fill(HIST("QAbefore/xiMass"), xi.mXi()); + histos.fill(HIST("QAbefore/xiPt"), xi.pt()); + histos.fill(HIST("QAbefore/xiEta"), xi.eta()); + histos.fill(HIST("QAbefore/xiDCAxy"), xi.pt(), xi.dcaXYCascToPV()); + histos.fill(HIST("QAbefore/xiDCAz"), xi.pt(), xi.dcaZCascToPV()); + histos.fill(HIST("QAbefore/xiV0CosPA"), xi.pt(), xi.v0CosPA()); + histos.fill(HIST("QAbefore/xiCascCosPA"), xi.pt(), xi.cascCosPA()); + histos.fill(HIST("QAbefore/xiV0Radius"), xi.pt(), xi.transRadius()); + histos.fill(HIST("QAbefore/xiCascRadius"), xi.pt(), xi.cascTransRadius()); + histos.fill(HIST("QAbefore/xiV0DauDCA"), xi.pt(), xi.daughDCA()); + histos.fill(HIST("QAbefore/xiCascDauDCA"), xi.pt(), xi.cascDaughDCA()); + + if (!cascprimaryTrackCut(xi)) + continue; + if (!casctopCut(xi)) + continue; + + // Count cascades passing cuts + if constexpr (!IsMix) { + nCascAfterCuts++; + } + + // QA after Xi cuts - detailed histograms + histos.fill(HIST("QAafter/xiMass"), xi.mXi()); + histos.fill(HIST("QAafter/xiPt"), xi.pt()); + histos.fill(HIST("QAafter/xiEta"), xi.eta()); + histos.fill(HIST("QAafter/xiDCAxy"), xi.pt(), xi.dcaXYCascToPV()); + histos.fill(HIST("QAafter/xiDCAz"), xi.pt(), xi.dcaZCascToPV()); + histos.fill(HIST("QAafter/xiV0CosPA"), xi.pt(), xi.v0CosPA()); + histos.fill(HIST("QAafter/xiCascCosPA"), xi.pt(), xi.cascCosPA()); + histos.fill(HIST("QAafter/xiV0Radius"), xi.pt(), xi.transRadius()); + histos.fill(HIST("QAafter/xiCascRadius"), xi.pt(), xi.cascTransRadius()); + histos.fill(HIST("QAafter/xiV0DauDCA"), xi.pt(), xi.daughDCA()); + histos.fill(HIST("QAafter/xiCascDauDCA"), xi.pt(), xi.cascDaughDCA()); + + // Build Xi + K0s + for (const auto& v0 : v0s) { + // QA before K0s selection - detailed histograms + histos.fill(HIST("QAbefore/k0sMassPt"), v0.pt(), v0.mK0Short()); + histos.fill(HIST("QAbefore/k0sPt"), v0.pt()); + histos.fill(HIST("QAbefore/k0sEta"), v0.eta()); + histos.fill(HIST("QAbefore/k0sCosPA"), v0.pt(), v0.v0CosPA()); + histos.fill(HIST("QAbefore/k0sRadius"), v0.pt(), v0.transRadius()); + histos.fill(HIST("QAbefore/k0sDauDCA"), v0.pt(), v0.daughDCA()); + histos.fill(HIST("QAbefore/k0sDCAtoPV"), v0.pt(), std::abs(v0.dcav0topv())); + // Calculate proper lifetime manually + float dx = v0.decayVtxX() - collision.posX(); + float dy = v0.decayVtxY() - collision.posY(); + float dz = v0.decayVtxZ() - collision.posZ(); + float l = std::sqrt(dx * dx + dy * dy + dz * dz); + float p = std::sqrt(v0.px() * v0.px() + v0.py() * v0.py() + v0.pz() * v0.pz()); + auto properLifetime = (l / (p + 1e-10)) * MassK0Short; + histos.fill(HIST("QAbefore/k0sProperLifetime"), v0.pt(), properLifetime); + // Skip Armenteros plot for now - requires daughter momentum info + // histos.fill(HIST("QAbefore/k0sArmenteros"), alpha, qt); + histos.fill(HIST("QAbefore/k0sDauPosDCA"), v0.pt(), std::abs(v0.dcapostopv())); + histos.fill(HIST("QAbefore/k0sDauNegDCA"), v0.pt(), std::abs(v0.dcanegtopv())); + + if (!v0CutEnhanced(collision, v0)) + continue; + + // Count V0s passing cuts + if constexpr (!IsMix) { + nV0sAfterCuts++; + } + + // QA after K0s selection - detailed histograms + histos.fill(HIST("QAafter/k0sMassPt"), v0.pt(), v0.mK0Short()); + histos.fill(HIST("QAafter/k0sPt"), v0.pt()); + histos.fill(HIST("QAafter/k0sEta"), v0.eta()); + histos.fill(HIST("QAafter/k0sCosPA"), v0.pt(), v0.v0CosPA()); + histos.fill(HIST("QAafter/k0sRadius"), v0.pt(), v0.transRadius()); + histos.fill(HIST("QAafter/k0sDauDCA"), v0.pt(), v0.daughDCA()); + histos.fill(HIST("QAafter/k0sDCAtoPV"), v0.pt(), std::abs(v0.dcav0topv())); + histos.fill(HIST("QAafter/k0sProperLifetime"), v0.pt(), properLifetime); + // Skip Armenteros plot for now - requires daughter momentum info + // histos.fill(HIST("QAafter/k0sArmenteros"), alpha, qt); + histos.fill(HIST("QAafter/k0sDauPosDCA"), v0.pt(), std::abs(v0.dcapostopv())); + histos.fill(HIST("QAafter/k0sDauNegDCA"), v0.pt(), std::abs(v0.dcanegtopv())); + + // 4-vectors + ROOT::Math::PxPyPzEVector pXi, pK0s, pRes; + pXi = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(xi.pt(), xi.eta(), xi.phi(), xi.mXi())); + pK0s = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(v0.pt(), v0.eta(), v0.phi(), massK0)); + pRes = pXi + pK0s; + + if constexpr (!IsMix) { + histos.fill(HIST("omega2012/invmass"), pRes.M()); + histos.fill(HIST("omega2012/massPtCent"), pRes.M(), pRes.Pt(), cent); + } else { + histos.fill(HIST("omega2012/invmass_Mix"), pRes.M()); + histos.fill(HIST("omega2012/massPtCent_Mix"), pRes.M(), pRes.Pt(), cent); + } + } + } + + // Fill event QA for after-cuts counters (only for same-event) + if constexpr (!IsMix) { + histos.fill(HIST("Event/nCascadesAfterCuts"), nCascAfterCuts); + histos.fill(HIST("Event/nV0sAfterCuts"), nV0sAfterCuts); + } + } + + void processDummy(aod::ResoCollision const& /*collision*/) + { + // Dummy function to satisfy the compiler + } + PROCESS_SWITCH(Omega2012Analysis, processDummy, "Process Dummy", true); + + void processData(const aod::ResoCollision& collision, + aod::ResoCascades const& resocasc, + aod::ResoV0s const& resov0s) + { + fill(collision, resocasc, resov0s); + } + PROCESS_SWITCH(Omega2012Analysis, processData, "Process Event for data", false); + + void processMixedEvent(const aod::ResoCollisions& collisions, + aod::ResoCascades const& resocasc, + aod::ResoV0s const& resov0s) + { + + auto cascV0sTuple = std::make_tuple(resocasc, resov0s); + Pair pairs{colBinning, nEvtMixing, -1, collisions, cascV0sTuple, &cache}; + + for (auto& [collision1, casc1, collision2, v0s2] : pairs) { // o2-linter: disable=const-ref-in-for-loop (structured binding cannot be const in this context) + auto cent = collision1.cent(); + + for (const auto& xi : casc1) { + if (!cascprimaryTrackCut(xi)) + continue; + if (!casctopCut(xi)) + continue; + + for (const auto& v0 : v0s2) { + if (!v0CutEnhanced(collision2, v0)) + continue; + + // 4-vectors for mixed event + ROOT::Math::PxPyPzEVector pXi, pK0s, pRes; + pXi = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(xi.pt(), xi.eta(), xi.phi(), xi.mXi())); + pK0s = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(v0.pt(), v0.eta(), v0.phi(), massK0)); + pRes = pXi + pK0s; + + histos.fill(HIST("omega2012/invmass_Mix"), pRes.M()); + histos.fill(HIST("omega2012/massPtCent_Mix"), pRes.M(), pRes.Pt(), cent); + } + } + } + } + PROCESS_SWITCH(Omega2012Analysis, processMixedEvent, "Process Mixed Event", false); + + // MC processes - placeholder for future implementation + void processMC(const aod::ResoCollision& /*collision*/, + aod::ResoCascades const& /*resocasc*/, + aod::ResoV0s const& /*resov0s*/, + aod::McParticles const& /*mcParticles*/) + { + // TODO: Implement MC truth matching for Xi + K0s + // - Match reconstructed Xi to MC Xi + // - Match reconstructed K0s to MC K0s + // - Fill MC truth histograms + // - Fill reconstruction efficiency histograms + // - Check if the Xi and K0s come from same Omega(2012) mother + } + PROCESS_SWITCH(Omega2012Analysis, processMC, "Process MC with truth matching (placeholder)", false); + + void processMCGenerated(aod::McParticles const& mcParticles) + { + // Process MC generated particles (no reconstruction requirement) + // Omega(2012) PDG code: Need to check - likely custom or using generator-specific codes + // This resonance decays to Xi + K0s + + for (const auto& mcParticle : mcParticles) { + // Look for Omega(2012) - PDG code may vary by generator + int pdg = mcParticle.pdgCode(); + + // TODO: Determine correct PDG code for Omega(2012) + // Placeholder check - update with correct PDG code + if (std::abs(pdg) != kPlaceholderPdgCode) // o2-linter: disable=pdg/explicit-code (placeholder for generator-specific PDG code) + continue; + + // Fill generated level histograms + auto pt = mcParticle.pt(); + auto eta = mcParticle.eta(); + auto y = mcParticle.y(); + + histos.fill(HIST("MC/hMCGenOmega2012Pt"), pt); + histos.fill(HIST("MC/hMCGenOmega2012PtEta"), pt, eta); + histos.fill(HIST("MC/hMCGenOmega2012Y"), y); + + // Get daughters + auto daughters = mcParticle.daughters_as(); + if (daughters.size() != kNumExpectedDaughters) + continue; + + int daughter1PDG = 0, daughter2PDG = 0; + ROOT::Math::PxPyPzEVector p1, p2, pMother; + + int iDaughter = 0; + for (const auto& daughter : daughters) { + if (iDaughter == 0) { + daughter1PDG = daughter.pdgCode(); + p1 = ROOT::Math::PxPyPzEVector(daughter.px(), daughter.py(), daughter.pz(), daughter.e()); + } else { + daughter2PDG = daughter.pdgCode(); + p2 = ROOT::Math::PxPyPzEVector(daughter.px(), daughter.py(), daughter.pz(), daughter.e()); + } + iDaughter++; + } + + pMother = p1 + p2; + + // Check decay channels + auto motherPt = pMother.Pt(); + auto motherM = pMother.M(); + + // Xi- + K0s or Xi+ + K0s + if ((std::abs(daughter1PDG) == kXiMinus && daughter2PDG == kK0Short) || + (std::abs(daughter2PDG) == kXiMinus && daughter1PDG == kK0Short)) { + histos.fill(HIST("MC/hMCTruthInvMassXiK0s"), motherM); + histos.fill(HIST("MC/hMCTruthMassPtXiK0s"), motherM, motherPt); + } + } + } + PROCESS_SWITCH(Omega2012Analysis, processMCGenerated, "Process MC generated particles (placeholder)", false); + + // Fill function for 3-body decay analysis + template + void fillThreeBody(const CollisionT& collision, const CascadesT& cascades, const V0sT& v0s, const TracksT& tracks) + { + auto cent = collision.cent(); + + for (const auto& xi : cascades) { + if (!cascprimaryTrackCut(xi)) + continue; + if (!casctopCut(xi)) + continue; + + for (const auto& v0 : v0s) { + if (!v0CutEnhanced(collision, v0)) + continue; + + for (const auto& pion : tracks) { + // Pion QA before cuts + histos.fill(HIST("QAbefore/pionPt"), pion.pt()); + histos.fill(HIST("QAbefore/pionEta"), pion.eta()); + + if constexpr (IsResoMicrotrack) { + histos.fill(HIST("QAbefore/pionDCAxy"), pion.pt(), o2::aod::resomicrodaughter::ResoMicroTrackSelFlag::decodeDCAxy(pion.trackSelectionFlags())); + histos.fill(HIST("QAbefore/pionDCAz"), pion.pt(), o2::aod::resomicrodaughter::ResoMicroTrackSelFlag::decodeDCAz(pion.trackSelectionFlags())); + histos.fill(HIST("QAbefore/pionTPCNSigma"), pion.pt(), o2::aod::resomicrodaughter::PidNSigma::getTPCnSigma(pion.pidNSigmaPiFlag())); + if (pion.hasTOF()) { + histos.fill(HIST("QAbefore/pionTOFNSigma"), pion.pt(), o2::aod::resomicrodaughter::PidNSigma::getTOFnSigma(pion.pidNSigmaPiFlag())); + } + } else { + histos.fill(HIST("QAbefore/pionDCAxy"), pion.pt(), pion.dcaXY()); + histos.fill(HIST("QAbefore/pionDCAz"), pion.pt(), pion.dcaZ()); + histos.fill(HIST("QAbefore/pionTPCNSigma"), pion.pt(), pion.tpcNSigmaPi()); + if (pion.hasTOF()) { + histos.fill(HIST("QAbefore/pionTOFNSigma"), pion.pt(), pion.tofNSigmaPi()); + } + if constexpr (requires { pion.tpcNClsFound(); }) { + histos.fill(HIST("QAbefore/pionTPCNcls"), pion.tpcNClsFound()); + } + } + + if (!pionCut(pion)) + continue; + + // Pion QA after cuts + histos.fill(HIST("QAafter/pionPt"), pion.pt()); + histos.fill(HIST("QAafter/pionEta"), pion.eta()); + + if constexpr (IsResoMicrotrack) { + histos.fill(HIST("QAafter/pionDCAxy"), pion.pt(), o2::aod::resomicrodaughter::ResoMicroTrackSelFlag::decodeDCAxy(pion.trackSelectionFlags())); + histos.fill(HIST("QAafter/pionDCAz"), pion.pt(), o2::aod::resomicrodaughter::ResoMicroTrackSelFlag::decodeDCAz(pion.trackSelectionFlags())); + histos.fill(HIST("QAafter/pionTPCNSigma"), pion.pt(), o2::aod::resomicrodaughter::PidNSigma::getTPCnSigma(pion.pidNSigmaPiFlag())); + if (pion.hasTOF()) { + histos.fill(HIST("QAafter/pionTOFNSigma"), pion.pt(), o2::aod::resomicrodaughter::PidNSigma::getTOFnSigma(pion.pidNSigmaPiFlag())); + } + } else { + histos.fill(HIST("QAafter/pionDCAxy"), pion.pt(), pion.dcaXY()); + histos.fill(HIST("QAafter/pionDCAz"), pion.pt(), pion.dcaZ()); + histos.fill(HIST("QAafter/pionTPCNSigma"), pion.pt(), pion.tpcNSigmaPi()); + if (pion.hasTOF()) { + histos.fill(HIST("QAafter/pionTOFNSigma"), pion.pt(), pion.tofNSigmaPi()); + } + if constexpr (requires { pion.tpcNClsFound(); }) { + histos.fill(HIST("QAafter/pionTPCNcls"), pion.tpcNClsFound()); + } + } + + // 4-vectors for 3-body + ROOT::Math::PxPyPzEVector pXi, pK0s, pPion, pRes; + pXi = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(xi.pt(), xi.eta(), xi.phi(), xi.mXi())); + pK0s = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(v0.pt(), v0.eta(), v0.phi(), massK0)); + pPion = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(pion.pt(), pion.eta(), pion.phi(), MassPionCharged)); + + pRes = pXi + pK0s + pPion; + + histos.fill(HIST("omega2012_3body/invmass"), pRes.M()); + histos.fill(HIST("omega2012_3body/massPtCent"), pRes.M(), pRes.Pt(), cent); + } + } + } + } + + // 3-body decay analysis: Xi + pi + K0s with ResoTracks + void processThreeBodyWithTracks(const aod::ResoCollision& collision, + aod::ResoCascades const& resocasc, + aod::ResoV0s const& resov0s, + aod::ResoTracks const& resotracks) + { + fillThreeBody(collision, resocasc, resov0s, resotracks); + } + PROCESS_SWITCH(Omega2012Analysis, processThreeBodyWithTracks, "Process 3-body decay with ResoTracks", false); + + // 3-body decay analysis: Xi + pi + K0s with ResoMicroTracks + void processThreeBodyWithMicroTracks(const aod::ResoCollision& collision, + aod::ResoCascades const& resocasc, + aod::ResoV0s const& resov0s, + aod::ResoMicroTracks const& resomicrotracks) + { + fillThreeBody(collision, resocasc, resov0s, resomicrotracks); + } + PROCESS_SWITCH(Omega2012Analysis, processThreeBodyWithMicroTracks, "Process 3-body decay with ResoMicroTracks", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/Tasks/Resonances/xi1820Analysis.cxx b/PWGLF/Tasks/Resonances/xi1820Analysis.cxx new file mode 100644 index 00000000000..fac68d4262a --- /dev/null +++ b/PWGLF/Tasks/Resonances/xi1820Analysis.cxx @@ -0,0 +1,1110 @@ +// 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 xi1820Analysis.cxx +/// \brief Invariant Mass Reconstruction of Xi(1820) Resonance +/// \author Bong-Hwi Lim + +#include "PWGLF/DataModel/LFResonanceTables.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; +using namespace o2::constants::physics; + +struct Xi1820Analysis { + SliceCache cache; + Preslice perResoCollisionV0 = aod::resodaughter::resoCollisionId; + Preslice perResoCollisionTrack = aod::resodaughter::resoCollisionId; + Preslice perResoCollisionMicroTrack = aod::resodaughter::resoCollisionId; + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // Constants + static constexpr float kSmallMomentumDenominator = 1e-10f; // Small value to avoid division by zero + static constexpr float kMaxDcaToPv = 1.0f; // Maximum DCA to primary vertex + static constexpr int kPdgXi1820 = 123314; // o2-linter: disable=pdg/explicit-code (Xi(1820) PDG code not available in PDG_t or o2::constants::physics::Pdg) + static constexpr int kExpectedDaughters = 2; // Expected number of daughters for two-body decay + + // Axes + ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 8.0, 10.0}, "pT"}; + ConfigurableAxis binsPtQA{"binsPtQA", {VARIABLE_WIDTH, 0.0, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0}, "pT (QA)"}; + ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0., 1., 5., 10., 30., 50., 70., 100., 110.}, "Centrality"}; + + // Invariant mass range for Xi(1820) → Λ + K + Configurable cInvMassStart{"cInvMassStart", 1.6, "Invariant mass start (GeV/c^2)"}; + Configurable cInvMassEnd{"cInvMassEnd", 2.2, "Invariant mass end (GeV/c^2)"}; + Configurable cInvMassBins{"cInvMassBins", 600, "Invariant mass bins"}; + + // Basic pre-selections + Configurable cMinPtcut{"cMinPtcut", 0.15, "Minimum pT for candidates"}; + Configurable cMaxEtaCut{"cMaxEtaCut", 0.8, "Maximum |eta|"}; + + // Kaon track selections + Configurable cKaonPtMin{"cKaonPtMin", 0.15, "Minimum kaon pT"}; + Configurable cKaonEtaMax{"cKaonEtaMax", 0.8, "Maximum kaon |eta|"}; + Configurable cKaonDCAxyMax{"cKaonDCAxyMax", 0.1, "Maximum kaon DCAxy to PV"}; + Configurable cKaonDCAzMax{"cKaonDCAzMax", 0.2, "Maximum kaon DCAz to PV"}; + Configurable cKaonTPCRefit{"cKaonTPCRefit", true, "Require TPC refit for kaon"}; + Configurable cKaonITSRefit{"cKaonITSRefit", true, "Require ITS refit for kaon"}; + Configurable cKaonTPCNClusMin{"cKaonTPCNClusMin", 70, "Minimum TPC clusters for kaon"}; + Configurable cKaonITSNClusMin{"cKaonITSNClusMin", 2, "Minimum ITS clusters for kaon"}; + + // Kaon PID selections + Configurable cKaonTPCNSigmaMax{"cKaonTPCNSigmaMax", 3.0, "Maximum TPC NSigma for kaon (if not using pT-dependent)"}; + Configurable cKaonTOFNSigmaMax{"cKaonTOFNSigmaMax", 3.0, "Maximum TOF NSigma for kaon (if not using pT-dependent)"}; + Configurable cKaonUsePtDepPID{"cKaonUsePtDepPID", false, "Use pT-dependent PID cuts"}; + Configurable> cKaonPIDPtBins{"cKaonPIDPtBins", {0.0f, 0.5f, 0.8f, 2.0f, 999.0f}, "pT bin edges for PID cuts (N+1 values for N bins)"}; + Configurable> cKaonTPCNSigmaCuts{"cKaonTPCNSigmaCuts", {3.0f, 3.0f, 2.0f, 2.0f}, "TPC NSigma cuts per pT bin (N values)"}; + Configurable> cKaonTOFNSigmaCuts{"cKaonTOFNSigmaCuts", {3.0f, 3.0f, 3.0f, 3.0f}, "TOF NSigma cuts per pT bin (N values)"}; + Configurable> cKaonTOFRequired{"cKaonTOFRequired", {0, 0, 1, 1}, "Require TOF per pT bin (N values, 0=false, 1=true)"}; + + // V0 (Lambda) selections + Configurable cV0MinCosPA{"cV0MinCosPA", 0.995, "V0 minimum pointing angle cosine"}; + Configurable cV0MaxDaughDCA{"cV0MaxDaughDCA", 1.0, "V0 daughter DCA Maximum"}; + Configurable cV0MassWindow{"cV0MassWindow", 0.005, "Mass window for Lambda selection"}; + Configurable cMaxV0Etacut{"cMaxV0Etacut", 0.8, "V0 maximum eta cut"}; + Configurable cV0RadiusMin{"cV0RadiusMin", 0.5, "V0 decay radius min"}; + Configurable cV0RadiusMax{"cV0RadiusMax", 200.0, "V0 decay radius max"}; + Configurable cV0DauPosDCAtoPVMin{"cV0DauPosDCAtoPVMin", 0.05, "V0 positive daughter DCA to PV min"}; + Configurable cV0DauNegDCAtoPVMin{"cV0DauNegDCAtoPVMin", 0.05, "V0 negative daughter DCA to PV min"}; + Configurable cV0ProperLifetimeMax{"cV0ProperLifetimeMax", 30.0, "Lambda proper lifetime max (cm/c)"}; + + // K0s selections + Configurable cK0sMinCosPA{"cK0sMinCosPA", 0.97, "K0s minimum pointing angle cosine"}; + Configurable cK0sMaxDaughDCA{"cK0sMaxDaughDCA", 1.0, "K0s daughter DCA Maximum"}; + Configurable cK0sMassWindow{"cK0sMassWindow", 0.0043, "Mass window for K0s selection"}; + Configurable cK0sProperLifetimeMax{"cK0sProperLifetimeMax", 20.0, "K0s proper lifetime max (cm/c)"}; + Configurable cK0sArmenterosQtMin{"cK0sArmenterosQtMin", 0.0, "K0s Armenteros qt min"}; + Configurable cK0sArmenterosAlphaMax{"cK0sArmenterosAlphaMax", 0.8, "K0s Armenteros alpha max"}; + Configurable cK0sDauPosDCAtoPVMin{"cK0sDauPosDCAtoPVMin", 0.1, "K0s positive daughter DCA to PV min"}; + Configurable cK0sDauNegDCAtoPVMin{"cK0sDauNegDCAtoPVMin", 0.1, "K0s negative daughter DCA to PV min"}; + Configurable cK0sRadiusMin{"cK0sRadiusMin", 0.5, "K0s decay radius min"}; + Configurable cK0sRadiusMax{"cK0sRadiusMax", 100.0, "K0s decay radius max"}; + Configurable cK0sCrossMassRejection{"cK0sCrossMassRejection", true, "Enable Lambda mass rejection for K0s"}; + + // Event Mixing + Configurable nEvtMixing{"nEvtMixing", 10, "Number of events to mix"}; + ConfigurableAxis cfgVtxBins{"cfgVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; + ConfigurableAxis cfgMultBins{"cfgMultBins", {VARIABLE_WIDTH, 0.0f, 1.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.0f, 110.0f}, "Mixing bins - centrality"}; + + // Track type selection + Configurable cUseMicroTracks{"cUseMicroTracks", false, "Use ResoMicroTracks instead of ResoTracks"}; + + using BinningTypeVertexContributor = ColumnBinningPolicy; + BinningTypeVertexContributor colBinning{{cfgVtxBins, cfgMultBins}, true}; + + void init(InitContext&) + { + AxisSpec centAxis = {binsCent, "V0M (%)"}; + AxisSpec ptAxis = {binsPt, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec ptAxisQA = {binsPtQA, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec invMassAxis = {cInvMassBins, cInvMassStart, cInvMassEnd, "Invariant Mass (GeV/#it{c}^{2})"}; + AxisSpec lambdaMassAxis = {200, 1.08, 1.16, "#Lambda mass (GeV/#it{c}^{2})"}; + AxisSpec dcaAxis = {200, 0., 2.0, "DCA (cm)"}; + AxisSpec dcaxyAxis = {200, -1.0, 1.0, "DCA_{xy} (cm)"}; + AxisSpec dcazAxis = {200, -2.0, 2.0, "DCA_{z} (cm)"}; + AxisSpec cosPAAxis = {1000, 0.95, 1.0, "cos(PA)"}; + AxisSpec radiusAxis = {200, 0, 200, "Radius (cm)"}; + AxisSpec lifetimeAxis = {200, 0, 50, "Proper lifetime (cm/c)"}; + AxisSpec nsigmaAxis = {100, -5.0, 5.0, "N#sigma"}; + + // Event QA histograms + histos.add("Event/posZ", "Event vertex Z position", kTH1F, {{200, -20., 20., "V_{z} (cm)"}}); + histos.add("Event/centrality", "Event centrality distribution", kTH1F, {centAxis}); + histos.add("Event/posZvsCent", "Vertex Z vs Centrality", kTH2F, {{200, -20., 20., "V_{z} (cm)"}, centAxis}); + histos.add("Event/nV0s", "Number of V0s per event", kTH1F, {{200, 0., 200., "N_{V0s}"}}); + histos.add("Event/nKaons", "Number of kaons per event", kTH1F, {{200, 0., 200., "N_{kaons}"}}); + histos.add("Event/nV0sAfterCuts", "Number of V0s per event after cuts", kTH1F, {{100, 0., 100., "N_{V0s}"}}); + histos.add("Event/nKaonsAfterCuts", "Number of kaons per event after cuts", kTH1F, {{100, 0., 100., "N_{kaons}"}}); + + // Lambda QA histograms + histos.add("QAbefore/lambdaMass", "Lambda mass before cuts", kTH1F, {lambdaMassAxis}); + histos.add("QAbefore/lambdaPt", "Lambda pT before cuts", kTH1F, {ptAxisQA}); + histos.add("QAbefore/lambdaEta", "Lambda eta before cuts", kTH1F, {{100, -2.0, 2.0, "#eta"}}); + histos.add("QAbefore/lambdaCosPA", "Lambda CosPA before cuts", kTH2F, {ptAxisQA, cosPAAxis}); + histos.add("QAbefore/lambdaRadius", "Lambda radius before cuts", kTH2F, {ptAxisQA, radiusAxis}); + histos.add("QAbefore/lambdaDauDCA", "Lambda daughter DCA before cuts", kTH2F, {ptAxisQA, dcaAxis}); + histos.add("QAbefore/lambdaProperLifetime", "Lambda proper lifetime before cuts", kTH2F, {ptAxisQA, lifetimeAxis}); + histos.add("QAbefore/lambdaDauPosDCA", "Lambda positive daughter DCA before cuts", kTH2F, {ptAxisQA, dcaAxis}); + histos.add("QAbefore/lambdaDauNegDCA", "Lambda negative daughter DCA before cuts", kTH2F, {ptAxisQA, dcaAxis}); + + histos.add("QAafter/lambdaMass", "Lambda mass after cuts", kTH1F, {lambdaMassAxis}); + histos.add("QAafter/lambdaPt", "Lambda pT after cuts", kTH1F, {ptAxisQA}); + histos.add("QAafter/lambdaEta", "Lambda eta after cuts", kTH1F, {{100, -2.0, 2.0, "#eta"}}); + histos.add("QAafter/lambdaCosPA", "Lambda CosPA after cuts", kTH2F, {ptAxisQA, cosPAAxis}); + histos.add("QAafter/lambdaRadius", "Lambda radius after cuts", kTH2F, {ptAxisQA, radiusAxis}); + histos.add("QAafter/lambdaDauDCA", "Lambda daughter DCA after cuts", kTH2F, {ptAxisQA, dcaAxis}); + histos.add("QAafter/lambdaProperLifetime", "Lambda proper lifetime after cuts", kTH2F, {ptAxisQA, lifetimeAxis}); + histos.add("QAafter/lambdaDauPosDCA", "Lambda positive daughter DCA after cuts", kTH2F, {ptAxisQA, dcaAxis}); + histos.add("QAafter/lambdaDauNegDCA", "Lambda negative daughter DCA after cuts", kTH2F, {ptAxisQA, dcaAxis}); + + // Kaon QA histograms + histos.add("QAbefore/kaonPt", "Kaon pT before cuts", kTH1F, {ptAxisQA}); + histos.add("QAbefore/kaonEta", "Kaon eta before cuts", kTH1F, {{100, -2.0, 2.0, "#eta"}}); + histos.add("QAbefore/kaonDCAxy", "Kaon DCAxy before cuts", kTH2F, {ptAxisQA, dcaxyAxis}); + histos.add("QAbefore/kaonDCAz", "Kaon DCAz before cuts", kTH2F, {ptAxisQA, dcazAxis}); + histos.add("QAbefore/kaonTPCNcls", "Kaon TPC clusters before cuts", kTH1F, {{160, 0, 160, "N_{TPC clusters}"}}); + histos.add("QAbefore/kaonITSNcls", "Kaon ITS clusters before cuts", kTH1F, {{10, 0, 10, "N_{ITS clusters}"}}); + histos.add("QAbefore/kaonTPCNSigma", "Kaon TPC NSigma before cuts", kTH2F, {ptAxisQA, nsigmaAxis}); + histos.add("QAbefore/kaonTOFNSigma", "Kaon TOF NSigma before cuts", kTH2F, {ptAxisQA, nsigmaAxis}); + + histos.add("QAafter/kaonPt", "Kaon pT after cuts", kTH1F, {ptAxisQA}); + histos.add("QAafter/kaonEta", "Kaon eta after cuts", kTH1F, {{100, -2.0, 2.0, "#eta"}}); + histos.add("QAafter/kaonDCAxy", "Kaon DCAxy after cuts", kTH2F, {ptAxisQA, dcaxyAxis}); + histos.add("QAafter/kaonDCAz", "Kaon DCAz after cuts", kTH2F, {ptAxisQA, dcazAxis}); + histos.add("QAafter/kaonTPCNcls", "Kaon TPC clusters after cuts", kTH1F, {{160, 0, 160, "N_{TPC clusters}"}}); + histos.add("QAafter/kaonITSNcls", "Kaon ITS clusters after cuts", kTH1F, {{10, 0, 10, "N_{ITS clusters}"}}); + histos.add("QAafter/kaonTPCNSigma", "Kaon TPC NSigma after cuts", kTH2F, {ptAxisQA, nsigmaAxis}); + histos.add("QAafter/kaonTOFNSigma", "Kaon TOF NSigma after cuts", kTH2F, {ptAxisQA, nsigmaAxis}); + + // Resonance histograms - 4 combinations + // K+ Lambda + histos.add("xi1820/kplus_lambda/hInvMassKplusLambda", "Invariant mass of Xi(1820) → K^{+} + #Lambda", kTH1F, {invMassAxis}); + histos.add("xi1820/kplus_lambda/hInvMassKplusLambda_Mix", "Mixed event Invariant mass of Xi(1820) → K^{+} + #Lambda", kTH1F, {invMassAxis}); + histos.add("xi1820/kplus_lambda/hMassPtCentKplusLambda", "Xi(1820) mass vs pT vs cent (K^{+}#Lambda)", kTH3F, {invMassAxis, ptAxis, centAxis}); + histos.add("xi1820/kplus_lambda/hMassPtCentKplusLambda_Mix", "Mixed event Xi(1820) mass vs pT vs cent (K^{+}#Lambda)", kTH3F, {invMassAxis, ptAxis, centAxis}); + + // K+ Anti-Lambda + histos.add("xi1820/kplus_antilambda/hInvMassKplusAntiLambda", "Invariant mass of Xi(1820) → K^{+} + #bar{#Lambda}", kTH1F, {invMassAxis}); + histos.add("xi1820/kplus_antilambda/hInvMassKplusAntiLambda_Mix", "Mixed event Invariant mass of Xi(1820) → K^{+} + #bar{#Lambda}", kTH1F, {invMassAxis}); + histos.add("xi1820/kplus_antilambda/hMassPtCentKplusAntiLambda", "Xi(1820) mass vs pT vs cent (K^{+}#bar{#Lambda})", kTH3F, {invMassAxis, ptAxis, centAxis}); + histos.add("xi1820/kplus_antilambda/hMassPtCentKplusAntiLambda_Mix", "Mixed event Xi(1820) mass vs pT vs cent (K^{+}#bar{#Lambda})", kTH3F, {invMassAxis, ptAxis, centAxis}); + + // K- Lambda + histos.add("xi1820/kminus_lambda/hInvMassKminusLambda", "Invariant mass of Xi(1820) → K^{-} + #Lambda", kTH1F, {invMassAxis}); + histos.add("xi1820/kminus_lambda/hInvMassKminusLambda_Mix", "Mixed event Invariant mass of Xi(1820) → K^{-} + #Lambda", kTH1F, {invMassAxis}); + histos.add("xi1820/kminus_lambda/hMassPtCentKminusLambda", "Xi(1820) mass vs pT vs cent (K^{-}#Lambda)", kTH3F, {invMassAxis, ptAxis, centAxis}); + histos.add("xi1820/kminus_lambda/hMassPtCentKminusLambda_Mix", "Mixed event Xi(1820) mass vs pT vs cent (K^{-}#Lambda)", kTH3F, {invMassAxis, ptAxis, centAxis}); + + // K- Anti-Lambda + histos.add("xi1820/kminus_antilambda/hInvMassKminusAntiLambda", "Invariant mass of Xi(1820) → K^{-} + #bar{#Lambda}", kTH1F, {invMassAxis}); + histos.add("xi1820/kminus_antilambda/hInvMassKminusAntiLambda_Mix", "Mixed event Invariant mass of Xi(1820) → K^{-} + #bar{#Lambda}", kTH1F, {invMassAxis}); + histos.add("xi1820/kminus_antilambda/hMassPtCentKminusAntiLambda", "Xi(1820) mass vs pT vs cent (K^{-}#bar{#Lambda})", kTH3F, {invMassAxis, ptAxis, centAxis}); + histos.add("xi1820/kminus_antilambda/hMassPtCentKminusAntiLambda_Mix", "Mixed event Xi(1820) mass vs pT vs cent (K^{-}#bar{#Lambda})", kTH3F, {invMassAxis, ptAxis, centAxis}); + + // K0s + Lambda + histos.add("xi1820/k0s_lambda/hInvMassK0sLambda", "Invariant mass of Xi(1820) → K^{0}_{S} + #Lambda", kTH1F, {invMassAxis}); + histos.add("xi1820/k0s_lambda/hInvMassK0sLambda_Mix", "Mixed event Invariant mass of Xi(1820) → K^{0}_{S} + #Lambda", kTH1F, {invMassAxis}); + histos.add("xi1820/k0s_lambda/hMassPtCentK0sLambda", "Xi(1820) mass vs pT vs cent (K^{0}_{S}#Lambda)", kTH3F, {invMassAxis, ptAxis, centAxis}); + histos.add("xi1820/k0s_lambda/hMassPtCentK0sLambda_Mix", "Mixed event Xi(1820) mass vs pT vs cent (K^{0}_{S}#Lambda)", kTH3F, {invMassAxis, ptAxis, centAxis}); + + // K0s + Anti-Lambda + histos.add("xi1820/k0s_antilambda/hInvMassK0sAntiLambda", "Invariant mass of Xi(1820) → K^{0}_{S} + #bar{#Lambda}", kTH1F, {invMassAxis}); + histos.add("xi1820/k0s_antilambda/hInvMassK0sAntiLambda_Mix", "Mixed event Invariant mass of Xi(1820) → K^{0}_{S} + #bar{#Lambda}", kTH1F, {invMassAxis}); + histos.add("xi1820/k0s_antilambda/hMassPtCentK0sAntiLambda", "Xi(1820) mass vs pT vs cent (K^{0}_{S}#bar{#Lambda})", kTH3F, {invMassAxis, ptAxis, centAxis}); + histos.add("xi1820/k0s_antilambda/hMassPtCentK0sAntiLambda_Mix", "Mixed event Xi(1820) mass vs pT vs cent (K^{0}_{S}#bar{#Lambda})", kTH3F, {invMassAxis, ptAxis, centAxis}); + + // MC truth histograms + AxisSpec etaAxis = {100, -2.0, 2.0, "#eta"}; + AxisSpec rapidityAxis = {100, -2.0, 2.0, "y"}; + + histos.add("MC/hMCGenXi1820Pt", "MC Generated Xi(1820) pT", kTH1F, {ptAxis}); + histos.add("MC/hMCGenXi1820PtEta", "MC Generated Xi(1820) pT vs eta", kTH2F, {ptAxis, etaAxis}); + histos.add("MC/hMCGenXi1820Y", "MC Generated Xi(1820) rapidity", kTH1F, {rapidityAxis}); + histos.add("MC/hMCRecXi1820Pt", "MC Reconstructed Xi(1820) pT", kTH1F, {ptAxis}); + histos.add("MC/hMCRecXi1820PtEta", "MC Reconstructed Xi(1820) pT vs eta", kTH2F, {ptAxis, etaAxis}); + + // MC truth invariant mass (from MC particles) + histos.add("MC/hMCTruthInvMassKplusLambda", "MC Truth Inv Mass K^{+}#Lambda", kTH1F, {invMassAxis}); + histos.add("MC/hMCTruthInvMassKminusAntiLambda", "MC Truth Inv Mass K^{-}#bar{#Lambda}", kTH1F, {invMassAxis}); + histos.add("MC/hMCTruthInvMassK0sLambda", "MC Truth Inv Mass K^{0}_{S}#Lambda", kTH1F, {invMassAxis}); + histos.add("MC/hMCTruthInvMassK0sAntiLambda", "MC Truth Inv Mass K^{0}_{S}#bar{#Lambda}", kTH1F, {invMassAxis}); + + // MC truth invariant mass vs pT (2D) + histos.add("MC/hMCTruthMassPtKplusLambda", "MC Truth Mass vs pT K^{+}#Lambda", kTH2F, {invMassAxis, ptAxis}); + histos.add("MC/hMCTruthMassPtKminusAntiLambda", "MC Truth Mass vs pT K^{-}#bar{#Lambda}", kTH2F, {invMassAxis, ptAxis}); + histos.add("MC/hMCTruthMassPtK0sLambda", "MC Truth Mass vs pT K^{0}_{S}#Lambda", kTH2F, {invMassAxis, ptAxis}); + histos.add("MC/hMCTruthMassPtK0sAntiLambda", "MC Truth Mass vs pT K^{0}_{S}#bar{#Lambda}", kTH2F, {invMassAxis, ptAxis}); + + // K0s QA histograms + histos.add("QAbefore/k0sMass", "K0s mass before cuts", kTH1F, {{100, 0.4, 0.6, "K^{0}_{S} mass (GeV/#it{c}^{2})"}}); + histos.add("QAbefore/k0sPt", "K0s pT before cuts", kTH1F, {ptAxisQA}); + histos.add("QAbefore/k0sEta", "K0s eta before cuts", kTH1F, {{100, -2.0, 2.0, "#eta"}}); + histos.add("QAbefore/k0sCosPA", "K0s CosPA before cuts", kTH2F, {ptAxisQA, cosPAAxis}); + histos.add("QAbefore/k0sRadius", "K0s radius before cuts", kTH2F, {ptAxisQA, radiusAxis}); + histos.add("QAbefore/k0sDauDCA", "K0s daughter DCA before cuts", kTH2F, {ptAxisQA, dcaAxis}); + histos.add("QAbefore/k0sProperLifetime", "K0s proper lifetime before cuts", kTH2F, {ptAxisQA, lifetimeAxis}); + + histos.add("QAafter/k0sMass", "K0s mass after cuts", kTH1F, {{100, 0.4, 0.6, "K^{0}_{S} mass (GeV/#it{c}^{2})"}}); + histos.add("QAafter/k0sPt", "K0s pT after cuts", kTH1F, {ptAxisQA}); + histos.add("QAafter/k0sEta", "K0s eta after cuts", kTH1F, {{100, -2.0, 2.0, "#eta"}}); + histos.add("QAafter/k0sCosPA", "K0s CosPA after cuts", kTH2F, {ptAxisQA, cosPAAxis}); + histos.add("QAafter/k0sRadius", "K0s radius after cuts", kTH2F, {ptAxisQA, radiusAxis}); + histos.add("QAafter/k0sDauDCA", "K0s daughter DCA after cuts", kTH2F, {ptAxisQA, dcaAxis}); + histos.add("QAafter/k0sProperLifetime", "K0s proper lifetime after cuts", kTH2F, {ptAxisQA, lifetimeAxis}); + } + + // Lambda/Anti-Lambda selection + template + bool v0Cut(const CollisionType& collision, const V0Type& v0, bool isLambda) + { + // Basic kinematic cuts + if (std::abs(v0.eta()) > cMaxV0Etacut) + return false; + if (v0.pt() < cMinPtcut) + return false; + + // Topological cuts + if (v0.v0CosPA() < cV0MinCosPA) + return false; + if (v0.daughDCA() > cV0MaxDaughDCA) + return false; + + // Daughter DCA to PV cuts + if (std::abs(v0.dcapostopv()) < cV0DauPosDCAtoPVMin) + return false; + if (std::abs(v0.dcanegtopv()) < cV0DauNegDCAtoPVMin) + return false; + + // Radius cuts + auto radius = v0.transRadius(); + if (radius < cV0RadiusMin || radius > cV0RadiusMax) + return false; + + // Proper lifetime cut + float dx = v0.decayVtxX() - collision.posX(); + float dy = v0.decayVtxY() - collision.posY(); + float dz = v0.decayVtxZ() - collision.posZ(); + float l = std::sqrt(dx * dx + dy * dy + dz * dz); + float p = std::sqrt(v0.px() * v0.px() + v0.py() * v0.py() + v0.pz() * v0.pz()); + auto properLifetime = (l / (p + kSmallMomentumDenominator)) * MassLambda; + if (properLifetime > cV0ProperLifetimeMax) + return false; + + // Mass window + if (isLambda) { + if (std::abs(v0.mLambda() - MassLambda) > cV0MassWindow) + return false; + } else { + if (std::abs(v0.mAntiLambda() - MassLambda) > cV0MassWindow) + return false; + } + + return true; + } + + // K0s selection + template + bool k0sCut(const CollisionType& collision, const V0Type& v0) + { + // Basic kinematic cuts + if (std::abs(v0.eta()) > cMaxV0Etacut) + return false; + if (v0.pt() < cMinPtcut) + return false; + + // Topological cuts + if (v0.v0CosPA() < cK0sMinCosPA) + return false; + if (v0.daughDCA() > cK0sMaxDaughDCA) + return false; + + // Daughter DCA to PV cuts + if (std::abs(v0.dcapostopv()) < cK0sDauPosDCAtoPVMin) + return false; + if (std::abs(v0.dcanegtopv()) < cK0sDauNegDCAtoPVMin) + return false; + + // Radius cuts + auto radius = v0.transRadius(); + if (radius < cK0sRadiusMin || radius > cK0sRadiusMax) + return false; + + // DCA to PV + if (std::abs(v0.dcav0topv()) > kMaxDcaToPv) + return false; + + // Proper lifetime cut + float dx = v0.decayVtxX() - collision.posX(); + float dy = v0.decayVtxY() - collision.posY(); + float dz = v0.decayVtxZ() - collision.posZ(); + float l = std::sqrt(dx * dx + dy * dy + dz * dz); + float p = std::sqrt(v0.px() * v0.px() + v0.py() * v0.py() + v0.pz() * v0.pz()); + auto properLifetime = (l / (p + kSmallMomentumDenominator)) * MassK0Short; + if (properLifetime > cK0sProperLifetimeMax) + return false; + + // Mass window + if (std::abs(v0.mK0Short() - MassK0Short) > cK0sMassWindow) + return false; + + // Competing V0 rejection: remove (Anti)Λ + if (cK0sCrossMassRejection) { + if (std::abs(v0.mLambda() - MassLambda) < cK0sMassWindow) + return false; + if (std::abs(v0.mAntiLambda() - MassLambda) < cK0sMassWindow) + return false; + } + + return true; + } + + // Helper function to find pT bin index + int getPtBinIndex(float pt) + { + auto ptBins = static_cast>(cKaonPIDPtBins); + for (size_t i = 0; i < ptBins.size() - 1; i++) { + if (pt >= ptBins[i] && pt < ptBins[i + 1]) { + return i; + } + } + return -1; // should not happen if bins are properly configured + } + + // Kaon PID selection + template + bool kaonPidCut(const TrackType& track) + { + float pt = track.pt(); + + if constexpr (IsResoMicrotrack) { + // For ResoMicroTracks - decode PID from flags + float tpcNSigma = o2::aod::resomicrodaughter::PidNSigma::getTPCnSigma(track.pidNSigmaKaFlag()); + float tofNSigma = track.hasTOF() ? o2::aod::resomicrodaughter::PidNSigma::getTOFnSigma(track.pidNSigmaKaFlag()) : 999.f; + + if (cKaonUsePtDepPID) { + // pT-dependent PID with binning + int ptBin = getPtBinIndex(pt); + if (ptBin < 0) + return false; // safety check + + auto tpcCuts = static_cast>(cKaonTPCNSigmaCuts); + auto tofCuts = static_cast>(cKaonTOFNSigmaCuts); + auto tofRequired = static_cast>(cKaonTOFRequired); + + // Check array sizes + if (ptBin >= static_cast(tpcCuts.size()) || + ptBin >= static_cast(tofCuts.size()) || + ptBin >= static_cast(tofRequired.size())) { + return false; // safety check + } + + // Apply TPC cut + if (std::abs(tpcNSigma) >= tpcCuts[ptBin]) + return false; + + // Apply TOF requirement and cut + if (tofRequired[ptBin] != 0) { + if (!track.hasTOF()) + return false; + if (std::abs(tofNSigma) >= tofCuts[ptBin]) + return false; + } else { + // TOF optional but apply cut if present + if (track.hasTOF() && std::abs(tofNSigma) >= tofCuts[ptBin]) + return false; + } + + return true; + } else { + // Standard PID + bool tpcPass = std::abs(tpcNSigma) < cKaonTPCNSigmaMax; + bool tofPass = track.hasTOF() ? std::abs(tofNSigma) < cKaonTOFNSigmaMax : true; + return tpcPass && tofPass; + } + } else { + // For ResoTracks - direct access + float tpcNSigma = track.tpcNSigmaKa(); + float tofNSigma = track.hasTOF() ? track.tofNSigmaKa() : 999.f; + + if (cKaonUsePtDepPID) { + // pT-dependent PID with binning + int ptBin = getPtBinIndex(pt); + if (ptBin < 0) + return false; // safety check + + auto tpcCuts = static_cast>(cKaonTPCNSigmaCuts); + auto tofCuts = static_cast>(cKaonTOFNSigmaCuts); + auto tofRequired = static_cast>(cKaonTOFRequired); + + // Check array sizes + if (ptBin >= static_cast(tpcCuts.size()) || + ptBin >= static_cast(tofCuts.size()) || + ptBin >= static_cast(tofRequired.size())) { + return false; // safety check + } + + // Apply TPC cut + if (std::abs(tpcNSigma) >= tpcCuts[ptBin]) + return false; + + // Apply TOF requirement and cut + if (tofRequired[ptBin] != 0) { + if (!track.hasTOF()) + return false; + if (std::abs(tofNSigma) >= tofCuts[ptBin]) + return false; + } else { + // TOF optional but apply cut if present + if (track.hasTOF() && std::abs(tofNSigma) >= tofCuts[ptBin]) + return false; + } + + return true; + } else { + // Standard PID + bool tpcPass = std::abs(tpcNSigma) < cKaonTPCNSigmaMax; + bool tofPass = track.hasTOF() ? std::abs(tofNSigma) < cKaonTOFNSigmaMax : true; + return tpcPass && tofPass; + } + } + } + + // Kaon track selection (for both ResoTracks and ResoMicroTracks) + template + bool kaonCut(const TrackType& track) + { + // Basic kinematic cuts + if (track.pt() < cKaonPtMin) + return false; + if (std::abs(track.eta()) > cKaonEtaMax) + return false; + + // DCA cuts - different access for ResoMicroTracks + if constexpr (IsResoMicrotrack) { + if (o2::aod::resomicrodaughter::ResoMicroTrackSelFlag::decodeDCAxy(track.trackSelectionFlags()) > cKaonDCAxyMax) + return false; + if (o2::aod::resomicrodaughter::ResoMicroTrackSelFlag::decodeDCAz(track.trackSelectionFlags()) > cKaonDCAzMax) + return false; + } else { + if (std::abs(track.dcaXY()) > cKaonDCAxyMax) + return false; + if (std::abs(track.dcaZ()) > cKaonDCAzMax) + return false; + } + + // Track quality cuts - check if fields are available (only for ResoTracks) + if constexpr (!IsResoMicrotrack) { + if constexpr (requires { track.tpcNClsFound(); }) { + if (track.tpcNClsFound() < cKaonTPCNClusMin) + return false; + } + if constexpr (requires { track.itsNCls(); }) { + if (track.itsNCls() < cKaonITSNClusMin) + return false; + } + } + + // PID selection + if (!kaonPidCut(track)) + return false; + + return true; + } + + template + void fill(const CollisionT& collision, const V0sT& v0s, const TracksT& tracks) + { + auto cent = collision.cent(); + + // Fill event QA histograms (only for same-event) + if constexpr (!IsMix) { + histos.fill(HIST("Event/posZ"), collision.posZ()); + histos.fill(HIST("Event/centrality"), cent); + histos.fill(HIST("Event/posZvsCent"), collision.posZ(), cent); + histos.fill(HIST("Event/nV0s"), v0s.size()); + histos.fill(HIST("Event/nKaons"), tracks.size()); + } + + // Count candidates after cuts + int nV0sAfterCuts = 0; + int nKaonsAfterCuts = 0; + + // Loop over kaon candidates + for (const auto& kaon : tracks) { + // QA before cuts + if constexpr (!IsMix) { + histos.fill(HIST("QAbefore/kaonPt"), kaon.pt()); + histos.fill(HIST("QAbefore/kaonEta"), kaon.eta()); + if constexpr (IsResoMicrotrack) { + histos.fill(HIST("QAbefore/kaonDCAxy"), kaon.pt(), o2::aod::resomicrodaughter::ResoMicroTrackSelFlag::decodeDCAxy(kaon.trackSelectionFlags())); + histos.fill(HIST("QAbefore/kaonDCAz"), kaon.pt(), o2::aod::resomicrodaughter::ResoMicroTrackSelFlag::decodeDCAz(kaon.trackSelectionFlags())); + histos.fill(HIST("QAbefore/kaonTPCNSigma"), kaon.pt(), o2::aod::resomicrodaughter::PidNSigma::getTPCnSigma(kaon.pidNSigmaKaFlag())); + if (kaon.hasTOF()) { + histos.fill(HIST("QAbefore/kaonTOFNSigma"), kaon.pt(), o2::aod::resomicrodaughter::PidNSigma::getTOFnSigma(kaon.pidNSigmaKaFlag())); + } + } else { + histos.fill(HIST("QAbefore/kaonDCAxy"), kaon.pt(), kaon.dcaXY()); + histos.fill(HIST("QAbefore/kaonDCAz"), kaon.pt(), kaon.dcaZ()); + histos.fill(HIST("QAbefore/kaonTPCNSigma"), kaon.pt(), kaon.tpcNSigmaKa()); + if (kaon.hasTOF()) { + histos.fill(HIST("QAbefore/kaonTOFNSigma"), kaon.pt(), kaon.tofNSigmaKa()); + } + if constexpr (requires { kaon.tpcNClsFound(); }) { + histos.fill(HIST("QAbefore/kaonTPCNcls"), kaon.tpcNClsFound()); + } + if constexpr (requires { kaon.itsNCls(); }) { + histos.fill(HIST("QAbefore/kaonITSNcls"), kaon.itsNCls()); + } + } + } + + if (!kaonCut(kaon)) + continue; + + if constexpr (!IsMix) { + nKaonsAfterCuts++; + // QA after cuts + histos.fill(HIST("QAafter/kaonPt"), kaon.pt()); + histos.fill(HIST("QAafter/kaonEta"), kaon.eta()); + if constexpr (IsResoMicrotrack) { + histos.fill(HIST("QAafter/kaonDCAxy"), kaon.pt(), o2::aod::resomicrodaughter::ResoMicroTrackSelFlag::decodeDCAxy(kaon.trackSelectionFlags())); + histos.fill(HIST("QAafter/kaonDCAz"), kaon.pt(), o2::aod::resomicrodaughter::ResoMicroTrackSelFlag::decodeDCAz(kaon.trackSelectionFlags())); + histos.fill(HIST("QAafter/kaonTPCNSigma"), kaon.pt(), o2::aod::resomicrodaughter::PidNSigma::getTPCnSigma(kaon.pidNSigmaKaFlag())); + if (kaon.hasTOF()) { + histos.fill(HIST("QAafter/kaonTOFNSigma"), kaon.pt(), o2::aod::resomicrodaughter::PidNSigma::getTOFnSigma(kaon.pidNSigmaKaFlag())); + } + } else { + histos.fill(HIST("QAafter/kaonDCAxy"), kaon.pt(), kaon.dcaXY()); + histos.fill(HIST("QAafter/kaonDCAz"), kaon.pt(), kaon.dcaZ()); + histos.fill(HIST("QAafter/kaonTPCNSigma"), kaon.pt(), kaon.tpcNSigmaKa()); + if (kaon.hasTOF()) { + histos.fill(HIST("QAafter/kaonTOFNSigma"), kaon.pt(), kaon.tofNSigmaKa()); + } + if constexpr (requires { kaon.tpcNClsFound(); }) { + histos.fill(HIST("QAafter/kaonTPCNcls"), kaon.tpcNClsFound()); + } + if constexpr (requires { kaon.itsNCls(); }) { + histos.fill(HIST("QAafter/kaonITSNcls"), kaon.itsNCls()); + } + } + } + + int kaonCharge = kaon.sign(); + + // Loop over V0 candidates + for (const auto& v0 : v0s) { + // Lambda QA before cuts + if constexpr (!IsMix) { + histos.fill(HIST("QAbefore/lambdaMass"), v0.mLambda()); + histos.fill(HIST("QAbefore/lambdaPt"), v0.pt()); + histos.fill(HIST("QAbefore/lambdaEta"), v0.eta()); + histos.fill(HIST("QAbefore/lambdaCosPA"), v0.pt(), v0.v0CosPA()); + histos.fill(HIST("QAbefore/lambdaRadius"), v0.pt(), v0.transRadius()); + histos.fill(HIST("QAbefore/lambdaDauDCA"), v0.pt(), v0.daughDCA()); + histos.fill(HIST("QAbefore/lambdaDauPosDCA"), v0.pt(), std::abs(v0.dcapostopv())); + histos.fill(HIST("QAbefore/lambdaDauNegDCA"), v0.pt(), std::abs(v0.dcanegtopv())); + + // Calculate proper lifetime manually + float dx = v0.decayVtxX() - collision.posX(); + float dy = v0.decayVtxY() - collision.posY(); + float dz = v0.decayVtxZ() - collision.posZ(); + float l = std::sqrt(dx * dx + dy * dy + dz * dz); + float p = std::sqrt(v0.px() * v0.px() + v0.py() * v0.py() + v0.pz() * v0.pz()); + auto properLifetime = (l / (p + kSmallMomentumDenominator)) * MassLambda; + histos.fill(HIST("QAbefore/lambdaProperLifetime"), v0.pt(), properLifetime); + } + + // Try Lambda + bool isLambda = v0Cut(collision, v0, true); + // Try Anti-Lambda + bool isAntiLambda = v0Cut(collision, v0, false); + + if (!isLambda && !isAntiLambda) + continue; + + if constexpr (!IsMix) { + nV0sAfterCuts++; + // QA after cuts (fill for whichever passes) + if (isLambda) { + histos.fill(HIST("QAafter/lambdaMass"), v0.mLambda()); + } + if (isAntiLambda) { + histos.fill(HIST("QAafter/lambdaMass"), v0.mAntiLambda()); + } + histos.fill(HIST("QAafter/lambdaPt"), v0.pt()); + histos.fill(HIST("QAafter/lambdaEta"), v0.eta()); + histos.fill(HIST("QAafter/lambdaCosPA"), v0.pt(), v0.v0CosPA()); + histos.fill(HIST("QAafter/lambdaRadius"), v0.pt(), v0.transRadius()); + histos.fill(HIST("QAafter/lambdaDauDCA"), v0.pt(), v0.daughDCA()); + histos.fill(HIST("QAafter/lambdaDauPosDCA"), v0.pt(), std::abs(v0.dcapostopv())); + histos.fill(HIST("QAafter/lambdaDauNegDCA"), v0.pt(), std::abs(v0.dcanegtopv())); + + float dx = v0.decayVtxX() - collision.posX(); + float dy = v0.decayVtxY() - collision.posY(); + float dz = v0.decayVtxZ() - collision.posZ(); + float l = std::sqrt(dx * dx + dy * dy + dz * dz); + float p = std::sqrt(v0.px() * v0.px() + v0.py() * v0.py() + v0.pz() * v0.pz()); + auto properLifetime = (l / (p + kSmallMomentumDenominator)) * MassLambda; + histos.fill(HIST("QAafter/lambdaProperLifetime"), v0.pt(), properLifetime); + } + + // Build 4 combinations + ROOT::Math::PxPyPzEVector pKaon, pLambda, pRes; + pKaon = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(kaon.pt(), kaon.eta(), kaon.phi(), MassKaonCharged)); + + // K+ Lambda + if (kaonCharge > 0 && isLambda) { + pLambda = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(v0.pt(), v0.eta(), v0.phi(), v0.mLambda())); + pRes = pKaon + pLambda; + if constexpr (!IsMix) { + histos.fill(HIST("xi1820/kplus_lambda/hInvMassKplusLambda"), pRes.M()); + histos.fill(HIST("xi1820/kplus_lambda/hMassPtCentKplusLambda"), pRes.M(), pRes.Pt(), cent); + } else { + histos.fill(HIST("xi1820/kplus_lambda/hInvMassKplusLambda_Mix"), pRes.M()); + histos.fill(HIST("xi1820/kplus_lambda/hMassPtCentKplusLambda_Mix"), pRes.M(), pRes.Pt(), cent); + } + } + + // K+ Anti-Lambda + if (kaonCharge > 0 && isAntiLambda) { + pLambda = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(v0.pt(), v0.eta(), v0.phi(), v0.mAntiLambda())); + pRes = pKaon + pLambda; + if constexpr (!IsMix) { + histos.fill(HIST("xi1820/kplus_antilambda/hInvMassKplusAntiLambda"), pRes.M()); + histos.fill(HIST("xi1820/kplus_antilambda/hMassPtCentKplusAntiLambda"), pRes.M(), pRes.Pt(), cent); + } else { + histos.fill(HIST("xi1820/kplus_antilambda/hInvMassKplusAntiLambda_Mix"), pRes.M()); + histos.fill(HIST("xi1820/kplus_antilambda/hMassPtCentKplusAntiLambda_Mix"), pRes.M(), pRes.Pt(), cent); + } + } + + // K- Lambda + if (kaonCharge < 0 && isLambda) { + pLambda = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(v0.pt(), v0.eta(), v0.phi(), v0.mLambda())); + pRes = pKaon + pLambda; + if constexpr (!IsMix) { + histos.fill(HIST("xi1820/kminus_lambda/hInvMassKminusLambda"), pRes.M()); + histos.fill(HIST("xi1820/kminus_lambda/hMassPtCentKminusLambda"), pRes.M(), pRes.Pt(), cent); + } else { + histos.fill(HIST("xi1820/kminus_lambda/hInvMassKminusLambda_Mix"), pRes.M()); + histos.fill(HIST("xi1820/kminus_lambda/hMassPtCentKminusLambda_Mix"), pRes.M(), pRes.Pt(), cent); + } + } + + // K- Anti-Lambda + if (kaonCharge < 0 && isAntiLambda) { + pLambda = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(v0.pt(), v0.eta(), v0.phi(), v0.mAntiLambda())); + pRes = pKaon + pLambda; + if constexpr (!IsMix) { + histos.fill(HIST("xi1820/kminus_antilambda/hInvMassKminusAntiLambda"), pRes.M()); + histos.fill(HIST("xi1820/kminus_antilambda/hMassPtCentKminusAntiLambda"), pRes.M(), pRes.Pt(), cent); + } else { + histos.fill(HIST("xi1820/kminus_antilambda/hInvMassKminusAntiLambda_Mix"), pRes.M()); + histos.fill(HIST("xi1820/kminus_antilambda/hMassPtCentKminusAntiLambda_Mix"), pRes.M(), pRes.Pt(), cent); + } + } + } + } + + // Fill event QA for after-cuts counters (only for same-event) + if constexpr (!IsMix) { + histos.fill(HIST("Event/nV0sAfterCuts"), nV0sAfterCuts); + histos.fill(HIST("Event/nKaonsAfterCuts"), nKaonsAfterCuts); + } + } + + void processDummy(const aod::ResoCollision& /*collision*/) + { + // Dummy function to satisfy the compiler + } + PROCESS_SWITCH(Xi1820Analysis, processDummy, "Process Dummy", true); + + void processDataWithTracks(const aod::ResoCollision& collision, + aod::ResoV0s const& resov0s, + aod::ResoTracks const& resotracks) + { + fill(collision, resov0s, resotracks); + } + PROCESS_SWITCH(Xi1820Analysis, processDataWithTracks, "Process Event with ResoTracks", false); + + void processDataWithMicroTracks(const aod::ResoCollision& collision, + aod::ResoV0s const& resov0s, + aod::ResoMicroTracks const& resomicrotracks) + { + fill(collision, resov0s, resomicrotracks); + } + PROCESS_SWITCH(Xi1820Analysis, processDataWithMicroTracks, "Process Event with ResoMicroTracks", false); + + void processMixedEventWithTracks(const aod::ResoCollisions& collisions, + aod::ResoV0s const& resov0s, + aod::ResoTracks const& resotracks) + { + + auto v0sTracksTuple = std::make_tuple(resov0s, resotracks); + Pair pairs{colBinning, nEvtMixing, -1, collisions, v0sTracksTuple, &cache}; + + for (auto& [collision1, v0s1, collision2, tracks2] : pairs) { // o2-linter: disable=const-ref-in-for-loop (structured bindings from Pair iterator cannot be const) + auto cent = collision1.cent(); + + for (const auto& kaon : tracks2) { + if (!kaonCut(kaon)) + continue; + int kaonCharge = kaon.sign(); + + for (const auto& v0 : v0s1) { + bool isLambda = v0Cut(collision1, v0, true); + bool isAntiLambda = v0Cut(collision1, v0, false); + + if (!isLambda && !isAntiLambda) + continue; + + ROOT::Math::PxPyPzEVector pKaon, pLambda, pRes; + pKaon = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(kaon.pt(), kaon.eta(), kaon.phi(), MassKaonCharged)); + + // K+ Lambda + if (kaonCharge > 0 && isLambda) { + pLambda = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(v0.pt(), v0.eta(), v0.phi(), v0.mLambda())); + pRes = pKaon + pLambda; + histos.fill(HIST("xi1820/kplus_lambda/hInvMassKplusLambda_Mix"), pRes.M()); + histos.fill(HIST("xi1820/kplus_lambda/hMassPtCentKplusLambda_Mix"), pRes.M(), pRes.Pt(), cent); + } + + // K+ Anti-Lambda + if (kaonCharge > 0 && isAntiLambda) { + pLambda = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(v0.pt(), v0.eta(), v0.phi(), v0.mAntiLambda())); + pRes = pKaon + pLambda; + histos.fill(HIST("xi1820/kplus_antilambda/hInvMassKplusAntiLambda_Mix"), pRes.M()); + histos.fill(HIST("xi1820/kplus_antilambda/hMassPtCentKplusAntiLambda_Mix"), pRes.M(), pRes.Pt(), cent); + } + + // K- Lambda + if (kaonCharge < 0 && isLambda) { + pLambda = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(v0.pt(), v0.eta(), v0.phi(), v0.mLambda())); + pRes = pKaon + pLambda; + histos.fill(HIST("xi1820/kminus_lambda/hInvMassKminusLambda_Mix"), pRes.M()); + histos.fill(HIST("xi1820/kminus_lambda/hMassPtCentKminusLambda_Mix"), pRes.M(), pRes.Pt(), cent); + } + + // K- Anti-Lambda + if (kaonCharge < 0 && isAntiLambda) { + pLambda = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(v0.pt(), v0.eta(), v0.phi(), v0.mAntiLambda())); + pRes = pKaon + pLambda; + histos.fill(HIST("xi1820/kminus_antilambda/hInvMassKminusAntiLambda_Mix"), pRes.M()); + histos.fill(HIST("xi1820/kminus_antilambda/hMassPtCentKminusAntiLambda_Mix"), pRes.M(), pRes.Pt(), cent); + } + } + } + } + } + PROCESS_SWITCH(Xi1820Analysis, processMixedEventWithTracks, "Process Mixed Event with ResoTracks", false); + + void processMixedEventWithMicroTracks(const aod::ResoCollisions& collisions, + aod::ResoV0s const& resov0s, + aod::ResoMicroTracks const& resomicrotracks) + { + + auto v0sTracksTuple = std::make_tuple(resov0s, resomicrotracks); + Pair pairs{colBinning, nEvtMixing, -1, collisions, v0sTracksTuple, &cache}; + + for (auto& [collision1, v0s1, collision2, tracks2] : pairs) { // o2-linter: disable=const-ref-in-for-loop (structured bindings from Pair iterator cannot be const) + auto cent = collision1.cent(); + + for (const auto& kaon : tracks2) { + if (!kaonCut(kaon)) + continue; + int kaonCharge = kaon.sign(); + + for (const auto& v0 : v0s1) { + bool isLambda = v0Cut(collision1, v0, true); + bool isAntiLambda = v0Cut(collision1, v0, false); + + if (!isLambda && !isAntiLambda) + continue; + + ROOT::Math::PxPyPzEVector pKaon, pLambda, pRes; + pKaon = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(kaon.pt(), kaon.eta(), kaon.phi(), MassKaonCharged)); + + // K+ Lambda + if (kaonCharge > 0 && isLambda) { + pLambda = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(v0.pt(), v0.eta(), v0.phi(), v0.mLambda())); + pRes = pKaon + pLambda; + histos.fill(HIST("xi1820/kplus_lambda/hInvMassKplusLambda_Mix"), pRes.M()); + histos.fill(HIST("xi1820/kplus_lambda/hMassPtCentKplusLambda_Mix"), pRes.M(), pRes.Pt(), cent); + } + + // K+ Anti-Lambda + if (kaonCharge > 0 && isAntiLambda) { + pLambda = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(v0.pt(), v0.eta(), v0.phi(), v0.mAntiLambda())); + pRes = pKaon + pLambda; + histos.fill(HIST("xi1820/kplus_antilambda/hInvMassKplusAntiLambda_Mix"), pRes.M()); + histos.fill(HIST("xi1820/kplus_antilambda/hMassPtCentKplusAntiLambda_Mix"), pRes.M(), pRes.Pt(), cent); + } + + // K- Lambda + if (kaonCharge < 0 && isLambda) { + pLambda = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(v0.pt(), v0.eta(), v0.phi(), v0.mLambda())); + pRes = pKaon + pLambda; + histos.fill(HIST("xi1820/kminus_lambda/hInvMassKminusLambda_Mix"), pRes.M()); + histos.fill(HIST("xi1820/kminus_lambda/hMassPtCentKminusLambda_Mix"), pRes.M(), pRes.Pt(), cent); + } + + // K- Anti-Lambda + if (kaonCharge < 0 && isAntiLambda) { + pLambda = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(v0.pt(), v0.eta(), v0.phi(), v0.mAntiLambda())); + pRes = pKaon + pLambda; + histos.fill(HIST("xi1820/kminus_antilambda/hInvMassKminusAntiLambda_Mix"), pRes.M()); + histos.fill(HIST("xi1820/kminus_antilambda/hMassPtCentKminusAntiLambda_Mix"), pRes.M(), pRes.Pt(), cent); + } + } + } + } + } + PROCESS_SWITCH(Xi1820Analysis, processMixedEventWithMicroTracks, "Process Mixed Event with ResoMicroTracks", false); + + // K0s + Lambda analysis + void processK0sLambda(const aod::ResoCollision& collision, + aod::ResoV0s const& resov0s) + { + auto cent = collision.cent(); + + // Fill event QA histograms + histos.fill(HIST("Event/posZ"), collision.posZ()); + histos.fill(HIST("Event/centrality"), cent); + histos.fill(HIST("Event/posZvsCent"), collision.posZ(), cent); + histos.fill(HIST("Event/nV0s"), resov0s.size()); + + // Loop over V0s for K0s + for (const auto& k0s : resov0s) { + // K0s QA before cuts + histos.fill(HIST("QAbefore/k0sMass"), k0s.mK0Short()); + histos.fill(HIST("QAbefore/k0sPt"), k0s.pt()); + histos.fill(HIST("QAbefore/k0sEta"), k0s.eta()); + histos.fill(HIST("QAbefore/k0sCosPA"), k0s.pt(), k0s.v0CosPA()); + histos.fill(HIST("QAbefore/k0sRadius"), k0s.pt(), k0s.transRadius()); + histos.fill(HIST("QAbefore/k0sDauDCA"), k0s.pt(), k0s.daughDCA()); + + float dx = k0s.decayVtxX() - collision.posX(); + float dy = k0s.decayVtxY() - collision.posY(); + float dz = k0s.decayVtxZ() - collision.posZ(); + float l = std::sqrt(dx * dx + dy * dy + dz * dz); + float p = std::sqrt(k0s.px() * k0s.px() + k0s.py() * k0s.py() + k0s.pz() * k0s.pz()); + auto k0sProperLifetime = (l / (p + 1e-10)) * MassK0Short; + histos.fill(HIST("QAbefore/k0sProperLifetime"), k0s.pt(), k0sProperLifetime); + + if (!k0sCut(collision, k0s)) + continue; + + // K0s QA after cuts + histos.fill(HIST("QAafter/k0sMass"), k0s.mK0Short()); + histos.fill(HIST("QAafter/k0sPt"), k0s.pt()); + histos.fill(HIST("QAafter/k0sEta"), k0s.eta()); + histos.fill(HIST("QAafter/k0sCosPA"), k0s.pt(), k0s.v0CosPA()); + histos.fill(HIST("QAafter/k0sRadius"), k0s.pt(), k0s.transRadius()); + histos.fill(HIST("QAafter/k0sDauDCA"), k0s.pt(), k0s.daughDCA()); + histos.fill(HIST("QAafter/k0sProperLifetime"), k0s.pt(), k0sProperLifetime); + + // Loop over V0s for Lambda + for (const auto& lambda : resov0s) { + // Try Lambda + bool isLambda = v0Cut(collision, lambda, true); + // Try Anti-Lambda + bool isAntiLambda = v0Cut(collision, lambda, false); + + if (!isLambda && !isAntiLambda) + continue; + + // 4-vectors + ROOT::Math::PxPyPzEVector pK0s, pLambda, pRes; + pK0s = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(k0s.pt(), k0s.eta(), k0s.phi(), MassK0Short)); + + // K0s + Lambda + if (isLambda) { + pLambda = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(lambda.pt(), lambda.eta(), lambda.phi(), lambda.mLambda())); + pRes = pK0s + pLambda; + histos.fill(HIST("xi1820/k0s_lambda/hInvMassK0sLambda"), pRes.M()); + histos.fill(HIST("xi1820/k0s_lambda/hMassPtCentK0sLambda"), pRes.M(), pRes.Pt(), cent); + } + + // K0s + Anti-Lambda + if (isAntiLambda) { + pLambda = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(lambda.pt(), lambda.eta(), lambda.phi(), lambda.mAntiLambda())); + pRes = pK0s + pLambda; + histos.fill(HIST("xi1820/k0s_antilambda/hInvMassK0sAntiLambda"), pRes.M()); + histos.fill(HIST("xi1820/k0s_antilambda/hMassPtCentK0sAntiLambda"), pRes.M(), pRes.Pt(), cent); + } + } + } + } + PROCESS_SWITCH(Xi1820Analysis, processK0sLambda, "Process K0s + Lambda", false); + + // K0s + Lambda mixed event analysis + void processK0sLambdaMixedEvent(const aod::ResoCollisions& collisions, + aod::ResoV0s const& resov0s) + { + + auto v0sV0sTuple = std::make_tuple(resov0s, resov0s); + Pair pairs{colBinning, nEvtMixing, -1, collisions, v0sV0sTuple, &cache}; + + for (auto& [collision1, k0s1, collision2, lambda2] : pairs) { // o2-linter: disable=const-ref-in-for-loop (structured bindings from Pair iterator cannot be const) + auto cent = collision1.cent(); + + for (const auto& k0s : k0s1) { + if (!k0sCut(collision1, k0s)) + continue; + + for (const auto& lambda : lambda2) { + bool isLambda = v0Cut(collision2, lambda, true); + bool isAntiLambda = v0Cut(collision2, lambda, false); + + if (!isLambda && !isAntiLambda) + continue; + + ROOT::Math::PxPyPzEVector pK0s, pLambda, pRes; + pK0s = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(k0s.pt(), k0s.eta(), k0s.phi(), MassK0Short)); + + // K0s + Lambda + if (isLambda) { + pLambda = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(lambda.pt(), lambda.eta(), lambda.phi(), lambda.mLambda())); + pRes = pK0s + pLambda; + histos.fill(HIST("xi1820/k0s_lambda/hInvMassK0sLambda_Mix"), pRes.M()); + histos.fill(HIST("xi1820/k0s_lambda/hMassPtCentK0sLambda_Mix"), pRes.M(), pRes.Pt(), cent); + } + + // K0s + Anti-Lambda + if (isAntiLambda) { + pLambda = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(lambda.pt(), lambda.eta(), lambda.phi(), lambda.mAntiLambda())); + pRes = pK0s + pLambda; + histos.fill(HIST("xi1820/k0s_antilambda/hInvMassK0sAntiLambda_Mix"), pRes.M()); + histos.fill(HIST("xi1820/k0s_antilambda/hMassPtCentK0sAntiLambda_Mix"), pRes.M(), pRes.Pt(), cent); + } + } + } + } + } + PROCESS_SWITCH(Xi1820Analysis, processK0sLambdaMixedEvent, "Process K0s + Lambda Mixed Event", false); + + // MC processes - placeholder for future implementation + void processMCWithTracks(const aod::ResoCollision& /*collision*/, + aod::ResoV0s const& /*resov0s*/, + aod::ResoTracks const& /*resotracks*/, + aod::McParticles const& /*mcParticles*/) + { + // TODO: Implement MC truth matching for K± + Lambda + // - Match reconstructed kaons to MC kaons + // - Match reconstructed Lambdas to MC Lambdas + // - Fill MC truth histograms + // - Fill reconstruction efficiency histograms + } + PROCESS_SWITCH(Xi1820Analysis, processMCWithTracks, "Process MC with ResoTracks (placeholder)", false); + + void processMCWithMicroTracks(const aod::ResoCollision& /*collision*/, + aod::ResoV0s const& /*resov0s*/, + aod::ResoMicroTracks const& /*resomicrotracks*/, + aod::McParticles const& /*mcParticles*/) + { + // TODO: Implement MC truth matching for K± + Lambda with MicroTracks + } + PROCESS_SWITCH(Xi1820Analysis, processMCWithMicroTracks, "Process MC with ResoMicroTracks (placeholder)", false); + + void processMCK0sLambda(const aod::ResoCollision& /*collision*/, + aod::ResoV0s const& /*resov0s*/, + aod::McParticles const& /*mcParticles*/) + { + // TODO: Implement MC truth matching for K0s + Lambda + // - Match reconstructed K0s to MC K0s + // - Match reconstructed Lambdas to MC Lambdas + // - Fill MC truth histograms + // - Fill reconstruction efficiency histograms + } + PROCESS_SWITCH(Xi1820Analysis, processMCK0sLambda, "Process MC K0s + Lambda (placeholder)", false); + + void processMCGenerated(aod::McParticles const& mcParticles) + { + // Process MC generated particles (no reconstruction requirement) + // Xi(1820)0 PDG code: 123314 (neutral, decays to K+ Lambda or K0s Lambda) + // Note: PDG doesn't have separate codes for charge states in this case + + for (const auto& mcParticle : mcParticles) { + // Look for Xi(1820) - PDG code can vary, check for resonance mass ~1820 MeV + int pdg = mcParticle.pdgCode(); + + // Xi(1820)0: PDG 123314 + // Check if it's Xi(1820) or similar resonance + if (std::abs(pdg) != kPdgXi1820) + continue; + + // Fill generated level histograms + auto pt = mcParticle.pt(); + auto eta = mcParticle.eta(); + auto y = mcParticle.y(); + + histos.fill(HIST("MC/hMCGenXi1820Pt"), pt); + histos.fill(HIST("MC/hMCGenXi1820PtEta"), pt, eta); + histos.fill(HIST("MC/hMCGenXi1820Y"), y); + + // Get daughters + auto daughters = mcParticle.daughters_as(); + if (daughters.size() != kExpectedDaughters) + continue; + + int daughter1PDG = 0, daughter2PDG = 0; + ROOT::Math::PxPyPzEVector p1, p2, pMother; + + int iDaughter = 0; + for (const auto& daughter : daughters) { + if (iDaughter == 0) { + daughter1PDG = daughter.pdgCode(); + p1.SetPxPyPzE(daughter.px(), daughter.py(), daughter.pz(), daughter.e()); + } else { + daughter2PDG = daughter.pdgCode(); + p2.SetPxPyPzE(daughter.px(), daughter.py(), daughter.pz(), daughter.e()); + } + iDaughter++; + } + + pMother = p1 + p2; + + // Check decay channels + auto motherPt = pMother.Pt(); + auto motherM = pMother.M(); + + // K+ + Lambda + if ((daughter1PDG == PDG_t::kKPlus && daughter2PDG == PDG_t::kLambda0) || + (daughter1PDG == PDG_t::kLambda0 && daughter2PDG == PDG_t::kKPlus)) { + histos.fill(HIST("MC/hMCTruthInvMassKplusLambda"), motherM); + histos.fill(HIST("MC/hMCTruthMassPtKplusLambda"), motherM, motherPt); + } + + // K- + Anti-Lambda + if ((daughter1PDG == PDG_t::kKMinus && daughter2PDG == PDG_t::kLambda0Bar) || + (daughter1PDG == PDG_t::kLambda0Bar && daughter2PDG == PDG_t::kKMinus)) { + histos.fill(HIST("MC/hMCTruthInvMassKminusAntiLambda"), motherM); + histos.fill(HIST("MC/hMCTruthMassPtKminusAntiLambda"), motherM, motherPt); + } + + // K0s + Lambda + if ((daughter1PDG == PDG_t::kK0Short && daughter2PDG == PDG_t::kLambda0) || + (daughter1PDG == PDG_t::kLambda0 && daughter2PDG == PDG_t::kK0Short)) { + histos.fill(HIST("MC/hMCTruthInvMassK0sLambda"), motherM); + histos.fill(HIST("MC/hMCTruthMassPtK0sLambda"), motherM, motherPt); + } + + // K0s + Anti-Lambda + if ((daughter1PDG == PDG_t::kK0Short && daughter2PDG == PDG_t::kLambda0Bar) || + (daughter1PDG == PDG_t::kLambda0Bar && daughter2PDG == PDG_t::kK0Short)) { + histos.fill(HIST("MC/hMCTruthInvMassK0sAntiLambda"), motherM); + histos.fill(HIST("MC/hMCTruthMassPtK0sAntiLambda"), motherM, motherPt); + } + } + } + PROCESS_SWITCH(Xi1820Analysis, processMCGenerated, "Process MC generated particles", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From fb2d3c9499b6072289006265d48d81ae10eaf8d5 Mon Sep 17 00:00:00 2001 From: Marta Urioni <78807256+murioni@users.noreply.github.com> Date: Mon, 6 Oct 2025 09:28:45 +0200 Subject: [PATCH 635/986] [PWGLF] k892analysispbpb.cxx - bug fix (#13222) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Resonances/k892analysispbpb.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/PWGLF/Tasks/Resonances/k892analysispbpb.cxx b/PWGLF/Tasks/Resonances/k892analysispbpb.cxx index 303a6cd6fc9..5e58f1e108a 100644 --- a/PWGLF/Tasks/Resonances/k892analysispbpb.cxx +++ b/PWGLF/Tasks/Resonances/k892analysispbpb.cxx @@ -834,6 +834,8 @@ struct K892analysispbpb { Partition posPitof = (aod::track::signed1Pt > static_cast(0)) && (nabs(aod::pidtof::tofNSigmaPi) <= cMaxTOFnSigmaPion) && (nabs(aod::track::pt) > cMinPtTOF); Partition negKatof = (aod::track::signed1Pt < static_cast(0)) && (nabs(aod::pidtof::tofNSigmaKa) <= cMaxTOFnSigmaKaon) && (nabs(aod::track::pt) > cMinPtTOF); + Preslice trackPerCollision = aod::track::collisionId; + template void callFillHistoswithPartitions(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&) { @@ -1095,9 +1097,8 @@ struct K892analysispbpb { } PROCESS_SWITCH(K892analysispbpb, processEvtLossSigLossMC, "Process Signal Loss, Event Loss", false); - void processMC(aod::McCollisions::iterator const& /*mcCollision*/, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions, TrackCandidatesMCrec const& RecTracks) + void processMC(aod::McCollisions::iterator const&, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions, TrackCandidatesMCrec const& RecTracks) { - histos.fill(HIST("QAevent/hMCrecCollSels"), 0); if (recCollisions.size() == 0) { histos.fill(HIST("QAevent/hMCrecCollSels"), 1); @@ -1117,7 +1118,7 @@ struct K892analysispbpb { auto centrality = RecCollision.centFT0C(); histos.fill(HIST("QAevent/hMultiplicityPercentMC"), centrality); - auto tracks = RecTracks.sliceByCached(aod::track::collisionId, RecCollision.globalIndex(), cache); + auto tracks = RecTracks.sliceBy(trackPerCollision, RecCollision.globalIndex()); // fillHistograms(RecCollision, tracks, tracks); @@ -1192,7 +1193,7 @@ struct K892analysispbpb { auto centrality = RecCollision.centRun2V0M(); histos.fill(HIST("QAevent/hMultiplicityPercentMC"), centrality); - auto tracks = RecTracks.sliceByCached(aod::track::collisionId, RecCollision.globalIndex(), cache); + auto tracks = RecTracks.sliceBy(trackPerCollision, RecCollision.globalIndex()); // fillHistograms(RecCollision, tracks, tracks); From 7500c53802f89f3c4ccb32fd1ad4c284b33a8889 Mon Sep 17 00:00:00 2001 From: FabiolaLP <150402425+FabiolaLP@users.noreply.github.com> Date: Mon, 6 Oct 2025 05:11:29 -0600 Subject: [PATCH 636/986] [PWGLF] Nuspex: antineutron CEX table producer (clean PR) (#13150) --- PWGLF/DataModel/LFAntinCexTables.h | 130 +++ PWGLF/TableProducer/Nuspex/CMakeLists.txt | 5 + .../Nuspex/nucleiAntineutronCex.cxx | 798 ++++++++++++++++++ 3 files changed, 933 insertions(+) create mode 100644 PWGLF/DataModel/LFAntinCexTables.h create mode 100644 PWGLF/TableProducer/Nuspex/nucleiAntineutronCex.cxx diff --git a/PWGLF/DataModel/LFAntinCexTables.h b/PWGLF/DataModel/LFAntinCexTables.h new file mode 100644 index 00000000000..f49eab6ad80 --- /dev/null +++ b/PWGLF/DataModel/LFAntinCexTables.h @@ -0,0 +1,130 @@ +// 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 LFAntinCexTables.h +/// \brief Slim tables for nucleiAntineutronCex +/// \author Fabiola Lugo +/// + +#ifndef PWGLF_DATAMODEL_LFANTINCEXTABLES_H_ +#define PWGLF_DATAMODEL_LFANTINCEXTABLES_H_ + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" + +namespace o2::aod +{ +namespace antin_cex +{ +// Metadata +DECLARE_SOA_COLUMN(IsCex, isCex, bool); // 1=CEX (from antin), 0=BG +DECLARE_SOA_COLUMN(MotherPdg, motherPdg, int32_t); // mother PDG +DECLARE_SOA_COLUMN(ColId, colId, int32_t); // mcCollisionId +DECLARE_SOA_COLUMN(PId, pId, int32_t); // proton MC id +DECLARE_SOA_COLUMN(AntipId, antipId, int32_t); // antiproton MC id + +// MC (pair) +DECLARE_SOA_COLUMN(McPairP, mcPairP, float); +DECLARE_SOA_COLUMN(McPairPt, mcPairPt, float); +DECLARE_SOA_COLUMN(McPairPz, mcPairPz, float); +DECLARE_SOA_COLUMN(McDplane, mcDplane, float); +DECLARE_SOA_COLUMN(McAngleDeg, mcAngleDeg, float); +DECLARE_SOA_COLUMN(McVtxX, mcVtxX, float); +DECLARE_SOA_COLUMN(McVtxY, mcVtxY, float); +DECLARE_SOA_COLUMN(McVtxZ, mcVtxZ, float); + +// Tracks (pair, fitter) +DECLARE_SOA_COLUMN(TrkPairP, trkPairP, float); +DECLARE_SOA_COLUMN(TrkPairPt, trkPairPt, float); +DECLARE_SOA_COLUMN(TrkPairPz, trkPairPz, float); +DECLARE_SOA_COLUMN(TrkAngleDeg, trkAngleDeg, float); +DECLARE_SOA_COLUMN(TrkVtxfitDcaPair, trkVtxfitDcaPair, float); +DECLARE_SOA_COLUMN(TrkVtxfitR, trkVtxfitR, float); +DECLARE_SOA_COLUMN(TrkVtxfitDistToPv, trkVtxfitDistToPv, float); +DECLARE_SOA_COLUMN(TrkVtxfitSecVtxX, trkVtxfitSecVtxX, float); +DECLARE_SOA_COLUMN(TrkVtxfitSecVtxY, trkVtxfitSecVtxY, float); +DECLARE_SOA_COLUMN(TrkVtxfitSecVtxZ, trkVtxfitSecVtxZ, float); + +// Fit quality (fit − MC) +DECLARE_SOA_COLUMN(VtxfitChi2, vtxfitChi2, float); +DECLARE_SOA_COLUMN(VtxfitStatus, vtxfitStatus, int32_t); +DECLARE_SOA_COLUMN(NCand, nCand, int32_t); +DECLARE_SOA_COLUMN(VtxfitDX, vtxfitDX, float); +DECLARE_SOA_COLUMN(VtxfitDY, vtxfitDY, float); +DECLARE_SOA_COLUMN(VtxfitDZ, vtxfitDZ, float); +DECLARE_SOA_COLUMN(VtxfitD3D, vtxfitD3D, float); + +// Proton track +DECLARE_SOA_COLUMN(PTrkP, pTrkP, float); +DECLARE_SOA_COLUMN(PTrkPx, pTrkPx, float); +DECLARE_SOA_COLUMN(PTrkPy, pTrkPy, float); +DECLARE_SOA_COLUMN(PTrkPz, pTrkPz, float); +DECLARE_SOA_COLUMN(PTrkEta, pTrkEta, float); +DECLARE_SOA_COLUMN(PTrkTpcSignal, pTrkTpcSignal, float); +DECLARE_SOA_COLUMN(PTrkNClsIts, pTrkNClsIts, int16_t); + +// Antiproton track +DECLARE_SOA_COLUMN(AntipTrkP, antipTrkP, float); +DECLARE_SOA_COLUMN(AntipTrkPx, antipTrkPx, float); +DECLARE_SOA_COLUMN(AntipTrkPy, antipTrkPy, float); +DECLARE_SOA_COLUMN(AntipTrkPz, antipTrkPz, float); +DECLARE_SOA_COLUMN(AntipTrkEta, antipTrkEta, float); +DECLARE_SOA_COLUMN(AntipTrkTpcSignal, antipTrkTpcSignal, float); +DECLARE_SOA_COLUMN(AntipTrkNClsIts, antipTrkNClsIts, int16_t); + +// Cuts Mask +DECLARE_SOA_COLUMN(SelMask, selMask, uint32_t); + +DECLARE_SOA_COLUMN(PairPointingAngleDeg, pairPointingAngleDeg, float); +DECLARE_SOA_COLUMN(PairPBalance, pairPBalance, float); +DECLARE_SOA_COLUMN(PairPtBalance, pairPtBalance, float); +DECLARE_SOA_COLUMN(PairQ, pairQ, float); + +DECLARE_SOA_COLUMN(DPairP, dPairP, float); +DECLARE_SOA_COLUMN(DPairPt, dPairPt, float); +DECLARE_SOA_COLUMN(DPairPz, dPairPz, float); +DECLARE_SOA_COLUMN(DOpenAngle, dOpenAngle, float); + +DECLARE_SOA_COLUMN(SVNearestLayerId, svNearestLayerId, int16_t); +DECLARE_SOA_COLUMN(SVDeltaRToLayer, svDeltaRToLayer, float); + +DECLARE_SOA_COLUMN(PTrkItsHitMap, pTrkItsHitMap, uint16_t); +DECLARE_SOA_COLUMN(APTrkItsHitMap, apTrkItsHitMap, uint16_t); +DECLARE_SOA_COLUMN(PLayersOk, pLayersOk, int8_t); +DECLARE_SOA_COLUMN(APLayersOk, apLayersOk, int8_t); + +DECLARE_SOA_COLUMN(PVtxZ, pVtxZ, float); +} // namespace antin_cex + +// Table +DECLARE_SOA_TABLE(AntinCexPairs, "AOD", "ANTINCEX", + antin_cex::IsCex, + antin_cex::MotherPdg, antin_cex::ColId, antin_cex::PId, antin_cex::AntipId, + antin_cex::McPairP, antin_cex::McPairPt, antin_cex::McPairPz, + antin_cex::McDplane, antin_cex::McAngleDeg, antin_cex::McVtxX, antin_cex::McVtxY, antin_cex::McVtxZ, + antin_cex::TrkPairP, antin_cex::TrkPairPt, antin_cex::TrkPairPz, antin_cex::TrkAngleDeg, + antin_cex::TrkVtxfitDcaPair, antin_cex::TrkVtxfitR, antin_cex::TrkVtxfitDistToPv, + antin_cex::TrkVtxfitSecVtxX, antin_cex::TrkVtxfitSecVtxY, antin_cex::TrkVtxfitSecVtxZ, + antin_cex::VtxfitChi2, antin_cex::VtxfitStatus, antin_cex::NCand, + antin_cex::VtxfitDX, antin_cex::VtxfitDY, antin_cex::VtxfitDZ, antin_cex::VtxfitD3D, + antin_cex::PTrkP, antin_cex::PTrkPx, antin_cex::PTrkPy, antin_cex::PTrkPz, antin_cex::PTrkEta, antin_cex::PTrkTpcSignal, antin_cex::PTrkNClsIts, + antin_cex::AntipTrkP, antin_cex::AntipTrkPx, antin_cex::AntipTrkPy, antin_cex::AntipTrkPz, antin_cex::AntipTrkEta, antin_cex::AntipTrkTpcSignal, antin_cex::AntipTrkNClsIts, + antin_cex::SelMask, + antin_cex::PairPointingAngleDeg, antin_cex::PairPBalance, antin_cex::PairPtBalance, antin_cex::PairQ, + antin_cex::DPairP, antin_cex::DPairPt, antin_cex::DPairPz, antin_cex::DOpenAngle, + antin_cex::SVNearestLayerId, antin_cex::SVDeltaRToLayer, + antin_cex::PTrkItsHitMap, antin_cex::APTrkItsHitMap, antin_cex::PLayersOk, antin_cex::APLayersOk, + antin_cex::PVtxZ); + +} // namespace o2::aod + +#endif // PWGLF_DATAMODEL_LFANTINCEXTABLES_H_ diff --git a/PWGLF/TableProducer/Nuspex/CMakeLists.txt b/PWGLF/TableProducer/Nuspex/CMakeLists.txt index 98dac784da5..127b4d465de 100644 --- a/PWGLF/TableProducer/Nuspex/CMakeLists.txt +++ b/PWGLF/TableProducer/Nuspex/CMakeLists.txt @@ -103,3 +103,8 @@ o2physics_add_dpl_workflow(he3-lambda-analysis SOURCES he3LambdaAnalysis.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(nuclei-antineutron-cex + SOURCES nucleiAntineutronCex.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGLF/TableProducer/Nuspex/nucleiAntineutronCex.cxx b/PWGLF/TableProducer/Nuspex/nucleiAntineutronCex.cxx new file mode 100644 index 00000000000..9fea0a7e487 --- /dev/null +++ b/PWGLF/TableProducer/Nuspex/nucleiAntineutronCex.cxx @@ -0,0 +1,798 @@ +// 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 nucleiAntineutronCex.cxx +/// \brief Analysis task for antineutron detection through cex interactions +/// \author Fabiola Lugo +/// + +#include "PWGLF/DataModel/LFAntinCexTables.h" + +#include "CommonConstants/MathConstants.h" +#include "DCAFitter/DCAFitterN.h" +#include "DetectorsBase/Propagator.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/Logger.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/TrackParametrization.h" + +#include "TMCProcess.h" +#include "TMath.h" +#include "TPDGCode.h" +#include "TVector3.h" + +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using o2::constants::math::Rad2Deg; + +struct NucleiAntineutronCex { + // Slicing per colision + Preslice perMcByColl = aod::mcparticle::mcCollisionId; + // Check available tables in the AOD, specifically TracksIU, TracksCovIU + using TracksWCovMc = soa::Join; + + // === Cut values === + static constexpr double kIts2MinR = 2.2; // ITS2 min radius [cm] + static constexpr double kIts2MaxR = 39.0; // ITS2 max radius [cm] + static constexpr double kIts2MaxVz = 39.0; // ITS2 max |vz| [cm] + static constexpr double kAccMaxEta = 1.2; // acceptance |eta| + static constexpr double kAccMaxVz = 5.3; // acceptance |vz| [cm] + static constexpr double kStrictEta = 0.9; // tighter eta cut + static constexpr double kInitDplane = 10.0; // init dplane + static constexpr double kHuge = 1e9; // fallback for bad denom + static constexpr int kMinItsHits = 2; + static constexpr double kVtxTol = 1e-4; + + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + Produces outPairs; + + void init(InitContext const&) + { + // Primary vertex + histos.add("hVx", "Primary vertex X;X (cm);Entries", kTH1F, {{100, -5., 5.}}); + histos.add("hVy", "Primary vertex Y;Y (cm);Entries", kTH1F, {{100, -5., 5.}}); + histos.add("hVz", "Primary vertex Z;Z (cm);Entries", kTH1F, {{200, -20., 20.}}); + + // Primary antineutrons + histos.add("antin_p", "Total momentum;|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); + histos.add("antin_px", "p_{x};p_{x} (GeV/c);Entries", kTH1F, {{100, -10., 10.}}); + histos.add("antin_py", "p_{y};p_{y} (GeV/c);Entries", kTH1F, {{100, -10., 10.}}); + histos.add("antin_pz", "p_{z};p_{z} (GeV/c);Entries", kTH1F, {{100, -10., 10.}}); + histos.add("antin_eta", "Pseudorapidity;#eta;Entries", kTH1F, {{100, -10., 10.}}); + histos.add("antin_p_ITScuts", "Momentum with ITS cuts;|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); + + // Primary neutrons + histos.add("n_p", "Total momentum;|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); + histos.add("n_px", "p_{x};p_{x} (GeV/c);Entries", kTH1F, {{100, -10., 10.}}); + histos.add("n_py", "p_{y};p_{y} (GeV/c);Entries", kTH1F, {{100, -10., 10.}}); + histos.add("n_pz", "p_{z};p_{z} (GeV/c);Entries", kTH1F, {{100, -10., 10.}}); + histos.add("n_eta", "Pseudorapidity;#eta;Entries", kTH1F, {{100, -10., 10.}}); + histos.add("n_p_ITScuts", "Momentum with ITS cuts;|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); + + // Primary antiprotons + histos.add("antipP", "Total momentum;|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); + histos.add("antipPx", "p_{x};p_{x} (GeV/c);Entries", kTH1F, {{100, -10., 10.}}); + histos.add("antipPy", "p_{y};p_{y} (GeV/c);Entries", kTH1F, {{100, -10., 10.}}); + histos.add("antipPz", "p_{z};p_{z} (GeV/c);Entries", kTH1F, {{100, -10., 10.}}); + histos.add("antipEta", "Pseudorapidity;#eta;Entries", kTH1F, {{100, -10., 10.}}); + histos.add("antipP_ITScuts", "Momentum with ITS cuts;|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); + + // Primary protons + histos.add("pP", "Total momentum;|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); + histos.add("pPx", "p_{x};p_{x} (GeV/c);Entries", kTH1F, {{100, -10., 10.}}); + histos.add("pPy", "p_{y};p_{y} (GeV/c);Entries", kTH1F, {{100, -10., 10.}}); + histos.add("pPz", "p_{z};p_{z} (GeV/c);Entries", kTH1F, {{100, -10., 10.}}); + histos.add("pEta", "Pseudorapidity;#eta;Entries", kTH1F, {{100, -10., 10.}}); + histos.add("pP_ITScuts", "Momentum with ITS cuts;|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); + + // test (MC) + histos.add("antip_test", "Secondary antiprotons;|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); + + // CEX pair from antineutron (MC) + histos.add("cexPairMcP", "CEX pair total momentum;|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); + histos.add("cexPairMcPt", "CEX pair p_{T};p_{T} (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); + histos.add("cexPairMcPz", "CEX pair p_{z};p_{z} (GeV/c);Entries", kTH1F, {{100, -10., 10.}}); + histos.add("cex_pairmcDplane", "CEX pair d_{plane};d_{plane} (cm);Entries", kTH1F, {{100, 0., 10.}}); + histos.add("cex_pairmc_angle", "Pair opening angle;Angle (°);Entries", kTH1F, {{180, 0., 180.}}); + histos.add("cex_pairmc_vtx", "MC CEX pair vertex;X (cm);Y (cm)", kTH2F, {{100, -50., 50.}, {100, -50., 50.}}); + histos.add("cex_pairmc_vtxz", "MC secondary vertex Z;Z (cm);Entries", kTH1F, {{200, -60., 60.}}); + histos.add("cexPairMcPITScuts", "CEX pair momentum (ITS cuts);|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); + + // CEX pair normalized to antineutron (MC) + histos.add("cexn_pairmc_p", "Pair p / antineutron p;p/p_{#bar{n}};Entries", kTH1F, {{100, 0., 2.}}); + histos.add("cexn_pairmc_pt", "Pair p_{T} / antineutron p_{T};p_{T}/p_{T,#bar{n}};Entries", kTH1F, {{100, 0., 2.}}); + histos.add("cexn_pairmc_pz", "Pair p_{z} / antineutron p_{z};p_{z}/p_{z,#bar{n}};Entries", kTH1F, {{100, -2., 2.}}); + + // BG pair (not from antineutron) (MC) + histos.add("cexbg_pairmc_p", "Background pair momentum;|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); + histos.add("cexbg_pairmc_pt", "Background pair p_{T};p_{T} (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); + histos.add("cexbg_pairmc_pz", "Background pair p_{z};p_{z} (GeV/c);Entries", kTH1F, {{100, -10., 10.}}); + histos.add("cexbg_pairmcDplane", "Background d_{plane};d_{plane} (cm);Entries", kTH1F, {{100, 0., 10.}}); + histos.add("cexbg_pairmc_angle", "Background opening angle;Angle (°);Entries", kTH1F, {{180, 0., 180.}}); + histos.add("cexbg_pairmc_vtx", "Background pair vertex;X (cm);Y (cm)", kTH2F, {{100, -50., 50.}, {100, -50., 50.}}); + histos.add("cexbg_pairmc_vtxz", "Background secondary vertex Z;Z (cm);Entries", kTH1F, {{200, -60., 60.}}); + histos.add("cexbg_pairmc_pITScuts", "Background momentum (ITS cuts);|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); + + // CEX pair from antineutron (TRK) + histos.add("cex_pairtrk_angle", "Pair opening angle (tracks);Angle (°);Entries", kTH1F, {{180, 0., 180.}}); + histos.add("cexPairTrkP", "Pair momentum (tracks);|p| (GeV/c);Entries", kTH1F, {{120, 0., 12.}}); + histos.add("cexPairTrkPt", "Pair p_{T} (tracks);p_{T} (GeV/c);Entries", kTH1F, {{120, 0., 12.}}); + histos.add("cexPairTrkPz", "Pair p_{z} (tracks);p_{z} (GeV/c);Entries", kTH1F, {{120, -12., 12.}}); + histos.add("cex_pairtrkVtxfitDcaPair", "DCA between tracks at PCA;DCA (cm);Entries", kTH1F, {{200, 0., 10.}}); + histos.add("cex_pairtrkVtxfitR", "Secondary-vertex radius (PCA);R (cm);Entries", kTH1F, {{200, 0., 60.}}); + histos.add("cex_pairtrkVtxfitDistToPv", "Distance from secondary vertex to PV;dist (cm);Entries", kTH1F, {{240, 0., 120.}}); + histos.add("cex_pairtrk_vtxfit_secVtxXY", "Secondary vertex (PCA);X (cm);Y (cm)", kTH2F, {{200, -60., 60.}, {200, -60., 60.}}); + histos.add("cex_pairtrk_vtxfit_secVtxZ", "Secondary vertex Z (PCA);Z (cm);Entries", kTH1F, {{240, -60., 60.}}); + + // BG pair (not from antineutron) (TRK) + histos.add("cexbg_pairtrk_angle", "Background opening angle (tracks);Angle (°);Entries", kTH1F, {{180, 0., 180.}}); + histos.add("cexbg_pairtrk_p", "Pair momentum (tracks);|p| (GeV/c);Entries", kTH1F, {{120, 0., 12.}}); + histos.add("cexbg_pairtrk_pt", "Pair p_{T} (tracks);p_{T} (GeV/c);Entries", kTH1F, {{120, 0., 12.}}); + histos.add("cexbg_pairtrk_pz", "Pair p_{z} (tracks);p_{z} (GeV/c);Entries", kTH1F, {{120, -12., 12.}}); + histos.add("cexbg_pairtrkVtxfitDcaPair", "DCA between tracks at PCA;DCA (cm);Entries", kTH1F, {{200, 0., 10.}}); + histos.add("cexbg_pairtrkVtxfitR", "Secondary-vertex radius (PCA);R (cm);Entries", kTH1F, {{200, 0., 60.}}); + histos.add("cexbg_pairtrkVtxfitDistToPv", "Distance from secondary vertex to PV;dist (cm);Entries", kTH1F, {{240, 0., 120.}}); + histos.add("cexbg_pairtrk_vtxfit_secVtxXY", "Secondary vertex (PCA);X (cm);Y (cm)", kTH2F, {{200, -60., 60.}, {200, -60., 60.}}); + histos.add("cexbg_pairtrk_vtxfit_secVtxZ", "Secondary vertex Z (PCA);Z (cm);Entries", kTH1F, {{240, -60., 60.}}); + + // Vertex fit (DCAFitter2 / PCA) + histos.add("vtxfitChi2", "DCAFitter2 #chi^{2};#chi^{2};Entries", kTH1F, {{200, 0., 100.}}); + histos.add("vtxfitStatus", "Fit status (0=OK);code;Entries", kTH1I, {{10, 0., 10.}}); + histos.add("vtxfit_mc_dX", "SV residual X (fit - MC);#Delta X (cm);Entries", kTH1F, {{400, -20., 20.}}); + histos.add("vtxfit_mc_dY", "SV residual Y (fit - MC);#Delta Y (cm);Entries", kTH1F, {{400, -20., 20.}}); + histos.add("vtxfit_mc_dZ", "SV residual Z (fit - MC);#Delta Z (cm);Entries", kTH1F, {{400, -20., 20.}}); + histos.add("vtxfit_mc_d3D", "SV distance |fit - MC|;#Delta r (cm);Entries", kTH1F, {{300, 0., 30.}}); + } + + static o2::track::TrackParCov makeTPCovFromAOD(const TracksWCovMc::iterator& tr) + { + using o2::track::TrackParCov; + TrackParCov tpcov; + // Local state: x, alpha, y, z, snp, tgl, q/pt + float par[5] = {tr.y(), tr.z(), tr.snp(), tr.tgl(), tr.signed1Pt()}; + tpcov.set(tr.x(), tr.alpha(), par); + + // Covariance matrix (15 terms) in O2 order + std::array cov = { + tr.cYY(), tr.cZY(), tr.cZZ(), + tr.cSnpY(), tr.cSnpZ(), tr.cSnpSnp(), + tr.cTglY(), tr.cTglZ(), tr.cTglSnp(), + tr.cTglTgl(), tr.c1PtY(), tr.c1PtZ(), + tr.c1PtSnp(), tr.c1PtTgl(), tr.c1Pt21Pt2()}; + tpcov.setCov(cov); + return tpcov; + } + + void process(aod::McCollisions const& cols, aod::McParticles const& particles, TracksWCovMc const& tracks) + { + double pvtxX = 0; + double pvtxY = 0; + double pvtxZ = 0; + for (auto const& col : cols) { + const auto colId = col.globalIndex(); + auto mcPartsThis = particles.sliceBy(perMcByColl, colId); + + if (std::isfinite(col.posX()) && std::isfinite(col.posY()) && std::isfinite(col.posZ())) { + pvtxX = col.posX(); + pvtxY = col.posY(); + pvtxZ = col.posZ(); + histos.fill(HIST("hVx"), pvtxX); + histos.fill(HIST("hVy"), pvtxY); + histos.fill(HIST("hVz"), pvtxZ); + } + + for (const auto& particle : mcPartsThis) { + + // Primary antineutrons + if (particle.pdgCode() == -kNeutron && particle.isPhysicalPrimary()) { + histos.fill(HIST("antin_p"), particle.p()); + histos.fill(HIST("antin_px"), particle.px()); + histos.fill(HIST("antin_py"), particle.py()); + histos.fill(HIST("antin_pz"), particle.pz()); + histos.fill(HIST("antin_eta"), particle.eta()); + if (std::abs(particle.eta()) < kAccMaxEta && std::abs(particle.vz()) < kAccMaxVz) + histos.fill(HIST("antin_p_ITScuts"), particle.p()); + } + // Primary neutrons + if (particle.pdgCode() == kNeutron && particle.isPhysicalPrimary()) { + histos.fill(HIST("n_p"), particle.p()); + histos.fill(HIST("n_px"), particle.px()); + histos.fill(HIST("n_py"), particle.py()); + histos.fill(HIST("n_pz"), particle.pz()); + histos.fill(HIST("n_eta"), particle.eta()); + if (std::abs(particle.eta()) < kAccMaxEta && std::abs(particle.vz()) < kAccMaxVz) + histos.fill(HIST("n_p_ITScuts"), particle.p()); + } + // Primary antiprotons + if (particle.pdgCode() == -kProton && particle.isPhysicalPrimary()) { + histos.fill(HIST("antipP"), particle.p()); + histos.fill(HIST("antipPx"), particle.px()); + histos.fill(HIST("antipPy"), particle.py()); + histos.fill(HIST("antipPz"), particle.pz()); + histos.fill(HIST("antipEta"), particle.eta()); + if (std::abs(particle.eta()) < kAccMaxEta && std::abs(particle.vz()) < kAccMaxVz) + histos.fill(HIST("antipP_ITScuts"), particle.p()); + } + // Primary protons + if (particle.pdgCode() == kProton && particle.isPhysicalPrimary()) { + histos.fill(HIST("pP"), particle.p()); + histos.fill(HIST("pPx"), particle.px()); + histos.fill(HIST("pPy"), particle.py()); + histos.fill(HIST("pPz"), particle.pz()); + histos.fill(HIST("pEta"), particle.eta()); + if (std::abs(particle.eta()) < kAccMaxEta && std::abs(particle.vz()) < kAccMaxVz) + histos.fill(HIST("pP_ITScuts"), particle.p()); + } + + // Seconday antiprotons from material + const auto procEnum = particle.getProcess(); + const bool isSecondaryFromMaterial = (!particle.producedByGenerator()) && (procEnum == kPHadronic || procEnum == kPHInhelastic); + if (particle.pdgCode() != -kProton || !isSecondaryFromMaterial || particle.mothersIds().empty()) + continue; + histos.fill(HIST("antip_test"), particle.p()); + + // Primary mother + bool hasPrimaryMotherAntip = false; + double motherPt = 0.0; + double motherPz = 0.0; + double motherVz = 0.0; + double motherP = 0.0; + double motherEta = 0.0; + int motherPdg = 0; + + for (const auto& mother : particle.mothers_as()) { + if (mother.isPhysicalPrimary()) { + hasPrimaryMotherAntip = true; + motherPt = mother.pt(); + motherPz = mother.pz(); + motherVz = mother.vz(); + motherP = mother.p(); + motherEta = mother.eta(); + motherPdg = mother.pdgCode(); + break; + } + } + if (!hasPrimaryMotherAntip) + continue; + + double antipVx = particle.vx(); + double antipVy = particle.vy(); + double antipVz = particle.vz(); + double antipPx = particle.px(); + double antipPy = particle.py(); + double antipPz = particle.pz(); + double antipE = particle.e(); + int antipId = particle.globalIndex(); + + // Selection conditions: Produced in the ITS + const double r = std::sqrt(antipVx * antipVx + antipVy * antipVy); + // Config for ITS + // if(3.9<=r && r<=43.0 && std::abs(antipVz)<=48.9){ + // Config for ITS2 + if (r < kIts2MinR || r > kIts2MaxR || std::abs(antipVz) > kIts2MaxVz) + continue; + if (std::abs(motherEta) >= kAccMaxEta || std::abs(motherVz) >= kAccMaxVz) + continue; + + // Pion minus veto + bool pionMinus = false; + for (const auto& particle1 : mcPartsThis) { + const auto proc1Enum = particle1.getProcess(); + const bool isSecondaryFromMaterial1 = (!particle1.producedByGenerator()) && (proc1Enum == kPHadronic || proc1Enum == kPHInhelastic); + if (particle1.mcCollisionId() != colId) + continue; + if (particle1.pdgCode() != kPiMinus || !isSecondaryFromMaterial1 || particle1.mothersIds().empty()) + continue; + bool hasPrimaryMotherPim = false; + for (const auto& mother : particle1.mothers_as()) { + if (mother.isPhysicalPrimary()) { + hasPrimaryMotherPim = true; + break; + } + } + if (!hasPrimaryMotherPim) + continue; + double pimVx = particle1.vx(); + double pimVy = particle1.vy(); + double pimVz = particle1.vz(); + if (std::abs(pimVx - antipVx) < kVtxTol && std::abs(pimVy - antipVy) < kVtxTol && std::abs(pimVz - antipVz) < kVtxTol) { + pionMinus = true; + break; + } + } + + // Pion plus veto + bool pionPlus = false; + for (const auto& particle2 : mcPartsThis) { + if (particle2.mcCollisionId() != colId) + continue; + const auto proc2Enum = particle2.getProcess(); + const bool isSecondaryFromMaterial2 = (!particle2.producedByGenerator()) && (proc2Enum == kPHadronic || proc2Enum == kPHInhelastic); + if (particle2.pdgCode() != kPiPlus || !isSecondaryFromMaterial2 || particle2.mothersIds().empty()) + continue; + bool hasPrimaryMotherPip = false; + for (const auto& mother : particle2.mothers_as()) { + if (mother.isPhysicalPrimary()) { + hasPrimaryMotherPip = true; + break; + } + } + if (!hasPrimaryMotherPip) + continue; + double pipVx = particle2.vx(); + double pipVy = particle2.vy(); + double pipVz = particle2.vz(); + if (std::abs(pipVx - antipVx) < kVtxTol && std::abs(pipVy - antipVy) < kVtxTol && std::abs(pipVz - antipVz) < kVtxTol) { + pionPlus = true; + break; + } + } + + if (pionPlus || pionMinus) + continue; + + // CEX selection + double dplane = kInitDplane; + double dplaneTmp = 0; + double p = 0; + double pTmp = 0; + double pcexPx = 0; + double pcexPy = 0; + double pcexPz = 0; + double e = 0; + double eTmp = 0; + int k_plane = -1; + int k_e = -1; + int k_p = -1; + + // Secondary proton from material + for (const auto& particle3 : mcPartsThis) { + if (particle3.mcCollisionId() != colId) + continue; + const auto proc3Enum = particle3.getProcess(); + const bool isSecondaryFromMaterial3 = (!particle3.producedByGenerator()) && (proc3Enum == kPHadronic || proc3Enum == kPHInhelastic); + if (particle3.pdgCode() != kProton || !isSecondaryFromMaterial3 || particle3.mothersIds().empty()) + continue; + bool hasPrimaryMotherP = false; + for (const auto& mother : particle3.mothers_as()) { + if (mother.isPhysicalPrimary()) { + hasPrimaryMotherP = true; + break; + } + } + if (!hasPrimaryMotherP) + continue; + double protonVx = particle3.vx(); + double protonVy = particle3.vy(); + double protonVz = particle3.vz(); + double pPx = particle3.px(); + double pPy = particle3.py(); + double pPz = particle3.pz(); + double pE = particle3.e(); + if (std::abs(protonVx - antipVx) < kVtxTol && std::abs(protonVy - antipVy) < kVtxTol && std::abs(protonVz - antipVz) < kVtxTol) { + // Same mother + bool shareMother = false; + const auto& momsAp = particle.mothersIds(); // antiproton + const auto& momsP = particle3.mothersIds(); // proton + for (const auto& ida : momsAp) { + for (const auto& idp : momsP) { + if (ida == idp) { + shareMother = true; + break; + } + } + if (shareMother) + break; + } + if (!shareMother) + continue; + + // CEX proton selection + // dplaneTmp = (pPy*antipPz - pPz*antipPy)*(pvtxX-antipVx) + (pPz*antipPx - pPx*antipPz)*(pvtxY-antipVy) + (pPx*antipPy - pPy*antipPx)*(pvtxZ-antipVz); + double nx = (pPy * antipPz - pPz * antipPy); + double ny = (pPz * antipPx - pPx * antipPz); + double nz = (pPx * antipPy - pPy * antipPx); + double rx = (pvtxX - antipVx); + double ry = (pvtxY - antipVy); + double rz = (pvtxZ - antipVz); + double denom = nx * nx + ny * ny + nz * nz; + if (denom > 0.) { + dplaneTmp = std::abs(nx * rx + ny * ry + nz * rz) / std::sqrt(denom); + } else { + dplaneTmp = kHuge; + } + if (std::abs(dplaneTmp) < std::abs(dplane)) { + k_plane = particle3.globalIndex(); + dplane = dplaneTmp; + } + + eTmp = antipE + pE; + if (std::abs(eTmp) > std::abs(e)) { + k_e = particle3.globalIndex(); + e = eTmp; + } + + pTmp = std::sqrt(std::pow((pPx + antipPx), 2) + std::pow((pPy + antipPy), 2) + std::pow((pPz + antipPz), 2)); + if (std::abs(pTmp) > std::abs(p)) { + k_p = particle3.globalIndex(); + p = pTmp; + pcexPx = pPx; + pcexPy = pPy; + pcexPz = pPz; + } + } + } + + if (k_plane == k_e && k_plane == k_p && k_plane >= 0) { + int pId = k_plane; + TVector3 pVecProton = TVector3(pcexPx, pcexPy, pcexPz); + TVector3 pVecAntiproton = TVector3(antipPx, antipPy, antipPz); + TVector3 total_mc_pVec = pVecProton + pVecAntiproton; + double cexPairMcP = total_mc_pVec.Mag(); + double cexPairMcPt = total_mc_pVec.Pt(); + double cexPairMcPz = pcexPz + antipPz; + double mcangleRad = pVecProton.Angle(pVecAntiproton); + double mcangleDeg = mcangleRad * Rad2Deg; + + // Antineutron mother + if (motherPdg == -kNeutron) { + // CEX pair + histos.fill(HIST("cexPairMcP"), cexPairMcP); + histos.fill(HIST("cexPairMcPt"), cexPairMcPt); + histos.fill(HIST("cexPairMcPz"), cexPairMcPz); + histos.fill(HIST("cex_pairmcDplane"), dplane); + histos.fill(HIST("cex_pairmc_angle"), mcangleDeg); + histos.fill(HIST("cex_pairmc_vtx"), antipVx, antipVy); + histos.fill(HIST("cex_pairmc_vtxz"), antipVz); + if (std::abs(motherEta) < kStrictEta && std::abs(motherVz) < kAccMaxVz) + histos.fill(HIST("cexPairMcPITScuts"), cexPairMcP); + // CEX pair normalized + if (motherP != 0) + histos.fill(HIST("cexn_pairmc_p"), cexPairMcP / motherP); + if (motherPt != 0) + histos.fill(HIST("cexn_pairmc_pt"), cexPairMcPt / motherPt); + if (motherPz != 0) + histos.fill(HIST("cexn_pairmc_pz"), cexPairMcPz / motherPz); + } + // BG mother + if (motherPdg != -kNeutron) { + // CEX pair + histos.fill(HIST("cexbg_pairmc_p"), cexPairMcP); + histos.fill(HIST("cexbg_pairmc_pt"), cexPairMcPt); + histos.fill(HIST("cexbg_pairmc_pz"), cexPairMcPz); + histos.fill(HIST("cexbg_pairmcDplane"), dplane); + histos.fill(HIST("cexbg_pairmc_angle"), mcangleDeg); + histos.fill(HIST("cexbg_pairmc_vtx"), antipVx, antipVy); + histos.fill(HIST("cexbg_pairmc_vtxz"), antipVz); + if (std::abs(motherEta) < kStrictEta && std::abs(motherVz) < kAccMaxVz) + histos.fill(HIST("cexbg_pairmc_pITScuts"), cexPairMcP); + } + + // Detector signal + bool antipLayers = false; + bool antipHasTrack = false; + double antipTrkPx = 0.; + double antipTrkPy = 0.; + double antipTrkPz = 0.; + double antipTrkP = 0.; + double antipTrkEta = 0.; + double antipTrkTpcSignal = 0; + // int antip_trk_nClsTPC = 0; + int antipTrkNClsIts = 0; + uint16_t apItsMap = 0; + + bool pLayers = false; + bool pHasTrack = false; + double pTrkPx = 0.; + double pTrkPy = 0.; + double pTrkPz = 0.; + double pTrkP = 0.; + double pTrkEta = 0.; + double pTrkTpcSignal = 0; + // int p_trk_nClsTPC = 0; + int pTrkNClsIts = 0; + uint16_t pItsMap = 0; + + for (const auto& track : tracks) { + if (!track.has_mcParticle()) + continue; + const auto& mc = track.mcParticle(); + if (mc.mcCollisionId() != colId) + continue; + uint8_t itsMap = track.itsClusterMap(); + // Config for ITS1 + /*bool hitSPD = (itsMap & 0x3) != 0; // bits 0 (SPD L1) & 1 (SPD L2) + bool hitSDD = (itsMap & 0xC) != 0; // bits 2–3 + bool hitSSD = (itsMap & 0x30) != 0; // bits 4–5 + bool layerCondition = (hitSDD || hitSSD) && !hitSPD;*/ + // Config for ITS2 + bool hitL0 = (itsMap & (1u << 0)) != 0; + bool hitL1 = (itsMap & (1u << 1)) != 0; + bool hitL2 = (itsMap & (1u << 2)) != 0; + bool hitL3 = (itsMap & (1u << 3)) != 0; + bool hitL4 = (itsMap & (1u << 4)) != 0; + bool hitL5 = (itsMap & (1u << 5)) != 0; + bool hitL6 = (itsMap & (1u << 6)) != 0; + bool hitIB = (hitL0 || hitL1 || hitL2); + bool hitOuter = (hitL3 || hitL4 || hitL5 || hitL6); + int nITS = track.itsNCls(); + bool layerCondition = (!hitIB) && hitOuter && (nITS >= kMinItsHits); + + if (mc.globalIndex() == antipId) { + antipTrkP = track.p(); + antipTrkPx = track.px(); + antipTrkPy = track.py(); + antipTrkPz = track.pz(); + antipTrkEta = track.eta(); + antipTrkTpcSignal = track.tpcSignal(); + // antip_trk_nClsTPC = track.tpcNCls(); + antipTrkNClsIts = track.itsNCls(); + antipHasTrack = true; + apItsMap = static_cast(track.itsClusterMap()); + antipLayers = (apItsMap != 0); + if (layerCondition) + antipLayers = true; + } else if (mc.globalIndex() == pId) { + pTrkP = track.p(); + pTrkPx = track.px(); + pTrkPy = track.py(); + pTrkPz = track.pz(); + pTrkEta = track.eta(); + pTrkTpcSignal = track.tpcSignal(); + // p_trk_nClsTPC = track.tpcNCls(); + pTrkNClsIts = track.itsNCls(); + pHasTrack = true; + pItsMap = static_cast(track.itsClusterMap()); + pLayers = (pItsMap != 0); + if (layerCondition) + pLayers = true; + } + } + if (!(pHasTrack && antipHasTrack)) + continue; + + TVector3 pVecProton_trk(pTrkPx, pTrkPy, pTrkPz); + TVector3 AntipVecProton_trk(antipTrkPx, antipTrkPy, antipTrkPz); + TVector3 total_trk_pVec = pVecProton_trk + AntipVecProton_trk; + double trkangleRad = AntipVecProton_trk.Angle(pVecProton_trk); + double trkangleDeg = trkangleRad * Rad2Deg; + if (motherPdg == -kNeutron) + histos.fill(HIST("cex_pairtrk_angle"), trkangleDeg); + if (motherPdg != -kNeutron) + histos.fill(HIST("cexbg_pairtrk_angle"), trkangleDeg); + + // ==== Secondary vertex via central DCA vertexer (DCAFitter2) ==== + using o2::vertexing::DCAFitter2; + constexpr float kBzTesla = 0.5f; + DCAFitter2 fitter(/*bz=*/kBzTesla, /*useAbsDCA=*/true, /*propagateToPCA=*/true); + fitter.setBz(kBzTesla); + // float bz = o2::base::Propagator::Instance()->getNominalBz(); // en kGauss + // DCAFitter2 fitter(bz, /*useAbsDCA=*/true, /*propagateToPCA=*/true); + fitter.setMaxR(45.f); // cm + fitter.setMaxDZIni(4.f); // cm + fitter.setMaxDXYIni(4.f); // cm + fitter.setMaxChi2(50.f); + fitter.setPropagateToPCA(true); + std::optional pRow, apRow; + for (const auto& tr : tracks) { + if (!tr.has_mcParticle()) + continue; + const auto& mc = tr.mcParticle(); + if (mc.globalIndex() == antipId) + apRow = tr; + if (mc.globalIndex() == pId) + pRow = tr; + if (pRow && apRow) + break; + } + if (pRow && apRow) { + // TrackParCov + auto trP = makeTPCovFromAOD(*pRow); + auto trAP = makeTPCovFromAOD(*apRow); + int nCand = fitter.process(trP, trAP); + auto status = fitter.getFitStatus(); + histos.fill(HIST("vtxfitStatus"), static_cast(status)); + if (nCand > 0 && (status == DCAFitter2::FitStatus::Converged || status == DCAFitter2::FitStatus::MaxIter)) { + // Secondary vertex (commom PCA) [x,y,z] cm + auto vtx = fitter.getPCACandidatePos(); + const double secX = vtx[0]; + const double secY = vtx[1]; + const double secZ = vtx[2]; + // DCA of the pair in the PCA (equivalent to minDCA) + fitter.propagateTracksToVertex(); + auto tp0 = fitter.getTrackParamAtPCA(0); + auto tp1 = fitter.getTrackParamAtPCA(1); + const auto p0 = tp0.getXYZGlo(); + const auto p1 = tp1.getXYZGlo(); + const double x0 = p0.X(), y0 = p0.Y(), z0 = p0.Z(); + const double x1 = p1.X(), y1 = p1.Y(), z1 = p1.Z(); + const double dcaPair = std::sqrt((x0 - x1) * (x0 - x1) + (y0 - y1) * (y0 - y1) + (z0 - z1) * (z0 - z1)); + + if (motherPdg == -kNeutron) + histos.fill(HIST("cex_pairtrkVtxfitDcaPair"), dcaPair); + if (motherPdg != -kNeutron) + histos.fill(HIST("cexbg_pairtrkVtxfitDcaPair"), dcaPair); + + if (!(antipLayers && pLayers)) + continue; + double cexPairTrkP = total_trk_pVec.Mag(); + double cexPairTrkPt = total_trk_pVec.Pt(); + double cexPairTrkPz = pTrkPz + antipTrkPz; + const double radius = std::hypot(secX, secY); + const double dxPv = secX - pvtxX; + const double dyPv = secY - pvtxY; + const double dzPv = secZ - pvtxZ; + const double distToPrimary = std::sqrt(dxPv * dxPv + dyPv * dyPv + dzPv * dzPv); + + const TVector3 pv2sv(secX - pvtxX, secY - pvtxY, secZ - pvtxZ); + const double pairPointingAngleDeg = pv2sv.Angle(total_trk_pVec) * Rad2Deg; + + const double pP = pVecProton_trk.Mag(); + const double pAP = AntipVecProton_trk.Mag(); + const double ptP = pVecProton_trk.Pt(); + const double ptAP = AntipVecProton_trk.Pt(); + + const double denomP = std::max(1e-9, pP + pAP); + const double denomPt = std::max(1e-9, ptP + ptAP); + + const float pairPBalance = std::abs(pP - pAP) / denomP; + const float pairPtBalance = std::abs(ptP - ptAP) / denomPt; + + const float pairQ = (pVecProton_trk - AntipVecProton_trk).Mag(); + + // Trk - MC + const float dPairP = cexPairTrkP - cexPairMcP; + const float dPairPt = cexPairTrkPt - cexPairMcPt; + const float dPairPz = cexPairTrkPz - cexPairMcPz; + const float dOpenAngle = trkangleDeg - mcangleDeg; + + // Closest ITS layer: Radius need to be checked + static const std::array rLayers = {2.2, 2.8, 3.6, 19.6, 24.0, 29.0, 35.0}; + int16_t svNearestLayerId = -1; + float svDeltaRToLayer = 1e9f; + for (int i = 0; i < static_cast(rLayers.size()); ++i) { + const float dR = static_cast(std::abs(radius - rLayers[i])); + if (dR < svDeltaRToLayer) { + svDeltaRToLayer = dR; + svNearestLayerId = static_cast(i); + } + } + + if (motherPdg == -kNeutron) { + histos.fill(HIST("cexPairTrkP"), cexPairTrkP); + histos.fill(HIST("cexPairTrkPt"), cexPairTrkPt); + histos.fill(HIST("cexPairTrkPz"), cexPairTrkPz); + histos.fill(HIST("cex_pairtrkVtxfitR"), radius); + histos.fill(HIST("cex_pairtrkVtxfitDistToPv"), distToPrimary); + histos.fill(HIST("cex_pairtrk_vtxfit_secVtxXY"), secX, secY); + histos.fill(HIST("cex_pairtrk_vtxfit_secVtxZ"), secZ); + } else { + histos.fill(HIST("cexbg_pairtrk_p"), cexPairTrkP); + histos.fill(HIST("cexbg_pairtrk_pt"), cexPairTrkPt); + histos.fill(HIST("cexbg_pairtrk_pz"), cexPairTrkPz); + histos.fill(HIST("cexbg_pairtrkVtxfitR"), radius); + histos.fill(HIST("cexbg_pairtrkVtxfitDistToPv"), distToPrimary); + histos.fill(HIST("cexbg_pairtrk_vtxfit_secVtxXY"), secX, secY); + histos.fill(HIST("cexbg_pairtrk_vtxfit_secVtxZ"), secZ); + } + + const float chi2 = fitter.getChi2AtPCACandidate(); + histos.fill(HIST("vtxfitChi2"), chi2); + const double dx = secX - antipVx; + const double dy = secY - antipVy; + const double dz = secZ - antipVz; + const double d3d = std::sqrt(dx * dx + dy * dy + dz * dz); + histos.fill(HIST("vtxfit_mc_dX"), dx); + histos.fill(HIST("vtxfit_mc_dY"), dy); + histos.fill(HIST("vtxfit_mc_dZ"), dz); + histos.fill(HIST("vtxfit_mc_d3D"), d3d); + + const bool isCex = (motherPdg == -kNeutron); + + const float vtxfitDX = secX - antipVx; + const float vtxfitDY = secY - antipVy; + const float vtxfitDZ = secZ - antipVz; + const float vtxfitD3D = std::sqrt(vtxfitDX * vtxfitDX + vtxfitDY * vtxfitDY + vtxfitDZ * vtxfitDZ); + + const uint32_t selMask = 0u; + + outPairs( + isCex, + motherPdg, + colId, + pId, + antipId, + + cexPairMcP, + cexPairMcPt, + cexPairMcPz, + dplane, + mcangleDeg, + antipVx, + antipVy, + antipVz, + + cexPairTrkP, + cexPairTrkPt, + cexPairTrkPz, + trkangleDeg, + dcaPair, + radius, + distToPrimary, + secX, + secY, + secZ, + + chi2, + static_cast(status), + nCand, + vtxfitDX, + vtxfitDY, + vtxfitDZ, + vtxfitD3D, + + pTrkP, + pTrkPx, + pTrkPy, + pTrkPz, + pTrkEta, + pTrkTpcSignal, + pTrkNClsIts, + + antipTrkP, + antipTrkPx, + antipTrkPy, + antipTrkPz, + antipTrkEta, + antipTrkTpcSignal, + antipTrkNClsIts, + + selMask, + + pairPointingAngleDeg, + pairPBalance, + pairPtBalance, + pairQ, + + dPairP, + dPairPt, + dPairPz, + dOpenAngle, + + svNearestLayerId, + svDeltaRToLayer, + + pItsMap, + apItsMap, + static_cast(pLayers ? 1 : 0), + static_cast(antipLayers ? 1 : 0), + + pvtxZ); + } + } + // ==== end DCAFitter2 ==== + } + } + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& ctx) +{ + return WorkflowSpec{adaptAnalysisTask(ctx)}; +} From ab5edce6ba170f3161393cba77bbac0cf227b0c3 Mon Sep 17 00:00:00 2001 From: GijsvWeelden <55794847+GijsvWeelden@users.noreply.github.com> Date: Mon, 6 Oct 2025 15:27:03 +0200 Subject: [PATCH 637/986] [PWGJE] Jet Fragmentation & V0 QA (#13218) --- PWGJE/Tasks/jetFragmentation.cxx | 23 ++++++++++++++++++----- PWGJE/Tasks/v0QA.cxx | 26 ++++++++++++++++++-------- 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/PWGJE/Tasks/jetFragmentation.cxx b/PWGJE/Tasks/jetFragmentation.cxx index 997a475400f..b623c4d0cda 100644 --- a/PWGJE/Tasks/jetFragmentation.cxx +++ b/PWGJE/Tasks/jetFragmentation.cxx @@ -64,6 +64,8 @@ struct JetFragmentation { Configurable trackSel{"trackSel", "globalTracks", "choose track selection"}; Configurable nV0Classes{"nV0Classes", 2, "Must be 2 or 4! Number of V0 signal/bkg classes"}; Configurable doCorrectionWithTracks{"doCorrectionWithTracks", false, "add tracks during background subtraction"}; + Configurable fillHistsInclusiveV0s{"fillHistsInclusiveV0s", true, "Fill hists for inclusive V0s"}; + Configurable fillHistsJets{"fillHistsJets", true, "Fill hists for jets"}; Configurable> ptBinsK0S{"ptBinsK0S", {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 10.0, 15.0, 20.0, 25.0, 30.0, 40.0}, "K0S pt Vals"}; Configurable> ptBinsLambda{"ptBinsLambda", {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 10.0, 15.0, 20.0, 25.0}, "Lambda pt Vals"}; @@ -2734,8 +2736,14 @@ struct JetFragmentation { registry.fill(HIST("data/hEvents"), 1.5); registry.fill(HIST("data/V0/nV0sEvent"), V0s.size()); - fillDataV0sInclusive(coll, V0s); - fillDataV0sInclusiveWeighted(coll, V0s); + + if (fillHistsInclusiveV0s) { + fillDataV0sInclusive(coll, V0s); + fillDataV0sInclusiveWeighted(coll, V0s); + } + + if (!fillHistsJets) + return; for (const auto& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, -99., -99., v0EtaMin, v0EtaMax)) @@ -2822,9 +2830,14 @@ struct JetFragmentation { registry.fill(HIST("matching/V0/nV0sEvent"), V0s.size()); registry.fill(HIST("matching/V0/nV0sEventWeighted"), V0s.size(), weight); - fillMcdV0sInclusive(coll, V0s, weight); - fillMcpV0sInclusive(pV0s, weight); - fillMatchingV0sInclusive(coll, V0s, pV0s, weight); + if (fillHistsInclusiveV0s) { + fillMcdV0sInclusive(coll, V0s, weight); + fillMcpV0sInclusive(pV0s, weight); + fillMatchingV0sInclusive(coll, V0s, pV0s, weight); + } + + if (!fillHistsJets) + return; for (const auto& detJet : v0jetsMCD) { if (!jetfindingutilities::isInEtaAcceptance(detJet, -99., -99., v0EtaMin, v0EtaMax)) diff --git a/PWGJE/Tasks/v0QA.cxx b/PWGJE/Tasks/v0QA.cxx index 31b47a88a6e..193227d24d4 100644 --- a/PWGJE/Tasks/v0QA.cxx +++ b/PWGJE/Tasks/v0QA.cxx @@ -325,8 +325,12 @@ struct V0QA { registry.add("sharing/AntiLambdaAntiLambda", "AntiLambda-AntiLambda w shared daughter", HistType::kTHnSparseD, {axisV0Pt, axisEta, axisV0Pt}); registry.add("sharing/JetPtEtaPhi", "JetPtEtaPhi", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); + registry.add("sharing/JetPtEtaPhiNone", "JetPtEtaPhiNone", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); registry.add("sharing/JetPtEtaPhiSingle", "JetPtEtaPhiSingle", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); registry.add("sharing/JetPtEtaPhiMultiple", "JetPtEtaPhiMultiple", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); + registry.add("sharing/JetPtEtaPhiShared", "JetPtEtaPhiShared", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); + registry.add("sharing/JetPtEtaPhiNoShared", "JetPtEtaPhiNoShared", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); + registry.add("sharing/JetPtEtaV0Pt", "JetPtEtaV0Pt", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); registry.add("sharing/JetPtEtaK0SPt", "JetPtEtaK0SPt", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); registry.add("sharing/JetPtEtaLambdaPt", "JetPtEtaLambdaPt", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); @@ -900,14 +904,20 @@ struct V0QA { } template - void fillV0DaughterSharingJet(T const& jet, bool jetHasSingleV0) + void fillV0DaughterSharingJet(T const& jet, bool jetContainsSharedDaughters) { registry.fill(HIST("sharing/JetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi()); - - if (jetHasSingleV0) + if (jet.candidatesIds().size() == 0) + registry.fill(HIST("sharing/JetPtEtaPhiNone"), jet.pt(), jet.eta(), jet.phi()); + else if (jet.candidatesIds().size() == 1) registry.fill(HIST("sharing/JetPtEtaPhiSingle"), jet.pt(), jet.eta(), jet.phi()); else registry.fill(HIST("sharing/JetPtEtaPhiMultiple"), jet.pt(), jet.eta(), jet.phi()); + + if (jetContainsSharedDaughters) + registry.fill(HIST("sharing/JetPtEtaPhiShared"), jet.pt(), jet.eta(), jet.phi()); + else + registry.fill(HIST("sharing/JetPtEtaPhiNoShared"), jet.pt(), jet.eta(), jet.phi()); } template @@ -1767,7 +1777,7 @@ struct V0QA { // Check if V0s within the same jet share daughters for (const auto& jet : jets) { - bool jetHasSingleV0 = true; + bool jetContainsSharedDaughters = false; for (const auto& trigger : jet.template candidates_as()) { if (trigger.isRejectedCandidate()) @@ -1782,14 +1792,14 @@ struct V0QA { if (trigger == associate) continue; - jetHasSingleV0 = false; - // Double-counting accounted for by filling histograms with weight 0.5 - if (v0sShareDaughter(trigger, associate)) + if (v0sShareDaughter(trigger, associate)) { + jetContainsSharedDaughters = true; fillV0DaughterSharingJet(jet, trigger, associate); + } } } - fillV0DaughterSharingJet(jet, jetHasSingleV0); + fillV0DaughterSharingJet(jet, jetContainsSharedDaughters); } } PROCESS_SWITCH(V0QA, processTestV0DaughterSharing, "Test V0s with shared daughters", false); From c739e8ada1edaa07f347e5d3d8895106f75ea224 Mon Sep 17 00:00:00 2001 From: jkinner2 <161342680+jkinner2@users.noreply.github.com> Date: Mon, 6 Oct 2025 15:27:58 +0200 Subject: [PATCH 638/986] [PWGJE] Add MC mixing and adjusting task for use on Hyperloop (#12670) --- .../PhotonChargedTriggerCorrelation.h | 13 +- PWGJE/Tasks/CMakeLists.txt | 4 + .../Tasks/photonChargedTriggerCorrelation.cxx | 1668 ++++++++--------- PWGJE/Tasks/photonChargedTriggerProducer.cxx | 347 ++++ 4 files changed, 1122 insertions(+), 910 deletions(-) create mode 100644 PWGJE/Tasks/photonChargedTriggerProducer.cxx diff --git a/PWGJE/DataModel/PhotonChargedTriggerCorrelation.h b/PWGJE/DataModel/PhotonChargedTriggerCorrelation.h index 53f5e581d82..8cd65eedcb5 100644 --- a/PWGJE/DataModel/PhotonChargedTriggerCorrelation.h +++ b/PWGJE/DataModel/PhotonChargedTriggerCorrelation.h @@ -18,11 +18,12 @@ #ifndef PWGJE_DATAMODEL_PHOTONCHARGEDTRIGGERCORRELATION_H_ #define PWGJE_DATAMODEL_PHOTONCHARGEDTRIGGERCORRELATION_H_ -#include "Framework/AnalysisDataModel.h" -#include "PWGJE/Core/JetDerivedDataUtilities.h" -#include "PWGJE/DataModel/Jet.h" #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" #include "PWGEM/PhotonMeson/Utils/PCMUtilities.h" +#include "PWGJE/Core/JetDerivedDataUtilities.h" +#include "PWGJE/DataModel/Jet.h" + +#include "Framework/AnalysisDataModel.h" namespace o2::aod { @@ -44,9 +45,10 @@ namespace collision_extra_corr { DECLARE_SOA_COLUMN(SelEv, selEv, bool); DECLARE_SOA_COLUMN(TrigEv, trigEv, bool); +DECLARE_SOA_COLUMN(NGlobalTracks, nGlobalTracks, int); } // namespace collision_extra_corr DECLARE_SOA_TABLE(CollisionsExtraCorr, "AOD", "COLLISIONSEXTRACORR", - collision_extra_corr::SelEv, collision_extra_corr::TrigEv); + collision_extra_corr::SelEv, collision_extra_corr::TrigEv, collision_extra_corr::NGlobalTracks); // trigger namespace trigger @@ -114,9 +116,10 @@ using PhotonPCMPair = PhotonPCMPairs::iterator; namespace mc_collision_extra_corr { DECLARE_SOA_COLUMN(TrigEv, trigEv, bool); +DECLARE_SOA_COLUMN(NChargedInEtaRange, nChargedInEtaRange, int); } // namespace mc_collision_extra_corr DECLARE_SOA_TABLE(McCollisionsExtraCorr, "AOD", "MCCOLLISIONSEXTRACORR", - mc_collision_extra_corr::TrigEv); + mc_collision_extra_corr::TrigEv, mc_collision_extra_corr::NChargedInEtaRange); // trigger namespace trigger_particle diff --git a/PWGJE/Tasks/CMakeLists.txt b/PWGJE/Tasks/CMakeLists.txt index 289cff5bd3b..f4d3dff0ce9 100644 --- a/PWGJE/Tasks/CMakeLists.txt +++ b/PWGJE/Tasks/CMakeLists.txt @@ -58,6 +58,10 @@ o2physics_add_dpl_workflow(task-emc-extensive-mc-qa SOURCES taskEmcExtensiveMcQa.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(photon-charged-trigger-producer + SOURCES photonChargedTriggerProducer.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) if(FastJet_FOUND) o2physics_add_dpl_workflow(jet-background-analysis diff --git a/PWGJE/Tasks/photonChargedTriggerCorrelation.cxx b/PWGJE/Tasks/photonChargedTriggerCorrelation.cxx index 8c62845a145..591af00c78b 100644 --- a/PWGJE/Tasks/photonChargedTriggerCorrelation.cxx +++ b/PWGJE/Tasks/photonChargedTriggerCorrelation.cxx @@ -11,345 +11,60 @@ /// \file photonChargedTriggerCorrelation.cxx /// \author Julius Kinner -/// \brief photon-jet correlation analysis +/// \brief photon-jet angular correlation analysis /// /// Analysis for angular correlations between jets and photons via two-particle correlations with charged high-pt triggers /// Associated hadrons (tracks), pipm, photons (PCM), pi0 (PCM) /// Also contains checks and monte-carlo (efficiency, purity, mc-true correlation,...) /// End goal of studying correlations between direct photons and jets -#include -#include -#include -#include -#include -#include -#include -#include +#include "PWGJE/DataModel/PhotonChargedTriggerCorrelation.h" -#include "TMath.h" -#include "Math/Vector4D.h" +#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" +#include "PWGEM/PhotonMeson/Utils/PCMUtilities.h" +#include "PWGJE/DataModel/Jet.h" + +#include "Common/Core/TableHelper.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" #include "CCDB/BasicCCDBManager.h" #include "Framework/ASoAHelpers.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" #include "Framework/O2DatabasePDGPlugin.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/PIDResponse.h" -#include "Common/Core/TableHelper.h" +#include "Framework/runDataProcessing.h" -#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" -#include "PWGEM/PhotonMeson/Utils/PCMUtilities.h" +#include "Math/Vector4D.h" +#include "TMath.h" -#include "PWGJE/DataModel/Jet.h" -#include "PWGJE/DataModel/PhotonChargedTriggerCorrelation.h" +#include +#include +#include +#include +#include +#include +#include +#include -const double absEtaMax = 0.8; +const double absEtaMaxDefault = 0.8; #define DPHI_SCALE constants::math::TwoPI - constants::math::PIHalf -#define DETA_SCALE 4 * absEtaMax - 2 * absEtaMax +#define DETA_SCALE 4 * absEtaMaxDefault - 2 * absEtaMaxDefault using namespace o2; using namespace o2::framework; -using CorrCollisions = soa::Join; +using CorrCollisions = soa::Join; using CorrCollision = CorrCollisions::iterator; -using CorrMcDCollisions = soa::Join; +using CorrMcDCollisions = soa::Join; using CorrMcDCollision = CorrMcDCollisions::iterator; -using CorrMcCollisions = soa::Join; +using CorrMcCollisions = soa::Join; using CorrMcCollision = CorrMcCollisions::iterator; -using BinningZPvMult = ColumnBinningPolicy; - -// correlation derived data =================================================================================================================================================================== - -struct CorrelationTableProducer { - // reco - Produces collisionExtraCorrTable; - Produces triggerTable; - Produces hadronTable; - Produces pipmTable; - Produces photonPCMTable; - Produces photonPCMPairTable; - // mc - Produces mcCollisionExtraCorrTable; - Produces triggerParticleTable; - - Configurable zPvMax{"zPvMax", 7, "maximum absZ primary-vertex cut"}; - Configurable occupancyMin{"occupancyMin", 0, "minimum occupancy cut"}; - Configurable occupancyMax{"occupancyMax", 2000, "maximum occupancy cut"}; - Configurable etaMax{"etaMax", 1 * absEtaMax, "maximum absEta cut"}; - - Configurable eventSelections{"eventSelections", "sel8", "JE framework - event selection"}; - Configurable trackSelections{"trackSelections", "globalTracks", "JE framework - track selections"}; - Configurable triggerMasks{"triggerMasks", "", "JE framework - skimmed data trigger masks (relevent for correlation: fTrackLowPt,fTrackHighPt)"}; - - Configurable piPIDLowPt{"piPIDLowPt", 0.5, "max pt value for pipm PID without tof"}; - Configurable piPIDHighPt{"piPIDHighPt", 2.5, "min pt value for pipm PID without tof in relativistic rise of Bethe-Bloch"}; - Configurable> nSigmaPiTpcLowPt{"nSigmaPiTpcLowPt", {-2, 2}, "minimum-maximum nSigma for pipm in tpc at low pt"}; - Configurable> nSigmaPiTpcMidPt{"nSigmaPiTpcMidPt", {-1, 1}, "minimum-maximum nSigma for pipm in tpc at mid pt"}; - Configurable> nSigmaPiTof{"nSigmaPiTof", {-1, 2}, "minimum-maximum nSigma for pipm in tof"}; - Configurable> nSigmaPiRelRise{"nSigmaPiRelRise", {0, 2}, "minimum-maximum nSigma pipm tpc at high pt"}; - - Configurable ptTrigMin{"ptTrigMin", 5, "minimum pT of triggers"}; - - // derivatives of configurables - - std::vector eventSelectionBits; - int trackSelection = -1; - std::vector triggerMaskBits; - - // for mc - Service pdg; - - // partitions++ - SliceCache cache; - Partition partitionTriggerTracks = aod::jtrack::pt > ptTrigMin; - Partition partitionTriggerParticles = aod::jmcparticle::pt > ptTrigMin; - - Preslice perColTracks = aod::jtrack::collisionId; - Preslice perColMcParticles = aod::jmcparticle::mcCollisionId; - - Preslice perColV0Photons = aod::v0photonkf::collisionId; - - // functions ================================================================================================================================================================================ - - // selections /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - // event selection - template - bool checkEventSelection(T_collision const& collision) - { - if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) - return false; - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) - return false; - if (std::abs(collision.posZ()) > zPvMax) - return false; - if (collision.trackOccupancyInTimeRange() < occupancyMin || collision.trackOccupancyInTimeRange() > occupancyMax) - return false; - return true; - } - - // checks global track cuts - template - bool checkGlobalTrackEta(T_track const& track) - { - if (!jetderiveddatautilities::selectTrack(track, trackSelection)) - return false; - if (!jetderiveddatautilities::applyTrackKinematics(track, 0.1, 1000, -1 * etaMax, etaMax)) - return false; - return true; - } - - // checks pipm selection (just PID (no additional track cuts)) - template - bool checkPipmTPCTOF(T_track const& track) - { - // too low for tof - if (track.pt() < piPIDLowPt) { - if (track.tpcNSigmaPi() > nSigmaPiTpcLowPt.value[0] && track.tpcNSigmaPi() < nSigmaPiTpcLowPt.value[1]) { - return true; - } - return false; - } - // Bethe-Bloch overlap (-> tpc + tof) - if (track.pt() < piPIDHighPt) { - if (track.hasTOF()) { // has to stay inside pt-if due to return-layout of function - if (track.tpcNSigmaPi() > nSigmaPiTpcMidPt.value[0] && track.tpcNSigmaPi() < nSigmaPiTpcMidPt.value[1] && - track.tofNSigmaPi() > nSigmaPiTof.value[0] && track.tofNSigmaPi() < nSigmaPiTof.value[1]) { - return true; - } - } - return false; - } - // Bethe-Bloch rel rise (too high for tof) - if (track.tpcNSigmaPi() > nSigmaPiRelRise.value[0] && track.tpcNSigmaPi() < nSigmaPiRelRise.value[1]) { - return true; - } - return false; - } - - // checks pipm selection (just PID (no additional track cuts)) - template - bool checkPipmTPC(T_track const& track) - { - // Bethe-Bloch rel rise - if (track.pt() > piPIDHighPt) { - if (track.tpcNSigmaPi() > nSigmaPiRelRise.value[0] && track.tpcNSigmaPi() < nSigmaPiRelRise.value[1]) { - return true; - } - } - return false; - } - - // analysis ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - void init(InitContext const&) - { - eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(static_cast(eventSelections)); - trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); - triggerMaskBits = jetderiveddatautilities::initialiseTriggerMaskBits(triggerMasks); - } - - void processRecoCollisionTrigger(aod::JetCollision const& collision, aod::JetTracks const&) - { - // event selection - const bool isSelectedEvent = checkEventSelection(collision); - // trigger event check - bool isTriggerEvent = false; - - if (isSelectedEvent) { - // group collision - auto const triggers = partitionTriggerTracks->sliceByCached(aod::jtrack::collisionId, collision.globalIndex(), cache); - - // trigger loop - for (auto const& trigger : triggers) { - // track selection - if (!checkGlobalTrackEta(trigger)) - continue; - - // detect trigger event - isTriggerEvent = true; - - // trigger info - triggerTable(trigger.collisionId(), trigger.globalIndex(), trigger.pt(), trigger.phi(), trigger.eta()); - } - } - - // collision info - collisionExtraCorrTable(isSelectedEvent, isTriggerEvent); - } - PROCESS_SWITCH(CorrelationTableProducer, processRecoCollisionTrigger, "process correlation collision_extra and trigger table (reconstructed)", false); - - void processRecoPipmTPCTOF(aod::JetCollision const& collision, - soa::Join const& tracks, soa::Join const&) - { - // event selection - if (!checkEventSelection(collision)) - return; - - // hadron/pipm - for (auto const& track : tracks) { - // track selection - if (!checkGlobalTrackEta(track)) - continue; - - // hadron - hadronTable(track.collisionId(), track.globalIndex(), track.pt(), track.phi(), track.eta()); - - // pipm selection - auto const& trackPID = track.track_as>(); - if (!checkPipmTPCTOF(trackPID)) - continue; - - // pipm - pipmTable(track.collisionId(), track.globalIndex(), track.pt(), track.phi(), track.eta()); - } - } - PROCESS_SWITCH(CorrelationTableProducer, processRecoPipmTPCTOF, "process pipm (TPC-TOF) table (reconstructed)", false); - - void processRecoPipmTPC(aod::JetCollision const& collision, - soa::Join const& tracks, soa::Join const&) - { - // event selection - if (!checkEventSelection(collision)) - return; - - // hadron/pipm - for (auto const& track : tracks) { - // track selection - if (!checkGlobalTrackEta(track)) - continue; - - // hadron - hadronTable(track.collisionId(), track.globalIndex(), track.pt(), track.phi(), track.eta()); - - // pipm selection - auto const& trackPID = track.track_as>(); - if (!checkPipmTPC(trackPID)) - continue; - - // pipm - pipmTable(track.collisionId(), track.globalIndex(), track.pt(), track.phi(), track.eta()); - } - } - PROCESS_SWITCH(CorrelationTableProducer, processRecoPipmTPC, "process pipm (TPC) table (reconstructed)", false); - - void processRecoPhotonPCM(soa::Join::iterator const& collision, aod::Collisions const&, - aod::V0PhotonsKF const& v0Photons, aod::V0Legs const&) - { - // event selection - if (!checkEventSelection(collision)) - return; - - // photonsPCM (for some reason collsionId not an index column (?)) - auto const v0PhotonsThisEvent = v0Photons.sliceBy(perColV0Photons, collision.collisionId()); - - // photonPCM - for (auto const& v0Photon : v0PhotonsThisEvent) { - // photon selection - if (std::abs(v0Photon.eta()) > etaMax) - continue; - - // photon PCM - photonPCMTable(v0Photon.collisionId(), v0Photon.globalIndex(), - v0Photon.posTrack().trackId(), v0Photon.negTrack().trackId(), v0Photon.pt(), v0Photon.phi(), v0Photon.eta()); - } - - // photonPCm pairs - for (auto const& [v0Photon1, v0Photon2] : soa::combinations(soa::CombinationsStrictlyUpperIndexPolicy(v0PhotonsThisEvent, v0PhotonsThisEvent))) { - // get kinematics - ROOT::Math::PtEtaPhiMVector const p4V0PCM1(v0Photon1.pt(), v0Photon1.eta(), v0Photon1.phi(), 0.); - ROOT::Math::PtEtaPhiMVector const p4V0PCM2(v0Photon2.pt(), v0Photon2.eta(), v0Photon2.phi(), 0.); - ROOT::Math::PtEtaPhiMVector const p4V0PCMPair = p4V0PCM1 + p4V0PCM2; - - // pi0 selection - if (std::abs(p4V0PCMPair.Eta()) > etaMax) - continue; - - // save info - photonPCMPairTable(v0Photon1.collisionId(), v0Photon1.globalIndex(), v0Photon2.globalIndex(), - v0Photon1.posTrack().trackId(), v0Photon1.negTrack().trackId(), v0Photon2.posTrack().trackId(), v0Photon2.negTrack().trackId(), - p4V0PCMPair.Pt(), p4V0PCMPair.Phi() + constants::math::PI, p4V0PCMPair.Eta(), p4V0PCMPair.M()); - } - } - PROCESS_SWITCH(CorrelationTableProducer, processRecoPhotonPCM, "process photonPCM table (reconstructed)", false); - - void processMcCorrTables(aod::JetMcCollision const& mcCollision, aod::JetParticles const&) - { - // group collision - auto const triggers = partitionTriggerParticles->sliceByCached(aod::jmcparticle::mcCollisionId, mcCollision.globalIndex(), cache); - // trigger event check - bool isTriggerEvent = false; - - // trigger loop - for (auto const& trigger : triggers) { - // track selection - auto const pdgParticle = pdg->GetParticle(trigger.pdgCode()); - if (!pdgParticle || pdgParticle->Charge() == 0) - continue; - if (!trigger.isPhysicalPrimary()) - continue; - if (std::abs(trigger.eta()) > etaMax) - continue; - - // detect trigger event - isTriggerEvent = true; - - // trigger info - triggerParticleTable(mcCollision.globalIndex(), trigger.globalIndex(), trigger.pt(), trigger.phi(), trigger.eta()); - } - - // collision info - mcCollisionExtraCorrTable(isTriggerEvent); - } - PROCESS_SWITCH(CorrelationTableProducer, processMcCorrTables, "process table production (mc)", false); -}; +using BinningZPvMult = ColumnBinningPolicy; // correlation analysis ======================================================================================================================================================================= @@ -359,9 +74,7 @@ struct PhotonChargedTriggerCorrelation { // general (kenobi) Configurable pathCcdbEff{"pathCcdbEff", "Users/j/jkinner/efficiency/set_in_config", "base path to the ccdb efficiencies"}; Configurable urlCcdb{"urlCcdb", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable noLaterThanCcdb{"noLaterThanCcdb", - std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), - "latest acceptable timestamp of creation for the object"}; + Configurable noLaterThanCcdbConfig{"noLaterThanCcdbConfig", -1, "latest acceptable timestamp of creation for the object (-1 for task start time)"}; // analysis Configurable doEffCorrectionTrigger{"doEffCorrectionTrigger", false, "whether to do on-the-fly mixing correction for triggers"}; @@ -370,16 +83,21 @@ struct PhotonChargedTriggerCorrelation { Configurable doEffCorrectionPhotonPCM{"doEffCorrectionPhotonPCM", false, "whether to do on-the-fly mixing correction for photonPCM"}; Configurable doTrigEvMixing{"doTrigEvMixing", false, "whether to use trigger events for trigger mixing"}; - Configurable doTrigEvEff{"doTrigEvEff", false, "whether to use trigger events for efficiency histograms"}; Configurable nTriggerSavedForMixing{"nTriggerSavedForMixing", 2048, "number of triggers that are saved for mixing with other events"}; + Configurable nTriggerMixingMcTrue{"nTriggerMixingMcTrue", 8, "number of triggers that are used for mc true mixing"}; Configurable nTriggerMixingHadron{"nTriggerMixingHadron", 64, "number of triggers that are used for hadron mixing"}; Configurable nTriggerMixingPipm{"nTriggerMixingPipm", 64, "number of triggers that are used for pipm mixing"}; - Configurable nTriggerMixingPhotonPCM{"nTriggerMixingPhotonPCM", 64, "number of triggers that are saved for photonPCM mixing"}; - Configurable nTriggerMixingPi0PCM{"nTriggerMixingPi0PCM", 64, "number of triggers that are saved for pi0PCM mixing"}; - Configurable nNeighboursMixingPi0PCMPair{"nNeighboursMixingPi0PCMPair", 64, "number neighbours used for for pi0PCM pair mixing"}; - Configurable> pi0PCMMassRange{"pi0PCMMassRange", {0.10, 0.15}, "photon-pair mass integration range for pi0PCM"}; - Configurable> pi0PCMSideMassRange{"pi0PCMSideMassRange", {0.16, 0.24}, "photon-pair mass integration range outside outside pi0PCM region"}; + Configurable nTriggerMixingPhotonPCM{"nTriggerMixingPhotonPCM", 256, "number of triggers that are saved for photonPCM mixing"}; + Configurable nTriggerMixingH0PCM{"nTriggerMixingH0PCM", 256, "number of triggers that are saved for h0PCM (pi0, eta) mixing"}; + Configurable nNeighboursMixingPhotonPCMPair{"nNeighboursMixingPhotonPCMPair", 32, "number neighbours used for for photonPCM pair mixing"}; + Configurable> pi0PCMPeakMassRange{"pi0PCMPeakMassRange", {0.10, 0.15}, "photon-pair mass integration range for pi0PCM"}; + Configurable> pi0PCMSideMassRange{"pi0PCMSideMassRange", {0.16, 0.24}, "photon-pair mass integration range outside pi0PCM region"}; + Configurable> etaPCMPeakMassRange{"etaPCMPeakMassRange", {0.51, 0.56}, "photon-pair mass integration range for etaPCM"}; + Configurable> etaPCMLowSideMassRange{"etaPCMLowSideMassRange", {0.45, 0.50}, "photon-pair mass integration range below etaPCM region"}; + Configurable> etaPCMHighSideMassRange{"etaPCMHighSideMassRange", {0.56, 0.65}, "photon-pair mass integration range above etaPCM region"}; + Configurable doTrigEvEff{"doTrigEvEff", false, "whether to use trigger events for efficiency histograms"}; + Configurable ptCutTrigEvEff{"ptCutTrigEvEff", 4, "pT cut for efficieny calculation in trigger events (to avoid trigger bias)"}; Configurable requireSingleCollisionPurity{"requireSingleCollisionPurity", true, "whether particle from single chosen MC-col associated to reco-col (else just type/kin match)"}; // for histograms @@ -425,7 +143,13 @@ struct PhotonChargedTriggerCorrelation { "zPv mixing bins"}; Configurable> binsMult{"binsMult", {-0.5, 9.5, 14.5, 19.5, 25.5, 32}, - "multiplicity mixing bins"}; + "multiplicity mixing bins for mc true"}; + Configurable> binsZPvMcTrue{"binsZPvMcTrue", + {-10000, 10000}, + "zPv mixing bins"}; + Configurable> binsMultMcTrue{"binsMultMcTrue", + {-0.5, 10.5, 15.5, 20.5, 25.5, 30.5, 35.5, 40.5, 50.5, 64}, + "multiplicity mixing bins for mc true"}; // configurables from other tasks @@ -435,6 +159,7 @@ struct PhotonChargedTriggerCorrelation { HistogramRegistry histos{"histogramRegistry", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; // ccdb calls + const int64_t noLaterThanCcdb = noLaterThanCcdbConfig == -1 ? std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count() : noLaterThanCcdbConfig; Service ccdb; // for mc Service pdg; @@ -452,6 +177,7 @@ struct PhotonChargedTriggerCorrelation { Preslice perColHadrons = aod::corr_particle::jetCollisionId; Preslice perColPipms = aod::corr_particle::jetCollisionId; Preslice perColPhotonPCMs = aod::corr_particle::jetCollisionId; + Preslice perColPhotonPCMPairs = aod::corr_particle::jetCollisionId; Preslice perColMcParticles = aod::jmcparticle::mcCollisionId; Preslice perColTriggerParticles = aod::corr_particle::jetMcCollisionId; @@ -474,16 +200,80 @@ struct PhotonChargedTriggerCorrelation { TH1D* h1PtInvEffPhotonPCM; // mixing trigger memory - int nTriggersThisDataFrame; - // organised as zPv- and mult-bin matrix of deques to save trigger info beyond single dataframe + struct MixingTrigger { + float fPt, fPhi, fEta; + float pt() const { return fPt; } + float phi() const { return fPhi; } + float eta() const { return fEta; } + }; + // class to handle trigger info from previous collisions (beyond single dataframe) + // organised as zPv- and mult-bin matrix of deque (pt, phi, eta) to save trigger info beyond single dataframe // extra bin for mult overflow - // with ajusted zVtx (see triggerBinValuesZPv in init) and mult overflow -> all events accounted for + // with adjusted zVtx (see triggerBinValuesZPv in init) and mult overflow -> all events accounted for // (possibly replace by some advanced derived data method and O2 event mixing in future?) - std::vector triggerBinValuesZPv; - std::vector triggerBinValuesMult; - std::vector>> savedTriggersZPvMultPt; - std::vector>> savedTriggersZPvMultPhi; - std::vector>> savedTriggersZPvMultEta; + class MixingTriggerMemory + { + public: + // finds bin that value belongs to (assumes ordered bins) (starts at 0; includes underflow (return -1) and overlflow (return bins.size() - 1)) + // should be faster than some std binary search due to small number of bins (zPv, mult) + static int findIntervalBin(double value, const std::vector& bins) + { + const int n = bins.size() - 1; + if (value < bins[0]) + return -1; // underflow + for (int i_bin = 0; i_bin < n; i_bin++) + if (value < bins[i_bin + 1]) + return i_bin; + return n; // overflow + } + + MixingTriggerMemory(int const nTriggerSavedForMixingIn, std::vector binsZPv, std::vector binsMult) + { + nTriggerSavedForMixing = nTriggerSavedForMixingIn; + triggerBinValuesZPv = binsZPv; + triggerBinValuesMult = binsMult; + // prevent rounding errors in bin finding (multiplicity accounted for by it going to 0 and already considering overflow separately) + triggerBinValuesZPv.front() *= zPvRoundingErrorAdjust; + triggerBinValuesZPv.back() *= zPvRoundingErrorAdjust; + // init correct size of zPv-mult matrix + savedTriggersZPvMult.resize(binsZPv.size() - 1); + for (size_t i_zPv = 0; i_zPv < binsZPv.size() - 1; i_zPv++) { + savedTriggersZPvMult[i_zPv].resize(binsMult.size()); + } + } + + // save trigger for mixing + // up to nTriggerSavedForMixing stored (LIFO) + void saveTrigger(float const pt, float const phi, float const eta, double const zPv, double const mult) + { + int const iBinCorrZPv = findIntervalBin(zPv, triggerBinValuesZPv); + int const iBinCorrMult = findIntervalBin(mult, triggerBinValuesMult); + // special cases (floating point precision errors, mult overflow) should be taken care of by triggerBinValuesZPv and triggerBinValuesMult + savedTriggersZPvMult[iBinCorrZPv][iBinCorrMult].push_front(MixingTrigger{pt, phi, eta}); + if (static_cast(savedTriggersZPvMult[iBinCorrZPv][iBinCorrMult].size()) > nTriggerSavedForMixing) { + savedTriggersZPvMult[iBinCorrZPv][iBinCorrMult].pop_back(); + } + } + + // return deques of trigger pt, phi, eta in the given zPv/mult bin + std::deque const& getTriggers(double const zPv, double const mult) const + { + int const iBinCorrZPv = findIntervalBin(zPv, triggerBinValuesZPv); + int const iBinCorrMult = findIntervalBin(mult, triggerBinValuesMult); + return savedTriggersZPvMult[iBinCorrZPv][iBinCorrMult]; + } + + private: + double const zPvRoundingErrorAdjust = 1.0001; + int nTriggerSavedForMixing; + std::vector triggerBinValuesZPv; + std::vector triggerBinValuesMult; + std::vector>> savedTriggersZPvMult; + }; + + MixingTriggerMemory mixingTriggerMemoryReco{nTriggerSavedForMixing.value, binsZPv.value, binsMult.value}; + MixingTriggerMemory mixingTriggerMemoryTrue{nTriggerSavedForMixing.value, binsZPvMcTrue.value, binsMult.value}; + MixingTriggerMemory mixingTriggerMemoryRecoColTrue{nTriggerSavedForMixing.value, binsZPvMcTrue.value, binsMult.value}; // functions ================================================================================================================================================================================ @@ -496,7 +286,7 @@ struct PhotonChargedTriggerCorrelation { // trigger h1PtInvEffTrigger = nullptr; if (doEffCorrectionTrigger) { - h1PtInvEffTrigger = ccdb->getForTimeStamp(pathCcdbEff.value + "/trigger", noLaterThanCcdb.value); + h1PtInvEffTrigger = ccdb->getForTimeStamp(pathCcdbEff.value + "/trigger", noLaterThanCcdb); const double* effBinsTrigger = h1PtInvEffTrigger->GetXaxis()->GetXbins()->GetArray(); const AxisSpec axisPtEffTrigger{std::vector(effBinsTrigger, effBinsTrigger + h1PtInvEffTrigger->GetNbinsX() + 1), "#it{p}_{T}"}; @@ -509,7 +299,7 @@ struct PhotonChargedTriggerCorrelation { // hadron h1PtInvEffHadron = nullptr; if (doEffCorrectionHadron) { - h1PtInvEffHadron = ccdb->getForTimeStamp(pathCcdbEff.value + "/hadron", noLaterThanCcdb.value); + h1PtInvEffHadron = ccdb->getForTimeStamp(pathCcdbEff.value + "/hadron", noLaterThanCcdb); const double* effBinsHadron = h1PtInvEffHadron->GetXaxis()->GetXbins()->GetArray(); const AxisSpec axisPtEffHadron{std::vector(effBinsHadron, effBinsHadron + h1PtInvEffHadron->GetNbinsX() + 1), "#it{p}_{T}"}; @@ -522,7 +312,7 @@ struct PhotonChargedTriggerCorrelation { // pipm h1PtInvEffPipm = nullptr; if (doEffCorrectionPipm) { - h1PtInvEffPipm = ccdb->getForTimeStamp(pathCcdbEff.value + "/pipm", noLaterThanCcdb.value); + h1PtInvEffPipm = ccdb->getForTimeStamp(pathCcdbEff.value + "/pipm", noLaterThanCcdb); const double* effBinsPipm = h1PtInvEffPipm->GetXaxis()->GetXbins()->GetArray(); const AxisSpec axisPtEffPipm{std::vector(effBinsPipm, effBinsPipm + h1PtInvEffPipm->GetNbinsX() + 1), "#it{p}_{T}"}; @@ -535,7 +325,7 @@ struct PhotonChargedTriggerCorrelation { // photonPCM h1PtInvEffPhotonPCM = nullptr; if (doEffCorrectionPhotonPCM) { - h1PtInvEffPhotonPCM = ccdb->getForTimeStamp(pathCcdbEff.value + "/photonPCM", noLaterThanCcdb.value); + h1PtInvEffPhotonPCM = ccdb->getForTimeStamp(pathCcdbEff.value + "/photonPCM", noLaterThanCcdb); const double* effBinsPhotonPCM = h1PtInvEffPhotonPCM->GetXaxis()->GetXbins()->GetArray(); const AxisSpec axisPtEffPhotonPCM{std::vector(effBinsPhotonPCM, effBinsPhotonPCM + h1PtInvEffPhotonPCM->GetNbinsX() + 1), "#it{p}_{T}"}; @@ -570,6 +360,8 @@ struct PhotonChargedTriggerCorrelation { const AxisSpec axisDEta{binsDEta, "#Delta#it{#eta}"}; const AxisSpec axisZPvBinning{binsZPv, "#it{z}_{pv} correlation binning"}; const AxisSpec axisMultBinning{binsMult, "multiplicity correlation binning"}; + const AxisSpec axisZPvBinningMcTrue{binsZPvMcTrue, "#it{z}_{pv} correlation binning for mc true"}; + const AxisSpec axisMultBinningMcTrue{binsMultMcTrue, "multiplicity correlation binning for mc true"}; // reco info histos.add("reco/info/h1_nEvents", "h1_nEvents", kTH1D, {axisCategories}); @@ -579,113 +371,90 @@ struct PhotonChargedTriggerCorrelation { histos.add("reco/info/h2_zPvMult", "h2_zPvMult", kTHnSparseD, {axisZPv, axisMult}, true); histos.add("reco/info/h1_occupancy", "h1_occupancy", kTH1D, {axisOccupancy}, true); - - // reco (correlation) analysis histos.add("reco/info/h2_zPvMult_trigEv", "h2_zPvMult_trigEv", kTHnSparseD, {axisZPv, axisMult}, true); histos.add("reco/info/h1_occupancy_trigEv", "h1_occupancy_trigEv", kTH1D, {axisOccupancy}, true); + + // reco (correlation) analysis histos.add("reco/corr/h3_ptPhiEta_trig", "h3_ptPhiEta_trig", kTHnSparseD, {axisPtAssoc, axisPhi, axisEta}, true); + std::function add_corrHists = + [&](std::string const name_id) { + histos.add(std::format("reco/corr/h3_ptPhiEta_assoc_{}", name_id).data(), std::format("h3_ptPhiEta_assoc_{}", name_id).data(), + kTHnSparseD, {axisPtAssoc, axisPhi, axisEta}, true); + histos.add(std::format("reco/corr/h6_corr_{}", name_id).data(), std::format("h6_corr_{}", name_id).data(), + kTHnSparseF, {axisDPhi, axisDEta, axisPtTrig, axisPtAssoc, axisZPvBinning, axisMultBinning}, true); + histos.add(std::format("reco/corr/h6_mix_{}", name_id).data(), std::format("h6_mix_{}", name_id).data(), + kTHnSparseF, {axisDPhi, axisDEta, axisPtTrig, axisPtAssoc, axisZPvBinning, axisMultBinning}, true); + }; // hadron histos.add("reco/plain/h3_ptPhiEta_hadron", "h3_ptPhiEta_hadron", kTHnSparseD, {axisPtAssoc, axisPhi, axisEta}, true); - histos.add("reco/corr/h3_ptPhiEta_assoc_hadron", "h3_ptPhiEta_assoc_hadron", kTHnSparseD, {axisPtAssoc, axisPhi, axisEta}, true); - histos.add("reco/corr/h6_corr_hadron", "h6_corr_hadron", - kTHnSparseF, {axisDPhi, axisDEta, axisPtTrig, axisPtAssoc, axisZPvBinning, axisMultBinning}, true); - histos.add("reco/corr/h6_mix_hadron", "h6_mix_hadron", - kTHnSparseF, {axisDPhi, axisDEta, axisPtTrig, axisPtAssoc, axisZPvBinning, axisMultBinning}, true); + add_corrHists("hadron"); // pipm histos.add("reco/plain/h3_ptPhiEta_pipm", "h3_ptPhiEta_pipm", kTHnSparseD, {axisPtAssoc, axisPhi, axisEta}, true); - histos.add("reco/corr/h3_ptPhiEta_assoc_pipm", "h3_ptPhiEta_assoc_pipm", kTHnSparseD, {axisPtAssoc, axisPhi, axisEta}, true); - histos.add("reco/corr/h6_corr_pipm", "h6_corr_pipm", - kTHnSparseF, {axisDPhi, axisDEta, axisPtTrig, axisPtAssoc, axisZPvBinning, axisMultBinning}, true); - histos.add("reco/corr/h6_mix_pipm", "h6_mix_pipm", - kTHnSparseF, {axisDPhi, axisDEta, axisPtTrig, axisPtAssoc, axisZPvBinning, axisMultBinning}, true); + add_corrHists("pipm"); // photonPCM histos.add("reco/plain/h3_ptPhiEta_photonPCM", "h3_ptPhiEta_photonPCM", kTHnSparseD, {axisPtAssoc, axisPhi, axisEta}, true); - histos.add("reco/corr/h3_ptPhiEta_assoc_photonPCM", "h3_ptPhiEta_assoc_photonPCM", kTHnSparseD, {axisPtAssoc, axisPhi, axisEta}, true); - histos.add("reco/corr/h6_corr_photonPCM", "h6_corr_photonPCM", - kTHnSparseF, {axisDPhi, axisDEta, axisPtTrig, axisPtAssoc, axisZPvBinning, axisMultBinning}, true); - histos.add("reco/corr/h6_mix_photonPCM", "h6_mix_photonPCM", - kTHnSparseF, {axisDPhi, axisDEta, axisPtTrig, axisPtAssoc, axisZPvBinning, axisMultBinning}, true); + add_corrHists("photonPCM"); // photonPCM pairs histos.add("reco/plain/h4_ptMggZPvMult_photonPCMPair", "h4_ptMggZPvMult_photonPCMPair", kTHnSparseD, {axisPtAssoc, axisMgg, axisZPvBinning, axisMultBinning}, true); - histos.add("reco/plain/h3_ptPhiEta_pi0PCMPeak", "h3_ptPhiEta_pi0PCMPeak", kTHnSparseD, {axisPtAssoc, axisPhi, axisEta}, true); - histos.add("reco/corr/h4_ptMggZPvMult_assoc_photonPCMPair", "h4_ptMggZPvMult_assoc_photonPCMPair", kTHnSparseD, {axisPtAssoc, axisMgg, axisZPvBinning, axisMultBinning}, true); - histos.add("reco/corr/h3_ptPhiEta_assoc_pi0PCMPeak", "h3_ptPhiEta_assoc_pi0PCMPeak", kTHnSparseD, {axisPtAssoc, axisPhi, axisEta}, true); - // peak (mgg) - histos.add("reco/corr/h6_corr_pi0PCMPeak", "h6_corr_pi0PCMPeak", - kTHnSparseF, {axisDPhi, axisDEta, axisPtTrig, axisPtAssoc, axisZPvBinning, axisMultBinning}, true); - histos.add("reco/corr/h6_mix_pi0PCMPeak", "h6_mix_pi0PCMPeak", - kTHnSparseF, {axisDPhi, axisDEta, axisPtTrig, axisPtAssoc, axisZPvBinning, axisMultBinning}, true); - // side (mgg) - histos.add("reco/corr/h6_corr_pi0PCMSide", "h6_corr_pi0PCMSide", - kTHnSparseF, {axisDPhi, axisDEta, axisPtTrig, axisPtAssoc, axisZPvBinning, axisMultBinning}, true); - histos.add("reco/corr/h6_mix_pi0PCMSide", "h6_mix_pi0PCMSide", - kTHnSparseF, {axisDPhi, axisDEta, axisPtTrig, axisPtAssoc, axisZPvBinning, axisMultBinning}, true); + histos.add("reco/plain/h4_ptMggZPvMult_trigEv_photonPCMPair", "h4_ptMggZPvMult_trigEv_photonPCMPair", kTHnSparseD, {axisPtAssoc, axisMgg, axisZPvBinning, axisMultBinning}, true); + histos.add("reco/corr/h5_ptTrigPtAssocMggZPvMult_assoc_photonPCMPair", "h5_ptTrigPtAssocMggZPvMult_assoc_photonPCMPair", kTHnSparseD, {axisPtTrig, axisPtAssoc, axisMgg, axisZPvBinning, axisMultBinning}, true); + // pi0PCM + add_corrHists("pi0PCMPeak"); + add_corrHists("pi0PCMSide"); + // etaPCM + add_corrHists("etaPCMPeak"); + add_corrHists("etaPCMSide"); + // event mixing for photon pairs histos.add("reco/plain/h2_zPvMult_photonPCMPair_evMix", "h2_zPvMult_photonPCMPair_evMix", kTHnSparseD, {axisZPv, axisMult}, true); histos.add("reco/plain/h4_ptMggZPvMult_photonPCMPair_evMix", "h4_ptMggZPvMult_photonPCMPair_evMix", kTHnSparseD, {axisPtAssoc, axisMgg, axisZPvBinning, axisMultBinning}, true); - histos.add("reco/plain/h3_ptPhiEta_pi0PCMPeak_evMix", "h3_ptPhiEta_pi0PCMPeak_evMix", kTHnSparseD, {axisPtAssoc, axisPhi, axisEta}, true); + histos.add("reco/plain/h4_ptMggZPvMult_trigEv_photonPCMPair_evMix", "h4_ptMggZPvMult_trigEv_photonPCMPair_evMix", kTHnSparseD, {axisPtAssoc, axisMgg, axisZPvBinning, axisMultBinning}, true); // mc info histos.add("mc/info/h1_nEvents_mcTrue", "h1_nEvents_mcTrue", kTH1D, {axisN}); - histos.add("mc/info/h1_nTriggerEvents_mcTrue", "h1_nTriggerEvents_mcTrue", kTH1D, {axisN}); - - histos.add("mc/info/h1_zPv_mcTrue", "h1_zPv_mcTrue", kTH1D, {axisZPv}, true); - histos.add("mc/info/h1_mult_mcTrue", "h1_mult_mcTrue", kTH1D, {axisMult}, true); + histos.add("mc/info/h2_zPvMult_mcTrue", "h2_zPvMult_mcTrue", kTHnSparseD, {axisZPv, axisMult}, true); + histos.add("mc/info/h1_nTrigEv_mcTrue", "h1_nTrigEv_mcTrue", kTH1D, {axisN}); + histos.add("mc/info/h2_zPvMult_trigEv_mcTrue", "h2_zPvMult_trigEv_mcTrue", kTHnSparseD, {axisZPv, axisMult}, true); + histos.add("mc/info/h1_nRecoCol_mcTrue", "h1_nRecoCol_mcTrue", kTH1D, {axisN}); + histos.add("mc/info/h2_zPvMult_recoCol_mcTrue", "h2_zPvMult_recoCol_mcTrue", kTHnSparseD, {axisZPv, axisMult}, true); // reco and true collision correlations - for (auto const& collision_type : {"true", "true_reco"}) { + const std::vector assocMcCorrHistNames = {"hadron", "pipm", "photon", "pi0", "eta"}; + for (auto const& collision_type : {"true", "recoCol_true"}) { histos.add(std::format("mc/{}/corr/h3_ptPhiEta_trig", collision_type).data(), "h3_ptPhiEta_trig", kTHnSparseD, {axisPtAssoc, axisPhi, axisEta}, true); - // hadron - histos.add(std::format("mc/{}/corr/h3_ptPhiEta_assoc_hadron", collision_type).data(), "h3_ptPhiEta_assoc_hadron", - kTHnSparseD, {axisPtAssoc, axisPhi, axisEta}, true); - histos.add(std::format("mc/{}/corr/h4_corr_hadron", collision_type).data(), "h4_corr_hadron", - kTHnSparseD, {axisDPhi, axisDEta, axisPtTrig, axisPtAssoc}, true); - // pipm - histos.add(std::format("mc/{}/corr/h3_ptPhiEta_assoc_pipm", collision_type).data(), "h3_ptPhiEta_assoc_pipm", - kTHnSparseD, {axisPtAssoc, axisPhi, axisEta}, true); - histos.add(std::format("mc/{}/corr/h4_corr_pipm", collision_type).data(), "h4_corr_pipm", - kTHnSparseD, {axisDPhi, axisDEta, axisPtTrig, axisPtAssoc}, true); - // photon - histos.add(std::format("mc/{}/corr/h3_ptPhiEta_assoc_photon", collision_type).data(), "h3_ptPhiEta_assoc_photon", - kTHnSparseD, {axisPtAssoc, axisPhi, axisEta}, true); - histos.add(std::format("mc/{}/corr/h4_corr_photon", collision_type).data(), "h4_corr_photon", - kTHnSparseD, {axisDPhi, axisDEta, axisPtTrig, axisPtAssoc}, true); - // pi0 - histos.add(std::format("mc/{}/corr/h3_ptPhiEta_assoc_pi0", collision_type).data(), "h3_ptPhiEta_assoc_pi0", - kTHnSparseD, {axisPtAssoc, axisPhi, axisEta}, true); - histos.add(std::format("mc/{}/corr/h4_corr_pi0", collision_type).data(), "h4_corr_pi0", - kTHnSparseD, {axisDPhi, axisDEta, axisPtTrig, axisPtAssoc}, true); + for (auto const& assocName : assocMcCorrHistNames) { + histos.add(std::format("mc/{}/corr/h6_corr_{}", collision_type, assocName).data(), std::format("h6_corr_{}", assocName).data(), + kTHnSparseD, {axisDPhi, axisDEta, axisPtTrig, axisPtAssoc, axisZPvBinningMcTrue, axisMultBinningMcTrue}, true); + histos.add(std::format("mc/{}/corr/h6_mix_{}", collision_type, assocName).data(), std::format("h6_mix_{}", assocName).data(), + kTHnSparseD, {axisDPhi, axisDEta, axisPtTrig, axisPtAssoc, axisZPvBinningMcTrue, axisMultBinningMcTrue}, true); + } } // mc efficiency/purity std::function add_effHists = - [&](std::string name_id) { - histos.add(std::format("mc/eff/h3_ptPhiEta_{}", name_id).data(), "h3_ptPhiEta_mcReco_hadron", + [&](std::string const name_id) { + histos.add(std::format("mc/eff/h3_ptPhiEta_{}", name_id).data(), std::format("h3_ptPhiEta_{}", name_id).data(), kTHnSparseD, {axisPtAssoc, axisPhi, axisEta}, true); - histos.add(std::format("mc/eff/h3_ptZPvMult_{}", name_id).data(), "h3_ptZPvMult_mcReco_hadron", + histos.add(std::format("mc/eff/h3_ptZPvMult_{}", name_id).data(), std::format("h3_ptZPvMult_{}", name_id).data(), kTHnSparseD, {axisPtAssoc, axisZPvSmol, axisMultSmol}, true); }; // mc tracks add_effHists("mcReco_hadron"); add_effHists("mcReco_hasCorrectMc_hadron"); - add_effHists("mcTrue_hadron"); add_effHists("mcTrue_recoCol_hadron"); // mc pipm PID add_effHists("mcReco_pipm"); add_effHists("mcReco_hasCorrectMc_pipm"); - add_effHists("mcTrue_pipm"); add_effHists("mcTrue_recoCol_pipm"); // mc photonPCM add_effHists("mcReco_photonPCM"); add_effHists("mcReco_hasCorrectMc_photonPCM"); - add_effHists("mcTrue_photon"); add_effHists("mcTrue_recoCol_photon"); - // mc pi0PCM - add_effHists("mcReco_pi0PCM"); - add_effHists("mcReco_hasCorrectMc_pi0PCM"); - add_effHists("mcTrue_pi0"); + // mc pi0 add_effHists("mcTrue_recoCol_pi0"); + // mc eta + add_effHists("mcTrue_recoCol_eta"); // test of the test while testing another test. featuring a test histos.add("test/h2_mult_comp", "h2_mult_comp", kTH2D, {axisMult, axisMult}, true); @@ -724,26 +493,73 @@ struct PhotonChargedTriggerCorrelation { return false; return true; } - // checks if mcParticle should be detected as 'primary' pi0->gg (|eta| not checked) + // checks if mcParticle should be detected as 'primary' (|eta| not checked) template - bool checkPi0ToGG(T_mcParticle const& mcParticle) + bool checkH0Primary(T_mcParticle const& mcParticle, int const pdg) { - if (mcParticle.pdgCode() != PDG_t::kPi0) + if (mcParticle.pdgCode() != pdg) return false; - // identify primary pi0 (account for 0 daughters for some reason) - if (mcParticle.template daughters_as().size() == 0) + const auto& h0Daughters = mcParticle.template daughters_as(); + // identify primary h0 (account for 0 daughters for some reason) + if (h0Daughters.size() == 0) return false; - for (auto const& pi0_daughter : mcParticle.template daughters_as()) { - if (!pi0_daughter.isPhysicalPrimary()) + for (auto const& h0_daughter : h0Daughters) { + if (!h0_daughter.isPhysicalPrimary()) return false; } - // select pi0 -> gg - constexpr int NDaughtersPi0ToGG = 2; - if (mcParticle.template daughters_as().size() != NDaughtersPi0ToGG) + return true; + } + // checks if mcParticle should be detected as 'primary' pi0->gammagamma (|eta| not checked) + template + bool checkH0ToGG(T_mcParticle const& mcParticle, int const pdg) + { + if (!checkH0Primary(mcParticle, pdg)) + return false; + // select h0 -> gg + constexpr int NDaughtersH0ToGG = 2; + if (mcParticle.template daughters_as().size() != NDaughtersH0ToGG) return false; return true; } + // checks if tracks come from photon conversion + template + bool isConversionPhoton(T_track const& posTrack, T_track const& negTrack) + { + // check same mother + auto const& posMothers = posTrack.mcParticle().template mothers_as(); + auto const& negMothers = negTrack.mcParticle().template mothers_as(); + if (posMothers.size() != 1 || negMothers.size() != 1) + return false; + if (posMothers.begin()->globalIndex() != negMothers.begin()->globalIndex()) + return false; + // check photon + if (posMothers.begin()->pdgCode() != PDG_t::kGamma) + return false; + + return true; + }; + // checks if tracks come from pi0 double conversion + template + bool isGGFromPi0(T_track const& posTrack1, T_track const& negTrack1, T_track const& posTrack2, T_track const& negTrack2) + { + if (!isConversionPhoton(posTrack1, negTrack1) || !isConversionPhoton(posTrack2, negTrack2)) + return false; + // check same mother + auto const& mothers1 = (*(posTrack1.mcParticle().template mothers_as().begin())).template mothers_as(); + auto const& mothers2 = (*(posTrack2.mcParticle().template mothers_as().begin())).template mothers_as(); + constexpr int NMothersPhotonFromPi0 = 2; // for some reason two mothers (same particle) for pi0 decays (contradicts PYTHIA documentation, but whatever) + if (mothers1.size() != NMothersPhotonFromPi0 || mothers2.size() != NMothersPhotonFromPi0) + return false; + if (mothers1.begin()->globalIndex() != mothers2.begin()->globalIndex()) + return false; + // check pi0 + if (mothers1.begin()->pdgCode() != PDG_t::kPi0) + return false; + + return true; + }; + // analysis helpers ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// template @@ -752,22 +568,21 @@ struct PhotonChargedTriggerCorrelation { return h1->GetBinContent(h1->FindFixBin(value)); } // efficiency helpers - // define enum class for particle type - enum class ParticleType { Trigger, - Hadron, - Pipm, - PhotonPCM }; + enum class EffParticleType { Trigger, + Hadron, + Pipm, + PhotonPCM }; // efficiency function - template + template double getInvEff(double const value) { - if constexpr (T == ParticleType::Trigger) { + if constexpr (T_effParticleType == EffParticleType::Trigger) { return doEffCorrectionTrigger ? getH1ValueAt(h1PtInvEffTrigger, value) : 1; - } else if constexpr (T == ParticleType::Hadron) { + } else if constexpr (T_effParticleType == EffParticleType::Hadron) { return doEffCorrectionHadron ? getH1ValueAt(h1PtInvEffHadron, value) : 1; - } else if constexpr (T == ParticleType::Pipm) { + } else if constexpr (T_effParticleType == EffParticleType::Pipm) { return doEffCorrectionPipm ? getH1ValueAt(h1PtInvEffPipm, value) : 1; - } else if constexpr (T == ParticleType::PhotonPCM) { + } else if constexpr (T_effParticleType == EffParticleType::PhotonPCM) { return doEffCorrectionPhotonPCM ? getH1ValueAt(h1PtInvEffPhotonPCM, value) : 1; } else { return 1; @@ -814,6 +629,28 @@ struct PhotonChargedTriggerCorrelation { return -1; } + // check if invariant mass range + enum class MassRange { pi0PCMPeak, + pi0PCMSide, + etaPCMPeak, + etaPCMSide }; + + template + bool checkMassRange(double const mgg) + { + if constexpr (T_massRange == MassRange::pi0PCMPeak) { + return mgg > pi0PCMPeakMassRange.value[0] && mgg < pi0PCMPeakMassRange.value[1]; + } else if constexpr (T_massRange == MassRange::pi0PCMSide) { + return mgg > pi0PCMSideMassRange.value[0] && mgg < pi0PCMSideMassRange.value[1]; + } else if constexpr (T_massRange == MassRange::etaPCMPeak) { + return mgg > etaPCMPeakMassRange.value[0] && mgg < etaPCMPeakMassRange.value[1]; + } else if constexpr (T_massRange == MassRange::etaPCMSide) { + return (mgg > etaPCMLowSideMassRange.value[0] && mgg < etaPCMLowSideMassRange.value[1]) || + (mgg > etaPCMHighSideMassRange.value[0] && mgg < etaPCMHighSideMassRange.value[1]); + } + return false; + } + // analysis ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // generalised correlation functions @@ -848,26 +685,21 @@ struct PhotonChargedTriggerCorrelation { typename T_funcMixing> void corrProcessMixing(T_collision const& collision, T_associatedThisEvent const& associatedThisEvent, T_funcMixing&& funcMixing, - size_t const nTriggerMixing) + size_t const nTriggerMixing, size_t const nTriggersThisDataFrame) { // skip if event does not contain valid trigger if (doTrigEvMixing && !collision.trigEv()) return; // mixing loops (more efficient than O2 mixing (for now)) - // prepare zPv-mult binned saved triggers - const int iBinCorrZPv = findIntervalBin(collision.posZ(), triggerBinValuesZPv); - const int iBinCorrMult = findIntervalBin(collision.multNTracksGlobal(), triggerBinValuesMult); - auto const& savedTriggersPt = savedTriggersZPvMultPt[iBinCorrZPv][iBinCorrMult]; - auto const& savedTriggersPhi = savedTriggersZPvMultPhi[iBinCorrZPv][iBinCorrMult]; - auto const& savedTriggersEta = savedTriggersZPvMultEta[iBinCorrZPv][iBinCorrMult]; + auto savedTriggers = mixingTriggerMemoryReco.getTriggers(collision.posZ(), collision.nGlobalTracks()); // number of triggers - const int mixUpToTriggerN = std::min(savedTriggersPt.size(), nTriggerMixing + nTriggersThisDataFrame); + const size_t mixUpToTriggerN = std::min(savedTriggers.size(), nTriggerMixing + nTriggersThisDataFrame); const float perTriggerWeight = 1. / (mixUpToTriggerN - nTriggersThisDataFrame); // mixUpToTriggerN <= nTriggersThisDataFrame not problematic since no loop then // mixing loops - for (int i_mixingTrigger = nTriggersThisDataFrame; i_mixingTrigger < mixUpToTriggerN; i_mixingTrigger++) { + for (size_t i_mixingTrigger = nTriggersThisDataFrame; i_mixingTrigger < mixUpToTriggerN; i_mixingTrigger++) { for (auto const& associated : associatedThisEvent) { - funcMixing(collision, savedTriggersPt[i_mixingTrigger], savedTriggersPhi[i_mixingTrigger], savedTriggersEta[i_mixingTrigger], associated, perTriggerWeight); + funcMixing(collision, savedTriggers[i_mixingTrigger].pt(), savedTriggers[i_mixingTrigger].phi(), savedTriggers[i_mixingTrigger].eta(), associated, perTriggerWeight); } } } @@ -879,29 +711,13 @@ struct PhotonChargedTriggerCorrelation { // enabling object caching (otherwise each call goes to CCDB server) ccdb->setCaching(true); // ccdb->setLocalObjectValidityChecking(); - // not later than now, will be replaced by the value of train creation (avoids replacing objects while a train is running) - ccdb->setCreatedNotAfter(noLaterThanCcdb.value); + // not later than (avoids replacing objects while a train is running) + ccdb->setCreatedNotAfter(noLaterThanCcdb); // init analysis variables - // get variabels from other tasks - getTaskOptionValue(initContext, "correlation-table-producer", "etaMax", etaMax, false); - - // mixing trigger memory - triggerBinValuesZPv = binsZPv; - triggerBinValuesMult = binsMult; - // prevent rounding errors in bin finding (multiplicity accounted for by it going to 0 and already considering overflow separately) - triggerBinValuesZPv.front() *= 1.0001; - triggerBinValuesZPv.back() *= 1.0001; - // init correct size of zPv-mult matrix - savedTriggersZPvMultPt.resize(binsZPv.value.size() - 1); - savedTriggersZPvMultPhi.resize(binsZPv.value.size() - 1); - savedTriggersZPvMultEta.resize(binsZPv.value.size() - 1); - for (size_t i_zPv = 0; i_zPv < binsZPv.value.size() - 1; i_zPv++) { - savedTriggersZPvMultPt[i_zPv].resize(binsMult.value.size()); - savedTriggersZPvMultPhi[i_zPv].resize(binsMult.value.size()); - savedTriggersZPvMultEta[i_zPv].resize(binsMult.value.size()); - } + // get variables from other tasks + getTaskOptionValue(initContext, "photon-charged-trigger-producer", "etaMax", etaMax, false); // histograms from ccdb initCcdbHistograms(); @@ -914,30 +730,33 @@ struct PhotonChargedTriggerCorrelation { void processInfo(CorrCollision const& collision) { - // trigger events - if (collision.trigEv()) { - histos.fill(HIST("reco/info/h1_nEvents"), 2.5); - } + // all events + histos.fill(HIST("reco/info/h1_nEvents"), 1.5); // event selection - histos.fill(HIST("reco/info/h1_nEvents"), 1.5); if (!collision.selEv()) return; histos.fill(HIST("reco/info/h1_nEvents"), 0.5); - // QA - histos.fill(HIST("reco/info/h2_zPvMult"), collision.posZ(), collision.multNTracksGlobal()); + histos.fill(HIST("reco/info/h2_zPvMult"), collision.posZ(), collision.nGlobalTracks()); histos.fill(HIST("reco/info/h1_occupancy"), collision.trackOccupancyInTimeRange()); + + // trigger events + if (!collision.trigEv()) + return; + histos.fill(HIST("reco/info/h1_nEvents"), 2.5); + + histos.fill(HIST("reco/info/h2_zPvMult_trigEv"), collision.posZ(), collision.nGlobalTracks()); + histos.fill(HIST("reco/info/h1_occupancy_trigEv"), collision.trackOccupancyInTimeRange()); } PROCESS_SWITCH(PhotonChargedTriggerCorrelation, processInfo, "process general info on collisions and tracks for analysis and qa", false); void processCorrFirst(CorrCollisions const& collisions, aod::Triggers const& triggers) { - // do at beginning of each data frame (before other correlation process functions) + // do at beginning of each data frame (before other reco correlation process functions) // (PROCESS_SWITCH of this process has to be declared first) - // set trigger counter - nTriggersThisDataFrame = triggers.size(); + // [wow, such empty] for (auto const& collision : collisions) { // event selection @@ -951,226 +770,291 @@ struct PhotonChargedTriggerCorrelation { for (auto const& trigger : triggersThisEvent) { // trigger info histos.fill(HIST("reco/corr/h3_ptPhiEta_trig"), trigger.pt(), trigger.phi(), trigger.eta(), - getInvEff(trigger.pt())); - - // save triggers for mixing - const int iBinCorrZPv = findIntervalBin(collision.posZ(), triggerBinValuesZPv); - const int iBinCorrMult = findIntervalBin(collision.multNTracksGlobal(), triggerBinValuesMult); - // special cases (floating point precision errors, mult overflow) should be taken care of by triggerBinValuesZPv and triggerBinValuesMult - savedTriggersZPvMultPt[iBinCorrZPv][iBinCorrMult].push_front(trigger.pt()); - savedTriggersZPvMultPhi[iBinCorrZPv][iBinCorrMult].push_front(trigger.phi()); - savedTriggersZPvMultEta[iBinCorrZPv][iBinCorrMult].push_front(trigger.eta()); - if (static_cast(savedTriggersZPvMultPt[iBinCorrZPv][iBinCorrMult].size()) > nTriggerSavedForMixing) { - savedTriggersZPvMultPt[iBinCorrZPv][iBinCorrMult].pop_back(); - savedTriggersZPvMultPhi[iBinCorrZPv][iBinCorrMult].pop_back(); - savedTriggersZPvMultEta[iBinCorrZPv][iBinCorrMult].pop_back(); - } - } + getInvEff(trigger.pt())); - // trigger event info - if (collision.trigEv()) { - histos.fill(HIST("reco/info/h2_zPvMult_trigEv"), collision.posZ(), collision.multNTracksGlobal()); - histos.fill(HIST("reco/info/h1_occupancy_trigEv"), collision.trackOccupancyInTimeRange()); + // save trigger for mixing + mixingTriggerMemoryReco.saveTrigger(trigger.pt(), trigger.phi(), trigger.eta(), collision.posZ(), collision.nGlobalTracks()); } } } PROCESS_SWITCH(PhotonChargedTriggerCorrelation, processCorrFirst, "process to gather info before correlation processes", false); - void processCorrHadron(CorrCollision const& collision, aod::Triggers const& triggers, aod::Hadrons const& hadrons) + void processCorrHadron(CorrCollisions const& collisions, aod::Triggers const& triggers, aod::Hadrons const& hadrons) { - // event selection - if (!collision.selEv()) - return; + size_t const nTriggersThisDataFrame = triggers.size(); - auto const funcPlain = [this]([[maybe_unused]] auto const& collision, auto const& associated) { - histos.fill(HIST("reco/plain/h3_ptPhiEta_hadron"), - associated.pt(), associated.phi(), associated.eta(), - getInvEff(associated.pt())); - }; - corrProcessPlain(collision, hadrons, funcPlain); + for (auto const& collision : collisions) { + // event selection + if (!collision.selEv()) + continue; - auto const funcCorrelation = [this](auto const& collision, auto const& trigger, auto const& associated) { - // exclude self correlation - if (trigger.jetTrackId() == associated.jetTrackId()) - return; + // group collision + auto const triggersThisEvent = triggers.sliceBy(perColTriggers, collision.globalIndex()); + auto const hadronsThisEvent = hadrons.sliceBy(perColHadrons, collision.globalIndex()); - histos.fill(HIST("reco/corr/h3_ptPhiEta_assoc_hadron"), - associated.pt(), associated.phi(), associated.eta(), - getInvEff(trigger.pt()) * getInvEff(associated.pt())); - histos.fill(HIST("reco/corr/h6_corr_hadron"), - getDeltaPhi(trigger.phi(), associated.phi()), - trigger.eta() - associated.eta(), - trigger.pt(), associated.pt(), collision.posZ(), collision.multNTracksGlobal(), - getInvEff(trigger.pt()) * getInvEff(associated.pt())); - }; - corrProcessCorrelation(collision, triggers, hadrons, funcCorrelation); - - auto const funcMixing = [this](auto const& collision, - float const mixingTriggerPt, float const mixingTriggerPhi, float const mixingTriggerEta, auto const& associated, auto const perTriggerWeight) { - histos.fill(HIST("reco/corr/h6_mix_hadron"), - getDeltaPhi(mixingTriggerPhi, associated.phi()), - mixingTriggerEta - associated.eta(), - mixingTriggerPt, associated.pt(), collision.posZ(), collision.multNTracksGlobal(), - perTriggerWeight * getInvEff(mixingTriggerPt) * getInvEff(associated.pt())); - }; - corrProcessMixing(collision, hadrons, funcMixing, nTriggerMixingHadron); + auto const funcPlain = [this]([[maybe_unused]] auto const& collision, auto const& associated) { + histos.fill(HIST("reco/plain/h3_ptPhiEta_hadron"), + associated.pt(), associated.phi(), associated.eta(), + getInvEff(associated.pt())); + }; + corrProcessPlain(collision, hadronsThisEvent, funcPlain); + + auto const funcCorrelation = [this](auto const& collision, auto const& trigger, auto const& associated) { + // exclude self correlation + if (trigger.jetTrackId() == associated.jetTrackId()) + return; + + histos.fill(HIST("reco/corr/h3_ptPhiEta_assoc_hadron"), + associated.pt(), associated.phi(), associated.eta(), + getInvEff(trigger.pt()) * getInvEff(associated.pt())); + histos.fill(HIST("reco/corr/h6_corr_hadron"), + getDeltaPhi(trigger.phi(), associated.phi()), + trigger.eta() - associated.eta(), + trigger.pt(), associated.pt(), collision.posZ(), collision.nGlobalTracks(), + getInvEff(trigger.pt()) * getInvEff(associated.pt())); + }; + corrProcessCorrelation(collision, triggersThisEvent, hadronsThisEvent, funcCorrelation); + + auto const funcMixing = [this](auto const& collision, + float const mixingTriggerPt, float const mixingTriggerPhi, float const mixingTriggerEta, auto const& associated, auto const perTriggerWeight) { + histos.fill(HIST("reco/corr/h6_mix_hadron"), + getDeltaPhi(mixingTriggerPhi, associated.phi()), + mixingTriggerEta - associated.eta(), + mixingTriggerPt, associated.pt(), collision.posZ(), collision.nGlobalTracks(), + perTriggerWeight * getInvEff(mixingTriggerPt) * getInvEff(associated.pt())); + }; + corrProcessMixing(collision, hadronsThisEvent, funcMixing, nTriggerMixingHadron, nTriggersThisDataFrame); + } } PROCESS_SWITCH(PhotonChargedTriggerCorrelation, processCorrHadron, "process standard correlation for associated hardons", false); - void processCorrPipm(CorrCollision const& collision, aod::Triggers const& triggers, aod::Pipms const& pipms) + void processCorrPipm(CorrCollisions const& collisions, aod::Triggers const& triggers, aod::Pipms const& pipms) { - // event selection - if (!collision.selEv()) - return; - - auto const funcPlain = [this]([[maybe_unused]] auto const& collision, auto const& associated) { - histos.fill(HIST("reco/plain/h3_ptPhiEta_pipm"), - associated.pt(), associated.phi(), associated.eta(), - getInvEff(associated.pt())); - }; - corrProcessPlain(collision, pipms, funcPlain); + size_t const nTriggersThisDataFrame = triggers.size(); - auto const funcCorrelation = [this](auto const& collision, auto const& trigger, auto const& associated) { - // exclude self correlation - if (trigger.jetTrackId() == associated.jetTrackId()) - return; + for (auto const& collision : collisions) { + // event selection + if (!collision.selEv()) + continue; - histos.fill(HIST("reco/corr/h3_ptPhiEta_assoc_pipm"), - associated.pt(), associated.phi(), associated.eta(), - getInvEff(trigger.pt()) * getInvEff(associated.pt())); - histos.fill(HIST("reco/corr/h6_corr_pipm"), - getDeltaPhi(trigger.phi(), associated.phi()), - trigger.eta() - associated.eta(), - trigger.pt(), associated.pt(), collision.posZ(), collision.multNTracksGlobal(), - getInvEff(trigger.pt()) * getInvEff(associated.pt())); - }; - corrProcessCorrelation(collision, triggers, pipms, funcCorrelation); - - auto const funcMixing = [this](auto const& collision, - float const mixingTriggerPt, float const mixingTriggerPhi, float const mixingTriggerEta, auto const& associated, auto const perTriggerWeight) { - histos.fill(HIST("reco/corr/h6_mix_pipm"), - getDeltaPhi(mixingTriggerPhi, associated.phi()), - mixingTriggerEta - associated.eta(), - mixingTriggerPt, associated.pt(), collision.posZ(), collision.multNTracksGlobal(), - perTriggerWeight * getInvEff(mixingTriggerPt) * getInvEff(associated.pt())); - }; - corrProcessMixing(collision, pipms, funcMixing, nTriggerMixingPipm); - } - PROCESS_SWITCH(PhotonChargedTriggerCorrelation, processCorrPipm, "process standard correlation for associated pipm", false); + // group collision + auto const triggersThisEvent = triggers.sliceBy(perColTriggers, collision.globalIndex()); + auto const pipmsThisEvent = pipms.sliceBy(perColPipms, collision.globalIndex()); - void processCorrPhotonPCM(CorrCollision const& collision, aod::Triggers const& triggers, aod::PhotonPCMs const& photonPCMs) - { - // event selection - if (!collision.selEv()) - return; + auto const funcPlain = [this]([[maybe_unused]] auto const& collision, auto const& associated) { + histos.fill(HIST("reco/plain/h3_ptPhiEta_pipm"), + associated.pt(), associated.phi(), associated.eta(), + getInvEff(associated.pt())); + }; + corrProcessPlain(collision, pipmsThisEvent, funcPlain); - auto const funcPlain = [this]([[maybe_unused]] auto const& collision, auto const& associated) { - histos.fill(HIST("reco/plain/h3_ptPhiEta_photonPCM"), - associated.pt(), associated.phi(), associated.eta(), - getInvEff(associated.pt())); - }; - corrProcessPlain(collision, photonPCMs, funcPlain); + auto const funcCorrelation = [this](auto const& collision, auto const& trigger, auto const& associated) { + // exclude self correlation + if (trigger.jetTrackId() == associated.jetTrackId()) + return; - auto const funcCorrelation = [this](auto const& collision, auto const& trigger, auto const& associated) { - // exclude self correlation - if (trigger.jetTrackId() == associated.posTrackId() || trigger.jetTrackId() == associated.negTrackId()) - return; + histos.fill(HIST("reco/corr/h3_ptPhiEta_assoc_pipm"), + associated.pt(), associated.phi(), associated.eta(), + getInvEff(trigger.pt()) * getInvEff(associated.pt())); + histos.fill(HIST("reco/corr/h6_corr_pipm"), + getDeltaPhi(trigger.phi(), associated.phi()), + trigger.eta() - associated.eta(), + trigger.pt(), associated.pt(), collision.posZ(), collision.nGlobalTracks(), + getInvEff(trigger.pt()) * getInvEff(associated.pt())); + }; + corrProcessCorrelation(collision, triggersThisEvent, pipmsThisEvent, funcCorrelation); - histos.fill(HIST("reco/corr/h3_ptPhiEta_assoc_photonPCM"), - associated.pt(), associated.phi(), associated.eta(), - getInvEff(trigger.pt()) * getInvEff(associated.pt())); - histos.fill(HIST("reco/corr/h6_corr_photonPCM"), - getDeltaPhi(trigger.phi(), associated.phi()), - trigger.eta() - associated.eta(), - trigger.pt(), associated.pt(), collision.posZ(), collision.multNTracksGlobal(), - getInvEff(trigger.pt()) * getInvEff(associated.pt())); - }; - corrProcessCorrelation(collision, triggers, photonPCMs, funcCorrelation); - - auto const funcMixing = [this](auto const& collision, - float const mixingTriggerPt, float const mixingTriggerPhi, float const mixingTriggerEta, auto const& associated, auto const perTriggerWeight) { - histos.fill(HIST("reco/corr/h6_mix_photonPCM"), - getDeltaPhi(mixingTriggerPhi, associated.phi()), - mixingTriggerEta - associated.eta(), - mixingTriggerPt, associated.pt(), collision.posZ(), collision.multNTracksGlobal(), - perTriggerWeight * getInvEff(mixingTriggerPt) * getInvEff(associated.pt())); - }; - corrProcessMixing(collision, photonPCMs, funcMixing, nTriggerMixingPhotonPCM); + auto const funcMixing = [this](auto const& collision, + float const mixingTriggerPt, float const mixingTriggerPhi, float const mixingTriggerEta, auto const& associated, auto const perTriggerWeight) { + histos.fill(HIST("reco/corr/h6_mix_pipm"), + getDeltaPhi(mixingTriggerPhi, associated.phi()), + mixingTriggerEta - associated.eta(), + mixingTriggerPt, associated.pt(), collision.posZ(), collision.nGlobalTracks(), + perTriggerWeight * getInvEff(mixingTriggerPt) * getInvEff(associated.pt())); + }; + corrProcessMixing(collision, pipmsThisEvent, funcMixing, nTriggerMixingPipm, nTriggersThisDataFrame); + } } - PROCESS_SWITCH(PhotonChargedTriggerCorrelation, processCorrPhotonPCM, "process standard correlation for associated photonPCM", false); + PROCESS_SWITCH(PhotonChargedTriggerCorrelation, processCorrPipm, "process standard correlation for associated pipm", false); - void processCorrPi0PCM(CorrCollision const& collision, aod::Triggers const& triggers, aod::PhotonPCMPairs const& photonPCMPairs) + void processCorrPhotonPCM(CorrCollisions const& collisions, aod::Triggers const& triggers, aod::PhotonPCMs const& photonPCMs) { - // event selection - if (!collision.selEv()) - return; + size_t const nTriggersThisDataFrame = triggers.size(); - auto const funcPlain = [this](auto const& collision, auto const& associated) { - histos.fill(HIST("reco/plain/h4_ptMggZPvMult_photonPCMPair"), associated.pt(), associated.mgg(), collision.posZ(), collision.multNTracksGlobal()); - // pi0 mass range - if (associated.mgg() > pi0PCMMassRange.value[0] && associated.mgg() < pi0PCMMassRange.value[1]) { - histos.fill(HIST("reco/plain/h3_ptPhiEta_pi0PCMPeak"), associated.pt(), associated.phi(), associated.eta()); - } - }; - corrProcessPlain(collision, photonPCMPairs, funcPlain); + for (auto const& collision : collisions) { + // event selection + if (!collision.selEv()) + continue; - auto const funcCorrelation = [this](auto const& collision, auto const& trigger, auto const& associated) { - // exclude self correlation - if (trigger.jetTrackId() == associated.posTrack1Id() || trigger.jetTrackId() == associated.negTrack1Id() || - trigger.jetTrackId() == associated.negTrack2Id() || trigger.jetTrackId() == associated.posTrack2Id()) - return; + // group collision + auto const triggersThisEvent = triggers.sliceBy(perColTriggers, collision.globalIndex()); + auto const photonPCMsThisEvent = photonPCMs.sliceBy(perColPhotonPCMs, collision.globalIndex()); + + auto const funcPlain = [this]([[maybe_unused]] auto const& collision, auto const& associated) { + histos.fill(HIST("reco/plain/h3_ptPhiEta_photonPCM"), + associated.pt(), associated.phi(), associated.eta(), + getInvEff(associated.pt())); + }; + corrProcessPlain(collision, photonPCMsThisEvent, funcPlain); - histos.fill(HIST("reco/corr/h4_ptMggZPvMult_assoc_photonPCMPair"), - associated.pt(), associated.mgg(), collision.posZ(), collision.multNTracksGlobal(), - getInvEff(trigger.pt())); + auto const funcCorrelation = [this](auto const& collision, auto const& trigger, auto const& associated) { + // exclude self correlation + if (trigger.jetTrackId() == associated.posTrackId() || trigger.jetTrackId() == associated.negTrackId()) + return; - if (associated.mgg() > pi0PCMMassRange.value[0] && associated.mgg() < pi0PCMMassRange.value[1]) { - // pi0 mass range - histos.fill(HIST("reco/corr/h3_ptPhiEta_assoc_pi0PCMPeak"), + histos.fill(HIST("reco/corr/h3_ptPhiEta_assoc_photonPCM"), associated.pt(), associated.phi(), associated.eta(), - getInvEff(trigger.pt())); - histos.fill(HIST("reco/corr/h6_corr_pi0PCMPeak"), - getDeltaPhi(trigger.phi(), associated.phi()), - trigger.eta() - associated.eta(), - trigger.pt(), associated.pt(), collision.posZ(), collision.multNTracksGlobal(), - getInvEff(trigger.pt())); - } else if (associated.mgg() > pi0PCMSideMassRange.value[0] && associated.mgg() < pi0PCMSideMassRange.value[1]) { - // pi0 mass side range - histos.fill(HIST("reco/corr/h6_corr_pi0PCMSide"), + getInvEff(trigger.pt()) * getInvEff(associated.pt())); + histos.fill(HIST("reco/corr/h6_corr_photonPCM"), getDeltaPhi(trigger.phi(), associated.phi()), trigger.eta() - associated.eta(), - trigger.pt(), associated.pt(), collision.posZ(), collision.multNTracksGlobal(), - getInvEff(trigger.pt())); - } - }; - corrProcessCorrelation(collision, triggers, photonPCMPairs, funcCorrelation); + trigger.pt(), associated.pt(), collision.posZ(), collision.nGlobalTracks(), + getInvEff(trigger.pt()) * getInvEff(associated.pt())); + }; + corrProcessCorrelation(collision, triggersThisEvent, photonPCMsThisEvent, funcCorrelation); - auto const funcMixing = [this](auto const& collision, - float const mixingTriggerPt, float const mixingTriggerPhi, float const mixingTriggerEta, auto const& associated, auto const perTriggerWeight) { - if (associated.mgg() > pi0PCMMassRange.value[0] && associated.mgg() < pi0PCMMassRange.value[1]) { - // pi0 mass range - histos.fill(HIST("reco/corr/h6_mix_pi0PCMPeak"), - getDeltaPhi(mixingTriggerPhi, associated.phi()), - mixingTriggerEta - associated.eta(), - mixingTriggerPt, associated.pt(), collision.posZ(), collision.multNTracksGlobal(), - perTriggerWeight * getInvEff(mixingTriggerPt)); - } else if (associated.mgg() > pi0PCMSideMassRange.value[0] && associated.mgg() < pi0PCMSideMassRange.value[1]) { - // pi0 mass side range - histos.fill(HIST("reco/corr/h6_mix_pi0PCMSide"), + auto const funcMixing = [this](auto const& collision, + float const mixingTriggerPt, float const mixingTriggerPhi, float const mixingTriggerEta, auto const& associated, auto const perTriggerWeight) { + histos.fill(HIST("reco/corr/h6_mix_photonPCM"), getDeltaPhi(mixingTriggerPhi, associated.phi()), mixingTriggerEta - associated.eta(), - mixingTriggerPt, associated.pt(), collision.posZ(), collision.multNTracksGlobal(), - perTriggerWeight * getInvEff(mixingTriggerPt)); - } - }; - corrProcessMixing(collision, photonPCMPairs, funcMixing, nTriggerMixingPi0PCM); + mixingTriggerPt, associated.pt(), collision.posZ(), collision.nGlobalTracks(), + perTriggerWeight * getInvEff(mixingTriggerPt) * getInvEff(associated.pt())); + }; + corrProcessMixing(collision, photonPCMsThisEvent, funcMixing, nTriggerMixingPhotonPCM, nTriggersThisDataFrame); + } } - PROCESS_SWITCH(PhotonChargedTriggerCorrelation, processCorrPi0PCM, "process standard correlation for associated pi0PCM", false); + PROCESS_SWITCH(PhotonChargedTriggerCorrelation, processCorrPhotonPCM, "process standard correlation for associated photonPCM", false); - void processCorrPi0PCMMix(CorrCollisions const& collisions, aod::PhotonPCMs const& photonPCMs) + void processCorrPhotonPCMPair(CorrCollisions const& collisions, aod::Triggers const& triggers, aod::PhotonPCMPairs const& photonPCMPairs) + { + size_t const nTriggersThisDataFrame = triggers.size(); + + for (auto const& collision : collisions) { + // event selection + if (!collision.selEv()) + continue; + + // group collision + auto const triggersThisEvent = triggers.sliceBy(perColTriggers, collision.globalIndex()); + auto const photonPCMPairsThisEvent = photonPCMPairs.sliceBy(perColPhotonPCMPairs, collision.globalIndex()); + + auto const funcPlain = [this](auto const& collision, auto const& associated) { + histos.fill(HIST("reco/plain/h4_ptMggZPvMult_photonPCMPair"), associated.pt(), associated.mgg(), collision.posZ(), collision.nGlobalTracks()); + }; + corrProcessPlain(collision, photonPCMPairsThisEvent, funcPlain); + + auto const funcPlainTrigEv = [this](auto const& collision, auto const& associated) { + histos.fill(HIST("reco/plain/h4_ptMggZPvMult_trigEv_photonPCMPair"), associated.pt(), associated.mgg(), collision.posZ(), collision.nGlobalTracks()); + }; + if (collision.trigEv()) + corrProcessPlain(collision, photonPCMPairsThisEvent, funcPlainTrigEv); + + auto const funcCorrelation = [this](auto const& collision, auto const& trigger, auto const& associated) { + // exclude self correlation + if (trigger.jetTrackId() == associated.posTrack1Id() || trigger.jetTrackId() == associated.negTrack1Id() || + trigger.jetTrackId() == associated.negTrack2Id() || trigger.jetTrackId() == associated.posTrack2Id()) + return; + + histos.fill(HIST("reco/corr/h5_ptTrigPtAssocMggZPvMult_assoc_photonPCMPair"), + trigger.pt(), associated.pt(), associated.mgg(), collision.posZ(), collision.nGlobalTracks(), + getInvEff(trigger.pt())); + + // pi0 + if (checkMassRange(associated.mgg())) { + histos.fill(HIST("reco/corr/h3_ptPhiEta_assoc_pi0PCMPeak"), + associated.pt(), associated.phi(), associated.eta(), + getInvEff(trigger.pt())); + histos.fill(HIST("reco/corr/h6_corr_pi0PCMPeak"), + getDeltaPhi(trigger.phi(), associated.phi()), + trigger.eta() - associated.eta(), + trigger.pt(), associated.pt(), collision.posZ(), collision.nGlobalTracks(), + getInvEff(trigger.pt())); + return; + } + if (checkMassRange(associated.mgg())) { + histos.fill(HIST("reco/corr/h3_ptPhiEta_assoc_pi0PCMSide"), + associated.pt(), associated.phi(), associated.eta(), + getInvEff(trigger.pt())); + histos.fill(HIST("reco/corr/h6_corr_pi0PCMSide"), + getDeltaPhi(trigger.phi(), associated.phi()), + trigger.eta() - associated.eta(), + trigger.pt(), associated.pt(), collision.posZ(), collision.nGlobalTracks(), + getInvEff(trigger.pt())); + return; + } + // eta + if (checkMassRange(associated.mgg())) { + histos.fill(HIST("reco/corr/h3_ptPhiEta_assoc_etaPCMPeak"), + associated.pt(), associated.phi(), associated.eta(), + getInvEff(trigger.pt())); + histos.fill(HIST("reco/corr/h6_corr_etaPCMPeak"), + getDeltaPhi(trigger.phi(), associated.phi()), + trigger.eta() - associated.eta(), + trigger.pt(), associated.pt(), collision.posZ(), collision.nGlobalTracks(), + getInvEff(trigger.pt())); + return; + } + if (checkMassRange(associated.mgg())) { + histos.fill(HIST("reco/corr/h3_ptPhiEta_assoc_etaPCMSide"), + associated.pt(), associated.phi(), associated.eta(), + getInvEff(trigger.pt())); + histos.fill(HIST("reco/corr/h6_corr_etaPCMSide"), + getDeltaPhi(trigger.phi(), associated.phi()), + trigger.eta() - associated.eta(), + trigger.pt(), associated.pt(), collision.posZ(), collision.nGlobalTracks(), + getInvEff(trigger.pt())); + return; + } + }; + corrProcessCorrelation(collision, triggersThisEvent, photonPCMPairsThisEvent, funcCorrelation); + + auto const funcMixing = [this](auto const& collision, + float const mixingTriggerPt, float const mixingTriggerPhi, float const mixingTriggerEta, auto const& associated, auto const perTriggerWeight) { + // pi0 + if (checkMassRange(associated.mgg())) { + histos.fill(HIST("reco/corr/h6_mix_pi0PCMPeak"), + getDeltaPhi(mixingTriggerPhi, associated.phi()), + mixingTriggerEta - associated.eta(), + mixingTriggerPt, associated.pt(), collision.posZ(), collision.nGlobalTracks(), + perTriggerWeight * getInvEff(mixingTriggerPt)); + return; + } + if (checkMassRange(associated.mgg())) { + histos.fill(HIST("reco/corr/h6_mix_pi0PCMSide"), + getDeltaPhi(mixingTriggerPhi, associated.phi()), + mixingTriggerEta - associated.eta(), + mixingTriggerPt, associated.pt(), collision.posZ(), collision.nGlobalTracks(), + perTriggerWeight * getInvEff(mixingTriggerPt)); + return; + } + // eta + if (checkMassRange(associated.mgg())) { + histos.fill(HIST("reco/corr/h6_mix_etaPCMPeak"), + getDeltaPhi(mixingTriggerPhi, associated.phi()), + mixingTriggerEta - associated.eta(), + mixingTriggerPt, associated.pt(), collision.posZ(), collision.nGlobalTracks(), + perTriggerWeight * getInvEff(mixingTriggerPt)); + return; + } + if (checkMassRange(associated.mgg())) { + histos.fill(HIST("reco/corr/h6_mix_etaPCMSide"), + getDeltaPhi(mixingTriggerPhi, associated.phi()), + mixingTriggerEta - associated.eta(), + mixingTriggerPt, associated.pt(), collision.posZ(), collision.nGlobalTracks(), + perTriggerWeight * getInvEff(mixingTriggerPt)); + return; + } + }; + corrProcessMixing(collision, photonPCMPairsThisEvent, funcMixing, nTriggerMixingH0PCM, nTriggersThisDataFrame); + } + } + PROCESS_SWITCH(PhotonChargedTriggerCorrelation, processCorrPhotonPCMPair, "process standard correlation for associated pi0PCM", false); + + void processCorrPhotonPCMPairMix(CorrCollisions const& collisions, aod::PhotonPCMs const& photonPCMs) { auto photonPCMsTuple = std::make_tuple(photonPCMs); - SameKindPair pairs{binningZPvMult, nNeighboursMixingPi0PCMPair, -1, collisions, photonPCMsTuple, &cache}; + SameKindPair pairs{binningZPvMult, nNeighboursMixingPhotonPCMPair, -1, collisions, photonPCMsTuple, &cache}; // mixed events for (auto pair = pairs.begin(); pair != pairs.end(); pair++) { @@ -1180,249 +1064,275 @@ struct PhotonChargedTriggerCorrelation { // if (checkSameBin(collision1.posZ(), collision2.posZ(), binsZPv) == -1) { // std::printf("ERROR: zPv bins do not match\n"); continue; // } - // if (checkSameBin(collision1.multNTracksGlobal(), collision2.multNTracksGlobal(), binsMult) == -1) { + // if (checkSameBin(collision1.nGlobalTracks(), collision2.nGlobalTracks(), binsMult) == -1) { // std::printf("ERROR: multiplicity bins do not match\n"); continue; // } // event selection - if (!collision1.selEv()) - continue; - if (!collision2.selEv()) + if (!collision1.selEv() || !collision2.selEv()) continue; - // event info - histos.fill(HIST("reco/plain/h2_zPvMult_photonPCMPair_evMix"), collision1.posZ(), collision1.multNTracksGlobal()); + histos.fill(HIST("reco/plain/h2_zPvMult_photonPCMPair_evMix"), collision1.posZ(), collision1.nGlobalTracks()); + // mixing loop + for (auto const& [photonPCM1, photonPCM2] : soa::combinations(soa::CombinationsFullIndexPolicy(photonPCMs1, photonPCMs2))) { + ROOT::Math::PtEtaPhiMVector const p4photonPCM1(photonPCM1.pt(), photonPCM1.eta(), photonPCM1.phi(), 0.); + ROOT::Math::PtEtaPhiMVector const p4photonPCM2(photonPCM2.pt(), photonPCM2.eta(), photonPCM2.phi(), 0.); + ROOT::Math::PtEtaPhiMVector const p4photonPCMPair = p4photonPCM1 + p4photonPCM2; + + histos.fill(HIST("reco/plain/h4_ptMggZPvMult_photonPCMPair_evMix"), p4photonPCMPair.pt(), p4photonPCMPair.M(), collision1.posZ(), collision1.nGlobalTracks()); + } + // trigger events + if (!collision1.trigEv() || !collision2.trigEv()) + continue; // mixing loop for (auto const& [photonPCM1, photonPCM2] : soa::combinations(soa::CombinationsFullIndexPolicy(photonPCMs1, photonPCMs2))) { ROOT::Math::PtEtaPhiMVector const p4photonPCM1(photonPCM1.pt(), photonPCM1.eta(), photonPCM1.phi(), 0.); ROOT::Math::PtEtaPhiMVector const p4photonPCM2(photonPCM2.pt(), photonPCM2.eta(), photonPCM2.phi(), 0.); ROOT::Math::PtEtaPhiMVector const p4photonPCMPair = p4photonPCM1 + p4photonPCM2; - // plain - histos.fill(HIST("reco/plain/h4_ptMggZPvMult_photonPCMPair_evMix"), p4photonPCMPair.pt(), p4photonPCMPair.M(), collision1.posZ(), collision1.multNTracksGlobal()); - // pi0 mass range - if (p4photonPCMPair.M() > pi0PCMMassRange.value[0] && p4photonPCMPair.M() < pi0PCMMassRange.value[1]) { - histos.fill(HIST("reco/plain/h3_ptPhiEta_pi0PCMPeak_evMix"), p4photonPCMPair.pt(), p4photonPCMPair.phi() + constants::math::PI, p4photonPCMPair.eta()); - } + histos.fill(HIST("reco/plain/h4_ptMggZPvMult_trigEv_photonPCMPair_evMix"), p4photonPCMPair.pt(), p4photonPCMPair.M(), collision1.posZ(), collision1.nGlobalTracks()); } } } - PROCESS_SWITCH(PhotonChargedTriggerCorrelation, processCorrPi0PCMMix, "process gamma-gamma mixing for photonPCM", false); + PROCESS_SWITCH(PhotonChargedTriggerCorrelation, processCorrPhotonPCMPairMix, "process gamma-gamma mixing for photonPCM", false); // mc /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - void processMcInfo(CorrMcCollision const& mcCollision) + void processMcInfo(CorrMcCollisions const& mcCollisions, CorrMcDCollisions const& collisions) { - // event counter - histos.fill(HIST("mc/info/h1_nEvents_mcTrue"), 0.5); - // trigger events - if (mcCollision.trigEv()) { - histos.fill(HIST("mc/info/h1_nTriggerEvents_mcTrue"), 0.5); - } + for (auto const& mcCollision : mcCollisions) { + // all events + histos.fill(HIST("mc/info/h1_nEvents_mcTrue"), 0.5); + histos.fill(HIST("mc/info/h2_zPvMult_mcTrue"), mcCollision.posZ(), mcCollision.nChargedInEtaRange()); - // QA - histos.fill(HIST("mc/info/h1_zPv_mcTrue"), mcCollision.posZ()); - histos.fill(HIST("mc/info/h1_mult_mcTrue"), mcCollision.multMCNParticlesEta08()); + // trigger events + if (!mcCollision.trigEv()) + continue; + histos.fill(HIST("mc/info/h1_nTrigEv_mcTrue"), 0.5); + histos.fill(HIST("mc/info/h2_zPvMult_trigEv_mcTrue"), mcCollision.posZ(), mcCollision.nChargedInEtaRange()); + } + for (auto const& collision : collisions) { + // event selection + if (!collision.selEv()) + continue; + histos.fill(HIST("mc/info/h1_nRecoCol_mcTrue"), 0.5); + histos.fill(HIST("mc/info/h2_zPvMult_recoCol_mcTrue"), collision.mcCollision_as().posZ(), collision.mcCollision_as().nChargedInEtaRange()); + } } PROCESS_SWITCH(PhotonChargedTriggerCorrelation, processMcInfo, "process general info on mc collisions and tracks for analysis and qa", false); - void processMcTrueCorr(CorrMcCollision const&, aod::TriggerParticles const& triggerParticles, aod::JetParticles const& mcParticles) + // (sad) attempt at reducing code duplication + enum class McCorrEventType : int { True = 0, + RecoColTrue = 1 }; + enum class McCorrCorrelationType : int { Correlation = 0, + Mixing = 1 }; + enum class McCorrAssociatedType : int { Hadron = 0, + Pipm = 1, + Photon = 2, + Pi0 = 3, + Eta = 4 }; + static constexpr const char* McHistPaths[2][2][5] = { + {{"mc/true/corr/h6_corr_hadron", "mc/true/corr/h6_corr_pipm", "mc/true/corr/h6_corr_photon", + "mc/true/corr/h6_corr_pi0", "mc/true/corr/h6_corr_eta"}, + {"mc/true/corr/h6_mix_hadron", "mc/true/corr/h6_mix_pipm", "mc/true/corr/h6_mix_photon", + "mc/true/corr/h6_mix_pi0", "mc/true/corr/h6_mix_eta"}}, + {{"mc/recoCol_true/corr/h6_corr_hadron", "mc/recoCol_true/corr/h6_corr_pipm", "mc/recoCol_true/corr/h6_corr_photon", + "mc/recoCol_true/corr/h6_corr_pi0", "mc/recoCol_true/corr/h6_corr_eta"}, + {"mc/recoCol_true/corr/h6_mix_hadron", "mc/recoCol_true/corr/h6_mix_pipm", "mc/recoCol_true/corr/h6_mix_photon", + "mc/recoCol_true/corr/h6_mix_pi0", "mc/recoCol_true/corr/h6_mix_eta"}}}; + static constexpr const char* getMcHistPath(McCorrEventType eventType, McCorrCorrelationType correlationType, McCorrAssociatedType associatedType) { - // trigger pairing loop - for (auto const& trigger : triggerParticles) { - // trigger info - histos.fill(HIST("mc/true/corr/h3_ptPhiEta_trig"), trigger.pt(), trigger.phi(), trigger.eta()); + return McHistPaths[static_cast(eventType)][static_cast(correlationType)][static_cast(associatedType)]; + } - // hadrons (tracks) and pipm - for (auto const& associated : mcParticles) { - // exclude self correlation - if (trigger.jetMcParticleId() == associated.globalIndex()) - continue; + // fill mc correaltion histograms based on given associated mc particle + template + void fillMcCorrHists(auto const& mcCollision, auto const& trigger, auto const& associated, double const weight) + { + // standard particles (marked physical primary) + if (checkPrimaryEtaMc(associated)) { + // charged primary ('hadron') selection + if (checkChargedMc(associated)) { + histos.fill(HIST(getMcHistPath(eventType, correlationType, McCorrAssociatedType::Hadron)), + getDeltaPhi(trigger.phi(), associated.phi()), + trigger.eta() - associated.eta(), + trigger.pt(), associated.pt(), mcCollision.posZ(), mcCollision.nChargedInEtaRange(), + weight); + } + // pipm selection + if (std::abs(associated.pdgCode()) == PDG_t::kPiPlus) { + histos.fill(HIST(getMcHistPath(eventType, correlationType, McCorrAssociatedType::Pipm)), + getDeltaPhi(trigger.phi(), associated.phi()), + trigger.eta() - associated.eta(), + trigger.pt(), associated.pt(), mcCollision.posZ(), mcCollision.nChargedInEtaRange(), + weight); + return; + } + // photon selection + if (associated.pdgCode() == PDG_t::kGamma) { + histos.fill(HIST(getMcHistPath(eventType, correlationType, McCorrAssociatedType::Photon)), + getDeltaPhi(trigger.phi(), associated.phi()), + trigger.eta() - associated.eta(), + trigger.pt(), associated.pt(), mcCollision.posZ(), mcCollision.nChargedInEtaRange(), + weight); + return; + } + return; + } + // decaying particles (not marked physical primary) + if ((std::abs(associated.eta()) < etaMax)) { + // pi0 selection + if (checkH0Primary(associated, PDG_t::kPi0)) { + histos.fill(HIST(getMcHistPath(eventType, correlationType, McCorrAssociatedType::Pi0)), + getDeltaPhi(trigger.phi(), associated.phi()), + trigger.eta() - associated.eta(), + trigger.pt(), associated.pt(), mcCollision.posZ(), mcCollision.nChargedInEtaRange(), + weight); + return; + } + // eta selection + if (checkH0Primary(associated, 221)) { + histos.fill(HIST(getMcHistPath(eventType, correlationType, McCorrAssociatedType::Eta)), + getDeltaPhi(trigger.phi(), associated.phi()), + trigger.eta() - associated.eta(), + trigger.pt(), associated.pt(), mcCollision.posZ(), mcCollision.nChargedInEtaRange(), + weight); + return; + } + } + } - // standard particles (marked physical primary) - if (checkPrimaryEtaMc(associated)) { - // charged primary ('hadron') selection - if (checkChargedMc(associated)) { - histos.fill(HIST("mc/true/corr/h3_ptPhiEta_assoc_hadron"), associated.pt(), associated.phi(), associated.eta()); - histos.fill(HIST("mc/true/corr/h4_corr_hadron"), - getDeltaPhi(trigger.phi(), associated.phi()), - trigger.eta() - associated.eta(), - trigger.pt(), associated.pt()); - } - - // pipm selection - if (std::abs(associated.pdgCode()) == PDG_t::kPiPlus) { - histos.fill(HIST("mc/true/corr/h3_ptPhiEta_assoc_pipm"), associated.pt(), associated.phi(), associated.eta()); - histos.fill(HIST("mc/true/corr/h4_corr_pipm"), - getDeltaPhi(trigger.phi(), associated.phi()), - trigger.eta() - associated.eta(), - trigger.pt(), associated.pt()); - } - - // photon selection - if (associated.pdgCode() == PDG_t::kGamma) { - histos.fill(HIST("mc/true/corr/h3_ptPhiEta_assoc_photon"), associated.pt(), associated.phi(), associated.eta()); - histos.fill(HIST("mc/true/corr/h4_corr_photon"), - getDeltaPhi(trigger.phi(), associated.phi()), - trigger.eta() - associated.eta(), - trigger.pt(), associated.pt()); - } - } + void processMcTrueCorr(CorrMcCollisions const& mcCollisions, aod::TriggerParticles const& triggerParticles, aod::JetParticles const& mcParticles) + { + for (auto const& mcCollision : mcCollisions) { + // group collision + auto const triggerParticlesThisEvent = triggerParticles.sliceBy(perColTriggerParticles, mcCollision.globalIndex()); + auto const mcParticlesThisEvent = mcParticles.sliceBy(perColMcParticles, mcCollision.globalIndex()); + + // trigger pairing loop + for (auto const& trigger : triggerParticlesThisEvent) { + // trigger info + histos.fill(HIST("mc/true/corr/h3_ptPhiEta_trig"), trigger.pt(), trigger.phi(), trigger.eta()); + + // save trigger for mixing + mixingTriggerMemoryTrue.saveTrigger(trigger.pt(), trigger.phi(), trigger.eta(), mcCollision.posZ(), mcCollision.nChargedInEtaRange()); - // decaying particles (not marked physical primary) - if ((std::abs(associated.eta()) < etaMax)) { - // pi0 selection - if (checkPi0ToGG(associated)) { - histos.fill(HIST("mc/true/corr/h3_ptPhiEta_assoc_pi0"), associated.pt(), associated.phi(), associated.eta()); - histos.fill(HIST("mc/true/corr/h4_corr_pi0"), - getDeltaPhi(trigger.phi(), associated.phi()), - trigger.eta() - associated.eta(), - trigger.pt(), associated.pt()); - } + for (auto const& associated : mcParticlesThisEvent) { + // exclude self correlation + if (trigger.jetMcParticleId() == associated.globalIndex()) + continue; + + fillMcCorrHists(mcCollision, trigger, associated, 1); } } } } PROCESS_SWITCH(PhotonChargedTriggerCorrelation, processMcTrueCorr, "process mc-true (all collisions) correlation for multiple associated particles", false); - void processMcTrueRecoColCorr(CorrMcDCollision const& collision, aod::JetMcCollisions const&, aod::TriggerParticles const& triggerParticles, aod::JetParticles const& mcParticles) + void processMcTrueMix(CorrMcCollisions const& mcCollisions, aod::TriggerParticles const& triggerParticles, aod::JetParticles const& mcParticles) { - // event selection - if (!collision.selEv()) - return; + for (auto const& mcCollision : mcCollisions) { + // group collision + auto const triggerParticlesThisEvent = triggerParticles.sliceBy(perColTriggerParticles, mcCollision.globalIndex()); + auto const mcParticlesThisEvent = mcParticles.sliceBy(perColMcParticles, mcCollision.globalIndex()); - // group collision - auto const triggerParticlesThisEvent = triggerParticles.sliceBy(perColTriggerParticles, collision.mcCollisionId()); - auto const mcParticlesThisEvent = mcParticles.sliceBy(perColMcParticles, collision.mcCollisionId()); + const size_t nTriggerParticlesThisDataFrame = triggerParticles.size(); + auto savedTriggers = mixingTriggerMemoryTrue.getTriggers(mcCollision.posZ(), mcCollision.nChargedInEtaRange()); + const size_t mixUpToTriggerN = std::min(savedTriggers.size(), static_cast(nTriggerMixingMcTrue) + nTriggerParticlesThisDataFrame); + const float perTriggerWeight = 1. / (mixUpToTriggerN - nTriggerParticlesThisDataFrame); - // trigger pairing loop - for (auto const& trigger : triggerParticlesThisEvent) { - // trigger info - histos.fill(HIST("mc/true_reco/corr/h3_ptPhiEta_trig"), trigger.pt(), trigger.phi(), trigger.eta()); + // trigger loop + for (size_t i_mixingTrigger = nTriggerParticlesThisDataFrame; i_mixingTrigger < mixUpToTriggerN; i_mixingTrigger++) { + MixingTrigger const& mixingTrigger = savedTriggers[i_mixingTrigger]; + for (auto const& associated : mcParticlesThisEvent) { + fillMcCorrHists(mcCollision, mixingTrigger, associated, perTriggerWeight); + } + } + } + } + PROCESS_SWITCH(PhotonChargedTriggerCorrelation, processMcTrueMix, "process mc-true (all collisions) correlation mixing for multiple associated particles", false); - // hadrons (tracks) and pipm - for (auto const& associated : mcParticlesThisEvent) { - // exclude self correlation - if (trigger.jetMcParticleId() == associated.globalIndex()) - continue; + void processMcRecoColTrueCorr(CorrMcDCollisions const& collisions, CorrMcCollisions const&, aod::TriggerParticles const& triggerParticles, aod::JetParticles const& mcParticles) + { + for (auto const& collision : collisions) { + // event selection + if (!collision.selEv()) + continue; - // standard particles (marked physical primary) - if (checkPrimaryEtaMc(associated)) { - // charged primary ('hadron') selection - if (checkChargedMc(associated)) { - histos.fill(HIST("mc/true_reco/corr/h3_ptPhiEta_assoc_hadron"), associated.pt(), associated.phi(), associated.eta()); - histos.fill(HIST("mc/true_reco/corr/h4_corr_hadron"), - getDeltaPhi(trigger.phi(), associated.phi()), - trigger.eta() - associated.eta(), - trigger.pt(), associated.pt()); - } - - // pipm selection - if (std::abs(associated.pdgCode()) == PDG_t::kPiPlus) { - histos.fill(HIST("mc/true_reco/corr/h3_ptPhiEta_assoc_pipm"), associated.pt(), associated.phi(), associated.eta()); - histos.fill(HIST("mc/true_reco/corr/h4_corr_pipm"), - getDeltaPhi(trigger.phi(), associated.phi()), - trigger.eta() - associated.eta(), - trigger.pt(), associated.pt()); - } - - // photon selection - if (associated.pdgCode() == PDG_t::kGamma) { - histos.fill(HIST("mc/true_reco/corr/h3_ptPhiEta_assoc_photon"), associated.pt(), associated.phi(), associated.eta()); - histos.fill(HIST("mc/true_reco/corr/h4_corr_photon"), - getDeltaPhi(trigger.phi(), associated.phi()), - trigger.eta() - associated.eta(), - trigger.pt(), associated.pt()); - } - } + // group collision + auto const triggerParticlesThisEvent = triggerParticles.sliceBy(perColTriggerParticles, collision.mcCollisionId()); + auto const mcParticlesThisEvent = mcParticles.sliceBy(perColMcParticles, collision.mcCollisionId()); + + auto const& mcCollision = collision.mcCollision_as(); + + // trigger pairing loop + for (auto const& trigger : triggerParticlesThisEvent) { + // trigger info + histos.fill(HIST("mc/recoCol_true/corr/h3_ptPhiEta_trig"), trigger.pt(), trigger.phi(), trigger.eta()); + + // save trigger for mixing + mixingTriggerMemoryRecoColTrue.saveTrigger(trigger.pt(), trigger.phi(), trigger.eta(), mcCollision.posZ(), mcCollision.nChargedInEtaRange()); - // decaying particles (not marked physical primary) - if ((std::abs(associated.eta()) < etaMax)) { - // pi0 selection - if (checkPi0ToGG(associated)) { - histos.fill(HIST("mc/true_reco/corr/h3_ptPhiEta_assoc_pi0"), associated.pt(), associated.phi(), associated.eta()); - histos.fill(HIST("mc/true_reco/corr/h4_corr_pi0"), - getDeltaPhi(trigger.phi(), associated.phi()), - trigger.eta() - associated.eta(), - trigger.pt(), associated.pt()); - } + // hadrons (tracks) and pipm + for (auto const& associated : mcParticlesThisEvent) { + // exclude self correlation + if (trigger.jetMcParticleId() == associated.globalIndex()) + continue; + + fillMcCorrHists(mcCollision, trigger, associated, 1); } } } } - PROCESS_SWITCH(PhotonChargedTriggerCorrelation, processMcTrueRecoColCorr, "process mc-true (reco collisions) correlation for multiple associated particles", false); + PROCESS_SWITCH(PhotonChargedTriggerCorrelation, processMcRecoColTrueCorr, "process mc-true (reco collisions) correlation for multiple associated particles", false); - void processMcTrueEff(CorrMcCollision const& mcCollision, aod::JetParticles const& mcParticles) + void processMcRecoColTrueMix(CorrMcDCollisions const& collisions, CorrMcCollisions const&, aod::TriggerParticles const& triggerParticles, aod::JetParticles const& mcParticles) { - // event selection - if (doTrigEvEff && !mcCollision.trigEv()) - return; + for (auto const& collision : collisions) { + // event selection + if (!collision.selEv()) + continue; - for (auto const& mcParticle : mcParticles) { - // standard particles (marked physical primary) - if (checkPrimaryEtaMc(mcParticle)) { - // hadrons - if (checkChargedMc(mcParticle)) { - histos.fill(HIST("mc/eff/h3_ptPhiEta_mcTrue_hadron"), mcParticle.pt(), mcParticle.phi(), mcParticle.eta()); - histos.fill(HIST("mc/eff/h3_ptZPvMult_mcTrue_hadron"), mcParticle.pt(), mcCollision.posZ(), mcCollision.multMCNParticlesEta08()); - } - // pipm - if (std::abs(mcParticle.pdgCode()) == PDG_t::kPiPlus) { - histos.fill(HIST("mc/eff/h3_ptPhiEta_mcTrue_pipm"), mcParticle.pt(), mcParticle.phi(), mcParticle.eta()); - histos.fill(HIST("mc/eff/h3_ptZPvMult_mcTrue_pipm"), mcParticle.pt(), mcCollision.posZ(), mcCollision.multMCNParticlesEta08()); - } - // photons - if (mcParticle.pdgCode() == PDG_t::kGamma) { - histos.fill(HIST("mc/eff/h3_ptPhiEta_mcTrue_photon"), mcParticle.pt(), mcParticle.phi(), mcParticle.eta()); - histos.fill(HIST("mc/eff/h3_ptZPvMult_mcTrue_photon"), mcParticle.pt(), mcCollision.posZ(), mcCollision.multMCNParticlesEta08()); - } - } + // group collision + auto const triggerParticlesThisEvent = triggerParticles.sliceBy(perColTriggerParticles, collision.mcCollisionId()); + auto const mcParticlesThisEvent = mcParticles.sliceBy(perColMcParticles, collision.mcCollisionId()); - // decaying particles (not marked physical primary) - if ((std::abs(mcParticle.eta()) < etaMax)) { - // pi0 - if (checkPi0ToGG(mcParticle)) { - histos.fill(HIST("mc/eff/h3_ptPhiEta_mcTrue_pi0"), mcParticle.pt(), mcParticle.phi(), mcParticle.eta()); - histos.fill(HIST("mc/eff/h3_ptZPvMult_mcTrue_pi0"), mcParticle.pt(), mcCollision.posZ(), mcCollision.multMCNParticlesEta08()); + auto const& mcCollision = collision.mcCollision_as(); + + const size_t nTriggerParticlesThisDataFrame = triggerParticles.size(); + auto savedTriggers = mixingTriggerMemoryRecoColTrue.getTriggers(mcCollision.posZ(), mcCollision.nChargedInEtaRange()); + const size_t mixUpToTriggerN = std::min(savedTriggers.size(), static_cast(nTriggerMixingMcTrue) + nTriggerParticlesThisDataFrame); + const float perTriggerWeight = 1. / (mixUpToTriggerN - nTriggerParticlesThisDataFrame); + + // trigger loop + for (size_t i_mixingTrigger = nTriggerParticlesThisDataFrame; i_mixingTrigger < mixUpToTriggerN; i_mixingTrigger++) { + MixingTrigger const& mixingTrigger = savedTriggers[i_mixingTrigger]; + for (auto const& associated : mcParticlesThisEvent) { + fillMcCorrHists(mcCollision, mixingTrigger, associated, perTriggerWeight); } } } } - PROCESS_SWITCH(PhotonChargedTriggerCorrelation, processMcTrueEff, "process MC-true data (all collisions) to calculate efficiencies", false); + PROCESS_SWITCH(PhotonChargedTriggerCorrelation, processMcRecoColTrueMix, "process mc-true (reco collisions) correlation mixing for multiple associated particles", false); - void processMcRecoColEff(CorrMcDCollision const& collision, aod::JetMcCollisions const&, aod::JetTracksMCD const& tracks, - aod::Triggers const& triggers, aod::Hadrons const& hadrons, aod::Pipms const& pipms, - aod::PhotonPCMs const& photonPCMs, aod::PhotonPCMPairs const& photonPCMPairs, - aod::JetParticles const& mcParticles) + void processMcRecoColEff(CorrMcDCollision const& collision, aod::JetTracksMCD const& tracks, + aod::Hadrons const& hadrons, aod::Pipms const& pipms, aod::PhotonPCMs const& photonPCMs, + CorrMcCollisions const&, aod::JetParticles const& mcParticles, aod::TriggerParticles const& triggerParticles) { - int excludeTriggerTrackId = -1; - int excludeTriggerParticleId = -1; - // event selection if (!collision.selEv()) return; - if (doTrigEvEff && !collision.trigEv()) - return; auto const mcParticlesThisEvent = mcParticles.sliceBy(perColMcParticles, collision.mcCollisionId()); - - // random trigger - if (doTrigEvEff) { - std::uniform_int_distribution intDistribution(0, static_cast(triggers.size()) - 1); - auto const& excludeTrigger = triggers.rawIteratorAt(intDistribution(randomEngine)); - if (excludeTrigger.jetTrack_as().has_mcParticle()) { - excludeTriggerParticleId = excludeTrigger.jetTrack_as().mcParticleId(); - excludeTriggerTrackId = excludeTrigger.jetTrack_as().globalIndex(); - } - } + auto const triggerParticlesThisEvent = triggerParticles.sliceBy(perColTriggerParticles, collision.mcCollisionId()); // hadrons for (auto const& hadron : hadrons) { - if (doTrigEvEff && hadron.jetTrackId() == excludeTriggerTrackId) + if (doTrigEvEff && !collision.trigEv() && hadron.pt() < ptCutTrigEvEff) continue; histos.fill(HIST("mc/eff/h3_ptPhiEta_mcReco_hadron"), hadron.pt(), hadron.phi(), hadron.eta()); - histos.fill(HIST("mc/eff/h3_ptZPvMult_mcReco_hadron"), hadron.pt(), collision.posZ(), collision.multNTracksGlobal()); + histos.fill(HIST("mc/eff/h3_ptZPvMult_mcReco_hadron"), hadron.pt(), collision.posZ(), collision.nGlobalTracks()); // purity if (!hadron.jetTrack_as().has_mcParticle()) continue; @@ -1433,15 +1343,15 @@ struct PhotonChargedTriggerCorrelation { continue; histos.fill(HIST("mc/eff/h3_ptPhiEta_mcReco_hasCorrectMc_hadron"), hadron.pt(), hadron.phi(), hadron.eta()); - histos.fill(HIST("mc/eff/h3_ptZPvMult_mcReco_hasCorrectMc_hadron"), hadron.pt(), collision.posZ(), collision.multNTracksGlobal()); + histos.fill(HIST("mc/eff/h3_ptZPvMult_mcReco_hasCorrectMc_hadron"), hadron.pt(), collision.posZ(), collision.nGlobalTracks()); } // pipm for (auto const& pipm : pipms) { - if (doTrigEvEff && pipm.jetTrackId() == excludeTriggerTrackId) + if (doTrigEvEff && !collision.trigEv() && pipm.pt() < ptCutTrigEvEff) continue; histos.fill(HIST("mc/eff/h3_ptPhiEta_mcReco_pipm"), pipm.pt(), pipm.phi(), pipm.eta()); - histos.fill(HIST("mc/eff/h3_ptZPvMult_mcReco_pipm"), pipm.pt(), collision.posZ(), collision.multNTracksGlobal()); + histos.fill(HIST("mc/eff/h3_ptZPvMult_mcReco_pipm"), pipm.pt(), collision.posZ(), collision.nGlobalTracks()); // purity if (!pipm.jetTrack_as().has_mcParticle()) continue; @@ -1452,47 +1362,15 @@ struct PhotonChargedTriggerCorrelation { continue; histos.fill(HIST("mc/eff/h3_ptPhiEta_mcReco_hasCorrectMc_pipm"), pipm.pt(), pipm.phi(), pipm.eta()); - histos.fill(HIST("mc/eff/h3_ptZPvMult_mcReco_hasCorrectMc_pipm"), pipm.pt(), collision.posZ(), collision.multNTracksGlobal()); + histos.fill(HIST("mc/eff/h3_ptZPvMult_mcReco_hasCorrectMc_pipm"), pipm.pt(), collision.posZ(), collision.nGlobalTracks()); } - // photon mc checks - - auto const isConversionPhoton = [&](auto const& posTrack, auto const& negTrack) { - // check same mother - auto const& posMothers = posTrack.mcParticle().template mothers_as(); - auto const& negMothers = negTrack.mcParticle().template mothers_as(); - if (posMothers.size() != 1 || negMothers.size() != 1) - return false; - if (posMothers.begin()->globalIndex() != negMothers.begin()->globalIndex()) - return false; - // check photon - if (posMothers.begin()->pdgCode() != PDG_t::kGamma) - return false; - - return true; - }; - auto const isGGFromPi0 = [&](auto const& posTrack1, auto const& negTrack1, auto const& posTrack2, auto const& negTrack2) { - if (!isConversionPhoton(posTrack1, negTrack1) || !isConversionPhoton(posTrack2, negTrack2)) - return false; - // check same mother - auto const& mothers1 = (*(posTrack1.mcParticle().template mothers_as().begin())).template mothers_as(); - auto const& mothers2 = (*(posTrack2.mcParticle().template mothers_as().begin())).template mothers_as(); - constexpr int NMothersPhotonFromPi0 = 2; // for some reason two mothers (same particle) for pi0 decays (contradicts PYTHIA documentation, but whatever) - if (mothers1.size() != NMothersPhotonFromPi0 || mothers2.size() != NMothersPhotonFromPi0) - return false; - if (mothers1.begin()->globalIndex() != mothers2.begin()->globalIndex()) - return false; - // check pi0 - if (mothers1.begin()->pdgCode() != PDG_t::kPi0) - return false; - - return true; - }; - // photonPCM for (auto const& photonPCM : photonPCMs) { + if (doTrigEvEff && !collision.trigEv()) + continue; histos.fill(HIST("mc/eff/h3_ptPhiEta_mcReco_photonPCM"), photonPCM.pt(), photonPCM.phi(), photonPCM.eta()); - histos.fill(HIST("mc/eff/h3_ptZPvMult_mcReco_photonPCM"), photonPCM.pt(), collision.posZ(), collision.multNTracksGlobal()); + histos.fill(HIST("mc/eff/h3_ptZPvMult_mcReco_photonPCM"), photonPCM.pt(), collision.posZ(), collision.nGlobalTracks()); // purity // (V0Legs does not have the tracks reference as index column (just int)??) @@ -1506,62 +1384,44 @@ struct PhotonChargedTriggerCorrelation { continue; histos.fill(HIST("mc/eff/h3_ptPhiEta_mcReco_hasCorrectMc_photonPCM"), photonPCM.pt(), photonPCM.phi(), photonPCM.eta()); - histos.fill(HIST("mc/eff/h3_ptZPvMult_mcReco_hasCorrectMc_photonPCM"), photonPCM.pt(), collision.posZ(), collision.multNTracksGlobal()); - } - - // pi0PCM - for (auto const& photonPCMPair : photonPCMPairs) { - if (photonPCMPair.mgg() < pi0PCMMassRange.value[0] || photonPCMPair.mgg() > pi0PCMMassRange.value[1]) - continue; - - histos.fill(HIST("mc/eff/h3_ptPhiEta_mcReco_pi0PCM"), photonPCMPair.pt(), photonPCMPair.phi(), photonPCMPair.eta()); - histos.fill(HIST("mc/eff/h3_ptZPvMult_mcReco_pi0PCM"), photonPCMPair.pt(), collision.posZ(), collision.multNTracksGlobal()); - - // purity - auto const& posTrack1 = tracks.rawIteratorAt(photonPCMPair.posTrack1Id() - tracks.offset()); - auto const& negTrack1 = tracks.rawIteratorAt(photonPCMPair.negTrack1Id() - tracks.offset()); - auto const& posTrack2 = tracks.rawIteratorAt(photonPCMPair.posTrack2Id() - tracks.offset()); - auto const& negTrack2 = tracks.rawIteratorAt(photonPCMPair.negTrack2Id() - tracks.offset()); - if (!posTrack1.has_mcParticle() || !negTrack1.has_mcParticle() || !posTrack2.has_mcParticle() || !negTrack2.has_mcParticle()) - continue; - if (!isGGFromPi0(posTrack1, negTrack1, posTrack2, negTrack2) || - std::abs((*(posTrack1.mcParticle().mothers_as().begin())).mothers_as().begin()->eta()) > etaMax) - continue; - if (requireSingleCollisionPurity && - (posTrack1.mcParticle().mcCollisionId() != collision.mcCollisionId() || posTrack2.mcParticle().mcCollisionId() != collision.mcCollisionId())) - continue; - - histos.fill(HIST("mc/eff/h3_ptPhiEta_mcReco_hasCorrectMc_pi0PCM"), photonPCMPair.pt(), photonPCMPair.phi(), photonPCMPair.eta()); - histos.fill(HIST("mc/eff/h3_ptZPvMult_mcReco_hasCorrectMc_pi0PCM"), photonPCMPair.pt(), collision.posZ(), collision.multNTracksGlobal()); + histos.fill(HIST("mc/eff/h3_ptZPvMult_mcReco_hasCorrectMc_photonPCM"), photonPCM.pt(), collision.posZ(), collision.nGlobalTracks()); } // mcParticle loop for (auto const& mcParticle : mcParticlesThisEvent) { + bool const countChargedTrigEvEff = !doTrigEvEff || collision.trigEv() || mcParticle.pt() > ptCutTrigEvEff; + bool const countOtherTrigEvEff = !doTrigEvEff || collision.trigEv(); + // standard particles (marked physical primary) if (checkPrimaryEtaMc(mcParticle)) { // hadrons - if (checkChargedMc(mcParticle) && (!doTrigEvEff || mcParticle.globalIndex() != excludeTriggerParticleId)) { + if (checkChargedMc(mcParticle) && countChargedTrigEvEff) { histos.fill(HIST("mc/eff/h3_ptPhiEta_mcTrue_recoCol_hadron"), mcParticle.pt(), mcParticle.phi(), mcParticle.eta()); - histos.fill(HIST("mc/eff/h3_ptZPvMult_mcTrue_recoCol_hadron"), mcParticle.pt(), collision.mcCollision().posZ(), collision.multNTracksGlobal()); + histos.fill(HIST("mc/eff/h3_ptZPvMult_mcTrue_recoCol_hadron"), mcParticle.pt(), collision.mcCollision_as().posZ(), collision.nGlobalTracks()); } // pipm - if (std::abs(mcParticle.pdgCode()) == PDG_t::kPiPlus && (!doTrigEvEff || mcParticle.globalIndex() != excludeTriggerParticleId)) { + if (std::abs(mcParticle.pdgCode()) == PDG_t::kPiPlus && countChargedTrigEvEff) { histos.fill(HIST("mc/eff/h3_ptPhiEta_mcTrue_recoCol_pipm"), mcParticle.pt(), mcParticle.phi(), mcParticle.eta()); - histos.fill(HIST("mc/eff/h3_ptZPvMult_mcTrue_recoCol_pipm"), mcParticle.pt(), collision.mcCollision().posZ(), collision.multNTracksGlobal()); + histos.fill(HIST("mc/eff/h3_ptZPvMult_mcTrue_recoCol_pipm"), mcParticle.pt(), collision.mcCollision_as().posZ(), collision.nGlobalTracks()); } // photons - if (mcParticle.pdgCode() == PDG_t::kGamma) { + if (mcParticle.pdgCode() == PDG_t::kGamma && countOtherTrigEvEff) { histos.fill(HIST("mc/eff/h3_ptPhiEta_mcTrue_recoCol_photon"), mcParticle.pt(), mcParticle.phi(), mcParticle.eta()); - histos.fill(HIST("mc/eff/h3_ptZPvMult_mcTrue_recoCol_photon"), mcParticle.pt(), collision.mcCollision().posZ(), collision.multNTracksGlobal()); + histos.fill(HIST("mc/eff/h3_ptZPvMult_mcTrue_recoCol_photon"), mcParticle.pt(), collision.mcCollision_as().posZ(), collision.nGlobalTracks()); } } // decaying particles (not marked physical primary) if ((std::abs(mcParticle.eta()) < etaMax)) { // pi0 - if (checkPi0ToGG(mcParticle)) { + if (checkH0ToGG(mcParticle, PDG_t::kPi0) && countOtherTrigEvEff) { histos.fill(HIST("mc/eff/h3_ptPhiEta_mcTrue_recoCol_pi0"), mcParticle.pt(), mcParticle.phi(), mcParticle.eta()); - histos.fill(HIST("mc/eff/h3_ptZPvMult_mcTrue_recoCol_pi0"), mcParticle.pt(), collision.mcCollision().posZ(), collision.multNTracksGlobal()); + histos.fill(HIST("mc/eff/h3_ptZPvMult_mcTrue_recoCol_pi0"), mcParticle.pt(), collision.mcCollision_as().posZ(), collision.nGlobalTracks()); + } + // eta + if (checkH0ToGG(mcParticle, 221) && countOtherTrigEvEff) { + histos.fill(HIST("mc/eff/h3_ptPhiEta_mcTrue_recoCol_eta"), mcParticle.pt(), mcParticle.phi(), mcParticle.eta()); + histos.fill(HIST("mc/eff/h3_ptZPvMult_mcTrue_recoCol_eta"), mcParticle.pt(), collision.mcCollision_as().posZ(), collision.nGlobalTracks()); } } } @@ -1578,7 +1438,7 @@ struct PhotonChargedTriggerCorrelation { if (!collision.selEv()) return; - histos.fill(HIST("test/h2_mult_comp"), collision.multNTracksGlobal(), hadrons.size()); + histos.fill(HIST("test/h2_mult_comp"), collision.nGlobalTracks(), hadrons.size()); for (auto const& track : tracks) { auto const fullTrack = track.track_as>(); @@ -1602,17 +1462,15 @@ struct PhotonChargedTriggerCorrelation { continue; } - histos.fill(HIST("test/h2_tracks_zPvMultDep"), collision.posZ(), collision.multNTracksGlobal()); + histos.fill(HIST("test/h2_tracks_zPvMultDep"), collision.posZ(), collision.nGlobalTracks()); } - histos.fill(HIST("test/h2_globalTracks_zPvMultDep"), collision.posZ(), collision.multNTracksGlobal(), hadrons.size()); + histos.fill(HIST("test/h2_globalTracks_zPvMultDep"), collision.posZ(), collision.nGlobalTracks(), hadrons.size()); } PROCESS_SWITCH(PhotonChargedTriggerCorrelation, processTest, "process just to test things", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& configContext) { - return WorkflowSpec{ - adaptAnalysisTask(configContext), - adaptAnalysisTask(configContext)}; + return WorkflowSpec{adaptAnalysisTask(configContext)}; } diff --git a/PWGJE/Tasks/photonChargedTriggerProducer.cxx b/PWGJE/Tasks/photonChargedTriggerProducer.cxx new file mode 100644 index 00000000000..a5143797124 --- /dev/null +++ b/PWGJE/Tasks/photonChargedTriggerProducer.cxx @@ -0,0 +1,347 @@ +// 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 photonChargedTriggerProducer.cxx +/// \author Julius Kinner +/// \brief photon-jet angular correlation table producer +/// +/// Table producer for photon-jet angular correlation analysis (see photonChargedTriggerCorrelation.cxx) + +#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" +#include "PWGEM/PhotonMeson/Utils/PCMUtilities.h" +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/DataModel/PhotonChargedTriggerCorrelation.h" + +#include "Common/Core/TableHelper.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CCDB/BasicCCDBManager.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/runDataProcessing.h" + +#include "Math/Vector4D.h" +#include "TMath.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; + +// correlation derived data =================================================================================================================================================================== + +struct PhotonChargedTriggerProducer { + // reco + Produces collisionExtraCorrTable; + Produces triggerTable; + Produces hadronTable; + Produces pipmTable; + Produces photonPCMTable; + Produces photonPCMPairTable; + // mc + Produces mcCollisionExtraCorrTable; + Produces triggerParticleTable; + + Configurable zPvMax{"zPvMax", 7, "maximum absZ primary-vertex cut"}; + Configurable occupancyMin{"occupancyMin", 0, "minimum occupancy cut"}; + Configurable occupancyMax{"occupancyMax", 2000, "maximum occupancy cut"}; + Configurable etaMax{"etaMax", 0.8, "maximum absEta cut"}; + + Configurable eventSelections{"eventSelections", "sel8", "JE framework - event selection"}; + Configurable trackSelections{"trackSelections", "globalTracks", "JE framework - track selections"}; + Configurable triggerMasks{"triggerMasks", "", "JE framework - skimmed data trigger masks (relevent for correlation: fTrackLowPt,fTrackHighPt)"}; + + Configurable piPIDLowPt{"piPIDLowPt", 0.5, "max pt value for pipm PID without tof"}; + Configurable piPIDHighPt{"piPIDHighPt", 2.5, "min pt value for pipm PID without tof in relativistic rise of Bethe-Bloch"}; + Configurable> nSigmaPiTpcLowPt{"nSigmaPiTpcLowPt", {-2, 2}, "minimum-maximum nSigma for pipm in tpc at low pt"}; + Configurable> nSigmaPiTpcMidPt{"nSigmaPiTpcMidPt", {-1, 1}, "minimum-maximum nSigma for pipm in tpc at mid pt"}; + Configurable> nSigmaPiTof{"nSigmaPiTof", {-1, 2}, "minimum-maximum nSigma for pipm in tof"}; + Configurable> nSigmaPiRelRise{"nSigmaPiRelRise", {0, 2}, "minimum-maximum nSigma pipm tpc at high pt"}; + + Configurable ptTrigMin{"ptTrigMin", 5, "minimum pT of triggers"}; + + // derivatives of configurables + + std::vector eventSelectionBits; + int trackSelection = -1; + std::vector triggerMaskBits; + + // for mc + Service pdg; + + // partitions++ + SliceCache cache; + + Preslice perColTracks = aod::jtrack::collisionId; + Preslice perColMcParticles = aod::jmcparticle::mcCollisionId; + + Preslice perColV0Photons = aod::v0photonkf::collisionId; + + // functions ================================================================================================================================================================================ + + // selections /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + // event selection + template + bool checkEventSelection(T_collision const& collision) + { + if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) + return false; + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) + return false; + if (std::abs(collision.posZ()) > zPvMax) + return false; + if (collision.trackOccupancyInTimeRange() < occupancyMin || collision.trackOccupancyInTimeRange() > occupancyMax) + return false; + return true; + } + + // checks global track cuts + template + bool checkGlobalTrackEta(T_track const& track) + { + if (!jetderiveddatautilities::selectTrack(track, trackSelection)) + return false; + if (!jetderiveddatautilities::applyTrackKinematics(track, 0.1, 1000, -1 * etaMax, etaMax)) + return false; + return true; + } + + // checks pipm selection (just PID (no additional track cuts)) + template + bool checkPipmTPCTOF(T_track const& track) + { + // too low for tof + if (track.pt() < piPIDLowPt) { + if (track.tpcNSigmaPi() > nSigmaPiTpcLowPt.value[0] && track.tpcNSigmaPi() < nSigmaPiTpcLowPt.value[1]) { + return true; + } + return false; + } + // Bethe-Bloch overlap (-> tpc + tof) + if (track.pt() < piPIDHighPt) { + if (track.hasTOF()) { // has to stay inside pt-if due to return-layout of function + if (track.tpcNSigmaPi() > nSigmaPiTpcMidPt.value[0] && track.tpcNSigmaPi() < nSigmaPiTpcMidPt.value[1] && + track.tofNSigmaPi() > nSigmaPiTof.value[0] && track.tofNSigmaPi() < nSigmaPiTof.value[1]) { + return true; + } + } + return false; + } + // Bethe-Bloch rel rise (too high for tof) + if (track.tpcNSigmaPi() > nSigmaPiRelRise.value[0] && track.tpcNSigmaPi() < nSigmaPiRelRise.value[1]) { + return true; + } + return false; + } + + // checks pipm selection (just PID (no additional track cuts)) + template + bool checkPipmTPC(T_track const& track) + { + // Bethe-Bloch rel rise + if (track.pt() > piPIDHighPt) { + if (track.tpcNSigmaPi() > nSigmaPiRelRise.value[0] && track.tpcNSigmaPi() < nSigmaPiRelRise.value[1]) { + return true; + } + } + return false; + } + + // analysis ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + void init(InitContext const&) + { + eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(static_cast(eventSelections)); + trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); + triggerMaskBits = jetderiveddatautilities::initialiseTriggerMaskBits(triggerMasks); + } + + void processRecoCollisionTrigger(aod::JetCollision const& collision, aod::JetTracks const& tracks) + { + // event selection + const bool isSelectedEvent = checkEventSelection(collision); + // trigger event check + bool isTriggerEvent = false; + // number global tracks + int nGlobalTracks = 0; + + // count global tracks (for independence of multiplicity task (uses only JE derieved data)) + for (auto const& track : tracks) { + // track selection + if (!checkGlobalTrackEta(track)) + continue; + + nGlobalTracks++; + + if (!isSelectedEvent) + continue; + if (track.pt() < ptTrigMin) + continue; + + isTriggerEvent = true; + + // trigger info + triggerTable(track.collisionId(), track.globalIndex(), track.pt(), track.phi(), track.eta()); + } + + // collision info + collisionExtraCorrTable(isSelectedEvent, isTriggerEvent, nGlobalTracks); + } + PROCESS_SWITCH(PhotonChargedTriggerProducer, processRecoCollisionTrigger, "process correlation collision_extra and trigger table (reconstructed)", false); + + void processRecoPipmTPCTOF(aod::JetCollision const& collision, + soa::Join const& tracks, soa::Join const&) + { + // event selection + if (!checkEventSelection(collision)) + return; + + // hadron/pipm + for (auto const& track : tracks) { + // track selection + if (!checkGlobalTrackEta(track)) + continue; + + // hadron + hadronTable(track.collisionId(), track.globalIndex(), track.pt(), track.phi(), track.eta()); + + // pipm selection + auto const& trackPID = track.track_as>(); + if (!checkPipmTPCTOF(trackPID)) + continue; + + // pipm + pipmTable(track.collisionId(), track.globalIndex(), track.pt(), track.phi(), track.eta()); + } + } + PROCESS_SWITCH(PhotonChargedTriggerProducer, processRecoPipmTPCTOF, "process pipm (TPC-TOF) table (reconstructed)", false); + + void processRecoPipmTPC(aod::JetCollision const& collision, + soa::Join const& tracks, soa::Join const&) + { + // event selection + if (!checkEventSelection(collision)) + return; + + // hadron/pipm + for (auto const& track : tracks) { + // track selection + if (!checkGlobalTrackEta(track)) + continue; + + // hadron + hadronTable(track.collisionId(), track.globalIndex(), track.pt(), track.phi(), track.eta()); + + // pipm selection + auto const& trackPID = track.track_as>(); + if (!checkPipmTPC(trackPID)) + continue; + + // pipm + pipmTable(track.collisionId(), track.globalIndex(), track.pt(), track.phi(), track.eta()); + } + } + PROCESS_SWITCH(PhotonChargedTriggerProducer, processRecoPipmTPC, "process pipm (TPC) table (reconstructed)", false); + + void processRecoPhotonPCM(soa::Join::iterator const& collision, + aod::V0PhotonsKF const& v0Photons, aod::V0Legs const&) + { + // event selection + if (!checkEventSelection(collision)) + return; + + // photonsPCM (for some reason collsionId not an index column (?)) + auto const v0PhotonsThisEvent = v0Photons.sliceBy(perColV0Photons, collision.collisionId()); + + // photonPCM + for (auto const& v0Photon : v0PhotonsThisEvent) { + // photon selection + if (std::abs(v0Photon.eta()) > etaMax) + continue; + + // photon PCM + photonPCMTable(v0Photon.collisionId(), v0Photon.globalIndex(), + v0Photon.posTrack().trackId(), v0Photon.negTrack().trackId(), v0Photon.pt(), v0Photon.phi(), v0Photon.eta()); + } + + // photonPCm pairs + for (auto const& [v0Photon1, v0Photon2] : soa::combinations(soa::CombinationsStrictlyUpperIndexPolicy(v0PhotonsThisEvent, v0PhotonsThisEvent))) { + // get kinematics + ROOT::Math::PtEtaPhiMVector const p4V0PCM1(v0Photon1.pt(), v0Photon1.eta(), v0Photon1.phi(), 0.); + ROOT::Math::PtEtaPhiMVector const p4V0PCM2(v0Photon2.pt(), v0Photon2.eta(), v0Photon2.phi(), 0.); + ROOT::Math::PtEtaPhiMVector const p4V0PCMPair = p4V0PCM1 + p4V0PCM2; + + // pi0 selection + if (std::abs(p4V0PCMPair.Eta()) > etaMax) + continue; + + // save info + photonPCMPairTable(v0Photon1.collisionId(), v0Photon1.globalIndex(), v0Photon2.globalIndex(), + v0Photon1.posTrack().trackId(), v0Photon1.negTrack().trackId(), v0Photon2.posTrack().trackId(), v0Photon2.negTrack().trackId(), + p4V0PCMPair.Pt(), RecoDecay::constrainAngle(p4V0PCMPair.Phi(), 0), p4V0PCMPair.Eta(), p4V0PCMPair.M()); + } + } + PROCESS_SWITCH(PhotonChargedTriggerProducer, processRecoPhotonPCM, "process photonPCM table (reconstructed)", false); + + void processMcCorrTables(aod::JetMcCollision const&, aod::JetParticles const& mcParticles) + { + // trigger event check + bool isTriggerEvent = false; + // number charged particles in eta range + int nCharged = 0; + + // particle loop + for (auto const& mcParticle : mcParticles) { + // track selection + auto const pdgParticle = pdg->GetParticle(mcParticle.pdgCode()); + if (!pdgParticle || pdgParticle->Charge() == 0) + continue; + if (!mcParticle.isPhysicalPrimary()) + continue; + if (std::abs(mcParticle.eta()) > etaMax) + continue; + + nCharged++; + + // trigger selection + if (mcParticle.pt() < ptTrigMin) + continue; + + isTriggerEvent = true; + + // trigger info + triggerParticleTable(mcParticle.mcCollisionId(), mcParticle.globalIndex(), mcParticle.pt(), mcParticle.phi(), mcParticle.eta()); + } + + // collision info + mcCollisionExtraCorrTable(isTriggerEvent, nCharged); + } + PROCESS_SWITCH(PhotonChargedTriggerProducer, processMcCorrTables, "process table production (mc)", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& configContext) +{ + return WorkflowSpec{adaptAnalysisTask(configContext)}; +} From 367c32d23f29fef66535ffe434f480dc7124120a Mon Sep 17 00:00:00 2001 From: gitchrishub-oss Date: Mon, 6 Oct 2025 16:57:05 +0200 Subject: [PATCH 639/986] [PWGCF] Implementation of the pari task for resonances (#13179) Co-authored-by: Christopher Klumm --- PWGCF/FemtoDream/Core/femtoDreamContainer.h | 20 +- .../FemtoDream/Core/femtoDreamDetaDphiStar.h | 137 +++++- .../FemtoDream/Core/femtoDreamParticleHisto.h | 24 +- PWGCF/FemtoDream/Tasks/CMakeLists.txt | 5 + .../Tasks/femtoDreamPairTaskV0Reso.cxx | 409 ++++++++++++++++++ 5 files changed, 562 insertions(+), 33 deletions(-) create mode 100644 PWGCF/FemtoDream/Tasks/femtoDreamPairTaskV0Reso.cxx diff --git a/PWGCF/FemtoDream/Core/femtoDreamContainer.h b/PWGCF/FemtoDream/Core/femtoDreamContainer.h index 4e8300c5c9e..75582365f37 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamContainer.h +++ b/PWGCF/FemtoDream/Core/femtoDreamContainer.h @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file FemtoDreamContainer.h +/// \file femtoDreamContainer.h /// \brief Definition of the FemtoDreamContainer /// \author Andi Mathis, TU München, andreas.mathis@ph.tum.de /// \author Valentina Mantovani Sarti, valentina.mantovani-sarti@tum.de @@ -19,18 +19,20 @@ #ifndef PWGCF_FEMTODREAM_CORE_FEMTODREAMCONTAINER_H_ #define PWGCF_FEMTODREAM_CORE_FEMTODREAMCONTAINER_H_ -#include -#include -#include - -#include "Framework/HistogramRegistry.h" +#include "PWGCF/DataModel/FemtoDerived.h" #include "PWGCF/FemtoDream/Core/femtoDreamMath.h" #include "PWGCF/FemtoDream/Core/femtoDreamUtils.h" -#include "PWGCF/DataModel/FemtoDerived.h" + +#include "Framework/HistogramRegistry.h" #include "Math/Vector4D.h" #include "TMath.h" +#include + +#include +#include + using namespace o2::framework; namespace o2::analysis::femtoDream @@ -99,6 +101,7 @@ class FemtoDreamContainer } if (extendedplots) { mHistogramRegistry->add((folderName + "/relPairkstarmTPtPart1PtPart2MultPercentile").c_str(), ("; :" + femtoObs + "; #it{m}_{T} (GeV/#it{c}^{2}); #it{p} _{T} Particle 1 (GeV/#it{c}); #it{p} _{T} Particle 2 (GeV/#it{c}); Multiplicity Percentile (%)").c_str(), kTHnSparseF, {femtoObsAxis, mTAxis4D, pTAxis, pTAxis, multPercentileAxis4D}); + mHistogramRegistry->add((folderName + "/invMassPart1invMassPart2kstar").c_str(), (";#it{m} (GeV/#it{c}^{2}); #it{m} (GeV/#it{c}^{2}), " + femtoObs).c_str(), kTHnSparseF, {mP2Axis, mP2Axis, femtoObsAxis}); } } @@ -267,6 +270,9 @@ class FemtoDreamContainer } if (extendedplots) { mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/relPairkstarmTPtPart1PtPart2MultPercentile"), femtoObs, mT, part1.pt(), part2.pt(), multPercentile); + if constexpr (std::is_same_v && std::is_same_v) { + mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/invMassPart1invMassPart2kstar"), part1.mLambda(), part2.mLambda(), femtoObs); + } } } diff --git a/PWGCF/FemtoDream/Core/femtoDreamDetaDphiStar.h b/PWGCF/FemtoDream/Core/femtoDreamDetaDphiStar.h index 7dadb08df78..a11506ba567 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamDetaDphiStar.h +++ b/PWGCF/FemtoDream/Core/femtoDreamDetaDphiStar.h @@ -1,4 +1,4 @@ -// Copyright 2019-2025 CERN and copyright holders of ALICE O2. +// Copyright 2019-2022 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. // @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file FemtoDreamDetaDphiStar.h +/// \file femtoDreamDetaDphiStar.h /// \brief FemtoDreamDetaDphiStar - Checks particles for the close pair rejection. /// \author Laura Serksnyte, TU München, laura.serksnyte@tum.de @@ -154,6 +154,25 @@ class FemtoDreamDetaDphiStar } } } + if constexpr (mPartOneType == o2::aod::femtodreamparticle::ParticleType::kV0 && mPartTwoType == o2::aod::femtodreamparticle::ParticleType::kReso) { + + for (int i = 0; i < 4; i++) { + std::string dirName = static_cast(dirNames[4]); + histdetadpi[i][0] = mHistogramRegistry->add((dirName + static_cast(histNames[0][i]) + static_cast(histNameSEorME[meORse])).c_str(), "; #Delta #eta; #Delta #phi^{*}", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpi[i][1] = mHistogramRegistry->add((dirName + static_cast(histNames[1][i]) + static_cast(histNameSEorME[meORse])).c_str(), "; #Delta #eta; #Delta #phi^{*}", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpi[i][2] = mHistogramRegistry->add((dirName + "at_PV_" + std::to_string(i) + "_before" + static_cast(histNameSEorME[meORse])).c_str(), "; #Delta #eta; #Delta #phi^{*}", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpi[i][3] = mHistogramRegistry->add((dirName + "at_PV_" + std::to_string(i) + "_after" + static_cast(histNameSEorME[meORse])).c_str(), "; #Delta #eta; #Delta #phi^{*}", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + if (plotForEveryRadii) { + for (int j = 0; j < 9; j++) { + histdetadpiRadii[i][j] = mHistogramRegistryQA->add((dirName + static_cast(histNamesRadii[i][j]) + static_cast(histNameSEorME[meORse])).c_str(), "; #Delta #eta; #Delta #phi^{*}", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + } + } + if (fillQA) { + histdetadpi_eta[i] = mHistogramRegistry->add((dirName + "dEtadPhi_Eta_" + std::to_string(i) + static_cast(histNameSEorME[meORse])).c_str(), "; #Delta #eta; #Delta #phi^{*}; #eta_{1}; #eta_{2}", kTHnSparseF, {{100, -0.15, 0.15}, {100, -0.15, 0.15}, {100, -0.8, 0.8}, {100, -0.8, 0.8}}); + histdetadpi_phi[i] = mHistogramRegistry->add((dirName + "dEtadPhi_Phi_" + std::to_string(i) + static_cast(histNameSEorME[meORse])).c_str(), "; #Delta #eta; #Delta #phi^{*}; #phi_{1}; #phi_{2}", kTHnSparseF, {{100, -0.15, 0.15}, {100, -0.15, 0.15}, {100, 0, 6.28}, {100, 0, 6.28}}); + } + } + } } /// Check if pair is close or not template @@ -191,7 +210,7 @@ class FemtoDreamDetaDphiStar } if (sameCharge) { if (atWhichRadiiToSelect == 1) { - if (pow(dphiAvg, 2) / pow(deltaPhiMax, 2) + pow(deta, 2) / pow(deltaEtaMax, 2) < 1.) { + if (std::pow(dphiAvg, 2) / std::pow(deltaPhiMax, 2) + std::pow(deta, 2) / std::pow(deltaEtaMax, 2) < 1.) { return true; } else { if (Q3 == 999) { @@ -204,7 +223,7 @@ class FemtoDreamDetaDphiStar return false; } } else if (atWhichRadiiToSelect == 0) { - if (pow(dphi_AT_PV, 2) / pow(deltaPhiMax, 2) + pow(deta, 2) / pow(deltaEtaMax, 2) < 1.) { + if (std::pow(dphi_AT_PV, 2) / std::pow(deltaPhiMax, 2) + std::pow(deta, 2) / std::pow(deltaEtaMax, 2) < 1.) { return true; } else { if (Q3 == 999) { @@ -217,7 +236,7 @@ class FemtoDreamDetaDphiStar return false; } } else if (atWhichRadiiToSelect == 2) { - if (pow(dphi_AT_SpecificRadii, 2) / pow(deltaPhiMax, 2) + pow(deta, 2) / pow(deltaEtaMax, 2) < 1.) { + if (std::pow(dphi_AT_SpecificRadii, 2) / std::pow(deltaPhiMax, 2) + std::pow(deta, 2) / std::pow(deltaEtaMax, 2) < 1.) { return true; } else { if (Q3 == 999) { @@ -236,6 +255,88 @@ class FemtoDreamDetaDphiStar return false; } + } else if constexpr (mPartOneType == o2::aod::femtodreamparticle::ParticleType::kV0 && mPartTwoType == o2::aod::femtodreamparticle::ParticleType::kReso) { + /// V0-Reso combination + // check if provided particles are in agreement with the class instantiation + if (part1.partType() != o2::aod::femtodreamparticle::ParticleType::kV0 || (part2.partType() != o2::aod::femtodreamparticle::ParticleType::kResoPosdaughTOF_NegdaughTOF && + part2.partType() != o2::aod::femtodreamparticle::ParticleType::kResoPosdaughTOF_NegdaughTPC && + part2.partType() != o2::aod::femtodreamparticle::ParticleType::kResoPosdaughTPC_NegdaughTOF && + part2.partType() != o2::aod::femtodreamparticle::ParticleType::kResoPosdaughTPC_NegdaughTPC)) { + LOG(fatal) << "FemtoDreamDetaDphiStar: passed arguments don't agree with FemtoDreamDetaDphiStar instantiation! Please provide kV0, kResoPosdaughTOF_NegdaughTOF, kResoPosdaughTOF_NegdaughTPC, kResoPosdaughTPC_NegdaughTOF, kResoPosdaughTPC_NegdaughTPC candidates."; + return false; + } + + bool pass = false; + int nhist = 0; + for (int i = 0; i < 2; i++) { + int indexOfDaughterPart1, indexOfDaughterPart2; + for (int j = 0; j < 2; j++) { + if (isMixedEventLambda) { + indexOfDaughterPart1 = part1.globalIndex() - 2 + i; + indexOfDaughterPart2 = part2.globalIndex() - 2 + j; + } else { + indexOfDaughterPart1 = part1.index() - 2 + i; + indexOfDaughterPart2 = part2.index() - 2 + j; + } + + auto daughterPart1 = particles.begin() + indexOfDaughterPart1; + auto daughterPart2 = particles.begin() + indexOfDaughterPart2; + auto deta = daughterPart1.eta() - daughterPart2.eta(); + auto dphi_AT_PV = daughterPart1.phi() - daughterPart2.phi(); + auto dphi_AT_SpecificRadii = PhiAtSpecificRadiiTPC(daughterPart1, radiiTPC) - PhiAtSpecificRadiiTPC(daughterPart2, radiiTPC); + bool sameCharge = false; + auto dphiAvg = AveragePhiStar(*daughterPart1, *daughterPart2, nhist, &sameCharge); + if (Q3 == 999) { + histdetadpi[nhist][0]->Fill(deta, dphiAvg); + histdetadpi[nhist][2]->Fill(deta, dphi_AT_PV); + if (fillQA) { + histdetadpi_eta[nhist]->Fill(deta, dphiAvg, daughterPart1.eta(), daughterPart2.eta()); + histdetadpi_phi[nhist]->Fill(deta, dphiAvg, daughterPart1.phi(), daughterPart2.phi()); + } + } + if (sameCharge) { + if (atWhichRadiiToSelect == 1) { + if (std::pow(dphiAvg, 2) / std::pow(deltaPhiMax, 2) + std::pow(deta, 2) / std::pow(deltaEtaMax, 2) < 1.) { + pass = true; + } else { + if (Q3 == 999) { + histdetadpi[nhist][1]->Fill(deta, dphiAvg); + histdetadpi[nhist][3]->Fill(deta, dphi_AT_PV); + } else if (Q3 < upperQ3LimitForPlotting) { + histdetadpi[nhist][1]->Fill(deta, dphiAvg); + histdetadpi[nhist][3]->Fill(deta, dphi_AT_PV); + } + } + } else if (atWhichRadiiToSelect == 0) { + if (std::pow(dphi_AT_PV, 2) / std::pow(deltaPhiMax, 2) + std::pow(deta, 2) / std::pow(deltaEtaMax, 2) < 1.) { + pass = true; + } else { + if (Q3 == 999) { + histdetadpi[nhist][1]->Fill(deta, dphiAvg); + histdetadpi[nhist][3]->Fill(deta, dphi_AT_PV); + } else if (Q3 < upperQ3LimitForPlotting) { + histdetadpi[nhist][1]->Fill(deta, dphiAvg); + histdetadpi[nhist][3]->Fill(deta, dphi_AT_PV); + } + } + } else if (atWhichRadiiToSelect == 2) { + if (std::pow(dphi_AT_SpecificRadii, 2) / std::pow(deltaPhiMax, 2) + std::pow(deta, 2) / std::pow(deltaEtaMax, 2) < 1.) { + pass = true; + } else { + if (Q3 == 999) { + histdetadpi[nhist][1]->Fill(deta, dphiAvg); + histdetadpi[nhist][3]->Fill(deta, dphi_AT_PV); + } else if (Q3 < upperQ3LimitForPlotting) { + histdetadpi[nhist][1]->Fill(deta, dphiAvg); + histdetadpi[nhist][3]->Fill(deta, dphi_AT_PV); + } + } + } + } + nhist += 1; + } + } + return pass; } else if constexpr (mPartOneType == o2::aod::femtodreamparticle::ParticleType::kTrack && mPartTwoType == o2::aod::femtodreamparticle::ParticleType::kV0) { /// Track-V0 combination // check if provided particles are in agreement with the class instantiation @@ -275,7 +376,7 @@ class FemtoDreamDetaDphiStar } if (sameCharge) { if (atWhichRadiiToSelect == 1) { - if (pow(dphiAvg, 2) / pow(deltaPhiMax, 2) + pow(deta, 2) / pow(deltaEtaMax, 2) < 1.) { + if (std::pow(dphiAvg, 2) / std::pow(deltaPhiMax, 2) + std::pow(deta, 2) / std::pow(deltaEtaMax, 2) < 1.) { pass = true; } else { if (Q3 == 999) { @@ -287,7 +388,7 @@ class FemtoDreamDetaDphiStar } } } else if (atWhichRadiiToSelect == 0) { - if (pow(dphi_AT_PV, 2) / pow(deltaPhiMax, 2) + pow(deta, 2) / pow(deltaEtaMax, 2) < 1.) { + if (std::pow(dphi_AT_PV, 2) / std::pow(deltaPhiMax, 2) + std::pow(deta, 2) / std::pow(deltaEtaMax, 2) < 1.) { pass = true; } else { if (Q3 == 999) { @@ -299,7 +400,7 @@ class FemtoDreamDetaDphiStar } } } else if (atWhichRadiiToSelect == 2) { - if (pow(dphi_AT_SpecificRadii, 2) / pow(deltaPhiMax, 2) + pow(deta, 2) / pow(deltaEtaMax, 2) < 1.) { + if (std::pow(dphi_AT_SpecificRadii, 2) / std::pow(deltaPhiMax, 2) + std::pow(deta, 2) / std::pow(deltaEtaMax, 2) < 1.) { pass = true; } else { if (Q3 == 999) { @@ -352,7 +453,7 @@ class FemtoDreamDetaDphiStar } if (sameCharge) { if (atWhichRadiiToSelect == 1) { - if (pow(dphiAvg, 2) / pow(deltaPhiMax, 2) + pow(deta, 2) / pow(deltaEtaMax, 2) < 1.) { + if (std::pow(dphiAvg, 2) / std::pow(deltaPhiMax, 2) + std::pow(deta, 2) / std::pow(deltaEtaMax, 2) < 1.) { pass = true; } else { if (Q3 == 999) { @@ -364,7 +465,7 @@ class FemtoDreamDetaDphiStar } } } else if (atWhichRadiiToSelect == 0) { - if (pow(dphi_AT_PV, 2) / pow(deltaPhiMax, 2) + pow(deta, 2) / pow(deltaEtaMax, 2) < 1.) { + if (std::pow(dphi_AT_PV, 2) / std::pow(deltaPhiMax, 2) + std::pow(deta, 2) / std::pow(deltaEtaMax, 2) < 1.) { pass = true; } else { if (Q3 == 999) { @@ -376,7 +477,7 @@ class FemtoDreamDetaDphiStar } } } else if (atWhichRadiiToSelect == 2) { - if (pow(dphi_AT_SpecificRadii, 2) / pow(deltaPhiMax, 2) + pow(deta, 2) / pow(deltaEtaMax, 2) < 1.) { + if (std::pow(dphi_AT_SpecificRadii, 2) / std::pow(deltaPhiMax, 2) + std::pow(deta, 2) / std::pow(deltaEtaMax, 2) < 1.) { pass = true; } else { if (Q3 == 999) { @@ -455,7 +556,7 @@ class FemtoDreamDetaDphiStar } if (atWhichRadiiToSelect == 1) { - if (pow(dphiAvg, 2) / pow(deltaPhiMax, 2) + pow(deta, 2) / pow(deltaEtaMax, 2) < 1.) { + if (std::pow(dphiAvg, 2) / std::pow(deltaPhiMax, 2) + std::pow(deta, 2) / std::pow(deltaEtaMax, 2) < 1.) { pass = true; } else { if (Q3 == 999) { @@ -467,7 +568,7 @@ class FemtoDreamDetaDphiStar } } } else if (atWhichRadiiToSelect == 0) { - if (pow(dphi_AT_PV, 2) / pow(deltaPhiMax, 2) + pow(deta, 2) / pow(deltaEtaMax, 2) < 1.) { + if (std::pow(dphi_AT_PV, 2) / std::pow(deltaPhiMax, 2) + std::pow(deta, 2) / std::pow(deltaEtaMax, 2) < 1.) { pass = true; } else { if (Q3 == 999) { @@ -479,7 +580,7 @@ class FemtoDreamDetaDphiStar } } } else if (atWhichRadiiToSelect == 2) { - if (pow(dphi_AT_SpecificRadii, 2) / pow(deltaPhiMax, 2) + pow(deta, 2) / pow(deltaEtaMax, 2) < 1.) { + if (std::pow(dphi_AT_SpecificRadii, 2) / std::pow(deltaPhiMax, 2) + std::pow(deta, 2) / std::pow(deltaEtaMax, 2) < 1.) { pass = true; } else { if (Q3 == 999) { @@ -534,7 +635,7 @@ class FemtoDreamDetaDphiStar } if (sameCharge) { if (atWhichRadiiToSelect == 1) { - if (pow(dphiAvg, 2) / pow(deltaPhiMax, 2) + pow(deta, 2) / pow(deltaEtaMax, 2) < 1.) { + if (std::pow(dphiAvg, 2) / std::pow(deltaPhiMax, 2) + std::pow(deta, 2) / std::pow(deltaEtaMax, 2) < 1.) { pass = true; } else { if (Q3 == 999) { @@ -547,7 +648,7 @@ class FemtoDreamDetaDphiStar } } else if (atWhichRadiiToSelect == 0) { - if (pow(dphi_AT_PV, 2) / pow(deltaPhiMax, 2) + pow(deta, 2) / pow(deltaEtaMax, 2) < 1.) { + if (std::pow(dphi_AT_PV, 2) / std::pow(deltaPhiMax, 2) + std::pow(deta, 2) / std::pow(deltaEtaMax, 2) < 1.) { pass = true; } else { if (Q3 == 999) { @@ -559,7 +660,7 @@ class FemtoDreamDetaDphiStar } } } else if (atWhichRadiiToSelect == 2) { - if (pow(dphi_AT_SpecificRadii, 2) / pow(deltaPhiMax, 2) + pow(deta, 2) / pow(deltaEtaMax, 2) < 1.) { + if (std::pow(dphi_AT_SpecificRadii, 2) / std::pow(deltaPhiMax, 2) + std::pow(deta, 2) / std::pow(deltaEtaMax, 2) < 1.) { pass = true; } else { if (Q3 == 999) { @@ -583,7 +684,7 @@ class FemtoDreamDetaDphiStar private: HistogramRegistry* mHistogramRegistry = nullptr; ///< For main output HistogramRegistry* mHistogramRegistryQA = nullptr; ///< For QA output - static constexpr std::string_view dirNames[4] = {"kTrack_kTrack/", "kTrack_kV0/", "kTrack_kCharmHadron/", "kTrack_kCascade/"}; + static constexpr std::string_view dirNames[5] = {"kTrack_kTrack/", "kTrack_kV0/", "kTrack_kCharmHadron/", "kTrack_kCascade/", "kV0_kReso/"}; static constexpr std::string_view histNameSEorME[3] = {"_SEandME", "_SE", "_ME"}; diff --git a/PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h b/PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h index d61b719250f..8cdf1cfbb60 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h +++ b/PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h @@ -76,13 +76,17 @@ class FemtoDreamParticleHisto mHistogramRegistry->add((folderName + folderSuffix + "/hpTInvMassCascade").c_str(), "; p_{T} (GeV/#it{c{}); M_{Cascade}", kTH2F, {pTAxis, InvMassAxis}); } if constexpr (mParticleType == o2::aod::femtodreamparticle::ParticleType::kReso) { - mHistogramRegistry->add((folderName + folderSuffix + "/hInvMassPhi").c_str(), "; M_{#Phi}; Entries", kTH1F, {InvMassAxis}); // added for Phi !! - mHistogramRegistry->add((folderName + folderSuffix + "/hpTInvMassPhi").c_str(), "; p_{T} (GeV/#it{c{}); M_{#Phi}", kTH2F, {pTAxis, InvMassAxis}); + mHistogramRegistry->add((folderName + folderSuffix + "/hInvMassReso").c_str(), "; M_{Reso}; Entries", kTH1F, {InvMassAxis}); // added for Phi !! + mHistogramRegistry->add((folderName + folderSuffix + "/hpTInvMassReso").c_str(), "; p_{T} (GeV/#it{c{}); M_{Reso}", kTH2F, {pTAxis, InvMassAxis}); + mHistogramRegistry->add((folderName + folderSuffix + "/hInvMassAntiReso").c_str(), "; M_{Reso}; Entries", kTH1F, {InvMassAxis}); // added for Phi !! + mHistogramRegistry->add((folderName + folderSuffix + "/hpTInvMassAntiReso").c_str(), "; p_{T} (GeV/#it{c{}); M_{Reso}", kTH2F, {pTAxis, InvMassAxis}); } if constexpr (mParticleType == o2::aod::femtodreamparticle::ParticleType::kResoChild) { - mHistogramRegistry->add((folderName + folderSuffix + "/hInvMassPhi").c_str(), "; M_{#Phi}; Entries", kTH1F, {InvMassAxis}); // added for Phi !! - mHistogramRegistry->add((folderName + folderSuffix + "/hpTInvMassPhi").c_str(), "; p_{T} (GeV/#it{c{}); M_{#Phi}", kTH2F, {pTAxis, InvMassAxis}); + mHistogramRegistry->add((folderName + folderSuffix + "/hInvMassReso").c_str(), "; M_{Reso}; Entries", kTH1F, {InvMassAxis}); // added for Phi !! + mHistogramRegistry->add((folderName + folderSuffix + "/hpTInvMassReso").c_str(), "; p_{T} (GeV/#it{c{}); M_{Reso}", kTH2F, {pTAxis, InvMassAxis}); + mHistogramRegistry->add((folderName + folderSuffix + "/hInvMassAntiReso").c_str(), "; M_{Reso}; Entries", kTH1F, {InvMassAxis}); // added for Phi !! + mHistogramRegistry->add((folderName + folderSuffix + "/hpTInvMassAntiReso").c_str(), "; p_{T} (GeV/#it{c{}); M_{Reso}", kTH2F, {pTAxis, InvMassAxis}); } } @@ -363,12 +367,16 @@ class FemtoDreamParticleHisto // mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hpTInvMassCascade"), part.pt(), part.mLambda()); } if constexpr (mParticleType == o2::aod::femtodreamparticle::ParticleType::kReso) { - mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hInvMassPhi"), part.mLambda()); // currently no MC for Phi!! - mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hpTInvMassPhi"), part.pt(), part.mLambda()); // getter from FDPArticles now!! + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hInvMassReso"), part.mLambda()); // currently no MC for Phi!! + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hpTInvMassReso"), part.pt(), part.mLambda()); // getter from FDPArticles now!! + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hInvMassAntiReso"), part.mAntiLambda()); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hpTInvMassAntiReso"), part.pt(), part.mAntiLambda()); } if constexpr (mParticleType == o2::aod::femtodreamparticle::ParticleType::kResoChild) { - mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hInvMassPhi"), part.mLambda()); // currently no MC for Phi!! - mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hpTInvMassPhi"), part.pt(), part.mLambda()); // getter from FDPArticles now!! + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hInvMassReso"), part.mLambda()); // currently no MC for Phi!! + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hpTInvMassReso"), part.pt(), part.mLambda()); // getter from FDPArticles now!! + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hInvMassAntiReso"), part.mAntiLambda()); + mHistogramRegistry->fill(HIST(o2::aod::femtodreamparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/hpTInvMassAntiReso"), part.pt(), part.mAntiLambda()); } } diff --git a/PWGCF/FemtoDream/Tasks/CMakeLists.txt b/PWGCF/FemtoDream/Tasks/CMakeLists.txt index 1e20c22c73a..d3b0bc6a436 100644 --- a/PWGCF/FemtoDream/Tasks/CMakeLists.txt +++ b/PWGCF/FemtoDream/Tasks/CMakeLists.txt @@ -29,6 +29,11 @@ o2physics_add_dpl_workflow(femtodream-pair-track-v0 PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(femto-dream-pair-task-v0-reso + SOURCES femtoDreamPairTaskV0Reso.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(femtodream-pair-track-cascade SOURCES femtoDreamPairTaskTrackCascade.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore diff --git a/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskV0Reso.cxx b/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskV0Reso.cxx new file mode 100644 index 00000000000..c6a5e91f6ba --- /dev/null +++ b/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskV0Reso.cxx @@ -0,0 +1,409 @@ +// Copyright 2019-2025 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 femtoDreamPairTaskV0Reso.cxx +/// \brief Tasks that reads the track tables used for the pairing and builds pairs of two tracks +/// \author Christopher Klumm, TU München, christopher.klumm@cern.ch +/// \author Anton Riedel, TU München, anton.riedel@cern.ch +/// \author Georgios Mantzaridis, TU München, georgios.mantzaridis@cern.ch + +#include "PWGCF/DataModel/FemtoDerived.h" +#include "PWGCF/FemtoDream/Core/femtoDreamContainer.h" +#include "PWGCF/FemtoDream/Core/femtoDreamDetaDphiStar.h" +#include "PWGCF/FemtoDream/Core/femtoDreamEventHisto.h" +#include "PWGCF/FemtoDream/Core/femtoDreamPairCleaner.h" +#include "PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h" +#include "PWGCF/FemtoDream/Core/femtoDreamUtils.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/Configurable.h" +#include "Framework/Expressions.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" + +#include "TRandom3.h" + +#include +#include +#include +#include + +using namespace o2; +using namespace o2::aod; +using namespace o2::soa; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::analysis::femtoDream; + +struct FemtoDreamPairTaskV0Reso { + SliceCache cache; + Preslice perCol = aod::femtodreamparticle::fdCollisionId; + + /// Histogramming for Event + FemtoDreamEventHisto eventHisto; // are my cases included check & add! + + FemtoDreamContainer sameEventCont; + FemtoDreamContainer mixedEventCont; + // FemtoDreamPairCleaner pairCleaner; + FemtoDreamDetaDphiStar pairCloseRejectionSE; + FemtoDreamDetaDphiStar pairCloseRejectionME; + + /// General options + struct : ConfigurableGroup { + std::string prefix = std::string("Option"); + Configurable isMC{"isMC", false, "Enable additional Histogramms in the case of a MonteCarlo Run"}; + Configurable use4D{"use4D", false, "Enable four dimensional histogramms (to be used only for analysis with high statistics): k* vs multiplicity vs multiplicity percentil vs mT"}; + Configurable extendedPlots{"extendedPlots", true, "Enable additional three dimensional histogramms. High memory consumption. Use for debugging"}; + Configurable highkstarCut{"highkstarCut", -1., "Set a cut for high k*, above which the pairs are rejected. Set it to -1 to deactivate it"}; + Configurable cPROn{"cPROn", false, "Close Pair Rejection"}; + Configurable cPROld{"cPROld", false, "Set to FALSE to use fixed version of CPR (for testing now, will be default soon)"}; + Configurable cPRPlotPerRadii{"cPRPlotPerRadii", false, "Plot CPR per radii"}; + Configurable cPRdeltaPhiMax{"cPRdeltaPhiMax", 0.01, "Max. Delta Phi for Close Pair Rejection"}; + Configurable cPRdeltaEtaMax{"cPRdeltaEtaMax", 0.01, "Max. Delta Eta for Close Pair Rejection"}; + Configurable dCACutPtDep{"dCACutPtDep", false, "Use pt dependent dca cut"}; + Configurable mixEventWithPairs{"mixEventWithPairs", true, "Only use events that contain particle 1 and partile 2 for the event mixing"}; + Configurable smearingByOrigin{"smearingByOrigin", false, "Obtain the smearing matrix differential in the MC origin of particle 1 and particle 2. High memory consumption. Use with care!"}; + ConfigurableAxis dummy{"dummy", {1, 0, 1}, "dummy axis"}; + } Option; + + /// Event selection + struct : ConfigurableGroup { + std::string prefix = std::string("EventSel"); + Configurable multMin{"multMin", 0, "Minimum Multiplicity (MultNtr)"}; + Configurable multMax{"multMax", 99999, "Maximum Multiplicity (MultNtr)"}; + Configurable multPercentileMin{"multPercentileMin", 0, "Minimum Multiplicity Percentile"}; + Configurable multPercentileMax{"multPercentileMax", 100, "Maximum Multiplicity Percentile"}; + } EventSel; + + /// Binning configurables + struct : ConfigurableGroup { + std::string prefix = std::string("Binning"); + ConfigurableAxis tempFitVarReso{"tempFitVarReso", {300, 0.9, 1}, "binning of the TempFitVar in the pT vs. TempFitVar plot (V0)"}; + ConfigurableAxis tempFitVarV0{"tempFitVarV0", {300, 0.9, 1}, "binning of the TempFitVar in the pT vs. TempFitVar plot (Reso))"}; + ConfigurableAxis tempFitVarV0Child{"tempFitVarV0Child", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot (V0 child)"}; + ConfigurableAxis tempFitVarResoChild{"tempFitVarResoChild", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot (Reso child)"}; + ConfigurableAxis invMass{"invMass", {1500, 0.9, 1.13}, "invMass binning"}; + ConfigurableAxis pTTrack{"pTTrack", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot (Track)"}; + ConfigurableAxis pTV0{"pTV0", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot (V0)"}; + ConfigurableAxis pTReso{"pTReso", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot (Reso)"}; + ConfigurableAxis pTV0Child{"pTV0Child", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot (V0 Child)"}; + ConfigurableAxis pTResoChild{"pTResoChild", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot (Reso Child)"}; + ConfigurableAxis pT{"pT", {20, 0.5, 4.05}, "pT binning"}; + ConfigurableAxis kstar{"kstar", {1500, 0., 6.}, "binning kstar"}; + ConfigurableAxis kT{"kT", {150, 0., 9.}, "binning kT"}; + ConfigurableAxis mT{"mT", {225, 0., 7.5}, "binning mT"}; + ConfigurableAxis multTempFit{"multTempFit", {1, 0, 1}, "multiplicity for the TempFitVar plot"}; + } Binning; + + struct : ConfigurableGroup { + std::string prefix = std::string("Binning4D"); + ConfigurableAxis kstar{"kstar", {1500, 0., 6.}, "binning kstar for the 4Dimensional plot: k* vs multiplicity vs multiplicity percentile vs mT (set <> to true in order to use)"}; + ConfigurableAxis mT{"mT", {VARIABLE_WIDTH, 1.02f, 1.14f, 1.20f, 1.26f, 1.38f, 1.56f, 1.86f, 4.50f}, "mT Binning for the 4Dimensional plot: k* vs multiplicity vs multiplicity percentile vs mT (set <> to true in order to use)"}; + ConfigurableAxis mult{"mult", {VARIABLE_WIDTH, 0.0f, 4.0f, 8.0f, 12.0f, 16.0f, 20.0f, 24.0f, 28.0f, 32.0f, 36.0f, 40.0f, 44.0f, 48.0f, 52.0f, 56.0f, 60.0f, 64.0f, 68.0f, 72.0f, 76.0f, 80.0f, 84.0f, 88.0f, 92.0f, 96.0f, 100.0f, 200.0f}, "multiplicity Binning for the 4Dimensional plot: k* vs multiplicity vs multiplicity percentile vs mT (set <> to true in order to use)"}; + ConfigurableAxis multPercentile{"multPercentile", {10, 0.0f, 100.0f}, "multiplicity percentile Binning for the 4Dimensional plot: k* vs multiplicity vs multiplicity percentile vs mT (set <> to true in order to use)"}; + } Binning4D; + + // Mixing configurables + struct : ConfigurableGroup { + std::string prefix = std::string("Mixing"); + ConfigurableAxis binMult{"binMult", {VARIABLE_WIDTH, 0.0f, 4.0f, 8.0f, 12.0f, 16.0f, 20.0f, 24.0f, 28.0f, 32.0f, 36.0f, 40.0f, 44.0f, 48.0f, 52.0f, 56.0f, 60.0f, 64.0f, 68.0f, 72.0f, 76.0f, 80.0f, 84.0f, 88.0f, 92.0f, 96.0f, 100.0f, 200.0f}, "bins - multiplicity"}; + ConfigurableAxis binMultPercentile{"binMultPercentile", {VARIABLE_WIDTH, 0.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.f}, "bins - multiplicity percentile"}; + ConfigurableAxis binVztx{"binVztx", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "bins - z-vertex"}; + Configurable depth{"depth", 5, "Number of events for mixing"}; + Configurable policy{"policy", 0, "Binning policy for mixing - 0: multiplicity, 1: multipliciy percentile, 2: both"}; + } Mixing; + + /// particle 1 (V01), Λ + struct : ConfigurableGroup { + std::string prefix = std::string("V01"); + Configurable pdgCode{"pdgCode", 3122, "PDG code of particle 1 (V0)"}; + Configurable cutBit{"cutBit", 7518, "Selection bit for particle 1 (V0)"}; + Configurable childPosCutBit{"childPosCutBit", 210, "Selection bit for positive child of V01"}; + Configurable childPosTPCBit{"childPosTPCBit", 64, "PID TPC bit for positive child of V01"}; + Configurable childNegCutBit{"childNegCutBit", 209, "Selection bit for negative child of V01"}; + Configurable childNegTPCBit{"childNegTPCBit", 256, "PID TPC bit for negative child of V01"}; + + Configurable invMassMin{"invMassMin", 1.08, "Minimum invariant mass of Partricle 1 (particle) (V0)"}; + Configurable invMassMax{"invMassMax", 1.15, "Maximum invariant mass of Partricle 1 (particle) (V0)"}; + Configurable invMassAntiMin{"invMassAntiMin", 0., "Minimum invariant mass of Partricle 1 (antiparticle) (V0)"}; // should be the same as for Lambda... + Configurable invMassAntiMax{"invMassAntiMax", 999., "Maximum invariant mass of Partricle 1 (antiparticle) (V0)"}; + + Configurable ptMin{"ptMin", 0., "Minimum pT of Partricle 1 (V0)"}; + Configurable ptMax{"ptMax", 999., "Maximum pT of Partricle 1 (V0)"}; + Configurable etaMin{"etaMin", -10., "Minimum eta of Partricle 1 (V0)"}; + Configurable etaMax{"etaMax", 10., "Maximum eta of Partricle 1 (V0)"}; + } V01; // hier evtl noch weiter Configurables einfügen... + + /// particle 2, (Resonance) (needs implementation phi in cut bit ) + struct : ConfigurableGroup { + std::string prefix = std::string("Reso2"); + Configurable pdgCode{"pdgCode", 333, "PDG code of particle 2 (V0)"}; + + Configurable invMassMin{"invMassMin", 1.017, "Minimum invariant mass of Partricle 2 (particle) (V0)"}; // phi values for inv mass + Configurable invMassMax{"invMassMax", 1.027, "Maximum invariant mass of Partricle 2 (particle) (V0)"}; + Configurable ptMin{"ptMin", 0., "Minimum pT of Partricle 2 (V0)"}; + Configurable ptMax{"ptMax", 999., "Maximum pT of Partricle 2 (V0)"}; + Configurable etaMin{"etaMin", -10., "Minimum eta of Partricle 2 (V0)"}; // change values + Configurable etaMax{"etaMax", 10., "Maximum eta of Partricle 2 (V0)"}; // change values + + Configurable daughPosCutBit{"daughPosCutBit", 4860458, "Selection bit for positive child of V02"}; // K+ + Configurable daughPosTPCBit{"daughPosTPCBit", 64, "PID TPC bit for positive child of V02"}; // NSigma_TPC = 2.5 + Configurable daughPosTPCTOFBit{"daughPosTPCTOFBit", 32, "PID TOF bit for positive child of V02"}; // NSigma_TOF = 2.5 + Configurable daughNegCutBit{"daughNegCutBit", 4860457, "Selection bit for negative child of V02"}; // K- + Configurable daughNegMergedTPCBit{"daughNegMergedTPCBit", 258, "PID TPC bit for negative child of V02"}; // NSigma_TPC = 2.5 + Configurable daughNegMergedTPCTOFBit{"daughNegMergedTPCTOFBit", 130, "PID TOF bit for negative child of V02"}; // NSigma_TOF = 2.5 + } Reso2; + + /// Partition for particle 1 + Partition partitionV01 = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kV0)) && + ((aod::femtodreamparticle::cut & V01.cutBit) == V01.cutBit) && + (aod::femtodreamparticle::pt > V01.ptMin) && + (aod::femtodreamparticle::pt < V01.ptMax) && + (aod::femtodreamparticle::eta > V01.etaMin) && + (aod::femtodreamparticle::eta < V01.etaMax) && + (aod::femtodreamparticle::mLambda > V01.invMassMin) && + (aod::femtodreamparticle::mLambda < V01.invMassMax) && + (aod::femtodreamparticle::mAntiLambda > V01.invMassAntiMin) && + (aod::femtodreamparticle::mAntiLambda < V01.invMassAntiMax); + + /// Partition for particle 2 + Partition partitionReso2 = (ifnode(aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kResoPosdaughTPC_NegdaughTPC), ncheckbit(aod::femtodreamparticle::pidcut, Reso2.daughPosTPCBit) && ncheckbit(aod::femtodreamparticle::cut, Reso2.daughNegMergedTPCBit), false) || + ifnode(aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kResoPosdaughTOF_NegdaughTOF), ncheckbit(aod::femtodreamparticle::pidcut, Reso2.daughPosTPCTOFBit) && ncheckbit(aod::femtodreamparticle::cut, Reso2.daughNegMergedTPCTOFBit), false) || + ifnode(aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kResoPosdaughTOF_NegdaughTPC), ncheckbit(aod::femtodreamparticle::pidcut, Reso2.daughPosTPCTOFBit) && ncheckbit(aod::femtodreamparticle::cut, Reso2.daughNegMergedTPCBit), false) || + ifnode(aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kResoPosdaughTPC_NegdaughTOF), ncheckbit(aod::femtodreamparticle::pidcut, Reso2.daughPosTPCBit) && ncheckbit(aod::femtodreamparticle::cut, Reso2.daughNegMergedTPCTOFBit), false)) && + (aod::femtodreamparticle::pt < Reso2.ptMax) && + (aod::femtodreamparticle::eta > Reso2.etaMin) && + (aod::femtodreamparticle::eta < Reso2.etaMax) && + (aod::femtodreamparticle::mLambda > Reso2.invMassMin) && + (aod::femtodreamparticle::mLambda < Reso2.invMassMax); + + ColumnBinningPolicy colBinningMult{{Mixing.binVztx, Mixing.binMult}, true}; + ColumnBinningPolicy colBinningMultPercentile{{Mixing.binVztx, Mixing.binMultPercentile}, true}; + ColumnBinningPolicy colBinningMultMultPercentile{{Mixing.binVztx, Mixing.binMult, Mixing.binMultPercentile}, true}; + + Filter eventMultiplicity = aod::femtodreamcollision::multNtr >= EventSel.multMin && aod::femtodreamcollision::multNtr <= EventSel.multMax; + Filter eventMultiplicityPercentile = aod::femtodreamcollision::multV0M >= EventSel.multPercentileMin && aod::femtodreamcollision::multV0M <= EventSel.multPercentileMax; + + using FilteredCollisions = soa::Filtered; + using FilteredCollision = FilteredCollisions::iterator; + // no masked yet + + /// Histogramming for particle 1 + FemtoDreamParticleHisto v0HistoPartOne; + FemtoDreamParticleHisto posChildHistos; + FemtoDreamParticleHisto negChildHistos; + + /// Histogramming for particle 2 + /// prob need to add cases in fillQA, fillDebug in femtoDreamParticleHisto + FemtoDreamParticleHisto resoHistoPartTwo; + FemtoDreamParticleHisto resoposChildHistos; + FemtoDreamParticleHisto resonegChildHistos; + + /// Histogram output + HistogramRegistry registry{"Output", {}, OutputObjHandlingPolicy::AnalysisObject}; + + void init(InitContext&) // InitContext& context + { + + // setup binnnig policy for mixing + colBinningMult = {{Mixing.binVztx, Mixing.binMult}, true}; + colBinningMultPercentile = {{Mixing.binVztx, Mixing.binMultPercentile}, true}; + colBinningMultMultPercentile = {{Mixing.binVztx, Mixing.binMult, Mixing.binMultPercentile}, true}; + + eventHisto.init(®istry, Option.isMC); + // change them !! + v0HistoPartOne.init(®istry, Binning.multTempFit, Option.dummy, Binning.pTTrack, Option.dummy, Option.dummy, Binning.tempFitVarV0, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Option.isMC, V01.pdgCode); + posChildHistos.init(®istry, Binning.multTempFit, Option.dummy, Binning.pTV0Child, Option.dummy, Option.dummy, Binning.tempFitVarV0Child, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Option.dummy, false, 0); + negChildHistos.init(®istry, Binning.multTempFit, Option.dummy, Binning.pTV0Child, Option.dummy, Option.dummy, Binning.tempFitVarV0Child, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Option.dummy, false, 0); + + resoHistoPartTwo.init(®istry, Binning.multTempFit, Option.dummy, Binning.pTReso, Option.dummy, Option.dummy, Binning.tempFitVarReso, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Binning.invMass, Option.dummy, Option.isMC, Reso2.pdgCode); + resoposChildHistos.init(®istry, Binning.multTempFit, Option.dummy, Binning.pTResoChild, Option.dummy, Option.dummy, Binning.tempFitVarResoChild, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Option.dummy, false, 0); + resonegChildHistos.init(®istry, Binning.multTempFit, Option.dummy, Binning.pTResoChild, Option.dummy, Option.dummy, Binning.tempFitVarResoChild, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Option.dummy, Option.dummy, false, 0); + + sameEventCont.init(®istry, + Binning.kstar, Binning.pT, Binning.kT, Binning.mT, Mixing.binMult, Mixing.binMultPercentile, + Binning4D.kstar, Binning4D.mT, Binning4D.mult, Binning4D.multPercentile, + Option.isMC, Option.use4D, Option.extendedPlots, + Option.highkstarCut, + Option.smearingByOrigin, Binning.invMass); + + sameEventCont.setPDGCodes(V01.pdgCode, Reso2.pdgCode); + mixedEventCont.init(®istry, + Binning.kstar, Binning.pT, Binning.kT, Binning.mT, Mixing.binMult, Mixing.binMultPercentile, + Binning4D.kstar, Binning4D.mT, Binning4D.mult, Binning4D.multPercentile, + Option.isMC, Option.use4D, Option.extendedPlots, + Option.highkstarCut, + Option.smearingByOrigin, Binning.invMass); + + mixedEventCont.setPDGCodes(V01.pdgCode, Reso2.pdgCode); + // pairCleaner.init(®istry); + if (Option.cPROn.value) { + pairCloseRejectionSE.init(®istry, ®istry, Option.cPRdeltaPhiMax.value, Option.cPRdeltaEtaMax.value, Option.cPRPlotPerRadii.value, 1, Option.cPROld.value); + pairCloseRejectionME.init(®istry, ®istry, Option.cPRdeltaPhiMax.value, Option.cPRdeltaEtaMax.value, Option.cPRPlotPerRadii.value, 2, Option.cPROld.value, 99, true); + } + } + + template + void doSameEvent(PartitionType& sliceV01, PartitionType& sliceReso2, TableTracks const& parts, Collision const& col) + { + /// Histogramming for same event missing + + for (const auto& v0 : sliceV01) { + const auto& posChild = parts.iteratorAt(v0.index() - 2); + const auto& negChild = parts.iteratorAt(v0.index() - 1); + + if (((posChild.cut() & V01.childPosCutBit) == V01.childPosCutBit) && + ((posChild.pidcut() & V01.childPosTPCBit) == V01.childPosTPCBit) && + ((negChild.cut() & V01.childNegCutBit) == V01.childNegCutBit) && + ((negChild.pidcut() & V01.childNegTPCBit) == V01.childNegTPCBit)) { + v0HistoPartOne.fillQA(v0, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); // fillQA, here IsDebug == true, false?? + posChildHistos.fillQA(posChild, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + negChildHistos.fillQA(negChild, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + } + } + + for (const auto& reso : sliceReso2) { + const auto& posresoChild = parts.iteratorAt(reso.index() - 2); + const auto& negresoChild = parts.iteratorAt(reso.index() - 1); + + if (ncheckbit(posresoChild.cut(), Reso2.daughPosCutBit)) { + resoposChildHistos.fillQA(posresoChild, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + } + + if (ncheckbit(negresoChild.cut(), Reso2.daughNegCutBit)) { + resonegChildHistos.fillQA(negresoChild, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); + } + + if (((posresoChild.cut() & Reso2.daughPosCutBit) == Reso2.daughPosCutBit) && + ((negresoChild.cut() & Reso2.daughNegCutBit) == Reso2.daughNegCutBit)) { + resoHistoPartTwo.fillQA(reso, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); // improve + } + } + + /// build particle combinations + for (auto const& [p1, p2] : combinations(CombinationsFullIndexPolicy(sliceV01, sliceReso2))) { + + const auto& posChild = parts.iteratorAt(p1.index() - 2); + const auto& negChild = parts.iteratorAt(p1.index() - 1); + + const auto& posresoChild = parts.iteratorAt(p2.index() - 2); + const auto& negresoChild = parts.iteratorAt(p2.index() - 1); + + if (((posChild.cut() & V01.childPosCutBit) == V01.childPosCutBit) && + ((posChild.pidcut() & V01.childPosTPCBit) == V01.childPosTPCBit) && + ((negChild.cut() & V01.childNegCutBit) == V01.childNegCutBit) && + ((negChild.pidcut() & V01.childNegTPCBit) == V01.childNegTPCBit) && + + ((posresoChild.cut() & Reso2.daughPosCutBit) == Reso2.daughPosCutBit) && + ((negresoChild.cut() & Reso2.daughNegCutBit) == Reso2.daughNegCutBit)) { + + if (Option.cPROn.value) { + if (pairCloseRejectionSE.isClosePair(p1, p2, parts, col.magField())) { + continue; + } + } + sameEventCont.setPair(p1, p2, col.multNtr(), col.multV0M(), Option.use4D, Option.extendedPlots, Option.smearingByOrigin); + } + } + } + + template + void doMixedEvent(CollisionType const& cols, PartType const& parts, PartitionType& part1, PartitionType& part2, BinningType policy) + { + + if (Option.mixEventWithPairs.value) { + for (auto const& [collision1, collision2] : soa::selfCombinations(policy, Mixing.depth.value, -1, cols, cols)) { + // make sure that tracks in same events are not mixed + if (collision1.globalIndex() == collision2.globalIndex()) { + continue; + } + + auto sliceV01 = part1.sliceByCached(aod::femtodreamparticle::fdCollisionId, collision1.globalIndex(), cache); // maybe use . + auto sliceReso2 = part2.sliceByCached(aod::femtodreamparticle::fdCollisionId, collision2.globalIndex(), cache); + + if (sliceV01.size() == 0 || sliceReso2.size() == 0) { + continue; + } + + for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(sliceV01, sliceReso2))) { + + const auto& posChild = parts.iteratorAt(p1.index() - 2); + const auto& negChild = parts.iteratorAt(p1.index() - 1); + + const auto& posresoChild = parts.iteratorAt(p2.index() - 2); + const auto& negresoChild = parts.iteratorAt(p2.index() - 1); + + // why pass if fullfilled?? + if ((((posChild.cut() & V01.childPosCutBit) == V01.childPosCutBit) && + ((posChild.pidcut() & V01.childPosTPCBit) == V01.childPosTPCBit) && + ((negChild.cut() & V01.childNegCutBit) == V01.childNegCutBit) && + ((negChild.pidcut() & V01.childNegTPCBit) == V01.childNegTPCBit) && + + ((posresoChild.cut() & Reso2.daughPosCutBit) == Reso2.daughPosCutBit) && + ((negresoChild.cut() & Reso2.daughNegCutBit) == Reso2.daughNegCutBit))) { + + if (Option.cPROn.value) { + if (pairCloseRejectionME.isClosePair(p1, p2, parts, collision1.magField())) { + continue; + } + } + mixedEventCont.setPair(p1, p2, collision1.multNtr(), collision1.multV0M(), Option.use4D, Option.extendedPlots, Option.smearingByOrigin); + } + } + } + } + } + + void processSameEvent(const FilteredCollision& col, const FDParticles& parts) // try this. + { + // fillCollision(col); + auto sliceV01 = partitionV01.sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); // maybe use . + auto sliceReso2 = partitionReso2.sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); + + // if (sliceV01.size() == 0 && sliceReso2.size() == 0) { + // return; + // } + eventHisto.fillQA(col); + doSameEvent(sliceV01, sliceReso2, parts, col); + } + PROCESS_SWITCH(FemtoDreamPairTaskV0Reso, processSameEvent, "Enable processing same event", true); + + void processMixedEvent(const FilteredCollisions& cols, const FDParticles& parts) + { + + switch (Mixing.policy.value) { + case femtodreamcollision::kMult: + doMixedEvent(cols, parts, partitionV01, partitionReso2, colBinningMult); + break; + case femtodreamcollision::kMultPercentile: + doMixedEvent(cols, parts, partitionV01, partitionReso2, colBinningMultPercentile); + break; + case femtodreamcollision::kMultMultPercentile: + doMixedEvent(cols, parts, partitionV01, partitionReso2, colBinningMultMultPercentile); + break; + default: + LOG(fatal) << "Invalid binning policiy specifed. Breaking..."; + } + } + PROCESS_SWITCH(FemtoDreamPairTaskV0Reso, processMixedEvent, "Enable processing mixed event", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{ + adaptAnalysisTask(cfgc), + }; + return workflow; +} From 3718a3d7260b80402a13047081deae17a0bedef0 Mon Sep 17 00:00:00 2001 From: Peter Stratmann <80676312+pestratm@users.noreply.github.com> Date: Mon, 6 Oct 2025 16:58:07 +0200 Subject: [PATCH 640/986] [PWGJE] Simulate hadron decay (#12615) --- PWGJE/Tasks/CMakeLists.txt | 17 +- PWGJE/Tasks/hadronPhotonCorrelation.cxx | 319 +++++++++++++++++++++--- 2 files changed, 296 insertions(+), 40 deletions(-) diff --git a/PWGJE/Tasks/CMakeLists.txt b/PWGJE/Tasks/CMakeLists.txt index f4d3dff0ce9..e264dc4032c 100644 --- a/PWGJE/Tasks/CMakeLists.txt +++ b/PWGJE/Tasks/CMakeLists.txt @@ -38,10 +38,6 @@ o2physics_add_dpl_workflow(emc-tmmonitor SOURCES emcTmMonitor.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(hadron-photon-correlation - SOURCES hadronPhotonCorrelation.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore - COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(mc-generator-studies SOURCES mcGeneratorStudies.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::AnalysisCore @@ -331,3 +327,16 @@ if(FastJet_FOUND) PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) endif() + +if(pythia_FOUND) + if(TARGET ROOT::EGPythia8) + set_target_properties(ROOT::EGPythia8 PROPERTIES + INTERFACE_LINK_LIBRARIES "ROOT::Core;ROOT::EG;ROOT::Graf;ROOT::Physics;${pythia_LIBRARY_SHARED}" + ) + + o2physics_add_dpl_workflow(hadron-photon-correlation + SOURCES hadronPhotonCorrelation.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore ROOT::EGPythia8 + COMPONENT_NAME Analysis) + endif() +endif() \ No newline at end of file diff --git a/PWGJE/Tasks/hadronPhotonCorrelation.cxx b/PWGJE/Tasks/hadronPhotonCorrelation.cxx index bd6496f2296..b50953eaa17 100644 --- a/PWGJE/Tasks/hadronPhotonCorrelation.cxx +++ b/PWGJE/Tasks/hadronPhotonCorrelation.cxx @@ -29,17 +29,21 @@ #include "CommonConstants/MathConstants.h" #include "Framework/ASoA.h" #include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisHelpers.h" #include "Framework/AnalysisTask.h" #include "Framework/Configurable.h" #include "Framework/Expressions.h" #include "Framework/HistogramRegistry.h" #include "Framework/HistogramSpec.h" +#include "Framework/InitContext.h" #include "Framework/O2DatabasePDGPlugin.h" -#include -#include -#include +#include "Framework/runDataProcessing.h" +#include +#include // o2-linter: disable= root/lorentz-vector (TLorentzVector is needed for TPythia8Decayer) #include +#include +#include #include #include @@ -60,12 +64,19 @@ struct HadronPhotonCorrelation { Configurable eventSelections{"eventSelections", "sel8", "choose event selection"}; Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; Configurable subGeneratorIdSelections{"subGeneratorIdSelections", -1, "set sub generator id"}; + Configurable hardQCDgg2gg{"hardQCDgg2gg", true, "include gg2gg process in hardQCD"}; Configurable tpcNClsCrossedRows{"tpcNClsCrossedRows", 70, "tpcNClsCrossedRows"}; Configurable tpcCrossedRowsOverFindableCls{"tpcCrossedRowsOverFindableCls", 0.8, "tpcCrossedRowsOverFindableCls"}; Configurable tpcNSigmaPi{"tpcNSigmaPi", 2., "tpcNSigmaPi"}; + Configurable pTHatMin{"pTHatMin", 5, "minimum pTHat cut"}; + Configurable pTHatMax{"pTHatMax", 600, "minimum pTHat cut"}; + const int pidCodeHadronCut = 100; + const int pythiaCodeIncomingHard = 21; + const int pythiaCodeOutgoingHard = 23; + const int pythiaCodeOutgoingDiff = 15; Configurable etaMaxTrig{"etaMaxTrig", 0.8, "maximum eta cut for triggers"}; Configurable etaMaxAssoc{"etaMaxAssoc", 0.8, "maximum eta cut for associateds"}; @@ -73,7 +84,14 @@ struct HadronPhotonCorrelation { Configurable etaBinsAssoc{"etaBinsAssoc", 40, "number of eta bins for associateds"}; Configurable phiBins{"phiBins", 72, "number of phi bins"}; - AxisSpec axisEventStats = {3, -.5, 2.5, "Stats"}; + // remove this comment + AxisSpec axisEventStats = {6, -.5, 5.5, "Stats"}; + ConfigurableAxis axisPtHat = {"axisPtHat", + {VARIABLE_WIDTH, 0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, + 1., 2., 3., 4., 5., 6., 7., 8., 9., + 10., 20., 30., 40., 50., 60., 70., 80., 90., + 100., 200., 300., 400., 500., 600., 700., 800., 900., 1000.}, + "p_{T}^{#hat}"}; ConfigurableAxis axisPtTrig = {"axisPtTrig", {VARIABLE_WIDTH, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 9.0f, 11.0f, 15.0f, 20.0f}, @@ -81,9 +99,10 @@ struct HadronPhotonCorrelation { ConfigurableAxis axisPtAssoc = {"axisPtAssoc", {VARIABLE_WIDTH, 0.2, 0.5, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 9.0f, 11.0f, 15.0f}, - "p_{T, assoc} [GeV]"}; // Axis for associated particle pt distribution - ConfigurableAxis axisDeltaPt = {"axisDeltaPt", {200, 0., 1.2}, "#Delta p_T"}; // Axis for pt ratio between neutral hadrons and decay photons - AxisSpec axisPid = {10, -3.5, 6.5, "pid"}; // Axis for PID of neutral hadrons + "p_{T, assoc} [GeV]"}; // Axis for associated particle pt distribution + ConfigurableAxis axisDeltaPt = {"axisDeltaPt", {200, 0., 1.2}, "#Delta p_T"}; // Axis for pt ratio between neutral hadrons and decay photons + int nHadrons = 6; + AxisSpec axisPid = {10, -3.5, nHadrons + 0.5, "pid"}; // Axis for PID of neutral hadrons ConfigurableAxis axisMult = {"axisMult", {100, 0., 99.}, "N_{ch}"}; // Axis for mutplipicity AxisSpec axisAlpha = {100, 0., 1., "alpha"}; // Axis for decay photon pt assymetry ConfigurableAxis axisDeltaRDecay = {"axisDeltaRDecay", {400, 0., 3.2}, "#Delta R"}; // Axis for Delta R = sqrt(Delta eta^2 + Delta phi^2) between neutral hadrons and decay photons @@ -93,18 +112,30 @@ struct HadronPhotonCorrelation { float ptMinAssoc; float ptMaxAssoc; + TPythia8Decayer* decayer = new TPythia8Decayer; + TLorentzVector* motherLV = new TLorentzVector(); // o2-linter: disable= root/lorentz-vector (TLorentzVector is needed for TPythia8Decayer) + TClonesArray* decayParticles = new TClonesArray("TParticle", 10); + HistogramRegistry registry{"histogram registry"}; // Particle ids for storing neutral hadrons std::map pidCodes = { - {"pi0", 1}, // pi0 - {"eta", 2}, // eta - {"eta'", 3}, // eta' - {"phi", 4}, // phi - {"omega", 5}, // omega - {"Sigma0", 6}, // Sigma + {"pi0", 1}, // pi0 + {"eta", 2}, // eta + {"eta'", 3}, // eta' + {"phi", 4}, // phi + {"omega", 5}, // omega + //{"Sigma0", 6}, // Sigma {"Sigma0_bar", 6}}; + std::map pidToPdg = { + {1, 111}, // pi0 + {2, 221}, // eta + {3, 331}, // eta' + {4, 333}, // phi + {5, 223}, // omega + {6, 3212}}; // Sigma + Service pdg; std::vector eventSelectionBits; @@ -128,55 +159,179 @@ struct HadronPhotonCorrelation { // Generated histograms registry.add("generated/events/hEventStats", "Event statistics", kTH1F, {axisEventStats}); + registry.get(HIST("generated/events/hEventStats"))->Sumw2(); + registry.add("generated/events/hPtHat", "pT of hard collision", kTH1F, {axisPtHat}); + registry.get(HIST("generated/events/hPtHat"))->Sumw2(); // Triggers registry.add("generated/triggers/hTrigMultGen", "Generated Trigger Multiplicity", kTH1F, {axisMult}); + registry.get(HIST("generated/triggers/hTrigMultGen"))->Sumw2(); registry.add("generated/triggers/hTrigSpectrumGen", "Generated Trigger Spectrum", kTHnSparseF, {axisPtTrig, axisEtaTrig, axisPhi}); + registry.get(HIST("generated/triggers/hTrigSpectrumGen"))->Sumw2(); // Hadrons registry.add("generated/hadrons/hHadronCorrelGen", "Generated Trigger-Hadron Correlation", kTHnSparseF, {axisPtTrig, axisPtAssoc, axisDeltaEta, axisDeltaPhi}); + registry.get(HIST("generated/hadrons/hHadronCorrelGen"))->Sumw2(); registry.add("generated/hadrons/hHadronMultGen", "Generated Hadron Multiplicity", kTH1F, {axisMult}); + registry.get(HIST("generated/hadrons/hHadronMultGen"))->Sumw2(); registry.add("generated/hadrons/hHadronSpectrumGen", "Generated Hadron Spectrum", kTHnSparseF, {axisPtAssoc, axisEtaAssoc, axisPhi}); + registry.get(HIST("generated/hadrons/hHadronSpectrumGen"))->Sumw2(); // Photons registry.add("generated/photons/hPhotonCorrelGen", "Generated Trigger-Photon Correlation", kTHnSparseF, {axisPtTrig, axisPtAssoc, axisDeltaEta, axisDeltaPhi, axisPid}); + registry.get(HIST("generated/photons/hPhotonCorrelGen"))->Sumw2(); registry.add("generated/photons/hPhotonMultGen", "Generated Photon Multiplicity", kTH1F, {axisMult}); + registry.get(HIST("generated/photons/hPhotonMultGen"))->Sumw2(); registry.add("generated/photons/hPhotonSpectrumGen", "Generated Photon Spectrum", kTHnSparseF, {axisPtAssoc, axisEtaAssoc, axisPhi, axisPid}); + registry.get(HIST("generated/photons/hPhotonSpectrumGen"))->Sumw2(); // Charged pions registry.add("generated/charged/hPionCorrelGen", "Generated Trigger-Pion Correlation", kTHnSparseF, {axisPtTrig, axisPtAssoc, axisDeltaEta, axisDeltaPhi}); + registry.get(HIST("generated/charged/hPionCorrelGen"))->Sumw2(); registry.add("generated/charged/hPionMultGen", "Generated Pion Multiplicity", kTH1F, {axisMult}); + registry.get(HIST("generated/charged/hPionMultGen"))->Sumw2(); registry.add("generated/charged/hPionSpectrumGen", "Generated Pion Spectrum", kTHnSparseF, {axisPtAssoc, axisEtaAssoc, axisPhi}); + registry.get(HIST("generated/charged/hPionSpectrumGen"))->Sumw2(); + registry.add("generated/charged/hCocktailPhotonCorrelGen", "Cocktail Photon from Pion-Hadron Correlation", kTHnSparseF, {axisPtTrig, axisPtAssoc, axisPtAssoc, axisDeltaEta, axisDeltaPhi, axisPid}); + registry.get(HIST("generated/charged/hCocktailPhotonCorrelGen"))->Sumw2(); + registry.add("generated/charged/hCocktailPhotonSpectrumGen", "Cocktail Photon from Pion Spectrum", kTHnSparseF, {axisPtAssoc, axisPtAssoc, axisEtaAssoc, axisPhi, axisPid}); + registry.get(HIST("generated/charged/hCocktailPhotonSpectrumGen"))->Sumw2(); ////Neutral particles registry.add("generated/neutral/hNeutralCorrelGen", "Generated Trigger-Neutral Hadron Correlation", kTHnSparseF, {axisPtTrig, axisPtAssoc, axisDeltaEta, axisDeltaPhi, axisPid}); + registry.get(HIST("generated/neutral/hNeutralCorrelGen"))->Sumw2(); registry.add("generated/neutral/hNeutralMultGen", "Generated Neutral Hadron Multiplicity", kTH1F, {axisMult}); + registry.get(HIST("generated/neutral/hNeutralMultGen"))->Sumw2(); registry.add("generated/neutral/hNeutralSpectrumGen", "Generated Neutral Hadron Spectrum", kTHnSparseF, {axisPtAssoc, axisEtaAssoc, axisPhi, axisPid}); + registry.get(HIST("generated/neutral/hNeutralSpectrumGen"))->Sumw2(); registry.add("generated/neutral/hNeutralDecayGen", "Generated Neutral Hadron-Decay Photon Correlation", kTHnSparseF, {axisPtAssoc, axisDeltaPt, axisDeltaRDecay, axisAlpha, axisPid}); // Correlation with decay photons + registry.get(HIST("generated/neutral/hNeutralDecayGen"))->Sumw2(); + registry.add("generated/neutral/hCocktailPhotonCorrelGen", "Cocktail Photon from Hadron-Hadron Correlation", kTHnSparseF, {axisPtTrig, axisPtAssoc, axisPtAssoc, axisDeltaEta, axisDeltaPhi, axisPid}); + registry.get(HIST("generated/neutral/hCocktailPhotonCorrelGen"))->Sumw2(); + registry.add("generated/neutral/hCocktailPhotonSpectrumGen", "Cocktail Photon from Hadron Spectrum", kTHnSparseF, {axisPtAssoc, axisPtAssoc, axisEtaAssoc, axisPhi, axisPid}); + registry.get(HIST("generated/neutral/hCocktailPhotonSpectrumGen"))->Sumw2(); // Reconstructed histograms registry.add("reconstructed/events/hEventStats", "Event statistics", kTH1F, {axisEventStats}); + registry.get(HIST("reconstructed/events/hEventStats"))->Sumw2(); // Triggers registry.add("reconstructed/triggers/hTrigMultReco", "Reconstructed Trigger Multiplicity", kTH1F, {axisMult}); + registry.get(HIST("reconstructed/triggers/hTrigMultReco"))->Sumw2(); registry.add("reconstructed/triggers/hTrigSpectrumReco", "Reconstructed Trigger Spectrum", kTHnSparseF, {axisPtTrig, axisEtaTrig, axisPhi}); + registry.get(HIST("reconstructed/triggers/hTrigSpectrumReco"))->Sumw2(); // Hadrons registry.add("reconstructed/hadrons/hHadronCorrelReco", "Reconstructed Trigger-Hadron Correlation", kTHnSparseF, {axisPtTrig, axisPtAssoc, axisDeltaEta, axisDeltaPhi}); + registry.get(HIST("reconstructed/hadrons/hHadronCorrelReco"))->Sumw2(); registry.add("reconstructed/hadrons/hHadronMultReco", "Reconstructed Hadron Multiplicity", kTH1F, {axisMult}); + registry.get(HIST("reconstructed/hadrons/hHadronMultReco"))->Sumw2(); registry.add("reconstructed/hadrons/hHadronSpectrumReco", "Reconstructed Hadron Spectrum", kTHnSparseF, {axisPtAssoc, axisEtaAssoc, axisPhi}); - registry.add("reconstructed/hadrons/hHadronPtPrimReco", "Reconstructed Primaries Spectrum", kTH1F, {axisPtAssoc}); // Primary hadron spectrum + registry.get(HIST("reconstructed/hadrons/hHadronSpectrumReco"))->Sumw2(); + registry.add("reconstructed/hadrons/hHadronPtPrimReco", "Reconstructed Primaries Spectrum", kTH1F, {axisPtAssoc}); // Primary hadron spectrum + registry.get(HIST("reconstructed/hadrons/hHadronPtPrimReco"))->Sumw2(); registry.add("reconstructed/hadrons/hHadronPtSecReco", "Reconstructed Secondaries Spectrum", kTH1F, {axisPtAssoc}); // Secondary hadron spectrum + registry.get(HIST("reconstructed/hadrons/hHadronPtSecReco"))->Sumw2(); // Photons registry.add("reconstructed/photons/hPhotonCorrelReco", "Reconstructed Trigger-Photon Correlation", kTHnSparseF, {axisPtTrig, axisPtAssoc, axisDeltaEta, axisDeltaPhi}); + registry.get(HIST("reconstructed/photons/hPhotonCorrelReco"))->Sumw2(); registry.add("reconstructed/photons/hPhotonMultReco", "Reconstructed Photon Multiplicity", kTH1F, {axisMult}); + registry.get(HIST("reconstructed/photons/hPhotonMultReco"))->Sumw2(); registry.add("reconstructed/photons/hPhotonSpectrumReco", "Reconstructed Photon Spectrum", kTHnSparseF, {axisPtAssoc, axisEtaAssoc, axisPhi}); + registry.get(HIST("reconstructed/photons/hPhotonSpectrumReco"))->Sumw2(); // Charged Pions registry.add("reconstructed/charged/hPionCorrelReco", "Reconstructed Trigger-Pion Correlation", kTHnSparseF, {axisPtTrig, axisPtAssoc, axisDeltaEta, axisDeltaPhi}); + registry.get(HIST("reconstructed/charged/hPionCorrelReco"))->Sumw2(); registry.add("reconstructed/charged/hPionMultReco", "Reconstructed Pion Multiplicity", kTH1F, {axisMult}); + registry.get(HIST("reconstructed/charged/hPionMultReco"))->Sumw2(); registry.add("reconstructed/charged/hPionSpectrumReco", "Reconstructed Pion Spectrum", kTHnSparseF, {axisPtAssoc, axisEtaAssoc, axisPhi}); + registry.get(HIST("reconstructed/charged/hPionSpectrumReco"))->Sumw2(); + } + + // Get pTHat of the event + template + double getCollisionPtHat(const P& particles) + { + double pTHat = 0; + bool isDiffractive = false; + + for (const auto& particle : particles) { + + if (std::abs(particle.getGenStatusCode()) == pythiaCodeOutgoingHard && !isDiffractive) { + if (particle.pt() > pTHat) { + pTHat = particle.pt(); + } + } + if (std::abs(particle.getGenStatusCode()) == pythiaCodeOutgoingDiff) { + if (isDiffractive) { + if (particle.pt() > pTHat) { + pTHat = particle.pt(); + } + } else { + pTHat = particle.pt(); + isDiffractive = true; + } + } + } + + return pTHat; + } + + template + bool rejectOutliers(const P& particles, double pTHat) + { + if (subGeneratorIdSelections == 0) { + return false; + } + + for (const auto& particle : particles) { + if (particle.getGenStatusCode() > 0 && particle.pt() > pTHat) { + return true; + } + } + + return false; + } + + // If event is a HardQCD gg->gg event (which is not implemented in POWHEG directphoton) + template + bool isHardQCDgg2gg(const P& particles) + { + for (const auto& particle : particles) { + if (std::abs(particle.getGenStatusCode()) == pythiaCodeIncomingHard && (PDG_t)std::abs(particle.pdgCode()) != kGluon) { + return false; + } + if (std::abs(particle.getGenStatusCode()) == pythiaCodeOutgoingHard && (PDG_t)std::abs(particle.pdgCode()) != kGluon) { + return false; + } + } + return true; + } + + // Initialize collision + template + bool initCollisionMC(const C& collision, const P& particles) + { + if (collision.subGeneratorId() != subGeneratorIdSelections) { + return false; + } + + double pTHat = getCollisionPtHat(particles); + if (pTHat < pTHatMin || pTHat > pTHatMax) { + return false; + } + + if (rejectOutliers(particles, pTHat)) { + return false; + } + + if (!hardQCDgg2gg && isHardQCDgg2gg(particles)) { + return false; + } + + return true; } // To check if object has has_mcParticle() (i.e. is MC Track or data track) @@ -235,6 +390,29 @@ struct HadronPhotonCorrelation { return true; } + // Initialize Pythia8 decay particle + bool initDecayParticle(const TParticle* particle) + { + + if (particle->GetMother(0) != 0) { + return false; + } + + if ((PDG_t)std::abs(particle->GetPdgCode()) != kGamma) { + return false; + } + + if (std::abs(particle->Eta()) > etaMaxAssoc) { + return false; + } + + if (particle->Pt() < ptMinAssoc || particle->Pt() > ptMaxAssoc) { + return false; + } + + return true; + } + // Initialize trigger tracks template bool initTrig(const T& track) @@ -319,32 +497,45 @@ struct HadronPhotonCorrelation { /**************************************************************************************************** ************************************************ EVENTS ******************************************** ****************************************************************************************************/ - - void processEventsMCGen(JetMcCollision const& collision) + void processEventsMCGen(JetMcCollision const& collision, + JetParticles const& particles) { - if (collision.subGeneratorId() != subGeneratorIdSelections) { + if (collision.subGeneratorId() == subGeneratorIdSelections) { + registry.fill(HIST("generated/events/hEventStats"), 0); + registry.fill(HIST("generated/events/hEventStats"), 2, collision.weight()); + registry.fill(HIST("generated/events/hEventStats"), 4, collision.xsectGen()); + } + + if (!initCollisionMC(collision, particles)) { return; } - registry.fill(HIST("generated/events/hEventStats"), 0); - registry.fill(HIST("generated/events/hEventStats"), 1, collision.weight()); - registry.fill(HIST("generated/events/hEventStats"), 2, collision.xsectGen()); + registry.fill(HIST("generated/events/hEventStats"), 1); + registry.fill(HIST("generated/events/hEventStats"), 3, collision.weight()); + registry.fill(HIST("generated/events/hEventStats"), 5, collision.xsectGen()); + + registry.fill(HIST("generated/events/hPtHat"), getCollisionPtHat(particles)); } PROCESS_SWITCH(HadronPhotonCorrelation, processEventsMCGen, "event stats MC gen", true); void processEventsMCReco(JetCollisionMCD const& collision, - JetMcCollisions const&) + JetMcCollisions const&, + JetParticles const&) { - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, false)) { + if (collision.subGeneratorId() != subGeneratorIdSelections) { return; } - if (collision.subGeneratorId() != subGeneratorIdSelections) { + registry.fill(HIST("reconstructed/events/hEventStats"), 0); + registry.fill(HIST("reconstructed/events/hEventStats"), 2, collision.mcCollision().weight()); + registry.fill(HIST("reconstructed/events/hEventStats"), 4, collision.mcCollision().xsectGen()); + + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, false)) { return; } - registry.fill(HIST("reconstructed/events/hEventStats"), 0); - registry.fill(HIST("reconstructed/events/hEventStats"), 1, collision.mcCollision().weight()); - registry.fill(HIST("reconstructed/events/hEventStats"), 2, collision.mcCollision().xsectGen()); + registry.fill(HIST("reconstructed/events/hEventStats"), 1); + registry.fill(HIST("reconstructed/events/hEventStats"), 3, collision.mcCollision().weight()); + registry.fill(HIST("reconstructed/events/hEventStats"), 5, collision.mcCollision().xsectGen()); } PROCESS_SWITCH(HadronPhotonCorrelation, processEventsMCReco, "event stats MC reco", true); @@ -411,7 +602,7 @@ struct HadronPhotonCorrelation { void processTrigsMCGen(JetMcCollision const& collision, JetParticles const& particles) { - if (collision.subGeneratorId() != subGeneratorIdSelections) { + if (!initCollisionMC(collision, particles)) { return; } @@ -514,7 +705,7 @@ struct HadronPhotonCorrelation { void processPhotonCorrelationsMCGen(JetMcCollision const& collision, JetParticles const& tracks_true) { - if (collision.subGeneratorId() != subGeneratorIdSelections) { + if (!initCollisionMC(collision, tracks_true)) { return; } @@ -570,9 +761,6 @@ struct HadronPhotonCorrelation { if (!initTrigParticle(track_trig)) { continue; } - if (!initParticle(track_assoc)) { - continue; - } float dphi = RecoDecay::constrainAngle(track_assoc.phi() - track_trig.phi(), -PIHalf); registry.fill(HIST("generated/photons/hPhotonCorrelGen"), track_trig.pt(), track_assoc.pt(), track_assoc.eta() - track_trig.eta(), dphi, photonGeneration, collision.weight()); } @@ -617,7 +805,7 @@ struct HadronPhotonCorrelation { continue; } float dphi = RecoDecay::constrainAngle(track_assoc.phi() - track_trig.phi(), -PIHalf); - registry.fill(HIST("reconstructed/hadrons/hadrons/hHadronCorrelReco"), track_trig.pt(), track_assoc.pt(), track_assoc.eta() - track_trig.eta(), dphi); + registry.fill(HIST("reconstructed/hadrons/hHadronCorrelReco"), track_trig.pt(), track_assoc.pt(), track_assoc.eta() - track_trig.eta(), dphi); } } registry.fill(HIST("reconstructed/hadrons/hHadronMultReco"), nHadrons); @@ -629,7 +817,7 @@ struct HadronPhotonCorrelation { void processHadronCorrelationsMCGen(JetMcCollision const& collision, JetParticles const& tracks_true) { - if (collision.subGeneratorId() != subGeneratorIdSelections) { + if (!initCollisionMC(collision, tracks_true)) { return; } @@ -773,7 +961,7 @@ struct HadronPhotonCorrelation { void processPionCorrelationsMCGen(JetMcCollision const& collision, JetParticles const& tracks_true) { - if (collision.subGeneratorId() != subGeneratorIdSelections) { + if (!initCollisionMC(collision, tracks_true)) { return; } @@ -789,6 +977,7 @@ struct HadronPhotonCorrelation { registry.fill(HIST("generated/charged/hPionSpectrumGen"), track_assoc.pt(), track_assoc.eta(), track_assoc.phi(), collision.weight()); nPions++; + // Get correlations for (const auto& track_trig : tracks_true) { if (!initTrigParticle(track_trig)) { continue; @@ -800,6 +989,40 @@ struct HadronPhotonCorrelation { registry.fill(HIST("generated/charged/hPionCorrelGen"), track_trig.pt(), track_assoc.pt(), track_assoc.eta() - track_trig.eta(), dphi, collision.weight()); } + + // Use PYTHIA to simulate decay + decayer->Init(); + for (int pid = 1; pid <= nHadrons; pid++) { + TParticlePDG* pdgParticle = nullptr; + + auto it = pidToPdg.find(pid); + if (it != pidToPdg.end()) { + pdgParticle = pdg->GetParticle(it->second); + } else { + continue; + } + + motherLV->SetPtEtaPhiM(track_assoc.pt(), track_assoc.eta(), track_assoc.phi(), pdgParticle->Mass()); + decayer->Decay(pdgParticle->PdgCode(), motherLV); + decayer->ImportParticles(decayParticles); + for (int i = 0; i < decayParticles->GetEntriesFast(); ++i) { + TParticle* daughter = static_cast(decayParticles->At(i)); + + if (!initDecayParticle(daughter)) { + continue; + } + + registry.fill(HIST("generated/charged/hCocktailPhotonSpectrumGen"), track_assoc.pt(), daughter->Pt(), daughter->Eta(), daughter->Phi(), pidCodes[pdgParticle->GetName()], collision.weight()); + + for (const auto& track_trig : tracks_true) { + if (!initTrigParticle(track_trig)) { + continue; + } + float dphi = RecoDecay::constrainAngle(daughter->Phi() - track_trig.phi(), -PIHalf); + registry.fill(HIST("generated/charged/hCocktailPhotonCorrelGen"), track_trig.pt(), track_assoc.pt(), daughter->Pt(), daughter->Eta() - track_trig.eta(), dphi, pidCodes[pdgParticle->GetName()], collision.weight()); + } + } + } } registry.fill(HIST("generated/charged/hPionMultGen"), nPions, collision.weight()); } @@ -861,7 +1084,7 @@ struct HadronPhotonCorrelation { void processNeutralCorrelationsMCGen(JetMcCollision const& collision, JetParticles const& tracks_true) { - if (collision.subGeneratorId() != subGeneratorIdSelections) { + if (!initCollisionMC(collision, tracks_true)) { return; } @@ -877,9 +1100,10 @@ struct HadronPhotonCorrelation { if (pdgParticle->Charge() != 0.) { continue; } // remove charged particles - if (track_assoc.pdgCode() < pidCodeHadronCut || (PDG_t)track_assoc.pdgCode() == kNeutron) { + if (std::abs(track_assoc.pdgCode()) < pidCodeHadronCut || (PDG_t)track_assoc.pdgCode() == kNeutron) { continue; } // remove non-hadrons and neutrons + registry.fill(HIST("generated/neutral/hNeutralSpectrumGen"), track_assoc.pt(), track_assoc.eta(), track_assoc.phi(), pidCodes[pdgParticle->GetName()], collision.weight()); nNeutrals++; @@ -918,6 +1142,29 @@ struct HadronPhotonCorrelation { float dphi = RecoDecay::constrainAngle(track_assoc.phi() - track_trig.phi(), -PIHalf); registry.fill(HIST("generated/neutral/hNeutralCorrelGen"), track_trig.pt(), track_assoc.pt(), track_assoc.eta() - track_trig.eta(), dphi, pidCodes[pdgParticle->GetName()], collision.weight()); } + + // Use PYTHIA to simulate decay + decayer->Init(); + motherLV->SetPtEtaPhiM(track_assoc.pt(), track_assoc.eta(), track_assoc.phi(), pdgParticle->Mass()); + decayer->Decay(track_assoc.pdgCode(), motherLV); + decayer->ImportParticles(decayParticles); + for (int i = 0; i < decayParticles->GetEntriesFast(); ++i) { + TParticle* daughter = static_cast(decayParticles->At(i)); + + if (!initDecayParticle(daughter)) { + continue; + } + + registry.fill(HIST("generated/neutral/hCocktailPhotonSpectrumGen"), track_assoc.pt(), daughter->Pt(), daughter->Eta(), daughter->Phi(), pidCodes[pdgParticle->GetName()], collision.weight()); + + for (const auto& track_trig : tracks_true) { + if (!initTrigParticle(track_trig)) { + continue; + } + float dphi = RecoDecay::constrainAngle(daughter->Phi() - track_trig.phi(), -PIHalf); + registry.fill(HIST("generated/neutral/hCocktailPhotonCorrelGen"), track_trig.pt(), track_assoc.pt(), daughter->Pt(), daughter->Eta() - track_trig.eta(), dphi, pidCodes[pdgParticle->GetName()], collision.weight()); + } + } } registry.fill(HIST("generated/neutral/hNeutralMultGen"), nNeutrals, collision.weight()); } From bb36e044e3ff3cb6b63367bd85541ed5a347e739 Mon Sep 17 00:00:00 2001 From: Junlee Kim Date: Tue, 7 Oct 2025 00:27:06 +0900 Subject: [PATCH 641/986] [Common] EventPlane: adding shift correction (#12967) Co-authored-by: ALICE Action Bot --- Common/DataModel/Qvectors.h | 37 +++++++ Common/TableProducer/qVectorsTable.cxx | 133 +++++++++++++++++++++- Common/Tasks/qVectorsCorrection.cxx | 148 ++++++++++++++++++++++++- 3 files changed, 315 insertions(+), 3 deletions(-) diff --git a/Common/DataModel/Qvectors.h b/Common/DataModel/Qvectors.h index d723d659bc5..4a750306cbf 100644 --- a/Common/DataModel/Qvectors.h +++ b/Common/DataModel/Qvectors.h @@ -51,6 +51,24 @@ DECLARE_SOA_COLUMN(QvecTPCnegImVec, qvecTPCnegImVec, std::vector); DECLARE_SOA_COLUMN(QvecTPCallReVec, qvecTPCallReVec, std::vector); DECLARE_SOA_COLUMN(QvecTPCallImVec, qvecTPCallImVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedRe, qvecShiftedRe, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedIm, qvecShiftedIm, std::vector); + +DECLARE_SOA_COLUMN(QvecShiftedFT0CReVec, qvecShiftedFT0CReVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedFT0CImVec, qvecShiftedFT0CImVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedFT0AReVec, qvecShiftedFT0AReVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedFT0AImVec, qvecShiftedFT0AImVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedFT0MReVec, qvecShiftedFT0MReVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedFT0MImVec, qvecShiftedFT0MImVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedFV0AReVec, qvecShiftedFV0AReVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedFV0AImVec, qvecShiftedFV0AImVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedTPCposReVec, qvecShiftedTPCposReVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedTPCposImVec, qvecShiftedTPCposImVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedTPCnegReVec, qvecShiftedTPCnegReVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedTPCnegImVec, qvecShiftedTPCnegImVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedTPCallReVec, qvecShiftedTPCallReVec, std::vector); +DECLARE_SOA_COLUMN(QvecShiftedTPCallImVec, qvecShiftedTPCallImVec, std::vector); + DECLARE_SOA_COLUMN(QvecFT0CRe, qvecFT0CRe, float); DECLARE_SOA_COLUMN(QvecFT0CIm, qvecFT0CIm, float); DECLARE_SOA_COLUMN(QvecFT0ARe, qvecFT0ARe, float); @@ -104,6 +122,9 @@ DECLARE_SOA_COLUMN(LabelsBTot, labelsBTot, std::vector); DECLARE_SOA_TABLE(Qvectors, "AOD", "QVECTORDEVS", //! Table with all Qvectors. qvec::Cent, qvec::IsCalibrated, qvec::QvecRe, qvec::QvecIm, qvec::QvecAmp); using Qvector = Qvectors::iterator; +DECLARE_SOA_TABLE(QvectorsShifteds, "AOD", "QVECTORSCDEVS", //! Table with all shifted Qvectors. + qvec::Cent, qvec::IsCalibrated, qvec::QvecShiftedRe, qvec::QvecShiftedIm, qvec::QvecAmp); +using QvectorShifted = QvectorsShifteds::iterator; DECLARE_SOA_TABLE(QvectorFT0Cs, "AOD", "QVECTORSFT0C", qvec::IsCalibrated, qvec::QvecFT0CRe, qvec::QvecFT0CIm, qvec::SumAmplFT0C); DECLARE_SOA_TABLE(QvectorFT0As, "AOD", "QVECTORSFT0A", qvec::IsCalibrated, qvec::QvecFT0ARe, qvec::QvecFT0AIm, qvec::SumAmplFT0A); @@ -121,6 +142,14 @@ DECLARE_SOA_TABLE(QvectorTPCposVecs, "AOD", "QVECTORSTPCPVEC", qvec::IsCalibrate DECLARE_SOA_TABLE(QvectorTPCnegVecs, "AOD", "QVECTORSTPCNVEC", qvec::IsCalibrated, qvec::QvecTPCnegReVec, qvec::QvecTPCnegImVec, qvec::NTrkTPCneg, qvec::LabelsTPCneg); DECLARE_SOA_TABLE(QvectorTPCallVecs, "AOD", "QVECTORSTPCAVEC", qvec::IsCalibrated, qvec::QvecTPCallReVec, qvec::QvecTPCallImVec, qvec::NTrkTPCall, qvec::LabelsTPCall); +DECLARE_SOA_TABLE(QvectorShiftedFT0CVecs, "AOD", "QVECSHIFTEDFT0C", qvec::IsCalibrated, qvec::QvecShiftedFT0CReVec, qvec::QvecShiftedFT0CImVec, qvec::SumAmplFT0C); +DECLARE_SOA_TABLE(QvectorShiftedFT0AVecs, "AOD", "QVECSHIFTEDFT0A", qvec::IsCalibrated, qvec::QvecShiftedFT0AReVec, qvec::QvecShiftedFT0AImVec, qvec::SumAmplFT0A); +DECLARE_SOA_TABLE(QvectorShiftedFT0MVecs, "AOD", "QVECSHIFTEDFT0M", qvec::IsCalibrated, qvec::QvecShiftedFT0MReVec, qvec::QvecShiftedFT0MImVec, qvec::SumAmplFT0M); +DECLARE_SOA_TABLE(QvectorShiftedFV0AVecs, "AOD", "QVECSHIFTEDFV0A", qvec::IsCalibrated, qvec::QvecShiftedFV0AReVec, qvec::QvecShiftedFV0AImVec, qvec::SumAmplFV0A); +DECLARE_SOA_TABLE(QvectorShiftedTPCposVecs, "AOD", "QVECSHIFTEDTPCP", qvec::IsCalibrated, qvec::QvecShiftedTPCposReVec, qvec::QvecShiftedTPCposImVec, qvec::NTrkTPCpos, qvec::LabelsTPCpos); +DECLARE_SOA_TABLE(QvectorShiftedTPCnegVecs, "AOD", "QVECSHIFTEDTPCN", qvec::IsCalibrated, qvec::QvecShiftedTPCnegReVec, qvec::QvecShiftedTPCnegImVec, qvec::NTrkTPCneg, qvec::LabelsTPCneg); +DECLARE_SOA_TABLE(QvectorShiftedTPCallVecs, "AOD", "QVECSHIFTEDTPCA", qvec::IsCalibrated, qvec::QvecShiftedTPCallReVec, qvec::QvecShiftedTPCallImVec, qvec::NTrkTPCall, qvec::LabelsTPCall); + using QvectorFT0C = QvectorFT0Cs::iterator; using QvectorFT0A = QvectorFT0As::iterator; using QvectorFT0M = QvectorFT0Ms::iterator; @@ -137,6 +166,14 @@ using QvectorTPCposVec = QvectorTPCposVecs::iterator; using QvectorTPCnegVec = QvectorTPCnegVecs::iterator; using QvectorTPCallVec = QvectorTPCallVecs::iterator; +using QvectorShiftedFT0CVec = QvectorShiftedFT0CVecs::iterator; +using QvectorShiftedFT0AVec = QvectorShiftedFT0AVecs::iterator; +using QvectorShiftedFT0MVec = QvectorShiftedFT0MVecs::iterator; +using QvectorShiftedFV0AVec = QvectorShiftedFV0AVecs::iterator; +using QvectorShiftedTPCposVec = QvectorShiftedTPCposVecs::iterator; +using QvectorShiftedTPCnegVec = QvectorShiftedTPCnegVecs::iterator; +using QvectorShiftedTPCallVec = QvectorShiftedTPCallVecs::iterator; + // Deprecated, will be removed in future after transition time // DECLARE_SOA_TABLE(QvectorBPoss, "AOD", "QVECTORSBPOS", qvec::IsCalibrated, qvec::QvecBPosRe, qvec::QvecBPosIm, qvec::NTrkBPos, qvec::LabelsBPos); DECLARE_SOA_TABLE(QvectorBNegs, "AOD", "QVECTORSBNEG", qvec::IsCalibrated, qvec::QvecBNegRe, qvec::QvecBNegIm, qvec::NTrkBNeg, qvec::LabelsBNeg); diff --git a/Common/TableProducer/qVectorsTable.cxx b/Common/TableProducer/qVectorsTable.cxx index d1d39acf3d4..58b569fec42 100644 --- a/Common/TableProducer/qVectorsTable.cxx +++ b/Common/TableProducer/qVectorsTable.cxx @@ -98,6 +98,9 @@ struct qVectorsTable { Configurable cfgGainEqPath{"cfgGainEqPath", "Users/j/junlee/Qvector/GainEq", "CCDB path for gain equalization constants"}; Configurable cfgQvecCalibPath{"cfgQvecCalibPath", "Analysis/EventPlane/QVecCorrections", "CCDB pasth for Q-vecteor calibration constants"}; + Configurable cfgShiftCorr{"cfgShiftCorr", false, "configurable flag for shift correction"}; + Configurable cfgShiftPath{"cfgShiftPath", "", "CCDB path for shift correction"}; + ConfigurableAxis cfgaxisFITamp{"cfgaxisFITamp", {1000, 0, 5000}, ""}; Configurable cfgUseFT0C{"cfgUseFT0C", false, "Initial value for using FT0C. By default obtained from DataModel."}; @@ -126,6 +129,15 @@ struct qVectorsTable { Produces qVectorTPCnegVec; Produces qVectorTPCallVec; + Produces qVectorShifted; + Produces qVectorFT0CShiftedVec; + Produces qVectorFT0AShiftedVec; + Produces qVectorFT0MShiftedVec; + Produces qVectorFV0AShiftedVec; + Produces qVectorTPCposShiftedVec; + Produces qVectorTPCnegShiftedVec; + Produces qVectorTPCallShiftedVec; + std::vector FT0RelGainConst{}; std::vector FV0RelGainConst{}; @@ -146,6 +158,7 @@ struct qVectorsTable { float cent; std::vector objQvec{}; + std::vector shiftprofile{}; // Deprecated, will be removed in future after transition time // Configurable cfgUseBPos{"cfgUseBPos", false, "Initial value for using BPos. By default obtained from DataModel."}; @@ -265,6 +278,19 @@ struct qVectorsTable { } objQvec.push_back(objqvec); } + + if (cfgShiftCorr) { + shiftprofile.clear(); + for (std::size_t i = 0; i < cfgnMods->size(); i++) { + int ind = cfgnMods->at(i); + fullPath = cfgShiftPath; + fullPath += "/v"; + fullPath += std::to_string(ind); + auto objshift = getForTsOrRun(fullPath, timestamp, runnumber); + shiftprofile.push_back(objshift); + } + } + fullPath = cfgGainEqPath; fullPath += "/FT0"; const auto objft0Gain = getForTsOrRun>(fullPath, timestamp, runnumber); @@ -560,6 +586,25 @@ struct qVectorsTable { std::vector qvecReTPCall{}; std::vector qvecImTPCall{}; + std::vector qvecShiftedRe{}; + std::vector qvecShiftedIm{}; + std::vector qvecShiftedAmp{}; + + std::vector qvecReShiftedFT0C{}; + std::vector qvecImShiftedFT0C{}; + std::vector qvecReShiftedFT0A{}; + std::vector qvecImShiftedFT0A{}; + std::vector qvecReShiftedFT0M{}; + std::vector qvecImShiftedFT0M{}; + std::vector qvecReShiftedFV0A{}; + std::vector qvecImShiftedFV0A{}; + std::vector qvecReShiftedTPCpos{}; + std::vector qvecImShiftedTPCpos{}; + std::vector qvecReShiftedTPCneg{}; + std::vector qvecImShiftedTPCneg{}; + std::vector qvecReShiftedTPCall{}; + std::vector qvecImShiftedTPCall{}; + auto bc = coll.bc_as(); int currentRun = bc.runNumber(); if (runNumber != currentRun) { @@ -577,8 +622,8 @@ struct qVectorsTable { IsCalibrated = false; } for (std::size_t id = 0; id < cfgnMods->size(); id++) { - int ind = cfgnMods->at(id); - CalQvec(ind, coll, tracks, qvecRe, qvecIm, qvecAmp, TrkTPCposLabel, TrkTPCnegLabel, TrkTPCallLabel); + int nmode = cfgnMods->at(id); + CalQvec(nmode, coll, tracks, qvecRe, qvecIm, qvecAmp, TrkTPCposLabel, TrkTPCnegLabel, TrkTPCallLabel); if (cent < cfgMaxCentrality) { for (auto i{0u}; i < kTPCall + 1; i++) { helperEP.DoRecenter(qvecRe[(kTPCall + 1) * 4 * id + i * 4 + 1], qvecIm[(kTPCall + 1) * 4 * id + i * 4 + 1], @@ -596,6 +641,79 @@ struct qVectorsTable { helperEP.DoRescale(qvecRe[(kTPCall + 1) * 4 * id + i * 4 + 3], qvecIm[(kTPCall + 1) * 4 * id + i * 4 + 3], objQvec.at(id)->GetBinContent(static_cast(cent) + 1, 5, i + 1), objQvec.at(id)->GetBinContent(static_cast(cent) + 1, 6, i + 1)); } + if (cfgShiftCorr) { + auto deltapsiFT0C = 0.0; + auto deltapsiFT0A = 0.0; + auto deltapsiFT0M = 0.0; + auto deltapsiFV0A = 0.0; + auto deltapsiTPCpos = 0.0; + auto deltapsiTPCneg = 0.0; + auto deltapsiTPCall = 0.0; + + auto psidefFT0C = TMath::ATan2(qvecIm[(kTPCall + 1) * 4 * id + kFT0C * 4 + 3], qvecRe[(kTPCall + 1) * 4 * id + kFT0C * 4 + 3]) / static_cast(nmode); + auto psidefFT0A = TMath::ATan2(qvecIm[(kTPCall + 1) * 4 * id + kFT0A * 4 + 3], qvecRe[(kTPCall + 1) * 4 * id + kFT0A * 4 + 3]) / static_cast(nmode); + auto psidefFT0M = TMath::ATan2(qvecIm[(kTPCall + 1) * 4 * id + kFT0M * 4 + 3], qvecRe[(kTPCall + 1) * 4 * id + kFT0M * 4 + 3]) / static_cast(nmode); + auto psidefFV0A = TMath::ATan2(qvecIm[(kTPCall + 1) * 4 * id + kFV0A * 4 + 3], qvecRe[(kTPCall + 1) * 4 * id + kFV0A * 4 + 3]) / static_cast(nmode); + auto psidefTPCpos = TMath::ATan2(qvecIm[(kTPCall + 1) * 4 * id + kTPCpos * 4 + 3], qvecRe[(kTPCall + 1) * 4 * id + kTPCpos * 4 + 3]) / static_cast(nmode); + auto psidefTPCneg = TMath::ATan2(qvecIm[(kTPCall + 1) * 4 * id + kTPCneg * 4 + 3], qvecRe[(kTPCall + 1) * 4 * id + kTPCneg * 4 + 3]) / static_cast(nmode); + auto psidefTPCall = TMath::ATan2(qvecIm[(kTPCall + 1) * 4 * id + kTPCall * 4 + 3], qvecRe[(kTPCall + 1) * 4 * id + kTPCall * 4 + 3]) / static_cast(nmode); + + for (int ishift = 1; ishift <= 10; ishift++) { + auto coeffshiftxFT0C = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kFT0C, ishift - 0.5)); + auto coeffshiftyFT0C = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kFT0C + 1, ishift - 0.5)); + auto coeffshiftxFT0A = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kFT0A, ishift - 0.5)); + auto coeffshiftyFT0A = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kFT0A + 1, ishift - 0.5)); + auto coeffshiftxFT0M = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kFT0M, ishift - 0.5)); + auto coeffshiftyFT0M = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kFT0M + 1, ishift - 0.5)); + auto coeffshiftxFV0A = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kFV0A, ishift - 0.5)); + auto coeffshiftyFV0A = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kFV0A + 1, ishift - 0.5)); + auto coeffshiftxTPCpos = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kTPCpos, ishift - 0.5)); + auto coeffshiftyTPCpos = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kTPCpos + 1, ishift - 0.5)); + auto coeffshiftxTPCneg = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kTPCneg, ishift - 0.5)); + auto coeffshiftyTPCneg = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kTPCneg + 1, ishift - 0.5)); + auto coeffshiftxTPCall = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kTPCall, ishift - 0.5)); + auto coeffshiftyTPCall = shiftprofile.at(nmode - 2)->GetBinContent(shiftprofile.at(nmode - 2)->FindBin(cent, 2 * kTPCall + 1, ishift - 0.5)); + + deltapsiFT0C += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0C * TMath::Cos(ishift * static_cast(nmode) * psidefFT0C) + coeffshiftyFT0C * TMath::Sin(ishift * static_cast(nmode) * psidefFT0C))); + deltapsiFT0A += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0A * TMath::Cos(ishift * static_cast(nmode) * psidefFT0A) + coeffshiftyFT0A * TMath::Sin(ishift * static_cast(nmode) * psidefFT0A))); + deltapsiFT0M += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0M * TMath::Cos(ishift * static_cast(nmode) * psidefFT0M) + coeffshiftyFT0M * TMath::Sin(ishift * static_cast(nmode) * psidefFT0M))); + deltapsiFV0A += ((1 / (1.0 * ishift)) * (-coeffshiftxFV0A * TMath::Cos(ishift * static_cast(nmode) * psidefFV0A) + coeffshiftyFV0A * TMath::Sin(ishift * static_cast(nmode) * psidefFV0A))); + deltapsiTPCpos += ((1 / (1.0 * ishift)) * (-coeffshiftxTPCpos * TMath::Cos(ishift * static_cast(nmode) * psidefTPCpos) + coeffshiftyTPCpos * TMath::Sin(ishift * static_cast(nmode) * psidefTPCpos))); + deltapsiTPCneg += ((1 / (1.0 * ishift)) * (-coeffshiftxTPCneg * TMath::Cos(ishift * static_cast(nmode) * psidefTPCneg) + coeffshiftyTPCneg * TMath::Sin(ishift * static_cast(nmode) * psidefTPCneg))); + deltapsiTPCall += ((1 / (1.0 * ishift)) * (-coeffshiftxTPCall * TMath::Cos(ishift * static_cast(nmode) * psidefTPCall) + coeffshiftyTPCall * TMath::Sin(ishift * static_cast(nmode) * psidefTPCall))); + } + + qvecReShiftedFT0C.push_back(qvecRe[(kTPCall + 1) * 4 * id + kFT0C * 4 + 3] * TMath::Cos(deltapsiFT0C) - qvecIm[(kTPCall + 1) * 4 * id + kFT0C * 4 + 3] * TMath::Sin(deltapsiFT0C)); + qvecImShiftedFT0C.push_back(qvecRe[(kTPCall + 1) * 4 * id + kFT0C * 4 + 3] * TMath::Sin(deltapsiFT0C) + qvecIm[(kTPCall + 1) * 4 * id + kFT0C * 4 + 3] * TMath::Cos(deltapsiFT0C)); + qvecReShiftedFT0A.push_back(qvecRe[(kTPCall + 1) * 4 * id + kFT0A * 4 + 3] * TMath::Cos(deltapsiFT0A) - qvecIm[(kTPCall + 1) * 4 * id + kFT0A * 4 + 3] * TMath::Sin(deltapsiFT0A)); + qvecImShiftedFT0A.push_back(qvecRe[(kTPCall + 1) * 4 * id + kFT0A * 4 + 3] * TMath::Sin(deltapsiFT0A) + qvecIm[(kTPCall + 1) * 4 * id + kFT0A * 4 + 3] * TMath::Cos(deltapsiFT0A)); + qvecReShiftedFT0M.push_back(qvecRe[(kTPCall + 1) * 4 * id + kFT0M * 4 + 3] * TMath::Cos(deltapsiFT0M) - qvecIm[(kTPCall + 1) * 4 * id + kFT0M * 4 + 3] * TMath::Sin(deltapsiFT0M)); + qvecImShiftedFT0M.push_back(qvecRe[(kTPCall + 1) * 4 * id + kFT0M * 4 + 3] * TMath::Sin(deltapsiFT0M) + qvecIm[(kTPCall + 1) * 4 * id + kFT0M * 4 + 3] * TMath::Cos(deltapsiFT0M)); + qvecReShiftedFV0A.push_back(qvecRe[(kTPCall + 1) * 4 * id + kFV0A * 4 + 3] * TMath::Cos(deltapsiFV0A) - qvecIm[(kTPCall + 1) * 4 * id + kFV0A * 4 + 3] * TMath::Sin(deltapsiFV0A)); + qvecImShiftedFV0A.push_back(qvecRe[(kTPCall + 1) * 4 * id + kFV0A * 4 + 3] * TMath::Sin(deltapsiFV0A) + qvecIm[(kTPCall + 1) * 4 * id + kFV0A * 4 + 3] * TMath::Cos(deltapsiFV0A)); + qvecReShiftedTPCpos.push_back(qvecRe[(kTPCall + 1) * 4 * id + kTPCpos * 4 + 3] * TMath::Cos(deltapsiTPCpos) - qvecIm[(kTPCall + 1) * 4 * id + kTPCpos * 4 + 3] * TMath::Sin(deltapsiTPCpos)); + qvecImShiftedTPCpos.push_back(qvecRe[(kTPCall + 1) * 4 * id + kTPCpos * 4 + 3] * TMath::Sin(deltapsiTPCpos) + qvecIm[(kTPCall + 1) * 4 * id + kTPCpos * 4 + 3] * TMath::Cos(deltapsiTPCpos)); + qvecReShiftedTPCneg.push_back(qvecRe[(kTPCall + 1) * 4 * id + kTPCneg * 4 + 3] * TMath::Cos(deltapsiTPCneg) - qvecIm[(kTPCall + 1) * 4 * id + kTPCneg * 4 + 3] * TMath::Sin(deltapsiTPCneg)); + qvecImShiftedTPCneg.push_back(qvecRe[(kTPCall + 1) * 4 * id + kTPCneg * 4 + 3] * TMath::Sin(deltapsiTPCneg) + qvecIm[(kTPCall + 1) * 4 * id + kTPCneg * 4 + 3] * TMath::Cos(deltapsiTPCneg)); + qvecReShiftedTPCall.push_back(qvecRe[(kTPCall + 1) * 4 * id + kTPCall * 4 + 3] * TMath::Cos(deltapsiTPCall) - qvecIm[(kTPCall + 1) * 4 * id + kTPCall * 4 + 3] * TMath::Sin(deltapsiTPCall)); + qvecImShiftedTPCall.push_back(qvecRe[(kTPCall + 1) * 4 * id + kTPCall * 4 + 3] * TMath::Sin(deltapsiTPCall) + qvecIm[(kTPCall + 1) * 4 * id + kTPCall * 4 + 3] * TMath::Cos(deltapsiTPCall)); + + qvecShiftedRe.push_back(qvecReShiftedFT0C[id]); + qvecShiftedRe.push_back(qvecReShiftedFT0A[id]); + qvecShiftedRe.push_back(qvecReShiftedFT0M[id]); + qvecShiftedRe.push_back(qvecReShiftedFV0A[id]); + qvecShiftedRe.push_back(qvecReShiftedTPCpos[id]); + qvecShiftedRe.push_back(qvecReShiftedTPCneg[id]); + qvecShiftedRe.push_back(qvecReShiftedTPCall[id]); + + qvecShiftedIm.push_back(qvecImShiftedFT0C[id]); + qvecShiftedIm.push_back(qvecImShiftedFT0A[id]); + qvecShiftedIm.push_back(qvecImShiftedFT0M[id]); + qvecShiftedIm.push_back(qvecImShiftedFV0A[id]); + qvecShiftedIm.push_back(qvecImShiftedTPCpos[id]); + qvecShiftedIm.push_back(qvecImShiftedTPCneg[id]); + qvecShiftedIm.push_back(qvecImShiftedTPCall[id]); + } } int CorrLevel = cfgCorrLevel == 0 ? 0 : cfgCorrLevel - 1; qvecReFT0C.push_back(qvecRe[(kTPCall + 1) * 4 * id + kFT0C * 4 + CorrLevel]); @@ -639,6 +757,17 @@ struct qVectorsTable { qVectorTPCnegVec(IsCalibrated, qvecReTPCneg, qvecImTPCneg, qvecAmp[kTPCneg], TrkTPCnegLabel); qVectorTPCallVec(IsCalibrated, qvecReTPCall, qvecImTPCall, qvecAmp[kTPCall], TrkTPCallLabel); + if (cfgShiftCorr) { + qVectorShifted(cent, IsCalibrated, qvecShiftedRe, qvecShiftedIm, qvecAmp); + qVectorFT0CShiftedVec(IsCalibrated, qvecReShiftedFT0C, qvecImShiftedFT0C, qvecAmp[kFT0C]); + qVectorFT0AShiftedVec(IsCalibrated, qvecReShiftedFT0A, qvecImShiftedFT0A, qvecAmp[kFT0A]); + qVectorFT0MShiftedVec(IsCalibrated, qvecReShiftedFT0M, qvecImShiftedFT0M, qvecAmp[kFT0M]); + qVectorFV0AShiftedVec(IsCalibrated, qvecReShiftedFV0A, qvecImShiftedFV0A, qvecAmp[kFV0A]); + qVectorTPCposShiftedVec(IsCalibrated, qvecReShiftedTPCpos, qvecImShiftedTPCpos, qvecAmp[kTPCpos], TrkTPCposLabel); + qVectorTPCnegShiftedVec(IsCalibrated, qvecReShiftedTPCneg, qvecImShiftedTPCneg, qvecAmp[kTPCneg], TrkTPCnegLabel); + qVectorTPCallShiftedVec(IsCalibrated, qvecReShiftedTPCall, qvecImShiftedTPCall, qvecAmp[kTPCall], TrkTPCallLabel); + } + // Deprecated, will be removed in future after transition time // if (useDetector["QvectorBPoss"]) qVectorBPos(IsCalibrated, qvecReTPCpos.at(0), qvecImTPCpos.at(0), qvecAmp[kTPCpos], TrkTPCposLabel); diff --git a/Common/Tasks/qVectorsCorrection.cxx b/Common/Tasks/qVectorsCorrection.cxx index 37636ce369d..e41eceaaefe 100644 --- a/Common/Tasks/qVectorsCorrection.cxx +++ b/Common/Tasks/qVectorsCorrection.cxx @@ -49,6 +49,7 @@ using namespace o2; using namespace o2::framework; using MyCollisions = soa::Join; +using MyCollisionsWithSC = soa::Join; using MyTracks = soa::Join; struct qVectorsCorrection { @@ -76,6 +77,8 @@ struct qVectorsCorrection { Configurable cfgQAFinal{"cfgQAFinal", false, "draw final q-vector steps"}; Configurable cfgQAFlowStudy{"cfgQAFlowStudy", false, "configurable for flow study"}; Configurable cfgQAOccupancyStudy{"cfgQAOccupancyStudy", false, "configurable for occupancy study"}; + Configurable cfgAddEvtSelPileup{"cfgAddEvtSelPileup", false, "configurable for pileup selection"}; + Configurable cfgShiftCor{"cfgShiftCor", false, "configurable for shift correction"}; Configurable cfgMinPt{"cfgMinPt", 0.15, "Minimum transverse momentum for charged track"}; Configurable cfgMaxEta{"cfgMaxEta", 0.8, "Maximum pseudorapidiy for charged track"}; @@ -251,6 +254,61 @@ struct qVectorsCorrection { } } // End void init(InitContext const&) + template + void fillHistosFlowWithSC(const CollType& coll, const TrackType& track, int nmode) + { + int DetInd = DetId + cfgnTotalSystem * (nmode - 2); + int RefAInd = RefAId + cfgnTotalSystem * (nmode - 2); + int RefBInd = RefBId + cfgnTotalSystem * (nmode - 2); + + for (auto& trk : track) { + if (!SelTrack(trk)) { + continue; + } + + if (std::abs(trk.eta()) > 0.8) { + continue; + } + if (nmode == 2) { + histosQA.fill(HIST("hist_EP_cos_Det_v2"), coll.cent(), trk.pt(), std::cos(2.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[DetInd], coll.qvecShiftedIm()[DetInd], nmode)))); + histosQA.fill(HIST("hist_EP_sin_Det_v2"), coll.cent(), trk.pt(), std::sin(2.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[DetInd], coll.qvecShiftedIm()[DetInd], nmode)))); + histosQA.fill(HIST("hist_EP_azimuth_Det_v2"), coll.cent(), trk.pt(), TVector2::Phi_0_2pi(2.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[DetInd], coll.qvecShiftedIm()[DetInd], nmode)))); + + histosQA.fill(HIST("hist_EP_cos_RefA_v2"), coll.cent(), trk.pt(), std::cos(2.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefAInd], coll.qvecShiftedIm()[RefAInd], nmode)))); + histosQA.fill(HIST("hist_EP_sin_RefA_v2"), coll.cent(), trk.pt(), std::sin(2.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefAInd], coll.qvecShiftedIm()[RefAInd], nmode)))); + histosQA.fill(HIST("hist_EP_azimuth_RefA_v2"), coll.cent(), trk.pt(), TVector2::Phi_0_2pi(2.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefAInd], coll.qvecShiftedIm()[RefAInd], nmode)))); + + histosQA.fill(HIST("hist_EP_cos_RefB_v2"), coll.cent(), trk.pt(), std::cos(2.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefBInd], coll.qvecShiftedIm()[RefBInd], nmode)))); + histosQA.fill(HIST("hist_EP_sin_RefB_v2"), coll.cent(), trk.pt(), std::sin(2.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefBInd], coll.qvecShiftedIm()[RefBInd], nmode)))); + histosQA.fill(HIST("hist_EP_azimuth_RefB_v2"), coll.cent(), trk.pt(), TVector2::Phi_0_2pi(2.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefBInd], coll.qvecShiftedIm()[RefBInd], nmode)))); + } else if (nmode == 3) { + histosQA.fill(HIST("hist_EP_cos_Det_v3"), coll.cent(), trk.pt(), std::cos(3.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[DetInd], coll.qvecShiftedIm()[DetInd], nmode)))); + histosQA.fill(HIST("hist_EP_sin_Det_v3"), coll.cent(), trk.pt(), std::sin(3.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[DetInd], coll.qvecShiftedIm()[DetInd], nmode)))); + histosQA.fill(HIST("hist_EP_azimuth_Det_v3"), coll.cent(), trk.pt(), TVector2::Phi_0_2pi(3.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[DetInd], coll.qvecShiftedIm()[DetInd], nmode)))); + + histosQA.fill(HIST("hist_EP_cos_RefA_v3"), coll.cent(), trk.pt(), std::cos(3.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefAInd], coll.qvecShiftedIm()[RefAInd], nmode)))); + histosQA.fill(HIST("hist_EP_sin_RefA_v3"), coll.cent(), trk.pt(), std::sin(3.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefAInd], coll.qvecShiftedIm()[RefAInd], nmode)))); + histosQA.fill(HIST("hist_EP_azimuth_RefA_v3"), coll.cent(), trk.pt(), TVector2::Phi_0_2pi(3.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefAInd], coll.qvecShiftedIm()[RefAInd], nmode)))); + + histosQA.fill(HIST("hist_EP_cos_RefB_v3"), coll.cent(), trk.pt(), std::cos(3.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefBInd], coll.qvecShiftedIm()[RefBInd], nmode)))); + histosQA.fill(HIST("hist_EP_sin_RefB_v3"), coll.cent(), trk.pt(), std::sin(3.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefBInd], coll.qvecShiftedIm()[RefBInd], nmode)))); + histosQA.fill(HIST("hist_EP_azimuth_RefB_v3"), coll.cent(), trk.pt(), TVector2::Phi_0_2pi(3.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefBInd], coll.qvecShiftedIm()[RefBInd], nmode)))); + } else if (nmode == 4) { + histosQA.fill(HIST("hist_EP_cos_Det_v4"), coll.cent(), trk.pt(), std::cos(4.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[DetInd], coll.qvecShiftedIm()[DetInd], nmode)))); + histosQA.fill(HIST("hist_EP_sin_Det_v4"), coll.cent(), trk.pt(), std::sin(4.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[DetInd], coll.qvecShiftedIm()[DetInd], nmode)))); + histosQA.fill(HIST("hist_EP_azimuth_Det_v4"), coll.cent(), trk.pt(), TVector2::Phi_0_2pi(4.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[DetInd], coll.qvecShiftedIm()[DetInd], nmode)))); + + histosQA.fill(HIST("hist_EP_cos_RefA_v4"), coll.cent(), trk.pt(), std::cos(4.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefAInd], coll.qvecShiftedIm()[RefAInd], nmode)))); + histosQA.fill(HIST("hist_EP_sin_RefA_v4"), coll.cent(), trk.pt(), std::sin(4.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefAInd], coll.qvecShiftedIm()[RefAInd], nmode)))); + histosQA.fill(HIST("hist_EP_azimuth_RefA_v4"), coll.cent(), trk.pt(), TVector2::Phi_0_2pi(4.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefAInd], coll.qvecShiftedIm()[RefAInd], nmode)))); + + histosQA.fill(HIST("hist_EP_cos_RefB_v4"), coll.cent(), trk.pt(), std::cos(4.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefBInd], coll.qvecShiftedIm()[RefBInd], nmode)))); + histosQA.fill(HIST("hist_EP_sin_RefB_v4"), coll.cent(), trk.pt(), std::sin(4.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefBInd], coll.qvecShiftedIm()[RefBInd], nmode)))); + histosQA.fill(HIST("hist_EP_azimuth_RefB_v4"), coll.cent(), trk.pt(), TVector2::Phi_0_2pi(4.0 * (trk.phi() - helperEP.GetEventPlane(coll.qvecShiftedRe()[RefBInd], coll.qvecShiftedIm()[RefBInd], nmode)))); + } + } + } + template void fillHistosFlow(const CollType& coll, const TrackType& track, int nmode) { @@ -310,6 +368,54 @@ struct qVectorsCorrection { } } + template + void fillHistosQvecWithSC(const T& vec, int nmode) + { + int DetInd = DetId + cfgnTotalSystem * (nmode - 2); + int RefAInd = RefAId + cfgnTotalSystem * (nmode - 2); + int RefBInd = RefBId + cfgnTotalSystem * (nmode - 2); + if (nmode == 2) { + histosQA.fill(HIST("histQvecFinalV2"), vec.qvecShiftedRe()[DetInd], vec.qvecShiftedIm()[DetInd], vec.cent()); + histosQA.fill(HIST("histEvtPlFinalV2"), helperEP.GetEventPlane(vec.qvecShiftedRe()[DetInd], vec.qvecShiftedIm()[DetInd], nmode), vec.cent()); + + histosQA.fill(HIST("histQvecRefAFinalV2"), vec.qvecShiftedRe()[RefAInd], vec.qvecShiftedIm()[RefAInd], vec.cent()); + histosQA.fill(HIST("histEvtPlRefAFinalV2"), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefAInd], vec.qvecShiftedIm()[RefAInd], nmode), vec.cent()); + + histosQA.fill(HIST("histQvecRefBFinalV2"), vec.qvecShiftedRe()[RefBInd], vec.qvecShiftedIm()[RefBInd], vec.cent()); + histosQA.fill(HIST("histEvtPlRefBFinalV2"), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefBInd], vec.qvecShiftedIm()[RefBInd], nmode), vec.cent()); + + histosQA.fill(HIST("histEvtPlRes_SigRefAV2"), helperEP.GetResolution(helperEP.GetEventPlane(vec.qvecShiftedRe()[DetInd], vec.qvecShiftedIm()[DetInd], nmode), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefAInd], vec.qvecShiftedIm()[RefAInd], nmode), nmode), vec.cent()); + histosQA.fill(HIST("histEvtPlRes_SigRefBV2"), helperEP.GetResolution(helperEP.GetEventPlane(vec.qvecShiftedRe()[DetInd], vec.qvecShiftedIm()[DetInd], nmode), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefBInd], vec.qvecShiftedIm()[RefBInd], nmode), nmode), vec.cent()); + histosQA.fill(HIST("histEvtPlRes_RefARefBV2"), helperEP.GetResolution(helperEP.GetEventPlane(vec.qvecShiftedRe()[RefAInd], vec.qvecShiftedIm()[RefAInd], nmode), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefBInd], vec.qvecShiftedIm()[RefBInd], nmode), nmode), vec.cent()); + } else if (nmode == 3) { + histosQA.fill(HIST("histQvecFinalV3"), vec.qvecShiftedRe()[DetInd], vec.qvecShiftedIm()[DetInd], vec.cent()); + histosQA.fill(HIST("histEvtPlFinalV3"), helperEP.GetEventPlane(vec.qvecShiftedRe()[DetInd], vec.qvecShiftedIm()[DetInd], nmode), vec.cent()); + + histosQA.fill(HIST("histQvecRefAFinalV3"), vec.qvecShiftedRe()[RefAInd], vec.qvecShiftedIm()[RefAInd], vec.cent()); + histosQA.fill(HIST("histEvtPlRefAFinalV3"), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefAInd], vec.qvecShiftedIm()[RefAInd], nmode), vec.cent()); + + histosQA.fill(HIST("histQvecRefBFinalV3"), vec.qvecShiftedRe()[RefBInd], vec.qvecShiftedIm()[RefBInd], vec.cent()); + histosQA.fill(HIST("histEvtPlRefBFinalV3"), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefBInd], vec.qvecShiftedIm()[RefBInd], nmode), vec.cent()); + + histosQA.fill(HIST("histEvtPlRes_SigRefAV3"), helperEP.GetResolution(helperEP.GetEventPlane(vec.qvecShiftedRe()[DetInd], vec.qvecShiftedIm()[DetInd], nmode), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefAInd], vec.qvecShiftedIm()[RefAInd], nmode), nmode), vec.cent()); + histosQA.fill(HIST("histEvtPlRes_SigRefBV3"), helperEP.GetResolution(helperEP.GetEventPlane(vec.qvecShiftedRe()[DetInd], vec.qvecShiftedIm()[DetInd], nmode), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefBInd], vec.qvecShiftedIm()[RefBInd], nmode), nmode), vec.cent()); + histosQA.fill(HIST("histEvtPlRes_RefARefBV3"), helperEP.GetResolution(helperEP.GetEventPlane(vec.qvecShiftedRe()[RefAInd], vec.qvecShiftedIm()[RefAInd], nmode), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefBInd], vec.qvecShiftedIm()[RefBInd], nmode), nmode), vec.cent()); + } else if (nmode == 4) { + histosQA.fill(HIST("histQvecFinalV4"), vec.qvecShiftedRe()[DetInd], vec.qvecShiftedIm()[DetInd], vec.cent()); + histosQA.fill(HIST("histEvtPlFinalV4"), helperEP.GetEventPlane(vec.qvecShiftedRe()[DetInd], vec.qvecShiftedIm()[DetInd], nmode), vec.cent()); + + histosQA.fill(HIST("histQvecRefAFinalV4"), vec.qvecShiftedRe()[RefAInd], vec.qvecShiftedIm()[RefAInd], vec.cent()); + histosQA.fill(HIST("histEvtPlRefAFinalV4"), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefAInd], vec.qvecShiftedIm()[RefAInd], nmode), vec.cent()); + + histosQA.fill(HIST("histQvecRefBFinalV4"), vec.qvecShiftedRe()[RefBInd], vec.qvecShiftedIm()[RefBInd], vec.cent()); + histosQA.fill(HIST("histEvtPlRefBFinalV4"), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefBInd], vec.qvecShiftedIm()[RefBInd], nmode), vec.cent()); + + histosQA.fill(HIST("histEvtPlRes_SigRefAV4"), helperEP.GetResolution(helperEP.GetEventPlane(vec.qvecShiftedRe()[DetInd], vec.qvecShiftedIm()[DetInd], nmode), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefAInd], vec.qvecShiftedIm()[RefAInd], nmode), nmode), vec.cent()); + histosQA.fill(HIST("histEvtPlRes_SigRefBV4"), helperEP.GetResolution(helperEP.GetEventPlane(vec.qvecShiftedRe()[DetInd], vec.qvecShiftedIm()[DetInd], nmode), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefBInd], vec.qvecShiftedIm()[RefBInd], nmode), nmode), vec.cent()); + histosQA.fill(HIST("histEvtPlRes_RefARefBV4"), helperEP.GetResolution(helperEP.GetEventPlane(vec.qvecShiftedRe()[RefAInd], vec.qvecShiftedIm()[RefAInd], nmode), helperEP.GetEventPlane(vec.qvecShiftedRe()[RefBInd], vec.qvecShiftedIm()[RefBInd], nmode), nmode), vec.cent()); + } + } + // Definition of all the needed template functions. template void fillHistosQvec(const T& vec, int nmode) @@ -574,7 +680,47 @@ struct qVectorsCorrection { fillHistosFlow(qVec, tracks, cfgnMods->at(i)); } } - } // End void process(...) + } + PROCESS_SWITCH(qVectorsCorrection, process, "default process", true); + + void processWithSC(MyCollisionsWithSC::iterator const& qVec, MyTracks const& tracks) + { + histosQA.fill(HIST("histCentFull"), qVec.cent()); + if (cfgAddEvtSel) { + switch (cfgEvtSel) { + case 0: // Sel8 + if (!qVec.sel8()) + return; + break; + case 1: // PbPb standard + if (!qVec.sel8() || !qVec.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !qVec.selection_bit(aod::evsel::kNoSameBunchPileup)) + return; + break; + case 2: // PbPb with pileup + if (!qVec.sel8() || !qVec.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) || + !qVec.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !qVec.selection_bit(aod::evsel::kNoSameBunchPileup)) + return; + break; + case 3: // Small systems (OO, NeNe, pp) + if (!qVec.sel8() || !qVec.selection_bit(aod::evsel::kNoSameBunchPileup)) + return; + break; + default: + LOGF(warning, "Event selection flag was not found, continuing without basic event selections!\n"); + } + // Check occupancy + if (qVec.trackOccupancyInTimeRange() > cfgMaxOccupancy || qVec.trackOccupancyInTimeRange() < cfgMinOccupancy) + return; + } + + for (uint i = 0; i < cfgnMods->size(); i++) { + fillHistosQvecWithSC(qVec, cfgnMods->at(i)); + if (cfgQAFlowStudy) { + fillHistosFlowWithSC(qVec, tracks, cfgnMods->at(i)); + } + } + } + PROCESS_SWITCH(qVectorsCorrection, processWithSC, "process with shift correction", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 0db1efb3fabf5296c4432c35f241bf873f7bbfac Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Mon, 6 Oct 2025 17:41:28 +0200 Subject: [PATCH 642/986] [PWGLF] Fix typo in the track type check when building V0s (#13248) --- PWGLF/Utils/strangenessBuilderHelper.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Utils/strangenessBuilderHelper.h b/PWGLF/Utils/strangenessBuilderHelper.h index 23be7279c56..46210d0dcfe 100644 --- a/PWGLF/Utils/strangenessBuilderHelper.h +++ b/PWGLF/Utils/strangenessBuilderHelper.h @@ -301,7 +301,7 @@ class strangenessBuilderHelper v0 = {}; return false; } - if (!acceptTPCOnly && !positiveTrack.hasITS() && !negativeTrack.hasTRD() && !negativeTrack.hasTOF()) { + if (!acceptTPCOnly && !positiveTrack.hasITS() && !positiveTrack.hasTRD() && !positiveTrack.hasTOF()) { v0 = {}; return false; } From 0c38446520acf04236f63ccd7ef2cb034e5d0e49 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Mon, 6 Oct 2025 18:48:59 +0200 Subject: [PATCH 643/986] [PWGEM/Dilepton] update for HM pp analyses (#13249) --- PWGEM/Dilepton/Core/Dilepton.h | 6 +++--- PWGEM/Dilepton/Core/DileptonMC.h | 6 +++--- PWGEM/Dilepton/Core/PhotonHBT.h | 6 +++--- PWGEM/Dilepton/Core/SingleTrackQC.h | 6 +++--- PWGEM/Dilepton/Core/SingleTrackQCMC.h | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 35d165aaa1b..4c9c2affbb2 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -116,8 +116,8 @@ struct Dilepton { ConfigurableAxis ConfEPBins{"ConfEPBins", {16, -M_PI / 2, +M_PI / 2}, "Mixing bins - event plane angle"}; ConfigurableAxis ConfOccupancyBins{"ConfOccupancyBins", {VARIABLE_WIDTH, -1, 1e+10}, "Mixing bins - occupancy"}; Configurable cfg_swt_name{"cfg_swt_name", "fHighTrackMult", "desired software trigger name"}; // 1 trigger name per 1 task. fHighTrackMult, fHighFt0Mult - // Configurable cfgNtracksPV08Min{"cfgNtracksPV08Min", -1, "min. multNTracksPV"}; - // Configurable cfgNtracksPV08Max{"cfgNtracksPV08Max", static_cast(1e+9), "max. multNTracksPV"}; + Configurable cfgNumContribMin{"cfgNumContribMin", 0, "min. numContrib"}; + Configurable cfgNumContribMax{"cfgNumContribMax", 65000, "max. numContrib"}; Configurable cfgApplyWeightTTCA{"cfgApplyWeightTTCA", false, "flag to apply weighting by 1/N"}; Configurable cfgDCAType{"cfgDCAType", 0, "type of DCA for output. 0:3D, 1:XY, 2:Z, else:3D"}; Configurable cfgUseSignedDCA{"cfgUseSignedDCA", false, "flag to use signs in the DCA calculation"}; @@ -1142,7 +1142,7 @@ struct Dilepton { } Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); - // Filter collisionFilter_multiplicity = cfgNtracksPV08Min <= o2::aod::mult::multNTracksPV && o2::aod::mult::multNTracksPV < cfgNtracksPV08Max; + Filter collisionFilter_numContrib = cfgNumContribMin <= o2::aod::collision::numContrib && o2::aod::collision::numContrib < cfgNumContribMax; Filter collisionFilter_occupancy_track = eventcuts.cfgTrackOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgTrackOccupancyMax; Filter collisionFilter_occupancy_ft0c = eventcuts.cfgFT0COccupancyMin <= o2::aod::evsel::ft0cOccupancyInTimeRange && o2::aod::evsel::ft0cOccupancyInTimeRange < eventcuts.cfgFT0COccupancyMax; using FilteredMyCollisions = soa::Filtered; diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index 60745eb9917..46326630ee3 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -99,8 +99,8 @@ struct DileptonMC { Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; Configurable cfgCentMin{"cfgCentMin", -1, "min. centrality"}; Configurable cfgCentMax{"cfgCentMax", 999.f, "max. centrality"}; - // Configurable cfgNtracksPV08Min{"cfgNtracksPV08Min", -1, "min. multNTracksPV"}; - // Configurable cfgNtracksPV08Max{"cfgNtracksPV08Max", static_cast(1e+9), "max. multNTracksPV"}; + Configurable cfgNumContribMin{"cfgNumContribMin", 0, "min. numContrib"}; + Configurable cfgNumContribMax{"cfgNumContribMax", 65000, "max. numContrib"}; Configurable cfgApplyWeightTTCA{"cfgApplyWeightTTCA", false, "flag to apply weighting by 1/N"}; Configurable cfgDCAType{"cfgDCAType", 0, "type of DCA for output. 0:3D, 1:XY, 2:Z, else:3D"}; Configurable cfgFillUnfolding{"cfgFillUnfolding", false, "flag to fill histograms for unfolding"}; @@ -1289,7 +1289,7 @@ struct DileptonMC { Filter ttcaFilter_muon = ifnode(dimuoncuts.enableTTCA.node(), o2::aod::emprimarymuon::isAssociatedToMPC == true || o2::aod::emprimarymuon::isAssociatedToMPC == false, o2::aod::emprimarymuon::isAssociatedToMPC == true); Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); - // Filter collisionFilter_multiplicity = cfgNtracksPV08Min <= o2::aod::mult::multNTracksPV && o2::aod::mult::multNTracksPV < cfgNtracksPV08Max; + Filter collisionFilter_numContrib = cfgNumContribMin <= o2::aod::collision::numContrib && o2::aod::collision::numContrib < cfgNumContribMax; Filter collisionFilter_occupancy_track = eventcuts.cfgTrackOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgTrackOccupancyMax; Filter collisionFilter_occupancy_ft0c = eventcuts.cfgFT0COccupancyMin <= o2::aod::evsel::ft0cOccupancyInTimeRange && o2::aod::evsel::ft0cOccupancyInTimeRange < eventcuts.cfgFT0COccupancyMax; using FilteredMyCollisions = soa::Filtered; diff --git a/PWGEM/Dilepton/Core/PhotonHBT.h b/PWGEM/Dilepton/Core/PhotonHBT.h index 39938df8f0d..fdb9755a299 100644 --- a/PWGEM/Dilepton/Core/PhotonHBT.h +++ b/PWGEM/Dilepton/Core/PhotonHBT.h @@ -110,8 +110,8 @@ struct PhotonHBT { ConfigurableAxis ConfEPBins{"ConfEPBins", {16, -M_PI / 2, +M_PI / 2}, "Mixing bins - event plane angle"}; ConfigurableAxis ConfOccupancyBins{"ConfOccupancyBins", {VARIABLE_WIDTH, -1, 1e+10}, "Mixing bins - occupancy"}; Configurable cfg_swt_name{"cfg_swt_name", "fHighTrackMult", "desired software trigger name"}; // 1 trigger name per 1 task. fHighTrackMult, fHighFt0Mult - // Configurable cfgNtracksPV08Min{"cfgNtracksPV08Min", -1, "min. multNTracksPV"}; - // Configurable cfgNtracksPV08Max{"cfgNtracksPV08Max", static_cast(1e+9), "max. multNTracksPV"}; + Configurable cfgNumContribMin{"cfgNumContribMin", 0, "min. numContrib"}; + Configurable cfgNumContribMax{"cfgNumContribMax", 65000, "max. numContrib"}; Configurable cfgApplyWeightTTCA{"cfgApplyWeightTTCA", true, "flag to apply weighting by 1/N"}; Configurable cfgUseLCMS{"cfgUseLCMS", true, "measure relative momentum in LCMS for 1D"}; // always in LCMS for 3D @@ -1427,7 +1427,7 @@ struct PhotonHBT { Preslice perCollision_electron = aod::emprimaryelectron::emeventId; Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); - // Filter collisionFilter_multiplicity = cfgNtracksPV08Min <= o2::aod::mult::multNTracksPV && o2::aod::mult::multNTracksPV < cfgNtracksPV08Max; + Filter collisionFilter_numContrib = cfgNumContribMin <= o2::aod::collision::numContrib && o2::aod::collision::numContrib < cfgNumContribMax; Filter collisionFilter_occupancy_track = eventcuts.cfgTrackOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgTrackOccupancyMax; Filter collisionFilter_occupancy_ft0c = eventcuts.cfgFT0COccupancyMin <= o2::aod::evsel::ft0cOccupancyInTimeRange && o2::aod::evsel::ft0cOccupancyInTimeRange < eventcuts.cfgFT0COccupancyMax; using FilteredMyCollisions = soa::Filtered; diff --git a/PWGEM/Dilepton/Core/SingleTrackQC.h b/PWGEM/Dilepton/Core/SingleTrackQC.h index b9949e7b2d3..5d9aa898951 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQC.h @@ -83,8 +83,8 @@ struct SingleTrackQC { Configurable cfgCentMin{"cfgCentMin", -1, "min. centrality"}; Configurable cfgCentMax{"cfgCentMax", 999.f, "max. centrality"}; Configurable cfg_swt_name{"cfg_swt_name", "fHighTrackMult", "desired software trigger name"}; // 1 trigger name per 1 task. fHighTrackMult, fHighFt0Mult - // Configurable cfgNtracksPV08Min{"cfgNtracksPV08Min", -1, "min. multNTracksPV"}; - // Configurable cfgNtracksPV08Max{"cfgNtracksPV08Max", static_cast(1e+9), "max. multNTracksPV"}; + Configurable cfgNumContribMin{"cfgNumContribMin", 0, "min. numContrib"}; + Configurable cfgNumContribMax{"cfgNumContribMax", 65000, "max. numContrib"}; Configurable cfgApplyWeightTTCA{"cfgApplyWeightTTCA", false, "flag to apply weighting by 1/N"}; ConfigurableAxis ConfPtlBins{"ConfPtlBins", {VARIABLE_WIDTH, 0.00, 0.05, 0.10, 0.15, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.50, 3.00, 3.50, 4.00, 4.50, 5.00, 6.00, 7.00, 8.00, 9.00, 10.00}, "pTl bins for output histograms"}; @@ -829,7 +829,7 @@ struct SingleTrackQC { Filter ttcaFilter_muon = ifnode(dimuoncuts.enableTTCA.node(), o2::aod::emprimarymuon::isAssociatedToMPC == true || o2::aod::emprimarymuon::isAssociatedToMPC == false, o2::aod::emprimarymuon::isAssociatedToMPC == true); Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); - // Filter collisionFilter_multiplicity = cfgNtracksPV08Min <= o2::aod::mult::multNTracksPV && o2::aod::mult::multNTracksPV < cfgNtracksPV08Max; + Filter collisionFilter_numContrib = cfgNumContribMin <= o2::aod::collision::numContrib && o2::aod::collision::numContrib < cfgNumContribMax; Filter collisionFilter_occupancy_track = eventcuts.cfgTrackOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgTrackOccupancyMax; Filter collisionFilter_occupancy_ft0c = eventcuts.cfgFT0COccupancyMin <= o2::aod::evsel::ft0cOccupancyInTimeRange && o2::aod::evsel::ft0cOccupancyInTimeRange < eventcuts.cfgFT0COccupancyMax; using FilteredMyCollisions = soa::Filtered; diff --git a/PWGEM/Dilepton/Core/SingleTrackQCMC.h b/PWGEM/Dilepton/Core/SingleTrackQCMC.h index 573bdc686d0..973eb681663 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQCMC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQCMC.h @@ -89,8 +89,8 @@ struct SingleTrackQCMC { Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; Configurable cfgCentMin{"cfgCentMin", -1, "min. centrality"}; Configurable cfgCentMax{"cfgCentMax", 999.f, "max. centrality"}; - // Configurable cfgNtracksPV08Min{"cfgNtracksPV08Min", -1, "min. multNTracksPV"}; - // Configurable cfgNtracksPV08Max{"cfgNtracksPV08Max", static_cast(1e+9), "max. multNTracksPV"}; + Configurable cfgNumContribMin{"cfgNumContribMin", 0, "min. numContrib"}; + Configurable cfgNumContribMax{"cfgNumContribMax", 65000, "max. numContrib"}; Configurable cfgFillQA{"cfgFillQA", false, "flag to fill QA histograms"}; Configurable cfgApplyWeightTTCA{"cfgApplyWeightTTCA", false, "flag to apply weighting by 1/N"}; Configurable cfgRequireTrueAssociation{"cfgRequireTrueAssociation", false, "flag to require true mc collision association"}; @@ -1160,7 +1160,7 @@ struct SingleTrackQCMC { Filter ttcaFilter_muon = ifnode(dimuoncuts.enableTTCA.node(), o2::aod::emprimarymuon::isAssociatedToMPC == true || o2::aod::emprimarymuon::isAssociatedToMPC == false, o2::aod::emprimarymuon::isAssociatedToMPC == true); Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); - // Filter collisionFilter_multiplicity = cfgNtracksPV08Min <= o2::aod::mult::multNTracksPV && o2::aod::mult::multNTracksPV < cfgNtracksPV08Max; + Filter collisionFilter_numContrib = cfgNumContribMin <= o2::aod::collision::numContrib && o2::aod::collision::numContrib < cfgNumContribMax; Filter collisionFilter_occupancy_track = eventcuts.cfgTrackOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgTrackOccupancyMax; Filter collisionFilter_occupancy_ft0c = eventcuts.cfgFT0COccupancyMin <= o2::aod::evsel::ft0cOccupancyInTimeRange && o2::aod::evsel::ft0cOccupancyInTimeRange < eventcuts.cfgFT0COccupancyMax; using FilteredMyCollisions = soa::Filtered; From 72375154ca4d16a7f10fb167f5a561640e38e199 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Mon, 6 Oct 2025 21:48:51 +0200 Subject: [PATCH 644/986] [PWGEM/Dilepton] update pion prefilter bits (#13258) --- PWGEM/Dilepton/Core/Dilepton.h | 12 ++++--- PWGEM/Dilepton/Core/DileptonHadronMPC.h | 12 ++++--- PWGEM/Dilepton/Core/DileptonMC.h | 12 ++++--- .../TableProducer/skimmerPrimaryElectron.cxx | 35 +++++++++---------- PWGEM/Dilepton/Utils/PairUtilities.h | 12 ++++--- 5 files changed, 49 insertions(+), 34 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 4c9c2affbb2..8a8b8806b43 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -191,7 +191,7 @@ struct Dilepton { Configurable cfg_require_diff_sides{"cfg_require_diff_sides", false, "flag to require 2 tracks are from different sides."}; Configurable cfg_apply_cuts_from_prefilter{"cfg_apply_cuts_from_prefilter", false, "flag to apply prefilter set when producing derived data"}; - Configurable cfg_prefilter_bits{"cfg_prefilter_bits", 0, "prefilter bits [kNone : 0, kElFromPC : 1, kElFromPi0_1 : 2, kElFromPi0_2 : 4, kElFromPi0_3 : 8] Please consider logical-OR among them."}; // see PairUtilities.h + Configurable cfg_prefilter_bits{"cfg_prefilter_bits", 0, "prefilter bits [kNone : 0, kElFromPC : 1, kElFromPi0_20MeV : 2, kElFromPi0_40MeV : 4, kElFromPi0_60MeV : 8, kElFromPi0_80MeV : 16, kElFromPi0_100MeV : 32, kElFromPi0_120MeV : 64, kElFromPi0_140MeV : 128] Please consider logical-OR among them."}; // see PairUtilities.h Configurable cfg_apply_cuts_from_prefilter_derived{"cfg_apply_cuts_from_prefilter_derived", false, "flag to apply pair cut same as prefilter set in derived data"}; Configurable cfg_prefilter_bits_derived{"cfg_prefilter_bits_derived", 0, "prefilter bits [kNone : 0, kMee : 1, kPhiV : 2, kSplitOrMergedTrackLS : 4, kSplitOrMergedTrackULS : 8] Please consider logical-OR among them."}; // see PairUtilities.h @@ -1160,9 +1160,13 @@ struct Dilepton { Filter prefilter_electron = ifnode(dielectroncuts.cfg_apply_cuts_from_prefilter.node() && dielectroncuts.cfg_prefilter_bits.node() >= static_cast(1), ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_1))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_1))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_2))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_2))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_3))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_3))) <= static_cast(0), true), + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_20MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_20MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_40MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_40MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_60MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_60MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_80MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_80MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_100MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_100MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_120MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_120MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_140MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_140MeV))) <= static_cast(0), true), o2::aod::emprimaryelectron::pfb >= static_cast(0)); Partition positive_electrons = o2::aod::emprimaryelectron::sign > int8_t(0); diff --git a/PWGEM/Dilepton/Core/DileptonHadronMPC.h b/PWGEM/Dilepton/Core/DileptonHadronMPC.h index ae423fd7a68..2f44a679930 100644 --- a/PWGEM/Dilepton/Core/DileptonHadronMPC.h +++ b/PWGEM/Dilepton/Core/DileptonHadronMPC.h @@ -186,7 +186,7 @@ struct DileptonHadronMPC { Configurable cfg_min_dphi{"cfg_min_dphi", 0.2, "min dphi between 2 electrons (elliptic cut)"}; Configurable cfg_apply_cuts_from_prefilter{"cfg_apply_cuts_from_prefilter", false, "flag to apply prefilter set when producing derived data"}; - Configurable cfg_prefilter_bits{"cfg_prefilter_bits", 0, "prefilter bits [kNone : 0, kElFromPC : 1, kElFromPi0_1 : 2, kElFromPi0_2 : 4, kElFromPi0_3 : 8] Please consider logical-OR among them."}; // see PairUtilities.h + Configurable cfg_prefilter_bits{"cfg_prefilter_bits", 0, "prefilter bits [kNone : 0, kElFromPC : 1, kElFromPi0_20MeV : 2, kElFromPi0_40MeV : 4, kElFromPi0_60MeV : 8, kElFromPi0_80MeV : 16, kElFromPi0_100MeV : 32, kElFromPi0_120MeV : 64, kElFromPi0_140MeV : 128] Please consider logical-OR among them."}; // see PairUtilities.h Configurable cfg_apply_cuts_from_prefilter_derived{"cfg_apply_cuts_from_prefilter_derived", false, "flag to apply pair cut same as prefilter set in derived data"}; Configurable cfg_prefilter_bits_derived{"cfg_prefilter_bits_derived", 0, "prefilter bits [kNone : 0, kMee : 1, kPhiV : 2, kSplitOrMergedTrackLS : 4, kSplitOrMergedTrackULS : 8] Please consider logical-OR among them."}; // see PairUtilities.h @@ -1052,9 +1052,13 @@ struct DileptonHadronMPC { Filter prefilter_electron = ifnode(dielectroncuts.cfg_apply_cuts_from_prefilter.node() && dielectroncuts.cfg_prefilter_bits.node() >= static_cast(1), ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_1))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_1))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_2))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_2))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_3))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_3))) <= static_cast(0), true), + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_20MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_20MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_40MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_40MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_60MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_60MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_80MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_80MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_100MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_100MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_120MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_120MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_140MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_140MeV))) <= static_cast(0), true), o2::aod::emprimaryelectron::pfb >= static_cast(0)); Partition positive_electrons = o2::aod::emprimaryelectron::sign > int8_t(0); diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index 46326630ee3..3e8b51e572d 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -186,7 +186,7 @@ struct DileptonMC { Configurable cfg_require_diff_sides{"cfg_require_diff_sides", false, "flag to require 2 tracks are from different sides."}; Configurable cfg_apply_cuts_from_prefilter{"cfg_apply_cuts_from_prefilter", false, "flag to apply prefilter set when producing derived data"}; - Configurable cfg_prefilter_bits{"cfg_prefilter_bits", 0, "prefilter bits [kNone : 0, kElFromPC : 1, kElFromPi0_1 : 2, kElFromPi0_2 : 4, kElFromPi0_3 : 8] Please consider logical-OR among them."}; // see PairUtilities.h + Configurable cfg_prefilter_bits{"cfg_prefilter_bits", 0, "prefilter bits [kNone : 0, kElFromPC : 1, kElFromPi0_20MeV : 2, kElFromPi0_40MeV : 4, kElFromPi0_60MeV : 8, kElFromPi0_80MeV : 16, kElFromPi0_100MeV : 32, kElFromPi0_120MeV : 64, kElFromPi0_140MeV : 128] Please consider logical-OR among them."}; // see PairUtilities.h Configurable cfg_apply_cuts_from_prefilter_derived{"cfg_apply_cuts_from_prefilter_derived", false, "flag to apply phiv cut inherited from prefilter"}; Configurable cfg_prefilter_bits_derived{"cfg_prefilter_bits_derived", 0, "prefilter bits [kNone : 0, kMee : 1, kPhiV : 2, kSplitOrMergedTrackLS : 4, kSplitOrMergedTrackULS : 8] Please consider logical-OR among them."}; // see PairUtilities.h @@ -1279,9 +1279,13 @@ struct DileptonMC { Filter prefilter_electron = ifnode(dielectroncuts.cfg_apply_cuts_from_prefilter.node() && dielectroncuts.cfg_prefilter_bits.node() >= static_cast(1), ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_1))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_1))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_2))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_2))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_3))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_3))) <= static_cast(0), true), + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_20MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_20MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_40MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_40MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_60MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_60MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_80MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_80MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_100MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_100MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_120MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_120MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_140MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_140MeV))) <= static_cast(0), true), o2::aod::emprimaryelectron::pfb >= static_cast(0)); Preslice perCollision_muon = aod::emprimarymuon::emeventId; diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx index d2370fe0936..b6cb2d76d78 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx @@ -840,9 +840,8 @@ struct prefilterPrimaryElectron { Configurable includeITSsa{"includeITSsa", false, "Flag to include ITSsa tracks"}; Configurable maxMeanITSClusterSize{"maxMeanITSClusterSize", 16, "max x cos(lambda)"}; - Configurable> max_mee_vec{"max_mee_vec", std::vector{0.06, 0.08, 0.10}, "vector fo max mee for prefilter in ULS. Please sort this by increasing order."}; // currently, 3 thoresholds are allowed. - HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; + const std::vector max_mee_vec{0.02, 0.04, 0.06, 0.08, 0.10, 0.12, 0.14}; int mRunNumber; float d_bz; @@ -1126,14 +1125,14 @@ struct prefilterPrimaryElectron { fRegistry.fill(HIST("Pair/before/uls/hMvsPhiV"), phiv, v12.M()); fRegistry.fill(HIST("Pair/before/uls/hMvsPt"), v12.M(), v12.Pt()); } - if (v12.M() < max_mee_vec->at(static_cast(max_mee_vec->size()) - 1)) { + if (v12.M() < max_mee_vec.at(static_cast(max_mee_vec.size()) - 1)) { if (fillQAHistogram) { fRegistry.fill(HIST("Track/hTPCNsigmaEl"), ele.tpcInnerParam(), ele.tpcNSigmaEl()); } } - for (int i = 0; i < static_cast(max_mee_vec->size()); i++) { - if (v12.M() < max_mee_vec->at(i)) { - pfb_map[empos.globalIndex()] |= (uint8_t(1) << (static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_1) + i)); + for (int i = 0; i < static_cast(max_mee_vec.size()); i++) { + if (v12.M() < max_mee_vec.at(i)) { + pfb_map[empos.globalIndex()] |= (uint8_t(1) << (static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_20MeV) + i)); } } @@ -1170,14 +1169,14 @@ struct prefilterPrimaryElectron { fRegistry.fill(HIST("Pair/before/uls/hMvsPhiV"), phiv, v12.M()); fRegistry.fill(HIST("Pair/before/uls/hMvsPt"), v12.M(), v12.Pt()); } - if (v12.M() < max_mee_vec->at(static_cast(max_mee_vec->size()) - 1)) { + if (v12.M() < max_mee_vec.at(static_cast(max_mee_vec.size()) - 1)) { if (fillQAHistogram) { fRegistry.fill(HIST("Track/hTPCNsigmaEl"), pos.tpcInnerParam(), pos.tpcNSigmaEl()); } } - for (int i = 0; i < static_cast(max_mee_vec->size()); i++) { - if (v12.M() < max_mee_vec->at(i)) { - pfb_map[emele.globalIndex()] |= (uint8_t(1) << (static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_1) + i)); + for (int i = 0; i < static_cast(max_mee_vec.size()); i++) { + if (v12.M() < max_mee_vec.at(i)) { + pfb_map[emele.globalIndex()] |= (uint8_t(1) << (static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_20MeV) + i)); } } @@ -1335,14 +1334,14 @@ struct prefilterPrimaryElectron { fRegistry.fill(HIST("Pair/before/uls/hMvsPhiV"), phiv, v12.M()); fRegistry.fill(HIST("Pair/before/uls/hMvsPt"), v12.M(), v12.Pt()); } - if (v12.M() < max_mee_vec->at(static_cast(max_mee_vec->size()) - 1)) { + if (v12.M() < max_mee_vec.at(static_cast(max_mee_vec.size()) - 1)) { if (fillQAHistogram) { fRegistry.fill(HIST("Track/hTPCNsigmaEl"), ele.tpcInnerParam(), ele.tpcNSigmaEl()); } } - for (int i = 0; i < static_cast(max_mee_vec->size()); i++) { - if (v12.M() < max_mee_vec->at(i)) { - pfb_map[empos.globalIndex()] |= (uint8_t(1) << (static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_1) + i)); + for (int i = 0; i < static_cast(max_mee_vec.size()); i++) { + if (v12.M() < max_mee_vec.at(i)) { + pfb_map[empos.globalIndex()] |= (uint8_t(1) << (static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_20MeV) + i)); } } @@ -1369,14 +1368,14 @@ struct prefilterPrimaryElectron { fRegistry.fill(HIST("Pair/before/uls/hMvsPhiV"), phiv, v12.M()); fRegistry.fill(HIST("Pair/before/uls/hMvsPt"), v12.M(), v12.Pt()); } - if (v12.M() < max_mee_vec->at(static_cast(max_mee_vec->size()) - 1)) { + if (v12.M() < max_mee_vec.at(static_cast(max_mee_vec.size()) - 1)) { if (fillQAHistogram) { fRegistry.fill(HIST("Track/hTPCNsigmaEl"), pos.tpcInnerParam(), pos.tpcNSigmaEl()); } } - for (int i = 0; i < static_cast(max_mee_vec->size()); i++) { - if (v12.M() < max_mee_vec->at(i)) { - pfb_map[emele.globalIndex()] |= (uint8_t(1) << (static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_1) + i)); + for (int i = 0; i < static_cast(max_mee_vec.size()); i++) { + if (v12.M() < max_mee_vec.at(i)) { + pfb_map[emele.globalIndex()] |= (uint8_t(1) << (static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_20MeV) + i)); } } diff --git a/PWGEM/Dilepton/Utils/PairUtilities.h b/PWGEM/Dilepton/Utils/PairUtilities.h index bd2a7f19f2a..9e59cd72704 100644 --- a/PWGEM/Dilepton/Utils/PairUtilities.h +++ b/PWGEM/Dilepton/Utils/PairUtilities.h @@ -51,10 +51,14 @@ enum class DileptonHadronAnalysisType : int { }; enum class DileptonPrefilterBit : int { - kElFromPC = 0, // electron from photon conversion - kElFromPi0_1 = 1, // electron from pi0 dalitz decay, threshold 1 - kElFromPi0_2 = 2, // electron from pi0 dalitz decay, threshold 2 - kElFromPi0_3 = 3, // electron from pi0 dalitz decay, threshold 3 + kElFromPC = 0, // electron from photon conversion + kElFromPi0_20MeV = 1, // electron from pi0 dalitz decay in mee < 20 MeV/c2 + kElFromPi0_40MeV = 2, // electron from pi0 dalitz decay in mee < 40 MeV/c2 + kElFromPi0_60MeV = 3, // electron from pi0 dalitz decay in mee < 60 MeV/c2 + kElFromPi0_80MeV = 4, // electron from pi0 dalitz decay in mee < 80 MeV/c2 + kElFromPi0_100MeV = 5, // electron from pi0 dalitz decay in mee < 100 MeV/c2 + kElFromPi0_120MeV = 6, // electron from pi0 dalitz decay in mee < 120 MeV/c2 + kElFromPi0_140MeV = 7, // electron from pi0 dalitz decay in mee < 140 MeV/c2 }; enum class DileptonPrefilterBitDerived : int { From 5c55b06dfbbdd6511b99b7fd96cc04667818ee33 Mon Sep 17 00:00:00 2001 From: fuchuncui <162277233+fuchuncui@users.noreply.github.com> Date: Tue, 7 Oct 2025 05:01:05 +0800 Subject: [PATCH 645/986] [PWGCF] Add IR cut for flowGfwOmegaXi.cxx (#13231) --- PWGCF/Flow/Tasks/CMakeLists.txt | 2 +- PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx | 50 +++++++++++++++++++++-------- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/PWGCF/Flow/Tasks/CMakeLists.txt b/PWGCF/Flow/Tasks/CMakeLists.txt index 532351a316b..f9805ac1ff0 100644 --- a/PWGCF/Flow/Tasks/CMakeLists.txt +++ b/PWGCF/Flow/Tasks/CMakeLists.txt @@ -56,7 +56,7 @@ o2physics_add_dpl_workflow(flow-pbpb-pikp o2physics_add_dpl_workflow(flow-gfw-omega-xi SOURCES flowGfwOmegaXi.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::GFWCore + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2Physics::GFWCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(flow-pid-cme diff --git a/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx b/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx index 658ab1fea95..7b4dc59e5cc 100644 --- a/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx +++ b/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx @@ -22,6 +22,7 @@ #include "PWGLF/DataModel/LFStrangenessTables.h" #include "PWGMM/Mult/DataModel/Index.h" +#include "Common/CCDB/ctpRateFetcher.h" #include "Common/Core/EventPlaneHelper.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/trackUtilities.h" @@ -141,6 +142,9 @@ struct FlowGfwOmegaXi { O2_DEFINE_CONFIGURABLE(cfgCutPtOmegaMin, float, 0.2f, "Minimal pT for Omega") O2_DEFINE_CONFIGURABLE(cfgCutPtOmegaMax, float, 10.0f, "Maximal pT for Omega") O2_DEFINE_CONFIGURABLE(cfgCutPtPIDDauMin, float, 0.15f, "Minimal pT for daughter PID") + O2_DEFINE_CONFIGURABLE(cfgCutPtPIDbachMin, float, 0.15f, "Minimal pT for daughter PID") + O2_DEFINE_CONFIGURABLE(cfgCutPtPIDposdauMin, float, 0.15f, "Minimal pT for daughter PID") + O2_DEFINE_CONFIGURABLE(cfgCutPtPIDnegdauMin, float, 0.15f, "Minimal pT for daughter PID") // track quality selections for daughter track O2_DEFINE_CONFIGURABLE(cfgCheckITSNCls, bool, false, "check minimum number of ITS clusters") O2_DEFINE_CONFIGURABLE(cfgCheckITSHits, bool, false, "check minimum number of ITS hits") @@ -160,6 +164,8 @@ struct FlowGfwOmegaXi { O2_DEFINE_CONFIGURABLE(cfgCutOccupancyHigh, int, 500, "High cut on TPC occupancy") O2_DEFINE_CONFIGURABLE(cfgMultPVCut, int, 5, "Use apassX MultPVCut function or not (-1)") O2_DEFINE_CONFIGURABLE(cfgDoV0AT0Acut, bool, true, "do V0A-T0A cut") + O2_DEFINE_CONFIGURABLE(cfgCutminIR, float, -1, "cut min IR") + O2_DEFINE_CONFIGURABLE(cfgCutmaxIR, float, -1, "cut max IR") } evtSeleOpts; O2_DEFINE_CONFIGURABLE(cfgCasc_rapidity, float, 0.5, "rapidity") @@ -209,6 +215,7 @@ struct FlowGfwOmegaXi { // Connect to ccdb Service ccdb; + ctpRateFetcher rateFetcher; O2_DEFINE_CONFIGURABLE(cfgnolaterthan, int64_t, std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object") O2_DEFINE_CONFIGURABLE(cfgurl, std::string, "http://alice-ccdb.cern.ch", "url of the ccdb repository") @@ -383,7 +390,7 @@ struct FlowGfwOmegaXi { } } - registry.add("hEventCount", "", {HistType::kTH1D, {{12, 0, 12}}}); + registry.add("hEventCount", "", {HistType::kTH1D, {{14, 0, 14}}}); registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(1, "Filtered event"); registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(2, "after sel8"); registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(3, "after kTVXinTRD"); @@ -396,6 +403,9 @@ struct FlowGfwOmegaXi { registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(10, "after MultPVCut"); registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(11, "after TPC occupancy cut"); registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(12, "after V0AT0Acut"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(13, "after IRmincut"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(14, "after IRmaxcut"); + registry.add("hInteractionRate", "", {HistType::kTH1D, {{1000, 0, 1000}}}); // QA if (cfgOutputQA) { @@ -879,9 +889,10 @@ struct FlowGfwOmegaXi { weight_loc = 1 / eff; return true; } + // event selection template - bool eventSelected(TCollision collision, const float centrality) + bool eventSelected(TCollision collision, const float centrality, float interactionRate = -1) { if (evtSeleOpts.cfgDoTVXinTRD.value && collision.alias_bit(kTVXinTRD)) { // TRD triggered @@ -958,6 +969,14 @@ struct FlowGfwOmegaXi { } registry.fill(HIST("hEventCount"), 11.5); + registry.fill(HIST("hInteractionRate"), interactionRate); + if (interactionRate > 0 && interactionRate < evtSeleOpts.cfgCutminIR.value) + return false; + registry.fill(HIST("hEventCount"), 12.5); + if (interactionRate > evtSeleOpts.cfgCutmaxIR.value) + return false; + registry.fill(HIST("hEventCount"), 13.5); + return true; } @@ -965,6 +984,10 @@ struct FlowGfwOmegaXi { { o2::aod::ITSResponse itsResponse; int nTot = tracks.size(); + auto bc = collision.bc_as(); + int runNumber = bc.runNumber(); + double interactionRate = rateFetcher.fetch(ccdb.service, bc.timestamp(), runNumber, "ZNC hadronic") * 1.e-3; + registry.fill(HIST("hEventCount"), 0.5); if (nTot < 1) return; @@ -973,11 +996,9 @@ struct FlowGfwOmegaXi { if (!collision.sel8()) return; registry.fill(HIST("hEventCount"), 1.5); - if (eventSelected(collision, cent)) + if (eventSelected(collision, cent, interactionRate)) return; TH1D* hLocalDensity = new TH1D("hphi", "hphi", 400, -constants::math::TwoPI, constants::math::TwoPI); - auto bc = collision.bc_as(); - int runNumber = bc.runNumber(); loadCorrections(bc.timestamp()); float vtxz = collision.posZ(); registry.fill(HIST("hVtxZ"), vtxz); @@ -1025,6 +1046,9 @@ struct FlowGfwOmegaXi { } // fill GFW of V0 flow double lowpt = trkQualityOpts.cfgCutPtPIDDauMin.value; + double bachPtcut = trkQualityOpts.cfgCutPtPIDbachMin.value; + double posdauPtcut = trkQualityOpts.cfgCutPtPIDposdauMin.value; + double negdauPtcut = trkQualityOpts.cfgCutPtPIDnegdauMin.value; if (cfgOutputV0) { for (const auto& v0 : V0s) { @@ -1199,14 +1223,14 @@ struct FlowGfwOmegaXi { if (casc.pt() > trkQualityOpts.cfgCutPtOmegaMin.value && casc.pt() < trkQualityOpts.cfgCutPtOmegaMax.value) { if (casc.sign() < 0 && std::fabs(casc.yOmega()) < cfgCasc_rapidity && (std::fabs(bachelor.tpcNSigmaKa()) < cfgNSigma[2] && std::fabs(posdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(negdau.tpcNSigmaPi()) < cfgNSigma[0]) && - ((std::fabs(bachelor.tofNSigmaKa()) < cfgNSigma[5] || bachelor.pt() < lowpt) && (std::fabs(posdau.tofNSigmaPr()) < cfgNSigma[4] || posdau.pt() < lowpt) && (std::fabs(negdau.tofNSigmaPi()) < cfgNSigma[3] || negdau.pt() < lowpt)) && - ((std::fabs(itsResponse.nSigmaITS(bachelor)) < cfgNSigma[8]) || bachelor.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(posdau)) < cfgNSigma[7]) || posdau.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(negdau)) < cfgNSigma[6]) || negdau.pt() < lowpt)) { + ((std::fabs(bachelor.tofNSigmaKa()) < cfgNSigma[5] || bachelor.pt() < bachPtcut) && (std::fabs(posdau.tofNSigmaPr()) < cfgNSigma[4] || posdau.pt() < posdauPtcut) && (std::fabs(negdau.tofNSigmaPi()) < cfgNSigma[3] || negdau.pt() < negdauPtcut)) && + ((std::fabs(itsResponse.nSigmaITS(bachelor)) < cfgNSigma[8]) || bachelor.pt() < bachPtcut) && ((std::fabs(itsResponse.nSigmaITS(posdau)) < cfgNSigma[7]) || posdau.pt() < posdauPtcut) && ((std::fabs(itsResponse.nSigmaITS(negdau)) < cfgNSigma[6]) || negdau.pt() < negdauPtcut)) { registry.fill(HIST("InvMassOmega_all"), casc.pt(), casc.mOmega(), casc.eta(), cent); isOmega = true; } else if (casc.sign() > 0 && std::fabs(casc.yOmega()) < cfgCasc_rapidity && (std::fabs(bachelor.tpcNSigmaKa()) < cfgNSigma[2] && std::fabs(negdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(posdau.tpcNSigmaPi()) < cfgNSigma[0]) && - ((std::fabs(bachelor.tofNSigmaKa()) < cfgNSigma[5] || bachelor.pt() < lowpt) && (std::fabs(negdau.tofNSigmaPr()) < cfgNSigma[4] || negdau.pt() < lowpt) && (std::fabs(posdau.tofNSigmaPi()) < cfgNSigma[3] || posdau.pt() < lowpt)) && - ((std::fabs(itsResponse.nSigmaITS(bachelor)) < cfgNSigma[8]) || bachelor.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(posdau)) < cfgNSigma[7]) || posdau.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(negdau)) < cfgNSigma[6]) || negdau.pt() < lowpt)) { + ((std::fabs(bachelor.tofNSigmaKa()) < cfgNSigma[5] || bachelor.pt() < bachPtcut) && (std::fabs(negdau.tofNSigmaPr()) < cfgNSigma[4] || negdau.pt() < negdauPtcut) && (std::fabs(posdau.tofNSigmaPi()) < cfgNSigma[3] || posdau.pt() < posdauPtcut)) && + ((std::fabs(itsResponse.nSigmaITS(bachelor)) < cfgNSigma[8]) || bachelor.pt() < bachPtcut) && ((std::fabs(itsResponse.nSigmaITS(posdau)) < cfgNSigma[7]) || posdau.pt() < posdauPtcut) && ((std::fabs(itsResponse.nSigmaITS(negdau)) < cfgNSigma[6]) || negdau.pt() < negdauPtcut)) { registry.fill(HIST("InvMassOmega_all"), casc.pt(), casc.mOmega(), casc.eta(), cent); isOmega = true; } @@ -1215,14 +1239,14 @@ struct FlowGfwOmegaXi { if (casc.pt() > trkQualityOpts.cfgCutPtXiMin.value && casc.pt() < trkQualityOpts.cfgCutPtXiMax.value) { if (casc.sign() < 0 && std::fabs(casc.yXi()) < cfgCasc_rapidity && (std::fabs(bachelor.tpcNSigmaPi()) < cfgNSigma[0] && std::fabs(posdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(negdau.tpcNSigmaPi()) < cfgNSigma[0]) && - ((std::fabs(bachelor.tofNSigmaPi()) < cfgNSigma[3] || bachelor.pt() < lowpt) && (std::fabs(posdau.tofNSigmaPr()) < cfgNSigma[4] || posdau.pt() < lowpt) && (std::fabs(negdau.tofNSigmaPi()) < cfgNSigma[3] || negdau.pt() < lowpt)) && - ((std::fabs(itsResponse.nSigmaITS(bachelor)) < cfgNSigma[6]) || bachelor.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(posdau)) < cfgNSigma[7]) || posdau.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(negdau)) < cfgNSigma[6]) || negdau.pt() < lowpt)) { + ((std::fabs(bachelor.tofNSigmaPi()) < cfgNSigma[3] || bachelor.pt() < bachPtcut) && (std::fabs(posdau.tofNSigmaPr()) < cfgNSigma[4] || posdau.pt() < posdauPtcut) && (std::fabs(negdau.tofNSigmaPi()) < cfgNSigma[3] || negdau.pt() < negdauPtcut)) && + ((std::fabs(itsResponse.nSigmaITS(bachelor)) < cfgNSigma[6]) || bachelor.pt() < bachPtcut) && ((std::fabs(itsResponse.nSigmaITS(posdau)) < cfgNSigma[7]) || posdau.pt() < posdauPtcut) && ((std::fabs(itsResponse.nSigmaITS(negdau)) < cfgNSigma[6]) || negdau.pt() < negdauPtcut)) { registry.fill(HIST("InvMassXi_all"), casc.pt(), casc.mXi(), casc.eta(), cent); isXi = true; } else if (casc.sign() > 0 && std::fabs(casc.yXi()) < cfgCasc_rapidity && (std::fabs(bachelor.tpcNSigmaPi()) < cfgNSigma[0] && std::fabs(negdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(posdau.tpcNSigmaPi()) < cfgNSigma[0]) && - ((std::fabs(bachelor.tofNSigmaPi()) < cfgNSigma[3] || bachelor.pt() < lowpt) && (std::fabs(negdau.tofNSigmaPr()) < cfgNSigma[4] || negdau.pt() < lowpt) && (std::fabs(posdau.tofNSigmaPi()) < cfgNSigma[3] || posdau.pt() < lowpt)) && - ((std::fabs(itsResponse.nSigmaITS(bachelor)) < cfgNSigma[6]) || bachelor.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(posdau)) < cfgNSigma[7]) || posdau.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(negdau)) < cfgNSigma[6]) || negdau.pt() < lowpt)) { + ((std::fabs(bachelor.tofNSigmaPi()) < cfgNSigma[3] || bachelor.pt() < bachPtcut) && (std::fabs(negdau.tofNSigmaPr()) < cfgNSigma[4] || negdau.pt() < negdauPtcut) && (std::fabs(posdau.tofNSigmaPi()) < cfgNSigma[3] || posdau.pt() < posdauPtcut)) && + ((std::fabs(itsResponse.nSigmaITS(bachelor)) < cfgNSigma[6]) || bachelor.pt() < bachPtcut) && ((std::fabs(itsResponse.nSigmaITS(posdau)) < cfgNSigma[7]) || posdau.pt() < posdauPtcut) && ((std::fabs(itsResponse.nSigmaITS(negdau)) < cfgNSigma[6]) || negdau.pt() < negdauPtcut)) { registry.fill(HIST("InvMassXi_all"), casc.pt(), casc.mXi(), casc.eta(), cent); isXi = true; } From 14f4f071dace404344900b7adf678468037a275e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= <26327373+vkucera@users.noreply.github.com> Date: Tue, 7 Oct 2025 00:10:24 +0200 Subject: [PATCH 646/986] [PWGHF] Cleanup, optimisation, bug fixes using clang-tidy (#13206) Co-authored-by: ALICE Builder --- PWGHF/Core/CentralityEstimation.h | 30 +- PWGHF/Core/HfHelper.h | 20 +- PWGHF/Core/HfMlResponseBplusToD0Pi.h | 4 +- PWGHF/Core/HfMlResponseBplusToJpsiKReduced.h | 2 + PWGHF/Core/HfMlResponseBsToJpsiPhiReduced.h | 2 + PWGHF/Core/SelectorCuts.h | 62 +- PWGHF/D2H/Core/SelectorCutsRedDataFormat.h | 4 +- PWGHF/D2H/DataModel/ReducedDataModel.h | 13 +- PWGHF/D2H/Macros/HFInvMassFitter.cxx | 110 +- PWGHF/D2H/Macros/HFInvMassFitter.h | 56 +- PWGHF/D2H/Macros/runMassFitter.C | 94 +- .../candidateCreatorB0Reduced.cxx | 30 +- .../candidateCreatorBToJpsiReduced.cxx | 24 +- .../candidateCreatorBplusReduced.cxx | 18 +- .../candidateCreatorBsReduced.cxx | 18 +- .../candidateCreatorCharmResoReduced.cxx | 128 +- .../candidateCreatorLbReduced.cxx | 22 +- .../candidateSelectorB0ToDPiReduced.cxx | 18 +- .../candidateSelectorBplusToD0PiReduced.cxx | 10 +- .../candidateSelectorBsToDsPiReduced.cxx | 10 +- .../candidateSelectorLbToLcPiReduced.cxx | 10 +- .../dataCreatorCharmHadPiReduced.cxx | 245 ++-- .../dataCreatorCharmResoReduced.cxx | 190 +-- .../dataCreatorJpsiHadReduced.cxx | 48 +- PWGHF/D2H/Tasks/taskB0.cxx | 6 +- PWGHF/D2H/Tasks/taskB0Reduced.cxx | 90 +- PWGHF/D2H/Tasks/taskBplusReduced.cxx | 48 +- PWGHF/D2H/Tasks/taskBplusToJpsiKReduced.cxx | 18 +- PWGHF/D2H/Tasks/taskBs.cxx | 6 +- PWGHF/D2H/Tasks/taskBsReduced.cxx | 56 +- PWGHF/D2H/Tasks/taskBsToJpsiPhiReduced.cxx | 22 +- PWGHF/D2H/Tasks/taskCharmPolarisation.cxx | 402 +++--- .../D2H/Tasks/taskCharmResoToDTrkReduced.cxx | 27 +- PWGHF/D2H/Tasks/taskCharmResoToDV0Reduced.cxx | 65 +- PWGHF/D2H/Tasks/taskD0.cxx | 26 +- .../Tasks/taskDirectedFlowCharmHadrons.cxx | 32 +- PWGHF/D2H/Tasks/taskDplus.cxx | 54 +- PWGHF/D2H/Tasks/taskDs.cxx | 167 ++- PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx | 46 +- PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx | 164 +-- PWGHF/D2H/Tasks/taskLb.cxx | 87 +- PWGHF/D2H/Tasks/taskLbReduced.cxx | 50 +- PWGHF/D2H/Tasks/taskLc.cxx | 35 +- PWGHF/D2H/Tasks/taskLcToK0sP.cxx | 38 +- PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx | 38 +- PWGHF/D2H/Tasks/taskSigmac.cxx | 81 +- PWGHF/D2H/Tasks/taskSigmacToCascade.cxx | 44 +- PWGHF/D2H/Tasks/taskXic.cxx | 22 +- PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx | 38 +- PWGHF/D2H/Tasks/taskXicToXiPiPi.cxx | 40 +- PWGHF/D2H/Tasks/taskXicc.cxx | 6 +- PWGHF/D2H/Utils/utilsRedDataFormat.h | 10 +- PWGHF/D2H/Utils/utilsSigmac.h | 2 + PWGHF/HFC/Macros/DhCorrelationExtraction.cxx | 1182 +++++++++-------- PWGHF/HFC/Macros/DhCorrelationExtraction.h | 146 +- PWGHF/HFC/Macros/DhCorrelationFitter.cxx | 263 ++-- PWGHF/HFC/Macros/DhCorrelationFitter.h | 90 +- PWGHF/HFC/Macros/ExtractOutputCorrel.C | 322 ++--- PWGHF/HFC/Macros/FitCorrel.C | 256 ++-- PWGHF/HFC/TableProducer/correlatorD0D0bar.cxx | 22 +- .../correlatorD0D0barBarrelFullPid.cxx | 22 +- .../HFC/TableProducer/correlatorD0Hadrons.cxx | 50 +- .../TableProducer/correlatorDMesonPairs.cxx | 114 +- .../TableProducer/correlatorDplusDminus.cxx | 22 +- .../TableProducer/correlatorDplusHadrons.cxx | 64 +- .../HFC/TableProducer/correlatorDsHadrons.cxx | 68 +- .../correlatorDsHadronsReduced.cxx | 16 +- .../TableProducer/correlatorDstarHadrons.cxx | 24 +- .../correlatorFlowCharmHadronsReduced.cxx | 60 +- .../TableProducer/correlatorHfeHadrons.cxx | 29 +- .../HFC/TableProducer/correlatorLcHadrons.cxx | 102 +- .../TableProducer/correlatorLcScHadrons.cxx | 177 +-- .../derivedDataCreatorCorrelationsReduced.cxx | 98 +- .../HFC/TableProducer/femtoDreamProducer.cxx | 79 +- .../HFC/Tasks/taskCharmHadronsFemtoDream.cxx | 27 +- PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx | 154 +-- PWGHF/HFC/Tasks/taskCorrelationDDbar.cxx | 78 +- .../HFC/Tasks/taskCorrelationDMesonPairs.cxx | 43 +- .../HFC/Tasks/taskCorrelationDplusHadrons.cxx | 146 +- PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx | 179 +-- .../HFC/Tasks/taskCorrelationDstarHadrons.cxx | 48 +- PWGHF/HFC/Tasks/taskCorrelationHfeHadrons.cxx | 6 +- PWGHF/HFC/Tasks/taskCorrelationLcHadrons.cxx | 144 +- PWGHF/HFC/Tasks/taskFlow.cxx | 204 +-- PWGHF/HFC/Utils/utilsCorrelations.h | 15 +- .../electronSelectionWithTpcEmcal.cxx | 27 +- .../TableProducer/treeCreatorElectronDCA.cxx | 26 +- PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx | 94 +- .../Tasks/taskMuonCharmBeautySeparation.cxx | 29 +- PWGHF/HFL/Tasks/taskSingleElectron.cxx | 285 ++-- PWGHF/HFL/Tasks/taskSingleMuon.cxx | 34 +- PWGHF/HFL/Tasks/taskSingleMuonMult.cxx | 38 +- PWGHF/HFL/Tasks/taskSingleMuonReader.cxx | 38 +- PWGHF/HFL/Tasks/taskSingleMuonReaderAssoc.cxx | 38 +- PWGHF/HFL/Tasks/taskSingleMuonSource.cxx | 29 +- .../computeFonllPlusPythiaPredictions.C | 84 +- .../TableProducer/candidateCreator2Prong.cxx | 74 +- .../TableProducer/candidateCreator3Prong.cxx | 90 +- PWGHF/TableProducer/candidateCreatorB0.cxx | 26 +- PWGHF/TableProducer/candidateCreatorBplus.cxx | 12 +- PWGHF/TableProducer/candidateCreatorBs.cxx | 30 +- .../TableProducer/candidateCreatorCascade.cxx | 50 +- PWGHF/TableProducer/candidateCreatorDstar.cxx | 54 +- PWGHF/TableProducer/candidateCreatorLb.cxx | 15 +- .../candidateCreatorSigmac0plusplus.cxx | 33 +- ...candidateCreatorSigmac0plusplusCascade.cxx | 65 +- .../candidateCreatorXic0Omegac0.cxx | 555 ++++---- .../candidateCreatorXicToXiPiPi.cxx | 121 +- PWGHF/TableProducer/candidateCreatorXicc.cxx | 16 +- .../candidateSelectorB0ToDPi.cxx | 10 +- .../candidateSelectorBplusToD0Pi.cxx | 10 +- .../candidateSelectorBsToDsPi.cxx | 12 +- PWGHF/TableProducer/candidateSelectorD0.cxx | 18 +- .../candidateSelectorDplusToPiKPi.cxx | 8 +- .../candidateSelectorDsToKKPi.cxx | 37 +- .../candidateSelectorDstarToD0Pi.cxx | 4 +- .../candidateSelectorLbToLcPi.cxx | 44 +- PWGHF/TableProducer/candidateSelectorLc.cxx | 59 +- .../candidateSelectorLcPidMl.cxx | 44 +- .../candidateSelectorLcToK0sP.cxx | 20 +- .../candidateSelectorOmegac0ToOmegaKa.cxx | 20 +- .../candidateSelectorOmegac0ToOmegaPi.cxx | 49 +- .../candidateSelectorOmegac0Xic0ToOmegaKa.cxx | 50 +- .../TableProducer/candidateSelectorToXiPi.cxx | 24 +- .../candidateSelectorXic0ToXiPiKf.cxx | 24 +- .../candidateSelectorXicToPKPi.cxx | 16 +- .../candidateSelectorXicToXiPiPi.cxx | 53 +- .../candidateSelectorXiccToPKPiPi.cxx | 6 +- .../derivedDataCreatorB0ToDPi.cxx | 28 +- .../derivedDataCreatorBplusToD0Pi.cxx | 30 +- .../derivedDataCreatorD0ToKPi.cxx | 28 +- .../derivedDataCreatorDplusToPiKPi.cxx | 28 +- .../derivedDataCreatorDsToKKPi.cxx | 28 +- .../derivedDataCreatorDstarToD0Pi.cxx | 24 +- .../derivedDataCreatorLcToPKPi.cxx | 30 +- .../derivedDataCreatorXicToXiPiPi.cxx | 28 +- PWGHF/TableProducer/mcPidTof.cxx | 180 ++- PWGHF/TableProducer/pidCreator.cxx | 4 +- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 121 +- PWGHF/TableProducer/treeCreatorB0ToDPi.cxx | 8 +- .../TableProducer/treeCreatorBplusToD0Pi.cxx | 8 +- PWGHF/TableProducer/treeCreatorBsToDsPi.cxx | 8 +- PWGHF/TableProducer/treeCreatorD0ToKPi.cxx | 44 +- .../TableProducer/treeCreatorDplusToPiKPi.cxx | 16 +- PWGHF/TableProducer/treeCreatorDsToKKPi.cxx | 31 +- .../TableProducer/treeCreatorDstarToD0Pi.cxx | 8 +- PWGHF/TableProducer/treeCreatorLbToLcPi.cxx | 16 +- PWGHF/TableProducer/treeCreatorLcToK0sP.cxx | 12 +- PWGHF/TableProducer/treeCreatorLcToPKPi.cxx | 52 +- PWGHF/TableProducer/treeCreatorOmegacSt.cxx | 90 +- .../treeCreatorSigmacCorrBkg.cxx | 36 +- .../TableProducer/treeCreatorTccToD0D0Pi.cxx | 16 +- PWGHF/TableProducer/treeCreatorToXiPi.cxx | 10 +- .../TableProducer/treeCreatorXic0ToXiPiKf.cxx | 4 +- PWGHF/TableProducer/treeCreatorXicToPKPi.cxx | 14 +- .../TableProducer/treeCreatorXicToXiPiPi.cxx | 14 +- .../TableProducer/treeCreatorXiccToPKPiPi.cxx | 20 +- PWGHF/Tasks/taskCharmHadImpactPar.cxx | 36 +- PWGHF/Tasks/taskLcCentrality.cxx | 8 +- PWGHF/Tasks/taskMcEfficiency.cxx | 84 +- PWGHF/Tasks/taskMcEfficiencyToXiPi.cxx | 4 +- PWGHF/Tasks/taskMcGenPtRapShapes.cxx | 32 +- PWGHF/Tasks/taskMcValidation.cxx | 436 +++--- .../taskMultiplicityEstimatorCorrelation.cxx | 20 +- PWGHF/Tasks/taskPidStudies.cxx | 24 +- PWGHF/Tasks/taskSelOptimisation.cxx | 188 +-- PWGHF/Utils/utilsAnalysis.h | 2 +- PWGHF/Utils/utilsDerivedData.h | 6 +- PWGHF/Utils/utilsEvSelHf.h | 56 +- PWGHF/Utils/utilsMcGen.h | 8 +- PWGHF/Utils/utilsPid.h | 12 +- PWGHF/Utils/utilsTrkCandHf.h | 4 +- 172 files changed, 5740 insertions(+), 5625 deletions(-) diff --git a/PWGHF/Core/CentralityEstimation.h b/PWGHF/Core/CentralityEstimation.h index 916d183a289..71cdc0ebffd 100644 --- a/PWGHF/Core/CentralityEstimation.h +++ b/PWGHF/Core/CentralityEstimation.h @@ -18,6 +18,8 @@ #include +#include + namespace o2::hf_centrality { // centrality selection estimators @@ -32,34 +34,34 @@ enum CentralityEstimator { }; template -concept hasFT0ACent = requires(T collision) { +concept HasFT0ACent = requires(T collision) { collision.centFT0A(); }; template -concept hasFT0CCent = requires(T collision) { +concept HasFT0CCent = requires(T collision) { collision.centFT0C(); }; template -concept hasFT0MCent = requires(T collision) { +concept HasFT0MCent = requires(T collision) { collision.centFT0M(); }; template -concept hasFV0ACent = requires(T collision) { +concept HasFV0ACent = requires(T collision) { collision.centFV0A(); }; template -concept hasNTracksPVCent = requires(T collision) { +concept HasNTracksPvCent = requires(T collision) { collision.centNTPV(); }; /// Evaluate centrality/multiplicity percentile using FT0A estimator /// \param candidate is candidate /// \return centrality/multiplicity percentile of the collision -template +template float getCentralityColl(const TCollision& collision) { return collision.centFT0A(); @@ -68,7 +70,7 @@ float getCentralityColl(const TCollision& collision) /// Evaluate centrality/multiplicity percentile using FT0C estimator /// \param candidate is candidate /// \return centrality/multiplicity percentile of the collision -template +template float getCentralityColl(const TCollision& collision) { return collision.centFT0C(); @@ -77,7 +79,7 @@ float getCentralityColl(const TCollision& collision) /// Evaluate centrality/multiplicity percentile using FT0M estimator /// \param candidate is candidate /// \return centrality/multiplicity percentile of the collision -template +template float getCentralityColl(const TCollision& collision) { return collision.centFT0M(); @@ -86,7 +88,7 @@ float getCentralityColl(const TCollision& collision) /// Evaluate centrality/multiplicity percentile using FV0A estimator /// \param candidate is candidate /// \return centrality/multiplicity percentile of the collision -template +template float getCentralityColl(const TCollision& collision) { return collision.centFV0A(); @@ -95,7 +97,7 @@ float getCentralityColl(const TCollision& collision) /// Evaluate centrality/multiplicity percentile using NTracksPV estimator /// \param candidate is candidate /// \return centrality/multiplicity percentile of the collision -template +template float getCentralityColl(const TCollision& collision) { return collision.centNTPV(); @@ -119,25 +121,25 @@ float getCentralityColl(const TCollision& collision, const int centEstimator) { switch (centEstimator) { case CentralityEstimator::FT0A: - if constexpr (hasFT0ACent) { + if constexpr (HasFT0ACent) { return collision.centFT0A(); } LOG(fatal) << "Collision does not have centFT0A()."; break; case CentralityEstimator::FT0C: - if constexpr (hasFT0CCent) { + if constexpr (HasFT0CCent) { return collision.centFT0C(); } LOG(fatal) << "Collision does not have centFT0C()."; break; case CentralityEstimator::FT0M: - if constexpr (hasFT0MCent) { + if constexpr (HasFT0MCent) { return collision.centFT0M(); } LOG(fatal) << "Collision does not have centFT0M()."; break; case CentralityEstimator::FV0A: - if constexpr (hasFV0ACent) { + if constexpr (HasFV0ACent) { return collision.centFV0A(); } LOG(fatal) << "Collision does not have centFV0A()."; diff --git a/PWGHF/Core/HfHelper.h b/PWGHF/Core/HfHelper.h index 37798045914..85190c4e245 100644 --- a/PWGHF/Core/HfHelper.h +++ b/PWGHF/Core/HfHelper.h @@ -290,9 +290,9 @@ class HfHelper auto cosPiKPhiRestFrame(const T& candidate, int option) { // Ported from AliAODRecoDecayHF3Prong::CosPiKPhiRFrame - std::array momPi; - std::array momK1; - std::array momK2; + std::array momPi{}; + std::array momK1{}; + std::array momK2{}; if (option == 0) { // KKPi momPi = candidate.pVectorProng2(); @@ -304,12 +304,12 @@ class HfHelper momK2 = candidate.pVectorProng2(); } - ROOT::Math::PxPyPzMVector vecPi(momPi[0], momPi[1], momPi[2], o2::constants::physics::MassPiPlus); - ROOT::Math::PxPyPzMVector vecK1(momK1[0], momK1[1], momK1[2], o2::constants::physics::MassKPlus); - ROOT::Math::PxPyPzMVector vecK2(momK2[0], momK2[1], momK2[2], o2::constants::physics::MassKPlus); - ROOT::Math::PxPyPzMVector vecPhi = vecK1 + vecK2; + ROOT::Math::PxPyPzMVector const vecPi(momPi[0], momPi[1], momPi[2], o2::constants::physics::MassPiPlus); + ROOT::Math::PxPyPzMVector const vecK1(momK1[0], momK1[1], momK1[2], o2::constants::physics::MassKPlus); + ROOT::Math::PxPyPzMVector const vecK2(momK2[0], momK2[1], momK2[2], o2::constants::physics::MassKPlus); + ROOT::Math::PxPyPzMVector const vecPhi = vecK1 + vecK2; - ROOT::Math::Boost boostToPhiRestFrame(vecPhi.BoostToCM()); + ROOT::Math::Boost const boostToPhiRestFrame(vecPhi.BoostToCM()); auto momPiPhiRestFrame = boostToPhiRestFrame(vecPi).Vect(); auto momK1PhiRestFrame = boostToPhiRestFrame(vecK1).Vect(); @@ -522,8 +522,8 @@ class HfHelper phiPi = RecoDecay::phi(candidate.pxProng2(), candidate.pyProng2()); } - double deltaEta = etaJpsi - etaPi; - double deltaPhi = RecoDecay::constrainAngle(phiJpsi - phiPi, -o2::constants::math::PI); + double const deltaEta = etaJpsi - etaPi; + double const deltaPhi = RecoDecay::constrainAngle(phiJpsi - phiPi, -o2::constants::math::PI); return RecoDecay::sqrtSumOfSquares(deltaEta, deltaPhi); } diff --git a/PWGHF/Core/HfMlResponseBplusToD0Pi.h b/PWGHF/Core/HfMlResponseBplusToD0Pi.h index 427e90fd16d..9593101719e 100644 --- a/PWGHF/Core/HfMlResponseBplusToD0Pi.h +++ b/PWGHF/Core/HfMlResponseBplusToD0Pi.h @@ -21,6 +21,8 @@ #include "Tools/ML/MlResponse.h" +#include + #include #include @@ -63,7 +65,7 @@ // where OBJECT is named candidateD , FEATURE = GETTER and INDEX is the index of the vector #define CHECK_AND_FILL_VEC_D0_INDEX(FEATURE, GETTER1, GETTER2, INDEX) \ case static_cast(InputFeaturesBplusToD0Pi::FEATURE): { \ - if (pdgCode == o2::constants::physics::kD0) { \ + if (pdgCode == o2::constants::physics::Pdg::kD0) { \ inputFeatures.emplace_back((candidateD0.GETTER1())[INDEX]); \ } else { \ inputFeatures.emplace_back((candidateD0.GETTER2())[INDEX]); \ diff --git a/PWGHF/Core/HfMlResponseBplusToJpsiKReduced.h b/PWGHF/Core/HfMlResponseBplusToJpsiKReduced.h index ebf77e7effe..85830fcb55b 100644 --- a/PWGHF/Core/HfMlResponseBplusToJpsiKReduced.h +++ b/PWGHF/Core/HfMlResponseBplusToJpsiKReduced.h @@ -21,6 +21,8 @@ #include "Tools/ML/MlResponse.h" +#include + #include #include diff --git a/PWGHF/Core/HfMlResponseBsToJpsiPhiReduced.h b/PWGHF/Core/HfMlResponseBsToJpsiPhiReduced.h index 2af47921132..ee9fb5956c7 100644 --- a/PWGHF/Core/HfMlResponseBsToJpsiPhiReduced.h +++ b/PWGHF/Core/HfMlResponseBsToJpsiPhiReduced.h @@ -21,6 +21,8 @@ #include "Tools/ML/MlResponse.h" +#include + #include #include diff --git a/PWGHF/Core/SelectorCuts.h b/PWGHF/Core/SelectorCuts.h index a3df78aee0f..2feeb313af6 100644 --- a/PWGHF/Core/SelectorCuts.h +++ b/PWGHF/Core/SelectorCuts.h @@ -40,7 +40,7 @@ constexpr double BinsPtTrack[NBinsPtTrack + 1] = { 2.0, 3.0, 1000.0}; -auto vecBinsPtTrack = std::vector{BinsPtTrack, BinsPtTrack + NBinsPtTrack + 1}; +const auto vecBinsPtTrack = std::vector{BinsPtTrack, BinsPtTrack + NBinsPtTrack + 1}; // default values for the dca_xy and dca_z cuts of displaced tracks constexpr double CutsTrack[NBinsPtTrack][NCutVarsTrack] = {{0.0000, 10., 0.0000, 100.}, /* 0 < pt < 0.5 */ @@ -86,7 +86,7 @@ static constexpr int NCutBdtScores = 3; constexpr double BinsPt[NBinsPt + 1] = { 0., 1000.0}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts constexpr double Cuts[NBinsPt][NCutBdtScores] = {{0.1, 0.5, 0.5}}; @@ -134,7 +134,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 16., 24., 50.}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the ML model paths, one model per pT bin static const std::vector modelPaths = { @@ -142,7 +142,7 @@ static const std::vector modelPaths = { // default values for the cut directions constexpr int CutDir[NCutScores] = {CutGreater, CutSmaller, CutSmaller}; -auto vecCutDir = std::vector{CutDir, CutDir + NCutScores}; +const auto vecCutDir = std::vector{CutDir, CutDir + NCutScores}; // default values for the cuts constexpr double Cuts[NBinsPt][NCutScores] = { @@ -190,7 +190,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 1., 5., 1000.0}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts constexpr double Cuts[NBinsPt][NCutVars] = {{1.65, 2.15, 0.5, 100.}, /* 1 < pt < 5 */ @@ -214,7 +214,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 1., 5., 1000.0}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts constexpr double Cuts[NBinsPt][NCutVars] = {{1.75, 2.05, 0.7, 0.02}, /* 1 < pt < 5 */ @@ -237,7 +237,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 1., 5., 1000.0}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts constexpr double Cuts[NBinsPt][NCutVars] = {{1.70, 2.15, 0.7, 0.02, 0.02}, /* 1 < pt < 5 */ @@ -260,7 +260,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 1., 5., 1000.0}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts constexpr double Cuts[NBinsPt][NCutVars] = {{0.17, 0.05}, /* 1 < pt < 5 */ @@ -306,7 +306,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 36.0, 50.0, 100.0}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts constexpr double Cuts[NBinsPt][NCutVars] = {{0.400, 350. * 1E-4, 0.8, 0.5, 0.5, 1000. * 1E-4, 1000. * 1E-4, -5000. * 1E-8, 0.80, 0., 0., 10., 10., 0.06, 0.5}, /* 0 < pT < 0.5 */ @@ -400,7 +400,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 36.0, 50.0, 100.0}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // row labels static const std::vector labelsPt = { @@ -480,7 +480,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 12., 24., 36.}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts m, ptP, ptK, ptPi, chi2PCA, dL, cosp, dLXY, NdLXY, ImpParXY, mass(Kpi) constexpr double Cuts[NBinsPt][NCutVars] = {{0.4, 0.4, 0.4, 0.4, 0., 0.005, 0., 0., 0., 1e+10, -1.}, /* 0 < pT < 1 */ @@ -541,7 +541,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 8., 12., 24.}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts // mLc(GeV) mK0s(GeV) mLambdas(GeV) mGammas(GeV) ptp ptK0sdau ptK0s d0p d0K0 @@ -589,7 +589,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 16., 24., 36.}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts // selections from pp at 5 TeV 2017 analysis https://alice-notes.web.cern.ch/node/808 @@ -640,7 +640,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 12., 16., 24.}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts // selections from pp at 5 TeV 2017 analysis https://alice-notes.web.cern.ch/node/808 @@ -682,7 +682,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 6.0, 12.0}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts // pi_pT @@ -716,7 +716,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 6.0, 12.0}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts // pi_pT @@ -756,7 +756,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 16.0, 24.0}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts constexpr double Cuts[NBinsPt][NCutVars] = {{0.2, 0.99, 0.97, 0.99, 0.99, 0.1, 0.2, 1.0, 0.04, 0.06, 0.06, 0.05, 0.3, 70, 60, 100, 120, 250, 250, 0.4, 100, 300, 0., 0., 1.5, 0., 0., 0.4}, /* 0 < pt < 1 */ @@ -811,7 +811,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 12., 24., 36.}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts m ptP ptK ptPi chi2PCA dL cosp, dLXY, NdL, ct, ImpParXY constexpr double Cuts[NBinsPt][NCutVars] = {{0.400, 0.4, 0.4, 0.4, 1e-5, 0.005, 0.8, 0.005, 4., 2., 0.}, /* 0 < pT < 1 */ @@ -863,7 +863,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 11., 12., 20.}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts m Y Eta EtaPi EtaXi pT Pi0 Pi1 Sum chi2SV dL dLXY invMass Xi-Pi pairs constexpr double Cuts[NBinsPt][NCutVars] = {{0.4, 0.8, 0.8, 0.8, 1.0, 0.1, 0.1, 0.2, 100, 0.0, 0.0, 2.4, 2.4}, /* 0 < pT < 1 */ @@ -918,7 +918,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 12., 24., 36.}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts constexpr double Cuts[NBinsPt][NCutVars] = {{0.400, 0.5, 0.2, 1.e-3, 10.0, 1.e-3, 10.0, 9999., 1.e-3, 0.0, 50.0, 50.0, 0.8, 0.8}, /* 0 < pT < 1 */ @@ -967,7 +967,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 10.0, 15.0, }; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts constexpr double Cuts[NBinsPt][NCutVars] = {{0.5, 0.2, 0.4, 1, 1.}, /* 0 < pT < 0.5 */ @@ -1014,7 +1014,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 10.0, 16.0, }; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts constexpr double Cuts[NBinsPt][NCutVars] = {{0.6, 1.0, 0.2, 0.2, 0.9, 0.9, 0., 0.}, /* 0 < pT < 0.5 */ @@ -1064,7 +1064,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 20.0, 24.0}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts // DeltaM CPA chi2PCA d0D d0Pi pTD pTPi B0DecayLength B0DecayLengthXY IPProd DeltaMD CthetaStr @@ -1118,7 +1118,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 16.0, 24.0}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts // DeltaM CPA chi2PCA d0Ds d0Pi pTDs pTPi BsDecayLength BsDecayLengthXY IPProd @@ -1171,7 +1171,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 20.0, 24.0}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts // DeltaM CPA d0Jpsi d0K pTJpsi pTK BDecayLength BDecayLengthXY BIPProd DeltaMJpsi JpsiIPProd @@ -1227,7 +1227,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 20.0, 24.0}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts // DeltaM CPA d0D0 d0Pi pTD0 pTPi BDecayLength BDecayLengthXY IPProd DeltaMD0 CthetaStr @@ -1283,7 +1283,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 20.0, 24.0}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts // DeltaM CPA d0Jpsi d0K pTJpsi pTK BDecayLength BDecayLengthXY BIPProd DeltaMJpsi JpsiIPProd @@ -1339,7 +1339,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 20.0, 24.0}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts // DeltaM CPA chi2PCA d0Lc d0Pi pTLc pTPi LbDecayLength LbDecayLengthXY IPProd DeltaMLc CthetaStr @@ -1392,7 +1392,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 10.0, 15.0, }; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts // m CPA d0Jpsi d0Pi pTJpsi pTPi chi2PCA @@ -1439,7 +1439,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 10.0, 15.0, }; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts // m CPA d0Jpsi d0gamma pTJpsi pTgamma chi2PCA @@ -1485,7 +1485,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 12., 24., 36.}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts constexpr double Cuts[NBinsPt][NCutVars] = {{0.03, 0.03}, /* 0 < pT < 1 */ diff --git a/PWGHF/D2H/Core/SelectorCutsRedDataFormat.h b/PWGHF/D2H/Core/SelectorCutsRedDataFormat.h index 4373ded905c..c18fcf61290 100644 --- a/PWGHF/D2H/Core/SelectorCutsRedDataFormat.h +++ b/PWGHF/D2H/Core/SelectorCutsRedDataFormat.h @@ -37,7 +37,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 12., 24., 1000.}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts constexpr double Cuts[NBinsPt][NCutVars] = {{1.84, 1.89, 1.77, 1.81, 1.92, 1.96}, /* 1 < pt < 2 */ {1.84, 1.89, 1.77, 1.81, 1.92, 1.96}, /* 2 < pt < 4 */ @@ -73,7 +73,7 @@ constexpr double BinsPt[NBinsPt + 1] = { 12., 24., 1000.}; -auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; // default values for the cuts constexpr double Cuts[NBinsPt][NCutVars] = {{0.48, 0.52, 0.99, 1., 0.9}, /* 1 < pt < 2 */ {0.48, 0.52, 0.99, 1., 0.9}, /* 2 < pt < 4 */ diff --git a/PWGHF/D2H/DataModel/ReducedDataModel.h b/PWGHF/D2H/DataModel/ReducedDataModel.h index 549fa45ecf9..cb1c82afb41 100644 --- a/PWGHF/D2H/DataModel/ReducedDataModel.h +++ b/PWGHF/D2H/DataModel/ReducedDataModel.h @@ -25,6 +25,7 @@ #define PWGHF_D2H_DATAMODEL_REDUCEDDATAMODEL_H_ #include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/Utils/utilsEvSelHf.h" #include "PWGHF/Utils/utilsPid.h" #include "Common/Core/RecoDecay.h" @@ -747,14 +748,14 @@ using HfRedPidDau2 = HfRedPidDau2s::iterator; // Beauty candidates prongs namespace hf_cand_b0_reduced { -DECLARE_SOA_INDEX_COLUMN_FULL(Prong0, prong0, int, HfRed3Prongs, "_0"); //! Prong0 index -DECLARE_SOA_INDEX_COLUMN_FULL(Prong1, prong1, int, HfRedTrackBases, "_1"); //! Prong1 index -DECLARE_SOA_INDEX_COLUMN_FULL(ProngD0, prongD0, int, HfRed2Prongs, "_0"); //! ProngD0 index +DECLARE_SOA_INDEX_COLUMN_FULL(Prong0, prong0, int, HfRed3Prongs, "_0"); //! Prong0 index +DECLARE_SOA_INDEX_COLUMN_FULL(Prong1, prong1, int, HfRedTrackBases, "_1"); //! Prong1 index +DECLARE_SOA_INDEX_COLUMN_FULL(ProngD0, prongD0, int, HfRed2Prongs, "_0"); //! ProngD0 index DECLARE_SOA_INDEX_COLUMN_FULL(ProngBachPi, prongBachPi, int, HfRedTrackBases, "_1"); //! ProngBachPi index DECLARE_SOA_INDEX_COLUMN_FULL(ProngSoftPi, prongSoftPi, int, HfRedSoftPiBases, "_2"); //! ProngSoftPi index -DECLARE_SOA_COLUMN(Prong0MlScoreBkg, prong0MlScoreBkg, float); //! Bkg ML score of the D daughter -DECLARE_SOA_COLUMN(Prong0MlScorePrompt, prong0MlScorePrompt, float); //! Prompt ML score of the D daughter -DECLARE_SOA_COLUMN(Prong0MlScoreNonprompt, prong0MlScoreNonprompt, float); //! Nonprompt ML score of the D daughter +DECLARE_SOA_COLUMN(Prong0MlScoreBkg, prong0MlScoreBkg, float); //! Bkg ML score of the D daughter +DECLARE_SOA_COLUMN(Prong0MlScorePrompt, prong0MlScorePrompt, float); //! Prompt ML score of the D daughter +DECLARE_SOA_COLUMN(Prong0MlScoreNonprompt, prong0MlScoreNonprompt, float); //! Nonprompt ML score of the D daughter } // namespace hf_cand_b0_reduced DECLARE_SOA_TABLE(HfRedB0Prongs, "AOD", "HFREDB0PRONG", //! Table with B0 daughter indices diff --git a/PWGHF/D2H/Macros/HFInvMassFitter.cxx b/PWGHF/D2H/Macros/HFInvMassFitter.cxx index fba3d7c67a1..957ec2bc523 100644 --- a/PWGHF/D2H/Macros/HFInvMassFitter.cxx +++ b/PWGHF/D2H/Macros/HFInvMassFitter.cxx @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -56,8 +55,7 @@ using namespace RooFit; ClassImp(HFInvMassFitter); -HFInvMassFitter::HFInvMassFitter() : TNamed(), - mHistoInvMass(nullptr), +HFInvMassFitter::HFInvMassFitter() : mHistoInvMass(nullptr), mFitOption("L,E"), mMinMass(0), mMaxMass(5), @@ -128,8 +126,7 @@ HFInvMassFitter::HFInvMassFitter() : TNamed(), // default constructor } -HFInvMassFitter::HFInvMassFitter(const TH1* histoToFit, Double_t minValue, Double_t maxValue, Int_t fitTypeBkg, Int_t fitTypeSgn) : TNamed(), - mHistoInvMass(nullptr), +HFInvMassFitter::HFInvMassFitter(const TH1* histoToFit, Double_t minValue, Double_t maxValue, Int_t fitTypeBkg, Int_t fitTypeSgn) : mHistoInvMass(nullptr), mFitOption("L,E"), mMinMass(minValue), mMaxMass(maxValue), @@ -260,7 +257,7 @@ void HFInvMassFitter::doFit() if (mTypeOfBkgPdf == NoBkg) { // MC mRooNSgn = new RooRealVar("mRooNSig", "number of signal", 0.3 * mIntegralHisto, 0., 1.2 * mIntegralHisto); // signal yield mTotalPdf = new RooAddPdf("mMCFunc", "MC fit function", RooArgList(*sgnPdf), RooArgList(*mRooNSgn)); // create total pdf - if (!strcmp(mFitOption.Data(), "Chi2")) { + if (strcmp(mFitOption.Data(), "Chi2") == 0) { mTotalPdf->chi2FitTo(dataHistogram, Range("signal")); } else { mTotalPdf->fitTo(dataHistogram, Range("signal")); @@ -272,13 +269,13 @@ void HFInvMassFitter::doFit() } else { // data mBkgPdf = new RooAddPdf("mBkgPdf", "background fit function", RooArgList(*bkgPdf), RooArgList(*mRooNBkg)); if (mTypeOfSgnPdf == GausSec) { // two peak fit - if (!strcmp(mFitOption.Data(), "Chi2")) { + if (strcmp(mFitOption.Data(), "Chi2") == 0) { mBkgPdf->chi2FitTo(dataHistogram, Range("SBL,SBR,SEC"), Save()); } else { mBkgPdf->fitTo(dataHistogram, Range("SBL,SBR,SEC"), Save()); } } else { // single peak fit - if (!strcmp(mFitOption.Data(), "Chi2")) { + if (strcmp(mFitOption.Data(), "Chi2") == 0) { mBkgPdf->chi2FitTo(dataHistogram, Range("SBL,SBR"), Save()); } else { mBkgPdf->fitTo(dataHistogram, Range("SBL,SBR"), Save()); @@ -287,7 +284,7 @@ void HFInvMassFitter::doFit() // define the frame to evaluate background sidebands chi2 (bg pdf needs to be plotted within sideband ranges) RooPlot* frameTemporary = mass->frame(Title(Form("%s_temp", mHistoInvMass->GetTitle()))); dataHistogram.plotOn(frameTemporary, Name("data_for_bkgchi2")); - mBkgPdf->plotOn(frameTemporary, Range("SBL", "SBR"), Name("Bkg_sidebands")); + mBkgPdf->plotOn(frameTemporary, Range("SBL", true), Name("Bkg_sidebands")); mChiSquareOverNdfBkg = frameTemporary->chiSquare("Bkg_sidebands", "data_for_bkgchi2"); // calculate reduced chi2 / NDF of background sidebands (pre-fit) delete frameTemporary; RooAbsPdf* mBkgPdfPrefit{nullptr}; @@ -311,7 +308,7 @@ void HFInvMassFitter::doFit() } mSgnPdf = new RooAddPdf("mSgnPdf", "signal fit function", RooArgList(*sgnPdf), RooArgList(*mRooNSgn)); // create reflection template and fit to reflection - if (mHistoTemplateRefl) { + if (mHistoTemplateRefl != nullptr) { RooAbsPdf* reflPdf = createReflectionFitFunction(mWorkspace); // create reflection pdf RooDataHist reflHistogram("reflHistogram", "refl for fit", *mass, Import(*mHistoTemplateRefl)); mReflFrame = mass->frame(); @@ -319,7 +316,7 @@ void HFInvMassFitter::doFit() reflHistogram.plotOn(mReflOnlyFrame); mRooNRefl = new RooRealVar("mNRefl", "number of reflection", 0.5 * mHistoTemplateRefl->Integral(), 0, mHistoTemplateRefl->Integral()); RooAddPdf reflFuncTemp("reflFuncTemp", "template reflection fit function", RooArgList(*reflPdf), RooArgList(*mRooNRefl)); - if (!strcmp(mFitOption.Data(), "Chi2")) { + if (strcmp(mFitOption.Data(), "Chi2") == 0) { reflFuncTemp.chi2FitTo(reflHistogram); } else { reflFuncTemp.fitTo(reflHistogram); @@ -330,14 +327,14 @@ void HFInvMassFitter::doFit() mRooNRefl->setConstant(kTRUE); setReflFuncFixed(); // fix reflection pdf parameter mTotalPdf = new RooAddPdf("mTotalPdf", "background + signal + reflection fit function", RooArgList(*bkgPdf, *sgnPdf, *reflPdf), RooArgList(*mRooNBkg, *mRooNSgn, *mRooNRefl)); - if (!strcmp(mFitOption.Data(), "Chi2")) { + if (strcmp(mFitOption.Data(), "Chi2") == 0) { mTotalPdf->chi2FitTo(dataHistogram); } else { mTotalPdf->fitTo(dataHistogram); } mTotalPdf->plotOn(mInvMassFrame, Name("Tot_c")); mReflPdf = new RooAddPdf("mReflPdf", "reflection fit function", RooArgList(*reflPdf), RooArgList(*mRooNRefl)); - RooAddPdf reflBkgPdf("reflBkgPdf", "reflBkgPdf", RooArgList(*bkgPdf, *reflPdf), RooArgList(*mRooNBkg, *mRooNRefl)); + RooAddPdf const reflBkgPdf("reflBkgPdf", "reflBkgPdf", RooArgList(*bkgPdf, *reflPdf), RooArgList(*mRooNBkg, *mRooNRefl)); reflBkgPdf.plotOn(mInvMassFrame, Normalization(1.0, RooAbsReal::RelativeExpected), LineStyle(7), LineColor(kRed + 1), Name("ReflBkg_c")); plotBkg(mTotalPdf); // plot bkg pdf in total pdf plotRefl(mTotalPdf); // plot reflection in total pdf @@ -350,7 +347,7 @@ void HFInvMassFitter::doFit() mSgnPdf->plotOn(mResidualFrame, Normalization(1.0, RooAbsReal::RelativeExpected), LineColor(kBlue)); } else { mTotalPdf = new RooAddPdf("mTotalPdf", "background + signal pdf", RooArgList(*bkgPdf, *sgnPdf), RooArgList(*mRooNBkg, *mRooNSgn)); - if (!strcmp(mFitOption.Data(), "Chi2")) { + if (strcmp(mFitOption.Data(), "Chi2") == 0) { mTotalPdf->chi2FitTo(dataHistogram); } else { mTotalPdf->fitTo(dataHistogram); @@ -388,30 +385,30 @@ void HFInvMassFitter::fillWorkspace(RooWorkspace& workspace) const workspace.import(*bkgFuncExpo); delete bkgFuncExpo; // bkg poly1 - RooRealVar polyParam0("polyParam0", "Parameter of Poly function", 0.5, -5., 5.); - RooRealVar polyParam1("polyParam1", "Parameter of Poly function", 0.2, -5., 5.); + RooRealVar const polyParam0("polyParam0", "Parameter of Poly function", 0.5, -5., 5.); + RooRealVar const polyParam1("polyParam1", "Parameter of Poly function", 0.2, -5., 5.); RooAbsPdf* bkgFuncPoly1 = new RooPolynomial("bkgFuncPoly1", "background fit function", mass, RooArgSet(polyParam0, polyParam1)); workspace.import(*bkgFuncPoly1); delete bkgFuncPoly1; // bkg poly2 - RooRealVar polyParam2("polyParam2", "Parameter of Poly function", 0.2, -5., 5.); + RooRealVar const polyParam2("polyParam2", "Parameter of Poly function", 0.2, -5., 5.); RooAbsPdf* bkgFuncPoly2 = new RooPolynomial("bkgFuncPoly2", "background fit function", mass, RooArgSet(polyParam0, polyParam1, polyParam2)); workspace.import(*bkgFuncPoly2); delete bkgFuncPoly2; // bkg poly3 - RooRealVar polyParam3("polyParam3", "Parameter of Poly function", 0.2, -1., 1.); + RooRealVar const polyParam3("polyParam3", "Parameter of Poly function", 0.2, -1., 1.); RooAbsPdf* bkgFuncPoly3 = new RooPolynomial("bkgFuncPoly3", "background pdf", mass, RooArgSet(polyParam0, polyParam1, polyParam2, polyParam3)); workspace.import(*bkgFuncPoly3); delete bkgFuncPoly3; // bkg power law - RooRealVar powParam1("powParam1", "Parameter of Pow function", TDatabasePDG::Instance()->GetParticle("pi+")->Mass()); - RooRealVar powParam2("powParam2", "Parameter of Pow function", 1., -10, 10); + RooRealVar const powParam1("powParam1", "Parameter of Pow function", TDatabasePDG::Instance()->GetParticle("pi+")->Mass()); + RooRealVar const powParam2("powParam2", "Parameter of Pow function", 1., -10, 10); RooAbsPdf* bkgFuncPow = new RooGenericPdf("bkgFuncPow", "bkgFuncPow", "(mass-powParam1)^powParam2", RooArgSet(mass, powParam1, powParam2)); workspace.import(*bkgFuncPow); delete bkgFuncPow; // pow * exp - RooRealVar powExpoParam1("powExpoParam1", "Parameter of PowExpo function", 1 / 2); - RooRealVar powExpoParam2("powExpoParam2", "Parameter of PowExpo function", 1, -10, 10); + RooRealVar const powExpoParam1("powExpoParam1", "Parameter of PowExpo function", 1. / 2.); + RooRealVar const powExpoParam2("powExpoParam2", "Parameter of PowExpo function", 1, -10, 10); RooRealVar massPi("massPi", "mass of pion", TDatabasePDG::Instance()->GetParticle("pi+")->Mass()); RooFormulaVar powExpoParam3("powExpoParam3", "powExpoParam1 + 1", RooArgList(powExpoParam1)); RooFormulaVar powExpoParam4("powExpoParam4", "1./powExpoParam2", RooArgList(powExpoParam2)); @@ -456,8 +453,8 @@ void HFInvMassFitter::fillWorkspace(RooWorkspace& workspace) const sigmaDoubleGaus.setVal(mSigmaSgnDoubleGaus); sigmaDoubleGaus.setConstant(kTRUE); } - RooGaussian gaus1("gaus1", "gaus1", mass, mean, sigma); - RooGaussian gaus2("gaus2", "gaus2", mass, mean, sigmaDoubleGaus); + RooGaussian const gaus1("gaus1", "gaus1", mass, mean, sigma); + RooGaussian const gaus2("gaus2", "gaus2", mass, mean, sigmaDoubleGaus); RooRealVar fracDoubleGaus("fracDoubleGaus", "frac of two gauss", mFracDoubleGaus, 0, 1.); if (mFixedFracDoubleGaus) { fracDoubleGaus.setVal(mFracDoubleGaus); @@ -481,8 +478,8 @@ void HFInvMassFitter::fillWorkspace(RooWorkspace& workspace) const sigma.setMin(mSigmaSgn * (1 - mParamSgn)); } RooRealVar sigmaDoubleGausRatio("sigmaDoubleGausRatio", "sigmaDoubleGausRatio", sigma.getVal() * ratio.getVal()); - RooGaussian gausRatio1("gausRatio1", "gausratio1", mass, mean, sigma); - RooGaussian gausRatio2("gausRatio2", "gausratio2", mass, mean, sigmaDoubleGausRatio); + RooGaussian const gausRatio1("gausRatio1", "gausratio1", mass, mean, sigma); + RooGaussian const gausRatio2("gausRatio2", "gausratio2", mass, mean, sigmaDoubleGausRatio); RooRealVar fracDoubleGausRatio("fracDoubleGausRatio", "fraction of two gauss ratio", 0.5, 0, 1.); if (mFixedFracDoubleGaus) { fracDoubleGausRatio.setVal(mFracDoubleGaus); @@ -510,9 +507,9 @@ void HFInvMassFitter::fillWorkspace(RooWorkspace& workspace) const sigmaSec.setMax(mSecSigma * (1 + mParamSgn)); sigmaSec.setMin(mSecSigma * (1 - mParamSgn)); } - RooGaussian gausSec1("gausSec1", "gausSec1", mass, mean, sigmaSec); - RooGaussian gausSec2("gausSec2", "gausSec2", mass, meanSec, sigmaSec); - RooRealVar fracSec("fracSec", "frac of two peak", 0.5, 0, 1.); + RooGaussian const gausSec1("gausSec1", "gausSec1", mass, mean, sigmaSec); + RooGaussian const gausSec2("gausSec2", "gausSec2", mass, meanSec, sigmaSec); + RooRealVar const fracSec("fracSec", "frac of two peak", 0.5, 0, 1.); RooAbsPdf* sgnFuncDoublePeak = new RooAddPdf("sgnFuncDoublePeak", "signal pdf", RooArgList(gausSec1, gausSec2), fracSec); workspace.import(*sgnFuncDoublePeak); delete sgnFuncDoublePeak; @@ -533,24 +530,24 @@ void HFInvMassFitter::fillWorkspace(RooWorkspace& workspace) const meanReflDoubleGaus.setMin(mMassReflLowLimit); } RooRealVar sigmaReflDoubleGaus("sigmaReflDoubleGaus", "sigmaReflDoubleGaus", 0.012, 0.0, 0.25); - RooGaussian gausRefl1("gausRefl1", "gausRefl1", mass, meanRefl, sigmaRefl); - RooGaussian gausRefl2("gausRefl2", "gausRefl2", mass, meanReflDoubleGaus, sigmaReflDoubleGaus); - RooRealVar fracRefl("fracRefl", "frac of two gauss", 0.5, 0, 1.); + RooGaussian const gausRefl1("gausRefl1", "gausRefl1", mass, meanRefl, sigmaRefl); + RooGaussian const gausRefl2("gausRefl2", "gausRefl2", mass, meanReflDoubleGaus, sigmaReflDoubleGaus); + RooRealVar const fracRefl("fracRefl", "frac of two gauss", 0.5, 0, 1.); RooAbsPdf* reflFuncDoubleGaus = new RooAddPdf("reflFuncDoubleGaus", "reflection pdf", RooArgList(gausRefl1, gausRefl2), fracRefl); workspace.import(*reflFuncDoubleGaus); delete reflFuncDoubleGaus; // reflection poly3 - RooRealVar polyReflParam0("polyReflParam0", "polyReflParam0", 0.5, -1., 1.); - RooRealVar polyReflParam1("polyReflParam1", "polyReflParam1", 0.2, -1., 1.); - RooRealVar polyReflParam2("polyReflParam2", "polyReflParam2", 0.2, -1., 1.); - RooRealVar polyReflParam3("polyReflParam3", "polyReflParam3", 0.2, -1., 1.); + RooRealVar const polyReflParam0("polyReflParam0", "polyReflParam0", 0.5, -1., 1.); + RooRealVar const polyReflParam1("polyReflParam1", "polyReflParam1", 0.2, -1., 1.); + RooRealVar const polyReflParam2("polyReflParam2", "polyReflParam2", 0.2, -1., 1.); + RooRealVar const polyReflParam3("polyReflParam3", "polyReflParam3", 0.2, -1., 1.); RooAbsPdf* reflFuncPoly3 = new RooPolynomial("reflFuncPoly3", "reflection PDF", mass, RooArgSet(polyReflParam0, polyReflParam1, polyReflParam2, polyReflParam3)); workspace.import(*reflFuncPoly3); delete reflFuncPoly3; // reflection poly6 - RooRealVar polyReflParam4("polyReflParam4", "polyReflParam4", 0.2, -1., 1.); - RooRealVar polyReflParam5("polyReflParam5", "polyReflParam5", 0.2, -1., 1.); - RooRealVar polyReflParam6("polyReflParam6", "polyReflParam6", 0.2, -1., 1.); + RooRealVar const polyReflParam4("polyReflParam4", "polyReflParam4", 0.2, -1., 1.); + RooRealVar const polyReflParam5("polyReflParam5", "polyReflParam5", 0.2, -1., 1.); + RooRealVar const polyReflParam6("polyReflParam6", "polyReflParam6", 0.2, -1., 1.); RooAbsPdf* reflFuncPoly6 = new RooPolynomial("reflFuncPoly6", "reflection pdf", mass, RooArgSet(polyReflParam0, polyReflParam1, polyReflParam2, polyReflParam3, polyReflParam4, polyReflParam5, polyReflParam6)); workspace.import(*reflFuncPoly6); delete reflFuncPoly6; @@ -563,8 +560,8 @@ void HFInvMassFitter::drawFit(TVirtualPad* pad, Int_t writeFitInfo) gStyle->SetFrameFillColor(0); pad->cd(); if (writeFitInfo > 0) { - TPaveText* textInfoLeft = new TPaveText(0.12, 0.65, 0.47, 0.89, "NDC"); - TPaveText* textInfoRight = new TPaveText(0.6, 0.7, 1., .87, "NDC"); + auto* textInfoLeft = new TPaveText(0.12, 0.65, 0.47, 0.89, "NDC"); + auto* textInfoRight = new TPaveText(0.6, 0.7, 1., .87, "NDC"); textInfoLeft->SetBorderSize(0); textInfoLeft->SetFillStyle(0); textInfoRight->SetBorderSize(0); @@ -576,7 +573,7 @@ void HFInvMassFitter::drawFit(TVirtualPad* pad, Int_t writeFitInfo) textInfoLeft->AddText(Form("B (%d#sigma) = %.0f #pm %.0f", mNSigmaForSidebands, mBkgYield, mBkgYieldErr)); textInfoLeft->AddText(Form("S/B (%d#sigma) = %.4g ", mNSigmaForSidebands, mRawYield / mBkgYield)); } - if (mReflPdf) { + if (mReflPdf != nullptr) { textInfoLeft->AddText(Form("Refl/Sig = %.3f #pm %.3f ", mReflOverSgn, 0.0)); } if (mTypeOfBkgPdf != NoBkg) { @@ -610,7 +607,7 @@ void HFInvMassFitter::drawFit(TVirtualPad* pad, Int_t writeFitInfo) mInvMassFrame->GetXaxis()->SetTitle(Form("%s", mHistoInvMass->GetXaxis()->GetTitle())); mInvMassFrame->Draw(); highlightPeakRegion(mInvMassFrame); - if (mHistoTemplateRefl) { + if (mHistoTemplateRefl != nullptr) { mReflFrame->Draw("same"); } } @@ -621,7 +618,7 @@ void HFInvMassFitter::drawResidual(TVirtualPad* pad) { pad->cd(); mResidualFrame->GetYaxis()->SetTitle(""); - TPaveText* textInfo = new TPaveText(0.12, 0.65, 0.47, .89, "NDC"); + auto* textInfo = new TPaveText(0.12, 0.65, 0.47, .89, "NDC"); textInfo->SetBorderSize(0); textInfo->SetFillStyle(0); textInfo->SetTextColor(kBlue); @@ -643,16 +640,17 @@ void HFInvMassFitter::drawResidual(TVirtualPad* pad) // draw peak region with vertical lines void HFInvMassFitter::highlightPeakRegion(const RooPlot* plot, Color_t color, Width_t width, Style_t style) const { - if (!mHighlightPeakRegion) + if (!mHighlightPeakRegion) { return; - double yMin = plot->GetMinimum(); - double yMax = plot->GetMaximum(); + } + double const yMin = plot->GetMinimum(); + double const yMax = plot->GetMaximum(); const Double_t mean = mRooMeanSgn->getVal(); const Double_t sigma = mRooSigmaSgn->getVal(); const Double_t minForSgn = mean - mNSigmaForSidebands * sigma; const Double_t maxForSgn = mean + mNSigmaForSidebands * sigma; - TLine* leftLine = new TLine(minForSgn, yMin, minForSgn, yMax); - TLine* rightLine = new TLine(maxForSgn, yMin, maxForSgn, yMax); + auto* leftLine = new TLine(minForSgn, yMin, minForSgn, yMax); + auto* rightLine = new TLine(maxForSgn, yMin, maxForSgn, yMax); for (const auto& line : std::array{leftLine, rightLine}) { line->SetLineColor(color); line->SetLineWidth(width); @@ -718,9 +716,9 @@ void HFInvMassFitter::calculateSignificance(Double_t& significance, Double_t& er calculateSignal(signal, errSignal); Double_t bkg, errBkg; calculateBackground(bkg, errBkg); - Double_t sgnErrSquare = errSignal * errSignal; - Double_t bkgErrSquare = errBkg * errBkg; - Double_t totalSgnBkg = signal + bkg; + Double_t const sgnErrSquare = errSignal * errSignal; + Double_t const bkgErrSquare = errBkg * errBkg; + Double_t const totalSgnBkg = signal + bkg; significance = signal / std::sqrt(signal + bkg); errSignificance = significance * std::sqrt((sgnErrSquare + bkgErrSquare) / (mNSigmaForSidebands * totalSgnBkg * totalSgnBkg) + (bkg / totalSgnBkg) * (sgnErrSquare / signal / signal)); } @@ -728,10 +726,10 @@ void HFInvMassFitter::calculateSignificance(Double_t& significance, Double_t& er // estimate Signal void HFInvMassFitter::checkForSignal(Double_t& estimatedSignal) { - Double_t minForSgn = mMass - 4 * mSigmaSgn; - Double_t maxForSgn = mMass + 4 * mSigmaSgn; - Int_t binForMinSgn = mHistoInvMass->FindBin(minForSgn); - Int_t binForMaxSgn = mHistoInvMass->FindBin(maxForSgn); + Double_t const minForSgn = mMass - 4 * mSigmaSgn; + Double_t const maxForSgn = mMass + 4 * mSigmaSgn; + Int_t const binForMinSgn = mHistoInvMass->FindBin(minForSgn); + Int_t const binForMaxSgn = mHistoInvMass->FindBin(maxForSgn); Double_t sum = 0; for (Int_t i = binForMinSgn; i <= binForMaxSgn; i++) { diff --git a/PWGHF/D2H/Macros/HFInvMassFitter.h b/PWGHF/D2H/Macros/HFInvMassFitter.h index 5ec95ebd473..1a245fe0db5 100644 --- a/PWGHF/D2H/Macros/HFInvMassFitter.h +++ b/PWGHF/D2H/Macros/HFInvMassFitter.h @@ -67,14 +67,14 @@ class HFInvMassFitter : public TNamed std::vector namesOfReflPdf{"reflFuncGaus", "reflFuncDoubleGaus", "reflFuncPoly3", "reflFuncPoly6"}; HFInvMassFitter(); HFInvMassFitter(const TH1* histoToFit, Double_t minValue, Double_t maxValue, Int_t fitTypeBkg = Expo, Int_t fitTypeSgn = SingleGaus); - ~HFInvMassFitter(); + ~HFInvMassFitter() override; void setHistogramForFit(const TH1* histoToFit) { - if (mHistoInvMass) { - delete mHistoInvMass; - } - mHistoInvMass = static_cast(histoToFit->Clone("mHistoInvMass")); - mHistoInvMass->SetDirectory(0); + + delete mHistoInvMass; + + mHistoInvMass = dynamic_cast(histoToFit->Clone("mHistoInvMass")); + mHistoInvMass->SetDirectory(nullptr); } void setUseLikelihoodFit() { mFitOption = "L,E"; } void setUseChi2Fit() { mFitOption = "Chi2"; } @@ -99,7 +99,7 @@ class HFInvMassFitter : public TNamed mParamSgn = sigmaLimit; } void setParticlePdgMass(Double_t mass) { mMassParticle = mass; } - Double_t getParticlePdgMass() { return mMassParticle; } + [[nodiscard]] Double_t getParticlePdgMass() const { return mMassParticle; } void setInitialGaussianMean(Double_t mean) { mMass = mean; @@ -188,36 +188,36 @@ class HFInvMassFitter : public TNamed setInitialReflOverSgn(reflOverSgn); mFixReflOverSgn = kTRUE; } - void setTemplateReflections(const TH1* histoRefl, Int_t fitTypeRefl = DoubleGaus) + void setTemplateReflections(const TH1* histoRefl) { - if (!histoRefl) { + if (histoRefl == nullptr) { mEnableReflections = kFALSE; + return; } - mHistoTemplateRefl = static_cast(histoRefl->Clone("mHistoTemplateRefl")); + mHistoTemplateRefl = dynamic_cast(histoRefl->Clone("mHistoTemplateRefl")); } void setDrawBgPrefit(Bool_t value = true) { mDrawBgPrefit = value; } void setHighlightPeakRegion(Bool_t value = true) { mHighlightPeakRegion = value; } - Double_t getChiSquareOverNDFTotal() const { return mChiSquareOverNdfTotal; } - Double_t getChiSquareOverNDFBkg() const { return mChiSquareOverNdfBkg; } - Double_t getRawYield() const { return mRawYield; } - Double_t getRawYieldError() const { return mRawYieldErr; } - Double_t getRawYieldCounted() const { return mRawYieldCounted; } - Double_t getRawYieldCountedError() const { return mRawYieldCountedErr; } - Double_t getBkgYield() const { return mBkgYield; } - Double_t getBkgYieldError() const { return mBkgYieldErr; } - Double_t getSignificance() const { return mSignificance; } - Double_t getSignificanceError() const { return mSignificanceErr; } - Double_t getMean() const { return mRooMeanSgn->getVal(); } - Double_t getMeanUncertainty() const { return mRooMeanSgn->getError(); } - Double_t getSigma() const { return mRooSigmaSgn->getVal(); } - Double_t getSigmaUncertainty() const { return mRooSigmaSgn->getError(); } - Double_t getReflOverSig() const + [[nodiscard]] Double_t getChiSquareOverNDFTotal() const { return mChiSquareOverNdfTotal; } + [[nodiscard]] Double_t getChiSquareOverNDFBkg() const { return mChiSquareOverNdfBkg; } + [[nodiscard]] Double_t getRawYield() const { return mRawYield; } + [[nodiscard]] Double_t getRawYieldError() const { return mRawYieldErr; } + [[nodiscard]] Double_t getRawYieldCounted() const { return mRawYieldCounted; } + [[nodiscard]] Double_t getRawYieldCountedError() const { return mRawYieldCountedErr; } + [[nodiscard]] Double_t getBkgYield() const { return mBkgYield; } + [[nodiscard]] Double_t getBkgYieldError() const { return mBkgYieldErr; } + [[nodiscard]] Double_t getSignificance() const { return mSignificance; } + [[nodiscard]] Double_t getSignificanceError() const { return mSignificanceErr; } + [[nodiscard]] Double_t getMean() const { return mRooMeanSgn->getVal(); } + [[nodiscard]] Double_t getMeanUncertainty() const { return mRooMeanSgn->getError(); } + [[nodiscard]] Double_t getSigma() const { return mRooSigmaSgn->getVal(); } + [[nodiscard]] Double_t getSigmaUncertainty() const { return mRooSigmaSgn->getError(); } + [[nodiscard]] Double_t getReflOverSig() const { - if (mReflPdf) { + if (mReflPdf != nullptr) { return mReflOverSgn; - } else { - return 0; } + return 0; } void calculateSignal(Double_t& signal, Double_t& signalErr) const; void countSignal(Double_t& signal, Double_t& signalErr) const; diff --git a/PWGHF/D2H/Macros/runMassFitter.C b/PWGHF/D2H/Macros/runMassFitter.C index e6cb569f4b0..d83c0f7b7a5 100644 --- a/PWGHF/D2H/Macros/runMassFitter.C +++ b/PWGHF/D2H/Macros/runMassFitter.C @@ -22,16 +22,23 @@ #include "HFInvMassFitter.h" -// if .h file not found, please include your local rapidjson/document.h and rapidjson/filereadstream.h here #include #include #include -#include +#include +#include +#include +#include -#include +#include // if .h file not found, please include your local rapidjson/document.h and rapidjson/filereadstream.h here #include +#include +#include + +#include #include // for fclose +#include #include #include #include // std::string @@ -47,7 +54,7 @@ int runMassFitter(const TString& configFileName = "config_massfitter.json"); template void readArray(const Value& jsonArray, std::vector& output) { - for (auto it = jsonArray.Begin(); it != jsonArray.End(); it++) { + for (const auto* it = jsonArray.Begin(); it != jsonArray.End(); it++) { auto value = it->template Get(); output.emplace_back(value); } @@ -55,7 +62,7 @@ void readArray(const Value& jsonArray, std::vector& output) void parseStringArray(const Value& jsonArray, std::vector& output) { - size_t arrayLength = jsonArray.Size(); + size_t const arrayLength = jsonArray.Size(); for (size_t i = 0; i < arrayLength; i++) { if (jsonArray[i].IsString()) { output.emplace_back(jsonArray[i].GetString()); @@ -70,7 +77,7 @@ int runMassFitter(const TString& configFileName) { // load config FILE* configFile = fopen(configFileName.Data(), "r"); - if (!configFile) { + if (configFile == nullptr) { throw std::runtime_error("ERROR: Missing configuration json file: " + configFileName); } @@ -80,11 +87,11 @@ int runMassFitter(const TString& configFileName) config.ParseStream(is); fclose(configFile); - Bool_t isMc = config["IsMC"].GetBool(); - TString inputFileName = config["InFileName"].GetString(); - TString reflFileName = config["ReflFileName"].GetString(); + Bool_t const isMc = config["IsMC"].GetBool(); + TString const inputFileName = config["InFileName"].GetString(); + TString const reflFileName = config["ReflFileName"].GetString(); TString outputFileName = config["OutFileName"].GetString(); - TString particleName = config["Particle"].GetString(); + TString const particleName = config["Particle"].GetString(); std::vector inputHistoName; std::vector promptHistoName; @@ -159,8 +166,8 @@ int runMassFitter(const TString& configFileName) const Value& rebinValue = config["Rebin"]; readArray(rebinValue, nRebin); - bool includeSecPeak = config["InclSecPeak"].GetBool(); - bool useLikelihood = config["UseLikelihood"].GetBool(); + bool const includeSecPeak = config["InclSecPeak"].GetBool(); + bool const useLikelihood = config["UseLikelihood"].GetBool(); const Value& bkgFuncValue = config["BkgFunc"]; readArray(bkgFuncValue, bkgFuncConfig); @@ -208,15 +215,15 @@ int runMassFitter(const TString& configFileName) const double massPDG = TDatabasePDG::Instance()->GetParticle(particles[particleName.Data()].second.c_str())->Mass(); // load inv-mass histograms - auto inputFile = TFile::Open(inputFileName.Data()); - if (!inputFile || !inputFile->IsOpen()) { + auto* inputFile = TFile::Open(inputFileName.Data()); + if ((inputFile == nullptr) || !inputFile->IsOpen()) { return -1; } TFile* inputFileRefl = nullptr; if (enableRefl) { inputFileRefl = TFile::Open(reflFileName.Data()); - if (!inputFileRefl || !inputFileRefl->IsOpen()) { + if ((inputFileRefl == nullptr) || !inputFileRefl->IsOpen()) { return -1; } } @@ -232,10 +239,10 @@ int runMassFitter(const TString& configFileName) hMassRefl[iSliceVar] = inputFileRefl->Get(reflHistoName[iSliceVar].data()); hMassSgn[iSliceVar] = inputFileRefl->Get(fdHistoName[iSliceVar].data()); hMassSgn[iSliceVar]->Add(inputFileRefl->Get(promptHistoName[iSliceVar].data())); - if (!hMassRefl[iSliceVar]) { + if (hMassRefl[iSliceVar] == nullptr) { throw std::runtime_error("ERROR: MC reflection histogram not found! Exit!"); } - if (!hMassSgn[iSliceVar]) { + if (hMassSgn[iSliceVar] == nullptr) { throw std::runtime_error("ERROR: MC prompt or FD histogram not found! Exit!"); } } @@ -247,7 +254,7 @@ int runMassFitter(const TString& configFileName) hMass[iSliceVar]->Add(inputFile->Get(fdSecPeakHistoName[iSliceVar].data())); } } - if (!hMass[iSliceVar]) { + if (hMass[iSliceVar] == nullptr) { throw std::runtime_error("ERROR: input histogram for fit not found! Exit!"); } hMass[iSliceVar]->SetDirectory(nullptr); @@ -255,39 +262,39 @@ int runMassFitter(const TString& configFileName) inputFile->Close(); // define output histos - auto hRawYieldsSignal = new TH1D("hRawYieldsSignal", ";" + sliceVarName + "(" + sliceVarUnit + ");raw yield", - nSliceVarBins, sliceVarLimits.data()); - auto hRawYieldsSignalCounted = new TH1D("hRawYieldsSignalCounted", ";" + sliceVarName + "(" + sliceVarUnit + ");raw yield via bin count", - nSliceVarBins, sliceVarLimits.data()); - auto hRawYieldsSigma = new TH1D( + auto* hRawYieldsSignal = new TH1D("hRawYieldsSignal", ";" + sliceVarName + "(" + sliceVarUnit + ");raw yield", + nSliceVarBins, sliceVarLimits.data()); + auto* hRawYieldsSignalCounted = new TH1D("hRawYieldsSignalCounted", ";" + sliceVarName + "(" + sliceVarUnit + ");raw yield via bin count", + nSliceVarBins, sliceVarLimits.data()); + auto* hRawYieldsSigma = new TH1D( "hRawYieldsSigma", ";" + sliceVarName + "(" + sliceVarUnit + ");width (GeV/#it{c}^{2})", nSliceVarBins, sliceVarLimits.data()); - auto hRawYieldsMean = new TH1D( + auto* hRawYieldsMean = new TH1D( "hRawYieldsMean", ";" + sliceVarName + "(" + sliceVarUnit + ");mean (GeV/#it{c}^{2})", nSliceVarBins, sliceVarLimits.data()); - auto hRawYieldsSignificance = new TH1D( + auto* hRawYieldsSignificance = new TH1D( "hRawYieldsSignificance", ";" + sliceVarName + "(" + sliceVarUnit + ");significance (3#sigma)", nSliceVarBins, sliceVarLimits.data()); - auto hRawYieldsSgnOverBkg = + auto* hRawYieldsSgnOverBkg = new TH1D("hRawYieldsSgnOverBkg", ";" + sliceVarName + "(" + sliceVarUnit + ");S/B (3#sigma)", nSliceVarBins, sliceVarLimits.data()); - auto hRawYieldsBkg = + auto* hRawYieldsBkg = new TH1D("hRawYieldsBkg", ";" + sliceVarName + "(" + sliceVarUnit + ");Background (3#sigma)", nSliceVarBins, sliceVarLimits.data()); - auto hRawYieldsChiSquareBkg = + auto* hRawYieldsChiSquareBkg = new TH1D("hRawYieldsChiSquareBkg", ";" + sliceVarName + "(" + sliceVarUnit + ");#chi^{2}/#it{ndf}", nSliceVarBins, sliceVarLimits.data()); - auto hRawYieldsChiSquareTotal = + auto* hRawYieldsChiSquareTotal = new TH1D("hRawYieldsChiSquareTotal", ";" + sliceVarName + "(" + sliceVarUnit + ");#chi^{2}/#it{ndf}", nSliceVarBins, sliceVarLimits.data()); - auto hReflectionOverSignal = + auto* hReflectionOverSignal = new TH1D("hReflectionOverSignal", ";" + sliceVarName + "(" + sliceVarUnit + ");Refl/Signal", nSliceVarBins, sliceVarLimits.data()); const Int_t nConfigsToSave = 6; - auto hFitConfig = new TH2F("hfitConfig", "Fit Configurations", nConfigsToSave, 0, 6, nSliceVarBins, sliceVarLimits.data()); + auto* hFitConfig = new TH2F("hfitConfig", "Fit Configurations", nConfigsToSave, 0, 6, nSliceVarBins, sliceVarLimits.data()); const char* hFitConfigXLabel[nConfigsToSave] = {"mass min", "mass max", "rebin num", "fix sigma", "bkg func", "sgn func"}; - hFitConfig->SetStats(0); + hFitConfig->SetStats(false); hFitConfig->LabelsDeflate("X"); hFitConfig->LabelsDeflate("Y"); hFitConfig->LabelsOption("v"); @@ -310,8 +317,8 @@ int runMassFitter(const TString& configFileName) TH1* histToFix = nullptr; if (isFix) { if (fixManual.empty()) { - auto fixInputFile = TFile::Open(fixFileName.data()); - if (!fixInputFile) { + auto* fixInputFile = TFile::Open(fixFileName.data()); + if (fixInputFile == nullptr) { throw std::runtime_error("Cannot open file for fixed " + var); } const std::string histName = "hRawYields" + var; @@ -342,7 +349,7 @@ int runMassFitter(const TString& configFileName) canvasSize[1] = 500; } - Int_t nCanvasesMax = 20; // do not put more than 20 bins per canvas to make them visible + Int_t const nCanvasesMax = 20; // do not put more than 20 bins per canvas to make them visible const Int_t nCanvases = std::ceil(static_cast(nSliceVarBins) / nCanvasesMax); std::vector canvasMass(nCanvases); std::vector canvasResiduals(nCanvases); @@ -364,8 +371,8 @@ int runMassFitter(const TString& configFileName) for (unsigned int iSliceVar = 0; iSliceVar < nSliceVarBins; iSliceVar++) { const Int_t iCanvas = std::floor(static_cast(iSliceVar) / nCanvasesMax); - hMassForFit[iSliceVar] = static_cast(hMass[iSliceVar]->Rebin(nRebin[iSliceVar])); - TString ptTitle = + hMassForFit[iSliceVar] = hMass[iSliceVar]->Rebin(nRebin[iSliceVar]); + TString const ptTitle = Form("%0.2f < " + sliceVarName + " < %0.2f " + sliceVarUnit, sliceVarMin[iSliceVar], sliceVarMax[iSliceVar]); hMassForFit[iSliceVar]->SetTitle(Form("%s;%s;Counts per %0.1f MeV/#it{c}^{2}", ptTitle.Data(), massAxisTitle.Data(), @@ -373,16 +380,11 @@ int runMassFitter(const TString& configFileName) hMassForFit[iSliceVar]->SetName(Form("MassForFit%d", iSliceVar)); if (enableRefl) { - hMassForRefl[iSliceVar] = static_cast(hMassRefl[iSliceVar]->Rebin(nRebin[iSliceVar])); - hMassForSgn[iSliceVar] = static_cast(hMassSgn[iSliceVar]->Rebin(nRebin[iSliceVar])); + hMassForRefl[iSliceVar] = hMassRefl[iSliceVar]->Rebin(nRebin[iSliceVar]); + hMassForSgn[iSliceVar] = hMassSgn[iSliceVar]->Rebin(nRebin[iSliceVar]); } Double_t reflOverSgn = 0; - double markerSize = 1.; - constexpr int NSliceVarBinsLarge = 15; - if (nSliceVarBins > NSliceVarBinsLarge) { - markerSize = 0.5; - } if (isMc) { HFInvMassFitter* massFitter; @@ -439,7 +441,7 @@ int runMassFitter(const TString& configFileName) massFitter->setUseLikelihoodFit(); } - auto setFixedValue = [&massFitter, &iSliceVar](bool const& isFix, std::vector const& fixManual, const TH1* histToFix, std::function setFunc, std::string const& var) -> void { + auto setFixedValue = [&iSliceVar](bool const& isFix, std::vector const& fixManual, const TH1* histToFix, std::function setFunc, std::string const& var) -> void { if (isFix) { if (fixManual.empty()) { setFunc(histToFix->GetBinContent(iSliceVar + 1)); @@ -463,7 +465,7 @@ int runMassFitter(const TString& configFileName) reflOverSgn = hMassForSgn[iSliceVar]->Integral(hMassForSgn[iSliceVar]->FindBin(massMin[iSliceVar] * 1.0001), hMassForSgn[iSliceVar]->FindBin(massMax[iSliceVar] * 0.999)); reflOverSgn = hMassForRefl[iSliceVar]->Integral(hMassForRefl[iSliceVar]->FindBin(massMin[iSliceVar] * 1.0001), hMassForRefl[iSliceVar]->FindBin(massMax[iSliceVar] * 0.999)) / reflOverSgn; massFitter->setFixReflOverSgn(reflOverSgn); - massFitter->setTemplateReflections(hMassRefl[iSliceVar], HFInvMassFitter::DoubleGaus); + massFitter->setTemplateReflections(hMassRefl[iSliceVar]); } massFitter->doFit(); diff --git a/PWGHF/D2H/TableProducer/candidateCreatorB0Reduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorB0Reduced.cxx index fd6a2b4098c..49cff73feea 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorB0Reduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorB0Reduced.cxx @@ -132,7 +132,7 @@ struct HfCandidateCreatorB0Reduced { /// \param tracksPionThisCollision pion tracks in this collision /// \param invMass2DPiMin minimum B0 invariant-mass /// \param invMass2DPiMax maximum B0 invariant-mass - template + template void runCandidateCreationDStar(Coll const& collision, Cands const& candsDThisColl, SoftPions const& softPions, @@ -230,7 +230,7 @@ struct HfCandidateCreatorB0Reduced { rowCandidateProngsDStar(candD.globalIndex(), trackBachPion.globalIndex(), trackSoftPion.globalIndex()); - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { rowCandidateDmesMlScores(candD.mlScoreBkgMassHypo0(), candD.mlScorePromptMassHypo0(), candD.mlScoreNonpromptMassHypo0()); } } // pi loop @@ -244,7 +244,7 @@ struct HfCandidateCreatorB0Reduced { /// \param tracksPionThisCollision pion tracks in this collision /// \param invMass2DPiMin minimum B0 invariant-mass /// \param invMass2DPiMax maximum B0 invariant-mass - template + template void runCandidateCreation(Coll const& collision, Cands const& candsDThisColl, Pions const& tracksPionThisCollision, @@ -333,7 +333,7 @@ struct HfCandidateCreatorB0Reduced { rowCandidateProngs(candD.globalIndex(), trackPion.globalIndex()); - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { rowCandidateDmesMlScores(candD.mlScoreBkgMassHypo0(), candD.mlScorePromptMassHypo0(), candD.mlScoreNonpromptMassHypo0()); } } // pi loop @@ -352,8 +352,8 @@ struct HfCandidateCreatorB0Reduced { } // invMassWindowDPiTolerance is used to apply a slightly tighter cut than in DPi pair preselection // to avoid accepting DPi pairs that were not formed in DPi pair creator - float invMass2DPiMin = (o2::constants::physics::MassB0 - myInvMassWindowDPi + invMassWindowDPiTolerance) * (o2::constants::physics::MassB0 - myInvMassWindowDPi + invMassWindowDPiTolerance); - float invMass2DPiMax = (o2::constants::physics::MassB0 + myInvMassWindowDPi - invMassWindowDPiTolerance) * (o2::constants::physics::MassB0 + myInvMassWindowDPi - invMassWindowDPiTolerance); + float const invMass2DPiMin = (o2::constants::physics::MassB0 - myInvMassWindowDPi + invMassWindowDPiTolerance) * (o2::constants::physics::MassB0 - myInvMassWindowDPi + invMassWindowDPiTolerance); + float const invMass2DPiMax = (o2::constants::physics::MassB0 + myInvMassWindowDPi - invMassWindowDPiTolerance) * (o2::constants::physics::MassB0 + myInvMassWindowDPi - invMassWindowDPiTolerance); for (const auto& collisionCounter : collisionsCounter) { registry.fill(HIST("hEvents"), 1, collisionCounter.originalCollisionCount()); @@ -386,8 +386,8 @@ struct HfCandidateCreatorB0Reduced { } // invMassWindowDPiTolerance is used to apply a slightly tighter cut than in DPi pair preselection // to avoid accepting DPi pairs that were not formed in DPi pair creator - float invMass2DPiMin = (o2::constants::physics::MassB0 - myInvMassWindowDPi + invMassWindowDPiTolerance) * (o2::constants::physics::MassB0 - myInvMassWindowDPi + invMassWindowDPiTolerance); - float invMass2DPiMax = (o2::constants::physics::MassB0 + myInvMassWindowDPi - invMassWindowDPiTolerance) * (o2::constants::physics::MassB0 + myInvMassWindowDPi - invMassWindowDPiTolerance); + float const invMass2DPiMin = (o2::constants::physics::MassB0 - myInvMassWindowDPi + invMassWindowDPiTolerance) * (o2::constants::physics::MassB0 - myInvMassWindowDPi + invMassWindowDPiTolerance); + float const invMass2DPiMax = (o2::constants::physics::MassB0 + myInvMassWindowDPi - invMassWindowDPiTolerance) * (o2::constants::physics::MassB0 + myInvMassWindowDPi - invMassWindowDPiTolerance); for (const auto& collisionCounter : collisionsCounter) { registry.fill(HIST("hEvents"), 1, collisionCounter.originalCollisionCount()); @@ -421,8 +421,8 @@ struct HfCandidateCreatorB0Reduced { } // invMassWindowDPiTolerance is used to apply a slightly tighter cut than in DPi pair preselection // to avoid accepting DPi pairs that were not formed in DPi pair creator - float invMass2DPiMin = (o2::constants::physics::MassB0 - myInvMassWindowDPi + invMassWindowDPiTolerance) * (o2::constants::physics::MassB0 - myInvMassWindowDPi + invMassWindowDPiTolerance); - float invMass2DPiMax = (o2::constants::physics::MassB0 + myInvMassWindowDPi - invMassWindowDPiTolerance) * (o2::constants::physics::MassB0 + myInvMassWindowDPi - invMassWindowDPiTolerance); + float const invMass2DPiMin = (o2::constants::physics::MassB0 - myInvMassWindowDPi + invMassWindowDPiTolerance) * (o2::constants::physics::MassB0 - myInvMassWindowDPi + invMassWindowDPiTolerance); + float const invMass2DPiMax = (o2::constants::physics::MassB0 + myInvMassWindowDPi - invMassWindowDPiTolerance) * (o2::constants::physics::MassB0 + myInvMassWindowDPi - invMassWindowDPiTolerance); for (const auto& collisionCounter : collisionsCounter) { registry.fill(HIST("hEvents"), 1, collisionCounter.originalCollisionCount()); @@ -456,8 +456,8 @@ struct HfCandidateCreatorB0Reduced { } // invMassWindowDPiTolerance is used to apply a slightly tighter cut than in DPi pair preselection // to avoid accepting DPi pairs that were not formed in DPi pair creator - float invMass2DPiMin = (o2::constants::physics::MassB0 - myInvMassWindowDPi + invMassWindowDPiTolerance) * (o2::constants::physics::MassB0 - myInvMassWindowDPi + invMassWindowDPiTolerance); - float invMass2DPiMax = (o2::constants::physics::MassB0 + myInvMassWindowDPi - invMassWindowDPiTolerance) * (o2::constants::physics::MassB0 + myInvMassWindowDPi - invMassWindowDPiTolerance); + float const invMass2DPiMin = (o2::constants::physics::MassB0 - myInvMassWindowDPi + invMassWindowDPiTolerance) * (o2::constants::physics::MassB0 - myInvMassWindowDPi + invMassWindowDPiTolerance); + float const invMass2DPiMax = (o2::constants::physics::MassB0 + myInvMassWindowDPi - invMassWindowDPiTolerance) * (o2::constants::physics::MassB0 + myInvMassWindowDPi - invMassWindowDPiTolerance); for (const auto& collisionCounter : collisionsCounter) { registry.fill(HIST("hEvents"), 1, collisionCounter.originalCollisionCount()); @@ -492,7 +492,7 @@ struct HfCandidateCreatorB0ReducedExpressions { /// \param checkDecayTypeMc /// \param rowsDPiMcRec MC reco information on DPi pairs /// \param candsB0 prong global indices of B0 candidates - template + template void fillB0McRec(McRec const& rowsDPiMcRec, B0Prongs const& candsB0) { for (const auto& candB0 : candsB0) { @@ -509,7 +509,7 @@ struct HfCandidateCreatorB0ReducedExpressions { } rowB0McRec(rowDPiMcRec.flagMcMatchRec(), -1 /*channel*/, rowDPiMcRec.flagWrongCollision(), rowDPiMcRec.debugMcRec(), rowDPiMcRec.ptMother()); filledMcInfo = true; - if constexpr (checkDecayTypeMc) { + if constexpr (CheckDecayTypeMc) { rowB0McCheck(rowDPiMcRec.pdgCodeBeautyMother(), rowDPiMcRec.pdgCodeCharmMother(), rowDPiMcRec.pdgCodeProng0(), @@ -521,7 +521,7 @@ struct HfCandidateCreatorB0ReducedExpressions { } if (!filledMcInfo) { // protection to get same size tables in case something went wrong: we created a candidate that was not preselected in the D-Pi creator rowB0McRec(0, -1, -1, -1, -1.f); - if constexpr (checkDecayTypeMc) { + if constexpr (CheckDecayTypeMc) { rowB0McCheck(-1, -1, -1, -1, -1, -1); } } diff --git a/PWGHF/D2H/TableProducer/candidateCreatorBToJpsiReduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorBToJpsiReduced.cxx index d96365a6b47..444ee4b1afe 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorBToJpsiReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorBToJpsiReduced.cxx @@ -150,7 +150,7 @@ struct HfCandidateCreatorBToJpsiReduced { /// \param tracksLfThisCollisionArr LF tracks in this collision /// \param invMass2JpsiHadMin minimum B invariant-mass /// \param invMass2JpsiHadMax maximum B invariant-mass - template + template void runCandidateCreation(Coll const& collision, Cands const& candsJpsiThisColl, TTracks0 const& tracksLfDau0ThisCollision, @@ -215,7 +215,7 @@ struct HfCandidateCreatorBToJpsiReduced { } auto trackParCovLf0 = getTrackParCov(trackLf0); std::array pVecTrackLf0{}; - if constexpr (decChannel == DecayChannel::BplusToJpsiK) { + if constexpr (DecChannel == DecayChannel::BplusToJpsiK) { // --------------------------------- // reconstruct the 3-prong B+ vertex hCandidatesB->Fill(SVFitting::BeforeFit); @@ -278,7 +278,7 @@ struct HfCandidateCreatorBToJpsiReduced { std::sqrt(dcaDauPos.getSigmaY2()), std::sqrt(dcaDauNeg.getSigmaY2()), std::sqrt(dcaKaon.getSigmaY2())); rowCandidateBpProngs(candJpsi.globalIndex(), trackLf0.globalIndex()); - } else if constexpr (decChannel == DecayChannel::BsToJpsiPhi) { + } else if constexpr (DecChannel == DecayChannel::BsToJpsiPhi) { for (const auto& trackLf1 : tracksLfDau1ThisCollision) { // this track is among daughters if (trackLf1.trackId() == candJpsi.prongPosId() || trackLf1.trackId() == candJpsi.prongNegId()) { @@ -369,8 +369,8 @@ struct HfCandidateCreatorBToJpsiReduced { } // invMassWindowJpsiHadTolerance is used to apply a slightly tighter cut than in JpsiK pair preselection // to avoid accepting JpsiK pairs that were not formed in JpsiK pair creator - double invMass2JpsiKMin = (massBplus - myInvMassWindowJpsiK + invMassWindowJpsiHadTolerance) * (massBplus - myInvMassWindowJpsiK + invMassWindowJpsiHadTolerance); - double invMass2JpsiKMax = (massBplus + myInvMassWindowJpsiK - invMassWindowJpsiHadTolerance) * (massBplus + myInvMassWindowJpsiK - invMassWindowJpsiHadTolerance); + double const invMass2JpsiKMin = (massBplus - myInvMassWindowJpsiK + invMassWindowJpsiHadTolerance) * (massBplus - myInvMassWindowJpsiK + invMassWindowJpsiHadTolerance); + double const invMass2JpsiKMax = (massBplus + myInvMassWindowJpsiK - invMassWindowJpsiHadTolerance) * (massBplus + myInvMassWindowJpsiK - invMassWindowJpsiHadTolerance); for (const auto& collisionCounter : collisionsCounter) { registry.fill(HIST("hEvents"), 1, collisionCounter.originalCollisionCount()); @@ -398,8 +398,8 @@ struct HfCandidateCreatorBToJpsiReduced { } // invMassWindowJpsiHadTolerance is used to apply a slightly tighter cut than in JpsiK pair preselection // to avoid accepting JpsiK pairs that were not formed in JpsiK pair creator - double invMass2JpsiKMin = (massBs - myInvMassWindowJpsiPhi + invMassWindowJpsiHadTolerance) * (massBs - myInvMassWindowJpsiPhi + invMassWindowJpsiHadTolerance); - double invMass2JpsiKMax = (massBs + myInvMassWindowJpsiPhi - invMassWindowJpsiHadTolerance) * (massBs + myInvMassWindowJpsiPhi - invMassWindowJpsiHadTolerance); + double const invMass2JpsiKMin = (massBs - myInvMassWindowJpsiPhi + invMassWindowJpsiHadTolerance) * (massBs - myInvMassWindowJpsiPhi + invMassWindowJpsiHadTolerance); + double const invMass2JpsiKMax = (massBs + myInvMassWindowJpsiPhi - invMassWindowJpsiHadTolerance) * (massBs + myInvMassWindowJpsiPhi - invMassWindowJpsiHadTolerance); for (const auto& collisionCounter : collisionsCounter) { registry.fill(HIST("hEvents"), 1, collisionCounter.originalCollisionCount()); @@ -426,12 +426,12 @@ struct HfCandidateCreatorBToJpsiReducedExpressions { /// Fill candidate information at MC reconstruction level /// \param rowsJpsiHadMcRec MC reco information on Jpsi hadron pairs /// \param candsBIds prong global indices of B candidates - template + template void fillMcRec(McRec const& rowsJpsiHadMcRec, CCands const& candsBIds) { for (const auto& candB : candsBIds) { bool filledMcInfo{false}; - if constexpr (decChannel == DecayChannel::BplusToJpsiK) { + if constexpr (DecChannel == DecayChannel::BplusToJpsiK) { for (const auto& rowJpsiHadMcRec : rowsJpsiHadMcRec) { if ((rowJpsiHadMcRec.jpsiId() != candB.jpsiId()) || (rowJpsiHadMcRec.bachKaId() != candB.bachKaId())) { continue; @@ -443,7 +443,7 @@ struct HfCandidateCreatorBToJpsiReducedExpressions { if (!filledMcInfo) { // protection to get same size tables in case something went wrong: we created a candidate that was not preselected in the Jpsi-K creator rowBplusMcRec(0, -1, -1, -1, -1.f); } - } else if constexpr (decChannel == DecayChannel::BsToJpsiPhi) { + } else if constexpr (DecChannel == DecayChannel::BsToJpsiPhi) { for (const auto& rowJpsiHadMcRec : rowsJpsiHadMcRec) { if ((rowJpsiHadMcRec.jpsiId() != candB.jpsiId()) || (rowJpsiHadMcRec.prong0PhiId() != candB.prong0PhiId()) || (rowJpsiHadMcRec.prong1PhiId() != candB.prong1PhiId())) { continue; @@ -465,9 +465,9 @@ struct HfCandidateCreatorBToJpsiReducedExpressions { } PROCESS_SWITCH(HfCandidateCreatorBToJpsiReducedExpressions, processMcBPlus, "Process MC", false); - void processMcBs(HfMcRecRedJPPhis const& rowsJpsiPhiMcRec, HfRedBs2JpsiDaus const& Bs) + void processMcBs(HfMcRecRedJPPhis const& rowsJpsiPhiMcRec, HfRedBs2JpsiDaus const& bs) { - fillMcRec(rowsJpsiPhiMcRec, Bs); + fillMcRec(rowsJpsiPhiMcRec, bs); } PROCESS_SWITCH(HfCandidateCreatorBToJpsiReducedExpressions, processMcBs, "Process MC", false); }; diff --git a/PWGHF/D2H/TableProducer/candidateCreatorBplusReduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorBplusReduced.cxx index 1bcff8ae7ae..a5f5ba5779b 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorBplusReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorBplusReduced.cxx @@ -120,7 +120,7 @@ struct HfCandidateCreatorBplusReduced { /// \param tracksPionThisCollision pion tracks in this collision /// \param invMass2D0PiMin minimum B+ invariant-mass /// \param invMass2D0PiMax maximum B+ invariant-mass - template + template void runCandidateCreation(Coll const& collision, Cands const& candsDThisColl, Pions const& tracksPionThisCollision, @@ -203,7 +203,7 @@ struct HfCandidateCreatorBplusReduced { rowCandidateProngs(candD0.globalIndex(), trackPion.globalIndex()); - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { if (trackPion.signed1Pt() < 0) { rowCandidateDmesMlScores(candD0.mlScoreBkgMassHypo0(), candD0.mlScorePromptMassHypo0(), candD0.mlScoreNonpromptMassHypo0()); } else { @@ -226,8 +226,8 @@ struct HfCandidateCreatorBplusReduced { } // invMassWindowD0PiTolerance is used to apply a slightly tighter cut than in D0Pi pair preselection // to avoid accepting D0Pi pairs that were not formed in D0Pi pair creator - double invMass2D0PiMin = (massBplus - myInvMassWindowD0Pi + invMassWindowD0PiTolerance) * (massBplus - myInvMassWindowD0Pi + invMassWindowD0PiTolerance); - double invMass2D0PiMax = (massBplus + myInvMassWindowD0Pi - invMassWindowD0PiTolerance) * (massBplus + myInvMassWindowD0Pi - invMassWindowD0PiTolerance); + double const invMass2D0PiMin = (massBplus - myInvMassWindowD0Pi + invMassWindowD0PiTolerance) * (massBplus - myInvMassWindowD0Pi + invMassWindowD0PiTolerance); + double const invMass2D0PiMax = (massBplus + myInvMassWindowD0Pi - invMassWindowD0PiTolerance) * (massBplus + myInvMassWindowD0Pi - invMassWindowD0PiTolerance); for (const auto& collisionCounter : collisionsCounter) { registry.fill(HIST("hEvents"), 1, collisionCounter.originalCollisionCount()); @@ -261,8 +261,8 @@ struct HfCandidateCreatorBplusReduced { } // invMassWindowD0PiTolerance is used to apply a slightly tighter cut than in D0Pi pair preselection // to avoid accepting D0Pi pairs that were not formed in D0Pi pair creator - float invMass2D0PiMin = (massBplus - myInvMassWindowD0Pi + invMassWindowD0PiTolerance) * (massBplus - myInvMassWindowD0Pi + invMassWindowD0PiTolerance); - float invMass2D0PiMax = (massBplus + myInvMassWindowD0Pi - invMassWindowD0PiTolerance) * (massBplus + myInvMassWindowD0Pi - invMassWindowD0PiTolerance); + float const invMass2D0PiMin = (massBplus - myInvMassWindowD0Pi + invMassWindowD0PiTolerance) * (massBplus - myInvMassWindowD0Pi + invMassWindowD0PiTolerance); + float const invMass2D0PiMax = (massBplus + myInvMassWindowD0Pi - invMassWindowD0PiTolerance) * (massBplus + myInvMassWindowD0Pi - invMassWindowD0PiTolerance); for (const auto& collisionCounter : collisionsCounter) { registry.fill(HIST("hEvents"), 1, collisionCounter.originalCollisionCount()); @@ -295,7 +295,7 @@ struct HfCandidateCreatorBplusReducedExpressions { /// \param checkDecayTypeMc /// \param rowsD0PiMcRec MC reco information on D0Pi pairs /// \param candsBplus prong global indices of B+ candidates - template + template void fillBplusMcRec(McRec const& rowsD0PiMcRec, HfRedBplusProngs const& candsBplus) { for (const auto& candBplus : candsBplus) { @@ -306,7 +306,7 @@ struct HfCandidateCreatorBplusReducedExpressions { } rowBplusMcRec(rowD0PiMcRec.flagMcMatchRec(), -1 /*channel*/, rowD0PiMcRec.flagWrongCollision(), rowD0PiMcRec.debugMcRec(), rowD0PiMcRec.ptMother()); filledMcInfo = true; - if constexpr (checkDecayTypeMc) { + if constexpr (CheckDecayTypeMc) { rowBplusMcCheck(rowD0PiMcRec.pdgCodeBeautyMother(), rowD0PiMcRec.pdgCodeCharmMother(), rowD0PiMcRec.pdgCodeProng0(), @@ -317,7 +317,7 @@ struct HfCandidateCreatorBplusReducedExpressions { } if (!filledMcInfo) { // protection to get same size tables in case something went wrong: we created a candidate that was not preselected in the D0-Pi creator rowBplusMcRec(0, -1, -1, -1, -1.f); - if constexpr (checkDecayTypeMc) { + if constexpr (CheckDecayTypeMc) { rowBplusMcCheck(-1, -1, -1, -1, -1); } } diff --git a/PWGHF/D2H/TableProducer/candidateCreatorBsReduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorBsReduced.cxx index 4a9ee3a9c57..3317b7383fa 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorBsReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorBsReduced.cxx @@ -116,7 +116,7 @@ struct HfCandidateCreatorBsReduced { /// \param tracksPionThisCollision pion tracks in this collision /// \param invMass2DPiMin minimum Bs invariant-mass /// \param invMass2DPiMax maximum Bs invariant-mass - template + template void runCandidateCreation(Coll const& collision, Cands const& candsDThisColl, Pions const& tracksPionThisCollision, @@ -203,7 +203,7 @@ struct HfCandidateCreatorBsReduced { rowCandidateProngs(candD.globalIndex(), trackPion.globalIndex()); - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { if (candD.invMassHypo0() > 0) { rowCandidateDmesMlScores(candD.mlScoreBkgMassHypo0(), candD.mlScorePromptMassHypo0(), candD.mlScoreNonpromptMassHypo0()); } else { @@ -227,8 +227,8 @@ struct HfCandidateCreatorBsReduced { } // invMassWindowDPiTolerance is used to apply a slightly tighter cut than in DsPi pair preselection // to avoid accepting DsPi pairs that were not formed in DsPi pair creator - float invMass2DPiMin = (massB - myInvMassWindowDPi + invMassWindowDPiTolerance) * (massB - myInvMassWindowDPi + invMassWindowDPiTolerance); - float invMass2DPiMax = (massB + myInvMassWindowDPi - invMassWindowDPiTolerance) * (massB + myInvMassWindowDPi - invMassWindowDPiTolerance); + float const invMass2DPiMin = (massB - myInvMassWindowDPi + invMassWindowDPiTolerance) * (massB - myInvMassWindowDPi + invMassWindowDPiTolerance); + float const invMass2DPiMax = (massB + myInvMassWindowDPi - invMassWindowDPiTolerance) * (massB + myInvMassWindowDPi - invMassWindowDPiTolerance); for (const auto& collisionCounter : collisionsCounter) { registry.fill(HIST("hEvents"), 1, collisionCounter.originalCollisionCount()); @@ -261,8 +261,8 @@ struct HfCandidateCreatorBsReduced { } // invMassWindowDPiTolerance is used to apply a slightly tighter cut than in DsPi pair preselection // to avoid accepting DPi pairs that were not formed in DsPi pair creator - float invMass2DPiMin = (massB - myInvMassWindowDPi + invMassWindowDPiTolerance) * (massB - myInvMassWindowDPi + invMassWindowDPiTolerance); - float invMass2DPiMax = (massB + myInvMassWindowDPi - invMassWindowDPiTolerance) * (massB + myInvMassWindowDPi - invMassWindowDPiTolerance); + float const invMass2DPiMin = (massB - myInvMassWindowDPi + invMassWindowDPiTolerance) * (massB - myInvMassWindowDPi + invMassWindowDPiTolerance); + float const invMass2DPiMax = (massB + myInvMassWindowDPi - invMassWindowDPiTolerance) * (massB + myInvMassWindowDPi - invMassWindowDPiTolerance); for (const auto& collisionCounter : collisionsCounter) { registry.fill(HIST("hEvents"), 1, collisionCounter.originalCollisionCount()); @@ -295,7 +295,7 @@ struct HfCandidateCreatorBsReducedExpressions { /// \param checkDecayTypeMc /// \param rowsDPiMcRec MC reco information on DsPi pairs /// \param candsB prong global indices of Bs candidates - template + template void fillBsMcRec(McRec const& rowsDPiMcRec, HfRedBsProngs const& candsB) { for (const auto& candB : candsB) { @@ -306,7 +306,7 @@ struct HfCandidateCreatorBsReducedExpressions { } rowBsMcRec(rowDPiMcRec.flagMcMatchRec(), -1 /*channel*/, rowDPiMcRec.flagWrongCollision(), rowDPiMcRec.debugMcRec(), rowDPiMcRec.ptMother()); filledMcInfo = true; - if constexpr (checkDecayTypeMc) { + if constexpr (CheckDecayTypeMc) { rowBsMcCheck(rowDPiMcRec.pdgCodeBeautyMother(), rowDPiMcRec.pdgCodeCharmMother(), rowDPiMcRec.pdgCodeProng0(), @@ -318,7 +318,7 @@ struct HfCandidateCreatorBsReducedExpressions { } if (!filledMcInfo) { // protection to get same size tables in case something went wrong: we created a candidate that was not preselected in the DsPi creator rowBsMcRec(0, -1, -1, -1, -1.f); - if constexpr (checkDecayTypeMc) { + if constexpr (CheckDecayTypeMc) { rowBsMcCheck(-1, -1, -1, -1, -1, -1); } } diff --git a/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx index baef99914fb..68e3f176736 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx @@ -22,6 +22,7 @@ #include "Common/Core/RecoDecay.h" +#include #include #include #include @@ -43,8 +44,8 @@ #include #include +#include #include -#include #include #include @@ -63,11 +64,11 @@ enum Selections : uint8_t { }; enum D0Sel : uint8_t { - selectedD0 = 0, - selectedD0Bar + SelectedD0 = 0, + SelectedD0Bar }; -enum DType : uint8_t { +enum DMesonType : uint8_t { Dplus = 1, Dstar, D0 @@ -184,32 +185,31 @@ struct HfCandidateCreatorCharmResoReduced { { if (!cfgDmesCuts.keepSideBands) { return (invMass >= cfgDmesCuts.cutsD->get(ptBin, "invMassSignalLow") && invMass <= cfgDmesCuts.cutsD->get(ptBin, "invMassSignalHigh")); - } else { - return ((invMass >= cfgDmesCuts.cutsD->get(ptBin, "invMassLeftSBLow") && invMass <= cfgDmesCuts.cutsD->get(ptBin, "invMassLeftSBHigh")) || - (invMass >= cfgDmesCuts.cutsD->get(ptBin, "invMassRightSBLow") && invMass <= cfgDmesCuts.cutsD->get(ptBin, "invMassRightSBHigh")) || - (invMass >= cfgDmesCuts.cutsD->get(ptBin, "invMassSignalLow") && invMass <= cfgDmesCuts.cutsD->get(ptBin, "invMassSignalHigh"))); } + return ((invMass >= cfgDmesCuts.cutsD->get(ptBin, "invMassLeftSBLow") && invMass <= cfgDmesCuts.cutsD->get(ptBin, "invMassLeftSBHigh")) || + (invMass >= cfgDmesCuts.cutsD->get(ptBin, "invMassRightSBLow") && invMass <= cfgDmesCuts.cutsD->get(ptBin, "invMassRightSBHigh")) || + (invMass >= cfgDmesCuts.cutsD->get(ptBin, "invMassSignalLow") && invMass <= cfgDmesCuts.cutsD->get(ptBin, "invMassSignalHigh"))); } /// Basic selection of D candidates /// \param candD is the reduced D meson candidate /// \return true if selections are passed - template + template uint8_t selctionFlagBachD(DRedTable const& candD) { - uint8_t selection = {BIT(D0Sel::selectedD0) | BIT(D0Sel::selectedD0Bar)}; + uint8_t selection = {BIT(D0Sel::SelectedD0) | BIT(D0Sel::SelectedD0Bar)}; float invMassD{0.}; - float ptD = candD.pt(); - int ptBin = findBin(cfgDmesCuts.binsPtD, ptD); + float const ptD = candD.pt(); + int const ptBin = findBin(cfgDmesCuts.binsPtD, ptD); if (ptBin == -1) { return 0; } - if constexpr (dType == DType::Dplus) { + if constexpr (DType == DMesonType::Dplus) { invMassD = candD.invMassDplus(); if (!isInMassInterval(invMassD, ptBin)) { return 0; } - } else if constexpr (dType == DType::Dstar) { + } else if constexpr (DType == DMesonType::Dstar) { if (candD.sign() > 0) { invMassD = candD.invMassDstar() - candD.invMassD0(); } else { @@ -218,22 +218,22 @@ struct HfCandidateCreatorCharmResoReduced { if (!isInMassInterval(invMassD, ptBin)) { return 0; } - } else if constexpr (dType == DType::D0) { - if (TESTBIT(candD.selFlagD0(), D0Sel::selectedD0)) { + } else if constexpr (DType == DMesonType::D0) { + if (TESTBIT(candD.selFlagD0(), D0Sel::SelectedD0)) { invMassD = candD.invMassD0(); if (!isInMassInterval(invMassD, ptBin)) { - CLRBIT(selection, D0Sel::selectedD0); + CLRBIT(selection, D0Sel::SelectedD0); } } else { - CLRBIT(selection, D0Sel::selectedD0); + CLRBIT(selection, D0Sel::SelectedD0); } - if (TESTBIT(candD.selFlagD0(), D0Sel::selectedD0Bar)) { + if (TESTBIT(candD.selFlagD0(), D0Sel::SelectedD0Bar)) { invMassD = candD.invMassD0Bar(); if (!isInMassInterval(invMassD, ptBin)) { - CLRBIT(selection, D0Sel::selectedD0Bar); + CLRBIT(selection, D0Sel::SelectedD0Bar); } } else { - CLRBIT(selection, D0Sel::selectedD0Bar); + CLRBIT(selection, D0Sel::SelectedD0Bar); } } return selection; @@ -245,7 +245,7 @@ struct HfCandidateCreatorCharmResoReduced { template bool isV0Selected(V0RedTable const& candV0) { - int ptBin = findBin(cfgV0Cuts.binsPtV0, candV0.pt()); + int const ptBin = findBin(cfgV0Cuts.binsPtV0, candV0.pt()); const float invMassLow = cfgV0Cuts.cutsV0->get(ptBin, "invMassLow"); const float invMassHigh = cfgV0Cuts.cutsV0->get(ptBin, "invMassHigh"); if (ptBin == -1) { @@ -350,7 +350,7 @@ struct HfCandidateCreatorCharmResoReduced { /// \param candV0Tr is the reduced V0 or track candidate /// \tparam dType is the type of D meson (Dplus, Dstar, D0) /// \tparam bachType is the type of bachelor (V0 or Track) - template + template void fillOutputTables(Coll const& collision, DRedTable const& candD, V0TrRedTable const& candV0Tr, @@ -359,24 +359,24 @@ struct HfCandidateCreatorCharmResoReduced { std::vector> pVectorCharmProngs = {candD.pVectorProng0(), candD.pVectorProng1()}; std::array pVecD = candD.pVector(); - int numFills = (cfgTrackRotation.enable) ? cfgTrackRotation.numRotations : 1; // number of times we fil the tables: default 1, but more in case of track rotation + int const numFills = (cfgTrackRotation.enable) ? cfgTrackRotation.numRotations : 1; // number of times we fil the tables: default 1, but more in case of track rotation for (int iFill{0}; iFill < numFills; ++iFill) { std::array pVecV0Tr = candV0Tr.pVector(); if (cfgTrackRotation.enable) { // let's rotate - float bkgRotAngle = cfgTrackRotation.minRotAngleMultByPi * constants::math::PI + bkgRotationAngleStep * iFill; + float const bkgRotAngle = cfgTrackRotation.minRotAngleMultByPi * constants::math::PI + bkgRotationAngleStep * iFill; pVecV0Tr = std::array{candV0Tr.px() * std::cos(bkgRotAngle) - candV0Tr.py() * std::sin(bkgRotAngle), candV0Tr.px() * std::sin(bkgRotAngle) + candV0Tr.py() * std::cos(bkgRotAngle), candV0Tr.pz()}; } float invMassReso{-1}, invMassV0Tr{-1}, invMassD{-1}; int8_t signReso{0}, isWrongSign{0}; - double ptReso = RecoDecay::pt(RecoDecay::sumOfVec(pVecV0Tr, pVecD)); + double const ptReso = RecoDecay::pt(RecoDecay::sumOfVec(pVecV0Tr, pVecD)); - if constexpr (dType == DType::Dplus) { + if constexpr (DType == DMesonType::Dplus) { invMassD = candD.invMassDplus(); pVectorCharmProngs.push_back(candD.pVectorProng2()); - if constexpr (bachType == BachelorType::V0) { + if constexpr (BachType == BachelorType::V0) { if (cfgV0Cuts.v0Type == V0Type::K0s) { // K0s invMassV0Tr = candV0Tr.invMassK0s(); signReso = candD.sign(); @@ -412,7 +412,7 @@ struct HfCandidateCreatorCharmResoReduced { registry.fill(HIST("hMassResoVsPt"), invMassReso, ptReso); registry.fill(HIST("hMassDmesDauVsPt"), invMassD, candD.pt()); registry.fill(HIST("hMassV0DauVsPt"), invMassV0Tr, candV0Tr.pt()); - } else if constexpr (bachType == BachelorType::Track) { + } else if constexpr (BachType == BachelorType::Track) { signReso = candD.sign() + candV0Tr.sign(); isWrongSign = candD.sign() * candV0Tr.sign() > 0 ? 1 : 0; if (cfgTrackCuts.massHypo == TrackType::Pion) { // Pion @@ -449,7 +449,7 @@ struct HfCandidateCreatorCharmResoReduced { registry.fill(HIST("hMassDmesDauVsPt"), invMassD, candD.pt()); registry.fill(HIST("hMassV0DauVsPt"), invMassV0Tr, candV0Tr.pt()); } - } else if constexpr (dType == DType::Dstar) { + } else if constexpr (DType == DMesonType::Dstar) { float invMassD0; if (candD.sign() > 0) { invMassD = candD.invMassDstar(); @@ -459,7 +459,7 @@ struct HfCandidateCreatorCharmResoReduced { invMassD0 = candD.invMassD0Bar(); } pVectorCharmProngs.push_back(candD.pVectorProng2()); - if constexpr (bachType == BachelorType::V0) { + if constexpr (BachType == BachelorType::V0) { signReso = candD.sign(); if (cfgV0Cuts.v0Type == V0Type::K0s) { // K0s invMassV0Tr = candV0Tr.invMassK0s(); @@ -500,7 +500,7 @@ struct HfCandidateCreatorCharmResoReduced { registry.fill(HIST("hMassResoVsPt"), invMassReso, ptReso); registry.fill(HIST("hMassDmesDauVsPt"), invMassD - invMassD0, candD.pt()); registry.fill(HIST("hMassV0DauVsPt"), invMassV0Tr, candV0Tr.pt()); - } else if constexpr (bachType == BachelorType::Track) { + } else if constexpr (BachType == BachelorType::Track) { signReso = candD.sign() + candV0Tr.sign(); isWrongSign = candD.sign() * candV0Tr.sign() > 0 ? 1 : 0; if (cfgTrackCuts.massHypo == TrackType::Pion) { // Pion @@ -549,11 +549,11 @@ struct HfCandidateCreatorCharmResoReduced { registry.fill(HIST("hMassDmesDauVsPt"), invMassD, candD.pt()); registry.fill(HIST("hMassV0DauVsPt"), invMassV0Tr, candV0Tr.pt()); } - } else if constexpr (dType == DType::D0) { + } else if constexpr (DType == DMesonType::D0) { // D0 - if (TESTBIT(selectionFlag, D0Sel::selectedD0)) { + if (TESTBIT(selectionFlag, D0Sel::SelectedD0)) { invMassD = candD.invMassD0(); - if constexpr (bachType == BachelorType::V0) { + if constexpr (BachType == BachelorType::V0) { signReso = 0; if (cfgV0Cuts.v0Type == V0Type::K0s) { // K0s invMassV0Tr = candV0Tr.invMassK0s(); @@ -586,7 +586,7 @@ struct HfCandidateCreatorCharmResoReduced { registry.fill(HIST("hMassResoVsPt"), invMassReso, ptReso); registry.fill(HIST("hMassDmesDauVsPt"), invMassD, candD.pt()); registry.fill(HIST("hMassV0DauVsPt"), invMassV0Tr, candV0Tr.pt()); - } else if constexpr (bachType == BachelorType::Track) { + } else if constexpr (BachType == BachelorType::Track) { signReso = candV0Tr.sign(); isWrongSign = candV0Tr.sign() > 0 ? 0 : 1; if (cfgTrackCuts.massHypo == TrackType::Pion) { // Pion @@ -625,9 +625,9 @@ struct HfCandidateCreatorCharmResoReduced { } } // D0bar - if (TESTBIT(selectionFlag, D0Sel::selectedD0Bar)) { + if (TESTBIT(selectionFlag, D0Sel::SelectedD0Bar)) { invMassD = candD.invMassD0Bar(); - if constexpr (bachType == BachelorType::V0) { + if constexpr (BachType == BachelorType::V0) { signReso = 0; if (cfgV0Cuts.v0Type == V0Type::K0s) { // K0s invMassV0Tr = candV0Tr.invMassK0s(); @@ -660,7 +660,7 @@ struct HfCandidateCreatorCharmResoReduced { registry.fill(HIST("hMassResoVsPt"), invMassReso, ptReso); registry.fill(HIST("hMassDmesDauVsPt"), invMassD, candD.pt()); registry.fill(HIST("hMassV0DauVsPt"), invMassV0Tr, candV0Tr.pt()); - } else if constexpr (bachType == BachelorType::Track) { + } else if constexpr (BachType == BachelorType::Track) { signReso = candV0Tr.sign(); isWrongSign = candV0Tr.sign() > 0 ? 1 : 0; if (cfgTrackCuts.massHypo == TrackType::Pion) { // Pion @@ -702,7 +702,7 @@ struct HfCandidateCreatorCharmResoReduced { } } - template + template void runCandidateCreation(Coll const& collision, DRedTable const& candsD, V0TrRedTable const& candsV0Tr) @@ -712,19 +712,19 @@ struct HfCandidateCreatorCharmResoReduced { for (const auto& candD : candsD) { // selection of D candidates registry.fill(HIST("hSelections"), 1); - uint8_t selFlagD = selctionFlagBachD(candD); + uint8_t const selFlagD = selctionFlagBachD(candD); if (selFlagD == 0) { continue; } registry.fill(HIST("hSelections"), 1 + Selections::DSel); std::vector dDaughtersIDs = {candD.prong0Id(), candD.prong1Id()}; - if constexpr (dType == DType::Dstar || dType == DType::Dplus) { + if constexpr (DType == DMesonType::Dstar || DType == DMesonType::Dplus) { dDaughtersIDs.push_back(candD.prong2Id()); } // loop on V0 or track candidates bool alreadyCounted{false}; for (const auto& candV0Tr : candsV0Tr) { - if constexpr (bachType == BachelorType::V0) { // Case: V0 + if constexpr (BachType == BachelorType::V0) { // Case: V0 if (rejectPairsWithCommonDaughter && (std::find(dDaughtersIDs.begin(), dDaughtersIDs.end(), candV0Tr.prong0Id()) != dDaughtersIDs.end() || std::find(dDaughtersIDs.begin(), dDaughtersIDs.end(), candV0Tr.prong1Id()) != dDaughtersIDs.end())) { continue; } @@ -735,7 +735,7 @@ struct HfCandidateCreatorCharmResoReduced { registry.fill(HIST("hSelections"), 1 + Selections::BachSel); alreadyCounted = true; } - } else if constexpr (bachType == BachelorType::Track) { // Case: Track + } else if constexpr (BachType == BachelorType::Track) { // Case: Track if (rejectPairsWithCommonDaughter && std::find(dDaughtersIDs.begin(), dDaughtersIDs.end(), candV0Tr.trackId()) != dDaughtersIDs.end()) { continue; } @@ -748,7 +748,7 @@ struct HfCandidateCreatorCharmResoReduced { } } // Filling of tables and histograms - fillOutputTables(collision, candD, candV0Tr, selFlagD); + fillOutputTables(collision, candD, candV0Tr, selFlagD); } // end of loop on V0/Track candidates } // end of loop on D candidates } // end of function @@ -759,34 +759,34 @@ struct HfCandidateCreatorCharmResoReduced { /// \param Coll is the reduced collisions table /// \param DRedTable is the D bachelors table /// \param V0TrRedTable is the V0/Track bachelors table - template + template void runCandidateCreationMixedEvent(Coll const& collisions, DRedTable const& candsD, V0TrRedTable const& candsV0Tr) { using BinningType = ColumnBinningPolicy; - BinningType corrBinning{{cfgMixedEvent.zPoolBins, cfgMixedEvent.multPoolBins}, true}; + BinningType const corrBinning{{cfgMixedEvent.zPoolBins, cfgMixedEvent.multPoolBins}, true}; auto bachTuple = std::make_tuple(candsD, candsV0Tr); - Pair pairs{corrBinning, cfgMixedEvent.numberEventsMixed, cfgMixedEvent.numberEventsToSkip, collisions, bachTuple, &cache}; + Pair const pairs{corrBinning, cfgMixedEvent.numberEventsMixed, cfgMixedEvent.numberEventsToSkip, collisions, bachTuple, &cache}; for (const auto& [collision1, bachDs, collision2, bachV0Trs] : pairs) { registry.fill(HIST("hNPvContCorr"), collision1.numContrib(), collision2.numContrib()); registry.fill(HIST("hZvertCorr"), collision1.posZ(), collision2.posZ()); for (const auto& [bachD, bachV0Tr] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(bachDs, bachV0Trs))) { // Apply analysis selections on D and V0 bachelors - uint8_t selFlagD = selctionFlagBachD(bachD); + uint8_t const selFlagD = selctionFlagBachD(bachD); if (selFlagD == 0) { continue; } - if constexpr (bachType == BachelorType::V0) { + if constexpr (BachType == BachelorType::V0) { if (!isV0Selected(bachV0Tr)) { continue; } - } else if constexpr (bachType == BachelorType::Track) { + } else if constexpr (BachType == BachelorType::Track) { if (!isTrackSelected(bachV0Tr)) { continue; } } - fillOutputTables(collision1, bachD, bachV0Tr, selFlagD); + fillOutputTables(collision1, bachD, bachV0Tr, selFlagD); } } } // runCandidateCreationMixedEvent @@ -800,7 +800,7 @@ struct HfCandidateCreatorCharmResoReduced { auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD.sliceBy(cands3PrPerCollision, thisCollId); auto v0sThisColl = candsV0.sliceBy(candsV0PerCollision, thisCollId); - runCandidateCreation(collision, candsDThisColl, v0sThisColl); + runCandidateCreation(collision, candsDThisColl, v0sThisColl); } } PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, process3ProngV0s, "Process resonances decaying in a 3 prong D meson and a V0", true); @@ -813,7 +813,7 @@ struct HfCandidateCreatorCharmResoReduced { auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD.sliceBy(candsDstarPerCollision, thisCollId); auto v0sThisColl = candsV0.sliceBy(candsV0PerCollision, thisCollId); - runCandidateCreation(collision, candsDThisColl, v0sThisColl); + runCandidateCreation(collision, candsDThisColl, v0sThisColl); } } PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processDstarV0s, "Process resonances decaying in a Dstar meson and a V0", false); @@ -826,7 +826,7 @@ struct HfCandidateCreatorCharmResoReduced { auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD.sliceBy(cands2PrPerCollision, thisCollId); auto v0sThisColl = candsV0.sliceBy(candsV0PerCollision, thisCollId); - runCandidateCreation(collision, candsDThisColl, v0sThisColl); + runCandidateCreation(collision, candsDThisColl, v0sThisColl); } } PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, process2PrV0s, "Process resonances decaying in a 2 prong D meson and a V0", false); @@ -839,7 +839,7 @@ struct HfCandidateCreatorCharmResoReduced { auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD.sliceBy(cands3PrPerCollision, thisCollId); auto trksThisColl = candsTr.sliceBy(candsTrackPerCollision, thisCollId); - runCandidateCreation(collision, candsDThisColl, trksThisColl); + runCandidateCreation(collision, candsDThisColl, trksThisColl); } } PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, process3ProngTracks, "Process resonances decaying in a 3 prong D meson and a Track", false); @@ -852,7 +852,7 @@ struct HfCandidateCreatorCharmResoReduced { auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD.sliceBy(candsDstarPerCollision, thisCollId); auto trksThisColl = candsTr.sliceBy(candsTrackPerCollision, thisCollId); - runCandidateCreation(collision, candsDThisColl, trksThisColl); + runCandidateCreation(collision, candsDThisColl, trksThisColl); } } PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processDstarTracks, "Process resonances decaying in a Dstar meson and a Track", false); @@ -865,7 +865,7 @@ struct HfCandidateCreatorCharmResoReduced { auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD.sliceBy(cands2PrPerCollision, thisCollId); auto trksThisColl = candsTr.sliceBy(candsTrackPerCollision, thisCollId); - runCandidateCreation(collision, candsDThisColl, trksThisColl); + runCandidateCreation(collision, candsDThisColl, trksThisColl); } } PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, process2PrTracks, "Process resonances decaying in a 2 prong D meson and a Track", false); @@ -875,7 +875,7 @@ struct HfCandidateCreatorCharmResoReduced { aod::HfRed3PrNoTrks const& candsD, aod::HfRedVzeros const& candsV0) { - runCandidateCreationMixedEvent(collisions, candsD, candsV0); + runCandidateCreationMixedEvent(collisions, candsD, candsV0); } PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, process3ProngV0sMixedEvent, "Process mixed events for resonances decaying in a 3 prong D meson and a V0", false); @@ -883,7 +883,7 @@ struct HfCandidateCreatorCharmResoReduced { aod::HfRedDstarNoTrks const& candsD, aod::HfRedVzeros const& candsV0) { - runCandidateCreationMixedEvent(collisions, candsD, candsV0); + runCandidateCreationMixedEvent(collisions, candsD, candsV0); } PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processDstarV0sMixedEvent, "Process mixed events for resonances decaying in a Dstar meson and a V0", false); @@ -891,7 +891,7 @@ struct HfCandidateCreatorCharmResoReduced { aod::HfRed2PrNoTrks const& candsD, aod::HfRedVzeros const& candsV0) { - runCandidateCreationMixedEvent(collisions, candsD, candsV0); + runCandidateCreationMixedEvent(collisions, candsD, candsV0); } PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, process2PrV0sMixedEvent, "Process mixed events for resonances decaying in a 2 prong D meson and a V0", false); @@ -899,7 +899,7 @@ struct HfCandidateCreatorCharmResoReduced { aod::HfRed3PrNoTrks const& candsD, HfRedTrkNoParams const& candsTr) { - runCandidateCreationMixedEvent(collisions, candsD, candsTr); + runCandidateCreationMixedEvent(collisions, candsD, candsTr); } PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, process3ProngTracksMixedEvent, "Process mixed events for resonances decaying in a 3 prong D meson and a Track", false); @@ -907,7 +907,7 @@ struct HfCandidateCreatorCharmResoReduced { aod::HfRedDstarNoTrks const& candsD, HfRedTrkNoParams const& candsTr) { - runCandidateCreationMixedEvent(collisions, candsD, candsTr); + runCandidateCreationMixedEvent(collisions, candsD, candsTr); } PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processDstarTracksMixedEvent, "Process mixed events for resonances decaying in a Dstar meson and a Track", false); @@ -915,7 +915,7 @@ struct HfCandidateCreatorCharmResoReduced { aod::HfRed2PrNoTrks const& candsD, HfRedTrkNoParams const& candsTr) { - runCandidateCreationMixedEvent(collisions, candsD, candsTr); + runCandidateCreationMixedEvent(collisions, candsD, candsTr); } PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, process2PrTracksMixedEvent, "Process mixed events for resonances decaying in a 2 prong D meson and a Track", false); diff --git a/PWGHF/D2H/TableProducer/candidateCreatorLbReduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorLbReduced.cxx index 3246cedb03f..77b9457ecb2 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorLbReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorLbReduced.cxx @@ -109,8 +109,8 @@ struct HfCandidateCreatorLbReduced { } template - inline std::pair computeInvMass2LcPiWindow(Config const& configs, - float invMassWindowLcPiTolerance) + std::pair computeInvMass2LcPiWindow(Config const& configs, + float invMassWindowLcPiTolerance) { myInvMassWindowLcPi = 0.0f; @@ -118,11 +118,11 @@ struct HfCandidateCreatorLbReduced { myInvMassWindowLcPi = config.myInvMassWindowLcPi(); } - float deltaMin = MassLambdaB0 - myInvMassWindowLcPi + invMassWindowLcPiTolerance; - float deltaMax = MassLambdaB0 + myInvMassWindowLcPi - invMassWindowLcPiTolerance; + float const deltaMin = MassLambdaB0 - myInvMassWindowLcPi + invMassWindowLcPiTolerance; + float const deltaMax = MassLambdaB0 + myInvMassWindowLcPi - invMassWindowLcPiTolerance; - float invMass2LcPiMin = deltaMin * deltaMin; - float invMass2LcPiMax = deltaMax * deltaMax; + float const invMass2LcPiMin = deltaMin * deltaMin; + float const invMass2LcPiMax = deltaMax * deltaMax; return {invMass2LcPiMin, invMass2LcPiMax}; } @@ -134,7 +134,7 @@ struct HfCandidateCreatorLbReduced { /// \param tracksPionThisCollision pion tracks in this collision /// \param invMass2LcPiMin minimum Lb invariant-mass /// \param invMass2LcPiMax maximum Lb invariant-mass - template + template void runCandidateCreation(Coll const& collision, Cands const& candsLcThisColl, Pions const& tracksPionThisCollision, @@ -223,7 +223,7 @@ struct HfCandidateCreatorLbReduced { rowCandidateProngs(candLc.globalIndex(), trackPion.globalIndex()); - if constexpr (withLcMl) { + if constexpr (WithLcMl) { if (candLc.invMassHypo0() > 0) { rowCandidateLcMlScores(candLc.mlScoreBkgMassHypo0(), candLc.mlScorePromptMassHypo0(), candLc.mlScoreNonpromptMassHypo0()); } else { @@ -308,7 +308,7 @@ struct HfCandidateCreatorLbReducedExpressions { /// \param checkDecayTypeMc /// \param rowsLcPiMcRec MC reco information on LcPi pairs /// \param candsLb prong global indices of Lb candidates - template + template void fillLbMcRec(McRec const& rowsLcPiMcRec, HfRedLbProngs const& candsLb) { for (const auto& candLb : candsLb) { @@ -319,7 +319,7 @@ struct HfCandidateCreatorLbReducedExpressions { } rowLbMcRec(rowLcPiMcRec.flagMcMatchRec(), rowLcPiMcRec.flagWrongCollision(), rowLcPiMcRec.debugMcRec(), rowLcPiMcRec.ptMother()); filledMcInfo = true; - if constexpr (checkDecayTypeMc) { + if constexpr (CheckDecayTypeMc) { rowLbMcCheck(rowLcPiMcRec.pdgCodeBeautyMother(), rowLcPiMcRec.pdgCodeCharmMother(), rowLcPiMcRec.pdgCodeProng0(), @@ -331,7 +331,7 @@ struct HfCandidateCreatorLbReducedExpressions { } if (!filledMcInfo) { // protection to get same size tables in case something went wrong: we created a candidate that was not preselected in the LcPi creator rowLbMcRec(0, -1, -1, -1.f); - if constexpr (checkDecayTypeMc) { + if constexpr (CheckDecayTypeMc) { rowLbMcCheck(-1, -1, -1, -1, -1, -1); } } diff --git a/PWGHF/D2H/TableProducer/candidateSelectorB0ToDPiReduced.cxx b/PWGHF/D2H/TableProducer/candidateSelectorB0ToDPiReduced.cxx index 51ba23c8511..0ab8c41c82d 100644 --- a/PWGHF/D2H/TableProducer/candidateSelectorB0ToDPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateSelectorB0ToDPiReduced.cxx @@ -97,7 +97,7 @@ struct HfCandidateSelectorB0ToDPiReduced { o2::analysis::HfMlResponseB0ToDPi hfMlResponse; float outputMlNotPreselected = -1.; - std::vector outputMl = {}; + std::vector outputMl; o2::ccdb::CcdbApi ccdbApi; TrackSelectorPi selectorPion; @@ -170,11 +170,11 @@ struct HfCandidateSelectorB0ToDPiReduced { /// \param candidate is the B0 candidate /// \param prongBachPi is the candidate's bachelor pion prong /// \note this method is used for B0 → D*- π+ candidates with D meson ML scores - template + template auto getMlInputFeatures(const T1& candB0, const T2& prongBachPi) { auto prongSoftPi = candB0.template prongSoftPi_as(); - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { return hfMlResponse.getInputFeaturesDStarPi(candB0, prongBachPi, prongSoftPi); } else { return hfMlResponse.getInputFeaturesDStarPi(candB0, prongBachPi, prongSoftPi); @@ -195,10 +195,10 @@ struct HfCandidateSelectorB0ToDPiReduced { /// \param candB0 is the B0 candidate /// \param prongBachPi is the candidate's bachelor pion prong /// \note this method is used for B0 → D- π+ candidates with D meson ML scores - template + template auto getMlInputFeatures(const T1& candB0, const T2& prongBachPi) { - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { return hfMlResponse.getInputFeatures(candB0, prongBachPi); } else { return hfMlResponse.getInputFeatures(candB0, prongBachPi); @@ -210,7 +210,7 @@ struct HfCandidateSelectorB0ToDPiReduced { /// \param hfCandsB0 B0 candidates /// \param pionTracks pion tracks /// \param configs config inherited from the Dpi data creator - template + template void runSelection(Cands const& hfCandsB0, TracksBachPion const&, HfCandB0Configs const& configs) @@ -239,7 +239,7 @@ struct HfCandidateSelectorB0ToDPiReduced { continue; } - if constexpr (withDmesMl) { // we include it in the topological selections + if constexpr (WithDmesMl) { // we include it in the topological selections if (!hfHelper.selectionDmesMlScoresForBReduced(hfCandB0, cutsDmesMl, binsPtDmesMl)) { hfSelB0ToDPiCandidate(statusB0ToDPi); if (applyB0Ml) { @@ -278,8 +278,8 @@ struct HfCandidateSelectorB0ToDPiReduced { } if (applyB0Ml) { // B0 ML selections - std::vector inputFeatures = getMlInputFeatures(hfCandB0, trackBachPi); - bool isSelectedMl = hfMlResponse.isSelectedMl(inputFeatures, ptCandB0, outputMl); + std::vector inputFeatures = getMlInputFeatures(hfCandB0, trackBachPi); + bool const isSelectedMl = hfMlResponse.isSelectedMl(inputFeatures, ptCandB0, outputMl); hfMlB0ToDPiCandidate(outputMl[1]); // storing ML score for signal class if (!isSelectedMl) { diff --git a/PWGHF/D2H/TableProducer/candidateSelectorBplusToD0PiReduced.cxx b/PWGHF/D2H/TableProducer/candidateSelectorBplusToD0PiReduced.cxx index 3e1554fdb2e..91d0b934261 100644 --- a/PWGHF/D2H/TableProducer/candidateSelectorBplusToD0PiReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateSelectorBplusToD0PiReduced.cxx @@ -97,7 +97,7 @@ struct HfCandidateSelectorBplusToD0PiReduced { o2::analysis::HfMlResponseBplusToD0PiReduced hfMlResponse; float outputMlNotPreselected = -1.; - std::vector outputMl = {}; + std::vector outputMl; o2::ccdb::CcdbApi ccdbApi; HfHelper hfHelper; @@ -160,7 +160,7 @@ struct HfCandidateSelectorBplusToD0PiReduced { /// \param hfCandsBp B+ candidates /// \param pionTracks pion tracks /// \param configs config inherited from the D0pi data creator - template + template void runSelection(Cands const& hfCandsBp, TracksPion const& /*pionTracks*/, HfCandBpConfigs const& configs) @@ -190,7 +190,7 @@ struct HfCandidateSelectorBplusToD0PiReduced { continue; } - if constexpr (withDmesMl) { // we include it in the topological selections + if constexpr (WithDmesMl) { // we include it in the topological selections if (!hfHelper.selectionDmesMlScoresForBReduced(hfCandBp, cutsDmesMl, binsPtDmesMl)) { hfSelBplusToD0PiCandidate(statusBplus); if (applyBplusMl) { @@ -230,8 +230,8 @@ struct HfCandidateSelectorBplusToD0PiReduced { } if (applyBplusMl) { // B+ ML selections - std::vector inputFeatures = hfMlResponse.getInputFeatures(hfCandBp, trackPi); - bool isSelectedMl = hfMlResponse.isSelectedMl(inputFeatures, ptCandBplus, outputMl); + std::vector inputFeatures = hfMlResponse.getInputFeatures(hfCandBp, trackPi); + bool const isSelectedMl = hfMlResponse.isSelectedMl(inputFeatures, ptCandBplus, outputMl); hfMlBplusToD0PiCandidate(outputMl[1]); // storing ML score for signal class if (!isSelectedMl) { diff --git a/PWGHF/D2H/TableProducer/candidateSelectorBsToDsPiReduced.cxx b/PWGHF/D2H/TableProducer/candidateSelectorBsToDsPiReduced.cxx index 99e71e34acd..71c9c54f589 100644 --- a/PWGHF/D2H/TableProducer/candidateSelectorBsToDsPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateSelectorBsToDsPiReduced.cxx @@ -93,7 +93,7 @@ struct HfCandidateSelectorBsToDsPiReduced { Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; o2::analysis::HfMlResponseBsToDsPi hfMlResponse; - std::vector outputMl = {}; + std::vector outputMl; o2::ccdb::CcdbApi ccdbApi; TrackSelectorPi selectorPion; @@ -156,7 +156,7 @@ struct HfCandidateSelectorBsToDsPiReduced { /// \param hfCandsBs Bs candidates /// \param pionTracks pion tracks /// \param configs config inherited from the charm-hadron data creator - template + template void runSelection(Cands const& hfCandsBs, TracksPion const&, HfCandBsConfigs const&) @@ -180,7 +180,7 @@ struct HfCandidateSelectorBsToDsPiReduced { continue; } - if constexpr (withDmesMl) { // we include it in the topological selections + if constexpr (WithDmesMl) { // we include it in the topological selections if (!hfHelper.selectionDmesMlScoresForBReduced(hfCandBs, cutsDmesMl, binsPtDmesMl)) { hfSelBsToDsPiCandidate(statusBsToDsPi); if (applyBsMl) { @@ -219,8 +219,8 @@ struct HfCandidateSelectorBsToDsPiReduced { if (applyBsMl) { // Bs ML selections - std::vector inputFeatures = hfMlResponse.getInputFeatures(hfCandBs, trackPi); - bool isSelectedMl = hfMlResponse.isSelectedMl(inputFeatures, ptCandBs, outputMl); + std::vector inputFeatures = hfMlResponse.getInputFeatures(hfCandBs, trackPi); + bool const isSelectedMl = hfMlResponse.isSelectedMl(inputFeatures, ptCandBs, outputMl); hfMlBsToDsPiCandidate(outputMl); if (!isSelectedMl) { diff --git a/PWGHF/D2H/TableProducer/candidateSelectorLbToLcPiReduced.cxx b/PWGHF/D2H/TableProducer/candidateSelectorLbToLcPiReduced.cxx index dbe86c4905d..d3dea0df59f 100644 --- a/PWGHF/D2H/TableProducer/candidateSelectorLbToLcPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateSelectorLbToLcPiReduced.cxx @@ -94,7 +94,7 @@ struct HfCandidateSelectorLbToLcPiReduced { o2::analysis::HfMlResponseLbToLcPi hfMlResponse; float outputMlNotPreselected = -1.; - std::vector outputMl = {}; + std::vector outputMl; o2::ccdb::CcdbApi ccdbApi; TrackSelectorPi selectorPion; @@ -157,7 +157,7 @@ struct HfCandidateSelectorLbToLcPiReduced { /// \param hfCandsLb Lb candidates /// \param pionTracks pion tracks /// \param configs config inherited from the charm-hadron data creator - template + template void runSelection(Cands const& hfCandsLb, TracksPion const&, HfCandLbConfigs const&) @@ -181,7 +181,7 @@ struct HfCandidateSelectorLbToLcPiReduced { continue; } - if constexpr (withLcMl) { // we include it in the topological selections + if constexpr (WithLcMl) { // we include it in the topological selections if (!hfHelper.selectionDmesMlScoresForBReduced(hfCandLb, cutsLcMl, binsPtLcMl)) { hfSelLbToLcPiCandidate(statusLbToLcPi); if (applyLbMl) { @@ -220,8 +220,8 @@ struct HfCandidateSelectorLbToLcPiReduced { if (applyLbMl) { // Lb ML selections - std::vector inputFeatures = hfMlResponse.getInputFeatures(hfCandLb, trackPi); - bool isSelectedMl = hfMlResponse.isSelectedMl(inputFeatures, ptCandLb, outputMl); + std::vector inputFeatures = hfMlResponse.getInputFeatures(hfCandLb, trackPi); + bool const isSelectedMl = hfMlResponse.isSelectedMl(inputFeatures, ptCandLb, outputMl); hfMlLbToLcPiCandidate(outputMl[1]); if (!isSelectedMl) { diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx index 9734cf40148..bc208719ee6 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx @@ -26,7 +26,6 @@ #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/Utils/utilsEvSelHf.h" -#include "PWGHF/Utils/utilsMcMatching.h" #include "PWGHF/Utils/utilsTrkCandHf.h" #include "Common/Core/RecoDecay.h" @@ -84,7 +83,6 @@ using namespace o2::aod; using namespace o2::constants::physics; using namespace o2::framework; using namespace o2::framework::expressions; -using namespace o2::hf_decay; using namespace o2::hf_trkcandsel; enum Event : uint8_t { @@ -210,7 +208,7 @@ struct HfDataCreatorCharmHadPiReduced { // CCDB service Service ccdb; o2::base::Propagator::MatCorrType noMatCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; - int runNumber; + int runNumber{}; // O2DatabasePDG service Service pdg; @@ -349,8 +347,8 @@ struct HfDataCreatorCharmHadPiReduced { registry.get(HIST("hEvents"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data()); } - std::string charmHadTitle = ""; - std::string histMassTitle = ""; + std::string charmHadTitle; + std::string histMassTitle; if (doprocessDplusPiData || doprocessDplusPiDataWithMl || doprocessDplusPiDataWithQvec || doprocessDplusPiDataWithMlAndQvec || doprocessDplusPiMc || doprocessDplusPiMcWithMl) { charmHadTitle = "D^{#plus}"; histMassTitle = "Dplus"; @@ -402,7 +400,7 @@ struct HfDataCreatorCharmHadPiReduced { doprocessDstarPiMc || doprocessDstarPiMcWithMl) { const auto& workflows = initContext.services().get(); for (const DeviceSpec& device : workflows.devices) { - if (device.name.compare("hf-data-creator-charm-had-pi-reduced") == 0) { + if (device.name == "hf-data-creator-charm-had-pi-reduced") { // init HF event selection helper hfEvSelMc.init(device, registry); break; @@ -481,7 +479,7 @@ struct HfDataCreatorCharmHadPiReduced { /// \param vecDaughtersB is the vector with all daughter tracks (bachelor pion in last position) /// \param indexHfCandCharm is the index of the charm-hadron candidate /// \param selectedTracksPion is the map with the indices of selected bachelor pion tracks - template + template void fillMcRecoInfo(const CColl& collision, const PParticles& particlesMc, const std::vector& vecDaughtersB, @@ -504,7 +502,7 @@ struct HfDataCreatorCharmHadPiReduced { int pdgCodeProng3{0}; float motherPt{-1.f}; - if constexpr (decChannel == DecayChannel::B0ToDminusPi) { + if constexpr (DecChannel == DecayChannel::B0ToDminusPi) { // B0 → D- π+ → (π- K+ π-) π+ auto indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kB0, std::array{-kPiPlus, +kKPlus, -kPiPlus, +kPiPlus}, true, &sign, 3); if (indexRec > -1) { @@ -569,15 +567,15 @@ struct HfDataCreatorCharmHadPiReduced { auto particleProng2 = vecDaughtersB[2].mcParticle(); auto particleProng3 = vecDaughtersB[3].mcParticle(); // b-hadron hypothesis - std::array bHadronMotherHypos = {Pdg::kB0, Pdg::kBS, Pdg::kLambdaB0}; + std::array const bHadronMotherHypos = {Pdg::kB0, Pdg::kBS, Pdg::kLambdaB0}; // c-hadron hypothesis - std::array cHadronMotherHypos = {Pdg::kDPlus, Pdg::kDS, Pdg::kDStar, Pdg::kLambdaCPlus}; + std::array const cHadronMotherHypos = {Pdg::kDPlus, Pdg::kDS, Pdg::kDStar, Pdg::kLambdaCPlus}; for (const auto& bHadronMotherHypo : bHadronMotherHypos) { - int index0Mother = RecoDecay::getMother(particlesMc, particleProng0, bHadronMotherHypo, true); - int index1Mother = RecoDecay::getMother(particlesMc, particleProng1, bHadronMotherHypo, true); - int index2Mother = RecoDecay::getMother(particlesMc, particleProng2, bHadronMotherHypo, true); - int index3Mother = RecoDecay::getMother(particlesMc, particleProng3, bHadronMotherHypo, true); + int const index0Mother = RecoDecay::getMother(particlesMc, particleProng0, bHadronMotherHypo, true); + int const index1Mother = RecoDecay::getMother(particlesMc, particleProng1, bHadronMotherHypo, true); + int const index2Mother = RecoDecay::getMother(particlesMc, particleProng2, bHadronMotherHypo, true); + int const index3Mother = RecoDecay::getMother(particlesMc, particleProng3, bHadronMotherHypo, true); // look for common b-hadron ancestor if (index0Mother > -1 && index1Mother > -1 && index2Mother > -1 && index3Mother > -1) { @@ -595,9 +593,9 @@ struct HfDataCreatorCharmHadPiReduced { if (cHadronMotherHypo == Pdg::kDStar) { // to include D* -> D π0/γ and D* -> D0 π depthMax += 1; } - int index0CharmMother = RecoDecay::getMother(particlesMc, particleProng0, cHadronMotherHypo, true, &sign, depthMax); - int index1CharmMother = RecoDecay::getMother(particlesMc, particleProng1, cHadronMotherHypo, true, &sign, depthMax); - int index2CharmMother = RecoDecay::getMother(particlesMc, particleProng2, cHadronMotherHypo, true, &sign, depthMax); + int const index0CharmMother = RecoDecay::getMother(particlesMc, particleProng0, cHadronMotherHypo, true, &sign, depthMax); + int const index1CharmMother = RecoDecay::getMother(particlesMc, particleProng1, cHadronMotherHypo, true, &sign, depthMax); + int const index2CharmMother = RecoDecay::getMother(particlesMc, particleProng2, cHadronMotherHypo, true, &sign, depthMax); if (index0CharmMother > -1 && index1CharmMother > -1 && index2CharmMother > -1) { if (index0CharmMother == index1CharmMother && index1CharmMother == index2CharmMother) { // pdgCodeCharmMother = @@ -618,7 +616,7 @@ struct HfDataCreatorCharmHadPiReduced { tables.rowHfDPiMcCheckReduced(pdgCodeBeautyMother, pdgCodeCharmMother, pdgCodeProng0, pdgCodeProng1, pdgCodeProng2, pdgCodeProng3); } tables.rowHfDPiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); - } else if constexpr (decChannel == DecayChannel::BsToDsminusPi) { + } else if constexpr (DecChannel == DecayChannel::BsToDsminusPi) { // Bs → Ds- π+ → (K- K+ π-) π+ auto indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kBS, std::array{-kKPlus, +kKPlus, -kPiPlus, +kPiPlus}, true, &sign, 3); if (indexRec > -1) { @@ -626,7 +624,7 @@ struct HfDataCreatorCharmHadPiReduced { indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, -Pdg::kDS, std::array{-kKPlus, +kKPlus, -kPiPlus}, true, &sign, 2); if (indexRec > -1) { std::vector arrDaughDsIndex; - std::array arrPDGDaughDs; + std::array arrPDGDaughDs{}; RecoDecay::getDaughters(particlesMc.rawIteratorAt(indexRec), &arrDaughDsIndex, std::array{0}, 1); if (arrDaughDsIndex.size() == NDaughtersDs) { for (auto iProng = 0u; iProng < arrDaughDsIndex.size(); ++iProng) { @@ -663,7 +661,7 @@ struct HfDataCreatorCharmHadPiReduced { indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, -Pdg::kDS, std::array{-kKPlus, +kKPlus, -kPiPlus}, true, &sign, 2); if (indexRec > -1) { std::vector arrDaughDsIndex; - std::array arrPDGDaughDs; + std::array arrPDGDaughDs{}; RecoDecay::getDaughters(particlesMc.rawIteratorAt(indexRec), &arrDaughDsIndex, std::array{0}, 1); if (arrDaughDsIndex.size() == NDaughtersDs) { for (auto iProng = 0u; iProng < arrDaughDsIndex.size(); ++iProng) { @@ -688,7 +686,7 @@ struct HfDataCreatorCharmHadPiReduced { indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, -Pdg::kDS, std::array{-kKPlus, +kKPlus, -kPiPlus}, true, &sign, 2); if (indexRec > -1) { std::vector arrDaughDsIndex; - std::array arrPDGDaughDs; + std::array arrPDGDaughDs{}; RecoDecay::getDaughters(particlesMc.rawIteratorAt(indexRec), &arrDaughDsIndex, std::array{0}, 1); if (arrDaughDsIndex.size() == NDaughtersDs) { for (auto iProng = 0u; iProng < arrDaughDsIndex.size(); ++iProng) { @@ -723,15 +721,15 @@ struct HfDataCreatorCharmHadPiReduced { auto particleProng2 = vecDaughtersB[2].mcParticle(); auto particleProng3 = vecDaughtersB[3].mcParticle(); // b-hadron hypothesis - std::array bHadronMotherHypos = {Pdg::kB0, Pdg::kBS, Pdg::kLambdaB0}; + std::array const bHadronMotherHypos = {Pdg::kB0, Pdg::kBS, Pdg::kLambdaB0}; // c-hadron hypothesis - std::array cHadronMotherHypos = {Pdg::kDPlus, Pdg::kDS, Pdg::kDStar, Pdg::kDSStar, Pdg::kLambdaCPlus}; + std::array const cHadronMotherHypos = {Pdg::kDPlus, Pdg::kDS, Pdg::kDStar, Pdg::kDSStar, Pdg::kLambdaCPlus}; for (const auto& bHadronMotherHypo : bHadronMotherHypos) { - int index0Mother = RecoDecay::getMother(particlesMc, particleProng0, bHadronMotherHypo, true); - int index1Mother = RecoDecay::getMother(particlesMc, particleProng1, bHadronMotherHypo, true); - int index2Mother = RecoDecay::getMother(particlesMc, particleProng2, bHadronMotherHypo, true); - int index3Mother = RecoDecay::getMother(particlesMc, particleProng3, bHadronMotherHypo, true); + int const index0Mother = RecoDecay::getMother(particlesMc, particleProng0, bHadronMotherHypo, true); + int const index1Mother = RecoDecay::getMother(particlesMc, particleProng1, bHadronMotherHypo, true); + int const index2Mother = RecoDecay::getMother(particlesMc, particleProng2, bHadronMotherHypo, true); + int const index3Mother = RecoDecay::getMother(particlesMc, particleProng3, bHadronMotherHypo, true); // look for common b-hadron ancestor if (index0Mother > -1 && index1Mother > -1 && index2Mother > -1 && index3Mother > -1) { @@ -749,9 +747,9 @@ struct HfDataCreatorCharmHadPiReduced { if (cHadronMotherHypo == Pdg::kDStar || cHadronMotherHypo == Pdg::kDSStar) { // to include D* -> D π0/γ, D* -> D0 π, and Ds* -> Ds π0/γ depthMax += 1; } - int index0CharmMother = RecoDecay::getMother(particlesMc, particleProng0, cHadronMotherHypo, true, &sign, depthMax); - int index1CharmMother = RecoDecay::getMother(particlesMc, particleProng1, cHadronMotherHypo, true, &sign, depthMax); - int index2CharmMother = RecoDecay::getMother(particlesMc, particleProng2, cHadronMotherHypo, true, &sign, depthMax); + int const index0CharmMother = RecoDecay::getMother(particlesMc, particleProng0, cHadronMotherHypo, true, &sign, depthMax); + int const index1CharmMother = RecoDecay::getMother(particlesMc, particleProng1, cHadronMotherHypo, true, &sign, depthMax); + int const index2CharmMother = RecoDecay::getMother(particlesMc, particleProng2, cHadronMotherHypo, true, &sign, depthMax); if (index0CharmMother > -1 && index1CharmMother > -1 && index2CharmMother > -1) { if (index0CharmMother == index1CharmMother && index1CharmMother == index2CharmMother) { // pdgCodeCharmMother = @@ -773,7 +771,7 @@ struct HfDataCreatorCharmHadPiReduced { tables.rowHfDsPiMcCheckReduced(pdgCodeBeautyMother, pdgCodeCharmMother, pdgCodeProng0, pdgCodeProng1, pdgCodeProng2, pdgCodeProng3); } tables.rowHfDsPiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); - } else if constexpr (decChannel == DecayChannel::BplusToD0barPi) { + } else if constexpr (DecChannel == DecayChannel::BplusToD0barPi) { // B+ → D0(bar) π+ → (K+ π-) π+ auto indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, Pdg::kBPlus, std::array{+kPiPlus, +kKPlus, -kPiPlus}, true, &sign, 2); if (indexRec > -1) { @@ -823,14 +821,14 @@ struct HfDataCreatorCharmHadPiReduced { auto particleProng1 = vecDaughtersB[1].mcParticle(); auto particleProng2 = vecDaughtersB[2].mcParticle(); // b-hadron hypothesis - std::array bHadronMotherHypos = {Pdg::kBPlus, Pdg::kB0, Pdg::kBS, Pdg::kLambdaB0}; + std::array const bHadronMotherHypos = {Pdg::kBPlus, Pdg::kB0, Pdg::kBS, Pdg::kLambdaB0}; // c-hadron hypothesis - std::array cHadronMotherHypos = {Pdg::kD0, Pdg::kDPlus, Pdg::kDS, Pdg::kDStar, 423, Pdg::kDSStar, Pdg::kLambdaCPlus}; + std::array const cHadronMotherHypos = {Pdg::kD0, Pdg::kDPlus, Pdg::kDS, Pdg::kDStar, 423, Pdg::kDSStar, Pdg::kLambdaCPlus}; for (const auto& bHadronMotherHypo : bHadronMotherHypos) { - int index0Mother = RecoDecay::getMother(particlesMc, particleProng0, bHadronMotherHypo, true); - int index1Mother = RecoDecay::getMother(particlesMc, particleProng1, bHadronMotherHypo, true); - int index2Mother = RecoDecay::getMother(particlesMc, particleProng2, bHadronMotherHypo, true); + int const index0Mother = RecoDecay::getMother(particlesMc, particleProng0, bHadronMotherHypo, true); + int const index1Mother = RecoDecay::getMother(particlesMc, particleProng1, bHadronMotherHypo, true); + int const index2Mother = RecoDecay::getMother(particlesMc, particleProng2, bHadronMotherHypo, true); // look for common b-hadron ancestor if (index0Mother > -1 && index1Mother > -1 && index2Mother > -1) { @@ -847,8 +845,8 @@ struct HfDataCreatorCharmHadPiReduced { if (cHadronMotherHypo == Pdg::kDStar || cHadronMotherHypo == Pdg::kDStar0 || cHadronMotherHypo == Pdg::kDSStar) { // to include D* -> D π0/γ, D* -> D0 π, and Ds* -> Ds π0/γ depthMax += 1; } - int index0CharmMother = RecoDecay::getMother(particlesMc, particleProng0, cHadronMotherHypo, true, &sign, depthMax); - int index1CharmMother = RecoDecay::getMother(particlesMc, particleProng1, cHadronMotherHypo, true, &sign, depthMax); + int const index0CharmMother = RecoDecay::getMother(particlesMc, particleProng0, cHadronMotherHypo, true, &sign, depthMax); + int const index1CharmMother = RecoDecay::getMother(particlesMc, particleProng1, cHadronMotherHypo, true, &sign, depthMax); if (index0CharmMother > -1 && index1CharmMother > -1) { if (index0CharmMother == index1CharmMother) { // pdgCodeCharmMother = @@ -870,7 +868,7 @@ struct HfDataCreatorCharmHadPiReduced { tables.rowHfD0PiMcCheckReduced(pdgCodeBeautyMother, pdgCodeCharmMother, pdgCodeProng0, pdgCodeProng1, pdgCodeProng2); } tables.rowHfD0PiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); - } else if constexpr (decChannel == DecayChannel::LbToLcplusPi) { + } else if constexpr (DecChannel == DecayChannel::LbToLcplusPi) { // Lb → Lc+ π- → (p K- π+) π- auto indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kLambdaB0, std::array{+kProton, -kKPlus, +kPiPlus, -kPiPlus}, true, &sign, 3); if (indexRec > -1) { @@ -925,15 +923,15 @@ struct HfDataCreatorCharmHadPiReduced { auto particleProng2 = vecDaughtersB[2].mcParticle(); auto particleProng3 = vecDaughtersB[3].mcParticle(); // b-hadron hypothesis - std::array bHadronMotherHypos = {Pdg::kB0, Pdg::kBS, Pdg::kLambdaB0}; + std::array const bHadronMotherHypos = {Pdg::kB0, Pdg::kBS, Pdg::kLambdaB0}; // c-hadron hypothesis - std::array cHadronMotherHypos = {Pdg::kDPlus, Pdg::kDS, Pdg::kDStar, Pdg::kLambdaCPlus}; + std::array const cHadronMotherHypos = {Pdg::kDPlus, Pdg::kDS, Pdg::kDStar, Pdg::kLambdaCPlus}; for (const auto& bHadronMotherHypo : bHadronMotherHypos) { - int index0Mother = RecoDecay::getMother(particlesMc, particleProng0, bHadronMotherHypo, true); - int index1Mother = RecoDecay::getMother(particlesMc, particleProng1, bHadronMotherHypo, true); - int index2Mother = RecoDecay::getMother(particlesMc, particleProng2, bHadronMotherHypo, true); - int index3Mother = RecoDecay::getMother(particlesMc, particleProng3, bHadronMotherHypo, true); + int const index0Mother = RecoDecay::getMother(particlesMc, particleProng0, bHadronMotherHypo, true); + int const index1Mother = RecoDecay::getMother(particlesMc, particleProng1, bHadronMotherHypo, true); + int const index2Mother = RecoDecay::getMother(particlesMc, particleProng2, bHadronMotherHypo, true); + int const index3Mother = RecoDecay::getMother(particlesMc, particleProng3, bHadronMotherHypo, true); // look for common b-hadron ancestor if (index0Mother > -1 && index1Mother > -1 && index2Mother > -1 && index3Mother > -1) { @@ -951,9 +949,9 @@ struct HfDataCreatorCharmHadPiReduced { if (cHadronMotherHypo == Pdg::kDStar) { // to include D* -> D π0/γ and D* -> D0 π depthMax += 1; } - int index0CharmMother = RecoDecay::getMother(particlesMc, particleProng0, cHadronMotherHypo, true, &sign, depthMax); - int index1CharmMother = RecoDecay::getMother(particlesMc, particleProng1, cHadronMotherHypo, true, &sign, depthMax); - int index2CharmMother = RecoDecay::getMother(particlesMc, particleProng2, cHadronMotherHypo, true, &sign, depthMax); + int const index0CharmMother = RecoDecay::getMother(particlesMc, particleProng0, cHadronMotherHypo, true, &sign, depthMax); + int const index1CharmMother = RecoDecay::getMother(particlesMc, particleProng1, cHadronMotherHypo, true, &sign, depthMax); + int const index2CharmMother = RecoDecay::getMother(particlesMc, particleProng2, cHadronMotherHypo, true, &sign, depthMax); if (index0CharmMother > -1 && index1CharmMother > -1 && index2CharmMother > -1) { if (index0CharmMother == index1CharmMother && index1CharmMother == index2CharmMother) { // pdgCodeCharmMother = @@ -974,7 +972,7 @@ struct HfDataCreatorCharmHadPiReduced { tables.rowHfLcPiMcCheckReduced(pdgCodeBeautyMother, pdgCodeCharmMother, pdgCodeProng0, pdgCodeProng1, pdgCodeProng2, pdgCodeProng3); } tables.rowHfLcPiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); - } else if constexpr (decChannel == DecayChannel::B0ToDstarPi) { + } else if constexpr (DecChannel == DecayChannel::B0ToDstarPi) { // B0 → D*+ π- → (D0 π+) π- → (K- π+ π+) π- auto indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kB0, std::array{+kKPlus, -kPiPlus, -kPiPlus, +kPiPlus}, true, &sign, 4); if (indexRec > -1) { @@ -984,9 +982,9 @@ struct HfDataCreatorCharmHadPiReduced { std::vector arrDaughDstarIndex; RecoDecay::getDaughters(particlesMc.rawIteratorAt(indexRec), &arrDaughDstarIndex, std::array{0}, 1); if (arrDaughDstarIndex.size() == NDaughtersDstar) { - bool matchD0{0}; - for (auto iProng = 0u; iProng < arrDaughDstarIndex.size(); ++iProng) { - auto daughI = particlesMc.rawIteratorAt(arrDaughDstarIndex[iProng]); + bool matchD0{false}; + for (const int iProng : arrDaughDstarIndex) { + auto daughI = particlesMc.rawIteratorAt(iProng); if (std::abs(daughI.pdgCode()) == Pdg::kD0) { matchD0 = RecoDecay::isMatchedMCGen(particlesMc, daughI, +Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &signD, 2); } @@ -1014,7 +1012,7 @@ struct HfDataCreatorCharmHadPiReduced { } } - template + template void runDataCreation(Coll const& collision, CCharmCands const& candsC, aod::TrackAssoc const& trackIndices, @@ -1031,7 +1029,7 @@ struct HfDataCreatorCharmHadPiReduced { } // helpers for ReducedTables filling - int indexHfReducedCollision = tables.hfReducedCollision.lastIndex() + 1; + int const indexHfReducedCollision = tables.hfReducedCollision.lastIndex() + 1; // std::map where the key is the track.globalIndex() and // the value is the track index in the table of the selected pions std::map selectedTracksPion; @@ -1045,7 +1043,7 @@ struct HfDataCreatorCharmHadPiReduced { auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; - o2::parameters::GRPMagField* grpo = ccdb->getForTimeStamp(configs.ccdbPathGrpMag, bc.timestamp()); + auto* grpo = ccdb->getForTimeStamp(configs.ccdbPathGrpMag, bc.timestamp()); if (grpo == nullptr) { LOGF(fatal, "Run 3 GRP object (type o2::parameters::GRPMagField) is not available in CCDB for run=%d at timestamp=%llu", bc.runNumber(), bc.timestamp()); } @@ -1061,13 +1059,13 @@ struct HfDataCreatorCharmHadPiReduced { for (const auto& candC : candsC) { int indexHfCandCharm{-1}; float invMassC0{-1.f}, invMassC1{-1.f}; - if constexpr (decChannel == DecayChannel::B0ToDminusPi) { + if constexpr (DecChannel == DecayChannel::B0ToDminusPi) { indexHfCandCharm = tables.hfCand3Prong.lastIndex() + 1; invMassC0 = hfHelper.invMassDplusToPiKPi(candC); registry.fill(HIST("hMassDplus"), invMassC0); registry.fill(HIST("hPtDplus"), candC.pt()); registry.fill(HIST("hCpaDplus"), candC.cpa()); - } else if constexpr (decChannel == DecayChannel::BsToDsminusPi) { + } else if constexpr (DecChannel == DecayChannel::BsToDsminusPi) { indexHfCandCharm = tables.hfCand3Prong.lastIndex() + 1; if (candC.isSelDsToKKPi() >= hfflagConfigurations.selectionFlagDs) { invMassC0 = hfHelper.invMassDsToKKPi(candC); @@ -1079,7 +1077,7 @@ struct HfDataCreatorCharmHadPiReduced { } registry.fill(HIST("hPtDs"), candC.pt()); registry.fill(HIST("hCpaDs"), candC.cpa()); - } else if constexpr (decChannel == DecayChannel::BplusToD0barPi) { + } else if constexpr (DecChannel == DecayChannel::BplusToD0barPi) { indexHfCandCharm = tables.hfCand2Prong.lastIndex() + 1; if (candC.isSelD0() >= hfflagConfigurations.selectionFlagD0) { invMassC0 = hfHelper.invMassD0ToPiK(candC); @@ -1091,7 +1089,7 @@ struct HfDataCreatorCharmHadPiReduced { } registry.fill(HIST("hPtD0"), candC.pt()); registry.fill(HIST("hCpaD0"), candC.cpa()); - } else if constexpr (decChannel == DecayChannel::LbToLcplusPi) { + } else if constexpr (DecChannel == DecayChannel::LbToLcplusPi) { indexHfCandCharm = tables.hfCand3Prong.lastIndex() + 1; if (candC.isSelLcToPKPi() >= hfflagConfigurations.selectionFlagLc) { invMassC0 = hfHelper.invMassLcToPKPi(candC); @@ -1103,7 +1101,7 @@ struct HfDataCreatorCharmHadPiReduced { } registry.fill(HIST("hPtLc"), candC.pt()); registry.fill(HIST("hCpaLc"), candC.cpa()); - } else if constexpr (decChannel == DecayChannel::B0ToDstarPi) { + } else if constexpr (DecChannel == DecayChannel::B0ToDstarPi) { indexHfCandCharm = tables.hfCand2Prong.lastIndex() + 1; if (candC.signSoftPi() > 0) { invMassC0 = candC.invMassDstar() - candC.invMassD0(); @@ -1138,8 +1136,8 @@ struct HfDataCreatorCharmHadPiReduced { } // third track, if it's a 3-prong - if constexpr (decChannel == DecayChannel::B0ToDminusPi || decChannel == DecayChannel::BsToDsminusPi || decChannel == DecayChannel::LbToLcplusPi || decChannel == DecayChannel::B0ToDstarPi) { - if constexpr (decChannel == DecayChannel::B0ToDstarPi) { + if constexpr (DecChannel == DecayChannel::B0ToDminusPi || DecChannel == DecayChannel::BsToDsminusPi || DecChannel == DecayChannel::LbToLcplusPi || DecChannel == DecayChannel::B0ToDstarPi) { + if constexpr (DecChannel == DecayChannel::B0ToDstarPi) { charmHadDauTracks.push_back(candC.template prongPi_as()); // Soft pion from D* decay } else { charmHadDauTracks.push_back(candC.template prong2_as()); @@ -1157,13 +1155,13 @@ struct HfDataCreatorCharmHadPiReduced { // reconstruct charm candidate secondary vertex o2::track::TrackParCov trackParCovCharmHad{}; std::array pVecCharm{}; - if constexpr (decChannel == DecayChannel::B0ToDminusPi || decChannel == DecayChannel::BsToDsminusPi || decChannel == DecayChannel::LbToLcplusPi) { // D∓ → π∓ K± π∓ and Ds∓ → K∓ K± π∓ and Lc∓ → p∓ K± π∓ + if constexpr (DecChannel == DecayChannel::B0ToDminusPi || DecChannel == DecayChannel::BsToDsminusPi || DecChannel == DecayChannel::LbToLcplusPi) { // D∓ → π∓ K± π∓ and Ds∓ → K∓ K± π∓ and Lc∓ → p∓ K± π∓ - if constexpr (decChannel == DecayChannel::B0ToDminusPi) { + if constexpr (DecChannel == DecayChannel::B0ToDminusPi) { hCandidatesDPlus->Fill(SVFitting::BeforeFit); - } else if constexpr (decChannel == DecayChannel::BsToDsminusPi) { + } else if constexpr (DecChannel == DecayChannel::BsToDsminusPi) { hCandidatesDs->Fill(SVFitting::BeforeFit); - } else if constexpr (decChannel == DecayChannel::LbToLcplusPi) { + } else if constexpr (DecChannel == DecayChannel::LbToLcplusPi) { hCandidatesLc->Fill(SVFitting::BeforeFit); } @@ -1173,20 +1171,20 @@ struct HfDataCreatorCharmHadPiReduced { } } catch (const std::runtime_error& error) { LOG(info) << "Run time error found: " << error.what() << ". DCAFitterN cannot work, skipping the candidate."; - if constexpr (decChannel == DecayChannel::B0ToDminusPi) { + if constexpr (DecChannel == DecayChannel::B0ToDminusPi) { hCandidatesDPlus->Fill(SVFitting::Fail); - } else if constexpr (decChannel == DecayChannel::BsToDsminusPi) { + } else if constexpr (DecChannel == DecayChannel::BsToDsminusPi) { hCandidatesDs->Fill(SVFitting::Fail); - } else if constexpr (decChannel == DecayChannel::LbToLcplusPi) { + } else if constexpr (DecChannel == DecayChannel::LbToLcplusPi) { hCandidatesLc->Fill(SVFitting::Fail); } continue; } - if constexpr (decChannel == DecayChannel::B0ToDminusPi) { + if constexpr (DecChannel == DecayChannel::B0ToDminusPi) { hCandidatesDPlus->Fill(SVFitting::FitOk); - } else if constexpr (decChannel == DecayChannel::BsToDsminusPi) { + } else if constexpr (DecChannel == DecayChannel::BsToDsminusPi) { hCandidatesDs->Fill(SVFitting::FitOk); - } else if constexpr (decChannel == DecayChannel::LbToLcplusPi) { + } else if constexpr (DecChannel == DecayChannel::LbToLcplusPi) { hCandidatesLc->Fill(SVFitting::FitOk); } @@ -1200,7 +1198,7 @@ struct HfDataCreatorCharmHadPiReduced { pVecCharm = RecoDecay::pVec(pVec0, pVec1, pVec2); trackParCovCharmHad = df3.createParentTrackParCov(); trackParCovCharmHad.setAbsCharge(charmHadDauTracks[1].sign()); // to be sure - } else if constexpr (decChannel == DecayChannel::BplusToD0barPi) { // D0(bar) → K± π∓ + } else if constexpr (DecChannel == DecayChannel::BplusToD0barPi) { // D0(bar) → K± π∓ hCandidatesD0->Fill(SVFitting::BeforeFit); try { @@ -1222,7 +1220,7 @@ struct HfDataCreatorCharmHadPiReduced { pVecCharm = RecoDecay::pVec(pVec0, pVec1); trackParCovCharmHad = df2.createParentTrackParCov(); trackParCovCharmHad.setAbsCharge(0); // to be sure - } else if constexpr (decChannel == DecayChannel::B0ToDstarPi) { + } else if constexpr (DecChannel == DecayChannel::B0ToDstarPi) { hCandidatesD0FromDstar->Fill(SVFitting::BeforeFit); try { @@ -1279,15 +1277,15 @@ struct HfDataCreatorCharmHadPiReduced { } // reject pi D with same sign as D - if constexpr (decChannel == DecayChannel::B0ToDminusPi || decChannel == DecayChannel::BsToDsminusPi || decChannel == DecayChannel::LbToLcplusPi) { // D∓ → π∓ K± π∓ and Ds∓ → K∓ K± π∓ and Lc∓ → p∓ K± π∓ + if constexpr (DecChannel == DecayChannel::B0ToDminusPi || DecChannel == DecayChannel::BsToDsminusPi || DecChannel == DecayChannel::LbToLcplusPi) { // D∓ → π∓ K± π∓ and Ds∓ → K∓ K± π∓ and Lc∓ → p∓ K± π∓ if (trackPion.sign() * charmHadDauTracks[0].sign() > 0) { continue; } - } else if constexpr (decChannel == DecayChannel::BplusToD0barPi) { // D0(bar) → K± π∓ + } else if constexpr (DecChannel == DecayChannel::BplusToD0barPi) { // D0(bar) → K± π∓ if (!((candC.isSelD0() >= hfflagConfigurations.selectionFlagD0 && trackPion.sign() < 0) || (candC.isSelD0bar() >= hfflagConfigurations.selectionFlagD0bar && trackPion.sign() > 0))) { continue; } - } else if constexpr (decChannel == DecayChannel::B0ToDstarPi) { // D*+ → D0 π+ + } else if constexpr (DecChannel == DecayChannel::B0ToDstarPi) { // D*+ → D0 π+ if (trackPion.sign() * charmHadDauTracks.back().sign() > 0) { continue; } @@ -1328,19 +1326,20 @@ struct HfDataCreatorCharmHadPiReduced { selectedTracksPion[trackPion.globalIndex()] = tables.hfTrackPion.lastIndex(); } - if constexpr (doMc) { + if constexpr (DoMc) { std::vector beautyHadDauTracks{}; + beautyHadDauTracks.reserve(charmHadDauTracks.size()); for (const auto& track : charmHadDauTracks) { beautyHadDauTracks.push_back(track); } beautyHadDauTracks.push_back(trackPion); - fillMcRecoInfo(collision, particlesMc, beautyHadDauTracks, indexHfCandCharm, selectedTracksPion, indexCollisionMaxNumContrib); + fillMcRecoInfo(collision, particlesMc, beautyHadDauTracks, indexHfCandCharm, selectedTracksPion, indexCollisionMaxNumContrib); } fillHfCandCharm = true; } // pion loop if (fillHfCandCharm) { // fill candCplus table only once per D candidate constexpr std::size_t NSizeMLScore{3u}; - if constexpr (decChannel == DecayChannel::B0ToDminusPi || decChannel == DecayChannel::BsToDsminusPi || decChannel == DecayChannel::LbToLcplusPi) { // D∓ → π∓ K± π∓ and Ds∓ → K∓ K± π∓ and Lc∓ → p∓ K± π∓ + if constexpr (DecChannel == DecayChannel::B0ToDminusPi || DecChannel == DecayChannel::BsToDsminusPi || DecChannel == DecayChannel::LbToLcplusPi) { // D∓ → π∓ K± π∓ and Ds∓ → K∓ K± π∓ and Lc∓ → p∓ K± π∓ tables.hfCand3Prong(charmHadDauTracks[0].globalIndex(), charmHadDauTracks[1].globalIndex(), charmHadDauTracks[2].globalIndex(), indexHfReducedCollision, trackParCovCharmHad.getX(), trackParCovCharmHad.getAlpha(), @@ -1356,7 +1355,7 @@ struct HfDataCreatorCharmHadPiReduced { trackParCovCharmHad.getSigma1PtTgl(), trackParCovCharmHad.getSigma1Pt2()); float nSigmaTpcPr0{-999.f}, nSigmaTpcPr1{-999.f}, nSigmaTpcPr2{-999.f}; float nSigmaTofPr0{-999.f}, nSigmaTofPr1{-999.f}, nSigmaTofPr2{-999.f}; - if constexpr (decChannel == DecayChannel::LbToLcplusPi) { + if constexpr (DecChannel == DecayChannel::LbToLcplusPi) { /// assign non-dummy values only for Lb->LcPi analysis nSigmaTpcPr0 = candC.nSigTpcPr0(); nSigmaTpcPr1 = candC.nSigTpcPr1(); @@ -1368,11 +1367,11 @@ struct HfDataCreatorCharmHadPiReduced { tables.hfCandPidProng0(candC.nSigTpcPi0(), candC.nSigTofPi0(), candC.nSigTpcKa0(), candC.nSigTofKa0(), nSigmaTpcPr0, nSigmaTofPr0, charmHadDauTracks[0].hasTOF(), charmHadDauTracks[0].hasTPC()); tables.hfCandPidProng1(candC.nSigTpcPi1(), candC.nSigTofPi1(), candC.nSigTpcKa1(), candC.nSigTofKa1(), nSigmaTpcPr1, nSigmaTofPr1, charmHadDauTracks[1].hasTOF(), charmHadDauTracks[1].hasTPC()); tables.hfCandPidProng2(candC.nSigTpcPi2(), candC.nSigTofPi2(), candC.nSigTpcKa2(), candC.nSigTofKa2(), nSigmaTpcPr2, nSigmaTofPr2, charmHadDauTracks[2].hasTOF(), charmHadDauTracks[2].hasTPC()); - if constexpr (withMl) { + if constexpr (WithMl) { std::array mlScores = {-1.f, -1.f, -1.f, -1.f, -1.f, -1.f}; - if constexpr (decChannel == DecayChannel::B0ToDminusPi) { + if constexpr (DecChannel == DecayChannel::B0ToDminusPi) { tables.hfCand3ProngMl(candC.mlProbDplusToPiKPi()[0], candC.mlProbDplusToPiKPi()[1], candC.mlProbDplusToPiKPi()[2], -1., -1., -1.); - } else if constexpr (decChannel == DecayChannel::BsToDsminusPi) { + } else if constexpr (DecChannel == DecayChannel::BsToDsminusPi) { if (candC.mlProbDsToKKPi().size() == NSizeMLScore) { std::copy(candC.mlProbDsToKKPi().begin(), candC.mlProbDsToKKPi().end(), mlScores.begin()); } @@ -1380,7 +1379,7 @@ struct HfDataCreatorCharmHadPiReduced { std::copy(candC.mlProbDsToPiKK().begin(), candC.mlProbDsToPiKK().end(), mlScores.begin() + 3); } tables.hfCand3ProngMl(mlScores[0], mlScores[1], mlScores[2], mlScores[3], mlScores[4], mlScores[5]); - } else if constexpr (decChannel == DecayChannel::LbToLcplusPi) { + } else if constexpr (DecChannel == DecayChannel::LbToLcplusPi) { if (candC.mlProbLcToPKPi().size() == NSizeMLScore) { std::copy(candC.mlProbLcToPKPi().begin(), candC.mlProbLcToPKPi().end(), mlScores.begin()); } @@ -1390,7 +1389,7 @@ struct HfDataCreatorCharmHadPiReduced { tables.hfCand3ProngMl(mlScores[0], mlScores[1], mlScores[2], mlScores[3], mlScores[4], mlScores[5]); } } - } else if constexpr (decChannel == DecayChannel::BplusToD0barPi) { // D0(bar) → K± π∓ + } else if constexpr (DecChannel == DecayChannel::BplusToD0barPi) { // D0(bar) → K± π∓ tables.hfCand2Prong(charmHadDauTracks[0].globalIndex(), charmHadDauTracks[1].globalIndex(), indexHfReducedCollision, trackParCovCharmHad.getX(), trackParCovCharmHad.getAlpha(), @@ -1406,7 +1405,7 @@ struct HfDataCreatorCharmHadPiReduced { trackParCovCharmHad.getSigma1PtTgl(), trackParCovCharmHad.getSigma1Pt2()); tables.hfCandPidProng0(candC.nSigTpcPi0(), candC.nSigTofPi0(), candC.nSigTpcKa0(), candC.nSigTofKa0(), 0., 0., charmHadDauTracks[0].hasTOF(), charmHadDauTracks[0].hasTPC()); tables.hfCandPidProng1(candC.nSigTpcPi1(), candC.nSigTofPi1(), candC.nSigTpcKa1(), candC.nSigTofKa1(), 0., 0., charmHadDauTracks[1].hasTOF(), charmHadDauTracks[1].hasTPC()); - if constexpr (withMl) { + if constexpr (WithMl) { std::array mlScores = {-1.f, -1.f, -1.f, -1.f, -1.f, -1.f}; if (candC.mlProbD0().size() == NSizeMLScore) { std::copy(candC.mlProbD0().begin(), candC.mlProbD0().end(), mlScores.begin()); @@ -1416,7 +1415,7 @@ struct HfDataCreatorCharmHadPiReduced { } tables.hfCand2ProngMl(mlScores[0], mlScores[1], mlScores[2], mlScores[3], mlScores[4], mlScores[5]); } - } else if constexpr (decChannel == DecayChannel::B0ToDstarPi) { + } else if constexpr (DecChannel == DecayChannel::B0ToDstarPi) { tables.hfCand2Prong(charmHadDauTracks[0].globalIndex(), charmHadDauTracks[1].globalIndex(), indexHfReducedCollision, trackParCovCharmHad.getX(), trackParCovCharmHad.getAlpha(), @@ -1456,7 +1455,7 @@ struct HfDataCreatorCharmHadPiReduced { trackParCovSoftPion.getSigma1PtY(), trackParCovSoftPion.getSigma1PtZ(), trackParCovSoftPion.getSigma1PtSnp(), trackParCovSoftPion.getSigma1PtTgl(), trackParCovSoftPion.getSigma1Pt2()); tables.hfTrackPidSoftPion(candC.nSigTpcPi2(), candC.nSigTofPi2(), charmHadDauTracks[2].hasTOF(), charmHadDauTracks[2].hasTPC()); - if constexpr (withMl) { + if constexpr (WithMl) { std::array mlScores = {-1.f, -1.f, -1.f, -1.f, -1.f, -1.f}; if (candC.mlProbDstarToD0Pi().size() == NSizeMLScore) { std::copy(candC.mlProbDstarToD0Pi().begin(), candC.mlProbDstarToD0Pi().end(), mlScores.begin()); @@ -1483,7 +1482,7 @@ struct HfDataCreatorCharmHadPiReduced { tables.hfReducedCollExtra(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); tables.hfReducedCollCentrality(collision.centFT0C(), collision.centFT0M(), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); - if constexpr (withQvec) { + if constexpr (WithQvec) { tables.hfReducedQvector(collision.qvecFT0CRe(), collision.qvecFT0CIm(), collision.sumAmplFT0C(), collision.qvecFT0ARe(), collision.qvecFT0AIm(), collision.sumAmplFT0A(), collision.qvecFT0MRe(), collision.qvecFT0MIm(), collision.sumAmplFT0M(), @@ -1493,7 +1492,7 @@ struct HfDataCreatorCharmHadPiReduced { } } - template + template void runMcGen(aod::McCollision const& mcCollision, aod::McParticles const& particlesMc, CollisionsWCentAndMcLabels const& collisions, @@ -1525,7 +1524,7 @@ struct HfDataCreatorCharmHadPiReduced { for (const auto& particle : mcParticlesPerMcColl) { int8_t sign{0}; int8_t flag{0}; - if constexpr (decayChannel == DecayChannel::B0ToDminusPi) { + if constexpr (DecayChannel == DecayChannel::B0ToDminusPi) { // B0 → D- π+ if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kB0, std::array{-static_cast(Pdg::kDPlus), +kPiPlus}, true)) { // Match D- -> π- K+ π- @@ -1545,9 +1544,9 @@ struct HfDataCreatorCharmHadPiReduced { auto yParticle = RecoDecay::y(particle.pVector(), massB); auto etaParticle = particle.eta(); - std::array ptProngs; - std::array yProngs; - std::array etaProngs; + std::array ptProngs{}; + std::array yProngs{}; + std::array etaProngs{}; int counter = 0; for (const auto& daught : particle.daughters_as()) { ptProngs[counter] = daught.pt(); @@ -1558,14 +1557,14 @@ struct HfDataCreatorCharmHadPiReduced { tables.rowHfB0McGenReduced(flag, -1 /*channel*/, ptParticle, yParticle, etaParticle, ptProngs[0], yProngs[0], etaProngs[0], ptProngs[1], yProngs[1], etaProngs[1], hfRejMap, centFT0C, centFT0M); - } else if constexpr (decayChannel == DecayChannel::BsToDsminusPi) { + } else if constexpr (DecayChannel == DecayChannel::BsToDsminusPi) { // Bs → Ds- π+ if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kBS, std::array{-static_cast(Pdg::kDS), +kPiPlus}, true)) { // Match Ds- -> π- K+ π- auto candCMC = particlesMc.rawIteratorAt(particle.daughtersIds().front()); if (RecoDecay::isMatchedMCGen(particlesMc, candCMC, -static_cast(Pdg::kDS), std::array{-kKPlus, +kKPlus, -kPiPlus}, true, &sign, 2)) { std::vector arrDaughDsIndex; - std::array arrPDGDaughDs; + std::array arrPDGDaughDs{}; RecoDecay::getDaughters(candCMC, &arrDaughDsIndex, std::array{0}, 1); if (arrDaughDsIndex.size() == NDaughtersDs) { for (auto jProng = 0u; jProng < arrDaughDsIndex.size(); ++jProng) { @@ -1591,7 +1590,7 @@ struct HfDataCreatorCharmHadPiReduced { auto candCMC = particlesMc.rawIteratorAt(particle.daughtersIds().front()); if (RecoDecay::isMatchedMCGen(particlesMc, candCMC, -static_cast(Pdg::kDS), std::array{-kKPlus, +kKPlus, -kPiPlus}, true, &sign, 2)) { std::vector arrDaughDsIndex; - std::array arrPDGDaughDs; + std::array arrPDGDaughDs{}; RecoDecay::getDaughters(candCMC, &arrDaughDsIndex, std::array{0}, 1); if (arrDaughDsIndex.size() == NDaughtersDs) { for (auto jProng = 0u; jProng < arrDaughDsIndex.size(); ++jProng) { @@ -1620,9 +1619,9 @@ struct HfDataCreatorCharmHadPiReduced { auto yParticle = RecoDecay::y(particle.pVector(), massB); auto etaParticle = particle.eta(); - std::array ptProngs; - std::array yProngs; - std::array etaProngs; + std::array ptProngs{}; + std::array yProngs{}; + std::array etaProngs{}; int counter = 0; for (const auto& daught : particle.daughters_as()) { ptProngs[counter] = daught.pt(); @@ -1633,7 +1632,7 @@ struct HfDataCreatorCharmHadPiReduced { tables.rowHfBsMcGenReduced(flag, -1 /*channel*/, ptParticle, yParticle, etaParticle, ptProngs[0], yProngs[0], etaProngs[0], ptProngs[1], yProngs[1], etaProngs[1], hfRejMap, centFT0C, centFT0M); - } else if constexpr (decayChannel == DecayChannel::BplusToD0barPi) { + } else if constexpr (DecayChannel == DecayChannel::BplusToD0barPi) { // B+ → D0bar π+ if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kBPlus, std::array{-static_cast(Pdg::kD0), +kPiPlus}, true)) { // Match D0bar -> π- K+ @@ -1653,9 +1652,9 @@ struct HfDataCreatorCharmHadPiReduced { auto yParticle = RecoDecay::y(particle.pVector(), massB); auto etaParticle = particle.eta(); - std::array ptProngs; - std::array yProngs; - std::array etaProngs; + std::array ptProngs{}; + std::array yProngs{}; + std::array etaProngs{}; int counter = 0; for (const auto& daught : particle.daughters_as()) { ptProngs[counter] = daught.pt(); @@ -1666,7 +1665,7 @@ struct HfDataCreatorCharmHadPiReduced { tables.rowHfBpMcGenReduced(flag, -1 /*channel*/, ptParticle, yParticle, etaParticle, ptProngs[0], yProngs[0], etaProngs[0], ptProngs[1], yProngs[1], etaProngs[1], hfRejMap, centFT0C, centFT0M); - } else if constexpr (decayChannel == DecayChannel::LbToLcplusPi) { + } else if constexpr (DecayChannel == DecayChannel::LbToLcplusPi) { // Lb → Lc+ π- if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kLambdaB0, std::array{static_cast(Pdg::kLambdaCPlus), -kPiPlus}, true)) { // Match Lc+ → p K- π+ @@ -1686,9 +1685,9 @@ struct HfDataCreatorCharmHadPiReduced { auto yParticle = RecoDecay::y(particle.pVector(), massB); auto etaParticle = particle.eta(); - std::array ptProngs; - std::array yProngs; - std::array etaProngs; + std::array ptProngs{}; + std::array yProngs{}; + std::array etaProngs{}; int counter = 0; for (const auto& daught : particle.daughters_as()) { ptProngs[counter] = daught.pt(); @@ -1699,7 +1698,7 @@ struct HfDataCreatorCharmHadPiReduced { tables.rowHfLbMcGenReduced(flag, ptParticle, yParticle, etaParticle, ptProngs[0], yProngs[0], etaProngs[0], ptProngs[1], yProngs[1], etaProngs[1], hfRejMap, centFT0C, centFT0M); - } else if constexpr (decayChannel == DecayChannel::B0ToDstarPi) { + } else if constexpr (DecayChannel == DecayChannel::B0ToDstarPi) { // B0 → D* π+ if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kB0, std::array{-static_cast(Pdg::kDStar), +kPiPlus}, true)) { // Match D- -> π- K+ π- @@ -1719,9 +1718,9 @@ struct HfDataCreatorCharmHadPiReduced { auto yParticle = RecoDecay::y(particle.pVector(), massB); auto etaParticle = particle.eta(); - std::array ptProngs; - std::array yProngs; - std::array etaProngs; + std::array ptProngs{}; + std::array yProngs{}; + std::array etaProngs{}; int counter = 0; for (const auto& daught : particle.daughters_as()) { ptProngs[counter] = daught.pt(); @@ -2312,7 +2311,7 @@ struct HfDataCreatorCharmHadPiReduced { auto candsCThisColl = candsC.sliceBy(preslices.candsDplusPerCollision, thisCollId); auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); auto collsSameMcCollision = collisions.sliceBy(preslices.colPerMcCollision, collision.mcCollisionId()); - int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); + int64_t const indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); } // handle normalization by the right number of collisions @@ -2349,7 +2348,7 @@ struct HfDataCreatorCharmHadPiReduced { auto candsCThisColl = candsC.sliceBy(preslices.candsDplusPerCollisionWithMl, thisCollId); auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); auto collsSameMcCollision = collisions.sliceBy(preslices.colPerMcCollision, collision.mcCollisionId()); - int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); + int64_t const indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); } // handle normalization by the right number of collisions @@ -2387,7 +2386,7 @@ struct HfDataCreatorCharmHadPiReduced { auto candsCThisColl = candsC.sliceBy(preslices.candsDstarPerCollision, thisCollId); auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); auto collsSameMcCollision = collisions.sliceBy(preslices.colPerMcCollision, collision.mcCollisionId()); - int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); + int64_t const indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); } // handle normalization by the right number of collisions @@ -2425,7 +2424,7 @@ struct HfDataCreatorCharmHadPiReduced { auto candsCThisColl = candsC.sliceBy(preslices.candsDstarPerCollisionWithMl, thisCollId); auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); auto collsSameMcCollision = collisions.sliceBy(preslices.colPerMcCollision, collision.mcCollisionId()); - int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); + int64_t const indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); } // handle normalization by the right number of collisions @@ -2462,7 +2461,7 @@ struct HfDataCreatorCharmHadPiReduced { auto candsCThisColl = candsC.sliceBy(preslices.candsDsPerCollision, thisCollId); auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); auto collsSameMcCollision = collisions.sliceBy(preslices.colPerMcCollision, collision.mcCollisionId()); - int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); + int64_t const indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); } // handle normalization by the right number of collisions @@ -2499,7 +2498,7 @@ struct HfDataCreatorCharmHadPiReduced { auto candsCThisColl = candsC.sliceBy(preslices.candsDsPerCollisionWithMl, thisCollId); auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); auto collsSameMcCollision = collisions.sliceBy(preslices.colPerMcCollision, collision.mcCollisionId()); - int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); + int64_t const indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); } // handle normalization by the right number of collisions @@ -2536,7 +2535,7 @@ struct HfDataCreatorCharmHadPiReduced { auto candsCThisColl = candsC.sliceBy(preslices.candsD0PerCollision, thisCollId); auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); auto collsSameMcCollision = collisions.sliceBy(preslices.colPerMcCollision, collision.mcCollisionId()); - int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); + int64_t const indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); } // handle normalization by the right number of collisions @@ -2573,7 +2572,7 @@ struct HfDataCreatorCharmHadPiReduced { auto candsCThisColl = candsC.sliceBy(preslices.candsD0PerCollisionWithMl, thisCollId); auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); auto collsSameMcCollision = collisions.sliceBy(preslices.colPerMcCollision, collision.mcCollisionId()); - int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); + int64_t const indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); } // handle normalization by the right number of collisions @@ -2610,7 +2609,7 @@ struct HfDataCreatorCharmHadPiReduced { auto candsCThisColl = candsC.sliceBy(preslices.candsLcPerCollision, thisCollId); auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); auto collsSameMcCollision = collisions.sliceBy(preslices.colPerMcCollision, collision.mcCollisionId()); - int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); + int64_t const indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); } // handle normalization by the right number of collisions @@ -2647,7 +2646,7 @@ struct HfDataCreatorCharmHadPiReduced { auto candsCThisColl = candsC.sliceBy(preslices.candsLcPerCollisionWithMl, thisCollId); auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); auto collsSameMcCollision = collisions.sliceBy(preslices.colPerMcCollision, collision.mcCollisionId()); - int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); + int64_t const indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); } // handle normalization by the right number of collisions diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx index b5bedc4e8ee..9cb426b3a31 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -103,8 +104,8 @@ enum PairingType : uint8_t { }; enum D0Sel : uint8_t { - selectedD0 = 0, - selectedD0Bar + SelectedD0 = 0, + SelectedD0Bar }; /// Creation of D-V0 pairs @@ -203,7 +204,7 @@ struct HfDataCreatorCharmResoReduced { int runNumber{0}; // needed to detect if the run changed and trigger update of calibrations etc. // material correction for track propagation - o2::base::MatLayerCylSet* lut; + o2::base::MatLayerCylSet* lut{}; o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; // O2DatabasePDG service @@ -228,7 +229,7 @@ struct HfDataCreatorCharmResoReduced { float mK0Short; float mLambda; uint8_t v0Type; - } candidateV0; + } candidateV0{}; struct { float invMassD; @@ -241,7 +242,7 @@ struct HfDataCreatorCharmResoReduced { std::array pVectorProng0; std::array pVectorProng1; std::array pVectorProng2; - } varUtils; + } varUtils{}; // Dplus using CandsDplusFiltered = soa::Filtered>; @@ -350,7 +351,7 @@ struct HfDataCreatorCharmResoReduced { doprocessDstarV0MC || doprocessDstarTrackMC || doprocessDstarV0AndTrackMC || doprocessDstarV0MCWithMl || doprocessDstarTrackMCWithMl || doprocessDstarV0AndTrackMCWithMl || doprocessDplusV0MC || doprocessDplusTrackMC || doprocessDplusV0AndTrackMC || doprocessDplusV0MCWithMl || doprocessDplusTrackMCWithMl || doprocessDplusV0AndTrackMCWithMl) { // MC Rec - int nChannels = hf_decay::hf_cand_reso::DecayChannelMain::NChannelsMain; + int const nChannels = hf_decay::hf_cand_reso::DecayChannelMain::NChannelsMain; registry.add("hMCRecCounter", "Number of Reconstructed MC Matched candidates per channel", {HistType::kTH1D, {{2 * nChannels + 1, -(nChannels + 0.5), nChannels + 0.5}}}); registry.add("hMCRecDebug", "Debug of MC Reco", {HistType::kTH1D, {{551, -0.5, 550.5}}}); registry.add("hMCRecOrigin", "Origin of Matched particles", {HistType::kTH1D, {{3, -0.5, 2.5}}}); @@ -385,7 +386,7 @@ struct HfDataCreatorCharmResoReduced { const auto& workflows = initContext.services().get(); for (const DeviceSpec& device : workflows.devices) { - if (device.name.compare("hf-data-creator-charm-reso-reduced") == 0) { + if (device.name == "hf-data-creator-charm-reso-reduced") { // init HF event selection helper hfEvSelMc.init(device, registry); break; @@ -425,15 +426,15 @@ struct HfDataCreatorCharmResoReduced { // Utility to find which v0 daughter carries the largest fraction of the mother longitudinal momentum float alphaAP(std::array const& momA, std::array const& momB, std::array const& momC) { - float momTot = std::sqrt(std::pow(momA[0], 2.) + std::pow(momA[1], 2.) + std::pow(momA[2], 2.)); - float lQlPos = (momB[0] * momA[0] + momB[1] * momA[1] + momB[2] * momA[2]) / momTot; - float lQlNeg = (momC[0] * momA[0] + momC[1] * momA[1] + momC[2] * momA[2]) / momTot; + float const momTot = std::sqrt(std::pow(momA[0], 2.) + std::pow(momA[1], 2.) + std::pow(momA[2], 2.)); + float const lQlPos = (momB[0] * momA[0] + momB[1] * momA[1] + momB[2] * momA[2]) / momTot; + float const lQlNeg = (momC[0] * momA[0] + momC[1] * momA[1] + momC[2] * momA[2]) / momTot; return (lQlPos - lQlNeg) / (lQlPos + lQlNeg); } // Utility to find DCA of V0 to Primary vertex - float calculateDCAStraightToPV(float X, float Y, float Z, float Px, float Py, float Pz, float pvX, float pvY, float pvZ) + float calculateDCAStraightToPV(float x, float y, float z, float px, float py, float pz, float pvX, float pvY, float pvZ) { - return std::sqrt((std::pow((pvY - Y) * Pz - (pvZ - Z) * Py, 2) + std::pow((pvX - X) * Pz - (pvZ - Z) * Px, 2) + std::pow((pvX - X) * Py - (pvY - Y) * Px, 2)) / (Px * Px + Py * Py + Pz * Pz)); + return std::sqrt((std::pow((pvY - y) * pz - (pvZ - z) * py, 2) + std::pow((pvX - x) * pz - (pvZ - z) * px, 2) + std::pow((pvX - x) * py - (pvY - y) * px, 2)) / (px * px + py * py + pz * pz)); } /// Basic selection of V0 candidates /// \param collision is the current collision @@ -443,13 +444,14 @@ struct HfDataCreatorCharmResoReduced { template bool buildAndSelectV0(const Coll& collision, const std::array& dDaughtersIds, const std::array& dauTracks) { - auto trackPos = dauTracks[0]; - auto trackNeg = dauTracks[1]; + const auto& trackPos = dauTracks[0]; + const auto& trackNeg = dauTracks[1]; // single-tracks selection - if (!selectV0Daughter(trackPos, dDaughtersIds) || !selectV0Daughter(trackNeg, dDaughtersIds)) + if (!selectV0Daughter(trackPos, dDaughtersIds) || !selectV0Daughter(trackNeg, dDaughtersIds)) { return false; + } // daughters DCA to V0's collision primary vertex - std::array dcaInfo; + std::array dcaInfo{}; auto trackPosPar = getTrackPar(trackPos); o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackPosPar, 2.f, fitter.getMatCorrType(), &dcaInfo); auto trackPosDcaXY = dcaInfo[0]; @@ -510,7 +512,7 @@ struct HfDataCreatorCharmResoReduced { return false; } // v0 cosine of pointing angle - std::array primVtx = {collision.posX(), collision.posY(), collision.posZ()}; + std::array const primVtx = {collision.posX(), collision.posY(), collision.posZ()}; candidateV0.cosPA = RecoDecay::cpa(primVtx, vtx, candidateV0.mom); if (candidateV0.cosPA < cfgV0Cuts.cosPa) { return false; @@ -519,7 +521,7 @@ struct HfDataCreatorCharmResoReduced { candidateV0.v0Type = {BIT(BachelorType::K0s) | BIT(BachelorType::Lambda) | BIT(BachelorType::AntiLambda)}; // for lambda hypotesys define if its lambda or anti-lambda candidateV0.alpha = alphaAP(candidateV0.mom, candidateV0.momPos, candidateV0.momNeg); - bool matter = candidateV0.alpha > 0; + bool const matter = candidateV0.alpha > 0; CLRBIT(candidateV0.v0Type, matter ? BachelorType::AntiLambda : BachelorType::Lambda); auto massPos = matter ? o2::constants::physics::MassProton : o2::constants::physics::MassPionCharged; auto massNeg = matter ? o2::constants::physics::MassPionCharged : o2::constants::physics::MassProton; @@ -536,20 +538,23 @@ struct HfDataCreatorCharmResoReduced { // PID if (TESTBIT(candidateV0.v0Type, BachelorType::K0s)) { if ((trackPos.hasTPC() && std::fabs(trackPos.tpcNSigmaPi()) > cfgV0Cuts.nSigmaTpc) || - (trackNeg.hasTPC() && std::fabs(trackNeg.tpcNSigmaPi()) > cfgV0Cuts.nSigmaTpc)) + (trackNeg.hasTPC() && std::fabs(trackNeg.tpcNSigmaPi()) > cfgV0Cuts.nSigmaTpc)) { CLRBIT(candidateV0.v0Type, BachelorType::K0s); + } } if (TESTBIT(candidateV0.v0Type, BachelorType::Lambda)) { if ((trackPos.hasTPC() && std::fabs(trackPos.tpcNSigmaPr()) > cfgV0Cuts.nSigmaTpc) || (trackPos.hasTOF() && std::fabs(trackPos.tofNSigmaPr()) > cfgV0Cuts.nSigmaTofPr) || - (trackNeg.hasTPC() && std::fabs(trackNeg.tpcNSigmaPi()) > cfgV0Cuts.nSigmaTpc)) + (trackNeg.hasTPC() && std::fabs(trackNeg.tpcNSigmaPi()) > cfgV0Cuts.nSigmaTpc)) { CLRBIT(candidateV0.v0Type, BachelorType::Lambda); + } } if (TESTBIT(candidateV0.v0Type, BachelorType::AntiLambda)) { if ((trackPos.hasTPC() && std::fabs(trackPos.tpcNSigmaPi()) > cfgV0Cuts.nSigmaTpc) || (trackNeg.hasTPC() && std::fabs(trackNeg.tpcNSigmaPr()) > cfgV0Cuts.nSigmaTpc) || - (trackNeg.hasTOF() && std::fabs(trackNeg.tofNSigmaPr()) > cfgV0Cuts.nSigmaTofPr)) + (trackNeg.hasTOF() && std::fabs(trackNeg.tofNSigmaPr()) > cfgV0Cuts.nSigmaTofPr)) { CLRBIT(candidateV0.v0Type, BachelorType::AntiLambda); + } } if (candidateV0.v0Type == 0) { return false; @@ -593,13 +598,10 @@ struct HfDataCreatorCharmResoReduced { if (!track.hasTPC()) { return false; } - bool isPion = std::abs(track.tpcNSigmaPi()) < cfgSingleTrackCuts.maxNsigmaTpcPi; - bool isKaon = std::abs(track.tpcNSigmaKa()) < cfgSingleTrackCuts.maxNsigmaTpcKa; - bool isProton = std::abs(track.tpcNSigmaPr()) < cfgSingleTrackCuts.maxNsigmaTpcPr; - if (!isPion && !isKaon && !isProton) { // we keep the track if is it compatible with at least one of the PID hypotheses selected - return false; - } - return true; + bool const isPion = std::abs(track.tpcNSigmaPi()) < cfgSingleTrackCuts.maxNsigmaTpcPi; + bool const isKaon = std::abs(track.tpcNSigmaKa()) < cfgSingleTrackCuts.maxNsigmaTpcKa; + bool const isProton = std::abs(track.tpcNSigmaPr()) < cfgSingleTrackCuts.maxNsigmaTpcPr; + return (isPion || isKaon || isProton); // we keep the track if is it compatible with at least one of the PID hypotheses selected } template @@ -639,7 +641,7 @@ struct HfDataCreatorCharmResoReduced { /// \param tracks is the table with tracks /// \param indexHfCandCharm is the index of the charm-hadron bachelor in the reduced table /// \param indexCandV0TrBach is the index of the v0 bachelor in the reduced table - template + template void fillMcRecoInfoDV0(PParticles const& particlesMc, CCand const& candCharmBach, BBachV0 const& bachelorV0, @@ -651,7 +653,7 @@ struct HfDataCreatorCharmResoReduced { int8_t sign{0}, nKinkedTracks{0}, origin{0}, flagCharmBach{0}, flagCharmBachInterm{0}, flagV0{0}, flagReso{0}; int indexRec{-1}, debugMcRec{0}; float ptGen{-1.f}, invMassGen{-1.f}; - if constexpr (dType == DType::Dstar) { + if constexpr (DType == DType::Dstar) { vecDaughtersReso.push_back(tracks.rawIteratorAt(candCharmBach.prong0Id())); vecDaughtersReso.push_back(tracks.rawIteratorAt(candCharmBach.prong1Id())); vecDaughtersReso.push_back(tracks.rawIteratorAt(candCharmBach.prongPiId())); @@ -675,7 +677,7 @@ struct HfDataCreatorCharmResoReduced { } // If both D* and K0s are matched, try to match resonance if (flagCharmBach != 0 && flagV0 == hf_decay::hf_cand_reso::PartialMatchMc::K0Matched) { - std::array pdgCodesDaughters = {+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}; + std::array const pdgCodesDaughters = {+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}; auto arrDaughtersReso = std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2], vecDaughtersReso[3], vecDaughtersReso[4]}; for (const auto& [decayChannelFlag, pdgCodeReso] : hf_decay::hf_cand_reso::particlesToDstarK0s) { indexRec = RecoDecay::getMatchedMCRec(particlesMc, arrDaughtersReso, pdgCodeReso, pdgCodesDaughters, true, &sign, 3, &nKinkedTracks); @@ -685,7 +687,7 @@ struct HfDataCreatorCharmResoReduced { } } } else if (flagCharmBachInterm != 0 && flagV0 == hf_decay::hf_cand_reso::PartialMatchMc::K0Matched) { - std::array pdgCodesDaughters = {+kPiPlus, -kKPlus, +kPiPlus, -kPiPlus}; + std::array const pdgCodesDaughters = {+kPiPlus, -kKPlus, +kPiPlus, -kPiPlus}; auto arrDaughtersReso = std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[3], vecDaughtersReso[4]}; // Peaking background of D0K0s <- Ds* with spurious soft pion for (const auto& [decayChannelFlag, pdgCodeReso] : hf_decay::hf_cand_reso::particlesToDstarK0s) { @@ -708,7 +710,7 @@ struct HfDataCreatorCharmResoReduced { flagCharmBachInterm, debugMcRec, origin, ptGen, invMassGen, nKinkedTracks); - } else if constexpr (dType == DType::Dplus) { + } else if constexpr (DType == DType::Dplus) { vecDaughtersReso.push_back(tracks.rawIteratorAt(candCharmBach.prong0Id())); vecDaughtersReso.push_back(tracks.rawIteratorAt(candCharmBach.prong1Id())); vecDaughtersReso.push_back(tracks.rawIteratorAt(candCharmBach.prong2Id())); @@ -761,7 +763,7 @@ struct HfDataCreatorCharmResoReduced { flagCharmBachInterm, debugMcRec, origin, ptGen, invMassGen, nKinkedTracks); - } else if constexpr (dType == DType::D0) { + } else if constexpr (DType == DType::D0) { vecDaughtersReso.push_back(tracks.rawIteratorAt(candCharmBach.prong0Id())); vecDaughtersReso.push_back(tracks.rawIteratorAt(candCharmBach.prong1Id())); // Check if D0 is matched @@ -821,9 +823,11 @@ struct HfDataCreatorCharmResoReduced { auto pdgCode = std::abs(particle.pdgCode()); if (pdgCode == kPiPlus) { return hf_decay::hf_cand_reso::PartialMatchMc::PionMatched; - } else if (pdgCode == kKPlus) { + } + if (pdgCode == kKPlus) { return hf_decay::hf_cand_reso::PartialMatchMc::KaonMatched; - } else if (pdgCode == kProton) { + } + if (pdgCode == kProton) { return hf_decay::hf_cand_reso::PartialMatchMc::ProtonMatched; } return 0; @@ -836,7 +840,7 @@ struct HfDataCreatorCharmResoReduced { /// \param tracks is the table with tracks /// \param indexHfCandCharm is the index of the charm-hadron bachelor in the reduced table /// \param indexCandTrBach is the index of the v0 bachelor in the reduced table - template + template void fillMcRecoInfoDTrack(PParticles const& particlesMc, CCand const& candCharmBach, BBachTr const& bachelorTrack, @@ -849,7 +853,7 @@ struct HfDataCreatorCharmResoReduced { int indexRec{-1}; uint16_t debugMcRec{0}; float ptGen{-1.f}, invMassGen{-1.f}; - if constexpr (dType == DType::Dstar) { + if constexpr (DType == DType::Dstar) { vecDaughtersReso.push_back(tracks.rawIteratorAt(candCharmBach.prong0Id())); vecDaughtersReso.push_back(tracks.rawIteratorAt(candCharmBach.prong1Id())); vecDaughtersReso.push_back(tracks.rawIteratorAt(candCharmBach.prongPiId())); @@ -892,7 +896,7 @@ struct HfDataCreatorCharmResoReduced { flagCharmBachInterm, debugMcRec, origin, ptGen, invMassGen, nKinkedTracks); - } else if constexpr (dType == DType::Dplus) { + } else if constexpr (DType == DType::Dplus) { vecDaughtersReso.push_back(tracks.rawIteratorAt(candCharmBach.prong0Id())); vecDaughtersReso.push_back(tracks.rawIteratorAt(candCharmBach.prong1Id())); vecDaughtersReso.push_back(tracks.rawIteratorAt(candCharmBach.prong2Id())); @@ -932,7 +936,7 @@ struct HfDataCreatorCharmResoReduced { flagCharmBachInterm, debugMcRec, origin, ptGen, invMassGen, nKinkedTracks); - } else if constexpr (dType == DType::D0) { + } else if constexpr (DType == DType::D0) { vecDaughtersReso.push_back(tracks.rawIteratorAt(candCharmBach.prong0Id())); vecDaughtersReso.push_back(tracks.rawIteratorAt(candCharmBach.prong1Id())); // Check if D0 is matched @@ -991,7 +995,7 @@ struct HfDataCreatorCharmResoReduced { } } // fillMcRecoInfoDTrack - template + template void runDataCreation(Coll const& collision, CCands const& candsD, BBachV0s const& bachelorV0s, @@ -1007,14 +1011,14 @@ struct HfDataCreatorCharmResoReduced { if (rejectCollisionsWithBadEvSel && hfRejMap != 0) { return; } - int indexHfReducedCollision = hfReducedCollision.lastIndex() + 1; + int const indexHfReducedCollision = hfReducedCollision.lastIndex() + 1; // std::map where the key is the V0.globalIndex() and // the value is the V0 index in the table of the selected v0s std::map selectedV0s; std::map selectedTracks; bool fillHfReducedCollision = false; - constexpr bool DoTracks = pairingType == PairingType::TrackOnly || pairingType == PairingType::V0AndTrack; - constexpr bool DoV0s = pairingType == PairingType::V0Only || pairingType == PairingType::V0AndTrack; + constexpr bool DoTracks = PairingType == PairingType::TrackOnly || PairingType == PairingType::V0AndTrack; + constexpr bool DoV0s = PairingType == PairingType::V0Only || PairingType == PairingType::V0AndTrack; auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; @@ -1027,12 +1031,12 @@ struct HfDataCreatorCharmResoReduced { for (const auto& candD : candsD) { // initialize variables depending on D meson type bool fillHfCandD = false; - std::array secondaryVertexD; - std::array prongIdsD; + std::array secondaryVertexD{}; + std::array prongIdsD{}; std::array bdtScores = {-1.f, -1.f, -1.f, -1.f, -1.f, -1.f}; std::vector> charmHadDauTracks{}; varUtils.ptD = candD.pt(); - if constexpr (dType == DType::Dstar) { + if constexpr (DType == DType::Dstar) { varUtils.signD = candD.signSoftPi(); if (varUtils.signD > 0) { varUtils.invMassD = candD.invMassDstar(); @@ -1052,11 +1056,11 @@ struct HfDataCreatorCharmResoReduced { varUtils.pVectorProng2 = candD.pVecSoftPi(); charmHadDauTracks.push_back(tracksIU.rawIteratorAt(candD.prong0Id())); charmHadDauTracks.push_back(tracksIU.rawIteratorAt(candD.prong1Id())); - if constexpr (withMl) { + if constexpr (WithMl) { std::copy(candD.mlProbDstarToD0Pi().begin(), candD.mlProbDstarToD0Pi().end(), bdtScores.begin()); } registry.fill(HIST("hMassVsPtDstarAll"), varUtils.ptD, varUtils.invMassD - varUtils.invMassD0); - } else if constexpr (dType == DType::Dplus) { + } else if constexpr (DType == DType::Dplus) { auto prong0 = tracksIU.rawIteratorAt(candD.prong0Id()); varUtils.invMassD = hfHelper.invMassDplusToPiKPi(candD); secondaryVertexD[0] = candD.xSecondaryVertex(); @@ -1072,11 +1076,11 @@ struct HfDataCreatorCharmResoReduced { charmHadDauTracks.push_back(tracksIU.rawIteratorAt(candD.prong0Id())); charmHadDauTracks.push_back(tracksIU.rawIteratorAt(candD.prong1Id())); charmHadDauTracks.push_back(tracksIU.rawIteratorAt(candD.prong2Id())); - if constexpr (withMl) { + if constexpr (WithMl) { std::copy(candD.mlProbDplusToPiKPi().begin(), candD.mlProbDplusToPiKPi().end(), bdtScores.begin()); } registry.fill(HIST("hMassVsPtDplusAll"), varUtils.ptD, varUtils.invMassD); - } else if constexpr (dType == DType::D0) { + } else if constexpr (DType == DType::D0) { varUtils.invMassD0 = hfHelper.invMassD0ToPiK(candD); varUtils.invMassD0Bar = hfHelper.invMassD0barToKPi(candD); secondaryVertexD[0] = candD.xSecondaryVertex(); @@ -1090,7 +1094,7 @@ struct HfDataCreatorCharmResoReduced { varUtils.pVectorProng0 = candD.pVectorProng0(); varUtils.pVectorProng1 = candD.pVectorProng1(); varUtils.pVectorProng2 = {0.f, 0.f, 0.f}; // D0 does not have a third prong - if constexpr (withMl) { + if constexpr (WithMl) { std::copy(candD.mlProbD0().begin(), candD.mlProbD0().end(), bdtScores.begin()); std::copy(candD.mlProbD0bar().begin(), candD.mlProbD0bar().end(), bdtScores.begin() + 3); } @@ -1118,7 +1122,7 @@ struct HfDataCreatorCharmResoReduced { chi2TpcDauMax = charmHadTrack.tpcChi2NCl(); } } - if constexpr (dType == DType::Dstar) { + if constexpr (DType == DType::Dstar) { auto softPi = tracksIU.rawIteratorAt(candD.prongPiId()); nItsClsSoftPi = softPi.itsNCls(); nTpcCrossRowsSoftPi = softPi.tpcNClsCrossedRows(); @@ -1151,8 +1155,8 @@ struct HfDataCreatorCharmResoReduced { } // propagate V0 to primary vertex (if enabled) if (propagateV0toPV) { - std::array pVecV0Orig = {candidateV0.mom[0], candidateV0.mom[1], candidateV0.mom[2]}; - std::array dcaInfo; + std::array const pVecV0Orig = {candidateV0.mom[0], candidateV0.mom[1], candidateV0.mom[2]}; + std::array dcaInfo{}; auto trackParK0 = o2::track::TrackPar(candidateV0.pos, pVecV0Orig, 0, true); trackParK0.setPID(o2::track::PID::K0); trackParK0.setAbsCharge(0); @@ -1162,7 +1166,7 @@ struct HfDataCreatorCharmResoReduced { // compute resonance invariant mass and filling of QA histograms if (TESTBIT(candidateV0.v0Type, BachelorType::K0s)) { registry.fill(HIST("hMassVsPtK0s"), candidateV0.pT, candidateV0.mK0Short); - switch (dType) { + switch (DType) { case DType::Dstar: varUtils.ptReso = RecoDecay::pt(RecoDecay::sumOfVec(varUtils.pVectorProng0, varUtils.pVectorProng1, varUtils.pVectorProng2, candidateV0.mom)); if (varUtils.signD > 0) { @@ -1193,11 +1197,11 @@ struct HfDataCreatorCharmResoReduced { break; // no other D meson types expected } // end of dType switch } // matched with K0s - bool isLambda = TESTBIT(candidateV0.v0Type, BachelorType::Lambda); - bool isAntiLambda = TESTBIT(candidateV0.v0Type, BachelorType::AntiLambda); + bool const isLambda = TESTBIT(candidateV0.v0Type, BachelorType::Lambda); + bool const isAntiLambda = TESTBIT(candidateV0.v0Type, BachelorType::AntiLambda); if (isLambda || isAntiLambda) { registry.fill(HIST("hMassVsPtLambda"), candidateV0.pT, candidateV0.mLambda); - switch (dType) { + switch (DType) { case DType::Dstar: varUtils.ptReso = RecoDecay::pt(RecoDecay::sumOfVec(varUtils.pVectorProng0, varUtils.pVectorProng1, varUtils.pVectorProng2, candidateV0.mom)); if (varUtils.signD > 0) { @@ -1263,15 +1267,16 @@ struct HfDataCreatorCharmResoReduced { } fillHfCandD = true; // Optional filling of MC Rec table, for now only implemented for Ds1->D*K0s and Ds2*->D+K0s - if constexpr (doMc) { + if constexpr (DoMc) { int indexHfCandCharm{-1}; - if constexpr (dType == DType::Dstar) + if constexpr (DType == DType::Dstar) { indexHfCandCharm = hfCandDstar.lastIndex() + 1; - else if constexpr (dType == DType::Dplus) + } else if constexpr (DType == DType::Dplus) { indexHfCandCharm = hfCandD3Pr.lastIndex() + 1; - else if constexpr (dType == DType::D0) + } else if constexpr (DType == DType::D0) { indexHfCandCharm = hfCandD2Pr.lastIndex() + 1; - fillMcRecoInfoDV0(particlesMc, candD, v0, tracksIU, indexHfCandCharm, selectedV0s[v0.globalIndex()]); + } + fillMcRecoInfoDV0(particlesMc, candD, v0, tracksIU, indexHfCandCharm, selectedV0s[v0.globalIndex()]); } } // end of loop on V0 candidates } // end of do V0s @@ -1292,7 +1297,7 @@ struct HfDataCreatorCharmResoReduced { } registry.fill(HIST("hdEdxVsP"), track.p(), track.tpcSignal()); // compute invariant mass and filling of QA histograms - switch (dType) { + switch (DType) { case DType::Dstar: // D* pi if (std::abs(track.tpcNSigmaPi()) < cfgSingleTrackCuts.maxNsigmaTpcPi) { @@ -1462,21 +1467,22 @@ struct HfDataCreatorCharmResoReduced { selectedTracks[track.globalIndex()] = hfTrackNoParam.lastIndex(); } fillHfCandD = true; - if constexpr (doMc) { + if constexpr (DoMc) { int indexHfCandCharm{-1}; - if constexpr (dType == DType::Dstar) + if constexpr (DType == DType::Dstar) { indexHfCandCharm = hfCandDstar.lastIndex() + 1; - else if constexpr (dType == DType::Dplus) + } else if constexpr (DType == DType::Dplus) { indexHfCandCharm = hfCandD3Pr.lastIndex() + 1; - else if constexpr (dType == DType::D0) + } else if constexpr (DType == DType::D0) { indexHfCandCharm = hfCandD2Pr.lastIndex() + 1; - fillMcRecoInfoDTrack(particlesMc, candD, track, tracks, indexHfCandCharm, selectedTracks[track.globalIndex()]); + } + fillMcRecoInfoDTrack(particlesMc, candD, track, tracks, indexHfCandCharm, selectedTracks[track.globalIndex()]); } } // end of loop on bachelor tracks } // end of do tracks // fill D candidate table if (fillHfCandD) { // fill candDplus table only once per D candidate, only if at least one V0 is found - if constexpr (dType == DType::Dplus) { + if constexpr (DType == DType::Dplus) { hfCandD3Pr(prongIdsD[0], prongIdsD[1], prongIdsD[2], indexHfReducedCollision, secondaryVertexD[0], secondaryVertexD[1], secondaryVertexD[2], @@ -1484,16 +1490,16 @@ struct HfDataCreatorCharmResoReduced { candD.pxProng1(), candD.pyProng1(), candD.pzProng1(), varUtils.pVectorProng2[0], varUtils.pVectorProng2[1], varUtils.pVectorProng2[2], nItsClsDauMin, nTpcCrossRowsDauMin, chi2TpcDauMax, varUtils.signD); - if constexpr (withMl) { + if constexpr (WithMl) { hfCandD3PrMl(bdtScores[0], bdtScores[1], bdtScores[2], bdtScores[3], bdtScores[4], bdtScores[5]); } - } else if constexpr (dType == DType::D0) { - uint8_t selFlagD0 = {BIT(D0Sel::selectedD0) | BIT(D0Sel::selectedD0Bar)}; + } else if constexpr (DType == DType::D0) { + uint8_t selFlagD0 = {BIT(D0Sel::SelectedD0) | BIT(D0Sel::SelectedD0Bar)}; if (candD.isSelD0() < cfgDmesCuts.selectionFlagD0) { - CLRBIT(selFlagD0, D0Sel::selectedD0); + CLRBIT(selFlagD0, D0Sel::SelectedD0); } if (candD.isSelD0bar() < cfgDmesCuts.selectionFlagD0Bar) { - CLRBIT(selFlagD0, D0Sel::selectedD0Bar); + CLRBIT(selFlagD0, D0Sel::SelectedD0Bar); } hfCandD2Pr(prongIdsD[0], prongIdsD[1], indexHfReducedCollision, @@ -1502,10 +1508,10 @@ struct HfDataCreatorCharmResoReduced { candD.pxProng1(), candD.pyProng1(), candD.pzProng1(), nItsClsDauMin, nTpcCrossRowsDauMin, chi2TpcDauMax, selFlagD0); - if constexpr (withMl) { + if constexpr (WithMl) { hfCandD2PrMl(bdtScores[0], bdtScores[1], bdtScores[2], bdtScores[3], bdtScores[4], bdtScores[5]); } - } else if constexpr (dType == DType::Dstar) { + } else if constexpr (DType == DType::Dstar) { hfCandDstar(prongIdsD[0], prongIdsD[1], prongIdsD[2], indexHfReducedCollision, secondaryVertexD[0], secondaryVertexD[1], secondaryVertexD[2], @@ -1515,16 +1521,16 @@ struct HfDataCreatorCharmResoReduced { nItsClsDauMin, nTpcCrossRowsDauMin, chi2TpcDauMax, nItsClsSoftPi, nTpcCrossRowsSoftPi, chi2TpcSoftPi, varUtils.signD); - if constexpr (withMl) { + if constexpr (WithMl) { hfCandD3PrMl(bdtScores[0], bdtScores[1], bdtScores[2], bdtScores[3], bdtScores[4], bdtScores[5]); } } fillHfReducedCollision = true; - if constexpr (dType == DType::Dstar) { + if constexpr (DType == DType::Dstar) { registry.fill(HIST("hMassVsPtDstarPaired"), candD.pt(), varUtils.invMassD - varUtils.invMassD0); - } else if constexpr (dType == DType::Dplus) { + } else if constexpr (DType == DType::Dplus) { registry.fill(HIST("hMassVsPtDplusPaired"), candD.pt(), varUtils.invMassD); - } else if constexpr (dType == DType::D0) { + } else if constexpr (DType == DType::D0) { if (candD.isSelD0() >= cfgDmesCuts.selectionFlagD0) { registry.fill(HIST("hMassVsPtD0Paired"), varUtils.ptD, varUtils.invMassD0); } @@ -1544,21 +1550,21 @@ struct HfDataCreatorCharmResoReduced { hfReducedCollision(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), hfRejMap, bz); } // end of runDataCreation function - template + template void runMcGen(McParticles const& mcParticles, CCs const& collInfos, McCollisions const& mcCollisions, BCsInfo const&) { - bool doV0s = (pairingType == PairingType::V0Only || pairingType == PairingType::V0AndTrack); - bool doTracks = (pairingType == PairingType::TrackOnly || pairingType == PairingType::V0AndTrack); + bool const doV0s = (PairingType == PairingType::V0Only || PairingType == PairingType::V0AndTrack); + bool const doTracks = (PairingType == PairingType::TrackOnly || PairingType == PairingType::V0AndTrack); for (const auto& mcCollision : mcCollisions) { // Slice the particles table to get the particles for the current MC collision const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex()); // Slice the collisions table to get the collision info for the current MC collision float centrality{-1.f}; o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; - int nSplitColl = 0; + int const nSplitColl = 0; const auto collSlice = collInfos.sliceBy(colPerMcCollision, mcCollision.globalIndex()); rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); hfEvSelMc.fillHistograms(mcCollision, rejectionMask, nSplitColl); @@ -1574,7 +1580,7 @@ struct HfDataCreatorCharmResoReduced { int8_t origin{0}; bool matchedReso{false}, matchedD{false}, matchedV0Tr{false}; std::vector idxBhadMothers{}; - if constexpr (dType == DType::Dstar) { + if constexpr (DType == DType::Dstar) { if (doV0s) { // D* K0s for (const auto& [decayChannelFlag, pdgCodeReso] : hf_decay::hf_cand_reso::particlesToDstarK0s) { @@ -1606,7 +1612,7 @@ struct HfDataCreatorCharmResoReduced { matchedD = RecoDecay::isMatchedMCGen(mcParticlesPerMcColl, candD0MC, Pdg::kD0, std::array{-kKPlus, +kPiPlus}, true, &signD, 2); } } - } else if constexpr (dType == DType::Dplus) { + } else if constexpr (DType == DType::Dplus) { if (doV0s) { // D+ K0s for (const auto& [decayChannelFlag, pdgCodeReso] : hf_decay::hf_cand_reso::particlesToDplusK0s) { @@ -1646,7 +1652,7 @@ struct HfDataCreatorCharmResoReduced { auto candDplusMC = mcParticles.rawIteratorAt(particle.daughtersIds().front()); matchedD = RecoDecay::isMatchedMCGen(mcParticlesPerMcColl, candDplusMC, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &signD, 2); } - } else if constexpr (dType == DType::D0) { + } else if constexpr (DType == DType::D0) { if (doV0s) { // D0 Lambda for (const auto& [decayChannelFlag, pdgCodeReso] : hf_decay::hf_cand_reso::particlesToD0Lambda) { @@ -1694,9 +1700,9 @@ struct HfDataCreatorCharmResoReduced { auto yParticle = RecoDecay::y(particle.pVector(), invMassGen); auto etaParticle = particle.eta(); - std::array ptProngs; - std::array yProngs; - std::array etaProngs; + std::array ptProngs{}; + std::array yProngs{}; + std::array etaProngs{}; int counter = 0; for (const auto& daught : particle.template daughters_as()) { ptProngs[counter] = daught.pt(); diff --git a/PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx index 41ee2790334..4778fcc168e 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx @@ -207,9 +207,9 @@ struct HfDataCreatorJpsiHadReduced { PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; o2::base::Propagator::MatCorrType noMatCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; - int runNumber; + int runNumber{}; double bz{0.}; - double invMass2JpsiHadMin, invMass2JpsiHadMax; + double invMass2JpsiHadMin{}, invMass2JpsiHadMax{}; bool isHfCandBhadConfigFilled = false; o2::hf_evsel::HfEventSelection hfEvSel; @@ -339,7 +339,7 @@ struct HfDataCreatorJpsiHadReduced { if (doprocessJpsiKMc || doprocessJpsiPhiMc) { const auto& workflows = initContext.services().get(); for (const DeviceSpec& device : workflows.devices) { - if (device.name.compare("hf-data-creator-jpsi-had-reduced") == 0) { + if (device.name == "hf-data-creator-jpsi-had-reduced") { // init HF event selection helper hfEvSelMc.init(device, registry); break; @@ -510,7 +510,7 @@ struct HfDataCreatorJpsiHadReduced { /// \param vecDaughtersB is the vector with all daughter tracks (Jpsi daughters in first position) /// \param indexHfCandJpsi is the index of the Jpsi candidate /// \param selectedTracksBach is the map with the indices of selected bachelor pion tracks - template + template void fillMcRecoInfo(CColl const& collision, PParticles const& particlesMc, std::vector const& vecDaughtersB, @@ -525,7 +525,7 @@ struct HfDataCreatorJpsiHadReduced { int8_t debug{0}; float motherPt{-1.f}; - if constexpr (decChannel == DecayChannel::BplusToJpsiK) { + if constexpr (DecChannel == DecayChannel::BplusToJpsiK) { // B+ → J/Psi K+ → (µ+µ-) K+ int indexRec = -1; if (!runJpsiToee) { @@ -555,7 +555,7 @@ struct HfDataCreatorJpsiHadReduced { } } rowHfJpsiKMcRecReduced(indexHfCandJpsi, selectedTracksBach[0][vecDaughtersB.back().globalIndex()], flag, channel, flagWrongCollision, debug, motherPt); - } else if constexpr (decChannel == DecayChannel::BsToJpsiPhi) { + } else if constexpr (DecChannel == DecayChannel::BsToJpsiPhi) { // Bs → J/Psi phi → (µ+µ-) (K+K-) int indexRec = -1; if (!runJpsiToee) { @@ -612,7 +612,7 @@ struct HfDataCreatorJpsiHadReduced { return indexCollisionMaxNumContrib; } - template + template void runMcGen(aod::McCollision const& mcCollision, aod::McParticles const& particlesMc, CollisionsWCMcLabels const& collisions, @@ -631,7 +631,7 @@ struct HfDataCreatorJpsiHadReduced { // Match generated particles. for (const auto& particle : mcParticlesPerMcColl) { int8_t sign{0}, flag{0}, channel{0}; - if constexpr (decChannel == DecayChannel::BplusToJpsiK) { + if constexpr (DecChannel == DecayChannel::BplusToJpsiK) { // B+ → J/Psi K+ → (µ+µ-) K+ if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kBPlus, std::array{static_cast(Pdg::kJPsi), +kKPlus}, true, &sign)) { // Match J/Psi -> µ+µ- @@ -658,9 +658,9 @@ struct HfDataCreatorJpsiHadReduced { auto yParticle = RecoDecay::y(particle.pVector(), MassBPlus); auto etaParticle = particle.eta(); - std::array ptProngs; - std::array yProngs; - std::array etaProngs; + std::array ptProngs{}; + std::array yProngs{}; + std::array etaProngs{}; int counter = 0; for (const auto& daught : particle.daughters_as()) { ptProngs[counter] = daught.pt(); @@ -671,7 +671,7 @@ struct HfDataCreatorJpsiHadReduced { rowHfBpMcGenReduced(flag, channel, ptParticle, yParticle, etaParticle, ptProngs[0], yProngs[0], etaProngs[0], ptProngs[1], yProngs[1], etaProngs[1], hfRejMap, centFT0C, centFT0M); - } else if constexpr (decChannel == DecayChannel::BsToJpsiPhi) { + } else if constexpr (DecChannel == DecayChannel::BsToJpsiPhi) { // Bs → J/Psi phi → (µ+µ-) (K+K-) if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kBS, std::array{static_cast(Pdg::kJPsi), +kKPlus, -kKPlus}, true, &sign, 2)) { // Match J/Psi -> µ+µ- and phi -> K+K- @@ -698,9 +698,9 @@ struct HfDataCreatorJpsiHadReduced { auto yParticle = RecoDecay::y(particle.pVector(), MassBPlus); auto etaParticle = particle.eta(); - std::array ptProngs; - std::array yProngs; - std::array etaProngs; + std::array ptProngs{}; + std::array yProngs{}; + std::array etaProngs{}; int counter = 0; for (const auto& daught : particle.daughters_as()) { ptProngs[counter] = daught.pt(); @@ -716,7 +716,7 @@ struct HfDataCreatorJpsiHadReduced { } // Jpsi candidate selection - template + template void runDataCreation(Coll const& collision, JpsiCands const& candsJpsi, aod::TrackAssoc const& trackIndices, @@ -750,7 +750,7 @@ struct HfDataCreatorJpsiHadReduced { auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; - o2::parameters::GRPMagField* grpo = ccdb->getForTimeStamp(ccdbPathGrpMag, bc.timestamp()); + auto* grpo = ccdb->getForTimeStamp(ccdbPathGrpMag, bc.timestamp()); if (grpo == nullptr) { LOGF(fatal, "Run 3 GRP object (type o2::parameters::GRPMagField) is not available in CCDB for run=%d at timestamp=%llu", bc.runNumber(), bc.timestamp()); } @@ -797,8 +797,8 @@ struct HfDataCreatorJpsiHadReduced { // --------------------------------- // reconstruct J/Psi candidate secondary vertex - o2::track::TrackParCov trackParCovJpsi{}; // FIXME: unused - std::array pVecJpsi{}; // FIXME: unused + o2::track::TrackParCov const trackParCovJpsi{}; // FIXME: unused + std::array const pVecJpsi{}; // FIXME: unused registry.fill(HIST("hFitCandidatesJpsi"), SVFitting::BeforeFit); try { if (df2.process(trackPosParCov, trackNegParCov) == 0) { @@ -850,7 +850,7 @@ struct HfDataCreatorJpsiHadReduced { continue; } - if constexpr (decChannel == DecayChannel::BplusToJpsiK) { + if constexpr (DecChannel == DecayChannel::BplusToJpsiK) { registry.fill(HIST("hPtKaon"), trackParCovBach.getPt()); // compute invariant mass square and apply selection invMass2JpsiHad = RecoDecay::m2(std::array{pVecJpsi, pVecBach}, std::array{MassJPsi, MassKPlus}); @@ -911,8 +911,9 @@ struct HfDataCreatorJpsiHadReduced { selectedTracksBach[trackBach.globalIndex()] = hfTrackLfDau0.lastIndex(); } - if constexpr (doMc) { + if constexpr (DoMc) { std::vector beautyHadDauTracks{}; + beautyHadDauTracks.reserve(jPsiDauTracks.size()); for (const auto& track : jPsiDauTracks) { beautyHadDauTracks.push_back(track); } @@ -920,7 +921,7 @@ struct HfDataCreatorJpsiHadReduced { fillMcRecoInfo(collision, particlesMc, beautyHadDauTracks, indexHfCandJpsi, std::array, 2>{selectedTracksBach}, indexCollisionMaxNumContrib); } fillHfCandJpsi = true; - } else if constexpr (decChannel == DecayChannel::BsToJpsiPhi) { + } else if constexpr (DecChannel == DecayChannel::BsToJpsiPhi) { for (auto trackBachId2 = trackId + 1; trackBachId2 != trackIndices.end(); ++trackBachId2) { auto trackBach2 = trackBachId2.template track_as(); auto trackBach2ParCov = getTrackParCov(trackBach2); @@ -1032,8 +1033,9 @@ struct HfDataCreatorJpsiHadReduced { selectedTracksBach2[trackBach2.globalIndex()] = hfTrackLfDau1.lastIndex(); } - if constexpr (doMc) { + if constexpr (DoMc) { std::vector beautyHadDauTracks{}; + beautyHadDauTracks.reserve(jPsiDauTracks.size()); for (const auto& track : jPsiDauTracks) { beautyHadDauTracks.push_back(track); } diff --git a/PWGHF/D2H/Tasks/taskB0.cxx b/PWGHF/D2H/Tasks/taskB0.cxx index 219d9dc50bb..54effeb26ea 100644 --- a/PWGHF/D2H/Tasks/taskB0.cxx +++ b/PWGHF/D2H/Tasks/taskB0.cxx @@ -290,9 +290,9 @@ struct HfTaskB0 { continue; } - std::array ptProngs; - std::array yProngs; - std::array etaProngs; + std::array ptProngs{}; + std::array yProngs{}; + std::array etaProngs{}; int counter = 0; for (const auto& daught : particle.daughters_as()) { ptProngs[counter] = daught.pt(); diff --git a/PWGHF/D2H/Tasks/taskB0Reduced.cxx b/PWGHF/D2H/Tasks/taskB0Reduced.cxx index fefbd739f11..8cbd55aa2f4 100644 --- a/PWGHF/D2H/Tasks/taskB0Reduced.cxx +++ b/PWGHF/D2H/Tasks/taskB0Reduced.cxx @@ -236,7 +236,7 @@ struct HfTaskB0Reduced { doprocessMcDplusPiWithDmesMlAndDecayTypeCheck, doprocessMcDplusPiWithB0Ml, doprocessMcDplusPiWithB0MlAndDecayTypeCheck}; const AxisSpec axisMass = ((std::accumulate(processFuncDplusPi.begin(), processFuncDplusPi.end(), 0)) > 0) ? axisMassDminus : axisMassDeltaMassDStar; - std::string dMesSpecie{""}; + std::string dMesSpecie; if ((std::accumulate(processFuncDplusPi.begin(), processFuncDplusPi.end(), 0)) > 0) { dMesSpecie += "D^{#minus}"; } else { @@ -448,7 +448,7 @@ struct HfTaskB0Reduced { /// \param withB0Ml is the flag to enable the filling with ML scores for the B0 candidate /// \param candidate is the B0 candidate /// \param candidatesD is the table with D- candidates - template + template void fillCandDStarPi(Cand const& candidate, SoftPions const& softPions, CandsDmes const&) @@ -459,9 +459,9 @@ struct HfTaskB0Reduced { auto ptD = candidate.ptProng0(); auto invMassD = candD.invMassHypo0(); auto softPi = softPions.rawIteratorAt(candD.globalIndex()); - std::array posPv{candidate.posX(), candidate.posY(), candidate.posZ()}; - std::array posSvD{candD.xSecondaryVertex(), candD.ySecondaryVertex(), candD.zSecondaryVertex()}; - std::array momD{candD.pVector()}; + std::array const posPv{candidate.posX(), candidate.posY(), candidate.posZ()}; + std::array const posSvD{candD.xSecondaryVertex(), candD.ySecondaryVertex(), candD.zSecondaryVertex()}; + std::array const momD{candD.pVector()}; auto cospD = RecoDecay::cpa(posPv, posSvD, momD); auto cospXyD = RecoDecay::cpaXY(posPv, posSvD, momD); auto decLenD = RecoDecay::distance(posPv, posSvD); @@ -470,14 +470,14 @@ struct HfTaskB0Reduced { int8_t flagMcMatchRec = 0; int8_t flagWrongCollision = 0; bool isSignal = false; - if constexpr (doMc) { + if constexpr (DoMc) { flagMcMatchRec = candidate.flagMcMatchRec(); flagWrongCollision = candidate.flagWrongCollision(); isSignal = TESTBIT(std::abs(flagMcMatchRec), hf_cand_b0::DecayTypeMc::B0ToDstarPiToD0PiPiToKPiPiPi); } if (fillHistograms) { - if constexpr (doMc) { + if constexpr (DoMc) { if (isSignal) { registry.fill(HIST("hMassRecSig"), ptCandB0, hfHelper.invMassB0ToDPi(candidate)); registry.fill(HIST("hPtProngD0RecSig"), ptCandB0, candidate.ptProng0()); @@ -499,7 +499,7 @@ struct HfTaskB0Reduced { registry.fill(HIST("hDecLengthXyDRecSig"), ptD, decLenXyD); registry.fill(HIST("hCospDRecSig"), ptD, cospD); registry.fill(HIST("hCospXyDRecSig"), ptD, cospXyD); - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { registry.fill(HIST("hMlScoreBkgDRecSig"), ptD, candidate.prong0MlScoreBkg()); registry.fill(HIST("hMlScorePromptDRecSig"), ptD, candidate.prong0MlScorePrompt()); registry.fill(HIST("hMlScoreNonPromptDRecSig"), ptD, candidate.prong0MlScoreNonprompt()); @@ -525,7 +525,7 @@ struct HfTaskB0Reduced { registry.fill(HIST("hDecLengthXyDRecBg"), ptD, decLenXyD); registry.fill(HIST("hCospDRecBg"), ptD, cospD); registry.fill(HIST("hCospXyDRecBg"), ptD, cospXyD); - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { registry.fill(HIST("hMlScoreBkgDRecBg"), ptD, candidate.prong0MlScoreBkg()); registry.fill(HIST("hMlScorePromptDRecBg"), ptD, candidate.prong0MlScorePrompt()); registry.fill(HIST("hMlScoreNonPromptDRecBg"), ptD, candidate.prong0MlScoreNonprompt()); @@ -553,7 +553,7 @@ struct HfTaskB0Reduced { registry.fill(HIST("hCospD"), ptD, cospD); registry.fill(HIST("hCospXyD"), ptD, cospXyD); - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { registry.fill(HIST("hMlScoreBkgD"), ptD, candidate.prong0MlScoreBkg()); registry.fill(HIST("hMlScorePromptD"), ptD, candidate.prong0MlScorePrompt()); registry.fill(HIST("hMlScoreNonPromptD"), ptD, candidate.prong0MlScoreNonprompt()); @@ -561,22 +561,22 @@ struct HfTaskB0Reduced { } } if (fillSparses) { - if constexpr (doMc) { + if constexpr (DoMc) { if (isSignal) { - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { registry.fill(HIST("hMassPtCutVarsRecSig"), invMassB0, ptCandB0, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProngSqSum(), candidate.cpa(), invMassD, ptD, candidate.prong0MlScoreBkg(), candidate.prong0MlScoreNonprompt()); } else { registry.fill(HIST("hMassPtCutVarsRecSig"), invMassB0, ptCandB0, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProngSqSum(), candidate.cpa(), invMassD, ptD, decLenD, cospD); } } else if (fillBackground) { - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { registry.fill(HIST("hMassPtCutVarsRecBg"), invMassB0, ptCandB0, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProngSqSum(), candidate.cpa(), invMassD, ptD, candidate.prong0MlScoreBkg(), candidate.prong0MlScoreNonprompt()); } else { registry.fill(HIST("hMassPtCutVarsRecBg"), invMassB0, ptCandB0, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProngSqSum(), candidate.cpa(), invMassD, ptD, decLenD, cospD); } } } else { - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { registry.fill(HIST("hMassPtCutVars"), invMassB0, ptCandB0, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProngSqSum(), candidate.cpa(), invMassD, ptD, candidate.prong0MlScoreBkg(), candidate.prong0MlScoreNonprompt()); } else { registry.fill(HIST("hMassPtCutVars"), invMassB0, ptCandB0, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProngSqSum(), candidate.cpa(), invMassD, ptD, decLenD, cospD); @@ -584,13 +584,13 @@ struct HfTaskB0Reduced { } } if (fillTree) { - float pseudoRndm = ptD * 1000. - static_cast(ptD * 1000); - if (flagMcMatchRec != 0 || (((doMc && fillBackground) || !doMc) && (ptCandB0 >= ptMaxForDownSample || pseudoRndm < downSampleBkgFactor))) { + float const pseudoRndm = ptD * 1000. - static_cast(ptD * 1000); + if (flagMcMatchRec != 0 || (((DoMc && fillBackground) || !DoMc) && (ptCandB0 >= ptMaxForDownSample || pseudoRndm < downSampleBkgFactor))) { float prong0MlScoreBkg = -1.; float prong0MlScorePrompt = -1.; float prong0MlScoreNonprompt = -1.; - float candidateMlScoreSig = -1; - if constexpr (withDmesMl) { + float const candidateMlScoreSig = -1; + if constexpr (WithDmesMl) { prong0MlScoreBkg = candidate.prong0MlScoreBkg(); prong0MlScorePrompt = candidate.prong0MlScorePrompt(); prong0MlScoreNonprompt = candidate.prong0MlScoreNonprompt(); @@ -598,7 +598,7 @@ struct HfTaskB0Reduced { auto prongBachPi = candidate.template prongBachPi_as(); float ptMother = -1.; - if constexpr (doMc) { + if constexpr (DoMc) { ptMother = candidate.ptMother(); } @@ -659,7 +659,7 @@ struct HfTaskB0Reduced { flagWrongCollision, ptMother); - if constexpr (withDecayTypeCheck) { + if constexpr (WithDecayTypeCheck) { hfRedB0McCheck( flagMcMatchRec, flagWrongCollision, @@ -686,7 +686,7 @@ struct HfTaskB0Reduced { /// \param withB0Ml is the flag to enable the filling with ML scores for the B0 candidate /// \param candidate is the B0 candidate /// \param candidatesD is the table with D- candidates - template + template void fillCand(Cand const& candidate, CandsDmes const&) { @@ -695,9 +695,9 @@ struct HfTaskB0Reduced { auto candD = candidate.template prong0_as(); auto ptD = candidate.ptProng0(); auto invMassD = candD.invMassHypo0(); - std::array posPv{candidate.posX(), candidate.posY(), candidate.posZ()}; - std::array posSvD{candD.xSecondaryVertex(), candD.ySecondaryVertex(), candD.zSecondaryVertex()}; - std::array momD{candD.pVector()}; + std::array const posPv{candidate.posX(), candidate.posY(), candidate.posZ()}; + std::array const posSvD{candD.xSecondaryVertex(), candD.ySecondaryVertex(), candD.zSecondaryVertex()}; + std::array const momD{candD.pVector()}; auto cospD = RecoDecay::cpa(posPv, posSvD, momD); auto cospXyD = RecoDecay::cpaXY(posPv, posSvD, momD); auto decLenD = RecoDecay::distance(posPv, posSvD); @@ -706,14 +706,14 @@ struct HfTaskB0Reduced { int8_t flagMcMatchRec = 0; int8_t flagWrongCollision = 0; bool isSignal = false; - if constexpr (doMc) { + if constexpr (DoMc) { flagMcMatchRec = candidate.flagMcMatchRec(); flagWrongCollision = candidate.flagWrongCollision(); isSignal = TESTBIT(std::abs(flagMcMatchRec), hf_cand_b0::DecayTypeMc::B0ToDplusPiToPiKPiPi); } if (fillHistograms) { - if constexpr (doMc) { + if constexpr (DoMc) { if (isSignal) { registry.fill(HIST("hMassRecSig"), ptCandB0, hfHelper.invMassB0ToDPi(candidate)); registry.fill(HIST("hPtProng0RecSig"), ptCandB0, candidate.ptProng0()); @@ -733,15 +733,15 @@ struct HfTaskB0Reduced { registry.fill(HIST("hDecLengthXyDRecSig"), ptD, decLenXyD); registry.fill(HIST("hCospDRecSig"), ptD, cospD); registry.fill(HIST("hCospXyDRecSig"), ptD, cospXyD); - if constexpr (withDecayTypeCheck) { + if constexpr (WithDecayTypeCheck) { registry.fill(HIST("hDecayTypeMc"), 1 + hf_cand_b0::DecayTypeMc::B0ToDplusPiToPiKPiPi, invMassB0, ptCandB0); } - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { registry.fill(HIST("hMlScoreBkgDRecSig"), ptD, candidate.prong0MlScoreBkg()); registry.fill(HIST("hMlScorePromptDRecSig"), ptD, candidate.prong0MlScorePrompt()); registry.fill(HIST("hMlScoreNonPromptDRecSig"), ptD, candidate.prong0MlScoreNonprompt()); } - if constexpr (withB0Ml) { + if constexpr (WithB0Ml) { registry.fill(HIST("hMlScoreSigB0RecSig"), ptCandB0, candidate.mlProbB0ToDPi()); } } else if (fillBackground) { @@ -763,15 +763,15 @@ struct HfTaskB0Reduced { registry.fill(HIST("hDecLengthXyDRecBg"), ptD, decLenXyD); registry.fill(HIST("hCospDRecBg"), ptD, cospD); registry.fill(HIST("hCospXyDRecBg"), ptD, cospXyD); - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { registry.fill(HIST("hMlScoreBkgDRecBg"), ptD, candidate.prong0MlScoreBkg()); registry.fill(HIST("hMlScorePromptDRecBg"), ptD, candidate.prong0MlScorePrompt()); registry.fill(HIST("hMlScoreNonPromptDRecBg"), ptD, candidate.prong0MlScoreNonprompt()); } - if constexpr (withB0Ml) { + if constexpr (WithB0Ml) { registry.fill(HIST("hMlScoreSigB0RecBg"), ptCandB0, candidate.mlProbB0ToDPi()); } - } else if constexpr (withDecayTypeCheck) { + } else if constexpr (WithDecayTypeCheck) { if (TESTBIT(flagMcMatchRec, hf_cand_b0::DecayTypeMc::B0ToDsPiToKKPiPi)) { // B0 → Ds- π+ → (K- K+ π-) π+ registry.fill(HIST("hDecayTypeMc"), 1 + hf_cand_b0::DecayTypeMc::B0ToDsPiToKKPiPi, invMassB0, ptCandB0); } else if (TESTBIT(flagMcMatchRec, hf_cand_b0::DecayTypeMc::BsToDsPiToKKPiPi)) { // B0s → Ds- π+ → (K- K+ π-) π+ @@ -804,33 +804,33 @@ struct HfTaskB0Reduced { registry.fill(HIST("hCospD"), ptD, cospD); registry.fill(HIST("hCospXyD"), ptD, cospXyD); - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { registry.fill(HIST("hMlScoreBkgD"), ptD, candidate.prong0MlScoreBkg()); registry.fill(HIST("hMlScorePromptD"), ptD, candidate.prong0MlScorePrompt()); registry.fill(HIST("hMlScoreNonPromptD"), ptD, candidate.prong0MlScoreNonprompt()); } - if constexpr (withB0Ml) { + if constexpr (WithB0Ml) { registry.fill(HIST("hMlScoreSigB0"), ptCandB0, candidate.mlProbB0ToDPi()); } } } if (fillSparses) { - if constexpr (doMc) { + if constexpr (DoMc) { if (isSignal) { - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { registry.fill(HIST("hMassPtCutVarsRecSig"), invMassB0, ptCandB0, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassD, ptD, candidate.prong0MlScoreBkg(), candidate.prong0MlScoreNonprompt()); } else { registry.fill(HIST("hMassPtCutVarsRecSig"), invMassB0, ptCandB0, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassD, ptD, decLenD, cospD); } } else if (fillBackground) { - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { registry.fill(HIST("hMassPtCutVarsRecBg"), invMassB0, ptCandB0, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassD, ptD, candidate.prong0MlScoreBkg(), candidate.prong0MlScoreNonprompt()); } else { registry.fill(HIST("hMassPtCutVarsRecBg"), invMassB0, ptCandB0, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassD, ptD, decLenD, cospD); } } } else { - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { registry.fill(HIST("hMassPtCutVars"), invMassB0, ptCandB0, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassD, ptD, candidate.prong0MlScoreBkg(), candidate.prong0MlScoreNonprompt()); } else { registry.fill(HIST("hMassPtCutVars"), invMassB0, ptCandB0, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassD, ptD, decLenD, cospD); @@ -838,24 +838,24 @@ struct HfTaskB0Reduced { } } if (fillTree) { - float pseudoRndm = ptD * 1000. - static_cast(ptD * 1000); - if (flagMcMatchRec != 0 || (((doMc && fillBackground) || !doMc) && (ptCandB0 >= ptMaxForDownSample || pseudoRndm < downSampleBkgFactor))) { + float const pseudoRndm = ptD * 1000. - static_cast(ptD * 1000); + if (flagMcMatchRec != 0 || (((DoMc && fillBackground) || !DoMc) && (ptCandB0 >= ptMaxForDownSample || pseudoRndm < downSampleBkgFactor))) { float prong0MlScoreBkg = -1.; float prong0MlScorePrompt = -1.; float prong0MlScoreNonprompt = -1.; float candidateMlScoreSig = -1; - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { prong0MlScoreBkg = candidate.prong0MlScoreBkg(); prong0MlScorePrompt = candidate.prong0MlScorePrompt(); prong0MlScoreNonprompt = candidate.prong0MlScoreNonprompt(); } - if constexpr (withB0Ml) { + if constexpr (WithB0Ml) { candidateMlScoreSig = candidate.mlProbB0ToDPi(); } auto prong1 = candidate.template prong1_as(); float ptMother = -1.; - if constexpr (doMc) { + if constexpr (DoMc) { ptMother = candidate.ptMother(); } @@ -916,7 +916,7 @@ struct HfTaskB0Reduced { flagWrongCollision, ptMother); - if constexpr (withDecayTypeCheck) { + if constexpr (WithDecayTypeCheck) { hfRedB0McCheck( flagMcMatchRec, flagWrongCollision, @@ -948,7 +948,7 @@ struct HfTaskB0Reduced { std::array ptProngs = {particle.ptProng0(), particle.ptProng1()}; std::array yProngs = {particle.yProng0(), particle.yProng1()}; std::array etaProngs = {particle.etaProng0(), particle.etaProng1()}; - bool prongsInAcc = isProngInAcceptance(etaProngs[0], ptProngs[0]) && isProngInAcceptance(etaProngs[1], ptProngs[1]); + bool const prongsInAcc = isProngInAcceptance(etaProngs[0], ptProngs[0]) && isProngInAcceptance(etaProngs[1], ptProngs[1]); if (fillHistograms) { registry.fill(HIST("hPtProng0Gen"), ptParticle, ptProngs[0]); diff --git a/PWGHF/D2H/Tasks/taskBplusReduced.cxx b/PWGHF/D2H/Tasks/taskBplusReduced.cxx index e7a9a8f93db..f47cc1c2c4e 100644 --- a/PWGHF/D2H/Tasks/taskBplusReduced.cxx +++ b/PWGHF/D2H/Tasks/taskBplusReduced.cxx @@ -402,7 +402,7 @@ struct HfTaskBplusReduced { /// \param withBplusMl is the flag to enable the filling with ML scores for the B+ candidate /// \param candidate is the B+ candidate /// \param candidatesD is the table with D0 candidates - template + template void fillCand(Cand const& candidate, CandsDmes const& /*candidatesD*/, TracksPion const&) @@ -413,9 +413,9 @@ struct HfTaskBplusReduced { auto candPi = candidate.template prong1_as(); auto ptD0 = candidate.ptProng0(); auto invMassD0 = (candPi.signed1Pt() < 0) ? candD0.invMassHypo0() : candD0.invMassHypo1(); - std::array posPv{candidate.posX(), candidate.posY(), candidate.posZ()}; - std::array posSvD{candD0.xSecondaryVertex(), candD0.ySecondaryVertex(), candD0.zSecondaryVertex()}; - std::array momD{candD0.pVector()}; + std::array const posPv{candidate.posX(), candidate.posY(), candidate.posZ()}; + std::array const posSvD{candD0.xSecondaryVertex(), candD0.ySecondaryVertex(), candD0.zSecondaryVertex()}; + std::array const momD{candD0.pVector()}; auto cpaD0 = RecoDecay::cpa(posPv, posSvD, momD); auto cpaXyD0 = RecoDecay::cpaXY(posPv, posSvD, momD); auto decLenD0 = RecoDecay::distance(posPv, posSvD); @@ -424,14 +424,14 @@ struct HfTaskBplusReduced { int8_t flagMcMatchRec = 0; int8_t flagWrongCollision = 0; bool isSignal = false; - if constexpr (doMc) { + if constexpr (DoMc) { flagMcMatchRec = candidate.flagMcMatchRec(); flagWrongCollision = candidate.flagWrongCollision(); isSignal = TESTBIT(std::abs(flagMcMatchRec), hf_cand_bplus::DecayTypeMc::BplusToD0PiToKPiPi); } if (fillHistograms) { - if constexpr (doMc) { + if constexpr (DoMc) { if (isSignal) { registry.fill(HIST("hMassRecSig"), invMassBplus, ptCandBplus); registry.fill(HIST("hPtRecSig"), ptCandBplus); @@ -453,15 +453,15 @@ struct HfTaskBplusReduced { registry.fill(HIST("hDecLengthXyD0RecSig"), decLenXyD0, ptD0); registry.fill(HIST("hCpaD0RecSig"), cpaD0, ptD0); registry.fill(HIST("hCpaXyD0RecSig"), cpaXyD0, ptD0); - if constexpr (withDecayTypeCheck) { + if constexpr (WithDecayTypeCheck) { registry.fill(HIST("hDecayTypeMc"), 1 + hf_cand_bplus::DecayTypeMc::BplusToD0PiToKPiPi, invMassBplus, ptCandBplus); } - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { registry.fill(HIST("hMlScoreBkgDRecSig"), ptD0, candidate.prong0MlScoreBkg()); registry.fill(HIST("hMlScorePromptDRecSig"), ptD0, candidate.prong0MlScorePrompt()); registry.fill(HIST("hMlScoreNonPromptDRecSig"), ptD0, candidate.prong0MlScoreNonprompt()); } - if constexpr (withBplusMl) { + if constexpr (WithBplusMl) { registry.fill(HIST("hMlScoreSigBplusRecSig"), ptCandBplus, candidate.mlProbBplusToD0Pi()); } } else if (fillBackground) { @@ -485,15 +485,15 @@ struct HfTaskBplusReduced { registry.fill(HIST("hDecLengthXyDRecBg"), decLenXyD0, ptD0); registry.fill(HIST("hCpaDRecBg"), cpaD0, ptD0); registry.fill(HIST("hCpaXyDRecBg"), cpaXyD0, ptD0); - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { registry.fill(HIST("hMlScoreBkgDRecBg"), ptD0, candidate.prong0MlScoreBkg()); registry.fill(HIST("hMlScorePromptDRecBg"), ptD0, candidate.prong0MlScorePrompt()); registry.fill(HIST("hMlScoreNonPromptDRecBg"), ptD0, candidate.prong0MlScoreNonprompt()); } - if constexpr (withBplusMl) { + if constexpr (WithBplusMl) { registry.fill(HIST("hMlScoreSigBplusRecBg"), ptCandBplus, candidate.mlProbBplusToD0Pi()); } - } else if constexpr (withDecayTypeCheck) { + } else if constexpr (WithDecayTypeCheck) { if (TESTBIT(flagMcMatchRec, hf_cand_bplus::DecayTypeMc::BplusToD0KToKPiK)) { // Partly reconstructed decay channel registry.fill(HIST("hDecayTypeMc"), 1 + hf_cand_bplus::DecayTypeMc::BplusToD0KToKPiK, invMassBplus, ptCandBplus); } else if (TESTBIT(flagMcMatchRec, hf_cand_bplus::DecayTypeMc::PartlyRecoDecay)) { // Partly reconstructed decay channel @@ -522,33 +522,33 @@ struct HfTaskBplusReduced { registry.fill(HIST("hDecLengthXyD0"), decLenXyD0, ptD0); registry.fill(HIST("hCpaD0"), cpaD0, ptD0); registry.fill(HIST("hCpaXyD0"), cpaXyD0, ptD0); - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { registry.fill(HIST("hMlScoreBkgD"), ptD0, candidate.prong0MlScoreBkg()); registry.fill(HIST("hMlScorePromptD"), ptD0, candidate.prong0MlScorePrompt()); registry.fill(HIST("hMlScoreNonPromptD"), ptD0, candidate.prong0MlScoreNonprompt()); } - if constexpr (withBplusMl) { + if constexpr (WithBplusMl) { registry.fill(HIST("hMlScoreSigBplus"), ptCandBplus, candidate.mlProbBplusToD0Pi()); } } } if (fillSparses) { - if constexpr (doMc) { + if constexpr (DoMc) { if (isSignal) { - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { registry.fill(HIST("hMassPtCutVarsRecSig"), invMassBplus, ptCandBplus, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassD0, ptD0, candidate.prong0MlScoreBkg(), candidate.prong0MlScoreNonprompt()); } else { registry.fill(HIST("hMassPtCutVarsRecSig"), invMassBplus, ptCandBplus, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassD0, ptD0, decLenD0, cpaD0); } } else if (fillBackground) { - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { registry.fill(HIST("hMassPtCutVarsRecBg"), invMassBplus, ptCandBplus, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassD0, ptD0, candidate.prong0MlScoreBkg(), candidate.prong0MlScoreNonprompt()); } else { registry.fill(HIST("hMassPtCutVarsRecBg"), invMassBplus, ptCandBplus, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassD0, ptD0, decLenD0, cpaD0); } } } else { - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { registry.fill(HIST("hMassPtCutVars"), invMassBplus, ptCandBplus, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassD0, ptD0, candidate.prong0MlScoreBkg(), candidate.prong0MlScoreNonprompt()); } else { registry.fill(HIST("hMassPtCutVars"), invMassBplus, ptCandBplus, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassD0, ptD0, decLenD0, cpaD0); @@ -556,18 +556,18 @@ struct HfTaskBplusReduced { } } if (fillTree) { - float pseudoRndm = ptD0 * 1000. - static_cast(ptD0 * 1000); + float const pseudoRndm = ptD0 * 1000. - static_cast(ptD0 * 1000); if (ptCandBplus >= ptMaxForDownSample || pseudoRndm < downSampleBkgFactor) { float prong0MlScoreBkg = -1.; float prong0MlScorePrompt = -1.; float prong0MlScoreNonprompt = -1.; float candidateMlScoreSig = -1; - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { prong0MlScoreBkg = candidate.prong0MlScoreBkg(); prong0MlScorePrompt = candidate.prong0MlScorePrompt(); prong0MlScoreNonprompt = candidate.prong0MlScoreNonprompt(); } - if constexpr (withBplusMl) { + if constexpr (WithBplusMl) { candidateMlScoreSig = candidate.mlProbBplusToD0Pi(); } auto prong1 = candidate.template prong1_as(); @@ -589,7 +589,7 @@ struct HfTaskBplusReduced { } float ptMother = -1.; - if constexpr (doMc) { + if constexpr (DoMc) { ptMother = candidate.ptMother(); } @@ -649,7 +649,7 @@ struct HfTaskBplusReduced { flagWrongCollision, ptMother); - if constexpr (withDecayTypeCheck) { + if constexpr (WithDecayTypeCheck) { hfRedBpMcCheck( flagMcMatchRec, flagWrongCollision, @@ -680,7 +680,7 @@ struct HfTaskBplusReduced { std::array ptProngs = {particle.ptProng0(), particle.ptProng1()}; std::array yProngs = {particle.yProng0(), particle.yProng1()}; std::array etaProngs = {particle.etaProng0(), particle.etaProng1()}; - bool prongsInAcc = isProngInAcceptance(etaProngs[0], ptProngs[0]) && isProngInAcceptance(etaProngs[1], ptProngs[1]); + bool const prongsInAcc = isProngInAcceptance(etaProngs[0], ptProngs[0]) && isProngInAcceptance(etaProngs[1], ptProngs[1]); if (fillHistograms) { registry.fill(HIST("hPtProng0Gen"), ptParticle, ptProngs[0]); diff --git a/PWGHF/D2H/Tasks/taskBplusToJpsiKReduced.cxx b/PWGHF/D2H/Tasks/taskBplusToJpsiKReduced.cxx index 25bec4a1f6f..85e89ec279e 100644 --- a/PWGHF/D2H/Tasks/taskBplusToJpsiKReduced.cxx +++ b/PWGHF/D2H/Tasks/taskBplusToJpsiKReduced.cxx @@ -242,7 +242,7 @@ struct HfTaskBplusToJpsiKReduced { o2::ccdb::CcdbApi ccdbApi; using TracksKaon = soa::Join; - std::vector outputMl = {}; + std::vector outputMl; // Filter filterSelectCandidates = (aod::hf_sel_candidate_bplus::isSelBplusToJpsiPi >= selectionFlagBplus); @@ -324,7 +324,7 @@ struct HfTaskBplusToJpsiKReduced { /// Calculate pseudorapidity from track tan(lambda) /// \param tgl is the track tangent of the dip angle /// \return pseudorapidity - inline float absEta(float tgl) + float absEta(float tgl) { return std::abs(std::log(std::tan(o2::constants::math::PIQuarter - 0.5f * std::atan(tgl)))); } @@ -334,7 +334,7 @@ struct HfTaskBplusToJpsiKReduced { /// \param withBplusMl is the flag to enable the filling with ML scores for the B+ candidate /// \param candidate is the B+ candidate /// \param candidatesJpsi is the table with Jpsi candidates - template + template void fillCand(Cand const& candidate, aod::HfRedJpsis const& /*candidatesJpsi*/, aod::HfRedBach0Tracks const&) @@ -349,7 +349,7 @@ struct HfTaskBplusToJpsiKReduced { int8_t flagMcMatchRec{0}, flagMcDecayChanRec{0}, flagWrongCollision{0}; bool isSignal = false; - if constexpr (doMc) { + if constexpr (DoMc) { flagMcMatchRec = candidate.flagMcMatchRec(); flagMcDecayChanRec = candidate.flagMcDecayChanRec(); flagWrongCollision = candidate.flagWrongCollision(); @@ -380,7 +380,7 @@ struct HfTaskBplusToJpsiKReduced { } float candidateMlScoreSig = -1; - if constexpr (withBplusMl) { + if constexpr (WithBplusMl) { // B+ ML selections std::vector inputFeatures = hfMlResponse.getInputFeatures(candidate, candKa); if (hfMlResponse.isSelectedMl(inputFeatures, ptCandBplus, outputMl)) { @@ -394,7 +394,7 @@ struct HfTaskBplusToJpsiKReduced { registry.fill(HIST("hMass"), invMassBplus, ptCandBplus); registry.fill(HIST("hMassJpsi"), invMassJpsi, candidate.ptProng0()); registry.fill(HIST("hd0K"), candidate.impactParameter1(), candidate.ptProng1()); - if constexpr (doMc) { + if constexpr (DoMc) { if (isSignal) { registry.fill(HIST("hMassRecSig"), invMassBplus, ptCandBplus); registry.fill(HIST("hMassJpsiRecSig"), invMassJpsi, candidate.ptProng0()); @@ -406,10 +406,10 @@ struct HfTaskBplusToJpsiKReduced { } } - float pseudoRndm = ptJpsi * 1000. - static_cast(ptJpsi * 1000); + float const pseudoRndm = ptJpsi * 1000. - static_cast(ptJpsi * 1000); if (ptCandBplus >= ptMaxForDownSample || pseudoRndm < downSampleBkgFactor) { float ptMother = -1.; - if constexpr (doMc) { + if constexpr (DoMc) { ptMother = candidate.ptMother(); } @@ -477,7 +477,7 @@ struct HfTaskBplusToJpsiKReduced { } std::array ptProngs = {particle.ptProng0(), particle.ptProng1()}; std::array etaProngs = {particle.etaProng0(), particle.etaProng1()}; - bool prongsInAcc = isProngInAcceptance(etaProngs[0], ptProngs[0]) && isProngInAcceptance(etaProngs[1], ptProngs[1]); + bool const prongsInAcc = isProngInAcceptance(etaProngs[0], ptProngs[0]) && isProngInAcceptance(etaProngs[1], ptProngs[1]); registry.fill(HIST("hPtJpsiGen"), ptProngs[0], ptParticle); registry.fill(HIST("hPtKGen"), ptProngs[1], ptParticle); diff --git a/PWGHF/D2H/Tasks/taskBs.cxx b/PWGHF/D2H/Tasks/taskBs.cxx index d1d1e252c7c..6d41a59ba82 100644 --- a/PWGHF/D2H/Tasks/taskBs.cxx +++ b/PWGHF/D2H/Tasks/taskBs.cxx @@ -287,9 +287,9 @@ struct HfTaskBs { continue; } - std::array ptProngs; - std::array yProngs; - std::array etaProngs; + std::array ptProngs{}; + std::array yProngs{}; + std::array etaProngs{}; int counter = 0; for (const auto& daught : particle.daughters_as()) { ptProngs[counter] = daught.pt(); diff --git a/PWGHF/D2H/Tasks/taskBsReduced.cxx b/PWGHF/D2H/Tasks/taskBsReduced.cxx index 098814b8e37..44e5f5d8f82 100644 --- a/PWGHF/D2H/Tasks/taskBsReduced.cxx +++ b/PWGHF/D2H/Tasks/taskBsReduced.cxx @@ -96,8 +96,8 @@ DECLARE_SOA_COLUMN(NSigTpcPiProng1, nSigTpcPiProng1, float); //! DECLARE_SOA_COLUMN(NSigTofPiProng1, nSigTofPiProng1, float); //! TOF Nsigma separation for prong1 with pion mass hypothesis DECLARE_SOA_COLUMN(NSigTpcTofPiProng1, nSigTpcTofPiProng1, float); //! Combined TPC and TOF Nsigma separation for prong1 with pion mass hypothesis // MC truth -DECLARE_SOA_COLUMN(FlagWrongCollision, flagWrongCollision, int8_t); //! Flag for association with wrong collision -DECLARE_SOA_COLUMN(PtGen, ptGen, float); //! Transverse momentum of candidate (GeV/c) +DECLARE_SOA_COLUMN(FlagWrongCollision, flagWrongCollision, int8_t); //! Flag for association with wrong collision +DECLARE_SOA_COLUMN(PtGen, ptGen, float); //! Transverse momentum of candidate (GeV/c) // General vars (unused for now) DECLARE_SOA_COLUMN(P, p, float); //! Momentum of candidate (GeV/c) DECLARE_SOA_COLUMN(E, e, float); //! Energy of candidate (GeV) @@ -398,7 +398,7 @@ struct HfTaskBsReduced { /// \param withBsMl is the flag to enable the filling with ML scores for the Bs candidate /// \param candidate is the Bs candidate /// \param candidatesD is the table with Ds- candidates - template + template void fillCand(Cand const& candidate, CandsDmes const&) { @@ -408,9 +408,9 @@ struct HfTaskBsReduced { auto ptDs = candidate.ptProng0(); auto invMassDs = candDs.invMassHypo0() > 0 ? candDs.invMassHypo0() : candDs.invMassHypo1(); // TODO: here we are assuming that only one of the two hypotheses is filled, to be checked - std::array posPv{candidate.posX(), candidate.posY(), candidate.posZ()}; - std::array posSvDs{candDs.xSecondaryVertex(), candDs.ySecondaryVertex(), candDs.zSecondaryVertex()}; - std::array momDs{candDs.pVector()}; + std::array const posPv{candidate.posX(), candidate.posY(), candidate.posZ()}; + std::array const posSvDs{candDs.xSecondaryVertex(), candDs.ySecondaryVertex(), candDs.zSecondaryVertex()}; + std::array const momDs{candDs.pVector()}; auto cospDs = RecoDecay::cpa(posPv, posSvDs, momDs); auto cospXyDs = RecoDecay::cpaXY(posPv, posSvDs, momDs); auto decLenDs = RecoDecay::distance(posPv, posSvDs); @@ -419,14 +419,14 @@ struct HfTaskBsReduced { int8_t flagMcMatchRec = 0; int8_t flagWrongCollision = 0; bool isSignal = false; - if constexpr (doMc) { + if constexpr (DoMc) { flagMcMatchRec = candidate.flagMcMatchRec(); flagWrongCollision = candidate.flagWrongCollision(); isSignal = TESTBIT(std::abs(flagMcMatchRec), hf_cand_bs::DecayTypeMc::BsToDsPiToPhiPiPiToKKPiPi); } if (fillHistograms) { - if constexpr (doMc) { + if constexpr (DoMc) { if (isSignal) { registry.fill(HIST("hMassRecSig"), ptCandBs, invMassBs); registry.fill(HIST("hPtProng0RecSig"), ptCandBs, candidate.ptProng0()); @@ -446,15 +446,15 @@ struct HfTaskBsReduced { registry.fill(HIST("hDecLengthXyDRecSig"), ptDs, decLenXyDs); registry.fill(HIST("hCospDRecSig"), ptDs, cospDs); registry.fill(HIST("hCospXyDRecSig"), ptDs, cospXyDs); - if constexpr (withDecayTypeCheck) { + if constexpr (WithDecayTypeCheck) { registry.fill(HIST("hDecayTypeMc"), 1 + hf_cand_bs::DecayTypeMc::BsToDsPiToPhiPiPiToKKPiPi, invMassBs, ptCandBs); } - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { registry.fill(HIST("hMlScoreBkgDsRecSig"), ptDs, candidate.prong0MlScoreBkg()); registry.fill(HIST("hMlScorePromptDsRecSig"), ptDs, candidate.prong0MlScorePrompt()); registry.fill(HIST("hMlScoreNonPromptDsRecSig"), ptDs, candidate.prong0MlScoreNonprompt()); } - if constexpr (withBsMl) { + if constexpr (WithBsMl) { registry.fill(HIST("hMlScoreSigBsRecSig"), ptCandBs, candidate.mlProbBsToDsPi()[1]); } } else if (fillBackground) { @@ -476,15 +476,15 @@ struct HfTaskBsReduced { registry.fill(HIST("hDecLengthXyDRecBg"), ptDs, decLenXyDs); registry.fill(HIST("hCospDRecBg"), ptDs, cospDs); registry.fill(HIST("hCospXyDRecBg"), ptDs, cospXyDs); - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { registry.fill(HIST("hMlScoreBkgDsRecBg"), ptDs, candidate.prong0MlScoreBkg()); registry.fill(HIST("hMlScorePromptDsRecBg"), ptDs, candidate.prong0MlScorePrompt()); registry.fill(HIST("hMlScoreNonPromptDsRecBg"), ptDs, candidate.prong0MlScoreNonprompt()); } - if constexpr (withBsMl) { + if constexpr (WithBsMl) { registry.fill(HIST("hMlScoreSigBsRecBg"), ptCandBs, candidate.mlProbBsToDsPi()[1]); } - } else if constexpr (withDecayTypeCheck) { + } else if constexpr (WithDecayTypeCheck) { for (uint8_t iFlag = 1; iFlag < hf_cand_bs::DecayTypeMc::NDecayTypeMc; ++iFlag) { if (TESTBIT(flagMcMatchRec, iFlag)) { registry.fill(HIST("hDecayTypeMc"), 1 + iFlag, invMassBs, ptCandBs); @@ -511,33 +511,33 @@ struct HfTaskBsReduced { registry.fill(HIST("hCospD"), ptDs, cospDs); registry.fill(HIST("hCospXyD"), ptDs, cospXyDs); - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { registry.fill(HIST("hMlScoreBkgDs"), ptDs, candidate.prong0MlScoreBkg()); registry.fill(HIST("hMlScorePromptDs"), ptDs, candidate.prong0MlScorePrompt()); registry.fill(HIST("hMlScoreNonPromptDs"), ptDs, candidate.prong0MlScoreNonprompt()); } - if constexpr (withBsMl) { + if constexpr (WithBsMl) { registry.fill(HIST("hMlScoreSigBs"), ptCandBs, candidate.mlProbBsToDsPi()[1]); } } } if (fillSparses) { - if constexpr (doMc) { + if constexpr (DoMc) { if (isSignal) { - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { registry.fill(HIST("hMassPtCutVarsRecSig"), invMassBs, ptCandBs, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassDs, ptDs, candidate.prong0MlScoreBkg(), candidate.prong0MlScoreNonprompt()); } else { registry.fill(HIST("hMassPtCutVarsRecSig"), invMassBs, ptCandBs, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassDs, ptDs, decLenDs, cospDs); } } else if (fillBackground) { - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { registry.fill(HIST("hMassPtCutVarsRecBg"), invMassBs, ptCandBs, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassDs, ptDs, candidate.prong0MlScoreBkg(), candidate.prong0MlScoreNonprompt()); } else { registry.fill(HIST("hMassPtCutVarsRecBg"), invMassBs, ptCandBs, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassDs, ptDs, decLenDs, cospDs); } } } else { - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { registry.fill(HIST("hMassPtCutVars"), invMassBs, ptCandBs, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassDs, ptDs, candidate.prong0MlScoreBkg(), candidate.prong0MlScoreNonprompt()); } else { registry.fill(HIST("hMassPtCutVars"), invMassBs, ptCandBs, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassDs, ptDs, decLenDs, cospDs); @@ -545,24 +545,24 @@ struct HfTaskBsReduced { } } if (fillTree) { - float pseudoRndm = ptDs * 1000. - static_cast(ptDs * 1000); - if (flagMcMatchRec != 0 || (((doMc && fillBackground) || !doMc) && (ptCandBs >= ptMaxForDownSample || pseudoRndm < downSampleBkgFactor))) { + float const pseudoRndm = ptDs * 1000. - static_cast(ptDs * 1000); + if (flagMcMatchRec != 0 || (((DoMc && fillBackground) || !DoMc) && (ptCandBs >= ptMaxForDownSample || pseudoRndm < downSampleBkgFactor))) { float prong0MlScoreBkg = -1.; float prong0MlScorePrompt = -1.; float prong0MlScoreNonprompt = -1.; float candidateMlScoreSig = -1; - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { prong0MlScoreBkg = candidate.prong0MlScoreBkg(); prong0MlScorePrompt = candidate.prong0MlScorePrompt(); prong0MlScoreNonprompt = candidate.prong0MlScoreNonprompt(); } - if constexpr (withBsMl) { + if constexpr (WithBsMl) { candidateMlScoreSig = candidate.mlProbBsToDsPi()[1]; } auto prong1 = candidate.template prong1_as(); float ptMother = -1.; - if constexpr (doMc) { + if constexpr (DoMc) { ptMother = candidate.ptMother(); } @@ -623,9 +623,9 @@ struct HfTaskBsReduced { flagWrongCollision, ptMother); - if constexpr (withDecayTypeCheck) { + if constexpr (WithDecayTypeCheck) { float candidateMlScoreSig = -1; - if constexpr (withBsMl) { + if constexpr (WithBsMl) { candidateMlScoreSig = candidate.mlProbBsToDsPi()[1]; } hfRedBsMcCheck( @@ -663,7 +663,7 @@ struct HfTaskBsReduced { std::array ptProngs = {particle.ptProng0(), particle.ptProng1()}; std::array yProngs = {particle.yProng0(), particle.yProng1()}; std::array etaProngs = {particle.etaProng0(), particle.etaProng1()}; - bool prongsInAcc = isProngInAcceptance(etaProngs[0], ptProngs[0]) && isProngInAcceptance(etaProngs[1], ptProngs[1]); + bool const prongsInAcc = isProngInAcceptance(etaProngs[0], ptProngs[0]) && isProngInAcceptance(etaProngs[1], ptProngs[1]); if (fillHistograms) { registry.fill(HIST("hPtProng0Gen"), ptParticle, ptProngs[0]); diff --git a/PWGHF/D2H/Tasks/taskBsToJpsiPhiReduced.cxx b/PWGHF/D2H/Tasks/taskBsToJpsiPhiReduced.cxx index bf06d3c7295..d8d977a29bf 100644 --- a/PWGHF/D2H/Tasks/taskBsToJpsiPhiReduced.cxx +++ b/PWGHF/D2H/Tasks/taskBsToJpsiPhiReduced.cxx @@ -267,7 +267,7 @@ struct HfTaskBsToJpsiPhiReduced { o2::ccdb::CcdbApi ccdbApi; using TracksKaon = soa::Join; - std::vector outputMl = {}; + std::vector outputMl; // Filter filterSelectCandidates = (aod::hf_sel_candidate_bplus::isSelBsToJpsiPi >= selectionFlagBs); @@ -355,7 +355,7 @@ struct HfTaskBsToJpsiPhiReduced { /// Calculate pseudorapidity from track tan(lambda) /// \param tgl is the track tangent of the dip angle /// \return pseudorapidity - inline float absEta(float tgl) + float absEta(float tgl) { return std::abs(std::log(std::tan(o2::constants::math::PIQuarter - 0.5f * std::atan(tgl)))); } @@ -365,7 +365,7 @@ struct HfTaskBsToJpsiPhiReduced { /// \param withBsMl is the flag to enable the filling with ML scores for the Bs candidate /// \param candidate is the Bs candidate /// \param candidatesJpsi is the table with Jpsi candidates - template + template void fillCand(Cand const& candidate, aod::HfRedJpsis const& /*candidatesJpsi*/, aod::HfRedBach0Tracks const&, @@ -376,8 +376,8 @@ struct HfTaskBsToJpsiPhiReduced { auto candJpsi = candidate.template jpsi_as(); auto candKa0 = candidate.template prong0Phi_as(); auto candKa1 = candidate.template prong1Phi_as(); - std::array pVecKa0 = {candKa0.px(), candKa0.py(), candKa0.pz()}; - std::array pVecKa1 = {candKa1.px(), candKa1.py(), candKa1.pz()}; + std::array const pVecKa0 = {candKa0.px(), candKa0.py(), candKa0.pz()}; + std::array const pVecKa1 = {candKa1.px(), candKa1.py(), candKa1.pz()}; auto ptJpsi = candidate.ptProng0(); auto invMassJpsi = candJpsi.m(); auto invMassPhi = RecoDecay::m(std::array{pVecKa0, pVecKa1}, std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassKPlus}); @@ -385,7 +385,7 @@ struct HfTaskBsToJpsiPhiReduced { int8_t flagMcMatchRec{0}, flagMcDecayChanRec{0}, flagWrongCollision{0}; bool isSignal = false; - if constexpr (doMc) { + if constexpr (DoMc) { flagMcMatchRec = candidate.flagMcMatchRec(); flagMcDecayChanRec = candidate.flagMcDecayChanRec(); flagWrongCollision = candidate.flagWrongCollision(); @@ -421,7 +421,7 @@ struct HfTaskBsToJpsiPhiReduced { } float candidateMlScoreSig = -1; - if constexpr (withBsMl) { + if constexpr (WithBsMl) { // Bs ML selections std::vector inputFeatures = hfMlResponse.getInputFeatures(candidate, candKa0, candKa1); if (hfMlResponse.isSelectedMl(inputFeatures, ptCandBs, outputMl)) { @@ -436,7 +436,7 @@ struct HfTaskBsToJpsiPhiReduced { registry.fill(HIST("hMassJpsi"), invMassJpsi, candidate.ptProng0()); registry.fill(HIST("hMassPhi"), invMassPhi, candidate.ptProng0()); registry.fill(HIST("hd0K"), candidate.impactParameter1(), candidate.ptProng1()); - if constexpr (doMc) { + if constexpr (DoMc) { if (isSignal) { registry.fill(HIST("hMassRecSig"), invMassBs, ptCandBs); registry.fill(HIST("hMassJpsiRecSig"), invMassJpsi, candidate.ptProng0()); @@ -448,10 +448,10 @@ struct HfTaskBsToJpsiPhiReduced { } } - float pseudoRndm = ptJpsi * 1000. - static_cast(ptJpsi * 1000); + float const pseudoRndm = ptJpsi * 1000. - static_cast(ptJpsi * 1000); if (ptCandBs >= ptMaxForDownSample || pseudoRndm < downSampleBkgFactor) { float ptMother = -1.; - if constexpr (doMc) { + if constexpr (DoMc) { ptMother = candidate.ptMother(); } @@ -532,7 +532,7 @@ struct HfTaskBsToJpsiPhiReduced { } std::array ptProngs = {particle.ptProng0(), particle.ptProng1()}; std::array etaProngs = {particle.etaProng0(), particle.etaProng1()}; - bool prongsInAcc = isProngInAcceptance(etaProngs[0], ptProngs[0]) && isProngInAcceptance(etaProngs[1], ptProngs[1]); + bool const prongsInAcc = isProngInAcceptance(etaProngs[0], ptProngs[0]) && isProngInAcceptance(etaProngs[1], ptProngs[1]); registry.fill(HIST("hPtJpsiGen"), ptProngs[0], ptParticle); registry.fill(HIST("hPtKGen"), ptProngs[1], ptParticle); diff --git a/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx b/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx index f938e7497fc..60e8c1e6bb8 100644 --- a/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx +++ b/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx @@ -430,8 +430,8 @@ struct HfTaskCharmPolarisation { } } if (doprocessDstarMc || doprocessDstarMcWithMl || doprocessDstarMcInPbPb || doprocessDstarMcWithMlInPbPb || doprocessLcToPKPiMc || doprocessLcToPKPiMcWithMl || doprocessLcToPKPiBackgroundMcWithMl) { - std::vector hgenPromptAxes = {thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisCosThetaStarHelicity, thnAxisDausAcc, thnAxisResoChannelLc, thnAxisCharge}; - std::vector hgenNonPromptAxes = {thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisCosThetaStarHelicity, thnAxisPtB, thnAxisDausAcc, thnAxisResoChannelLc, thnAxisCharge}; + std::vector const hgenPromptAxes = {thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisCosThetaStarHelicity, thnAxisDausAcc, thnAxisResoChannelLc, thnAxisCharge}; + std::vector const hgenNonPromptAxes = {thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisCosThetaStarHelicity, thnAxisPtB, thnAxisDausAcc, thnAxisResoChannelLc, thnAxisCharge}; registry.add("hGenPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis and BDT scores for generated prompt D*+ candidates", HistType::kTHnSparseF, hgenPromptAxes); registry.add("hGenNonPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis and BDT scores for generated non-prompt D*+ candidates", HistType::kTHnSparseF, hgenNonPromptAxes); if (activatePartRecoDstar) { @@ -504,8 +504,8 @@ struct HfTaskCharmPolarisation { } } if (doprocessDstarMc || doprocessDstarMcWithMl || doprocessDstarMcInPbPb || doprocessDstarMcWithMlInPbPb || doprocessLcToPKPiMc || doprocessLcToPKPiMcWithMl || doprocessLcToPKPiBackgroundMcWithMl) { - std::vector hgenPromptAxes = {thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisCosThetaStarProduction, thnAxisDausAcc, thnAxisResoChannelLc, thnAxisCharge}; - std::vector hgenNonPromptAxes = {thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisCosThetaStarProduction, thnAxisPtB, thnAxisDausAcc, thnAxisResoChannelLc, thnAxisCharge}; + std::vector const hgenPromptAxes = {thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisCosThetaStarProduction, thnAxisDausAcc, thnAxisResoChannelLc, thnAxisCharge}; + std::vector const hgenNonPromptAxes = {thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisCosThetaStarProduction, thnAxisPtB, thnAxisDausAcc, thnAxisResoChannelLc, thnAxisCharge}; registry.add("hGenPromptProduction", "THn for polarisation studies with cosThStar w.r.t. production axis and BDT scores for generated prompt D*+ candidates", HistType::kTHnSparseF, hgenPromptAxes); registry.add("hGenNonPromptProduction", "THn for polarisation studies with cosThStar w.r.t. production axis and BDT scores for generated non-prompt D*+ candidates", HistType::kTHnSparseF, hgenNonPromptAxes); if (activatePartRecoDstar) { @@ -577,8 +577,8 @@ struct HfTaskCharmPolarisation { } } if (doprocessDstarMc || doprocessDstarMcWithMl || doprocessDstarMcInPbPb || doprocessDstarMcWithMlInPbPb || doprocessLcToPKPiMc || doprocessLcToPKPiMcWithMl || doprocessLcToPKPiBackgroundMcWithMl) { - std::vector hgenPromptAxes = {thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisCosThetaStarBeam, thnAxisDausAcc, thnAxisResoChannelLc, thnAxisCharge}; - std::vector hgenNonPromptAxes = {thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisCosThetaStarBeam, thnAxisPtB, thnAxisDausAcc, thnAxisResoChannelLc, thnAxisCharge}; + std::vector const hgenPromptAxes = {thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisCosThetaStarBeam, thnAxisDausAcc, thnAxisResoChannelLc, thnAxisCharge}; + std::vector const hgenNonPromptAxes = {thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisCosThetaStarBeam, thnAxisPtB, thnAxisDausAcc, thnAxisResoChannelLc, thnAxisCharge}; registry.add("hGenPromptBeam", "THn for polarisation studies with cosThStar w.r.t. beam axis and BDT scores for generated prompt D*+ candidates", HistType::kTHnSparseF, hgenPromptAxes); registry.add("hGenNonPromptBeam", "THn for polarisation studies with cosThStar w.r.t. beam axis and BDT scores for generated non-prompt D*+ candidates", HistType::kTHnSparseF, hgenNonPromptAxes); if (activatePartRecoDstar) { @@ -635,8 +635,8 @@ struct HfTaskCharmPolarisation { registry.add("hRandom", "THn for polarisation studies with cosThStar w.r.t. random axis and BDT scores", HistType::kTHnSparseF, hRandomaxes); } if (doprocessDstarMc || doprocessDstarMcWithMl || doprocessDstarMcInPbPb || doprocessDstarMcWithMlInPbPb || doprocessLcToPKPiMc || doprocessLcToPKPiMcWithMl || doprocessLcToPKPiBackgroundMcWithMl) { - std::vector hgenPromptAxes = {thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisCosThetaStarRandom, thnAxisDausAcc, thnAxisResoChannelLc, thnAxisCharge}; - std::vector hgenNonPromptAxes = {thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisCosThetaStarRandom, thnAxisPtB, thnAxisDausAcc, thnAxisResoChannelLc, thnAxisCharge}; + std::vector const hgenPromptAxes = {thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisCosThetaStarRandom, thnAxisDausAcc, thnAxisResoChannelLc, thnAxisCharge}; + std::vector const hgenNonPromptAxes = {thnAxisPt, thnAxisNumPvContributors, thnAxisY, thnAxisCosThetaStarRandom, thnAxisPtB, thnAxisDausAcc, thnAxisResoChannelLc, thnAxisCharge}; registry.add("hGenPromptRandom", "THn for polarisation studies with cosThStar w.r.t. random axis and BDT scores for generated prompt D*+ candidates", HistType::kTHnSparseF, hgenPromptAxes); registry.add("hGenNonPromptRandom", "THn for polarisation studies with cosThStar w.r.t. random axis and BDT scores for generated non-prompt D*+ candidates", HistType::kTHnSparseF, hgenNonPromptAxes); if (activatePartRecoDstar) { @@ -701,13 +701,13 @@ struct HfTaskCharmPolarisation { /// \param charge is the charge of the hadron /// \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 + template void fillRecoHistos(float invMassCharmHad, float ptCharmHad, int numPvContributors, float rapCharmHad, float invMassD0, float invMassKPiLc, float cosThetaStar, float phiEuler, std::array outputMl, int isRotatedCandidate, int8_t origin, float ptBhadMother, int8_t resoChannelLc, float absEtaMin, int numItsClsMin, int numTpcClsMin, int8_t charge, int8_t nMuons, bool isPartRecoDstar) { - if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::Helicity) { // Helicity - if constexpr (!doMc) { // data - if constexpr (withMl) { // with ML - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { + if constexpr (CosThetaStarType == charm_polarisation::CosThetaStarType::Helicity) { // Helicity + if constexpr (!DoMc) { // data + if constexpr (WithMl) { // with ML + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { if (activateTrackingSys) { if (nBkgRotations > 0) { registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); @@ -721,14 +721,14 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2]); } } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, charge); if (activateTHnEulerPhiMonitor) { registry.fill(HIST("hEulerPhiHelicity"), invMassCharmHad, ptCharmHad, invMassKPiLc, phiEuler, outputMl[0], /*outputMl[1],*/ outputMl[2], charge); } } } else { // without ML - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (activateTrackingSys) { if (nBkgRotations > 0) { registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); @@ -742,7 +742,7 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassD0, cosThetaStar); } } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassKPiLc, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, charge); if (activateTHnEulerPhiMonitor) { registry.fill(HIST("hEulerPhiHelicity"), invMassCharmHad, ptCharmHad, invMassKPiLc, phiEuler, charge); @@ -750,9 +750,9 @@ struct HfTaskCharmPolarisation { } } } else { // MC --> no distinction among channels, since rotational bkg not supported - if constexpr (withMl) { // with ML + if constexpr (WithMl) { // with ML if (origin == RecoDecay::OriginType::Prompt) { // prompt - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (activateTrackingSys) { if (!isPartRecoDstar) { registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, nMuons); @@ -766,14 +766,14 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hPartRecoPromptHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons); } } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); if (activateTHnEulerPhiMonitor) { registry.fill(HIST("hRecPromptEulerPhiHelicity"), invMassCharmHad, ptCharmHad, invMassKPiLc, phiEuler, outputMl[0], /*outputMl[1],*/ outputMl[2], resoChannelLc, charge); } } } else { // non-prompt - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (activateTrackingSys) { if (!isPartRecoDstar) { registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, nMuons, ptBhadMother); @@ -787,7 +787,7 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hPartRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, ptBhadMother); } } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); if (activateTHnEulerPhiMonitor) { registry.fill(HIST("hRecNonPromptEulerPhiHelicity"), invMassCharmHad, ptCharmHad, invMassKPiLc, phiEuler, outputMl[0], /*outputMl[1],*/ outputMl[2], resoChannelLc, charge); @@ -796,7 +796,7 @@ struct HfTaskCharmPolarisation { } } else { // without ML if (origin == RecoDecay::OriginType::Prompt) { // prompt - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (activateTrackingSys) { if (!isPartRecoDstar) { registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons); @@ -810,14 +810,14 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hPartRecoPromptHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, nMuons); } } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); if (activateTHnEulerPhiMonitor) { registry.fill(HIST("hRecPromptEulerPhiHelicity"), invMassCharmHad, ptCharmHad, invMassKPiLc, phiEuler, resoChannelLc, charge); } } } else { // non-prompt - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (activateTrackingSys) { if (!isPartRecoDstar) { registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, ptBhadMother); @@ -831,7 +831,7 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hPartRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, nMuons, ptBhadMother); } } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); if (activateTHnEulerPhiMonitor) { registry.fill(HIST("hRecNonPromptEulerPhiHelicity"), invMassCharmHad, ptCharmHad, invMassKPiLc, phiEuler, resoChannelLc, charge); @@ -840,10 +840,10 @@ struct HfTaskCharmPolarisation { } } } - } else if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::Production) { // Production - if constexpr (!doMc) { // data - if constexpr (withMl) { // with ML - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + } else if constexpr (CosThetaStarType == charm_polarisation::CosThetaStarType::Production) { // Production + if constexpr (!DoMc) { // data + if constexpr (WithMl) { // with ML + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (activateTrackingSys) { if (nBkgRotations > 0) { registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); @@ -857,14 +857,14 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2]); } } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, charge); if (activateTHnEulerPhiMonitor) { registry.fill(HIST("hEulerPhiProduction"), invMassCharmHad, ptCharmHad, invMassKPiLc, phiEuler, outputMl[0], /*outputMl[1],*/ outputMl[2], charge); } } } else { // without ML - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (activateTrackingSys) { if (nBkgRotations > 0) { registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); @@ -878,7 +878,7 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassD0, cosThetaStar); } } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassKPiLc, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, charge); if (activateTHnEulerPhiMonitor) { registry.fill(HIST("hEulerPhiProduction"), invMassCharmHad, ptCharmHad, invMassKPiLc, phiEuler, charge); @@ -886,9 +886,9 @@ struct HfTaskCharmPolarisation { } } } else { // MC --> no distinction among channels, since rotational bkg not supported - if constexpr (withMl) { // with ML + if constexpr (WithMl) { // with ML if (origin == RecoDecay::OriginType::Prompt) { // prompt - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (activateTrackingSys) { if (!isPartRecoDstar) { registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, nMuons); @@ -902,14 +902,14 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hPartRecoPromptProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons); } } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); if (activateTHnEulerPhiMonitor) { registry.fill(HIST("hRecPromptEulerPhiProduction"), invMassCharmHad, ptCharmHad, invMassKPiLc, phiEuler, outputMl[0], /*outputMl[1],*/ outputMl[2], resoChannelLc, charge); } } } else { // non-prompt - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (activateTrackingSys) { if (!isPartRecoDstar) { registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, nMuons, ptBhadMother); @@ -923,7 +923,7 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hPartRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, ptBhadMother); } } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); if (activateTHnEulerPhiMonitor) { registry.fill(HIST("hRecNonPromptEulerPhiProduction"), invMassCharmHad, ptCharmHad, invMassKPiLc, phiEuler, outputMl[0], /*outputMl[1],*/ outputMl[2], resoChannelLc, charge); @@ -932,7 +932,7 @@ struct HfTaskCharmPolarisation { } } else { // without ML if (origin == RecoDecay::OriginType::Prompt) { // prompt - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (activateTrackingSys) { if (!isPartRecoDstar) { registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons); @@ -946,14 +946,14 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hPartRecoPromptProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, nMuons); } } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); if (activateTHnEulerPhiMonitor) { registry.fill(HIST("hRecPromptEulerPhiProduction"), invMassCharmHad, ptCharmHad, invMassKPiLc, phiEuler, resoChannelLc, charge); } } } else { // non-prompt - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (activateTrackingSys) { if (!isPartRecoDstar) { registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, ptBhadMother); @@ -967,7 +967,7 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hPartRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, nMuons, ptBhadMother); } } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); if (activateTHnEulerPhiMonitor) { registry.fill(HIST("hRecNonPromptEulerPhiProduction"), invMassCharmHad, ptCharmHad, invMassKPiLc, phiEuler, resoChannelLc, charge); @@ -976,10 +976,10 @@ struct HfTaskCharmPolarisation { } } } - } else if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::Beam) { // Beam - if constexpr (!doMc) { // data - if constexpr (withMl) { // with ML - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + } else if constexpr (CosThetaStarType == charm_polarisation::CosThetaStarType::Beam) { // Beam + if constexpr (!DoMc) { // data + if constexpr (WithMl) { // with ML + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (activateTrackingSys) { if (nBkgRotations > 0) { registry.fill(HIST("hBeam"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); @@ -993,14 +993,14 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hBeam"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2]); } } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hBeam"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, charge); if (activateTHnEulerPhiMonitor) { registry.fill(HIST("hEulerPhiBeam"), invMassCharmHad, ptCharmHad, invMassKPiLc, phiEuler, outputMl[0], /*outputMl[1],*/ outputMl[2], charge); } } } else { // without ML - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (activateTrackingSys) { if (nBkgRotations > 0) { registry.fill(HIST("hBeam"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); @@ -1014,7 +1014,7 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hBeam"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassD0, cosThetaStar); } } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hBeam"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassKPiLc, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, charge); if (activateTHnEulerPhiMonitor) { registry.fill(HIST("hEulerPhiBeam"), invMassCharmHad, ptCharmHad, invMassKPiLc, phiEuler, charge); @@ -1022,9 +1022,9 @@ struct HfTaskCharmPolarisation { } } } else { // MC --> no distinction among channels, since rotational bkg not supported - if constexpr (withMl) { // with ML + if constexpr (WithMl) { // with ML if (origin == RecoDecay::OriginType::Prompt) { // prompt - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (activateTrackingSys) { if (!isPartRecoDstar) { registry.fill(HIST("hRecoPromptBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, nMuons); @@ -1038,14 +1038,14 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hPartRecoPromptBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons); } } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoPromptBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); if (activateTHnEulerPhiMonitor) { registry.fill(HIST("hRecPromptEulerPhiBeam"), invMassCharmHad, ptCharmHad, invMassKPiLc, phiEuler, outputMl[0], /*outputMl[1],*/ outputMl[2], resoChannelLc, charge); } } } else { // non-prompt - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (activateTrackingSys) { if (!isPartRecoDstar) { registry.fill(HIST("hRecoNonPromptBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, nMuons, ptBhadMother); @@ -1059,7 +1059,7 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hPartRecoNonPromptBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, ptBhadMother); } } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoNonPromptBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); if (activateTHnEulerPhiMonitor) { registry.fill(HIST("hRecNonPromptEulerPhiBeam"), invMassCharmHad, ptCharmHad, invMassKPiLc, phiEuler, outputMl[0], /*outputMl[1],*/ outputMl[2], resoChannelLc, charge); @@ -1068,7 +1068,7 @@ struct HfTaskCharmPolarisation { } } else { // without ML if (origin == RecoDecay::OriginType::Prompt) { // prompt - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (activateTrackingSys) { if (!isPartRecoDstar) { registry.fill(HIST("hRecoPromptBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons); @@ -1082,14 +1082,14 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hPartRecoPromptBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, nMuons); } } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoPromptBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); if (activateTHnEulerPhiMonitor) { registry.fill(HIST("hRecPromptEulerPhiBeam"), invMassCharmHad, ptCharmHad, invMassKPiLc, phiEuler, resoChannelLc, charge); } } } else { // non-prompt - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (activateTrackingSys) { if (!isPartRecoDstar) { registry.fill(HIST("hRecoNonPromptBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, ptBhadMother); @@ -1103,7 +1103,7 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hPartRecoNonPromptBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, nMuons, ptBhadMother); } } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoNonPromptBeam"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); if (activateTHnEulerPhiMonitor) { registry.fill(HIST("hRecNonPromptEulerPhiBeam"), invMassCharmHad, ptCharmHad, invMassKPiLc, phiEuler, resoChannelLc, charge); @@ -1112,10 +1112,10 @@ struct HfTaskCharmPolarisation { } } } - } else if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::Random) { // Random - if constexpr (!doMc) { // data - if constexpr (withMl) { // with ML - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + } else if constexpr (CosThetaStarType == charm_polarisation::CosThetaStarType::Random) { // Random + if constexpr (!DoMc) { // data + if constexpr (WithMl) { // with ML + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (activateTrackingSys) { if (nBkgRotations > 0) { registry.fill(HIST("hRandom"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); @@ -1129,11 +1129,11 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hRandom"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2]); } } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRandom"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, charge); } } else { // without ML - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (activateTrackingSys) { if (nBkgRotations > 0) { registry.fill(HIST("hRandom"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); @@ -1147,14 +1147,14 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hRandom"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassD0, cosThetaStar); } } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRandom"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassKPiLc, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, charge); } } } else { // MC --> no distinction among channels, since rotational bkg not supported - if constexpr (withMl) { // with ML + if constexpr (WithMl) { // with ML if (origin == RecoDecay::OriginType::Prompt) { // prompt - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (activateTrackingSys) { if (!isPartRecoDstar) { registry.fill(HIST("hRecoPromptRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, nMuons); @@ -1168,11 +1168,11 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hPartRecoPromptRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons); } } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoPromptRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); } } else { // non-prompt - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (activateTrackingSys) { if (!isPartRecoDstar) { registry.fill(HIST("hRecoNonPromptRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, nMuons, ptBhadMother); @@ -1186,38 +1186,38 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hPartRecoNonPromptRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, ptBhadMother); } } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoNonPromptRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); } } } else { // without ML if (origin == RecoDecay::OriginType::Prompt) { // prompt - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (!isPartRecoDstar) { registry.fill(HIST("hRecoPromptRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons); } else { registry.fill(HIST("hPartRecoPromptRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons); } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoPromptRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); } } else { // non-prompt - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (!isPartRecoDstar) { registry.fill(HIST("hRecoNonPromptRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, ptBhadMother); } else { registry.fill(HIST("hPartRecoNonPromptRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, ptBhadMother); } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoNonPromptRandom"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassKPiLc, cosThetaStar, resoChannelLc, absEtaMin, numItsClsMin, numTpcClsMin, charge); } } } } - } else if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::EP) { // EP - if constexpr (!doMc) { // data - if constexpr (withMl) { // with ML - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + } else if constexpr (CosThetaStarType == charm_polarisation::CosThetaStarType::EP) { // EP + if constexpr (!DoMc) { // data + if constexpr (WithMl) { // with ML + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (activateTrackingSys) { if (nBkgRotations > 0) { registry.fill(HIST("hEP"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); @@ -1233,7 +1233,7 @@ struct HfTaskCharmPolarisation { } } } else { - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (activateTrackingSys) { if (nBkgRotations > 0) { registry.fill(HIST("hEP"), invMassCharmHad, ptCharmHad, numPvContributors, std::abs(rapCharmHad), invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); @@ -1250,9 +1250,9 @@ struct HfTaskCharmPolarisation { } } } else { - if constexpr (withMl) { // with ML + if constexpr (WithMl) { // with ML if (origin == RecoDecay::OriginType::Prompt) { // prompt - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (activateTrackingSys) { if (!isPartRecoDstar) { registry.fill(HIST("hRecoPromptEP"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, nMuons); @@ -1268,7 +1268,7 @@ struct HfTaskCharmPolarisation { } } } else { // non-prompt - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ if (activateTrackingSys) { if (!isPartRecoDstar) { registry.fill(HIST("hRecoNonPromptEP"), invMassCharmHad, ptCharmHad, numPvContributors, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], absEtaMin, numItsClsMin, numTpcClsMin, nMuons, ptBhadMother); @@ -1298,10 +1298,10 @@ struct HfTaskCharmPolarisation { /// \param areDausInAcc is a flag indicating whether the daughters are in acceptance or not /// \param resoChannelLc indicates the Lc decay channel (direct, resonant) /// \param isPartRecoDstar is a flag indicating if it is a partly reconstructed Dstar->D0pi->Kpipipi0 meson (MC only) - template + template void fillGenHistos(float ptCharmHad, int numPvContributors, float rapCharmHad, float cosThetaStar, int8_t origin, float ptBhadMother, bool areDausInAcc, uint8_t resoChannelLc, int8_t charge, bool isPartRecoDstar) { - if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::Helicity) { // Helicity + if constexpr (CosThetaStarType == charm_polarisation::CosThetaStarType::Helicity) { // Helicity if (origin == RecoDecay::OriginType::Prompt) { // prompt if (!isPartRecoDstar) { registry.fill(HIST("hGenPromptHelicity"), ptCharmHad, numPvContributors, rapCharmHad, cosThetaStar, areDausInAcc, resoChannelLc, charge); @@ -1315,7 +1315,7 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hGenPartRecoNonPromptHelicity"), ptCharmHad, numPvContributors, rapCharmHad, cosThetaStar, ptBhadMother, areDausInAcc, resoChannelLc, charge); } } - } else if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::Production) { // Production + } else if constexpr (CosThetaStarType == charm_polarisation::CosThetaStarType::Production) { // Production if (origin == RecoDecay::OriginType::Prompt) { // prompt if (!isPartRecoDstar) { registry.fill(HIST("hGenPromptProduction"), ptCharmHad, numPvContributors, rapCharmHad, cosThetaStar, areDausInAcc, resoChannelLc, charge); @@ -1329,7 +1329,7 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hGenPartRecoNonPromptProduction"), ptCharmHad, numPvContributors, rapCharmHad, cosThetaStar, ptBhadMother, areDausInAcc, resoChannelLc, charge); } } - } else if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::Beam) { // Beam + } else if constexpr (CosThetaStarType == charm_polarisation::CosThetaStarType::Beam) { // Beam if (origin == RecoDecay::OriginType::Prompt) { // prompt if (!isPartRecoDstar) { registry.fill(HIST("hGenPromptBeam"), ptCharmHad, numPvContributors, rapCharmHad, cosThetaStar, areDausInAcc, resoChannelLc, charge); @@ -1343,7 +1343,7 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hGenPartRecoNonPromptBeam"), ptCharmHad, numPvContributors, rapCharmHad, cosThetaStar, ptBhadMother, areDausInAcc, resoChannelLc, charge); } } - } else if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::Random) { // Random + } else if constexpr (CosThetaStarType == charm_polarisation::CosThetaStarType::Random) { // Random if (origin == RecoDecay::OriginType::Prompt) { // prompt if (!isPartRecoDstar) { registry.fill(HIST("hGenPromptRandom"), ptCharmHad, numPvContributors, rapCharmHad, cosThetaStar, areDausInAcc, resoChannelLc, charge); @@ -1357,7 +1357,7 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hGenPartRecoNonPromptRandom"), ptCharmHad, numPvContributors, rapCharmHad, cosThetaStar, ptBhadMother, areDausInAcc, resoChannelLc, charge); } } - } else if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::EP) { // EP + } else if constexpr (CosThetaStarType == charm_polarisation::CosThetaStarType::EP) { // EP if (origin == RecoDecay::OriginType::Prompt) { // prompt if (!isPartRecoDstar) { registry.fill(HIST("hGenPromptEP"), ptCharmHad, numPvContributors, rapCharmHad, cosThetaStar, areDausInAcc, resoChannelLc, charge); @@ -1390,18 +1390,18 @@ struct HfTaskCharmPolarisation { /// \param invMass is the invariant mass /// \return true if candidate in signal region - template + template bool isInSignalRegion(float invMass) { float invMassMin = 0.f; float invMassMax = 100.f; - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ invMassMin = 0.142f; invMassMax = 0.15f; if (invMassMin < invMass && invMass < invMassMax) { return true; } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ (to be tuned!) + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ (to be tuned!) invMassMin = 2.25f; invMassMax = 2.35f; if (invMassMin < invMass && invMass < invMassMax) { @@ -1482,7 +1482,7 @@ struct HfTaskCharmPolarisation { { float xQVec = -999.; float yQVec = -999.; - float amplQVec = -999.; + float const amplQVec = -999.; switch (qVecDetector) { case charm_polarisation::QvecEstimator::FV0A: xQVec = collision.qvecFV0ARe(); @@ -1511,10 +1511,10 @@ struct HfTaskCharmPolarisation { /// \param particles are the generated particles /// \param tracks are the reconstructed tracks /// \return true if candidate in signal region - template + template bool runPolarisationAnalysis(Cand const& candidate, int bkgRotationId, int numPvContributors, Part const& particles, Trk const& /*tracks*/, QVecs const* qVecs = nullptr) { - if constexpr (withEP) { + if constexpr (WithEp) { assert(qVecs && "EP analysis requested but qVecs == nullptr"); } @@ -1527,22 +1527,22 @@ struct HfTaskCharmPolarisation { int8_t resoChannelLc = -1; int8_t charge = -99; bool partRecoDstar{false}; - if constexpr (doMc) { - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { + 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.flagMcMatchRecD0()) == hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiKPi0; - bool signalDstar = std::abs(candidate.flagMcMatchRec()) == hf_decay::hf_cand_dstar::DecayChannelMain::DstarToPiKPi && std::abs(candidate.flagMcMatchRecD0()) == hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK; + bool const signalDstar = std::abs(candidate.flagMcMatchRec()) == hf_decay::hf_cand_dstar::DecayChannelMain::DstarToPiKPi && std::abs(candidate.flagMcMatchRecD0()) == 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(); + int const 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; } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { - if constexpr (!studyLcPKPiBkgMc) { // skip this if studyLcPKPiBkgMc is true, since we are interested in background + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { + if constexpr (!StudyLcPkPiBkgMc) { // skip this if studyLcPKPiBkgMc is true, since we are interested in background if (std::abs(candidate.flagMcMatchRec()) != hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi) { // this candidate is not signal, skip return isCandidateInSignalRegion; } @@ -1557,12 +1557,12 @@ struct HfTaskCharmPolarisation { /// Lc electric charge from MC truth /// This is checked when the reconstructed 3-prong candidate is matched to MC with RecoDecay::getMatchedMCRec - int8_t flagMc = candidate.flagMcMatchRec(); + int8_t const flagMc = candidate.flagMcMatchRec(); charge = std::abs(flagMc) > 0 ? flagMc / std::abs(flagMc) : 0; /// 0 should never happen, debug protection } } else { /// data - if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { + if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { /// Calculate the electric charge from reconstructed daughter tracks /// Lc charge == first daughter charge auto trackProng0 = candidate.template prong0_as(); @@ -1581,7 +1581,7 @@ struct HfTaskCharmPolarisation { 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) { + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // Dstar analysis // polarization measured from the soft-pion daughter (*) @@ -1626,16 +1626,16 @@ struct HfTaskCharmPolarisation { } invMassCharmHadForSparse = invMassCharmHad - invMassD0; - if constexpr (withMl) { + if constexpr (WithMl) { outputMl[0] = candidate.mlProbDstarToD0Pi()[0]; outputMl[1] = candidate.mlProbDstarToD0Pi()[1]; outputMl[2] = candidate.mlProbDstarToD0Pi()[2]; } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc->pKpi analysis // polarization measured from the proton daughter (*) - if constexpr (doMc) { // we keep only the good hypo in the MC + if constexpr (DoMc) { // we keep only the good hypo in the MC if ((iMass == charm_polarisation::MassHyposLcToPKPi::PiKP && massHypoMcTruth == charm_polarisation::MassHyposLcToPKPi::PKPi) || (iMass == charm_polarisation::MassHyposLcToPKPi::PKPi && massHypoMcTruth == charm_polarisation::MassHyposLcToPKPi::PiKP)) { continue; } @@ -1683,7 +1683,7 @@ struct HfTaskCharmPolarisation { invMassCharmHad = hfHelper.invMassLcToPKPi(candidate); invMassCharmHadForSparse = hfHelper.invMassLcToPKPi(candidate); } - if constexpr (withMl) { + if constexpr (WithMl) { if (candidate.mlProbLcToPKPi().size() == NScores) { // protect from empty vectors // the BDT output score might be empty if no preselections were enabled (selectionFlag null) @@ -1717,7 +1717,7 @@ struct HfTaskCharmPolarisation { invMassCharmHad = hfHelper.invMassLcToPiKP(candidate); invMassCharmHadForSparse = hfHelper.invMassLcToPiKP(candidate); } - if constexpr (withMl) { + if constexpr (WithMl) { if (candidate.mlProbLcToPiKP().size() == NScores) { // protect from empty vectors // the BDT output score might be empty if no preselections were enabled (selectionFlag null) @@ -1755,9 +1755,9 @@ struct HfTaskCharmPolarisation { } /// control plots on pair masses - double invMass2KPiLc = invMassKPiLc * invMassKPiLc; - double invMass2PKLc = invMassPKLc * invMassPKLc; - double invMass2PPiLc = invMassPPiLc * invMassPPiLc; + double const invMass2KPiLc = invMassKPiLc * invMassKPiLc; + double const invMass2PKLc = invMassPKLc * invMassPKLc; + double const invMass2PPiLc = invMassPPiLc * invMassPPiLc; if (lcPKPiChannels.activateTHnLcChannelMonitor && bkgRotationId == 0) { /// fill Dalitz plot only for genuine candidates (i.e. non-rotated) registry.fill(HIST("hMass2PairsLcPKPi"), invMass2KPiLc, invMass2PKLc, invMass2PPiLc, candidate.pt()); @@ -1780,18 +1780,18 @@ struct HfTaskCharmPolarisation { continue; } - float phiRandom = gRandom->Uniform(0.f, constants::math::TwoPI); - float thetaRandom = gRandom->Uniform(0.f, constants::math::PI); - 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(); + float const phiRandom = gRandom->Uniform(0.f, constants::math::TwoPI); + float const thetaRandom = gRandom->Uniform(0.f, constants::math::PI); + ROOT::Math::PxPyPzMVector const fourVecDau = ROOT::Math::PxPyPzMVector(pxDau, pyDau, pzDau, massDau); + ROOT::Math::PxPyPzMVector const fourVecMother = ROOT::Math::PxPyPzMVector(pxCharmHad, pyCharmHad, pzCharmHad, invMassCharmHad); + ROOT::Math::Boost const boost{fourVecMother.BoostToCM()}; + ROOT::Math::PxPyPzMVector const fourVecDauCM = boost(fourVecDau); + ROOT::Math::XYZVector const threeVecDauCM = fourVecDauCM.Vect(); - float ptCharmHad = std::sqrt(pxCharmHad * pxCharmHad + pyCharmHad * pyCharmHad); // this definition is valid for both rotated and original candidates + float const 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); + isCandidateInSignalRegion = isInSignalRegion(invMassCharmHadForSparse); } float absEtaTrackMin{-1.f}; @@ -1800,47 +1800,47 @@ struct HfTaskCharmPolarisation { if (activateTrackingSys) { auto trackProng0 = candidate.template prong0_as(); auto trackProng1 = candidate.template prong1_as(); - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { auto trackProng2 = candidate.template prongPi_as(); getTrackingInfos(std::vector{trackProng0, trackProng1, trackProng2}, absEtaTrackMin, numItsClsMin, numTpcClsMin); - } else if (channel == charm_polarisation::DecayChannel::LcToPKPi) { + } else if (Channel == charm_polarisation::DecayChannel::LcToPKPi) { auto trackProng2 = candidate.template prong2_as(); getTrackingInfos(std::vector{trackProng0, trackProng1, trackProng2}, absEtaTrackMin, numItsClsMin, numTpcClsMin); } } // helicity - ROOT::Math::XYZVector helicityVec = fourVecMother.Vect(); + ROOT::Math::XYZVector const helicityVec = fourVecMother.Vect(); float cosThetaStarHelicity = -10.f; float phiHelicity = -10.f; // production - ROOT::Math::XYZVector normalVec = ROOT::Math::XYZVector(pyCharmHad, -pxCharmHad, 0.f); + ROOT::Math::XYZVector const normalVec = ROOT::Math::XYZVector(pyCharmHad, -pxCharmHad, 0.f); float cosThetaStarProduction = -10.f; float phiProduction = -10.f; // beam - ROOT::Math::XYZVector beamVec = ROOT::Math::XYZVector(0.f, 0.f, 1.f); + ROOT::Math::XYZVector const beamVec = ROOT::Math::XYZVector(0.f, 0.f, 1.f); float cosThetaStarBeam = -10.f; float phiBeam = -10.f; // random float cosThetaStarRandom = -10.f; int8_t nMuons{0u}; - if constexpr (doMc) { + if constexpr (DoMc) { nMuons = candidate.nTracksDecayed(); } - if constexpr (withEP && !doMc) { + if constexpr (WithEp && !DoMc) { /// EP analysis - float xQvec = (*qVecs).at(0); - float yQvec = (*qVecs).at(1); - ROOT::Math::XYZVector qVecNorm = ROOT::Math::XYZVector(yQvec, -xQvec, 0.f); + float const xQvec = (*qVecs).at(0); + float const yQvec = (*qVecs).at(1); + ROOT::Math::XYZVector const qVecNorm = ROOT::Math::XYZVector(yQvec, -xQvec, 0.f); float cosThetaStarEP = -10.f; - float phiEP = -99.f; + float const phiEP = -99.f; if (activateTHnSparseCosThStarEP) { // EP cosThetaStarEP = qVecNorm.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(qVecNorm.Mag2()); - fillRecoHistos(invMassCharmHadForSparse, ptCharmHad, numPvContributors, rapidity, invMassD0, invMassKPiLc, cosThetaStarEP, phiEP, outputMl, isRotatedCandidate, origin, ptBhadMother, resoChannelLc, absEtaTrackMin, numItsClsMin, numTpcClsMin, charge, nMuons, partRecoDstar); + fillRecoHistos(invMassCharmHadForSparse, ptCharmHad, numPvContributors, rapidity, invMassD0, invMassKPiLc, cosThetaStarEP, phiEP, outputMl, isRotatedCandidate, origin, ptBhadMother, resoChannelLc, absEtaTrackMin, numItsClsMin, numTpcClsMin, charge, nMuons, partRecoDstar); } } @@ -1848,31 +1848,31 @@ struct HfTaskCharmPolarisation { // helicity cosThetaStarHelicity = helicityVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(helicityVec.Mag2()); phiHelicity = std::atan2(beamVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()), normalVec.Dot(threeVecDauCM) / (std::sqrt(threeVecDauCM.Mag2()) * std::sqrt(normalVec.Mag2()))); - fillRecoHistos(invMassCharmHadForSparse, ptCharmHad, numPvContributors, rapidity, invMassD0, invMassKPiLc, cosThetaStarHelicity, phiHelicity, outputMl, isRotatedCandidate, origin, ptBhadMother, resoChannelLc, absEtaTrackMin, numItsClsMin, numTpcClsMin, charge, nMuons, partRecoDstar); + fillRecoHistos(invMassCharmHadForSparse, ptCharmHad, numPvContributors, rapidity, invMassD0, invMassKPiLc, cosThetaStarHelicity, phiHelicity, outputMl, isRotatedCandidate, origin, ptBhadMother, resoChannelLc, absEtaTrackMin, numItsClsMin, numTpcClsMin, charge, nMuons, partRecoDstar); } if (activateTHnSparseCosThStarProduction) { // production cosThetaStarProduction = normalVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(normalVec.Mag2()); phiProduction = std::atan2(normalVec.Dot(threeVecDauCM) / (std::sqrt(threeVecDauCM.Mag2()) * std::sqrt(normalVec.Mag2())), helicityVec.Dot(threeVecDauCM) / (std::sqrt(threeVecDauCM.Mag2()) * std::sqrt(helicityVec.Mag2()))); - fillRecoHistos(invMassCharmHadForSparse, ptCharmHad, numPvContributors, rapidity, invMassD0, invMassKPiLc, cosThetaStarProduction, phiProduction, outputMl, isRotatedCandidate, origin, ptBhadMother, resoChannelLc, absEtaTrackMin, numItsClsMin, numTpcClsMin, charge, nMuons, partRecoDstar); + fillRecoHistos(invMassCharmHadForSparse, ptCharmHad, numPvContributors, rapidity, invMassD0, invMassKPiLc, cosThetaStarProduction, phiProduction, outputMl, isRotatedCandidate, origin, ptBhadMother, resoChannelLc, absEtaTrackMin, numItsClsMin, numTpcClsMin, charge, nMuons, partRecoDstar); } if (activateTHnSparseCosThStarBeam) { // beam cosThetaStarBeam = beamVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()); phiBeam = std::atan2(helicityVec.Dot(threeVecDauCM) / (std::sqrt(threeVecDauCM.Mag2()) * std::sqrt(helicityVec.Mag2())), beamVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2())); - fillRecoHistos(invMassCharmHadForSparse, ptCharmHad, numPvContributors, rapidity, invMassD0, invMassKPiLc, cosThetaStarBeam, phiBeam, outputMl, isRotatedCandidate, origin, ptBhadMother, resoChannelLc, absEtaTrackMin, numItsClsMin, numTpcClsMin, charge, nMuons, partRecoDstar); + fillRecoHistos(invMassCharmHadForSparse, ptCharmHad, numPvContributors, rapidity, invMassD0, invMassKPiLc, cosThetaStarBeam, phiBeam, outputMl, isRotatedCandidate, origin, ptBhadMother, resoChannelLc, absEtaTrackMin, numItsClsMin, numTpcClsMin, charge, nMuons, partRecoDstar); } if (activateTHnSparseCosThStarRandom) { // random - ROOT::Math::XYZVector randomVec = ROOT::Math::XYZVector(std::sin(thetaRandom) * std::cos(phiRandom), std::sin(thetaRandom) * std::sin(phiRandom), std::cos(thetaRandom)); + ROOT::Math::XYZVector const randomVec = ROOT::Math::XYZVector(std::sin(thetaRandom) * std::cos(phiRandom), std::sin(thetaRandom) * std::sin(phiRandom), std::cos(thetaRandom)); cosThetaStarRandom = randomVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()); - fillRecoHistos(invMassCharmHadForSparse, ptCharmHad, numPvContributors, rapidity, invMassD0, invMassKPiLc, cosThetaStarRandom, -99.f, outputMl, isRotatedCandidate, origin, ptBhadMother, resoChannelLc, absEtaTrackMin, numItsClsMin, numTpcClsMin, charge, nMuons, partRecoDstar); + fillRecoHistos(invMassCharmHadForSparse, ptCharmHad, numPvContributors, rapidity, invMassD0, invMassKPiLc, cosThetaStarRandom, -99.f, outputMl, isRotatedCandidate, origin, ptBhadMother, resoChannelLc, absEtaTrackMin, numItsClsMin, numTpcClsMin, charge, nMuons, partRecoDstar); } /// Table for Lc->pKpi background studies /// Defined only in MC simulations, to study resonances and reflected signal - if constexpr (doMc && channel == charm_polarisation::DecayChannel::LcToPKPi) { - if constexpr (studyLcPKPiBkgMc) { + if constexpr (DoMc && Channel == charm_polarisation::DecayChannel::LcToPKPi) { + if constexpr (StudyLcPkPiBkgMc) { /****************************************************************************************** The code below can work only without grouping on "mcCollision". In fact, grouping by "mcCollision" introduces the following inconsistencies: @@ -1949,9 +1949,9 @@ struct HfTaskCharmPolarisation { originTriplet = RecoDecay::OriginType::Prompt; } else if (originProng0 == RecoDecay::OriginType::NonPrompt && originProng1 == RecoDecay::OriginType::NonPrompt && originProng2 == RecoDecay::OriginType::NonPrompt) { /// check if the three particles share the same B-hadron id. If yes: claim the triplet as "non-prompt" - int idBMotherProng0 = idxBhadMothersProng0.at(0); - int idBMotherProng1 = idxBhadMothersProng1.at(0); - int idBMotherProng2 = idxBhadMothersProng2.at(0); + int const idBMotherProng0 = idxBhadMothersProng0.at(0); + int const idBMotherProng1 = idxBhadMothersProng1.at(0); + int const idBMotherProng2 = idxBhadMothersProng2.at(0); if (idBMotherProng0 == idBMotherProng1 && idBMotherProng1 == idBMotherProng2) { originTriplet = RecoDecay::OriginType::NonPrompt; } @@ -1976,23 +1976,23 @@ struct HfTaskCharmPolarisation { int pdgMotherProng0 = -1; int pdgMotherProng1 = -1; int pdgMotherProng2 = -1; - bool atLeast2ProngsFromSameMother = (idMothersProng0.size() > 0 && idMothersProng1.size() > 0 && idMothersProng0.at(0) == idMothersProng1.at(0)) || - (idMothersProng1.size() > 0 && idMothersProng2.size() > 0 && idMothersProng1.at(0) == idMothersProng2.at(0)) || - (idMothersProng0.size() > 0 && idMothersProng2.size() > 0 && idMothersProng0.at(0) == idMothersProng2.at(0)); + bool const atLeast2ProngsFromSameMother = (!idMothersProng0.empty() && !idMothersProng1.empty() && idMothersProng0.at(0) == idMothersProng1.at(0)) || + (!idMothersProng1.empty() && !idMothersProng2.empty() && idMothersProng1.at(0) == idMothersProng2.at(0)) || + (!idMothersProng0.empty() && !idMothersProng2.empty() && idMothersProng0.at(0) == idMothersProng2.at(0)); if (atLeast2ProngsFromSameMother) { - if (idMothersProng0.size() > 0) { + if (!idMothersProng0.empty()) { /// BEWARE: in case of mcCollision grouping, the idMother can anyway point to a particle in another collision (*) /// therefore the rawIteratorAt call might crash the code because one goes above the (grouped) particles table size auto mother = particles.rawIteratorAt(idMothersProng0.at(0) - particles.offset()); pdgMotherProng0 = std::abs(mother.pdgCode()); // PDG code of the mother } - if (idMothersProng1.size() > 0) { + if (!idMothersProng1.empty()) { /// BEWARE: in case of mcCollision grouping, the idMother can anyway point to a particle in another collision (*) /// therefore the rawIteratorAt call might crash the code because one goes above the (grouped) particles table size auto mother = particles.rawIteratorAt(idMothersProng1.at(0) - particles.offset()); pdgMotherProng1 = std::abs(mother.pdgCode()); // PDG code of the mother } - if (idMothersProng2.size() > 0) { + if (!idMothersProng2.empty()) { /// BEWARE: in case of mcCollision grouping, the idMother can anyway point to a particle in another collision (*) /// therefore the rawIteratorAt call might crash the code because one goes above the (grouped) particles table size auto mother = particles.rawIteratorAt(idMothersProng2.at(0) - particles.offset()); @@ -2002,7 +2002,7 @@ struct HfTaskCharmPolarisation { /// calculate inv. masses for pairs, depending on mass hypothesis std::array pVecPion = {}; - std::array pVecKaon = candidate.pVectorProng1(); + std::array const pVecKaon = candidate.pVectorProng1(); std::array pVecProton = {}; if (iMass == charm_polarisation::MassHyposLcToPKPi::PKPi && candidate.isSelLcToPKPi() >= selectionFlagLcToPKPi) { pVecProton = candidate.pVectorProng0(); @@ -2053,13 +2053,13 @@ struct HfTaskCharmPolarisation { /// \param mcParticle is the Mc particle /// \param mcParticles is the table of Mc particles /// \param numPvContributors is the number of PV contributors in the associated reco collision - template + template void runMcGenPolarisationAnalysis(Part const& mcParticle, Particles const& mcParticles, int numPvContributors, Cent const* centrality = nullptr) { - if constexpr (withCent) { + if constexpr (WithCent) { assert(qVecs && "Centrality analysis requested but Cent == nullptr"); } - if constexpr (withCent) { + if constexpr (WithCent) { if (*centrality < centralityMin || *centrality > centralityMax) { return; // skip this collision if outside of the centrality range } @@ -2073,9 +2073,9 @@ struct HfTaskCharmPolarisation { int8_t resoChannelLc = -1; int8_t charge = -99; bool partRecoDstar{false}; - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { + if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { partRecoDstar = (std::abs(mcParticle.flagMcMatchGen()) == hf_decay::hf_cand_dstar::DecayChannelMain::DstarToPiKPiPi0) && (std::abs(mcParticle.flagMcMatchGenD0()) == hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiKPi0); - bool signalDstar = (std::abs(mcParticle.flagMcMatchGen()) == hf_decay::hf_cand_dstar::DecayChannelMain::DstarToPiKPi) && (std::abs(mcParticle.flagMcMatchGenD0()) == hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK); + bool const signalDstar = (std::abs(mcParticle.flagMcMatchGen()) == hf_decay::hf_cand_dstar::DecayChannelMain::DstarToPiKPi) && (std::abs(mcParticle.flagMcMatchGenD0()) == hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK); if (!signalDstar && (!activatePartRecoDstar || !partRecoDstar)) { // this particle is not signal and not partially reconstructed signal, skip return; @@ -2083,48 +2083,48 @@ struct HfTaskCharmPolarisation { origin = mcParticle.originMcGen(); if (origin == RecoDecay::OriginType::NonPrompt) { auto bHadMother = mcParticles.rawIteratorAt(mcParticle.idxBhadMotherPart() - mcParticles.offset()); - int pdgBhadMother = std::abs(bHadMother.pdgCode()); + int const 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) { // o2-linter: disable=pdg/explicit-code, magic-number (constants not in the PDG header) + if (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; } ptBhadMother = bHadMother.pt(); } - std::array dauPdgs = {kPiPlus, o2::constants::physics::Pdg::kD0}; + std::array const dauPdgs = {kPiPlus, o2::constants::physics::Pdg::kD0}; RecoDecay::getDaughters(mcParticle, &listDaughters, dauPdgs, 1); massDau = massPi; massCharmHad = massDstar; - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { if (std::abs(mcParticle.flagMcMatchGen()) != hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi) { // this particle is not signal, skip return; } origin = mcParticle.originMcGen(); resoChannelLc = mcParticle.flagMcDecayChanGen(); - std::array dauPdgs = {kProton, -kKPlus, kPiPlus}; + std::array const dauPdgs = {kProton, -kKPlus, kPiPlus}; RecoDecay::getDaughters(mcParticle, &listDaughters, dauPdgs, 2); massDau = massProton; massCharmHad = massLc; /// electric charge from PDG code - int pdgCode = mcParticle.pdgCode(); + int const pdgCode = mcParticle.pdgCode(); charge = static_cast(pdgCode / std::abs(pdgCode)); } - float rapidity = mcParticle.y(); + float const 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 const pxCharmHad = mcParticle.px(); + float const pyCharmHad = mcParticle.py(); + float const pzCharmHad = mcParticle.pz(); + float const 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 constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { if (std::abs(dauPart.pdgCode()) == kPiPlus) { pxDau = dauPart.px(); pyDau = dauPart.py(); @@ -2134,16 +2134,14 @@ struct HfTaskCharmPolarisation { } } else if (areDauInAcc) { // check also D0 daughters std::vector listDaughtersD0{}; - std::array dauPdgsD0 = {kPiPlus, -kKPlus}; + std::array const 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); - } + areDauInAcc = isDaughterInAcceptance(dauPartD0, 0.3, 0.8); } } - } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { + } else if constexpr (Channel == charm_polarisation::DecayChannel::LcToPKPi) { if (std::abs(dauPart.pdgCode()) == kProton) { pxDau = dauPart.px(); pyDau = dauPart.py(); @@ -2155,32 +2153,32 @@ struct HfTaskCharmPolarisation { } } - float phiRandom = gRandom->Uniform(0.f, constants::math::TwoPI); - float thetaRandom = gRandom->Uniform(0.f, constants::math::PI); - 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(); + float const phiRandom = gRandom->Uniform(0.f, constants::math::TwoPI); + float const thetaRandom = gRandom->Uniform(0.f, constants::math::PI); + ROOT::Math::PxPyPzMVector const fourVecDau = ROOT::Math::PxPyPzMVector(pxDau, pyDau, pzDau, massDau); + ROOT::Math::PxPyPzMVector const fourVecMother = ROOT::Math::PxPyPzMVector(pxCharmHad, pyCharmHad, pzCharmHad, massCharmHad); + ROOT::Math::Boost const boost{fourVecMother.BoostToCM()}; + ROOT::Math::PxPyPzMVector const fourVecDauCM = boost(fourVecDau); + ROOT::Math::XYZVector const threeVecDauCM = fourVecDauCM.Vect(); if (activateTHnSparseCosThStarHelicity) { - ROOT::Math::XYZVector helicityVec = fourVecMother.Vect(); - float cosThetaStarHelicity = helicityVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(helicityVec.Mag2()); + ROOT::Math::XYZVector const helicityVec = fourVecMother.Vect(); + float const cosThetaStarHelicity = helicityVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(helicityVec.Mag2()); fillGenHistos(ptCharmHad, numPvContributors, rapidity, cosThetaStarHelicity, origin, ptBhadMother, areDauInAcc, resoChannelLc, 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()); + ROOT::Math::XYZVector const normalVec = ROOT::Math::XYZVector(pyCharmHad, -pxCharmHad, 0.f); + float const cosThetaStarProduction = normalVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(normalVec.Mag2()); fillGenHistos(ptCharmHad, numPvContributors, rapidity, cosThetaStarProduction, origin, ptBhadMother, areDauInAcc, resoChannelLc, charge, partRecoDstar); } if (activateTHnSparseCosThStarBeam) { - ROOT::Math::XYZVector beamVec = ROOT::Math::XYZVector(0.f, 0.f, 1.f); - float cosThetaStarBeam = beamVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()); + ROOT::Math::XYZVector const beamVec = ROOT::Math::XYZVector(0.f, 0.f, 1.f); + float const cosThetaStarBeam = beamVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()); fillGenHistos(ptCharmHad, numPvContributors, rapidity, cosThetaStarBeam, origin, ptBhadMother, areDauInAcc, resoChannelLc, charge, partRecoDstar); } if (activateTHnSparseCosThStarRandom) { - ROOT::Math::XYZVector randomVec = ROOT::Math::XYZVector(std::sin(thetaRandom) * std::cos(phiRandom), std::sin(thetaRandom) * std::sin(phiRandom), std::cos(thetaRandom)); - float cosThetaStarRandom = randomVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()); + ROOT::Math::XYZVector const randomVec = ROOT::Math::XYZVector(std::sin(thetaRandom) * std::cos(phiRandom), std::sin(thetaRandom) * std::sin(phiRandom), std::cos(thetaRandom)); + float const cosThetaStarRandom = randomVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()); fillGenHistos(ptCharmHad, numPvContributors, rapidity, cosThetaStarRandom, origin, ptBhadMother, areDauInAcc, resoChannelLc, charge, partRecoDstar); } } @@ -2196,7 +2194,7 @@ struct HfTaskCharmPolarisation { { for (const auto& collision : collisions) { auto thisCollId = collision.globalIndex(); - int numPvContributors = collision.numContrib(); + int const numPvContributors = collision.numContrib(); auto groupedDstarCandidates = dstarCandidates.sliceBy(dstarPerCollision, thisCollId); int nCands{0}, nCandsInSignalRegion{0}; @@ -2222,7 +2220,7 @@ struct HfTaskCharmPolarisation { { for (const auto& collision : collisions) { auto thisCollId = collision.globalIndex(); - int numPvContributors = collision.numContrib(); + int const numPvContributors = collision.numContrib(); auto groupedDstarCandidates = dstarCandidates.sliceBy(dstarWithMlPerCollision, thisCollId); int nCands{0}, nCandsInSignalRegion{0}; @@ -2251,7 +2249,7 @@ struct HfTaskCharmPolarisation { int numPvContributorsGen{0}; for (const auto& collision : collisions) { // loop over reco collisions associated to this gen collision auto thisCollId = collision.globalIndex(); - int numPvContributors = collision.numContrib(); + int const numPvContributors = collision.numContrib(); auto groupedDstarCandidates = dstarCandidates.sliceBy(dstarWithMcPerCollision, thisCollId); int nCands{0}, nCandsInSignalRegion{0}; @@ -2284,7 +2282,7 @@ struct HfTaskCharmPolarisation { int numPvContributorsGen{0}; for (const auto& collision : collisions) { // loop over reco collisions associated to this gen collision auto thisCollId = collision.globalIndex(); - int numPvContributors = collision.numContrib(); + int const numPvContributors = collision.numContrib(); auto groupedDstarCandidates = dstarCandidates.sliceBy(dstarWithMcAndMlPerCollision, thisCollId); int nCands{0}, nCandsInSignalRegion{0}; @@ -2320,11 +2318,11 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hCentrality"), centrality); auto thisCollId = collision.globalIndex(); - int numPvContributors = collision.numContrib(); + int const numPvContributors = collision.numContrib(); auto groupedDstarCandidates = dstarCandidates.sliceBy(dstarPerCollision, thisCollId); int nCands{0}, nCandsInSignalRegion{0}; - std::vector qVecs = getQVec(collision); + std::vector const qVecs = getQVec(collision); for (const auto& dstarCandidate : groupedDstarCandidates) { nCands++; @@ -2350,11 +2348,11 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hCentrality"), centrality); auto thisCollId = collision.globalIndex(); - int numPvContributors = collision.numContrib(); + int const numPvContributors = collision.numContrib(); auto groupedDstarCandidates = dstarCandidates.sliceBy(dstarWithMlPerCollision, thisCollId); int nCands{0}, nCandsInSignalRegion{0}; - std::vector qVecs = getQVec(collision); + std::vector const qVecs = getQVec(collision); for (const auto& dstarCandidate : groupedDstarCandidates) { nCands++; @@ -2384,7 +2382,7 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hCentrality"), centrality); auto thisCollId = collision.globalIndex(); - int numPvContributors = collision.numContrib(); + int const numPvContributors = collision.numContrib(); auto groupedDstarCandidates = dstarCandidates.sliceBy(dstarWithMcPerCollision, thisCollId); int nCands{0}, nCandsInSignalRegion{0}; @@ -2402,7 +2400,7 @@ struct HfTaskCharmPolarisation { } for (const auto& mcParticle : mcParticles) { const auto& recoCollsPerMcColl = collisions.sliceBy(colPerMcCollision, mcParticle.mcCollision().globalIndex()); - float cent = o2::hf_centrality::getCentralityGenColl(recoCollsPerMcColl, centEstimator); + float const cent = o2::hf_centrality::getCentralityGenColl(recoCollsPerMcColl, centEstimator); runMcGenPolarisationAnalysis(mcParticle, mcParticles, numPvContributorsGen, ¢); } } @@ -2425,7 +2423,7 @@ struct HfTaskCharmPolarisation { registry.fill(HIST("hCentrality"), centrality); auto thisCollId = collision.globalIndex(); - int numPvContributors = collision.numContrib(); + int const numPvContributors = collision.numContrib(); auto groupedDstarCandidates = dstarCandidates.sliceBy(dstarWithMcAndMlPerCollision, thisCollId); int nCands{0}, nCandsInSignalRegion{0}; @@ -2443,7 +2441,7 @@ struct HfTaskCharmPolarisation { } for (const auto& mcParticle : mcParticles) { const auto& recoCollsPerMcColl = collisions.sliceBy(colPerMcCollision, mcParticle.mcCollision().globalIndex()); - float cent = o2::hf_centrality::getCentralityGenColl(recoCollsPerMcColl, centEstimator); + float const cent = o2::hf_centrality::getCentralityGenColl(recoCollsPerMcColl, centEstimator); runMcGenPolarisationAnalysis(mcParticle, mcParticles, numPvContributorsGen, ¢); } } @@ -2460,7 +2458,7 @@ struct HfTaskCharmPolarisation { { for (const auto& collision : collisions) { auto thisCollId = collision.globalIndex(); - int numPvContributors = collision.numContrib(); + int const numPvContributors = collision.numContrib(); auto groupedLcCandidates = lcCandidates.sliceBy(lcToPKPiPerCollision, thisCollId); int nCands{0}, nCandsInSignalRegion{0}; @@ -2487,7 +2485,7 @@ struct HfTaskCharmPolarisation { { for (const auto& collision : collisions) { auto thisCollId = collision.globalIndex(); - int numPvContributors = collision.numContrib(); + int const numPvContributors = collision.numContrib(); auto groupedLcCandidates = lcCandidates.sliceBy(lcToPKPiWithMlPerCollision, thisCollId); int nCands{0}, nCandsInSignalRegion{0}; @@ -2517,7 +2515,7 @@ struct HfTaskCharmPolarisation { int numPvContributorsGen{0}; for (const auto& collision : collisions) { // loop over reco collisions associated to this gen collision auto thisCollId = collision.globalIndex(); - int numPvContributors = collision.numContrib(); + int const numPvContributors = collision.numContrib(); auto groupedLcCandidates = lcCandidates.sliceBy(lcToPKPiWithMcAndMlPerCollision, thisCollId); int nCands{0}, nCandsInSignalRegion{0}; @@ -2550,7 +2548,7 @@ struct HfTaskCharmPolarisation { int numPvContributorsGen{0}; for (const auto& collision : collisions) { // loop over reco collisions associated to this gen collision auto thisCollId = collision.globalIndex(); - int numPvContributors = collision.numContrib(); + int const numPvContributors = collision.numContrib(); auto groupedLcCandidates = lcCandidates.sliceBy(lcToPKPiWithMcAndMlPerCollision, thisCollId); int nCands{0}, nCandsInSignalRegion{0}; diff --git a/PWGHF/D2H/Tasks/taskCharmResoToDTrkReduced.cxx b/PWGHF/D2H/Tasks/taskCharmResoToDTrkReduced.cxx index 362933d9124..be096e1da49 100644 --- a/PWGHF/D2H/Tasks/taskCharmResoToDTrkReduced.cxx +++ b/PWGHF/D2H/Tasks/taskCharmResoToDTrkReduced.cxx @@ -204,14 +204,14 @@ struct HfTaskCharmResoToDTrkReduced { /// \param coll is a reduced collision /// \param bach0 is a bachelor of the candidate /// \param bach1 is a bachelor of the candidate - template + template void fillCand(const Cand& candidate, const Coll& collision, const CharmBach& bach0, const TrkBach& bach1) { // Base float massReso{0}, cosThetaStar{0}; int8_t sign{0}; float tpcNSigmaBach1{0}, tofNSigmaBach1{0}, tpcTofNSigmaBach1{0}; - if constexpr (channel == DecayChannel::D0Kplus) { + if constexpr (Channel == DecayChannel::D0Kplus) { massReso = useDeltaMass ? candidate.invMass() + MassD0 : candidate.invMass(); cosThetaStar = RecoDecay::cosThetaStar(std::array{bach0.pVector(), bach1.pVector()}, std::array{MassD0, MassKPlus}, massReso, 0); tpcNSigmaBach1 = bach1.tpcNSigmaKa(); @@ -229,7 +229,7 @@ struct HfTaskCharmResoToDTrkReduced { float ptGen{-1.}, invMassGen{-1}; int8_t origin{0}, flagMcMatchRec{0}, flagCharmBach{0}, flagCharmBachInterm{0}; int debugMcRec{-1}; - if constexpr (doMc) { + if constexpr (DoMc) { ptGen = candidate.ptGen(); origin = candidate.origin(); flagMcMatchRec = candidate.flagMcMatchRec(); @@ -238,7 +238,7 @@ struct HfTaskCharmResoToDTrkReduced { flagCharmBach = candidate.flagMcMatchRecD(); flagCharmBachInterm = candidate.flagMcMatchChanD(); if (fillOnlySignal) { - if (channel == DecayChannel::D0Kplus && + if (Channel == DecayChannel::D0Kplus && !hf_decay::hf_cand_reso::particlesToD0Kplus.contains(static_cast(std::abs(flagMcMatchRec)))) { return; } @@ -252,8 +252,8 @@ struct HfTaskCharmResoToDTrkReduced { // Ml float mlScoreBkg{-1.}, mlScorePrompt{-1.}, mlScoreNonPrompt{-1.}; - if constexpr (withMl) { - if constexpr (channel == DecayChannel::D0Kplus) { + if constexpr (WithMl) { + if constexpr (Channel == DecayChannel::D0Kplus) { if (bach1.sign() > 0 && !doWrongSign) { mlScoreBkg = bach0.mlScoreBkgMassHypo0(); mlScorePrompt = bach0.mlScorePromptMassHypo0(); @@ -334,7 +334,7 @@ struct HfTaskCharmResoToDTrkReduced { /// \param CharmBach is the reduced 3 prong table /// \param TrkBach is the reduced v0 table /// \param Cand is the candidates table - template + template void processData(Coll const&, Candidates const& candidates, CharmBach const&, aod::HfRedTrkNoParams const&) { for (const auto& cand : candidates) { @@ -347,13 +347,14 @@ struct HfTaskCharmResoToDTrkReduced { } if (doWrongSign && cand.isWrongSign() == 0) { continue; - } else if (!doWrongSign && cand.isWrongSign() != 0) { + } + if (!doWrongSign && cand.isWrongSign() != 0) { continue; } float massReso{0}; if (useDeltaMass) { - switch (channel) { + switch (Channel) { case DecayChannel::D0Kplus: massReso = cand.invMass() + MassD0; break; @@ -369,7 +370,7 @@ struct HfTaskCharmResoToDTrkReduced { auto coll = cand.template hfRedCollision_as(); auto bach0 = cand.template prong0_as(); auto bach1 = cand.template prong1_as(); - fillCand(cand, coll, bach0, bach1); + fillCand(cand, coll, bach0, bach1); } } @@ -384,7 +385,7 @@ struct HfTaskCharmResoToDTrkReduced { } /// Fill particle histograms (gen MC truth) - template + template void fillCandMcGen(aod::HfMcGenRedResos const& mcParticles) { for (const auto& particle : mcParticles) { @@ -394,8 +395,8 @@ struct HfTaskCharmResoToDTrkReduced { auto flag = particle.flagMcMatchGen(); std::array ptProngs = {particle.ptProng0(), particle.ptProng1()}; std::array etaProngs = {particle.etaProng0(), particle.etaProng1()}; - bool prongsInAcc = isProngInAcceptance(etaProngs[0], ptProngs[0]) && isProngInAcceptance(etaProngs[1], ptProngs[1]); - if (channel == DecayChannel::D0Kplus && + bool const prongsInAcc = isProngInAcceptance(etaProngs[0], ptProngs[0]) && isProngInAcceptance(etaProngs[1], ptProngs[1]); + if (Channel == DecayChannel::D0Kplus && !hf_decay::hf_cand_reso::particlesToD0Kplus.contains(static_cast(std::abs(flag)))) { continue; } diff --git a/PWGHF/D2H/Tasks/taskCharmResoToDV0Reduced.cxx b/PWGHF/D2H/Tasks/taskCharmResoToDV0Reduced.cxx index 360b8a3002f..4c01573ace8 100644 --- a/PWGHF/D2H/Tasks/taskCharmResoToDV0Reduced.cxx +++ b/PWGHF/D2H/Tasks/taskCharmResoToDV0Reduced.cxx @@ -30,6 +30,8 @@ #include #include +#include + #include #include #include @@ -221,7 +223,7 @@ struct HfTaskCharmResoToDV0Reduced { /// \param coll is a reduced collision /// \param bach0 is a bachelor of the candidate /// \param bach1 is a bachelor of the candidate - template + template void fillCand(const Cand& candidate, const Coll& collision, const CharmBach& bach0, const V0Bach& bach1) { // Base @@ -229,22 +231,22 @@ struct HfTaskCharmResoToDV0Reduced { int8_t sign{0}; int itsNClsSoftPi{0}, tpcNClsCrossedRowsSoftPi{0}; float tpcChi2NClSoftPi{0.}; - if constexpr (channel == DecayChannel::DstarK0s) { + if constexpr (Channel == DecayChannel::DstarK0s) { sign = bach0.sign(); massReso = useDeltaMass ? candidate.invMass() + MassDStar : candidate.invMass(); cosThetaStar = RecoDecay::cosThetaStar(std::array{bach0.pVector(), bach1.pVector()}, std::array{MassDStar, MassK0}, massReso, 0); itsNClsSoftPi = bach0.itsNClsSoftPi(); tpcNClsCrossedRowsSoftPi = bach0.tpcNClsCrossedRowsSoftPi(); tpcChi2NClSoftPi = bach0.tpcChi2NClSoftPi(); - } else if constexpr (channel == DecayChannel::DplusK0s) { + } else if constexpr (Channel == DecayChannel::DplusK0s) { sign = bach0.sign(); massReso = useDeltaMass ? candidate.invMass() + MassDPlus : candidate.invMass(); cosThetaStar = RecoDecay::cosThetaStar(std::array{bach0.pVector(), bach1.pVector()}, std::array{MassDPlus, MassK0}, massReso, 0); - } else if constexpr (channel == DecayChannel::DplusLambda) { + } else if constexpr (Channel == DecayChannel::DplusLambda) { sign = bach0.sign(); massReso = useDeltaMass ? candidate.invMass() + MassDPlus : candidate.invMass(); cosThetaStar = RecoDecay::cosThetaStar(std::array{bach0.pVector(), bach1.pVector()}, std::array{MassDPlus, MassLambda0}, massReso, 0); - } else if constexpr (channel == DecayChannel::D0Lambda) { + } else if constexpr (Channel == DecayChannel::D0Lambda) { massReso = useDeltaMass ? candidate.invMass() + MassD0 : candidate.invMass(); cosThetaStar = RecoDecay::cosThetaStar(std::array{bach0.pVector(), bach1.pVector()}, std::array{MassD0, MassLambda0}, massReso, 0); } @@ -258,7 +260,7 @@ struct HfTaskCharmResoToDV0Reduced { float ptGen{-1.}, invMassGen{-1}; int8_t origin{0}, flagMcMatchRec{0}, flagCharmBach{0}, flagCharmBachInterm{0}; int debugMcRec{-1}; - if constexpr (doMc) { + if constexpr (DoMc) { ptGen = candidate.ptGen(); origin = candidate.origin(); flagMcMatchRec = candidate.flagMcMatchRec(); @@ -267,17 +269,20 @@ struct HfTaskCharmResoToDV0Reduced { flagCharmBach = candidate.flagMcMatchRecD(); flagCharmBachInterm = candidate.flagMcMatchChanD(); if (fillOnlySignal) { - if (channel == DecayChannel::DstarK0s && + if (Channel == DecayChannel::DstarK0s && !hf_decay::hf_cand_reso::particlesToDstarK0s.contains(static_cast(std::abs(flagMcMatchRec)))) { return; - } else if (channel == DecayChannel::DplusK0s && - !hf_decay::hf_cand_reso::particlesToDplusK0s.contains(static_cast(std::abs(flagMcMatchRec)))) { + } + if (Channel == DecayChannel::DplusK0s && + !hf_decay::hf_cand_reso::particlesToDplusK0s.contains(static_cast(std::abs(flagMcMatchRec)))) { return; - } else if (channel == DecayChannel::DplusLambda && - !hf_decay::hf_cand_reso::particlesToDplusLambda.contains(static_cast(std::abs(flagMcMatchRec)))) { + } + if (Channel == DecayChannel::DplusLambda && + !hf_decay::hf_cand_reso::particlesToDplusLambda.contains(static_cast(std::abs(flagMcMatchRec)))) { return; - } else if (channel == DecayChannel::D0Lambda && - !hf_decay::hf_cand_reso::particlesToD0Lambda.contains(static_cast(std::abs(flagMcMatchRec)))) { + } + if (Channel == DecayChannel::D0Lambda && + !hf_decay::hf_cand_reso::particlesToD0Lambda.contains(static_cast(std::abs(flagMcMatchRec)))) { return; } } @@ -290,8 +295,8 @@ struct HfTaskCharmResoToDV0Reduced { // Ml float mlScoreBkg{-1.}, mlScorePrompt{-1.}, mlScoreNonPrompt{-1.}; - if constexpr (withMl) { - if constexpr (channel == DecayChannel::D0Lambda) { + if constexpr (WithMl) { + if constexpr (Channel == DecayChannel::D0Lambda) { if (TESTBIT(bach1.v0Type(), BachelorType::Lambda) && !doWrongSign) { mlScoreBkg = bach0.mlScoreBkgMassHypo0(); mlScorePrompt = bach0.mlScorePromptMassHypo0(); @@ -377,7 +382,7 @@ struct HfTaskCharmResoToDV0Reduced { /// \param CharmBach is the reduced 3 prong table /// \param V0Bach is the reduced v0 table /// \param Cand is the candidates table - template + template void processData(Coll const&, Candidates const& candidates, CharmBach const&, aod::HfRedVzeros const&) { for (const auto& cand : candidates) { @@ -390,13 +395,14 @@ struct HfTaskCharmResoToDV0Reduced { } if (doWrongSign && cand.isWrongSign() == 0) { continue; - } else if (!doWrongSign && cand.isWrongSign() != 0) { + } + if (!doWrongSign && cand.isWrongSign() != 0) { continue; } float massReso{0}; if (useDeltaMass) { - switch (channel) { + switch (Channel) { case DecayChannel::DstarK0s: massReso = cand.invMass() + MassDStar; break; @@ -421,7 +427,7 @@ struct HfTaskCharmResoToDV0Reduced { auto coll = cand.template hfRedCollision_as(); auto bach0 = cand.template prong0_as(); auto bach1 = cand.template prong1_as(); - fillCand(cand, coll, bach0, bach1); + fillCand(cand, coll, bach0, bach1); } } @@ -436,7 +442,7 @@ struct HfTaskCharmResoToDV0Reduced { } /// Fill particle histograms (gen MC truth) - template + template void fillCandMcGen(aod::HfMcGenRedResos const& mcParticles) { for (const auto& particle : mcParticles) { @@ -446,18 +452,21 @@ struct HfTaskCharmResoToDV0Reduced { auto flag = particle.flagMcMatchGen(); std::array ptProngs = {particle.ptProng0(), particle.ptProng1()}; std::array etaProngs = {particle.etaProng0(), particle.etaProng1()}; - bool prongsInAcc = isProngInAcceptance(etaProngs[0], ptProngs[0]) && isProngInAcceptance(etaProngs[1], ptProngs[1]); - if (channel == DecayChannel::DstarK0s && + bool const prongsInAcc = isProngInAcceptance(etaProngs[0], ptProngs[0]) && isProngInAcceptance(etaProngs[1], ptProngs[1]); + if (Channel == DecayChannel::DstarK0s && !hf_decay::hf_cand_reso::particlesToDstarK0s.contains(static_cast(std::abs(flag)))) { continue; - } else if (channel == DecayChannel::DplusK0s && - !hf_decay::hf_cand_reso::particlesToDplusK0s.contains(static_cast(std::abs(flag)))) { + } + if (Channel == DecayChannel::DplusK0s && + !hf_decay::hf_cand_reso::particlesToDplusK0s.contains(static_cast(std::abs(flag)))) { continue; - } else if (channel == DecayChannel::DplusLambda && - !hf_decay::hf_cand_reso::particlesToDplusLambda.contains(static_cast(std::abs(flag)))) { + } + if (Channel == DecayChannel::DplusLambda && + !hf_decay::hf_cand_reso::particlesToDplusLambda.contains(static_cast(std::abs(flag)))) { continue; - } else if (channel == DecayChannel::D0Lambda && - !hf_decay::hf_cand_reso::particlesToD0Lambda.contains(static_cast(std::abs(flag)))) { + } + if (Channel == DecayChannel::D0Lambda && + !hf_decay::hf_cand_reso::particlesToD0Lambda.contains(static_cast(std::abs(flag)))) { continue; } registry.fill(HIST("hYGenAll"), ptParticle, yParticle); diff --git a/PWGHF/D2H/Tasks/taskD0.cxx b/PWGHF/D2H/Tasks/taskD0.cxx index 3e4be3ca15c..e5ed97171b1 100644 --- a/PWGHF/D2H/Tasks/taskD0.cxx +++ b/PWGHF/D2H/Tasks/taskD0.cxx @@ -321,7 +321,7 @@ struct HfTaskD0 { } } - template + template void processData(CandType const& candidates, CollType const&, aod::TracksWExtra const&) @@ -335,7 +335,7 @@ struct HfTaskD0 { } float massD0, massD0bar; - if constexpr (reconstructionType == aod::hf_cand::VertexerType::KfParticle) { + if constexpr (ReconstructionType == aod::hf_cand::VertexerType::KfParticle) { massD0 = candidate.kfGeoMassD0(); massD0bar = candidate.kfGeoMassD0bar(); } else { @@ -397,9 +397,9 @@ struct HfTaskD0 { auto trackPos = candidate.template prong0_as(); // positive daughter auto trackNeg = candidate.template prong1_as(); // negative daughter - int minItsClustersOfProngs = std::min(trackPos.itsNCls(), trackNeg.itsNCls()); - int minTpcCrossedRowsOfProngs = std::min(trackPos.tpcNClsCrossedRows(), trackNeg.tpcNClsCrossedRows()); - if constexpr (applyMl) { + int const minItsClustersOfProngs = std::min(trackPos.itsNCls(), trackNeg.itsNCls()); + int const minTpcCrossedRowsOfProngs = std::min(trackPos.tpcNClsCrossedRows(), trackNeg.tpcNClsCrossedRows()); + if constexpr (ApplyMl) { if (storeCentrality && storeOccupancy) { if (candidate.isSelD0() >= selectionFlagD0) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent, occ); @@ -534,7 +534,7 @@ struct HfTaskD0 { PROCESS_SWITCH(HfTaskD0, processDataWithKFParticleMl, "process taskD0 with KFParticle and ML selections", false); // TODO: add processKFParticleMlCent - template + template void processMc(CandType const& candidates, soa::Join const& mcParticles, TracksSelQuality const&, @@ -561,7 +561,7 @@ struct HfTaskD0 { occ = o2::hf_occupancy::getOccupancyColl(collision, occEstimator); } float massD0, massD0bar; - if constexpr (reconstructionType == aod::hf_cand::VertexerType::KfParticle) { + if constexpr (ReconstructionType == aod::hf_cand::VertexerType::KfParticle) { massD0 = candidate.kfGeoMassD0(); massD0bar = candidate.kfGeoMassD0bar(); } else { @@ -660,8 +660,8 @@ struct HfTaskD0 { auto ctCandidate = hfHelper.ctD0(candidate); auto cpaCandidate = candidate.cpa(); auto cpaxyCandidate = candidate.cpaXY(); - int minItsClustersOfProngs = std::min(trackPos.itsNCls(), trackNeg.itsNCls()); - int minTpcCrossedRowsOfProngs = std::min(trackPos.tpcNClsCrossedRows(), trackNeg.tpcNClsCrossedRows()); + int const minItsClustersOfProngs = std::min(trackPos.itsNCls(), trackNeg.itsNCls()); + int const minTpcCrossedRowsOfProngs = std::min(trackPos.tpcNClsCrossedRows(), trackNeg.tpcNClsCrossedRows()); if (candidate.isSelD0() >= selectionFlagD0) { registry.fill(HIST("hMassSigBkgD0"), massD0, ptCandidate, rapidityCandidate); if (candidate.flagMcMatchRec() == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { @@ -688,7 +688,7 @@ struct HfTaskD0 { registry.fill(HIST("hDecLengthVsPtSig"), declengthCandidate, ptCandidate); registry.fill(HIST("hDecLengthxyVsPtSig"), declengthxyCandidate, ptCandidate); registry.fill(HIST("hMassSigD0"), massD0, ptCandidate, rapidityCandidate); - if constexpr (applyMl) { + if constexpr (ApplyMl) { if (storeCentrality && storeOccupancy) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); } else if (storeCentrality && !storeOccupancy) { @@ -730,7 +730,7 @@ struct HfTaskD0 { registry.fill(HIST("hMassBkgD0"), massD0, ptCandidate, rapidityCandidate); if (candidate.flagMcMatchRec() == -o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { registry.fill(HIST("hMassReflBkgD0"), massD0, ptCandidate, rapidityCandidate); - if constexpr (applyMl) { + if constexpr (ApplyMl) { if (storeCentrality && storeOccupancy) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); } else if (storeCentrality && !storeOccupancy) { @@ -762,7 +762,7 @@ struct HfTaskD0 { registry.fill(HIST("hMassSigBkgD0bar"), massD0bar, ptCandidate, rapidityCandidate); if (candidate.flagMcMatchRec() == -o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { registry.fill(HIST("hMassSigD0bar"), massD0bar, ptCandidate, rapidityCandidate); - if constexpr (applyMl) { + if constexpr (ApplyMl) { if (storeCentrality && storeOccupancy) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); } else if (storeCentrality && !storeOccupancy) { @@ -791,7 +791,7 @@ struct HfTaskD0 { registry.fill(HIST("hMassBkgD0bar"), massD0bar, ptCandidate, rapidityCandidate); if (candidate.flagMcMatchRec() == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { registry.fill(HIST("hMassReflBkgD0bar"), massD0bar, ptCandidate, rapidityCandidate); - if constexpr (applyMl) { + if constexpr (ApplyMl) { if (storeCentrality && storeOccupancy) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); } else if (storeCentrality && !storeOccupancy) { diff --git a/PWGHF/D2H/Tasks/taskDirectedFlowCharmHadrons.cxx b/PWGHF/D2H/Tasks/taskDirectedFlowCharmHadrons.cxx index 23afd2c23ba..417c03ab8a6 100644 --- a/PWGHF/D2H/Tasks/taskDirectedFlowCharmHadrons.cxx +++ b/PWGHF/D2H/Tasks/taskDirectedFlowCharmHadrons.cxx @@ -201,12 +201,12 @@ struct HfTaskDirectedFlowCharmHadrons { /// Compute the scalar product /// \param collision is the collision with the Q vector information and event plane /// \param candidates are the selected candidates - template + template void runFlowAnalysis(CollsWithQvecs::iterator const& collision, T1 const& candidates, Trk const& /*tracks*/) { - double cent = getCentrality(collision); + double const cent = getCentrality(collision); if (cent < centralityMin || cent > centralityMax) { return; } @@ -258,18 +258,20 @@ struct HfTaskDirectedFlowCharmHadrons { auto trackprong0 = candidate.template prong0_as(); sign = trackprong0.sign(); if constexpr (std::is_same_v) { - for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDplusToPiKPi()[classMl->at(iclass)]; + } } } else if constexpr (std::is_same_v || std::is_same_v) { - switch (channel) { + switch (Channel) { case DecayChannel::D0ToPiK: massCand = hfHelper.invMassD0ToPiK(candidate); rapCand = hfHelper.yD0(candidate); sign = candidate.isSelD0bar() ? 3 : 1; // 3: reflected D0bar, 1: pure D0 excluding reflected D0bar if constexpr (std::is_same_v) { - for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbD0()[classMl->at(iclass)]; + } } break; case DecayChannel::D0ToKPi: @@ -277,8 +279,9 @@ struct HfTaskDirectedFlowCharmHadrons { rapCand = hfHelper.yD0(candidate); sign = candidate.isSelD0() ? 3 : 2; // 3: reflected D0, 2: pure D0bar excluding reflected D0 if constexpr (std::is_same_v) { - for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbD0bar()[classMl->at(iclass)]; + } } break; default: @@ -294,22 +297,25 @@ struct HfTaskDirectedFlowCharmHadrons { rapCand = candidate.y(candidate.invMassAntiDstar()); } if constexpr (std::is_same_v) { - for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDstarToD0Pi()[classMl->at(iclass)]; + } } } - double ptCand = candidate.pt(); + double const ptCand = candidate.pt(); double etaCand = candidate.eta(); - double phiCand = candidate.phi(); - double cosNPhi = std::cos(phiCand); - double sinNPhi = std::sin(phiCand); + double const phiCand = candidate.phi(); + double const cosNPhi = std::cos(phiCand); + double const sinNPhi = std::sin(phiCand); - if (userap) + if (userap) { etaCand = rapCand; + } - if (selectionFlagDstar) + if (selectionFlagDstar) { sign = signDstarCand; + } auto ux = cosNPhi; // real part of candidate q vector auto uy = sinNPhi; // imaginary part of candidate q vector diff --git a/PWGHF/D2H/Tasks/taskDplus.cxx b/PWGHF/D2H/Tasks/taskDplus.cxx index 18e2e59b26d..7a4851d4766 100644 --- a/PWGHF/D2H/Tasks/taskDplus.cxx +++ b/PWGHF/D2H/Tasks/taskDplus.cxx @@ -130,17 +130,17 @@ struct HfTaskDplus { LOGP(fatal, "Only one process function should be enabled! Please check your configuration!"); } auto vbins = static_cast>(binsPt); - AxisSpec thnAxisPt = {vbins, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec thnAxisMass = {600, 1.67, 2.27, "inv. mass (K#pi#pi) (GeV/#it{c}^{2})"}; - AxisSpec thnAxisY = {thnConfigAxisY, "y"}; - AxisSpec thnAxisMlScore0 = {thnConfigAxisMlScore0, "Score 0"}; - AxisSpec thnAxisMlScore1 = {thnConfigAxisMlScore1, "Score 1"}; - AxisSpec thnAxisMlScore2 = {thnConfigAxisMlScore2, "Score 2"}; - AxisSpec thnAxisPtBHad{thnConfigAxisPtBHad, "#it{p}_{T,B} (GeV/#it{c})"}; - AxisSpec thnAxisFlagBHad{thnConfigAxisFlagBHad, "B Hadron flag"}; - AxisSpec thnAxisCent{thnConfigAxisCent, "Centrality"}; - AxisSpec thnAxisOccupancy{thnConfigAxisOccupancy, "Occupancy"}; - AxisSpec thnAxisPvContributors{thnConfigAxisPvContributors, "PV contributors"}; + AxisSpec const thnAxisPt = {vbins, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec const thnAxisMass = {600, 1.67, 2.27, "inv. mass (K#pi#pi) (GeV/#it{c}^{2})"}; + AxisSpec const thnAxisY = {thnConfigAxisY, "y"}; + AxisSpec const thnAxisMlScore0 = {thnConfigAxisMlScore0, "Score 0"}; + AxisSpec const thnAxisMlScore1 = {thnConfigAxisMlScore1, "Score 1"}; + AxisSpec const thnAxisMlScore2 = {thnConfigAxisMlScore2, "Score 2"}; + AxisSpec const thnAxisPtBHad{thnConfigAxisPtBHad, "#it{p}_{T,B} (GeV/#it{c})"}; + AxisSpec const thnAxisFlagBHad{thnConfigAxisFlagBHad, "B Hadron flag"}; + AxisSpec const thnAxisCent{thnConfigAxisCent, "Centrality"}; + AxisSpec const thnAxisOccupancy{thnConfigAxisOccupancy, "Occupancy"}; + AxisSpec const thnAxisPvContributors{thnConfigAxisPvContributors, "PV contributors"}; registry.add("hMass", "3-prong candidates;inv. mass (#pi K #pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{350, 1.7, 2.05}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hEta", "3-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); @@ -247,7 +247,7 @@ struct HfTaskDplus { template void fillHisto(const T1& candidate) { - float pt = candidate.pt(); + float const pt = candidate.pt(); registry.fill(HIST("hMass"), hfHelper.invMassDplusToPiKPi(candidate), pt); registry.fill(HIST("hPt"), pt); registry.fill(HIST("hEta"), candidate.eta(), pt); @@ -280,7 +280,7 @@ struct HfTaskDplus { /// \param centrality collision centrality /// \param occupancy collision occupancy /// \param numPvContributors contributors to the PV - template + template void fillSparseML(const T1& candidate, float ptbhad, int flagBHad, @@ -292,8 +292,8 @@ struct HfTaskDplus { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDplusToPiKPi()[classMl->at(iclass)]; } - if constexpr (isMc) { // MC - if constexpr (isMatched) { // Matched + if constexpr (IsMc) { // MC + if constexpr (IsMatched) { // Matched if (candidate.originMcRec() == RecoDecay::OriginType::Prompt) { // Prompt if (storeCentrality && storeOccupancy) { @@ -367,10 +367,10 @@ struct HfTaskDplus { // Fill histograms of quantities for the reconstructed Dplus candidates with MC matching /// \param candidate is candidate - template + template void fillHistoMCRec(const T1& candidate) { - if constexpr (isMatched) { + if constexpr (IsMatched) { auto ptRec = candidate.pt(); auto yRec = hfHelper.yDplus(candidate); registry.fill(HIST("hPtVsYRecSig_RecoSkim"), ptRec, yRec); @@ -479,15 +479,15 @@ struct HfTaskDplus { // Run analysis for the reconstructed Dplus candidates from data /// \param candidates are reconstructed candidates - template + template void runDataAnalysis(const T1& /*candidates*/, CollisionsCent const& /*colls*/) { float cent{-1.f}; float occ{-1.f}; float numPvContr{-1.f}; float ptBhad{-1.f}; - int flagBHad{-1}; - if constexpr (!fillMl) { + int const flagBHad{-1}; + if constexpr (!FillMl) { for (const auto& candidate : selectedDPlusCandidates) { if ((yCandRecoMax >= 0. && std::abs(hfHelper.yDplus(candidate)) > yCandRecoMax)) { continue; @@ -522,7 +522,7 @@ struct HfTaskDplus { // Run analysis for the reconstructed Dplus candidates with MC matching /// \param recoCandidates are reconstructed candidates /// \param recoColls are reconstructed collisions - template + template void runAnalysisMcRec(McRecoCollisionsCent const& /*recoColls*/) { float cent{-1}; @@ -532,7 +532,7 @@ struct HfTaskDplus { int flagBHad{-1}; // MC rec. w/o Ml - if constexpr (!fillMl) { + if constexpr (!FillMl) { for (const auto& candidate : recoDPlusCandidates) { if ((yCandRecoMax >= 0. && std::abs(hfHelper.yDplus(candidate)) > yCandRecoMax)) { continue; @@ -565,9 +565,9 @@ struct HfTaskDplus { occ = o2::hf_occupancy::getOccupancyColl(collision, occEstimator); } } - if (storePvContributors) { - numPvContr = collision.numContrib(); - } + if (storePvContributors) { + numPvContr = collision.numContrib(); + } fillHisto(candidate); fillHistoMCRec(candidate); fillSparseML(candidate, ptBhad, flagBHad, cent, occ, numPvContr); @@ -601,7 +601,7 @@ struct HfTaskDplus { /// \param mcGenCollisions are the generated MC collisions /// \param mcRecoCollisions are the reconstructed MC collisions /// \param mcGenParticles are the generated MC particle candidates - template + template void runAnalysisMcGen(aod::McCollisions const& mcGenCollisions, McRecoCollisionsCent const& mcRecoCollisions, Cand const& mcGenParticles) @@ -640,7 +640,7 @@ struct HfTaskDplus { numPvContr = std::max(numPvContr, recCol.numContrib()); } fillHistoMCGen(particle); - if constexpr (fillMl) { + if constexpr (FillMl) { fillSparseMcGen(particle, ptGenB, flagGenB, cent, occ, numPvContr); } } diff --git a/PWGHF/D2H/Tasks/taskDs.cxx b/PWGHF/D2H/Tasks/taskDs.cxx index 2621b1e1163..eb93b29ba17 100644 --- a/PWGHF/D2H/Tasks/taskDs.cxx +++ b/PWGHF/D2H/Tasks/taskDs.cxx @@ -166,24 +166,24 @@ struct HfTaskDs { ConfigurableAxis axisOccupancy{"axisOccupancy", {14, 0., 14000.}, "axis for occupancy"}; int mRunNumber{0}; - bool lCalibLoaded; - TList* lCalibObjects; - TProfile* hVtxZFT0A; - TProfile* hVtxZFT0C; - TProfile* hVtxZNTracks; + bool lCalibLoaded{}; + TList* lCalibObjects{}; + TProfile* hVtxZFT0A{}; + TProfile* hVtxZFT0C{}; + TProfile* hVtxZNTracks{}; HistogramRegistry registry{"registry", {}}; std::array folders = {"Data/", "MC/Ds/Prompt/", "MC/Ds/NonPrompt/", "MC/Dplus/Prompt/", "MC/Dplus/NonPrompt/", "MC/Dplus/Bkg/", "MC/Lc/", "MC/Bkg/"}; - std::unordered_map dataHistograms = {}; - std::unordered_map mcDsPromptHistograms = {}; - std::unordered_map mcDsNonPromptHistograms = {}; - std::unordered_map mcDplusPromptHistograms = {}; - std::unordered_map mcDplusNonPromptHistograms = {}; - std::unordered_map mcDplusBkgHistograms = {}; - std::unordered_map mcLcBkgHistograms = {}; - std::unordered_map mcBkgHistograms = {}; + std::unordered_map dataHistograms; + std::unordered_map mcDsPromptHistograms; + std::unordered_map mcDsNonPromptHistograms; + std::unordered_map mcDplusPromptHistograms; + std::unordered_map mcDplusNonPromptHistograms; + std::unordered_map mcDplusBkgHistograms; + std::unordered_map mcLcBkgHistograms; + std::unordered_map mcBkgHistograms; std::array, DataType::kDataTypes> histosPtr = {dataHistograms, mcDsPromptHistograms, mcDsNonPromptHistograms, mcDplusPromptHistograms, mcDplusNonPromptHistograms, mcDplusBkgHistograms, mcLcBkgHistograms, mcBkgHistograms}; @@ -202,17 +202,17 @@ struct HfTaskDs { LOGP(fatal, "Invalid value of decayChannel"); } - AxisSpec ptbins{axisPt, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec ptBHad{axisPtBHad, "#it{p}_{T}(B) (GeV/#it{c})"}; - AxisSpec flagBHad{axisFlagBHad, "B Hadron flag"}; + AxisSpec const ptbins{axisPt, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec const ptBHad{axisPtBHad, "#it{p}_{T}(B) (GeV/#it{c})"}; + AxisSpec const flagBHad{axisFlagBHad, "B Hadron flag"}; AxisSpec ybins = {100, -5., 5, "#it{y}"}; - AxisSpec massbins = {600, 1.67, 2.27, "inv. mass (KK#pi) (GeV/#it{c}^{2})"}; - AxisSpec centralitybins = {axisCentrality, "Centrality"}; - AxisSpec npvcontributorsbins = {axisNPvContributors, "NPvContributors"}; - AxisSpec mlscore0bins = {axisMlScore0, "Score 0"}; - AxisSpec mlscore1bins = {axisMlScore1, "Score 1"}; - AxisSpec mlscore2bins = {axisMlScore2, "Score 2"}; - AxisSpec occupancybins = {axisOccupancy, "Occupancy"}; + AxisSpec const massbins = {600, 1.67, 2.27, "inv. mass (KK#pi) (GeV/#it{c}^{2})"}; + AxisSpec const centralitybins = {axisCentrality, "Centrality"}; + AxisSpec const npvcontributorsbins = {axisNPvContributors, "NPvContributors"}; + AxisSpec const mlscore0bins = {axisMlScore0, "Score 0"}; + AxisSpec const mlscore1bins = {axisMlScore1, "Score 1"}; + AxisSpec const mlscore2bins = {axisMlScore2, "Score 2"}; + AxisSpec const occupancybins = {axisOccupancy, "Occupancy"}; histosPtr[DataType::Data]["hNPvContribAll"] = registry.add((folders[DataType::Data] + "hNPvContribAll").c_str(), "3-prong candidates;NPvContributors;Centrality;Entries", HistType::kTH2F, {axisNPvContributors, {100, 0., 100}}); @@ -352,8 +352,8 @@ struct HfTaskDs { template bool isCandInSignalRegion(const CandDs& candidate, bool isDs) { - bool isKKPi = candidate.isSelDsToKKPi() >= selectionFlagDs; - float invMass = isKKPi ? hfHelper.invMassDsToKKPi(candidate) : hfHelper.invMassDsToPiKK(candidate); + bool const isKKPi = candidate.isSelDsToKKPi() >= selectionFlagDs; + float const invMass = isKKPi ? hfHelper.invMassDsToKKPi(candidate) : hfHelper.invMassDsToPiKK(candidate); if (isDs && (invMass < massDsSignalMin || invMass > massDsSignalMax)) { return false; } @@ -366,24 +366,24 @@ struct HfTaskDs { /// Evaluate centrality/multiplicity percentile using FT0M estimator /// \param candidate is candidate /// \return centrality/multiplicity percentile of the collision - template + template float getZEqMultColl(const Coll& collision, uint8_t nProngsContributorsPV) { auto multFT0A = collision.multFT0A() - nProngsContributorsPV; auto multFT0C = collision.multFT0C() - nProngsContributorsPV; - float multZeqFT0A = hVtxZFT0A->Interpolate(0.0) * multFT0A / hVtxZFT0A->Interpolate(collision.posZ()); - float multZeqFT0C = hVtxZFT0C->Interpolate(0.0) * multFT0C / hVtxZFT0C->Interpolate(collision.posZ()); + float const multZeqFT0A = hVtxZFT0A->Interpolate(0.0) * multFT0A / hVtxZFT0A->Interpolate(collision.posZ()); + float const multZeqFT0C = hVtxZFT0C->Interpolate(0.0) * multFT0C / hVtxZFT0C->Interpolate(collision.posZ()); return multZeqFT0A + multZeqFT0C; } /// Evaluate centrality/multiplicity percentile using NTracksPV estimator /// \param candidate is candidate /// \return centrality/multiplicity percentile of the collision - template + template float getZEqMultColl(const Coll& collision, uint8_t nProngsContributorsPV) { auto multNTracksPV = collision.multNTracksPV() - nProngsContributorsPV; - float multZeqNTracksPV = hVtxZNTracks->Interpolate(0.0) * multNTracksPV / hVtxZNTracks->Interpolate(collision.posZ()); + float const multZeqNTracksPV = hVtxZNTracks->Interpolate(0.0) * multNTracksPV / hVtxZNTracks->Interpolate(collision.posZ()); return multZeqNTracksPV; } @@ -404,9 +404,8 @@ struct HfTaskDs { { if (fillPercentiles) { return o2::hf_centrality::getCentralityColl(collision); - } else { - return getZEqMultColl(collision, candidate.nProngsContributorsPV()); } + return getZEqMultColl(collision, candidate.nProngsContributorsPV()); } /// Evaluate centrality/multiplicity percentile (centrality estimator is automatically selected based on the used table) @@ -417,9 +416,8 @@ struct HfTaskDs { { if (fillPercentiles) { return o2::hf_centrality::getCentralityColl(collision); - } else { - return getZEqMultColl(collision, 0); } + return getZEqMultColl(collision, 0); } /// Evaluate centrality/multiplicity percentile @@ -460,15 +458,13 @@ struct HfTaskDs { std::get(histosPtr[dataType]["hd0Prong0"])->Fill(candidate.impactParameter0(), pt); std::get(histosPtr[dataType]["hd0Prong1"])->Fill(candidate.impactParameter1(), pt); std::get(histosPtr[dataType]["hd0Prong2"])->Fill(candidate.impactParameter2(), pt); - - return; } /// Fill mass sparse if ML information is present /// \param candidate is candidate /// \param dataType is data class, as defined in DataType enum /// \param finalState is either KKPi or PiKK, as defined in FinalState enum - template + template void fillSparse(const Cand& candidate, DataType dataType, FinalState finalState) { auto mass = finalState == FinalState::KKPi ? hfHelper.invMassDsToKKPi(candidate) : hfHelper.invMassDsToPiKK(candidate); @@ -487,29 +483,25 @@ struct HfTaskDs { if (storeOccupancy) { std::get(histosPtr[dataType]["hSparseMass"])->Fill(mass, pt, evaluateCentralityCand(candidate), outputMl[0], outputMl[1], outputMl[2], o2::hf_occupancy::getOccupancyColl(candidate.template collision_as(), occEstimator)); return; - } else { - std::get(histosPtr[dataType]["hSparseMass"])->Fill(mass, pt, evaluateCentralityCand(candidate), outputMl[0], outputMl[1], outputMl[2]); - return; } + std::get(histosPtr[dataType]["hSparseMass"])->Fill(mass, pt, evaluateCentralityCand(candidate), outputMl[0], outputMl[1], outputMl[2]); + return; } - if constexpr (isMc) { + if constexpr (IsMc) { if (dataType == DataType::McDsNonPrompt || dataType == DataType::McDplusNonPrompt) { if (storeOccupancy) { std::get(histosPtr[dataType]["hSparseMass"])->Fill(mass, pt, evaluateCentralityCand(candidate), outputMl[0], outputMl[1], outputMl[2], candidate.template collision_as().numContrib(), candidate.ptBhadMotherPart(), getBHadMotherFlag(candidate.pdgBhadMotherPart()), o2::hf_occupancy::getOccupancyColl(candidate.template collision_as(), occEstimator)); return; - } else { - std::get(histosPtr[dataType]["hSparseMass"])->Fill(mass, pt, evaluateCentralityCand(candidate), outputMl[0], outputMl[1], outputMl[2], candidate.template collision_as().numContrib(), candidate.ptBhadMotherPart(), getBHadMotherFlag(candidate.pdgBhadMotherPart())); - return; - } - } else { - if (storeOccupancy) { - std::get(histosPtr[dataType]["hSparseMass"])->Fill(mass, pt, evaluateCentralityCand(candidate), outputMl[0], outputMl[1], outputMl[2], candidate.template collision_as().numContrib(), o2::hf_occupancy::getOccupancyColl(candidate.template collision_as(), occEstimator)); - return; - } else { - std::get(histosPtr[dataType]["hSparseMass"])->Fill(mass, pt, evaluateCentralityCand(candidate), outputMl[0], outputMl[1], outputMl[2], candidate.template collision_as().numContrib()); - return; } + std::get(histosPtr[dataType]["hSparseMass"])->Fill(mass, pt, evaluateCentralityCand(candidate), outputMl[0], outputMl[1], outputMl[2], candidate.template collision_as().numContrib(), candidate.ptBhadMotherPart(), getBHadMotherFlag(candidate.pdgBhadMotherPart())); + return; } + if (storeOccupancy) { + std::get(histosPtr[dataType]["hSparseMass"])->Fill(mass, pt, evaluateCentralityCand(candidate), outputMl[0], outputMl[1], outputMl[2], candidate.template collision_as().numContrib(), o2::hf_occupancy::getOccupancyColl(candidate.template collision_as(), occEstimator)); + return; + } + std::get(histosPtr[dataType]["hSparseMass"])->Fill(mass, pt, evaluateCentralityCand(candidate), outputMl[0], outputMl[1], outputMl[2], candidate.template collision_as().numContrib()); + return; } } @@ -517,7 +509,7 @@ struct HfTaskDs { /// \param candidate is candidate /// \param dataType is data class, as defined in DataType enum /// \param finalState is either KKPi or PiKK, as defined in FinalState enum - template + template void fillSparse(const Cand& candidate, DataType dataType, FinalState finalState) { auto mass = finalState == FinalState::KKPi ? hfHelper.invMassDsToKKPi(candidate) : hfHelper.invMassDsToPiKK(candidate); @@ -527,64 +519,56 @@ struct HfTaskDs { if (storeOccupancy) { std::get(histosPtr[dataType]["hSparseMass"])->Fill(mass, pt, evaluateCentralityCand(candidate), o2::hf_occupancy::getOccupancyColl(candidate.template collision_as(), occEstimator)); return; - } else { - std::get(histosPtr[dataType]["hSparseMass"])->Fill(mass, pt, evaluateCentralityCand(candidate)); - return; } + std::get(histosPtr[dataType]["hSparseMass"])->Fill(mass, pt, evaluateCentralityCand(candidate)); + return; } - if constexpr (isMc) { + if constexpr (IsMc) { if (dataType == DataType::McDsNonPrompt || dataType == DataType::McDplusNonPrompt) { if (storeOccupancy) { std::get(histosPtr[dataType]["hSparseMass"])->Fill(mass, pt, evaluateCentralityCand(candidate), candidate.template collision_as().numContrib(), candidate.ptBhadMotherPart(), getBHadMotherFlag(candidate.pdgBhadMotherPart()), o2::hf_occupancy::getOccupancyColl(candidate.template collision_as(), occEstimator)); return; - } else { - std::get(histosPtr[dataType]["hSparseMass"])->Fill(mass, pt, evaluateCentralityCand(candidate), candidate.template collision_as().numContrib(), candidate.ptBhadMotherPart(), getBHadMotherFlag(candidate.pdgBhadMotherPart())); - return; - } - } else { - if (storeOccupancy) { - std::get(histosPtr[dataType]["hSparseMass"])->Fill(mass, pt, evaluateCentralityCand(candidate), candidate.template collision_as().numContrib(), o2::hf_occupancy::getOccupancyColl(candidate.template collision_as(), occEstimator)); - return; - } else { - std::get(histosPtr[dataType]["hSparseMass"])->Fill(mass, pt, evaluateCentralityCand(candidate), candidate.template collision_as().numContrib()); - return; } + std::get(histosPtr[dataType]["hSparseMass"])->Fill(mass, pt, evaluateCentralityCand(candidate), candidate.template collision_as().numContrib(), candidate.ptBhadMotherPart(), getBHadMotherFlag(candidate.pdgBhadMotherPart())); + return; + } + if (storeOccupancy) { + std::get(histosPtr[dataType]["hSparseMass"])->Fill(mass, pt, evaluateCentralityCand(candidate), candidate.template collision_as().numContrib(), o2::hf_occupancy::getOccupancyColl(candidate.template collision_as(), occEstimator)); + return; } + std::get(histosPtr[dataType]["hSparseMass"])->Fill(mass, pt, evaluateCentralityCand(candidate), candidate.template collision_as().numContrib()); + return; } } /// Fill histograms of quantities for the KKPi daugther-mass hypothesis /// \param candidate is candidate /// \param dataType is data class, as defined in DataType enum - template + template void fillHistoKKPi(const T1& candidate, DataType dataType) { auto pt = candidate.pt(); - fillSparse(candidate, dataType, FinalState::KKPi); + fillSparse(candidate, dataType, FinalState::KKPi); std::get(histosPtr[dataType]["hCos3PiK"])->Fill(hfHelper.cos3PiKDsToKKPi(candidate), pt); std::get(histosPtr[dataType]["hAbsCos3PiK"])->Fill(hfHelper.absCos3PiKDsToKKPi(candidate), pt); std::get(histosPtr[dataType]["hDeltaMassPhi"])->Fill(hfHelper.deltaMassPhiDsToKKPi(candidate), pt); std::get(histosPtr[dataType]["hMassKK"])->Fill(hfHelper.massKKPairDsToKKPi(candidate), pt); - - return; } /// Fill histograms of quantities for the PiKK daugther-mass hypothesis /// \param candidate is candidate /// \param dataType is data class, as defined in DataType enum - template + template void fillHistoPiKK(const T1& candidate, DataType dataType) { auto pt = candidate.pt(); - fillSparse(candidate, dataType, FinalState::PiKK); + fillSparse(candidate, dataType, FinalState::PiKK); std::get(histosPtr[dataType]["hCos3PiK"])->Fill(hfHelper.cos3PiKDsToPiKK(candidate), pt); std::get(histosPtr[dataType]["hAbsCos3PiK"])->Fill(hfHelper.absCos3PiKDsToPiKK(candidate), pt); std::get(histosPtr[dataType]["hDeltaMassPhi"])->Fill(hfHelper.deltaMassPhiDsToPiKK(candidate), pt); std::get(histosPtr[dataType]["hMassKK"])->Fill(hfHelper.massKKPairDsToPiKK(candidate), pt); - - return; } /// Fill MC histograms at reconstruction level @@ -647,7 +631,6 @@ struct HfTaskDs { } } } - return; } template @@ -730,7 +713,7 @@ struct HfTaskDs { for (const auto& recCol : recoCollsPerMcColl) { maxNumContrib = recCol.numContrib() > maxNumContrib ? recCol.numContrib() : maxNumContrib; } - float cent = o2::hf_centrality::getCentralityGenColl(recoCollsPerMcColl); + float const cent = o2::hf_centrality::getCentralityGenColl(recoCollsPerMcColl); float occ{-1.}; if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) { occ = o2::hf_occupancy::getOccupancyGenColl(recoCollsPerMcColl, occEstimator); @@ -755,8 +738,8 @@ struct HfTaskDs { std::get(histosPtr[DataType::McDsNonPrompt]["hPtGen"])->Fill(pt); // gen. level pT std::get(histosPtr[DataType::McDsNonPrompt]["hEtaGen"])->Fill(particle.eta()); auto bHadMother = mcParticles.rawIteratorAt(particle.idxBhadMotherPart() - mcParticles.offset()); - int flagGenB = getBHadMotherFlag(bHadMother.pdgCode()); - float ptGenB = bHadMother.pt(); + int const flagGenB = getBHadMotherFlag(bHadMother.pdgCode()); + float const ptGenB = bHadMother.pt(); if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) { std::get(histosPtr[DataType::McDsNonPrompt]["hSparseGen"])->Fill(pt, y, maxNumContrib, cent, occ, ptGenB, flagGenB); } else { @@ -781,8 +764,8 @@ struct HfTaskDs { std::get(histosPtr[DataType::McDplusNonPrompt]["hPtGen"])->Fill(pt); // gen. level pT std::get(histosPtr[DataType::McDplusNonPrompt]["hEtaGen"])->Fill(particle.eta()); auto bHadMother = mcParticles.rawIteratorAt(particle.idxBhadMotherPart() - mcParticles.offset()); - int flagGenB = getBHadMotherFlag(bHadMother.pdgCode()); - float ptGenB = bHadMother.pt(); + int const flagGenB = getBHadMotherFlag(bHadMother.pdgCode()); + float const ptGenB = bHadMother.pt(); if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) { std::get(histosPtr[DataType::McDplusNonPrompt]["hSparseGen"])->Fill(pt, y, maxNumContrib, cent, occ, ptGenB, flagGenB); } else { @@ -801,8 +784,8 @@ struct HfTaskDs { std::array& nCandsInSignalRegionDsPerType, std::array& nCandsInSignalRegionDplusPerType) { - int numPvContributors = collision.numContrib(); - float centrality = evaluateCentralityColl(collision); + int const numPvContributors = collision.numContrib(); + float const centrality = evaluateCentralityColl(collision); std::get(histosPtr[DataType::Data]["hNPvContribAll"])->Fill(numPvContributors, centrality); for (int i = 0; i < DataType::kDataTypes; i++) { if (i == DataType::McBkg && !fillMcBkgHistos) { @@ -828,7 +811,7 @@ struct HfTaskDs { const auto& bc = collision.bc(); if (bc.runNumber() != mRunNumber) { mRunNumber = bc.runNumber(); // mark this run as at least tried - if (ccdbConfig.reconstructionPass.value == "") { + if (ccdbConfig.reconstructionPass.value.empty()) { lCalibObjects = ccdb->getForRun(ccdbConfig.ccdbPath, mRunNumber); } else if (ccdbConfig.reconstructionPass.value == "metadata") { std::map metadata; @@ -844,9 +827,9 @@ struct HfTaskDs { if (lCalibObjects) { LOG(info) << "CCDB objects loaded successfully"; - hVtxZFT0A = static_cast(lCalibObjects->FindObject("hVtxZFT0A")); - hVtxZFT0C = static_cast(lCalibObjects->FindObject("hVtxZFT0C")); - hVtxZNTracks = static_cast(lCalibObjects->FindObject("hVtxZNTracksPV")); + hVtxZFT0A = dynamic_cast(lCalibObjects->FindObject("hVtxZFT0A")); + hVtxZFT0C = dynamic_cast(lCalibObjects->FindObject("hVtxZFT0C")); + hVtxZNTracks = dynamic_cast(lCalibObjects->FindObject("hVtxZNTracksPV")); lCalibLoaded = true; // Capture error if (!hVtxZFT0A || !hVtxZFT0C || !hVtxZNTracks) { @@ -893,7 +876,7 @@ struct HfTaskDs { const auto& bc = collision.bc(); if (bc.runNumber() != mRunNumber) { mRunNumber = bc.runNumber(); // mark this run as at least tried - if (ccdbConfig.reconstructionPass.value == "") { + if (ccdbConfig.reconstructionPass.value.empty()) { lCalibObjects = ccdb->getForRun(ccdbConfig.ccdbPath, mRunNumber); } else if (ccdbConfig.reconstructionPass.value == "metadata") { std::map metadata; @@ -909,9 +892,9 @@ struct HfTaskDs { if (lCalibObjects) { LOG(info) << "CCDB objects loaded successfully"; - hVtxZFT0A = static_cast(lCalibObjects->FindObject("hVtxZFT0A")); - hVtxZFT0C = static_cast(lCalibObjects->FindObject("hVtxZFT0C")); - hVtxZNTracks = static_cast(lCalibObjects->FindObject("hVtxZNTracksPV")); + hVtxZFT0A = dynamic_cast(lCalibObjects->FindObject("hVtxZFT0A")); + hVtxZFT0C = dynamic_cast(lCalibObjects->FindObject("hVtxZFT0C")); + hVtxZNTracks = dynamic_cast(lCalibObjects->FindObject("hVtxZNTracksPV")); lCalibLoaded = true; // Capture error if (!hVtxZFT0A || !hVtxZFT0C || !hVtxZNTracks) { diff --git a/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx b/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx index 801e25e3460..35b9f9dee4a 100644 --- a/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx +++ b/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx @@ -39,6 +39,8 @@ #include #include +#include + #include #include #include @@ -119,16 +121,16 @@ struct HfTaskDstarToD0Pi { } auto vecPtBins = (std::vector)ptBins; - AxisSpec axisImpactParam = {binningImpactParam, "impact parameter (cm)"}; - AxisSpec axisDecayLength = {binningDecayLength, " decay length (cm)"}; - AxisSpec axisNormDecayLength = {binningNormDecayLength, "normalised decay length (cm)"}; + AxisSpec const axisImpactParam = {binningImpactParam, "impact parameter (cm)"}; + AxisSpec const axisDecayLength = {binningDecayLength, " decay length (cm)"}; + AxisSpec const axisNormDecayLength = {binningNormDecayLength, "normalised decay length (cm)"}; AxisSpec axisCentrality = {binningCentrality, "centrality (%)"}; AxisSpec axisDeltaInvMass = {binningDeltaInvMass, "#Delta #it{M}_{inv} D*"}; AxisSpec axisBDTScorePrompt = {binningSigBDTScore, "BDT Score for Prompt Cand"}; AxisSpec axisBDTScoreNonPrompt = {binningSigBDTScore, "BDT Score for Non-Prompt Cand"}; AxisSpec axisBDTScoreBackground = {binningBkgBDTScore, "BDT Score for Background Cand"}; AxisSpec axisPvContrib = {binningPvContrib, "PV Contribution"}; - AxisSpec axisPt = {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec const axisPt = {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}; axesPtVsCentVsBDTVsPvContrib = {axisPt, axisCentrality, axisBDTScoreBackground, axisBDTScorePrompt, axisBDTScoreNonPrompt, axisPvContrib}; axesPtVsCentVsPvContrib = {axisPt, axisCentrality, axisPvContrib}; @@ -263,9 +265,9 @@ struct HfTaskDstarToD0Pi { // if weights to be applied if (useWeight) { ccdbApi.init(ccdbUrl); - std::map metadata; + std::map const metadata; // Retrieve the file from CCDB - bool isFileAvailable = ccdbApi.retrieveBlob(ccdbPathForWeight, ".", metadata, timestampCCDB, false, weightFileName); + bool const isFileAvailable = ccdbApi.retrieveBlob(ccdbPathForWeight, ".", metadata, timestampCCDB, false, weightFileName); if (!isFileAvailable) { LOGF(fatal, "Failed to retrieve weight file from CCDB: %s", ccdbPathForWeight.value.c_str()); return; @@ -274,17 +276,17 @@ struct HfTaskDstarToD0Pi { if (isCentStudy) { // Open the ROOT file TFile* weightFile = TFile::Open(weightFileName.value.c_str(), "READ"); - if (weightFile && !weightFile->IsZombie()) { + if ((weightFile != nullptr) && !weightFile->IsZombie()) { // Ensure hWeights is properly sized hWeights.resize(nWeights); for (int ithWeight = 0; ithWeight < nWeights; ++ithWeight) { - std::string histName = "hMult" + std::to_string(ithWeight + 1) + "_Weight"; + std::string const histName = "hMult" + std::to_string(ithWeight + 1) + "_Weight"; hWeights[ithWeight] = reinterpret_cast(weightFile->Get(histName.c_str())); - if (!hWeights[ithWeight]) { + if (hWeights[ithWeight] == nullptr) { LOGF(fatal, "Histogram %s not found in weight file!", histName.c_str()); return; } - hWeights[ithWeight]->SetDirectory(0); + hWeights[ithWeight]->SetDirectory(nullptr); hWeights[ithWeight]->SetName(("hWeight" + std::to_string(ithWeight + 1)).c_str()); } weightFile->Close(); @@ -310,7 +312,7 @@ struct HfTaskDstarToD0Pi { /// @param cols reconstructed collision with centrality /// @param selectedCands selected candidates with selection flag /// @param preslice preslice to slice - template + template void runTaskDstar(CollisionsWCent const& cols, T1 selectedCands, T2 preslice) { for (const auto& col : cols) { @@ -370,7 +372,7 @@ struct HfTaskDstarToD0Pi { nCandsSignalRegion++; } - if constexpr (applyMl) { + if constexpr (ApplyMl) { auto mlBdtScore = candDstar.mlProbDstarToD0Pi(); registry.fill(HIST("Yield/hDeltaInvMassVsPtVsCentVsBDTScore"), deltaMDstar, candDstar.pt(), centrality, mlBdtScore[0], mlBdtScore[1], mlBdtScore[2]); } @@ -393,7 +395,7 @@ struct HfTaskDstarToD0Pi { nCandsSignalRegion++; } - if constexpr (applyMl) { + if constexpr (ApplyMl) { auto mlBdtScore = candDstar.mlProbDstarToD0Pi(); registry.fill(HIST("Yield/hDeltaInvMassVsPtVsCentVsBDTScore"), deltaMAntiDstar, candDstar.pt(), centrality, mlBdtScore[0], mlBdtScore[1], mlBdtScore[2]); } @@ -425,7 +427,7 @@ struct HfTaskDstarToD0Pi { /// @tparam applyMl a boolean to apply ML or not /// @param candsMcRecSel reconstructed candidates with selection flag /// @param rowsMcPartilces generated particles table - template + template void runMcRecTaskDstar(T1 const& candsMcRecSel, CandDstarMcGen const& rowsMcPartilces) { int8_t signDstar = 0; @@ -458,10 +460,11 @@ struct HfTaskDstarToD0Pi { if (candDstarMcRec.isSelDstarToD0Pi()) { // if all selection passed float weightValue = 1.0; - if (useWeight && (hWeights.size() < 1 || hWeights[0] == nullptr)) { + if (useWeight && (hWeights.empty() || hWeights[0] == nullptr)) { LOGF(fatal, "Weight histograms are not initialized or empty. Check CCDB path or weight file."); return; - } else if (useWeight && isCentStudy) { + } + if (useWeight && isCentStudy) { for (int ithWeight = 0; ithWeight < nWeights; ++ithWeight) { if (centrality > centRangesForWeights.value[ithWeight] && centrality <= centRangesForWeights.value[ithWeight + 1]) { weightValue = hWeights[ithWeight]->GetBinContent(hWeights[ithWeight]->FindBin(nPVContributors)); @@ -473,7 +476,7 @@ struct HfTaskDstarToD0Pi { registry.fill(HIST("QA/hPtFullRecoDstarRecSig"), ptDstarRecSig); } - if constexpr (applyMl) { // All efficiency histograms at reconstruction level w/ ml + if constexpr (ApplyMl) { // All efficiency histograms at reconstruction level w/ ml if (isCentStudy) { auto bdtScore = candDstarMcRec.mlProbDstarToD0Pi(); registry.fill(HIST("Efficiency/hPtVsCentVsBDTScoreVsPvContribRecSig"), ptDstarRecSig, centrality, bdtScore[0], bdtScore[1], bdtScore[2], nPVContributors, weightValue); @@ -584,10 +587,10 @@ struct HfTaskDstarToD0Pi { float centFT0MGen; float pvContributors; // assigning centrality to MC Collision using max FT0M amplitute from Reconstructed collisions - if (recCollisions.size()) { + if (recCollisions.size() != 0) { std::vector::iterator, int>> tempRecCols; for (const auto& recCol : recCollisions) { - tempRecCols.push_back(std::make_pair(recCol, recCol.numContrib())); + tempRecCols.emplace_back(recCol, recCol.numContrib()); } std::sort(tempRecCols.begin(), tempRecCols.end(), compare); centFT0MGen = tempRecCols.at(0).first.centFT0M(); @@ -598,10 +601,11 @@ struct HfTaskDstarToD0Pi { } float weightValue = 1.0; - if (useWeight && (hWeights.size() < 1 || hWeights[0] == nullptr)) { + if (useWeight && (hWeights.empty() || hWeights[0] == nullptr)) { LOGF(fatal, "Weight histograms are not initialized or empty. Check CCDB path or weight file."); return; - } else if (useWeight && isCentStudy) { + } + if (useWeight && isCentStudy) { for (int ithWeight = 0; ithWeight < nWeights; ++ithWeight) { if (centFT0MGen > centRangesForWeights.value[ithWeight] && centFT0MGen <= centRangesForWeights.value[ithWeight + 1]) { weightValue = hWeights[ithWeight]->GetBinContent(hWeights[ithWeight]->FindBin(centFT0MGen, pvContributors)); diff --git a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx index 5666daeaacb..a7c954f9720 100644 --- a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx +++ b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx @@ -316,32 +316,32 @@ struct HfTaskFlowCharmHadrons { /// \param tracksQx is the X component of the Q vector for the tracks /// \param tracksQy is the Y component of the Q vector for the tracks /// \param channel is the decay channel - template + template void getQvecDtracks(T1 const& cand, std::vector& tracksQx, std::vector& tracksQy, const float ampl) { // TODO: add possibility to consider different weights for the tracks, at the moment only pT is considered; - float pXTrack0 = cand.pxProng0(); - float pYTrack0 = cand.pyProng0(); - float pTTrack0 = cand.ptProng0(); - float phiTrack0 = std::atan2(pYTrack0, pXTrack0); - float pXTrack1 = cand.pxProng1(); - float pYTrack1 = cand.pyProng1(); - float pTTrack1 = cand.ptProng1(); - float phiTrack1 = std::atan2(pYTrack1, pXTrack1); + float const pXTrack0 = cand.pxProng0(); + float const pYTrack0 = cand.pyProng0(); + float const pTTrack0 = cand.ptProng0(); + float const phiTrack0 = std::atan2(pYTrack0, pXTrack0); + float const pXTrack1 = cand.pxProng1(); + float const pYTrack1 = cand.pyProng1(); + float const pTTrack1 = cand.ptProng1(); + float const phiTrack1 = std::atan2(pYTrack1, pXTrack1); tracksQx.push_back(std::cos(harmonic * phiTrack0) * pTTrack0 / ampl); tracksQy.push_back(std::sin(harmonic * phiTrack0) * pTTrack0 / ampl); tracksQx.push_back(std::cos(harmonic * phiTrack1) * pTTrack1 / ampl); tracksQy.push_back(std::sin(harmonic * phiTrack1) * pTTrack1 / ampl); - if constexpr (channel != DecayChannel::D0ToPiK && channel != DecayChannel::D0ToKPi) { - float pXTrack2 = cand.pxProng2(); - float pYTrack2 = cand.pyProng2(); - float pTTrack2 = cand.ptProng2(); - float phiTrack2 = std::atan2(pYTrack2, pXTrack2); + if constexpr (Channel != DecayChannel::D0ToPiK && Channel != DecayChannel::D0ToKPi) { + float const pXTrack2 = cand.pxProng2(); + float const pYTrack2 = cand.pyProng2(); + float const pTTrack2 = cand.ptProng2(); + float const phiTrack2 = std::atan2(pYTrack2, pXTrack2); tracksQx.push_back(std::cos(harmonic * phiTrack2) * pTTrack2 / ampl); tracksQy.push_back(std::sin(harmonic * phiTrack2) * pTTrack2 / ampl); } @@ -359,22 +359,22 @@ struct HfTaskFlowCharmHadrons { float ampl) { // add possibility to consider different weights for the tracks, at the moment only pT is considered; - float pXTrack0 = cand.pxPosV0Dau(); - float pYTrack0 = cand.pyPosV0Dau(); - float pTTrack0 = std::hypot(pXTrack0, pYTrack0); - float phiTrack0 = std::atan2(pXTrack0, pYTrack0); - float pXTrack1 = cand.pxNegV0Dau(); - float pYTrack1 = cand.pyNegV0Dau(); - float pTTrack1 = std::hypot(pXTrack1, pYTrack1); - float phiTrack1 = std::atan2(pXTrack1, pYTrack1); - float pYTrack2 = cand.pxBachFromCasc(); - float pXTrack2 = cand.pyBachFromCasc(); - float pTTrack2 = std::hypot(pXTrack2, pYTrack2); - float phiTrack2 = std::atan2(pXTrack2, pYTrack2); - float pXTrack3 = cand.pxBachFromCharmBaryon(); - float pYTrack3 = cand.pyBachFromCharmBaryon(); - float pTTrack3 = std::hypot(pXTrack3, pYTrack3); - float phiTrack3 = std::atan2(pXTrack3, pYTrack3); + float const pXTrack0 = cand.pxPosV0Dau(); + float const pYTrack0 = cand.pyPosV0Dau(); + float const pTTrack0 = std::hypot(pXTrack0, pYTrack0); + float const phiTrack0 = std::atan2(pXTrack0, pYTrack0); + float const pXTrack1 = cand.pxNegV0Dau(); + float const pYTrack1 = cand.pyNegV0Dau(); + float const pTTrack1 = std::hypot(pXTrack1, pYTrack1); + float const phiTrack1 = std::atan2(pXTrack1, pYTrack1); + float const pYTrack2 = cand.pxBachFromCasc(); + float const pXTrack2 = cand.pyBachFromCasc(); + float const pTTrack2 = std::hypot(pXTrack2, pYTrack2); + float const phiTrack2 = std::atan2(pXTrack2, pYTrack2); + float const pXTrack3 = cand.pxBachFromCharmBaryon(); + float const pYTrack3 = cand.pyBachFromCharmBaryon(); + float const pTTrack3 = std::hypot(pXTrack3, pYTrack3); + float const phiTrack3 = std::atan2(pXTrack3, pYTrack3); tracksQx.push_back(std::cos(harmonic * phiTrack0) * pTTrack0 / ampl); tracksQy.push_back(std::sin(harmonic * phiTrack0) * pTTrack0 / ampl); @@ -471,14 +471,14 @@ struct HfTaskFlowCharmHadrons { /// \param bc is the bunch crossing with timestamp information /// \param centrality is the collision centrality /// \return true if the collision is selected, false otherwise - template + template bool isCollSelected(CollsWithQvecs::iterator const& collision, aod::BCsWithTimestamps const&, float& centrality) { const auto occupancy = o2::hf_occupancy::getOccupancyColl(collision, occEstimator); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); - centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + centrality = o2::hf_centrality::getCentralityColl(collision, CentEstimator); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -537,7 +537,7 @@ struct HfTaskFlowCharmHadrons { /// Compute the scalar product /// \param collision is the collision with the Q vector information and event plane /// \param candidates are the selected candidates - template + template void runFlowAnalysis(CollsWithQvecs::iterator const& collision, T1 const& candidates) { @@ -556,8 +556,8 @@ struct HfTaskFlowCharmHadrons { std::vector qVecs = getQvec(collision); float xQVec = qVecs[0]; float yQVec = qVecs[1]; - float amplQVec = qVecs[2]; - float evtPl = epHelper.GetEventPlane(xQVec, yQVec, harmonic); + float const amplQVec = qVecs[2]; + float const evtPl = epHelper.GetEventPlane(xQVec, yQVec, harmonic); int nProngs = 3; for (const auto& candidate : candidates) { @@ -565,19 +565,21 @@ struct HfTaskFlowCharmHadrons { std::vector outputMl = {-999., -999.}; if constexpr (std::is_same_v || std::is_same_v) { - switch (channel) { + switch (Channel) { case DecayChannel::DsToKKPi: massCand = hfHelper.invMassDsToKKPi(candidate); if constexpr (std::is_same_v) { - for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDsToKKPi()[classMl->at(iclass)]; + } } break; case DecayChannel::DsToPiKK: massCand = hfHelper.invMassDsToPiKK(candidate); if constexpr (std::is_same_v) { - for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDsToPiKK()[classMl->at(iclass)]; + } } break; default: @@ -586,62 +588,69 @@ struct HfTaskFlowCharmHadrons { } else if constexpr (std::is_same_v || std::is_same_v) { massCand = hfHelper.invMassDplusToPiKPi(candidate); if constexpr (std::is_same_v) { - for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDplusToPiKPi()[classMl->at(iclass)]; + } } } else if constexpr (std::is_same_v || std::is_same_v) { nProngs = 2; - switch (channel) { + switch (Channel) { case DecayChannel::D0ToPiK: massCand = hfHelper.invMassD0ToPiK(candidate); if constexpr (std::is_same_v) { - for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbD0()[classMl->at(iclass)]; + } } break; case DecayChannel::D0ToKPi: massCand = hfHelper.invMassD0barToKPi(candidate); if constexpr (std::is_same_v) { - for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbD0bar()[classMl->at(iclass)]; + } } break; default: break; } } else if constexpr (std::is_same_v || std::is_same_v) { - switch (channel) { + switch (Channel) { case DecayChannel::LcToPKPi: massCand = hfHelper.invMassLcToPKPi(candidate); if constexpr (std::is_same_v) { - for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbLcToPKPi()[classMl->at(iclass)]; + } } break; case DecayChannel::LcToPiKP: massCand = hfHelper.invMassLcToPiKP(candidate); if constexpr (std::is_same_v) { - for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbLcToPiKP()[classMl->at(iclass)]; + } } break; default: break; } } else if constexpr (std::is_same_v || std::is_same_v) { - switch (channel) { + switch (Channel) { case DecayChannel::XicToPKPi: massCand = hfHelper.invMassXicToPKPi(candidate); if constexpr (std::is_same_v) { - for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbXicToPKPi()[classMl->at(iclass)]; + } } break; case DecayChannel::XicToPiKP: massCand = hfHelper.invMassXicToPiKP(candidate); if constexpr (std::is_same_v) { - for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbXicToPiKP()[classMl->at(iclass)]; + } } break; default: @@ -650,8 +659,9 @@ struct HfTaskFlowCharmHadrons { } else if constexpr (std::is_same_v || std::is_same_v) { massCand = candidate.invMassCharmBaryon(); if constexpr (std::is_same_v) { - for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbToXiPi()[classMl->at(iclass)]; + } } } @@ -675,7 +685,7 @@ struct HfTaskFlowCharmHadrons { // std::cout<(candidate, tracksQx, tracksQy, ampl); + getQvecDtracks(candidate, tracksQx, tracksQy, ampl); } for (auto iTrack{0u}; iTrack < tracksQx.size(); ++iTrack) { xQVec -= tracksQx[iTrack]; @@ -683,14 +693,14 @@ struct HfTaskFlowCharmHadrons { } } - float cosNPhi = std::cos(harmonic * phiCand); - float sinNPhi = std::sin(harmonic * phiCand); - float scalprodCand = cosNPhi * xQVec + sinNPhi * yQVec; - float cosDeltaPhi = std::cos(harmonic * (phiCand - evtPl)); + float const cosNPhi = std::cos(harmonic * phiCand); + float const sinNPhi = std::sin(harmonic * phiCand); + float const scalprodCand = cosNPhi * xQVec + sinNPhi * yQVec; + float const cosDeltaPhi = std::cos(harmonic * (phiCand - evtPl)); if (fillMassPtMlTree && storeMl) { if (downSampleFactor < 1.) { - float pseudoRndm = ptCand * 1000. - static_cast(ptCand * 1000); + float const pseudoRndm = ptCand * 1000. - static_cast(ptCand * 1000); if (ptCand < ptDownSampleMax && pseudoRndm >= downSampleFactor) { continue; } @@ -829,20 +839,20 @@ struct HfTaskFlowCharmHadrons { aod::BCsWithTimestamps const& bcs) { float centrality{-1.f}; - float xQVecFT0a = collision.qvecFT0ARe(); - float yQVecFT0a = collision.qvecFT0AIm(); - float xQVecFT0c = collision.qvecFT0CRe(); - float yQVecFT0c = collision.qvecFT0CIm(); - float xQVecFT0m = collision.qvecFT0MRe(); - float yQVecFT0m = collision.qvecFT0MIm(); - float xQVecFV0a = collision.qvecFV0ARe(); - float yQVecFV0a = collision.qvecFV0AIm(); - float xQVecBPos = collision.qvecBPosRe(); - float yQVecBPos = collision.qvecBPosIm(); - float xQVecBNeg = collision.qvecBNegRe(); - float yQVecBNeg = collision.qvecBNegIm(); - float xQVecBTot = collision.qvecBTotRe(); - float yQVecBTot = collision.qvecBTotIm(); + float const xQVecFT0a = collision.qvecFT0ARe(); + float const yQVecFT0a = collision.qvecFT0AIm(); + float const xQVecFT0c = collision.qvecFT0CRe(); + float const yQVecFT0c = collision.qvecFT0CIm(); + float const xQVecFT0m = collision.qvecFT0MRe(); + float const yQVecFT0m = collision.qvecFT0MIm(); + float const xQVecFV0a = collision.qvecFV0ARe(); + float const yQVecFV0a = collision.qvecFV0AIm(); + float const xQVecBPos = collision.qvecBPosRe(); + float const yQVecBPos = collision.qvecBPosIm(); + float const xQVecBNeg = collision.qvecBNegRe(); + float const yQVecBNeg = collision.qvecBNegIm(); + float const xQVecBTot = collision.qvecBTotRe(); + float const yQVecBTot = collision.qvecBTotIm(); centrality = o2::hf_centrality::getCentralityColl(collision, o2::hf_centrality::CentralityEstimator::FT0C); if (storeResoOccu) { @@ -880,13 +890,13 @@ struct HfTaskFlowCharmHadrons { registry.fill(HIST("spReso/hSpResoTPCposTPCneg"), centrality, xQVecBPos * xQVecBNeg + yQVecBPos * yQVecBNeg); if (saveEpResoHisto) { - float epFT0a = epHelper.GetEventPlane(xQVecFT0a, yQVecFT0a, harmonic); - float epFT0c = epHelper.GetEventPlane(xQVecFT0c, yQVecFT0c, harmonic); - float epFT0m = epHelper.GetEventPlane(xQVecFT0m, yQVecFT0m, harmonic); - float epFV0a = epHelper.GetEventPlane(xQVecFV0a, yQVecFV0a, harmonic); - float epBPoss = epHelper.GetEventPlane(xQVecBPos, yQVecBPos, harmonic); - float epBNegs = epHelper.GetEventPlane(xQVecBNeg, yQVecBNeg, harmonic); - float epBTots = epHelper.GetEventPlane(xQVecBTot, yQVecBTot, harmonic); + float const epFT0a = epHelper.GetEventPlane(xQVecFT0a, yQVecFT0a, harmonic); + float const epFT0c = epHelper.GetEventPlane(xQVecFT0c, yQVecFT0c, harmonic); + float const epFT0m = epHelper.GetEventPlane(xQVecFT0m, yQVecFT0m, harmonic); + float const epFV0a = epHelper.GetEventPlane(xQVecFV0a, yQVecFV0a, harmonic); + float const epBPoss = epHelper.GetEventPlane(xQVecBPos, yQVecBPos, harmonic); + float const epBNegs = epHelper.GetEventPlane(xQVecBNeg, yQVecBNeg, harmonic); + float const epBTots = epHelper.GetEventPlane(xQVecBTot, yQVecBTot, harmonic); registry.fill(HIST("epReso/hEpResoFT0cFT0a"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0c, epFT0a))); registry.fill(HIST("epReso/hEpResoFT0cFV0a"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0c, epFV0a))); diff --git a/PWGHF/D2H/Tasks/taskLb.cxx b/PWGHF/D2H/Tasks/taskLb.cxx index 3272db196b3..feb4444386d 100644 --- a/PWGHF/D2H/Tasks/taskLb.cxx +++ b/PWGHF/D2H/Tasks/taskLb.cxx @@ -83,15 +83,15 @@ struct HfTaskLb { bool passesImpactParameterResolution(float pT, float d0Resolution) { - float expectedResolution(0.001 + 0.0052 * std::exp(-0.655 * pT)); + float const expectedResolution(0.001 + 0.0052 * std::exp(-0.655 * pT)); return (d0Resolution <= expectedResolution * 1.5); } // Compares to pT dependent cut on impact parameter resolution float logLikelihoodRatioSingleTrackDCA(float dca, float reso, float lengthParameter) { reso *= resoCorrectionFactor; // In case real resolution is worse - float numerator = 1. / lengthParameter * std::exp(-dca / lengthParameter); - float denominator = (1. - largeLifetimeBG) * TMath::Gaus(dca, 0., reso, true) + largeLifetimeBG / 0.2; // flat distribution to 2 mm + float const numerator = 1. / lengthParameter * std::exp(-dca / lengthParameter); + float const denominator = (1. - largeLifetimeBG) * TMath::Gaus(dca, 0., reso, true) + largeLifetimeBG / 0.2; // flat distribution to 2 mm return std::log(numerator / denominator); } // Creates the single track log likelihood assuming an exonential law for the secondaries @@ -187,39 +187,43 @@ struct HfTaskLb { soa::Join const& candidatesLc, TracksWExt const&) { - float massKStar892 = 0.892; - float massDelta1232 = 1.232; + float const massKStar892 = 0.892; + float const massDelta1232 = 1.232; std::array dca = {0.f, 0.f, 0.f}; std::array dcaResolution = {0.f, 0.f, 0.f}; for (const auto& candidateLc : candidatesLc) { - if (!candidateLc.isSelLcToPKPi() && !candidateLc.isSelLcToPiKP()) + if ((candidateLc.isSelLcToPKPi() == 0) && (candidateLc.isSelLcToPiKP() == 0)) { continue; + } auto track0 = candidateLc.prong0_as(); auto track1 = candidateLc.prong1_as(); auto track2 = candidateLc.prong2_as(); registry.get(HIST("hIPs"))->Fill(candidateLc.pt(), candidateLc.impactParameter0()); registry.get(HIST("hIPs"))->Fill(candidateLc.pt(), candidateLc.impactParameter1()); registry.get(HIST("hIPs"))->Fill(candidateLc.pt(), candidateLc.impactParameter2()); - float reso0 = candidateLc.errorImpactParameter0(); // 0.0023166 *pow(track0.pt(), -0.788); - float reso1 = candidateLc.errorImpactParameter1(); - float reso2 = candidateLc.errorImpactParameter2(); + float const reso0 = candidateLc.errorImpactParameter0(); // 0.0023166 *pow(track0.pt(), -0.788); + float const reso1 = candidateLc.errorImpactParameter1(); + float const reso2 = candidateLc.errorImpactParameter2(); registry.get(HIST("hIPResolution"))->Fill(track0.pt(), reso0); registry.get(HIST("hIPResolution"))->Fill(track1.pt(), reso1); registry.get(HIST("hIPResolution"))->Fill(track2.pt(), reso2); - if (!passesImpactParameterResolution(track0.pt(), reso0)) + if (!passesImpactParameterResolution(track0.pt(), reso0)) { continue; - if (!passesImpactParameterResolution(track1.pt(), reso1)) + } + if (!passesImpactParameterResolution(track1.pt(), reso1)) { continue; - if (!passesImpactParameterResolution(track2.pt(), reso2)) + } + if (!passesImpactParameterResolution(track2.pt(), reso2)) { continue; + } dca = { candidateLc.impactParameter0(), candidateLc.impactParameter1(), candidateLc.impactParameter2()}; - bool exceedsMaxDca = std::any_of(dca.begin(), dca.end(), [&](float val) { + bool const exceedsMaxDca = std::any_of(dca.begin(), dca.end(), [&](float val) { return val > maximumImpactParameterForLambdaCCrossChecks; }); @@ -234,27 +238,32 @@ struct HfTaskLb { } registry.get(HIST("hPtlogLikelihood"))->Fill(candidateLc.pt(), likelihoodRatio); - if (likelihoodRatio < minLikelihoodRatioLc) + if (likelihoodRatio < minLikelihoodRatioLc) { continue; + } registry.get(HIST("hIPsAfterCut"))->Fill(candidateLc.pt(), candidateLc.impactParameter0()); registry.get(HIST("hIPsAfterCut"))->Fill(candidateLc.pt(), candidateLc.impactParameter1()); registry.get(HIST("hIPsAfterCut"))->Fill(candidateLc.pt(), candidateLc.impactParameter2()); - if (candidateLc.isSelLcToPKPi()) { + if (candidateLc.isSelLcToPKPi() != 0) { registry.get(HIST("hPtinvMassLc"))->Fill(candidateLc.pt(), hfHelper.invMassLcToPKPi(candidateLc)); - float mRecoKstar = RecoDecay::m(std::array{track1.pVector(), track2.pVector()}, std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}); - float mRecoDelta1232 = RecoDecay::m(std::array{track0.pVector(), track2.pVector()}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPiPlus}); - float mRecoLambda1520 = RecoDecay::m(std::array{track0.pVector(), track1.pVector()}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassKPlus}); - float mDiffKStar892 = std::abs(mRecoKstar - massKStar892); - float mDiffDelta1232 = std::abs(mRecoDelta1232 - massDelta1232); - float mDiffLambda1520 = std::abs(mRecoLambda1520 - o2::constants::physics::MassLambda1520); - if (mDiffKStar892 < mDiffKStar892Max || mDiffDelta1232 < mDiffDelta1232Max || mDiffLambda1520 < mDiffLambda1520Max) + float const mRecoKstar = RecoDecay::m(std::array{track1.pVector(), track2.pVector()}, std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}); + float const mRecoDelta1232 = RecoDecay::m(std::array{track0.pVector(), track2.pVector()}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPiPlus}); + float const mRecoLambda1520 = RecoDecay::m(std::array{track0.pVector(), track1.pVector()}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassKPlus}); + float const mDiffKStar892 = std::abs(mRecoKstar - massKStar892); + float const mDiffDelta1232 = std::abs(mRecoDelta1232 - massDelta1232); + float const mDiffLambda1520 = std::abs(mRecoLambda1520 - o2::constants::physics::MassLambda1520); + if (mDiffKStar892 < mDiffKStar892Max || mDiffDelta1232 < mDiffDelta1232Max || mDiffLambda1520 < mDiffLambda1520Max) { registry.get(HIST("hPtinvMassLcReso"))->Fill(candidateLc.pt(), hfHelper.invMassLcToPKPi(candidateLc)); - if (mDiffKStar892 < mDiffKStar892Max) + } + if (mDiffKStar892 < mDiffKStar892Max) { registry.get(HIST("hPtinvMassLcKStar"))->Fill(candidateLc.pt(), hfHelper.invMassLcToPKPi(candidateLc)); - if (mDiffDelta1232 < mDiffDelta1232Max) + } + if (mDiffDelta1232 < mDiffDelta1232Max) { registry.get(HIST("hPtinvMassLcDelta"))->Fill(candidateLc.pt(), hfHelper.invMassLcToPKPi(candidateLc)); - if (mDiffLambda1520 < mDiffLambda1520Max) + } + if (mDiffLambda1520 < mDiffLambda1520Max) { registry.get(HIST("hPtinvMassLcLambda1520"))->Fill(candidateLc.pt(), hfHelper.invMassLcToPKPi(candidateLc)); + } if (std::abs(hfHelper.invMassLcToPKPi(candidateLc) - o2::constants::physics::MassLambdaCPlus) < mDiffLcMax) { registry.get(HIST("hPtinvMassKStar"))->Fill(candidateLc.pt(), mRecoKstar); @@ -262,22 +271,26 @@ struct HfTaskLb { registry.get(HIST("hPtinvMassLambda1520"))->Fill(candidateLc.pt(), mRecoLambda1520); } } - if (candidateLc.isSelLcToPiKP()) { + if (candidateLc.isSelLcToPiKP() != 0) { registry.get(HIST("hPtinvMassLc"))->Fill(candidateLc.pt(), hfHelper.invMassLcToPiKP(candidateLc)); - float mRecoKstar = RecoDecay::m(std::array{track1.pVector(), track0.pVector()}, std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}); - float mRecoDelta1232 = RecoDecay::m(std::array{track2.pVector(), track0.pVector()}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPiPlus}); - float mRecoLambda1520 = RecoDecay::m(std::array{track2.pVector(), track1.pVector()}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassKPlus}); - float mDiffKStar892 = std::abs(mRecoKstar - massKStar892); - float mDiffDelta1232 = std::abs(mRecoDelta1232 - massDelta1232); - float mDiffLambda1520 = std::abs(mRecoLambda1520 - o2::constants::physics::MassLambda1520); - if (mDiffKStar892 < mDiffKStar892Max || mDiffDelta1232 < mDiffDelta1232Max || mDiffLambda1520 < mDiffLambda1520Max) + float const mRecoKstar = RecoDecay::m(std::array{track1.pVector(), track0.pVector()}, std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}); + float const mRecoDelta1232 = RecoDecay::m(std::array{track2.pVector(), track0.pVector()}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPiPlus}); + float const mRecoLambda1520 = RecoDecay::m(std::array{track2.pVector(), track1.pVector()}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassKPlus}); + float const mDiffKStar892 = std::abs(mRecoKstar - massKStar892); + float const mDiffDelta1232 = std::abs(mRecoDelta1232 - massDelta1232); + float const mDiffLambda1520 = std::abs(mRecoLambda1520 - o2::constants::physics::MassLambda1520); + if (mDiffKStar892 < mDiffKStar892Max || mDiffDelta1232 < mDiffDelta1232Max || mDiffLambda1520 < mDiffLambda1520Max) { registry.get(HIST("hPtinvMassLcReso"))->Fill(candidateLc.pt(), hfHelper.invMassLcToPiKP(candidateLc)); - if (mDiffKStar892 < mDiffKStar892Max) + } + if (mDiffKStar892 < mDiffKStar892Max) { registry.get(HIST("hPtinvMassLcKStar"))->Fill(candidateLc.pt(), hfHelper.invMassLcToPiKP(candidateLc)); - if (mDiffDelta1232 < mDiffDelta1232Max) + } + if (mDiffDelta1232 < mDiffDelta1232Max) { registry.get(HIST("hPtinvMassLcDelta"))->Fill(candidateLc.pt(), hfHelper.invMassLcToPiKP(candidateLc)); - if (mDiffLambda1520 < mDiffLambda1520Max) + } + if (mDiffLambda1520 < mDiffLambda1520Max) { registry.get(HIST("hPtinvMassLcLambda1520"))->Fill(candidateLc.pt(), hfHelper.invMassLcToPiKP(candidateLc)); + } if (std::abs(hfHelper.invMassLcToPiKP(candidateLc) - o2::constants::physics::MassLambdaCPlus) < mDiffLcMax) { registry.get(HIST("hPtinvMassKStar"))->Fill(candidateLc.pt(), mRecoKstar); @@ -313,7 +326,7 @@ struct HfTaskLb { if (likelihoodRatio < minLikelihoodRatio) { continue; // Larger likelihood means more likely to be signal } - float lbMass = hfHelper.invMassLbToLcPi(candidate); + float const lbMass = hfHelper.invMassLbToLcPi(candidate); registry.get(HIST("hPtinvMassLb"))->Fill(candidate.pt(), lbMass); registry.fill(HIST("hMass"), hfHelper.invMassLbToLcPi(candidate), candidate.pt()); diff --git a/PWGHF/D2H/Tasks/taskLbReduced.cxx b/PWGHF/D2H/Tasks/taskLbReduced.cxx index f756d9abc62..f47e06d84c5 100644 --- a/PWGHF/D2H/Tasks/taskLbReduced.cxx +++ b/PWGHF/D2H/Tasks/taskLbReduced.cxx @@ -388,7 +388,7 @@ struct HfTaskLbReduced { /// \param withLbMl is the flag to enable the filling with ML scores for the Lb candidate /// \param candidate is the Lb candidate /// \param candidatesLc is the table with Lc candidates - template + template void fillCand(Cand const& candidate, CandsLc const&) { @@ -398,9 +398,9 @@ struct HfTaskLbReduced { auto ptLc = candidate.ptProng0(); auto invMassLc = candLc.invMassHypo0() > 0 ? candLc.invMassHypo0() : candLc.invMassHypo1(); // TODO: here we are assuming that only one of the two hypotheses is filled, to be checked - std::array posPv{candidate.posX(), candidate.posY(), candidate.posZ()}; - std::array posSvLc{candLc.xSecondaryVertex(), candLc.ySecondaryVertex(), candLc.zSecondaryVertex()}; - std::array momLc{candLc.pVector()}; + std::array const posPv{candidate.posX(), candidate.posY(), candidate.posZ()}; + std::array const posSvLc{candLc.xSecondaryVertex(), candLc.ySecondaryVertex(), candLc.zSecondaryVertex()}; + std::array const momLc{candLc.pVector()}; auto cospLc = RecoDecay::cpa(posPv, posSvLc, momLc); auto cospXyLc = RecoDecay::cpaXY(posPv, posSvLc, momLc); auto decLenLc = RecoDecay::distance(posPv, posSvLc); @@ -409,14 +409,14 @@ struct HfTaskLbReduced { int8_t flagMcMatchRec = 0; int8_t flagWrongCollision = 0; bool isSignal = false; - if constexpr (doMc) { + if constexpr (DoMc) { flagMcMatchRec = candidate.flagMcMatchRec(); flagWrongCollision = candidate.flagWrongCollision(); isSignal = TESTBIT(std::abs(flagMcMatchRec), hf_cand_lb::DecayTypeMc::LbToLcPiToPKPiPi); } if (fillHistograms) { - if constexpr (doMc) { + if constexpr (DoMc) { if (isSignal) { registry.fill(HIST("hMassRecSig"), ptCandLb, hfHelper.invMassLbToLcPi(candidate)); registry.fill(HIST("hPtProng0RecSig"), ptCandLb, candidate.ptProng0()); @@ -436,15 +436,15 @@ struct HfTaskLbReduced { registry.fill(HIST("hDecLengthXyLcRecSig"), ptLc, decLenXyLc); registry.fill(HIST("hCospLcRecSig"), ptLc, cospLc); registry.fill(HIST("hCospXyLcRecSig"), ptLc, cospXyLc); - if constexpr (withDecayTypeCheck) { + if constexpr (WithDecayTypeCheck) { registry.fill(HIST("hDecayTypeMc"), 1 + hf_cand_lb::DecayTypeMc::LbToLcPiToPKPiPi, invMassLb, ptCandLb); } - if constexpr (withLcMl) { + if constexpr (WithLcMl) { registry.fill(HIST("hMlScoreBkgLcRecSig"), ptLc, candidate.prong0MlScoreBkg()); registry.fill(HIST("hMlScorePromptLcRecSig"), ptLc, candidate.prong0MlScorePrompt()); registry.fill(HIST("hMlScoreNonPromptLcRecSig"), ptLc, candidate.prong0MlScoreNonprompt()); } - if constexpr (withLbMl) { + if constexpr (WithLbMl) { registry.fill(HIST("hMlScoreSigLbRecSig"), ptCandLb, candidate.mlProbLbToLcPi()); } } else if (fillBackground) { @@ -466,15 +466,15 @@ struct HfTaskLbReduced { registry.fill(HIST("hDecLengthXyLcRecBg"), ptLc, decLenXyLc); registry.fill(HIST("hCospLcRecBg"), ptLc, cospLc); registry.fill(HIST("hCospXyLcRecBg"), ptLc, cospXyLc); - if constexpr (withLcMl) { + if constexpr (WithLcMl) { registry.fill(HIST("hMlScoreBkgLcRecBg"), ptLc, candidate.prong0MlScoreBkg()); registry.fill(HIST("hMlScorePromptLcRecBg"), ptLc, candidate.prong0MlScorePrompt()); registry.fill(HIST("hMlScoreNonPromptLcRecBg"), ptLc, candidate.prong0MlScoreNonprompt()); } - if constexpr (withLbMl) { + if constexpr (WithLbMl) { registry.fill(HIST("hMlScoreSigLbRecBg"), ptCandLb, candidate.mlProbLbToLcPi()); } - } else if constexpr (withDecayTypeCheck) { + } else if constexpr (WithDecayTypeCheck) { if (TESTBIT(flagMcMatchRec, hf_cand_lb::DecayTypeMc::LbToLcKToPKPiK)) { // Lb → Lc+ K- → (pK-π+) K- registry.fill(HIST("hDecayTypeMc"), 1 + hf_cand_lb::DecayTypeMc::LbToLcKToPKPiK, invMassLb, ptCandLb); } else if (TESTBIT(flagMcMatchRec, hf_cand_lb::DecayTypeMc::B0ToDplusPiToPiKPiPi)) { // // B0 → D- π+ → (π- K+ π-) π+ @@ -505,33 +505,33 @@ struct HfTaskLbReduced { registry.fill(HIST("hCospLc"), ptLc, cospLc); registry.fill(HIST("hCospXyLc"), ptLc, cospXyLc); - if constexpr (withLcMl) { + if constexpr (WithLcMl) { registry.fill(HIST("hMlScoreBkgLc"), ptLc, candidate.prong0MlScoreBkg()); registry.fill(HIST("hMlScorePromptLc"), ptLc, candidate.prong0MlScorePrompt()); registry.fill(HIST("hMlScoreNonPromptLc"), ptLc, candidate.prong0MlScoreNonprompt()); } - if constexpr (withLbMl) { + if constexpr (WithLbMl) { registry.fill(HIST("hMlScoreSigLb"), ptCandLb, candidate.mlProbLbToLcPi()); } } } if (fillSparses) { - if constexpr (withLcMl) { + if constexpr (WithLcMl) { if (isSignal) { - if constexpr (withLcMl) { + if constexpr (WithLcMl) { registry.fill(HIST("hMassPtCutVarsRecSig"), invMassLb, ptCandLb, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassLc, ptLc, candidate.prong0MlScoreBkg(), candidate.prong0MlScoreNonprompt()); } else { registry.fill(HIST("hMassPtCutVarsRecSig"), invMassLb, ptCandLb, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassLc, ptLc, decLenLc, cospLc); } } else if (fillBackground) { - if constexpr (withLcMl) { + if constexpr (WithLcMl) { registry.fill(HIST("hMassPtCutVarsRecBg"), invMassLb, ptCandLb, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassLc, ptLc, candidate.prong0MlScoreBkg(), candidate.prong0MlScoreNonprompt()); } else { registry.fill(HIST("hMassPtCutVarsRecBg"), invMassLb, ptCandLb, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassLc, ptLc, decLenLc, cospLc); } } } else { - if constexpr (withLcMl) { + if constexpr (WithLcMl) { registry.fill(HIST("hMassPtCutVars"), invMassLb, ptCandLb, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassLc, ptLc, candidate.prong0MlScoreBkg(), candidate.prong0MlScoreNonprompt()); } else { registry.fill(HIST("hMassPtCutVars"), invMassLb, ptCandLb, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassLc, ptLc, decLenLc, cospLc); @@ -539,24 +539,24 @@ struct HfTaskLbReduced { } } if (fillTree) { - float pseudoRndm = ptLc * 1000. - static_cast(ptLc * 1000); - if (flagMcMatchRec != 0 || (((doMc && fillBackground) || !doMc) && (ptCandLb >= ptMaxForDownSample || pseudoRndm < downSampleBkgFactor))) { + float const pseudoRndm = ptLc * 1000. - static_cast(ptLc * 1000); + if (flagMcMatchRec != 0 || (((DoMc && fillBackground) || !DoMc) && (ptCandLb >= ptMaxForDownSample || pseudoRndm < downSampleBkgFactor))) { float prong0MlScoreBkg = -1.; float prong0MlScorePrompt = -1.; float prong0MlScoreNonprompt = -1.; float candidateMlScoreSig = -1; - if constexpr (withLcMl) { + if constexpr (WithLcMl) { prong0MlScoreBkg = candidate.prong0MlScoreBkg(); prong0MlScorePrompt = candidate.prong0MlScorePrompt(); prong0MlScoreNonprompt = candidate.prong0MlScoreNonprompt(); } - if constexpr (withLbMl) { + if constexpr (WithLbMl) { candidateMlScoreSig = candidate.mlProbLbToLcPi(); } auto prong1 = candidate.template prong1_as(); float ptMother = -1.; - if constexpr (doMc) { + if constexpr (DoMc) { ptMother = candidate.ptMother(); } @@ -617,7 +617,7 @@ struct HfTaskLbReduced { flagWrongCollision, ptMother); - if constexpr (withDecayTypeCheck) { + if constexpr (WithDecayTypeCheck) { hfRedLbMcCheck( flagMcMatchRec, flagWrongCollision, @@ -649,7 +649,7 @@ struct HfTaskLbReduced { std::array ptProngs = {particle.ptProng0(), particle.ptProng1()}; std::array yProngs = {particle.yProng0(), particle.yProng1()}; std::array etaProngs = {particle.etaProng0(), particle.etaProng1()}; - bool prongsInAcc = isProngInAcceptance(etaProngs[0], ptProngs[0]) && isProngInAcceptance(etaProngs[1], ptProngs[1]); + bool const prongsInAcc = isProngInAcceptance(etaProngs[0], ptProngs[0]) && isProngInAcceptance(etaProngs[1], ptProngs[1]); if (fillHistograms) { registry.fill(HIST("hPtProng0Gen"), ptParticle, ptProngs[0]); diff --git a/PWGHF/D2H/Tasks/taskLc.cxx b/PWGHF/D2H/Tasks/taskLc.cxx index f1fdc7ef961..8c391447428 100644 --- a/PWGHF/D2H/Tasks/taskLc.cxx +++ b/PWGHF/D2H/Tasks/taskLc.cxx @@ -45,6 +45,7 @@ #include #include +#include #include #include // std::vector @@ -331,10 +332,10 @@ struct HfTaskLc { const AxisSpec thnAxisOccupancy{thnConfigAxisOccupancy, "Occupancy"}; const AxisSpec thnAxisProperLifetime{thnConfigAxisProperLifetime, "T_{proper} (ps)"}; - bool isDataWithMl = doprocessDataWithMl || doprocessDataWithMlWithFT0C || doprocessDataWithMlWithFT0M; - bool isMcWithMl = doprocessMcWithMl || doprocessMcWithMlWithFT0C || doprocessMcWithMlWithFT0M; - bool isDataStd = doprocessDataStd || doprocessDataStdWithFT0C || doprocessDataStdWithFT0M; - bool isMcStd = doprocessMcStd || doprocessMcStdWithFT0C || doprocessMcStdWithFT0M; + bool const isDataWithMl = doprocessDataWithMl || doprocessDataWithMlWithFT0C || doprocessDataWithMlWithFT0M; + bool const isMcWithMl = doprocessMcWithMl || doprocessMcWithMlWithFT0C || doprocessMcWithMlWithFT0M; + bool const isDataStd = doprocessDataStd || doprocessDataStdWithFT0C || doprocessDataStdWithFT0M; + bool const isMcStd = doprocessMcStd || doprocessMcStdWithFT0C || doprocessMcStdWithFT0M; std::vector axesStd, axesWithBdt, axesGen; @@ -394,7 +395,7 @@ struct HfTaskLc { /// Fill MC histograms at reconstruction level /// \tparam fillMl switch to fill ML histograms - template + template void fillHistosMcRec(CollType const& collision, CandLcMcRec const& candidates, CandLcMcGen const& mcParticles) { @@ -554,7 +555,7 @@ struct HfTaskLc { registry.fill(HIST("MC/reconstructed/nonprompt/hDecLenErrSigNonPrompt"), candidate.errorDecayLength(), pt); } if (fillTHn) { - float cent = evaluateCentralityColl(collision); + float const cent = evaluateCentralityColl(collision); float occ{-1.}; if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) { occ = o2::hf_occupancy::getOccupancyColl(collision, occEstimator); @@ -565,7 +566,7 @@ struct HfTaskLc { if ((candidate.isSelLcToPKPi() >= selectionFlagLc) && pdgCodeProng0 == kProton) { massLc = hfHelper.invMassLcToPKPi(candidate); - if constexpr (fillMl) { + if constexpr (FillMl) { if (candidate.mlProbLcToPKPi().size() == NumberOfMlClasses) { outputBkg = candidate.mlProbLcToPKPi()[MlClassBackground]; /// bkg score outputPrompt = candidate.mlProbLcToPKPi()[MlClassPrompt]; /// prompt score @@ -594,7 +595,7 @@ struct HfTaskLc { if ((candidate.isSelLcToPiKP() >= selectionFlagLc) && pdgCodeProng0 == kPiPlus) { massLc = hfHelper.invMassLcToPiKP(candidate); - if constexpr (fillMl) { + if constexpr (FillMl) { if (candidate.mlProbLcToPiKP().size() == NumberOfMlClasses) { outputBkg = candidate.mlProbLcToPiKP()[MlClassBackground]; /// bkg score outputPrompt = candidate.mlProbLcToPiKP()[MlClassPrompt]; /// prompt score @@ -645,7 +646,7 @@ struct HfTaskLc { for (const auto& recCol : recoCollsPerMcColl) { numPvContributors = recCol.numContrib() > numPvContributors ? recCol.numContrib() : numPvContributors; } - float cent = o2::hf_centrality::getCentralityGenColl(recoCollsPerMcColl); + float const cent = o2::hf_centrality::getCentralityGenColl(recoCollsPerMcColl); float occ{-1.}; if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) { occ = o2::hf_occupancy::getOccupancyGenColl(recoCollsPerMcColl, occEstimator); @@ -709,7 +710,7 @@ struct HfTaskLc { /// Fill histograms for real data /// \tparam fillMl switch to fill ML histograms - template + template void fillHistosData(CollType const& collision, CandType const& candidates) { auto thisCollId = collision.globalIndex(); @@ -777,7 +778,7 @@ struct HfTaskLc { registry.fill(HIST("Data/hDecLenErr"), candidate.errorDecayLength(), pt); if (fillTHn) { - float cent = evaluateCentralityColl(collision); + float const cent = evaluateCentralityColl(collision); float occ{-1.}; if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) { occ = o2::hf_occupancy::getOccupancyColl(collision, occEstimator); @@ -788,7 +789,7 @@ struct HfTaskLc { if (candidate.isSelLcToPKPi() >= selectionFlagLc) { massLc = hfHelper.invMassLcToPKPi(candidate); - if constexpr (fillMl) { + if constexpr (FillMl) { if (candidate.mlProbLcToPKPi().size() == NumberOfMlClasses) { outputBkg = candidate.mlProbLcToPKPi()[MlClassBackground]; /// bkg score outputPrompt = candidate.mlProbLcToPKPi()[MlClassPrompt]; /// prompt score @@ -817,7 +818,7 @@ struct HfTaskLc { if (candidate.isSelLcToPiKP() >= selectionFlagLc) { massLc = hfHelper.invMassLcToPiKP(candidate); - if constexpr (fillMl) { + if constexpr (FillMl) { if (candidate.mlProbLcToPiKP().size() == NumberOfMlClasses) { outputBkg = candidate.mlProbLcToPiKP()[MlClassBackground]; /// bkg score outputPrompt = candidate.mlProbLcToPiKP()[MlClassPrompt]; /// prompt score @@ -848,26 +849,26 @@ struct HfTaskLc { } /// Run the analysis on real data /// \tparam fillMl switch to fill ML histograms - template + template void runAnalysisPerCollisionData(CollType const& collisions, CandType const& candidates) { for (const auto& collision : collisions) { - fillHistosData(collision, candidates); + fillHistosData(collision, candidates); } } /// Run the analysis on MC data /// \tparam fillMl switch to fill ML histograms - template + template void runAnalysisPerCollisionMc(CollType const& collisions, CandType const& candidates, CandLcMcGen const& mcParticles) { for (const auto& collision : collisions) { // MC Rec. - fillHistosMcRec(collision, candidates, mcParticles); + fillHistosMcRec(collision, candidates, mcParticles); } // MC gen. fillHistosMcGen(mcParticles, collisions); diff --git a/PWGHF/D2H/Tasks/taskLcToK0sP.cxx b/PWGHF/D2H/Tasks/taskLcToK0sP.cxx index f107452344a..955331e6d3f 100644 --- a/PWGHF/D2H/Tasks/taskLcToK0sP.cxx +++ b/PWGHF/D2H/Tasks/taskLcToK0sP.cxx @@ -62,25 +62,25 @@ struct HfTaskLcToK0sP { void init(InitContext& context) { // axes - AxisSpec axisBinsPt = {binsPt, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec axisPt = {300, 0.0f, 30.0f, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec axisEta = {500, -2.0f, 2.0f, "#it{#eta}"}; - AxisSpec axisPhi = {100, 0.f, 6.3f, "#it{#phi}"}; - AxisSpec axisMassCand = {600, 1.98f, 2.58f, "inv. mass (p K_{S}^{0}) (GeV/#it{c}^{2})"}; - AxisSpec axisd0 = {500, -0.5f, 0.5f, "DCAxy (cm)"}; - AxisSpec axisd0V0Daughters = {1000, -5.0f, 5.0f, "DCAxy (cm)"}; - AxisSpec axisV0CPA = {500, 0.98f, 1.0001f, "v0 cos pointing angle"}; - AxisSpec axisV0Radius = {1000, 0.f, 40.f, "V0 radius (cm)"}; - AxisSpec axisV0DCADaughters = {200, 0.f, 2.f, "DCA (cm)"}; - AxisSpec axisMassK0Short = {500, 0.4f, 0.6f, "#it{m}(K_{S}^{0}) (GeV/#it{c}^{2})"}; - AxisSpec axisMassLambda = {500, 1.0f, 1.2f, "#it{m}(#Lambda) (GeV/#it{c}^{2})"}; - AxisSpec axisMassGamma = {500, 0.0f, 0.4f, "#it{m}(#gamma) (GeV/#it{c}^{2})"}; - AxisSpec axisCPACand = {110, -1.1f, 1.1f, "candiate cos pointing angle"}; - AxisSpec axisDecLength = {200, 0.f, 2.0f, "decay length (cm)"}; - AxisSpec axisProperLifetime = {100, 0.f, 0.2f, "#it{c#tau} (cm)"}; - AxisSpec axisProperLifetimeV0 = {1000, 0.f, 80.f, "#it{c#tau} (cm)"}; - AxisSpec axisNSigma = {100, -6.f, 6.f, "n#it{#sigma}_{p}"}; - AxisSpec axisPidP = {100, 0.f, 10.0f, "#it{p} (GeV/#it{c})"}; + AxisSpec const axisBinsPt = {binsPt, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec const axisPt = {300, 0.0f, 30.0f, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec const axisEta = {500, -2.0f, 2.0f, "#it{#eta}"}; + AxisSpec const axisPhi = {100, 0.f, 6.3f, "#it{#phi}"}; + AxisSpec const axisMassCand = {600, 1.98f, 2.58f, "inv. mass (p K_{S}^{0}) (GeV/#it{c}^{2})"}; + AxisSpec const axisd0 = {500, -0.5f, 0.5f, "DCAxy (cm)"}; + AxisSpec const axisd0V0Daughters = {1000, -5.0f, 5.0f, "DCAxy (cm)"}; + AxisSpec const axisV0CPA = {500, 0.98f, 1.0001f, "v0 cos pointing angle"}; + AxisSpec const axisV0Radius = {1000, 0.f, 40.f, "V0 radius (cm)"}; + AxisSpec const axisV0DCADaughters = {200, 0.f, 2.f, "DCA (cm)"}; + AxisSpec const axisMassK0Short = {500, 0.4f, 0.6f, "#it{m}(K_{S}^{0}) (GeV/#it{c}^{2})"}; + AxisSpec const axisMassLambda = {500, 1.0f, 1.2f, "#it{m}(#Lambda) (GeV/#it{c}^{2})"}; + AxisSpec const axisMassGamma = {500, 0.0f, 0.4f, "#it{m}(#gamma) (GeV/#it{c}^{2})"}; + AxisSpec const axisCPACand = {110, -1.1f, 1.1f, "candiate cos pointing angle"}; + AxisSpec const axisDecLength = {200, 0.f, 2.0f, "decay length (cm)"}; + AxisSpec const axisProperLifetime = {100, 0.f, 0.2f, "#it{c#tau} (cm)"}; + AxisSpec const axisProperLifetimeV0 = {1000, 0.f, 80.f, "#it{c#tau} (cm)"}; + AxisSpec const axisNSigma = {100, -6.f, 6.f, "n#it{#sigma}_{p}"}; + AxisSpec const axisPidP = {100, 0.f, 10.0f, "#it{p} (GeV/#it{c})"}; // data registry.add("hPtCand", "cascade candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); registry.add("hEtaCand", "cascade candidates;candidate #it{#eta};entries", {HistType::kTH1F, {axisEta}}); diff --git a/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx b/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx index 69c09d88d5f..f3941a83889 100644 --- a/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx +++ b/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx @@ -135,14 +135,14 @@ struct HfTaskOmegac0ToOmegapi { if (doprocessDataKFParticleFT0C || doprocessDataKFParticleMlFT0C || doprocessDataKFParticleFT0M || doprocessDataKFParticleMlFT0M) { axes.push_back(thnAxisCent); - axes.push_back(thnConfigAxisNumPvContr); + axes.emplace_back(thnConfigAxisNumPvContr); } if (doprocessMcKFParticleFT0M || doprocessMcKFParticleMlFT0M) { axes.push_back(thnAxisCentMc); - axes.push_back(thnConfigAxisNumPvContr); + axes.emplace_back(thnConfigAxisNumPvContr); axesMcGen.push_back(thnAxisCentMc); - axesMcGen.push_back(thnConfigAxisNumPvContr); + axesMcGen.emplace_back(thnConfigAxisNumPvContr); } if (doprocessMcKFParticle || doprocessMcKFParticleMl || doprocessMcKFParticleFT0M || doprocessMcKFParticleMlFT0M) { @@ -177,7 +177,7 @@ struct HfTaskOmegac0ToOmegapi { return o2::hf_centrality::getCentralityColl(collision); } - template + template void processData(const CandType& candidates) { for (const auto& candidate : candidates) { @@ -189,7 +189,7 @@ struct HfTaskOmegac0ToOmegapi { continue; } - if constexpr (applyMl) { + if constexpr (ApplyMl) { registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), candidate.mlProbOmegac()[0]); } else { registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac()); @@ -197,12 +197,12 @@ struct HfTaskOmegac0ToOmegapi { } } - template + template void processDataCent(const CandType& candidates, CollType const& collisions) { for (const auto& collision : collisions) { auto thisCollId = collision.globalIndex(); - auto groupedOmegacCandidates = applyMl ? candidates.sliceBy(candOmegacKFMlPerCollision, thisCollId) : candidates.sliceBy(candOmegacKFPerCollision, thisCollId); + auto groupedOmegacCandidates = ApplyMl ? candidates.sliceBy(candOmegacKFMlPerCollision, thisCollId) : candidates.sliceBy(candOmegacKFPerCollision, thisCollId); auto numPvContributors = collision.numContrib(); for (const auto& candidate : groupedOmegacCandidates) { @@ -214,9 +214,9 @@ struct HfTaskOmegac0ToOmegapi { continue; } - float cent = evaluateCentralityColl(collision); + float const cent = evaluateCentralityColl(collision); - if constexpr (applyMl) { + if constexpr (ApplyMl) { registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), cent, numPvContributors, candidate.mlProbOmegac()[0]); if (fillTree) { @@ -230,7 +230,7 @@ struct HfTaskOmegac0ToOmegapi { } } - template + template void processMc(const CandType& candidates, Omegac0Gen const& mcParticles) { // MC rec. @@ -242,7 +242,7 @@ struct HfTaskOmegac0ToOmegapi { continue; } - if constexpr (applyMl) { + if constexpr (ApplyMl) { registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec(), candidate.mlProbOmegac()[0]); } else { @@ -262,13 +262,13 @@ struct HfTaskOmegac0ToOmegapi { if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { registry.fill(HIST("hMcGen"), ptGen, -1., yGen, RecoDecay::OriginType::Prompt); } else { - float ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt(); + float const ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt(); registry.fill(HIST("hMcGen"), ptGen, ptGenB, yGen, RecoDecay::OriginType::NonPrompt); } } } - template + template void processMcCent(const CandType& candidates, Omegac0Gen const& mcParticles, CollisionsWithMcLabels const& collisions, McCollisionWithCents const&) { @@ -282,10 +282,10 @@ struct HfTaskOmegac0ToOmegapi { } auto collision = candidate.template collision_as(); - uint16_t numPvContributors = collision.numContrib(); - float mcCent = evaluateCentralityColl(collision.template mcCollision_as()); + uint16_t const numPvContributors = collision.numContrib(); + float const mcCent = evaluateCentralityColl(collision.template mcCollision_as()); - if constexpr (applyMl) { + if constexpr (ApplyMl) { registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), mcCent, numPvContributors, candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec(), candidate.mlProbOmegac()[0]); } else { @@ -309,12 +309,12 @@ struct HfTaskOmegac0ToOmegapi { maxNumContrib = recCol.numContrib() > maxNumContrib ? recCol.numContrib() : maxNumContrib; } - float mcCent = evaluateCentralityColl(mcCollision); + float const mcCent = evaluateCentralityColl(mcCollision); if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { registry.fill(HIST("hMcGen"), ptGen, -1., yGen, RecoDecay::OriginType::Prompt, mcCent, maxNumContrib); } else { - float ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt(); + float const ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt(); registry.fill(HIST("hMcGen"), ptGen, ptGenB, yGen, RecoDecay::OriginType::NonPrompt, mcCent, maxNumContrib); } @@ -325,7 +325,7 @@ struct HfTaskOmegac0ToOmegapi { if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { registry.fill(HIST("hMcGenWithRecoColl"), ptGen, -1., yGen, RecoDecay::OriginType::Prompt, mcCent, maxNumContrib); } else { - float ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt(); + float const ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt(); registry.fill(HIST("hMcGenWithRecoColl"), ptGen, ptGenB, yGen, RecoDecay::OriginType::NonPrompt, mcCent, maxNumContrib); } } diff --git a/PWGHF/D2H/Tasks/taskSigmac.cxx b/PWGHF/D2H/Tasks/taskSigmac.cxx index 6818508421a..e6e9fbe4e1f 100644 --- a/PWGHF/D2H/Tasks/taskSigmac.cxx +++ b/PWGHF/D2H/Tasks/taskSigmac.cxx @@ -65,7 +65,7 @@ struct HfTaskSigmac { Configurable addSoftPiDcaToSigmacSparse{"addSoftPiDcaToSigmacSparse", false, "enable the filling of sof-pion dcaXY, dcaZ in the Σc0,++ THnSparse"}; HfHelper hfHelper; - bool isMc; + bool isMc{}; static constexpr std::size_t NDaughters{2u}; using RecoLc = soa::Join; @@ -152,11 +152,7 @@ struct HfTaskSigmac { } /// establish if the analysis is done on Data or MC - if (doprocessMcWoMl || doprocessMcWithMl) { - isMc = true; - } else { - isMc = false; - } + isMc = doprocessMcWoMl || doprocessMcWithMl; const AxisSpec thnAxisMassLambdaC{configAxisMassLambdaC, "inv. mass (p K #pi) (GeV/#it{c}^{2})"}; const AxisSpec thnAxisPtLambdaC{thnConfigAxisPt, "#it{p}_{T}(#Lambda_{c}^{+}) (GeV/#it{c})"}; @@ -344,7 +340,7 @@ struct HfTaskSigmac { /// @brief function to fill the histograms needed in analysis (data) /// @param candidatesSc are the reconstructed candidate Σc0,++ /// @param - template + template void fillHistosData(aod::HfCandSc const& candidatesSc, CandsLc const& candidatesLc, aod::Tracks const&) @@ -433,7 +429,7 @@ struct HfTaskSigmac { /// fill it only if no MC operations are enabled, otherwise fill it in the processMC with the right origin and channel! const float softPiAbsDcaXY = std::abs(candSc.softPiDcaXY()); const float softPiAbsDcaZ = std::abs(candSc.softPiDcaZ()); - if constexpr (useMl) { + if constexpr (UseMl) { /// fill with ML information /// BDT index 0: bkg score; BDT index 2: non-prompt score std::array outputMl{-1., -1.}; @@ -516,7 +512,7 @@ struct HfTaskSigmac { /// fill it only if no MC operations are enabled, otherwise fill it in the processMC with the right origin and channel! const float softPiAbsDcaXY = std::abs(candSc.softPiDcaXY()); const float softPiAbsDcaZ = std::abs(candSc.softPiDcaZ()); - if constexpr (useMl) { + if constexpr (UseMl) { /// fill with ML information /// BDT index 0: bkg score; BDT index 2: non-prompt score std::array outputMl{-1., -1.}; @@ -549,12 +545,12 @@ struct HfTaskSigmac { /// loop over Λc+ candidates w/o Σc0,++ mass-window cut for (const auto& candidateLc : candidatesLc) { double massLc(-1.); - double ptLc(candidateLc.pt()); + double const ptLc(candidateLc.pt()); double decLengthLc(candidateLc.decayLength()), decLengthXYLc(candidateLc.decayLengthXY()); double cpaLc(candidateLc.cpa()), cpaXYLc(candidateLc.cpaXY()); if (candidateLc.isSelLcToPKPi() >= 1) { massLc = hfHelper.invMassLcToPKPi(candidateLc); - if constexpr (useMl) { + if constexpr (UseMl) { /// fill with ML information /// BDT index 0: bkg score; BDT index 2: non-prompt score std::array outputMl{-1., -1.}; @@ -570,7 +566,7 @@ struct HfTaskSigmac { } if (candidateLc.isSelLcToPiKP() >= 1) { massLc = hfHelper.invMassLcToPiKP(candidateLc); - if constexpr (useMl) { + if constexpr (UseMl) { /// fill with ML information /// BDT index 0: bkg score; BDT index 2: non-prompt score std::array outputMl{-1., -1.}; @@ -593,7 +589,7 @@ struct HfTaskSigmac { /// @param candidatesSc are the reconstructed candidate Σc0,++ with MC info /// @param mcParticles are the generated particles with flags wheter they are Σc0,++ or not /// @param - template + template void fillHistosMc(soa::Join const& candidatesSc, soa::Join const& mcParticlesSc, soa::Join const& mcParticlesLc, @@ -606,12 +602,13 @@ struct HfTaskSigmac { for (const auto& particle : mcParticlesSc) { /// reject immediately particles different from Σc0,++ - bool isSc0Gen = (std::abs(particle.flagMcMatchGen()) == BIT(aod::hf_cand_sigmac::DecayType::Sc0ToPKPiPi)); - bool isScStar0Gen = (std::abs(particle.flagMcMatchGen()) == BIT(aod::hf_cand_sigmac::DecayType::ScStar0ToPKPiPi)); - bool isScPlusPlusGen = (std::abs(particle.flagMcMatchGen()) == BIT(aod::hf_cand_sigmac::DecayType::ScplusplusToPKPiPi)); - bool isScStarPlusPlusGen = (std::abs(particle.flagMcMatchGen()) == BIT(aod::hf_cand_sigmac::DecayType::ScStarPlusPlusToPKPiPi)); - if (!isSc0Gen && !isScPlusPlusGen && !isScStar0Gen && !isScStarPlusPlusGen) + bool const isSc0Gen = (std::abs(particle.flagMcMatchGen()) == BIT(aod::hf_cand_sigmac::DecayType::Sc0ToPKPiPi)); + bool const isScStar0Gen = (std::abs(particle.flagMcMatchGen()) == BIT(aod::hf_cand_sigmac::DecayType::ScStar0ToPKPiPi)); + bool const isScPlusPlusGen = (std::abs(particle.flagMcMatchGen()) == BIT(aod::hf_cand_sigmac::DecayType::ScplusplusToPKPiPi)); + bool const isScStarPlusPlusGen = (std::abs(particle.flagMcMatchGen()) == BIT(aod::hf_cand_sigmac::DecayType::ScStarPlusPlusToPKPiPi)); + if (!isSc0Gen && !isScPlusPlusGen && !isScStar0Gen && !isScStarPlusPlusGen) { continue; + } /// look for generated particles in acceptance /* @@ -711,7 +708,7 @@ struct HfTaskSigmac { registry.fill(HIST("MC/generated/hPtGenLcFromSc0PlusPlusSig"), ptGenLc, origin, channel); registry.fill(HIST("MC/generated/hEtaGenLcFromSc0PlusPlusSig"), etaGenLc, origin, channel); registry.fill(HIST("MC/generated/hPhiGenLcFromSc0PlusPlusSig"), phiGenLc, origin, channel); /// Generated Λc+ ← Σc0,++ signal - int8_t particleAntiparticle = particle.particleAntiparticle(); + int8_t const particleAntiparticle = particle.particleAntiparticle(); if (origin == RecoDecay::OriginType::Prompt) { registry.fill(HIST("MC/generated/hnSigmaCGen"), ptGenSc, ptGenScBMother, origin, channel, ptGenLc, 0, sigmacSpecies, particleAntiparticle); } else { @@ -746,7 +743,7 @@ struct HfTaskSigmac { registry.fill(HIST("MC/generated/hPtGenLcFromSc0PlusPlusSig"), ptGenLc, origin, channel); registry.fill(HIST("MC/generated/hEtaGenLcFromSc0PlusPlusSig"), etaGenLc, origin, channel); registry.fill(HIST("MC/generated/hPhiGenLcFromSc0PlusPlusSig"), phiGenLc, origin, channel); /// Generated Λc+ ← Σc0,++ signal - int8_t particleAntiparticle = particle.particleAntiparticle(); + int8_t const particleAntiparticle = particle.particleAntiparticle(); if (origin == RecoDecay::OriginType::Prompt) { registry.fill(HIST("MC/generated/hnSigmaCGen"), ptGenSc, ptGenScBMother, origin, channel, ptGenLc, 2, sigmacSpecies, particleAntiparticle); } else { @@ -772,8 +769,8 @@ struct HfTaskSigmac { continue; } double ptGenLc(particle.pt()), ptGenLcBMother(-1.); - int origin = particle.originMcGen(); - int channel = particle.flagMcDecayChanGen(); + int const origin = particle.originMcGen(); + int const channel = particle.flagMcDecayChanGen(); if (origin == RecoDecay::OriginType::Prompt) { registry.fill(HIST("MC/generated/hnLambdaCGen"), ptGenLc, ptGenLcBMother, origin, channel); } else { @@ -801,10 +798,10 @@ struct HfTaskSigmac { // candidateLc.flagMcDecayChanRec(); - bool isTrueSc0Reco = std::abs(candSc.flagMcMatchRec()) == BIT(aod::hf_cand_sigmac::DecayType::Sc0ToPKPiPi); - bool isTrueScStar0Reco = std::abs(candSc.flagMcMatchRec()) == BIT(aod::hf_cand_sigmac::DecayType::ScStar0ToPKPiPi); - bool isTrueScPlusPlusReco = std::abs(candSc.flagMcMatchRec()) == BIT(aod::hf_cand_sigmac::DecayType::ScplusplusToPKPiPi); - bool isTrueScStarPlusPlusReco = std::abs(candSc.flagMcMatchRec()) == BIT(aod::hf_cand_sigmac::DecayType::ScStarPlusPlusToPKPiPi); + bool const isTrueSc0Reco = std::abs(candSc.flagMcMatchRec()) == BIT(aod::hf_cand_sigmac::DecayType::Sc0ToPKPiPi); + bool const isTrueScStar0Reco = std::abs(candSc.flagMcMatchRec()) == BIT(aod::hf_cand_sigmac::DecayType::ScStar0ToPKPiPi); + bool const isTrueScPlusPlusReco = std::abs(candSc.flagMcMatchRec()) == BIT(aod::hf_cand_sigmac::DecayType::ScplusplusToPKPiPi); + bool const isTrueScStarPlusPlusReco = std::abs(candSc.flagMcMatchRec()) == BIT(aod::hf_cand_sigmac::DecayType::ScStarPlusPlusToPKPiPi); int sigmacSpecies = -1; if ((isTrueSc0Reco || isTrueScStar0Reco) && (chargeSc == o2::aod::hf_cand_sigmac::ChargeNull)) { /// Reconstructed Σc0 signal @@ -823,7 +820,7 @@ struct HfTaskSigmac { // Get the corresponding MC particle for Lc auto arrayDaughtersLc = std::array{candidateLc.template prong0_as(), candidateLc.template prong1_as(), candidateLc.template prong2_as()}; int8_t sign = 0; - int indexMcLcRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersLc, o2::constants::physics::Pdg::kLambdaCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2); + int const indexMcLcRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersLc, o2::constants::physics::Pdg::kLambdaCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2); auto particleLc = mcParticles.rawIteratorAt(indexMcLcRec); // Get the corresponding MC particle for soft pion auto particleSoftPi = candSc.prong1_as().mcParticle(); @@ -838,7 +835,7 @@ struct HfTaskSigmac { double ptGenSc(particleSc.pt()), ptGenLc(particleLc.pt()), ptGenSoftPi(particleSoftPi.pt()); double decLengthLc(candidateLc.decayLength()), decLengthXYLc(candidateLc.decayLengthXY()); double cpaLc(candidateLc.cpa()), cpaXYLc(candidateLc.cpaXY()); - int origin = candSc.originMcRec(); + int const origin = candSc.originMcRec(); auto channel = candidateLc.flagMcDecayChanRec(); /// 0: direct; 1: Λc± → p± K*; 2: Λc± → Δ(1232)±± K∓; 3: Λc± → Λ(1520) π± /// candidate Λc+ → pK-π+ (and charge conjugate) within the range of M(pK-π+) chosen in the Σc0,++ builder @@ -899,10 +896,10 @@ struct HfTaskSigmac { /// THn for candidate Σc0,++ cut variation if (enableTHn) { - int8_t particleAntiparticle = candSc.particleAntiparticle(); + int8_t const particleAntiparticle = candSc.particleAntiparticle(); const float softPiAbsDcaXY = std::abs(candSc.softPiDcaXY()); const float softPiAbsDcaZ = std::abs(candSc.softPiDcaZ()); - if constexpr (useMl) { + if constexpr (UseMl) { /// fill with ML information /// BDT index 0: bkg score; BDT index 2: non-prompt score std::array outputMl{-1., -1.}; @@ -984,10 +981,10 @@ struct HfTaskSigmac { /// THn for candidate Σc0,++ cut variation if (enableTHn) { - int8_t particleAntiparticle = candSc.particleAntiparticle(); + int8_t const particleAntiparticle = candSc.particleAntiparticle(); const float softPiAbsDcaXY = std::abs(candSc.softPiDcaXY()); const float softPiAbsDcaZ = std::abs(candSc.softPiDcaZ()); - if constexpr (useMl) { + if constexpr (UseMl) { /// fill with ML information /// BDT index 0: bkg score; BDT index 2: non-prompt score std::array outputMl{-1., -1.}; @@ -1029,7 +1026,7 @@ struct HfTaskSigmac { // Get the corresponding MC particle for Lc auto arrayDaughtersLc = std::array{candidateLc.template prong0_as(), candidateLc.template prong1_as(), candidateLc.template prong2_as()}; int8_t sign = 0; - int indexMcLcRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersLc, o2::constants::physics::Pdg::kLambdaCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2); + int const indexMcLcRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersLc, o2::constants::physics::Pdg::kLambdaCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2); auto particleLc = mcParticles.rawIteratorAt(indexMcLcRec); // Get the corresponding MC particle for soft pion auto particleSoftPi = candSc.prong1_as().mcParticle(); @@ -1044,7 +1041,7 @@ struct HfTaskSigmac { double ptGenSc(particleSc.pt()), ptGenLc(particleLc.pt()), ptGenSoftPi(particleSoftPi.pt()); double decLengthLc(candidateLc.decayLength()), decLengthXYLc(candidateLc.decayLengthXY()); double cpaLc(candidateLc.cpa()), cpaXYLc(candidateLc.cpaXY()); - int origin = candSc.originMcRec(); + int const origin = candSc.originMcRec(); auto channel = candidateLc.flagMcDecayChanRec(); /// 0: direct; 1: Λc± → p± K*; 2: Λc± → Δ(1232)±± K∓; 3: Λc± → Λ(1520) π±; FIXME: DecayChannelResonant /// candidate Λc+ → pK-π+ (and charge conjugate) within the range of M(pK-π+) chosen in the Σc0,++ builder @@ -1105,10 +1102,10 @@ struct HfTaskSigmac { /// THn for candidate Σc0,++ cut variation if (enableTHn) { - int8_t particleAntiparticle = candSc.particleAntiparticle(); + int8_t const particleAntiparticle = candSc.particleAntiparticle(); const float softPiAbsDcaXY = std::abs(candSc.softPiDcaXY()); const float softPiAbsDcaZ = std::abs(candSc.softPiDcaZ()); - if constexpr (useMl) { + if constexpr (UseMl) { /// fill with ML information /// BDT index 0: bkg score; BDT index 2: non-prompt score std::array outputMl{-1., -1.}; @@ -1188,10 +1185,10 @@ struct HfTaskSigmac { /// THn for candidate Σc0,++ cut variation if (enableTHn) { - int8_t particleAntiparticle = candSc.particleAntiparticle(); + int8_t const particleAntiparticle = candSc.particleAntiparticle(); const float softPiAbsDcaXY = std::abs(candSc.softPiDcaXY()); const float softPiAbsDcaZ = std::abs(candSc.softPiDcaZ()); - if constexpr (useMl) { + if constexpr (UseMl) { /// fill with ML information /// BDT index 0: bkg score; BDT index 2: non-prompt score std::array outputMl{-1., -1.}; @@ -1227,10 +1224,10 @@ struct HfTaskSigmac { continue; } double massLc(-1.); - double ptLc(candidateLc.pt()); + double const ptLc(candidateLc.pt()); double decLengthLc(candidateLc.decayLength()), decLengthXYLc(candidateLc.decayLengthXY()); double cpaLc(candidateLc.cpa()), cpaXYLc(candidateLc.cpaXY()); - int origin = candidateLc.originMcRec(); + int const origin = candidateLc.originMcRec(); auto channel = candidateLc.flagMcDecayChanRec(); /// 0: direct; 1: Λc± → p± K*; 2: Λc± → Δ(1232)±± K∓; 3: Λc± → Λ(1520) π± int pdgAbs = -1; if (candidateLc.template prong0_as().has_mcParticle()) { @@ -1238,7 +1235,7 @@ struct HfTaskSigmac { } if (candidateLc.isSelLcToPKPi() >= 1 && pdgAbs == kProton) { massLc = hfHelper.invMassLcToPKPi(candidateLc); - if constexpr (useMl) { + if constexpr (UseMl) { /// fill with ML information /// BDT index 0: bkg score; BDT index 2: non-prompt score std::array outputMl{-1., -1.}; @@ -1254,7 +1251,7 @@ struct HfTaskSigmac { } if (candidateLc.isSelLcToPiKP() >= 1 && pdgAbs == kPiPlus) { massLc = hfHelper.invMassLcToPiKP(candidateLc); - if constexpr (useMl) { + if constexpr (UseMl) { /// fill with ML information /// BDT index 0: bkg score; BDT index 2: non-prompt score std::array outputMl{-1., -1.}; diff --git a/PWGHF/D2H/Tasks/taskSigmacToCascade.cxx b/PWGHF/D2H/Tasks/taskSigmacToCascade.cxx index fc527254dac..5d6a27f7141 100644 --- a/PWGHF/D2H/Tasks/taskSigmacToCascade.cxx +++ b/PWGHF/D2H/Tasks/taskSigmacToCascade.cxx @@ -67,26 +67,26 @@ struct HfTaskSigmacToCascade { void init(InitContext&) { // axes - AxisSpec axisBinsPt = {binsPt, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec axisPt = {300, 0.0f, 30.0f, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec axisEta = {500, -2.0f, 2.0f, "#it{#eta}"}; - AxisSpec axisY = {500, -2.0f, 2.0f, "y"}; - AxisSpec axisPhi = {100, 0.f, 6.3f, "#it{#phi}"}; - AxisSpec axisMassCand = {600, 1.98f, 2.58f, "inv. mass (p K_{S}^{0}) (GeV/#it{c}^{2})"}; - AxisSpec axisd0 = {500, -0.5f, 0.5f, "DCAxy (cm)"}; - AxisSpec axisd0V0Daughters = {1000, -5.0f, 5.0f, "DCAxy (cm)"}; - AxisSpec axisV0CPA = {500, 0.98f, 1.0001f, "v0 cos pointing angle"}; - AxisSpec axisV0Radius = {1000, 0.f, 40.f, "V0 radius (cm)"}; - AxisSpec axisV0DCADaughters = {200, 0.f, 2.f, "DCA (cm)"}; - AxisSpec axisMassK0Short = {500, 0.4f, 0.6f, "#it{m}(K_{S}^{0}) (GeV/#it{c}^{2})"}; - AxisSpec axisMassLambda = {500, 1.0f, 1.2f, "#it{m}(#Lambda) (GeV/#it{c}^{2})"}; - AxisSpec axisMassGamma = {500, 0.0f, 0.4f, "#it{m}(#gamma) (GeV/#it{c}^{2})"}; - AxisSpec axisCPACand = {110, -1.1f, 1.1f, "candiate cos pointing angle"}; - AxisSpec axisDecLength = {200, 0.f, 2.0f, "decay length (cm)"}; - AxisSpec axisProperLifetime = {100, 0.f, 0.2f, "#it{c#tau} (cm)"}; - AxisSpec axisProperLifetimeV0 = {1000, 0.f, 80.f, "#it{c#tau} (cm)"}; - AxisSpec axisNSigma = {100, -6.f, 6.f, "n#it{#sigma}_{p}"}; - AxisSpec axisPidP = {100, 0.f, 10.0f, "#it{p} (GeV/#it{c})"}; + AxisSpec const axisBinsPt = {binsPt, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec const axisPt = {300, 0.0f, 30.0f, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec const axisEta = {500, -2.0f, 2.0f, "#it{#eta}"}; + AxisSpec const axisY = {500, -2.0f, 2.0f, "y"}; + AxisSpec const axisPhi = {100, 0.f, 6.3f, "#it{#phi}"}; + AxisSpec const axisMassCand = {600, 1.98f, 2.58f, "inv. mass (p K_{S}^{0}) (GeV/#it{c}^{2})"}; + AxisSpec const axisd0 = {500, -0.5f, 0.5f, "DCAxy (cm)"}; + AxisSpec const axisd0V0Daughters = {1000, -5.0f, 5.0f, "DCAxy (cm)"}; + AxisSpec const axisV0CPA = {500, 0.98f, 1.0001f, "v0 cos pointing angle"}; + AxisSpec const axisV0Radius = {1000, 0.f, 40.f, "V0 radius (cm)"}; + AxisSpec const axisV0DCADaughters = {200, 0.f, 2.f, "DCA (cm)"}; + AxisSpec const axisMassK0Short = {500, 0.4f, 0.6f, "#it{m}(K_{S}^{0}) (GeV/#it{c}^{2})"}; + AxisSpec const axisMassLambda = {500, 1.0f, 1.2f, "#it{m}(#Lambda) (GeV/#it{c}^{2})"}; + AxisSpec const axisMassGamma = {500, 0.0f, 0.4f, "#it{m}(#gamma) (GeV/#it{c}^{2})"}; + AxisSpec const axisCPACand = {110, -1.1f, 1.1f, "candiate cos pointing angle"}; + AxisSpec const axisDecLength = {200, 0.f, 2.0f, "decay length (cm)"}; + AxisSpec const axisProperLifetime = {100, 0.f, 0.2f, "#it{c#tau} (cm)"}; + AxisSpec const axisProperLifetimeV0 = {1000, 0.f, 80.f, "#it{c#tau} (cm)"}; + AxisSpec const axisNSigma = {100, -6.f, 6.f, "n#it{#sigma}_{p}"}; + AxisSpec const axisPidP = {100, 0.f, 10.0f, "#it{p} (GeV/#it{c})"}; const AxisSpec axisDeltaMassSigmaC{configAxisDeltaMassSigmaC, "#it{M}(pK_{S}^{0}#pi) - #it{M}(pK_{S}^{0}) (GeV/#it{c}^{2})"}; // data @@ -142,8 +142,8 @@ struct HfTaskSigmacToCascade { const auto& candidateLc = candSc.prongLc_as(); float massSc(-1.), massLc(-1.), deltaMass(-1.); float ptSc(candSc.pt()), ptLc(candidateLc.pt()); - float etaSc(candSc.eta()) /*, etaLc(candidateLc.eta())*/; - float phiSc(candSc.phi()) /*, phiLc(candidateLc.phi())*/; + float const etaSc(candSc.eta()) /*, etaLc(candidateLc.eta())*/; + float const phiSc(candSc.phi()) /*, phiLc(candidateLc.phi())*/; float ptSoftPi(candSc.prong1().pt()), etaSoftPi(candSc.prong1().eta()), phiSoftPi(candSc.prong1().phi()); double decLengthLc(candidateLc.decayLength()), decLengthXYLc(candidateLc.decayLengthXY()); float cpaLc(candidateLc.cpa()), cpaXYLc(candidateLc.cpaXY()); diff --git a/PWGHF/D2H/Tasks/taskXic.cxx b/PWGHF/D2H/Tasks/taskXic.cxx index 8a07bfbe3bd..4d517f9fdfb 100644 --- a/PWGHF/D2H/Tasks/taskXic.cxx +++ b/PWGHF/D2H/Tasks/taskXic.cxx @@ -119,10 +119,10 @@ struct HfTaskXic { LOGP(fatal, "no or more than one process function enabled! Please check your configuration!"); } - AxisSpec axisPPid = {100, 0.f, 10.0f, "#it{p} (GeV/#it{c})"}; - AxisSpec axisNSigmaPr = {100, -6.f, 6.f, "n#it{#sigma}_{p}"}; - AxisSpec axisNSigmaPi = {100, -6.f, 6.f, "n#it{#sigma}_{#pi}"}; - AxisSpec axisNSigmaKa = {100, -6.f, 6.f, "n#it{#sigma}_{K}"}; + AxisSpec const axisPPid = {100, 0.f, 10.0f, "#it{p} (GeV/#it{c})"}; + AxisSpec const axisNSigmaPr = {100, -6.f, 6.f, "n#it{#sigma}_{p}"}; + AxisSpec const axisNSigmaPi = {100, -6.f, 6.f, "n#it{#sigma}_{#pi}"}; + AxisSpec const axisNSigmaKa = {100, -6.f, 6.f, "n#it{#sigma}_{K}"}; auto vbins = (std::vector)binsPt; // histo in pt bins registry.add("Data/hMassVsPt", "3-prong candidates;inv. mass (p K #pi) (GeV/#it{c}^{2});;entries", {HistType::kTH2F, {{500, 2., 3.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); @@ -266,7 +266,7 @@ struct HfTaskXic { { return std::abs(etaProng) <= etaMaxAcceptance && ptProng >= ptMinAcceptance; } - template + template void analysisData(aod::Collision const& collision, Cands const& candidates, aod::TracksWDca const& tracks) @@ -370,7 +370,7 @@ struct HfTaskXic { const int ternaryCl = 3; if (candidate.isSelXicToPKPi() >= selectionFlagXic) { massXic = hfHelper.invMassXicToPKPi(candidate); - if constexpr (useMl) { + if constexpr (UseMl) { if (candidate.mlProbXicToPKPi().size() == ternaryCl) { outputBkg = candidate.mlProbXicToPKPi()[0]; /// bkg score outputPrompt = candidate.mlProbXicToPKPi()[1]; /// prompt score @@ -384,7 +384,7 @@ struct HfTaskXic { } if (candidate.isSelXicToPiKP() >= selectionFlagXic) { massXic = hfHelper.invMassXicToPiKP(candidate); - if constexpr (useMl) { + if constexpr (UseMl) { if (candidate.mlProbXicToPiKP().size() == ternaryCl) { outputBkg = candidate.mlProbXicToPiKP()[0]; /// bkg score outputPrompt = candidate.mlProbXicToPiKP()[1]; /// prompt score @@ -416,7 +416,7 @@ struct HfTaskXic { PROCESS_SWITCH(HfTaskXic, processDataWithMl, "Process Data with the ML method", false); // Fill MC histograms - template + template void analysisMc(Cands const& candidates, soa::Join const& mcParticles, aod::TracksWMc const&) @@ -477,7 +477,7 @@ struct HfTaskXic { registry.fill(HIST("MC/reconstructed/signal/hEtaVsPtRecSig"), candidate.eta(), ptCandidate); /// reconstructed signal prompt - int origin = candidate.originMcRec(); + int const origin = candidate.originMcRec(); if (origin == RecoDecay::OriginType::Prompt) { if ((candidate.isSelXicToPKPi() >= selectionFlagXic) && pdgCodeProng0 == kProton) { registry.fill(HIST("MC/reconstructed/prompt/hMassRecSigPrompt"), massXicToPKPi); @@ -506,7 +506,7 @@ struct HfTaskXic { double outputBkg(-1), outputPrompt(-1), outputFD(-1); const int ternaryCl = 3; if ((candidate.isSelXicToPKPi() >= selectionFlagXic) && pdgCodeProng0 == kProton) { - if constexpr (useMl) { + if constexpr (UseMl) { if (candidate.mlProbXicToPKPi().size() == ternaryCl) { outputBkg = candidate.mlProbXicToPKPi()[0]; /// bkg score outputPrompt = candidate.mlProbXicToPKPi()[1]; /// prompt score @@ -519,7 +519,7 @@ struct HfTaskXic { } } if ((candidate.isSelXicToPiKP() >= selectionFlagXic) && pdgCodeProng0 == kPiPlus) { - if constexpr (useMl) { + if constexpr (UseMl) { if (candidate.mlProbXicToPiKP().size() == ternaryCl) { outputBkg = candidate.mlProbXicToPiKP()[0]; /// bkg score outputPrompt = candidate.mlProbXicToPiKP()[1]; /// prompt score diff --git a/PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx b/PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx index 40efcbbcc31..55bfe924842 100644 --- a/PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx +++ b/PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx @@ -116,7 +116,7 @@ struct HfTaskXic0ToXiPi { const AxisSpec thnAxisNumPvContr{thnConfigAxisNumPvContr, "Number of PV contributors"}; if (doprocessMcWithKFParticle || doprocessMcWithKFParticleMl) { - std::vector axesAcc = {thnAxisGenPtD, thnAxisGenPtB, thnAxisY, thnAxisOrigin, thnAxisNumPvContr}; + std::vector const axesAcc = {thnAxisGenPtD, thnAxisGenPtB, thnAxisY, thnAxisOrigin, thnAxisNumPvContr}; registry.add("hSparseAcc", "Thn for generated Xic0 from charm and beauty", HistType::kTHnSparseD, axesAcc); registry.get(HIST("hSparseAcc"))->Sumw2(); } @@ -141,8 +141,8 @@ struct HfTaskXic0ToXiPi { const AxisSpec thnAxisPromptScore{thnConfigAxisPromptScore, "BDT score prompt."}; const AxisSpec thnAxisCent{thnConfigAxisCent, "Centrality."}; const AxisSpec thnAxisPtPion{thnConfigAxisPtPion, "Pt of Pion from Xic0."}; - std::vector axesWithBdtCent = {thnAxisPromptScore, thnAxisMass, thnAxisPt, thnAxisY, thnAxisCent, thnAxisPtPion, thnConfigAxisNumPvContr}; - std::vector axesWithCent = {thnAxisMass, thnAxisPt, thnAxisY, thnAxisCent, thnAxisPtPion, thnConfigAxisNumPvContr}; + std::vector const axesWithBdtCent = {thnAxisPromptScore, thnAxisMass, thnAxisPt, thnAxisY, thnAxisCent, thnAxisPtPion, thnConfigAxisNumPvContr}; + std::vector const axesWithCent = {thnAxisMass, thnAxisPt, thnAxisY, thnAxisCent, thnAxisPtPion, thnConfigAxisNumPvContr}; registry.add("hBdtScoreVsMassVsPtVsYVsCentVsPtPion", "Thn for Xic0 candidates with BDT&Cent&pTpi", HistType::kTHnSparseD, axesWithBdtCent); registry.add("hMassVsPtVsYVsCentVsPtPion", "Thn for Xic0 candidates with Cent&pTpi", HistType::kTHnSparseD, axesWithCent); registry.get(HIST("hBdtScoreVsMassVsPtVsYVsCentVsPtPion"))->Sumw2(); @@ -150,7 +150,7 @@ struct HfTaskXic0ToXiPi { } } - template + template void processData(const CandType& candidates, CollType const&) { for (const auto& candidate : candidates) { @@ -161,7 +161,7 @@ struct HfTaskXic0ToXiPi { continue; } - if constexpr (applyMl) { + if constexpr (ApplyMl) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsXic0Type"), candidate.mlProbToXiPi()[0], candidate.invMassCharmBaryon(), candidate.kfptXic(), candidate.kfRapXic()); } else { registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsXic0Type"), candidate.invMassCharmBaryon(), candidate.kfptXic(), candidate.kfRapXic()); @@ -169,13 +169,13 @@ struct HfTaskXic0ToXiPi { } } - template + template void processDataCent(const CandType& candidates, CollType const& collisions) { for (const auto& collision : collisions) { auto thisCollId = collision.globalIndex(); - auto groupedXicCandidates = applyMl + auto groupedXicCandidates = ApplyMl ? candidates.sliceBy(candXicKFMlPerCollision, thisCollId) : candidates.sliceBy(candXicKFPerCollision, thisCollId); // auto numPvContributors = collision.numContrib(); @@ -190,13 +190,13 @@ struct HfTaskXic0ToXiPi { auto numPvContributors = candidate.template collision_as().numContrib(); float centrality = -999.f; - if constexpr (useCentrality) { + if constexpr (UseCentrality) { auto const& collision = candidate.template collision_as(); centrality = o2::hf_centrality::getCentralityColl(collision); } - double kfptXic = RecoDecay::sqrtSumOfSquares(candidate.pxCharmBaryon(), candidate.pyCharmBaryon()); - double kfptPiFromXic = RecoDecay::sqrtSumOfSquares(candidate.pxBachFromCharmBaryon(), candidate.pyBachFromCharmBaryon()); - if constexpr (applyMl) { + double const kfptXic = RecoDecay::sqrtSumOfSquares(candidate.pxCharmBaryon(), candidate.pyCharmBaryon()); + double const kfptPiFromXic = RecoDecay::sqrtSumOfSquares(candidate.pxBachFromCharmBaryon(), candidate.pyBachFromCharmBaryon()); + if constexpr (ApplyMl) { registry.fill(HIST("hBdtScoreVsMassVsPtVsYVsCentVsPtPion"), candidate.mlProbToXiPi()[0], candidate.invMassCharmBaryon(), @@ -218,7 +218,7 @@ struct HfTaskXic0ToXiPi { } } - template + template void processMc(const CandType& candidates, Xic0Gen const& mcParticles, TracksMc const&, @@ -235,8 +235,8 @@ struct HfTaskXic0ToXiPi { } auto numPvContributors = candidate.template collision_as().numContrib(); - double kfptXic = RecoDecay::sqrtSumOfSquares(candidate.pxCharmBaryon(), candidate.pyCharmBaryon()); - if constexpr (applyMl) { + double const kfptXic = RecoDecay::sqrtSumOfSquares(candidate.pxCharmBaryon(), candidate.pyCharmBaryon()); + if constexpr (ApplyMl) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsXic0Type"), candidate.mlProbToXiPi()[0], candidate.invMassCharmBaryon(), @@ -281,7 +281,7 @@ struct HfTaskXic0ToXiPi { RecoDecay::OriginType::Prompt, maxNumContrib); } else { - float ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt(); + float const ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt(); registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, @@ -334,23 +334,23 @@ struct HfTaskXic0ToXiPi { } PROCESS_SWITCH(HfTaskXic0ToXiPi, processDataWithKFParticleMlFT0M, "process HfTaskXic0ToXiPi with KFParticle and ML selections and with FT0M centrality", false); - void processMcWithKFParticle(Xic0CandsMcKF const& Xic0CandidatesMcKF, + void processMcWithKFParticle(Xic0CandsMcKF const& xic0CandidatesMcKf, Xic0Gen const& mcParticles, TracksMc const& tracks, CollisionsWithMcLabels const& collisions, aod::McCollisions const& mcCollisions) { - processMc(Xic0CandidatesMcKF, mcParticles, tracks, collisions, mcCollisions); + processMc(xic0CandidatesMcKf, mcParticles, tracks, collisions, mcCollisions); } PROCESS_SWITCH(HfTaskXic0ToXiPi, processMcWithKFParticle, "Process MC with KFParticle", false); - void processMcWithKFParticleMl(Xic0CandsMlMcKF const& Xic0CandidatesMlMcKF, + void processMcWithKFParticleMl(Xic0CandsMlMcKF const& xic0CandidatesMlMcKf, Xic0Gen const& mcParticles, TracksMc const& tracks, CollisionsWithMcLabels const& collisions, aod::McCollisions const& mcCollisions) { - processMc(Xic0CandidatesMlMcKF, mcParticles, tracks, collisions, mcCollisions); + processMc(xic0CandidatesMlMcKf, mcParticles, tracks, collisions, mcCollisions); } PROCESS_SWITCH(HfTaskXic0ToXiPi, processMcWithKFParticleMl, "Process MC with KFParticle and ML selections", false); }; diff --git a/PWGHF/D2H/Tasks/taskXicToXiPiPi.cxx b/PWGHF/D2H/Tasks/taskXicToXiPiPi.cxx index cc3459eba4a..79853e9dc46 100644 --- a/PWGHF/D2H/Tasks/taskXicToXiPiPi.cxx +++ b/PWGHF/D2H/Tasks/taskXicToXiPiPi.cxx @@ -67,7 +67,7 @@ struct HfTaskXicToXiPiPi { // THnSparese for ML selection check Configurable enableTHn{"enableTHn", false, "Fill THnSparse for Xic"}; - const int nVarsMultiClass = 3; + static constexpr int NVarsMultiClass{3}; Service pdg; @@ -286,23 +286,23 @@ struct HfTaskXicToXiPiPi { /// Fill THnSpare depending on whether ML selection is used // \param candidate is candidate - template + template void fillTHnSparse(const T1& candidate) { if (!enableTHn) { return; } - if constexpr (useMl) { + if constexpr (UseMl) { // with ML information double outputBkg = -99.; // bkg score double outputPrompt = -99.; // prompt score double outputFD = -99.; // non-prompt score - int scoreSize = candidate.mlProbXicToXiPiPi().size(); + int const scoreSize = candidate.mlProbXicToXiPiPi().size(); if (scoreSize > 0) { outputBkg = candidate.mlProbXicToXiPiPi()[0]; outputPrompt = candidate.mlProbXicToXiPiPi()[1]; - if (scoreSize == nVarsMultiClass) { + if (scoreSize == NVarsMultiClass) { outputFD = candidate.mlProbXicToXiPiPi()[2]; } } @@ -324,7 +324,7 @@ struct HfTaskXicToXiPiPi { } /// Function to fill histograms - template + template void fillHistograms(TCanTable const& candidates) { for (const auto& candidate : candidates) { @@ -369,7 +369,7 @@ struct HfTaskXicToXiPiPi { registry.fill(HIST("hMassXiPi2"), candidate.invMassXiPi1(), ptCandXic); // fill KFParticle specific histograms - if constexpr (useKfParticle) { + if constexpr (UseKfParticle) { registry.fill(HIST("hChi2GeoXi"), candidate.kfCascadeChi2(), ptCandXic); registry.fill(HIST("hChi2GeoLam"), candidate.kfV0Chi2(), ptCandXic); registry.fill(HIST("hChi2TopoXicPlusToPV"), candidate.chi2TopoXicPlusToPV(), ptCandXic); @@ -377,7 +377,7 @@ struct HfTaskXicToXiPiPi { // fill THnSparse if (enableTHn) { - if constexpr (useMl) { + if constexpr (UseMl) { fillTHnSparse(candidate); } else { fillTHnSparse(candidate); @@ -387,7 +387,7 @@ struct HfTaskXicToXiPiPi { } /// Function for MC analysis and histogram filling - template + template void fillHistogramsMc(TCandTable const& candidates, soa::Join const& mcParticles, aod::TracksWMc const&) @@ -441,7 +441,7 @@ struct HfTaskXicToXiPiPi { registry.fill(HIST("hCPAxyLambdaRecSig"), candidate.cpaLambda(), ptCandXic); // fill KFParticle specific histograms - if constexpr (useKfParticle) { + if constexpr (UseKfParticle) { registry.fill(HIST("hChi2geoXiRecSig"), candidate.kfCascadeChi2(), ptCandXic); registry.fill(HIST("hChi2geoLamRecSig"), candidate.kfV0Chi2(), ptCandXic); registry.fill(HIST("hChi2TopoXicPlusToPVRecSig"), candidate.chi2TopoXicPlusToPV(), ptCandXic); @@ -479,7 +479,7 @@ struct HfTaskXicToXiPiPi { registry.fill(HIST("hCPAxyLambdaRecBg"), candidate.cpaLambda(), ptCandXic); // fill KFParticle specific histograms - if constexpr (useKfParticle) { + if constexpr (UseKfParticle) { registry.fill(HIST("hChi2geoXiRecBg"), candidate.kfCascadeChi2(), ptCandXic); registry.fill(HIST("hChi2geoLamRecBg"), candidate.kfV0Chi2(), ptCandXic); registry.fill(HIST("hChi2TopoXicPlusToPVRecBg"), candidate.chi2TopoXicPlusToPV(), ptCandXic); @@ -497,7 +497,7 @@ struct HfTaskXicToXiPiPi { } // fill THnSparse if (enableTHn) { - if constexpr (useMl) { + if constexpr (UseMl) { fillTHnSparse(candidate); } else { fillTHnSparse(candidate); @@ -518,16 +518,16 @@ struct HfTaskXicToXiPiPi { } // get kinematic variables of Ξ π π - std::array ptProngs; - std::array yProngs; - std::array etaProngs; - std::array prodVtxXProngs; - std::array prodVtxYProngs; - std::array prodVtxZProngs; + std::array ptProngs{}; + std::array yProngs{}; + std::array etaProngs{}; + std::array prodVtxXProngs{}; + std::array prodVtxYProngs{}; + std::array prodVtxZProngs{}; int counter = 0; RecoDecay::getDaughters(particle, &arrDaughIndex, std::array{+kXiMinus, +kPiPlus, +kPiPlus}, 2); - for (auto iProng = 0u; iProng < arrDaughIndex.size(); ++iProng) { - auto daughI = mcParticles.rawIteratorAt(arrDaughIndex[iProng]); + for (const int iProng : arrDaughIndex) { + auto daughI = mcParticles.rawIteratorAt(iProng); ptProngs[counter] = daughI.pt(); etaProngs[counter] = daughI.eta(); yProngs[counter] = RecoDecay::y(daughI.pVector(), pdg->Mass(daughI.pdgCode())); diff --git a/PWGHF/D2H/Tasks/taskXicc.cxx b/PWGHF/D2H/Tasks/taskXicc.cxx index 90f4c5da24d..2c8e6fcd789 100644 --- a/PWGHF/D2H/Tasks/taskXicc.cxx +++ b/PWGHF/D2H/Tasks/taskXicc.cxx @@ -43,7 +43,7 @@ using namespace o2::framework::expressions; void customize(std::vector& workflowOptions) { - ConfigParamSpec optionDoMC{"doMC", VariantType::Bool, true, {"Fill MC histograms."}}; + ConfigParamSpec const optionDoMC{"doMC", VariantType::Bool, true, {"Fill MC histograms."}}; workflowOptions.push_back(optionDoMC); } @@ -87,7 +87,7 @@ struct HfTaskXicc { void process(soa::Filtered> const& candidates) { for (const auto& candidate : candidates) { - if (!(candidate.hfflag() & 1 << aod::hf_cand_xicc::DecayType::XiccToXicPi)) { + if ((candidate.hfflag() & 1 << aod::hf_cand_xicc::DecayType::XiccToXicPi) == 0) { continue; } if (yCandMax >= 0. && std::abs(hfHelper.yXicc(candidate)) > yCandMax) { @@ -195,7 +195,7 @@ struct HfTaskXiccMc { { // MC rec. for (const auto& candidate : candidates) { - if (!(candidate.hfflag() & 1 << aod::hf_cand_xicc::DecayType::XiccToXicPi)) { + if ((candidate.hfflag() & 1 << aod::hf_cand_xicc::DecayType::XiccToXicPi) == 0) { continue; } if (yCandMax >= 0. && std::abs(hfHelper.yXicc(candidate)) > yCandMax) { diff --git a/PWGHF/D2H/Utils/utilsRedDataFormat.h b/PWGHF/D2H/Utils/utilsRedDataFormat.h index f5115e59ac0..b188bee7645 100644 --- a/PWGHF/D2H/Utils/utilsRedDataFormat.h +++ b/PWGHF/D2H/Utils/utilsRedDataFormat.h @@ -33,11 +33,11 @@ namespace o2::hf_evsel /// \tparam useEvSel use information from the EvSel table /// \tparam centEstimator centrality estimator /// \param collision collision to test against the selection criteria -template +template void checkEvSel(Coll const& collision, o2::hf_evsel::HfEventSelection& hfEvSel, int& zvtxColl, int& sel8Coll, int& zvtxAndSel8Coll, int& zvtxAndSel8CollAndSoftTrig, int& allSelColl, o2::framework::Service const& ccdb, o2::framework::HistogramRegistry& registry) { float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (!TESTBIT(rejectionMask, o2::hf_evsel::EventRejection::Trigger)) { sel8Coll++; } @@ -63,7 +63,7 @@ namespace o2::pid_tpc_tof_utils template float getTpcTofNSigmaPi1(const T1& prong1) { - float defaultNSigma = -999.f; // -999.f is the default value set in TPCPIDResponse.h and PIDTOF.h + float const defaultNSigma = -999.f; // -999.f is the default value set in TPCPIDResponse.h and PIDTOF.h bool hasTpc = prong1.hasTPC(); bool hasTof = prong1.hasTOF(); @@ -87,7 +87,7 @@ float getTpcTofNSigmaPi1(const T1& prong1) template float getTpcTofNSigmaSoftPi(const T1& prongSoftPi) { - float defaultNSigma = -999.f; // -999.f is the default value set in TPCPIDResponse.h and PIDTOF.h + float const defaultNSigma = -999.f; // -999.f is the default value set in TPCPIDResponse.h and PIDTOF.h bool hasTpc = prongSoftPi.hasTPC(); bool hasTof = prongSoftPi.hasTOF(); @@ -112,7 +112,7 @@ float getTpcTofNSigmaSoftPi(const T1& prongSoftPi) template float getTpcTofNSigmaKa1(const T1& prong1) { - float defaultNSigma = -999.f; // -999.f is the default value set in TPCPIDResponse.h and PIDTOF.h + float const defaultNSigma = -999.f; // -999.f is the default value set in TPCPIDResponse.h and PIDTOF.h bool hasTpc = prong1.hasTPC(); bool hasTof = prong1.hasTOF(); diff --git a/PWGHF/D2H/Utils/utilsSigmac.h b/PWGHF/D2H/Utils/utilsSigmac.h index b1f9012c28f..4777235ee6a 100644 --- a/PWGHF/D2H/Utils/utilsSigmac.h +++ b/PWGHF/D2H/Utils/utilsSigmac.h @@ -18,6 +18,8 @@ #include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include + #include namespace o2::hf_sigmac_utils diff --git a/PWGHF/HFC/Macros/DhCorrelationExtraction.cxx b/PWGHF/HFC/Macros/DhCorrelationExtraction.cxx index 5e6125d0bdb..ebf50d0f10e 100644 --- a/PWGHF/HFC/Macros/DhCorrelationExtraction.cxx +++ b/PWGHF/HFC/Macros/DhCorrelationExtraction.cxx @@ -16,6 +16,7 @@ #include "DhCorrelationExtraction.h" +#include #include #include #include @@ -24,40 +25,41 @@ #include #include #include +#include +#include #include +#include #include #include +#include #include DhCorrelationExtraction::DhCorrelationExtraction() : // default constructor - fFileMass(0x0), - fFileSE(0x0), - fFileME(0x0), - fFileFDTemplate(0x0), - fFileFDPromptFrac(0x0), - fFileSecPart(0x0), - fDirMass(0x0), - fDirSE(0x0), - fDirME(0x0), - fDirSecPart(0x0), - fFilePromptMc(0x0), - fFileNonPromptMc(0x0), - fCorrectedCorrHisto(0x0), - fCorrectedCorrHisto_BaselineSubtr(0x0), - fCorrectedCorrHisto_Reflected(0x0), - fCorrectedCorrHisto_Reflected_BaselineSubtr(0x0), + fFileMass(nullptr), + fFileSE(nullptr), + fFileME(nullptr), + fFileFDTemplate(nullptr), + fFileFDPromptFrac(nullptr), + fFileSecPart(nullptr), + fFilePromptMc(nullptr), + fFileNonPromptMc(nullptr), + fDirMass(nullptr), + fDirSE(nullptr), + fDirME(nullptr), + fDirSecPart(nullptr), + fCorrectedCorrHisto(nullptr), + fCorrectedCorrHistoBaselineSubtr(nullptr), + fCorrectedCorrHistoReflected(nullptr), + fCorrectedCorrHistoReflectedBaselineSubtr(nullptr), fDmesonSpecies(kDsToKKPi), fDmesonLabel("Ds"), - fNpools(9), - fDeltaEtaMin(-1.), - fDeltaEtaMax(1.), - fCorrectPoolsSeparately(kTRUE), - fSubtractSoftPiME(kFALSE), fFileNameSE(""), fFileNameME(""), fFileSecPartName(""), + fFileFDTemplateName(""), + fFileFDPromptFracName(""), fFilePromptMcRecName(""), fFileNonPromptMcRecName(""), fDirNameSE(""), @@ -74,30 +76,33 @@ DhCorrelationExtraction::DhCorrelationExtraction() : // default constructor fMECorrelSidebandsName(""), fMECorrelSidebandLeftName(""), fMECorrelSidebandRightName(""), - fFileFDTemplateName(""), - fFileFDPromptFracName(""), fHistoFDTemplatePromptName(""), fHistoFDTemplateNonPromptName(""), fHistoFDPromptFracName(""), fHistoPrimaryPartName(""), fHistoAllPartName(""), + fNpools(9), + fRebinAxisDeltaEta(1), + fRebinAxisDeltaPhi(1), + fDebug(0), + fBinPtCand(0), + fBinPtHad(0), + fDeltaEtaMin(-1.), + fDeltaEtaMax(1.), fBkgScaleFactor(1.), fSgnYieldNorm(1.), fBkgYield(1.), + fCorrectPoolsSeparately(kTRUE), + fSubtractSoftPiME(kFALSE), fRebinAngCorr(kFALSE), fRebinFDCorr(kFALSE), fRebinSecPart(kFALSE), fSidebandDivided(kFALSE), fUseSidebLeft(kFALSE), fUseSidebRight(kFALSE), - fRebinAxisDeltaEta(1), - fRebinAxisDeltaPhi(1), - fBinPtCand(0), - fBinPtHad(0), - fDebug(0), - fFDsubtraction(0), - fSecPartContamination(0), - fCorrBiasBtoD(0) + fFDsubtraction(false), + fSecPartContamination(false), + fCorrBiasBtoD(false) { } @@ -113,19 +118,16 @@ DhCorrelationExtraction::DhCorrelationExtraction(const DhCorrelationExtraction& fDirMass(source.fDirMass), fDirSecPart(source.fDirSecPart), fCorrectedCorrHisto(source.fCorrectedCorrHisto), - fCorrectedCorrHisto_BaselineSubtr(source.fCorrectedCorrHisto_BaselineSubtr), - fCorrectedCorrHisto_Reflected(source.fCorrectedCorrHisto_Reflected), - fCorrectedCorrHisto_Reflected_BaselineSubtr(source.fCorrectedCorrHisto_Reflected_BaselineSubtr), + fCorrectedCorrHistoBaselineSubtr(source.fCorrectedCorrHistoBaselineSubtr), + fCorrectedCorrHistoReflected(source.fCorrectedCorrHistoReflected), + fCorrectedCorrHistoReflectedBaselineSubtr(source.fCorrectedCorrHistoReflectedBaselineSubtr), fDmesonSpecies(source.fDmesonSpecies), fDmesonLabel(source.fDmesonLabel), - fNpools(source.fNpools), - fDeltaEtaMin(source.fDeltaEtaMin), - fDeltaEtaMax(source.fDeltaEtaMax), - fCorrectPoolsSeparately(source.fCorrectPoolsSeparately), - fSubtractSoftPiME(source.fSubtractSoftPiME), fFileNameSE(source.fFileNameSE), fFileNameME(source.fFileNameME), fFileSecPartName(source.fFileSecPartName), + fFileFDTemplateName(source.fFileFDTemplateName), + fFileFDPromptFracName(source.fFileFDPromptFracName), fFilePromptMcRecName(source.fFilePromptMcRecName), fFileNonPromptMcRecName(source.fFileNonPromptMcRecName), fDirNameSE(source.fDirNameSE), @@ -142,27 +144,30 @@ DhCorrelationExtraction::DhCorrelationExtraction(const DhCorrelationExtraction& fMECorrelSidebandsName(source.fMECorrelSidebandsName), fMECorrelSidebandLeftName(source.fMECorrelSidebandLeftName), fMECorrelSidebandRightName(source.fMECorrelSidebandRightName), - fFileFDTemplateName(source.fFileFDTemplateName), - fFileFDPromptFracName(source.fFileFDPromptFracName), fHistoFDTemplatePromptName(source.fHistoFDTemplatePromptName), fHistoFDTemplateNonPromptName(source.fHistoFDTemplateNonPromptName), fHistoFDPromptFracName(source.fHistoFDPromptFracName), fHistoPrimaryPartName(source.fHistoPrimaryPartName), fHistoAllPartName(source.fHistoAllPartName), + fNpools(source.fNpools), + fRebinAxisDeltaEta(source.fRebinAxisDeltaEta), + fRebinAxisDeltaPhi(source.fRebinAxisDeltaPhi), + fDebug(source.fDebug), + fBinPtCand(source.fBinPtCand), + fBinPtHad(source.fBinPtHad), + fDeltaEtaMin(source.fDeltaEtaMin), + fDeltaEtaMax(source.fDeltaEtaMax), fBkgScaleFactor(source.fBkgScaleFactor), fSgnYieldNorm(source.fSgnYieldNorm), fBkgYield(source.fBkgYield), + fCorrectPoolsSeparately(source.fCorrectPoolsSeparately), + fSubtractSoftPiME(source.fSubtractSoftPiME), fRebinAngCorr(source.fRebinAngCorr), fRebinFDCorr(source.fRebinFDCorr), fRebinSecPart(source.fRebinSecPart), fSidebandDivided(source.fSidebandDivided), fUseSidebLeft(source.fUseSidebLeft), fUseSidebRight(source.fUseSidebRight), - fRebinAxisDeltaEta(source.fRebinAxisDeltaEta), - fRebinAxisDeltaPhi(source.fRebinAxisDeltaPhi), - fBinPtCand(source.fBinPtCand), - fBinPtHad(source.fBinPtHad), - fDebug(source.fDebug), fFDsubtraction(source.fFDsubtraction), fSecPartContamination(source.fSecPartContamination), fCorrBiasBtoD(source.fCorrBiasBtoD) @@ -170,17 +175,17 @@ DhCorrelationExtraction::DhCorrelationExtraction(const DhCorrelationExtraction& } DhCorrelationExtraction::~DhCorrelationExtraction() -// destructor -{ -} + // destructor + = default; -Bool_t DhCorrelationExtraction::SetDmesonSpecie(DmesonSpecie k) +Bool_t DhCorrelationExtraction::setDmesonSpecie(DmesonSpecie k) { if (k < 0 || k > 3) { printf("[ERROR] D meson specie not correctly set!\n"); return kFALSE; - } else if (k == 0) { + } + if (k == 0) { fDmesonLabel = "Dzero"; } else if (k == 1) { fDmesonLabel = "Dplus"; @@ -193,317 +198,318 @@ Bool_t DhCorrelationExtraction::SetDmesonSpecie(DmesonSpecie k) return kTRUE; } -Bool_t DhCorrelationExtraction::ExtractCorrelations(Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax, TString codeName) +Bool_t DhCorrelationExtraction::extractCorrelations(Double_t ptCandMin, Double_t ptCandMax, Double_t ptHadMin, Double_t ptHadMax, TString codeName) { if (fSubtractSoftPiME) { printf("[INFO] Fake softPi subtraction in ME via extraction code is enabled!\n"); } - if (!fCorrectPoolsSeparately) + if (!fCorrectPoolsSeparately) { fNpools = 1; // single histogram with integrated pools + } // Histograms definition - TH2D* hSE_Sign[fNpools]; - TH2D* hME_Sign[fNpools]; - TH2D* hME_Sign_SoftPi[fNpools]; - TH2D* hSE_Sideb[fNpools]; - TH2D* hME_Sideb[fNpools]; - TH2D* hME_Sideb_SoftPi[fNpools]; - - TH2D* hCorr_Sign[fNpools]; - TH2D* hCorr_Sideb[fNpools]; - - TH2D* h2D_Sign; - TH2D* h2D_Sideb; - TH2D* h2D_Subtr; - - TH2D* h2D_FDTemplatePrompt; - TH2D* h2D_FDTemplateNonPrompt; - - TH1D* h1D_Sign; - TH1D* h1D_Sideb; - TH1D* h1D_Subtr; - TH1D* h1D_SignNorm; - TH1D* h1D_SidebNorm; - TH1D* h1D_SubtrNorm; - TH1D* h1D_FDTemplatePrompt; - TH1D* h1D_FDTemplateNonPrompt; - TH1D* h1D_TemplateTotal; - TH1D* h1D_SubtrFDNorm; - TH1D* h1D_PrimaryPartCorr; - TH1D* h1D_AllPartCorr; - TH1D* h1D_SecPartFrac; - TH1D* h1D_SubtrNorm_SecPart; - TH1D* h1D_BaselineSubtr; - TH1D* h1D_ReflCorr; - TH1D* h1D_ReflCorr_BaselineSubtr; + TH2D* hSeSign[fNpools]; + TH2D* hMeSign[fNpools]; + TH2D* hMeSignSoftPi[fNpools]; + TH2D* hSeSideb[fNpools]; + TH2D* hMeSideb[fNpools]; + TH2D* hMeSidebSoftPi[fNpools]; + + TH2D* hCorrSign[fNpools]; + TH2D* hCorrSideb[fNpools]; + + TH2D* h2DSign; + TH2D* h2DSideb; + TH2D* h2DSubtr; + + TH2D* h2DFdTemplatePrompt; + TH2D* h2DFdTemplateNonPrompt; + + TH1D* h1DSign; + TH1D* h1DSideb; + TH1D* h1DSubtr; + TH1D* h1DSignNorm; + TH1D* h1DSidebNorm; + TH1D* h1DSubtrNorm; + TH1D* h1DFdTemplatePrompt; + TH1D* h1DFdTemplateNonPrompt; + TH1D* h1DTemplateTotal; + TH1D* h1DSubtrFdNorm; + TH1D* h1DPrimaryPartCorr; + TH1D* h1DAllPartCorr; + TH1D* h1DSecPartFrac; + TH1D* h1DSubtrNormSecPart; + TH1D* h1DBaselineSubtr; + TH1D* h1DReflCorr; + TH1D* h1DReflCorrBaselineSubtr; TH1D* hModul; TH1D* hBeforeModulCorr; - Double_t FDPromptFrac; + Double_t fdPromptFrac; // if (fIntegratePtBins && iBinPtHad>0) continue; for (int iPool = 0; iPool < fNpools; iPool++) { // Retrieve 2D plots for SE and ME, signal and bkg regions, for each pTbin and pool - hSE_Sign[iPool] = GetCorrelHisto(kSE, kSign, iPool, PtCandMin, PtCandMax, PtHadMin, PtHadMax); + hSeSign[iPool] = getCorrelHisto(kSE, kSign, iPool, ptCandMin, ptCandMax, ptHadMin, ptHadMax); std::cout << "Got SE histogram signal region" << std::endl; - hME_Sign[iPool] = GetCorrelHisto(kME, kSign, iPool, PtCandMin, PtCandMax, PtHadMin, PtHadMax); + hMeSign[iPool] = getCorrelHisto(kME, kSign, iPool, ptCandMin, ptCandMax, ptHadMin, ptHadMax); std::cout << "Got ME histogram signal region" << std::endl; - hSE_Sideb[iPool] = GetCorrelHisto(kSE, kSideb, iPool, PtCandMin, PtCandMax, PtHadMin, PtHadMax); + hSeSideb[iPool] = getCorrelHisto(kSE, kSideb, iPool, ptCandMin, ptCandMax, ptHadMin, ptHadMax); std::cout << "Got SE histogram sdeband region" << std::endl; - hME_Sideb[iPool] = GetCorrelHisto(kME, kSideb, iPool, PtCandMin, PtCandMax, PtHadMin, PtHadMax); + hMeSideb[iPool] = getCorrelHisto(kME, kSideb, iPool, ptCandMin, ptCandMax, ptHadMin, ptHadMax); std::cout << "Got ME histogram sdeband region" << std::endl; - hSE_Sign[iPool]->Sumw2(); - hME_Sign[iPool]->Sumw2(); - hSE_Sideb[iPool]->Sumw2(); - hME_Sideb[iPool]->Sumw2(); + hSeSign[iPool]->Sumw2(); + hMeSign[iPool]->Sumw2(); + hSeSideb[iPool]->Sumw2(); + hMeSideb[iPool]->Sumw2(); // rebin axes deltaEta and deltaPhi if (fRebinAngCorr) { - hSE_Sign[iPool]->Rebin2D(fRebinAxisDeltaEta, fRebinAxisDeltaPhi); // Xaxis: deltaEta, Yaxis: deltaPhi - hSE_Sideb[iPool]->Rebin2D(fRebinAxisDeltaEta, fRebinAxisDeltaPhi); - hME_Sign[iPool]->Rebin2D(fRebinAxisDeltaEta, fRebinAxisDeltaPhi); - hME_Sideb[iPool]->Rebin2D(fRebinAxisDeltaEta, fRebinAxisDeltaPhi); + hSeSign[iPool]->Rebin2D(fRebinAxisDeltaEta, fRebinAxisDeltaPhi); // Xaxis: deltaEta, Yaxis: deltaPhi + hSeSideb[iPool]->Rebin2D(fRebinAxisDeltaEta, fRebinAxisDeltaPhi); + hMeSign[iPool]->Rebin2D(fRebinAxisDeltaEta, fRebinAxisDeltaPhi); + hMeSideb[iPool]->Rebin2D(fRebinAxisDeltaEta, fRebinAxisDeltaPhi); if (fSubtractSoftPiME) { - hME_Sideb_SoftPi[iPool]->Rebin2D(fRebinAxisDeltaEta, fRebinAxisDeltaPhi); + hMeSidebSoftPi[iPool]->Rebin2D(fRebinAxisDeltaEta, fRebinAxisDeltaPhi); } std::cout << "SE and ME histograms rebinned" << std::endl; } if (fDebug >= 1) { - TCanvas* c = new TCanvas(Form("cSE_Original_%d_%1.1fto%1.1f", iPool, PtHadMin, PtHadMax), Form("cSE_Original_%s_pool%d_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), iPool, PtCandMin, PtCandMax, PtHadMin, PtHadMax), 100, 100, 1600, 900); + auto* c = new TCanvas(Form("cSE_Original_%d_%1.1fto%1.1f", iPool, ptHadMin, ptHadMax), Form("cSE_Original_%s_pool%d_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), iPool, ptCandMin, ptCandMax, ptHadMin, ptHadMax), 100, 100, 1600, 900); c->Divide(2, 1); c->cd(1); - hSE_Sign[iPool]->SetMinimum(0); - hSE_Sign[iPool]->Draw("lego2"); + hSeSign[iPool]->SetMinimum(0); + hSeSign[iPool]->Draw("lego2"); c->cd(2); - hSE_Sideb[iPool]->SetMinimum(0); - hSE_Sideb[iPool]->Draw("lego2"); - c->SaveAs(Form("Output_CorrelationExtraction_%s_png/CorrSE_Original_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); - c->SaveAs(Form("Output_CorrelationExtraction_%s_Root/CorrSE_Original_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + hSeSideb[iPool]->SetMinimum(0); + hSeSideb[iPool]->Draw("lego2"); + c->SaveAs(Form("Output_CorrelationExtraction_%s_png/CorrSE_Original_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); + c->SaveAs(Form("Output_CorrelationExtraction_%s_Root/CorrSE_Original_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); } if (fDebug >= 1) { - TCanvas* c = new TCanvas(Form("cME_Original_%d_%1.1fto%1.1f", iPool, PtHadMin, PtHadMax), Form("cME_Original_%s_pool%d_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), iPool, PtCandMin, PtCandMax, PtHadMin, PtHadMax), 100, 100, 1600, 900); + auto* c = new TCanvas(Form("cME_Original_%d_%1.1fto%1.1f", iPool, ptHadMin, ptHadMax), Form("cME_Original_%s_pool%d_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), iPool, ptCandMin, ptCandMax, ptHadMin, ptHadMax), 100, 100, 1600, 900); c->Divide(2, 1); c->cd(1); - hME_Sign[iPool]->SetMinimum(0); - hME_Sign[iPool]->Draw("lego2"); + hMeSign[iPool]->SetMinimum(0); + hMeSign[iPool]->Draw("lego2"); c->cd(2); - hME_Sideb[iPool]->SetMinimum(0); - hME_Sideb[iPool]->Draw("lego2"); - c->SaveAs(Form("Output_CorrelationExtraction_%s_png/CorrME_Original_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); - c->SaveAs(Form("Output_CorrelationExtraction_%s_Root/CorrME_Original_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + hMeSideb[iPool]->SetMinimum(0); + hMeSideb[iPool]->Draw("lego2"); + c->SaveAs(Form("Output_CorrelationExtraction_%s_png/CorrME_Original_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); + c->SaveAs(Form("Output_CorrelationExtraction_%s_Root/CorrME_Original_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); } // Scale bkg plots by ratio of signal region/sidebands - hSE_Sideb[iPool]->Scale(fBkgScaleFactor); - hME_Sideb[iPool]->Scale(fBkgScaleFactor); // when normalised this factor should cancel out + hSeSideb[iPool]->Scale(fBkgScaleFactor); + hMeSideb[iPool]->Scale(fBkgScaleFactor); // when normalised this factor should cancel out std::cout << "[INFO] fBkgScaleFactor = " << fBkgScaleFactor << std::endl; - hSE_Sideb[iPool]->SetEntries(hSE_Sideb[iPool]->GetEntries() * fBkgScaleFactor); - hME_Sideb[iPool]->SetEntries(hME_Sideb[iPool]->GetEntries() * fBkgScaleFactor); + hSeSideb[iPool]->SetEntries(hSeSideb[iPool]->GetEntries() * fBkgScaleFactor); + hMeSideb[iPool]->SetEntries(hMeSideb[iPool]->GetEntries() * fBkgScaleFactor); if (fSubtractSoftPiME) { - hME_Sideb_SoftPi[iPool]->Scale(fBkgScaleFactor); - hME_Sideb_SoftPi[iPool]->SetEntries(hME_Sideb_SoftPi[iPool]->GetEntries() * fBkgScaleFactor); + hMeSidebSoftPi[iPool]->Scale(fBkgScaleFactor); + hMeSidebSoftPi[iPool]->SetEntries(hMeSidebSoftPi[iPool]->GetEntries() * fBkgScaleFactor); } // Normalize ME plots for the entries in (deltaEta, deltaPhi) = (0, 0) - NormalizeMEplot(hME_Sign[iPool], hME_Sign_SoftPi[iPool]); - NormalizeMEplot(hME_Sideb[iPool], hME_Sideb_SoftPi[iPool]); + normalizeMePlot(hMeSign[iPool], hMeSignSoftPi[iPool]); + normalizeMePlot(hMeSideb[iPool], hMeSidebSoftPi[iPool]); // Apply Event Mixing Correction - hCorr_Sign[iPool] = reinterpret_cast(hSE_Sign[iPool]->Clone(Form("hCorr_Sign_Pool%d", iPool))); - hCorr_Sign[iPool]->Sumw2(); - hCorr_Sign[iPool]->Divide(hME_Sign[iPool]); - - hCorr_Sideb[iPool] = reinterpret_cast(hSE_Sideb[iPool]->Clone(Form("hCorr_Sideb_Pool%d", iPool))); - hCorr_Sideb[iPool]->Sumw2(); - hCorr_Sideb[iPool]->Divide(hME_Sideb[iPool]); - - Double_t N_SEsign = 0, N_SEsideb = 0, N_sign = 0, N_sideb = 0; - for (int i = 1; i <= hCorr_Sign[iPool]->GetXaxis()->GetNbins(); i++) { - for (int j = 1; j <= hCorr_Sign[iPool]->GetYaxis()->GetNbins(); j++) { - N_SEsign += hSE_Sign[iPool]->GetBinContent(i, j); - N_SEsideb += hSE_Sideb[iPool]->GetBinContent(i, j); - N_sign += hCorr_Sign[iPool]->GetBinContent(i, j); - N_sideb += hCorr_Sideb[iPool]->GetBinContent(i, j); + hCorrSign[iPool] = reinterpret_cast(hSeSign[iPool]->Clone(Form("hCorr_Sign_Pool%d", iPool))); + hCorrSign[iPool]->Sumw2(); + hCorrSign[iPool]->Divide(hMeSign[iPool]); + + hCorrSideb[iPool] = reinterpret_cast(hSeSideb[iPool]->Clone(Form("hCorr_Sideb_Pool%d", iPool))); + hCorrSideb[iPool]->Sumw2(); + hCorrSideb[iPool]->Divide(hMeSideb[iPool]); + + Double_t nSEsign = 0, nSEsideb = 0, nSign = 0, nSideb = 0; + for (int i = 1; i <= hCorrSign[iPool]->GetXaxis()->GetNbins(); i++) { + for (int j = 1; j <= hCorrSign[iPool]->GetYaxis()->GetNbins(); j++) { + nSEsign += hSeSign[iPool]->GetBinContent(i, j); + nSEsideb += hSeSideb[iPool]->GetBinContent(i, j); + nSign += hCorrSign[iPool]->GetBinContent(i, j); + nSideb += hCorrSideb[iPool]->GetBinContent(i, j); } } - hSE_Sign[iPool]->SetEntries(N_SEsign); - hSE_Sideb[iPool]->SetEntries(N_SEsideb); - hCorr_Sign[iPool]->SetEntries(N_sign); - hCorr_Sideb[iPool]->SetEntries(N_sideb); + hSeSign[iPool]->SetEntries(nSEsign); + hSeSideb[iPool]->SetEntries(nSEsideb); + hCorrSign[iPool]->SetEntries(nSign); + hCorrSideb[iPool]->SetEntries(nSideb); if (fDebug >= 1) { - TCanvas* c = new TCanvas(Form("cSEME_%d_%1.1fto%1.1f", iPool, PtHadMin, PtHadMax), Form("cSEME_%s_pool%d_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), iPool, PtCandMin, PtCandMax, PtHadMin, PtHadMax), 100, 100, 1600, 900); + auto* c = new TCanvas(Form("cSEME_%d_%1.1fto%1.1f", iPool, ptHadMin, ptHadMax), Form("cSEME_%s_pool%d_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), iPool, ptCandMin, ptCandMax, ptHadMin, ptHadMax), 100, 100, 1600, 900); c->Divide(3, 2); c->cd(1); - hSE_Sign[iPool]->SetMinimum(0); - hSE_Sign[iPool]->Draw("lego2"); + hSeSign[iPool]->SetMinimum(0); + hSeSign[iPool]->Draw("lego2"); c->cd(2); - hME_Sign[iPool]->SetMinimum(0); - hME_Sign[iPool]->Draw("lego2"); + hMeSign[iPool]->SetMinimum(0); + hMeSign[iPool]->Draw("lego2"); c->cd(3); - hCorr_Sign[iPool]->SetMinimum(0); - hCorr_Sign[iPool]->Draw("lego2"); + hCorrSign[iPool]->SetMinimum(0); + hCorrSign[iPool]->Draw("lego2"); c->cd(4); - hSE_Sideb[iPool]->SetMinimum(0); - hSE_Sideb[iPool]->Draw("lego2"); + hSeSideb[iPool]->SetMinimum(0); + hSeSideb[iPool]->Draw("lego2"); c->cd(5); - hME_Sideb[iPool]->SetMinimum(0); - hME_Sideb[iPool]->Draw("lego2"); + hMeSideb[iPool]->SetMinimum(0); + hMeSideb[iPool]->Draw("lego2"); c->cd(6); - hCorr_Sideb[iPool]->SetMinimum(0); - hCorr_Sideb[iPool]->Draw("lego2"); - c->SaveAs(Form("Output_CorrelationExtraction_%s_png/CorrSEandME_%s_Canvas_PtCand%.0fto%.0f_Pool%d_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, iPool, PtHadMin, PtHadMax)); - c->SaveAs(Form("Output_CorrelationExtraction_%s_Root/CorrSEandME_%s_Canvas_PtCand%.0fto%.0f_Pool%d_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, iPool, PtHadMin, PtHadMax)); + hCorrSideb[iPool]->SetMinimum(0); + hCorrSideb[iPool]->Draw("lego2"); + c->SaveAs(Form("Output_CorrelationExtraction_%s_png/CorrSEandME_%s_Canvas_PtCand%.0fto%.0f_Pool%d_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, iPool, ptHadMin, ptHadMax)); + c->SaveAs(Form("Output_CorrelationExtraction_%s_Root/CorrSEandME_%s_Canvas_PtCand%.0fto%.0f_Pool%d_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, iPool, ptHadMin, ptHadMax)); } // Pools integration if (iPool == 0) { - h2D_Sign = reinterpret_cast(hCorr_Sign[0]->Clone("h2D_Sign")); - h2D_Sideb = reinterpret_cast(hCorr_Sideb[0]->Clone("h2D_Sideb")); - h2D_Sign->Sumw2(); - h2D_Sideb->Sumw2(); + h2DSign = reinterpret_cast(hCorrSign[0]->Clone("h2D_Sign")); + h2DSideb = reinterpret_cast(hCorrSideb[0]->Clone("h2D_Sideb")); + h2DSign->Sumw2(); + h2DSideb->Sumw2(); } else { - h2D_Sign->Add(hCorr_Sign[iPool]); - h2D_Sideb->Add(hCorr_Sideb[iPool]); + h2DSign->Add(hCorrSign[iPool]); + h2DSideb->Add(hCorrSideb[iPool]); } } // end pool loop // Draw 2D plots (Signal region and Sidebands) - TCanvas* c2D = new TCanvas(Form("c2D_IntPools_PtHad%.0fto%.0f", PtHadMin, PtHadMax), Form("c2D_%s_IntPools_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), PtHadMin, PtHadMax), 100, 100, 1500, 800); - SetTH2HistoStyle(h2D_Sign, Form("Signal region, %.0f < p^{%s}_{T} < %.0f GeV/c, %.0f < p^{assoc}_{T} < %.0f GeV/c", PtCandMin, fDmesonLabel.Data(), PtCandMax, PtHadMin, PtHadMax), "#Delta#eta", "#Delta#phi [rad]", "entries", 1.6, 1.6, 1.6, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04); - SetTH2HistoStyle(h2D_Sideb, Form("Sideband region, %.0f < p^{%s}_{T} < %.0f GeV/c, %.0f < p^{assoc}_{T} < %.0f GeV/c", PtCandMin, fDmesonLabel.Data(), PtCandMax, PtHadMin, PtHadMax), "#Delta#eta", "#Delta#phi [rad]", "#frac{Y_{Bkg}}{Y_{SB}} entries", 1.6, 1.6, 1.6, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04); + auto* c2D = new TCanvas(Form("c2D_IntPools_PtHad%.0fto%.0f", ptHadMin, ptHadMax), Form("c2D_%s_IntPools_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), ptHadMin, ptHadMax), 100, 100, 1500, 800); + setTH2HistoStyle(h2DSign, Form("Signal region, %.0f < p^{%s}_{T} < %.0f GeV/c, %.0f < p^{assoc}_{T} < %.0f GeV/c", ptCandMin, fDmesonLabel.Data(), ptCandMax, ptHadMin, ptHadMax), "#Delta#eta", "#Delta#phi [rad]", "entries", 1.6, 1.6, 1.6, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04); + setTH2HistoStyle(h2DSideb, Form("Sideband region, %.0f < p^{%s}_{T} < %.0f GeV/c, %.0f < p^{assoc}_{T} < %.0f GeV/c", ptCandMin, fDmesonLabel.Data(), ptCandMax, ptHadMin, ptHadMax), "#Delta#eta", "#Delta#phi [rad]", "#frac{Y_{Bkg}}{Y_{SB}} entries", 1.6, 1.6, 1.6, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04); c2D->Divide(2, 1); c2D->cd(1); - h2D_Sign->SetMinimum(0); - h2D_Sign->Draw("lego2"); + h2DSign->SetMinimum(0); + h2DSign->Draw("lego2"); c2D->cd(2); - h2D_Sideb->SetMinimum(0); - h2D_Sideb->Draw("lego2"); - c2D->SaveAs(Form("Output_CorrelationExtraction_%s_png/h2D_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); - c2D->SaveAs(Form("Output_CorrelationExtraction_%s_Root/h2D_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + h2DSideb->SetMinimum(0); + h2DSideb->Draw("lego2"); + c2D->SaveAs(Form("Output_CorrelationExtraction_%s_png/h2D_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); + c2D->SaveAs(Form("Output_CorrelationExtraction_%s_Root/h2D_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); // Get FD correlations for FD subtraction if (fFDsubtraction) { - h2D_FDTemplatePrompt = GetFDTemplateHisto(kPrompt, PtCandMin, PtCandMax, PtHadMin, PtHadMax); - h2D_FDTemplateNonPrompt = GetFDTemplateHisto(kFD, PtCandMin, PtCandMax, PtHadMin, PtHadMax); + h2DFdTemplatePrompt = getFdTemplateHisto(kPrompt, ptCandMin, ptCandMax, ptHadMin, ptHadMax); + h2DFdTemplateNonPrompt = getFdTemplateHisto(kFD, ptCandMin, ptCandMax, ptHadMin, ptHadMax); // h1D_BaselineSubtr - FDPromptFrac = GetFDPromptFrac(PtCandMin, PtCandMax, PtHadMin, PtHadMax); + fdPromptFrac = getFdPromptFrac(ptCandMin, ptCandMax, ptHadMin, ptHadMax); if (fRebinFDCorr) { - h2D_FDTemplatePrompt->Rebin2D(fRebinAxisDeltaEta, fRebinAxisDeltaPhi); - h2D_FDTemplateNonPrompt->Rebin2D(fRebinAxisDeltaEta, fRebinAxisDeltaPhi); + h2DFdTemplatePrompt->Rebin2D(fRebinAxisDeltaEta, fRebinAxisDeltaPhi); + h2DFdTemplateNonPrompt->Rebin2D(fRebinAxisDeltaEta, fRebinAxisDeltaPhi); } if (fDebug >= 1) { - TCanvas* c = new TCanvas(Form("cFDTemplate_PtCand%.0fto%.0f_PtHad%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax), Form("cFDTemplate_%s_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + auto* c = new TCanvas(Form("cFDTemplate_PtCand%.0fto%.0f_PtHad%.0fto%.0f", ptCandMin, ptCandMax, ptHadMin, ptHadMax), Form("cFDTemplate_%s_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); c->Divide(2, 1); c->cd(1); - h2D_FDTemplatePrompt->SetMinimum(0); - h2D_FDTemplatePrompt->Draw("lego2"); + h2DFdTemplatePrompt->SetMinimum(0); + h2DFdTemplatePrompt->Draw("lego2"); c->cd(2); - h2D_FDTemplateNonPrompt->SetMinimum(0); - h2D_FDTemplateNonPrompt->Draw("lego2"); - c->SaveAs(Form("Output_CorrelationExtraction_%s_png/CorrFDTemplate_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + h2DFdTemplateNonPrompt->SetMinimum(0); + h2DFdTemplateNonPrompt->Draw("lego2"); + c->SaveAs(Form("Output_CorrelationExtraction_%s_png/CorrFDTemplate_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); } } // Bkg subtraction (2D plot) - TCanvas* c2D_Sub = new TCanvas(Form("c2D_Subtr_IntPools_PtHAd%.0fto%.0f", PtHadMin, PtHadMax), Form("c2D_%s_Subtr_IntPools_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), PtHadMin, PtHadMax), 100, 100, 1500, 800); - h2D_Subtr = reinterpret_cast(h2D_Sign->Clone("h2D_Subtr")); - h2D_Subtr->Sumw2(); - h2D_Subtr->Add(h2D_Sideb, -1); - h2D_Subtr->SetEntries(h2D_Sign->GetEntries() - h2D_Sideb->GetEntries()); - h2D_Subtr->SetTitle("Signal region after sideb. subt. corr. - 2D"); - h2D_Subtr->Draw("lego2"); - c2D_Sub->SaveAs(Form("Output_CorrelationExtraction_%s_png/h2D_%s_Subtr_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); - c2D_Sub->SaveAs(Form("Output_CorrelationExtraction_%s_Root/h2D_%s_Subtr_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + auto* c2DSub = new TCanvas(Form("c2D_Subtr_IntPools_PtHAd%.0fto%.0f", ptHadMin, ptHadMax), Form("c2D_%s_Subtr_IntPools_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), ptHadMin, ptHadMax), 100, 100, 1500, 800); + h2DSubtr = reinterpret_cast(h2DSign->Clone("h2D_Subtr")); + h2DSubtr->Sumw2(); + h2DSubtr->Add(h2DSideb, -1); + h2DSubtr->SetEntries(h2DSign->GetEntries() - h2DSideb->GetEntries()); + h2DSubtr->SetTitle("Signal region after sideb. subt. corr. - 2D"); + h2DSubtr->Draw("lego2"); + c2DSub->SaveAs(Form("Output_CorrelationExtraction_%s_png/h2D_%s_Subtr_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); + c2DSub->SaveAs(Form("Output_CorrelationExtraction_%s_Root/h2D_%s_Subtr_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); // 1D projection - h1D_Sign = reinterpret_cast(h2D_Sign->ProjectionY("h1D_Sign")); // projection on deltaPhi axis - h1D_Sideb = reinterpret_cast(h2D_Sideb->ProjectionY("h1D_Sideb")); - h1D_Sign->SetTitle("Signal region correlations"); - h1D_Sideb->SetTitle("Sidebands correlations"); - h1D_Sign->Scale(1. / h1D_Sign->GetXaxis()->GetBinWidth(1)); - h1D_Sideb->Scale(1. / h1D_Sideb->GetXaxis()->GetBinWidth(1)); + h1DSign = h2DSign->ProjectionY("h1D_Sign"); // projection on deltaPhi axis + h1DSideb = h2DSideb->ProjectionY("h1D_Sideb"); + h1DSign->SetTitle("Signal region correlations"); + h1DSideb->SetTitle("Sidebands correlations"); + h1DSign->Scale(1. / h1DSign->GetXaxis()->GetBinWidth(1)); + h1DSideb->Scale(1. / h1DSideb->GetXaxis()->GetBinWidth(1)); // Bkg subtraction (1D plot) - h1D_Subtr = reinterpret_cast(h1D_Sign->Clone("h1D_Subtr")); - h1D_Subtr->Sumw2(); - h1D_Subtr->Add(h1D_Sideb, -1); - h1D_Subtr->SetEntries(h1D_Sign->GetEntries() - h1D_Sideb->GetEntries()); - h1D_Subtr->SetTitle("Signal region after sideb. subt. corr."); + h1DSubtr = reinterpret_cast(h1DSign->Clone("h1D_Subtr")); + h1DSubtr->Sumw2(); + h1DSubtr->Add(h1DSideb, -1); + h1DSubtr->SetEntries(h1DSign->GetEntries() - h1DSideb->GetEntries()); + h1DSubtr->SetTitle("Signal region after sideb. subt. corr."); // Draw 1D plots (Signal region, Sidebands, S-SB (subtr.)) - TCanvas* c1D = new TCanvas(Form("c1D_IntPools_PtCand%.0fto%.0f_PtHad%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax), Form("c1D_%s_IntPools_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), PtHadMin, PtHadMax), 100, 100, 1600, 500); + auto* c1D = new TCanvas(Form("c1D_IntPools_PtCand%.0fto%.0f_PtHad%.0fto%.0f", ptCandMin, ptCandMax, ptHadMin, ptHadMax), Form("c1D_%s_IntPools_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), ptHadMin, ptHadMax), 100, 100, 1600, 500); c1D->Divide(3, 1); c1D->cd(1); - h1D_Sign->Draw(); + h1DSign->Draw(); c1D->cd(2); - h1D_Sideb->Draw(); + h1DSideb->Draw(); c1D->cd(3); - h1D_Subtr->Draw(); - c1D->SaveAs(Form("Output_CorrelationExtraction_%s_png/h1D_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); - c1D->SaveAs(Form("Output_CorrelationExtraction_%s_Root/h1D_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + h1DSubtr->Draw(); + c1D->SaveAs(Form("Output_CorrelationExtraction_%s_png/h1D_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); + c1D->SaveAs(Form("Output_CorrelationExtraction_%s_Root/h1D_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); if (fDebug >= 1) { - h1D_SignNorm = reinterpret_cast(h1D_Sign->Clone("h1D_Sign_Norm")); - h1D_SidebNorm = reinterpret_cast(h1D_Sideb->Clone("h1D_Sideb_Norm")); - h1D_SignNorm->Scale(1. / (fSgnYieldNorm + fBkgYield)); + h1DSignNorm = reinterpret_cast(h1DSign->Clone("h1D_Sign_Norm")); + h1DSidebNorm = reinterpret_cast(h1DSideb->Clone("h1D_Sideb_Norm")); + h1DSignNorm->Scale(1. / (fSgnYieldNorm + fBkgYield)); // h1D_SidebNorm -> Scale(1./fBkgYield); - h1D_SidebNorm->Scale(1. / fBkgScaleFactor); - h1D_SidebNorm->Scale(1. / fSBYield); - h1D_SignNorm->SetMarkerStyle(kFullCircle); - h1D_SignNorm->SetMarkerSize(1.2); - h1D_SignNorm->SetLineColor(kRed); - h1D_SignNorm->SetMarkerColor(kRed); - h1D_SignNorm->SetLineWidth(2); - h1D_SidebNorm->SetMinimum(0); - h1D_SidebNorm->SetMarkerStyle(kFullSquare); - h1D_SidebNorm->SetMarkerSize(1.2); - h1D_SidebNorm->SetLineColor(kBlue); - h1D_SidebNorm->SetMarkerColor(kBlue); - h1D_SidebNorm->SetLineWidth(2); - h1D_SidebNorm->SetTitle(Form("%.0f < p_{T} < %.0f", PtCandMin, PtCandMax)); - TCanvas* c = new TCanvas(Form("c_IntPools_PtCand%.0fto%.0f_PtHad%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax), ""); + h1DSidebNorm->Scale(1. / fBkgScaleFactor); + h1DSidebNorm->Scale(1. / fSBYield); + h1DSignNorm->SetMarkerStyle(kFullCircle); + h1DSignNorm->SetMarkerSize(1.2); + h1DSignNorm->SetLineColor(kRed); + h1DSignNorm->SetMarkerColor(kRed); + h1DSignNorm->SetLineWidth(2); + h1DSidebNorm->SetMinimum(0); + h1DSidebNorm->SetMarkerStyle(kFullSquare); + h1DSidebNorm->SetMarkerSize(1.2); + h1DSidebNorm->SetLineColor(kBlue); + h1DSidebNorm->SetMarkerColor(kBlue); + h1DSidebNorm->SetLineWidth(2); + h1DSidebNorm->SetTitle(Form("%.0f < p_{T} < %.0f", ptCandMin, ptCandMax)); + auto* c = new TCanvas(Form("c_IntPools_PtCand%.0fto%.0f_PtHad%.0fto%.0f", ptCandMin, ptCandMax, ptHadMin, ptHadMax), ""); c->cd(); - h1D_SidebNorm->Draw(); - h1D_SignNorm->Draw("same"); - c->SaveAs(Form("Output_CorrelationExtraction_%s_png/ComparisonSignalSidebCorr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); - c->SaveAs(Form("Output_CorrelationExtraction_%s_Root/ComparisonSignalSidebCorr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + h1DSidebNorm->Draw(); + h1DSignNorm->Draw("same"); + c->SaveAs(Form("Output_CorrelationExtraction_%s_png/ComparisonSignalSidebCorr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); + c->SaveAs(Form("Output_CorrelationExtraction_%s_Root/ComparisonSignalSidebCorr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); } // Apply normalization to number of triggers - h1D_SubtrNorm = reinterpret_cast(h1D_Subtr->Clone("h1D_SubtrNorm")); - h1D_SubtrNorm->Sumw2(); - h1D_SubtrNorm->Scale(1. / fSgnYieldNorm); - h1D_SubtrNorm->SetTitle("Signal region after sideb. subt. corr. - Normalized to # of triggers"); + h1DSubtrNorm = reinterpret_cast(h1DSubtr->Clone("h1D_SubtrNorm")); + h1DSubtrNorm->Sumw2(); + h1DSubtrNorm->Scale(1. / fSgnYieldNorm); + h1DSubtrNorm->SetTitle("Signal region after sideb. subt. corr. - Normalized to # of triggers"); // Correction for bias B to D topologies if (fCorrBiasBtoD) { - hModul = EvaluateMCClosModulations(PtCandMin, PtCandMax, PtHadMin, PtHadMax); - TCanvas* c1D_corrBbias = new TCanvas(Form("c1D_corrBbias_IntPools_PtCand%.0fto%.0f_PtHad%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax), Form("c1D_corrBbias_%s_IntPools_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), PtHadMin, PtHadMax), 100, 100, 1600, 500); - c1D_corrBbias->cd(); - hBeforeModulCorr = reinterpret_cast(h1D_SubtrNorm->Clone("hBeforeModulCorr")); + hModul = evaluateMcClosModulations(ptCandMin, ptCandMax, ptHadMin, ptHadMax); + auto* c1DCorrBbias = new TCanvas(Form("c1D_corrBbias_IntPools_PtCand%.0fto%.0f_PtHad%.0fto%.0f", ptCandMin, ptCandMax, ptHadMin, ptHadMax), Form("c1D_corrBbias_%s_IntPools_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), ptHadMin, ptHadMax), 100, 100, 1600, 500); + c1DCorrBbias->cd(); + hBeforeModulCorr = reinterpret_cast(h1DSubtrNorm->Clone("hBeforeModulCorr")); hBeforeModulCorr->SetLineColor(kViolet - 3); hBeforeModulCorr->GetYaxis()->SetRangeUser(0., 5.); hBeforeModulCorr->Draw(); - h1D_SubtrNorm->Multiply(hModul); - h1D_SubtrNorm->Draw("same"); - c1D_corrBbias->SaveAs(Form("Output_CorrelationExtraction_%s_png/ComparisonCorrBiasBtoD_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); - c1D_corrBbias->SaveAs(Form("Output_CorrelationExtraction_%s_Root/ComparisonCorrBiasBtoD_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); - - TFile* file = new TFile(Form("Output_CorrelationExtraction_%s_Root/SystematicCorrBiasBtoD_%s_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax), "RECREATE"); // Open file in write mode - TH1D* h1D_SubtrNorm_Clone = reinterpret_cast(h1D_SubtrNorm->Clone("h1D_SubtrNorm_Clone")); - h1D_SubtrNorm_Clone = ReflectCorrHistogram(h1D_SubtrNorm_Clone); - hBeforeModulCorr = ReflectCorrHistogram(hBeforeModulCorr); - TH1D* hSystematicCorrBiasBtoD = reinterpret_cast(h1D_SubtrNorm_Clone->Clone("hSystematicCorrBiasBtoD")); - hSystematicCorrBiasBtoD->Add(h1D_SubtrNorm_Clone, hBeforeModulCorr, 1, -1); + h1DSubtrNorm->Multiply(hModul); + h1DSubtrNorm->Draw("same"); + c1DCorrBbias->SaveAs(Form("Output_CorrelationExtraction_%s_png/ComparisonCorrBiasBtoD_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); + c1DCorrBbias->SaveAs(Form("Output_CorrelationExtraction_%s_Root/ComparisonCorrBiasBtoD_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); + + auto* file = new TFile(Form("Output_CorrelationExtraction_%s_Root/SystematicCorrBiasBtoD_%s_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax), "RECREATE"); // Open file in write mode + TH1D* h1DSubtrNormClone = reinterpret_cast(h1DSubtrNorm->Clone("h1D_SubtrNorm_Clone")); + h1DSubtrNormClone = reflectCorrHistogram(h1DSubtrNormClone); + hBeforeModulCorr = reflectCorrHistogram(hBeforeModulCorr); + TH1D* hSystematicCorrBiasBtoD = reinterpret_cast(h1DSubtrNormClone->Clone("hSystematicCorrBiasBtoD")); + hSystematicCorrBiasBtoD->Add(h1DSubtrNormClone, hBeforeModulCorr, 1, -1); // Set bin contents to absolute values for (int i = 1; i <= hSystematicCorrBiasBtoD->GetNbinsX(); ++i) { hSystematicCorrBiasBtoD->SetBinContent(i, std::abs(hSystematicCorrBiasBtoD->GetBinContent(i)) / TMath::Sqrt(12)); @@ -515,255 +521,257 @@ Bool_t DhCorrelationExtraction::ExtractCorrelations(Double_t PtCandMin, Double_t // Secondary particle contamination if (fSecPartContamination) { - h1D_PrimaryPartCorr = GetCorrelHistoSecondaryPart(kPrimaryPart, PtCandMin, PtCandMax, PtHadMin, PtHadMax); - h1D_AllPartCorr = GetCorrelHistoSecondaryPart(kAllPart, PtCandMin, PtCandMax, PtHadMin, PtHadMax); - h1D_PrimaryPartCorr->Sumw2(); - h1D_AllPartCorr->Sumw2(); + h1DPrimaryPartCorr = getCorrelHistoSecondaryPart(kPrimaryPart, ptCandMin, ptCandMax, ptHadMin, ptHadMax); + h1DAllPartCorr = getCorrelHistoSecondaryPart(kAllPart, ptCandMin, ptCandMax, ptHadMin, ptHadMax); + h1DPrimaryPartCorr->Sumw2(); + h1DAllPartCorr->Sumw2(); if (fRebinSecPart) { - h1D_PrimaryPartCorr->RebinX(fRebinAxisDeltaPhi); // Xaxis: deltaPhi - h1D_AllPartCorr->RebinX(fRebinAxisDeltaPhi); + h1DPrimaryPartCorr->RebinX(fRebinAxisDeltaPhi); // Xaxis: deltaPhi + h1DAllPartCorr->RebinX(fRebinAxisDeltaPhi); std::cout << "Secondary particle histogram rebinned" << std::endl; } - h1D_SecPartFrac = reinterpret_cast(h1D_PrimaryPartCorr->Clone(Form("hCorrRatio_PtD%.0fto%.0f_PtHad%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax))); - h1D_SecPartFrac->Sumw2(); - h1D_SecPartFrac->Divide(h1D_PrimaryPartCorr, h1D_AllPartCorr, 1., 1., "B"); + h1DSecPartFrac = reinterpret_cast(h1DPrimaryPartCorr->Clone(Form("hCorrRatio_PtD%.0fto%.0f_PtHad%.0fto%.0f", ptCandMin, ptCandMax, ptHadMin, ptHadMax))); + h1DSecPartFrac->Sumw2(); + h1DSecPartFrac->Divide(h1DPrimaryPartCorr, h1DAllPartCorr, 1., 1., "B"); - TCanvas* c1D = new TCanvas(Form("c1D_CorrPrimaryPart_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax), Form("c1D_%s_CorrPrimaryPart_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), PtHadMin, PtHadMax)); + auto* c1D = new TCanvas(Form("c1D_CorrPrimaryPart_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", ptCandMin, ptCandMax, ptHadMin, ptHadMax), Form("c1D_%s_CorrPrimaryPart_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), ptHadMin, ptHadMax)); c1D->cd(); - SetTH1HistoStyle(h1D_SecPartFrac, Form("%.0f < p_{T} < %.0f GeV/c", PtCandMin, PtCandMax), "#Delta#phi [rad]", "#frac{primary part.}{part. selected}"); - h1D_SecPartFrac->Draw(); - c1D->SaveAs(Form("Output_CorrelationExtraction_%s_png/CorrPrimaryPartRatio_%s_Canvas_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); - c1D->SaveAs(Form("Output_CorrelationExtraction_%s_Root/CorrPrimaryPartRatio_%s_Canvas_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); - - h1D_SubtrNorm_SecPart = reinterpret_cast(h1D_SubtrNorm->Clone("h1D_SubtrNorm_SecPart")); - h1D_SubtrNorm_SecPart->Sumw2(); - Int_t nBinsPhi = h1D_SubtrNorm_SecPart->GetNbinsX(); - if (nBinsPhi != h1D_SecPartFrac->GetNbinsX()) { + setTH1HistoStyle(h1DSecPartFrac, Form("%.0f < p_{T} < %.0f GeV/c", ptCandMin, ptCandMax), "#Delta#phi [rad]", "#frac{primary part.}{part. selected}"); + h1DSecPartFrac->Draw(); + c1D->SaveAs(Form("Output_CorrelationExtraction_%s_png/CorrPrimaryPartRatio_%s_Canvas_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); + c1D->SaveAs(Form("Output_CorrelationExtraction_%s_Root/CorrPrimaryPartRatio_%s_Canvas_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); + + h1DSubtrNormSecPart = reinterpret_cast(h1DSubtrNorm->Clone("h1D_SubtrNorm_SecPart")); + h1DSubtrNormSecPart->Sumw2(); + Int_t const nBinsPhi = h1DSubtrNormSecPart->GetNbinsX(); + if (nBinsPhi != h1DSecPartFrac->GetNbinsX()) { std::cout << "[ERROR]: nBinsPhi different between h1D_SubtrNorm and h1D_SecPartFrac" << std::endl; return kFALSE; } - h1D_SubtrNorm_SecPart->Multiply(h1D_SecPartFrac); + h1DSubtrNormSecPart->Multiply(h1DSecPartFrac); } // FD Subtraction if (fFDsubtraction) { - h1D_FDTemplatePrompt = reinterpret_cast(h2D_FDTemplatePrompt->ProjectionY("h1D_FDTemplatePrompt")); - h1D_FDTemplateNonPrompt = reinterpret_cast(h2D_FDTemplateNonPrompt->ProjectionY("h1D_FDTemplateNonPrompt")); + h1DFdTemplatePrompt = h2DFdTemplatePrompt->ProjectionY("h1D_FDTemplatePrompt"); + h1DFdTemplateNonPrompt = h2DFdTemplateNonPrompt->ProjectionY("h1D_FDTemplateNonPrompt"); - h1D_FDTemplatePrompt->Scale(1. / h1D_FDTemplatePrompt->GetXaxis()->GetBinWidth(1)); - h1D_FDTemplateNonPrompt->Scale(1. / h1D_FDTemplateNonPrompt->GetXaxis()->GetBinWidth(1)); + h1DFdTemplatePrompt->Scale(1. / h1DFdTemplatePrompt->GetXaxis()->GetBinWidth(1)); + h1DFdTemplateNonPrompt->Scale(1. / h1DFdTemplateNonPrompt->GetXaxis()->GetBinWidth(1)); - h1D_TemplateTotal = reinterpret_cast(h1D_FDTemplatePrompt->Clone("h1D_TemplateTotal")); - h1D_TemplateTotal->Sumw2(); - h1D_TemplateTotal->Scale(FDPromptFrac); - h1D_TemplateTotal->Add(h1D_FDTemplateNonPrompt, 1 - FDPromptFrac); + h1DTemplateTotal = reinterpret_cast(h1DFdTemplatePrompt->Clone("h1D_TemplateTotal")); + h1DTemplateTotal->Sumw2(); + h1DTemplateTotal->Scale(fdPromptFrac); + h1DTemplateTotal->Add(h1DFdTemplateNonPrompt, 1 - fdPromptFrac); if (fDebug >= 1) { - TCanvas* c = new TCanvas(Form("cFDTemplate_1D_%1.1fto%1.1f", PtHadMin, PtHadMax), Form("cFDTemplate_%s_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + auto* c = new TCanvas(Form("cFDTemplate_1D_%1.1fto%1.1f", ptHadMin, ptHadMax), Form("cFDTemplate_%s_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); c->cd(); - h1D_TemplateTotal->SetMinimum(0); - h1D_FDTemplateNonPrompt->SetMinimum(0); - h1D_TemplateTotal->SetMarkerColor(kGreen); - h1D_TemplateTotal->SetLineColor(kGreen); - h1D_TemplateTotal->SetLineWidth(2); - h1D_TemplateTotal->SetMarkerStyle(kFullCircle); - h1D_FDTemplatePrompt->SetMarkerColor(kRed); - h1D_FDTemplatePrompt->SetLineColor(kRed); - h1D_FDTemplatePrompt->SetLineWidth(2); - h1D_FDTemplatePrompt->SetMarkerStyle(kFullCircle); - h1D_FDTemplateNonPrompt->SetMarkerColor(kBlue); - h1D_FDTemplateNonPrompt->SetLineColor(kBlue); - h1D_FDTemplateNonPrompt->SetLineWidth(2); - h1D_FDTemplateNonPrompt->SetMarkerStyle(kFullCircle); - h1D_FDTemplateNonPrompt->Draw(); - h1D_FDTemplatePrompt->Draw("same"); - h1D_TemplateTotal->Draw("same"); - TLegend* lFD = new TLegend(); - lFD->AddEntry(h1D_TemplateTotal, "Total template"); - lFD->AddEntry(h1D_FDTemplatePrompt, "Prompt Template"); - lFD->AddEntry(h1D_FDTemplateNonPrompt, "Non prompt template"); + h1DTemplateTotal->SetMinimum(0); + h1DFdTemplateNonPrompt->SetMinimum(0); + h1DTemplateTotal->SetMarkerColor(kGreen); + h1DTemplateTotal->SetLineColor(kGreen); + h1DTemplateTotal->SetLineWidth(2); + h1DTemplateTotal->SetMarkerStyle(kFullCircle); + h1DFdTemplatePrompt->SetMarkerColor(kRed); + h1DFdTemplatePrompt->SetLineColor(kRed); + h1DFdTemplatePrompt->SetLineWidth(2); + h1DFdTemplatePrompt->SetMarkerStyle(kFullCircle); + h1DFdTemplateNonPrompt->SetMarkerColor(kBlue); + h1DFdTemplateNonPrompt->SetLineColor(kBlue); + h1DFdTemplateNonPrompt->SetLineWidth(2); + h1DFdTemplateNonPrompt->SetMarkerStyle(kFullCircle); + h1DFdTemplateNonPrompt->Draw(); + h1DFdTemplatePrompt->Draw("same"); + h1DTemplateTotal->Draw("same"); + auto* lFD = new TLegend(); + lFD->AddEntry(h1DTemplateTotal, "Total template"); + lFD->AddEntry(h1DFdTemplatePrompt, "Prompt Template"); + lFD->AddEntry(h1DFdTemplateNonPrompt, "Non prompt template"); lFD->Draw("same"); - c->SaveAs(Form("Output_CorrelationExtraction_%s_png/CorrFDTemplate_1D_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); - c->SaveAs(Form("Output_CorrelationExtraction_%s_Root/CorrFDTemplate_1D_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + c->SaveAs(Form("Output_CorrelationExtraction_%s_png/CorrFDTemplate_1D_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); + c->SaveAs(Form("Output_CorrelationExtraction_%s_Root/CorrFDTemplate_1D_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); } - Double_t BaselineFD = CalculateBaseline(h1D_TemplateTotal, kTRUE); - Double_t BaselineData; + Double_t const baselineFd = calculateBaseline(h1DTemplateTotal, kTRUE); + Double_t baselineData; if (fSecPartContamination) { - BaselineData = CalculateBaseline(h1D_SubtrNorm_SecPart, kTRUE); + baselineData = calculateBaseline(h1DSubtrNormSecPart, kTRUE); } else { - BaselineData = CalculateBaseline(h1D_SubtrNorm, kTRUE); + baselineData = calculateBaseline(h1DSubtrNorm, kTRUE); } std::cout << "===================== " << std::endl; - std::cout << "Baseline FD: " << BaselineFD << std::endl; - std::cout << "Baseline Data: " << BaselineData << std::endl; + std::cout << "Baseline FD: " << baselineFd << std::endl; + std::cout << "Baseline Data: " << baselineData << std::endl; std::cout << "===================== " << std::endl; std::cout << " " << std::endl; - Double_t Baselinediff = BaselineData - BaselineFD; - TH1D* hBaselineDiff = reinterpret_cast(h1D_FDTemplateNonPrompt->Clone("hBaselineDiff")); + Double_t const baselinediff = baselineData - baselineFd; + TH1D* hBaselineDiff = reinterpret_cast(h1DFdTemplateNonPrompt->Clone("hBaselineDiff")); for (int iBin = 0; iBin < hBaselineDiff->GetNbinsX(); iBin++) { - hBaselineDiff->SetBinContent(iBin + 1, Baselinediff); + hBaselineDiff->SetBinContent(iBin + 1, baselinediff); } - h1D_FDTemplateNonPrompt->Add(hBaselineDiff); - h1D_TemplateTotal->Add(hBaselineDiff); + h1DFdTemplateNonPrompt->Add(hBaselineDiff); + h1DTemplateTotal->Add(hBaselineDiff); if (fSecPartContamination) { - h1D_SubtrFDNorm = reinterpret_cast(h1D_SubtrNorm_SecPart->Clone("h1D_SubtrFDNorm")); + h1DSubtrFdNorm = reinterpret_cast(h1DSubtrNormSecPart->Clone("h1D_SubtrFDNorm")); } else { - h1D_SubtrFDNorm = reinterpret_cast(h1D_SubtrNorm->Clone("h1D_SubtrFDNorm")); + h1DSubtrFdNorm = reinterpret_cast(h1DSubtrNorm->Clone("h1D_SubtrFDNorm")); } - h1D_FDTemplateNonPrompt->Scale(1 - FDPromptFrac); - h1D_SubtrFDNorm->Add(h1D_FDTemplateNonPrompt, -1); - h1D_SubtrFDNorm->Scale(1. / FDPromptFrac); + h1DFdTemplateNonPrompt->Scale(1 - fdPromptFrac); + h1DSubtrFdNorm->Add(h1DFdTemplateNonPrompt, -1); + h1DSubtrFdNorm->Scale(1. / fdPromptFrac); if (fDebug >= 1) { - TCanvas* c1 = new TCanvas(Form("cFDTemplateSubtr_%1.1fto%1.1f", PtHadMin, PtHadMax), Form("cFDTemplateSubtr_%s_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax), 100, 100, 1600, 900); + auto* c1 = new TCanvas(Form("cFDTemplateSubtr_%1.1fto%1.1f", ptHadMin, ptHadMax), Form("cFDTemplateSubtr_%s_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax), 100, 100, 1600, 900); c1->cd(); - h1D_SubtrNorm->SetLineColor(kRed); - h1D_SubtrNorm_SecPart->SetLineColor(kOrange); - h1D_FDTemplateNonPrompt->SetLineColor(kBlue); - h1D_SubtrFDNorm->SetLineColor(kGreen); - h1D_TemplateTotal->SetLineColor(kMagenta); - h1D_SubtrNorm->SetMinimum(0); - h1D_SubtrNorm_SecPart->SetMinimum(0); - h1D_FDTemplateNonPrompt->SetMinimum(0); - h1D_SubtrFDNorm->SetMinimum(0); + h1DSubtrNorm->SetLineColor(kRed); + h1DSubtrNormSecPart->SetLineColor(kOrange); + h1DFdTemplateNonPrompt->SetLineColor(kBlue); + h1DSubtrFdNorm->SetLineColor(kGreen); + h1DTemplateTotal->SetLineColor(kMagenta); + h1DSubtrNorm->SetMinimum(0); + h1DSubtrNormSecPart->SetMinimum(0); + h1DFdTemplateNonPrompt->SetMinimum(0); + h1DSubtrFdNorm->SetMinimum(0); // h1D_SubtrNorm -> GetYaxis() -> SetRangeUser(0., 8.); - h1D_SubtrNorm->SetMarkerStyle(kFullCircle); - h1D_SubtrNorm->SetMarkerSize(1.2); - h1D_SubtrNorm->SetMarkerColor(kRed); - h1D_SubtrNorm->SetLineWidth(2); - h1D_SubtrNorm_SecPart->SetMarkerStyle(kFullCircle); - h1D_SubtrNorm_SecPart->SetMarkerSize(1.2); - h1D_SubtrNorm_SecPart->SetMarkerColor(kOrange); - h1D_SubtrNorm_SecPart->SetLineWidth(2); - h1D_SubtrFDNorm->SetMarkerStyle(kFullCircle); - h1D_SubtrFDNorm->SetMarkerSize(1.2); - h1D_SubtrFDNorm->SetMarkerColor(kGreen); - h1D_SubtrFDNorm->SetLineWidth(2); - h1D_SubtrNorm->GetYaxis()->SetTitle("#frac{1}{N_{D}} #frac{dN^{assoc. part}}{d#Delta#phi}"); - h1D_SubtrNorm_SecPart->GetYaxis()->SetTitle("#frac{1}{N_{D}} #frac{dN^{assoc. part}}{d#Delta#phi}"); + h1DSubtrNorm->SetMarkerStyle(kFullCircle); + h1DSubtrNorm->SetMarkerSize(1.2); + h1DSubtrNorm->SetMarkerColor(kRed); + h1DSubtrNorm->SetLineWidth(2); + h1DSubtrNormSecPart->SetMarkerStyle(kFullCircle); + h1DSubtrNormSecPart->SetMarkerSize(1.2); + h1DSubtrNormSecPart->SetMarkerColor(kOrange); + h1DSubtrNormSecPart->SetLineWidth(2); + h1DSubtrFdNorm->SetMarkerStyle(kFullCircle); + h1DSubtrFdNorm->SetMarkerSize(1.2); + h1DSubtrFdNorm->SetMarkerColor(kGreen); + h1DSubtrFdNorm->SetLineWidth(2); + h1DSubtrNorm->GetYaxis()->SetTitle("#frac{1}{N_{D}} #frac{dN^{assoc. part}}{d#Delta#phi}"); + h1DSubtrNormSecPart->GetYaxis()->SetTitle("#frac{1}{N_{D}} #frac{dN^{assoc. part}}{d#Delta#phi}"); if (fSecPartContamination) { - h1D_SubtrNorm_SecPart->Draw(); + h1DSubtrNormSecPart->Draw(); } else { - h1D_SubtrNorm->Draw(); + h1DSubtrNorm->Draw(); } // h1D_FDTemplateNonPrompt -> Draw("same"); - h1D_SubtrFDNorm->Draw("same"); - h1D_TemplateTotal->Draw("same"); - c1->SaveAs(Form("Output_CorrelationExtraction_%s_png/CorrFDTemplateSubtr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); - c1->SaveAs(Form("Output_CorrelationExtraction_%s_Root/CorrFDTemplateSubtr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + h1DSubtrFdNorm->Draw("same"); + h1DTemplateTotal->Draw("same"); + c1->SaveAs(Form("Output_CorrelationExtraction_%s_png/CorrFDTemplateSubtr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); + c1->SaveAs(Form("Output_CorrelationExtraction_%s_Root/CorrFDTemplateSubtr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); } } if (fFDsubtraction) { - fCorrectedCorrHisto = reinterpret_cast(h1D_SubtrFDNorm->Clone(Form("hCorrectedCorr_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax))); + fCorrectedCorrHisto = reinterpret_cast(h1DSubtrFdNorm->Clone(Form("hCorrectedCorr_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", ptCandMin, ptCandMax, ptHadMin, ptHadMax))); } else if (fSecPartContamination) { - fCorrectedCorrHisto = reinterpret_cast(h1D_SubtrNorm_SecPart->Clone(Form("hCorrectedCorr_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax))); + fCorrectedCorrHisto = reinterpret_cast(h1DSubtrNormSecPart->Clone(Form("hCorrectedCorr_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", ptCandMin, ptCandMax, ptHadMin, ptHadMax))); } else { - fCorrectedCorrHisto = reinterpret_cast(h1D_SubtrNorm->Clone(Form("hCorrectedCorr_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax))); + fCorrectedCorrHisto = reinterpret_cast(h1DSubtrNorm->Clone(Form("hCorrectedCorr_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", ptCandMin, ptCandMax, ptHadMin, ptHadMax))); } std::cout << "Analysis steps completed - baseline subtraction missing" << std::endl; // Draw 1D plots (Signal region, normalized) - TCanvas* cFinal = new TCanvas(Form("cFinal_%.0fto%.0f", PtHadMin, PtHadMax), Form("cFinal_%s_IntPools_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), PtHadMin, PtHadMax), 100, 100, 1200, 700); - h1D_SubtrNorm->SetLineColor(kBlue + 1); - h1D_SubtrNorm->SetMarkerColor(kBlue + 1); - h1D_SubtrNorm->SetMarkerStyle(kFullCircle); - h1D_SubtrNorm->SetMinimum(0); - h1D_SubtrNorm->Draw(); + auto* cFinal = new TCanvas(Form("cFinal_%.0fto%.0f", ptHadMin, ptHadMax), Form("cFinal_%s_IntPools_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), ptHadMin, ptHadMax), 100, 100, 1200, 700); + h1DSubtrNorm->SetLineColor(kBlue + 1); + h1DSubtrNorm->SetMarkerColor(kBlue + 1); + h1DSubtrNorm->SetMarkerStyle(kFullCircle); + h1DSubtrNorm->SetMinimum(0); + h1DSubtrNorm->Draw(); if (fSecPartContamination) { - h1D_SubtrNorm_SecPart->SetLineColor(kRed + 1); - h1D_SubtrNorm_SecPart->SetMarkerColor(kRed + 1); - h1D_SubtrNorm_SecPart->SetMarkerStyle(kFullCircle); - h1D_SubtrNorm_SecPart->Draw("same"); + h1DSubtrNormSecPart->SetLineColor(kRed + 1); + h1DSubtrNormSecPart->SetMarkerColor(kRed + 1); + h1DSubtrNormSecPart->SetMarkerStyle(kFullCircle); + h1DSubtrNormSecPart->Draw("same"); } if (fFDsubtraction) { - h1D_SubtrFDNorm->SetLineColor(kGreen + 2); - h1D_SubtrFDNorm->SetMarkerColor(kGreen + 2); - h1D_SubtrFDNorm->SetMarkerStyle(kFullCircle); - h1D_SubtrFDNorm->Draw("same"); + h1DSubtrFdNorm->SetLineColor(kGreen + 2); + h1DSubtrFdNorm->SetMarkerColor(kGreen + 2); + h1DSubtrFdNorm->SetMarkerStyle(kFullCircle); + h1DSubtrFdNorm->Draw("same"); + } + if (fFDsubtraction) { + h1DTemplateTotal->Draw("same"); + } + auto* lFinal = new TLegend(); + lFinal->AddEntry(h1DSubtrNorm, "Corr. after bkg subtr."); + if (fFDsubtraction) { + lFinal->AddEntry(h1DTemplateTotal, "CR Mode 2 total template"); } - if (fFDsubtraction) - h1D_TemplateTotal->Draw("same"); - TLegend* lFinal = new TLegend(); - lFinal->AddEntry(h1D_SubtrNorm, "Corr. after bkg subtr."); - if (fFDsubtraction) - lFinal->AddEntry(h1D_TemplateTotal, "CR Mode 2 total template"); if (fSecPartContamination) { - lFinal->AddEntry(h1D_SubtrNorm_SecPart, "Corr. after sec. part. correction"); + lFinal->AddEntry(h1DSubtrNormSecPart, "Corr. after sec. part. correction"); } if (fFDsubtraction) { - lFinal->AddEntry(h1D_SubtrFDNorm, "Corr. FD subtr."); + lFinal->AddEntry(h1DSubtrFdNorm, "Corr. FD subtr."); } lFinal->Draw("same"); - cFinal->SaveAs(Form("Output_CorrelationExtraction_%s_png/AzimCorrDistr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); - cFinal->SaveAs(Form("Output_CorrelationExtraction_%s_Root/AzimCorrDistr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + cFinal->SaveAs(Form("Output_CorrelationExtraction_%s_png/AzimCorrDistr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); + cFinal->SaveAs(Form("Output_CorrelationExtraction_%s_Root/AzimCorrDistr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); // Baseline subtraction - Double_t BaselineData, BaselineDataErr; - TH1D* hBaseline = reinterpret_cast(h1D_SubtrNorm->Clone("hBaseline")); + Double_t baselineData, baselineDataErr; + TH1D* hBaseline = reinterpret_cast(h1DSubtrNorm->Clone("hBaseline")); hBaseline->Sumw2(); if (fFDsubtraction) { - BaselineData = CalculateBaseline(h1D_SubtrFDNorm, kTRUE, kFALSE); // introduced kFALSE - BaselineDataErr = CalculateBaselineError(h1D_SubtrFDNorm, kTRUE, kFALSE); + baselineData = calculateBaseline(h1DSubtrFdNorm, kTRUE, kFALSE); // introduced kFALSE + baselineDataErr = calculateBaselineError(h1DSubtrFdNorm, kTRUE, kFALSE); for (int iBin = 0; iBin < hBaseline->GetNbinsX(); iBin++) { - hBaseline->SetBinContent(iBin + 1, BaselineData); - hBaseline->SetBinError(iBin + 1, BaselineDataErr); + hBaseline->SetBinContent(iBin + 1, baselineData); + hBaseline->SetBinError(iBin + 1, baselineDataErr); } - h1D_BaselineSubtr = reinterpret_cast(h1D_SubtrFDNorm->Clone("h1D_BaselineSubtr")); - h1D_BaselineSubtr->Add(hBaseline, -1.); + h1DBaselineSubtr = reinterpret_cast(h1DSubtrFdNorm->Clone("h1D_BaselineSubtr")); + h1DBaselineSubtr->Add(hBaseline, -1.); } else if (fSecPartContamination) { - BaselineData = CalculateBaseline(h1D_SubtrNorm_SecPart, kTRUE, kFALSE); - BaselineDataErr = CalculateBaselineError(h1D_SubtrNorm_SecPart, kTRUE, kFALSE); + baselineData = calculateBaseline(h1DSubtrNormSecPart, kTRUE, kFALSE); + baselineDataErr = calculateBaselineError(h1DSubtrNormSecPart, kTRUE, kFALSE); for (int iBin = 0; iBin < hBaseline->GetNbinsX(); iBin++) { - hBaseline->SetBinContent(iBin + 1, BaselineData); - hBaseline->SetBinError(iBin + 1, BaselineDataErr); + hBaseline->SetBinContent(iBin + 1, baselineData); + hBaseline->SetBinError(iBin + 1, baselineDataErr); } - h1D_BaselineSubtr = reinterpret_cast(h1D_SubtrNorm_SecPart->Clone("h1D_BaselineSubtr")); - h1D_BaselineSubtr->Add(hBaseline, -1.); + h1DBaselineSubtr = reinterpret_cast(h1DSubtrNormSecPart->Clone("h1D_BaselineSubtr")); + h1DBaselineSubtr->Add(hBaseline, -1.); } else { - BaselineData = CalculateBaseline(h1D_SubtrNorm, kTRUE, kFALSE); - BaselineDataErr = CalculateBaselineError(h1D_SubtrNorm, kTRUE, kFALSE); + baselineData = calculateBaseline(h1DSubtrNorm, kTRUE, kFALSE); + baselineDataErr = calculateBaselineError(h1DSubtrNorm, kTRUE, kFALSE); for (int iBin = 0; iBin < hBaseline->GetNbinsX(); iBin++) { - hBaseline->SetBinContent(iBin + 1, BaselineData); - hBaseline->SetBinError(iBin + 1, BaselineDataErr); + hBaseline->SetBinContent(iBin + 1, baselineData); + hBaseline->SetBinError(iBin + 1, baselineDataErr); } - h1D_BaselineSubtr = reinterpret_cast(h1D_SubtrNorm->Clone("h1D_BaselineSubtr")); - h1D_BaselineSubtr->Add(hBaseline, -1.); + h1DBaselineSubtr = reinterpret_cast(h1DSubtrNorm->Clone("h1D_BaselineSubtr")); + h1DBaselineSubtr->Add(hBaseline, -1.); } - fCorrectedCorrHisto_BaselineSubtr = reinterpret_cast(h1D_BaselineSubtr->Clone(Form("hCorrectedCorrBaselineSubtr_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax))); + fCorrectedCorrHistoBaselineSubtr = reinterpret_cast(h1DBaselineSubtr->Clone(Form("hCorrectedCorrBaselineSubtr_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", ptCandMin, ptCandMax, ptHadMin, ptHadMax))); - TCanvas* cFinal_BaselineSubtr = new TCanvas(Form("cFinal_BaselineSubtr_%.0fto%.0f", PtHadMin, PtHadMax), Form("cFinal_BaselineSubtr_%s_IntPools_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), PtHadMin, PtHadMax), 100, 100, 1200, 700); - h1D_BaselineSubtr->SetMarkerColor(kOrange + 8); - h1D_BaselineSubtr->SetLineColor(kOrange + 8); - h1D_BaselineSubtr->GetYaxis()->SetRangeUser(-0.2, 8.); - h1D_BaselineSubtr->Draw(); + auto* cFinalBaselineSubtr = new TCanvas(Form("cFinal_BaselineSubtr_%.0fto%.0f", ptHadMin, ptHadMax), Form("cFinal_BaselineSubtr_%s_IntPools_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), ptHadMin, ptHadMax), 100, 100, 1200, 700); + h1DBaselineSubtr->SetMarkerColor(kOrange + 8); + h1DBaselineSubtr->SetLineColor(kOrange + 8); + h1DBaselineSubtr->GetYaxis()->SetRangeUser(-0.2, 8.); + h1DBaselineSubtr->Draw(); if (fFDsubtraction) { - h1D_SubtrFDNorm->Draw("same"); + h1DSubtrFdNorm->Draw("same"); } else if (fSecPartContamination) { - h1D_SubtrNorm_SecPart->Draw("same"); + h1DSubtrNormSecPart->Draw("same"); } else { - h1D_SubtrNorm->Draw("same"); + h1DSubtrNorm->Draw("same"); } hBaseline->SetMarkerColor(kPink - 6); hBaseline->SetMarkerStyle(kFullSquare); hBaseline->SetLineColor(kPink - 6); hBaseline->Draw("same"); - cFinal_BaselineSubtr->SaveAs(Form("Output_CorrelationExtraction_%s_png/AzimCorrDistr_BaselineSubtr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); - cFinal_BaselineSubtr->SaveAs(Form("Output_CorrelationExtraction_%s_Root/AzimCorrDistr_BaselineSubtr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + cFinalBaselineSubtr->SaveAs(Form("Output_CorrelationExtraction_%s_png/AzimCorrDistr_BaselineSubtr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); + cFinalBaselineSubtr->SaveAs(Form("Output_CorrelationExtraction_%s_Root/AzimCorrDistr_BaselineSubtr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); // Reflected histograms if (fFDsubtraction) { - h1D_ReflCorr = ReflectCorrHistogram(h1D_SubtrFDNorm); + h1DReflCorr = reflectCorrHistogram(h1DSubtrFdNorm); } else if (fSecPartContamination) { - h1D_ReflCorr = ReflectCorrHistogram(h1D_SubtrNorm_SecPart); + h1DReflCorr = reflectCorrHistogram(h1DSubtrNormSecPart); } else { - h1D_ReflCorr = ReflectCorrHistogram(h1D_SubtrNorm); + h1DReflCorr = reflectCorrHistogram(h1DSubtrNorm); } /* used as control using Run2 reflection function @@ -775,27 +783,27 @@ Bool_t DhCorrelationExtraction::ExtractCorrelations(Double_t PtCandMin, Double_t h1D_ReflCorr = ReflectHistoRun2(h1D_SubtrNorm, 0.5); }*/ - TCanvas* cFinal_Reflected = new TCanvas(Form("cFinal_Reflected_%.0fto%.0f", PtHadMin, PtHadMax), Form("cFinal_Reflected_%s_IntPools_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), PtHadMin, PtHadMax), 100, 100, 1200, 700); - cFinal_Reflected->cd(); - SetTH1HistoStyle(h1D_ReflCorr, Form("%.0f < p_{T} < %.0f GeV/c", PtCandMin, PtCandMax), "#Delta#phi [rad]", "#frac{1}{N_{D}}#frac{dN^{assoc}}{d#Delta#phi} [rad^{-1}]", kFullCircle, kOrange + 8, 1.6, kOrange + 8, 3); - h1D_ReflCorr->SetMinimum(0); - h1D_ReflCorr->Draw(); - cFinal_Reflected->SaveAs(Form("Output_CorrelationExtraction_%s_png/AzimCorrDistr_Reflected_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); - cFinal_Reflected->SaveAs(Form("Output_CorrelationExtraction_%s_Root/AzimCorrDistr_Reflected_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + auto* cFinalReflected = new TCanvas(Form("cFinal_Reflected_%.0fto%.0f", ptHadMin, ptHadMax), Form("cFinal_Reflected_%s_IntPools_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), ptHadMin, ptHadMax), 100, 100, 1200, 700); + cFinalReflected->cd(); + setTH1HistoStyle(h1DReflCorr, Form("%.0f < p_{T} < %.0f GeV/c", ptCandMin, ptCandMax), "#Delta#phi [rad]", "#frac{1}{N_{D}}#frac{dN^{assoc}}{d#Delta#phi} [rad^{-1}]", kFullCircle, kOrange + 8, 1.6, kOrange + 8, 3); + h1DReflCorr->SetMinimum(0); + h1DReflCorr->Draw(); + cFinalReflected->SaveAs(Form("Output_CorrelationExtraction_%s_png/AzimCorrDistr_Reflected_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); + cFinalReflected->SaveAs(Form("Output_CorrelationExtraction_%s_Root/AzimCorrDistr_Reflected_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); // Reflected histograms baseline subtracted - TH1D* hBaseline_Refl = reinterpret_cast(h1D_ReflCorr->Clone("hBaseline_Refl")); - hBaseline_Refl->Sumw2(); - BaselineData = CalculateBaseline(h1D_ReflCorr, kFALSE, kTRUE); - BaselineDataErr = CalculateBaselineError(h1D_ReflCorr, kFALSE, kTRUE); - - for (int iBin = 0; iBin < hBaseline_Refl->GetNbinsX(); iBin++) { - hBaseline_Refl->SetBinContent(iBin + 1, BaselineData); - hBaseline_Refl->SetBinError(iBin + 1, BaselineDataErr); + TH1D* hBaselineRefl = reinterpret_cast(h1DReflCorr->Clone("hBaseline_Refl")); + hBaselineRefl->Sumw2(); + baselineData = calculateBaseline(h1DReflCorr, kFALSE, kTRUE); + baselineDataErr = calculateBaselineError(h1DReflCorr, kFALSE, kTRUE); + + for (int iBin = 0; iBin < hBaselineRefl->GetNbinsX(); iBin++) { + hBaselineRefl->SetBinContent(iBin + 1, baselineData); + hBaselineRefl->SetBinError(iBin + 1, baselineDataErr); } - h1D_ReflCorr_BaselineSubtr = reinterpret_cast(h1D_ReflCorr->Clone("h1D_ReflCorr_BaselineSubtr")); - h1D_ReflCorr_BaselineSubtr->Sumw2(); - h1D_ReflCorr_BaselineSubtr->Add(hBaseline_Refl, -1.); + h1DReflCorrBaselineSubtr = reinterpret_cast(h1DReflCorr->Clone("h1D_ReflCorr_BaselineSubtr")); + h1DReflCorrBaselineSubtr->Sumw2(); + h1DReflCorrBaselineSubtr->Add(hBaselineRefl, -1.); TF1* fConstZero = new TF1("fConstZero", "[0]", 0., TMath::Pi()); fConstZero->SetParameter(0, 0.); @@ -804,40 +812,40 @@ Bool_t DhCorrelationExtraction::ExtractCorrelations(Double_t PtCandMin, Double_t fConstZero->SetLineWidth(4); fConstZero->SetTitle(""); - TCanvas* cFinal_Reflected_BaselineSubtr = new TCanvas(Form("cFinal_Reflected_BaselineSubtr_%.0fto%.0f", PtHadMin, PtHadMax), Form("cFinal_Reflected_BaselineSubtr_%s_IntPools_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), PtHadMin, PtHadMax), 100, 100, 1200, 700); - SetTH1HistoStyle(h1D_ReflCorr_BaselineSubtr, Form("%.0f < p_{T} < %.0f GeV/c", PtCandMin, PtCandMax), "#Delta#phi [rad]", "#frac{1}{N_{D}}#frac{dN^{assoc}}{d#Delta#phi} [rad^{-1}]", kFullCircle, kRed + 1, 1.6, kRed + 1, 3); - hBaseline_Refl->SetMarkerColor(kOrange); - hBaseline_Refl->SetMarkerStyle(kFullSquare); - hBaseline_Refl->SetLineColor(kOrange); - cFinal_Reflected_BaselineSubtr->cd(); - h1D_ReflCorr->SetMinimum(-0.8); - h1D_ReflCorr->SetStats(0); - hBaseline_Refl->SetStats(0); - h1D_ReflCorr->Draw(); - hBaseline_Refl->Draw("same"); - h1D_ReflCorr_BaselineSubtr->SetStats(0); - h1D_ReflCorr_BaselineSubtr->Draw("same"); // then keep just this + auto* cFinalReflectedBaselineSubtr = new TCanvas(Form("cFinal_Reflected_BaselineSubtr_%.0fto%.0f", ptHadMin, ptHadMax), Form("cFinal_Reflected_BaselineSubtr_%s_IntPools_PtAssoc%.0fto%.0f", fDmesonLabel.Data(), ptHadMin, ptHadMax), 100, 100, 1200, 700); + setTH1HistoStyle(h1DReflCorrBaselineSubtr, Form("%.0f < p_{T} < %.0f GeV/c", ptCandMin, ptCandMax), "#Delta#phi [rad]", "#frac{1}{N_{D}}#frac{dN^{assoc}}{d#Delta#phi} [rad^{-1}]", kFullCircle, kRed + 1, 1.6, kRed + 1, 3); + hBaselineRefl->SetMarkerColor(kOrange); + hBaselineRefl->SetMarkerStyle(kFullSquare); + hBaselineRefl->SetLineColor(kOrange); + cFinalReflectedBaselineSubtr->cd(); + h1DReflCorr->SetMinimum(-0.8); + h1DReflCorr->SetStats(false); + hBaselineRefl->SetStats(false); + h1DReflCorr->Draw(); + hBaselineRefl->Draw("same"); + h1DReflCorrBaselineSubtr->SetStats(false); + h1DReflCorrBaselineSubtr->Draw("same"); // then keep just this fConstZero->Draw("same"); - cFinal_Reflected_BaselineSubtr->SaveAs(Form("Output_CorrelationExtraction_%s_png/AzimCorrDistr_Reflected_BaselineSubtr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); - cFinal_Reflected_BaselineSubtr->SaveAs(Form("Output_CorrelationExtraction_%s_Root/AzimCorrDistr_Reflected_BaselineSubtr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + cFinalReflectedBaselineSubtr->SaveAs(Form("Output_CorrelationExtraction_%s_png/AzimCorrDistr_Reflected_BaselineSubtr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); + cFinalReflectedBaselineSubtr->SaveAs(Form("Output_CorrelationExtraction_%s_Root/AzimCorrDistr_Reflected_BaselineSubtr_%s_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.root", codeName.Data(), fDmesonLabel.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax)); - fCorrectedCorrHisto_Reflected = reinterpret_cast(h1D_ReflCorr->Clone(Form("hCorrectedCorrReflected_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax))); - fCorrectedCorrHisto_Reflected_BaselineSubtr = reinterpret_cast(h1D_ReflCorr_BaselineSubtr->Clone(Form("hCorrectedCorrReflected_BaselineSubtr_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax))); + fCorrectedCorrHistoReflected = reinterpret_cast(h1DReflCorr->Clone(Form("hCorrectedCorrReflected_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", ptCandMin, ptCandMax, ptHadMin, ptHadMax))); + fCorrectedCorrHistoReflectedBaselineSubtr = reinterpret_cast(h1DReflCorrBaselineSubtr->Clone(Form("hCorrectedCorrReflected_BaselineSubtr_PtCand%.0fto%.0f_PtAssoc%.0fto%.0f", ptCandMin, ptCandMax, ptHadMin, ptHadMax))); return kTRUE; } -Bool_t DhCorrelationExtraction::ReadInputSEandME() +Bool_t DhCorrelationExtraction::readInputSeAndMe() { fFileSE = TFile::Open(fFileNameSE.Data()); - if (!fFileSE) { + if (fFileSE == nullptr) { std::cout << "[ERROR] File " << fFileNameSE << " cannot be opened! check your file path!"; return kFALSE; } fFileME = TFile::Open(fFileNameME.Data()); - if (!fFileME) { + if (fFileME == nullptr) { std::cout << "[ERROR] File " << fFileNameME << " cannot be opened! check your file path!"; return kFALSE; } @@ -857,11 +865,11 @@ Bool_t DhCorrelationExtraction::ReadInputSEandME() return kTRUE; } -Bool_t DhCorrelationExtraction::ReadInputInvMass() +Bool_t DhCorrelationExtraction::readInputInvMass() { fFileMass = TFile::Open(fFileNameMass.Data()); - if (!fFileMass) { + if (fFileMass == nullptr) { std::cout << "[ERROR] File " << fFileNameMass << " cannot be opened! check your file path!"; return kFALSE; } @@ -878,16 +886,16 @@ Bool_t DhCorrelationExtraction::ReadInputInvMass() return kTRUE; } -Bool_t DhCorrelationExtraction::ReadInputFDSubtr() +Bool_t DhCorrelationExtraction::readInputFdSubtr() { fFileFDTemplate = TFile::Open(fFileFDTemplateName.Data()); fFileFDPromptFrac = TFile::Open(fFileFDPromptFracName.Data()); - if (!fFileFDTemplate) { + if (fFileFDTemplate == nullptr) { std::cout << "[ERROR] File " << fFileFDTemplateName << " cannot be opened! check your file path!" << std::endl; return kFALSE; } - if (!fFileFDPromptFrac) { + if (fFileFDPromptFrac == nullptr) { std::cout << "[ERROR] File " << fFileFDPromptFracName << " cannot be opened! check your file path!" << std::endl; return kFALSE; } @@ -905,18 +913,18 @@ Bool_t DhCorrelationExtraction::ReadInputFDSubtr() return kTRUE; } -Bool_t DhCorrelationExtraction::ReadInputSecondaryPartContamination() +Bool_t DhCorrelationExtraction::readInputSecondaryPartContamination() { fFileSecPart = TFile::Open(fFileSecPartName.Data()); - if (!fFileSecPart) { + if (fFileSecPart == nullptr) { std::cout << "[ERROR] File " << fFileSecPartName << " cannot be opened! check your file path!" << std::endl; return kFALSE; } fDirSecPart = reinterpret_cast(fFileSecPart->Get(fDirSecPartName.Data())); - if (!fDirSecPart) { + if (fDirSecPart == nullptr) { std::cout << "[ERROR] Directory " << fDirSecPart << " cannot be opened! check your file path!" << std::endl; return kFALSE; } @@ -931,7 +939,7 @@ Bool_t DhCorrelationExtraction::ReadInputSecondaryPartContamination() return kTRUE; } -TH1D* DhCorrelationExtraction::EvaluateMCClosModulations(Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax) +TH1D* DhCorrelationExtraction::evaluateMcClosModulations(Double_t ptCandMin, Double_t ptCandMax, Double_t ptHadMin, Double_t ptHadMax) { TH1D* hModul = new TH1D(); @@ -939,10 +947,10 @@ TH1D* DhCorrelationExtraction::EvaluateMCClosModulations(Double_t PtCandMin, Dou fFilePromptMc = TFile::Open(fFilePromptMcRecName.Data()); fFileNonPromptMc = TFile::Open(fFileNonPromptMcRecName.Data()); - if (!fFilePromptMc) { + if (fFilePromptMc == nullptr) { std::cout << "[ERROR] File prompt MC rec cannot be opened! check your file path!" << std::endl; } - if (!fFileNonPromptMc) { + if (fFileNonPromptMc == nullptr) { std::cout << "[ERROR] File non-prompt MC rec cannot be opened! check your file path!" << std::endl; } @@ -954,10 +962,10 @@ TH1D* DhCorrelationExtraction::EvaluateMCClosModulations(Double_t PtCandMin, Dou printf("[INFO] Bin cand %d - Bin had %d \n", fBinPtCand, fBinPtHad); - // hRecPrompt = ReflectCorrHistogram(hRecPrompt); - // hRecNonPrompt = ReflectCorrHistogram(hRecNonPrompt); - // hGenPrompt = ReflectCorrHistogram(hGenPrompt); - // hGenNonPrompt = ReflectCorrHistogram(hGenNonPrompt); + // hRecPrompt = reflectCorrHistogram(hRecPrompt); + // hRecNonPrompt = reflectCorrHistogram(hRecNonPrompt); + // hGenPrompt = reflectCorrHistogram(hGenPrompt); + // hGenNonPrompt = reflectCorrHistogram(hGenNonPrompt); hRecNonPrompt->Sumw2(); hRecNonPrompt->Sumw2(); @@ -971,14 +979,14 @@ TH1D* DhCorrelationExtraction::EvaluateMCClosModulations(Double_t PtCandMin, Dou TF1* funFit = new TF1("funFit", "[0]", TMath::Pi() * 3. / 8., TMath::Pi() * 3 / 2); hRatioNonPrompt->Fit(funFit, "R"); - Double_t fitVal = funFit->GetParameter(0); + Double_t const fitVal = funFit->GetParameter(0); - TCanvas* cRatio_MCClosure = new TCanvas(Form("cRatio_MCClosure_PtCand%.0fto%.0f_Pthad%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax), Form("cRatio_MCClosure_PtCand%.0fto%.0f_Pthad%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax), 100, 100, 1200, 700); - cRatio_MCClosure->cd(); + auto* cRatioMcClosure = new TCanvas(Form("cRatio_MCClosure_PtCand%.0fto%.0f_Pthad%.0fto%.0f", ptCandMin, ptCandMax, ptHadMin, ptHadMax), Form("cRatio_MCClosure_PtCand%.0fto%.0f_Pthad%.0fto%.0f", ptCandMin, ptCandMax, ptHadMin, ptHadMax), 100, 100, 1200, 700); + cRatioMcClosure->cd(); hRatioNonPrompt->GetYaxis()->SetRangeUser(0.2, 1.8); hRatioNonPrompt->Draw(); - Double_t FPrompt = GetFDPromptFrac(PtCandMin, PtCandMax, PtHadMin, PtHadMax); + Double_t const fPrompt = getFdPromptFrac(ptCandMin, ptCandMax, ptHadMin, ptHadMax); Double_t relAmplC[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Double_t relAmplB[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Double_t recoKineVal[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; @@ -987,13 +995,13 @@ TH1D* DhCorrelationExtraction::EvaluateMCClosModulations(Double_t PtCandMin, Dou for (int iBin = 0; iBin < hRatioNonPrompt->GetNbinsX(); iBin++) { if (iBin > 1 && iBin < 13) { recoKineVal[iBin - 2] = hRatioNonPrompt->GetBinContent(iBin + 1) - (fitVal - 1); - relAmplC[iBin - 2] = hRecPrompt->GetBinContent(iBin + 1) / (hRecPrompt->GetBinContent(iBin + 1) * FPrompt + hRecNonPrompt->GetBinContent(iBin + 1) * (1 - FPrompt)); - relAmplB[iBin - 2] = hRecNonPrompt->GetBinContent(iBin + 1) / (hRecPrompt->GetBinContent(iBin + 1) * FPrompt + hRecNonPrompt->GetBinContent(iBin + 1) * (1 - FPrompt)); - modul[iBin - 2] = relAmplC[iBin - 2] * FPrompt + relAmplB[iBin - 2] * (1 - FPrompt) / recoKineVal[iBin - 2]; + relAmplC[iBin - 2] = hRecPrompt->GetBinContent(iBin + 1) / (hRecPrompt->GetBinContent(iBin + 1) * fPrompt + hRecNonPrompt->GetBinContent(iBin + 1) * (1 - fPrompt)); + relAmplB[iBin - 2] = hRecNonPrompt->GetBinContent(iBin + 1) / (hRecPrompt->GetBinContent(iBin + 1) * fPrompt + hRecNonPrompt->GetBinContent(iBin + 1) * (1 - fPrompt)); + modul[iBin - 2] = relAmplC[iBin - 2] * fPrompt + relAmplB[iBin - 2] * (1 - fPrompt) / recoKineVal[iBin - 2]; hModul->SetBinContent(iBin + 1, modul[iBin - 2]); hModul->SetBinError(iBin + 1, 0.); - printf("[INFO] Bin%d MODUL = %1.5f\t (Reco/Kine-fitVal = %1.4f, FPrompt = %1.3f, Ampl_ratio C,B = %1.4f, %1.4f)\n", iBin + 1, modul[iBin - 2], recoKineVal[iBin - 2], FPrompt, relAmplC[iBin - 2], relAmplB[iBin - 2]); + printf("[INFO] Bin%d MODUL = %1.5f\t (Reco/Kine-fitVal = %1.4f, FPrompt = %1.3f, Ampl_ratio C,B = %1.4f, %1.4f)\n", iBin + 1, modul[iBin - 2], recoKineVal[iBin - 2], fPrompt, relAmplC[iBin - 2], relAmplB[iBin - 2]); } else { hModul->SetBinContent(iBin + 1, 1.); hModul->SetBinError(iBin + 1, 0.); @@ -1003,19 +1011,19 @@ TH1D* DhCorrelationExtraction::EvaluateMCClosModulations(Double_t PtCandMin, Dou hModul->SetLineColor(kMagenta); hModul->Draw("same"); - cRatio_MCClosure->SaveAs(Form("Output_CorrelationExtraction_Thin2023_FullAnalysis_CentralPoints_png/Ratio_MCClosure_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + cRatioMcClosure->SaveAs(Form("Output_CorrelationExtraction_Thin2023_FullAnalysis_CentralPoints_png/Ratio_MCClosure_Canvas_PtCand%.0fto%.0f_PoolInt_PtAssoc%.0fto%.0f.png", ptCandMin, ptCandMax, ptHadMin, ptHadMax)); return hModul; } -TH2D* DhCorrelationExtraction::GetCorrelHisto(Int_t SEorME, Int_t SorSB, Int_t pool, Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax) +TH2D* DhCorrelationExtraction::getCorrelHisto(Int_t sEorMe, Int_t sorSb, Int_t pool, Double_t ptCandMin, Double_t ptCandMax, Double_t ptHadMin, Double_t ptHadMax) { // TODO: Subtraction of softpion TH2D* h2D = new TH2D(); // pointer to be returned - THnSparseD* hSparse = 0x0; - if (SEorME == kSE) { // Same Event - if (SorSB == kSign) { + THnSparseD* hSparse = nullptr; + if (sEorMe == kSE) { // Same Event + if (sorSb == kSign) { hSparse = reinterpret_cast(fDirSE->Get(fSECorrelSignalRegionName.Data())); } else if (!fSidebandDivided) { hSparse = reinterpret_cast(fDirSE->Get(fSECorrelSidebandsName.Data())); @@ -1027,12 +1035,12 @@ TH2D* DhCorrelationExtraction::GetCorrelHisto(Int_t SEorME, Int_t SorSB, Int_t p } else if (fUseSidebLeft && fUseSidebRight) { hSparse = reinterpret_cast(fDirSE->Get(fSECorrelSidebandLeftName.Data())); hSparse->SetName("hSparse"); - THnSparseD* hSparseRightSideb = reinterpret_cast(fDirSE->Get(fSECorrelSidebandRightName.Data())); + auto* hSparseRightSideb = reinterpret_cast(fDirSE->Get(fSECorrelSidebandRightName.Data())); hSparse->Add(hSparseRightSideb, 1.); } } } else { // Mixed Event - if (SorSB == kSign) { + if (sorSb == kSign) { hSparse = reinterpret_cast(fDirME->Get(fMECorrelSignalRegionName.Data())); } else if (!fSidebandDivided) { hSparse = reinterpret_cast(fDirME->Get(fMECorrelSidebandsName.Data())); @@ -1044,7 +1052,7 @@ TH2D* DhCorrelationExtraction::GetCorrelHisto(Int_t SEorME, Int_t SorSB, Int_t p } else if (fUseSidebLeft && fUseSidebRight) { hSparse = reinterpret_cast(fDirME->Get(fMECorrelSidebandLeftName.Data())); hSparse->SetName("hSparse"); - THnSparseD* hSparseRightSideb = reinterpret_cast(fDirME->Get(fMECorrelSidebandRightName.Data())); + auto* hSparseRightSideb = reinterpret_cast(fDirME->Get(fMECorrelSidebandRightName.Data())); hSparse->Add(hSparseRightSideb, 1.); } } @@ -1066,33 +1074,35 @@ TH2D* DhCorrelationExtraction::GetCorrelHisto(Int_t SEorME, Int_t SorSB, Int_t p } }*/ - Int_t binExtPtCandMin = (Int_t)hSparse->GetAxis(2)->FindBin(PtCandMin + 0.01); // axis2: ptCand, the 0.01 to avoid bin edges! - Int_t binExtPtCandMax = (Int_t)hSparse->GetAxis(2)->FindBin(PtCandMax - 0.01); - Int_t binExtPtHadMin = (Int_t)hSparse->GetAxis(3)->FindBin(PtHadMin + 0.01); // axis3: ptHad - Int_t binExtPtHadMax = (Int_t)hSparse->GetAxis(3)->FindBin(PtHadMax - 0.01); + Int_t const binExtPtCandMin = hSparse->GetAxis(2)->FindBin(ptCandMin + 0.01); // axis2: ptCand, the 0.01 to avoid bin edges! + Int_t const binExtPtCandMax = hSparse->GetAxis(2)->FindBin(ptCandMax - 0.01); + Int_t const binExtPtHadMin = hSparse->GetAxis(3)->FindBin(ptHadMin + 0.01); // axis3: ptHad + Int_t const binExtPtHadMax = hSparse->GetAxis(3)->FindBin(ptHadMax - 0.01); Int_t binExtPoolMin; Int_t binExtPoolMax; if (fCorrectPoolsSeparately) { - binExtPoolMin = (Int_t)hSparse->GetAxis(4)->FindBin(pool + 0.01); // axis4: pool bin - binExtPoolMax = (Int_t)hSparse->GetAxis(4)->FindBin(pool + 0.99); + binExtPoolMin = hSparse->GetAxis(4)->FindBin(pool + 0.01); // axis4: pool bin + binExtPoolMax = hSparse->GetAxis(4)->FindBin(pool + 0.99); } else { // merge all pools in one binExtPoolMin = 1; - binExtPoolMax = (Int_t)hSparse->GetAxis(4)->GetNbins(); + binExtPoolMax = hSparse->GetAxis(4)->GetNbins(); } // possibility to select a certain eta region - Int_t binExtEtaMin = (Int_t)hSparse->GetAxis(1)->FindBin(fDeltaEtaMin + 0.0001); - Int_t binExtEtaMax = (Int_t)hSparse->GetAxis(1)->FindBin(fDeltaEtaMax - 0.0001); - if (binExtEtaMax > hSparse->GetAxis(1)->GetNbins()) + Int_t binExtEtaMin = hSparse->GetAxis(1)->FindBin(fDeltaEtaMin + 0.0001); + Int_t binExtEtaMax = hSparse->GetAxis(1)->FindBin(fDeltaEtaMax - 0.0001); + if (binExtEtaMax > hSparse->GetAxis(1)->GetNbins()) { binExtEtaMax = hSparse->GetAxis(1)->GetNbins(); - if (binExtEtaMin < 1) + } + if (binExtEtaMin < 1) { binExtEtaMin = 1; + } hSparse->GetAxis(1)->SetRange(binExtEtaMin, binExtEtaMax); // axis1: deltaEta hSparse->GetAxis(2)->SetRange(binExtPtCandMin, binExtPtCandMax); // axis2: ptCand hSparse->GetAxis(3)->SetRange(binExtPtHadMin, binExtPtHadMax); // axis3: ptHad hSparse->GetAxis(4)->SetRange(binExtPoolMin, binExtPoolMax); // axis4: pool bin - h2D = reinterpret_cast(hSparse->Projection(0, 1)); // axis0: deltaPhi, axis1: deltaEta - if (SEorME == kSE) { // Same Event - if (SorSB == kSign) { + h2D = hSparse->Projection(0, 1); // axis0: deltaPhi, axis1: deltaEta + if (sEorMe == kSE) { // Same Event + if (sorSb == kSign) { h2D->SetName(Form("hCorr_SE_Sig_2D_PtCandBin%d_PtHadBin%d_iPool%d", binExtPtCandMin, binExtPtHadMin, pool)); } else if (!fSidebandDivided) { h2D->SetName(Form("hCorr_SE_Sideb_2D_PtCandBin%d_PtHadBin%d_iPool%d", binExtPtCandMin, binExtPtHadMin, pool)); @@ -1106,7 +1116,7 @@ TH2D* DhCorrelationExtraction::GetCorrelHisto(Int_t SEorME, Int_t SorSB, Int_t p } } } else { // Mixed Event - if (SorSB == kSign) { + if (sorSb == kSign) { h2D->SetName(Form("hCorr_ME_Sig_2D_PtCandBin%d_PtHadBin%d_iPool%d", binExtPtCandMin, binExtPtHadMin, pool)); } else if (!fSidebandDivided) { h2D->SetName(Form("hCorr_SE_Sideb_2D_PtCandBin%d_PtHadBin%d_iPool%d", binExtPtCandMin, binExtPtHadMin, pool)); @@ -1124,7 +1134,7 @@ TH2D* DhCorrelationExtraction::GetCorrelHisto(Int_t SEorME, Int_t SorSB, Int_t p return h2D; } -void DhCorrelationExtraction::GetSignalAndBackgroundForNorm(Double_t PtCandMin, Double_t PtCandMax) +void DhCorrelationExtraction::getSignalAndBackgroundForNorm(Double_t ptCandMin, Double_t ptCandMax) { // using results obtained from HFInvariantMassFitter.cxx class @@ -1134,66 +1144,67 @@ void DhCorrelationExtraction::GetSignalAndBackgroundForNorm(Double_t PtCandMin, TH1F* hMassFitSBLYield = reinterpret_cast(fFileMass->Get("hBackgroundSidebandLeft")); TH1F* hMassFitSBRYield = reinterpret_cast(fFileMass->Get("hBackgroundSidebandRight")); - Int_t PtCandBin = hMassFitSgnYield->FindBin(PtCandMin + 0.01); - if (PtCandBin != hMassFitSgnYield->FindBin(PtCandMax - 0.01)) + Int_t const ptCandBin = hMassFitSgnYield->FindBin(ptCandMin + 0.01); + if (ptCandBin != hMassFitSgnYield->FindBin(ptCandMax - 0.01)) { std::cout << "[ERROR] Pt bin in invariant mass histogram not univocally defined " << std::endl; + } - Float_t SgnYield = hMassFitSgnYield->GetBinContent(PtCandBin); - Float_t BkgYield = hMassFitBkgYield->GetBinContent(PtCandBin); - Float_t SBsYield = hMassFitSBsYield->GetBinContent(PtCandBin); - Float_t SBLYield = hMassFitSBLYield->GetBinContent(PtCandBin); - Float_t SBRYield = hMassFitSBRYield->GetBinContent(PtCandBin); + Float_t const sgnYield = hMassFitSgnYield->GetBinContent(ptCandBin); + Float_t const bkgYield = hMassFitBkgYield->GetBinContent(ptCandBin); + Float_t const sBsYield = hMassFitSBsYield->GetBinContent(ptCandBin); + Float_t const sblYield = hMassFitSBLYield->GetBinContent(ptCandBin); + Float_t const sbrYield = hMassFitSBRYield->GetBinContent(ptCandBin); std::cout << "================================= " << std::endl; std::cout << "Getting invariant mass parameters " << std::endl; - std::cout << "Pt cand " << PtCandMin << " - " << PtCandMax << std::endl; - std::cout << "Signal yield = " << SgnYield << std::endl; - std::cout << "Bkg yield = " << BkgYield << std::endl; - std::cout << "Sideband yield = " << SBsYield << std::endl; - std::cout << "Sideband left yield = " << SBLYield << std::endl; - std::cout << "Sideband right yield = " << SBRYield << std::endl; + std::cout << "Pt cand " << ptCandMin << " - " << ptCandMax << std::endl; + std::cout << "Signal yield = " << sgnYield << std::endl; + std::cout << "Bkg yield = " << bkgYield << std::endl; + std::cout << "Sideband yield = " << sBsYield << std::endl; + std::cout << "Sideband left yield = " << sblYield << std::endl; + std::cout << "Sideband right yield = " << sbrYield << std::endl; std::cout << "================================= " << std::endl; std::cout << " " << std::endl; - SetSignalYieldforNorm(SgnYield); - SetBkgYield(BkgYield); + setSignalYieldforNorm(sgnYield); + setBkgYield(bkgYield); if (fUseSidebLeft && fUseSidebRight) { - SetBkgScaleFactor(BkgYield / SBsYield); - SetSBYield(SBsYield); + setBkgScaleFactor(bkgYield / sBsYield); + setSbYield(sBsYield); } else if (fUseSidebLeft && !fUseSidebRight) { - SetBkgScaleFactor(BkgYield / SBLYield); - SetSBYield(SBLYield); + setBkgScaleFactor(bkgYield / sblYield); + setSbYield(sblYield); } else if (!fUseSidebLeft && fUseSidebRight) { - SetBkgScaleFactor(BkgYield / SBRYield); - SetSBYield(SBRYield); + setBkgScaleFactor(bkgYield / sbrYield); + setSbYield(sbrYield); } - - return; } -TH2D* DhCorrelationExtraction::GetFDTemplateHisto(Int_t PromptOrFD, Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax) +TH2D* DhCorrelationExtraction::getFdTemplateHisto(Int_t promptOrFd, Double_t ptCandMin, Double_t ptCandMax, Double_t ptHadMin, Double_t ptHadMax) { TH2D* h2D = new TH2D(); // pointer to be returned - if (PromptOrFD == kPrompt) { - h2D = reinterpret_cast(fFileFDTemplate->Get(Form("%s%.0f_%.0f_ptassoc%.0f_%.0f", fHistoFDTemplatePromptName.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax))); + if (promptOrFd == kPrompt) { + h2D = reinterpret_cast(fFileFDTemplate->Get(Form("%s%.0f_%.0f_ptassoc%.0f_%.0f", fHistoFDTemplatePromptName.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax))); } else { - h2D = reinterpret_cast(fFileFDTemplate->Get(Form("%s%.0f_%.0f_ptassoc%.0f_%.0f", fHistoFDTemplateNonPromptName.Data(), PtCandMin, PtCandMax, PtHadMin, PtHadMax))); + h2D = reinterpret_cast(fFileFDTemplate->Get(Form("%s%.0f_%.0f_ptassoc%.0f_%.0f", fHistoFDTemplateNonPromptName.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax))); } - Int_t binExtEtaMin = (Int_t)h2D->GetXaxis()->FindBin(fDeltaEtaMin + 0.000001); - Int_t binExtEtaMax = (Int_t)h2D->GetXaxis()->FindBin(fDeltaEtaMax - 0.000001); - if (binExtEtaMax > h2D->GetXaxis()->GetNbins()) + Int_t binExtEtaMin = h2D->GetXaxis()->FindBin(fDeltaEtaMin + 0.000001); + Int_t binExtEtaMax = h2D->GetXaxis()->FindBin(fDeltaEtaMax - 0.000001); + if (binExtEtaMax > h2D->GetXaxis()->GetNbins()) { binExtEtaMax = h2D->GetXaxis()->GetNbins(); - if (binExtEtaMin < 1) + } + if (binExtEtaMin < 1) { binExtEtaMin = 1; + } h2D->GetXaxis()->SetRange(binExtEtaMin, binExtEtaMax); - if (PromptOrFD == kPrompt) { - h2D->SetName(Form("hFDTemplatePrompt_2D_PtCand%.0fto%.0f_PtHad%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + if (promptOrFd == kPrompt) { + h2D->SetName(Form("hFDTemplatePrompt_2D_PtCand%.0fto%.0f_PtHad%.0fto%.0f", ptCandMin, ptCandMax, ptHadMin, ptHadMax)); } else { - h2D->SetName(Form("hFDTemplateNonPrompt_2D_PtCand%.0fto%.0f_PtHad%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + h2D->SetName(Form("hFDTemplateNonPrompt_2D_PtCand%.0fto%.0f_PtHad%.0fto%.0f", ptCandMin, ptCandMax, ptHadMin, ptHadMax)); } h2D->GetYaxis()->SetTitle("#Delta#phi (rad)"); h2D->GetXaxis()->SetTitle("#Delta#eta"); @@ -1201,61 +1212,63 @@ TH2D* DhCorrelationExtraction::GetFDTemplateHisto(Int_t PromptOrFD, Double_t PtC return h2D; } -TH1D* DhCorrelationExtraction::GetCorrelHistoSecondaryPart(Int_t PartType, Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax) +TH1D* DhCorrelationExtraction::getCorrelHistoSecondaryPart(Int_t partType, Double_t ptCandMin, Double_t ptCandMax, Double_t ptHadMin, Double_t ptHadMax) { TH1D* h1D = new TH1D(); // pointer to be returned - THnSparseD* hSparse = 0x0; + THnSparseD* hSparse = nullptr; - if (PartType == kPrimaryPart) { // primary particles + if (partType == kPrimaryPart) { // primary particles hSparse = reinterpret_cast(fDirSecPart->Get(fHistoPrimaryPartName.Data())); } else { // all selected particles hSparse = reinterpret_cast(fDirSecPart->Get(fHistoAllPartName.Data())); } - Int_t binExtPtCandMin = (Int_t)hSparse->GetAxis(2)->FindBin(PtCandMin + 0.01); // axis2: ptCand, the 0.01 to avoid bin edges! - Int_t binExtPtCandMax = (Int_t)hSparse->GetAxis(2)->FindBin(PtCandMax - 0.01); - Int_t binExtPtHadMin = (Int_t)hSparse->GetAxis(3)->FindBin(PtHadMin + 0.01); // axis3: ptHad - Int_t binExtPtHadMax = (Int_t)hSparse->GetAxis(3)->FindBin(PtHadMax - 0.01); + Int_t const binExtPtCandMin = hSparse->GetAxis(2)->FindBin(ptCandMin + 0.01); // axis2: ptCand, the 0.01 to avoid bin edges! + Int_t const binExtPtCandMax = hSparse->GetAxis(2)->FindBin(ptCandMax - 0.01); + Int_t const binExtPtHadMin = hSparse->GetAxis(3)->FindBin(ptHadMin + 0.01); // axis3: ptHad + Int_t const binExtPtHadMax = hSparse->GetAxis(3)->FindBin(ptHadMax - 0.01); Int_t binExtPoolMin; Int_t binExtPoolMax; - if (PartType == kAllPart) { + if (partType == kAllPart) { binExtPoolMin = 1; - binExtPoolMax = (Int_t)hSparse->GetAxis(4)->GetNbins(); + binExtPoolMax = hSparse->GetAxis(4)->GetNbins(); } // possibility to select a certain eta region - Int_t binExtEtaMin = (Int_t)hSparse->GetAxis(1)->FindBin(fDeltaEtaMin + 0.0001); - Int_t binExtEtaMax = (Int_t)hSparse->GetAxis(1)->FindBin(fDeltaEtaMax - 0.0001); - if (binExtEtaMax > hSparse->GetAxis(1)->GetNbins()) + Int_t binExtEtaMin = hSparse->GetAxis(1)->FindBin(fDeltaEtaMin + 0.0001); + Int_t binExtEtaMax = hSparse->GetAxis(1)->FindBin(fDeltaEtaMax - 0.0001); + if (binExtEtaMax > hSparse->GetAxis(1)->GetNbins()) { binExtEtaMax = hSparse->GetAxis(1)->GetNbins(); - if (binExtEtaMin < 1) + } + if (binExtEtaMin < 1) { binExtEtaMin = 1; + } hSparse->GetAxis(1)->SetRange(binExtEtaMin, binExtEtaMax); // axis1: deltaEta hSparse->GetAxis(2)->SetRange(binExtPtCandMin, binExtPtCandMax); // axis2: ptCand hSparse->GetAxis(3)->SetRange(binExtPtHadMin, binExtPtHadMax); // axis3: ptHad - if (PartType == kAllPart) { + if (partType == kAllPart) { hSparse->GetAxis(4)->SetRange(binExtPoolMin, binExtPoolMax); // axis4: pool bin } - h1D = reinterpret_cast(hSparse->Projection(0)); // axis0: deltaPhi - if (PartType == kPrimaryPart) { // primary particles - h1D->SetName(Form("hPrimaryPartCorr_PtD%.0fto%.0f_PtHad%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + h1D = hSparse->Projection(0); // axis0: deltaPhi + if (partType == kPrimaryPart) { // primary particles + h1D->SetName(Form("hPrimaryPartCorr_PtD%.0fto%.0f_PtHad%.0fto%.0f", ptCandMin, ptCandMax, ptHadMin, ptHadMax)); } else { // all selected particles - h1D->SetName(Form("hAllPartCorr_PtD%.0fto%.0f_PtHad%.0fto%.0f", PtCandMin, PtCandMax, PtHadMin, PtHadMax)); + h1D->SetName(Form("hAllPartCorr_PtD%.0fto%.0f_PtHad%.0fto%.0f", ptCandMin, ptCandMax, ptHadMin, ptHadMax)); } return h1D; } -TH1D* DhCorrelationExtraction::ReflectCorrHistogram(TH1D*& histo) +TH1D* DhCorrelationExtraction::reflectCorrHistogram(TH1D*& histo) { // nBinsPhi must be a multple of 4 in order to reflect correcty the histogram - Int_t nBinsPhi = histo->GetNbinsX(); - Int_t nBinsPhiRefl = nBinsPhi / 2; - Int_t bin0Phi = nBinsPhi / 4 + 1; - Int_t binPiPhi = 3 * nBinsPhi / 4; + Int_t const nBinsPhi = histo->GetNbinsX(); + Int_t const nBinsPhiRefl = nBinsPhi / 2; + Int_t const bin0Phi = nBinsPhi / 4 + 1; + Int_t const binPiPhi = 3 * nBinsPhi / 4; TH1D* h1D = new TH1D("h1D_Reflected", "", nBinsPhiRefl, 0., TMath::Pi()); // pointer to be returned h1D->Sumw2(); @@ -1284,14 +1297,14 @@ TH1D* DhCorrelationExtraction::ReflectCorrHistogram(TH1D*& histo) return h1D; } -TH1D* DhCorrelationExtraction::ReflectHistoRun2(TH1D* h, Double_t scale) +TH1D* DhCorrelationExtraction::reflectHistoRun2(TH1D* h, Double_t scale) { TH1D* h2 = new TH1D(Form("%sReflected", h->GetName()), Form("%sReflected", h->GetName()), h->GetNbinsX() / 2., 0., TMath::Pi()); for (Int_t j = 1; j <= h->GetNbinsX(); j++) { - Double_t x = h->GetBinCenter(j); - Double_t y0 = h->GetBinContent(j); - Double_t ey0 = h->GetBinError(j); + Double_t const x = h->GetBinCenter(j); + Double_t const y0 = h->GetBinContent(j); + Double_t const ey0 = h->GetBinError(j); Int_t j2; if (x > 0 && x < TMath::Pi()) { j2 = h2->FindBin(x); @@ -1303,8 +1316,8 @@ TH1D* DhCorrelationExtraction::ReflectHistoRun2(TH1D* h, Double_t scale) printf("Point %d excluded \n", j); continue; } - Double_t y = h2->GetBinContent(j2); - Double_t ey = h2->GetBinError(j2); + Double_t const y = h2->GetBinContent(j2); + Double_t const ey = h2->GetBinError(j2); h2->SetBinContent(j2, (y + y0)); h2->SetBinError(j2, TMath::Sqrt(ey0 * ey0 + ey * ey)); } @@ -1313,30 +1326,30 @@ TH1D* DhCorrelationExtraction::ReflectHistoRun2(TH1D* h, Double_t scale) return h2; } -Double_t DhCorrelationExtraction::GetFDPromptFrac(Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax) +Double_t DhCorrelationExtraction::getFdPromptFrac(Double_t ptCandMin, Double_t ptCandMax, Double_t /*ptHadMin*/, Double_t /*ptHadMax*/) { TH1D* h1D = new TH1D(); h1D = reinterpret_cast(fFileFDPromptFrac->Get(fHistoFDPromptFracName.Data())); - Int_t binPtCandMin = h1D->GetXaxis()->FindBin(PtCandMin + 0.01); - Int_t binPtCandMax = h1D->GetXaxis()->FindBin(PtCandMax - 0.01); - Double_t PromptFraction; + Int_t const binPtCandMin = h1D->GetXaxis()->FindBin(ptCandMin + 0.01); + Int_t const binPtCandMax = h1D->GetXaxis()->FindBin(ptCandMax - 0.01); + Double_t promptFraction; if (binPtCandMin == binPtCandMax) { - PromptFraction = h1D->GetBinContent(binPtCandMin); + promptFraction = h1D->GetBinContent(binPtCandMin); } else { std::cout << "[ERROR] Different bin obtained from PtCandMin and PtCandMax"; return 0.; } - return PromptFraction; + return promptFraction; } -void DhCorrelationExtraction::NormalizeMEplot(TH2D*& histoME, TH2D*& histoMEsoftPi) +void DhCorrelationExtraction::normalizeMePlot(TH2D*& histoME, TH2D*& histoMEsoftPi) const { - Int_t bin0phi = histoME->GetYaxis()->FindBin(0.); - Int_t bin0eta = histoME->GetXaxis()->FindBin(0.); + Int_t const bin0phi = histoME->GetYaxis()->FindBin(0.); + Int_t const bin0eta = histoME->GetXaxis()->FindBin(0.); // evaluate the normalization (from ALL tracks, including possible fake softpions) -> **histoME indeed includes bin1+bin2 of THnSparse, i.e. all the tracks** Double_t factorNorm = 0; @@ -1353,27 +1366,26 @@ void DhCorrelationExtraction::NormalizeMEplot(TH2D*& histoME, TH2D*& histoMEsoft std::cout << "Factor norm. ME: " << factorNorm << std::endl; std::cout << "Bin content (0,0) ME: " << histoME->GetBinContent(bin0eta, bin0phi) << std::endl; - if (fSubtractSoftPiME) + if (fSubtractSoftPiME) { histoME->Add(histoMEsoftPi, -1); // remove the tracks compatible with soft pion (if requested) + } // apply the normalization histoME->Scale(1. / factorNorm); - - return; } -Double_t DhCorrelationExtraction::CalculateBaseline(TH1D*& histo, Bool_t totalRange, Bool_t reflected) +Double_t DhCorrelationExtraction::calculateBaseline(TH1D*& histo, Bool_t totalRange, Bool_t reflected) { // total range = 2*Pi // half range = Pi , for histogram reflected under symmetric assumption Double_t baseline, errBaseline; - Int_t nBinsPhi = histo->GetNbinsX(); - Int_t binPhiHalf = nBinsPhi / 2; - Int_t binPhiHalfMinus1 = nBinsPhi / 2 - 1; - Int_t binPhiHalfPlus1 = nBinsPhi / 2 + 1; - Int_t binPhiHalfPlus2 = nBinsPhi / 2 + 1; + Int_t const nBinsPhi = histo->GetNbinsX(); + Int_t const binPhiHalf = nBinsPhi / 2; + Int_t const binPhiHalfMinus1 = nBinsPhi / 2 - 1; + Int_t const binPhiHalfPlus1 = nBinsPhi / 2 + 1; + Int_t const binPhiHalfPlus2 = nBinsPhi / 2 + 1; if (totalRange) { // baseline evaluated considering: the two first points, the last two points and four points in the middle (corresponding to the outer points) @@ -1442,18 +1454,18 @@ Double_t DhCorrelationExtraction::CalculateBaseline(TH1D*& histo, Bool_t totalRa return baseline; } -Double_t DhCorrelationExtraction::CalculateBaselineError(TH1D*& histo, Bool_t totalRange, Bool_t reflected) +Double_t DhCorrelationExtraction::calculateBaselineError(TH1D*& histo, Bool_t totalRange, Bool_t reflected) { // total range = 2*Pi // half range = Pi , for histogram reflected under symmetric assumption Double_t errBaseline; - Int_t nBinsPhi = histo->GetNbinsX(); - Int_t binPhiHalf = nBinsPhi / 2; - Int_t binPhiHalfMinus1 = nBinsPhi / 2 - 1; - Int_t binPhiHalfPlus1 = nBinsPhi / 2 + 1; - Int_t binPhiHalfPlus2 = nBinsPhi / 2 + 1; + Int_t const nBinsPhi = histo->GetNbinsX(); + Int_t const binPhiHalf = nBinsPhi / 2; + Int_t const binPhiHalfMinus1 = nBinsPhi / 2 - 1; + Int_t const binPhiHalfPlus1 = nBinsPhi / 2 + 1; + Int_t const binPhiHalfPlus2 = nBinsPhi / 2 + 1; if (totalRange) { // baseline evaluated considering: the two first points, the last two points and four points in the middle (corresponding to the outer points) @@ -1500,7 +1512,7 @@ Double_t DhCorrelationExtraction::CalculateBaselineError(TH1D*& histo, Bool_t to return errBaseline; } -void DhCorrelationExtraction::SetTH1HistoStyle(TH1D*& histo, TString hTitle, TString hXaxisTitle, TString hYaxisTitle, +void DhCorrelationExtraction::setTH1HistoStyle(TH1D*& histo, TString hTitle, TString hXaxisTitle, TString hYaxisTitle, Style_t markerStyle, Color_t markerColor, Double_t markerSize, Color_t lineColor, Int_t lineWidth, Float_t hTitleXaxisOffset, Float_t hTitleYaxisOffset, Float_t hTitleXaxisSize, Float_t hTitleYaxisSize, Float_t hLabelXaxisSize, Float_t hLabelYaxisSize, @@ -1523,11 +1535,9 @@ void DhCorrelationExtraction::SetTH1HistoStyle(TH1D*& histo, TString hTitle, TSt histo->GetYaxis()->SetLabelSize(hLabelYaxisSize); histo->GetXaxis()->CenterTitle(centerXaxisTitle); histo->GetYaxis()->CenterTitle(centerYaxisTitle); - - return; } -void DhCorrelationExtraction::SetTH2HistoStyle(TH2D*& histo, TString hTitle, TString hXaxisTitle, TString hYaxisTitle, TString hZaxisTitle, +void DhCorrelationExtraction::setTH2HistoStyle(TH2D*& histo, TString hTitle, TString hXaxisTitle, TString hYaxisTitle, TString hZaxisTitle, Float_t hTitleXaxisOffset, Float_t hTitleYaxisOffset, Float_t hTitleZaxisOffset, Float_t hTitleXaxisSize, Float_t hTitleYaxisSize, Float_t hTitleZaxisSize, Float_t hLabelXaxisSize, Float_t hLabelYaxisSize, Float_t hLabelZaxisSize, @@ -1549,6 +1559,4 @@ void DhCorrelationExtraction::SetTH2HistoStyle(TH2D*& histo, TString hTitle, TSt histo->GetZaxis()->SetLabelSize(hLabelZaxisSize); histo->GetXaxis()->CenterTitle(centerXaxisTitle); histo->GetYaxis()->CenterTitle(centerYaxisTitle); - - return; } diff --git a/PWGHF/HFC/Macros/DhCorrelationExtraction.h b/PWGHF/HFC/Macros/DhCorrelationExtraction.h index 52508ea3bb9..aa3f2a52874 100644 --- a/PWGHF/HFC/Macros/DhCorrelationExtraction.h +++ b/PWGHF/HFC/Macros/DhCorrelationExtraction.h @@ -37,121 +37,121 @@ class DhCorrelationExtraction : public TObject kDplusKpipi, kDsToKKPi, kDStarD0pi }; - enum selectAnalysisType { kSE, + enum SelectAnalysisType { kSE, kME }; - enum selectInvMassRegion { kSign, + enum SelectInvMassRegion { kSign, kSideb }; - enum selectDmesonOrigin { kPrompt, + enum SelectDmesonOrigin { kPrompt, kFD }; - enum selectParticleType { kPrimaryPart, + enum SelectParticleType { kPrimaryPart, kAllPart }; DhCorrelationExtraction(); // default constructor DhCorrelationExtraction(const DhCorrelationExtraction& source); - virtual ~DhCorrelationExtraction(); + ~DhCorrelationExtraction() override; /// Methods to set the input configuration // Input files, directories and histograms - Bool_t SetDmesonSpecie(DmesonSpecie k); - void SetInputFilenameMass(TString filenameMass) { fFileNameMass = filenameMass; } - void SetInputFilenameSE(TString filenameSE) { fFileNameSE = filenameSE; } - void SetInputFilenameME(TString filenameME) { fFileNameME = filenameME; } - void SetInputFilenameSecPart(TString filenameSecPart) { fFileSecPartName = filenameSecPart; } - void SetInputFilenameBiasBtoD(TString filenamePromptMcRec, TString filenameNonPromptMcRec) + Bool_t setDmesonSpecie(DmesonSpecie k); + void setInputFilenameMass(TString filenameMass) { fFileNameMass = filenameMass; } + void setInputFilenameSe(TString filenameSE) { fFileNameSE = filenameSE; } + void setInputFilenameMe(TString filenameME) { fFileNameME = filenameME; } + void setInputFilenameSecPart(TString filenameSecPart) { fFileSecPartName = filenameSecPart; } + void setInputFilenameBiasBtoD(TString filenamePromptMcRec, TString filenameNonPromptMcRec) { fFilePromptMcRecName = filenamePromptMcRec; fFileNonPromptMcRecName = filenameNonPromptMcRec; } - void SetDirNameSE(TString dirNameSE) { fDirNameSE = dirNameSE; } - void SetDirNameME(TString dirNameME) { fDirNameME = dirNameME; } - void SetDirNameSecPart(TString dirNameSecPart) { fDirSecPartName = dirNameSecPart; } - void SetMassHistoNameSgn(TString massHistoNameSgn) { fMassHistoNameSgn = massHistoNameSgn; } - void SetMassHistoNameBkg(TString massHistoNameBkg) { fMassHistoNameBkg = massHistoNameBkg; } - void SetMassHistoNameSBs(TString massHistoNameSBs) { fMassHistoNameSBs = massHistoNameSBs; } - void SetSECorrelHistoSignalName(TString correlNameSigSE) { fSECorrelSignalRegionName = correlNameSigSE; } - void SetSECorrelHistoSidebandName(TString correlNameSbSE) { fSECorrelSidebandsName = correlNameSbSE; } - void SetSECorrelHistoSidebandLeftName(TString correlNameSbSE) { fSECorrelSidebandLeftName = correlNameSbSE; } - void SetSECorrelHistoSidebandRightName(TString correlNameSbSE) { fSECorrelSidebandRightName = correlNameSbSE; } - void SetMECorrelHistoSignalName(TString correlNameSigME) { fMECorrelSignalRegionName = correlNameSigME; } - void SetMECorrelHistoSidebandName(TString correlNameSbME) { fMECorrelSidebandsName = correlNameSbME; } - void SetMECorrelHistoSidebandLeftName(TString correlNameSbME) { fMECorrelSidebandLeftName = correlNameSbME; } - void SetMECorrelHistoSidebandRightName(TString correlNameSbME) { fMECorrelSidebandRightName = correlNameSbME; } - void SetHistoSecPartName(TString histoPrimaryPartName, TString histoAllPartName) + void setDirNameSe(TString dirNameSE) { fDirNameSE = dirNameSE; } + void setDirNameMe(TString dirNameME) { fDirNameME = dirNameME; } + void setDirNameSecPart(TString dirNameSecPart) { fDirSecPartName = dirNameSecPart; } + void setMassHistoNameSgn(TString massHistoNameSgn) { fMassHistoNameSgn = massHistoNameSgn; } + void setMassHistoNameBkg(TString massHistoNameBkg) { fMassHistoNameBkg = massHistoNameBkg; } + void setMassHistoNameSBs(TString massHistoNameSBs) { fMassHistoNameSBs = massHistoNameSBs; } + void setSeCorrelHistoSignalName(TString correlNameSigSE) { fSECorrelSignalRegionName = correlNameSigSE; } + void setSeCorrelHistoSidebandName(TString correlNameSbSE) { fSECorrelSidebandsName = correlNameSbSE; } + void setSeCorrelHistoSidebandLeftName(TString correlNameSbSE) { fSECorrelSidebandLeftName = correlNameSbSE; } + void setSeCorrelHistoSidebandRightName(TString correlNameSbSE) { fSECorrelSidebandRightName = correlNameSbSE; } + void setMeCorrelHistoSignalName(TString correlNameSigME) { fMECorrelSignalRegionName = correlNameSigME; } + void setMeCorrelHistoSidebandName(TString correlNameSbME) { fMECorrelSidebandsName = correlNameSbME; } + void setMeCorrelHistoSidebandLeftName(TString correlNameSbME) { fMECorrelSidebandLeftName = correlNameSbME; } + void setMeCorrelHistoSidebandRightName(TString correlNameSbME) { fMECorrelSidebandRightName = correlNameSbME; } + void setHistoSecPartName(TString histoPrimaryPartName, TString histoAllPartName) { fHistoPrimaryPartName = histoPrimaryPartName; fHistoAllPartName = histoAllPartName; } - void SetInputFilenameFDTemplate(TString filenameFDTemplate) { fFileFDTemplateName = filenameFDTemplate; } - void SetInputFilenameFDPromptFrac(TString filenameFDPromptFrac) { fFileFDPromptFracName = filenameFDPromptFrac; } - void SetInputHistoNameFDTemplatePrompt(TString hNameFDTemplatePrompt) { fHistoFDTemplatePromptName = hNameFDTemplatePrompt; } - void SetInputHistoNameFDTemplateNonPrompt(TString hNameFDTemplateNonPrompt) { fHistoFDTemplateNonPromptName = hNameFDTemplateNonPrompt; } - void SetInputHistoNameFDPromptFrac(TString hNameFDPromptFrac) { fHistoFDPromptFracName = hNameFDPromptFrac; } + void setInputFilenameFdTemplate(TString filenameFDTemplate) { fFileFDTemplateName = filenameFDTemplate; } + void setInputFilenameFdPromptFrac(TString filenameFDPromptFrac) { fFileFDPromptFracName = filenameFDPromptFrac; } + void setInputHistoNameFdTemplatePrompt(TString hNameFDTemplatePrompt) { fHistoFDTemplatePromptName = hNameFDTemplatePrompt; } + void setInputHistoNameFdTemplateNonPrompt(TString hNameFDTemplateNonPrompt) { fHistoFDTemplateNonPromptName = hNameFDTemplateNonPrompt; } + void setInputHistoNameFdPromptFrac(TString hNameFDPromptFrac) { fHistoFDPromptFracName = hNameFDPromptFrac; } // Input conditions: PtCand, PtHad, PoolBins - void SetNpools(Int_t npools) { fNpools = npools; } - void SetCorrectPoolsSeparately(Bool_t usePools) { fCorrectPoolsSeparately = usePools; } - void SetDeltaEtaRange(Double_t etaLow = -1., Double_t etaHigh = 1) + void setNpools(Int_t npools) { fNpools = npools; } + void setCorrectPoolsSeparately(Bool_t usePools) { fCorrectPoolsSeparately = usePools; } + void setDeltaEtaRange(Double_t etaLow = -1., Double_t etaHigh = 1) { fDeltaEtaMin = etaLow; fDeltaEtaMax = etaHigh; } - void SetSubtractSoftPiInMEdistr(Bool_t subtractSoftPiME) { fSubtractSoftPiME = subtractSoftPiME; } - void SetBkgScaleFactor(Double_t scaleFactor) { fBkgScaleFactor = scaleFactor; } - void SetSignalYieldforNorm(Double_t sgnYield) { fSgnYieldNorm = sgnYield; } - void SetBkgYield(Double_t bkgYield) { fBkgYield = bkgYield; } - void SetSBYield(Double_t SBYield) { fSBYield = SBYield; } - void SetRebin2DcorrelHisto(Int_t rebinDeltaEta, Int_t rebinDeltaPhi) + void setSubtractSoftPiInMEdistr(Bool_t subtractSoftPiME) { fSubtractSoftPiME = subtractSoftPiME; } + void setBkgScaleFactor(Double_t scaleFactor) { fBkgScaleFactor = scaleFactor; } + void setSignalYieldforNorm(Double_t sgnYield) { fSgnYieldNorm = sgnYield; } + void setBkgYield(Double_t bkgYield) { fBkgYield = bkgYield; } + void setSbYield(Double_t sbYield) { fSBYield = sbYield; } + void setRebin2DcorrelHisto(Int_t rebinDeltaEta, Int_t rebinDeltaPhi) { fRebinAxisDeltaEta = rebinDeltaEta; fRebinAxisDeltaPhi = rebinDeltaPhi; } - void SetRebinOptions(Bool_t rebinAngCorr, Bool_t rebinFDCorr, Bool_t rebinSecPart) + void setRebinOptions(Bool_t rebinAngCorr, Bool_t rebinFDCorr, Bool_t rebinSecPart) { fRebinAngCorr = rebinAngCorr; fRebinFDCorr = rebinFDCorr; fRebinSecPart = rebinSecPart; } - void GetSignalAndBackgroundForNorm(Double_t PtCandMin, Double_t PtCandMax); - void NormalizeMEplot(TH2D*& histoME, TH2D*& histoMEsoftPi); - void SetDebugLevel(Int_t debug) { fDebug = debug; } - void SetDividedSidebands(Bool_t dividedSideb, Bool_t useSidebLeft, Bool_t useSidebRight) + void getSignalAndBackgroundForNorm(Double_t ptCandMin, Double_t ptCandMax); + void normalizeMePlot(TH2D*& histoME, TH2D*& histoMEsoftPi) const; + void setDebugLevel(Int_t debug) { fDebug = debug; } + void setDividedSidebands(Bool_t dividedSideb, Bool_t useSidebLeft, Bool_t useSidebRight) { fSidebandDivided = dividedSideb; fUseSidebLeft = useSidebLeft; fUseSidebRight = useSidebRight; } - void SetFDSubtraction(Bool_t subtractFD) { fFDsubtraction = subtractFD; } - void SetSecPartContamination(Bool_t secPartContamination) { fSecPartContamination = secPartContamination; } - void SetCorrBiasBtoD(Bool_t corrbiasBtoD) { fCorrBiasBtoD = corrbiasBtoD; } - void SetBinCandAndHad(Int_t binCand, Int_t binHad) + void setFdSubtraction(Bool_t subtractFD) { fFDsubtraction = subtractFD; } + void setSecPartContamination(Bool_t secPartContamination) { fSecPartContamination = secPartContamination; } + void setCorrBiasBtoD(Bool_t corrbiasBtoD) { fCorrBiasBtoD = corrbiasBtoD; } + void setBinCandAndHad(Int_t binCand, Int_t binHad) { fBinPtCand = binCand; fBinPtHad = binHad; } /// Analysis methods - TH2D* GetCorrelHisto(Int_t SEorME, Int_t SorSB, Int_t pool, Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax); - TH2D* GetFDTemplateHisto(Int_t PromptOrFD, Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax); - TH1D* GetCorrelHistoSecondaryPart(Int_t PrimaryPart, Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax); - TH1D* ReflectCorrHistogram(TH1D*& histo); - TH1D* ReflectHistoRun2(TH1D* h, Double_t scale); - TH1D* EvaluateMCClosModulations(Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax); - Double_t GetFDPromptFrac(Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax); - Double_t CalculateBaseline(TH1D*& histo, Bool_t totalRange = kTRUE, Bool_t reflected = kFALSE); - Double_t CalculateBaselineError(TH1D*& histo, Bool_t totalRange = kTRUE, Bool_t reflected = kFALSE); - Bool_t ReadInputSEandME(); - Bool_t ReadInputInvMass(); - Bool_t ReadInputFDSubtr(); - Bool_t ReadInputSecondaryPartContamination(); - Bool_t ExtractCorrelations(Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax, TString codeName); - TH1D* GetCorrectedCorrHisto() { return fCorrectedCorrHisto; } - TH1D* GetCorrectedCorrHisto_BaselineSubtr() { return fCorrectedCorrHisto_BaselineSubtr; } - TH1D* GetCorrectedCorrHisto_Reflected() { return fCorrectedCorrHisto_Reflected; } - TH1D* GetCorrectedCorrHisto_Reflected_BaselineSubtr() { return fCorrectedCorrHisto_Reflected_BaselineSubtr; } + TH2D* getCorrelHisto(Int_t sEorMe, Int_t sorSb, Int_t pool, Double_t ptCandMin, Double_t ptCandMax, Double_t ptHadMin, Double_t ptHadMax); + TH2D* getFdTemplateHisto(Int_t promptOrFd, Double_t ptCandMin, Double_t ptCandMax, Double_t ptHadMin, Double_t ptHadMax); + TH1D* getCorrelHistoSecondaryPart(Int_t primaryPart, Double_t ptCandMin, Double_t ptCandMax, Double_t ptHadMin, Double_t ptHadMax); + TH1D* reflectCorrHistogram(TH1D*& histo); + TH1D* reflectHistoRun2(TH1D* h, Double_t scale); + TH1D* evaluateMcClosModulations(Double_t ptCandMin, Double_t ptCandMax, Double_t ptHadMin, Double_t ptHadMax); + Double_t getFdPromptFrac(Double_t ptCandMin, Double_t ptCandMax, Double_t ptHadMin, Double_t ptHadMax); + Double_t calculateBaseline(TH1D*& histo, Bool_t totalRange = kTRUE, Bool_t reflected = kFALSE); + Double_t calculateBaselineError(TH1D*& histo, Bool_t totalRange = kTRUE, Bool_t reflected = kFALSE); + Bool_t readInputSeAndMe(); + Bool_t readInputInvMass(); + Bool_t readInputFdSubtr(); + Bool_t readInputSecondaryPartContamination(); + Bool_t extractCorrelations(Double_t ptCandMin, Double_t ptCandMax, Double_t ptHadMin, Double_t ptHadMax, TString codeName); + TH1D* getCorrectedCorrHisto() { return fCorrectedCorrHisto; } + TH1D* getCorrectedCorrHistoBaselineSubtr() { return fCorrectedCorrHistoBaselineSubtr; } + TH1D* getCorrectedCorrHistoReflected() { return fCorrectedCorrHistoReflected; } + TH1D* getCorrectedCorrHistoReflectedBaselineSubtr() { return fCorrectedCorrHistoReflectedBaselineSubtr; } /// Histogram style - void SetTH1HistoStyle(TH1D*& histo, TString hTitle, TString hXaxisTitle, TString hYaxisTitle, Style_t markerStyle = kFullCircle, Color_t markerColor = kRed + 1, Double_t markerSize = 1.4, Color_t lineColor = kRed + 1, Int_t lineWidth = 3, Float_t hTitleXaxisOffset = 1.0, Float_t hTitleYaxisOffset = 1.0, Float_t hTitleXaxisSize = 0.060, Float_t hTitleYaxisSize = 0.060, Float_t hLabelXaxisSize = 0.060, Float_t hLabelYaxisSize = 0.060, Bool_t centerXaxisTitle = false, Bool_t centerYaxisTitle = false); - void SetTH2HistoStyle(TH2D*& histo, TString hTitle, TString hXaxisTitle, TString hYaxisTitle, TString hZaxisTitle, Float_t hTitleXaxisOffset = 1.8, Float_t hTitleYaxisOffset = 1.8, Float_t hTitleZaxisOffset = 1.2, Float_t hTitleXaxisSize = 0.060, Float_t hTitleYaxisSize = 0.060, Float_t hTitleZaxisSize = 0.060, Float_t hLabelXaxisSize = 0.060, Float_t hLabelYaxisSize = 0.060, Float_t hLabelZaxisSize = 0.060, Bool_t centerXaxisTitle = true, Bool_t centerYaxisTitle = true); + void setTH1HistoStyle(TH1D*& histo, TString hTitle, TString hXaxisTitle, TString hYaxisTitle, Style_t markerStyle = kFullCircle, Color_t markerColor = kRed + 1, Double_t markerSize = 1.4, Color_t lineColor = kRed + 1, Int_t lineWidth = 3, Float_t hTitleXaxisOffset = 1.0, Float_t hTitleYaxisOffset = 1.0, Float_t hTitleXaxisSize = 0.060, Float_t hTitleYaxisSize = 0.060, Float_t hLabelXaxisSize = 0.060, Float_t hLabelYaxisSize = 0.060, Bool_t centerXaxisTitle = false, Bool_t centerYaxisTitle = false); + void setTH2HistoStyle(TH2D*& histo, TString hTitle, TString hXaxisTitle, TString hYaxisTitle, TString hZaxisTitle, Float_t hTitleXaxisOffset = 1.8, Float_t hTitleYaxisOffset = 1.8, Float_t hTitleZaxisOffset = 1.2, Float_t hTitleXaxisSize = 0.060, Float_t hTitleYaxisSize = 0.060, Float_t hTitleZaxisSize = 0.060, Float_t hLabelXaxisSize = 0.060, Float_t hLabelYaxisSize = 0.060, Float_t hLabelZaxisSize = 0.060, Bool_t centerXaxisTitle = true, Bool_t centerYaxisTitle = true); private: TFile* fFileMass; // File containing the mass histograms @@ -168,10 +168,10 @@ class DhCorrelationExtraction : public TObject TDirectoryFile* fDirME; // TDirectory for ME info TDirectoryFile* fDirSecPart; // TDirectory for seondary particle correction - TH1D* fCorrectedCorrHisto; // Corrected correlation histogram - TH1D* fCorrectedCorrHisto_BaselineSubtr; // Corrected correlation histogram with baseline subtracion - TH1D* fCorrectedCorrHisto_Reflected; // Corrected correlation histogram relected in azimuth - TH1D* fCorrectedCorrHisto_Reflected_BaselineSubtr; // Corrected correlation histogram reflected in azimuth with baseline subtraction + TH1D* fCorrectedCorrHisto; // Corrected correlation histogram + TH1D* fCorrectedCorrHistoBaselineSubtr; // Corrected correlation histogram with baseline subtracion + TH1D* fCorrectedCorrHistoReflected; // Corrected correlation histogram relected in azimuth + TH1D* fCorrectedCorrHistoReflectedBaselineSubtr; // Corrected correlation histogram reflected in azimuth with baseline subtraction DmesonSpecie fDmesonSpecies; // D meson specie TString fDmesonLabel; // D meson label diff --git a/PWGHF/HFC/Macros/DhCorrelationFitter.cxx b/PWGHF/HFC/Macros/DhCorrelationFitter.cxx index 683ae0cc04a..a69a1ab4a2e 100644 --- a/PWGHF/HFC/Macros/DhCorrelationFitter.cxx +++ b/PWGHF/HFC/Macros/DhCorrelationFitter.cxx @@ -47,24 +47,24 @@ DhCorrelationFitter::DhCorrelationFitter() : // default constructor fMinAssoPt(0.), fMaxAssoPt(99.), fNpars(0), - fExtParsVals(0x0), - fExtParsLowBounds(0x0), - fExtParsUppBounds(0x0), + fExtParsVals(nullptr), + fExtParsLowBounds(nullptr), + fExtParsUppBounds(nullptr), fUseExternalPars(kFALSE), fShiftBaselineUp(kFALSE), fShiftBaselineDown(kFALSE), fIsTotal(kTRUE), fNbasleinePoints(0), - fBinsBaseline(0x0), - fHist(0x0), + fBinsBaseline(nullptr), + fHist(nullptr), fMinCorr(0), fMaxCorr(0), fBaseline(0.), fErrBaseline(0.), - fFit(0x0), - fGausNS(0x0), - fGausAS(0x0), - fPed(0x0), + fFit(nullptr), + fGausNS(nullptr), + fGausAS(nullptr), + fPed(nullptr), fv2AssocPart(0.), fv2Dmeson(0.), fNSyieldBinCount(0.), @@ -84,25 +84,25 @@ DhCorrelationFitter::DhCorrelationFitter(TH1F* histoToFit, Double_t min, Double_ fMinAssoPt(0.), fMaxAssoPt(99.), fNpars(0), - fExtParsVals(0x0), - fExtParsLowBounds(0x0), - fExtParsUppBounds(0x0), + fExtParsVals(nullptr), + fExtParsLowBounds(nullptr), + fExtParsUppBounds(nullptr), fUseExternalPars(kFALSE), fShiftBaselineUp(kFALSE), fShiftBaselineDown(kFALSE), fIsTotal(kTRUE), fNbasleinePoints(0), - fBinsBaseline(0x0), - fHist(0x0), + fBinsBaseline(nullptr), + fHist(nullptr), fMinCorr(0.), fMaxCorr(0.), fBaseline(0.), fErrBaseline(0.), - fFit(0x0), - fGausNS(0x0), - fGausAS(0x0), - fPed(0x0), - fBaseTransvReg(0x0), + fFit(nullptr), + fGausNS(nullptr), + fGausAS(nullptr), + fPed(nullptr), + fBaseTransvReg(nullptr), fv2AssocPart(0.), fv2Dmeson(0.), fNSyieldBinCount(0.), @@ -115,73 +115,40 @@ DhCorrelationFitter::DhCorrelationFitter(TH1F* histoToFit, Double_t min, Double_ fMaxCorr = max; } -DhCorrelationFitter::DhCorrelationFitter(const DhCorrelationFitter& source) : // copy constructor - fIsReflected(source.fIsReflected), - fTypeOfFitFunc(source.fTypeOfFitFunc), - fFixBase(source.fFixBase), - fFixMean(source.fFixMean), - fMinCandPt(source.fMinCandPt), - fMaxCandPt(source.fMaxCandPt), - fMinAssoPt(source.fMinAssoPt), - fMaxAssoPt(source.fMaxAssoPt), - fNpars(source.fNpars), - fExtParsVals(source.fExtParsVals), - fExtParsLowBounds(source.fExtParsLowBounds), - fExtParsUppBounds(source.fExtParsUppBounds), - fUseExternalPars(source.fUseExternalPars), - fShiftBaselineUp(source.fShiftBaselineUp), - fShiftBaselineDown(source.fShiftBaselineDown), - fIsTotal(source.fIsTotal), - fNbasleinePoints(source.fNbasleinePoints), - fBinsBaseline(source.fBinsBaseline), - fHist(source.fHist), - fMinCorr(source.fMinCorr), - fMaxCorr(source.fMaxCorr), - fBaseline(source.fBaseline), - fErrBaseline(source.fErrBaseline), - fFit(source.fFit), - fGausNS(source.fGausNS), - fGausAS(source.fGausAS), - fPed(source.fPed), - fBaseTransvReg(source.fBaseTransvReg), - fv2AssocPart(source.fv2AssocPart), - fv2Dmeson(source.fv2Dmeson), - fNSyieldBinCount(source.fNSyieldBinCount), - fErrNSyieldBinCount(source.fErrNSyieldBinCount), - fASyieldBinCount(source.fASyieldBinCount), - fErrASyieldBinCount(source.fErrASyieldBinCount) -{ -} +DhCorrelationFitter::DhCorrelationFitter(const DhCorrelationFitter& source) + + = default; DhCorrelationFitter::~DhCorrelationFitter() // destructor { Info("DhCorrelationFitter.cxx", "Destructor is calling"); - if (fHist) { + if (fHist != nullptr) { delete fHist; - fHist = 0; + fHist = nullptr; } - if (fFit) { + if (fFit != nullptr) { delete fFit; - fFit = 0; + fFit = nullptr; } - if (fGausNS) { + if (fGausNS != nullptr) { delete fGausNS; - fGausNS = 0; + fGausNS = nullptr; } // if (fGausNS2) {delete fGausNS2; fGausNS2 = 0;} - if (fPed) { + if (fPed != nullptr) { delete fPed; - fPed = 0; + fPed = nullptr; } } DhCorrelationFitter& DhCorrelationFitter::operator=(const DhCorrelationFitter& cfit) // assignment operator { - if (&cfit == this) + if (&cfit == this) { return *this; + } fIsReflected = cfit.fIsReflected; fTypeOfFitFunc = cfit.fTypeOfFitFunc; @@ -215,7 +182,7 @@ DhCorrelationFitter& DhCorrelationFitter::operator=(const DhCorrelationFitter& c return *this; } -void DhCorrelationFitter::SetExternalValsAndBounds(Int_t nPars, Double_t* vals, Double_t* lowBounds, Double_t* uppBounds) +void DhCorrelationFitter::setExternalValsAndBounds(Int_t nPars, const Double_t* vals, const Double_t* lowBounds, const Double_t* uppBounds) { fNpars = nPars; @@ -229,11 +196,9 @@ void DhCorrelationFitter::SetExternalValsAndBounds(Int_t nPars, Double_t* vals, fExtParsLowBounds[i] = lowBounds[i]; fExtParsUppBounds[i] = uppBounds[i]; } - - return; } -void DhCorrelationFitter::Fitting(Bool_t drawSplitTerm, Bool_t useExternalPars) +void DhCorrelationFitter::fitting(Bool_t drawSplitTerm, Bool_t useExternalPars) { // -> fFixBase = 0 : baseline free // = 1 : fix the baseline to the minimum of the histogram @@ -247,23 +212,24 @@ void DhCorrelationFitter::Fitting(Bool_t drawSplitTerm, Bool_t useExternalPars) // = 2 : AS mean fixed to pi, NS mean free // = 3 : NS mean fixed to 0, AS mean to pi - if (useExternalPars) + if (useExternalPars) { fUseExternalPars = kTRUE; + } if (fFixBase != 0 && fFixBase != 6) { Printf("[INFO] DhCorrelationFitter::Fitting, Finding baseline"); - FindBaseline(); + findBaseline(); } if (fFixBase == 0) { // set initial value of the fBaseline - fBaseline = CalculateBaseline(fHist, fIsTotal); + fBaseline = calculateBaseline(fHist, fIsTotal); } Printf("[INFO] DhCorrelationFitter::Fitting, Setting Function"); if (fTypeOfFitFunc == 7) { // case for v2 modulation - FitBaselineWv2(); // to contrain the B parameter in the fit function for the pedestal + fitBaselineWv2(); // to contrain the B parameter in the fit function for the pedestal Printf("[INFO] B parameter for v2 fit: %.3f", fBaseline); } - SetFitFunction(); + setFitFunction(); if (fFixBase != 0) { fFit->FixParameter(0, fBaseline); @@ -272,17 +238,19 @@ void DhCorrelationFitter::Fitting(Bool_t drawSplitTerm, Bool_t useExternalPars) fFit->FixParameter(2, 0.); } if (fFixMean == 2 || fFixMean == 3) { - if (fTypeOfFitFunc != 0 && fTypeOfFitFunc != 3) + if (fTypeOfFitFunc != 0 && fTypeOfFitFunc != 3) { fFit->FixParameter(5, TMath::Pi()); - if (fTypeOfFitFunc == 3 || fTypeOfFitFunc == 6) + } + if (fTypeOfFitFunc == 3 || fTypeOfFitFunc == 6) { fFit->FixParameter(2, TMath::Pi()); + } } Printf("[INFO] DhCorrelationFitter::Fitting, Fitting"); TVirtualFitter::SetMaxIterations(20000); - TFitResultPtr fitptr = fHist->Fit(fFit, "RIMES", "", fMinCorr, fMaxCorr); - TMatrixD cor = fitptr->GetCorrelationMatrix(); - TMatrixD cov = fitptr->GetCovarianceMatrix(); + TFitResultPtr const fitptr = fHist->Fit(fFit, "RIMES", "", fMinCorr, fMaxCorr); + TMatrixD const cor = fitptr->GetCorrelationMatrix(); + TMatrixD const cov = fitptr->GetCovarianceMatrix(); printf("[INFO] Correlation Matrix - The final one! \n"); cor.Print(); gMinuit->mnmatu(1); @@ -293,10 +261,10 @@ void DhCorrelationFitter::Fitting(Bool_t drawSplitTerm, Bool_t useExternalPars) fErrBaseline = fFit->GetParError(0); } Printf("[INFO] DhCorrelationFitter::Fitting, Calculating yields with BC"); - CalculateYieldsAboveBaseline(); + calculateYieldsAboveBaseline(); fHist->SetTitle(";#Delta#varphi (rad); #frac{1}{N_{D}}#frac{dN^{assoc}}{d#Delta#varphi} (rad^{-1})"); Printf("[INFO] DhCorrelationFitter::Fitting, Now drawing, if requested"); - SetSingleTermsForDrawing(drawSplitTerm); + setSingleTermsForDrawing(drawSplitTerm); // NS yield from bin counting double fNSyield = 0.; @@ -321,7 +289,7 @@ void DhCorrelationFitter::Fitting(Bool_t drawSplitTerm, Bool_t useExternalPars) printf("[RESULT MINE] Bin counting results: NS Yield = %.3f +- %.3f \n[RESULT MINE] Bin counting results: AS Yield: %.3f +- %.3f \n[RESULT MINE] baseline = %.3f \n", fNSyield, fNSyieldErr, fASyield, fASyieldErr, baselinBinCount); } -void DhCorrelationFitter::SetFitFunction() +void DhCorrelationFitter::setFitFunction() { // -> fitFunc = 1: const + G NS + G AS (w/o periodicity) // = 2: const + G NS + G AS (w/ periodicity) @@ -331,7 +299,7 @@ void DhCorrelationFitter::SetFitFunction() // = 6: const + VonMises AS // = 7: baseline w v2 modulation + G NS + G AS (w/ periodicity) - if (fFit) { + if (fFit != nullptr) { delete fFit; delete fGausNS; // delete fGausNS2; @@ -596,7 +564,7 @@ void DhCorrelationFitter::SetFitFunction() } } -void DhCorrelationFitter::SetPointsForBaseline(Int_t nBaselinePoints, Int_t* binsBaseline) +void DhCorrelationFitter::setPointsForBaseline(Int_t nBaselinePoints, const Int_t* binsBaseline) { fNbasleinePoints = nBaselinePoints; @@ -606,17 +574,15 @@ void DhCorrelationFitter::SetPointsForBaseline(Int_t nBaselinePoints, Int_t* bin for (int i = 0; i < fNbasleinePoints; i++) { fBinsBaseline[i] = binsBaseline[i]; } - - return; } -Double_t DhCorrelationFitter::FindBaseline() +Double_t DhCorrelationFitter::findBaseline() { // baseline free if (fFixBase == 0) { Printf("[INFO] DhCorrelationFitter::FindBasline(). The baseline option is set to free baseline: now the full fit will be done. Beware!"); - Fitting(); // TODO: not sure + fitting(); // TODO: not sure return fBaseline; } @@ -649,12 +615,12 @@ Double_t DhCorrelationFitter::FindBaseline() // fix the baseline to the weighted average of the abs(fFixBaseline) lower points if (fFixBase < 0) { Int_t npointsAv = TMath::Abs(fFixBase); - Int_t* ind = new Int_t[fHist->GetNbinsX()]; - Float_t* hval = new Float_t[fHist->GetNbinsX()]; + auto* ind = new Int_t[fHist->GetNbinsX()]; + auto* hval = new Float_t[fHist->GetNbinsX()]; for (Int_t k = 1; k <= fHist->GetNbinsX(); k++) { hval[k - 1] = fHist->GetBinContent(k); } - Double_t errAv = 0., Av = 0.; + Double_t errAv = 0., av = 0.; TMath::Sort(fHist->GetNbinsX(), hval, ind, kFALSE); // KFALSE -> increasing order // Average of abs(fFixBase) lower points for (Int_t k = 0; k < npointsAv; k++) { @@ -664,13 +630,13 @@ Double_t DhCorrelationFitter::FindBaseline() npointsAv++; continue; } - Av += fHist->GetBinContent(ind[k] + 1) / (fHist->GetBinError(ind[k] + 1) * fHist->GetBinError(ind[k] + 1)); + av += fHist->GetBinContent(ind[k] + 1) / (fHist->GetBinError(ind[k] + 1) * fHist->GetBinError(ind[k] + 1)); errAv += 1. / (fHist->GetBinError(ind[k] + 1) * fHist->GetBinError(ind[k] + 1)); } - Av /= errAv; + av /= errAv; errAv = TMath::Sqrt(1. / errAv); - printf("[RESULT] Average fBaseline: %.3f +- %.3f", Av, errAv); - fBaseline = Av; + printf("[RESULT] Average fBaseline: %.3f +- %.3f", av, errAv); + fBaseline = av; fErrBaseline = errAv; if (fShiftBaselineUp) { @@ -688,23 +654,24 @@ Double_t DhCorrelationFitter::FindBaseline() // zyam at pi/2. Fix the baseline averaging the 2 points around +-pi/2 value if (fFixBase == 2) { - Double_t errAv = 0., Av = 0.; + Double_t errAv = 0., av = 0.; Int_t binPhi = fHist->FindBin(TMath::Pi() / 2.); - Av += fHist->GetBinContent(binPhi) / (fHist->GetBinError(binPhi) * fHist->GetBinError(binPhi)); + av += fHist->GetBinContent(binPhi) / (fHist->GetBinError(binPhi) * fHist->GetBinError(binPhi)); errAv += 1. / (fHist->GetBinError(binPhi) * fHist->GetBinError(binPhi)); if (!fIsReflected) { binPhi = fHist->FindBin(-TMath::Pi() / 2.); - if (binPhi < 1) + if (binPhi < 1) { binPhi = 1; - Av += fHist->GetBinContent(binPhi) / (fHist->GetBinError(binPhi) * fHist->GetBinError(binPhi)); + } + av += fHist->GetBinContent(binPhi) / (fHist->GetBinError(binPhi) * fHist->GetBinError(binPhi)); errAv += 1. / (fHist->GetBinError(binPhi) * fHist->GetBinError(binPhi)); } else { printf("[INFO] Reflected histo: only the point at +pi/2 used to evaluate baseline"); } - Av /= errAv; + av /= errAv; errAv = TMath::Sqrt(1. / errAv); - printf("[RESULT] Average fBaseline: %.3f +- %.3f \n", Av, errAv); - fBaseline = Av; + printf("[RESULT] Average fBaseline: %.3f +- %.3f \n", av, errAv); + fBaseline = av; fErrBaseline = errAv; if (fShiftBaselineUp) { @@ -726,15 +693,15 @@ Double_t DhCorrelationFitter::FindBaseline() printf("[ERROR] No baseline points set for the baseline evaluation, SetPointsForBaseline(Int_t nBaselinePoints, Double_t* valsBaseline). Returning -1"); return -1; } - Double_t errAv = 0., Av = 0.; + Double_t errAv = 0., av = 0.; for (int i = 0; i < fNbasleinePoints; i++) { - Av += fHist->GetBinContent(fBinsBaseline[i]) / (fHist->GetBinError(fBinsBaseline[i]) * fHist->GetBinError(fBinsBaseline[i])); + av += fHist->GetBinContent(fBinsBaseline[i]) / (fHist->GetBinError(fBinsBaseline[i]) * fHist->GetBinError(fBinsBaseline[i])); errAv += 1. / (fHist->GetBinError(fBinsBaseline[i]) * fHist->GetBinError(fBinsBaseline[i])); } - Av /= errAv; + av /= errAv; errAv = TMath::Sqrt(1. / errAv); - printf("[RESULT] Average fBaseline: %.3f +- %.3f \n", Av, errAv); - fBaseline = Av; + printf("[RESULT] Average fBaseline: %.3f +- %.3f \n", av, errAv); + fBaseline = av; fErrBaseline = errAv; if (fShiftBaselineUp) { @@ -751,8 +718,8 @@ Double_t DhCorrelationFitter::FindBaseline() } if (fFixBase == 4) { - fBaseline = CalculateBaseline(fHist, fIsTotal); // TODO: add the option for total range/ reflected range to pass in input - fErrBaseline = CalculateBaselineError(fHist, fIsTotal); + fBaseline = calculateBaseline(fHist, fIsTotal); // TODO: add the option for total range/ reflected range to pass in input + fErrBaseline = calculateBaselineError(fHist, fIsTotal); if (fShiftBaselineUp) { fBaseline += fErrBaseline; @@ -771,11 +738,11 @@ Double_t DhCorrelationFitter::FindBaseline() return -1.; } -void DhCorrelationFitter::FitBaselineWv2() +void DhCorrelationFitter::fitBaselineWv2() { - fBaseTransvReg = new TF1("fBaseTransvReg", [](double* x, double* p) { - double xx = x[0]; // x value + fBaseTransvReg = new TF1("fBaseTransvReg", [](const double* x, const double* p) { + double const xx = x[0]; // x value if ((xx >= -TMath::Pi()/2 && xx <= -3*TMath::Pi()/8) || (xx >= 3*TMath::Pi()/8 && xx <= 5*TMath::Pi()/8) || (xx >= 11*TMath::Pi()/8 && xx <= 3*TMath::Pi()/2)) { // Gaussian example: p[0] = amplitude, p[1] = mean, p[2] = sigma return p[0]*(1+2*p[1]*p[2]*TMath::Cos(2*xx)); @@ -785,33 +752,33 @@ void DhCorrelationFitter::FitBaselineWv2() fBaseTransvReg->FixParameter(1, fv2AssocPart); fBaseTransvReg->FixParameter(2, fv2Dmeson); - TFitResultPtr rFit = fHist->Fit(fBaseTransvReg, "RIMES", "", fMinCorr, fMaxCorr); + TFitResultPtr const rFit = fHist->Fit(fBaseTransvReg, "RIMES", "", fMinCorr, fMaxCorr); fBaseline = fBaseTransvReg->GetParameter(0); - - return; } -void DhCorrelationFitter::CalculateYieldsAboveBaseline() +void DhCorrelationFitter::calculateYieldsAboveBaseline() { fNSyieldBinCount = 0; fErrNSyieldBinCount = 0; fASyieldBinCount = 0; fErrASyieldBinCount = 0; - cout << "[RESULT] Baseline: " << fBaseline << " +- " << fErrBaseline << endl; + std::cout << "[RESULT] Baseline: " << fBaseline << " +- " << fErrBaseline << std::endl; Int_t binMinNS = fHist->FindBin(-1.5); // slightly more than -pi/2 - if (binMinNS < 1) - binMinNS = 1; // with this, it is ok even in the case of a reflected fHist (range 0 - pi) - Int_t binMaxNS = 6; // fHist -> FindBin(1.5); // slightly less than +pi/2 - Int_t binMinAS = 11; // fHist -> FindBin(1.6); // slightly more than +pi/2 - Int_t binMaxAS = 16; // fHist -> FindBin(3.14+1.5); // slightly less than +3pi/2 - if (binMaxAS > fHist->GetNbinsX()) + if (binMinNS < 1) { + binMinNS = 1; // with this, it is ok even in the case of a reflected fHist (range 0 - pi) + } + Int_t const binMaxNS = 6; // fHist -> FindBin(1.5); // slightly less than +pi/2 + Int_t const binMinAS = 11; // fHist -> FindBin(1.6); // slightly more than +pi/2 + Int_t binMaxAS = 16; // fHist -> FindBin(3.14+1.5); // slightly less than +3pi/2 + if (binMaxAS > fHist->GetNbinsX()) { binMaxAS = fHist->GetNbinsX(); // with this, it is ok even in the case of a reflected fHist (range 0 - pi) - cout << "N bins : " << fHist->GetNbinsX() << endl; - cout << "binMinNS : " << binMinNS << endl; - cout << "binMaxNS : " << binMaxNS << endl; - cout << "binMinAS : " << binMinAS << endl; - cout << "binMaxAS : " << binMaxAS << endl; + } + std::cout << "N bins : " << fHist->GetNbinsX() << std::endl; + std::cout << "binMinNS : " << binMinNS << std::endl; + std::cout << "binMaxNS : " << binMaxNS << std::endl; + std::cout << "binMinAS : " << binMinAS << std::endl; + std::cout << "binMaxAS : " << binMaxAS << std::endl; // Near Side Yield from bin counting for (Int_t bmNS = binMinNS; bmNS <= binMaxNS; bmNS++) { fNSyieldBinCount += 2 * (fHist->GetBinContent(bmNS) - fBaseline) * fHist->GetBinWidth(bmNS); @@ -827,22 +794,20 @@ void DhCorrelationFitter::CalculateYieldsAboveBaseline() fErrASyieldBinCount = TMath::Sqrt(fErrASyieldBinCount); printf("[RESULT] Bin counting results: NS Yield = %.3f +- %.3f \n[RESULT] Bin counting results: AS Yield: %.3f +- %.3f \n", fNSyieldBinCount, fErrNSyieldBinCount, fASyieldBinCount, fErrASyieldBinCount); - - return; } -Double_t DhCorrelationFitter::CalculateBaseline(TH1F*& histo, Bool_t totalRange) +Double_t DhCorrelationFitter::calculateBaseline(TH1F*& histo, Bool_t totalRange) { // total range = 2*Pi // half range = Pi , for histogram reflected under symmetric assumption Double_t baseline, errBaseline; - Int_t nBinsPhi = histo->GetNbinsX(); - Int_t binPhiHalf = nBinsPhi / 2; - Int_t binPhiHalfMinus1 = nBinsPhi / 2 - 1; - Int_t binPhiHalfPlus1 = nBinsPhi / 2 + 1; - Int_t binPhiHalfPlus2 = nBinsPhi / 2 + 1; + Int_t const nBinsPhi = histo->GetNbinsX(); + Int_t const binPhiHalf = nBinsPhi / 2; + Int_t const binPhiHalfMinus1 = nBinsPhi / 2 - 1; + Int_t const binPhiHalfPlus1 = nBinsPhi / 2 + 1; + Int_t const binPhiHalfPlus2 = nBinsPhi / 2 + 1; if (totalRange) { printf("[INFO] Using total deltaPhi range \n"); @@ -904,18 +869,18 @@ Double_t DhCorrelationFitter::CalculateBaseline(TH1F*& histo, Bool_t totalRange) return baseline; } -Double_t DhCorrelationFitter::CalculateBaselineError(TH1F*& histo, Bool_t totalRange) +Double_t DhCorrelationFitter::calculateBaselineError(TH1F*& histo, Bool_t totalRange) { // total range = 2*Pi // half range = Pi , for histogram reflected under symmetric assumption Double_t errBaseline; - Int_t nBinsPhi = histo->GetNbinsX(); - Int_t binPhiHalf = nBinsPhi / 2; - Int_t binPhiHalfMinus1 = nBinsPhi / 2 - 1; - Int_t binPhiHalfPlus1 = nBinsPhi / 2 + 1; - Int_t binPhiHalfPlus2 = nBinsPhi / 2 + 1; + Int_t const nBinsPhi = histo->GetNbinsX(); + Int_t const binPhiHalf = nBinsPhi / 2; + Int_t const binPhiHalfMinus1 = nBinsPhi / 2 - 1; + Int_t const binPhiHalfPlus1 = nBinsPhi / 2 + 1; + Int_t const binPhiHalfPlus2 = nBinsPhi / 2 + 1; if (totalRange) { // baseline evaluated considering: the two first points, the last two points and four points in the middle (corresponding to the outer points) @@ -954,9 +919,9 @@ Double_t DhCorrelationFitter::CalculateBaselineError(TH1F*& histo, Bool_t totalR return errBaseline; } -void DhCorrelationFitter::SetSingleTermsForDrawing(Bool_t draw) +void DhCorrelationFitter::setSingleTermsForDrawing(Bool_t draw) { - Double_t* par = 0; + Double_t* par = nullptr; if (fTypeOfFitFunc == 1 || fTypeOfFitFunc == 2 || fTypeOfFitFunc == 5) { par = new Double_t[7]; } else if (fTypeOfFitFunc == 3 || fTypeOfFitFunc == 6) { @@ -987,7 +952,7 @@ void DhCorrelationFitter::SetSingleTermsForDrawing(Bool_t draw) fGausAS->SetLineColor(kGreen); fGausAS->SetLineWidth(4); - TPaveText* pvStatTests1 = new TPaveText(0.51, 0.58, 0.85, 0.90, "NDC"); + auto* pvStatTests1 = new TPaveText(0.51, 0.58, 0.85, 0.90, "NDC"); pvStatTests1->SetFillStyle(0); pvStatTests1->SetTextSize(0.045); pvStatTests1->SetBorderSize(0); @@ -1027,7 +992,7 @@ void DhCorrelationFitter::SetSingleTermsForDrawing(Bool_t draw) fGausNS->SetLineWidth(4); fGausAS->SetLineWidth(4); - TPaveText* pvStatTests1 = new TPaveText(0.51, 0.58, 0.85, 0.90, "NDC"); + auto* pvStatTests1 = new TPaveText(0.51, 0.58, 0.85, 0.90, "NDC"); pvStatTests1->SetFillStyle(0); pvStatTests1->SetTextSize(0.045); pvStatTests1->SetBorderSize(0); @@ -1077,7 +1042,7 @@ void DhCorrelationFitter::SetSingleTermsForDrawing(Bool_t draw) fGausNS->SetLineWidth(4); fGausAS->SetLineWidth(4); - TPaveText* pvStatTests1 = new TPaveText(0.51, 0.58, 0.85, 0.90, "NDC"); + auto* pvStatTests1 = new TPaveText(0.51, 0.58, 0.85, 0.90, "NDC"); pvStatTests1->SetFillStyle(0); pvStatTests1->SetTextSize(0.045); pvStatTests1->SetBorderSize(0); @@ -1089,7 +1054,7 @@ void DhCorrelationFitter::SetSingleTermsForDrawing(Bool_t draw) t5 = pvStatTests1->AddText(0., 0.35, Form("AS #sigma = %.3f#pm%.3f ", fFit->GetParameter("AS #sigma"), fFit->GetParError(fFit->GetParNumber("AS #sigma")))); // t6 = pvStatTests1 -> AddText(0., 0.20, Form("#beta = %.3f#pm%.3f ", fFit -> GetParameter("NS shape par"), fFit -> GetParError(fFit->GetParNumber("NS shape par")))); - TPaveText* pvStatTests2 = new TPaveText(0.51, 0.28, 0.85, 0.60, "NDC"); + auto* pvStatTests2 = new TPaveText(0.51, 0.28, 0.85, 0.60, "NDC"); pvStatTests2->SetFillStyle(0); pvStatTests2->SetTextSize(0.045); pvStatTests2->SetBorderSize(0); @@ -1129,7 +1094,7 @@ void DhCorrelationFitter::SetSingleTermsForDrawing(Bool_t draw) fGausNS->SetLineWidth(4); fGausAS->SetLineWidth(4); - TPaveText* pvStatTests1 = new TPaveText(0.51, 0.58, 0.85, 0.90, "NDC"); + auto* pvStatTests1 = new TPaveText(0.51, 0.58, 0.85, 0.90, "NDC"); pvStatTests1->SetFillStyle(0); pvStatTests1->SetTextSize(0.045); pvStatTests1->SetBorderSize(0); diff --git a/PWGHF/HFC/Macros/DhCorrelationFitter.h b/PWGHF/HFC/Macros/DhCorrelationFitter.h index 8a9db7fe6e7..692ff6a0ad5 100644 --- a/PWGHF/HFC/Macros/DhCorrelationFitter.h +++ b/PWGHF/HFC/Macros/DhCorrelationFitter.h @@ -44,67 +44,67 @@ class DhCorrelationFitter DhCorrelationFitter& operator=(const DhCorrelationFitter& cfit); /// Setters - void SetHistoIsReflected(Bool_t isrefl) { fIsReflected = isrefl; } - void SetFuncType(FunctionType fitType) { fTypeOfFitFunc = fitType; } - void SetFixBaseline(Int_t fixBase) { fFixBase = fixBase; } - void SetFixMean(Int_t fixMean) { fFixMean = fixMean; } - void SetPtRanges(Double_t PtCandMin, Double_t PtCandMax, Double_t PtAssocMin, Double_t PtAssocMax) + void setHistoIsReflected(Bool_t isrefl) { fIsReflected = isrefl; } + void setFuncType(FunctionType fitType) { fTypeOfFitFunc = fitType; } + void setFixBaseline(Int_t fixBase) { fFixBase = fixBase; } + void setFixMean(Int_t fixMean) { fFixMean = fixMean; } + void setPtRanges(Double_t ptCandMin, Double_t ptCandMax, Double_t ptAssocMin, Double_t ptAssocMax) { - fMinCandPt = PtCandMin; - fMaxCandPt = PtCandMax; - fMinAssoPt = PtAssocMin; - fMaxAssoPt = PtAssocMax; + fMinCandPt = ptCandMin; + fMaxCandPt = ptCandMax; + fMinAssoPt = ptAssocMin; + fMaxAssoPt = ptAssocMax; } - void SetExternalValsAndBounds(Int_t nPars, Double_t* vals, Double_t* lowBounds, Double_t* uppBounds); - void SetPointsForBaseline(Int_t nBaselinePoints, Int_t* binsBaseline); - void SetReflectedCorrHisto(Bool_t isReflected) { fIsTotal = !isReflected; } - void SetBaselineUpOrDown(Bool_t baseUp, Bool_t baseDown) + void setExternalValsAndBounds(Int_t nPars, const Double_t* vals, const Double_t* lowBounds, const Double_t* uppBounds); + void setPointsForBaseline(Int_t nBaselinePoints, const Int_t* binsBaseline); + void setReflectedCorrHisto(Bool_t isReflected) { fIsTotal = !isReflected; } + void setBaselineUpOrDown(Bool_t baseUp, Bool_t baseDown) { fShiftBaselineUp = baseUp; fShiftBaselineDown = baseDown; } - void Setv2(Double_t v2AssocPart, Double_t v2Dmeson) + void setv2(Double_t v2AssocPart, Double_t v2Dmeson) { fv2AssocPart = v2AssocPart; fv2Dmeson = v2Dmeson; } /// Functions for fitting - void Fitting(Bool_t drawSplitTerm = kTRUE, Bool_t useExternalPars = kFALSE); - void SetFitFunction(); - void CalculateYieldsAboveBaseline(); - void FitBaselineWv2(); - Double_t CalculateBaseline(TH1F*& histo, Bool_t totalRange = kTRUE); - Double_t CalculateBaselineError(TH1F*& histo, Bool_t totalRange = kTRUE); - void SetSingleTermsForDrawing(Bool_t draw); - Double_t FindBaseline(); + void fitting(Bool_t drawSplitTerm = kTRUE, Bool_t useExternalPars = kFALSE); + void setFitFunction(); + void calculateYieldsAboveBaseline(); + void fitBaselineWv2(); + Double_t calculateBaseline(TH1F*& histo, Bool_t totalRange = kTRUE); + Double_t calculateBaselineError(TH1F*& histo, Bool_t totalRange = kTRUE); + void setSingleTermsForDrawing(Bool_t draw); + Double_t findBaseline(); /// Getters - Double_t GetNSSigma() { return fFit->GetParameter("NS #sigma"); } // TODO: case kConstThreeGausPeriodicity - Double_t GetASSigma() { return fFit->GetParameter("AS #sigma"); } // TODO: case kConstThreeGausPeriodicity - Double_t GetNSYield() { return fFit->GetParameter("NS Y"); } - Double_t GetASYield() { return fFit->GetParameter("AS Y"); } - Double_t GetBeta() { return fFit->GetParameter(7); } - Double_t GetPedestal() { return fBaseline; } - Double_t Getv2hadron() { return fFit->GetParameter("v_{2} hadron"); } - Double_t Getv2Dmeson() { return fFit->GetParameter("v_{2} D meson"); } - Double_t GetNSSigmaError() { return fFit->GetParError(fFit->GetParNumber("NS #sigma")); } // TODO: case kConstThreeGausPeriodicity - Double_t GetASSigmaError() { return fFit->GetParError(fFit->GetParNumber("AS #sigma")); } // TODO: case kConstThreeGausPeriodicityAS - Double_t GetNSYieldError() { return fFit->GetParError(fFit->GetParNumber("NS Y")); } - Double_t GetASYieldError() { return fFit->GetParError(fFit->GetParNumber("AS Y")); } - Double_t GetBetaError() { return fFit->GetParError(7); } - Double_t GetPedestalError() { return fErrBaseline; } - Double_t Getv2hadronError() { return fFit->GetParError(fFit->GetParNumber("v_{2} hadron")); } - Double_t Getv2DmesonError() { return fFit->GetParError(fFit->GetParNumber("v_{2} D meson")); } - Double_t GetBinCountingNSYield() { return fNSyieldBinCount; } - Double_t GetBinCountingASYield() { return fASyieldBinCount; } - Double_t GetBinCountingNSYieldErr() { return fErrNSyieldBinCount; } - Double_t GetBinCountingASYieldErr() { return fErrASyieldBinCount; } - TF1* GetFitFunction() + Double_t getNsSigma() { return fFit->GetParameter("NS #sigma"); } // TODO: case kConstThreeGausPeriodicity + Double_t getAsSigma() { return fFit->GetParameter("AS #sigma"); } // TODO: case kConstThreeGausPeriodicity + Double_t getNsYield() { return fFit->GetParameter("NS Y"); } + Double_t getAsYield() { return fFit->GetParameter("AS Y"); } + Double_t getBeta() { return fFit->GetParameter(7); } + [[nodiscard]] Double_t getPedestal() const { return fBaseline; } + Double_t getv2hadron() { return fFit->GetParameter("v_{2} hadron"); } + Double_t getv2Dmeson() { return fFit->GetParameter("v_{2} D meson"); } + Double_t getNsSigmaError() { return fFit->GetParError(fFit->GetParNumber("NS #sigma")); } // TODO: case kConstThreeGausPeriodicity + Double_t getAsSigmaError() { return fFit->GetParError(fFit->GetParNumber("AS #sigma")); } // TODO: case kConstThreeGausPeriodicityAS + Double_t getNsYieldError() { return fFit->GetParError(fFit->GetParNumber("NS Y")); } + Double_t getAsYieldError() { return fFit->GetParError(fFit->GetParNumber("AS Y")); } + Double_t getBetaError() { return fFit->GetParError(7); } + [[nodiscard]] Double_t getPedestalError() const { return fErrBaseline; } + Double_t getv2hadronError() { return fFit->GetParError(fFit->GetParNumber("v_{2} hadron")); } + Double_t getv2DmesonError() { return fFit->GetParError(fFit->GetParNumber("v_{2} D meson")); } + [[nodiscard]] Double_t getBinCountingNsYield() const { return fNSyieldBinCount; } + [[nodiscard]] Double_t getBinCountingAsYield() const { return fASyieldBinCount; } + [[nodiscard]] Double_t getBinCountingNsYieldErr() const { return fErrNSyieldBinCount; } + [[nodiscard]] Double_t getBinCountingAsYieldErr() const { return fErrASyieldBinCount; } + TF1* getFitFunction() { - if (!fFit) { + if (fFit == nullptr) { printf("[ERROR] DhCorrelationFitter::GetFitFunction, No fit function"); - return NULL; + return nullptr; } return fFit; } diff --git a/PWGHF/HFC/Macros/ExtractOutputCorrel.C b/PWGHF/HFC/Macros/ExtractOutputCorrel.C index e263a810ff1..db8dc9158d5 100644 --- a/PWGHF/HFC/Macros/ExtractOutputCorrel.C +++ b/PWGHF/HFC/Macros/ExtractOutputCorrel.C @@ -17,14 +17,18 @@ /// \author Swapnesh Santosh Khade #include "DhCorrelationExtraction.h" -#include "Riostream.h" +#include #include +#include #include +#include #include #include +#include + #include #include #include @@ -35,7 +39,7 @@ using namespace rapidjson; template void readArray(const Value& jsonArray, std::vector& output) { - for (auto it = jsonArray.Begin(); it != jsonArray.End(); it++) { + for (const auto* it = jsonArray.Begin(); it != jsonArray.End(); it++) { auto value = it->template Get(); output.emplace_back(value); } @@ -43,7 +47,7 @@ void readArray(const Value& jsonArray, std::vector& output) void parseStringArray(const Value& jsonArray, std::vector& output) { - size_t arrayLength = jsonArray.Size(); + size_t const arrayLength = jsonArray.Size(); for (size_t i = 0; i < arrayLength; i++) { if (jsonArray[i].IsString()) { output.emplace_back(jsonArray[i].GetString()); @@ -51,13 +55,13 @@ void parseStringArray(const Value& jsonArray, std::vector& output) } } -void SetInputCorrelNames(DhCorrelationExtraction* plotter, TString pathFileSE, TString pathFileME, TString dirSE, TString dirME, TString histoNameCorrSignal, TString histoNameCorrSideba, TString histoNameCorrSidebaLeft, TString histoNameCorrSidebaRight); -void SetInputHistoInvMassNames(DhCorrelationExtraction* plotter, TString pathFileMass, std::vector inputMassNames); -void SetInputHistoFDSubtraction(DhCorrelationExtraction* plotter, TString pathFileFDTemplate, TString pathFileFDPromptFrac, TString histoNameFDTemplatePrompt, TString histoNameFDTemplateNonPrompt, TString histoNameRawFracPrompt); -void SetInputHistoSecPart(DhCorrelationExtraction* plotter, TString pathFileSecPart, TString dirSecPartName, TString histoNamePrimaryPart, TString histoNameAllPart); -void SetInputHistoBiasBtoD(DhCorrelationExtraction* plotter, TString pathfFilePromptMcRec, TString pathfFileNonPromptMcRec); +void setInputCorrelNames(DhCorrelationExtraction* plotter, TString pathFileSE, TString pathFileME, TString dirSE, TString dirME, TString histoNameCorrSignal, TString histoNameCorrSideba, TString histoNameCorrSidebaLeft, TString histoNameCorrSidebaRight); +void setInputHistoInvMassNames(DhCorrelationExtraction* plotter, TString pathFileMass, std::vector inputMassNames); +void setInputHistoFdSubtraction(DhCorrelationExtraction* plotter, TString pathFileFDTemplate, TString pathFileFDPromptFrac, TString histoNameFDTemplatePrompt, TString histoNameFDTemplateNonPrompt, TString histoNameRawFracPrompt); +void setInputHistoSecPart(DhCorrelationExtraction* plotter, TString pathFileSecPart, TString dirSecPartName, TString histoNamePrimaryPart, TString histoNameAllPart); +void setInputHistoBiasBtoD(DhCorrelationExtraction* plotter, TString pathfFilePromptMcRec, TString pathfFileNonPromptMcRec); -void ExtractOutputCorrel_Ds(const TString cfgFileName = "config_CorrAnalysis.json") +void extractOutputCorrelDs(const TString cfgFileName = "config_CorrAnalysis.json") { // gStyle -> SetOptStat(0); gStyle->SetPadLeftMargin(0.15); @@ -75,73 +79,73 @@ void ExtractOutputCorrel_Ds(const TString cfgFileName = "config_CorrAnalysis.jso config.ParseStream(is); fclose(configFile); - string CodeNameAnalysis = config["CodeName"].GetString(); - gSystem->Exec(Form("rm -rf Output_CorrelationExtraction_%s_Root/ Output_CorrelationExtraction_%s_png/", CodeNameAnalysis.data(), CodeNameAnalysis.data())); - gSystem->Exec(Form("mkdir Output_CorrelationExtraction_%s_Root/ Output_CorrelationExtraction_%s_png/", CodeNameAnalysis.data(), CodeNameAnalysis.data())); - - string pathFileSE = config["pathFileSE"].GetString(); - string pathFileME = config["pathFileME"].GetString(); - string pathFileMass = config["pathFileMass"].GetString(); - string pathFileFDTemplate = config["pathFileFDTemplate"].GetString(); - string pathFileFDPromptFrac = config["pathFileFDPromptFrac"].GetString(); - string pathFileSecPart = config["pathFileSecPart"].GetString(); - string pathfFilePromptMcRec = config["pathfFilePromptMcRec"].GetString(); - string pathfFileNonPromptMcRec = config["pathfFileNonPromptMcRec"].GetString(); - - string dirSE = config["InputDirSE"].GetString(); - string dirME = config["InputDirME"].GetString(); - string dirSecPart = config["InputDirSecPart"].GetString(); - string histoNameCorrSignal = config["InputHistoCorrSignalName"].GetString(); - string histoNameCorrSideba = config["InputHistoCorrSidebaName"].GetString(); - string histoNameCorrSidebaLeft = config["InputHistoCorrSidebaLeftName"].GetString(); - string histoNameCorrSidebaRight = config["InputHistoCorrSidebaRightName"].GetString(); - string histoNameFDTemplatePrompt = config["InputHistoFDTemplatePrompt"].GetString(); - string histoNameFDTemplateNonPrompt = config["InputHistoFDTemplateNonPrompt"].GetString(); - string histoNameRawFracPrompt = config["InputHistoFDPromptFrac"].GetString(); - string histoNamePrimaryPart = config["InputHistoPrimaryPart"].GetString(); - string histoNameAllPart = config["InputHistoAllPart"].GetString(); - - std::vector InputHistoMassName; + std::string codeNameAnalysis = config["CodeName"].GetString(); + gSystem->Exec(Form("rm -rf Output_CorrelationExtraction_%s_Root/ Output_CorrelationExtraction_%s_png/", codeNameAnalysis.data(), codeNameAnalysis.data())); + gSystem->Exec(Form("mkdir Output_CorrelationExtraction_%s_Root/ Output_CorrelationExtraction_%s_png/", codeNameAnalysis.data(), codeNameAnalysis.data())); + + std::string const pathFileSE = config["pathFileSE"].GetString(); + std::string const pathFileME = config["pathFileME"].GetString(); + std::string const pathFileMass = config["pathFileMass"].GetString(); + std::string const pathFileFDTemplate = config["pathFileFDTemplate"].GetString(); + std::string const pathFileFDPromptFrac = config["pathFileFDPromptFrac"].GetString(); + std::string const pathFileSecPart = config["pathFileSecPart"].GetString(); + std::string const pathfFilePromptMcRec = config["pathfFilePromptMcRec"].GetString(); + std::string const pathfFileNonPromptMcRec = config["pathfFileNonPromptMcRec"].GetString(); + + std::string const dirSE = config["InputDirSE"].GetString(); + std::string const dirME = config["InputDirME"].GetString(); + std::string const dirSecPart = config["InputDirSecPart"].GetString(); + std::string const histoNameCorrSignal = config["InputHistoCorrSignalName"].GetString(); + std::string const histoNameCorrSideba = config["InputHistoCorrSidebaName"].GetString(); + std::string const histoNameCorrSidebaLeft = config["InputHistoCorrSidebaLeftName"].GetString(); + std::string const histoNameCorrSidebaRight = config["InputHistoCorrSidebaRightName"].GetString(); + std::string const histoNameFDTemplatePrompt = config["InputHistoFDTemplatePrompt"].GetString(); + std::string const histoNameFDTemplateNonPrompt = config["InputHistoFDTemplateNonPrompt"].GetString(); + std::string const histoNameRawFracPrompt = config["InputHistoFDPromptFrac"].GetString(); + std::string const histoNamePrimaryPart = config["InputHistoPrimaryPart"].GetString(); + std::string const histoNameAllPart = config["InputHistoAllPart"].GetString(); + + std::vector inputHistoMassName; const Value& inputMassNames = config["InputHistoMassName"]; - parseStringArray(inputMassNames, InputHistoMassName); + parseStringArray(inputMassNames, inputHistoMassName); - std::cout << InputHistoMassName[0].data() << std::endl; - std::cout << InputHistoMassName[1].data() << std::endl; - std::cout << InputHistoMassName[2].data() << std::endl; + std::cout << inputHistoMassName[0].data() << std::endl; + std::cout << inputHistoMassName[1].data() << std::endl; + std::cout << inputHistoMassName[2].data() << std::endl; std::vector binsPtCandIntervals; std::vector binsPtHadIntervals; std::vector deltaEtaInterval; - const Value& PtCandValue = config["binsPtCandIntervals"]; - readArray(PtCandValue, binsPtCandIntervals); + const Value& ptCandValue = config["binsPtCandIntervals"]; + readArray(ptCandValue, binsPtCandIntervals); - const Value& PtHadValue = config["binsPtHadIntervals"]; - readArray(PtHadValue, binsPtHadIntervals); + const Value& ptHadValue = config["binsPtHadIntervals"]; + readArray(ptHadValue, binsPtHadIntervals); const Value& deltaEtaValue = config["deltaEtaInterval"]; readArray(deltaEtaValue, deltaEtaInterval); - double deltaEtaMin = deltaEtaInterval[0]; - double deltaEtaMax = deltaEtaInterval[1]; - - int specie = config["DmesonSpecie"].GetInt(); - bool rebinAngCorr = config["RebinAngCorr"].GetBool(); - bool rebinFDCorr = config["RebinFDCorr"].GetBool(); - bool rebinSecPart = config["RebinSecPart"].GetBool(); - int rebinDeltaPhi = config["nRebinDeltaPhi"].GetInt(); - int rebinDeltaEta = config["nRebinDeltaEta"].GetInt(); - - int npools = config["NumberOfPools"].GetInt(); - bool poolByPool = config["CorrectPoolsSeparately"].GetBool(); - bool applySecPartCorr = config["ApplySecPartCorr"].GetBool(); - bool applyBiasBtoDCorr = config["ApplyBiasBtoDCorr"].GetBool(); - bool applyFDCorr = config["ApplyFDCorr"].GetBool(); - bool isDividedSideb = config["IsDividedSideb"].GetBool(); - bool useSidebLeft = config["UseSidebLeft"].GetBool(); - bool useSidebRight = config["UseSidebRight"].GetBool(); - - if (useSidebLeft && useSidebLeft) { + double const deltaEtaMin = deltaEtaInterval[0]; + double const deltaEtaMax = deltaEtaInterval[1]; + + int const specie = config["DmesonSpecie"].GetInt(); + bool const rebinAngCorr = config["RebinAngCorr"].GetBool(); + bool const rebinFDCorr = config["RebinFDCorr"].GetBool(); + bool const rebinSecPart = config["RebinSecPart"].GetBool(); + int const rebinDeltaPhi = config["nRebinDeltaPhi"].GetInt(); + int const rebinDeltaEta = config["nRebinDeltaEta"].GetInt(); + + int const npools = config["NumberOfPools"].GetInt(); + bool const poolByPool = config["CorrectPoolsSeparately"].GetBool(); + bool const applySecPartCorr = config["ApplySecPartCorr"].GetBool(); + bool const applyBiasBtoDCorr = config["ApplyBiasBtoDCorr"].GetBool(); + bool const applyFDCorr = config["ApplyFDCorr"].GetBool(); + bool const isDividedSideb = config["IsDividedSideb"].GetBool(); + bool const useSidebLeft = config["UseSidebLeft"].GetBool(); + bool const useSidebRight = config["UseSidebRight"].GetBool(); + + if (useSidebLeft && useSidebRight) { std::cout << "Using left and right" << std::endl; } @@ -159,70 +163,78 @@ void ExtractOutputCorrel_Ds(const TString cfgFileName = "config_CorrAnalysis.jso const int nBinsPtHad = binsPtHadIntervals.size() - 1; TH1D* hCorrectedCorrel[nBinsPtCand][nBinsPtHad]; - TH1D* hCorrectedCorrel_BaselineSubtr[nBinsPtCand][nBinsPtHad]; - TH1D* hCorrectedCorrel_Reflected[nBinsPtCand][nBinsPtHad]; - TH1D* hCorrectedCorrel_Reflected_BaselineSubtr[nBinsPtCand][nBinsPtHad]; + TH1D* hCorrectedCorrelBaselineSubtr[nBinsPtCand][nBinsPtHad]; + TH1D* hCorrectedCorrelReflected[nBinsPtCand][nBinsPtHad]; + TH1D* hCorrectedCorrelReflectedBaselineSubtr[nBinsPtCand][nBinsPtHad]; // Create and set the correlation plotter class - DhCorrelationExtraction* plotter = new DhCorrelationExtraction(); - - Bool_t flagSpecie = plotter->SetDmesonSpecie(static_cast(specie)); - plotter->SetNpools(npools); - plotter->SetCorrectPoolsSeparately(poolByPool); // kTRUE = pool.by-pool extraction and correction; kFALSE = merged ME pools - plotter->SetFDSubtraction(applyFDCorr); - plotter->SetSecPartContamination(applySecPartCorr); - plotter->SetDeltaEtaRange(deltaEtaMin, deltaEtaMax); - plotter->SetSubtractSoftPiInMEdistr(kFALSE); - plotter->SetRebinOptions(rebinAngCorr, rebinFDCorr, rebinSecPart); - plotter->SetRebin2DcorrelHisto(rebinDeltaEta, rebinDeltaPhi); // Xaxis: deltaEta, Yaxis: deltaPhi - plotter->SetCorrBiasBtoD(applyBiasBtoDCorr); - plotter->SetDebugLevel(1); - - if (!flagSpecie) + auto* plotter = new DhCorrelationExtraction(); + + Bool_t const flagSpecie = plotter->setDmesonSpecie(static_cast(specie)); + plotter->setNpools(npools); + plotter->setCorrectPoolsSeparately(poolByPool); // kTRUE = pool.by-pool extraction and correction; kFALSE = merged ME pools + plotter->setFdSubtraction(applyFDCorr); + plotter->setSecPartContamination(applySecPartCorr); + plotter->setDeltaEtaRange(deltaEtaMin, deltaEtaMax); + plotter->setSubtractSoftPiInMEdistr(kFALSE); + plotter->setRebinOptions(rebinAngCorr, rebinFDCorr, rebinSecPart); + plotter->setRebin2DcorrelHisto(rebinDeltaEta, rebinDeltaPhi); // Xaxis: deltaEta, Yaxis: deltaPhi + plotter->setCorrBiasBtoD(applyBiasBtoDCorr); + plotter->setDebugLevel(1); + + if (!flagSpecie) { std::cout << "[ERROR] Wrong D meson flag" << std::endl; + } // Set the input file config - SetInputCorrelNames(plotter, pathFileSE, pathFileME, dirSE, dirME, histoNameCorrSignal, histoNameCorrSideba, histoNameCorrSidebaLeft, histoNameCorrSidebaRight); - SetInputHistoInvMassNames(plotter, pathFileMass, InputHistoMassName); - if (applyFDCorr) - SetInputHistoFDSubtraction(plotter, pathFileFDTemplate, pathFileFDPromptFrac, histoNameFDTemplatePrompt, histoNameFDTemplateNonPrompt, histoNameRawFracPrompt); - if (applySecPartCorr) - SetInputHistoSecPart(plotter, pathFileSecPart, dirSecPart, histoNamePrimaryPart, histoNameAllPart); - if (applyBiasBtoDCorr) - SetInputHistoBiasBtoD(plotter, pathfFilePromptMcRec, pathfFileNonPromptMcRec); - Bool_t readSEandME = plotter->ReadInputSEandME(); - if (readSEandME) + setInputCorrelNames(plotter, pathFileSE, pathFileME, dirSE, dirME, histoNameCorrSignal, histoNameCorrSideba, histoNameCorrSidebaLeft, histoNameCorrSidebaRight); + setInputHistoInvMassNames(plotter, pathFileMass, inputHistoMassName); + if (applyFDCorr) { + setInputHistoFdSubtraction(plotter, pathFileFDTemplate, pathFileFDPromptFrac, histoNameFDTemplatePrompt, histoNameFDTemplateNonPrompt, histoNameRawFracPrompt); + } + if (applySecPartCorr) { + setInputHistoSecPart(plotter, pathFileSecPart, dirSecPart, histoNamePrimaryPart, histoNameAllPart); + } + if (applyBiasBtoDCorr) { + setInputHistoBiasBtoD(plotter, pathfFilePromptMcRec, pathfFileNonPromptMcRec); + } + Bool_t const readSEandME = plotter->readInputSeAndMe(); + if (readSEandME) { std::cout << "Files SE and ME read correctly" << std::endl; - Bool_t readInvMass = plotter->ReadInputInvMass(); - if (readInvMass) + } + Bool_t const readInvMass = plotter->readInputInvMass(); + if (readInvMass) { std::cout << "Files inv. mass read correctly" << std::endl; + } if (applyFDCorr) { - Bool_t readFDSubtr = plotter->ReadInputFDSubtr(); - if (readFDSubtr) + Bool_t const readFDSubtr = plotter->readInputFdSubtr(); + if (readFDSubtr) { std::cout << "Files for FD subtr. read correctly" << std::endl; + } } if (applySecPartCorr) { - Bool_t readSecPart = plotter->ReadInputSecondaryPartContamination(); - if (readSecPart) + Bool_t const readSecPart = plotter->readInputSecondaryPartContamination(); + if (readSecPart) { std::cout << "Files for secondary part. contamination read correctly" << std::endl; + } } // Loop over candidate pt and assoc. particle pt for (int iBinPtCand = 0; iBinPtCand < nBinsPtCand; iBinPtCand++) { - plotter->SetDividedSidebands(isDividedSideb, useSidebLeft, useSidebRight); - plotter->GetSignalAndBackgroundForNorm(binsPtCandIntervals[iBinPtCand], binsPtCandIntervals[iBinPtCand + 1]); + plotter->setDividedSidebands(isDividedSideb, useSidebLeft, useSidebRight); + plotter->getSignalAndBackgroundForNorm(binsPtCandIntervals[iBinPtCand], binsPtCandIntervals[iBinPtCand + 1]); for (int iBinPtHad = 0; iBinPtHad < nBinsPtHad; iBinPtHad++) { - plotter->SetBinCandAndHad(iBinPtCand + 1, iBinPtHad + 1); - plotter->ExtractCorrelations(binsPtCandIntervals[iBinPtCand], binsPtCandIntervals[iBinPtCand + 1], binsPtHadIntervals[iBinPtHad], binsPtHadIntervals[iBinPtHad + 1], CodeNameAnalysis); - hCorrectedCorrel[iBinPtCand][iBinPtHad] = (TH1D*)plotter->GetCorrectedCorrHisto(); - hCorrectedCorrel_BaselineSubtr[iBinPtCand][iBinPtHad] = (TH1D*)plotter->GetCorrectedCorrHisto_BaselineSubtr(); - hCorrectedCorrel_Reflected[iBinPtCand][iBinPtHad] = (TH1D*)plotter->GetCorrectedCorrHisto_Reflected(); - hCorrectedCorrel_Reflected_BaselineSubtr[iBinPtCand][iBinPtHad] = (TH1D*)plotter->GetCorrectedCorrHisto_Reflected_BaselineSubtr(); + plotter->setBinCandAndHad(iBinPtCand + 1, iBinPtHad + 1); + plotter->extractCorrelations(binsPtCandIntervals[iBinPtCand], binsPtCandIntervals[iBinPtCand + 1], binsPtHadIntervals[iBinPtHad], binsPtHadIntervals[iBinPtHad + 1], codeNameAnalysis); + hCorrectedCorrel[iBinPtCand][iBinPtHad] = plotter->getCorrectedCorrHisto(); + hCorrectedCorrelBaselineSubtr[iBinPtCand][iBinPtHad] = plotter->getCorrectedCorrHistoBaselineSubtr(); + hCorrectedCorrelReflected[iBinPtCand][iBinPtHad] = plotter->getCorrectedCorrHistoReflected(); + hCorrectedCorrelReflectedBaselineSubtr[iBinPtCand][iBinPtHad] = plotter->getCorrectedCorrHistoReflectedBaselineSubtr(); } } // output file - TFile* outFile = new TFile(Form("Output_CorrelationExtraction_%s_Root/ExtractCorrelationsResults.root", CodeNameAnalysis.data()), "RECREATE"); + auto* outFile = new TFile(Form("Output_CorrelationExtraction_%s_Root/ExtractCorrelationsResults.root", codeNameAnalysis.data()), "RECREATE"); outFile->cd(); for (int iBinPtCand = 0; iBinPtCand < nBinsPtCand; iBinPtCand++) { for (int iBinPtHad = 0; iBinPtHad < nBinsPtHad; iBinPtHad++) { @@ -232,95 +244,83 @@ void ExtractOutputCorrel_Ds(const TString cfgFileName = "config_CorrAnalysis.jso outFile->Close(); // output file baseline subtr. - TFile* outFile_BaselineSubtr = new TFile(Form("Output_CorrelationExtraction_%s_Root/ExtractCorrelationsResults_BaselineSubtr.root", CodeNameAnalysis.data()), "RECREATE"); - outFile_BaselineSubtr->cd(); + auto* outFileBaselineSubtr = new TFile(Form("Output_CorrelationExtraction_%s_Root/ExtractCorrelationsResults_BaselineSubtr.root", codeNameAnalysis.data()), "RECREATE"); + outFileBaselineSubtr->cd(); for (int iBinPtCand = 0; iBinPtCand < nBinsPtCand; iBinPtCand++) { for (int iBinPtHad = 0; iBinPtHad < nBinsPtHad; iBinPtHad++) { - hCorrectedCorrel_BaselineSubtr[iBinPtCand][iBinPtHad]->Write(); + hCorrectedCorrelBaselineSubtr[iBinPtCand][iBinPtHad]->Write(); } } - outFile_BaselineSubtr->Close(); + outFileBaselineSubtr->Close(); // output file reflected - TFile* outFile_Reflected = new TFile(Form("Output_CorrelationExtraction_%s_Root/ExtractCorrelationsResults_Reflected.root", CodeNameAnalysis.data()), "RECREATE"); - outFile_Reflected->cd(); + auto* outFileReflected = new TFile(Form("Output_CorrelationExtraction_%s_Root/ExtractCorrelationsResults_Reflected.root", codeNameAnalysis.data()), "RECREATE"); + outFileReflected->cd(); for (int iBinPtCand = 0; iBinPtCand < nBinsPtCand; iBinPtCand++) { for (int iBinPtHad = 0; iBinPtHad < nBinsPtHad; iBinPtHad++) { - hCorrectedCorrel_Reflected[iBinPtCand][iBinPtHad]->Write(); + hCorrectedCorrelReflected[iBinPtCand][iBinPtHad]->Write(); } } - outFile_Reflected->Close(); + outFileReflected->Close(); // output file reflected baseline subtr. - TFile* outFile_Reflected_BaselineSubtr = new TFile(Form("Output_CorrelationExtraction_%s_Root/ExtractCorrelationsResults_Reflected_BaselineSubtr.root", CodeNameAnalysis.data()), "RECREATE"); - outFile_Reflected_BaselineSubtr->cd(); + auto* outFileReflectedBaselineSubtr = new TFile(Form("Output_CorrelationExtraction_%s_Root/ExtractCorrelationsResults_Reflected_BaselineSubtr.root", codeNameAnalysis.data()), "RECREATE"); + outFileReflectedBaselineSubtr->cd(); for (int iBinPtCand = 0; iBinPtCand < nBinsPtCand; iBinPtCand++) { for (int iBinPtHad = 0; iBinPtHad < nBinsPtHad; iBinPtHad++) { - hCorrectedCorrel_Reflected_BaselineSubtr[iBinPtCand][iBinPtHad]->Write(); + hCorrectedCorrelReflectedBaselineSubtr[iBinPtCand][iBinPtHad]->Write(); } } - outFile_Reflected_BaselineSubtr->Close(); - - return; + outFileReflectedBaselineSubtr->Close(); } -void SetInputCorrelNames(DhCorrelationExtraction* plotter, TString pathFileSE, TString pathFileME, TString dirSE, TString dirME, TString histoNameCorrSignal, TString histoNameCorrSideba, TString histoNameCorrSidebaLeft, TString histoNameCorrSidebaRight) +void setInputCorrelNames(DhCorrelationExtraction* plotter, TString pathFileSE, TString pathFileME, TString dirSE, TString dirME, TString histoNameCorrSignal, TString histoNameCorrSideba, TString histoNameCorrSidebaLeft, TString histoNameCorrSidebaRight) { // Ds paths - plotter->SetInputFilenameSE(pathFileSE.Data()); - plotter->SetInputFilenameME(pathFileME.Data()); - plotter->SetDirNameSE(dirSE.Data()); - plotter->SetDirNameME(dirME.Data()); - plotter->SetSECorrelHistoSignalName(histoNameCorrSignal.Data()); - plotter->SetSECorrelHistoSidebandName(histoNameCorrSideba.Data()); - plotter->SetMECorrelHistoSignalName(histoNameCorrSignal.Data()); - plotter->SetMECorrelHistoSidebandName(histoNameCorrSideba.Data()); - plotter->SetSECorrelHistoSidebandLeftName(histoNameCorrSidebaLeft.Data()); - plotter->SetMECorrelHistoSidebandLeftName(histoNameCorrSidebaLeft.Data()); - plotter->SetSECorrelHistoSidebandRightName(histoNameCorrSidebaRight.Data()); - plotter->SetMECorrelHistoSidebandRightName(histoNameCorrSidebaRight.Data()); - - return; + plotter->setInputFilenameSe(pathFileSE.Data()); + plotter->setInputFilenameMe(pathFileME.Data()); + plotter->setDirNameSe(dirSE.Data()); + plotter->setDirNameMe(dirME.Data()); + plotter->setSeCorrelHistoSignalName(histoNameCorrSignal.Data()); + plotter->setSeCorrelHistoSidebandName(histoNameCorrSideba.Data()); + plotter->setMeCorrelHistoSignalName(histoNameCorrSignal.Data()); + plotter->setMeCorrelHistoSidebandName(histoNameCorrSideba.Data()); + plotter->setSeCorrelHistoSidebandLeftName(histoNameCorrSidebaLeft.Data()); + plotter->setMeCorrelHistoSidebandLeftName(histoNameCorrSidebaLeft.Data()); + plotter->setSeCorrelHistoSidebandRightName(histoNameCorrSidebaRight.Data()); + plotter->setMeCorrelHistoSidebandRightName(histoNameCorrSidebaRight.Data()); } -void SetInputHistoInvMassNames(DhCorrelationExtraction* plotter, TString pathFileMass, std::vector inputMassNames) +void setInputHistoInvMassNames(DhCorrelationExtraction* plotter, TString pathFileMass, std::vector inputMassNames) { // to use if sgn and bkg extraction is done apart - plotter->SetInputFilenameMass(pathFileMass.Data()); - plotter->SetMassHistoNameSgn(inputMassNames[0].data()); - plotter->SetMassHistoNameBkg(inputMassNames[1].data()); - plotter->SetMassHistoNameSBs(inputMassNames[2].data()); - - return; + plotter->setInputFilenameMass(pathFileMass.Data()); + plotter->setMassHistoNameSgn(inputMassNames[0].data()); + plotter->setMassHistoNameBkg(inputMassNames[1].data()); + plotter->setMassHistoNameSBs(inputMassNames[2].data()); } -void SetInputHistoFDSubtraction(DhCorrelationExtraction* plotter, TString pathFileFDTemplate, TString pathFileFDPromptFrac, TString histoNameFDTemplatePrompt, TString histoNameFDTemplateNonPrompt, TString histoNameRawFracPrompt) +void setInputHistoFdSubtraction(DhCorrelationExtraction* plotter, TString pathFileFDTemplate, TString pathFileFDPromptFrac, TString histoNameFDTemplatePrompt, TString histoNameFDTemplateNonPrompt, TString histoNameRawFracPrompt) { - plotter->SetInputFilenameFDTemplate(pathFileFDTemplate.Data()); - plotter->SetInputFilenameFDPromptFrac(pathFileFDPromptFrac.Data()); - plotter->SetInputHistoNameFDTemplatePrompt(histoNameFDTemplatePrompt.Data()); - plotter->SetInputHistoNameFDTemplateNonPrompt(histoNameFDTemplateNonPrompt.Data()); - plotter->SetInputHistoNameFDPromptFrac(histoNameRawFracPrompt.Data()); - - return; + plotter->setInputFilenameFdTemplate(pathFileFDTemplate.Data()); + plotter->setInputFilenameFdPromptFrac(pathFileFDPromptFrac.Data()); + plotter->setInputHistoNameFdTemplatePrompt(histoNameFDTemplatePrompt.Data()); + plotter->setInputHistoNameFdTemplateNonPrompt(histoNameFDTemplateNonPrompt.Data()); + plotter->setInputHistoNameFdPromptFrac(histoNameRawFracPrompt.Data()); } -void SetInputHistoSecPart(DhCorrelationExtraction* plotter, TString pathFileSecPart, TString dirSecPartName, TString histoNamePrimaryPart, TString histoNameAllPart) +void setInputHistoSecPart(DhCorrelationExtraction* plotter, TString pathFileSecPart, TString dirSecPartName, TString histoNamePrimaryPart, TString histoNameAllPart) { - plotter->SetInputFilenameSecPart(pathFileSecPart.Data()); - plotter->SetDirNameSecPart(dirSecPartName.Data()); - plotter->SetHistoSecPartName(histoNamePrimaryPart.Data(), histoNameAllPart.Data()); - - return; + plotter->setInputFilenameSecPart(pathFileSecPart.Data()); + plotter->setDirNameSecPart(dirSecPartName.Data()); + plotter->setHistoSecPartName(histoNamePrimaryPart.Data(), histoNameAllPart.Data()); } -void SetInputHistoBiasBtoD(DhCorrelationExtraction* plotter, TString pathfFilePromptMcRec, TString pathfFileNonPromptMcRec) +void setInputHistoBiasBtoD(DhCorrelationExtraction* plotter, TString pathfFilePromptMcRec, TString pathfFileNonPromptMcRec) { - plotter->SetInputFilenameBiasBtoD(pathfFilePromptMcRec.Data(), pathfFileNonPromptMcRec.Data()); - - return; + plotter->setInputFilenameBiasBtoD(pathfFilePromptMcRec.Data(), pathfFileNonPromptMcRec.Data()); } diff --git a/PWGHF/HFC/Macros/FitCorrel.C b/PWGHF/HFC/Macros/FitCorrel.C index 7c1d64ea823..11e5b0c5742 100644 --- a/PWGHF/HFC/Macros/FitCorrel.C +++ b/PWGHF/HFC/Macros/FitCorrel.C @@ -15,19 +15,26 @@ /// \author Swapnesh Santosh Khade #include "DhCorrelationFitter.h" -#include "Riostream.h" +#include +#include #include -#include +#include +#include #include #include #include +#include #include #include +#include #include #include +#include +#include + #include #include #include @@ -41,24 +48,24 @@ bool removeNSPeakLowPt = false; template void readArray(const Value& jsonArray, vector& output) { - for (auto it = jsonArray.Begin(); it != jsonArray.End(); it++) { + for (const auto* it = jsonArray.Begin(); it != jsonArray.End(); it++) { auto value = it->template Get(); output.emplace_back(value); } } -void SetTH1HistoStyle(TH1D*& histo, TString hTitle, TString hXaxisTitle, TString hYaxisTitle, +void setTH1HistoStyle(TH1D*& histo, TString hTitle, TString hXaxisTitle, TString hYaxisTitle, Style_t markerStyle, Color_t markerColor, Double_t markerSize, Color_t lineColor, Int_t lineWidth, Float_t hTitleXaxisOffset = 1.3, Float_t hTitleYaxisOffset = 1.3, Float_t hTitleXaxisSize = 0.045, Float_t hTitleYaxisSize = 0.045, Float_t hLabelXaxisSize = 0.045, Float_t hLabelYaxisSize = 0.045, Bool_t centerXaxisTitle = false, Bool_t centerYaxisTitle = false); -void SetTH1HistoStyle(TH1F*& histo, TString hTitle, TString hXaxisTitle, TString hYaxisTitle, +void setTH1HistoStyle(TH1F*& histo, TString hTitle, TString hXaxisTitle, TString hYaxisTitle, Style_t markerStyle, Color_t markerColor, Double_t markerSize, Color_t lineColor, Int_t lineWidth, Float_t hTitleXaxisOffset = 1.3, Float_t hTitleYaxisOffset = 1.3, Float_t hTitleXaxisSize = 0.045, Float_t hTitleYaxisSize = 0.045, Float_t hLabelXaxisSize = 0.045, Float_t hLabelYaxisSize = 0.045, Bool_t centerXaxisTitle = false, Bool_t centerYaxisTitle = false); -void FitCorrel_Ds(const TString cfgFileName = "config_CorrAnalysis.json") +void fitCorrelDs(const TString cfgFileName = "config_CorrAnalysis.json") { gStyle->SetOptStat(0); gStyle->SetPadLeftMargin(0.2); @@ -77,28 +84,28 @@ void FitCorrel_Ds(const TString cfgFileName = "config_CorrAnalysis.json") config.ParseStream(is); fclose(configFile); - string CodeNameAnalysis = config["CodeName"].GetString(); - gSystem->Exec(Form("rm -rf Output_CorrelationFitting_%s_Root/ Output_CorrelationFitting_%s_png/", CodeNameAnalysis.data(), CodeNameAnalysis.data())); - gSystem->Exec(Form("mkdir Output_CorrelationFitting_%s_Root/ Output_CorrelationFitting_%s_png/", CodeNameAnalysis.data(), CodeNameAnalysis.data())); + string codeNameAnalysis = config["CodeName"].GetString(); + gSystem->Exec(Form("rm -rf Output_CorrelationFitting_%s_Root/ Output_CorrelationFitting_%s_png/", codeNameAnalysis.data(), codeNameAnalysis.data())); + gSystem->Exec(Form("mkdir Output_CorrelationFitting_%s_Root/ Output_CorrelationFitting_%s_png/", codeNameAnalysis.data(), codeNameAnalysis.data())); string inputFileNameFit = config["InputFileNameFitCorr"].GetString(); - const TString inFileName = Form("Output_CorrelationExtraction_%s_Root/%s", CodeNameAnalysis.data(), inputFileNameFit.data()); + const TString inFileName = Form("Output_CorrelationExtraction_%s_Root/%s", codeNameAnalysis.data(), inputFileNameFit.data()); - bool isReflected = config["IsRiflected"].GetBool(); - bool drawSystematicErrors = config["DrawSystematics"].GetBool(); - bool sameSystematics = config["SameSystematics"].GetBool(); - bool shiftBaseUp = config["ShiftBaseUp"].GetBool(); - bool shiftBaseDown = config["ShiftBaseDown"].GetBool(); + bool const isReflected = config["IsRiflected"].GetBool(); + bool const drawSystematicErrors = config["DrawSystematics"].GetBool(); + bool const sameSystematics = config["SameSystematics"].GetBool(); + bool const shiftBaseUp = config["ShiftBaseUp"].GetBool(); + bool const shiftBaseDown = config["ShiftBaseDown"].GetBool(); std::vector binsPtCandIntervalsVec; std::vector binsPtHadIntervals; std::vector fitFunc; - const Value& PtCandValue = config["binsPtCandIntervals"]; - readArray(PtCandValue, binsPtCandIntervalsVec); + const Value& ptCandValue = config["binsPtCandIntervals"]; + readArray(ptCandValue, binsPtCandIntervalsVec); - const Value& PtHadValue = config["binsPtHadIntervals"]; - readArray(PtHadValue, binsPtHadIntervals); + const Value& ptHadValue = config["binsPtHadIntervals"]; + readArray(ptHadValue, binsPtHadIntervals); const int nBinsPtCand = binsPtCandIntervalsVec.size() - 1; const int nBinsPtHad = binsPtHadIntervals.size() - 1; @@ -108,13 +115,13 @@ void FitCorrel_Ds(const TString cfgFileName = "config_CorrAnalysis.json") binsPtCandIntervals[i] = binsPtCandIntervalsVec[i]; } - const Value& FitFuncValue = config["FitFunction"]; - readArray(FitFuncValue, fitFunc); + const Value& fitFuncValue = config["FitFunction"]; + readArray(fitFuncValue, fitFunc); - int fixBase = config["FixBaseline"].GetInt(); - int fixMean = config["FixMean"].GetInt(); + int const fixBase = config["FixBaseline"].GetInt(); + int const fixMean = config["FixMean"].GetInt(); - int nBaselinePoints = config["nBaselinePoints"].GetInt(); + int const nBaselinePoints = config["nBaselinePoints"].GetInt(); vector pointsForBaselineVec; const Value& pointsForBaselineValue = config["binsForBaseline"]; readArray(pointsForBaselineValue, pointsForBaselineVec); @@ -138,15 +145,15 @@ void FitCorrel_Ds(const TString cfgFileName = "config_CorrAnalysis.json") std::cout << " " << std::endl; // TODO: reflections - bool refl = false; + bool const refl = false; // Input file - TFile* inFile = new TFile(inFileName.Data()); - TFile* inFileSystematicErrors = new TFile("OutputSystematicUncertainties/SystematicUncertaintesAngCorrMerged.root"); - TFile* inFileFitSystematicErrors = new TFile("OutputSystematicUncertainties/SystematicUncertaintesFitPhysObsMerged.root"); + auto* inFile = new TFile(inFileName.Data()); + auto* inFileSystematicErrors = new TFile("OutputSystematicUncertainties/SystematicUncertaintesAngCorrMerged.root"); + auto* inFileFitSystematicErrors = new TFile("OutputSystematicUncertainties/SystematicUncertaintesFitPhysObsMerged.root"); // Canvas - TCanvas* CanvasCorrPhi[nBinsPtHad]; + TCanvas* canvasCorrPhi[nBinsPtHad]; // Histograms TH1D* hCorrPhi[nBinsPtCand][nBinsPtHad]; @@ -158,7 +165,7 @@ void FitCorrel_Ds(const TString cfgFileName = "config_CorrAnalysis.json") std::cout << "[ERROR]: nBinsPtD != nBinsPtCand" << std::endl; return; } - double SystUncCorrelatedDs[nBinsPtD] = {20, 20, 20, 10}; // % (just the MC Closure uncertainty to put in the plot) + double const systUncCorrelatedDs[nBinsPtD] = {20, 20, 20, 10}; // % (just the MC Closure uncertainty to put in the plot) // DhCorrelationFitter const double fMin{-0.5 * TMath::Pi()}, fMax{1.5 * TMath::Pi()}; // limits for the fitting function @@ -170,8 +177,8 @@ void FitCorrel_Ds(const TString cfgFileName = "config_CorrAnalysis.json") Double_t lowBounds[npars] = {0., 0., -1., 0., 0., 2., 0., 0.5, 0., 0.}; Double_t uppBounds[npars] = {9999., 999., 1., 3.14 / 3., 999., 4., 3.14 / 2., 3.5, 0.5, 0.5}; - Double_t v2AssocPart[nBinsPtD] = {0.15, 0.15, 0.15, 0.15}; - Double_t v2Dmeson[nBinsPtD] = {0.175, 0.09, 0.04, 0.04}; + Double_t const v2AssocPart[nBinsPtD] = {0.15, 0.15, 0.15, 0.15}; + Double_t const v2Dmeson[nBinsPtD] = {0.175, 0.09, 0.04, 0.04}; // Output histograms TH1D* hBaselin[nBinsPtHad]; @@ -193,27 +200,27 @@ void FitCorrel_Ds(const TString cfgFileName = "config_CorrAnalysis.json") } corrFitter[iBinPtHad][iBinPtCand] = new DhCorrelationFitter(reinterpret_cast(hCorrPhi[iBinPtCand][iBinPtHad]), fMin, fMax); - corrFitter[iBinPtHad][iBinPtCand]->SetHistoIsReflected(refl); - corrFitter[iBinPtHad][iBinPtCand]->SetFixBaseline(fixBase); - corrFitter[iBinPtHad][iBinPtCand]->SetBaselineUpOrDown(shiftBaseUp, shiftBaseDown); - corrFitter[iBinPtHad][iBinPtCand]->SetPointsForBaseline(nBaselinePoints, pointsForBaseline); - corrFitter[iBinPtHad][iBinPtCand]->Setv2(v2AssocPart[iBinPtCand], v2Dmeson[iBinPtCand]); - corrFitter[iBinPtHad][iBinPtCand]->SetReflectedCorrHisto(isReflected); - - corrFitter[iBinPtHad][iBinPtCand]->SetFixMean(fixMean); - corrFitter[iBinPtHad][iBinPtCand]->SetPtRanges(binsPtCandIntervals[iBinPtCand], binsPtCandIntervals[iBinPtCand + 1], binsPtHadIntervals[iBinPtHad], binsPtHadIntervals[iBinPtHad + 1]); - corrFitter[iBinPtHad][iBinPtCand]->SetExternalValsAndBounds(npars, vals, lowBounds, uppBounds); // these are starting points and limits... + corrFitter[iBinPtHad][iBinPtCand]->setHistoIsReflected(refl); + corrFitter[iBinPtHad][iBinPtCand]->setFixBaseline(fixBase); + corrFitter[iBinPtHad][iBinPtCand]->setBaselineUpOrDown(shiftBaseUp, shiftBaseDown); + corrFitter[iBinPtHad][iBinPtCand]->setPointsForBaseline(nBaselinePoints, pointsForBaseline); + corrFitter[iBinPtHad][iBinPtCand]->setv2(v2AssocPart[iBinPtCand], v2Dmeson[iBinPtCand]); + corrFitter[iBinPtHad][iBinPtCand]->setReflectedCorrHisto(isReflected); + + corrFitter[iBinPtHad][iBinPtCand]->setFixMean(fixMean); + corrFitter[iBinPtHad][iBinPtCand]->setPtRanges(binsPtCandIntervals[iBinPtCand], binsPtCandIntervals[iBinPtCand + 1], binsPtHadIntervals[iBinPtHad], binsPtHadIntervals[iBinPtHad + 1]); + corrFitter[iBinPtHad][iBinPtCand]->setExternalValsAndBounds(npars, vals, lowBounds, uppBounds); // these are starting points and limits... } } // Plots and fit for (int iBinPtHad = 0; iBinPtHad < nBinsPtHad; iBinPtHad++) { - CanvasCorrPhi[iBinPtHad] = new TCanvas(Form("CanvasCorrPhi_PtBinAssoc%d", iBinPtHad + 1), Form("CorrPhiDs_PtBinAssoc%d", iBinPtHad + 1)); + canvasCorrPhi[iBinPtHad] = new TCanvas(Form("CanvasCorrPhi_PtBinAssoc%d", iBinPtHad + 1), Form("CorrPhiDs_PtBinAssoc%d", iBinPtHad + 1)); if (nBinsPtCand <= 4) { - CanvasCorrPhi[iBinPtHad]->Divide(2, 2); + canvasCorrPhi[iBinPtHad]->Divide(2, 2); } if (nBinsPtCand > 4 && nBinsPtCand <= 6) { - CanvasCorrPhi[iBinPtHad]->Divide(3, 2); + canvasCorrPhi[iBinPtHad]->Divide(3, 2); } // histograms with fir parameters hBaselin[iBinPtHad] = new TH1D(Form("hBaselin_PtBinAssoc%d", iBinPtHad + 1), "", nBinsPtCand, binsPtCandIntervals); @@ -226,17 +233,17 @@ void FitCorrel_Ds(const TString cfgFileName = "config_CorrAnalysis.json") hASYieldBinCount[iBinPtHad] = new TH1D(Form("hASYieldBinCount_PtBinAssoc%d", iBinPtHad + 1), "", nBinsPtCand, binsPtCandIntervals); for (int iBinPtCand = 0; iBinPtCand < nBinsPtCand; iBinPtCand++) { - SetTH1HistoStyle(hCorrPhi[iBinPtCand][iBinPtHad], "", "#Delta#phi [rad]", "#frac{1}{N_{D_{s}}}#frac{dN^{assoc}}{d#Delta#phi} [rad^{-1}]", kFullCircle, kRed + 1, 1.4, kRed + 1, 3); + setTH1HistoStyle(hCorrPhi[iBinPtCand][iBinPtHad], "", "#Delta#phi [rad]", "#frac{1}{N_{D_{s}}}#frac{dN^{assoc}}{d#Delta#phi} [rad^{-1}]", kFullCircle, kRed + 1, 1.4, kRed + 1, 3); - CanvasCorrPhi[iBinPtHad]->cd(iBinPtCand + 1); - CanvasCorrPhi[iBinPtHad]->SetTickx(); - CanvasCorrPhi[iBinPtHad]->SetTicky(); - hCorrPhi[iBinPtCand][iBinPtHad]->SetStats(0); + canvasCorrPhi[iBinPtHad]->cd(iBinPtCand + 1); + canvasCorrPhi[iBinPtHad]->SetTickx(); + canvasCorrPhi[iBinPtHad]->SetTicky(); + hCorrPhi[iBinPtCand][iBinPtHad]->SetStats(false); hCorrPhi[iBinPtCand][iBinPtHad]->SetMinimum(0); // hCorrPhi[iBinPtCand][iBinPtHad] -> Draw(); // draw systematic errors - int nBinsPhi = hCorrPhi[iBinPtCand][iBinPtHad]->GetNbinsX(); + int const nBinsPhi = hCorrPhi[iBinPtCand][iBinPtHad]->GetNbinsX(); if (drawSystematicErrors) { hSystematicErrors[iBinPtCand][iBinPtHad] = reinterpret_cast(inFileSystematicErrors->Get(Form("hSystematicErrorsMerged_PtBin%d_PtBinAssoc%d", iBinPtCand + 1, iBinPtHad + 1))); hSystematicErrorsPlot[iBinPtCand][iBinPtHad] = reinterpret_cast(hCorrPhi[iBinPtCand][iBinPtHad]->Clone(Form("hSystematicErrorsPlot_PtBin%d_PtBinAssoc%d", iBinPtCand + 1, iBinPtHad + 1))); @@ -248,7 +255,7 @@ void FitCorrel_Ds(const TString cfgFileName = "config_CorrAnalysis.json") } hSystematicErrorsPlot[iBinPtCand][iBinPtHad]->SetBinContent(iPhi + 1, hCorrPhi[iBinPtCand][iBinPtHad]->GetBinContent(iPhi + 1)); } - SetTH1HistoStyle(hSystematicErrorsPlot[iBinPtCand][iBinPtHad], "", "#Delta#phi [rad]", "#frac{1}{N_{D_{s}}}#frac{dN^{assoc}}{d#Delta#phi} [rad^{-1}]", kFullCircle, kRed + 1, 1.4, kRed + 1, 2); + setTH1HistoStyle(hSystematicErrorsPlot[iBinPtCand][iBinPtHad], "", "#Delta#phi [rad]", "#frac{1}{N_{D_{s}}}#frac{dN^{assoc}}{d#Delta#phi} [rad^{-1}]", kFullCircle, kRed + 1, 1.4, kRed + 1, 2); hSystematicErrorsPlot[iBinPtCand][iBinPtHad]->SetLineColor(kRed - 4); hSystematicErrorsPlot[iBinPtCand][iBinPtHad]->SetFillStyle(0); // hSystematicErrorsPlot[iBinPtCand][iBinPtHad] -> Draw("E2same"); @@ -256,21 +263,21 @@ void FitCorrel_Ds(const TString cfgFileName = "config_CorrAnalysis.json") // hCorrPhi[iBinPtCand][iBinPtHad] -> Draw("same"); // Fit - corrFitter[iBinPtHad][iBinPtCand]->SetFuncType(static_cast(fitFunc[iBinPtCand])); - corrFitter[iBinPtHad][iBinPtCand]->Fitting(kTRUE, kTRUE); // the first term is for drawing the fit functions, the second argument is useExternalParams + corrFitter[iBinPtHad][iBinPtCand]->setFuncType(static_cast(fitFunc[iBinPtCand])); + corrFitter[iBinPtHad][iBinPtCand]->fitting(kTRUE, kTRUE); // the first term is for drawing the fit functions, the second argument is useExternalParams - TF1* fFit = corrFitter[iBinPtHad][iBinPtCand]->GetFitFunction(); + TF1* fFit = corrFitter[iBinPtHad][iBinPtCand]->getFitFunction(); // Title of the histogram - TPaveText* pttext = new TPaveText(0.15, 0.9, 0.85, 0.95, "NDC"); + auto* pttext = new TPaveText(0.15, 0.9, 0.85, 0.95, "NDC"); pttext->SetFillStyle(0); pttext->SetBorderSize(0); TText* tpT = pttext->AddText(0., 0.8, Form("%.0f < p_{T}^{D_{s}} < %.0f GeV/c, p_{T}^{assoc} > %.1f GeV/c", binsPtCandIntervals[iBinPtCand], binsPtCandIntervals[iBinPtCand + 1], binsPtHadIntervals[iBinPtHad])); // pttext -> Draw("same"); // Fill the histograms with the fit parameters - hBaselin[iBinPtHad]->SetBinContent(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetPedestal()); - hBaselin[iBinPtHad]->SetBinError(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetPedestalError()); + hBaselin[iBinPtHad]->SetBinContent(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->getPedestal()); + hBaselin[iBinPtHad]->SetBinError(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->getPedestalError()); if (iBinPtCand == 0 && removeNSPeakLowPt) { hNSYield[iBinPtHad]->SetBinContent(iBinPtCand + 1, -1); hNSYield[iBinPtHad]->SetBinError(iBinPtCand + 1, 0); @@ -281,50 +288,50 @@ void FitCorrel_Ds(const TString cfgFileName = "config_CorrAnalysis.json") hBeta[iBinPtHad]->SetBinContent(iBinPtCand + 1, -1); hBeta[iBinPtHad]->SetBinError(iBinPtCand + 1, 0); } else { - hNSYield[iBinPtHad]->SetBinContent(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetNSYield()); - hNSYield[iBinPtHad]->SetBinError(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetNSYieldError()); + hNSYield[iBinPtHad]->SetBinContent(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->getNsYield()); + hNSYield[iBinPtHad]->SetBinError(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->getNsYieldError()); if (fitFunc[iBinPtCand] != 5 && fitFunc[iBinPtCand] != 6) { - hNSSigma[iBinPtHad]->SetBinContent(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetNSSigma()); - hNSSigma[iBinPtHad]->SetBinError(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetNSSigmaError()); + hNSSigma[iBinPtHad]->SetBinContent(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->getNsSigma()); + hNSSigma[iBinPtHad]->SetBinError(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->getNsSigmaError()); } else { - hNSSigma[iBinPtHad]->SetBinContent(iBinPtCand + 1, TMath::Sqrt(1. / corrFitter[iBinPtHad][iBinPtCand]->GetNSSigma())); - Double_t errrel = corrFitter[iBinPtHad][iBinPtCand]->GetNSSigmaError() / corrFitter[iBinPtHad][iBinPtCand]->GetNSSigma() / 2.; - hNSSigma[iBinPtHad]->SetBinError(iBinPtCand + 1, errrel * TMath::Sqrt(1. / corrFitter[iBinPtHad][iBinPtCand]->GetNSSigma())); + hNSSigma[iBinPtHad]->SetBinContent(iBinPtCand + 1, TMath::Sqrt(1. / corrFitter[iBinPtHad][iBinPtCand]->getNsSigma())); + Double_t const errrel = corrFitter[iBinPtHad][iBinPtCand]->getNsSigmaError() / corrFitter[iBinPtHad][iBinPtCand]->getNsSigma() / 2.; + hNSSigma[iBinPtHad]->SetBinError(iBinPtCand + 1, errrel * TMath::Sqrt(1. / corrFitter[iBinPtHad][iBinPtCand]->getNsSigma())); } } - hNSYieldBinCount[iBinPtHad]->SetBinContent(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetBinCountingNSYield()); - hNSYieldBinCount[iBinPtHad]->SetBinError(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetBinCountingNSYieldErr()); + hNSYieldBinCount[iBinPtHad]->SetBinContent(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->getBinCountingNsYield()); + hNSYieldBinCount[iBinPtHad]->SetBinError(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->getBinCountingNsYieldErr()); - hASYield[iBinPtHad]->SetBinContent(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetASYield()); - hASYield[iBinPtHad]->SetBinError(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetASYieldError()); + hASYield[iBinPtHad]->SetBinContent(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->getAsYield()); + hASYield[iBinPtHad]->SetBinError(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->getAsYieldError()); - hASYieldBinCount[iBinPtHad]->SetBinContent(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetBinCountingASYield()); - hASYieldBinCount[iBinPtHad]->SetBinError(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetBinCountingASYieldErr()); + hASYieldBinCount[iBinPtHad]->SetBinContent(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->getBinCountingAsYield()); + hASYieldBinCount[iBinPtHad]->SetBinError(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->getBinCountingAsYieldErr()); if (fitFunc[iBinPtCand] != 5 && fitFunc[iBinPtCand] != 6) { - hASSigma[iBinPtHad]->SetBinContent(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetASSigma()); - hASSigma[iBinPtHad]->SetBinError(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetASSigmaError()); + hASSigma[iBinPtHad]->SetBinContent(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->getAsSigma()); + hASSigma[iBinPtHad]->SetBinError(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->getAsSigmaError()); } else { - hASSigma[iBinPtHad]->SetBinContent(iBinPtCand + 1, TMath::Sqrt(1. / corrFitter[iBinPtHad][iBinPtCand]->GetASSigma())); - Double_t errrel = corrFitter[iBinPtHad][iBinPtCand]->GetASSigmaError() / corrFitter[iBinPtHad][iBinPtCand]->GetASSigma() / 2.; - hASSigma[iBinPtHad]->SetBinError(iBinPtCand + 1, errrel * TMath::Sqrt(1. / corrFitter[iBinPtHad][iBinPtCand]->GetASSigma())); + hASSigma[iBinPtHad]->SetBinContent(iBinPtCand + 1, TMath::Sqrt(1. / corrFitter[iBinPtHad][iBinPtCand]->getAsSigma())); + Double_t const errrel = corrFitter[iBinPtHad][iBinPtCand]->getAsSigmaError() / corrFitter[iBinPtHad][iBinPtCand]->getAsSigma() / 2.; + hASSigma[iBinPtHad]->SetBinError(iBinPtCand + 1, errrel * TMath::Sqrt(1. / corrFitter[iBinPtHad][iBinPtCand]->getAsSigma())); } if (fitFunc[iBinPtCand] == 4) { // param beta for gen. gauss - hBeta[iBinPtHad]->SetBinContent(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetBeta()); - hBeta[iBinPtHad]->SetBinError(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->GetBetaError()); + hBeta[iBinPtHad]->SetBinContent(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->getBeta()); + hBeta[iBinPtHad]->SetBinError(iBinPtCand + 1, corrFitter[iBinPtHad][iBinPtCand]->getBetaError()); } // Draw - TPaveText* tCorrUncDs = new TPaveText(0.413, 0.311, 0.877, 0.392, "NDC"); + auto* tCorrUncDs = new TPaveText(0.413, 0.311, 0.877, 0.392, "NDC"); tCorrUncDs->SetFillStyle(0); tCorrUncDs->SetBorderSize(0); tCorrUncDs->SetTextSize(0.05); tCorrUncDs->SetTextFont(42); tCorrUncDs->SetTextAlign(13); tCorrUncDs->SetTextColor(kRed + 1); - tCorrUncDs->AddText(0., 0., Form("#splitline{+%.0f%%}{#minus%.0f%%}", SystUncCorrelatedDs[iBinPtCand], SystUncCorrelatedDs[iBinPtCand])); + tCorrUncDs->AddText(0., 0., Form("#splitline{+%.0f%%}{#minus%.0f%%}", systUncCorrelatedDs[iBinPtCand], systUncCorrelatedDs[iBinPtCand])); - TPaveText* tScaleUnc = new TPaveText(0.501, 0.292, 0.968, 0.372, "NDC"); + auto* tScaleUnc = new TPaveText(0.501, 0.292, 0.968, 0.372, "NDC"); tScaleUnc->SetFillStyle(0); tScaleUnc->SetBorderSize(0); tScaleUnc->SetTextSize(0.05); @@ -333,21 +340,24 @@ void FitCorrel_Ds(const TString cfgFileName = "config_CorrAnalysis.json") tScaleUnc->SetTextColor(kBlack); tScaleUnc->AddText(0., 0., "corr. unc."); - if (drawSystematicErrors) + if (drawSystematicErrors) { hSystematicErrorsPlot[iBinPtCand][iBinPtHad]->Draw("E2same"); + } hCorrPhi[iBinPtCand][iBinPtHad]->Draw("same"); pttext->Draw("same"); - if (drawSystematicErrors) + if (drawSystematicErrors) { tCorrUncDs->Draw("same"); - if (drawSystematicErrors) + } + if (drawSystematicErrors) { tScaleUnc->Draw("same"); + } } - CanvasCorrPhi[iBinPtHad]->SaveAs(Form("Output_CorrelationFitting_%s_png/CorrPhiDs_PtBinAssoc%d.png", CodeNameAnalysis.data(), iBinPtHad + 1)); - CanvasCorrPhi[iBinPtHad]->SaveAs(Form("Output_CorrelationFitting_%s_Root/CorrPhiDs_PtBinAssoc%d.root", CodeNameAnalysis.data(), iBinPtHad + 1)); + canvasCorrPhi[iBinPtHad]->SaveAs(Form("Output_CorrelationFitting_%s_png/CorrPhiDs_PtBinAssoc%d.png", codeNameAnalysis.data(), iBinPtHad + 1)); + canvasCorrPhi[iBinPtHad]->SaveAs(Form("Output_CorrelationFitting_%s_Root/CorrPhiDs_PtBinAssoc%d.root", codeNameAnalysis.data(), iBinPtHad + 1)); } // histogram with fit parameter and errors - TFile* outFile = new TFile(Form("Output_CorrelationFitting_%s_Root/CorrPhiDs_FinalPlots.root", CodeNameAnalysis.data()), "RECREATE"); + auto* outFile = new TFile(Form("Output_CorrelationFitting_%s_Root/CorrPhiDs_FinalPlots.root", codeNameAnalysis.data()), "RECREATE"); outFile->cd(); for (int iBinPtHad = 0; iBinPtHad < nBinsPtHad; iBinPtHad++) { hBaselin[iBinPtHad]->Write(); @@ -363,16 +373,16 @@ void FitCorrel_Ds(const TString cfgFileName = "config_CorrAnalysis.json") // Draw plots for (int iBinPtHad = 0; iBinPtHad < nBinsPtHad; iBinPtHad++) { - TCanvas* c1 = new TCanvas(Form("NS_yield_PtAssoc%d", iBinPtHad + 1), Form("NS_yield_PtAssoc%d", iBinPtHad + 1)); - TCanvas* c2 = new TCanvas(Form("AS_yield_PtAssoc%d", iBinPtHad + 1), Form("AS_yield_PtAssoc%d", iBinPtHad + 1)); - TCanvas* c3 = new TCanvas(Form("NS_sigma_PtAssoc%d", iBinPtHad + 1), Form("AS_sigma_PtAssoc%d", iBinPtHad + 1)); - TCanvas* c4 = new TCanvas(Form("AS_sigma_PtAssoc%d", iBinPtHad + 1), Form("AS_sigma_PtAssoc%d", iBinPtHad + 1)); - TCanvas* c5 = new TCanvas(Form("Baseline_PtAssoc%d", iBinPtHad + 1), Form("Baseline_PtAssoc%d", iBinPtHad + 1)); - SetTH1HistoStyle(hBaselin[iBinPtHad], Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "Baseline", kFullSquare, kBlue, 1.8, kBlue, 2); - SetTH1HistoStyle(hNSYield[iBinPtHad], Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "Y^{NS}", kFullSquare, kRed, 1.8, kRed, 2); - SetTH1HistoStyle(hASYield[iBinPtHad], Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "Y^{AS}", kFullSquare, kMagenta, 1.8, kMagenta, 2); - SetTH1HistoStyle(hNSSigma[iBinPtHad], Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "#sigma_{NS}", kFullSquare, kOrange + 8, 1.8, kOrange + 8, 2); - SetTH1HistoStyle(hASSigma[iBinPtHad], Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "#sigma_{AS}", kFullSquare, kViolet - 5, 1.8, kViolet - 5, 2); + auto* c1 = new TCanvas(Form("NS_yield_PtAssoc%d", iBinPtHad + 1), Form("NS_yield_PtAssoc%d", iBinPtHad + 1)); + auto* c2 = new TCanvas(Form("AS_yield_PtAssoc%d", iBinPtHad + 1), Form("AS_yield_PtAssoc%d", iBinPtHad + 1)); + auto* c3 = new TCanvas(Form("NS_sigma_PtAssoc%d", iBinPtHad + 1), Form("AS_sigma_PtAssoc%d", iBinPtHad + 1)); + auto* c4 = new TCanvas(Form("AS_sigma_PtAssoc%d", iBinPtHad + 1), Form("AS_sigma_PtAssoc%d", iBinPtHad + 1)); + auto* c5 = new TCanvas(Form("Baseline_PtAssoc%d", iBinPtHad + 1), Form("Baseline_PtAssoc%d", iBinPtHad + 1)); + setTH1HistoStyle(hBaselin[iBinPtHad], Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "Baseline", kFullSquare, kBlue, 1.8, kBlue, 2); + setTH1HistoStyle(hNSYield[iBinPtHad], Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "Y^{NS}", kFullSquare, kRed, 1.8, kRed, 2); + setTH1HistoStyle(hASYield[iBinPtHad], Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "Y^{AS}", kFullSquare, kMagenta, 1.8, kMagenta, 2); + setTH1HistoStyle(hNSSigma[iBinPtHad], Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "#sigma_{NS}", kFullSquare, kOrange + 8, 1.8, kOrange + 8, 2); + setTH1HistoStyle(hASSigma[iBinPtHad], Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "#sigma_{AS}", kFullSquare, kViolet - 5, 1.8, kViolet - 5, 2); c1->cd(); hNSYield[iBinPtHad]->SetMinimum(0); hNSYield[iBinPtHad]->Draw(); @@ -417,51 +427,49 @@ void FitCorrel_Ds(const TString cfgFileName = "config_CorrAnalysis.json") } c1->cd(); - SetTH1HistoStyle(hNSYieldSyst, Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "Y^{NS}", kFullSquare, kRed, 1.8, kRed, 2); + setTH1HistoStyle(hNSYieldSyst, Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "Y^{NS}", kFullSquare, kRed, 1.8, kRed, 2); hNSYieldSyst->SetFillStyle(0); hNSYieldSyst->Draw("E2same"); c2->cd(); - SetTH1HistoStyle(hASYieldSyst, Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "Y^{AS}", kFullSquare, kMagenta, 1.8, kMagenta, 2); + setTH1HistoStyle(hASYieldSyst, Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "Y^{AS}", kFullSquare, kMagenta, 1.8, kMagenta, 2); hASYieldSyst->SetFillStyle(0); hASYieldSyst->Draw("E2same"); c3->cd(); - SetTH1HistoStyle(hNSSigmaSyst, Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "#sigma_{NS}", kFullSquare, kOrange + 8, 1.8, kOrange + 8, 2); + setTH1HistoStyle(hNSSigmaSyst, Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "#sigma_{NS}", kFullSquare, kOrange + 8, 1.8, kOrange + 8, 2); hNSSigmaSyst->SetFillStyle(0); hNSSigmaSyst->Draw("E2same"); c4->cd(); - SetTH1HistoStyle(hASSigmaSyst, Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "#sigma_{AS}", kFullSquare, kViolet - 5, 1.8, kViolet - 5, 2); + setTH1HistoStyle(hASSigmaSyst, Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "#sigma_{AS}", kFullSquare, kViolet - 5, 1.8, kViolet - 5, 2); hASSigmaSyst->SetFillStyle(0); hASSigmaSyst->Draw("E2same"); c5->cd(); - SetTH1HistoStyle(hBaselinSyst, Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "Baseline", kFullSquare, kBlue, 1.8, kBlue, 2); + setTH1HistoStyle(hBaselinSyst, Form("p_{T}^{assoc} > %.1f GeV/c", binsPtHadIntervals[iBinPtHad]), "p_{T} (GeV/c)", "Baseline", kFullSquare, kBlue, 1.8, kBlue, 2); hBaselinSyst->SetFillStyle(0); hBaselinSyst->Draw("E2same"); } - c1->SaveAs(Form("Output_CorrelationFitting_%s_png/NearSideYield_PtAssoc%d.png", CodeNameAnalysis.data(), iBinPtHad + 1)); - c2->SaveAs(Form("Output_CorrelationFitting_%s_png/AwaySideYield_PtAssoc%d.png", CodeNameAnalysis.data(), iBinPtHad + 1)); - c3->SaveAs(Form("Output_CorrelationFitting_%s_png/NearSideSigma_PtAssoc%d.png", CodeNameAnalysis.data(), iBinPtHad + 1)); - c4->SaveAs(Form("Output_CorrelationFitting_%s_png/AwaySideSigma_PtAssoc%d.png", CodeNameAnalysis.data(), iBinPtHad + 1)); - c5->SaveAs(Form("Output_CorrelationFitting_%s_png/Baseline_PtAssoc%d.png", CodeNameAnalysis.data(), iBinPtHad + 1)); - c1->SaveAs(Form("Output_CorrelationFitting_%s_Root/NearSideYield_PtBinAssoc%d.root", CodeNameAnalysis.data(), iBinPtHad + 1)); - c2->SaveAs(Form("Output_CorrelationFitting_%s_Root/AwaySideYield_PtBinAssoc%d.root", CodeNameAnalysis.data(), iBinPtHad + 1)); - c3->SaveAs(Form("Output_CorrelationFitting_%s_Root/NearSideSigma_PtBinAssoc%d.root", CodeNameAnalysis.data(), iBinPtHad + 1)); - c4->SaveAs(Form("Output_CorrelationFitting_%s_Root/AwaySideSigma_PtBinAssoc%d.root", CodeNameAnalysis.data(), iBinPtHad + 1)); - c5->SaveAs(Form("Output_CorrelationFitting_%s_Root/Baseline_PtBinAssoc%d.root", CodeNameAnalysis.data(), iBinPtHad + 1)); + c1->SaveAs(Form("Output_CorrelationFitting_%s_png/NearSideYield_PtAssoc%d.png", codeNameAnalysis.data(), iBinPtHad + 1)); + c2->SaveAs(Form("Output_CorrelationFitting_%s_png/AwaySideYield_PtAssoc%d.png", codeNameAnalysis.data(), iBinPtHad + 1)); + c3->SaveAs(Form("Output_CorrelationFitting_%s_png/NearSideSigma_PtAssoc%d.png", codeNameAnalysis.data(), iBinPtHad + 1)); + c4->SaveAs(Form("Output_CorrelationFitting_%s_png/AwaySideSigma_PtAssoc%d.png", codeNameAnalysis.data(), iBinPtHad + 1)); + c5->SaveAs(Form("Output_CorrelationFitting_%s_png/Baseline_PtAssoc%d.png", codeNameAnalysis.data(), iBinPtHad + 1)); + c1->SaveAs(Form("Output_CorrelationFitting_%s_Root/NearSideYield_PtBinAssoc%d.root", codeNameAnalysis.data(), iBinPtHad + 1)); + c2->SaveAs(Form("Output_CorrelationFitting_%s_Root/AwaySideYield_PtBinAssoc%d.root", codeNameAnalysis.data(), iBinPtHad + 1)); + c3->SaveAs(Form("Output_CorrelationFitting_%s_Root/NearSideSigma_PtBinAssoc%d.root", codeNameAnalysis.data(), iBinPtHad + 1)); + c4->SaveAs(Form("Output_CorrelationFitting_%s_Root/AwaySideSigma_PtBinAssoc%d.root", codeNameAnalysis.data(), iBinPtHad + 1)); + c5->SaveAs(Form("Output_CorrelationFitting_%s_Root/Baseline_PtBinAssoc%d.root", codeNameAnalysis.data(), iBinPtHad + 1)); } - - return; } -void SetTH1HistoStyle(TH1D*& histo, TString hTitle, TString hXaxisTitle, TString hYaxisTitle, +void setTH1HistoStyle(TH1D*& histo, TString hTitle, TString hXaxisTitle, TString hYaxisTitle, Style_t markerStyle, Color_t markerColor, Double_t markerSize, - Color_t lineColor, Int_t lineWidth, Float_t hTitleXaxisOffset = 1.3, Float_t hTitleYaxisOffset = 1.3, - Float_t hTitleXaxisSize = 0.045, Float_t hTitleYaxisSize = 0.045, Float_t hLabelXaxisSize = 0.045, Float_t hLabelYaxisSize = 0.045, - Bool_t centerXaxisTitle = false, Bool_t centerYaxisTitle = false) + Color_t lineColor, Int_t lineWidth, Float_t hTitleXaxisOffset, Float_t hTitleYaxisOffset, + Float_t hTitleXaxisSize, Float_t hTitleYaxisSize, Float_t hLabelXaxisSize, Float_t hLabelYaxisSize, + Bool_t centerXaxisTitle, Bool_t centerYaxisTitle) { histo->SetTitle(hTitle.Data()); @@ -480,15 +488,13 @@ void SetTH1HistoStyle(TH1D*& histo, TString hTitle, TString hXaxisTitle, TString histo->GetYaxis()->SetLabelSize(hLabelYaxisSize); histo->GetXaxis()->CenterTitle(centerXaxisTitle); histo->GetYaxis()->CenterTitle(centerYaxisTitle); - - return; } -void SetTH1HistoStyle(TH1F*& histo, TString hTitle, TString hXaxisTitle, TString hYaxisTitle, +void setTH1HistoStyle(TH1F*& histo, TString hTitle, TString hXaxisTitle, TString hYaxisTitle, Style_t markerStyle, Color_t markerColor, Double_t markerSize, - Color_t lineColor, Int_t lineWidth, Float_t hTitleXaxisOffset = 1.3, Float_t hTitleYaxisOffset = 1.3, - Float_t hTitleXaxisSize = 0.045, Float_t hTitleYaxisSize = 0.045, Float_t hLabelXaxisSize = 0.045, Float_t hLabelYaxisSize = 0.045, - Bool_t centerXaxisTitle = false, Bool_t centerYaxisTitle = false) + Color_t lineColor, Int_t lineWidth, Float_t hTitleXaxisOffset, Float_t hTitleYaxisOffset, + Float_t hTitleXaxisSize, Float_t hTitleYaxisSize, Float_t hLabelXaxisSize, Float_t hLabelYaxisSize, + Bool_t centerXaxisTitle, Bool_t centerYaxisTitle) { histo->SetTitle(hTitle.Data()); @@ -507,6 +513,4 @@ void SetTH1HistoStyle(TH1F*& histo, TString hTitle, TString hXaxisTitle, TString histo->GetYaxis()->SetLabelSize(hLabelYaxisSize); histo->GetXaxis()->CenterTitle(centerXaxisTitle); histo->GetYaxis()->CenterTitle(centerYaxisTitle); - - return; } diff --git a/PWGHF/HFC/TableProducer/correlatorD0D0bar.cxx b/PWGHF/HFC/TableProducer/correlatorD0D0bar.cxx index a2ed89ce8d9..62b9f6b08ea 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0D0bar.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0D0bar.cxx @@ -64,7 +64,7 @@ const double epsilon = 1E-5; const int npTBinsMassAndEfficiency = o2::analysis::hf_cuts_d0_to_pi_k::NBinsPt; const double efficiencyDmesonDefault[npTBinsMassAndEfficiency] = {}; -auto efficiencyDmeson_v = std::vector{efficiencyDmesonDefault, efficiencyDmesonDefault + npTBinsMassAndEfficiency}; +const auto efficiencyDmesonV = std::vector{efficiencyDmesonDefault, efficiencyDmesonDefault + npTBinsMassAndEfficiency}; // histogram binning definition const int massAxisBins = 120; @@ -96,7 +96,7 @@ struct HfCorrelatorD0D0bar { Configurable multMin{"multMin", 0., "minimum multiplicity accepted"}; Configurable multMax{"multMax", 10000., "maximum multiplicity accepted"}; Configurable> binsPt{"binsPt", std::vector{o2::analysis::hf_cuts_d0_to_pi_k::vecBinsPt}, "pT bin limits for candidate mass plots and efficiency"}; - Configurable> efficiencyD{"efficiencyD", std::vector{efficiencyDmeson_v}, "Efficiency values for D0 meson"}; + Configurable> efficiencyD{"efficiencyD", std::vector{efficiencyDmesonV}, "Efficiency values for D0 meson"}; HfHelper hfHelper; @@ -182,12 +182,12 @@ struct HfCorrelatorD0D0bar { continue; } // check decay channel flag for candidate1 - if (!(candidate1.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { + if ((candidate1.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) == 0) { continue; } double efficiencyWeight = 1.; - if (applyEfficiency) { + if (applyEfficiency != 0) { efficiencyWeight = 1. / efficiencyD->at(o2::analysis::findBin(binsPt, candidate1.pt())); } @@ -214,7 +214,7 @@ struct HfCorrelatorD0D0bar { continue; } for (const auto& candidate2 : selectedD0CandidatesGrouped) { - if (!(candidate2.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { // check decay channel flag for candidate2 + if ((candidate2.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) == 0) { // check decay channel flag for candidate2 continue; } if (candidate2.isSelD0bar() < selectionFlagD0bar) { // keep only D0bar candidates passing the selection @@ -292,7 +292,7 @@ struct HfCorrelatorD0D0bar { bool flagD0barReflection = false; for (const auto& candidate1 : selectedD0CandidatesGroupedMC) { // check decay channel flag for candidate1 - if (!(candidate1.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { + if ((candidate1.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) == 0) { continue; } if (yCandMax >= 0. && std::abs(hfHelper.yD0(candidate1)) > yCandMax) { @@ -303,7 +303,7 @@ struct HfCorrelatorD0D0bar { } double efficiencyWeight = 1.; - if (applyEfficiency) { + if (applyEfficiency != 0) { efficiencyWeight = 1. / efficiencyD->at(o2::analysis::findBin(binsPt, candidate1.pt())); } @@ -345,7 +345,7 @@ struct HfCorrelatorD0D0bar { flagD0Signal = candidate1.flagMcMatchRec() == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK; // flagD0Signal 'true' if candidate1 matched to D0 (particle) flagD0Reflection = candidate1.flagMcMatchRec() == -o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK; // flagD0Reflection 'true' if candidate1, selected as D0 (particle), is matched to D0bar (antiparticle) for (const auto& candidate2 : selectedD0CandidatesGroupedMC) { - if (!(candidate2.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { // check decay channel flag for candidate2 + if ((candidate2.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) == 0) { // check decay channel flag for candidate2 continue; } if (candidate2.isSelD0bar() < selectionFlagD0bar) { // discard candidates not selected as D0bar in inner loop @@ -415,7 +415,7 @@ struct HfCorrelatorD0D0bar { if (std::abs(particle1.pdgCode()) != Pdg::kD0) { continue; } - double yD = RecoDecay::y(particle1.pVector(), MassD0); + double const yD = RecoDecay::y(particle1.pVector(), MassD0); if (yCandMax >= 0. && std::abs(yD) > yCandMax) { continue; } @@ -507,13 +507,13 @@ struct HfCorrelatorD0D0bar { if (std::abs(particle1.pdgCode()) != PDG_t::kCharm) { // search c or cbar particles continue; } - int partMothPDG = particle1.mothers_as().front().pdgCode(); + int const partMothPDG = particle1.mothers_as().front().pdgCode(); // check whether mothers of quark c/cbar are still '4'/'-4' particles - in that case the c/cbar quark comes from its own fragmentation, skip it if (partMothPDG == particle1.pdgCode()) { continue; } counterCCbarBeforeEtasel++; // count c or cbar (before kinematic selection) - double yC = RecoDecay::y(particle1.pVector(), MassCharm); + double const yC = RecoDecay::y(particle1.pVector(), MassCharm); if (yCandMax >= 0. && std::abs(yC) > yCandMax) { continue; } diff --git a/PWGHF/HFC/TableProducer/correlatorD0D0barBarrelFullPid.cxx b/PWGHF/HFC/TableProducer/correlatorD0D0barBarrelFullPid.cxx index 8fa93dc0d63..d43a90b79d2 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0D0barBarrelFullPid.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0D0barBarrelFullPid.cxx @@ -64,7 +64,7 @@ const double epsilon = 1E-5; const int npTBinsMassAndEfficiency = o2::analysis::hf_cuts_d0_to_pi_k::NBinsPt; const double efficiencyDmesonDefault[npTBinsMassAndEfficiency] = {}; -auto efficiencyDmeson_v = std::vector{efficiencyDmesonDefault, efficiencyDmesonDefault + npTBinsMassAndEfficiency}; +const auto efficiencyDmesonV = std::vector{efficiencyDmesonDefault, efficiencyDmesonDefault + npTBinsMassAndEfficiency}; // histogram binning definition const int massAxisBins = 120; @@ -97,7 +97,7 @@ struct HfCorrelatorD0D0barBarrelFullPid { Configurable multMin{"multMin", 0., "minimum multiplicity accepted"}; Configurable multMax{"multMax", 10000., "maximum multiplicity accepted"}; Configurable> binsPt{"binsPt", std::vector{o2::analysis::hf_cuts_d0_to_pi_k::vecBinsPt}, "pT bin limits for candidate mass plots and efficiency"}; - Configurable> efficiencyD{"efficiencyD", std::vector{efficiencyDmeson_v}, "Efficiency values for D0 meson"}; + Configurable> efficiencyD{"efficiencyD", std::vector{efficiencyDmesonV}, "Efficiency values for D0 meson"}; HfHelper hfHelper; @@ -183,12 +183,12 @@ struct HfCorrelatorD0D0barBarrelFullPid { continue; } // check decay channel flag for candidate1 - if (!(candidate1.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { + if ((candidate1.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) == 0) { continue; } double efficiencyWeight = 1.; - if (applyEfficiency) { + if (applyEfficiency != 0) { efficiencyWeight = 1. / efficiencyD->at(o2::analysis::findBin(binsPt, candidate1.pt())); } @@ -215,7 +215,7 @@ struct HfCorrelatorD0D0barBarrelFullPid { continue; } for (const auto& candidate2 : selectedD0candidatesGrouped) { - if (!(candidate2.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { // check decay channel flag for candidate2 + if ((candidate2.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) == 0) { // check decay channel flag for candidate2 continue; } if (candidate2.isSelD0barTofPlusRichPid() < selectionFlagD0bar) { // keep only D0bar candidates passing the selection @@ -293,7 +293,7 @@ struct HfCorrelatorD0D0barBarrelFullPid { bool flagD0barReflection = false; for (const auto& candidate1 : selectedD0candidatesGroupedMC) { // check decay channel flag for candidate1 - if (!(candidate1.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { + if ((candidate1.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) == 0) { continue; } if (yCandMax >= 0. && std::abs(hfHelper.yD0(candidate1)) > yCandMax) { @@ -304,7 +304,7 @@ struct HfCorrelatorD0D0barBarrelFullPid { } double efficiencyWeight = 1.; - if (applyEfficiency) { + if (applyEfficiency != 0) { efficiencyWeight = 1. / efficiencyD->at(o2::analysis::findBin(binsPt, candidate1.pt())); } @@ -346,7 +346,7 @@ struct HfCorrelatorD0D0barBarrelFullPid { flagD0Signal = candidate1.flagMcMatchRec() == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK; // flagD0Signal 'true' if candidate1 matched to D0 (particle) flagD0Reflection = candidate1.flagMcMatchRec() == -o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK; // flagD0Reflection 'true' if candidate1, selected as D0 (particle), is matched to D0bar (antiparticle) for (const auto& candidate2 : selectedD0candidatesGroupedMC) { - if (!(candidate2.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { // check decay channel flag for candidate2 + if ((candidate2.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) == 0) { // check decay channel flag for candidate2 continue; } if (candidate2.isSelD0barTofPlusRichPid() < selectionFlagD0bar) { // discard candidates not selected as D0bar in inner loop @@ -416,7 +416,7 @@ struct HfCorrelatorD0D0barBarrelFullPid { if (std::abs(particle1.pdgCode()) != Pdg::kD0) { continue; } - double yD = RecoDecay::y(particle1.pVector(), MassD0); + double const yD = RecoDecay::y(particle1.pVector(), MassD0); if (yCandMax >= 0. && std::abs(yD) > yCandMax) { continue; } @@ -508,13 +508,13 @@ struct HfCorrelatorD0D0barBarrelFullPid { if (std::abs(particle1.pdgCode()) != PDG_t::kCharm) { // search c or cbar particles continue; } - int partMothPDG = particle1.mothers_as().front().pdgCode(); + int const partMothPDG = particle1.mothers_as().front().pdgCode(); // check whether mothers of quark c/cbar are still '4'/'-4' particles - in that case the c/cbar quark comes from its own fragmentation, skip it if (partMothPDG == particle1.pdgCode()) { continue; } counterCCbarBeforeEtasel++; // count c or cbar (before kinematic selection) - double yC = RecoDecay::y(particle1.pVector(), MassCharm); + double const yC = RecoDecay::y(particle1.pVector(), MassCharm); if (yCandMax >= 0. && std::abs(yC) > yCandMax) { continue; } diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index 09585789935..ab1618e8b82 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -135,7 +135,7 @@ struct HfCorrelatorD0HadronsSelection { } if (selNoSameBunchPileUpColl) { isNosameBunchPileUp = false; - isNosameBunchPileUp = static_cast(collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)); + isNosameBunchPileUp = collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup); } isSelColl = isD0Found && isSel8 && isNosameBunchPileUp; collisionsWithSelD0(isSelColl); @@ -169,7 +169,7 @@ struct HfCorrelatorD0HadronsSelection { isSel8 = collision.sel8(); } if (selNoSameBunchPileUpColl) { - isNosameBunchPileUp = static_cast(collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)); + isNosameBunchPileUp = collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup); } isSelColl = isD0Found && isSel8 && isNosameBunchPileUp; collisionsWithSelD0(isSelColl); @@ -184,7 +184,7 @@ struct HfCorrelatorD0HadronsSelection { if (std::abs(particle.pdgCode()) != Pdg::kD0) { continue; } - double yD = RecoDecay::y(particle.pVector(), MassD0); + double const yD = RecoDecay::y(particle.pVector(), MassD0); if (std::abs(yD) > yCandMax || particle.pt() < ptCandMin) { continue; } @@ -269,19 +269,19 @@ struct HfCorrelatorD0Hadrons { massK = MassKPlus; AxisSpec axisMassD = {binsMassD, "inv. mass (#pi K) (GeV/#it{c}^{2})"}; - AxisSpec axisEta = {binsEta, "#it{#eta}"}; - AxisSpec axisPhi = {binsPhi, "#it{#varphi}"}; - AxisSpec axisRapidity = {100, -5., 5., "Rapidity"}; + AxisSpec const axisEta = {binsEta, "#it{#eta}"}; + AxisSpec const axisPhi = {binsPhi, "#it{#varphi}"}; + AxisSpec const axisRapidity = {100, -5., 5., "Rapidity"}; AxisSpec axisPtD = {(std::vector)binsPtD, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec axisPtHadron = {(std::vector)binsPtHadron, "#it{p}_{T} Hadron (GeV/#it{c})"}; - AxisSpec axisMultiplicity = {binsMultiplicity, "Multiplicity"}; + AxisSpec const axisMultiplicity = {binsMultiplicity, "Multiplicity"}; AxisSpec axisMultFT0M = {binsMultFT0M, "MultiplicityFT0M"}; - AxisSpec axisPosZ = {binsPosZ, "PosZ"}; - AxisSpec axisPoolBin = {binsPoolBin, "PoolBin"}; - AxisSpec axisStatus = {4, -0.5, 3.5, "Selection status"}; - AxisSpec axisSignalStatus = {200, 0., 200., "Signal status"}; + AxisSpec const axisPosZ = {binsPosZ, "PosZ"}; + AxisSpec const axisPoolBin = {binsPoolBin, "PoolBin"}; + AxisSpec const axisStatus = {4, -0.5, 3.5, "Selection status"}; + AxisSpec const axisSignalStatus = {200, 0., 200., "Signal status"}; AxisSpec axisEvtCount = {1, -0.5, 0.5}; - AxisSpec axisTrkCount = {5, 0., 5.}; + AxisSpec const axisTrkCount = {5, 0., 5.}; AxisSpec axisBdtScoreBkg = {100, 0., 1., "Bdt score background"}; AxisSpec axisBdtScorePrompt = {100, 0., 1., "Bdt score prompt"}; AxisSpec axisOrigin = {10, 0., 10., "Candidate origin"}; @@ -398,7 +398,7 @@ struct HfCorrelatorD0Hadrons { // ========================== trigger efficiency ================================ double efficiencyWeight = 1.; - if (applyEfficiency) { + if (applyEfficiency != 0) { efficiencyWeight = 1. / efficiencyDmeson->at(o2::analysis::findBin(binsPtEfficiencyD, candidate.pt())); } // ========================== Fill mass histo ================================ @@ -409,7 +409,7 @@ struct HfCorrelatorD0Hadrons { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMlD0[iclass] = candidate.mlProbD0()[classMl->at(iclass)]; } - registry.fill(HIST("hMLScoresVsMassVsPtVsOrigin"), outputMlD0[0], outputMlD0[2], hfHelper.invMassD0ToPiK(candidate), candidate.pt(), candidate.isSelD0bar() ? o2::aod::hf_correlation_d0_hadron::D0D0barBoth : o2::aod::hf_correlation_d0_hadron::D0Only); + registry.fill(HIST("hMLScoresVsMassVsPtVsOrigin"), outputMlD0[0], outputMlD0[2], hfHelper.invMassD0ToPiK(candidate), candidate.pt(), (candidate.isSelD0bar() != 0) ? o2::aod::hf_correlation_d0_hadron::D0D0barBoth : o2::aod::hf_correlation_d0_hadron::D0Only); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { registry.fill(HIST("hMass"), hfHelper.invMassD0barToKPi(candidate), candidate.pt(), efficiencyWeight); @@ -418,7 +418,7 @@ struct HfCorrelatorD0Hadrons { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMlD0bar[iclass] = candidate.mlProbD0bar()[classMl->at(iclass)]; } - registry.fill(HIST("hMLScoresVsMassVsPtVsOrigin"), outputMlD0bar[0], outputMlD0bar[2], hfHelper.invMassD0barToKPi(candidate), candidate.pt(), candidate.isSelD0() ? o2::aod::hf_correlation_d0_hadron::D0D0barBoth : o2::aod::hf_correlation_d0_hadron::D0barOnly); + registry.fill(HIST("hMLScoresVsMassVsPtVsOrigin"), outputMlD0bar[0], outputMlD0bar[2], hfHelper.invMassD0barToKPi(candidate), candidate.pt(), (candidate.isSelD0() != 0) ? o2::aod::hf_correlation_d0_hadron::D0D0barBoth : o2::aod::hf_correlation_d0_hadron::D0barOnly); } entryD0CandRecoInfo(hfHelper.invMassD0ToPiK(candidate), hfHelper.invMassD0barToKPi(candidate), candidate.pt(), outputMlD0[0], outputMlD0[2], outputMlD0bar[0], outputMlD0bar[2]); @@ -557,7 +557,7 @@ struct HfCorrelatorD0Hadrons { registry.fill(HIST("hD0PoolBin"), poolBin); double efficiencyWeight = 1.; - if (applyEfficiency) { + if (applyEfficiency != 0) { efficiencyWeight = 1. / efficiencyDmeson->at(o2::analysis::findBin(binsPtEfficiencyD, candidate.pt())); } @@ -727,7 +727,7 @@ struct HfCorrelatorD0Hadrons { void processMcGen(SelectedCollisionsMcGen::iterator const& mcCollision, SelectedParticlesMcGen const& mcParticles) { - BinningTypeMcGen corrBinningMcGen{{zPoolBins, multPoolBinsMcGen}, true}; + BinningTypeMcGen const corrBinningMcGen{{zPoolBins, multPoolBinsMcGen}, true}; int poolBin = corrBinningMcGen.getBin(std::make_tuple(mcCollision.posZ(), mcCollision.multMCFT0A())); registry.fill(HIST("hCollisionPoolBin"), poolBin); registry.fill(HIST("hEvtCountGen"), 0); @@ -745,7 +745,7 @@ struct HfCorrelatorD0Hadrons { continue; } if (std::abs(particleTrigg.flagMcMatchGen()) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { - double yD = RecoDecay::y(particleTrigg.pVector(), MassD0); + double const yD = RecoDecay::y(particleTrigg.pVector(), MassD0); if (yCandMax >= 0. && std::abs(yD) > yCandMax) { continue; } @@ -835,7 +835,7 @@ struct HfCorrelatorD0Hadrons { } auto tracksTuple = std::make_tuple(candidates, tracks); - Pair pairData{corrBinning, numberEventsMixed, -1, collisions, tracksTuple, &cache}; + Pair const pairData{corrBinning, numberEventsMixed, -1, collisions, tracksTuple, &cache}; for (const auto& [c1, tracks1, c2, tracks2] : pairData) { if (tracks1.size() == 0) { @@ -843,7 +843,7 @@ struct HfCorrelatorD0Hadrons { } // LOGF(info, "Mixed event collisions: Index = (%d, %d), tracks Size: (%d, %d), Z Vertex: (%f, %f), Pool Bin: (%d, %d)", c1.globalIndex(), c2.globalIndex(), tracks1.size(), tracks2.size(), c1.posZ(), c2.posZ(), corrBinning.getBin(std::make_tuple(c1.posZ(), c1.multFT0M())),corrBinning.getBin(std::make_tuple(c2.posZ(), c2.multFT0M()))); // For debug int poolBin = corrBinning.getBin(std::make_tuple(c2.posZ(), c2.multFT0M())); - int poolBinD0 = corrBinning.getBin(std::make_tuple(c1.posZ(), c1.multFT0M())); + int const poolBinD0 = corrBinning.getBin(std::make_tuple(c1.posZ(), c1.multFT0M())); registry.fill(HIST("hTracksPoolBin"), poolBin); registry.fill(HIST("hD0PoolBin"), poolBinD0); for (const auto& [candidate, particleAssoc] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { @@ -915,7 +915,7 @@ struct HfCorrelatorD0Hadrons { aod::McParticles const& mcParticles) { auto tracksTuple = std::make_tuple(candidates, tracks); - Pair pairMcRec{corrBinning, numberEventsMixed, -1, collisions, tracksTuple, &cache}; + Pair const pairMcRec{corrBinning, numberEventsMixed, -1, collisions, tracksTuple, &cache}; bool isD0Prompt = false; bool flagD0 = false; bool flagD0bar = false; @@ -923,7 +923,7 @@ struct HfCorrelatorD0Hadrons { int trackOrigin = 0; for (const auto& [c1, tracks1, c2, tracks2] : pairMcRec) { int poolBin = corrBinning.getBin(std::make_tuple(c2.posZ(), c2.multFT0M())); - int poolBinD0 = corrBinning.getBin(std::make_tuple(c1.posZ(), c1.multFT0M())); + int const poolBinD0 = corrBinning.getBin(std::make_tuple(c1.posZ(), c1.multFT0M())); registry.fill(HIST("hTracksPoolBin"), poolBin); registry.fill(HIST("hD0PoolBin"), poolBinD0); registry.fill(HIST("hMultFT0M"), c1.multFT0M()); @@ -1044,9 +1044,9 @@ struct HfCorrelatorD0Hadrons { void processMcGenMixedEvent(SelectedCollisionsMcGen const& collisions, SelectedParticlesMcGen const& mcParticles) { - BinningTypeMcGen corrBinningMcGen{{zPoolBins, multPoolBinsMcGen}, true}; + BinningTypeMcGen const corrBinningMcGen{{zPoolBins, multPoolBinsMcGen}, true}; auto tracksTuple = std::make_tuple(mcParticles, mcParticles); - Pair pairMcGen{corrBinningMcGen, numberEventsMixed, -1, collisions, tracksTuple, &cache}; + Pair const pairMcGen{corrBinningMcGen, numberEventsMixed, -1, collisions, tracksTuple, &cache}; for (const auto& [c1, tracks1, c2, tracks2] : pairMcGen) { int poolBin = corrBinningMcGen.getBin(std::make_tuple(c1.posZ(), c1.multMCFT0A())); @@ -1055,7 +1055,7 @@ struct HfCorrelatorD0Hadrons { continue; } if (std::abs(particleTrigg.flagMcMatchGen()) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { - double yD = RecoDecay::y(particleTrigg.pVector(), MassD0); + double const yD = RecoDecay::y(particleTrigg.pVector(), MassD0); if (std::abs(yD) >= yCandMax || particleTrigg.pt() <= ptCandMin || std::abs(particleAssoc.eta()) >= etaTrackMax || particleAssoc.pt() <= ptTrackMin) { continue; } diff --git a/PWGHF/HFC/TableProducer/correlatorDMesonPairs.cxx b/PWGHF/HFC/TableProducer/correlatorDMesonPairs.cxx index 8616569468c..5a62565d230 100644 --- a/PWGHF/HFC/TableProducer/correlatorDMesonPairs.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDMesonPairs.cxx @@ -114,11 +114,11 @@ struct HfCorrelatorDMesonPairs { o2::analysis::HfMlResponseD0ToKPi hfMlResponse; o2::ccdb::CcdbApi ccdbApi; - std::vector outputMlD0Cand1 = {}; - std::vector outputMlD0barCand1 = {}; + std::vector outputMlD0Cand1; + std::vector outputMlD0barCand1; - std::vector outputMlD0Cand2 = {}; - std::vector outputMlD0barCand2 = {}; + std::vector outputMlD0Cand2; + std::vector outputMlD0barCand2; // using TracksWPid = soa::Join; @@ -223,7 +223,7 @@ struct HfCorrelatorDMesonPairs { labels[23] = "# of True D+Dbar Pairs"; labels[24] = "# of True Dbar+D Pairs"; - AxisSpec axisSelStatus = {kNBinsSelStatus, 0.5, kNBinsSelStatus + 0.5, ""}; + AxisSpec const axisSelStatus = {kNBinsSelStatus, 0.5, kNBinsSelStatus + 0.5, ""}; registry.add("hSelectionStatus", "D Meson candidates;selection status;entries", HistType::kTH1F, {axisSelStatus}); registry.add("hSelectionStatusMcGen", "D Meson candidates MC Gen;selection status;entries", HistType::kTH1F, {axisSelStatus}); @@ -245,7 +245,7 @@ struct HfCorrelatorDMesonPairs { labelsMatching[6] = "# of matched Dbar Cand 2"; labelsMatching[7] = "# of unmatched Cand 2"; - AxisSpec axisMatching = {kNBinsMatching, 0.5, kNBinsMatching + 0.5, ""}; + AxisSpec const axisMatching = {kNBinsMatching, 0.5, kNBinsMatching + 0.5, ""}; registry.add("hMatchingMcRec", "D Meson candidates; MC matching status;entries", HistType::kTH1F, {axisMatching}); registry.add("hMatchingMcGen", "D Meson candidates; MC matching status;entries", HistType::kTH1F, {axisMatching}); @@ -264,7 +264,7 @@ struct HfCorrelatorDMesonPairs { labelsSinglePart[4] = "# of true D"; labelsSinglePart[5] = "# of true Dbar"; - AxisSpec axisSinglePart = {kNBinsSinglePart, 0.5, kNBinsSinglePart + 0.5, ""}; + AxisSpec const axisSinglePart = {kNBinsSinglePart, 0.5, kNBinsSinglePart + 0.5, ""}; registry.add("hStatusSinglePart", "D Meson candidates; MC matching status;entries", HistType::kTH1F, {axisSinglePart}); registry.add("hStatusSinglePartMcGen", "D Meson candidates; MC matching status;entries", HistType::kTH1F, {axisSinglePart}); @@ -273,7 +273,7 @@ struct HfCorrelatorDMesonPairs { registry.get(HIST("hStatusSinglePartMcGen"))->GetXaxis()->SetBinLabel(iBin + 1, labelsSinglePart[iBin].data()); } - AxisSpec axisInputD0 = {200, -0.5, 199.5}; + AxisSpec const axisInputD0 = {200, -0.5, 199.5}; registry.add("hInputCheckD0", "Check on input D0 meson candidates/event", {HistType::kTH1F, {axisInputD0}}); registry.add("hInputCheckD0bar", "Check on input D0bar meson candidates/event", {HistType::kTH1F, {axisInputD0}}); registry.add("hInputCheckD0AndD0bar", "Check on input D0 & D0bar meson candidates/event", {HistType::kTH1F, {axisInputD0}}); @@ -316,7 +316,7 @@ struct HfCorrelatorDMesonPairs { /// SelectedD and SelectedDbar bits look at whether the candidate passed the selection flags. /// \param candidate is candidate /// \return bitmap with type of candidate - template + template uint8_t assignCandidateTypeD0(const T& candidate) { uint8_t candidateType(0); @@ -326,7 +326,7 @@ struct HfCorrelatorDMesonPairs { if (candidate.isSelD0bar() >= selectionFlagD0bar) { SETBIT(candidateType, SelectedDbar); } - if constexpr (isMcRec) { + if constexpr (IsMcRec) { if (candidate.flagMcMatchRec() == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { // matched as D0 SETBIT(candidateType, TrueD); } @@ -416,8 +416,8 @@ struct HfCorrelatorDMesonPairs { int nDevent = 0, nDbarevent = 0, nDDbarevent = 0, nDorDbarevent = 0; for (const auto& candidate : selectedD0Candidates) { // Get counters per event - bool isSignalD0 = std::abs(hfHelper.invMassD0ToPiK(candidate) - MassD0) < massCut; - bool isSignalD0bar = std::abs(hfHelper.invMassD0barToKPi(candidate) - MassD0Bar) < massCut; + bool const isSignalD0 = std::abs(hfHelper.invMassD0ToPiK(candidate) - MassD0) < massCut; + bool const isSignalD0bar = std::abs(hfHelper.invMassD0barToKPi(candidate) - MassD0Bar) < massCut; if (selectSignalRegionOnly && !(isSignalD0 || isSignalD0bar)) { continue; } @@ -430,8 +430,8 @@ struct HfCorrelatorDMesonPairs { continue; } - bool isDCand1 = isD(candidateType1); - bool isDbarCand1 = isDbar(candidateType1); + bool const isDCand1 = isD(candidateType1); + bool const isDbarCand1 = isDbar(candidateType1); if (isDCand1) { nDevent++; } @@ -550,23 +550,23 @@ struct HfCorrelatorDMesonPairs { registry.fill(HIST("hMatchingMcRec"), 8); } // Fill True info - if (isTrueDCand1) { + if (isTrueDCand1 != 0) { registry.fill(HIST("hSelectionStatus"), 6); - } else if (isTrueDbarCand1) { + } else if (isTrueDbarCand1 != 0) { registry.fill(HIST("hSelectionStatus"), 7); } - if (isTrueDCand2) { + if (isTrueDCand2 != 0) { registry.fill(HIST("hSelectionStatus"), 12); - } else if (isTrueDbarCand2) { + } else if (isTrueDbarCand2 != 0) { registry.fill(HIST("hSelectionStatus"), 13); } - if (isTrueDCand1 && isTrueDCand2) { + if ((isTrueDCand1 != 0) && (isTrueDCand2 != 0)) { registry.fill(HIST("hSelectionStatus"), 22); - } else if (isTrueDbarCand1 && isTrueDbarCand2) { + } else if ((isTrueDbarCand1 != 0) && (isTrueDbarCand2 != 0)) { registry.fill(HIST("hSelectionStatus"), 23); - } else if (isTrueDCand1 && isTrueDbarCand2) { + } else if ((isTrueDCand1 != 0) && (isTrueDbarCand2 != 0)) { registry.fill(HIST("hSelectionStatus"), 24); - } else if (isTrueDbarCand1 && isTrueDCand2) { + } else if ((isTrueDbarCand1 != 0) && (isTrueDCand2 != 0)) { registry.fill(HIST("hSelectionStatus"), 25); } } @@ -598,15 +598,15 @@ struct HfCorrelatorDMesonPairs { auto prong0Cand1 = candidate1.template prong0_as(); auto prong1Cand1 = candidate1.template prong1_as(); - bool isSignalD0Cand1 = std::abs(hfHelper.invMassD0ToPiK(candidate1) - MassD0) < massCut; - bool isSignalD0barCand1 = std::abs(hfHelper.invMassD0barToKPi(candidate1) - MassD0Bar) < massCut; + bool const isSignalD0Cand1 = std::abs(hfHelper.invMassD0ToPiK(candidate1) - MassD0) < massCut; + bool const isSignalD0barCand1 = std::abs(hfHelper.invMassD0barToKPi(candidate1) - MassD0Bar) < massCut; if (selectSignalRegionOnly && !(isSignalD0Cand1 || isSignalD0barCand1)) { continue; } auto candidateType1 = assignCandidateTypeD0(candidate1); // Candidate type attribution - bool isDCand1 = isD(candidateType1); - bool isDbarCand1 = isDbar(candidateType1); + bool const isDCand1 = isD(candidateType1); + bool const isDbarCand1 = isDbar(candidateType1); bool isSelectedMlD0Cand1 = false; bool isSelectedMlD0barCand1 = false; @@ -674,15 +674,15 @@ struct HfCorrelatorDMesonPairs { continue; } - bool isSignalD0Cand2 = std::abs(hfHelper.invMassD0ToPiK(candidate2) - MassD0) < massCut; - bool isSignalD0barCand2 = std::abs(hfHelper.invMassD0barToKPi(candidate2) - MassD0Bar) < massCut; + bool const isSignalD0Cand2 = std::abs(hfHelper.invMassD0ToPiK(candidate2) - MassD0) < massCut; + bool const isSignalD0barCand2 = std::abs(hfHelper.invMassD0barToKPi(candidate2) - MassD0Bar) < massCut; if (selectSignalRegionOnly && !(isSignalD0Cand2 || isSignalD0barCand2)) { continue; } auto candidateType2 = assignCandidateTypeD0(candidate2); // Candidate type attribution - bool isDCand2 = isD(candidateType2); - bool isDbarCand2 = isDbar(candidateType2); + bool const isDCand2 = isD(candidateType2); + bool const isDbarCand2 = isDbar(candidateType2); bool isSelectedMlD0Cand2 = false; bool isSelectedMlD0barCand2 = false; @@ -743,8 +743,8 @@ struct HfCorrelatorDMesonPairs { auto ptCandidate1 = candidate1.pt(); auto yCandidate1 = hfHelper.yD0(candidate1); auto phiCandidate1 = candidate1.phi(); - float massD0Cand1 = hfHelper.invMassD0ToPiK(candidate1); - float massD0barCand1 = hfHelper.invMassD0barToKPi(candidate1); + float const massD0Cand1 = hfHelper.invMassD0ToPiK(candidate1); + float const massD0barCand1 = hfHelper.invMassD0barToKPi(candidate1); auto prong0Cand1 = candidate1.template prong0_as(); auto prong1Cand1 = candidate1.template prong1_as(); @@ -754,21 +754,21 @@ struct HfCorrelatorDMesonPairs { if (ptCandMin >= 0. && candidate1.pt() < ptCandMin) { continue; } - bool isSignalD0Cand1 = std::abs(massD0Cand1 - MassD0) < massCut; - bool isSignalD0barCand1 = std::abs(massD0barCand1 - MassD0Bar) < massCut; + bool const isSignalD0Cand1 = std::abs(massD0Cand1 - MassD0) < massCut; + bool const isSignalD0barCand1 = std::abs(massD0barCand1 - MassD0Bar) < massCut; if (selectSignalRegionOnly && !(isSignalD0Cand1 || isSignalD0barCand1)) { continue; } - if (!(candidate1.isSelD0() >= selectionFlagD0 || candidate1.isSelD0bar() >= selectionFlagD0bar)) { + if (candidate1.isSelD0() < selectionFlagD0 && candidate1.isSelD0bar() < selectionFlagD0bar) { continue; } auto candidateType1 = assignCandidateTypeD0(candidate1); // Candidate type attribution - bool isDCand1 = isD(candidateType1); - bool isDbarCand1 = isDbar(candidateType1); - bool isTrueDCand1 = isTrueD(candidateType1); - bool isTrueDbarCand1 = isTrueDbar(candidateType1); + bool const isDCand1 = isD(candidateType1); + bool const isDbarCand1 = isDbar(candidateType1); + bool const isTrueDCand1 = isTrueD(candidateType1); + bool const isTrueDbarCand1 = isTrueDbar(candidateType1); int8_t matchedRec1 = candidate1.flagMcMatchRec(); int8_t originRec1 = candidate1.originMcRec(); @@ -858,8 +858,8 @@ struct HfCorrelatorDMesonPairs { auto ptCandidate2 = candidate2.pt(); auto yCandidate2 = hfHelper.yD0(candidate2); auto phiCandidate2 = candidate2.phi(); - float massD0Cand2 = hfHelper.invMassD0ToPiK(candidate2); - float massD0barCand2 = hfHelper.invMassD0barToKPi(candidate2); + float const massD0Cand2 = hfHelper.invMassD0ToPiK(candidate2); + float const massD0barCand2 = hfHelper.invMassD0barToKPi(candidate2); auto prong0Cand2 = candidate2.template prong0_as(); auto prong1Cand2 = candidate2.template prong1_as(); @@ -869,12 +869,12 @@ struct HfCorrelatorDMesonPairs { if (ptCandMin >= 0. && candidate2.pt() < ptCandMin) { continue; } - bool isSignalD0Cand2 = std::abs(massD0Cand2 - MassD0) < massCut; - bool isSignalD0barCand2 = std::abs(massD0barCand2 - MassD0Bar) < massCut; + bool const isSignalD0Cand2 = std::abs(massD0Cand2 - MassD0) < massCut; + bool const isSignalD0barCand2 = std::abs(massD0barCand2 - MassD0Bar) < massCut; if (selectSignalRegionOnly && !(isSignalD0Cand2 || isSignalD0barCand2)) { continue; } - if (!(candidate2.isSelD0() >= selectionFlagD0 || candidate2.isSelD0bar() >= selectionFlagD0bar)) { + if (candidate2.isSelD0() < selectionFlagD0 && candidate2.isSelD0bar() < selectionFlagD0bar) { continue; } if (daughterTracksCutFlag && ((prong0Cand1 == prong0Cand2) || (prong1Cand1 == prong1Cand2) || (prong0Cand1 == prong1Cand2) || (prong1Cand1 == prong0Cand2))) { @@ -882,10 +882,10 @@ struct HfCorrelatorDMesonPairs { } auto candidateType2 = assignCandidateTypeD0(candidate2); // Candidate type attribution - bool isDCand2 = isD(candidateType2); - bool isDbarCand2 = isDbar(candidateType2); - bool isTrueDCand2 = isTrueD(candidateType2); - bool isTrueDbarCand2 = isTrueDbar(candidateType2); + bool const isDCand2 = isD(candidateType2); + bool const isDbarCand2 = isDbar(candidateType2); + bool const isTrueDCand2 = isTrueD(candidateType2); + bool const isTrueDbarCand2 = isTrueDbar(candidateType2); int8_t matchedRec2 = candidate2.flagMcMatchRec(); int8_t originRec2 = candidate2.originMcRec(); @@ -916,7 +916,7 @@ struct HfCorrelatorDMesonPairs { // Fill tables fillEntry(isDCand1, isDbarCand1, isDCand2, isDbarCand2, candidateType1, candidateType2, yCandidate1, yCandidate2, phiCandidate1, phiCandidate2, ptCandidate1, ptCandidate2, massD0Cand1, massD0barCand1, massD0Cand2, massD0barCand2); - fillMcHistos(matchedRec1, matchedRec2, isTrueDCand1, isTrueDbarCand1, isTrueDCand2, isTrueDbarCand2); + fillMcHistos(matchedRec1, matchedRec2, static_cast(isTrueDCand1), static_cast(isTrueDbarCand1), static_cast(isTrueDCand2), static_cast(isTrueDbarCand2)); entryD0PairMcInfo(originRec1, originRec2, matchedRec1, matchedRec2); entryD0PairMl(outputMlD0Cand1, outputMlD0barCand1, outputMlD0Cand2, outputMlD0barCand2); @@ -924,7 +924,7 @@ struct HfCorrelatorDMesonPairs { // Fill tables fillEntry(isDCand1, isDbarCand1, isDCand2, isDbarCand2, candidateType1, candidateType2, yCandidate1, yCandidate2, phiCandidate1, phiCandidate2, ptCandidate1, ptCandidate2, massD0Cand1, massD0barCand1, massD0Cand2, massD0barCand2); - fillMcHistos(matchedRec1, matchedRec2, isTrueDCand1, isTrueDbarCand1, isTrueDCand2, isTrueDbarCand2); + fillMcHistos(matchedRec1, matchedRec2, static_cast(isTrueDCand1), static_cast(isTrueDbarCand1), static_cast(isTrueDCand2), static_cast(isTrueDbarCand2)); entryD0PairMcInfo(originRec1, originRec2, matchedRec1, matchedRec2); } } // end inner loop (Cand2) @@ -937,7 +937,7 @@ struct HfCorrelatorDMesonPairs { { int numPvContributorsGen{0}; for (const auto& collision : collisions) { // loop over reco collisions associated to this gen collision - int numPvContributors = collision.numContrib(); + int const numPvContributors = collision.numContrib(); if (numPvContributors > numPvContributorsGen) { // we take the associated reconstructed collision with higher number of PV contributors numPvContributorsGen = numPvContributors; @@ -957,8 +957,8 @@ struct HfCorrelatorDMesonPairs { continue; } auto particleType = assignParticleTypeD0Gen(particle); // Candidate type attribution - bool isDParticle = isTrueD(particleType); - bool isDbarParticle = isTrueDbar(particleType); + bool const isDParticle = isTrueD(particleType); + bool const isDbarParticle = isTrueDbar(particleType); if (isDParticle) { nDevent++; } @@ -1006,8 +1006,8 @@ struct HfCorrelatorDMesonPairs { registry.fill(HIST("hPtCandAfterCutMcGen"), particle1.pt()); auto particleType1 = assignParticleTypeD0Gen(particle1); // Candidate sign attribution - bool isDParticle1 = isTrueD(particleType1); - bool isDbarParticle1 = isTrueDbar(particleType1); + bool const isDParticle1 = isTrueD(particleType1); + bool const isDbarParticle1 = isTrueDbar(particleType1); // check if it's MC matched int8_t matchedGen1 = particle1.flagMcMatchGen(); @@ -1048,8 +1048,8 @@ struct HfCorrelatorDMesonPairs { } // Candidate sign attribution. auto particleType2 = assignParticleTypeD0Gen(particle2); - bool isDParticle2 = isTrueD(particleType2); - bool isDbarParticle2 = isTrueDbar(particleType2); + bool const isDParticle2 = isTrueD(particleType2); + bool const isDbarParticle2 = isTrueDbar(particleType2); // check if it's MC matched int8_t matchedGen2 = particle2.flagMcMatchGen(); diff --git a/PWGHF/HFC/TableProducer/correlatorDplusDminus.cxx b/PWGHF/HFC/TableProducer/correlatorDplusDminus.cxx index e4c2e0fe6bb..277f07d0eec 100644 --- a/PWGHF/HFC/TableProducer/correlatorDplusDminus.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDplusDminus.cxx @@ -64,7 +64,7 @@ const double epsilon = 1E-5; const int npTBinsMassAndEfficiency = o2::analysis::hf_cuts_dplus_to_pi_k_pi::NBinsPt; const double efficiencyDmesonDefault[npTBinsMassAndEfficiency] = {}; -auto efficiencyDmeson_v = std::vector{efficiencyDmesonDefault, efficiencyDmesonDefault + npTBinsMassAndEfficiency}; +const auto efficiencyDmesonV = std::vector{efficiencyDmesonDefault, efficiencyDmesonDefault + npTBinsMassAndEfficiency}; // histogram binning definition const int massAxisBins = 120; @@ -94,7 +94,7 @@ struct HfCorrelatorDplusDminus { Configurable multMin{"multMin", 0., "minimum multiplicity accepted"}; Configurable multMax{"multMax", 10000., "maximum multiplicity accepted"}; Configurable> binsPt{"binsPt", std::vector{o2::analysis::hf_cuts_dplus_to_pi_k_pi::vecBinsPt}, "pT bin limits for candidate mass plots and efficiency"}; - Configurable> efficiencyD{"efficiencyD", std::vector{efficiencyDmeson_v}, "Efficiency values for Dplus meson"}; + Configurable> efficiencyD{"efficiencyD", std::vector{efficiencyDmesonV}, "Efficiency values for Dplus meson"}; HfHelper hfHelper; SliceCache cache; @@ -183,12 +183,12 @@ struct HfCorrelatorDplusDminus { continue; } // check decay channel flag for candidate1 - if (!(candidate1.hfflag() & 1 << aod::hf_cand_3prong::DecayType::DplusToPiKPi)) { // probably dummy since already selected? not sure... + if ((candidate1.hfflag() & 1 << aod::hf_cand_3prong::DecayType::DplusToPiKPi) == 0) { // probably dummy since already selected? not sure... continue; } double efficiencyWeight = 1.; - if (applyEfficiency) { + if (applyEfficiency != 0) { efficiencyWeight = 1. / efficiencyD->at(o2::analysis::findBin(binsPt, candidate1.pt())); } @@ -222,7 +222,7 @@ struct HfCorrelatorDplusDminus { } for (const auto& candidate2 : selectedDPlusCandidatesGrouped) { // check decay channel flag for candidate2 - if (!(candidate2.hfflag() & 1 << aod::hf_cand_3prong::DecayType::DplusToPiKPi)) { // probably dummy since already selected? not sure... + if ((candidate2.hfflag() & 1 << aod::hf_cand_3prong::DecayType::DplusToPiKPi) == 0) { // probably dummy since already selected? not sure... continue; } auto innerSecondTrack = candidate2.prong1_as(); @@ -289,7 +289,7 @@ struct HfCorrelatorDplusDminus { bool flagDminusSignal = false; for (const auto& candidate1 : selectedDPlusCandidatesGroupedMC) { // check decay channel flag for candidate1 - if (!(candidate1.hfflag() & 1 << aod::hf_cand_3prong::DecayType::DplusToPiKPi)) { + if ((candidate1.hfflag() & 1 << aod::hf_cand_3prong::DecayType::DplusToPiKPi) == 0) { continue; } if (yCandMax >= 0. && std::abs(hfHelper.yDplus(candidate1)) > yCandMax) { @@ -300,7 +300,7 @@ struct HfCorrelatorDplusDminus { } double efficiencyWeight = 1.; - if (applyEfficiency) { + if (applyEfficiency != 0) { efficiencyWeight = 1. / efficiencyD->at(o2::analysis::findBin(binsPt, candidate1.pt())); } @@ -339,7 +339,7 @@ struct HfCorrelatorDplusDminus { } flagDplusSignal = std::abs(candidate1.flagMcMatchRec()) == hf_decay::hf_cand_3prong::DecayChannelMain::DplusToPiKPi; // flagDplusSignal 'true' if candidate1 matched to Dplus for (const auto& candidate2 : selectedDPlusCandidatesGroupedMC) { - if (!(candidate2.hfflag() & 1 << aod::hf_cand_3prong::DecayType::DplusToPiKPi)) { // check decay channel flag for candidate2 + if ((candidate2.hfflag() & 1 << aod::hf_cand_3prong::DecayType::DplusToPiKPi) == 0) { // check decay channel flag for candidate2 continue; } auto innerSecondTrack = candidate2.prong1_as(); @@ -398,7 +398,7 @@ struct HfCorrelatorDplusDminus { if (std::abs(particle1.pdgCode()) != Pdg::kDPlus) { continue; } - double yD = RecoDecay::y(particle1.pVector(), MassDPlus); + double const yD = RecoDecay::y(particle1.pVector(), MassDPlus); if (yCandMax >= 0. && std::abs(yD) > yCandMax) { continue; } @@ -489,13 +489,13 @@ struct HfCorrelatorDplusDminus { if (std::abs(particle1.pdgCode()) != PDG_t::kCharm) { // search c or cbar particles continue; } - int partMothPDG = particle1.mothers_as().front().pdgCode(); + int const partMothPDG = particle1.mothers_as().front().pdgCode(); // check whether mothers of quark c/cbar are still '4'/'-4' particles - in that case the c/cbar quark comes from its own fragmentation, skip it if (partMothPDG == particle1.pdgCode()) { continue; } counterCCbarBeforeEtasel++; // count c or cbar (before kinematic selection) - double yC = RecoDecay::y(particle1.pVector(), MassCharm); + double const yC = RecoDecay::y(particle1.pVector(), MassCharm); if (yCandMax >= 0. && std::abs(yC) > yCandMax) { continue; } diff --git a/PWGHF/HFC/TableProducer/correlatorDplusHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorDplusHadrons.cxx index c10865e21d2..2b7908f4dd5 100644 --- a/PWGHF/HFC/TableProducer/correlatorDplusHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDplusHadrons.cxx @@ -65,7 +65,7 @@ double getDeltaPhi(double phiD, double phiHadron) /// definition of variables for Dplus hadron pairs (in data-like, MC-reco and MC-kine tasks) const int npTBinsMassAndEfficiency = o2::analysis::hf_cuts_dplus_to_pi_k_pi::NBinsPt; -std::vector efficiencyDmeson(npTBinsMassAndEfficiency + 1); +const std::vector efficiencyDmeson(npTBinsMassAndEfficiency + 1); // definition of ME variables using BinningType = ColumnBinningPolicy>; @@ -114,7 +114,7 @@ struct HfCorrelatorDplusHadronsDplusSelection { isSel8 = collision.sel8(); } if (selNoSameBunchPileUpColl) { - isNosameBunchPileUp = static_cast(collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)); + isNosameBunchPileUp = collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup); } isSelColl = isDplusFound && isSel8 && isNosameBunchPileUp; dplusSel(isSelColl); @@ -133,7 +133,7 @@ struct HfCorrelatorDplusHadronsDplusSelection { if (std::abs(hfHelper.yDplus(candidate)) >= yCandMax || candidate.pt() <= ptCandMin) { continue; } - isDplusFound = 1; + isDplusFound = true; break; } } @@ -141,7 +141,7 @@ struct HfCorrelatorDplusHadronsDplusSelection { isSel8 = collision.sel8(); } if (selNoSameBunchPileUpColl) { - isNosameBunchPileUp = static_cast(collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)); + isNosameBunchPileUp = collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup); } isSelColl = isDplusFound && isSel8 && isNosameBunchPileUp; dplusSel(isSelColl); @@ -152,16 +152,16 @@ struct HfCorrelatorDplusHadronsDplusSelection { void processDplusSelectionMcGen(aod::McCollision const&, CandDplusMcGen const& mcParticles) { - bool isDplusFound = 0; + bool isDplusFound = false; for (const auto& particle1 : mcParticles) { if (std::abs(particle1.pdgCode()) != Pdg::kDPlus) { continue; } - double yD = RecoDecay::y(particle1.pVector(), MassDPlus); + double const yD = RecoDecay::y(particle1.pVector(), MassDPlus); if (std::abs(yD) >= yCandMax || particle1.pt() <= ptCandMin) { continue; } - isDplusFound = 1; + isDplusFound = true; break; } dplusSel(isDplusFound); @@ -240,17 +240,17 @@ struct HfCorrelatorDplusHadrons { void init(InitContext&) { AxisSpec axisMassD = {binsMassD, "inv. mass (pi^{+}K^{-}#pi^{+}) (GeV/#it{c}^{2})"}; - AxisSpec axisEta = {binsEta, "#it{#eta}"}; - AxisSpec axisPhi = {binsPhi, "#it{#varphi}"}; + AxisSpec const axisEta = {binsEta, "#it{#eta}"}; + AxisSpec const axisPhi = {binsPhi, "#it{#varphi}"}; AxisSpec axisPtD = {(std::vector)binsPtD, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec axisPtHadron = {(std::vector)binsPtHadron, "#it{p}_{T} Hadron (GeV/#it{c})"}; - AxisSpec axisMultiplicity = {binsMultiplicity, "Multiplicity"}; + AxisSpec const axisMultiplicity = {binsMultiplicity, "Multiplicity"}; AxisSpec axisMultFT0M = {binsMultFT0M, "MultiplicityFT0M"}; - AxisSpec axisPosZ = {binsZVtx, "PosZ"}; - AxisSpec axisBdtScore = {binsBdtScore, "Bdt score"}; - AxisSpec axisPoolBin = {binsPoolBin, "PoolBin"}; - AxisSpec axisStatus = {15, 0.5, 15.5, "Selection status"}; - AxisSpec axisRapidity = {100, -2, 2, "Rapidity"}; + AxisSpec const axisPosZ = {binsZVtx, "PosZ"}; + AxisSpec const axisBdtScore = {binsBdtScore, "Bdt score"}; + AxisSpec const axisPoolBin = {binsPoolBin, "PoolBin"}; + AxisSpec const axisStatus = {15, 0.5, 15.5, "Selection status"}; + AxisSpec const axisRapidity = {100, -2, 2, "Rapidity"}; registry.add("hPtCand", "Dplus,Hadron candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPtD}}); registry.add("hPtProng0", "Dplus,Hadron candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPtD}}); @@ -341,7 +341,7 @@ struct HfCorrelatorDplusHadrons { if (std::abs(hfHelper.yDplus(candidate)) >= yCandMax || candidate.pt() <= ptCandMin || candidate.pt() >= ptCandMax) { continue; } - int effBinD = o2::analysis::findBin(binsPtEfficiencyD, candidate.pt()); + int const effBinD = o2::analysis::findBin(binsPtEfficiencyD, candidate.pt()); double efficiencyWeightD = 1.; if (applyEfficiency) { efficiencyWeightD = 1. / efficiencyD->at(effBinD); @@ -421,7 +421,7 @@ struct HfCorrelatorDplusHadrons { } registry.fill(HIST("hMultiplicity"), nTracks); - float multiplicityFT0M = collision.multFT0M(); + float const multiplicityFT0M = collision.multFT0M(); // MC reco level bool isDplusPrompt = false; @@ -433,7 +433,7 @@ struct HfCorrelatorDplusHadrons { continue; } // efficiency weight determination - int effBinD = o2::analysis::findBin(binsPtEfficiencyD, candidate.pt()); + int const effBinD = o2::analysis::findBin(binsPtEfficiencyD, candidate.pt()); double efficiencyWeightD = 1.; if (applyEfficiency) { efficiencyWeightD = 1. / efficiencyD->at(effBinD); @@ -536,7 +536,7 @@ struct HfCorrelatorDplusHadrons { int counterDplusHadron = 0; registry.fill(HIST("hMCEvtCount"), 0); - BinningTypeMcGen corrBinningMcGen{{binsZVtx, binsMultiplicityMc}, true}; + BinningTypeMcGen const corrBinningMcGen{{binsZVtx, binsMultiplicityMc}, true}; int poolBin = corrBinningMcGen.getBin(std::make_tuple(mcCollision.posZ(), mcCollision.multMCFT0A())); registry.fill(HIST("hMultFT0AMcGen"), mcCollision.multMCFT0A()); @@ -551,7 +551,7 @@ struct HfCorrelatorDplusHadrons { if (std::abs(particle1.flagMcMatchGen()) != hf_decay::hf_cand_3prong::DecayChannelMain::DplusToPiKPi) { continue; } - double yD = RecoDecay::y(particle1.pVector(), MassDPlus); + double const yD = RecoDecay::y(particle1.pVector(), MassDPlus); if (std::abs(yD) >= yCandMax || particle1.pt() <= ptCandMin) { continue; } @@ -572,8 +572,8 @@ struct HfCorrelatorDplusHadrons { // prompt and non-prompt division std::vector listDaughters{}; - std::array arrDaughDplusPDG = {+kPiPlus, -kKPlus, kPiPlus}; - std::array prongsId; + std::array const arrDaughDplusPDG = {+kPiPlus, -kKPlus, kPiPlus}; + std::array prongsId{}; listDaughters.clear(); RecoDecay::getDaughters(particle1, &listDaughters, arrDaughDplusPDG, 2); int counterDaughters = 0; @@ -626,7 +626,7 @@ struct HfCorrelatorDplusHadrons { TracksData const& tracks) { auto tracksTuple = std::make_tuple(candidates, tracks); - Pair pairData{corrBinning, 5, -1, collisions, tracksTuple, &cache}; + Pair const pairData{corrBinning, 5, -1, collisions, tracksTuple, &cache}; for (const auto& [c1, tracks1, c2, tracks2] : pairData) { // LOGF(info, "Mixed event collisions: Index = (%d, %d), tracks Size: (%d, %d), Z Vertex: (%f, %f), Pool Bin: (%d, %d)", c1.globalIndex(), c2.globalIndex(), tracks1.size(), tracks2.size(), c1.posZ(), c2.posZ(), corrBinning.getBin(std::make_tuple(c1.posZ(), c1.multFT0M())),corrBinning.getBin(std::make_tuple(c2.posZ(), c2.multFT0M()))); // For debug @@ -648,16 +648,16 @@ struct HfCorrelatorDplusHadrons { TracksWithMc const& tracks, aod::McParticles const& mcParticles) { - BinningType corrBinning{{binsZVtx, binsMultiplicityMc}, true}; + BinningType const corrBinning{{binsZVtx, binsMultiplicityMc}, true}; for (const auto& candidate : candidates) { if (std::abs(hfHelper.yDplus(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { continue; } // Dplus flag - bool isDplusSignal = std::abs(candidate.flagMcMatchRec()) == hf_decay::hf_cand_3prong::DecayChannelMain::DplusToPiKPi; + bool const isDplusSignal = std::abs(candidate.flagMcMatchRec()) == hf_decay::hf_cand_3prong::DecayChannelMain::DplusToPiKPi; // prompt and non-prompt division - bool isDplusPrompt = candidate.originMcRec() == RecoDecay::OriginType::Prompt; - bool isDplusNonPrompt = candidate.originMcRec() == RecoDecay::OriginType::NonPrompt; + bool const isDplusPrompt = candidate.originMcRec() == RecoDecay::OriginType::Prompt; + bool const isDplusNonPrompt = candidate.originMcRec() == RecoDecay::OriginType::NonPrompt; if (isDplusSignal) { if (isDplusPrompt) { registry.fill(HIST("hPtCandMcRecSigPrompt"), candidate.pt()); @@ -673,11 +673,11 @@ struct HfCorrelatorDplusHadrons { } } auto tracksTuple = std::make_tuple(candidates, tracks); - Pair pairMcRec{corrBinning, numberEventsMixed, -1, collisions, tracksTuple, &cache}; + Pair const pairMcRec{corrBinning, numberEventsMixed, -1, collisions, tracksTuple, &cache}; for (const auto& [c1, tracks1, c2, tracks2] : pairMcRec) { int poolBin = corrBinning.getBin(std::make_tuple(c2.posZ(), c2.multFT0M())); - int poolBinDplus = corrBinning.getBin(std::make_tuple(c1.posZ(), c1.multFT0M())); + int const poolBinDplus = corrBinning.getBin(std::make_tuple(c1.posZ(), c1.multFT0M())); registry.fill(HIST("hMultFT0M"), c1.multFT0M()); registry.fill(HIST("hZVtx"), c1.posZ()); registry.fill(HIST("hTracksPoolBin"), poolBin); // note that the selections here are not yet applied @@ -722,16 +722,16 @@ struct HfCorrelatorDplusHadrons { void processMcGenMixedEvent(SelCollisionsWithDplusMc const& collisions, CandDplusMcGen const& mcParticles) { - BinningTypeMcGen corrBinningMcGen{{binsZVtx, binsMultiplicityMc}, true}; + BinningTypeMcGen const corrBinningMcGen{{binsZVtx, binsMultiplicityMc}, true}; auto tracksTuple = std::make_tuple(mcParticles, mcParticles); - Pair pairMcGen{corrBinningMcGen, numberEventsMixed, -1, collisions, tracksTuple, &cache}; + Pair const pairMcGen{corrBinningMcGen, numberEventsMixed, -1, collisions, tracksTuple, &cache}; for (const auto& [c1, tracks1, c2, tracks2] : pairMcGen) { int poolBin = corrBinningMcGen.getBin(std::make_tuple(c1.posZ(), c1.multMCFT0A())); for (const auto& [candidate, particleAssoc] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { if (std::abs(candidate.pdgCode()) != Pdg::kDPlus) { continue; } - double yD = RecoDecay::y(candidate.pVector(), MassDPlus); + double const yD = RecoDecay::y(candidate.pVector(), MassDPlus); if (std::abs(yD) > yCandGenMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { continue; } diff --git a/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx index 6b171bb23df..7d40e1e4db1 100644 --- a/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx @@ -28,6 +28,8 @@ #include "Common/Core/RecoDecay.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/TrackSelectionTables.h" #include @@ -44,6 +46,7 @@ #include #include #include +#include #include @@ -123,7 +126,7 @@ struct HfCorrelatorDsHadronsSelCollision { } if (selNoSameBunchPileUpColl) { isNosameBunchPileUp = false; - isNosameBunchPileUp = static_cast(collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)); + isNosameBunchPileUp = collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup); } isSelColl = isDsFound && isSel8 && isNosameBunchPileUp; collisionsWithSelDs(isSelColl); @@ -152,7 +155,7 @@ struct HfCorrelatorDsHadronsSelCollision { isSel8 = collision.sel8(); } if (selNoSameBunchPileUpColl) { - isNosameBunchPileUp = static_cast(collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)); + isNosameBunchPileUp = collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup); } isSelColl = isDsFound && isSel8 && isNosameBunchPileUp; collisionsWithSelDs(isSelColl); @@ -251,11 +254,11 @@ struct HfCorrelatorDsHadrons { AxisSpec axisPhi = {binsPhi, "#it{#varphi}"}; AxisSpec axisPtD = {(std::vector)binsPtD, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec axisPtHadron = {(std::vector)binsPtHadron, "#it{p}_{T} Hadron (GeV/#it{c})"}; - AxisSpec axisMultiplicity = {binsMultiplicity, "Multiplicity"}; + AxisSpec const axisMultiplicity = {binsMultiplicity, "Multiplicity"}; AxisSpec axisMultFT0M = {binsMultFT0M, "MultiplicityFT0M"}; - AxisSpec axisPosZ = {binsPosZ, "PosZ"}; - AxisSpec axisPoolBin = {binsPoolBin, "PoolBin"}; - AxisSpec axisStatus = {15, 0.5, 15.5, "Selection status"}; + AxisSpec const axisPosZ = {binsPosZ, "PosZ"}; + AxisSpec const axisPoolBin = {binsPoolBin, "PoolBin"}; + AxisSpec const axisStatus = {15, 0.5, 15.5, "Selection status"}; // Histograms for data analysis registry.add("hCollisionPoolBin", "Ds candidates collision pool bin", {HistType::kTH1F, {axisPoolBin}}); @@ -410,12 +413,12 @@ struct HfCorrelatorDsHadrons { CandDsData const& candidates, MyTracksData const& tracks) { - BinningType corrBinning{{zPoolBins, multPoolBins}, true}; + BinningType const corrBinning{{zPoolBins, multPoolBins}, true}; registry.fill(HIST("hZVtx"), collision.posZ()); registry.fill(HIST("hMultFT0M"), collision.multFT0M()); int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFT0M())); registry.fill(HIST("hCollisionPoolBin"), poolBin); - int nTracks = tracks.size(); + int const nTracks = tracks.size(); registry.fill(HIST("hMultiplicity"), nTracks); // Ds fill histograms and Ds-Hadron correlation for DsToKKPi @@ -428,7 +431,7 @@ struct HfCorrelatorDsHadrons { efficiencyWeightD = 1. / efficiencyD->at(o2::analysis::findBin(binsPtEfficiencyD, candidate.pt())); } auto prong0 = candidate.template prong0_as(); - int chargeDs = prong0.sign(); + int const chargeDs = prong0.sign(); std::vector outputMl = {-1., -1., -1.}; fillHisto(candidate); if (candidate.isSelDsToKKPi() >= selectionFlagDs) { @@ -494,7 +497,7 @@ struct HfCorrelatorDsHadrons { TracksWithMc const& tracks, aod::McParticles const& mcParticles) { - BinningType corrBinning{{zPoolBins, multPoolBins}, true}; + BinningType const corrBinning{{zPoolBins, multPoolBins}, true}; registry.fill(HIST("hZVtx"), collision.posZ()); registry.fill(HIST("hMultFT0M"), collision.multFT0M()); int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFT0M())); @@ -506,7 +509,7 @@ struct HfCorrelatorDsHadrons { bool isCorrectInvMassHypo = false; bool isDecayChan = false; bool isAlreadyFilledEvent = false; - float multiplicityFT0M = collision.multFT0M(); + float const multiplicityFT0M = collision.multFT0M(); for (const auto& candidate : candidates) { // prompt and non-prompt division isDsPrompt = candidate.originMcRec() == RecoDecay::OriginType::Prompt; @@ -528,7 +531,7 @@ struct HfCorrelatorDsHadrons { std::vector outputMl = {-1., -1., -1.}; auto prong0 = candidate.template prong0_as(); - int chargeDs = prong0.sign(); + int const chargeDs = prong0.sign(); if (isDsSignal && isDecayChan && isCorrectInvMassHypo) { fillHistoMcRecSig(candidate, multiplicityFT0M); @@ -651,7 +654,7 @@ struct HfCorrelatorDsHadrons { soa::Join const& collisions, CandDsMcGen const& mcParticles) { - BinningTypeMcGen corrBinningMcGen{{zPoolBins, multPoolBins}, true}; + BinningTypeMcGen const corrBinningMcGen{{zPoolBins, multPoolBins}, true}; for (const auto& mcCollision : mcCollisions) { @@ -697,7 +700,7 @@ struct HfCorrelatorDsHadrons { for (const auto& particle : groupedMcParticles) { // check if the particle is Ds if ((std::abs(particle.flagMcMatchGen()) == hf_decay::hf_cand_3prong::DecayChannelMain::DsToPiKK) && (particle.flagMcDecayChanGen() == channelsResonant[decayChannel])) { - double yD = RecoDecay::y(particle.pVector(), MassDS); + double const yD = RecoDecay::y(particle.pVector(), MassDS); if (std::abs(yD) > yCandGenMax || particle.pt() < ptCandMin || particle.pt() > ptCandMax) { continue; } @@ -706,8 +709,8 @@ struct HfCorrelatorDsHadrons { isDsPrompt = particle.originMcGen() == RecoDecay::OriginType::Prompt; isDecayChan = particle.flagMcDecayChanGen() == channelsResonant[decayChannel]; std::vector listDaughters{}; - std::array arrDaughDsPDG = {+kKPlus, -kKPlus, kPiPlus}; - std::array prongsId; + std::array const arrDaughDsPDG = {+kKPlus, -kKPlus, kPiPlus}; + std::array prongsId{}; listDaughters.clear(); RecoDecay::getDaughters(particle, &listDaughters, arrDaughDsPDG, 2); int counterDaughters = 0; @@ -798,7 +801,7 @@ struct HfCorrelatorDsHadrons { for (const auto& candidate : candsDsThisColl) { std::vector outputMl = {-1., -1., -1.}; auto prong0 = candidate.template prong0_as(); - int chargeDs = prong0.sign(); + int const chargeDs = prong0.sign(); // candidate selected if (candidate.isSelDsToKKPi() >= selectionFlagDs) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { @@ -821,8 +824,9 @@ struct HfCorrelatorDsHadrons { continue; } if (pidTrkApplied) { - if (!passPIDSelection(track, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) + if (!passPIDSelection(track, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) { continue; + } } assocTrackReduced(indexHfcReducedCollision, track.globalIndex(), track.phi(), track.eta(), track.pt() * track.sign()); assocTrackSelInfo(indexHfcReducedCollision, track.tpcNClsCrossedRows(), track.itsClusterMap(), track.itsNCls(), track.dcaXY(), track.dcaZ()); @@ -838,14 +842,14 @@ struct HfCorrelatorDsHadrons { CandDsData const& candidates, MyTracksData const& tracks) { - BinningType corrBinning{{zPoolBins, multPoolBins}, true}; + BinningType const corrBinning{{zPoolBins, multPoolBins}, true}; for (const auto& collision : collisions) { registry.fill(HIST("hMultFT0M"), collision.multFT0M()); registry.fill(HIST("hZVtx"), collision.posZ()); } auto tracksTuple = std::make_tuple(candidates, tracks); - Pair pairData{corrBinning, numberEventsMixed, -1, collisions, tracksTuple, &cache}; + Pair const pairData{corrBinning, numberEventsMixed, -1, collisions, tracksTuple, &cache}; for (const auto& [c1, tracks1, c2, tracks2] : pairData) { if (tracks1.size() == 0) { @@ -854,11 +858,11 @@ struct HfCorrelatorDsHadrons { // LOGF(info, "Mixed event collisions: Index = (%d, %d), tracks Size: (%d, %d), Z Vertex: (%f, %f), Pool Bin: (%d, %d)", c1.globalIndex(), c2.globalIndex(), tracks1.size(), tracks2.size(), c1.posZ(), c2.posZ(), corrBinning.getBin(std::make_tuple(c1.posZ(), c1.multFT0M())), corrBinning.getBin(std::make_tuple(c2.posZ(), c2.multFT0M()))); int poolBin = corrBinning.getBin(std::make_tuple(c2.posZ(), c2.multFT0M())); - int poolBinDs = corrBinning.getBin(std::make_tuple(c1.posZ(), c1.multFT0M())); + int const poolBinDs = corrBinning.getBin(std::make_tuple(c1.posZ(), c1.multFT0M())); registry.fill(HIST("hTracksPoolBin"), poolBin); // note that the selections here are not yet applied registry.fill(HIST("hDsPoolBin"), poolBinDs); // note that the selections here are not yet applied for (const auto& [cand, pAssoc] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - if (!(cand.hfflag() & 1 << aod::hf_cand_3prong::DecayType::DsToKKPi)) { + if ((cand.hfflag() & 1 << aod::hf_cand_3prong::DecayType::DsToKKPi) == 0) { continue; } if (std::abs(hfHelper.yDs(cand)) > yCandMax || cand.pt() < ptCandMin || cand.pt() > ptCandMax) { @@ -868,7 +872,7 @@ struct HfCorrelatorDsHadrons { continue; } auto prong0 = cand.template prong0_as(); - int chargeDs = prong0.sign(); + int const chargeDs = prong0.sign(); std::vector outputMl = {-1., -1., -1.}; // DsToKKPi and DsToPiKK division if (cand.isSelDsToKKPi() >= selectionFlagDs) { @@ -912,16 +916,14 @@ struct HfCorrelatorDsHadrons { TracksWithMc const& tracks, aod::McParticles const& mcParticles) { - BinningType corrBinning{{zPoolBins, multPoolBins}, true}; + BinningType const corrBinning{{zPoolBins, multPoolBins}, true}; for (const auto& candidate : candidates) { if (std::abs(hfHelper.yDs(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { continue; } if (std::abs(candidate.flagMcMatchRec()) == hf_decay::hf_cand_3prong::DecayChannelMain::DsToPiKK) { // DsToKKPi and DsToPiKK division - if (candidate.isSelDsToKKPi() >= selectionFlagDs) { - fillHistoMcRecSig(candidate, 0.); - } else if (candidate.isSelDsToPiKK() >= selectionFlagDs) { + if (candidate.isSelDsToKKPi() >= selectionFlagDs || candidate.isSelDsToPiKK() >= selectionFlagDs) { fillHistoMcRecSig(candidate, 0.); } } else { @@ -929,7 +931,7 @@ struct HfCorrelatorDsHadrons { } } auto tracksTuple = std::make_tuple(candidates, tracks); - Pair pairMcRec{corrBinning, numberEventsMixed, -1, collisions, tracksTuple, &cache}; + Pair const pairMcRec{corrBinning, numberEventsMixed, -1, collisions, tracksTuple, &cache}; bool isDsPrompt = false; bool isDsSignal = false; @@ -938,7 +940,7 @@ struct HfCorrelatorDsHadrons { int trackOrigin = 0; for (const auto& [c1, tracks1, c2, tracks2] : pairMcRec) { int poolBin = corrBinning.getBin(std::make_tuple(c2.posZ(), c2.multFT0M())); - int poolBinDs = corrBinning.getBin(std::make_tuple(c1.posZ(), c1.multFT0M())); + int const poolBinDs = corrBinning.getBin(std::make_tuple(c1.posZ(), c1.multFT0M())); registry.fill(HIST("hMultFT0M"), c1.multFT0M()); registry.fill(HIST("hZVtx"), c1.posZ()); registry.fill(HIST("hTracksPoolBin"), poolBin); // note that the selections here are not yet applied @@ -951,7 +953,7 @@ struct HfCorrelatorDsHadrons { continue; } auto prong0 = candidate.template prong0_as(); - int chargeDs = prong0.sign(); + int const chargeDs = prong0.sign(); std::vector outputMl = {-1., -1., -1.}; // prompt and non-prompt division isDsPrompt = candidate.originMcRec() == RecoDecay::OriginType::Prompt; @@ -1003,14 +1005,14 @@ struct HfCorrelatorDsHadrons { void processMcGenME(SelCollisionsMc const& collisions, CandDsMcGen const& mcParticles) { - BinningTypeMcGen corrBinningMcGen{{zPoolBins, multPoolBins}, true}; + BinningTypeMcGen const corrBinningMcGen{{zPoolBins, multPoolBins}, true}; auto tracksTuple = std::make_tuple(mcParticles, mcParticles); - Pair pairMcGen{corrBinningMcGen, numberEventsMixed, -1, collisions, tracksTuple, &cache}; + Pair const pairMcGen{corrBinningMcGen, numberEventsMixed, -1, collisions, tracksTuple, &cache}; for (const auto& [c1, tracks1, c2, tracks2] : pairMcGen) { int poolBin = corrBinningMcGen.getBin(std::make_tuple(c1.posZ(), c1.multMCFT0A())); for (const auto& [candidate, particleAssoc] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { if ((std::abs(candidate.flagMcMatchGen()) == hf_decay::hf_cand_3prong::DecayChannelMain::DsToPiKK) && (candidate.flagMcDecayChanGen() == decayChannel)) { - double yD = RecoDecay::y(candidate.pVector(), MassDS); + double const yD = RecoDecay::y(candidate.pVector(), MassDS); if (std::abs(yD) > yCandGenMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { continue; } diff --git a/PWGHF/HFC/TableProducer/correlatorDsHadronsReduced.cxx b/PWGHF/HFC/TableProducer/correlatorDsHadronsReduced.cxx index ece87ee21ad..f7aa4fbc31b 100644 --- a/PWGHF/HFC/TableProducer/correlatorDsHadronsReduced.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDsHadronsReduced.cxx @@ -83,9 +83,9 @@ struct HfCorrelatorDsHadronsReduced { void init(InitContext&) { - AxisSpec axisMultFT0M = {binsMultFT0M, "MultiplicityFT0M"}; - AxisSpec axisPosZ = {binsPosZ, "PosZ"}; - AxisSpec axisPoolBin = {binsPoolBin, "PoolBin"}; + AxisSpec const axisMultFT0M = {binsMultFT0M, "MultiplicityFT0M"}; + AxisSpec const axisPosZ = {binsPosZ, "PosZ"}; + AxisSpec const axisPoolBin = {binsPoolBin, "PoolBin"}; AxisSpec axisEta = {binsEta, "#it{#eta}"}; AxisSpec axisPhi = {binsPhi, "#it{#varphi}"}; AxisSpec axisPtD = {(std::vector)binsPtD, "#it{p}_{T} (GeV/#it{c})"}; @@ -110,7 +110,7 @@ struct HfCorrelatorDsHadronsReduced { soa::Join const& tracks) { - BinningTypeDerived corrBinning{{zPoolBins, multPoolBins}, true}; + BinningTypeDerived const corrBinning{{zPoolBins, multPoolBins}, true}; for (const auto& collision : collisions) { int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multiplicity())); @@ -156,10 +156,10 @@ struct HfCorrelatorDsHadronsReduced { aod::AssocTrackReds const& tracks) { - BinningTypeDerived corrBinning{{zPoolBins, multPoolBins}, true}; + BinningTypeDerived const corrBinning{{zPoolBins, multPoolBins}, true}; for (const auto& collision : collisions) { - int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multiplicity())); + int const poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multiplicity())); registry.fill(HIST("hCollisionPoolBin"), poolBin); registry.fill(HIST("hMultFT0M"), collision.multiplicity()); registry.fill(HIST("hZVtx"), collision.posZ()); @@ -182,7 +182,7 @@ struct HfCorrelatorDsHadronsReduced { auto tracksTuple = std::make_tuple(candidates, tracks); - Pair pairData{corrBinning, numberEventsMixed, -1, collisions, tracksTuple, &cache}; + Pair const pairData{corrBinning, numberEventsMixed, -1, collisions, tracksTuple, &cache}; for (const auto& [c1, tracks1, c2, tracks2] : pairData) { if (tracks1.size() == 0) { @@ -190,7 +190,7 @@ struct HfCorrelatorDsHadronsReduced { } int poolBin = corrBinning.getBin(std::make_tuple(c2.posZ(), c2.multiplicity())); - int poolBinDs = corrBinning.getBin(std::make_tuple(c1.posZ(), c1.multiplicity())); + int const poolBinDs = corrBinning.getBin(std::make_tuple(c1.posZ(), c1.multiplicity())); if (poolBin != poolBinDs) { LOGF(info, "Error, poolBins are diffrent"); diff --git a/PWGHF/HFC/TableProducer/correlatorDstarHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorDstarHadrons.cxx index 6f763420bcd..b24806c1b5c 100644 --- a/PWGHF/HFC/TableProducer/correlatorDstarHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDstarHadrons.cxx @@ -52,19 +52,19 @@ using namespace o2::framework::expressions; const int nBinsPtCorrelation = 8; const double binsPtCorrelationsDefault[nBinsPtCorrelation + 1] = {0., 2., 4., 6., 8., 12., 16., 24., 100.}; -auto vecBinsPtCorrelationsDefault = std::vector{binsPtCorrelationsDefault, binsPtCorrelationsDefault + nBinsPtCorrelation + 1}; +const auto vecBinsPtCorrelationsDefault = std::vector{binsPtCorrelationsDefault, binsPtCorrelationsDefault + nBinsPtCorrelation + 1}; const double signalRegionLefBoundDefault[nBinsPtCorrelation] = {0.144, 0.144, 0.144, 0.144, 0.144, 0.144, 0.144, 0.144}; -auto vecSignalRegionLefBoundDefault = std::vector{signalRegionLefBoundDefault, signalRegionLefBoundDefault + nBinsPtCorrelation}; +const auto vecSignalRegionLefBoundDefault = std::vector{signalRegionLefBoundDefault, signalRegionLefBoundDefault + nBinsPtCorrelation}; const double signalRegionRightBoundDefault[nBinsPtCorrelation] = {0.146, 0.146, 0.146, 0.146, 0.146, 0.146, 0.146, 0.146}; -auto vecSignalRegionRightBoundDefault = std::vector{signalRegionRightBoundDefault, signalRegionRightBoundDefault + nBinsPtCorrelation}; +const auto vecSignalRegionRightBoundDefault = std::vector{signalRegionRightBoundDefault, signalRegionRightBoundDefault + nBinsPtCorrelation}; const double sidebandRightInnerDefault[nBinsPtCorrelation] = {0.147, 0.147, 0.147, 0.147, 0.147, 0.147, 0.147, 0.147}; -auto vecSidebandRightInnerDefault = std::vector{sidebandRightInnerDefault, sidebandRightInnerDefault + nBinsPtCorrelation}; +const auto vecSidebandRightInnerDefault = std::vector{sidebandRightInnerDefault, sidebandRightInnerDefault + nBinsPtCorrelation}; const double sidebandRightOuterDefault[nBinsPtCorrelation] = {0.154, 0.154, 0.154, 0.154, 0.154, 0.154, 0.154, 0.154}; -auto vecSidebandRightOuterDefault = std::vector{sidebandRightOuterDefault, sidebandRightOuterDefault + nBinsPtCorrelation}; +const auto vecSidebandRightOuterDefault = std::vector{sidebandRightOuterDefault, sidebandRightOuterDefault + nBinsPtCorrelation}; // flaging a collision if D* meson is found. struct HfCorrelatorDstarHadronsCollisionSelector { @@ -144,9 +144,9 @@ struct HfCorrelatorDstarHadrons { Configurable> rightSidebandInnerBoundary{"rightSidebandInnerBoundary", std::vector{vecSidebandRightInnerDefault}, "right sideband inner boundary"}; // Inv Mass of Dstar and D0 Candidate - float invMassDstarParticle; - float invMassD0Particle; - int binNumber; + float invMassDstarParticle{}; + float invMassD0Particle{}; + int binNumber{}; SliceCache cache; // using BinningType = ColumnBinningPolicy>; @@ -196,7 +196,7 @@ struct HfCorrelatorDstarHadrons { LOGP(fatal, "One and only one process function must be enabled at a time."); } - AxisSpec axisSpecMultFT0M{binsMultiplicity, "Multiplicity in FT0M", "multFT0M"}; + AxisSpec const axisSpecMultFT0M{binsMultiplicity, "Multiplicity in FT0M", "multFT0M"}; invMassDstarParticle = -999.0; invMassD0Particle = -999.0; @@ -237,7 +237,7 @@ struct HfCorrelatorDstarHadrons { auto candidatesPerCol = candidates.sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); auto tracksPerCol = tracks.sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - if (candidatesPerCol.size() && tracksPerCol.size() == 0) { + if ((candidatesPerCol.size() != 0) && tracksPerCol.size() == 0) { continue; } // endif @@ -260,7 +260,7 @@ struct HfCorrelatorDstarHadrons { invMassD0Particle = cand.invMassD0Bar(); } auto ptDstar = cand.pt(); - int corrBinPtDstar = o2::analysis::findBin(binsPtCorrelations, ptDstar); + int const corrBinPtDstar = o2::analysis::findBin(binsPtCorrelations, ptDstar); auto deltaM = cand.invMassDstar() - cand.invMassD0(); if (deltaM > signalRegionLefBound->at(corrBinPtDstar) && deltaM < signalRegionRightBound->at(corrBinPtDstar)) { // Signal Region @@ -361,7 +361,7 @@ struct HfCorrelatorDstarHadrons { { auto dstarHadronTuple = std::make_tuple(candidates, tracks); - Pair pairData{binningScheme, 5, -1, collisions, dstarHadronTuple, &cache}; + Pair const pairData{binningScheme, 5, -1, collisions, dstarHadronTuple, &cache}; for (const auto& [c1, candidatesPerCol, c2, tracksPerCol] : pairData) { auto bc = c2.bc_as(); diff --git a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx index bb3c7c34b0a..f1d2fc578b4 100644 --- a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx +++ b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx @@ -13,17 +13,11 @@ /// \brief CharmHadrons-Hadrons correlator tree creator for data analyses /// \author Marcello Di Costanzo , Politecnico and INFN Torino -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/Core/RecoDecay.h" -#include #include -#include #include #include #include @@ -40,15 +34,15 @@ #include #include -#include +#include +#include +#include #include #include using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -using namespace o2::hf_centrality; -using namespace o2::hf_evsel; using BinningCentPosZ = ColumnBinningPolicy; using BinningMultPosZ = ColumnBinningPolicy; @@ -216,13 +210,13 @@ struct HfCorrelatorFlowCharmHadronsReduced { /// Get the binning pool associated to the collision /// \param collision is the collision /// \param binPolicy is the binning policy for the correlation - template + template int getPoolBin(const TColl& collision, const TBinningType& binPolicy) { int poolBin{0}; if constexpr (std::is_same_v) { poolBin = binPolicy.getBin(std::make_tuple(collision.posZ(), collision.centrality())); - if constexpr (isMixedEvent) { + if constexpr (IsMixedEvent) { registry.fill(HIST("hCentPoolBinME"), collision.centrality(), poolBin); registry.fill(HIST("hZVtxPoolBinME"), collision.posZ(), poolBin); } else { @@ -231,7 +225,7 @@ struct HfCorrelatorFlowCharmHadronsReduced { } } else if constexpr (std::is_same_v) { poolBin = binPolicy.getBin(std::make_tuple(collision.posZ(), collision.multiplicity())); - if constexpr (isMixedEvent) { + if constexpr (IsMixedEvent) { registry.fill(HIST("hMultFT0MPoolBinME"), collision.multiplicity(), poolBin); registry.fill(HIST("hZVtxPoolBinME"), collision.posZ(), poolBin); } else { @@ -261,28 +255,28 @@ struct HfCorrelatorFlowCharmHadronsReduced { /// \param trigCands are the selected trigger candidates /// \param assocTracks are the selected associated tracks /// \param binPolicy is the binning policy for the correlation - template + template void fillSameEvent(TPair const& pair, TTrigCand const& trigCand, TBinningType binPolicy) { auto collision = pair.template hfcRedCorrColl_as(); - double ptTrig = trigCand.ptTrig(); + double const ptTrig = trigCand.ptTrig(); if constexpr (requires { trigCand.bdtScore0Trig(); }) { // ML selection on bkg score for Charm-Had case if (!isSelBdtBkgScoreCut(trigCand, ptTrig)) { return; } } if (downSamplePairs < 1.) { - float pseudoRndm = ptTrig * 1000. - static_cast(ptTrig * 1000); + float const pseudoRndm = ptTrig * 1000. - static_cast(ptTrig * 1000); if (ptTrig < ptMaxForDownSample && collision.centrality() < centMaxForDownSample && pseudoRndm >= downSamplePairs) { return; } } - int poolBin = getPoolBin(collision, binPolicy); + int const poolBin = getPoolBin(collision, binPolicy); registry.fill(HIST("hPoolBinTrigSE"), poolBin); registry.fill(HIST("hPoolBinAssocSE"), poolBin); - if constexpr (fillTables) { + if constexpr (FillTables) { if constexpr (requires { trigCand.bdtScore0Trig(); }) { // Separate Charm-Had and Had-Had cases rowPairSECharmHads(poolBin, ptTrig, pair.ptAssoc(), pair.deltaEta(), pair.deltaPhi(), trigCand.invMassTrig(), trigCand.bdtScore0Trig(), trigCand.bdtScore1Trig(), @@ -294,7 +288,7 @@ struct HfCorrelatorFlowCharmHadronsReduced { } rowCollInfos(collision.multiplicity(), collision.numPvContrib(), collision.centrality()); } - if constexpr (fillSparses) { + if constexpr (FillSparses) { if constexpr (requires { trigCand.bdtScore0Trig(); }) { // Separate Charm-Had and Had-Had cases registry.fill(HIST("hSparseCorrelationsSECharmHad"), poolBin, ptTrig, pair.ptAssoc(), pair.deltaEta(), pair.deltaPhi(), trigCand.invMassTrig(), trigCand.bdtScore0Trig(), trigCand.bdtScore1Trig()); @@ -308,7 +302,7 @@ struct HfCorrelatorFlowCharmHadronsReduced { /// \param collisions are the selected collisions /// \param pairs are the mixed event pairs of trigger candidates and associated tracks /// \param binPolicy is the binning policy for the correlation - template + template void fillMixedEvent(TPairs const& pairs, TBinningType binPolicy) { @@ -316,8 +310,8 @@ struct HfCorrelatorFlowCharmHadronsReduced { if (trigCands.size() == 0 || assocTracks.size() == 0) { continue; } - int poolBinTrig = getPoolBin(trigColl, binPolicy); - int poolBinAssoc = getPoolBin(assocColl, binPolicy); + int const poolBinTrig = getPoolBin(trigColl, binPolicy); + int const poolBinAssoc = getPoolBin(assocColl, binPolicy); if (poolBinAssoc != poolBinTrig) { LOGF(info, "Error, poolBins are different"); continue; @@ -327,26 +321,26 @@ struct HfCorrelatorFlowCharmHadronsReduced { for (const auto& [trigCand, assocTrack] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(trigCands, assocTracks))) { // LOGF(info, "Mixed event tracks pair: (%d, %d) from events (%d, %d), track event: (%d, %d)", trigCand.index(), assocTrack.index(), trigColl.index(), assocColl.index(), trigCand.hfcRedFlowCollId(), assocTrack.hfcRedFlowCollId()); - double deltaEta = getEta(assocTrack) - getEta(trigCand); + double const deltaEta = getEta(assocTrack) - getEta(trigCand); if (std::abs(deltaEta) < deltaEtaAbsMin || std::abs(deltaEta) > deltaEtaAbsMax) { continue; } - double ptTrig = getPt(trigCand); + double const ptTrig = getPt(trigCand); if constexpr (requires { trigCand.bdtScore0Trig(); }) { // ML selection on bkg score for Charm-Had case if (!isSelBdtBkgScoreCut(trigCand, ptTrig)) { continue; } } - double ptAssoc = getPt(assocTrack); + double const ptAssoc = getPt(assocTrack); if (downSamplePairs < 1.) { - float pseudoRndm = ptAssoc * 1000. - static_cast(ptAssoc * 1000); + float const pseudoRndm = ptAssoc * 1000. - static_cast(ptAssoc * 1000); if (ptTrig < ptMaxForDownSample && trigColl.centrality() < centMaxForDownSample && assocColl.centrality() < centMaxForDownSample && pseudoRndm >= downSamplePairs) { continue; } } - double deltaPhi = RecoDecay::constrainAngle(getPhi(assocTrack) - getPhi(trigCand), -o2::constants::math::PIHalf); - if constexpr (fillTables) { + double const deltaPhi = RecoDecay::constrainAngle(getPhi(assocTrack) - getPhi(trigCand), -o2::constants::math::PIHalf); + if constexpr (FillTables) { if constexpr (requires { trigCand.bdtScore0Trig(); }) { // Separate Charm-Had and Had-Had cases rowPairMECharmHads(poolBinTrig, ptTrig, ptAssoc, deltaEta, deltaPhi, trigCand.invMassTrig(), trigCand.bdtScore0Trig(), trigCand.bdtScore1Trig(), @@ -358,7 +352,7 @@ struct HfCorrelatorFlowCharmHadronsReduced { } rowCollInfos(trigColl.multiplicity(), trigColl.numPvContrib(), trigColl.centrality()); } - if constexpr (fillSparses) { + if constexpr (FillSparses) { if constexpr (requires { trigCand.bdtScore0Trig(); }) { // Separate Charm-Had and Had-Had cases registry.fill(HIST("hSparseCorrelationsMECharmHad"), poolBinTrig, ptTrig, ptAssoc, deltaEta, deltaPhi, trigCand.invMassTrig(), trigCand.bdtScore0Trig(), trigCand.bdtScore1Trig()); @@ -435,7 +429,7 @@ struct HfCorrelatorFlowCharmHadronsReduced { AssocTracks const& tracks) { auto pairsTuple = std::make_tuple(candidates, tracks); - Pair pairs{binPolicyPosZCent, numberEventsMixed, -1, collisions, pairsTuple, &cache}; + Pair const pairs{binPolicyPosZCent, numberEventsMixed, -1, collisions, pairsTuple, &cache}; if (fillSparses && fillTables) { fillMixedEvent(pairs, binPolicyPosZCent); } else if (fillSparses) { @@ -451,7 +445,7 @@ struct HfCorrelatorFlowCharmHadronsReduced { AssocTracks const& tracks) { auto pairsTuple = std::make_tuple(candidates, tracks); - Pair pairs{binPolicyPosZMult, numberEventsMixed, -1, collisions, pairsTuple, &cache}; + Pair const pairs{binPolicyPosZMult, numberEventsMixed, -1, collisions, pairsTuple, &cache}; if (fillSparses && fillTables) { fillMixedEvent(pairs, binPolicyPosZMult); } else if (fillSparses) { @@ -466,7 +460,7 @@ struct HfCorrelatorFlowCharmHadronsReduced { AssocTracks const& tracks) { auto tracksTuple = std::make_tuple(tracks); - SameKindPair pairs{binPolicyPosZCent, numberEventsMixed, -1, collisions, tracksTuple, &cache}; + SameKindPair const pairs{binPolicyPosZCent, numberEventsMixed, -1, collisions, tracksTuple, &cache}; if (fillSparses && fillTables) { fillMixedEvent(pairs, binPolicyPosZCent); } else if (fillSparses) { @@ -481,7 +475,7 @@ struct HfCorrelatorFlowCharmHadronsReduced { AssocTracks const& tracks) { auto tracksTuple = std::make_tuple(tracks); - SameKindPair pairs{binPolicyPosZMult, numberEventsMixed, -1, collisions, tracksTuple, &cache}; + SameKindPair const pairs{binPolicyPosZMult, numberEventsMixed, -1, collisions, tracksTuple, &cache}; if (fillSparses && fillTables) { fillMixedEvent(pairs, binPolicyPosZMult); } else if (fillSparses) { diff --git a/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx index 8b3b8186e8a..d0d3a1707bd 100644 --- a/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx @@ -47,11 +47,12 @@ using namespace o2::framework::expressions; using namespace o2::soa; using namespace o2::aod::hf_sel_electron; -std::vector zBins{VARIABLE_WIDTH, -10.0, -2.5, 2.5, 10.0}; -std::vector multBins{VARIABLE_WIDTH, 0., 200., 500.0, 5000.}; -std::vector multBinsMcGen{VARIABLE_WIDTH, 0., 20., 50.0, 500.}; // In MCGen multiplicity is defined by counting primaries +const std::vector zBins{VARIABLE_WIDTH, -10.0, -2.5, 2.5, 10.0}; +const std::vector multBins{VARIABLE_WIDTH, 0., 200., 500.0, 5000.}; +const std::vector multBinsMcGen{VARIABLE_WIDTH, 0., 20., 50.0, 500.}; // In MCGen multiplicity is defined by counting primaries using BinningType = ColumnBinningPolicy>; -BinningType corrBinning{{zBins, multBins}, true}; +const BinningType corrBinning{{zBins, multBins}, true}; + using BinningTypeMcGen = ColumnBinningPolicy; struct HfCorrelatorHfeHadrons { @@ -112,11 +113,11 @@ struct HfCorrelatorHfeHadrons { void init(InitContext&) { - AxisSpec axisPosZ = {binsPosZ, "Pos Z"}; + AxisSpec const axisPosZ = {binsPosZ, "Pos Z"}; AxisSpec axisDeltaEta = {binsDeltaEta, "#Delta #eta = #eta_{Electron}- #eta_{Hadron}"}; AxisSpec axisDeltaPhi = {binsDeltaPhi, "#Delta #varphi = #varphi_{Electron}- #varphi_{Hadron}"}; AxisSpec axisPt = {binsPt, "#it{p_{T}}(GeV/#it{c})"}; - AxisSpec axisPoolBin = {binsPoolBin, "PoolBin"}; + AxisSpec const axisPoolBin = {binsPoolBin, "PoolBin"}; AxisSpec axisNSigma = {binsNSigma, "it{#sigma_{TPC}}"}; registry.add("hZvertex", "z vertex", {HistType::kTH1D, {axisPosZ}}); @@ -169,8 +170,9 @@ struct HfCorrelatorHfeHadrons { template void fillCorrelation(CollisionType const& collision, ElectronType const& electron, TracksType const& tracks, BcType const&) { - if (!(isRun3 ? collision.sel8() : (collision.sel7() && collision.alias_bit(kINT7)))) + if (!(isRun3 ? collision.sel8() : (collision.sel7() && collision.alias_bit(kINT7)))) { return; + } int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFT0M())); auto bc = collision.template bc_as(); int gCollisionId = collision.globalIndex(); @@ -303,8 +305,9 @@ struct HfCorrelatorHfeHadrons { template void fillMixCorrelation(CollisionType1 const&, CollisionType2 const& c2, ElectronType const& tracks1, TracksType const& tracks2) { - if (!(isRun3 ? c2.sel8() : (c2.sel7() && c2.alias_bit(kINT7)))) + if (!(isRun3 ? c2.sel8() : (c2.sel7() && c2.alias_bit(kINT7)))) { return; + } double ptElectronMix = -999; double phiElectronMix = -999; double etaElectronMix = -999; @@ -382,7 +385,7 @@ struct HfCorrelatorHfeHadrons { void processMcGen(McGenTableCollision const& mcCollision, aod::McParticles const& mcParticles, aod::HfMcGenSelEl const& electron) { - BinningTypeMcGen corrBinningMcGen{{zBins, multBinsMcGen}, true}; + BinningTypeMcGen const corrBinningMcGen{{zBins, multBinsMcGen}, true}; int poolBin = corrBinningMcGen.getBin(std::make_tuple(mcCollision.posZ(), mcCollision.multMCFT0A())); for (const auto& particleMc : mcParticles) { @@ -459,7 +462,7 @@ struct HfCorrelatorHfeHadrons { void processDataMixedEvent(TableCollisions const& collision, aod::HfCorrSelEl const& electron, TableTracks const& tracks) { auto tracksTuple = std::make_tuple(electron, tracks); - Pair pair{corrBinning, numberEventsMixed, -1, collision, tracksTuple, &cache}; + Pair const pair{corrBinning, numberEventsMixed, -1, collision, tracksTuple, &cache}; // loop over the rows of the new table for (const auto& [c1, tracks1, c2, tracks2] : pair) { @@ -474,7 +477,7 @@ struct HfCorrelatorHfeHadrons { void processMcRecMixedEvent(McTableCollisions const& mccollision, aod::HfCorrSelEl const& electron, McTableTracks const& mcTracks) { auto tracksTuple = std::make_tuple(electron, mcTracks); - Pair pairMcRec{corrBinning, numberEventsMixed, -1, mccollision, tracksTuple, &cache}; + Pair const pairMcRec{corrBinning, numberEventsMixed, -1, mccollision, tracksTuple, &cache}; // loop over the rows of the new table for (const auto& [c1, tracks1, c2, tracks2] : pairMcRec) { @@ -486,10 +489,10 @@ struct HfCorrelatorHfeHadrons { void processMcGenMixedEvent(McGenTableCollisions const& mcCollision, aod::HfMcGenSelEl const& electrons, aod::McParticles const& mcParticles) { - BinningTypeMcGen corrBinningMcGen{{zBins, multBinsMcGen}, true}; + BinningTypeMcGen const corrBinningMcGen{{zBins, multBinsMcGen}, true}; auto tracksTuple = std::make_tuple(electrons, mcParticles); - Pair pairMcGen{corrBinningMcGen, 5, -1, mcCollision, tracksTuple, &cache}; + Pair const pairMcGen{corrBinningMcGen, 5, -1, mcCollision, tracksTuple, &cache}; // loop over the rows of the new table double ptElectronMix = -999; diff --git a/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx index 3407c77829b..59360564a88 100644 --- a/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx @@ -132,7 +132,7 @@ struct HfCorrelatorLcHadronsSelection { isSel8 = collision.sel8(); } if (selNoSameBunchPileUpColl) { - isNosameBunchPileUp = static_cast(collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)); + isNosameBunchPileUp = collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup); } isCentInRange = (cent >= centMin && cent < centMax); @@ -162,7 +162,7 @@ struct HfCorrelatorLcHadronsSelection { isSel8 = collision.sel8(); } if (selNoSameBunchPileUpColl) { - isNosameBunchPileUp = static_cast(collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)); + isNosameBunchPileUp = collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup); } isSelColl = isLcFound && isSel8 && isNosameBunchPileUp; lcSel(isSelColl); @@ -178,7 +178,7 @@ struct HfCorrelatorLcHadronsSelection { isLcFound = false; continue; } - double yL = RecoDecay::y(particle.pVector(), MassLambdaCPlus); + double const yL = RecoDecay::y(particle.pVector(), MassLambdaCPlus); if (std::abs(yL) > yCandMax || particle.pt() < ptCandMin) { isLcFound = false; continue; @@ -288,17 +288,17 @@ struct HfCorrelatorLcHadrons { void init(InitContext&) { AxisSpec axisMassLc = {binsMassLc, "inv. mass (p K #pi) (GeV/#it{c}^{2})"}; - AxisSpec axisEta = {binsEta, "#it{eta}"}; - AxisSpec axisPhi = {binsPhi, "#it{#varphi}"}; + AxisSpec const axisEta = {binsEta, "#it{eta}"}; + AxisSpec const axisPhi = {binsPhi, "#it{#varphi}"}; AxisSpec axisPtLc = {(std::vector)binsPtLc, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec axisPtHadron = {(std::vector)binsPtHadron, "#it{p}_{T} Hadron (GeV/#it{c})"}; AxisSpec axisPtTrack = {500, 0, 50, "#it{p}_{T} Hadron (GeV/#it{c})"}; - AxisSpec axisMultiplicity = {binsMultiplicity, "Multiplicity"}; + AxisSpec const axisMultiplicity = {binsMultiplicity, "Multiplicity"}; AxisSpec axisMultFT0M = {binsMultFT0M, "MultiplicityFT0M"}; - AxisSpec axisPosZ = {binsZVtx, "PosZ"}; - AxisSpec axisBdtScore = {binsBdtScore, "Bdt score"}; - AxisSpec axisPoolBin = {binsPoolBin, "PoolBin"}; - AxisSpec axisRapidity = {100, -2, 2, "Rapidity"}; + AxisSpec const axisPosZ = {binsZVtx, "PosZ"}; + AxisSpec const axisBdtScore = {binsBdtScore, "Bdt score"}; + AxisSpec const axisPoolBin = {binsPoolBin, "PoolBin"}; + AxisSpec const axisRapidity = {100, -2, 2, "Rapidity"}; AxisSpec axisSign = {2, -1, 1, "Sign"}; AxisSpec axisCent = {binsCentFt0m, "Centrality"}; @@ -417,11 +417,11 @@ struct HfCorrelatorLcHadrons { continue; } double efficiencyWeightLc = 1.; - if (applyEfficiency) { + if (applyEfficiency != 0) { efficiencyWeightLc = 1. / efficiencyLc->at(o2::analysis::findBin(binsPtEfficiencyLc, candidate.pt())); } auto trackPos1 = candidate.template prong0_as(); // positive daughter (negative for the antiparticles) - int8_t chargeLc = trackPos1.sign(); // charge of 1st prong will be the charge of Lc candidate + int8_t const chargeLc = trackPos1.sign(); // charge of 1st prong will be the charge of Lc candidate registry.fill(HIST("hPtCand"), candidate.pt()); registry.fill(HIST("hPtProng0"), candidate.ptProng0()); @@ -472,8 +472,9 @@ struct HfCorrelatorLcHadrons { continue; } if (pidTrkApplied) { - if (!passPIDSelection(track, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) + if (!passPIDSelection(track, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) { continue; + } } if (correlateLcWithLeadingParticle) { if (track.globalIndex() != leadingIndex) { @@ -563,7 +564,7 @@ struct HfCorrelatorLcHadrons { } registry.fill(HIST("hMultiplicity"), nTracks); - float multiplicityFT0M = collision.multFT0M(); + float const multiplicityFT0M = collision.multFT0M(); // Mc reco level bool isLcPrompt = false; bool isLcNonPrompt = false; @@ -575,12 +576,12 @@ struct HfCorrelatorLcHadrons { continue; } double efficiencyWeightLc = 1.; - if (applyEfficiency) { + if (applyEfficiency != 0) { efficiencyWeightLc = 1. / efficiencyLc->at(o2::analysis::findBin(binsPtEfficiencyLc, candidate.pt())); } auto trackPos1 = candidate.template prong0_as(); // positive daughter (negative for the antiparticles) auto trackPos2 = candidate.template prong2_as(); - int8_t chargeLc = trackPos1.sign(); // charge of 1st prong will be the charge of Lc candidate + int8_t const chargeLc = trackPos1.sign(); // charge of 1st prong will be the charge of Lc candidate isLcSignal = std::abs(candidate.flagMcMatchRec()) == hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi; isLcPrompt = candidate.originMcRec() == RecoDecay::OriginType::Prompt; isLcNonPrompt = candidate.originMcRec() == RecoDecay::OriginType::NonPrompt; @@ -677,16 +678,18 @@ struct HfCorrelatorLcHadrons { continue; } - if (pidTrkApplied && (std::abs(track.pdgCode()) != kProton)) + if (pidTrkApplied && (std::abs(track.pdgCode()) != kProton)) { continue; // proton PID + } if (!track.isPhysicalPrimary()) { continue; } auto motherTrkGen = mcParticles.iteratorAt(track.mothersIds()[0]); - if (std::abs(motherTrkGen.pdgCode()) == kLambdaCPlus) + if (std::abs(motherTrkGen.pdgCode()) == kLambdaCPlus) { continue; + } auto chargeTrack = pdg->GetParticle(track.pdgCode())->Charge(); // Retrieve charge registry.fill(HIST("hPtTracksVsSignGen"), track.pt(), chargeTrack / (2 * std::abs(chargeTrack))); @@ -706,22 +709,26 @@ struct HfCorrelatorLcHadrons { continue; } if (pidTrkApplied) { - if (!passPIDSelection(track, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) + if (!passPIDSelection(track, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) { continue; + } } if (calTrkEff && countLc == 1 && (isLcSignal || !calEffLcEvent) && track.has_mcParticle()) { auto mcParticle = track.template mcParticle_as(); - if (!mcParticle.isPhysicalPrimary() && isRecTrkPhyPrimary) + if (!mcParticle.isPhysicalPrimary() && isRecTrkPhyPrimary) { continue; + } auto motherTrk = mcParticles.iteratorAt(mcParticle.mothersIds()[0]); - if (std::abs(motherTrk.pdgCode()) == kLambdaCPlus) + if (std::abs(motherTrk.pdgCode()) == kLambdaCPlus) { continue; + } registry.fill(HIST("hPtTracksVsSignRec"), track.pt(), track.sign() / 2.); - if (std::abs(mcParticle.pdgCode()) == kProton) + if (std::abs(mcParticle.pdgCode()) == kProton) { registry.fill(HIST("hPtTracksVsSignRecTrue"), track.pt(), track.sign() / 2.); + } } // Removing Lc daughters by checking track indices @@ -814,7 +821,7 @@ struct HfCorrelatorLcHadrons { int counterLcHadron = 0; registry.fill(HIST("hMcEvtCount"), 0); - BinningTypeMcGen corrBinningMcGen{{binsZVtx, binsMultiplicityMc}, true}; + BinningTypeMcGen const corrBinningMcGen{{binsZVtx, binsMultiplicityMc}, true}; int poolBin = corrBinningMcGen.getBin(std::make_tuple(mcCollision.posZ(), mcCollision.multMCFT0A())); registry.fill(HIST("hMultFT0AMcGen"), mcCollision.multMCFT0A()); @@ -835,7 +842,7 @@ struct HfCorrelatorLcHadrons { if (std::abs(particle.flagMcMatchGen()) != hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi) { continue; } - double yL = RecoDecay::y(particle.pVector(), MassLambdaCPlus); + double const yL = RecoDecay::y(particle.pVector(), MassLambdaCPlus); if (std::abs(yL) > yCandGenMax || particle.pt() < ptCandMin) { continue; } @@ -855,8 +862,8 @@ struct HfCorrelatorLcHadrons { // prompt and non-prompt division std::vector listDaughters{}; - std::array arrDaughLcPDG = {kProton, -kKPlus, kPiPlus}; - std::array prongsId; + std::array const arrDaughLcPDG = {kProton, -kKPlus, kPiPlus}; + std::array prongsId{}; listDaughters.clear(); RecoDecay::getDaughters(particle, &listDaughters, arrDaughLcPDG, 2); int counterDaughters = 0; @@ -887,8 +894,9 @@ struct HfCorrelatorLcHadrons { continue; } - if (pidTrkApplied && (std::abs(particleAssoc.pdgCode()) != kProton)) + if (pidTrkApplied && (std::abs(particleAssoc.pdgCode()) != kProton)) { continue; // proton PID + } if (!particleAssoc.isPhysicalPrimary()) { continue; @@ -900,8 +908,8 @@ struct HfCorrelatorLcHadrons { } } - int8_t chargeLc = pdg->GetParticle(particle.pdgCode())->Charge(); // Retrieve charge - int8_t chargeAssoc = pdg->GetParticle(particleAssoc.pdgCode())->Charge(); // Retrieve charge + int8_t const chargeLc = pdg->GetParticle(particle.pdgCode())->Charge(); // Retrieve charge + int8_t const chargeAssoc = pdg->GetParticle(particleAssoc.pdgCode())->Charge(); // Retrieve charge int trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, particleAssoc, true); registry.fill(HIST("hPtParticleAssocMcGen"), particleAssoc.pt()); @@ -927,7 +935,7 @@ struct HfCorrelatorLcHadrons { TracksData const& tracks) { auto tracksTuple = std::make_tuple(candidates, tracks); - Pair pairData{corrBinning, numberEventsMixed, -1, collisions, tracksTuple, &cache}; + Pair const pairData{corrBinning, numberEventsMixed, -1, collisions, tracksTuple, &cache}; for (const auto& [c1, tracks1, c2, tracks2] : pairData) { int poolBin = corrBinning.getBin(std::make_tuple(c2.posZ(), c2.multFT0M())); @@ -937,12 +945,13 @@ struct HfCorrelatorLcHadrons { } if (pidTrkApplied) { - if (!passPIDSelection(assocParticle, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) + if (!passPIDSelection(assocParticle, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) { continue; + } } auto trackPos1 = trigLc.template prong0_as(); // positive daughter (negative for the antiparticles) - int8_t chargeLc = trackPos1.sign(); // charge of 1st prong will be the charge of Lc candidate + int8_t const chargeLc = trackPos1.sign(); // charge of 1st prong will be the charge of Lc candidate float cent = 100.0; // will be updated later @@ -998,16 +1007,16 @@ struct HfCorrelatorLcHadrons { TracksWithMc const& tracks, aod::McParticles const& mcParticles) { - BinningType corrBinning{{binsZVtx, binsMultiplicityMc}, true}; + BinningType const corrBinning{{binsZVtx, binsMultiplicityMc}, true}; for (const auto& candidate : candidates) { if (std::abs(hfHelper.yLc(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { continue; } // Lc flag - bool isLcSignal = std::abs(candidate.flagMcMatchRec()) == hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi; + bool const isLcSignal = std::abs(candidate.flagMcMatchRec()) == hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi; // prompt and non-prompt division - bool isLcPrompt = candidate.originMcRec() == RecoDecay::OriginType::Prompt; - bool isLcNonPrompt = candidate.originMcRec() == RecoDecay::OriginType::NonPrompt; + bool const isLcPrompt = candidate.originMcRec() == RecoDecay::OriginType::Prompt; + bool const isLcNonPrompt = candidate.originMcRec() == RecoDecay::OriginType::NonPrompt; if (isLcSignal) { if (candidate.isSelLcToPKPi() >= selectionFlagLc) { if (isLcPrompt) { @@ -1034,11 +1043,11 @@ struct HfCorrelatorLcHadrons { } } auto tracksTuple = std::make_tuple(candidates, tracks); - Pair pairMcRec{corrBinning, numberEventsMixed, -1, collisions, tracksTuple, &cache}; + Pair const pairMcRec{corrBinning, numberEventsMixed, -1, collisions, tracksTuple, &cache}; for (const auto& [c1, tracks1, c2, tracks2] : pairMcRec) { int poolBin = corrBinning.getBin(std::make_tuple(c2.posZ(), c2.multFT0M())); - int poolBinLc = corrBinning.getBin(std::make_tuple(c1.posZ(), c1.multFT0M())); + int const poolBinLc = corrBinning.getBin(std::make_tuple(c1.posZ(), c1.multFT0M())); registry.fill(HIST("hMultFT0M"), c1.multFT0M()); registry.fill(HIST("hZvtx"), c1.posZ()); registry.fill(HIST("hTracksPoolBin"), poolBin); @@ -1057,11 +1066,12 @@ struct HfCorrelatorLcHadrons { bool isLcSignal = std::abs(candidate.flagMcMatchRec()) == hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi; bool isLcPrompt = candidate.originMcRec() == RecoDecay::OriginType::Prompt; if (pidTrkApplied) { - if (!passPIDSelection(pAssoc, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) + if (!passPIDSelection(pAssoc, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) { continue; + } } auto trackPos1 = candidate.template prong0_as(); // positive daughter (negative for the antiparticles) - int8_t chargeLc = trackPos1.sign(); // charge of 1st prong will be the charge of Lc candidate + int8_t const chargeLc = trackPos1.sign(); // charge of 1st prong will be the charge of Lc candidate if (pAssoc.has_mcParticle()) { auto mcParticle = pAssoc.template mcParticle_as(); @@ -1118,16 +1128,16 @@ struct HfCorrelatorLcHadrons { void processMcGenMixedEvent(SelCollisionsWithLcMc const& collisions, CandidatesLcMcGen const& mcParticles) { - BinningTypeMcGen corrBinningMcGen{{binsZVtx, binsMultiplicityMc}, true}; + BinningTypeMcGen const corrBinningMcGen{{binsZVtx, binsMultiplicityMc}, true}; auto tracksTuple = std::make_tuple(mcParticles, mcParticles); - Pair pairMcGen{corrBinningMcGen, numberEventsMixed, -1, collisions, tracksTuple, &cache}; + Pair const pairMcGen{corrBinningMcGen, numberEventsMixed, -1, collisions, tracksTuple, &cache}; for (const auto& [c1, tracks1, c2, tracks2] : pairMcGen) { int poolBin = corrBinningMcGen.getBin(std::make_tuple(c1.posZ(), c1.multMCFT0A())); for (const auto& [candidate, particleAssoc] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { if (std::abs(candidate.pdgCode()) != Pdg::kLambdaCPlus) { continue; } - double yL = RecoDecay::y(candidate.pVector(), MassLambdaCPlus); + double const yL = RecoDecay::y(candidate.pVector(), MassLambdaCPlus); if (std::abs(yL) > yCandGenMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { continue; } @@ -1143,9 +1153,9 @@ struct HfCorrelatorLcHadrons { if (pidTrkApplied && (std::abs(particleAssoc.pdgCode()) != kProton)) { continue; // proton PID } - int8_t chargeLc = pdg->GetParticle(candidate.pdgCode())->Charge(); // Retrieve charge - int8_t chargeAssoc = pdg->GetParticle(particleAssoc.pdgCode())->Charge(); // Retrieve charge - float cent = 100.0; // will be updated later + int8_t const chargeLc = pdg->GetParticle(candidate.pdgCode())->Charge(); // Retrieve charge + int8_t const chargeAssoc = pdg->GetParticle(particleAssoc.pdgCode())->Charge(); // Retrieve charge + float cent = 100.0; // will be updated later int trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, particleAssoc, true); bool isLcPrompt = candidate.originMcGen() == RecoDecay::OriginType::Prompt; diff --git a/PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx index a7f0d4846d2..e7557429c3a 100644 --- a/PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx @@ -24,6 +24,7 @@ #include "PWGHF/HFC/DataModel/CorrelationTables.h" #include "PWGHF/HFC/Utils/utilsCorrelations.h" #include "PWGHF/Utils/utilsAnalysis.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" #include "Common/CCDB/EventSelectionParams.h" #include "Common/Core/RecoDecay.h" @@ -104,7 +105,7 @@ struct HfCorrelatorLcScHadronsSelection { // filter on selection of Lc and decay channel Lc->PKPi Filter lcFilter = ((o2::aod::hf_track_index::hfflag & static_cast(1 << aod::hf_cand_3prong::DecayType::LcToPKPi)) != static_cast(0)) && (aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLc); - template + template void selectionCollision(CollType const& collision, CandType const& candidates) { bool isSelColl = true; @@ -116,8 +117,8 @@ struct HfCorrelatorLcScHadronsSelection { if (doSelLcCollision) { for (const auto& candidate : candidates) { - if constexpr (isCandSc) { - int8_t chargeCand = candidate.charge(); + if constexpr (IsCandSc) { + int8_t const chargeCand = candidate.charge(); if (chargeCand == chargeZero) { yCand = hfHelper.ySc0(candidate); @@ -147,19 +148,19 @@ struct HfCorrelatorLcScHadronsSelection { candSel(isSelColl); } - template + template void selectionCollisionMcGen(CandType const& mcParticles) { bool isCandFound = false; double massCand = -999.0; for (const auto& particle : mcParticles) { - isCandFound = matchCandAndMass(particle, massCand); + isCandFound = matchCandAndMass(particle, massCand); if (!isCandFound) { continue; } - double yCand = RecoDecay::y(particle.pVector(), massCand); + double const yCand = RecoDecay::y(particle.pVector(), massCand); if (std::abs(yCand) > yCandMax || particle.pt() < ptCandMin) { isCandFound = false; continue; @@ -300,9 +301,9 @@ struct HfCorrelatorLcScHadrons { bool isPrompt = false; bool isNonPrompt = false; bool isSignal = false; - const int8_t chargeScPlusPlus = 2; - const int8_t chargeZero = 0; - const int8_t assignedChargeSc0 = 1; // to distingush sc0 from anti-sc0, charge set to +1 and -1 + static constexpr int8_t ChargeScPlusPlus{2}; + static constexpr int8_t ChargeZero{0}; + static constexpr int8_t AssignedChargeSc0{1}; // to distinguish sc0 from anti-sc0, charge set to +1 and -1 TRandom3* rnd = new TRandom3(0); // std::vector outputMl = {-1., -1., -1.}; @@ -357,17 +358,17 @@ struct HfCorrelatorLcScHadrons { void init(InitContext&) { AxisSpec axisCandMass = {binsCandMass, "inv. mass (p K #pi) (GeV/#it{c}^{2})"}; - AxisSpec axisEta = {binsEta, "#it{eta}"}; - AxisSpec axisPhi = {binsPhi, "#it{#varphi}"}; + AxisSpec const axisEta = {binsEta, "#it{eta}"}; + AxisSpec const axisPhi = {binsPhi, "#it{#varphi}"}; AxisSpec axisPtLc = {static_cast>(binsPtLc), "#it{p}_{T} (GeV/#it{c})"}; AxisSpec axisPtHadron = {static_cast>(binsPtHadron), "#it{p}_{T} Hadron (GeV/#it{c})"}; AxisSpec axisPtTrack = {500, 0, 50, "#it{p}_{T} Hadron (GeV/#it{c})"}; - AxisSpec axisMultiplicity = {binsMultiplicity, "Multiplicity"}; + AxisSpec const axisMultiplicity = {binsMultiplicity, "Multiplicity"}; AxisSpec axisMultFT0M = {binsMultFT0M, "MultiplicityFT0M"}; - AxisSpec axisPosZ = {binsZVtx, "PosZ"}; - AxisSpec axisBdtScore = {binsBdtScore, "Bdt score"}; - AxisSpec axisPoolBin = {binsPoolBin, "PoolBin"}; - AxisSpec axisRapidity = {100, -2, 2, "Rapidity"}; + AxisSpec const axisPosZ = {binsZVtx, "PosZ"}; + AxisSpec const axisBdtScore = {binsBdtScore, "Bdt score"}; + AxisSpec const axisPoolBin = {binsPoolBin, "PoolBin"}; + AxisSpec const axisRapidity = {100, -2, 2, "Rapidity"}; AxisSpec axisSign = {5, -2.5, 2.5, "Sign"}; AxisSpec axisPtV0 = {500, 0., 50.0, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec axisMassV0 = {200, 0.9f, 1.2f, "inv. mass (p #pi) (GeV/#it{c}^{2})"}; @@ -451,14 +452,14 @@ struct HfCorrelatorLcScHadrons { } }; - template + template double estimateY(CandType const& candidate) { double y = -999.; - if constexpr (isCandSc) { - int8_t chargeCand = candidate.charge(); + if constexpr (IsCandSc) { + int8_t const chargeCand = candidate.charge(); - if (chargeCand == chargeZero) { + if (chargeCand == ChargeZero) { y = hfHelper.ySc0(candidate); } else { y = hfHelper.yScPlusPlus(candidate); @@ -531,7 +532,7 @@ struct HfCorrelatorLcScHadrons { return true; } - template + template void fillV0Histograms(CollType const& collV0, V0 const& v0s, TrackType const&) { for (const auto& v0 : v0s) { @@ -565,7 +566,7 @@ struct HfCorrelatorLcScHadrons { } } } - if constexpr (isMcRec) { + if constexpr (IsMcRec) { if (!v0.has_mcParticle() || !posTrackV0.has_mcParticle() || !negTrackV0.has_mcParticle()) { continue; } @@ -644,29 +645,31 @@ struct HfCorrelatorLcScHadrons { continue; } - if (pidTrkApplied && (std::abs(track.pdgCode()) != kProton)) + if (pidTrkApplied && (std::abs(track.pdgCode()) != kProton)) { continue; // proton PID + } if (!track.isPhysicalPrimary()) { continue; } auto motherTrkGen = mcParticles.iteratorAt(track.mothersIds()[0]); - if (std::abs(motherTrkGen.pdgCode()) == kLambdaCPlus) + if (std::abs(motherTrkGen.pdgCode()) == kLambdaCPlus) { continue; + } auto chargeTrack = pdg->GetParticle(track.pdgCode())->Charge(); // Retrieve charge registry.fill(HIST("hPtTracksVsSignGen"), track.pt(), chargeTrack / (std::abs(chargeTrack))); } } - template + template void fillCorrelationTable(bool trkPidFill, TrackType const& track, CandType const& candidate, const std::vector& outMl, int binPool, int8_t correlStatus, double yCand, int signCand, McPart const& mcParticles) { bool isPhysicalPrimary = false; int trackOrigin = -1; - float cent = 100.0; // will be updated later + float const cent = 100.0; // will be updated later entryCandHadronPair(getDeltaPhi(track.phi(), candidate.phi()), track.eta() - candidate.eta(), @@ -682,7 +685,7 @@ struct HfCorrelatorLcScHadrons { if (trkPidFill) { entryCandHadronPairTrkPID(track.tpcNSigmaPr(), track.tpcNSigmaKa(), track.tpcNSigmaPi(), track.tofNSigmaPr(), track.tofNSigmaKa(), track.tofNSigmaPi()); } - if constexpr (isMcRec) { + if constexpr (IsMcRec) { if (track.has_mcParticle()) { auto mcParticle = track.template mcParticle_as(); isPhysicalPrimary = mcParticle.isPhysicalPrimary(); @@ -699,7 +702,7 @@ struct HfCorrelatorLcScHadrons { } } - template + template void doSameEvent(CollisionType const& collision, TrackType const& tracks, CandType const& candidates, @@ -709,7 +712,7 @@ struct HfCorrelatorLcScHadrons { int nTracks = 0; int64_t timeStamp = 0; bool skipMixedEventTableFilling = false; - float multiplicityFT0M = collision.multFT0M(); + float const multiplicityFT0M = collision.multFT0M(); int gCollisionId = collision.globalIndex(); if (candidates.size() == 0) { return; @@ -721,7 +724,7 @@ struct HfCorrelatorLcScHadrons { } } - if constexpr (!isMcRec) { + if constexpr (!IsMcRec) { timeStamp = collision.template bc_as().timestamp(); } @@ -760,7 +763,7 @@ struct HfCorrelatorLcScHadrons { bool selLcPKPi = false; bool selLcPiKP = false; - yCand = estimateY(candidate); + yCand = estimateY(candidate); etaCand = candidate.eta(); ptCand = candidate.pt(); phiCand = RecoDecay::constrainAngle(candidate.phi(), -PIHalf); @@ -779,12 +782,12 @@ struct HfCorrelatorLcScHadrons { efficiencyWeightCand = 1. / efficiencyLc->at(o2::analysis::findBin(binsPtEfficiencyLc, ptCand)); } - if constexpr (isMcRec) { + if constexpr (IsMcRec) { isPrompt = candidate.originMcRec() == RecoDecay::OriginType::Prompt; isNonPrompt = candidate.originMcRec() == RecoDecay::OriginType::NonPrompt; } - if constexpr (isCandSc) { + if constexpr (IsCandSc) { chargeCand = candidate.charge(); const auto& candidateLc = candidate.template prongLc_as(); ptCandLc = candidateLc.pt(); @@ -800,13 +803,13 @@ struct HfCorrelatorLcScHadrons { fillMlOutput(probs, outputMlPiKP); massCandPiKP = std::abs(hfHelper.invMassScRecoLcToPiKP(candidate, candidateLc) - hfHelper.invMassLcToPiKP(candidateLc)); } - if constexpr (isMcRec) { + if constexpr (IsMcRec) { // isSignal = // (TESTBIT(std::abs(candidate.flagMcMatchRec()), aod::hf_cand_sigmac::DecayType::Sc0ToPKPiPi) && chargeCand == 0) || // (TESTBIT(std::abs(candidate.flagMcMatchRec()), aod::hf_cand_sigmac::DecayType::ScplusplusToPKPiPi) && std::abs(chargeCand) == 2); isSignal = - (std::abs(candidate.flagMcMatchRec()) == (1 << aod::hf_cand_sigmac::DecayType::Sc0ToPKPiPi) && chargeCand == chargeZero) || - (std::abs(candidate.flagMcMatchRec()) == (1 << aod::hf_cand_sigmac::DecayType::ScplusplusToPKPiPi) && std::abs(chargeCand) == chargeScPlusPlus); + (std::abs(candidate.flagMcMatchRec()) == (1 << aod::hf_cand_sigmac::DecayType::Sc0ToPKPiPi) && chargeCand == ChargeZero) || + (std::abs(candidate.flagMcMatchRec()) == (1 << aod::hf_cand_sigmac::DecayType::ScplusplusToPKPiPi) && std::abs(chargeCand) == ChargeScPlusPlus); auto trackPos1 = candidateLc.template prong0_as(); auto trackPos2 = candidateLc.template prong2_as(); @@ -821,8 +824,8 @@ struct HfCorrelatorLcScHadrons { } registry.fill(HIST("hPtProng0"), ptCandLc); - if (chargeCand == chargeZero) { - chargeCand = (signSoftPion < chargeZero) ? assignedChargeSc0 : -assignedChargeSc0; // to distingush sc0 from anti-sc0, charge set to +1 and -1 + if (chargeCand == ChargeZero) { + chargeCand = (signSoftPion < ChargeZero) ? AssignedChargeSc0 : -AssignedChargeSc0; // to distingush sc0 from anti-sc0, charge set to +1 and -1 } } else { @@ -841,7 +844,7 @@ struct HfCorrelatorLcScHadrons { auto trackPos1 = candidate.template prong0_as(); auto trackPos2 = candidate.template prong2_as(); chargeCand = trackPos1.sign(); - if constexpr (isMcRec) { + if constexpr (IsMcRec) { isSignal = std::abs(candidate.flagMcMatchRec()) == o2::hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi; if (calTrkEff && countCand == 1 && (isSignal || !calEffEventWithCand)) { calculateTrkEff(trackPos1, trackPos2, *mcParticles); @@ -904,7 +907,7 @@ struct HfCorrelatorLcScHadrons { // Correlation with hadrons for (const auto& track : tracks) { // Remove Lc daughters by checking track indices - if constexpr (!isCandSc) { + if constexpr (!IsCandSc) { if ((candidate.prong0Id() == track.globalIndex()) || (candidate.prong1Id() == track.globalIndex()) || (candidate.prong2Id() == track.globalIndex())) { if (!storeAutoCorrelationFlag) { continue; @@ -924,36 +927,40 @@ struct HfCorrelatorLcScHadrons { continue; } if (pidTrkApplied) { - if (!passPIDSelection(track, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) + if (!passPIDSelection(track, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) { continue; + } } if (correlateLcWithLeadingParticle) { if (track.globalIndex() != leadingIndex) { continue; } } - if constexpr (isMcRec) { + if constexpr (IsMcRec) { if (calTrkEff && countCand == 1 && (isSignal || !calEffEventWithCand) && track.has_mcParticle()) { auto mcParticle = track.template mcParticle_as(); - if (!mcParticle.isPhysicalPrimary() && isRecTrkPhyPrimary) + if (!mcParticle.isPhysicalPrimary() && isRecTrkPhyPrimary) { continue; + } auto motherTrk = mcParticles->iteratorAt(mcParticle.mothersIds()[0]); - if (std::abs(motherTrk.pdgCode()) == kLambdaCPlus) + if (std::abs(motherTrk.pdgCode()) == kLambdaCPlus) { continue; + } registry.fill(HIST("hPtTracksVsSignRec"), track.pt(), track.sign()); - if (std::abs(mcParticle.pdgCode()) == kProton) + if (std::abs(mcParticle.pdgCode()) == kProton) { registry.fill(HIST("hPtTracksVsSignRecTrue"), track.pt(), track.sign()); + } } } if (selLcPKPi) { - fillCorrelationTable(fillTrkPID, track, candidate, outputMlPKPi, poolBin, correlationStatus, yCand, chargeCand, *mcParticles); + fillCorrelationTable(fillTrkPID, track, candidate, outputMlPKPi, poolBin, correlationStatus, yCand, chargeCand, *mcParticles); entryCandHadronRecoInfo(massCandPKPi, false); } if (selLcPiKP) { - fillCorrelationTable(fillTrkPID, track, candidate, outputMlPiKP, poolBin, correlationStatus, yCand, chargeCand, *mcParticles); + fillCorrelationTable(fillTrkPID, track, candidate, outputMlPiKP, poolBin, correlationStatus, yCand, chargeCand, *mcParticles); entryCandHadronRecoInfo(massCandPiKP, false); } @@ -973,7 +980,7 @@ struct HfCorrelatorLcScHadrons { registry.fill(HIST("hMultFT0M"), multiplicityFT0M); } - template + template void doMixEvent(CollisionType const& collisions, TrackType const& tracks, CandType const& candidates, @@ -993,7 +1000,7 @@ struct HfCorrelatorLcScHadrons { bool selLcPiKP = false; auto tracksTuple = std::make_tuple(candidates, tracks); - Pair pairData{corrBinning, numberEventsMixed, -1, collisions, tracksTuple, &cache}; + Pair const pairData{corrBinning, numberEventsMixed, -1, collisions, tracksTuple, &cache}; for (const auto& [c1, tracks1, c2, tracks2] : pairData) { poolBin = corrBinning.getBin(std::make_tuple(c2.posZ(), c2.multFT0M())); @@ -1004,14 +1011,14 @@ struct HfCorrelatorLcScHadrons { registry.fill(HIST("hLcPoolBin"), poolBinLc); for (const auto& [candidate, assocParticle] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - yCand = estimateY(candidate); + yCand = estimateY(candidate); ptCand = candidate.pt(); - if constexpr (isMcRec) { + if constexpr (IsMcRec) { isPrompt = candidate.originMcRec() == RecoDecay::OriginType::Prompt; isNonPrompt = candidate.originMcRec() == RecoDecay::OriginType::NonPrompt; } - if constexpr (isCandSc) { + if constexpr (IsCandSc) { const auto& candidateLc = candidate.template prongLc_as(); chargeCand = candidate.charge(); @@ -1027,16 +1034,16 @@ struct HfCorrelatorLcScHadrons { fillMlOutput(probs, outputMlPiKP); massCandPiKP = std::abs(hfHelper.invMassScRecoLcToPiKP(candidate, candidateLc) - hfHelper.invMassLcToPiKP(candidateLc)); } - if constexpr (isMcRec) { + if constexpr (IsMcRec) { isSignal = - (TESTBIT(std::abs(candidate.flagMcMatchRec()), aod::hf_cand_sigmac::DecayType::Sc0ToPKPiPi) && chargeCand == chargeZero) || - (TESTBIT(std::abs(candidate.flagMcMatchRec()), aod::hf_cand_sigmac::DecayType::ScplusplusToPKPiPi) && std::abs(chargeCand) == chargeScPlusPlus); + (TESTBIT(std::abs(candidate.flagMcMatchRec()), aod::hf_cand_sigmac::DecayType::Sc0ToPKPiPi) && chargeCand == ChargeZero) || + (TESTBIT(std::abs(candidate.flagMcMatchRec()), aod::hf_cand_sigmac::DecayType::ScplusplusToPKPiPi) && std::abs(chargeCand) == ChargeScPlusPlus); signSoftPion = candidate.template prong1_as().sign(); } else { signSoftPion = candidate.template prong1_as().sign(); } - if (chargeCand == chargeZero) { - chargeCand = (signSoftPion < chargeZero) ? assignedChargeSc0 : -assignedChargeSc0; // to distingush sc0 from anti-sc0, charge set to +1 and -1 + if (chargeCand == ChargeZero) { + chargeCand = (signSoftPion < ChargeZero) ? AssignedChargeSc0 : -AssignedChargeSc0; // to distingush sc0 from anti-sc0, charge set to +1 and -1 } } else { selLcPKPi = candidate.isSelLcToPKPi() >= selectionFlagLc; @@ -1053,7 +1060,7 @@ struct HfCorrelatorLcScHadrons { } auto trackPos1 = candidate.template prong0_as(); chargeCand = trackPos1.sign(); - if constexpr (isMcRec) { + if constexpr (IsMcRec) { isSignal = std::abs(candidate.flagMcMatchRec()) == o2::hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi; } } @@ -1063,12 +1070,13 @@ struct HfCorrelatorLcScHadrons { } if (pidTrkApplied) { - if (!passPIDSelection(assocParticle, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) + if (!passPIDSelection(assocParticle, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) { continue; + } } if (selLcPKPi) { - fillCorrelationTable(fillTrkPID, assocParticle, candidate, outputMlPKPi, poolBin, correlationStatus, yCand, chargeCand, *mcParticles); + fillCorrelationTable(fillTrkPID, assocParticle, candidate, outputMlPKPi, poolBin, correlationStatus, yCand, chargeCand, *mcParticles); entryCandHadronRecoInfo(massCandPKPi, false); if (isPrompt) { @@ -1081,7 +1089,7 @@ struct HfCorrelatorLcScHadrons { } if (selLcPiKP) { - fillCorrelationTable(fillTrkPID, assocParticle, candidate, outputMlPiKP, poolBin, correlationStatus, yCand, chargeCand, *mcParticles); + fillCorrelationTable(fillTrkPID, assocParticle, candidate, outputMlPiKP, poolBin, correlationStatus, yCand, chargeCand, *mcParticles); entryCandHadronRecoInfo(massCandPiKP, false); if (isPrompt) { @@ -1096,7 +1104,7 @@ struct HfCorrelatorLcScHadrons { } } - template + template void doSameEventMcGen(CollisionType const& mcCollision, PartType const& mcParticles) { @@ -1104,7 +1112,7 @@ struct HfCorrelatorLcScHadrons { static constexpr std::size_t PDGChargeScale{3u}; registry.fill(HIST("hMcEvtCount"), 0); - BinningTypeMcGen corrBinningMcGen{{binsZVtx, binsMultiplicityMc}, true}; + BinningTypeMcGen const corrBinningMcGen{{binsZVtx, binsMultiplicityMc}, true}; poolBin = corrBinningMcGen.getBin(std::make_tuple(mcCollision.posZ(), mcCollision.multMCFT0A())); registry.fill(HIST("hMultFT0AMcGen"), mcCollision.multMCFT0A()); @@ -1116,11 +1124,11 @@ struct HfCorrelatorLcScHadrons { for (const auto& particle : mcParticles) { double massCand = -999.0; - bool isCandFound = isCandSc ? matchCandAndMass(particle, massCand) : matchCandAndMass(particle, massCand); + bool const isCandFound = IsCandSc ? matchCandAndMass(particle, massCand) : matchCandAndMass(particle, massCand); if (!isCandFound) { continue; } - double yCand = RecoDecay::y(particle.pVector(), massCand); + double const yCand = RecoDecay::y(particle.pVector(), massCand); if (std::abs(yCand) > yCandGenMax || particle.pt() < ptCandMin) { continue; @@ -1132,8 +1140,8 @@ struct HfCorrelatorLcScHadrons { registry.fill(HIST("hYMcGen"), yCand); int8_t chargeCand = pdg->GetParticle(particle.pdgCode())->Charge() / PDGChargeScale; // Retrieve charge - if (chargeCand == chargeZero) { - chargeCand = (particle.pdgCode() > chargeZero) ? assignedChargeSc0 : -assignedChargeSc0; // to distingush sc0 from anti-sc0, charge set to +1 and -1 + if (chargeCand == ChargeZero) { + chargeCand = (particle.pdgCode() > ChargeZero) ? AssignedChargeSc0 : -AssignedChargeSc0; // to distingush sc0 from anti-sc0, charge set to +1 and -1 } isPrompt = particle.originMcGen() == RecoDecay::OriginType::Prompt; @@ -1150,18 +1158,18 @@ struct HfCorrelatorLcScHadrons { static constexpr std::size_t NDaughtersLc{3u}; std::vector listDaughters{}; listDaughters.clear(); - const std::size_t nDaughtersExpected = isCandSc ? NDaughtersSc : NDaughtersLc; + const std::size_t nDaughtersExpected = IsCandSc ? NDaughtersSc : NDaughtersLc; - if (isCandSc) { + if (IsCandSc) { if (massCand == o2::constants::physics::MassSigmaC0 || massCand == o2::constants::physics::MassSigmaCStar0) { - std::array arrDaughSc0PDG = {kProton, -kKPlus, kPiPlus, kPiMinus}; + std::array const arrDaughSc0PDG = {kProton, -kKPlus, kPiPlus, kPiMinus}; RecoDecay::getDaughters(particle, &listDaughters, arrDaughSc0PDG, 2); } else { - std::array arrDaughScPlusPDG = {kProton, -kKPlus, kPiPlus, kPiPlus}; + std::array const arrDaughScPlusPDG = {kProton, -kKPlus, kPiPlus, kPiPlus}; RecoDecay::getDaughters(particle, &listDaughters, arrDaughScPlusPDG, 2); } } else { - std::array arrDaughLcPDG = {kProton, -kKPlus, kPiPlus}; + std::array const arrDaughLcPDG = {kProton, -kKPlus, kPiPlus}; RecoDecay::getDaughters(particle, &listDaughters, arrDaughLcPDG, 2); } @@ -1195,8 +1203,9 @@ struct HfCorrelatorLcScHadrons { continue; } - if (pidTrkApplied && (std::abs(particleAssoc.pdgCode()) != kProton)) + if (pidTrkApplied && (std::abs(particleAssoc.pdgCode()) != kProton)) { continue; // proton PID + } if (!particleAssoc.isPhysicalPrimary()) { continue; @@ -1212,7 +1221,7 @@ struct HfCorrelatorLcScHadrons { int8_t chargeAssoc = pdg->GetParticle(particleAssoc.pdgCode())->Charge(); // Retrieve charge chargeAssoc = chargeAssoc / std::abs(chargeAssoc); registry.fill(HIST("hPtParticleAssocMcGen"), particleAssoc.pt()); - float cent = 100.0; // will be updated later + float const cent = 100.0; // will be updated later entryCandHadronPair(getDeltaPhi(particleAssoc.phi(), particle.phi()), particleAssoc.eta() - particle.eta(), @@ -1334,16 +1343,16 @@ struct HfCorrelatorLcScHadrons { void processMcGenMixedEvent(SelCollisionsMc const& collisions, CandidatesLcMcGen const& mcParticles) { - BinningTypeMcGen corrBinningMcGen{{binsZVtx, binsMultiplicityMc}, true}; + BinningTypeMcGen const corrBinningMcGen{{binsZVtx, binsMultiplicityMc}, true}; auto tracksTuple = std::make_tuple(mcParticles, mcParticles); - Pair pairMcGen{corrBinningMcGen, numberEventsMixed, -1, collisions, tracksTuple, &cache}; + Pair const pairMcGen{corrBinningMcGen, numberEventsMixed, -1, collisions, tracksTuple, &cache}; for (const auto& [c1, tracks1, c2, tracks2] : pairMcGen) { poolBin = corrBinningMcGen.getBin(std::make_tuple(c1.posZ(), c1.multMCFT0A())); for (const auto& [candidate, particleAssoc] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { if (std::abs(candidate.pdgCode()) != Pdg::kLambdaCPlus) { continue; } - double yL = RecoDecay::y(candidate.pVector(), MassLambdaCPlus); + double const yL = RecoDecay::y(candidate.pVector(), MassLambdaCPlus); if (std::abs(yL) > yCandGenMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { continue; } @@ -1359,9 +1368,9 @@ struct HfCorrelatorLcScHadrons { if (pidTrkApplied && (std::abs(particleAssoc.pdgCode()) != kProton)) { continue; // proton PID } - int8_t chargeLc = pdg->GetParticle(candidate.pdgCode())->Charge(); // Retrieve charge - int8_t chargeAssoc = pdg->GetParticle(particleAssoc.pdgCode())->Charge(); // Retrieve charge - float cent = 100.0; // will be updated later + int8_t const chargeLc = pdg->GetParticle(candidate.pdgCode())->Charge(); // Retrieve charge + int8_t const chargeAssoc = pdg->GetParticle(particleAssoc.pdgCode())->Charge(); // Retrieve charge + float cent = 100.0; // will be updated later int trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, particleAssoc, true); bool isPrompt = candidate.originMcGen() == RecoDecay::OriginType::Prompt; @@ -1381,7 +1390,7 @@ struct HfCorrelatorLcScHadrons { PROCESS_SWITCH(HfCorrelatorLcScHadrons, processMcGenMixedEvent, "Process Mixed Event McGen", false); void processDataLambdaV0(soa::Join::iterator const& collision, - TracksData const& tracks, aod::V0Datas const& V0s) + TracksData const& tracks, aod::V0Datas const& v0s) { registry.fill(HIST("hEventLambdaV0"), 0.5); if (!eventSelV0(collision)) { @@ -1389,12 +1398,12 @@ struct HfCorrelatorLcScHadrons { } registry.fill(HIST("hEventLambdaV0"), 1.5); - fillV0Histograms(collision, V0s, tracks); + fillV0Histograms(collision, v0s, tracks); } PROCESS_SWITCH(HfCorrelatorLcScHadrons, processDataLambdaV0, "Data process for v0 lambda", false); void processMcLambdaV0(soa::Join::iterator const& collision, - TracksWithMc const& tracks, soa::Join const& V0s, aod::McParticles const&) + TracksWithMc const& tracks, soa::Join const& v0s, aod::McParticles const&) { registry.fill(HIST("hEventLambdaV0"), 0.5); if (!eventSelV0(collision)) { @@ -1402,7 +1411,7 @@ struct HfCorrelatorLcScHadrons { } registry.fill(HIST("hEventLambdaV0"), 1.5); - fillV0Histograms(collision, V0s, tracks); + fillV0Histograms(collision, v0s, tracks); } PROCESS_SWITCH(HfCorrelatorLcScHadrons, processMcLambdaV0, "Mc process for v0 lambda", false); }; diff --git a/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx b/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx index 0ccbc065dd9..0ae49453a27 100644 --- a/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx +++ b/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx @@ -15,12 +15,16 @@ /// \author Stefano Politanò , CERN /// \author Wu Chuntai , CCNU, INFN Padova, and Padova University +#include "PWGHF/Core/CentralityEstimation.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h" #include "PWGHF/Utils/utilsEvSelHf.h" +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/TrackSelectionTables.h" @@ -28,20 +32,21 @@ #include #include #include -#include #include #include #include -#include #include -#include #include #include #include #include -#include #include +#include +#include + +#include +#include #include #include @@ -51,7 +56,7 @@ using namespace o2::framework::expressions; using namespace o2::hf_centrality; using namespace o2::hf_evsel; -enum CandType { +enum CandidateType { DplusToPiKPi = 0, DsToKKPi, DsToPiKK, @@ -188,22 +193,22 @@ struct HfDerivedDataCreatorCorrelationsReduced { /// Get charm hadron candidate mass /// \param candidate is the charm hadron candidate - template + template double getCandMass(const TCand& candidate) { - if constexpr (candType == CandType::DsToKKPi) { + if constexpr (CandType == CandidateType::DsToKKPi) { return hfHelper.invMassDsToKKPi(candidate); } - if constexpr (candType == CandType::DsToPiKK) { + if constexpr (CandType == CandidateType::DsToPiKK) { return hfHelper.invMassDsToPiKK(candidate); } - if constexpr (candType == CandType::DplusToPiKPi) { + if constexpr (CandType == CandidateType::DplusToPiKPi) { return hfHelper.invMassDplusToPiKPi(candidate); } - if constexpr (candType == CandType::D0ToPiK) { + if constexpr (CandType == CandidateType::D0ToPiK) { return hfHelper.invMassD0ToPiK(candidate); } - if constexpr (candType == CandType::D0ToKPi) { + if constexpr (CandType == CandidateType::D0ToKPi) { return hfHelper.invMassD0barToKPi(candidate); } return -1.; @@ -211,31 +216,31 @@ struct HfDerivedDataCreatorCorrelationsReduced { /// Get charm hadron bdt scores /// \param candidate is the charm hadron candidate - template + template std::array getCandMlScores(const TCand& candidate) { std::array outputMl{-999.f, -999.f}; - if constexpr (candType == CandType::DsToKKPi) { + if constexpr (CandType == CandidateType::DsToKKPi) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDsToKKPi()[classMl->at(iclass)]; } } - if constexpr (candType == CandType::DsToPiKK) { + if constexpr (CandType == CandidateType::DsToPiKK) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDsToPiKK()[classMl->at(iclass)]; } } - if constexpr (candType == CandType::DplusToPiKPi) { + if constexpr (CandType == CandidateType::DplusToPiKPi) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDplusToPiKPi()[classMl->at(iclass)]; } } - if constexpr (candType == CandType::D0ToPiK) { + if constexpr (CandType == CandidateType::D0ToPiK) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbD0()[classMl->at(iclass)]; } } - if constexpr (candType == CandType::D0ToKPi) { + if constexpr (CandType == CandidateType::D0ToKPi) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbD0bar()[classMl->at(iclass)]; } @@ -266,16 +271,13 @@ struct HfDerivedDataCreatorCorrelationsReduced { std::abort(); } hfEvSel.fillHistograms(collision, collRejMask, cent); - if (collRejMask != 0) { - return false; - } - return true; + return collRejMask == 0; } /// Checks if the trigger cand-associated track pair can be accepted for SE correlation /// \param assTrk is the associated track /// \param cand is the trigger candidate - template + template bool acceptSameEvtPair(TAssocTrk const& assTrk, TCand const& cand, double deltaEta) { if (std::abs(deltaEta) <= deltaEtaAbsMin || std::abs(deltaEta) > deltaEtaAbsMax) { @@ -286,8 +288,8 @@ struct HfDerivedDataCreatorCorrelationsReduced { return false; } - int trackGlobalIndex = assTrk.globalIndex(); - if constexpr (candType == CandType::Hadron) { + int const trackGlobalIndex = assTrk.globalIndex(); + if constexpr (CandType == CandidateType::Hadron) { if (!cand.isGlobalTrackWoDCA() || cand.tpcNClsCrossedRows() < tpcNClsCrossedRowsMin) { return false; } @@ -312,7 +314,7 @@ struct HfDerivedDataCreatorCorrelationsReduced { /// \param trigCands are the trigger candidates /// \param assTrks are the associated tracks /// \param collCentrality is the collision centrality - template + template void fillSameEvent(TTrigCands const& trigCands, TAssocTrks const& assTrks, const float collCentrality) @@ -321,28 +323,28 @@ struct HfDerivedDataCreatorCorrelationsReduced { double trigCandPt = trigCand.pt(); registry.fill(HIST("hPhiVsPtTrig"), RecoDecay::constrainAngle(trigCand.phi(), -o2::constants::math::PIHalf), trigCandPt); registry.fill(HIST("hEtaVsPtTrig"), trigCand.eta(), trigCandPt); - if constexpr (candType == CandType::Hadron) { + if constexpr (CandType == CandidateType::Hadron) { rowTrigHads(trigCandPt, trigCand.tpcNClsCrossedRows(), trigCand.itsClusterMap(), trigCand.itsNCls(), trigCand.dcaXY(), trigCand.dcaZ()); } else { - std::array outputMl = getCandMlScores(trigCand); - rowTrigCharms(trigCandPt, getCandMass(trigCand), outputMl[0], outputMl[1]); + std::array outputMl = getCandMlScores(trigCand); + rowTrigCharms(trigCandPt, getCandMass(trigCand), outputMl[0], outputMl[1]); } for (const auto& assTrk : assTrks) { double assTrkPt = assTrk.pt(); if (usePtDiffDcaXYCut) { - float dcaXYTrkCut = funcDcaXYPtCutPrimTrk->Eval(assTrkPt); + float const dcaXYTrkCut = funcDcaXYPtCutPrimTrk->Eval(assTrkPt); if (std::fabs(assTrk.dcaXY()) > dcaXYTrkCut) { continue; } } double deltaEta = assTrk.eta() - trigCand.eta(); - if (!acceptSameEvtPair(assTrk, trigCand, deltaEta)) { + if (!acceptSameEvtPair(assTrk, trigCand, deltaEta)) { continue; } if (downSampleTrksFactor < 1.) { - float pseudoRndm = assTrkPt * 1000. - static_cast(assTrkPt * 1000); + float const pseudoRndm = assTrkPt * 1000. - static_cast(assTrkPt * 1000); if (assTrkPt < ptMaxForDownSample && collCentrality < centMaxForDownSample && pseudoRndm >= downSampleTrksFactor) { continue; } @@ -356,7 +358,7 @@ struct HfDerivedDataCreatorCorrelationsReduced { double deltaPhi = RecoDecay::constrainAngle(assTrk.phi() - trigCand.phi(), -o2::constants::math::PIHalf); rowAssocTrkSels(assTrk.tpcNClsCrossedRows(), assTrk.itsClusterMap(), assTrk.itsNCls(), assTrk.dcaXY(), assTrk.dcaZ()); - if constexpr (candType == CandType::Hadron) { + if constexpr (CandType == CandidateType::Hadron) { rowSEHadHadPairs(rowCollisions.lastIndex(), rowTrigHads.lastIndex(), assTrkPt, deltaEta, deltaPhi); } else { rowSECharmHadPairs(rowCollisions.lastIndex(), rowTrigCharms.lastIndex(), assTrkPt, deltaEta, deltaPhi); @@ -367,16 +369,16 @@ struct HfDerivedDataCreatorCorrelationsReduced { /// Fill charm hadron tables for mixed-event /// \param trigCands are the charm trigger candidates - template + template void fillCharmMixedEvent(TTrigCands const& trigCands) { for (const auto& trigCand : trigCands) { registry.fill(HIST("hPhiVsPtTrig"), RecoDecay::constrainAngle(trigCand.phi(), -o2::constants::math::PIHalf), trigCand.pt()); registry.fill(HIST("hEtaVsPtTrig"), trigCand.eta(), trigCand.pt()); - std::array outputMl = getCandMlScores(trigCand); + std::array outputMl = getCandMlScores(trigCand); rowTrigBases(rowCollisions.lastIndex(), trigCand.phi(), trigCand.eta()); - rowTrigCharms(trigCand.pt(), getCandMass(trigCand), outputMl[0], outputMl[1]); + rowTrigCharms(trigCand.pt(), getCandMass(trigCand), outputMl[0], outputMl[1]); } } @@ -394,13 +396,13 @@ struct HfDerivedDataCreatorCorrelationsReduced { } double assTrkPt = assTrk.pt(); if (usePtDiffDcaXYCut) { - float dcaXYTrkCut = funcDcaXYPtCutPrimTrk->Eval(assTrkPt); + float const dcaXYTrkCut = funcDcaXYPtCutPrimTrk->Eval(assTrkPt); if (std::fabs(assTrk.dcaXY()) > dcaXYTrkCut) { continue; } } if (!first && downSampleTrksFactor < 1.) { // skip downsampling for the first track to avoid empty tables - float pseudoRndm = assTrkPt * 1000. - static_cast(assTrkPt * 1000); + float const pseudoRndm = assTrkPt * 1000. - static_cast(assTrkPt * 1000); if (assTrkPt < ptMaxForDownSample && collCentrality < centMaxForDownSample && pseudoRndm >= downSampleTrksFactor) { continue; } @@ -428,7 +430,7 @@ struct HfDerivedDataCreatorCorrelationsReduced { return; } rowCollisions(mult, coll.numContrib(), cent, coll.posZ()); - fillSameEvent(candsDplus, tracks, cent); + fillSameEvent(candsDplus, tracks, cent); } PROCESS_SWITCH(HfDerivedDataCreatorCorrelationsReduced, processDplusSameEvent, "Process Same Event for Dplus candidates", true); @@ -445,7 +447,7 @@ struct HfDerivedDataCreatorCorrelationsReduced { return; } rowCollisions(mult, coll.numContrib(), cent, coll.posZ()); - fillCharmMixedEvent(candsDplus); + fillCharmMixedEvent(candsDplus); fillTrkMixedEvent(tracks, cent); } PROCESS_SWITCH(HfDerivedDataCreatorCorrelationsReduced, processDplusMixedEvent, "Process Mixed Event for Dplus candidates", false); @@ -465,8 +467,8 @@ struct HfDerivedDataCreatorCorrelationsReduced { return; } rowCollisions(mult, coll.numContrib(), cent, coll.posZ()); - fillSameEvent(candsDsToPiKK, tracks, cent); - fillSameEvent(candsDsToKKPi, tracks, cent); + fillSameEvent(candsDsToPiKK, tracks, cent); + fillSameEvent(candsDsToKKPi, tracks, cent); } PROCESS_SWITCH(HfDerivedDataCreatorCorrelationsReduced, processDsSameEvent, "Process Same Event for Ds candidates", false); @@ -485,8 +487,8 @@ struct HfDerivedDataCreatorCorrelationsReduced { return; } rowCollisions(mult, coll.numContrib(), cent, coll.posZ()); - fillCharmMixedEvent(candsDsToPiKK); - fillCharmMixedEvent(candsDsToKKPi); + fillCharmMixedEvent(candsDsToPiKK); + fillCharmMixedEvent(candsDsToKKPi); fillTrkMixedEvent(tracks, cent); } PROCESS_SWITCH(HfDerivedDataCreatorCorrelationsReduced, processDsMixedEvent, "Process Mixed Event for Ds candidates", false); @@ -506,8 +508,8 @@ struct HfDerivedDataCreatorCorrelationsReduced { return; } rowCollisions(mult, coll.numContrib(), cent, coll.posZ()); - fillSameEvent(candsD0ToPiK, tracks, cent); - fillSameEvent(candsD0ToKPi, tracks, cent); + fillSameEvent(candsD0ToPiK, tracks, cent); + fillSameEvent(candsD0ToKPi, tracks, cent); } PROCESS_SWITCH(HfDerivedDataCreatorCorrelationsReduced, processD0SameEvent, "Process Same Event for D0 candidates", false); @@ -526,8 +528,8 @@ struct HfDerivedDataCreatorCorrelationsReduced { return; } rowCollisions(mult, coll.numContrib(), cent, coll.posZ()); - fillCharmMixedEvent(candsD0ToPiK); - fillCharmMixedEvent(candsD0ToKPi); + fillCharmMixedEvent(candsD0ToPiK); + fillCharmMixedEvent(candsD0ToKPi); fillTrkMixedEvent(tracks, cent); } PROCESS_SWITCH(HfDerivedDataCreatorCorrelationsReduced, processD0MixedEvent, "Process Mixed Event for D0 candidates", false); @@ -541,7 +543,7 @@ struct HfDerivedDataCreatorCorrelationsReduced { return; } rowCollisions(mult, coll.numContrib(), cent, coll.posZ()); - fillSameEvent(tracks, tracks, cent); + fillSameEvent(tracks, tracks, cent); } PROCESS_SWITCH(HfDerivedDataCreatorCorrelationsReduced, processHadronHadronSameEvent, "Process Same Event for hadron candidates", true); diff --git a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx index 1255781f2b0..f5cc68a3996 100644 --- a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx +++ b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx @@ -161,17 +161,17 @@ struct HfFemtoDreamProducer { HfHelper hfHelper; o2::analysis::HfMlResponseLcToPKPi hfMlResponse; o2::analysis::HfMlResponseDplusToPiKPi hfMlResponseDplus; - std::vector outputMlDplus = {}; - std::vector outputMlPKPi = {}; - std::vector outputMlPiKP = {}; + std::vector outputMlDplus; + std::vector outputMlPKPi; + std::vector outputMlPiKP; o2::ccdb::CcdbApi ccdbApi; o2::hf_evsel::HfEventSelection hfEvSel; Service ccdb; /// Accessing the CCDB - o2::base::MatLayerCylSet* lut; + o2::base::MatLayerCylSet* lut{}; // if (doPvRefit){ lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get(ccdbPathLut));} //! may be it useful, will check later - float magField; - int runNumber; + float magField{}; + int runNumber{}; using CandidateDplus = soa::Join; using CandidateDplusMc = soa::Join; using CandidateLc = soa::Join; @@ -202,7 +202,7 @@ struct HfFemtoDreamProducer { LOGP(fatal, "One and only one process function must be enabled at a time."); } - int cutBits = 8 * sizeof(o2::aod::femtodreamparticle::cutContainerType); + int const cutBits = 8 * sizeof(o2::aod::femtodreamparticle::cutContainerType); trackRegistry.add("AnalysisQA/CutCounter", "; Bit; Counter", kTH1F, {{cutBits + 1, -0.5, cutBits + 0.5}}); // event QA histograms @@ -247,7 +247,7 @@ struct HfFemtoDreamProducer { hfEvSel.addHistograms(qaRegistry); // collision monitoring - int64_t now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); + int64_t const now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); ccdb->setCreatedNotAfter(now); if (applyMlMode == FillMlFromNewBDT) { @@ -264,7 +264,7 @@ struct HfFemtoDreamProducer { } /// Function to retrieve the nominal magnetic field in kG (0.1T) and convert it directly to T - void getMagneticFieldTesla(aod::BCsWithTimestamps::iterator bc) + void getMagneticFieldTesla(const aod::BCsWithTimestamps::iterator& bc) { initCCDB(bc, runNumber, ccdb, !isRun3 ? ccdbPathGrp : ccdbPathGrpMag, lut, !isRun3); } @@ -374,11 +374,11 @@ struct HfFemtoDreamProducer { } } - template + template bool fillTracksForCharmHadron(CollisionType const& col, TrackType const& tracks) { - std::vector childIDs = {0, 0}; // these IDs are necessary to keep track of the children + std::vector const childIDs = {0, 0}; // these IDs are necessary to keep track of the children // std::vector tmpIDtrack; // this vector keeps track of the matching of the primary track table row <-> aod::track table global index bool fIsTrackFilled = false; @@ -413,14 +413,14 @@ struct HfFemtoDreamProducer { fillDebugParticle(track); } - if constexpr (isMc) { + if constexpr (IsMc) { fillMcParticle(col, track, o2::aod::femtodreamparticle::ParticleType::kTrack); } } return fIsTrackFilled; } - template + template void fillCharmHadronTable(CollisionType const& col, TrackType const& tracks, CandType const& candidates) { const auto vtxZ = col.posZ(); @@ -458,7 +458,7 @@ struct HfFemtoDreamProducer { } outputCollision(vtxZ, mult, multNtr, spher, magField); - if constexpr (isMc) { + if constexpr (IsMc) { fillMcCollision(col); } @@ -478,12 +478,12 @@ struct HfFemtoDreamProducer { auto bc = col.template bc_as(); int64_t timeStamp = bc.timestamp(); - auto fillTable = [&](int CandFlag, - int FunctionSelection, - float BDTScoreBkg, - float BDTScorePrompt, - float BDTScoreFD) { - if (FunctionSelection >= 1){ + auto fillTable = [&](int candFlag, + int functionSelection, + float bdtScoreBkg, + float bdtScorePrompt, + float bdtScoreFd) { + if (functionSelection >= 1){ rowCandCharmHad( outputCollision.lastIndex(), timeStamp, @@ -500,21 +500,21 @@ struct HfFemtoDreamProducer { trackPos1.phi(), trackNeg.phi(), trackPos2.phi(), - 1 << CandFlag, - BDTScoreBkg, - BDTScorePrompt, - BDTScoreFD); + 1 << candFlag, + bdtScoreBkg, + bdtScorePrompt, + bdtScoreFd); // Row for MC candidate charm hadron (if constexpr isMc) - if constexpr (isMc) { + if constexpr (IsMc) { rowCandMcCharmHad( candidate.flagMcMatchRec(), candidate.originMcRec()); } } }; - if constexpr (channel == DecayChannel::DplusToPiKPi) { - if constexpr (useCharmMl) { + if constexpr (Channel == DecayChannel::DplusToPiKPi) { + if constexpr (UseCharmMl) { /// fill with ML information /// BDT index 0: bkg score; BDT index 1: prompt score; BDT index 2: non-prompt score if (applyMlMode == FillMlFromSelector) { @@ -529,16 +529,17 @@ struct HfFemtoDreamProducer { std::vector inputFeaturesDplusToPiKPi = hfMlResponseDplus.getInputFeatures(candidate); isSelectedMlDplusToPiKPi = hfMlResponseDplus.isSelectedMl(inputFeaturesDplusToPiKPi, candidate.pt(), outputMlDplus); } - if (!isSelectedMlDplusToPiKPi) + if (!isSelectedMlDplusToPiKPi) { continue; + } } else { LOGF(fatal, "Please check your Ml configuration!!"); } } fillTable(2, candidate.isSelDplusToPiKPi(), outputMlDplus.at(0), outputMlDplus.at(1), outputMlDplus.at(2)); - } else if constexpr (channel == DecayChannel::LcToPKPi) { - if constexpr (useCharmMl) { + } else if constexpr (Channel == DecayChannel::LcToPKPi) { + if constexpr (UseCharmMl) { /// fill with ML information /// BDT index 0: bkg score; BDT index 1: prompt score; BDT index 2: non-prompt score if (applyMlMode == FillMlFromSelector) { @@ -563,8 +564,9 @@ struct HfFemtoDreamProducer { std::vector inputFeaturesLcToPiKP = hfMlResponse.getInputFeatures(candidate, false); isSelectedMlLcToPiKP = hfMlResponse.isSelectedMl(inputFeaturesLcToPiKP, candidate.pt(), outputMlPKPi); } - if (!isSelectedMlLcToPKPi && !isSelectedMlLcToPiKP) + if (!isSelectedMlLcToPKPi && !isSelectedMlLcToPiKP) { continue; + } } else { LOGF(fatal, "Please check your Ml configuration!!"); } @@ -575,7 +577,7 @@ struct HfFemtoDreamProducer { } if (!isTrackFilled) { - isTrackFilled = fillTracksForCharmHadron(col, tracks); + isTrackFilled = fillTracksForCharmHadron(col, tracks); // If track filling was successful, fill the collision table } @@ -591,11 +593,12 @@ struct HfFemtoDreamProducer { qaRegistry.fill(HIST("hEventQA"), 1 + Event::CharmSelected); } - if (isTrackFilled && (sizeCand > 0)) + if (isTrackFilled && (sizeCand > 0)) { qaRegistry.fill(HIST("hEventQA"), 1 + Event::PairSelected); + } - rowMasks(static_cast(bitTrack), - static_cast(bitCand), + rowMasks(bitTrack, + bitCand, 0); } @@ -615,12 +618,12 @@ struct HfFemtoDreamProducer { return true; } - template + template void fillCharmHadMcGen(ParticleType particles) { // Filling particle properties rowCandCharmHadGen.reserve(particles.size()); - if constexpr (channel == DecayChannel::DplusToPiKPi) { + if constexpr (Channel == DecayChannel::DplusToPiKPi) { for (const auto& particle : particles) { if (std::abs(particle.flagMcMatchGen()) == hf_decay::hf_cand_3prong::DecayChannelMain::DplusToPiKPi) { rowCandCharmHadGen( @@ -629,7 +632,7 @@ struct HfFemtoDreamProducer { particle.originMcGen()); } } - } else if constexpr (channel == DecayChannel::LcToPKPi) { + } else if constexpr (Channel == DecayChannel::LcToPKPi) { for (const auto& particle : particles) { if (std::abs(particle.flagMcMatchGen()) == hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi) { rowCandCharmHadGen( diff --git a/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx b/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx index de58e448ca7..40f907f5a29 100644 --- a/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx +++ b/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx @@ -27,6 +27,7 @@ #include "Common/Core/RecoDecay.h" +#include #include #include #include @@ -42,8 +43,6 @@ #include #include -#include - #include #include #include @@ -196,7 +195,7 @@ struct HfTaskCharmHadronsFemtoDream { ConfigurableAxis binMulPercentile{"binMulPercentile", {10, 0.0f, 100.0f}, "multiplicity percentile Binning"}; ConfigurableAxis binpTTrack{"binpTTrack", {50, 0.5, 10.05}, "pT binning of the pT vs. TempFitVar plot (Track)"}; ConfigurableAxis binEta{"binEta", {{200, -1.5, 1.5}}, "eta binning"}; - ConfigurableAxis binPhi{"binPhi", {{200, 0, 2.f * 3.14159274101257324e+00f}}, "phi binning"}; + ConfigurableAxis binPhi{"binPhi", {{200, 0, o2::constants::math::TwoPI}}, "phi binning"}; ConfigurableAxis binkT{"binkT", {150, 0., 9.}, "binning kT"}; ConfigurableAxis binkstar{"binkstar", {1500, 0., 6.}, "binning kstar"}; ConfigurableAxis binNSigmaTPC{"binNSigmaTPC", {1600, -8, 8}, "Binning of Nsigma TPC plot"}; @@ -291,10 +290,9 @@ struct HfTaskCharmHadronsFemtoDream { if (cand.candidateSelFlag() == 1) { invMass = cand.m(std::array{o2::constants::physics::MassProton, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}); return invMass; - } else { - invMass = cand.m(std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassProton}); - return invMass; } + invMass = cand.m(std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassProton}); + return invMass; } // D+ → π K π (PDG: 411) if (charmHadPDGCode == o2::constants::physics::Pdg::kDPlus) { @@ -349,15 +347,16 @@ struct HfTaskCharmHadronsFemtoDream { } /// This function processes the same event and takes care of all the histogramming - template + template void doSameEvent(PartitionType& sliceTrk1, CandType& sliceCharmHad, TableTracks const& parts, Collision const& col) { fillCollision(col); processType = 1; // for same event for (auto const& [p1, p2] : combinations(CombinationsFullIndexPolicy(sliceTrk1, sliceCharmHad))) { - if (p1.trackId() == p2.prong0Id() || p1.trackId() == p2.prong1Id() || p1.trackId() == p2.prong2Id()) + if (p1.trackId() == p2.prong0Id() || p1.trackId() == p2.prong1Id() || p1.trackId() == p2.prong2Id()) { continue; + } if (useCPR.value) { if (pairCloseRejectionSE.isClosePair(p1, p2, parts, col.magField())) { @@ -400,11 +399,11 @@ struct HfTaskCharmHadronsFemtoDream { } /// Filling QA histograms of the selected tracks - selectedTrackHisto.fillQA(p1, static_cast(confTempFitVarMomentum.value), col.multNtr(), col.multV0M()); + selectedTrackHisto.fillQA(p1, static_cast(confTempFitVarMomentum.value), col.multNtr(), col.multV0M()); int charmHadMc = 0; int originType = 0; - if constexpr (isMc) { + if constexpr (IsMc) { charmHadMc = p2.flagMc(); originType = p2.originMcRec(); } @@ -428,11 +427,11 @@ struct HfTaskCharmHadronsFemtoDream { charmHadMc, originType); - sameEventCont.setPair(p1, p2, col.multNtr(), col.multV0M(), use4D, extendedPlots, smearingByOrigin); + sameEventCont.setPair(p1, p2, col.multNtr(), col.multV0M(), use4D, extendedPlots, smearingByOrigin); } } - template + template void doMixedEvent(CollisionType const& cols, PartType const& parts, PartitionType1& part1, PartitionType2& part2, BinningType policy) { processType = 2; // for mixed event @@ -498,7 +497,7 @@ struct HfTaskCharmHadronsFemtoDream { int charmHadMc = 0; int originType = 0; - if constexpr (isMc) { + if constexpr (IsMc) { charmHadMc = p2.flagMc(); originType = p2.originMcRec(); } @@ -522,7 +521,7 @@ struct HfTaskCharmHadronsFemtoDream { charmHadMc, originType); - mixedEventCont.setPair(p1, p2, collision1.multNtr(), collision1.multV0M(), use4D, extendedPlots, smearingByOrigin); + mixedEventCont.setPair(p1, p2, collision1.multNtr(), collision1.multV0M(), use4D, extendedPlots, smearingByOrigin); } } } diff --git a/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx b/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx index bea1510a24b..78aa10b08b9 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx @@ -62,22 +62,22 @@ using namespace o2::analysis::hf_correlations; // definition of vectors for standard ptbin and invariant mass configurables const int nPtBinsCorrelations = 12; const double pTBinsCorrelations[nPtBinsCorrelations + 1] = {0., 1., 2., 3., 4., 5., 6., 7., 8., 12., 16., 24., 99.}; -auto vecPtBinsCorrelations = std::vector{pTBinsCorrelations, pTBinsCorrelations + nPtBinsCorrelations + 1}; +const auto vecPtBinsCorrelations = std::vector{pTBinsCorrelations, pTBinsCorrelations + nPtBinsCorrelations + 1}; const double signalRegionLeftDefault[nPtBinsCorrelations] = {1.7948, 1.8198, 1.8198, 1.8148, 1.8148, 1.8048, 1.8048, 1.7948, 1.7948, 1.7898, 1.7848, 1.7598}; const double signalRegionRightDefault[nPtBinsCorrelations] = {1.9098, 1.8998, 1.9048, 1.9048, 1.9148, 1.9248, 1.9298, 1.9348, 1.9398, 1.9298, 1.9398, 1.9198}; const double sidebandLeftInnerDefault[nPtBinsCorrelations] = {1.7398, 1.7748, 1.7798, 1.7698, 1.7648, 1.7448, 1.7448, 1.7198, 1.7198, 1.7198, 1.7048, 1.6798}; const double sidebandLeftOuterDefault[nPtBinsCorrelations] = {1.6298, 1.6898, 1.6948, 1.6748, 1.6648, 1.6248, 1.6198, 1.5748, 1.5748, 1.5798, 1.5448, 1.5198}; const double sidebandRightInnerDefault[nPtBinsCorrelations] = {1.9648, 1.9448, 1.9448, 1.9548, 1.9648, 1.9848, 1.9948, 2.0098, 2.0148, 1.9998, 2.0248, 1.9998}; const double sidebandRightOuterDefault[nPtBinsCorrelations] = {2.0748, 2.0248, 2.0298, 2.0448, 2.0648, 2.1048, 2.1148, 2.1548, 2.1648, 2.1398, 2.1848, 2.1598}; -auto vecsignalRegionLeft = std::vector{signalRegionLeftDefault, signalRegionLeftDefault + nPtBinsCorrelations}; -auto vecsignalRegionRight = std::vector{signalRegionRightDefault, signalRegionRightDefault + nPtBinsCorrelations}; -auto vecSidebandLeftInner = std::vector{sidebandLeftInnerDefault, sidebandLeftInnerDefault + nPtBinsCorrelations}; -auto vecSidebandLeftOuter = std::vector{sidebandLeftOuterDefault, sidebandLeftOuterDefault + nPtBinsCorrelations}; -auto vecSidebandRightInner = std::vector{sidebandRightInnerDefault, sidebandRightInnerDefault + nPtBinsCorrelations}; -auto vecSidebandRightOuter = std::vector{sidebandRightOuterDefault, sidebandRightOuterDefault + nPtBinsCorrelations}; +const auto vecsignalRegionLeft = std::vector{signalRegionLeftDefault, signalRegionLeftDefault + nPtBinsCorrelations}; +const auto vecsignalRegionRight = std::vector{signalRegionRightDefault, signalRegionRightDefault + nPtBinsCorrelations}; +const auto vecSidebandLeftInner = std::vector{sidebandLeftInnerDefault, sidebandLeftInnerDefault + nPtBinsCorrelations}; +const auto vecSidebandLeftOuter = std::vector{sidebandLeftOuterDefault, sidebandLeftOuterDefault + nPtBinsCorrelations}; +const auto vecSidebandRightInner = std::vector{sidebandRightInnerDefault, sidebandRightInnerDefault + nPtBinsCorrelations}; +const auto vecSidebandRightOuter = std::vector{sidebandRightOuterDefault, sidebandRightOuterDefault + nPtBinsCorrelations}; const int nPtbinsPtEfficiencyD = o2::analysis::hf_cuts_d0_to_pi_k::NBinsPt; const double efficiencyDmesonDefault[nPtbinsPtEfficiencyD] = {}; -auto vecEfficiencyDmeson = std::vector{efficiencyDmesonDefault, efficiencyDmesonDefault + nPtbinsPtEfficiencyD}; +const auto vecEfficiencyDmeson = std::vector{efficiencyDmesonDefault, efficiencyDmesonDefault + nPtbinsPtEfficiencyD}; struct HfTaskCorrelationD0Hadrons { @@ -150,14 +150,14 @@ struct HfTaskCorrelationD0Hadrons { { AxisSpec axisMassD = {binsMassD, "inv. mass (#pi K) (GeV/#it{c}^{2})"}; AxisSpec axisDeltaEta = {binsEta, "#it{#eta}^{Hadron}-#it{#eta}^{D}"}; - AxisSpec axisEta = {binsEta, "#it{#eta}"}; + AxisSpec const axisEta = {binsEta, "#it{#eta}"}; AxisSpec axisDeltaPhi = {binsPhi, "#it{#varphi}^{Hadron}-#it{#varphi}^{D} (rad)"}; AxisSpec axisPtD = {(std::vector)binsPtD, "#it{p}_{T}^{D} (GeV/#it{c})"}; AxisSpec axisPtHadron = {(std::vector)binsPtHadron, "#it{p}_{T}^{Hadron} (GeV/#it{c})"}; AxisSpec axisPoolBin = {binsPoolBin, "poolBin"}; - AxisSpec axisBdtScore = {binsBdtScore, "Bdt score"}; - AxisSpec axisMultFT0M = {binsMultFT0M, "MultiplicityFT0M"}; - AxisSpec axisPosZ = {binsPosZ, "PosZ"}; + AxisSpec const axisBdtScore = {binsBdtScore, "Bdt score"}; + AxisSpec const axisMultFT0M = {binsMultFT0M, "MultiplicityFT0M"}; + AxisSpec const axisPosZ = {binsPosZ, "PosZ"}; AxisSpec axisD0Prompt = {2, -0.5, 1.5, "Prompt D0"}; AxisSpec axisCorrelationState = {2, 0., 2., "correlationState"}; @@ -306,12 +306,12 @@ struct HfTaskCorrelationD0Hadrons { aod::D0CandRecoInfo const& candidates) { for (const auto& candidate : candidates) { - float ptD = candidate.ptD(); - float bdtScorePromptD0 = candidate.mlScorePromptD0(); - float bdtScoreBkgD0 = candidate.mlScoreBkgD0(); - float bdtScorePromptD0bar = candidate.mlScorePromptD0bar(); - float bdtScoreBkgD0bar = candidate.mlScoreBkgD0bar(); - int effBinD = o2::analysis::findBin(binsPtEfficiencyD, ptD); + float const ptD = candidate.ptD(); + float const bdtScorePromptD0 = candidate.mlScorePromptD0(); + float const bdtScoreBkgD0 = candidate.mlScoreBkgD0(); + float const bdtScorePromptD0bar = candidate.mlScorePromptD0bar(); + float const bdtScoreBkgD0bar = candidate.mlScoreBkgD0bar(); + int const effBinD = o2::analysis::findBin(binsPtEfficiencyD, ptD); registry.fill(HIST("hBdtScorePromptD0"), bdtScorePromptD0); registry.fill(HIST("hBdtScoreBkgD0"), bdtScoreBkgD0); @@ -326,24 +326,24 @@ struct HfTaskCorrelationD0Hadrons { for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities - double deltaPhi = pairEntry.deltaPhi(); - double deltaEta = pairEntry.deltaEta(); - double ptD = pairEntry.ptD(); - double ptHadron = pairEntry.ptHadron(); - double massD = pairEntry.mD(); - double massDbar = pairEntry.mDbar(); - int signalStatus = pairEntry.signalStatus(); - int effBinD = o2::analysis::findBin(binsPtEfficiencyD, ptD); - int ptBinD = o2::analysis::findBin(binsCorrelations, ptD); - int poolBin = pairEntry.poolBin(); - float trackDcaXY = pairEntry.trackDcaXY(); - float trackDcaZ = pairEntry.trackDcaZ(); - int trackTpcCrossedRows = pairEntry.trackTPCNClsCrossedRows(); - bool isAutoCorrelated = pairEntry.isAutoCorrelated(); - float bdtScorePromptD0 = pairEntry.mlScorePromptD0(); - float bdtScoreBkgD0 = pairEntry.mlScoreBkgD0(); - float bdtScorePromptD0bar = pairEntry.mlScorePromptD0bar(); - float bdtScoreBkgD0bar = pairEntry.mlScoreBkgD0bar(); + double const deltaPhi = pairEntry.deltaPhi(); + double const deltaEta = pairEntry.deltaEta(); + double const ptD = pairEntry.ptD(); + double const ptHadron = pairEntry.ptHadron(); + double const massD = pairEntry.mD(); + double const massDbar = pairEntry.mDbar(); + int const signalStatus = pairEntry.signalStatus(); + int const effBinD = o2::analysis::findBin(binsPtEfficiencyD, ptD); + int const ptBinD = o2::analysis::findBin(binsCorrelations, ptD); + int const poolBin = pairEntry.poolBin(); + float const trackDcaXY = pairEntry.trackDcaXY(); + float const trackDcaZ = pairEntry.trackDcaZ(); + int const trackTpcCrossedRows = pairEntry.trackTPCNClsCrossedRows(); + bool const isAutoCorrelated = pairEntry.isAutoCorrelated(); + float const bdtScorePromptD0 = pairEntry.mlScorePromptD0(); + float const bdtScoreBkgD0 = pairEntry.mlScoreBkgD0(); + float const bdtScorePromptD0bar = pairEntry.mlScorePromptD0bar(); + float const bdtScoreBkgD0bar = pairEntry.mlScoreBkgD0bar(); // reject entries outside pT ranges of interest if (ptBinD < 0 || effBinD < 0) { continue; @@ -356,7 +356,7 @@ struct HfTaskCorrelationD0Hadrons { continue; } double efficiencyWeight = 1.; - if (applyEfficiency) { + if (applyEfficiency != 0) { efficiencyWeight = 1. / (efficiencyDmeson->at(o2::analysis::findBin(binsPtEfficiencyD, ptD)) * efficiencyHad->at(o2::analysis::findBin(binsPtEfficiencyHad, ptHadron))); } // reject entries outside pT ranges of interest @@ -369,7 +369,7 @@ struct HfTaskCorrelationD0Hadrons { if (ptHadron < leadingParticlePtMin) { continue; } - Region region = getRegion(deltaPhi); + Region const region = getRegion(deltaPhi); switch (region) { case Toward: @@ -465,12 +465,12 @@ struct HfTaskCorrelationD0Hadrons { soa::Join const& candidates) { for (const auto& candidate : candidates) { - float ptD = candidate.ptD(); - float bdtScorePromptD0 = candidate.mlScorePromptD0(); - float bdtScoreBkgD0 = candidate.mlScoreBkgD0(); - float bdtScorePromptD0bar = candidate.mlScorePromptD0bar(); - float bdtScoreBkgD0bar = candidate.mlScoreBkgD0bar(); - int effBinD = o2::analysis::findBin(binsPtEfficiencyD, ptD); + float const ptD = candidate.ptD(); + float const bdtScorePromptD0 = candidate.mlScorePromptD0(); + float const bdtScoreBkgD0 = candidate.mlScoreBkgD0(); + float const bdtScorePromptD0bar = candidate.mlScorePromptD0bar(); + float const bdtScoreBkgD0bar = candidate.mlScoreBkgD0bar(); + int const effBinD = o2::analysis::findBin(binsPtEfficiencyD, ptD); registry.fill(HIST("hBdtScorePromptD0"), bdtScorePromptD0); registry.fill(HIST("hBdtScoreBkgD0"), bdtScoreBkgD0); @@ -485,26 +485,26 @@ struct HfTaskCorrelationD0Hadrons { for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities - double deltaPhi = pairEntry.deltaPhi(); - double deltaEta = pairEntry.deltaEta(); - double ptD = pairEntry.ptD(); - double ptHadron = pairEntry.ptHadron(); - double massD = pairEntry.mD(); - double massDbar = pairEntry.mDbar(); - int signalStatus = pairEntry.signalStatus(); - int ptBinD = o2::analysis::findBin(binsCorrelations, ptD); - int poolBin = pairEntry.poolBin(); - float trackDcaXY = pairEntry.trackDcaXY(); - float trackDcaZ = pairEntry.trackDcaZ(); - int trackTpcCrossedRows = pairEntry.trackTPCNClsCrossedRows(); - bool isAutoCorrelated = pairEntry.isAutoCorrelated(); - float bdtScorePromptD0 = pairEntry.mlScorePromptD0(); - float bdtScoreBkgD0 = pairEntry.mlScoreBkgD0(); - float bdtScorePromptD0bar = pairEntry.mlScorePromptD0bar(); - float bdtScoreBkgD0bar = pairEntry.mlScoreBkgD0bar(); - bool isPhysicalPrimary = pairEntry.isPhysicalPrimary(); - bool isD0Prompt = pairEntry.isPrompt(); - int statusPromptHadron = pairEntry.trackOrigin(); + double const deltaPhi = pairEntry.deltaPhi(); + double const deltaEta = pairEntry.deltaEta(); + double const ptD = pairEntry.ptD(); + double const ptHadron = pairEntry.ptHadron(); + double const massD = pairEntry.mD(); + double const massDbar = pairEntry.mDbar(); + int const signalStatus = pairEntry.signalStatus(); + int const ptBinD = o2::analysis::findBin(binsCorrelations, ptD); + int const poolBin = pairEntry.poolBin(); + float const trackDcaXY = pairEntry.trackDcaXY(); + float const trackDcaZ = pairEntry.trackDcaZ(); + int const trackTpcCrossedRows = pairEntry.trackTPCNClsCrossedRows(); + bool const isAutoCorrelated = pairEntry.isAutoCorrelated(); + float const bdtScorePromptD0 = pairEntry.mlScorePromptD0(); + float const bdtScoreBkgD0 = pairEntry.mlScoreBkgD0(); + float const bdtScorePromptD0bar = pairEntry.mlScorePromptD0bar(); + float const bdtScoreBkgD0bar = pairEntry.mlScoreBkgD0bar(); + bool const isPhysicalPrimary = pairEntry.isPhysicalPrimary(); + bool const isD0Prompt = pairEntry.isPrompt(); + int const statusPromptHadron = pairEntry.trackOrigin(); if (bdtScorePromptD0 < mlOutputPromptD0->at(ptBinD) || bdtScoreBkgD0 > mlOutputBkgD0->at(ptBinD) || bdtScorePromptD0bar < mlOutputPromptD0bar->at(ptBinD) || bdtScoreBkgD0bar > mlOutputBkgD0bar->at(ptBinD)) { @@ -514,7 +514,7 @@ struct HfTaskCorrelationD0Hadrons { continue; } double efficiencyWeight = 1.; - if (applyEfficiency) { + if (applyEfficiency != 0) { efficiencyWeight = 1. / (efficiencyDmeson->at(o2::analysis::findBin(binsPtEfficiencyD, ptD)) * efficiencyHad->at(o2::analysis::findBin(binsPtEfficiencyHad, ptHadron))); } if (isTowardTransverseAway) { @@ -522,7 +522,7 @@ struct HfTaskCorrelationD0Hadrons { if (ptHadron < leadingParticlePtMin) { continue; } - Region region = getRegion(deltaPhi); + Region const region = getRegion(deltaPhi); switch (region) { case Toward: registry.fill(HIST("hTowardRec"), massD, ptD, isAutoCorrelated, efficiencyWeight); @@ -538,7 +538,7 @@ struct HfTaskCorrelationD0Hadrons { } } // fill correlation plots for signal/bagkground correlations - if (pairEntry.signalStatus()) { + if (pairEntry.signalStatus() != 0) { registry.fill(HIST("hCorrel2DVsPtRecSig"), deltaPhi, deltaEta, ptD, ptHadron, efficiencyWeight); } else { @@ -736,15 +736,15 @@ struct HfTaskCorrelationD0Hadrons { { for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities - double deltaPhi = pairEntry.deltaPhi(); - double deltaEta = pairEntry.deltaEta(); - double ptD = pairEntry.ptD(); - double ptHadron = pairEntry.ptHadron(); - int poolBin = pairEntry.poolBin(); - double massD = pairEntry.mD(); - bool isAutoCorrelated = pairEntry.isAutoCorrelated(); - int statusPromptHadron = pairEntry.trackOrigin(); - bool isD0Prompt = pairEntry.isPrompt(); + double const deltaPhi = pairEntry.deltaPhi(); + double const deltaEta = pairEntry.deltaEta(); + double const ptD = pairEntry.ptD(); + double const ptHadron = pairEntry.ptHadron(); + int const poolBin = pairEntry.poolBin(); + double const massD = pairEntry.mD(); + bool const isAutoCorrelated = pairEntry.isAutoCorrelated(); + int const statusPromptHadron = pairEntry.trackOrigin(); + bool const isD0Prompt = pairEntry.isPrompt(); // reject entries outside pT ranges of interest if (o2::analysis::findBin(binsCorrelations, ptD) < 0) { @@ -755,7 +755,7 @@ struct HfTaskCorrelationD0Hadrons { if (ptHadron < leadingParticlePtMin) { continue; } - Region region = getRegion(deltaPhi); + Region const region = getRegion(deltaPhi); switch (region) { case Toward: registry.fill(HIST("hTowardGen"), massD, ptD, isAutoCorrelated); diff --git a/PWGHF/HFC/Tasks/taskCorrelationDDbar.cxx b/PWGHF/HFC/Tasks/taskCorrelationDDbar.cxx index 21321f51f21..652d49d29dc 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationDDbar.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationDDbar.cxx @@ -76,37 +76,37 @@ const TString stringMCReco = "MC reco - D,Dbar candidates "; // definition of vectors for standard ptbin and invariant mass configurables const int npTBinsCorrelations = 8; const double pTBinsCorrelations[npTBinsCorrelations + 1] = {0., 2., 4., 6., 8., 12., 16., 24., 99.}; -auto pTBinsCorrelations_v = std::vector{pTBinsCorrelations, pTBinsCorrelations + npTBinsCorrelations + 1}; +const auto pTBinsCorrelationsV = std::vector{pTBinsCorrelations, pTBinsCorrelations + npTBinsCorrelations + 1}; const double signalRegionInnerDefault[npTBinsCorrelations] = {1.810, 1.810, 1.810, 1.810, 1.810, 1.810, 1.810, 1.810}; const double signalRegionOuterDefault[npTBinsCorrelations] = {1.922, 1.922, 1.922, 1.922, 1.922, 1.922, 1.922, 1.922}; const double sidebandLeftInnerDefault[npTBinsCorrelations] = {1.642, 1.642, 1.642, 1.642, 1.642, 1.642, 1.642, 1.642}; const double sidebandLeftOuterDefault[npTBinsCorrelations] = {1.754, 1.754, 1.754, 1.754, 1.754, 1.754, 1.754, 1.754}; const double sidebandRightInnerDefault[npTBinsCorrelations] = {1.978, 1.978, 1.978, 1.978, 1.978, 1.978, 1.978, 1.978}; const double sidebandRightOuterDefault[npTBinsCorrelations] = {2.090, 2.090, 2.090, 2.090, 2.090, 2.090, 2.090, 2.090}; -auto signalRegionInner_v = std::vector{signalRegionInnerDefault, signalRegionInnerDefault + npTBinsCorrelations}; -auto signalRegionOuter_v = std::vector{signalRegionOuterDefault, signalRegionOuterDefault + npTBinsCorrelations}; -auto sidebandLeftInner_v = std::vector{sidebandLeftInnerDefault, sidebandLeftInnerDefault + npTBinsCorrelations}; -auto sidebandLeftOuter_v = std::vector{sidebandLeftOuterDefault, sidebandLeftOuterDefault + npTBinsCorrelations}; -auto sidebandRightInner_v = std::vector{sidebandRightInnerDefault, sidebandRightInnerDefault + npTBinsCorrelations}; -auto sidebandRightOuter_v = std::vector{sidebandRightOuterDefault, sidebandRightOuterDefault + npTBinsCorrelations}; +const auto signalRegionInnerV = std::vector{signalRegionInnerDefault, signalRegionInnerDefault + npTBinsCorrelations}; +const auto signalRegionOuterV = std::vector{signalRegionOuterDefault, signalRegionOuterDefault + npTBinsCorrelations}; +const auto sidebandLeftInnerV = std::vector{sidebandLeftInnerDefault, sidebandLeftInnerDefault + npTBinsCorrelations}; +const auto sidebandLeftOuterV = std::vector{sidebandLeftOuterDefault, sidebandLeftOuterDefault + npTBinsCorrelations}; +const auto sidebandRightInnerV = std::vector{sidebandRightInnerDefault, sidebandRightInnerDefault + npTBinsCorrelations}; +const auto sidebandRightOuterV = std::vector{sidebandRightOuterDefault, sidebandRightOuterDefault + npTBinsCorrelations}; const int npTBinsEfficiency = o2::analysis::hf_cuts_d0_to_pi_k::NBinsPt; const double efficiencyDmesonDefault[npTBinsEfficiency] = {}; -auto efficiencyDmeson_v = std::vector{efficiencyDmesonDefault, efficiencyDmesonDefault + npTBinsEfficiency}; +const auto efficiencyDmesonV = std::vector{efficiencyDmesonDefault, efficiencyDmesonDefault + npTBinsEfficiency}; struct HfTaskCorrelationDDbar { Configurable applyEfficiency{"applyEfficiency", 1, "Flag for applying efficiency weights"}; // pT ranges for correlation plots: the default values are those embedded in hf_cuts_d0_to_pi_k (i.e. the mass pT bins), but can be redefined via json files - Configurable> binsPtCorrelations{"binsPtCorrelations", std::vector{pTBinsCorrelations_v}, "pT bin limits for correlation plots"}; + Configurable> binsPtCorrelations{"binsPtCorrelations", std::vector{pTBinsCorrelationsV}, "pT bin limits for correlation plots"}; // pT bins for effiencies: same as above Configurable> binsPtEfficiency{"binsPtEfficiency", std::vector{o2::analysis::hf_cuts_d0_to_pi_k::vecBinsPt}, "pT bin limits for efficiency"}; // signal and sideband region edges, to be defined via json file (initialised to empty) - Configurable> signalRegionInner{"signalRegionInner", std::vector{signalRegionInner_v}, "Inner values of signal region vs pT"}; - Configurable> signalRegionOuter{"signalRegionOuter", std::vector{signalRegionOuter_v}, "Outer values of signal region vs pT"}; - Configurable> sidebandLeftInner{"sidebandLeftInner", std::vector{sidebandLeftInner_v}, "Inner values of left sideband vs pT"}; - Configurable> sidebandLeftOuter{"sidebandLeftOuter", std::vector{sidebandLeftOuter_v}, "Outer values of left sideband vs pT"}; - Configurable> sidebandRightInner{"sidebandRightInner", std::vector{sidebandRightInner_v}, "Inner values of right sideband vs pT"}; - Configurable> sidebandRightOuter{"sidebandRightOuter", std::vector{sidebandRightOuter_v}, "Outer values of right sideband vs pT"}; - Configurable> efficiencyD{"efficiencyD", std::vector{efficiencyDmeson_v}, "Efficiency values for D meson specie under study"}; + Configurable> signalRegionInner{"signalRegionInner", std::vector{signalRegionInnerV}, "Inner values of signal region vs pT"}; + Configurable> signalRegionOuter{"signalRegionOuter", std::vector{signalRegionOuterV}, "Outer values of signal region vs pT"}; + Configurable> sidebandLeftInner{"sidebandLeftInner", std::vector{sidebandLeftInnerV}, "Inner values of left sideband vs pT"}; + Configurable> sidebandLeftOuter{"sidebandLeftOuter", std::vector{sidebandLeftOuterV}, "Outer values of left sideband vs pT"}; + Configurable> sidebandRightInner{"sidebandRightInner", std::vector{sidebandRightInnerV}, "Inner values of right sideband vs pT"}; + Configurable> sidebandRightOuter{"sidebandRightOuter", std::vector{sidebandRightOuterV}, "Outer values of right sideband vs pT"}; + Configurable> efficiencyD{"efficiencyD", std::vector{efficiencyDmesonV}, "Efficiency values for D meson specie under study"}; HistogramRegistry registry{ "registry", @@ -171,7 +171,7 @@ struct HfTaskCorrelationDDbar { void init(InitContext&) { // redefinition of pT axes for THnSparse holding correlation entries - int nBinspTaxis = binsPtCorrelations->size() - 1; + int const nBinspTaxis = binsPtCorrelations->size() - 1; const double* valuespTaxis = binsPtCorrelations->data(); for (int i = 2; i <= 3; i++) { @@ -246,18 +246,18 @@ struct HfTaskCorrelationDDbar { { for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities - double deltaPhi = pairEntry.deltaPhi(); - double deltaEta = pairEntry.deltaEta(); - double ptD = pairEntry.ptD(); - double ptDbar = pairEntry.ptDbar(); - double massD = pairEntry.mD(); - double massDbar = pairEntry.mDbar(); + double const deltaPhi = pairEntry.deltaPhi(); + double const deltaEta = pairEntry.deltaEta(); + double const ptD = pairEntry.ptD(); + double const ptDbar = pairEntry.ptDbar(); + double const massD = pairEntry.mD(); + double const massDbar = pairEntry.mDbar(); - int pTBinD = o2::analysis::findBin(binsPtCorrelations, ptD); - int pTBinDbar = o2::analysis::findBin(binsPtCorrelations, ptDbar); + int const pTBinD = o2::analysis::findBin(binsPtCorrelations, ptD); + int const pTBinDbar = o2::analysis::findBin(binsPtCorrelations, ptDbar); double efficiencyWeight = 1.; - if (applyEfficiency) { + if (applyEfficiency != 0) { efficiencyWeight = 1. / (efficiencyD->at(o2::analysis::findBin(binsPtEfficiency, ptD)) * efficiencyD->at(o2::analysis::findBin(binsPtEfficiency, ptDbar))); } @@ -303,18 +303,18 @@ struct HfTaskCorrelationDDbar { { for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities - double deltaPhi = pairEntry.deltaPhi(); - double deltaEta = pairEntry.deltaEta(); - double ptD = pairEntry.ptD(); - double ptDbar = pairEntry.ptDbar(); - double massD = pairEntry.mD(); - double massDbar = pairEntry.mDbar(); + double const deltaPhi = pairEntry.deltaPhi(); + double const deltaEta = pairEntry.deltaEta(); + double const ptD = pairEntry.ptD(); + double const ptDbar = pairEntry.ptDbar(); + double const massD = pairEntry.mD(); + double const massDbar = pairEntry.mDbar(); - int pTBinD = o2::analysis::findBin(binsPtCorrelations, ptD); - int pTBinDbar = o2::analysis::findBin(binsPtCorrelations, ptDbar); + int const pTBinD = o2::analysis::findBin(binsPtCorrelations, ptD); + int const pTBinDbar = o2::analysis::findBin(binsPtCorrelations, ptDbar); double efficiencyWeight = 1.; - if (applyEfficiency) { + if (applyEfficiency != 0) { efficiencyWeight = 1. / (efficiencyD->at(o2::analysis::findBin(binsPtEfficiency, ptD)) * efficiencyD->at(o2::analysis::findBin(binsPtEfficiency, ptDbar))); } @@ -450,10 +450,10 @@ struct HfTaskCorrelationDDbar { { for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities - double deltaPhi = pairEntry.deltaPhi(); - double deltaEta = pairEntry.deltaEta(); - double ptD = pairEntry.ptD(); - double ptDbar = pairEntry.ptDbar(); + double const deltaPhi = pairEntry.deltaPhi(); + double const deltaEta = pairEntry.deltaEta(); + double const ptD = pairEntry.ptD(); + double const ptDbar = pairEntry.ptDbar(); // reject entries outside pT ranges of interest if (o2::analysis::findBin(binsPtCorrelations, ptD) == -1 || o2::analysis::findBin(binsPtCorrelations, ptDbar) == -1) { diff --git a/PWGHF/HFC/Tasks/taskCorrelationDMesonPairs.cxx b/PWGHF/HFC/Tasks/taskCorrelationDMesonPairs.cxx index 31082ef795a..955c2f559bc 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationDMesonPairs.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationDMesonPairs.cxx @@ -94,28 +94,29 @@ struct HfTaskCorrelationDMesonPairs { { if ((TESTBIT(candidateType, SelectedD) && TESTBIT(candidateType, TrueD)) || (TESTBIT(candidateType, SelectedDbar) && TESTBIT(candidateType, TrueDbar))) { return Signal; - } else if ((TESTBIT(candidateType, SelectedD) && TESTBIT(candidateType, TrueDbar)) || (TESTBIT(candidateType, SelectedDbar) && TESTBIT(candidateType, TrueD))) { + } + if ((TESTBIT(candidateType, SelectedD) && TESTBIT(candidateType, TrueDbar)) || (TESTBIT(candidateType, SelectedDbar) && TESTBIT(candidateType, TrueD))) { return Reflected; - } else if ((TESTBIT(candidateType, SelectedD) && !(TESTBIT(candidateType, TrueD) && TESTBIT(candidateType, TrueDbar))) || - (TESTBIT(candidateType, SelectedDbar) && !(TESTBIT(candidateType, TrueD) && TESTBIT(candidateType, TrueDbar)))) { + } + if ((TESTBIT(candidateType, SelectedD) && !(TESTBIT(candidateType, TrueD) && TESTBIT(candidateType, TrueDbar))) || + (TESTBIT(candidateType, SelectedDbar) && !(TESTBIT(candidateType, TrueD) && TESTBIT(candidateType, TrueDbar)))) { return Bkg; - } else { - return Default; } + return Default; } void processData(aod::D0Pair const& pairEntries) { for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities - float ptCand1 = pairEntry.ptCand1(); - float ptCand2 = pairEntry.ptCand2(); - float massDCand1 = pairEntry.mDCand1(); - float massDbarCand1 = pairEntry.mDbarCand1(); - float massDCand2 = pairEntry.mDCand2(); - float massDbarCand2 = pairEntry.mDbarCand2(); - float yCand1 = pairEntry.yCand1(); - float yCand2 = pairEntry.yCand2(); + float const ptCand1 = pairEntry.ptCand1(); + float const ptCand2 = pairEntry.ptCand2(); + float const massDCand1 = pairEntry.mDCand1(); + float const massDbarCand1 = pairEntry.mDbarCand1(); + float const massDCand2 = pairEntry.mDCand2(); + float const massDbarCand2 = pairEntry.mDbarCand2(); + float const yCand1 = pairEntry.yCand1(); + float const yCand2 = pairEntry.yCand2(); auto pairType = pairEntry.pairType(); auto d0Type1 = getD0Type(pairEntry.candidateType1()); auto d0Type2 = getD0Type(pairEntry.candidateType2()); @@ -141,14 +142,14 @@ struct HfTaskCorrelationDMesonPairs { { for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities - double ptParticle1 = pairEntry.ptCand1(); - double ptParticle2 = pairEntry.ptCand2(); - float massDParticle1 = pairEntry.mDCand1(); - float massDbarParticle1 = pairEntry.mDbarCand1(); - float massDParticle2 = pairEntry.mDCand2(); - float massDbarParticle2 = pairEntry.mDbarCand2(); - float yParticle1 = pairEntry.yCand1(); - float yParticle2 = pairEntry.yCand2(); + double const ptParticle1 = pairEntry.ptCand1(); + double const ptParticle2 = pairEntry.ptCand2(); + float const massDParticle1 = pairEntry.mDCand1(); + float const massDbarParticle1 = pairEntry.mDbarCand1(); + float const massDParticle2 = pairEntry.mDCand2(); + float const massDbarParticle2 = pairEntry.mDbarCand2(); + float const yParticle1 = pairEntry.yCand1(); + float const yParticle2 = pairEntry.yCand2(); auto pairType = pairEntry.pairType(); auto d0Type1 = getD0Type(pairEntry.candidateType1()); auto d0Type2 = getD0Type(pairEntry.candidateType2()); diff --git a/PWGHF/HFC/Tasks/taskCorrelationDplusHadrons.cxx b/PWGHF/HFC/Tasks/taskCorrelationDplusHadrons.cxx index ebdbab469df..aa8a6ea4d42 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationDplusHadrons.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationDplusHadrons.cxx @@ -79,21 +79,21 @@ const TString stringMCGenDFd = "MC gen, non-prompt D+;"; const int npTBinsCorrelations = 8; const double pTBinsCorrelations[npTBinsCorrelations + 1] = {0., 2., 4., 6., 8., 12., 16., 24., 99.}; -auto ptBinsCorrelationsVec = std::vector{pTBinsCorrelations, pTBinsCorrelations + npTBinsCorrelations + 1}; +const auto ptBinsCorrelationsVec = std::vector{pTBinsCorrelations, pTBinsCorrelations + npTBinsCorrelations + 1}; const double signalRegionInnerDefault[npTBinsCorrelations] = {1.8490, 1.8490, 1.8490, 1.8490, 1.8490, 1.8490, 1.8490, 1.8490}; const double signalRegionOuterDefault[npTBinsCorrelations] = {1.8890, 1.8890, 1.8890, 1.8890, 1.8890, 1.8890, 1.8890, 1.8890}; const double sidebandLeftOuterDefault[npTBinsCorrelations] = {1.7690, 1.7690, 1.7690, 1.7690, 1.7690, 1.7690, 1.7690, 1.7690}; const double sidebandLeftInnerDefault[npTBinsCorrelations] = {1.8250, 1.8250, 1.8250, 1.8250, 1.8250, 1.8250, 1.8250, 1.8250}; const double sidebandRightInnerDefault[npTBinsCorrelations] = {1.9130, 1.9130, 1.9130, 1.9130, 1.9130, 1.9130, 1.9130, 1.9130}; const double sidebandRightOuterDefault[npTBinsCorrelations] = {1.9690, 1.9690, 1.9690, 1.9690, 1.9690, 1.9690, 1.9690, 1.9690}; -auto signalRegionInnerVec = std::vector{signalRegionInnerDefault, signalRegionInnerDefault + npTBinsCorrelations}; -auto signalRegionOuterVec = std::vector{signalRegionOuterDefault, signalRegionOuterDefault + npTBinsCorrelations}; -auto sidebandLeftInnerVec = std::vector{sidebandLeftInnerDefault, sidebandLeftInnerDefault + npTBinsCorrelations}; -auto sidebandLeftOuterVec = std::vector{sidebandLeftOuterDefault, sidebandLeftOuterDefault + npTBinsCorrelations}; -auto sidebandRightInnerVec = std::vector{sidebandRightInnerDefault, sidebandRightInnerDefault + npTBinsCorrelations}; -auto sidebandRightOuterVec = std::vector{sidebandRightOuterDefault, sidebandRightOuterDefault + npTBinsCorrelations}; +const auto signalRegionInnerVec = std::vector{signalRegionInnerDefault, signalRegionInnerDefault + npTBinsCorrelations}; +const auto signalRegionOuterVec = std::vector{signalRegionOuterDefault, signalRegionOuterDefault + npTBinsCorrelations}; +const auto sidebandLeftInnerVec = std::vector{sidebandLeftInnerDefault, sidebandLeftInnerDefault + npTBinsCorrelations}; +const auto sidebandLeftOuterVec = std::vector{sidebandLeftOuterDefault, sidebandLeftOuterDefault + npTBinsCorrelations}; +const auto sidebandRightInnerVec = std::vector{sidebandRightInnerDefault, sidebandRightInnerDefault + npTBinsCorrelations}; +const auto sidebandRightOuterVec = std::vector{sidebandRightOuterDefault, sidebandRightOuterDefault + npTBinsCorrelations}; const int npTBinsEfficiency = o2::analysis::hf_cuts_dplus_to_pi_k_pi::NBinsPt; -std::vector efficiencyDmeson(npTBinsEfficiency + 1); +const std::vector efficiencyDmeson(npTBinsEfficiency + 1); /// Dplus-Hadron correlation pair filling task, from pair tables - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) struct HfTaskCorrelationDplusHadrons { @@ -186,13 +186,13 @@ struct HfTaskCorrelationDplusHadrons { AxisSpec axisMassD = {binsMassD, "inv. mass (#pi^{+}K^{-}#pi^{+}) (GeV/#it{c}^{2})"}; AxisSpec axisPtCorr = {(std::vector)binsPtCorrelations, "#it{p}_{T}^{D} (GeV/#it{c})"}; AxisSpec axisPtD = {(std::vector)binsPtEfficiencyD, "#it{p}_{T}^{D} (GeV/#it{c})"}; - AxisSpec axisMultFT0M = {binsMultFT0M, "MultiplicityFT0M"}; + AxisSpec const axisMultFT0M = {binsMultFT0M, "MultiplicityFT0M"}; AxisSpec axisDeltaEta = {binsEta, "#it{#eta}^{Hadron}-#it{#eta}^{D}"}; AxisSpec axisDeltaPhi = {binsPhi, "#it{#varphi}^{Hadron}-#it{#varphi}^{D} (rad)"}; AxisSpec axisPtHadron = {(std::vector)binsPtHadron, "#it{p}_{T}^{Hadron} (GeV/#it{c})"}; AxisSpec axisPoolBin = {binsPoolBin, "poolBin"}; AxisSpec axisDplusPrompt = {2, -0.5, 1.5, "Prompt D+"}; - AxisSpec axisBdtScore = {binsBdtScore, "Bdt score"}; + AxisSpec const axisBdtScore = {binsBdtScore, "Bdt score"}; // Histograms for data analysis registry.add("hBdtScorePrompt", "D+ BDT prompt score", {HistType::kTH1F, {axisBdtScore}}); @@ -281,7 +281,7 @@ struct HfTaskCorrelationDplusHadrons { hCandidates->GetAxis(2)->SetTitle("Charm hadron origin"); // Loading efficiency histograms from CCDB - if (applyEfficiency && loadAccXEffFromCCDB) { + if ((applyEfficiency != 0) && loadAccXEffFromCCDB) { ccdb->setURL(ccdbUrl); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); @@ -330,13 +330,13 @@ struct HfTaskCorrelationDplusHadrons { void processData(DplusHadronPairFullWithMl const& pairEntries, aod::DplusRecoInfo const& candidates) { for (const auto& candidate : candidates) { - float massD = candidate.mD(); - float ptD = candidate.ptD(); - float bdtScorePrompt = candidate.mlScorePrompt(); - float bdtScoreNonPrompt = candidate.mlScoreNonPrompt(); - float bdtScoreBkg = candidate.mlScoreBkg(); - int effBinD = o2::analysis::findBin(binsPtEfficiencyD, ptD); - float bdtScorePromptOrNonPrompt = isPromptAnalysis ? bdtScorePrompt : bdtScoreNonPrompt; + float const massD = candidate.mD(); + float const ptD = candidate.ptD(); + float const bdtScorePrompt = candidate.mlScorePrompt(); + float const bdtScoreNonPrompt = candidate.mlScoreNonPrompt(); + float const bdtScoreBkg = candidate.mlScoreBkg(); + int const effBinD = o2::analysis::findBin(binsPtEfficiencyD, ptD); + float const bdtScorePromptOrNonPrompt = isPromptAnalysis ? bdtScorePrompt : bdtScoreNonPrompt; // reject entries outside pT ranges of interest if (ptD < binsPtEfficiencyD->front() || ptD > binsPtEfficiencyD->back()) { @@ -347,7 +347,7 @@ struct HfTaskCorrelationDplusHadrons { continue; } double efficiencyWeightD = 1.; - if (applyEfficiency) { + if (applyEfficiency != 0) { efficiencyWeightD = 1. / efficiencyD->at(o2::analysis::findBin(binsPtEfficiencyD, ptD)); if (loadAccXEffFromCCDB) { efficiencyWeightD = 1. / effD->GetBinContent(effD->FindBin(ptD)); @@ -361,21 +361,21 @@ struct HfTaskCorrelationDplusHadrons { for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities - float deltaPhi = pairEntry.deltaPhi(); - float deltaEta = pairEntry.deltaEta(); - float ptD = pairEntry.ptD(); - float ptHadron = pairEntry.ptHadron(); - float bdtScorePrompt = pairEntry.mlScorePrompt(); - float bdtScoreNonPrompt = pairEntry.mlScoreNonPrompt(); - float bdtScoreBkg = pairEntry.mlScoreBkg(); - float trackDcaXY = pairEntry.trackDcaXY(); - float trackDcaZ = pairEntry.trackDcaZ(); - int trackTpcCrossedRows = pairEntry.trackTPCNClsCrossedRows(); - int poolBin = pairEntry.poolBin(); - double massD = pairEntry.mD(); - int effBinD = o2::analysis::findBin(binsPtEfficiencyD, ptD); - int pTBinD = o2::analysis::findBin(binsPtCorrelations, ptD); - float bdtScorePromptOrNonPrompt = isPromptAnalysis ? bdtScorePrompt : bdtScoreNonPrompt; + float const deltaPhi = pairEntry.deltaPhi(); + float const deltaEta = pairEntry.deltaEta(); + float const ptD = pairEntry.ptD(); + float const ptHadron = pairEntry.ptHadron(); + float const bdtScorePrompt = pairEntry.mlScorePrompt(); + float const bdtScoreNonPrompt = pairEntry.mlScoreNonPrompt(); + float const bdtScoreBkg = pairEntry.mlScoreBkg(); + float const trackDcaXY = pairEntry.trackDcaXY(); + float const trackDcaZ = pairEntry.trackDcaZ(); + int const trackTpcCrossedRows = pairEntry.trackTPCNClsCrossedRows(); + int const poolBin = pairEntry.poolBin(); + double const massD = pairEntry.mD(); + int const effBinD = o2::analysis::findBin(binsPtEfficiencyD, ptD); + int const pTBinD = o2::analysis::findBin(binsPtCorrelations, ptD); + float const bdtScorePromptOrNonPrompt = isPromptAnalysis ? bdtScorePrompt : bdtScoreNonPrompt; // reject entries outside pT ranges of interest if (ptD < binsPtEfficiencyD->front() || ptD > binsPtEfficiencyD->back()) { @@ -389,7 +389,7 @@ struct HfTaskCorrelationDplusHadrons { continue; } double efficiencyWeight = 1.; - if (applyEfficiency) { + if (applyEfficiency != 0) { efficiencyWeight = 1. / (efficiencyD->at(effBinD) * efficiencyHad->at(o2::analysis::findBin(binsPtEfficiencyHad, ptHadron))); if (loadAccXEffFromCCDB) { efficiencyWeight = 1. / (effD->GetBinContent(effD->FindBin(ptD)) * mEfficiencyAssociated->GetBinContent(mEfficiencyAssociated->FindBin(ptHadron))); @@ -432,24 +432,25 @@ struct HfTaskCorrelationDplusHadrons { soa::Join const& candidates) { for (const auto& candidate : candidates) { - float massD = candidate.mD(); - float ptD = candidate.ptD(); - float bdtScorePrompt = candidate.mlScorePrompt(); - float bdtScoreNonPrompt = candidate.mlScoreNonPrompt(); - float bdtScoreBkg = candidate.mlScoreBkg(); - int effBinD = o2::analysis::findBin(binsPtEfficiencyD, ptD); - bool isDplusPrompt = candidate.isPrompt(); - float bdtScorePromptOrNonPrompt = isPromptAnalysis ? bdtScorePrompt : bdtScoreNonPrompt; + float const massD = candidate.mD(); + float const ptD = candidate.ptD(); + float const bdtScorePrompt = candidate.mlScorePrompt(); + float const bdtScoreNonPrompt = candidate.mlScoreNonPrompt(); + float const bdtScoreBkg = candidate.mlScoreBkg(); + int const effBinD = o2::analysis::findBin(binsPtEfficiencyD, ptD); + bool const isDplusPrompt = candidate.isPrompt(); + float const bdtScorePromptOrNonPrompt = isPromptAnalysis ? bdtScorePrompt : bdtScoreNonPrompt; // reject entries outside pT ranges of interest - if (ptD < binsPtEfficiencyD->front() || ptD > binsPtEfficiencyD->back()) + if (ptD < binsPtEfficiencyD->front() || ptD > binsPtEfficiencyD->back()) { continue; + } if (bdtScorePromptOrNonPrompt < mlScorePromptOrNonPromptMin->at(effBinD) || bdtScorePromptOrNonPrompt > mlScorePromptOrNonPromptMax->at(effBinD) || bdtScoreBkg > mlScoreBkg->at(effBinD)) { continue; } double efficiencyWeightD = 1.; - if (applyEfficiency) { + if (applyEfficiency != 0) { if (isDplusPrompt) { efficiencyWeightD = 1. / efficiencyD->at(effBinD); if (loadAccXEffFromCCDB) { @@ -476,28 +477,29 @@ struct HfTaskCorrelationDplusHadrons { for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities - float deltaPhi = pairEntry.deltaPhi(); - float deltaEta = pairEntry.deltaEta(); - float ptD = pairEntry.ptD(); - float ptHadron = pairEntry.ptHadron(); - float massD = pairEntry.mD(); - float bdtScorePrompt = pairEntry.mlScorePrompt(); - float bdtScoreNonPrompt = pairEntry.mlScoreNonPrompt(); - float bdtScoreBkg = pairEntry.mlScoreBkg(); - bool isPhysicalPrimary = pairEntry.isPhysicalPrimary(); - float trackDcaXY = pairEntry.trackDcaXY(); - float trackDcaZ = pairEntry.trackDcaZ(); - int trackTpcCrossedRows = pairEntry.trackTPCNClsCrossedRows(); - bool isDplusPrompt = pairEntry.isPrompt(); - int originHadron = pairEntry.trackOrigin(); - int poolBin = pairEntry.poolBin(); - int effBinD = o2::analysis::findBin(binsPtEfficiencyD, ptD); - int pTBinD = o2::analysis::findBin(binsPtCorrelations, ptD); - float bdtScorePromptOrNonPrompt = isPromptAnalysis ? bdtScorePrompt : bdtScoreNonPrompt; + float const deltaPhi = pairEntry.deltaPhi(); + float const deltaEta = pairEntry.deltaEta(); + float const ptD = pairEntry.ptD(); + float const ptHadron = pairEntry.ptHadron(); + float const massD = pairEntry.mD(); + float const bdtScorePrompt = pairEntry.mlScorePrompt(); + float const bdtScoreNonPrompt = pairEntry.mlScoreNonPrompt(); + float const bdtScoreBkg = pairEntry.mlScoreBkg(); + bool const isPhysicalPrimary = pairEntry.isPhysicalPrimary(); + float const trackDcaXY = pairEntry.trackDcaXY(); + float const trackDcaZ = pairEntry.trackDcaZ(); + int const trackTpcCrossedRows = pairEntry.trackTPCNClsCrossedRows(); + bool const isDplusPrompt = pairEntry.isPrompt(); + int const originHadron = pairEntry.trackOrigin(); + int const poolBin = pairEntry.poolBin(); + int const effBinD = o2::analysis::findBin(binsPtEfficiencyD, ptD); + int const pTBinD = o2::analysis::findBin(binsPtCorrelations, ptD); + float const bdtScorePromptOrNonPrompt = isPromptAnalysis ? bdtScorePrompt : bdtScoreNonPrompt; // reject entries outside pT ranges of interest - if (ptD < binsPtEfficiencyD->front() || ptD > binsPtEfficiencyD->back()) + if (ptD < binsPtEfficiencyD->front() || ptD > binsPtEfficiencyD->back()) { continue; + } if (bdtScorePromptOrNonPrompt < mlScorePromptOrNonPromptMin->at(effBinD) || bdtScorePromptOrNonPrompt > mlScorePromptOrNonPromptMax->at(effBinD) || bdtScoreBkg > mlScoreBkg->at(effBinD)) { continue; @@ -507,7 +509,7 @@ struct HfTaskCorrelationDplusHadrons { } double efficiencyWeight = 1.; - if (applyEfficiency) { + if (applyEfficiency != 0) { if (isDplusPrompt) { efficiencyWeight = 1. / (efficiencyD->at(effBinD) * efficiencyHad->at(o2::analysis::findBin(binsPtEfficiencyHad, ptHadron))); if (loadAccXEffFromCCDB) { @@ -574,13 +576,13 @@ struct HfTaskCorrelationDplusHadrons { { for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities - float deltaPhi = pairEntry.deltaPhi(); - float deltaEta = pairEntry.deltaEta(); - float ptD = pairEntry.ptD(); - float ptHadron = pairEntry.ptHadron(); - int poolBin = pairEntry.poolBin(); - int originHadron = pairEntry.trackOrigin(); - bool isDplusPrompt = pairEntry.isPrompt(); + float const deltaPhi = pairEntry.deltaPhi(); + float const deltaEta = pairEntry.deltaEta(); + float const ptD = pairEntry.ptD(); + float const ptHadron = pairEntry.ptHadron(); + int const poolBin = pairEntry.poolBin(); + int const originHadron = pairEntry.trackOrigin(); + bool const isDplusPrompt = pairEntry.isPrompt(); registry.fill(HIST("hCorrel2DVsPtMcGen"), deltaPhi, deltaEta, ptD, ptHadron, poolBin); registry.fill(HIST("hDeltaEtaPtIntMcGen"), deltaEta); diff --git a/PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx b/PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx index 1536814e5f8..450258ab02b 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx @@ -44,6 +44,8 @@ #include #include +#include +#include #include #include @@ -67,7 +69,10 @@ enum ResonantChannel : int8_t { Kstar0K = 2 }; -static std::unordered_map channelsResonant = {{{ResonantChannel::PhiPi, hf_decay::hf_cand_3prong::DecayChannelResonant::DsToPhiPi}, {ResonantChannel::Kstar0K, hf_decay::hf_cand_3prong::DecayChannelResonant::DsToKstar0K}}}; +namespace +{ +std::unordered_map channelsResonant = {{{ResonantChannel::PhiPi, hf_decay::hf_cand_3prong::DecayChannelResonant::DsToPhiPi}, {ResonantChannel::Kstar0K, hf_decay::hf_cand_3prong::DecayChannelResonant::DsToKstar0K}}}; +} /// Ds-Hadron correlation pair filling task, from pair tables - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) struct HfTaskCorrelationDsHadrons { @@ -130,7 +135,7 @@ struct HfTaskCorrelationDsHadrons { std::shared_ptr hEfficiencyAssociatedMult = nullptr; std::shared_ptr hEfficiencyAssociatedDeltaPhiCorr = nullptr; - const float epsilon = 1.e-8; + static constexpr float Epsilon{1.e-8}; HfHelper hfHelper; SliceCache cache; @@ -174,8 +179,8 @@ struct HfTaskCorrelationDsHadrons { AxisSpec axisPtD = {(std::vector)binsPtD, "#it{p}_{T}^{D} (GeV/#it{c})"}; AxisSpec axisPtHadron = {(std::vector)binsPtHadron, "#it{p}_{T}^{Hadron} (GeV/#it{c})"}; AxisSpec axisPoolBin = {binsPoolBin, "poolBin"}; - AxisSpec axisBdtScore = {binsBdtScore, "Bdt score"}; - AxisSpec axisMultFT0M = {binsMultFT0M, "MultiplicityFT0M"}; + AxisSpec const axisBdtScore = {binsBdtScore, "Bdt score"}; + AxisSpec const axisMultFT0M = {binsMultFT0M, "MultiplicityFT0M"}; AxisSpec axisPosZ = {binsPosZ, "PosZ"}; AxisSpec axisNumPvContr = {binsNumPvContr, "Num PV contributors"}; AxisSpec axisDsPrompt = {2, -0.5, 1.5, "Prompt Ds"}; @@ -351,18 +356,18 @@ struct HfTaskCorrelationDsHadrons { case EfficiencyMode::DsOnly: if (loadAccXEffFromCCDB) { if (useHighDimHistoForEff) { - if (hEfficiencyDMult->GetBinContent(hEfficiencyDMult->FindBin(ptD, static_cast(*multPvContrib))) <= epsilon) { + if (hEfficiencyDMult->GetBinContent(hEfficiencyDMult->FindBin(ptD, static_cast(*multPvContrib))) <= Epsilon) { LOG(fatal) << "A bin content in Ds-meson efficiency histogram is zero!"; } weight = 1. / hEfficiencyDMult->GetBinContent(hEfficiencyDMult->FindBin(ptD, static_cast(*multPvContrib))); } else { - if (hEfficiencyD->GetBinContent(hEfficiencyD->FindBin(ptD)) <= epsilon) { + if (hEfficiencyD->GetBinContent(hEfficiencyD->FindBin(ptD)) <= Epsilon) { LOG(fatal) << "A bin content in Ds-meson efficiency histogram is zero!"; } weight = 1. / hEfficiencyD->GetBinContent(hEfficiencyD->FindBin(ptD)); } } else { - if (efficiencyD->at(o2::analysis::findBin(binsPtEfficiencyD, ptD)) <= epsilon) { + if (efficiencyD->at(o2::analysis::findBin(binsPtEfficiencyD, ptD)) <= Epsilon) { LOG(fatal) << "A bin content in Ds-meson efficiency vector is zero!"; } weight = 1. / efficiencyD->at(o2::analysis::findBin(binsPtEfficiencyD, ptD)); @@ -373,18 +378,18 @@ struct HfTaskCorrelationDsHadrons { if (ptAssoc && (hEfficiencyAssociated || hEfficiencyAssociatedMult || hEfficiencyAssociatedDeltaPhiCorr)) { if (useHighDimHistoForEff) { if (applyDeltaPhiCorrEff) { - if (hEfficiencyAssociatedDeltaPhiCorr->GetBinContent(hEfficiencyAssociatedDeltaPhiCorr->FindBin(*ptAssoc, ptD, static_cast(*deltaPhi))) <= epsilon) { + if (hEfficiencyAssociatedDeltaPhiCorr->GetBinContent(hEfficiencyAssociatedDeltaPhiCorr->FindBin(*ptAssoc, ptD, static_cast(*deltaPhi))) <= Epsilon) { LOG(fatal) << "A bin content in associated particle efficiency histogram is zero!"; } weight = 1. / (hEfficiencyDMult->GetBinContent(hEfficiencyDMult->FindBin(ptD, static_cast(*multPvContrib))) * hEfficiencyAssociatedDeltaPhiCorr->GetBinContent(hEfficiencyAssociatedDeltaPhiCorr->FindBin(*ptAssoc, ptD, static_cast(*deltaPhi)))); } else { - if (hEfficiencyAssociatedMult->GetBinContent(hEfficiencyAssociatedMult->FindBin(*ptAssoc, static_cast(*multPvContrib))) <= epsilon) { + if (hEfficiencyAssociatedMult->GetBinContent(hEfficiencyAssociatedMult->FindBin(*ptAssoc, static_cast(*multPvContrib))) <= Epsilon) { LOG(fatal) << "A bin content in associated particle efficiency histogram is zero!"; } weight = 1. / (hEfficiencyDMult->GetBinContent(hEfficiencyDMult->FindBin(ptD, static_cast(*multPvContrib))) * hEfficiencyAssociatedMult->GetBinContent(hEfficiencyAssociatedMult->FindBin(*ptAssoc, static_cast(*multPvContrib)))); } } else { - if (hEfficiencyAssociated->GetBinContent(hEfficiencyAssociated->FindBin(*ptAssoc)) <= epsilon) { + if (hEfficiencyAssociated->GetBinContent(hEfficiencyAssociated->FindBin(*ptAssoc)) <= Epsilon) { LOG(fatal) << "A bin content in associated particle efficiency histogram is zero!"; } weight = 1. / (hEfficiencyD->GetBinContent(hEfficiencyD->FindBin(ptD)) * hEfficiencyAssociated->GetBinContent(hEfficiencyAssociated->FindBin(*ptAssoc))); @@ -392,7 +397,7 @@ struct HfTaskCorrelationDsHadrons { } } else { if (ptAssoc) { - if (efficiencyHad->at(o2::analysis::findBin(binsPtEfficiencyHad, *ptAssoc)) <= epsilon) { + if (efficiencyHad->at(o2::analysis::findBin(binsPtEfficiencyHad, *ptAssoc)) <= Epsilon) { LOG(fatal) << "A bin content in associated particle efficiency vector is zero!"; } weight = 1. / (efficiencyD->at(o2::analysis::findBin(binsPtEfficiencyD, ptD)) * efficiencyHad->at(o2::analysis::findBin(binsPtEfficiencyHad, *ptAssoc))); @@ -411,12 +416,12 @@ struct HfTaskCorrelationDsHadrons { aod::DsCandRecoInfo const& candidates) { for (const auto& candidate : candidates) { - float massD = candidate.mD(); - float ptD = candidate.signedPtD(); - float bdtScorePrompt = candidate.mlScorePrompt(); - float bdtScoreBkg = candidate.mlScoreBkg(); + float const massD = candidate.mD(); + float const ptD = candidate.signedPtD(); + float const bdtScorePrompt = candidate.mlScorePrompt(); + float const bdtScoreBkg = candidate.mlScoreBkg(); int multPvContrib = candidate.numPvContrib(); - int ptBinD = o2::analysis::findBin(binsPtD, std::abs(ptD)); + int const ptBinD = o2::analysis::findBin(binsPtD, std::abs(ptD)); if (!isSelectedCandidate(ptBinD, bdtScorePrompt, bdtScoreBkg)) { continue; @@ -437,18 +442,18 @@ struct HfTaskCorrelationDsHadrons { for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities float deltaPhi = pairEntry.deltaPhi(); - float deltaEta = pairEntry.deltaEta(); - float ptD = pairEntry.signedPtD(); - float ptHadron = pairEntry.signedPtHadron(); - float massD = pairEntry.mD(); - float bdtScorePrompt = pairEntry.mlScorePrompt(); - float bdtScoreBkg = pairEntry.mlScoreBkg(); - float trackDcaXY = pairEntry.trackDcaXY(); - float trackDcaZ = pairEntry.trackDcaZ(); + float const deltaEta = pairEntry.deltaEta(); + float const ptD = pairEntry.signedPtD(); + float const ptHadron = pairEntry.signedPtHadron(); + float const massD = pairEntry.mD(); + float const bdtScorePrompt = pairEntry.mlScorePrompt(); + float const bdtScoreBkg = pairEntry.mlScoreBkg(); + float const trackDcaXY = pairEntry.trackDcaXY(); + float const trackDcaZ = pairEntry.trackDcaZ(); int multPvContrib = pairEntry.numPvContrib(); - int trackTpcCrossedRows = pairEntry.trackTPCNClsCrossedRows(); - int poolBin = pairEntry.poolBin(); - int ptBinD = o2::analysis::findBin(binsPtD, std::abs(ptD)); + int const trackTpcCrossedRows = pairEntry.trackTPCNClsCrossedRows(); + int const poolBin = pairEntry.poolBin(); + int const ptBinD = o2::analysis::findBin(binsPtD, std::abs(ptD)); if (!isSelectedCandidate(ptBinD, bdtScorePrompt, bdtScoreBkg)) { continue; @@ -522,13 +527,13 @@ struct HfTaskCorrelationDsHadrons { soa::Join const& candidates) { for (const auto& candidate : candidates) { - float massD = candidate.mD(); - float ptD = candidate.signedPtD(); - float bdtScorePrompt = candidate.mlScorePrompt(); - float bdtScoreBkg = candidate.mlScoreBkg(); - int ptBinD = o2::analysis::findBin(binsPtD, std::abs(ptD)); + float const massD = candidate.mD(); + float const ptD = candidate.signedPtD(); + float const bdtScorePrompt = candidate.mlScorePrompt(); + float const bdtScoreBkg = candidate.mlScoreBkg(); + int const ptBinD = o2::analysis::findBin(binsPtD, std::abs(ptD)); int multPvContrib = candidate.numPvContrib(); - bool isDsPrompt = candidate.isPrompt(); + bool const isDsPrompt = candidate.isPrompt(); if (!isSelectedCandidate(ptBinD, bdtScorePrompt, bdtScoreBkg)) { continue; @@ -555,21 +560,21 @@ struct HfTaskCorrelationDsHadrons { for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities float deltaPhi = pairEntry.deltaPhi(); - float deltaEta = pairEntry.deltaEta(); - float ptD = pairEntry.signedPtD(); - float ptHadron = pairEntry.signedPtHadron(); - float massD = pairEntry.mD(); - float bdtScorePrompt = pairEntry.mlScorePrompt(); - float bdtScoreBkg = pairEntry.mlScoreBkg(); - float trackDcaXY = pairEntry.trackDcaXY(); - float trackDcaZ = pairEntry.trackDcaZ(); + float const deltaEta = pairEntry.deltaEta(); + float const ptD = pairEntry.signedPtD(); + float const ptHadron = pairEntry.signedPtHadron(); + float const massD = pairEntry.mD(); + float const bdtScorePrompt = pairEntry.mlScorePrompt(); + float const bdtScoreBkg = pairEntry.mlScoreBkg(); + float const trackDcaXY = pairEntry.trackDcaXY(); + float const trackDcaZ = pairEntry.trackDcaZ(); int multPvContrib = pairEntry.numPvContrib(); - int trackTpcCrossedRows = pairEntry.trackTPCNClsCrossedRows(); - int poolBin = pairEntry.poolBin(); - int statusDsPrompt = static_cast(pairEntry.isPrompt()); - int statusPromptHadron = pairEntry.trackOrigin(); - int ptBinD = o2::analysis::findBin(binsPtD, std::abs(ptD)); - bool isPhysicalPrimary = pairEntry.isPhysicalPrimary(); + int const trackTpcCrossedRows = pairEntry.trackTPCNClsCrossedRows(); + int const poolBin = pairEntry.poolBin(); + int const statusDsPrompt = static_cast(pairEntry.isPrompt()); + int const statusPromptHadron = pairEntry.trackOrigin(); + int const ptBinD = o2::analysis::findBin(binsPtD, std::abs(ptD)); + bool const isPhysicalPrimary = pairEntry.isPhysicalPrimary(); if (!isSelectedCandidate(ptBinD, bdtScorePrompt, bdtScoreBkg)) { continue; @@ -624,13 +629,13 @@ struct HfTaskCorrelationDsHadrons { { for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities - float deltaPhi = pairEntry.deltaPhi(); - float deltaEta = pairEntry.deltaEta(); - float ptD = pairEntry.signedPtD(); - float ptHadron = pairEntry.signedPtHadron(); - int poolBin = pairEntry.poolBin(); - int statusPromptHadron = pairEntry.trackOrigin(); - bool isDsPrompt = pairEntry.isPrompt(); + float const deltaPhi = pairEntry.deltaPhi(); + float const deltaEta = pairEntry.deltaEta(); + float const ptD = pairEntry.signedPtD(); + float const ptHadron = pairEntry.signedPtHadron(); + int const poolBin = pairEntry.poolBin(); + int const statusPromptHadron = pairEntry.trackOrigin(); + bool const isDsPrompt = pairEntry.isPrompt(); registry.fill(HIST("hCorrel2DVsPtMcGen"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin); registry.fill(HIST("hDeltaEtaPtIntMcGen"), deltaEta); @@ -655,18 +660,18 @@ struct HfTaskCorrelationDsHadrons { for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities float deltaPhi = pairEntry.deltaPhi(); - float deltaEta = pairEntry.deltaEta(); - float ptD = pairEntry.signedPtD(); - float ptHadron = pairEntry.signedPtHadron(); - float massD = pairEntry.mD(); - float bdtScorePrompt = pairEntry.mlScorePrompt(); - float bdtScoreBkg = pairEntry.mlScoreBkg(); - float trackDcaXY = pairEntry.trackDcaXY(); - float trackDcaZ = pairEntry.trackDcaZ(); + float const deltaEta = pairEntry.deltaEta(); + float const ptD = pairEntry.signedPtD(); + float const ptHadron = pairEntry.signedPtHadron(); + float const massD = pairEntry.mD(); + float const bdtScorePrompt = pairEntry.mlScorePrompt(); + float const bdtScoreBkg = pairEntry.mlScoreBkg(); + float const trackDcaXY = pairEntry.trackDcaXY(); + float const trackDcaZ = pairEntry.trackDcaZ(); int multPvContrib = pairEntry.numPvContrib(); - int trackTpcCrossedRows = pairEntry.trackTPCNClsCrossedRows(); - int poolBin = pairEntry.poolBin(); - int ptBinD = o2::analysis::findBin(binsPtD, std::abs(ptD)); + int const trackTpcCrossedRows = pairEntry.trackTPCNClsCrossedRows(); + int const poolBin = pairEntry.poolBin(); + int const ptBinD = o2::analysis::findBin(binsPtD, std::abs(ptD)); if (!isSelectedCandidate(ptBinD, bdtScorePrompt, bdtScoreBkg)) { continue; @@ -740,13 +745,13 @@ struct HfTaskCorrelationDsHadrons { for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities float deltaPhi = pairEntry.deltaPhi(); - float deltaEta = pairEntry.deltaEta(); - float ptD = pairEntry.signedPtD(); - float ptHadron = pairEntry.signedPtHadron(); - float massD = pairEntry.mD(); + float const deltaEta = pairEntry.deltaEta(); + float const ptD = pairEntry.signedPtD(); + float const ptHadron = pairEntry.signedPtHadron(); + float const massD = pairEntry.mD(); int multPvContrib = pairEntry.numPvContrib(); - int poolBin = pairEntry.poolBin(); - int ptBinD = o2::analysis::findBin(binsPtD, std::abs(ptD)); + int const poolBin = pairEntry.poolBin(); + int const ptBinD = o2::analysis::findBin(binsPtD, std::abs(ptD)); double efficiencyWeight = 1.; if (useHighDimHistoForEff) { @@ -813,21 +818,21 @@ struct HfTaskCorrelationDsHadrons { for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities float deltaPhi = pairEntry.deltaPhi(); - float deltaEta = pairEntry.deltaEta(); - float ptD = pairEntry.signedPtD(); - float ptHadron = pairEntry.signedPtHadron(); - float massD = pairEntry.mD(); - float bdtScorePrompt = pairEntry.mlScorePrompt(); - float bdtScoreBkg = pairEntry.mlScoreBkg(); - float trackDcaXY = pairEntry.trackDcaXY(); - float trackDcaZ = pairEntry.trackDcaZ(); + float const deltaEta = pairEntry.deltaEta(); + float const ptD = pairEntry.signedPtD(); + float const ptHadron = pairEntry.signedPtHadron(); + float const massD = pairEntry.mD(); + float const bdtScorePrompt = pairEntry.mlScorePrompt(); + float const bdtScoreBkg = pairEntry.mlScoreBkg(); + float const trackDcaXY = pairEntry.trackDcaXY(); + float const trackDcaZ = pairEntry.trackDcaZ(); int multPvContrib = pairEntry.numPvContrib(); - int trackTpcCrossedRows = pairEntry.trackTPCNClsCrossedRows(); - int poolBin = pairEntry.poolBin(); - int statusDsPrompt = static_cast(pairEntry.isPrompt()); - int statusPromptHadron = pairEntry.trackOrigin(); - int ptBinD = o2::analysis::findBin(binsPtD, std::abs(ptD)); - bool isPhysicalPrimary = pairEntry.isPhysicalPrimary(); + int const trackTpcCrossedRows = pairEntry.trackTPCNClsCrossedRows(); + int const poolBin = pairEntry.poolBin(); + int const statusDsPrompt = static_cast(pairEntry.isPrompt()); + int const statusPromptHadron = pairEntry.trackOrigin(); + int const ptBinD = o2::analysis::findBin(binsPtD, std::abs(ptD)); + bool const isPhysicalPrimary = pairEntry.isPhysicalPrimary(); if (!isSelectedCandidate(ptBinD, bdtScorePrompt, bdtScoreBkg)) { continue; @@ -1145,7 +1150,7 @@ struct HfTaskCorrelationDsHadrons { } } if (separateTrackOrigins) { - int trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, true); + int const trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, true); if (trackOrigin == RecoDecay::OriginType::Prompt) { // charm orgin registry.fill(HIST("hPtPrmPromptPartMcGen"), mcParticle.pt()); } else if (trackOrigin == RecoDecay::OriginType::NonPrompt) { // beauty origin @@ -1198,7 +1203,7 @@ struct HfTaskCorrelationDsHadrons { } // check track origin if (separateTrackOrigins) { - int trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, true); + int const trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, true); if (trackOrigin == RecoDecay::OriginType::Prompt) { // charm orgin registry.fill(HIST("hPtPrmPromptPartMcRec"), track.pt()); } else if (trackOrigin == RecoDecay::OriginType::NonPrompt) { // beauty origin diff --git a/PWGHF/HFC/Tasks/taskCorrelationDstarHadrons.cxx b/PWGHF/HFC/Tasks/taskCorrelationDstarHadrons.cxx index eb450cc7e61..0b354abecee 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationDstarHadrons.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationDstarHadrons.cxx @@ -48,28 +48,28 @@ const TString stringPoolBin = "Pool Bin Number;"; const int nBinsPtCorrelation = 8; const double binsPtCorrelationsDefault[nBinsPtCorrelation + 1] = {0., 2., 4., 6., 8., 12., 16., 24., 100.}; -auto vecBinsPtCorrelationsDefault = std::vector{binsPtCorrelationsDefault, binsPtCorrelationsDefault + nBinsPtCorrelation + 1}; +const auto vecBinsPtCorrelationsDefault = std::vector{binsPtCorrelationsDefault, binsPtCorrelationsDefault + nBinsPtCorrelation + 1}; const double signalRegionLefBoundDefault[nBinsPtCorrelation] = {0.144, 0.144, 0.144, 0.144, 0.144, 0.144, 0.144, 0.144}; -auto vecSignalRegionLefBoundDefault = std::vector{signalRegionLefBoundDefault, signalRegionLefBoundDefault + nBinsPtCorrelation}; +const auto vecSignalRegionLefBoundDefault = std::vector{signalRegionLefBoundDefault, signalRegionLefBoundDefault + nBinsPtCorrelation}; const double signalRegionRightBoundDefault[nBinsPtCorrelation] = {0.146, 0.146, 0.146, 0.146, 0.146, 0.146, 0.146, 0.146}; -auto vecSignalRegionRightBoundDefault = std::vector{signalRegionRightBoundDefault, signalRegionRightBoundDefault + nBinsPtCorrelation}; +const auto vecSignalRegionRightBoundDefault = std::vector{signalRegionRightBoundDefault, signalRegionRightBoundDefault + nBinsPtCorrelation}; // const double sidebandLeftOuterDefault[nBinsPtCorrelation] = {1.7690, 1.7690, 1.7690, 1.7690, 1.7690, 1.7690, 1.7690, 1.7690}; -// auto vecSidebandLeftOuterDefault = std::vector{sidebandLeftOuterDefault, sidebandLeftOuterDefault + nBinsPtCorrelation}; +// const auto vecSidebandLeftOuterDefault = std::vector{sidebandLeftOuterDefault, sidebandLeftOuterDefault + nBinsPtCorrelation}; // const double sidebandLeftInnerDefault[nBinsPtCorrelation] = {1.8250, 1.8250, 1.8250, 1.8250, 1.8250, 1.8250, 1.8250, 1.8250}; -// auto vecSidebandLeftInnerDefault = std::vector{sidebandLeftInnerDefault, sidebandLeftInnerDefault + nBinsPtCorrelation}; +// const auto vecSidebandLeftInnerDefault = std::vector{sidebandLeftInnerDefault, sidebandLeftInnerDefault + nBinsPtCorrelation}; const double sidebandRightInnerDefault[nBinsPtCorrelation] = {0.147, 0.147, 0.147, 0.147, 0.147, 0.147, 0.147, 0.147}; -auto vecSidebandRightInnerDefault = std::vector{sidebandRightInnerDefault, sidebandRightInnerDefault + nBinsPtCorrelation}; +const auto vecSidebandRightInnerDefault = std::vector{sidebandRightInnerDefault, sidebandRightInnerDefault + nBinsPtCorrelation}; const double sidebandRightOuterDefault[nBinsPtCorrelation] = {0.154, 0.154, 0.154, 0.154, 0.154, 0.154, 0.154, 0.154}; -auto vecSidebandRightOuterDefault = std::vector{sidebandRightOuterDefault, sidebandRightOuterDefault + nBinsPtCorrelation}; +const auto vecSidebandRightOuterDefault = std::vector{sidebandRightOuterDefault, sidebandRightOuterDefault + nBinsPtCorrelation}; const int npTBinsEfficiency = o2::analysis::hf_cuts_dstar_to_d0_pi::NBinsPt; -std::vector vecEfficiencyDstarDefault(npTBinsEfficiency); // line # 76 in taskCorrelationDstarHadron.cxx; why (npTBinsEfficiency+1) ? +const std::vector vecEfficiencyDstarDefault(npTBinsEfficiency); // line # 76 in taskCorrelationDstarHadron.cxx; why (npTBinsEfficiency+1) ? // Dstar-Hadron correlation pair struct HfTaskCorrelationDstarHadrons { @@ -97,11 +97,11 @@ struct HfTaskCorrelationDstarHadrons { { auto axisPtDstar = (std::vector)binsPtEfficiency; - AxisSpec axisSpecPtDstar = {axisPtDstar}; - AxisSpec axisSpecDeltaPhi = {nBinsDeltaPhi, -o2::constants::math::PIHalf, 3. * o2::constants::math::PIHalf}; - AxisSpec axisSpecDeltaEta = {deltaEtaBinEdges}; - AxisSpec axisSpecPtHadron = {ptHadronBinsEdges}; - AxisSpec axisSpecPoolBin = {9, 0., 9.}; + AxisSpec const axisSpecPtDstar = {axisPtDstar}; + AxisSpec const axisSpecDeltaPhi = {nBinsDeltaPhi, -o2::constants::math::PIHalf, 3. * o2::constants::math::PIHalf}; + AxisSpec const axisSpecDeltaEta = {deltaEtaBinEdges}; + AxisSpec const axisSpecPtHadron = {ptHadronBinsEdges}; + AxisSpec const axisSpecPoolBin = {9, 0., 9.}; registry.add("hCorrel2DVsPtSignalRegion", stringDHadron + stringSignal + stringDeltaPhi + stringDeltaEta + stringPtD + stringPtHadron + stringPoolBin + "entries", {HistType::kTHnSparseD, {axisSpecDeltaPhi, axisSpecDeltaEta, axisSpecPtDstar, axisSpecPtHadron, axisSpecPoolBin}}, true); registry.add("hCorrel2DPtIntSignalRegion", stringDHadron + stringSignal + stringDeltaPhi + stringDeltaEta + "entries", {HistType::kTH2D, {axisSpecDeltaPhi, axisSpecDeltaEta}}, true); @@ -116,16 +116,16 @@ struct HfTaskCorrelationDstarHadrons { void processData(aod::DstarHadronPair const& dstarHPairs) { for (const auto& dstarHPair : dstarHPairs) { - float deltaPhi = dstarHPair.deltaPhi(); - float deltaEta = dstarHPair.deltaEta(); - float ptDstar = dstarHPair.ptDstar(); - float ptTrack = dstarHPair.ptTrack(); - int poolBin = dstarHPair.poolBin(); - float deltaM = dstarHPair.deltaM(); - - int effBinPtDstar = o2::analysis::findBin(binsPtEfficiency, ptDstar); + float const deltaPhi = dstarHPair.deltaPhi(); + float const deltaEta = dstarHPair.deltaEta(); + float const ptDstar = dstarHPair.ptDstar(); + float const ptTrack = dstarHPair.ptTrack(); + int const poolBin = dstarHPair.poolBin(); + float const deltaM = dstarHPair.deltaM(); + + int const effBinPtDstar = o2::analysis::findBin(binsPtEfficiency, ptDstar); // LOG(info) << "efficiency index " << effBinPtDstar; - int corrBinPtDstar = o2::analysis::findBin(binsPtCorrelations, ptDstar); + int const corrBinPtDstar = o2::analysis::findBin(binsPtCorrelations, ptDstar); // LOG(info) << "correlation index " << corrBinPtDstar; // reject candidate if outside pT ranges of interst @@ -137,10 +137,10 @@ struct HfTaskCorrelationDstarHadrons { // ptTrack = 10.5; // } float netEfficiencyWeight = 1.0; - float efficiencyWeightTracks = 1.0; + float const efficiencyWeightTracks = 1.0; if (applyEfficiency) { - float efficiencyWeightDstar = efficiencyDstar->at(effBinPtDstar); + float const efficiencyWeightDstar = efficiencyDstar->at(effBinPtDstar); // LOG(info)<<"efficiencyWeightDstar "<{pTBinsCorrelations, pTBinsCorrelations + nPtBinsCorrelations + 1}; +const auto vecBinsPtCorrelations = std::vector{pTBinsCorrelations, pTBinsCorrelations + nPtBinsCorrelations + 1}; const double signalRegionInnerDefault[nPtBinsCorrelations] = {2.269, 2.269, 2.269, 2.269, 2.269, 2.269, 2.269, 2.269}; const double signalRegionOuterDefault[nPtBinsCorrelations] = {2.309, 2.309, 2.309, 2.309, 2.309, 2.309, 2.309, 2.309}; const double sidebandLeftOuterDefault[nPtBinsCorrelations] = {2.209, 2.209, 2.209, 2.209, 2.209, 2.209, 2.209, 2.209}; const double sidebandLeftInnerDefault[nPtBinsCorrelations] = {2.249, 2.249, 2.249, 2.249, 2.249, 2.249, 2.249, 2.249}; const double sidebandRightInnerDefault[nPtBinsCorrelations] = {2.329, 2.329, 2.329, 2.329, 2.329, 2.329, 2.329, 2.329}; const double sidebandRightOuterDefault[nPtBinsCorrelations] = {2.369, 2.369, 2.369, 2.369, 2.369, 2.369, 2.369, 2.369}; -auto vecSignalRegionInner = std::vector{signalRegionInnerDefault, signalRegionInnerDefault + nPtBinsCorrelations}; -auto vecSignalRegionOuter = std::vector{signalRegionOuterDefault, signalRegionOuterDefault + nPtBinsCorrelations}; -auto vecSidebandLeftInner = std::vector{sidebandLeftInnerDefault, sidebandLeftInnerDefault + nPtBinsCorrelations}; -auto vecSidebandLeftOuter = std::vector{sidebandLeftOuterDefault, sidebandLeftOuterDefault + nPtBinsCorrelations}; -auto vecSidebandRightInner = std::vector{sidebandRightInnerDefault, sidebandRightInnerDefault + nPtBinsCorrelations}; -auto vecSidebandRightOuter = std::vector{sidebandRightOuterDefault, sidebandRightOuterDefault + nPtBinsCorrelations}; +const auto vecSignalRegionInner = std::vector{signalRegionInnerDefault, signalRegionInnerDefault + nPtBinsCorrelations}; +const auto vecSignalRegionOuter = std::vector{signalRegionOuterDefault, signalRegionOuterDefault + nPtBinsCorrelations}; +const auto vecSidebandLeftInner = std::vector{sidebandLeftInnerDefault, sidebandLeftInnerDefault + nPtBinsCorrelations}; +const auto vecSidebandLeftOuter = std::vector{sidebandLeftOuterDefault, sidebandLeftOuterDefault + nPtBinsCorrelations}; +const auto vecSidebandRightInner = std::vector{sidebandRightInnerDefault, sidebandRightInnerDefault + nPtBinsCorrelations}; +const auto vecSidebandRightOuter = std::vector{sidebandRightOuterDefault, sidebandRightOuterDefault + nPtBinsCorrelations}; /// Lc-Hadron correlation pair filling task, from pair tables - for real data and data-like analysis (i.e. reco-level w/o matching request via Mc truth) struct HfTaskCorrelationLcHadrons { @@ -197,13 +197,13 @@ struct HfTaskCorrelationLcHadrons { AxisSpec axisMassLc = {binsMassLc, "inv. mass (p K #pi) (GeV/#it{c}^{2})"}; AxisSpec axisPtCorr = {(std::vector)binsPtCorrelations, "#it{p}_{T}^{#Lambda_c} (GeV/#it{c})"}; AxisSpec axisPtLc = {(std::vector)binsPtEfficiencyLc, "#it{p}_{T}^{#Lambda_c} (GeV/#it{c})"}; - AxisSpec axisMultFT0M = {binsMultFT0M, "MultiplicityFT0M"}; + AxisSpec const axisMultFT0M = {binsMultFT0M, "MultiplicityFT0M"}; AxisSpec axisDeltaEta = {binsEta, "#it{#eta}^{Hadron}-#it{#eta}^{#Lambda_c}"}; AxisSpec axisDeltaPhi = {binsPhi, "#it{#varphi}^{Hadron}-#it{#varphi}^{#Lambda_c} (rad)"}; AxisSpec axisPtHadron = {(std::vector)binsPtHadron, "#it{p}_{T}^{Hadron} (GeV/#it{c})"}; AxisSpec axisPoolBin = {binsPoolBin, "poolBin"}; AxisSpec axisLcPrompt = {2, -0.5, 1.5, "Prompt #Lambda_c"}; - AxisSpec axisBdtScore = {binsBdtScore, "Bdt score"}; + AxisSpec const axisBdtScore = {binsBdtScore, "Bdt score"}; AxisSpec axisCorrelationState = {2, 0., 2., ""}; AxisSpec axisSignPair = {4, 1., 5.}; AxisSpec axisCentFT0M = {binsCentFt0m, "Centrality percentile (FT0M)"}; @@ -368,7 +368,7 @@ struct HfTaskCorrelationLcHadrons { hCandidates->GetAxis(2)->SetTitle("Charm hadron origin"); // Loading efficiency histograms from CCDB - if (applyEfficiency && loadAccXEffFromCCDB) { + if ((applyEfficiency != 0) && loadAccXEffFromCCDB) { ccdb->setURL(ccdbUrl); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); @@ -415,11 +415,11 @@ struct HfTaskCorrelationLcHadrons { void processData(LcHadronPairFullWithMl const& pairEntries, aod::LcRecoInfo const& candidates) { for (const auto& candidate : candidates) { - float massLc = candidate.mLc(); - float ptLc = std::abs(candidate.ptLc()); - float bdtScorePrompt = candidate.mlScorePrompt(); - float bdtScoreBkg = candidate.mlScoreBkg(); - int effBinLc = o2::analysis::findBin(binsPtEfficiencyLc, ptLc); + float const massLc = candidate.mLc(); + float const ptLc = std::abs(candidate.ptLc()); + float const bdtScorePrompt = candidate.mlScorePrompt(); + float const bdtScoreBkg = candidate.mlScoreBkg(); + int const effBinLc = o2::analysis::findBin(binsPtEfficiencyLc, ptLc); // reject entries outside Pt ranges of interest if (ptLc < binsPtEfficiencyLc->front() || ptLc > binsPtEfficiencyLc->back()) { @@ -430,7 +430,7 @@ struct HfTaskCorrelationLcHadrons { continue; } double efficiencyWeightLc = 1.; - if (applyEfficiency) { + if (applyEfficiency != 0) { efficiencyWeightLc = 1. / efficiencyLc->at(o2::analysis::findBin(binsPtEfficiencyLc, ptLc)); if (loadAccXEffFromCCDB) { efficiencyWeightLc = 1. / mEfficiencyPrompt->GetBinContent(mEfficiencyPrompt->FindBin(ptLc)); @@ -444,24 +444,24 @@ struct HfTaskCorrelationLcHadrons { for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities - float deltaPhi = pairEntry.deltaPhi(); + float const deltaPhi = pairEntry.deltaPhi(); float cent = 0.; if (useCentrality) { cent = pairEntry.cent(); } - float deltaEta = pairEntry.deltaEta(); - double ptLc = std::abs(pairEntry.ptLc()); - double ptHadron = std::abs(pairEntry.ptHadron()); - float bdtScorePrompt = pairEntry.mlScorePrompt(); - float bdtScoreBkg = pairEntry.mlScoreBkg(); - float trackDcaXY = pairEntry.trackDcaXY(); - float trackDcaZ = pairEntry.trackDcaZ(); - int trackTpcCrossedRows = pairEntry.trackTPCNClsCrossedRows(); - int poolBin = pairEntry.poolBin(); - double massLc = pairEntry.mLc(); - int effBinLc = o2::analysis::findBin(binsPtEfficiencyLc, ptLc); - int ptBinLc = o2::analysis::findBin(binsPtCorrelations, ptLc); - bool isAutoCorrelated = pairEntry.isAutoCorrelated(); + float const deltaEta = pairEntry.deltaEta(); + double const ptLc = std::abs(pairEntry.ptLc()); + double const ptHadron = std::abs(pairEntry.ptHadron()); + float const bdtScorePrompt = pairEntry.mlScorePrompt(); + float const bdtScoreBkg = pairEntry.mlScoreBkg(); + float const trackDcaXY = pairEntry.trackDcaXY(); + float const trackDcaZ = pairEntry.trackDcaZ(); + int const trackTpcCrossedRows = pairEntry.trackTPCNClsCrossedRows(); + int const poolBin = pairEntry.poolBin(); + double const massLc = pairEntry.mLc(); + int const effBinLc = o2::analysis::findBin(binsPtEfficiencyLc, ptLc); + int const ptBinLc = o2::analysis::findBin(binsPtCorrelations, ptLc); + bool const isAutoCorrelated = pairEntry.isAutoCorrelated(); int signPair = 0; // reject entries outside Pt ranges of interest if (ptBinLc < 0 || effBinLc < 0) { @@ -476,7 +476,7 @@ struct HfTaskCorrelationLcHadrons { } double efficiencyWeight = 1.; - if (applyEfficiency) { + if (applyEfficiency != 0) { efficiencyWeight = 1. / (efficiencyLc->at(effBinLc) * efficiencyHad->at(o2::analysis::findBin(binsPtEfficiencyHad, ptHadron))); if (loadAccXEffFromCCDB) { efficiencyWeight = 1. / (mEfficiencyPrompt->GetBinContent(mEfficiencyPrompt->FindBin(ptLc)) * mEfficiencyAssociated->GetBinContent(mEfficiencyAssociated->FindBin(ptHadron))); @@ -488,7 +488,7 @@ struct HfTaskCorrelationLcHadrons { if (ptHadron < leadingParticlePtMin) { continue; } - Region region = getRegion(deltaPhi); + Region const region = getRegion(deltaPhi); switch (region) { case Toward: registry.fill(HIST("hToward"), massLc, ptLc, isAutoCorrelated, efficiencyWeight); @@ -559,22 +559,23 @@ struct HfTaskCorrelationLcHadrons { soa::Join const& candidates) { for (const auto& candidate : candidates) { - float massLc = candidate.mLc(); - float ptLc = std::abs(candidate.ptLc()); - float bdtScorePrompt = candidate.mlScorePrompt(); - float bdtScoreBkg = candidate.mlScoreBkg(); - int effBinLc = o2::analysis::findBin(binsPtEfficiencyLc, ptLc); - bool isLcPrompt = candidate.isPrompt(); + float const massLc = candidate.mLc(); + float const ptLc = std::abs(candidate.ptLc()); + float const bdtScorePrompt = candidate.mlScorePrompt(); + float const bdtScoreBkg = candidate.mlScoreBkg(); + int const effBinLc = o2::analysis::findBin(binsPtEfficiencyLc, ptLc); + bool const isLcPrompt = candidate.isPrompt(); // reject entries outside pT ranges of interest - if (ptLc < binsPtEfficiencyLc->front() || ptLc > binsPtEfficiencyLc->back()) + if (ptLc < binsPtEfficiencyLc->front() || ptLc > binsPtEfficiencyLc->back()) { continue; + } if (bdtScorePrompt < mlOutputPrompt->at(effBinLc) || bdtScoreBkg > mlOutputBkg->at(effBinLc)) { continue; } double efficiencyWeightLc = 1.; - if (applyEfficiency) { + if (applyEfficiency != 0) { if (isLcPrompt) { efficiencyWeightLc = 1. / efficiencyLc->at(effBinLc); if (loadAccXEffFromCCDB) { @@ -601,28 +602,29 @@ struct HfTaskCorrelationLcHadrons { for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities - float deltaPhi = pairEntry.deltaPhi(); - float deltaEta = pairEntry.deltaEta(); - float ptLc = std::abs(pairEntry.ptLc()); - float ptHadron = std::abs(pairEntry.ptHadron()); - float massLc = pairEntry.mLc(); - float bdtScorePrompt = pairEntry.mlScorePrompt(); - float bdtScoreBkg = pairEntry.mlScoreBkg(); - bool isPhysicalPrimary = pairEntry.isPhysicalPrimary(); - float trackDcaXY = pairEntry.trackDcaXY(); - float trackDcaZ = pairEntry.trackDcaZ(); - int trackTpcCrossedRows = pairEntry.trackTPCNClsCrossedRows(); - int statusLcPrompt = static_cast(pairEntry.isPrompt()); - int statusPromptHadron = pairEntry.trackOrigin(); - int poolBin = pairEntry.poolBin(); - int effBinLc = o2::analysis::findBin(binsPtEfficiencyLc, ptLc); - int ptBinLc = o2::analysis::findBin(binsPtCorrelations, ptLc); - bool isAutoCorrelated = pairEntry.isAutoCorrelated(); + float const deltaPhi = pairEntry.deltaPhi(); + float const deltaEta = pairEntry.deltaEta(); + float const ptLc = std::abs(pairEntry.ptLc()); + float const ptHadron = std::abs(pairEntry.ptHadron()); + float const massLc = pairEntry.mLc(); + float const bdtScorePrompt = pairEntry.mlScorePrompt(); + float const bdtScoreBkg = pairEntry.mlScoreBkg(); + bool const isPhysicalPrimary = pairEntry.isPhysicalPrimary(); + float const trackDcaXY = pairEntry.trackDcaXY(); + float const trackDcaZ = pairEntry.trackDcaZ(); + int const trackTpcCrossedRows = pairEntry.trackTPCNClsCrossedRows(); + int const statusLcPrompt = static_cast(pairEntry.isPrompt()); + int const statusPromptHadron = pairEntry.trackOrigin(); + int const poolBin = pairEntry.poolBin(); + int const effBinLc = o2::analysis::findBin(binsPtEfficiencyLc, ptLc); + int const ptBinLc = o2::analysis::findBin(binsPtCorrelations, ptLc); + bool const isAutoCorrelated = pairEntry.isAutoCorrelated(); int signPair = 0; // reject entries outside pT ranges of interest - if (ptLc < binsPtEfficiencyLc->front() || ptLc > binsPtEfficiencyLc->back()) + if (ptLc < binsPtEfficiencyLc->front() || ptLc > binsPtEfficiencyLc->back()) { continue; + } if (bdtScorePrompt < mlOutputPrompt->at(effBinLc) || bdtScoreBkg > mlOutputBkg->at(effBinLc)) { continue; @@ -632,8 +634,8 @@ struct HfTaskCorrelationLcHadrons { } double efficiencyWeight = 1.; - if (applyEfficiency) { - if (statusLcPrompt) { + if (applyEfficiency != 0) { + if (statusLcPrompt != 0) { efficiencyWeight = 1. / (efficiencyLc->at(effBinLc) * efficiencyHad->at(o2::analysis::findBin(binsPtEfficiencyHad, ptHadron))); if (loadAccXEffFromCCDB) { efficiencyWeight = 1. / (mEfficiencyPrompt->GetBinContent(mEfficiencyPrompt->FindBin(ptLc)) * mEfficiencyAssociated->GetBinContent(mEfficiencyAssociated->FindBin(ptHadron))); @@ -651,7 +653,7 @@ struct HfTaskCorrelationLcHadrons { if (ptHadron < leadingParticlePtMin) { continue; } - Region region = getRegion(deltaPhi); + Region const region = getRegion(deltaPhi); switch (region) { case Toward: registry.fill(HIST("hTowardRec"), massLc, ptLc, isAutoCorrelated, efficiencyWeight); @@ -675,7 +677,7 @@ struct HfTaskCorrelationLcHadrons { } // fill correlation plots for signal/bagkground correlations - if (pairEntry.signalStatus()) { + if (pairEntry.signalStatus() != 0) { if (fillSign) { registry.fill(HIST("hCorrel2DVsPtSignSignalMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, signPair, poolBin, efficiencyWeight); } else { @@ -755,14 +757,14 @@ struct HfTaskCorrelationLcHadrons { { for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities - float deltaPhi = pairEntry.deltaPhi(); - float deltaEta = pairEntry.deltaEta(); - float ptLc = std::abs(pairEntry.ptLc()); - float ptHadron = std::abs(pairEntry.ptHadron()); - int poolBin = pairEntry.poolBin(); - int statusPromptHadron = pairEntry.trackOrigin(); - bool isLcPrompt = pairEntry.isPrompt(); - bool isAutoCorrelated = pairEntry.isAutoCorrelated(); + float const deltaPhi = pairEntry.deltaPhi(); + float const deltaEta = pairEntry.deltaEta(); + float const ptLc = std::abs(pairEntry.ptLc()); + float const ptHadron = std::abs(pairEntry.ptHadron()); + int const poolBin = pairEntry.poolBin(); + int const statusPromptHadron = pairEntry.trackOrigin(); + bool const isLcPrompt = pairEntry.isPrompt(); + bool const isAutoCorrelated = pairEntry.isAutoCorrelated(); int signPair = 0; if (isTowardTransverseAway) { @@ -770,7 +772,7 @@ struct HfTaskCorrelationLcHadrons { if (ptHadron < leadingParticlePtMin) { continue; } - Region region = getRegion(deltaPhi); + Region const region = getRegion(deltaPhi); switch (region) { case Toward: registry.fill(HIST("hTowardRec"), o2::constants::physics::MassLambdaCPlus, ptLc, isAutoCorrelated); diff --git a/PWGHF/HFC/Tasks/taskFlow.cxx b/PWGHF/HFC/Tasks/taskFlow.cxx index 7512ff1281f..f3a74f14e79 100644 --- a/PWGHF/HFC/Tasks/taskFlow.cxx +++ b/PWGHF/HFC/Tasks/taskFlow.cxx @@ -16,48 +16,58 @@ /// \author Maja Kabus , CERN #include "PWGCF/Core/CorrelationContainer.h" -#include "PWGCF/Core/PairCuts.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/Utils/utilsPid.h" -#include "PWGMM/Mult/DataModel/Index.h" #include "PWGMM/Mult/DataModel/bestCollisionTable.h" -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/Core/RecoDecay.h" #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/FT0Corrected.h" +#include "Common/DataModel/McCollisionExtra.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "CCDB/BasicCCDBManager.h" -#include "CCDB/CcdbApi.h" -#include "CommonConstants/MathConstants.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DetectorsCommonDataFormats/AlignParam.h" -#include "FT0Base/Geometry.h" -#include "FV0Base/Geometry.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/Logger.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/StepTHn.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/GlobalTrackID.h" - -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include -#include +#include +#include +#include + +#include +#include #include +#include +#include #include +#include #include +#include #include using namespace o2; @@ -214,11 +224,11 @@ struct HfTaskFlow { SliceCache cache; Service pdg; Service ccdb; - std::vector* offsetFT0; - std::vector* offsetFV0; + std::vector* offsetFT0{}; + std::vector* offsetFV0{}; o2::ccdb::CcdbApi ccdbApi; o2::ft0::Geometry ft0Det; - o2::fv0::Geometry* fv0Det; + o2::fv0::Geometry* fv0Det{}; std::vector hfIndexCache; // ========================= @@ -354,17 +364,17 @@ struct HfTaskFlow { OutputObj sameEventHfMc{"sameEventHfMc"}; OutputObj mixedEventHfMc{"mixedEventHfMc"}; - template + template void addHistograms() { - registry.add(Form("%s%s%shEtaTrigger", WhatDataType[dataType].data(), WhatCorrelationCase[correlationCase].data(), WhatParticles[correlatedParticles].data()), "", {HistType::kTH1D, {axisEtaTrigger}}); - registry.add(Form("%s%s%shPhiTrigger", WhatDataType[dataType].data(), WhatCorrelationCase[correlationCase].data(), WhatParticles[correlatedParticles].data()), "", {HistType::kTH1D, {axisPhi}}); - registry.add(Form("%s%s%shPtTrigger", WhatDataType[dataType].data(), WhatCorrelationCase[correlationCase].data(), WhatParticles[correlatedParticles].data()), "", {HistType::kTH1D, {axisPt}}); - registry.add(Form("%s%s%shYieldsTrigger", WhatDataType[dataType].data(), WhatCorrelationCase[correlationCase].data(), WhatParticles[correlatedParticles].data()), "", {HistType::kTH3F, {axisMultiplicity, axisPt, axisEtaTrigger}}); - registry.add(Form("%s%s%shEtaPhiTrigger", WhatDataType[dataType].data(), WhatCorrelationCase[correlationCase].data(), WhatParticles[correlatedParticles].data()), "", {HistType::kTH3F, {axisMultiplicity, axisEtaTrigger, axisPhi}}); - registry.add(Form("%s%s%shEtaAssociated", WhatDataType[dataType].data(), WhatCorrelationCase[correlationCase].data(), WhatParticles[correlatedParticles].data()), "", {HistType::kTH1D, {axisEtaAssociated}}); - registry.add(Form("%s%s%shPhiAssociated", WhatDataType[dataType].data(), WhatCorrelationCase[correlationCase].data(), WhatParticles[correlatedParticles].data()), "", {HistType::kTH1D, {axisPhi}}); - registry.add(Form("%s%s%shEtaPhiAssociated", WhatDataType[dataType].data(), WhatCorrelationCase[correlationCase].data(), WhatParticles[correlatedParticles].data()), "", {HistType::kTH3F, {axisMultiplicity, axisEtaAssociated, axisPhi}}); + registry.add(Form("%s%s%shEtaTrigger", WhatDataType[DataType].data(), WhatCorrelationCase[CorrelationCase].data(), WhatParticles[CorrelatedParticles].data()), "", {HistType::kTH1D, {axisEtaTrigger}}); + registry.add(Form("%s%s%shPhiTrigger", WhatDataType[DataType].data(), WhatCorrelationCase[CorrelationCase].data(), WhatParticles[CorrelatedParticles].data()), "", {HistType::kTH1D, {axisPhi}}); + registry.add(Form("%s%s%shPtTrigger", WhatDataType[DataType].data(), WhatCorrelationCase[CorrelationCase].data(), WhatParticles[CorrelatedParticles].data()), "", {HistType::kTH1D, {axisPt}}); + registry.add(Form("%s%s%shYieldsTrigger", WhatDataType[DataType].data(), WhatCorrelationCase[CorrelationCase].data(), WhatParticles[CorrelatedParticles].data()), "", {HistType::kTH3F, {axisMultiplicity, axisPt, axisEtaTrigger}}); + registry.add(Form("%s%s%shEtaPhiTrigger", WhatDataType[DataType].data(), WhatCorrelationCase[CorrelationCase].data(), WhatParticles[CorrelatedParticles].data()), "", {HistType::kTH3F, {axisMultiplicity, axisEtaTrigger, axisPhi}}); + registry.add(Form("%s%s%shEtaAssociated", WhatDataType[DataType].data(), WhatCorrelationCase[CorrelationCase].data(), WhatParticles[CorrelatedParticles].data()), "", {HistType::kTH1D, {axisEtaAssociated}}); + registry.add(Form("%s%s%shPhiAssociated", WhatDataType[DataType].data(), WhatCorrelationCase[CorrelationCase].data(), WhatParticles[CorrelatedParticles].data()), "", {HistType::kTH1D, {axisPhi}}); + registry.add(Form("%s%s%shEtaPhiAssociated", WhatDataType[DataType].data(), WhatCorrelationCase[CorrelationCase].data(), WhatParticles[CorrelatedParticles].data()), "", {HistType::kTH3F, {axisMultiplicity, axisEtaAssociated, axisPhi}}); } // ========================= @@ -443,16 +453,16 @@ struct HfTaskFlow { // Declaration of correlation containers and their respective axis // ========================= - std::vector corrAxis = {{axisDeltaEta, "#Delta#eta"}, - {axisPtAssoc, "p_{T} (GeV/c)"}, - {axisPtTrigger, "p_{T} (GeV/c)"}, - {axisMultiplicity, "multiplicity"}, - {axisDeltaPhi, "#Delta#varphi (rad)"}, - {axisVertex, "z-vtx (cm)"}}; - std::vector effAxis = {{axisEtaEfficiency, "#eta"}, - {axisPtEfficiency, "p_{T} (GeV/c)"}, - {axisVertexEfficiency, "z-vtx (cm)"}}; - std::vector userAxis = {{axisMass, "m_{inv} (GeV/c^{2})"}}; + std::vector const corrAxis = {{axisDeltaEta, "#Delta#eta"}, + {axisPtAssoc, "p_{T} (GeV/c)"}, + {axisPtTrigger, "p_{T} (GeV/c)"}, + {axisMultiplicity, "multiplicity"}, + {axisDeltaPhi, "#Delta#varphi (rad)"}, + {axisVertex, "z-vtx (cm)"}}; + std::vector const effAxis = {{axisEtaEfficiency, "#eta"}, + {axisPtEfficiency, "p_{T} (GeV/c)"}, + {axisVertexEfficiency, "z-vtx (cm)"}}; + std::vector const userAxis = {{axisMass, "m_{inv} (GeV/c^{2})"}}; fv0Det = o2::fv0::Geometry::instance(o2::fv0::Geometry::eUninitialized); @@ -623,22 +633,22 @@ struct HfTaskFlow { // Quality assessment functions // ========================= - template + template void fillTriggerQa(float multiplicity, float const& eta, float const& phi, float const& pt) { - registry.fill(HIST(WhatDataType[dataType]) + HIST(WhatCorrelationCase[correlationCase]) + HIST(WhatParticles[correlatedParticles]) + HIST("hPtTrigger"), pt); - registry.fill(HIST(WhatDataType[dataType]) + HIST(WhatCorrelationCase[correlationCase]) + HIST(WhatParticles[correlatedParticles]) + HIST("hEtaTrigger"), eta); - registry.fill(HIST(WhatDataType[dataType]) + HIST(WhatCorrelationCase[correlationCase]) + HIST(WhatParticles[correlatedParticles]) + HIST("hPhiTrigger"), phi); - registry.fill(HIST(WhatDataType[dataType]) + HIST(WhatCorrelationCase[correlationCase]) + HIST(WhatParticles[correlatedParticles]) + HIST("hYieldsTrigger"), multiplicity, pt, eta); - registry.fill(HIST(WhatDataType[dataType]) + HIST(WhatCorrelationCase[correlationCase]) + HIST(WhatParticles[correlatedParticles]) + HIST("hEtaPhiTrigger"), multiplicity, eta, phi); + registry.fill(HIST(WhatDataType[DataType]) + HIST(WhatCorrelationCase[CorrelationCase]) + HIST(WhatParticles[CorrelatedParticles]) + HIST("hPtTrigger"), pt); + registry.fill(HIST(WhatDataType[DataType]) + HIST(WhatCorrelationCase[CorrelationCase]) + HIST(WhatParticles[CorrelatedParticles]) + HIST("hEtaTrigger"), eta); + registry.fill(HIST(WhatDataType[DataType]) + HIST(WhatCorrelationCase[CorrelationCase]) + HIST(WhatParticles[CorrelatedParticles]) + HIST("hPhiTrigger"), phi); + registry.fill(HIST(WhatDataType[DataType]) + HIST(WhatCorrelationCase[CorrelationCase]) + HIST(WhatParticles[CorrelatedParticles]) + HIST("hYieldsTrigger"), multiplicity, pt, eta); + registry.fill(HIST(WhatDataType[DataType]) + HIST(WhatCorrelationCase[CorrelationCase]) + HIST(WhatParticles[CorrelatedParticles]) + HIST("hEtaPhiTrigger"), multiplicity, eta, phi); } - template + template void fillAssociatedQa(float multiplicity, float const& eta, float const& phi) { - registry.fill(HIST(WhatDataType[dataType]) + HIST(WhatCorrelationCase[correlationCase]) + HIST(WhatParticles[correlatedParticles]) + HIST("hEtaAssociated"), eta); - registry.fill(HIST(WhatDataType[dataType]) + HIST(WhatCorrelationCase[correlationCase]) + HIST(WhatParticles[correlatedParticles]) + HIST("hPhiAssociated"), phi); - registry.fill(HIST(WhatDataType[dataType]) + HIST(WhatCorrelationCase[correlationCase]) + HIST(WhatParticles[correlatedParticles]) + HIST("hEtaPhiAssociated"), multiplicity, eta, phi); + registry.fill(HIST(WhatDataType[DataType]) + HIST(WhatCorrelationCase[CorrelationCase]) + HIST(WhatParticles[CorrelatedParticles]) + HIST("hEtaAssociated"), eta); + registry.fill(HIST(WhatDataType[DataType]) + HIST(WhatCorrelationCase[CorrelationCase]) + HIST(WhatParticles[CorrelatedParticles]) + HIST("hPhiAssociated"), phi); + registry.fill(HIST(WhatDataType[DataType]) + HIST(WhatCorrelationCase[CorrelationCase]) + HIST(WhatParticles[CorrelatedParticles]) + HIST("hEtaPhiAssociated"), multiplicity, eta, phi); } // ========================= @@ -695,10 +705,10 @@ struct HfTaskFlow { return RecoDecay::phi(chPos.X() + (*offsetFT0)[i].getX(), chPos.Y() + (*offsetFT0)[i].getY()); } - double getPhiFV0(unsigned int chno) + double getPhiFV0(unsigned int chno) const { int cellsInLeft[] = {0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27, 32, 40, 33, 41, 34, 42, 35, 43}; - bool isChnoInLeft = std::find(std::begin(cellsInLeft), std::end(cellsInLeft), chno) != std::end(cellsInLeft); + bool const isChnoInLeft = std::find(std::begin(cellsInLeft), std::end(cellsInLeft), chno) != std::end(cellsInLeft); float offsetX, offsetY; if (isChnoInLeft) { offsetX = (*offsetFV0)[0].getX(); @@ -708,7 +718,7 @@ struct HfTaskFlow { offsetY = (*offsetFV0)[1].getY(); } - o2::fv0::Point3Dsimple chPos; + o2::fv0::Point3Dsimple chPos{}; chPos = fv0Det->getReadoutCenter(chno); // if (configTask.isReadoutCenter) @@ -731,10 +741,10 @@ struct HfTaskFlow { return -std::log(std::tan(0.5 * theta)); } - double getEtaFV0(unsigned int chno) + double getEtaFV0(unsigned int chno) const { int cellsInLeft[] = {0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27, 32, 40, 33, 41, 34, 42, 35, 43}; - bool isChnoInLeft = std::find(std::begin(cellsInLeft), std::end(cellsInLeft), chno) != std::end(cellsInLeft); + bool const isChnoInLeft = std::find(std::begin(cellsInLeft), std::end(cellsInLeft), chno) != std::end(cellsInLeft); float offsetX, offsetY, offsetZ; if (isChnoInLeft) { offsetX = (*offsetFV0)[0].getX(); @@ -746,7 +756,7 @@ struct HfTaskFlow { offsetZ = (*offsetFV0)[1].getZ(); } - o2::fv0::Point3Dsimple chPos; + o2::fv0::Point3Dsimple chPos{}; chPos = fv0Det->getReadoutCenter(chno); // if (configTask.isReadoutCenter) // chPos = fv0Det->getReadoutCenter(chno); @@ -773,7 +783,7 @@ struct HfTaskFlow { registry.fill(HIST("Data/hEventCounter"), EventSelectionStep::AllEvents); } - if (configTask.processMc == false) { + if (!configTask.processMc) { if (!collision.sel8()) { return false; } @@ -973,9 +983,9 @@ struct HfTaskFlow { loopCounter++; - float eta1 = track1.eta(); - float pt1 = track1.pt(); - float phi1 = track1.phi(); + float const eta1 = track1.eta(); + float const pt1 = track1.pt(); + float const phi1 = track1.phi(); // TODO: add getter for NUE trigger efficiency here @@ -1018,7 +1028,7 @@ struct HfTaskFlow { // FILL QA PLOTS for trigger particle if (sameEvent && (step == CorrelationContainer::kCFStepReconstructed)) { - if (configTask.processMc == false) { // If DATA + if (!configTask.processMc) { // If DATA if constexpr (!std::is_same_v) { // IF TPC-TPC case if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-TPC D0-h fillTriggerQa(multiplicity, eta1, phi1, pt1); @@ -1090,8 +1100,8 @@ struct HfTaskFlow { } } - float eta2 = track2.eta(); - float pt2 = track2.pt(); + float const eta2 = track2.eta(); + float const pt2 = track2.pt(); float phi2 = track2.phi(); o2::math_utils::bringTo02Pi(phi2); @@ -1159,9 +1169,9 @@ struct HfTaskFlow { loopCounter++; - float eta1 = track1.eta(); - float pt1 = track1.pt(); - float phi1 = track1.phi(); + float const eta1 = track1.eta(); + float const pt1 = track1.pt(); + float const phi1 = track1.phi(); bool fillingHFcontainer = false; double invmass = 0; @@ -1185,7 +1195,7 @@ struct HfTaskFlow { } // FILL QA PLOTS for trigger particle - if (sameEvent && (cutAmbiguousTracks == false)) { + if (sameEvent && (!cutAmbiguousTracks)) { if constexpr (std::is_same_v) { fillTriggerQa(multiplicity, eta1, phi1, pt1); } else if constexpr (std::is_same_v) { @@ -1243,8 +1253,8 @@ struct HfTaskFlow { } } - float eta2 = reassociatedMftTrack.eta(); - float pt2 = reassociatedMftTrack.pt(); + float const eta2 = reassociatedMftTrack.eta(); + float const pt2 = reassociatedMftTrack.pt(); float phi2 = reassociatedMftTrack.phi(); o2::math_utils::bringTo02Pi(phi2); @@ -1265,7 +1275,7 @@ struct HfTaskFlow { } // FILL QA PLOTS for associated particle - if (sameEvent && (loopCounter == 1) && (cutAmbiguousTracks == false)) { + if (sameEvent && (loopCounter == 1) && (!cutAmbiguousTracks)) { if constexpr (std::is_same_v) { fillAssociatedQa(multiplicity, eta2, phi2); } else if constexpr (std::is_same_v) { @@ -1302,8 +1312,8 @@ struct HfTaskFlow { loopCounter++; - float eta1 = track1.eta(); - float pt1 = track1.pt(); + float const eta1 = track1.eta(); + float const pt1 = track1.pt(); float phi1 = track1.phi(); if constexpr (std::is_same_v) { o2::math_utils::bringTo02Pi(phi1); @@ -1332,7 +1342,7 @@ struct HfTaskFlow { // FILL QA PLOTS for trigger particle if (sameEvent && (step == CorrelationContainer::kCFStepReconstructed)) { - if (configTask.processMc == false) { // If DATA + if (!configTask.processMc) { // If DATA if constexpr (!std::is_same_v) { // If not FilteredMftTracks as trigger -> TPC-FV0a correlations if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-FV0a D0-h if constexpr (std::is_same_v) { // IF NEITHER D0 NOR LC -> @@ -1478,8 +1488,8 @@ struct HfTaskFlow { } } - float eta1 = reassociatedMftTrack.eta(); - float pt1 = reassociatedMftTrack.pt(); + float const eta1 = reassociatedMftTrack.eta(); + float const pt1 = reassociatedMftTrack.pt(); float phi1 = reassociatedMftTrack.phi(); o2::math_utils::bringTo02Pi(phi1); @@ -1567,9 +1577,9 @@ struct HfTaskFlow { // The first one that I call "Data" should work for data and mc rec using BinningTypeData = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getMultiplicity)>; - BinningTypeData binningWithTracksSize{{getMultiplicity}, {binsMixingVertex, binsMixingMultiplicity}, true}; + BinningTypeData const binningWithTracksSize{{getMultiplicity}, {binsMixingVertex, binsMixingMultiplicity}, true}; auto tracksTuple = std::make_tuple(tracks1, tracks2); - Pair pair{binningWithTracksSize, configTask.nMixedEvents, -1, collisions, tracksTuple, &cache}; + Pair const pair{binningWithTracksSize, configTask.nMixedEvents, -1, collisions, tracksTuple, &cache}; for (const auto& [collision1, tracks1, collision2, tracks2] : pair) { @@ -1600,7 +1610,7 @@ struct HfTaskFlow { }; using MixedBinning = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getMultiplicity)>; - MixedBinning binningOnVtxAndMult{{getMultiplicity}, {binsMixingVertex, binsMixingMultiplicity}, true}; + MixedBinning const binningOnVtxAndMult{{getMultiplicity}, {binsMixingVertex, binsMixingMultiplicity}, true}; for (auto const& [collision1, collision2] : soa::selfCombinations(binningOnVtxAndMult, configTask.nMixedEvents, -1, collisions, collisions)) { @@ -1686,9 +1696,9 @@ struct HfTaskFlow { { using BinningTypeMcTruth = FlexibleBinningPolicy, aod::mccollision::PosZ, decltype(getPartsSize)>; - BinningTypeMcTruth binningWithTracksSize{{getPartsSize}, {binsMixingVertex, binsMixingMultiplicity}, true}; + BinningTypeMcTruth const binningWithTracksSize{{getPartsSize}, {binsMixingVertex, binsMixingMultiplicity}, true}; auto tracksTuple = std::make_tuple(tracks1, tracks2); - Pair pair{binningWithTracksSize, configTask.nMixedEvents, -1, mcCollisions, tracksTuple, &cache}; + Pair const pair{binningWithTracksSize, configTask.nMixedEvents, -1, mcCollisions, tracksTuple, &cache}; for (const auto& [collision1, tracks1, collision2, tracks2] : pair) { @@ -1744,8 +1754,9 @@ struct HfTaskFlow { auto fillEventSelectionPlots = true; // When doing reference flow, two cases are used (HF-h, h-h) and thus eventSelectionPlots was filled twice - if (configTask.doReferenceFlow) + if (configTask.doReferenceFlow) { fillEventSelectionPlots = false; + } if (!(isAcceptedCollision(collision, fillEventSelectionPlots))) { return; @@ -1769,8 +1780,9 @@ struct HfTaskFlow { auto fillEventSelectionPlots = true; // When doing reference flow, two cases are used (HF-h, h-h) and thus eventSelectionPlots was filled twice - if (configTask.doReferenceFlow) + if (configTask.doReferenceFlow) { fillEventSelectionPlots = false; + } if (!(isAcceptedCollision(collision, fillEventSelectionPlots))) { return; @@ -1885,8 +1897,9 @@ struct HfTaskFlow { auto fillEventSelectionPlots = true; // When doing reference flow, two cases are used (HF-h, h-h) and thus eventSelectionPlots was filled twice - if (configTask.doReferenceFlow) + if (configTask.doReferenceFlow) { fillEventSelectionPlots = false; + } if (!(isAcceptedCollision(collision, fillEventSelectionPlots))) { return; @@ -1928,8 +1941,9 @@ struct HfTaskFlow { auto fillEventSelectionPlots = true; // When doing reference flow, two cases are used (HF-h, h-h) and thus eventSelectionPlots was filled twice - if (configTask.doReferenceFlow) + if (configTask.doReferenceFlow) { fillEventSelectionPlots = false; + } if (!(isAcceptedCollision(collision, fillEventSelectionPlots))) { return; @@ -2259,7 +2273,7 @@ struct HfTaskFlow { { const auto multiplicity = mcCollision.multMCPVz(); - BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; + BinningPolicyBase<2> const baseBinning{{axisVertex, axisMultiplicity}, true}; sameEventHfMc->fillEvent(multiplicity, CorrelationContainer::kCFStepAll); fillCorrelations(sameEventHfMc, CorrelationContainer::CFStep::kCFStepAll, mcParticles2Prong, mcParticles, multiplicity, mcCollision.posZ(), true); @@ -2276,7 +2290,7 @@ struct HfTaskFlow { { const auto multiplicity = mcCollision.multMCPVz(); - BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; + BinningPolicyBase<2> const baseBinning{{axisVertex, axisMultiplicity}, true}; sameEventHfMc->fillEvent(multiplicity, CorrelationContainer::kCFStepAll); fillCorrelations(sameEventHfMc, CorrelationContainer::CFStep::kCFStepAll, mcParticles3Prong, mcParticles, multiplicity, mcCollision.posZ(), true); diff --git a/PWGHF/HFC/Utils/utilsCorrelations.h b/PWGHF/HFC/Utils/utilsCorrelations.h index 56fc5e435e2..3cbef6ee2de 100644 --- a/PWGHF/HFC/Utils/utilsCorrelations.h +++ b/PWGHF/HFC/Utils/utilsCorrelations.h @@ -59,11 +59,11 @@ Region getRegion(T const deltaPhi) { if (std::abs(deltaPhi) < PhiTowardMax) { return Toward; - } else if (deltaPhi > PhiAwayMin && deltaPhi < PhiAwayMax) { + } + if (deltaPhi > PhiAwayMin && deltaPhi < PhiAwayMax) { return Away; - } else { - return Transverse; } + return Transverse; } // Pair Sign Calculation @@ -99,8 +99,9 @@ bool passPIDSelection(Atrack const& track, SpeciesContainer const mPIDspecies, auto const& pid = mPIDspecies->at(speciesIndex); auto nSigmaTPC = o2::aod::pidutils::tpcNSigma(pid, track); - if (tofForced && !track.hasTOF()) + if (tofForced && !track.hasTOF()) { return false; + } if (speciesIndex == 0) { // First species logic if (std::abs(nSigmaTPC) > maxTPC->at(speciesIndex)) { @@ -139,14 +140,14 @@ bool passPIDSelection(Atrack const& track, SpeciesContainer const mPIDspecies, /// @param[out] massCand Mass of the matched candidate is set here, if a valid match is found /// /// @return `true` if candidate matches expected PDG and decay flag, and mass is set; `false` otherwise -template +template bool matchCandAndMass(McParticleType const& particle, double& massCand) { const auto pdgCand = std::abs(particle.pdgCode()); const auto matchGenFlag = std::abs(particle.flagMcMatchGen()); // Validate PDG code based on candidate type - if (isScCandidate) { + if (IsScCandidate) { if (!(pdgCand == o2::constants::physics::Pdg::kSigmaC0 || pdgCand == o2::constants::physics::Pdg::kSigmaCPlusPlus || pdgCand == o2::constants::physics::Pdg::kSigmaCStar0 || @@ -172,7 +173,7 @@ bool matchCandAndMass(McParticleType const& particle, double& massCand) } case BIT(aod::hf_cand_sigmac::DecayType::ScplusplusToPKPiPi): { - massCand = o2::constants::physics::MassSigmaCStarPlusPlus; + massCand = o2::constants::physics::MassSigmaCPlusPlus; return true; } diff --git a/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx b/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx index e890bbe72d7..0ffff07c55b 100644 --- a/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx +++ b/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx @@ -163,7 +163,7 @@ struct HfElectronSelectionWithTpcEmcal { void init(o2::framework::InitContext&) { - AxisSpec axisPosZ = {binsPosZ, "Pos Z"}; + AxisSpec const axisPosZ = {binsPosZ, "Pos Z"}; AxisSpec axisMass = {binsMass, "Mass (GeV/#it{c}^{2}); entries"}; AxisSpec axisPt = {binsPt, "#it{p_{T}}(GeV/#it{c})"}; AxisSpec axisEta = {binsEta, "#it{#eta}"}; @@ -315,16 +315,16 @@ struct HfElectronSelectionWithTpcEmcal { pdgE2 = kPositron; } - KFPTrack kfpTrack = createKFPTrackFromTrack(electron); - KFPTrack kfpAssociatedTrack = createKFPTrackFromTrack(pTrack); - KFParticle kfTrack(kfpTrack, pdgE1); - KFParticle kfAssociatedTrack(kfpAssociatedTrack, pdgE2); + KFPTrack const kfpTrack = createKFPTrackFromTrack(electron); + KFPTrack const kfpAssociatedTrack = createKFPTrackFromTrack(pTrack); + KFParticle const kfTrack(kfpTrack, pdgE1); + KFParticle const kfAssociatedTrack(kfpAssociatedTrack, pdgE2); const KFParticle* electronPairs[2] = {&kfTrack, &kfAssociatedTrack}; kfNonHfe.SetConstructMethod(2); kfNonHfe.Construct(electronPairs, 2); - int ndf = kfNonHfe.GetNDF(); - double chi2recg = kfNonHfe.GetChi2() / ndf; + int const ndf = kfNonHfe.GetNDF(); + double const chi2recg = kfNonHfe.GetChi2() / ndf; if (ndf < 1.0) { continue; } @@ -373,11 +373,12 @@ struct HfElectronSelectionWithTpcEmcal { hfElectronSelection(electron.collisionId(), electron.globalIndex(), electron.eta(), electron.phi(), electron.pt(), electron.tpcNSigmaEl(), electron.tofNSigmaEl(), nElPairsLS, nElPairsUS, isEMcal); } // Electron Identification - template + template void fillElectronTrack(CollisionType const& collision, TracksType const& tracks, EmcClusterType const& emcClusters, MatchType const& matchedTracks, ParticleType const& /*particlemc*/) { - if (!(isRun3 ? collision.sel8() : (collision.sel7() && collision.alias_bit(kINT7)))) + if (!(isRun3 ? collision.sel8() : (collision.sel7() && collision.alias_bit(kINT7)))) { return; + } registry.fill(HIST("hNevents"), 1); @@ -421,10 +422,12 @@ struct HfElectronSelectionWithTpcEmcal { if (!selTracks(track)) { continue; } - if ((phiTrack > phiTrackEMCalMin && phiTrack < phiTrackEMCalMax) && (etaTrack > etaTrackMin && etaTrack < etaTrackMax)) + if ((phiTrack > phiTrackEMCalMin && phiTrack < phiTrackEMCalMax) && (etaTrack > etaTrackMin && etaTrack < etaTrackMax)) { passEMCal = EMCalAcceptance; // EMcal acceptance passed - if ((phiTrack > phiTrackDCalMin && phiTrack < phiTrackDCalMax) && ((etaTrack > etaTrackDCalPositiveMin && etaTrack < etaTrackDCalPositiveMax) || (etaTrack > etaTrackDCalNegativeMin && etaTrack < etaTrackDCalNegativeMax))) + } + if ((phiTrack > phiTrackDCalMin && phiTrack < phiTrackDCalMax) && ((etaTrack > etaTrackDCalPositiveMin && etaTrack < etaTrackDCalPositiveMax) || (etaTrack > etaTrackDCalNegativeMin && etaTrack < etaTrackDCalNegativeMax))) { passEMCal = DCalAcceptance; // Dcal acceptance passed + } if (fillTrackInfo) { registry.fill(HIST("hTrackEtaPhi"), etaTrack, phiTrack, passEMCal); // track etaphi infor after filter bit @@ -449,7 +452,7 @@ struct HfElectronSelectionWithTpcEmcal { float deltaPhiMatch = -999.; float deltaEtaMatch = -999.; float eop = -999; - bool isEMcal = false; + bool const isEMcal = false; float trackRapidity = track.rapidity(MassElectron); diff --git a/PWGHF/HFL/TableProducer/treeCreatorElectronDCA.cxx b/PWGHF/HFL/TableProducer/treeCreatorElectronDCA.cxx index 1b32608a310..acd38174698 100644 --- a/PWGHF/HFL/TableProducer/treeCreatorElectronDCA.cxx +++ b/PWGHF/HFL/TableProducer/treeCreatorElectronDCA.cxx @@ -94,15 +94,19 @@ struct HfTreeCreatorElectronDCA { registry.get(HIST("hZVertex"))->Fill(collision.posZ()); int pdgCode = 0, absPDGCode = 0, sourcePDG = 0; for (const auto& track : tracks) { - if (!track.trackCutFlagFb3()) + if (!track.trackCutFlagFb3()) { continue; + } registry.get(HIST("hpTTracks"))->Fill(track.pt()); - if (track.pt() < pTMin) + if (track.pt() < pTMin) { continue; - if (std::abs(track.eta()) > etaRange) + } + if (std::abs(track.eta()) > etaRange) { continue; - if (track.mcParticleId() < 1) + } + if (track.mcParticleId() < 1) { continue; + } auto mcTrack = track.mcParticle(); if (std::abs(mcTrack.pdgCode()) == kElectron) { bool isConversion = false; @@ -113,18 +117,19 @@ struct HfTreeCreatorElectronDCA { auto motherTracks = mcTrack.mothers_as(); int numberOfMothers = motherTracks.size(); // Categorise the electron sources - int firstMotherPDG = motherTracks[0].pdgCode(); - if (firstMotherPDG == kGamma) + int const firstMotherPDG = motherTracks[0].pdgCode(); + if (firstMotherPDG == kGamma) { isConversion = true; + } while (numberOfMothers == 1) // loop through all generations { pdgCode = motherTracks[0].pdgCode(); absPDGCode = std::abs(pdgCode); - if (static_cast(absPDGCode / 100) == 4 || static_cast(absPDGCode / 1000) == 4) { + if ((absPDGCode / 100) == 4 || (absPDGCode / 1000) == 4) { isCharm = true; sourcePDG = pdgCode; } - if (static_cast(absPDGCode / 100) == 5 || static_cast(absPDGCode / 1000) == 5) { + if ((absPDGCode / 100) == 5 || (absPDGCode / 1000) == 5) { isBeauty = true; sourcePDG = pdgCode; // already in order, since beauty would decay to charm } @@ -133,10 +138,11 @@ struct HfTreeCreatorElectronDCA { numberOfMothers = motherTracks.size(); } if (!isBeauty && !isCharm) { - if (isConversion) + if (isConversion) { sourcePDG = kGamma; - else + } else { sourcePDG = firstMotherPDG; + } } hfEleTable(track.eta(), track.phi(), track.pt(), sourcePDG, track.dcaXY(), productionRadius); } diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx index 7d06f3f525d..3559f74475a 100644 --- a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -23,7 +23,6 @@ #include "Common/Core/RecoDecay.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/TrackSelectionTables.h" #include "EventFiltering/Zorro.h" @@ -328,19 +327,19 @@ struct HfTaskElectronWeakBoson { { double energySum = 0.0; double isoEnergy = 10.0; - double etaAssCluster = cluster.eta(); - double phiAssCluster = cluster.phi(); + double const etaAssCluster = cluster.eta(); + double const phiAssCluster = cluster.phi(); for (const auto& associateCluster : clusters) { // Calculate angular distances - double dEta = associateCluster.eta() - etaAssCluster; + double const dEta = associateCluster.eta() - etaAssCluster; double dPhi = associateCluster.phi() - phiAssCluster; // Normalize φ difference dPhi = RecoDecay::constrainAngle(dPhi, -o2::constants::math::PI); // Calculate ΔR - double deltaR = std::sqrt(dEta * dEta + dPhi * dPhi); + double const deltaR = std::sqrt(dEta * dEta + dPhi * dPhi); // Sum energy within isolation cone if (deltaR < rIsolation) { @@ -368,11 +367,11 @@ struct HfTaskElectronWeakBoson { for (const auto& track : tracks) { - double dEta = track.eta() - etaEle; + double const dEta = track.eta() - etaEle; double dPhi = track.phi() - phiEle; dPhi = RecoDecay::constrainAngle(dPhi, -o2::constants::math::PI); - double deltaR = std::sqrt(dEta * dEta + dPhi * dPhi); + double const deltaR = std::sqrt(dEta * dEta + dPhi * dPhi); if (deltaR < rIsolation) { trackCount++; @@ -389,7 +388,7 @@ struct HfTaskElectronWeakBoson { return std::make_pair(trackCount - 1, isoMomentum); } - void recoMassZee(KFParticle kfpIsoEle, + void recoMassZee(const KFParticle& kfpIsoEle, int charge, float centrality, TrackEle const& tracks) @@ -418,12 +417,12 @@ struct HfTaskElectronWeakBoson { continue; } - KFPTrack kfpTrackAssEle = createKFPTrackFromTrack(track); - KFParticle kfpAssEle(kfpTrackAssEle, pdgAss); + KFPTrack const kfpTrackAssEle = createKFPTrackFromTrack(track); + KFParticle const kfpAssEle(kfpTrackAssEle, pdgAss); // reco by RecoDecay auto child1 = RecoDecayPtEtaPhi::pVector(kfpIsoEle.GetPt() * correctionPtElectron, kfpIsoEle.GetEta(), kfpIsoEle.GetPhi()); auto child2 = RecoDecayPtEtaPhi::pVector(kfpAssEle.GetPt() * correctionPtElectron, kfpAssEle.GetEta(), kfpAssEle.GetPhi()); - double invMassEE = RecoDecay::m(std::array{child1, child2}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}); + double const invMassEE = RecoDecay::m(std::array{child1, child2}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}); registry.fill(HIST("hInvMassZee"), centrality, track.sign() * charge, kfpIsoEle.GetPt(), invMassEE); @@ -433,7 +432,7 @@ struct HfTaskElectronWeakBoson { zeeKF.SetConstructMethod(kfConstructMethod); zeeKF.Construct(electronPairs, 2); // LOG(info) << "Invarimass cal by KF particle Chi2/NDF = " << zeeKF.GetChi2()/zeeKF.GetNDF(); - float chiSqNdf = zeeKF.GetChi2() / zeeKF.GetNDF(); + float const chiSqNdf = zeeKF.GetChi2() / zeeKF.GetNDF(); if (zeeKF.GetNDF() < 1) { continue; } @@ -470,8 +469,8 @@ struct HfTaskElectronWeakBoson { // Get BC for this collision auto bc = collision.bc_as(); - uint64_t globalBC = bc.globalBC(); - int runNumber = bc.runNumber(); + uint64_t const globalBC = bc.globalBC(); + int const runNumber = bc.runNumber(); // Initialize Zorro for the first event (once per run) static bool isFirstEvent = true; @@ -479,7 +478,7 @@ struct HfTaskElectronWeakBoson { if ((isFirstEvent || runNumber != lastRunNumber) && cfgSkimmedProcessing) { LOGF(info, "Initializing Zorro for run %d", runNumber); - uint64_t currentTimestamp = bc.timestamp(); + uint64_t const currentTimestamp = bc.timestamp(); // debug for timestamp LOGF(info, "Using CCDB path: %s, timestamp: %llu", cfgCCDBPath.value.c_str(), currentTimestamp); @@ -490,12 +489,13 @@ struct HfTaskElectronWeakBoson { lastRunNumber = runNumber; // initialize magnetic field - o2::parameters::GRPMagField* grpo = ccdb->getForTimeStamp(ccdbPathGrpMag, currentTimestamp); + auto* grpo = ccdb->getForTimeStamp(ccdbPathGrpMag, currentTimestamp); o2::base::Propagator::initFieldFromGRP(grpo); - double magneticField = o2::base::Propagator::Instance()->getNominalBz(); + double const magneticField = o2::base::Propagator::Instance()->getNominalBz(); LOG(info) << "magneticField = " << magneticField; - if (magneticField) + if (magneticField != 0.0) { KFParticle::SetField(magneticField); + } } // Check if this is a triggered event using Zorro @@ -610,30 +610,31 @@ struct HfTaskElectronWeakBoson { bool isIsolated = false; bool isIsolatedTr = false; - if (tracksofcluster.size() && isEMCacceptance) { + if ((tracksofcluster.size() != 0) && isEMCacceptance) { int nMatch = 0; for (const auto& match : tracksofcluster) { - if (match.emcalcluster_as().time() < timeEmcMin || match.emcalcluster_as().time() > timeEmcMax) + if (match.emcalcluster_as().time() < timeEmcMin || match.emcalcluster_as().time() > timeEmcMax) { continue; + } - float m02Emc = match.emcalcluster_as().m02(); - float energyEmc = match.emcalcluster_as().energy(); - double phiEmc = match.emcalcluster_as().phi(); - double etaEmc = match.emcalcluster_as().eta(); - double timeEmc = match.emcalcluster_as().time(); + float const m02Emc = match.emcalcluster_as().m02(); + float const energyEmc = match.emcalcluster_as().energy(); + double const phiEmc = match.emcalcluster_as().phi(); + double const etaEmc = match.emcalcluster_as().eta(); + double const timeEmc = match.emcalcluster_as().time(); // LOG(info) << "tr phi0 = " << match.track_as().phi(); // LOG(info) << "tr phi1 = " << track.phi(); // LOG(info) << "emc phi = " << phiEmc; if (nMatch == 0) { - double dEta = match.track_as().trackEtaEmcal() - etaEmc; + double const dEta = match.track_as().trackEtaEmcal() - etaEmc; double dPhi = match.track_as().trackPhiEmcal() - phiEmc; dPhi = RecoDecay::constrainAngle(dPhi, -o2::constants::math::PI); registry.fill(HIST("hMatchPhi"), phiEmc, match.track_as().trackPhiEmcal()); registry.fill(HIST("hMatchEta"), etaEmc, match.track_as().trackEtaEmcal()); - double r = RecoDecay::sqrtSumOfSquares(dPhi, dEta); + double const r = RecoDecay::sqrtSumOfSquares(dPhi, dEta); // LOG(info) << "r match = " << r; if (r < rMin) { rMin = r; @@ -644,8 +645,9 @@ struct HfTaskElectronWeakBoson { registry.fill(HIST("hEMCtime"), timeEmc); registry.fill(HIST("hEnergy"), energyEmc); - if (std::abs(dPhi) > rMatchMax || std::abs(dEta) > rMatchMax) + if (std::abs(dPhi) > rMatchMax || std::abs(dEta) > rMatchMax) { continue; + } registry.fill(HIST("hTrMatchR"), match.track_as().pt(), r); registry.fill(HIST("hEnergyNcell"), energyEmc, match.emcalcluster_as().nCells()); @@ -668,10 +670,12 @@ struct HfTaskElectronWeakBoson { if (match.track_as().tpcNSigmaEl() > nsigTpcMin && match.track_as().tpcNSigmaEl() < nsigTpcMax) { registry.fill(HIST("hEop"), match.track_as().pt(), eop); - if (eop > eopMin && eop < eopMax && isoEnergy < energyIsolationMax) + if (eop > eopMin && eop < eopMax && isoEnergy < energyIsolationMax) { isIsolated = true; - if (eop > eopMin && eop < eopMax && trackCount < trackIsolationMax && isoMomentum < momentumIsolationMax) + } + if (eop > eopMin && eop < eopMax && trackCount < trackIsolationMax && isoMomentum < momentumIsolationMax) { isIsolatedTr = true; + } if (isIsolated && isIsolatedTr) { registry.fill(HIST("hEopIsolation"), match.track_as().pt(), eop); @@ -681,8 +685,8 @@ struct HfTaskElectronWeakBoson { if (match.track_as().sign() > 0) { pdgIso = kPositron; } - KFPTrack kfpTrackIsoEle = createKFPTrackFromTrack(match.track_as()); - KFParticle kfpIsoEle(kfpTrackIsoEle, pdgIso); + KFPTrack const kfpTrackIsoEle = createKFPTrackFromTrack(match.track_as()); + KFParticle const kfpIsoEle(kfpTrackIsoEle, pdgIso); recoMassZee(kfpIsoEle, match.track_as().sign(), centrality, tracks); } // end of pt cut for e from Z @@ -732,7 +736,7 @@ struct HfTaskElectronWeakBoson { } // end of track loop // Z-hadron - if (reconstructedZ.size() > 0) { + if (!reconstructedZ.empty()) { for (const auto& zBoson : reconstructedZ) { // Z boson selection if (zBoson.mass < massZMin || zBoson.mass > massZMax) { @@ -747,23 +751,23 @@ struct HfTaskElectronWeakBoson { continue; } // calculate Z-h correlation - double deltaPhi = RecoDecay::constrainAngle(trackAss.phi - zBoson.phi, -o2::constants::math::PIHalf); - double ptRatio = trackAss.pt / zBoson.pt; + double const deltaPhi = RecoDecay::constrainAngle(trackAss.phi - zBoson.phi, -o2::constants::math::PIHalf); + double const ptRatio = trackAss.pt / zBoson.pt; registry.fill(HIST("hZHadronDphi"), centrality, zBoson.charge, zBoson.pt, deltaPhi, ptRatio, trackAss.pt); } } } // end of Z-hadron correlation // Z->ee QA if (enableZeeRecoQA) { - if (selectedElectronsIso.size() > 0 && selectedPositronsIso.size() > 0) { + if (!selectedElectronsIso.empty() && !selectedPositronsIso.empty()) { // signal for (const auto& trackEle : selectedElectronsIso) { auto child1 = RecoDecayPtEtaPhi::pVector(trackEle.pt, trackEle.eta, trackEle.phi); - float sectorneg = trackEle.phi / o2::constants::math::SectorSpanRad; + float const sectorneg = trackEle.phi / o2::constants::math::SectorSpanRad; for (const auto& trackPos : selectedPositronsIso) { auto child2 = RecoDecayPtEtaPhi::pVector(trackPos.pt, trackPos.eta, trackPos.phi); - double invMass = RecoDecay::m(std::array{child1, child2}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}); - float sectorpos = trackPos.phi / o2::constants::math::SectorSpanRad; + double const invMass = RecoDecay::m(std::array{child1, child2}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}); + float const sectorpos = trackPos.phi / o2::constants::math::SectorSpanRad; if (invMass > massZMinQA) { registry.fill(HIST("hInvMassZeeQA"), invMass, trackEle.pt, trackPos.pt, trackEle.dcaxyTrk, trackPos.dcaxyTrk, trackPos.dcazTrk, trackEle.nclusterTPC, trackPos.nclusterTPC, trackEle.nclusterITS, trackPos.nclusterITS, sectorneg, sectorpos, trackEle.eop, trackPos.eop, trackEle.energyIso, trackPos.energyIso, trackEle.momIso, trackPos.momIso, trackEle.ntrackIso, trackPos.ntrackIso); } @@ -773,12 +777,12 @@ struct HfTaskElectronWeakBoson { for (size_t i = 0; i < selectedElectronsIso.size(); ++i) { const auto& trackEle = selectedElectronsIso[i]; auto child1 = RecoDecayPtEtaPhi::pVector(trackEle.pt, trackEle.eta, trackEle.phi); - float sectorneg = trackEle.phi / o2::constants::math::SectorSpanRad; + float const sectorneg = trackEle.phi / o2::constants::math::SectorSpanRad; for (size_t j = i + 1; j < selectedElectronsIso.size(); ++j) { const auto& trackEle2 = selectedElectronsIso[j]; auto child2 = RecoDecayPtEtaPhi::pVector(trackEle2.pt, trackEle2.eta, trackEle2.phi); - float sectorpos = trackEle2.phi / o2::constants::math::SectorSpanRad; - double invMass = RecoDecay::m(std::array{child1, child2}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}); + float const sectorpos = trackEle2.phi / o2::constants::math::SectorSpanRad; + double const invMass = RecoDecay::m(std::array{child1, child2}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}); if (invMass > massZMinQA) { registry.fill(HIST("hInvMassZeeQAbg"), invMass, trackEle.pt, trackEle2.pt, trackEle.dcaxyTrk, trackEle2.dcaxyTrk, trackEle2.dcazTrk, trackEle.nclusterTPC, trackEle2.nclusterTPC, trackEle.nclusterITS, trackEle2.nclusterITS, sectorneg, sectorpos, trackEle.eop, trackEle2.eop, trackEle.energyIso, trackEle2.energyIso, trackEle.momIso, trackEle2.momIso, trackEle.ntrackIso, trackEle2.ntrackIso); } @@ -788,12 +792,12 @@ struct HfTaskElectronWeakBoson { for (size_t i = 0; i < selectedPositronsIso.size(); ++i) { const auto& trackPos = selectedPositronsIso[i]; auto child1 = RecoDecayPtEtaPhi::pVector(trackPos.pt, trackPos.eta, trackPos.phi); - float sectorneg = trackPos.phi / o2::constants::math::SectorSpanRad; + float const sectorneg = trackPos.phi / o2::constants::math::SectorSpanRad; for (size_t j = i + 1; j < selectedPositronsIso.size(); ++j) { const auto& trackPos2 = selectedPositronsIso[j]; auto child2 = RecoDecayPtEtaPhi::pVector(trackPos2.pt, trackPos2.eta, trackPos2.phi); - float sectorpos = trackPos2.phi / o2::constants::math::SectorSpanRad; - double invMass = RecoDecay::m(std::array{child1, child2}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}); + float const sectorpos = trackPos2.phi / o2::constants::math::SectorSpanRad; + double const invMass = RecoDecay::m(std::array{child1, child2}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}); if (invMass > massZMinQA) { registry.fill(HIST("hInvMassZeeQAbg"), invMass, trackPos.pt, trackPos2.pt, trackPos.dcaxyTrk, trackPos2.dcaxyTrk, trackPos2.dcazTrk, trackPos.nclusterTPC, trackPos2.nclusterTPC, trackPos.nclusterITS, trackPos2.nclusterITS, sectorneg, sectorpos, trackPos.eop, trackPos2.eop, trackPos.energyIso, trackPos2.energyIso, trackPos.momIso, trackPos2.momIso, trackPos.ntrackIso, trackPos2.ntrackIso); } diff --git a/PWGHF/HFL/Tasks/taskMuonCharmBeautySeparation.cxx b/PWGHF/HFL/Tasks/taskMuonCharmBeautySeparation.cxx index 5fca08870fa..818928f5055 100644 --- a/PWGHF/HFL/Tasks/taskMuonCharmBeautySeparation.cxx +++ b/PWGHF/HFL/Tasks/taskMuonCharmBeautySeparation.cxx @@ -35,20 +35,20 @@ struct HfTaskMuonCharmBeautySeparation { void init(InitContext&) { - AxisSpec trackTypeAxis = {6, -0.5, 5.5, "Track Type"}; - AxisSpec ptRecoAxis = {1500, 0, 15, "#it{p}_{T}_{Reco}"}; - AxisSpec dcaxAxis = {1000, -5.0, 5.0, "DCA {x or y} (cm)"}; - AxisSpec dcaAxis = {1000, 0.0, 100.0, "DCA {xy} (cm)"}; - AxisSpec zvtxAxis = {400, -20.0, 20.0, "zvtx (cm)"}; - AxisSpec etaRecoAxis = {150, -5, -2, "#eta_{Reco}"}; - AxisSpec rAbsAxis = {100, 0, 100, "R_{abs}"}; - AxisSpec pdcaAxis = {450, 0, 450, "p_{DCA}"}; - AxisSpec chi2GlobalAxis = {170, -1.5, 150.5, "#chi^{2} global"}; - AxisSpec chi2MCHMFTAxis = {170, -1.5, 150.5, "#chi^{2} MCH-MFT"}; - AxisSpec chi2MCHMIDAxis = {170, -1.5, 150.5, "#chi^{2} MCH-MID"}; + AxisSpec const trackTypeAxis = {6, -0.5, 5.5, "Track Type"}; + AxisSpec const ptRecoAxis = {1500, 0, 15, "#it{p}_{T}_{Reco}"}; + AxisSpec const dcaxAxis = {1000, -5.0, 5.0, "DCA {x or y} (cm)"}; + AxisSpec const dcaAxis = {1000, 0.0, 100.0, "DCA {xy} (cm)"}; + AxisSpec const zvtxAxis = {400, -20.0, 20.0, "zvtx (cm)"}; + AxisSpec const etaRecoAxis = {150, -5, -2, "#eta_{Reco}"}; + AxisSpec const rAbsAxis = {100, 0, 100, "R_{abs}"}; + AxisSpec const pdcaAxis = {450, 0, 450, "p_{DCA}"}; + AxisSpec const chi2GlobalAxis = {170, -1.5, 150.5, "#chi^{2} global"}; + AxisSpec const chi2MCHMFTAxis = {170, -1.5, 150.5, "#chi^{2} MCH-MFT"}; + AxisSpec const chi2MCHMIDAxis = {170, -1.5, 150.5, "#chi^{2} MCH-MID"}; - HistogramConfigSpec HistVariable({HistType::kTHnSparseF, {ptRecoAxis, dcaxAxis, dcaxAxis, dcaAxis, zvtxAxis}}); - registry.add("hBasicDist", "", HistVariable); + HistogramConfigSpec const histVariable({HistType::kTHnSparseF, {ptRecoAxis, dcaxAxis, dcaxAxis, dcaAxis, zvtxAxis}}); + registry.add("hBasicDist", "", histVariable); registry.add("hTrackType", "hTrackType", {HistType::kTH1F, {trackTypeAxis}}); registry.add("hZvtx", "Zvtx in cm", {HistType::kTH1F, {zvtxAxis}}); registry.add("hZvtx_WithMuons", "Zvtx with muons", {HistType::kTH1F, {zvtxAxis}}); @@ -86,8 +86,9 @@ struct HfTaskMuonCharmBeautySeparation { } } registry.fill(HIST("hForwardMultiplicity"), nFwdTracks); - if (nFwdTracks > 0) + if (nFwdTracks > 0) { registry.fill(HIST("hZvtx_WithMuons"), zvtx); + } } }; diff --git a/PWGHF/HFL/Tasks/taskSingleElectron.cxx b/PWGHF/HFL/Tasks/taskSingleElectron.cxx index a19b8c79cb8..b53043cff80 100644 --- a/PWGHF/HFL/Tasks/taskSingleElectron.cxx +++ b/PWGHF/HFL/Tasks/taskSingleElectron.cxx @@ -13,16 +13,26 @@ /// \brief task for electrons from heavy-flavour hadron decays /// \author Jonghan Park (Jeonbuk National University) -#include "Common/Core/RecoDecay.h" #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/TrackSelectionTables.h" #include -#include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include #include +#include + #include using namespace o2; @@ -108,21 +118,21 @@ struct HfTaskSingleElectron { // ConfigurableAxis ConfigurableAxis axisPtEl{"axisPtEl", {VARIABLE_WIDTH, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.75f, 2.0f, 2.25f, 2.5f, 2.75f, 3.f, 3.5f, 4.0f, 5.0f, 6.0f, 8.0f, 10.0f}, "electron pt bins"}; - // AxisSpec - const AxisSpec axisEvt{4, 0., 4., "nEvents"}; - const AxisSpec axisNCont{100, 0., 100., "nCont"}; - const AxisSpec axisPosZ{600, -30., 30., "Z_{pos}"}; - const AxisSpec axisEta{30, -1.5, +1.5, "#eta"}; - const AxisSpec axisP{nBinsP, 0., 15., "p_{T}"}; - const AxisSpec axisPt{nBinsPt, 0., 15., "p_{T}"}; - const AxisSpec axisNsig{800, -20., 20.}; - const AxisSpec axisTrackIp{4000, -0.2, 0.2, "dca"}; - // Histogram registry HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; void init(InitContext const&) { + // AxisSpec + const AxisSpec axisEvt{4, 0., 4., "nEvents"}; + const AxisSpec axisNCont{100, 0., 100., "nCont"}; + const AxisSpec axisPosZ{600, -30., 30., "Z_{pos}"}; + const AxisSpec axisEta{30, -1.5, +1.5, "#eta"}; + const AxisSpec axisP{nBinsP, 0., 15., "p_{T}"}; + const AxisSpec axisPt{nBinsPt, 0., 15., "p_{T}"}; + const AxisSpec axisNsig{800, -20., 20.}; + const AxisSpec axisTrackIp{4000, -0.2, 0.2, "dca"}; + // create histograms histos.add("nEvents", "Number of events", kTH1D, {{1, 0., 1.}}); histos.add("VtxZ", "VtxZ; cm; entries", kTH1D, {axisPosZ}); @@ -237,14 +247,13 @@ struct HfTaskSingleElectron { if (grmothersIdsVec.empty()) { return DirectCharm; - } else { - grmotherPt = mctrack.front().pt(); - grmotherPdg = std::abs(mctrack.front().pdgCode()); - if ((static_cast(grmotherPdg / 100.) % 10) == kBottom || (static_cast(grmotherPdg / 1000.) % 10) == kBottom) { - mpt = grmotherPt; - mpdg = grmotherPdg; - return BeautyCharm; - } + } + grmotherPt = mctrack.front().pt(); + grmotherPdg = std::abs(mctrack.front().pdgCode()); + if ((static_cast(grmotherPdg / 100.) % 10) == kBottom || (static_cast(grmotherPdg / 1000.) % 10) == kBottom) { + mpt = grmotherPt; + mpdg = grmotherPdg; + return BeautyCharm; } } partMother = mctrack; @@ -257,77 +266,86 @@ struct HfTaskSingleElectron { auto const& grmothersIdsVec = mctrack.front().mothersIds(); if (grmothersIdsVec.empty()) { return DirectGamma; - } else { - grmotherPdg = std::abs(mctrack.front().pdgCode()); - mpdg = grmotherPdg; - mpt = mctrack.front().pt(); - - partMother = mctrack; - mctrack = partMother.front().template mothers_as(); - if (mctrack.size()) { - auto const& ggrmothersIdsVec = mctrack.front().mothersIds(); - if (ggrmothersIdsVec.empty()) { - if (grmotherPdg == kPi0) { - return GammaPi0; - } else if (grmotherPdg == kEta) { - return GammaEta; - } else if (grmotherPdg == kOmega) { - return GammaOmega; - } else if (grmotherPdg == kPhi) { - return GammaPhi; - } else if (grmotherPdg == kEtaPrime) { - return GammaEtaPrime; - } else if (grmotherPdg == kRho770_0) { - return GammaRho0; - } else { - return Else; - } - } else { - ggrmotherPdg = mctrack.front().pdgCode(); - ggrmotherPt = mctrack.front().pt(); - mpdg = ggrmotherPdg; - mpt = ggrmotherPt; - if (grmotherPdg == kPi0) { - if (ggrmotherPdg == kK0Short) { - return GammaK0s; - } else if (ggrmotherPdg == kK0Long) { - return GammaK0l; - } else if (ggrmotherPdg == kKPlus) { - return GammaKe3; - } else if (ggrmotherPdg == kLambda0) { - return GammaLambda0; - } else if (ggrmotherPdg == kSigmaPlus) { - return GammaSigma; - } else { - mpdg = grmotherPdg; - mpt = grmotherPt; - return GammaPi0; - } - } else if (grmotherPdg == kEta) { - mpdg = grmotherPdg; - mpt = grmotherPt; - return GammaEta; - } else if (grmotherPdg == kOmega) { - mpdg = grmotherPdg; - mpt = grmotherPt; - return GammaOmega; - } else if (grmotherPdg == kPhi) { - mpdg = grmotherPdg; - mpt = grmotherPt; - return GammaPhi; - } else if (grmotherPdg == kEtaPrime) { - mpdg = grmotherPdg; - mpt = grmotherPt; - return GammaEtaPrime; - } else if (grmotherPdg == kRho770_0) { - mpdg = grmotherPdg; - mpt = grmotherPt; - return GammaRho0; - } else { - return Else; - } + } + grmotherPdg = std::abs(mctrack.front().pdgCode()); + mpdg = grmotherPdg; + mpt = mctrack.front().pt(); + + partMother = mctrack; + mctrack = partMother.front().template mothers_as(); + if (mctrack.size()) { + auto const& ggrmothersIdsVec = mctrack.front().mothersIds(); + if (ggrmothersIdsVec.empty()) { + if (grmotherPdg == kPi0) { + return GammaPi0; + } + if (grmotherPdg == kEta) { + return GammaEta; + } + if (grmotherPdg == kOmega) { + return GammaOmega; } + if (grmotherPdg == kPhi) { + return GammaPhi; + } + if (grmotherPdg == kEtaPrime) { + return GammaEtaPrime; + } + if (grmotherPdg == kRho770_0) { + return GammaRho0; + } + return Else; + } + ggrmotherPdg = mctrack.front().pdgCode(); + ggrmotherPt = mctrack.front().pt(); + mpdg = ggrmotherPdg; + mpt = ggrmotherPt; + if (grmotherPdg == kPi0) { + if (ggrmotherPdg == kK0Short) { + return GammaK0s; + } + if (ggrmotherPdg == kK0Long) { + return GammaK0l; + } + if (ggrmotherPdg == kKPlus) { + return GammaKe3; + } + if (ggrmotherPdg == kLambda0) { + return GammaLambda0; + } + if (ggrmotherPdg == kSigmaPlus) { + return GammaSigma; + } + mpdg = grmotherPdg; + mpt = grmotherPt; + return GammaPi0; } + if (grmotherPdg == kEta) { + mpdg = grmotherPdg; + mpt = grmotherPt; + return GammaEta; + } + if (grmotherPdg == kOmega) { + mpdg = grmotherPdg; + mpt = grmotherPt; + return GammaOmega; + } + if (grmotherPdg == kPhi) { + mpdg = grmotherPdg; + mpt = grmotherPt; + return GammaPhi; + } + if (grmotherPdg == kEtaPrime) { + mpdg = grmotherPdg; + mpt = grmotherPt; + return GammaEtaPrime; + } + if (grmotherPdg == kRho770_0) { + mpdg = grmotherPdg; + mpt = grmotherPt; + return GammaRho0; + } + return Else; } } } else { // check if electron from Dalitz decays @@ -350,46 +368,53 @@ struct HfTaskSingleElectron { return it->second; } return Else; - - } else { - if (motherPdg == kPi0) { - grmotherPt = mctrack.front().pt(); - grmotherPdg = mctrack.front().pdgCode(); - mpt = grmotherPt; - mpdg = grmotherPdg; - if (grmotherPdg == kK0Short) { - return K0s; - } else if (grmotherPdg == kK0Long) { - return K0l; - } else if (grmotherPdg == kKPlus) { - return Ke3; - } else if (grmotherPdg == kLambda0) { - return Lambda0; - } else if (grmotherPdg == kSigmaPlus) { - return Sigma; - } else { - mpt = motherPt; - mpdg = motherPdg; - return Pi0; - } - } else if (motherPdg == kEta) { - return Eta; - } else if (motherPdg == kOmega) { - return Omega; - } else if (motherPdg == kPhi) { - return Phi; - } else if (motherPdg == kEtaPrime) { - return EtaPrime; - } else if (motherPdg == kRho770_0) { - return Rho0; - } else if (motherPdg == kKPlus) { - return Ke3; - } else if (motherPdg == kK0Long) { + } + if (motherPdg == kPi0) { + grmotherPt = mctrack.front().pt(); + grmotherPdg = mctrack.front().pdgCode(); + mpt = grmotherPt; + mpdg = grmotherPdg; + if (grmotherPdg == kK0Short) { + return K0s; + } + if (grmotherPdg == kK0Long) { return K0l; - } else { - return Else; } + if (grmotherPdg == kKPlus) { + return Ke3; + } + if (grmotherPdg == kLambda0) { + return Lambda0; + } + if (grmotherPdg == kSigmaPlus) { + return Sigma; + } + mpt = motherPt; + mpdg = motherPdg; + return Pi0; + } + if (motherPdg == kEta) { + return Eta; + } + if (motherPdg == kOmega) { + return Omega; + } + if (motherPdg == kPhi) { + return Phi; + } + if (motherPdg == kEtaPrime) { + return EtaPrime; + } + if (motherPdg == kRho770_0) { + return Rho0; + } + if (motherPdg == kKPlus) { + return Ke3; + } + if (motherPdg == kK0Long) { + return K0l; } + return Else; } } @@ -399,7 +424,7 @@ struct HfTaskSingleElectron { void processData(soa::Filtered::iterator const& collision, TracksEl const& tracks) { - float flagAnalysedEvt = 0.5; + float const flagAnalysedEvt = 0.5; if (!collision.sel8()) { return; @@ -458,7 +483,7 @@ struct HfTaskSingleElectron { McTracksEl const& tracks, aod::McParticles const&) { - float flagAnalysedEvt = 0.5; + float const flagAnalysedEvt = 0.5; if (!collision.sel8()) { return; @@ -492,7 +517,7 @@ struct HfTaskSingleElectron { int mpdg; // electron source pdg code double mpt; // electron source pt - int source = getElecSource(track, mpt, mpdg); + int const source = getElecSource(track, mpt, mpdg); if (source == DirectBeauty || source == BeautyCharm) { histos.fill(HIST("hPdgB"), mpdg); diff --git a/PWGHF/HFL/Tasks/taskSingleMuon.cxx b/PWGHF/HFL/Tasks/taskSingleMuon.cxx index 9b38f3f45a6..95c6e6d70e8 100644 --- a/PWGHF/HFL/Tasks/taskSingleMuon.cxx +++ b/PWGHF/HFL/Tasks/taskSingleMuon.cxx @@ -88,24 +88,24 @@ struct HfTaskSingleMuon { void init(InitContext&) { - AxisSpec axisPt{200, 0., 200., "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec axisEta{250, -5., 0., "#it{#eta}"}; - AxisSpec axisDCA{500, 0., 5., "#it{DCA}_{xy} (cm)"}; - AxisSpec axisChi2MatchMCHMFT{100, 0., 100., "MCH-MFT matching #chi^{2}"}; - AxisSpec axisSign{5, -2.5, 2.5, "Charge"}; - AxisSpec axisPDca{100000, 0, 100000, "#it{p} #times DCA (GeV/#it{c} * cm)"}; - AxisSpec axisVtxZ{80, -20., 20., "#it{z}_{vtx} (cm)"}; - AxisSpec axisDCAx{1000, -5., 5., "#it{DCA}_{x or y} (cm)"}; - AxisSpec axisPtDif{200, -2., 2., "#it{p}_{T} diff (GeV/#it{c})"}; - AxisSpec axisEtaDif{200, -2., 2., "#it{#eta} diff"}; - AxisSpec axisDeltaPt{60, -30, 30, "#Delta #it{p}_{T} (GeV/#it{c})"}; + AxisSpec const axisPt{200, 0., 200., "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec const axisEta{250, -5., 0., "#it{#eta}"}; + AxisSpec const axisDCA{500, 0., 5., "#it{DCA}_{xy} (cm)"}; + AxisSpec const axisChi2MatchMCHMFT{100, 0., 100., "MCH-MFT matching #chi^{2}"}; + AxisSpec const axisSign{5, -2.5, 2.5, "Charge"}; + AxisSpec const axisPDca{100000, 0, 100000, "#it{p} #times DCA (GeV/#it{c} * cm)"}; + AxisSpec const axisVtxZ{80, -20., 20., "#it{z}_{vtx} (cm)"}; + AxisSpec const axisDCAx{1000, -5., 5., "#it{DCA}_{x or y} (cm)"}; + AxisSpec const axisPtDif{200, -2., 2., "#it{p}_{T} diff (GeV/#it{c})"}; + AxisSpec const axisEtaDif{200, -2., 2., "#it{#eta} diff"}; + AxisSpec const axisDeltaPt{60, -30, 30, "#Delta #it{p}_{T} (GeV/#it{c})"}; - HistogramConfigSpec hTHnMu{HistType::kTHnSparseF, {axisPt, axisEta, axisDCA, axisPDca, axisSign, axisChi2MatchMCHMFT}, 6}; - HistogramConfigSpec h2PtMc{HistType::kTH2F, {axisPt, axisPtDif}}; - HistogramConfigSpec h2EtaMc{HistType::kTH2F, {axisEta, axisEtaDif}}; - HistogramConfigSpec h2DCA{HistType::kTH2F, {axisDCAx, axisDCAx}}; - HistogramConfigSpec h3DeltaPt{HistType::kTH3F, {axisPt, axisEta, axisDeltaPt}}; - HistogramConfigSpec hVtxZ{HistType::kTH1F, {axisVtxZ}}; + HistogramConfigSpec const hTHnMu{HistType::kTHnSparseF, {axisPt, axisEta, axisDCA, axisPDca, axisSign, axisChi2MatchMCHMFT}, 6}; + HistogramConfigSpec const h2PtMc{HistType::kTH2F, {axisPt, axisPtDif}}; + HistogramConfigSpec const h2EtaMc{HistType::kTH2F, {axisEta, axisEtaDif}}; + HistogramConfigSpec const h2DCA{HistType::kTH2F, {axisDCAx, axisDCAx}}; + HistogramConfigSpec const h3DeltaPt{HistType::kTH3F, {axisPt, axisEta, axisDeltaPt}}; + HistogramConfigSpec const hVtxZ{HistType::kTH1F, {axisVtxZ}}; registry.add("hMuBeforeCuts", "", hTHnMu); registry.add("hMuAfterCuts", "", hTHnMu); diff --git a/PWGHF/HFL/Tasks/taskSingleMuonMult.cxx b/PWGHF/HFL/Tasks/taskSingleMuonMult.cxx index b51635dda6b..f755dfac5e2 100644 --- a/PWGHF/HFL/Tasks/taskSingleMuonMult.cxx +++ b/PWGHF/HFL/Tasks/taskSingleMuonMult.cxx @@ -88,25 +88,25 @@ struct HfTaskSingleMuonMult { void init(InitContext&) { - AxisSpec axisCent = {101, -0.5, 100.5, "centrality"}; - AxisSpec axisEvent{NEventSelection, 0, NEventSelection, "Event Selection"}; - AxisSpec axisVtxZ{80, -20., 20., "#it{z}_{vtx} (cm)"}; - AxisSpec axisMuon{NMuonSelection, 0, NMuonSelection, "Muon Selection"}; - AxisSpec axisNCh{500, 0.5, 500.5, "#it{N}_{ch}"}; - AxisSpec axisNMu{20, -0.5, 19.5, "#it{N}_{#mu}"}; - AxisSpec axisPt{1000, 0., 500., "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec axisEta{250, -5., 5., "#it{#eta}"}; - AxisSpec axisTheta{500, 170., 180., "#it{#theta}"}; - AxisSpec axisRAbsorb{1000, 0., 100., "#it{R}_{Absorb} (cm)"}; - AxisSpec axisDCA{500, 0., 5., "#it{DCA}_{xy} (cm)"}; - AxisSpec axisChi2MatchMCHMFT{1000, 0., 1000., "MCH-MFT matching #chi^{2}"}; - AxisSpec axisSign{5, -2.5, 2.5, "Charge"}; - AxisSpec axisPDca{100000, 0, 100000, "#it{p} #times DCA (GeV/#it{c} * cm)"}; - AxisSpec axisDCAx{1000, -5., 5., "#it{DCA}_{x or y} (cm)"}; - AxisSpec axisEtaDif{200, -2., 2., "#it{#eta} diff"}; - AxisSpec axisDeltaPt{10000, -50, 50, "#Delta #it{p}_{T} (GeV/#it{c})"}; - AxisSpec axisTrackType{8, -1.5, 6.5, "TrackType"}; - AxisSpec axisPtDif{200, -2., 2., "#it{p}_{T} diff (GeV/#it{c})"}; + AxisSpec const axisCent = {101, -0.5, 100.5, "centrality"}; + AxisSpec const axisEvent{NEventSelection, 0, NEventSelection, "Event Selection"}; + AxisSpec const axisVtxZ{80, -20., 20., "#it{z}_{vtx} (cm)"}; + AxisSpec const axisMuon{NMuonSelection, 0, NMuonSelection, "Muon Selection"}; + AxisSpec const axisNCh{500, 0.5, 500.5, "#it{N}_{ch}"}; + AxisSpec const axisNMu{20, -0.5, 19.5, "#it{N}_{#mu}"}; + AxisSpec const axisPt{1000, 0., 500., "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec const axisEta{250, -5., 5., "#it{#eta}"}; + AxisSpec const axisTheta{500, 170., 180., "#it{#theta}"}; + AxisSpec const axisRAbsorb{1000, 0., 100., "#it{R}_{Absorb} (cm)"}; + AxisSpec const axisDCA{500, 0., 5., "#it{DCA}_{xy} (cm)"}; + AxisSpec const axisChi2MatchMCHMFT{1000, 0., 1000., "MCH-MFT matching #chi^{2}"}; + AxisSpec const axisSign{5, -2.5, 2.5, "Charge"}; + AxisSpec const axisPDca{100000, 0, 100000, "#it{p} #times DCA (GeV/#it{c} * cm)"}; + AxisSpec const axisDCAx{1000, -5., 5., "#it{DCA}_{x or y} (cm)"}; + AxisSpec const axisEtaDif{200, -2., 2., "#it{#eta} diff"}; + AxisSpec const axisDeltaPt{10000, -50, 50, "#Delta #it{p}_{T} (GeV/#it{c})"}; + AxisSpec const axisTrackType{8, -1.5, 6.5, "TrackType"}; + AxisSpec const axisPtDif{200, -2., 2., "#it{p}_{T} diff (GeV/#it{c})"}; registry.add("hCentrality", "Centrality Percentile", {HistType::kTH1F, {axisCent}}); registry.add("hEventSel", " Number of Events", {HistType::kTH1F, {axisEvent}}); diff --git a/PWGHF/HFL/Tasks/taskSingleMuonReader.cxx b/PWGHF/HFL/Tasks/taskSingleMuonReader.cxx index 52cb12b6f41..0db3d4a3350 100644 --- a/PWGHF/HFL/Tasks/taskSingleMuonReader.cxx +++ b/PWGHF/HFL/Tasks/taskSingleMuonReader.cxx @@ -69,17 +69,17 @@ struct HfTaskSingleMuonReader { void init(InitContext&) { - AxisSpec axisPt{200, 0., 100., "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec axisEta{100, -4., -2., "#it{#eta}"}; - AxisSpec axisDCA{2000, 0., 2., "#it{DCA}_{xy} (cm)"}; - AxisSpec axisChi2MatchMCHMFT{100, 0., 100., "MCH-MFT matching #chi^{2}"}; - AxisSpec axisSign{5, -2.5, 2.5, "Charge"}; - AxisSpec axisRabs{1000, 0, 100, "R at Absorber End (cm)"}; - AxisSpec axisDeltaPt{10000, -50, 50, "#Delta #it{p}_{T} (GeV/#it{c})"}; - AxisSpec axisVtxZ{80, -20., 20., "#it{z}_{vtx} (cm)"}; - - HistogramConfigSpec hTHnMu{HistType::kTHnSparseF, {axisPt, axisEta, axisDCA, axisRabs, axisSign, axisChi2MatchMCHMFT, axisDeltaPt}, 7}; - HistogramConfigSpec hVtxZ{HistType::kTH1F, {axisVtxZ}}; + AxisSpec const axisPt{200, 0., 100., "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec const axisEta{100, -4., -2., "#it{#eta}"}; + AxisSpec const axisDCA{2000, 0., 2., "#it{DCA}_{xy} (cm)"}; + AxisSpec const axisChi2MatchMCHMFT{100, 0., 100., "MCH-MFT matching #chi^{2}"}; + AxisSpec const axisSign{5, -2.5, 2.5, "Charge"}; + AxisSpec const axisRabs{1000, 0, 100, "R at Absorber End (cm)"}; + AxisSpec const axisDeltaPt{10000, -50, 50, "#Delta #it{p}_{T} (GeV/#it{c})"}; + AxisSpec const axisVtxZ{80, -20., 20., "#it{z}_{vtx} (cm)"}; + + HistogramConfigSpec const hTHnMu{HistType::kTHnSparseF, {axisPt, axisEta, axisDCA, axisRabs, axisSign, axisChi2MatchMCHMFT, axisDeltaPt}, 7}; + HistogramConfigSpec const hVtxZ{HistType::kTH1F, {axisVtxZ}}; registry.add("hMuAfterCuts", "", hTHnMu); if (fillMcHist) { @@ -119,10 +119,10 @@ struct HfTaskSingleMuonReader { // histograms after acceptance cuts if (muon.has_matchMCHTrack()) { auto muonType3 = muon.template matchMCHTrack_as(); - auto Dpt = muonType3.pt() - pt; + auto dpt = muonType3.pt() - pt; - singleMuon(pt, dcaXY, Dpt, chi2); - registry.fill(HIST("hMuAfterCuts"), pt, eta, dcaXY, rAbs, charge, chi2, Dpt); + singleMuon(pt, dcaXY, dpt, chi2); + registry.fill(HIST("hMuAfterCuts"), pt, eta, dcaXY, rAbs, charge, chi2, dpt); } } } @@ -156,15 +156,15 @@ struct HfTaskSingleMuonReader { // histograms after acceptance cuts if (muon.has_matchMCHTrack()) { auto muonType3 = muon.template matchMCHTrack_as(); - auto Dpt = muonType3.pt() - pt; + auto dpt = muonType3.pt() - pt; - singleMuon(pt, dcaXY, Dpt, chi2); - registry.fill(HIST("hMuAfterCuts"), pt, eta, dcaXY, rAbs, charge, chi2, Dpt); + singleMuon(pt, dcaXY, dpt, chi2); + registry.fill(HIST("hMuAfterCuts"), pt, eta, dcaXY, rAbs, charge, chi2, dpt); if (muon.mcMask() == 0) { - registry.fill(HIST("hMuAfterCutsTrue"), pt, eta, dcaXY, rAbs, charge, chi2, Dpt); + registry.fill(HIST("hMuAfterCutsTrue"), pt, eta, dcaXY, rAbs, charge, chi2, dpt); } if (muon.mcMask() == 128) { - registry.fill(HIST("hMuAfterCutsFake"), pt, eta, dcaXY, rAbs, charge, chi2, Dpt); + registry.fill(HIST("hMuAfterCutsFake"), pt, eta, dcaXY, rAbs, charge, chi2, dpt); } } } diff --git a/PWGHF/HFL/Tasks/taskSingleMuonReaderAssoc.cxx b/PWGHF/HFL/Tasks/taskSingleMuonReaderAssoc.cxx index 2b43e9ab14f..1185268b0a6 100644 --- a/PWGHF/HFL/Tasks/taskSingleMuonReaderAssoc.cxx +++ b/PWGHF/HFL/Tasks/taskSingleMuonReaderAssoc.cxx @@ -62,17 +62,17 @@ struct HfTaskSingleMuonReaderAssoc { void init(InitContext&) { - AxisSpec axisPt{200, 0., 100., "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec axisEta{100, -4., -2., "#it{#eta}"}; - AxisSpec axisDCA{2000, 0., 2., "#it{DCA}_{xy} (cm)"}; - AxisSpec axisChi2MatchMCHMFT{100, 0., 100., "MCH-MFT matching #chi^{2}"}; - AxisSpec axisSign{5, -2.5, 2.5, "Charge"}; - AxisSpec axisRabs{1000, 0, 100, "R at Absorber End (cm)"}; - AxisSpec axisDeltaPt{10000, -50, 50, "#Delta #it{p}_{T} (GeV/#it{c})"}; - AxisSpec axisVtxZ{80, -20., 20., "#it{z}_{vtx} (cm)"}; - - HistogramConfigSpec hTHnMu{HistType::kTHnSparseF, {axisPt, axisEta, axisDCA, axisRabs, axisSign, axisChi2MatchMCHMFT, axisDeltaPt}, 7}; - HistogramConfigSpec hVtxZ{HistType::kTH1F, {axisVtxZ}}; + AxisSpec const axisPt{200, 0., 100., "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec const axisEta{100, -4., -2., "#it{#eta}"}; + AxisSpec const axisDCA{2000, 0., 2., "#it{DCA}_{xy} (cm)"}; + AxisSpec const axisChi2MatchMCHMFT{100, 0., 100., "MCH-MFT matching #chi^{2}"}; + AxisSpec const axisSign{5, -2.5, 2.5, "Charge"}; + AxisSpec const axisRabs{1000, 0, 100, "R at Absorber End (cm)"}; + AxisSpec const axisDeltaPt{10000, -50, 50, "#Delta #it{p}_{T} (GeV/#it{c})"}; + AxisSpec const axisVtxZ{80, -20., 20., "#it{z}_{vtx} (cm)"}; + + HistogramConfigSpec const hTHnMu{HistType::kTHnSparseF, {axisPt, axisEta, axisDCA, axisRabs, axisSign, axisChi2MatchMCHMFT, axisDeltaPt}, 7}; + HistogramConfigSpec const hVtxZ{HistType::kTH1F, {axisVtxZ}}; registry.add("hMuAfterCuts", "", hTHnMu); if (fillMcHist) { @@ -114,10 +114,10 @@ struct HfTaskSingleMuonReaderAssoc { // histograms after acceptance cuts if (muon.has_matchMCHTrack()) { auto muonType3 = muon.template matchMCHTrack_as(); - auto Dpt = muonType3.pt() - pt; + auto dpt = muonType3.pt() - pt; - singleMuon(pt, dcaXY, Dpt, chi2); - registry.fill(HIST("hMuAfterCuts"), pt, eta, dcaXY, rAbs, charge, chi2, Dpt); + singleMuon(pt, dcaXY, dpt, chi2); + registry.fill(HIST("hMuAfterCuts"), pt, eta, dcaXY, rAbs, charge, chi2, dpt); } } } @@ -154,15 +154,15 @@ struct HfTaskSingleMuonReaderAssoc { // histograms after acceptance cuts if (muon.has_matchMCHTrack()) { auto muonType3 = muon.template matchMCHTrack_as(); - auto Dpt = muonType3.pt() - pt; + auto dpt = muonType3.pt() - pt; - singleMuon(pt, dcaXY, Dpt, chi2); - registry.fill(HIST("hMuAfterCuts"), pt, eta, dcaXY, rAbs, charge, chi2, Dpt); + singleMuon(pt, dcaXY, dpt, chi2); + registry.fill(HIST("hMuAfterCuts"), pt, eta, dcaXY, rAbs, charge, chi2, dpt); if (muon.mcMask() == 0) { - registry.fill(HIST("hMuAfterCutsTrue"), pt, eta, dcaXY, rAbs, charge, chi2, Dpt); + registry.fill(HIST("hMuAfterCutsTrue"), pt, eta, dcaXY, rAbs, charge, chi2, dpt); } if (muon.mcMask() == 128) { - registry.fill(HIST("hMuAfterCutsFake"), pt, eta, dcaXY, rAbs, charge, chi2, Dpt); + registry.fill(HIST("hMuAfterCutsFake"), pt, eta, dcaXY, rAbs, charge, chi2, dpt); } } } diff --git a/PWGHF/HFL/Tasks/taskSingleMuonSource.cxx b/PWGHF/HFL/Tasks/taskSingleMuonSource.cxx index 58f6654ee68..20c3db63117 100644 --- a/PWGHF/HFL/Tasks/taskSingleMuonSource.cxx +++ b/PWGHF/HFL/Tasks/taskSingleMuonSource.cxx @@ -103,17 +103,17 @@ struct HfTaskSingleMuonSource { "Hadron", "Unidentified"}; - AxisSpec axisColNumber{1, 0.5, 1.5, "Selected collisions"}; - AxisSpec axisDCA{5000, 0., 5., "DCA (cm)"}; - AxisSpec axisChi2{500, 0., 100., "#chi^{2} of MCH-MFT matching"}; - AxisSpec axisPt{200, 0., 100., "#it{p}_{T,reco} (GeV/#it{c})"}; - AxisSpec axisDeltaPt{1000, -50., 50., "#Delta #it{p}_{T} (GeV/#it{c})"}; - - HistogramConfigSpec h1ColNumber{HistType::kTH1F, {axisColNumber}}; - HistogramConfigSpec h1Pt{HistType::kTH1F, {axisPt}}; - HistogramConfigSpec h2PtDCA{HistType::kTH2F, {axisPt, axisDCA}}; - HistogramConfigSpec h2PtChi2{HistType::kTH2F, {axisPt, axisChi2}}; - HistogramConfigSpec h2PtDeltaPt{HistType::kTH2F, {axisPt, axisDeltaPt}}; + AxisSpec const axisColNumber{1, 0.5, 1.5, "Selected collisions"}; + AxisSpec const axisDCA{5000, 0., 5., "DCA (cm)"}; + AxisSpec const axisChi2{500, 0., 100., "#chi^{2} of MCH-MFT matching"}; + AxisSpec const axisPt{200, 0., 100., "#it{p}_{T,reco} (GeV/#it{c})"}; + AxisSpec const axisDeltaPt{1000, -50., 50., "#Delta #it{p}_{T} (GeV/#it{c})"}; + + HistogramConfigSpec const h1ColNumber{HistType::kTH1F, {axisColNumber}}; + HistogramConfigSpec const h1Pt{HistType::kTH1F, {axisPt}}; + HistogramConfigSpec const h2PtDCA{HistType::kTH2F, {axisPt, axisDCA}}; + HistogramConfigSpec const h2PtChi2{HistType::kTH2F, {axisPt, axisChi2}}; + HistogramConfigSpec const h2PtDeltaPt{HistType::kTH2F, {axisPt, axisDeltaPt}}; registry.add("h1ColNumber", "", h1ColNumber); for (const auto& src : muonSources) { @@ -146,8 +146,9 @@ struct HfTaskSingleMuonSource { mcPart = *(mcPart.mothers_first_as()); const auto pdgAbs(std::abs(mcPart.pdgCode())); - if (pdgAbs < 10) + if (pdgAbs < 10) { break; // Quark + } if (!mcPart.producedByGenerator()) { // Produced in transport code SETBIT(mask, IsSecondary); @@ -181,8 +182,8 @@ struct HfTaskSingleMuonSource { continue; } - auto pdgData(TDatabasePDG::Instance()->GetParticle(mcPart.pdgCode())); - if (pdgData && !pdgData->AntiParticle()) { + auto* pdgData(TDatabasePDG::Instance()->GetParticle(mcPart.pdgCode())); + if ((pdgData != nullptr) && (pdgData->AntiParticle() == nullptr)) { SETBIT(mask, HasQuarkoniumParent); } else if (flv == 4) { SETBIT(mask, HasCharmParent); diff --git a/PWGHF/Macros/computeFonllPlusPythiaPredictions.C b/PWGHF/Macros/computeFonllPlusPythiaPredictions.C index c112f7f5d24..8b410b2b1e9 100644 --- a/PWGHF/Macros/computeFonllPlusPythiaPredictions.C +++ b/PWGHF/Macros/computeFonllPlusPythiaPredictions.C @@ -40,7 +40,7 @@ #endif -enum Bhadrons { +enum BHadrons { Bplus = 0, Bzero, Bs, @@ -48,7 +48,7 @@ enum Bhadrons { NBeautyHadrons }; -enum Chadrons { +enum CHadrons { Dplus = 0, Dzero, Ds, @@ -180,7 +180,7 @@ void computeFonllPlusPythiaPredictions(int nDecays, int seed, std::string inFile // get histograms from FONLL auto hFonllBhad = readFonll(inFileFonllBhad); - if (!hFonllBhad[0]) { + if (hFonllBhad[0] == nullptr) { return; } @@ -205,12 +205,12 @@ void computeFonllPlusPythiaPredictions(int nDecays, int seed, std::string inFile // initialise histograms for non-prompt charm hadrons std::map, NBeautyHadrons + 1>> hFonllPythiaNonPromptChad{}; for (auto iChad{0}; iChad < NCharmHadrons; ++iChad) { - for (auto iBhad{0}; iBhad < NBeautyHadrons; ++iBhad) { + for (auto iBHad{0}; iBHad < NBeautyHadrons; ++iBHad) { for (auto iFonll{0}; iFonll < 3; ++iFonll) { - hFonllPythiaNonPromptChad[charmHadPdgs[iChad]][iBhad][iFonll] = new TH1D( - Form("hFonll%sFrom%s%s", charmHadNames[iChad].data(), beautyHadNames[iBhad].data(), namesFonll[iFonll].data()), + hFonllPythiaNonPromptChad[charmHadPdgs[iChad]][iBHad][iFonll] = new TH1D( + Form("hFonll%sFrom%s%s", charmHadNames[iChad].data(), beautyHadNames[iBHad].data(), namesFonll[iFonll].data()), ";#it{p}_{T} (GeV/#it{c});d#sigma/d#it{p}_{T} (#it{c}/GeV)", 1000, 0., 100.); - hFonllPythiaNonPromptChad[charmHadPdgs[iChad]][iBhad][iFonll]->Sumw2(); + hFonllPythiaNonPromptChad[charmHadPdgs[iChad]][iBHad][iFonll]->Sumw2(); } } } @@ -240,53 +240,53 @@ void computeFonllPlusPythiaPredictions(int nDecays, int seed, std::string inFile float parBsp2 = -0.00091f + ((iPar == 7 || iPar == 14) ? sign * 0.00025f : 0.f); float parBsAvePt = 10.1f; - for (int iBhad{0}; iBhad < NBeautyHadrons; ++iBhad) { - fragFracFuncs[iBhad][iPar]->SetParameters(parBsA, parBsp1, parBsp2, parBsAvePt, parLbA, parLbp1, parLbp2, parLbp3); + for (int iBHad{0}; iBHad < NBeautyHadrons; ++iBHad) { + fragFracFuncs[iBHad][iPar]->SetParameters(parBsA, parBsp1, parBsp2, parBsAvePt, parLbA, parLbp1, parLbp2, parLbp3); } } } std::array beautyHadMasses{}; for (auto iFonll{0}; iFonll < 3; ++iFonll) { - for (auto iBhad{0}; iBhad < NBeautyHadrons; ++iBhad) { - beautyHadMasses[iBhad] = TDatabasePDG::Instance()->GetParticle(beautyHadPdgs[iBhad])->Mass(); + for (auto iBHad{0}; iBHad < NBeautyHadrons; ++iBHad) { + beautyHadMasses[iBHad] = TDatabasePDG::Instance()->GetParticle(beautyHadPdgs[iBHad])->Mass(); for (auto iDecay{0}; iDecay < nDecays; ++iDecay) { auto ptB = hFonllBhad[iFonll]->GetRandom(); auto yB = gRandom->Uniform(-1., 1.); // we might consider to use more realistic shape from FONLL in the future auto phiB = gRandom->Rndm() * o2::constants::math::TwoPI; auto pxB = ptB * std::cos(phiB); auto pyB = ptB * std::sin(phiB); - auto mtB = std::sqrt(beautyHadMasses[iBhad] * beautyHadMasses[iBhad] + ptB * ptB); + auto mtB = std::sqrt(beautyHadMasses[iBHad] * beautyHadMasses[iBHad] + ptB * ptB); auto pzB = mtB * std::sinh(yB); auto pB = std::sqrt(ptB * ptB + pzB * pzB); - auto eB = std::sqrt(beautyHadMasses[iBhad] * beautyHadMasses[iBhad] + pB * pB); - - Pythia8::Particle Bhad; - Bhad.id(beautyHadPdgs[iBhad]); - Bhad.status(81); - Bhad.m(beautyHadMasses[iBhad]); - Bhad.xProd(0.); - Bhad.yProd(0.); - Bhad.zProd(0.); - Bhad.tProd(0.); - Bhad.e(eB); - Bhad.px(pxB); - Bhad.py(pyB); - Bhad.pz(pzB); + auto eB = std::sqrt(beautyHadMasses[iBHad] * beautyHadMasses[iBHad] + pB * pB); + + Pythia8::Particle bHad; + bHad.id(beautyHadPdgs[iBHad]); + bHad.status(81); + bHad.m(beautyHadMasses[iBHad]); + bHad.xProd(0.); + bHad.yProd(0.); + bHad.zProd(0.); + bHad.tProd(0.); + bHad.e(eB); + bHad.px(pxB); + bHad.py(pyB); + bHad.pz(pzB); pythia.event.reset(); - pythia.event.append(Bhad); + pythia.event.append(bHad); auto idPart = pythia.event[1].id(); pythia.particleData.mayDecay(idPart, true); pythia.moreDecays(); - auto fracB = fragFracs[iBhad]; + auto fracB = fragFracs[iBHad]; if (fragFracOpt == LHCb) { - fracB = fragFracFuncs[iBhad][0]->Eval(ptB > 5.f ? ptB : 5); + fracB = fragFracFuncs[iBHad][0]->Eval(ptB > 5.f ? ptB : 5); } else if (fragFracOpt == LHCbMin) { fracB = 2.f; for (int iPar{0}; iPar < 15; ++iPar) { - auto tmpFrac = fragFracFuncs[iBhad][iPar]->Eval(ptB > 5.f ? ptB : 5); + auto tmpFrac = fragFracFuncs[iBHad][iPar]->Eval(ptB > 5.f ? ptB : 5); if (tmpFrac < fracB) { fracB = tmpFrac; } @@ -294,7 +294,7 @@ void computeFonllPlusPythiaPredictions(int nDecays, int seed, std::string inFile } else if (fragFracOpt == LHCbMax) { fracB = -1.f; for (int iPar{0}; iPar < 15; ++iPar) { - auto tmpFrac = fragFracFuncs[iBhad][iPar]->Eval(ptB > 5.f ? ptB : 5); + auto tmpFrac = fragFracFuncs[iBHad][iPar]->Eval(ptB > 5.f ? ptB : 5); if (tmpFrac > fracB) { fracB = tmpFrac; } @@ -307,7 +307,7 @@ void computeFonllPlusPythiaPredictions(int nDecays, int seed, std::string inFile } auto absPdg = std::abs(pythia.event[iPart].id()); if (std::find(charmHadPdgs.begin(), charmHadPdgs.end(), absPdg) != charmHadPdgs.end()) { // we found a charm hadron, let's fill the corresponding histogram - hFonllPythiaNonPromptChad[absPdg][iBhad][iFonll]->Fill(pythia.event[iPart].pT(), fracB); + hFonllPythiaNonPromptChad[absPdg][iBHad][iFonll]->Fill(pythia.event[iPart].pT(), fracB); } } } @@ -320,9 +320,9 @@ void computeFonllPlusPythiaPredictions(int nDecays, int seed, std::string inFile for (auto iChad{0}; iChad < NCharmHadrons; ++iChad) { hFonllPythiaNonPromptChad[charmHadPdgs[iChad]][NBeautyHadrons][iFonll] = reinterpret_cast(hFonllPythiaNonPromptChad[charmHadPdgs[iChad]][0][iFonll]->Clone(Form("hFonllNonPrompt%s%s", charmHadNames[iChad].data(), namesFonll[iFonll].data()))); hFonllPythiaNonPromptChad[charmHadPdgs[iChad]][NBeautyHadrons][iFonll]->Reset(); - for (auto iBhad{0}; iBhad < NBeautyHadrons; ++iBhad) { - hFonllPythiaNonPromptChad[charmHadPdgs[iChad]][iBhad][iFonll]->Scale(normCrossSec[iFonll] / nDecays); - hFonllPythiaNonPromptChad[charmHadPdgs[iChad]][NBeautyHadrons][iFonll]->Add(hFonllPythiaNonPromptChad[charmHadPdgs[iChad]][iBhad][iFonll]); + for (auto iBHad{0}; iBHad < NBeautyHadrons; ++iBHad) { + hFonllPythiaNonPromptChad[charmHadPdgs[iChad]][iBHad][iFonll]->Scale(normCrossSec[iFonll] / nDecays); + hFonllPythiaNonPromptChad[charmHadPdgs[iChad]][NBeautyHadrons][iFonll]->Add(hFonllPythiaNonPromptChad[charmHadPdgs[iChad]][iBHad][iFonll]); } } } @@ -331,30 +331,30 @@ void computeFonllPlusPythiaPredictions(int nDecays, int seed, std::string inFile for (auto iFonll{0}; iFonll < 3; ++iFonll) { hFonllBhad[iFonll]->Write(); } - auto dirNonPrompt = new TDirectoryFile("NonPrompt", "NonPrompt"); + auto* dirNonPrompt = new TDirectoryFile("NonPrompt", "NonPrompt"); dirNonPrompt->Write(); for (auto iChad{0}; iChad < NCharmHadrons; ++iChad) { dirNonPrompt->cd(); - auto dirCharmHad = new TDirectoryFile(charmHadNames[iChad].data(), charmHadNames[iChad].data()); + auto* dirCharmHad = new TDirectoryFile(charmHadNames[iChad].data(), charmHadNames[iChad].data()); dirCharmHad->Write(); dirCharmHad->cd(); - for (auto iBhad{0}; iBhad < NBeautyHadrons + 1; ++iBhad) { + for (auto iBHad{0}; iBHad < NBeautyHadrons + 1; ++iBHad) { for (auto iFonll{0}; iFonll < 3; ++iFonll) { - hFonllPythiaNonPromptChad[charmHadPdgs[iChad]][iBhad][iFonll]->Write(); + hFonllPythiaNonPromptChad[charmHadPdgs[iChad]][iBHad][iFonll]->Write(); } } } if (addPromptCharmHadrons) { outFile.cd(); - auto dirPrompt = new TDirectoryFile("Prompt", "Prompt"); + auto* dirPrompt = new TDirectoryFile("Prompt", "Prompt"); dirPrompt->Write(); for (auto iChad{0}; iChad < NCharmHadrons; ++iChad) { dirPrompt->cd(); - auto dirCharmHad = new TDirectoryFile(charmHadNames[iChad].data(), charmHadNames[iChad].data()); + auto* dirCharmHad = new TDirectoryFile(charmHadNames[iChad].data(), charmHadNames[iChad].data()); dirCharmHad->Write(); dirCharmHad->cd(); for (auto iFonll{0}; iFonll < 3; ++iFonll) { - if (hFonllPromptChad[charmHadPdgs[iChad]][iFonll]) { + if (hFonllPromptChad[charmHadPdgs[iChad]][iFonll] != nullptr) { hFonllPromptChad[charmHadPdgs[iChad]][iFonll]->Write(); } } diff --git a/PWGHF/TableProducer/candidateCreator2Prong.cxx b/PWGHF/TableProducer/candidateCreator2Prong.cxx index c8bc2bd1274..dc93fc318bc 100644 --- a/PWGHF/TableProducer/candidateCreator2Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator2Prong.cxx @@ -18,10 +18,10 @@ #ifndef HomogeneousField #define HomogeneousField // o2-linter: disable=name/macro (required by KFParticle) -#include "PWGHF/Core/DecayChannels.h" #endif #include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/Core/DecayChannels.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/Utils/utilsBfieldCCDB.h" #include "PWGHF/Utils/utilsEvSelHf.h" @@ -222,7 +222,7 @@ struct HfCandidateCreator2Prong { setLabelHistoCands(hCandidates); } - template + template void runCreator2ProngWithDCAFitterN(Coll const&, CandType const& rowsTrackIndexProng2, TTracks const&, @@ -235,10 +235,10 @@ struct HfCandidateCreator2Prong { auto collision = rowTrackIndexProng2.template collision_as(); float centrality{-1.f}; o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; - if constexpr (applyUpcSel) { - rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, registry, bcs); + if constexpr (ApplyUpcSel) { + rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, registry, bcs); } else { - rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); } if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate @@ -288,8 +288,8 @@ struct HfCandidateCreator2Prong { auto trackParVar1 = df.getTrack(1); // get track momenta - std::array pvec0; - std::array pvec1; + std::array pvec0{}; + std::array pvec1{}; trackParVar0.getPxPyPzGlo(pvec0); trackParVar1.getPxPyPzGlo(pvec1); @@ -297,7 +297,7 @@ struct HfCandidateCreator2Prong { // This modifies track momenta! auto primaryVertex = getPrimaryVertex(collision); auto covMatrixPV = primaryVertex.getCov(); - if constexpr (doPvRefit) { + if constexpr (DoPvRefit) { /// use PV refit /// Using it in the rowCandidateBase all dynamic columns shall take it into account // coordinates @@ -379,7 +379,7 @@ struct HfCandidateCreator2Prong { } } - template + template void runCreator2ProngWithKFParticle(Coll const&, CandType const& rowsTrackIndexProng2, TTracks const&, @@ -392,10 +392,10 @@ struct HfCandidateCreator2Prong { auto collision = rowTrackIndexProng2.template collision_as(); float centrality{-1.f}; o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; - if constexpr (applyUpcSel) { - rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, registry, bcs); + if constexpr (ApplyUpcSel) { + rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, registry, bcs); } else { - rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); } if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate @@ -422,7 +422,7 @@ struct HfCandidateCreator2Prong { KFParticle::SetField(bz); KFPVertex kfpVertex = createKFPVertexFromCollision(collision); - if constexpr (doPvRefit) { + if constexpr (DoPvRefit) { /// use PV refit /// Using it in the rowCandidateBase all dynamic columns shall take it into account // coordinates @@ -431,19 +431,19 @@ struct HfCandidateCreator2Prong { kfpVertex.SetCovarianceMatrix(rowTrackIndexProng2.pvRefitSigmaX2(), rowTrackIndexProng2.pvRefitSigmaXY(), rowTrackIndexProng2.pvRefitSigmaY2(), rowTrackIndexProng2.pvRefitSigmaXZ(), rowTrackIndexProng2.pvRefitSigmaYZ(), rowTrackIndexProng2.pvRefitSigmaZ2()); } kfpVertex.GetCovarianceMatrix(covMatrixPV); - KFParticle kfpV(kfpVertex); + KFParticle const kfpV(kfpVertex); registry.fill(HIST("hCovPVXX"), covMatrixPV[0]); registry.fill(HIST("hCovPVYY"), covMatrixPV[2]); registry.fill(HIST("hCovPVXZ"), covMatrixPV[3]); registry.fill(HIST("hCovPVZZ"), covMatrixPV[5]); - KFPTrack kfpTrack0 = createKFPTrackFromTrack(track0); - KFPTrack kfpTrack1 = createKFPTrackFromTrack(track1); + KFPTrack const kfpTrack0 = createKFPTrackFromTrack(track0); + KFPTrack const kfpTrack1 = createKFPTrackFromTrack(track1); - KFParticle kfPosPion(kfpTrack0, kPiPlus); - KFParticle kfNegPion(kfpTrack1, kPiPlus); - KFParticle kfPosKaon(kfpTrack0, kKPlus); - KFParticle kfNegKaon(kfpTrack1, kKPlus); + KFParticle const kfPosPion(kfpTrack0, kPiPlus); + KFParticle const kfNegPion(kfpTrack1, kPiPlus); + KFParticle const kfPosKaon(kfpTrack0, kKPlus); + KFParticle const kfNegKaon(kfpTrack1, kKPlus); float impactParameter0XY = 0., errImpactParameter0XY = 0., impactParameter1XY = 0., errImpactParameter1XY = 0.; if (!kfPosPion.GetDistanceFromVertexXY(kfpV, impactParameter0XY, errImpactParameter0XY)) { @@ -478,7 +478,7 @@ struct HfCandidateCreator2Prong { registry.fill(HIST("hCovSVXZ"), kfCandD0.Covariance(2, 0)); registry.fill(HIST("hCovSVZZ"), kfCandD0.Covariance(2, 2)); - auto covMatrixSV = kfCandD0.CovarianceMatrix(); + auto* covMatrixSV = kfCandD0.CovarianceMatrix(); double phi, theta; getPointDirection(std::array{kfpV.GetX(), kfpV.GetY(), kfpV.GetZ()}, std::array{kfCandD0.GetX(), kfCandD0.GetY(), kfCandD0.GetZ()}, phi, theta); @@ -857,7 +857,7 @@ struct HfCandidateCreator2ProngExpressions { const auto& workflows = initContext.services().get(); for (const DeviceSpec& device : workflows.devices) { - if (device.name.compare("hf-candidate-creator-2prong") == 0) { + if (device.name == "hf-candidate-creator-2prong") { // init HF event selection helper hfEvSelMc.init(device, registry); break; @@ -866,7 +866,7 @@ struct HfCandidateCreator2ProngExpressions { } /// Performs MC matching. - template + template void runCreator2ProngMc(aod::TracksWMc const& tracks, aod::McParticles const& mcParticles, CCs const& collInfos, @@ -918,7 +918,7 @@ struct HfCandidateCreator2ProngExpressions { // D0(bar) → π+ K−, π+ K− π0, π+ π−, π+ π− π0, K+ K− for (const auto& [channelMain, finalState] : daughtersD0Main) { - std::array arrPdgDaughtersMain2Prongs = std::array{finalState[0], finalState[1]}; + std::array const arrPdgDaughtersMain2Prongs = std::array{finalState[0], finalState[1]}; if (finalState.size() == 3) { // o2-linter: disable=magic-number (partially reconstructed 3-prong decays) if (matchKinkedDecayTopology && matchInteractionsWithMaterial) { indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kD0, arrPdgDaughtersMain2Prongs, true, &sign, FinalStateDepth, &nKinkedTracks, &nInteractionsWithMaterial); @@ -1030,18 +1030,18 @@ struct HfCandidateCreator2ProngExpressions { float centrality{-1.f}; o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; int nSplitColl = 0; - if constexpr (centEstimator == CentralityEstimator::FT0C) { + if constexpr (CentEstimator == CentralityEstimator::FT0C) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); - } else if constexpr (centEstimator == CentralityEstimator::FT0M) { + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + } else if constexpr (CentEstimator == CentralityEstimator::FT0M) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0M, mcCollision.globalIndex()); nSplitColl = collSlice.size(); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); - } else if constexpr (centEstimator == CentralityEstimator::None) { + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + } else if constexpr (CentEstimator == CentralityEstimator::None) { const auto collSlice = collInfos.sliceBy(colPerMcCollision, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } - hfEvSelMc.fillHistograms(mcCollision, rejectionMask, nSplitColl); + hfEvSelMc.fillHistograms(mcCollision, rejectionMask, nSplitColl); if (rejectionMask != 0) { // at least one event selection not satisfied --> reject all particles from this collision for (unsigned int i = 0; i < mcParticlesPerMcColl.size(); ++i) { @@ -1057,9 +1057,9 @@ struct HfCandidateCreator2ProngExpressions { aod::McParticles const& mcParticles, McCollisionsNoCents const& collInfos, aod::McCollisions const& mcCollisions, - BCsInfo const& BCsInfo) + BCsInfo const& bcsInfo) { - runCreator2ProngMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); + runCreator2ProngMc(tracks, mcParticles, collInfos, mcCollisions, bcsInfo); } PROCESS_SWITCH(HfCandidateCreator2ProngExpressions, processMc, "Process MC - no centrality", false); @@ -1067,9 +1067,9 @@ struct HfCandidateCreator2ProngExpressions { aod::McParticles const& mcParticles, McCollisionsFT0Cs const& collInfos, aod::McCollisions const& mcCollisions, - BCsInfo const& BCsInfo) + BCsInfo const& bcsInfo) { - runCreator2ProngMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); + runCreator2ProngMc(tracks, mcParticles, collInfos, mcCollisions, bcsInfo); } PROCESS_SWITCH(HfCandidateCreator2ProngExpressions, processMcCentFT0C, "Process MC - FT0c centrality", false); @@ -1077,9 +1077,9 @@ struct HfCandidateCreator2ProngExpressions { aod::McParticles const& mcParticles, McCollisionsFT0Ms const& collInfos, McCollisionsCentFT0Ms const& mcCollisions, - BCsInfo const& BCsInfo) + BCsInfo const& bcsInfo) { - runCreator2ProngMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); + runCreator2ProngMc(tracks, mcParticles, collInfos, mcCollisions, bcsInfo); } PROCESS_SWITCH(HfCandidateCreator2ProngExpressions, processMcCentFT0M, "Process MC - FT0m centrality", false); }; diff --git a/PWGHF/TableProducer/candidateCreator3Prong.cxx b/PWGHF/TableProducer/candidateCreator3Prong.cxx index a549cd24df7..d2a852eeed9 100644 --- a/PWGHF/TableProducer/candidateCreator3Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator3Prong.cxx @@ -264,7 +264,7 @@ struct HfCandidateCreator3Prong { } } - template + template void runCreator3ProngWithDCAFitterN(Coll const&, Cand const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const&, @@ -277,10 +277,10 @@ struct HfCandidateCreator3Prong { auto collision = rowTrackIndexProng3.template collision_as(); float centrality{-1.f}; o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; - if constexpr (applyUpcSel) { - rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, registry, bcs); + if constexpr (ApplyUpcSel) { + rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, registry, bcs); } else { - rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); } if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate @@ -333,9 +333,9 @@ struct HfCandidateCreator3Prong { trackParVar2 = df.getTrack(2); // get track momenta - std::array pvec0; - std::array pvec1; - std::array pvec2; + std::array pvec0{}; + std::array pvec1{}; + std::array pvec2{}; trackParVar0.getPxPyPzGlo(pvec0); trackParVar1.getPxPyPzGlo(pvec1); trackParVar2.getPxPyPzGlo(pvec2); @@ -344,7 +344,7 @@ struct HfCandidateCreator3Prong { // This modifies track momenta! auto primaryVertex = getPrimaryVertex(collision); auto covMatrixPV = primaryVertex.getCov(); - if constexpr (doPvRefit) { + if constexpr (DoPvRefit) { /// use PV refit /// Using it in the rowCandidateBase all dynamic columns shall take it into account // coordinates @@ -437,7 +437,7 @@ struct HfCandidateCreator3Prong { } } - template + template void runCreator3ProngWithKFParticle(Coll const&, Cand const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const&, @@ -448,10 +448,10 @@ struct HfCandidateCreator3Prong { auto collision = rowTrackIndexProng3.template collision_as(); float centrality{-1.f}; o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; - if constexpr (applyUpcSel) { - rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, registry, bcs); + if constexpr (ApplyUpcSel) { + rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, registry, bcs); } else { - rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); } if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate @@ -479,7 +479,7 @@ struct HfCandidateCreator3Prong { KFParticle::SetField(bz); KFPVertex kfpVertex = createKFPVertexFromCollision(collision); - if constexpr (doPvRefit) { + if constexpr (DoPvRefit) { /// use PV refit /// Using it in the rowCandidateBase all dynamic columns shall take it into account // coordinates @@ -494,17 +494,17 @@ struct HfCandidateCreator3Prong { registry.fill(HIST("hCovPVXZ"), covMatrixPV[3]); registry.fill(HIST("hCovPVZZ"), covMatrixPV[5]); - KFPTrack kfpTrack0 = createKFPTrackFromTrack(track0); - KFPTrack kfpTrack1 = createKFPTrackFromTrack(track1); - KFPTrack kfpTrack2 = createKFPTrackFromTrack(track2); + KFPTrack const kfpTrack0 = createKFPTrackFromTrack(track0); + KFPTrack const kfpTrack1 = createKFPTrackFromTrack(track1); + KFPTrack const kfpTrack2 = createKFPTrackFromTrack(track2); - KFParticle kfFirstProton(kfpTrack0, kProton); - KFParticle kfFirstPion(kfpTrack0, kPiPlus); - KFParticle kfFirstKaon(kfpTrack0, kKPlus); - KFParticle kfSecondKaon(kfpTrack1, kKPlus); - KFParticle kfThirdProton(kfpTrack2, kProton); - KFParticle kfThirdPion(kfpTrack2, kPiPlus); - KFParticle kfThirdKaon(kfpTrack2, kKPlus); + KFParticle const kfFirstProton(kfpTrack0, kProton); + KFParticle const kfFirstPion(kfpTrack0, kPiPlus); + KFParticle const kfFirstKaon(kfpTrack0, kKPlus); + KFParticle const kfSecondKaon(kfpTrack1, kKPlus); + KFParticle const kfThirdProton(kfpTrack2, kProton); + KFParticle const kfThirdPion(kfpTrack2, kPiPlus); + KFParticle const kfThirdKaon(kfpTrack2, kKPlus); float impactParameter0XY = 0., errImpactParameter0XY = 0., impactParameter1XY = 0., errImpactParameter1XY = 0., impactParameter2XY = 0., errImpactParameter2XY = 0.; if (!kfFirstProton.GetDistanceFromVertexXY(kfpV, impactParameter0XY, errImpactParameter0XY)) { @@ -618,7 +618,7 @@ struct HfCandidateCreator3Prong { registry.fill(HIST("hCovSVXZ"), kfCandPKPi.Covariance(2, 0)); registry.fill(HIST("hCovSVZZ"), kfCandPKPi.Covariance(2, 2)); - auto covMatrixSV = kfCandPKPi.CovarianceMatrix(); + auto* covMatrixSV = kfCandPKPi.CovarianceMatrix(); double phi, theta; getPointDirection(std::array{kfpV.GetX(), kfpV.GetY(), kfpV.GetZ()}, std::array{kfCandPKPi.GetX(), kfCandPKPi.GetY(), kfCandPKPi.GetZ()}, phi, theta); auto errorDecayLength = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, theta) + getRotatedCovMatrixXX(covMatrixSV, phi, theta)); @@ -1004,7 +1004,7 @@ struct HfCandidateCreator3ProngExpressions { // inspect for which particle species the candidates were created and which zPvPosMax cut was set for reconstructed const auto& workflows = initContext.services().get(); for (const DeviceSpec& device : workflows.devices) { - if (device.name.compare("hf-candidate-creator-3prong") == 0) { + if (device.name == "hf-candidate-creator-3prong") { // init HF event selection helper hfEvSelMc.init(device, registry); break; @@ -1013,7 +1013,7 @@ struct HfCandidateCreator3ProngExpressions { } /// Performs MC matching. - template + template void runCreator3ProngMc(aod::TracksWMc const& tracks, aod::McParticles const& mcParticles, CCs const& collInfos, @@ -1030,8 +1030,8 @@ struct HfCandidateCreator3ProngExpressions { int8_t swapping = 0; int8_t nKinkedTracks = 0; int8_t nInteractionsWithMaterial = 0; - std::vector arrDaughIndex; - std::array arrPdgDaugResonant; + std::vector arrDaughIndex{}; + std::array arrPdgDaugResonant{}; const std::array arrPdgDaugResonantLcToPKstar0{daughtersLcResonant.at(DecayChannelResonant::LcToPKstar0)}; // Λc± → p± K* const std::array arrPdgDaugResonantLcToDeltaplusplusK{daughtersLcResonant.at(DecayChannelResonant::LcToDeltaplusplusK)}; // Λc± → Δ(1232)±± K∓ const std::array arrPdgDaugResonantLcToL1520Pi{daughtersLcResonant.at(DecayChannelResonant::LcToL1520Pi)}; // Λc± → Λ(1520) π± @@ -1080,7 +1080,7 @@ struct HfCandidateCreator3ProngExpressions { } auto finalStates = getDecayChannelsMain(pdgMother); for (const auto& [channelMain, finalState] : finalStates) { - std::array arrPdgDaughtersMain3Prongs = std::array{finalState[0], finalState[1], finalState[2]}; + std::array const arrPdgDaughtersMain3Prongs = std::array{finalState[0], finalState[1], finalState[2]}; if (finalState.size() > 3) { // o2-linter: disable=magic-number (partially reconstructed decays with 4 or 5 final state particles) if (matchKinkedDecayTopology && matchInteractionsWithMaterial) { indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, pdgMother, arrPdgDaughtersMain3Prongs, true, &sign, depthMainMax, &nKinkedTracks, &nInteractionsWithMaterial); @@ -1108,7 +1108,7 @@ struct HfCandidateCreator3ProngExpressions { } } } - } else if (finalState.size() == 3) { // o2-linter: disable=magic-number(fully reconstructed 3-prong decays) + } else if (finalState.size() == 3) { // o2-linter: disable=magic-number (fully reconstructed 3-prong decays) if (matchKinkedDecayTopology && matchInteractionsWithMaterial) { indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, pdgMother, arrPdgDaughtersMain3Prongs, true, &sign, depthMainMax, &nKinkedTracks, &nInteractionsWithMaterial); } else if (matchKinkedDecayTopology && !matchInteractionsWithMaterial) { @@ -1137,8 +1137,8 @@ struct HfCandidateCreator3ProngExpressions { if (pdgMother == Pdg::kDStar) { std::vector arrResoDaughIndexDstar = {}; RecoDecay::getDaughters(mcParticles.rawIteratorAt(indexRec), &arrResoDaughIndexDstar, std::array{0}, DepthResoMax); - for (size_t iDaug = 0; iDaug < arrResoDaughIndexDstar.size(); iDaug++) { - auto daughDstar = mcParticles.rawIteratorAt(arrResoDaughIndexDstar[iDaug]); + for (const int iDaug : arrResoDaughIndexDstar) { // o2-linter: disable=const-ref-in-for-loop (int elements) + auto daughDstar = mcParticles.rawIteratorAt(iDaug); if (std::abs(daughDstar.pdgCode()) == Pdg::kD0 || std::abs(daughDstar.pdgCode()) == Pdg::kDPlus) { RecoDecay::getDaughters(daughDstar, &arrResoDaughIndex, std::array{0}, DepthResoMax); break; @@ -1318,18 +1318,18 @@ struct HfCandidateCreator3ProngExpressions { float centrality{-1.f}; o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; int nSplitColl = 0; - if constexpr (centEstimator == CentralityEstimator::FT0C) { + if constexpr (CentEstimator == CentralityEstimator::FT0C) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); - } else if constexpr (centEstimator == CentralityEstimator::FT0M) { + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + } else if constexpr (CentEstimator == CentralityEstimator::FT0M) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0M, mcCollision.globalIndex()); nSplitColl = collSlice.size(); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); - } else if constexpr (centEstimator == CentralityEstimator::None) { + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + } else if constexpr (CentEstimator == CentralityEstimator::None) { const auto collSlice = collInfos.sliceBy(colPerMcCollision, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } - hfEvSelMc.fillHistograms(mcCollision, rejectionMask, nSplitColl); + hfEvSelMc.fillHistograms(mcCollision, rejectionMask, nSplitColl); if (rejectionMask != 0) { // at least one event selection not satisfied --> reject all gen particles from this collision for (unsigned int i = 0; i < mcParticlesPerMcColl.size(); ++i) { @@ -1345,9 +1345,9 @@ struct HfCandidateCreator3ProngExpressions { aod::McParticles const& mcParticles, McCollisionsNoCents const& collInfos, aod::McCollisions const& mcCollisions, - BCsInfo const& BCsInfo) + BCsInfo const& bcsInfo) { - runCreator3ProngMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); + runCreator3ProngMc(tracks, mcParticles, collInfos, mcCollisions, bcsInfo); } PROCESS_SWITCH(HfCandidateCreator3ProngExpressions, processMc, "Process MC - no centrality", false); @@ -1355,9 +1355,9 @@ struct HfCandidateCreator3ProngExpressions { aod::McParticles const& mcParticles, McCollisionsFT0Cs const& collInfos, aod::McCollisions const& mcCollisions, - BCsInfo const& BCsInfo) + BCsInfo const& bcsInfo) { - runCreator3ProngMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); + runCreator3ProngMc(tracks, mcParticles, collInfos, mcCollisions, bcsInfo); } PROCESS_SWITCH(HfCandidateCreator3ProngExpressions, processMcCentFT0C, "Process MC - FT0c centrality", false); @@ -1365,9 +1365,9 @@ struct HfCandidateCreator3ProngExpressions { aod::McParticles const& mcParticles, McCollisionsFT0Ms const& collInfos, McCollisionsCentFT0Ms const& mcCollisions, - BCsInfo const& BCsInfo) + BCsInfo const& bcsInfo) { - runCreator3ProngMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); + runCreator3ProngMc(tracks, mcParticles, collInfos, mcCollisions, bcsInfo); } PROCESS_SWITCH(HfCandidateCreator3ProngExpressions, processMcCentFT0M, "Process MC - FT0m centrality", false); }; diff --git a/PWGHF/TableProducer/candidateCreatorB0.cxx b/PWGHF/TableProducer/candidateCreatorB0.cxx index a2751e9f3eb..5097623643f 100644 --- a/PWGHF/TableProducer/candidateCreatorB0.cxx +++ b/PWGHF/TableProducer/candidateCreatorB0.cxx @@ -98,9 +98,9 @@ struct HfCandidateCreatorB0 { HfHelper hfHelper; Service ccdb; - o2::base::MatLayerCylSet* lut; + o2::base::MatLayerCylSet* lut{}; o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; - int runNumber; + int runNumber{}; double massPi{0.}; double massD{0.}; @@ -288,14 +288,14 @@ struct HfCandidateCreatorB0 { df3.getTrack(2).getPxPyPzGlo(pVec2); // D∓ → π∓ K± π∓ - std::array pVecPiK = RecoDecay::pVec(pVec0, pVec1); + std::array const pVecPiK = RecoDecay::pVec(pVec0, pVec1); std::array pVecD = RecoDecay::pVec(pVec0, pVec1, pVec2); auto trackParCovPiK = o2::dataformats::V0(df3.getPCACandidatePos(), pVecPiK, df3.calcPCACovMatrixFlat(), trackParCov0, trackParCov1); auto trackParCovD = o2::dataformats::V0(df3.getPCACandidatePos(), pVecD, df3.calcPCACovMatrixFlat(), trackParCovPiK, trackParCov2); - int indexTrack0 = track0.globalIndex(); - int indexTrack1 = track1.globalIndex(); - int indexTrack2 = track2.globalIndex(); + int const indexTrack0 = track0.globalIndex(); + int const indexTrack1 = track1.globalIndex(); + int const indexTrack2 = track2.globalIndex(); auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); @@ -438,7 +438,7 @@ struct HfCandidateCreatorB0Expressions { } // B0 → Ds- π+ → (K- K+ π-) π+ - if (!flagChannelMain) { + if (flagChannelMain == 0) { indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersB0, Pdg::kB0, std::array{-kKPlus, +kKPlus, -kPiPlus, +kPiPlus}, true, &sign, 3); if (indexRec > -1) { // Ds- → K- K+ π- @@ -451,19 +451,19 @@ struct HfCandidateCreatorB0Expressions { // Partly reconstructed decays, i.e. the 4 prongs have a common b-hadron ancestor // convention: final state particles are prong0,1,2,3 - if (!flagChannelMain) { + if (flagChannelMain == 0) { auto particleProng0 = arrayDaughtersB0[0].mcParticle(); auto particleProng1 = arrayDaughtersB0[1].mcParticle(); auto particleProng2 = arrayDaughtersB0[2].mcParticle(); auto particleProng3 = arrayDaughtersB0[3].mcParticle(); // b-hadron hypothesis - std::array bHadronMotherHypos = {Pdg::kB0, Pdg::kBS, Pdg::kLambdaB0}; + std::array const bHadronMotherHypos = {Pdg::kB0, Pdg::kBS, Pdg::kLambdaB0}; for (const auto& bHadronMotherHypo : bHadronMotherHypos) { - int index0Mother = RecoDecay::getMother(mcParticles, particleProng0, bHadronMotherHypo, true); - int index1Mother = RecoDecay::getMother(mcParticles, particleProng1, bHadronMotherHypo, true); - int index2Mother = RecoDecay::getMother(mcParticles, particleProng2, bHadronMotherHypo, true); - int index3Mother = RecoDecay::getMother(mcParticles, particleProng3, bHadronMotherHypo, true); + int const index0Mother = RecoDecay::getMother(mcParticles, particleProng0, bHadronMotherHypo, true); + int const index1Mother = RecoDecay::getMother(mcParticles, particleProng1, bHadronMotherHypo, true); + int const index2Mother = RecoDecay::getMother(mcParticles, particleProng2, bHadronMotherHypo, true); + int const index3Mother = RecoDecay::getMother(mcParticles, particleProng3, bHadronMotherHypo, true); // look for common b-hadron ancestor if (index0Mother > -1 && index0Mother == index1Mother && index1Mother == index2Mother && index2Mother == index3Mother) { diff --git a/PWGHF/TableProducer/candidateCreatorBplus.cxx b/PWGHF/TableProducer/candidateCreatorBplus.cxx index f3cc0baa11e..8dcefe55c9c 100644 --- a/PWGHF/TableProducer/candidateCreatorBplus.cxx +++ b/PWGHF/TableProducer/candidateCreatorBplus.cxx @@ -106,9 +106,9 @@ struct HfCandidateCreatorBplus { HfHelper hfHelper; Service ccdb; - o2::base::MatLayerCylSet* lut; + o2::base::MatLayerCylSet* lut{}; o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; - int runNumber; + int runNumber{}; double invMass2D0PiMin{0.}; double invMass2D0PiMax{0.}; @@ -268,13 +268,13 @@ struct HfCandidateCreatorBplus { df.getTrack(0).getPxPyPzGlo(pVec0); df.getTrack(1).getPxPyPzGlo(pVec1); // Get D0 momentum - std::array pVecD = RecoDecay::pVec(pVec0, pVec1); + std::array const pVecD = RecoDecay::pVec(pVec0, pVec1); // build a D0 neutral track auto trackD0 = o2::dataformats::V0(vertexD0, pVecD, df.calcPCACovMatrixFlat(), trackParCovProng0, trackParCovProng1); - int indexTrack0 = prong0.globalIndex(); - int indexTrack1 = prong1.globalIndex(); + int const indexTrack0 = prong0.globalIndex(); + int const indexTrack1 = prong1.globalIndex(); auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); @@ -288,7 +288,7 @@ struct HfCandidateCreatorBplus { } // Select D0pi- and D0(bar)pi+ pairs only - if (!((candD0.isSelD0() >= selectionFlagD0 && trackPion.sign() < 0) || (candD0.isSelD0bar() >= selectionFlagD0bar && trackPion.sign() > 0))) { + if ((candD0.isSelD0() < selectionFlagD0 || trackPion.sign() >= 0) && (candD0.isSelD0bar() < selectionFlagD0bar || trackPion.sign() <= 0)) { // LOGF(debug, "D0: %d, D0bar%d, sign: %d", candD0.isSelD0(), candD0.isSelD0bar(), track.sign()); continue; } diff --git a/PWGHF/TableProducer/candidateCreatorBs.cxx b/PWGHF/TableProducer/candidateCreatorBs.cxx index 0bf80217b41..41c41d7dcaa 100644 --- a/PWGHF/TableProducer/candidateCreatorBs.cxx +++ b/PWGHF/TableProducer/candidateCreatorBs.cxx @@ -99,7 +99,7 @@ struct HfCandidateCreatorBs { o2::vertexing::DCAFitterN<3> df3; // 3-prong vertex fitter HfHelper hfHelper; Service ccdb; - o2::base::MatLayerCylSet* lut; + o2::base::MatLayerCylSet* lut{}; o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; int runNumber{0}; @@ -268,16 +268,16 @@ struct HfCandidateCreatorBs { df3.getTrack(2).getPxPyPzGlo(pVec2); // Ds∓ → K∓ K± π∓ - std::array pVecKK = RecoDecay::pVec(pVec0, pVec1); + std::array const pVecKK = RecoDecay::pVec(pVec0, pVec1); std::array pVecDs = RecoDecay::pVec(pVec0, pVec1, pVec2); auto trackParCovKK = o2::dataformats::V0(df3.getPCACandidatePos(), pVecKK, df3.calcPCACovMatrixFlat(), trackParCov0, trackParCov1); auto trackParCovDs = o2::dataformats::V0(df3.getPCACandidatePos(), pVecDs, df3.calcPCACovMatrixFlat(), trackParCovKK, trackParCov2); - int indexTrack0 = track0.globalIndex(); - int indexTrack1 = track1.globalIndex(); - int indexTrack2 = track2.globalIndex(); + int const indexTrack0 = track0.globalIndex(); + int const indexTrack1 = track1.globalIndex(); + int const indexTrack2 = track2.globalIndex(); auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); @@ -393,8 +393,8 @@ struct HfCandidateCreatorBsExpressions { int8_t sign = 0; int8_t flagChannelMain = 0; int8_t flagChannelReso = 0; - std::vector arrDaughDsIndex; - std::array arrPDGDaughDs; + std::vector arrDaughDsIndex{}; + std::array arrPDGDaughDs{}; std::array arrPDGResonantDsPhiPi = {Pdg::kPhi, kPiPlus}; // Ds± → Phi π± // Match reconstructed candidates. @@ -430,7 +430,7 @@ struct HfCandidateCreatorBsExpressions { } } - if (!flagChannelMain) { + if (flagChannelMain == 0) { // Checking B0(bar) → Ds± π∓ → (K- K+ π±) π∓ indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersBs, Pdg::kB0, std::array{-kKPlus, +kKPlus, +kPiPlus, -kPiPlus}, true, &sign, 3); if (indexRec > -1) { @@ -453,19 +453,19 @@ struct HfCandidateCreatorBsExpressions { // Partly reconstructed decays, i.e. the 4 prongs have a common b-hadron ancestor // convention: final state particles are prong0,1,2,3 - if (!flagChannelMain) { + if (flagChannelMain == 0) { auto particleProng0 = arrayDaughtersBs[0].mcParticle(); auto particleProng1 = arrayDaughtersBs[1].mcParticle(); auto particleProng2 = arrayDaughtersBs[2].mcParticle(); auto particleProng3 = arrayDaughtersBs[3].mcParticle(); // b-hadron hypothesis - std::array bHadronMotherHypos = {Pdg::kB0, Pdg::kBPlus, Pdg::kBS, Pdg::kLambdaB0}; + std::array const bHadronMotherHypos = {Pdg::kB0, Pdg::kBPlus, Pdg::kBS, Pdg::kLambdaB0}; for (const auto& bHadronMotherHypo : bHadronMotherHypos) { - int index0Mother = RecoDecay::getMother(mcParticles, particleProng0, bHadronMotherHypo, true); - int index1Mother = RecoDecay::getMother(mcParticles, particleProng1, bHadronMotherHypo, true); - int index2Mother = RecoDecay::getMother(mcParticles, particleProng2, bHadronMotherHypo, true); - int index3Mother = RecoDecay::getMother(mcParticles, particleProng3, bHadronMotherHypo, true); + int const index0Mother = RecoDecay::getMother(mcParticles, particleProng0, bHadronMotherHypo, true); + int const index1Mother = RecoDecay::getMother(mcParticles, particleProng1, bHadronMotherHypo, true); + int const index2Mother = RecoDecay::getMother(mcParticles, particleProng2, bHadronMotherHypo, true); + int const index3Mother = RecoDecay::getMother(mcParticles, particleProng3, bHadronMotherHypo, true); // look for common b-hadron ancestor if (index0Mother > -1 && index0Mother == index1Mother && index1Mother == index2Mother && index2Mother == index3Mother) { @@ -502,7 +502,7 @@ struct HfCandidateCreatorBsExpressions { } } - if (!flagChannelMain) { + if (flagChannelMain == 0) { // Checking B0(bar) → Ds± π∓ → (K- K+ π±) π∓ if (RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kB0, std::array{+Pdg::kDS, -kPiPlus}, true)) { // Checking Ds± → K- K+ π± diff --git a/PWGHF/TableProducer/candidateCreatorCascade.cxx b/PWGHF/TableProducer/candidateCreatorCascade.cxx index 74d78f6a00e..781b50c3412 100644 --- a/PWGHF/TableProducer/candidateCreatorCascade.cxx +++ b/PWGHF/TableProducer/candidateCreatorCascade.cxx @@ -90,7 +90,7 @@ struct HfCandidateCreatorCascade { HfEventSelection hfEvSel; // event selection and monitoring o2::vertexing::DCAFitterN<2> df; // 2-prong vertex fitter Service ccdb; - o2::base::MatLayerCylSet* lut; + o2::base::MatLayerCylSet* lut{}; o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; int runNumber{0}; @@ -163,7 +163,7 @@ struct HfCandidateCreatorCascade { setLabelHistoCands(hCandidates); } - template + template void runCreatorCascade(Coll const&, aod::HfCascades const& rowsTrackIndexCasc, aod::V0sLinked const&, @@ -178,7 +178,7 @@ struct HfCandidateCreatorCascade { auto collision = casc.template collision_as(); /// reject candidates in collisions not satisfying the event selections float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -222,7 +222,7 @@ struct HfCandidateCreatorCascade { dcaNegToPV = v0row.dcanegtopv(); v0cosPA = v0row.v0cosPA(); - int momIndSize = 6; + int const momIndSize = 6; constexpr int MomInd[6] = {9, 13, 14, 18, 19, 20}; // cov matrix elements for momentum component for (int i = 0; i < momIndSize; i++) { covV[MomInd[i]] = v0row.momentumCovMat()[i]; @@ -257,9 +257,9 @@ struct HfCandidateCreatorCascade { try { if (df.process(trackV0, trackBach) == 0) { continue; - } else { - LOG(debug) << "Vertexing succeeded for Lc candidate"; } + LOG(debug) << "Vertexing succeeded for Lc candidate"; + } catch (const std::runtime_error& error) { LOG(debug) << "Run time error found: " << error.what() << ". DCAFitterN cannot work, skipping the candidate."; hCandidates->Fill(SVFitting::Fail); @@ -276,8 +276,8 @@ struct HfCandidateCreatorCascade { auto trackParVarBach = df.getTrack(1); // get track momenta - std::array pVecV0; - std::array pVecBach; + std::array pVecV0{}; + std::array pVecBach{}; trackParVarV0.getPxPyPzGlo(pVecV0); trackParVarBach.getPxPyPzGlo(pVecBach); @@ -324,8 +324,6 @@ struct HfCandidateCreatorCascade { registry.fill(HIST("hMass2"), mass2K0sP); } } - - return; } /// @brief process function w/o centrality selections @@ -457,7 +455,7 @@ struct HfCandidateCreatorCascadeMc { const auto& workflows = initContext.services().get(); for (const DeviceSpec& device : workflows.devices) { - if (device.name.compare("hf-candidate-creator-cascade") == 0) { + if (device.name == "hf-candidate-creator-cascade") { // init HF event selection helper hfEvSelMc.init(device, registry); break; @@ -465,7 +463,7 @@ struct HfCandidateCreatorCascadeMc { } } - template + template void runCreatorCascMc(MyTracksWMc const& tracks, aod::McParticles const& mcParticles, CCs const& collInfos, @@ -506,7 +504,7 @@ struct HfCandidateCreatorCascadeMc { } } - int indexK0SRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersV0, kK0Short, std::array{+kPiPlus, -kPiPlus}, false, &sign, 1); + int const indexK0SRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersV0, kK0Short, std::array{+kPiPlus, -kPiPlus}, false, &sign, 1); if (indexK0SRec >= 0) { // we have already positively checked the K0s // then we check the Lc indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersLc, Pdg::kLambdaCPlus, std::array{+kProton, +kPiPlus, -kPiPlus}, true, &sign, 3); // 3-levels Lc --> p + K0 --> p + K0s --> p + pi+ pi- @@ -533,18 +531,18 @@ struct HfCandidateCreatorCascadeMc { float centrality{-1.f}; o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; int nSplitColl = 0; - if constexpr (centEstimator == CentralityEstimator::FT0C) { + if constexpr (CentEstimator == CentralityEstimator::FT0C) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); - } else if constexpr (centEstimator == CentralityEstimator::FT0M) { + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + } else if constexpr (CentEstimator == CentralityEstimator::FT0M) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0M, mcCollision.globalIndex()); nSplitColl = collSlice.size(); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); - } else if constexpr (centEstimator == CentralityEstimator::None) { + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + } else if constexpr (CentEstimator == CentralityEstimator::None) { const auto collSlice = collInfos.sliceBy(colPerMcCollision, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } - hfEvSelMc.fillHistograms(mcCollision, rejectionMask, nSplitColl); + hfEvSelMc.fillHistograms(mcCollision, rejectionMask, nSplitColl); if (rejectionMask != 0) { // at least one event selection not satisfied --> reject all particles from this collision for (unsigned int i = 0; i < mcParticlesPerMcColl.size(); ++i) { @@ -605,9 +603,9 @@ struct HfCandidateCreatorCascadeMc { aod::McParticles const& mcParticles, McCollisionsNoCents const& collInfos, aod::McCollisions const& mcCollisions, - BCsInfo const& BCsInfo) + BCsInfo const& bcsInfo) { - runCreatorCascMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); + runCreatorCascMc(tracks, mcParticles, collInfos, mcCollisions, bcsInfo); } PROCESS_SWITCH(HfCandidateCreatorCascadeMc, processMc, "Process MC - no centrality", false); @@ -615,9 +613,9 @@ struct HfCandidateCreatorCascadeMc { aod::McParticles const& mcParticles, McCollisionsFT0Cs const& collInfos, aod::McCollisions const& mcCollisions, - BCsInfo const& BCsInfo) + BCsInfo const& bcsInfo) { - runCreatorCascMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); + runCreatorCascMc(tracks, mcParticles, collInfos, mcCollisions, bcsInfo); } PROCESS_SWITCH(HfCandidateCreatorCascadeMc, processMcCentFT0C, "Process MC - FT0c centrality", false); @@ -625,9 +623,9 @@ struct HfCandidateCreatorCascadeMc { aod::McParticles const& mcParticles, McCollisionsFT0Ms const& collInfos, McCollisionsCentFT0Ms const& mcCollisions, - BCsInfo const& BCsInfo) + BCsInfo const& bcsInfo) { - runCreatorCascMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); + runCreatorCascMc(tracks, mcParticles, collInfos, mcCollisions, bcsInfo); } PROCESS_SWITCH(HfCandidateCreatorCascadeMc, processMcCentFT0M, "Process MC - FT0m centrality", false); }; diff --git a/PWGHF/TableProducer/candidateCreatorDstar.cxx b/PWGHF/TableProducer/candidateCreatorDstar.cxx index 2fb6092c4e3..47a05c41c37 100644 --- a/PWGHF/TableProducer/candidateCreatorDstar.cxx +++ b/PWGHF/TableProducer/candidateCreatorDstar.cxx @@ -107,10 +107,10 @@ struct HfCandidateCreatorDstar { o2::base::Propagator::MatCorrType noMatCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; // D0-prong vertex fitter o2::vertexing::DCAFitterN<2> df; - int runNumber; - double bz; + int runNumber{}; + double bz{}; static constexpr float CmToMicrometers = 10000.; // from cm to µm - double massPi, massK, massD0; + double massPi{}, massK{}, massD0{}; using TracksWCovExtraPidPiKa = soa::Join; @@ -204,7 +204,7 @@ struct HfCandidateCreatorDstar { /// @param rowsTrackIndexD0 D0 table object from trackIndexSkimCreator.cxx /// @param tracks track table with Cov object /// @param bcWithTimeStamps Bunch Crossing with timestamps - template + template void runCreatorDstar(Coll const&, CandsDstar const& rowsTrackIndexDstar, aod::Hf2Prongs const&, @@ -219,7 +219,7 @@ struct HfCandidateCreatorDstar { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexDstar.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -249,7 +249,7 @@ struct HfCandidateCreatorDstar { auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { // LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; - o2::parameters::GRPMagField* grpo = ccdb->getForTimeStamp(ccdbPathGrpMag, bc.timestamp()); + auto* grpo = ccdb->getForTimeStamp(ccdbPathGrpMag, bc.timestamp()); if (grpo == nullptr) { LOGF(fatal, "Run 3 GRP object (type o2::parameters::GRPMagField) is not available in CCDB for run=%d at timestamp=%llu", bc.runNumber(), bc.timestamp()); } @@ -287,13 +287,13 @@ struct HfCandidateCreatorDstar { auto trackD0ProngParVar0 = df.getTrack(0); auto trackD0ProngParVar1 = df.getTrack(1); - std::array pVecD0Prong0; - std::array pVecD0Prong1; + std::array pVecD0Prong0{}; + std::array pVecD0Prong1{}; trackD0ProngParVar0.getPxPyPzGlo(pVecD0Prong0); trackD0ProngParVar1.getPxPyPzGlo(pVecD0Prong1); // This modifies track momenta! - if constexpr (doPvRefit) { + if constexpr (DoPvRefit) { /// use PV refit /// Using it in the *HfCand3ProngBase/HfCand2ProngBase* all dynamic columns shall take it into account // coordinates @@ -346,9 +346,9 @@ struct HfCandidateCreatorDstar { auto ptD0 = RecoDecay::pt(pVecD0); // Soft pi momentum vector and sign - std::array pVecSoftPi; + std::array pVecSoftPi{}; trackPiParVar.getPxPyPzGlo(pVecSoftPi); - int8_t signSoftPi = static_cast(trackPi.sign()); + auto signSoftPi = static_cast(trackPi.sign()); // D* pt magnitude auto ptDstar = RecoDecay::pt(pVecD0, pVecSoftPi); @@ -575,7 +575,7 @@ struct HfCandidateCreatorDstarExpressions { const auto& workflows = initContext.services().get(); for (const DeviceSpec& device : workflows.devices) { - if (device.name.compare("hf-candidate-creator-dstar") == 0) { + if (device.name == "hf-candidate-creator-dstar") { // init HF event selection helper hfEvSelMc.init(device, registry); break; @@ -584,7 +584,7 @@ struct HfCandidateCreatorDstarExpressions { } /// Perform MC Matching. - template + template void runCreatorDstarMc(aod::TracksWMc const& tracks, aod::McParticles const& mcParticles, CCs const& collInfos, @@ -734,18 +734,18 @@ struct HfCandidateCreatorDstarExpressions { float centrality{-1.f}; o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; int nSplitColl = 0; - if constexpr (centEstimator == CentralityEstimator::FT0C) { + if constexpr (CentEstimator == CentralityEstimator::FT0C) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); - } else if constexpr (centEstimator == CentralityEstimator::FT0M) { + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + } else if constexpr (CentEstimator == CentralityEstimator::FT0M) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0M, mcCollision.globalIndex()); nSplitColl = collSlice.size(); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); - } else if constexpr (centEstimator == CentralityEstimator::None) { + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + } else if constexpr (CentEstimator == CentralityEstimator::None) { const auto collSlice = collInfos.sliceBy(colPerMcCollision, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } - hfEvSelMc.fillHistograms(mcCollision, rejectionMask, nSplitColl); + hfEvSelMc.fillHistograms(mcCollision, rejectionMask, nSplitColl); if (rejectionMask != 0) { // at least one event selection not satisfied --> reject all particles from this collision for (unsigned int i = 0; i < mcParticlesPerMcColl.size(); ++i) { @@ -768,7 +768,7 @@ struct HfCandidateCreatorDstarExpressions { // D*± → D0(bar) π± std::vector listIndexDaughters{}; - bool isDstarToDzeroPi = RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kDStar, std::array{+Pdg::kD0, +kPiPlus}, true, &signDstar, 1, &listIndexDaughters); + bool const isDstarToDzeroPi = RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kDStar, std::array{+Pdg::kD0, +kPiPlus}, true, &signDstar, 1, &listIndexDaughters); // D0(bar) → π± K∓ if (isDstarToDzeroPi) { @@ -808,9 +808,9 @@ struct HfCandidateCreatorDstarExpressions { aod::McParticles const& mcParticles, McCollisionsNoCents const& collInfos, aod::McCollisions const& mcCollisions, - BCsInfo const& BCsInfo) + BCsInfo const& bcsInfo) { - runCreatorDstarMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); + runCreatorDstarMc(tracks, mcParticles, collInfos, mcCollisions, bcsInfo); } PROCESS_SWITCH(HfCandidateCreatorDstarExpressions, processMc, "Process MC - no centrality", false); @@ -818,9 +818,9 @@ struct HfCandidateCreatorDstarExpressions { aod::McParticles const& mcParticles, McCollisionsFT0Cs const& collInfos, aod::McCollisions const& mcCollisions, - BCsInfo const& BCsInfo) + BCsInfo const& bcsInfo) { - runCreatorDstarMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); + runCreatorDstarMc(tracks, mcParticles, collInfos, mcCollisions, bcsInfo); } PROCESS_SWITCH(HfCandidateCreatorDstarExpressions, processMcCentFT0C, "Process MC - FT0c centrality", false); @@ -828,9 +828,9 @@ struct HfCandidateCreatorDstarExpressions { aod::McParticles const& mcParticles, McCollisionsFT0Ms const& collInfos, McCollisionsCentFT0Ms const& mcCollisions, - BCsInfo const& BCsInfo) + BCsInfo const& bcsInfo) { - runCreatorDstarMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); + runCreatorDstarMc(tracks, mcParticles, collInfos, mcCollisions, bcsInfo); } PROCESS_SWITCH(HfCandidateCreatorDstarExpressions, processMcCentFT0M, "Process MC - FT0m centrality", false); }; diff --git a/PWGHF/TableProducer/candidateCreatorLb.cxx b/PWGHF/TableProducer/candidateCreatorLb.cxx index 9d15a7e3e1d..b3fcad95b9b 100644 --- a/PWGHF/TableProducer/candidateCreatorLb.cxx +++ b/PWGHF/TableProducer/candidateCreatorLb.cxx @@ -47,7 +47,6 @@ #include #include #include -#include using namespace o2; using namespace o2::analysis; @@ -135,7 +134,7 @@ struct HfCandidateCreatorLb { { // loop over Lc candidates for (const auto& lcCand : lcCands) { - if (!(lcCand.hfflag() & 1 << o2::aod::hf_cand_3prong::DecayType::LcToPKPi)) { + if ((lcCand.hfflag() & 1 << o2::aod::hf_cand_3prong::DecayType::LcToPKPi) == 0) { continue; } if (lcCand.isSelLcToPKPi() >= selectionFlagLc) { @@ -173,14 +172,14 @@ struct HfCandidateCreatorLb { trackParVar1.propagateTo(secondaryVertex[0], bz); trackParVar2.propagateTo(secondaryVertex[0], bz); - std::array pvecpK = RecoDecay::pVec(track0.pVector(), track1.pVector()); + std::array const pvecpK = RecoDecay::pVec(track0.pVector(), track1.pVector()); std::array pvecLc = RecoDecay::pVec(pvecpK, track2.pVector()); auto trackpK = o2::dataformats::V0(df3.getPCACandidatePos(), pvecpK, df3.calcPCACovMatrixFlat(), trackParVar0, trackParVar1); auto trackLc = o2::dataformats::V0(df3.getPCACandidatePos(), pvecLc, df3.calcPCACovMatrixFlat(), trackpK, trackParVar2); - int index0Lc = track0.globalIndex(); - int index1Lc = track1.globalIndex(); - int index2Lc = track2.globalIndex(); + int const index0Lc = track0.globalIndex(); + int const index1Lc = track1.globalIndex(); + int const index2Lc = track2.globalIndex(); // int charge = track0.sign() + track1.sign() + track2.sign(); for (const auto& trackPion : tracks) { @@ -194,7 +193,7 @@ struct HfCandidateCreatorLb { continue; } hPtPion->Fill(trackPion.pt()); - std::array pvecPion; + std::array pvecPion{}; auto trackParVarPi = getTrackParCov(trackPion); // reconstruct the 3-prong Lc vertex @@ -248,7 +247,7 @@ struct HfCandidateCreatorLb { rowCandidateProngs(lcCand.globalIndex(), trackPion.globalIndex()); // calculate invariant mass auto arrayMomenta = std::array{pvecLc, pvecPion}; - massLcPi = RecoDecay::m(std::move(arrayMomenta), std::array{massLc, massPi}); + massLcPi = RecoDecay::m(arrayMomenta, std::array{massLc, massPi}); if (lcCand.isSelLcToPKPi() > 0) { hMassLbToLcPi->Fill(massLcPi); } diff --git a/PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx b/PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx index e826254ea35..b95b69e4937 100644 --- a/PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx +++ b/PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx @@ -101,9 +101,9 @@ struct HfCandidateCreatorSigmac0plusplus { // Needed for dcaXY, dcaZ recalculation of soft pions reassigned to a new collision Service ccdb; - o2::base::MatLayerCylSet* lut; + o2::base::MatLayerCylSet* lut{}; o2::base::Propagator::MatCorrType noMatCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; - int runNumber; + int runNumber{}; using CandidatesLc = soa::Filtered>; @@ -132,7 +132,7 @@ struct HfCandidateCreatorSigmac0plusplus { /// process function switches std::array arrProcess = {doprocessDataTrackToCollAssoc, doprocessDataNoTrackToCollAssoc}; - int processes = std::accumulate(arrProcess.begin(), arrProcess.end(), 0); + int const processes = std::accumulate(arrProcess.begin(), arrProcess.end(), 0); if (processes != 1) { LOG(fatal) << "Check the enabled process functions. doprocessDataTrackToCollAssoc=" << doprocessDataTrackToCollAssoc << ", doprocessDataNoTrackToCollAssoc=" << doprocessDataNoTrackToCollAssoc; } @@ -173,8 +173,8 @@ struct HfCandidateCreatorSigmac0plusplus { LOG(info) << "### ITS hitmap for soft pion"; LOG(info) << " >>> setSoftPiItsHitMap.size(): " << setSoftPiItsHitMap.size(); LOG(info) << " >>> Custom ITS hitmap dfchecked: "; - for (std::set::iterator it = setSoftPiItsHitMap.begin(); it != setSoftPiItsHitMap.end(); it++) { - LOG(info) << " Layer " << static_cast(*it) << " "; + for (const auto it : setSoftPiItsHitMap) { + LOG(info) << " Layer " << static_cast(it) << " "; } LOG(info) << "############"; softPiCuts.SetRequireITSRefit(); @@ -283,7 +283,7 @@ struct HfCandidateCreatorSigmac0plusplus { /// @param trackSoftPi is the track (with dcaXY, dcaZ information)of a candidate soft-pion in the collision /// @param tracks are the tracks (with dcaXY, dcaZ information) → soft-pion candidate tracks /// @param candidates are 3-prong candidates satisfying the analysis selections for Λc+ → pK-π+ (and charge conj.) - template + template void createSigmaC(aod::Collisions::iterator const& collision, TRK const& trackSoftPi, aod::TracksWDcaExtra const& tracks, @@ -300,7 +300,7 @@ struct HfCandidateCreatorSigmac0plusplus { return; } std::array softPiDca = {-999.f, -999.f}; - if constexpr (withTimeAssoc) { + if constexpr (WithTimeAssoc) { /// dcaXY, dcaZ selections /// To be done separately from the others, because for reassigned tracks the dca must be recalculated /// TODO: to be properly adapted in case of PV refit usage @@ -334,7 +334,7 @@ struct HfCandidateCreatorSigmac0plusplus { histos.fill(HIST("hCounter"), 3); /// loop over Λc+ → pK-π+ (and charge conj.) candidates - if constexpr (withTimeAssoc) { + if constexpr (WithTimeAssoc) { /// need to group candidates manually auto candidatesThisColl = candidates.sliceBy(hf3ProngPerCollision, thisCollId); makeSoftPiLcPair(softPiDca, trackSoftPi, candidatesThisColl, tracks); @@ -431,7 +431,7 @@ struct HfCandidateSigmac0plusplusMc { for (const DeviceSpec& device : workflows.devices) { // here we assume that the hf-candidate-creator-3prong is in the workflow // configure the ev. sel from that workflow - if (device.name.compare("hf-candidate-creator-3prong") == 0) { + if (device.name == "hf-candidate-creator-3prong") { // init HF event selection helper hfEvSelMc.init(device, registry); break; @@ -450,7 +450,8 @@ struct HfCandidateSigmac0plusplusMc { if (pdgCode == pdgSigmac) { // particle return aod::hf_cand_sigmac::Particle; - } else if (pdgCode == -pdgSigmac) { + } + if (pdgCode == -pdgSigmac) { // antiparticle return aod::hf_cand_sigmac::Antiparticle; } @@ -606,8 +607,9 @@ struct HfCandidateSigmac0plusplusMc { // generated Σc0(2455) for (const auto& daughter : particle.daughters_as()) { // look for Λc+ daughter decaying in pK-π+ - if (std::abs(daughter.pdgCode()) != Pdg::kLambdaCPlus) + if (std::abs(daughter.pdgCode()) != Pdg::kLambdaCPlus) { continue; + } if (std::abs(daughter.flagMcMatchGen()) == o2::hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi) { /// Λc+ daughter decaying in pK-π+ found! flag = sign * BIT(aod::hf_cand_sigmac::DecayType::Sc0ToPKPiPi); @@ -619,8 +621,9 @@ struct HfCandidateSigmac0plusplusMc { // generated Σc++(2455) for (const auto& daughter : particle.daughters_as()) { // look for Λc+ daughter decaying in pK-π+ - if (std::abs(daughter.pdgCode()) != Pdg::kLambdaCPlus) + if (std::abs(daughter.pdgCode()) != Pdg::kLambdaCPlus) { continue; + } if (std::abs(daughter.flagMcMatchGen()) == o2::hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi) { /// Λc+ daughter decaying in pK-π+ found! flag = sign * BIT(aod::hf_cand_sigmac::DecayType::ScplusplusToPKPiPi); @@ -636,8 +639,9 @@ struct HfCandidateSigmac0plusplusMc { // generated Σc0(2520) for (const auto& daughter : particle.daughters_as()) { // look for Λc+ daughter decaying in pK-π+ - if (std::abs(daughter.pdgCode()) != Pdg::kLambdaCPlus) + if (std::abs(daughter.pdgCode()) != Pdg::kLambdaCPlus) { continue; + } if (std::abs(daughter.flagMcMatchGen()) == o2::hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi) { /// Λc+ daughter decaying in pK-π+ found! flag = sign * BIT(aod::hf_cand_sigmac::DecayType::ScStar0ToPKPiPi); @@ -649,8 +653,9 @@ struct HfCandidateSigmac0plusplusMc { // generated Σc++(2520) for (const auto& daughter : particle.daughters_as()) { // look for Λc+ daughter decaying in pK-π+ - if (std::abs(daughter.pdgCode()) != Pdg::kLambdaCPlus) + if (std::abs(daughter.pdgCode()) != Pdg::kLambdaCPlus) { continue; + } if (std::abs(daughter.flagMcMatchGen()) == o2::hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi) { /// Λc+ daughter decaying in pK-π+ found! flag = sign * BIT(aod::hf_cand_sigmac::DecayType::ScStarPlusPlusToPKPiPi); diff --git a/PWGHF/TableProducer/candidateCreatorSigmac0plusplusCascade.cxx b/PWGHF/TableProducer/candidateCreatorSigmac0plusplusCascade.cxx index 71a61bec437..c63bbf09ce4 100644 --- a/PWGHF/TableProducer/candidateCreatorSigmac0plusplusCascade.cxx +++ b/PWGHF/TableProducer/candidateCreatorSigmac0plusplusCascade.cxx @@ -91,25 +91,25 @@ struct HfCandidateCreatorSigmac0plusplusCascade { void init(InitContext&) { // axes - AxisSpec axisBinsPt = {binsPt, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec axisPt = {300, 0.0f, 30.0f, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec axisEta = {500, -2.0f, 2.0f, "#it{#eta}"}; - AxisSpec axisPhi = {100, 0.f, 6.3f, "#it{#phi}"}; - AxisSpec axisMassCand = {600, 1.98f, 2.58f, "inv. mass (p K_{S}^{0}) (GeV/#it{c}^{2})"}; - AxisSpec axisd0 = {500, -0.5f, 0.5f, "DCAxy (cm)"}; - AxisSpec axisd0V0Daughters = {1000, -5.0f, 5.0f, "DCAxy (cm)"}; - AxisSpec axisV0CPA = {500, 0.98f, 1.0001f, "v0 cos pointing angle"}; - AxisSpec axisV0Radius = {1000, 0.f, 40.f, "V0 radius (cm)"}; - AxisSpec axisV0DCADaughters = {200, 0.f, 2.f, "DCA (cm)"}; - AxisSpec axisMassK0Short = {500, 0.4f, 0.6f, "#it{m}(K_{S}^{0}) (GeV/#it{c}^{2})"}; - AxisSpec axisMassLambda = {500, 1.0f, 1.2f, "#it{m}(#Lambda) (GeV/#it{c}^{2})"}; - AxisSpec axisMassGamma = {500, 0.0f, 0.4f, "#it{m}(#gamma) (GeV/#it{c}^{2})"}; - AxisSpec axisCPACand = {110, -1.1f, 1.1f, "candiate cos pointing angle"}; - AxisSpec axisDecLength = {200, 0.f, 2.0f, "decay length (cm)"}; - AxisSpec axisProperLifetime = {100, 0.f, 0.2f, "#it{c#tau} (cm)"}; - AxisSpec axisProperLifetimeV0 = {1000, 0.f, 80.f, "#it{c#tau} (cm)"}; - AxisSpec axisNSigma = {100, -6.f, 6.f, "n#it{#sigma}_{p}"}; - AxisSpec axisPidP = {100, 0.f, 10.0f, "#it{p} (GeV/#it{c})"}; + AxisSpec const axisBinsPt = {binsPt, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec const axisPt = {300, 0.0f, 30.0f, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec const axisEta = {500, -2.0f, 2.0f, "#it{#eta}"}; + AxisSpec const axisPhi = {100, 0.f, 6.3f, "#it{#phi}"}; + AxisSpec const axisMassCand = {600, 1.98f, 2.58f, "inv. mass (p K_{S}^{0}) (GeV/#it{c}^{2})"}; + AxisSpec const axisd0 = {500, -0.5f, 0.5f, "DCAxy (cm)"}; + AxisSpec const axisd0V0Daughters = {1000, -5.0f, 5.0f, "DCAxy (cm)"}; + AxisSpec const axisV0CPA = {500, 0.98f, 1.0001f, "v0 cos pointing angle"}; + AxisSpec const axisV0Radius = {1000, 0.f, 40.f, "V0 radius (cm)"}; + AxisSpec const axisV0DCADaughters = {200, 0.f, 2.f, "DCA (cm)"}; + AxisSpec const axisMassK0Short = {500, 0.4f, 0.6f, "#it{m}(K_{S}^{0}) (GeV/#it{c}^{2})"}; + AxisSpec const axisMassLambda = {500, 1.0f, 1.2f, "#it{m}(#Lambda) (GeV/#it{c}^{2})"}; + AxisSpec const axisMassGamma = {500, 0.0f, 0.4f, "#it{m}(#gamma) (GeV/#it{c}^{2})"}; + AxisSpec const axisCPACand = {110, -1.1f, 1.1f, "candiate cos pointing angle"}; + AxisSpec const axisDecLength = {200, 0.f, 2.0f, "decay length (cm)"}; + AxisSpec const axisProperLifetime = {100, 0.f, 0.2f, "#it{c#tau} (cm)"}; + AxisSpec const axisProperLifetimeV0 = {1000, 0.f, 80.f, "#it{c#tau} (cm)"}; + AxisSpec const axisNSigma = {100, -6.f, 6.f, "n#it{#sigma}_{p}"}; + AxisSpec const axisPidP = {100, 0.f, 10.0f, "#it{p} (GeV/#it{c})"}; auto h = registry.add("candidateStat", "", kTH1D, {{3, 0.5, 3.5}}); h->GetXaxis()->SetBinLabel(1, "Lc candidates"); @@ -179,24 +179,33 @@ struct HfCandidateCreatorSigmac0plusplusCascade { template bool isTrackSelected(const TrackType& track) { - if (track.pt() < trkMinPt) + if (track.pt() < trkMinPt) { return false; - if (std::abs(track.eta()) > trkMaxEta) + } + if (std::abs(track.eta()) > trkMaxEta) { return false; - if (std::abs(track.dcaXY()) > maxDCAxyToPVcut) + } + if (std::abs(track.dcaXY()) > maxDCAxyToPVcut) { return false; - if (std::abs(track.dcaZ()) > maxDCAzToPVcut) + } + if (std::abs(track.dcaZ()) > maxDCAzToPVcut) { return false; - if (track.tpcNClsFound() < nTpcNClsFound) + } + if (track.tpcNClsFound() < nTpcNClsFound) { return false; - if (track.tpcNClsCrossedRows() < nTPCCrossedRows) + } + if (track.tpcNClsCrossedRows() < nTPCCrossedRows) { return false; - if (track.tpcChi2NCl() > nTPCChi2) + } + if (track.tpcChi2NCl() > nTPCChi2) { return false; - if (track.itsChi2NCl() > nITSChi2) + } + if (track.itsChi2NCl() > nITSChi2) { return false; - if (track.tpcNSigmaPi() > tpcnSigmaPi) + } + if (track.tpcNSigmaPi() > tpcnSigmaPi) { return false; + } return true; } diff --git a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx index 5f3e0b3ebba..f658e183b10 100644 --- a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx +++ b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx @@ -140,7 +140,7 @@ struct HfCandidateCreatorXic0Omegac0 { HfEventSelection hfEvSel; // event selection and monitoring o2::vertexing::DCAFitterN<2> df; // 2-prong vertex fitter to build the omegac/xic vertex Service ccdb; - o2::base::MatLayerCylSet* lut; + o2::base::MatLayerCylSet* lut{}; o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; int runNumber{-1}; double magneticField{0.}; @@ -207,7 +207,7 @@ struct HfCandidateCreatorXic0Omegac0 { float chi2MassCasc; float etaOmegac; float cascRejectInvmass; // rej - } kfOmegac0Candidate; + } kfOmegac0Candidate{}; struct { float chi2GeoV0; @@ -251,7 +251,7 @@ struct HfCandidateCreatorXic0Omegac0 { float chi2MassV0; float chi2MassCasc; float etaXic; - } kfXic0Candidate; + } kfXic0Candidate{}; void init(InitContext const&) { @@ -380,7 +380,7 @@ struct HfCandidateCreatorXic0Omegac0 { runNumber = 0; } - template + template void runXic0Omegac0Creator(Coll const&, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/, MyLFTracksWCov const& lfTracks, @@ -393,7 +393,7 @@ struct HfCandidateCreatorXic0Omegac0 { Hist& hCascadesCounter) { - if constexpr (decayChannel != hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi && decayChannel != hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi && decayChannel != hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaK) { + if constexpr (DecayChannel != hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi && DecayChannel != hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi && DecayChannel != hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaK) { LOGP(fatal, "Decay channel not recognized!"); } @@ -401,15 +401,15 @@ struct HfCandidateCreatorXic0Omegac0 { hCandidateCounter->Fill(0); - if constexpr (decayChannel == hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi) { + if constexpr (DecayChannel == hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi) { if (!TESTBIT(cand.hfflag(), aod::hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi)) { continue; } - } else if constexpr (decayChannel == hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi) { + } else if constexpr (DecayChannel == hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi) { if (!TESTBIT(cand.hfflag(), aod::hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi)) { continue; } - } else if constexpr (decayChannel == hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaK) { + } else if constexpr (DecayChannel == hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaK) { if (!TESTBIT(cand.hfflag(), aod::hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaK)) { continue; } @@ -419,7 +419,7 @@ struct HfCandidateCreatorXic0Omegac0 { auto collision = cand.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -492,7 +492,7 @@ struct HfCandidateCreatorXic0Omegac0 { // info from LF table std::array vertexCasc = {casc.x(), casc.y(), casc.z()}; - std::array pVecCasc = {casc.px(), casc.py(), casc.pz()}; + std::array const pVecCasc = {casc.px(), casc.py(), casc.pz()}; std::array covCasc = {0.}; constexpr int NumCovElements = 6; constexpr int MomInd[NumCovElements] = {9, 13, 14, 18, 19, 20}; // cov matrix elements for momentum component @@ -510,7 +510,7 @@ struct HfCandidateCreatorXic0Omegac0 { continue; } trackCasc.setAbsCharge(1); - if constexpr (decayChannel == hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi) { + if constexpr (DecayChannel == hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi) { trackCasc.setPID(o2::track::PID::XiMinus); } else { trackCasc.setPID(o2::track::PID::OmegaMinus); @@ -537,8 +537,8 @@ struct HfCandidateCreatorXic0Omegac0 { hFitterStatus->Fill(0); hCandidateCounter->Fill(2); auto vertexCharmBaryonFromFitter = df.getPCACandidate(); - std::array pVecCascAsD; - std::array pVecCharmBachelorAsD; + std::array pVecCascAsD{}; + std::array pVecCharmBachelorAsD{}; df.propagateTracksToVertex(); if (!df.isPropagateTracksToVertexDone()) { continue; @@ -547,11 +547,11 @@ struct HfCandidateCreatorXic0Omegac0 { df.getTrack(1).getPxPyPzGlo(pVecCharmBachelorAsD); std::array pVecCharmBaryon = {pVecCascAsD[0] + pVecCharmBachelorAsD[0], pVecCascAsD[1] + pVecCharmBachelorAsD[1], pVecCascAsD[2] + pVecCharmBachelorAsD[2]}; - std::array coordVtxCharmBaryon = df.getPCACandidatePos(); + std::array const coordVtxCharmBaryon = df.getPCACandidatePos(); std::array covVtxCharmBaryon = df.calcPCACovMatrixFlat(); // pseudorapidity - float pseudorapCharmBachelor = trackCharmBachelor.eta(); + float const pseudorapCharmBachelor = trackCharmBachelor.eta(); // primary vertex of the collision auto primaryVertex = getPrimaryVertex(collision); // get the associated covariance matrix with auto covMatrixPV = primaryVertex.getCov(); @@ -567,33 +567,33 @@ struct HfCandidateCreatorXic0Omegac0 { o2::base::Propagator::Instance()->propagateToDCABxByBz(primaryVertex, trackParVarV0Dau0, 2.f, matCorr, &impactParameterV0Dau0); o2::base::Propagator::Instance()->propagateToDCABxByBz(primaryVertex, trackParVarV0Dau1, 2.f, matCorr, &impactParameterV0Dau1); o2::base::Propagator::Instance()->propagateToDCABxByBz(primaryVertex, trackParVarCascDauCharged, 2.f, matCorr, &impactParameterCascDauCharged); - float dcaxyV0Dau0 = impactParameterV0Dau0.getY(); - float dcaxyV0Dau1 = impactParameterV0Dau1.getY(); - float dcaxyCascBachelor = impactParameterCascDauCharged.getY(); - float dcazV0Dau0 = impactParameterV0Dau0.getZ(); - float dcazV0Dau1 = impactParameterV0Dau1.getZ(); - float dcazCascBachelor = impactParameterCascDauCharged.getZ(); + float const dcaxyV0Dau0 = impactParameterV0Dau0.getY(); + float const dcaxyV0Dau1 = impactParameterV0Dau1.getY(); + float const dcaxyCascBachelor = impactParameterCascDauCharged.getY(); + float const dcazV0Dau0 = impactParameterV0Dau0.getZ(); + float const dcazV0Dau1 = impactParameterV0Dau1.getZ(); + float const dcazCascBachelor = impactParameterCascDauCharged.getZ(); // impact parameters o2::dataformats::DCA impactParameterCasc; o2::dataformats::DCA impactParameterCharmBachelor; o2::base::Propagator::Instance()->propagateToDCABxByBz(primaryVertex, trackCasc, 2.f, matCorr, &impactParameterCasc); o2::base::Propagator::Instance()->propagateToDCABxByBz(primaryVertex, trackParVarCharmBachelor, 2.f, matCorr, &impactParameterCharmBachelor); - float impactParBachFromCharmBaryonXY = impactParameterCharmBachelor.getY(); - float impactParBachFromCharmBaryonZ = impactParameterCharmBachelor.getZ(); + float const impactParBachFromCharmBaryonXY = impactParameterCharmBachelor.getY(); + float const impactParBachFromCharmBaryonZ = impactParameterCharmBachelor.getZ(); // invariant mass under the hypothesis of particles ID corresponding to the decay chain float mLambda = casc.mLambda(); // from LF table, V0 mass under lambda hypothesis float mCasc = 0.; - if constexpr (decayChannel == hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi) { + if constexpr (DecayChannel == hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi) { mCasc = casc.mXi(); } else { mCasc = casc.mOmega(); } auto arrMassCharmBaryon = std::array{0., 0.}; - if constexpr (decayChannel == hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi) { + if constexpr (DecayChannel == hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi) { arrMassCharmBaryon = {MassXiMinus, MassPiPlus}; - } else if constexpr (decayChannel == hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi) { + } else if constexpr (DecayChannel == hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi) { arrMassCharmBaryon = {MassOmegaMinus, MassPiPlus}; } else { arrMassCharmBaryon = {MassOmegaMinus, MassKPlus}; @@ -602,48 +602,48 @@ struct HfCandidateCreatorXic0Omegac0 { // computing cosPA float cpaV0 = casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ()); - float cpaCharmBaryon = RecoDecay::cpa(pvCoord, coordVtxCharmBaryon, pVecCharmBaryon); + float const cpaCharmBaryon = RecoDecay::cpa(pvCoord, coordVtxCharmBaryon, pVecCharmBaryon); float cpaCasc = casc.casccosPA(collision.posX(), collision.posY(), collision.posZ()); - float cpaxyV0 = RecoDecay::cpaXY(pvCoord, vertexV0, pVecV0); - float cpaxyCharmBaryon = RecoDecay::cpaXY(pvCoord, coordVtxCharmBaryon, pVecCharmBaryon); - float cpaxyCasc = RecoDecay::cpaXY(pvCoord, vertexCasc, pVecCasc); + float const cpaxyV0 = RecoDecay::cpaXY(pvCoord, vertexV0, pVecV0); + float const cpaxyCharmBaryon = RecoDecay::cpaXY(pvCoord, coordVtxCharmBaryon, pVecCharmBaryon); + float const cpaxyCasc = RecoDecay::cpaXY(pvCoord, vertexCasc, pVecCasc); // computing decay length and ctau - float decLenCharmBaryon = RecoDecay::distance(pvCoord, coordVtxCharmBaryon); - float decLenCascade = RecoDecay::distance(coordVtxCharmBaryon, vertexCasc); - float decLenV0 = RecoDecay::distance(vertexCasc, vertexV0); + float const decLenCharmBaryon = RecoDecay::distance(pvCoord, coordVtxCharmBaryon); + float const decLenCascade = RecoDecay::distance(coordVtxCharmBaryon, vertexCasc); + float const decLenV0 = RecoDecay::distance(vertexCasc, vertexV0); double phiCharmBaryon, thetaCharmBaryon; getPointDirection(std::array{primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ()}, coordVtxCharmBaryon, phiCharmBaryon, thetaCharmBaryon); auto errorDecayLengthCharmBaryon = std::sqrt(getRotatedCovMatrixXX(primaryVertex.getCov(), phiCharmBaryon, thetaCharmBaryon) + getRotatedCovMatrixXX(covVtxCharmBaryon, phiCharmBaryon, thetaCharmBaryon)); auto errorDecayLengthXYCharmBaryon = std::sqrt(getRotatedCovMatrixXX(primaryVertex.getCov(), phiCharmBaryon, 0.) + getRotatedCovMatrixXX(covVtxCharmBaryon, phiCharmBaryon, 0.)); - float ctOmegac = RecoDecay::ct(pVecCharmBaryon, decLenCharmBaryon, MassOmegaC0); - float ctXic = RecoDecay::ct(pVecCharmBaryon, decLenCharmBaryon, MassXiC0); + float const ctOmegac = RecoDecay::ct(pVecCharmBaryon, decLenCharmBaryon, MassOmegaC0); + float const ctXic = RecoDecay::ct(pVecCharmBaryon, decLenCharmBaryon, MassXiC0); float ctCascade = 0.; - if constexpr (decayChannel == hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi) { + if constexpr (DecayChannel == hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi) { ctCascade = RecoDecay::ct(pVecCasc, decLenCascade, MassXiMinus); } else { ctCascade = RecoDecay::ct(pVecCasc, decLenCascade, MassOmegaMinus); } - float ctV0 = RecoDecay::ct(pVecV0, decLenV0, MassLambda0); + float const ctV0 = RecoDecay::ct(pVecV0, decLenV0, MassLambda0); // computing eta - float pseudorapCharmBaryon = RecoDecay::eta(pVecCharmBaryon); - float pseudorapCascade = RecoDecay::eta(pVecCasc); - float pseudorapV0 = RecoDecay::eta(pVecV0); + float const pseudorapCharmBaryon = RecoDecay::eta(pVecCharmBaryon); + float const pseudorapCascade = RecoDecay::eta(pVecCasc); + float const pseudorapV0 = RecoDecay::eta(pVecV0); // DCA between daughters float dcaCascDau = casc.dcacascdaughters(); float dcaV0Dau = casc.dcaV0daughters(); - float dcaCharmBaryonDau = std::sqrt(df.getChi2AtPCACandidate()); + float const dcaCharmBaryonDau = std::sqrt(df.getChi2AtPCACandidate()); // fill test histograms hInvMassCharmBaryon->Fill(mCharmBaryon); hCandidateCounter->Fill(3); // fill the table - if constexpr (decayChannel == hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi) { + if constexpr (DecayChannel == hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi) { rowCandToXiPi(collision.globalIndex(), pvCoord[0], pvCoord[1], pvCoord[2], vertexCharmBaryonFromFitter[0], vertexCharmBaryonFromFitter[1], vertexCharmBaryonFromFitter[2], @@ -673,7 +673,7 @@ struct HfCandidateCreatorXic0Omegac0 { dcaCascDau, dcaV0Dau, dcaCharmBaryonDau, decLenCharmBaryon, decLenCascade, decLenV0, errorDecayLengthCharmBaryon, errorDecayLengthXYCharmBaryon); - } else if constexpr (decayChannel == hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi) { + } else if constexpr (DecayChannel == hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi) { rowCandToOmegaPi(collision.globalIndex(), pvCoord[0], pvCoord[1], pvCoord[2], vertexCharmBaryonFromFitter[0], vertexCharmBaryonFromFitter[1], vertexCharmBaryonFromFitter[2], @@ -737,7 +737,7 @@ struct HfCandidateCreatorXic0Omegac0 { } // loop over LF Cascade-bachelor candidates } // end of run function - template + template void runKfOmegac0CreatorWithKFParticle(Coll const&, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/, MyKfTracksIU const& tracksIU, @@ -754,7 +754,7 @@ struct HfCandidateCreatorXic0Omegac0 { auto collision = cand.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -776,7 +776,7 @@ struct HfCandidateCreatorXic0Omegac0 { auto trackCharmBachelor = tracks.rawIteratorAt(trackCharmBachelorId); auto cascAodElement = cand.cascade_as(); hCascadesCounter->Fill(0); - int v0index = cascAodElement.v0Id(); + int const v0index = cascAodElement.v0Id(); if (!cascAodElement.has_kfCascData()) { continue; } @@ -797,18 +797,18 @@ struct HfCandidateCreatorXic0Omegac0 { // kaon <- casc TrackParCov auto omegaDauChargedTrackParCov = getTrackParCov(trackCascDauCharged); // convert tracks into KFParticle object - KFPTrack kfTrack0 = createKFPTrackFromTrack(trackV0Dau0); - KFPTrack kfTrack1 = createKFPTrackFromTrack(trackV0Dau1); - KFPTrack kfTrackBach = createKFPTrackFromTrack(trackCascDauCharged); - - KFParticle kfPosPr(kfTrack0, kProton); - KFParticle kfNegPi(kfTrack1, kPiMinus); - KFParticle kfNegKa(kfTrackBach, kKMinus); - KFParticle kfNegPiRej(kfTrackBach, kPiMinus); // rej - KFParticle kfPosPi(kfTrack0, kPiPlus); - KFParticle kfNegPr(kfTrack1, kProton); - KFParticle kfPosKa(kfTrackBach, kKPlus); - KFParticle kfPosPiRej(kfTrackBach, kPiPlus); // rej + KFPTrack const kfTrack0 = createKFPTrackFromTrack(trackV0Dau0); + KFPTrack const kfTrack1 = createKFPTrackFromTrack(trackV0Dau1); + KFPTrack const kfTrackBach = createKFPTrackFromTrack(trackCascDauCharged); + + KFParticle const kfPosPr(kfTrack0, kProton); + KFParticle const kfNegPi(kfTrack1, kPiMinus); + KFParticle const kfNegKa(kfTrackBach, kKMinus); + KFParticle const kfNegPiRej(kfTrackBach, kPiMinus); // rej + KFParticle const kfPosPi(kfTrack0, kPiPlus); + KFParticle const kfNegPr(kfTrack1, kProton); + KFParticle const kfPosKa(kfTrackBach, kKPlus); + KFParticle const kfPosPiRej(kfTrackBach, kPiPlus); // rej KFParticle kfBachKaon; KFParticle kfPos; @@ -842,16 +842,18 @@ struct HfCandidateCreatorXic0Omegac0 { // mass window cut on lambda before mass constraint float massLam, sigLam; kfV0.GetMass(massLam, sigLam); - if (std::abs(massLam - MassLambda0) > lambdaMassWindow) + if (std::abs(massLam - MassLambda0) > lambdaMassWindow) { continue; + } // err_mass>0 of Lambda - if (sigLam <= 0) + if (sigLam <= 0) { continue; + } kfOmegac0Candidate.chi2GeoV0 = kfV0.GetChi2(); KFParticle kfV0MassConstrained = kfV0; kfV0MassConstrained.SetNonlinearMassConstraint(o2::constants::physics::MassLambda); // set mass constrain to Lambda if (kfUseV0MassConstraint) { - KFParticle kfV0 = kfV0MassConstrained; + KFParticle const kfV0 = kfV0MassConstrained; } kfV0.TransportToDecayVertex(); @@ -876,10 +878,12 @@ struct HfCandidateCreatorXic0Omegac0 { kfOmega.GetMass(massCasc, sigCasc); kfOmegarej.GetMass(massCascrej, sigCascrej); // rej // err_massOmega > 0 - if (sigCasc <= 0) + if (sigCasc <= 0) { continue; - if (std::abs(massCasc - MassOmegaMinus) > massToleranceCascade) + } + if (std::abs(massCasc - MassOmegaMinus) > massToleranceCascade) { continue; + } kfOmegac0Candidate.chi2GeoCasc = kfOmega.GetChi2(); kfOmegac0Candidate.cascRejectInvmass = massCascrej; @@ -888,7 +892,7 @@ struct HfCandidateCreatorXic0Omegac0 { kfOmegaMassConstrained.SetNonlinearMassConstraint(o2::constants::physics::MassOmegaMinus); // set mass constrain to OmegaMinus if (kfUseCascadeMassConstraint) { // set mass constraint if requested - KFParticle kfOmega = kfOmegaMassConstrained; + KFParticle const kfOmega = kfOmegaMassConstrained; } registry.fill(HIST("hInvMassOmegaMinus"), massCasc); kfOmega.TransportToDecayVertex(); @@ -897,8 +901,8 @@ struct HfCandidateCreatorXic0Omegac0 { //__________________________________________ //*>~<* step 3 : reconstruc Omegac0 with KF // Create KF charm bach Pion from track - KFPTrack kfTrackBachPion = createKFPTrackFromTrack(trackCharmBachelor); - KFParticle kfBachPion(kfTrackBachPion, kPiPlus); + KFPTrack const kfTrackBachPion = createKFPTrackFromTrack(trackCharmBachelor); + KFParticle const kfBachPion(kfTrackBachPion, kPiPlus); const KFParticle* omegaC0Daugthers[2] = {&kfBachPion, &kfOmega}; // construct OmegaC0 @@ -912,15 +916,16 @@ struct HfCandidateCreatorXic0Omegac0 { } float massOmegaC0, sigOmegaC0; kfOmegaC0.GetMass(massOmegaC0, sigOmegaC0); - if (sigOmegaC0 <= 0) + if (sigOmegaC0 <= 0) { continue; + } hFitterStatus->Fill(0); hCandidateCounter->Fill(2); kfOmegaC0.TransportToDecayVertex(); // PV - KFPVertex kfVertex = createKFPVertexFromCollision(collision); - KFParticle kfPV(kfVertex); + KFPVertex const kfVertex = createKFPVertexFromCollision(collision); + KFParticle const kfPV(kfVertex); // set production vertex; kfNeg.SetProductionVertex(kfV0); @@ -962,8 +967,8 @@ struct HfCandidateCreatorXic0Omegac0 { //-------------------------- V0 info--------------------------- // pseudorapidity - float pseudorapV0Dau0 = kfPos.GetEta(); - float pseudorapV0Dau1 = kfNeg.GetEta(); + float const pseudorapV0Dau0 = kfPos.GetEta(); + float const pseudorapV0Dau1 = kfNeg.GetEta(); // info from from KFParticle std::array pVecV0 = {kfV0.GetPx(), kfV0.GetPy(), kfV0.GetPz()}; // pVec stands for vector containing the 3-momentum components @@ -973,7 +978,7 @@ struct HfCandidateCreatorXic0Omegac0 { //-------------------reconstruct cascade track------------------ // pseudorapidity - float pseudorapCascBachelor = kfBachKaonToOmega.GetEta(); + float const pseudorapCascBachelor = kfBachKaonToOmega.GetEta(); // info from KFParticle std::array vertexCasc = {kfOmega.GetX(), kfOmega.GetY(), kfOmega.GetZ()}; @@ -982,33 +987,33 @@ struct HfCandidateCreatorXic0Omegac0 { auto primaryVertex = getPrimaryVertex(collision); std::array pvCoord = {collision.posX(), collision.posY(), collision.posZ()}; std::array vertexCharmBaryonFromFitter = {0.0, 0.0, 0.0}; // This variable get from DCAfitter in default process, in KF process it is set as 0. - std::array pVecCharmBachelorAsD; + std::array pVecCharmBachelorAsD{}; pVecCharmBachelorAsD[0] = kfBachPionToOmegaC.GetPx(); pVecCharmBachelorAsD[1] = kfBachPionToOmegaC.GetPy(); pVecCharmBachelorAsD[2] = kfBachPionToOmegaC.GetPz(); std::array pVecCharmBaryon = {kfOmegaC0.GetPx(), kfOmegaC0.GetPy(), kfOmegaC0.GetPz()}; - std::array coordVtxCharmBaryon = {kfOmegaC0.GetX(), kfOmegaC0.GetY(), kfOmegaC0.GetZ()}; - auto covVtxCharmBaryon = kfOmegaC0.CovarianceMatrix(); + std::array const coordVtxCharmBaryon = {kfOmegaC0.GetX(), kfOmegaC0.GetY(), kfOmegaC0.GetZ()}; + auto* covVtxCharmBaryon = kfOmegaC0.CovarianceMatrix(); float covMatrixPV[6]; kfVertex.GetCovarianceMatrix(covMatrixPV); // impact parameters - std::array impactParameterV0Dau0; - std::array impactParameterV0Dau1; - std::array impactParameterKaFromCasc; + std::array impactParameterV0Dau0{}; + std::array impactParameterV0Dau1{}; + std::array impactParameterKaFromCasc{}; o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParCovV0Dau0, 2.f, matCorr, &impactParameterV0Dau0); o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParCovV0Dau1, 2.f, matCorr, &impactParameterV0Dau1); o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, omegaDauChargedTrackParCov, 2.f, matCorr, &impactParameterKaFromCasc); float dcaxyV0Dau0 = impactParameterV0Dau0[0]; float dcaxyV0Dau1 = impactParameterV0Dau1[0]; float dcaxyCascBachelor = impactParameterKaFromCasc[0]; - float dcazV0Dau0 = impactParameterV0Dau0[1]; - float dcazV0Dau1 = impactParameterV0Dau1[1]; - float dcazCascBachelor = impactParameterKaFromCasc[1]; + float const dcazV0Dau0 = impactParameterV0Dau0[1]; + float const dcazV0Dau1 = impactParameterV0Dau1[1]; + float const dcazCascBachelor = impactParameterKaFromCasc[1]; // pseudorapidity - float pseudorapCharmBachelor = kfBachPionToOmegaC.GetEta(); + float const pseudorapCharmBachelor = kfBachPionToOmegaC.GetEta(); // impact parameters o2::dataformats::DCA impactParameterCasc; @@ -1019,9 +1024,9 @@ struct HfCandidateCreatorXic0Omegac0 { float impactParBachFromCharmBaryonZ = impactParameterCharmBachelor.getZ(); // computing decay length and ctau - float decLenCharmBaryon = RecoDecay::distance(pvCoord, coordVtxCharmBaryon); - float decLenCascade = RecoDecay::distance(coordVtxCharmBaryon, vertexCasc); - float decLenV0 = RecoDecay::distance(vertexCasc, vertexV0); + float const decLenCharmBaryon = RecoDecay::distance(pvCoord, coordVtxCharmBaryon); + float const decLenCascade = RecoDecay::distance(coordVtxCharmBaryon, vertexCasc); + float const decLenV0 = RecoDecay::distance(vertexCasc, vertexV0); double phiCharmBaryon, thetaCharmBaryon; getPointDirection(std::array{kfV0.GetX(), kfV0.GetY(), kfV0.GetZ()}, coordVtxCharmBaryon, phiCharmBaryon, thetaCharmBaryon); @@ -1218,7 +1223,7 @@ struct HfCandidateCreatorXic0Omegac0 { } // loop over LF Cascade-bachelor candidates } // end of run function //========================================================== - template + template void runKfXic0CreatorWithKFParticle(Coll const&, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/, MyKfTracksIU const& tracksIU, @@ -1238,7 +1243,7 @@ struct HfCandidateCreatorXic0Omegac0 { auto collision = cand.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -1260,7 +1265,7 @@ struct HfCandidateCreatorXic0Omegac0 { auto trackCharmBachelor = tracks.rawIteratorAt(trackCharmBachelorId); auto cascAodElement = cand.cascade_as(); hCascadesCounter->Fill(0); - int v0index = cascAodElement.v0Id(); + int const v0index = cascAodElement.v0Id(); if (!cascAodElement.has_kfCascData()) { continue; } @@ -1282,16 +1287,16 @@ struct HfCandidateCreatorXic0Omegac0 { auto xiDauChargedTrackParCov = getTrackParCov(trackCascDauCharged); // convert tracks into KFParticle object - KFPTrack kfTrack0 = createKFPTrackFromTrack(trackV0Dau0); - KFPTrack kfTrack1 = createKFPTrackFromTrack(trackV0Dau1); - KFPTrack kfTrackBach = createKFPTrackFromTrack(trackCascDauCharged); + KFPTrack const kfTrack0 = createKFPTrackFromTrack(trackV0Dau0); + KFPTrack const kfTrack1 = createKFPTrackFromTrack(trackV0Dau1); + KFPTrack const kfTrackBach = createKFPTrackFromTrack(trackCascDauCharged); - KFParticle kfPosPr(kfTrack0, kProton); - KFParticle kfNegPi(kfTrack1, kPiMinus); - KFParticle kfNegBachPi(kfTrackBach, kPiMinus); - KFParticle kfPosPi(kfTrack0, kPiPlus); - KFParticle kfNegPr(kfTrack1, kProton); - KFParticle kfPosBachPi(kfTrackBach, kPiPlus); + KFParticle const kfPosPr(kfTrack0, kProton); + KFParticle const kfNegPi(kfTrack1, kPiMinus); + KFParticle const kfNegBachPi(kfTrackBach, kPiMinus); + KFParticle const kfPosPi(kfTrack0, kPiPlus); + KFParticle const kfNegPr(kfTrack1, kProton); + KFParticle const kfPosBachPi(kfTrackBach, kPiPlus); KFParticle kfBachPion; KFParticle kfPos; @@ -1322,15 +1327,18 @@ struct HfCandidateCreatorXic0Omegac0 { // mass window cut on lambda before mass constraint float massLam, sigLam; kfV0.GetMass(massLam, sigLam); - if (std::abs(massLam - MassLambda0) > lambdaMassWindow) + if (std::abs(massLam - MassLambda0) > lambdaMassWindow) { continue; + } // err_mass>0 of Lambda - if (sigLam <= 0) + if (sigLam <= 0) { continue; + } // chi2>0 && NDF>0 for selecting Lambda - if ((kfV0.GetNDF() <= 0 || kfV0.GetChi2() <= 0)) + if ((kfV0.GetNDF() <= 0 || kfV0.GetChi2() <= 0)) { continue; + } kfXic0Candidate.chi2GeoV0 = kfV0.GetChi2(); KFParticle kfV0MassConstrained = kfV0; @@ -1356,20 +1364,23 @@ struct HfCandidateCreatorXic0Omegac0 { float massCasc, sigCasc; kfXi.GetMass(massCasc, sigCasc); // err_massXi > 0 - if (sigCasc <= 0) + if (sigCasc <= 0) { continue; + } - if (std::abs(massCasc - MassXiMinus) > massToleranceCascade) + if (std::abs(massCasc - MassXiMinus) > massToleranceCascade) { continue; + } // chi2>0 && NDF>0 - if (kfXi.GetNDF() <= 0 || kfXi.GetChi2() <= 0) + if (kfXi.GetNDF() <= 0 || kfXi.GetChi2() <= 0) { continue; + } kfXic0Candidate.chi2GeoCasc = kfXi.GetChi2(); KFParticle kfXiMassConstrained = kfXi; kfXiMassConstrained.SetNonlinearMassConstraint(o2::constants::physics::MassXiMinus); // set mass constrain to XiMinus if (kfUseCascadeMassConstraint) { // set mass constraint if requested - KFParticle kfXi = kfXiMassConstrained; + KFParticle const kfXi = kfXiMassConstrained; } registry.fill(HIST("hInvMassXiMinus"), massCasc); kfXi.TransportToDecayVertex(); @@ -1377,8 +1388,8 @@ struct HfCandidateCreatorXic0Omegac0 { //__________________________________________ //*>~<* step 3 : reconstruc Xic0 with KF // Create KF charm bach Pion from track - KFPTrack kfTrackBachPion = createKFPTrackFromTrack(trackCharmBachelor); - KFParticle kfCharmBachPion(kfTrackBachPion, kPiPlus); + KFPTrack const kfTrackBachPion = createKFPTrackFromTrack(trackCharmBachelor); + KFParticle const kfCharmBachPion(kfTrackBachPion, kPiPlus); const KFParticle* xiC0Daugthers[2] = {&kfCharmBachPion, &kfXi}; // construct XiC0 @@ -1392,21 +1403,23 @@ struct HfCandidateCreatorXic0Omegac0 { } float massXiC0, sigXiC0; kfXiC0.GetMass(massXiC0, sigXiC0); - if (sigXiC0 <= 0) + if (sigXiC0 <= 0) { continue; + } // chi2>0 && NDF>0 - if (kfXiC0.GetNDF() <= 0 || kfXiC0.GetChi2() <= 0) + if (kfXiC0.GetNDF() <= 0 || kfXiC0.GetChi2() <= 0) { continue; + } hFitterStatus->Fill(0); hCandidateCounter->Fill(2); kfXiC0.TransportToDecayVertex(); // PV - KFPVertex kfVertex = createKFPVertexFromCollision(collision); - KFParticle kfPV(kfVertex); + KFPVertex const kfVertex = createKFPVertexFromCollision(collision); + KFParticle const kfPV(kfVertex); - KFParticle kfPosOrigin = kfPos; - KFParticle kfNegOrigin = kfNeg; + KFParticle const kfPosOrigin = kfPos; + KFParticle const kfNegOrigin = kfNeg; // set production vertex; kfNeg.SetProductionVertex(kfV0); kfPos.SetProductionVertex(kfV0); @@ -1447,8 +1460,8 @@ struct HfCandidateCreatorXic0Omegac0 { //-------------------------- V0 info--------------------------- // pseudorapidity - float pseudorapV0Dau0 = kfPos.GetEta(); - float pseudorapV0Dau1 = kfNeg.GetEta(); + float const pseudorapV0Dau0 = kfPos.GetEta(); + float const pseudorapV0Dau1 = kfNeg.GetEta(); // info from from KFParticle std::array pVecV0 = {kfV0.GetPx(), kfV0.GetPy(), kfV0.GetPz()}; // pVec stands for vector containing the 3-momentum components @@ -1458,36 +1471,36 @@ struct HfCandidateCreatorXic0Omegac0 { //-------------------reconstruct cascade track------------------ // pseudorapidity - float pseudorapCascBachelor = kfBachPionToXi.GetEta(); + float const pseudorapCascBachelor = kfBachPionToXi.GetEta(); // info from KFParticle std::array vertexCasc = {kfXi.GetX(), kfXi.GetY(), kfXi.GetZ()}; std::array pVecCascBachelor = {kfBachPionToXi.GetPx(), kfBachPionToXi.GetPy(), kfBachPionToXi.GetPz()}; std::array pvCoord = {collision.posX(), collision.posY(), collision.posZ()}; - std::array pVecCharmBachelorAsD; + std::array pVecCharmBachelorAsD{}; pVecCharmBachelorAsD[0] = kfCharmBachPionToXiC.GetPx(); pVecCharmBachelorAsD[1] = kfCharmBachPionToXiC.GetPy(); pVecCharmBachelorAsD[2] = kfCharmBachPionToXiC.GetPz(); std::array pVecCharmBaryon = {kfXiC0.GetPx(), kfXiC0.GetPy(), kfXiC0.GetPz()}; - auto covVtxCharmBaryon = kfXiC0.CovarianceMatrix(); + auto* covVtxCharmBaryon = kfXiC0.CovarianceMatrix(); float covMatrixPV[6]; kfVertex.GetCovarianceMatrix(covMatrixPV); // impact parameters - std::array impactParameterV0Dau0; - std::array impactParameterV0Dau1; - std::array impactParameterPiFromCasc; + std::array impactParameterV0Dau0{}; + std::array impactParameterV0Dau1{}; + std::array impactParameterPiFromCasc{}; o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParCovV0Dau0, 2.f, matCorr, &impactParameterV0Dau0); o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParCovV0Dau1, 2.f, matCorr, &impactParameterV0Dau1); o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, xiDauChargedTrackParCov, 2.f, matCorr, &impactParameterPiFromCasc); - float dcaxyV0Dau0 = impactParameterV0Dau0[0]; - float dcaxyV0Dau1 = impactParameterV0Dau1[0]; - float dcaxyCascBachelor = impactParameterPiFromCasc[0]; + float const dcaxyV0Dau0 = impactParameterV0Dau0[0]; + float const dcaxyV0Dau1 = impactParameterV0Dau1[0]; + float const dcaxyCascBachelor = impactParameterPiFromCasc[0]; // pseudorapidity - float pseudorapCharmBachelor = kfCharmBachPionToXiC.GetEta(); + float const pseudorapCharmBachelor = kfCharmBachPionToXiC.GetEta(); // fill test histograms hInvMassCharmBaryon->Fill(massXiC0); @@ -1632,7 +1645,7 @@ struct HfCandidateCreatorXic0Omegac0 { } // loop over LF Cascade-bachelor candidates } - template + template void runOmegac0Xic0ToOmegaKaCreatorWithKFParticle(Coll const&, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/, MyKfTracksIU const& tracksIU, @@ -1650,7 +1663,7 @@ struct HfCandidateCreatorXic0Omegac0 { //----------------------check if the event is selected----------------------------- auto collision = cand.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -1688,10 +1701,10 @@ struct HfCandidateCreatorXic0Omegac0 { auto kaFromOmegaCharge = trackKaFromOmega.sign(); auto signOmega = casc.sign(); - KFPTrack kfpTrackKaFromCharm = createKFPTrackFromTrack(trackKaFromCharm); - KFPTrack kfpTrackKaFromOmega = createKFPTrackFromTrack(trackKaFromOmega); - KFPTrack kfpTrackV0DauPos = createKFPTrackFromTrack(trackV0DauPos); - KFPTrack kfpTrackV0DauNeg = createKFPTrackFromTrack(trackV0DauNeg); + KFPTrack const kfpTrackKaFromCharm = createKFPTrackFromTrack(trackKaFromCharm); + KFPTrack const kfpTrackKaFromOmega = createKFPTrackFromTrack(trackKaFromOmega); + KFPTrack const kfpTrackV0DauPos = createKFPTrackFromTrack(trackV0DauPos); + KFPTrack const kfpTrackV0DauNeg = createKFPTrackFromTrack(trackV0DauNeg); KFParticle kfPrFromV0(kfpTrackV0DauPos, kProton); KFParticle kfPiFromV0(kfpTrackV0DauNeg, kPiMinus); @@ -1746,14 +1759,17 @@ struct HfCandidateCreatorXic0Omegac0 { // mass window cut on lambda before mass constraint float massLam, sigLam; kfV0.GetMass(massLam, sigLam); - if (std::abs(massLam - MassLambda0) > lambdaMassWindow) + if (std::abs(massLam - MassLambda0) > lambdaMassWindow) { continue; + } // err_mass>0 of Lambda - if (sigLam <= 0) + if (sigLam <= 0) { continue; + } // chi2>0 && NDF>0 for selecting Lambda - if ((kfV0.GetNDF() <= 0 || kfV0.GetChi2() <= 0)) + if ((kfV0.GetNDF() <= 0 || kfV0.GetChi2() <= 0)) { continue; + } KFParticle kfV0MassConstrained = kfV0; kfV0MassConstrained.SetNonlinearMassConstraint(o2::constants::physics::MassLambda); // set mass constrain to Lambda if (kfUseV0MassConstraint) { @@ -1781,13 +1797,16 @@ struct HfCandidateCreatorXic0Omegac0 { kfOmega.GetMass(massCasc, sigCasc); kfOmegarej.GetMass(massCascrej, sigCascrej); // rej // err_massOmega and err_massXiRej > 0 - if (sigCasc <= 0 || sigCascrej <= 0) + if (sigCasc <= 0 || sigCascrej <= 0) { continue; + } // chi2>0 && NDF>0 - if (kfOmega.GetNDF() <= 0 || kfOmega.GetChi2() <= 0) + if (kfOmega.GetNDF() <= 0 || kfOmega.GetChi2() <= 0) { continue; - if ((std::abs(massCasc - MassOmegaMinus) > massToleranceCascade) || (std::abs(massCascrej - MassXiMinus) < massToleranceCascadeRej)) + } + if ((std::abs(massCasc - MassOmegaMinus) > massToleranceCascade) || (std::abs(massCascrej - MassXiMinus) < massToleranceCascadeRej)) { continue; + } registry.fill(HIST("hInvMassXiMinus_rej"), massCascrej); // rej: Add competing rejection to minimize misidentified Xi impact. Reject if kfBachPionRej is Pion and the constructed cascade has Xi's invariant mass. KFParticle kfOmegaMassConstrained = kfOmega; kfOmegaMassConstrained.SetNonlinearMassConstraint(o2::constants::physics::MassOmegaMinus); // set mass constrain to XiMinus @@ -1813,19 +1832,21 @@ struct HfCandidateCreatorXic0Omegac0 { } float massOmegaKa, sigOmegaKa; kfOmegaKa.GetMass(massOmegaKa, sigOmegaKa); - if (sigOmegaKa <= 0) + if (sigOmegaKa <= 0) { continue; - if (kfOmegaKa.GetNDF() <= 0 || kfOmegaKa.GetChi2() <= 0) + } + if (kfOmegaKa.GetNDF() <= 0 || kfOmegaKa.GetChi2() <= 0) { continue; + } kfOmegaKa.TransportToDecayVertex(); hFitterStatus->Fill(0); hCandidateCounter->Fill(2); // initialize primary vertex - KFPVertex kfpVertex = createKFPVertexFromCollision(collision); + KFPVertex const kfpVertex = createKFPVertexFromCollision(collision); float covMatrixPV[6]; kfpVertex.GetCovarianceMatrix(covMatrixPV); - KFParticle kfPv(kfpVertex); // for calculation of DCAs to PV + KFParticle const kfPv(kfpVertex); // for calculation of DCAs to PV // fill test histograms hInvMassCharmBaryon->Fill(massOmegaKa); @@ -1874,40 +1895,40 @@ struct HfCandidateCreatorXic0Omegac0 { kfOmega.GetDistanceFromVertexXY(kfPv, impactParameterOmegaXY, errImpactParameterOmegaXY); // calculate cosine of pointing angle - float cosPaV0ToPv = cpaFromKF(kfV0, kfPv); - float cosPaCascToPv = cpaFromKF(kfOmega, kfPv); - float cosPaOmegaKaToPv = cpaFromKF(kfOmegaKa, kfPv); - float cosPaXYV0ToPv = cpaXYFromKF(kfV0, kfPv); - float cosPaXYCascToPv = cpaXYFromKF(kfOmega, kfPv); - float cosPaXYOmegaKaToPv = cpaXYFromKF(kfOmegaKa, kfPv); - float cosPaV0ToCasc = cpaFromKF(kfV0, kfOmega); - float cosPaCascToOmegaKa = cpaFromKF(kfOmega, kfOmegaKa); - float cosPaXYV0ToCasc = cpaXYFromKF(kfV0, kfOmega); - float cosPaXYCascToOmegaKa = cpaXYFromKF(kfOmega, kfOmegaKa); + float const cosPaV0ToPv = cpaFromKF(kfV0, kfPv); + float const cosPaCascToPv = cpaFromKF(kfOmega, kfPv); + float const cosPaOmegaKaToPv = cpaFromKF(kfOmegaKa, kfPv); + float const cosPaXYV0ToPv = cpaXYFromKF(kfV0, kfPv); + float const cosPaXYCascToPv = cpaXYFromKF(kfOmega, kfPv); + float const cosPaXYOmegaKaToPv = cpaXYFromKF(kfOmegaKa, kfPv); + float const cosPaV0ToCasc = cpaFromKF(kfV0, kfOmega); + float const cosPaCascToOmegaKa = cpaFromKF(kfOmega, kfOmegaKa); + float const cosPaXYV0ToCasc = cpaXYFromKF(kfV0, kfOmega); + float const cosPaXYCascToOmegaKa = cpaXYFromKF(kfOmega, kfOmegaKa); // Get Chi2Geo/NDF - float chi2GeoV0 = kfV0.GetChi2() / kfV0.GetNDF(); - float chi2GeoCasc = kfOmega.GetChi2() / kfOmega.GetNDF(); - float chi2GeoOmegaKa = kfOmegaKa.GetChi2() / kfOmegaKa.GetNDF(); + float const chi2GeoV0 = kfV0.GetChi2() / kfV0.GetNDF(); + float const chi2GeoCasc = kfOmega.GetChi2() / kfOmega.GetNDF(); + float const chi2GeoOmegaKa = kfOmegaKa.GetChi2() / kfOmegaKa.GetNDF(); // Get Chi2Topo/NDF - float chi2NdfTopoV0ToCasc = kfV0ToOmega.GetChi2() / kfV0ToOmega.GetNDF(); - float chi2NdfTopoKaToCasc = kfKaToOmega.GetChi2() / kfKaToOmega.GetNDF(); - float chi2NdfTopoKaFromOmegaKaToOmegaKa = kfKaFromCharmToOmegaKa.GetChi2() / kfKaFromCharmToOmegaKa.GetNDF(); - float chi2NdfTopoCascToOmegaKa = kfOmegaToOmegaKa.GetChi2() / kfOmegaToOmegaKa.GetNDF(); - float chi2NdfTopoV0ToPv = kfV0ToPv.GetChi2() / kfV0ToPv.GetNDF(); - float chi2NdfTopoCascToPv = kfOmegaToPv.GetChi2() / kfOmegaToPv.GetNDF(); - float chi2NdfTopoOmegaKaToPv = kfCharmToPv.GetChi2() / kfCharmToPv.GetNDF(); - float chi2NdfTopoKaFromOmegaKaToPv = kfKaFromCharmToPv.GetChi2() / kfKaFromCharmToPv.GetNDF(); + float const chi2NdfTopoV0ToCasc = kfV0ToOmega.GetChi2() / kfV0ToOmega.GetNDF(); + float const chi2NdfTopoKaToCasc = kfKaToOmega.GetChi2() / kfKaToOmega.GetNDF(); + float const chi2NdfTopoKaFromOmegaKaToOmegaKa = kfKaFromCharmToOmegaKa.GetChi2() / kfKaFromCharmToOmegaKa.GetNDF(); + float const chi2NdfTopoCascToOmegaKa = kfOmegaToOmegaKa.GetChi2() / kfOmegaToOmegaKa.GetNDF(); + float const chi2NdfTopoV0ToPv = kfV0ToPv.GetChi2() / kfV0ToPv.GetNDF(); + float const chi2NdfTopoCascToPv = kfOmegaToPv.GetChi2() / kfOmegaToPv.GetNDF(); + float const chi2NdfTopoOmegaKaToPv = kfCharmToPv.GetChi2() / kfCharmToPv.GetNDF(); + float const chi2NdfTopoKaFromOmegaKaToPv = kfKaFromCharmToPv.GetChi2() / kfKaFromCharmToPv.GetNDF(); // Get MassChi2/NDF auto v0Chi2OverNdfm = kfV0MassConstrained.GetChi2() / kfV0MassConstrained.GetNDF(); auto cascChi2OverNdfm = kfOmegaMassConstrained.GetChi2() / kfOmegaMassConstrained.GetNDF(); // KF ldl - float ldlV0 = ldlFromKF(kfV0, kfPv); - float ldlCasc = ldlFromKF(kfOmega, kfPv); - float ldlOmegaKa = ldlFromKF(kfOmegaKa, kfPv); + float const ldlV0 = ldlFromKF(kfV0, kfPv); + float const ldlCasc = ldlFromKF(kfOmega, kfPv); + float const ldlOmegaKa = ldlFromKF(kfOmegaKa, kfPv); // KF decay length float decayLxyLam, errDecayLxyLam; @@ -1918,18 +1939,18 @@ struct HfCandidateCreatorXic0Omegac0 { kfCharmToPv.GetDecayLengthXY(decayLxyOmegaKa, errDecayLxyOmegaKa); // KF pT - float ptOmegaKa = kfOmegaKa.GetPt(); - float ptKaFromCharm = kfKaFromCharm.GetPt(); - float ptOmega = kfOmega.GetPt(); + float const ptOmegaKa = kfOmegaKa.GetPt(); + float const ptKaFromCharm = kfKaFromCharm.GetPt(); + float const ptOmega = kfOmega.GetPt(); // KF cosThetaStar - float cosThetaStarKaFromOmegac = cosThetaStarFromKF(0, 4332, 321, 3334, kfKaFromCharmToOmegaKa, kfOmegaToOmegaKa); - float cosThetaStarKaFromXic = cosThetaStarFromKF(0, 4132, 321, 3334, kfKaFromCharmToOmegaKa, kfOmegaToOmegaKa); + float const cosThetaStarKaFromOmegac = cosThetaStarFromKF(0, 4332, 321, 3334, kfKaFromCharmToOmegaKa, kfOmegaToOmegaKa); + float const cosThetaStarKaFromXic = cosThetaStarFromKF(0, 4132, 321, 3334, kfKaFromCharmToOmegaKa, kfOmegaToOmegaKa); // KF ct - float ctV0 = kfV0ToOmega.GetLifeTime(); - float ctCasc = kfOmegaToOmegaKa.GetLifeTime(); - float ctOmegaKa = kfCharmToPv.GetLifeTime(); + float const ctV0 = kfV0ToOmega.GetLifeTime(); + float const ctCasc = kfOmegaToOmegaKa.GetLifeTime(); + float const ctOmegaKa = kfCharmToPv.GetLifeTime(); hCandidateCounter->Fill(3); @@ -2309,7 +2330,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { const auto& workflows = initContext.services().get(); for (const DeviceSpec& device : workflows.devices) { - if (device.name.compare("hf-candidate-creator-xic0-omegac0") == 0) { + if (device.name == "hf-candidate-creator-xic0-omegac0") { // init HF event selection helper hfEvSelMc.init(device, registry); break; @@ -2330,10 +2351,10 @@ struct HfCandidateCreatorXic0Omegac0Mc { // QA if (doprocessMcXicToXiPiKfQa) { - AxisSpec axisPt{20, 0., 20.}; - AxisSpec axisDelta{1000, -0.5, 0.5}; - AxisSpec axisPull{2000, -10., 10.}; - AxisSpec axisPtRes{400, -0.2, 0.2}; + AxisSpec const axisPt{20, 0., 20.}; + AxisSpec const axisDelta{1000, -0.5, 0.5}; + AxisSpec const axisPull{2000, -10., 10.}; + AxisSpec const axisPtRes{400, -0.2, 0.2}; // mass over pt registry.add("hV0MassPullVsPt", "m_{PULL}(V0) vs. p_{T}", HistType::kTH2D, {axisPt, axisPull}); registry.add("hXiMassPullVsPt", "m_{PULL}(#Xi^{-}) vs. p_{T}", HistType::kTH2D, {axisPt, axisPull}); @@ -2464,7 +2485,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { } } - template + template void runXic0Omegac0Mc(TMyRecoCand const& candidates, MyTracksWMc const&, aod::McParticles const& mcParticles, @@ -2528,7 +2549,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { } } // Xic0 -> xi pi matching - if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::XiczeroToXiPi) { + if constexpr (DecayChannel == aod::hf_cand_xic0_omegac0::DecayType::XiczeroToXiPi) { // Xic → pi pi pi p indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, +kXiC0, std::array{+kPiPlus, +kPiMinus, +kProton, +kPiMinus}, true, &sign, 3); indexRecCharmBaryon = indexRec; @@ -2567,7 +2588,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { if (debug == McMatchFlag::CascUnmatched || debug == McMatchFlag::V0Unmatched) { LOGF(info, "WARNING: Xic0ToXiPi decays in the expected final state but the condition on the intermediate states are not fulfilled"); } - } else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToXiPi) { // Omegac -> xi pi matching + } else if constexpr (DecayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToXiPi) { // Omegac -> xi pi matching // Omegac → pi pi pi p indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, +kOmegaC0, std::array{+kPiPlus, +kPiMinus, +kProton, +kPiMinus}, true, &sign, 3); indexRecCharmBaryon = indexRec; @@ -2606,7 +2627,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { if (debug == McMatchFlag::CascUnmatched || debug == McMatchFlag::V0Unmatched) { LOGF(info, "WARNING: Omegac0ToXiPi decays in the expected final state but the condition on the intermediate states are not fulfilled"); } - } else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaPi) { // Omegac0 -> omega pi matching + } else if constexpr (DecayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaPi) { // Omegac0 -> omega pi matching if (acceptTrackIntWithMaterial) { // Omegac → pi K pi p indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, +kOmegaC0, std::array{+kPiPlus, +kKMinus, +kProton, +kPiMinus}, true, &sign, 3, &nPiToMuOmegac0, &nKaToPiOmegac0); @@ -2678,7 +2699,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { if (debug == McMatchFlag::CascUnmatched || debug == McMatchFlag::V0Unmatched) { LOGF(info, "WARNING: Omegac0ToOmegaPi decays in the expected final state but the condition on the intermediate states are not fulfilled"); } - } else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaK) { // Omegac0 -> omega K matching + } else if constexpr (DecayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaK) { // Omegac0 -> omega K matching // Omegac → K K pi p indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, +kOmegaC0, std::array{+kKPlus, +kKMinus, +kProton, +kPiMinus}, true, &sign, 3); indexRecCharmBaryon = indexRec; @@ -2728,30 +2749,30 @@ struct HfCandidateCreatorXic0Omegac0Mc { float centrality{-1.f}; o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; int nSplitColl = 0; - if constexpr (centEstimator == CentralityEstimator::FT0C) { + if constexpr (CentEstimator == CentralityEstimator::FT0C) { const auto collSlice = collsWithMcLabels.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); nSplitColl = collSlice.size(); - } else if constexpr (centEstimator == CentralityEstimator::FT0M) { + } else if constexpr (CentEstimator == CentralityEstimator::FT0M) { const auto collSlice = collsWithMcLabels.sliceBy(colPerMcCollisionFT0M, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); nSplitColl = collSlice.size(); - } else if constexpr (centEstimator == CentralityEstimator::None) { + } else if constexpr (CentEstimator == CentralityEstimator::None) { const auto collSlice = collsWithMcLabels.sliceBy(colPerMcCollision, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); nSplitColl = collSlice.size(); } - hfEvSelMc.fillHistograms(mcCollision, rejectionMask, nSplitColl); + hfEvSelMc.fillHistograms(mcCollision, rejectionMask, nSplitColl); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject all particles from this collision for (unsigned int i = 0; i < mcParticlesPerMcColl.size(); ++i) { - if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::XiczeroToXiPi) { + if constexpr (DecayChannel == aod::hf_cand_xic0_omegac0::DecayType::XiczeroToXiPi) { rowMCMatchGenXicToXiPi(0, 0, 0, 0, -999., -999., RecoDecay::OriginType::None, -1); - } else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToXiPi) { + } else if constexpr (DecayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToXiPi) { rowMCMatchGenOmegacToXiPi(0, 0, 0, 0, -999., -999., RecoDecay::OriginType::None, -1); - } else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaPi) { + } else if constexpr (DecayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaPi) { rowMCMatchGenToOmegaPi(0, 0, 0, 0, -999., -999., RecoDecay::OriginType::None, -1); - } else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaK) { + } else if constexpr (DecayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaK) { rowMCMatchGenToOmegaK(0, 0, 0, 0, -999., -999., RecoDecay::OriginType::None, -1); } } @@ -2769,24 +2790,24 @@ struct HfCandidateCreatorXic0Omegac0Mc { debugGenLambda = 0; origin = RecoDecay::OriginType::None; std::vector idxBhadMothers{}; - float kRapidityCutTight = 0.5; - float kRapidityCutLoose = 0.8; + float const kRapidityCutTight = 0.5; + float const kRapidityCutLoose = 0.8; // Reject particles from background events if (particle.fromBackgroundEvent() && rejectBackground) { - if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::XiczeroToXiPi) { + if constexpr (DecayChannel == aod::hf_cand_xic0_omegac0::DecayType::XiczeroToXiPi) { rowMCMatchGenXicToXiPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, rapidityCharmBaryonGen, origin, -1); - } else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToXiPi) { + } else if constexpr (DecayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToXiPi) { rowMCMatchGenOmegacToXiPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, rapidityCharmBaryonGen, origin, -1); - } else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaPi) { + } else if constexpr (DecayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaPi) { rowMCMatchGenToOmegaPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, rapidityCharmBaryonGen, origin, -1); - } else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaK) { + } else if constexpr (DecayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaK) { rowMCMatchGenToOmegaK(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, rapidityCharmBaryonGen, origin, -1); } continue; } - if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::XiczeroToXiPi) { + if constexpr (DecayChannel == aod::hf_cand_xic0_omegac0::DecayType::XiczeroToXiPi) { // Xic → Xi pi if (RecoDecay::isMatchedMCGen(mcParticles, particle, +kXiC0, std::array{+kXiMinus, +kPiPlus}, true, &sign)) { debugGenCharmBar = 1; @@ -2828,7 +2849,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { rowMCMatchGenXicToXiPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, rapidityCharmBaryonGen, origin, -1); } - } else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToXiPi) { + } else if constexpr (DecayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToXiPi) { // Omegac → Xi pi if (RecoDecay::isMatchedMCGen(mcParticles, particle, +kOmegaC0, std::array{+kXiMinus, +kPiPlus}, true, &sign)) { debugGenCharmBar = 1; @@ -2870,7 +2891,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { rowMCMatchGenOmegacToXiPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, rapidityCharmBaryonGen, origin, -1); } - } else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaPi) { + } else if constexpr (DecayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaPi) { // Omegac → Omega pi if (RecoDecay::isMatchedMCGen(mcParticles, particle, +kOmegaC0, std::array{+kOmegaMinus, +kPiPlus}, true, &sign)) { debugGenCharmBar = 1; @@ -2912,7 +2933,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { rowMCMatchGenToOmegaPi(flag, debugGenCharmBar, debugGenCasc, debugGenLambda, ptCharmBaryonGen, rapidityCharmBaryonGen, origin, -1); } - } else if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaK) { + } else if constexpr (DecayChannel == aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaK) { // Omegac → Omega K if (RecoDecay::isMatchedMCGen(mcParticles, particle, +kOmegaC0, std::array{+kOmegaMinus, +kKPlus}, true, &sign)) { debugGenCharmBar = 1; @@ -2958,7 +2979,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { } // close loop on MCCollisions } // close process - template + template void runXic0Omegac0McQa(TMyRecoCand const& candidates, MyTracksWMc const&, aod::McParticles const& mcParticles, @@ -2987,42 +3008,42 @@ struct HfCandidateCreatorXic0Omegac0Mc { auto mcXic0Bachelor = arrayDaughters[0].mcParticle(); // Xic0 -> xi pi matching - if constexpr (decayChannel == aod::hf_cand_xic0_omegac0::DecayType::XiczeroToXiPi) { + if constexpr (DecayChannel == aod::hf_cand_xic0_omegac0::DecayType::XiczeroToXiPi) { // Lambda → p pi indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersV0, +kLambda0, std::array{+kProton, +kPiMinus}, true, &signV0, 1); if (indexRec > -1 && signV0 == 1) { auto mcV0 = mcParticles.rawIteratorAt(indexRec - mcParticles.offset()); - float v0MassPull = (candidate.invMassLambda() - MassLambda0) / candidate.invMassV0Err(); + float const v0MassPull = (candidate.invMassLambda() - MassLambda0) / candidate.invMassV0Err(); registry.fill(HIST("hV0MassPullVsPt"), candidate.v0Pt(), v0MassPull); - float v0DauPosXDelta = candidate.v0DauPosX() - mcV0DauPos.vx(); - float v0DauPosYDelta = candidate.v0DauPosY() - mcV0DauPos.vy(); - float v0DauPosZDelta = candidate.v0DauPosZ() - mcV0DauPos.vz(); - float v0DauPosPt = mcV0DauPos.pt(); - float v0DauPosXPull = v0DauPosXDelta / candidate.v0DauPosXError(); - float v0DauPosYPull = v0DauPosYDelta / candidate.v0DauPosYError(); - float v0DauPosZPull = v0DauPosZDelta / candidate.v0DauPosZError(); - - float v0DauNegXDelta = candidate.v0DauNegX() - mcV0DauNeg.vx(); - float v0DauNegYDelta = candidate.v0DauNegY() - mcV0DauNeg.vy(); - float v0DauNegZDelta = candidate.v0DauNegZ() - mcV0DauNeg.vz(); - float v0DauNegPt = mcV0DauNeg.pt(); - float v0DauNegXPull = v0DauNegXDelta / candidate.v0DauNegXError(); - float v0DauNegYPull = v0DauNegYDelta / candidate.v0DauNegYError(); - float v0DauNegZPull = v0DauNegZDelta / candidate.v0DauNegZError(); - - float v0XDelta = candidate.v0VtxX() - mcV0DauNeg.vx(); - float v0YDelta = candidate.v0VtxY() - mcV0DauNeg.vy(); - float v0ZDelta = candidate.v0VtxZ() - mcV0DauNeg.vz(); - float v0Pt = mcV0.pt(); - float v0XPull = v0XDelta / candidate.v0XError(); - float v0YPull = v0YDelta / candidate.v0YError(); - float v0ZPull = v0ZDelta / candidate.v0ZError(); - - float lambdaXDelta = candidate.v0X() - mcV0DauNeg.vx(); - float lambdaYDelta = candidate.v0Y() - mcV0DauNeg.vy(); - float lambdaZDelta = candidate.v0Z() - mcV0DauNeg.vz(); + float const v0DauPosXDelta = candidate.v0DauPosX() - mcV0DauPos.vx(); + float const v0DauPosYDelta = candidate.v0DauPosY() - mcV0DauPos.vy(); + float const v0DauPosZDelta = candidate.v0DauPosZ() - mcV0DauPos.vz(); + float const v0DauPosPt = mcV0DauPos.pt(); + float const v0DauPosXPull = v0DauPosXDelta / candidate.v0DauPosXError(); + float const v0DauPosYPull = v0DauPosYDelta / candidate.v0DauPosYError(); + float const v0DauPosZPull = v0DauPosZDelta / candidate.v0DauPosZError(); + + float const v0DauNegXDelta = candidate.v0DauNegX() - mcV0DauNeg.vx(); + float const v0DauNegYDelta = candidate.v0DauNegY() - mcV0DauNeg.vy(); + float const v0DauNegZDelta = candidate.v0DauNegZ() - mcV0DauNeg.vz(); + float const v0DauNegPt = mcV0DauNeg.pt(); + float const v0DauNegXPull = v0DauNegXDelta / candidate.v0DauNegXError(); + float const v0DauNegYPull = v0DauNegYDelta / candidate.v0DauNegYError(); + float const v0DauNegZPull = v0DauNegZDelta / candidate.v0DauNegZError(); + + float const v0XDelta = candidate.v0VtxX() - mcV0DauNeg.vx(); + float const v0YDelta = candidate.v0VtxY() - mcV0DauNeg.vy(); + float const v0ZDelta = candidate.v0VtxZ() - mcV0DauNeg.vz(); + float const v0Pt = mcV0.pt(); + float const v0XPull = v0XDelta / candidate.v0XError(); + float const v0YPull = v0YDelta / candidate.v0YError(); + float const v0ZPull = v0ZDelta / candidate.v0ZError(); + + float const lambdaXDelta = candidate.v0X() - mcV0DauNeg.vx(); + float const lambdaYDelta = candidate.v0Y() - mcV0DauNeg.vy(); + float const lambdaZDelta = candidate.v0Z() - mcV0DauNeg.vz(); registry.fill(HIST("hV0DauPosXDelta"), v0DauPosXDelta); registry.fill(HIST("hV0DauPosYDelta"), v0DauPosYDelta); registry.fill(HIST("hV0DauPosZDelta"), v0DauPosZDelta); @@ -3073,30 +3094,30 @@ struct HfCandidateCreatorXic0Omegac0Mc { indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersCasc, +kXiMinus, std::array{+kPiMinus, +kProton, +kPiMinus}, true, &signCasc, 2); if (indexRec > -1 && signCasc == 1) { // QA - float xiMassPull = (candidate.invMassCascade() - MassXiMinus) / candidate.invMassXiErr(); + float const xiMassPull = (candidate.invMassCascade() - MassXiMinus) / candidate.invMassXiErr(); registry.fill(HIST("hXiMassPullVsPt"), candidate.xiPt(), xiMassPull); - float xiBachelorXDelta = candidate.xiBachelorX() - mcXiBachelor.vx(); - float xiBachelorYDelta = candidate.xiBachelorY() - mcXiBachelor.vy(); - float xiBachelorZDelta = candidate.xiBachelorZ() - mcXiBachelor.vz(); - float xiBachelorPt = mcXiBachelor.pt(); - float xiBachelorXPull = xiBachelorXDelta / candidate.xiBachelorXError(); - float xiBachelorYPull = xiBachelorYDelta / candidate.xiBachelorYError(); - float xiBachelorZPull = xiBachelorZDelta / candidate.xiBachelorZError(); + float const xiBachelorXDelta = candidate.xiBachelorX() - mcXiBachelor.vx(); + float const xiBachelorYDelta = candidate.xiBachelorY() - mcXiBachelor.vy(); + float const xiBachelorZDelta = candidate.xiBachelorZ() - mcXiBachelor.vz(); + float const xiBachelorPt = mcXiBachelor.pt(); + float const xiBachelorXPull = xiBachelorXDelta / candidate.xiBachelorXError(); + float const xiBachelorYPull = xiBachelorYDelta / candidate.xiBachelorYError(); + float const xiBachelorZPull = xiBachelorZDelta / candidate.xiBachelorZError(); auto mcXi = mcParticles.rawIteratorAt(indexRec - mcParticles.offset()); - float xiXDelta = candidate.xiX() - mcXiBachelor.vx(); - float xiYDelta = candidate.xiY() - mcXiBachelor.vy(); - float xiZDelta = candidate.xiZ() - mcXiBachelor.vz(); - float xiPt = mcXi.pt(); - float xiXPull = xiXDelta / candidate.xiXError(); - float xiYPull = xiYDelta / candidate.xiYError(); - float xiZPull = xiZDelta / candidate.xiZError(); + float const xiXDelta = candidate.xiX() - mcXiBachelor.vx(); + float const xiYDelta = candidate.xiY() - mcXiBachelor.vy(); + float const xiZDelta = candidate.xiZ() - mcXiBachelor.vz(); + float const xiPt = mcXi.pt(); + float const xiXPull = xiXDelta / candidate.xiXError(); + float const xiYPull = xiYDelta / candidate.xiYError(); + float const xiZPull = xiZDelta / candidate.xiZError(); - float cascXDelta = candidate.xDecayVtxCascade() - mcXiBachelor.vx(); - float cascYDelta = candidate.yDecayVtxCascade() - mcXiBachelor.vy(); - float cascZDelta = candidate.zDecayVtxCascade() - mcXiBachelor.vz(); + float const cascXDelta = candidate.xDecayVtxCascade() - mcXiBachelor.vx(); + float const cascYDelta = candidate.yDecayVtxCascade() - mcXiBachelor.vy(); + float const cascZDelta = candidate.zDecayVtxCascade() - mcXiBachelor.vz(); registry.fill(HIST("hXiBachelorXDelta"), xiBachelorXDelta); registry.fill(HIST("hXiBachelorYDelta"), xiBachelorYDelta); @@ -3135,24 +3156,24 @@ struct HfCandidateCreatorXic0Omegac0Mc { indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, +kXiC0, std::array{+kPiPlus, +kPiMinus, +kProton, +kPiMinus}, true, &sign, 3); if (indexRec > -1 && sign == 1) { auto mcXic0 = mcParticles.rawIteratorAt(indexRec - mcParticles.offset()); - float xic0MassPull = (candidate.invMassCharmBaryon() - MassXiC0) / candidate.invMassXic0Err(); + float const xic0MassPull = (candidate.invMassCharmBaryon() - MassXiC0) / candidate.invMassXic0Err(); registry.fill(HIST("hXic0MassPullVsPt"), candidate.xic0Pt(), xic0MassPull); - float xic0BachelorXDelta = candidate.xic0BachelorX() - mcXic0Bachelor.vx(); - float xic0BachelorYDelta = candidate.xic0BachelorY() - mcXic0Bachelor.vy(); - float xic0BachelorZDelta = candidate.xic0BachelorZ() - mcXic0Bachelor.vz(); - float xic0BachelorPt = mcXic0Bachelor.pt(); - float xic0BachelorXPull = xic0BachelorXDelta / candidate.xic0BachelorXError(); - float xic0BachelorYPull = xic0BachelorYDelta / candidate.xic0BachelorYError(); - float xic0BachelorZPull = xic0BachelorZDelta / candidate.xic0BachelorZError(); - - float xic0XDelta = candidate.xDecayVtxCharmBaryon() - mcXic0Bachelor.vx(); - float xic0YDelta = candidate.yDecayVtxCharmBaryon() - mcXic0Bachelor.vy(); - float xic0ZDelta = candidate.zDecayVtxCharmBaryon() - mcXic0Bachelor.vz(); - float xic0Pt = mcXic0.pt(); - float xic0XPull = xic0XDelta / candidate.xic0XError(); - float xic0YPull = xic0YDelta / candidate.xic0YError(); - float xic0ZPull = xic0ZDelta / candidate.xic0ZError(); + float const xic0BachelorXDelta = candidate.xic0BachelorX() - mcXic0Bachelor.vx(); + float const xic0BachelorYDelta = candidate.xic0BachelorY() - mcXic0Bachelor.vy(); + float const xic0BachelorZDelta = candidate.xic0BachelorZ() - mcXic0Bachelor.vz(); + float const xic0BachelorPt = mcXic0Bachelor.pt(); + float const xic0BachelorXPull = xic0BachelorXDelta / candidate.xic0BachelorXError(); + float const xic0BachelorYPull = xic0BachelorYDelta / candidate.xic0BachelorYError(); + float const xic0BachelorZPull = xic0BachelorZDelta / candidate.xic0BachelorZError(); + + float const xic0XDelta = candidate.xDecayVtxCharmBaryon() - mcXic0Bachelor.vx(); + float const xic0YDelta = candidate.yDecayVtxCharmBaryon() - mcXic0Bachelor.vy(); + float const xic0ZDelta = candidate.zDecayVtxCharmBaryon() - mcXic0Bachelor.vz(); + float const xic0Pt = mcXic0.pt(); + float const xic0XPull = xic0XDelta / candidate.xic0XError(); + float const xic0YPull = xic0YDelta / candidate.xic0YError(); + float const xic0ZPull = xic0ZDelta / candidate.xic0ZError(); registry.fill(HIST("hXic0BachelorXDelta"), xic0BachelorXDelta); registry.fill(HIST("hXic0BachelorYDelta"), xic0BachelorYDelta); registry.fill(HIST("hXic0BachelorZDelta"), xic0BachelorZDelta); diff --git a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx index f88a6d573c9..6a183d21c2f 100644 --- a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx @@ -68,7 +68,6 @@ #include #include #include -#include #include using namespace o2; @@ -110,7 +109,7 @@ struct HfCandidateCreatorXicToXiPiPi { Configurable rejDiffCollTrack{"rejDiffCollTrack", true, "Reject tracks coming from different collisions (effective only for KFParticle w/o derived data)"}; Service ccdb; - o2::base::MatLayerCylSet* lut; + o2::base::MatLayerCylSet* lut{}; o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; o2::vertexing::DCAFitterN<3> df; @@ -194,7 +193,7 @@ struct HfCandidateCreatorXicToXiPiPi { df.setWeightedFinalPCA(useWeightedFinalPCA); } - template + template void runXicplusCreatorWithDcaFitter(Collision const&, aod::HfCascLf3Prongs const& rowsTrackIndexXicPlus, CascadesLinked const&, @@ -209,7 +208,7 @@ struct HfCandidateCreatorXicToXiPiPi { // check if the event is selected auto collision = rowTrackIndexXicPlus.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -249,10 +248,10 @@ struct HfCandidateCreatorXicToXiPiPi { df.setBz(bz); //--------------------------info of V0 and cascades track from LF-tables--------------------------- - std::array vertexV0 = {casc.xlambda(), casc.ylambda(), casc.zlambda()}; - std::array pVecV0 = {casc.pxlambda(), casc.pylambda(), casc.pzlambda()}; - std::array vertexCasc = {casc.x(), casc.y(), casc.z()}; - std::array pVecCasc = {casc.px(), casc.py(), casc.pz()}; + std::array const vertexV0 = {casc.xlambda(), casc.ylambda(), casc.zlambda()}; + std::array const pVecV0 = {casc.pxlambda(), casc.pylambda(), casc.pzlambda()}; + std::array const vertexCasc = {casc.x(), casc.y(), casc.z()}; + std::array const pVecCasc = {casc.px(), casc.py(), casc.pz()}; std::array covCasc = {0.}; //----------------create cascade track------------------------------------------------------------ @@ -291,7 +290,7 @@ struct HfCandidateCreatorXicToXiPiPi { //----------------------------calculate physical properties----------------------- // Charge of charm baryon - int8_t signXic = casc.sign() < 0 ? +1 : -1; + int8_t const signXic = casc.sign() < 0 ? +1 : -1; // get SV properties const auto& secondaryVertex = df.getPCACandidate(); @@ -302,16 +301,16 @@ struct HfCandidateCreatorXicToXiPiPi { trackCasc = df.getTrack(0); trackParCovCharmBachelor0 = df.getTrack(1); trackParCovCharmBachelor1 = df.getTrack(2); - std::array pVecXi; - std::array pVecPi0; - std::array pVecPi1; + std::array pVecXi{}; + std::array pVecPi0{}; + std::array pVecPi1{}; trackCasc.getPxPyPzGlo(pVecXi); trackParCovCharmBachelor0.getPxPyPzGlo(pVecPi0); trackParCovCharmBachelor1.getPxPyPzGlo(pVecPi1); // get invariant mass of Xic candidate auto arrayMomenta = std::array{pVecXi, pVecPi0, pVecPi1}; - massXiPiPi = RecoDecay::m(std::move(arrayMomenta), std::array{MassXiMinus, MassPiPlus, MassPiPlus}); + massXiPiPi = RecoDecay::m(arrayMomenta, std::array{MassXiMinus, MassPiPlus, MassPiPlus}); // get track impact parameters // This modifies track momenta! @@ -326,19 +325,19 @@ struct HfCandidateCreatorXicToXiPiPi { trackParCovCharmBachelor1.propagateToDCA(primaryVertex, bz, &impactParameter1); // calculate cosine of pointing angle - std::array pvCoord = {collision.posX(), collision.posY(), collision.posZ()}; + std::array const pvCoord = {collision.posX(), collision.posY(), collision.posZ()}; float cpaLambda = casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ()); - float cpaXYLambda = RecoDecay::cpaXY(pvCoord, vertexV0, pVecV0); + float const cpaXYLambda = RecoDecay::cpaXY(pvCoord, vertexV0, pVecV0); float cpaXi = casc.casccosPA(collision.posX(), collision.posY(), collision.posZ()); - float cpaXYXi = RecoDecay::cpaXY(pvCoord, vertexCasc, pVecCasc); - float cpaLambdaToXi = RecoDecay::cpa(vertexCasc, vertexV0, pVecV0); - float cpaXYLambdaToXi = RecoDecay::cpaXY(vertexCasc, vertexV0, pVecV0); + float const cpaXYXi = RecoDecay::cpaXY(pvCoord, vertexCasc, pVecCasc); + float const cpaLambdaToXi = RecoDecay::cpa(vertexCasc, vertexV0, pVecV0); + float const cpaXYLambdaToXi = RecoDecay::cpaXY(vertexCasc, vertexV0, pVecV0); // get invariant mass of Xi-pi pairs auto arrayMomentaXiPi0 = std::array{pVecXi, pVecPi0}; - massXiPi0 = RecoDecay::m(std::move(arrayMomentaXiPi0), std::array{MassXiMinus, MassPiPlus}); + massXiPi0 = RecoDecay::m(arrayMomentaXiPi0, std::array{MassXiMinus, MassPiPlus}); auto arrayMomentaXiPi1 = std::array{pVecXi, pVecPi1}; - massXiPi1 = RecoDecay::m(std::move(arrayMomentaXiPi1), std::array{MassXiMinus, MassPiPlus}); + massXiPi1 = RecoDecay::m(arrayMomentaXiPi1, std::array{MassXiMinus, MassPiPlus}); // get uncertainty of the decay length float phi, theta; @@ -347,14 +346,14 @@ struct HfCandidateCreatorXicToXiPiPi { auto errorDecayLengthXY = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, 0.) + getRotatedCovMatrixXX(covMatrixSV, phi, 0.)); //--------------------- get PID information----------------------- - float nSigTpcPiFromXicPlus0 = trackCharmBachelor0.tpcNSigmaPi(); - float nSigTofPiFromXicPlus0 = trackCharmBachelor0.tofNSigmaPi(); - float nSigTpcPiFromXicPlus1 = trackCharmBachelor1.tpcNSigmaPi(); - float nSigTofPiFromXicPlus1 = trackCharmBachelor1.tofNSigmaPi(); + float const nSigTpcPiFromXicPlus0 = trackCharmBachelor0.tpcNSigmaPi(); + float const nSigTofPiFromXicPlus0 = trackCharmBachelor0.tofNSigmaPi(); + float const nSigTpcPiFromXicPlus1 = trackCharmBachelor1.tpcNSigmaPi(); + float const nSigTofPiFromXicPlus1 = trackCharmBachelor1.tofNSigmaPi(); // Bachelor pion auto trackPionFromXi = casc.bachelor_as(); - float nSigTpcBachelorPi = trackPionFromXi.tpcNSigmaPi(); - float nSigTofBachelorPi = trackPionFromXi.tofNSigmaPi(); + float const nSigTpcBachelorPi = trackPionFromXi.tpcNSigmaPi(); + float const nSigTofBachelorPi = trackPionFromXi.tofNSigmaPi(); // Lambda daughters auto trackPosLambdaDaughter = casc.posTrack_as(); auto trackNegLambdaDaughter = casc.negTrack_as(); @@ -427,7 +426,7 @@ struct HfCandidateCreatorXicToXiPiPi { } // loop over track triplets } - template + template void runXicplusCreatorWithKFParticle(Collision const&, aod::HfCascLf3Prongs const& rowsTrackIndexXicPlus, KFCascadesLinked const&, @@ -442,7 +441,7 @@ struct HfCandidateCreatorXicToXiPiPi { // check if the event is selected auto collision = rowTrackIndexXicPlus.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -482,21 +481,21 @@ struct HfCandidateCreatorXicToXiPiPi { KFParticle::SetField(bz); //----------------------info of V0 and cascade tracks from LF-table------------------ - std::array vertexV0 = {casc.xlambda(), casc.ylambda(), casc.zlambda()}; - std::array pVecV0 = {casc.pxlambda(), casc.pylambda(), casc.pzlambda()}; - std::array vertexCasc = {casc.x(), casc.y(), casc.z()}; - std::array pVecCasc = {casc.px(), casc.py(), casc.pz()}; + std::array const vertexV0 = {casc.xlambda(), casc.ylambda(), casc.zlambda()}; + std::array const pVecV0 = {casc.pxlambda(), casc.pylambda(), casc.pzlambda()}; + std::array const vertexCasc = {casc.x(), casc.y(), casc.z()}; + std::array const pVecCasc = {casc.px(), casc.py(), casc.pz()}; //----------------------Create XicPlus as KFParticle object------------------------------------------- // initialize primary vertex - KFPVertex kfpVertex = createKFPVertexFromCollision(collision); + KFPVertex const kfpVertex = createKFPVertexFromCollision(collision); float covMatrixPV[6]; kfpVertex.GetCovarianceMatrix(covMatrixPV); - KFParticle kfPv(kfpVertex); // for calculation of DCAs to PV + KFParticle const kfPv(kfpVertex); // for calculation of DCAs to PV // convert pion tracks into KFParticle object - KFPTrack kfpTrackCharmBachelor0 = createKFPTrackFromTrack(trackCharmBachelor0); - KFPTrack kfpTrackCharmBachelor1 = createKFPTrackFromTrack(trackCharmBachelor1); + KFPTrack const kfpTrackCharmBachelor0 = createKFPTrackFromTrack(trackCharmBachelor0); + KFPTrack const kfpTrackCharmBachelor1 = createKFPTrackFromTrack(trackCharmBachelor1); KFParticle kfCharmBachelor0(kfpTrackCharmBachelor0, kPiPlus); KFParticle kfCharmBachelor1(kfpTrackCharmBachelor1, kPiPlus); @@ -508,7 +507,7 @@ struct HfCandidateCreatorXicToXiPiPi { std::copy(xyzpxpypz.begin(), xyzpxpypz.end(), parPosMom); // create KFParticle KFParticle kfXi; - float massXi = casc.mXi(); + float const massXi = casc.mXi(); kfXi.Create(parPosMom, casc.kfTrackCovMat(), casc.sign(), massXi); if (useXiMassConstraint) { kfXi.SetNonlinearMassConstraint(MassXiMinus); @@ -527,7 +526,7 @@ struct HfCandidateCreatorXicToXiPiPi { registry.fill(HIST("hCandCounter"), VertexFit); // get chi2 values - float chi2GeoXicPlus = kfXicPlus.GetChi2() / kfXicPlus.GetNDF(); + float const chi2GeoXicPlus = kfXicPlus.GetChi2() / kfXicPlus.GetNDF(); float chi2PrimXi = kfXi.GetDeviationFromVertex(kfPv); float chi2PrimPi0 = kfCharmBachelor0.GetDeviationFromVertex(kfPv); float chi2PrimPi1 = kfCharmBachelor1.GetDeviationFromVertex(kfPv); @@ -544,7 +543,7 @@ struct HfCandidateCreatorXicToXiPiPi { //---------------------calculate physical parameters of XicPlus candidate---------------------- // sign of charm baryon - int8_t signXic = casc.sign() < 0 ? +1 : -1; + int8_t const signXic = casc.sign() < 0 ? +1 : -1; // transport XicPlus daughters to XicPlus decay vertex (secondary vertex) float secondaryVertex[3] = {0.}; @@ -564,13 +563,13 @@ struct HfCandidateCreatorXicToXiPiPi { kfXi.GetDistanceFromVertexXY(kfPv, impactParameterXiXY, errImpactParameterXiXY); // calculate cosine of pointing angle - std::array pvCoord = {collision.posX(), collision.posY(), collision.posZ()}; + std::array const pvCoord = {collision.posX(), collision.posY(), collision.posZ()}; float cpaLambda = casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ()); - float cpaXYLambda = RecoDecay::cpaXY(pvCoord, vertexV0, pVecV0); + float const cpaXYLambda = RecoDecay::cpaXY(pvCoord, vertexV0, pVecV0); float cpaXi = casc.casccosPA(collision.posX(), collision.posY(), collision.posZ()); - float cpaXYXi = RecoDecay::cpaXY(pvCoord, vertexCasc, pVecCasc); - float cpaLambdaToXi = RecoDecay::cpa(vertexCasc, vertexV0, pVecV0); - float cpaXYLambdaToXi = RecoDecay::cpaXY(vertexCasc, vertexV0, pVecV0); + float const cpaXYXi = RecoDecay::cpaXY(pvCoord, vertexCasc, pVecCasc); + float const cpaLambdaToXi = RecoDecay::cpa(vertexCasc, vertexV0, pVecV0); + float const cpaXYLambdaToXi = RecoDecay::cpaXY(vertexCasc, vertexV0, pVecV0); // get chi2 deviation of Pi0-Pi1, Pi0-Xi, Pi1-Xi float chi2DevPi0Pi1 = kfCharmBachelor0.GetDeviationFromParticle(kfCharmBachelor1); @@ -622,14 +621,14 @@ struct HfCandidateCreatorXicToXiPiPi { float kfDecayLengthXYNormalised = ldlXYFromKF(kfXicPlus, kfPv); //--------------------- get PID information----------------------- - float nSigTpcPiFromXicPlus0 = trackCharmBachelor0.tpcNSigmaPi(); - float nSigTofPiFromXicPlus0 = trackCharmBachelor0.tofNSigmaPi(); - float nSigTpcPiFromXicPlus1 = trackCharmBachelor1.tpcNSigmaPi(); - float nSigTofPiFromXicPlus1 = trackCharmBachelor1.tofNSigmaPi(); + float const nSigTpcPiFromXicPlus0 = trackCharmBachelor0.tpcNSigmaPi(); + float const nSigTofPiFromXicPlus0 = trackCharmBachelor0.tofNSigmaPi(); + float const nSigTpcPiFromXicPlus1 = trackCharmBachelor1.tpcNSigmaPi(); + float const nSigTofPiFromXicPlus1 = trackCharmBachelor1.tofNSigmaPi(); // Bachelor pion auto trackPionFromXi = casc.bachelor_as(); - float nSigTpcBachelorPi = trackPionFromXi.tpcNSigmaPi(); - float nSigTofBachelorPi = trackPionFromXi.tofNSigmaPi(); + float const nSigTpcBachelorPi = trackPionFromXi.tpcNSigmaPi(); + float const nSigTofBachelorPi = trackPionFromXi.tofNSigmaPi(); // Lambda daughters auto trackPosLambdaDaughter = casc.posTrack_as(); auto trackNegLambdaDaughter = casc.negTrack_as(); @@ -660,7 +659,7 @@ struct HfCandidateCreatorXicToXiPiPi { registry.fill(HIST("hCovPVXZ"), covMatrixPV[3]); registry.fill(HIST("hCovPVZZ"), covMatrixPV[5]); // covariance matrix elements of SV - auto covMatrixXicPlus = kfXicPlus.CovarianceMatrix(); + auto* covMatrixXicPlus = kfXicPlus.CovarianceMatrix(); registry.fill(HIST("hCovSVXX"), covMatrixXicPlus[0]); registry.fill(HIST("hCovSVYY"), covMatrixXicPlus[2]); registry.fill(HIST("hCovSVXZ"), covMatrixXicPlus[3]); @@ -891,14 +890,14 @@ struct HfCandidateCreatorXicToXiPiPiExpressions { // initialize HF event selection helper const auto& workflows = initContext.services().get(); for (const DeviceSpec& device : workflows.devices) { - if (device.name.compare("hf-candidate-creator-xic-to-xi-pi-pi") == 0) { + if (device.name == "hf-candidate-creator-xic-to-xi-pi-pi") { hfEvSelMc.init(device, registry); break; } } } - template + template void runMcMatching(aod::TracksWMc const& tracks, aod::McParticles const& mcParticles, McCollisions const& mcCollisions, @@ -918,7 +917,7 @@ struct HfCandidateCreatorXicToXiPiPiExpressions { // for resonance matching std::vector arrDaughIndex; constexpr std::size_t NDaughtersResonant{2u}; - std::array arrPDGDaugh; + std::array arrPDGDaugh{}; std::array arrXiResonance = {3324, kPiPlus}; // 3324: Ξ(1530) // for non-prompt std::vector idxBhadMothers; @@ -1074,18 +1073,18 @@ struct HfCandidateCreatorXicToXiPiPiExpressions { float centrality{-1.f}; o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; int nSplitColl = 0; - if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FT0C) { + if constexpr (CentEstimator == o2::hf_centrality::CentralityEstimator::FT0C) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); - } else if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FT0M) { + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + } else if constexpr (CentEstimator == o2::hf_centrality::CentralityEstimator::FT0M) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0M, mcCollision.globalIndex()); nSplitColl = collSlice.size(); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); - } else if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::None) { + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + } else if constexpr (CentEstimator == o2::hf_centrality::CentralityEstimator::None) { const auto collSlice = collInfos.sliceBy(colPerMcCollision, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } - hfEvSelMc.fillHistograms(mcCollision, rejectionMask, nSplitColl); + hfEvSelMc.fillHistograms(mcCollision, rejectionMask, nSplitColl); if (rejectionMask != 0) { // at least one event selection not satisfied --> reject all particles from this collision for (unsigned int i = 0; i < mcParticlesPerMcColl.size(); ++i) { diff --git a/PWGHF/TableProducer/candidateCreatorXicc.cxx b/PWGHF/TableProducer/candidateCreatorXicc.cxx index 915d6501d6f..380bae1445f 100644 --- a/PWGHF/TableProducer/candidateCreatorXicc.cxx +++ b/PWGHF/TableProducer/candidateCreatorXicc.cxx @@ -53,7 +53,7 @@ using namespace o2::framework::expressions; void customize(std::vector& workflowOptions) { - ConfigParamSpec optionDoMC{"doMC", VariantType::Bool, true, {"Perform MC matching."}}; + ConfigParamSpec const optionDoMC{"doMC", VariantType::Bool, true, {"Perform MC matching."}}; workflowOptions.push_back(optionDoMC); } @@ -121,7 +121,7 @@ struct HfCandidateCreatorXicc { aod::TracksWCov const& tracks) { for (const auto& xicCand : xicCands) { - if (!(xicCand.hfflag() & 1 << o2::aod::hf_cand_3prong::DecayType::XicToPKPi)) { + if ((xicCand.hfflag() & 1 << o2::aod::hf_cand_3prong::DecayType::XicToPKPi) == 0) { continue; } if (xicCand.isSelXicToPKPi() >= selectionFlagXic) { @@ -147,15 +147,15 @@ struct HfCandidateCreatorXicc { trackParVar1.propagateTo(secondaryVertex[0], bz); trackParVar2.propagateTo(secondaryVertex[0], bz); - std::array pvecpK = RecoDecay::pVec(track0.pVector(), track1.pVector()); + std::array const pvecpK = RecoDecay::pVec(track0.pVector(), track1.pVector()); std::array pvecxic = RecoDecay::pVec(pvecpK, track2.pVector()); auto trackpK = o2::dataformats::V0(df3.getPCACandidatePos(), pvecpK, df3.calcPCACovMatrixFlat(), trackParVar0, trackParVar1); auto trackxic = o2::dataformats::V0(df3.getPCACandidatePos(), pvecxic, df3.calcPCACovMatrixFlat(), trackpK, trackParVar2); - int index0Xic = track0.globalIndex(); - int index1Xic = track1.globalIndex(); - int index2Xic = track2.globalIndex(); - int charge = track0.sign() + track1.sign() + track2.sign(); + int const index0Xic = track0.globalIndex(); + int const index1Xic = track1.globalIndex(); + int const index2Xic = track2.globalIndex(); + int const charge = track0.sign() + track1.sign() + track2.sign(); for (const auto& trackpion : tracks) { if (trackpion.pt() < cutPtPionMin) { @@ -167,7 +167,7 @@ struct HfCandidateCreatorXicc { if (trackpion.globalIndex() == index0Xic || trackpion.globalIndex() == index1Xic || trackpion.globalIndex() == index2Xic) { continue; } - std::array pvecpion; + std::array pvecpion{}; auto trackParVarPi = getTrackParCov(trackpion); // reconstruct the 3-prong X vertex diff --git a/PWGHF/TableProducer/candidateSelectorB0ToDPi.cxx b/PWGHF/TableProducer/candidateSelectorB0ToDPi.cxx index 60709a4e4dc..dfcd47e3e1a 100644 --- a/PWGHF/TableProducer/candidateSelectorB0ToDPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorB0ToDPi.cxx @@ -97,7 +97,7 @@ struct HfCandidateSelectorB0ToDPi { o2::analysis::HfMlResponseB0ToDPi hfMlResponse; float outputMlNotPreselected = -1.; - std::vector outputMl = {}; + std::vector outputMl; o2::ccdb::CcdbApi ccdbApi; HfHelper hfHelper; @@ -159,7 +159,7 @@ struct HfCandidateSelectorB0ToDPi { /// \param withDmesMl is the flag to use the table with ML scores for the D- daughter (only possible if present in the derived data) /// \param hfCandsB0 B0 candidates /// \param pionTracks pion tracks - template + template void runSelection(Cands const& hfCandsB0, CandsDmes const& /*hfCandsD*/, TracksPion const& /*pionTracks*/) @@ -188,7 +188,7 @@ struct HfCandidateSelectorB0ToDPi { auto hfCandD = hfCandB0.template prong0_as(); std::vector mlScoresD; - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { std::copy(hfCandD.mlProbDplusToPiKPi().begin(), hfCandD.mlProbDplusToPiKPi().end(), std::back_inserter(mlScoresD)); if (!hfHelper.selectionDmesMlScoresForB(hfCandD, cutsDmesMl, binsPtDmesMl, mlScoresD)) { @@ -229,8 +229,8 @@ struct HfCandidateSelectorB0ToDPi { } if (applyB0Ml) { // B0 ML selections - std::vector inputFeatures = hfMlResponse.getInputFeatures(hfCandB0, trackPi, &mlScoresD); - bool isSelectedMl = hfMlResponse.isSelectedMl(inputFeatures, ptCandB0, outputMl); + std::vector inputFeatures = hfMlResponse.getInputFeatures(hfCandB0, trackPi, &mlScoresD); + bool const isSelectedMl = hfMlResponse.isSelectedMl(inputFeatures, ptCandB0, outputMl); hfMlB0ToDPiCandidate(outputMl[1]); // storing ML score for signal class if (!isSelectedMl) { diff --git a/PWGHF/TableProducer/candidateSelectorBplusToD0Pi.cxx b/PWGHF/TableProducer/candidateSelectorBplusToD0Pi.cxx index 1bcc8bff8e0..0a8e6503230 100644 --- a/PWGHF/TableProducer/candidateSelectorBplusToD0Pi.cxx +++ b/PWGHF/TableProducer/candidateSelectorBplusToD0Pi.cxx @@ -100,7 +100,7 @@ struct HfCandidateSelectorBplusToD0Pi { o2::analysis::HfMlResponseBplusToD0Pi hfMlResponse; float outputMlNotPreselected = -1.; - std::vector outputMl = {}; + std::vector outputMl; o2::ccdb::CcdbApi ccdbApi; HfHelper hfHelper; @@ -162,7 +162,7 @@ struct HfCandidateSelectorBplusToD0Pi { /// \param withDmesMl is the flag to use the table with ML scores for the D- daughter (only possible if present in the derived data) /// \param hfCandsBp B+ candidates /// \param pionTracks pion tracks - template + template void runSelection(Cands const& hfCandsBp, CandsDmes const& /*hfCandsD0*/, TracksPion const& /*pionTracks*/) @@ -190,7 +190,7 @@ struct HfCandidateSelectorBplusToD0Pi { auto trackPi = hfCandBp.template prong1_as(); auto hfCandD = hfCandBp.template prong0_as(); - if constexpr (withDmesMl) { + if constexpr (WithDmesMl) { std::vector mlScoresD; if (trackPi.sign() < 0) { std::copy(hfCandD.mlProbD0().begin(), hfCandD.mlProbD0().end(), std::back_inserter(mlScoresD)); @@ -240,8 +240,8 @@ struct HfCandidateSelectorBplusToD0Pi { if (trackPi.sign() > 0) { pdgCode = -1 * pdgCode; } - std::vector inputFeatures = hfMlResponse.getInputFeatures(hfCandBp, hfCandD, pdgCode, trackPi); - bool isSelectedMl = hfMlResponse.isSelectedMl(inputFeatures, ptCandBplus, outputMl); + std::vector inputFeatures = hfMlResponse.getInputFeatures(hfCandBp, hfCandD, pdgCode, trackPi); + bool const isSelectedMl = hfMlResponse.isSelectedMl(inputFeatures, ptCandBplus, outputMl); hfMlBplusToD0PiCandidate(outputMl[1]); // storing ML score for signal class if (!isSelectedMl) { diff --git a/PWGHF/TableProducer/candidateSelectorBsToDsPi.cxx b/PWGHF/TableProducer/candidateSelectorBsToDsPi.cxx index 05a66854ada..5e66076e670 100644 --- a/PWGHF/TableProducer/candidateSelectorBsToDsPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorBsToDsPi.cxx @@ -90,7 +90,7 @@ struct HfCandidateSelectorBsToDsPi { bool selectionFlagDsAndUsePidInSync = true; o2::analysis::HfMlResponse hfMlResponse; - std::vector outputMl = {}; + std::vector outputMl; o2::ccdb::CcdbApi ccdbApi; @@ -138,11 +138,11 @@ struct HfCandidateSelectorBsToDsPi { } int selectionFlagDs = -1; - auto& workflows = initContext.services().get(); + const auto& workflows = initContext.services().get(); for (const DeviceSpec& device : workflows.devices) { - if (device.name.compare("hf-candidate-creator-bs") == 0) { + if (device.name == "hf-candidate-creator-bs") { for (const auto& option : device.options) { - if (option.name.compare("selectionFlagDs") == 0) { + if (option.name == "selectionFlagDs") { selectionFlagDs = option.defaultValue.get(); LOGF(info, "selectionFlagDs = %d", selectionFlagDs); } @@ -197,7 +197,7 @@ struct HfCandidateSelectorBsToDsPi { // track-level PID selection if (usePid) { auto trackPi = hfCandBs.prong1_as(); - int pidTrackPi = selectorPion.statusTpcAndTof(trackPi); + int const pidTrackPi = selectorPion.statusTpcAndTof(trackPi); if (!hfHelper.selectionBsToDsPiPid(pidTrackPi, acceptPIDNotApplicable.value)) { hfSelBsToDsPiCandidate(statusBsToDsPi); if (applyMl) { @@ -223,7 +223,7 @@ struct HfCandidateSelectorBsToDsPi { hfCandBs.maxNormalisedDeltaIP(), hfCandBs.impactParameterProduct()}; - bool isSelectedMl = hfMlResponse.isSelectedMl(inputFeatures, ptCandBs, outputMl); + bool const isSelectedMl = hfMlResponse.isSelectedMl(inputFeatures, ptCandBs, outputMl); hfMlBsToDsPiCandidate(outputMl); if (!isSelectedMl) { diff --git a/PWGHF/TableProducer/candidateSelectorD0.cxx b/PWGHF/TableProducer/candidateSelectorD0.cxx index 98634b9cf08..48344fb7fa1 100644 --- a/PWGHF/TableProducer/candidateSelectorD0.cxx +++ b/PWGHF/TableProducer/candidateSelectorD0.cxx @@ -100,8 +100,8 @@ struct HfCandidateSelectorD0 { Configurable useTriggerMassCut{"useTriggerMassCut", false, "Flag to enable parametrize pT differential mass cut for triggered data"}; o2::analysis::HfMlResponseD0ToKPi hfMlResponse; - std::vector outputMlD0 = {}; - std::vector outputMlD0bar = {}; + std::vector outputMlD0; + std::vector outputMlD0bar; o2::ccdb::CcdbApi ccdbApi; TrackSelectorPi selectorPion; TrackSelectorKa selectorKaon; @@ -172,7 +172,7 @@ struct HfCandidateSelectorD0 { /// \param reconstructionType is the reconstruction type (DCAFitterN or KFParticle) /// \param candidate is candidate /// \return true if candidate passes all cuts - template + template bool selectionTopol(const T& candidate) { auto candpT = candidate.pt(); @@ -233,7 +233,7 @@ struct HfCandidateSelectorD0 { /// \param trackKaon is the track with the kaon hypothesis /// \note trackPion = positive and trackKaon = negative for D0 selection and inverse for D0bar /// \return true if candidate passes all cuts for the given Conjugate - template + template bool selectionTopolConjugate(const T1& candidate, const T2& trackPion, const T2& trackKaon) { auto candpT = candidate.pt(); @@ -244,7 +244,7 @@ struct HfCandidateSelectorD0 { // invariant-mass cut float massD0, massD0bar; - if constexpr (reconstructionType == aod::hf_cand::VertexerType::KfParticle) { + if constexpr (ReconstructionType == aod::hf_cand::VertexerType::KfParticle) { massD0 = candidate.kfGeoMassD0(); massD0bar = candidate.kfGeoMassD0bar(); } else { @@ -303,7 +303,7 @@ struct HfCandidateSelectorD0 { return true; } - template + template void processSel(CandType const& candidates, TracksSel const&) { @@ -344,7 +344,7 @@ struct HfCandidateSelectorD0 { } // conjugate-independent topological selection - if (!selectionTopol(candidate)) { + if (!selectionTopol(candidate)) { hfSelD0Candidate(statusD0, statusD0bar, statusHFFlag, statusTopol, statusCand, statusPID); if (applyMl) { hfMlD0Candidate(outputMlD0, outputMlD0bar); @@ -357,9 +357,9 @@ struct HfCandidateSelectorD0 { // need to add special cuts (additional cuts on decay length and d0 norm) // conjugate-dependent topological selection for D0 - bool topolD0 = selectionTopolConjugate(candidate, trackPos, trackNeg); + bool const topolD0 = selectionTopolConjugate(candidate, trackPos, trackNeg); // conjugate-dependent topological selection for D0bar - bool topolD0bar = selectionTopolConjugate(candidate, trackNeg, trackPos); + bool const topolD0bar = selectionTopolConjugate(candidate, trackNeg, trackPos); if (!topolD0 && !topolD0bar) { hfSelD0Candidate(statusD0, statusD0bar, statusHFFlag, statusTopol, statusCand, statusPID); diff --git a/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx b/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx index a531b6dbab0..1cb7e8d9a59 100644 --- a/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx @@ -94,8 +94,8 @@ struct HfCandidateSelectorDplusToPiKPi { Configurable useTriggerMassCut{"useTriggerMassCut", false, "Flag to enable parametrize pT differential mass cut for triggered data"}; HfMlResponseDplusToPiKPi hfMlResponse; - std::vector outputMlNotPreselected = {}; - std::vector outputMl = {}; + std::vector outputMlNotPreselected; + std::vector outputMl; o2::ccdb::CcdbApi ccdbApi; TrackSelectorPi selectorPion; TrackSelectorKa selectorKaon; @@ -154,7 +154,7 @@ struct HfCandidateSelectorDplusToPiKPi { bool selection(const T1& candidate, const T2& trackPion1, const T2& trackKaon, const T2& trackPion2) { auto ptCand = candidate.pt(); - int pTBin = findBin(binsPt, ptCand); + int const pTBin = findBin(binsPt, ptCand); if (pTBin == -1) { return false; } @@ -302,7 +302,7 @@ struct HfCandidateSelectorDplusToPiKPi { if (applyMl) { // ML selections std::vector inputFeatures = hfMlResponse.getInputFeatures(candidate); - bool isSelectedMl = hfMlResponse.isSelectedMl(inputFeatures, ptCand, outputMl); + bool const isSelectedMl = hfMlResponse.isSelectedMl(inputFeatures, ptCand, outputMl); hfMlDplusToPiKPiCandidate(outputMl); if (!isSelectedMl) { diff --git a/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx b/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx index 80f22343ff1..5f1f534cc27 100644 --- a/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx @@ -96,8 +96,8 @@ struct HfCandidateSelectorDsToKKPi { HfHelper hfHelper; o2::analysis::HfMlResponseDsToKKPi hfMlResponse; - std::vector outputMlDsToKKPi = {}; - std::vector outputMlDsToPiKK = {}; + std::vector outputMlDsToKKPi; + std::vector outputMlDsToPiKK; o2::ccdb::CcdbApi ccdbApi; TrackSelectorPi selectorPion; TrackSelectorKa selectorKaon; @@ -151,12 +151,9 @@ struct HfCandidateSelectorDsToKKPi { template bool isSelectedCandidateProngDca(const T1& candidate) { - if (isSelectedTrackDca(binsPtTrack, cutsSingleTrack, candidate.ptProng0(), candidate.impactParameter0(), candidate.impactParameterZ0()) && - isSelectedTrackDca(binsPtTrack, cutsSingleTrack, candidate.ptProng1(), candidate.impactParameter1(), candidate.impactParameterZ1()) && - isSelectedTrackDca(binsPtTrack, cutsSingleTrack, candidate.ptProng2(), candidate.impactParameter2(), candidate.impactParameterZ2())) { - return true; - } - return false; + return static_cast(isSelectedTrackDca(binsPtTrack, cutsSingleTrack, candidate.ptProng0(), candidate.impactParameter0(), candidate.impactParameterZ0()) && + isSelectedTrackDca(binsPtTrack, cutsSingleTrack, candidate.ptProng1(), candidate.impactParameter1(), candidate.impactParameterZ1()) && + isSelectedTrackDca(binsPtTrack, cutsSingleTrack, candidate.ptProng2(), candidate.impactParameter2(), candidate.impactParameterZ2())); } /// Candidate selections independent from the daugther-mass hypothesis @@ -166,7 +163,7 @@ struct HfCandidateSelectorDsToKKPi { bool selection(const T1& candidate) { auto candpT = candidate.pt(); - int pTBin = findBin(binsPt, candpT); + int const pTBin = findBin(binsPt, candpT); if (pTBin == -1) { return false; } @@ -210,7 +207,7 @@ struct HfCandidateSelectorDsToKKPi { template bool selectionKKPi(const T1& candidate, const T2& trackKaon1, const T2& trackKaon2, const T2& trackPion) { - int pTBin = findBin(binsPt, candidate.pt()); + int const pTBin = findBin(binsPt, candidate.pt()); if (pTBin == -1) { return false; } @@ -242,7 +239,7 @@ struct HfCandidateSelectorDsToKKPi { template bool selectionPiKK(const T1& candidate, const T2& trackPion, const T2& trackKaon1, const T2& trackKaon2) { - int pTBin = findBin(binsPt, candidate.pt()); + int const pTBin = findBin(binsPt, candidate.pt()); if (pTBin == -1) { return false; } @@ -278,7 +275,7 @@ struct HfCandidateSelectorDsToKKPi { outputMlDsToKKPi.clear(); outputMlDsToPiKK.clear(); - if (!(candidate.hfflag() & 1 << aod::hf_cand_3prong::DecayType::DsToKKPi)) { + if ((candidate.hfflag() & 1 << aod::hf_cand_3prong::DecayType::DsToKKPi) == 0) { hfSelDsToKKPiCandidate(statusDsToKKPi, statusDsToPiKK); if (applyMl) { hfMlDsToKKPiCandidate(outputMlDsToKKPi, outputMlDsToPiKK); @@ -307,8 +304,8 @@ struct HfCandidateSelectorDsToKKPi { continue; } - bool topolDsToKKPi = selectionKKPi(candidate, trackPos1, trackNeg, trackPos2); - bool topolDsToPiKK = selectionPiKK(candidate, trackPos1, trackNeg, trackPos2); + bool const topolDsToKKPi = selectionKKPi(candidate, trackPos1, trackNeg, trackPos2); + bool const topolDsToPiKK = selectionPiKK(candidate, trackPos1, trackNeg, trackPos2); if (!topolDsToKKPi && !topolDsToPiKK) { hfSelDsToKKPiCandidate(statusDsToKKPi, statusDsToPiKK); if (applyMl) { @@ -347,13 +344,13 @@ struct HfCandidateSelectorDsToKKPi { pidTrackNegKaon = selectorKaon.statusTpcOrTof(trackNeg, candidate.nSigTpcKa1(), candidate.nSigTofKa1()); } - bool pidDsToKKPi = !(pidTrackPos1Kaon == TrackSelectorPID::Rejected || - pidTrackNegKaon == TrackSelectorPID::Rejected || - pidTrackPos2Pion == TrackSelectorPID::Rejected); + bool const pidDsToKKPi = pidTrackPos1Kaon != TrackSelectorPID::Rejected && + pidTrackNegKaon != TrackSelectorPID::Rejected && + pidTrackPos2Pion != TrackSelectorPID::Rejected; - bool pidDsToPiKK = !(pidTrackPos1Pion == TrackSelectorPID::Rejected || - pidTrackNegKaon == TrackSelectorPID::Rejected || - pidTrackPos2Kaon == TrackSelectorPID::Rejected); + bool const pidDsToPiKK = pidTrackPos1Pion != TrackSelectorPID::Rejected && + pidTrackNegKaon != TrackSelectorPID::Rejected && + pidTrackPos2Kaon != TrackSelectorPID::Rejected; if (!pidDsToKKPi && !pidDsToPiKK) { hfSelDsToKKPiCandidate(statusDsToKKPi, statusDsToPiKK); diff --git a/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx b/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx index b5d0c2258f9..ae30c15f231 100644 --- a/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx @@ -108,7 +108,7 @@ struct HfCandidateSelectorDstarToD0Pi { HfHelper hfHelper; o2::analysis::HfMlResponseDstarToD0Pi hfMlResponse; - std::vector outputMlDstarToD0Pi = {}; + std::vector outputMlDstarToD0Pi; o2::ccdb::CcdbApi ccdbApi; TrackSelectorPi selectorPion; @@ -393,7 +393,7 @@ struct HfCandidateSelectorDstarToD0Pi { // need to add special cuts (additional cuts on decay length and d0 norm) // conjugate-dependent topological selection for Dstar - bool topoDstar = selectionTopolConjugate(candDstar); + bool const topoDstar = selectionTopolConjugate(candDstar); if (!topoDstar) { hfSelDstarCandidate(statusDstar, statusD0Flag, statusTopol, statusCand, statusPID); if (applyMl) { diff --git a/PWGHF/TableProducer/candidateSelectorLbToLcPi.cxx b/PWGHF/TableProducer/candidateSelectorLbToLcPi.cxx index 74abba33758..f698e250b27 100644 --- a/PWGHF/TableProducer/candidateSelectorLbToLcPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorLbToLcPi.cxx @@ -69,11 +69,8 @@ struct HfCandidateSelectorLbToLcPi { bool passesImpactParameterResolution(float pT, float d0Resolution) { - float expectedResolution(0.001 + 0.0052 * std::exp(-0.655 * pT)); - if (d0Resolution > expectedResolution * 1.5) - return false; - else - return true; + float const expectedResolution(0.001 + 0.0052 * std::exp(-0.655 * pT)); + return d0Resolution <= expectedResolution * 1.5; } // Compares to pT dependent cut on impact parameter resolution // Apply topological cuts as defined in SelectorCuts.h; return true if candidate passes all cuts @@ -81,7 +78,7 @@ struct HfCandidateSelectorLbToLcPi { bool selectionTopol(const T1& hfCandLb, const T2& hfCandLc, const T3& trackPi) { auto candpT = hfCandLb.pt(); - int pTBin = findBin(binsPt, candpT); + int const pTBin = findBin(binsPt, candpT); if (pTBin == -1) { // LOGF(debug, "Lb topol selection failed at getpTBin"); return false; @@ -109,17 +106,22 @@ struct HfCandidateSelectorLbToLcPi { } float lcMass = 0.; - if (hfCandLc.isSelLcToPKPi()) + if (hfCandLc.isSelLcToPKPi()) { lcMass = hfHelper.invMassLcToPKPi(hfCandLc); - if (hfCandLc.isSelLcToPiKP()) + } + if (hfCandLc.isSelLcToPiKP()) { lcMass = hfHelper.invMassLcToPiKP(hfCandLc); - if (std::abs(lcMass - o2::constants::physics::MassLambdaCPlus) > cuts->get(pTBin, "DeltaMLc")) + } + if (std::abs(lcMass - o2::constants::physics::MassLambdaCPlus) > cuts->get(pTBin, "DeltaMLc")) { return false; + } - if (hfCandLb.errorDecayLengthXY() > maxDecayLengthXYError) + if (hfCandLb.errorDecayLengthXY() > maxDecayLengthXYError) { return false; - if (hfCandLb.errorDecayLength() > maxDecayLengthError) + } + if (hfCandLb.errorDecayLength() > maxDecayLengthError) { return false; + } // Lb Decay length if (hfCandLb.decayLength() < cuts->get(pTBin, "Lb decLen")) { @@ -153,15 +155,11 @@ struct HfCandidateSelectorLbToLcPi { } // distance between Lb and Lc decay - float diffXVert = hfCandLb.xSecondaryVertex() - hfCandLc.xSecondaryVertex(); - float diffYVert = hfCandLb.ySecondaryVertex() - hfCandLc.ySecondaryVertex(); - float diffZVert = hfCandLb.zSecondaryVertex() - hfCandLc.zSecondaryVertex(); - float vertexDistance = std::sqrt(diffXVert * diffXVert + diffYVert * diffYVert + diffZVert * diffZVert); - if (vertexDistance > maxVertexDistanceLbLc) { - return false; - } - - return true; + float const diffXVert = hfCandLb.xSecondaryVertex() - hfCandLc.xSecondaryVertex(); + float const diffYVert = hfCandLb.ySecondaryVertex() - hfCandLc.ySecondaryVertex(); + float const diffZVert = hfCandLb.zSecondaryVertex() - hfCandLc.zSecondaryVertex(); + float const vertexDistance = std::sqrt(diffXVert * diffXVert + diffYVert * diffYVert + diffZVert * diffZVert); + return vertexDistance <= maxVertexDistanceLbLc; } void process(aod::HfCandLb const& hfCandLbs, @@ -180,9 +178,9 @@ struct HfCandidateSelectorLbToLcPi { auto track0 = candLc.prong0_as(); auto track1 = candLc.prong1_as(); auto track2 = candLc.prong2_as(); - float reso0 = candLc.errorImpactParameter0(); - float reso1 = candLc.errorImpactParameter1(); - float reso2 = candLc.errorImpactParameter2(); + float const reso0 = candLc.errorImpactParameter0(); + float const reso1 = candLc.errorImpactParameter1(); + float const reso2 = candLc.errorImpactParameter2(); if (!passesImpactParameterResolution(track0.pt(), reso0) || !passesImpactParameterResolution(track1.pt(), reso1) || !passesImpactParameterResolution(track2.pt(), reso2) || !passesImpactParameterResolution(trackPi.pt(), hfCandLb.errorImpactParameter1())) { hfSelLbToLcPiCandidate(statusLb); continue; diff --git a/PWGHF/TableProducer/candidateSelectorLc.cxx b/PWGHF/TableProducer/candidateSelectorLc.cxx index 2b06decbec7..ded5f282810 100644 --- a/PWGHF/TableProducer/candidateSelectorLc.cxx +++ b/PWGHF/TableProducer/candidateSelectorLc.cxx @@ -110,8 +110,8 @@ struct HfCandidateSelectorLc { HfHelper hfHelper; o2::analysis::HfMlResponseLcToPKPi hfMlResponseDCA; o2::analysis::HfMlResponseLcToPKPi hfMlResponseKF; - std::vector outputMlLcToPKPi = {}; - std::vector outputMlLcToPiKP = {}; + std::vector outputMlLcToPKPi; + std::vector outputMlLcToPiKP; o2::ccdb::CcdbApi ccdbApi; TrackSelectorPi selectorPion; TrackSelectorKa selectorKaon; @@ -123,7 +123,7 @@ struct HfCandidateSelectorLc { HistogramRegistry registry{"registry"}; - double massK0Star892; + double massK0Star892{}; void init(InitContext const&) { @@ -207,12 +207,12 @@ struct HfCandidateSelectorLc { /// Conjugate-independent topological cuts /// \param candidate is candidate /// \return true if candidate passes all cuts - template + template bool selectionTopol(const T& candidate) { auto candpT = candidate.pt(); - int pTBin = findBin(binsPt, candpT); + int const pTBin = findBin(binsPt, candpT); if (pTBin == -1) { return false; } @@ -222,7 +222,7 @@ struct HfCandidateSelectorLc { return false; } - if (reconstructionType == aod::hf_cand::VertexerType::DCAFitter || (reconstructionType == aod::hf_cand::VertexerType::KfParticle && applyNonKfCuts)) { + if (ReconstructionType == aod::hf_cand::VertexerType::DCAFitter || (ReconstructionType == aod::hf_cand::VertexerType::KfParticle && applyNonKfCuts)) { // cosine of pointing angle if (candidate.cpa() <= cuts->get(pTBin, "cos pointing angle")) { return false; @@ -253,7 +253,7 @@ struct HfCandidateSelectorLc { } } - if constexpr (reconstructionType == aod::hf_cand::VertexerType::KfParticle) { + if constexpr (ReconstructionType == aod::hf_cand::VertexerType::KfParticle) { if (applyKfCuts) { // candidate chi2geo of the triplet of prongs if (candidate.kfChi2Geo() > kfCuts->get(pTBin, "kfChi2Geo")) { @@ -285,17 +285,17 @@ struct HfCandidateSelectorLc { /// \param trackPion is the track with the pion hypothesis /// \param trackKaon is the track with the kaon hypothesis /// \return true if candidate passes all cuts for the given Conjugate - template + template bool selectionTopolConjugate(const T1& candidate, const T2& trackProton, const T2& trackKaon, const T2& trackPion) { auto candpT = candidate.pt(); - int pTBin = findBin(binsPt, candpT); + int const pTBin = findBin(binsPt, candpT); if (pTBin == -1) { return false; } - if (reconstructionType == aod::hf_cand::VertexerType::DCAFitter || (reconstructionType == aod::hf_cand::VertexerType::KfParticle && applyNonKfCuts)) { + if (ReconstructionType == aod::hf_cand::VertexerType::DCAFitter || (ReconstructionType == aod::hf_cand::VertexerType::KfParticle && applyNonKfCuts)) { // cut on daughter pT if (trackProton.pt() < cuts->get(pTBin, "pT p") || trackKaon.pt() < cuts->get(pTBin, "pT K") || trackPion.pt() < cuts->get(pTBin, "pT Pi")) { @@ -303,7 +303,7 @@ struct HfCandidateSelectorLc { } float massLc{0.f}, massKPi{0.f}; - if constexpr (reconstructionType == aod::hf_cand::VertexerType::DCAFitter) { + if constexpr (ReconstructionType == aod::hf_cand::VertexerType::DCAFitter) { if (trackProton.globalIndex() == candidate.prong0Id()) { massLc = hfHelper.invMassLcToPKPi(candidate); massKPi = hfHelper.invMassKPiPairLcToPKPi(candidate); @@ -311,7 +311,7 @@ struct HfCandidateSelectorLc { massLc = hfHelper.invMassLcToPiKP(candidate); massKPi = hfHelper.invMassKPiPairLcToPiKP(candidate); } - } else if constexpr (reconstructionType == aod::hf_cand::VertexerType::KfParticle) { + } else if constexpr (ReconstructionType == aod::hf_cand::VertexerType::KfParticle) { if (trackProton.globalIndex() == candidate.prong0Id()) { massLc = candidate.kfMassPKPi(); massKPi = candidate.kfMassKPi(); @@ -333,7 +333,7 @@ struct HfCandidateSelectorLc { } } - if constexpr (reconstructionType == aod::hf_cand::VertexerType::KfParticle) { + if constexpr (ReconstructionType == aod::hf_cand::VertexerType::KfParticle) { if (applyKfCuts) { const float chi2PrimProng0 = candidate.kfChi2PrimProng0(); const float chi2PrimProng1 = candidate.kfChi2PrimProng1(); @@ -429,19 +429,16 @@ struct HfCandidateSelectorLc { /// \return true if prongs pass all selections bool isSelectedPID(const TrackSelectorPID::Status pidTrackProton, const TrackSelectorPID::Status pidTrackKaon, const TrackSelectorPID::Status pidTrackPion) { - if (pidTrackProton == TrackSelectorPID::Rejected || - pidTrackKaon == TrackSelectorPID::Rejected || - pidTrackPion == TrackSelectorPID::Rejected) { - return false; - } - return true; + return pidTrackProton != TrackSelectorPID::Rejected && + pidTrackKaon != TrackSelectorPID::Rejected && + pidTrackPion != TrackSelectorPID::Rejected; } /// \brief function to apply Lc selections /// \param reconstructionType is the reconstruction type (DCAFitterN or KFParticle) /// \param candidates Lc candidate table /// \param tracks track table - template + template void runSelectLc(CandType const& candidates, TTracks const&) { // looping over 3-prong candidates @@ -478,7 +475,7 @@ struct HfCandidateSelectorLc { // implement filter bit 4 cut - should be done before this task at the track selection level // track quality selection - bool trackQualitySel = isSelectedCandidateProngQuality(trackPos1, trackNeg, trackPos2); + bool const trackQualitySel = isSelectedCandidateProngQuality(trackPos1, trackNeg, trackPos2); if (!trackQualitySel) { hfSelLcCandidate(statusLcToPKPi, statusLcToPiKP); if (applyMl) { @@ -488,7 +485,7 @@ struct HfCandidateSelectorLc { } // conjugate-independent topological selection - if (!selectionTopol(candidate)) { + if (!selectionTopol(candidate)) { hfSelLcCandidate(statusLcToPKPi, statusLcToPiKP); if (applyMl) { hfMlLcToPKPiCandidate(outputMlLcToPKPi, outputMlLcToPiKP); @@ -497,8 +494,8 @@ struct HfCandidateSelectorLc { } // conjugate-dependent topological selection for Lc - bool topolLcToPKPi = selectionTopolConjugate(candidate, trackPos1, trackNeg, trackPos2); - bool topolLcToPiKP = selectionTopolConjugate(candidate, trackPos2, trackNeg, trackPos1); + bool const topolLcToPKPi = selectionTopolConjugate(candidate, trackPos1, trackNeg, trackPos2); + bool const topolLcToPiKP = selectionTopolConjugate(candidate, trackPos2, trackNeg, trackPos1); if (!topolLcToPKPi && !topolLcToPiKP) { hfSelLcCandidate(statusLcToPKPi, statusLcToPiKP); @@ -547,12 +544,12 @@ struct HfCandidateSelectorLc { } } - if constexpr (useBayesPid) { - TrackSelectorPID::Status pidBayesTrackPos1Proton = selectorProton.statusBayes(trackPos1); - TrackSelectorPID::Status pidBayesTrackPos2Proton = selectorProton.statusBayes(trackPos2); - TrackSelectorPID::Status pidBayesTrackPos1Pion = selectorPion.statusBayes(trackPos1); - TrackSelectorPID::Status pidBayesTrackPos2Pion = selectorPion.statusBayes(trackPos2); - TrackSelectorPID::Status pidBayesTrackNegKaon = selectorKaon.statusBayes(trackNeg); + if constexpr (UseBayesPid) { + TrackSelectorPID::Status const pidBayesTrackPos1Proton = selectorProton.statusBayes(trackPos1); + TrackSelectorPID::Status const pidBayesTrackPos2Proton = selectorProton.statusBayes(trackPos2); + TrackSelectorPID::Status const pidBayesTrackPos1Pion = selectorPion.statusBayes(trackPos1); + TrackSelectorPID::Status const pidBayesTrackPos2Pion = selectorPion.statusBayes(trackPos2); + TrackSelectorPID::Status const pidBayesTrackNegKaon = selectorKaon.statusBayes(trackNeg); if (!isSelectedPID(pidBayesTrackPos1Proton, pidBayesTrackNegKaon, pidBayesTrackPos2Pion)) { pidBayesLcToPKPi = 0; // reject LcToPKPi @@ -582,7 +579,7 @@ struct HfCandidateSelectorLc { isSelectedMlLcToPKPi = false; isSelectedMlLcToPiKP = false; - if constexpr (reconstructionType == aod::hf_cand::VertexerType::DCAFitter) { + if constexpr (ReconstructionType == aod::hf_cand::VertexerType::DCAFitter) { if (pidLcToPKPi == 1 && pidBayesLcToPKPi == 1 && topolLcToPKPi) { std::vector inputFeaturesLcToPKPi = hfMlResponseDCA.getInputFeatures(candidate, true); isSelectedMlLcToPKPi = hfMlResponseDCA.isSelectedMl(inputFeaturesLcToPKPi, candidate.pt(), outputMlLcToPKPi); diff --git a/PWGHF/TableProducer/candidateSelectorLcPidMl.cxx b/PWGHF/TableProducer/candidateSelectorLcPidMl.cxx index 9a68436f861..ce791afe7b1 100644 --- a/PWGHF/TableProducer/candidateSelectorLcPidMl.cxx +++ b/PWGHF/TableProducer/candidateSelectorLcPidMl.cxx @@ -93,7 +93,7 @@ struct HfCandidateSelectorLcPidMl { Configurable activateQA{"activateQA", false, "flag to enable QA histos"}; - int dataTypeML; + int dataTypeML{}; o2::ccdb::CcdbApi ccdbApi; OnnxModel model; TrackSelectorPi selectorPion; @@ -118,7 +118,7 @@ struct HfCandidateSelectorLcPidMl { selectorKaon = selectorPion; selectorProton = selectorPion; - AxisSpec bdtAxis{100, 0.f, 1.f}; + AxisSpec const bdtAxis{100, 0.f, 1.f}; if (applyML && activateQA) { registry.add("hLcBDTScoreBkg", "BDT background score distribution for Lc;BDT background score;counts", HistType::kTH1F, {bdtAxis}); registry.add("hLcBDTScorePrompt", "BDT prompt score distribution for Lc;BDT prompt score;counts", HistType::kTH1F, {bdtAxis}); @@ -128,17 +128,17 @@ struct HfCandidateSelectorLcPidMl { ccdbApi.init(url); // init ONNX runtime session - std::map metadata; + std::map const metadata; std::map headers; bool retrieveSuccess = true; if (applyML) { - if (onnxFileLcToPiKPConf.value == "") { + if (onnxFileLcToPiKPConf.value.empty()) { LOG(error) << "Apply ML specified, but no name given to the local model file"; } if (loadModelsFromCCDB && timestampCCDB > 0) { retrieveSuccess = ccdbApi.retrieveBlob(mlModelPathCCDB.value, ".", metadata, timestampCCDB.value, false, onnxFileLcToPiKPConf.value); headers = ccdbApi.retrieveHeaders(mlModelPathCCDB.value, metadata, timestampCCDB.value); - model.initModel(onnxFileLcToPiKPConf.value, false, 1, strtoul(headers["Valid-From"].c_str(), NULL, 0), strtoul(headers["Valid-Until"].c_str(), NULL, 0)); + model.initModel(onnxFileLcToPiKPConf.value, false, 1, strtoul(headers["Valid-From"].c_str(), nullptr, 0), strtoul(headers["Valid-Until"].c_str(), nullptr, 0)); } else if (!loadModelsFromCCDB) { model.initModel(onnxFileLcToPiKPConf.value, false, 1); } else { @@ -147,7 +147,7 @@ struct HfCandidateSelectorLcPidMl { if (retrieveSuccess) { auto session = model.getSession(); std::vector> inputShapes; - Ort::AllocatorWithDefaultOptions tmpAllocator; + Ort::AllocatorWithDefaultOptions const tmpAllocator; for (size_t i = 0; i < session->GetInputCount(); ++i) { inputShapes.emplace_back(session->GetInputTypeInfo(i).GetTensorTypeAndShapeInfo().GetShape()); } @@ -174,7 +174,7 @@ struct HfCandidateSelectorLcPidMl { auto statusLcToPKPi = 0; auto statusLcToPiKP = 0; - if (!(candidate.hfflag() & 1 << aod::hf_cand_3prong::DecayType::LcToPKPi)) { + if ((candidate.hfflag() & 1 << aod::hf_cand_3prong::DecayType::LcToPKPi) == 0) { hfSelLcCandidate(statusLcToPKPi, statusLcToPiKP); continue; } @@ -196,11 +196,11 @@ struct HfCandidateSelectorLcPidMl { pidLcToPiKP = 1; } else { // track-level PID selection - TrackSelectorPID::Status pidTrackPos1Proton = selectorProton.statusTpcOrTof(trackPos1, candidate.nSigTpcPr0(), candidate.nSigTofPr0()); - TrackSelectorPID::Status pidTrackPos2Proton = selectorProton.statusTpcOrTof(trackPos2, candidate.nSigTpcPr2(), candidate.nSigTofPr2()); - TrackSelectorPID::Status pidTrackPos1Pion = selectorPion.statusTpcOrTof(trackPos1, candidate.nSigTpcPi0(), candidate.nSigTofPi0()); - TrackSelectorPID::Status pidTrackPos2Pion = selectorPion.statusTpcOrTof(trackPos2, candidate.nSigTpcPi2(), candidate.nSigTofPi2()); - TrackSelectorPID::Status pidTrackNegKaon = selectorKaon.statusTpcOrTof(trackNeg, candidate.nSigTpcKa1(), candidate.nSigTofKa1()); + TrackSelectorPID::Status const pidTrackPos1Proton = selectorProton.statusTpcOrTof(trackPos1, candidate.nSigTpcPr0(), candidate.nSigTofPr0()); + TrackSelectorPID::Status const pidTrackPos2Proton = selectorProton.statusTpcOrTof(trackPos2, candidate.nSigTpcPr2(), candidate.nSigTofPr2()); + TrackSelectorPID::Status const pidTrackPos1Pion = selectorPion.statusTpcOrTof(trackPos1, candidate.nSigTpcPi0(), candidate.nSigTofPi0()); + TrackSelectorPID::Status const pidTrackPos2Pion = selectorPion.statusTpcOrTof(trackPos2, candidate.nSigTpcPi2(), candidate.nSigTofPi2()); + TrackSelectorPID::Status const pidTrackNegKaon = selectorKaon.statusTpcOrTof(trackNeg, candidate.nSigTpcKa1(), candidate.nSigTofKa1()); if (pidTrackPos1Proton == TrackSelectorPID::Accepted && pidTrackNegKaon == TrackSelectorPID::Accepted && @@ -227,11 +227,11 @@ struct HfCandidateSelectorLcPidMl { pidBayesLcToPKPi = 1; pidBayesLcToPiKP = 1; } else { - int pidBayesTrackPos1Proton = selectorProton.statusBayes(trackPos1); - int pidBayesTrackPos2Proton = selectorProton.statusBayes(trackPos2); - int pidBayesTrackPos1Pion = selectorPion.statusBayes(trackPos1); - int pidBayesTrackPos2Pion = selectorPion.statusBayes(trackPos2); - int pidBayesTrackNegKaon = selectorKaon.statusBayes(trackNeg); + int const pidBayesTrackPos1Proton = selectorProton.statusBayes(trackPos1); + int const pidBayesTrackPos2Proton = selectorProton.statusBayes(trackPos2); + int const pidBayesTrackPos1Pion = selectorPion.statusBayes(trackPos1); + int const pidBayesTrackPos2Pion = selectorPion.statusBayes(trackPos2); + int const pidBayesTrackNegKaon = selectorKaon.statusBayes(trackNeg); if (pidBayesTrackPos1Proton == TrackSelectorPID::Accepted && pidBayesTrackNegKaon == TrackSelectorPID::Accepted && @@ -277,9 +277,9 @@ struct HfCandidateSelectorLcPidMl { continue; } - std::array pVecPos1 = trackPos1.pVector(); - std::array pVecNeg = trackNeg.pVector(); - std::array pVecPos2 = trackPos2.pVector(); + std::array const pVecPos1 = trackPos1.pVector(); + std::array const pVecNeg = trackNeg.pVector(); + std::array const pVecPos2 = trackPos2.pVector(); const float massPi = o2::constants::physics::MassPiPlus; const float massK = o2::constants::physics::MassKPlus; const float massProton = o2::constants::physics::MassProton; @@ -305,12 +305,12 @@ struct HfCandidateSelectorLcPidMl { std::vector inputFeaturesD{trackParPos1.getPt(), trackPos1.dcaXY(), trackPos1.dcaZ(), trackParNeg.getPt(), trackNeg.dcaXY(), trackNeg.dcaZ(), trackParPos2.getPt(), trackPos2.dcaXY(), trackPos2.dcaZ()}; float scores[3] = {-1.f, -1.f, -1.f}; if (dataTypeML == 1) { - auto scoresRaw = model.evalModel(inputFeaturesF); + auto* scoresRaw = model.evalModel(inputFeaturesF); for (int iScore = 0; iScore < 3; ++iScore) { scores[iScore] = scoresRaw[iScore]; } } else if (dataTypeML == 11) { - auto scoresRaw = model.evalModel(inputFeaturesD); + auto* scoresRaw = model.evalModel(inputFeaturesD); for (int iScore = 0; iScore < 3; ++iScore) { scores[iScore] = scoresRaw[iScore]; } diff --git a/PWGHF/TableProducer/candidateSelectorLcToK0sP.cxx b/PWGHF/TableProducer/candidateSelectorLcToK0sP.cxx index d91ab2f718e..ae017847cf4 100644 --- a/PWGHF/TableProducer/candidateSelectorLcToK0sP.cxx +++ b/PWGHF/TableProducer/candidateSelectorLcToK0sP.cxx @@ -96,7 +96,7 @@ struct HfCandidateSelectorLcToK0sP { TrackSelectorPr selectorProtonHighP; o2::analysis::HfMlResponseLcToK0sP hfMlResponse; - std::vector outputMl = {}; + std::vector outputMl; o2::ccdb::CcdbApi ccdbApi; @@ -141,8 +141,8 @@ struct HfCandidateSelectorLcToK0sP { hfMlResponse.init(); // load histograms for ML score - AxisSpec axisScore = {100, 0, 1, "score"}; - AxisSpec axisBinsPt = {binsPtMl, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec const axisScore = {100, 0, 1, "score"}; + AxisSpec const axisBinsPt = {binsPtMl, "#it{p}_{T} (GeV/#it{c})"}; for (int classMl = 0; classMl < nClassesMl; classMl++) { hModelScore.push_back(registry.add(Form("hMlScoreClass%d", classMl), "Model score distribution for Lc;Model score;counts", HistType::kTH1F, {axisScore})); hModelScoreVsPtCand.push_back(registry.add(Form("hMlScoreClass%dVsPtCand", classMl), "Model score distribution for Lc;Model score;counts", HistType::kTH2F, {axisScore, axisBinsPt})); @@ -157,7 +157,7 @@ struct HfCandidateSelectorLcToK0sP { bool selectionTopol(const T& hfCandCascade) { auto candPt = hfCandCascade.pt(); - int ptBin = findBin(binsPt, candPt); + int const ptBin = findBin(binsPt, candPt); if (ptBin == -1) { return false; } @@ -221,9 +221,8 @@ struct HfCandidateSelectorLcToK0sP { { if (track.p() < pPidThreshold) { return selectorProtonLowP.statusTpcAndTof(track) == TrackSelectorPID::Accepted; - } else { - return selectorProtonHighP.statusTpcAndTof(track) == TrackSelectorPID::Accepted; } + return selectorProtonHighP.statusTpcAndTof(track) == TrackSelectorPID::Accepted; } template @@ -235,9 +234,8 @@ struct HfCandidateSelectorLcToK0sP { if (track.p() < pPidThreshold) { return selectorProtonLowP.statusBayesProb(track) == TrackSelectorPID::Accepted; - } else { - return selectorProtonHighP.statusBayesProb(track) == TrackSelectorPID::Accepted; } + return selectorProtonHighP.statusBayesProb(track) == TrackSelectorPID::Accepted; } template @@ -247,7 +245,7 @@ struct HfCandidateSelectorLcToK0sP { auto ptCand = hfCandCascade.pt(); std::vector inputFeatures = hfMlResponse.getInputFeatures(hfCandCascade, bach); - bool isSelectedMl = hfMlResponse.isSelectedMl(inputFeatures, ptCand, outputMl); + bool const isSelectedMl = hfMlResponse.isSelectedMl(inputFeatures, ptCand, outputMl); for (int classMl = 0; classMl < nClassesMl; classMl++) { hModelScore[classMl]->Fill(outputMl[classMl]); @@ -287,7 +285,7 @@ struct HfCandidateSelectorLcToK0sP { } if (applyMl) { - bool isSelectedMlLcToK0sP = selectionMl(candidate, bach, outputMl); + bool const isSelectedMlLcToK0sP = selectionMl(candidate, bach, outputMl); hfMlLcToK0sPCandidate(outputMl); if (!isSelectedMlLcToK0sP) { @@ -330,7 +328,7 @@ struct HfCandidateSelectorLcToK0sP { } if (applyMl) { - bool isSelectedMlLcToK0sP = selectionMl(candidate, bach, outputMl); + bool const isSelectedMlLcToK0sP = selectionMl(candidate, bach, outputMl); hfMlLcToK0sPCandidate(outputMl); if (!isSelectedMlLcToK0sP) { diff --git a/PWGHF/TableProducer/candidateSelectorOmegac0ToOmegaKa.cxx b/PWGHF/TableProducer/candidateSelectorOmegac0ToOmegaKa.cxx index d65b56a40a9..0f514d9aa05 100644 --- a/PWGHF/TableProducer/candidateSelectorOmegac0ToOmegaKa.cxx +++ b/PWGHF/TableProducer/candidateSelectorOmegac0ToOmegaKa.cxx @@ -231,7 +231,7 @@ struct HfCandidateSelectorToOmegaKa { auto trackPiFromLam = trackV0NegDau; auto trackPrFromLam = trackV0PosDau; - int8_t signDecay = candidate.signDecay(); // sign of pi <- cascade + int8_t const signDecay = candidate.signDecay(); // sign of pi <- cascade if (signDecay > 0) { trackPiFromLam = trackV0PosDau; @@ -242,10 +242,10 @@ struct HfCandidateSelectorToOmegaKa { } // eta selection - double etaV0PosDau = candidate.etaV0PosDau(); - double etaV0NegDau = candidate.etaV0NegDau(); - double etaKaFromCasc = candidate.etaBachFromCasc(); - double etaKaFromCharmBaryon = candidate.etaBachFromCharmBaryon(); + double const etaV0PosDau = candidate.etaV0PosDau(); + double const etaV0NegDau = candidate.etaV0NegDau(); + double const etaKaFromCasc = candidate.etaBachFromCasc(); + double const etaKaFromCharmBaryon = candidate.etaBachFromCharmBaryon(); if (std::abs(etaV0PosDau) > etaTrackLFDauMax) { resultSelections = false; registry.fill(HIST("hSelEtaPosV0Dau"), 0); @@ -367,8 +367,8 @@ struct HfCandidateSelectorToOmegaKa { } // pT selections - double ptKaFromCasc = RecoDecay::sqrtSumOfSquares(candidate.pxBachFromCasc(), candidate.pyBachFromCasc()); - double ptKaFromCharmBaryon = RecoDecay::sqrtSumOfSquares(candidate.pxBachFromCharmBaryon(), candidate.pyBachFromCharmBaryon()); + double const ptKaFromCasc = RecoDecay::sqrtSumOfSquares(candidate.pxBachFromCasc(), candidate.pyBachFromCasc()); + double const ptKaFromCharmBaryon = RecoDecay::sqrtSumOfSquares(candidate.pxBachFromCharmBaryon(), candidate.pyBachFromCharmBaryon()); if (std::abs(ptKaFromCasc) < ptKaFromCascMin) { resultSelections = false; registry.fill(HIST("hSelPtKaFromCasc"), 0); @@ -500,9 +500,9 @@ struct HfCandidateSelectorToOmegaKa { bool statusInvMassCascade = false; bool statusInvMassCharmBaryon = false; - double invMassLambda = candidate.invMassLambda(); - double invMassCascade = candidate.invMassCascade(); - double invMassCharmBaryon = candidate.invMassCharmBaryon(); + double const invMassLambda = candidate.invMassLambda(); + double const invMassCascade = candidate.invMassCascade(); + double const invMassCharmBaryon = candidate.invMassCharmBaryon(); if (std::abs(invMassLambda - o2::constants::physics::MassLambda0) < v0MassWindow) { statusInvMassLambda = true; diff --git a/PWGHF/TableProducer/candidateSelectorOmegac0ToOmegaPi.cxx b/PWGHF/TableProducer/candidateSelectorOmegac0ToOmegaPi.cxx index 7b31151af9d..d05c87196be 100644 --- a/PWGHF/TableProducer/candidateSelectorOmegac0ToOmegaPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorOmegac0ToOmegaPi.cxx @@ -172,7 +172,7 @@ struct HfCandidateSelectorToOmegaPi { Configurable decayLenXYLambdaMin{"decayLenXYLambdaMin", 0., "Minimum decay lengthXY of V0"}; Configurable cosPaCascToOmegacMin{"cosPaCascToOmegacMin", 0.995, "Minimum cosPA of cascade<-Omegac"}; Configurable cosPaV0ToCascMin{"cosPaV0ToCascMin", 0.99, "Minimum cosPA of V0<-cascade"}; - } KfconfigurableGroup; + } kfConfigurableGroup; // topological cuts Configurable> binsPt{"binsPt", std::vector{hf_cuts_omegac_to_omega_pi::vecBinsPt}, "pT bin limits"}; Configurable> cuts{"cuts", {hf_cuts_omegac_to_omega_pi::Cuts[0], hf_cuts_omegac_to_omega_pi::NBinsPt, hf_cuts_omegac_to_omega_pi::NCutVars, hf_cuts_omegac_to_omega_pi::labelsPt, hf_cuts_omegac_to_omega_pi::labelsCutVar}, "OmegaC0 candidate selection per pT bin"}; @@ -191,7 +191,7 @@ struct HfCandidateSelectorToOmegaPi { Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; o2::analysis::HfMlResponseOmegacToOmegaPi hfMlResponse; - std::vector outputMlOmegac = {}; + std::vector outputMlOmegac; o2::ccdb::CcdbApi ccdbApi; TrackSelectorPi selectorPion; @@ -270,7 +270,7 @@ struct HfCandidateSelectorToOmegaPi { registry.add("hSelDcaXYToPvV0Daughters", "hSelDcaXYToPvV0Daughters;status;entries", {HistType::kTH1D, {axisSel}}); registry.add("hSelDcaXYToPvKaFromCasc", "hSelDcaXYToPvKaFromCasc;status;entries", {HistType::kTH1D, {axisSel}}); - if (KfconfigurableGroup.applyKFpreselections) { + if (kfConfigurableGroup.applyKFpreselections) { registry.add("hSelPtOmegac", "hSelPtOmegac;status;entries", {HistType::kTH1D, {axisSel}}); registry.add("hSelCompetingCasc", "hSelCompetingCasc;status;entries", {HistType::kTH1D, {axisSel}}); registry.add("hSelKFstatus", "hSelKFstatus;status;entries", {HistType::kTH1D, {axisSel}}); @@ -303,7 +303,7 @@ struct HfCandidateSelectorToOmegaPi { { auto candpT = hfCandOmegac.ptCharmBaryon(); auto pionPtFromOmegac = hfCandOmegac.ptPiFromCharmBaryon(); - int pTBin = findBin(binsPt, candpT); + int const pTBin = findBin(binsPt, candpT); if (pTBin == -1) { return false; } @@ -317,9 +317,8 @@ struct HfCandidateSelectorToOmegaPi { if (pionPtFromOmegac < cuts->get(pTBin, "pT pi from Omegac")) { registry.fill(HIST("hSelPtPiFromCharm"), 0); return false; - } else { - registry.fill(HIST("hSelPtPiFromCharm"), 1); } + registry.fill(HIST("hSelPtPiFromCharm"), 1); return true; } // end template @@ -358,7 +357,7 @@ struct HfCandidateSelectorToOmegaPi { auto trackPrFromLam = trackV0PosDau; auto ptCand = candidate.ptCharmBaryon(); - int8_t signDecay = candidate.signDecay(); // sign of pi <- cascade + int8_t const signDecay = candidate.signDecay(); // sign of pi <- cascade if (signDecay > 0) { trackPiFromLam = trackV0PosDau; @@ -383,10 +382,10 @@ struct HfCandidateSelectorToOmegaPi { } // eta selection - double etaV0PosDau = candidate.etaV0PosDau(); - double etaV0NegDau = candidate.etaV0NegDau(); - double etaKaFromCasc = candidate.etaBachFromCasc(); - double etaPiFromCharmBaryon = candidate.etaBachFromCharmBaryon(); + double const etaV0PosDau = candidate.etaV0PosDau(); + double const etaV0NegDau = candidate.etaV0NegDau(); + double const etaKaFromCasc = candidate.etaBachFromCasc(); + double const etaPiFromCharmBaryon = candidate.etaBachFromCharmBaryon(); if (std::abs(etaV0PosDau) > etaTrackLFDauMax) { resultSelections = false; registry.fill(HIST("hSelEtaPosV0Dau"), 0); @@ -508,8 +507,8 @@ struct HfCandidateSelectorToOmegaPi { } // pT selections - double ptKaFromCasc = RecoDecay::sqrtSumOfSquares(candidate.pxBachFromCasc(), candidate.pyBachFromCasc()); - double ptPiFromCharmBaryon = RecoDecay::sqrtSumOfSquares(candidate.pxBachFromCharmBaryon(), candidate.pyBachFromCharmBaryon()); + double const ptKaFromCasc = RecoDecay::sqrtSumOfSquares(candidate.pxBachFromCasc(), candidate.pyBachFromCasc()); + double const ptPiFromCharmBaryon = RecoDecay::sqrtSumOfSquares(candidate.pxBachFromCharmBaryon(), candidate.pyBachFromCharmBaryon()); if (std::abs(ptKaFromCasc) < ptKaFromCascMin) { resultSelections = false; registry.fill(HIST("hSelPtKaFromCasc"), 0); @@ -525,7 +524,7 @@ struct HfCandidateSelectorToOmegaPi { if constexpr (ConstructMethod == hf_cand_casc_lf::ConstructMethod::KfParticle) { // KFParticle Preselections(kfsel) - if (KfconfigurableGroup.applyKFpreselections) { + if (kfConfigurableGroup.applyKFpreselections) { bool inputKF = false; if (resultSelections) { @@ -534,8 +533,8 @@ struct HfCandidateSelectorToOmegaPi { } // Competing Ξ rejection(KF) Try to reject cases in which the candidate has a an inv. mass compatibler to Xi (bachelor pion) instead of Omega (bachelor kaon) - if (KfconfigurableGroup.applyCompetingCascRejection) { - if (std::abs(candidate.cascRejectInvmass() - o2::constants::physics::MassXiMinus) < KfconfigurableGroup.cascadeRejMassWindow) { + if (kfConfigurableGroup.applyCompetingCascRejection) { + if (std::abs(candidate.cascRejectInvmass() - o2::constants::physics::MassXiMinus) < kfConfigurableGroup.cascadeRejMassWindow) { resultSelections = false; registry.fill(HIST("hSelCompetingCasc"), 0); } else { @@ -553,7 +552,7 @@ struct HfCandidateSelectorToOmegaPi { } // v0&Casc&Omegac ldl selection - if ((candidate.v0ldl() < KfconfigurableGroup.v0LdlMin) || (candidate.cascldl() < KfconfigurableGroup.cascLdlMin) || (candidate.omegacldl() > KfconfigurableGroup.omegacLdlMax)) { + if ((candidate.v0ldl() < kfConfigurableGroup.v0LdlMin) || (candidate.cascldl() < kfConfigurableGroup.cascLdlMin) || (candidate.omegacldl() > kfConfigurableGroup.omegacLdlMax)) { resultSelections = false; registry.fill(HIST("hSelV0_Casc_Omegacldl"), 0); } else { @@ -561,7 +560,7 @@ struct HfCandidateSelectorToOmegaPi { } // Omegac ctau selsection - if (candidate.cTauOmegac() > KfconfigurableGroup.cTauOmegacMax) { + if (candidate.cTauOmegac() > kfConfigurableGroup.cTauOmegacMax) { resultSelections = false; registry.fill(HIST("hSelctauOmegac"), 0); } else { @@ -569,7 +568,7 @@ struct HfCandidateSelectorToOmegaPi { } // Chi2Geo/NDF V0&Casc&Omegac selection - if ((candidate.v0Chi2OverNdf() > KfconfigurableGroup.v0Chi2OverNdfMax) || (candidate.v0Chi2OverNdf() < 0) || (candidate.cascChi2OverNdf() > KfconfigurableGroup.cascChi2OverNdfMax) || (candidate.cascChi2OverNdf() < 0) || (candidate.omegacChi2OverNdf() > KfconfigurableGroup.omegacChi2OverNdfMax) || (candidate.omegacChi2OverNdf() < 0)) { + if ((candidate.v0Chi2OverNdf() > kfConfigurableGroup.v0Chi2OverNdfMax) || (candidate.v0Chi2OverNdf() < 0) || (candidate.cascChi2OverNdf() > kfConfigurableGroup.cascChi2OverNdfMax) || (candidate.cascChi2OverNdf() < 0) || (candidate.omegacChi2OverNdf() > kfConfigurableGroup.omegacChi2OverNdfMax) || (candidate.omegacChi2OverNdf() < 0)) { resultSelections = false; registry.fill(HIST("hSelChi2GeooverNDFV0_Casc_Omegac"), 0); } else { @@ -577,7 +576,7 @@ struct HfCandidateSelectorToOmegaPi { } // Chi2Topo/NDF (chi2TopoV0ToCasc chi2TopoOmegacToPv chi2TopoCascToOmegac chi2TopoCascToPv) selection (???????????/NDF of which particle????????) - if ((candidate.chi2TopoV0ToCasc() > KfconfigurableGroup.chi2TopoV0ToCascMax) || (candidate.chi2TopoV0ToCasc() < 0) || (candidate.chi2TopoOmegacToPv() > KfconfigurableGroup.chi2TopoOmegacToPvMax) || (candidate.chi2TopoOmegacToPv() < 0) || (candidate.chi2TopoCascToOmegac() > KfconfigurableGroup.chi2TopoCascToOmegacMax) || (candidate.chi2TopoCascToOmegac() < 0) || (candidate.chi2TopoCascToPv() > KfconfigurableGroup.chi2TopoCascToPvMax) || (candidate.chi2TopoCascToPv() < 0)) { + if ((candidate.chi2TopoV0ToCasc() > kfConfigurableGroup.chi2TopoV0ToCascMax) || (candidate.chi2TopoV0ToCasc() < 0) || (candidate.chi2TopoOmegacToPv() > kfConfigurableGroup.chi2TopoOmegacToPvMax) || (candidate.chi2TopoOmegacToPv() < 0) || (candidate.chi2TopoCascToOmegac() > kfConfigurableGroup.chi2TopoCascToOmegacMax) || (candidate.chi2TopoCascToOmegac() < 0) || (candidate.chi2TopoCascToPv() > kfConfigurableGroup.chi2TopoCascToPvMax) || (candidate.chi2TopoCascToPv() < 0)) { resultSelections = false; registry.fill(HIST("hSelChi2TopooverNDFV0_Casc_Omegac"), 0); } else { @@ -585,7 +584,7 @@ struct HfCandidateSelectorToOmegaPi { } // DecaylengthXY of Omegac&Casc&V0 selection - if ((std::abs(candidate.decayLenXYOmegac()) > KfconfigurableGroup.decayLenXYOmegacMax) || (std::abs(candidate.decayLenXYCasc()) < KfconfigurableGroup.decayLenXYCascMin) || (std::abs(candidate.decayLenXYLambda()) < KfconfigurableGroup.decayLenXYLambdaMin)) { + if ((std::abs(candidate.decayLenXYOmegac()) > kfConfigurableGroup.decayLenXYOmegacMax) || (std::abs(candidate.decayLenXYCasc()) < kfConfigurableGroup.decayLenXYCascMin) || (std::abs(candidate.decayLenXYLambda()) < kfConfigurableGroup.decayLenXYLambdaMin)) { resultSelections = false; registry.fill(HIST("hSeldecayLenXYOmegac_Casc_V0"), 0); } else { @@ -593,7 +592,7 @@ struct HfCandidateSelectorToOmegaPi { } // KFPA cut cosPaCascToOmegac cosPaV0ToCasc - if ((candidate.cosPaCascToOmegac() < KfconfigurableGroup.cosPaCascToOmegacMin) || (candidate.cosPaV0ToCasc() < KfconfigurableGroup.cosPaV0ToCascMin)) { + if ((candidate.cosPaCascToOmegac() < kfConfigurableGroup.cosPaCascToOmegacMin) || (candidate.cosPaV0ToCasc() < kfConfigurableGroup.cosPaV0ToCascMin)) { resultSelections = false; registry.fill(HIST("hSelcosPaCascToOmegac_V0ToCasc"), 0); } else { @@ -719,9 +718,9 @@ struct HfCandidateSelectorToOmegaPi { } // invariant mass cuts - double invMassLambda = candidate.invMassLambda(); - double invMassCascade = candidate.invMassCascade(); - double invMassCharmBaryon = candidate.invMassCharmBaryon(); + double const invMassLambda = candidate.invMassLambda(); + double const invMassCascade = candidate.invMassCascade(); + double const invMassCharmBaryon = candidate.invMassCharmBaryon(); if (std::abs(invMassLambda - o2::constants::physics::MassLambda0) < v0MassWindow) { statusInvMassLambda = true; diff --git a/PWGHF/TableProducer/candidateSelectorOmegac0Xic0ToOmegaKa.cxx b/PWGHF/TableProducer/candidateSelectorOmegac0Xic0ToOmegaKa.cxx index 3bb9e410347..1dd9ad697e3 100644 --- a/PWGHF/TableProducer/candidateSelectorOmegac0Xic0ToOmegaKa.cxx +++ b/PWGHF/TableProducer/candidateSelectorOmegac0Xic0ToOmegaKa.cxx @@ -171,7 +171,7 @@ struct HfCandidateSelectorToOmegaKa { Configurable decayLenLambdaMin{"decayLenLambdaMin", 0., "Minimum decay lengthXY of V0"}; Configurable cosPaCascToOmegaKaMin{"cosPaCascToOmegaKaMin", 0.995, "Minimum cosPA of cascade<-OmegaKa"}; Configurable cosPaV0ToCascMin{"cosPaV0ToCascMin", 0.99, "Minimum cosPA of V0<-cascade"}; - } KfconfigurableGroup; + } kfConfigurableGroup; TrackSelectorPi selectorPion; TrackSelectorPr selectorProton; @@ -191,7 +191,7 @@ struct HfCandidateSelectorToOmegaKa { const AxisSpec thnAxisMass{thnConfigAxisMass, "inv. mass (#Omega#Ka) (GeV/#it{c}^{2})"}; const AxisSpec thnAxisPt{thnConfigAxisPt, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec thnAxisPtKaon{thnConfigAxisPtKaon, "Pt of Kaon from Omegac0."}; - std::vector axes = {thnAxisMass, thnAxisPt, thnAxisPtKaon}; + std::vector const axes = {thnAxisMass, thnAxisPt, thnAxisPtKaon}; registry.add("hMassVsPtVsPtKaon", "Thn for Omegac0 or Xic candidates with InvmassOmegaKa&pT&pTKa", HistType::kTHnSparseF, axes); registry.get(HIST("hMassVsPtVsPtKaon"))->Sumw2(); @@ -265,8 +265,8 @@ struct HfCandidateSelectorToOmegaKa { bool selectionTopol(const T1& hfCandOmegaKa) { auto candpT = hfCandOmegaKa.kfPtOmegaKa(); - auto KaPtFromOmegaKa = hfCandOmegaKa.kfPtKaFromOmegaKa(); - int pTBin = findBin(binsPt, candpT); + auto kaPtFromOmegaKa = hfCandOmegaKa.kfPtKaFromOmegaKa(); + int const pTBin = findBin(binsPt, candpT); if (pTBin == -1) { return false; } @@ -275,17 +275,15 @@ struct HfCandidateSelectorToOmegaKa { if (candpT <= ptCandMin || candpT >= ptCandMax) { registry.fill(HIST("hSelPtOmegaKa"), 0); return false; - } else { - registry.fill(HIST("hSelPtOmegaKa"), 1); } + registry.fill(HIST("hSelPtOmegaKa"), 1); // check that the candidate pT is within the analysis range - if (KaPtFromOmegaKa < cuts->get(pTBin, "pT ka from OmegaKa")) { + if (kaPtFromOmegaKa < cuts->get(pTBin, "pT ka from OmegaKa")) { registry.fill(HIST("hSelPtKaFromCharm"), 0); return false; - } else { - registry.fill(HIST("hSelPtKaFromCharm"), 1); } + registry.fill(HIST("hSelPtKaFromCharm"), 1); return true; } // end template @@ -322,7 +320,7 @@ struct HfCandidateSelectorToOmegaKa { auto trackPiFromLam = trackV0NegDau; auto trackPrFromLam = trackV0PosDau; - int8_t signDecay = candidate.signDecay(); // sign of pi <- cascade + int8_t const signDecay = candidate.signDecay(); // sign of pi <- cascade if (signDecay > 0) { trackPiFromLam = trackV0PosDau; @@ -338,10 +336,10 @@ struct HfCandidateSelectorToOmegaKa { } // eta selection - double etaV0DauPr = candidate.etaV0DauPr(); - double etaV0DauPi = candidate.etaV0DauPi(); - double etaKaFromCasc = candidate.etaBachFromCasc(); - double etaKaFromCharmBaryon = candidate.etaBachFromCharmBaryon(); + double const etaV0DauPr = candidate.etaV0DauPr(); + double const etaV0DauPi = candidate.etaV0DauPi(); + double const etaKaFromCasc = candidate.etaBachFromCasc(); + double const etaKaFromCharmBaryon = candidate.etaBachFromCharmBaryon(); if (std::abs(etaV0DauPr) > etaTrackLFDauMax) { resultSelections = false; registry.fill(HIST("hSelEtaPosV0Dau"), 0); @@ -446,8 +444,8 @@ struct HfCandidateSelectorToOmegaKa { } // Competing Ξ rejection(KF) Try to reject cases in which the candidate has a an inv. mass compatibler to Xi (bachelor pion) instead of Omega (bachelor kaon) - if (KfconfigurableGroup.applyCompetingCascRejection) { - if (std::abs(candidate.invMassCascadeRej() - o2::constants::physics::MassXiMinus) < KfconfigurableGroup.cascadeRejMassWindow) { + if (kfConfigurableGroup.applyCompetingCascRejection) { + if (std::abs(candidate.invMassCascadeRej() - o2::constants::physics::MassXiMinus) < kfConfigurableGroup.cascadeRejMassWindow) { resultSelections = false; registry.fill(HIST("hSelCompetingCasc"), 0); } else { @@ -457,7 +455,7 @@ struct HfCandidateSelectorToOmegaKa { } // v0&Casc&OmegaKa ldl selection - if ((candidate.v0ldl() < KfconfigurableGroup.v0LdlMin) || (candidate.cascldl() < KfconfigurableGroup.cascLdlMin) || (candidate.omegaKaldl() > KfconfigurableGroup.omegaKaLdlMax)) { + if ((candidate.v0ldl() < kfConfigurableGroup.v0LdlMin) || (candidate.cascldl() < kfConfigurableGroup.cascLdlMin) || (candidate.omegaKaldl() > kfConfigurableGroup.omegaKaLdlMax)) { resultSelections = false; registry.fill(HIST("hSelV0_Casc_OmegaKaldl"), 0); } else { @@ -465,7 +463,7 @@ struct HfCandidateSelectorToOmegaKa { } // OmegaKa ctau selsection - if (candidate.cTauOmegaKa() > KfconfigurableGroup.cTauOmegaKaMax) { + if (candidate.cTauOmegaKa() > kfConfigurableGroup.cTauOmegaKaMax) { resultSelections = false; registry.fill(HIST("hSelctauOmegaKa"), 0); } else { @@ -473,7 +471,7 @@ struct HfCandidateSelectorToOmegaKa { } // Chi2Geo/NDF V0&Casc&OmegaKa selection - if ((candidate.chi2GeoV0() > KfconfigurableGroup.v0Chi2OverNdfMax) || (candidate.chi2GeoV0() < 0) || (candidate.chi2GeoCasc() > KfconfigurableGroup.cascChi2OverNdfMax) || (candidate.chi2GeoCasc() < 0) || (candidate.chi2GeoOmegaKa() > KfconfigurableGroup.omegaKaChi2OverNdfMax) || (candidate.chi2GeoOmegaKa() < 0)) { + if ((candidate.chi2GeoV0() > kfConfigurableGroup.v0Chi2OverNdfMax) || (candidate.chi2GeoV0() < 0) || (candidate.chi2GeoCasc() > kfConfigurableGroup.cascChi2OverNdfMax) || (candidate.chi2GeoCasc() < 0) || (candidate.chi2GeoOmegaKa() > kfConfigurableGroup.omegaKaChi2OverNdfMax) || (candidate.chi2GeoOmegaKa() < 0)) { resultSelections = false; registry.fill(HIST("hSelChi2GeooverNDFV0_Casc_OmegaKa"), 0); } else { @@ -481,8 +479,8 @@ struct HfCandidateSelectorToOmegaKa { } // Chi2Topo/NDF selection - if ((candidate.chi2TopoV0ToCasc() > KfconfigurableGroup.chi2TopoV0ToCascMax) || (candidate.chi2TopoV0ToCasc() < 0) || (candidate.chi2TopoKaToCasc() > KfconfigurableGroup.chi2TopoKaToCascMax) || (candidate.chi2TopoKaToCasc() < 0) || (candidate.chi2TopoCascToOmegaKa() > KfconfigurableGroup.chi2TopoCascToOmegaKaMax) || (candidate.chi2TopoCascToOmegaKa() < 0) || (candidate.chi2TopoKaToOmegaKa() > KfconfigurableGroup.chi2TopoKaToOmegaKaMax) || (candidate.chi2TopoKaToOmegaKa() < 0) || - (candidate.chi2TopoOmegaKaToPv() > KfconfigurableGroup.chi2TopoOmegaKaToPvMax) || (candidate.chi2TopoOmegaKaToPv() < 0) || (candidate.chi2TopoCascToPv() > KfconfigurableGroup.chi2TopoCascToPvMax) || (candidate.chi2TopoCascToPv() < 0) || (candidate.chi2TopoKaFromOmegaKaToPv() > KfconfigurableGroup.chi2TopoKaFromOmegaKaToPvMax) || (candidate.chi2TopoKaFromOmegaKaToPv() < 0)) { + if ((candidate.chi2TopoV0ToCasc() > kfConfigurableGroup.chi2TopoV0ToCascMax) || (candidate.chi2TopoV0ToCasc() < 0) || (candidate.chi2TopoKaToCasc() > kfConfigurableGroup.chi2TopoKaToCascMax) || (candidate.chi2TopoKaToCasc() < 0) || (candidate.chi2TopoCascToOmegaKa() > kfConfigurableGroup.chi2TopoCascToOmegaKaMax) || (candidate.chi2TopoCascToOmegaKa() < 0) || (candidate.chi2TopoKaToOmegaKa() > kfConfigurableGroup.chi2TopoKaToOmegaKaMax) || (candidate.chi2TopoKaToOmegaKa() < 0) || + (candidate.chi2TopoOmegaKaToPv() > kfConfigurableGroup.chi2TopoOmegaKaToPvMax) || (candidate.chi2TopoOmegaKaToPv() < 0) || (candidate.chi2TopoCascToPv() > kfConfigurableGroup.chi2TopoCascToPvMax) || (candidate.chi2TopoCascToPv() < 0) || (candidate.chi2TopoKaFromOmegaKaToPv() > kfConfigurableGroup.chi2TopoKaFromOmegaKaToPvMax) || (candidate.chi2TopoKaFromOmegaKaToPv() < 0)) { resultSelections = false; registry.fill(HIST("hSelChi2TopooverNDFV0_Casc_OmegaKa"), 0); } else { @@ -490,7 +488,7 @@ struct HfCandidateSelectorToOmegaKa { } // DecaylengthXY of OmegaKa&Casc&V0 selection - if ((std::abs(candidate.decLenCharmBaryon()) > KfconfigurableGroup.decayLenOmegaKaMax) || (std::abs(candidate.decLenCascade()) < KfconfigurableGroup.decayLenCascMin) || (std::abs(candidate.decLenV0()) < KfconfigurableGroup.decayLenLambdaMin)) { + if ((std::abs(candidate.decLenCharmBaryon()) > kfConfigurableGroup.decayLenOmegaKaMax) || (std::abs(candidate.decLenCascade()) < kfConfigurableGroup.decayLenCascMin) || (std::abs(candidate.decLenV0()) < kfConfigurableGroup.decayLenLambdaMin)) { resultSelections = false; registry.fill(HIST("hSeldecayLenOmegaKa_Casc_V0"), 0); } else { @@ -498,7 +496,7 @@ struct HfCandidateSelectorToOmegaKa { } // KFPA cut cosPaCascToOmegaKa cosPaV0ToCasc - if ((candidate.cosPaCascToOmegaKa() < KfconfigurableGroup.cosPaCascToOmegaKaMin) || (candidate.cosPaV0ToCasc() < KfconfigurableGroup.cosPaV0ToCascMin)) { + if ((candidate.cosPaCascToOmegaKa() < kfConfigurableGroup.cosPaCascToOmegaKaMin) || (candidate.cosPaV0ToCasc() < kfConfigurableGroup.cosPaV0ToCascMin)) { resultSelections = false; registry.fill(HIST("hSelcosPaCascToOmegaKa_V0ToCasc"), 0); } else { @@ -620,9 +618,9 @@ struct HfCandidateSelectorToOmegaKa { } // invariant mass cuts - double invMassLambda = candidate.invMassLambda(); - double invMassCascade = candidate.invMassCascade(); - double invMassCharmBaryon = candidate.invMassCharmBaryon(); + double const invMassLambda = candidate.invMassLambda(); + double const invMassCascade = candidate.invMassCascade(); + double const invMassCharmBaryon = candidate.invMassCharmBaryon(); if (std::abs(invMassLambda - o2::constants::physics::MassLambda0) < v0MassWindow) { statusInvMassLambda = true; diff --git a/PWGHF/TableProducer/candidateSelectorToXiPi.cxx b/PWGHF/TableProducer/candidateSelectorToXiPi.cxx index 4372e3cb40a..3a53c0532f9 100644 --- a/PWGHF/TableProducer/candidateSelectorToXiPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorToXiPi.cxx @@ -196,8 +196,8 @@ struct HfCandidateSelectorToXiPi { TracksSelLf const& lfTracks) { - double massLambdaFromPDG = o2::constants::physics::MassLambda0; - double massXiFromPDG = o2::constants::physics::MassXiMinus; + double const massLambdaFromPDG = o2::constants::physics::MassLambda0; + double const massXiFromPDG = o2::constants::physics::MassXiMinus; // looping over charm baryon candidates for (const auto& candidate : candidates) { @@ -216,7 +216,7 @@ struct HfCandidateSelectorToXiPi { auto trackPiFromLam = trackV0NegDau; auto trackPrFromLam = trackV0PosDau; - int8_t signDecay = candidate.signDecay(); // sign of pi <- cascade + int8_t const signDecay = candidate.signDecay(); // sign of pi <- cascade if (signDecay > 0) { trackPiFromLam = trackV0PosDau; @@ -227,10 +227,10 @@ struct HfCandidateSelectorToXiPi { } // eta selection - double etaV0PosDau = candidate.etaV0PosDau(); - double etaV0NegDau = candidate.etaV0NegDau(); - double etaPiFromCasc = candidate.etaBachFromCasc(); - double etaPiFromCharmBaryon = candidate.etaBachFromCharmBaryon(); + double const etaV0PosDau = candidate.etaV0PosDau(); + double const etaV0NegDau = candidate.etaV0NegDau(); + double const etaPiFromCasc = candidate.etaBachFromCasc(); + double const etaPiFromCharmBaryon = candidate.etaBachFromCharmBaryon(); if (std::abs(etaV0PosDau) > etaTrackLFDauMax) { resultSelections = false; registry.fill(HIST("hSelEtaPosV0Dau"), 0); @@ -352,8 +352,8 @@ struct HfCandidateSelectorToXiPi { } // pT selections - double ptPiFromCasc = RecoDecay::sqrtSumOfSquares(candidate.pxBachFromCasc(), candidate.pyBachFromCasc()); - double ptPiFromCharmBaryon = RecoDecay::sqrtSumOfSquares(candidate.pxBachFromCharmBaryon(), candidate.pyBachFromCharmBaryon()); + double const ptPiFromCasc = RecoDecay::sqrtSumOfSquares(candidate.pxBachFromCasc(), candidate.pyBachFromCasc()); + double const ptPiFromCharmBaryon = RecoDecay::sqrtSumOfSquares(candidate.pxBachFromCharmBaryon(), candidate.pyBachFromCharmBaryon()); if (std::abs(ptPiFromCasc) < ptPiFromCascMin) { resultSelections = false; registry.fill(HIST("hSelPtPiFromCasc"), 0); @@ -485,9 +485,9 @@ struct HfCandidateSelectorToXiPi { bool statusInvMassCascade = false; bool statusInvMassCharmBaryon = false; - double invMassLambda = candidate.invMassLambda(); - double invMassCascade = candidate.invMassCascade(); - double invMassCharmBaryon = candidate.invMassCharmBaryon(); + double const invMassLambda = candidate.invMassLambda(); + double const invMassCascade = candidate.invMassCascade(); + double const invMassCharmBaryon = candidate.invMassCharmBaryon(); if (std::abs(invMassLambda - massLambdaFromPDG) < v0MassWindow) { statusInvMassLambda = true; diff --git a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx index 88824d4d75d..f40b2c030e5 100644 --- a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx +++ b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx @@ -137,7 +137,7 @@ struct HfCandidateSelectorXic0ToXiPiKf { Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; o2::analysis::HfMlResponseXic0ToXiPiKf hfMlResponse; - std::vector outputMlXic0ToXiPiKf = {}; + std::vector outputMlXic0ToXiPiKf; o2::ccdb::CcdbApi ccdbApi; TrackSelectorPr selectorProton; @@ -226,7 +226,7 @@ struct HfCandidateSelectorXic0ToXiPiKf { auto trackPiFromLam = trackV0NegDau; auto trackPrFromLam = trackV0PosDau; - int8_t signDecay = candidate.signDecay(); // sign of pi <- cascade + int8_t const signDecay = candidate.signDecay(); // sign of pi <- cascade if (signDecay > 0) { trackPiFromLam = trackV0PosDau; @@ -237,14 +237,14 @@ struct HfCandidateSelectorXic0ToXiPiKf { } // eta selection - double etaV0PosDau = candidate.etaV0PosDau(); - double etaV0NegDau = candidate.etaV0NegDau(); - double etaPiFromCasc = candidate.etaBachFromCasc(); - double etaPiFromCharmBaryon = candidate.etaBachFromCharmBaryon(); + double const etaV0PosDau = candidate.etaV0PosDau(); + double const etaV0NegDau = candidate.etaV0NegDau(); + double const etaPiFromCasc = candidate.etaBachFromCasc(); + double const etaPiFromCharmBaryon = candidate.etaBachFromCharmBaryon(); if (std::abs(etaV0PosDau) > etaTrackLFDauMax || std::abs(etaV0NegDau) > etaTrackLFDauMax || std::abs(etaPiFromCasc) > etaTrackLFDauMax || std::abs(etaPiFromCharmBaryon) > etaTrackCharmBachMax) { resultSelections = false; } - double ptPiFromCasc = RecoDecay::sqrtSumOfSquares(candidate.pxBachFromCasc(), candidate.pyBachFromCasc()); + double const ptPiFromCasc = RecoDecay::sqrtSumOfSquares(candidate.pxBachFromCasc(), candidate.pyBachFromCasc()); if (std::abs(ptPiFromCasc) < ptPiFromCascMin) { resultSelections = false; registry.fill(HIST("hSelPtPiFromCasc"), 0); @@ -384,9 +384,9 @@ struct HfCandidateSelectorXic0ToXiPiKf { bool statusInvMassCascade = false; bool statusInvMassCharmBaryon = false; - double invMassLambda = candidate.invMassLambda(); - double invMassCascade = candidate.invMassCascade(); - double invMassCharmBaryon = candidate.invMassCharmBaryon(); + double const invMassLambda = candidate.invMassLambda(); + double const invMassCascade = candidate.invMassCascade(); + double const invMassCharmBaryon = candidate.invMassCharmBaryon(); if (resultSelections) { resultSelections = selectionTopolKf(candidate); @@ -483,12 +483,12 @@ struct HfCandidateSelectorXic0ToXiPiKf { { auto candpT = RecoDecay::pt(candidate.pxCharmBaryon(), candidate.pyCharmBaryon()); - int pTBin = findBin(binsPt, candpT); + int const pTBin = findBin(binsPt, candpT); if (pTBin == -1) { return false; } - double ptPiFromCharmBaryon = RecoDecay::sqrtSumOfSquares(candidate.pxBachFromCharmBaryon(), candidate.pyBachFromCharmBaryon()); + double const ptPiFromCharmBaryon = RecoDecay::sqrtSumOfSquares(candidate.pxBachFromCharmBaryon(), candidate.pyBachFromCharmBaryon()); if (ptPiFromCharmBaryon <= cuts->get(pTBin, "ptPiFromCharmBaryon")) { return false; } diff --git a/PWGHF/TableProducer/candidateSelectorXicToPKPi.cxx b/PWGHF/TableProducer/candidateSelectorXicToPKPi.cxx index 14b010aeaa2..2ed4e2b329f 100644 --- a/PWGHF/TableProducer/candidateSelectorXicToPKPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorXicToPKPi.cxx @@ -90,8 +90,8 @@ struct HfCandidateSelectorXicToPKPi { Configurable activateQA{"activateQA", true, "Flag to enable QA histogram"}; o2::analysis::HfMlResponseXicToPKPi hfMlResponse; - std::vector outputMlXicToPKPi = {}; - std::vector outputMlXicToPiKP = {}; + std::vector outputMlXicToPKPi; + std::vector outputMlXicToPiKP; o2::ccdb::CcdbApi ccdbApi; TrackSelectorPi selectorPion; TrackSelectorKa selectorKaon; @@ -148,7 +148,7 @@ struct HfCandidateSelectorXicToPKPi { bool selectionTopol(const T& candidate) { auto candpT = candidate.pt(); - int pTBin = findBin(binsPt, candpT); + int const pTBin = findBin(binsPt, candpT); if (pTBin == -1) { return false; } @@ -212,7 +212,7 @@ struct HfCandidateSelectorXicToPKPi { { auto candpT = candidate.pt(); - int pTBin = findBin(binsPt, candpT); + int const pTBin = findBin(binsPt, candpT); if (pTBin == -1) { return false; } @@ -283,8 +283,8 @@ struct HfCandidateSelectorXicToPKPi { // conjugate-dependent topplogical selection for Xic - bool topolXicToPKPi = selectionTopolConjugate(candidate, trackPos1, trackNeg, trackPos2); - bool topolXicToPiKP = selectionTopolConjugate(candidate, trackPos2, trackNeg, trackPos1); + bool const topolXicToPKPi = selectionTopolConjugate(candidate, trackPos1, trackNeg, trackPos2); + bool const topolXicToPiKP = selectionTopolConjugate(candidate, trackPos2, trackNeg, trackPos1); if (!topolXicToPKPi && !topolXicToPiKP) { hfSelXicToPKPiCandidate(statusXicToPKPi, statusXicToPiKP); @@ -376,11 +376,11 @@ struct HfCandidateSelectorXicToPKPi { bool isSelectedMlXicToPKPi = false; bool isSelectedMlXicToPiKP = false; - if (topolXicToPKPi && pidXicToPKPi) { + if (topolXicToPKPi && (pidXicToPKPi != 0)) { std::vector inputFeaturesXicToPKPi = hfMlResponse.getInputFeatures(candidate, true); isSelectedMlXicToPKPi = hfMlResponse.isSelectedMl(inputFeaturesXicToPKPi, ptCand, outputMlXicToPKPi); } - if (topolXicToPiKP && pidXicToPiKP) { + if (topolXicToPiKP && (pidXicToPiKP != 0)) { std::vector inputFeaturesXicToPiKP = hfMlResponse.getInputFeatures(candidate, false); isSelectedMlXicToPiKP = hfMlResponse.isSelectedMl(inputFeaturesXicToPiKP, ptCand, outputMlXicToPiKP); } diff --git a/PWGHF/TableProducer/candidateSelectorXicToXiPiPi.cxx b/PWGHF/TableProducer/candidateSelectorXicToXiPiPi.cxx index c4087a93e75..b5f5c2cb64c 100644 --- a/PWGHF/TableProducer/candidateSelectorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorXicToXiPiPi.cxx @@ -92,7 +92,7 @@ struct HfCandidateSelectorXicToXiPiPi { Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; o2::analysis::HfMlResponseXicToXiPiPi hfMlResponse; - std::vector outputMlXicToXiPiPi = {}; + std::vector outputMlXicToXiPiPi; o2::ccdb::CcdbApi ccdbApi; TrackSelectorPi selectorPion; TrackSelectorPr selectorProton; @@ -276,10 +276,7 @@ struct HfCandidateSelectorXicToXiPiPi { bool const useTpcPidOnly) { if (useTpcPidOnly) { - if ((statusPidPi0 != TrackSelectorPID::Accepted && statusPidPi0 != TrackSelectorPID::NotApplicable) || (statusPidPi1 != TrackSelectorPID::Accepted && statusPidPi1 != TrackSelectorPID::NotApplicable) || (statusPidPiXi != TrackSelectorPID::Accepted && statusPidPiXi != TrackSelectorPID::NotApplicable) || (statusPidPrLam != TrackSelectorPID::Accepted && statusPidPrLam != TrackSelectorPID::NotApplicable) || (statusPidPiLam != TrackSelectorPID::Accepted && statusPidPiLam != TrackSelectorPID::NotApplicable)) { - return false; - } - return true; + return (statusPidPi0 == TrackSelectorPID::Accepted || statusPidPi0 == TrackSelectorPID::NotApplicable) && (statusPidPi1 == TrackSelectorPID::Accepted || statusPidPi1 == TrackSelectorPID::NotApplicable) && (statusPidPiXi == TrackSelectorPID::Accepted || statusPidPiXi == TrackSelectorPID::NotApplicable) && (statusPidPrLam == TrackSelectorPID::Accepted || statusPidPrLam == TrackSelectorPID::NotApplicable) && (statusPidPiLam == TrackSelectorPID::Accepted || statusPidPiLam == TrackSelectorPID::NotApplicable); } if (statusPidPi0 == TrackSelectorPID::Rejected || statusPidPi1 == TrackSelectorPID::Rejected || statusPidPiXi == TrackSelectorPID::Rejected || statusPidPrLam == TrackSelectorPID::Rejected || statusPidPiLam == TrackSelectorPID::Rejected) { return false; @@ -292,7 +289,7 @@ struct HfCandidateSelectorXicToXiPiPi { /// \param statusXicToXiPiPi Flag to store selection status as defined in hf_sel_candidate_xic::XicToXiPiPiSelectionStep /// \param isMatchedSignal Flag to indicate if the candidate is matched to a genereated XiCplus MC particle /// \return true if Xic candidate passes all selections, otherwise false - template + template bool isSelectedXicToXiPiPiCandidateWoMl(XicCandidate const& hfCandXic, TracksExtraWPid const&, int& statusXicToXiPiPi, @@ -300,7 +297,7 @@ struct HfCandidateSelectorXicToXiPiPi { { // Successful reconstruction SETBIT(statusXicToXiPiPi, hf_sel_candidate_xic::XicToXiPiPiSelectionStep::RecoTotal); // RecoTotal = 0 --> statusXicToXiPiPi += 1 - if constexpr (isMc) { + if constexpr (IsMc) { if (isMatchedSignal) { registry.fill(HIST("hSelCandidatesRecSig"), All); } else { @@ -318,7 +315,7 @@ struct HfCandidateSelectorXicToXiPiPi { auto trackV0NegDau = hfCandXic.template negTrack_as(); if (fillQAHistograms) { - if constexpr (isMc) { + if constexpr (IsMc) { if (isMatchedSignal) { registry.fill(HIST("hEtaPi0FromXicRecSig"), trackPi0.eta()); registry.fill(HIST("hEtaPi1FromXicRecSig"), trackPi1.eta()); @@ -389,11 +386,11 @@ struct HfCandidateSelectorXicToXiPiPi { // check whether candidate is in analyzed pT range auto ptCandXic = hfCandXic.pt(); - int pTBin = findBin(binsPt, ptCandXic); + int const pTBin = findBin(binsPt, ptCandXic); if (pTBin == -1) { return false; } - if constexpr (isMc) { + if constexpr (IsMc) { if (isMatchedSignal) { registry.fill(HIST("hSelCandidatesRecSig"), Pt); } else { @@ -407,7 +404,7 @@ struct HfCandidateSelectorXicToXiPiPi { if (std::abs(hfCandXic.invMassXicPlus() - o2::constants::physics::MassXiCPlus) > cuts->get(pTBin, "m")) { return false; } - if constexpr (isMc) { + if constexpr (IsMc) { if (isMatchedSignal) { registry.fill(HIST("hSelCandidatesRecSig"), Mass); } else { @@ -421,7 +418,7 @@ struct HfCandidateSelectorXicToXiPiPi { if (std::abs(hfCandXic.y(o2::constants::physics::MassXiCPlus)) > cuts->get(pTBin, "y")) { return false; } - if constexpr (isMc) { + if constexpr (IsMc) { if (isMatchedSignal) { registry.fill(HIST("hSelCandidatesRecSig"), Rapidity); } else { @@ -435,7 +432,7 @@ struct HfCandidateSelectorXicToXiPiPi { if (std::abs(hfCandXic.eta()) > cuts->get(pTBin, "eta")) { return false; } - if constexpr (isMc) { + if constexpr (IsMc) { if (isMatchedSignal) { registry.fill(HIST("hSelCandidatesRecSig"), Eta); } else { @@ -449,7 +446,7 @@ struct HfCandidateSelectorXicToXiPiPi { if (std::abs(trackPi0.eta()) > cuts->get(pTBin, "eta Pi from XicPlus") || std::abs(trackPi1.eta()) > cuts->get(pTBin, "eta Pi from XicPlus")) { return false; } - if constexpr (isMc) { + if constexpr (IsMc) { if (isMatchedSignal) { registry.fill(HIST("hSelCandidatesRecSig"), EtaPionFromXicPlus); } else { @@ -463,7 +460,7 @@ struct HfCandidateSelectorXicToXiPiPi { if (std::abs(trackPiFromXi.eta()) > cuts->get(pTBin, "eta Xi Daughters") || std::abs(trackV0PosDau.eta()) > cuts->get(pTBin, "eta Xi Daughters") || std::abs(trackV0NegDau.eta()) > cuts->get(pTBin, "eta Xi Daughters")) { return false; } - if constexpr (isMc) { + if constexpr (IsMc) { if (isMatchedSignal) { registry.fill(HIST("hSelCandidatesRecSig"), EtaXiDaughters); } else { @@ -477,7 +474,7 @@ struct HfCandidateSelectorXicToXiPiPi { if (hfCandXic.ptProng1() < cuts->get(pTBin, "pT Pi0") || hfCandXic.ptProng2() < cuts->get(pTBin, "pT Pi1") || (hfCandXic.ptProng1() + hfCandXic.ptProng2()) < cuts->get(pTBin, "pT Pi0 + Pi1")) { return false; } - if constexpr (isMc) { + if constexpr (IsMc) { if (isMatchedSignal) { registry.fill(HIST("hSelCandidatesRecSig"), PtPionFromXicPlus); } else { @@ -491,7 +488,7 @@ struct HfCandidateSelectorXicToXiPiPi { if (hfCandXic.chi2PCA() > cuts->get(pTBin, "chi2SV")) { return false; } - if constexpr (isMc) { + if constexpr (IsMc) { if (isMatchedSignal) { registry.fill(HIST("hSelCandidatesRecSig"), Chi2SV); } else { @@ -505,7 +502,7 @@ struct HfCandidateSelectorXicToXiPiPi { if (hfCandXic.decayLength() < cuts->get(pTBin, "min decay length") || hfCandXic.decayLengthXY() < cuts->get(pTBin, "min decay length XY")) { return false; } - if constexpr (isMc) { + if constexpr (IsMc) { if (isMatchedSignal) { registry.fill(HIST("hSelCandidatesRecSig"), MinDecayLength); } else { @@ -519,7 +516,7 @@ struct HfCandidateSelectorXicToXiPiPi { if (hfCandXic.invMassXiPi0() > cuts->get(pTBin, "max inv mass Xi-Pi0") || hfCandXic.invMassXiPi1() > cuts->get(pTBin, "max inv mass Xi-Pi1")) { return false; } - if constexpr (isMc) { + if constexpr (IsMc) { if (isMatchedSignal) { registry.fill(HIST("hSelCandidatesRecSig"), MaxInvMassXiPiPairs); } else { @@ -542,7 +539,7 @@ struct HfCandidateSelectorXicToXiPiPi { !isSelectedTrackTpcQuality(trackV0NegDau, nClustersTpcMin, nTpcCrossedRowsMin, tpcCrossedRowsOverFindableClustersRatioMin, tpcChi2PerClusterMax)) { return false; } - if constexpr (isMc) { + if constexpr (IsMc) { if (isMatchedSignal) { registry.fill(HIST("hSelCandidatesRecSig"), TpcTrackQualityXiDaughters); } else { @@ -557,7 +554,7 @@ struct HfCandidateSelectorXicToXiPiPi { !isSelectedTrackTpcQuality(trackPi1, nClustersTpcMin, nTpcCrossedRowsMin, tpcCrossedRowsOverFindableClustersRatioMin, tpcChi2PerClusterMax)) { return false; } - if constexpr (isMc) { + if constexpr (IsMc) { if (isMatchedSignal) { registry.fill(HIST("hSelCandidatesRecSig"), TpcTrackQualityPiFromCharm); } else { @@ -572,7 +569,7 @@ struct HfCandidateSelectorXicToXiPiPi { (!isSelectedTrackItsQuality(trackPi0, nClustersItsMin, itsChi2PerClusterMax) || trackPi1.itsNClsInnerBarrel() < nClustersItsInnBarrMin)) { return false; } - if constexpr (isMc) { + if constexpr (IsMc) { if (isMatchedSignal) { registry.fill(HIST("hSelCandidatesRecSig"), ItsTrackQualityPiFromCharm); } else { @@ -585,7 +582,7 @@ struct HfCandidateSelectorXicToXiPiPi { // Successful track quality selection SETBIT(statusXicToXiPiPi, hf_sel_candidate_xic::XicToXiPiPiSelectionStep::RecoTrackQuality); // RecoTrackQuality = 2 --> statusXicToXiPiPi += 4 } else { - if constexpr (isMc) { + if constexpr (IsMc) { if (isMatchedSignal) { registry.fill(HIST("hSelCandidatesRecSig"), TpcTrackQualityXiDaughters); registry.fill(HIST("hSelCandidatesRecSig"), TpcTrackQualityPiFromCharm); @@ -640,7 +637,7 @@ struct HfCandidateSelectorXicToXiPiPi { // Successful PID selection SETBIT(statusXicToXiPiPi, hf_sel_candidate_xic::XicToXiPiPiSelectionStep::RecoPID); // RecoPID = 3 --> statusXicToXiPiPi += 8 - if constexpr (isMc) { + if constexpr (IsMc) { if (isMatchedSignal) { registry.fill(HIST("hSelCandidatesRecSig"), PidSelected); } else { @@ -650,7 +647,7 @@ struct HfCandidateSelectorXicToXiPiPi { registry.fill(HIST("hSelCandidates"), PidSelected); } } else { - if constexpr (isMc) { + if constexpr (IsMc) { if (isMatchedSignal) { registry.fill(HIST("hSelCandidatesRecSig"), PidSelected); } else { @@ -668,13 +665,13 @@ struct HfCandidateSelectorXicToXiPiPi { /// \param hfCandXic Xic candidate /// \param statusXicToXiPiPi Flag to store selection status as defined in hf_sel_candidate_xic::XicToXiPiPiSelectionStep /// \param isMatchedSignal Flag to indicate if the candidate is matched to a genereated XiCplus MC particle - template + template void isBdtSelected(XicCandidate const& hfCandXic, int& statusXicToXiPiPi, bool const isMatchedSignal = false) { bool isSelectedMlXicToXiPiPi = false; - float ptCandXic = hfCandXic.pt(); + float const ptCandXic = hfCandXic.pt(); std::vector inputFeaturesXicToXiPiPi = hfMlResponse.getInputFeatures(hfCandXic); isSelectedMlXicToXiPiPi = hfMlResponse.isSelectedMl(inputFeaturesXicToXiPiPi, ptCandXic, outputMlXicToXiPiPi); @@ -687,7 +684,7 @@ struct HfCandidateSelectorXicToXiPiPi { // Successful ML selection SETBIT(statusXicToXiPiPi, hf_sel_candidate_xic::XicToXiPiPiSelectionStep::RecoMl); // RecoML = 4 --> statusXicToXiPiPi += 16 - if constexpr (isMc) { + if constexpr (IsMc) { if (isMatchedSignal) { registry.fill(HIST("hSelCandidatesRecSig"), BdtSelected); } else { diff --git a/PWGHF/TableProducer/candidateSelectorXiccToPKPiPi.cxx b/PWGHF/TableProducer/candidateSelectorXiccToPKPiPi.cxx index dd178bd83f0..24057d1e59b 100644 --- a/PWGHF/TableProducer/candidateSelectorXiccToPKPiPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorXiccToPKPiPi.cxx @@ -80,7 +80,7 @@ struct HfCandidateSelectorXiccToPKPiPi { bool selectionTopol(const T1& hfCandXicc, const T2& hfCandXic, const T3& trackPi) { auto candpT = hfCandXicc.pt(); - int pTBin = findBin(binsPt, candpT); + int const pTBin = findBin(binsPt, candpT); if (pTBin == -1) { return false; } @@ -161,7 +161,7 @@ struct HfCandidateSelectorXiccToPKPiPi { // final selection flag: 0 - rejected, 1 - accepted auto statusXiccToPKPiPi = 0; - if (!(hfCandXicc.hfflag() & 1 << aod::hf_cand_xicc::DecayType::XiccToXicPi)) { + if ((hfCandXicc.hfflag() & 1 << aod::hf_cand_xicc::DecayType::XiccToXicPi) == 0) { hfSelXiccToPKPiPiCandidate(statusXiccToPKPiPi); continue; } @@ -179,7 +179,7 @@ struct HfCandidateSelectorXiccToPKPiPi { pidPi = 1; } else { // track-level PID selection - int pidPion = selectorPion.statusTpcOrTof(trackPi); + int const pidPion = selectorPion.statusTpcOrTof(trackPi); if (pidPion == TrackSelectorPID::Accepted) { pidPi = 1; } diff --git a/PWGHF/TableProducer/derivedDataCreatorB0ToDPi.cxx b/PWGHF/TableProducer/derivedDataCreatorB0ToDPi.cxx index 53a1c31e8c7..862e3da3d38 100644 --- a/PWGHF/TableProducer/derivedDataCreatorB0ToDPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorB0ToDPi.cxx @@ -236,7 +236,7 @@ struct HfDerivedDataCreatorB0ToDPi { } } - template + template void processCandidates(CollType const& collisions, Partition& candidates, CandCharmType const&, @@ -244,7 +244,7 @@ struct HfDerivedDataCreatorB0ToDPi { aod::BCs const&) { // Fill collision properties - if constexpr (isMc) { + if constexpr (IsMc) { if (confDerData.fillMcRCollId) { rowsCommon.matchedCollisions.clear(); } @@ -258,7 +258,7 @@ struct HfDerivedDataCreatorB0ToDPi { LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCand); // Skip collisions without HF candidates (and without HF particles in matched MC collisions if saving indices of reconstructed collisions matched to MC collisions) bool mcCollisionHasMcParticles{false}; - if constexpr (isMc) { + if constexpr (IsMc) { mcCollisionHasMcParticles = confDerData.fillMcRCollId && collision.has_mcCollision() && rowsCommon.hasMcParticles[collision.mcCollisionId()]; LOGF(debug, "Rec. collision %d has MC collision %d with MC particles? %s", thisCollId, collision.mcCollisionId(), mcCollisionHasMcParticles ? "yes" : "no"); } @@ -267,7 +267,7 @@ struct HfDerivedDataCreatorB0ToDPi { continue; } LOGF(debug, "Filling rec. collision %d at derived index %d", thisCollId, rowsCommon.rowCollBase.lastIndex() + 1); - rowsCommon.fillTablesCollision(collision); + rowsCommon.fillTablesCollision(collision); // Fill candidate properties rowsCommon.reserveTablesCandidates(sizeTableCand); @@ -278,31 +278,31 @@ struct HfDerivedDataCreatorB0ToDPi { reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); reserveTable(rowCandidateMlDplus, fillCandidateMlDplus, sizeTableCand); reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); - if constexpr (isMc) { + if constexpr (IsMc) { reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); } int8_t flagMcRec = 0, origin = 0; for (const auto& candidate : candidatesThisColl) { - if constexpr (isMl) { + if constexpr (IsMl) { if (!TESTBIT(candidate.isSelB0ToDPi(), aod::SelectionStep::RecoMl)) { continue; } } - if constexpr (isMc) { + if constexpr (IsMc) { flagMcRec = candidate.flagMcMatchRec(); origin = candidate.originMcRec(); - if constexpr (onlyBkg) { + if constexpr (OnlyBkg) { if (std::abs(flagMcRec) == DecayChannelMain::B0ToDminusPi) { continue; } if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); + float const pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } } } - if constexpr (onlySig) { + if constexpr (OnlySig) { if (std::abs(flagMcRec) != DecayChannelMain::B0ToDminusPi) { continue; } @@ -310,13 +310,13 @@ struct HfDerivedDataCreatorB0ToDPi { } auto prongCharm = candidate.template prong0_as(); auto prongBachelor = candidate.template prong1_as(); - double ct = hfHelper.ctB0(candidate); - double y = hfHelper.yB0(candidate); - float massB0ToDPi = hfHelper.invMassB0ToDPi(candidate); + double const ct = hfHelper.ctB0(candidate); + double const y = hfHelper.yB0(candidate); + float const massB0ToDPi = hfHelper.invMassB0ToDPi(candidate); float mlScoreB0ToDPi{-1.f}; std::vector mlScoresDplus; std::copy(prongCharm.mlProbDplusToPiKPi().begin(), prongCharm.mlProbDplusToPiKPi().end(), std::back_inserter(mlScoresDplus)); - if constexpr (isMl) { + if constexpr (IsMl) { mlScoreB0ToDPi = candidate.mlProbB0ToDPi(); } fillTablesCandidate(candidate, prongCharm, prongBachelor, 0, massB0ToDPi, ct, y, flagMcRec, origin, mlScoreB0ToDPi, mlScoresDplus); diff --git a/PWGHF/TableProducer/derivedDataCreatorBplusToD0Pi.cxx b/PWGHF/TableProducer/derivedDataCreatorBplusToD0Pi.cxx index da07e1abfad..6e33f7b4f1d 100644 --- a/PWGHF/TableProducer/derivedDataCreatorBplusToD0Pi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorBplusToD0Pi.cxx @@ -239,7 +239,7 @@ struct HfDerivedDataCreatorBplusToD0Pi { } } - template + template void processCandidates(CollType const& collisions, Partition& candidates, CandCharmType const&, @@ -247,7 +247,7 @@ struct HfDerivedDataCreatorBplusToD0Pi { aod::BCs const&) { // Fill collision properties - if constexpr (isMc) { + if constexpr (IsMc) { if (confDerData.fillMcRCollId) { rowsCommon.matchedCollisions.clear(); } @@ -261,7 +261,7 @@ struct HfDerivedDataCreatorBplusToD0Pi { LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCand); // Skip collisions without HF candidates (and without HF particles in matched MC collisions if saving indices of reconstructed collisions matched to MC collisions) bool mcCollisionHasMcParticles{false}; - if constexpr (isMc) { + if constexpr (IsMc) { mcCollisionHasMcParticles = confDerData.fillMcRCollId && collision.has_mcCollision() && rowsCommon.hasMcParticles[collision.mcCollisionId()]; LOGF(debug, "Rec. collision %d has MC collision %d with MC particles? %s", thisCollId, collision.mcCollisionId(), mcCollisionHasMcParticles ? "yes" : "no"); } @@ -270,7 +270,7 @@ struct HfDerivedDataCreatorBplusToD0Pi { continue; } LOGF(debug, "Filling rec. collision %d at derived index %d", thisCollId, rowsCommon.rowCollBase.lastIndex() + 1); - rowsCommon.fillTablesCollision(collision); + rowsCommon.fillTablesCollision(collision); // Fill candidate properties rowsCommon.reserveTablesCandidates(sizeTableCand); @@ -281,31 +281,31 @@ struct HfDerivedDataCreatorBplusToD0Pi { reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); reserveTable(rowCandidateMlD0, fillCandidateMlD0, sizeTableCand); reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); - if constexpr (isMc) { + if constexpr (IsMc) { reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); } int8_t flagMcRec = 0, origin = 0; for (const auto& candidate : candidatesThisColl) { - if constexpr (isMl) { + if constexpr (IsMl) { if (!TESTBIT(candidate.isSelBplusToD0Pi(), aod::SelectionStep::RecoMl)) { continue; } } - if constexpr (isMc) { + if constexpr (IsMc) { flagMcRec = candidate.flagMcMatchRec(); origin = candidate.originMcRec(); - if constexpr (onlyBkg) { + if constexpr (OnlyBkg) { if (std::abs(flagMcRec) == DecayChannelMain::BplusToD0Pi) { continue; } if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); + float const pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } } } - if constexpr (onlySig) { + if constexpr (OnlySig) { if (std::abs(flagMcRec) != DecayChannelMain::BplusToD0Pi) { continue; } @@ -313,18 +313,18 @@ struct HfDerivedDataCreatorBplusToD0Pi { } auto prongCharm = candidate.template prong0_as(); auto prongBachelor = candidate.template prong1_as(); - double ct = hfHelper.ctBplus(candidate); - double y = hfHelper.yBplus(candidate); - float massBplusToD0Pi = hfHelper.invMassBplusToD0Pi(candidate); + double const ct = hfHelper.ctBplus(candidate); + double const y = hfHelper.yBplus(candidate); + float const massBplusToD0Pi = hfHelper.invMassBplusToD0Pi(candidate); float mlScoreBplusToD0Pi{-1.f}; std::vector mlScoresD0; - bool isD0 = prongBachelor.sign() < 0; + bool const isD0 = prongBachelor.sign() < 0; if (isD0) { // is D0 std::copy(prongCharm.mlProbD0().begin(), prongCharm.mlProbD0().end(), std::back_inserter(mlScoresD0)); } else { // is D0bar std::copy(prongCharm.mlProbD0bar().begin(), prongCharm.mlProbD0bar().end(), std::back_inserter(mlScoresD0)); } - if constexpr (isMl) { + if constexpr (IsMl) { mlScoreBplusToD0Pi = candidate.mlProbBplusToD0Pi(); } // flag = 0 for D0 pi-, flag = 1 for D0bar pi+ diff --git a/PWGHF/TableProducer/derivedDataCreatorD0ToKPi.cxx b/PWGHF/TableProducer/derivedDataCreatorD0ToKPi.cxx index d1d803d5361..ece7eba03c4 100644 --- a/PWGHF/TableProducer/derivedDataCreatorD0ToKPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorD0ToKPi.cxx @@ -237,14 +237,14 @@ struct HfDerivedDataCreatorD0ToKPi { } } - template + template void processCandidates(CollType const& collisions, Partition& candidates, aod::Tracks const&, aod::BCs const&) { // Fill collision properties - if constexpr (isMc) { + if constexpr (IsMc) { if (confDerData.fillMcRCollId) { rowsCommon.matchedCollisions.clear(); } @@ -258,7 +258,7 @@ struct HfDerivedDataCreatorD0ToKPi { LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCand); // Skip collisions without HF candidates (and without HF particles in matched MC collisions if saving indices of reconstructed collisions matched to MC collisions) bool mcCollisionHasMcParticles{false}; - if constexpr (isMc) { + if constexpr (IsMc) { mcCollisionHasMcParticles = confDerData.fillMcRCollId && collision.has_mcCollision() && rowsCommon.hasMcParticles[collision.mcCollisionId()]; LOGF(debug, "Rec. collision %d has MC collision %d with MC particles? %s", thisCollId, collision.mcCollisionId(), mcCollisionHasMcParticles ? "yes" : "no"); } @@ -267,7 +267,7 @@ struct HfDerivedDataCreatorD0ToKPi { continue; } LOGF(debug, "Filling rec. collision %d at derived index %d", thisCollId, rowsCommon.rowCollBase.lastIndex() + 1); - rowsCommon.fillTablesCollision(collision); + rowsCommon.fillTablesCollision(collision); // Fill candidate properties rowsCommon.reserveTablesCandidates(sizeTableCand); @@ -276,44 +276,44 @@ struct HfDerivedDataCreatorD0ToKPi { reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); - if constexpr (isMc) { + if constexpr (IsMc) { reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); } int8_t flagMcRec = 0, origin = 0; for (const auto& candidate : candidatesThisColl) { - if constexpr (isMc) { + if constexpr (IsMc) { flagMcRec = candidate.flagMcMatchRec(); origin = candidate.originMcRec(); - if constexpr (onlyBkg) { + if constexpr (OnlyBkg) { if (std::abs(flagMcRec) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { continue; } if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); + float const pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } } } - if constexpr (onlySig) { + if constexpr (OnlySig) { if (std::abs(flagMcRec) != o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { continue; } } } else { if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); + float const pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } } } - double ct = hfHelper.ctD0(candidate); - double y = hfHelper.yD0(candidate); + double const ct = hfHelper.ctD0(candidate); + double const y = hfHelper.yD0(candidate); float massD0, massD0bar; float topolChi2PerNdf = -999.; - if constexpr (reconstructionType == aod::hf_cand::VertexerType::KfParticle) { + if constexpr (ReconstructionType == aod::hf_cand::VertexerType::KfParticle) { massD0 = candidate.kfGeoMassD0(); massD0bar = candidate.kfGeoMassD0bar(); topolChi2PerNdf = candidate.kfTopolChi2OverNdf(); @@ -322,7 +322,7 @@ struct HfDerivedDataCreatorD0ToKPi { massD0bar = hfHelper.invMassD0barToKPi(candidate); } std::vector mlScoresD0, mlScoresD0bar; - if constexpr (isMl) { + if constexpr (IsMl) { std::copy(candidate.mlProbD0().begin(), candidate.mlProbD0().end(), std::back_inserter(mlScoresD0)); std::copy(candidate.mlProbD0bar().begin(), candidate.mlProbD0bar().end(), std::back_inserter(mlScoresD0bar)); } diff --git a/PWGHF/TableProducer/derivedDataCreatorDplusToPiKPi.cxx b/PWGHF/TableProducer/derivedDataCreatorDplusToPiKPi.cxx index e1b06568c49..c8bf7a1ee3b 100644 --- a/PWGHF/TableProducer/derivedDataCreatorDplusToPiKPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorDplusToPiKPi.cxx @@ -211,14 +211,14 @@ struct HfDerivedDataCreatorDplusToPiKPi { } } - template + template void processCandidates(CollType const& collisions, Partition& candidates, TracksWPid const&, aod::BCs const&) { // Fill collision properties - if constexpr (isMc) { + if constexpr (IsMc) { if (confDerData.fillMcRCollId) { rowsCommon.matchedCollisions.clear(); } @@ -232,7 +232,7 @@ struct HfDerivedDataCreatorDplusToPiKPi { LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCand); // Skip collisions without HF candidates (and without HF particles in matched MC collisions if saving indices of reconstructed collisions matched to MC collisions) bool mcCollisionHasMcParticles{false}; - if constexpr (isMc) { + if constexpr (IsMc) { mcCollisionHasMcParticles = confDerData.fillMcRCollId && collision.has_mcCollision() && rowsCommon.hasMcParticles[collision.mcCollisionId()]; LOGF(debug, "Rec. collision %d has MC collision %d with MC particles? %s", thisCollId, collision.mcCollisionId(), mcCollisionHasMcParticles ? "yes" : "no"); } @@ -241,7 +241,7 @@ struct HfDerivedDataCreatorDplusToPiKPi { continue; } LOGF(debug, "Filling rec. collision %d at derived index %d", thisCollId, rowsCommon.rowCollBase.lastIndex() + 1); - rowsCommon.fillTablesCollision(collision); + rowsCommon.fillTablesCollision(collision); // Fill candidate properties rowsCommon.reserveTablesCandidates(sizeTableCand); @@ -250,43 +250,43 @@ struct HfDerivedDataCreatorDplusToPiKPi { reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); - if constexpr (isMc) { + if constexpr (IsMc) { reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); } int8_t flagMcRec = 0, origin = 0, swapping = 0, flagDecayChanRec = 0; for (const auto& candidate : candidatesThisColl) { - if constexpr (isMl) { + if constexpr (IsMl) { if (!TESTBIT(candidate.isSelDplusToPiKPi(), aod::SelectionStep::RecoMl)) { continue; } } - if constexpr (isMc) { + if constexpr (IsMc) { flagMcRec = candidate.flagMcMatchRec(); origin = candidate.originMcRec(); swapping = candidate.isCandidateSwapped(); flagDecayChanRec = candidate.flagMcDecayChanRec(); - if constexpr (onlyBkg) { + if constexpr (OnlyBkg) { if (std::abs(flagMcRec) == hf_decay::hf_cand_3prong::DecayChannelMain::DplusToPiKPi) { continue; } if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); + float const pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } } } - if constexpr (onlySig) { + if constexpr (OnlySig) { if (std::abs(flagMcRec) != hf_decay::hf_cand_3prong::DecayChannelMain::DplusToPiKPi) { continue; } } } - double ct = hfHelper.ctDplus(candidate); - double y = hfHelper.yDplus(candidate); - float massDplusToPiKPi = hfHelper.invMassDplusToPiKPi(candidate); + double const ct = hfHelper.ctDplus(candidate); + double const y = hfHelper.yDplus(candidate); + float const massDplusToPiKPi = hfHelper.invMassDplusToPiKPi(candidate); std::vector mlScoresDplusToPiKPi; - if constexpr (isMl) { + if constexpr (IsMl) { std::copy(candidate.mlProbDplusToPiKPi().begin(), candidate.mlProbDplusToPiKPi().end(), std::back_inserter(mlScoresDplusToPiKPi)); } fillTablesCandidate(candidate, 0, massDplusToPiKPi, ct, y, flagMcRec, origin, swapping, flagDecayChanRec, mlScoresDplusToPiKPi); diff --git a/PWGHF/TableProducer/derivedDataCreatorDsToKKPi.cxx b/PWGHF/TableProducer/derivedDataCreatorDsToKKPi.cxx index 1dfe94c9d62..5eb404e57ab 100644 --- a/PWGHF/TableProducer/derivedDataCreatorDsToKKPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorDsToKKPi.cxx @@ -217,14 +217,14 @@ struct HfDerivedDataCreatorDsToKKPi { } } - template + template void processCandidates(CollType const& collisions, Partition& candidates, TracksWPid const&, aod::BCs const&) { // Fill collision properties - if constexpr (isMc) { + if constexpr (IsMc) { if (confDerData.fillMcRCollId) { rowsCommon.matchedCollisions.clear(); } @@ -238,7 +238,7 @@ struct HfDerivedDataCreatorDsToKKPi { LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCand); // Skip collisions without HF candidates (and without HF particles in matched MC collisions if saving indices of reconstructed collisions matched to MC collisions) bool mcCollisionHasMcParticles{false}; - if constexpr (isMc) { + if constexpr (IsMc) { mcCollisionHasMcParticles = confDerData.fillMcRCollId && collision.has_mcCollision() && rowsCommon.hasMcParticles[collision.mcCollisionId()]; LOGF(debug, "Rec. collision %d has MC collision %d with MC particles? %s", thisCollId, collision.mcCollisionId(), mcCollisionHasMcParticles ? "yes" : "no"); } @@ -247,7 +247,7 @@ struct HfDerivedDataCreatorDsToKKPi { continue; } LOGF(debug, "Filling rec. collision %d at derived index %d", thisCollId, rowsCommon.rowCollBase.lastIndex() + 1); - rowsCommon.fillTablesCollision(collision); + rowsCommon.fillTablesCollision(collision); // Fill candidate properties rowsCommon.reserveTablesCandidates(sizeTableCand); @@ -256,43 +256,43 @@ struct HfDerivedDataCreatorDsToKKPi { reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); - if constexpr (isMc) { + if constexpr (IsMc) { reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); } int8_t flagMcRec = 0, origin = 0, swapping = 0, flagDecayChanRec = 0; for (const auto& candidate : candidatesThisColl) { - if constexpr (isMl) { + if constexpr (IsMl) { if (!TESTBIT(candidate.isSelDsToKKPi(), aod::SelectionStep::RecoMl)) { continue; } } - if constexpr (isMc) { + if constexpr (IsMc) { flagMcRec = candidate.flagMcMatchRec(); origin = candidate.originMcRec(); swapping = candidate.isCandidateSwapped(); flagDecayChanRec = candidate.flagMcDecayChanRec(); - if constexpr (onlyBkg) { + if constexpr (OnlyBkg) { if (std::abs(flagMcRec) == hf_decay::hf_cand_3prong::DecayChannelMain::DsToPiKK) { continue; } if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); + float const pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } } } - if constexpr (onlySig) { + if constexpr (OnlySig) { if (std::abs(flagMcRec) != hf_decay::hf_cand_3prong::DecayChannelMain::DsToPiKK) { continue; } } } - double ct = hfHelper.ctDs(candidate); - double y = hfHelper.yDs(candidate); - float massDsToKKPi = hfHelper.invMassDsToKKPi(candidate); + double const ct = hfHelper.ctDs(candidate); + double const y = hfHelper.yDs(candidate); + float const massDsToKKPi = hfHelper.invMassDsToKKPi(candidate); std::vector mlScoresDsToKKPi; - if constexpr (isMl) { + if constexpr (IsMl) { std::copy(candidate.mlProbDsToKKPi().begin(), candidate.mlProbDsToKKPi().end(), std::back_inserter(mlScoresDsToKKPi)); } fillTablesCandidate(candidate, 0, massDsToKKPi, ct, y, flagMcRec, origin, swapping, flagDecayChanRec, mlScoresDsToKKPi); diff --git a/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx b/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx index f1b14a5769f..dfbfce30e68 100644 --- a/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx @@ -204,14 +204,14 @@ struct HfDerivedDataCreatorDstarToD0Pi { } } - template + template void processCandidates(CollType const& collisions, Partition& candidates, TracksWPid const&, aod::BCs const&) { // Fill collision properties - if constexpr (isMc) { + if constexpr (IsMc) { if (confDerData.fillMcRCollId) { rowsCommon.matchedCollisions.clear(); } @@ -225,7 +225,7 @@ struct HfDerivedDataCreatorDstarToD0Pi { LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCand); // Skip collisions without HF candidates (and without HF particles in matched MC collisions if saving indices of reconstructed collisions matched to MC collisions) bool mcCollisionHasMcParticles{false}; - if constexpr (isMc) { + if constexpr (IsMc) { mcCollisionHasMcParticles = confDerData.fillMcRCollId && collision.has_mcCollision() && rowsCommon.hasMcParticles[collision.mcCollisionId()]; LOGF(debug, "Rec. collision %d has MC collision %d with MC particles? %s", thisCollId, collision.mcCollisionId(), mcCollisionHasMcParticles ? "yes" : "no"); } @@ -234,7 +234,7 @@ struct HfDerivedDataCreatorDstarToD0Pi { continue; } LOGF(debug, "Filling rec. collision %d at derived index %d", thisCollId, rowsCommon.rowCollBase.lastIndex() + 1); - rowsCommon.fillTablesCollision(collision); + rowsCommon.fillTablesCollision(collision); // Fill candidate properties rowsCommon.reserveTablesCandidates(sizeTableCand); @@ -243,37 +243,37 @@ struct HfDerivedDataCreatorDstarToD0Pi { reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); - if constexpr (isMc) { + if constexpr (IsMc) { reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); } int8_t flagMcRec = 0, flagMcRecD0 = 0, origin = 0, nTracksDecayed = 0; double ptBhadMotherPart = 0; int pdgBhadMotherPart = 0; for (const auto& candidate : candidatesThisColl) { - if constexpr (isMl) { + if constexpr (IsMl) { if (!TESTBIT(candidate.isSelDstarToD0Pi(), aod::SelectionStep::RecoMl)) { continue; } } - if constexpr (isMc) { + if constexpr (IsMc) { flagMcRec = candidate.flagMcMatchRec(); flagMcRecD0 = candidate.flagMcMatchRecD0(); origin = candidate.originMcRec(); nTracksDecayed = candidate.nTracksDecayed(); ptBhadMotherPart = candidate.ptBhadMotherPart(); pdgBhadMotherPart = candidate.pdgBhadMotherPart(); - if constexpr (onlyBkg) { + if constexpr (OnlyBkg) { if (std::abs(flagMcRec) == hf_decay::hf_cand_dstar::DecayChannelMain::DstarToPiKPi) { continue; } if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); + float const pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } } } - if constexpr (onlySig) { + if constexpr (OnlySig) { if (std::abs(flagMcRec) != hf_decay::hf_cand_dstar::DecayChannelMain::DstarToPiKPi) { continue; } @@ -282,11 +282,11 @@ struct HfDerivedDataCreatorDstarToD0Pi { auto prong0 = candidate.template prong0_as(); auto prong1 = candidate.template prong1_as(); auto prongSoftPi = candidate.template prongPi_as(); - double y = candidate.y(o2::constants::physics::MassDStar); + double const y = candidate.y(o2::constants::physics::MassDStar); int flagSign = -1; double massDstar = 0, invMassD0 = 0; std::vector mlScoresDstarToD0Pi; - if constexpr (isMl) { + if constexpr (IsMl) { std::copy(candidate.mlProbDstarToD0Pi().begin(), candidate.mlProbDstarToD0Pi().end(), std::back_inserter(mlScoresDstarToD0Pi)); } if (candidate.signSoftPi() > 0) { diff --git a/PWGHF/TableProducer/derivedDataCreatorLcToPKPi.cxx b/PWGHF/TableProducer/derivedDataCreatorLcToPKPi.cxx index 96835cdefe5..86688ca2bb5 100644 --- a/PWGHF/TableProducer/derivedDataCreatorLcToPKPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorLcToPKPi.cxx @@ -216,14 +216,14 @@ struct HfDerivedDataCreatorLcToPKPi { } } - template + template void processCandidates(CollType const& collisions, Partition& candidates, TracksWPid const&, aod::BCs const&) { // Fill collision properties - if constexpr (isMc) { + if constexpr (IsMc) { if (confDerData.fillMcRCollId) { rowsCommon.matchedCollisions.clear(); } @@ -237,7 +237,7 @@ struct HfDerivedDataCreatorLcToPKPi { LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCand); // Skip collisions without HF candidates (and without HF particles in matched MC collisions if saving indices of reconstructed collisions matched to MC collisions) bool mcCollisionHasMcParticles{false}; - if constexpr (isMc) { + if constexpr (IsMc) { mcCollisionHasMcParticles = confDerData.fillMcRCollId && collision.has_mcCollision() && rowsCommon.hasMcParticles[collision.mcCollisionId()]; LOGF(debug, "Rec. collision %d has MC collision %d with MC particles? %s", thisCollId, collision.mcCollisionId(), mcCollisionHasMcParticles ? "yes" : "no"); } @@ -246,7 +246,7 @@ struct HfDerivedDataCreatorLcToPKPi { continue; } LOGF(debug, "Filling rec. collision %d at derived index %d", thisCollId, rowsCommon.rowCollBase.lastIndex() + 1); - rowsCommon.fillTablesCollision(collision); + rowsCommon.fillTablesCollision(collision); // Fill candidate properties rowsCommon.reserveTablesCandidates(sizeTableCand); @@ -255,45 +255,45 @@ struct HfDerivedDataCreatorLcToPKPi { reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); - if constexpr (isMc) { + if constexpr (IsMc) { reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); } int8_t flagMcRec = 0, origin = 0, swapping = 0; for (const auto& candidate : candidatesThisColl) { - if constexpr (isMc) { + if constexpr (IsMc) { flagMcRec = candidate.flagMcMatchRec(); origin = candidate.originMcRec(); swapping = candidate.isCandidateSwapped(); - if constexpr (onlyBkg) { + if constexpr (OnlyBkg) { if (std::abs(flagMcRec) == hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi) { continue; } if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); + float const pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } } } - if constexpr (onlySig) { + if constexpr (OnlySig) { if (std::abs(flagMcRec) != hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi) { continue; } } } else { if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); + float const pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } } } - double ct = hfHelper.ctLc(candidate); - double y = hfHelper.yLc(candidate); - float massLcToPKPi = hfHelper.invMassLcToPKPi(candidate); - float massLcToPiKP = hfHelper.invMassLcToPiKP(candidate); + double const ct = hfHelper.ctLc(candidate); + double const y = hfHelper.yLc(candidate); + float const massLcToPKPi = hfHelper.invMassLcToPKPi(candidate); + float const massLcToPiKP = hfHelper.invMassLcToPiKP(candidate); std::vector mlScoresLcToPKPi, mlScoresLcToPiKP; - if constexpr (isMl) { + if constexpr (IsMl) { std::copy(candidate.mlProbLcToPKPi().begin(), candidate.mlProbLcToPKPi().end(), std::back_inserter(mlScoresLcToPKPi)); std::copy(candidate.mlProbLcToPiKP().begin(), candidate.mlProbLcToPiKP().end(), std::back_inserter(mlScoresLcToPiKP)); } diff --git a/PWGHF/TableProducer/derivedDataCreatorXicToXiPiPi.cxx b/PWGHF/TableProducer/derivedDataCreatorXicToXiPiPi.cxx index 92af9a89c53..6dc0fac79d3 100644 --- a/PWGHF/TableProducer/derivedDataCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorXicToXiPiPi.cxx @@ -215,14 +215,14 @@ struct HfDerivedDataCreatorXicToXiPiPi { } } - template + template void processCandidates(CollType const& collisions, Partition& candidates, TracksWPid const&, aod::BCs const&) { // Fill collision properties - if constexpr (isMc) { + if constexpr (IsMc) { if (confDerData.fillMcRCollId) { rowsCommon.matchedCollisions.clear(); } @@ -236,7 +236,7 @@ struct HfDerivedDataCreatorXicToXiPiPi { LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCand); // Skip collisions without HF candidates (and without HF particles in matched MC collisions if saving indices of reconstructed collisions matched to MC collisions) bool mcCollisionHasMcParticles{false}; - if constexpr (isMc) { + if constexpr (IsMc) { mcCollisionHasMcParticles = confDerData.fillMcRCollId && collision.has_mcCollision() && rowsCommon.hasMcParticles[collision.mcCollisionId()]; LOGF(debug, "Rec. collision %d has MC collision %d with MC particles? %s", thisCollId, collision.mcCollisionId(), mcCollisionHasMcParticles ? "yes" : "no"); } @@ -245,7 +245,7 @@ struct HfDerivedDataCreatorXicToXiPiPi { continue; } LOGF(debug, "Filling rec. collision %d at derived index %d", thisCollId, rowsCommon.rowCollBase.lastIndex() + 1); - rowsCommon.fillTablesCollision(collision); + rowsCommon.fillTablesCollision(collision); // Fill candidate properties rowsCommon.reserveTablesCandidates(sizeTableCand); @@ -254,41 +254,41 @@ struct HfDerivedDataCreatorXicToXiPiPi { reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); - if constexpr (isMc) { + if constexpr (IsMc) { reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); } int8_t flagMcRec = 0, origin = 0; for (const auto& candidate : candidatesThisColl) { - if constexpr (isMl) { + if constexpr (IsMl) { if (!TESTBIT(candidate.isSelXicToXiPiPi(), o2::aod::hf_sel_candidate_xic::XicToXiPiPiSelectionStep::RecoMl)) { continue; } } - if constexpr (isMc) { + if constexpr (IsMc) { flagMcRec = candidate.flagMcMatchRec(); origin = candidate.originMcRec(); - if constexpr (onlyBkg) { + if constexpr (OnlyBkg) { if (TESTBIT(std::abs(flagMcRec), DecayType::XicToXiPiPi)) { continue; } if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); + float const pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } } } - if constexpr (onlySig) { + if constexpr (OnlySig) { if (!TESTBIT(std::abs(flagMcRec), DecayType::XicToXiPiPi)) { continue; } } } - float massXicToXiPiPi = candidate.invMassXicPlus(); - double ct = hfHelper.ctXic(candidate); - double y = hfHelper.yXic(candidate); + float const massXicToXiPiPi = candidate.invMassXicPlus(); + double const ct = hfHelper.ctXic(candidate); + double const y = hfHelper.yXic(candidate); std::vector mlScoresXicToXiPiPi; - if constexpr (isMl) { + if constexpr (IsMl) { std::copy(candidate.mlProbXicToXiPiPi().begin(), candidate.mlProbXicToXiPiPi().end(), std::back_inserter(mlScoresXicToXiPiPi)); } // FIXME: Remove candFlag? diff --git a/PWGHF/TableProducer/mcPidTof.cxx b/PWGHF/TableProducer/mcPidTof.cxx index a310175c789..f3b6aac8bbf 100644 --- a/PWGHF/TableProducer/mcPidTof.cxx +++ b/PWGHF/TableProducer/mcPidTof.cxx @@ -26,6 +26,7 @@ #include "Common/TableProducer/PID/pidTOFBase.h" #include +#include #include #include #include @@ -335,14 +336,11 @@ struct TOFCalibConfig { /// Selection criteria for tracks used for TOF event time bool isTrackGoodMatchForTOFPID(const Trks::iterator& tr) { - if (!tr.hasTOF()) { - return false; - } - return true; + return tr.hasTOF(); } /// Task to produce the TOF signal from the trackTime information -struct tofSignal { +struct TofSignal { // Tables to produce o2::framework::Produces table; o2::framework::Produces tableFlags; @@ -434,8 +432,8 @@ struct tofSignal { /// Selection criteria for tracks used for TOF event time float trackSampleMinMomentum = 0.5f; float trackSampleMaxMomentum = 2.f; -template -bool filterForTOFEventTime(const trackType& tr) +template +bool filterForTOFEventTime(const TrackType& tr) { return (tr.hasTOF() && tr.p() > trackSampleMinMomentum && tr.p() < trackSampleMaxMomentum && @@ -445,30 +443,30 @@ bool filterForTOFEventTime(const trackType& tr) } // accept all /// Specialization of TOF event time maker -template typename response, - typename trackTypeContainer, - typename responseParametersType> -o2::tof::eventTimeContainer evTimeMakerForTracks(const trackTypeContainer& tracks, - const responseParametersType& responseParameters, +template typename Response, + typename TrackTypeContainer, + typename ResponseParametersType> +o2::tof::eventTimeContainer evTimeMakerForTracks(const TrackTypeContainer& tracks, + const ResponseParametersType& responseParameters, const float& diamond = 6.0) { - return o2::tof::evTimeMakerFromParam(tracks, responseParameters, diamond); + return o2::tof::evTimeMakerFromParam(tracks, responseParameters, diamond); } // Part 2 event time definition /// Task to produce the TOF event time table -struct tofEventTime { +struct TofEventTime { // Tables to produce Produces tableEvTime; Produces tableEvTimeTOFOnly; Produces tableFlags; - static constexpr bool removeTOFEvTimeBias = true; // Flag to subtract the Ev. Time bias for low multiplicity events with TOF - static constexpr float diamond = 6.0; // Collision diamond used in the estimation of the TOF event time - static constexpr float errDiamond = diamond * 33.356409f; - static constexpr float weightDiamond = 1.f / (errDiamond * errDiamond); + static constexpr bool RemoveTofEvTimeBias = true; // Flag to subtract the Ev. Time bias for low multiplicity events with TOF + static constexpr float Diamond = 6.0; // Collision diamond used in the estimation of the TOF event time + static constexpr float ErrDiamond = Diamond * 33.356409f; + static constexpr float WeightDiamond = 1.f / (ErrDiamond * ErrDiamond); bool enableTableTOFEvTime = false; bool enableTableEvTimeTOFOnly = false; @@ -517,7 +515,7 @@ struct tofEventTime { trackSampleMaxMomentum = maxMomentum; LOG(info) << "Configuring track sample for TOF ev. time: " << trackSampleMinMomentum << " < p < " << trackSampleMaxMomentum; - if (sel8TOFEvTime.value == true) { + if (sel8TOFEvTime.value) { LOG(info) << "TOF event time will be computed for collisions that pass the event selection only!"; } mTOFCalibConfig.initSetup(mRespParamsV3, ccdb); // Getting the parametrization parameters @@ -530,8 +528,8 @@ struct tofEventTime { /// Process function to prepare the event for each track on Run 3 data without the FT0 // Define slice per collision Preslice perCollision = aod::track::collisionId; - template - using ResponseImplementationEvTime = o2::pid::tof::ExpTimes; + template + using ResponseImplementationEvTime = o2::pid::tof::ExpTimes; void process(TrksWtof const& tracks, aod::FT0s const&, EvTimeCollisionsFT0 const&, @@ -569,9 +567,9 @@ struct tofEventTime { LOG(debug) << "Running on " << CollisionSystemType::getCollisionSystemName(mTOFCalibConfig.collisionSystem()) << " mComputeEvTimeWithTOF " << mComputeEvTimeWithTOF.value << " mComputeEvTimeWithFT0 " << mComputeEvTimeWithFT0.value; if (mComputeEvTimeWithTOF == 1 && mComputeEvTimeWithFT0 == 1) { - int lastCollisionId = -1; // Last collision ID analysed - for (auto const& t : tracks) { // Loop on collisions - if (!t.has_collision() || ((sel8TOFEvTime.value == true) && !t.collision_as().sel8())) { // Track was not assigned, cannot compute event time or event did not pass the event selection + int lastCollisionId = -1; // Last collision ID analysed + for (auto const& t : tracks) { // Loop on collisions + if (!t.has_collision() || ((sel8TOFEvTime.value) && !t.collision_as().sel8())) { // Track was not assigned, cannot compute event time or event did not pass the event selection tableFlags(0); tableEvTime(0.f, 999.f); if (enableTableEvTimeTOFOnly) { @@ -589,7 +587,7 @@ struct tofEventTime { const auto& collision = t.collision_as(); // Compute the TOF event time - const auto evTimeMakerTOF = evTimeMakerForTracks(tracksInCollision, mRespParamsV3, diamond); + const auto evTimeMakerTOF = evTimeMakerForTracks(tracksInCollision, mRespParamsV3, Diamond); float t0AC[2] = {.0f, 999.f}; // Value and error of T0A or T0C or T0AC float t0TOF[2] = {static_cast(evTimeMakerTOF.mEventTime), static_cast(evTimeMakerTOF.mEventTimeError)}; // Value and error of TOF @@ -608,10 +606,10 @@ struct tofEventTime { sumOfWeights = 0.f; weight = 0.f; // Remove the bias on TOF ev. time - if constexpr (removeTOFEvTimeBias) { + if constexpr (RemoveTofEvTimeBias) { evTimeMakerTOF.removeBias(trk, nGoodTracksForTOF, t0TOF[0], t0TOF[1], 2); } - if (t0TOF[1] < errDiamond && (maxEvTimeTOF <= 0 || std::abs(t0TOF[0]) < maxEvTimeTOF)) { + if (t0TOF[1] < ErrDiamond && (maxEvTimeTOF <= 0 || std::abs(t0TOF[0]) < maxEvTimeTOF)) { flags |= o2::aod::pidflags::enums::PIDFlags::EvTimeTOF; weight = 1.f / (t0TOF[1] * t0TOF[1]); @@ -632,9 +630,9 @@ struct tofEventTime { sumOfWeights += weight; } - if (sumOfWeights < weightDiamond) { // avoiding sumOfWeights = 0 or worse that diamond + if (sumOfWeights < WeightDiamond) { // avoiding sumOfWeights = 0 or worse that diamond eventTime = 0; - sumOfWeights = weightDiamond; + sumOfWeights = WeightDiamond; tableFlags(0); } else { tableFlags(flags); @@ -646,9 +644,9 @@ struct tofEventTime { } } } else if (mComputeEvTimeWithTOF == 1 && mComputeEvTimeWithFT0 == 0) { - int lastCollisionId = -1; // Last collision ID analysed - for (auto const& t : tracks) { // Loop on collisions - if (!t.has_collision() || ((sel8TOFEvTime.value == true) && !t.collision_as().sel8())) { // Track was not assigned, cannot compute event time or event did not pass the event selection + int lastCollisionId = -1; // Last collision ID analysed + for (auto const& t : tracks) { // Loop on collisions + if (!t.has_collision() || ((sel8TOFEvTime.value) && !t.collision_as().sel8())) { // Track was not assigned, cannot compute event time or event did not pass the event selection tableFlags(0); tableEvTime(0.f, 999.f); if (enableTableEvTimeTOFOnly) { @@ -665,21 +663,21 @@ struct tofEventTime { const auto& tracksInCollision = tracks.sliceBy(perCollision, lastCollisionId); // First make table for event time - const auto evTimeMakerTOF = evTimeMakerForTracks(tracksInCollision, mRespParamsV3, diamond); + const auto evTimeMakerTOF = evTimeMakerForTracks(tracksInCollision, mRespParamsV3, Diamond); int nGoodTracksForTOF = 0; float et = evTimeMakerTOF.mEventTime; float erret = evTimeMakerTOF.mEventTimeError; for (auto const& trk : tracksInCollision) { // Loop on Tracks - if constexpr (removeTOFEvTimeBias) { + if constexpr (RemoveTofEvTimeBias) { evTimeMakerTOF.removeBias(trk, nGoodTracksForTOF, et, erret, 2); } uint8_t flags = 0; - if (erret < errDiamond && (maxEvTimeTOF <= 0.f || std::abs(et) < maxEvTimeTOF)) { + if (erret < ErrDiamond && (maxEvTimeTOF <= 0.f || std::abs(et) < maxEvTimeTOF)) { flags |= o2::aod::pidflags::enums::PIDFlags::EvTimeTOF; } else { et = 0.f; - erret = errDiamond; + erret = ErrDiamond; } tableFlags(flags); tableEvTime(et, erret); @@ -719,13 +717,13 @@ struct tofEventTime { // Part 3 Nsigma computation -static constexpr int idxPi = 2; -static constexpr int idxKa = 3; -static constexpr int idxPr = 4; -static constexpr int idxDe = 5; +static constexpr int IdxPi = 2; +static constexpr int IdxKa = 3; +static constexpr int IdxPr = 4; +static constexpr int IdxDe = 5; /// Task to produce the response table -struct mcPidTof { +struct McPidTof { // Tables to produce Produces tablePIDPi; Produces tablePIDKa; @@ -749,8 +747,8 @@ struct mcPidTof { std::array, nSpecies> hnSigmaFull; // postcalibrations to overcome MC FT0 timing issue - std::map gMcPostCalibMean{}; - std::map gMcPostCalibSigma{}; + std::map gMcPostCalibMean; + std::map gMcPostCalibSigma; int currentRun{0}; struct : ConfigurableGroup { std::string prefix = "mcRecalib"; @@ -771,7 +769,7 @@ struct mcPidTof { { mTOFCalibConfig.inheritFromBaseTask(initContext); // Checking the tables are requested in the workflow and enabling them (only pi, K, p) - std::array supportedSpecies = {idxPi, idxKa, idxPr, idxDe}; + std::array supportedSpecies = {IdxPi, IdxKa, IdxPr, IdxDe}; for (auto iSpecie{0u}; iSpecie < supportedSpecies.size(); ++iSpecie) { // First checking tiny int flag = -1; @@ -787,7 +785,7 @@ struct mcPidTof { mEnabledParticlesFull.push_back(supportedSpecies[iSpecie]); } } - if (mEnabledParticlesFull.size() == 0 && mEnabledParticles.size() == 0) { + if (mEnabledParticlesFull.empty() && mEnabledParticles.empty()) { LOG(info) << "No PID tables are required, disabling process function"; doprocessFillTables.value = false; doprocessDummy.value = true; @@ -826,7 +824,7 @@ struct mcPidTof { void reserveTable(const int id, const int64_t& size, const bool fullTable = false) { switch (id) { - case idxPi: { + case IdxPi: { if (fullTable) { tablePIDFullPi.reserve(size); } else { @@ -834,7 +832,7 @@ struct mcPidTof { } break; } - case idxKa: { + case IdxKa: { if (fullTable) { tablePIDFullKa.reserve(size); } else { @@ -842,7 +840,7 @@ struct mcPidTof { } break; } - case idxPr: { + case IdxPr: { if (fullTable) { tablePIDFullPr.reserve(size); } else { @@ -860,7 +858,7 @@ struct mcPidTof { void makeTableEmpty(const int id, bool fullTable = false) { switch (id) { - case idxPi: + case IdxPi: if (fullTable) { tablePIDFullPi(-999.f, -999.f); } else { @@ -868,7 +866,7 @@ struct mcPidTof { tablePIDPi); } break; - case idxKa: + case IdxKa: if (fullTable) { tablePIDFullKa(-999.f, -999.f); } else { @@ -876,7 +874,7 @@ struct mcPidTof { tablePIDKa); } break; - case idxPr: + case IdxPr: if (fullTable) { tablePIDFullPr(-999.f, -999.f); } else { @@ -884,7 +882,7 @@ struct mcPidTof { tablePIDPr); } break; - case idxDe: + case IdxDe: if (fullTable) { tablePIDFullDe(-999.f, -999.f); } else { @@ -913,7 +911,7 @@ struct mcPidTof { LOGP(error, "Impossible to read metadata! Using default calibrations (2022 apass7)"); metadata["RecoPassName"] = ""; } - auto calibList = ccdb->getSpecific(mcRecalib.ccdbPath, timestamp, metadata); + auto* calibList = ccdb->getSpecific(mcRecalib.ccdbPath, timestamp, metadata); std::vector updatedSpecies{}; for (auto const& pidId : mEnabledParticles) { // Loop on enabled particle hypotheses (tiny) gMcPostCalibMean[pidId] = reinterpret_cast(calibList->FindObject(Form("Mean%s", particleNames[pidId].data()))); @@ -940,9 +938,9 @@ struct mcPidTof { } float shift{0.f}, scaleWidth{0.f}; - int nPoints = gMcPostCalibMean[pidId]->GetN(); - double ptMin = gMcPostCalibMean[pidId]->GetX()[0]; - double ptMax = gMcPostCalibMean[pidId]->GetX()[nPoints - 1]; + int const nPoints = gMcPostCalibMean[pidId]->GetN(); + double const ptMin = gMcPostCalibMean[pidId]->GetX()[0]; + double const ptMax = gMcPostCalibMean[pidId]->GetX()[nPoints - 1]; if (trackPt < ptMin) { shift = gMcPostCalibMean[pidId]->Eval(ptMin); scaleWidth = gMcPostCalibSigma[pidId]->Eval(ptMin); @@ -959,19 +957,19 @@ struct mcPidTof { } void processDummy(Trks const&) {} - PROCESS_SWITCH(mcPidTof, processDummy, "Dummy process function", false); + PROCESS_SWITCH(McPidTof, processDummy, "Dummy process function", false); - template - using ResponseImplementation = o2::pid::tof::ExpTimes; + template + using ResponseImplementation = o2::pid::tof::ExpTimes; void processFillTables(TrksWtofWevTime const& tracks, Cols const&, aod::BCsWithTimestamps const& bcs, aod::McParticles const&) { - constexpr auto responsePi = ResponseImplementation(); - constexpr auto responseKa = ResponseImplementation(); - constexpr auto responsePr = ResponseImplementation(); - constexpr auto responseDe = ResponseImplementation(); + constexpr auto ResponsePi = ResponseImplementation(); + constexpr auto ResponseKa = ResponseImplementation(); + constexpr auto ResponsePr = ResponseImplementation(); + constexpr auto ResponseDe = ResponseImplementation(); mTOFCalibConfig.processSetup(mRespParamsV3, ccdb, bcs.iteratorAt(0)); // Update the calibration parameters @@ -1008,8 +1006,8 @@ struct mcPidTof { for (auto const& pidId : mEnabledParticles) { // Loop on enabled particle hypotheses switch (pidId) { - case idxPi: { - nSigma = responsePi.GetSeparation(mRespParamsV3, trk); + case IdxPi: { + nSigma = ResponsePi.GetSeparation(mRespParamsV3, trk); if (enableMcRecalib && trk.has_mcParticle()) { if (std::abs(trk.mcParticle().pdgCode()) == kPiPlus) { // we rescale only true signal nSigma = applyMcRecalib(pidId, trk.pt(), nSigma); @@ -1018,8 +1016,8 @@ struct mcPidTof { aod::pidutils::packInTable(nSigma, tablePIDPi); break; } - case idxKa: { - nSigma = responseKa.GetSeparation(mRespParamsV3, trk); + case IdxKa: { + nSigma = ResponseKa.GetSeparation(mRespParamsV3, trk); if (enableMcRecalib && trk.has_mcParticle()) { if (std::abs(trk.mcParticle().pdgCode()) == kKPlus) { // we rescale only true signal nSigma = applyMcRecalib(pidId, trk.pt(), nSigma); @@ -1028,8 +1026,8 @@ struct mcPidTof { aod::pidutils::packInTable(nSigma, tablePIDKa); break; } - case idxPr: { - nSigma = responsePr.GetSeparation(mRespParamsV3, trk); + case IdxPr: { + nSigma = ResponsePr.GetSeparation(mRespParamsV3, trk); if (enableMcRecalib && trk.has_mcParticle()) { if (std::abs(trk.mcParticle().pdgCode()) == kProton) { // we rescale only true signal nSigma = applyMcRecalib(pidId, trk.pt(), nSigma); @@ -1038,11 +1036,11 @@ struct mcPidTof { aod::pidutils::packInTable(nSigma, tablePIDPr); break; } - case idxDe: { - nSigma = responseDe.GetSeparation(mRespParamsV3, trk); + case IdxDe: { + nSigma = ResponseDe.GetSeparation(mRespParamsV3, trk); if (enableMcRecalib && trk.has_mcParticle()) { if (std::abs(trk.mcParticle().pdgCode()) == o2::constants::physics::kDeuteron) { // we rescale only true signal - nSigma = applyMcRecalib(idxPr, trk.pt(), nSigma); // FIXME: currently postcalibrations for protons applied to deuterons, to be checked + nSigma = applyMcRecalib(IdxPr, trk.pt(), nSigma); // FIXME: currently postcalibrations for protons applied to deuterons, to be checked } } aod::pidutils::packInTable(nSigma, tablePIDDe); @@ -1059,9 +1057,9 @@ struct mcPidTof { for (auto const& pidId : mEnabledParticlesFull) { // Loop on enabled particle hypotheses with full tables switch (pidId) { - case idxPi: { - resolution = responsePi.GetExpectedSigma(mRespParamsV3, trk); - nSigma = responsePi.GetSeparation(mRespParamsV3, trk); + case IdxPi: { + resolution = ResponsePi.GetExpectedSigma(mRespParamsV3, trk); + nSigma = ResponsePi.GetSeparation(mRespParamsV3, trk); if (enableMcRecalib && trk.has_mcParticle()) { if (std::abs(trk.mcParticle().pdgCode()) == kPiPlus) { // we rescale only true signal nSigma = applyMcRecalib(pidId, trk.pt(), nSigma); @@ -1070,9 +1068,9 @@ struct mcPidTof { tablePIDFullPi(resolution, nSigma); break; } - case idxKa: { - resolution = responseKa.GetExpectedSigma(mRespParamsV3, trk); - nSigma = responseKa.GetSeparation(mRespParamsV3, trk, resolution); + case IdxKa: { + resolution = ResponseKa.GetExpectedSigma(mRespParamsV3, trk); + nSigma = ResponseKa.GetSeparation(mRespParamsV3, trk, resolution); if (enableMcRecalib && trk.has_mcParticle()) { if (std::abs(trk.mcParticle().pdgCode()) == kKPlus) { // we rescale only true signal nSigma = applyMcRecalib(pidId, trk.pt(), nSigma); @@ -1081,9 +1079,9 @@ struct mcPidTof { tablePIDFullKa(resolution, nSigma); break; } - case idxPr: { - resolution = responsePr.GetExpectedSigma(mRespParamsV3, trk); - nSigma = responsePr.GetSeparation(mRespParamsV3, trk, resolution); + case IdxPr: { + resolution = ResponsePr.GetExpectedSigma(mRespParamsV3, trk); + nSigma = ResponsePr.GetSeparation(mRespParamsV3, trk, resolution); if (enableMcRecalib && trk.has_mcParticle()) { if (std::abs(trk.mcParticle().pdgCode()) == kProton) { // we rescale only true signal nSigma = applyMcRecalib(pidId, trk.pt(), nSigma); @@ -1092,12 +1090,12 @@ struct mcPidTof { tablePIDFullPr(resolution, nSigma); break; } - case idxDe: { - resolution = responseDe.GetExpectedSigma(mRespParamsV3, trk); - nSigma = responseDe.GetSeparation(mRespParamsV3, trk, resolution); + case IdxDe: { + resolution = ResponseDe.GetExpectedSigma(mRespParamsV3, trk); + nSigma = ResponseDe.GetSeparation(mRespParamsV3, trk, resolution); if (enableMcRecalib && trk.has_mcParticle()) { if (std::abs(trk.mcParticle().pdgCode()) == o2::constants::physics::kDeuteron) { // we rescale only true signal - nSigma = applyMcRecalib(idxPr, trk.pt(), nSigma); // FIXME: currently postcalibrations for protons applied to deuterons, to be checked + nSigma = applyMcRecalib(IdxPr, trk.pt(), nSigma); // FIXME: currently postcalibrations for protons applied to deuterons, to be checked } } tablePIDFullDe(resolution, nSigma); @@ -1113,15 +1111,15 @@ struct mcPidTof { } } } - PROCESS_SWITCH(mcPidTof, processFillTables, "Process with table filling", true); + PROCESS_SWITCH(McPidTof, processFillTables, "Process with table filling", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { // Parse the metadata metadataInfo.initMetadata(cfgc); - auto workflow = WorkflowSpec{adaptAnalysisTask(cfgc)}; - workflow.push_back(adaptAnalysisTask(cfgc)); - workflow.push_back(adaptAnalysisTask(cfgc)); + auto workflow = WorkflowSpec{adaptAnalysisTask(cfgc)}; + workflow.push_back(adaptAnalysisTask(cfgc)); + workflow.push_back(adaptAnalysisTask(cfgc)); return workflow; } diff --git a/PWGHF/TableProducer/pidCreator.cxx b/PWGHF/TableProducer/pidCreator.cxx index d4a236b5d72..e011b18cf9b 100644 --- a/PWGHF/TableProducer/pidCreator.cxx +++ b/PWGHF/TableProducer/pidCreator.cxx @@ -86,10 +86,10 @@ struct HfPidCreator { /// \param tpcNSigma is the (binned) NSigma separation in TPC (if tiny = true) /// \param tofNSigma is the (binned) NSigma separation in TOF (if tiny = true) /// \return combined NSigma of TPC and TOF - template + template T1 combineNSigma(T1 tpcNSigma, T1 tofNSigma) { - if constexpr (tiny) { + if constexpr (Tiny) { tpcNSigma *= aod::pidtpc_tiny::binning::bin_width; tofNSigma *= aod::pidtof_tiny::binning::bin_width; } diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index dcd13a07c01..0bcb60aec6e 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -67,8 +67,9 @@ #include #include +#include + #include -#include #include // std::find #include @@ -140,7 +141,7 @@ struct HfTrackIndexSkimCreatorTagSelCollisions { } // set numerical value of the Run 2 trigger class - const auto triggerAlias = std::find(aliasLabels, aliasLabels + kNaliases, triggerClassName.value.data()); + auto* const triggerAlias = std::find(aliasLabels, aliasLabels + kNaliases, triggerClassName.value.data()); if (triggerAlias != aliasLabels + kNaliases) { hfEvSel.triggerClass.value = std::distance(aliasLabels, triggerAlias); } @@ -158,25 +159,25 @@ struct HfTrackIndexSkimCreatorTagSelCollisions { /// Collision selection /// \param collision collision table with - template + template void selectCollision(const Col& collision, const BCsType& bcs) { float centrality{-1.f}; o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; - if constexpr (applyUpcSel) { - rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc( + if constexpr (ApplyUpcSel) { + rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc( collision, centrality, ccdb, registry, bcs); } else { - rejectionMask = hfEvSel.getHfCollisionRejectionMask( + rejectionMask = hfEvSel.getHfCollisionRejectionMask( collision, centrality, ccdb, registry); } if (fillHistograms) { hfEvSel.fillHistograms(collision, rejectionMask, centrality); // additional centrality histos - if constexpr (centEstimator != o2::hf_centrality::None) { + if constexpr (CentEstimator != o2::hf_centrality::None) { if (rejectionMask == 0) { registry.fill(HIST("hCentralitySelected"), centrality); } else if (rejectionMask == BIT(EventRejection::Centrality)) { // rejected by centrality only @@ -318,9 +319,9 @@ struct HfTrackIndexSkimCreatorTagSelTracks { // Needed for PV refitting Service ccdb; - o2::base::MatLayerCylSet* lut; + o2::base::MatLayerCylSet* lut{}; o2::base::Propagator::MatCorrType noMatCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; - int runNumber; + int runNumber{}; using TracksWithSelAndDca = soa::Join; using TracksWithSelAndDcaAndPidTpc = soa::Join; @@ -464,11 +465,11 @@ struct HfTrackIndexSkimCreatorTagSelTracks { /// PID track cuts (for proton only) /// \param hfTrack is a track /// \return true if the track is compatible with a proton hypothesis - template + template uint8_t isSelectedPid(const T& hfTrack) { std::array statusPid{TrackSelectorPID::Accepted, TrackSelectorPID::Accepted, TrackSelectorPID::Accepted, TrackSelectorPID::Accepted}; - if constexpr (pidStrategy == ProtonPidStrategy::PidTofOnly) { + if constexpr (PidStrategy == ProtonPidStrategy::PidTofOnly) { if (hfTrack.hasTOF()) { for (auto iChannel{0u}; iChannel < ChannelsProtonPid::NChannelsProtonPid; ++iChannel) { statusPid[iChannel] = selectorProton[iChannel].statusTof(hfTrack); @@ -476,7 +477,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { statusPid[ChannelKaonPid] = selectorKaon.statusTof(hfTrack); } } - if constexpr (pidStrategy == ProtonPidStrategy::PidTpcOnly) { + if constexpr (PidStrategy == ProtonPidStrategy::PidTpcOnly) { if (hfTrack.hasTPC()) { for (auto iChannel{0u}; iChannel < ChannelsProtonPid::NChannelsProtonPid; ++iChannel) { statusPid[iChannel] = selectorProton[iChannel].statusTpc(hfTrack); @@ -484,13 +485,13 @@ struct HfTrackIndexSkimCreatorTagSelTracks { statusPid[ChannelKaonPid] = selectorKaon.statusTpc(hfTrack); } } - if constexpr (pidStrategy == ProtonPidStrategy::PidTpcOrTof) { + if constexpr (PidStrategy == ProtonPidStrategy::PidTpcOrTof) { for (auto iChannel{0u}; iChannel < ChannelsProtonPid::NChannelsProtonPid; ++iChannel) { statusPid[iChannel] = selectorProton[iChannel].statusTpcOrTof(hfTrack); } statusPid[ChannelKaonPid] = selectorKaon.statusTpcOrTof(hfTrack); } - if constexpr (pidStrategy == ProtonPidStrategy::PidTpcAndTof) { + if constexpr (PidStrategy == ProtonPidStrategy::PidTpcAndTof) { for (auto iChannel{0u}; iChannel < ChannelsProtonPid::NChannelsProtonPid; ++iChannel) { statusPid[iChannel] = selectorProton[iChannel].statusTpcAndTof(hfTrack); } @@ -921,7 +922,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { /// \param pvRefitDcaPerTrack is a vector to be filled with track dcas after PV refit /// \param pvRefitPvCoordPerTrack is a vector to be filled with PV coordinates after PV refit /// \param pvRefitPvCovMatrixPerTrack is a vector to be filled with PV coordinate covariances after PV refit - template + template void runTagSelTracks(aod::Collision const& collision, TTracks const&, GroupedTrackIndices const& trackIndicesCollision, @@ -991,7 +992,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { // } isSelectedTrack(track, trackPt, trackEta, pvRefitDcaXYDcaZ, statusProng); - const int8_t isIdentifiedPid = isSelectedPid(track); + const int8_t isIdentifiedPid = isSelectedPid(track); const bool isPositive = track.sign() > 0; rowSelectedTrack(statusProng, isIdentifiedPid, isPositive); } @@ -1263,9 +1264,9 @@ struct HfTrackIndexSkimCreator { o2::vertexing::DCAFitterN<3> df3; // 3-prong vertex fitter // Needed for PV refitting Service ccdb; - o2::base::MatLayerCylSet* lut; + o2::base::MatLayerCylSet* lut{}; o2::base::Propagator::MatCorrType noMatCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; - int runNumber; + int runNumber{}; // int nColls{0}; //can be added to run over limited collisions per file - for tesing purposes @@ -1466,7 +1467,7 @@ struct HfTrackIndexSkimCreator { // initialise 3-prong ML responses for (int iDecay3P{0}; iDecay3P < kN3ProngDecays; ++iDecay3P) { - if (onnxFileNames3Prongs[iDecay3P][0] == "") { // 3-prong species to be skipped + if (onnxFileNames3Prongs[iDecay3P][0].empty()) { // 3-prong species to be skipped continue; } hasMlModel3Prong[iDecay3P] = true; @@ -1749,11 +1750,7 @@ struct HfTrackIndexSkimCreator { return false; } const auto decLen = RecoDecay::distance(primVtx, secVtx); - if (decLen < config.minTwoTrackDecayLengthFor3Prongs) { - return false; - } - - return true; + return static_cast(decLen >= config.minTwoTrackDecayLengthFor3Prongs); } /// Method to perform selections for 3-prong candidates after vertex reconstruction @@ -1811,7 +1808,7 @@ struct HfTrackIndexSkimCreator { /// \param featuresCandPid is the vector with the candidate PID features /// \param outputScores is the array of vectors with the output scores to be filled /// \param isSelected ia s bitmap with selection outcome - template + template void applyMlSelectionForHfFilters3Prong(std::vector featuresCand, std::vector featuresCandPid, std::array, kN3ProngDecays>& outputScores, auto& isSelected) { if (isSelected == 0) { @@ -1822,7 +1819,7 @@ struct HfTrackIndexSkimCreator { for (int iDecay3P{0}; iDecay3P < kN3ProngDecays; ++iDecay3P) { if (TESTBIT(isSelected, iDecay3P) && hasMlModel3Prong[iDecay3P]) { bool isMlSel = false; - if constexpr (usePidForHfFiltersBdt) { + if constexpr (UsePidForHfFiltersBdt) { if (iDecay3P != hf_cand_3prong::DecayType::LcToPKPi && iDecay3P != hf_cand_3prong::DecayType::XicToPKPi) { isMlSel = hfMlResponse3Prongs[iDecay3P].isSelectedMl(featuresCand, ptDummy, outputScores[iDecay3P]); } else { @@ -1933,7 +1930,7 @@ struct HfTrackIndexSkimCreator { aod::BCsWithTimestamps const&, std::vector const& vecPvContributorGlobId, std::vector const& vecPvContributorTrackParCov, - std::vector vecCandPvContributorGlobId, + std::vector const& vecCandPvContributorGlobId, std::array& pvCoord, std::array& pvCovMatrix) { @@ -2054,10 +2051,9 @@ struct HfTrackIndexSkimCreator { } /// end 'if (doprocess2And3ProngsWithPvRefit && pvRefitDoable)' - return; } /// end of performPvRefitCandProngs function - template + template void run2And3Prongs(SelectedCollisions const& collisions, aod::BCsWithTimestamps const& bcWithTimeStamps, FilteredTrackAssocSel const&, @@ -2081,7 +2077,7 @@ struct HfTrackIndexSkimCreator { std::vector vecPvContributorGlobId{}; std::vector vecPvContributorTrackParCov{}; std::vector vecPvRefitContributorUsed{}; - if constexpr (doPvRefit) { + if constexpr (DoPvRefit) { auto groupedTracksUnfiltered = tracks.sliceBy(tracksPerCollision, collision.globalIndex()); const int nTrk = groupedTracksUnfiltered.size(); int nContrib = 0; @@ -2091,14 +2087,13 @@ struct HfTrackIndexSkimCreator { /// the track did not contribute to fit the primary vertex nNonContrib++; continue; - } else { - vecPvContributorGlobId.push_back(trackUnfiltered.globalIndex()); - vecPvContributorTrackParCov.push_back(getTrackParCov(trackUnfiltered)); - nContrib++; - if (config.debugPvRefit) { - LOG(info) << "---> a contributor! stuff saved"; - LOG(info) << "vec_contrib size: " << vecPvContributorTrackParCov.size() << ", nContrib: " << nContrib; - } + } + vecPvContributorGlobId.push_back(trackUnfiltered.globalIndex()); + vecPvContributorTrackParCov.push_back(getTrackParCov(trackUnfiltered)); + nContrib++; + if (config.debugPvRefit) { + LOG(info) << "---> a contributor! stuff saved"; + LOG(info) << "vec_contrib size: " << vecPvContributorTrackParCov.size() << ", nContrib: " << nContrib; } } if (config.debugPvRefit) { @@ -2227,7 +2222,7 @@ struct HfTrackIndexSkimCreator { df2.getTrack(1).getPxPyPzGlo(pvec1); /// PV refit excluding the candidate daughters, if contributors - if constexpr (doPvRefit) { + if constexpr (DoPvRefit) { if (config.fillHistograms) { registry.fill(HIST("PvRefit/verticesPerCandidate"), 1); } @@ -2289,7 +2284,7 @@ struct HfTrackIndexSkimCreator { const auto pVecCandProng2 = RecoDecay::pVec(pvec0, pvec1); // 2-prong selections after secondary vertex std::array pvCoord2Prong = {collision.posX(), collision.posY(), collision.posZ()}; - if constexpr (doPvRefit) { + if constexpr (DoPvRefit) { pvCoord2Prong[0] = pvRefitCoord2Prong[0]; pvCoord2Prong[1] = pvRefitCoord2Prong[1]; pvCoord2Prong[2] = pvRefitCoord2Prong[2]; @@ -2317,7 +2312,7 @@ struct HfTrackIndexSkimCreator { lastFilledD0 = rowTrackIndexProng2.lastIndex(); } - if constexpr (doPvRefit) { + if constexpr (DoPvRefit) { // fill table row with coordinates of PV refit rowProng2PVrefit(pvRefitCoord2Prong[0], pvRefitCoord2Prong[1], pvRefitCoord2Prong[2], pvRefitCovMatrix2Prong[0], pvRefitCovMatrix2Prong[1], pvRefitCovMatrix2Prong[2], pvRefitCovMatrix2Prong[3], pvRefitCovMatrix2Prong[4], pvRefitCovMatrix2Prong[5]); @@ -2399,17 +2394,15 @@ struct HfTrackIndexSkimCreator { if (!TESTBIT(trackIndexPos2.isSelProng(), CandidateType::Cand3Prong)) { // continue immediately if (!config.debug) { continue; - } else { - isSelected3ProngCand = 0; } + isSelected3ProngCand = 0; } if (config.applyKaonPidIn3Prongs && !TESTBIT(trackIndexNeg1.isIdentifiedPid(), ChannelKaonPid)) { // continue immediately if kaon PID enabled and opposite-sign track not a kaon if (!config.debug) { continue; - } else { - isSelected3ProngCand = 0; } + isSelected3ProngCand = 0; } const auto trackPos2 = trackIndexPos2.template track_as(); @@ -2444,7 +2437,7 @@ struct HfTrackIndexSkimCreator { /// PV refit excluding the candidate daughters, if contributors std::array pvRefitCoord3Prong2Pos1Neg{collision.posX(), collision.posY(), collision.posZ()}; /// initialize to the original PV std::array pvRefitCovMatrix3Prong2Pos1Neg{getPrimaryVertex(collision).getCov()}; /// initialize to the original PV - if constexpr (doPvRefit) { + if constexpr (DoPvRefit) { if (config.fillHistograms) { registry.fill(HIST("PvRefit/verticesPerCandidate"), 1); } @@ -2562,14 +2555,14 @@ struct HfTrackIndexSkimCreator { if (config.applyMlForHfFilters) { const std::vector inputFeatures{trackParVarPcaPos1.getPt(), dcaInfoPos1[0], dcaInfoPos1[1], trackParVarPcaNeg1.getPt(), dcaInfoNeg1[0], dcaInfoNeg1[1], trackParVarPcaPos2.getPt(), dcaInfoPos2[0], dcaInfoPos2[1]}; std::vector inputFeaturesLcPid{}; - if constexpr (usePidForHfFiltersBdt) { + if constexpr (UsePidForHfFiltersBdt) { inputFeaturesLcPid.push_back(trackPos1.tpcNSigmaPr()); inputFeaturesLcPid.push_back(trackPos2.tpcNSigmaPr()); inputFeaturesLcPid.push_back(trackPos1.tpcNSigmaPi()); inputFeaturesLcPid.push_back(trackPos2.tpcNSigmaPi()); inputFeaturesLcPid.push_back(trackNeg1.tpcNSigmaKa()); } - applyMlSelectionForHfFilters3Prong(inputFeatures, inputFeaturesLcPid, mlScores3Prongs, isSelected3ProngCand); + applyMlSelectionForHfFilters3Prong(inputFeatures, inputFeaturesLcPid, mlScores3Prongs, isSelected3ProngCand); } if (!config.debug && isSelected3ProngCand == 0) { @@ -2581,7 +2574,7 @@ struct HfTrackIndexSkimCreator { if (config.applyMlForHfFilters) { rowTrackIndexMlScoreProng3(mlScores3Prongs[0], mlScores3Prongs[1], mlScores3Prongs[2], mlScores3Prongs[3]); } - if constexpr (doPvRefit) { + if constexpr (DoPvRefit) { // fill table row of coordinates of PV refit rowProng3PVrefit(pvRefitCoord3Prong2Pos1Neg[0], pvRefitCoord3Prong2Pos1Neg[1], pvRefitCoord3Prong2Pos1Neg[2], pvRefitCovMatrix3Prong2Pos1Neg[0], pvRefitCovMatrix3Prong2Pos1Neg[1], pvRefitCovMatrix3Prong2Pos1Neg[2], pvRefitCovMatrix3Prong2Pos1Neg[3], pvRefitCovMatrix3Prong2Pos1Neg[4], pvRefitCovMatrix3Prong2Pos1Neg[5]); @@ -2651,17 +2644,15 @@ struct HfTrackIndexSkimCreator { if (!TESTBIT(trackIndexNeg2.isSelProng(), CandidateType::Cand3Prong)) { // continue immediately if (!config.debug) { continue; - } else { - isSelected3ProngCand = 0; } + isSelected3ProngCand = 0; } if (config.applyKaonPidIn3Prongs && !TESTBIT(trackIndexPos1.isIdentifiedPid(), ChannelKaonPid)) { // continue immediately if kaon PID enabled and opposite-sign track not a kaon if (!config.debug) { continue; - } else { - isSelected3ProngCand = 0; } + isSelected3ProngCand = 0; } auto trackNeg2 = trackIndexNeg2.template track_as(); @@ -2685,8 +2676,8 @@ struct HfTrackIndexSkimCreator { } // 3-prong preselections - int8_t isIdentifiedPidTrackNeg1 = trackIndexNeg1.isIdentifiedPid(); - int8_t isIdentifiedPidTrackNeg2 = trackIndexNeg2.isIdentifiedPid(); + int8_t const isIdentifiedPidTrackNeg1 = trackIndexNeg1.isIdentifiedPid(); + int8_t const isIdentifiedPidTrackNeg2 = trackIndexNeg2.isIdentifiedPid(); applyPreselection3Prong(pVecTrackNeg1, pVecTrackPos1, pVecTrackNeg2, isIdentifiedPidTrackNeg1, isIdentifiedPidTrackNeg2, cutStatus3Prong, whichHypo3Prong, isSelected3ProngCand); if (!config.debug && isSelected3ProngCand == 0) { continue; @@ -2696,7 +2687,7 @@ struct HfTrackIndexSkimCreator { /// PV refit excluding the candidate daughters, if contributors std::array pvRefitCoord3Prong1Pos2Neg{collision.posX(), collision.posY(), collision.posZ()}; /// initialize to the original PV std::array pvRefitCovMatrix3Prong1Pos2Neg{getPrimaryVertex(collision).getCov()}; /// initialize to the original PV - if constexpr (doPvRefit) { + if constexpr (DoPvRefit) { if (config.fillHistograms) { registry.fill(HIST("PvRefit/verticesPerCandidate"), 1); } @@ -2815,14 +2806,14 @@ struct HfTrackIndexSkimCreator { if (config.applyMlForHfFilters) { const std::vector inputFeatures{trackParVarPcaNeg1.getPt(), dcaInfoNeg1[0], dcaInfoNeg1[1], trackParVarPcaPos1.getPt(), dcaInfoPos1[0], dcaInfoPos1[1], trackParVarPcaNeg2.getPt(), dcaInfoNeg2[0], dcaInfoNeg2[1]}; std::vector inputFeaturesLcPid{}; - if constexpr (usePidForHfFiltersBdt) { + if constexpr (UsePidForHfFiltersBdt) { inputFeaturesLcPid.push_back(trackNeg1.tpcNSigmaPr()); inputFeaturesLcPid.push_back(trackNeg2.tpcNSigmaPr()); inputFeaturesLcPid.push_back(trackNeg1.tpcNSigmaPi()); inputFeaturesLcPid.push_back(trackNeg2.tpcNSigmaPi()); inputFeaturesLcPid.push_back(trackPos1.tpcNSigmaKa()); } - applyMlSelectionForHfFilters3Prong(inputFeatures, inputFeaturesLcPid, mlScores3Prongs, isSelected3ProngCand); + applyMlSelectionForHfFilters3Prong(inputFeatures, inputFeaturesLcPid, mlScores3Prongs, isSelected3ProngCand); } if (!config.debug && isSelected3ProngCand == 0) { @@ -2834,7 +2825,7 @@ struct HfTrackIndexSkimCreator { if (config.applyMlForHfFilters) { rowTrackIndexMlScoreProng3(mlScores3Prongs[0], mlScores3Prongs[1], mlScores3Prongs[2], mlScores3Prongs[3]); } - if constexpr (doPvRefit) { + if constexpr (DoPvRefit) { // fill table row of coordinates of PV refit rowProng3PVrefit(pvRefitCoord3Prong1Pos2Neg[0], pvRefitCoord3Prong1Pos2Neg[1], pvRefitCoord3Prong1Pos2Neg[2], pvRefitCovMatrix3Prong1Pos2Neg[0], pvRefitCovMatrix3Prong1Pos2Neg[1], pvRefitCovMatrix3Prong1Pos2Neg[2], pvRefitCovMatrix3Prong1Pos2Neg[3], pvRefitCovMatrix3Prong1Pos2Neg[4], pvRefitCovMatrix3Prong1Pos2Neg[5]); @@ -2925,7 +2916,7 @@ struct HfTrackIndexSkimCreator { if (config.fillHistograms) { registry.fill(HIST("hMassDstarToD0Pi"), deltaMass); } - if constexpr (doPvRefit) { + if constexpr (DoPvRefit) { // fill table row with coordinates of PV refit (same as 2-prong because we do not remove the soft pion) rowDstarPVrefit(pvRefitCoord2Prong[0], pvRefitCoord2Prong[1], pvRefitCoord2Prong[2], pvRefitCovMatrix2Prong[0], pvRefitCovMatrix2Prong[1], pvRefitCovMatrix2Prong[2], pvRefitCovMatrix2Prong[3], pvRefitCovMatrix2Prong[4], pvRefitCovMatrix2Prong[5]); @@ -2962,7 +2953,7 @@ struct HfTrackIndexSkimCreator { if (config.fillHistograms) { registry.fill(HIST("hMassDstarToD0Pi"), deltaMass); } - if constexpr (doPvRefit) { + if constexpr (DoPvRefit) { // fill table row with coordinates of PV refit (same as 2-prong because we do not remove the soft pion) rowDstarPVrefit(pvRefitCoord2Prong[0], pvRefitCoord2Prong[1], pvRefitCoord2Prong[2], pvRefitCovMatrix2Prong[0], pvRefitCovMatrix2Prong[1], pvRefitCovMatrix2Prong[2], pvRefitCovMatrix2Prong[3], pvRefitCovMatrix2Prong[4], pvRefitCovMatrix2Prong[5]); @@ -3088,7 +3079,7 @@ struct HfTrackIndexSkimCreatorCascades { o2::vertexing::DCAFitterN<2> df2; // 2-prong vertex fitter // Needed for PV refitting Service ccdb; - o2::base::MatLayerCylSet* lut; + o2::base::MatLayerCylSet* lut{}; o2::base::Propagator::MatCorrType noMatCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; int runNumber{0}; @@ -3097,7 +3088,7 @@ struct HfTrackIndexSkimCreatorCascades { using FilteredTrackAssocSel = soa::Filtered>; Filter filterSelectCollisions = (aod::hf_sel_collision::whyRejectColl == static_cast(0)); - Filter filterSelectTrackIds = (aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::CandV0bachelor))) != 0u && (config.applyProtonPid == false || (aod::hf_sel_track::isIdentifiedPid & static_cast(BIT(ChannelsProtonPid::LcToPK0S))) != 0u); + Filter filterSelectTrackIds = (aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::CandV0bachelor))) != 0u && (!config.applyProtonPid || (aod::hf_sel_track::isIdentifiedPid & static_cast(BIT(ChannelsProtonPid::LcToPK0S))) != 0u); Preslice trackIndicesPerCollision = aod::track_association::collisionId; Preslice v0sPerCollision = aod::v0data::collisionId; @@ -3351,9 +3342,9 @@ struct HfTrackIndexSkimCreatorLfCascades { o2::vertexing::DCAFitterN<2> df2; // 2-prong vertex fitter Service ccdb; - o2::base::MatLayerCylSet* lut; + o2::base::MatLayerCylSet* lut{}; o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; - int runNumber; + int runNumber{}; // array of PDG masses of possible charm baryon daughters static constexpr int kN2ProngDecays = hf_cand_casc_lf::DecayType2Prong::N2ProngDecays; // number of 2-prong hadron types diff --git a/PWGHF/TableProducer/treeCreatorB0ToDPi.cxx b/PWGHF/TableProducer/treeCreatorB0ToDPi.cxx index ebfd87c5e46..b354d7e5595 100644 --- a/PWGHF/TableProducer/treeCreatorB0ToDPi.cxx +++ b/PWGHF/TableProducer/treeCreatorB0ToDPi.cxx @@ -209,12 +209,12 @@ struct HfTreeCreatorB0ToDPi { runNumber); } - template + template void fillCandidateTable(const T& candidate, const U& prong1) { int8_t flagMc = 0; int8_t originMc = 0; - if constexpr (doMc) { + if constexpr (DoMc) { flagMc = candidate.flagMcMatchRec(); originMc = candidate.originMcRec(); } @@ -312,7 +312,7 @@ struct HfTreeCreatorB0ToDPi { } for (const auto& candidate : candidates) { if (fillOnlyBackground) { - float pseudoRndm = candidate.ptProng1() * 1000. - static_cast(candidate.ptProng1() * 1000); + float const pseudoRndm = candidate.ptProng1() * 1000. - static_cast(candidate.ptProng1() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } @@ -352,7 +352,7 @@ struct HfTreeCreatorB0ToDPi { rowCandidateLite.reserve(recBg.size()); } for (const auto& candidate : recBg) { - float pseudoRndm = candidate.ptProng1() * 1000. - static_cast(candidate.ptProng1() * 1000); + float const pseudoRndm = candidate.ptProng1() * 1000. - static_cast(candidate.ptProng1() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } diff --git a/PWGHF/TableProducer/treeCreatorBplusToD0Pi.cxx b/PWGHF/TableProducer/treeCreatorBplusToD0Pi.cxx index cd9665de50c..a0e7b2a3597 100644 --- a/PWGHF/TableProducer/treeCreatorBplusToD0Pi.cxx +++ b/PWGHF/TableProducer/treeCreatorBplusToD0Pi.cxx @@ -265,12 +265,12 @@ struct HfTreeCreatorBplusToD0Pi { runNumber); } - template + template void fillCandidateTable(const T& candidate, const U& prong1) { int8_t flagMc = 0; int8_t originMc = 0; - if constexpr (doMc) { + if constexpr (DoMc) { flagMc = candidate.flagMcMatchRec(); originMc = candidate.originMcRec(); } @@ -402,7 +402,7 @@ struct HfTreeCreatorBplusToD0Pi { } for (const auto& candidate : candidates) { if (fillOnlyBackground) { - float pseudoRndm = candidate.ptProng1() * 1000. - static_cast(candidate.ptProng1() * 1000); + float const pseudoRndm = candidate.ptProng1() * 1000. - static_cast(candidate.ptProng1() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } @@ -442,7 +442,7 @@ struct HfTreeCreatorBplusToD0Pi { rowCandidateLite.reserve(recBg.size()); } for (const auto& candidate : recBg) { - float pseudoRndm = candidate.ptProng1() * 1000. - static_cast(candidate.ptProng1() * 1000); + float const pseudoRndm = candidate.ptProng1() * 1000. - static_cast(candidate.ptProng1() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } diff --git a/PWGHF/TableProducer/treeCreatorBsToDsPi.cxx b/PWGHF/TableProducer/treeCreatorBsToDsPi.cxx index 3c639967995..594aae65cd1 100644 --- a/PWGHF/TableProducer/treeCreatorBsToDsPi.cxx +++ b/PWGHF/TableProducer/treeCreatorBsToDsPi.cxx @@ -204,11 +204,11 @@ struct HfTreeCreatorBsToDsPi { runNumber); } - template + template void fillCandidateTable(const T& candidate, const U& prong1) { int8_t flagMc = 0; - if constexpr (doMc) { + if constexpr (DoMc) { flagMc = candidate.flagMcMatchRec(); } if (fillCandidateLiteTable) { @@ -302,7 +302,7 @@ struct HfTreeCreatorBsToDsPi { } for (const auto& candidate : candidates) { if (fillOnlyBackground && downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng1() * 1000. - static_cast(candidate.ptProng1() * 1000); + float const pseudoRndm = candidate.ptProng1() * 1000. - static_cast(candidate.ptProng1() * 1000); if (pseudoRndm >= downSampleBkgFactor && candidate.pt() < ptMaxForDownSample) { continue; } @@ -342,7 +342,7 @@ struct HfTreeCreatorBsToDsPi { rowCandidateLite.reserve(recBg.size()); } for (const auto& candidate : recBg) { - float pseudoRndm = candidate.ptProng1() * 1000. - static_cast(candidate.ptProng1() * 1000); + float const pseudoRndm = candidate.ptProng1() * 1000. - static_cast(candidate.ptProng1() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } diff --git a/PWGHF/TableProducer/treeCreatorD0ToKPi.cxx b/PWGHF/TableProducer/treeCreatorD0ToKPi.cxx index 4178f66f864..dc962e7ed49 100644 --- a/PWGHF/TableProducer/treeCreatorD0ToKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorD0ToKPi.cxx @@ -286,7 +286,7 @@ struct HfTreeCreatorD0ToKPi { runNumber); } - template + template auto fillTable(const T& candidate, int candFlag, double invMass, double topoChi2, double ct, double y, double e, int8_t flagMc, int8_t flagMcDecay, int8_t origin) { @@ -392,7 +392,7 @@ struct HfTreeCreatorD0ToKPi { flagMcDecay, origin); } - if constexpr (applyMl) { + if constexpr (ApplyMl) { if (candFlag == 0) { rowCandidateMl( candidate.mlProbD0()[0], @@ -407,7 +407,7 @@ struct HfTreeCreatorD0ToKPi { } } - template + template void processData(aod::Collisions const& collisions, CandType const& candidates, aod::Tracks const&, aod::BCs const&) @@ -424,22 +424,22 @@ struct HfTreeCreatorD0ToKPi { } else { rowCandidateFull.reserve(candidates.size()); } - if constexpr (applyMl) { + if constexpr (ApplyMl) { rowCandidateMl.reserve(candidates.size()); } for (const auto& candidate : candidates) { if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); + float const pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } } - double yD = hfHelper.yD0(candidate); - double eD = hfHelper.eD0(candidate); - double ctD = hfHelper.ctD0(candidate); + double const yD = hfHelper.yD0(candidate); + double const eD = hfHelper.eD0(candidate); + double const ctD = hfHelper.ctD0(candidate); float massD0, massD0bar; float topolChi2PerNdf = -999.; - if constexpr (reconstructionType == aod::hf_cand::VertexerType::KfParticle) { + if constexpr (ReconstructionType == aod::hf_cand::VertexerType::KfParticle) { massD0 = candidate.kfGeoMassD0(); massD0bar = candidate.kfGeoMassD0bar(); topolChi2PerNdf = candidate.kfTopolChi2OverNdf(); @@ -448,10 +448,10 @@ struct HfTreeCreatorD0ToKPi { massD0bar = hfHelper.invMassD0barToKPi(candidate); } if (candidate.isSelD0()) { - fillTable(candidate, 0, massD0, topolChi2PerNdf, ctD, yD, eD, 0, 0, 0); + fillTable(candidate, 0, massD0, topolChi2PerNdf, ctD, yD, eD, 0, 0, 0); } if (candidate.isSelD0bar()) { - fillTable(candidate, 1, massD0bar, topolChi2PerNdf, ctD, yD, eD, 0, 0, 0); + fillTable(candidate, 1, massD0bar, topolChi2PerNdf, ctD, yD, eD, 0, 0, 0); } } } @@ -492,7 +492,7 @@ struct HfTreeCreatorD0ToKPi { } PROCESS_SWITCH(HfTreeCreatorD0ToKPi, processDataWithKFParticleMl, "Process data with KFParticle and ML", false); - template + template void processMc(aod::Collisions const& collisions, aod::McCollisions const&, CandType const& candidates, @@ -512,22 +512,22 @@ struct HfTreeCreatorD0ToKPi { } else { rowCandidateFull.reserve(candidates.size()); } - if constexpr (applyMl) { + if constexpr (ApplyMl) { rowCandidateMl.reserve(candidates.size()); } for (const auto& candidate : candidates) { - if constexpr (onlyBkg) { + if constexpr (OnlyBkg) { if ((std::abs(candidate.flagMcMatchRec()) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) || (fillCorrBkgs && (candidate.flagMcMatchRec() != 0))) { continue; } if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); + float const pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } } } - if constexpr (onlySig) { + if constexpr (OnlySig) { if (fillCorrBkgs && candidate.flagMcMatchRec() == 0) { continue; } @@ -535,12 +535,12 @@ struct HfTreeCreatorD0ToKPi { continue; } } - double yD = hfHelper.yD0(candidate); - double eD = hfHelper.eD0(candidate); - double ctD = hfHelper.ctD0(candidate); + double const yD = hfHelper.yD0(candidate); + double const eD = hfHelper.eD0(candidate); + double const ctD = hfHelper.ctD0(candidate); float massD0, massD0bar; float topolChi2PerNdf = -999.; - if constexpr (reconstructionType == aod::hf_cand::VertexerType::KfParticle) { + if constexpr (ReconstructionType == aod::hf_cand::VertexerType::KfParticle) { massD0 = candidate.kfGeoMassD0(); massD0bar = candidate.kfGeoMassD0bar(); topolChi2PerNdf = candidate.kfTopolChi2OverNdf(); @@ -549,10 +549,10 @@ struct HfTreeCreatorD0ToKPi { massD0bar = hfHelper.invMassD0barToKPi(candidate); } if (candidate.isSelD0()) { - fillTable(candidate, 0, massD0, topolChi2PerNdf, ctD, yD, eD, candidate.flagMcMatchRec(), candidate.flagMcDecayChanRec(), candidate.originMcRec()); + fillTable(candidate, 0, massD0, topolChi2PerNdf, ctD, yD, eD, candidate.flagMcMatchRec(), candidate.flagMcDecayChanRec(), candidate.originMcRec()); } if (candidate.isSelD0bar()) { - fillTable(candidate, 1, massD0bar, topolChi2PerNdf, ctD, yD, eD, candidate.flagMcMatchRec(), candidate.flagMcDecayChanRec(), candidate.originMcRec()); + fillTable(candidate, 1, massD0bar, topolChi2PerNdf, ctD, yD, eD, candidate.flagMcMatchRec(), candidate.flagMcDecayChanRec(), candidate.originMcRec()); } } diff --git a/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx b/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx index f0fc63623a6..dcee30bf93b 100644 --- a/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx @@ -300,20 +300,20 @@ struct HfTreeCreatorDplusToPiKPi { runNumber); } - template + template void fillCandidateTable(const T& candidate) { int8_t flagMc = 0; int8_t originMc = 0; int8_t channelMc = 0; - if constexpr (doMc) { + if constexpr (DoMc) { flagMc = candidate.flagMcMatchRec(); originMc = candidate.originMcRec(); channelMc = candidate.flagMcDecayChanRec(); } std::vector outputMl = {-999., -999.}; - if constexpr (doMl) { + if constexpr (DoMl) { for (unsigned int iclass = 0; iclass < classMlIndexes->size(); iclass++) { outputMl[iclass] = candidate.mlProbDplusToPiKPi()[classMlIndexes->at(iclass)]; } @@ -478,7 +478,7 @@ struct HfTreeCreatorDplusToPiKPi { } for (const auto& candidate : candidates) { if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); + float const pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } @@ -507,7 +507,7 @@ struct HfTreeCreatorDplusToPiKPi { } for (const auto& candidate : candidates) { if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); + float const pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } @@ -518,7 +518,7 @@ struct HfTreeCreatorDplusToPiKPi { PROCESS_SWITCH(HfTreeCreatorDplusToPiKPi, processDataWCent, "Process data with cent", false); - template + template void fillMcTables(CollType const& collisions, aod::McCollisions const&, CandTypeMcRec const& candidates, @@ -539,12 +539,12 @@ struct HfTreeCreatorDplusToPiKPi { } for (const auto& candidate : candidates) { if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); + float const pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } } - fillCandidateTable(candidate); + fillCandidateTable(candidate); } // Filling particle properties diff --git a/PWGHF/TableProducer/treeCreatorDsToKKPi.cxx b/PWGHF/TableProducer/treeCreatorDsToKKPi.cxx index de1c9984435..a68b673f732 100644 --- a/PWGHF/TableProducer/treeCreatorDsToKKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorDsToKKPi.cxx @@ -254,8 +254,11 @@ enum ResonantChannel : int8_t { Kstar0K = 2 }; -static std::unordered_map> channelsResonant = {{{Mother::Ds, {{ResonantChannel::PhiPi, hf_decay::hf_cand_3prong::DecayChannelResonant::DsToPhiPi}, {ResonantChannel::Kstar0K, hf_decay::hf_cand_3prong::DecayChannelResonant::DsToKstar0K}}}, - {Mother::Dplus, {{ResonantChannel::PhiPi, hf_decay::hf_cand_3prong::DecayChannelResonant::DplusToPhiPi}, {ResonantChannel::Kstar0K, hf_decay::hf_cand_3prong::DecayChannelResonant::DplusToKstar0K}}}}}; +namespace +{ +std::unordered_map> channelsResonant = {{{Mother::Ds, {{ResonantChannel::PhiPi, hf_decay::hf_cand_3prong::DecayChannelResonant::DsToPhiPi}, {ResonantChannel::Kstar0K, hf_decay::hf_cand_3prong::DecayChannelResonant::DsToKstar0K}}}, + {Mother::Dplus, {{ResonantChannel::PhiPi, hf_decay::hf_cand_3prong::DecayChannelResonant::DplusToPhiPi}, {ResonantChannel::Kstar0K, hf_decay::hf_cand_3prong::DecayChannelResonant::DplusToKstar0K}}}}}; +} /// Writes the full information in an output TTree struct HfTreeCreatorDsToKKPi { @@ -325,17 +328,17 @@ struct HfTreeCreatorDsToKKPi { /// \param doMc true to fill MC information /// \param massHypo mass hypothesis considered: 0 = KKPi, 1 = PiKK /// \param candidate is candidate - template + template void fillCandidateTable(const T& candidate) { float invMassDs = 0; float deltaMassPhiKK = 0; float absCos3PiKDs = 0; - if constexpr (massHypo == 0) { + if constexpr (MassHypo == 0) { invMassDs = hfHelper.invMassDsToKKPi(candidate); deltaMassPhiKK = hfHelper.deltaMassPhiDsToKKPi(candidate); absCos3PiKDs = hfHelper.absCos3PiKDsToKKPi(candidate); - } else if constexpr (massHypo == 1) { + } else if constexpr (MassHypo == 1) { invMassDs = hfHelper.invMassDsToPiKK(candidate); deltaMassPhiKK = hfHelper.deltaMassPhiDsToPiKK(candidate); absCos3PiKDs = hfHelper.absCos3PiKDsToPiKK(candidate); @@ -344,11 +347,11 @@ struct HfTreeCreatorDsToKKPi { int8_t flagMc{0}; int8_t originMc{0}; int8_t channelMc{0}; - int8_t isSwapped{massHypo}; // 0 if KKPi, 1 if PiKK + int8_t isSwapped{MassHypo}; // 0 if KKPi, 1 if PiKK float eCand{0.f}; float ctCand{0.f}; float yCand = candidate.y(invMassDs); - if constexpr (doMc) { + if constexpr (DoMc) { flagMc = candidate.flagMcMatchRec(); originMc = candidate.originMcRec(); channelMc = candidate.flagMcDecayChanRec(); @@ -395,8 +398,8 @@ struct HfTreeCreatorDsToKKPi { candidate.nSigTofKa2(), candidate.tpcTofNSigmaPi2(), candidate.tpcTofNSigmaKa2(), - massHypo == 0 ? candidate.isSelDsToKKPi() : -1, - massHypo == 1 ? candidate.isSelDsToPiKK() : -1, + MassHypo == 0 ? candidate.isSelDsToKKPi() : -1, + MassHypo == 1 ? candidate.isSelDsToPiKK() : -1, invMassDs, candidate.pt(), candidate.eta(), @@ -463,8 +466,8 @@ struct HfTreeCreatorDsToKKPi { candidate.nSigTofKa2(), candidate.tpcTofNSigmaPi2(), candidate.tpcTofNSigmaKa2(), - massHypo == 0 ? candidate.isSelDsToKKPi() : -1, - massHypo == 1 ? candidate.isSelDsToPiKK() : -1, + MassHypo == 0 ? candidate.isSelDsToKKPi() : -1, + MassHypo == 1 ? candidate.isSelDsToPiKK() : -1, candidate.xSecondaryVertex(), candidate.ySecondaryVertex(), candidate.zSecondaryVertex(), @@ -515,7 +518,7 @@ struct HfTreeCreatorDsToKKPi { for (const auto& candidate : selectedDsToKKPiCand) { if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); + float const pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } @@ -525,7 +528,7 @@ struct HfTreeCreatorDsToKKPi { for (const auto& candidate : selectedDsToPiKKCand) { if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); + float const pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } @@ -571,7 +574,7 @@ struct HfTreeCreatorDsToKKPi { for (const auto& candidate : reconstructedCandBkg) { if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); + float const pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } diff --git a/PWGHF/TableProducer/treeCreatorDstarToD0Pi.cxx b/PWGHF/TableProducer/treeCreatorDstarToD0Pi.cxx index 18ee43a111b..f7055dfa8d0 100644 --- a/PWGHF/TableProducer/treeCreatorDstarToD0Pi.cxx +++ b/PWGHF/TableProducer/treeCreatorDstarToD0Pi.cxx @@ -293,12 +293,12 @@ struct HfTreeCreatorDstarToD0Pi { runNumber); } - template + template void fillCandidateTable(const T& candidate, float ptBhadMotherPart = -1) { int8_t flagMc{0}; int8_t originMc{0}; - if constexpr (doMc) { + if constexpr (DoMc) { flagMc = candidate.flagMcMatchRec(); originMc = candidate.originMcRec(); } @@ -495,7 +495,7 @@ struct HfTreeCreatorDstarToD0Pi { } for (const auto& candidate : candidates) { if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); + float const pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } @@ -536,7 +536,7 @@ struct HfTreeCreatorDstarToD0Pi { } for (const auto& candidate : reconstructedCandBkg) { if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); + float const pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } diff --git a/PWGHF/TableProducer/treeCreatorLbToLcPi.cxx b/PWGHF/TableProducer/treeCreatorLbToLcPi.cxx index a60a7eba661..899d2c2ca28 100644 --- a/PWGHF/TableProducer/treeCreatorLbToLcPi.cxx +++ b/PWGHF/TableProducer/treeCreatorLbToLcPi.cxx @@ -207,10 +207,10 @@ struct HfTreeCreatorLbToLcPi { // Filling candidate properties rowCandidateFull.reserve(candidates.size()); for (const auto& candidate : candidates) { - auto fillTable = [&](int FunctionSelection, - float FunctionInvMass, - float FunctionCt, - float FunctionY) { + auto fillTable = [&](int functionSelection, + float functionInvMass, + float functionCt, + float functionY) { auto candLc = candidate.prong0_as>(); auto track0 = candidate.prong1_as(); // daughter pion track auto track1 = candLc.prong0_as(); // granddaughter tracks (lc decay particles) @@ -290,16 +290,16 @@ struct HfTreeCreatorLbToLcPi { track2.px(), track2.py(), track2.pz(), track3.px(), track3.py(), track3.pz(), track1.sign(), track2.sign(), track3.sign(), - FunctionSelection, - FunctionInvMass, + functionSelection, + functionInvMass, candidate.pt(), candidate.p(), candidate.cpa(), candidate.cpaXY(), - FunctionCt, + functionCt, candidate.eta(), candidate.phi(), - FunctionY, + functionY, tempConst, tempConst); }; diff --git a/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx b/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx index e14b9182347..d80e3729507 100644 --- a/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx +++ b/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx @@ -36,12 +36,12 @@ #include #include #include +#include #include using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -using std::array; namespace o2::aod { @@ -266,7 +266,7 @@ struct HfTreeCreatorLcToK0sP { constexpr int IndexFirstClass{0}; constexpr int IndexSecondClass{1}; constexpr int IndexThirdClass{2}; - if (mlScores.size() == 0) { + if (mlScores.empty()) { return; // when candidateSelectorLcK0sP rejects a candidate by "usual", non-ML cut, the ml score vector remains empty } mlScoreFirstClass = mlScores.at(IndexFirstClass); @@ -448,11 +448,7 @@ struct HfTreeCreatorLcToK0sP { auto bach = candidate.prong0_as(); // bachelor const int flag = candidate.flagMcMatchRec(); - if (fillOnlySignal && flag != 0) { - fillCandidate(candidate, bach, candidate.flagMcMatchRec(), candidate.originMcRec(), candidateMlScore); - } else if (fillOnlyBackground && flag == 0) { - fillCandidate(candidate, bach, candidate.flagMcMatchRec(), candidate.originMcRec(), candidateMlScore); - } else { + if ((fillOnlySignal && flag != 0) || (fillOnlyBackground && flag == 0) || (!fillOnlySignal && !fillOnlyBackground)) { fillCandidate(candidate, bach, candidate.flagMcMatchRec(), candidate.originMcRec(), candidateMlScore); } } @@ -503,7 +499,7 @@ struct HfTreeCreatorLcToK0sP { auto candidateMlScore = candidateMlScores.rawIteratorAt(iCand); ++iCand; auto bach = candidate.prong0_as(); // bachelor - double pseudoRndm = bach.pt() * 1000. - static_cast(bach.pt() * 1000); + double const pseudoRndm = bach.pt() * 1000. - static_cast(bach.pt() * 1000); if (candidate.isSelLcToK0sP() >= 1 && pseudoRndm < downSampleBkgFactor) { fillCandidate(candidate, bach, 0, 0, candidateMlScore); } diff --git a/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx b/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx index e9cc4401c31..f1986fe72e3 100644 --- a/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx @@ -440,19 +440,21 @@ struct HfTreeCreatorLcToPKPi { if (std::abs(flag) == o2::hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi) { if (swapped == 0) { if (candFlag == 0) { - if (origin == RecoDecay::OriginType::Prompt) + if (origin == RecoDecay::OriginType::Prompt) { status = Prompt; - else if (origin == RecoDecay::OriginType::NonPrompt) + } else if (origin == RecoDecay::OriginType::NonPrompt) { status = NonPrompt; + } } else { status = WrongOrder; } } else { if (candFlag == 1) { - if (origin == RecoDecay::OriginType::Prompt) + if (origin == RecoDecay::OriginType::Prompt) { status = Prompt; - else if (origin == RecoDecay::OriginType::NonPrompt) + } else if (origin == RecoDecay::OriginType::NonPrompt) { status = NonPrompt; + } } else { status = WrongOrder; } @@ -471,14 +473,14 @@ struct HfTreeCreatorLcToPKPi { if (std::accumulate(processes.begin(), processes.end(), 0) != 1) { LOGP(fatal, "One and only one process function must be enabled at a time."); } - if (std::accumulate(processes.begin(), processes.begin() + 4, 0) && fillCandidateMcTable) { + if ((std::accumulate(processes.begin(), processes.begin() + 4, 0) != 0) && fillCandidateMcTable) { LOGP(fatal, "fillCandidateMcTable can be activated only in case of MC processing."); } } /// \brief function to fill event properties /// \param collisions Collision table - template + template void fillEventProperties(Colls const& collisions) { // Filling event properties @@ -490,7 +492,7 @@ struct HfTreeCreatorLcToPKPi { float centFT0M = -1.f; float centFV0A = -1.f; float centFDDM = -1.f; - if constexpr (useCentrality) { + if constexpr (UseCentrality) { centFT0A = collision.centFT0A(); centFT0C = collision.centFT0C(); centFT0M = collision.centFT0M(); @@ -503,7 +505,7 @@ struct HfTreeCreatorLcToPKPi { float mcPosZ{UndefValueFloat}; int mcCollId{-1}; - if constexpr (isMc) { + if constexpr (IsMc) { auto mcCollision = collision.template mcCollision_as(); mcPosX = mcCollision.posX(); @@ -541,10 +543,10 @@ struct HfTreeCreatorLcToPKPi { /// \brief function to reserve tables size /// \param candidatesSize size of the candidates table /// \param isMc boolean flag whether MC or data is processed - template + template void reserveTables(size_t candidatesSize, bool isMc) { - if constexpr (reconstructionType == aod::hf_cand::VertexerType::DCAFitter) { + if constexpr (ReconstructionType == aod::hf_cand::VertexerType::DCAFitter) { if (fillCandidateLiteTable) { rowCandidateLite.reserve(candidatesSize * 2); } else { @@ -592,7 +594,7 @@ struct HfTreeCreatorLcToPKPi { constexpr int IndexFirstClass{0}; constexpr int IndexSecondClass{1}; constexpr int IndexThirdClass{2}; - if (mlScores.size() == 0) { + if (mlScores.empty()) { return; // when candidateSelectorLc rejects a candidate by "usual", non-ML cut, the ml score vector remains empty } mlScoreFirstClass = mlScores.at(IndexFirstClass); @@ -606,7 +608,7 @@ struct HfTreeCreatorLcToPKPi { /// \param candidate candidate instance /// \param candidateMlScore instance of handler of vectors with ML scores associated with the current candidate /// \param candFlag flag indicating if PKPi (0) or PiKP (1) hypothesis is used - template + template void fillLiteTable(CandType const& candidate, aod::HfMlLcToPKPi::iterator const& candidateMlScore, int candFlag) { auto [functionInvMass, functionInvMassKPi] = evaluateInvariantMassesDCAFitter(candidate, candFlag); @@ -618,7 +620,7 @@ struct HfTreeCreatorLcToPKPi { int8_t functionIsCandidateSwapped{0}; int8_t functionFlagMcDecayChanRec{-1}; - if constexpr (isMc) { + if constexpr (IsMc) { functionFlagMcMatchRec = candidate.flagMcMatchRec(); functionOriginMcRec = candidate.originMcRec(); functionIsCandidateSwapped = candidate.isCandidateSwapped(); @@ -691,7 +693,7 @@ struct HfTreeCreatorLcToPKPi { /// \param candidate candidate instance /// \param candidateMlScore instance of handler of vectors with ML scores associated with the current candidate /// \param candFlag flag indicating if PKPi (0) or PiKP (1) hypothesis is used - template + template void fillFullTable(CandType const& candidate, aod::HfMlLcToPKPi::iterator const& candidateMlScore, int candFlag) { auto [functionInvMass, functionInvMassKPi] = evaluateInvariantMassesDCAFitter(candidate, candFlag); @@ -704,7 +706,7 @@ struct HfTreeCreatorLcToPKPi { int8_t functionIsCandidateSwapped{0}; int8_t functionFlagMcDecayChanRec{-1}; - if constexpr (isMc) { + if constexpr (IsMc) { functionFlagMcMatchRec = candidate.flagMcMatchRec(); functionOriginMcRec = candidate.originMcRec(); functionIsCandidateSwapped = candidate.isCandidateSwapped(); @@ -908,7 +910,7 @@ struct HfTreeCreatorLcToPKPi { /// \param mcCollisions MC collision table /// \param candidates Lc->pKpi candidate table /// \param particles Generated particle table - template + template void fillTablesMc(Colls const& collisions, aod::McCollisions const&, CandType const& candidates, @@ -919,10 +921,10 @@ struct HfTreeCreatorLcToPKPi { constexpr bool IsMc = true; - fillEventProperties(collisions); + fillEventProperties(collisions); const size_t candidatesSize = candidates.size(); - reserveTables(candidatesSize, IsMc); + reserveTables(candidatesSize, IsMc); int iCand{0}; for (const auto& candidate : candidates) { @@ -931,7 +933,7 @@ struct HfTreeCreatorLcToPKPi { float ptProng0 = candidate.ptProng0(); auto collision = candidate.template collision_as(); auto fillTable = [&](int candFlag) { - double pseudoRndm = ptProng0 * 1000. - static_cast(ptProng0 * 1000); + double const pseudoRndm = ptProng0 * 1000. - static_cast(ptProng0 * 1000); const int functionSelection = candFlag == 0 ? candidate.isSelLcToPKPi() : candidate.isSelLcToPiKP(); const int sigbgstatus = determineSignalBgStatus(candidate, candFlag); const bool isMcCandidateSignal = (sigbgstatus == Prompt) || (sigbgstatus == NonPrompt); @@ -947,7 +949,7 @@ struct HfTreeCreatorLcToPKPi { fillFullTable(candidate, candidateMlScore, candFlag); } - if constexpr (reconstructionType == aod::hf_cand::VertexerType::KfParticle) { + if constexpr (ReconstructionType == aod::hf_cand::VertexerType::KfParticle) { fillKFTable(candidate, collision, candFlag, functionSelection, sigbgstatus); } if (fillCandidateMcTable) { @@ -1097,7 +1099,7 @@ struct HfTreeCreatorLcToPKPi { /// \brief core function to fill tables in data /// \param collisions Collision table /// \param candidates Lc->pKpi candidate table - template + template void fillTablesData(Colls const& collisions, CandType const& candidates, aod::HfMlLcToPKPi const& candidateMlScores, @@ -1106,10 +1108,10 @@ struct HfTreeCreatorLcToPKPi { constexpr bool IsMc = false; - fillEventProperties(collisions); + fillEventProperties(collisions); const size_t candidatesSize = candidates.size(); - reserveTables(candidatesSize, IsMc); + reserveTables(candidatesSize, IsMc); // Filling candidate properties @@ -1120,7 +1122,7 @@ struct HfTreeCreatorLcToPKPi { float ptProng0 = candidate.ptProng0(); auto collision = candidate.template collision_as(); auto fillTable = [&](int candFlag) { - double pseudoRndm = ptProng0 * 1000. - static_cast(ptProng0 * 1000); + double const pseudoRndm = ptProng0 * 1000. - static_cast(ptProng0 * 1000); const int functionSelection = candFlag == 0 ? candidate.isSelLcToPKPi() : candidate.isSelLcToPiKP(); if (functionSelection >= selectionFlagLc && (candidate.pt() > downSampleBkgPtMax || (pseudoRndm < downSampleBkgFactor && candidate.pt() < downSampleBkgPtMax))) { if (fillCandidateLiteTable) { @@ -1129,7 +1131,7 @@ struct HfTreeCreatorLcToPKPi { fillFullTable(candidate, candidateMlScore, candFlag); } - if constexpr (reconstructionType == aod::hf_cand::VertexerType::KfParticle) { + if constexpr (ReconstructionType == aod::hf_cand::VertexerType::KfParticle) { fillKFTable(candidate, collision, candFlag, functionSelection, UndefValueInt); } } diff --git a/PWGHF/TableProducer/treeCreatorOmegacSt.cxx b/PWGHF/TableProducer/treeCreatorOmegacSt.cxx index 1bd4466893e..d4b76a1b631 100644 --- a/PWGHF/TableProducer/treeCreatorOmegacSt.cxx +++ b/PWGHF/TableProducer/treeCreatorOmegacSt.cxx @@ -260,16 +260,16 @@ struct HfTreeCreatorOmegacSt { Configurable bzOnly{"bzOnly", true, "Use B_z instead of full field map"}; Configurable cfgTriggersOfInterest{"cfgTriggersOfInterest", "fTrackedOmega,fHfCharmBarToXiBach", "Triggers of interest, comma separated for Zorro"}; - const int itsNClsMin = 4; - const float tpcNclsFindableFraction = 0.8; - const float tpcChi2NclMax = 4.; - const float itsChi2NclMax = 36.; - SliceCache cache; Service ccdb; o2::vertexing::DCAFitterN<2> df2; - float bz = 0.; + static constexpr int ItsNClsMin{4}; + static constexpr float TpcNclsFindableFraction{0.8f}; + static constexpr float TpcChi2NclMax{4.f}; + static constexpr float ItsChi2NclMax{36.f}; + + float bz{0.f}; int runNumber{0}; std::map mapMcPartToGenTable; @@ -354,7 +354,7 @@ struct HfTreeCreatorOmegacSt { int8_t origin = 0; // to be used for prompt/non prompt int8_t nPiToMuV0{0}, nPiToMuCasc{0}, nPiToMuOmegac0{0}; int8_t nKaToPiCasc{0}, nKaToPiOmegac0{0}; - std::vector idxBhadMothers{}; + std::vector idxBhadMothers; int decayChannel = -1; // flag for different decay channels bool isMatched = false; static constexpr std::size_t NDaughters{2u}; @@ -392,19 +392,19 @@ struct HfTreeCreatorOmegacSt { decayChannel = -1; // LOG(warning) << "Decay channel not recognized!"; } if (decayChannel != -1) { - int idxDaughter = (decayChannel == o2::aod::hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi) ? idxPionDaughter : idxKaonDaughter; + int const idxDaughter = (decayChannel == o2::aod::hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi) ? idxPionDaughter : idxKaonDaughter; auto particle = mcParticles.rawIteratorAt(idxDaughter); origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle, false, &idxBhadMothers); const auto& cascDaughter = mcParticles.iteratorAt(idxCascDaughter); const auto& mcColl = mcParticle.mcCollision(); - std::array primaryVertexPosGen = {mcColl.posX(), mcColl.posY(), mcColl.posZ()}; - std::array secondaryVertexGen = {cascDaughter.vx(), cascDaughter.vy(), cascDaughter.vz()}; + std::array const primaryVertexPosGen = {mcColl.posX(), mcColl.posY(), mcColl.posZ()}; + std::array const secondaryVertexGen = {cascDaughter.vx(), cascDaughter.vy(), cascDaughter.vz()}; float decayLengthCascGen = -1.; float decayLengthXYCascGen = -1.; if (cascDaughter.has_daughters()) { const auto& cascDecayDaughter = cascDaughter.daughters_as().iteratorAt(0); - std::array tertiaryVertexGen = {cascDecayDaughter.vx(), cascDecayDaughter.vy(), cascDecayDaughter.vz()}; + std::array const tertiaryVertexGen = {cascDecayDaughter.vx(), cascDecayDaughter.vy(), cascDecayDaughter.vz()}; decayLengthCascGen = RecoDecay::distance(tertiaryVertexGen, primaryVertexPosGen); decayLengthXYCascGen = RecoDecay::distanceXY(tertiaryVertexGen, primaryVertexPosGen); } @@ -455,10 +455,10 @@ struct HfTreeCreatorOmegacSt { runNumber = bc.runNumber(); auto timestamp = bc.timestamp(); - if (o2::parameters::GRPObject* grpo = ccdb->getForTimeStamp(grpPath, timestamp)) { + if (auto* grpo = ccdb->getForTimeStamp(grpPath, timestamp)) { o2::base::Propagator::initFieldFromGRP(grpo); bz = grpo->getNominalL3Field(); - } else if (o2::parameters::GRPMagField* grpmag = ccdb->getForTimeStamp(grpMagPath, timestamp)) { + } else if (auto* grpmag = ccdb->getForTimeStamp(grpMagPath, timestamp)) { o2::base::Propagator::initFieldFromGRP(grpmag); bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); } else { @@ -468,7 +468,7 @@ struct HfTreeCreatorOmegacSt { } uint32_t toiMask = 0; if (skimmedProcessing) { - bool sel = zorro.isSelected(bc.globalBC()); + bool const sel = zorro.isSelected(bc.globalBC()); if (sel) { std::vector toivect = zorro.getTriggerOfInterestResults(); for (size_t i{0}; i < toivect.size(); i++) { @@ -531,15 +531,15 @@ struct HfTreeCreatorOmegacSt { } hCandidatesPrPi->Fill(SVFitting::FitOk); - std::array massesV0Daughters{o2::constants::physics::MassProton, o2::constants::physics::MassPiMinus}; - std::array, NDaughters> momentaV0Daughters; - o2::track::TrackPar trackParV0Pr = df2.getTrackParamAtPCA(0); + std::array const massesV0Daughters{o2::constants::physics::MassProton, o2::constants::physics::MassPiMinus}; + std::array, NDaughters> momentaV0Daughters{}; + o2::track::TrackPar const trackParV0Pr = df2.getTrackParamAtPCA(0); trackParV0Pr.getPxPyPzGlo(momentaV0Daughters[0]); - o2::track::TrackPar trackParV0Pi = df2.getTrackParamAtPCA(1); + o2::track::TrackPar const trackParV0Pi = df2.getTrackParamAtPCA(1); trackParV0Pi.getPxPyPzGlo(momentaV0Daughters[1]); const auto massV0 = RecoDecay::m(momentaV0Daughters, massesV0Daughters); - o2::track::TrackParCov trackParCovV0 = df2.createParentTrackParCov(0); + o2::track::TrackParCov const trackParCovV0 = df2.createParentTrackParCov(0); hCandidatesV0Pi->Fill(SVFitting::BeforeFit); try { if (!df2.process(trackParCovV0, getTrackParCov(bachelor))) { @@ -555,20 +555,20 @@ struct HfTreeCreatorOmegacSt { const auto& secondaryVertex = df2.getPCACandidate(); const auto decayLengthCasc = RecoDecay::distance(secondaryVertex, primaryVertexPos); const auto decayLengthCascXY = RecoDecay::distanceXY(secondaryVertex, primaryVertexPos); - o2::track::TrackPar trackParV0 = df2.getTrackParamAtPCA(0); - o2::track::TrackPar trackParBachelor = df2.getTrackParamAtPCA(1); - std::array, NDaughters> momentaCascDaughters; + o2::track::TrackPar const trackParV0 = df2.getTrackParamAtPCA(0); + o2::track::TrackPar const trackParBachelor = df2.getTrackParamAtPCA(1); + std::array, NDaughters> momentaCascDaughters{}; trackParV0.getPxPyPzGlo(momentaCascDaughters[0]); trackParBachelor.getPxPyPzGlo(momentaCascDaughters[1]); - o2::track::TrackParCov trackParCovCascUntracked = df2.createParentTrackParCov(0); - std::array pCasc; + o2::track::TrackParCov const trackParCovCascUntracked = df2.createParentTrackParCov(0); + std::array pCasc{}; trackParCovCascUntracked.getPxPyPzGlo(pCasc); const auto cpaCasc = RecoDecay::cpa(primaryVertexPos, df2.getPCACandidate(), pCasc); const auto cpaXYCasc = RecoDecay::cpaXY(primaryVertexPos, df2.getPCACandidate(), pCasc); - std::array massesXiDaughters = {o2::constants::physics::MassLambda0, o2::constants::physics::MassPiPlus}; + std::array const massesXiDaughters = {o2::constants::physics::MassLambda0, o2::constants::physics::MassPiPlus}; const auto massXi = RecoDecay::m(momentaCascDaughters, massesXiDaughters); - std::array massesOmegaDaughters = {o2::constants::physics::MassLambda0, o2::constants::physics::MassKPlus}; + std::array const massesOmegaDaughters = {o2::constants::physics::MassLambda0, o2::constants::physics::MassKPlus}; const auto massOmega = RecoDecay::m(momentaCascDaughters, massesOmegaDaughters); registry.fill(HIST("hDca"), std::sqrt(impactParameterCasc.getR2())); @@ -586,10 +586,10 @@ struct HfTreeCreatorOmegacSt { (std::abs(v0TrackPr.tpcNSigmaPr()) < maxNSigmaV0Pr) && (std::abs(v0TrackPi.tpcNSigmaPi()) < maxNSigmaV0Pi)) { - std::array massesOmegacToOmegaPi{o2::constants::physics::MassOmegaMinus, o2::constants::physics::MassPiPlus}; - std::array massesOmegacToOmegaK{o2::constants::physics::MassOmegaMinus, o2::constants::physics::MassKPlus}; - std::array massesXicDaughters{o2::constants::physics::MassXiMinus, o2::constants::physics::MassPiPlus}; - std::array, NDaughters> momenta; + std::array const massesOmegacToOmegaPi{o2::constants::physics::MassOmegaMinus, o2::constants::physics::MassPiPlus}; + std::array const massesOmegacToOmegaK{o2::constants::physics::MassOmegaMinus, o2::constants::physics::MassKPlus}; + std::array const massesXicDaughters{o2::constants::physics::MassXiMinus, o2::constants::physics::MassPiPlus}; + std::array, NDaughters> momenta{}; auto trackParCovPr = getTrackParCov(v0TrackPr); auto trackParCovKa = getTrackParCov(v0TrackPi); @@ -614,12 +614,12 @@ struct HfTreeCreatorOmegacSt { track.globalIndex() == bachelor.globalIndex()) { continue; } - if ((track.itsNCls() >= itsNClsMin) && + if ((track.itsNCls() >= ItsNClsMin) && (track.tpcNClsFound() >= minNoClsTrackedPionOrKaon) && (track.tpcNClsCrossedRows() >= minNoClsTrackedPionOrKaon) && - (track.tpcNClsCrossedRows() >= tpcNclsFindableFraction * track.tpcNClsFindable()) && - (track.tpcChi2NCl() <= tpcChi2NclMax) && - (track.itsChi2NCl() <= itsChi2NclMax) && + (track.tpcNClsCrossedRows() >= TpcNclsFindableFraction * track.tpcNClsFindable()) && + (track.tpcChi2NCl() <= TpcChi2NclMax) && + (track.itsChi2NCl() <= ItsChi2NclMax) && (std::abs(track.tpcNSigmaPi()) < maxNSigmaPion || std::abs(track.tpcNSigmaKa()) < maxNSigmaKaon)) { LOGF(debug, " .. combining with pion/kaon candidate %d", track.globalIndex()); int trackMotherId = -1; @@ -653,7 +653,7 @@ struct HfTreeCreatorOmegacSt { const auto decayLength = RecoDecay::distance(secondaryVertex, primaryVertexPos); const auto decayLengthXY = RecoDecay::distanceXY(secondaryVertex, primaryVertexPos); const auto chi2TopCharmedBaryon = df2.getChi2AtPCACandidate(); - std::array pCharmedBaryon; + std::array pCharmedBaryon{}; df2.createParentTrackParCov().getPxPyPzGlo(pCharmedBaryon); const auto cpaCharmedBaryon = RecoDecay::cpa(primaryVertexPos, df2.getPCACandidate(), pCharmedBaryon); const auto cpaXYCharmedBaryon = RecoDecay::cpaXY(primaryVertexPos, df2.getPCACandidate(), pCharmedBaryon); @@ -746,11 +746,11 @@ struct HfTreeCreatorOmegacSt { momenta[0][0], // cascade momentum momenta[0][1], momenta[0][2], - trackCasc.sign() > 0 ? true : false, + static_cast(trackCasc.sign() > 0), momenta[1][0], // pion/kaon momentum momenta[1][1], momenta[1][2], - track.sign() > 0 ? true : false, + static_cast(track.sign() > 0), track.itsClusterMap(), cpaCharmedBaryon, cpaXYCharmedBaryon, @@ -841,9 +841,9 @@ struct HfTreeCreatorOmegacSt { runNumber = bc.runNumber(); auto timestamp = bc.timestamp(); - if (o2::parameters::GRPObject* grpo = ccdb->getForTimeStamp(grpPath, timestamp)) { + if (auto* grpo = ccdb->getForTimeStamp(grpPath, timestamp)) { o2::base::Propagator::initFieldFromGRP(grpo); - } else if (o2::parameters::GRPMagField* grpmag = ccdb->getForTimeStamp(grpMagPath, timestamp)) { + } else if (auto* grpmag = ccdb->getForTimeStamp(grpMagPath, timestamp)) { o2::base::Propagator::initFieldFromGRP(grpmag); } else { LOG(fatal) << "Got nullptr from CCDB for path " << grpMagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << timestamp; @@ -889,11 +889,11 @@ struct HfTreeCreatorOmegacSt { LOG(debug) << "cascade with PDG code: " << pdgCode; if (std::abs(pdgCode) == kOmegaMinus) { LOG(debug) << "found Omega, looking for pions"; - std::array masses{o2::constants::physics::MassOmegaMinus, o2::constants::physics::MassPiPlus}; - std::array, NDaughters> momenta; - std::array primaryVertexPos = {primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ()}; + std::array const masses{o2::constants::physics::MassOmegaMinus, o2::constants::physics::MassPiPlus}; + std::array, NDaughters> momenta{}; + std::array const primaryVertexPos = {primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ()}; const auto& mcColl = mother.mcCollision(); - std::array primaryVertexPosGen = {mcColl.posX(), mcColl.posY(), mcColl.posZ()}; + std::array const primaryVertexPosGen = {mcColl.posX(), mcColl.posY(), mcColl.posZ()}; for (const auto& track : tracks) { if (!track.has_mcParticle()) { @@ -917,7 +917,7 @@ struct HfTreeCreatorOmegacSt { hCandidatesCascPiOrK->Fill(SVFitting::BeforeFit); try { - if (df2.process(trackParCovCasc, trackParCovPion)) { + if (df2.process(trackParCovCasc, trackParCovPion) != 0) { const auto& secondaryVertex = df2.getPCACandidate(); const auto decayLength = RecoDecay::distance(secondaryVertex, primaryVertexPos); if (mother.has_mothers()) { @@ -927,7 +927,7 @@ struct HfTreeCreatorOmegacSt { registry.fill(HIST("hDecayLengthId"), decayLength * 1e4); registry.fill(HIST("hDecayLengthScaledId"), decayLength * o2::constants::physics::MassOmegaC0 / RecoDecay::p(momenta[0], momenta[1]) * 1e4); - std::array secondaryVertexGen = {mother.vx(), mother.vy(), mother.vz()}; + std::array const secondaryVertexGen = {mother.vx(), mother.vy(), mother.vz()}; const auto decayLengthGen = RecoDecay::distance(secondaryVertexGen, primaryVertexPosGen); registry.fill(HIST("hDecayLengthGen"), decayLengthGen * 1e4); registry.fill(HIST("hDecayLengthScaledGen"), decayLengthGen * o2::constants::physics::MassOmegaC0 / RecoDecay::p(momenta[0], momenta[1]) * 1e4); diff --git a/PWGHF/TableProducer/treeCreatorSigmacCorrBkg.cxx b/PWGHF/TableProducer/treeCreatorSigmacCorrBkg.cxx index 1e46bfc9ea5..9a4cec7ef9e 100644 --- a/PWGHF/TableProducer/treeCreatorSigmacCorrBkg.cxx +++ b/PWGHF/TableProducer/treeCreatorSigmacCorrBkg.cxx @@ -19,21 +19,28 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/D2H/Utils/utilsSigmac.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "Common/Core/RecoDecay.h" + +#include #include #include #include #include #include -#include #include #include -#include #include #include +#include + +#include +#include + using namespace o2; using namespace o2::framework; // for Produces, Configuable @@ -104,7 +111,7 @@ struct HfTreeCreatorSigmacCorrBkg { } /// BDT scores - if (candLcDauSc.mlProbLcToPiKP().size() > 0) { + if (!candLcDauSc.mlProbLcToPiKP().empty()) { outputMl.at(0) = candLcDauSc.mlProbLcToPiKP()[0]; /// bkg score outputMl.at(1) = candLcDauSc.mlProbLcToPiKP()[2]; /// non-prompt score } @@ -141,10 +148,10 @@ struct HfTreeCreatorSigmacCorrBkg { /// tag immediately the Σc0,++(2455) and Σc0,++(2520) signal auto flagMcDecayChanScAbs = std::abs(candidateSc.flagMcMatchRec()); - bool isTrueSigmac0 = (flagMcDecayChanScAbs == BIT(aod::hf_cand_sigmac::DecayType::Sc0ToPKPiPi)); - bool isTrueSigmacPlusPlus = (flagMcDecayChanScAbs == BIT(aod::hf_cand_sigmac::DecayType::ScplusplusToPKPiPi)); - bool isTrueSigmacStar0 = (flagMcDecayChanScAbs == BIT(aod::hf_cand_sigmac::DecayType::ScStar0ToPKPiPi)); - bool isTrueSigmacStarPlusPlus = (flagMcDecayChanScAbs == BIT(aod::hf_cand_sigmac::DecayType::ScStarPlusPlusToPKPiPi)); + bool const isTrueSigmac0 = (flagMcDecayChanScAbs == BIT(aod::hf_cand_sigmac::DecayType::Sc0ToPKPiPi)); + bool const isTrueSigmacPlusPlus = (flagMcDecayChanScAbs == BIT(aod::hf_cand_sigmac::DecayType::ScplusplusToPKPiPi)); + bool const isTrueSigmacStar0 = (flagMcDecayChanScAbs == BIT(aod::hf_cand_sigmac::DecayType::ScStar0ToPKPiPi)); + bool const isTrueSigmacStarPlusPlus = (flagMcDecayChanScAbs == BIT(aod::hf_cand_sigmac::DecayType::ScStarPlusPlusToPKPiPi)); if (isTrueSigmac0) { /// fill the output for the signal fillTable(candidateSc, candLcDauSc, o2::constants::physics::Pdg::kSigmaC0); @@ -152,21 +159,24 @@ struct HfTreeCreatorSigmacCorrBkg { /// the candidate that we reconstructed is a real Sigmac(2455, 2520), but later we look for correlated background sources /// let's continue continue; - } else if (isTrueSigmacPlusPlus) { + } + if (isTrueSigmacPlusPlus) { /// fill the output for the signal fillTable(candidateSc, candLcDauSc, o2::constants::physics::Pdg::kSigmaCPlusPlus); /// the candidate that we reconstructed is a real Sigmac(2455, 2520), but later we look for correlated background sources /// let's continue continue; - } else if (isTrueSigmacStar0) { + } + if (isTrueSigmacStar0) { /// fill the output for the signal fillTable(candidateSc, candLcDauSc, o2::constants::physics::Pdg::kSigmaCStar0); /// the candidate that we reconstructed is a real Sigmac(2455, 2520), but later we look for correlated background sources /// let's continue continue; - } else if (isTrueSigmacStarPlusPlus) { + } + if (isTrueSigmacStarPlusPlus) { /// fill the output for the signal fillTable(candidateSc, candLcDauSc, o2::constants::physics::Pdg::kSigmaCStarPlusPlus); @@ -192,7 +202,7 @@ struct HfTreeCreatorSigmacCorrBkg { /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// check if the candidate Lc and soft pion daugthers are not real Lc or pion - bool isLambdac = std::abs(candLcDauSc.flagMcMatchRec()) == hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi; + bool const isLambdac = std::abs(candLcDauSc.flagMcMatchRec()) == hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi; bool isPion = false; if (candSoftPiDauSc.has_mcParticle()) { isPion = std::abs(candSoftPiDauSc.template mcParticle_as().pdgCode()) == kPiPlus; @@ -258,7 +268,7 @@ struct HfTreeCreatorSigmacCorrBkg { candLcDauSc.template prong1_as(), candLcDauSc.template prong2_as()}; int8_t signLambdac = 0; - int indexRecLc = RecoDecay::getMatchedMCRec(particles, arrayDaughtersLambdac, o2::constants::physics::Pdg::kLambdaCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &signLambdac, 2); + int const indexRecLc = RecoDecay::getMatchedMCRec(particles, arrayDaughtersLambdac, o2::constants::physics::Pdg::kLambdaCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &signLambdac, 2); if (indexRecLc < 0) { /// this should never happen, since we check above that the isLambdac==true LOG(fatal) << "Generated Lambdac not found. Not expected. Aborting."; @@ -268,7 +278,7 @@ struct HfTreeCreatorSigmacCorrBkg { /// we should always enter here, since the Λc± is coming from a Λc±(2595, 2625) decay for (auto iMother = particleLc.mothersIds().front(); iMother <= particleLc.mothersIds().back(); ++iMother) { auto mother = particles.rawIteratorAt(iMother); - int pdgCodeMotherAbs = std::abs(mother.pdgCode()); + int const pdgCodeMotherAbs = std::abs(mother.pdgCode()); if (pdgCodeMotherAbs == o2::constants::physics::Pdg::kSigmaC0 || pdgCodeMotherAbs == o2::constants::physics::Pdg::kSigmaCPlusPlus) { /// the Λc± comes from a Σc0,++(2455) /// ==> we found a Λc±(2595, 2625) → Σc0,++(2455) π+,- decay! diff --git a/PWGHF/TableProducer/treeCreatorTccToD0D0Pi.cxx b/PWGHF/TableProducer/treeCreatorTccToD0D0Pi.cxx index a59713f4adf..2791be74e04 100644 --- a/PWGHF/TableProducer/treeCreatorTccToD0D0Pi.cxx +++ b/PWGHF/TableProducer/treeCreatorTccToD0D0Pi.cxx @@ -58,7 +58,6 @@ #include #include #include -#include #include using namespace o2; @@ -260,7 +259,7 @@ struct HfTreeCreatorTccToD0D0Pi { HfHelper hfHelper; Service ccdb; - o2::base::MatLayerCylSet* lut; + o2::base::MatLayerCylSet* lut{}; o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; double bz{0.}; int runNumber{0}; @@ -392,16 +391,17 @@ struct HfTreeCreatorTccToD0D0Pi { o2::dataformats::V0 trackD2; auto thisCollId = collision.globalIndex(); auto candwD0ThisColl = candidates.sliceBy(candsD0PerCollisionWithMl, thisCollId); - if (candwD0ThisColl.size() <= 1) + if (candwD0ThisColl.size() <= 1) { continue; // only loop the collision that include at least 2 D candidates + } auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); for (const auto& candidateD1 : candwD0ThisColl) { auto trackD1Prong0 = tracks.rawIteratorAt(candidateD1.prong0Id()); // positive daughter for D1 auto trackD1Prong1 = tracks.rawIteratorAt(candidateD1.prong1Id()); // negative daughter for D1 - std::array pVecD1Prong0{trackD1Prong0.pVector()}; - std::array pVecD1Prong1{trackD1Prong1.pVector()}; + std::array const pVecD1Prong0{trackD1Prong0.pVector()}; + std::array const pVecD1Prong1{trackD1Prong1.pVector()}; std::array pVecD1 = RecoDecay::pVec(pVecD1Prong0, pVecD1Prong1); for (auto candidateD2 = candidateD1 + 1; candidateD2 != candwD0ThisColl.end(); ++candidateD2) { @@ -416,8 +416,8 @@ struct HfTreeCreatorTccToD0D0Pi { auto trackD2Prong0 = tracks.rawIteratorAt(candidateD2.prong0Id()); // positive daughter for D2 auto trackD2Prong1 = tracks.rawIteratorAt(candidateD2.prong1Id()); // negative daughter for D2 - std::array pVecD2Prong0{trackD2Prong0.pVector()}; - std::array pVecD2Prong1{trackD2Prong1.pVector()}; + std::array const pVecD2Prong0{trackD2Prong0.pVector()}; + std::array const pVecD2Prong1{trackD2Prong1.pVector()}; std::array pVecD2 = RecoDecay::pVec(pVecD2Prong0, pVecD2Prong1); if (buildVertex) { @@ -646,7 +646,7 @@ struct HfTreeCreatorTccToD0D0Pi { auto massKpipi1 = RecoDecay::m(std::array{pVecD1Prong0, pVecD1Prong1, pVecSoftPi}, std::array{massD1Daus[0], massD1Daus[1], MassPiPlus}); auto massKpipi2 = RecoDecay::m(std::array{pVecD2Prong0, pVecD2Prong1, pVecSoftPi}, std::array{massD2Daus[0], massD2Daus[1], MassPiPlus}); auto arrayMomentaDDpi = std::array{pVecD1, pVecD2, pVecSoftPi}; - const auto massD0D0Pi = RecoDecay::m(std::move(arrayMomentaDDpi), std::array{MassD0, MassD0, MassPiPlus}); + const auto massD0D0Pi = RecoDecay::m(arrayMomentaDDpi, std::array{MassD0, MassD0, MassPiPlus}); const auto deltaMassD0D0Pi = massD0D0Pi - (massD01 + massD02); deltaMassD01 = massKpipi1 - massD01; diff --git a/PWGHF/TableProducer/treeCreatorToXiPi.cxx b/PWGHF/TableProducer/treeCreatorToXiPi.cxx index 01e40cfb2c8..ed265daa74a 100644 --- a/PWGHF/TableProducer/treeCreatorToXiPi.cxx +++ b/PWGHF/TableProducer/treeCreatorToXiPi.cxx @@ -246,19 +246,19 @@ struct HfTreeCreatorToXiPi { } } - template + template void fillEvent(const T& collision, float cutZPv) { rowEv( collision.sel8(), std::abs(collision.posZ()) < cutZPv); } - template + template void fillCandidate(const T& candidate, int8_t flagMc, int8_t debugMc, int8_t originMc, bool collisionMatched) { float centrality = -999.f; - if constexpr (useCentrality) { + if constexpr (UseCentrality) { auto const& collision = candidate.template collision_as(); centrality = o2::hf_centrality::getCentralityColl(collision); } @@ -376,13 +376,13 @@ struct HfTreeCreatorToXiPi { collisionMatched); } - template + template void fillCandidateLite(const T& candidate, int8_t flagMc, int8_t originMc, bool collisionMatched) { if (candidate.resultSelections() && candidate.statusPidCharmBaryon() && candidate.statusInvMassLambda() && candidate.statusInvMassCascade() && candidate.statusInvMassCharmBaryon()) { float centrality = -999.f; - if constexpr (useCentrality) { + if constexpr (UseCentrality) { auto const& collision = candidate.template collision_as(); centrality = o2::hf_centrality::getCentralityColl(collision); } diff --git a/PWGHF/TableProducer/treeCreatorXic0ToXiPiKf.cxx b/PWGHF/TableProducer/treeCreatorXic0ToXiPiKf.cxx index 0e1c06d5965..296d9e11ab7 100644 --- a/PWGHF/TableProducer/treeCreatorXic0ToXiPiKf.cxx +++ b/PWGHF/TableProducer/treeCreatorXic0ToXiPiKf.cxx @@ -156,14 +156,14 @@ struct HfTreeCreatorXic0ToXiPiKf { registry.add("hV0Dau1ItsChi2NCls", "hItsChi2NCls;status;entries", {HistType::kTH1D, {{1000, 0.0f, 10.0f}}}); } - template + template void fillKfCandidate(const T& candidate, int8_t flagMc, int8_t debugMc, int8_t originMc, bool collisionMatched) { if (candidate.resultSelections()) { float centrality = -999.f; - if constexpr (useCentrality) { + if constexpr (UseCentrality) { auto const& collision = candidate.template collision_as(); centrality = o2::hf_centrality::getCentralityColl(collision); } diff --git a/PWGHF/TableProducer/treeCreatorXicToPKPi.cxx b/PWGHF/TableProducer/treeCreatorXicToPKPi.cxx index 07374fe70ad..56e88a3b65e 100644 --- a/PWGHF/TableProducer/treeCreatorXicToPKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorXicToPKPi.cxx @@ -269,13 +269,13 @@ struct HfTreeCreatorXicToPKPi { /// \param doMc true to fill MC information /// \param massHypo mass hypothesis considered: 0 = PKPi, 1 = PiKP /// \param candidate is candidate - template + template void fillCandidateTable(const T& candidate) { int8_t flagMc = 0; int8_t originMc = 0; int candSwapped = 0; - if constexpr (doMc) { + if constexpr (DoMc) { flagMc = candidate.flagMcMatchRec(); originMc = candidate.originMcRec(); candSwapped = candidate.isCandidateSwapped(); @@ -285,10 +285,10 @@ struct HfTreeCreatorXicToPKPi { int selStatusPKPi = candidate.isSelXicToPKPi(); int selStatusPiKP = candidate.isSelXicToPiKP(); - if constexpr (massHypo == 0) { // Xic->PKPi + if constexpr (MassHypo == 0) { // Xic->PKPi selStatusPiKP *= -1; invMassXic = hfHelper.invMassXicToPKPi(candidate); - } else if constexpr (massHypo == 1) { // Xic->PiKP + } else if constexpr (MassHypo == 1) { // Xic->PiKP selStatusPKPi *= -1; invMassXic = hfHelper.invMassXicToPiKP(candidate); } @@ -422,7 +422,7 @@ struct HfTreeCreatorXicToPKPi { for (const auto& candidate : selectedXicToPKPiCand) { if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); + float const pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } @@ -432,7 +432,7 @@ struct HfTreeCreatorXicToPKPi { for (const auto& candidate : selectedXicToPiKPCand) { if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); + float const pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } @@ -479,7 +479,7 @@ struct HfTreeCreatorXicToPKPi { for (const auto& candidate : reconstructedCandBkg) { if (downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); + float const pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } diff --git a/PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx b/PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx index ca2f34ae5d3..8cd92bef0c5 100644 --- a/PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx @@ -373,16 +373,16 @@ struct HfTreeCreatorXicToXiPiPi { { } - template + template void fillCandidateTable(const T& candidate) { int8_t particleFlag = candidate.sign(); int8_t originMc = 0; - if constexpr (doMc) { + if constexpr (DoMc) { particleFlag = candidate.flagMcMatchRec(); originMc = candidate.originMcRec(); } - if constexpr (!doKf) { + if constexpr (!DoKf) { if (fillCandidateLiteTable) { rowCandidateLite( particleFlag, @@ -647,7 +647,7 @@ struct HfTreeCreatorXicToXiPiPi { } for (const auto& candidate : candidates) { if (fillOnlyBackground && downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng1() * 1000. - static_cast(candidate.ptProng1() * 1000); + float const pseudoRndm = candidate.ptProng1() * 1000. - static_cast(candidate.ptProng1() * 1000); if (pseudoRndm >= downSampleBkgFactor && candidate.pt() < ptMaxForDownSample) { continue; } @@ -667,7 +667,7 @@ struct HfTreeCreatorXicToXiPiPi { } for (const auto& candidate : candidates) { if (fillOnlyBackground && downSampleBkgFactor < 1.) { - float pseudoRndm = candidate.ptProng1() * 1000. - static_cast(candidate.ptProng1() * 1000); + float const pseudoRndm = candidate.ptProng1() * 1000. - static_cast(candidate.ptProng1() * 1000); if (pseudoRndm >= downSampleBkgFactor && candidate.pt() < ptMaxForDownSample) { continue; } @@ -697,7 +697,7 @@ struct HfTreeCreatorXicToXiPiPi { rowCandidateFull.reserve(recBg.size()); } for (const auto& candidate : recBg) { - float pseudoRndm = candidate.ptProng1() * 1000. - static_cast(candidate.ptProng1() * 1000); + float const pseudoRndm = candidate.ptProng1() * 1000. - static_cast(candidate.ptProng1() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } @@ -751,7 +751,7 @@ struct HfTreeCreatorXicToXiPiPi { rowCandidateFull.reserve(recBgKf.size()); } for (const auto& candidate : recBgKf) { - float pseudoRndm = candidate.ptProng1() * 1000. - static_cast(candidate.ptProng1() * 1000); + float const pseudoRndm = candidate.ptProng1() * 1000. - static_cast(candidate.ptProng1() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { continue; } diff --git a/PWGHF/TableProducer/treeCreatorXiccToPKPiPi.cxx b/PWGHF/TableProducer/treeCreatorXiccToPKPiPi.cxx index 56ca3f152c6..9e4f0e3703c 100644 --- a/PWGHF/TableProducer/treeCreatorXiccToPKPiPi.cxx +++ b/PWGHF/TableProducer/treeCreatorXiccToPKPiPi.cxx @@ -204,12 +204,12 @@ struct HfTreeCreatorXiccToPKPiPi { // Filling candidate properties rowCandidateFull.reserve(candidates.size()); for (const auto& candidate : candidates) { - auto fillTable = [&](int CandFlag, - int FunctionSelection, - float FunctionInvMass, - float FunctionCt, - float FunctionY) { - if (FunctionSelection >= 1) { + auto fillTable = [&](int candFlag, + int functionSelection, + float functionInvMass, + float functionCt, + float functionY) { + if (functionSelection >= 1) { auto xicCand = candidate.prong0(); rowCandidateFull( @@ -253,16 +253,16 @@ struct HfTreeCreatorXiccToPKPiPi { xicCand.prong1_as().tofNSigmaKa(), xicCand.prong2_as().tofNSigmaPr(), xicCand.prong2_as().tofNSigmaPi(), - 1 << CandFlag, - FunctionInvMass, + 1 << candFlag, + functionInvMass, candidate.pt(), candidate.p(), candidate.cpa(), candidate.cpaXY(), - FunctionCt, + functionCt, candidate.eta(), candidate.phi(), - FunctionY, + functionY, candidate.flagMcMatchRec(), candidate.originMcRec()); } diff --git a/PWGHF/Tasks/taskCharmHadImpactPar.cxx b/PWGHF/Tasks/taskCharmHadImpactPar.cxx index 01c838df129..b8da8a09ffa 100644 --- a/PWGHF/Tasks/taskCharmHadImpactPar.cxx +++ b/PWGHF/Tasks/taskCharmHadImpactPar.cxx @@ -167,14 +167,14 @@ struct HfTaskCharmHadImpactPar { // Fill THnSparses for the ML analysis /// \param candidate is a particle candidate - template + template void fillSparse(const CCands& candidate) { std::vector outputMl = {-999., -999., -999.}; float invMass{-1.f}; float yCand{-999.f}; - if constexpr (channel == Channel::DplusToKPiPi) { // D+ -> Kpipi - if constexpr (doMc) { + if constexpr (Channel == Channel::DplusToKPiPi) { // D+ -> Kpipi + if constexpr (DoMc) { if (fillOnlySignal) { if (std::abs(candidate.flagMcMatchRec()) != o2::hf_decay::hf_cand_3prong::DecayChannelMain::DplusToPiKPi) { return; @@ -183,7 +183,7 @@ struct HfTaskCharmHadImpactPar { } invMass = hfHelper.invMassDplusToPiKPi(candidate); yCand = hfHelper.yDplus(candidate); - if constexpr (withMl) { + if constexpr (WithMl) { for (auto iScore{0u}; iScore < candidate.mlProbDplusToPiKPi().size(); ++iScore) { outputMl[iScore] = candidate.mlProbDplusToPiKPi()[iScore]; } @@ -191,9 +191,9 @@ struct HfTaskCharmHadImpactPar { } else { registry.fill(HIST("hMassPtImpParPhiY"), invMass, candidate.pt(), candidate.impactParameterXY(), candidate.phi(), yCand); } - } else if constexpr (channel == Channel::DzeroToKPi) { + } else if constexpr (Channel == Channel::DzeroToKPi) { if (candidate.isSelD0()) { // D0 -> Kpi - if constexpr (doMc) { + if constexpr (DoMc) { if (fillOnlySignal) { if (std::abs(candidate.flagMcMatchRec()) != o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { return; @@ -202,7 +202,7 @@ struct HfTaskCharmHadImpactPar { } invMass = hfHelper.invMassD0ToPiK(candidate); yCand = hfHelper.yD0(candidate); - if constexpr (withMl) { + if constexpr (WithMl) { for (auto iScore{0u}; iScore < candidate.mlProbD0().size(); ++iScore) { outputMl[iScore] = candidate.mlProbD0()[iScore]; } @@ -214,7 +214,7 @@ struct HfTaskCharmHadImpactPar { if (candidate.isSelD0bar()) { invMass = hfHelper.invMassD0barToKPi(candidate); yCand = hfHelper.yD0(candidate); - if constexpr (withMl) { + if constexpr (WithMl) { for (auto iScore{0u}; iScore < candidate.mlProbD0bar().size(); ++iScore) { outputMl[iScore] = candidate.mlProbD0bar()[iScore]; } @@ -229,7 +229,7 @@ struct HfTaskCharmHadImpactPar { // Fill the TTree with both event and candidate properties /// \param candidate is a particle candidate /// \param collision is the respective collision - template + template void fillTree(const CCands& candidate, const CollType& collision) { std::vector outputMl = {-999., -999., -999.}; @@ -238,22 +238,22 @@ struct HfTaskCharmHadImpactPar { std::array ptProngs = {candidate.ptProng0(), candidate.ptProng1(), -1.}; std::array phiProngs = {RecoDecay::phi(std::array{candidate.pxProng0(), candidate.pyProng0()}), RecoDecay::phi(std::array{candidate.pxProng1(), candidate.pyProng1()}), 99.}; std::array etaProngs = {RecoDecay::eta(std::array{candidate.pxProng0(), candidate.pyProng0(), candidate.pzProng0()}), RecoDecay::eta(std::array{candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()}), 99.}; - if constexpr (channel == Channel::DplusToKPiPi) { // D+ -> Kpipi + if constexpr (Channel == Channel::DplusToKPiPi) { // D+ -> Kpipi invMass = hfHelper.invMassDplusToPiKPi(candidate); yCand = hfHelper.yDplus(candidate); ptProngs[2] = candidate.ptProng2(); phiProngs[2] = RecoDecay::phi(candidate.pxProng2(), candidate.pyProng2()); etaProngs[2] = RecoDecay::eta(std::array{candidate.pxProng2(), candidate.pyProng2(), candidate.pzProng2()}); - if constexpr (withMl) { + if constexpr (WithMl) { for (auto iScore{0u}; iScore < candidate.mlProbDplusToPiKPi().size(); ++iScore) { outputMl[iScore] = candidate.mlProbDplusToPiKPi()[iScore]; } } - } else if constexpr (channel == Channel::DzeroToKPi) { + } else if constexpr (Channel == Channel::DzeroToKPi) { if (candidate.isSelD0()) { // D0 -> Kpi invMass = hfHelper.invMassD0ToPiK(candidate); yCand = hfHelper.yD0(candidate); - if constexpr (withMl) { + if constexpr (WithMl) { for (auto iScore{0u}; iScore < candidate.mlProbD0().size(); ++iScore) { outputMl[iScore] = candidate.mlProbD0()[iScore]; } @@ -262,7 +262,7 @@ struct HfTaskCharmHadImpactPar { if (candidate.isSelD0bar()) { invMass = hfHelper.invMassD0barToKPi(candidate); yCand = hfHelper.yD0(candidate); - if constexpr (withMl) { + if constexpr (WithMl) { for (auto iScore{0u}; iScore < candidate.mlProbD0bar().size(); ++iScore) { outputMl[iScore] = candidate.mlProbD0bar()[iScore]; } @@ -279,7 +279,7 @@ struct HfTaskCharmHadImpactPar { } int8_t flagMcMatchRec = 0; - if constexpr (doMc) { + if constexpr (DoMc) { flagMcMatchRec = candidate.flagMcMatchRec(); } double impParZ = candidate.impactParameterXY() * (-1) * candidate.pz() / candidate.pt(); @@ -319,14 +319,14 @@ struct HfTaskCharmHadImpactPar { } /// \param candidates are reconstructed candidates - template + template void runAnalysis(const CCands& candidates, CollisionsCent const&) { for (auto const& candidate : candidates) { auto collision = candidate.template collision_as(); - fillSparse(candidate); + fillSparse(candidate); if (fillLightTreeCandidate) { - fillTree(candidate, collision); + fillTree(candidate, collision); } } } diff --git a/PWGHF/Tasks/taskLcCentrality.cxx b/PWGHF/Tasks/taskLcCentrality.cxx index d866224d752..96d4c03c2f3 100644 --- a/PWGHF/Tasks/taskLcCentrality.cxx +++ b/PWGHF/Tasks/taskLcCentrality.cxx @@ -45,7 +45,7 @@ using namespace o2::framework::expressions; void customize(std::vector& workflowOptions) { - ConfigParamSpec optionDoMC{"doMC", VariantType::Bool, true, {"Fill MC histograms."}}; + ConfigParamSpec const optionDoMC{"doMC", VariantType::Bool, true, {"Fill MC histograms."}}; workflowOptions.push_back(optionDoMC); } @@ -91,11 +91,11 @@ struct HfTaskLcCentrality { void process(soa::Join::iterator const& collision, soa::Filtered> const& candidates) { - float centrality = collision.centRun2V0M(); + float const centrality = collision.centRun2V0M(); registry.fill(HIST("hCentrality"), centrality); for (const auto& candidate : candidates) { - if (!(candidate.hfflag() & 1 << aod::hf_cand_3prong::DecayType::LcToPKPi)) { + if ((candidate.hfflag() & 1 << aod::hf_cand_3prong::DecayType::LcToPKPi) == 0) { continue; } if (yCandMax >= 0. && std::abs(hfHelper.yLc(candidate)) > yCandMax) { @@ -166,7 +166,7 @@ struct HfTaskLcCentralityMc { { // MC rec. for (const auto& candidate : candidates) { - if (!(candidate.hfflag() & 1 << aod::hf_cand_3prong::DecayType::LcToPKPi)) { + if ((candidate.hfflag() & 1 << aod::hf_cand_3prong::DecayType::LcToPKPi) == 0) { continue; } if (yCandMax >= 0. && std::abs(hfHelper.yLc(candidate)) > yCandMax) { diff --git a/PWGHF/Tasks/taskMcEfficiency.cxx b/PWGHF/Tasks/taskMcEfficiency.cxx index 6d58957c664..9cea8501366 100644 --- a/PWGHF/Tasks/taskMcEfficiency.cxx +++ b/PWGHF/Tasks/taskMcEfficiency.cxx @@ -118,13 +118,13 @@ struct HfTaskMcEfficiency { } template - inline bool checkTrack(T track) + bool checkTrack(T track) { // TODO configurable? return track.isGlobalTrackWoDCA(); } - template + template void candidate3ProngLoop(T1& candidates, T2& tracks, T3& mcParticles, std::vector pdgCodes) { using TracksType = std::decay_t; @@ -136,7 +136,7 @@ struct HfTaskMcEfficiency { for (const auto pdgCode : pdgCodes) { /// loop on pdg codes auto decayType = -1; - std::array pdgDaughters; + std::array pdgDaughters{}; if (pdgCode == Pdg::kDPlus) { decayType = 1 << aod::hf_cand_3prong::DecayType::DplusToPiKPi; @@ -175,24 +175,24 @@ struct HfTaskMcEfficiency { bool isHypoMass1SelStep = false; bool isHypoMass2SelStep = false; /// selections from candidate selectors - if constexpr (hasDplus) { + if constexpr (HasDplus) { if (pdgCode == Pdg::kDPlus) { isHypoMass1SelStep = candidate.isSelDplusToPiKPi(); // only one mass hypo for D+ } } - if constexpr (hasDs) { + if constexpr (HasDs) { if (pdgCode == Pdg::kDS) { isHypoMass1SelStep = candidate.isSelDsToKKPi(); isHypoMass2SelStep = candidate.isSelDsToPiKK(); } } - if constexpr (hasLc) { + if constexpr (HasLc) { if (pdgCode == Pdg::kLambdaCPlus) { isHypoMass1SelStep = candidate.isSelLcToPKPi(); isHypoMass2SelStep = candidate.isSelLcToPiKP(); } } - if constexpr (hasXicPlus) { + if constexpr (HasXicPlus) { if (pdgCode == Pdg::kXiCPlus) { isHypoMass1SelStep = candidate.isSelXicToPKPi(); isHypoMass2SelStep = candidate.isSelXicToPiKP(); @@ -201,9 +201,9 @@ struct HfTaskMcEfficiency { bool collisionMatched = false; int origin = RecoDecay::OriginType::None; - if constexpr (mc) { /// info MC used + if constexpr (Mc) { /// info MC used int8_t sign = 0; - int indexRec = RecoDecay::getMatchedMCRec(mcParticles, std::array{trackPos, trackNeg, trackThird}, pdgCode, pdgDaughters, true, &sign, 2); + int const indexRec = RecoDecay::getMatchedMCRec(mcParticles, std::array{trackPos, trackNeg, trackThird}, pdgCode, pdgDaughters, true, &sign, 2); if (indexRec < 0) { continue; @@ -250,8 +250,8 @@ struct HfTaskMcEfficiency { float massHypo1 = -1; float massHypo2 = -1; - float cpa = candidate.cpa(); - float pt = candidate.pt(); + float const cpa = candidate.cpa(); + float const pt = candidate.pt(); // bool selected = false; /// all candidates @@ -303,8 +303,8 @@ struct HfTaskMcEfficiency { // duplicates std::array prongIds = {candidate.prong0Id(), candidate.prong1Id(), candidate.prong2Id()}; std::sort(prongIds.begin(), prongIds.end()); - std::string concat = std::to_string(prongIds[0]) + std::to_string(prongIds[1]) + std::to_string(prongIds[2]); - std::size_t hash = std::hash{}(concat); /// unique value for the 'concat' string + std::string const concat = std::to_string(prongIds[0]) + std::to_string(prongIds[1]) + std::to_string(prongIds[2]); + std::size_t const hash = std::hash{}(concat); /// unique value for the 'concat' string if (duplicates.find(hash) != duplicates.end()) { if (isHypoMass1TrackStep) { hCandidates->Fill(kHFStepTrackedDuplicates, pt, massHypo1, pdgCode, cpa, collisionMatched, origin); @@ -324,7 +324,7 @@ struct HfTaskMcEfficiency { } } - template + template void candidate2ProngLoop(T1 const& candidates, T2 const& tracks, T3 const& mcParticles, std::vector pdgCodes) { using TracksType = std::decay_t; @@ -334,7 +334,7 @@ struct HfTaskMcEfficiency { for (const auto pdgCode : pdgCodes) { auto decayType = -1; - std::array pdgDaughters; + std::array pdgDaughters{}; if (pdgCode == Pdg::kD0) { decayType = 1 << aod::hf_cand_2prong::DecayType::D0ToPiK; @@ -360,7 +360,7 @@ struct HfTaskMcEfficiency { bool collisionMatched = false; int origin = RecoDecay::OriginType::None; - if constexpr (mc) { + if constexpr (Mc) { auto indexRec = RecoDecay::getMatchedMCRec(mcParticles, std::array{trackPos, trackNeg}, pdgCode, pdgDaughters, false); if (indexRec < 0) { continue; @@ -371,8 +371,8 @@ struct HfTaskMcEfficiency { } float mass = -1; - float cpa = candidate.cpa(); - float pt = candidate.pt(); + float const cpa = candidate.cpa(); + float const pt = candidate.pt(); bool selected = false; if (pdgCode == Pdg::kD0) { mass = hfHelper.invMassD0ToPiK(candidate); @@ -465,7 +465,7 @@ struct HfTaskMcEfficiency { continue; } - int origin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle); + int const origin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle); hCandidates->Fill(kHFStepMC, mcParticle.pt(), mass, pdgCode, 1.0, true, origin); @@ -536,10 +536,10 @@ struct HfTaskMcEfficiency { /// 3-prong analyses - template + template void candidate3ProngMcLoop(C const& candidates, TracksWithSelectionMC const& tracks, aod::McParticles const& mcParticles, aod::McCollisionLabels const&, std::vector pdgCodes) { - candidate3ProngLoop(candidates, tracks, mcParticles, pdgCodes); + candidate3ProngLoop(candidates, tracks, mcParticles, pdgCodes); auto hCandidates = registry.get(HIST("hCandidates")); auto hTrackablePtEta = registry.get(HIST("hTrackablePtEta")); @@ -577,7 +577,7 @@ struct HfTaskMcEfficiency { continue; } - std::array pdgDaughters; + std::array pdgDaughters{}; if (pdgCode == Pdg::kDPlus) { pdgDaughters[0] = +kPiPlus; pdgDaughters[1] = -kKPlus; @@ -600,13 +600,13 @@ struct HfTaskMcEfficiency { /// check if we end-up with the correct final state using MC info int8_t sign = 0; - std::unique_ptr> listIndexDaughters(new std::vector{}); + std::unique_ptr> const listIndexDaughters(new std::vector{}); if (!RecoDecay::isMatchedMCGen(mcParticles, mcParticle, pdgCode, pdgDaughters, true, &sign, 2, listIndexDaughters.get())) { /// check if we have Λc± → p± K∓ π± (either direct or resonant), or D± → π± K∓ π± (either direct or resonant) or Ds± → K± K∓ π± (either direct or resonant) continue; } - int origin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle); + int const origin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle); hCandidates->Fill(kHFStepMC, mcParticle.pt(), mass, pdgCode * sign, 1.0, true, origin); @@ -711,7 +711,7 @@ struct HfTaskMcEfficiency { void processDataD0(soa::Join const& candidates, TracksWithSelection const& tracks) { - std::vector pdgCodes{Pdg::kD0Bar, Pdg::kD0}; + std::vector const pdgCodes{Pdg::kD0Bar, Pdg::kD0}; candidate2ProngLoop(candidates, tracks, tracks, pdgCodes); // NOTE third argument has to be provided but is not used as template argument is } PROCESS_SWITCH(HfTaskMcEfficiency, processDataD0, "Process D0 data (no MC information needed)", false); @@ -719,7 +719,7 @@ struct HfTaskMcEfficiency { void processDataDplus(soa::Join const& candidates, TracksWithSelection const& tracks) { - std::vector pdgCodes{Pdg::kDPlus}; + std::vector const pdgCodes{Pdg::kDPlus}; candidate3ProngLoop(candidates, tracks, tracks, pdgCodes); } PROCESS_SWITCH(HfTaskMcEfficiency, processDataDplus, "Process D+ data (no MC information needed)", false); @@ -727,7 +727,7 @@ struct HfTaskMcEfficiency { void processDataDs(soa::Join const& candidates, TracksWithSelection const& tracks) { - std::vector pdgCodes{Pdg::kDS}; + std::vector const pdgCodes{Pdg::kDS}; candidate3ProngLoop(candidates, tracks, tracks, pdgCodes); } PROCESS_SWITCH(HfTaskMcEfficiency, processDataDs, "Process Ds+ data (no MC information needed)", false); @@ -735,7 +735,7 @@ struct HfTaskMcEfficiency { void processDataLc(soa::Join const& candidates, TracksWithSelection const& tracks) { - std::vector pdgCodes{Pdg::kLambdaCPlus}; + std::vector const pdgCodes{Pdg::kLambdaCPlus}; candidate3ProngLoop(candidates, tracks, tracks, pdgCodes); } PROCESS_SWITCH(HfTaskMcEfficiency, processDataLc, "Process Lc data (no MC information needed)", false); @@ -743,7 +743,7 @@ struct HfTaskMcEfficiency { void processDataXic(soa::Join const& candidates, TracksWithSelection const& tracks) { - std::vector pdgCodes{Pdg::kXiCPlus}; + std::vector const pdgCodes{Pdg::kXiCPlus}; candidate3ProngLoop(candidates, tracks, tracks, pdgCodes); } PROCESS_SWITCH(HfTaskMcEfficiency, processDataXic, "Process Xic data (no MC information needed)", false); @@ -751,7 +751,7 @@ struct HfTaskMcEfficiency { void processDataDplusDs(soa::Join const& candidates, TracksWithSelection const& tracks) { - std::vector pdgCodes{Pdg::kDPlus, Pdg::kDS}; + std::vector const pdgCodes{Pdg::kDPlus, Pdg::kDS}; candidate3ProngLoop(candidates, tracks, tracks, pdgCodes); } PROCESS_SWITCH(HfTaskMcEfficiency, processDataDplusDs, "Process D+ and Ds+ data (no MC information needed)", false); @@ -759,7 +759,7 @@ struct HfTaskMcEfficiency { void processDataDplusDsLc(soa::Join const& candidates, TracksWithSelection const& tracks) { - std::vector pdgCodes{Pdg::kDPlus, Pdg::kDS, Pdg::kLambdaCPlus}; + std::vector const pdgCodes{Pdg::kDPlus, Pdg::kDS, Pdg::kLambdaCPlus}; candidate3ProngLoop(candidates, tracks, tracks, pdgCodes); } PROCESS_SWITCH(HfTaskMcEfficiency, processDataDplusDsLc, "Process D+, Ds+, and Lc data (no MC information needed)", false); @@ -767,7 +767,7 @@ struct HfTaskMcEfficiency { void processDataDplusLc(soa::Join const& candidates, TracksWithSelection const& tracks) { - std::vector pdgCodes{Pdg::kDPlus, Pdg::kLambdaCPlus}; + std::vector const pdgCodes{Pdg::kDPlus, Pdg::kLambdaCPlus}; candidate3ProngLoop(candidates, tracks, tracks, pdgCodes); } PROCESS_SWITCH(HfTaskMcEfficiency, processDataDplusLc, "Process D+ and Lc data (no MC information needed)", false); @@ -775,7 +775,7 @@ struct HfTaskMcEfficiency { void processDataDsLc(soa::Join const& candidates, TracksWithSelection const& tracks) { - std::vector pdgCodes{Pdg::kDPlus, Pdg::kDS, Pdg::kLambdaCPlus}; + std::vector const pdgCodes{Pdg::kDPlus, Pdg::kDS, Pdg::kLambdaCPlus}; candidate3ProngLoop(candidates, tracks, tracks, pdgCodes); } PROCESS_SWITCH(HfTaskMcEfficiency, processDataDsLc, "Process Ds+ and Lc data (no MC information needed)", false); @@ -786,7 +786,7 @@ struct HfTaskMcEfficiency { aod::McParticles const& mcParticles, aod::McCollisionLabels const& colls) { - std::vector pdgCodes{Pdg::kD0Bar, Pdg::kD0}; + std::vector const pdgCodes{Pdg::kD0Bar, Pdg::kD0}; candidate2ProngMcLoop(candidates, tracks, mcParticles, colls, pdgCodes); } PROCESS_SWITCH(HfTaskMcEfficiency, processMcD0, "Process MC for D0 signal", true); @@ -796,7 +796,7 @@ struct HfTaskMcEfficiency { aod::McParticles const& mcParticles, aod::McCollisionLabels const& colls) { - std::vector pdgCodes{Pdg::kDPlus}; + std::vector const pdgCodes{Pdg::kDPlus}; candidate3ProngMcLoop(candidates, tracks, mcParticles, colls, pdgCodes); } PROCESS_SWITCH(HfTaskMcEfficiency, processMcDplus, "Process MC for D+ signal", false); @@ -806,7 +806,7 @@ struct HfTaskMcEfficiency { aod::McParticles const& mcParticles, aod::McCollisionLabels const& colls) { - std::vector pdgCodes{Pdg::kDS}; + std::vector const pdgCodes{Pdg::kDS}; candidate3ProngMcLoop(candidates, tracks, mcParticles, colls, pdgCodes); } PROCESS_SWITCH(HfTaskMcEfficiency, processMcDs, "Process MC for Ds+ signal", false); @@ -816,7 +816,7 @@ struct HfTaskMcEfficiency { aod::McParticles const& mcParticles, aod::McCollisionLabels const& colls) { - std::vector pdgCodes{Pdg::kLambdaCPlus}; + std::vector const pdgCodes{Pdg::kLambdaCPlus}; candidate3ProngMcLoop(candidates, tracks, mcParticles, colls, pdgCodes); } PROCESS_SWITCH(HfTaskMcEfficiency, processMcLc, "Process MC for Lc signal", false); @@ -826,7 +826,7 @@ struct HfTaskMcEfficiency { aod::McParticles const& mcParticles, aod::McCollisionLabels const& colls) { - std::vector pdgCodes{Pdg::kXiCPlus}; + std::vector const pdgCodes{Pdg::kXiCPlus}; candidate3ProngMcLoop(candidates, tracks, mcParticles, colls, pdgCodes); } PROCESS_SWITCH(HfTaskMcEfficiency, processMcXic, "Process MC for Xic signal", false); @@ -836,7 +836,7 @@ struct HfTaskMcEfficiency { aod::McParticles const& mcParticles, aod::McCollisionLabels const& colls) { - std::vector pdgCodes{Pdg::kDPlus, Pdg::kDS}; + std::vector const pdgCodes{Pdg::kDPlus, Pdg::kDS}; candidate3ProngMcLoop(candidates, tracks, mcParticles, colls, pdgCodes); } PROCESS_SWITCH(HfTaskMcEfficiency, processMcDplusDs, "Process MC for D+ and Ds+ signals", false); @@ -846,7 +846,7 @@ struct HfTaskMcEfficiency { aod::McParticles const& mcParticles, aod::McCollisionLabels const& colls) { - std::vector pdgCodes{Pdg::kDPlus, Pdg::kDS, Pdg::kLambdaCPlus}; + std::vector const pdgCodes{Pdg::kDPlus, Pdg::kDS, Pdg::kLambdaCPlus}; candidate3ProngMcLoop(candidates, tracks, mcParticles, colls, pdgCodes); } PROCESS_SWITCH(HfTaskMcEfficiency, processMcDplusDsLc, "Process MC for D+, Ds+, and Lc signals", false); @@ -856,7 +856,7 @@ struct HfTaskMcEfficiency { aod::McParticles const& mcParticles, aod::McCollisionLabels const& colls) { - std::vector pdgCodes{Pdg::kDPlus, Pdg::kLambdaCPlus}; + std::vector const pdgCodes{Pdg::kDPlus, Pdg::kLambdaCPlus}; candidate3ProngMcLoop(candidates, tracks, mcParticles, colls, pdgCodes); } PROCESS_SWITCH(HfTaskMcEfficiency, processMcDplusLc, "Process MC for D+ and Lc signals", false); @@ -866,7 +866,7 @@ struct HfTaskMcEfficiency { aod::McParticles const& mcParticles, aod::McCollisionLabels const& colls) { - std::vector pdgCodes{Pdg::kDS, Pdg::kLambdaCPlus}; + std::vector const pdgCodes{Pdg::kDS, Pdg::kLambdaCPlus}; candidate3ProngMcLoop(candidates, tracks, mcParticles, colls, pdgCodes); } PROCESS_SWITCH(HfTaskMcEfficiency, processMcDsLc, "Process MC for Ds+ and Lc signals", false); diff --git a/PWGHF/Tasks/taskMcEfficiencyToXiPi.cxx b/PWGHF/Tasks/taskMcEfficiencyToXiPi.cxx index 0550bd5e726..78398ae2ec0 100644 --- a/PWGHF/Tasks/taskMcEfficiencyToXiPi.cxx +++ b/PWGHF/Tasks/taskMcEfficiencyToXiPi.cxx @@ -104,13 +104,13 @@ struct HfTaskMcEfficiencyToXiPi { } template - inline bool checkTrackGlbTrk(T const& track) + bool checkTrackGlbTrk(T const& track) { return (track.isGlobalTrackWoDCA() && track.tpcNClsFound() > nClustersTpcMin && track.itsNCls() > nClustersItsMin); } template - inline bool checkTrackItsTrk(T const& track) + bool checkTrackItsTrk(T const& track) { return (track.isQualityTrackITS() && track.itsNCls() > nClustersItsMin); } diff --git a/PWGHF/Tasks/taskMcGenPtRapShapes.cxx b/PWGHF/Tasks/taskMcGenPtRapShapes.cxx index 01c795d0461..849b32b2c66 100644 --- a/PWGHF/Tasks/taskMcGenPtRapShapes.cxx +++ b/PWGHF/Tasks/taskMcGenPtRapShapes.cxx @@ -44,10 +44,10 @@ using namespace o2::constants::physics; namespace { const int nCharmHadrons = 10; -static constexpr std::array pdgCodesCharm = {Pdg::kD0, Pdg::kDPlus, Pdg::kDS, Pdg::kDStar, Pdg::kLambdaCPlus, Pdg::kSigmaC0, Pdg::kSigmaCPlusPlus, Pdg::kXiC0, Pdg::kXiCPlus, Pdg::kOmegaC0}; +constexpr std::array PdgCodesCharm = {Pdg::kD0, Pdg::kDPlus, Pdg::kDS, Pdg::kDStar, Pdg::kLambdaCPlus, Pdg::kSigmaC0, Pdg::kSigmaCPlusPlus, Pdg::kXiC0, Pdg::kXiCPlus, Pdg::kOmegaC0}; const int nBeautyHadrons = 4; -static constexpr std::array pdgCodesBeauty = {Pdg::kB0, Pdg::kBPlus, Pdg::kBS, Pdg::kLambdaB0}; +constexpr std::array PdgCodesBeauty = {Pdg::kB0, Pdg::kBPlus, Pdg::kBS, Pdg::kLambdaB0}; } // namespace struct HfTaskMcGenPtRapShapes { @@ -62,32 +62,32 @@ struct HfTaskMcGenPtRapShapes { std::array, nCharmHadrons> histPtCharmVsPtBeautyNonPrompt{}; std::array, nBeautyHadrons> histRapVsPtBeauty{}; - HistogramRegistry registry{}; + HistogramRegistry registry; void init(InitContext&) { for (auto iCharmHad{0}; iCharmHad < nCharmHadrons; ++iCharmHad) { - histRapVsPtCharmPrompt[iCharmHad] = registry.add(Form("CharmHadrons/hRapVsPtPrompt%d", pdgCodesCharm[iCharmHad]), Form("Prompt %d;#it{p}_{T} (GeV/#it{c});#it{y}", pdgCodesCharm[iCharmHad]), {HistType::kTH2F, {axisPtCharm, axisRapCharm}}); - histRapVsPtCharmNonPrompt[iCharmHad] = registry.add(Form("CharmHadrons/hRapVsPtNonPrompt%d", pdgCodesCharm[iCharmHad]), Form("Non-prompt %d;#it{p}_{T} (GeV/#it{c});#it{y}", pdgCodesCharm[iCharmHad]), {HistType::kTH2F, {axisPtCharm, axisRapCharm}}); - histPtCharmVsPtBeautyNonPrompt[iCharmHad] = registry.add(Form("CharmHadrons/hPtCharmVsPtBeautyNonPrompt%d", pdgCodesCharm[iCharmHad]), Form("Non-prompt %d;#it{p}_{T}(b-had) (GeV/#it{c});#it{p}_{T}(c-had) (GeV/#it{c})", pdgCodesCharm[iCharmHad]), {HistType::kTH2F, {axisPtBeauty, axisPtCharm}}); + histRapVsPtCharmPrompt[iCharmHad] = registry.add(Form("CharmHadrons/hRapVsPtPrompt%d", PdgCodesCharm[iCharmHad]), Form("Prompt %d;#it{p}_{T} (GeV/#it{c});#it{y}", PdgCodesCharm[iCharmHad]), {HistType::kTH2F, {axisPtCharm, axisRapCharm}}); + histRapVsPtCharmNonPrompt[iCharmHad] = registry.add(Form("CharmHadrons/hRapVsPtNonPrompt%d", PdgCodesCharm[iCharmHad]), Form("Non-prompt %d;#it{p}_{T} (GeV/#it{c});#it{y}", PdgCodesCharm[iCharmHad]), {HistType::kTH2F, {axisPtCharm, axisRapCharm}}); + histPtCharmVsPtBeautyNonPrompt[iCharmHad] = registry.add(Form("CharmHadrons/hPtCharmVsPtBeautyNonPrompt%d", PdgCodesCharm[iCharmHad]), Form("Non-prompt %d;#it{p}_{T}(b-had) (GeV/#it{c});#it{p}_{T}(c-had) (GeV/#it{c})", PdgCodesCharm[iCharmHad]), {HistType::kTH2F, {axisPtBeauty, axisPtCharm}}); } for (auto iBeautyHad{0}; iBeautyHad < nBeautyHadrons; ++iBeautyHad) { - histRapVsPtBeauty[iBeautyHad] = registry.add(Form("BeautyHadrons/hRapVsPt%d", pdgCodesBeauty[iBeautyHad]), Form("%d;#it{p}_{T} (GeV/#it{c});#it{y}", pdgCodesBeauty[iBeautyHad]), {HistType::kTH2F, {axisPtBeauty, axisRapBeauty}}); + histRapVsPtBeauty[iBeautyHad] = registry.add(Form("BeautyHadrons/hRapVsPt%d", PdgCodesBeauty[iBeautyHad]), Form("%d;#it{p}_{T} (GeV/#it{c});#it{y}", PdgCodesBeauty[iBeautyHad]), {HistType::kTH2F, {axisPtBeauty, axisRapBeauty}}); } } void process(aod::McParticles const& mcParticles) { for (auto const& mcParticle : mcParticles) { - int absPdgCode = std::abs(mcParticle.pdgCode()); - float pt = mcParticle.pt(); - float rap = mcParticle.y(); - auto itCharm = std::find(pdgCodesCharm.begin(), pdgCodesCharm.end(), absPdgCode); - auto itBeauty = std::find(pdgCodesBeauty.begin(), pdgCodesBeauty.end(), absPdgCode); - if (itCharm != pdgCodesCharm.end()) { - auto idxCharm = std::distance(pdgCodesCharm.begin(), itCharm); + int const absPdgCode = std::abs(mcParticle.pdgCode()); + float const pt = mcParticle.pt(); + float const rap = mcParticle.y(); + const auto* itCharm = std::find(PdgCodesCharm.begin(), PdgCodesCharm.end(), absPdgCode); + const auto* itBeauty = std::find(PdgCodesBeauty.begin(), PdgCodesBeauty.end(), absPdgCode); + if (itCharm != PdgCodesCharm.end()) { + auto idxCharm = std::distance(PdgCodesCharm.begin(), itCharm); std::vector idxBhadMothers{}; auto origin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, false, &idxBhadMothers); if (origin == RecoDecay::OriginType::Prompt) { @@ -99,8 +99,8 @@ struct HfTaskMcGenPtRapShapes { histPtCharmVsPtBeautyNonPrompt[idxCharm]->Fill(bMother.pt(), pt); } } - } else if (itBeauty != pdgCodesBeauty.end()) { - auto idxBeauty = std::distance(pdgCodesBeauty.begin(), itBeauty); + } else if (itBeauty != PdgCodesBeauty.end()) { + auto idxBeauty = std::distance(PdgCodesBeauty.begin(), itBeauty); histRapVsPtBeauty[idxBeauty]->Fill(pt, rap); } } diff --git a/PWGHF/Tasks/taskMcValidation.cxx b/PWGHF/Tasks/taskMcValidation.cxx index 083b85d6255..650452250db 100644 --- a/PWGHF/Tasks/taskMcValidation.cxx +++ b/PWGHF/Tasks/taskMcValidation.cxx @@ -97,39 +97,39 @@ enum DecayChannels { DzeroToKPi = 0, XiCzeroToXiPi, OmegaCToOmegaPi, OmegaCToXiPi, - nChannels + NChannels }; // always keep nChannels at the end -static constexpr int nCharmMesonChannels = 10; // number of charm meson channels -static constexpr int nBeautyChannels = 3; // number of beauty hadron channels -static constexpr int nCharmBaryonChannels = nChannels - nCharmMesonChannels - nBeautyChannels; // number of charm baryon channels -static constexpr int nOriginTypes = 2; // number of origin types (prompt, non-prompt; only for charm hadrons) -static constexpr std::array PDGArrayParticle = {o2::constants::physics::Pdg::kD0, o2::constants::physics::Pdg::kDStar, - o2::constants::physics::Pdg::kDPlus, o2::constants::physics::Pdg::kDPlus, - o2::constants::physics::Pdg::kDS, o2::constants::physics::Pdg::kDS, o2::constants::physics::Pdg::kDS1, o2::constants::physics::Pdg::kDS2Star, - o2::constants::physics::Pdg::kD10, o2::constants::physics::Pdg::kD2Star0, - o2::constants::physics::Pdg::kB0, o2::constants::physics::Pdg::kBPlus, o2::constants::physics::Pdg::kBS, - o2::constants::physics::Pdg::kLambdaCPlus, o2::constants::physics::Pdg::kLambdaCPlus, - o2::constants::physics::Pdg::kXiCPlus, o2::constants::physics::Pdg::kXiCPlus, o2::constants::physics::Pdg::kXiC0, - o2::constants::physics::Pdg::kOmegaC0, o2::constants::physics::Pdg::kOmegaC0}; -static constexpr std::array nDaughters = {2, 3, 3, 3, 3, 3, 5, 5, 4, 4, 4, 3, 4, 3, 3, 3, 5, 4, 4, 4}; -static constexpr std::array maxDepthForSearch = {1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 2, 3, 2, 3, 2, 4, 3, 3, 3}; +constexpr int NCharmMesonChannels = 10; // number of charm meson channels +constexpr int NBeautyChannels = 3; // number of beauty hadron channels +constexpr int NCharmBaryonChannels = NChannels - NCharmMesonChannels - NBeautyChannels; // number of charm baryon channels +constexpr int NOriginTypes = 2; // number of origin types (prompt, non-prompt; only for charm hadrons) +constexpr std::array PDGArrayParticle = {o2::constants::physics::Pdg::kD0, o2::constants::physics::Pdg::kDStar, + o2::constants::physics::Pdg::kDPlus, o2::constants::physics::Pdg::kDPlus, + o2::constants::physics::Pdg::kDS, o2::constants::physics::Pdg::kDS, o2::constants::physics::Pdg::kDS1, o2::constants::physics::Pdg::kDS2Star, + o2::constants::physics::Pdg::kD10, o2::constants::physics::Pdg::kD2Star0, + o2::constants::physics::Pdg::kB0, o2::constants::physics::Pdg::kBPlus, o2::constants::physics::Pdg::kBS, + o2::constants::physics::Pdg::kLambdaCPlus, o2::constants::physics::Pdg::kLambdaCPlus, + o2::constants::physics::Pdg::kXiCPlus, o2::constants::physics::Pdg::kXiCPlus, o2::constants::physics::Pdg::kXiC0, + o2::constants::physics::Pdg::kOmegaC0, o2::constants::physics::Pdg::kOmegaC0}; +constexpr std::array NDaughters = {2, 3, 3, 3, 3, 3, 5, 5, 4, 4, 4, 3, 4, 3, 3, 3, 5, 4, 4, 4}; +constexpr std::array MaxDepthForSearch = {1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 2, 3, 2, 3, 2, 4, 3, 3, 3}; // keep coherent indexing with PDGArrayParticle // FIXME: look for a better solution -static constexpr std::array, nChannels> arrPDGFinal2Prong = {{{+kPiPlus, -kKPlus}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}}}; -static constexpr std::array, nChannels> arrPDGFinal3Prong = {{{}, {+kPiPlus, -kKPlus, +kPiPlus}, {+kPiPlus, -kKPlus, +kPiPlus}, {+kKPlus, -kKPlus, +kPiPlus}, {+kKPlus, -kKPlus, +kPiPlus}, {+kKPlus, -kKPlus, +kPiPlus}, {}, {}, {}, {}, {}, {-kPiPlus, +kKPlus, +kPiPlus}, {}, {+kProton, -kKPlus, +kPiPlus}, {+kProton, -kPiPlus, +kPiPlus}, {+kProton, -kKPlus, +kPiPlus}, {}, {}, {}, {}}}; -static constexpr std::array, nChannels> arrPDGFinal4Prong = {{{}, {}, {}, {}, {}, {}, {}, {}, {+kPiPlus, -kKPlus, +kPiPlus, -kPiPlus}, {+kPiPlus, -kKPlus, +kPiPlus, -kPiPlus}, {-kPiPlus, +kKPlus, -kPiPlus, +kPiPlus}, {}, {-kKPlus, +kKPlus, -kPiPlus, +kPiPlus}, {}, {}, {}, {}, {+kPiPlus, -kPiPlus, -kPiPlus, +kProton}, {+kPiPlus, -kKPlus, -kPiPlus, +kProton}, {+kPiPlus, -kPiPlus, -kPiPlus, +kProton}}}; -static constexpr std::array, nChannels> arrPDGFinal5Prong = {{{}, {}, {}, {}, {}, {}, {+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, {+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, {}, {}, {}, {}, {}, {}, {}, {}, {+kPiPlus, +kPiPlus, -kPiPlus, -kPiPlus, +kProton}, {}, {}, {}}}; -static constexpr std::string_view labels[nChannels] = {"D^{0} #rightarrow K#pi", "D*^{+} #rightarrow D^{0}#pi", "D^{+} #rightarrow K#pi#pi", "D^{+} #rightarrow KK#pi", "D_{s}^{+} #rightarrow #Phi#pi #rightarrow KK#pi", - "D_{s}^{+} #rightarrow #bar{K}^{*0}K #rightarrow KK#pi", "D_{s}1 #rightarrow D*^{+}K^{0}_{s}", "D_{s}2* #rightarrow D^{+}K^{0}_{s}", "D1^{0} #rightarrow D*^{+}#pi", - "D2^{*} #rightarrow D^{+}#pi", - "B^{0} #rightarrow D^{-}#pi", "B^{+} #rightarrow D^{0}#pi", "B_{s}^{+} #rightarrow D_{s}^{-}#pi", - "#Lambda_{c}^{+} #rightarrow pK#pi", - "#Lambda_{c}^{+} #rightarrow pK^{0}_{s}", "#Xi_{c}^{+} #rightarrow pK#pi", - "#Xi_{c}^{+} #rightarrow #Xi#pi#pi", "#Xi_{c}^{0} #rightarrow #Xi#pi", "#Omega_{c}^{0} #rightarrow #Omega#pi", "#Omega_{c}^{0} #rightarrow #Xi#pi"}; -static constexpr std::string_view particleNames[nChannels] = {"DzeroToKPi", "DstarToDzeroPi", "DplusToPiKPi", "DplusToPhiPiToKKPi", "DsToPhiPiToKKPi", "DsToK0starKToKKPi", "Ds1ToDStarK0s", "Ds2StarToDPlusK0s", "D10ToDStarPi", "D2Star0ToDPlusPi", "B0ToDminusPi", "BplusToD0Pi", "BsToDsPi", - "LcToPKPi", "LcToPiK0s", "XiCplusToPKPi", "XiCplusToXiPiPi", "XiCzeroToXiPi", "OmegaCToOmegaPi", "OmegaCToXiPi"}; -static constexpr std::string_view originNames[nOriginTypes] = {"Prompt", "NonPrompt"}; +constexpr std::array, NChannels> ArrPdgFinal2Prong = {{{+kPiPlus, -kKPlus}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}}}; +constexpr std::array, NChannels> ArrPdgFinal3Prong = {{{}, {+kPiPlus, -kKPlus, +kPiPlus}, {+kPiPlus, -kKPlus, +kPiPlus}, {+kKPlus, -kKPlus, +kPiPlus}, {+kKPlus, -kKPlus, +kPiPlus}, {+kKPlus, -kKPlus, +kPiPlus}, {}, {}, {}, {}, {}, {-kPiPlus, +kKPlus, +kPiPlus}, {}, {+kProton, -kKPlus, +kPiPlus}, {+kProton, -kPiPlus, +kPiPlus}, {+kProton, -kKPlus, +kPiPlus}, {}, {}, {}, {}}}; +constexpr std::array, NChannels> ArrPdgFinal4Prong = {{{}, {}, {}, {}, {}, {}, {}, {}, {+kPiPlus, -kKPlus, +kPiPlus, -kPiPlus}, {+kPiPlus, -kKPlus, +kPiPlus, -kPiPlus}, {-kPiPlus, +kKPlus, -kPiPlus, +kPiPlus}, {}, {-kKPlus, +kKPlus, -kPiPlus, +kPiPlus}, {}, {}, {}, {}, {+kPiPlus, -kPiPlus, -kPiPlus, +kProton}, {+kPiPlus, -kKPlus, -kPiPlus, +kProton}, {+kPiPlus, -kPiPlus, -kPiPlus, +kProton}}}; +constexpr std::array, NChannels> ArrPdgFinal5Prong = {{{}, {}, {}, {}, {}, {}, {+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, {+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, {}, {}, {}, {}, {}, {}, {}, {}, {+kPiPlus, +kPiPlus, -kPiPlus, -kPiPlus, +kProton}, {}, {}, {}}}; +constexpr std::string_view Labels[NChannels] = {"D^{0} #rightarrow K#pi", "D*^{+} #rightarrow D^{0}#pi", "D^{+} #rightarrow K#pi#pi", "D^{+} #rightarrow KK#pi", "D_{s}^{+} #rightarrow #Phi#pi #rightarrow KK#pi", + "D_{s}^{+} #rightarrow #bar{K}^{*0}K #rightarrow KK#pi", "D_{s}1 #rightarrow D*^{+}K^{0}_{s}", "D_{s}2* #rightarrow D^{+}K^{0}_{s}", "D1^{0} #rightarrow D*^{+}#pi", + "D2^{*} #rightarrow D^{+}#pi", + "B^{0} #rightarrow D^{-}#pi", "B^{+} #rightarrow D^{0}#pi", "B_{s}^{+} #rightarrow D_{s}^{-}#pi", + "#Lambda_{c}^{+} #rightarrow pK#pi", + "#Lambda_{c}^{+} #rightarrow pK^{0}_{s}", "#Xi_{c}^{+} #rightarrow pK#pi", + "#Xi_{c}^{+} #rightarrow #Xi#pi#pi", "#Xi_{c}^{0} #rightarrow #Xi#pi", "#Omega_{c}^{0} #rightarrow #Omega#pi", "#Omega_{c}^{0} #rightarrow #Xi#pi"}; +constexpr std::string_view ParticleNames[NChannels] = {"DzeroToKPi", "DstarToDzeroPi", "DplusToPiKPi", "DplusToPhiPiToKKPi", "DsToPhiPiToKKPi", "DsToK0starKToKKPi", "Ds1ToDStarK0s", "Ds2StarToDPlusK0s", "D10ToDStarPi", "D2Star0ToDPlusPi", "B0ToDminusPi", "BplusToD0Pi", "BsToDsPi", + "LcToPKPi", "LcToPiK0s", "XiCplusToPKPi", "XiCplusToXiPiPi", "XiCzeroToXiPi", "OmegaCToOmegaPi", "OmegaCToXiPi"}; +constexpr std::string_view OriginNames[NOriginTypes] = {"Prompt", "NonPrompt"}; } // namespace /// Generated Level Validation @@ -155,16 +155,16 @@ struct HfTaskMcValidationGen { HfEventSelectionMc hfEvSelMc; // mc event selection and monitoring - AxisSpec axisNhadrons{nChannels, -0.5, static_cast(nChannels) - 0.5}; + AxisSpec axisNhadrons{NChannels, -0.5, static_cast(NChannels) - 0.5}; AxisSpec axisNquarks{20, -0.5, 19.5}; AxisSpec axisResiduals{100, -0.01, 0.01}; AxisSpec axisPt{100, 0., 50.}; AxisSpec axisY{100, -5., 5.}; AxisSpec axisCent{110, 0., 110.}; AxisSpec axisOcc{3000, 0., 15000.}; - AxisSpec axisCharmMesonSpecies{nCharmMesonChannels, -0.5, static_cast(nCharmMesonChannels) - 0.5}; - AxisSpec axisBeautySpecies{nBeautyChannels, -0.5, static_cast(nBeautyChannels) - 0.5}; - AxisSpec axisCharmBaryonSpecies{nCharmBaryonChannels, -0.5, static_cast(nCharmBaryonChannels) - 0.5}; + AxisSpec axisCharmMesonSpecies{NCharmMesonChannels, -0.5, static_cast(NCharmMesonChannels) - 0.5}; + AxisSpec axisBeautySpecies{NBeautyChannels, -0.5, static_cast(NBeautyChannels) - 0.5}; + AxisSpec axisCharmBaryonSpecies{NCharmBaryonChannels, -0.5, static_cast(NCharmBaryonChannels) - 0.5}; AxisSpec axisDecLen{100, 0., 10000.}; HistogramRegistry registry{ @@ -217,57 +217,57 @@ struct HfTaskMcValidationGen { } // add per species histograms - for (size_t iOrigin = 0; iOrigin < nOriginTypes; iOrigin++) { - for (int iChannel = 0; iChannel < nCharmMesonChannels; iChannel++) { // Charm mesons - registry.add(Form("%sCharmMesons/hCount%s%s", originNames[iOrigin].data(), originNames[iOrigin].data(), particleNames[iChannel].data()), - Form("Event counter - %s %s; Events Per Collision; entries", originNames[iOrigin].data(), labels[iChannel].data()), {HistType::kTH1F, {axisNhadrons}}); + for (auto originName : OriginNames) { + for (int iChannel = 0; iChannel < NCharmMesonChannels; iChannel++) { // Charm mesons + registry.add(Form("%sCharmMesons/hCount%s%s", originName.data(), originName.data(), ParticleNames[iChannel].data()), + Form("Event counter - %s %s; Events Per Collision; entries", originName.data(), Labels[iChannel].data()), {HistType::kTH1F, {axisNhadrons}}); } - for (int iChannel = nCharmMesonChannels + nBeautyChannels; iChannel < nChannels; iChannel++) { // Charm baryons - registry.add(Form("%sCharmBaryons/hCount%s%s", originNames[iOrigin].data(), originNames[iOrigin].data(), particleNames[iChannel].data()), - Form("Event counter - %s %s; Events Per Collision; entries", originNames[iOrigin].data(), labels[iChannel].data()), {HistType::kTH1F, {axisNhadrons}}); + for (int iChannel = NCharmMesonChannels + NBeautyChannels; iChannel < NChannels; iChannel++) { // Charm baryons + registry.add(Form("%sCharmBaryons/hCount%s%s", originName.data(), originName.data(), ParticleNames[iChannel].data()), + Form("Event counter - %s %s; Events Per Collision; entries", originName.data(), Labels[iChannel].data()), {HistType::kTH1F, {axisNhadrons}}); } } - for (int iChannel = nCharmMesonChannels; iChannel < nCharmMesonChannels + nBeautyChannels; iChannel++) { // Beauty mesons - registry.add(Form("Beauty/hCount%s", particleNames[iChannel].data()), - Form("Event counter - %s; Events Per Collision; entries", labels[iChannel].data()), {HistType::kTH1F, {axisNhadrons}}); + for (int iChannel = NCharmMesonChannels; iChannel < NCharmMesonChannels + NBeautyChannels; iChannel++) { // Beauty mesons + registry.add(Form("Beauty/hCount%s", ParticleNames[iChannel].data()), + Form("Event counter - %s; Events Per Collision; entries", Labels[iChannel].data()), {HistType::kTH1F, {axisNhadrons}}); } - for (auto iBin = 1; iBin <= nCharmMesonChannels; ++iBin) { - registry.get(HIST("PromptCharmMesons/hPromptMesonsPtDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin - 1].data()); - registry.get(HIST("PromptCharmMesons/hPromptMesonsPtCentDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin - 1].data()); - registry.get(HIST("PromptCharmMesons/hPromptMesonsPtOccDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin - 1].data()); - registry.get(HIST("PromptCharmMesons/hPromptMesonsYDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin - 1].data()); - registry.get(HIST("PromptCharmMesons/hPromptMesonsDecLenDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin - 1].data()); - registry.get(HIST("NonPromptCharmMesons/hNonPromptMesonsPtDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin - 1].data()); - registry.get(HIST("NonPromptCharmMesons/hNonPromptMesonsPtCentDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin - 1].data()); - registry.get(HIST("NonPromptCharmMesons/hNonPromptMesonsPtOccDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin - 1].data()); - registry.get(HIST("NonPromptCharmMesons/hNonPromptMesonsYDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin - 1].data()); - registry.get(HIST("NonPromptCharmMesons/hNonPromptMesonsDecLenDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin - 1].data()); + for (auto iBin = 1; iBin <= NCharmMesonChannels; ++iBin) { + registry.get(HIST("PromptCharmMesons/hPromptMesonsPtDistr"))->GetXaxis()->SetBinLabel(iBin, Labels[iBin - 1].data()); + registry.get(HIST("PromptCharmMesons/hPromptMesonsPtCentDistr"))->GetXaxis()->SetBinLabel(iBin, Labels[iBin - 1].data()); + registry.get(HIST("PromptCharmMesons/hPromptMesonsPtOccDistr"))->GetXaxis()->SetBinLabel(iBin, Labels[iBin - 1].data()); + registry.get(HIST("PromptCharmMesons/hPromptMesonsYDistr"))->GetXaxis()->SetBinLabel(iBin, Labels[iBin - 1].data()); + registry.get(HIST("PromptCharmMesons/hPromptMesonsDecLenDistr"))->GetXaxis()->SetBinLabel(iBin, Labels[iBin - 1].data()); + registry.get(HIST("NonPromptCharmMesons/hNonPromptMesonsPtDistr"))->GetXaxis()->SetBinLabel(iBin, Labels[iBin - 1].data()); + registry.get(HIST("NonPromptCharmMesons/hNonPromptMesonsPtCentDistr"))->GetXaxis()->SetBinLabel(iBin, Labels[iBin - 1].data()); + registry.get(HIST("NonPromptCharmMesons/hNonPromptMesonsPtOccDistr"))->GetXaxis()->SetBinLabel(iBin, Labels[iBin - 1].data()); + registry.get(HIST("NonPromptCharmMesons/hNonPromptMesonsYDistr"))->GetXaxis()->SetBinLabel(iBin, Labels[iBin - 1].data()); + registry.get(HIST("NonPromptCharmMesons/hNonPromptMesonsDecLenDistr"))->GetXaxis()->SetBinLabel(iBin, Labels[iBin - 1].data()); } - for (auto iBin = 1; iBin <= nBeautyChannels; ++iBin) { - registry.get(HIST("Beauty/hPtDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels - 1].data()); - registry.get(HIST("Beauty/hPtCentDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels - 1].data()); - registry.get(HIST("Beauty/hPtOccDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels - 1].data()); - registry.get(HIST("Beauty/hYDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels - 1].data()); - registry.get(HIST("Beauty/hDecLenDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels - 1].data()); + for (auto iBin = 1; iBin <= NBeautyChannels; ++iBin) { + registry.get(HIST("Beauty/hPtDistr"))->GetXaxis()->SetBinLabel(iBin, Labels[iBin + NCharmMesonChannels - 1].data()); + registry.get(HIST("Beauty/hPtCentDistr"))->GetXaxis()->SetBinLabel(iBin, Labels[iBin + NCharmMesonChannels - 1].data()); + registry.get(HIST("Beauty/hPtOccDistr"))->GetXaxis()->SetBinLabel(iBin, Labels[iBin + NCharmMesonChannels - 1].data()); + registry.get(HIST("Beauty/hYDistr"))->GetXaxis()->SetBinLabel(iBin, Labels[iBin + NCharmMesonChannels - 1].data()); + registry.get(HIST("Beauty/hDecLenDistr"))->GetXaxis()->SetBinLabel(iBin, Labels[iBin + NCharmMesonChannels - 1].data()); } - for (auto iBin = 1; iBin <= nCharmBaryonChannels; ++iBin) { - registry.get(HIST("PromptCharmBaryons/hPromptBaryonsPtDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels + nBeautyChannels - 1].data()); - registry.get(HIST("PromptCharmBaryons/hPromptBaryonsPtCentDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels + nBeautyChannels - 1].data()); - registry.get(HIST("PromptCharmBaryons/hPromptBaryonsPtOccDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels + nBeautyChannels - 1].data()); - registry.get(HIST("PromptCharmBaryons/hPromptBaryonsYDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels + nBeautyChannels - 1].data()); - registry.get(HIST("PromptCharmBaryons/hPromptBaryonsDecLenDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels + nBeautyChannels - 1].data()); - registry.get(HIST("NonPromptCharmBaryons/hNonPromptBaryonsPtDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels + nBeautyChannels - 1].data()); - registry.get(HIST("NonPromptCharmBaryons/hNonPromptBaryonsPtCentDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels + nBeautyChannels - 1].data()); - registry.get(HIST("NonPromptCharmBaryons/hNonPromptBaryonsPtOccDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels + nBeautyChannels - 1].data()); - registry.get(HIST("NonPromptCharmBaryons/hNonPromptBaryonsYDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels + nBeautyChannels - 1].data()); - registry.get(HIST("NonPromptCharmBaryons/hNonPromptBaryonsDecLenDistr"))->GetXaxis()->SetBinLabel(iBin, labels[iBin + nCharmMesonChannels + nBeautyChannels - 1].data()); + for (auto iBin = 1; iBin <= NCharmBaryonChannels; ++iBin) { + registry.get(HIST("PromptCharmBaryons/hPromptBaryonsPtDistr"))->GetXaxis()->SetBinLabel(iBin, Labels[iBin + NCharmMesonChannels + NBeautyChannels - 1].data()); + registry.get(HIST("PromptCharmBaryons/hPromptBaryonsPtCentDistr"))->GetXaxis()->SetBinLabel(iBin, Labels[iBin + NCharmMesonChannels + NBeautyChannels - 1].data()); + registry.get(HIST("PromptCharmBaryons/hPromptBaryonsPtOccDistr"))->GetXaxis()->SetBinLabel(iBin, Labels[iBin + NCharmMesonChannels + NBeautyChannels - 1].data()); + registry.get(HIST("PromptCharmBaryons/hPromptBaryonsYDistr"))->GetXaxis()->SetBinLabel(iBin, Labels[iBin + NCharmMesonChannels + NBeautyChannels - 1].data()); + registry.get(HIST("PromptCharmBaryons/hPromptBaryonsDecLenDistr"))->GetXaxis()->SetBinLabel(iBin, Labels[iBin + NCharmMesonChannels + NBeautyChannels - 1].data()); + registry.get(HIST("NonPromptCharmBaryons/hNonPromptBaryonsPtDistr"))->GetXaxis()->SetBinLabel(iBin, Labels[iBin + NCharmMesonChannels + NBeautyChannels - 1].data()); + registry.get(HIST("NonPromptCharmBaryons/hNonPromptBaryonsPtCentDistr"))->GetXaxis()->SetBinLabel(iBin, Labels[iBin + NCharmMesonChannels + NBeautyChannels - 1].data()); + registry.get(HIST("NonPromptCharmBaryons/hNonPromptBaryonsPtOccDistr"))->GetXaxis()->SetBinLabel(iBin, Labels[iBin + NCharmMesonChannels + NBeautyChannels - 1].data()); + registry.get(HIST("NonPromptCharmBaryons/hNonPromptBaryonsYDistr"))->GetXaxis()->SetBinLabel(iBin, Labels[iBin + NCharmMesonChannels + NBeautyChannels - 1].data()); + registry.get(HIST("NonPromptCharmBaryons/hNonPromptBaryonsDecLenDistr"))->GetXaxis()->SetBinLabel(iBin, Labels[iBin + NCharmMesonChannels + NBeautyChannels - 1].data()); } // inspect for which particle species the candidates were created and which zPvPosMax cut was set for reconstructed const auto& workflows = initContext.services().get(); for (const DeviceSpec& device : workflows.devices) { - if (device.name.compare("hf-task-mc-validation-rec") == 0) { + if (device.name == "hf-task-mc-validation-rec") { hfEvSelMc.configureFromDevice(device); break; } @@ -276,8 +276,8 @@ struct HfTaskMcValidationGen { hfEvSelMc.addHistograms(registry); // particles monitoring } - template - void runCheckGenParticles(GenColl const& mcCollision, Particles const& mcParticles, RecoColls const& recoCollisions, BCsInfo const&, std::array& counterPrompt, std::array& counterNonPrompt) + template + void runCheckGenParticles(GenColl const& mcCollision, Particles const& mcParticles, RecoColls const& recoCollisions, BCsInfo const&, std::array& counterPrompt, std::array& counterNonPrompt) { if (eventGeneratorType >= 0 && mcCollision.getSubGeneratorId() != eventGeneratorType) { return; @@ -291,14 +291,10 @@ struct HfTaskMcValidationGen { occupancy = o2::hf_occupancy::getOccupancyGenColl(recoCollisions, OccupancyEstimator::Its); } o2::hf_evsel::HfCollisionRejectionMask rejectionMask{}; - if constexpr (centEstimator == CentralityEstimator::FT0C) { - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, recoCollisions, centrality); - } else if constexpr (centEstimator == CentralityEstimator::FT0M) { - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, recoCollisions, centrality); - } else if constexpr (centEstimator == CentralityEstimator::None) { - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, recoCollisions, centrality); + if constexpr (CentEstimator == CentralityEstimator::FT0C || CentEstimator == CentralityEstimator::FT0M || CentEstimator == CentralityEstimator::None) { + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, recoCollisions, centrality); } - hfEvSelMc.fillHistograms(mcCollision, rejectionMask); + hfEvSelMc.fillHistograms(mcCollision, rejectionMask); if (rejectionMask != 0) { return; } @@ -318,7 +314,7 @@ struct HfTaskMcValidationGen { continue; } - int particlePdgCode = particle.pdgCode(); + int const particlePdgCode = particle.pdgCode(); bool isDiffFromMothers = true; for (const auto& mother : particle.template mothers_as()) { if (particlePdgCode == mother.pdgCode()) { @@ -356,14 +352,14 @@ struct HfTaskMcValidationGen { std::vector listDaughters{}; // Check that the decay channel is correct and retrieve the daughters - if (nDaughters[iD] == 2) { - if (!RecoDecay::isMatchedMCGen(mcParticles, particle, PDGArrayParticle[iD], arrPDGFinal2Prong[iD], true, nullptr, maxDepthForSearch[iD], &listDaughters)) { + if (NDaughters[iD] == 2) { + if (!RecoDecay::isMatchedMCGen(mcParticles, particle, PDGArrayParticle[iD], ArrPdgFinal2Prong[iD], true, nullptr, MaxDepthForSearch[iD], &listDaughters)) { continue; } } - if (nDaughters[iD] == 3) { - if (!RecoDecay::isMatchedMCGen(mcParticles, particle, PDGArrayParticle[iD], arrPDGFinal3Prong[iD], true, nullptr, maxDepthForSearch[iD], &listDaughters)) { + if (NDaughters[iD] == 3) { + if (!RecoDecay::isMatchedMCGen(mcParticles, particle, PDGArrayParticle[iD], ArrPdgFinal3Prong[iD], true, nullptr, MaxDepthForSearch[iD], &listDaughters)) { continue; } if (iD == DstarToDzeroPi && @@ -390,13 +386,13 @@ struct HfTaskMcValidationGen { } } - if (nDaughters[iD] == 4) { + if (NDaughters[iD] == 4) { if (iD != B0ToDminusPi) { - if (!RecoDecay::isMatchedMCGen(mcParticles, particle, PDGArrayParticle[iD], arrPDGFinal4Prong[iD], true, nullptr, maxDepthForSearch[iD], &listDaughters)) { + if (!RecoDecay::isMatchedMCGen(mcParticles, particle, PDGArrayParticle[iD], ArrPdgFinal4Prong[iD], true, nullptr, MaxDepthForSearch[iD], &listDaughters)) { continue; } } else { // For B0 we consider flavour oscillations - if (!RecoDecay::isMatchedMCGen(mcParticles, particle, PDGArrayParticle[iD], arrPDGFinal4Prong[iD], true, nullptr, maxDepthForSearch[iD], &listDaughters)) { + if (!RecoDecay::isMatchedMCGen(mcParticles, particle, PDGArrayParticle[iD], ArrPdgFinal4Prong[iD], true, nullptr, MaxDepthForSearch[iD], &listDaughters)) { continue; } } @@ -426,8 +422,8 @@ struct HfTaskMcValidationGen { } } - if (nDaughters[iD] == 5) { - if (!RecoDecay::isMatchedMCGen(mcParticles, particle, PDGArrayParticle[iD], arrPDGFinal5Prong[iD], true, nullptr, maxDepthForSearch[iD], &listDaughters)) { + if (NDaughters[iD] == 5) { + if (!RecoDecay::isMatchedMCGen(mcParticles, particle, PDGArrayParticle[iD], ArrPdgFinal5Prong[iD], true, nullptr, MaxDepthForSearch[iD], &listDaughters)) { continue; } if (iD == Ds1ToDStarK0s && @@ -451,8 +447,8 @@ struct HfTaskMcValidationGen { double sumPyDau = 0.; double sumPzDau = 0.; bool momentumCheck = true; - for (std::size_t iDau = 0; iDau < listDaughters.size(); ++iDau) { - auto daughter = mcParticles.rawIteratorAt(listDaughters.at(iDau) - mcParticles.offset()); + for (const int listDaughter : listDaughters) { + auto daughter = mcParticles.rawIteratorAt(listDaughter - mcParticles.offset()); sumPxDau += daughter.px(); sumPyDau += daughter.py(); sumPzDau += daughter.pz(); @@ -463,8 +459,8 @@ struct HfTaskMcValidationGen { if (std::abs(pxDiff) > 0.001 || std::abs(pyDiff) > 0.001 || std::abs(pzDiff) > 0.001) { momentumCheck = false; } - double pDiff = RecoDecay::p(pxDiff, pyDiff, pzDiff); - double ptDiff = RecoDecay::pt(pxDiff, pyDiff); + double const pDiff = RecoDecay::p(pxDiff, pyDiff, pzDiff); + double const ptDiff = RecoDecay::pt(pxDiff, pyDiff); registry.fill(HIST("hMomentumCheck"), static_cast(momentumCheck)); registry.fill(HIST("hPxDiffMotherDaughterGen"), pxDiff); registry.fill(HIST("hPyDiffMotherDaughterGen"), pyDiff); @@ -473,7 +469,7 @@ struct HfTaskMcValidationGen { registry.fill(HIST("hPtDiffMotherDaughterGen"), ptDiff); int origin{0}; - if (iD < nCharmMesonChannels || iD >= nCharmMesonChannels + nBeautyChannels) { // Charm hadrons + if (iD < NCharmMesonChannels || iD >= NCharmMesonChannels + NBeautyChannels) { // Charm hadrons origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle); if (origin == RecoDecay::OriginType::Prompt) { counterPrompt[iD]++; @@ -483,10 +479,10 @@ struct HfTaskMcValidationGen { } auto daughter0 = particle.template daughters_as().begin(); - double vertexDau[3] = {daughter0.vx(), daughter0.vy(), daughter0.vz()}; - double vertexPrimary[3] = {mcCollision.posX(), mcCollision.posY(), mcCollision.posZ()}; + double const vertexDau[3] = {daughter0.vx(), daughter0.vy(), daughter0.vz()}; + double const vertexPrimary[3] = {mcCollision.posX(), mcCollision.posY(), mcCollision.posZ()}; auto decayLength = RecoDecay::distance(vertexPrimary, vertexDau); - if (iD < nCharmMesonChannels) { + if (iD < NCharmMesonChannels) { if (origin == RecoDecay::OriginType::Prompt) { // Prompt charm mesons if (std::abs(particle.y()) < 0.5) { registry.fill(HIST("PromptCharmMesons/hPromptMesonsPtDistr"), iD, particle.pt()); @@ -508,34 +504,34 @@ struct HfTaskMcValidationGen { registry.fill(HIST("NonPromptCharmMesons/hNonPromptMesonsYDistr"), iD, particle.y()); registry.fill(HIST("NonPromptCharmMesons/hNonPromptMesonsDecLenDistr"), iD, decayLength * 10000); } - } else if (iD < nCharmMesonChannels + nBeautyChannels) { // Beauty mesons + } else if (iD < NCharmMesonChannels + NBeautyChannels) { // Beauty mesons if (std::abs(particle.y()) < 0.5) { - registry.fill(HIST("Beauty/hPtDistr"), iD - nCharmMesonChannels, particle.pt()); - registry.fill(HIST("Beauty/hPtCentDistr"), iD - nCharmMesonChannels, particle.pt(), centrality); + registry.fill(HIST("Beauty/hPtDistr"), iD - NCharmMesonChannels, particle.pt()); + registry.fill(HIST("Beauty/hPtCentDistr"), iD - NCharmMesonChannels, particle.pt(), centrality); } - registry.fill(HIST("Beauty/hYDistr"), iD - nCharmMesonChannels, particle.y()); - registry.fill(HIST("Beauty/hDecLenDistr"), iD - nCharmMesonChannels, decayLength * 10000); + registry.fill(HIST("Beauty/hYDistr"), iD - NCharmMesonChannels, particle.y()); + registry.fill(HIST("Beauty/hDecLenDistr"), iD - NCharmMesonChannels, decayLength * 10000); } else { // Charm baryons if (origin == RecoDecay::OriginType::Prompt) { if (std::abs(particle.y()) < 0.5) { - registry.fill(HIST("PromptCharmBaryons/hPromptBaryonsPtDistr"), iD - nCharmMesonChannels - nBeautyChannels, particle.pt()); - registry.fill(HIST("PromptCharmBaryons/hPromptBaryonsPtCentDistr"), iD - nCharmMesonChannels - nBeautyChannels, particle.pt(), centrality); + registry.fill(HIST("PromptCharmBaryons/hPromptBaryonsPtDistr"), iD - NCharmMesonChannels - NBeautyChannels, particle.pt()); + registry.fill(HIST("PromptCharmBaryons/hPromptBaryonsPtCentDistr"), iD - NCharmMesonChannels - NBeautyChannels, particle.pt(), centrality); if (storeOccupancy) { - registry.fill(HIST("PromptCharmBaryons/hPromptBaryonsPtOccDistr"), iD - nCharmMesonChannels - nBeautyChannels, particle.pt(), occupancy); + registry.fill(HIST("PromptCharmBaryons/hPromptBaryonsPtOccDistr"), iD - NCharmMesonChannels - NBeautyChannels, particle.pt(), occupancy); } } - registry.fill(HIST("PromptCharmBaryons/hPromptBaryonsYDistr"), iD - nCharmMesonChannels - nBeautyChannels, particle.y()); - registry.fill(HIST("PromptCharmBaryons/hPromptBaryonsDecLenDistr"), iD - nCharmMesonChannels - nBeautyChannels, decayLength * 10000); + registry.fill(HIST("PromptCharmBaryons/hPromptBaryonsYDistr"), iD - NCharmMesonChannels - NBeautyChannels, particle.y()); + registry.fill(HIST("PromptCharmBaryons/hPromptBaryonsDecLenDistr"), iD - NCharmMesonChannels - NBeautyChannels, decayLength * 10000); } else if (origin == RecoDecay::OriginType::NonPrompt) { if (std::abs(particle.y()) < 0.5) { - registry.fill(HIST("NonPromptCharmBaryons/hNonPromptBaryonsPtDistr"), iD - nCharmMesonChannels - nBeautyChannels, particle.pt()); - registry.fill(HIST("NonPromptCharmBaryons/hNonPromptBaryonsPtCentDistr"), iD - nCharmMesonChannels - nBeautyChannels, particle.pt(), centrality); + registry.fill(HIST("NonPromptCharmBaryons/hNonPromptBaryonsPtDistr"), iD - NCharmMesonChannels - NBeautyChannels, particle.pt()); + registry.fill(HIST("NonPromptCharmBaryons/hNonPromptBaryonsPtCentDistr"), iD - NCharmMesonChannels - NBeautyChannels, particle.pt(), centrality); if (storeOccupancy) { - registry.fill(HIST("NonPromptCharmBaryons/hNonPromptBaryonsPtOccDistr"), iD - nCharmMesonChannels - nBeautyChannels, particle.pt(), occupancy); + registry.fill(HIST("NonPromptCharmBaryons/hNonPromptBaryonsPtOccDistr"), iD - NCharmMesonChannels - NBeautyChannels, particle.pt(), occupancy); } } - registry.fill(HIST("NonPromptCharmBaryons/hNonPromptBaryonsYDistr"), iD - nCharmMesonChannels - nBeautyChannels, particle.y()); - registry.fill(HIST("NonPromptCharmBaryons/hNonPromptBaryonsDecLenDistr"), iD - nCharmMesonChannels - nBeautyChannels, decayLength * 10000); + registry.fill(HIST("NonPromptCharmBaryons/hNonPromptBaryonsYDistr"), iD - NCharmMesonChannels - NBeautyChannels, particle.y()); + registry.fill(HIST("NonPromptCharmBaryons/hNonPromptBaryonsDecLenDistr"), iD - NCharmMesonChannels - NBeautyChannels, decayLength * 10000); } } } @@ -555,21 +551,21 @@ struct HfTaskMcValidationGen { for (const auto& mcCollision : mcCollisions) { const auto recoCollsPerMcColl = recoCollisions.sliceBy(colPerMcCollision, mcCollision.globalIndex()); const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex()); - std::array counterPrompt{0}, counterNonPrompt{0}; + std::array counterPrompt{0}, counterNonPrompt{0}; runCheckGenParticles(mcCollision, mcParticlesPerMcColl, recoCollsPerMcColl, bcInfo, counterPrompt, counterNonPrompt); - static_for<0, nCharmMesonChannels - 1>([&](auto i) { // Charm mesons - constexpr int index = i.value; - registry.fill(HIST("PromptCharmMesons/hCountPrompt") + HIST(particleNames[index]), counterPrompt[index]); - registry.fill(HIST("NonPromptCharmMesons/hCountNonPrompt") + HIST(particleNames[index]), counterNonPrompt[index]); + static_for<0, NCharmMesonChannels - 1>([&](auto i) { // Charm mesons + constexpr int Index = i.value; + registry.fill(HIST("PromptCharmMesons/hCountPrompt") + HIST(ParticleNames[Index]), counterPrompt[Index]); + registry.fill(HIST("NonPromptCharmMesons/hCountNonPrompt") + HIST(ParticleNames[Index]), counterNonPrompt[Index]); }); - static_for([&](auto i) { // Beauty hadrons - constexpr int index = i.value; - registry.fill(HIST("Beauty/hCount") + HIST(particleNames[index]), counterPrompt[index]); + static_for([&](auto i) { // Beauty hadrons + constexpr int Index = i.value; + registry.fill(HIST("Beauty/hCount") + HIST(ParticleNames[Index]), counterPrompt[Index]); }); - static_for([&](auto i) { // Charm baryons - constexpr int index = i.value; - registry.fill(HIST("PromptCharmBaryons/hCountPrompt") + HIST(particleNames[index]), counterPrompt[index]); - registry.fill(HIST("NonPromptCharmBaryons/hCountNonPrompt") + HIST(particleNames[index]), counterNonPrompt[index]); + static_for([&](auto i) { // Charm baryons + constexpr int Index = i.value; + registry.fill(HIST("PromptCharmBaryons/hCountPrompt") + HIST(ParticleNames[Index]), counterPrompt[Index]); + registry.fill(HIST("NonPromptCharmBaryons/hCountNonPrompt") + HIST(ParticleNames[Index]), counterNonPrompt[Index]); }); } } // end processNoCentSel @@ -583,21 +579,21 @@ struct HfTaskMcValidationGen { for (const auto& mcCollision : mcCollisions) { const auto recoCollsPerMcColl = recoCollisions.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex()); const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex()); - std::array counterPrompt{0}, counterNonPrompt{0}; + std::array counterPrompt{0}, counterNonPrompt{0}; runCheckGenParticles(mcCollision, mcParticlesPerMcColl, recoCollsPerMcColl, bcInfo, counterPrompt, counterNonPrompt); - static_for<0, nCharmMesonChannels - 1>([&](auto i) { // Charm mesons - constexpr int index = i.value; - registry.fill(HIST("PromptCharmMesons/hCountPrompt") + HIST(particleNames[index]), counterPrompt[index]); - registry.fill(HIST("NonPromptCharmMesons/hCountNonPrompt") + HIST(particleNames[index]), counterNonPrompt[index]); + static_for<0, NCharmMesonChannels - 1>([&](auto i) { // Charm mesons + constexpr int Index = i.value; + registry.fill(HIST("PromptCharmMesons/hCountPrompt") + HIST(ParticleNames[Index]), counterPrompt[Index]); + registry.fill(HIST("NonPromptCharmMesons/hCountNonPrompt") + HIST(ParticleNames[Index]), counterNonPrompt[Index]); }); - static_for([&](auto i) { // Beauty - constexpr int index = i.value; - registry.fill(HIST("Beauty/hCount") + HIST(particleNames[index]), counterPrompt[index]); + static_for([&](auto i) { // Beauty + constexpr int Index = i.value; + registry.fill(HIST("Beauty/hCount") + HIST(ParticleNames[Index]), counterPrompt[Index]); }); - static_for([&](auto i) { // Charm baryons - constexpr int index = i.value; - registry.fill(HIST("PromptCharmBaryons/hCountPrompt") + HIST(particleNames[index]), counterPrompt[index]); - registry.fill(HIST("NonPromptCharmBaryons/hCountNonPrompt") + HIST(particleNames[index]), counterNonPrompt[index]); + static_for([&](auto i) { // Charm baryons + constexpr int Index = i.value; + registry.fill(HIST("PromptCharmBaryons/hCountPrompt") + HIST(ParticleNames[Index]), counterPrompt[Index]); + registry.fill(HIST("NonPromptCharmBaryons/hCountNonPrompt") + HIST(ParticleNames[Index]), counterNonPrompt[Index]); }); } } // end processCentFT0C @@ -611,21 +607,21 @@ struct HfTaskMcValidationGen { for (const auto& mcCollision : mcCollisions) { const auto recoCollsPerMcColl = recoCollisions.sliceBy(colPerMcCollisionFT0M, mcCollision.globalIndex()); const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex()); - std::array counterPrompt{0}, counterNonPrompt{0}; + std::array counterPrompt{0}, counterNonPrompt{0}; runCheckGenParticles(mcCollision, mcParticlesPerMcColl, recoCollsPerMcColl, bcInfo, counterPrompt, counterNonPrompt); - static_for<0, nCharmMesonChannels - 1>([&](auto i) { // Charm mesons - constexpr int index = i.value; - registry.fill(HIST("PromptCharmMesons/hCountPrompt") + HIST(particleNames[index]), counterPrompt[index]); - registry.fill(HIST("NonPromptCharmMesons/hCountNonPrompt") + HIST(particleNames[index]), counterNonPrompt[index]); + static_for<0, NCharmMesonChannels - 1>([&](auto i) { // Charm mesons + constexpr int Index = i.value; + registry.fill(HIST("PromptCharmMesons/hCountPrompt") + HIST(ParticleNames[Index]), counterPrompt[Index]); + registry.fill(HIST("NonPromptCharmMesons/hCountNonPrompt") + HIST(ParticleNames[Index]), counterNonPrompt[Index]); }); - static_for([&](auto i) { // Beauty mesons - constexpr int index = i.value; - registry.fill(HIST("Beauty/hCount") + HIST(particleNames[index]), counterPrompt[index]); + static_for([&](auto i) { // Beauty mesons + constexpr int Index = i.value; + registry.fill(HIST("Beauty/hCount") + HIST(ParticleNames[Index]), counterPrompt[Index]); }); - static_for([&](auto i) { // Charm baryons - constexpr int index = i.value; - registry.fill(HIST("PromptCharmBaryons/hCountPrompt") + HIST(particleNames[index]), counterPrompt[index]); - registry.fill(HIST("NonPromptCharmBaryons/hCountNonPrompt") + HIST(particleNames[index]), counterNonPrompt[index]); + static_for([&](auto i) { // Charm baryons + constexpr int Index = i.value; + registry.fill(HIST("PromptCharmBaryons/hCountPrompt") + HIST(ParticleNames[Index]), counterPrompt[Index]); + registry.fill(HIST("NonPromptCharmBaryons/hCountNonPrompt") + HIST(ParticleNames[Index]), counterNonPrompt[Index]); }); } } // end processCentFT0M @@ -643,10 +639,10 @@ struct HfTaskMcValidationRec { Configurable eventGeneratorType{"eventGeneratorType", -1, "If positive, enable event selection using subGeneratorId information. The value indicates which events to keep (0 = MB, 4 = charm triggered, 5 = beauty triggered)"}; Configurable storeOccupancy{"storeOccupancy", false, "Store collision occupancy for dedicated studies"}; - std::array, nChannels> histDeltaPt, histDeltaPx, histDeltaPy, histDeltaPz, histDeltaSecondaryVertexX, histDeltaSecondaryVertexY, histDeltaSecondaryVertexZ, histDeltaDecayLength; - std::array, 2>, nChannels> histPtCentReco; - std::array, 2>, nChannels> histPtOccReco; - std::array, 5>, 2>, nChannels> histPtDau, histEtaDau, histImpactParameterDau; + std::array, NChannels> histDeltaPt, histDeltaPx, histDeltaPy, histDeltaPz, histDeltaSecondaryVertexX, histDeltaSecondaryVertexY, histDeltaSecondaryVertexZ, histDeltaDecayLength; + std::array, 2>, NChannels> histPtCentReco; + std::array, 2>, NChannels> histPtOccReco; + std::array, 5>, 2>, NChannels> histPtDau, histEtaDau, histImpactParameterDau; std::array, 4> histOriginTracks; std::shared_ptr histAmbiguousTracks, histTracks; std::shared_ptr histContributors; @@ -707,8 +703,8 @@ struct HfTaskMcValidationRec { std::vector diff(vec.size()); std::transform(vec.begin(), vec.end(), diff.begin(), [mean](T x) { return x - mean; }); - T sq_sum = std::inner_product(diff.begin(), diff.end(), diff.begin(), 0.0); - T stdev = std::sqrt(sq_sum / vec.size()); + T sqSum = std::inner_product(diff.begin(), diff.end(), diff.begin(), 0.0); + T stdev = std::sqrt(sqSum / vec.size()); return stdev; } @@ -729,20 +725,20 @@ struct HfTaskMcValidationRec { histDeltaPz[whichHad]->Fill(candidate.pz() - mother.pz()); // Compare Secondary vertex and decay length with MC auto daughter0 = mother.template daughters_as().begin(); - double vertexDau[3] = {daughter0.vx(), daughter0.vy(), daughter0.vz()}; - double vertexMoth[3] = {mother.vx(), mother.vy(), mother.vz()}; + double const vertexDau[3] = {daughter0.vx(), daughter0.vy(), daughter0.vz()}; + double const vertexMoth[3] = {mother.vx(), mother.vy(), mother.vz()}; auto decayLength = RecoDecay::distance(vertexMoth, vertexDau); histDeltaSecondaryVertexX[whichHad]->Fill(candidate.xSecondaryVertex() - vertexDau[0]); histDeltaSecondaryVertexY[whichHad]->Fill(candidate.ySecondaryVertex() - vertexDau[1]); histDeltaSecondaryVertexZ[whichHad]->Fill(candidate.zSecondaryVertex() - vertexDau[2]); histDeltaDecayLength[whichHad]->Fill(candidate.decayLength() - decayLength); - std::array momDau0 = {candidate.pxProng0(), - candidate.pyProng0(), - candidate.pzProng0()}; - std::array momDau1 = {candidate.pxProng1(), - candidate.pyProng1(), - candidate.pzProng1()}; + std::array const momDau0 = {candidate.pxProng0(), + candidate.pyProng0(), + candidate.pzProng0()}; + std::array const momDau1 = {candidate.pxProng1(), + candidate.pyProng1(), + candidate.pzProng1()}; histPtCentReco[whichHad][whichOrigin]->Fill(candidate.pt(), centrality); if (storeOccupancy) { histPtOccReco[whichHad][whichOrigin]->Fill(candidate.pt(), occupancy); @@ -787,45 +783,45 @@ struct HfTaskMcValidationRec { histAmbiguousTracks->GetXaxis()->SetBinLabel(2, "no quark"); histAmbiguousTracks->GetXaxis()->SetBinLabel(3, "charm"); histAmbiguousTracks->GetXaxis()->SetBinLabel(4, "beauty"); - for (auto iHad = 0; iHad < nChannels; ++iHad) { - if (iHad < nCharmMesonChannels) { - histDeltaPt[iHad] = registryMesons.add(Form("%s/histDeltaPt", particleNames[iHad].data()), Form("Pt difference reco - MC %s; #it{p}_{T}^{reco} - #it{p}_{T}^{gen} (GeV/#it{c}); entries", labels[iHad].data()), HistType::kTH1F, {axisDeltaMom}); - histDeltaPx[iHad] = registryMesons.add(Form("%s/histDeltaPx", particleNames[iHad].data()), Form("Px difference reco - MC %s; #it{p}_{x}^{reco} - #it{p}_{x}^{gen} (GeV/#it{c}); entries", labels[iHad].data()), HistType::kTH1F, {axisDeltaMom}); - histDeltaPy[iHad] = registryMesons.add(Form("%s/histDeltaPy", particleNames[iHad].data()), Form("Py difference reco - MC %s; #it{p}_{y}^{reco} - #it{p}_{y}^{gen} (GeV/#it{c}); entries", labels[iHad].data()), HistType::kTH1F, {axisDeltaMom}); - histDeltaPz[iHad] = registryMesons.add(Form("%s/histDeltaPz", particleNames[iHad].data()), Form("Pz difference reco - MC %s; #it{p}_{z}^{reco} - #it{p}_{z}^{gen} (GeV/#it{c}); entries", labels[iHad].data()), HistType::kTH1F, {axisDeltaMom}); - histDeltaSecondaryVertexX[iHad] = registryMesons.add(Form("%s/histDeltaSecondaryVertexX", particleNames[iHad].data()), Form("Sec. Vertex difference reco - MC (MC matched) - %s; #Delta x (cm); entries", labels[iHad].data()), HistType::kTH1F, {axisDeltaVtx}); - histDeltaSecondaryVertexY[iHad] = registryMesons.add(Form("%s/histDeltaSecondaryVertexY", particleNames[iHad].data()), Form("Sec. Vertex difference reco - MC (MC matched) - %s; #Delta y (cm); entries", labels[iHad].data()), HistType::kTH1F, {axisDeltaVtx}); - histDeltaSecondaryVertexZ[iHad] = registryMesons.add(Form("%s/histDeltaSecondaryVertexZ", particleNames[iHad].data()), Form("Sec. Vertex difference reco - MC (MC matched) - %s; #Delta z (cm); entries", labels[iHad].data()), HistType::kTH1F, {axisDeltaVtx}); - histDeltaDecayLength[iHad] = registryMesons.add(Form("%s/histDeltaDecayLength", particleNames[iHad].data()), Form("Decay length difference reco - MC (%s); #Delta L (cm); entries", labels[iHad].data()), HistType::kTH1F, {axisDeltaVtx}); + for (auto iHad = 0; iHad < NChannels; ++iHad) { + if (iHad < NCharmMesonChannels) { + histDeltaPt[iHad] = registryMesons.add(Form("%s/histDeltaPt", ParticleNames[iHad].data()), Form("Pt difference reco - MC %s; #it{p}_{T}^{reco} - #it{p}_{T}^{gen} (GeV/#it{c}); entries", Labels[iHad].data()), HistType::kTH1F, {axisDeltaMom}); + histDeltaPx[iHad] = registryMesons.add(Form("%s/histDeltaPx", ParticleNames[iHad].data()), Form("Px difference reco - MC %s; #it{p}_{x}^{reco} - #it{p}_{x}^{gen} (GeV/#it{c}); entries", Labels[iHad].data()), HistType::kTH1F, {axisDeltaMom}); + histDeltaPy[iHad] = registryMesons.add(Form("%s/histDeltaPy", ParticleNames[iHad].data()), Form("Py difference reco - MC %s; #it{p}_{y}^{reco} - #it{p}_{y}^{gen} (GeV/#it{c}); entries", Labels[iHad].data()), HistType::kTH1F, {axisDeltaMom}); + histDeltaPz[iHad] = registryMesons.add(Form("%s/histDeltaPz", ParticleNames[iHad].data()), Form("Pz difference reco - MC %s; #it{p}_{z}^{reco} - #it{p}_{z}^{gen} (GeV/#it{c}); entries", Labels[iHad].data()), HistType::kTH1F, {axisDeltaMom}); + histDeltaSecondaryVertexX[iHad] = registryMesons.add(Form("%s/histDeltaSecondaryVertexX", ParticleNames[iHad].data()), Form("Sec. Vertex difference reco - MC (MC matched) - %s; #Delta x (cm); entries", Labels[iHad].data()), HistType::kTH1F, {axisDeltaVtx}); + histDeltaSecondaryVertexY[iHad] = registryMesons.add(Form("%s/histDeltaSecondaryVertexY", ParticleNames[iHad].data()), Form("Sec. Vertex difference reco - MC (MC matched) - %s; #Delta y (cm); entries", Labels[iHad].data()), HistType::kTH1F, {axisDeltaVtx}); + histDeltaSecondaryVertexZ[iHad] = registryMesons.add(Form("%s/histDeltaSecondaryVertexZ", ParticleNames[iHad].data()), Form("Sec. Vertex difference reco - MC (MC matched) - %s; #Delta z (cm); entries", Labels[iHad].data()), HistType::kTH1F, {axisDeltaVtx}); + histDeltaDecayLength[iHad] = registryMesons.add(Form("%s/histDeltaDecayLength", ParticleNames[iHad].data()), Form("Decay length difference reco - MC (%s); #Delta L (cm); entries", Labels[iHad].data()), HistType::kTH1F, {axisDeltaVtx}); for (auto iOrigin = 0; iOrigin < 2; ++iOrigin) { - histPtCentReco[iHad][iOrigin] = registryMesons.add(Form("%s/histPtCentReco%s", particleNames[iHad].data(), originNames[iOrigin].data()), Form("Pt Cent reco %s %s; #it{p}_{T}^{reco} (GeV/#it{c}); Centrality (%%); entries", originNames[iOrigin].data(), labels[iHad].data()), HistType::kTH2F, {axisPtD, axisCent}); + histPtCentReco[iHad][iOrigin] = registryMesons.add(Form("%s/histPtCentReco%s", ParticleNames[iHad].data(), OriginNames[iOrigin].data()), Form("Pt Cent reco %s %s; #it{p}_{T}^{reco} (GeV/#it{c}); Centrality (%%); entries", OriginNames[iOrigin].data(), Labels[iHad].data()), HistType::kTH2F, {axisPtD, axisCent}); if (storeOccupancy) { - histPtOccReco[iHad][iOrigin] = registryMesons.add(Form("%s/histPtOccReco%s", particleNames[iHad].data(), originNames[iOrigin].data()), Form("Pt Cent reco %s %s; #it{p}_{T}^{reco} (GeV/#it{c}); Occupancy; entries", originNames[iOrigin].data(), labels[iHad].data()), HistType::kTH2F, {axisPtD, axisOcc}); + histPtOccReco[iHad][iOrigin] = registryMesons.add(Form("%s/histPtOccReco%s", ParticleNames[iHad].data(), OriginNames[iOrigin].data()), Form("Pt Cent reco %s %s; #it{p}_{T}^{reco} (GeV/#it{c}); Occupancy; entries", OriginNames[iOrigin].data(), Labels[iHad].data()), HistType::kTH2F, {axisPtD, axisOcc}); } - for (unsigned int iDau = 0; iDau < nDaughters[iHad]; ++iDau) { - histPtDau[iHad][iOrigin][iDau] = registryMesons.add(Form("%s/histPtDau%d%s", particleNames[iHad].data(), iDau, originNames[iOrigin].data()), Form("Daughter %d Pt reco - %s %s; #it{p}_{T}^{dau, reco} (GeV/#it{c}); entries", iDau, originNames[iOrigin].data(), labels[iHad].data()), HistType::kTH1F, {axisPt}); - histEtaDau[iHad][iOrigin][iDau] = registryMesons.add(Form("%s/histEtaDau%d%s", particleNames[iHad].data(), iDau, originNames[iOrigin].data()), Form("Daughter %d Eta reco - %s %s; #it{#eta}^{dau, reco}; entries", iDau, originNames[iOrigin].data(), labels[iHad].data()), HistType::kTH1F, {{100, -1., 1.}}); - histImpactParameterDau[iHad][iOrigin][iDau] = registryMesons.add(Form("%s/histImpactParameterDau%d%s", particleNames[iHad].data(), iDau, originNames[iOrigin].data()), Form("Daughter %d DCAxy reco - %s %s; DCAxy (cm); entries", iDau, originNames[iOrigin].data(), labels[iHad].data()), HistType::kTH1F, {axisDeltaVtx}); + for (unsigned int iDau = 0; iDau < NDaughters[iHad]; ++iDau) { + histPtDau[iHad][iOrigin][iDau] = registryMesons.add(Form("%s/histPtDau%d%s", ParticleNames[iHad].data(), iDau, OriginNames[iOrigin].data()), Form("Daughter %d Pt reco - %s %s; #it{p}_{T}^{dau, reco} (GeV/#it{c}); entries", iDau, OriginNames[iOrigin].data(), Labels[iHad].data()), HistType::kTH1F, {axisPt}); + histEtaDau[iHad][iOrigin][iDau] = registryMesons.add(Form("%s/histEtaDau%d%s", ParticleNames[iHad].data(), iDau, OriginNames[iOrigin].data()), Form("Daughter %d Eta reco - %s %s; #it{#eta}^{dau, reco}; entries", iDau, OriginNames[iOrigin].data(), Labels[iHad].data()), HistType::kTH1F, {{100, -1., 1.}}); + histImpactParameterDau[iHad][iOrigin][iDau] = registryMesons.add(Form("%s/histImpactParameterDau%d%s", ParticleNames[iHad].data(), iDau, OriginNames[iOrigin].data()), Form("Daughter %d DCAxy reco - %s %s; DCAxy (cm); entries", iDau, OriginNames[iOrigin].data(), Labels[iHad].data()), HistType::kTH1F, {axisDeltaVtx}); } } - } else if (iHad >= nCharmMesonChannels + nBeautyChannels) { - histDeltaPt[iHad] = registryBaryons.add(Form("%s/histDeltaPt", particleNames[iHad].data()), Form("Pt difference reco - MC %s; #it{p}_{T}^{reco} - #it{p}_{T}^{gen} (GeV/#it{c}); entries", labels[iHad].data()), HistType::kTH1F, {axisDeltaMom}); - histDeltaPx[iHad] = registryBaryons.add(Form("%s/histDeltaPx", particleNames[iHad].data()), Form("Px difference reco - MC %s; #it{p}_{x}^{reco} - #it{p}_{x}^{gen} (GeV/#it{c}); entries", labels[iHad].data()), HistType::kTH1F, {axisDeltaMom}); - histDeltaPy[iHad] = registryBaryons.add(Form("%s/histDeltaPy", particleNames[iHad].data()), Form("Py difference reco - MC %s; #it{p}_{y}^{reco} - #it{p}_{y}^{gen} (GeV/#it{c}); entries", labels[iHad].data()), HistType::kTH1F, {axisDeltaMom}); - histDeltaPz[iHad] = registryBaryons.add(Form("%s/histDeltaPz", particleNames[iHad].data()), Form("Pz difference reco - MC %s; #it{p}_{z}^{reco} - #it{p}_{z}^{gen} (GeV/#it{c}); entries", labels[iHad].data()), HistType::kTH1F, {axisDeltaMom}); - histDeltaSecondaryVertexX[iHad] = registryBaryons.add(Form("%s/histDeltaSecondaryVertexX", particleNames[iHad].data()), Form("Sec. Vertex difference reco - MC (MC matched) - %s; #Delta x (cm); entries", labels[iHad].data()), HistType::kTH1F, {axisDeltaVtx}); - histDeltaSecondaryVertexY[iHad] = registryBaryons.add(Form("%s/histDeltaSecondaryVertexY", particleNames[iHad].data()), Form("Sec. Vertex difference reco - MC (MC matched) - %s; #Delta y (cm); entries", labels[iHad].data()), HistType::kTH1F, {axisDeltaVtx}); - histDeltaSecondaryVertexZ[iHad] = registryBaryons.add(Form("%s/histDeltaSecondaryVertexZ", particleNames[iHad].data()), Form("Sec. Vertex difference reco - MC (MC matched) - %s; #Delta z (cm); entries", labels[iHad].data()), HistType::kTH1F, {axisDeltaVtx}); - histDeltaDecayLength[iHad] = registryBaryons.add(Form("%s/histDeltaDecayLength", particleNames[iHad].data()), Form("Decay length difference reco - MC (%s); #Delta L (cm); entries", labels[iHad].data()), HistType::kTH1F, {axisDeltaVtx}); + } else if (iHad >= NCharmMesonChannels + NBeautyChannels) { + histDeltaPt[iHad] = registryBaryons.add(Form("%s/histDeltaPt", ParticleNames[iHad].data()), Form("Pt difference reco - MC %s; #it{p}_{T}^{reco} - #it{p}_{T}^{gen} (GeV/#it{c}); entries", Labels[iHad].data()), HistType::kTH1F, {axisDeltaMom}); + histDeltaPx[iHad] = registryBaryons.add(Form("%s/histDeltaPx", ParticleNames[iHad].data()), Form("Px difference reco - MC %s; #it{p}_{x}^{reco} - #it{p}_{x}^{gen} (GeV/#it{c}); entries", Labels[iHad].data()), HistType::kTH1F, {axisDeltaMom}); + histDeltaPy[iHad] = registryBaryons.add(Form("%s/histDeltaPy", ParticleNames[iHad].data()), Form("Py difference reco - MC %s; #it{p}_{y}^{reco} - #it{p}_{y}^{gen} (GeV/#it{c}); entries", Labels[iHad].data()), HistType::kTH1F, {axisDeltaMom}); + histDeltaPz[iHad] = registryBaryons.add(Form("%s/histDeltaPz", ParticleNames[iHad].data()), Form("Pz difference reco - MC %s; #it{p}_{z}^{reco} - #it{p}_{z}^{gen} (GeV/#it{c}); entries", Labels[iHad].data()), HistType::kTH1F, {axisDeltaMom}); + histDeltaSecondaryVertexX[iHad] = registryBaryons.add(Form("%s/histDeltaSecondaryVertexX", ParticleNames[iHad].data()), Form("Sec. Vertex difference reco - MC (MC matched) - %s; #Delta x (cm); entries", Labels[iHad].data()), HistType::kTH1F, {axisDeltaVtx}); + histDeltaSecondaryVertexY[iHad] = registryBaryons.add(Form("%s/histDeltaSecondaryVertexY", ParticleNames[iHad].data()), Form("Sec. Vertex difference reco - MC (MC matched) - %s; #Delta y (cm); entries", Labels[iHad].data()), HistType::kTH1F, {axisDeltaVtx}); + histDeltaSecondaryVertexZ[iHad] = registryBaryons.add(Form("%s/histDeltaSecondaryVertexZ", ParticleNames[iHad].data()), Form("Sec. Vertex difference reco - MC (MC matched) - %s; #Delta z (cm); entries", Labels[iHad].data()), HistType::kTH1F, {axisDeltaVtx}); + histDeltaDecayLength[iHad] = registryBaryons.add(Form("%s/histDeltaDecayLength", ParticleNames[iHad].data()), Form("Decay length difference reco - MC (%s); #Delta L (cm); entries", Labels[iHad].data()), HistType::kTH1F, {axisDeltaVtx}); for (auto iOrigin = 0; iOrigin < 2; ++iOrigin) { - histPtCentReco[iHad][iOrigin] = registryBaryons.add(Form("%s/histPtCentReco%s", particleNames[iHad].data(), originNames[iOrigin].data()), Form("Pt Cent reco %s %s; #it{p}_{T}^{reco} (GeV/#it{c}); Centrality (%%); entries", originNames[iOrigin].data(), labels[iHad].data()), HistType::kTH2F, {axisPtD, axisCent}); + histPtCentReco[iHad][iOrigin] = registryBaryons.add(Form("%s/histPtCentReco%s", ParticleNames[iHad].data(), OriginNames[iOrigin].data()), Form("Pt Cent reco %s %s; #it{p}_{T}^{reco} (GeV/#it{c}); Centrality (%%); entries", OriginNames[iOrigin].data(), Labels[iHad].data()), HistType::kTH2F, {axisPtD, axisCent}); if (storeOccupancy) { - histPtOccReco[iHad][iOrigin] = registryBaryons.add(Form("%s/histPtOccReco%s", particleNames[iHad].data(), originNames[iOrigin].data()), Form("Pt Cent reco %s %s; #it{p}_{T}^{reco} (GeV/#it{c}); Occupancy; entries", originNames[iOrigin].data(), labels[iHad].data()), HistType::kTH2F, {axisPtD, axisOcc}); + histPtOccReco[iHad][iOrigin] = registryBaryons.add(Form("%s/histPtOccReco%s", ParticleNames[iHad].data(), OriginNames[iOrigin].data()), Form("Pt Cent reco %s %s; #it{p}_{T}^{reco} (GeV/#it{c}); Occupancy; entries", OriginNames[iOrigin].data(), Labels[iHad].data()), HistType::kTH2F, {axisPtD, axisOcc}); } - for (unsigned int iDau = 0; iDau < nDaughters[iHad]; ++iDau) { - histPtDau[iHad][iOrigin][iDau] = registryBaryons.add(Form("%s/histPtDau%d%s", particleNames[iHad].data(), iDau, originNames[iOrigin].data()), Form("Daughter %d Pt reco - %s %s; #it{p}_{T}^{dau, reco} (GeV/#it{c}); entries", iDau, originNames[iOrigin].data(), labels[iHad].data()), HistType::kTH1F, {axisPt}); - histEtaDau[iHad][iOrigin][iDau] = registryBaryons.add(Form("%s/histEtaDau%d%s", particleNames[iHad].data(), iDau, originNames[iOrigin].data()), Form("Daughter %d Eta reco - %s %s; #it{#eta}^{dau, reco}; entries", iDau, originNames[iOrigin].data(), labels[iHad].data()), HistType::kTH1F, {{100, -1., 1.}}); - histImpactParameterDau[iHad][iOrigin][iDau] = registryBaryons.add(Form("%s/histImpactParameterDau%d%s", particleNames[iHad].data(), iDau, originNames[iOrigin].data()), Form("Daughter %d DCAxy reco - %s %s; DCAxy (cm); entries", iDau, originNames[iOrigin].data(), labels[iHad].data()), HistType::kTH1F, {axisDeltaVtx}); + for (unsigned int iDau = 0; iDau < NDaughters[iHad]; ++iDau) { + histPtDau[iHad][iOrigin][iDau] = registryBaryons.add(Form("%s/histPtDau%d%s", ParticleNames[iHad].data(), iDau, OriginNames[iOrigin].data()), Form("Daughter %d Pt reco - %s %s; #it{p}_{T}^{dau, reco} (GeV/#it{c}); entries", iDau, OriginNames[iOrigin].data(), Labels[iHad].data()), HistType::kTH1F, {axisPt}); + histEtaDau[iHad][iOrigin][iDau] = registryBaryons.add(Form("%s/histEtaDau%d%s", ParticleNames[iHad].data(), iDau, OriginNames[iOrigin].data()), Form("Daughter %d Eta reco - %s %s; #it{#eta}^{dau, reco}; entries", iDau, OriginNames[iOrigin].data(), Labels[iHad].data()), HistType::kTH1F, {{100, -1., 1.}}); + histImpactParameterDau[iHad][iOrigin][iDau] = registryBaryons.add(Form("%s/histImpactParameterDau%d%s", ParticleNames[iHad].data(), iDau, OriginNames[iOrigin].data()), Form("Daughter %d DCAxy reco - %s %s; DCAxy (cm); entries", iDau, OriginNames[iOrigin].data(), Labels[iHad].data()), HistType::kTH1F, {axisDeltaVtx}); } } } @@ -840,7 +836,7 @@ struct HfTaskMcValidationRec { ccdb->setLocalObjectValidityChecking(); } - template + template void checkCollisions(Coll const& collision, aod::McCollisions const&, aod::BCsWithTimestamps const&) @@ -851,7 +847,7 @@ struct HfTaskMcValidationRec { } float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate return; @@ -869,7 +865,7 @@ struct HfTaskMcValidationRec { registry.fill(HIST("histDeltaZvtx"), collision.numContrib(), collision.posZ() - mcCollision.posZ()); } - template + template void checkCollisionAssociation(Colls const& collisions, TracksWithSel const&, aod::McParticles const& mcParticles, @@ -881,7 +877,7 @@ struct HfTaskMcValidationRec { // check that collision is selected by hf-track-index-skim-creator-tag-sel-collisions float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -911,14 +907,14 @@ struct HfTaskMcValidationRec { nGoodContributors++; } } - float frac = (nContributors > 0) ? static_cast(nGoodContributors) / nContributors : 1.; + float const frac = (nContributors > 0) ? static_cast(nGoodContributors) / nContributors : 1.; registry.fill(HIST("TrackToCollChecks/histFracGoodContributors"), frac); - uint64_t mostProbableBC = collision.bc().globalBC(); + uint64_t const mostProbableBC = collision.bc().globalBC(); for (auto collision2 = collision + 1; collision2 != collisions.end(); ++collision2) { - uint64_t mostProbableBC2 = collision2.bc().globalBC(); + uint64_t const mostProbableBC2 = collision2.bc().globalBC(); if (mostProbableBC2 == mostProbableBC) { - float radColl1 = std::sqrt(collision.posX() * collision.posX() + collision.posY() * collision.posY()); - float radColl2 = std::sqrt(collision2.posX() * collision2.posX() + collision2.posY() * collision2.posY()); + float const radColl1 = std::sqrt(collision.posX() * collision.posX() + collision.posY() * collision.posY()); + float const radColl2 = std::sqrt(collision2.posX() * collision2.posX() + collision2.posY() * collision2.posY()); int nFromBeautyColl1 = 0, nFromBeautyColl2 = 0; for (const auto& trackColl1 : tracksColl1) { if (trackColl1.has_mcParticle() && trackColl1.isPVContributor()) { @@ -949,13 +945,13 @@ struct HfTaskMcValidationRec { for (const auto& track : tracksFilteredGlobalTrackWoDCA) { // check number of ITS hits int nITSlayers = 0; - uint8_t ITSHitMap = track.itsClusterMap(); + uint8_t const itsHitMap = track.itsClusterMap(); for (int iLayer = 0; iLayer < 7; ++iLayer) { - if (TESTBIT(ITSHitMap, iLayer)) { + if (TESTBIT(itsHitMap, iLayer)) { nITSlayers++; } } - uint index = uint(track.collisionId() >= 0); + uint const index = uint(track.collisionId() >= 0); if (track.has_mcParticle()) { auto particle = track.mcParticle(); // get corresponding MC particle to check origin auto mcCollision = particle.mcCollision_as(); @@ -964,7 +960,7 @@ struct HfTaskMcValidationRec { } auto origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle, true); histTracks->Fill(origin, track.pt()); - bool isAmbiguous = (track.compatibleCollIds().size() != 1); + bool const isAmbiguous = (track.compatibleCollIds().size() != 1); if (isAmbiguous) { registry.fill(HIST("TrackToCollChecks/histAmbiguousTrackNumCollisions"), track.compatibleCollIds().size()); histAmbiguousTracks->Fill(origin, track.pt()); @@ -974,7 +970,7 @@ struct HfTaskMcValidationRec { ambCollPosZ.push_back(ambCollision.posZ()); } // here we are only interested to tracks associated to multiple vertices - if (ambCollPosZ.size() > 0) { + if (!ambCollPosZ.empty()) { registry.fill(HIST("TrackToCollChecks/histAmbiguousTrackZvtxRMS"), computeRMS(ambCollPosZ)); } } @@ -1066,7 +1062,7 @@ struct HfTaskMcValidationRec { } PROCESS_SWITCH(HfTaskMcValidationRec, processCollAssocWithCentFTOM, "Process collision-association information with centrality selection with FT0M, requires extra table from TrackToCollisionAssociation task (fillTableOfCollIdsPerTrack=true)", false); - template + template void processEff(HfCand2ProngWithMCRec const& cand2Prongs, HfCand3ProngWithMCRec const& cand3Prongs, aod::TracksWMc const&, @@ -1081,8 +1077,8 @@ struct HfTaskMcValidationRec { for (const auto& collision : collisions) { // apply event selection float centrality{105.f}; - int occupancy = collision.trackOccupancyInTimeRange(); - hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); // only needed to update centrality, no bitmask selection applied + int const occupancy = collision.trackOccupancyInTimeRange(); + hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); // only needed to update centrality, no bitmask selection applied if (!collision.has_mcCollision()) { return; } @@ -1100,7 +1096,7 @@ struct HfTaskMcValidationRec { for (const auto& cand2Prong : grouped2ProngCandidates) { // determine which kind of candidate it is - bool isD0Sel = TESTBIT(cand2Prong.hfflag(), o2::aod::hf_cand_2prong::DecayType::D0ToPiK); + bool const isD0Sel = TESTBIT(cand2Prong.hfflag(), o2::aod::hf_cand_2prong::DecayType::D0ToPiK); if (!isD0Sel) { continue; } @@ -1131,10 +1127,10 @@ struct HfTaskMcValidationRec { // determine which kind of candidate it is // FIXME: add D* and decays with cascades - bool isDPlusSel = TESTBIT(cand3Prong.hfflag(), hf_cand_3prong::DecayType::DplusToPiKPi); - bool isDsSel = TESTBIT(cand3Prong.hfflag(), hf_cand_3prong::DecayType::DsToKKPi); - bool isLcSel = TESTBIT(cand3Prong.hfflag(), hf_cand_3prong::DecayType::LcToPKPi); - bool isXicSel = TESTBIT(cand3Prong.hfflag(), hf_cand_3prong::DecayType::XicToPKPi); + bool const isDPlusSel = TESTBIT(cand3Prong.hfflag(), hf_cand_3prong::DecayType::DplusToPiKPi); + bool const isDsSel = TESTBIT(cand3Prong.hfflag(), hf_cand_3prong::DecayType::DsToKKPi); + bool const isLcSel = TESTBIT(cand3Prong.hfflag(), hf_cand_3prong::DecayType::LcToPKPi); + bool const isXicSel = TESTBIT(cand3Prong.hfflag(), hf_cand_3prong::DecayType::XicToPKPi); if (!isDPlusSel && !isDsSel && !isLcSel && !isXicSel) { continue; } @@ -1173,9 +1169,9 @@ struct HfTaskMcValidationRec { } auto mother = mcParticles.rawIteratorAt(indexParticle); fillHisto(cand3Prong, mother, whichHad, whichOrigin, centrality, occupancy); - std::array momDau2 = {cand3Prong.pxProng2(), - cand3Prong.pyProng2(), - cand3Prong.pzProng2()}; + std::array const momDau2 = {cand3Prong.pxProng2(), + cand3Prong.pyProng2(), + cand3Prong.pzProng2()}; histPtDau[whichHad][whichOrigin][2]->Fill(RecoDecay::pt(momDau2)); histEtaDau[whichHad][whichOrigin][2]->Fill(RecoDecay::eta(momDau2)); histImpactParameterDau[whichHad][whichOrigin][2]->Fill(cand3Prong.impactParameter2()); diff --git a/PWGHF/Tasks/taskMultiplicityEstimatorCorrelation.cxx b/PWGHF/Tasks/taskMultiplicityEstimatorCorrelation.cxx index 3e8537a47d1..3df1ca0fc65 100644 --- a/PWGHF/Tasks/taskMultiplicityEstimatorCorrelation.cxx +++ b/PWGHF/Tasks/taskMultiplicityEstimatorCorrelation.cxx @@ -43,8 +43,8 @@ using namespace o2::framework::expressions; struct HfTaskMultiplicityEstimatorCorrelation { HistogramRegistry registry{"registry", {}}; - static constexpr int8_t nEstimators = 8; - static constexpr std::array estimatorsNames = {"FV0A", "FT0A", "FT0C", "FT0M", "FDDA", "FDDC", "FDDM", "NTPV"}; + static constexpr int8_t NEstimators = 8; + static constexpr std::array EstimatorsNames = {"FV0A", "FT0A", "FT0C", "FT0M", "FDDA", "FDDC", "FDDM", "NTPV"}; std::vector consideredParticles = { kElectron, @@ -72,9 +72,9 @@ struct HfTaskMultiplicityEstimatorCorrelation { void init(InitContext&) { - for (int8_t i = 0; i < nEstimators; i++) { - registry.add(("etaPFive/" + std::string(estimatorsNames[i]) + "VsdNdeta").c_str(), (std::string(estimatorsNames[i]) + "VsdNdeta;" + std::string(estimatorsNames[i]) + ";").c_str(), HistType::kTH2F, {*(estimatorsAxes[i]), axisdNdEta}); - registry.add(("etaOne/" + std::string(estimatorsNames[i]) + "VsdNdeta").c_str(), (std::string(estimatorsNames[i]) + "VsdNdeta;" + std::string(estimatorsNames[i]) + ";").c_str(), HistType::kTH2F, {*(estimatorsAxes[i]), axisdNdEta}); + for (int8_t i = 0; i < NEstimators; i++) { + registry.add(("etaPFive/" + std::string(EstimatorsNames[i]) + "VsdNdeta").c_str(), (std::string(EstimatorsNames[i]) + "VsdNdeta;" + std::string(EstimatorsNames[i]) + ";").c_str(), HistType::kTH2F, {*(estimatorsAxes[i]), axisdNdEta}); + registry.add(("etaOne/" + std::string(EstimatorsNames[i]) + "VsdNdeta").c_str(), (std::string(EstimatorsNames[i]) + "VsdNdeta;" + std::string(EstimatorsNames[i]) + ";").c_str(), HistType::kTH2F, {*(estimatorsAxes[i]), axisdNdEta}); } } @@ -132,11 +132,11 @@ struct HfTaskMultiplicityEstimatorCorrelation { float dNdetaFive = nChargedInEtaFive; float dNdetaOne = nChargedInEtaOne / 2.0; - for (int i = 0; i < nEstimators; i++) { - static_for<0, nEstimators - 1>([&](auto j) { - constexpr int index = j.value; - registry.fill(HIST("etaPFive/") + HIST(estimatorsNames[index]) + HIST("VsdNdeta"), multiplicity[index], dNdetaFive); - registry.fill(HIST("etaOne/") + HIST(estimatorsNames[index]) + HIST("VsdNdeta"), multiplicity[index], dNdetaOne); + for (int i = 0; i < NEstimators; i++) { + static_for<0, NEstimators - 1>([&](auto j) { + constexpr int Index = j.value; + registry.fill(HIST("etaPFive/") + HIST(EstimatorsNames[Index]) + HIST("VsdNdeta"), multiplicity[Index], dNdetaFive); + registry.fill(HIST("etaOne/") + HIST(EstimatorsNames[Index]) + HIST("VsdNdeta"), multiplicity[Index], dNdetaOne); }); } } diff --git a/PWGHF/Tasks/taskPidStudies.cxx b/PWGHF/Tasks/taskPidStudies.cxx index 805266b76a9..75878f4f9a6 100644 --- a/PWGHF/Tasks/taskPidStudies.cxx +++ b/PWGHF/Tasks/taskPidStudies.cxx @@ -225,7 +225,7 @@ struct HfTaskPidStudies { ccdb->setLocalObjectValidityChecking(); hfEvSel.addHistograms(registry); - std::shared_ptr hTrackSel = registry.add("hTrackSel", "Track selection;;Counts", {HistType::kTH1F, {{TrackCuts::NCuts, 0, TrackCuts::NCuts}}}); + std::shared_ptr const hTrackSel = registry.add("hTrackSel", "Track selection;;Counts", {HistType::kTH1F, {{TrackCuts::NCuts, 0, TrackCuts::NCuts}}}); // Set Labels for hTrackSel hTrackSel->GetXaxis()->SetBinLabel(TrackCuts::All + 1, "All"); @@ -238,16 +238,16 @@ struct HfTaskPidStudies { hTrackSel->GetXaxis()->SetBinLabel(TrackCuts::ItsChi2NCls + 1, "ITS #chi^{2}/NCls"); } - template + template void fillTree(Cand const& candidate, const int flag) { - float pseudoRndm = candidate.pt() * 1000. - static_cast(candidate.pt() * 1000); + float const pseudoRndm = candidate.pt() * 1000. - static_cast(candidate.pt() * 1000); if (candidate.pt() < ptMaxForDownSample && pseudoRndm > downSampleBkgFactor) { return; } const auto& coll = candidate.template collision_as(); - if constexpr (isV0) { + if constexpr (IsV0) { const auto& posTrack = candidate.template posTrack_as(); const auto& negTrack = candidate.template negTrack_as(); pidV0( @@ -361,13 +361,13 @@ struct HfTaskPidStudies { return rejectionMask == 0; } - template + template bool isTrackSelected(const T1& candidate) { const auto& posTrack = candidate.template posTrack_as(); const auto& negTrack = candidate.template negTrack_as(); registry.fill(HIST("hTrackSel"), TrackCuts::All); - if constexpr (isV0) { + if constexpr (IsV0) { if (!posTrack.hasITS() || !negTrack.hasITS()) { return false; } @@ -508,13 +508,13 @@ struct HfTaskPidStudies { } void processV0Mc(CollisionsMc const& /*mcCollisions*/, - V0sMcRec const& V0s, + V0sMcRec const& v0s, aod::V0MCCores const&, aod::McParticles const& /*particlesMc*/, PidTracks const& /*tracks*/, aod::BCsWithTimestamps const&) { - for (const auto& v0 : V0s) { + for (const auto& v0 : v0s) { if (applyEvSels && !isCollSelected(v0.collision_as())) { continue; } @@ -522,7 +522,7 @@ struct HfTaskPidStudies { continue; } if (isSelectedV0AsK0s(v0) || isSelectedV0AsLambda(v0)) { - int matched = isMatched(v0); + int const matched = isMatched(v0); if (matched != Particle::NotMatched) { fillTree(v0, matched); } @@ -531,12 +531,12 @@ struct HfTaskPidStudies { } PROCESS_SWITCH(HfTaskPidStudies, processV0Mc, "Process MC", true); - void processV0Data(aod::V0Datas const& V0s, + void processV0Data(aod::V0Datas const& v0s, PidTracks const&, aod::BCsWithTimestamps const&, CollSels const&) { - for (const auto& v0 : V0s) { + for (const auto& v0 : v0s) { if (applyEvSels && !isCollSelected(v0.collision_as())) { continue; } @@ -565,7 +565,7 @@ struct HfTaskPidStudies { continue; } if (isSelectedCascAsOmega(casc)) { - int matched = isMatched(casc); + int const matched = isMatched(casc); if (matched != Particle::NotMatched) { fillTree(casc, matched); } diff --git a/PWGHF/Tasks/taskSelOptimisation.cxx b/PWGHF/Tasks/taskSelOptimisation.cxx index c91f5d55819..77fae9bf1e0 100644 --- a/PWGHF/Tasks/taskSelOptimisation.cxx +++ b/PWGHF/Tasks/taskSelOptimisation.cxx @@ -45,74 +45,74 @@ using namespace o2::framework::expressions; namespace { -static constexpr int nCutsToTestCosp = 15; -static constexpr int nCutsToTestDecLen = 11; -static constexpr int nCutsToTestImpParProd = 11; -static constexpr int nCutsToTestMinDCAxy = 9; -static constexpr int nCutsToTestMinTrackPt = 7; - -constexpr float cutsCosp[nCutsToTestCosp] = {0.70, 0.75, 0.80, 0.85, 0.88, 0.90, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 0.995}; -constexpr float cutsDecLen[nCutsToTestDecLen] = {0., 0.005, 0.01, 0.015, 0.02, 0.025, 0.03, 0.04, 0.05, 0.075, 0.1}; -constexpr float cutsImpParProd[nCutsToTestImpParProd] = {-0.00005, -0.00004, -0.00003, -0.00002, -0.00001, 0., 0.00001, 0.00002, 0.00003, 0.00004, 0.00005}; -constexpr float cutsMinDCAxy[nCutsToTestMinDCAxy] = {0., 0.0005, 0.001, 0.0015, 0.0020, 0.0025, 0.0030, 0.0040, 0.0050}; -constexpr float cutsMinTrackPt[nCutsToTestMinTrackPt] = {0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60}; - -auto vecCutsCosp = std::vector{cutsCosp, cutsCosp + nCutsToTestCosp}; -auto vecCutsDecLen = std::vector{cutsDecLen, cutsDecLen + nCutsToTestDecLen}; -auto vecCutsImpParProd = std::vector{cutsImpParProd, cutsImpParProd + nCutsToTestImpParProd}; -auto vecCutsMinDCAxy = std::vector{cutsMinDCAxy, cutsMinDCAxy + nCutsToTestMinDCAxy}; -auto vecCutsMinTrackPt = std::vector{cutsMinTrackPt, cutsMinTrackPt + nCutsToTestMinTrackPt}; - -static const int n2Prong = o2::aod::hf_cand_2prong::DecayType::N2ProngDecays; -static const int n3Prong = o2::aod::hf_cand_3prong::DecayType::N3ProngDecays; - -static constexpr std::array, 3> histoNames2Prong = {{{"hPromptVsPtD0ToPiK", "hPromptVsPtJpsiToEE", "hPromptVsPtJpsiToMuMu", "hPromptVsPt2Prong"}, - {"hNonPromptVsPtD0ToPiK", "hNonPromptVsPtJpsiToEE", "hNonPromptVsPtJpsiToMuMu", "hNonPromptVsPt2Prong"}, - {"hBkgVsPtD0ToPiK", "hBkgVsPtJpsiToEE", "hBkgVsPtJpsiToMuMu", "hBkgVsPt2Prong"}}}; -static constexpr std::array, 3> histoNamesCosp2Prong = {{{"hPromptCospVsPtD0ToPiK", "hPromptCospVsPtJpsiToEE", "hPromptCospVsPtJpsiToMuMu", "hPromptCospVsPt2Prong"}, - {"hNonPromptCospVsPtD0ToPiK", "hNonPromptCospVsPtJpsiToEE", "hNonPromptCospVsPtJpsiToMuMu", "hNonPromptCospVsPt2Prong"}, - {"hBkgCospVsPtD0ToPiK", "hBkgCospVsPtJpsiToEE", "hBkgCospVsPtJpsiToMuMu", "hBkgCospVsPt2Prong"}}}; -static constexpr std::array, 3> histoNamesDecLen2Prong = {{{"hPromptDecLenVsPtD0ToPiK", "hPromptDecLenVsPtJpsiToEE", "hPromptDecLenVsPtJpsiToMuMu", "hPromptDecLenVsPt2Prong"}, - {"hNonPromptDecLenVsPtD0ToPiK", "hNonPromptDecLenVsPtJpsiToEE", "hNonPromptDecLenVsPtJpsiToMuMu", "hNonPromptDecLenVsPt2Prong"}, - {"hBkgDecLenVsPtD0ToPiK", "hBkgDecLenVsPtJpsiToEE", "hBkgDecLenVsPtJpsiToMuMu", "hBkgDecLenVsPt2Prong"}}}; -static constexpr std::array, 3> histoNamesImpParProd2Prong = {{{"hPromptImpParProdVsPtD0ToPiK", "hPromptImpParProdVsPtJpsiToEE", "hPromptImpParProdVsPtJpsiToMuMu", "hPromptImpParProdVsPt2Prong"}, - {"hNonPromptImpParProdVsPtD0ToPiK", "hNonPromptImpParProdVsPtJpsiToEE", "hNonPromptImpParProdVsPtJpsiToMuMu", "hNonPromptImpParProdVsPt2Prong"}, - {"hBkgImpParProdVsPtD0ToPiK", "hBkgImpParProdVsPtJpsiToEE", "hBkgImpParProdVsPtJpsiToMuMu", "hBkgImpParProdVsPt2Prong"}}}; -static constexpr std::array, 3> histoNamesMinDCAxy2Prong = {{{"hPromptMinDCAxyVsPtD0ToPiK", "hPromptMinDCAxyVsPtJpsiToEE", "hPromptMinDCAxyVsPtJpsiToMuMu", "hPromptMinDCAxyVsPt2Prong"}, - {"hNonPromptMinDCAxyVsPtD0ToPiK", "hNonPromptMinDCAxyVsPtJpsiToEE", "hNonPromptMinDCAxyVsPtJpsiToMuMu", "hNonPromptMinDCAxyVsPt2Prong"}, - {"hBkgMinDCAxyVsPtD0ToPiK", "hBkgMinDCAxyVsPtJpsiToEE", "hBkgMinDCAxyVsPtJpsiToMuMu", "hBkgMinDCAxyVsPt2Prong"}}}; -static constexpr std::array, 3> histoNamesMinTrackPt2Prong = {{{"hPromptMinTrackPtVsPtD0ToPiK", "hPromptMinTrackPtVsPtJpsiToEE", "hPromptMinTrackPtVsPtJpsiToMuMu", "hPromptMinTrackPtVsPt2Prong"}, - {"hNonPromptMinTrackPtVsPtD0ToPiK", "hNonPromptMinTrackPtVsPtJpsiToEE", "hNonPromptMinTrackPtVsPtJpsiToMuMu", "hNonPromptMinTrackPtVsPt2Prong"}, - {"hBkgMinTrackPtVsPtD0ToPiK", "hBkgMinTrackPtVsPtJpsiToEE", "hBkgMinTrackPtVsPtJpsiToMuMu", "hBkgMinTrackPtVsPt2Prong"}}}; - -static constexpr std::array, 3> histoNames3Prong = {{{"hPromptVsPtDPlusToPiKPi", "hPromptVsPtLcToPKPi", "hPromptVsPtDsToPiKK", "hPromptVsPtXicToPKPi", "hPromptVsPt3Prong"}, - {"hNonPromptVsPtDPlusToPiKPi", "hNonPromptVsPtLcToPKPi", "hNonPromptVsPtDsToPiKK", "hNonPromptVsPtXicToPKPi", "hNonPromptVsPt3Prong"}, - {"hBkgVsPtDPlusToPiKPi", "hBkgVsPtLcToPKPi", "hBkgVsPtDsToPiKK", "hBkgVsPtXicToPKPi", "hBkgVsPt3Prong"}}}; -static constexpr std::array, 3> histoNamesCosp3Prong = {{{"hPromptCospVsPtDPlusToPiKPi", "hPromptCospVsPtLcToPKPi", "hPromptCospVsPtDsToPiKK", "hPromptCospVsPtXicToPKPi", "hPromptCospVsPt3Prong"}, - {"hNonPromptCospVsPtDPlusToPiKPi", "hNonPromptCospVsPtLcToPKPi", "hNonPromptCospVsPtDsToPiKK", "hNonPromptCospVsPtXicToPKPi", "hNonPromptCospVsPt3Prong"}, - {"hBkgCospVsPtDPlusToPiKPi", "hBkgCospVsPtLcToPKPi", "hBkgCospVsPtDsToPiKK", "hBkgCospVsPtXicToPKPi", "hBkgCospVsPt3Prong"}}}; -static constexpr std::array, 3> histoNamesDecLen3Prong = {{{"hPromptDecLenVsPtDPlusToPiKPi", "hPromptDecLenVsPtLcToPKPi", "hPromptDecLenVsPtDsToPiKK", "hPromptDecLenVsPtXicToPKPi", "hPromptDecLenVsPt3Prong"}, - {"hNonPromptDecLenVsPtDPlusToPiKPi", "hNonPromptDecLenVsPtLcToPKPi", "hNonPromptDecLenVsPtDsToPiKK", "hNonPromptDecLenVsPtXicToPKPi", "hNonPromptDecLenVsPt3Prong"}, - {"hBkgDecLenVsPtDPlusToPiKPi", "hBkgDecLenVsPtLcToPKPi", "hBkgDecLenVsPtDsToPiKK", "hBkgDecLenVsPtXicToPKPi", "hBkgDecLenVsPt3Prong"}}}; -static constexpr std::array, 3> histoNamesMinDCAxy3Prong = {{{"hPromptMinDCAxyVsPtDPlusToPiKPi", "hPromptMinDCAxyVsPtLcToPKPi", "hPromptMinDCAxyVsPtDsToPiKK", "hPromptMinDCAxyVsPtXicToPKPi", "hPromptMinDCAxyVsPt3Prong"}, - {"hNonPromptMinDCAxyVsPtDPlusToPiKPi", "hNonPromptMinDCAxyVsPtLcToPKPi", "hNonPromptMinDCAxyVsPtDsToPiKK", "hNonPromptMinDCAxyVsPtXicToPKPi", "hNonPromptMinDCAxyVsPt3Prong"}, - {"hBkgMinDCAxyVsPtDPlusToPiKPi", "hBkgMinDCAxyVsPtLcToPKPi", "hBkgMinDCAxyVsPtDsToPiKK", "hBkgMinDCAxyVsPtXicToPKPi", "hBkgMinDCAxyVsPt3Prong"}}}; -static constexpr std::array, 3> histoNamesMinTrackPt3Prong = {{{"hPromptMinTrackPtVsPtDPlusToPiKPi", "hPromptMinTrackPtVsPtLcToPKPi", "hPromptMinTrackPtVsPtDsToPiKK", "hPromptMinTrackPtVsPtXicToPKPi", "hPromptMinTrackPtVsPt3Prong"}, - {"hNonPromptMinTrackPtVsPtDPlusToPiKPi", "hNonPromptMinTrackPtVsPtLcToPKPi", "hNonPromptMinTrackPtVsPtDsToPiKK", "hNonPromptMinTrackPtVsPtXicToPKPi", "hNonPromptMinTrackPtVsPt3Prong"}, - {"hBkgMinTrackPtVsPtDPlusToPiKPi", "hBkgMinTrackPtVsPtLcToPKPi", "hBkgMinTrackPtVsPtDsToPiKK", "hBkgMinTrackPtVsPtXicToPKPi", "hBkgMinTrackPtVsPt3Prong"}}}; - -static std::array, n2Prong + 1>, 3> histPt2Prong{}; -static std::array, n2Prong + 1>, 3> histCospVsPt2Prong{}; -static std::array, n2Prong + 1>, 3> histDecLenVsPt2Prong{}; -static std::array, n2Prong + 1>, 3> histImpParProdVsPt2Prong{}; -static std::array, n2Prong + 1>, 3> histMinDCAxyVsPt2Prong{}; -static std::array, n2Prong + 1>, 3> histMinTrackPtVsPt2Prong{}; - -static std::array, n3Prong + 1>, 3> histPt3Prong{}; -static std::array, n3Prong + 1>, 3> histCospVsPt3Prong{}; -static std::array, n3Prong + 1>, 3> histDecLenVsPt3Prong{}; -static std::array, n3Prong + 1>, 3> histMinDCAxyVsPt3Prong{}; -static std::array, n3Prong + 1>, 3> histMinTrackPtVsPt3Prong{}; +constexpr int NCutsToTestCosp = 15; +constexpr int NCutsToTestDecLen = 11; +constexpr int NCutsToTestImpParProd = 11; +constexpr int NCutsToTestMinDcAxy = 9; +constexpr int NCutsToTestMinTrackPt = 7; + +constexpr float CutsCosp[NCutsToTestCosp] = {0.70, 0.75, 0.80, 0.85, 0.88, 0.90, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 0.995}; +constexpr float CutsDecLen[NCutsToTestDecLen] = {0., 0.005, 0.01, 0.015, 0.02, 0.025, 0.03, 0.04, 0.05, 0.075, 0.1}; +constexpr float CutsImpParProd[NCutsToTestImpParProd] = {-0.00005, -0.00004, -0.00003, -0.00002, -0.00001, 0., 0.00001, 0.00002, 0.00003, 0.00004, 0.00005}; +constexpr float CutsMinDcAxy[NCutsToTestMinDcAxy] = {0., 0.0005, 0.001, 0.0015, 0.0020, 0.0025, 0.0030, 0.0040, 0.0050}; +constexpr float CutsMinTrackPt[NCutsToTestMinTrackPt] = {0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60}; + +auto vecCutsCosp = std::vector{CutsCosp, CutsCosp + NCutsToTestCosp}; +auto vecCutsDecLen = std::vector{CutsDecLen, CutsDecLen + NCutsToTestDecLen}; +auto vecCutsImpParProd = std::vector{CutsImpParProd, CutsImpParProd + NCutsToTestImpParProd}; +auto vecCutsMinDCAxy = std::vector{CutsMinDcAxy, CutsMinDcAxy + NCutsToTestMinDcAxy}; +auto vecCutsMinTrackPt = std::vector{CutsMinTrackPt, CutsMinTrackPt + NCutsToTestMinTrackPt}; + +const int n2Prong = o2::aod::hf_cand_2prong::DecayType::N2ProngDecays; +const int n3Prong = o2::aod::hf_cand_3prong::DecayType::N3ProngDecays; + +constexpr std::array, 3> HistoNames2Prong = {{{"hPromptVsPtD0ToPiK", "hPromptVsPtJpsiToEE", "hPromptVsPtJpsiToMuMu", "hPromptVsPt2Prong"}, + {"hNonPromptVsPtD0ToPiK", "hNonPromptVsPtJpsiToEE", "hNonPromptVsPtJpsiToMuMu", "hNonPromptVsPt2Prong"}, + {"hBkgVsPtD0ToPiK", "hBkgVsPtJpsiToEE", "hBkgVsPtJpsiToMuMu", "hBkgVsPt2Prong"}}}; +constexpr std::array, 3> HistoNamesCosp2Prong = {{{"hPromptCospVsPtD0ToPiK", "hPromptCospVsPtJpsiToEE", "hPromptCospVsPtJpsiToMuMu", "hPromptCospVsPt2Prong"}, + {"hNonPromptCospVsPtD0ToPiK", "hNonPromptCospVsPtJpsiToEE", "hNonPromptCospVsPtJpsiToMuMu", "hNonPromptCospVsPt2Prong"}, + {"hBkgCospVsPtD0ToPiK", "hBkgCospVsPtJpsiToEE", "hBkgCospVsPtJpsiToMuMu", "hBkgCospVsPt2Prong"}}}; +constexpr std::array, 3> HistoNamesDecLen2Prong = {{{"hPromptDecLenVsPtD0ToPiK", "hPromptDecLenVsPtJpsiToEE", "hPromptDecLenVsPtJpsiToMuMu", "hPromptDecLenVsPt2Prong"}, + {"hNonPromptDecLenVsPtD0ToPiK", "hNonPromptDecLenVsPtJpsiToEE", "hNonPromptDecLenVsPtJpsiToMuMu", "hNonPromptDecLenVsPt2Prong"}, + {"hBkgDecLenVsPtD0ToPiK", "hBkgDecLenVsPtJpsiToEE", "hBkgDecLenVsPtJpsiToMuMu", "hBkgDecLenVsPt2Prong"}}}; +constexpr std::array, 3> HistoNamesImpParProd2Prong = {{{"hPromptImpParProdVsPtD0ToPiK", "hPromptImpParProdVsPtJpsiToEE", "hPromptImpParProdVsPtJpsiToMuMu", "hPromptImpParProdVsPt2Prong"}, + {"hNonPromptImpParProdVsPtD0ToPiK", "hNonPromptImpParProdVsPtJpsiToEE", "hNonPromptImpParProdVsPtJpsiToMuMu", "hNonPromptImpParProdVsPt2Prong"}, + {"hBkgImpParProdVsPtD0ToPiK", "hBkgImpParProdVsPtJpsiToEE", "hBkgImpParProdVsPtJpsiToMuMu", "hBkgImpParProdVsPt2Prong"}}}; +constexpr std::array, 3> HistoNamesMinDcAxy2Prong = {{{"hPromptMinDCAxyVsPtD0ToPiK", "hPromptMinDCAxyVsPtJpsiToEE", "hPromptMinDCAxyVsPtJpsiToMuMu", "hPromptMinDCAxyVsPt2Prong"}, + {"hNonPromptMinDCAxyVsPtD0ToPiK", "hNonPromptMinDCAxyVsPtJpsiToEE", "hNonPromptMinDCAxyVsPtJpsiToMuMu", "hNonPromptMinDCAxyVsPt2Prong"}, + {"hBkgMinDCAxyVsPtD0ToPiK", "hBkgMinDCAxyVsPtJpsiToEE", "hBkgMinDCAxyVsPtJpsiToMuMu", "hBkgMinDCAxyVsPt2Prong"}}}; +constexpr std::array, 3> HistoNamesMinTrackPt2Prong = {{{"hPromptMinTrackPtVsPtD0ToPiK", "hPromptMinTrackPtVsPtJpsiToEE", "hPromptMinTrackPtVsPtJpsiToMuMu", "hPromptMinTrackPtVsPt2Prong"}, + {"hNonPromptMinTrackPtVsPtD0ToPiK", "hNonPromptMinTrackPtVsPtJpsiToEE", "hNonPromptMinTrackPtVsPtJpsiToMuMu", "hNonPromptMinTrackPtVsPt2Prong"}, + {"hBkgMinTrackPtVsPtD0ToPiK", "hBkgMinTrackPtVsPtJpsiToEE", "hBkgMinTrackPtVsPtJpsiToMuMu", "hBkgMinTrackPtVsPt2Prong"}}}; + +constexpr std::array, 3> HistoNames3Prong = {{{"hPromptVsPtDPlusToPiKPi", "hPromptVsPtLcToPKPi", "hPromptVsPtDsToPiKK", "hPromptVsPtXicToPKPi", "hPromptVsPt3Prong"}, + {"hNonPromptVsPtDPlusToPiKPi", "hNonPromptVsPtLcToPKPi", "hNonPromptVsPtDsToPiKK", "hNonPromptVsPtXicToPKPi", "hNonPromptVsPt3Prong"}, + {"hBkgVsPtDPlusToPiKPi", "hBkgVsPtLcToPKPi", "hBkgVsPtDsToPiKK", "hBkgVsPtXicToPKPi", "hBkgVsPt3Prong"}}}; +constexpr std::array, 3> HistoNamesCosp3Prong = {{{"hPromptCospVsPtDPlusToPiKPi", "hPromptCospVsPtLcToPKPi", "hPromptCospVsPtDsToPiKK", "hPromptCospVsPtXicToPKPi", "hPromptCospVsPt3Prong"}, + {"hNonPromptCospVsPtDPlusToPiKPi", "hNonPromptCospVsPtLcToPKPi", "hNonPromptCospVsPtDsToPiKK", "hNonPromptCospVsPtXicToPKPi", "hNonPromptCospVsPt3Prong"}, + {"hBkgCospVsPtDPlusToPiKPi", "hBkgCospVsPtLcToPKPi", "hBkgCospVsPtDsToPiKK", "hBkgCospVsPtXicToPKPi", "hBkgCospVsPt3Prong"}}}; +constexpr std::array, 3> HistoNamesDecLen3Prong = {{{"hPromptDecLenVsPtDPlusToPiKPi", "hPromptDecLenVsPtLcToPKPi", "hPromptDecLenVsPtDsToPiKK", "hPromptDecLenVsPtXicToPKPi", "hPromptDecLenVsPt3Prong"}, + {"hNonPromptDecLenVsPtDPlusToPiKPi", "hNonPromptDecLenVsPtLcToPKPi", "hNonPromptDecLenVsPtDsToPiKK", "hNonPromptDecLenVsPtXicToPKPi", "hNonPromptDecLenVsPt3Prong"}, + {"hBkgDecLenVsPtDPlusToPiKPi", "hBkgDecLenVsPtLcToPKPi", "hBkgDecLenVsPtDsToPiKK", "hBkgDecLenVsPtXicToPKPi", "hBkgDecLenVsPt3Prong"}}}; +constexpr std::array, 3> HistoNamesMinDcAxy3Prong = {{{"hPromptMinDCAxyVsPtDPlusToPiKPi", "hPromptMinDCAxyVsPtLcToPKPi", "hPromptMinDCAxyVsPtDsToPiKK", "hPromptMinDCAxyVsPtXicToPKPi", "hPromptMinDCAxyVsPt3Prong"}, + {"hNonPromptMinDCAxyVsPtDPlusToPiKPi", "hNonPromptMinDCAxyVsPtLcToPKPi", "hNonPromptMinDCAxyVsPtDsToPiKK", "hNonPromptMinDCAxyVsPtXicToPKPi", "hNonPromptMinDCAxyVsPt3Prong"}, + {"hBkgMinDCAxyVsPtDPlusToPiKPi", "hBkgMinDCAxyVsPtLcToPKPi", "hBkgMinDCAxyVsPtDsToPiKK", "hBkgMinDCAxyVsPtXicToPKPi", "hBkgMinDCAxyVsPt3Prong"}}}; +constexpr std::array, 3> HistoNamesMinTrackPt3Prong = {{{"hPromptMinTrackPtVsPtDPlusToPiKPi", "hPromptMinTrackPtVsPtLcToPKPi", "hPromptMinTrackPtVsPtDsToPiKK", "hPromptMinTrackPtVsPtXicToPKPi", "hPromptMinTrackPtVsPt3Prong"}, + {"hNonPromptMinTrackPtVsPtDPlusToPiKPi", "hNonPromptMinTrackPtVsPtLcToPKPi", "hNonPromptMinTrackPtVsPtDsToPiKK", "hNonPromptMinTrackPtVsPtXicToPKPi", "hNonPromptMinTrackPtVsPt3Prong"}, + {"hBkgMinTrackPtVsPtDPlusToPiKPi", "hBkgMinTrackPtVsPtLcToPKPi", "hBkgMinTrackPtVsPtDsToPiKK", "hBkgMinTrackPtVsPtXicToPKPi", "hBkgMinTrackPtVsPt3Prong"}}}; + +std::array, n2Prong + 1>, 3> histPt2Prong{}; +std::array, n2Prong + 1>, 3> histCospVsPt2Prong{}; +std::array, n2Prong + 1>, 3> histDecLenVsPt2Prong{}; +std::array, n2Prong + 1>, 3> histImpParProdVsPt2Prong{}; +std::array, n2Prong + 1>, 3> histMinDCAxyVsPt2Prong{}; +std::array, n2Prong + 1>, 3> histMinTrackPtVsPt2Prong{}; + +std::array, n3Prong + 1>, 3> histPt3Prong{}; +std::array, n3Prong + 1>, 3> histCospVsPt3Prong{}; +std::array, n3Prong + 1>, 3> histDecLenVsPt3Prong{}; +std::array, n3Prong + 1>, 3> histMinDCAxyVsPt3Prong{}; +std::array, n3Prong + 1>, 3> histMinTrackPtVsPt3Prong{}; } // namespace @@ -139,43 +139,43 @@ struct HfSelOptimisation { { for (int iOrig{0}; iOrig < 3; iOrig++) { for (int i2Prong = 0; i2Prong < n2Prong + 1; ++i2Prong) { - histPt2Prong[iOrig][i2Prong] = registry.add(histoNames2Prong[iOrig][i2Prong].data(), "", HistType::kTH1F, {axisPt}); - histCospVsPt2Prong[iOrig][i2Prong] = registry.add(histoNamesCosp2Prong[iOrig][i2Prong].data(), "", HistType::kTH2F, {axisPt, axisCosp}); + histPt2Prong[iOrig][i2Prong] = registry.add(HistoNames2Prong[iOrig][i2Prong].data(), "", HistType::kTH1F, {axisPt}); + histCospVsPt2Prong[iOrig][i2Prong] = registry.add(HistoNamesCosp2Prong[iOrig][i2Prong].data(), "", HistType::kTH2F, {axisPt, axisCosp}); for (int iBin{0}; iBin < histCospVsPt2Prong[iOrig][i2Prong]->GetYaxis()->GetNbins(); ++iBin) { histCospVsPt2Prong[iOrig][i2Prong]->GetYaxis()->SetBinLabel(iBin + 1, Form("%0.4f", cutsToTestCpa->at(iBin))); } - histDecLenVsPt2Prong[iOrig][i2Prong] = registry.add(histoNamesDecLen2Prong[iOrig][i2Prong].data(), "", HistType::kTH2F, {axisPt, axisDecLen}); + histDecLenVsPt2Prong[iOrig][i2Prong] = registry.add(HistoNamesDecLen2Prong[iOrig][i2Prong].data(), "", HistType::kTH2F, {axisPt, axisDecLen}); for (int iBin{0}; iBin < histDecLenVsPt2Prong[iOrig][i2Prong]->GetYaxis()->GetNbins(); ++iBin) { histDecLenVsPt2Prong[iOrig][i2Prong]->GetYaxis()->SetBinLabel(iBin + 1, Form("%0.3f", cutsToTestDecLen->at(iBin))); } - histImpParProdVsPt2Prong[iOrig][i2Prong] = registry.add(histoNamesImpParProd2Prong[iOrig][i2Prong].data(), "", HistType::kTH2F, {axisPt, axisImpParProd}); + histImpParProdVsPt2Prong[iOrig][i2Prong] = registry.add(HistoNamesImpParProd2Prong[iOrig][i2Prong].data(), "", HistType::kTH2F, {axisPt, axisImpParProd}); for (int iBin{0}; iBin < histImpParProdVsPt2Prong[iOrig][i2Prong]->GetYaxis()->GetNbins(); ++iBin) { histImpParProdVsPt2Prong[iOrig][i2Prong]->GetYaxis()->SetBinLabel(iBin + 1, Form("%0.4f", cutsToTestImpParProd->at(iBin))); } - histMinDCAxyVsPt2Prong[iOrig][i2Prong] = registry.add(histoNamesMinDCAxy2Prong[iOrig][i2Prong].data(), "", HistType::kTH2F, {axisPt, axisMinDCAxy}); + histMinDCAxyVsPt2Prong[iOrig][i2Prong] = registry.add(HistoNamesMinDcAxy2Prong[iOrig][i2Prong].data(), "", HistType::kTH2F, {axisPt, axisMinDCAxy}); for (int iBin{0}; iBin < histMinDCAxyVsPt2Prong[iOrig][i2Prong]->GetYaxis()->GetNbins(); ++iBin) { histMinDCAxyVsPt2Prong[iOrig][i2Prong]->GetYaxis()->SetBinLabel(iBin + 1, Form("%0.4f", cutsToTestMinDcaXY->at(iBin))); } - histMinTrackPtVsPt2Prong[iOrig][i2Prong] = registry.add(histoNamesMinTrackPt2Prong[iOrig][i2Prong].data(), "", HistType::kTH2F, {axisPt, axisMinTrackPt}); + histMinTrackPtVsPt2Prong[iOrig][i2Prong] = registry.add(HistoNamesMinTrackPt2Prong[iOrig][i2Prong].data(), "", HistType::kTH2F, {axisPt, axisMinTrackPt}); for (int iBin{0}; iBin < histMinTrackPtVsPt2Prong[iOrig][i2Prong]->GetYaxis()->GetNbins(); ++iBin) { histMinTrackPtVsPt2Prong[iOrig][i2Prong]->GetYaxis()->SetBinLabel(iBin + 1, Form("%0.2f", cutsToTestMinTrackPt->at(iBin))); } } for (int i3Prong{0}; i3Prong < n3Prong + 1; ++i3Prong) { - histPt3Prong[iOrig][i3Prong] = registry.add(histoNames3Prong[iOrig][i3Prong].data(), "", HistType::kTH1F, {axisPt}); - histCospVsPt3Prong[iOrig][i3Prong] = registry.add(histoNamesCosp3Prong[iOrig][i3Prong].data(), "", HistType::kTH2F, {axisPt, axisCosp}); + histPt3Prong[iOrig][i3Prong] = registry.add(HistoNames3Prong[iOrig][i3Prong].data(), "", HistType::kTH1F, {axisPt}); + histCospVsPt3Prong[iOrig][i3Prong] = registry.add(HistoNamesCosp3Prong[iOrig][i3Prong].data(), "", HistType::kTH2F, {axisPt, axisCosp}); for (int iBin{0}; iBin < histCospVsPt3Prong[iOrig][i3Prong]->GetYaxis()->GetNbins(); ++iBin) { histCospVsPt3Prong[iOrig][i3Prong]->GetYaxis()->SetBinLabel(iBin + 1, Form("%0.4f", cutsToTestCpa->at(iBin))); } - histDecLenVsPt3Prong[iOrig][i3Prong] = registry.add(histoNamesDecLen3Prong[iOrig][i3Prong].data(), "", HistType::kTH2F, {axisPt, axisDecLen}); + histDecLenVsPt3Prong[iOrig][i3Prong] = registry.add(HistoNamesDecLen3Prong[iOrig][i3Prong].data(), "", HistType::kTH2F, {axisPt, axisDecLen}); for (int iBin{0}; iBin < histDecLenVsPt3Prong[iOrig][i3Prong]->GetYaxis()->GetNbins(); ++iBin) { histDecLenVsPt3Prong[iOrig][i3Prong]->GetYaxis()->SetBinLabel(iBin + 1, Form("%0.4f", cutsToTestDecLen->at(iBin))); } - histMinDCAxyVsPt3Prong[iOrig][i3Prong] = registry.add(histoNamesMinDCAxy3Prong[iOrig][i3Prong].data(), "", HistType::kTH2F, {axisPt, axisMinDCAxy}); + histMinDCAxyVsPt3Prong[iOrig][i3Prong] = registry.add(HistoNamesMinDcAxy3Prong[iOrig][i3Prong].data(), "", HistType::kTH2F, {axisPt, axisMinDCAxy}); for (int iBin{0}; iBin < histMinDCAxyVsPt3Prong[iOrig][i3Prong]->GetYaxis()->GetNbins(); ++iBin) { histMinDCAxyVsPt3Prong[iOrig][i3Prong]->GetYaxis()->SetBinLabel(iBin + 1, Form("%0.4f", cutsToTestMinDcaXY->at(iBin))); } - histMinTrackPtVsPt3Prong[iOrig][i3Prong] = registry.add(histoNamesMinTrackPt3Prong[iOrig][i3Prong].data(), "", HistType::kTH2F, {axisPt, axisMinTrackPt}); + histMinTrackPtVsPt3Prong[iOrig][i3Prong] = registry.add(HistoNamesMinTrackPt3Prong[iOrig][i3Prong].data(), "", HistType::kTH2F, {axisPt, axisMinTrackPt}); for (int iBin{0}; iBin < histMinTrackPtVsPt3Prong[iOrig][i3Prong]->GetYaxis()->GetNbins(); ++iBin) { histMinTrackPtVsPt3Prong[iOrig][i3Prong]->GetYaxis()->SetBinLabel(iBin + 1, Form("%0.4f", cutsToTestMinTrackPt->at(iBin))); } @@ -188,7 +188,7 @@ struct HfSelOptimisation { /// \param candOrig is candidate type (Prompt, NonPrompt, Bkg) /// \param candidate is a candidate /// \param tracks is the array of daughter tracks - template + template void testSelections2Prong(const T1& candidate, const T2& tracks) { auto pT = candidate.pt(); @@ -198,35 +198,35 @@ struct HfSelOptimisation { std::array ptTrack{tracks[0].pt(), tracks[1].pt()}; std::sort(ptTrack.begin(), ptTrack.end()); - histPt2Prong[candOrig][candType]->Fill(pT); + histPt2Prong[CandOrig][CandType]->Fill(pT); for (std::size_t iCospCut{0}; iCospCut < cutsToTestCpa->size(); ++iCospCut) { if (candidate.cpa() > cutsToTestCpa->at(iCospCut)) { - histCospVsPt2Prong[candOrig][candType]->Fill(pT, iCospCut + 1); + histCospVsPt2Prong[CandOrig][CandType]->Fill(pT, iCospCut + 1); } } for (std::size_t iDecLenCut{0}; iDecLenCut < cutsToTestDecLen->size(); ++iDecLenCut) { if (candidate.decayLength() > cutsToTestDecLen->at(iDecLenCut)) { - histDecLenVsPt2Prong[candOrig][candType]->Fill(pT, iDecLenCut + 1); + histDecLenVsPt2Prong[CandOrig][CandType]->Fill(pT, iDecLenCut + 1); } } for (std::size_t iImpParProd{0}; iImpParProd < cutsToTestImpParProd->size(); ++iImpParProd) { if (candidate.impactParameterProduct() < cutsToTestImpParProd->at(iImpParProd)) { - histImpParProdVsPt2Prong[candOrig][candType]->Fill(pT, iImpParProd + 1); + histImpParProdVsPt2Prong[CandOrig][CandType]->Fill(pT, iImpParProd + 1); } } for (std::size_t iMinDCAxy{0}; iMinDCAxy < cutsToTestMinDcaXY->size(); ++iMinDCAxy) { if (absDCA[0] > cutsToTestMinDcaXY->at(iMinDCAxy)) { - histMinDCAxyVsPt2Prong[candOrig][candType]->Fill(pT, iMinDCAxy + 1); + histMinDCAxyVsPt2Prong[CandOrig][CandType]->Fill(pT, iMinDCAxy + 1); } } for (std::size_t iMinTrackPt{0}; iMinTrackPt < cutsToTestMinTrackPt->size(); ++iMinTrackPt) { if (ptTrack[0] > cutsToTestMinTrackPt->at(iMinTrackPt)) { - histMinTrackPtVsPt2Prong[candOrig][candType]->Fill(pT, iMinTrackPt + 1); + histMinTrackPtVsPt2Prong[CandOrig][CandType]->Fill(pT, iMinTrackPt + 1); } } } @@ -236,7 +236,7 @@ struct HfSelOptimisation { /// \param candOrig is candidate type (Prompt, NonPrompt, Bkg) /// \param candidate is a candidate /// \param tracks is the array of doughter tracks - template + template void testSelections3Prong(const T1& candidate, const T2& tracks) { auto pT = candidate.pt(); @@ -246,29 +246,29 @@ struct HfSelOptimisation { std::array ptTrack{tracks[0].pt(), tracks[1].pt(), tracks[2].pt()}; std::sort(ptTrack.begin(), ptTrack.end()); - histPt3Prong[candOrig][candType]->Fill(pT); + histPt3Prong[CandOrig][CandType]->Fill(pT); for (std::size_t iCospCut{0}; iCospCut < cutsToTestCpa->size(); ++iCospCut) { if (candidate.cpa() > cutsToTestCpa->at(iCospCut)) { - histCospVsPt3Prong[candOrig][candType]->Fill(pT, iCospCut + 1); + histCospVsPt3Prong[CandOrig][CandType]->Fill(pT, iCospCut + 1); } } for (std::size_t iDecLenCut{0}; iDecLenCut < cutsToTestDecLen->size(); ++iDecLenCut) { if (candidate.decayLength() > cutsToTestDecLen->at(iDecLenCut)) { - histDecLenVsPt3Prong[candOrig][candType]->Fill(pT, iDecLenCut + 1); + histDecLenVsPt3Prong[CandOrig][CandType]->Fill(pT, iDecLenCut + 1); } } for (std::size_t iMinDCAxy{0}; iMinDCAxy < cutsToTestMinDcaXY->size(); ++iMinDCAxy) { if (absDCA[0] > cutsToTestMinDcaXY->at(iMinDCAxy)) { - histMinDCAxyVsPt3Prong[candOrig][candType]->Fill(pT, iMinDCAxy + 1); + histMinDCAxyVsPt3Prong[CandOrig][CandType]->Fill(pT, iMinDCAxy + 1); } } for (std::size_t iMinTrackPt{0}; iMinTrackPt < cutsToTestMinTrackPt->size(); ++iMinTrackPt) { if (ptTrack[0] > cutsToTestMinTrackPt->at(iMinTrackPt)) { - histMinTrackPtVsPt3Prong[candOrig][candType]->Fill(pT, iMinTrackPt + 1); + histMinTrackPtVsPt3Prong[CandOrig][CandType]->Fill(pT, iMinTrackPt + 1); } } } @@ -282,7 +282,7 @@ struct HfSelOptimisation { auto trackPos = cand2Prong.prong0_as(); // positive daughter auto trackNeg = cand2Prong.prong1_as(); // negative daughter - std::array tracks = {trackPos, trackNeg}; + std::array const tracks = {trackPos, trackNeg}; bool isPrompt = false, isNonPrompt = false, isBkg = false; for (int iDecay{0}; iDecay < n2Prong; ++iDecay) { @@ -338,7 +338,7 @@ struct HfSelOptimisation { auto trackFirst = cand3Prong.prong0_as(); // first daughter auto trackSecond = cand3Prong.prong1_as(); // second daughter auto trackThird = cand3Prong.prong2_as(); // third daughter - std::array tracks = {trackFirst, trackSecond, trackThird}; + std::array const tracks = {trackFirst, trackSecond, trackThird}; bool isPrompt = false, isNonPrompt = false, isBkg = false; for (int iDecay{0}; iDecay < n3Prong; ++iDecay) { diff --git a/PWGHF/Utils/utilsAnalysis.h b/PWGHF/Utils/utilsAnalysis.h index d5879647f94..dfc4ef46fdd 100644 --- a/PWGHF/Utils/utilsAnalysis.h +++ b/PWGHF/Utils/utilsAnalysis.h @@ -37,7 +37,7 @@ enum BHadMothers { NotMatched = 0, /// Convert the B hadron mother PDG for non prompt candidates to a flag /// \param flagBHad pdg of the b hadron mother /// \return integer map to specific mothers' PDG codes -BHadMothers getBHadMotherFlag(const int flagBHad) +inline BHadMothers getBHadMotherFlag(const int flagBHad) { if (std::abs(flagBHad) == o2::constants::physics::kBPlus) { return BHadMothers::BPlus; diff --git a/PWGHF/Utils/utilsDerivedData.h b/PWGHF/Utils/utilsDerivedData.h index 4a08d37d535..8b2b4fd431a 100644 --- a/PWGHF/Utils/utilsDerivedData.h +++ b/PWGHF/Utils/utilsDerivedData.h @@ -87,7 +87,7 @@ struct HfProducesDerivedData : o2::framework::ProducesGroup { o2::framework::Produces rowParticleBase; o2::framework::Produces rowParticleId; - HfConfigurableDerivedData const* conf; + HfConfigurableDerivedData const* conf{}; std::map> matchedCollisions; // indices of derived reconstructed collisions matched to the global indices of MC collisions std::map hasMcParticles; // flags for MC collisions with HF particles @@ -136,7 +136,7 @@ struct HfProducesDerivedData : o2::framework::ProducesGroup { } } - template + template void fillTablesCollision(TCollision const& collision) { if (conf->fillCollBase.value) { @@ -155,7 +155,7 @@ struct HfProducesDerivedData : o2::framework::ProducesGroup { rowCollId( collision.globalIndex()); } - if constexpr (isMC) { + if constexpr (IsMc) { if (conf->fillMcRCollId.value && collision.has_mcCollision()) { // Save rowCollBase.lastIndex() at key collision.mcCollisionId() LOGF(debug, "Rec. collision %d: Filling derived-collision index %d for MC collision %d", collision.globalIndex(), rowCollBase.lastIndex(), collision.mcCollisionId()); diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index eac38fbfaf3..cda1d9f9766 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -248,7 +248,7 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { } // we initialise the summary object - if (softwareTrigger.value != "") { + if (!softwareTrigger.value.empty()) { zorroSummary.setObject(zorro.getZorroSummary()); } @@ -264,7 +264,7 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { /// \param ccdb ccdb service needed to retrieve the needed info for zorro /// \param registry reference to the histogram registry needed for zorro /// \return bitmask with the event selection criteria not satisfied by the collision - template + template HfCollisionRejectionMask getHfCollisionRejectionMask(TCollision const& collision, float& centrality, o2::framework::Service const& ccdb, @@ -272,14 +272,14 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { { HfCollisionRejectionMask rejectionMask{}; - if constexpr (centEstimator != o2::hf_centrality::CentralityEstimator::None) { - centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); + if constexpr (CentEstimator != o2::hf_centrality::CentralityEstimator::None) { + centrality = o2::hf_centrality::getCentralityColl(collision, CentEstimator); if (centrality < centralityMin || centrality > centralityMax) { SETBIT(rejectionMask, EventRejection::Centrality); } } - if constexpr (useEvSel) { + if constexpr (UseEvSel) { /// RCT condition if (requireGoodRct && !rctChecker.checkTable(collision)) { SETBIT(rejectionMask, EventRejection::Rct); @@ -344,7 +344,7 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { SETBIT(rejectionMask, EventRejection::PositionZ); } - if (softwareTrigger.value != "") { + if (!softwareTrigger.value.empty()) { // we might have to update it from CCDB const auto bc = collision.template bc_as(); const auto runNumber = bc.runNumber(); @@ -370,16 +370,16 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { return rejectionMask; } - template + template HfCollisionRejectionMask getHfCollisionRejectionMaskWithUpc(TCollision const& collision, float& centrality, o2::framework::Service const& ccdb, o2::framework::HistogramRegistry& registry, TBcs const& bcs) { - auto rejectionMaskWithUpc = getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + auto rejectionMaskWithUpc = getHfCollisionRejectionMask(collision, centrality, ccdb, registry); - if (useEvSel) { + if (UseEvSel) { const SGCutParHolder sgCuts = setSgPreselection(); const auto bc = collision.template foundBC_as(); const auto bcRange = udhelpers::compatibleBCs(collision, sgCuts.NDtcoll(), bcs, sgCuts.minNBCs()); @@ -435,7 +435,7 @@ struct HfEventSelectionMc { float centralityMin{-10.f}; // Minimum centrality float centralityMax{100.f}; // Maximum centrality bool requireGoodRct{false}; // Apply RCT selection - std::string rctLabel{""}; // RCT selection flag + std::string rctLabel; // RCT selection flag bool rctCheckZDC{false}; // require ZDC from RCT bool rctTreatLimitedAcceptanceAsBad{false}; // RCT flag to reject events with limited acceptance for selected detectors @@ -471,29 +471,29 @@ struct HfEventSelectionMc { void configureFromDevice(o2::framework::DeviceSpec const& device) { for (const auto& option : device.options) { - if (option.name.compare("hfEvSel.useSel8Trigger") == 0) { + if (option.name == "hfEvSel.useSel8Trigger") { useSel8Trigger = option.defaultValue.get(); - } else if (option.name.compare("hfEvSel.useTvxTrigger") == 0) { + } else if (option.name == "hfEvSel.useTvxTrigger") { useTvxTrigger = option.defaultValue.get(); - } else if (option.name.compare("hfEvSel.useTimeFrameBorderCut") == 0) { + } else if (option.name == "hfEvSel.useTimeFrameBorderCut") { useTimeFrameBorderCut = option.defaultValue.get(); - } else if (option.name.compare("hfEvSel.useItsRofBorderCut") == 0) { + } else if (option.name == "hfEvSel.useItsRofBorderCut") { useItsRofBorderCut = option.defaultValue.get(); - } else if (option.name.compare("hfEvSel.zPvPosMin") == 0) { + } else if (option.name == "hfEvSel.zPvPosMin") { zPvPosMin = option.defaultValue.get(); - } else if (option.name.compare("hfEvSel.zPvPosMax") == 0) { + } else if (option.name == "hfEvSel.zPvPosMax") { zPvPosMax = option.defaultValue.get(); - } else if (option.name.compare("hfEvSel.centralityMin") == 0) { + } else if (option.name == "hfEvSel.centralityMin") { centralityMin = option.defaultValue.get(); - } else if (option.name.compare("hfEvSel.centralityMax") == 0) { + } else if (option.name == "hfEvSel.centralityMax") { centralityMax = option.defaultValue.get(); - } else if (option.name.compare("hfEvSel.requireGoodRct") == 0) { + } else if (option.name == "hfEvSel.requireGoodRct") { requireGoodRct = option.defaultValue.get(); - } else if (option.name.compare("hfEvSel.rctLabel") == 0) { + } else if (option.name == "hfEvSel.rctLabel") { rctLabel = option.defaultValue.get(); - } else if (option.name.compare("hfEvSel.rctCheckZDC") == 0) { + } else if (option.name == "hfEvSel.rctCheckZDC") { rctCheckZDC = option.defaultValue.get(); - } else if (option.name.compare("hfEvSel.rctTreatLimitedAcceptanceAsBad") == 0) { + } else if (option.name == "hfEvSel.rctTreatLimitedAcceptanceAsBad") { rctTreatLimitedAcceptanceAsBad = option.defaultValue.get(); } } @@ -522,7 +522,7 @@ struct HfEventSelectionMc { /// \param collSlice collection of reconstructed collisions /// \param centrality centrality variable to be set in this function /// \return a bitmask with the event selections not satisfied by the analysed collision - template + template HfCollisionRejectionMask getHfMcCollisionRejectionMask(TMcCollision const& mcCollision, TCollisions const& collSlice, float& centrality) @@ -531,8 +531,8 @@ struct HfEventSelectionMc { const auto zPv = mcCollision.posZ(); const auto bc = mcCollision.template bc_as(); - if constexpr (centEstimator != o2::hf_centrality::CentralityEstimator::None) { - centrality = o2::hf_centrality::getCentralityGenColl(collSlice, centEstimator); + if constexpr (CentEstimator != o2::hf_centrality::CentralityEstimator::None) { + centrality = o2::hf_centrality::getCentralityGenColl(collSlice, CentEstimator); /// centrality selection if (centrality < centralityMin || centrality > centralityMax) { SETBIT(rejectionMask, EventRejection::Centrality); @@ -575,14 +575,14 @@ struct HfEventSelectionMc { /// \brief Fills histogram for monitoring event selections satisfied by the collision. /// \param collision analysed collision /// \param rejectionMask bitmask storing the info about which ev. selections are not satisfied by the collision - template + template void fillHistograms(TMcCollision const& mcCollision, const HfCollisionRejectionMask rejectionMask, const int nSplitColl = 0) { hGenCollisions->Fill(EventRejection::None); - if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FT0M) { + if constexpr (CentEstimator == o2::hf_centrality::CentralityEstimator::FT0M) { if (!TESTBIT(rejectionMask, EventRejection::TimeFrameBorderCut) && !TESTBIT(rejectionMask, EventRejection::ItsRofBorderCut) && !TESTBIT(rejectionMask, EventRejection::PositionZ)) { hGenCollisionsCent->Fill(mcCollision.centFT0M()); } @@ -595,7 +595,7 @@ struct HfEventSelectionMc { hGenCollisions->Fill(reason); } - if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FT0M) { + if constexpr (CentEstimator == o2::hf_centrality::CentralityEstimator::FT0M) { hNSplitVertices->Fill(nSplitColl); for (int nColl = 0; nColl < nSplitColl; nColl++) { hRecCollisionsCentMc->Fill(mcCollision.centFT0M()); diff --git a/PWGHF/Utils/utilsMcGen.h b/PWGHF/Utils/utilsMcGen.h index 485b15de1af..18734c1e96a 100644 --- a/PWGHF/Utils/utilsMcGen.h +++ b/PWGHF/Utils/utilsMcGen.h @@ -147,7 +147,7 @@ void fillMcMatchGen3Prong(TMcParticles const& mcParticles, int8_t sign = 0; std::vector arrDaughIndex; std::vector idxBhadMothers{}; - std::array arrPdgDaugResonant; + std::array arrPdgDaugResonant{}; const std::array arrPdgDaugResonantLcToPKstar0{daughtersLcResonant.at(DecayChannelResonant::LcToPKstar0)}; // Λc± → p± K* const std::array arrPdgDaugResonantLcToDeltaplusplusK{daughtersLcResonant.at(DecayChannelResonant::LcToDeltaplusplusK)}; // Λc± → Δ(1232)±± K∓ const std::array arrPdgDaugResonantLcToL1520Pi{daughtersLcResonant.at(DecayChannelResonant::LcToL1520Pi)}; // Λc± → Λ(1520) π± @@ -160,7 +160,7 @@ void fillMcMatchGen3Prong(TMcParticles const& mcParticles, continue; } - if (pdgMothersCorrelBkg.size() > 0) { + if (!pdgMothersCorrelBkg.empty()) { for (const auto& pdgMother : pdgMothersCorrelBkg) { if (std::abs(particle.pdgCode()) != pdgMother) { continue; // Skip if the particle PDG code does not match the mother PDG code @@ -202,8 +202,8 @@ void fillMcMatchGen3Prong(TMcParticles const& mcParticles, if (std::abs(pdgMother) == Pdg::kDStar) { std::vector arrResoDaughIndexDStar = {}; RecoDecay::getDaughters(particle, &arrResoDaughIndexDStar, std::array{0}, DepthResoMax); - for (std::size_t iDaug = 0; iDaug < arrResoDaughIndexDStar.size(); iDaug++) { - auto daughDstar = mcParticles.rawIteratorAt(arrResoDaughIndexDStar[iDaug]); + for (const int iDaug : arrResoDaughIndexDStar) { + auto daughDstar = mcParticles.rawIteratorAt(iDaug); if (std::abs(daughDstar.pdgCode()) == Pdg::kD0 || std::abs(daughDstar.pdgCode()) == Pdg::kDPlus) { RecoDecay::getDaughters(daughDstar, &arrResoDaughIndex, std::array{0}, DepthResoMax); break; diff --git a/PWGHF/Utils/utilsPid.h b/PWGHF/Utils/utilsPid.h index bc5024daf75..83307bc43d8 100644 --- a/PWGHF/Utils/utilsPid.h +++ b/PWGHF/Utils/utilsPid.h @@ -47,13 +47,13 @@ enum PidMethod { /// \param nSigmaTpc is the (binned) NSigma separation in TPC (if tiny = true) /// \param nSigmaTof is the (binned) NSigma separation in TOF (if tiny = true) /// \return combined NSigma of TPC and TOF -template +template TNumber combineNSigma(TNumber nSigmaTpc, TNumber nSigmaTof) { static constexpr float DefaultNSigmaTolerance = .1f; static constexpr float DefaultNSigma = -999.f + DefaultNSigmaTolerance; // -999.f is the default value set in TPCPIDResponse.h and PIDTOF.h - if constexpr (tiny) { + if constexpr (Tiny) { nSigmaTpc *= aod::pidtpc_tiny::binning::bin_width; nSigmaTof *= aod::pidtof_tiny::binning::bin_width; } @@ -76,7 +76,7 @@ TNumber combineNSigma(TNumber nSigmaTpc, TNumber nSigmaTof) /// \tparam TCursor datatype of the cursor of the prong PID table to fill /// \param track prong track /// \param rowPid cursor of the prong PID table to fill -template +template void fillProngPid(TTrack const& track, TCursor& rowPid) { @@ -84,7 +84,7 @@ void fillProngPid(TTrack const& track, TCursor& rowPid) // TODO: add here the code for a possible PID post-calibrations in MC float nSigTpc = -999.f; float nSigTof = -999.f; - if constexpr (specPid == HfProngSpecies::Pion) { + if constexpr (SpecPid == HfProngSpecies::Pion) { // pion PID if (track.hasTPC()) { nSigTpc = track.tpcNSigmaPi(); @@ -92,7 +92,7 @@ void fillProngPid(TTrack const& track, TCursor& rowPid) if (track.hasTOF()) { nSigTof = track.tofNSigmaPi(); } - } else if constexpr (specPid == HfProngSpecies::Kaon) { + } else if constexpr (SpecPid == HfProngSpecies::Kaon) { // kaon PID if (track.hasTPC()) { nSigTpc = track.tpcNSigmaKa(); @@ -100,7 +100,7 @@ void fillProngPid(TTrack const& track, TCursor& rowPid) if (track.hasTOF()) { nSigTof = track.tofNSigmaKa(); } - } else if constexpr (specPid == HfProngSpecies::Proton) { + } else if constexpr (SpecPid == HfProngSpecies::Proton) { // proton PID if (track.hasTPC()) { nSigTpc = track.tpcNSigmaPr(); diff --git a/PWGHF/Utils/utilsTrkCandHf.h b/PWGHF/Utils/utilsTrkCandHf.h index 295b8fb7538..20167cb82eb 100644 --- a/PWGHF/Utils/utilsTrkCandHf.h +++ b/PWGHF/Utils/utilsTrkCandHf.h @@ -35,7 +35,7 @@ enum SVFitting { NCases }; -o2::framework::AxisSpec axisCands = {SVFitting::NCases, -0.5f, static_cast(SVFitting::NCases) - 0.5f, ""}; +const o2::framework::AxisSpec axisCands = {SVFitting::NCases, -0.5f, static_cast(SVFitting::NCases) - 0.5f, ""}; /// \brief Function to put labels on candidate monitoring histogram /// \param hCandidates is the histogram @@ -50,7 +50,7 @@ void setLabelHistoCands(THisto& hCandidates) /// \brief Function to evaluate number of ones in a binary representation of the argument /// \param num is the input argument -int countOnesInBinary(const uint8_t num) +inline int countOnesInBinary(const uint8_t num) { int count{0}; constexpr std::size_t NBits{8u}; From bf7205cdcc78816be3d512a6a59b885a0da5d8d2 Mon Sep 17 00:00:00 2001 From: Gyula Bencedi Date: Tue, 7 Oct 2025 01:18:39 +0200 Subject: [PATCH 647/986] [PWGLF] Add task for pseudo-efficiency checks (#13257) --- PWGMM/Mult/Tasks/CMakeLists.txt | 5 + PWGMM/Mult/Tasks/pseudoEffMFT.cxx | 1199 +++++++++++++++++++++++++++++ 2 files changed, 1204 insertions(+) create mode 100644 PWGMM/Mult/Tasks/pseudoEffMFT.cxx diff --git a/PWGMM/Mult/Tasks/CMakeLists.txt b/PWGMM/Mult/Tasks/CMakeLists.txt index 2c56cc8fc96..aae28c5eef1 100644 --- a/PWGMM/Mult/Tasks/CMakeLists.txt +++ b/PWGMM/Mult/Tasks/CMakeLists.txt @@ -79,3 +79,8 @@ o2physics_add_dpl_workflow(flattenicty-chrg SOURCES flattenicty-chrg.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(pseudo-eff-mft + SOURCES pseudoEffMFT.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2::MFTBase O2::DataFormatsMFT O2::MFTTracking O2::ITSMFTSimulation O2::ITSMFTWorkflow + COMPONENT_NAME Analysis) diff --git a/PWGMM/Mult/Tasks/pseudoEffMFT.cxx b/PWGMM/Mult/Tasks/pseudoEffMFT.cxx new file mode 100644 index 00000000000..d8dc1990329 --- /dev/null +++ b/PWGMM/Mult/Tasks/pseudoEffMFT.cxx @@ -0,0 +1,1199 @@ +// 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 pseudoEffMFT.cxx +/// \brief Task for calculating pseudo-efficiency of MFT disks; based on PWGDQ/Tasks/taskMFTTrkEfficiency.cxx +/// \author Gyula Bencedi, gyula.bencedi@cern.ch +/// \since OCT 2025 + +#include "Functions.h" +#include "Index.h" +#include "bestCollisionTable.h" + +#include "Common/CCDB/ctpRateFetcher.h" +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/MathConstants.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/Configurable.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/RuntimeError.h" +#include "Framework/runDataProcessing.h" +#include "MathUtils/Utils.h" +#include "ReconstructionDataFormats/GlobalTrackID.h" +#include +#include +#include + +#include "TPDGCode.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::aod::track; +using namespace o2::aod::fwdtrack; +using namespace o2::constants::physics; +using namespace o2::constants::math; +using namespace pwgmm::mult; +using namespace o2::aod::rctsel; + +namespace mft_xy +{ +constexpr float kMx[936] = { + -8.8, -8.8, 8.2, 8.2, 9.9, 9.9, -9.9, -9.9, -8.2, -8.2, + 8.8, 8.8, -7.1, -7.1, -7.1, -5.4, -5.4, -5.4, -3.7, -3.7, + -3.7, -2, -2, -2, -0.3, -0.3, -0.3, 1.4, 1.4, 1.4, + 3.1, 3.1, 3.1, 4.8, 4.8, 4.8, 6.5, 6.5, 6.5, -6.5, + -6.5, -6.5, -4.8, -4.8, -4.8, -3.1, -3.1, -3.1, -1.4, -1.4, + -1.4, 0.3, 0.3, 0.3, 2, 2, 2, 3.7, 3.7, 3.7, + 5.4, 5.4, 5.4, 7.1, 7.1, 7.1, -8.8, -8.8, 8.2, 8.2, + 9.9, 9.9, -9.9, -9.9, -8.2, -8.2, 8.8, 8.8, -7.1, -7.1, + -7.1, -5.4, -5.4, -5.4, -3.7, -3.7, -3.7, -2, -2, -2, + -0.3, -0.3, -0.3, 1.4, 1.4, 1.4, 3.1, 3.1, 3.1, 4.8, + 4.8, 4.8, 6.5, 6.5, 6.5, -6.5, -6.5, -6.5, -4.8, -4.8, + -4.8, -3.1, -3.1, -3.1, -1.4, -1.4, -1.4, 0.3, 0.3, 0.3, + 2, 2, 2, 3.7, 3.7, 3.7, 5.4, 5.4, 5.4, 7.1, + 7.1, 7.1, -10.5, -10.5, 9.9, 9.9, -9.9, -9.9, 10.5, 10.5, + -8.8, -8.8, -8.8, -7.1, -7.1, -7.1, -2, -2, -2, -0.3, + -0.3, -0.3, 1.4, 1.4, 1.4, 6.5, 6.5, 6.5, 8.2, 8.2, + 8.2, -8.2, -8.2, -8.2, -6.5, -6.5, -6.5, -1.4, -1.4, -1.4, + 0.3, 0.3, 0.3, 2, 2, 2, 7.1, 7.1, 7.1, 8.8, + 8.8, 8.8, -5.4, -5.4, -5.4, -5.4, -3.7, -3.7, -3.7, -3.7, + 3.1, 3.1, 3.1, 3.1, 4.8, 4.8, 4.8, 4.8, -4.8, -4.8, + -4.8, -4.8, -3.1, -3.1, -3.1, -3.1, 3.7, 3.7, 3.7, 3.7, + 5.4, 5.4, 5.4, 5.4, -12.2, -12.2, -12.2, -10.5, -10.5, -10.5, + 9.9, 9.9, 9.9, 11.6, 11.6, 11.6, 13.3, 13.3, 13.3, -13.3, + -13.3, -13.3, -11.6, -11.6, -11.6, -9.9, -9.9, -9.9, 10.5, 10.5, + 10.5, 12.2, 12.2, 12.2, -8.8, -8.8, -8.8, -8.8, -7.1, -7.1, + -7.1, -7.1, -5.4, -5.4, -5.4, -5.4, -3.7, -3.7, -3.7, -3.7, + -2, -2, -2, -2, -0.3, -0.3, -0.3, -0.3, 1.4, 1.4, + 1.4, 1.4, 3.1, 3.1, 3.1, 3.1, 4.8, 4.8, 4.8, 4.8, + 6.5, 6.5, 6.5, 6.5, 8.2, 8.2, 8.2, 8.2, -8.2, -8.2, + -8.2, -8.2, -6.5, -6.5, -6.5, -6.5, -4.8, -4.8, -4.8, -4.8, + -3.1, -3.1, -3.1, -3.1, -1.4, -1.4, -1.4, -1.4, 0.3, 0.3, + 0.3, 0.3, 2, 2, 2, 2, 3.7, 3.7, 3.7, 3.7, + 5.4, 5.4, 5.4, 5.4, 7.1, 7.1, 7.1, 7.1, 8.8, 8.8, + 8.8, 8.8, -13.9, -13.9, -13.9, -12.2, -12.2, -12.2, 11.6, 11.6, + 11.6, 13.3, 13.3, 13.3, -13.3, -13.3, -13.3, -11.6, -11.6, -11.6, + 12.2, 12.2, 12.2, 13.9, 13.9, 13.9, -10.5, -10.5, -10.5, -10.5, + -8.8, -8.8, -8.8, -8.8, -3.7, -3.7, -3.7, -3.7, -2, -2, + -2, -2, -0.3, -0.3, -0.3, -0.3, 1.4, 1.4, 1.4, 1.4, + 3.1, 3.1, 3.1, 3.1, 8.2, 8.2, 8.2, 8.2, 9.9, 9.9, + 9.9, 9.9, -9.9, -9.9, -9.9, -9.9, -8.2, -8.2, -8.2, -8.2, + -3.1, -3.1, -3.1, -3.1, -1.4, -1.4, -1.4, -1.4, 0.3, 0.3, + 0.3, 0.3, 2, 2, 2, 2, 3.7, 3.7, 3.7, 3.7, + 8.8, 8.8, 8.8, 8.8, 10.5, 10.5, 10.5, 10.5, -7.1, -7.1, + -7.1, -7.1, -7.1, -5.4, -5.4, -5.4, -5.4, -5.4, 4.8, 4.8, + 4.8, 4.8, 4.8, 6.5, 6.5, 6.5, 6.5, 6.5, -6.5, -6.5, + -6.5, -6.5, -6.5, -4.8, -4.8, -4.8, -4.8, -4.8, 5.4, 5.4, + 5.4, 5.4, 5.4, 7.1, 7.1, 7.1, 7.1, 7.1, 8.8, 8.8, + -8.2, -8.2, -9.9, -9.9, 9.9, 9.9, 8.2, 8.2, -8.8, -8.8, + 7.1, 7.1, 7.1, 5.4, 5.4, 5.4, 3.7, 3.7, 3.7, 2, + 2, 2, 0.3, 0.3, 0.3, -1.4, -1.4, -1.4, -3.1, -3.1, + -3.1, -4.8, -4.8, -4.8, -6.5, -6.5, -6.5, 6.5, 6.5, 6.5, + 4.8, 4.8, 4.8, 3.1, 3.1, 3.1, 1.4, 1.4, 1.4, -0.3, + -0.3, -0.3, -2, -2, -2, -3.7, -3.7, -3.7, -5.4, -5.4, + -5.4, -7.1, -7.1, -7.1, 8.8, 8.8, -8.2, -8.2, -9.9, -9.9, + 9.9, 9.9, 8.2, 8.2, -8.8, -8.8, 7.1, 7.1, 7.1, 5.4, + 5.4, 5.4, 3.7, 3.7, 3.7, 2, 2, 2, 0.3, 0.3, + 0.3, -1.4, -1.4, -1.4, -3.1, -3.1, -3.1, -4.8, -4.8, -4.8, + -6.5, -6.5, -6.5, 6.5, 6.5, 6.5, 4.8, 4.8, 4.8, 3.1, + 3.1, 3.1, 1.4, 1.4, 1.4, -0.3, -0.3, -0.3, -2, -2, + -2, -3.7, -3.7, -3.7, -5.4, -5.4, -5.4, -7.1, -7.1, -7.1, + 10.5, 10.5, -9.9, -9.9, 9.9, 9.9, -10.5, -10.5, 8.8, 8.8, + 8.8, 7.1, 7.1, 7.1, 2, 2, 2, 0.3, 0.3, 0.3, + -1.4, -1.4, -1.4, -6.5, -6.5, -6.5, -8.2, -8.2, -8.2, 8.2, + 8.2, 8.2, 6.5, 6.5, 6.5, 1.4, 1.4, 1.4, -0.3, -0.3, + -0.3, -2, -2, -2, -7.1, -7.1, -7.1, -8.8, -8.8, -8.8, + 5.4, 5.4, 5.4, 5.4, 3.7, 3.7, 3.7, 3.7, -3.1, -3.1, + -3.1, -3.1, -4.8, -4.8, -4.8, -4.8, 4.8, 4.8, 4.8, 4.8, + 3.1, 3.1, 3.1, 3.1, -3.7, -3.7, -3.7, -3.7, -5.4, -5.4, + -5.4, -5.4, 12.2, 12.2, 12.2, 10.5, 10.5, 10.5, -9.9, -9.9, + -9.9, -11.6, -11.6, -11.6, -13.3, -13.3, -13.3, 13.3, 13.3, 13.3, + 11.6, 11.6, 11.6, 9.9, 9.9, 9.9, -10.5, -10.5, -10.5, -12.2, + -12.2, -12.2, 8.8, 8.8, 8.8, 8.8, 7.1, 7.1, 7.1, 7.1, + 5.4, 5.4, 5.4, 5.4, 3.7, 3.7, 3.7, 3.7, 2, 2, + 2, 2, 0.3, 0.3, 0.3, 0.3, -1.4, -1.4, -1.4, -1.4, + -3.1, -3.1, -3.1, -3.1, -4.8, -4.8, -4.8, -4.8, -6.5, -6.5, + -6.5, -6.5, -8.2, -8.2, -8.2, -8.2, 8.2, 8.2, 8.2, 8.2, + 6.5, 6.5, 6.5, 6.5, 4.8, 4.8, 4.8, 4.8, 3.1, 3.1, + 3.1, 3.1, 1.4, 1.4, 1.4, 1.4, -0.3, -0.3, -0.3, -0.3, + -2, -2, -2, -2, -3.7, -3.7, -3.7, -3.7, -5.4, -5.4, + -5.4, -5.4, -7.1, -7.1, -7.1, -7.1, -8.8, -8.8, -8.8, -8.8, + 13.9, 13.9, 13.9, 12.2, 12.2, 12.2, -11.6, -11.6, -11.6, -13.3, + -13.3, -13.3, 13.3, 13.3, 13.3, 11.6, 11.6, 11.6, -12.2, -12.2, + -12.2, -13.9, -13.9, -13.9, 10.5, 10.5, 10.5, 10.5, 8.8, 8.8, + 8.8, 8.8, 3.7, 3.7, 3.7, 3.7, 2, 2, 2, 2, + 0.3, 0.3, 0.3, 0.3, -1.4, -1.4, -1.4, -1.4, -3.1, -3.1, + -3.1, -3.1, -8.2, -8.2, -8.2, -8.2, -9.9, -9.9, -9.9, -9.9, + 9.9, 9.9, 9.9, 9.9, 8.2, 8.2, 8.2, 8.2, 3.1, 3.1, + 3.1, 3.1, 1.4, 1.4, 1.4, 1.4, -0.3, -0.3, -0.3, -0.3, + -2, -2, -2, -2, -3.7, -3.7, -3.7, -3.7, -8.8, -8.8, + -8.8, -8.8, -10.5, -10.5, -10.5, -10.5, 7.1, 7.1, 7.1, 7.1, + 7.1, 5.4, 5.4, 5.4, 5.4, 5.4, -4.8, -4.8, -4.8, -4.8, + -4.8, -6.5, -6.5, -6.5, -6.5, -6.5, 6.5, 6.5, 6.5, 6.5, + 6.5, 4.8, 4.8, 4.8, 4.8, 4.8, -5.4, -5.4, -5.4, -5.4, + -5.4, -7.1, -7.1, -7.1, -7.1, -7.1}; + +constexpr float kMy[936] = { + -1.7, -4.715, -1.7, -4.715, -1.7, -4.715, -1.7, -4.715, -1.7, -4.715, + -1.7, -4.715, -1.7, -4.715, -7.73, -1.7, -4.715, -7.73, -1.7, -4.715, + -7.73, -3.546, -6.561, -9.576, -3.8, -6.815, -9.83, -3.706, -6.721, -9.736, + -1.7, -4.715, -7.73, -1.7, -4.715, -7.73, -1.7, -4.715, -7.73, -1.7, + -4.715, -7.73, -1.7, -4.715, -7.73, -1.7, -4.715, -7.73, -3.706, -6.721, + -9.736, -3.8, -6.815, -9.83, -3.546, -6.561, -9.576, -1.7, -4.715, -7.73, + -1.7, -4.715, -7.73, -1.7, -4.715, -7.73, -1.7, -4.715, -1.7, -4.715, + -1.7, -4.715, -1.7, -4.715, -1.7, -4.715, -1.7, -4.715, -1.7, -4.715, + -7.73, -1.7, -4.715, -7.73, -1.7, -4.715, -7.73, -3.546, -6.561, -9.576, + -3.8, -6.815, -9.83, -3.706, -6.721, -9.736, -1.7, -4.715, -7.73, -1.7, + -4.715, -7.73, -1.7, -4.715, -7.73, -1.7, -4.715, -7.73, -1.7, -4.715, + -7.73, -1.7, -4.715, -7.73, -3.706, -6.721, -9.736, -3.8, -6.815, -9.83, + -3.546, -6.561, -9.576, -1.7, -4.715, -7.73, -1.7, -4.715, -7.73, -1.7, + -4.715, -7.73, -1.7, -4.715, -1.7, -4.715, -1.7, -4.715, -1.7, -4.715, + -1.7, -4.715, -7.73, -1.7, -4.715, -7.73, -3.55, -6.565, -9.58, -3.8, + -6.815, -9.83, -3.71, -6.725, -9.74, -1.7, -4.715, -7.73, -1.7, -4.715, + -7.73, -1.7, -4.715, -7.73, -1.7, -4.715, -7.73, -3.71, -6.725, -9.74, + -3.8, -6.815, -9.83, -3.55, -6.565, -9.58, -1.7, -4.715, -7.73, -1.7, + -4.715, -7.73, -1.7, -4.715, -7.73, -10.745, -1.7, -4.715, -7.73, -10.745, + -1.7, -4.715, -7.73, -10.745, -1.7, -4.715, -7.73, -10.745, -1.7, -4.715, + -7.73, -10.745, -1.7, -4.715, -7.73, -10.745, -1.7, -4.715, -7.73, -10.745, + -1.7, -4.715, -7.73, -10.745, -1.7, -4.715, -7.73, -1.7, -4.715, -7.73, + -1.7, -4.715, -7.73, -1.7, -4.715, -7.73, -1.7, -4.715, -7.73, -1.7, + -4.715, -7.73, -1.7, -4.715, -7.73, -1.7, -4.715, -7.73, -1.7, -4.715, + -7.73, -1.7, -4.715, -7.73, -1.7, -4.715, -7.73, -10.745, -1.7, -4.715, + -7.73, -10.745, -1.7, -4.715, -7.73, -10.745, -3.5, -6.515, -9.53, -12.545, + -4.735, -7.75, -10.765, -13.78, -4.9, -7.915, -10.93, -13.945, -4.84, -7.855, + -10.87, -13.885, -3.97, -6.985, -10, -13.015, -1.7, -4.715, -7.73, -10.745, + -1.7, -4.715, -7.73, -10.745, -1.7, -4.715, -7.73, -10.745, -1.7, -4.715, + -7.73, -10.745, -1.7, -4.715, -7.73, -10.745, -1.7, -4.715, -7.73, -10.745, + -3.97, -6.985, -10, -13.015, -4.84, -7.855, -10.87, -13.885, -4.9, -7.915, + -10.93, -13.945, -4.735, -7.75, -10.765, -13.78, -3.5, -6.515, -9.53, -12.545, + -1.7, -4.715, -7.73, -10.745, -1.7, -4.715, -7.73, -10.745, -1.7, -4.715, + -7.73, -10.745, -1.7, -4.715, -7.73, -1.7, -4.715, -7.73, -1.7, -4.715, + -7.73, -1.7, -4.715, -7.73, -1.7, -4.715, -7.73, -1.7, -4.715, -7.73, + -1.7, -4.715, -7.73, -1.7, -4.715, -7.73, -1.7, -4.715, -7.73, -10.745, + -1.7, -4.715, -7.73, -10.745, -4.125, -7.14, -10.155, -13.17, -5.155, -8.17, + -11.185, -14.2, -5.3, -8.315, -11.33, -14.345, -5.245, -8.26, -11.275, -14.29, + -4.5, -7.515, -10.53, -13.545, -1.7, -4.715, -7.73, -10.745, -1.7, -4.715, + -7.73, -10.745, -1.7, -4.715, -7.73, -10.745, -1.7, -4.715, -7.73, -10.745, + -4.5, -7.515, -10.53, -13.545, -5.245, -8.26, -11.275, -14.29, -5.3, -8.315, + -11.33, -14.345, -5.155, -8.17, -11.185, -14.2, -4.125, -7.14, -10.155, -13.17, + -1.7, -4.715, -7.73, -10.745, -1.7, -4.715, -7.73, -10.745, -1.7, -4.715, + -7.73, -10.745, -13.76, -1.7, -4.715, -7.73, -10.745, -13.76, -1.7, -4.715, + -7.73, -10.745, -13.76, -1.7, -4.715, -7.73, -10.745, -13.76, -1.7, -4.715, + -7.73, -10.745, -13.76, -1.7, -4.715, -7.73, -10.745, -13.76, -1.7, -4.715, + -7.73, -10.745, -13.76, -1.7, -4.715, -7.73, -10.745, -13.76, 1.7, 4.715, + 1.7, 4.715, 1.7, 4.715, 1.7, 4.715, 1.7, 4.715, 1.7, 4.715, + 1.7, 4.715, 7.73, 1.7, 4.715, 7.73, 1.7, 4.715, 7.73, 3.546, + 6.561, 9.576, 3.8, 6.815, 9.83, 3.706, 6.721, 9.736, 1.7, 4.715, + 7.73, 1.7, 4.715, 7.73, 1.7, 4.715, 7.73, 1.7, 4.715, 7.73, + 1.7, 4.715, 7.73, 1.7, 4.715, 7.73, 3.706, 6.721, 9.736, 3.8, + 6.815, 9.83, 3.546, 6.561, 9.576, 1.7, 4.715, 7.73, 1.7, 4.715, + 7.73, 1.7, 4.715, 7.73, 1.7, 4.715, 1.7, 4.715, 1.7, 4.715, + 1.7, 4.715, 1.7, 4.715, 1.7, 4.715, 1.7, 4.715, 7.73, 1.7, + 4.715, 7.73, 1.7, 4.715, 7.73, 3.546, 6.561, 9.576, 3.8, 6.815, + 9.83, 3.706, 6.721, 9.736, 1.7, 4.715, 7.73, 1.7, 4.715, 7.73, + 1.7, 4.715, 7.73, 1.7, 4.715, 7.73, 1.7, 4.715, 7.73, 1.7, + 4.715, 7.73, 3.706, 6.721, 9.736, 3.8, 6.815, 9.83, 3.546, 6.561, + 9.576, 1.7, 4.715, 7.73, 1.7, 4.715, 7.73, 1.7, 4.715, 7.73, + 1.7, 4.715, 1.7, 4.715, 1.7, 4.715, 1.7, 4.715, 1.7, 4.715, + 7.73, 1.7, 4.715, 7.73, 3.55, 6.565, 9.58, 3.8, 6.815, 9.83, + 3.71, 6.725, 9.74, 1.7, 4.715, 7.73, 1.7, 4.715, 7.73, 1.7, + 4.715, 7.73, 1.7, 4.715, 7.73, 3.71, 6.725, 9.74, 3.8, 6.815, + 9.83, 3.55, 6.565, 9.58, 1.7, 4.715, 7.73, 1.7, 4.715, 7.73, + 1.7, 4.715, 7.73, 10.745, 1.7, 4.715, 7.73, 10.745, 1.7, 4.715, + 7.73, 10.745, 1.7, 4.715, 7.73, 10.745, 1.7, 4.715, 7.73, 10.745, + 1.7, 4.715, 7.73, 10.745, 1.7, 4.715, 7.73, 10.745, 1.7, 4.715, + 7.73, 10.745, 1.7, 4.715, 7.73, 1.7, 4.715, 7.73, 1.7, 4.715, + 7.73, 1.7, 4.715, 7.73, 1.7, 4.715, 7.73, 1.7, 4.715, 7.73, + 1.7, 4.715, 7.73, 1.7, 4.715, 7.73, 1.7, 4.715, 7.73, 1.7, + 4.715, 7.73, 1.7, 4.715, 7.73, 10.745, 1.7, 4.715, 7.73, 10.745, + 1.7, 4.715, 7.73, 10.745, 3.5, 6.515, 9.53, 12.545, 4.735, 7.75, + 10.765, 13.78, 4.9, 7.915, 10.93, 13.945, 4.84, 7.855, 10.87, 13.885, + 3.97, 6.985, 10, 13.015, 1.7, 4.715, 7.73, 10.745, 1.7, 4.715, + 7.73, 10.745, 1.7, 4.715, 7.73, 10.745, 1.7, 4.715, 7.73, 10.745, + 1.7, 4.715, 7.73, 10.745, 1.7, 4.715, 7.73, 10.745, 3.97, 6.985, + 10, 13.015, 4.84, 7.855, 10.87, 13.885, 4.9, 7.915, 10.93, 13.945, + 4.735, 7.75, 10.765, 13.78, 3.5, 6.515, 9.53, 12.545, 1.7, 4.715, + 7.73, 10.745, 1.7, 4.715, 7.73, 10.745, 1.7, 4.715, 7.73, 10.745, + 1.7, 4.715, 7.73, 1.7, 4.715, 7.73, 1.7, 4.715, 7.73, 1.7, + 4.715, 7.73, 1.7, 4.715, 7.73, 1.7, 4.715, 7.73, 1.7, 4.715, + 7.73, 1.7, 4.715, 7.73, 1.7, 4.715, 7.73, 10.745, 1.7, 4.715, + 7.73, 10.745, 4.125, 7.14, 10.155, 13.17, 5.155, 8.17, 11.185, 14.2, + 5.3, 8.315, 11.33, 14.345, 5.245, 8.26, 11.275, 14.29, 4.5, 7.515, + 10.53, 13.545, 1.7, 4.715, 7.73, 10.745, 1.7, 4.715, 7.73, 10.745, + 1.7, 4.715, 7.73, 10.745, 1.7, 4.715, 7.73, 10.745, 4.5, 7.515, + 10.53, 13.545, 5.245, 8.26, 11.275, 14.29, 5.3, 8.315, 11.33, 14.345, + 5.155, 8.17, 11.185, 14.2, 4.125, 7.14, 10.155, 13.17, 1.7, 4.715, + 7.73, 10.745, 1.7, 4.715, 7.73, 10.745, 1.7, 4.715, 7.73, 10.745, + 13.76, 1.7, 4.715, 7.73, 10.745, 13.76, 1.7, 4.715, 7.73, 10.745, + 13.76, 1.7, 4.715, 7.73, 10.745, 13.76, 1.7, 4.715, 7.73, 10.745, + 13.76, 1.7, 4.715, 7.73, 10.745, 13.76, 1.7, 4.715, 7.73, 10.745, + 13.76, 1.7, 4.715, 7.73, 10.745, 13.76}; +} // namespace mft_xy + +auto static constexpr kMinCharge = 3.f; +auto static constexpr kIntZero = 0; +auto static constexpr kZero = 0.f; +auto static constexpr kIntOne = 1; +auto static constexpr kNlayers = 10; +auto static constexpr kNhits = 15; +auto static constexpr kDisks = 5; + +enum TrkSel { + trkSelAll, + trkSelNCls, + trkSelChi2Ncl, + trkSelEta, + trkSelPhiCut, + trkSelPt, + trkSelCA, + nTrkSel +}; + +enum TrkBestSel { + trkBestSelAll, + trkBestSelCollID, + trkBestSelDCAxyCut, + trkBestSelDCAzCut, + trkBestSelWoAmbiguous, + nTrkBestSel +}; + +enum OccupancyEst { TrkITS = 1, + Ft0C +}; + +struct PseudoEffMFT { + + HistogramRegistry registry{ + "registry", + {}, + OutputObjHandlingPolicy::AnalysisObject}; + + Configurable cfgDoIR{"cfgDoIR", false, "Flag to retrieve Interaction rate from CCDB"}; + Configurable cfgUseIRCut{"cfgUseIRCut", false, "Flag to cut on IR rate"}; + Configurable cfgIRCrashOnNull{"cfgIRCrashOnNull", false, "Flag to avoid CTP RateFetcher crash"}; + Configurable cfgIRSource{"cfgIRSource", "ZNC hadronic", "Estimator of the interaction rate (Pb-Pb: ZNC hadronic)"}; + Configurable cfgUseEventkSel{"cfgUseEventkSel", false, "Flag to apply event selection"}; + Configurable cfgUseTrackSel{"cfgUseTrackSel", false, "Flag to apply track selection"}; + Configurable cfgUseParticleSel{"cfgUseParticleSel", false, "Flag to apply particle selection"}; + Configurable cfgUseCcdbForRun{"cfgUseCcdbForRun", false, "Get ccdb object based on run number instead of timestamp"}; + Configurable cfgRejectDeadChips{"cfgRejectDeadChips", true, "Reject tracks passing by dead chips per MFT layer "}; + Configurable cfgDeadMapCcdbPath{"cfgDeadMapCcdbPath", "MFT/Calib/TimeDeadMap", "CCDB path for MFT dead map"}; + + struct : ConfigurableGroup { + ConfigurableAxis interactionRateBins{"interactionRateBins", {500, 0, 50}, "Binning for the interaction rate (kHz)"}; + ConfigurableAxis occupancyBins{"occupancyBins", {VARIABLE_WIDTH, 0.0f, 250.0f, 500.0f, 750.0f, 1000.0f, 1500.0f, 2000.0f, 3000.0f, 4500.0f, 6000.0f, 8000.0f, 10000.0f, 50000.0f}, "Occupancy"}; + ConfigurableAxis centralityBins{"centralityBins", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, "Centrality"}; + ConfigurableAxis irBins{"irBins", {500, 0, 50}, "Interaction rate (kHz)"}; + ConfigurableAxis ptBins{"ptBins", {11, -0.5, 10.5}, "pT binning (GeV/c)"}; + ConfigurableAxis phiBins{"phiBins", {63, 0., TwoPI}, "#varphi binning (rad)"}; + ConfigurableAxis etaBins{"etaBins", {20, -4., -2.}, "#eta binning"}; + Configurable nEtaBins{"nEtaBins", 400, "Number of Eta bins"}; + Configurable nPhiBins{"nPhiBins", 400, "Number of Phi bins"}; + } binOpt; + + struct : ConfigurableGroup { + Configurable requireRCTFlagChecker{"requireRCTFlagChecker", false, "Check event quality in run condition table"}; + Configurable cfgEvtRCTFlagCheckerLabel{"cfgEvtRCTFlagCheckerLabel", "CBT_fw", "Evt sel: RCT flag checker label"}; + Configurable cfgEvtRCTFlagCheckerZDCCheck{"cfgEvtRCTFlagCheckerZDCCheck", false, "Evt sel: RCT flag checker ZDC check"}; + Configurable cfgEvtRCTFlagCheckerLimitAcceptAsBad{"cfgEvtRCTFlagCheckerLimitAcceptAsBad", true, "Evt sel: RCT flag checker treat Limited Acceptance As Bad"}; + } rctCuts; + + struct : ConfigurableGroup { + Configurable usephiCut{"usephiCut", false, "use azimuthal angle cut"}; + Configurable phiCut{"phiCut", 0.1f, "Cut on azimuthal angle of MFT tracks"}; + Configurable minPhi{"minPhi", 0.f, ""}; + Configurable maxPhi{"maxPhi", 6.2832, ""}; + Configurable minEta{"minEta", -3.6f, ""}; + Configurable maxEta{"maxEta", -2.5f, ""}; + Configurable minNclusterMft{"minNclusterMft", 5, "minimum number of MFT clusters"}; + Configurable useChi2Cut{"useChi2Cut", false, "use track chi2 cut"}; + Configurable maxChi2NCl{"maxChi2NCl", 1000.f, "maximum chi2 per MFT clusters"}; + Configurable usePtCut{"usePtCut", false, "use track pT cut"}; + Configurable minPt{"minPt", 0., "minimum pT of the MFT tracks"}; + Configurable requireCA{"requireCA", false, "Use Cellular Automaton track-finding algorithm"}; + Configurable excludeAmbiguous{"excludeAmbiguous", false, "Exclude Ambiguous tracks"}; + Configurable maxDCAxy{"maxDCAxy", 0.01f, "Cut on dca XY"}; + Configurable maxDCAz{"maxDCAz", 0.01f, "Cut on dca Z"}; + } trackCuts; + + struct : ConfigurableGroup { + Configurable maxZvtx{"maxZvtx", 20.0f, "maximum cut on z-vtx (cm)"}; + Configurable minZvtx{"minZvtx", -20.0f, "minimum cut on z-vtx (cm)"}; + Configurable useZDiffCut{"useZDiffCut", false, "use Zvtx reco-mc diff. cut"}; + Configurable maxZvtxDiff{"maxZvtxDiff", 1.0f, "max allowed Z vtx difference for reconstruced collisions (cm)"}; + Configurable requireIsGoodZvtxFT0VsPV{"requireIsGoodZvtxFT0VsPV", true, "require events with PV position along z consistent (within 1 cm) between PV reconstructed using tracks and PV using FT0 A-C time difference"}; + Configurable requireRejectSameBunchPileup{"requireRejectSameBunchPileup", true, "reject collisions in case of pileup with another collision in the same foundBC"}; + Configurable requireNoCollInTimeRangeStrict{"requireNoCollInTimeRangeStrict", true, " requireNoCollInTimeRangeStrict"}; + Configurable requireNoCollInRofStrict{"requireNoCollInRofStrict", false, "requireNoCollInRofStrict"}; + Configurable requireNoCollInRofStandard{"requireNoCollInRofStandard", false, "requireNoCollInRofStandard"}; + Configurable requireNoHighMultCollInPrevRof{"requireNoHighMultCollInPrevRof", false, "requireNoHighMultCollInPrevRof"}; + Configurable requireNoCollInTimeRangeStd{"requireNoCollInTimeRangeStd", true, "reject collisions corrupted by the cannibalism, with other collisions within +/- 10 microseconds"}; + Configurable requireNoCollInTimeRangeNarrow{"requireNoCollInTimeRangeNarrow", false, "reject collisions corrupted by the cannibalism, with other collisions within +/- 10 microseconds"}; + Configurable occupancyEstimator{"occupancyEstimator", 1, "Occupancy estimator: 1 = trackOccupancyInTimeRange, 2 = ft0cOccupancyInTimeRange"}; + Configurable minOccupancy{"minOccupancy", -1, "minimum occupancy from neighbouring collisions"}; + Configurable maxOccupancy{"maxOccupancy", -1, "maximum occupancy from neighbouring collisions"}; + Configurable minIR{"minIR", -1, "minimum IR (kHz) collisions"}; + Configurable maxIR{"maxIR", -1, "maximum IR (kHz) collisions"}; + } eventCuts; + + Service pdg; + Service ccdb; + Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable ccdbPath{"ccdbPath", "MFT/Calib/TimeDeadMap", "ccdb path to MFT deadmap"}; + + int nBCsPerOrbit = 3564; + uint64_t mOrbit; + uint64_t mPrevOrbit; + o2::itsmft::TimeDeadMap* deadmap = nullptr; + std::array, 10> chipsPerLayer{}; + std::array layerMasks; + const o2::itsmft::ChipMappingMFT mapping; + const std::array chipMap = mapping.getChipMappingData(); + + float dX = 1.7; + float dY = 3.015; + std::array layersZ = {-45.3, -46.7, -48.6, -50.0, -52.4, -53.8, -67.7, -69.1, -76.1, -77.5}; + + int mRunNumber{-1}; + uint64_t mSOR{0}; + float mMinSeconds{-1.}; + std::unordered_map gHadronicRate; + ctpRateFetcher rateFetcher; + TH2* gCurrentHadronicRate; + RCTFlagsChecker rctChecker; + + /// @brief init function, definition of histograms + void init(InitContext&) + { + const AxisSpec centralityAxis = {binOpt.centralityBins, "Centrality", "centrality axis"}; + const AxisSpec occupancyAxis = {binOpt.occupancyBins, "Occupancy", "occupancy axis"}; + const AxisSpec irAxis = {binOpt.interactionRateBins, "Interaction Rate", "IR axis"}; + const AxisSpec ptAxis = {binOpt.ptBins, "Pt axis (GeV/c)"}; + const AxisSpec phiAxis = {binOpt.phiBins, "#phi axis"}; + const AxisSpec etaAxis = {binOpt.etaBins, "#eta axis"}; + + rctChecker.init(rctCuts.cfgEvtRCTFlagCheckerLabel, rctCuts.cfgEvtRCTFlagCheckerZDCCheck, rctCuts.cfgEvtRCTFlagCheckerLimitAcceptAsBad); + + ccdb->setURL(ccdbUrl.value); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setCreatedNotAfter(ccdbNoLaterThan.value); + ccdb->setFatalWhenNull(false); + + auto hev = registry.add("Events/hEvtSel", "hEvtSel", HistType::kTH1F, + {{15, -0.5f, +14.5f}}); + hev->GetXaxis()->SetBinLabel(1, "All collisions"); + hev->GetXaxis()->SetBinLabel(2, "Ev. sel."); + hev->GetXaxis()->SetBinLabel(3, "kIsGoodZvtxFT0vsPV"); + hev->GetXaxis()->SetBinLabel(4, "NoSameBunchPileup"); + hev->GetXaxis()->SetBinLabel(5, "Z-vtx cut"); + hev->GetXaxis()->SetBinLabel(6, "kNoCollInTimeRangeStd"); + hev->GetXaxis()->SetBinLabel(7, "kNoCollInTimeRangeNarrow"); + hev->GetXaxis()->SetBinLabel(8, "kNoCollInTimeRangeStrict"); + hev->GetXaxis()->SetBinLabel(9, "kNoCollInRofStrict"); + hev->GetXaxis()->SetBinLabel(10, "kNoCollInRofStandard"); + hev->GetXaxis()->SetBinLabel(11, "kNoHighMultCollInPrevRof"); + hev->GetXaxis()->SetBinLabel(12, "Below min occup."); + hev->GetXaxis()->SetBinLabel(13, "Above max occup."); + hev->GetXaxis()->SetBinLabel(14, "RCT Flag Checker"); + + registry.add("Tracks/hBestTrkSel", "Number of best tracks; Cut; #Tracks Passed Cut", {HistType::kTH1F, {{nTrkBestSel, -0.5, +nTrkBestSel - 0.5}}}); + registry.get(HIST("Tracks/hBestTrkSel"))->GetXaxis()->SetBinLabel(trkBestSelAll + 1, "All"); + registry.get(HIST("Tracks/hBestTrkSel"))->GetXaxis()->SetBinLabel(trkBestSelCollID + 1, "Assigned (ID>=0)"); + registry.get(HIST("Tracks/hBestTrkSel"))->GetXaxis()->SetBinLabel(trkBestSelDCAxyCut + 1, "DCA xy cut"); + registry.get(HIST("Tracks/hBestTrkSel"))->GetXaxis()->SetBinLabel(trkBestSelDCAzCut + 1, "DCA z cut"); + registry.get(HIST("Tracks/hBestTrkSel"))->GetXaxis()->SetBinLabel(trkBestSelWoAmbiguous + 1, "No Ambiguous"); + + registry.add("Tracks/hTrkSel", "Number of tracks; Cut; #Tracks Passed Cut", {HistType::kTH1F, {{nTrkSel, -0.5, +nTrkSel - 0.5}}}); + registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelAll + 1, "All"); + registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelNCls + 1, "Ncl cut"); + registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelChi2Ncl + 1, "#chi^{2}/Ncl cut"); + registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelEta + 1, "#eta cut"); + registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelPhiCut + 1, "#varphi cut"); + registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelPt + 1, "#it{p}_{T} cut"); + registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelCA + 1, "Tracking algorithm (CA)"); + + auto hBcSel = registry.add("hBcSel", "hBcSel", HistType::kTH1F, {{3, -0.5f, +2.5f}}); + hBcSel->GetXaxis()->SetBinLabel(1, "Good BCs"); + hBcSel->GetXaxis()->SetBinLabel(2, "BCs with collisions"); + hBcSel->GetXaxis()->SetBinLabel(3, "BCs with pile-up/splitting"); + + if (doprocessPseudoEffInclusive || doprocessPseudoEffMCInlusive || + doprocessPseudoEffCentFT0C || doprocessPseudoEffMCCentFT0C) { + registry.add("Events/hInteractionRate", "; IR (kHz)", kTH1F, {irAxis}); + for (int i = 0; i < kNlayers; i++) { + layerMasks[i] = new TH2I("", "", binOpt.nEtaBins, trackCuts.minEta, trackCuts.maxEta, binOpt.nPhiBins, -PI, +PI); + } + + const AxisSpec axisMFtBitMap{1031, -0.5, 1030.5, "axisMFtBitMap"}; + registry.add("hMftBitMap", "hMftBitMap", {HistType::kTH1F, {axisMFtBitMap}}); + + const AxisSpec axisNhits{15, -0.5, 15.5, ""}; + const char* elabels[15] = {"N12", "N10", "N02", "N34", "N30", "N04", "N56", "N50", "N06", "N78", "N70", "N08", "N910", "N90", "N010"}; + HistogramConfigSpec defaultNhitsEtaPtPhi({HistType::kTHnF, {{axisNhits}, {etaAxis}, {ptAxis}, {phiAxis}}}); + HistogramConfigSpec defaultNhitsCentEtaPtPhi({HistType::kTHnF, {{axisNhits}, {etaAxis}, {ptAxis}, {phiAxis}, {centralityAxis}}}); + + if (doprocessPseudoEffInclusive) { + registry.add("hEtaPtPhi", "hEtaPtPhi", defaultNhitsEtaPtPhi); + auto hEtaPtPhi = registry.get(HIST("hEtaPtPhi")); + for (int i = 0; i < kNhits; i++) { + hEtaPtPhi->GetAxis(0)->SetBinLabel(i + 1, elabels[i]); + } + } + + if (doprocessPseudoEffCentFT0C) { + registry.add("Cent/hEtaPtPhi", "hEtaPtPhi", defaultNhitsCentEtaPtPhi); + auto hEtaPtPhi = registry.get(HIST("Cent/hEtaPtPhi")); + for (int i = 0; i < kNhits; i++) { + hEtaPtPhi->GetAxis(0)->SetBinLabel(i + 1, elabels[i]); + } + } + + if (doprocessPseudoEffMCInlusive) { + registry.add("hPtRecVsGen", "; #it{p}_{T} (GeV/#it{c}); #it{p}_{T} (GeV/#it{c}) Gen", {HistType::kTH2F, {{ptAxis}, {ptAxis}}}); + registry.add("hEtaRecVsGen", "; #eta; #eta Gen", {HistType::kTH2F, {{etaAxis}, {etaAxis}}}); + registry.add("hPhiRecVsGen", "; #varphi; #varphi Gen", {HistType::kTH2F, {{phiAxis}, {phiAxis}}}); + registry.add("hEtaPtPhiGen", "hEtaPtPhiGen", defaultNhitsEtaPtPhi); + auto hEtaPtPhiGen = registry.get(HIST("hEtaPtPhiGen")); + for (int i = 0; i < kNhits; i++) { + hEtaPtPhiGen->GetAxis(0)->SetBinLabel(i + 1, elabels[i]); + } + registry.add("hMftBitMapGen", "hMftBitMapGen", {HistType::kTH1F, {axisMFtBitMap}}); + } + + if (doprocessPseudoEffMCCentFT0C) { + registry.add("Cent/hPtRecVsGen", "; #it{p}_{T} (GeV/#it{c}); #it{p}_{T} (GeV/#it{c}) Gen", {HistType::kTHnF, {{ptAxis}, {ptAxis}, {centralityAxis}}}); + registry.add("Cent/hEtaRecVsGen", "; #eta; #eta Gen", {HistType::kTHnF, {{etaAxis}, {etaAxis}, {centralityAxis}}}); + registry.add("Cent/hPhiRecVsGen", "; #varphi; #varphi Gen", {HistType::kTHnF, {{phiAxis}, {phiAxis}, {centralityAxis}}}); + registry.add("Cent/hEtaPtPhiGen", "hEtaPtPhiGen", defaultNhitsCentEtaPtPhi); + auto hEtaPtPhiGen = registry.get(HIST("Cent/hEtaPtPhiGen")); + for (int i = 0; i < kNhits; i++) { + hEtaPtPhiGen->GetAxis(0)->SetBinLabel(i + 1, elabels[i]); + } + } + } + } + + /// Filters - tracks + Filter filtTrkEta = (aod::fwdtrack::eta < trackCuts.maxEta) && (aod::fwdtrack::eta > trackCuts.minEta); + Filter filtATrackID = (aod::fwdtrack::bestCollisionId >= 0); + Filter filtATrackDCAxy = (nabs(aod::fwdtrack::bestDCAXY) < trackCuts.maxDCAxy); + Filter filtATrackDCAz = (nabs(aod::fwdtrack::bestDCAZ) < trackCuts.maxDCAz); + /// Filters - mc particles + Filter primaries = (aod::mcparticle::flags & (uint8_t)o2::aod::mcparticle::enums::PhysicalPrimary) == (uint8_t)o2::aod::mcparticle::enums::PhysicalPrimary && (aod::mcparticle::eta < trackCuts.maxEta) && (aod::mcparticle::eta > trackCuts.minEta); + + /// Joined tables + using FullBCs = soa::Join; + using CollBCs = soa::Join; + using Colls = soa::Join; + using CollsCentFT0C = soa::Join; + + using MFTTracksLabeled = soa::Join; + + /// Filtered tables + using FiltMftTracks = soa::Filtered; + using FiltMcMftTracks = soa::Filtered; + using FiltParticles = soa::Filtered; + + template + ObjType* getForTsOrRun(std::string const& fullPath, int64_t timestamp, int runNumber) + { + if (cfgUseCcdbForRun) { + return ccdb->getForRun(fullPath, runNumber); + } else { + return ccdb->getForTimeStamp(fullPath, timestamp); + } + } + + void initCCDB(CollBCs::iterator const& bc) + { + auto timestamp = bc.timestamp(); + auto runnumber = bc.runNumber(); + if (cfgRejectDeadChips) { + deadmap = getForTsOrRun(cfgDeadMapCcdbPath, timestamp, runnumber); + if (deadmap != nullptr) { + LOGF(info, "Using deadmap for run %d", bc.runNumber()); + } else { + LOGF(fatal, "DeadMap is not available in CCDB for run=%d at timestamp=%llu", bc.runNumber(), bc.timestamp()); + } + } + } + + void decodeChipVector(std::vector& inChips, std::array, 10>& outChipsPerLayer) + { + bool prevIsDead = false; + uint16_t lastDead = 0; + for (auto const& chip : inChips) { + if (chip & static_cast(0x8000)) { + auto firstChip = chip - 0x8000; + outChipsPerLayer[chipMap[firstChip].layer].push_back(firstChip); + prevIsDead = true; + lastDead = static_cast(firstChip); + } else { + if (prevIsDead) { + for (int i = 1; i < chip - lastDead; i++) { + outChipsPerLayer[chipMap[i + lastDead].layer].push_back(i + lastDead); + } + } + outChipsPerLayer[chipMap[chip].layer].push_back(chip); + prevIsDead = false; + } + } + } + + std::tuple computeEtaPhiCoverage(float posX, float posY, float dX, float dY, float z) + { + float x1 = posX - dX / 2.0; + float x2 = posX + dX / 2.0; + float y1 = posY - dY / 2.0; + float y2 = posY + dY / 2.0; + + std::vector etas; + std::vector phis; + etas.reserve(4); + phis.reserve(4); + + for (auto const& x : {x1, x2}) { + for (auto const& y : {y1, y2}) { + float r = std::sqrt(x * x + y * y); + float theta = std::atan2(r, z); + float eta = -std::log(std::tan(theta / 2.0)); + float phi = std::atan2(y, x); + etas.push_back(eta); + phis.push_back(phi); + } + } + + float etaMin = *std::min_element(etas.begin(), etas.end()); + float etaMax = *std::max_element(etas.begin(), etas.end()); + float phiMin = *std::min_element(phis.begin(), phis.end()); + float phiMax = *std::max_element(phis.begin(), phis.end()); + + RecoDecay::constrainAngle(phiMax - phiMin, 0.f); + + phiMin = *std::min_element(phis.begin(), phis.end()); + phiMax = *std::max_element(phis.begin(), phis.end()); + + return std::make_tuple(etaMin, etaMax, phiMin, phiMax); + } + + void applyChipToMask(TH2* mask, float etaMin, float etaMax, float phiMin, float phiMax) + { + if (!mask) + return; + + int etaBinMin = mask->GetXaxis()->FindBin(etaMin); + int etaBinMax = mask->GetXaxis()->FindBin(etaMax); + int phiBinMin = mask->GetYaxis()->FindBin(phiMin); + int phiBinMax = mask->GetYaxis()->FindBin(phiMax); + + for (int iEta = etaBinMin; iEta <= etaBinMax; ++iEta) { + for (int iPhi = phiBinMin; iPhi <= phiBinMax; ++iPhi) { + mask->SetBinContent(iEta, iPhi, 1.0); + } + } + } + + void computeExclusionMap(int layer) + { + auto chips = chipsPerLayer[layer]; + float z = layersZ[layer]; + for (const auto& chip : chips) { + float posX = mft_xy::kMx[chip]; + float posY = mft_xy::kMy[chip]; + auto [etaMin, etaMax, phi_min, phi_max] = computeEtaPhiCoverage(posX, posY, dX, dY, z); + applyChipToMask(layerMasks[layer], etaMin, etaMax, phi_min, phi_max); + } + } + + bool isExcluded(float eta, float phi, int layer) + { + int binEta = layerMasks[layer]->GetXaxis()->FindBin(eta); + int binPhi = layerMasks[layer]->GetYaxis()->FindBin(phi); + bool isBad = (layerMasks[layer]->GetBinContent(binEta, binPhi) > 0); + return isBad; + } + + bool isHitAtDisk(uint16_t map, int ilayer) + { + LOGP(debug, " map %i --> %i", map, (map >> (ilayer * 6)) & 0x3F); + return (map >> (ilayer * 6)) & 0x3F; + } + + template + void fillHistos(float cent, float eta, float pt, float phi, uint16_t map) + { + if constexpr (!isMC) { + registry.fill(HIST("hMftBitMap"), map); + } else { + registry.fill(HIST("hMftBitMapGen"), map); + } + + bool iN[10]; + for (int ilayer = 0; ilayer < kNlayers; ilayer++) { + iN[ilayer] = false; + bool ishit = isHitAtDisk(map, ilayer); + if (ishit) { + iN[ilayer] = true; + } + } + + for (int i = 0; i < kDisks; i++) { + if (iN[2 * i] && iN[2 * i + 1]) { + if constexpr (!isMC) { + if constexpr (isCent) { + registry.get(HIST("Cent/hEtaPtPhi"))->Fill(3 * i, eta, pt, phi, cent); + } else { + registry.get(HIST("hEtaPtPhi"))->Fill(3 * i, eta, pt, phi); + } + } else { + if constexpr (isCent) { + registry.get(HIST("Cent/hEtaPtPhiGen"))->Fill(3 * i, eta, pt, phi, cent); + } else { + registry.get(HIST("hEtaPtPhiGen"))->Fill(3 * i, eta, pt, phi); + } + } + } + if (iN[2 * i] && (!iN[2 * i + 1]) && !isExcluded(eta, phi, 2 * i + 1)) { + if constexpr (!isMC) { + if constexpr (isCent) { + registry.get(HIST("Cent/hEtaPtPhi"))->Fill(3 * i + 1, eta, pt, phi, cent); + } else { + registry.get(HIST("hEtaPtPhi"))->Fill(3 * i + 1, eta, pt, phi); + } + } else { + if constexpr (isCent) { + registry.get(HIST("Cent/hEtaPtPhiGen"))->Fill(3 * i + 1, eta, pt, phi, cent); + } else { + registry.get(HIST("hEtaPtPhiGen"))->Fill(3 * i + 1, eta, pt, phi); + } + } + } + if ((!iN[2 * i]) && iN[2 * i + 1] && !isExcluded(eta, phi, 2 * i)) { + if constexpr (!isMC) { + if constexpr (isCent) { + registry.get(HIST("Cent/hEtaPtPhi"))->Fill(3 * i + 2, eta, pt, phi, cent); + } else { + registry.get(HIST("hEtaPtPhi"))->Fill(3 * i + 2, eta, pt, phi); + } + } else { + if constexpr (isCent) { + registry.get(HIST("Cent/hEtaPtPhiGen"))->Fill(3 * i + 2, eta, pt, phi, cent); + } else { + registry.get(HIST("hEtaPtPhiGen"))->Fill(3 * i + 2, eta, pt, phi); + } + } + } + } + } + + template + bool isBestTrackSelected(const B& besttrack) + { + if (fillHis) { + registry.fill(HIST("Tracks/hBestTrkSel"), trkBestSelAll); + } + if (besttrack.bestCollisionId() < kIntZero) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("Tracks/hBestTrkSel"), trkBestSelCollID); + } + if (std::abs(besttrack.bestDCAXY()) >= trackCuts.maxDCAxy) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("Tracks/hBestTrkSel"), trkBestSelDCAxyCut); + } + if (std::abs(besttrack.bestDCAZ()) >= trackCuts.maxDCAxy) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("Tracks/hBestTrkSel"), trkBestSelDCAzCut); + } + if (trackCuts.excludeAmbiguous && besttrack.ambDegree() > kIntOne) { + return false; + } + if (fillHis) { + registry.fill(HIST("Tracks/hBestTrkSel"), trkBestSelWoAmbiguous); + } + return true; + } + + template + bool isTrackSelected(const T& track) + { + if constexpr (fillHis) { + registry.fill(HIST("Tracks/hTrkSel"), trkSelAll); + } + if (track.nClusters() < trackCuts.minNclusterMft) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("Tracks/hTrkSel"), trkSelNCls); + } + if (trackCuts.useChi2Cut) { + float nclMft = std::max(2.0f * track.nClusters() - 5.0f, 1.0f); + float mftChi2NCl = track.chi2() / nclMft; + if (mftChi2NCl > trackCuts.maxChi2NCl) + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("Tracks/hTrkSel"), trkSelChi2Ncl); + } + if (track.eta() < trackCuts.minEta || track.eta() > trackCuts.maxEta) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("Tracks/hTrkSel"), trkSelEta); + } + if (trackCuts.usephiCut) { + float phi = track.phi(); + o2::math_utils::bringTo02Pi(phi); + if (phi < trackCuts.minPhi || trackCuts.maxPhi < phi) { + return false; + } + if ((phi < trackCuts.phiCut) || + ((phi > PI - trackCuts.phiCut) && (phi < PI + trackCuts.phiCut)) || + (phi > TwoPI - trackCuts.phiCut) || + ((phi > ((PIHalf - 0.1) * PI) - trackCuts.phiCut) && + (phi < ((PIHalf - 0.1) * PI) + trackCuts.phiCut))) + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("Tracks/hTrkSel"), trkSelPhiCut); + } + if (trackCuts.usePtCut && track.pt() < trackCuts.minPt) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("Tracks/hTrkSel"), trkSelPt); + } + if (trackCuts.requireCA && !track.isCA()) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("Tracks/hTrkSel"), trkSelCA); + } + return true; + } + + template + bool isParticleSelected(P const& particle) + { + if (particle.eta() < trackCuts.minEta || particle.eta() > trackCuts.maxEta) { + return false; + } + if (trackCuts.usephiCut) { + float phi = particle.phi(); + o2::math_utils::bringTo02Pi(phi); + if (phi < trackCuts.minPhi || trackCuts.maxPhi < phi) { + return false; + } + if ((phi < trackCuts.phiCut) || + ((phi > PI - trackCuts.phiCut) && (phi < PI + trackCuts.phiCut)) || + (phi > TwoPI - trackCuts.phiCut) || + ((phi > ((PIHalf - 0.1) * PI) - trackCuts.phiCut) && + (phi < ((PIHalf - 0.1) * PI) + trackCuts.phiCut))) + return false; + } + return true; + } + + template + float getOccupancy(C const& collision, uint occEstimator) + { + switch (occEstimator) { + case OccupancyEst::TrkITS: + return collision.trackOccupancyInTimeRange(); + case OccupancyEst::Ft0C: + return collision.ft0cOccupancyInTimeRange(); + default: + LOG(fatal) << "No valid occupancy estimator "; + break; + } + return -1.f; + } + + void initHadronicRate(CollBCs::iterator const& bc) + { + if (mRunNumber == bc.runNumber()) { + return; + } + mRunNumber = bc.runNumber(); + if (gHadronicRate.find(mRunNumber) == gHadronicRate.end()) { + auto runDuration = ccdb->getRunDuration(mRunNumber); + mSOR = runDuration.first; + mMinSeconds = std::floor(mSOR * 1.e-3); /// round tsSOR to the highest integer lower than tsSOR + float maxSec = std::ceil(runDuration.second * 1.e-3); /// round tsEOR to the lowest integer higher than tsEOR + const AxisSpec axisSeconds{static_cast((maxSec - mMinSeconds) / 20.f), 0, maxSec - mMinSeconds, "Seconds since SOR"}; + int hadronicRateBins = static_cast(eventCuts.maxIR - eventCuts.minIR); + gHadronicRate[mRunNumber] = registry.add(Form("HadronicRate/%i", mRunNumber), ";Time since SOR (s);Hadronic rate (kHz)", kTH2D, {axisSeconds, {hadronicRateBins, eventCuts.minIR, eventCuts.maxIR}}).get(); + } + gCurrentHadronicRate = gHadronicRate[mRunNumber]; + } + + template + bool isGoodEvent(C const& collision) + { + if constexpr (fillHis) { + registry.fill(HIST("Events/hEvtSel"), 0); + } + if (!collision.sel8()) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("Events/hEvtSel"), 1); + } + if (eventCuts.requireIsGoodZvtxFT0VsPV && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("Events/hEvtSel"), 2); + } + if (eventCuts.requireRejectSameBunchPileup && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("Events/hEvtSel"), 3); + } + if (collision.posZ() <= eventCuts.minZvtx || collision.posZ() >= eventCuts.maxZvtx) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("Events/hEvtSel"), 4); + } + if (eventCuts.requireNoCollInTimeRangeStd && + !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("Events/hEvtSel"), 5); + } + if (eventCuts.requireNoCollInTimeRangeNarrow && + !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("Events/hEvtSel"), 6); + } + if (eventCuts.requireNoCollInTimeRangeStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStrict)) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("Events/hEvtSel"), 7); + } + if (eventCuts.requireNoCollInRofStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStrict)) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("Events/hEvtSel"), 8); + } + if (eventCuts.requireNoCollInRofStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("Events/hEvtSel"), 9); + } + if (eventCuts.requireNoHighMultCollInPrevRof && !collision.selection_bit(o2::aod::evsel::kNoHighMultCollInPrevRof)) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("Events/hEvtSel"), 10); + } + if (eventCuts.minOccupancy >= 0 && + getOccupancy(collision, eventCuts.occupancyEstimator) < + eventCuts.minOccupancy) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("Events/hEvtSel"), 11); + } + if (eventCuts.maxOccupancy >= 0 && + getOccupancy(collision, eventCuts.occupancyEstimator) > + eventCuts.maxOccupancy) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("Events/hEvtSel"), 12); + } + + if (rctCuts.requireRCTFlagChecker && !rctChecker(collision)) { + return false; + } + if constexpr (fillHis) { + registry.fill(HIST("Events/hEvtSel"), 13); + } + return true; + } + + /// @brief Selection of charged particles + /// @return true: charged; false: not charged + bool isChrgParticle(int code) + { + auto p = pdg->GetParticle(code); + auto charge = 0.; + if (p != nullptr) { + charge = p->Charge(); + } + return std::abs(charge) >= kMinCharge; + } + + /// @brief process function for general event statistics + void processTagging(FullBCs const& bcs, CollsCentFT0C const& collisions) + { + std::vector::iterator> cols; + for (auto const& bc : bcs) { + if ((bc.selection_bit(aod::evsel::kIsBBT0A) && + bc.selection_bit(aod::evsel::kIsBBT0C)) != 0) { + registry.fill(HIST("hBcSel"), 0); + cols.clear(); + for (auto const& collision : collisions) { + if (collision.has_foundBC()) { + if (collision.foundBCId() == bc.globalIndex()) { + cols.emplace_back(collision); + } + } else if (collision.bcId() == bc.globalIndex()) { + cols.emplace_back(collision); + } + } + LOGP(debug, "BC {} has {} collisions", bc.globalBC(), cols.size()); + if (!cols.empty()) { + registry.fill(HIST("hBcSel"), 1); + if (cols.size() > 1) { + registry.fill(HIST("hBcSel"), 2); + } + } + } + } + } + + PROCESS_SWITCH(PseudoEffMFT, processTagging, "Collect event sample stats", true); + + template + void processPseudoEff(typename C::iterator const& collision, + FiltMftTracks const& /*tracks*/, + soa::SmallGroups const& besttracks, + CollBCs const& /*bcs*/) + { + auto bcFound = collision.template foundBC_as(); + + if (cfgDoIR) { + initHadronicRate(bcFound); + float ir = !cfgIRSource.value.empty() ? rateFetcher.fetch(ccdb.service, bcFound.timestamp(), bcFound.runNumber(), cfgIRSource, cfgIRCrashOnNull) * 1.e-3 : -1; + registry.fill(HIST("Events/hInteractionRate"), ir); + float seconds = bcFound.timestamp() * 1.e-3 - mMinSeconds; + if (cfgUseIRCut && (ir < eventCuts.minIR || ir > eventCuts.maxIR)) { // cut on hadronic rate + return; + } + gCurrentHadronicRate->Fill(seconds, ir); + } + + for (auto const& atrack : besttracks) { + if (cfgUseTrackSel && !isBestTrackSelected(atrack)) { + continue; + } + auto track = atrack.mfttrack_as(); + if (!track.has_collision()) { + continue; + } + const auto& coll = track.collision_as(); + if (cfgRejectDeadChips) { + auto bc = coll.template bc_as(); + int currentRun = bc.runNumber(); + if (mRunNumber != currentRun) { + initCCDB(bc); + mRunNumber = currentRun; + auto orbits = deadmap->getEvolvingMapKeys(); + } + if (mOrbit != (bc.globalBC() / nBCsPerOrbit)) { + mOrbit = (bc.globalBC() / nBCsPerOrbit); + std::vector encodeChips; + auto lowerOrbit = deadmap->getMapAtOrbit(mOrbit, encodeChips); + if ((mOrbit - lowerOrbit) > mPrevOrbit) { + for (int i = 0; i < kNlayers; i++) { + chipsPerLayer[i].clear(); + } + // for (auto& v : chipsPerLayer) { + // v.clear(); + // } + // for (auto& h : layerMasks) { + // if (h) + // h->Reset("ICES"); + // } + decodeChipVector(encodeChips, chipsPerLayer); + for (int i = 0; i < kNlayers; i++) { + computeExclusionMap(i); + } + mPrevOrbit = mOrbit - lowerOrbit; + } + } + } + + if (cfgUseEventkSel && !isGoodEvent(coll)) { + continue; + } + if (cfgUseTrackSel && !isTrackSelected(track)) { + continue; + } + + auto eta = track.eta(); + auto pt = track.pt(); + auto phi = track.phi(); + o2::math_utils::bringTo02Pi(phi); + if (phi < kZero || TwoPI < phi) { + continue; + } + auto map = track.mftClusterSizesAndTrackFlags(); + fillHistos>(getRecoCent(collision), eta, pt, phi, map); + } + } + + void processPseudoEffInclusive(Colls::iterator const& collision, + FiltMftTracks const& tracks, + soa::SmallGroups const& besttracks, + CollBCs const& bcs) + { + processPseudoEff(collision, tracks, besttracks, bcs); + } + + PROCESS_SWITCH(PseudoEffMFT, processPseudoEffInclusive, "Process PseudoEffMFT data/reco (inclusive)", true); + + void processPseudoEffCentFT0C(CollsCentFT0C::iterator const& collision, + FiltMftTracks const& tracks, + soa::SmallGroups const& besttracks, + CollBCs const& bcs) + { + processPseudoEff(collision, tracks, besttracks, bcs); + } + + PROCESS_SWITCH(PseudoEffMFT, processPseudoEffCentFT0C, "Process PseudoEffMFT data/reco (in FT0C centrality bins)", false); + + template + void processPseudoEffMC(typename soa::Join::iterator const& collision, + MC const& /*mccollisions*/, + FiltParticles const& /*particles*/, + FiltMcMftTracks const& /*tracks*/, + soa::SmallGroups const& besttracks) + { + if (cfgUseEventkSel && !isGoodEvent(collision)) { + return; + } + if (!collision.has_mcCollision()) { + return; + } + auto mcCollision = collision.mcCollision(); + if (eventCuts.useZDiffCut) { + if (std::abs(collision.posZ() - mcCollision.posZ()) > eventCuts.maxZvtxDiff) { + return; + } + } + + for (auto const& atrack : besttracks) { + if (cfgUseTrackSel && !isBestTrackSelected(atrack)) { + continue; + } + auto track = atrack.mfttrack_as(); + auto eta = track.eta(); + auto pt = track.pt(); + + auto phi = track.phi(); + o2::math_utils::bringTo02Pi(phi); + if (phi < kZero || TwoPI < phi) { + continue; + } + + auto map = track.mftClusterSizesAndTrackFlags(); + if (cfgUseTrackSel && !isTrackSelected(track)) { + continue; + } + if (!track.has_mcParticle()) { + LOGF(warning, "No MC particle for track, skipping..."); + continue; + } + auto particle = track.template mcParticle_as(); + + if (!isChrgParticle(particle.pdgCode())) { + continue; + } + if (cfgUseParticleSel && !isParticleSelected(particle)) { + continue; + } + + auto partphi = particle.phi(); + o2::math_utils::bringTo02Pi(partphi); + if (partphi < 0.f || TwoPI < partphi) { + continue; + } + + float cGen = getRecoCent(collision); + if constexpr (has_reco_cent) { + registry.fill(HIST("Cent/hPtRecVsGen"), pt, particle.pt(), cGen); + registry.fill(HIST("Cent/hEtaRecVsGen"), eta, particle.eta(), cGen); + registry.fill(HIST("Cent/hPhiRecVsGen"), phi, partphi, cGen); + } else { + registry.fill(HIST("hPtRecVsGen"), pt, particle.pt()); + registry.fill(HIST("hEtaRecVsGen"), eta, particle.eta()); + registry.fill(HIST("hPhiRecVsGen"), phi, partphi); + } + fillHistos, true>(cGen, particle.eta(), particle.pt(), partphi, map); + } + } + + void processPseudoEffMCInlusive(soa::Join::iterator const& collision, + aod::McCollisions const& mccollisions, + FiltParticles const& particles, + FiltMcMftTracks const& tracks, + soa::SmallGroups const& besttracks) + { + processPseudoEffMC(collision, mccollisions, particles, tracks, besttracks); + } + + PROCESS_SWITCH(PseudoEffMFT, processPseudoEffMCInlusive, "Process PseudoEffMFT mc generated (inclusive)", false); + + void processPseudoEffMCCentFT0C(soa::Join::iterator const& collision, + aod::McCollisions const& mccollisions, + FiltParticles const& particles, + FiltMcMftTracks const& tracks, + soa::SmallGroups const& besttracks) + { + processPseudoEffMC(collision, mccollisions, particles, tracks, besttracks); + } + + PROCESS_SWITCH(PseudoEffMFT, processPseudoEffMCCentFT0C, "Process PseudoEffMFT mc generated (in FT0C centrality bins)", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From 72670f6c331242887fd98c93c17bf8ad66f0bb6c Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Tue, 7 Oct 2025 01:52:07 +0200 Subject: [PATCH 648/986] [PWGLF] Fix issue with getting efficiency weight (#13250) --- .../Strangeness/lambdaspincorrderived.cxx | 107 +++++------------- 1 file changed, 29 insertions(+), 78 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx index 513acb7db8a..f542a8c8fc7 100644 --- a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx @@ -80,13 +80,9 @@ struct lambdaspincorrderived { // Configurable ConfWeightPathLAL{"ConfWeightPathLAL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; // Configurable ConfWeightPathALL{"ConfWeightPathALL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; - Configurable ConfRPathL{"ConfRPathL", "", "CCDB path to R_L (optional)"}; - Configurable ConfRPathAL{"ConfRPathAL", "", "CCDB path to R_AL (optional)"}; Configurable ConfEffPathL{"ConfEffPathL", "", "CCDB path to Eff (optional)"}; Configurable ConfEffPathAL{"ConfEffPathAL", "", "CCDB path to Eff (optional)"}; - TH3D* hR_L = nullptr; - TH3D* hR_AL = nullptr; TH3D* hEff_L = nullptr; TH3D* hEff_AL = nullptr; @@ -140,12 +136,6 @@ struct lambdaspincorrderived { histos.add("ptCent", "ptCent", HistType::kTH2D, {{100, 0.0, 10.0}, {8, 0.0, 80.0}}, true); histos.add("etaCent", "etaCent", HistType::kTH2D, {{32, -0.8, 0.8}, {8, 0.0, 80.0}}, true); - // --- Singles QA for data-driven MIXED reweight (one fill per candidate) --- - histos.add("hSE_L", "SE #Lambda; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - histos.add("hSE_AL", "SE #bar{#Lambda}; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - histos.add("hME_L", "ME #Lambda; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - histos.add("hME_AL", "ME #bar{#Lambda}; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - // Attempted-for-replacement (Den) and Succeeded (Num) per SE leg kinematics histos.add("hMatchDen_L", "Attempted #Lambda; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); histos.add("hMatchDen_AL", "Attempted #bar{#Lambda}; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); @@ -203,8 +193,6 @@ struct lambdaspincorrderived { ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); LOGF(info, "Getting alignment offsets from the CCDB..."); if (useweight) { - hR_L = ccdb->getForTimeStamp(ConfRPathL.value, cfgCcdbParam.nolaterthan.value); - hR_AL = ccdb->getForTimeStamp(ConfRPathAL.value, cfgCcdbParam.nolaterthan.value); hEff_L = ccdb->getForTimeStamp(ConfEffPathL.value, cfgCcdbParam.nolaterthan.value); hEff_AL = ccdb->getForTimeStamp(ConfEffPathAL.value, cfgCcdbParam.nolaterthan.value); // hweight1 = ccdb->getForTimeStamp(ConfWeightPathLL.value, cfgCcdbParam.nolaterthan.value); @@ -421,7 +409,9 @@ struct lambdaspincorrderived { auto costhetaz1costhetaz2 = -999.0; if (cosDef == 0) { cosThetaDiff = cosDeltaTheta_STAR_naive; - costhetaz1costhetaz2 = (proton1LambdaRF.Pz() * proton2LambdaRF.Pz()) / (proton1LambdaRF.P() * proton2LambdaRF.P()); + if (proton1LambdaRF.P() * proton2LambdaRF.P() != 0.0) { + costhetaz1costhetaz2 = (proton1LambdaRF.Pz() * proton2LambdaRF.Pz()) / (proton1LambdaRF.P() * proton2LambdaRF.P()); + } } else { cosThetaDiff = cosDeltaTheta_hel; costhetaz1costhetaz2 = cosDeltaTheta_beam; @@ -432,38 +422,20 @@ struct lambdaspincorrderived { double deltaRap = std::abs(particle1Dummy.Rapidity() - particle2Dummy.Rapidity()); double deltaR = TMath::Sqrt(deltaEta * deltaEta + deltaPhi * deltaPhi); - double nuaWeightParticle1 = 1.0, epsWeightParticle1 = 1.0; - double nuaWeightParticle2 = 1.0, epsWeightParticle2 = 1.0; - - if (useweight && datatype == 1) { - // particle 1 - { - auto* hR = (tag1 == 0 ? hR_L : hR_AL); - auto* hEff = (tag1 == 0 ? hEff_L : hEff_AL); + double epsWeightParticle1 = 1.0; + double epsWeightParticle2 = 1.0; - float pt = particle1.Pt(); - float eta = particle1.Eta(); - float phi = RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic); - - nuaWeightParticle1 = hR->GetBinContent(hR->FindBin(pt, eta, phi)); - if (replacedFlag == 1) { - epsWeightParticle1 = hEff->GetBinContent(hEff->FindBin(pt, eta, phi)); - } + if (useweight && datatype == 1 && replacedFlag == 1) { + if (tag1 == 0) { + epsWeightParticle1 = hEff_L->GetBinContent(hEff_L->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic))); + } else { + epsWeightParticle1 = hEff_AL->GetBinContent(hEff_AL->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic))); } - - // particle 2 - { - auto* hR = (tag2 == 0 ? hR_L : hR_AL); - auto* hEff = (tag2 == 0 ? hEff_L : hEff_AL); - - float pt = particle2.Pt(); - float eta = particle2.Eta(); - float phi = RecoDecay::constrainAngle(particle2.Phi(), 0.0F, harmonic); - - nuaWeightParticle2 = hR->GetBinContent(hR->FindBin(pt, eta, phi)); - if (replacedFlag == 2) { - epsWeightParticle2 = hEff->GetBinContent(hEff->FindBin(pt, eta, phi)); - } + } else if (useweight && datatype == 1 && replacedFlag == 2) { + if (tag2 == 0) { + epsWeightParticle2 = hEff_L->GetBinContent(hEff_L->FindBin(particle2.Pt(), particle2.Eta(), RecoDecay::constrainAngle(particle2.Phi(), 0.0F, harmonic))); + } else { + epsWeightParticle2 = hEff_AL->GetBinContent(hEff_AL->FindBin(particle2.Pt(), particle2.Eta(), RecoDecay::constrainAngle(particle2.Phi(), 0.0F, harmonic))); } } @@ -492,17 +464,16 @@ struct lambdaspincorrderived { // histos.fill(HIST("hAntiLambdaSameForALAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), mixpairweight); } } else if (datatype == 1) { - // double weight1 = mixpairweight*nuaWeightParticle1*nuaWeightParticle2; - // double weight2 = mixpairweight*nuaWeightParticle1*nuaWeightParticle2; - // double weight3 = mixpairweight*nuaWeightParticle1*nuaWeightParticle2; - // double weight4 = mixpairweight*nuaWeightParticle1*nuaWeightParticle2; - // if (useweight) { - // weight1 = mixpairweight * hweight1->GetBinContent(hweight1->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic))); - // weight2 = mixpairweight * hweight2->GetBinContent(hweight2->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic))); - // weight3 = mixpairweight * hweight3->GetBinContent(hweight3->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic))); - // weight4 = mixpairweight * hweight4->GetBinContent(hweight4->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic))); - // } - double weight = mixpairweight * (nuaWeightParticle1 / epsWeightParticle1) * (nuaWeightParticle2 / epsWeightParticle2); + double weight = mixpairweight; + if (useweight && replacedFlag == 1) { + weight = mixpairweight / epsWeightParticle1; + } + if (useweight && replacedFlag == 2) { + weight = mixpairweight / epsWeightParticle2; + } + if (weight <= 0.0) { + weight = 1.0; + } if (tag1 == 0 && tag2 == 0) { histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight); histos.fill(HIST("hSparseLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); @@ -552,13 +523,6 @@ struct lambdaspincorrderived { proton = ROOT::Math::PtEtaPhiMVector(v0.protonPt(), v0.protonEta(), v0.protonPhi(), o2::constants::physics::MassProton); lambda = ROOT::Math::PtEtaPhiMVector(v0.lambdaPt(), v0.lambdaEta(), v0.lambdaPhi(), v0.lambdaMass()); - auto phiH0 = RecoDecay::constrainAngle(v0.lambdaPhi(), 0.0F, harmonic); - if (v0.v0Status() == 0) { - histos.fill(HIST("hSE_L"), v0.lambdaPt(), v0.lambdaEta(), phiH0); - } else { - histos.fill(HIST("hSE_AL"), v0.lambdaPt(), v0.lambdaEta(), phiH0); - } - for (const auto& v02 : V0s) { if (v02.index() <= v0.index()) { continue; @@ -803,11 +767,11 @@ struct lambdaspincorrderived { int mixes = 0; struct PoolView { AllTrackCandidates* pool; - int nRepl; + double nRepl; int collIdx; }; std::vector usable; - int totalRepl = 0; + double totalRepl = 0; for (auto it = eventPools[bin].rbegin(); it != eventPools[bin].rend() && mixes < nEvtMixing; ++it, ++mixes) { @@ -816,7 +780,7 @@ struct lambdaspincorrderived { if (collision2idx == collision1.index()) continue; // safety - int nRepl = 0; + double nRepl = 0; for (auto& tX : poolB) { if (!selectionV0(tX)) continue; @@ -836,8 +800,8 @@ struct lambdaspincorrderived { if (totalRepl == 0) continue; - const float wBase = 1.0f / static_cast(totalRepl); + const float wBase = 1.0f / totalRepl; // --- Second pass: actually build mixed pairs for the chosen leg for (auto& pv : usable) { auto& poolB = *pv.pool; @@ -878,19 +842,6 @@ struct lambdaspincorrderived { // after mixing with prior events, push current event into the pool auto sliced = V0s.sliceBy(tracksPerCollisionV0, collision1.index()); - - // --- ME singles (one fill per candidate) for this event entering the pool --- - for (auto& t : sliced) { - if (!selectionV0(t)) - continue; - const double phiH = RecoDecay::constrainAngle(t.lambdaPhi(), 0.0F, harmonic); - if (t.v0Status() == 0) { - histos.fill(HIST("hME_L"), t.lambdaPt(), t.lambdaEta(), phiH); - } else { - histos.fill(HIST("hME_AL"), t.lambdaPt(), t.lambdaEta(), phiH); - } - } - eventPools[bin].emplace_back(collision1.index(), std::move(sliced)); if (static_cast(eventPools[bin].size()) > nEvtMixing) { eventPools[bin].pop_front(); From 012249c97a9f1a3e55059782648e0e7b88cc9319 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Tue, 7 Oct 2025 07:37:14 +0200 Subject: [PATCH 649/986] [PWGEM/Dilepton] update treeCreatorElectronMLDDA.cxx to support Zorro (#13252) --- PWGEM/Dilepton/TableProducer/CMakeLists.txt | 2 +- .../treeCreatorElectronMLDDA.cxx | 30 +++++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/PWGEM/Dilepton/TableProducer/CMakeLists.txt b/PWGEM/Dilepton/TableProducer/CMakeLists.txt index 9dbfc1b7d61..ce30fbc4959 100644 --- a/PWGEM/Dilepton/TableProducer/CMakeLists.txt +++ b/PWGEM/Dilepton/TableProducer/CMakeLists.txt @@ -17,7 +17,7 @@ o2physics_add_dpl_workflow(tree-creator-electron-ml o2physics_add_dpl_workflow(tree-creator-electron-ml-dda SOURCES treeCreatorElectronMLDDA.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(skimmer-primary-electron diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx index 38bc78f9f91..f9fe96ca5a1 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx @@ -27,6 +27,7 @@ #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" +#include "EventFiltering/Zorro.h" #include "CCDB/BasicCCDBManager.h" #include "CommonConstants/PhysicsConstants.h" @@ -75,7 +76,8 @@ struct TreeCreatorElectronMLDDA { HistogramRegistry registry{ "registry", { - {"hEventCounter", "hEventCounter", {HistType::kTH1F, {{5, 0.5f, 5.5f}}}}, + {"Event/hEventCounter", "hEventCounter", {HistType::kTH1F, {{5, 0.5f, 5.5f}}}}, + {"Event/hNumContrib", "Number of contributors to PV;N_{contrib}^{PV};Entries", {HistType::kTH1F, {{65001, -0.5f, 65000.5f}}}}, {"V0/hAP", "Armenteros Podolanski", {HistType::kTH2F, {{200, -1.f, +1.f}, {250, 0, 0.25}}}}, {"V0/hXY_Gamma", "photon conversion point in XY;X (cm);Y (cm)", {HistType::kTH2F, {{400, -100, +100}, {400, -100, +100}}}}, {"V0/hMassGamma_Rxy", "V0 mass gamma", {HistType::kTH2F, {{200, 0, 100}, {100, 0, 0.1}}}}, @@ -123,6 +125,12 @@ struct TreeCreatorElectronMLDDA { Configurable d_bz_input{"d_bz_input", -999, "bz field, -999 is automatic"}; Configurable useMatCorrType{"useMatCorrType", 2, "0: none, 1: TGeo, 2: LUT"}; + // for zorro + Configurable cfg_swt_names{"cfg_swt_names", "fHighTrackMult,fHighFt0cFv0Mult", "comma-separated software trigger names"}; + o2::framework::Configurable ccdbPathSoftwareTrigger{"ccdbPathSoftwareTrigger", "EventFiltering/Zorro/", "ccdb path for ZORRO objects"}; + Configurable bcMarginForSoftwareTrigger{"bcMarginForSoftwareTrigger", 100, "Number of BCs of margin for software triggers"}; + Configurable cfgUseZorro{"cfgUseZorro", false, "flag to analyze software-triggered data"}; + Configurable downscaling_electron_highP{"downscaling_electron_highP", 1.1, "down scaling factor to store electron at high p"}; Configurable downscaling_pion_highP{"downscaling_pion_highP", 1.1, "down scaling factor to store pion at high p"}; Configurable downscaling_kaon_highP{"downscaling_kaon_highP", 1.1, "down scaling factor to store kaon at high p"}; @@ -167,6 +175,8 @@ struct TreeCreatorElectronMLDDA { Configurable cfgRequireGoodITSLayer3{"cfgRequireGoodITSLayer3", false, "number of inactive chips on ITS layer 3 are below threshold "}; Configurable cfgRequireGoodITSLayer0123{"cfgRequireGoodITSLayer0123", false, "number of inactive chips on ITS layers 0-3 are below threshold "}; Configurable cfgRequireGoodITSLayersAll{"cfgRequireGoodITSLayersAll", false, "number of inactive chips on all ITS layers are below threshold "}; + Configurable cfgNumContribMin{"cfgNumContribMin", 0, "min. numContrib"}; + Configurable cfgNumContribMax{"cfgNumContribMax", 65000, "max. numContrib"}; } eventcuts; struct : ConfigurableGroup { @@ -287,6 +297,7 @@ struct TreeCreatorElectronMLDDA { o2::base::MatLayerCylSet* lut = nullptr; o2::dataformats::DCA mDcaInfoCov; o2::aod::rctsel::RCTFlagsChecker rctChecker; + Zorro zorro; std::mt19937 engine; std::uniform_real_distribution dist01; @@ -325,6 +336,13 @@ struct TreeCreatorElectronMLDDA { return; } + if (cfgUseZorro) { + zorro.setCCDBpath(ccdbPathSoftwareTrigger); + zorro.setBCtolerance(bcMarginForSoftwareTrigger); // this does nothing. + zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), cfg_swt_names.value); + zorro.populateHistRegistry(registry, bc.runNumber()); + } + // load matLUT for this timestamp if (!lut) { LOG(info) << "Loading material look-up table for timestamp: " << bc.timestamp(); @@ -762,6 +780,7 @@ struct TreeCreatorElectronMLDDA { Filter collisionFilter_track_occupancy = eventcuts.cfgTrackOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgTrackOccupancyMax; Filter collisionFilter_ft0c_occupancy = eventcuts.cfgFT0COccupancyMin <= o2::aod::evsel::ft0cOccupancyInTimeRange && o2::aod::evsel::ft0cOccupancyInTimeRange < eventcuts.cfgFT0COccupancyMax; + Filter collisionFilter_numContrib = eventcuts.cfgNumContribMin <= o2::aod::collision::numContrib && o2::aod::collision::numContrib < eventcuts.cfgNumContribMax; Filter collisionFilter_common = nabs(o2::aod::collision::posZ) < 10.f && o2::aod::evsel::sel8 == true; using filteredMyCollisions = soa::Filtered; @@ -777,7 +796,7 @@ struct TreeCreatorElectronMLDDA { { stored_trackIds.reserve(tracks.size()); for (const auto& collision : collisions) { - registry.fill(HIST("hEventCounter"), 1.0); // all + registry.fill(HIST("Event/hEventCounter"), 1.0); // all auto bc = collision.template foundBC_as(); initCCDB(bc); @@ -786,10 +805,15 @@ struct TreeCreatorElectronMLDDA { continue; } + if (cfgUseZorro && !zorro.isSelected(bc.globalBC(), bcMarginForSoftwareTrigger)) { + continue; + } + if (cfgRequireGoodRCT && !rctChecker.checkTable(collision)) { continue; } - registry.fill(HIST("hEventCounter"), 2.0); // selected + registry.fill(HIST("Event/hEventCounter"), 2.0); // selected + registry.fill(HIST("Event/hNumContrib"), collision.numContrib()); auto v0s_coll = v0s.sliceBy(perCollision_v0, collision.globalIndex()); for (const auto& v0 : v0s_coll) { From 79182c65782d8158a1bc007f91d3220e34dbd6a9 Mon Sep 17 00:00:00 2001 From: suyoupeng <109774812+15071832337@users.noreply.github.com> Date: Tue, 7 Oct 2025 15:52:06 +0800 Subject: [PATCH 650/986] [PWGLF] Local polarization of Lambda induced by jets in Run3 pp collisions at 13.6 TeV (#13159) --- .../Strangeness/lambdaJetpolarization.cxx | 440 ++++++++++++++++-- 1 file changed, 393 insertions(+), 47 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx b/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx index d5648fada70..2e66bc08385 100644 --- a/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx @@ -79,6 +79,7 @@ struct LfMyV0s { Configurable maxChi2ITS{"maxChi2ITS", 36.0f, "max chi2 per cluster ITS"}; Configurable requireTOF{"requireTOF", false, "require TOF hit"}; Configurable requireITS{"requireITS", false, "require ITS hit"}; + Configurable require_max_tpcSharedCls{"require_max_tpcSharedCls", false, "require ITS hit"}; Configurable max_tpcSharedCls{"max_tpcSharedCls", 100, "max_tpcSharedCls"}; Configurable max_chi2_TPC{"max_chi2_TPC", 4, "max_chi2_TPC"}; Configurable max_chi2_ITS{"max_chi2_ITS", 36, "max_chi2_ITS"}; @@ -151,7 +152,10 @@ struct LfMyV0s { const AxisSpec axisPz{100, -10, 10, "#pz (GeV/c)"}; const AxisSpec axisPT{200, 0, 50, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec axisPhi{100, -3.14, 3.14, "#Phi"}; - const AxisSpec axisMass{100, 0, 2, "Mass(GeV/c^{2})"}; + const AxisSpec axisTheta{100, 0, 3.14, "#Theta"}; + const AxisSpec axisMass{100, 0.9, 1.0, "Mass(GeV/c^{2})"}; + const AxisSpec axisCostheta{100, -1, 1, "Cos(#theta^{*}_{p})"}; + const AxisSpec axisSinPhi{100, -1, 1, "Sin(#phi^{*}_{p})"}; const AxisSpec JetaxisEta{30, -1.5, +1.5, "#eta"}; const AxisSpec JetaxisPhi{200, -1, +7, "#phi"}; @@ -216,7 +220,6 @@ struct LfMyV0s { registry.add("V0LambdaprotonPhi", "V0LambdaprotonPhi", {HistType::kTH1F, {{200, -TMath::Pi() / 2, TMath::Pi() / 2}}}); registry.add("V0AntiLambdaprotonPhi", "V0AntiLambdaprotonPhi", {HistType::kTH1F, {{200, -TMath::Pi() / 2, TMath::Pi() / 2}}}); - registryData.add("number_of_events_data", "number of events in data", HistType::kTH1D, {{20, 0, 20, "Event Cuts"}}); registryData.add("number_of_events_vsmultiplicity", "number of events in data vs multiplicity", HistType::kTH1D, {{101, 0, 101, "Multiplicity percentile"}}); registryData.add("h_track_pt", "track pT;#it{p}_{T,track} (GeV/#it{c});entries", kTH1F, {{200, 0., 200.}}); registryData.add("h_track_eta", "track #eta;#eta_{track};entries", kTH1F, {{100, -1.f, 1.f}}); @@ -254,24 +257,57 @@ struct LfMyV0s { registryData.add("V0pyInRest_frame", "V0pyInRest_frame", kTH1F, {axisPy}); registryData.add("V0pzInRest_frame", "V0pzInRest_frame", kTH1F, {axisPz}); - registryData.add("V0protonpxInLab", "V0protonpxInLab", kTH1F, {axisPx}); - registryData.add("V0protonpyInLab", "V0protonpyInLab", kTH1F, {axisPy}); - registryData.add("V0protonpzInLab", "V0protonpzInLab", kTH1F, {axisPz}); - registryData.add("V0protonphiInLab", "V0protonphiInLab", kTH1F, {axisPhi}); - - registryData.add("V0protonpxInRest_frame", "V0protonpxInRest_frame", kTH1F, {axisPx}); - registryData.add("V0protonpyInRest_frame", "V0protonpyInRest_frame", kTH1F, {axisPy}); - registryData.add("V0protonpzInRest_frame", "V0protonpzInRest_frame", kTH1F, {axisPz}); - registryData.add("V0protonMassInRest_frame", "V0protonMassInRest_frame", kTH1F, {axisMass}); - registryData.add("V0protonphiInRest_frame", "V0protonphiInRest_frame", kTH1F, {axisPhi}); - - registryData.add("V0protonpxInJetV0frame", "V0protonpxInJetV0frame", kTH1F, {axisPx}); - registryData.add("V0protonpyInJetV0frame", "V0protonpyInJetV0frame", kTH1F, {axisPy}); - registryData.add("V0protonpzInJetV0frame", "V0protonpzInJetV0frame", kTH1F, {axisPz}); + registryData.add("protonQA/V0protonpxInLab", "V0protonpxInLab", kTH1F, {axisPx}); + registryData.add("protonQA/V0protonpyInLab", "V0protonpyInLab", kTH1F, {axisPy}); + registryData.add("protonQA/V0protonpzInLab", "V0protonpzInLab", kTH1F, {axisPz}); + registryData.add("protonQA/V0protonMassInLab", "V0protonMassInLab", kTH1F, {axisMass}); + registryData.add("protonQA/V0protonphiInLab", "V0protonphiInLab", kTH1F, {axisPhi}); + registryData.add("protonQA/V0protonthetaInLab", "V0protonthetaInLab", kTH1F, {axisTheta}); + registryData.add("protonQA/V0protoncosthetaInLab", "V0protoncosthetaInLab", kTH1F, {axisCostheta}); + registryData.add("protonQA/profileprotonsinthetaInLab", "Invariant Mass vs sin(theta)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); + registryData.add("protonQA/profileprotonsinphiInLab", "Invariant Mass vs sin(phi)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); + registryData.add("protonQA/profileprotoncosSquarethetaInLab", "Invariant Mass vs cos^2(theta)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); + + registryData.add("protonQA/V0protonpxInRest_frame", "V0protonpxInRest_frame", kTH1F, {axisPx}); + registryData.add("protonQA/V0protonpyInRest_frame", "V0protonpyInRest_frame", kTH1F, {axisPy}); + registryData.add("protonQA/V0protonpzInRest_frame", "V0protonpzInRest_frame", kTH1F, {axisPz}); + registryData.add("protonQA/V0protonMassInRest_frame", "V0protonMassInRest_frame", kTH1F, {axisMass}); + registryData.add("protonQA/V0protonphiInRest_frame", "V0protonphiInRest_frame", kTH1F, {axisPhi}); + registryData.add("protonQA/V0protonthetaInRest_frame", "V0protonthetaInRest_frame", kTH1F, {axisTheta}); + registryData.add("protonQA/V0protoncosthetaInV0frame", "V0protoncosthetaInV0frame", kTH1F, {axisCostheta}); + registryData.add("protonQA/profileprotonsinthetaInV0frame", "Invariant Mass vs sin(theta)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); + registryData.add("protonQA/profileprotonsinphiInV0frame", "Invariant Mass vs sin(phi)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); + registryData.add("protonQA/profileprotoncosSquarethetaInV0frame", "Invariant Mass vs cos^2(theta)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); + + registryData.add("protonQA/V0protonpxInJetframe", "V0protonpxInJetframe", kTH1F, {axisPx}); + registryData.add("protonQA/V0protonpyInJetframe", "V0protonpyInJetframe", kTH1F, {axisPy}); + registryData.add("protonQA/V0protonpzInJetframe", "V0protonpzInJetframe", kTH1F, {axisPz}); + registryData.add("protonQA/V0protonphiInJetframe", "V0protonphiInJetframe", kTH1F, {axisPhi}); + registryData.add("protonQA/V0protonthetaInJetframe", "V0protonthetaInJetframe", kTH1F, {axisTheta}); + registryData.add("protonQA/V0protoncosthetaInJetframe", "V0protoncosthetaInJetframe", kTH1F, {axisCostheta}); + registryData.add("protonQA/profileprotonsinthetaInJetframe", "Invariant Mass vs sin(theta)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); + registryData.add("protonQA/profileprotonsinphiInJetframe", "Invariant Mass vs sin(phi)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); + registryData.add("protonQA/profileprotoncosSquarethetaInJetframe", "Invariant Mass vs cos^2(theta)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); + registryData.add("protonQA/V0protonMassInJetframe", "V0protonMassInJetframe", kTH1F, {axisMass}); + + registryData.add("protonQA/V0protonpxInJetV0frame", "V0protonpxInJetV0frame", kTH1F, {axisPx}); + registryData.add("protonQA/V0protonpyInJetV0frame", "V0protonpyInJetV0frame", kTH1F, {axisPy}); + registryData.add("protonQA/V0protonpzInJetV0frame", "V0protonpzInJetV0frame", kTH1F, {axisPz}); + registryData.add("protonQA/V0protonphiInJetV0frame", "V0protonphiInJetV0frame", kTH1F, {axisPhi}); + registryData.add("protonQA/V0protonthetaInJetV0frame", "V0protonthetaInJetV0frame", kTH1F, {axisTheta}); + registryData.add("protonQA/V0protoncosthetaInJetV0", "V0protoncosthetaInJetV0", kTH1F, {axisCostheta}); + registryData.add("protonQA/V0protonMassInJetV0frame", "V0protonMassInJetV0frame", kTH1F, {axisMass}); + registryData.add("protonQA/profileprotonsinthetaInJetV0frame", "Invariant Mass vs sin(theta)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); + registryData.add("protonQA/profileprotonsinphiInJetV0frame", "Invariant Mass vs sin(phi)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); + registryData.add("protonQA/profileprotoncosSquarethetaInJetV0frame", "Invariant Mass vs cos^2(theta)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); registryData.add("V0LambdapxInJetV0frame", "V0LambdapxInJetV0frame", kTH1F, {axisPx}); registryData.add("V0LambdapyInJetV0frame", "V0LambdapyInJetV0frame", kTH1F, {axisPy}); registryData.add("V0LambdapzInJetV0frame", "V0LambdapzInJetV0frame", kTH1F, {axisPz}); + + registryData.add("hprotonPhi", "hprotonPhi", kTH1F, {axisPhi}); + registryData.add("hantiprotonPhi", "hantiprotonPhi", kTH1F, {axisPhi}); + registryData.add("hLambdamassandSinPhi", "hLambdamassandSinPhi", kTH2F, {{200, 0.9, 1.2}, {200, -1, 1}}); registryData.add("profileLambda", "Invariant Mass vs sin(phi)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); registryData.add("hLambdaPhiandSinPhi", "hLambdaPhiandSinPhi", kTH2F, {{200, -TMath::Pi() / 2, TMath::Pi() / 2}, {200, -1, 1}}); @@ -287,6 +323,11 @@ struct LfMyV0s { registryData.add("TProfile2DLambdaPtMassCosSquareTheta", "", kTProfile2D, {TProfile2DaxisMass, TProfile2DaxisPt}); registryData.add("TProfile2DAntiLambdaPtMassCosSquareTheta", "", kTProfile2D, {TProfile2DaxisMass, TProfile2DaxisPt}); + registryData.add("TProfile2DLambdaMassDeltaPhi", "", kTProfile2D, {{200, -TMath::Pi(), TMath::Pi(), "#Delta#varphi"}, TProfile2DaxisMass}); + registryData.add("TProfile2DAntiLambdaMassDeltaPhi", "", kTProfile2D, {{200, -TMath::Pi(), TMath::Pi(), "#Delta#varphi"}, TProfile2DaxisMass}); + registryData.add("hprotonThetaInLab", "hprotonThetaInLab", kTH1F, {axisTheta}); + registryData.add("hprotonThetaInV0", "hprotonThetaInV0", kTH1F, {axisTheta}); + registryData.add("hprotonThetaInJetV0", "hprotonThetaInJetV0", kTH1F, {axisTheta}); registryData.add("hNEvents", "hNEvents", {HistType::kTH1I, {{10, 0.f, 10.f}}}); registryData.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(1, "all"); @@ -299,6 +340,30 @@ struct LfMyV0s { registryData.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(8, "isGoodZvtxFT0vsPV"); registryData.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(9, "Applied selected"); + if (doQA) { + registryData.add("QA/hv0sSelection", ";Sel", {HistType::kTH1D, {{22, 0., 22.}}}); + registryData.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(1, "all"); + registryData.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(2, "Event selection"); + registryData.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(3, "Radius"); + registryData.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(4, "Eta Daughters"); + registryData.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(5, "Dau DCA to PV"); + registryData.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(6, "DCA Daughters"); + registryData.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(7, "min ITS hits"); + registryData.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(8, "has TOF 1 Leg"); + registryData.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(9, "has TOF 2 Legs"); + registryData.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(10, "TPC NCl"); + registryData.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(11, "TPC Cls Shared"); + registryData.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(12, "ITS Chi2"); + registryData.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(13, "TPC Chi2"); + registryData.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(14, "cosPA"); + registryData.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(15, "rapidity"); + registryData.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(16, "ctau"); + registryData.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(17, "v0 rej"); + registryData.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(18, "TPC nsigma Neg Dau"); + registryData.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(19, "TPC nsigma Pos Dau"); + registryData.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(20, "Armenteros-Podolansky"); + } + registryV0Data.add("hLambdaPt", "hLambdaPt", {HistType::kTH1F, {ptAxis}}); registryV0Data.add("hAntiLambdaPt", "hAntiLambdaPt", {HistType::kTH1F, {ptAxis}}); @@ -372,6 +437,15 @@ struct LfMyV0s { registryLongitudinalPolarization.add("hLambdamassandCosthetaInV0", "hLambdamassandCosthetaInV0", kTH2F, {{200, 0.9, 1.2}, {200, -1, 1}}); registryLongitudinalPolarization.add("TProfile2DLambdaPtMassCostheta", "", kTProfile2D, {TProfile2DaxisMass, TProfile2DaxisPt}); registryLongitudinalPolarization.add("TProfile2DLambdaPtMassCosSquareTheta", "", kTProfile2D, {TProfile2DaxisMass, TProfile2DaxisPt}); + registryLongitudinalPolarization.add("TH2FLambdaPtCostheta", "", kTH2F, {axisCostheta, TProfile2DaxisPt}); + + registryLongitudinalPolarization.add("hprotonThetaInLab", "hprotonThetaInLab", kTH1F, {axisTheta}); + registryLongitudinalPolarization.add("hprotonPhiInLab", "hprotonPhiInLab", kTH1F, {axisPhi}); + registryLongitudinalPolarization.add("hprotonPhiInV0", "hprotonPhiInV0", kTH1F, {axisPhi}); + registryLongitudinalPolarization.add("hAntiprotonThetaInLab", "hAntiprotonThetaInLab", kTH1F, {axisTheta}); + + registryLongitudinalPolarization.add("hprotonTheta", "hprotonTheta", kTH1F, {axisTheta}); + registryLongitudinalPolarization.add("hAntiprotonTheta", "hAntiprotonTheta", kTH1F, {axisTheta}); registryLongitudinalPolarization.add("hantiprotoncosthetainV0", "hantiprotoncosthetainV0", kTH1F, {{200, -1.f, 1.f}}); registryLongitudinalPolarization.add("hantiprotoncosSquarethetainV0", "hantiprotoncosSquarethetainV0", kTH1F, {{200, -1.f, 1.f}}); @@ -380,6 +454,7 @@ struct LfMyV0s { registryLongitudinalPolarization.add("TProfile2DAntiLambdaPtMassCosSquareTheta", "TProfile2DAntiLambdaPtMassCosSquareTheta", kTProfile2D, {TProfile2DaxisMass, TProfile2DaxisPt}); registryLongitudinalPolarization.add("TProfile1DLambdaPtMassCostheta", "Invariant Mass vs cos(#theta)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); registryLongitudinalPolarization.add("TProfile1DAntiLambdaPtMassCostheta", "Invariant Mass vs cos(#theta)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); + registryLongitudinalPolarization.add("TH2FAntiLambdaPtCostheta", "", kTH2F, {axisCostheta, TProfile2DaxisPt}); if (doQA) { registryLongitudinalPolarization.add("QA/hv0sSelection", ";Sel", {HistType::kTH1D, {{22, 0., 22.}}}); @@ -912,6 +987,205 @@ struct LfMyV0s { return true; } + template + bool registryDataAcceptV0Lambda(const Lambda& v0, const TrackPos& ptrack, const TrackNeg& ntrack, const TCollision& collision) + { + + int evFlag = 0; + if (collision.isInelGt0()) { + evFlag = 1; + } + + registryData.fill(HIST("QA/hv0sSelection"), 0.5); + + if (evSel && evFlag < 1) + return false; + + registryData.fill(HIST("QA/hv0sSelection"), 1.5); + + if (v0.v0radius() < minimumV0Radius || v0.v0radius() > maximumV0Radius) + return false; + + registryData.fill(HIST("QA/hv0sSelection"), 2.5); + + if (TMath::Abs(ptrack.eta()) > V0tracketaMax || TMath::Abs(ntrack.eta()) > V0tracketaMax) { + return false; + } + registryData.fill(HIST("QA/hv0sSelection"), 3.5); + + if (std::fabs(v0.dcapostopv()) < dcapostoPVmin) + return false; + if (std::fabs(v0.dcanegtopv()) < dcanegtoPVmin) + return false; + registryData.fill(HIST("QA/hv0sSelection"), 4.5); + + if (std::fabs(v0.dcaV0daughters()) > dcaV0DaughtersMax) + return false; + registryData.fill(HIST("QA/hv0sSelection"), 5.5); + + if (requireITS && ptrack.itsNCls() < minITSnCls) + return false; + if (requireITS && ntrack.itsNCls() < minITSnCls) + return false; + registryData.fill(HIST("QA/hv0sSelection"), 6.5); + + if (hasTOF1Leg && !ptrack.hasTOF() && !ntrack.hasTOF()) + return false; + registryData.fill(HIST("QA/hv0sSelection"), 7.5); + + if (hasTOF2Leg && (!ptrack.hasTOF() || !ntrack.hasTOF())) + return false; + registryData.fill(HIST("QA/hv0sSelection"), 8.5); + + if (ptrack.tpcNClsCrossedRows() < minNCrossedRowsTPC) + return false; + if (ntrack.tpcNClsCrossedRows() < minNCrossedRowsTPC) + return false; + registryData.fill(HIST("QA/hv0sSelection"), 9.5); + + if (require_max_tpcSharedCls && ptrack.tpcNClsShared() > max_tpcSharedCls) + return false; + if (require_max_tpcSharedCls && ntrack.tpcNClsShared() > max_tpcSharedCls) + return false; + registryData.fill(HIST("QA/hv0sSelection"), 10.5); + + if (ptrack.itsChi2NCl() > max_chi2_ITS) + return false; + if (ntrack.itsChi2NCl() > max_chi2_ITS) + return false; + registryData.fill(HIST("QA/hv0sSelection"), 11.5); + + if (ptrack.tpcChi2NCl() > max_chi2_TPC) + return false; + if (ntrack.tpcChi2NCl() > max_chi2_TPC) + return false; + registryData.fill(HIST("QA/hv0sSelection"), 12.5); + + if (v0.v0cosPA() < v0cospaMin) + return false; + registryData.fill(HIST("QA/hv0sSelection"), 13.5); + + if (v0.yLambda() < yMin || v0.yLambda() > yMax) { + return false; + } + registryData.fill(HIST("QA/hv0sSelection"), 14.5); + + float ctauLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0; + if (ctauLambda >= CtauLambda) + return false; + registryData.fill(HIST("QA/hv0sSelection"), 15.5); + + if (TMath::Abs(v0.mK0Short() - o2::constants::physics::MassK0Short) < v0rejLambda) { + return false; + } + if (std::abs(v0.mLambda() - o2::constants::physics::MassLambda0) > v0accLambda) { + return false; + } + + registryData.fill(HIST("QA/hv0sSelection"), 16.5); + + if (ntrack.tpcNSigmaPi() < nsigmaTPCmin || ntrack.tpcNSigmaPi() > nsigmaTPCmax) + return false; + registryData.fill(HIST("QA/hv0sSelection"), 17.5); + + if (ptrack.tpcNSigmaPr() < nsigmaTPCmin || ptrack.tpcNSigmaPr() > nsigmaTPCmax) + return false; + registryData.fill(HIST("QA/hv0sSelection"), 18.5); + + if (doArmenterosCut && v0.qtarm() > (paramArmenterosCut * std::abs(v0.alpha()))) + return false; + registryData.fill(HIST("QA/hv0sSelection"), 19.5); + + return true; + } + + template + bool registryDataAcceptV0AntiLambda(const Lambda& v0, const TrackPos& ptrack, const TrackNeg& ntrack, const TCollision& collision) + { + + int evFlag = 0; + if (collision.isInelGt0()) { + evFlag = 1; + } + + if (evSel && evFlag < 1) + return false; + + if (v0.v0radius() < minimumV0Radius || v0.v0radius() > maximumV0Radius) + return false; + + if (TMath::Abs(ptrack.eta()) > V0tracketaMax || TMath::Abs(ntrack.eta()) > V0tracketaMax) { + return false; + } + + if (std::fabs(v0.dcapostopv()) < dcapostoPVmin) + return false; + if (std::fabs(v0.dcanegtopv()) < dcanegtoPVmin) + return false; + + if (std::fabs(v0.dcaV0daughters()) > dcaV0DaughtersMax) + return false; + + if (requireITS && ptrack.itsNCls() < minITSnCls) + return false; + if (requireITS && ntrack.itsNCls() < minITSnCls) + return false; + + if (hasTOF1Leg && !ptrack.hasTOF() && !ntrack.hasTOF()) + return false; + + if (hasTOF2Leg && (!ptrack.hasTOF() || !ntrack.hasTOF())) + return false; + + if (ptrack.tpcNClsCrossedRows() < minNCrossedRowsTPC) + return false; + if (ntrack.tpcNClsCrossedRows() < minNCrossedRowsTPC) + return false; + + if (ptrack.tpcNClsShared() > max_tpcSharedCls) + return false; + if (ntrack.tpcNClsShared() > max_tpcSharedCls) + return false; + + if (ptrack.itsChi2NCl() > max_chi2_ITS) + return false; + if (ntrack.itsChi2NCl() > max_chi2_ITS) + return false; + + if (ptrack.tpcChi2NCl() > max_chi2_TPC) + return false; + if (ntrack.tpcChi2NCl() > max_chi2_TPC) + return false; + + if (v0.v0cosPA() < v0cospaMin) + return false; + + if (v0.yLambda() < yMin || v0.yLambda() > yMax) { + return false; + } + + float ctauAntiLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0Bar; + if (ctauAntiLambda >= CtauLambda) + return false; + + if (TMath::Abs(v0.mK0Short() - o2::constants::physics::MassK0Short) < v0rejLambda) { + return false; + } + if (std::abs(v0.mAntiLambda() - o2::constants::physics::MassLambda0) > v0accLambda) { + return false; + } + if (ntrack.tpcNSigmaPr() < nsigmaTPCmin || ntrack.tpcNSigmaPr() > nsigmaTPCmax) + return false; + + if (ptrack.tpcNSigmaPi() < nsigmaTPCmin || ptrack.tpcNSigmaPi() > nsigmaTPCmax) + return false; + + if (doArmenterosCut && v0.qtarm() > (paramArmenterosCut * std::abs(v0.alpha()))) + return false; + + return true; + } + // Lambda Selections template bool passedLambdaSelection(const Lambda& v0, const TrackPos& ptrack, const TrackNeg& ntrack) @@ -1196,16 +1470,14 @@ struct LfMyV0s { } using SelCollisions = soa::Join; + using SelV0Collisions = soa::Join; using StrHadronDaughterTracks = soa::Join; - void processData(SelCollisions::iterator const& collision, aod::V0Datas const& fullV0s, StrHadronDaughterTracks const& tracks) + void processData(SelV0Collisions::iterator const& collision, aod::V0Datas const& fullV0s, StrHadronDaughterTracks const& tracks) { - registryData.fill(HIST("number_of_events_data"), 0.5); - // event selection - if (!collision.sel8() || std::fabs(collision.posZ()) > zVtx) { + if (!AcceptEvent(collision)) { return; } - // event counter: after event selection - registryData.fill(HIST("number_of_events_data"), 1.5); + // event selection // loop over reconstructed tracks std::vector fjParticles; for (auto const& track : tracks) { @@ -1226,8 +1498,6 @@ struct LfMyV0s { // reject empty events if (fjParticles.size() < 1) return; - registryData.fill(HIST("number_of_events_data"), 2.5); - // cluster particles using the anti-kt algorithm fastjet::RecombinationScheme recombScheme = fastjet::E_scheme; fastjet::JetDefinition jetDef(fastjet::antikt_algorithm, rJet, recombScheme); @@ -1287,7 +1557,7 @@ struct LfMyV0s { if (!isAtLeastOneJetSelected) { return; } - registryData.fill(HIST("number_of_events_data"), 3.5); + // Event multiplicity const float multiplicity = collision.centFT0M(); registryData.fill(HIST("number_of_events_vsmultiplicity"), multiplicity); @@ -1298,11 +1568,11 @@ struct LfMyV0s { const auto& pos = v0.posTrack_as(); const auto& neg = v0.negTrack_as(); TVector3 v0dir(v0.px(), v0.py(), v0.pz()); - if (passedLambdaSelection(v0, pos, neg)) { + if (registryDataAcceptV0Lambda(v0, pos, neg, collision)) { V0Numbers = V0Numbers + 1; registryData.fill(HIST("LambdaPtMass"), v0.pt(), v0.mLambda()); } - if (passedAntiLambdaSelection(v0, pos, neg)) { + if (registryDataAcceptV0AntiLambda(v0, pos, neg, collision)) { AntiV0Numbers = AntiV0Numbers + 1; registryData.fill(HIST("AntiLambdaPtMass"), v0.pt(), v0.mAntiLambda()); } @@ -1311,7 +1581,7 @@ struct LfMyV0s { // calculate lambda polarization induced by jet - if (V0Numbers == 0) { + if (V0Numbers == 0 && AntiV0Numbers == 0) { return; } if (maxJetpx == 0) { @@ -1325,15 +1595,15 @@ struct LfMyV0s { const auto& neg = candidate.negTrack_as(); TVector3 v0dir(candidate.px(), candidate.py(), candidate.pz()); - if (passedLambdaSelection(candidate, pos, neg)) { + if (registryDataAcceptV0Lambda(candidate, pos, neg, collision)) { registryData.fill(HIST("hMassLambda"), candidate.mLambda()); registryData.fill(HIST("V0pTInLab"), candidate.pt()); registryData.fill(HIST("V0pxInLab"), candidate.px()); registryData.fill(HIST("V0pyInLab"), candidate.py()); registryData.fill(HIST("V0pzInLab"), candidate.pz()); - registryData.fill(HIST("V0protonpxInLab"), pos.px()); - registryData.fill(HIST("V0protonpyInLab"), pos.py()); - registryData.fill(HIST("V0protonpzInLab"), pos.pz()); + registryData.fill(HIST("protonQA/V0protonpxInLab"), pos.px()); + registryData.fill(HIST("protonQA/V0protonpyInLab"), pos.py()); + registryData.fill(HIST("protonQA/V0protonpzInLab"), pos.pz()); double PLambda = sqrt(candidate.px() * candidate.px() + candidate.py() * candidate.py() + candidate.pz() * candidate.pz()); double ELambda = sqrt(candidate.mLambda() * candidate.mLambda() + PLambda * PLambda); @@ -1351,9 +1621,6 @@ struct LfMyV0s { registryData.fill(HIST("V0pyInRest_frame"), V0InV0(2, 0)); registryData.fill(HIST("V0pzInRest_frame"), V0InV0(3, 0)); - double protonsinPhiInLab = candidate.py() / sqrt(candidate.px() * candidate.px() + candidate.py() * candidate.py()); - registryData.fill(HIST("V0protonphiInLab"), protonsinPhiInLab); - TMatrixD lambdaInJet(4, 1); lambdaInJet = MyTMatrixTranslationToJet(maxJetpx, maxJetpy, maxJetpz, candidate.px(), candidate.py(), candidate.pz()) * pLabV0; @@ -1368,28 +1635,82 @@ struct LfMyV0s { pLabproton(1, 0) = pos.px(); pLabproton(2, 0) = pos.py(); pLabproton(3, 0) = pos.pz(); + double protonsinPhiInLab = pLabproton(2, 0) / sqrt(pLabproton(1, 0) * pLabproton(1, 0) + pLabproton(2, 0) * pLabproton(2, 0)); + double protoncosthetaInLab = pLabproton(3, 0) / sqrt(pLabproton(1, 0) * pLabproton(1, 0) + pLabproton(2, 0) * pLabproton(2, 0) + pLabproton(3, 0) * pLabproton(3, 0)); + double protonPtInLab = sqrt(pLabproton(1, 0) * pLabproton(1, 0) + pLabproton(2, 0) * pLabproton(2, 0)); + double protonPInLab = sqrt(pLabproton(1, 0) * pLabproton(1, 0) + pLabproton(2, 0) * pLabproton(2, 0) + pLabproton(3, 0) * pLabproton(3, 0)); + double protonsinThetaInLab = protonPtInLab / protonPInLab; + double protonMassInLab = sqrt(pLabproton(0, 0) * pLabproton(0, 0) - pLabproton(1, 0) * pLabproton(1, 0) - pLabproton(2, 0) * pLabproton(2, 0) - pLabproton(3, 0) * pLabproton(3, 0)); + + registryData.fill(HIST("protonQA/V0protonphiInLab"), TMath::ASin(protonsinPhiInLab)); + registryData.fill(HIST("protonQA/V0protonThetaInLab"), TMath::ASin(protonsinThetaInLab)); + registryData.fill(HIST("protonQA/V0protoncosthetaInLab"), protoncosthetaInLab); + registryData.fill(HIST("protonQA/profileprotonsinthetaInLab"), candidate.mLambda(), protonsinThetaInLab); + registryData.fill(HIST("protonQA/profileprotonsinphiInLab"), candidate.mLambda(), protonsinPhiInLab); + registryData.fill(HIST("protonQA/profileprotoncosSquarethetaInLab"), candidate.mLambda(), protoncosthetaInLab * protoncosthetaInLab); + registryData.fill(HIST("protonQA/V0protonMassInLab"), protonMassInLab); TMatrixD protonInV0(4, 1); protonInV0 = LorentzTransInV0frame(ELambda, candidate.px(), candidate.py(), candidate.pz()) * pLabproton; double protonMassInV0 = sqrt(protonInV0(0, 0) * protonInV0(0, 0) - protonInV0(1, 0) * protonInV0(1, 0) - protonInV0(2, 0) * protonInV0(2, 0) - protonInV0(3, 0) * protonInV0(3, 0)); - registryData.fill(HIST("V0protonMassInRest_frame"), protonMassInV0); - registryData.fill(HIST("V0protonpxInRest_frame"), protonInV0(1, 0)); - registryData.fill(HIST("V0protonpyInRest_frame"), protonInV0(2, 0)); - registryData.fill(HIST("V0protonpzInRest_frame"), protonInV0(3, 0)); + double protonPInV0 = sqrt(protonInV0(1, 0) * protonInV0(1, 0) + protonInV0(2, 0) * protonInV0(2, 0) + protonInV0(3, 0) * protonInV0(3, 0)); + double protonPtInV0 = sqrt(protonInV0(1, 0) * protonInV0(1, 0) + protonInV0(2, 0) * protonInV0(2, 0)); + double protonsinThetaInV0 = protonPtInV0 / protonPInV0; + + registryData.fill(HIST("protonQA/V0protonMassInRest_frame"), protonMassInV0); + registryData.fill(HIST("protonQA/V0protonpxInRest_frame"), protonInV0(1, 0)); + registryData.fill(HIST("protonQA/V0protonpyInRest_frame"), protonInV0(2, 0)); + registryData.fill(HIST("protonQA/V0protonpzInRest_frame"), protonInV0(3, 0)); double protonsinPhiInV0frame = protonInV0(2, 0) / sqrt(protonInV0(1, 0) * protonInV0(1, 0) + protonInV0(2, 0) * protonInV0(2, 0)); - registryData.fill(HIST("V0protonphiInRest_frame"), protonsinPhiInV0frame); + double protoncosthetaInV0frame = protonInV0(3, 0) / sqrt(protonInV0(1, 0) * protonInV0(1, 0) + protonInV0(2, 0) * protonInV0(2, 0) + protonInV0(3, 0) * protonInV0(3, 0)); + registryData.fill(HIST("protonQA/V0protonphiInRest_frame"), TMath::ASin(protonsinPhiInV0frame)); + registryData.fill(HIST("protonQA/V0protonThetaInRest_frame"), TMath::ASin(protonsinThetaInV0)); + registryData.fill(HIST("protonQA/V0protoncosthetaInV0frame"), protoncosthetaInV0frame); + registryData.fill(HIST("protonQA/profileprotonsinthetaInV0frame"), candidate.mLambda(), protonsinThetaInV0); + registryData.fill(HIST("protonQA/profileprotonsinphiInV0frame"), candidate.mLambda(), protonsinPhiInV0frame); + registryData.fill(HIST("protonQA/profileprotoncosSquarethetaInV0frame"), candidate.mLambda(), protoncosthetaInV0frame * protoncosthetaInV0frame); + + TMatrixD protonInJet(4, 1); + protonInJet = MyTMatrixTranslationToJet(maxJetpx, maxJetpy, maxJetpz, candidate.px(), candidate.py(), candidate.pz()) * pLabproton; + double protoncosthetaInJet = protonInJet(3, 0) / sqrt(protonInJet(1, 0) * protonInJet(1, 0) + protonInJet(2, 0) * protonInJet(2, 0) + protonInJet(3, 0) * protonInJet(3, 0)); + double protonsinPhiInJet = protonInJet(2, 0) / sqrt(protonInJet(1, 0) * protonInJet(1, 0) + protonInJet(2, 0) * protonInJet(2, 0)); + double protonPtinJet = sqrt(protonInJet(1, 0) * protonInJet(1, 0) + protonInJet(2, 0) * protonInJet(2, 0)); + double protonPinJet = sqrt(protonInJet(1, 0) * protonInJet(1, 0) + protonInJet(2, 0) * protonInJet(2, 0) + protonInJet(3, 0) * protonInJet(3, 0)); + double protonSinThetainJet = protonPtinJet / protonPinJet; + double protonMassInJetframe = sqrt(protonInJet(0, 0) * protonInJet(0, 0) - protonInJet(1, 0) * protonInJet(1, 0) - protonInJet(2, 0) * protonInJet(2, 0) - protonInJet(3, 0) * protonInJet(3, 0)); + + registryData.fill(HIST("protonQA/V0protonpxInJetframe"), protonInJet(1, 0)); + registryData.fill(HIST("protonQA/V0protonpyInJetframe"), protonInJet(2, 0)); + registryData.fill(HIST("protonQA/V0protonpzInJetframe"), protonInJet(3, 0)); + registryData.fill(HIST("protonQA/V0protonphiInJetframe"), TMath::ASin(protonsinPhiInJet)); + registryData.fill(HIST("protonQA/V0protonThetaInJetframe"), TMath::ASin(protonSinThetainJet)); + registryData.fill(HIST("protonQA/V0protoncosthetaInJetframe"), protoncosthetaInJet); + registryData.fill(HIST("protonQA/profileprotonsinthetaInJetframe"), candidate.mLambda(), protonSinThetainJet); + registryData.fill(HIST("protonQA/profileprotonsinphiInJetframe"), candidate.mLambda(), protonsinPhiInJet); + registryData.fill(HIST("protonQA/profileprotoncosSquarethetaInJetframe"), candidate.mLambda(), protoncosthetaInJet * protoncosthetaInJet); + registryData.fill(HIST("protonQA/V0protonMassInJetframe"), protonMassInJetframe); TMatrixD protonInJetV0(4, 1); protonInJetV0 = LorentzTransInV0frame(ELambda, lambdaInJet(1, 0), lambdaInJet(2, 0), lambdaInJet(3, 0)) * MyTMatrixTranslationToJet(maxJetpx, maxJetpy, maxJetpz, candidate.px(), candidate.py(), candidate.pz()) * pLabproton; - registryData.fill(HIST("V0protonpxInJetV0frame"), protonInJetV0(1, 0)); - registryData.fill(HIST("V0protonpyInJetV0frame"), protonInJetV0(2, 0)); - registryData.fill(HIST("V0protonpzInJetV0frame"), protonInJetV0(3, 0)); - - double protonPinJetV0 = sqrt(protonInJetV0(1, 0) * protonInJetV0(1, 0) + protonInJetV0(2, 0) * protonInJetV0(2, 0) + protonInJetV0(3, 0) * protonInJetV0(3, 0)); + double protoncosthetaInJetV0 = protonInJetV0(3, 0) / sqrt(protonInJetV0(1, 0) * protonInJetV0(1, 0) + protonInJetV0(2, 0) * protonInJetV0(2, 0) + protonInJetV0(3, 0) * protonInJetV0(3, 0)); + double protonsinphiInJetV0 = protonInJetV0(2, 0) / sqrt(protonInJetV0(1, 0) * protonInJetV0(1, 0) + protonInJetV0(2, 0) * protonInJetV0(2, 0)); double protonPtinJetV0 = sqrt(protonInJetV0(1, 0) * protonInJetV0(1, 0) + protonInJetV0(2, 0) * protonInJetV0(2, 0)); + double protonPinJetV0 = sqrt(protonInJetV0(1, 0) * protonInJetV0(1, 0) + protonInJetV0(2, 0) * protonInJetV0(2, 0) + protonInJetV0(3, 0) * protonInJetV0(3, 0)); + double protonSinThetainJetV0 = protonPtinJetV0 / protonPinJetV0; + double protonMassInJetV0frame = sqrt(protonInJetV0(0, 0) * protonInJetV0(0, 0) - protonInJetV0(1, 0) * protonInJetV0(1, 0) - protonInJetV0(2, 0) * protonInJetV0(2, 0) - protonInJetV0(3, 0) * protonInJetV0(3, 0)); + + registryData.fill(HIST("protonQA/V0protonpxInJetV0frame"), protonInJetV0(1, 0)); + registryData.fill(HIST("protonQA/V0protonpyInJetV0frame"), protonInJetV0(2, 0)); + registryData.fill(HIST("protonQA/V0protonpzInJetV0frame"), protonInJetV0(3, 0)); + registryData.fill(HIST("protonQA/V0protonphiInJetV0frame"), TMath::ASin(protonsinphiInJetV0)); + registryData.fill(HIST("protonQA/V0protonThetaInJetV0frame"), TMath::ASin(protonSinThetainJetV0)); + registryData.fill(HIST("protonQA/V0protoncosthetaInJetV0"), protoncosthetaInJetV0); + registryData.fill(HIST("protonQA/V0protonMassInJetV0frame"), protonMassInJetV0frame); + registryData.fill(HIST("protonQA/profileprotonsinthetaInJetV0frame"), candidate.mLambda(), protonSinThetainJetV0); + registryData.fill(HIST("protonQA/profileprotonsinphiInJetV0frame"), candidate.mLambda(), protonsinphiInJetV0); + registryData.fill(HIST("protonQA/profileprotoncosSquarethetaInJetV0frame"), candidate.mLambda(), protoncosthetaInJetV0 * protoncosthetaInJetV0); double protonCosThetainJetV0 = protonInJetV0(3, 0) / protonPinJetV0; - double protonSinThetainJetV0 = protonPtinJetV0 / protonPinJetV0; double protonthetainJetV0 = TMath::ASin(protonSinThetainJetV0); registryV0Data.fill(HIST("hprotoncosthetainJetV0"), protonCosThetainJetV0); registryV0Data.fill(HIST("hprotonsinthetainJetV0"), protonSinThetainJetV0); @@ -1407,8 +1728,17 @@ struct LfMyV0s { registryData.fill(HIST("TProfile2DLambdaPtMassSinPhi"), candidate.mLambda(), candidate.pt(), protonInJetV0(2, 0) / sqrt(protonInJetV0(1, 0) * protonInJetV0(1, 0) + protonInJetV0(2, 0) * protonInJetV0(2, 0))); registryData.fill(HIST("TProfile2DLambdaPtMassSintheta"), candidate.mLambda(), candidate.pt(), (4.0 / TMath::Pi()) * protonSinThetainJetV0); registryData.fill(HIST("TProfile2DLambdaPtMassCosSquareTheta"), candidate.mLambda(), candidate.pt(), 3.0 * protonCosThetainJetV0 * protonCosThetainJetV0); + registryData.fill(HIST("TProfile2DLambdaMassDeltaPhi"), TMath::ASin(protonsinPhiInJetV0frame), candidate.mLambda(), protonsinPhiInJetV0frame); + registryData.fill(HIST("hprotonPhi"), TMath::ASin(protonsinPhiInJetV0frame)); + + double protonCosThetaInLab = pLabproton(3, 0) / sqrt(pLabproton(1, 0) * pLabproton(1, 0) + pLabproton(2, 0) * pLabproton(2, 0) + pLabproton(3, 0) * pLabproton(3, 0)); // cos(theta) of lambda in lab frame + double protonCosThetaInV0frame = protonInV0(3, 0) / sqrt(protonInV0(1, 0) * protonInV0(1, 0) + protonInV0(2, 0) * protonInV0(2, 0) + protonInV0(3, 0) * protonInV0(3, 0)); // cos(theta) of lambda in V0 frame + double protonCosThetaInJetV0frame = protonCosThetainJetV0; // cos(theta) of lambda in jet V0 frame + registryData.fill(HIST("hprotonThetaInLab"), TMath::ACos(protonCosThetaInLab)); + registryData.fill(HIST("hprotonThetaInV0"), TMath::ACos(protonCosThetaInV0frame)); + registryData.fill(HIST("hprotonThetaInJetV0"), TMath::ACos(protonCosThetaInJetV0frame)); } - if (passedAntiLambdaSelection(candidate, pos, neg)) { + if (registryDataAcceptV0AntiLambda(candidate, pos, neg, collision)) { registryData.fill(HIST("hMassAntiLambda"), candidate.mAntiLambda()); double PAntiLambda = sqrt(candidate.px() * candidate.px() + candidate.py() * candidate.py() + candidate.pz() * candidate.pz()); double EAntiLambda = sqrt(candidate.mAntiLambda() * candidate.mAntiLambda() + PAntiLambda * PAntiLambda); @@ -1439,6 +1769,8 @@ struct LfMyV0s { registryData.fill(HIST("TProfile2DAntiLambdaPtMassSinPhi"), candidate.mAntiLambda(), candidate.pt(), AntiprotonInJetV0(2, 0) / sqrt(AntiprotonInJetV0(1, 0) * AntiprotonInJetV0(1, 0) + AntiprotonInJetV0(2, 0) * AntiprotonInJetV0(2, 0))); registryData.fill(HIST("TProfile2DAntiLambdaPtMassSintheta"), candidate.mAntiLambda(), candidate.pt(), (4.0 / TMath::Pi()) * AntiprotonSinThetainJetV0); registryData.fill(HIST("TProfile2DAntiLambdaPtMassCosSquareTheta"), candidate.mAntiLambda(), candidate.pt(), 3.0 * AntiprotonCosThetainJetV0 * AntiprotonCosThetainJetV0); + registryData.fill(HIST("TProfile2DAntiLambdaMassDeltaPhi"), TMath::ASin(AntiprotonsinPhiInJetV0frame), candidate.mAntiLambda(), AntiprotonsinPhiInJetV0frame); + registryData.fill(HIST("hantiprotonPhi"), TMath::ASin(AntiprotonsinPhiInJetV0frame)); } } @@ -1583,6 +1915,9 @@ struct LfMyV0s { registryLongitudinalPolarization.fill(HIST("V0pzInRest_frame"), LambdaBoostedVec.Pz()); double protonCosThetainV0 = ProtonBoostedVec.Pz() / ProtonBoostedVec.P(); + double protonCosThetainLab = ProtonVec.Pz() / ProtonVec.P(); + double protonSinPhiInLab = ProtonVec.Py() / sqrt(ProtonVec.Px() * ProtonVec.Px() + ProtonVec.Py() * ProtonVec.Py()); + double protonSinPhiInV0 = ProtonBoostedVec.Py() / sqrt(ProtonBoostedVec.Px() * ProtonBoostedVec.Px() + ProtonBoostedVec.Py() * ProtonBoostedVec.Py()); registryLongitudinalPolarization.fill(HIST("hprotoncosthetainV0"), protonCosThetainV0); registryLongitudinalPolarization.fill(HIST("hprotoncosSquarethetainV0"), protonCosThetainV0 * protonCosThetainV0); @@ -1592,6 +1927,13 @@ struct LfMyV0s { registryLongitudinalPolarization.fill(HIST("TProfile2DLambdaPtMassCosSquareTheta"), v0.mLambda(), v0.pt(), protonCosThetainV0 * protonCosThetainV0); registryLongitudinalPolarization.fill(HIST("TProfile1DLambdaPtMassCostheta"), v0.mLambda(), protonCosThetainV0); + + registryLongitudinalPolarization.fill(HIST("TH2FLambdaPtCostheta"), protonCosThetainV0, v0.pt()); + registryLongitudinalPolarization.fill(HIST("hprotonThetaInLab"), TMath::ACos(protonCosThetainLab)); + registryLongitudinalPolarization.fill(HIST("hprotonPhiInLab"), TMath::ASin(protonSinPhiInLab)); + registryLongitudinalPolarization.fill(HIST("hprotonPhiInV0"), TMath::ASin(protonSinPhiInV0)); + + registryLongitudinalPolarization.fill(HIST("hprotonTheta"), TMath::ACos(protonCosThetainV0)); } if (AcceptV0AntiLambda(v0, pos, neg, collision) && ifpasslambda) { registryLongitudinalPolarization.fill(HIST("hMassAntiLambdasel"), v0.mAntiLambda()); @@ -1606,6 +1948,7 @@ struct LfMyV0s { LambdaBoostedVec = boost(LambdaVec); double protonCosThetainV0 = ProtonBoostedVec.Pz() / ProtonBoostedVec.P(); + double protonCosThetainLab = ProtonVec.Pz() / ProtonVec.P(); registryLongitudinalPolarization.fill(HIST("hantiprotoncosthetainV0"), protonCosThetainV0); registryLongitudinalPolarization.fill(HIST("hantiprotoncosSquarethetainV0"), protonCosThetainV0 * protonCosThetainV0); @@ -1614,6 +1957,9 @@ struct LfMyV0s { registryLongitudinalPolarization.fill(HIST("TProfile2DAntiLambdaPtMassCostheta"), v0.mAntiLambda(), v0.pt(), protonCosThetainV0); registryLongitudinalPolarization.fill(HIST("TProfile2DAntiLambdaPtMassCosSquareTheta"), v0.mAntiLambda(), v0.pt(), protonCosThetainV0 * protonCosThetainV0); registryLongitudinalPolarization.fill(HIST("TProfile1DAntiLambdaPtMassCostheta"), v0.mAntiLambda(), protonCosThetainV0); + registryLongitudinalPolarization.fill(HIST("TH2FAntiLambdaPtCostheta"), protonCosThetainV0, v0.pt()); + registryLongitudinalPolarization.fill(HIST("hAntiprotonThetaInLab"), TMath::ACos(protonCosThetainLab)); + registryLongitudinalPolarization.fill(HIST("hAntiprotonTheta"), TMath::ACos(protonCosThetainV0)); } } registryLongitudinalPolarization.fill(HIST("nV0sPerEvent"), V0NumbersPerEvent); From f1006a30318d2083dcc05992e6103acd32cea981 Mon Sep 17 00:00:00 2001 From: Rik Spijkers <78484875+rspijkers@users.noreply.github.com> Date: Tue, 7 Oct 2025 10:01:09 +0200 Subject: [PATCH 651/986] [PWGLF] fix INEL evsel (#13253) --- PWGLF/Tasks/Strangeness/cascadecorrelations.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx b/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx index 56354e1502f..e45c18eed51 100644 --- a/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx +++ b/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx @@ -505,7 +505,7 @@ struct CascadeSelector { void processGenMC(aod::McCollision const& mcCollision, soa::SmallGroups> const& collisions, aod::McParticles const& mcParticles) { // evsel - if (INEL < 0 || pwglf::isINELgtNmc(mcParticles, INEL, pdgDB)) + if (INEL >= 0 && !pwglf::isINELgtNmc(mcParticles, INEL, pdgDB)) return; if (std::abs(mcCollision.posZ()) > maxVertexZ) return; From 2b7a8448006eee6c2cbc498f52edbb12bd062c5c Mon Sep 17 00:00:00 2001 From: Giorgio Alberto Lucia <87222843+GiorgioAlbertoLucia@users.noreply.github.com> Date: Tue, 7 Oct 2025 11:03:36 +0200 Subject: [PATCH 652/986] [PWGLF] Solved issue with centrality filling dummy values, adjusted histogram axes (#13259) --- PWGLF/TableProducer/Nuspex/nucleiFlowTree.cxx | 6 ++-- PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx | 6 ++-- PWGLF/TableProducer/QC/nucleiQC.cxx | 22 ++++++------- PWGLF/Utils/nucleiUtils.h | 33 ++++++++++--------- 4 files changed, 34 insertions(+), 33 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/nucleiFlowTree.cxx b/PWGLF/TableProducer/Nuspex/nucleiFlowTree.cxx index beb4da99806..baade70ce9c 100644 --- a/PWGLF/TableProducer/Nuspex/nucleiFlowTree.cxx +++ b/PWGLF/TableProducer/Nuspex/nucleiFlowTree.cxx @@ -135,12 +135,12 @@ struct nucleiFlowTree { Configurable cfgHarmonics{"cfgHarmonics", 2, "Harmonics index for flow analysis"}; // Collisions with chentrality - using CollWithCent = soa::Join::iterator; + using CollWithCent = soa::Join::iterator; // Flow analysis - using CollWithEP = soa::Join::iterator; + using CollWithEP = soa::Join::iterator; - using CollWithQvec = soa::Join::iterator; + using CollWithQvec = soa::Join::iterator; HistogramRegistry spectra{"spectra", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; diff --git a/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx b/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx index 5891997bc54..5c2d2544247 100644 --- a/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx +++ b/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx @@ -338,12 +338,12 @@ struct nucleiSpectra { using TrackCandidates = soa::Join; // Collisions with chentrality - using CollWithCent = soa::Join::iterator; + using CollWithCent = soa::Join::iterator; // Flow analysis - using CollWithEP = soa::Join::iterator; + using CollWithEP = soa::Join::iterator; - using CollWithQvec = soa::Join::iterator; + using CollWithQvec = soa::Join::iterator; HistogramRegistry spectra{"spectra", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; diff --git a/PWGLF/TableProducer/QC/nucleiQC.cxx b/PWGLF/TableProducer/QC/nucleiQC.cxx index 739890077b7..86460ba0688 100644 --- a/PWGLF/TableProducer/QC/nucleiQC.cxx +++ b/PWGLF/TableProducer/QC/nucleiQC.cxx @@ -71,7 +71,7 @@ struct nucleiQC { using TrackCandidates = soa::Join; using TrackCandidatesMC = soa::Join; - using Collision = soa::Join::iterator; + using Collision = soa::Join::iterator; Preslice mMcParticlesPerCollision = o2::aod::mcparticle::mcCollisionId; Configurable cfgFillTable{"cfgFillTable", true, "Fill output tree"}; @@ -205,10 +205,10 @@ struct nucleiQC { float centrality = nuclei::getCentrality(collision, cfgCentralityEstimator); float nsigmaTPC = mPidManagers[kIndex].getNSigmaTPC(track); - mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3NsigmaTPC_preselectionVsCentrality"), track.pt(), nsigmaTPC, centrality); + mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3NsigmaTPC_preselectionVsCentrality"), track.pt() * track.sign(), nsigmaTPC, centrality); if (std::abs(nsigmaTPC) > cfgNsigmaTPC->get(kIndex, 1)) return false; - mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3NsigmaTPCVsCentrality"), track.pt(), nsigmaTPC, centrality); + mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3NsigmaTPCVsCentrality"), track.pt() * track.sign(), nsigmaTPC, centrality); float nsigmaITS = mPidManagers[kIndex].getNSigmaITS(track); mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3NsigmaITS_preselectionVsCentrality"), track.sign() * track.pt(), nsigmaITS, centrality); @@ -216,10 +216,10 @@ struct nucleiQC { mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3NsigmaITSVsCentrality"), track.sign() * track.pt(), nsigmaITS, centrality); float nsigmaTOF = mPidManagers[kIndex].getNSigmaTOF(track); - mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3NsigmaTOF_preselectionVsCentrality"), track.pt(), nsigmaTOF, centrality); - if (std::abs(nsigmaTOF) > cfgNsigmaTOF->get(kIndex, 1)) + mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3NsigmaTOF_preselectionVsCentrality"), track.sign() * track.pt(), nsigmaTOF, centrality); + if (std::abs(nsigmaTOF) > cfgNsigmaTOF->get(kIndex, 1) && track.hasTOF()) return false; - mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3NsigmaTOFVsCentrality"), track.pt(), nsigmaTOF, centrality); + mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3NsigmaTOFVsCentrality"), track.sign() * track.pt(), nsigmaTOF, centrality); return true; } @@ -376,10 +376,10 @@ struct nucleiQC { mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/hPtReconstructed"), candidate.pt); mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3PtVsEtaVsCentralityReconstructed"), candidate.pt, candidate.eta, candidate.centrality); mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3PhiVsEtaVsCentralityReconstructed"), candidate.phi, candidate.eta, candidate.centrality); - mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3DCAxyVsPtVsCentrality"), candidate.DCAxy, candidate.pt, candidate.centrality); - mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3DCAzVsPtVsCentrality"), candidate.DCAz, candidate.pt, candidate.centrality); - mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3BetaVsPtVsCentrality"), candidate.beta, candidate.pt, candidate.centrality); - mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3dEdxVsPVsCentrality"), candidate.TPCsignal, candidate.pt, candidate.centrality); + mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3DCAxyVsPtVsCentrality"), candidate.pt, candidate.DCAxy, candidate.centrality); + mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3DCAzVsPtVsCentrality"), candidate.pt, candidate.DCAz, candidate.centrality); + mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3BetaVsPtVsCentrality"), candidate.pt, candidate.beta, candidate.centrality); + mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3dEdxVsPVsCentrality"), candidate.pt, candidate.TPCsignal, candidate.centrality); mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3ClusterSizeVsPtVsCentrality"), mPidManagers[kIndex].getClusterSizeCosLambdaITS(candidate.clusterSizesITS, candidate.eta), candidate.pt, candidate.centrality); } } @@ -412,7 +412,7 @@ struct nucleiQC { if (particle.pdgCode() != nuclei::pdgCodes[kSpeciesRt]) return; } - if (particle.y() - cfgRapidityCenterMass < cfgRapidityMin || particle.y() - cfgRapidityCenterMass > cfgRapidityMax) { + if ((particle.y() - cfgRapidityCenterMass) < cfgRapidityMin || (particle.y() - cfgRapidityCenterMass) > cfgRapidityMax) { return; } } diff --git a/PWGLF/Utils/nucleiUtils.h b/PWGLF/Utils/nucleiUtils.h index 967f017cbe7..5a54390067d 100644 --- a/PWGLF/Utils/nucleiUtils.h +++ b/PWGLF/Utils/nucleiUtils.h @@ -348,18 +348,19 @@ bool eventSelection(const Tcollision& collision, HistogramRegistry& registry, La template float getCentrality(Tcollision const& collision, const int centralityEstimator) { - if constexpr (o2::aod::HasCentrality) { - if (centralityEstimator == centDetectors::kFV0A) { - return collision.centFV0A(); - } else if (centralityEstimator == centDetectors::kFT0M) { - return collision.centFT0M(); - } else if (centralityEstimator == centDetectors::kFT0A) { - return collision.centFT0A(); - } else if (centralityEstimator == centDetectors::kFT0C) { - return collision.centFT0C(); - } else { - LOG(warning) << "Centrality estimator not valid. Possible values: (FV0A: 0, FT0M: 1, FT0A: 2, FT0C: 3). Centrality set to -1."; - } + if constexpr (!o2::aod::HasCentrality) { + return -1.f; + } + if (centralityEstimator == centDetectors::kFV0A) { + return collision.centFV0A(); + } else if (centralityEstimator == centDetectors::kFT0M) { + return collision.centFT0M(); + } else if (centralityEstimator == centDetectors::kFT0A) { + return collision.centFT0A(); + } else if (centralityEstimator == centDetectors::kFT0C) { + return collision.centFT0C(); + } else { + LOG(warning) << "Centrality estimator not valid. Possible values: (FV0A: 0, FT0M: 1, FT0A: 2, FT0C: 3). Centrality set to -1."; } return -1.f; } @@ -386,9 +387,9 @@ void createHistogramRegistryNucleus(HistogramRegistry& registry) registry.add(fmt::format("{}/hTrackSelections", cNames[index]).c_str(), (fmt::format("{} track selections;", cNames[index]) + std::string("Selection step; Counts")).c_str(), HistType::kTH1D, {{trackSelection::kNtrackSelections, -0.5f, static_cast(trackSelection::kNtrackSelections) - 0.5f}}); registry.add(fmt::format("{}/hPtReconstructed", cNames[index]).c_str(), (fmt::format("{} - reconstructed variables;", cNames[index]) + std::string("#it{p}_{T} / |#it{Z}| (GeV/#it{c}); Counts")).c_str(), HistType::kTH1F, {{240, -6.0f, 6.0f}}); registry.add(fmt::format("{}/h3PtVsEtaVsCentralityReconstructed", cNames[index]).c_str(), (fmt::format("{} - reconstructed variables;", cNames[index]) + std::string("#it{p}_{T} / |#it{Z}| (GeV/#it{c}); #eta; CentralityFT0C (%)")).c_str(), HistType::kTH3F, {{240, -6.0f, 6.0f}, {40, -1.0f, 1.f}, {20, 0.0f, 100.0f}}); - registry.add(fmt::format("{}/h3PhiVsEtaVsCentralityReconstructed", cNames[index]).c_str(), (fmt::format("{} - reconstructed variables;", cNames[index]) + std::string("#phi (radians); #eta; CentralityFT0C (%)")).c_str(), HistType::kTH3F, {{240, -6.0f, 6.0f}, {40, 0.0f, o2::constants::math::TwoPI}, {20, 0.0f, 100.0f}}); - registry.add(fmt::format("{}/h3DCAxyVsPtVsCentrality", cNames[index]).c_str(), (fmt::format(";", cNames[index]) + std::string("#it{p}_{T} / |#it{Z}| (GeV/#it{c}); DCA_{xy} (cm); CentralityFT0C (%)")).c_str(), HistType::kTH3F, {{240, -6.0f, 6.0f}, {200, -5.0f, 5.0f}, {20, 0.0f, 100.0f}}); - registry.add(fmt::format("{}/h3DCAzVsPtVsCentrality", cNames[index]).c_str(), (fmt::format("{};", cNames[index]) + std::string("#it{p}_{T} / |#it{Z}| (GeV/#it{c}); DCA_{z} (cm); CentralityFT0C (%)")).c_str(), HistType::kTH3F, {{240, -6.0f, 6.0f}, {200, -5.0f, 5.0f}, {20, 0.0f, 100.0f}}); + registry.add(fmt::format("{}/h3PhiVsEtaVsCentralityReconstructed", cNames[index]).c_str(), (fmt::format("{} - reconstructed variables;", cNames[index]) + std::string("#phi (radians); #eta; CentralityFT0C (%)")).c_str(), HistType::kTH3F, {{40, 0, o2::constants::math::TwoPI}, {40, -1.0f, 1.f}, {20, 0.0f, 100.0f}}); + registry.add(fmt::format("{}/h3DCAxyVsPtVsCentrality", cNames[index]).c_str(), (fmt::format(";", cNames[index]) + std::string("#it{p}_{T} / |#it{Z}| (GeV/#it{c}); DCA_{xy} (cm); CentralityFT0C (%)")).c_str(), HistType::kTH3F, {{240, -6.0f, 6.0f}, {200, -0.5f, 0.5f}, {20, 0.0f, 100.0f}}); + registry.add(fmt::format("{}/h3DCAzVsPtVsCentrality", cNames[index]).c_str(), (fmt::format("{};", cNames[index]) + std::string("#it{p}_{T} / |#it{Z}| (GeV/#it{c}); DCA_{z} (cm); CentralityFT0C (%)")).c_str(), HistType::kTH3F, {{240, -6.0f, 6.0f}, {200, -0.5f, 0.5f}, {20, 0.0f, 100.0f}}); registry.add(fmt::format("{}/h3NsigmaTPC_preselectionVsCentrality", cNames[index]).c_str(), (fmt::format("Nsigma{} TPC distribution;", cNames[index]) + std::string("#it{p}_{T} / |#it{Z}| (GeV/#it{c});") + fmt::format("n#sigma_{{TPC}}({}); CentralityFT0C (%)", cNames[index])).c_str(), HistType::kTH3F, {{100, -5.0f, 5.0f}, {400, -10.0f, 10.0f}, {20, 0.0f, 100.0f}}); registry.add(fmt::format("{}/h3NsigmaTPCVsCentrality", cNames[index]).c_str(), (fmt::format("Nsigma{} TPC distribution;", cNames[index]) + std::string("#it{p}_{T} / |#it{Z}| (GeV/#it{c});") + fmt::format("n#sigma_{{TPC}}({}); Centrality FT0C (%)", cNames[index])).c_str(), HistType::kTH3F, {{20, -5.0f, 5.0f}, {200, -5.0f, 5.0f}, {20, 0.0f, 100.0f}}); registry.add(fmt::format("{}/h3NsigmaITS_preselectionVsCentrality", cNames[index]).c_str(), (fmt::format("Nsigma{} ITS distribution;", cNames[index]) + std::string("signed #it{p}_{T} / |#it{Z}| (GeV/#it{c});") + fmt::format("n#sigma_{{ITS}}({}); Centrality FT0C (%)", cNames[index])).c_str(), HistType::kTH3F, {{50, -5.0f, 5.0f}, {120, -3.0f, 3.0f}, {20, 0.0f, 100.0f}}); @@ -400,7 +401,7 @@ void createHistogramRegistryNucleus(HistogramRegistry& registry) registry.add(fmt::format("{}/h3ClusterSizeVsPtVsCentrality", cNames[index]).c_str(), (fmt::format("{};", cNames[index]) + std::string("#it{p}_{T} / |#it{Z}| (GeV/#it{c}); Cluster size ITS; CentralityFT0C (%)")).c_str(), HistType::kTH3F, {{240, -6.0f, 6.0f}, {90, 0.f, 15.f}, {20, 0.0f, 100.0f}}); registry.add(fmt::format("{}/hPtGenerated", cNames[index]).c_str(), (fmt::format("{} - generated variables;", cNames[index]) + std::string("#it{p}_{T} / |#it{Z}| (GeV/#it{c}); Counts")).c_str(), HistType::kTH1F, {{240, -6.0f, 6.0f}}); registry.add(fmt::format("{}/h3PtVsEtaVsCentralityGenerated", cNames[index]).c_str(), (fmt::format("{} - generated variables;", cNames[index]) + std::string("#it{p}_{T} / |#it{Z}| (GeV/#it{c}); #eta; CentralityFT0C (%)")).c_str(), HistType::kTH3F, {{240, -6.0f, 6.0f}, {40, -1.0f, 1.f}, {20, 0.0f, 100.0f}}); - registry.add(fmt::format("{}/h3PhiVsEtaVsCentralityGenerated", cNames[index]).c_str(), (fmt::format("{} - generated variables;", cNames[index]) + std::string("#phi (radians); #eta; CentralityFT0C (%)")).c_str(), HistType::kTH3F, {{240, -6.0f, 6.0f}, {40, 0.0f, o2::constants::math::TwoPI}, {20, 0.0f, 100.0f}}); + registry.add(fmt::format("{}/h3PhiVsEtaVsCentralityGenerated", cNames[index]).c_str(), (fmt::format("{} - generated variables;", cNames[index]) + std::string("#phi (radians); #eta; CentralityFT0C (%)")).c_str(), HistType::kTH3F, {{40, 0, o2::constants::math::TwoPI}, {40, -1.0f, 1.f}, {20, 0.0f, 100.0f}}); for (size_t iSel = 0; iSel < trackSelection::kNtrackSelections; iSel++) { registry.get(HIST(cNames[index]) + HIST("/hTrackSelections"))->GetXaxis()->SetBinLabel(iSel + 1, trackSelectionLabels[iSel].c_str()); From 4246fbfa143c00342f848157758bf7056a8b6e64 Mon Sep 17 00:00:00 2001 From: Yuanjing Ji Date: Tue, 7 Oct 2025 17:22:25 +0800 Subject: [PATCH 653/986] [PWGDQ] Add MC definition of Lambda0 and Sigma+ (#13145) Co-authored-by: Yuanjing Ji Co-authored-by: Yuanjing Ji --- PWGDQ/Core/MCSignalLibrary.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/PWGDQ/Core/MCSignalLibrary.cxx b/PWGDQ/Core/MCSignalLibrary.cxx index 701a25fc8e4..d32054afb5a 100644 --- a/PWGDQ/Core/MCSignalLibrary.cxx +++ b/PWGDQ/Core/MCSignalLibrary.cxx @@ -87,6 +87,16 @@ MCSignal* o2::aod::dqmcsignals::GetMCSignal(const char* name) signal = new MCSignal(name, "Primary Kaons", {prong}, {-1}); // define the signal using the full constructor return signal; } + if (!nameStr.compare("Lambda0Baryon")) { + MCProng prong(1, {3122}, {true}, {false}, {0}, {0}, {false}); + signal = new MCSignal(name, "Lambda0 Baryon", {prong}, {-1}); + return signal; + } + if (!nameStr.compare("SigmaPlusBaryon")) { + MCProng prong(1, {3222}, {true}, {false}, {0}, {0}, {false}); + signal = new MCSignal(name, "SigmaPlus Baryon", {prong}, {-1}); + return signal; + } if (!nameStr.compare("proton")) { MCProng prong(1, {2212}, {true}, {false}, {0}, {0}, {false}); signal = new MCSignal(name, "proton", {prong}, {-1}); From d3378cdff2b491a10051e573ea1f1ca4cd955e05 Mon Sep 17 00:00:00 2001 From: "Paul Veen (paveen)" <80593165+ppoava@users.noreply.github.com> Date: Tue, 7 Oct 2025 12:43:12 +0300 Subject: [PATCH 654/986] [Common] Adding dimuon DCA to muon QA task (#13204) --- Common/Tasks/qaMuon.cxx | 239 +++++++++++++++++++++++++++++----------- 1 file changed, 172 insertions(+), 67 deletions(-) diff --git a/Common/Tasks/qaMuon.cxx b/Common/Tasks/qaMuon.cxx index 2aef776035a..b8646f83291 100644 --- a/Common/Tasks/qaMuon.cxx +++ b/Common/Tasks/qaMuon.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -55,8 +56,6 @@ #include #include -#include - #include #include @@ -77,7 +76,6 @@ #include // FIXME: Replace M_PI -using namespace std; using namespace o2; using namespace o2::aod; using namespace o2::mch; @@ -170,9 +168,9 @@ struct VarTrack { }; struct VarClusters { - vector> posClusters; // (x,y,z) - vector> errorClusters; // (ex,ey) - vector DEIDs; + std::vector> posClusters; // (x,y,z) + std::vector> errorClusters; // (ex,ey) + std::vector DEIDs; }; struct muonQa { @@ -182,6 +180,7 @@ struct muonQa { Configurable fEnableQAResidual{"cfgEnableQAResidual", false, "Enable residual QA checks"}; Configurable fEnableQADCA{"cfgEnableQADCA", false, "Enable DCA QA checks"}; Configurable fEnableQADimuon{"cfgEnableQADimuon", false, "Enable dimuon QA checks"}; + Configurable fEnableSingleMuonDiMuonCorrelations{"cfgEnableMuonDiMuonCorrelations", false, "Enable muon-dimuon QA checks"}; } configQAs; //// Variables for selecting muon tracks @@ -251,8 +250,8 @@ struct muonQa { double Bz; // Bz for MFT geo::TransformationCreator transformation; - map transformRef; // reference geometry w.r.t track data - map transformNew; // new geometry + std::map transformRef; // reference geometry w.r.t track data + std::map transformNew; // new geometry TGeoManager* geoNew = nullptr; TGeoManager* geoRef = nullptr; @@ -262,6 +261,7 @@ struct muonQa { HistogramRegistry registry{"registry", {}}; HistogramRegistry registryDCA{"registryDCA", {}}; + HistogramRegistry registryDCAdiMuons{"registryDCAdiMuons", {}}; HistogramRegistry registryResiduals{"registryResiduals", {}}; HistogramRegistry registryResidualsMFT{"registryResidualsMFT", {}}; HistogramRegistry registryResidualsMCH{"registryResidualsMCH", {}}; @@ -288,7 +288,7 @@ struct muonQa { VarTrack fgValuesMCHpv; VarTrack fgValuesMFT; VarTrack fgValuesGlobal; - vector fgValuesCandidates; + std::vector fgValuesCandidates; void CreateBasicHistograms() { @@ -596,7 +596,8 @@ struct muonQa { AxisSpec transverseMomentumAxis = {100, 0, 30, "p_{T} (GeV/c)"}; AxisSpec etaAxis = {40, -5, -1, "#eta"}; AxisSpec rAbsAxis = {10, 0., 100.0, "R_{abs} (cm)"}; - AxisSpec dcaAxis = {40, 0.0, 20.0, "DCA"}; + AxisSpec dcaAxis = {400, -10.0, 10.0, "DCA"}; + AxisSpec dcaAxisReduced = {40, -10.0, 10.0, "DCA"}; AxisSpec phiAxis = {36, -180.0, 180.0, "#phi (degrees)"}; // dimuons AxisSpec invMassAxis = {400, 1, 5, "M_{#mu^{+}#mu^{-}} (GeV/c^{2})"}; @@ -605,21 +606,45 @@ struct muonQa { AxisSpec yPairAxis = {120, 0.0, 6.0, "#y_{pair}"}; AxisSpec invMassAxis2D = {750, 0, 15, "M_{#mu^{+}#mu^{-}} (GeV/c^{2})"}; AxisSpec pTAxis2D = {120, 0, 30, "p_{T} (GeV/c)"}; - // Single muons - dimuons correlations - registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosPt_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+} p_{T}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, pTAxis2D}}); - registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegPt_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-} p_{T}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, pTAxis2D}}); - // - registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosEta_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+} #eta", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, etaAxis}}); - registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegEta_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-} #eta", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, etaAxis}}); - // - registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosRabs_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+} R_{abs}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, rAbsAxis}}); - registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegRabs_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-} R_{abs}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, rAbsAxis}}); - // - registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosDca_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+} DCA", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, dcaAxis}}); - registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegDca_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-} DCA", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, dcaAxis}}); + // Jpsi candidate DCA histograms + registryDimuon.add("dimuon/same-event/DCA/pT_MuPosDCAx_minus_MuNegDCAx_MuonKine_MuonCuts", "DCA_x #mu^{+} minus DCA_x #mu^{-} and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/DCA/pT_MuPosTDCAx_minus_MuNegTDCAx_MuonKine_MuonCuts", "DCA_x #mu^{+} top minus DCA_x #mu^{-} top and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/DCA/pT_MuPosTDCAx_minus_MuNegBDCAx_MuonKine_MuonCuts", "DCA_x #mu^{+} top minus DCA_x #mu^{-} bottom and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/DCA/pT_MuPosBDCAx_minus_MuNegBDCAx_MuonKine_MuonCuts", "DCA_x #mu^{+} bottom minus DCA_x #mu^{-} bottom and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/DCA/pT_MuPosBDCAx_minus_MuNegTDCAx_MuonKine_MuonCuts", "DCA_x #mu^{+} bottom minus DCA_x #mu^{-} top and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/DCA/pT_MuPosDCAy_minus_MuNegDCAy_MuonKine_MuonCuts", "DCA_y #mu^{+} minus DCA_y #mu^{-} and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/DCA/pT_MuPosTDCAy_minus_MuNegTDCAy_MuonKine_MuonCuts", "DCA_y #mu^{+} top minus DCA_y #mu^{-} top and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/DCA/pT_MuPosTDCAy_minus_MuNegBDCAy_MuonKine_MuonCuts", "DCA_y #mu^{+} top minus DCA_y #mu^{-} bottom and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/DCA/pT_MuPosBDCAy_minus_MuNegBDCAy_MuonKine_MuonCuts", "DCA_y #mu^{+} bottom minus DCA_y #mu^{-} bottom and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/DCA/pT_MuPosBDCAy_minus_MuNegTDCAy_MuonKine_MuonCuts", "DCA_y #mu^{+} bottom minus DCA_y #mu^{-} top and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); // - registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosPhi_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+} #phi", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, phiAxis}}); - registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegPhi_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-} #phi", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, phiAxis}}); + registryDimuon.add("dimuon/mixed-event/DCA/pT_MuPosDCAx_minus_MuNegDCAx_MuonKine_MuonCuts", "DCA_x #mu^{+} minus DCA_x #mu^{-} and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/mixed-event/DCA/pT_MuPosTDCAx_minus_MuNegTDCAx_MuonKine_MuonCuts", "DCA_x #mu^{+} top minus DCA_x #mu^{-} top and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/mixed-event/DCA/pT_MuPosTDCAx_minus_MuNegBDCAx_MuonKine_MuonCuts", "DCA_x #mu^{+} top minus DCA_x #mu^{-} bottom and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/mixed-event/DCA/pT_MuPosBDCAx_minus_MuNegBDCAx_MuonKine_MuonCuts", "DCA_x #mu^{+} bottom minus DCA_x #mu^{-} bottom and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/mixed-event/DCA/pT_MuPosBDCAx_minus_MuNegTDCAx_MuonKine_MuonCuts", "DCA_x #mu^{+} bottom minus DCA_x #mu^{-} top and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/mixed-event/DCA/pT_MuPosDCAy_minus_MuNegDCAy_MuonKine_MuonCuts", "DCA_y #mu^{+} minus DCA_y #mu^{-} and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/mixed-event/DCA/pT_MuPosTDCAy_minus_MuNegTDCAy_MuonKine_MuonCuts", "DCA_y #mu^{+} top minus DCA_y #mu^{-} top and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/mixed-event/DCA/pT_MuPosTDCAy_minus_MuNegBDCAy_MuonKine_MuonCuts", "DCA_y #mu^{+} top minus DCA_y #mu^{-} bottom and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/mixed-event/DCA/pT_MuPosBDCAy_minus_MuNegBDCAy_MuonKine_MuonCuts", "DCA_y #mu^{+} bottom minus DCA_y #mu^{-} bottom and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/mixed-event/DCA/pT_MuPosBDCAy_minus_MuNegTDCAy_MuonKine_MuonCuts", "DCA_y #mu^{+} bottom minus DCA_y #mu^{-} top and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + if (configQAs.fEnableSingleMuonDiMuonCorrelations) { + // Single muons - dimuons correlations + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosPt_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+} p_{T}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegPt_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-} p_{T}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, pTAxis2D}}); + // + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosEta_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+} #eta", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, etaAxis}}); + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegEta_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-} #eta", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, etaAxis}}); + // + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosRabs_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+} R_{abs}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, rAbsAxis}}); + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegRabs_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-} R_{abs}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, rAbsAxis}}); + // + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosDca_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+} DCA", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, dcaAxisReduced}}); + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegDca_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-} DCA", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, dcaAxisReduced}}); + // + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosPhi_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+} #phi", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, phiAxis}}); + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegPhi_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-} #phi", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, phiAxis}}); + } // MCH-MID tracks with MCH acceptance cuts registryDimuon.add("dimuon/same-event/invariantMass_MuonKine_MuonCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH1F, {invMassAxis}}); registryDimuon.add("dimuon/same-event/invariantMassFull_MuonKine_MuonCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH1F, {invMassAxisFull}}); @@ -941,7 +966,7 @@ struct muonQa { bool removeTrack = false; try { trackFitter.fit(track, false); - } catch (exception const& e) { + } catch (std::exception const& e) { removeTrack = true; return removeTrack; } @@ -952,7 +977,7 @@ struct muonQa { try { trackFitter.fit(track, true, false, (itStartingParam == track.rbegin()) ? nullptr : &itStartingParam); - } catch (exception const&) { + } catch (std::exception const&) { removeTrack = true; break; } @@ -1373,7 +1398,7 @@ struct muonQa { { int removable = 0; auto clustersSliced = mchcls.sliceBy(perMuon, muon.globalIndex()); // Slice clusters by muon id - vector> posClusters; + std::vector> posClusters; int clIndex = -1; // Get re-aligned clusters associated to current track @@ -1402,8 +1427,8 @@ struct muonQa { clusterMCH->ey = cluster.isGoodY() ? 0.2 : 10.0; // Fill temporary values - vector posCls = {clusterMCH->x, clusterMCH->y, clusterMCH->z}; - vector eCls = {clusterMCH->ex, clusterMCH->ey}; + std::vector posCls = {clusterMCH->x, clusterMCH->y, clusterMCH->z}; + std::vector eCls = {clusterMCH->ex, clusterMCH->ey}; posClusters.emplace_back(posCls); fgValues.errorClusters.emplace_back(eCls); fgValues.DEIDs.emplace_back(cluster.deId()); @@ -1421,7 +1446,7 @@ struct muonQa { } for (auto it = convertedTrack.begin(); it != convertedTrack.end(); it++) { - vector pos = {static_cast(it->getNonBendingCoor()), static_cast(it->getBendingCoor()), static_cast(it->getZ())}; + std::vector pos = {static_cast(it->getNonBendingCoor()), static_cast(it->getBendingCoor()), static_cast(it->getZ())}; fgValues.posClusters.emplace_back(pos); } @@ -1485,9 +1510,9 @@ struct muonQa { fgValues.phi = propmuon.getPhi(); fgValues.p = propmuon.getP(); - fgValues.px = propmuon.getP() * sin(M_PI / 2 - atan(propmuon.getTgl())) * cos(propmuon.getPhi()); - fgValues.py = propmuon.getP() * sin(M_PI / 2 - atan(propmuon.getTgl())) * sin(propmuon.getPhi()); - fgValues.pz = propmuon.getP() * cos(M_PI / 2 - atan(propmuon.getTgl())); + fgValues.px = propmuon.getP() * std::sin(M_PI / 2 - std::atan(propmuon.getTgl())) * std::cos(propmuon.getPhi()); + fgValues.py = propmuon.getP() * std::sin(M_PI / 2 - std::atan(propmuon.getTgl())) * std::sin(propmuon.getPhi()); + fgValues.pz = propmuon.getP() * std::cos(M_PI / 2 - std::atan(propmuon.getTgl())); } if (endPoint == kToDCA) { @@ -1557,8 +1582,8 @@ struct muonQa { double pMCH = fgValuesMCH.p; int sign = fgValuesMCH.sign; - double px = pMCH * sin(M_PI / 2 - atan(muon.tgl())) * cos(muon.phi()); - double py = pMCH * sin(M_PI / 2 - atan(muon.tgl())) * sin(muon.phi()); + double px = pMCH * std::sin(M_PI / 2 - std::atan(muon.tgl())) * std::cos(muon.phi()); + double py = pMCH * std::sin(M_PI / 2 - std::atan(muon.tgl())) * std::sin(muon.phi()); // double pz = pMCH * cos(M_PI / 2 - atan(mft.tgl())); double pt = std::sqrt(std::pow(px, 2) + std::pow(py, 2)); @@ -1611,6 +1636,10 @@ struct muonQa { propmuon.setParameters(track.getParameters()); propmuon.setZ(track.getZ()); propmuon.setCovariances(track.getCovariances()); + if (endPoint == kToDCA) { + fgValues.dcaX = (propmuon.getX() - collision.x); + fgValues.dcaY = (propmuon.getY() - collision.y); + } } //// Fill propagation informations @@ -1624,9 +1653,9 @@ struct muonQa { fgValues.phi = propmuon.getPhi(); fgValues.p = propmuon.getP(); - fgValues.px = propmuon.getP() * sin(M_PI / 2 - atan(propmuon.getTgl())) * cos(propmuon.getPhi()); - fgValues.py = propmuon.getP() * sin(M_PI / 2 - atan(propmuon.getTgl())) * sin(propmuon.getPhi()); - fgValues.pz = propmuon.getP() * cos(M_PI / 2 - atan(propmuon.getTgl())); + fgValues.px = propmuon.getP() * std::sin(M_PI / 2 - std::atan(propmuon.getTgl())) * std::cos(propmuon.getPhi()); + fgValues.py = propmuon.getP() * std::sin(M_PI / 2 - std::atan(propmuon.getTgl())) * std::sin(propmuon.getPhi()); + fgValues.pz = propmuon.getP() * std::cos(M_PI / 2 - std::atan(propmuon.getTgl())); } if (endPoint == kToDCA) { @@ -2158,7 +2187,7 @@ struct muonQa { auto& fgValuesCollMatched = collisions.at(mfttrack.collisionId()); // Do extrapolation for muons to all reference planes - vector mchTrackExtrap; + std::vector mchTrackExtrap; for (double z : zRefPlane) { VarTrack fgValues; if (configRealign.fDoRealign) { @@ -2194,7 +2223,7 @@ struct muonQa { } // Do extrapolation for MFTs to all reference planes - vector mftTrackExtrap; + std::vector mftTrackExtrap; for (double z : zRefPlane) { VarTrack fgValues; FillPropagation<0, 1>(mft, fgValuesCollMFT, mchTrackExtrap[1], fgValues, kToZ, z); @@ -2515,7 +2544,10 @@ struct muonQa { // Propagate MCH to PV FillPropagation<1>(muonTrack1, collision1, fgValuesMuon1, fgValuesMuonPV1); - FillPropagation<1>(muonTrack2, collision2, fgValuesMuon1, fgValuesMuonPV2); + FillPropagation<1>(muonTrack2, collision2, fgValuesMuon2, fgValuesMuonPV2); + // Calculate DCA + FillPropagation<1>(muonTrack1, collision1, fgValuesMuon1, fgValuesMuonPV1, kToDCA); + FillPropagation<1>(muonTrack2, collision2, fgValuesMuon2, fgValuesMuonPV2, kToDCA); } int sign1 = muonTrack1.sign(); @@ -2527,6 +2559,9 @@ struct muonQa { const auto& muonPos = fgValuesMuon1.sign > 0 ? fgValuesMuon1 : fgValuesMuon2; const auto& muonNeg = fgValuesMuon1.sign < 0 ? fgValuesMuon1 : fgValuesMuon2; + // for DCA + const auto& muonPosPV = fgValuesMuon1.sign > 0 ? fgValuesMuonPV1 : fgValuesMuonPV2; + const auto& muonNegPV = fgValuesMuon1.sign < 0 ? fgValuesMuonPV1 : fgValuesMuonPV2; // μ⁺ variables double muPosPt = muonPos.pT; double muPosEta = muonPos.eta; @@ -2552,35 +2587,50 @@ struct muonQa { bool sameEvent = (collisionIndex1 == collisionIndex2); + // dimuon variables double mass = GetMuMuInvariantMass(fgValuesMuonPV1, fgValuesMuonPV2); double pT = GetMuMuPt(fgValuesMuonPV1, fgValuesMuonPV2); double yPair = GetMuMuRap(fgValuesMuonPV1, fgValuesMuonPV2); + double dcaXPair = muonPosPV.dcaX - muonNegPV.dcaX; + double dcaYPair = muonPosPV.dcaY - muonNegPV.dcaY; + // mass cuts only used for DCA of Jpsi candidates + double minJpsiMass = 2.8; + double maxJpsiMass = 3.4; if (goodMuonTracks) { if (sameEvent) { // same-event case - // single muons - registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosPt_MuonKine_MuonCuts"))->Fill(mass, pT, muPosPt); - registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegPt_MuonKine_MuonCuts"))->Fill(mass, pT, muNegPt); - // - registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosEta_MuonKine_MuonCuts"))->Fill(mass, pT, muPosEta); - registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegEta_MuonKine_MuonCuts"))->Fill(mass, pT, muNegEta); - // - registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosRabs_MuonKine_MuonCuts"))->Fill(mass, pT, muPosRabs); - registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegRabs_MuonKine_MuonCuts"))->Fill(mass, pT, muNegRabs); - // - registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosDca_MuonKine_MuonCuts"))->Fill(mass, pT, muPosDca); - registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegDca_MuonKine_MuonCuts"))->Fill(mass, pT, muNegDca); - // - registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosPhi_MuonKine_MuonCuts"))->Fill(mass, pT, muPosPhi); - registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegPhi_MuonKine_MuonCuts"))->Fill(mass, pT, muNegPhi); - // dimuons - registryDimuon.get(HIST("dimuon/same-event/invariantMass_MuonKine_MuonCuts"))->Fill(mass); - registryDimuon.get(HIST("dimuon/same-event/invariantMassFull_MuonKine_MuonCuts"))->Fill(mass); - registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_MuonKine_MuonCuts"))->Fill(mass, pT); - registryDimuon.get(HIST("dimuon/same-event/rapPair_MuonKine_MuonCuts"))->Fill(yPair); - registryDimuon.get(HIST("dimuon/same-event/invariantMass_rapPair_MuonKine_MuonCuts"))->Fill(mass, yPair); - registryDimuon.get(HIST("dimuon/same-event/pT_rapPair_MuonKine_MuonCuts"))->Fill(pT, yPair); + if (configQAs.fEnableSingleMuonDiMuonCorrelations) { + // single muons + registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosPt_MuonKine_MuonCuts"))->Fill(mass, pT, muPosPt); + registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegPt_MuonKine_MuonCuts"))->Fill(mass, pT, muNegPt); + // + registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosEta_MuonKine_MuonCuts"))->Fill(mass, pT, muPosEta); + registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegEta_MuonKine_MuonCuts"))->Fill(mass, pT, muNegEta); + // + registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosRabs_MuonKine_MuonCuts"))->Fill(mass, pT, muPosRabs); + registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegRabs_MuonKine_MuonCuts"))->Fill(mass, pT, muNegRabs); + // + registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosDca_MuonKine_MuonCuts"))->Fill(mass, pT, muPosDca); + registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegDca_MuonKine_MuonCuts"))->Fill(mass, pT, muNegDca); + // + registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosPhi_MuonKine_MuonCuts"))->Fill(mass, pT, muPosPhi); + registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegPhi_MuonKine_MuonCuts"))->Fill(mass, pT, muNegPhi); + // dimuons + registryDimuon.get(HIST("dimuon/same-event/invariantMass_MuonKine_MuonCuts"))->Fill(mass); + registryDimuon.get(HIST("dimuon/same-event/invariantMassFull_MuonKine_MuonCuts"))->Fill(mass); + registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_MuonKine_MuonCuts"))->Fill(mass, pT); + registryDimuon.get(HIST("dimuon/same-event/rapPair_MuonKine_MuonCuts"))->Fill(yPair); + registryDimuon.get(HIST("dimuon/same-event/invariantMass_rapPair_MuonKine_MuonCuts"))->Fill(mass, yPair); + registryDimuon.get(HIST("dimuon/same-event/pT_rapPair_MuonKine_MuonCuts"))->Fill(pT, yPair); + } + + // dimuon DCA + if (mass >= minJpsiMass && mass <= maxJpsiMass) { + registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosDCAx_minus_MuNegDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosDCAy_minus_MuNegDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } + // dimuon top-bottom and left-right separation if (TopBottom1 == 0 && TopBottom2 == 0) { registryDimuon.get(HIST("dimuon/same-event/invariantMass_MuonKine_MuonCuts_TT"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMassFull_MuonKine_MuonCuts_TT"))->Fill(mass); @@ -2588,6 +2638,10 @@ struct muonQa { registryDimuon.get(HIST("dimuon/same-event/rapPair_MuonKine_MuonCuts_TT"))->Fill(yPair); registryDimuon.get(HIST("dimuon/same-event/invariantMass_rapPair_MuonKine_MuonCuts_TT"))->Fill(mass, yPair); registryDimuon.get(HIST("dimuon/same-event/pT_rapPair_MuonKine_MuonCuts_TT"))->Fill(pT, yPair); + if (mass >= minJpsiMass && mass <= maxJpsiMass) { + registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosTDCAx_minus_MuNegTDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosTDCAy_minus_MuNegTDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } } else if ((TopBottom1 == 0 && TopBottom2 == 1) || (TopBottom1 == 1 && TopBottom2 == 0)) { registryDimuon.get(HIST("dimuon/same-event/invariantMass_MuonKine_MuonCuts_TB"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMassFull_MuonKine_MuonCuts_TB"))->Fill(mass); @@ -2600,20 +2654,36 @@ struct muonQa { registryDimuon.get(HIST("dimuon/same-event/invariantMass_MuonKine_MuonCuts_TPBN"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMassFull_MuonKine_MuonCuts_TPBN"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_MuonKine_MuonCuts_TPBN"))->Fill(mass, pT); + if (mass >= minJpsiMass && mass <= maxJpsiMass) { + registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosTDCAx_minus_MuNegBDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosTDCAy_minus_MuNegBDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } } else { registryDimuon.get(HIST("dimuon/same-event/invariantMass_MuonKine_MuonCuts_TNBP"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMassFull_MuonKine_MuonCuts_TNBP"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_MuonKine_MuonCuts_TNBP"))->Fill(mass, pT); + if (mass >= minJpsiMass && mass <= maxJpsiMass) { + registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosBDCAx_minus_MuNegTDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosBDCAy_minus_MuNegTDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } } } else if (TopBottom1 == 1 && TopBottom2 == 0) { if (sign2 > 0) { registryDimuon.get(HIST("dimuon/same-event/invariantMass_MuonKine_MuonCuts_TPBN"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMassFull_MuonKine_MuonCuts_TPBN"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_MuonKine_MuonCuts_TPBN"))->Fill(mass, pT); + if (mass >= minJpsiMass && mass <= maxJpsiMass) { + registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosTDCAx_minus_MuNegBDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosTDCAy_minus_MuNegBDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } } else { registryDimuon.get(HIST("dimuon/same-event/invariantMass_MuonKine_MuonCuts_TNBP"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMassFull_MuonKine_MuonCuts_TNBP"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_MuonKine_MuonCuts_TNBP"))->Fill(mass, pT); + if (mass >= minJpsiMass && mass <= maxJpsiMass) { + registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosBDCAx_minus_MuNegTDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosBDCAy_minus_MuNegTDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } } } } else if (TopBottom1 == 1 && TopBottom2 == 1) { @@ -2623,6 +2693,10 @@ struct muonQa { registryDimuon.get(HIST("dimuon/same-event/rapPair_MuonKine_MuonCuts_BB"))->Fill(yPair); registryDimuon.get(HIST("dimuon/same-event/invariantMass_rapPair_MuonKine_MuonCuts_BB"))->Fill(mass, yPair); registryDimuon.get(HIST("dimuon/same-event/pT_rapPair_MuonKine_MuonCuts_BB"))->Fill(pT, yPair); + if (mass >= minJpsiMass && mass <= maxJpsiMass) { + registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosBDCAx_minus_MuNegBDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosBDCAy_minus_MuNegBDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } } if (LeftRight1 == 0 && LeftRight2 == 0) { @@ -2637,7 +2711,7 @@ struct muonQa { registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_MuonKine_MuonCuts_LR"))->Fill(mass, pT); registryDimuon.get(HIST("dimuon/same-event/rapPair_MuonKine_MuonCuts_LR"))->Fill(yPair); registryDimuon.get(HIST("dimuon/same-event/invariantMass_rapPair_MuonKine_MuonCuts_LR"))->Fill(mass, yPair); - if (TopBottom1 == 0 && TopBottom2 == 1) { + if (LeftRight1 == 0 && LeftRight2 == 1) { if (sign1 > 0) { registryDimuon.get(HIST("dimuon/same-event/invariantMass_MuonKine_MuonCuts_LPRN"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMassFull_MuonKine_MuonCuts_LPRN"))->Fill(mass); @@ -2647,7 +2721,7 @@ struct muonQa { registryDimuon.get(HIST("dimuon/same-event/invariantMassFull_MuonKine_MuonCuts_LNRP"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_MuonKine_MuonCuts_LNRP"))->Fill(mass, pT); } - } else if (TopBottom1 == 1 && TopBottom2 == 0) { + } else if (LeftRight1 == 1 && LeftRight2 == 0) { if (sign2 > 0) { registryDimuon.get(HIST("dimuon/same-event/invariantMass_MuonKine_MuonCuts_LPRN"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMassFull_MuonKine_MuonCuts_LPRN"))->Fill(mass); @@ -2671,10 +2745,21 @@ struct muonQa { registryDimuon.get(HIST("dimuon/mixed-event/invariantMassFull_MuonKine_MuonCuts"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_MuonKine_MuonCuts"))->Fill(mass, pT); + // dimuon DCA + if (mass >= minJpsiMass && mass <= maxJpsiMass) { + registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosDCAx_minus_MuNegDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosDCAy_minus_MuNegDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } + + // dimuon top-bottom and left-right separation if (TopBottom1 == 0 && TopBottom2 == 0) { registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_MuonKine_MuonCuts_TT"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMassFull_MuonKine_MuonCuts_TT"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_MuonKine_MuonCuts_TT"))->Fill(mass, pT); + if (mass >= minJpsiMass && mass <= maxJpsiMass) { + registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosTDCAx_minus_MuNegTDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosTDCAy_minus_MuNegTDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } } else if ((TopBottom1 == 0 && TopBottom2 == 1) || (TopBottom1 == 1 && TopBottom2 == 0)) { registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_MuonKine_MuonCuts_TB"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMassFull_MuonKine_MuonCuts_TB"))->Fill(mass); @@ -2684,26 +2769,46 @@ struct muonQa { registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_MuonKine_MuonCuts_TPBN"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMassFull_MuonKine_MuonCuts_TPBN"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_MuonKine_MuonCuts_TPBN"))->Fill(mass, pT); + if (mass >= minJpsiMass && mass <= maxJpsiMass) { + registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosTDCAx_minus_MuNegBDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosTDCAy_minus_MuNegBDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } } else { registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_MuonKine_MuonCuts_TNBP"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMassFull_MuonKine_MuonCuts_TNBP"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_MuonKine_MuonCuts_TNBP"))->Fill(mass, pT); + if (mass >= minJpsiMass && mass <= maxJpsiMass) { + registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosBDCAx_minus_MuNegTDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosBDCAy_minus_MuNegTDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } } } else if (TopBottom1 == 1 && TopBottom2 == 0) { if (sign2 > 0) { registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_MuonKine_MuonCuts_TPBN"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMassFull_MuonKine_MuonCuts_TPBN"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_MuonKine_MuonCuts_TPBN"))->Fill(mass, pT); + if (mass >= minJpsiMass && mass <= maxJpsiMass) { + registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosTDCAx_minus_MuNegBDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosTDCAy_minus_MuNegBDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } } else { registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_MuonKine_MuonCuts_TNBP"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMassFull_MuonKine_MuonCuts_TNBP"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_MuonKine_MuonCuts_TNBP"))->Fill(mass, pT); + if (mass >= minJpsiMass && mass <= maxJpsiMass) { + registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosBDCAx_minus_MuNegTDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosBDCAy_minus_MuNegTDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } } } } else if (TopBottom1 == 1 && TopBottom2 == 1) { registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_MuonKine_MuonCuts_BB"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMassFull_MuonKine_MuonCuts_BB"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_MuonKine_MuonCuts_BB"))->Fill(mass, pT); + if (mass >= minJpsiMass && mass <= maxJpsiMass) { + registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosBDCAx_minus_MuNegBDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosBDCAy_minus_MuNegBDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } } if (LeftRight1 == 0 && LeftRight2 == 0) { @@ -2714,7 +2819,7 @@ struct muonQa { registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_MuonKine_MuonCuts_LR"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMassFull_MuonKine_MuonCuts_LR"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_MuonKine_MuonCuts_LR"))->Fill(mass, pT); - if (TopBottom1 == 0 && TopBottom2 == 1) { + if (LeftRight1 == 0 && LeftRight2 == 1) { if (sign1 > 0) { registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_MuonKine_MuonCuts_LPRN"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMassFull_MuonKine_MuonCuts_LPRN"))->Fill(mass); @@ -2724,7 +2829,7 @@ struct muonQa { registryDimuon.get(HIST("dimuon/mixed-event/invariantMassFull_MuonKine_MuonCuts_LNRP"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_MuonKine_MuonCuts_LNRP"))->Fill(mass, pT); } - } else if (TopBottom1 == 1 && TopBottom2 == 0) { + } else if (LeftRight1 == 1 && LeftRight2 == 0) { if (sign2 > 0) { registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_MuonKine_MuonCuts_LPRN"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMassFull_MuonKine_MuonCuts_LPRN"))->Fill(mass); From 6edbb0a49bef0f75c550526b241f94a58b39b6d6 Mon Sep 17 00:00:00 2001 From: Bhagyarathi Sahoo Date: Tue, 7 Oct 2025 22:13:22 +0530 Subject: [PATCH 655/986] [PWGDQ] Fixing the minitree for Rec tracks (#13267) --- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index fee7cc0356f..475bc6d6f8e 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -2001,7 +2001,7 @@ struct AnalysisSameEventPairing { t2.reducedMCTrack().pt(), t2.reducedMCTrack().eta(), t2.reducedMCTrack().phi(), t1.reducedMCTrack().pt(), t1.reducedMCTrack().eta(), t1.reducedMCTrack().phi(), t2.pt(), t2.eta(), t2.phi(), - t2.pt(), t2.eta(), t2.phi()); + t1.pt(), t1.eta(), t1.phi()); } } } From 01cd68cc627c1c6cdd8e81371eb28b29bc761d21 Mon Sep 17 00:00:00 2001 From: Oleksii Lubynets Date: Tue, 7 Oct 2025 22:28:19 +0200 Subject: [PATCH 656/986] [DPG] Refactor tpcSkimsTableCreator (#13246) Co-authored-by: ALICE Builder --- DPG/Tasks/TPC/tpcSkimsTableCreator.cxx | 1697 ++++++++---------------- 1 file changed, 537 insertions(+), 1160 deletions(-) diff --git a/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx b/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx index 136af7ab61c..b9e4e963842 100644 --- a/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx +++ b/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx @@ -26,6 +26,7 @@ /// ROOT #include "TRandom3.h" /// O2 +#include "CommonConstants/PhysicsConstants.h" #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" @@ -46,6 +47,7 @@ #include "Common/TableProducer/PID/pidTPCBase.h" using namespace o2; +using namespace o2::constants::physics; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::track; @@ -67,6 +69,11 @@ struct TreeWriterTpcV0 { Produces rowTPCTreeWithdEdxTrkQA; Produces rowTPCTreeWithTrkQA; + constexpr static o2::track::PID::ID PidElectron{o2::track::PID::Electron}; + constexpr static o2::track::PID::ID PidPion{o2::track::PID::Pion}; + constexpr static o2::track::PID::ID PidKaon{o2::track::PID::Kaon}; + constexpr static o2::track::PID::ID PidProton{o2::track::PID::Proton}; + /// Configurables Configurable nSigmaTOFdautrack{"nSigmaTOFdautrack", 999., "n-sigma TOF cut on the proton daughter tracks. Set 999 to switch it off."}; Configurable nClNorm{"nClNorm", 152., "Number of cluster normalization. Run 2: 159, Run 3 152"}; @@ -74,11 +81,11 @@ struct TreeWriterTpcV0 { Configurable trackSelection{"trackSelection", 1, "Track selection: 0 -> No Cut, 1 -> kGlobalTrack, 2 -> kGlobalTrackWoPtEta, 3 -> kGlobalTrackWoDCA, 4 -> kQualityTracks, 5 -> kInAcceptanceTracks"}; Configurable irSource{"irSource", "T0VTX", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"}; /// Configurables downsampling - Configurable dwnSmplFactor_Pi{"dwnSmplFactor_Pi", 1., "downsampling factor for pions, default fraction to keep is 1."}; - Configurable dwnSmplFactor_Pr{"dwnSmplFactor_Pr", 1., "downsampling factor for protons, default fraction to keep is 1."}; - Configurable dwnSmplFactor_El{"dwnSmplFactor_El", 1., "downsampling factor for electrons, default fraction to keep is 1."}; - Configurable dwnSmplFactor_Ka{"dwnSmplFactor_Ka", 1., "downsampling factor for kaons, default fraction to keep is 1."}; - Configurable sqrtSNN{"sqrt_s_NN", 0., "sqrt(s_NN), used for downsampling with the Tsallis distribution"}; + Configurable dwnSmplFactorPi{"dwnSmplFactorPi", 1., "downsampling factor for pions, default fraction to keep is 1."}; + Configurable dwnSmplFactorPr{"dwnSmplFactorPr", 1., "downsampling factor for protons, default fraction to keep is 1."}; + Configurable dwnSmplFactorEl{"dwnSmplFactorEl", 1., "downsampling factor for electrons, default fraction to keep is 1."}; + Configurable dwnSmplFactorKa{"dwnSmplFactorKa", 1., "downsampling factor for kaons, default fraction to keep is 1."}; + Configurable sqrtSNN{"sqrtSNN", 0., "sqrt(s_NN), used for downsampling with the Tsallis distribution"}; Configurable downsamplingTsalisPions{"downsamplingTsalisPions", -1., "Downsampling factor to reduce the number of pions"}; Configurable downsamplingTsalisProtons{"downsamplingTsalisProtons", -1., "Downsampling factor to reduce the number of protons"}; Configurable downsamplingTsalisElectrons{"downsamplingTsalisElectrons", -1., "Downsampling factor to reduce the number of electrons"}; @@ -88,28 +95,61 @@ struct TreeWriterTpcV0 { Configurable maxPt4dwnsmplTsalisElectrons{"maxPt4dwnsmplTsalisElectrons", 100., "Maximum Pt for applying downsampling factor of electrons"}; Configurable maxPt4dwnsmplTsalisKaons{"maxPt4dwnsmplTsalisKaons", 100., "Maximum Pt for applying downsampling factor of kaons"}; - enum { // Reconstructed V0 - kUndef = -1, - kGamma = 0, - kK0S = 1, - kLambda = 2, - kAntiLambda = 3, - kOmega = 4, - kAntiOmega = 5 + enum { // Reconstructed V0 and cascade + MotherUndef = -1, + MotherGamma = 0, + MotherK0S, + MotherLambda, + MotherAntiLambda, + MotherOmega, + MotherAntiOmega + }; + + enum { + TrackSelectionNoCut = 0, + TrackSelectionGlobalTrack, + TrackSelectionTrackWoPtEta, + TrackSelectionGlobalTrackWoDCA, + TrackSelectionQualityTracks, + TrackSelectionInAcceptanceTracks }; - Filter trackFilter = (trackSelection.node() == 0) || - ((trackSelection.node() == 1) && requireGlobalTrackInFilter()) || - ((trackSelection.node() == 2) && requireGlobalTrackWoPtEtaInFilter()) || - ((trackSelection.node() == 3) && requireGlobalTrackWoDCAInFilter()) || - ((trackSelection.node() == 4) && requireQualityTracksInFilter()) || - ((trackSelection.node() == 5) && requireTrackCutInFilter(TrackSelectionFlags::kInAcceptanceTracks)); + enum { + EventSelectionNo = 0, + EventSelectionRun2, + EventSelectionRun3 + }; + + Filter trackFilter = (trackSelection.node() == static_cast(TrackSelectionNoCut)) || + ((trackSelection.node() == static_cast(TrackSelectionGlobalTrack)) && requireGlobalTrackInFilter()) || + ((trackSelection.node() == static_cast(TrackSelectionTrackWoPtEta)) && requireGlobalTrackWoPtEtaInFilter()) || + ((trackSelection.node() == static_cast(TrackSelectionGlobalTrackWoDCA)) && requireGlobalTrackWoDCAInFilter()) || + ((trackSelection.node() == static_cast(TrackSelectionQualityTracks)) && requireQualityTracksInFilter()) || + ((trackSelection.node() == static_cast(TrackSelectionInAcceptanceTracks)) && requireTrackCutInFilter(TrackSelectionFlags::kInAcceptanceTracks)); ctpRateFetcher mRateFetcher; + struct V0Daughter { + double downsamplingTsalis; + double mass; + double maxPt4dwnsmplTsalis; + double tpcNSigma; + double tofNSigma; + double tpcExpSignal; + o2::track::PID::ID id; + double dwnSmplFactor; + bool isApplyTofNSigmaCut; + }; + + struct V0Mother { + int id; + V0Daughter posDaughter; + V0Daughter negDaughter; + }; + /// Funktion to fill skimmed tables - template - void fillSkimmedV0Table(V0Casc const& v0casc, T const& track, C const& collision, const float nSigmaTPC, const float nSigmaTOF, const float dEdxExp, const o2::track::PID::ID id, int runnumber, double dwnSmplFactor, float hadronicRate) + template + void fillSkimmedV0Table(V0Casc const& v0casc, T const& track, C const& collision, const float nSigmaTPC, const float nSigmaTOF, const float dEdxExp, const o2::track::PID::ID id, const int runnumber, const double dwnSmplFactor, const float hadronicRate) { const double ncl = track.tpcNClsFound(); @@ -118,20 +158,20 @@ struct TreeWriterTpcV0 { const double mass = o2::track::pid_constants::sMasses[id]; const double bg = p / mass; const int multTPC = collision.multTPC(); - auto trackocc = collision.trackOccupancyInTimeRange(); - auto ft0occ = collision.ft0cOccupancyInTimeRange(); + const auto trackOcc = collision.trackOccupancyInTimeRange(); + const auto ft0Occ = collision.ft0cOccupancyInTimeRange(); const float alpha = v0casc.alpha(); const float qt = v0casc.qtarm(); - const float cosPA = GetCosPA(v0casc, collision); + const float cosPA = getCosPA(v0casc, collision); const float pT = v0casc.pt(); - const float v0radius = GetRadius(v0casc); + const float v0radius = getRadius(v0casc); const float gammapsipair = v0casc.psipair(); const double pseudoRndm = track.pt() * 1000. - static_cast(track.pt() * 1000); if (pseudoRndm < dwnSmplFactor) { float usedDedx; - if constexpr (doUseCorreceddEdx) { + if constexpr (DoUseCorrectedDeDx) { usedDedx = track.tpcSignalCorrected(); } else { usedDedx = track.tpcSignal(); @@ -159,149 +199,119 @@ struct TreeWriterTpcV0 { v0radius, gammapsipair, runnumber, - trackocc, - ft0occ, + trackOcc, + ft0Occ, hadronicRate); } }; - template - void fillSkimmedV0TableWithdEdxTrQA(V0Casc const& v0casc, T const& track, TQA const& trackQA, bool existTrkQA, C const& collision, const float nSigmaTPC, const float nSigmaTOF, const float dEdxExp, const o2::track::PID::ID id, int runnumber, double dwnSmplFactor, float hadronicRate) + template + void fillSkimmedV0TableWithTrQAGeneric(V0Casc const& v0casc, T const& track, TQA const& trackQA, const bool existTrkQA, C const& collision, const float nSigmaTPC, const float nSigmaTOF, const float dEdxExp, const o2::track::PID::ID id, const int runnumber, const double dwnSmplFactor, const float hadronicRate, const int bcGlobalIndex, const int bcTimeFrameId, const int bcBcInTimeFrame) { - const double ncl = track.tpcNClsFound(); const double nclPID = track.tpcNClsFindableMinusPID(); const double p = track.tpcInnerParam(); const double mass = o2::track::pid_constants::sMasses[id]; const double bg = p / mass; const int multTPC = collision.multTPC(); - auto trackocc = collision.trackOccupancyInTimeRange(); - auto ft0occ = collision.ft0cOccupancyInTimeRange(); + const auto trackOcc = collision.trackOccupancyInTimeRange(); + const auto ft0Occ = collision.ft0cOccupancyInTimeRange(); const float alpha = v0casc.alpha(); const float qt = v0casc.qtarm(); - const float cosPA = GetCosPA(v0casc, collision); + const float cosPA = getCosPA(v0casc, collision); const float pT = v0casc.pt(); - const float v0radius = GetRadius(v0casc); + const float v0radius = getRadius(v0casc); const float gammapsipair = v0casc.psipair(); const double pseudoRndm = track.pt() * 1000. - static_cast(track.pt() * 1000); if (pseudoRndm < dwnSmplFactor) { float usedDedx; - if constexpr (doUseCorreceddEdx) { + if constexpr (DoUseCorrectedDeDx) { usedDedx = track.tpcSignalCorrected(); } else { usedDedx = track.tpcSignal(); } - rowTPCTreeWithdEdxTrkQA(usedDedx, - 1. / dEdxExp, - track.tpcInnerParam(), - track.tgl(), - track.signed1Pt(), - track.eta(), - track.phi(), - track.y(), - mass, - bg, - multTPC / 11000., - std::sqrt(nClNorm / ncl), - nclPID, - id, - nSigmaTPC, - nSigmaTOF, - alpha, - qt, - cosPA, - pT, - v0radius, - gammapsipair, - runnumber, - trackocc, - ft0occ, - hadronicRate, - existTrkQA ? trackQA.tpcdEdxNorm() : -999); - } - }; - - /// Function to fill skimmed tables - template - void fillSkimmedV0TableWithTrQA(V0Casc const& v0casc, T const& track, TQA const& trackQA, bool existTrkQA, C const& collision, const float nSigmaTPC, const float nSigmaTOF, const float dEdxExp, const o2::track::PID::ID id, int runnumber, double dwnSmplFactor, float hadronicRate, int bcGlobalIndex, int bcTimeFrameId, int bcBcInTimeFrame) - { - - const double ncl = track.tpcNClsFound(); - const double nclPID = track.tpcNClsFindableMinusPID(); - const double p = track.tpcInnerParam(); - const double mass = o2::track::pid_constants::sMasses[id]; - const double bg = p / mass; - const int multTPC = collision.multTPC(); - auto trackocc = collision.trackOccupancyInTimeRange(); - auto ft0occ = collision.ft0cOccupancyInTimeRange(); - - const float alpha = v0casc.alpha(); - const float qt = v0casc.qtarm(); - const float cosPA = GetCosPA(v0casc, collision); - const float pT = v0casc.pt(); - const float v0radius = GetRadius(v0casc); - const float gammapsipair = v0casc.psipair(); - - const double pseudoRndm = track.pt() * 1000. - static_cast(track.pt() * 1000); - if (pseudoRndm < dwnSmplFactor) { - float usedDedx; - if constexpr (doUseCorreceddEdx) { - usedDedx = track.tpcSignalCorrected(); + if constexpr (IsWithdEdx) { + rowTPCTreeWithdEdxTrkQA(usedDedx, + 1. / dEdxExp, + track.tpcInnerParam(), + track.tgl(), + track.signed1Pt(), + track.eta(), + track.phi(), + track.y(), + mass, + bg, + multTPC / 11000., + std::sqrt(nClNorm / ncl), + nclPID, + id, + nSigmaTPC, + nSigmaTOF, + alpha, + qt, + cosPA, + pT, + v0radius, + gammapsipair, + runnumber, + trackOcc, + ft0Occ, + hadronicRate, + existTrkQA ? trackQA.tpcdEdxNorm() : -999); } else { - usedDedx = track.tpcSignal(); + rowTPCTreeWithTrkQA(usedDedx, + 1. / dEdxExp, + track.tpcInnerParam(), + track.tgl(), + track.signed1Pt(), + track.eta(), + track.phi(), + track.y(), + mass, + bg, + multTPC / 11000., + std::sqrt(nClNorm / ncl), + nclPID, + id, + nSigmaTPC, + nSigmaTOF, + alpha, + qt, + cosPA, + pT, + v0radius, + gammapsipair, + runnumber, + trackOcc, + ft0Occ, + hadronicRate, + bcGlobalIndex, + bcTimeFrameId, + bcBcInTimeFrame, + existTrkQA ? trackQA.tpcClusterByteMask() : -999, + existTrkQA ? trackQA.tpcdEdxMax0R() : -999, + existTrkQA ? trackQA.tpcdEdxMax1R() : -999, + existTrkQA ? trackQA.tpcdEdxMax2R() : -999, + existTrkQA ? trackQA.tpcdEdxMax3R() : -999, + existTrkQA ? trackQA.tpcdEdxTot0R() : -999, + existTrkQA ? trackQA.tpcdEdxTot1R() : -999, + existTrkQA ? trackQA.tpcdEdxTot2R() : -999, + existTrkQA ? trackQA.tpcdEdxTot3R() : -999, + existTrkQA ? trackQA.tpcdEdxNorm() : -999); } - rowTPCTreeWithTrkQA(usedDedx, - 1. / dEdxExp, - track.tpcInnerParam(), - track.tgl(), - track.signed1Pt(), - track.eta(), - track.phi(), - track.y(), - mass, - bg, - multTPC / 11000., - std::sqrt(nClNorm / ncl), - nclPID, - id, - nSigmaTPC, - nSigmaTOF, - alpha, - qt, - cosPA, - pT, - v0radius, - gammapsipair, - runnumber, - trackocc, - ft0occ, - hadronicRate, - bcGlobalIndex, - bcTimeFrameId, - bcBcInTimeFrame, - existTrkQA ? trackQA.tpcClusterByteMask() : -999, - existTrkQA ? trackQA.tpcdEdxMax0R() : -999, - existTrkQA ? trackQA.tpcdEdxMax1R() : -999, - existTrkQA ? trackQA.tpcdEdxMax2R() : -999, - existTrkQA ? trackQA.tpcdEdxMax3R() : -999, - existTrkQA ? trackQA.tpcdEdxTot0R() : -999, - existTrkQA ? trackQA.tpcdEdxTot1R() : -999, - existTrkQA ? trackQA.tpcdEdxTot2R() : -999, - existTrkQA ? trackQA.tpcdEdxTot3R() : -999, - existTrkQA ? trackQA.tpcdEdxNorm() : -999); } - }; + } - double tsalisCharged(double pt, double mass, double sqrts) + double tsalisCharged(const double pt, const double mass) { const double a = 6.81, b = 59.24; const double c = 0.082, d = 0.151; const double mt = std::sqrt(mass * mass + pt * pt); - const double n = a + b / sqrts; - const double T = c + d / sqrts; - const double p0 = n * T; + const double n = a + b / sqrtSNN; + const double t = c + d / sqrtSNN; + const double p0 = n * t; const double result = std::pow((1. + mt / p0), -n); return result; }; @@ -309,7 +319,7 @@ struct TreeWriterTpcV0 { /// Random downsampling trigger function using Tsalis/Hagedorn spectra fit (sqrt(s) = 62.4 GeV to 13 TeV) /// as in https://iopscience.iop.org/article/10.1088/2399-6528/aab00f/pdf TRandom3* fRndm = new TRandom3(0); - bool downsampleTsalisCharged(double pt, double factor1Pt, double sqrts, double mass, double maxPt) + bool downsampleTsalisCharged(const double pt, const double factor1Pt, const double mass, const double maxPt) { if (factor1Pt < 0.) { return true; @@ -317,8 +327,8 @@ struct TreeWriterTpcV0 { if (pt > maxPt) { return true; } - const double prob = tsalisCharged(pt, mass, sqrts) * pt; - const double probNorm = tsalisCharged(1., mass, sqrts); + const double prob = tsalisCharged(pt, mass) * pt; + const double probNorm = tsalisCharged(1., mass); if ((fRndm->Rndm() * ((prob / probNorm) * pt * pt)) > factor1Pt) { return false; } else { @@ -330,11 +340,11 @@ struct TreeWriterTpcV0 { template bool isEventSelected(const CollisionType& collision, const TrackType& /*tracks*/) { - if (applyEvSel == 1) { + if (applyEvSel == EventSelectionRun2) { if (!collision.sel7()) { return false; } - } else if (applyEvSel == 2) { + } else if (applyEvSel == EventSelectionRun3) { if (!collision.sel8()) { return false; } @@ -351,548 +361,126 @@ struct TreeWriterTpcV0 { /// Evaluate cosPA of the v0 template - double GetCosPA(V0sWithID::iterator const& v0, CollisionType const&) + double getCosPA(V0sWithID::iterator const& v0, CollisionType const&) { return v0.v0cosPA(); } /// Evaluate cosPA of the cascade template - double GetCosPA(CascsWithID::iterator const& casc, CollisionType const& collision) + double getCosPA(CascsWithID::iterator const& casc, CollisionType const& collision) { return casc.casccosPA(collision.posX(), collision.posY(), collision.posZ()); } /// Evaluate radius of the v0 - double GetRadius(V0sWithID::iterator const& v0) + double getRadius(V0sWithID::iterator const& v0) { return v0.v0radius(); } /// Evaluate radius of the cascade - double GetRadius(CascsWithID::iterator const& casc) + double getRadius(CascsWithID::iterator const& casc) { return casc.cascradius(); } - /// Apply a track quality selection with a filter! - void processStandard(Colls::iterator const& collision, soa::Filtered const& tracks, V0sWithID const& v0s, CascsWithID const& cascs, aod::BCsWithTimestamps const&) + /// Evaluate tpcSignal with or without correction + template + double tpcSignalGeneric(const TrkType& track) { - /// Check event slection - if (!isEventSelected(collision, tracks)) { - return; - } - auto bc = collision.bc_as(); - const int runnumber = bc.runNumber(); - float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * 1.e-3; - - rowTPCTree.reserve(tracks.size()); - - /// Loop over v0 candidates - for (const auto& v0 : v0s) { - auto posTrack = v0.posTrack_as>(); - auto negTrack = v0.negTrack_as>(); - if (v0.v0addid() == -1) { - continue; - } - // gamma - if (static_cast(posTrack.pidbit() & (1 << 0)) && static_cast(negTrack.pidbit() & (1 << 0))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisElectrons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Electron], maxPt4dwnsmplTsalisElectrons)) { - fillSkimmedV0Table(v0, posTrack, collision, posTrack.tpcNSigmaEl(), posTrack.tofNSigmaEl(), posTrack.tpcExpSignalEl(posTrack.tpcSignal()), o2::track::PID::Electron, runnumber, dwnSmplFactor_El, hadronicRate); - } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisElectrons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Electron], maxPt4dwnsmplTsalisElectrons)) { - fillSkimmedV0Table(v0, negTrack, collision, negTrack.tpcNSigmaEl(), negTrack.tofNSigmaEl(), negTrack.tpcExpSignalEl(negTrack.tpcSignal()), o2::track::PID::Electron, runnumber, dwnSmplFactor_El, hadronicRate); - } - } - // Ks0 - if (static_cast(posTrack.pidbit() & (1 << 1)) && static_cast(negTrack.pidbit() & (1 << 1))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { - fillSkimmedV0Table(v0, posTrack, collision, posTrack.tpcNSigmaPi(), posTrack.tofNSigmaPi(), posTrack.tpcExpSignalPi(posTrack.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); - } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { - fillSkimmedV0Table(v0, negTrack, collision, negTrack.tpcNSigmaPi(), negTrack.tofNSigmaPi(), negTrack.tpcExpSignalPi(negTrack.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); - } - } - // Lambda - if (static_cast(posTrack.pidbit() & (1 << 2)) && static_cast(negTrack.pidbit() & (1 << 2))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton], maxPt4dwnsmplTsalisProtons)) { - if (std::abs(posTrack.tofNSigmaPr()) <= nSigmaTOFdautrack) { - fillSkimmedV0Table(v0, posTrack, collision, posTrack.tpcNSigmaPr(), posTrack.tofNSigmaPr(), posTrack.tpcExpSignalPr(posTrack.tpcSignal()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate); - } - } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { - fillSkimmedV0Table(v0, negTrack, collision, negTrack.tpcNSigmaPi(), negTrack.tofNSigmaPi(), negTrack.tpcExpSignalPi(negTrack.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); - } - } - // Antilambda - if (static_cast(posTrack.pidbit() & (1 << 3)) && static_cast(negTrack.pidbit() & (1 << 3))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { - fillSkimmedV0Table(v0, posTrack, collision, posTrack.tpcNSigmaPi(), posTrack.tofNSigmaPi(), posTrack.tpcExpSignalPi(posTrack.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); - } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton], maxPt4dwnsmplTsalisProtons)) { - if (std::abs(negTrack.tofNSigmaPr()) <= nSigmaTOFdautrack) { - fillSkimmedV0Table(v0, negTrack, collision, negTrack.tpcNSigmaPr(), negTrack.tofNSigmaPr(), negTrack.tpcExpSignalPr(negTrack.tpcSignal()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate); - } - } - } - } - - /// Loop over cascade candidates - for (const auto& casc : cascs) { - auto bachTrack = casc.bachelor_as>(); - if (casc.cascaddid() == kUndef) { - continue; - } - // Omega and antiomega - if (static_cast(bachTrack.pidbit() & (1 << kOmega)) || static_cast(bachTrack.pidbit() & (1 << kAntiOmega))) { - if (downsampleTsalisCharged(bachTrack.pt(), downsamplingTsalisKaons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Kaon], maxPt4dwnsmplTsalisKaons)) { - fillSkimmedV0Table(casc, bachTrack, collision, bachTrack.tpcNSigmaKa(), bachTrack.tofNSigmaKa(), bachTrack.tpcExpSignalKa(bachTrack.tpcSignal()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka, hadronicRate); - } - } + if constexpr (IsCorrectedDeDx) { + return track.tpcSignalCorrected(); + } else { + return track.tpcSignal(); } + } - } /// process Standard - PROCESS_SWITCH(TreeWriterTpcV0, processStandard, "Standard V0 Samples for PID", true); - - void processStandardWithCorrecteddEdx(Colls::iterator const& collision, soa::Filtered const& tracks, V0sWithID const& v0s, CascsWithID const& cascs, aod::BCsWithTimestamps const&) + template + void runStandard(Colls::iterator const& collision, soa::Filtered const& tracks, V0sWithID const& v0s, CascsWithID const& cascs) { /// Check event slection if (!isEventSelected(collision, tracks)) { return; } - auto bc = collision.bc_as(); + const auto& bc = collision.bc_as(); const int runnumber = bc.runNumber(); - float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * 1.e-3; + const float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * 1.e-3; rowTPCTree.reserve(tracks.size()); /// Loop over v0 candidates for (const auto& v0 : v0s) { - auto posTrack = v0.posTrack_as>(); - auto negTrack = v0.negTrack_as>(); - if (v0.v0addid() == -1) { - continue; - } - // gamma - if (static_cast(posTrack.pidbit() & (1 << 0)) && static_cast(negTrack.pidbit() & (1 << 0))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisElectrons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Electron], maxPt4dwnsmplTsalisElectrons)) { - fillSkimmedV0Table(v0, posTrack, collision, posTrack.tpcNSigmaEl(), posTrack.tofNSigmaEl(), posTrack.tpcExpSignalEl(posTrack.tpcSignalCorrected()), o2::track::PID::Electron, runnumber, dwnSmplFactor_El, hadronicRate); - } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisElectrons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Electron], maxPt4dwnsmplTsalisElectrons)) { - fillSkimmedV0Table(v0, negTrack, collision, negTrack.tpcNSigmaEl(), negTrack.tofNSigmaEl(), negTrack.tpcExpSignalEl(negTrack.tpcSignalCorrected()), o2::track::PID::Electron, runnumber, dwnSmplFactor_El, hadronicRate); - } - } - // Ks0 - if (static_cast(posTrack.pidbit() & (1 << 1)) && static_cast(negTrack.pidbit() & (1 << 1))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { - fillSkimmedV0Table(v0, posTrack, collision, posTrack.tpcNSigmaPi(), posTrack.tofNSigmaPi(), posTrack.tpcExpSignalPi(posTrack.tpcSignalCorrected()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); - } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { - fillSkimmedV0Table(v0, negTrack, collision, negTrack.tpcNSigmaPi(), negTrack.tofNSigmaPi(), negTrack.tpcExpSignalPi(negTrack.tpcSignalCorrected()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); - } - } - // Lambda - if (static_cast(posTrack.pidbit() & (1 << 2)) && static_cast(negTrack.pidbit() & (1 << 2))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton], maxPt4dwnsmplTsalisProtons)) { - if (std::abs(posTrack.tofNSigmaPr()) <= nSigmaTOFdautrack) { - fillSkimmedV0Table(v0, posTrack, collision, posTrack.tpcNSigmaPr(), posTrack.tofNSigmaPr(), posTrack.tpcExpSignalPr(posTrack.tpcSignalCorrected()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate); - } - } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { - fillSkimmedV0Table(v0, negTrack, collision, negTrack.tpcNSigmaPi(), negTrack.tofNSigmaPi(), negTrack.tpcExpSignalPi(negTrack.tpcSignalCorrected()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); - } - } - // Antilambda - if (static_cast(posTrack.pidbit() & (1 << 3)) && static_cast(negTrack.pidbit() & (1 << 3))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { - fillSkimmedV0Table(v0, posTrack, collision, posTrack.tpcNSigmaPi(), posTrack.tofNSigmaPi(), posTrack.tpcExpSignalPi(posTrack.tpcSignalCorrected()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); - } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton], maxPt4dwnsmplTsalisProtons)) { - if (std::abs(negTrack.tofNSigmaPr()) <= nSigmaTOFdautrack) { - fillSkimmedV0Table(v0, negTrack, collision, negTrack.tpcNSigmaPr(), negTrack.tofNSigmaPr(), negTrack.tpcExpSignalPr(negTrack.tpcSignalCorrected()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate); - } - } - } - } - - /// Loop over cascade candidates - for (const auto& casc : cascs) { - auto bachTrack = casc.bachelor_as>(); - if (casc.cascaddid() == kUndef) { - continue; - } - // Omega and antiomega - if (static_cast(bachTrack.pidbit() & (1 << kOmega)) || static_cast(bachTrack.pidbit() & (1 << kAntiOmega))) { - if (downsampleTsalisCharged(bachTrack.pt(), downsamplingTsalisKaons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Kaon], maxPt4dwnsmplTsalisKaons)) { - fillSkimmedV0Table(casc, bachTrack, collision, bachTrack.tpcNSigmaKa(), bachTrack.tofNSigmaKa(), bachTrack.tpcExpSignalKa(bachTrack.tpcSignal()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka, hadronicRate); - } - } - } - } /// process StandardWithCorrecteddEdx - PROCESS_SWITCH(TreeWriterTpcV0, processStandardWithCorrecteddEdx, "Standard V0 Samples for PID with corrected dEdx", false); - - Preslice perCollisionTracks = aod::track::collisionId; - Preslice perCollisionV0s = aod::v0data::collisionId; - Preslice perCollisionCascs = aod::cascdata::collisionId; - void processWithdEdxTrQA(Colls const& collisions, Trks const& myTracks, V0sWithID const& myV0s, CascsWithID const& myCascs, aod::BCsWithTimestamps const&, aod::TracksQAVersion const& tracksQA) - { - std::vector labelTrack2TrackQA; - labelTrack2TrackQA.clear(); - labelTrack2TrackQA.resize(myTracks.size(), -1); - for (const auto& trackQA : tracksQA) { - int64_t trackId = trackQA.trackId(); - int64_t trackQAIndex = trackQA.globalIndex(); - labelTrack2TrackQA[trackId] = trackQAIndex; - } - for (const auto& collision : collisions) { - auto tracks = myTracks.sliceBy(perCollisionTracks, collision.globalIndex()); - auto v0s = myV0s.sliceBy(perCollisionV0s, collision.globalIndex()); - auto cascs = myCascs.sliceBy(perCollisionCascs, collision.globalIndex()); - /// Check event slection - if (!isEventSelected(collision, tracks)) { - continue; - } - auto bc = collision.bc_as(); - const int runnumber = bc.runNumber(); - float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * 1.e-3; - rowTPCTreeWithTrkQA.reserve(tracks.size()); - /// Loop over v0 candidates - for (const auto& v0 : v0s) { - auto posTrack = v0.posTrack_as(); - auto negTrack = v0.negTrack_as(); - if (v0.v0addid() == -1) { - continue; - } - aod::TracksQA posTrackQA; - aod::TracksQA negTrackQA; - bool existPosTrkQA; - bool existNegTrkQA; - if (labelTrack2TrackQA[posTrack.globalIndex()] != -1) { - posTrackQA = tracksQA.iteratorAt(labelTrack2TrackQA[posTrack.globalIndex()]); - existPosTrkQA = true; - } else { - posTrackQA = tracksQA.iteratorAt(0); - existPosTrkQA = false; - } - if (labelTrack2TrackQA[negTrack.globalIndex()] != -1) { - negTrackQA = tracksQA.iteratorAt(labelTrack2TrackQA[negTrack.globalIndex()]); - existNegTrkQA = true; - } else { - negTrackQA = tracksQA.iteratorAt(0); - existNegTrkQA = false; - } - - // gamma - if (static_cast(posTrack.pidbit() & (1 << 0)) && static_cast(negTrack.pidbit() & (1 << 0))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisElectrons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Electron], maxPt4dwnsmplTsalisElectrons)) { - fillSkimmedV0TableWithdEdxTrQA(v0, posTrack, posTrackQA, existPosTrkQA, collision, posTrack.tpcNSigmaEl(), posTrack.tofNSigmaEl(), posTrack.tpcExpSignalEl(posTrack.tpcSignal()), o2::track::PID::Electron, runnumber, dwnSmplFactor_El, hadronicRate); - } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisElectrons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Electron], maxPt4dwnsmplTsalisElectrons)) { - fillSkimmedV0TableWithdEdxTrQA(v0, negTrack, negTrackQA, existNegTrkQA, collision, negTrack.tpcNSigmaEl(), negTrack.tofNSigmaEl(), negTrack.tpcExpSignalEl(negTrack.tpcSignal()), o2::track::PID::Electron, runnumber, dwnSmplFactor_El, hadronicRate); - } - } - // Ks0 - if (static_cast(posTrack.pidbit() & (1 << 1)) && static_cast(negTrack.pidbit() & (1 << 1))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { - fillSkimmedV0TableWithdEdxTrQA(v0, posTrack, posTrackQA, existPosTrkQA, collision, posTrack.tpcNSigmaPi(), posTrack.tofNSigmaPi(), posTrack.tpcExpSignalPi(posTrack.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); - } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { - fillSkimmedV0TableWithdEdxTrQA(v0, negTrack, negTrackQA, existNegTrkQA, collision, negTrack.tpcNSigmaPi(), negTrack.tofNSigmaPi(), negTrack.tpcExpSignalPi(negTrack.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); - } - } - // Lambda - if (static_cast(posTrack.pidbit() & (1 << 2)) && static_cast(negTrack.pidbit() & (1 << 2))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton], maxPt4dwnsmplTsalisProtons)) { - if (std::abs(posTrack.tofNSigmaPr()) <= nSigmaTOFdautrack) { - fillSkimmedV0TableWithdEdxTrQA(v0, posTrack, posTrackQA, existPosTrkQA, collision, posTrack.tpcNSigmaPr(), posTrack.tofNSigmaPr(), posTrack.tpcExpSignalPr(posTrack.tpcSignal()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate); - } - } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { - fillSkimmedV0TableWithdEdxTrQA(v0, negTrack, negTrackQA, existNegTrkQA, collision, negTrack.tpcNSigmaPi(), negTrack.tofNSigmaPi(), negTrack.tpcExpSignalPi(negTrack.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); - } - } - // Antilambda - if (static_cast(posTrack.pidbit() & (1 << 3)) && static_cast(negTrack.pidbit() & (1 << 3))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { - fillSkimmedV0TableWithdEdxTrQA(v0, posTrack, posTrackQA, existPosTrkQA, collision, posTrack.tpcNSigmaPi(), posTrack.tofNSigmaPi(), posTrack.tpcExpSignalPi(posTrack.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); - } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton], maxPt4dwnsmplTsalisProtons)) { - if (std::abs(negTrack.tofNSigmaPr()) <= nSigmaTOFdautrack) { - fillSkimmedV0TableWithdEdxTrQA(v0, negTrack, negTrackQA, existNegTrkQA, collision, negTrack.tpcNSigmaPr(), negTrack.tofNSigmaPr(), negTrack.tpcExpSignalPr(negTrack.tpcSignal()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate); - } - } - } - } - - /// Loop over cascade candidates - for (const auto& casc : cascs) { - auto bachTrack = casc.bachelor_as(); - if (casc.cascaddid() == kUndef) { - continue; - } - - aod::TracksQA bachTrackQA; - bool existBachTrkQA; - if (labelTrack2TrackQA[bachTrack.globalIndex()] != -1) { - bachTrackQA = tracksQA.iteratorAt(labelTrack2TrackQA[bachTrack.globalIndex()]); - existBachTrkQA = true; - } else { - bachTrackQA = tracksQA.iteratorAt(0); - existBachTrkQA = false; - } - - // Omega and antiomega - if (static_cast(bachTrack.pidbit() & (1 << kOmega)) || static_cast(bachTrack.pidbit() & (1 << kAntiOmega))) { - if (downsampleTsalisCharged(bachTrack.pt(), downsamplingTsalisKaons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Kaon], maxPt4dwnsmplTsalisKaons)) { - fillSkimmedV0TableWithdEdxTrQA(casc, bachTrack, bachTrackQA, existBachTrkQA, collision, bachTrack.tpcNSigmaKa(), bachTrack.tofNSigmaKa(), bachTrack.tpcExpSignalKa(bachTrack.tpcSignal()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka, hadronicRate); - } - } - } - } - } /// process with dEdx from TrackQA - PROCESS_SWITCH(TreeWriterTpcV0, processWithdEdxTrQA, "Standard V0 Samples with dEdx from Track QA for PID", false); - - Preslice perCollisionTracksWithNewDEdx = aod::track::collisionId; - void processWithdEdxTrQAWithCorrecteddEdx(Colls const& collisions, TrksWithDEdxCorrection const& myTracks, V0sWithID const& myV0s, CascsWithID const& myCascs, aod::BCsWithTimestamps const&, aod::TracksQAVersion const& tracksQA) - { - std::vector labelTrack2TrackQA; - labelTrack2TrackQA.clear(); - labelTrack2TrackQA.resize(myTracks.size(), -1); - for (const auto& trackQA : tracksQA) { - int64_t trackId = trackQA.trackId(); - int64_t trackQAIndex = trackQA.globalIndex(); - labelTrack2TrackQA[trackId] = trackQAIndex; - } - for (const auto& collision : collisions) { - auto tracks = myTracks.sliceBy(perCollisionTracksWithNewDEdx, collision.globalIndex()); - auto v0s = myV0s.sliceBy(perCollisionV0s, collision.globalIndex()); - auto cascs = myCascs.sliceBy(perCollisionCascs, collision.globalIndex()); - /// Check event slection - if (!isEventSelected(collision, tracks)) { + if (v0.v0addid() == MotherUndef) { continue; } - auto bc = collision.bc_as(); - const int runnumber = bc.runNumber(); - float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * 1.e-3; - rowTPCTreeWithTrkQA.reserve(tracks.size()); - /// Loop over v0 candidates - for (const auto& v0 : v0s) { - auto posTrack = v0.posTrack_as(); - auto negTrack = v0.negTrack_as(); - if (v0.v0addid() == -1) { - continue; - } - aod::TracksQA posTrackQA; - aod::TracksQA negTrackQA; - bool existPosTrkQA; - bool existNegTrkQA; - if (labelTrack2TrackQA[posTrack.globalIndex()] != -1) { - posTrackQA = tracksQA.iteratorAt(labelTrack2TrackQA[posTrack.globalIndex()]); - existPosTrkQA = true; - } else { - posTrackQA = tracksQA.iteratorAt(0); - existPosTrkQA = false; - } - if (labelTrack2TrackQA[negTrack.globalIndex()] != -1) { - negTrackQA = tracksQA.iteratorAt(labelTrack2TrackQA[negTrack.globalIndex()]); - existNegTrkQA = true; - } else { - negTrackQA = tracksQA.iteratorAt(0); - existNegTrkQA = false; - } - - // gamma - if (static_cast(posTrack.pidbit() & (1 << 0)) && static_cast(negTrack.pidbit() & (1 << 0))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisElectrons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Electron], maxPt4dwnsmplTsalisElectrons)) { - fillSkimmedV0TableWithdEdxTrQA(v0, posTrack, posTrackQA, existPosTrkQA, collision, posTrack.tpcNSigmaEl(), posTrack.tofNSigmaEl(), posTrack.tpcExpSignalEl(posTrack.tpcSignalCorrected()), o2::track::PID::Electron, runnumber, dwnSmplFactor_El, hadronicRate); - } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisElectrons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Electron], maxPt4dwnsmplTsalisElectrons)) { - fillSkimmedV0TableWithdEdxTrQA(v0, negTrack, negTrackQA, existNegTrkQA, collision, negTrack.tpcNSigmaEl(), negTrack.tofNSigmaEl(), negTrack.tpcExpSignalEl(negTrack.tpcSignalCorrected()), o2::track::PID::Electron, runnumber, dwnSmplFactor_El, hadronicRate); - } - } - // Ks0 - if (static_cast(posTrack.pidbit() & (1 << 1)) && static_cast(negTrack.pidbit() & (1 << 1))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { - fillSkimmedV0TableWithdEdxTrQA(v0, posTrack, posTrackQA, existPosTrkQA, collision, posTrack.tpcNSigmaPi(), posTrack.tofNSigmaPi(), posTrack.tpcExpSignalPi(posTrack.tpcSignalCorrected()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); - } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { - fillSkimmedV0TableWithdEdxTrQA(v0, negTrack, negTrackQA, existNegTrkQA, collision, negTrack.tpcNSigmaPi(), negTrack.tofNSigmaPi(), negTrack.tpcExpSignalPi(negTrack.tpcSignalCorrected()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); - } - } - // Lambda - if (static_cast(posTrack.pidbit() & (1 << 2)) && static_cast(negTrack.pidbit() & (1 << 2))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton], maxPt4dwnsmplTsalisProtons)) { - if (std::abs(posTrack.tofNSigmaPr()) <= nSigmaTOFdautrack) { - fillSkimmedV0TableWithdEdxTrQA(v0, posTrack, posTrackQA, existPosTrkQA, collision, posTrack.tpcNSigmaPr(), posTrack.tofNSigmaPr(), posTrack.tpcExpSignalPr(posTrack.tpcSignal()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate); + const auto& posTrack = v0.posTrack_as>(); + const auto& negTrack = v0.negTrack_as>(); + + V0Daughter elPos{downsamplingTsalisElectrons, MassElectron, maxPt4dwnsmplTsalisElectrons, posTrack.tpcNSigmaEl(), posTrack.tofNSigmaEl(), posTrack.tpcExpSignalEl(tpcSignalGeneric(posTrack)), PidElectron, dwnSmplFactorEl, false}; + V0Daughter elNeg{downsamplingTsalisElectrons, MassElectron, maxPt4dwnsmplTsalisElectrons, negTrack.tpcNSigmaEl(), negTrack.tofNSigmaEl(), negTrack.tpcExpSignalEl(tpcSignalGeneric(negTrack)), PidElectron, dwnSmplFactorEl, false}; + V0Daughter piPos{downsamplingTsalisPions, MassPiPlus, maxPt4dwnsmplTsalisPions, posTrack.tpcNSigmaPi(), posTrack.tofNSigmaPi(), posTrack.tpcExpSignalPi(tpcSignalGeneric(posTrack)), PidPion, dwnSmplFactorPi, false}; + V0Daughter piNeg{downsamplingTsalisPions, MassPiPlus, maxPt4dwnsmplTsalisPions, negTrack.tpcNSigmaPi(), negTrack.tofNSigmaPi(), negTrack.tpcExpSignalPi(tpcSignalGeneric(negTrack)), PidPion, dwnSmplFactorPi, false}; + V0Daughter prPos{downsamplingTsalisProtons, MassProton, maxPt4dwnsmplTsalisProtons, posTrack.tpcNSigmaPr(), posTrack.tofNSigmaPr(), posTrack.tpcExpSignalPr(tpcSignalGeneric(posTrack)), PidProton, dwnSmplFactorPr, true}; + V0Daughter prNeg{downsamplingTsalisProtons, MassProton, maxPt4dwnsmplTsalisProtons, negTrack.tpcNSigmaPr(), negTrack.tofNSigmaPr(), negTrack.tpcExpSignalPr(tpcSignalGeneric(negTrack)), PidProton, dwnSmplFactorPr, true}; + + const std::array v0Mothers{ + V0Mother{MotherGamma, elPos, elNeg}, + V0Mother{MotherK0S, piPos, piNeg}, + V0Mother{MotherLambda, prPos, piNeg}, + V0Mother{MotherAntiLambda, piPos, prNeg}}; + + for (const auto& v0Mother : v0Mothers) { + if (static_cast(posTrack.pidbit() & (1 << v0Mother.id)) && static_cast(negTrack.pidbit() & (1 << v0Mother.id))) { + bool isPosDaughter{true}; + for (const auto& daughter : {v0Mother.posDaughter, v0Mother.negDaughter}) { + const auto& dauTrack = isPosDaughter ? posTrack : negTrack; + if (downsampleTsalisCharged(dauTrack.pt(), daughter.downsamplingTsalis, daughter.mass, daughter.maxPt4dwnsmplTsalis)) { + if (!daughter.isApplyTofNSigmaCut || std::fabs(daughter.tofNSigma) <= nSigmaTOFdautrack) { + fillSkimmedV0Table(v0, dauTrack, collision, daughter.tpcNSigma, daughter.tofNSigma, daughter.tpcExpSignal, daughter.id, runnumber, daughter.dwnSmplFactor, hadronicRate); + } } - } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { - fillSkimmedV0TableWithdEdxTrQA(v0, negTrack, negTrackQA, existNegTrkQA, collision, negTrack.tpcNSigmaPi(), negTrack.tofNSigmaPi(), negTrack.tpcExpSignalPi(negTrack.tpcSignalCorrected()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); - } - } - // Antilambda - if (static_cast(posTrack.pidbit() & (1 << 3)) && static_cast(negTrack.pidbit() & (1 << 3))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { - fillSkimmedV0TableWithdEdxTrQA(v0, posTrack, posTrackQA, existPosTrkQA, collision, posTrack.tpcNSigmaPi(), posTrack.tofNSigmaPi(), posTrack.tpcExpSignalPi(posTrack.tpcSignalCorrected()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); - } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton], maxPt4dwnsmplTsalisProtons)) { - if (std::abs(negTrack.tofNSigmaPr()) <= nSigmaTOFdautrack) { - fillSkimmedV0TableWithdEdxTrQA(v0, negTrack, negTrackQA, existNegTrkQA, collision, negTrack.tpcNSigmaPr(), negTrack.tofNSigmaPr(), negTrack.tpcExpSignalPr(negTrack.tpcSignalCorrected()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate); - } - } - } - } - - /// Loop over cascade candidates - for (const auto& casc : cascs) { - auto bachTrack = casc.bachelor_as(); - if (casc.cascaddid() == kUndef) { - continue; - } - - aod::TracksQA bachTrackQA; - bool existBachTrkQA; - if (labelTrack2TrackQA[bachTrack.globalIndex()] != -1) { - bachTrackQA = tracksQA.iteratorAt(labelTrack2TrackQA[bachTrack.globalIndex()]); - existBachTrkQA = true; - } else { - bachTrackQA = tracksQA.iteratorAt(0); - existBachTrkQA = false; - } - - // Omega and antiomega - if (static_cast(bachTrack.pidbit() & (1 << kOmega)) || static_cast(bachTrack.pidbit() & (1 << kAntiOmega))) { - if (downsampleTsalisCharged(bachTrack.pt(), downsamplingTsalisKaons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Kaon], maxPt4dwnsmplTsalisKaons)) { - fillSkimmedV0TableWithdEdxTrQA(casc, bachTrack, bachTrackQA, existBachTrkQA, collision, bachTrack.tpcNSigmaKa(), bachTrack.tofNSigmaKa(), bachTrack.tpcExpSignalKa(bachTrack.tpcSignal()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka, hadronicRate); + isPosDaughter = false; } } - } + } // v0Mothers } - } /// process with dEdx from TrackQA - PROCESS_SWITCH(TreeWriterTpcV0, processWithdEdxTrQAWithCorrecteddEdx, "Standard V0 Samples with dEdx from Track QA for PID with corrected dEdx", false); - - void processWithTrQA(Colls const& collisions, Trks const& myTracks, V0sWithID const& myV0s, CascsWithID const& myCascs, MyBCTable const&, aod::TracksQAVersion const& tracksQA) - { - std::vector labelTrack2TrackQA; - labelTrack2TrackQA.clear(); - labelTrack2TrackQA.resize(myTracks.size(), -1); - for (const auto& trackQA : tracksQA) { - int64_t trackId = trackQA.trackId(); - int64_t trackQAIndex = trackQA.globalIndex(); - labelTrack2TrackQA[trackId] = trackQAIndex; - } - for (const auto& collision : collisions) { - auto tracks = myTracks.sliceBy(perCollisionTracks, collision.globalIndex()); - auto v0s = myV0s.sliceBy(perCollisionV0s, collision.globalIndex()); - auto cascs = myCascs.sliceBy(perCollisionCascs, collision.globalIndex()); - /// Check event slection - if (!isEventSelected(collision, tracks)) { - continue; - } - auto bc = collision.bc_as(); - const int runnumber = bc.runNumber(); - float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * 1.e-3; - const int bcGlobalIndex = bc.globalIndex(); - const int bcTimeFrameId = bc.tfId(); - const int bcBcInTimeFrame = bc.bcInTF(); - rowTPCTreeWithTrkQA.reserve(tracks.size()); - /// Loop over v0 candidates - for (const auto& v0 : v0s) { - auto posTrack = v0.posTrack_as(); - auto negTrack = v0.negTrack_as(); - if (v0.v0addid() == -1) { - continue; - } - aod::TracksQA posTrackQA; - aod::TracksQA negTrackQA; - bool existPosTrkQA; - bool existNegTrkQA; - if (labelTrack2TrackQA[posTrack.globalIndex()] != -1) { - posTrackQA = tracksQA.iteratorAt(labelTrack2TrackQA[posTrack.globalIndex()]); - existPosTrkQA = true; - } else { - posTrackQA = tracksQA.iteratorAt(0); - existPosTrkQA = false; - } - if (labelTrack2TrackQA[negTrack.globalIndex()] != -1) { - negTrackQA = tracksQA.iteratorAt(labelTrack2TrackQA[negTrack.globalIndex()]); - existNegTrkQA = true; - } else { - negTrackQA = tracksQA.iteratorAt(0); - existNegTrkQA = false; - } - - // gamma - if (static_cast(posTrack.pidbit() & (1 << 0)) && static_cast(negTrack.pidbit() & (1 << 0))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisElectrons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Electron], maxPt4dwnsmplTsalisElectrons)) { - fillSkimmedV0TableWithTrQA(v0, posTrack, posTrackQA, existPosTrkQA, collision, posTrack.tpcNSigmaEl(), posTrack.tofNSigmaEl(), posTrack.tpcExpSignalEl(posTrack.tpcSignal()), o2::track::PID::Electron, runnumber, dwnSmplFactor_El, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisElectrons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Electron], maxPt4dwnsmplTsalisElectrons)) { - fillSkimmedV0TableWithTrQA(v0, negTrack, negTrackQA, existNegTrkQA, collision, negTrack.tpcNSigmaEl(), negTrack.tofNSigmaEl(), negTrack.tpcExpSignalEl(negTrack.tpcSignal()), o2::track::PID::Electron, runnumber, dwnSmplFactor_El, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - } - // Ks0 - if (static_cast(posTrack.pidbit() & (1 << 1)) && static_cast(negTrack.pidbit() & (1 << 1))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { - fillSkimmedV0TableWithTrQA(v0, posTrack, posTrackQA, existPosTrkQA, collision, posTrack.tpcNSigmaPi(), posTrack.tofNSigmaPi(), posTrack.tpcExpSignalPi(posTrack.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { - fillSkimmedV0TableWithTrQA(v0, negTrack, negTrackQA, existNegTrkQA, collision, negTrack.tpcNSigmaPi(), negTrack.tofNSigmaPi(), negTrack.tpcExpSignalPi(negTrack.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - } - // Lambda - if (static_cast(posTrack.pidbit() & (1 << 2)) && static_cast(negTrack.pidbit() & (1 << 2))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton], maxPt4dwnsmplTsalisProtons)) { - if (std::abs(posTrack.tofNSigmaPr()) <= nSigmaTOFdautrack) { - fillSkimmedV0TableWithTrQA(v0, posTrack, posTrackQA, existPosTrkQA, collision, posTrack.tpcNSigmaPr(), posTrack.tofNSigmaPr(), posTrack.tpcExpSignalPr(posTrack.tpcSignal()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { - fillSkimmedV0TableWithTrQA(v0, negTrack, negTrackQA, existNegTrkQA, collision, negTrack.tpcNSigmaPi(), negTrack.tofNSigmaPi(), negTrack.tpcExpSignalPi(negTrack.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - } - // Antilambda - if (static_cast(posTrack.pidbit() & (1 << 3)) && static_cast(negTrack.pidbit() & (1 << 3))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { - fillSkimmedV0TableWithTrQA(v0, posTrack, posTrackQA, existPosTrkQA, collision, posTrack.tpcNSigmaPi(), posTrack.tofNSigmaPi(), posTrack.tpcExpSignalPi(posTrack.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton], maxPt4dwnsmplTsalisProtons)) { - if (std::abs(negTrack.tofNSigmaPr()) <= nSigmaTOFdautrack) { - fillSkimmedV0TableWithTrQA(v0, negTrack, negTrackQA, existNegTrkQA, collision, negTrack.tpcNSigmaPr(), negTrack.tofNSigmaPr(), negTrack.tpcExpSignalPr(negTrack.tpcSignal()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - } - } - } - /// Loop over cascade candidates - for (const auto& casc : cascs) { - auto bachTrack = casc.bachelor_as(); - if (casc.cascaddid() == kUndef) { - continue; - } - - aod::TracksQA bachTrackQA; - bool existBachTrkQA; - if (labelTrack2TrackQA[bachTrack.globalIndex()] != -1) { - bachTrackQA = tracksQA.iteratorAt(labelTrack2TrackQA[bachTrack.globalIndex()]); - existBachTrkQA = true; - } else { - bachTrackQA = tracksQA.iteratorAt(0); - existBachTrkQA = false; - } - - // Omega and antiomega - if (static_cast(bachTrack.pidbit() & (1 << kOmega)) || static_cast(bachTrack.pidbit() & (1 << kAntiOmega))) { - if (downsampleTsalisCharged(bachTrack.pt(), downsamplingTsalisKaons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Kaon], maxPt4dwnsmplTsalisKaons)) { - fillSkimmedV0TableWithTrQA(casc, bachTrack, bachTrackQA, existBachTrkQA, collision, bachTrack.tpcNSigmaKa(), bachTrack.tofNSigmaKa(), bachTrack.tpcExpSignalKa(bachTrack.tpcSignal()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } + /// Loop over cascade candidates + for (const auto& casc : cascs) { + if (casc.cascaddid() == MotherUndef) { + continue; + } + const auto& bachTrack = casc.bachelor_as>(); + // Omega and antiomega + if (static_cast(bachTrack.pidbit() & (1 << MotherOmega)) || static_cast(bachTrack.pidbit() & (1 << MotherAntiOmega))) { + if (downsampleTsalisCharged(bachTrack.pt(), downsamplingTsalisKaons, MassKPlus, maxPt4dwnsmplTsalisKaons)) { + fillSkimmedV0Table(casc, bachTrack, collision, bachTrack.tpcNSigmaKa(), bachTrack.tofNSigmaKa(), bachTrack.tpcExpSignalKa(tpcSignalGeneric(bachTrack)), PidKaon, runnumber, dwnSmplFactorKa, hadronicRate); } } } - } /// process with TrackQA - PROCESS_SWITCH(TreeWriterTpcV0, processWithTrQA, "Standard V0 Samples with Track QA for PID", false); + } - void processWithTrQAWithCorrecteddEdx(Colls const& collisions, TrksWithDEdxCorrection const& myTracks, V0sWithID const& myV0s, CascsWithID const& myCascs, MyBCTable const&, aod::TracksQAVersion const& tracksQA) + /// Apply a track quality selection with a filter! + void processStandard(Colls::iterator const& collision, soa::Filtered const& tracks, V0sWithID const& v0s, CascsWithID const& cascs, aod::BCsWithTimestamps const&) + { + runStandard(collision, tracks, v0s, cascs); + } /// process Standard + PROCESS_SWITCH(TreeWriterTpcV0, processStandard, "Standard V0 Samples for PID", true); + + void processStandardWithCorrecteddEdx(Colls::iterator const& collision, soa::Filtered const& tracks, V0sWithID const& v0s, CascsWithID const& cascs, aod::BCsWithTimestamps const&) + { + runStandard(collision, tracks, v0s, cascs); + } /// process StandardWithCorrecteddEdx + PROCESS_SWITCH(TreeWriterTpcV0, processStandardWithCorrecteddEdx, "Standard V0 Samples for PID with corrected dEdx", false); + + Preslice perCollisionTracks = aod::track::collisionId; + Preslice perCollisionV0s = aod::v0data::collisionId; + Preslice perCollisionCascs = aod::cascdata::collisionId; + Preslice perCollisionTracksWithNewDEdx = aod::track::collisionId; + + template + void runWithTrQAGeneric(Colls const& collisions, TrksType const& myTracks, V0sWithID const& myV0s, CascsWithID const& myCascs, aod::TracksQAVersion const& tracksQA, Preslice const& perCollisionTracksType) { std::vector labelTrack2TrackQA; labelTrack2TrackQA.clear(); @@ -903,27 +491,37 @@ struct TreeWriterTpcV0 { labelTrack2TrackQA[trackId] = trackQAIndex; } for (const auto& collision : collisions) { - auto tracks = myTracks.sliceBy(perCollisionTracksWithNewDEdx, collision.globalIndex()); - auto v0s = myV0s.sliceBy(perCollisionV0s, collision.globalIndex()); - auto cascs = myCascs.sliceBy(perCollisionCascs, collision.globalIndex()); /// Check event slection + const auto& tracks = myTracks.sliceBy(perCollisionTracksType, collision.globalIndex()); if (!isEventSelected(collision, tracks)) { continue; } - auto bc = collision.bc_as(); + const auto& v0s = myV0s.sliceBy(perCollisionV0s, collision.globalIndex()); + const auto& cascs = myCascs.sliceBy(perCollisionCascs, collision.globalIndex()); + const auto& bc = collision.bc_as(); const int runnumber = bc.runNumber(); - float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * 1.e-3; + const float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * 1.e-3; const int bcGlobalIndex = bc.globalIndex(); - const int bcTimeFrameId = bc.tfId(); - const int bcBcInTimeFrame = bc.bcInTF(); - rowTPCTreeWithTrkQA.reserve(tracks.size()); + int bcTimeFrameId, bcBcInTimeFrame; + if constexpr (IsWithdEdx) { + bcTimeFrameId = -999; + bcBcInTimeFrame = -999; + } else { + bcTimeFrameId = bc.tfId(); + bcBcInTimeFrame = bc.bcInTF(); + } + if constexpr (IsWithdEdx) { + rowTPCTreeWithdEdxTrkQA.reserve(tracks.size()); + } else { + rowTPCTreeWithTrkQA.reserve(tracks.size()); + } /// Loop over v0 candidates for (const auto& v0 : v0s) { - auto posTrack = v0.posTrack_as(); - auto negTrack = v0.negTrack_as(); - if (v0.v0addid() == -1) { + if (v0.v0addid() == MotherUndef) { continue; } + const auto& posTrack = v0.posTrack_as(); + const auto& negTrack = v0.negTrack_as(); aod::TracksQA posTrackQA; aod::TracksQA negTrackQA; bool existPosTrkQA; @@ -943,55 +541,43 @@ struct TreeWriterTpcV0 { existNegTrkQA = false; } - // gamma - if (static_cast(posTrack.pidbit() & (1 << 0)) && static_cast(negTrack.pidbit() & (1 << 0))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisElectrons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Electron], maxPt4dwnsmplTsalisElectrons)) { - fillSkimmedV0TableWithTrQA(v0, posTrack, posTrackQA, existPosTrkQA, collision, posTrack.tpcNSigmaEl(), posTrack.tofNSigmaEl(), posTrack.tpcExpSignalEl(posTrack.tpcSignalCorrected()), o2::track::PID::Electron, runnumber, dwnSmplFactor_El, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisElectrons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Electron], maxPt4dwnsmplTsalisElectrons)) { - fillSkimmedV0TableWithTrQA(v0, negTrack, negTrackQA, existNegTrkQA, collision, negTrack.tpcNSigmaEl(), negTrack.tofNSigmaEl(), negTrack.tpcExpSignalEl(negTrack.tpcSignalCorrected()), o2::track::PID::Electron, runnumber, dwnSmplFactor_El, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - } - // Ks0 - if (static_cast(posTrack.pidbit() & (1 << 1)) && static_cast(negTrack.pidbit() & (1 << 1))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { - fillSkimmedV0TableWithTrQA(v0, posTrack, posTrackQA, existPosTrkQA, collision, posTrack.tpcNSigmaPi(), posTrack.tofNSigmaPi(), posTrack.tpcExpSignalPi(posTrack.tpcSignalCorrected()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { - fillSkimmedV0TableWithTrQA(v0, negTrack, negTrackQA, existNegTrkQA, collision, negTrack.tpcNSigmaPi(), negTrack.tofNSigmaPi(), negTrack.tpcExpSignalPi(negTrack.tpcSignalCorrected()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - } - // Lambda - if (static_cast(posTrack.pidbit() & (1 << 2)) && static_cast(negTrack.pidbit() & (1 << 2))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton], maxPt4dwnsmplTsalisProtons)) { - if (std::abs(posTrack.tofNSigmaPr()) <= nSigmaTOFdautrack) { - fillSkimmedV0TableWithTrQA(v0, posTrack, posTrackQA, existPosTrkQA, collision, posTrack.tpcNSigmaPr(), posTrack.tofNSigmaPr(), posTrack.tpcExpSignalPr(posTrack.tpcSignalCorrected()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { - fillSkimmedV0TableWithTrQA(v0, negTrack, negTrackQA, existNegTrkQA, collision, negTrack.tpcNSigmaPi(), negTrack.tofNSigmaPi(), negTrack.tpcExpSignalPi(negTrack.tpcSignalCorrected()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - } - // Antilambda - if (static_cast(posTrack.pidbit() & (1 << 3)) && static_cast(negTrack.pidbit() & (1 << 3))) { - if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion], maxPt4dwnsmplTsalisPions)) { - fillSkimmedV0TableWithTrQA(v0, posTrack, posTrackQA, existPosTrkQA, collision, posTrack.tpcNSigmaPi(), posTrack.tofNSigmaPi(), posTrack.tpcExpSignalPi(posTrack.tpcSignalCorrected()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton], maxPt4dwnsmplTsalisProtons)) { - if (std::abs(negTrack.tofNSigmaPr()) <= nSigmaTOFdautrack) { - fillSkimmedV0TableWithTrQA(v0, negTrack, negTrackQA, existNegTrkQA, collision, negTrack.tpcNSigmaPr(), negTrack.tofNSigmaPr(), negTrack.tpcExpSignalPr(negTrack.tpcSignalCorrected()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); + V0Daughter elPos{downsamplingTsalisElectrons, MassElectron, maxPt4dwnsmplTsalisElectrons, posTrack.tpcNSigmaEl(), posTrack.tofNSigmaEl(), posTrack.tpcExpSignalEl(tpcSignalGeneric(posTrack)), PidElectron, dwnSmplFactorEl, false}; + V0Daughter elNeg{downsamplingTsalisElectrons, MassElectron, maxPt4dwnsmplTsalisElectrons, negTrack.tpcNSigmaEl(), negTrack.tofNSigmaEl(), negTrack.tpcExpSignalEl(tpcSignalGeneric(negTrack)), PidElectron, dwnSmplFactorEl, false}; + V0Daughter piPos{downsamplingTsalisPions, MassPiPlus, maxPt4dwnsmplTsalisPions, posTrack.tpcNSigmaPi(), posTrack.tofNSigmaPi(), posTrack.tpcExpSignalPi(tpcSignalGeneric(posTrack)), PidPion, dwnSmplFactorPi, false}; + V0Daughter piNeg{downsamplingTsalisPions, MassPiPlus, maxPt4dwnsmplTsalisPions, negTrack.tpcNSigmaPi(), negTrack.tofNSigmaPi(), negTrack.tpcExpSignalPi(tpcSignalGeneric(negTrack)), PidPion, dwnSmplFactorPi, false}; + V0Daughter prPos{downsamplingTsalisProtons, MassProton, maxPt4dwnsmplTsalisProtons, posTrack.tpcNSigmaPr(), posTrack.tofNSigmaPr(), posTrack.tpcExpSignalPr(tpcSignalGeneric(posTrack)), PidProton, dwnSmplFactorPr, true}; + V0Daughter prNeg{downsamplingTsalisProtons, MassProton, maxPt4dwnsmplTsalisProtons, negTrack.tpcNSigmaPr(), negTrack.tofNSigmaPr(), negTrack.tpcExpSignalPr(tpcSignalGeneric(negTrack)), PidProton, dwnSmplFactorPr, true}; + + const std::array v0Mothers{ + V0Mother{MotherGamma, elPos, elNeg}, + V0Mother{MotherK0S, piPos, piNeg}, + V0Mother{MotherLambda, prPos, piNeg}, + V0Mother{MotherAntiLambda, piPos, prNeg}}; + + for (const auto& v0Mother : v0Mothers) { + if (static_cast(posTrack.pidbit() & (1 << v0Mother.id)) && static_cast(negTrack.pidbit() & (1 << v0Mother.id))) { + bool isPosDaughter{true}; + for (const auto& daughter : {v0Mother.posDaughter, v0Mother.negDaughter}) { + const auto& dauTrack = isPosDaughter ? posTrack : negTrack; + const auto& trackQA = isPosDaughter ? posTrackQA : negTrackQA; + const auto& existTrkQA = isPosDaughter ? existPosTrkQA : existNegTrkQA; + if (downsampleTsalisCharged(dauTrack.pt(), daughter.downsamplingTsalis, daughter.mass, daughter.maxPt4dwnsmplTsalis)) { + if (!daughter.isApplyTofNSigmaCut || std::fabs(daughter.tofNSigma) <= nSigmaTOFdautrack) { + fillSkimmedV0TableWithTrQAGeneric(v0, dauTrack, trackQA, existTrkQA, collision, daughter.tpcNSigma, daughter.tofNSigma, daughter.tpcExpSignal, daughter.id, runnumber, daughter.dwnSmplFactor, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); + } + } + isPosDaughter = false; } } - } + } // v0Mothers } /// Loop over cascade candidates for (const auto& casc : cascs) { - auto bachTrack = casc.bachelor_as(); - if (casc.cascaddid() == kUndef) { + if (casc.cascaddid() == MotherUndef) { continue; } - + const auto& bachTrack = casc.bachelor_as(); aod::TracksQA bachTrackQA; bool existBachTrkQA; if (labelTrack2TrackQA[bachTrack.globalIndex()] != -1) { @@ -1003,13 +589,36 @@ struct TreeWriterTpcV0 { } // Omega and antiomega - if (static_cast(bachTrack.pidbit() & (1 << kOmega)) || static_cast(bachTrack.pidbit() & (1 << kAntiOmega))) { - if (downsampleTsalisCharged(bachTrack.pt(), downsamplingTsalisKaons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Kaon], maxPt4dwnsmplTsalisKaons)) { - fillSkimmedV0TableWithTrQA(casc, bachTrack, bachTrackQA, existBachTrkQA, collision, bachTrack.tpcNSigmaKa(), bachTrack.tofNSigmaKa(), bachTrack.tpcExpSignalKa(bachTrack.tpcSignal()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); + if (static_cast(bachTrack.pidbit() & (1 << MotherOmega)) || static_cast(bachTrack.pidbit() & (1 << MotherAntiOmega))) { + if (downsampleTsalisCharged(bachTrack.pt(), downsamplingTsalisKaons, MassKPlus, maxPt4dwnsmplTsalisKaons)) { + fillSkimmedV0TableWithTrQAGeneric(casc, bachTrack, bachTrackQA, existBachTrkQA, collision, bachTrack.tpcNSigmaKa(), bachTrack.tofNSigmaKa(), bachTrack.tpcExpSignalKa(tpcSignalGeneric(bachTrack)), PidKaon, runnumber, dwnSmplFactorKa, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); } } } } + } + + void processWithdEdxTrQA(Colls const& collisions, Trks const& myTracks, V0sWithID const& myV0s, CascsWithID const& myCascs, aod::BCsWithTimestamps const&, aod::TracksQAVersion const& tracksQA) + { + runWithTrQAGeneric(collisions, myTracks, myV0s, myCascs, tracksQA, perCollisionTracks); + } /// process with dEdx from TrackQA + PROCESS_SWITCH(TreeWriterTpcV0, processWithdEdxTrQA, "Standard V0 Samples with dEdx from Track QA for PID", false); + + void processWithdEdxTrQAWithCorrecteddEdx(Colls const& collisions, TrksWithDEdxCorrection const& myTracks, V0sWithID const& myV0s, CascsWithID const& myCascs, aod::BCsWithTimestamps const&, aod::TracksQAVersion const& tracksQA) + { + runWithTrQAGeneric(collisions, myTracks, myV0s, myCascs, tracksQA, perCollisionTracksWithNewDEdx); + } /// process with dEdx from TrackQA + PROCESS_SWITCH(TreeWriterTpcV0, processWithdEdxTrQAWithCorrecteddEdx, "Standard V0 Samples with dEdx from Track QA for PID with corrected dEdx", false); + + void processWithTrQA(Colls const& collisions, Trks const& myTracks, V0sWithID const& myV0s, CascsWithID const& myCascs, MyBCTable const&, aod::TracksQAVersion const& tracksQA) + { + runWithTrQAGeneric(collisions, myTracks, myV0s, myCascs, tracksQA, perCollisionTracks); + } /// process with TrackQA + PROCESS_SWITCH(TreeWriterTpcV0, processWithTrQA, "Standard V0 Samples with Track QA for PID", false); + + void processWithTrQAWithCorrecteddEdx(Colls const& collisions, TrksWithDEdxCorrection const& myTracks, V0sWithID const& myV0s, CascsWithID const& myCascs, MyBCTable const&, aod::TracksQAVersion const& tracksQA) + { + runWithTrQAGeneric(collisions, myTracks, myV0s, myCascs, tracksQA, perCollisionTracksWithNewDEdx); } /// process with TrackQA PROCESS_SWITCH(TreeWriterTpcV0, processWithTrQAWithCorrecteddEdx, "Standard V0 Samples with Track QA for PID with corrected dEdx", false); @@ -1042,6 +651,12 @@ struct TreeWriterTPCTOF { Produces rowTPCTOFTreeWithdEdxTrkQA; Produces rowTPCTOFTreeWithTrkQA; + constexpr static o2::track::PID::ID PidPion{o2::track::PID::Pion}; + constexpr static o2::track::PID::ID PidKaon{o2::track::PID::Kaon}; + constexpr static o2::track::PID::ID PidProton{o2::track::PID::Proton}; + constexpr static o2::track::PID::ID PidDeuteron{o2::track::PID::Deuteron}; + constexpr static o2::track::PID::ID PidTriton{o2::track::PID::Triton}; + /// Configurables Configurable nClNorm{"nClNorm", 152., "Number of cluster normalization. Run 2: 159, Run 3 152"}; Configurable applyEvSel{"applyEvSel", 2, "Flag to apply rapidity cut: 0 -> no event selection, 1 -> Run 2 event selection, 2 -> Run 3 event selection"}; @@ -1052,60 +667,92 @@ struct TreeWriterTPCTOF { Configurable maxMomTPCOnlyTr{"maxMomTPCOnlyTr", 1.5, "Maximum momentum for TPC only cut triton"}; Configurable maxMomHardCutOnlyTr{"maxMomHardCutOnlyTr", 50, "Maximum TPC inner momentum for triton"}; Configurable nSigmaTPCOnlyTr{"nSigmaTPCOnlyTr", 4., "number of sigma for TPC only cut triton"}; - Configurable nSigmaTPC_TPCTOF_Tr{"nSigmaTPC_TPCTOF_Tr", 4., "number of sigma for TPC cut for TPC and TOF combined triton"}; - Configurable nSigmaTOF_TPCTOF_Tr{"nSigmaTOF_TPCTOF_Tr", 3., "number of sigma for TOF cut for TPC and TOF combined triton"}; - Configurable dwnSmplFactor_Tr{"dwnSmplFactor_Tr", 1., "downsampling factor for triton, default fraction to keep is 1."}; + Configurable nSigmaTpcTpctofTr{"nSigmaTpcTpctofTr", 4., "number of sigma for TPC cut for TPC and TOF combined triton"}; + Configurable nSigmaTofTpctofTr{"nSigmaTofTpctofTr", 3., "number of sigma for TOF cut for TPC and TOF combined triton"}; + Configurable dwnSmplFactorTr{"dwnSmplFactorTr", 1., "downsampling factor for triton, default fraction to keep is 1."}; /// Deuteron Configurable maxMomTPCOnlyDe{"maxMomTPCOnlyDe", 1.0, "Maximum momentum for TPC only cut deuteron"}; Configurable maxMomHardCutOnlyDe{"maxMomHardCutOnlyDe", 50, "Maximum TPC inner momentum for deuteron"}; Configurable nSigmaTPCOnlyDe{"nSigmaTPCOnlyDe", 4., "number of sigma for TPC only cut deuteron"}; - Configurable nSigmaTPC_TPCTOF_De{"nSigmaTPC_TPCTOF_De", 4., "number of sigma for TPC cut for TPC and TOF combined deuteron"}; - Configurable nSigmaTOF_TPCTOF_De{"nSigmaTOF_TPCTOF_De", 3., "number of sigma for TOF cut for TPC and TOF combined deuteron"}; - Configurable dwnSmplFactor_De{"dwnSmplFactor_De", 1., "downsampling factor for deuteron, default fraction to keep is 1."}; + Configurable nSigmaTpcTpctofDe{"nSigmaTpcTpctofDe", 4., "number of sigma for TPC cut for TPC and TOF combined deuteron"}; + Configurable nSigmaTofTpctofDe{"nSigmaTofTpctofDe", 3., "number of sigma for TOF cut for TPC and TOF combined deuteron"}; + Configurable dwnSmplFactorDe{"dwnSmplFactorDe", 1., "downsampling factor for deuteron, default fraction to keep is 1."}; /// Proton Configurable maxMomTPCOnlyPr{"maxMomTPCOnlyPr", 0.6, "Maximum momentum for TPC only cut proton"}; Configurable nSigmaTPCOnlyPr{"nSigmaTPCOnlyPr", 4., "number of sigma for TPC only cut proton"}; - Configurable nSigmaTPC_TPCTOF_Pr{"nSigmaTPC_TPCTOF_Pr", 4., "number of sigma for TPC cut for TPC and TOF combined proton"}; - Configurable nSigmaTOF_TPCTOF_Pr{"nSigmaTOF_TPCTOF_Pr", 3., "number of sigma for TOF cut for TPC and TOF combined proton"}; - Configurable dwnSmplFactor_Pr{"dwnSmplFactor_Pr", 1., "downsampling factor for protons, default fraction to keep is 1."}; + Configurable nSigmaTpcTpctofPr{"nSigmaTpcTpctofPr", 4., "number of sigma for TPC cut for TPC and TOF combined proton"}; + Configurable nSigmaTofTpctofPr{"nSigmaTofTpctofPr", 3., "number of sigma for TOF cut for TPC and TOF combined proton"}; + Configurable dwnSmplFactorPr{"dwnSmplFactorPr", 1., "downsampling factor for protons, default fraction to keep is 1."}; /// Kaon Configurable maxMomTPCOnlyKa{"maxMomTPCOnlyKa", 0.3, "Maximum momentum for TPC only cut kaon"}; Configurable maxMomHardCutOnlyKa{"maxMomHardCutOnlyKa", 50, "Maximum TPC inner momentum for kaons"}; Configurable nSigmaTPCOnlyKa{"nSigmaTPCOnlyKa", 4., "number of sigma for TPC only cut kaon"}; - Configurable nSigmaTPC_TPCTOF_Ka{"nSigmaTPC_TPCTOF_Ka", 4., "number of sigma for TPC cut for TPC and TOF combined kaon"}; - Configurable nSigmaTOF_TPCTOF_Ka{"nSigmaTOF_TPCTOF_Ka", 3., "number of sigma for TOF cut for TPC and TOF combined kaon"}; - Configurable dwnSmplFactor_Ka{"dwnSmplFactor_Ka", 1., "downsampling factor for kaons, default fraction to keep is 1."}; + Configurable nSigmaTpcTpctofKa{"nSigmaTpcTpctofKa", 4., "number of sigma for TPC cut for TPC and TOF combined kaon"}; + Configurable nSigmaTofTpctofKa{"nSigmaTofTpctofKa", 3., "number of sigma for TOF cut for TPC and TOF combined kaon"}; + Configurable dwnSmplFactorKa{"dwnSmplFactorKa", 1., "downsampling factor for kaons, default fraction to keep is 1."}; /// Pion Configurable maxMomTPCOnlyPi{"maxMomTPCOnlyPi", 0.5, "Maximum momentum for TPC only cut pion"}; Configurable nSigmaTPCOnlyPi{"nSigmaTPCOnlyPi", 4., "number of sigma for TPC only cut pion"}; - Configurable nSigmaTPC_TPCTOF_Pi{"nSigmaTPC_TPCTOF_Pi", 4., "number of sigma for TPC cut for TPC and TOF combined pion"}; - Configurable nSigmaTOF_TPCTOF_Pi{"nSigmaTOF_TPCTOF_Pi", 4., "number of sigma for TOF cut for TPC and TOF combined pion"}; - Configurable dwnSmplFactor_Pi{"dwnSmplFactor_Pi", 1., "downsampling factor for pions, default fraction to keep is 1."}; + Configurable nSigmaTpcTpctofPi{"nSigmaTpcTpctofPi", 4., "number of sigma for TPC cut for TPC and TOF combined pion"}; + Configurable nSigmaTofTpctofPi{"nSigmaTofTpctofPi", 4., "number of sigma for TOF cut for TPC and TOF combined pion"}; + Configurable dwnSmplFactorPi{"dwnSmplFactorPi", 1., "downsampling factor for pions, default fraction to keep is 1."}; /// pT dependent downsampling - Configurable sqrtSNN{"sqrt_s_NN", 0., "sqrt(s_NN), used for downsampling with the Tsallis distribution"}; + Configurable sqrtSNN{"sqrtSNN", 0., "sqrt(s_NN), used for downsampling with the Tsallis distribution"}; Configurable downsamplingTsalisTritons{"downsamplingTsalisTritons", -1., "Downsampling factor to reduce the number of tritons"}; Configurable downsamplingTsalisDeuterons{"downsamplingTsalisDeuterons", -1., "Downsampling factor to reduce the number of deuterons"}; Configurable downsamplingTsalisProtons{"downsamplingTsalisProtons", -1., "Downsampling factor to reduce the number of protons"}; Configurable downsamplingTsalisKaons{"downsamplingTsalisKaons", -1., "Downsampling factor to reduce the number of kaons"}; Configurable downsamplingTsalisPions{"downsamplingTsalisPions", -1., "Downsampling factor to reduce the number of pions"}; - Filter trackFilter = (trackSelection.node() == 0) || - ((trackSelection.node() == 1) && requireGlobalTrackInFilter()) || - ((trackSelection.node() == 2) && requireGlobalTrackWoPtEtaInFilter()) || - ((trackSelection.node() == 3) && requireGlobalTrackWoDCAInFilter()) || - ((trackSelection.node() == 4) && requireQualityTracksInFilter()) || - ((trackSelection.node() == 5) && requireTrackCutInFilter(TrackSelectionFlags::kInAcceptanceTracks)); + enum { + TrackSelectionNoCut = 0, + TrackSelectionGlobalTrack, + TrackSelectionTrackWoPtEta, + TrackSelectionGlobalTrackWoDCA, + TrackSelectionQualityTracks, + TrackSelectionInAcceptanceTracks + }; + + enum { + EventSelectionNo = 0, + EventSelectionRun2, + EventSelectionRun3 + }; + + Filter trackFilter = (trackSelection.node() == static_cast(TrackSelectionNoCut)) || + ((trackSelection.node() == static_cast(TrackSelectionGlobalTrack)) && requireGlobalTrackInFilter()) || + ((trackSelection.node() == static_cast(TrackSelectionTrackWoPtEta)) && requireGlobalTrackWoPtEtaInFilter()) || + ((trackSelection.node() == static_cast(TrackSelectionGlobalTrackWoDCA)) && requireGlobalTrackWoDCAInFilter()) || + ((trackSelection.node() == static_cast(TrackSelectionQualityTracks)) && requireQualityTracksInFilter()) || + ((trackSelection.node() == static_cast(TrackSelectionInAcceptanceTracks)) && requireTrackCutInFilter(TrackSelectionFlags::kInAcceptanceTracks)); ctpRateFetcher mRateFetcher; - double tsalisCharged(double pt, double mass, double sqrts) + struct TofTrack { + bool isApplyHardCutOnly; + double maxMomHardCutOnly; + double maxMomTPCOnly; + double tpcNSigma; + double nSigmaTPCOnly; + double downsamplingTsalis; + double mass; + double tofNSigma; + double itsNSigma; + double tpcExpSignal; + o2::track::PID::ID pid; + double dwnSmplFactor; + double nSigmaTofTpctof; + double nSigmaTpcTpctof; + }; + + double tsalisCharged(const double pt, const double mass) { const double a = 6.81, b = 59.24; const double c = 0.082, d = 0.151; double mt = std::sqrt(mass * mass + pt * pt); - double n = a + b / sqrts; - double T = c + d / sqrts; - double p0 = n * T; + double n = a + b / sqrtSNN; + double t = c + d / sqrtSNN; + double p0 = n * t; double result = std::pow((1. + mt / p0), -n); return result; }; @@ -1113,13 +760,13 @@ struct TreeWriterTPCTOF { /// Random downsampling trigger function using Tsalis/Hagedorn spectra fit (sqrt(s) = 62.4 GeV to 13 TeV) /// as in https://iopscience.iop.org/article/10.1088/2399-6528/aab00f/pdf TRandom3* fRndm = new TRandom3(0); - bool downsampleTsalisCharged(double pt, float factor1Pt, double sqrts, double mass) + bool downsampleTsalisCharged(const double pt, const float factor1Pt, const double mass) { if (factor1Pt < 0.) { return true; } - const double prob = tsalisCharged(pt, mass, sqrts) * pt; - const double probNorm = tsalisCharged(1., mass, sqrts); + const double prob = tsalisCharged(pt, mass) * pt; + const double probNorm = tsalisCharged(1., mass); if ((fRndm->Rndm() * ((prob / probNorm) * pt * pt)) > factor1Pt) { return false; } else { @@ -1128,8 +775,8 @@ struct TreeWriterTPCTOF { }; /// Function to fill trees - template - void fillSkimmedTPCTOFTable(T const& track, C const& collision, const float nSigmaTPC, const float nSigmaTOF, const float dEdxExp, const o2::track::PID::ID id, int runnumber, double dwnSmplFactor, double hadronicRate) + template + void fillSkimmedTPCTOFTable(T const& track, C const& collision, const float nSigmaTPC, const float nSigmaTOF, const float dEdxExp, const o2::track::PID::ID id, const int runnumber, const double dwnSmplFactor, const double hadronicRate) { const double ncl = track.tpcNClsFound(); @@ -1138,13 +785,13 @@ struct TreeWriterTPCTOF { const double mass = o2::track::pid_constants::sMasses[id]; const double bg = p / mass; const int multTPC = collision.multTPC(); - auto trackocc = collision.trackOccupancyInTimeRange(); - auto ft0occ = collision.ft0cOccupancyInTimeRange(); + const auto trackOcc = collision.trackOccupancyInTimeRange(); + const auto ft0Occ = collision.ft0cOccupancyInTimeRange(); const double pseudoRndm = track.pt() * 1000. - static_cast(track.pt() * 1000); if (pseudoRndm < dwnSmplFactor) { float usedEdx; - if constexpr (doCorrectdEdx) { + if constexpr (DoCorrectDeDx) { usedEdx = track.tpcSignalCorrected(); } else { usedEdx = track.tpcSignal(); @@ -1166,124 +813,103 @@ struct TreeWriterTPCTOF { nSigmaTPC, nSigmaTOF, runnumber, - trackocc, - ft0occ, + trackOcc, + ft0Occ, hadronicRate); } }; - template - void fillSkimmedTPCTOFTableWithdEdxTrkQA(T const& track, TQA const& trackQA, bool existTrkQA, C const& collision, const float nSigmaTPC, const float nSigmaTOF, const float nSigmaITS, const float dEdxExp, const o2::track::PID::ID id, int runnumber, double dwnSmplFactor, double hadronicRate) - { + template + void fillSkimmedTPCTOFTableWithTrkQAGeneric(T const& track, TQA const& trackQA, const bool existTrkQA, C const& collision, const float nSigmaTPC, const float nSigmaTOF, const float nSigmaITS, const float dEdxExp, const o2::track::PID::ID id, const int runnumber, const double dwnSmplFactor, const double hadronicRate, const int bcGlobalIndex, const int bcTimeFrameId, const int bcBcInTimeFrame) + { const double ncl = track.tpcNClsFound(); const double nclPID = track.tpcNClsFindableMinusPID(); const double p = track.tpcInnerParam(); const double mass = o2::track::pid_constants::sMasses[id]; const double bg = p / mass; const int multTPC = collision.multTPC(); - auto trackocc = collision.trackOccupancyInTimeRange(); - auto ft0occ = collision.ft0cOccupancyInTimeRange(); + const auto trackOcc = collision.trackOccupancyInTimeRange(); + const auto ft0Occ = collision.ft0cOccupancyInTimeRange(); const double pseudoRndm = track.pt() * 1000. - static_cast(track.pt() * 1000); if (pseudoRndm < dwnSmplFactor) { float usedEdx; - if constexpr (doCorrectdEdx) { + if constexpr (DoCorrectDeDx) { usedEdx = track.tpcSignalCorrected(); } else { usedEdx = track.tpcSignal(); } - rowTPCTOFTreeWithdEdxTrkQA(usedEdx, - 1. / dEdxExp, - track.tpcInnerParam(), - track.tgl(), - track.signed1Pt(), - track.eta(), - track.phi(), - track.y(), - mass, - bg, - multTPC / 11000., - std::sqrt(nClNorm / ncl), - nclPID, - id, - nSigmaTPC, - nSigmaTOF, - nSigmaITS, - runnumber, - trackocc, - ft0occ, - hadronicRate, - existTrkQA ? trackQA.tpcdEdxNorm() : -999); - } - }; - /// Function to fill trees - template - void fillSkimmedTPCTOFTableWithTrkQA(T const& track, TQA const& trackQA, bool existTrkQA, C const& collision, const float nSigmaTPC, const float nSigmaTOF, const float nSigmaITS, const float dEdxExp, const o2::track::PID::ID id, int runnumber, double dwnSmplFactor, double hadronicRate, int bcGlobalIndex, int bcTimeFrameId, int bcBcInTimeFrame) - { - - const double ncl = track.tpcNClsFound(); - const double nclPID = track.tpcNClsFindableMinusPID(); - const double p = track.tpcInnerParam(); - const double mass = o2::track::pid_constants::sMasses[id]; - const double bg = p / mass; - const int multTPC = collision.multTPC(); - auto trackocc = collision.trackOccupancyInTimeRange(); - auto ft0occ = collision.ft0cOccupancyInTimeRange(); - - const double pseudoRndm = track.pt() * 1000. - static_cast(track.pt() * 1000); - if (pseudoRndm < dwnSmplFactor) { - float usedEdx; - if constexpr (doCorrectdEdx) { - usedEdx = track.tpcSignalCorrected(); + if constexpr (IsWithdEdx) { + rowTPCTOFTreeWithdEdxTrkQA(usedEdx, + 1. / dEdxExp, + track.tpcInnerParam(), + track.tgl(), + track.signed1Pt(), + track.eta(), + track.phi(), + track.y(), + mass, + bg, + multTPC / 11000., + std::sqrt(nClNorm / ncl), + nclPID, + id, + nSigmaTPC, + nSigmaTOF, + nSigmaITS, + runnumber, + trackOcc, + ft0Occ, + hadronicRate, + existTrkQA ? trackQA.tpcdEdxNorm() : -999); } else { - usedEdx = track.tpcSignal(); + rowTPCTOFTreeWithTrkQA(usedEdx, + 1. / dEdxExp, + track.tpcInnerParam(), + track.tgl(), + track.signed1Pt(), + track.eta(), + track.phi(), + track.y(), + mass, + bg, + multTPC / 11000., + std::sqrt(nClNorm / ncl), + nclPID, + id, + nSigmaTPC, + nSigmaTOF, + nSigmaITS, + runnumber, + trackOcc, + ft0Occ, + hadronicRate, + bcGlobalIndex, + bcTimeFrameId, + bcBcInTimeFrame, + existTrkQA ? trackQA.tpcClusterByteMask() : -999, + existTrkQA ? trackQA.tpcdEdxMax0R() : -999, + existTrkQA ? trackQA.tpcdEdxMax1R() : -999, + existTrkQA ? trackQA.tpcdEdxMax2R() : -999, + existTrkQA ? trackQA.tpcdEdxMax3R() : -999, + existTrkQA ? trackQA.tpcdEdxTot0R() : -999, + existTrkQA ? trackQA.tpcdEdxTot1R() : -999, + existTrkQA ? trackQA.tpcdEdxTot2R() : -999, + existTrkQA ? trackQA.tpcdEdxTot3R() : -999, + existTrkQA ? trackQA.tpcdEdxNorm() : -999); } - rowTPCTOFTreeWithTrkQA(usedEdx, - 1. / dEdxExp, - track.tpcInnerParam(), - track.tgl(), - track.signed1Pt(), - track.eta(), - track.phi(), - track.y(), - mass, - bg, - multTPC / 11000., - std::sqrt(nClNorm / ncl), - nclPID, - id, - nSigmaTPC, - nSigmaTOF, - nSigmaITS, - runnumber, - trackocc, - ft0occ, - hadronicRate, - bcGlobalIndex, - bcTimeFrameId, - bcBcInTimeFrame, - existTrkQA ? trackQA.tpcClusterByteMask() : -999, - existTrkQA ? trackQA.tpcdEdxMax0R() : -999, - existTrkQA ? trackQA.tpcdEdxMax1R() : -999, - existTrkQA ? trackQA.tpcdEdxMax2R() : -999, - existTrkQA ? trackQA.tpcdEdxMax3R() : -999, - existTrkQA ? trackQA.tpcdEdxTot0R() : -999, - existTrkQA ? trackQA.tpcdEdxTot1R() : -999, - existTrkQA ? trackQA.tpcdEdxTot2R() : -999, - existTrkQA ? trackQA.tpcdEdxTot3R() : -999, - existTrkQA ? trackQA.tpcdEdxNorm() : -999); } - }; + } /// Event selection template bool isEventSelected(const CollisionType& collision, const TrackType& /*tracks*/) { - if (applyEvSel == 1) { + if (applyEvSel == EventSelectionRun2) { if (!collision.sel7()) { return false; } - } else if (applyEvSel == 2) { + } else if (applyEvSel == EventSelectionRun3) { if (!collision.sel8()) { return false; } @@ -1298,100 +924,69 @@ struct TreeWriterTPCTOF { ccdb->setFatalWhenNull(false); } - void processStandard(Colls::iterator const& collision, soa::Filtered const& tracks, aod::BCsWithTimestamps const&) + /// Evaluate tpcSignal with or without correction + template + double tpcSignalGeneric(const TrkType& track) + { + if constexpr (IsCorrectedDeDx) { + return track.tpcSignalCorrected(); + } else { + return track.tpcSignal(); + } + } + + template + void runStandard(Colls::iterator const& collision, soa::Filtered const& tracks) { /// Check event selection if (!isEventSelected(collision, tracks)) { return; } - auto bc = collision.bc_as(); + const auto& bc = collision.bc_as(); const int runnumber = bc.runNumber(); - float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * 1.e-3; + const float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * 1.e-3; rowTPCTOFTree.reserve(tracks.size()); for (auto const& trk : tracks) { - /// Fill tree for tritons - if (trk.tpcInnerParam() < maxMomHardCutOnlyTr && trk.tpcInnerParam() <= maxMomTPCOnlyTr && std::abs(trk.tpcNSigmaTr()) < nSigmaTPCOnlyTr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Triton])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaTr(), trk.tofNSigmaTr(), trk.tpcExpSignalTr(trk.tpcSignal()), o2::track::PID::Triton, runnumber, dwnSmplFactor_Tr, hadronicRate); - } else if (trk.tpcInnerParam() < maxMomHardCutOnlyTr && trk.tpcInnerParam() > maxMomTPCOnlyTr && std::abs(trk.tofNSigmaTr()) < nSigmaTOF_TPCTOF_Tr && std::abs(trk.tpcNSigmaTr()) < nSigmaTPC_TPCTOF_Tr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Triton])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaTr(), trk.tofNSigmaTr(), trk.tpcExpSignalTr(trk.tpcSignal()), o2::track::PID::Triton, runnumber, dwnSmplFactor_Tr, hadronicRate); - } - /// Fill tree for deuterons - if (trk.tpcInnerParam() < maxMomHardCutOnlyDe && trk.tpcInnerParam() <= maxMomTPCOnlyDe && std::abs(trk.tpcNSigmaDe()) < nSigmaTPCOnlyDe && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Deuteron])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaDe(), trk.tofNSigmaDe(), trk.tpcExpSignalDe(trk.tpcSignal()), o2::track::PID::Deuteron, runnumber, dwnSmplFactor_De, hadronicRate); - } else if (trk.tpcInnerParam() < maxMomHardCutOnlyDe && trk.tpcInnerParam() > maxMomTPCOnlyDe && std::abs(trk.tofNSigmaDe()) < nSigmaTOF_TPCTOF_De && std::abs(trk.tpcNSigmaDe()) < nSigmaTPC_TPCTOF_De && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Deuteron])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaDe(), trk.tofNSigmaDe(), trk.tpcExpSignalDe(trk.tpcSignal()), o2::track::PID::Deuteron, runnumber, dwnSmplFactor_De, hadronicRate); - } - /// Fill tree for protons - if (trk.tpcInnerParam() <= maxMomTPCOnlyPr && std::abs(trk.tpcNSigmaPr()) < nSigmaTPCOnlyPr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaPr(), trk.tofNSigmaPr(), trk.tpcExpSignalPr(trk.tpcSignal()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate); - } else if (trk.tpcInnerParam() > maxMomTPCOnlyPr && std::abs(trk.tofNSigmaPr()) < nSigmaTOF_TPCTOF_Pr && std::abs(trk.tpcNSigmaPr()) < nSigmaTPC_TPCTOF_Pr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaPr(), trk.tofNSigmaPr(), trk.tpcExpSignalPr(trk.tpcSignal()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate); - } - /// Fill tree for kaons - if (trk.tpcInnerParam() < maxMomHardCutOnlyKa && trk.tpcInnerParam() <= maxMomTPCOnlyKa && std::abs(trk.tpcNSigmaKa()) < nSigmaTPCOnlyKa && downsampleTsalisCharged(trk.pt(), downsamplingTsalisKaons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Kaon])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaKa(), trk.tofNSigmaKa(), trk.tpcExpSignalKa(trk.tpcSignal()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka, hadronicRate); - } else if (trk.tpcInnerParam() < maxMomHardCutOnlyKa && trk.tpcInnerParam() > maxMomTPCOnlyKa && std::abs(trk.tofNSigmaKa()) < nSigmaTOF_TPCTOF_Ka && std::abs(trk.tpcNSigmaKa()) < nSigmaTPC_TPCTOF_Ka && downsampleTsalisCharged(trk.pt(), downsamplingTsalisKaons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Kaon])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaKa(), trk.tofNSigmaKa(), trk.tpcExpSignalKa(trk.tpcSignal()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka, hadronicRate); - } - /// Fill tree pions - if (trk.tpcInnerParam() <= maxMomTPCOnlyPi && std::abs(trk.tpcNSigmaPi()) < nSigmaTPCOnlyPi && downsampleTsalisCharged(trk.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaPi(), trk.tofNSigmaPi(), trk.tpcExpSignalPi(trk.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); - } else if (trk.tpcInnerParam() > maxMomTPCOnlyPi && std::abs(trk.tofNSigmaPi()) < nSigmaTOF_TPCTOF_Pi && std::abs(trk.tpcNSigmaPi()) < nSigmaTPC_TPCTOF_Pi && downsampleTsalisCharged(trk.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaPi(), trk.tofNSigmaPi(), trk.tpcExpSignalPi(trk.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); + + TofTrack tofTriton(true, maxMomHardCutOnlyTr, maxMomTPCOnlyTr, trk.tpcNSigmaTr(), nSigmaTPCOnlyTr, downsamplingTsalisTritons, MassTriton, trk.tofNSigmaTr(), -999., trk.tpcExpSignalTr(tpcSignalGeneric(trk)), PidTriton, dwnSmplFactorTr, nSigmaTofTpctofTr, nSigmaTpcTpctofTr); + + TofTrack tofDeuteron(true, maxMomHardCutOnlyDe, maxMomTPCOnlyDe, trk.tpcNSigmaDe(), nSigmaTPCOnlyDe, downsamplingTsalisDeuterons, MassDeuteron, trk.tofNSigmaDe(), -999., trk.tpcExpSignalDe(tpcSignalGeneric(trk)), PidDeuteron, dwnSmplFactorDe, nSigmaTofTpctofDe, nSigmaTpcTpctofDe); + + TofTrack tofProton(false, -999., maxMomTPCOnlyPr, trk.tpcNSigmaPr(), nSigmaTPCOnlyPr, downsamplingTsalisProtons, MassProton, trk.tofNSigmaPr(), -999., trk.tpcExpSignalPr(tpcSignalGeneric(trk)), PidProton, dwnSmplFactorPr, nSigmaTofTpctofPr, nSigmaTpcTpctofPr); + + TofTrack tofKaon(true, maxMomHardCutOnlyKa, maxMomTPCOnlyKa, trk.tpcNSigmaKa(), nSigmaTPCOnlyKa, downsamplingTsalisKaons, MassKPlus, trk.tofNSigmaKa(), -999., trk.tpcExpSignalKa(tpcSignalGeneric(trk)), PidKaon, dwnSmplFactorKa, nSigmaTofTpctofKa, nSigmaTpcTpctofKa); + + TofTrack tofPion(false, -999., maxMomTPCOnlyPi, trk.tpcNSigmaPi(), nSigmaTPCOnlyPi, downsamplingTsalisPions, MassPiPlus, trk.tofNSigmaPi(), -999., trk.tpcExpSignalPi(tpcSignalGeneric(trk)), PidPion, dwnSmplFactorPi, nSigmaTofTpctofPi, nSigmaTpcTpctofPi); + + for (const auto& tofTrack : {tofTriton, tofDeuteron, tofProton, tofKaon, tofPion}) { + if ((!tofTrack.isApplyHardCutOnly || trk.tpcInnerParam() < tofTrack.maxMomHardCutOnly) && + ((trk.tpcInnerParam() <= tofTrack.maxMomTPCOnly && std::fabs(tofTrack.tpcNSigma) < tofTrack.nSigmaTPCOnly) || + (trk.tpcInnerParam() > tofTrack.maxMomTPCOnly && std::fabs(tofTrack.tofNSigma) < tofTrack.nSigmaTofTpctof && std::fabs(tofTrack.tpcNSigma) < tofTrack.nSigmaTpcTpctof)) && + downsampleTsalisCharged(trk.pt(), tofTrack.downsamplingTsalis, tofTrack.mass)) { + fillSkimmedTPCTOFTable(trk, collision, tofTrack.tpcNSigma, tofTrack.tofNSigma, tofTrack.tpcExpSignal, tofTrack.pid, runnumber, tofTrack.dwnSmplFactor, hadronicRate); + } } } /// Loop tracks + } + + void processStandard(Colls::iterator const& collision, soa::Filtered const& tracks, aod::BCsWithTimestamps const&) + { + runStandard(collision, tracks); } /// process PROCESS_SWITCH(TreeWriterTPCTOF, processStandard, "Standard Samples for PID", true); - void processStandard2(Colls::iterator const& collision, soa::Filtered const& tracks, aod::BCsWithTimestamps const&) + void processStandardWithCorrecteddEdx(Colls::iterator const& collision, soa::Filtered const& tracks, aod::BCsWithTimestamps const&) { - /// Check event selection - if (!isEventSelected(collision, tracks)) { - return; - } - auto bc = collision.bc_as(); - const int runnumber = bc.runNumber(); - float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * 1.e-3; - - rowTPCTOFTree.reserve(tracks.size()); - for (auto const& trk : tracks) { - /// Fill tree for tritons/* */ - if (trk.tpcInnerParam() < maxMomHardCutOnlyTr && trk.tpcInnerParam() <= maxMomTPCOnlyTr && std::abs(trk.tpcNSigmaTr()) < nSigmaTPCOnlyTr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Triton])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaTr(), trk.tofNSigmaTr(), trk.tpcExpSignalTr(trk.tpcSignalCorrected()), o2::track::PID::Triton, runnumber, dwnSmplFactor_Tr, hadronicRate); - } else if (trk.tpcInnerParam() < maxMomHardCutOnlyTr && trk.tpcInnerParam() > maxMomTPCOnlyTr && std::abs(trk.tofNSigmaTr()) < nSigmaTOF_TPCTOF_Tr && std::abs(trk.tpcNSigmaTr()) < nSigmaTPC_TPCTOF_Tr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Triton])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaTr(), trk.tofNSigmaTr(), trk.tpcExpSignalTr(trk.tpcSignalCorrected()), o2::track::PID::Triton, runnumber, dwnSmplFactor_Tr, hadronicRate); - } - /// Fill tree for deuterons - if (trk.tpcInnerParam() < maxMomHardCutOnlyDe && trk.tpcInnerParam() <= maxMomTPCOnlyDe && std::abs(trk.tpcNSigmaDe()) < nSigmaTPCOnlyDe && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Deuteron])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaDe(), trk.tofNSigmaDe(), trk.tpcExpSignalDe(trk.tpcSignalCorrected()), o2::track::PID::Deuteron, runnumber, dwnSmplFactor_De, hadronicRate); - } else if (trk.tpcInnerParam() < maxMomHardCutOnlyDe && trk.tpcInnerParam() > maxMomTPCOnlyDe && std::abs(trk.tofNSigmaDe()) < nSigmaTOF_TPCTOF_De && std::abs(trk.tpcNSigmaDe()) < nSigmaTPC_TPCTOF_De && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Deuteron])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaDe(), trk.tofNSigmaDe(), trk.tpcExpSignalDe(trk.tpcSignalCorrected()), o2::track::PID::Deuteron, runnumber, dwnSmplFactor_De, hadronicRate); - } - /// Fill tree for protons - if (trk.tpcInnerParam() <= maxMomTPCOnlyPr && std::abs(trk.tpcNSigmaPr()) < nSigmaTPCOnlyPr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaPr(), trk.tofNSigmaPr(), trk.tpcExpSignalPr(trk.tpcSignalCorrected()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate); - } else if (trk.tpcInnerParam() > maxMomTPCOnlyPr && std::abs(trk.tofNSigmaPr()) < nSigmaTOF_TPCTOF_Pr && std::abs(trk.tpcNSigmaPr()) < nSigmaTPC_TPCTOF_Pr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaPr(), trk.tofNSigmaPr(), trk.tpcExpSignalPr(trk.tpcSignalCorrected()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate); - } - /// Fill tree for kaons - if (trk.tpcInnerParam() < maxMomHardCutOnlyKa && trk.tpcInnerParam() <= maxMomTPCOnlyKa && std::abs(trk.tpcNSigmaKa()) < nSigmaTPCOnlyKa && downsampleTsalisCharged(trk.pt(), downsamplingTsalisKaons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Kaon])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaKa(), trk.tofNSigmaKa(), trk.tpcExpSignalKa(trk.tpcSignalCorrected()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka, hadronicRate); - } else if (trk.tpcInnerParam() < maxMomHardCutOnlyKa && trk.tpcInnerParam() > maxMomTPCOnlyKa && std::abs(trk.tofNSigmaKa()) < nSigmaTOF_TPCTOF_Ka && std::abs(trk.tpcNSigmaKa()) < nSigmaTPC_TPCTOF_Ka && downsampleTsalisCharged(trk.pt(), downsamplingTsalisKaons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Kaon])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaKa(), trk.tofNSigmaKa(), trk.tpcExpSignalKa(trk.tpcSignalCorrected()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka, hadronicRate); - } - /// Fill tree pions - if (trk.tpcInnerParam() <= maxMomTPCOnlyPi && std::abs(trk.tpcNSigmaPi()) < nSigmaTPCOnlyPi && downsampleTsalisCharged(trk.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaPi(), trk.tofNSigmaPi(), trk.tpcExpSignalPi(trk.tpcSignalCorrected()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); - } else if (trk.tpcInnerParam() > maxMomTPCOnlyPi && std::abs(trk.tofNSigmaPi()) < nSigmaTOF_TPCTOF_Pi && std::abs(trk.tpcNSigmaPi()) < nSigmaTPC_TPCTOF_Pi && downsampleTsalisCharged(trk.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion])) { - fillSkimmedTPCTOFTable(trk, collision, trk.tpcNSigmaPi(), trk.tofNSigmaPi(), trk.tpcExpSignalPi(trk.tpcSignalCorrected()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); - } - } /// Loop tracks + runStandard(collision, tracks); } /// process - PROCESS_SWITCH(TreeWriterTPCTOF, processStandard2, "Standard Samples for PID with corrected dEdx", false); + PROCESS_SWITCH(TreeWriterTPCTOF, processStandardWithCorrecteddEdx, "Standard Samples for PID with corrected dEdx", false); Preslice perCollisionTracks = aod::track::collisionId; - void processWithdEdxTrQA(Colls const& collisions, Trks const& myTracks, aod::BCsWithTimestamps const&, aod::TracksQAVersion const& tracksQA) + Preslice perCollisionTracksWithCorrecteddEdx = aod::track::collisionId; + + template + void runWithTrQAGeneric(Colls const& collisions, TrksType const& myTracks, aod::TracksQAVersion const& tracksQA, Preslice const& perCollisionTracksType) { std::vector labelTrack2TrackQA; labelTrack2TrackQA.clear(); @@ -1402,26 +997,37 @@ struct TreeWriterTPCTOF { labelTrack2TrackQA[trackId] = trackQAIndex; } for (const auto& collision : collisions) { - auto tracks = myTracks.sliceBy(perCollisionTracks, collision.globalIndex()); - auto tracksWithITSPid = soa::Attach(tracks); /// Check event selection + const auto& tracks = myTracks.sliceBy(perCollisionTracksType, collision.globalIndex()); if (!isEventSelected(collision, tracks)) { continue; } - auto bc = collision.bc_as(); + const auto& tracksWithITSPid = soa::Attach(tracks); + + const auto& bc = collision.bc_as(); const int runnumber = bc.runNumber(); float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * 1.e-3; + int bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame; + if constexpr (IsWithdEdx) { + bcGlobalIndex = -999; + bcTimeFrameId = -999; + bcBcInTimeFrame = -999; + } else { + bcGlobalIndex = bc.globalIndex(); + bcTimeFrameId = bc.tfId(); + bcBcInTimeFrame = bc.bcInTF(); + } rowTPCTOFTreeWithTrkQA.reserve(tracks.size()); for (auto const& trk : tracksWithITSPid) { - if (!((trackSelection == 0) || - ((trackSelection == 1) && trk.isGlobalTrack()) || - ((trackSelection == 2) && trk.isGlobalTrackWoPtEta()) || - ((trackSelection == 3) && trk.isGlobalTrackWoDCA()) || - ((trackSelection == 4) && trk.isQualityTrack()) || - ((trackSelection == 5) && trk.isInAcceptanceTrack()))) { + if (!((trackSelection == TrackSelectionNoCut) || + ((trackSelection == TrackSelectionGlobalTrack) && trk.isGlobalTrack()) || + ((trackSelection == TrackSelectionTrackWoPtEta) && trk.isGlobalTrackWoPtEta()) || + ((trackSelection == TrackSelectionGlobalTrackWoDCA) && trk.isGlobalTrackWoDCA()) || + ((trackSelection == TrackSelectionQualityTracks) && trk.isQualityTrack()) || + ((trackSelection == TrackSelectionInAcceptanceTracks) && trk.isInAcceptanceTrack()))) { continue; } // get the corresponding trackQA using labelTracks2TracKQA and get variables of interest @@ -1434,279 +1040,50 @@ struct TreeWriterTPCTOF { trackQA = tracksQA.iteratorAt(0); existTrkQA = false; } - /// Fill tree for tritons - if (trk.tpcInnerParam() < maxMomHardCutOnlyTr && trk.tpcInnerParam() <= maxMomTPCOnlyTr && std::abs(trk.tpcNSigmaTr()) < nSigmaTPCOnlyTr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Triton])) { - fillSkimmedTPCTOFTableWithdEdxTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaTr(), trk.tofNSigmaTr(), trk.itsNSigmaTr(), trk.tpcExpSignalTr(trk.tpcSignal()), o2::track::PID::Triton, runnumber, dwnSmplFactor_Tr, hadronicRate); - } else if (trk.tpcInnerParam() < maxMomHardCutOnlyTr && trk.tpcInnerParam() > maxMomTPCOnlyTr && std::abs(trk.tofNSigmaTr()) < nSigmaTOF_TPCTOF_Tr && std::abs(trk.tpcNSigmaTr()) < nSigmaTPC_TPCTOF_Tr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Triton])) { - fillSkimmedTPCTOFTableWithdEdxTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaTr(), trk.tofNSigmaTr(), trk.itsNSigmaTr(), trk.tpcExpSignalTr(trk.tpcSignal()), o2::track::PID::Triton, runnumber, dwnSmplFactor_Tr, hadronicRate); - } - /// Fill tree for deuterons - if (trk.tpcInnerParam() < maxMomHardCutOnlyDe && trk.tpcInnerParam() <= maxMomTPCOnlyDe && std::abs(trk.tpcNSigmaDe()) < nSigmaTPCOnlyDe && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Deuteron])) { - fillSkimmedTPCTOFTableWithdEdxTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaDe(), trk.tofNSigmaDe(), trk.itsNSigmaDe(), trk.tpcExpSignalDe(trk.tpcSignal()), o2::track::PID::Deuteron, runnumber, dwnSmplFactor_De, hadronicRate); - } else if (trk.tpcInnerParam() < maxMomHardCutOnlyDe && trk.tpcInnerParam() > maxMomTPCOnlyDe && std::abs(trk.tofNSigmaDe()) < nSigmaTOF_TPCTOF_De && std::abs(trk.tpcNSigmaDe()) < nSigmaTPC_TPCTOF_De && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Deuteron])) { - fillSkimmedTPCTOFTableWithdEdxTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaDe(), trk.tofNSigmaDe(), trk.itsNSigmaDe(), trk.tpcExpSignalDe(trk.tpcSignal()), o2::track::PID::Deuteron, runnumber, dwnSmplFactor_De, hadronicRate); - } - /// Fill tree for protons - if (trk.tpcInnerParam() <= maxMomTPCOnlyPr && std::abs(trk.tpcNSigmaPr()) < nSigmaTPCOnlyPr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton])) { - fillSkimmedTPCTOFTableWithdEdxTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaPr(), trk.tofNSigmaPr(), trk.itsNSigmaPr(), trk.tpcExpSignalPr(trk.tpcSignal()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate); - } else if (trk.tpcInnerParam() > maxMomTPCOnlyPr && std::abs(trk.tofNSigmaPr()) < nSigmaTOF_TPCTOF_Pr && std::abs(trk.tpcNSigmaPr()) < nSigmaTPC_TPCTOF_Pr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton])) { - fillSkimmedTPCTOFTableWithdEdxTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaPr(), trk.tofNSigmaPr(), trk.itsNSigmaPr(), trk.tpcExpSignalPr(trk.tpcSignal()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate); - } - /// Fill tree for kaons - if (trk.tpcInnerParam() < maxMomHardCutOnlyKa && trk.tpcInnerParam() <= maxMomTPCOnlyKa && std::abs(trk.tpcNSigmaKa()) < nSigmaTPCOnlyKa && downsampleTsalisCharged(trk.pt(), downsamplingTsalisKaons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Kaon])) { - fillSkimmedTPCTOFTableWithdEdxTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaKa(), trk.tofNSigmaKa(), trk.itsNSigmaKa(), trk.tpcExpSignalKa(trk.tpcSignal()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka, hadronicRate); - } else if (trk.tpcInnerParam() < maxMomHardCutOnlyKa && trk.tpcInnerParam() > maxMomTPCOnlyKa && std::abs(trk.tofNSigmaKa()) < nSigmaTOF_TPCTOF_Ka && std::abs(trk.tpcNSigmaKa()) < nSigmaTPC_TPCTOF_Ka && downsampleTsalisCharged(trk.pt(), downsamplingTsalisKaons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Kaon])) { - fillSkimmedTPCTOFTableWithdEdxTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaKa(), trk.tofNSigmaKa(), trk.itsNSigmaKa(), trk.tpcExpSignalKa(trk.tpcSignal()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka, hadronicRate); - } - /// Fill tree pions - if (trk.tpcInnerParam() <= maxMomTPCOnlyPi && std::abs(trk.tpcNSigmaPi()) < nSigmaTPCOnlyPi && downsampleTsalisCharged(trk.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion])) { - fillSkimmedTPCTOFTableWithdEdxTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaPi(), trk.tofNSigmaPi(), trk.itsNSigmaPi(), trk.tpcExpSignalPi(trk.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); - } else if (trk.tpcInnerParam() > maxMomTPCOnlyPi && std::abs(trk.tofNSigmaPi()) < nSigmaTOF_TPCTOF_Pi && std::abs(trk.tpcNSigmaPi()) < nSigmaTPC_TPCTOF_Pi && downsampleTsalisCharged(trk.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion])) { - fillSkimmedTPCTOFTableWithdEdxTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaPi(), trk.tofNSigmaPi(), trk.itsNSigmaPi(), trk.tpcExpSignalPi(trk.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); + + TofTrack tofTriton(true, maxMomHardCutOnlyTr, maxMomTPCOnlyTr, trk.tpcNSigmaTr(), nSigmaTPCOnlyTr, downsamplingTsalisTritons, MassTriton, trk.tofNSigmaTr(), trk.itsNSigmaTr(), trk.tpcExpSignalTr(tpcSignalGeneric(trk)), PidTriton, dwnSmplFactorTr, nSigmaTofTpctofTr, nSigmaTpcTpctofTr); + + TofTrack tofDeuteron(true, maxMomHardCutOnlyDe, maxMomTPCOnlyDe, trk.tpcNSigmaDe(), nSigmaTPCOnlyDe, downsamplingTsalisDeuterons, MassDeuteron, trk.tofNSigmaDe(), trk.itsNSigmaDe(), trk.tpcExpSignalDe(tpcSignalGeneric(trk)), PidDeuteron, dwnSmplFactorDe, nSigmaTofTpctofDe, nSigmaTpcTpctofDe); + + TofTrack tofProton(false, -999., maxMomTPCOnlyPr, trk.tpcNSigmaPr(), nSigmaTPCOnlyPr, downsamplingTsalisProtons, MassProton, trk.tofNSigmaPr(), trk.itsNSigmaPr(), trk.tpcExpSignalPr(tpcSignalGeneric(trk)), PidProton, dwnSmplFactorPr, nSigmaTofTpctofPr, nSigmaTpcTpctofPr); + + TofTrack tofKaon(true, maxMomHardCutOnlyKa, maxMomTPCOnlyKa, trk.tpcNSigmaKa(), nSigmaTPCOnlyKa, downsamplingTsalisKaons, MassKPlus, trk.tofNSigmaKa(), trk.itsNSigmaKa(), trk.tpcExpSignalKa(tpcSignalGeneric(trk)), PidKaon, dwnSmplFactorKa, nSigmaTofTpctofKa, nSigmaTpcTpctofKa); + + TofTrack tofPion(false, -999., maxMomTPCOnlyPi, trk.tpcNSigmaPi(), nSigmaTPCOnlyPi, downsamplingTsalisPions, MassPiPlus, trk.tofNSigmaPi(), trk.itsNSigmaPi(), trk.tpcExpSignalPi(tpcSignalGeneric(trk)), PidPion, dwnSmplFactorPi, nSigmaTofTpctofPi, nSigmaTpcTpctofPi); + + for (const auto& tofTrack : {tofTriton, tofDeuteron, tofProton, tofKaon, tofPion}) { + if ((!tofTrack.isApplyHardCutOnly || trk.tpcInnerParam() < tofTrack.maxMomHardCutOnly) && + ((trk.tpcInnerParam() <= tofTrack.maxMomTPCOnly && std::fabs(tofTrack.tpcNSigma) < tofTrack.nSigmaTPCOnly) || + (trk.tpcInnerParam() > tofTrack.maxMomTPCOnly && std::fabs(tofTrack.tofNSigma) < tofTrack.nSigmaTofTpctof && std::fabs(tofTrack.tpcNSigma) < tofTrack.nSigmaTpcTpctof)) && + downsampleTsalisCharged(trk.pt(), tofTrack.downsamplingTsalis, tofTrack.mass)) { + fillSkimmedTPCTOFTableWithTrkQAGeneric(trk, trackQA, existTrkQA, collision, tofTrack.tpcNSigma, tofTrack.tofNSigma, tofTrack.itsNSigma, tofTrack.tpcExpSignal, tofTrack.pid, runnumber, tofTrack.dwnSmplFactor, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); + } } } /// Loop tracks } + } + + void processWithdEdxTrQA(Colls const& collisions, Trks const& myTracks, aod::BCsWithTimestamps const&, aod::TracksQAVersion const& tracksQA) + { + runWithTrQAGeneric(collisions, myTracks, tracksQA, perCollisionTracks); } /// process PROCESS_SWITCH(TreeWriterTPCTOF, processWithdEdxTrQA, "Samples for PID with TrackQA info", false); - Preslice perCollisionTracksWithCorrecteddEdx = aod::track::collisionId; void processWithdEdxTrQAWithCorrecteddEdx(Colls const& collisions, TrksWithDEdxCorrection const& myTracks, aod::BCsWithTimestamps const&, aod::TracksQAVersion const& tracksQA) { - std::vector labelTrack2TrackQA; - labelTrack2TrackQA.clear(); - labelTrack2TrackQA.resize(myTracks.size(), -1); - for (const auto& trackQA : tracksQA) { - int64_t trackId = trackQA.trackId(); - int64_t trackQAIndex = trackQA.globalIndex(); - labelTrack2TrackQA[trackId] = trackQAIndex; - } - for (const auto& collision : collisions) { - auto tracks = myTracks.sliceBy(perCollisionTracksWithCorrecteddEdx, collision.globalIndex()); - auto tracksWithITSPid = soa::Attach(tracks); - /// Check event selection - if (!isEventSelected(collision, tracks)) { - continue; - } - auto bc = collision.bc_as(); - const int runnumber = bc.runNumber(); - float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * 1.e-3; - rowTPCTOFTreeWithTrkQA.reserve(tracks.size()); - for (auto const& trk : tracksWithITSPid) { - if (!((trackSelection == 0) || - ((trackSelection == 1) && trk.isGlobalTrack()) || - ((trackSelection == 2) && trk.isGlobalTrackWoPtEta()) || - ((trackSelection == 3) && trk.isGlobalTrackWoDCA()) || - ((trackSelection == 4) && trk.isQualityTrack()) || - ((trackSelection == 5) && trk.isInAcceptanceTrack()))) { - continue; - } - // get the corresponding trackQA using labelTracks2TracKQA and get variables of interest - aod::TracksQA trackQA; - bool existTrkQA; - if (labelTrack2TrackQA[trk.globalIndex()] != -1) { - trackQA = tracksQA.iteratorAt(labelTrack2TrackQA[trk.globalIndex()]); - existTrkQA = true; - } else { - trackQA = tracksQA.iteratorAt(0); - existTrkQA = false; - } - /// Fill tree for tritons - if (trk.tpcInnerParam() < maxMomHardCutOnlyTr && trk.tpcInnerParam() <= maxMomTPCOnlyTr && std::abs(trk.tpcNSigmaTr()) < nSigmaTPCOnlyTr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Triton])) { - fillSkimmedTPCTOFTableWithdEdxTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaTr(), trk.tofNSigmaTr(), trk.itsNSigmaTr(), trk.tpcExpSignalTr(trk.tpcSignalCorrected()), o2::track::PID::Triton, runnumber, dwnSmplFactor_Tr, hadronicRate); - } else if (trk.tpcInnerParam() < maxMomHardCutOnlyTr && trk.tpcInnerParam() > maxMomTPCOnlyTr && std::abs(trk.tofNSigmaTr()) < nSigmaTOF_TPCTOF_Tr && std::abs(trk.tpcNSigmaTr()) < nSigmaTPC_TPCTOF_Tr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Triton])) { - fillSkimmedTPCTOFTableWithdEdxTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaTr(), trk.tofNSigmaTr(), trk.itsNSigmaTr(), trk.tpcExpSignalTr(trk.tpcSignalCorrected()), o2::track::PID::Triton, runnumber, dwnSmplFactor_Tr, hadronicRate); - } - /// Fill tree for deuterons - if (trk.tpcInnerParam() < maxMomHardCutOnlyDe && trk.tpcInnerParam() <= maxMomTPCOnlyDe && std::abs(trk.tpcNSigmaDe()) < nSigmaTPCOnlyDe && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Deuteron])) { - fillSkimmedTPCTOFTableWithdEdxTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaDe(), trk.tofNSigmaDe(), trk.itsNSigmaDe(), trk.tpcExpSignalDe(trk.tpcSignalCorrected()), o2::track::PID::Deuteron, runnumber, dwnSmplFactor_De, hadronicRate); - } else if (trk.tpcInnerParam() < maxMomHardCutOnlyDe && trk.tpcInnerParam() > maxMomTPCOnlyDe && std::abs(trk.tofNSigmaDe()) < nSigmaTOF_TPCTOF_De && std::abs(trk.tpcNSigmaDe()) < nSigmaTPC_TPCTOF_De && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Deuteron])) { - fillSkimmedTPCTOFTableWithdEdxTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaDe(), trk.tofNSigmaDe(), trk.itsNSigmaDe(), trk.tpcExpSignalDe(trk.tpcSignalCorrected()), o2::track::PID::Deuteron, runnumber, dwnSmplFactor_De, hadronicRate); - } - /// Fill tree for protons - if (trk.tpcInnerParam() <= maxMomTPCOnlyPr && std::abs(trk.tpcNSigmaPr()) < nSigmaTPCOnlyPr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton])) { - fillSkimmedTPCTOFTableWithdEdxTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaPr(), trk.tofNSigmaPr(), trk.itsNSigmaPr(), trk.tpcExpSignalPr(trk.tpcSignalCorrected()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate); - } else if (trk.tpcInnerParam() > maxMomTPCOnlyPr && std::abs(trk.tofNSigmaPr()) < nSigmaTOF_TPCTOF_Pr && std::abs(trk.tpcNSigmaPr()) < nSigmaTPC_TPCTOF_Pr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton])) { - fillSkimmedTPCTOFTableWithdEdxTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaPr(), trk.tofNSigmaPr(), trk.itsNSigmaPr(), trk.tpcExpSignalPr(trk.tpcSignalCorrected()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate); - } - /// Fill tree for kaons - if (trk.tpcInnerParam() < maxMomHardCutOnlyKa && trk.tpcInnerParam() <= maxMomTPCOnlyKa && std::abs(trk.tpcNSigmaKa()) < nSigmaTPCOnlyKa && downsampleTsalisCharged(trk.pt(), downsamplingTsalisKaons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Kaon])) { - fillSkimmedTPCTOFTableWithdEdxTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaKa(), trk.tofNSigmaKa(), trk.itsNSigmaKa(), trk.tpcExpSignalKa(trk.tpcSignalCorrected()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka, hadronicRate); - } else if (trk.tpcInnerParam() < maxMomHardCutOnlyKa && trk.tpcInnerParam() > maxMomTPCOnlyKa && std::abs(trk.tofNSigmaKa()) < nSigmaTOF_TPCTOF_Ka && std::abs(trk.tpcNSigmaKa()) < nSigmaTPC_TPCTOF_Ka && downsampleTsalisCharged(trk.pt(), downsamplingTsalisKaons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Kaon])) { - fillSkimmedTPCTOFTableWithdEdxTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaKa(), trk.tofNSigmaKa(), trk.itsNSigmaKa(), trk.tpcExpSignalKa(trk.tpcSignalCorrected()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka, hadronicRate); - } - /// Fill tree pions - if (trk.tpcInnerParam() <= maxMomTPCOnlyPi && std::abs(trk.tpcNSigmaPi()) < nSigmaTPCOnlyPi && downsampleTsalisCharged(trk.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion])) { - fillSkimmedTPCTOFTableWithdEdxTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaPi(), trk.tofNSigmaPi(), trk.itsNSigmaPi(), trk.tpcExpSignalPi(trk.tpcSignalCorrected()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); - } else if (trk.tpcInnerParam() > maxMomTPCOnlyPi && std::abs(trk.tofNSigmaPi()) < nSigmaTOF_TPCTOF_Pi && std::abs(trk.tpcNSigmaPi()) < nSigmaTPC_TPCTOF_Pi && downsampleTsalisCharged(trk.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion])) { - fillSkimmedTPCTOFTableWithdEdxTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaPi(), trk.tofNSigmaPi(), trk.itsNSigmaPi(), trk.tpcExpSignalPi(trk.tpcSignalCorrected()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate); - } - } /// Loop tracks - } + runWithTrQAGeneric(collisions, myTracks, tracksQA, perCollisionTracksWithCorrecteddEdx); } /// process PROCESS_SWITCH(TreeWriterTPCTOF, processWithdEdxTrQAWithCorrecteddEdx, "Samples for PID with TrackQA info with corrected dEdx", false); void processWithTrQA(Colls const& collisions, Trks const& myTracks, MyBCTable const&, aod::TracksQAVersion const& tracksQA) { - std::vector labelTrack2TrackQA; - labelTrack2TrackQA.clear(); - labelTrack2TrackQA.resize(myTracks.size(), -1); - for (const auto& trackQA : tracksQA) { - int64_t trackId = trackQA.trackId(); - int64_t trackQAIndex = trackQA.globalIndex(); - labelTrack2TrackQA[trackId] = trackQAIndex; - } - for (const auto& collision : collisions) { - auto tracks = myTracks.sliceBy(perCollisionTracks, collision.globalIndex()); - auto tracksWithITSPid = soa::Attach(tracks); - /// Check event selection - if (!isEventSelected(collision, tracks)) { - continue; - } - auto bc = collision.bc_as(); - const int runnumber = bc.runNumber(); - float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * 1.e-3; - const int bcGlobalIndex = bc.globalIndex(); - const int bcTimeFrameId = bc.tfId(); - const int bcBcInTimeFrame = bc.bcInTF(); - rowTPCTOFTreeWithTrkQA.reserve(tracks.size()); - for (auto const& trk : tracksWithITSPid) { - if (!((trackSelection == 0) || - ((trackSelection == 1) && trk.isGlobalTrack()) || - ((trackSelection == 2) && trk.isGlobalTrackWoPtEta()) || - ((trackSelection == 3) && trk.isGlobalTrackWoDCA()) || - ((trackSelection == 4) && trk.isQualityTrack()) || - ((trackSelection == 5) && trk.isInAcceptanceTrack()))) { - continue; - } - // get the corresponding trackQA using labelTracks2TracKQA and get variables of interest - aod::TracksQA trackQA; - bool existTrkQA; - if (labelTrack2TrackQA[trk.globalIndex()] != -1) { - trackQA = tracksQA.iteratorAt(labelTrack2TrackQA[trk.globalIndex()]); - existTrkQA = true; - } else { - trackQA = tracksQA.iteratorAt(0); - existTrkQA = false; - } - /// Fill tree for tritons - if (trk.tpcInnerParam() < maxMomHardCutOnlyTr && trk.tpcInnerParam() <= maxMomTPCOnlyTr && std::abs(trk.tpcNSigmaTr()) < nSigmaTPCOnlyTr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Triton])) { - fillSkimmedTPCTOFTableWithTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaTr(), trk.tofNSigmaTr(), trk.itsNSigmaTr(), trk.tpcExpSignalTr(trk.tpcSignal()), o2::track::PID::Triton, runnumber, dwnSmplFactor_Tr, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } else if (trk.tpcInnerParam() < maxMomHardCutOnlyTr && trk.tpcInnerParam() > maxMomTPCOnlyTr && std::abs(trk.tofNSigmaTr()) < nSigmaTOF_TPCTOF_Tr && std::abs(trk.tpcNSigmaTr()) < nSigmaTPC_TPCTOF_Tr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Triton])) { - fillSkimmedTPCTOFTableWithTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaTr(), trk.tofNSigmaTr(), trk.itsNSigmaTr(), trk.tpcExpSignalTr(trk.tpcSignal()), o2::track::PID::Triton, runnumber, dwnSmplFactor_Tr, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - /// Fill tree for deuterons - if (trk.tpcInnerParam() < maxMomHardCutOnlyDe && trk.tpcInnerParam() <= maxMomTPCOnlyDe && std::abs(trk.tpcNSigmaDe()) < nSigmaTPCOnlyDe && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Deuteron])) { - fillSkimmedTPCTOFTableWithTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaDe(), trk.tofNSigmaDe(), trk.itsNSigmaDe(), trk.tpcExpSignalDe(trk.tpcSignal()), o2::track::PID::Deuteron, runnumber, dwnSmplFactor_De, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } else if (trk.tpcInnerParam() < maxMomHardCutOnlyDe && trk.tpcInnerParam() > maxMomTPCOnlyDe && std::abs(trk.tofNSigmaDe()) < nSigmaTOF_TPCTOF_De && std::abs(trk.tpcNSigmaDe()) < nSigmaTPC_TPCTOF_De && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Deuteron])) { - fillSkimmedTPCTOFTableWithTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaDe(), trk.tofNSigmaDe(), trk.itsNSigmaDe(), trk.tpcExpSignalDe(trk.tpcSignal()), o2::track::PID::Deuteron, runnumber, dwnSmplFactor_De, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - /// Fill tree for protons - if (trk.tpcInnerParam() <= maxMomTPCOnlyPr && std::abs(trk.tpcNSigmaPr()) < nSigmaTPCOnlyPr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton])) { - fillSkimmedTPCTOFTableWithTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaPr(), trk.tofNSigmaPr(), trk.itsNSigmaPr(), trk.tpcExpSignalPr(trk.tpcSignal()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } else if (trk.tpcInnerParam() > maxMomTPCOnlyPr && std::abs(trk.tofNSigmaPr()) < nSigmaTOF_TPCTOF_Pr && std::abs(trk.tpcNSigmaPr()) < nSigmaTPC_TPCTOF_Pr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton])) { - fillSkimmedTPCTOFTableWithTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaPr(), trk.tofNSigmaPr(), trk.itsNSigmaPr(), trk.tpcExpSignalPr(trk.tpcSignal()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - /// Fill tree for kaons - if (trk.tpcInnerParam() < maxMomHardCutOnlyKa && trk.tpcInnerParam() <= maxMomTPCOnlyKa && std::abs(trk.tpcNSigmaKa()) < nSigmaTPCOnlyKa && downsampleTsalisCharged(trk.pt(), downsamplingTsalisKaons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Kaon])) { - fillSkimmedTPCTOFTableWithTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaKa(), trk.tofNSigmaKa(), trk.itsNSigmaKa(), trk.tpcExpSignalKa(trk.tpcSignal()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } else if (trk.tpcInnerParam() < maxMomHardCutOnlyKa && trk.tpcInnerParam() > maxMomTPCOnlyKa && std::abs(trk.tofNSigmaKa()) < nSigmaTOF_TPCTOF_Ka && std::abs(trk.tpcNSigmaKa()) < nSigmaTPC_TPCTOF_Ka && downsampleTsalisCharged(trk.pt(), downsamplingTsalisKaons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Kaon])) { - fillSkimmedTPCTOFTableWithTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaKa(), trk.tofNSigmaKa(), trk.itsNSigmaKa(), trk.tpcExpSignalKa(trk.tpcSignal()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - /// Fill tree pions - if (trk.tpcInnerParam() <= maxMomTPCOnlyPi && std::abs(trk.tpcNSigmaPi()) < nSigmaTPCOnlyPi && downsampleTsalisCharged(trk.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion])) { - fillSkimmedTPCTOFTableWithTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaPi(), trk.tofNSigmaPi(), trk.itsNSigmaPi(), trk.tpcExpSignalPi(trk.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } else if (trk.tpcInnerParam() > maxMomTPCOnlyPi && std::abs(trk.tofNSigmaPi()) < nSigmaTOF_TPCTOF_Pi && std::abs(trk.tpcNSigmaPi()) < nSigmaTPC_TPCTOF_Pi && downsampleTsalisCharged(trk.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion])) { - fillSkimmedTPCTOFTableWithTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaPi(), trk.tofNSigmaPi(), trk.itsNSigmaPi(), trk.tpcExpSignalPi(trk.tpcSignal()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - } /// Loop tracks - } + runWithTrQAGeneric(collisions, myTracks, tracksQA, perCollisionTracks); } /// process PROCESS_SWITCH(TreeWriterTPCTOF, processWithTrQA, "Samples for PID with TrackQA info", false); void processWithTrQAWithCorrecteddEdx(Colls const& collisions, TrksWithDEdxCorrection const& myTracks, MyBCTable const&, aod::TracksQAVersion const& tracksQA) { - std::vector labelTrack2TrackQA; - labelTrack2TrackQA.clear(); - labelTrack2TrackQA.resize(myTracks.size(), -1); - for (const auto& trackQA : tracksQA) { - int64_t trackId = trackQA.trackId(); - int64_t trackQAIndex = trackQA.globalIndex(); - labelTrack2TrackQA[trackId] = trackQAIndex; - } - for (const auto& collision : collisions) { - auto tracks = myTracks.sliceBy(perCollisionTracks, collision.globalIndex()); - auto tracksWithITSPid = soa::Attach(tracks); - /// Check event selection - if (!isEventSelected(collision, tracks)) { - continue; - } - auto bc = collision.bc_as(); - const int runnumber = bc.runNumber(); - float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * 1.e-3; - const int bcGlobalIndex = bc.globalIndex(); - const int bcTimeFrameId = bc.tfId(); - const int bcBcInTimeFrame = bc.bcInTF(); - rowTPCTOFTreeWithTrkQA.reserve(tracks.size()); - for (auto const& trk : tracksWithITSPid) { - if (!((trackSelection == 0) || - ((trackSelection == 1) && trk.isGlobalTrack()) || - ((trackSelection == 2) && trk.isGlobalTrackWoPtEta()) || - ((trackSelection == 3) && trk.isGlobalTrackWoDCA()) || - ((trackSelection == 4) && trk.isQualityTrack()) || - ((trackSelection == 5) && trk.isInAcceptanceTrack()))) { - continue; - } - // get the corresponding trackQA using labelTracks2TracKQA and get variables of interest - aod::TracksQA trackQA; - bool existTrkQA; - if (labelTrack2TrackQA[trk.globalIndex()] != -1) { - trackQA = tracksQA.iteratorAt(labelTrack2TrackQA[trk.globalIndex()]); - existTrkQA = true; - } else { - trackQA = tracksQA.iteratorAt(0); - existTrkQA = false; - } - /// Fill tree for tritons - if (trk.tpcInnerParam() < maxMomHardCutOnlyTr && trk.tpcInnerParam() <= maxMomTPCOnlyTr && std::abs(trk.tpcNSigmaTr()) < nSigmaTPCOnlyTr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Triton])) { - fillSkimmedTPCTOFTableWithTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaTr(), trk.tofNSigmaTr(), trk.itsNSigmaTr(), trk.tpcExpSignalTr(trk.tpcSignalCorrected()), o2::track::PID::Triton, runnumber, dwnSmplFactor_Tr, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } else if (trk.tpcInnerParam() < maxMomHardCutOnlyTr && trk.tpcInnerParam() > maxMomTPCOnlyTr && std::abs(trk.tofNSigmaTr()) < nSigmaTOF_TPCTOF_Tr && std::abs(trk.tpcNSigmaTr()) < nSigmaTPC_TPCTOF_Tr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Triton])) { - fillSkimmedTPCTOFTableWithTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaTr(), trk.tofNSigmaTr(), trk.itsNSigmaTr(), trk.tpcExpSignalTr(trk.tpcSignalCorrected()), o2::track::PID::Triton, runnumber, dwnSmplFactor_Tr, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - /// Fill tree for deuterons - if (trk.tpcInnerParam() < maxMomHardCutOnlyDe && trk.tpcInnerParam() <= maxMomTPCOnlyDe && std::abs(trk.tpcNSigmaDe()) < nSigmaTPCOnlyDe && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Deuteron])) { - fillSkimmedTPCTOFTableWithTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaDe(), trk.tofNSigmaDe(), trk.itsNSigmaDe(), trk.tpcExpSignalDe(trk.tpcSignalCorrected()), o2::track::PID::Deuteron, runnumber, dwnSmplFactor_De, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } else if (trk.tpcInnerParam() < maxMomHardCutOnlyDe && trk.tpcInnerParam() > maxMomTPCOnlyDe && std::abs(trk.tofNSigmaDe()) < nSigmaTOF_TPCTOF_De && std::abs(trk.tpcNSigmaDe()) < nSigmaTPC_TPCTOF_De && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Deuteron])) { - fillSkimmedTPCTOFTableWithTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaDe(), trk.tofNSigmaDe(), trk.itsNSigmaDe(), trk.tpcExpSignalDe(trk.tpcSignalCorrected()), o2::track::PID::Deuteron, runnumber, dwnSmplFactor_De, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - /// Fill tree for protons - if (trk.tpcInnerParam() <= maxMomTPCOnlyPr && std::abs(trk.tpcNSigmaPr()) < nSigmaTPCOnlyPr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton])) { - fillSkimmedTPCTOFTableWithTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaPr(), trk.tofNSigmaPr(), trk.itsNSigmaPr(), trk.tpcExpSignalPr(trk.tpcSignalCorrected()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } else if (trk.tpcInnerParam() > maxMomTPCOnlyPr && std::abs(trk.tofNSigmaPr()) < nSigmaTOF_TPCTOF_Pr && std::abs(trk.tpcNSigmaPr()) < nSigmaTPC_TPCTOF_Pr && downsampleTsalisCharged(trk.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton])) { - fillSkimmedTPCTOFTableWithTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaPr(), trk.tofNSigmaPr(), trk.itsNSigmaPr(), trk.tpcExpSignalPr(trk.tpcSignalCorrected()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - /// Fill tree for kaons - if (trk.tpcInnerParam() < maxMomHardCutOnlyKa && trk.tpcInnerParam() <= maxMomTPCOnlyKa && std::abs(trk.tpcNSigmaKa()) < nSigmaTPCOnlyKa && downsampleTsalisCharged(trk.pt(), downsamplingTsalisKaons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Kaon])) { - fillSkimmedTPCTOFTableWithTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaKa(), trk.tofNSigmaKa(), trk.itsNSigmaKa(), trk.tpcExpSignalKa(trk.tpcSignalCorrected()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } else if (trk.tpcInnerParam() < maxMomHardCutOnlyKa && trk.tpcInnerParam() > maxMomTPCOnlyKa && std::abs(trk.tofNSigmaKa()) < nSigmaTOF_TPCTOF_Ka && std::abs(trk.tpcNSigmaKa()) < nSigmaTPC_TPCTOF_Ka && downsampleTsalisCharged(trk.pt(), downsamplingTsalisKaons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Kaon])) { - fillSkimmedTPCTOFTableWithTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaKa(), trk.tofNSigmaKa(), trk.itsNSigmaKa(), trk.tpcExpSignalKa(trk.tpcSignalCorrected()), o2::track::PID::Kaon, runnumber, dwnSmplFactor_Ka, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - /// Fill tree pions - if (trk.tpcInnerParam() <= maxMomTPCOnlyPi && std::abs(trk.tpcNSigmaPi()) < nSigmaTPCOnlyPi && downsampleTsalisCharged(trk.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion])) { - fillSkimmedTPCTOFTableWithTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaPi(), trk.tofNSigmaPi(), trk.itsNSigmaPi(), trk.tpcExpSignalPi(trk.tpcSignalCorrected()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } else if (trk.tpcInnerParam() > maxMomTPCOnlyPi && std::abs(trk.tofNSigmaPi()) < nSigmaTOF_TPCTOF_Pi && std::abs(trk.tpcNSigmaPi()) < nSigmaTPC_TPCTOF_Pi && downsampleTsalisCharged(trk.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion])) { - fillSkimmedTPCTOFTableWithTrkQA(trk, trackQA, existTrkQA, collision, trk.tpcNSigmaPi(), trk.tofNSigmaPi(), trk.itsNSigmaPi(), trk.tpcExpSignalPi(trk.tpcSignalCorrected()), o2::track::PID::Pion, runnumber, dwnSmplFactor_Pi, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - } /// Loop tracks - } + runWithTrQAGeneric(collisions, myTracks, tracksQA, perCollisionTracksWithCorrecteddEdx); } /// process PROCESS_SWITCH(TreeWriterTPCTOF, processWithTrQAWithCorrecteddEdx, "Samples for PID with TrackQA info with correced dEdx", false); From 53cdd094360e29962ebf4acf37a0dd0bf7fc5567 Mon Sep 17 00:00:00 2001 From: Marvin Hemmer <53471402+mhemmer-cern@users.noreply.github.com> Date: Wed, 8 Oct 2025 02:09:50 +0200 Subject: [PATCH 657/986] [PWGEM,PWGHF,Trigger] Fix O2linter warnings (#13264) --- .../PWGEM/HeavyNeutralMesonFilter.cxx | 73 +- PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h | 427 ++++--- PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h | 439 ++++--- PWGEM/PhotonMeson/DataModel/gammaTables.h | 6 + .../TableProducer/photonconversionbuilder.cxx | 90 +- .../TableProducer/skimmerGammaCalo.cxx | 60 +- PWGEM/PhotonMeson/Tasks/CMakeLists.txt | 4 + .../Tasks/Pi0EtaToGammaGammaEMCEMC.cxx | 21 +- .../Tasks/Pi0EtaToGammaGammaMCEMCEMC.cxx | 21 +- .../Tasks/Pi0EtaToGammaGammaMCPCMDalitzEE.cxx | 31 +- .../Tasks/Pi0EtaToGammaGammaMCPCMPCM.cxx | 27 +- .../Tasks/Pi0EtaToGammaGammaPCMDalitzEE.cxx | 24 +- .../Tasks/Pi0EtaToGammaGammaPCMPCM.cxx | 23 +- PWGEM/PhotonMeson/Tasks/calibTaskEmc.cxx | 1071 +++++++++++++++++ PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx | 45 +- PWGEM/PhotonMeson/Utils/ClusterHistograms.h | 41 +- PWGEM/PhotonMeson/Utils/EventHistograms.h | 122 +- PWGEM/PhotonMeson/Utils/HNMUtilities.h | 35 +- PWGEM/PhotonMeson/Utils/MCUtilities.h | 50 +- PWGEM/PhotonMeson/Utils/NMHistograms.h | 61 +- PWGEM/PhotonMeson/Utils/PCMUtilities.h | 24 +- PWGEM/PhotonMeson/Utils/TrackSelection.h | 5 +- .../PhotonMeson/Utils/emcalHistoDefinitions.h | 57 +- .../PhotonMeson/Utils/gammaConvDefinitions.h | 4 +- .../electronSelectionWithTpcEmcal.cxx | 13 +- PWGHF/HFL/Tasks/taskSingleElectron.cxx | 24 +- 26 files changed, 1967 insertions(+), 831 deletions(-) create mode 100644 PWGEM/PhotonMeson/Tasks/calibTaskEmc.cxx diff --git a/EventFiltering/PWGEM/HeavyNeutralMesonFilter.cxx b/EventFiltering/PWGEM/HeavyNeutralMesonFilter.cxx index 6909d1561ee..013bee26a88 100644 --- a/EventFiltering/PWGEM/HeavyNeutralMesonFilter.cxx +++ b/EventFiltering/PWGEM/HeavyNeutralMesonFilter.cxx @@ -10,38 +10,52 @@ // or submit itself to any jurisdiction. /// /// \file HeavyNeutralMesonFilter.cxx -/// /// \brief This code loops over collisions to filter events contaning heavy neutral mesons (omega or eta') using EMCal clusters and V0s (PCM) -/// /// \author Nicolas Strangmann (nicolas.strangmann@cern.ch) - Goethe University Frankfurt; Maximilian Korwieser (maximilian.korwieser@cern.ch) - Technical University Munich /// -#include -#include -#include - -#include "Math/GenVector/Boost.h" -#include "Math/Vector4D.h" -#include "TMath.h" -#include "TRandom3.h" - +#include "EventFiltering/filterTables.h" +// #include "PWGEM/PhotonMeson/Utils/HNMUtilities.h" +#include "PWGEM/PhotonMeson/Utils/PairUtilities.h" #include "PWGJE/DataModel/EMCALMatchedCollisions.h" -#include "Common/DataModel/PIDResponse.h" -#include "Common/DataModel/PIDResponseITS.h" -#include "fairlogger/Logger.h" -#include "Framework/Configurable.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" -#include "CommonConstants/MathConstants.h" -#include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/CCDB/TriggerAliases.h" +#include "Common/Core/RecoDecay.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponseITS.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include // IWYU pragma: keep +#include +#include +#include + +#include + +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -90,21 +104,22 @@ const std::vector pidCutsName{"TPC min", "TPC max", "TPCTOF max", " const std::vector femtoFilterNames{"PPOmega", "PPEtaPrime", "Omegad", "EtaPrimed", "OmegaP", "EtaPrimeP"}; // configs for tracks -const float pidcutsTable[kNFemtoPartners][kNPIDLimits]{ +// these are need [[maybe_unused]] to silence a warning from clangd, since the compiler will inline them directly to the configs down below and then say: Variable 'X' is not needed and will not be emitted +[[maybe_unused]] const float pidcutsTable[kNFemtoPartners][kNPIDLimits]{ {-4.f, 4.f, 4.f, -99.f, 99.f}, {-4.f, 4.f, 4.f, -6.f, 6.f}, {-4.f, 4.f, 4.f, -99.f, 99.f}}; -const float ptcutsTable[kNFemtoPartners][3]{ +[[maybe_unused]] const float ptcutsTable[kNFemtoPartners][3]{ {0.35f, 6.f, 0.75f}, {0.55f, 2.f, 1.2f}, {0.35f, 6.f, 0.75f}}; -const float nClusterMinTPC[1][kNFemtoPartners]{{80.0f, 80.0f, 80.0f}}; -const float nClusterMinITS[1][kNFemtoPartners]{{4, 4, 4}}; +[[maybe_unused]] const float nClusterMinTPC[1][kNFemtoPartners]{{80.0f, 80.0f, 80.0f}}; +[[maybe_unused]] const float nClusterMinITS[1][kNFemtoPartners]{{4, 4, 4}}; -static const float triggerSwitches[1][kNFemtoTriggers]{{1, 1, 1, 1, 1, 1}}; -const float triggerLimits[1][kNFemtoTriggers]{{1.f, 1.f, 1.f, 1.f, 1.f, 1.f}}; +[[maybe_unused]] static const float triggerSwitches[1][kNFemtoTriggers]{{1, 1, 1, 1, 1, 1}}; +[[maybe_unused]] const float triggerLimits[1][kNFemtoTriggers]{{1.f, 1.f, 1.f, 1.f, 1.f, 1.f}}; } // namespace hnmtrigger struct HeavyNeutralMesonFilter { diff --git a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h index 8d2f16d34f6..9dd902396b4 100644 --- a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h +++ b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h @@ -9,19 +9,13 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // -// ======================== -// /// \file Pi0EtaToGammaGamma.h /// \brief This code loops over photons and makes pairs for neutral mesons analyses. -/// /// \author D. Sekihata, daiki.sekihata@cern.ch #ifndef PWGEM_PHOTONMESON_CORE_PI0ETATOGAMMAGAMMA_H_ #define PWGEM_PHOTONMESON_CORE_PI0ETATOGAMMAGAMMA_H_ -#include "PWGEM/Dilepton/Utils/EMTrack.h" -#include "PWGEM/Dilepton/Utils/EMTrackUtilities.h" -#include "PWGEM/Dilepton/Utils/EventMixingHandler.h" #include "PWGEM/PhotonMeson/Core/DalitzEECut.h" #include "PWGEM/PhotonMeson/Core/EMCPhotonCut.h" #include "PWGEM/PhotonMeson/Core/EMPhotonEventCut.h" @@ -31,200 +25,187 @@ #include "PWGEM/PhotonMeson/Utils/EventHistograms.h" #include "PWGEM/PhotonMeson/Utils/NMHistograms.h" #include "PWGEM/PhotonMeson/Utils/PairUtilities.h" +// Dilepton headers +#include "PWGEM/Dilepton/Utils/EMTrack.h" +#include "PWGEM/Dilepton/Utils/EventMixingHandler.h" -#include "Common/Core/RecoDecay.h" - -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DetectorsBase/GeometryManager.h" -#include "EMCALBase/Geometry.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" - -#include "Math/AxisAngle.h" -#include "Math/LorentzRotation.h" -#include "Math/Rotation3D.h" -#include "Math/Vector3D.h" -#include "Math/Vector4D.h" -#include "TString.h" +#include "Common/CCDB/TriggerAliases.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include // IWYU pragma: keep +#include #include -#include +#include +#include #include -#include #include #include #include +#include #include #include -using namespace o2; -using namespace o2::aod; -using namespace o2::framework; -using namespace o2::framework::expressions; -using namespace o2::soa; -using namespace o2::aod::pwgem::photonmeson::photonpair; -using namespace o2::aod::pwgem::photon; -using namespace o2::aod::pwgem::dilepton::utils::emtrackutil; -using namespace o2::aod::pwgem::dilepton::utils; - -using MyCollisions = soa::Join; -using MyCollision = MyCollisions::iterator; - -using MyCollisionsWithJJMC = soa::Join; -using MyCollisionWithJJMC = MyCollisionsWithJJMC::iterator; - -using MyV0Photons = soa::Filtered>; -using MyV0Photon = MyV0Photons::iterator; - -using MyPrimaryElectrons = soa::Filtered>; -using MyPrimaryElectron = MyPrimaryElectrons::iterator; - -using MyEMCClusters = soa::Join; -using MyEMCCluster = MyEMCClusters::iterator; - -using MyPHOSClusters = soa::Join; -using MyPHOSCluster = MyPHOSClusters::iterator; +#include -template +template struct Pi0EtaToGammaGamma { - Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; - Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; - Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; - Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; - Configurable ndiff_bc_mix{"ndiff_bc_mix", 198, "difference in global BC required in mixed events"}; - - Configurable cfgQvecEstimator{"cfgQvecEstimator", 0, "FT0M:0, FT0A:1, FT0C:2"}; - Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; - Configurable cfgOccupancyEstimator{"cfgOccupancyEstimator", 0, "FT0C:0, Track:1"}; - Configurable cfgCentMin{"cfgCentMin", 0, "min. centrality"}; - Configurable cfgCentMax{"cfgCentMax", 999, "max. centrality"}; - Configurable maxY{"maxY", 0.8, "maximum rapidity for reconstructed particles"}; - Configurable cfgDoMix{"cfgDoMix", true, "flag for event mixing"}; - Configurable ndepth{"ndepth", 10, "depth for event mixing"}; - ConfigurableAxis ConfVtxBins{"ConfVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; - ConfigurableAxis ConfCentBins{"ConfCentBins", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.f, 999.f}, "Mixing bins - centrality"}; - ConfigurableAxis ConfEPBins{"ConfEPBins", {VARIABLE_WIDTH, -M_PI / 2, -M_PI / 4, 0.0f, +M_PI / 4, +M_PI / 2}, "Mixing bins - event plane angle"}; - ConfigurableAxis ConfOccupancyBins{"ConfOccupancyBins", {VARIABLE_WIDTH, -1, 1e+10}, "Mixing bins - occupancy"}; + o2::framework::Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + o2::framework::Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; + o2::framework::Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + o2::framework::Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; + o2::framework::Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; + o2::framework::Configurable ndiff_bc_mix{"ndiff_bc_mix", 198, "difference in global BC required in mixed events"}; + + o2::framework::Configurable cfgQvecEstimator{"cfgQvecEstimator", 0, "FT0M:0, FT0A:1, FT0C:2"}; + o2::framework::Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; + o2::framework::Configurable cfgOccupancyEstimator{"cfgOccupancyEstimator", 0, "FT0C:0, Track:1"}; + o2::framework::Configurable cfgCentMin{"cfgCentMin", 0, "min. centrality"}; + o2::framework::Configurable cfgCentMax{"cfgCentMax", 999, "max. centrality"}; + o2::framework::Configurable maxY{"maxY", 0.8, "maximum rapidity for reconstructed particles"}; + o2::framework::Configurable cfgDoMix{"cfgDoMix", true, "flag for event mixing"}; + o2::framework::Configurable ndepth{"ndepth", 10, "depth for event mixing"}; + o2::framework::ConfigurableAxis ConfVtxBins{"ConfVtxBins", {o2::framework::VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; + o2::framework::ConfigurableAxis ConfCentBins{"ConfCentBins", {o2::framework::VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.f, 999.f}, "Mixing bins - centrality"}; + o2::framework::ConfigurableAxis ConfEPBins{"ConfEPBins", {o2::framework::VARIABLE_WIDTH, -o2::constants::math::PIHalf, -o2::constants::math::PIQuarter, 0.0f, +o2::constants::math::PIQuarter, +o2::constants::math::PIHalf}, "Mixing bins - event plane angle"}; + o2::framework::ConfigurableAxis ConfOccupancyBins{"ConfOccupancyBins", {o2::framework::VARIABLE_WIDTH, -1, 1e+10}, "Mixing bins - occupancy"}; EMPhotonEventCut fEMEventCut; - struct : ConfigurableGroup { + struct : o2::framework::ConfigurableGroup { std::string prefix = "eventcut_group"; - Configurable cfgZvtxMin{"cfgZvtxMin", -10.f, "min. Zvtx"}; - Configurable cfgZvtxMax{"cfgZvtxMax", +10.f, "max. Zvtx"}; - Configurable cfgRequireSel8{"cfgRequireSel8", true, "require sel8 in event cut"}; - Configurable cfgRequireFT0AND{"cfgRequireFT0AND", true, "require FT0AND in event cut"}; - Configurable cfgRequireNoTFB{"cfgRequireNoTFB", false, "require No time frame border in event cut"}; - Configurable cfgRequireNoITSROFB{"cfgRequireNoITSROFB", false, "require no ITS readout frame border in event cut"}; - Configurable cfgRequireNoSameBunchPileup{"cfgRequireNoSameBunchPileup", false, "require no same bunch pileup in event cut"}; - Configurable cfgRequireVertexITSTPC{"cfgRequireVertexITSTPC", false, "require Vertex ITSTPC in event cut"}; // ITS-TPC matched track contributes PV. - Configurable cfgRequireGoodZvtxFT0vsPV{"cfgRequireGoodZvtxFT0vsPV", false, "require good Zvtx between FT0 vs. PV in event cut"}; - Configurable cfgRequireEMCReadoutInMB{"cfgRequireEMCReadoutInMB", false, "require the EMC to be read out in an MB collision (kTVXinEMC)"}; - Configurable cfgRequireEMCHardwareTriggered{"cfgRequireEMCHardwareTriggered", false, "require the EMC to be hardware triggered (kEMC7 or kDMC7)"}; - Configurable cfgTrackOccupancyMin{"cfgTrackOccupancyMin", -2, "min. occupancy"}; - Configurable cfgTrackOccupancyMax{"cfgTrackOccupancyMax", 1000000000, "max. occupancy"}; - Configurable cfgFT0COccupancyMin{"cfgFT0COccupancyMin", -2, "min. FT0C occupancy"}; - Configurable cfgFT0COccupancyMax{"cfgFT0COccupancyMax", 1000000000, "max. FT0C occupancy"}; - Configurable onlyKeepWeightedEvents{"onlyKeepWeightedEvents", false, "flag to keep only weighted events (for JJ MCs) and remove all MB events (with weight = 1)"}; + o2::framework::Configurable cfgZvtxMin{"cfgZvtxMin", -10.f, "min. Zvtx"}; + o2::framework::Configurable cfgZvtxMax{"cfgZvtxMax", +10.f, "max. Zvtx"}; + o2::framework::Configurable cfgRequireSel8{"cfgRequireSel8", true, "require sel8 in event cut"}; + o2::framework::Configurable cfgRequireFT0AND{"cfgRequireFT0AND", true, "require FT0AND in event cut"}; + o2::framework::Configurable cfgRequireNoTFB{"cfgRequireNoTFB", false, "require No time frame border in event cut"}; + o2::framework::Configurable cfgRequireNoITSROFB{"cfgRequireNoITSROFB", false, "require no ITS readout frame border in event cut"}; + o2::framework::Configurable cfgRequireNoSameBunchPileup{"cfgRequireNoSameBunchPileup", false, "require no same bunch pileup in event cut"}; + o2::framework::Configurable cfgRequireVertexITSTPC{"cfgRequireVertexITSTPC", false, "require Vertex ITSTPC in event cut"}; // ITS-TPC matched track contributes PV. + o2::framework::Configurable cfgRequireGoodZvtxFT0vsPV{"cfgRequireGoodZvtxFT0vsPV", false, "require good Zvtx between FT0 vs. PV in event cut"}; + o2::framework::Configurable cfgRequireEMCReadoutInMB{"cfgRequireEMCReadoutInMB", false, "require the EMC to be read out in an MB collision (kTVXinEMC)"}; + o2::framework::Configurable cfgRequireEMCHardwareTriggered{"cfgRequireEMCHardwareTriggered", false, "require the EMC to be hardware triggered (kEMC7 or kDMC7)"}; + o2::framework::Configurable cfgTrackOccupancyMin{"cfgTrackOccupancyMin", -2, "min. occupancy"}; + o2::framework::Configurable cfgTrackOccupancyMax{"cfgTrackOccupancyMax", 1000000000, "max. occupancy"}; + o2::framework::Configurable cfgFT0COccupancyMin{"cfgFT0COccupancyMin", -2, "min. FT0C occupancy"}; + o2::framework::Configurable cfgFT0COccupancyMax{"cfgFT0COccupancyMax", 1000000000, "max. FT0C occupancy"}; + o2::framework::Configurable onlyKeepWeightedEvents{"onlyKeepWeightedEvents", false, "flag to keep only weighted events (for JJ MCs) and remove all MB events (with weight = 1)"}; } eventcuts; V0PhotonCut fV0PhotonCut; - struct : ConfigurableGroup { + struct : o2::framework::ConfigurableGroup { std::string prefix = "pcmcut_group"; - Configurable cfg_require_v0_with_itstpc{"cfg_require_v0_with_itstpc", false, "flag to select V0s with ITS-TPC matched tracks"}; - Configurable cfg_require_v0_with_itsonly{"cfg_require_v0_with_itsonly", false, "flag to select V0s with ITSonly tracks"}; - Configurable cfg_require_v0_with_tpconly{"cfg_require_v0_with_tpconly", false, "flag to select V0s with TPConly tracks"}; - Configurable cfg_min_pt_v0{"cfg_min_pt_v0", 0.1, "min pT for v0 photons at PV"}; - Configurable cfg_max_pt_v0{"cfg_max_pt_v0", 1e+10, "max pT for v0 photons at PV"}; - Configurable cfg_min_eta_v0{"cfg_min_eta_v0", -0.8, "min eta for v0 photons at PV"}; - Configurable cfg_max_eta_v0{"cfg_max_eta_v0", 0.8, "max eta for v0 photons at PV"}; - Configurable cfg_min_v0radius{"cfg_min_v0radius", 4.0, "min v0 radius"}; - Configurable cfg_max_v0radius{"cfg_max_v0radius", 90.0, "max v0 radius"}; - Configurable cfg_max_alpha_ap{"cfg_max_alpha_ap", 0.95, "max alpha for AP cut"}; - Configurable cfg_max_qt_ap{"cfg_max_qt_ap", 0.01, "max qT for AP cut"}; - Configurable cfg_min_cospa{"cfg_min_cospa", 0.999, "min V0 CosPA"}; - Configurable cfg_max_pca{"cfg_max_pca", 1.5, "max distance btween 2 legs"}; - Configurable cfg_max_chi2kf{"cfg_max_chi2kf", 1e+10, "max chi2/ndf with KF"}; - Configurable cfg_reject_v0_on_itsib{"cfg_reject_v0_on_itsib", true, "flag to reject V0s on ITSib"}; - Configurable cfg_apply_cuts_from_prefilter_derived{"cfg_apply_cuts_from_prefilter_derived", false, "flag to apply prefilter to V0"}; - - Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; - Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 40, "min ncrossed rows"}; - Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; - Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; - Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; - Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -3.0, "min. TPC n sigma for electron"}; - Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +3.0, "max. TPC n sigma for electron"}; - Configurable cfg_disable_itsonly_track{"cfg_disable_itsonly_track", false, "flag to disable ITSonly tracks"}; - Configurable cfg_disable_tpconly_track{"cfg_disable_tpconly_track", false, "flag to disable TPConly tracks"}; + o2::framework::Configurable cfg_require_v0_with_itstpc{"cfg_require_v0_with_itstpc", false, "flag to select V0s with ITS-TPC matched tracks"}; + o2::framework::Configurable cfg_require_v0_with_itsonly{"cfg_require_v0_with_itsonly", false, "flag to select V0s with ITSonly tracks"}; + o2::framework::Configurable cfg_require_v0_with_tpconly{"cfg_require_v0_with_tpconly", false, "flag to select V0s with TPConly tracks"}; + o2::framework::Configurable cfg_min_pt_v0{"cfg_min_pt_v0", 0.1, "min pT for v0 photons at PV"}; + o2::framework::Configurable cfg_max_pt_v0{"cfg_max_pt_v0", 1e+10, "max pT for v0 photons at PV"}; + o2::framework::Configurable cfg_min_eta_v0{"cfg_min_eta_v0", -0.8, "min eta for v0 photons at PV"}; + o2::framework::Configurable cfg_max_eta_v0{"cfg_max_eta_v0", 0.8, "max eta for v0 photons at PV"}; + o2::framework::Configurable cfg_min_v0radius{"cfg_min_v0radius", 4.0, "min v0 radius"}; + o2::framework::Configurable cfg_max_v0radius{"cfg_max_v0radius", 90.0, "max v0 radius"}; + o2::framework::Configurable cfg_max_alpha_ap{"cfg_max_alpha_ap", 0.95, "max alpha for AP cut"}; + o2::framework::Configurable cfg_max_qt_ap{"cfg_max_qt_ap", 0.01, "max qT for AP cut"}; + o2::framework::Configurable cfg_min_cospa{"cfg_min_cospa", 0.999, "min V0 CosPA"}; + o2::framework::Configurable cfg_max_pca{"cfg_max_pca", 1.5, "max distance btween 2 legs"}; + o2::framework::Configurable cfg_max_chi2kf{"cfg_max_chi2kf", 1e+10, "max chi2/ndf with KF"}; + o2::framework::Configurable cfg_reject_v0_on_itsib{"cfg_reject_v0_on_itsib", true, "flag to reject V0s on ITSib"}; + o2::framework::Configurable cfg_apply_cuts_from_prefilter_derived{"cfg_apply_cuts_from_prefilter_derived", false, "flag to apply prefilter to V0"}; + + o2::framework::Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; + o2::framework::Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 40, "min ncrossed rows"}; + o2::framework::Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; + o2::framework::Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; + o2::framework::Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; + o2::framework::Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -3.0, "min. TPC n sigma for electron"}; + o2::framework::Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +3.0, "max. TPC n sigma for electron"}; + o2::framework::Configurable cfg_disable_itsonly_track{"cfg_disable_itsonly_track", false, "flag to disable ITSonly tracks"}; + o2::framework::Configurable cfg_disable_tpconly_track{"cfg_disable_tpconly_track", false, "flag to disable TPConly tracks"}; } pcmcuts; DalitzEECut fDileptonCut; - struct : ConfigurableGroup { + struct : o2::framework::ConfigurableGroup { std::string prefix = "dileptoncut_group"; - Configurable cfg_min_mass{"cfg_min_mass", 0.0, "min mass"}; - Configurable cfg_max_mass{"cfg_max_mass", 0.1, "max mass"}; - Configurable cfg_apply_phiv{"cfg_apply_phiv", true, "flag to apply phiv cut"}; - Configurable cfg_require_itsib_any{"cfg_require_itsib_any", false, "flag to require ITS ib any hits"}; - Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", true, "flag to require ITS ib 1st hit"}; - Configurable cfg_phiv_slope{"cfg_phiv_slope", 0.0185, "slope for m vs. phiv"}; - Configurable cfg_phiv_intercept{"cfg_phiv_intercept", -0.0280, "intercept for m vs. phiv"}; - - Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.1, "min pT for single track"}; - Configurable cfg_max_eta_track{"cfg_max_eta_track", 0.8, "max eta for single track"}; - Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; - Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 5, "min ncluster its"}; - Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 70, "min ncrossed rows"}; - Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; - Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; - Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 0.05, "max dca XY for single track in cm"}; - Configurable cfg_max_dcaz{"cfg_max_dcaz", 0.05, "max dca Z for single track in cm"}; - Configurable cfg_max_dca3dsigma_track{"cfg_max_dca3dsigma_track", 1.5, "max DCA 3D in sigma"}; - Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; - Configurable cfg_apply_cuts_from_prefilter_derived{"cfg_apply_cuts_from_prefilter_derived", false, "flag to apply prefilter to electron"}; - Configurable includeITSsa{"includeITSsa", false, "Flag to enable ITSsa tracks"}; - Configurable cfg_max_pt_track_ITSsa{"cfg_max_pt_track_ITSsa", 0.15, "max pt for ITSsa tracks"}; - - Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DalitzEECut::PIDSchemes::kTOFif), "pid scheme [kTOFif : 0, kTPConly : 1]"}; - Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; - Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +3.0, "max. TPC n sigma for electron inclusion"}; - Configurable cfg_min_TPCNsigmaPi{"cfg_min_TPCNsigmaPi", -0.0, "min. TPC n sigma for pion exclusion"}; - Configurable cfg_max_TPCNsigmaPi{"cfg_max_TPCNsigmaPi", +0.0, "max. TPC n sigma for pion exclusion"}; - Configurable cfg_min_TOFNsigmaEl{"cfg_min_TOFNsigmaEl", -3.0, "min. TOF n sigma for electron inclusion"}; - Configurable cfg_max_TOFNsigmaEl{"cfg_max_TOFNsigmaEl", +3.0, "max. TOF n sigma for electron inclusion"}; + o2::framework::Configurable cfg_min_mass{"cfg_min_mass", 0.0, "min mass"}; + o2::framework::Configurable cfg_max_mass{"cfg_max_mass", 0.1, "max mass"}; + o2::framework::Configurable cfg_apply_phiv{"cfg_apply_phiv", true, "flag to apply phiv cut"}; + o2::framework::Configurable cfg_require_itsib_any{"cfg_require_itsib_any", false, "flag to require ITS ib any hits"}; + o2::framework::Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", true, "flag to require ITS ib 1st hit"}; + o2::framework::Configurable cfg_phiv_slope{"cfg_phiv_slope", 0.0185, "slope for m vs. phiv"}; + o2::framework::Configurable cfg_phiv_intercept{"cfg_phiv_intercept", -0.0280, "intercept for m vs. phiv"}; + + o2::framework::Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.1, "min pT for single track"}; + o2::framework::Configurable cfg_max_eta_track{"cfg_max_eta_track", 0.8, "max eta for single track"}; + o2::framework::Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; + o2::framework::Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 5, "min ncluster its"}; + o2::framework::Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 70, "min ncrossed rows"}; + o2::framework::Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; + o2::framework::Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; + o2::framework::Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 0.05, "max dca XY for single track in cm"}; + o2::framework::Configurable cfg_max_dcaz{"cfg_max_dcaz", 0.05, "max dca Z for single track in cm"}; + o2::framework::Configurable cfg_max_dca3dsigma_track{"cfg_max_dca3dsigma_track", 1.5, "max DCA 3D in sigma"}; + o2::framework::Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; + o2::framework::Configurable cfg_apply_cuts_from_prefilter_derived{"cfg_apply_cuts_from_prefilter_derived", false, "flag to apply prefilter to electron"}; + o2::framework::Configurable includeITSsa{"includeITSsa", false, "Flag to enable ITSsa tracks"}; + o2::framework::Configurable cfg_max_pt_track_ITSsa{"cfg_max_pt_track_ITSsa", 0.15, "max pt for ITSsa tracks"}; + + o2::framework::Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DalitzEECut::PIDSchemes::kTOFif), "pid scheme [kTOFif : 0, kTPConly : 1]"}; + o2::framework::Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; + o2::framework::Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +3.0, "max. TPC n sigma for electron inclusion"}; + o2::framework::Configurable cfg_min_TPCNsigmaPi{"cfg_min_TPCNsigmaPi", -0.0, "min. TPC n sigma for pion exclusion"}; + o2::framework::Configurable cfg_max_TPCNsigmaPi{"cfg_max_TPCNsigmaPi", +0.0, "max. TPC n sigma for pion exclusion"}; + o2::framework::Configurable cfg_min_TOFNsigmaEl{"cfg_min_TOFNsigmaEl", -3.0, "min. TOF n sigma for electron inclusion"}; + o2::framework::Configurable cfg_max_TOFNsigmaEl{"cfg_max_TOFNsigmaEl", +3.0, "max. TOF n sigma for electron inclusion"}; } dileptoncuts; EMCPhotonCut fEMCCut; - struct : ConfigurableGroup { + struct : o2::framework::ConfigurableGroup { std::string prefix = "emccut_group"; - Configurable clusterDefinition{"clusterDefinition", "kV3Default", "Clusterizer to be selected, e.g. V3Default"}; - Configurable minOpenAngle{"minOpenAngle", 0.0202, "apply min opening angle"}; - Configurable EMC_minTime{"EMC_minTime", -20., "Minimum cluster time for EMCal time cut"}; - Configurable EMC_maxTime{"EMC_maxTime", +25., "Maximum cluster time for EMCal time cut"}; - Configurable EMC_minM02{"EMC_minM02", 0.1, "Minimum M02 for EMCal M02 cut"}; - Configurable EMC_maxM02{"EMC_maxM02", 0.7, "Maximum M02 for EMCal M02 cut"}; - Configurable EMC_minE{"EMC_minE", 0.7, "Minimum cluster energy for EMCal energy cut"}; - Configurable EMC_minNCell{"EMC_minNCell", 1, "Minimum number of cells per cluster for EMCal NCell cut"}; - Configurable> EMC_TM_Eta{"EMC_TM_Eta", {0.01f, 4.07f, -2.5f}, "|eta| <= [0]+(pT+[1])^[2] for EMCal track matching"}; - Configurable> EMC_TM_Phi{"EMC_TM_Phi", {0.015f, 3.65f, -2.f}, "|phi| <= [0]+(pT+[1])^[2] for EMCal track matching"}; - Configurable EMC_Eoverp{"EMC_Eoverp", 1.75, "Minimum cluster energy over track momentum for EMCal track matching"}; - Configurable EMC_UseExoticCut{"EMC_UseExoticCut", true, "FLag to use the EMCal exotic cluster cut"}; - Configurable cfgDistanceToEdge{"cfgDistanceToEdge", 1, "Distance to edge in cells required for rotated cluster to be accepted"}; + o2::framework::Configurable clusterDefinition{"clusterDefinition", "kV3Default", "Clusterizer to be selected, e.g. V3Default"}; + o2::framework::Configurable minOpenAngle{"minOpenAngle", 0.0202, "apply min opening angle"}; + o2::framework::Configurable EMC_minTime{"EMC_minTime", -20., "Minimum cluster time for EMCal time cut"}; + o2::framework::Configurable EMC_maxTime{"EMC_maxTime", +25., "Maximum cluster time for EMCal time cut"}; + o2::framework::Configurable EMC_minM02{"EMC_minM02", 0.1, "Minimum M02 for EMCal M02 cut"}; + o2::framework::Configurable EMC_maxM02{"EMC_maxM02", 0.7, "Maximum M02 for EMCal M02 cut"}; + o2::framework::Configurable EMC_minE{"EMC_minE", 0.7, "Minimum cluster energy for EMCal energy cut"}; + o2::framework::Configurable EMC_minNCell{"EMC_minNCell", 1, "Minimum number of cells per cluster for EMCal NCell cut"}; + o2::framework::Configurable> EMC_TM_Eta{"EMC_TM_Eta", {0.01f, 4.07f, -2.5f}, "|eta| <= [0]+(pT+[1])^[2] for EMCal track matching"}; + o2::framework::Configurable> EMC_TM_Phi{"EMC_TM_Phi", {0.015f, 3.65f, -2.f}, "|phi| <= [0]+(pT+[1])^[2] for EMCal track matching"}; + o2::framework::Configurable EMC_Eoverp{"EMC_Eoverp", 1.75, "Minimum cluster energy over track momentum for EMCal track matching"}; + o2::framework::Configurable EMC_UseExoticCut{"EMC_UseExoticCut", true, "FLag to use the EMCal exotic cluster cut"}; + o2::framework::Configurable cfgDistanceToEdge{"cfgDistanceToEdge", 1, "Distance to edge in cells required for rotated cluster to be accepted"}; } emccuts; PHOSPhotonCut fPHOSCut; - struct : ConfigurableGroup { + struct : o2::framework::ConfigurableGroup { std::string prefix = "phoscut_group"; - Configurable cfg_min_Ecluster{"cfg_min_Ecluster", 0.3, "Minimum cluster energy for PHOS in GeV"}; + o2::framework::Configurable cfg_min_Ecluster{"cfg_min_Ecluster", 0.3, "Minimum cluster energy for PHOS in GeV"}; } phoscuts; - HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; - static constexpr std::string_view event_types[2] = {"before/", "after/"}; - static constexpr std::string_view event_pair_types[2] = {"same/", "mix/"}; + o2::framework::HistogramRegistry fRegistry{"output", {}, o2::framework::OutputObjHandlingPolicy::AnalysisObject, false, false}; + // static constexpr std::string_view event_types[2] = {"before/", "after/"}; + // static constexpr std::string_view event_pair_types[2] = {"same/", "mix/"}; std::vector zvtx_bin_edges; std::vector cent_bin_edges; @@ -232,12 +213,12 @@ struct Pi0EtaToGammaGamma { std::vector occ_bin_edges; o2::ccdb::CcdbApi ccdbApi; - Service ccdb; + o2::framework::Service ccdb; int mRunNumber; float d_bz; o2::emcal::Geometry* emcalGeom; - void init(InitContext&) + void init(o2::framework::InitContext&) { zvtx_bin_edges = std::vector(ConfVtxBins.value.begin(), ConfVtxBins.value.end()); zvtx_bin_edges.erase(zvtx_bin_edges.begin()); @@ -252,11 +233,11 @@ struct Pi0EtaToGammaGamma { occ_bin_edges = std::vector(ConfOccupancyBins.value.begin(), ConfOccupancyBins.value.end()); occ_bin_edges.erase(occ_bin_edges.begin()); - emh1 = new MyEMH(ndepth); - emh2 = new MyEMH(ndepth); + emh1 = new o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, o2::aod::pwgem::dilepton::utils::EMTrack>(ndepth); + emh2 = new o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, o2::aod::pwgem::dilepton::utils::EMTrack>(ndepth); o2::aod::pwgem::photonmeson::utils::eventhistogram::addEventHistograms(&fRegistry); - if constexpr (pairtype == PairType::kPCMDalitzEE) { + if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMDalitzEE) { o2::aod::pwgem::photonmeson::utils::nmhistogram::addNMHistograms(&fRegistry, false, "ee#gamma"); } else { o2::aod::pwgem::photonmeson::utils::nmhistogram::addNMHistograms(&fRegistry, false, "#gamma#gamma"); @@ -267,11 +248,11 @@ struct Pi0EtaToGammaGamma { DefineEMCCut(); DefinePHOSCut(); - if constexpr (pairtype == kEMCEMC) { + if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kEMCEMC) { fRegistry.addClone("Pair/same/", "Pair/rotation/"); emcalGeom = o2::emcal::Geometry::GetInstanceFromRunNumber(300000); } - fRegistry.add("Pair/mix/hDiffBC", "diff. global BC in mixed event;|BC_{current} - BC_{mixed}|", kTH1D, {{10001, -0.5, 10000.5}}, true); + fRegistry.add("Pair/mix/hDiffBC", "diff. global BC in mixed event;|BC_{current} - BC_{mixed}|", o2::framework::kTH1D, {{10001, -0.5, 10000.5}}, true); mRunNumber = 0; d_bz = 0; @@ -489,7 +470,7 @@ struct Pi0EtaToGammaGamma { if (photons_coll.size() < 3) { return; } - const float rotationAngle = M_PI / 2.0; // rotaion angle 90 degree + const float rotationAngle = o2::constants::math::PIHalf; // rotaion angle 90 degree ROOT::Math::AxisAngle rotationAxis(meson.Vect(), rotationAngle); ROOT::Math::Rotation3D rotationMatrix(rotationAxis); photon1 = rotationMatrix * photon1; @@ -523,7 +504,7 @@ struct Pi0EtaToGammaGamma { // only combine rotated photons with other photons continue; } - if (!(fEMCCut.IsSelected(photon))) { + if (!(fEMCCut.IsSelected::iterator>(photon))) { continue; } @@ -544,18 +525,18 @@ struct Pi0EtaToGammaGamma { return; } - SliceCache cache; - Preslice perCollision_pcm = aod::v0photonkf::emeventId; - Preslice perCollision_emc = aod::emccluster::emeventId; - Preslice perCollision_phos = aod::phoscluster::emeventId; + o2::framework::SliceCache cache; + o2::framework::Preslice>> perCollision_pcm = o2::aod::v0photonkf::emeventId; + o2::framework::Preslice> perCollision_emc = o2::aod::emccluster::emeventId; + o2::framework::Preslice> perCollision_phos = o2::aod::phoscluster::emeventId; - Preslice perCollision_electron = aod::emprimaryelectron::emeventId; - Partition positrons = o2::aod::emprimaryelectron::sign > int8_t(0) && dileptoncuts.cfg_min_pt_track < o2::aod::track::pt&& nabs(o2::aod::track::eta) < dileptoncuts.cfg_max_eta_track; - Partition electrons = o2::aod::emprimaryelectron::sign < int8_t(0) && dileptoncuts.cfg_min_pt_track < o2::aod::track::pt && nabs(o2::aod::track::eta) < dileptoncuts.cfg_max_eta_track; + o2::framework::Preslice>> perCollision_electron = o2::aod::emprimaryelectron::emeventId; + o2::framework::Partition>> positrons = o2::aod::emprimaryelectron::sign > int8_t(0) && dileptoncuts.cfg_min_pt_track < o2::aod::track::pt&& nabs(o2::aod::track::eta) < dileptoncuts.cfg_max_eta_track; + o2::framework::Partition>> electrons = o2::aod::emprimaryelectron::sign < int8_t(0) && dileptoncuts.cfg_min_pt_track < o2::aod::track::pt && nabs(o2::aod::track::eta) < dileptoncuts.cfg_max_eta_track; - using MyEMH = o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, EMTrack>; - MyEMH* emh1 = nullptr; - MyEMH* emh2 = nullptr; + // using MyEMH = o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, o2::aod::pwgem::dilepton::utils::EMTrack>; + o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, o2::aod::pwgem::dilepton::utils::EMTrack>* emh1 = nullptr; + o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, o2::aod::pwgem::dilepton::utils::EMTrack>* emh2 = nullptr; std::vector> used_photonIds; // std::vector> used_dileptonIds; // std::map, uint64_t> map_mixed_eventId_to_globalBC; @@ -570,12 +551,12 @@ struct Pi0EtaToGammaGamma { for (const auto& collision : collisions) { initCCDB(collision); int ndiphoton = 0; - if ((pairtype == PairType::kPHOSPHOS || pairtype == PairType::kPCMPHOS) && !collision.alias_bit(triggerAliases::kTVXinPHOS)) { + if ((pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPHOSPHOS || pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMPHOS) && !collision.alias_bit(triggerAliases::kTVXinPHOS)) { continue; } float weight = 1.f; - if constexpr (std::is_same_v, FilteredMyCollisionsWithJJMC>) { + if constexpr (std::is_same_v, o2::soa::Filtered, o2::aod::EMEventsWeight>>>) { weight = collision.weight(); } @@ -639,11 +620,11 @@ struct Pi0EtaToGammaGamma { std::tuple key_bin = std::make_tuple(zbin, centbin, epbin, occbin); std::pair key_df_collision = std::make_pair(ndf, collision.globalIndex()); - if constexpr (pairtype == PairType::kPCMPCM || pairtype == PairType::kPHOSPHOS || pairtype == PairType::kEMCEMC) { // same kinds pairing + if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMPCM || pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPHOSPHOS || pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kEMCEMC) { // same kinds pairing auto photons1_per_collision = photons1.sliceBy(perCollision1, collision.globalIndex()); auto photons2_per_collision = photons2.sliceBy(perCollision2, collision.globalIndex()); - for (const auto& [g1, g2] : combinations(CombinationsStrictlyUpperIndexPolicy(photons1_per_collision, photons2_per_collision))) { + for (const auto& [g1, g2] : o2::soa::combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(photons1_per_collision, photons2_per_collision))) { if (!cut1.template IsSelected(g1) || !cut2.template IsSelected(g2)) { continue; } @@ -655,7 +636,7 @@ struct Pi0EtaToGammaGamma { continue; } - if (pairtype == PairType::kEMCEMC) { + if (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kEMCEMC) { float openingAngle = std::acos(v1.Vect().Dot(v2.Vect()) / (v1.P() * v2.P())); if (openingAngle < emccuts.minOpenAngle) { continue; @@ -664,24 +645,24 @@ struct Pi0EtaToGammaGamma { fRegistry.fill(HIST("Pair/same/hs"), v12.M(), v12.Pt(), weight); - if constexpr (pairtype == PairType::kEMCEMC) { - RotationBackground(v12, v1, v2, photons2_per_collision, g1.globalIndex(), g2.globalIndex(), weight); + if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kEMCEMC) { + RotationBackground>(v12, v1, v2, photons2_per_collision, g1.globalIndex(), g2.globalIndex(), weight); } std::pair pair_tmp_id1 = std::make_pair(ndf, g1.globalIndex()); std::pair pair_tmp_id2 = std::make_pair(ndf, g2.globalIndex()); if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id1) == used_photonIds.end()) { - emh1->AddTrackToEventPool(key_df_collision, EMTrack(-1, g1.globalIndex(), collision.globalIndex(), g1.globalIndex(), g1.pt(), g1.eta(), g1.phi(), 0)); + emh1->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(-1, g1.globalIndex(), collision.globalIndex(), g1.globalIndex(), g1.pt(), g1.eta(), g1.phi(), 0)); used_photonIds.emplace_back(pair_tmp_id1); } if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id2) == used_photonIds.end()) { - emh1->AddTrackToEventPool(key_df_collision, EMTrack(-1, g2.globalIndex(), collision.globalIndex(), g2.globalIndex(), g2.pt(), g2.eta(), g2.phi(), 0)); + emh1->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(-1, g2.globalIndex(), collision.globalIndex(), g2.globalIndex(), g2.pt(), g2.eta(), g2.phi(), 0)); used_photonIds.emplace_back(pair_tmp_id2); } ndiphoton++; } // end of pairing loop - } else if constexpr (pairtype == PairType::kPCMDalitzEE) { + } else if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMDalitzEE) { auto photons1_per_collision = photons1.sliceBy(perCollision1, collision.globalIndex()); auto positrons_per_collision = positrons->sliceByCached(o2::aod::emprimaryelectron::emeventId, collision.globalIndex(), cache); auto electrons_per_collision = electrons->sliceByCached(o2::aod::emprimaryelectron::emeventId, collision.globalIndex(), cache); @@ -694,7 +675,7 @@ struct Pi0EtaToGammaGamma { auto ele1 = g1.template negTrack_as(); ROOT::Math::PtEtaPhiMVector v_gamma(g1.pt(), g1.eta(), g1.phi(), 0.); - for (const auto& [pos2, ele2] : combinations(CombinationsFullIndexPolicy(positrons_per_collision, electrons_per_collision))) { + for (const auto& [pos2, ele2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(positrons_per_collision, electrons_per_collision))) { if (pos2.trackId() == ele2.trackId()) { // this is protection against pairing identical 2 tracks. continue; @@ -724,11 +705,11 @@ struct Pi0EtaToGammaGamma { std::pair pair_tmp_id1 = std::make_pair(ndf, g1.globalIndex()); std::tuple tuple_tmp_id2 = std::make_tuple(ndf, collision.globalIndex(), pos2.trackId(), ele2.trackId()); if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id1) == used_photonIds.end()) { - emh1->AddTrackToEventPool(key_df_collision, EMTrack(-1, g1.globalIndex(), collision.globalIndex(), -1, g1.pt(), g1.eta(), g1.phi(), 0)); + emh1->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(-1, g1.globalIndex(), collision.globalIndex(), -1, g1.pt(), g1.eta(), g1.phi(), 0)); used_photonIds.emplace_back(pair_tmp_id1); } if (std::find(used_dileptonIds.begin(), used_dileptonIds.end(), tuple_tmp_id2) == used_dileptonIds.end()) { - emh2->AddTrackToEventPool(key_df_collision, EMTrack(-1, -1, collision.globalIndex(), -1, v_ee.Pt(), v_ee.Eta(), v_ee.Phi(), v_ee.M())); + emh2->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(-1, -1, collision.globalIndex(), -1, v_ee.Pt(), v_ee.Eta(), v_ee.Phi(), v_ee.M())); used_dileptonIds.emplace_back(tuple_tmp_id2); } ndiphoton++; @@ -738,7 +719,7 @@ struct Pi0EtaToGammaGamma { auto photons1_per_collision = photons1.sliceBy(perCollision1, collision.globalIndex()); auto photons2_per_collision = photons2.sliceBy(perCollision2, collision.globalIndex()); - for (const auto& [g1, g2] : combinations(CombinationsFullIndexPolicy(photons1_per_collision, photons2_per_collision))) { + for (const auto& [g1, g2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(photons1_per_collision, photons2_per_collision))) { if (!cut1.template IsSelected(g1) || !cut2.template IsSelected(g2)) { continue; } @@ -755,11 +736,11 @@ struct Pi0EtaToGammaGamma { std::pair pair_tmp_id2 = std::make_pair(ndf, g2.globalIndex()); if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id1) == used_photonIds.end()) { - emh1->AddTrackToEventPool(key_df_collision, EMTrack(-1, g1.globalIndex(), collision.globalIndex(), -1, g1.pt(), g1.eta(), g1.phi(), 0)); + emh1->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(-1, g1.globalIndex(), collision.globalIndex(), -1, g1.pt(), g1.eta(), g1.phi(), 0)); used_photonIds.emplace_back(pair_tmp_id1); } if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id2) == used_photonIds.end()) { - emh2->AddTrackToEventPool(key_df_collision, EMTrack(-1, g2.globalIndex(), collision.globalIndex(), -1, g2.pt(), g2.eta(), g2.phi(), 0)); + emh2->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(-1, g2.globalIndex(), collision.globalIndex(), -1, g2.pt(), g2.eta(), g2.phi(), 0)); used_photonIds.emplace_back(pair_tmp_id2); } ndiphoton++; @@ -778,7 +759,7 @@ struct Pi0EtaToGammaGamma { auto collisionIds1_in_mixing_pool = emh1->GetCollisionIdsFromEventPool(key_bin); auto collisionIds2_in_mixing_pool = emh2->GetCollisionIdsFromEventPool(key_bin); - if constexpr (pairtype == PairType::kPCMPCM || pairtype == PairType::kPHOSPHOS || pairtype == PairType::kEMCEMC) { // same kinds pairing + if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMPCM || pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPHOSPHOS || pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kEMCEMC) { // same kinds pairing for (const auto& mix_dfId_collisionId : collisionIds1_in_mixing_pool) { int mix_dfId = mix_dfId_collisionId.first; int64_t mix_collisionId = mix_dfId_collisionId.second; @@ -834,7 +815,7 @@ struct Pi0EtaToGammaGamma { for (const auto& g2 : photons2_from_event_pool) { ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); - if constexpr (pairtype == PairType::kPCMDalitzEE) { //[photon from event1, dilepton from event2] and [photon from event2, dilepton from event1] + if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMDalitzEE) { //[photon from event1, dilepton from event2] and [photon from event2, dilepton from event1] v2.SetM(g2.mass()); } ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; @@ -867,7 +848,7 @@ struct Pi0EtaToGammaGamma { for (const auto& g2 : photons1_from_event_pool) { ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); - if constexpr (pairtype == PairType::kPCMDalitzEE) { //[photon from event1, dilepton from event2] and [photon from event2, dilepton from event1] + if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMDalitzEE) { //[photon from event1, dilepton from event2] and [photon from event2, dilepton from event1] v1.SetM(g1.mass()); } ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; @@ -889,32 +870,32 @@ struct Pi0EtaToGammaGamma { } // end of collision loop } - Filter collisionFilter_occupancy_track = eventcuts.cfgTrackOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgTrackOccupancyMax; - Filter collisionFilter_occupancy_ft0c = eventcuts.cfgFT0COccupancyMin <= o2::aod::evsel::ft0cOccupancyInTimeRange && o2::aod::evsel::ft0cOccupancyInTimeRange < eventcuts.cfgFT0COccupancyMax; - Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); - using FilteredMyCollisions = soa::Filtered; + o2::framework::expressions::Filter collisionFilter_occupancy_track = eventcuts.cfgTrackOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgTrackOccupancyMax; + o2::framework::expressions::Filter collisionFilter_occupancy_ft0c = eventcuts.cfgFT0COccupancyMin <= o2::aod::evsel::ft0cOccupancyInTimeRange && o2::aod::evsel::ft0cOccupancyInTimeRange < eventcuts.cfgFT0COccupancyMax; + o2::framework::expressions::Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); + // using FilteredMyCollisions = o2::soa::Filtered>; - Filter prefilter_pcm = ifnode(pcmcuts.cfg_apply_cuts_from_prefilter_derived.node(), o2::aod::v0photonkf::pfbderived == static_cast(0), true); - Filter prefilter_primaryelectron = ifnode(dileptoncuts.cfg_apply_cuts_from_prefilter_derived.node(), o2::aod::emprimaryelectron::pfbderived == static_cast(0), true); + o2::framework::expressions::Filter prefilter_pcm = ifnode(pcmcuts.cfg_apply_cuts_from_prefilter_derived.node(), o2::aod::v0photonkf::pfbderived == static_cast(0), true); + o2::framework::expressions::Filter prefilter_primaryelectron = ifnode(dileptoncuts.cfg_apply_cuts_from_prefilter_derived.node(), o2::aod::emprimaryelectron::pfbderived == static_cast(0), true); int ndf = 0; - void processAnalysis(FilteredMyCollisions const& collisions, Types const&... args) + void processAnalysis(o2::soa::Filtered> const& collisions, Types const&... args) { // LOGF(info, "ndf = %d", ndf); - if constexpr (pairtype == PairType::kPCMPCM) { + if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMPCM) { auto v0photons = std::get<0>(std::tie(args...)); auto v0legs = std::get<1>(std::tie(args...)); runPairing(collisions, v0photons, v0photons, v0legs, v0legs, perCollision_pcm, perCollision_pcm, fV0PhotonCut, fV0PhotonCut); - } else if constexpr (pairtype == PairType::kPCMDalitzEE) { + } else if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMDalitzEE) { auto v0photons = std::get<0>(std::tie(args...)); auto v0legs = std::get<1>(std::tie(args...)); auto emprimaryelectrons = std::get<2>(std::tie(args...)); // LOGF(info, "electrons.size() = %d, positrons.size() = %d", electrons.size(), positrons.size()); runPairing(collisions, v0photons, emprimaryelectrons, v0legs, emprimaryelectrons, perCollision_pcm, perCollision_electron, fV0PhotonCut, fDileptonCut); - } else if constexpr (pairtype == PairType::kEMCEMC) { + } else if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kEMCEMC) { auto emcclusters = std::get<0>(std::tie(args...)); runPairing(collisions, emcclusters, emcclusters, nullptr, nullptr, perCollision_emc, perCollision_emc, fEMCCut, fEMCCut); - } else if constexpr (pairtype == PairType::kPHOSPHOS) { + } else if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPHOSPHOS) { auto phosclusters = std::get<0>(std::tie(args...)); runPairing(collisions, phosclusters, phosclusters, nullptr, nullptr, perCollision_phos, perCollision_phos, fPHOSCut, fPHOSCut); } @@ -934,24 +915,24 @@ struct Pi0EtaToGammaGamma { } PROCESS_SWITCH(Pi0EtaToGammaGamma, processAnalysis, "process pair analysis", true); - using FilteredMyCollisionsWithJJMC = soa::Filtered; - void processAnalysisJJMC(FilteredMyCollisionsWithJJMC const& collisions, Types const&... args) + // using FilteredMyCollisionsWithJJMC = o2::soa::Filtered, o2::aod::EMEventsWeight>>; + void processAnalysisJJMC(o2::soa::Filtered, o2::aod::EMEventsWeight>> const& collisions, Types const&... args) { // LOGF(info, "ndf = %d", ndf); - if constexpr (pairtype == PairType::kPCMPCM) { + if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMPCM) { auto v0photons = std::get<0>(std::tie(args...)); auto v0legs = std::get<1>(std::tie(args...)); runPairing(collisions, v0photons, v0photons, v0legs, v0legs, perCollision_pcm, perCollision_pcm, fV0PhotonCut, fV0PhotonCut); - } else if constexpr (pairtype == PairType::kPCMDalitzEE) { + } else if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMDalitzEE) { auto v0photons = std::get<0>(std::tie(args...)); auto v0legs = std::get<1>(std::tie(args...)); auto emprimaryelectrons = std::get<2>(std::tie(args...)); // LOGF(info, "electrons.size() = %d, positrons.size() = %d", electrons.size(), positrons.size()); runPairing(collisions, v0photons, emprimaryelectrons, v0legs, emprimaryelectrons, perCollision_pcm, perCollision_electron, fV0PhotonCut, fDileptonCut); - } else if constexpr (pairtype == PairType::kEMCEMC) { + } else if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kEMCEMC) { auto emcclusters = std::get<0>(std::tie(args...)); runPairing(collisions, emcclusters, emcclusters, nullptr, nullptr, perCollision_emc, perCollision_emc, fEMCCut, fEMCCut); - } else if constexpr (pairtype == PairType::kPHOSPHOS) { + } else if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPHOSPHOS) { auto phosclusters = std::get<0>(std::tie(args...)); runPairing(collisions, phosclusters, phosclusters, nullptr, nullptr, perCollision_phos, perCollision_phos, fPHOSCut, fPHOSCut); } @@ -971,7 +952,7 @@ struct Pi0EtaToGammaGamma { } PROCESS_SWITCH(Pi0EtaToGammaGamma, processAnalysisJJMC, "process pair analysis", false); - void processDummy(MyCollisions const&) {} + void processDummy(o2::aod::EMEvents const&) {} PROCESS_SWITCH(Pi0EtaToGammaGamma, processDummy, "Dummy function", false); }; #endif // PWGEM_PHOTONMESON_CORE_PI0ETATOGAMMAGAMMA_H_ diff --git a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h index 16cd3054172..674e663e03c 100644 --- a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h +++ b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h @@ -9,15 +9,13 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // -// ======================== -// -// This code loops over photons and makes pairs for neutral mesons analyses. -// Please write to: daiki.sekihata@cern.ch +/// \file Pi0EtaToGammaGammaMC.h +/// \brief This code loops over photons and makes pairs for neutral mesons analyses with MC true info. +/// \author D. Sekihata, daiki.sekihata@cern.ch #ifndef PWGEM_PHOTONMESON_CORE_PI0ETATOGAMMAGAMMAMC_H_ #define PWGEM_PHOTONMESON_CORE_PI0ETATOGAMMAGAMMAMC_H_ -#include "PWGEM/Dilepton/Utils/MCUtilities.h" #include "PWGEM/PhotonMeson/Core/DalitzEECut.h" #include "PWGEM/PhotonMeson/Core/EMCPhotonCut.h" #include "PWGEM/PhotonMeson/Core/EMPhotonEventCut.h" @@ -28,204 +26,187 @@ #include "PWGEM/PhotonMeson/Utils/MCUtilities.h" #include "PWGEM/PhotonMeson/Utils/NMHistograms.h" #include "PWGEM/PhotonMeson/Utils/PairUtilities.h" +// Dilepton headers +#include "PWGEM/Dilepton/Utils/MCUtilities.h" -#include "Common/Core/RecoDecay.h" - -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DetectorsBase/GeometryManager.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" - -#include "Math/Vector4D.h" -#include "TF1.h" -#include "TString.h" - -#include +#include "Common/CCDB/TriggerAliases.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include // IWYU pragma: keep +#include +#include +#include +#include + +#include +#include #include +#include +#include #include -using namespace o2; -using namespace o2::aod; -using namespace o2::framework; -using namespace o2::framework::expressions; -using namespace o2::soa; -using namespace o2::aod::pwgem::photonmeson::photonpair; -using namespace o2::aod::pwgem::photonmeson::utils::mcutil; -using namespace o2::aod::pwgem::dilepton::utils::mcutil; - -using MyCollisions = soa::Join; -using MyCollision = MyCollisions::iterator; - -using MyCollisionsWithJJMC = soa::Join; -using MyCollisionWithJJMC = MyCollisionsWithJJMC::iterator; - -using MyMCCollisions = soa::Join; -using MyMCCollision = MyMCCollisions::iterator; - -using MyV0Photons = soa::Filtered>; -using MyV0Photon = MyV0Photons::iterator; - -using MyEMCClusters = soa::Join; -using MyEMCCluster = MyEMCClusters::iterator; - -using MyPHOSClusters = soa::Join; -using MyPHOSCluster = MyEMCClusters::iterator; - -using MyMCV0Legs = soa::Join; -using MyMCV0Leg = MyMCV0Legs::iterator; - -using MyMCElectrons = soa::Filtered>; -using MyMCElectron = MyMCElectrons::iterator; - -template +template struct Pi0EtaToGammaGammaMC { - Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; - Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; - Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; - Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; - - Configurable cfgQvecEstimator{"cfgQvecEstimator", 0, "FT0M:0, FT0A:1, FT0C:2"}; - Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; - Configurable cfgCentMin{"cfgCentMin", -1, "min. centrality"}; - Configurable cfgCentMax{"cfgCentMax", 999, "max. centrality"}; - Configurable maxY_rec{"maxY_rec", 0.9, "maximum rapidity for reconstructed particles"}; - Configurable fd_k0s_to_pi0{"fd_k0s_pi0", "1.0", "feed down correction to pi0"}; - Configurable cfgRequireTrueAssociation{"cfgRequireTrueAssociation", false, "flag to require true mc collision association"}; + o2::framework::Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + o2::framework::Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; + o2::framework::Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + o2::framework::Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; + o2::framework::Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; + + o2::framework::Configurable cfgQvecEstimator{"cfgQvecEstimator", 0, "FT0M:0, FT0A:1, FT0C:2"}; + o2::framework::Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; + o2::framework::Configurable cfgCentMin{"cfgCentMin", -1, "min. centrality"}; + o2::framework::Configurable cfgCentMax{"cfgCentMax", 999, "max. centrality"}; + o2::framework::Configurable maxY_rec{"maxY_rec", 0.9, "maximum rapidity for reconstructed particles"}; + o2::framework::Configurable fd_k0s_to_pi0{"fd_k0s_pi0", "1.0", "feed down correction to pi0"}; + o2::framework::Configurable cfgRequireTrueAssociation{"cfgRequireTrueAssociation", false, "flag to require true mc collision association"}; EMPhotonEventCut fEMEventCut; - struct : ConfigurableGroup { + struct : o2::framework::ConfigurableGroup { std::string prefix = "eventcut_group"; - Configurable cfgZvtxMin{"cfgZvtxMin", -10.f, "min. Zvtx"}; - Configurable cfgZvtxMax{"cfgZvtxMax", +10.f, "max. Zvtx"}; - Configurable cfgRequireSel8{"cfgRequireSel8", false, "require sel8 in event cut"}; - Configurable cfgRequireFT0AND{"cfgRequireFT0AND", true, "require FT0AND in event cut"}; - Configurable cfgRequireNoTFB{"cfgRequireNoTFB", true, "require No time frame border in event cut"}; - Configurable cfgRequireNoITSROFB{"cfgRequireNoITSROFB", false, "require no ITS readout frame border in event cut"}; - Configurable cfgRequireNoSameBunchPileup{"cfgRequireNoSameBunchPileup", false, "require no same bunch pileup in event cut"}; - Configurable cfgRequireVertexITSTPC{"cfgRequireVertexITSTPC", false, "require Vertex ITSTPC in event cut"}; // ITS-TPC matched track contributes PV. - Configurable cfgRequireGoodZvtxFT0vsPV{"cfgRequireGoodZvtxFT0vsPV", false, "require good Zvtx between FT0 vs. PV in event cut"}; - Configurable cfgRequireEMCReadoutInMB{"cfgRequireEMCReadoutInMB", false, "require the EMC to be read out in an MB collision (kTVXinEMC)"}; - Configurable cfgRequireEMCHardwareTriggered{"cfgRequireEMCHardwareTriggered", false, "require the EMC to be hardware triggered (kEMC7 or kDMC7)"}; - Configurable cfgTrackOccupancyMin{"cfgTrackOccupancyMin", -2, "min. occupancy"}; - Configurable cfgTrackOccupancyMax{"cfgTrackOccupancyMax", 1000000000, "max. occupancy"}; - Configurable cfgFT0COccupancyMin{"cfgFT0COccupancyMin", -2, "min. FT0C occupancy"}; - Configurable cfgFT0COccupancyMax{"cfgFT0COccupancyMax", 1000000000, "max. FT0C occupancy"}; - Configurable onlyKeepWeightedEvents{"onlyKeepWeightedEvents", false, "flag to keep only weighted events (for JJ MCs) and remove all MB events (with weight = 1)"}; + o2::framework::Configurable cfgZvtxMin{"cfgZvtxMin", -10.f, "min. Zvtx"}; + o2::framework::Configurable cfgZvtxMax{"cfgZvtxMax", +10.f, "max. Zvtx"}; + o2::framework::Configurable cfgRequireSel8{"cfgRequireSel8", false, "require sel8 in event cut"}; + o2::framework::Configurable cfgRequireFT0AND{"cfgRequireFT0AND", true, "require FT0AND in event cut"}; + o2::framework::Configurable cfgRequireNoTFB{"cfgRequireNoTFB", true, "require No time frame border in event cut"}; + o2::framework::Configurable cfgRequireNoITSROFB{"cfgRequireNoITSROFB", false, "require no ITS readout frame border in event cut"}; + o2::framework::Configurable cfgRequireNoSameBunchPileup{"cfgRequireNoSameBunchPileup", false, "require no same bunch pileup in event cut"}; + o2::framework::Configurable cfgRequireVertexITSTPC{"cfgRequireVertexITSTPC", false, "require Vertex ITSTPC in event cut"}; // ITS-TPC matched track contributes PV. + o2::framework::Configurable cfgRequireGoodZvtxFT0vsPV{"cfgRequireGoodZvtxFT0vsPV", false, "require good Zvtx between FT0 vs. PV in event cut"}; + o2::framework::Configurable cfgRequireEMCReadoutInMB{"cfgRequireEMCReadoutInMB", false, "require the EMC to be read out in an MB collision (kTVXinEMC)"}; + o2::framework::Configurable cfgRequireEMCHardwareTriggered{"cfgRequireEMCHardwareTriggered", false, "require the EMC to be hardware triggered (kEMC7 or kDMC7)"}; + o2::framework::Configurable cfgTrackOccupancyMin{"cfgTrackOccupancyMin", -2, "min. occupancy"}; + o2::framework::Configurable cfgTrackOccupancyMax{"cfgTrackOccupancyMax", 1000000000, "max. occupancy"}; + o2::framework::Configurable cfgFT0COccupancyMin{"cfgFT0COccupancyMin", -2, "min. FT0C occupancy"}; + o2::framework::Configurable cfgFT0COccupancyMax{"cfgFT0COccupancyMax", 1000000000, "max. FT0C occupancy"}; + o2::framework::Configurable onlyKeepWeightedEvents{"onlyKeepWeightedEvents", false, "flag to keep only weighted events (for JJ MCs) and remove all MB events (with weight = 1)"}; } eventcuts; V0PhotonCut fV0PhotonCut; - struct : ConfigurableGroup { + struct : o2::framework::ConfigurableGroup { std::string prefix = "pcmcut_group"; - Configurable cfg_require_v0_with_itstpc{"cfg_require_v0_with_itstpc", false, "flag to select V0s with ITS-TPC matched tracks"}; - Configurable cfg_require_v0_with_itsonly{"cfg_require_v0_with_itsonly", false, "flag to select V0s with ITSonly tracks"}; - Configurable cfg_require_v0_with_tpconly{"cfg_require_v0_with_tpconly", false, "flag to select V0s with TPConly tracks"}; - Configurable cfg_min_pt_v0{"cfg_min_pt_v0", 0.1, "min pT for v0 photons at PV"}; - Configurable cfg_max_pt_v0{"cfg_max_pt_v0", 1e+10, "max pT for v0 photons at PV"}; - Configurable cfg_min_eta_v0{"cfg_min_eta_v0", -0.8, "min eta for v0 photons at PV"}; - Configurable cfg_max_eta_v0{"cfg_max_eta_v0", 0.8, "max eta for v0 photons at PV"}; - Configurable cfg_min_v0radius{"cfg_min_v0radius", 4.0, "min v0 radius"}; - Configurable cfg_max_v0radius{"cfg_max_v0radius", 90.0, "max v0 radius"}; - Configurable cfg_max_alpha_ap{"cfg_max_alpha_ap", 0.95, "max alpha for AP cut"}; - Configurable cfg_max_qt_ap{"cfg_max_qt_ap", 0.01, "max qT for AP cut"}; - Configurable cfg_min_cospa{"cfg_min_cospa", 0.999, "min V0 CosPA"}; - Configurable cfg_max_pca{"cfg_max_pca", 1.5, "max distance btween 2 legs"}; - Configurable cfg_max_chi2kf{"cfg_max_chi2kf", 1e+10, "max chi2/ndf with KF"}; - Configurable cfg_reject_v0_on_itsib{"cfg_reject_v0_on_itsib", true, "flag to reject V0s on ITSib"}; - Configurable cfg_apply_cuts_from_prefilter_derived{"cfg_apply_cuts_from_prefilter_derived", false, "flag to apply prefilter to V0"}; - - Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; - Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 40, "min ncrossed rows"}; - Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; - Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; - Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; - Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -3.0, "min. TPC n sigma for electron"}; - Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +3.0, "max. TPC n sigma for electron"}; - Configurable cfg_disable_itsonly_track{"cfg_disable_itsonly_track", false, "flag to disable ITSonly tracks"}; - Configurable cfg_disable_tpconly_track{"cfg_disable_tpconly_track", false, "flag to disable TPConly tracks"}; + o2::framework::Configurable cfg_require_v0_with_itstpc{"cfg_require_v0_with_itstpc", false, "flag to select V0s with ITS-TPC matched tracks"}; + o2::framework::Configurable cfg_require_v0_with_itsonly{"cfg_require_v0_with_itsonly", false, "flag to select V0s with ITSonly tracks"}; + o2::framework::Configurable cfg_require_v0_with_tpconly{"cfg_require_v0_with_tpconly", false, "flag to select V0s with TPConly tracks"}; + o2::framework::Configurable cfg_min_pt_v0{"cfg_min_pt_v0", 0.1, "min pT for v0 photons at PV"}; + o2::framework::Configurable cfg_max_pt_v0{"cfg_max_pt_v0", 1e+10, "max pT for v0 photons at PV"}; + o2::framework::Configurable cfg_min_eta_v0{"cfg_min_eta_v0", -0.8, "min eta for v0 photons at PV"}; + o2::framework::Configurable cfg_max_eta_v0{"cfg_max_eta_v0", 0.8, "max eta for v0 photons at PV"}; + o2::framework::Configurable cfg_min_v0radius{"cfg_min_v0radius", 4.0, "min v0 radius"}; + o2::framework::Configurable cfg_max_v0radius{"cfg_max_v0radius", 90.0, "max v0 radius"}; + o2::framework::Configurable cfg_max_alpha_ap{"cfg_max_alpha_ap", 0.95, "max alpha for AP cut"}; + o2::framework::Configurable cfg_max_qt_ap{"cfg_max_qt_ap", 0.01, "max qT for AP cut"}; + o2::framework::Configurable cfg_min_cospa{"cfg_min_cospa", 0.999, "min V0 CosPA"}; + o2::framework::Configurable cfg_max_pca{"cfg_max_pca", 1.5, "max distance btween 2 legs"}; + o2::framework::Configurable cfg_max_chi2kf{"cfg_max_chi2kf", 1e+10, "max chi2/ndf with KF"}; + o2::framework::Configurable cfg_reject_v0_on_itsib{"cfg_reject_v0_on_itsib", true, "flag to reject V0s on ITSib"}; + o2::framework::Configurable cfg_apply_cuts_from_prefilter_derived{"cfg_apply_cuts_from_prefilter_derived", false, "flag to apply prefilter to V0"}; + + o2::framework::Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; + o2::framework::Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 40, "min ncrossed rows"}; + o2::framework::Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; + o2::framework::Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; + o2::framework::Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; + o2::framework::Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -3.0, "min. TPC n sigma for electron"}; + o2::framework::Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +3.0, "max. TPC n sigma for electron"}; + o2::framework::Configurable cfg_disable_itsonly_track{"cfg_disable_itsonly_track", false, "flag to disable ITSonly tracks"}; + o2::framework::Configurable cfg_disable_tpconly_track{"cfg_disable_tpconly_track", false, "flag to disable TPConly tracks"}; } pcmcuts; DalitzEECut fDileptonCut; - struct : ConfigurableGroup { + struct : o2::framework::ConfigurableGroup { std::string prefix = "dileptoncut_group"; - Configurable cfg_min_mass{"cfg_min_mass", 0.0, "min mass"}; - Configurable cfg_max_mass{"cfg_max_mass", 0.1, "max mass"}; - Configurable cfg_apply_phiv{"cfg_apply_phiv", true, "flag to apply phiv cut"}; - Configurable cfg_require_itsib_any{"cfg_require_itsib_any", false, "flag to require ITS ib any hits"}; - Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", true, "flag to require ITS ib 1st hit"}; - Configurable cfg_phiv_slope{"cfg_phiv_slope", 0.0185, "slope for m vs. phiv"}; - Configurable cfg_phiv_intercept{"cfg_phiv_intercept", -0.0280, "intercept for m vs. phiv"}; - - Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.1, "min pT for single track"}; - Configurable cfg_max_eta_track{"cfg_max_eta_track", 0.8, "max eta for single track"}; - Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; - Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 5, "min ncluster its"}; - Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 70, "min ncrossed rows"}; - Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; - Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; - Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; - Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 0.05, "max dca XY for single track in cm"}; - Configurable cfg_max_dcaz{"cfg_max_dcaz", 0.05, "max dca Z for single track in cm"}; - Configurable cfg_max_dca3dsigma_track{"cfg_max_dca3dsigma_track", 1.5, "max DCA 3D in sigma"}; - Configurable cfg_apply_cuts_from_prefilter_derived{"cfg_apply_cuts_from_prefilter_derived", false, "flag to apply prefilter to electron"}; - Configurable includeITSsa{"includeITSsa", false, "Flag to enable ITSsa tracks"}; - Configurable cfg_max_pt_track_ITSsa{"cfg_max_pt_track_ITSsa", 0.15, "max pt for ITSsa tracks"}; - - Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DalitzEECut::PIDSchemes::kTOFif), "pid scheme [kTOFif : 0, kTPConly : 1]"}; - Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; - Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +3.0, "max. TPC n sigma for electron inclusion"}; - Configurable cfg_min_TPCNsigmaPi{"cfg_min_TPCNsigmaPi", -0.0, "min. TPC n sigma for pion exclusion"}; - Configurable cfg_max_TPCNsigmaPi{"cfg_max_TPCNsigmaPi", +0.0, "max. TPC n sigma for pion exclusion"}; - Configurable cfg_min_TOFNsigmaEl{"cfg_min_TOFNsigmaEl", -3.0, "min. TOF n sigma for electron inclusion"}; - Configurable cfg_max_TOFNsigmaEl{"cfg_max_TOFNsigmaEl", +3.0, "max. TOF n sigma for electron inclusion"}; + o2::framework::Configurable cfg_min_mass{"cfg_min_mass", 0.0, "min mass"}; + o2::framework::Configurable cfg_max_mass{"cfg_max_mass", 0.1, "max mass"}; + o2::framework::Configurable cfg_apply_phiv{"cfg_apply_phiv", true, "flag to apply phiv cut"}; + o2::framework::Configurable cfg_require_itsib_any{"cfg_require_itsib_any", false, "flag to require ITS ib any hits"}; + o2::framework::Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", true, "flag to require ITS ib 1st hit"}; + o2::framework::Configurable cfg_phiv_slope{"cfg_phiv_slope", 0.0185, "slope for m vs. phiv"}; + o2::framework::Configurable cfg_phiv_intercept{"cfg_phiv_intercept", -0.0280, "intercept for m vs. phiv"}; + + o2::framework::Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.1, "min pT for single track"}; + o2::framework::Configurable cfg_max_eta_track{"cfg_max_eta_track", 0.8, "max eta for single track"}; + o2::framework::Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; + o2::framework::Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 5, "min ncluster its"}; + o2::framework::Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 70, "min ncrossed rows"}; + o2::framework::Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; + o2::framework::Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; + o2::framework::Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; + o2::framework::Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 0.05, "max dca XY for single track in cm"}; + o2::framework::Configurable cfg_max_dcaz{"cfg_max_dcaz", 0.05, "max dca Z for single track in cm"}; + o2::framework::Configurable cfg_max_dca3dsigma_track{"cfg_max_dca3dsigma_track", 1.5, "max DCA 3D in sigma"}; + o2::framework::Configurable cfg_apply_cuts_from_prefilter_derived{"cfg_apply_cuts_from_prefilter_derived", false, "flag to apply prefilter to electron"}; + o2::framework::Configurable includeITSsa{"includeITSsa", false, "Flag to enable ITSsa tracks"}; + o2::framework::Configurable cfg_max_pt_track_ITSsa{"cfg_max_pt_track_ITSsa", 0.15, "max pt for ITSsa tracks"}; + + o2::framework::Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DalitzEECut::PIDSchemes::kTOFif), "pid scheme [kTOFif : 0, kTPConly : 1]"}; + o2::framework::Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; + o2::framework::Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +3.0, "max. TPC n sigma for electron inclusion"}; + o2::framework::Configurable cfg_min_TPCNsigmaPi{"cfg_min_TPCNsigmaPi", -0.0, "min. TPC n sigma for pion exclusion"}; + o2::framework::Configurable cfg_max_TPCNsigmaPi{"cfg_max_TPCNsigmaPi", +0.0, "max. TPC n sigma for pion exclusion"}; + o2::framework::Configurable cfg_min_TOFNsigmaEl{"cfg_min_TOFNsigmaEl", -3.0, "min. TOF n sigma for electron inclusion"}; + o2::framework::Configurable cfg_max_TOFNsigmaEl{"cfg_max_TOFNsigmaEl", +3.0, "max. TOF n sigma for electron inclusion"}; } dileptoncuts; EMCPhotonCut fEMCCut; - struct : ConfigurableGroup { + struct : o2::framework::ConfigurableGroup { std::string prefix = "emccut_group"; - Configurable clusterDefinition{"clusterDefinition", "kV3Default", "Clusterizer to be selected, e.g. V3Default"}; - Configurable minOpenAngle{"minOpenAngle", 0.0202, "apply min opening angle"}; - Configurable EMC_minTime{"EMC_minTime", -20., "Minimum cluster time for EMCal time cut"}; - Configurable EMC_maxTime{"EMC_maxTime", +25., "Maximum cluster time for EMCal time cut"}; - Configurable EMC_minM02{"EMC_minM02", 0.1, "Minimum M02 for EMCal M02 cut"}; - Configurable EMC_maxM02{"EMC_maxM02", 0.7, "Maximum M02 for EMCal M02 cut"}; - Configurable EMC_minE{"EMC_minE", 0.7, "Minimum cluster energy for EMCal energy cut"}; - Configurable EMC_minNCell{"EMC_minNCell", 1, "Minimum number of cells per cluster for EMCal NCell cut"}; - Configurable> EMC_TM_Eta{"EMC_TM_Eta", {0.01f, 4.07f, -2.5f}, "|eta| <= [0]+(pT+[1])^[2] for EMCal track matching"}; - Configurable> EMC_TM_Phi{"EMC_TM_Phi", {0.015f, 3.65f, -2.f}, "|phi| <= [0]+(pT+[1])^[2] for EMCal track matching"}; - Configurable EMC_Eoverp{"EMC_Eoverp", 1.75, "Minimum cluster energy over track momentum for EMCal track matching"}; - Configurable EMC_UseExoticCut{"EMC_UseExoticCut", true, "FLag to use the EMCal exotic cluster cut"}; + o2::framework::Configurable clusterDefinition{"clusterDefinition", "kV3Default", "Clusterizer to be selected, e.g. V3Default"}; + o2::framework::Configurable minOpenAngle{"minOpenAngle", 0.0202, "apply min opening angle"}; + o2::framework::Configurable EMC_minTime{"EMC_minTime", -20., "Minimum cluster time for EMCal time cut"}; + o2::framework::Configurable EMC_maxTime{"EMC_maxTime", +25., "Maximum cluster time for EMCal time cut"}; + o2::framework::Configurable EMC_minM02{"EMC_minM02", 0.1, "Minimum M02 for EMCal M02 cut"}; + o2::framework::Configurable EMC_maxM02{"EMC_maxM02", 0.7, "Maximum M02 for EMCal M02 cut"}; + o2::framework::Configurable EMC_minE{"EMC_minE", 0.7, "Minimum cluster energy for EMCal energy cut"}; + o2::framework::Configurable EMC_minNCell{"EMC_minNCell", 1, "Minimum number of cells per cluster for EMCal NCell cut"}; + o2::framework::Configurable> EMC_TM_Eta{"EMC_TM_Eta", {0.01f, 4.07f, -2.5f}, "|eta| <= [0]+(pT+[1])^[2] for EMCal track matching"}; + o2::framework::Configurable> EMC_TM_Phi{"EMC_TM_Phi", {0.015f, 3.65f, -2.f}, "|phi| <= [0]+(pT+[1])^[2] for EMCal track matching"}; + o2::framework::Configurable EMC_Eoverp{"EMC_Eoverp", 1.75, "Minimum cluster energy over track momentum for EMCal track matching"}; + o2::framework::Configurable EMC_UseExoticCut{"EMC_UseExoticCut", true, "FLag to use the EMCal exotic cluster cut"}; } emccuts; - Configurable maxY_gen{"maxY_gen", 0.9, "maximum rapidity for generated particles"}; // for PCM and dielectron - Configurable maxRgen{"maxRgen", 90.f, "maximum radius for generated particles"}; - Configurable margin_z_mc{"margin_z_mc", 7.0, "margin for z cut in cm for MC"}; + o2::framework::Configurable maxY_gen{"maxY_gen", 0.9, "maximum rapidity for generated particles"}; // for PCM and dielectron + o2::framework::Configurable maxRgen{"maxRgen", 90.f, "maximum radius for generated particles"}; + o2::framework::Configurable margin_z_mc{"margin_z_mc", 7.0, "margin for z cut in cm for MC"}; PHOSPhotonCut fPHOSCut; - struct : ConfigurableGroup { + struct : o2::framework::ConfigurableGroup { std::string prefix = "phoscut_group"; - Configurable cfg_min_Ecluster{"cfg_min_Ecluster", 0.3, "Minimum cluster energy for PHOS in GeV"}; + o2::framework::Configurable cfg_min_Ecluster{"cfg_min_Ecluster", 0.3, "Minimum cluster energy for PHOS in GeV"}; } phoscuts; TF1* f1fd_k0s_to_pi0; - HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; - static constexpr std::string_view event_types[2] = {"before/", "after/"}; - static constexpr std::string_view event_pair_types[2] = {"same/", "mix/"}; - static constexpr std::string_view parnames[2] = {"Pi0/", "Eta/"}; + o2::framework::HistogramRegistry fRegistry{"output", {}, o2::framework::OutputObjHandlingPolicy::AnalysisObject, false, false}; + // static constexpr std::string_view event_types[2] = {"before/", "after/"}; + // static constexpr std::string_view event_pair_types[2] = {"same/", "mix/"}; + static constexpr std::string_view kParnames[2] = {"Pi0/", "Eta/"}; o2::ccdb::CcdbApi ccdbApi; - Service ccdb; + o2::framework::Service ccdb; int mRunNumber; float d_bz; - void init(InitContext&) + void init(o2::framework::InitContext&) { o2::aod::pwgem::photonmeson::utils::eventhistogram::addEventHistograms(&fRegistry); - if constexpr (pairtype == PairType::kPCMDalitzEE) { + if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMDalitzEE) { o2::aod::pwgem::photonmeson::utils::nmhistogram::addNMHistograms(&fRegistry, true, "ee#gamma"); } else { o2::aod::pwgem::photonmeson::utils::nmhistogram::addNMHistograms(&fRegistry, true, "#gamma#gamma"); @@ -238,7 +219,7 @@ struct Pi0EtaToGammaGammaMC { f1fd_k0s_to_pi0 = new TF1("f1fd_k0s_to_pi0", TString(fd_k0s_to_pi0), 0.f, 100.f); - fRegistry.add("Event/hNrecPerMCCollision", "Nrec per mc collision;N_{rec} collisions per MC collision", kTH1F, {{21, -0.5f, 20.5f}}, false); + fRegistry.add("Event/hNrecPerMCCollision", "Nrec per mc collision;N_{rec} collisions per MC collision", o2::framework::kTH1F, {{21, -0.5f, 20.5f}}, false); mRunNumber = 0; d_bz = 0; @@ -404,14 +385,14 @@ struct Pi0EtaToGammaGammaMC { fPHOSCut.SetEnergyRange(phoscuts.cfg_min_Ecluster, 1e+10); } - SliceCache cache; - Preslice perCollision_pcm = aod::v0photonkf::emeventId; - Preslice perCollision_emc = aod::emccluster::emeventId; - Preslice perCollision_phos = aod::phoscluster::emeventId; + o2::framework::SliceCache cache; + o2::framework::Preslice>> perCollision_pcm = o2::aod::v0photonkf::emeventId; + o2::framework::Preslice> perCollision_emc = o2::aod::emccluster::emeventId; + o2::framework::Preslice> perCollision_phos = o2::aod::phoscluster::emeventId; - Preslice perCollision_electron = aod::emprimaryelectron::emeventId; - Partition positrons = o2::aod::emprimaryelectron::sign > int8_t(0) && dileptoncuts.cfg_min_pt_track < o2::aod::track::pt&& nabs(o2::aod::track::eta) < dileptoncuts.cfg_max_eta_track; - Partition electrons = o2::aod::emprimaryelectron::sign < int8_t(0) && dileptoncuts.cfg_min_pt_track < o2::aod::track::pt && nabs(o2::aod::track::eta) < dileptoncuts.cfg_max_eta_track; + o2::framework::Preslice>> perCollision_electron = o2::aod::emprimaryelectron::emeventId; + o2::framework::Partition>> positrons = o2::aod::emprimaryelectron::sign > int8_t(0) && dileptoncuts.cfg_min_pt_track < o2::aod::track::pt&& nabs(o2::aod::track::eta) < dileptoncuts.cfg_max_eta_track; + o2::framework::Partition>> electrons = o2::aod::emprimaryelectron::sign < int8_t(0) && dileptoncuts.cfg_min_pt_track < o2::aod::track::pt && nabs(o2::aod::track::eta) < dileptoncuts.cfg_max_eta_track; template void runTruePairing(TCollisions const& collisions, @@ -424,12 +405,12 @@ struct Pi0EtaToGammaGammaMC { for (auto& collision : collisions) { initCCDB(collision); - if ((pairtype == PairType::kPHOSPHOS || pairtype == PairType::kPCMPHOS) && !collision.alias_bit(triggerAliases::kTVXinPHOS)) { + if ((pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPHOSPHOS || pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMPHOS) && !collision.alias_bit(triggerAliases::kTVXinPHOS)) { continue; } float weight = 1.f; - if constexpr (std::is_same_v, FilteredMyCollisionsWithJJMC>) { + if constexpr (std::is_same_v, o2::soa::Filtered, o2::aod::EMEventsWeight>>>) { weight = collision.weight(); } @@ -451,16 +432,16 @@ struct Pi0EtaToGammaGammaMC { fRegistry.fill(HIST("Event/after/hCollisionCounter"), 12.0, weight); // accepted int photonid1 = -1, photonid2 = -1, pi0id = -1, etaid = -1; - if constexpr (pairtype == PairType::kPCMPCM || pairtype == PairType::kPHOSPHOS || pairtype == PairType::kEMCEMC) { // same kinds pairing + if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMPCM || pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPHOSPHOS || pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kEMCEMC) { // same kinds pairing auto photons1_per_collision = photons1.sliceBy(perCollision1, collision.globalIndex()); auto photons2_per_collision = photons2.sliceBy(perCollision2, collision.globalIndex()); - for (auto& [g1, g2] : combinations(CombinationsStrictlyUpperIndexPolicy(photons1_per_collision, photons2_per_collision))) { + for (auto& [g1, g2] : o2::soa::combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(photons1_per_collision, photons2_per_collision))) { if (!cut1.template IsSelected(g1) || !cut2.template IsSelected(g2)) { continue; } - if constexpr (pairtype == PairType::kPCMPCM) { // check 2 legs + if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMPCM) { // check 2 legs auto pos1 = g1.template posTrack_as(); auto ele1 = g1.template negTrack_as(); auto pos2 = g2.template posTrack_as(); @@ -471,14 +452,14 @@ struct Pi0EtaToGammaGammaMC { auto pos2mc = pos2.template emmcparticle_as(); auto ele2mc = ele2.template emmcparticle_as(); - photonid1 = FindCommonMotherFrom2Prongs(pos1mc, ele1mc, -11, 11, 22, mcparticles); - photonid2 = FindCommonMotherFrom2Prongs(pos2mc, ele2mc, -11, 11, 22, mcparticles); - } else if constexpr (pairtype == PairType::kEMCEMC) { + photonid1 = o2::aod::pwgem::dilepton::utils::mcutil::FindCommonMotherFrom2Prongs(pos1mc, ele1mc, -11, 11, 22, mcparticles); + photonid2 = o2::aod::pwgem::dilepton::utils::mcutil::FindCommonMotherFrom2Prongs(pos2mc, ele2mc, -11, 11, 22, mcparticles); + } else if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kEMCEMC) { auto cluster1mcparticle = mcparticles.iteratorAt(g1.emmcparticleId()); auto cluster2mcparticle = mcparticles.iteratorAt(g2.emmcparticleId()); - photonid1 = FindMotherInChain(cluster1mcparticle, mcparticles, std::vector{111, 221}); - photonid2 = FindMotherInChain(cluster2mcparticle, mcparticles, std::vector{111, 221}); + photonid1 = o2::aod::pwgem::photonmeson::utils::mcutil::FindMotherInChain(cluster1mcparticle, mcparticles, std::vector{111, 221}); + photonid2 = o2::aod::pwgem::photonmeson::utils::mcutil::FindMotherInChain(cluster2mcparticle, mcparticles, std::vector{111, 221}); } else { photonid1 = -1; photonid2 = -1; @@ -490,14 +471,14 @@ struct Pi0EtaToGammaGammaMC { auto g1mc = mcparticles.iteratorAt(photonid1); auto g2mc = mcparticles.iteratorAt(photonid2); - if constexpr (pairtype == PairType::kPCMPCM) { - if (!IsConversionPointInAcceptance(g1mc, maxRgen, maxY_gen, margin_z_mc, mcparticles) || !IsConversionPointInAcceptance(g2mc, maxRgen, maxY_gen, margin_z_mc, mcparticles)) { + if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMPCM) { + if (!o2::aod::pwgem::photonmeson::utils::mcutil::IsConversionPointInAcceptance(g1mc, maxRgen, maxY_gen, margin_z_mc, mcparticles) || !o2::aod::pwgem::photonmeson::utils::mcutil::IsConversionPointInAcceptance(g2mc, maxRgen, maxY_gen, margin_z_mc, mcparticles)) { continue; } } - pi0id = FindCommonMotherFrom2Prongs(g1mc, g2mc, 22, 22, 111, mcparticles); - etaid = FindCommonMotherFrom2Prongs(g1mc, g2mc, 22, 22, 221, mcparticles); + pi0id = o2::aod::pwgem::dilepton::utils::mcutil::FindCommonMotherFrom2Prongs(g1mc, g2mc, 22, 22, 111, mcparticles); + etaid = o2::aod::pwgem::dilepton::utils::mcutil::FindCommonMotherFrom2Prongs(g1mc, g2mc, 22, 22, 221, mcparticles); if (g1mc.globalIndex() != g2mc.globalIndex() && pi0id < 0 && etaid < 0) { // for same gamma no pi0/eta will be found, but we still want to fill the FromSameGamma hist continue; @@ -510,7 +491,7 @@ struct Pi0EtaToGammaGammaMC { continue; } - if (pairtype == PairType::kEMCEMC) { + if (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kEMCEMC) { float openingAngle = std::acos(v1.Vect().Dot(v2.Vect()) / (v1.P() * v2.P())); if (openingAngle < emccuts.minOpenAngle) { continue; @@ -518,9 +499,9 @@ struct Pi0EtaToGammaGammaMC { } if (g1mc.globalIndex() == g2mc.globalIndex()) { - if (getMotherPDGCode(g1mc, mcparticles) == 111) + if (o2::aod::pwgem::dilepton::utils::mcutil::getMotherPDGCode(g1mc, mcparticles) == 111) fRegistry.fill(HIST("Pair/Pi0/hs_FromSameGamma"), v12.M(), v12.Pt(), weight); - else if (getMotherPDGCode(g1mc, mcparticles) == 221) + else if (o2::aod::pwgem::dilepton::utils::mcutil::getMotherPDGCode(g1mc, mcparticles) == 221) fRegistry.fill(HIST("Pair/Eta/hs_FromSameGamma"), v12.M(), v12.Pt(), weight); continue; } @@ -539,7 +520,7 @@ struct Pi0EtaToGammaGammaMC { o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, etamc, mcparticles, mccollisions, f1fd_k0s_to_pi0, weight); } } // end of pairing loop - } else if constexpr (pairtype == PairType::kPCMDalitzEE) { + } else if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMDalitzEE) { auto photons1_per_collision = photons1.sliceBy(perCollision1, collision.globalIndex()); auto positrons_per_collision = positrons->sliceByCached(o2::aod::emprimaryelectron::emeventId, collision.globalIndex(), cache); auto electrons_per_collision = electrons->sliceByCached(o2::aod::emprimaryelectron::emeventId, collision.globalIndex(), cache); @@ -552,18 +533,18 @@ struct Pi0EtaToGammaGammaMC { auto ele1 = g1.template negTrack_as(); auto pos1mc = pos1.template emmcparticle_as(); auto ele1mc = ele1.template emmcparticle_as(); - photonid1 = FindCommonMotherFrom2Prongs(pos1mc, ele1mc, -11, 11, 22, mcparticles); + photonid1 = o2::aod::pwgem::dilepton::utils::mcutil::FindCommonMotherFrom2Prongs(pos1mc, ele1mc, -11, 11, 22, mcparticles); if (photonid1 < 0) { continue; } auto g1mc = mcparticles.iteratorAt(photonid1); - if (!IsConversionPointInAcceptance(g1mc, maxRgen, maxY_gen, margin_z_mc, mcparticles)) { + if (!o2::aod::pwgem::photonmeson::utils::mcutil::IsConversionPointInAcceptance(g1mc, maxRgen, maxY_gen, margin_z_mc, mcparticles)) { continue; } ROOT::Math::PtEtaPhiMVector v_gamma(g1.pt(), g1.eta(), g1.phi(), 0.f); - for (auto& [pos2, ele2] : combinations(CombinationsFullIndexPolicy(positrons_per_collision, electrons_per_collision))) { // ULS - if (pos2.trackId() == ele2.trackId()) { // this is protection against pairing identical 2 tracks. + for (auto& [pos2, ele2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(positrons_per_collision, electrons_per_collision))) { // ULS + if (pos2.trackId() == ele2.trackId()) { // this is protection against pairing identical 2 tracks. continue; } if (pos1.trackId() == pos2.trackId() || ele1.trackId() == ele2.trackId()) { @@ -580,8 +561,8 @@ struct Pi0EtaToGammaGammaMC { auto pos2mc = mcparticles.iteratorAt(pos2.emmcparticleId()); auto ele2mc = mcparticles.iteratorAt(ele2.emmcparticleId()); - pi0id = FindCommonMotherFrom3Prongs(g1mc, pos2mc, ele2mc, 22, -11, 11, 111, mcparticles); - etaid = FindCommonMotherFrom3Prongs(g1mc, pos2mc, ele2mc, 22, -11, 11, 221, mcparticles); + pi0id = o2::aod::pwgem::dilepton::utils::mcutil::FindCommonMotherFrom3Prongs(g1mc, pos2mc, ele2mc, 22, -11, 11, 111, mcparticles); + etaid = o2::aod::pwgem::dilepton::utils::mcutil::FindCommonMotherFrom3Prongs(g1mc, pos2mc, ele2mc, 22, -11, 11, 221, mcparticles); if (pi0id < 0 && etaid < 0) { continue; } @@ -610,7 +591,7 @@ struct Pi0EtaToGammaGammaMC { auto photons1_per_collision = photons1.sliceBy(perCollision1, collision.globalIndex()); auto photons2_per_collision = photons2.sliceBy(perCollision2, collision.globalIndex()); - for (auto& [g1, g2] : combinations(CombinationsFullIndexPolicy(photons1_per_collision, photons2_per_collision))) { + for (auto& [g1, g2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(photons1_per_collision, photons2_per_collision))) { if (!cut1.template IsSelected(g1) || !cut2.template IsSelected(g2)) { continue; } @@ -636,8 +617,8 @@ struct Pi0EtaToGammaGammaMC { void fillBinnedData(TBinnedData const& binned_data, const float weight = 1.f) { int xbin = 0, ybin = 0, zbin = 0; - auto hPtY = fRegistry.get(HIST("Generated/") + HIST(parnames[par_id]) + HIST("hPtY")); // 2D - auto hPt = fRegistry.get(HIST("Generated/") + HIST(parnames[par_id]) + HIST("hPt")); // 1D + auto hPtY = fRegistry.get(HIST("Generated/") + HIST(kParnames[par_id]) + HIST("hPtY")); // 2D + auto hPt = fRegistry.get(HIST("Generated/") + HIST(kParnames[par_id]) + HIST("hPt")); // 1D for (int ibin = 0; ibin < hPtY->GetNcells(); ibin++) { int nentry = binned_data[ibin]; @@ -655,8 +636,8 @@ struct Pi0EtaToGammaGammaMC { } } - PresliceUnsorted perMcCollision = aod::emmcparticle::emmceventId; - PresliceUnsorted rec_perMcCollision = aod::emmceventlabel::emmceventId; + o2::framework::PresliceUnsorted perMcCollision = o2::aod::emmcparticle::emmceventId; + o2::framework::PresliceUnsorted> rec_perMcCollision = o2::aod::emmceventlabel::emmceventId; template void runGenInfo(TCollisions const& collisions, TMCCollisions const& mccollisions, TMCParticles const& /*mcparticles*/) @@ -671,12 +652,12 @@ struct Pi0EtaToGammaGammaMC { } for (auto& collision : collisions) { - if ((pairtype == kPHOSPHOS || pairtype == kPCMPHOS) && !collision.alias_bit(triggerAliases::kTVXinPHOS)) { + if ((pairtype == o2::aod::pwgem::photonmeson::photonpair::kPHOSPHOS || pairtype == o2::aod::pwgem::photonmeson::photonpair::kPCMPHOS) && !collision.alias_bit(triggerAliases::kTVXinPHOS)) { continue; // I don't know why this is necessary in simulation. } float weight = 1.f; - if constexpr (std::is_same_v, FilteredMyCollisionsWithJJMC>) { + if constexpr (std::is_same_v, o2::soa::Filtered, o2::aod::EMEventsWeight>>>) { weight = collision.weight(); } @@ -701,45 +682,45 @@ struct Pi0EtaToGammaGammaMC { } // end of collision loop } - Filter collisionFilter_occupancy_track = eventcuts.cfgTrackOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgTrackOccupancyMax; - Filter collisionFilter_occupancy_ft0c = eventcuts.cfgFT0COccupancyMin <= o2::aod::evsel::ft0cOccupancyInTimeRange && o2::aod::evsel::ft0cOccupancyInTimeRange < eventcuts.cfgFT0COccupancyMax; - Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); - using FilteredMyCollisions = soa::Filtered; + o2::framework::expressions::Filter collisionFilter_occupancy_track = eventcuts.cfgTrackOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgTrackOccupancyMax; + o2::framework::expressions::Filter collisionFilter_occupancy_ft0c = eventcuts.cfgFT0COccupancyMin <= o2::aod::evsel::ft0cOccupancyInTimeRange && o2::aod::evsel::ft0cOccupancyInTimeRange < eventcuts.cfgFT0COccupancyMax; + o2::framework::expressions::Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); + // using FilteredMyCollisions = o2::soa::Filtered>; - Filter prefilter_pcm = ifnode(pcmcuts.cfg_apply_cuts_from_prefilter_derived.node(), o2::aod::v0photonkf::pfbderived == static_cast(0), true); - Filter prefilter_primaryelectron = ifnode(dileptoncuts.cfg_apply_cuts_from_prefilter_derived.node(), o2::aod::emprimaryelectron::pfbderived == static_cast(0), true); + o2::framework::expressions::Filter prefilter_pcm = ifnode(pcmcuts.cfg_apply_cuts_from_prefilter_derived.node(), o2::aod::v0photonkf::pfbderived == static_cast(0), true); + o2::framework::expressions::Filter prefilter_primaryelectron = ifnode(dileptoncuts.cfg_apply_cuts_from_prefilter_derived.node(), o2::aod::emprimaryelectron::pfbderived == static_cast(0), true); - void processAnalysis(FilteredMyCollisions const& collisions, MyMCCollisions const& mccollisions, aod::EMMCParticles const& mcparticles, Types const&... args) + void processAnalysis(o2::soa::Filtered> const& collisions, o2::soa::Join const& mccollisions, o2::aod::EMMCParticles const& mcparticles, Types const&... args) { - if constexpr (pairtype == PairType::kPCMPCM) { + if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMPCM) { auto v0photons = std::get<0>(std::tie(args...)); auto v0legs = std::get<1>(std::tie(args...)); runTruePairing(collisions, v0photons, v0photons, v0legs, v0legs, perCollision_pcm, perCollision_pcm, fV0PhotonCut, fV0PhotonCut, mccollisions, mcparticles); runGenInfo(collisions, mccollisions, mcparticles); - } else if constexpr (pairtype == PairType::kPCMDalitzEE) { + } else if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMDalitzEE) { auto v0photons = std::get<0>(std::tie(args...)); auto v0legs = std::get<1>(std::tie(args...)); auto emprimaryelectrons = std::get<2>(std::tie(args...)); // LOGF(info, "electrons.size() = %d, positrons.size() = %d", electrons.size(), positrons.size()); runTruePairing(collisions, v0photons, emprimaryelectrons, v0legs, emprimaryelectrons, perCollision_pcm, perCollision_electron, fV0PhotonCut, fDileptonCut, mccollisions, mcparticles); runGenInfo(collisions, mccollisions, mcparticles); - } else if constexpr (pairtype == PairType::kEMCEMC) { + } else if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kEMCEMC) { auto emcclusters = std::get<0>(std::tie(args...)); runTruePairing(collisions, emcclusters, emcclusters, nullptr, nullptr, perCollision_emc, perCollision_emc, fEMCCut, fEMCCut, mccollisions, mcparticles); runGenInfo(collisions, mccollisions, mcparticles); } - // else if constexpr (pairtype == PairType::kPHOSPHOS) { + // else if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPHOSPHOS) { // auto phosclusters = std::get<0>(std::tie(args...)); // runPairing(collisions, phosclusters, phosclusters, nullptr, nullptr, perCollision_phos, perCollision_phos, fPHOSCut, fPHOSCut, nullptr, nullptr); // } - // else if constexpr (pairtype == PairType::kPCMEMC) { + // else if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMEMC) { // auto v0photons = std::get<0>(std::tie(args...)); // auto v0legs = std::get<1>(std::tie(args...)); // auto emcclusters = std::get<2>(std::tie(args...)); // auto emcmatchedtracks = std::get<3>(std::tie(args...)); // runPairing(collisions, v0photons, emcclusters, v0legs, nullptr, perCollision_pcm, perCollision_emc, fV0PhotonCut, fEMCCut, emcmatchedtracks, nullptr); - // } else if constexpr (pairtype == PairType::kPCMPHOS) { + // } else if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMPHOS) { // auto v0photons = std::get<0>(std::tie(args...)); // auto v0legs = std::get<1>(std::tie(args...)); // auto phosclusters = std::get<2>(std::tie(args...)); @@ -748,38 +729,38 @@ struct Pi0EtaToGammaGammaMC { } PROCESS_SWITCH(Pi0EtaToGammaGammaMC, processAnalysis, "process pair analysis", true); - using FilteredMyCollisionsWithJJMC = soa::Filtered; - void processAnalysisJJMC(FilteredMyCollisionsWithJJMC const& collisions, MyMCCollisions const& mccollisions, aod::EMMCParticles const& mcparticles, Types const&... args) + // using FilteredMyCollisionsWithJJMC = o2::soa::Filtered, aod::EMEventsWeight>>; + void processAnalysisJJMC(o2::soa::Filtered, o2::aod::EMEventsWeight>> const& collisions, o2::soa::Join const& mccollisions, o2::aod::EMMCParticles const& mcparticles, Types const&... args) { - if constexpr (pairtype == PairType::kPCMPCM) { + if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMPCM) { auto v0photons = std::get<0>(std::tie(args...)); auto v0legs = std::get<1>(std::tie(args...)); runTruePairing(collisions, v0photons, v0photons, v0legs, v0legs, perCollision_pcm, perCollision_pcm, fV0PhotonCut, fV0PhotonCut, mccollisions, mcparticles); runGenInfo(collisions, mccollisions, mcparticles); - } else if constexpr (pairtype == PairType::kPCMDalitzEE) { + } else if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMDalitzEE) { auto v0photons = std::get<0>(std::tie(args...)); auto v0legs = std::get<1>(std::tie(args...)); auto emprimaryelectrons = std::get<2>(std::tie(args...)); // LOGF(info, "electrons.size() = %d, positrons.size() = %d", electrons.size(), positrons.size()); runTruePairing(collisions, v0photons, emprimaryelectrons, v0legs, emprimaryelectrons, perCollision_pcm, perCollision_electron, fV0PhotonCut, fDileptonCut, mccollisions, mcparticles); runGenInfo(collisions, mccollisions, mcparticles); - } else if constexpr (pairtype == PairType::kEMCEMC) { + } else if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kEMCEMC) { auto emcclusters = std::get<0>(std::tie(args...)); runTruePairing(collisions, emcclusters, emcclusters, nullptr, nullptr, perCollision_emc, perCollision_emc, fEMCCut, fEMCCut, mccollisions, mcparticles); runGenInfo(collisions, mccollisions, mcparticles); } - // else if constexpr (pairtype == PairType::kPHOSPHOS) { + // else if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPHOSPHOS) { // auto phosclusters = std::get<0>(std::tie(args...)); // runPairing(collisions, phosclusters, phosclusters, nullptr, nullptr, perCollision_phos, perCollision_phos, fPHOSCut, fPHOSCut, nullptr, nullptr); // } - // else if constexpr (pairtype == PairType::kPCMEMC) { + // else if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMEMC) { // auto v0photons = std::get<0>(std::tie(args...)); // auto v0legs = std::get<1>(std::tie(args...)); // auto emcclusters = std::get<2>(std::tie(args...)); // auto emcmatchedtracks = std::get<3>(std::tie(args...)); // runPairing(collisions, v0photons, emcclusters, v0legs, nullptr, perCollision_pcm, perCollision_emc, fV0PhotonCut, fEMCCut, emcmatchedtracks, nullptr); - // } else if constexpr (pairtype == PairType::kPCMPHOS) { + // } else if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMPHOS) { // auto v0photons = std::get<0>(std::tie(args...)); // auto v0legs = std::get<1>(std::tie(args...)); // auto phosclusters = std::get<2>(std::tie(args...)); @@ -788,7 +769,7 @@ struct Pi0EtaToGammaGammaMC { } PROCESS_SWITCH(Pi0EtaToGammaGammaMC, processAnalysisJJMC, "process pair analysis", false); - void processDummy(MyCollisions const&) {} + void processDummy(o2::aod::EMEvents const&) {} PROCESS_SWITCH(Pi0EtaToGammaGammaMC, processDummy, "Dummy function", false); }; #endif // PWGEM_PHOTONMESON_CORE_PI0ETATOGAMMAGAMMAMC_H_ diff --git a/PWGEM/PhotonMeson/DataModel/gammaTables.h b/PWGEM/PhotonMeson/DataModel/gammaTables.h index 5f3392e1704..b10f56a2299 100644 --- a/PWGEM/PhotonMeson/DataModel/gammaTables.h +++ b/PWGEM/PhotonMeson/DataModel/gammaTables.h @@ -584,6 +584,12 @@ DECLARE_SOA_TABLE(SkimEMCClusters, "AOD", "SKIMEMCCLUSTER", //! table of skimmed emccluster::DeltaEta, emccluster::TrackP, emccluster::TrackPt, emccluster::Pt); using SkimEMCCluster = SkimEMCClusters::iterator; +DECLARE_SOA_TABLE_VERSIONED(SkimEMCClusters_001, "AOD", "SKIMEMCCLUSTER", 1, //! table of skimmed EMCal clusters + o2::soa::Index<>, skimmedcluster::CollisionId, emccluster::Definition, skimmedcluster::E, skimmedcluster::Eta, skimmedcluster::Phi, + skimmedcluster::M02, skimmedcluster::NCells, skimmedcluster::Time, emccluster::IsExotic, emccluster::DeltaPhi, + emccluster::DeltaEta, emccluster::TrackP, emccluster::TrackPt, emccluster::Pt); +using SkimEMCCluster = SkimEMCClusters::iterator; + DECLARE_SOA_TABLE(EMCEMEventIds, "AOD", "EMCEMEVENTID", emccluster::EMEventId); // To be joined with SkimEMCClusters table at analysis level. // iterators using EMCEMEventId = EMCEMEventIds::iterator; diff --git a/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx b/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx index 770cd6ad1c3..f84f260bc46 100644 --- a/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx +++ b/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx @@ -9,11 +9,10 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // -// ======================== -// \file photonconversionbuilder.cxx -// \brief this task produces photon data table with KFParticle. -// -// \author Daiki Sekihata , Tokyo + +/// \file photonconversionbuilder.cxx +/// \brief this task produces photon data table with KFParticle. +/// \author Daiki Sekihata , Tokyo #include "PWGEM/Dilepton/Utils/PairUtilities.h" #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" @@ -22,31 +21,42 @@ #include "Common/Core/RecoDecay.h" #include "Common/Core/TPCVDriftManager.h" -#include "Common/Core/TableHelper.h" -#include "Common/Core/TrackSelection.h" #include "Common/Core/trackUtilities.h" -#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/PIDResponseTPC.h" #include "Tools/KFparticle/KFUtilities.h" -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DetectorsBase/GeometryManager.h" -#include "DetectorsBase/Propagator.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/Track.h" - -#include "Math/Vector4D.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include // IWYU pragma: keep +#include +#include + +#include +#include +#include #include #include #include +#include #include -#include #include #include #include @@ -69,6 +79,12 @@ using MyCollisionsMC = soa::Join; using MyTracksIU = soa::Join; using MyTracksIUMC = soa::Join; +enum MatCorrType { + None = 0, + TGeo = 1, + LUT = 2 +}; + struct PhotonConversionBuilder { Produces v0photonskf; Produces v0legs; @@ -152,7 +168,7 @@ struct PhotonConversionBuilder { {"V0/hConversionPointXY", "conversion point in XY;X (cm);Y (cm)", {HistType::kTH2F, {{400, -100.0f, 100.0f}, {400, -100.f, 100.f}}}}, {"V0/hConversionPointRZ", "conversion point in RZ;Z (cm);R_{xy} (cm)", {HistType::kTH2F, {{200, -100.0f, 100.0f}, {200, 0.f, 100.f}}}}, {"V0/hPt", "pT of V0 at PV;p_{T,#gamma} (GeV/c)", {HistType::kTH1F, {{1000, 0.0f, 10.0f}}}}, - {"V0/hEtaPhi", "#eta vs. #varphi of V0 at PV;#varphi (rad.);#eta", {HistType::kTH2F, {{72, 0.0f, 2 * M_PI}, {200, -1, +1}}}}, + {"V0/hEtaPhi", "#eta vs. #varphi of V0 at PV;#varphi (rad.);#eta", {HistType::kTH2F, {{72, 0.0f, o2::constants::math::TwoPI}, {200, -1, +1}}}}, {"V0/hCosPA", "cosine of pointing angle;cosine of pointing angle", {HistType::kTH1F, {{100, 0.99f, 1.f}}}}, {"V0/hCosPA_Rxy", "cosine of pointing angle;r_{xy} (cm);cosine of pointing angle", {HistType::kTH2F, {{200, 0, 100}, {100, 0.99f, 1.f}}}}, {"V0/hCosPAXY_Rxy", "cosine of pointing angle;r_{xy} (cm);cosine of pointing angle", {HistType::kTH2F, {{200, 0, 100}, {100, 0.99f, 1.f}}}}, @@ -170,7 +186,7 @@ struct PhotonConversionBuilder { {"V0/hPCA_diffX", "PCA vs. trackiu X - R_{xy};distance btween 2 legs (cm);min trackiu X - R_{xy} (cm)", {HistType::kTH2F, {{500, 0.0f, 5.f}, {100, -50.0, 50.0f}}}}, {"V0/hPhiV", "#phi_{V}; #phi_{V} (rad.)", {HistType::kTH1F, {{500, 0.0f, 2 * M_PI}}}}, {"V0Leg/hPt", "pT of leg at SV;p_{T,e} (GeV/c)", {HistType::kTH1F, {{1000, 0.0f, 10.0f}}}}, - {"V0Leg/hEtaPhi", "#eta vs. #varphi of leg at SV;#varphi (rad.);#eta", {HistType::kTH2F, {{72, 0.0f, 2 * M_PI}, {200, -1, +1}}}}, + {"V0Leg/hEtaPhi", "#eta vs. #varphi of leg at SV;#varphi (rad.);#eta", {HistType::kTH2F, {{72, 0.0f, o2::constants::math::TwoPI}, {200, -1, +1}}}}, {"V0Leg/hRelDeltaPt", "pT resolution;p_{T} (GeV/c);#Deltap_{T}/p_{T}", {HistType::kTH2F, {{1000, 0.f, 10.f}, {100, 0, 1}}}}, {"V0Leg/hDCAxyz", "DCA xy vs. z to PV;DCA_{xy} (cm);DCA_{z} (cm)", {HistType::kTH2F, {{200, -50.f, 50.f}, {200, -50.f, +50.f}}}}, {"V0Leg/hdEdx_Pin", "TPC dE/dx vs. p_{in};p_{in} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{1000, 0.f, 10.f}, {200, 0.f, 200.f}}}}, @@ -190,21 +206,21 @@ struct PhotonConversionBuilder { ccdb->setLocalObjectValidityChecking(); ccdb->setFatalWhenNull(false); - if (useMatCorrType == 1) { + if (useMatCorrType == MatCorrType::TGeo) { LOGF(info, "TGeo correction requested, loading geometry"); if (!o2::base::GeometryManager::isGeometryLoaded()) { ccdb->get(geoPath); } } - if (useMatCorrType == 2) { + if (useMatCorrType == MatCorrType::LUT) { LOGF(info, "LUT correction requested, loading LUT"); lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get(lutPath)); } - if (useMatCorrType == 1) { + if (useMatCorrType == MatCorrType::TGeo) { matCorr = o2::base::Propagator::MatCorrType::USEMatCorrTGeo; } - if (useMatCorrType == 2) { + if (useMatCorrType == MatCorrType::LUT) { matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; } } @@ -467,8 +483,8 @@ struct PhotonConversionBuilder { KFPTrack kfp_track_pos = createKFPTrackFromTrackParCov(pTrack, pos.sign(), pos.tpcNClsFound(), pos.tpcChi2NCl()); KFPTrack kfp_track_ele = createKFPTrackFromTrackParCov(nTrack, ele.sign(), ele.tpcNClsFound(), ele.tpcChi2NCl()); - KFParticle kfp_pos(kfp_track_pos, -11); - KFParticle kfp_ele(kfp_track_ele, 11); + KFParticle kfp_pos(kfp_track_pos, kPositron); + KFParticle kfp_ele(kfp_track_ele, kElectron); const KFParticle* GammaDaughters[2] = {&kfp_pos, &kfp_ele}; KFParticle gammaKF; @@ -553,7 +569,7 @@ struct PhotonConversionBuilder { gammaKF_PV.SetProductionVertex(KFPV); float v0pt = RecoDecay::sqrtSumOfSquares(gammaKF_PV.GetPx(), gammaKF_PV.GetPy()); float v0eta = RecoDecay::eta(std::array{gammaKF_PV.GetPx(), gammaKF_PV.GetPy(), gammaKF_PV.GetPz()}); - float v0phi = RecoDecay::phi(gammaKF_PV.GetPx(), gammaKF_PV.GetPy()) > 0.f ? RecoDecay::phi(gammaKF_PV.GetPx(), gammaKF_PV.GetPy()) : RecoDecay::phi(gammaKF_PV.GetPx(), gammaKF_PV.GetPy()) + TMath::TwoPi(); + float v0phi = RecoDecay::constrainAngle(RecoDecay::phi(gammaKF_PV.GetPx(), gammaKF_PV.GetPy())); // KFParticle gammaKF_DecayVtx2 = gammaKF; // gammaKF_DecayVtx2.SetProductionVertex(KFPV); @@ -657,18 +673,18 @@ struct PhotonConversionBuilder { registry.fill(HIST("V0/hCosPAXY_Rxy"), rxy, cospaXY_kf); registry.fill(HIST("V0/hCosPARZ_Rxy"), rxy, cospaRZ_kf); - for (auto& leg : {kfp_pos_DecayVtx, kfp_ele_DecayVtx}) { + for (const auto& leg : {kfp_pos_DecayVtx, kfp_ele_DecayVtx}) { float legpt = RecoDecay::sqrtSumOfSquares(leg.GetPx(), leg.GetPy()); float legeta = RecoDecay::eta(std::array{leg.GetPx(), leg.GetPy(), leg.GetPz()}); - float legphi = RecoDecay::phi(leg.GetPx(), leg.GetPy()) > 0.f ? RecoDecay::phi(leg.GetPx(), leg.GetPy()) : RecoDecay::phi(leg.GetPx(), leg.GetPy()) + TMath::TwoPi(); + float legphi = RecoDecay::constrainAngle(RecoDecay::phi(leg.GetPx(), leg.GetPy())); registry.fill(HIST("V0Leg/hPt"), legpt); registry.fill(HIST("V0Leg/hEtaPhi"), legphi, legeta); } // end of leg loop - for (auto& leg : {pos, ele}) { + for (const auto& leg : {pos, ele}) { registry.fill(HIST("V0Leg/hdEdx_Pin"), leg.tpcInnerParam(), leg.tpcSignal()); registry.fill(HIST("V0Leg/hTPCNsigmaEl"), leg.tpcInnerParam(), leg.tpcNSigmaEl()); } // end of leg loop - for (auto& leg : {pTrack, nTrack}) { + for (const auto& leg : {pTrack, nTrack}) { registry.fill(HIST("V0Leg/hXZ"), leg.getZ(), leg.getX()); registry.fill(HIST("V0Leg/hRelDeltaPt"), leg.getPt(), leg.getPt() * std::sqrt(leg.getSigma1Pt2())); } // end of leg loop @@ -793,7 +809,7 @@ struct PhotonConversionBuilder { } // end of pca_map loop // LOGF(info, "pca_map.size() = %d", pca_map.size()); - for (auto& fullv0Id : stored_fullv0Ids) { + for (const auto& fullv0Id : stored_fullv0Ids) { auto v0Id = std::get<0>(fullv0Id); // auto collisionId = std::get<1>(fullv0Id); // auto posId = std::get<2>(fullv0Id); @@ -812,7 +828,7 @@ struct PhotonConversionBuilder { fillV0Table(v0, true); } // end of fullv0Id loop - for (auto& collision : collisions) { + for (const auto& collision : collisions) { if constexpr (isMC) { if (!collision.has_mcCollision()) { continue; diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx index 731a9ed9331..cc253c54746 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx @@ -10,9 +10,9 @@ // or submit itself to any jurisdiction. /// \file skimmerGammaCalo.cxx -/// \brief skim cluster information to write photon cluster table in AO2D.root -/// dependencies: emcal-correction-task +/// \brief skim cluster information to write photon cluster table into derived AO2D.root /// \author marvin.hemmer@cern.ch +/// dependencies: emcal-correction-task #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" #include "PWGEM/PhotonMeson/Utils/emcalHistoDefinitions.h" @@ -58,9 +58,11 @@ struct SkimmerGammaCalo { Configurable minM02{"minM02", 0.0, "Minimum M02 for M02 cut"}; Configurable maxM02{"maxM02", 1.0, "Maximum M02 for M02 cut"}; Configurable minE{"minE", 0.5, "Minimum energy for energy cut"}; + Configurable removeExotic{"removeExotic", false, "Flag to enable the removal of exotic clusters."}; Configurable> clusterDefinitions{"clusterDefinitions", {0, 1, 2, 10, 11, 12, 13, 20, 21, 22, 30, 40, 41, 42, 43, 44, 45}, "Cluster definitions to be accepted (e.g. 13 for kV3MostSplitLowSeed)"}; Configurable maxdEta{"maxdEta", 0.1, "Set a maximum difference in eta for tracks and cluster to still count as matched"}; Configurable maxdPhi{"maxdPhi", 0.1, "Set a maximum difference in phi for tracks and cluster to still count as matched"}; + Configurable maxEoverP{"maxEoverP", 1.5, "Set a maximum for cluster E / track p for track matching."}; Configurable needEMCTrigger{"needEMCTrigger", false, "flag to only save events which have kTVXinEMC trigger bit. To reduce PbPb derived data size"}; HistogramRegistry historeg{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; @@ -69,25 +71,38 @@ struct SkimmerGammaCalo { { historeg.add("DefinitionIn", "Cluster definitions before cuts;#bf{Cluster definition};#bf{#it{N}_{clusters}}", HistType::kTH1F, {{51, -0.5, 50.5}}); historeg.add("DefinitionOut", "Cluster definitions after cuts;#bf{Cluster definition};#bf{#it{N}_{clusters}}", HistType::kTH1F, {{51, -0.5, 50.5}}); - historeg.add("EIn", "Energy of clusters before cuts", gHistoSpec_clusterE); - historeg.add("EOut", "Energy of clusters after cuts", gHistoSpec_clusterE); - historeg.add("MTEtaPhi", "Eta phi of matched tracks", gHistoSpec_clusterTM_dEtadPhi); + historeg.add("EIn", "Energy of clusters before cuts", gHistoSpecClusterE); + historeg.add("EOut", "Energy of clusters after cuts", gHistoSpecClusterE); + historeg.add("MTEtaPhiBeforeTM", "Eta phi of matched tracks before TM cuts", gHistoSpecClusterTMdEtadPhi); + historeg.add("MTEtaPhiAfterTM", "Eta phi of matched tracks after TM cuts", gHistoSpecClusterTMdEtadPhi); + historeg.add("Eoverp", "E/p for cluster E and track p", gHistoSpecTMEoverP); historeg.add("M02In", "Shape of cluster before cuts;#bf{#it{M}_{02}};#bf{#it{N}_{clusters}}", HistType::kTH1F, {{200, 0, 2}}); historeg.add("M02Out", "Shape of cluster after cuts;#bf{#it{M}_{02}};#bf{#it{N}_{clusters}}", HistType::kTH1F, {{200, 0, 2}}); historeg.add("TimeIn", "Time of cluster before cuts;#bf{#it{t} (ns)};#bf{#it{N}_{clusters}}", HistType::kTH1F, {{200, -100, 100}}); historeg.add("TimeOut", "Time of cluster after cuts;#bf{#it{t} (ns)};#bf{#it{N}_{clusters}}", HistType::kTH1F, {{200, -100, 100}}); - auto hCaloClusterFilter = historeg.add("hCaloClusterFilter", "hCaloClusterFilter", kTH1I, {{6, 0, 6}}); + auto hCaloClusterFilter = historeg.add("hCaloClusterFilter", "hCaloClusterFilter", kTH1I, {{7, 0, 7}}); hCaloClusterFilter->GetXaxis()->SetBinLabel(1, "in"); hCaloClusterFilter->GetXaxis()->SetBinLabel(2, "Definition cut"); hCaloClusterFilter->GetXaxis()->SetBinLabel(3, "E cut"); hCaloClusterFilter->GetXaxis()->SetBinLabel(4, "time cut"); hCaloClusterFilter->GetXaxis()->SetBinLabel(5, "M02 cut"); - hCaloClusterFilter->GetXaxis()->SetBinLabel(6, "out"); + hCaloClusterFilter->GetXaxis()->SetBinLabel(6, "exotic cut"); + hCaloClusterFilter->GetXaxis()->SetBinLabel(7, "out"); + + auto hCaloTrackFilter = historeg.add("hCaloTrackFilter", "hCaloTrackFilter", kTH1I, {{4, 0, 4}}); + hCaloTrackFilter->GetXaxis()->SetBinLabel(1, "in"); + hCaloTrackFilter->GetXaxis()->SetBinLabel(2, "#Delta#eta #Delta#varphi"); + hCaloTrackFilter->GetXaxis()->SetBinLabel(3, "E/p cut"); + hCaloTrackFilter->GetXaxis()->SetBinLabel(4, "out"); + LOG(info) << "| EMCal cluster cuts for skimming:"; LOG(info) << "| Timing cut: " << minTime << " < t < " << maxTime; LOG(info) << "| M02 cut: " << minM02 << " < M02 < " << maxM02; LOG(info) << "| E cut: E > " << minE; + LOG(info) << "| TM - dPhi cut: dPhi < " << maxdPhi; + LOG(info) << "| TM - dEta cut: dEta < " << maxdEta; + LOG(info) << "| TM - E/p cut: E/p < " << maxEoverP; } void processRec(soa::Join::iterator const& collision, aod::EMCALClusters const& emcclusters, aod::EMCALClusterCells const& emcclustercells, aod::EMCALMatchedTracks const& emcmatchedtracks, aod::FullTracks const&) @@ -103,16 +118,15 @@ struct SkimmerGammaCalo { historeg.fill(HIST("hCaloClusterFilter"), 0); historeg.fill(HIST("DefinitionIn"), emccluster.definition()); - historeg.fill(HIST("EIn"), emccluster.energy()); historeg.fill(HIST("M02In"), emccluster.m02()); historeg.fill(HIST("TimeIn"), emccluster.time()); + historeg.fill(HIST("EIn"), emccluster.energy()); // Definition cut if (!(std::find(clusterDefinitions.value.begin(), clusterDefinitions.value.end(), emccluster.definition()) != clusterDefinitions.value.end())) { historeg.fill(HIST("hCaloClusterFilter"), 1); continue; } - historeg.fill(HIST("EIn"), emccluster.energy()); // Energy cut if (emccluster.energy() < minE) { historeg.fill(HIST("hCaloClusterFilter"), 2); @@ -128,12 +142,11 @@ struct SkimmerGammaCalo { historeg.fill(HIST("hCaloClusterFilter"), 4); continue; } - historeg.fill(HIST("hCaloClusterFilter"), 5); - - historeg.fill(HIST("DefinitionOut"), emccluster.definition()); - historeg.fill(HIST("EOut"), emccluster.energy()); - historeg.fill(HIST("M02Out"), emccluster.m02()); - historeg.fill(HIST("TimeOut"), emccluster.time()); + if (removeExotic.value && emccluster.isExotic()) { + historeg.fill(HIST("hCaloClusterFilter"), 5); + continue; + } + historeg.fill(HIST("hCaloClusterFilter"), 6); // Skimmed cell table auto groupedCells = emcclustercells.sliceBy(psCellperCluster, emccluster.globalIndex()); @@ -154,10 +167,19 @@ struct SkimmerGammaCalo { vP.reserve(groupedMTs.size()); vPt.reserve(groupedMTs.size()); for (const auto& emcmatchedtrack : groupedMTs) { + historeg.fill(HIST("hCaloTrackFilter"), 0); + historeg.fill(HIST("MTEtaPhiBeforeTM"), emcmatchedtrack.deltaEta(), emcmatchedtrack.deltaPhi()); if (std::abs(emcmatchedtrack.deltaEta()) >= maxdEta || std::abs(emcmatchedtrack.deltaPhi()) >= maxdPhi) { + historeg.fill(HIST("hCaloTrackFilter"), 1); + continue; + } + historeg.fill(HIST("Eoverp"), emccluster.energy(), emccluster.energy() / emcmatchedtrack.track_as().p()); + if (emccluster.energy() / emcmatchedtrack.track_as().p() > maxEoverP) { + historeg.fill(HIST("hCaloTrackFilter"), 2); continue; } - historeg.fill(HIST("MTEtaPhi"), emccluster.eta() - emcmatchedtrack.track_as().trackEtaEmcal(), emccluster.phi() - emcmatchedtrack.track_as().trackPhiEmcal()); + historeg.fill(HIST("hCaloTrackFilter"), 3); + historeg.fill(HIST("MTEtaPhiAfterTM"), emcmatchedtrack.deltaEta(), emcmatchedtrack.deltaPhi()); vTrackIds.emplace_back(emcmatchedtrack.trackId()); vEta.emplace_back(emcmatchedtrack.deltaEta()); vPhi.emplace_back(emcmatchedtrack.deltaPhi()); @@ -165,6 +187,12 @@ struct SkimmerGammaCalo { vPt.emplace_back(emcmatchedtrack.track_as().pt()); } + historeg.fill(HIST("DefinitionOut"), emccluster.definition()); + historeg.fill(HIST("EOut"), emccluster.energy()); + historeg.fill(HIST("M02Out"), emccluster.m02()); + historeg.fill(HIST("TimeOut"), emccluster.time()); + historeg.fill(HIST("hCaloClusterFilter"), 6); + tableGammaEMCReco(emccluster.collisionId(), emccluster.definition(), emccluster.energy(), emccluster.eta(), emccluster.phi(), emccluster.m02(), emccluster.nCells(), emccluster.time(), emccluster.isExotic(), vPhi, vEta, vP, vPt); } diff --git a/PWGEM/PhotonMeson/Tasks/CMakeLists.txt b/PWGEM/PhotonMeson/Tasks/CMakeLists.txt index 332cafc0795..8dc5bdc0e01 100644 --- a/PWGEM/PhotonMeson/Tasks/CMakeLists.txt +++ b/PWGEM/PhotonMeson/Tasks/CMakeLists.txt @@ -172,3 +172,7 @@ o2physics_add_dpl_workflow(diphoton-hadron-mpc-pcmdalitzee PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGEMPhotonMesonCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(calib-task-emc + SOURCES calibTaskEmc.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::EMCALBase O2::EMCALCalib O2Physics::PWGEMPhotonMesonCore + COMPONENT_NAME Analysis) diff --git a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaEMCEMC.cxx b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaEMCEMC.cxx index 3b7893f7373..b1b657f8a1f 100644 --- a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaEMCEMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaEMCEMC.cxx @@ -9,25 +9,24 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // -// ======================== -// -// This code loops over photons and makes pairs for neutral mesons analyses. -// Please write to: daiki.sekihata@cern.ch - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" +/// \file Pi0EtaToGammaGammaEMCEMC.cxx +/// \brief This code loops over photons and makes pairs for neutral mesons analyses for EMC-EMC. +/// \author D. Sekihata, daiki.sekihata@cern.ch +#include "PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h" #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" #include "PWGEM/PhotonMeson/Utils/PairUtilities.h" -#include "PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h" + +#include +#include +#include using namespace o2; using namespace o2::aod; +using namespace o2::framework; +using namespace o2::aod::pwgem::photonmeson::photonpair; using MyEMCClusters = soa::Join; -using MyEMCCluster = MyEMCClusters::iterator; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCEMCEMC.cxx b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCEMCEMC.cxx index 7cd7ba3c492..982eba314e1 100644 --- a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCEMCEMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCEMCEMC.cxx @@ -9,25 +9,24 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // -// ======================== -// -// This code loops over photons and makes pairs for neutral mesons analyses. -// Please write to: daiki.sekihata@cern.ch - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" +/// \file Pi0EtaToGammaGammaMCEMCEMC.cxx +/// \brief This code loops over photons and makes pairs for neutral mesons analyses in MC for EMC-EMC. +/// \author D. Sekihata, daiki.sekihata@cern.ch +#include "PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h" #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" #include "PWGEM/PhotonMeson/Utils/PairUtilities.h" -#include "PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h" + +#include +#include +#include using namespace o2; using namespace o2::aod; +using namespace o2::framework; +using namespace o2::aod::pwgem::photonmeson::photonpair; using MyEMCClusters = soa::Join; -using MyEMCCluster = MyEMCClusters::iterator; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCPCMDalitzEE.cxx b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCPCMDalitzEE.cxx index 2d929f1a82a..e36da8a2556 100644 --- a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCPCMDalitzEE.cxx +++ b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCPCMDalitzEE.cxx @@ -9,31 +9,26 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // -// ======================== -// -// This code loops over photons and makes pairs for neutral mesons analyses. -// Please write to: daiki.sekihata@cern.ch - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" +/// \file Pi0EtaToGammaGammaMCPCMDalitzEE.cxx +/// \brief This code loops over photons and makes pairs for neutral mesons analyses in MC for PCM-Dalitz. +/// \author D. Sekihata, daiki.sekihata@cern.ch +#include "PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h" #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" #include "PWGEM/PhotonMeson/Utils/PairUtilities.h" -#include "PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h" + +#include +#include +#include using namespace o2; using namespace o2::aod; +using namespace o2::framework; +using namespace o2::aod::pwgem::photonmeson::photonpair; -// using MyV0Photons = soa::Join; -// using MyV0Photon = MyV0Photons::iterator; -// -// using MyMCV0Legs = soa::Join; -// using MyMCV0Leg = MyMCV0Legs::iterator; -// -// using MyMCElectrons = soa::Join; -// using MyMCElectron = MyMCElectrons::iterator; +using MyV0Photons = soa::Filtered>; +using MyMCV0Legs = soa::Join; +using MyMCElectrons = soa::Filtered>; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCPCMPCM.cxx b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCPCMPCM.cxx index 9b79891739c..62c57593fd0 100644 --- a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCPCMPCM.cxx +++ b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCPCMPCM.cxx @@ -9,28 +9,25 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // -// ======================== -// -// This code loops over photons and makes pairs for neutral mesons analyses. -// Please write to: daiki.sekihata@cern.ch - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" +/// \file Pi0EtaToGammaGammaMCPCMPCM.cxx +/// \brief This code loops over photons and makes pairs for neutral mesons analyses in MC for PCM-PCM. +/// \author D. Sekihata, daiki.sekihata@cern.ch +#include "PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h" #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" #include "PWGEM/PhotonMeson/Utils/PairUtilities.h" -#include "PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h" + +#include +#include +#include using namespace o2; using namespace o2::aod; +using namespace o2::framework; +using namespace o2::aod::pwgem::photonmeson::photonpair; -// using MyV0Photons = soa::Join; -// using MyV0Photon = MyV0Photons::iterator; - -// using MyMCV0Legs = soa::Join; -// using MyMCV0Leg = MyMCV0Legs::iterator; +using MyV0Photons = o2::soa::Filtered>; +using MyMCV0Legs = soa::Join; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaPCMDalitzEE.cxx b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaPCMDalitzEE.cxx index 15ccbe72bd4..b2c39f2093a 100644 --- a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaPCMDalitzEE.cxx +++ b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaPCMDalitzEE.cxx @@ -9,23 +9,25 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // -// ======================== -// -// This code loops over photons and makes pairs for neutral mesons analyses. -// Please write to: daiki.sekihata@cern.ch - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" +/// \file Pi0EtaToGammaGammaPCMDalitzEE.cxx +/// \brief This code loops over photons and makes pairs for neutral mesons analyses for PCM-Dalitz. +/// \author D. Sekihata, daiki.sekihata@cern.ch -#include "Common/Core/RecoDecay.h" +#include "PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h" #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" #include "PWGEM/PhotonMeson/Utils/PairUtilities.h" -#include "PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h" + +#include +#include +#include using namespace o2; using namespace o2::aod; +using namespace o2::framework; +using namespace o2::aod::pwgem::photonmeson::photonpair; + +using MyV0Photons = o2::soa::Filtered>; +using MyPrimaryElectrons = o2::soa::Filtered>; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaPCMPCM.cxx b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaPCMPCM.cxx index 24557c828a7..6272af75da6 100644 --- a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaPCMPCM.cxx +++ b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaPCMPCM.cxx @@ -9,25 +9,24 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // -// ======================== -// -// This code loops over photons and makes pairs for neutral mesons analyses. -// Please write to: daiki.sekihata@cern.ch - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" +/// \file Pi0EtaToGammaGammaPCMPCM.cxx +/// \brief This code loops over photons and makes pairs for neutral mesons analyses for PCM-PCM. +/// \author D. Sekihata, daiki.sekihata@cern.ch +#include "PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h" #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" #include "PWGEM/PhotonMeson/Utils/PairUtilities.h" -#include "PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h" + +#include +#include +#include using namespace o2; using namespace o2::aod; +using namespace o2::framework; +using namespace o2::aod::pwgem::photonmeson::photonpair; -// using MyV0Photons = soa::Join; -// using MyV0Photon = MyV0Photons::iterator; +using MyV0Photons = o2::soa::Filtered>; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGEM/PhotonMeson/Tasks/calibTaskEmc.cxx b/PWGEM/PhotonMeson/Tasks/calibTaskEmc.cxx new file mode 100644 index 00000000000..4df49aad167 --- /dev/null +++ b/PWGEM/PhotonMeson/Tasks/calibTaskEmc.cxx @@ -0,0 +1,1071 @@ +// 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 calibTaskEmc.cxx +/// \brief Task to produce calibration values for EMCal +/// \author M. Hemmer, marvin.hemmer@cern.ch + +#include "PWGEM/PhotonMeson/Core/EMCPhotonCut.h" +#include "PWGEM/PhotonMeson/Core/EMPhotonEventCut.h" +#include "PWGEM/PhotonMeson/Core/V0PhotonCut.h" +#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" +#include "PWGEM/PhotonMeson/Utils/EventHistograms.h" +#include "PWGEM/PhotonMeson/Utils/emcalHistoDefinitions.h" +// +#include "PWGEM/Dilepton/Utils/EMTrack.h" +#include "PWGEM/Dilepton/Utils/EventMixingHandler.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include // IWYU pragma: keep +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace o2; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; +using namespace o2::aod::pwgem::photon; + +enum QvecEstimator { + FT0M = 0, + FT0A = 1, + FT0C, + TPCPos, + TPCNeg, + TPCTot +}; + +enum CentralityEstimator { + None = 0, + CFT0A = 1, + CFT0C, + CFT0M, + NCentralityEstimators +}; + +enum Harmonics { + kNone = 0, + kDirect = 1, + kElliptic = 2, + kTriangluar = 3, + kQuadrangular = 4, + kPentagonal = 5, + kHexagonal = 6, + kHeptagonal = 7, + kOctagonal = 8 +}; + +struct CalibTaskEmc { + static constexpr float MinEnergy = 0.7f; + + // configurable for flow + Configurable centEstimator{"centEstimator", 2, "Centrality estimation (FT0A: 1, FT0C: 2, FT0M: 3)"}; + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable cfgDoRotation{"cfgDoRotation", false, "Flag to enable rotation background method"}; + Configurable cfgDownsampling{"cfgDownsampling", 1, "Calculate rotation background only for every collision"}; + Configurable cfgEMCalMapLevelBackground{"cfgEMCalMapLevelBackground", 4, "Different levels of correction for the background, the smaller number includes the level of the higher number (4: none, 3: only inside EMCal, 2: exclude bad channels, 1: remove edges)"}; + Configurable cfgEMCalMapLevelSameEvent{"cfgEMCalMapLevelSameEvent", 4, "Different levels of correction for the same event, the smaller number includes the level of the higher number (4: none, 3: only inside EMCal, 2: exclude bad channels, 1: remove edges)"}; + Configurable cfgRotAngle{"cfgRotAngle", std::move(const_cast(o2::constants::math::PIHalf)), "Angle used for the rotation method"}; + Configurable cfgDistanceToEdge{"cfgDistanceToEdge", 1, "Distance to edge in cells required for rotated cluster to be accepted"}; + Configurable cfgMaxAsymmetry{"cfgMaxAsymmetry", 0.1f, "Maximum allowed asymmetry for photon pairs used in calibration when using EMC-EMC."}; + + // configurable axis + ConfigurableAxis thnConfigAxisInvMass{"thnConfigAxisInvMass", {400, 0.0, 0.8}, ""}; + ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {100, 0., 20.}, ""}; + ConfigurableAxis thnConfigAxisCent{"thnConfigAxisCent", {20, 0., 100.}, ""}; + ConfigurableAxis thnConfigAxisEnergyCalib{"thnConfigAxisEnergyCalib", {200, 0., 20.}, ""}; + + EMPhotonEventCut fEMEventCut; + struct : ConfigurableGroup { + std::string prefix = "eventcuts"; + Configurable cfgZvtxMax{"cfgZvtxMax", 10.f, "max. Zvtx"}; + Configurable cfgRequireSel8{"cfgRequireSel8", true, "require sel8 in event cut"}; + Configurable cfgRequireFT0AND{"cfgRequireFT0AND", true, "require FT0AND in event cut"}; + Configurable cfgRequireNoTFB{"cfgRequireNoTFB", false, "require No time frame border in event cut"}; + Configurable cfgRequireNoITSROFB{"cfgRequireNoITSROFB", false, "require no ITS readout frame border in event cut"}; + Configurable cfgRequireNoSameBunchPileup{"cfgRequireNoSameBunchPileup", false, "require no same bunch pileup in event cut"}; + Configurable cfgRequireVertexITSTPC{"cfgRequireVertexITSTPC", false, "require Vertex ITSTPC in event cut"}; // ITS-TPC matched track contributes PV. + Configurable cfgRequireGoodZvtxFT0vsPV{"cfgRequireGoodZvtxFT0vsPV", false, "require good Zvtx between FT0 vs. PV in event cut"}; + Configurable cfgRequireEMCReadoutInMB{"cfgRequireEMCReadoutInMB", true, "require the EMC to be read out in an MB collision (kTVXinEMC)"}; + Configurable cfgRequireEMCHardwareTriggered{"cfgRequireEMCHardwareTriggered", false, "require the EMC to be hardware triggered (kEMC7 or kDMC7)"}; + Configurable cfgTrackOccupancyMin{"cfgTrackOccupancyMin", -1, "min. track occupancy"}; + Configurable cfgTrackOccupancyMax{"cfgTrackOccupancyMax", 1000000000, "max. track occupancy"}; + Configurable cfgFT0COccupancyMin{"cfgFT0COccupancyMin", -1, "min. FT0C occupancy"}; + Configurable cfgFT0COccupancyMax{"cfgFT0COccupancyMax", 1000000000, "max. FT0C occupancy"}; + Configurable cfgMinCent{"cfgMinCent", 0, "min. centrality (%)"}; + Configurable cfgMaxCent{"cfgMaxCent", 90, "max. centrality (%)"}; + Configurable onlyKeepWeightedEvents{"onlyKeepWeightedEvents", false, "flag to keep only weighted events (for JJ MCs) and remove all MB events (with weight = 1)"}; + Configurable cfgEnableQA{"cfgEnableQA", false, "flag to turn QA plots on/off"}; + } eventcuts; + + EMCPhotonCut fEMCCut; + struct : ConfigurableGroup { + std::string prefix = "emccuts"; + Configurable clusterDefinition{"clusterDefinition", "kV3Default", "Clusterizer to be selected, e.g. V3Default"}; + Configurable cfgEMCminTime{"cfgEMCminTime", -25., "Minimum cluster time for EMCal time cut"}; + Configurable cfgEMCmaxTime{"cfgEMCmaxTime", +30., "Maximum cluster time for EMCal time cut"}; + Configurable cfgEMCminM02{"cfgEMCminM02", 0.1, "Minimum M02 for EMCal M02 cut"}; + Configurable cfgEMCmaxM02{"cfgEMCmaxM02", 0.7, "Maximum M02 for EMCal M02 cut"}; + Configurable cfgEMCminE{"cfgEMCminE", 0.7, "Minimum cluster energy for EMCal energy cut"}; + Configurable cfgEMCminNCell{"cfgEMCminNCell", 1, "Minimum number of cells per cluster for EMCal NCell cut"}; + Configurable> cfgEMCTMEta{"cfgEMCTMEta", {0.01f, 4.07f, -2.5f}, "|eta| <= [0]+(pT+[1])^[2] for EMCal track matching"}; + Configurable> cfgEMCTMPhi{"cfgEMCTMPhi", {0.015f, 3.65f, -2.f}, "|phi| <= [0]+(pT+[1])^[2] for EMCal track matching"}; + Configurable cfgEMCEoverp{"cfgEMCEoverp", 1.75, "Minimum cluster energy over track momentum for EMCal track matching"}; + Configurable cfgEMCUseExoticCut{"cfgEMCUseExoticCut", true, "FLag to use the EMCal exotic cluster cut"}; + Configurable cfgEMCUseTM{"cfgEMCUseTM", true, "flag to use EMCal track matching cut or not"}; + Configurable cfgEnableQA{"cfgEnableQA", false, "flag to turn QA plots on/off"}; + } emccuts; + + V0PhotonCut fPCMPhotonCut; + struct : ConfigurableGroup { + std::string prefix = "pcmcuts"; + Configurable cfgRequireV0WithITSTPC{"cfgRequireV0WithITSTPC", false, "flag to select V0s with ITS-TPC matched tracks"}; + Configurable cfgRequireV0WithITSonly{"cfgRequireV0WithITSonly", false, "flag to select V0s with ITSonly tracks"}; + Configurable cfgRequireV0WithTPConly{"cfgRequireV0WithTPConly", false, "flag to select V0s with TPConly tracks"}; + Configurable cfgMinPtV0{"cfgMinPtV0", 0.1, "min pT for v0 photons at PV"}; + Configurable cfgMaxPtV0{"cfgMaxPtV0", 1e+10, "max pT for v0 photons at PV"}; + Configurable cfgMinEtaV0{"cfgMinEtaV0", -0.8, "min eta for v0 photons at PV"}; + Configurable cfgMaxEtaV0{"cfgMaxEtaV0", 0.8, "max eta for v0 photons at PV"}; + Configurable cfgMinV0Radius{"cfgMinV0Radius", 4.0, "min v0 radius"}; + Configurable cfgMaxV0Radius{"cfgMaxV0Radius", 90.0, "max v0 radius"}; + Configurable cfgMaxAlphaAP{"cfgMaxAlphaAP", 0.95, "max alpha for AP cut"}; + Configurable cfgMaxQtAP{"cfgMaxQtAP", 0.01, "max qT for AP cut"}; + Configurable cfgMinCosPA{"cfgMinCosPA", 0.999, "min V0 CosPA"}; + Configurable cfgMaxPCA{"cfgMaxPCA", 1.5, "max distance btween 2 legs"}; + Configurable cfgMaxChi2KF{"cfgMaxChi2KF", 1e+10, "max chi2/ndf with KF"}; + Configurable cfgRejectV0OnITSib{"cfgRejectV0OnITSib", true, "flag to reject V0s on ITSib"}; + + Configurable cfgMinNClusterTPC{"cfgMinNClusterTPC", 0, "min ncluster tpc"}; + Configurable cfgMinNCrossedRows{"cfgMinNCrossedRows", 40, "min ncrossed rows"}; + Configurable cfgMaxFracSharedClusterTPC{"cfgMaxFracSharedClusterTPC", 999.f, "max fraction of shared clusters in TPC"}; + Configurable cfgMaxChi2TPC{"cfgMaxChi2TPC", 4.0, "max chi2/NclsTPC"}; + Configurable cfgMaxChi2ITS{"cfgMaxChi2ITS", 36.0, "max chi2/NclsITS"}; + Configurable cfgMinTPCNSigmaEl{"cfgMinTPCNSigmaEl", -3.0, "min. TPC n sigma for electron"}; + Configurable cfgMaxTPCNSigmaEl{"cfgMaxTPCNSigmaEl", +3.0, "max. TPC n sigma for electron"}; + Configurable cfgDisableITSOnly{"cfgDisableITSOnly", false, "flag to disable ITSonly tracks"}; + Configurable cfgDisableTPCOnly{"cfgDisableTPCOnly", false, "flag to disable TPConly tracks"}; + } pcmcuts; + + struct : ConfigurableGroup { + std::string prefix = "mesonConfig"; + Configurable minOpenAngle{"minOpenAngle", 0.0202, "apply min opening angle. Default value one EMCal cell"}; + Configurable enableTanThetadPhi{"enableTanThetadPhi", false, "flag to turn cut opening angle in delta theta delta phi on/off"}; + Configurable minTanThetadPhi{"minTanThetadPhi", 4., "apply min opening angle in delta theta delta phi to cut on late conversion"}; + Configurable cfgEnableQA{"cfgEnableQA", false, "flag to turn QA plots on/off"}; + ConfigurableAxis thConfigAxisTanThetaPhi{"thConfigAxisTanThetaPhi", {180, -90.f, 90.f}, ""}; + } mesonConfig; + + struct : ConfigurableGroup { + std::string prefix = "mixingConfig"; + ConfigurableAxis cfgVtxBins{"cfgVtxBins", {VARIABLE_WIDTH, -10.0f, -9.0f, -8.f, -7.0f, -6.f, -5.0f, -4.f, -3.f, -2.f, -1.f, 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f, 10.f}, "Mixing bins - z-vertex"}; + ConfigurableAxis cfgCentBins{"cfgCentBins", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.f}, "Mixing bins - centrality"}; + Configurable cfgMixingDepth{"cfgMixingDepth", 2, "Mixing depth"}; + } mixingConfig; + + SliceCache cache; + o2::framework::Service ccdb; + int runNow = 0; + int runBefore = -1; + + // Filter clusterFilter = aod::skimmedcluster::time >= emccuts.cfgEMCminTime && aod::skimmedcluster::time <= emccuts.cfgEMCmaxTime && aod::skimmedcluster::m02 >= emccuts.cfgEMCminM02 && aod::skimmedcluster::m02 <= emccuts.cfgEMCmaxM02 && skimmedcluster::e >= emccuts.cfgEMCminE; + // Filter collisionFilter = (nabs(aod::collision::posZ) <= eventcuts.cfgZvtxMax) && (aod::evsel::ft0cOccupancyInTimeRange <= eventcuts.cfgFT0COccupancyMax) && (aod::evsel::ft0cOccupancyInTimeRange >= eventcuts.cfgFT0COccupancyMin); + // using FilteredEMCalPhotons = soa::Filtered>; + using EMCalPhotons = soa::Join; + using PCMPhotons = soa::Join; + using Colls = soa::Join; + + // for event mixing + using MyEMH = o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, o2::aod::pwgem::dilepton::utils::EMTrack>; + MyEMH* emh1 = nullptr; + MyEMH* emh2 = nullptr; + + Preslice perCollisionEMC = aod::emccluster::emeventId; + Preslice perCollisionPCM = aod::v0photonkf::emeventId; + + using BinningType = ColumnBinningPolicy; + BinningType binningOnPositions{{mixingConfig.cfgVtxBins, mixingConfig.cfgCentBins}, true}; + Pair pairPCMEMC{binningOnPositions, mixingConfig.cfgMixingDepth, -1, &cache}; // indicates that mixingConfig.cfgMixingDepth events should be mixed and under/overflow (-1) to be ignored + + HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; + + o2::emcal::Geometry* emcalGeom; + o2::emcal::BadChannelMap* mBadChannels; + // Constants for eta and phi ranges + double etaMin = -0.75, etaMax = 0.75; + int nBinsEta = 150; // 150 bins for eta + + double phiMin = 1.35, phiMax = 5.75; + int nBinsPhi = 440; // (440 bins = 0.01 step size covering most regions) + + std::vector lookupTable1D; + float epsilon = 1.e-8; + + // static constexpr + static constexpr int64_t NMinPhotonRotBkg = 3; + static constexpr int64_t NMinPhotonRotBkgMixed = 2; + + // Usage when cfgEnableNonLin is enabled + std::unique_ptr fEMCalCorrectionFactor; // ("fEMCalCorrectionFactor","(1 + [0]/x + [1]/x^2) / (1 + [2]/x)", 0.3, 100.); + + // To access the 1D array + inline int getIndex(int iEta, int iPhi) + { + return iEta * nBinsPhi + iPhi; + } + + // Function to access the lookup table + inline int8_t checkEtaPhi1D(double eta, double phi) + { + if (eta < etaMin || eta > etaMax || phi < phiMin || phi > phiMax) { + return 3; // Out of bounds + } + + // Compute indices directly + int iEta = static_cast((eta - etaMin) / ((etaMax - etaMin) / nBinsEta)); + int iPhi = static_cast((phi - phiMin) / ((phiMax - phiMin) / nBinsPhi)); + + return lookupTable1D[getIndex(iEta, iPhi)]; + } + + void defineEMEventCut() + { + fEMEventCut = EMPhotonEventCut("fEMEventCut", "fEMEventCut"); + fEMEventCut.SetRequireSel8(eventcuts.cfgRequireSel8); + fEMEventCut.SetRequireFT0AND(eventcuts.cfgRequireFT0AND); + fEMEventCut.SetZvtxRange(-eventcuts.cfgZvtxMax, +eventcuts.cfgZvtxMax); + fEMEventCut.SetRequireNoTFB(eventcuts.cfgRequireNoTFB); + fEMEventCut.SetRequireNoITSROFB(eventcuts.cfgRequireNoITSROFB); + fEMEventCut.SetRequireNoSameBunchPileup(eventcuts.cfgRequireNoSameBunchPileup); + fEMEventCut.SetRequireVertexITSTPC(eventcuts.cfgRequireVertexITSTPC); + fEMEventCut.SetRequireGoodZvtxFT0vsPV(eventcuts.cfgRequireGoodZvtxFT0vsPV); + fEMEventCut.SetRequireEMCReadoutInMB(eventcuts.cfgRequireEMCReadoutInMB); + fEMEventCut.SetRequireEMCHardwareTriggered(eventcuts.cfgRequireEMCHardwareTriggered); + } + + void defineEMCCut() + { + fEMCCut = EMCPhotonCut("fEMCCut", "fEMCCut"); + const float a = emccuts.cfgEMCTMEta->at(0); + const float b = emccuts.cfgEMCTMEta->at(1); + const float c = emccuts.cfgEMCTMEta->at(2); + + const float d = emccuts.cfgEMCTMPhi->at(0); + const float e = emccuts.cfgEMCTMPhi->at(1); + const float f = emccuts.cfgEMCTMPhi->at(2); + LOGF(info, "EMCal track matching parameters : a = %f, b = %f, c = %f, d = %f, e = %f, f = %f", a, b, c, d, e, f); + fEMCCut.SetTrackMatchingEta([a, b, c](float pT) { return a + std::pow(pT + b, c); }); + fEMCCut.SetTrackMatchingPhi([d, e, f](float pT) { return d + std::pow(pT + e, f); }); + fEMCCut.SetMinEoverP(emccuts.cfgEMCEoverp); + + fEMCCut.SetMinE(emccuts.cfgEMCminE); + fEMCCut.SetMinNCell(emccuts.cfgEMCminNCell); + fEMCCut.SetM02Range(emccuts.cfgEMCminM02, emccuts.cfgEMCmaxM02); + fEMCCut.SetTimeRange(emccuts.cfgEMCminTime, emccuts.cfgEMCmaxTime); + fEMCCut.SetUseExoticCut(emccuts.cfgEMCUseExoticCut); + fEMCCut.SetClusterizer(emccuts.clusterDefinition); + } + + void DefinePCMCut() + { + fPCMPhotonCut = V0PhotonCut("fPCMPhotonCut", "fPCMPhotonCut"); + + // for v0 + fPCMPhotonCut.SetV0PtRange(pcmcuts.cfgMinPtV0, pcmcuts.cfgMaxPtV0); + fPCMPhotonCut.SetV0EtaRange(pcmcuts.cfgMinEtaV0, pcmcuts.cfgMaxEtaV0); + fPCMPhotonCut.SetMinCosPA(pcmcuts.cfgMinCosPA); + fPCMPhotonCut.SetMaxPCA(pcmcuts.cfgMaxPCA); + fPCMPhotonCut.SetMaxChi2KF(pcmcuts.cfgMaxChi2KF); + fPCMPhotonCut.SetRxyRange(pcmcuts.cfgMinV0Radius, pcmcuts.cfgMaxV0Radius); + fPCMPhotonCut.SetAPRange(pcmcuts.cfgMaxAlphaAP, pcmcuts.cfgMaxQtAP); + fPCMPhotonCut.RejectITSib(pcmcuts.cfgRejectV0OnITSib); + + // for track + fPCMPhotonCut.SetMinNClustersTPC(pcmcuts.cfgMinNClusterTPC); + fPCMPhotonCut.SetMinNCrossedRowsTPC(pcmcuts.cfgMinNCrossedRows); + fPCMPhotonCut.SetMinNCrossedRowsOverFindableClustersTPC(0.8); + fPCMPhotonCut.SetMaxFracSharedClustersTPC(pcmcuts.cfgMaxFracSharedClusterTPC); + fPCMPhotonCut.SetChi2PerClusterTPC(0.0, pcmcuts.cfgMaxChi2TPC); + fPCMPhotonCut.SetTPCNsigmaElRange(pcmcuts.cfgMinTPCNSigmaEl, pcmcuts.cfgMaxTPCNSigmaEl); + fPCMPhotonCut.SetChi2PerClusterITS(-1e+10, pcmcuts.cfgMaxChi2ITS); + fPCMPhotonCut.SetNClustersITS(0, 7); + fPCMPhotonCut.SetMeanClusterSizeITSob(0.0, 16.0); + fPCMPhotonCut.SetDisableITSonly(pcmcuts.cfgDisableITSOnly); + fPCMPhotonCut.SetDisableTPConly(pcmcuts.cfgDisableTPCOnly); + fPCMPhotonCut.SetRequireITSTPC(pcmcuts.cfgRequireV0WithITSTPC); + fPCMPhotonCut.SetRequireITSonly(pcmcuts.cfgRequireV0WithITSonly); + fPCMPhotonCut.SetRequireTPConly(pcmcuts.cfgRequireV0WithTPConly); + } + + void init(InitContext&) + { + defineEMEventCut(); + defineEMCCut(); + fEMCCut.SetUseTM(emccuts.cfgEMCUseTM); // disables TM + o2::aod::pwgem::photonmeson::utils::eventhistogram::addEventHistograms(®istry); + + const AxisSpec thnAxisInvMass{thnConfigAxisInvMass, "#it{M}_{#gamma#gamma} (GeV/#it{c}^{2})"}; + const AxisSpec thnAxisPt{thnConfigAxisPt, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec thnAxisCent{thnConfigAxisCent, "Centrality (%)"}; + const AxisSpec thAxisTanThetaPhi{mesonConfig.thConfigAxisTanThetaPhi, "atan(#Delta#theta/#Delta#varphi)"}; + const AxisSpec thAxisClusterEnergy{thnConfigAxisPt, "#it{E} (GeV)"}; + const AxisSpec thAxisEnergyCalib{thnConfigAxisEnergyCalib, "#it{E}_{clus} (GeV)"}; + const AxisSpec thAxisAlpha{100, -1., +1, "#alpha"}; + const AxisSpec thAxisEnergy{1000, 0., 100., "#it{E}_{clus} (GeV)"}; + + registry.add("hSparseCalibSE", "THn for Calib same event", HistType::kTHnSparseF, {thnAxisInvMass, thAxisEnergyCalib, thnAxisCent}); + registry.add("hSparseCalibBack", "THn for Calib background", HistType::kTHnSparseF, {thnAxisInvMass, thAxisEnergyCalib, thnAxisCent}); + + auto hClusterCuts = registry.add("hClusterCuts", "hClusterCuts;;Counts", kTH1D, {{6, 0.5, 6.5}}, false); + hClusterCuts->GetXaxis()->SetBinLabel(1, "in"); + hClusterCuts->GetXaxis()->SetBinLabel(2, "opening angle"); + hClusterCuts->GetXaxis()->SetBinLabel(3, "#it{M}_{#gamma#gamma}"); + hClusterCuts->GetXaxis()->SetBinLabel(4, "#it{p}_{T}"); + hClusterCuts->GetXaxis()->SetBinLabel(5, "conversion cut"); + hClusterCuts->GetXaxis()->SetBinLabel(6, "out"); + + auto hClusterCutsMixed = registry.add("hClusterCutsMixed", "hClusterCutsMixed;;Counts", kTH1D, {{6, 0.5, 6.5}}, false); + hClusterCutsMixed->GetXaxis()->SetBinLabel(1, "in"); + hClusterCutsMixed->GetXaxis()->SetBinLabel(2, "opening angle"); + hClusterCutsMixed->GetXaxis()->SetBinLabel(3, "#it{M}_{#gamma#gamma}"); + hClusterCutsMixed->GetXaxis()->SetBinLabel(4, "#it{p}_{T}"); + hClusterCutsMixed->GetXaxis()->SetBinLabel(5, "conversion cut"); + hClusterCutsMixed->GetXaxis()->SetBinLabel(6, "out"); + + if (eventcuts.cfgEnableQA) { + auto hCollisionEMCCheck = registry.add("hCollisionEMCCheck", "collision counter;;Counts", kTH1D, {{7, 0.5, 7.5}}, false); + hCollisionEMCCheck->GetXaxis()->SetBinLabel(1, "all"); + hCollisionEMCCheck->GetXaxis()->SetBinLabel(2, "EMC MB Readout"); + hCollisionEMCCheck->GetXaxis()->SetBinLabel(3, "has clusters"); + hCollisionEMCCheck->GetXaxis()->SetBinLabel(4, "EMC MB Readout & has clusters"); + hCollisionEMCCheck->GetXaxis()->SetBinLabel(5, "EMC MB Readout but no clusters"); + hCollisionEMCCheck->GetXaxis()->SetBinLabel(6, "No EMC MB Readout but has clusters"); + hCollisionEMCCheck->GetXaxis()->SetBinLabel(7, "No EMC MB Readout and no clusters"); + } + + if (emccuts.cfgEnableQA) { + registry.add("hEClusterBefore", "Histo for cluster energy before cuts", HistType::kTH1D, {thAxisClusterEnergy}); + registry.add("hEClusterAfter", "Histo for cluster energy after cuts", HistType::kTH1D, {thAxisClusterEnergy}); + } + + if (mesonConfig.cfgEnableQA) { + registry.add("hInvMassPt", "Histo for inv pair mass vs pt", HistType::kTH2D, {thnAxisInvMass, thnAxisPt}); + registry.add("hTanThetaPhi", "Histo for identification of conversion cluster", HistType::kTH2D, {thnAxisInvMass, thAxisTanThetaPhi}); + registry.add("hAlphaPt", "Histo of meson asymmetry vs pT", HistType::kTH2D, {thAxisAlpha, thnAxisPt}); + registry.add("hInvMassPtMixed", "Histo for inv pair mass vs pt for mixed event", HistType::kTH2D, {thnAxisInvMass, thnAxisPt}); + registry.add("hTanThetaPhiMixed", "Histo for identification of conversion cluster for mixed event", HistType::kTH2D, {thnAxisInvMass, thAxisTanThetaPhi}); + registry.add("hAlphaPtMixed", "Histo of meson asymmetry vs pT for mixed event", HistType::kTH2D, {thAxisAlpha, thnAxisPt}); + } + + ccdb->setURL(ccdbUrl); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setFatalWhenNull(false); + + LOG(info) << "thnConfigAxisInvMass.value[1] = " << thnConfigAxisInvMass.value[1] << " thnConfigAxisInvMass.value.back() = " << thnConfigAxisInvMass.value.back(); + LOG(info) << "thnConfigAxisPt.value[1] = " << thnConfigAxisPt.value[1] << " thnConfigAxisPt.value.back() = " << thnConfigAxisPt.value.back(); + + fEMCalCorrectionFactor = std::make_unique("fEMCalCorrectionFactor", "(1 + [0]/x + [1]/x^2) / (1 + [2]/x)", 0.3, 100.); + fEMCalCorrectionFactor->SetParameters(-5.33426e-01, 1.40144e-02, -5.24434e-01); + }; // end init + + /// Change radians to degree + /// \param angle in radians + /// \return angle in degree + float getAngleDegree(float angle) + { + return angle * 180.f * std::numbers::inv_pi_v; + } + + /// Get the centrality + /// \param collision is the collision with the centrality information + template + float getCentrality(TCollision const& collision) + { + float cent = -999.; + switch (centEstimator) { + case CentralityEstimator::CFT0M: + cent = collision.centFT0M(); + break; + case CentralityEstimator::CFT0A: + cent = collision.centFT0A(); + break; + case CentralityEstimator::CFT0C: + cent = collision.centFT0C(); + break; + default: + LOG(warning) << "Centrality estimator not valid. Possible values are T0M, T0A, T0C. Fallback to T0C"; + cent = collision.centFT0C(); + break; + } + return cent; + } + + bool isTooCloseToEdge(const int cellID, const int DistanceToBorder = 1) + { + if (DistanceToBorder <= 0) { + return false; + } + if (cellID < 0) { + return true; + } + + int iBadCell = -1; + + // check distance to border in case the cell is okay + auto [iSupMod, iMod, iPhi, iEta] = emcalGeom->GetCellIndex(cellID); + auto [irow, icol] = emcalGeom->GetCellPhiEtaIndexInSModule(iSupMod, iMod, iPhi, iEta); + + // Check rows/phi + int iRowLast = 24; + if (emcalGeom->GetSMType(iSupMod) == o2::emcal::EMCALSMType::EMCAL_HALF) { + iRowLast /= 2; // 2/3 sm case + } else if (emcalGeom->GetSMType(iSupMod) == o2::emcal::EMCALSMType::EMCAL_THIRD) { + iRowLast /= 3; // 1/3 sm case + } else if (emcalGeom->GetSMType(iSupMod) == o2::emcal::EMCALSMType::DCAL_EXT) { + iRowLast /= 3; // 1/3 sm case + } + + if (irow < DistanceToBorder || (iRowLast - irow) <= DistanceToBorder) { + iBadCell = 1; + } + + if (iBadCell > 0) { + return true; + } + return false; + } + + bool isCellMasked(int cellID) + { + bool masked = false; + if (mBadChannels) { + auto maskStatus = mBadChannels->getChannelStatus(cellID); + masked = (maskStatus != o2::emcal::BadChannelMap::MaskType_t::GOOD_CELL); + } + return masked; + } + + template + void initCCDB(TCollision const& collision) + { + // Load EMCal geometry + emcalGeom = o2::emcal::Geometry::GetInstanceFromRunNumber(collision.runNumber()); + // Load Bad Channel map + mBadChannels = ccdb->getForTimeStamp("EMC/Calib/BadChannelMap", collision.timestamp()); + lookupTable1D = std::vector(nBinsEta * nBinsPhi, -1); + double binWidthEta = (etaMax - etaMin) / nBinsEta; + double binWidthPhi = (phiMax - phiMin) / nBinsPhi; + + for (int iEta = 0; iEta < nBinsEta; ++iEta) { + double etaCenter = etaMin + (iEta + 0.5) * binWidthEta; + for (int iPhi = 0; iPhi < nBinsPhi; ++iPhi) { + double phiCenter = phiMin + (iPhi + 0.5) * binWidthPhi; + try { + // Get the cell ID + int cellID = emcalGeom->GetAbsCellIdFromEtaPhi(etaCenter, phiCenter); + + // Check conditions for the cell + if (isTooCloseToEdge(cellID, 1)) { + lookupTable1D[getIndex(iEta, iPhi)] = 2; // Edge + } else if (isCellMasked(cellID)) { + lookupTable1D[getIndex(iEta, iPhi)] = 1; // Bad + } else { + lookupTable1D[getIndex(iEta, iPhi)] = 0; // Good + } + } catch (o2::emcal::InvalidPositionException& e) { + lookupTable1D[getIndex(iEta, iPhi)] = 3; // Outside geometry + } + } + } + } + + /// \brief Calculate background using rotation background method for calib + template + void rotationBackgroundCalib(const ROOT::Math::PtEtaPhiMVector& meson, ROOT::Math::PtEtaPhiMVector photon1, ROOT::Math::PtEtaPhiMVector photon2, TPhotons const& photons_coll, unsigned int ig1, unsigned int ig2, TCollision const& collision) + { + // if less than 3 clusters are present skip event since we need at least 3 clusters + if (photons_coll.size() < NMinPhotonRotBkg) { + return; + } + float cent = getCentrality(collision); + int iCellIDPhoton1 = 0; + int iCellIDPhoton2 = 0; + + ROOT::Math::AxisAngle rotationAxis(meson.Vect(), cfgRotAngle.value); + ROOT::Math::Rotation3D rotationMatrix(rotationAxis); + photon1 = rotationMatrix * photon1; + photon2 = rotationMatrix * photon2; + + if (checkEtaPhi1D(photon1.Eta(), RecoDecay::constrainAngle(photon1.Phi())) >= cfgEMCalMapLevelBackground.value) { + iCellIDPhoton1 = -1; + } + if (checkEtaPhi1D(photon2.Eta(), RecoDecay::constrainAngle(photon2.Phi())) >= cfgEMCalMapLevelBackground.value) { + iCellIDPhoton2 = -1; + } + + if (iCellIDPhoton1 == -1 && iCellIDPhoton2 == -1) { + return; + } + for (const auto& photon : photons_coll) { + if (photon.globalIndex() == ig1 || photon.globalIndex() == ig2) { + // only combine rotated photons with other photons + continue; + } + if (!(fEMCCut.IsSelected(photon))) { + continue; + } + if (checkEtaPhi1D(photon.eta(), RecoDecay::constrainAngle(photon.phi())) >= cfgEMCalMapLevelBackground.value) { + continue; + } + float energyCorrectionFactor = 1.f; + energyCorrectionFactor = fEMCalCorrectionFactor->Eval(photon.e() > MinEnergy ? photon.e() : MinEnergy); + ROOT::Math::PtEtaPhiMVector photon3(energyCorrectionFactor * photon.pt(), photon.eta(), photon.phi(), 0.); + if (iCellIDPhoton1 >= 0) { + if (std::fabs((photon1.E() - photon3.E()) / (photon1.E() + photon3.E()) < cfgMaxAsymmetry)) { // only use symmetric decays + ROOT::Math::PtEtaPhiMVector mother1 = photon1 + photon3; + float openingAngle1 = std::acos(photon1.Vect().Dot(photon3.Vect()) / (photon1.P() * photon3.P())); + + if (openingAngle1 > mesonConfig.minOpenAngle && thnConfigAxisInvMass.value[1] <= mother1.M() && thnConfigAxisInvMass.value.back() >= mother1.M() && thnConfigAxisPt.value[1] <= mother1.Pt() && thnConfigAxisPt.value.back() >= mother1.Pt()) { + if (mesonConfig.enableTanThetadPhi) { + float dTheta = photon1.Theta() - photon3.Theta(); + float dPhi = photon1.Phi() - photon3.Phi(); + if (mesonConfig.enableTanThetadPhi && mesonConfig.minTanThetadPhi > std::fabs(getAngleDegree(std::atan(dTheta / dPhi)))) { + registry.fill(HIST("hSparseCalibBack"), mother1.M(), mother1.E() / 2., cent); + } + } else { + registry.fill(HIST("hSparseCalibBack"), mother1.M(), mother1.E() / 2., cent); + } + } + } + } + if (iCellIDPhoton2 >= 0) { + if (std::fabs((photon2.E() - photon3.E()) / (photon2.E() + photon3.E()) < cfgMaxAsymmetry)) { // only use symmetric decays + ROOT::Math::PtEtaPhiMVector mother2 = photon2 + photon3; + float openingAngle2 = std::acos(photon2.Vect().Dot(photon3.Vect()) / (photon2.P() * photon3.P())); + + if (openingAngle2 > mesonConfig.minOpenAngle && thnConfigAxisInvMass.value[1] <= mother2.M() && thnConfigAxisInvMass.value.back() >= mother2.M() && thnConfigAxisPt.value[1] <= mother2.Pt() && thnConfigAxisPt.value.back() >= mother2.Pt()) { + if (mesonConfig.enableTanThetadPhi) { + float dTheta = photon2.Theta() - photon3.Theta(); + float dPhi = photon2.Phi() - photon3.Phi(); + if (mesonConfig.enableTanThetadPhi && mesonConfig.minTanThetadPhi > std::fabs(getAngleDegree(std::atan(dTheta / dPhi)))) { + registry.fill(HIST("hSparseCalibBack"), mother2.M(), mother2.E() / 2., cent); + } + } else { + registry.fill(HIST("hSparseCalibBack"), mother2.M(), mother2.E() / 2., cent); + } + } + } + } + } // end of loop over third photon + return; + } + + /// \brief Calculate background using rotation background method for calib + /// \param meson mother particle from photon1 & photon2 which defines rotation axis + /// \param photon1 first photon (EMC) which will be rotated + /// \param photon2 second photon (PCM) which will be rotated + /// \param photonsEMC sub table of EMC photons of current event which will be combined with rotated photon2 + /// \param photonsPCM sub table of PCM photons of current event which will be combined with rotated photon1 + /// \param ig1 index of photon1 + /// \param ig2 index of photon2 + /// \param cent current collisions centrality + template + void rotationBackgroundCalibEMCPCM(const ROOT::Math::PtEtaPhiMVector& meson, ROOT::Math::PtEtaPhiMVector photon1, ROOT::Math::PtEtaPhiMVector photon2, TPhotonEMC const& photonsEMC, TPhotonPCM const& photonsPCM, unsigned int ig1, unsigned int ig2, float cent) + { + // we need at least 2 clusters or 2 pcm photons for rotation + if (photonsEMC.size() < NMinPhotonRotBkgMixed || photonsPCM.size() < NMinPhotonRotBkgMixed) { + return; + } + int iCellIDPhoton1 = 0; + int iCellIDPhoton2 = 0; + + ROOT::Math::AxisAngle rotationAxis(meson.Vect(), cfgRotAngle.value); + ROOT::Math::Rotation3D rotationMatrix(rotationAxis); + photon1 = rotationMatrix * photon1; + photon2 = rotationMatrix * photon2; + + if (checkEtaPhi1D(photon1.Eta(), RecoDecay::constrainAngle(photon1.Phi())) >= cfgEMCalMapLevelBackground.value) { + iCellIDPhoton1 = -1; + } + + if (iCellIDPhoton1 == -1 && iCellIDPhoton2 == -1) { + return; + } + // Combining with EMCal photons from event + if (photonsEMC.size() >= NMinPhotonRotBkgMixed) { + for (const auto& photon : photonsEMC) { + if (photon.globalIndex() == ig1) { + continue; + } + if (!(fEMCCut.IsSelected(photon))) { + continue; + } + if (checkEtaPhi1D(photon.eta(), RecoDecay::constrainAngle(photon.phi())) >= cfgEMCalMapLevelBackground.value) { + continue; + } + float energyCorrectionFactor = 1.f; + energyCorrectionFactor = fEMCalCorrectionFactor->Eval(photon.e() > MinEnergy ? photon.e() : MinEnergy); + ROOT::Math::PtEtaPhiMVector photon3(energyCorrectionFactor * photon.pt(), photon.eta(), photon.phi(), 0.); + if (iCellIDPhoton2 >= 0) { + ROOT::Math::PtEtaPhiMVector mother = photon2 + photon3; + float openingAngle2 = std::acos(photon2.Vect().Dot(photon3.Vect()) / (photon2.P() * photon3.P())); + + if (openingAngle2 > mesonConfig.minOpenAngle && thnConfigAxisInvMass.value[1] <= mother.M() && thnConfigAxisInvMass.value.back() >= mother.M() && thnConfigAxisPt.value[1] <= mother.Pt() && thnConfigAxisPt.value.back() >= mother.Pt()) { + if (mesonConfig.enableTanThetadPhi) { + float dTheta = photon2.Theta() - photon3.Theta(); + float dPhi = photon2.Phi() - photon3.Phi(); + if (mesonConfig.enableTanThetadPhi && mesonConfig.minTanThetadPhi > std::fabs(getAngleDegree(std::atan(dTheta / dPhi)))) { + registry.fill(HIST("hSparseCalibBack"), mother.M(), mother.E() / 2., cent); + } + } else { + registry.fill(HIST("hSparseCalibBack"), mother.M(), mother.E() / 2., cent); + } + } + } + } // end of loop over third photon + } // check that we have at least 2 clusters + + // Combining with PCM photons from event + if (photonsPCM.size() >= NMinPhotonRotBkgMixed) { + for (const auto& photon : photonsPCM) { + if (photon.globalIndex() == ig2) { + continue; + } + if (!(fPCMPhotonCut.IsSelected(photon))) { + continue; + } + ROOT::Math::PtEtaPhiMVector photon3(photon.pt(), photon.eta(), photon.phi(), 0.); + if (iCellIDPhoton1 >= 0) { + ROOT::Math::PtEtaPhiMVector mother = photon1 + photon3; + float openingAngle2 = std::acos(photon1.Vect().Dot(photon3.Vect()) / (photon1.P() * photon3.P())); + + if (openingAngle2 > mesonConfig.minOpenAngle && thnConfigAxisInvMass.value[1] <= mother.M() && thnConfigAxisInvMass.value.back() >= mother.M() && thnConfigAxisPt.value[1] <= mother.Pt() && thnConfigAxisPt.value.back() >= mother.Pt()) { + if (mesonConfig.enableTanThetadPhi) { + float dTheta = photon1.Theta() - photon3.Theta(); + float dPhi = photon1.Phi() - photon3.Phi(); + if (mesonConfig.enableTanThetadPhi && mesonConfig.minTanThetadPhi > std::fabs(getAngleDegree(std::atan(dTheta / dPhi)))) { + registry.fill(HIST("hSparseCalibBack"), mother.M(), mother.E() / 2., cent); + } + } else { + registry.fill(HIST("hSparseCalibBack"), mother.M(), mother.E() / 2., cent); + } + } + } + } // end of loop over third photon + } // check that we have at least 2 clusters + return; + } + + // EMCal calibration same event + void processEMCalCalib(Colls const& collisions, EMCalPhotons const& clusters, PCMPhotons const&) + { + float energyCorrectionFactor = 1.f; + int nColl = 1; + for (const auto& collision : collisions) { + auto photonsPerCollision = clusters.sliceBy(perCollisionEMC, collision.globalIndex()); + o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<0>(®istry, collision); + if (!(fEMEventCut.IsSelected(collision))) { + // general event selection + continue; + } + if (!(eventcuts.cfgFT0COccupancyMin <= collision.ft0cOccupancyInTimeRange() && collision.ft0cOccupancyInTimeRange() < eventcuts.cfgFT0COccupancyMax)) { + // occupancy selection + continue; + } + float cent = getCentrality(collision); + if (cent < eventcuts.cfgMinCent || cent > eventcuts.cfgMaxCent) { + // event selection + continue; + } + runNow = collision.runNumber(); + if (runNow != runBefore) { + initCCDB(collision); + runBefore = runNow; + } + o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<1>(®istry, collision); + registry.fill(HIST("Event/before/hCollisionCounter"), 12.0); // accepted + registry.fill(HIST("Event/after/hCollisionCounter"), 12.0); // accepted + + if (emccuts.cfgEnableQA) { + for (const auto& photon : photonsPerCollision) { + registry.fill(HIST("hEClusterBefore"), photon.e()); // before cuts + if (!(fEMCCut.IsSelected(photon))) { + continue; + } + registry.fill(HIST("hEClusterAfter"), photon.e()); // accepted after cuts + } + } + for (const auto& [g1, g2] : combinations(CombinationsStrictlyUpperIndexPolicy(photonsPerCollision, photonsPerCollision))) { + if (!(fEMCCut.IsSelected(g1)) || !(fEMCCut.IsSelected(g2))) { + continue; + } + + // Cut edge clusters away, similar to rotation method to ensure same acceptance is used + if (cfgDistanceToEdge.value) { + if (checkEtaPhi1D(g1.eta(), RecoDecay::constrainAngle(g1.phi())) >= cfgEMCalMapLevelSameEvent.value) { + continue; + } + if (checkEtaPhi1D(g2.eta(), RecoDecay::constrainAngle(g2.phi())) >= cfgEMCalMapLevelSameEvent.value) { + continue; + } + } + + energyCorrectionFactor = fEMCalCorrectionFactor->Eval(g1.e() > MinEnergy ? g1.e() : MinEnergy); + ROOT::Math::PtEtaPhiMVector v1(energyCorrectionFactor * g1.pt(), g1.eta(), g1.phi(), 0.); + energyCorrectionFactor = fEMCalCorrectionFactor->Eval(g2.e() > MinEnergy ? g2.e() : MinEnergy); + ROOT::Math::PtEtaPhiMVector v2(energyCorrectionFactor * g2.pt(), g2.eta(), g2.phi(), 0.); + ROOT::Math::PtEtaPhiMVector vMeson = v1 + v2; + + float dTheta = v1.Theta() - v2.Theta(); + float dPhi = v1.Phi() - v2.Phi(); + float openingAngle = std::acos(v1.Vect().Dot(v2.Vect()) / (v1.P() * v2.P())); + registry.fill(HIST("hClusterCuts"), 1); + if (openingAngle <= mesonConfig.minOpenAngle) { + registry.fill(HIST("hClusterCuts"), 2); + continue; + } + if (cfgDoRotation) { + if (nColl % cfgDownsampling.value == 0) { + rotationBackgroundCalib(vMeson, v1, v2, photonsPerCollision, g1.globalIndex(), g2.globalIndex(), collision); + } + } + if (thnConfigAxisInvMass.value[1] > vMeson.M() || thnConfigAxisInvMass.value.back() < vMeson.M()) { + registry.fill(HIST("hClusterCuts"), 3); + continue; + } + if (thnConfigAxisPt.value[1] > vMeson.Pt() || thnConfigAxisPt.value.back() < vMeson.Pt()) { + registry.fill(HIST("hClusterCuts"), 4); + continue; + } + if (mesonConfig.cfgEnableQA) { + registry.fill(HIST("hInvMassPt"), vMeson.M(), vMeson.Pt()); + registry.fill(HIST("hTanThetaPhi"), vMeson.M(), getAngleDegree(std::atan(dTheta / dPhi))); + registry.fill(HIST("hAlphaPt"), (v1.E() - v2.E()) / (v1.E() + v2.E()), vMeson.Pt()); + } + if (mesonConfig.enableTanThetadPhi && mesonConfig.minTanThetadPhi > std::fabs(getAngleDegree(std::atan(dTheta / dPhi)))) { + registry.fill(HIST("hClusterCuts"), 5); + continue; + } + if (std::fabs((v1.E() - v2.E()) / (v1.E() + v2.E()) < cfgMaxAsymmetry)) { // only use symmetric decays + registry.fill(HIST("hClusterCuts"), 6); + registry.fill(HIST("hSparseCalibSE"), vMeson.M(), vMeson.E() / 2., getCentrality(collision)); + } + } + if (cfgDoRotation) { + if (nColl % cfgDownsampling.value == 0) { + nColl = 1; // reset counter + } else { + nColl++; + } + } + } + } + PROCESS_SWITCH(CalibTaskEmc, processEMCalCalib, "Process EMCal calibration same event", true); + + // EMCal calibration + void processEMCalPCMCalib(Colls const& collisions, EMCalPhotons const& clusters, PCMPhotons const& photons, aod::V0Legs const&) + { + float energyCorrectionFactor = 1.f; + int nColl = 1; + for (const auto& collision : collisions) { + o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<0>(®istry, collision); + if (!(fEMEventCut.IsSelected(collision))) { + // general event selection + continue; + } + if (!(eventcuts.cfgFT0COccupancyMin <= collision.ft0cOccupancyInTimeRange() && collision.ft0cOccupancyInTimeRange() < eventcuts.cfgFT0COccupancyMax)) { + // occupancy selection + continue; + } + float cent = getCentrality(collision); + if (cent < eventcuts.cfgMinCent || cent > eventcuts.cfgMaxCent) { + // event selection + continue; + } + runNow = collision.runNumber(); + if (runNow != runBefore) { + initCCDB(collision); + runBefore = runNow; + } + o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<1>(®istry, collision); + registry.fill(HIST("Event/before/hCollisionCounter"), 12.0); // accepted + registry.fill(HIST("Event/after/hCollisionCounter"), 12.0); // accepted + + auto photonsEMCPerCollision = clusters.sliceBy(perCollisionEMC, collision.globalIndex()); + auto photonsPCMPerCollision = photons.sliceBy(perCollisionPCM, collision.globalIndex()); + + if (emccuts.cfgEnableQA) { + for (const auto& photon : photonsEMCPerCollision) { + registry.fill(HIST("hEClusterBefore"), photon.e()); // before cuts + if (!(fEMCCut.IsSelected(photon))) { + continue; + } + registry.fill(HIST("hEClusterAfter"), photon.e()); // accepted after cuts + } + } + for (const auto& [g1, g2] : combinations(CombinationsFullIndexPolicy(photonsEMCPerCollision, photonsPCMPerCollision))) { + if (!(fEMCCut.IsSelected(g1)) || !(fPCMPhotonCut.IsSelected(g2))) { + continue; + } + + // Cut edge clusters away, similar to rotation method to ensure same acceptance is used + if (cfgDistanceToEdge.value) { + if (checkEtaPhi1D(g1.eta(), RecoDecay::constrainAngle(g1.phi())) >= cfgEMCalMapLevelSameEvent.value) { + continue; + } + } + + // EMCal photon v1 + energyCorrectionFactor = fEMCalCorrectionFactor->Eval(g1.e() > MinEnergy ? g1.e() : MinEnergy); + ROOT::Math::PtEtaPhiMVector v1(energyCorrectionFactor * g1.pt(), g1.eta(), g1.phi(), 0.); + // PCM photon v2s + ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); + ROOT::Math::PtEtaPhiMVector vMeson = v1 + v2; + + float dTheta = v1.Theta() - v2.Theta(); + float dPhi = v1.Phi() - v2.Phi(); + float openingAngle = std::acos(v1.Vect().Dot(v2.Vect()) / (v1.P() * v2.P())); + registry.fill(HIST("hClusterCuts"), 1); + if (openingAngle <= mesonConfig.minOpenAngle) { + registry.fill(HIST("hClusterCuts"), 2); + continue; + } + if (cfgDoRotation) { + if (nColl % cfgDownsampling.value == 0) { + rotationBackgroundCalibEMCPCM(vMeson, v1, v2, photonsEMCPerCollision, photonsPCMPerCollision, g1.globalIndex(), g2.globalIndex(), cent); + } + } + if (thnConfigAxisInvMass.value[1] > vMeson.M() || thnConfigAxisInvMass.value.back() < vMeson.M()) { + registry.fill(HIST("hClusterCuts"), 3); + continue; + } + if (thnConfigAxisPt.value[1] > vMeson.Pt() || thnConfigAxisPt.value.back() < vMeson.Pt()) { + registry.fill(HIST("hClusterCuts"), 4); + continue; + } + if (mesonConfig.cfgEnableQA) { + registry.fill(HIST("hInvMassPt"), vMeson.M(), vMeson.Pt()); + registry.fill(HIST("hTanThetaPhi"), vMeson.M(), getAngleDegree(std::atan(dTheta / dPhi))); + registry.fill(HIST("hAlphaPt"), (v1.E() - v2.E()) / (v1.E() + v2.E()), vMeson.Pt()); + } + if (mesonConfig.enableTanThetadPhi && mesonConfig.minTanThetadPhi > std::fabs(getAngleDegree(std::atan(dTheta / dPhi)))) { + registry.fill(HIST("hClusterCuts"), 5); + continue; + } + registry.fill(HIST("hSparseCalibSE"), vMeson.M(), vMeson.E() / 2., getCentrality(collision)); + } + if (cfgDoRotation) { + if (nColl % cfgDownsampling.value == 0) { + nColl = 1; // reset counter + } else { + nColl++; + } + } + } + } + PROCESS_SWITCH(CalibTaskEmc, processEMCalPCMCalib, "Process EMCal calibration using PCM-EMC same event", true); + + // EMCal calibration mixed event + void processEMCalCalibMixed(Colls const&, EMCalPhotons const&, PCMPhotons const&) + { + float energyCorrectionFactor = 1.f; + + SameKindPair pair{binningOnPositions, mixingConfig.cfgMixingDepth, -1, &cache}; // indicates that 5 events should be mixed and under/overflow (-1) to be ignored + + for (const auto& [c1, clusters1, c2, clusters2] : pair) { + if (!(fEMEventCut.IsSelected(c1)) || !(fEMEventCut.IsSelected(c2))) { + // general event selection + continue; + } + if (!(eventcuts.cfgFT0COccupancyMin <= c1.ft0cOccupancyInTimeRange() && c1.ft0cOccupancyInTimeRange() < eventcuts.cfgFT0COccupancyMax) || !(eventcuts.cfgFT0COccupancyMin <= c2.ft0cOccupancyInTimeRange() && c2.ft0cOccupancyInTimeRange() < eventcuts.cfgFT0COccupancyMax)) { + // occupancy selection + continue; + } + if (getCentrality(c1) < eventcuts.cfgMinCent || getCentrality(c1) > eventcuts.cfgMaxCent || getCentrality(c2) < eventcuts.cfgMinCent || getCentrality(c2) > eventcuts.cfgMaxCent) { + // event selection + continue; + } + runNow = c1.runNumber(); + if (runNow != runBefore) { + initCCDB(c1); + runBefore = runNow; + } + for (const auto& [g1, g2] : combinations(CombinationsFullIndexPolicy(clusters1, clusters2))) { + if (!(fEMCCut.IsSelected(g1)) || !(fEMCCut.IsSelected(g2))) { + continue; + } + // Cut edge clusters away, similar to rotation method to ensure same acceptance is used + if (cfgDistanceToEdge.value) { + if (checkEtaPhi1D(g1.eta(), RecoDecay::constrainAngle(g1.phi())) >= cfgEMCalMapLevelBackground.value) { + continue; + } + if (checkEtaPhi1D(g2.eta(), RecoDecay::constrainAngle(g2.phi())) >= cfgEMCalMapLevelBackground.value) { + continue; + } + } + energyCorrectionFactor = fEMCalCorrectionFactor->Eval(g1.e() > MinEnergy ? g1.e() : MinEnergy); + ROOT::Math::PtEtaPhiMVector v1(energyCorrectionFactor * g1.pt(), g1.eta(), g1.phi(), 0.); + energyCorrectionFactor = fEMCalCorrectionFactor->Eval(g2.e() > MinEnergy ? g2.e() : MinEnergy); + ROOT::Math::PtEtaPhiMVector v2(energyCorrectionFactor * g2.pt(), g2.eta(), g2.phi(), 0.); + ROOT::Math::PtEtaPhiMVector vMeson = v1 + v2; + + float dTheta = v1.Theta() - v2.Theta(); + float dPhi = v1.Phi() - v2.Phi(); + float openingAngle = std::acos(v1.Vect().Dot(v2.Vect()) / (v1.P() * v2.P())); + + registry.fill(HIST("hClusterCutsMixed"), 1); + if (openingAngle <= mesonConfig.minOpenAngle) { + registry.fill(HIST("hClusterCutsMixed"), 2); + continue; + } + if (thnConfigAxisInvMass.value[1] > vMeson.M() || thnConfigAxisInvMass.value.back() < vMeson.M()) { + registry.fill(HIST("hClusterCutsMixed"), 3); + continue; + } + if (thnConfigAxisPt.value[1] > vMeson.Pt() || thnConfigAxisPt.value.back() < vMeson.Pt()) { + registry.fill(HIST("hClusterCutsMixed"), 4); + continue; + } + if (mesonConfig.cfgEnableQA) { + registry.fill(HIST("hInvMassPtMixed"), vMeson.M(), vMeson.Pt()); + registry.fill(HIST("hTanThetaPhiMixed"), vMeson.M(), getAngleDegree(std::atan(dTheta / dPhi))); + registry.fill(HIST("hAlphaPtMixed"), (v1.E() - v2.E()) / (v1.E() + v2.E()), vMeson.Pt()); + } + if (mesonConfig.enableTanThetadPhi && mesonConfig.minTanThetadPhi > std::fabs(getAngleDegree(std::atan(dTheta / dPhi)))) { + registry.fill(HIST("hClusterCutsMixed"), 5); + continue; + } + if (std::fabs((v1.E() - v2.E()) / (v1.E() + v2.E()) < cfgMaxAsymmetry)) { // only use symmetric decays + registry.fill(HIST("hClusterCutsMixed"), 6); + registry.fill(HIST("hSparseCalibBack"), vMeson.M(), vMeson.E() / 2., getCentrality(c1)); + } + } + } + } + PROCESS_SWITCH(CalibTaskEmc, processEMCalCalibMixed, "Process EMCal calibration mixed event", false); + + // EMCal calibration + void processEMCalPCMCalibMixed(Colls const&, EMCalPhotons const&, PCMPhotons const&, aod::V0Legs const&) + { + float energyCorrectionFactor = 1.f; + + LOG(info) << "Beginning of processEMCalPCMCalibMixed"; + + for (const auto& [c1, photonEMC, c2, photonPCM] : pairPCMEMC) { + if (!(fEMEventCut.IsSelected(c1)) || !(fEMEventCut.IsSelected(c2))) { + // general event selection + continue; + } + if (!(eventcuts.cfgFT0COccupancyMin <= c1.ft0cOccupancyInTimeRange() && c1.ft0cOccupancyInTimeRange() < eventcuts.cfgFT0COccupancyMax) || !(eventcuts.cfgFT0COccupancyMin <= c2.ft0cOccupancyInTimeRange() && c2.ft0cOccupancyInTimeRange() < eventcuts.cfgFT0COccupancyMax)) { + // occupancy selection + continue; + } + if (getCentrality(c1) < eventcuts.cfgMinCent || getCentrality(c1) > eventcuts.cfgMaxCent || getCentrality(c2) < eventcuts.cfgMinCent || getCentrality(c2) > eventcuts.cfgMaxCent) { + // event selection + continue; + } + runNow = c1.runNumber(); + if (runNow != runBefore) { + initCCDB(c1); + runBefore = runNow; + } + for (const auto& [g1, g2] : combinations(CombinationsFullIndexPolicy(photonEMC, photonPCM))) { + if (!(fEMCCut.IsSelected(g1)) || !(fPCMPhotonCut.IsSelected(g2))) { + continue; + } + // Cut edge clusters away, similar to rotation method to ensure same acceptance is used + if (cfgDistanceToEdge.value) { + if (checkEtaPhi1D(g1.eta(), RecoDecay::constrainAngle(g1.phi())) >= cfgEMCalMapLevelBackground.value) { + continue; + } + } + energyCorrectionFactor = fEMCalCorrectionFactor->Eval(g1.e() > MinEnergy ? g1.e() : MinEnergy); + ROOT::Math::PtEtaPhiMVector v1(energyCorrectionFactor * g1.pt(), g1.eta(), g1.phi(), 0.); + ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); + ROOT::Math::PtEtaPhiMVector vMeson = v1 + v2; + + float dTheta = v1.Theta() - v2.Theta(); + float dPhi = v1.Phi() - v2.Phi(); + float openingAngle = std::acos(v1.Vect().Dot(v2.Vect()) / (v1.P() * v2.P())); + + registry.fill(HIST("hClusterCutsMixed"), 1); + if (openingAngle <= mesonConfig.minOpenAngle) { + registry.fill(HIST("hClusterCutsMixed"), 2); + continue; + } + if (thnConfigAxisInvMass.value[1] > vMeson.M() || thnConfigAxisInvMass.value.back() < vMeson.M()) { + registry.fill(HIST("hClusterCutsMixed"), 3); + continue; + } + if (thnConfigAxisPt.value[1] > vMeson.Pt() || thnConfigAxisPt.value.back() < vMeson.Pt()) { + registry.fill(HIST("hClusterCutsMixed"), 4); + continue; + } + if (mesonConfig.cfgEnableQA) { + registry.fill(HIST("hInvMassPtMixed"), vMeson.M(), vMeson.Pt()); + registry.fill(HIST("hTanThetaPhiMixed"), vMeson.M(), getAngleDegree(std::atan(dTheta / dPhi))); + registry.fill(HIST("hAlphaPtMixed"), (v1.E() - v2.E()) / (v1.E() + v2.E()), vMeson.Pt()); + } + if (mesonConfig.enableTanThetadPhi && mesonConfig.minTanThetadPhi > std::fabs(getAngleDegree(std::atan(dTheta / dPhi)))) { + registry.fill(HIST("hClusterCutsMixed"), 5); + continue; + } + registry.fill(HIST("hSparseCalibBack"), vMeson.M(), vMeson.E() / 2., getCentrality(c1)); + } + } + } + PROCESS_SWITCH(CalibTaskEmc, processEMCalPCMCalibMixed, "Process EMCal calibration with PCM-EMC mixed event", false); + +}; // End struct CalibTaskEmc + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx b/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx index aa837b02233..4b576285531 100644 --- a/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx @@ -11,14 +11,12 @@ /// \file taskPi0FlowEMC.cxx /// \brief Analysis task for neutral pion flow with EMCal -/// /// \author M. Hemmer, marvin.hemmer@cern.ch #include "PWGEM/PhotonMeson/Core/EMCPhotonCut.h" #include "PWGEM/PhotonMeson/Core/EMPhotonEventCut.h" #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" #include "PWGEM/PhotonMeson/Utils/EventHistograms.h" -#include "PWGEM/PhotonMeson/Utils/emcalHistoDefinitions.h" #include "Common/CCDB/TriggerAliases.h" #include "Common/Core/EventPlaneHelper.h" @@ -50,6 +48,7 @@ #include #include #include // IWYU pragma: keep +#include #include #include #include @@ -209,7 +208,7 @@ struct TaskPi0FlowEMC { int runNow = 0; int runBefore = -1; - Filter clusterFilter = aod::skimmedcluster::time >= emccuts.cfgEMCminTime && aod::skimmedcluster::time <= emccuts.cfgEMCmaxTime && aod::skimmedcluster::m02 >= emccuts.cfgEMCminM02 && aod::skimmedcluster::m02 <= emccuts.cfgEMCmaxM02 && skimmedcluster::e >= emccuts.cfgEMCminE; + Filter clusterFilter = aod::skimmedcluster::time >= emccuts.cfgEMCminTime && aod::skimmedcluster::time <= emccuts.cfgEMCmaxTime && aod::skimmedcluster::m02 >= emccuts.cfgEMCminM02 && aod::skimmedcluster::m02 <= emccuts.cfgEMCmaxM02 && aod::skimmedcluster::e >= emccuts.cfgEMCminE; Filter collisionFilter = (nabs(aod::collision::posZ) <= eventcuts.cfgZvtxMax) && (aod::evsel::ft0cOccupancyInTimeRange <= eventcuts.cfgFT0COccupancyMax) && (aod::evsel::ft0cOccupancyInTimeRange >= eventcuts.cfgFT0COccupancyMin); using FilteredEMCalPhotons = soa::Filtered>; using EMCalPhotons = soa::Join; @@ -330,6 +329,7 @@ struct TaskPi0FlowEMC { const AxisSpec thAxisCN{8, 0.5, 8.5, "#it{c}_{n}"}; const AxisSpec thAxisSN{8, 0.5, 8.5, "#it{s}_{n}"}; const AxisSpec thAxisCPUTime{1000, 0, 10000, "#it{t} (#mus)"}; + const AxisSpec thAxisAzimuth{360, -o2::constants::math::PI, o2::constants::math::PI, "#it{#varphi} (rad)"}; const AxisSpec thnAxisMixingVtx{mixingConfig.cfgVtxBins, "#it{z} (cm)"}; const AxisSpec thnAxisMixingCent{mixingConfig.cfgCentBins, "Centrality (%)"}; @@ -399,6 +399,12 @@ struct TaskPi0FlowEMC { registry.add("epReso/hEpSinCoefficientsTPCneg", "hEpSinCoefficientsTPCneg; centrality; s_{n}", HistType::kTProfile2D, {thnAxisCent, thAxisSN}); registry.add("epReso/hEpCosCoefficientsTPCTots", "hEpCosCoefficientsTPCTots; centrality; c_{n}", HistType::kTProfile2D, {thnAxisCent, thAxisCN}); registry.add("epReso/hEpSinCoefficientsTPCTots", "hEpSinCoefficientsTPCTots; centrality; s_{n}", HistType::kTProfile2D, {thnAxisCent, thAxisSN}); + registry.add("QVector/hQVecMeanRVsPhiFT0a", "hQVecMeanRVsPhiFT0a; centrality; #it{#varphi} (rad), <#it{r}> (a.u.)", HistType::kTProfile2D, {thnAxisCent, thAxisAzimuth}); + registry.add("QVector/hQVecMeanRVsPhiFT0c", "hQVecMeanRVsPhiFT0c; centrality; #it{#varphi} (rad), <#it{r}> (a.u.)", HistType::kTProfile2D, {thnAxisCent, thAxisAzimuth}); + registry.add("QVector/hQVecMeanRVsPhiFT0m", "hQVecMeanRVsPhiFT0m; centrality; #it{#varphi} (rad), <#it{r}> (a.u.)", HistType::kTProfile2D, {thnAxisCent, thAxisAzimuth}); + registry.add("QVector/hQVecMeanRVsPhiTPCpos", "hQVecMeanRVsPhiTPCpos; centrality; #it{#varphi} (rad), <#it{r}> (a.u.)", HistType::kTProfile2D, {thnAxisCent, thAxisAzimuth}); + registry.add("QVector/hQVecMeanRVsPhiTPCneg", "hQVecMeanRVsPhiTPCneg; centrality; #it{#varphi} (rad), <#it{r}> (a.u.)", HistType::kTProfile2D, {thnAxisCent, thAxisAzimuth}); + registry.add("QVector/hQVecMeanRVsPhiTPCTot", "hQVecMeanRVsPhiTPCTot; centrality; #it{#varphi} (rad), <#it{r}> (a.u.)", HistType::kTProfile2D, {thnAxisCent, thAxisAzimuth}); } if (eventcuts.cfgEnableQA) { auto hCollisionEMCCheck = registry.add("hCollisionEMCCheck", "collision counter;;Counts", kTH1D, {{7, 0.5, 7.5}}, false); @@ -1239,6 +1245,13 @@ struct TaskPi0FlowEMC { registry.fill(HIST("hEventPlaneAngleTPCpos"), centrality, epBPoss); registry.fill(HIST("hEventPlaneAngleTPCneg"), centrality, epBNegs); + registry.fill(HIST("QVector/hQVecMeanRVsPhiFT0a"), centrality, std::atan2(yQVecFT0a, xQVecFT0a)); + registry.fill(HIST("QVector/hQVecMeanRVsPhiFT0c"), centrality, std::atan2(yQVecFT0c, xQVecFT0c)); + registry.fill(HIST("QVector/hQVecMeanRVsPhiFT0m"), centrality, std::atan2(yQVecFT0m, xQVecFT0m)); + registry.fill(HIST("QVector/hQVecMeanRVsPhiTPCpos"), centrality, std::atan2(yQVecBPos, xQVecBPos)); + registry.fill(HIST("QVector/hQVecMeanRVsPhiTPCneg"), centrality, std::atan2(yQVecBNeg, xQVecBNeg)); + registry.fill(HIST("QVector/hQVecMeanRVsPhiTPCTot"), centrality, std::atan2(yQVecBTot, xQVecBTot)); + registry.fill(HIST("epReso/hEpResoFT0cFT0a"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0c, epFT0a))); registry.fill(HIST("epReso/hEpResoFT0cTPCpos"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0c, epBPoss))); registry.fill(HIST("epReso/hEpResoFT0cTPCneg"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0c, epBNegs))); @@ -1251,18 +1264,18 @@ struct TaskPi0FlowEMC { registry.fill(HIST("epReso/hEpResoFT0mTPCtot"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0m, epBTots))); registry.fill(HIST("epReso/hEpResoTPCposTPCneg"), centrality, std::cos(harmonic * getDeltaPsiInRange(epBPoss, epBNegs))); for (int n = 1; n <= kOctagonal; n++) { - registry.fill(HIST("epReso/hEpCosCoefficientsFT0c"), centrality, n, std::cos(n * epFT0c)); - registry.fill(HIST("epReso/hEpSinCoefficientsFT0c"), centrality, n, std::sin(n * epFT0c)); - registry.fill(HIST("epReso/hEpCosCoefficientsFT0a"), centrality, n, std::cos(n * epFT0a)); - registry.fill(HIST("epReso/hEpSinCoefficientsFT0a"), centrality, n, std::sin(n * epFT0a)); - registry.fill(HIST("epReso/hEpCosCoefficientsFT0m"), centrality, n, std::cos(n * epFT0m)); - registry.fill(HIST("epReso/hEpSinCoefficientsFT0m"), centrality, n, std::sin(n * epFT0m)); - registry.fill(HIST("epReso/hEpCosCoefficientsTPCpos"), centrality, n, std::cos(n * epBPoss)); - registry.fill(HIST("epReso/hEpSinCoefficientsTPCpos"), centrality, n, std::sin(n * epBPoss)); - registry.fill(HIST("epReso/hEpCosCoefficientsTPCneg"), centrality, n, std::cos(n * epBNegs)); - registry.fill(HIST("epReso/hEpSinCoefficientsTPCneg"), centrality, n, std::sin(n * epBNegs)); - registry.fill(HIST("epReso/hEpCosCoefficientsTPCTots"), centrality, n, std::cos(n * epBTots)); - registry.fill(HIST("epReso/hEpSinCoefficientsTPCTots"), centrality, n, std::sin(n * epBTots)); + registry.fill(HIST("epReso/hEpCosCoefficientsFT0c"), centrality, n, std::cos(n * harmonic * epFT0c)); + registry.fill(HIST("epReso/hEpSinCoefficientsFT0c"), centrality, n, std::sin(n * harmonic * epFT0c)); + registry.fill(HIST("epReso/hEpCosCoefficientsFT0a"), centrality, n, std::cos(n * harmonic * epFT0a)); + registry.fill(HIST("epReso/hEpSinCoefficientsFT0a"), centrality, n, std::sin(n * harmonic * epFT0a)); + registry.fill(HIST("epReso/hEpCosCoefficientsFT0m"), centrality, n, std::cos(n * harmonic * epFT0m)); + registry.fill(HIST("epReso/hEpSinCoefficientsFT0m"), centrality, n, std::sin(n * harmonic * epFT0m)); + registry.fill(HIST("epReso/hEpCosCoefficientsTPCpos"), centrality, n, std::cos(n * harmonic * epBPoss)); + registry.fill(HIST("epReso/hEpSinCoefficientsTPCpos"), centrality, n, std::sin(n * harmonic * epBPoss)); + registry.fill(HIST("epReso/hEpCosCoefficientsTPCneg"), centrality, n, std::cos(n * harmonic * epBNegs)); + registry.fill(HIST("epReso/hEpSinCoefficientsTPCneg"), centrality, n, std::sin(n * harmonic * epBNegs)); + registry.fill(HIST("epReso/hEpCosCoefficientsTPCTots"), centrality, n, std::cos(n * harmonic * epBTots)); + registry.fill(HIST("epReso/hEpSinCoefficientsTPCTots"), centrality, n, std::sin(n * harmonic * epBTots)); } } } @@ -1379,7 +1392,7 @@ struct TaskPi0FlowEMC { } } } - PROCESS_SWITCH(TaskPi0FlowEMC, processEMCalCalib, "Process EMCal calibration", false); + PROCESS_SWITCH(TaskPi0FlowEMC, processEMCalCalib, "Process EMCal calibration mixed event", false); // Pi0 from EMCal void processM02(CollsWithQvecs const& collisions, EMCalPhotons const& clusters) diff --git a/PWGEM/PhotonMeson/Utils/ClusterHistograms.h b/PWGEM/PhotonMeson/Utils/ClusterHistograms.h index b5f0eb6db85..71337021f38 100644 --- a/PWGEM/PhotonMeson/Utils/ClusterHistograms.h +++ b/PWGEM/PhotonMeson/Utils/ClusterHistograms.h @@ -16,6 +16,7 @@ #ifndef PWGEM_PHOTONMESON_UTILS_CLUSTERHISTOGRAMS_H_ #define PWGEM_PHOTONMESON_UTILS_CLUSTERHISTOGRAMS_H_ +#include #include #include @@ -26,16 +27,14 @@ #include -using namespace o2::framework; - namespace o2::aod::pwgem::photonmeson::utils::clusterhistogram { -inline void addClusterHistograms(HistogramRegistry* fRegistry, bool do2DQA) +inline void addClusterHistograms(o2::framework::HistogramRegistry* fRegistry, bool do2DQA) { fRegistry->add("Cluster/before/hE", "E_{cluster};#it{E}_{cluster} (GeV);#it{N}_{cluster}", o2::framework::kTH1F, {{500, 0.0f, 50}}, true); fRegistry->add("Cluster/before/hPt", "Transverse momenta of clusters;#it{p}_{T} (GeV/c);#it{N}_{cluster}", o2::framework::kTH1F, {{500, 0.0f, 50}}, true); fRegistry->add("Cluster/before/hNgamma", "Number of #gamma candidates per collision;#it{N}_{#gamma} per collision;#it{N}_{collisions}", o2::framework::kTH1F, {{51, -0.5f, 50.5f}}, true); - fRegistry->add("Cluster/before/hEtaPhi", "#eta vs #varphi;#eta;#varphi (rad.)", o2::framework::kTH2F, {{280, -0.7f, 0.7f}, {180, 0, 2 * M_PI}}, true); + fRegistry->add("Cluster/before/hEtaPhi", "#eta vs #varphi;#eta;#varphi (rad.)", o2::framework::kTH2F, {{280, -0.7f, 0.7f}, {180, 0, o2::constants::math::TwoPI}}, true); fRegistry->add("Cluster/before/hNTracks", "Number of tracks considered for TM;#it{N}_{tracks};#it{N}_{cluster}", o2::framework::kTH1F, {{20, -0.5f, 19.5}}, true); fRegistry->add("Cluster/before/hTrackdEtadPhi", "d#eta vs. d#varphi of matched tracks;d#eta;d#varphi (rad.)", o2::framework::kTH2F, {{200, -0.2f, 0.2f}, {200, -0.2f, 0.2f}}, true); @@ -67,31 +66,31 @@ inline void addClusterHistograms(HistogramRegistry* fRegistry, bool do2DQA) } template -inline void fillClusterHistograms(HistogramRegistry* fRegistry, TCluster cluster, bool do2DQA, float weight = 1.f) +inline void fillClusterHistograms(o2::framework::HistogramRegistry* fRegistry, TCluster cluster, bool do2DQA, float weight = 1.f) { - static constexpr std::string_view cluster_types[2] = {"before/", "after/"}; - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hE"), cluster.e(), weight); - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hPt"), cluster.pt(), weight); - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hEtaPhi"), cluster.eta(), cluster.phi(), weight); - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hNTracks"), cluster.deltaEta().size(), weight); + static constexpr std::string_view kClusterTypes[2] = {"before/", "after/"}; + fRegistry->fill(HIST("Cluster/") + HIST(kClusterTypes[cls_id]) + HIST("hE"), cluster.e(), weight); + fRegistry->fill(HIST("Cluster/") + HIST(kClusterTypes[cls_id]) + HIST("hPt"), cluster.pt(), weight); + fRegistry->fill(HIST("Cluster/") + HIST(kClusterTypes[cls_id]) + HIST("hEtaPhi"), cluster.eta(), cluster.phi(), weight); + fRegistry->fill(HIST("Cluster/") + HIST(kClusterTypes[cls_id]) + HIST("hNTracks"), cluster.deltaEta().size(), weight); for (size_t itrack = 0; itrack < cluster.deltaEta().size(); itrack++) { // Fill TrackEtaPhi histogram with delta phi and delta eta of all tracks saved in the vectors in skimmerGammaCalo.cxx - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTrackdEtadPhi"), cluster.deltaEta()[itrack], cluster.deltaPhi()[itrack], weight); + fRegistry->fill(HIST("Cluster/") + HIST(kClusterTypes[cls_id]) + HIST("hTrackdEtadPhi"), cluster.deltaEta()[itrack], cluster.deltaPhi()[itrack], weight); } if (do2DQA) { - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hNCell"), cluster.nCells(), cluster.e(), weight); - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hM02"), cluster.m02(), cluster.e(), weight); - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTime"), cluster.time(), cluster.e(), weight); + fRegistry->fill(HIST("Cluster/") + HIST(kClusterTypes[cls_id]) + HIST("hNCell"), cluster.nCells(), cluster.e(), weight); + fRegistry->fill(HIST("Cluster/") + HIST(kClusterTypes[cls_id]) + HIST("hM02"), cluster.m02(), cluster.e(), weight); + fRegistry->fill(HIST("Cluster/") + HIST(kClusterTypes[cls_id]) + HIST("hTime"), cluster.time(), cluster.e(), weight); for (size_t itrack = 0; itrack < cluster.deltaEta().size(); itrack++) { - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTrackEOverP"), cluster.e() / cluster.trackp()[itrack], cluster.e(), weight); - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTrackdEta"), cluster.deltaEta()[itrack], cluster.e(), weight); - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTrackdPhi"), cluster.deltaPhi()[itrack], cluster.e(), weight); + fRegistry->fill(HIST("Cluster/") + HIST(kClusterTypes[cls_id]) + HIST("hTrackEOverP"), cluster.e() / cluster.trackp()[itrack], cluster.e(), weight); + fRegistry->fill(HIST("Cluster/") + HIST(kClusterTypes[cls_id]) + HIST("hTrackdEta"), cluster.deltaEta()[itrack], cluster.e(), weight); + fRegistry->fill(HIST("Cluster/") + HIST(kClusterTypes[cls_id]) + HIST("hTrackdPhi"), cluster.deltaPhi()[itrack], cluster.e(), weight); } } else { - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hNCell"), cluster.nCells(), weight); - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hM02"), cluster.m02(), weight); - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTime"), cluster.time(), weight); + fRegistry->fill(HIST("Cluster/") + HIST(kClusterTypes[cls_id]) + HIST("hNCell"), cluster.nCells(), weight); + fRegistry->fill(HIST("Cluster/") + HIST(kClusterTypes[cls_id]) + HIST("hM02"), cluster.m02(), weight); + fRegistry->fill(HIST("Cluster/") + HIST(kClusterTypes[cls_id]) + HIST("hTime"), cluster.time(), weight); for (size_t itrack = 0; itrack < cluster.deltaEta().size(); itrack++) { - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTrackEOverP"), cluster.e() / cluster.trackp()[itrack], weight); + fRegistry->fill(HIST("Cluster/") + HIST(kClusterTypes[cls_id]) + HIST("hTrackEOverP"), cluster.e() / cluster.trackp()[itrack], weight); } } } diff --git a/PWGEM/PhotonMeson/Utils/EventHistograms.h b/PWGEM/PhotonMeson/Utils/EventHistograms.h index ef5f115e216..5a00d9b6da9 100644 --- a/PWGEM/PhotonMeson/Utils/EventHistograms.h +++ b/PWGEM/PhotonMeson/Utils/EventHistograms.h @@ -9,22 +9,29 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \header file for histograms +/// \file EventHistograms.h +/// \brief header file for event histograms /// \author daiki.sekihata@cern.ch #ifndef PWGEM_PHOTONMESON_UTILS_EVENTHISTOGRAMS_H_ #define PWGEM_PHOTONMESON_UTILS_EVENTHISTOGRAMS_H_ -#include "Framework/HistogramRegistry.h" +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/CCDB/TriggerAliases.h" -using namespace o2::framework; +#include +#include + +#include + +#include namespace o2::aod::pwgem::photonmeson::utils::eventhistogram { -void addEventHistograms(HistogramRegistry* fRegistry) +inline void addEventHistograms(o2::framework::HistogramRegistry* fRegistry) { // event info - auto hCollisionCounter = fRegistry->add("Event/before/hCollisionCounter", "collision counter;;Number of events", kTH1D, {{12, 0.5, 12.5}}, false); + auto hCollisionCounter = fRegistry->add("Event/before/hCollisionCounter", "collision counter;;Number of events", o2::framework::kTH1D, {{12, 0.5, 12.5}}, false); hCollisionCounter->GetXaxis()->SetBinLabel(1, "all"); hCollisionCounter->GetXaxis()->SetBinLabel(2, "No TF border"); hCollisionCounter->GetXaxis()->SetBinLabel(3, "No ITS ROF border"); @@ -38,86 +45,87 @@ void addEventHistograms(HistogramRegistry* fRegistry) hCollisionCounter->GetXaxis()->SetBinLabel(11, "EMC L0 Triggered"); hCollisionCounter->GetXaxis()->SetBinLabel(12, "accepted"); - const AxisSpec axis_cent_ft0m{{0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110}, - "centrality FT0M (%)"}; + const o2::framework::AxisSpec axis_cent_ft0m{{0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110}, + "centrality FT0M (%)"}; - const AxisSpec axis_cent_ft0a{{0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110}, - "centrality FT0A (%)"}; + const o2::framework::AxisSpec axis_cent_ft0a{{0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110}, + "centrality FT0A (%)"}; - const AxisSpec axis_cent_ft0c{{0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110}, - "centrality FT0C (%)"}; + const o2::framework::AxisSpec axis_cent_ft0c{{0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110}, + "centrality FT0C (%)"}; - fRegistry->add("Event/before/hZvtx", "vertex z; Z_{vtx} (cm)", kTH1F, {{100, -50, +50}}, false); - fRegistry->add("Event/before/hMultNTracksPV", "hMultNTracksPV; N_{track} to PV", kTH1F, {{6001, -0.5, 6000.5}}, false); - fRegistry->add("Event/before/hMultNTracksPVeta1", "hMultNTracksPVeta1; N_{track} to PV", kTH1F, {{6001, -0.5, 6000.5}}, false); - fRegistry->add("Event/before/hMultFT0", "hMultFT0;mult. FT0A;mult. FT0C", kTH2F, {{200, 0, 200000}, {60, 0, 60000}}, false); - fRegistry->add("Event/before/hCentFT0A", "hCentFT0A;centrality FT0A (%)", kTH1F, {{axis_cent_ft0a}}, false); - fRegistry->add("Event/before/hCentFT0C", "hCentFT0C;centrality FT0C (%)", kTH1F, {{axis_cent_ft0c}}, false); - fRegistry->add("Event/before/hCentFT0M", "hCentFT0M;centrality FT0M (%)", kTH1F, {{axis_cent_ft0m}}, false); - fRegistry->add("Event/before/hCentFT0CvsMultNTracksPV", "hCentFT0CvsMultNTracksPV;centrality FT0C (%);N_{track} to PV", kTH2F, {{110, 0, 110}, {500, 0, 5000}}, false); - fRegistry->add("Event/before/hMultFT0CvsMultNTracksPV", "hMultFT0CvsMultNTracksPV;mult. FT0C;N_{track} to PV", kTH2F, {{60, 0, 60000}, {500, 0, 5000}}, false); - fRegistry->add("Event/before/hMultFT0CvsOccupancy", "hMultFT0CvsOccupancy;mult. FT0C;N_{track} in time range", kTH2F, {{60, 0, 60000}, {2000, 0, 20000}}, false); + fRegistry->add("Event/before/hZvtx", "vertex z; Z_{vtx} (cm)", o2::framework::kTH1F, {{100, -50, +50}}, false); + fRegistry->add("Event/before/hMultNTracksPV", "hMultNTracksPV; N_{track} to PV", o2::framework::kTH1F, {{6001, -0.5, 6000.5}}, false); + fRegistry->add("Event/before/hMultNTracksPVeta1", "hMultNTracksPVeta1; N_{track} to PV", o2::framework::kTH1F, {{6001, -0.5, 6000.5}}, false); + fRegistry->add("Event/before/hMultFT0", "hMultFT0;mult. FT0A;mult. FT0C", o2::framework::kTH2F, {{200, 0, 200000}, {60, 0, 60000}}, false); + fRegistry->add("Event/before/hCentFT0A", "hCentFT0A;centrality FT0A (%)", o2::framework::kTH1F, {{axis_cent_ft0a}}, false); + fRegistry->add("Event/before/hCentFT0C", "hCentFT0C;centrality FT0C (%)", o2::framework::kTH1F, {{axis_cent_ft0c}}, false); + fRegistry->add("Event/before/hCentFT0M", "hCentFT0M;centrality FT0M (%)", o2::framework::kTH1F, {{axis_cent_ft0m}}, false); + fRegistry->add("Event/before/hCentFT0CvsMultNTracksPV", "hCentFT0CvsMultNTracksPV;centrality FT0C (%);N_{track} to PV", o2::framework::kTH2F, {{110, 0, 110}, {500, 0, 5000}}, false); + fRegistry->add("Event/before/hMultFT0CvsMultNTracksPV", "hMultFT0CvsMultNTracksPV;mult. FT0C;N_{track} to PV", o2::framework::kTH2F, {{60, 0, 60000}, {500, 0, 5000}}, false); + fRegistry->add("Event/before/hMultFT0CvsOccupancy", "hMultFT0CvsOccupancy;mult. FT0C;N_{track} in time range", o2::framework::kTH2F, {{60, 0, 60000}, {2000, 0, 20000}}, false); fRegistry->addClone("Event/before/", "Event/after/"); } template -void fillEventInfo(HistogramRegistry* fRegistry, TCollision const& collision, float weight = 1.) +void fillEventInfo(o2::framework::HistogramRegistry* fRegistry, TCollision const& collision, float weight = 1.) { - static constexpr std::string_view event_types[2] = {"before/", "after/"}; - fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 1.0, weight); + const float maxZ = 10.f; + static constexpr std::string_view kEventTypes[2] = {"before/", "after/"}; + fRegistry->fill(HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hCollisionCounter"), 1.0, weight); if (collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { - fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 2.0, weight); + fRegistry->fill(HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hCollisionCounter"), 2.0, weight); } if (collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { - fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 3.0, weight); + fRegistry->fill(HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hCollisionCounter"), 3.0, weight); } if (collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 4.0, weight); + fRegistry->fill(HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hCollisionCounter"), 4.0, weight); } if (collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { - fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 5.0, weight); + fRegistry->fill(HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hCollisionCounter"), 5.0, weight); } if (collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { - fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 6.0, weight); + fRegistry->fill(HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hCollisionCounter"), 6.0, weight); } if (collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { - fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 7.0, weight); + fRegistry->fill(HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hCollisionCounter"), 7.0, weight); } if (collision.sel8()) { - fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 8.0, weight); + fRegistry->fill(HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hCollisionCounter"), 8.0, weight); } - if (std::abs(collision.posZ()) < 10.0) { - fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 9.0, weight); + if (std::abs(collision.posZ()) < maxZ) { + fRegistry->fill(HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hCollisionCounter"), 9.0, weight); } - fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hZvtx"), collision.posZ(), weight); + fRegistry->fill(HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hZvtx"), collision.posZ(), weight); if (collision.alias_bit(kTVXinEMC)) { - fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 10.0, weight); + fRegistry->fill(HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hCollisionCounter"), 10.0, weight); } if (collision.alias_bit(kEMC7) || collision.alias_bit(kDMC7)) { - fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 11.0, weight); + fRegistry->fill(HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hCollisionCounter"), 11.0, weight); } - fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultNTracksPV"), collision.multNTracksPV(), weight); - fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultNTracksPVeta1"), collision.multNTracksPVeta1(), weight); - fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultFT0"), collision.multFT0A(), collision.multFT0C(), weight); - fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0A"), collision.centFT0A(), weight); - fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0C"), collision.centFT0C(), weight); - fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0M"), collision.centFT0M(), weight); - fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0CvsMultNTracksPV"), collision.centFT0C(), collision.multNTracksPV(), weight); - fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultFT0CvsMultNTracksPV"), collision.multFT0C(), collision.multNTracksPV(), weight); - fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultFT0CvsOccupancy"), collision.multFT0C(), collision.trackOccupancyInTimeRange(), weight); + fRegistry->fill(HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hMultNTracksPV"), collision.multNTracksPV(), weight); + fRegistry->fill(HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hMultNTracksPVeta1"), collision.multNTracksPVeta1(), weight); + fRegistry->fill(HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hMultFT0"), collision.multFT0A(), collision.multFT0C(), weight); + fRegistry->fill(HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hCentFT0A"), collision.centFT0A(), weight); + fRegistry->fill(HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hCentFT0C"), collision.centFT0C(), weight); + fRegistry->fill(HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hCentFT0M"), collision.centFT0M(), weight); + fRegistry->fill(HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hCentFT0CvsMultNTracksPV"), collision.centFT0C(), collision.multNTracksPV(), weight); + fRegistry->fill(HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hMultFT0CvsMultNTracksPV"), collision.multFT0C(), collision.multNTracksPV(), weight); + fRegistry->fill(HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hMultFT0CvsOccupancy"), collision.multFT0C(), collision.trackOccupancyInTimeRange(), weight); } } // namespace o2::aod::pwgem::photonmeson::utils::eventhistogram diff --git a/PWGEM/PhotonMeson/Utils/HNMUtilities.h b/PWGEM/PhotonMeson/Utils/HNMUtilities.h index 80101807641..e4d71bab8f1 100644 --- a/PWGEM/PhotonMeson/Utils/HNMUtilities.h +++ b/PWGEM/PhotonMeson/Utils/HNMUtilities.h @@ -19,22 +19,21 @@ #ifndef PWGEM_PHOTONMESON_UTILS_HNMUTILITIES_H_ #define PWGEM_PHOTONMESON_UTILS_HNMUTILITIES_H_ -#include -#include -#include -#include "TVector3.h" - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Common/DataModel/EventSelection.h" -#include "EMCALBase/Geometry.h" -#include "PWGJE/DataModel/EMCALClusters.h" #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" #include "PWGEM/PhotonMeson/Utils/PairUtilities.h" -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "EventFiltering/filterTables.h" + +#include +#include + +#include // IWYU pragma: keep +#include + +#include + +#include +#include +#include +#include namespace o2::aod::pwgem::photonmeson::hnmutilities { @@ -124,9 +123,9 @@ struct HeavyNeutralMeson { }; const int nSMEdges = 9; -float smPhiEdges[nSMEdges] = {1.75, 2.1, 2.45, 2.8, 3.14, 4., 4.89, 5.24, 5.58}; +inline float smPhiEdges[nSMEdges] = {1.75, 2.1, 2.45, 2.8, 3.14, 4., 4.89, 5.24, 5.58}; -int getSMNumber(float eta, float phi) +inline int getSMNumber(float eta, float phi) { int smNumber = 0; for (int iPhiInterval = 0; iPhiInterval < nSMEdges; iPhiInterval++) { @@ -175,7 +174,7 @@ void storeGammasInVector(C clusters, std::vector& vPhotons, std::array vPhotons, std::vector& vGGs) +inline void reconstructGGs(std::vector vPhotons, std::vector& vGGs) { vGGs.clear(); // loop over all photon combinations and build meson candidates @@ -195,7 +194,7 @@ void reconstructGGs(std::vector vPhotons, std::vector& v } /// \brief Reconstruct heavy neutral mesons from the given pion, antipion and the GG candidates and add them to the vHNMs vector -void reconstructHeavyNeutralMesons(ROOT::Math::PtEtaPhiMVector const& vecPiPlPiMi, std::vector& vGGs, std::vector& vHNMs) +inline void reconstructHeavyNeutralMesons(ROOT::Math::PtEtaPhiMVector const& vecPiPlPiMi, std::vector& vGGs, std::vector& vHNMs) { for (size_t iGG = 0; iGG < vGGs.size(); iGG++) { HeavyNeutralMeson heavyNeutralMeson(&vGGs.at(iGG), vecPiPlPiMi.E(), vecPiPlPiMi.Px(), vecPiPlPiMi.Py(), vecPiPlPiMi.Pz()); diff --git a/PWGEM/PhotonMeson/Utils/MCUtilities.h b/PWGEM/PhotonMeson/Utils/MCUtilities.h index c72a8a0b06d..8164d846c02 100644 --- a/PWGEM/PhotonMeson/Utils/MCUtilities.h +++ b/PWGEM/PhotonMeson/Utils/MCUtilities.h @@ -9,16 +9,18 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \commonly used for MC analysis. +/// \file MCUtilities.h +/// \brief commonly used for MC analysis. /// \author daiki.sekihata@cern.ch #ifndef PWGEM_PHOTONMESON_UTILS_MCUTILITIES_H_ #define PWGEM_PHOTONMESON_UTILS_MCUTILITIES_H_ -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" +#include #include +#include +#include #include //_______________________________________________________________________ @@ -50,7 +52,7 @@ int IsFromWD(TCollision const&, T const& mctrack, TMCs const& mcTracks) if (motherid < mcTracks.size()) { // protect against bad mother indices. why is this needed? auto mp = mcTracks.iteratorAt(motherid); int pdg_mother = mp.pdgCode(); - if (abs(pdg_mother) == 310 || abs(pdg_mother) == 130 || abs(pdg_mother) == 3122) { + if (std::abs(pdg_mother) == kK0Short || std::abs(pdg_mother) == kK0Long || std::abs(pdg_mother) == kLambda0) { // LOGF(info, "mctrack.globalIndex() = %d, mp.globalIndex() = %d , pdg_mother = %d", mctrack.globalIndex(), mp.globalIndex(), pdg_mother); return motherid; } @@ -90,32 +92,36 @@ int IsXFromY(T const& mctrack, TMCs const& mcTracks, const int pdgX, const int p // Go up the decay chain of a mcparticle looking for a mother with the given pdg codes, if found return this mothers daughter // E.g. Find the gamma that was created in a pi0 or eta decay template -int FindMotherInChain(T const& mcparticle, TMCs const& mcparticles, TTargetPDGs const& motherpdgs, const int Depth = 50) +int FindMotherInChain(T const& mcparticle, TMCs const& mcparticles, TTargetPDGs const& motherpdgs, const int Depth = 50) // o2-linter: disable=pdg/explicit-code (false positive) { - if (!mcparticle.has_mothers() || Depth < 1) + if (!mcparticle.has_mothers() || Depth < 1) { return -1; + } int motherid = mcparticle.mothersIds()[0]; auto mother = mcparticles.iteratorAt(motherid); - if (std::find(motherpdgs.begin(), motherpdgs.end(), mother.pdgCode()) != motherpdgs.end()) + if (std::find(motherpdgs.begin(), motherpdgs.end(), mother.pdgCode()) != motherpdgs.end()) { return mcparticle.globalIndex(); // The mother has the required pdg code, so return its daughters global mc particle code. - else + } else { return FindMotherInChain(mother, mcparticles, motherpdgs, Depth - 1); + } } //_______________________________________________________________________ template int IsEleFromPC(T const& mctrack, TMCs const& mcTracks) { // is election from photon conversion? returns index of mother photon - if (abs(mctrack.pdgCode()) != 11) + if (std::abs(mctrack.pdgCode()) != kElectron) { return -1; - if (mctrack.producedByGenerator()) + } + if (mctrack.producedByGenerator()) { return -1; + } if (mctrack.has_mothers()) { int motherid = mctrack.mothersIds()[0]; // first mother auto mp = mcTracks.iteratorAt(motherid); int pdg_mother = mp.pdgCode(); - if (pdg_mother == 22) { + if (pdg_mother == kGamma) { return motherid; } } else { @@ -191,7 +197,7 @@ bool IsInAcceptance(TMCParticle const& mcparticle, TMCParticles const& mcparticl } std::vector pdgs; pdgs.reserve(target_pdgs.size()); - for (auto& daughterId : daughtersIds) { + for (const auto& daughterId : daughtersIds) { if (daughterId < 0) { pdgs.clear(); pdgs.shrink_to_fit(); @@ -226,21 +232,21 @@ bool IsInAcceptance(TMCParticle const& mcparticle, TMCParticles const& mcparticl template bool IsConversionPointInAcceptance(TMCPhoton const& mcphoton, const float max_r_gen, const float max_eta_gen, const float margin_z_mc, TMCParticles const& mcparticles) { - if (std::abs(mcphoton.pdgCode()) != 22) { + if (std::abs(mcphoton.pdgCode()) != kGamma) { return false; } auto daughtersIds = mcphoton.daughtersIds(); - if (daughtersIds.size() != 2) { + if (daughtersIds.size() != 2) { // o2-linter: disable=magic-number (2 is not that magic in this context) return false; } - for (auto& daughterId : daughtersIds) { + for (const auto& daughterId : daughtersIds) { if (daughterId < 0) { return false; } auto daughter = mcparticles.iteratorAt(daughterId); - if (std::abs(daughter.pdgCode()) != 11) { + if (std::abs(daughter.pdgCode()) != kElectron) { return false; } @@ -248,9 +254,9 @@ bool IsConversionPointInAcceptance(TMCPhoton const& mcphoton, const float max_r_ return false; } - float rxy_gen_e = std::sqrt(std::pow(daughter.vx(), 2) + pow(daughter.vy(), 2)); + float rxy_gen_e = std::sqrt(std::pow(daughter.vx(), 2) + std::pow(daughter.vy(), 2)); // LOGF(info, "daughterId = %d , pdg = %d , vx = %f , vy = %f , vz = %f, rxy = %f", daughterId, daughter.pdgCode(), daughter.vx(), daughter.vy(), daughter.vz(), rxy_gen_e); - if (rxy_gen_e > max_r_gen || rxy_gen_e < abs(daughter.vz()) * std::tan(2 * std::atan(std::exp(-max_eta_gen))) - margin_z_mc) { + if (rxy_gen_e > max_r_gen || rxy_gen_e < std::abs(daughter.vz()) * std::tan(2 * std::atan(std::exp(-max_eta_gen))) - margin_z_mc) { return false; } } // end of daughter loop @@ -262,11 +268,13 @@ template bool isGammaGammaDecay(TMCParticle mcParticle, TMCParticles mcParticles) { auto daughtersIds = mcParticle.daughtersIds(); - if (daughtersIds.size() != 2) + if (daughtersIds.size() != 2) { // o2-linter: disable=magic-number (2 is not that magic in this context) return false; - for (auto& daughterId : daughtersIds) { - if (mcParticles.iteratorAt(daughterId).pdgCode() != 22) + } + for (const auto& daughterId : daughtersIds) { + if (mcParticles.iteratorAt(daughterId).pdgCode() != kGamma) { return false; + } } return true; } diff --git a/PWGEM/PhotonMeson/Utils/NMHistograms.h b/PWGEM/PhotonMeson/Utils/NMHistograms.h index 8915c6624b5..b04b8a67878 100644 --- a/PWGEM/PhotonMeson/Utils/NMHistograms.h +++ b/PWGEM/PhotonMeson/Utils/NMHistograms.h @@ -9,58 +9,59 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \header file for histograms +/// \file NMHistograms.h +/// \brief utility for mass vs pT histograms mainly /// \author daiki.sekihata@cern.ch #ifndef PWGEM_PHOTONMESON_UTILS_NMHISTOGRAMS_H_ #define PWGEM_PHOTONMESON_UTILS_NMHISTOGRAMS_H_ #include "PWGEM/PhotonMeson/Utils/MCUtilities.h" -#include "PWGEM/PhotonMeson/Utils/PairUtilities.h" -#include "Framework/HistogramRegistry.h" +#include +#include -#include "TF1.h" +#include +#include +#include +#include #include -using namespace o2::framework; -using namespace o2::aod::pwgem::photonmeson::utils::mcutil; - namespace o2::aod::pwgem::photonmeson::utils::nmhistogram { -void addNMHistograms(HistogramRegistry* fRegistry, bool isMC, const char* pairname = "#gamma#gamma") +inline void addNMHistograms(o2::framework::HistogramRegistry* fRegistry, bool isMC, const char* pairname = "#gamma#gamma") { // !!Don't change pt,eta,y binning. These binnings have to be consistent with binned data at skimming.!! std::vector ptbins; - for (int i = 0; i < 2; i++) { + for (int i = 0; i < 2; i++) { // o2-linter: disable=magic-number (just numbers for binning) ptbins.emplace_back(0.05 * (i - 0) + 0.0); // from 0 to 0.05 GeV/c, every 0.05 GeV/c } - for (int i = 2; i < 51; i++) { + for (int i = 2; i < 51; i++) { // o2-linter: disable=magic-number (just numbers for binning) ptbins.emplace_back(0.1 * (i - 2) + 0.1); // from 0.1 to 4.9 GeV/c, every 0.1 GeV/c } - for (int i = 51; i < 61; i++) { + for (int i = 51; i < 61; i++) { // o2-linter: disable=magic-number (just numbers for binning) ptbins.emplace_back(0.5 * (i - 51) + 5.0); // from 5 to 9.5 GeV/c, every 0.5 GeV/c } - for (int i = 61; i < 72; i++) { + for (int i = 61; i < 72; i++) { // o2-linter: disable=magic-number (just numbers for binning) ptbins.emplace_back(1.0 * (i - 61) + 10.0); // from 10 to 20 GeV/c, every 1 GeV/c } - const AxisSpec axis_pt{ptbins, Form("p_{T,%s} (GeV/c)", pairname)}; - const AxisSpec axis_mass{400, 0, 0.8, Form("m_{%s} (GeV/c^{2})", pairname)}; + const o2::framework::AxisSpec axis_pt{ptbins, Form("p_{T,%s} (GeV/c)", pairname)}; + const o2::framework::AxisSpec axis_mass{400, 0, 0.8, Form("m_{%s} (GeV/c^{2})", pairname)}; if (isMC) { - fRegistry->add("Pair/Pi0/hs_Primary", "rec. true pi0", kTHnSparseD, {axis_mass, axis_pt}, true); - fRegistry->add("Pair/Pi0/hs_FromWD", "rec. true pi0 from weak decay", kTHnSparseD, {axis_mass, axis_pt}, true); - fRegistry->add("Pair/Pi0/hs_FromHS", "rec. true pi0 from hadronic shower in material", kTHnSparseD, {axis_mass, axis_pt}, true); - fRegistry->add("Pair/Pi0/hs_FromSameGamma", "Two clusters from same gamma that is a pi0 daughter (conversion)", kTHnSparseD, {axis_mass, axis_pt}, true); - fRegistry->add("Pair/Eta/hs_FromSameGamma", "Two clusters from same gamma that is a eta daughter (conversion)", kTHnSparseD, {axis_mass, axis_pt}, true); - fRegistry->add("Pair/Eta/hs_Primary", "rec. true eta", kTHnSparseD, {axis_mass, axis_pt}, true); - fRegistry->add("Pair/Eta/hs_FromWD", "rec. true eta from weak decay", kTHnSparseD, {axis_mass, axis_pt}, true); - fRegistry->add("Pair/Eta/hs_FromHS", "rec. true eta from hadronic shower in material", kTHnSparseD, {axis_mass, axis_pt}, true); + fRegistry->add("Pair/Pi0/hs_Primary", "rec. true pi0", o2::framework::kTHnSparseD, {axis_mass, axis_pt}, true); + fRegistry->add("Pair/Pi0/hs_FromWD", "rec. true pi0 from weak decay", o2::framework::kTHnSparseD, {axis_mass, axis_pt}, true); + fRegistry->add("Pair/Pi0/hs_FromHS", "rec. true pi0 from hadronic shower in material", o2::framework::kTHnSparseD, {axis_mass, axis_pt}, true); + fRegistry->add("Pair/Pi0/hs_FromSameGamma", "Two clusters from same gamma that is a pi0 daughter (conversion)", o2::framework::kTHnSparseD, {axis_mass, axis_pt}, true); + fRegistry->add("Pair/Eta/hs_Primary", "rec. true eta", o2::framework::kTHnSparseD, {axis_mass, axis_pt}, true); + fRegistry->add("Pair/Eta/hs_FromWD", "rec. true eta from weak decay", o2::framework::kTHnSparseD, {axis_mass, axis_pt}, true); + fRegistry->add("Pair/Eta/hs_FromHS", "rec. true eta from hadronic shower in material", o2::framework::kTHnSparseD, {axis_mass, axis_pt}, true); + fRegistry->add("Pair/Eta/hs_FromSameGamma", "Two clusters from same gamma that is a eta daughter (conversion)", o2::framework::kTHnSparseD, {axis_mass, axis_pt}, true); - const AxisSpec axis_rapidity{{0.0, +0.8, +0.9}, "rapidity |y|"}; - fRegistry->add("Generated/Pi0/hPt", "pT;p_{T} (GeV/c)", kTH1F, {axis_pt}, true); - fRegistry->add("Generated/Pi0/hPtY", "Generated info", kTH2F, {axis_pt, axis_rapidity}, true); + const o2::framework::AxisSpec axis_rapidity{{0.0, +0.8, +0.9}, "rapidity |y|"}; + fRegistry->add("Generated/Pi0/hPt", "pT;p_{T} (GeV/c)", o2::framework::kTH1F, {axis_pt}, true); + fRegistry->add("Generated/Pi0/hPtY", "Generated info", o2::framework::kTH2F, {axis_pt, axis_rapidity}, true); fRegistry->addClone("Generated/Pi0/", "Generated/Eta/"); fRegistry->get(HIST("Generated/Pi0/hPt"))->SetXTitle("p_{T} (GeV/c)"); @@ -70,24 +71,24 @@ void addNMHistograms(HistogramRegistry* fRegistry, bool isMC, const char* pairna fRegistry->get(HIST("Generated/Eta/hPtY"))->SetXTitle("p_{T} (GeV/c)"); fRegistry->get(HIST("Generated/Eta/hPtY"))->SetYTitle("rapidity |y|"); } else { - fRegistry->add("Pair/same/hs", "diphoton", kTHnSparseD, {axis_mass, axis_pt}, true); + fRegistry->add("Pair/same/hs", "diphoton", o2::framework::kTHnSparseD, {axis_mass, axis_pt}, true); fRegistry->addClone("Pair/same/", "Pair/mix/"); } } template -void fillTruePairInfo(HistogramRegistry* fRegistry, TDiphoton const& v12, TMCParitlce const& mcparticle, TMCParticles const& mcparticles, TMCCollisions const&, const TF1* f1fd_k0s_to_pi0 = nullptr, float eventWeight = 1.f) +void fillTruePairInfo(o2::framework::HistogramRegistry* fRegistry, TDiphoton const& v12, TMCParitlce const& mcparticle, TMCParticles const& mcparticles, TMCCollisions const&, const TF1* f1fd_k0s_to_pi0 = nullptr, float eventWeight = 1.f) { int pdg = std::abs(mcparticle.pdgCode()); float weight = eventWeight; - int motherid_strhad = IsFromWD(mcparticle.template emmcevent_as(), mcparticle, mcparticles); + int motherid_strhad = o2::aod::pwgem::photonmeson::utils::mcutil::IsFromWD(mcparticle.template emmcevent_as(), mcparticle, mcparticles); switch (pdg) { - case 111: { + case kPi0: { if (mcparticle.isPhysicalPrimary() || mcparticle.producedByGenerator()) { fRegistry->fill(HIST("Pair/Pi0/hs_Primary"), v12.M(), v12.Pt(), weight); } else if (motherid_strhad > 0) { auto str_had = mcparticles.iteratorAt(motherid_strhad); - if (std::abs(str_had.pdgCode()) == 310 && f1fd_k0s_to_pi0 != nullptr) { + if (std::abs(str_had.pdgCode()) == kK0Short && f1fd_k0s_to_pi0 != nullptr) { weight *= f1fd_k0s_to_pi0->Eval(str_had.pt()); } fRegistry->fill(HIST("Pair/Pi0/hs_FromWD"), v12.M(), v12.Pt(), weight); diff --git a/PWGEM/PhotonMeson/Utils/PCMUtilities.h b/PWGEM/PhotonMeson/Utils/PCMUtilities.h index 095179a24ad..269db4f46fb 100644 --- a/PWGEM/PhotonMeson/Utils/PCMUtilities.h +++ b/PWGEM/PhotonMeson/Utils/PCMUtilities.h @@ -9,17 +9,27 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \commonly used for PCM analyses. +/// \file PCMUtilities.h +/// \brief helper functions commonly used for PCM analyses. /// \author daiki.sekihata@cern.ch #ifndef PWGEM_PHOTONMESON_UTILS_PCMUTILITIES_H_ #define PWGEM_PHOTONMESON_UTILS_PCMUTILITIES_H_ -#include -#include "ReconstructionDataFormats/HelixHelper.h" -#include "DetectorsBase/Propagator.h" -#include "Common/Core/trackUtilities.h" #include "Common/Core/RecoDecay.h" +#include "Common/Core/trackUtilities.h" + +#include +#include +#include +#include + +#include + +#include +#include + +#include //_______________________________________________________________________ inline bool checkAP(const float alpha, const float qt, const float alpha_max = 0.95, const float qt_max = 0.05) @@ -64,8 +74,8 @@ inline void Vtx_recalculationParCov(o2::base::Propagator* prop, const o2::track: // I think this calculation gets the closest point on the track to the conversion point // This alpha is a different alpha than the usual alpha and I think it is the angle between X axis and conversion point - float alphaPos = M_PI + std::atan2(-(xyz[1] - helixPos.yC), -(xyz[0] - helixPos.xC)); - float alphaNeg = M_PI + std::atan2(-(xyz[1] - helixNeg.yC), -(xyz[0] - helixNeg.xC)); + float alphaPos = o2::constants::math::PI + std::atan2(-(xyz[1] - helixPos.yC), -(xyz[0] - helixPos.xC)); + float alphaNeg = o2::constants::math::PI + std::atan2(-(xyz[1] - helixNeg.yC), -(xyz[0] - helixNeg.xC)); float vertexXPos = helixPos.xC + helixPos.rC * std::cos(alphaPos); float vertexYPos = helixPos.yC + helixPos.rC * std::sin(alphaPos); diff --git a/PWGEM/PhotonMeson/Utils/TrackSelection.h b/PWGEM/PhotonMeson/Utils/TrackSelection.h index bdc2f5be533..81803c9cee7 100644 --- a/PWGEM/PhotonMeson/Utils/TrackSelection.h +++ b/PWGEM/PhotonMeson/Utils/TrackSelection.h @@ -9,13 +9,16 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file TrackSelection.h /// \brief helper functions for pair track selection /// \author felix.schlepper@cern.ch #ifndef PWGEM_PHOTONMESON_UTILS_TRACKSELECTION_H_ #define PWGEM_PHOTONMESON_UTILS_TRACKSELECTION_H_ -#include "TPDGCode.h" +#include + +#include namespace o2::pwgem::photonmeson { diff --git a/PWGEM/PhotonMeson/Utils/emcalHistoDefinitions.h b/PWGEM/PhotonMeson/Utils/emcalHistoDefinitions.h index f3eac77ca04..0fc655d8858 100644 --- a/PWGEM/PhotonMeson/Utils/emcalHistoDefinitions.h +++ b/PWGEM/PhotonMeson/Utils/emcalHistoDefinitions.h @@ -9,7 +9,8 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \brief commonly used histogram (axis) definitions for emcal in PWGEM +/// \file emcalHistoDefinitions.h +/// \brief commonly used histograms and axes definitions for emcal in PWGEM /// \author marvin.hemmer@cern.ch #include @@ -19,32 +20,32 @@ #ifndef PWGEM_PHOTONMESON_UTILS_EMCALHISTODEFINITIONS_H_ #define PWGEM_PHOTONMESON_UTILS_EMCALHISTODEFINITIONS_H_ -using namespace o2::framework; - -AxisSpec const gAxis_dEta{100, -0.2f, 0.2f, "#Delta#it{#eta}"}; -AxisSpec const gAxis_dPhi{100, -0.2f, 0.2f, "#Delta#it{#varphi} (rad)"}; -AxisSpec const gAxis_dR{100, 0.0f, 0.2f, "#Delta#it{R}"}; -AxisSpec const gAxis_MatchedTrack{10, 0.5f, 10.5f, "matched track"}; -AxisSpec const gAxis_Eta{160, -0.8f, 0.8f, "#it{#eta}"}; -AxisSpec const gAxis_Phi{144, 0.f, 2 * 3.14159, "#it{#varphi} (rad)"}; - -std::vector EClusBins = {0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, - 1, 1.2, 1.4, 1.6, 1.8, 2, 2.2, 2.4, 2.6, 2.8, - 3, 3.2, 3.4, 3.6, 3.8, 4, 4.2, 4.4, 4.6, 4.8, - 5, 5.5, 6, 6.5, 7, 7.5, 8, 8.5, 9, 9.5, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, - 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200}; -AxisSpec gAxis_EClus = {EClusBins, "#it{E}_{clus} (GeV)"}; - -HistogramConfigSpec gHistoSpec_clusterTM_dEtadPhi({HistType::kTH2F, {gAxis_dEta, gAxis_dPhi}}); -HistogramConfigSpec gHistoSpec_clusterTM_dEtaMT({HistType::kTH2F, {gAxis_dEta, {10, 0.5, 10.5}}}); -HistogramConfigSpec gHistoSpec_clusterTM_dPhiMT({HistType::kTH2F, {gAxis_dPhi, {10, 0.5, 10.5}}}); -HistogramConfigSpec gHistoSpec_clusterTM_dRMT({HistType::kTH2F, {gAxis_dR, {10, 0.5, 10.5}}}); -HistogramConfigSpec gHistoSpec_EtaPhi({HistType::kTH2F, {gAxis_Eta, gAxis_Phi}}); -HistogramConfigSpec gHistoSpec_clusterE({HistType::kTH1F, {gAxis_EClus}}); -HistogramConfigSpec gHistoSpec_clusterECuts({HistType::kTH2F, {gAxis_EClus, {64, -0.5, 63.5}}}); +o2::framework::AxisSpec const gAxisdEta{200, -0.1f, 0.1f, "#Delta#it{#eta}"}; +o2::framework::AxisSpec const gAxisdPhi{200, -0.1f, 0.1f, "#Delta#it{#varphi} (rad)"}; +o2::framework::AxisSpec const gAxisdR{100, 0.0f, 0.2f, "#Delta#it{R}"}; +o2::framework::AxisSpec const gAxisMatchedTrack{10, 0.5f, 10.5f, "matched track"}; +o2::framework::AxisSpec const gAxisEta{160, -0.8f, 0.8f, "#it{#eta}"}; +o2::framework::AxisSpec const gAxisPhi{144, 0.f, 2 * 3.14159, "#it{#varphi} (rad)"}; +o2::framework::AxisSpec const gAxisEoverP{250, 0.f, 2.5f, "#it{E}_{clus.}/#it{p}_{track} (#it{c})"}; + +const std::vector eClusBins = {0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, + 1, 1.2, 1.4, 1.6, 1.8, 2, 2.2, 2.4, 2.6, 2.8, + 3, 3.2, 3.4, 3.6, 3.8, 4, 4.2, 4.4, 4.6, 4.8, + 5, 5.5, 6, 6.5, 7, 7.5, 8, 8.5, 9, 9.5, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, + 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200}; +o2::framework::AxisSpec const gAxisEClus = {eClusBins, "#it{E}_{clus} (GeV)"}; + +o2::framework::HistogramConfigSpec const gHistoSpecClusterTMdEtadPhi({o2::framework::HistType::kTH2F, {gAxisdEta, gAxisdPhi}}); +o2::framework::HistogramConfigSpec const gHistoSpecClusterTMdEtaMT({o2::framework::HistType::kTH2F, {gAxisdEta, {10, 0.5, 10.5}}}); +o2::framework::HistogramConfigSpec const gHistoSpecClusterTMdPhiMT({o2::framework::HistType::kTH2F, {gAxisdPhi, {10, 0.5, 10.5}}}); +o2::framework::HistogramConfigSpec const gHistoSpecClusterTMdRMT({o2::framework::HistType::kTH2F, {gAxisdR, {10, 0.5, 10.5}}}); +o2::framework::HistogramConfigSpec const gHistoSpecEtaPhi({o2::framework::HistType::kTH2F, {gAxisEta, gAxisPhi}}); +o2::framework::HistogramConfigSpec const gHistoSpecClusterE({o2::framework::HistType::kTH1F, {gAxisEClus}}); +o2::framework::HistogramConfigSpec const gHistoSpecClusterECuts({o2::framework::HistType::kTH2F, {gAxisEClus, {64, -0.5, 63.5}}}); +o2::framework::HistogramConfigSpec const gHistoSpecTMEoverP({o2::framework::HistType::kTH2D, {gAxisEClus, gAxisEoverP}}); #endif // PWGEM_PHOTONMESON_UTILS_EMCALHISTODEFINITIONS_H_ diff --git a/PWGEM/PhotonMeson/Utils/gammaConvDefinitions.h b/PWGEM/PhotonMeson/Utils/gammaConvDefinitions.h index a9257d90ee4..2eb11525278 100644 --- a/PWGEM/PhotonMeson/Utils/gammaConvDefinitions.h +++ b/PWGEM/PhotonMeson/Utils/gammaConvDefinitions.h @@ -9,13 +9,15 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file gammaConvDefinitions.h /// \brief commonly used definitions for gammaConv tasks /// \author stephan.friedrich.stiefelmaier@cern.ch #ifndef PWGEM_PHOTONMESON_UTILS_GAMMACONVDEFINITIONS_H_ #define PWGEM_PHOTONMESON_UTILS_GAMMACONVDEFINITIONS_H_ -#include "Framework/AnalysisTask.h" +#include +#include using namespace o2::framework; diff --git a/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx b/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx index 0ffff07c55b..59e22fd8b03 100644 --- a/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx +++ b/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx @@ -53,7 +53,7 @@ using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::soa; -const int kEta = 221; +const int kEtaLocal = 221; struct HfElectronSelectionWithTpcEmcal { @@ -573,15 +573,14 @@ struct HfElectronSelectionWithTpcEmcal { if (particleMc.has_mothers()) { auto const& mother = particleMc.mothers_first_as(); - if (std::abs(mother.pdgCode()) == kEta || std::abs(mother.pdgCode()) == kPi0 || std::abs(mother.pdgCode()) == kGamma) { - + if (std::abs(mother.pdgCode()) == kEtaLocal || std::abs(mother.pdgCode()) == kPi0 || std::abs(mother.pdgCode()) == kGamma) { registry.fill(HIST("hMcgenAllNonHfeElectron"), particleMc.pt()); auto const& gmother = mother.mothers_first_as(); // cases to consider: eta->e, eta->pi0->e, eta->gamma->e, eta->pi0->gamma->e, pi0->e, pi0->gamma->e //================= eta->e ====================================== - if (std::abs(mother.pdgCode()) == kEta) { + if (std::abs(mother.pdgCode()) == kEtaLocal) { if (mother.isPhysicalPrimary()) { if ((std::abs(gmother.pdgCode()) >= pdgCodeCharmMin && std::abs(gmother.pdgCode()) < pdgCodeCharmMax) || @@ -602,7 +601,7 @@ struct HfElectronSelectionWithTpcEmcal { } isEmbPi0 = true; // pi0 -> e } - if (std::abs(gmother.pdgCode()) == kEta) { + if (std::abs(gmother.pdgCode()) == kEtaLocal) { if (gmother.isPhysicalPrimary() || gmother.has_mothers()) { auto const& ggmother = gmother.mothers_first_as(); if ((std::abs(ggmother.pdgCode()) >= pdgCodeCharmMin && std::abs(ggmother.pdgCode()) < pdgCodeCharmMax) || @@ -617,7 +616,7 @@ struct HfElectronSelectionWithTpcEmcal { /// ==================================== eta->gamma->e and eta->pi0->gamma->e============ if (std::abs(mother.pdgCode()) == kGamma) { - if (std::abs(gmother.pdgCode()) == kEta) { + if (std::abs(gmother.pdgCode()) == kEtaLocal) { if (gmother.isPhysicalPrimary() || gmother.has_mothers()) { auto const& ggmother = gmother.mothers_first_as(); if ((std::abs(ggmother.pdgCode()) >= pdgCodeCharmMin && std::abs(ggmother.pdgCode()) < pdgCodeCharmMax) || @@ -638,7 +637,7 @@ struct HfElectronSelectionWithTpcEmcal { } if (gmother.has_mothers()) { auto const& ggmother = gmother.mothers_first_as(); - if (std::abs(ggmother.pdgCode()) == kEta) { + if (std::abs(ggmother.pdgCode()) == kEtaLocal) { if (ggmother.isPhysicalPrimary() || ggmother.has_mothers()) { auto const& gggmother = ggmother.mothers_first_as(); if ((std::abs(gggmother.pdgCode()) >= pdgCodeCharmMin && std::abs(gggmother.pdgCode()) < pdgCodeCharmMax) || diff --git a/PWGHF/HFL/Tasks/taskSingleElectron.cxx b/PWGHF/HFL/Tasks/taskSingleElectron.cxx index b53043cff80..6c4d1f76833 100644 --- a/PWGHF/HFL/Tasks/taskSingleElectron.cxx +++ b/PWGHF/HFL/Tasks/taskSingleElectron.cxx @@ -279,16 +279,16 @@ struct HfTaskSingleElectron { if (grmotherPdg == kPi0) { return GammaPi0; } - if (grmotherPdg == kEta) { + if (grmotherPdg == PdgCode::kEta) { return GammaEta; } - if (grmotherPdg == kOmega) { + if (grmotherPdg == PdgCode::kOmega) { return GammaOmega; } if (grmotherPdg == kPhi) { return GammaPhi; } - if (grmotherPdg == kEtaPrime) { + if (grmotherPdg == PdgCode::kEtaPrime) { return GammaEtaPrime; } if (grmotherPdg == kRho770_0) { @@ -320,12 +320,12 @@ struct HfTaskSingleElectron { mpt = grmotherPt; return GammaPi0; } - if (grmotherPdg == kEta) { + if (grmotherPdg == PdgCode::kEta) { mpdg = grmotherPdg; mpt = grmotherPt; return GammaEta; } - if (grmotherPdg == kOmega) { + if (grmotherPdg == PdgCode::kOmega) { mpdg = grmotherPdg; mpt = grmotherPt; return GammaOmega; @@ -335,7 +335,7 @@ struct HfTaskSingleElectron { mpt = grmotherPt; return GammaPhi; } - if (grmotherPdg == kEtaPrime) { + if (grmotherPdg == PdgCode::kEtaPrime) { mpdg = grmotherPdg; mpt = grmotherPt; return GammaEtaPrime; @@ -355,10 +355,10 @@ struct HfTaskSingleElectron { if (grmothersIdsVec.empty()) { static const std::map pdgToSource = { {kPi0, Pi0}, - {kEta, Eta}, - {kOmega, Omega}, + {PdgCode::kEta, Eta}, + {PdgCode::kOmega, Omega}, {kPhi, Phi}, - {kEtaPrime, EtaPrime}, + {PdgCode::kEtaPrime, EtaPrime}, {kRho770_0, Rho0}, {kKPlus, Ke3}, {kK0Long, K0l}}; @@ -393,16 +393,16 @@ struct HfTaskSingleElectron { mpdg = motherPdg; return Pi0; } - if (motherPdg == kEta) { + if (motherPdg == PdgCode::kEta) { return Eta; } - if (motherPdg == kOmega) { + if (motherPdg == PdgCode::kOmega) { return Omega; } if (motherPdg == kPhi) { return Phi; } - if (motherPdg == kEtaPrime) { + if (motherPdg == PdgCode::kEtaPrime) { return EtaPrime; } if (motherPdg == kRho770_0) { From c423f80dbad834a973249db17c302a8be970e0df Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Wed, 8 Oct 2025 05:03:18 +0200 Subject: [PATCH 658/986] [Common] Add FT0C variant 2 (Run 2 like truncation) (#13239) Co-authored-by: David Dobrigkeit Chinellato Co-authored-by: ALICE Builder --- Common/DataModel/Centrality.h | 2 ++ Common/Tools/Multiplicity/MultModule.h | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Common/DataModel/Centrality.h b/Common/DataModel/Centrality.h index 4713cceb697..97be46c17b1 100644 --- a/Common/DataModel/Centrality.h +++ b/Common/DataModel/Centrality.h @@ -31,6 +31,7 @@ DECLARE_SOA_COLUMN(CentFT0M, centFT0M, float); //! Run 3 cent. f DECLARE_SOA_COLUMN(CentFT0A, centFT0A, float); //! Run 3 cent. from FT0A multiplicity DECLARE_SOA_COLUMN(CentFT0C, centFT0C, float); //! Run 3 cent. from FT0C multiplicity DECLARE_SOA_COLUMN(CentFT0CVariant1, centFT0CVariant1, float); //! Run 3 cent. from FT0C multiplicity +DECLARE_SOA_COLUMN(CentFT0CVariant2, centFT0CVariant2, float); //! Run 3 cent. from FT0C multiplicity, uses classical truncated Nancestors (NOT recommended, cross-check only!) DECLARE_SOA_COLUMN(CentFDDM, centFDDM, float); //! Run 3 cent. from FDDA+FDDC multiplicity DECLARE_SOA_COLUMN(CentNTPV, centNTPV, float); //! Run 3 cent. from the number of tracks contributing to the DECLARE_SOA_COLUMN(CentNGlobal, centNGlobal, float); //! Run 3 cent. from the number of tracks contributing to the PV @@ -59,6 +60,7 @@ DECLARE_SOA_TABLE(CentMFTs, "AOD", "CENTMFT", cent::CentMFT); //! Ru // Run 3 variant tables DECLARE_SOA_TABLE(CentFT0CVariant1s, "AOD", "CENTFT0Cvar1", cent::CentFT0CVariant1); //! Run 3 FT0C variant 1 +DECLARE_SOA_TABLE(CentFT0CVariant2s, "AOD", "CENTFT0Cvar2", cent::CentFT0CVariant2); //! Run 3 FT0C variant 1 - uses truncated Nancestors in glauber fit. Not recommended! for cross-checks only // Run 3 centrality per BC (joinable with BC) DECLARE_SOA_TABLE(BCCentFT0Ms, "AOD", "BCCENTFT0M", cent::CentFT0M, o2::soa::Marker<1>); //! Run 3 FT0M BC centrality table diff --git a/Common/Tools/Multiplicity/MultModule.h b/Common/Tools/Multiplicity/MultModule.h index d2faac6ca16..6df1bd366de 100644 --- a/Common/Tools/Multiplicity/MultModule.h +++ b/Common/Tools/Multiplicity/MultModule.h @@ -90,6 +90,7 @@ static const std::vector tableNames{ "CentFT0As", "CentFT0Cs", "CentFT0CVariant1s", + "CentFT0CVariant2s", "CentFDDMs", "CentNTPVs", "CentNGlobals", @@ -98,7 +99,7 @@ static const std::vector tableNames{ "BCCentFT0As", "BCCentFT0Cs"}; -static constexpr int nTablesConst = 38; +static constexpr int nTablesConst = 39; static const std::vector parameterNames{"enable"}; static const int defaultParameters[nTablesConst][nParameters]{ @@ -139,6 +140,7 @@ static const int defaultParameters[nTablesConst][nParameters]{ {-1}, {-1}, {-1}, + {-1}, {-1}}; // table index : match order above @@ -175,6 +177,7 @@ enum tableIndex { kFV0Mults, // standard kCentFT0As, // standard Run 3 kCentFT0Cs, // standard Run 3 kCentFT0CVariant1s, // standard Run 3 + kCentFT0CVariant2s, // standard Run 3 kCentFDDMs, // standard Run 3 kCentNTPVs, // standard Run 3 kCentNGlobals, // requires track selection task @@ -221,6 +224,7 @@ struct products : o2::framework::ProducesGroup { o2::framework::Produces centFT0A; o2::framework::Produces centFT0C; o2::framework::Produces centFT0CVariant1; + o2::framework::Produces centFT0CVariant2; o2::framework::Produces centFDDM; o2::framework::Produces centNTPV; o2::framework::Produces centNGlobals; @@ -432,6 +436,7 @@ class MultModule CalibrationInfo ft0aInfo = CalibrationInfo("FT0A"); CalibrationInfo ft0cInfo = CalibrationInfo("FT0C"); CalibrationInfo ft0cVariant1Info = CalibrationInfo("FT0Cvar1"); + CalibrationInfo ft0cVariant2Info = CalibrationInfo("FT0Cvar2"); CalibrationInfo fddmInfo = CalibrationInfo("FDD"); CalibrationInfo ntpvInfo = CalibrationInfo("NTracksPV"); CalibrationInfo nGlobalInfo = CalibrationInfo("NGlobal"); @@ -1186,6 +1191,7 @@ class MultModule ft0aInfo.mCalibrationStored = false; ft0cInfo.mCalibrationStored = false; ft0cVariant1Info.mCalibrationStored = false; + ft0cVariant2Info.mCalibrationStored = false; fddmInfo.mCalibrationStored = false; ntpvInfo.mCalibrationStored = false; nGlobalInfo.mCalibrationStored = false; @@ -1225,6 +1231,8 @@ class MultModule getccdb(ft0cInfo, internalOpts.generatorName); if (internalOpts.mEnabledTables[kCentFT0CVariant1s]) getccdb(ft0cVariant1Info, internalOpts.generatorName); + if (internalOpts.mEnabledTables[kCentFT0CVariant2s]) + getccdb(ft0cVariant2Info, internalOpts.generatorName); if (internalOpts.mEnabledTables[kCentFDDMs]) getccdb(fddmInfo, internalOpts.generatorName); if (internalOpts.mEnabledTables[kCentNTPVs]) @@ -1249,7 +1257,9 @@ class MultModule if ( internalOpts.mEnabledTables[kCentFV0As] || internalOpts.mEnabledTables[kCentFT0Ms] || internalOpts.mEnabledTables[kCentFT0As] || internalOpts.mEnabledTables[kCentFT0Cs] || - internalOpts.mEnabledTables[kCentFT0CVariant1s] || internalOpts.mEnabledTables[kCentFDDMs] || + internalOpts.mEnabledTables[kCentFT0CVariant1s] || + internalOpts.mEnabledTables[kCentFT0CVariant2s] || + internalOpts.mEnabledTables[kCentFDDMs] || internalOpts.mEnabledTables[kCentNTPVs] || internalOpts.mEnabledTables[kCentNGlobals] || internalOpts.mEnabledTables[kCentMFTs] || internalOpts.mEnabledTables[kBCCentFT0Ms] || internalOpts.mEnabledTables[kBCCentFT0As] || internalOpts.mEnabledTables[kBCCentFT0Cs]) { @@ -1304,6 +1314,8 @@ class MultModule populateTable(cursors.centFT0C, ft0cInfo, mults[iEv].multFT0CZeq, isInelGt0); if (internalOpts.mEnabledTables[kCentFT0CVariant1s]) populateTable(cursors.centFT0CVariant1, ft0cVariant1Info, mults[iEv].multFT0CZeq, isInelGt0); + if (internalOpts.mEnabledTables[kCentFT0CVariant2s]) + populateTable(cursors.centFT0CVariant2, ft0cVariant2Info, mults[iEv].multFT0CZeq, isInelGt0); if (internalOpts.mEnabledTables[kCentFDDMs]) populateTable(cursors.centFDDM, fddmInfo, mults[iEv].multFDDAZeq + mults[iEv].multFDDCZeq, isInelGt0); if (internalOpts.mEnabledTables[kCentNTPVs]) From 3703f7a1743b0ad258fbdbf0d2a6c21d42c0e35b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Eduardo=20Mu=C3=B1oz=20M=C3=A9ndez?= <56033627+jmunozme@users.noreply.github.com> Date: Tue, 7 Oct 2025 22:43:33 -0600 Subject: [PATCH 659/986] [PWGLF] Add INEL flag (#13262) --- PWGMM/UE/Tasks/uecharged.cxx | 132 +++++++++++++++++++++++++---------- 1 file changed, 97 insertions(+), 35 deletions(-) diff --git a/PWGMM/UE/Tasks/uecharged.cxx b/PWGMM/UE/Tasks/uecharged.cxx index 1e17615ca8a..0ce3891c324 100644 --- a/PWGMM/UE/Tasks/uecharged.cxx +++ b/PWGMM/UE/Tasks/uecharged.cxx @@ -13,7 +13,11 @@ /// \file uecharged.cxx /// \brief Underlying event analysis task /// \since November 2021 -/// \last update: September 2025 +/// \last update: October 2025 + +#include "PWGLF/DataModel/mcCentrality.h" +#include "PWGLF/Utils/inelGt.h" +#include "PWGLF/Utils/mcParticle.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectionDefaults.h" @@ -30,7 +34,7 @@ #include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/Track.h" -#include "TDatabasePDG.h" +#include "TPDGCode.h" #include #include #include @@ -45,8 +49,7 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -using BCsRun3 = soa::Join; +using BCsRun3 = soa::Join; struct ueCharged { @@ -80,8 +83,7 @@ struct ueCharged { selectedTracks.SetMaxChi2PerClusterTPC(4.f); selectedTracks.SetRequireHitsInITSLayers(1, {0, 1}); // one hit in any SPD layer selectedTracks.SetMaxChi2PerClusterITS(36.f); - // selectedTracks.SetMaxDcaXYPtDep([](float pt) { return 0.0105f + 0.0350f / - // pow(pt, 1.1f); }); + // selectedTracks.SetMaxDcaXYPtDep([](float pt) { return 0.0105f + 0.0350f / pow(pt, 1.1f); }); selectedTracks.SetMaxDcaZ(2.f); return selectedTracks; } @@ -91,6 +93,7 @@ struct ueCharged { Service pdg; float deltaPhi(float phia, float phib, float rangeMin, float rangeMax); + // Configurable for event selection Configurable isRun3{"isRun3", true, "is Run3 dataset"}; Configurable piluprejection{"piluprejection", true, "Pileup rejection"}; @@ -98,7 +101,7 @@ struct ueCharged { Configurable sel8{"sel8", true, "Apply the sel8 event selection"}; Configurable removeITSROFBorder{"removeITSROFBorder", false, "Remove ITS Read-Out Frame border and only apply kIsTriggerTVX & kNoTimeFrameBorder (recommended for MC)"}; Configurable analyzeEvandTracksel{"analyzeEvandTracksel", true, "Analyze the event and track selection"}; - + Configurable cfgINELCut{"cfgINELCut", 0, "INEL event selection: 0 no sel, 1 INEL>0, 2 INEL>1"}; // acceptance cuts Configurable cfgTrkEtaCut{"cfgTrkEtaCut", 0.8f, "Eta range for tracks"}; Configurable cfgTrkLowPtCut{"cfgTrkLowPtCut", 0.15f, "Minimum constituent pT"}; @@ -130,6 +133,9 @@ struct ueCharged { static constexpr std::string_view hPtVsPtLeadingTrue[3] = { "hPtVsPtLeadingTrue_NS", "hPtVsPtLeadingTrue_AS", "hPtVsPtLeadingTrue_TS"}; + static constexpr std::string_view hPtVsPtLeadingTruePS[3] = { + "hPtVsPtLeadingTruePS_NS", "hPtVsPtLeadingTruePS_AS", + "hPtVsPtLeadingTruePS_TS"}; // all wo detector effects static constexpr std::string_view pNumDenTrueAll[3] = { "pNumDenTrueAll_NS", "pNumDenTrueAll_AS", "pNumDenTrueAll_TS"}; @@ -140,7 +146,6 @@ struct ueCharged { "pNumDenTrue_NS", "pNumDenTrue_AS", "pNumDenTrue_TS"}; static constexpr std::string_view pSumPtTrue[3] = { "pSumPtTrue_NS", "pSumPtTrue_AS", "pSumPtTrue_TS"}; - // this must have all event selection effects, but it has not been implemented // 50% static constexpr std::string_view pNumDenTruePS[3] = { @@ -165,16 +170,11 @@ struct ueCharged { template void analyzeEventAndTrackSelection(const C& collision, const T& tracks); - Filter trackFilter = (nabs(aod::track::eta) < cfgTrkEtaCut) && - (aod::track::pt > cfgTrkLowPtCut); + Filter trackFilter = (nabs(aod::track::eta) < cfgTrkEtaCut) && (aod::track::pt > cfgTrkLowPtCut); using CollisionTableMCTrue = aod::McCollisions; - using CollisionTableMC = - soa::SmallGroups>; - using TrackTableMC = - soa::Filtered>; + using CollisionTableMC = soa::SmallGroups>; + using TrackTableMC = soa::Filtered>; using ParticleTableMC = aod::McParticles; Preslice perCollision = aod::track::collisionId; void processMC(CollisionTableMCTrue::iterator const& mcCollision, @@ -183,23 +183,16 @@ struct ueCharged { BCsRun3 const&); PROCESS_SWITCH(ueCharged, processMC, "process MC", false); - using CollisionTableMCData = - soa::Join; - using TrackTableMCData = - soa::Filtered>; + using CollisionTableMCData = soa::Join; + using TrackTableMCData = soa::Filtered>; void processDataMC(CollisionTableMCData::iterator const& collision, TrackTableMCData const& tracks, ParticleTableMC const& particles, aod::McCollisions const& mcCollisions); PROCESS_SWITCH(ueCharged, processDataMC, "process data MC", false); - using CollisionTableData = - soa::Join; - using TrackTableData = - soa::Filtered>; + using CollisionTableData = soa::Join; + using TrackTableData = soa::Filtered>; void processData(CollisionTableData::iterator const& collision, TrackTableData const& tracks, aod::FT0s const&, BCsRun3 const&); @@ -207,12 +200,14 @@ struct ueCharged { // add new method }; + WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { WorkflowSpec workflow{}; workflow.push_back(adaptAnalysisTask(cfgc)); return workflow; } + // implementation float ueCharged::deltaPhi(float phia, float phib, float rangeMin = -o2::constants::math::PI / 2.0, @@ -289,7 +284,6 @@ void ueCharged::init(InitContext const&) {{ptAxis}, {121, -3.025, 3.025, "#it{DCA}_{xy} (cm)"}}); ue.add("hPtDCAMat", "Material; DCA_xy; Nch", HistType::kTH2D, {{ptAxis}, {121, -3.025, 3.025, "#it{DCA}_{xy} (cm)"}}); - ue.add("hmultTrue", "mult true", HistType::kTH1F, {{200, -0.5, 199.5, " "}}); ue.add("hmultTrueGen", "mult true all Gen", HistType::kTH1F, @@ -299,8 +293,8 @@ void ueCharged::init(InitContext const&) HistType::kTH1D, {ptAxist}); for (int i = 0; i < 3; ++i) { - ue.add(hPtVsPtLeadingTrue[i].data(), " ", HistType::kTH2D, - {{ptAxist}, {ptAxis}}); + ue.add(hPtVsPtLeadingTrue[i].data(), " ", HistType::kTH2D, {{ptAxist}, {ptAxis}}); + ue.add(hPtVsPtLeadingTruePS[i].data(), " ", HistType::kTH2D, {{ptAxist}, {ptAxis}}); ue.add(pNumDenTrueAll[i].data(), "", HistType::kTProfile, {ptAxist}); ue.add(pSumPtTrueAll[i].data(), "", HistType::kTProfile, {ptAxist}); ue.add(pNumDenTrue[i].data(), "", HistType::kTProfile, {ptAxist}); @@ -324,7 +318,6 @@ void ueCharged::init(InitContext const&) ue.add("phiEta", ";#eta;#varphi", HistType::kTH2F, {{50, -2.5, 2.5}, {200, 0., 2 * o2::constants::math::PI, " "}}); ue.add("hvtxZ", "vtxZ", HistType::kTH1F, {{40, -20.0, 20.0, " "}}); - ue.add("hCounter", "Counter; sel; Nev", HistType::kTH1D, {{7, 0, 7, " "}}); ue.add("hPtLeadingRecPS", "rec pTleading after physics selection", HistType::kTH1D, {ptAxist}); @@ -332,6 +325,14 @@ void ueCharged::init(InitContext const&) HistType::kTH1D, {ptAxist}); ue.add("hPtLeadingVsTracks", "", HistType::kTProfile, {{ptAxist}}); + auto h = ue.get(HIST("hCounter")); + h->GetXaxis()->SetBinLabel(1, "Events read"); + h->GetXaxis()->SetBinLabel(2, "INEL"); + h->GetXaxis()->SetBinLabel(3, "Sel8"); + h->GetXaxis()->SetBinLabel(4, "NoSameBunchPileup"); + h->GetXaxis()->SetBinLabel(5, "IsGoodZvtxFT0vsPV"); + h->GetXaxis()->SetBinLabel(6, "posZ passed"); + for (int i = 0; i < 3; ++i) { ue.add(pNumDenMeasuredPS[i].data(), "Number Density; ; #LT #it{N}_{trk} #GT", HistType::kTProfile, @@ -512,7 +513,7 @@ template void ueCharged::processTrue(const C& mcCollision, const P& particles) { int multTrue = 0; - int multTrueINEL = 0; + // int multTrueINEL = 0; for (const auto& particle : particles) { auto pdgParticle = pdg->GetParticle(particle.pdgCode()); if (!pdgParticle || pdgParticle->Charge() == 0.) { @@ -522,7 +523,7 @@ void ueCharged::processTrue(const C& mcCollision, const P& particles) continue; } if (std::abs(particle.eta()) <= 1.0) { - multTrueINEL++; + // multTrueINEL++; } if (std::abs(particle.eta()) >= cfgTrkEtaCut) { continue; @@ -534,7 +535,16 @@ void ueCharged::processTrue(const C& mcCollision, const P& particles) ue.fill(HIST("hPtInPrimGen"), particle.pt()); } ue.fill(HIST("hmultTrueGen"), multTrue); - if (std::abs(mcCollision.posZ()) > 10.f && multTrueINEL <= 0) { + + if (cfgINELCut == 1 && !o2::pwglf::isINELgt0mc(particles, pdg)) { + return; + } + + if (cfgINELCut == 2 && !o2::pwglf::isINELgt1mc(particles, pdg)) { + return; + } + + if (std::abs(mcCollision.posZ()) > 10.f) { return; } @@ -648,6 +658,14 @@ void ueCharged::processMeas(const C& collision, const T& tracks) ue.fill(HIST("hCounter"), 0); + if (cfgINELCut == 1 && !collision.isInelGt0()) { + return; + } + + if (cfgINELCut == 2 && !collision.isInelGt1()) { + return; + } + ue.fill(HIST("hCounter"), 1); if (sel8 && !collision.sel8()) { @@ -668,6 +686,7 @@ void ueCharged::processMeas(const C& collision, const T& tracks) } ue.fill(HIST("hCounter"), 3); + if (goodzvertex && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { return; @@ -860,6 +879,14 @@ void ueCharged::processMeasMC(const C& collision, const T& tracks, const P& particles) { + if (cfgINELCut == 1 && !o2::pwglf::isINELgt0mc(particles, pdg)) { + return; + } + + if (cfgINELCut == 2 && !o2::pwglf::isINELgt1mc(particles, pdg)) { + return; + } + ue.fill(HIST("hStat"), collision.size()); auto vtxZ = collision.posZ(); @@ -960,6 +987,14 @@ void ueCharged::processMeasMC(const C& collision, const T& tracks, ue.fill(HIST("hCounter"), 0); + if (cfgINELCut == 1 && !collision.isInelGt0()) { + return; + } + + if (cfgINELCut == 2 && !collision.isInelGt1()) { + return; + } + ue.fill(HIST("hCounter"), 1); if (sel8 && !collision.sel8()) { @@ -978,18 +1013,20 @@ void ueCharged::processMeasMC(const C& collision, const T& tracks, !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { return; } + ue.fill(HIST("hCounter"), 3); if (goodzvertex && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { return; } + ue.fill(HIST("hCounter"), 4); - // only PS if ((std::abs(collision.posZ()) >= 10.f)) { return; } + ue.fill(HIST("hCounter"), 5); ue.fill(HIST(pNumDenTruePS[0]), flPtTrue, ueTrue[0]); @@ -1020,7 +1057,24 @@ void ueCharged::processMeasMC(const C& collision, const T& tracks, continue; } ue.fill(HIST("hPtInPrim"), particle.pt()); + + // remove the autocorrelation + if (flIndexTrue == particle.globalIndex()) { + continue; + } + double dPhi = deltaPhi(particle.phi(), flPhiTrue); + + // definition of the topological regions + if (std::abs(dPhi) < o2::constants::math::PI / 3.0) { // near side + ue.fill(HIST(hPtVsPtLeadingTruePS[0]), flPtTrue, particle.pt()); + } else if (std::abs(dPhi - o2::constants::math::PI) < + o2::constants::math::PI / 3.0) { // away side + ue.fill(HIST(hPtVsPtLeadingTruePS[1]), flPtTrue, particle.pt()); + } else { // transverse side + ue.fill(HIST(hPtVsPtLeadingTruePS[2]), flPtTrue, particle.pt()); + } } + ue.fill(HIST("hmultTrue"), multTrue); // loop over selected tracks @@ -1229,6 +1283,14 @@ void ueCharged::analyzeEventAndTrackSelection(const C& collision, const T& tracks) { + if (cfgINELCut == 1 && !collision.isInelGt0()) { + return; + } + + if (cfgINELCut == 2 && !collision.isInelGt1()) { + return; + } + // z-vertex from FT0 vs PV analysis const auto& foundBC = collision.template foundBC_as(); From 6dc7be0065d737dedfb4892ccb4644c97e6065bb Mon Sep 17 00:00:00 2001 From: Jaideep Tanwar <141036812+jtanwar2212@users.noreply.github.com> Date: Wed, 8 Oct 2025 13:20:42 +0530 Subject: [PATCH 660/986] [PWGLF] Update correction on pT, with minor changes in configurables (#13269) --- PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx | 105 +++++++++++++++++++++++---- 1 file changed, 92 insertions(+), 13 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx b/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx index d1634c4f294..1762e26375e 100644 --- a/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx +++ b/PWGLF/Tasks/Nuspex/nucleitpcpbpb.cxx @@ -55,6 +55,7 @@ namespace { static const int nParticles = 6; static const std::vector particleNames{"pion", "proton", "deuteron", "triton", "helion", "alpha"}; +static const std::vector correctedparticleNames{"helion", "antihelion", "alpha", "antialpha"}; static const std::vector particlePdgCodes{211, 2212, o2::constants::physics::kDeuteron, o2::constants::physics::kTriton, o2::constants::physics::kHelium3, o2::constants::physics::kAlpha}; static const std::vector particleMasses{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron, o2::constants::physics::MassTriton, o2::constants::physics::MassHelium3, o2::constants::physics::MassAlpha}; static const std::vector particleCharge{1, 1, 1, 1, 2, 2}; @@ -88,6 +89,15 @@ constexpr double kTrackPIDSettings2[nParticles][nTrkSettings2]{ {1, -5, 4, 1, 1, 2}, {1, -5, 4, 1, 1, 2}}; +static const int nfittingparticle = 4; +const int nfittingparameters = 4; +static const std::vector trackcorrectionNames{"correctionneed", "a", "b", "c"}; +constexpr double ktrackcorrection[nfittingparticle][nfittingparameters]{ + {1, 0.464215, 0.195771, 0.0183111}, // He3 + {1, 0.464215, 0.195771, 0.0183111}, // anti-He3 + {1, 0.00765, 0.503791, -1.10517}, // He4 + {1, 0.00765, 0.503791, -1.10517}}; // anti-He4 + struct PrimParticles { TString name; int pdgCode, charge; @@ -145,13 +155,14 @@ struct NucleitpcPbPb { Configurable cfgminGetMeanItsClsSizeRequire{"cfgminGetMeanItsClsSizeRequire", true, "Require minGetMeanItsClsSize Cut"}; Configurable cfgmaxGetMeanItsClsSizeRequire{"cfgmaxGetMeanItsClsSizeRequire", true, "Require maxGetMeanItsClsSize Cut"}; Configurable cfgRequirebetaplot{"cfgRequirebetaplot", true, "Require beta plot"}; - Configurable cfgMasscut{"cfgMasscut", true, "Require mass cut on He4 particles"}; Configurable cfgdcaxynopt{"cfgdcaxynopt", true, "DCA xy cut without pT dependent"}; Configurable cfgdcaznopt{"cfgdcaznopt", false, "DCA xy cut without pT dependent"}; + Configurable cfgmass2{"cfgmass2", true, "Fill mass square difference"}; Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {kBetheBlochDefault[0], nParticles, nBetheParams, particleNames, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for light nuclei"}; Configurable> cfgTrackPIDsettings{"cfgTrackPIDsettings", {kTrackPIDSettings[0], nParticles, nTrkSettings, particleNames, trackPIDsettingsNames}, "track selection and PID criteria"}; Configurable> cfgTrackPIDsettings2{"cfgTrackPIDsettings2", {kTrackPIDSettings2[0], nParticles, nTrkSettings2, particleNames, trackPIDsettingsNames2}, "track selection and PID criteria"}; + Configurable> cfgktrackcorrection{"cfgktrackcorrection", {ktrackcorrection[0], nfittingparticle, nfittingparameters, correctedparticleNames, trackcorrectionNames}, "fitting paramters"}; Configurable cfgFillhspectra{"cfgFillhspectra", true, "fill data sparsh"}; Configurable cfgFillmass{"cfgFillmass", false, "Fill mass histograms"}; Configurable cfgFillmassnsigma{"cfgFillmassnsigma", true, "Fill mass vs nsigma histograms"}; @@ -162,6 +173,10 @@ struct NucleitpcPbPb { Configurable cfgZvertex{"cfgZvertex", 10, "Min Z Vertex"}; Configurable cfgZvertexRequireMC{"cfgZvertexRequireMC", true, "Pos Z cut in MC"}; Configurable cfgsel8Require{"cfgsel8Require", true, "sel8 cut require"}; + Configurable cfgminmassrejection{"cfgminmassrejection", 6.5, "Min side of He3 particle rejection"}; + Configurable cfgmaxmassrejection{"cfgmaxmassrejection", 9.138, "Max side of He3 particle rejection"}; + Configurable cfghe3massrejreq{"cfghe3massrejreq", true, "Require mass cut on He4 particles"}; + o2::track::TrackParametrizationWithError mTrackParCov; // Binning configuration ConfigurableAxis axisMagField{"axisMagField", {10, -10., 10.}, "magnetic field"}; @@ -225,6 +240,8 @@ struct NucleitpcPbPb { histos.add("hSpectra", " ", HistType::kTHnSparseF, {speciesBitAxis, ptAxis, nsigmaAxis, {5, -2.5, 2.5}, axisCent, axisDCA, axisDCA}); } histos.add("histeta", "histeta", kTH1F, {axiseta}); + histos.add("dcaZ", "dcaZ", kTH2F, {ptAxis, axisDCA}); + histos.add("dcaXY", "dcaXY", kTH2F, {ptAxis, axisDCA}); histos.add("Tofsignal", "Tofsignal", kTH2F, {axisRigidity, {4000, 0.2, 1.2, "#beta"}}); histos.add("Tpcsignal", "Tpcsignal", kTH2F, {axisRigidity, axisdEdx}); @@ -343,6 +360,33 @@ struct NucleitpcPbPb { mTrackParCov.setPID(track.pidForTracking()); ptMomn = (i == he3 || i == he4) ? 2 * mTrackParCov.getPt() : mTrackParCov.getPt(); + double a = 0, b = 0, c = 0; + + int param = -1; + if (i == he3) { + param = (track.sign() > 0) ? 0 : 1; + } else if (i == he4) { + param = (track.sign() > 0) ? 2 : 3; + } + + if (param >= 0) { + a = cfgktrackcorrection->get(param, "a"); + b = cfgktrackcorrection->get(param, "b"); + c = cfgktrackcorrection->get(param, "c"); + } + + if (i == he4 && cfgmccorrectionhe4Require) { + ptMomn = ptMomn + a + b * std::exp(c * ptMomn); + } + + if (i == he3 && cfgmccorrectionhe4Require) { + int pidGuess = track.pidForTracking(); + int antitriton = 6; + if (pidGuess == antitriton) { + ptMomn = ptMomn - a + b * ptMomn - c * ptMomn * ptMomn; + } + } + int sign = (track.sign() > 0) ? 1 : ((track.sign() < 0) ? -1 : 0); if (std::abs(getRapidity(track, i)) > cfgCutRapidity && cfgRapidityRequire) @@ -391,6 +435,9 @@ struct NucleitpcPbPb { histos.fill(HIST("Tpcsignal"), getRigidity(track) * track.sign(), track.tpcSignal()); + histos.fill(HIST("dcaXY"), ptMomn, track.dcaXY()); + histos.fill(HIST("dcaZ"), ptMomn, track.dcaZ()); + if (cfgFillhspectra && cfgTrackPIDsettings2->get(i, "fillsparsh") == 1) { if (i != he4) { @@ -411,7 +458,7 @@ struct NucleitpcPbPb { float massTOF = p * charge * std::sqrt(1.f / (beta * beta) - 1.f); // Apply mass cut for he4 (mass^2 around 3.73^2 = 13.9) - if (cfgMasscut && (massTOF * massTOF > 6.5 && massTOF * massTOF < 9.138)) { + if (cfghe3massrejreq && (massTOF * massTOF > cfgminmassrejection && massTOF * massTOF < cfgmaxmassrejection)) { continue; // Skip if mass cut fails } @@ -685,9 +732,6 @@ struct NucleitpcPbPb { if (std::abs(pdg) != std::abs(particlePdgCodes.at(i))) continue; - if (std::abs(getRapidity(track, i)) > cfgCutRapidity && cfgRapidityRequire) - continue; - float ptReco; setTrackParCov(track, mTrackParCov); mTrackParCov.setPID(track.pidForTracking()); @@ -696,18 +740,36 @@ struct NucleitpcPbPb { int particleAnti = (pdg > 0) ? 0 : 1; - if (pdg == -particlePdgCodes.at(5) && cfgmccorrectionhe4Require) { - ptReco = ptReco + 0.00765 + 0.503791 * std::exp(-1.10517 * ptReco); + double a = 0, b = 0, c = 0; + + int param = -1; + if (i == he3) { + param = (-particlePdgCodes.at(4) > 0) ? 0 : 1; + } else if (i == he4) { + param = (-particlePdgCodes.at(4) > 0) ? 2 : 3; + } + + if (param >= 0) { + a = cfgktrackcorrection->get(param, "a"); + b = cfgktrackcorrection->get(param, "b"); + c = cfgktrackcorrection->get(param, "c"); } - if (pdg == -particlePdgCodes.at(4) && cfgmccorrectionhe4Require) { + if (std::abs(pdg) == particlePdgCodes.at(5) && cfgmccorrectionhe4Require) { + ptReco = ptReco + a + b * std::exp(c * ptReco); + } + + if (std::abs(pdg) == particlePdgCodes.at(4) && cfgmccorrectionhe4Require) { int pidGuess = track.pidForTracking(); int antitriton = 6; if (pidGuess == antitriton) { - ptReco = ptReco - 0.464215 + 0.195771 * ptReco - 0.0183111 * ptReco * ptReco; + ptReco = ptReco - a + b * ptReco - c * ptReco * ptReco; } } + if (std::abs(getRapidity(track, i)) > cfgCutRapidity && cfgRapidityRequire) + continue; + if (track.tpcNClsFound() < cfgTrackPIDsettings->get(i, "minTPCnCls") && cfgTPCNClsfoundRequire) continue; if (((track.tpcNClsCrossedRows() < cfgTrackPIDsettings->get(i, "minTPCnClsCrossedRows")) || track.tpcNClsCrossedRows() < cfgtpcNClsFindable * track.tpcNClsFindable()) && cfgTPCNClsCrossedRowsRequire) @@ -752,6 +814,11 @@ struct NucleitpcPbPb { ptReco, ptTOF); } + float tpcNsigma = getTPCnSigma(track, primaryParticles.at(i)); + fillhmassnsigma(track, i, tpcNsigma); + histos.fill(HIST("dcaXY"), ptReco, track.dcaXY()); + histos.fill(HIST("dcaZ"), ptReco, track.dcaZ()); + histos.fill(HIST("Tpcsignal"), getRigidity(track) * track.sign(), track.tpcSignal()); // Fill the requested histograms @@ -854,12 +921,24 @@ struct NucleitpcPbPb { float pdgMass = particleMasses[species]; float massDiff = 0.0; if (species != he4) { - massDiff = massTOF - pdgMass; + if (cfgmass2) { + // Compare squared masses + massDiff = massTOF * massTOF - pdgMass * pdgMass; + } else { + // Compare linear masses + massDiff = massTOF - pdgMass; + } } if (species == he4) { - if (cfgMasscut && (massTOF * massTOF > 6.5 && massTOF * massTOF < 9.138)) + if (cfghe3massrejreq && (massTOF * massTOF > cfgminmassrejection && massTOF * massTOF < cfgmaxmassrejection)) return; - massDiff = massTOF - pdgMass; + if (cfgmass2) { + // Compare squared masses + massDiff = massTOF * massTOF - pdgMass * pdgMass; + } else { + // Compare linear masses + massDiff = massTOF - pdgMass; + } } float ptMomn; @@ -893,7 +972,7 @@ struct NucleitpcPbPb { masssquare = massTOF * massTOF; } if (species == he4) { - if (cfgMasscut && (massTOF * massTOF > 6.5 && massTOF * massTOF < 9.138)) + if (cfghe3massrejreq && (massTOF * massTOF > cfgminmassrejection && massTOF * massTOF < cfgmaxmassrejection)) return; masssquare = massTOF * massTOF; } From 34e0e1dff4571169a39726aaa25bf67aaf7626d8 Mon Sep 17 00:00:00 2001 From: Fabrizio Chinu <91954233+fchinu@users.noreply.github.com> Date: Wed, 8 Oct 2025 11:15:46 +0200 Subject: [PATCH 661/986] [PWGHF] Add script to check injected signal in PbPb embedded MC (#13235) --- PWGHF/Tasks/CMakeLists.txt | 5 + PWGHF/Tasks/taskMcInjection.cxx | 247 ++++++++++++++++++++++++++++++++ 2 files changed, 252 insertions(+) create mode 100644 PWGHF/Tasks/taskMcInjection.cxx diff --git a/PWGHF/Tasks/CMakeLists.txt b/PWGHF/Tasks/CMakeLists.txt index b212b705b23..d276ac35c57 100644 --- a/PWGHF/Tasks/CMakeLists.txt +++ b/PWGHF/Tasks/CMakeLists.txt @@ -49,6 +49,11 @@ o2physics_add_dpl_workflow(task-pid-studies PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::AnalysisCCDB COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(task-mc-injection + SOURCES taskMcInjection.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + # o2physics_add_dpl_workflow(task-sel-optimisation # SOURCES taskSelOptimisation.cxx # PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore diff --git a/PWGHF/Tasks/taskMcInjection.cxx b/PWGHF/Tasks/taskMcInjection.cxx new file mode 100644 index 00000000000..b0377cecc23 --- /dev/null +++ b/PWGHF/Tasks/taskMcInjection.cxx @@ -0,0 +1,247 @@ +// 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 taskMcInjection.cxx +/// \brief Task for checking injected events in Pb-Pb MC productions +/// +/// \author Fabrizio Chinu , Università and INFN Torino + +#include "Common/DataModel/Centrality.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +namespace o2::aod +{ +namespace check_mc_pv_contr +{ +// Collisions +DECLARE_SOA_COLUMN(IdCollGen, idCollGen, int); //! Generated collision index +DECLARE_SOA_COLUMN(ImpParGen, impParGen, float); //! Generated impact parameter +DECLARE_SOA_COLUMN(XCollGen, xCollGen, float); //! Generated x coordinate of the collision +DECLARE_SOA_COLUMN(YCollGen, yCollGen, float); //! Generated y coordinate of the collision +DECLARE_SOA_COLUMN(ZCollGen, zCollGen, float); //! Generated z coordinate of the collision +DECLARE_SOA_COLUMN(TimeGen, timeGen, float); //! Generated collision time +DECLARE_SOA_COLUMN(TimeRec, timeRec, float); //! Reconstructed collision time +DECLARE_SOA_COLUMN(NCharm, nCharm, int); //! Number of charm quarks in the collision +DECLARE_SOA_COLUMN(NCharmFromInj, nCharmFromInj, int); //! Number of charm quarks from injected events +DECLARE_SOA_COLUMN(NPVContributors, nPVContributors, int); //! Number of contributors to the PV +DECLARE_SOA_COLUMN(Centrality, centrality, int); //! Centrality FT0C +DECLARE_SOA_COLUMN(XCollRec, xCollRec, float); //! Reconstructed x coordinate of the collision +DECLARE_SOA_COLUMN(YCollRec, yCollRec, float); //! Reconstructed y coordinate of the collision +DECLARE_SOA_COLUMN(ZCollRec, zCollRec, float); //! Reconstructed z coordinate of the collision +DECLARE_SOA_COLUMN(Bc, bc, int); //! Bunch crossing +// Tracks +DECLARE_SOA_COLUMN(Vx, vx, float); // x coordinate of the track production vertex +DECLARE_SOA_COLUMN(Vy, vy, float); // y coordinate of the track production vertex +DECLARE_SOA_COLUMN(Vz, vz, float); // z coordinate of the track production vertex +DECLARE_SOA_COLUMN(IsFromSignal, isFromSignal, bool); // Whether the track is from the signal event +} // namespace check_mc_pv_contr + +DECLARE_SOA_TABLE(CheckInj, "AOD", "CHECKINJ", //! Table with PID information + check_mc_pv_contr::IdCollGen, + check_mc_pv_contr::ImpParGen, + check_mc_pv_contr::XCollGen, + check_mc_pv_contr::YCollGen, + check_mc_pv_contr::ZCollGen, + check_mc_pv_contr::TimeGen, + check_mc_pv_contr::XCollRec, + check_mc_pv_contr::YCollRec, + check_mc_pv_contr::ZCollRec, + check_mc_pv_contr::TimeRec, + check_mc_pv_contr::NCharm, + check_mc_pv_contr::NCharmFromInj, + check_mc_pv_contr::NPVContributors, + check_mc_pv_contr::Centrality, + check_mc_pv_contr::Bc); + +DECLARE_SOA_TABLE(TracksInjection, "AOD", "TRKINJ", //! Table with MC labels for tracks + check_mc_pv_contr::IdCollGen, + check_mc_pv_contr::Vx, + check_mc_pv_contr::Vy, + check_mc_pv_contr::Vz, + check_mc_pv_contr::IsFromSignal); +} // namespace o2::aod + +struct HfTaskMcInjection { + + Produces checkInj; + Produces tracksInj; + + Configurable centMaxForCollDelta{"centMaxForCollDelta", 20., "max. cent. for gen-rec collision position histograms"}; + Configurable nPvContribMaxForCollDelta{"nPvContribMaxForCollDelta", 2000, "max. PV contrib. for gen-rec collision position histograms"}; + + std::shared_ptr hCharmPerCollImpPar, hCollisions; + + using TrackWLabels = soa::Join; + using CollisionWLabels = soa::Join; + + Preslice tracksPerCollision = aod::track::collisionId; + Preslice perMcCollision = aod::mcparticle::mcCollisionId; + PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; + + HistogramRegistry registry{"registry", {}}; + + void init(InitContext&) + { + AxisSpec impParBins = {200, 0, 20}; + AxisSpec deltaXYbins = {200, -0.05, 0.05}; + AxisSpec deltaZbins = {200, -10, 10}; + + registry.add("hCharmImpPar", ";Impact parameter (fm);Charm counts", {HistType::kTH1F, {impParBins}}); + registry.add("hCollImpPar", ";Impact parameter (fm);Counts", {HistType::kTH1F, {impParBins}}); + hCharmPerCollImpPar = registry.add("hCharmPerCollImpPar", ";Impact parameter (fm);Charm counts per collision", {HistType::kTH1F, {impParBins}}); + + registry.add("hDeltaX", ";#DeltaX (cm);Counts", {HistType::kTH1F, {{deltaXYbins}}}); + registry.add("hDeltaY", ";#DeltaY (cm);Counts", {HistType::kTH1F, {{deltaXYbins}}}); + registry.add("hDeltaZ", ";#DeltaZ (cm);Counts", {HistType::kTH1F, {{deltaZbins}}}); + + registry.add("hDeltaX_NPV_lt", ";#DeltaX (cm);Counts", {HistType::kTH1F, {{deltaXYbins}}}); + registry.add("hDeltaY_NPV_lt", ";#DeltaY (cm);Counts", {HistType::kTH1F, {{deltaXYbins}}}); + registry.add("hDeltaZ_NPV_lt", ";#DeltaZ (cm);Counts", {HistType::kTH1F, {{deltaZbins}}}); + + registry.add("hDeltaX_NPV_gt", ";#DeltaX (cm);Counts", {HistType::kTH1F, {{deltaXYbins}}}); + registry.add("hDeltaY_NPV_gt", ";#DeltaY (cm);Counts", {HistType::kTH1F, {{deltaXYbins}}}); + registry.add("hDeltaZ_NPV_gt", ";#DeltaZ (cm);Counts", {HistType::kTH1F, {{deltaZbins}}}); + + registry.add("hDeltaXSngBkg", ";#DeltaX (signal/bkg) (cm);Counts", {HistType::kTH1F, {{200, -10, 10}}}); + registry.add("hDeltaYSngBkg", ";#DeltaY (signal/bkg) (cm);Counts", {HistType::kTH1F, {{200, -10, 10}}}); + registry.add("hDeltaZSngBkg", ";#DeltaZ (signal/bkg) (cm);Counts", {HistType::kTH1F, {{200, -20, 20}}}); + + hCollisions = registry.add("hCollisions", ";;Counts", {HistType::kTH1F, {{2, 0.5, 2.5}}}); + hCollisions->GetXaxis()->SetBinLabel(1, "Generated"); + hCollisions->GetXaxis()->SetBinLabel(2, "Reconstructed"); + } + + bool isCharm(int pdg) + { + if (std::abs(pdg) / 1000 == PDG_t::kCharm) // o2-linter: disable=magic-number (get thousands digit) + return true; + if (std::abs(pdg) / 100 == PDG_t::kCharm) // o2-linter: disable=magic-number (get hundreds digit) + return true; + return false; + } + + bool isBeauty(int pdg) // if needed in the future + { + if (std::abs(pdg) / 1000 == PDG_t::kBottom) // o2-linter: disable=magic-number (get thousands digit) + return true; + if (std::abs(pdg) / 100 == PDG_t::kBottom) // o2-linter: disable=magic-number (get hundreds digit) + return true; + return false; + } + + void process(CollisionWLabels const& collisions, + TrackWLabels const& tracks, + aod::McParticles const& mcParticles, + aod::McCollisions const& mcCollisions) + { + for (const auto& mcColl : mcCollisions) { + registry.fill(HIST("hCollImpPar"), mcColl.impactParameter()); + const auto mcPartColl = mcParticles.sliceBy(perMcCollision, mcColl.globalIndex()); + double xAvgSgn{0.}, yAvgSgn{0.}, zAvgSgn{0.}; + double xAvgBkg{0.}, yAvgBkg{0.}, zAvgBkg{0.}; + int nSgn{0}, nBkg{0}; + for (const auto& mcPart : mcPartColl) { + if (isCharm(mcPart.pdgCode())) { // charm hadron + registry.fill(HIST("hCharmImpPar"), mcColl.impactParameter()); + } + if (mcPart.fromBackgroundEvent()) { + xAvgBkg += mcPart.vx(); + yAvgBkg += mcPart.vy(); + zAvgBkg += mcPart.vz(); + nBkg++; + tracksInj(mcPart.mcCollisionId(), mcPart.vx(), mcPart.vy(), mcPart.vz(), false); + } else { + xAvgSgn += mcPart.vx(); + yAvgSgn += mcPart.vy(); + zAvgSgn += mcPart.vz(); + nSgn++; + tracksInj(mcPart.mcCollisionId(), mcPart.vx(), mcPart.vy(), mcPart.vz(), true); + } + } + registry.fill(HIST("hDeltaXSngBkg"), xAvgSgn / nSgn - xAvgBkg / nBkg); + registry.fill(HIST("hDeltaYSngBkg"), yAvgSgn / nSgn - yAvgBkg / nBkg); + registry.fill(HIST("hDeltaZSngBkg"), zAvgSgn / nSgn - zAvgBkg / nBkg); + + const auto collSlice = collisions.sliceBy(colPerMcCollision, mcColl.globalIndex()); + + // Then we fill the histogram with the distances of the collisions + for (const auto& collision : collSlice) { + const auto collTracks = tracks.sliceBy(tracksPerCollision, collision.globalIndex()); + int fromSignalEv{0}; + if (collision.centFT0C() < centMaxForCollDelta) { + registry.fill(HIST("hDeltaX"), collision.posX() - collision.mcCollision().posX()); + registry.fill(HIST("hDeltaY"), collision.posY() - collision.mcCollision().posY()); + registry.fill(HIST("hDeltaZ"), collision.posZ() - collision.mcCollision().posZ()); + + if (collision.numContrib() > nPvContribMaxForCollDelta) { + registry.fill(HIST("hDeltaX_NPV_gt"), collision.posX() - collision.mcCollision().posX()); + registry.fill(HIST("hDeltaY_NPV_gt"), collision.posY() - collision.mcCollision().posY()); + registry.fill(HIST("hDeltaZ_NPV_gt"), collision.posZ() - collision.mcCollision().posZ()); + } else { + registry.fill(HIST("hDeltaX_NPV_lt"), collision.posX() - collision.mcCollision().posX()); + registry.fill(HIST("hDeltaY_NPV_lt"), collision.posY() - collision.mcCollision().posY()); + registry.fill(HIST("hDeltaZ_NPV_lt"), collision.posZ() - collision.mcCollision().posZ()); + } + } + std::unordered_set charmIds{}; + for (const auto& track : collTracks) { + if (track.has_mcParticle()) { + auto mcPart = track.mcParticle_as(); + for (const auto& mother : mcPart.mothers_as()) { + if (isCharm(mother.pdgCode())) { // charm hadron + if (!charmIds.contains(mother.globalIndex())) { + charmIds.emplace(mother.globalIndex()); + fromSignalEv += static_cast(!mother.fromBackgroundEvent()); + } + break; + } + } + } + } + checkInj( + mcColl.globalIndex(), mcColl.impactParameter(), + mcColl.posX(), mcColl.posY(), mcColl.posZ(), mcColl.t(), + collision.posX(), collision.posY(), collision.posZ(), collision.collisionTime(), + charmIds.size(), fromSignalEv, collision.numContrib(), collision.centFT0C(), collision.bcId()); + } + } + + hCharmPerCollImpPar->Divide(registry.get(HIST("hCharmImpPar")).get(), registry.get(HIST("hCollImpPar")).get(), 1, 1); + hCollisions->Fill(1, mcCollisions.size()); + hCollisions->Fill(2, collisions.size()); + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From 48aa315225a6884f1cc9d3814c733683f7030b64 Mon Sep 17 00:00:00 2001 From: alcaliva <32872606+alcaliva@users.noreply.github.com> Date: Wed, 8 Oct 2025 11:53:40 +0200 Subject: [PATCH 662/986] [PWGLF] add histograms for syst uncertainty on primary fraction (#13272) --- PWGLF/Tasks/Nuspex/antinucleiInJets.cxx | 146 ++++++++++++++++++++++++ 1 file changed, 146 insertions(+) diff --git a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx index 86ce8a1a340..c37bdc6aeb9 100644 --- a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx +++ b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx @@ -142,6 +142,22 @@ struct AntinucleiInJets { Configurable cfgCompensatePIDinTracking{"cfgCompensatePIDinTracking", false, "If true, divide tpcInnerParam by the electric charge"}; Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {0.6539, 1.591, 0.8225, 2.363, 0.09}, "TPC Bethe-Bloch parameterisation for He3"}; + // Configuration parameters for CCDB access and reweighting input files + Configurable urlToCcdb{"urlToCcdb", "http://alice-ccdb.cern.ch", "url of the personal ccdb"}; + Configurable pathToFile{"pathToFile", "Users/a/alcaliva/PrimaryFractionAntip", "path to file with reweighting"}; + Configurable weightsProton{"weightsProton", "", "weightsProton"}; + Configurable weightsLambda{"weightsLambda", "", "weightsLambda"}; + Configurable weightsSigma{"weightsSigma", "", "weightsSigma"}; + Configurable weightsXi{"weightsXi", "", "weightsXi"}; + Configurable weightsOmega{"weightsOmega", "", "weightsOmega"}; + + // Reweighting histograms + TH1F* primaryAntiprotons; + TH1F* primaryAntiLambda; + TH1F* primaryAntiSigma; + TH1F* primaryAntiXi; + TH1F* primaryAntiOmega; + // CCDB manager service for accessing condition data Service ccdb; @@ -179,6 +195,16 @@ struct AntinucleiInJets { itsResponse.setMCDefaultParameters(); } + // Load reweighting histograms from CCDB if antinuclei efficiency processing is enabled + if (doprocessAntinucleiEfficiency) { + ccdb->setURL(urlToCcdb.value); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + ccdb->setFatalWhenNull(false); + getReweightingHistograms(ccdb, TString(pathToFile), TString(weightsProton), TString(weightsLambda), TString(weightsSigma), TString(weightsXi), TString(weightsOmega)); + } + // Binning double min = 0.0; double max = 6.0; @@ -361,6 +387,17 @@ struct AntinucleiInJets { // nsigmaITS for antiproton candidates registryMC.add("antiproton_nsigma_its_mc", "antiproton_nsigma_its_mc", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{ITS}"}}); + + // Systematics on the fraction of primary antiprotons + registryMC.add("antip_prim_pythia", "antip_prim_pythia", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antip_prim_std", "antip_prim_std", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antip_prim_up", "antip_prim_up", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antip_prim_low", "antip_prim_low", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); + + registryMC.add("antip_sec_pythia", "antip_sec_pythia", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antip_sec_std", "antip_sec_std", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antip_sec_up", "antip_sec_up", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antip_sec_low", "antip_sec_low", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); } // Systematic uncertainties (Data) @@ -442,6 +479,27 @@ struct AntinucleiInJets { } } + void getReweightingHistograms(o2::framework::Service const& ccdbObj, TString filepath, TString antip, TString antilambda, TString antisigma, TString antixi, TString antiomega) + { + TList* list = ccdbObj->get(filepath.Data()); + if (!list) { + LOGP(error, "Could not retrieve the list from CCDB"); + return; + } + + primaryAntiprotons = static_cast(list->FindObject(antip)); + primaryAntiLambda = static_cast(list->FindObject(antilambda)); + primaryAntiSigma = static_cast(list->FindObject(antisigma)); + primaryAntiXi = static_cast(list->FindObject(antixi)); + primaryAntiOmega = static_cast(list->FindObject(antiomega)); + + if (!primaryAntiprotons || !primaryAntiSigma || !primaryAntiLambda || !primaryAntiXi || !primaryAntiOmega) { + LOGP(error, "Missing one or more reweighting histograms in CCDB list"); + } + + LOGP(info, "Successfully loaded reweighting histograms from CCDB path"); + } + // Compute two unit vectors perpendicular to p void getPerpendicularAxis(const TVector3& p, TVector3& u, double sign) { @@ -1344,6 +1402,94 @@ struct AntinucleiInJets { continue; const auto particle = track.mcParticle(); + // **************************************************************************************************************** + + // Systematic uncertainty on primary fraction + if (track.sign() < 0 && particle.pdgCode() == PDG_t::kProtonBar) { + + // Primary antiprotons + if (particle.isPhysicalPrimary()) { + + // Initialize weights + double wPrimStd(1.0), wPrimUp(1.0), wPrimLow(1.0); + + // Weight assignment + if (particle.pt() < primaryAntiprotons->GetXaxis()->GetXmax()) { + int ipt = primaryAntiprotons->FindBin(particle.pt()); + wPrimStd = primaryAntiprotons->GetBinContent(ipt); + wPrimUp = wPrimStd + primaryAntiprotons->GetBinError(ipt); + wPrimLow = wPrimStd - primaryAntiprotons->GetBinError(ipt); + } + + // Fill histograms + registryMC.fill(HIST("antip_prim_pythia"), track.pt()); + registryMC.fill(HIST("antip_prim_std"), track.pt(), wPrimStd); + registryMC.fill(HIST("antip_prim_up"), track.pt(), wPrimUp); + registryMC.fill(HIST("antip_prim_low"), track.pt(), wPrimLow); + } + + // Secondary antiprotons from week decays + if (!particle.isPhysicalPrimary() && particle.has_mothers()) { + + // Initialize weights + double wSecStd(1.0), wSecUp(1.0), wSecLow(1.0); + auto mother = mcParticles.iteratorAt(particle.mothersIds()[0]); + + // Antiprotons from sigma + if (std::abs(mother.pdgCode()) == PDG_t::kSigmaBarMinus) { + if (mother.pt() < primaryAntiSigma->GetXaxis()->GetXmax()) { + int ipt = primaryAntiSigma->FindBin(mother.pt()); + wSecStd = primaryAntiSigma->GetBinContent(ipt); + wSecUp = wSecStd + primaryAntiSigma->GetBinError(ipt); + wSecLow = wSecStd - primaryAntiSigma->GetBinError(ipt); + } + } + + // Antiprotons from primary Lambda0 + if (std::abs(mother.pdgCode()) == kLambda0Bar) { + if (mother.isPhysicalPrimary()) { + if (mother.pt() < primaryAntiLambda->GetXaxis()->GetXmax()) { + int ipt = primaryAntiLambda->FindBin(mother.pt()); + wSecStd = primaryAntiLambda->GetBinContent(ipt); + wSecUp = wSecStd + primaryAntiLambda->GetBinError(ipt); + wSecLow = wSecStd - primaryAntiLambda->GetBinError(ipt); + } + } + + // Antiprotons from secondary Lambda0 (Xi -> Lambda0) + if (!mother.isPhysicalPrimary()) { + auto grandmother = mcParticles.iteratorAt(mother.mothersIds()[0]); + if (std::abs(grandmother.pdgCode()) == kXiMinus) { + if (grandmother.pt() < primaryAntiXi->GetXaxis()->GetXmax()) { + int ipt = primaryAntiXi->FindBin(grandmother.pt()); + wSecStd = primaryAntiXi->GetBinContent(ipt); + wSecUp = wSecStd + primaryAntiXi->GetBinError(ipt); + wSecLow = wSecStd - primaryAntiXi->GetBinError(ipt); + } + } + + // Antiprotons from secondary Lambda0 (Omega -> Lambda0) + if (std::abs(grandmother.pdgCode()) == kOmegaMinus) { + if (grandmother.pt() < primaryAntiOmega->GetXaxis()->GetXmax()) { + int ipt = primaryAntiOmega->FindBin(grandmother.pt()); + wSecStd = primaryAntiOmega->GetBinContent(ipt); + wSecUp = wSecStd + primaryAntiOmega->GetBinError(ipt); + wSecLow = wSecStd - primaryAntiOmega->GetBinError(ipt); + } + } + } + } + + // Fill histograms + registryMC.fill(HIST("antip_sec_pythia"), track.pt()); + registryMC.fill(HIST("antip_sec_std"), track.pt(), wSecStd); + registryMC.fill(HIST("antip_sec_up"), track.pt(), wSecUp); + registryMC.fill(HIST("antip_sec_low"), track.pt(), wSecLow); + } + } + + // **************************************************************************************************************** + // Select only physical primary particles if (!particle.isPhysicalPrimary()) continue; From 095feea044f32a7463669c731c469d169c9b6e72 Mon Sep 17 00:00:00 2001 From: jaimenorman Date: Wed, 8 Oct 2025 11:15:43 +0100 Subject: [PATCH 663/986] [PWGJE] Add MC outlier QA task (#13260) --- PWGJE/Tasks/CMakeLists.txt | 4 + PWGJE/Tasks/jetOutlierQA.cxx | 591 +++++++++++++++++++++++++++++++++++ 2 files changed, 595 insertions(+) create mode 100644 PWGJE/Tasks/jetOutlierQA.cxx diff --git a/PWGJE/Tasks/CMakeLists.txt b/PWGJE/Tasks/CMakeLists.txt index e264dc4032c..f23f26b7ad5 100644 --- a/PWGJE/Tasks/CMakeLists.txt +++ b/PWGJE/Tasks/CMakeLists.txt @@ -160,6 +160,10 @@ if(FastJet_FOUND) SOURCES jetFinderQA.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-outlier-qa + SOURCES jetOutlierQA.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(jet-charged-v2 SOURCES jetChargedV2.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore diff --git a/PWGJE/Tasks/jetOutlierQA.cxx b/PWGJE/Tasks/jetOutlierQA.cxx new file mode 100644 index 00000000000..16e2ecffbbf --- /dev/null +++ b/PWGJE/Tasks/jetOutlierQA.cxx @@ -0,0 +1,591 @@ +// 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. + +// QA task for MC-based outliers +// +/// \author Jaime Norman + +#include "RecoDecay.h" + +#include "PWGJE/Core/JetDerivedDataUtilities.h" +#include "PWGJE/Core/JetFindingUtilities.h" +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/DataModel/JetReducedData.h" +#include "PWGJE/DataModel/JetSubtraction.h" + +#include "Framework/ASoA.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +struct JetOutlierQATask { + + HistogramRegistry registry; + + Preslice perCol = aod::jtrack::collisionId; + Preslice> perColJets = aod::jet::collisionId; + Preslice> perColJetsMatched = aod::jet::collisionId; + + Configurable eventSelections{"eventSelections", "sel8", "choose event selection"}; + Configurable vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"}; + Configurable centralityMin{"centralityMin", -999.0, "minimum centrality"}; + Configurable centralityMax{"centralityMax", 999.0, "maximum centrality"}; + Configurable> jetRadii{"jetRadii", std::vector{0.4}, "jet resolution parameters"}; + Configurable trackEtaMin{"trackEtaMin", -0.9, "minimum eta acceptance for tracks"}; + Configurable trackEtaMax{"trackEtaMax", 0.9, "maximum eta acceptance for tracks"}; + Configurable trackPtMin{"trackPtMin", 0.15, "minimum pT acceptance for tracks"}; + Configurable trackPtMax{"trackPtMax", 100.0, "maximum pT acceptance for tracks"}; + Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; + Configurable pTHatMaxMCD{"pTHatMaxMCD", 999.0, "maximum fraction of hard scattering for jet acceptance in detector MC"}; + Configurable pTHatMaxMCP{"pTHatMaxMCP", 999.0, "maximum fraction of hard scattering for jet acceptance in particle MC"}; + Configurable pTHatExponent{"pTHatExponent", 6.0, "exponent of the event weight for the calculation of pTHat"}; + Configurable pTHatMaxMCDOutlier{"pTHatMaxMCDOutlier", 3.0, "maximum fraction of hard scattering for jet acceptance in detector MC for outlier studies"}; + Configurable jetPtMax{"jetPtMax", 200., "set jet pT bin max"}; + Configurable jetEtaMin{"jetEtaMin", -99.0, "minimum jet pseudorapidity"}; + Configurable jetEtaMax{"jetEtaMax", 99.0, "maximum jet pseudorapidity"}; + Configurable jetAreaFractionMin{"jetAreaFractionMin", -99.0, "used to make a cut on the jet areas"}; + Configurable leadingConstituentPtMin{"leadingConstituentPtMin", -99.0, "minimum pT selection on jet constituent"}; + Configurable leadingConstituentPtMax{"leadingConstituentPtMax", 9999.0, "maximum pT selection on jet constituent"}; + Configurable trackOccupancyInTimeRangeMax{"trackOccupancyInTimeRangeMax", 999999, "maximum occupancy of tracks in neighbouring collisions in a given time range; only applied to reconstructed collisions (data and mcd jets), not mc collisions (mcp jets)"}; + Configurable trackOccupancyInTimeRangeMin{"trackOccupancyInTimeRangeMin", -999999, "minimum occupancy of tracks in neighbouring collisions in a given time range; only applied to reconstructed collisions (data and mcd jets), not mc collisions (mcp jets)"}; + Configurable splitCollisionsDeltaZ{"splitCollisionsDeltaZ", 0.2, "threshold in delta z to assign as split collision"}; + Configurable splitCollisionsDeltaZPart{"splitCollisionsDeltaZPart", 0.2, "threshold in delta z to assign as split collision particle level"}; + Configurable splitCollisionsDeltaBC{"splitCollisionsDeltaBC", 5, "threshold in BC to assign as split collision"}; + Configurable mergeCollisionsDeltaMin{"mergeCollisionsDeltaMin", -10, "number of prior collisions to search for close Z position"}; + Configurable mergeCollisionsDeltaMax{"mergeCollisionsDeltaMax", 10, "number of following collisions to search for close Z position"}; + + std::map> fBCCollMap; // key: global BC, value: vector of reduced event global indices + + std::vector eventSelectionBits; + int trackSelection = -1; + + std::vector jetPtBins; + std::vector jetPtBinsRhoAreaSub; + + void init(o2::framework::InitContext&) + { + eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(static_cast(eventSelections)); + trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); + + auto jetPtTemp = 0.0; + jetPtBins.push_back(jetPtTemp); + while (jetPtTemp < jetPtMax) { + if (jetPtTemp < 100.0) { + jetPtTemp += 1.0; + jetPtBins.push_back(jetPtTemp); + } else if (jetPtTemp < 200.0) { + jetPtTemp += 5.0; + jetPtBins.push_back(jetPtTemp); + } else { + jetPtTemp += 10.0; + jetPtBins.push_back(jetPtTemp); + } + } + + AxisSpec jetPtAxis = {jetPtBins, "#it{p}_{T} (GeV/#it{c})"}; + + if (doprocessJetsAmbiguous) { + // outliers + registry.add("h3_pthat_jet_pt_jet_ntracks_outliers", "#it#hat{p} (GeV/#it{c});#it{p}_{T,jet} (GeV/#it{c});N_{jet tracks}", {HistType::kTH3F, {{100, 0, 200}, jetPtAxis, {200, -0.5, 199.5}}}); + registry.add("h3_jet_pt_track_dEta_track_dPhi_outliers", "#it{p}_{T,jet} (GeV/#it{c});#Delta#eta;#Delta#phi", {HistType::kTH3F, {jetPtAxis, {100, -0.5, 0.5}, {100, -0.5, 0.5}}}); + registry.add("h3_pthat_jet_pt_jet_ntracks_all", "it#hat{p} (GeV/#it{c});#it{p}_{T,jet} (GeV/#it{c});N_{jet tracks}", {HistType::kTH3F, {{100, 0, 200}, jetPtAxis, {200, -0.5, 199.5}}}); + registry.add("h3_jet_pt_track_dEta_track_dPhi_all", "#it{p}_{T,jet} (GeV/#it{c});#Delta#eta;#Delta#phi", {HistType::kTH3F, {jetPtAxis, {100, -0.5, 0.5}, {100, -0.5, 0.5}}}); + + registry.add("h3_pthat_jet_pt_jet_ntracks_outliers_noweight", "#it#hat{p} (GeV/#it{c});#it{p}_{T,jet} (GeV/#it{c});N_{jet tracks}", {HistType::kTH3F, {{100, 0, 200}, jetPtAxis, {200, -0.5, 199.5}}}); + registry.add("h3_jet_pt_track_dEta_track_dPhi_outliers_noweight", "#it{p}_{T,jet} (GeV/#it{c});#Delta#eta;#Delta#phi", {HistType::kTH3F, {jetPtAxis, {100, -0.5, 0.5}, {100, -0.5, 0.5}}}); + registry.add("h2_jet_pt_Dz_outliers_noweight", "#it{p}_{T,jet} (GeV/#it{c});z = #it{p}_{T,track} / #it{p}_{T,jet}", {HistType::kTH2F, {jetPtAxis, {30, 0, 1}}}); + registry.add("h3_pthat_jet_pt_jet_ntracks_all_noweight", "it#hat{p} (GeV/#it{c});#it{p}_{T,jet} (GeV/#it{c});N_{jet tracks}", {HistType::kTH3F, {{100, 0, 200}, jetPtAxis, {200, -0.5, 199.5}}}); + registry.add("h3_jet_pt_track_dEta_track_dPhi_all_noweight", "#it{p}_{T,jet} (GeV/#it{c});#Delta#eta;#Delta#phi", {HistType::kTH3F, {jetPtAxis, {100, -0.5, 0.5}, {100, -0.5, 0.5}}}); + registry.add("h2_jet_pt_Dz_all_noweight", "#it{p}_{T,jet} (GeV/#it{c});z = #it{p}_{T,track} / #it{p}_{T,jet}", {HistType::kTH2F, {jetPtAxis, {30, 0, 1}}}); + + registry.add("h3_jet_pt_track_pt_pt_hat_ambiguous", "ambiguous;#it{p}_{T,jet} (GeV/#it{c});#it{p}_{T,track} (GeV/#it{c}); #hat{#it{p}_{T}} (GeV/#it{c})", {HistType::kTH3F, {{150, 0, 300}, {100, 0, 100}, {200, 0, 600}}}); + registry.add("h3_jet_pt_track_pt_pt_hat_unambiguous", "matched;#it{p}_{T,jet} (GeV/#it{c});#it{p}_{T,track} (GeV/#it{c}); #hat{#it{p}_{T}} (GeV/#it{c})", {HistType::kTH3F, {{150, 0, 300}, {100, 0, 100}, {200, 0, 600}}}); + registry.add("h3_jet_pt_frac_pt_ambiguous_pt_hat", "fraction pT;#it{p}_{T,jet} (GeV/#it{c});fraction of #it{p}_{T,track} unmatched; #hat{#it{p}_{T}} (GeV/#it{c})", {HistType::kTH3F, {{150, 0, 300}, {40, 0, 1.1}, {200, 0, 600}}}); + registry.add("h3_jet_pt_frac_constituents_ambiguous_pt_hat", "fraction const;#it{p}_{T,jet} (GeV/#it{c});fraction of constituents matched; #hat{#it{p}_{T}} (GeV/#it{c})", {HistType::kTH3F, {{150, 0, 300}, {40, 0, 1.1}, {200, 0, 600}}}); + registry.add("h3_jet_pt_track_pt_pt_hat_no_particle", "no matching particle;#it{p}_{T,jet} (GeV/#it{c});#it{p}_{T,track} (GeV/#it{c}); #hat{#it{p}_{T}} (GeV/#it{c})", {HistType::kTH3F, {{150, 0, 300}, {100, 0, 100}, {200, 0, 600}}}); + registry.add("h3_jet_pt_track_pt_pt_hat_with_particle", "with matching particle;#it{p}_{T,jet} (GeV/#it{c});#it{p}_{T,track} (GeV/#it{c}); #hat{#it{p}_{T}} (GeV/#it{c})", {HistType::kTH3F, {{150, 0, 300}, {100, 0, 100}, {200, 0, 600}}}); + registry.add("h3_jet_pt_frac_pt_unmatched_particle_pt_hat", "fraction pT;#it{p}_{T,jet} (GeV/#it{c});fraction of #it{p}_{T,track} unmatched; #hat{#it{p}_{T}} (GeV/#it{c})", {HistType::kTH3F, {{150, 0, 300}, {40, 0, 1.1}, {200, 0, 600}}}); + registry.add("h3_jet_pt_frac_constituents_unmatched_particle_pt_hat", "fraction const;#it{p}_{T,jet} (GeV/#it{c});fraction of constituents unmatched; #hat{#it{p}_{T}} (GeV/#it{c})", {HistType::kTH3F, {{150, 0, 300}, {40, 0, 1.1}, {200, 0, 600}}}); + + // collision-level properties + registry.add("h_collision_multiplicity_outlier", "multiplicity", {HistType::kTH1F, {{200, 0, 200}}}); + registry.add("h_collision_pTHat_multiplicity_outlier", "multiplicity", {HistType::kTH2F, {{100, 0, 500}, {200, 0, 200}}}); + registry.add("h_collision_multiplicity_all", "multiplicity", {HistType::kTH1F, {{200, 0, 200}}}); + registry.add("h_collision_pTHat_multiplicity_all", "multiplicity", {HistType::kTH2F, {{100, 0, 500}, {200, 0, 200}}}); + registry.add("h_collision_trackOccupancyInTimeRange_outlier", "track occupancy", {HistType::kTH1F, {{1000, 0, 10000}}}); + registry.add("h_collision_trackOccupancyInTimeRange_all", "track occupancy", {HistType::kTH1F, {{1000, 0, 10000}}}); + registry.add("h_collision_multFV0A_outlier", "mult V0A", {HistType::kTH1F, {{1000, 0, 1000}}}); + registry.add("h_collision_multFV0A_all", "mult V0A", {HistType::kTH1F, {{1000, 0, 1000}}}); + registry.add("h_collision_multFV0C_outlier", "mult V0A", {HistType::kTH1F, {{1000, 0, 1000}}}); + registry.add("h_collision_multFV0C_all", "mult V0A", {HistType::kTH1F, {{1000, 0, 1000}}}); + registry.add("h_collision_multFV0M_outlier", "mult V0A", {HistType::kTH1F, {{1000, 0, 1000}}}); + registry.add("h_collision_multFV0M_all", "mult V0A", {HistType::kTH1F, {{1000, 0, 1000}}}); + } + if (doprocessCollisionsBC) { + // delta Z checks + registry.add("h_DeltaZ_InBunch", "Delta Z between two events in bunch", {HistType::kTH1F, {{1200, -30, 30}}}); + registry.add("h_DeltaZ_Z1_InBunch", "Delta Z between two events in bunch vs Z1", {HistType::kTH2F, {{1200, 30, 30}, {400, -12, 12}}}); + registry.add("h_Z1_Z2_InBunch", "Z1 vs Z2 between two events in bunch", {HistType::kTH2F, {{400, -12, 12}, {400, -12, 12}}}); + registry.add("h_DeltaZ_OutOfBunch", "Delta Z between two events out of bunch", {HistType::kTH1F, {{1200, -30, 30}}}); + registry.add("h_DeltaZ_Z1_OutOfBunch", "Delta Z between two events out of bunch vs Z1", {HistType::kTH2F, {{1200, 30, 30}, {400, -12, 12}}}); + registry.add("h_Z1_Z2_OutOfBunch", "Z1 vs Z2 between two events out of bunch", {HistType::kTH2F, {{400, -12, 12}, {400, -12, 12}}}); + registry.add("h_DeltaZ_InBunch_JJ", "Delta Z between two events in bunch", {HistType::kTH1F, {{1200, -30, 30}}}); + registry.add("h_DeltaZ_Z1_InBunch_JJ", "Delta Z between two events in bunch vs Z1", {HistType::kTH2F, {{1200, 30, 30}, {400, -12, 12}}}); + registry.add("h_Z1_Z2_InBunch_JJ", "Z1 vs Z2 between two events in bunch", {HistType::kTH2F, {{400, -12, 12}, {400, -12, 12}}}); + registry.add("h_DeltaZ_OutOfBunch_JJ", "Delta Z between two events out of bunch", {HistType::kTH1F, {{1200, -30, 30}}}); + registry.add("h_DeltaZ_Z1_OutOfBunch_JJ", "Delta Z between two events out of bunch vs Z1", {HistType::kTH2F, {{1200, 30, 30}, {400, -12, 12}}}); + registry.add("h_Z1_Z2_OutOfBunch_JJ", "Z1 vs Z2 between two events out of bunch", {HistType::kTH2F, {{400, -12, 12}, {400, -12, 12}}}); + registry.add("h_Z", "Delta Z between two events", {HistType::kTH1F, {{400, -12, 12}}}); + } + if (doprocessTracksBC) { + // track checks based on z position + registry.add("h_Z_resolution", "Z resolution", {HistType::kTH1F, {{200, -0.05, 0.05}}}); + registry.add("h_Z_resolution_wide", "Z resolution", {HistType::kTH1F, {{200, -1, 1}}}); + registry.add("h_Z_reco_rejected", "Z position reconstructed rejected", {HistType::kTH1F, {{400, -12, 12}}}); + registry.add("h_Z_true_rejected", "Z position particle rejected", {HistType::kTH1F, {{400, -12, 12}}}); + registry.add("h_Z_reco_accepted", "Z position reconstructed accepted", {HistType::kTH1F, {{400, -12, 12}}}); + registry.add("h_Z_true_accepted", "Z position particle accepted", {HistType::kTH1F, {{400, -12, 12}}}); + + registry.add("h_track_pt", "track pt;p_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{300, 0, 300}}}); + registry.add("h_track_eta", "track eta;#eta_{track};entries", {HistType::kTH1F, {{100, -5, 5}}}); + registry.add("h_track_phi", "track phi;#varphi_{track} (rad);entries", {HistType::kTH1F, {{160, -1.0, 7.0}}}); + registry.add("h_track_pt_eta", "track pt vs eta;p_{T,track} (GeV/#it{c});#eta_{track};entries", {HistType::kTH2F, {{300, 0, 300}, {100, -5, 5}}}); + registry.add("h_track_pt_phi", "track pt vs phi;p_{T,track} (GeV/#it{c});#varphi_{track} (rad);entries", {HistType::kTH2F, {{300, 0, 300}, {160, -1.0, 7.0}}}); + + registry.add("h_track_pt_accepted", "track pt accepted;p_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{300, 0, 300}}}); + registry.add("h_track_eta_accepted", "track eta accepted;#eta_{track};entries", {HistType::kTH1F, {{100, -5, 5}}}); + registry.add("h_track_phi_accepted", "track phi accepted;#varphi_{track} (rad);entries", {HistType::kTH1F, {{160, -1.0, 7.0}}}); + registry.add("h_track_pt_eta_accepted", "track pt vs eta accepted;p_{T,track} (GeV/#it{c});#eta_{track};entries", {HistType::kTH2F, {{300, 0, 300}, {100, -5, 5}}}); + registry.add("h_track_pt_phi_accepted", "track pt vs phi accepted;p_{T,track} (GeV/#it{c});#varphi_{track} (rad);entries", {HistType::kTH2F, {{300, 0, 300}, {160, -1.0, 7.0}}}); + // track checks based on collisions/particle association + registry.add("h_track_pt_no_collision", "track pt no collision;p_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{300, 0, 300}}}); + registry.add("h_track_pt_collision", "track pt collision;p_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{300, 0, 300}}}); + registry.add("h2_track_pt_pt_hat_no_particle", "track pt vs pt hat no particle;p_{T,track} (GeV/#it{c});#hat{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{300, 0, 300}, {600, 0, 600}}}); + registry.add("h2_track_pt_pt_hat_particle", "track pt vs pt hat particle;p_{T,track} (GeV/#it{c});#hat{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{300, 0, 300}, {600, 0, 600}}}); + + registry.add("h_track_pt_outlier", "weight track pt", {HistType::kTH1F, {{200, 0., 200.}}}); + registry.add("h2_pt_hat_track_pt", "track; #hat{#it{p}_{T}} (GeV/#it{c});#it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{600, 0, 600}, {150, 0, 300}}}); + registry.add("h2_pt_hat_track_pt_outlier", "track; #hat{#it{p}_{T}} (GeV/#it{c});#it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{600, 0, 600}, {150, 0, 300}}}); + registry.add("h2_neighbour_pt_hat_outlier", "neighbour; distance from collision; #hat{#it{p}_{T}} (GeV/#it{c})", {HistType::kTH2F, {{15, -7.5, 7.5}, {600, 0, 600}}}); + registry.add("h2_neighbour_track_pt_outlier", "neighbour; distance from collision; #it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{15, -7.5, 7.5}, {200, 0, 100}}}); + registry.add("h2_neighbour_pt_hat_all", "neighbour; distance from collision; #hat{#it{p}_{T}} (GeV/#it{c})", {HistType::kTH2F, {{15, -7.5, 7.5}, {600, 0, 600}}}); + registry.add("h2_neighbour_track_pt_all", "neighbour; distance from collision; #it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{15, -7.5, 7.5}, {200, 0, 100}}}); + } + } + + Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax); + Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centFT0M >= centralityMin && aod::jcollision::centFT0M < centralityMax); + + template + bool isAcceptedJet(U const& jet) + { + + if (jetAreaFractionMin > -98.0) { + if (jet.area() < jetAreaFractionMin * M_PI * (jet.r() / 100.0) * (jet.r() / 100.0)) { + return false; + } + } + bool checkConstituentPt = true; + bool checkConstituentMinPt = (leadingConstituentPtMin > -98.0); + bool checkConstituentMaxPt = (leadingConstituentPtMax < 9998.0); + if (!checkConstituentMinPt && !checkConstituentMaxPt) { + checkConstituentPt = false; + } + + if (checkConstituentPt) { + bool isMinLeadingConstituent = !checkConstituentMinPt; + bool isMaxLeadingConstituent = true; + + for (const auto& constituent : jet.template tracks_as()) { + double pt = constituent.pt(); + + if (checkConstituentMinPt && pt >= leadingConstituentPtMin) { + isMinLeadingConstituent = true; + } + if (checkConstituentMaxPt && pt > leadingConstituentPtMax) { + isMaxLeadingConstituent = false; + } + } + return isMinLeadingConstituent && isMaxLeadingConstituent; + } + + return true; + } + + void fillHistogramsAmbiguous(soa::Join::iterator const& jet, + float weight, + aod::AmbiguousTracks const& tracksAmbiguous) + { + + float pTHat = 10. / (std::pow(weight, 1.0 / pTHatExponent)); + if (jet.pt() > pTHatMaxMCD * pTHat) { + return; + } + // outlier ID checks + if (jet.pt() > pTHatMaxMCDOutlier * pTHat) { + registry.fill(HIST("h3_pthat_jet_pt_jet_ntracks_outliers"), pTHat, jet.pt(), jet.tracksIds().size(), weight); + registry.fill(HIST("h3_pthat_jet_pt_jet_ntracks_outliers_noweight"), pTHat, jet.pt(), jet.tracksIds().size()); + } else { + registry.fill(HIST("h3_pthat_jet_pt_jet_ntracks_all"), pTHat, jet.pt(), jet.tracksIds().size(), weight); + registry.fill(HIST("h3_pthat_jet_pt_jet_ntracks_all_noweight"), pTHat, jet.pt(), jet.tracksIds().size()); + } + for (auto& constituent : jet.template tracks_as()) { + if (jet.pt() > pTHatMaxMCDOutlier * pTHat) { + registry.fill(HIST("h3_jet_pt_track_dEta_track_dPhi_outliers"), jet.pt(), jet.eta() - constituent.eta(), jet.phi() - constituent.phi(), weight); + registry.fill(HIST("h3_jet_pt_track_dEta_track_dPhi_outliers_noweight"), jet.pt(), jet.eta() - constituent.eta(), jet.phi() - constituent.phi()); + registry.fill(HIST("h2_jet_pt_Dz_outliers_noweight"), jet.pt(), constituent.pt() / jet.pt()); + } else { + registry.fill(HIST("h3_jet_pt_track_dEta_track_dPhi_all"), jet.pt(), jet.eta() - constituent.eta(), jet.phi() - constituent.phi(), weight); + registry.fill(HIST("h3_jet_pt_track_dEta_track_dPhi_all_noweight"), jet.pt(), jet.eta() - constituent.eta(), jet.phi() - constituent.phi()); + registry.fill(HIST("h2_jet_pt_Dz_all_noweight"), jet.pt(), constituent.pt() / jet.pt()); + } + } + + // ambiguous/unmatched track checks + auto iterAmbiguous = tracksAmbiguous.begin(); + int nAmbTracks = 0; + int nUnmatchedTracks = 0; + double pt_total = 0; + double pt_amb = 0; + double pt_unmatched = 0; + for (auto& constituent : jet.template tracks_as()) { + pt_total += constituent.pt(); + bool has_MCparticle = constituent.has_mcParticle(); + if (!has_MCparticle) { + // LOG(info) << "constituent NO MC PARTICLE: track.index()=" << constituent.index() << " track.globalIndex()=" << constituent.globalIndex(); + registry.fill(HIST("h3_jet_pt_track_pt_pt_hat_no_particle"), jet.pt(), constituent.pt(), pTHat, weight); + pt_unmatched += constituent.pt(); + nUnmatchedTracks++; + } else { + registry.fill(HIST("h3_jet_pt_track_pt_pt_hat_with_particle"), jet.pt(), constituent.pt(), pTHat, weight); + } + + bool goFillHisto = (iterAmbiguous != tracksAmbiguous.end()); + if (goFillHisto) { + while (constituent.globalIndex() > iterAmbiguous.trackId()) { + iterAmbiguous++; + if (iterAmbiguous == tracksAmbiguous.end()) { /// all ambiguous tracks found + goFillHisto = false; + break; + } + } + } + if (goFillHisto) { + if (constituent.globalIndex() == iterAmbiguous.trackId()) { + nAmbTracks++; + registry.fill(HIST("h3_jet_pt_track_pt_pt_hat_ambiguous"), jet.pt(), constituent.pt(), pTHat, weight); + pt_amb += constituent.pt(); + nAmbTracks++; + } else { + registry.fill(HIST("h3_jet_pt_track_pt_pt_hat_unambiguous"), jet.pt(), constituent.pt(), pTHat, weight); + } + } + } + registry.fill(HIST("h3_jet_pt_frac_pt_ambiguous_pt_hat"), jet.pt(), pt_amb / pt_total, pTHat, weight); + registry.fill(HIST("h3_jet_pt_frac_constituents_ambiguous_pt_hat"), jet.pt(), double(nAmbTracks) / double(jet.template tracks_as().size()), pTHat, weight); + + registry.fill(HIST("h3_jet_pt_frac_pt_unmatched_particle_pt_hat"), jet.pt(), pt_unmatched / pt_total, pTHat, weight); + registry.fill(HIST("h3_jet_pt_frac_constituents_unmatched_particle_pt_hat"), jet.pt(), double(nUnmatchedTracks) / double(jet.template tracks_as().size()), pTHat, weight); + } + + void processJetsAmbiguous(soa::Filtered>::iterator const& collision, + aod::JetMcCollisions const&, + soa::Join const& jets, + aod::JetTracksMCD const&, + const aod::AmbiguousTracks& tracksAmbiguous) + { + // + // jet-based outlier checks based on ambiguous tracks + // + if (collision.subGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) { + return; + } + if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + return; + } + bool isOutlierEvent = false; + int nTracksJet = 0; + float pTHat = collision.mcCollision().ptHard(); + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(jet)) { + continue; + } + fillHistogramsAmbiguous(jet, jet.eventWeight(), tracksAmbiguous); + nTracksJet += jet.tracksIds().size(); + if (jet.pt() > pTHatMaxMCDOutlier * pTHat) { + isOutlierEvent = true; + } + } + if (isOutlierEvent) { + registry.fill(HIST("h_collision_pTHat_multiplicity_outlier"), pTHat, nTracksJet, collision.weight()); + registry.fill(HIST("h_collision_multiplicity_outlier"), nTracksJet, collision.weight()); + registry.fill(HIST("h_collision_trackOccupancyInTimeRange_outlier"), collision.trackOccupancyInTimeRange(), collision.weight()); + registry.fill(HIST("h_collision_multFV0A_outlier"), collision.multFV0A(), collision.weight()); + registry.fill(HIST("h_collision_multFV0C_outlier"), collision.multFV0C(), collision.weight()); + registry.fill(HIST("h_collision_multFV0M_outlier"), collision.multFV0M(), collision.weight()); + } else { + registry.fill(HIST("h_collision_multiplicity_all"), nTracksJet, collision.weight()); + registry.fill(HIST("h_collision_pTHat_multiplicity_all"), pTHat, nTracksJet, collision.weight()); + registry.fill(HIST("h_collision_trackOccupancyInTimeRange_all"), collision.trackOccupancyInTimeRange(), collision.weight()); + registry.fill(HIST("h_collision_multFV0A_all"), collision.multFV0A(), collision.weight()); + registry.fill(HIST("h_collision_multFV0C_all"), collision.multFV0C(), collision.weight()); + registry.fill(HIST("h_collision_multFV0M_all"), collision.multFV0M(), collision.weight()); + } + } + PROCESS_SWITCH(JetOutlierQATask, processJetsAmbiguous, "jet finder QA mcd with weighted events", false); + + void processCollisionsBC(soa::Join const& collisions, + aod::JetMcCollisions const&) + { + // + // collision-based outlier checks based on BC and z position + // based on 2-event correlation checks in PWGDQ/Tasks/tableReader_withAssoc.cxx + // + + fBCCollMap.clear(); + for (auto const& collision : collisions) { + // Fill the BC map of events + if (fBCCollMap.find(collision.bcId()) == fBCCollMap.end()) { + std::vector evIndices = {collision.globalIndex()}; + fBCCollMap[collision.bcId()] = evIndices; + } else { + auto& evIndices = fBCCollMap[collision.bcId()]; + evIndices.push_back(collision.globalIndex()); + } + registry.fill(HIST("h_Z"), collision.posZ()); + } + + // Create a map for collisions which are candidate of being split + // key: event global index, value: whether pileup event is a possible splitting + // (not used ATM, but could be used to flag events in the future) + std::map collisionSplittingMap; + + // loop over the BC map, get the collision vectors and make in-bunch and out of bunch 2-event correlations + for (auto bc1It = fBCCollMap.begin(); bc1It != fBCCollMap.end(); ++bc1It) { + uint64_t bc1 = bc1It->first; + auto bc1Events = bc1It->second; + + // same bunch event correlations, if more than 1 collisions in this bunch + if (bc1Events.size() > 1) { + for (auto ev1It = bc1Events.begin(); ev1It != bc1Events.end(); ++ev1It) { + auto ev1 = collisions.rawIteratorAt(*ev1It); + for (auto ev2It = std::next(ev1It); ev2It != bc1Events.end(); ++ev2It) { + auto ev2 = collisions.rawIteratorAt(*ev2It); + // compute 2-event quantities and mark the candidate split collisions + float deltaZ = ev1.posZ() - ev2.posZ(); + if (TMath::Abs(deltaZ) < splitCollisionsDeltaZ) { // this is a possible collision split + collisionSplittingMap[*ev1It] = true; + collisionSplittingMap[*ev2It] = true; + } + registry.fill(HIST("h_DeltaZ_InBunch"), deltaZ); + registry.fill(HIST("h_DeltaZ_Z1_InBunch"), deltaZ, ev1.posZ()); + registry.fill(HIST("h_Z1_Z2_InBunch"), ev1.posZ(), ev2.posZ()); + if (ev1.subGeneratorId() != jetderiveddatautilities::JCollisionSubGeneratorId::mbGap && + ev2.subGeneratorId() != jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) { // both are non-gap events + registry.fill(HIST("h_DeltaZ_InBunch_JJ"), deltaZ); + registry.fill(HIST("h_DeltaZ_Z1_InBunch_JJ"), deltaZ, ev1.posZ()); + registry.fill(HIST("h_Z1_Z2_InBunch_JJ"), ev1.posZ(), ev2.posZ()); + } + } // end second event loop + } // end first event loop + } // end if BC1 events > 1 + + // loop over the following BCs in the TF + for (auto bc2It = std::next(bc1It); bc2It != fBCCollMap.end(); ++bc2It) { + uint64_t bc2 = bc2It->first; + if ((bc2 > bc1 ? bc2 - bc1 : bc1 - bc2) > splitCollisionsDeltaBC) { + break; + } + auto bc2Events = bc2It->second; + + // loop over events in the first BC + for (auto ev1It : bc1Events) { + auto ev1 = collisions.rawIteratorAt(ev1It); + // loop over events in the second BC + for (auto ev2It : bc2Events) { + auto ev2 = collisions.rawIteratorAt(ev2It); + // compute 2-event quantities and mark the candidate split collisions + float deltaZ = ev1.posZ() - ev2.posZ(); + if (TMath::Abs(deltaZ) < splitCollisionsDeltaZ) { // this is a possible collision split + collisionSplittingMap[ev1It] = true; + collisionSplittingMap[ev2It] = true; + } + registry.fill(HIST("h_DeltaZ_OutOfBunch"), deltaZ); + registry.fill(HIST("h_DeltaZ_Z1_OutOfBunch"), deltaZ, ev1.posZ()); + registry.fill(HIST("h_Z1_Z2_OutOfBunch"), ev1.posZ(), ev2.posZ()); + if (ev1.subGeneratorId() != jetderiveddatautilities::JCollisionSubGeneratorId::mbGap && + ev2.subGeneratorId() != jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) { // both are non-gap events + registry.fill(HIST("h_DeltaZ_OutOfBunch_JJ"), deltaZ); + registry.fill(HIST("h_DeltaZ_Z1_OutOfBunch_JJ"), deltaZ, ev1.posZ()); + registry.fill(HIST("h_Z1_Z2_OutOfBunch_JJ"), ev1.posZ(), ev2.posZ()); + } + } + } + } + } + } + PROCESS_SWITCH(JetOutlierQATask, processCollisionsBC, "jet finder QA outliers", false); + + void processTracksBC(soa::Filtered> const& collisions, + aod::JetMcCollisions const& collisionsMC, + aod::JetTracksMCD const& tracks) + { + // + // track-based outlier checks + // + + // first check for collisions occuring close by in time and z in MC + std::set closeByCollisionIDs; + for (auto const& collisionMC : collisionsMC) { + if (collisionMC.subGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) { + return; + } + float posZtrue = collisionMC.posZ(); + for (auto const& collisionCloseMC : collisionsMC) { // check for closeby collisions in MC + int diffColl = collisionCloseMC.globalIndex() - collisionMC.globalIndex(); + if (diffColl >= mergeCollisionsDeltaMin && diffColl <= mergeCollisionsDeltaMax) { // check if n collisions prior or after + if (collisionCloseMC.subGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) { + continue; + } + if (diffColl == 0) { + continue; + } + if (TMath::Abs(collisionCloseMC.posZ() - posZtrue) < splitCollisionsDeltaZPart) { + closeByCollisionIDs.insert(collisionMC.globalIndex()); // Save the ID of the close-by collision + break; // closeby collision in MC, don't use this event + } + } + } + } + // now make reconstructed-level checks + for (auto const& collision : collisions) { // loop over reconstructed collisions + if (collision.subGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) { + return; + } + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { + continue; + } + if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + continue; + } + float weight = collision.weight(); + float pTHat = collision.mcCollision().ptHard(); + const auto tracksColl = tracks.sliceBy(perCol, collision.globalIndex()); + + // fill track histograms for all collisions + for (auto const& track : tracksColl) { + if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { + continue; + } + registry.fill(HIST("h_track_pt"), track.pt(), weight); + registry.fill(HIST("h_track_eta"), track.eta(), weight); + registry.fill(HIST("h_track_phi"), track.phi(), weight); + registry.fill(HIST("h_track_pt_eta"), track.pt(), track.eta(), weight); + registry.fill(HIST("h_track_pt_phi"), track.pt(), track.phi(), weight); + // checks on track distributions with/without collision and with/without MC particle + if (!track.has_collision() || track.collisionId() != collision.globalIndex()) { + registry.fill(HIST("h_track_pt_no_collision"), track.pt(), weight); + } else { + registry.fill(HIST("h_track_pt_collision"), track.pt(), weight); + } + bool has_MCparticle = track.has_mcParticle(); + if (!has_MCparticle) { + registry.fill(HIST("h2_track_pt_pt_hat_no_particle"), track.pt(), collision.mcCollision().ptHard(), weight); + } else { + registry.fill(HIST("h2_track_pt_pt_hat_particle"), track.pt(), collision.mcCollision().ptHard(), weight); + } + + // check outlier tracks and neighbouring collisions + registry.fill(HIST("h2_pt_hat_track_pt"), pTHat, track.pt()); + if (track.pt() > 1.5 * pTHat) { // high weight outlier track + registry.fill(HIST("h_track_pt_outlier"), track.pt()); + registry.fill(HIST("h2_pt_hat_track_pt_outlier"), pTHat, track.pt()); + for (auto const& collisionOutlier : collisions) { // find collisions closeby + int diffColl = collision.globalIndex() - collisionOutlier.globalIndex(); + if (abs(diffColl) < 6) { + float eventWeightOutlier = collisionOutlier.mcCollision().weight(); + double pTHatOutlier = collisionOutlier.mcCollision().ptHard(); + registry.fill(HIST("h2_neighbour_pt_hat_outlier"), float(diffColl + 0.1), pTHatOutlier, eventWeightOutlier); + registry.fill(HIST("h2_neighbour_track_pt_outlier"), float(diffColl + 0.1), track.pt(), eventWeightOutlier); + } + } + } + // all + for (auto const& collisionOutlier : collisions) { // find collisions closeby + float eventWeightOutlier = collisionOutlier.mcCollision().weight(); + double pTHatOutlier = collisionOutlier.mcCollision().ptHard(); + int diffColl = collision.globalIndex() - collisionOutlier.globalIndex(); + + if (abs(diffColl) < 6) { + // LOG(info) << "pThat = " << pTHat << "pThat neighbour = "<(cfgc, TaskName{"jet-outlier-qa"})}; // o2-linter: disable=name/o2-task,name/workflow-file +} From d2c66ee9d8ecb9835398db96b833cf7d4e59d83e Mon Sep 17 00:00:00 2001 From: Chiara De Martin <39315597+ChiaraDeMartin95@users.noreply.github.com> Date: Wed, 8 Oct 2025 15:15:28 +0200 Subject: [PATCH 664/986] [PWGLF] Add FT0M centrality estimator (#13276) Co-authored-by: Chiara De Martin Co-authored-by: ALICE Action Bot --- .../TableProducer/Strangeness/cascadeflow.cxx | 68 +++++++++++++------ 1 file changed, 46 insertions(+), 22 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx index 40201f4a47d..af709e697a2 100644 --- a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx @@ -156,6 +156,7 @@ struct cascadeFlow { Configurable isQVecT0C{"isQVecT0C", 1, ""}; Configurable isQVecT0M{"isQVecT0M", 0, ""}; Configurable isQVecV0A{"isQVecV0A", 0, ""}; + Configurable isCollisionCentrality{"isCollisionCentrality", 0, ""}; // 0: FT0C, 1: FT0M (implemented only for Lambda analysis in OO) // Output filling criteria struct : ConfigurableGroup { @@ -258,6 +259,7 @@ struct cascadeFlow { Configurable v0radiusMax{"v0radiusMax", 1E5, "maximum V0 radius (cm)"}; Configurable rapidityLambda{"rapidityLambda", 0.5, "rapidityLambda"}; Configurable etaLambda{"etaLambda", 0.8, "etaLambda"}; + Configurable dauTrackV0Eta{"dauTrackV0Eta", 0.8, "dauTrackV0Eta"}; } V0Configs; Configurable sideBandStart{"sideBandStart", 5, "Start of the sideband region in number of sigmas"}; @@ -428,6 +430,10 @@ struct cascadeFlow { return false; counter++; + + // eta daughters) + // if (abs(posExtra.eta()) > V0Configs.dauTrackV0Eta || abs(negExtra.y()) > V0Configs.dauTrackV0Eta) return false; + return true; } template @@ -760,6 +766,11 @@ struct cascadeFlow { } histos.add("hEventVertexZ", "hEventVertexZ", kTH1F, {{120, -12., 12.}}); histos.add("hEventCentrality", "hEventCentrality", kTH1F, {{101, 0, 101}}); + histos.add("hEventCentralityBefEvSel", "hEventCentralityBefEvSel", kTH1F, {{101, 0, 101}}); + histos.add("hEventCentralityBefEPSel", "hEventCentralityBefEPSel", kTH1F, {{101, 0, 101}}); + histos.add("hEventCentralityT0M", "hEventCentralityT0M", kTH1F, {{101, 0, 101}}); + histos.add("hEventCentralityBefEvSelT0M", "hEventCentralityBefEvSelT0M", kTH1F, {{101, 0, 101}}); + histos.add("hEventCentralityBefEPSelT0M", "hEventCentralityBefEPSelT0M", kTH1F, {{101, 0, 101}}); histos.add("hPsiT0C", "hPsiT0C", HistType::kTH1D, {{100, -o2::constants::math::PI, o2::constants::math::PI}}); histos.add("hPsiT0CvsCentFT0C", "hPsiT0CvsCentFT0C", HistType::kTH2D, {CentAxis, {100, -o2::constants::math::PI, o2::constants::math::PI}}); histos.add("hPsiZDCA_vs_ZDCC", "hPsiZDCA_vs_ZDCC", HistType::kTH2D, {{100, -o2::constants::math::PI, o2::constants::math::PI}, {100, -o2::constants::math::PI, o2::constants::math::PI}}); @@ -1653,6 +1664,16 @@ struct cascadeFlow { void processAnalyseLambdaEP2CentralFW(CollEventPlaneCentralFW const& coll, V0Candidates const& V0s, DauTracks const&) { + histos.fill(HIST("hEventCentralityBefEvSel"), coll.centFT0C()); + histos.fill(HIST("hEventCentralityBefEvSelT0M"), coll.centFT0M()); + + Float_t collisionCentrality = 0; + if (isCollisionCentrality == 0) { // T0C + collisionCentrality = coll.centFT0C(); + } else if (isCollisionCentrality == 1) { // T0M + collisionCentrality = coll.centFT0M(); + } + if (!AcceptEvent(coll, 1)) { return; } @@ -1671,6 +1692,8 @@ struct cascadeFlow { qvecIm = coll.qvecFV0AIm(); } + histos.fill(HIST("hEventCentralityBefEPSel"), collisionCentrality); + histos.fill(HIST("hEventCentralityBefEPSelT0M"), coll.centFT0M()); // select only events used for the calibration of the event plane if (isGoodEventEP) { if (std::abs(qvecRe) > 990 || std::abs(qvecIm) > 990 || std::abs(coll.qvecBNegRe()) > 990 || std::abs(coll.qvecBNegIm()) > 990 || std::abs(coll.qvecBPosRe()) > 990 || std::abs(coll.qvecBPosIm()) > 990) { @@ -1683,10 +1706,11 @@ struct cascadeFlow { histos.fill(HIST("hNEvents"), 9.5); histos.fill(HIST("hEventNchCorrelationAfterEP"), coll.multNTracksPVeta1(), coll.multNTracksGlobal()); - histos.fill(HIST("hEventPVcontributorsVsCentralityAfterEP"), coll.centFT0C(), coll.multNTracksPVeta1()); - histos.fill(HIST("hEventGlobalTracksVsCentralityAfterEP"), coll.centFT0C(), coll.multNTracksGlobal()); + histos.fill(HIST("hEventPVcontributorsVsCentralityAfterEP"), collisionCentrality, coll.multNTracksPVeta1()); + histos.fill(HIST("hEventGlobalTracksVsCentralityAfterEP"), collisionCentrality, coll.multNTracksGlobal()); - histos.fill(HIST("hEventCentrality"), coll.centFT0C()); + histos.fill(HIST("hEventCentrality"), collisionCentrality); + histos.fill(HIST("hEventCentralityT0M"), coll.centFT0M()); histos.fill(HIST("hEventVertexZ"), coll.posZ()); ROOT::Math::XYZVector eventplaneVecT0C{qvecRe, qvecIm, 0}; @@ -1698,14 +1722,14 @@ struct cascadeFlow { const float psiTPCC = std::atan2(coll.qvecBNegIm(), coll.qvecBNegRe()) * 0.5f; float psiT0CCorr = psiT0C; for (int ishift = 1; ishift <= 10; ishift++) { - histos.fill(HIST("ShiftFT0C"), coll.centFT0C(), 0.5, ishift - 0.5, std::sin(ishift * 2 * psiT0C)); - histos.fill(HIST("ShiftFT0C"), coll.centFT0C(), 1.5, ishift - 0.5, std::cos(ishift * 2 * psiT0C)); + histos.fill(HIST("ShiftFT0C"), collisionCentrality, 0.5, ishift - 0.5, std::sin(ishift * 2 * psiT0C)); + histos.fill(HIST("ShiftFT0C"), collisionCentrality, 1.5, ishift - 0.5, std::cos(ishift * 2 * psiT0C)); - histos.fill(HIST("ShiftTPCL"), coll.centFT0C(), 0.5, ishift - 0.5, std::sin(ishift * 2 * psiTPCA)); - histos.fill(HIST("ShiftTPCL"), coll.centFT0C(), 1.5, ishift - 0.5, std::cos(ishift * 2 * psiTPCA)); + histos.fill(HIST("ShiftTPCL"), collisionCentrality, 0.5, ishift - 0.5, std::sin(ishift * 2 * psiTPCA)); + histos.fill(HIST("ShiftTPCL"), collisionCentrality, 1.5, ishift - 0.5, std::cos(ishift * 2 * psiTPCA)); - histos.fill(HIST("ShiftTPCR"), coll.centFT0C(), 0.5, ishift - 0.5, std::sin(ishift * 2 * psiTPCC)); - histos.fill(HIST("ShiftTPCR"), coll.centFT0C(), 1.5, ishift - 0.5, std::cos(ishift * 2 * psiTPCC)); + histos.fill(HIST("ShiftTPCR"), collisionCentrality, 0.5, ishift - 0.5, std::sin(ishift * 2 * psiTPCC)); + histos.fill(HIST("ShiftTPCR"), collisionCentrality, 1.5, ishift - 0.5, std::cos(ishift * 2 * psiTPCC)); } if (ShiftConfigs.cfgShiftCorr) { @@ -1727,14 +1751,14 @@ struct cascadeFlow { } histos.fill(HIST("hPsiT0C"), psiT0CCorr); - histos.fill(HIST("hPsiT0CvsCentFT0C"), coll.centFT0C(), psiT0CCorr); + histos.fill(HIST("hPsiT0CvsCentFT0C"), collisionCentrality, psiT0CCorr); - resolution.fill(HIST("QVectorsT0CTPCA"), eventplaneVecT0C.Dot(eventplaneVecTPCA), coll.centFT0C()); - resolution.fill(HIST("QVectorsT0CTPCC"), eventplaneVecT0C.Dot(eventplaneVecTPCC), coll.centFT0C()); - resolution.fill(HIST("QVectorsTPCAC"), eventplaneVecTPCA.Dot(eventplaneVecTPCC), coll.centFT0C()); - resolution.fill(HIST("QVectorsNormT0CTPCA"), eventplaneVecT0C.Dot(eventplaneVecTPCA) / (coll.qTPCR() * coll.sumAmplFT0C()), coll.centFT0C()); - resolution.fill(HIST("QVectorsNormT0CTPCC"), eventplaneVecT0C.Dot(eventplaneVecTPCC) / (coll.qTPCL() * coll.sumAmplFT0C()), coll.centFT0C()); - resolution.fill(HIST("QVectorsNormTPCAC"), eventplaneVecTPCA.Dot(eventplaneVecTPCC) / (coll.qTPCR() * coll.qTPCL()), coll.centFT0C()); + resolution.fill(HIST("QVectorsT0CTPCA"), eventplaneVecT0C.Dot(eventplaneVecTPCA), collisionCentrality); + resolution.fill(HIST("QVectorsT0CTPCC"), eventplaneVecT0C.Dot(eventplaneVecTPCC), collisionCentrality); + resolution.fill(HIST("QVectorsTPCAC"), eventplaneVecTPCA.Dot(eventplaneVecTPCC), collisionCentrality); + resolution.fill(HIST("QVectorsNormT0CTPCA"), eventplaneVecT0C.Dot(eventplaneVecTPCA) / (coll.qTPCR() * coll.sumAmplFT0C()), collisionCentrality); + resolution.fill(HIST("QVectorsNormT0CTPCC"), eventplaneVecT0C.Dot(eventplaneVecTPCC) / (coll.qTPCL() * coll.sumAmplFT0C()), collisionCentrality); + resolution.fill(HIST("QVectorsNormTPCAC"), eventplaneVecTPCA.Dot(eventplaneVecTPCC) / (coll.qTPCR() * coll.qTPCL()), collisionCentrality); std::vector bdtScore[nParticles]; for (auto const& v0 : V0s) { @@ -1841,25 +1865,25 @@ struct cascadeFlow { cosThetaLambda = cosThetaStarProton[0] / cascadev2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda; } - histos.fill(HIST("hv2CEPvsFT0C"), coll.centFT0C(), v2CEP); + histos.fill(HIST("hv2CEPvsFT0C"), collisionCentrality, v2CEP); histos.fill(HIST("hv2CEPvsv2CSP"), v2CSP, v2CEP); histos.fill(HIST("hLambdaPhi"), v0.phi()); histos.fill(HIST("hlambdaminuspsiT0C"), lambdaminuspsiT0C); if (fillingConfigs.isFillTHNLambda) { if (fillingConfigs.isFillTHN_V2) - histos.get(HIST("hLambdaV2"))->Fill(coll.centFT0C(), chargeIndex, v0.pt(), v0.mLambda(), v2CEP); + histos.get(HIST("hLambdaV2"))->Fill(collisionCentrality, chargeIndex, v0.pt(), v0.mLambda(), v2CEP); if (fillingConfigs.isFillTHN_Pz) { - histos.get(HIST("hLambdaPzs2"))->Fill(coll.centFT0C(), chargeIndex, v0.pt(), v0.mLambda(), pzs2Lambda); + histos.get(HIST("hLambdaPzs2"))->Fill(collisionCentrality, chargeIndex, v0.pt(), v0.mLambda(), pzs2Lambda); } if (fillingConfigs.isFillTHN_Acc) - histos.get(HIST("hLambdaCos2Theta"))->Fill(coll.centFT0C(), chargeIndex, v0.eta(), v0.pt(), v0.mLambda(), cos2ThetaLambda); + histos.get(HIST("hLambdaCos2Theta"))->Fill(collisionCentrality, chargeIndex, v0.eta(), v0.pt(), v0.mLambda(), cos2ThetaLambda); } if (fillingConfigs.isFillTHNLambda_PzVsPsi) { if (fillingConfigs.isFillTHN_Pz) - histos.get(HIST("hLambdaPzVsPsi"))->Fill(coll.centFT0C(), chargeIndex, v0.pt(), v0.mLambda(), cosThetaLambda, 2 * lambdaminuspsiT0C); + histos.get(HIST("hLambdaPzVsPsi"))->Fill(collisionCentrality, chargeIndex, v0.pt(), v0.mLambda(), cosThetaLambda, 2 * lambdaminuspsiT0C); if (fillingConfigs.isFillTHN_Acc) - histos.get(HIST("hLambdaCos2ThetaVsPsi"))->Fill(coll.centFT0C(), chargeIndex, v0.eta(), v0.pt(), v0.mLambda(), cos2ThetaLambda, 2 * lambdaminuspsiT0C); + histos.get(HIST("hLambdaCos2ThetaVsPsi"))->Fill(collisionCentrality, chargeIndex, v0.eta(), v0.pt(), v0.mLambda(), cos2ThetaLambda, 2 * lambdaminuspsiT0C); } double invMassLambda = 0; From 113d6e41e45baaaaf840c79f550086d7f13f0aa5 Mon Sep 17 00:00:00 2001 From: jaimenorman Date: Wed, 8 Oct 2025 15:24:03 +0100 Subject: [PATCH 665/986] [PWGJE] widen binning for pThat ratio (#13277) --- PWGJE/Tasks/jetHadronRecoil.cxx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/PWGJE/Tasks/jetHadronRecoil.cxx b/PWGJE/Tasks/jetHadronRecoil.cxx index 34af8f17272..b19a527bcb5 100644 --- a/PWGJE/Tasks/jetHadronRecoil.cxx +++ b/PWGJE/Tasks/jetHadronRecoil.cxx @@ -109,6 +109,8 @@ struct JetHadronRecoil { 0.207, 0.21, 0.213, 0.216, 0.219, 0.222, 0.225, 0.228, 0.231, 0.234, 0.237, 0.24, 0.27, 0.30, 0.33, 0.36, 0.39, 0.42, 0.45, 0.48, 0.51, 0.54, 0.57, 0.60}; + std::vector pThatBinning = {0.0, 0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 2.75, 3.0, + 3.25, 3.5, 3.75, 4.0, 4.25, 4.5, 4.75, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 20.0, 30.0}; AxisSpec dRAxis = {dRBinning, "#Delta R"}; AxisSpec ptAxisDet = {ptBinningDet, "#it{p}_{T,det} (GeV/c)"}; @@ -117,6 +119,7 @@ struct JetHadronRecoil { AxisSpec phiAxisPart = {100, 0.0, o2::constants::math::TwoPI, "#phi_{part}"}; AxisSpec dRAxisDet = {dRBinning, "#Delta R_{det}"}; AxisSpec dRAxisPart = {dRBinning, "#Delta R_{part}"}; + AxisSpec pThatAxis = {pThatBinning, "#hat{p_{T}}"}; HistogramRegistry registry; @@ -142,8 +145,8 @@ struct JetHadronRecoil { if (doprocessData || doprocessDataWithRhoSubtraction || doprocessMCD || doprocessMCDWithRhoSubtraction || doprocessMCDWeighted || doprocessMCDWeightedWithRhoSubtraction || doprocessMCP || doprocessMCPWeighted) { registry.add("hNtrig", "number of triggers;trigger type;entries", {HistType::kTH1F, {{2, 0, 2}}}, doSumw); - registry.add("hSignalTriggersPtHard", "Signal triggers vs PtHard", {HistType::kTH1F, {{20, 0, 5}}}, doSumw); - registry.add("hReferenceTriggersPtHard", "Reference triggers vs PtHard", {HistType::kTH1F, {{20, 0, 5}}}, doSumw); + registry.add("hSignalTriggersPtHard", "Signal triggers vs PtHard", {HistType::kTH1F, {pThatAxis}}, doSumw); + registry.add("hReferenceTriggersPtHard", "Reference triggers vs PtHard", {HistType::kTH1F, {pThatAxis}}, doSumw); registry.add("hConstituents3D", "3D constituents histogram;p_{T};#eta;#phi", {HistType::kTH3F, {{200, 0, 200}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}, doSumw); registry.add("hReferencePtDPhi", "jet p_{T} vs DPhi;#Delta#phi;p_{T,jet}", {HistType::kTH2F, {{100, 0, o2::constants::math::TwoPI}, {500, -100, 400}}}, doSumw); registry.add("hReferencePtDPhiShifts", "rho shifts;#Delta#phi;p_{T,jet};shifts", {HistType::kTH3F, {{100, 0, o2::constants::math::TwoPI}, {500, -100, 400}, {20, 0.0, 2.0}}}, doSumw); @@ -151,9 +154,9 @@ struct JetHadronRecoil { registry.add("hReferencePt", "jet p_{T};p_{T,jet};entries", {HistType::kTH1F, {{500, -100, 400}}}, doSumw); registry.add("hSignalPt", "jet p_{T};p_{T,jet};entries", {HistType::kTH1F, {{500, -100, 400}}}, doSumw); registry.add("hSignalTriggers", "trigger p_{T};p_{T,trig};entries", {HistType::kTH1F, {{150, 0, 150}}}, doSumw); - registry.add("hSignalPtHard", "jet p_{T} vs #hat{p};p_{T,jet};#frac{p_{T,trig}}{#hat{p}}", {HistType::kTH2F, {{500, -100, 400}, {20, 0, 5}}}, doSumw); + registry.add("hSignalPtHard", "jet p_{T} vs #hat{p};p_{T,jet};#frac{p_{T,trig}}{#hat{p}}", {HistType::kTH2F, {{500, -100, 400}, pThatAxis}}, doSumw); registry.add("hReferenceTriggers", "trigger p_{T};p_{T,trig};entries", {HistType::kTH1F, {{150, 0, 150}}}, doSumw); - registry.add("hReferencePtHard", "jet p_{T} vs #hat{p};p_{T,jet};#frac{p_{T,trig}}{#hat{p}}", {HistType::kTH2F, {{500, -100, 400}, {20, 0, 5}}}, doSumw); + registry.add("hReferencePtHard", "jet p_{T} vs #hat{p};p_{T,jet};#frac{p_{T,trig}}{#hat{p}}", {HistType::kTH2F, {{500, -100, 400}, pThatAxis}}, doSumw); registry.add("hSigEventTriggers", "N_{triggers};events", {HistType::kTH1F, {{10, 0, 10}}}, doSumw); registry.add("hRefEventTriggers", "N_{triggers};events", {HistType::kTH1F, {{10, 0, 10}}}, doSumw); registry.add("hJetPt", "jet p_{T};p_{T,jet};entries", {HistType::kTH1F, {{500, -100, 400}}}, doSumw); @@ -167,7 +170,7 @@ struct JetHadronRecoil { registry.add("hEtaTrack", "Track #eta;#eta;entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}, doSumw); registry.add("hPhiTrack", "Track #phi;#phi;entries", {HistType::kTH1F, {{100, 0.0, o2::constants::math::TwoPI}}}, doSumw); registry.add("hTrack3D", "3D tracks histogram;p_{T};#eta;#phi", {HistType::kTH3F, {{200, 0, 200}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}, doSumw); - registry.add("hPtTrackPtHard", "Tracks vs pThard;#frac{p_{T}}{#hat{p}};p_{T}", {HistType::kTH2F, {{20, 0, 5}, {200, 0, 200}}}, doSumw); + registry.add("hPtTrackPtHard", "Tracks vs pThard;#frac{p_{T}}{#hat{p}};p_{T}", {HistType::kTH2F, {pThatAxis, {200, 0, 200}}}, doSumw); registry.add("hTracksvsJets", "comparing leading tracks and jets;p_{T,track};p_{T,jet};#hat{p}", {HistType::kTH3F, {{200, 0, 200}, {500, -100, 400}, {195, 5, 200}}}, doSumw); registry.add("hRhoSignal", "Signal Rho bkg;#rho;entries", {HistType::kTH1F, {{220, 0, 220}}}, doSumw); registry.add("hRhoReference", "Reference Rho bkg;#rho;entries", {HistType::kTH1F, {{220, 0, 220}}}, doSumw); @@ -187,7 +190,7 @@ struct JetHadronRecoil { registry.add("hEtaPart", "Particle #eta;#eta;entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}, doSumw); registry.add("hPhiPart", "Particle #phi;#phi;entries", {HistType::kTH1F, {{100, 0.0, o2::constants::math::TwoPI}}}, doSumw); registry.add("hPart3D", "3D tracks histogram;p_{T};#eta;#phi", {HistType::kTH3F, {{200, 0, 200}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}, doSumw); - registry.add("hPtPartPtHard", "Track p_{T} vs #hat{p};p_{T};#frac{p_{T}}{#hat{p}}", {HistType::kTH2F, {{200, 0, 200}, {20, 0, 5}}}, doSumw); + registry.add("hPtPartPtHard", "Track p_{T} vs #hat{p};p_{T};#frac{p_{T}}{#hat{p}}", {HistType::kTH2F, {{200, 0, 200}, pThatAxis}}, doSumw); registry.add("hDeltaRSignalPart", "Particle #DeltaR;#DeltaR;#frac{1}{N_{jets}}#frac{dN_{jets}}{d#DeltaR}", {HistType::kTH1F, {dRAxis}}, doSumw); registry.add("hDeltaRpTSignalPart", "Particle jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{400, 0, 400}, dRAxis}}, doSumw); registry.add("hDeltaRpTDPhiSignalPart", "Particle jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{400, 0, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis}}, doSumw); From 689968149d4069e09f982edb23834b4e45d9a67b Mon Sep 17 00:00:00 2001 From: Jesper Karlsson Gumprecht <113693781+jesgum@users.noreply.github.com> Date: Wed, 8 Oct 2025 16:26:10 +0200 Subject: [PATCH 666/986] [ALICE3] Strangeness tracking considers dead phi region (#13275) --- ALICE3/TableProducer/OTF/onTheFlyTracker.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx index f2d11253b25..1be815b2411 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx @@ -838,6 +838,10 @@ struct OnTheFlyTracker { static_cast(xyz1[1]), static_cast(xyz1[2])}; const o2::track::TrackParametrization::dim3_t hitpointcov = {currentTrackingLayer.getResolutionRPhi() * currentTrackingLayer.getResolutionRPhi(), 0.f, currentTrackingLayer.getResolutionZ() * currentTrackingLayer.getResolutionZ()}; + if (currentTrackingLayer.isInDeadPhiRegion(phi)) { + continue; // No hit for strangeness tracking update + } + cascadeTrack.update(hitpoint, hitpointcov); thisCascade.foundClusters++; // add to findable } From e6841fa61503b7fab07e9cc39e7f47d68275090b Mon Sep 17 00:00:00 2001 From: dajones2 <140733426+dajones2@users.noreply.github.com> Date: Wed, 8 Oct 2025 16:27:19 +0100 Subject: [PATCH 667/986] =?UTF-8?q?[PWGJE]=20Adding=20task=20for=20denomin?= =?UTF-8?q?ator=20consistency=20in=20effieicncy=20calcula=E2=80=A6=20(#132?= =?UTF-8?q?55)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PWGJE/Tasks/jetHadronRecoil.cxx | 166 +++++++++++++++++++++++++++++++- 1 file changed, 161 insertions(+), 5 deletions(-) diff --git a/PWGJE/Tasks/jetHadronRecoil.cxx b/PWGJE/Tasks/jetHadronRecoil.cxx index b19a527bcb5..0536eadd0da 100644 --- a/PWGJE/Tasks/jetHadronRecoil.cxx +++ b/PWGJE/Tasks/jetHadronRecoil.cxx @@ -143,7 +143,7 @@ struct JetHadronRecoil { registry.add("hZvtxSelected", "Z vertex position;Z_{vtx};entries", {HistType::kTH1F, {{80, -20, 20}}}, doSumw); - if (doprocessData || doprocessDataWithRhoSubtraction || doprocessMCD || doprocessMCDWithRhoSubtraction || doprocessMCDWeighted || doprocessMCDWeightedWithRhoSubtraction || doprocessMCP || doprocessMCPWeighted) { + if (doprocessData || doprocessDataWithRhoSubtraction || doprocessMCD || doprocessMCDWithRhoSubtraction || doprocessMCDWeighted || doprocessMCDWeightedWithRhoSubtraction || doprocessMCP || doprocessMCPWeighted || doprocessMCPWeightedWithMatchedTracks) { registry.add("hNtrig", "number of triggers;trigger type;entries", {HistType::kTH1F, {{2, 0, 2}}}, doSumw); registry.add("hSignalTriggersPtHard", "Signal triggers vs PtHard", {HistType::kTH1F, {pThatAxis}}, doSumw); registry.add("hReferenceTriggersPtHard", "Reference triggers vs PtHard", {HistType::kTH1F, {pThatAxis}}, doSumw); @@ -184,7 +184,7 @@ struct JetHadronRecoil { registry.add("hDeltaRpTDPhiReferenceShifts", "testing shifts;p_{T,jet};#Delta#phi;#DeltaR;shifts", {HistType::kTHnSparseD, {{500, -100, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis, {20, 0.0, 2.0}}}, doSumw); } - if (doprocessMCP || doprocessMCPWeighted) { + if (doprocessMCP || doprocessMCPWeighted || doprocessMCPWeightedWithMatchedTracks) { registry.add("hPartvsJets", "comparing leading particles and jets;p_{T,part};p_{T,jet};#hat{p}", {HistType::kTH3F, {{200, 0, 200}, {500, -100, 400}, {195, 5, 200}}}, doSumw); registry.add("hPtPart", "Particle p_{T};p_{T};entries", {HistType::kTH1F, {{200, 0, 200}}}, doSumw); registry.add("hEtaPart", "Particle #eta;#eta;entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}, doSumw); @@ -389,11 +389,139 @@ struct JetHadronRecoil { phiTTAr.push_back(particle.phi()); ptTTAr.push_back(particle.pt()); nTT++; + registry.fill(HIST("hSignalTriggers"), particle.pt(), weight); } if (!isSigCol && particle.pt() < ptTTrefMax && particle.pt() > ptTTrefMin) { phiTTAr.push_back(particle.phi()); ptTTAr.push_back(particle.pt()); nTT++; + registry.fill(HIST("hReferenceTriggers"), particle.pt(), weight); + } + registry.fill(HIST("hPtPart"), particle.pt(), weight); + registry.fill(HIST("hEtaPart"), particle.eta(), weight); + registry.fill(HIST("hPhiPart"), particle.phi(), weight); + registry.fill(HIST("hPart3D"), particle.pt(), particle.eta(), particle.phi(), weight); + registry.fill(HIST("hPtPartPtHard"), particle.pt(), particle.pt() / pTHat, weight); + } + + if (nTT > 0) { + trigNumber = rand->Integer(nTT); + phiTT = phiTTAr[trigNumber]; + ptTT = ptTTAr[trigNumber]; + if (isSigCol) { + registry.fill(HIST("hNtrig"), 1.5, weight); + registry.fill(HIST("hSigEventTriggers"), nTT, weight); + registry.fill(HIST("hSignalTriggersPtHard"), ptTT / pTHat, weight); + } + if (!isSigCol) { + registry.fill(HIST("hNtrig"), 0.5, weight); + registry.fill(HIST("hRefEventTriggers"), nTT, weight); + registry.fill(HIST("hReferenceTriggersPtHard"), ptTT / pTHat, weight); + } + } + + for (const auto& jet : jets) { + if (jet.pt() > leadingJetPt) { + leadingJetPt = jet.pt(); + } + if (jet.pt() > pTHatMaxMCP * pTHat) { + if (outlierRejectEvent) { + return; + } else { + continue; + } + } + for (const auto& constituent : jet.template tracks_as()) { + registry.fill(HIST("hConstituents3D"), constituent.pt(), constituent.eta(), constituent.phi()); + } + registry.fill(HIST("hJetPt"), jet.pt(), weight); + registry.fill(HIST("hJetEta"), jet.eta(), weight); + registry.fill(HIST("hJetPhi"), jet.phi(), weight); + registry.fill(HIST("hJet3D"), jet.pt(), jet.eta(), jet.phi(), weight); + + if (nTT > 0) { + float dphi = RecoDecay::constrainAngle(jet.phi() - phiTT); + double dR = getWTAaxisDifference(jet, particles); + if (isSigCol) { + if (std::abs(dphi - o2::constants::math::PI) < 0.6) { + registry.fill(HIST("hDeltaRpTSignalPart"), jet.pt(), dR, weight); + registry.fill(HIST("hDeltaRSignalPart"), dR, weight); + } + registry.fill(HIST("hDeltaRpTDPhiSignalPart"), jet.pt(), dphi, dR, weight); + registry.fill(HIST("hSignalPtDPhi"), dphi, jet.pt(), weight); + if (std::abs(dphi - o2::constants::math::PI) < 0.6) { + registry.fill(HIST("hSignalPt"), jet.pt(), weight); + registry.fill(HIST("hSignalPtHard"), jet.pt(), ptTT / pTHat, weight); + } + } + if (!isSigCol) { + if (std::abs(dphi - o2::constants::math::PI) < 0.6) { + registry.fill(HIST("hDeltaRpTPartReference"), jet.pt(), dR, weight); + registry.fill(HIST("hDeltaRPartReference"), dR, weight); + } + registry.fill(HIST("hDeltaRpTDPhiReferencePart"), jet.pt(), dphi, dR, weight); + registry.fill(HIST("hReferencePtDPhi"), dphi, jet.pt(), weight); + if (std::abs(dphi - o2::constants::math::PI) < 0.6) { + registry.fill(HIST("hReferencePt"), jet.pt(), weight); + registry.fill(HIST("hReferencePtHard"), jet.pt(), ptTT / pTHat, weight); + } + } + } + } + registry.fill(HIST("hPartvsJets"), leadingPartPt, leadingJetPt, pTHat, weight); + } + + template + void fillMCPHistogramsWithMatchedTracks(T const& jets, U const& particles, V const& tracks, float weight = 1.0, float pTHat = 999.0) + { + bool isSigCol; + std::vector phiTTAr; + std::vector ptTTAr; + double phiTT = 0; + double ptTT = 0; + int trigNumber = 0; + int nTT = 0; + double leadingPartPt = 0; + double leadingJetPt = 0; + float dice = rand->Rndm(); + if (dice < fracSig) + isSigCol = true; + else + isSigCol = false; + + for (const auto& track : tracks) { + if (!track.has_mcParticle()) { + continue; + } + auto particle = track.template mcParticle_as(); + if (particle.pt() > leadingPartPt) { + leadingPartPt = particle.pt(); + } + if (particle.pt() > pTHatTrackMaxMCD * pTHat) { + if (outlierRejectEvent) { + return; + } else { + continue; + } + } + auto pdgParticle = pdg->GetParticle(particle.pdgCode()); + if (!pdgParticle) { + continue; + } + if ((pdgParticle->Charge() == 0.0) || (!particle.isPhysicalPrimary())) { + continue; + } + if (isSigCol && particle.pt() < ptTTsigMax && particle.pt() > ptTTsigMin && track.pt() < ptTTsigMax && track.pt() > ptTTsigMin) { + phiTTAr.push_back(particle.phi()); + ptTTAr.push_back(particle.pt()); + nTT++; + registry.fill(HIST("hSignalTriggers"), particle.pt(), weight); + } + if (!isSigCol && particle.pt() < ptTTrefMax && particle.pt() > ptTTrefMin && track.pt() < ptTTrefMax && track.pt() > ptTTrefMin) { + phiTTAr.push_back(particle.phi()); + ptTTAr.push_back(particle.pt()); + nTT++; + registry.fill(HIST("hReferenceTriggers"), particle.pt(), weight); } registry.fill(HIST("hPtPart"), particle.pt(), weight); registry.fill(HIST("hEtaPart"), particle.eta(), weight); @@ -537,10 +665,19 @@ struct JetHadronRecoil { } } if (track.pt() < ptTTsigMax && track.pt() > ptTTsigMin) { - phiTTAr.push_back(track.phi()); - nTT++; auto particle = track.template mcParticle_as(); - phiTTArPart.push_back(particle.phi()); + auto pdgParticle = pdg->GetParticle(particle.pdgCode()); + if (!pdgParticle) { + continue; + } + if ((pdgParticle->Charge() == 0.0) || (!particle.isPhysicalPrimary())) { + continue; + } + if (particle.pt() < ptTTsigMax && particle.pt() > ptTTsigMin) { + nTT++; + phiTTAr.push_back(track.phi()); + phiTTArPart.push_back(particle.phi()); + } } } @@ -761,6 +898,25 @@ struct JetHadronRecoil { } PROCESS_SWITCH(JetHadronRecoil, processMCPWeighted, "process MC particle level with event weights", false); + void processMCPWeightedWithMatchedTracks(aod::JetMcCollision const& collision, + soa::Filtered> const& jets, + soa::Filtered const& particles, + soa::Filtered const& tracks) + { + if (std::abs(collision.posZ()) > vertexZCut) { + return; + } + if (skipMBGapEvents && collision.subGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) { + return; + } + if (collision.ptHard() < pTHatMinEvent) { + return; + } + registry.fill(HIST("hZvtxSelected"), collision.posZ(), collision.weight()); + fillMCPHistogramsWithMatchedTracks(jets, particles, tracks, collision.weight(), collision.ptHard()); + } + PROCESS_SWITCH(JetHadronRecoil, processMCPWeightedWithMatchedTracks, "process MC particle level with event weights - only triggers matched with detector level tracks", false); + void processJetsMCPMCDMatched(soa::Filtered>::iterator const& collision, soa::Filtered> const& mcdjets, aod::JetTracks const& tracks, From fa0cebd3eb555634b91ae6bc68723a050cea8b1e Mon Sep 17 00:00:00 2001 From: ariedel-cern <85537041+ariedel-cern@users.noreply.github.com> Date: Wed, 8 Oct 2025 20:58:08 +0200 Subject: [PATCH 668/986] [PWGCF] Clean up event selection in femto framework (#13281) --- PWGCF/Femto/Core/baseSelection.h | 69 ++++++++++++-- PWGCF/Femto/Core/collisionBuilder.h | 99 +++++++++++++++------ PWGCF/Femto/Core/selectionContainer.h | 59 +++++++++--- PWGCF/Femto/TableProducer/femtoProducer.cxx | 40 ++------- 4 files changed, 184 insertions(+), 83 deletions(-) diff --git a/PWGCF/Femto/Core/baseSelection.h b/PWGCF/Femto/Core/baseSelection.h index c2280dc21eb..d85829beb7a 100644 --- a/PWGCF/Femto/Core/baseSelection.h +++ b/PWGCF/Femto/Core/baseSelection.h @@ -170,15 +170,46 @@ class BaseSelection // set bitmask for given observable mSelectionContainers.at(observableIndex).evaluate(value); // check if minimal selction for this observable holds + // if one minimal selection is not fullfilled, the condition failes if (mSelectionContainers.at(observableIndex).passesAsMinimalCut() == false) { mPassesMinimalSelections = false; } // check if any optional selection holds + // if one optional selection is fullfilled, the condition succeeds if (mSelectionContainers.at(observableIndex).passesAsOptionalCut() == true) { mPassesOptionalSelections = true; } } + /// \brief Evaluate a single observable against its configured selections. + /// \param observableIndex Index of the observable. + /// \param values vector of values of the observable. + void evaluateObservable(int observableIndex, std::vector values) + { + // if there are no selections configured, bail out + if (mSelectionContainers.at(observableIndex).isEmpty()) { + return; + } + // if any previous observable did not pass minimal selections, there is no point in setting bitmask for other observables + // minimal selection for each observable is computed after adding it + if (mPassesMinimalSelections == false) { + return; + } + // set bitmask for given observable + mSelectionContainers.at(observableIndex).evaluate(values); + // check if minimal selction for this observable holds + if (mSelectionContainers.at(observableIndex).passesAsMinimalCut() == false) { + mPassesMinimalSelections = false; + } + // check if any optional selection holds + if (mSelectionContainers.at(observableIndex).passesAsOptionalCut() == true) { + mPassesOptionalSelections = true; + } + } + + /// \brief Add comments to specific observabel + void addComments(int observableIndex, std::vector const& comments) { mSelectionContainers.at(observableIndex).addComments(comments); } + /// \brief Check if all required (minimal) and optional cuts are passed. /// \return True if all required and at least one optional cut (if present) is passed. bool passesAllRequiredSelections() const @@ -223,20 +254,38 @@ class BaseSelection /// \return The combined selection bitmask. BitmaskType getBitmask(int observableIndex) const { return static_cast(mSelectionContainers.at(observableIndex).getBitmask().to_ullong()); } - /// \brief Retrieve the assembled bitmask as an integer value. + /// \brief Set the assembled bitmask for on observable /// \return The combined selection bitmask. template void setBitmask(int observableIndex, R bitmask) { + // if there are no selections configured, bail out + if (mSelectionContainers.at(observableIndex).isEmpty()) { + return; + } + // if any previous observable did not pass minimal selections, there is no point in setting bitmask for other observables + // minimal selection for each observable is computed after adding it + if (mPassesMinimalSelections == false) { + return; + } + // set bitmask for given observable mSelectionContainers.at(observableIndex).setBitmask(bitmask); + // check if minimal selction for this observable holds + if (mSelectionContainers.at(observableIndex).passesAsMinimalCut() == false) { + mPassesMinimalSelections = false; + } + // check if any optional selection holds + if (mSelectionContainers.at(observableIndex).passesAsOptionalCut() == true) { + mPassesOptionalSelections = true; + } } /// \brief Print detailed information about all configured selections. /// \tparam MapType Type used in the observable name map (usually an enum or int). /// \param objectName Name of the current object (e.g. particle species). /// \param observableNames Map from observable index to human-readable names. - template - void printSelections(const std::string& objectName, const std::unordered_map& observableNames) const + template + void printSelections(const std::string& objectName, const std::unordered_map& observableNames) const { LOG(info) << "Printing Configuration of " << objectName; @@ -248,7 +297,7 @@ class BaseSelection continue; } - const MapType key = static_cast(idx); + R key = static_cast(idx); const std::string& name = observableNames.count(key) ? observableNames.at(key) : "[Unknown]"; LOG(info) << "Observable: " << name << " (index " << idx << ")"; @@ -260,9 +309,11 @@ class BaseSelection const auto& values = container.getSelectionValues(); const auto& functions = container.getSelectionFunction(); - const bool useFunctions = !functions.empty(); - const size_t numSelections = useFunctions ? functions.size() : values.size(); - const bool skipMostPermissive = container.skipMostPermissiveBit(); + bool useFunctions = !functions.empty(); + size_t numSelections = useFunctions ? functions.size() : values.size(); + bool skipMostPermissive = container.skipMostPermissiveBit(); + const auto& comments = container.getComments(); + bool hasComments = !comments.empty(); int valWidth = 20; int bitWidth = 30; @@ -273,7 +324,9 @@ class BaseSelection // Selection string (either value or function) const std::string& sel = useFunctions ? std::string(functions[j].GetFormula()->GetExpFormula().Data()) : std::to_string(values[j]); line << " " << std::left << std::setw(valWidth) << sel; - + if (hasComments) { + line << "(" << comments.at(j) << ")"; + } // Bitmask if (skipMostPermissive && j == 0) { line << std::setw(bitWidth) << "-> loosest minimal selection, no bit saved"; diff --git a/PWGCF/Femto/Core/collisionBuilder.h b/PWGCF/Femto/Core/collisionBuilder.h index adcfd40b5ee..71f9bc48028 100644 --- a/PWGCF/Femto/Core/collisionBuilder.h +++ b/PWGCF/Femto/Core/collisionBuilder.h @@ -25,14 +25,17 @@ #include "Common/CCDB/EventSelectionParams.h" #include "EventFiltering/Zorro.h" +#include "DataFormatsParameters/GRPMagField.h" #include "Framework/AnalysisHelpers.h" #include "Framework/Configurable.h" #include "fairlogger/Logger.h" +#include #include #include #include +#include namespace o2::analysis::femto { @@ -73,13 +76,14 @@ struct ConfCollisionBits : o2::framework::ConfigurableGroup { o2::framework::Configurable> occupancyMax{"occupancyMax", {}, "Maximum occpancy"}; o2::framework::Configurable> sphericityMin{"sphericityMin", {}, "Minimum sphericity"}; o2::framework::Configurable> sphericityMax{"sphericityMax", {}, "Maximum sphericity"}; + o2::framework::Configurable> triggers{"triggers", {}, "List of all triggers to be used"}; }; -struct ConfCollisionTriggers : o2::framework::ConfigurableGroup { - std::string prefix = std::string("CollisionTriggers"); - o2::framework::Configurable useTrigger{"useTrigger", false, "Set to true to only selected triggered collisions"}; - o2::framework::Configurable ccdbPath{"ccdbPath", std::string("EventFiltering/Zorro/"), "CCDB path for trigger information"}; - o2::framework::Configurable triggers{"triggers", std::string("fPPP,fPPL"), "Comma seperated list of all triggers to be used"}; +struct ConfCcdb : o2::framework::ConfigurableGroup { + std::string prefix = std::string("ConfCcdb"); + o2::framework::Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "URL to ccdb"}; + o2::framework::Configurable grpPath{"grpPath", "GLO/Config/GRPMagField", "Path to GRP object (Run3 -> GLO/Config/GRPMagField/Run2 -> GLO/GRP/GRP"}; + o2::framework::Configurable triggerPath{"triggerPath", "EventFiltering/Zorro/", "CCDB path for trigger information"}; }; struct ConfCollisionRctFlags : o2::framework::ConfigurableGroup { @@ -125,6 +129,8 @@ enum CollisionSels { kSphericityMin, ///< Min. sphericity kSphericityMax, ///< Max. sphericity + kTriggers, + kCollisionSelsMax }; @@ -146,14 +152,16 @@ const std::unordered_map colSelsToString = { {kOccupancyMin, "Minimum Occupancy"}, {kOccupancyMax, "Maximum Occupancy"}, {kSphericityMin, "Minimum Sphericity"}, - {kSphericityMax, "Maximum Sphericity"} + {kSphericityMax, "Maximum Sphericity"}, + + {kTriggers, "Triggers"} }; class CollisionSelection : public BaseSelection { public: - CollisionSelection() {} + CollisionSelection() = default; virtual ~CollisionSelection() = default; template @@ -188,6 +196,10 @@ class CollisionSelection : public BaseSelectionaddSelection(config.occupancyMax.value, kOccupancyMax, limits::kUpperLimit, true, true); this->addSelection(config.sphericityMin.value, kSphericityMin, limits::kLowerLimit, true, true); this->addSelection(config.sphericityMax.value, kSphericityMax, limits::kUpperLimit, true, true); + + std::vector triggerValues(config.triggers.value.size(), 1.f); + this->addSelection(triggerValues, kTriggers, limits::kEqualArray, false, true); + this->addComments(kTriggers, config.triggers.value); }; void setMagneticField(int MagField) @@ -255,13 +267,12 @@ class CollisionSelection : public BaseSelection - void applySelections(T const& col) + void applySelections(T const& col, std::vector const& triggerDecisions) { this->reset(); - // casting bool to float gurantees - // false -> 0 - // true -> 1 + // casting bool to float gurantees false -> 0 and true -> 1 + // and we check for equality to 1, so evaluation succeeds if the selection bit is true this->evaluateObservable(kSel8, static_cast(col.sel8())); this->evaluateObservable(kNoSameBunchPileUp, static_cast(col.selection_bit(o2::aod::evsel::kNoSameBunchPileup))); this->evaluateObservable(kIsVertexItsTpc, static_cast(col.selection_bit(o2::aod::evsel::kIsVertexITSTPC))); @@ -280,6 +291,13 @@ class CollisionSelection : public BaseSelectionevaluateObservable(kSphericityMin, mSphericity); this->evaluateObservable(kSphericityMax, mSphericity); + // for the trigger we need to pass an vector of 0 (false) and 1 (true) for all configured trigger selections + if (!triggerDecisions.empty()) { + std::vector trigger(triggerDecisions.size()); + std::transform(triggerDecisions.begin(), triggerDecisions.end(), trigger.begin(), [](bool b) { return b ? 1.0f : 0.0f; }); + this->evaluateObservable(kTriggers, trigger); + } + this->assembleBitmask(); }; @@ -330,18 +348,24 @@ class CollisionBuilder virtual ~CollisionBuilder() = default; template - void init(T1& confFilter, T2& confBits, T3& confRct, T4& confTrigger, T5& confTable, T6& initContext) + void init(T1& confFilter, T2& confBits, T3& confRct, T4& confCcdb, T5& confTable, T6& initContext) { mCollisionSelection.configure(confFilter, confBits); - if (confTrigger.useTrigger.value) { + if (!confBits.triggers.value.empty()) { mUseTrigger = true; - mTriggerNames = confTrigger.triggers.value; - mZorro.setBaseCCDBPath(confTrigger.ccdbPath.value); + for (size_t i = 0; i < confBits.triggers.value.size(); ++i) { + mTriggerNames += confBits.triggers.value[i]; + if (i != confBits.triggers.value.size() - 1) { + mTriggerNames += ","; + } + } + mZorro.setBaseCCDBPath(confCcdb.triggerPath.value); } if (confRct.useRctFlags.value) { mUseRctFlags = true; mRctFlagsChecker.init(confRct.label.value, confRct.useZdc.value, confRct.treatLimitedAcceptanceAsBad.value); } + mGrpPath = confCcdb.grpPath.value; LOG(info) << "Initialize femto collision builder..."; mProducedCollisions = utils::enableTable("FCols_001", confTable.produceCollisions.value, initContext); @@ -360,31 +384,45 @@ class CollisionBuilder LOG(info) << "Initialization done..."; } - template - void buildCollision(T1& bc, T2& col, T3& tracks, T4& ccdb, int magField) + template + void initCollision(T1& bc, T2& col, T3& tracks, T4& ccdb, T5& histRegistry) { - if (mUseTrigger) { - mZorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), mTriggerNames); + if (mRunNumber != bc.runNumber()) { + mRunNumber = bc.runNumber(); + static o2::parameters::GRPMagField* grpo = nullptr; + grpo = ccdb->template getForRun(mGrpPath, mRunNumber); + if (grpo == nullptr) { + LOG(fatal) << "GRP object not found for Run " << mRunNumber; + } + mMagField = static_cast(grpo->getNominalL3Field()); // get magnetic field in kG + + if (mUseTrigger) { + mZorro.initCCDB(ccdb.service, mRunNumber, bc.timestamp(), mTriggerNames); + mZorro.populateHistRegistry(histRegistry, mRunNumber); + } } - mCollisionSelection.setMagneticField(magField); + + mCollisionSelection.setMagneticField(mMagField); mCollisionSelection.setSphericity(tracks); mCollisionSelection.setMultiplicity(col); mCollisionSelection.setCentrality(col); - mCollisionSelection.applySelections(col); + + std::vector triggerDecisions = {}; + if (mUseTrigger) { + triggerDecisions = mZorro.getTriggerOfInterestResults(bc.globalBC()); + } + + mCollisionSelection.applySelections(col, triggerDecisions); } - template - bool checkCollision(T1 const& bc, T2 const& col) + template + bool checkCollision(T1 const& col) { - // First: if triggers are enabled, the object must be selected - if (mUseTrigger && !mZorro.isSelected(bc.globalBC())) { - return false; - } - // Then: if RCT flags are enabled, check them + // check RCT flags first if (mUseRctFlags && !mRctFlagsChecker(col)) { return false; } - // Finally: do the expensive checks + // make other checks return mCollisionSelection.checkFilters(col) && mCollisionSelection.passesAllRequiredSelections(); } @@ -438,6 +476,9 @@ class CollisionBuilder CollisionSelection mCollisionSelection; Zorro mZorro; bool mUseTrigger = false; + int mRunNumber = -1; + std::string mGrpPath = std::string(""); + int mMagField = 0; aod::rctsel::RCTFlagsChecker mRctFlagsChecker; bool mUseRctFlags = false; std::string mTriggerNames = std::string(""); diff --git a/PWGCF/Femto/Core/selectionContainer.h b/PWGCF/Femto/Core/selectionContainer.h index 420af6554d6..0ebeb803b0e 100644 --- a/PWGCF/Femto/Core/selectionContainer.h +++ b/PWGCF/Femto/Core/selectionContainer.h @@ -41,11 +41,12 @@ enum LimitType { kUpperLimit, ///< simple upper limit for the value, kAbsUpperLimit, ///< upper limit of the absolute value, e.g. |eta| < 0.8 kLowerLimit, ///< simple lower limit for the value, e.g. p_T > 0.2 GeV/c kAbsLowerLimit, ///< lower limit of the absolute value, e.g. |DCA_xyz| > 0.05 cm - kEqual, ///< values need to be equal, e.g. sign = 1 kUpperFunctionLimit, ///< simple upper limit of a function value, e.g. DCA_xy > f(pt) kAbsUpperFunctionLimit, ///< upper limit of an absolute value given by a function, e.g. |DCA_xy| > f(pt) kLowerFunctionLimit, ///< simple lower limit of a function value, e.g. DCA_xy < f(pt) - kAbsLowerFunctionLimit ///< lower limit of an absolute value given by a function, e.g. |DCA_xy| < f(pt) + kAbsLowerFunctionLimit, ///< lower limit of an absolute value given by a function, e.g. |DCA_xy| < f(pt) + kEqual, ///< values need to be equal, e.g. sign = 1 + kEqualArray, ///< values inside an array need to be equal }; std::unordered_map limitTypeAsStrings = { @@ -53,11 +54,14 @@ std::unordered_map limitTypeAsStrings = { {kAbsUpperLimit, "Absolute Upper Limit"}, {kLowerLimit, "Lower Limit"}, {kAbsLowerLimit, "Absolute Lower Limit"}, - {kEqual, "Equal"}, {kUpperFunctionLimit, "Upper Function Limit"}, {kAbsUpperFunctionLimit, "Absolute Upper Function Limit"}, {kLowerFunctionLimit, "Lower Function Limit"}, - {kAbsLowerFunctionLimit, "Absolute Lower Function Limit"}}; + {kAbsLowerFunctionLimit, "Absolute Lower Function Limit"}, + {kEqual, "Equal"}, + {kEqualArray, "EqualArray"}, + +}; }; // namespace limits @@ -70,7 +74,8 @@ class SelectionContainer { public: /// Default constructor - SelectionContainer() {} + SelectionContainer() = default; + ~SelectionContainer() = default; /// \brief Constructor for static value-based selection. /// \param SelectionValues Vector of values for the selection. @@ -113,9 +118,7 @@ class SelectionContainer LOG(fatal) << "Too many selections for single a observable. Limit is " << sizeof(BitmaskType) * CHAR_BIT; } for (std::size_t i = 0; i < functions.size(); i++) { - const std::string& func = functions.at(i); - const std::string& safeFunc = func.empty() ? "0.1" : func; // in case string is empty, set to constant value of 0.1 - mSelectionFunctions.emplace_back((baseName + std::to_string(i)).c_str(), safeFunc.c_str(), lowerLimit, upperLimit); + mSelectionFunctions.emplace_back((baseName + std::to_string(i)).c_str(), functions.at(i).c_str(), lowerLimit, upperLimit); } // functions for selection are not necessarily ordered correctly // use value at midpoint to order them @@ -128,8 +131,6 @@ class SelectionContainer } } - virtual ~SelectionContainer() = default; - /// \brief Sort static selection values based on the limit type. void sortSelections() { @@ -140,7 +141,6 @@ class SelectionContainer break; case (limits::kLowerLimit): case (limits::kAbsLowerLimit): - case (limits::kEqual): std::sort(mSelectionValues.begin(), mSelectionValues.end(), [](T a, T b) { return a < b; }); break; default: @@ -166,6 +166,17 @@ class SelectionContainer } } + /// \brief Add comments to the selection values + /// \param comments Vector of comments + void addComments(std::vector const& comments) + { + // make sure that the comments are in correct order + // the values passed to the selection container can be reordered based on the limit type + mComments = comments; + } + + std::vector getComments() const { return mComments; } + /// \brief Update selection limits using internal functions evaluated at a given value. /// \param value Input value to evaluate functions at. void updateLimits(T value) @@ -237,6 +248,26 @@ class SelectionContainer } } + /// \brief Evaluate which selection criteria are fulfilled for a given value. + /// \param values Values of the observable to evaluate + void evaluate(std::vector& values) + { + if (values.size() != mSelectionValues.size()) { + LOG(fatal) << "Wrong number of values have been passed"; + } + for (size_t i = 0; i < mSelectionValues.size(); i++) { + switch (mLimitType) { + case (limits::kEqualArray): + if (std::fabs(values.at(i) - mSelectionValues.at(i)) < constants::math::Epsilon) { + mBitmask.set(i); + } + break; + default: + continue; + } + } + } + /// \brief Retrieve the bitmask indicating which selections were passed. /// \return Bitset representing passed selections. std::bitset getBitmask() const @@ -260,8 +291,9 @@ class SelectionContainer bool passesAsMinimalCut() const { if (mIsMinimalCut) { - // check if loosest bit is set - return mBitmask.test(0); + // check if any bit is set + // in case were bits are evaluted in order, if the loosests fails, all fail, so testing any is safe here + return mBitmask.any(); } else { // if selection is not marked as a minimal cut, we return true by default return true; @@ -325,6 +357,7 @@ class SelectionContainer private: std::vector mSelectionValues = {}; ///< Values used for the selection + std::vector mComments = {}; ///< Comments for the values std::vector mSelectionFunctions = {}; ///< Function used for the selection limits::LimitType mLimitType; ///< Limit type of selection std::bitset mBitmask = {}; ///< bitmask for the observable diff --git a/PWGCF/Femto/TableProducer/femtoProducer.cxx b/PWGCF/Femto/TableProducer/femtoProducer.cxx index 207309a5781..c21281d0616 100644 --- a/PWGCF/Femto/TableProducer/femtoProducer.cxx +++ b/PWGCF/Femto/TableProducer/femtoProducer.cxx @@ -32,7 +32,6 @@ #include "Common/DataModel/TrackSelectionTables.h" #include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPMagField.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisHelpers.h" #include "Framework/AnalysisTask.h" @@ -59,8 +58,6 @@ namespace o2::analysis::femto namespace consumeddata { using Run3PpCollisions = soa::Join; -// FIXME: sometimes people want to run analyis even though centrality calibration is not available yet -// using Run3PpWithoutCentCollisions = soa::Join; using Run3FullPidTracks = soa::Join ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "URL to ccdb"}; - Configurable grpPath{"grpPath", "GLO/Config/GRPMagField", "Path to GRP object (Run3 -> GLO/Config/GRPMagField/Run2 -> GLO/GRP/GRP"}; - } ConfOptions; + // ccdb + collisionbuilder::ConfCcdb confCcdb; // collision builder collisionbuilder::CollisionBuilderProducts collisionBuilderProducts; @@ -92,7 +85,6 @@ struct FemtoProducer { collisionbuilder::ConfCollisionFilters confCollisionFilters; collisionbuilder::ConfCollisionBits confCollisionBits; collisionbuilder::ConfCollisionRctFlags confCollisionRctFlags; - collisionbuilder::ConfCollisionTriggers confCollisionTriggers; collisionbuilder::CollisionBuilder collisionBuilder; // track builder @@ -160,40 +152,23 @@ struct FemtoProducer { // histogramming // add histograms in next iteration - // HistogramRegistry hRegistry{"FemtoProducer", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry hRegistry{"FemtoProducer", {}, OutputObjHandlingPolicy::AnalysisObject}; // data members - int runNumber = -1; - int magField = 0.f; Service ccdb; /// Accessing the CCDB std::unordered_map indexMapTracks; // for mapping tracks to lambdas, cascades and resonances - void initFromCcdb(o2::aod::BCsWithTimestamps::iterator const& bc) - { - if (runNumber == bc.runNumber()) - return; - auto timestamp = bc.timestamp(); - static o2::parameters::GRPMagField* grpo = nullptr; - grpo = ccdb->getForTimeStamp(ConfOptions.grpPath.value, timestamp); - if (grpo == nullptr) { - LOGF(fatal, "GRP object not found for timestamp %llu", timestamp); - return; - } - magField = static_cast(grpo->getNominalL3Field()); // get magnetic field in kG - runNumber = bc.runNumber(); - }; - void init(InitContext& context) { // init ccdb - ccdb->setURL(ConfOptions.ccdbUrl.value); + ccdb->setURL(confCcdb.ccdbUrl.value); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); int64_t now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); ccdb->setCreatedNotAfter(now); // collision selection - collisionBuilder.init(confCollisionFilters, confCollisionBits, confCollisionRctFlags, confCollisionTriggers, confCollisionTables, context); + collisionBuilder.init(confCollisionFilters, confCollisionBits, confCollisionRctFlags, confCcdb, confCollisionTables, context); // configure track builder trackBuilder.init(confTrackBits, confTrackFilters, confTrackTables, context); @@ -232,9 +207,8 @@ struct FemtoProducer { void processTracks(T1 const& col, T2 const& /* bcs*/, T3 const& tracks, T4 const& tracksWithItsPid) { auto bc = col.template bc_as(); - initFromCcdb(bc); - collisionBuilder.buildCollision(bc, col, tracks, ccdb, magField); - if (!collisionBuilder.checkCollision(bc, col)) { + collisionBuilder.initCollision(bc, col, tracks, ccdb, hRegistry); + if (!collisionBuilder.checkCollision(col)) { return; } collisionBuilder.fillCollision(collisionBuilderProducts, col); From 852b1ae8f291ae517ad4277d3bda05d2568579f4 Mon Sep 17 00:00:00 2001 From: Sweta Singh <122526337+sweta29singh@users.noreply.github.com> Date: Wed, 8 Oct 2025 22:05:09 +0200 Subject: [PATCH 669/986] [PWGCF] Mean pT fluctuations in PbPb 5.36TeV (#13263) --- .../EbyEFluctuations/Tasks/eventMeanPtId.cxx | 499 +++++++++++++----- 1 file changed, 355 insertions(+), 144 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/eventMeanPtId.cxx b/PWGCF/EbyEFluctuations/Tasks/eventMeanPtId.cxx index 7ef12c2b69f..7f9797e493f 100644 --- a/PWGCF/EbyEFluctuations/Tasks/eventMeanPtId.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/eventMeanPtId.cxx @@ -38,6 +38,7 @@ #include "Framework/RunningWorkflowInfo.h" #include "Framework/runDataProcessing.h" +#include "TF1.h" #include #include @@ -56,34 +57,134 @@ using namespace o2::framework::expressions; using namespace std; using o2::constants::physics::Pdg; -namespace o2::aod -{ -using MyCollisions = soa::Join; -using MyTracks = soa::Join; - -using MyMCRecoCollisions = soa::Join; -using MyMCRecoCollision = MyMCRecoCollisions::iterator; - -using MyMCRecoTracks = soa::Join; -using MyMCRecoTrack = MyMCRecoTracks::iterator; - -using EventCandidatesMC = soa::Join; -using MyCollision = MyCollisions::iterator; -using MyTrack = MyTracks::iterator; -} // namespace o2::aod - struct EventMeanPtId { + +#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; + + // Configurables + Configurable cVtxZcut{"cVtxZcut", 10.0f, "Vertex Z"}; + Configurable cEtacut{"cEtacut", 0.8f, "Eta cut"}; + Configurable cPtmincut{"cPtmincut", 0.15f, "Pt min cut"}; + Configurable cPtmaxcut{"cPtmaxcut", 2.0f, "Pt max cut"}; + Configurable cPtmincut1{"cPtmincut1", 0.15f, " Pt min cut"}; + Configurable cPtmaxcut1{"cPtmaxcut1", 2.0f, " Pt max cut"}; + Configurable cDcaXYcut{"cDcaXYcut", 0.3f, "DCA XY cut"}; + Configurable cDcaZcut{"cDcaZcut", 2.0f, "DCA Z cut"}; + Configurable cCentmincut{"cCentmincut", 0.0, "Min cent cut"}; + Configurable cCentmaxcut{"cCentmaxcut", 90.0, "Max cent cut"}; + Configurable cTPCcrosscut{"cTPCcrosscut", 70, "TPC crossrows cut"}; + Configurable cItsChiCut{"cItsChiCut", 36, "ITS chi2 cluster cut"}; + Configurable cTpcChiCut{"cTpcChiCut", 4, "TPC chi2 cluster cut"}; + Configurable cnITSClustersCut{"cnITSClustersCut", 5, "Number of ITS clusters cut"}; + Configurable ctpcNClsCut{"ctpcNClsCut", 80, "No. of TPC clusters cut"}; + Configurable threshold{"threshold", 1e-6, "Delta eta bin count"}; + Configurable ptMax{"ptMax", 2.0, "maximum pT"}; + Configurable ptMin{"ptMin", 0.15, "minimum pT"}; + Configurable> ptBins{"ptBins", {0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.90, 0.95, 1.00, 1.05, 1.10, 1.15, 1.20, 1.25, 1.30, 1.35, 1.40, 1.45, 1.50, 1.55, 1.60, 1.65, 1.70, 1.75, 1.80, 1.85, 1.90, 1.95, 2.00}, "p_{T} bins"}; + Configurable piluprejection{"piluprejection", false, "Pileup rejection"}; + + // Event selections + Configurable cSel8Trig{"cSel8Trig", true, "Sel8 (T0A + T0C) Selection Run3"}; + Configurable cTFBorder{"cTFBorder", true, "Timeframe Border Selection"}; + Configurable cNoItsROBorder{"cNoItsROBorder", true, "No ITSRO Border Cut"}; + Configurable cItsTpcVtx{"cItsTpcVtx", true, "ITS+TPC Vertex Selection"}; + Configurable cPileupReject{"cPileupReject", true, "Pileup rejection"}; + Configurable cZVtxTimeDiff{"cZVtxTimeDiff", true, "z-vtx time diff selection"}; + Configurable cIsGoodITSLayers{"cIsGoodITSLayers", true, "Good ITS Layers All"}; + Configurable cItslayerall{"cItslayerall", true, "dead staves of ITS removed"}; + Configurable cvtxtofmatched{"cvtxtofmatched", true, "TOF vertex matched"}; + Configurable cfgRejEl{"cfgRejEl", false, "Rejected electrons"}; + Configurable cdata{"cdata", false, "Enable histogram filling for processData"}; + Configurable citsNCluster{"citsNCluster", false, "Enable Number of ITS clusters"}; + Configurable ctpcNClusterFound{"ctpcNClusterFound", false, "Enable Number of TPC clusters"}; + Configurable cPVContributor{"cPVContributor", false, "Enable Primary Vertex Contributor"}; + Configurable cDCAxy{"cDCAxy", true, "DCAxy cut"}; + Configurable cDCAz{"cDCAz", true, "DCAz cut"}; + Configurable cTPCcr{"cTPCcr", true, "tpc crossed rows"}; + Configurable cITSchi{"cITSchi", true, "ITS chi2"}; + Configurable cTPCchi{"cTPCchi", true, "TPC chi2"}; + Configurable ccentFT0C{"ccentFT0C", true, "Use FT0C centraity"}; + + // PID selection configurables + Configurable cPionPmincut{"cPionPmincut", 0.15, "pion min cut of pion"}; + Configurable cKaonPmincut{"cKaonPmincut", 0.15, "kaon min cut of kaon"}; + Configurable cProtonPmincut{"cProtonPmincut", 0.15, "proton min cut of proton"}; + Configurable cPionPmaxcut{"cPionPmaxcut", 2.0, "pion min cut of pion"}; + Configurable cKaonPmaxcut{"cKaonPmaxcut", 2.0, "kaon min cut of kaon"}; + Configurable cProtonPmaxcut{"cProtonPmaxcut", 2.0, "proton min cut of proton"}; + Configurable cPionPthcut{"cPionPthcut", 0.65, "pion threshold cut of pion"}; + Configurable cKaonPthcut{"cKaonPthcut", 0.65, "kaon threshold cut of kaon"}; + Configurable cProtonPthcut{"cProtonPthcut", 1.0, "proton threshold cut of proton"}; + Configurable cNSigCut2{"cNSigCut2", 2.0, "nSigma cut (2)"}; + Configurable cNSigCut3{"cNSigCut3", 3.0, "nSigma cut (3)"}; + Configurable cElMinCut{"cElMinCut", -3.0, "electron min cut"}; + Configurable cElMaxCut{"cElMaxCut", 5.0, "electron max cut"}; + Configurable cTwoPtlCut2{"cTwoPtlCut2", 2.0, "n2ptl cut"}; + Configurable cRapidityCut05{"cRapidityCut05", 0.5, "rapidity cut"}; + Configurable nchBins{"nchBins", 4000, "Number of bins for nch axis"}; + Configurable nchMin{"nchMin", 0.0, "Minimum value for nch axis"}; + Configurable nchMax{"nchMax", 4000.0, "Maximum value for nch axis"}; + + O2_DEFINE_CONFIGURABLE(cfgEvSelMultCorrelation, bool, true, "Multiplicity correlation cut") + struct : ConfigurableGroup { + + O2_DEFINE_CONFIGURABLE(cfgMultPVFT0CCutEnabled, bool, true, "Enable PV multiplicity vs FT0C centrality cut") + O2_DEFINE_CONFIGURABLE(cfgMultGlobalFT0CCutEnabled, bool, true, "Enable globalTracks vs FT0C centrality cut") + O2_DEFINE_CONFIGURABLE(cfgMultGlobalPVCutEnabled, bool, true, "Enable globalTracks vs PV multiplicity cut") + + Configurable> cfgMultPVFT0CCutPars{"cfgMultPVFT0CCutPars", + std::vector{3303.11, -121.316, 1.90207, -0.0152644, 5.10121e-05, 190.633, -4.32972, 0.0340001, -5.83261e-05, -3.19566e-07}, + "PV multiplicity vs T0C centrality cut parameter values"}; + + Configurable> cfgMultGlobalFT0CCutPars{"cfgMultGlobalFT0CCutPars", + std::vector{1893.97, -61.3423, 0.790664, -0.00507208, 1.41683e-05, 167.997, -5.29125, 0.0840145, -0.000748102, 2.75743e-06}, + "globalTracks vs FT0C cut parameter values"}; + + Configurable> cfgMultGlobalPVCutPars{"cfgMultGlobalPVCutPars", + std::vector{65.0322, 0.557725, -0.772828, 0.059224, -1.96379e-05, 4.46295e-09}, + "globalTracks vs PV cut parameter values"}; + + std::vector multPVFT0CCutPars; + std::vector multGlobalFT0CPars; + std::vector multGlobalPVCutPars; + + TF1* fMultPVFT0CCutLow = nullptr; + TF1* fMultPVFT0CCutHigh = nullptr; + TF1* fMultGlobalFT0CCutLow = nullptr; + TF1* fMultGlobalFT0CCutHigh = nullptr; + TF1* fMultGlobalPVCutLow = nullptr; + TF1* fMultGlobalPVCutHigh = nullptr; + + } cfgFunCoeff; + Service ccdb; Service pdg; + Filter collisionFilter = nabs(aod::collision::posZ) <= cVtxZcut; + Filter trackFilter = (nabs(aod::track::eta) < cEtacut) && (aod::track::pt > ptMin) && (aod::track::pt < ptMax) && (requireGlobalTrackInFilter()); + + using MyCollisions = soa::Filtered>; + using MyCollision = MyCollisions::iterator; + + using MyTracks = soa::Filtered>; + using MyTrack = MyTracks::iterator; + + using MyMCRecoCollisions = soa::Filtered>; + using MyMCRecoCollision = MyMCRecoCollisions::iterator; + + using MyMCRecoTracks = soa::Filtered>; + using MyMCRecoTrack = MyMCRecoTracks::iterator; + + using EventCandidatesMC = soa::Join; + Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable cfgUrlCCDB{"cfgUrlCCDB", "http://alice-ccdb.cern.ch", "url of ccdb"}; Configurable cfgPathCCDB{"cfgPathCCDB", "Users/s/swsingh/My/Object/test", "Path for ccdb-object"}; @@ -92,11 +193,6 @@ struct EventMeanPtId { HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; TH2D* ptHistogramAllchargeRec = nullptr; - Configurable ptMax{"ptMax", 2.0, "maximum pT"}; - Configurable ptMin{"ptMin", 0.15, "minimum pT"}; - Configurable> ptBins{"ptBins", {0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.90, 0.95, 1.00, 1.05, 1.10, 1.15, 1.20, 1.25, 1.30, 1.35, 1.40, 1.45, 1.50, 1.55, 1.60, 1.65, 1.70, 1.75, 1.80, 1.85, 1.90, 1.95, 2.00}, "p_{T} bins"}; - Configurable piluprejection{"piluprejection", false, "Pileup rejection"}; - void init(o2::framework::InitContext&) { if (cfgLoadEff) { @@ -116,7 +212,7 @@ struct EventMeanPtId { AxisSpec vtxZAxis = {100, -20.0, 20.0, "Z (cm)"}; AxisSpec dcaAxis = {1002, -5.01, 5.01, "DCA_{xy} (cm)"}; AxisSpec dcazAxis = {1002, -5.01, 5.01, "DCA_{z} (cm)"}; - AxisSpec ptAxis = {600, 0.0, 6.0, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec ptAxis = {600, 0.0, 6.0, "#it{p}_{T} (GeV/#it{c})"}; // 600,0,6 AxisSpec pAxis = {400, 0.0, 4.0, "#it{p} (GeV/#it{c})"}; AxisSpec betaAxis = {200, 0.0, 2.0, "TOF_{#beta} (GeV/#it{c})"}; AxisSpec dEdxAxis = {2000, 0.0, 200.0, "dE/dx (GeV/#it{c})"}; @@ -126,12 +222,13 @@ struct EventMeanPtId { AxisSpec nSigmaTOFAxispid = {170, -8.5, 8.5, "n#sigma_{TOF}"}; AxisSpec centAxis = {100, 0., 100., "centrality"}; AxisSpec subAxis = {30, 0., 30., "sample"}; - // AxisSpec nchAxis = {4000, 0., 4000., "nch"}; + AxisSpec tnchAxis = {40, 0., 4000., "nch"}; AxisSpec nchAxis = {nchBins, nchMin, nchMax, "nch"}; AxisSpec varAxis1 = {400, 0., 4., "var1"}; AxisSpec varAxis2 = {400, 0., 4., "var2"}; - AxisSpec chi2Axis = {100, 0., 100., "Chi2"}; - AxisSpec crossedRowTpcAxis = {600, 0., 600., "TPC Crossed rows"}; + AxisSpec tpcchi2Axis = {700, 0., 7., "tpc Chi2"}; + AxisSpec itschi2Axis = {400, 0., 40., "its Chi2"}; + AxisSpec crossedRowTpcAxis = {1600, 0., 160., "TPC Crossed rows"}; AxisSpec counter = {10, 0., 10., "events"}; // QA Plots @@ -163,6 +260,7 @@ struct EventMeanPtId { histos.add("Data/hP", "hP", kTH1D, {pAxis}); histos.add("Data/hEta", ";hEta", kTH1D, {etaAxis}); histos.add("Data/hPt", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); + histos.add("Data/hPtvar", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); histos.add("Data/hNsigmaTPC", "hNsigmaTPC", kTH2D, {pAxis, nSigmaTPCAxis}); histos.add("Data/hDCAxy", "hDCAxy", kTH1D, {dcaAxis}); histos.add("Data/hDCAz", "hDCAz", kTH1D, {dcazAxis}); @@ -211,6 +309,9 @@ struct EventMeanPtId { histos.add("Data/hVar1x", "hVar1x", kTH2D, {subAxis, nchAxis}); histos.add("Data/hVar2x", "hVar2x", kTH2D, {subAxis, nchAxis}); histos.add("Data/hVarx", "hVarx", kTH2D, {subAxis, nchAxis}); + histos.add("Data/hdiffVar1x", "hdiffVar1x", kTH2D, {subAxis, nchAxis}); + histos.add("Data/hdiffVar2x", "hdiffVar2x", kTH2D, {subAxis, nchAxis}); + histos.add("Data/hdiffVarx", "hdiffVarx", kTH2D, {subAxis, nchAxis}); histos.add("Data/hVar2meanptx", "hVar2meanptx", kTH2D, {nchAxis, varAxis2}); histos.add("Data/hVar1pix", "hVar1pix", kTH2D, {subAxis, nchAxis}); histos.add("Data/hVar2pix", "hVar2pix", kTH2D, {subAxis, nchAxis}); @@ -236,13 +337,25 @@ struct EventMeanPtId { histos.add("Data/hdEdx_afterselection", "hdEdx_afterselection", kTH2D, {pAxis, dEdxAxis}); histos.add("Data/hTOFbeta_afterselection1", "hTOFbeta_afterselection1", kTH2D, {pAxis, betaAxis}); histos.add("Data/hdEdx_afterselection1", "hdEdx_afterselection1", kTH2D, {pAxis, dEdxAxis}); - histos.add("Data/hTPCchi2perCluster_before", "TPC #Chi^{2}/Cluster", kTH1D, {chi2Axis}); - histos.add("Data/hITSchi2perCluster_before", "ITS #Chi^{2}/Cluster", kTH1D, {chi2Axis}); + histos.add("Data/hTPCchi2perCluster_before", "TPC #Chi^{2}/Cluster", kTH1D, {tpcchi2Axis}); + histos.add("Data/hITSchi2perCluster_before", "ITS #Chi^{2}/Cluster", kTH1D, {itschi2Axis}); histos.add("Data/hTPCCrossedrows_before", "Crossed TPC rows", kTH1D, {crossedRowTpcAxis}); - histos.add("Data/hTPCchi2perCluster_after", "TPC #Chi^{2}/Cluster", kTH1D, {chi2Axis}); - histos.add("Data/hITSchi2perCluster_after", "ITS #Chi^{2}/Cluster", kTH1D, {chi2Axis}); + histos.add("Data/hTPCchi2perCluster_after", "TPC #Chi^{2}/Cluster", kTH1D, {tpcchi2Axis}); + histos.add("Data/hITSchi2perCluster_after", "ITS #Chi^{2}/Cluster", kTH1D, {itschi2Axis}); histos.add("Data/hTPCCrossedrows_after", "Crossed TPC rows", kTH1D, {crossedRowTpcAxis}); histos.add("Data/hcent_nacc", "hcent_nacc", kTH2D, {centAxis, nchAxis}); + histos.add("Data/hcentFT0A_nacc", "hcentFT0A_nacc", kTH2D, {centAxis, nchAxis}); + histos.add("Data/hcentFT0M_nacc", "hcentFT0M_nacc", kTH2D, {centAxis, nchAxis}); + histos.add("Data/hcentFV0A_nacc", "hcentFV0A_nacc", kTH2D, {centAxis, nchAxis}); + histos.add("Data/hNchPV_NchGlobal_before", "hNchPV_NchGlobal_before", kTH2D, {nchAxis, nchAxis}); + histos.add("Data/hcentFT0C_GlobalNch_before", "hcentFT0C_GlobalNch_before", kTH2D, {centAxis, nchAxis}); + histos.add("Data/hcentFT0C_NchPV_before", "hcentFT0C_NchPV_before", kTH2D, {centAxis, nchAxis}); + histos.add("Data/hNchPV_NchGlobal_after", "hNchPV_NchGlobal_after", kTH2D, {nchAxis, nchAxis}); + histos.add("Data/hcentFT0C_GlobalNch_after", "hcentFT0C_GlobalNch_after", kTH2D, {centAxis, nchAxis}); + histos.add("Data/hcentFT0C_NchPV_after", "hcentFT0C_NchPV_after", kTH2D, {centAxis, nchAxis}); + histos.add("Data/hNchPV_NchGlobal_after3", "hNchPV_NchGlobal_after3", kTH2D, {nchAxis, nchAxis}); + histos.add("Data/hNchPV_NchGlobal_after4", "hNchPV_NchGlobal_after4", kTH2D, {nchAxis, nchAxis}); + histos.add("Data/hNchPV_NchGlobal_after5", "hNchPV_NchGlobal_after5", kTH2D, {nchAxis, nchAxis}); histos.addClone("Data/", "Rec/"); // rec histograms @@ -297,17 +410,21 @@ struct EventMeanPtId { histos.add("ptHistogramKaon", "ptHistogramKaon", kTH1D, {ptAxis}); histos.add("ptHistogramProton", "ptHistogramProton", kTH1D, {ptAxis}); histos.add("hnch_gen_all", ";hnch_gen_all", kTH1D, {nchAxis}); - histos.add("hnch_gen_true", ";hnch_gen_true", kTH1D, {nchAxis}); - histos.add("hnch1", ";hnch1", kTH1D, {nchAxis}); - histos.add("hnch2", ";hnch2", kTH1D, {nchAxis}); - histos.add("hnch3", ";hnch3", kTH1D, {nchAxis}); + histos.add("hnch_gen_after_etacut", ";hnch_gen_after_etacut", kTH1D, {nchAxis}); + histos.add("hnch_afterPhysPrimary", ";hnch_afterPhysPrimary", kTH1D, {nchAxis}); histos.add("hnch_pi", ";hnch_pi", kTH1D, {nchAxis}); histos.add("hnch_ka", ";hnch_ka", kTH1D, {nchAxis}); histos.add("hnch_pr", ";hnch_pr", kTH1D, {nchAxis}); + histos.add("hnch_gen", ";hnch_gen", kTH1D, {nchAxis}); + histos.add("hPtvar_gen", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); histos.add("hVar1x_gen", "hVar1x_gen", kTH2D, {subAxis, nchAxis}); histos.add("hVar2x_gen", "hVar2x_gen", kTH2D, {subAxis, nchAxis}); histos.add("hVarx_gen", "hVarx_gen", kTH2D, {subAxis, nchAxis}); + histos.add("hdiffVar1x_gen", "hdiffVar1x_gen", kTH2D, {subAxis, nchAxis}); + histos.add("hdiffVar2x_gen", "hdiffVar2x_gen", kTH2D, {subAxis, nchAxis}); + histos.add("hdiffVarx_gen", "hdiffVarx_gen", kTH2D, {subAxis, nchAxis}); + histos.add("hVar2meanptx_gen", "hVar2meanptx_gen", kTH2D, {nchAxis, varAxis2}); histos.add("hVar1pix_gen", "hVar1pix_gen", kTH2D, {subAxis, nchAxis}); histos.add("hVar2pix_gen", "hVar2pix_gen", kTH2D, {subAxis, nchAxis}); @@ -341,7 +458,8 @@ struct EventMeanPtId { histos.add("hPty_pi_gen", "hPty_pi_gen", kTH2D, {ptAxis, etaAxis}); histos.add("hPty_ka_gen", "hPty_ka_gen", kTH2D, {ptAxis, etaAxis}); histos.add("hPty_pr_gen", "hPty_pr_gen", kTH2D, {ptAxis, etaAxis}); - histos.add("hNch_vs_corr", "hNch_vs_corr", kTH1D, {nchAxis}); + histos.add("hNch_vs_corr", "hNch_vs_corr", kTH2D, {subAxis, nchAxis}); + histos.add("hNch_vs_Nch", "hNch_vs_Nch", kTH2D, {subAxis, nchAxis}); histos.add("hVar1_gen", "hVar1_gen", kTH2D, {subAxis, centAxis}); histos.add("hVar2_gen", "hVar2_gen", kTH2D, {subAxis, centAxis}); histos.add("hVarc_gen", "hVarc_gen", kTH2D, {subAxis, centAxis}); @@ -361,69 +479,100 @@ struct EventMeanPtId { histos.add("hEffVar2x_data", "hEffVar2x_data", kTH2D, {subAxis, nchAxis}); histos.add("hEffVarx_data", "hEffVarx_data", kTH2D, {subAxis, nchAxis}); histos.add("hEffVar2Meanptx_data", "hEffVar2Meanptx_data", kTH2D, {nchAxis, varAxis2}); + histos.add("hterm1", "hterm1", kTProfile, {tnchAxis}); + histos.add("hterm2", "hterm2", kTProfile, {tnchAxis}); + histos.add("hterm1_gen", "hterm1_gen", kTProfile, {tnchAxis}); + histos.add("hterm2_gen", "hterm2_gen", kTProfile, {tnchAxis}); + histos.add("hCentrality_rec_before", "hCentrality_rec_before", kTH1D, {centAxis}); + histos.add("hEta1", ";hEta1", kTH1D, {etaAxis}); + + cfgFunCoeff.multPVFT0CCutPars = cfgFunCoeff.cfgMultPVFT0CCutPars; + cfgFunCoeff.multGlobalFT0CPars = cfgFunCoeff.cfgMultGlobalFT0CCutPars; + cfgFunCoeff.multGlobalPVCutPars = cfgFunCoeff.cfgMultGlobalPVCutPars; + + Configurable cSigmaLowHighcut{"cSigmaLowHighcut", 3.0f, "lower and upper sigma cut"}; + + cfgFunCoeff.fMultPVFT0CCutLow = + new TF1("fMultPVFT0CCutLow", + "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 3.0*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", + 0, 100); + cfgFunCoeff.fMultPVFT0CCutLow->SetParameters(&(cfgFunCoeff.multPVFT0CCutPars[0])); + + cfgFunCoeff.fMultPVFT0CCutHigh = + new TF1("fMultPVFT0CCutHigh", + "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 3.0*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", + 0, 100); + cfgFunCoeff.fMultPVFT0CCutHigh->SetParameters(&(cfgFunCoeff.multPVFT0CCutPars[0])); + + cfgFunCoeff.fMultGlobalFT0CCutLow = + new TF1("fMultGlobalFT0CCutLow", + "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 3.0*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", + 0, 100); + cfgFunCoeff.fMultGlobalFT0CCutLow->SetParameters(&(cfgFunCoeff.multGlobalFT0CPars[0])); + + cfgFunCoeff.fMultGlobalFT0CCutHigh = + new TF1("fMultGlobalFT0CCutHigh", + "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 3.0*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", + 0, 100); + cfgFunCoeff.fMultGlobalFT0CCutHigh->SetParameters(&(cfgFunCoeff.multGlobalFT0CPars[0])); + + cfgFunCoeff.fMultGlobalPVCutLow = + new TF1("fMultGlobalPVCutLow", + "[0] + [1]*x - 3.0*([2] + [3]*x + [4]*x*x + [5]*x*x*x)", + 0, 100); + cfgFunCoeff.fMultGlobalPVCutLow->SetParameters(&(cfgFunCoeff.multGlobalPVCutPars[0])); + + cfgFunCoeff.fMultGlobalPVCutHigh = + new TF1("fMultGlobalPVCutHigh", + "[0] + [1]*x + 3.0*([2] + [3]*x + [4]*x*x + [5]*x*x*x)", + 0, 100); + cfgFunCoeff.fMultGlobalPVCutHigh->SetParameters(&(cfgFunCoeff.multGlobalPVCutPars[0])); } - // Configurables - Configurable cVtxZcut{"cVtxZcut", 10.f, "Vertex Z"}; - Configurable cEtacut{"cEtacut", 0.8, "Eta cut"}; - Configurable cPtmincut{"cPtmincut", 0.2, "Pt min cut"}; - Configurable cPtmaxcut{"cPtmaxcut", 2.0, "Pt max cut"}; - Configurable cDcaXYcut{"cDcaXYcut", 0.12, "DCA XY cut"}; - Configurable cDcaZcut{"cDcaZcut", 2.0, "DCA Z cut"}; - Configurable cCentmincut{"cCentmincut", 0.0, "Min cent cut"}; - Configurable cCentmaxcut{"cCentmaxcut", 90.0, "Max cent cut"}; - Configurable cTPCcrosscut{"cTPCcrosscut", 70, "TPC crossrows cut"}; - Configurable cItsChiCut{"cItsChiCut", 36, "ITS chi2 cluster cut"}; - Configurable cTpcChiCut{"cTpcChiCut", 4, "TPC chi2 cluster cut"}; - Configurable cnITSClustersCut{"cnITSClustersCut", 5, "Number of ITS clusters cut"}; - Configurable ctpcNClsCut{"ctpcNClsCut", 80, "No. of TPC clusters cut"}; - Configurable threshold{"threshold", 1e-6, "Delta eta bin count"}; + bool eventSelected(const float& globalNch, const float& pvTrack, const float& centrality) + { + if (cfgFunCoeff.cfgMultPVFT0CCutEnabled) { - // Event selections - Configurable cSel8Trig{"cSel8Trig", true, "Sel8 (T0A + T0C) Selection Run3"}; - Configurable cTFBorder{"cTFBorder", true, "Timeframe Border Selection"}; - Configurable cNoItsROBorder{"cNoItsROBorder", true, "No ITSRO Border Cut"}; - Configurable cItsTpcVtx{"cItsTpcVtx", true, "ITS+TPC Vertex Selection"}; - Configurable cPileupReject{"cPileupReject", true, "Pileup rejection"}; - Configurable cZVtxTimeDiff{"cZVtxTimeDiff", true, "z-vtx time diff selection"}; - Configurable cIsGoodITSLayers{"cIsGoodITSLayers", true, "Good ITS Layers All"}; - Configurable cItslayerall{"cItslayerall", true, "dead staves of ITS removed"}; - Configurable cvtxtofmatched{"cvtxtofmatched", true, "TOF vertex matched"}; - Configurable cfgRejEl{"cfgRejEl", false, "Rejected electrons"}; - Configurable cdata{"cdata", false, "Enable histogram filling for processData"}; - Configurable citsNCluster{"citsNCluster", false, "Enable Number of ITS clusters"}; - Configurable ctpcNClusterFound{"ctpcNClusterFound", false, "Enable Number of TPC clusters"}; + if (pvTrack < cfgFunCoeff.fMultPVFT0CCutLow->Eval(centrality)) + return false; + if (pvTrack > cfgFunCoeff.fMultPVFT0CCutHigh->Eval(centrality)) + return false; + } - // PID selection configurables - Configurable cPionPmincut{"cPionPmincut", 0.2, "pion min cut of pion"}; - Configurable cKaonPmincut{"cKaonPmincut", 0.2, "kaon min cut of kaon"}; - Configurable cProtonPmincut{"cProtonPmincut", 0.2, "proton min cut of proton"}; - Configurable cPionPmaxcut{"cPionPmaxcut", 2.0, "pion min cut of pion"}; - Configurable cKaonPmaxcut{"cKaonPmaxcut", 2.0, "kaon min cut of kaon"}; - Configurable cProtonPmaxcut{"cProtonPmaxcut", 2.0, "proton min cut of proton"}; - Configurable cPionPthcut{"cPionPthcut", 0.65, "pion threshold cut of pion"}; - Configurable cKaonPthcut{"cKaonPthcut", 0.65, "kaon threshold cut of kaon"}; - Configurable cProtonPthcut{"cProtonPthcut", 1.0, "proton threshold cut of proton"}; - Configurable cNSigCut2{"cNSigCut2", 2.0, "nSigma cut (2)"}; - Configurable cNSigCut3{"cNSigCut3", 3.0, "nSigma cut (3)"}; - Configurable cElMinCut{"cElMinCut", -3.0, "electron min cut"}; - Configurable cElMaxCut{"cElMaxCut", 5.0, "electron max cut"}; - Configurable cTwoPtlCut2{"cTwoPtlCut2", 2.0, "n2ptl cut"}; - Configurable cRapidityCut05{"cRapidityCut05", 0.5, "rapidity cut"}; - Configurable nchBins{"nchBins", 4000, "Number of bins for nch axis"}; - Configurable nchMin{"nchMin", 0.0, "Minimum value for nch axis"}; - Configurable nchMax{"nchMax", 4000.0, "Maximum value for nch axis"}; + if (cfgFunCoeff.cfgMultGlobalFT0CCutEnabled) { + + if (globalNch < cfgFunCoeff.fMultGlobalFT0CCutLow->Eval(centrality)) + return false; + if (globalNch > cfgFunCoeff.fMultGlobalFT0CCutHigh->Eval(centrality)) + return false; + } + + if (cfgFunCoeff.cfgMultGlobalPVCutEnabled) { + + if (globalNch < cfgFunCoeff.fMultGlobalPVCutLow->Eval(pvTrack)) + return false; + if (globalNch > cfgFunCoeff.fMultGlobalPVCutHigh->Eval(pvTrack)) + return false; + } + + return true; + } template - bool selCollision(C const& coll) + bool selCollision(C const& coll, float& cent) { - if (std::abs(coll.posZ()) > cVtxZcut) { + if (std::abs(coll.posZ()) >= cVtxZcut) { return false; } // Reject the collisions with large vertex-z histos.fill(HIST("hEventcounter"), 2.); - // cent = coll.centFT0M(); //centrality for run3 + if (ccentFT0C) { + cent = coll.centFT0C(); // centrality from FT0C + } else { + cent = coll.centFT0M(); // centrality from FT0M + } + if (cSel8Trig && !coll.sel8()) { return false; } // require min bias trigger @@ -452,7 +601,7 @@ struct EventMeanPtId { } histos.fill(HIST("trackSelRec"), 7); - // if (cItslayerall && !coll.selection_bit(aod::evsel::kIsGoodITSLayersAll)) {return false;} + // if (cItslayerall && !coll.selection_bit(aod::evsel::kIsGoodITSLayersAll)) {return false;} histos.fill(HIST("trackSelRec"), 8); if (cvtxtofmatched && !coll.selection_bit(aod::evsel::kIsVertexTOFmatched)) { @@ -471,10 +620,12 @@ struct EventMeanPtId { } // accept only global tracks histos.fill(HIST("tracksel"), 2); - // if (std::fabs(track.dcaXY()) > cDcaXYcut) {return false;} + if (cDCAxy && std::fabs(track.dcaXY()) > cDcaXYcut) { + return false; + } histos.fill(HIST("tracksel"), 3); - if (std::fabs(track.dcaZ()) > cDcaZcut) { + if (cDCAz && std::fabs(track.dcaZ()) > cDcaZcut) { return false; } histos.fill(HIST("tracksel"), 4); @@ -484,31 +635,31 @@ struct EventMeanPtId { } histos.fill(HIST("tracksel"), 5); - if (track.pt() < cPtmincut) { - return false; - } - if (track.pt() > cPtmaxcut) { + if (cTPCcr && track.tpcNClsCrossedRows() < cTPCcrosscut) { return false; } histos.fill(HIST("tracksel"), 6); - if (track.tpcNClsCrossedRows() < cTPCcrosscut) { + if (cITSchi && track.itsChi2NCl() >= cItsChiCut) { return false; } histos.fill(HIST("tracksel"), 7); - if (track.itsChi2NCl() > cItsChiCut) { + if (cTPCchi && track.tpcChi2NCl() >= cTpcChiCut) { return false; } histos.fill(HIST("tracksel"), 8); - if (track.tpcChi2NCl() > cTpcChiCut) { + if (track.sign() == 0) { return false; } - histos.fill(HIST("tracksel"), 9); - if (track.sign() == 0) - return false; + if (cPVContributor) { + if (!(track.isPVContributor())) { + return false; + } + histos.fill(HIST("tracksel"), 9); + } if (citsNCluster) { if (track.itsNCls() < cnITSClustersCut) { @@ -631,20 +782,36 @@ struct EventMeanPtId { } //++++++++++++++++++++++++++++++++++++DATA CALCULATION +++++++++++++++++++++++++++++++++++++++++++++++++++++// - void processData(aod::MyCollision const& coll, aod::MyTracks const& inputTracks) + void processData(MyCollision const& coll, MyTracks const& inputTracks) + { + float cent = -1; histos.fill(HIST("hEventcounter"), 1.); histos.fill(HIST("Data/hZvtx_before_sel"), coll.posZ()); - if (!selCollision(coll)) + if (!selCollision(coll, cent)) return; { histos.fill(HIST("Data/hZvtx_after_sel8"), coll.posZ()); } - const auto cent = coll.centFT0C(); histos.fill(HIST("Data/hCentrality"), cent); + float globalNch = inputTracks.size(); + float pvTrack = coll.multNTracksPV(); + + histos.fill(HIST("Data/hNchPV_NchGlobal_before"), pvTrack, globalNch); + histos.fill(HIST("Data/hcentFT0C_GlobalNch_before"), coll.centFT0C(), globalNch); + histos.fill(HIST("Data/hcentFT0C_NchPV_before"), coll.centFT0C(), pvTrack); + + if (cfgEvSelMultCorrelation && !eventSelected(globalNch, pvTrack, cent)) { + return; + } + + histos.fill(HIST("Data/hNchPV_NchGlobal_after"), pvTrack, globalNch); + histos.fill(HIST("Data/hcentFT0C_GlobalNch_after"), coll.centFT0C(), globalNch); + histos.fill(HIST("Data/hcentFT0C_NchPV_after"), coll.centFT0C(), pvTrack); + double nchAll = 0., nchAllBfCut = 0., nchEta = 0., nchPt = 0., nch = 0., nchPi = 0., nchKa = 0., nchPr = 0.; double q1 = 0., q2 = 0., var1 = 0., var2 = 0.; double sumPtWeight = 0., sumWeight = 0., sumPtPtWeight = 0., var1Eff = 0., var2Eff = 0.; @@ -653,7 +820,8 @@ struct EventMeanPtId { double q1Pr = 0., q2Pr = 0., var1Pr = 0., var2Pr = 0.; int sample = histos.get(HIST("Data/hZvtx_after_sel8"))->GetEntries(); - sample = sample % 30; // subsample error estimation + sample = sample % 30; + for (const auto& track : inputTracks) { nchAllBfCut += 1.; histos.fill(HIST("Data/hnchAll_bf_cut"), nchAllBfCut); @@ -671,11 +839,18 @@ struct EventMeanPtId { nchPt += 1.; histos.fill(HIST("Data/hnchTrue_pt"), nchPt); } - if (track.sign() == 0) - continue; if (!selTrack(track)) continue; + if (track.pt() >= cPtmincut1 && track.pt() <= cPtmaxcut1) { + nch += 1.; + histos.fill(HIST("Data/hnch"), nch); + histos.fill(HIST("Data/hPtvar"), track.pt()); + } + + if (track.pt() < cPtmincut || track.pt() > cPtmaxcut) + continue; + nchAll += 1.; q1 += track.pt(); q2 += (track.pt() * track.pt()); @@ -703,12 +878,6 @@ struct EventMeanPtId { sumPtPtWeight += (track.pt() * track.pt()) / (eff * eff); sumWeight += weight; - if (track.pt() >= cPtmincut || track.pt() <= cPtmaxcut) // do not change this (it is for different pt work) - { - nch += 1.; - histos.fill(HIST("Data/hnch"), nch); - } - // only TPC tracks: Pion, Kaon, Proton if (track.hasTPC() && std::abs(track.tpcNSigmaPi()) < cNSigCut3) histos.fill(HIST("Data/NSigamaTPCpion"), track.pt(), track.tpcNSigmaPi()); @@ -793,6 +962,9 @@ struct EventMeanPtId { } } // Track loop ends! + histos.fill(HIST("Data/hcentFV0A_nacc"), coll.multFV0A(), nchAll); + histos.fill(HIST("Data/hcentFT0A_nacc"), coll.multFT0A(), nchAll); + histos.fill(HIST("Data/hcentFT0M_nacc"), coll.centFT0M(), nchAll); histos.fill(HIST("Data/hcent_nacc"), cent, nchAll); if (nchAll < cTwoPtlCut2) @@ -840,6 +1012,9 @@ struct EventMeanPtId { histos.fill(HIST("Data/hVar2x"), sample, nchAll, var2); histos.fill(HIST("Data/hVarx"), sample, nchAll); histos.fill(HIST("Data/hVar2meanptx"), nchAll, var2); + histos.fill(HIST("Data/hdiffVar1x"), sample, nch, var1); + histos.fill(HIST("Data/hdiffVar2x"), sample, nch, var2); + histos.fill(HIST("Data/hdiffVarx"), sample, nch); histos.fill(HIST("hEffVar1x_data"), sample, nchAll, var1Eff); histos.fill(HIST("hEffVar2x_data"), sample, nchAll, var2Eff); @@ -871,28 +1046,44 @@ struct EventMeanPtId { histos.fill(HIST("Data/hVar2meanptpx"), nchAll, var2Pr); } // event loop ends! - PROCESS_SWITCH(EventMeanPtId, processData, "process real data information", false); + PROCESS_SWITCH(EventMeanPtId, processData, "process real data information", true); //++++++++++++++++++++++++++++++++++++MC Reconstructed +++++++++++++++++++++++++++++++++++++++++++++++++++++// - SliceCache cache; Preslice mcTrack = o2::aod::mcparticle::mcCollisionId; - void processMcReco(aod::MyMCRecoCollision const& coll, aod::MyMCRecoTracks const& inputTracks, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) + void processMcReco(MyMCRecoCollision const& coll, MyMCRecoTracks const& inputTracks, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { + float cent = -1; (void)mcCollisions; if (!coll.has_mcCollision()) { return; } + histos.fill(HIST("Rec/hZvtx_before_sel"), coll.posZ()); histos.fill(HIST("hVtxZ_before_gen"), coll.mcCollision().posZ()); + histos.fill(HIST("hCentrality_rec_before"), cent); - if (!selCollision(coll)) // add + if (!selCollision(coll, cent)) return; - float cent = coll.centFT0C(); histos.fill(HIST("Rec/hZvtx_after_sel8"), coll.posZ()); histos.fill(HIST("Rec/hCentrality"), cent); + float globalNch = inputTracks.size(); + float pvTrack = coll.multNTracksPV(); + + histos.fill(HIST("Rec/hNchPV_NchGlobal_before"), pvTrack, globalNch); + histos.fill(HIST("Rec/hcentFT0C_GlobalNch_before"), coll.centFT0C(), globalNch); + histos.fill(HIST("Rec/hcentFT0C_NchPV_before"), coll.centFT0C(), pvTrack); + + if (cfgEvSelMultCorrelation && !eventSelected(globalNch, pvTrack, cent)) { + return; + } + + histos.fill(HIST("Rec/hNchPV_NchGlobal_after"), pvTrack, globalNch); + histos.fill(HIST("Rec/hcentFT0C_GlobalNch_after"), coll.centFT0C(), globalNch); + histos.fill(HIST("Rec/hcentFT0C_NchPV_after"), coll.centFT0C(), pvTrack); + double nch = 0., nchPi = 0., nchKa = 0., nchPr = 0., nchAll = 0., nchAllBfCut = 0., nchEta = 0., nchPt = 0.; double q1 = 0., q2 = 0.; double q1Pi = 0., q2Pi = 0., q1Ka = 0., q2Ka = 0., q1Pr = 0., q2Pr = 0.; @@ -918,9 +1109,19 @@ struct EventMeanPtId { nchPt += 1.; histos.fill(HIST("Rec/hnchTrue_pt"), nchPt); } + if (!selTrack(track)) continue; - // if (std::fabs(track.y()) > 0.5) continue; + + if (track.pt() >= cPtmincut1 && track.pt() <= cPtmaxcut1) { + nch += 1.; + histos.fill(HIST("Rec/hnch"), nch); + histos.fill(HIST("Rec/hPtvar"), track.pt()); + } + if (track.pt() < cPtmincut || track.pt() > cPtmaxcut) + continue; + + // if (std::fabs(track.y()) > 0.5) continue; histos.fill(HIST("hPt_rec"), track.pt()); histos.fill(HIST("hEta_rec"), track.eta()); @@ -937,6 +1138,9 @@ struct EventMeanPtId { auto mcParticle = track.mcParticle(); nchAll += 1.; + q1 += track.pt(); + q2 += (track.pt() * track.pt()); + histos.fill(HIST("Rec/hnchAll"), nchAll); histos.fill(HIST("ptHistogramAllchargeRec"), track.pt()); histos.fill(HIST("Rec/hDCAxy"), track.dcaXY()); @@ -954,14 +1158,6 @@ struct EventMeanPtId { histos.fill(HIST("Rec/hNsigmaTPC"), track.p(), track.tpcNSigmaPr()); histos.fill(HIST("hPtEta_rec"), track.pt(), track.eta()); - if (track.pt() >= cPtmincut || track.pt() <= cPtmaxcut) // do not change this (it is for different pt work) - { - nch += 1.; - histos.fill(HIST("Rec/hnch"), nch); - } - q1 += track.pt(); - q2 += (track.pt() * track.pt()); - if (std::abs(mcParticle.pdgCode()) == PDG_t::kPiPlus) histos.fill(HIST("ptHistogramPionrec_pdg"), track.pt()); if (std::abs(mcParticle.pdgCode()) == PDG_t::kKPlus) @@ -1102,7 +1298,8 @@ struct EventMeanPtId { } // loop over tracks histos.fill(HIST("Rec/hcent_nacc"), cent, nchAll); histos.fill(HIST("hcent_nacc_corr"), cent, sumWeight); - histos.fill(HIST("hNch_vs_corr"), nchAll, sumWeight); + histos.fill(HIST("hNch_vs_corr"), sample, nchAll, sumWeight); + histos.fill(HIST("hNch_vs_Nch"), sample, nchAll, nchAll); if (nchAll < cTwoPtlCut2) return; @@ -1110,6 +1307,8 @@ struct EventMeanPtId { var2 = (q1 / nchAll); //------------------ Efficiency corrected histograms --------------- + histos.fill(HIST("hterm1"), nchAll, var1); + histos.fill(HIST("hterm2"), nchAll, var2); var1Eff = (sumPtWeight * sumPtWeight - sumPtPtWeight) / (sumWeight * (sumWeight - 1)); var2Eff = (sumPtWeight / sumWeight); @@ -1150,6 +1349,10 @@ struct EventMeanPtId { histos.fill(HIST("Rec/hVar1x"), sample, nchAll, var1); histos.fill(HIST("Rec/hVar2x"), sample, nchAll, var2); histos.fill(HIST("Rec/hVarx"), sample, nchAll); + histos.fill(HIST("Rec/hdiffVar1x"), sample, nch, var1); + histos.fill(HIST("Rec/hdiffVar2x"), sample, nch, var2); + histos.fill(HIST("Rec/hdiffVarx"), sample, nch); + histos.fill(HIST("Rec/hVar2meanptx"), nchAll, var2); histos.fill(HIST("Rec/hVar1pix"), sample, nchAll, var1Pi); histos.fill(HIST("Rec/hVar2pix"), sample, nchAll, var2Pi); @@ -1184,9 +1387,8 @@ struct EventMeanPtId { const auto& mcpartgen = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mccolgen.globalIndex(), cache); histos.fill(HIST("hVtxZ_after_gensim"), mccolgen.posZ()); - double nchGenAll = 0., nchGenTrue = 0.; + double nchGenAll = 0., nchGenTrue = 0., nch1 = 0., nchgen = 0.; double nchPiGen = 0., nchKaGen = 0., nchPrGen = 0.; - double nch1 = 0., nch2 = 0., nch3 = 0.; double q1AllGen = 0, q2AllGen = 0.; double q1PiGen = 0, q2PiGen = 0, q1KaGen = 0, q2KaGen = 0, q1PrGen = 0, q2PrGen = 0; double var1AllGen = 0, var2AllGen = 0.; @@ -1201,11 +1403,7 @@ struct EventMeanPtId { continue; } nch1++; - histos.fill(HIST("hnch1"), nch1); - nch2++; - histos.fill(HIST("hnch2"), nch2); - nch3++; - histos.fill(HIST("hnch3"), nch3); + histos.fill(HIST("hnch_afterPhysPrimary"), nch1); int pid = mcpart.pdgCode(); auto sign = 0; @@ -1220,8 +1418,15 @@ struct EventMeanPtId { if (std::fabs(mcpart.eta()) > cEtacut) continue; nchGenTrue++; - histos.fill(HIST("hnch_gen_true"), nchGenTrue); - if ((mcpart.pt() <= cPtmincut) || (mcpart.pt() >= cPtmaxcut)) + histos.fill(HIST("hnch_gen_after_etacut"), nchGenTrue); + + if (mcpart.pt() >= cPtmincut1 && mcpart.pt() <= cPtmaxcut1) { + nchgen += 1.; + histos.fill(HIST("hnch_gen"), nchgen); + histos.fill(HIST("hPtvar_gen"), mcpart.pt()); + } + + if ((mcpart.pt() < cPtmincut) || (mcpart.pt() > cPtmaxcut)) continue; histos.fill(HIST("hPt_gen"), mcpart.pt()); histos.fill(HIST("hEta_gen"), mcpart.eta()); @@ -1266,7 +1471,7 @@ struct EventMeanPtId { } //|y| < 0.5 cut ends! - } // particle + } // track loop ends! histos.fill(HIST("hcent_nacc_gen"), cent, nchGenAll); if (nchGenAll < cTwoPtlCut2) @@ -1278,6 +1483,8 @@ struct EventMeanPtId { histos.fill(HIST("hVar2_gen"), sampleGen, cent, var2AllGen); histos.fill(HIST("hVarc_gen"), sampleGen, cent); + histos.fill(HIST("hterm1_gen"), nchGenAll, var1AllGen); + histos.fill(HIST("hterm2_gen"), nchGenAll, var2AllGen); //--------------------------Pions------------------------------------------- if (nchPiGen >= cTwoPtlCut2) { var1PiGen = (q1PiGen * q1PiGen - q2PiGen) / (nchPiGen * (nchPiGen - 1)); @@ -1297,6 +1504,10 @@ struct EventMeanPtId { histos.fill(HIST("hVar1x_gen"), sampleGen, nchGenAll, var1AllGen); histos.fill(HIST("hVar2x_gen"), sampleGen, nchGenAll, var2AllGen); histos.fill(HIST("hVarx_gen"), sampleGen, nchGenAll); + histos.fill(HIST("hdiffVar1x_gen"), sampleGen, nchgen, var1AllGen); + histos.fill(HIST("hdiffVar2x_gen"), sampleGen, nchgen, var2AllGen); + histos.fill(HIST("hdiffVarx_gen"), sampleGen, nchgen); + histos.fill(HIST("hVar2meanptx_gen"), nchGenAll, var2AllGen); histos.fill(HIST("hVar1pix_gen"), sampleGen, nchGenAll, var1PiGen); histos.fill(HIST("hVar2pix_gen"), sampleGen, nchGenAll, var2PiGen); @@ -1312,7 +1523,7 @@ struct EventMeanPtId { histos.fill(HIST("hVar2meanptpx_gen"), nchGenAll, var2PrGen); } // void process - PROCESS_SWITCH(EventMeanPtId, processMcReco, "Process reconstructed", true); + PROCESS_SWITCH(EventMeanPtId, processMcReco, "Process reconstructed", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From aa9f145d394f3465437302421b6d42247d03562c Mon Sep 17 00:00:00 2001 From: jaimenorman Date: Thu, 9 Oct 2025 00:10:02 +0100 Subject: [PATCH 670/986] [PWGJE] fix collision rejection (#13286) --- PWGJE/Tasks/jetOutlierQA.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGJE/Tasks/jetOutlierQA.cxx b/PWGJE/Tasks/jetOutlierQA.cxx index 16e2ecffbbf..9cc8ead45ee 100644 --- a/PWGJE/Tasks/jetOutlierQA.cxx +++ b/PWGJE/Tasks/jetOutlierQA.cxx @@ -469,7 +469,7 @@ struct JetOutlierQATask { std::set closeByCollisionIDs; for (auto const& collisionMC : collisionsMC) { if (collisionMC.subGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) { - return; + continue; } float posZtrue = collisionMC.posZ(); for (auto const& collisionCloseMC : collisionsMC) { // check for closeby collisions in MC @@ -491,7 +491,7 @@ struct JetOutlierQATask { // now make reconstructed-level checks for (auto const& collision : collisions) { // loop over reconstructed collisions if (collision.subGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) { - return; + continue; } if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { continue; From e194a063f50f9d75ac0ecd33f747a93b5d6b4e18 Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Thu, 9 Oct 2025 02:36:09 +0200 Subject: [PATCH 671/986] [PWGLF] Code clean up, fix weight calculation (#13289) --- .../Strangeness/lambdaspincorrderived.cxx | 337 +++++------------- 1 file changed, 98 insertions(+), 239 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx index f542a8c8fc7..111fa2b514f 100644 --- a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx @@ -137,24 +137,11 @@ struct lambdaspincorrderived { histos.add("etaCent", "etaCent", HistType::kTH2D, {{32, -0.8, 0.8}, {8, 0.0, 80.0}}, true); // Attempted-for-replacement (Den) and Succeeded (Num) per SE leg kinematics - histos.add("hMatchDen_L", "Attempted #Lambda; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - histos.add("hMatchDen_AL", "Attempted #bar{#Lambda}; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); + histos.add("hMatchDen_L", "Attempted #Lambda; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {40, -1.0, 1.0}, {72, 0.0, 2.0 * TMath::Pi()}}, true); + histos.add("hMatchDen_AL", "Attempted #bar{#Lambda}; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {40, -1.0, 1.0}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - histos.add("hMatchNum_L", "Succeeded #Lambda; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - histos.add("hMatchNum_AL", "Succeeded #bar{#Lambda}; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - - // histos.add("hLambdaNUA", "hLambdaNUA", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - // histos.add("hAntiLambdaNUA", "hAntiLambdaNUA", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - - // histos.add("hLambdaSameForLL", "hLambdaSameForLL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - // histos.add("hLambdaSameForLAL", "hLambdaSameForLAL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - // histos.add("hLambdaSameForALL", "hLambdaSameForALL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - // histos.add("hAntiLambdaSameForALAL", "hAntiLambdaSameForALAL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - - // histos.add("hLambdaMixForLL", "hLambdaMixForLL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - // histos.add("hLambdaMixForLAL", "hLambdaMixForLAL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - // histos.add("hLambdaMixForALL", "hLambdaMixForALL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - // histos.add("hAntiLambdaMixForALAL", "hAntiLambdaMixForALAL", HistType::kTH3D, {{50, 0.0, 5.0}, {32, -0.8, 0.8}, {72, 0.0, 2.0 * TMath::Pi()}}, true); + histos.add("hMatchNum_L", "Succeeded #Lambda; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {40, -1.0, 1.0}, {72, 0.0, 2.0 * TMath::Pi()}}, true); + histos.add("hMatchNum_AL", "Succeeded #bar{#Lambda}; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {40, -1.0, 1.0}, {72, 0.0, 2.0 * TMath::Pi()}}, true); histos.add("hSparseLambdaLambda", "hSparseLambdaLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisR}, true); histos.add("hSparseLambdaAntiLambda", "hSparseLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisR}, true); @@ -176,16 +163,6 @@ struct lambdaspincorrderived { histos.add("hSparseRapAntiLambdaLambdaMixed", "hSparseRapAntiLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); histos.add("hSparseRapAntiLambdaAntiLambdaMixed", "hSparseRapAntiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); - histos.add("hSparsePhiLambdaLambda", "hSparsePhiLambdaLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPhi}, true); - histos.add("hSparsePhiLambdaAntiLambda", "hSparsePhiLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPhi}, true); - histos.add("hSparsePhiAntiLambdaLambda", "hSparsePhiAntiLambdLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPhi}, true); - histos.add("hSparsePhiAntiLambdaAntiLambda", "hSparsePhiAntiLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPhi}, true); - - histos.add("hSparsePhiLambdaLambdaMixed", "hSparsePhiLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPhi}, true); - histos.add("hSparsePhiLambdaAntiLambdaMixed", "hSparsePhiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPhi}, true); - histos.add("hSparsePhiAntiLambdaLambdaMixed", "hSparsePhiAntiLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPhi}, true); - histos.add("hSparsePhiAntiLambdaAntiLambdaMixed", "hSparsePhiAntiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPhi}, true); - ccdb->setURL(cfgCcdbParam.cfgURL); ccdbApi.init("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); @@ -195,10 +172,6 @@ struct lambdaspincorrderived { if (useweight) { hEff_L = ccdb->getForTimeStamp(ConfEffPathL.value, cfgCcdbParam.nolaterthan.value); hEff_AL = ccdb->getForTimeStamp(ConfEffPathAL.value, cfgCcdbParam.nolaterthan.value); - // hweight1 = ccdb->getForTimeStamp(ConfWeightPathLL.value, cfgCcdbParam.nolaterthan.value); - // hweight2 = ccdb->getForTimeStamp(ConfWeightPathLAL.value, cfgCcdbParam.nolaterthan.value); - // hweight3 = ccdb->getForTimeStamp(ConfWeightPathALL.value, cfgCcdbParam.nolaterthan.value); - // hweight4 = ccdb->getForTimeStamp(ConfWeightPathALAL.value, cfgCcdbParam.nolaterthan.value); } } @@ -263,7 +236,7 @@ struct lambdaspincorrderived { void fillHistograms(int tag1, int tag2, const ROOT::Math::PtEtaPhiMVector& particle1, const ROOT::Math::PtEtaPhiMVector& particle2, const ROOT::Math::PtEtaPhiMVector& daughpart1, const ROOT::Math::PtEtaPhiMVector& daughpart2, - int datatype, float mixpairweight, int replacedFlag) + int datatype, float mixpairweight) { auto lambda1Mass = 0.0; @@ -296,95 +269,6 @@ struct lambdaspincorrderived { auto proton1LambdaRF = boostLambda1ToCM(proton1pairCM); auto proton2LambdaRF = boostLambda2ToCM(proton2pairCM); - // =================== Opening-angle correlator: cos(Δθ) for helicity-z and beam-z =================== - - // Proton unit directions in Λ rest frames - TVector3 k1(proton1LambdaRF.Px(), proton1LambdaRF.Py(), proton1LambdaRF.Pz()); - k1 = k1.Unit(); - TVector3 k2(proton2LambdaRF.Px(), proton2LambdaRF.Py(), proton2LambdaRF.Pz()); - k2 = k2.Unit(); - - // Helper: boost a spacelike axis (t=0) from PRF into a Λ rest frame - auto transport = [](const TVector3& v, const ROOT::Math::Boost& B) -> TVector3 { - ROOT::Math::PxPyPzEVector a(v.X(), v.Y(), v.Z(), 0.0); - auto ar = B(a); - TVector3 out(ar.Px(), ar.Py(), ar.Pz()); - return (out.Mag2() > 0) ? out.Unit() : out; - }; - - // ----------------------------- (1) Helicity-z construction ----------------------------- - // z along Λ1 in PRF - TVector3 zPRF(lambda1CM.Px(), lambda1CM.Py(), lambda1CM.Pz()); - if (zPRF.Mag2() == 0) - zPRF = TVector3(0, 0, 1); - zPRF = zPRF.Unit(); - - // transverse axes in PRF - TVector3 ref(0, 0, 1); - if (std::abs(zPRF.Dot(ref)) > 0.999) - ref = TVector3(1, 0, 0); - TVector3 xPRF = (ref - (ref.Dot(zPRF)) * zPRF).Unit(); - TVector3 yPRF = (zPRF.Cross(xPRF)).Unit(); - - // carry PRF triad to Λ rest frames (flip triad for Λ2 to keep same PRF-handedness) - TVector3 z1_h = transport(zPRF, boostLambda1ToCM); - TVector3 x1_h = transport(xPRF, boostLambda1ToCM); - TVector3 y1_h = transport(yPRF, boostLambda1ToCM); - - TVector3 z2_h = transport(-zPRF, boostLambda2ToCM); - TVector3 x2_h = transport(-xPRF, boostLambda2ToCM); - TVector3 y2_h = transport(-yPRF, boostLambda2ToCM); - - // angles and cosΔθ (helicity) - double c1_h = k1.Dot(z1_h); - double s1_h = std::sqrt(std::max(0.0, 1.0 - c1_h * c1_h)); - double phi1_h = std::atan2(k1.Dot(y1_h), k1.Dot(x1_h)); - - double c2_h = k2.Dot(z2_h); - double s2_h = std::sqrt(std::max(0.0, 1.0 - c2_h * c2_h)); - double phi2_h = std::atan2(k2.Dot(y2_h), k2.Dot(x2_h)); - - double cosDeltaTheta_hel = c1_h * c2_h + s1_h * s2_h * std::cos(phi1_h - phi2_h); - if (cosDeltaTheta_hel > 1.0) - cosDeltaTheta_hel = 1.0; - if (cosDeltaTheta_hel < -1.0) - cosDeltaTheta_hel = -1.0; - - // ------------------------------- (2) Beam-z construction ------------------------------- - // z along beam in PRF; choose x by projecting Λ1 onto the ⟂ plane to fix azimuth zero - TVector3 zB(0, 0, 1); - TVector3 L1dir(lambda1CM.Px(), lambda1CM.Py(), lambda1CM.Pz()); - L1dir = L1dir.Unit(); - TVector3 xB = L1dir - (L1dir.Dot(zB)) * zB; - if (xB.Mag2() < 1e-12) - xB = TVector3(1, 0, 0); - xB = xB.Unit(); - TVector3 yB = (zB.Cross(xB)).Unit(); - - // carry beam triad to Λ rest frames (no flip for a common external axis) - TVector3 z1_b = transport(zB, boostLambda1ToCM); - TVector3 x1_b = transport(xB, boostLambda1ToCM); - TVector3 y1_b = transport(yB, boostLambda1ToCM); - - TVector3 z2_b = transport(zB, boostLambda2ToCM); - TVector3 x2_b = transport(xB, boostLambda2ToCM); - TVector3 y2_b = transport(yB, boostLambda2ToCM); - - // angles and cosΔθ (beam) - double c1_b = k1.Dot(z1_b); - double s1_b = std::sqrt(std::max(0.0, 1.0 - c1_b * c1_b)); - double phi1_b = std::atan2(k1.Dot(y1_b), k1.Dot(x1_b)); - - double c2_b = k2.Dot(z2_b); - double s2_b = std::sqrt(std::max(0.0, 1.0 - c2_b * c2_b)); - double phi2_b = std::atan2(k2.Dot(y2_b), k2.Dot(x2_b)); - - double cosDeltaTheta_beam = c1_b * c2_b + s1_b * s2_b * std::cos(phi1_b - phi2_b); - if (cosDeltaTheta_beam > 1.0) - cosDeltaTheta_beam = 1.0; - if (cosDeltaTheta_beam < -1.0) - cosDeltaTheta_beam = -1.0; - // --- STAR-style Δθ (as written: dot product of proton directions in their own Λ RFs) --- // Boost each proton into its parent's rest frame @@ -398,23 +282,30 @@ struct lambdaspincorrderived { TVector3 u1 = TVector3(p1_LRF.Px(), p1_LRF.Py(), p1_LRF.Pz()).Unit(); TVector3 u2 = TVector3(p2_LRF.Px(), p2_LRF.Py(), p2_LRF.Pz()).Unit(); + // Proton unit directions in Λ rest frames + TVector3 k1(proton1LambdaRF.Px(), proton1LambdaRF.Py(), proton1LambdaRF.Pz()); + k1 = k1.Unit(); + TVector3 k2(proton2LambdaRF.Px(), proton2LambdaRF.Py(), proton2LambdaRF.Pz()); + k2 = k2.Unit(); + // STAR-style cosΔθ definition double cosDeltaTheta_STAR_naive = u1.Dot(u2); if (cosDeltaTheta_STAR_naive > 1.0) - cosDeltaTheta_STAR_naive = 1.0; + cosDeltaTheta_STAR_naive = 111.0; if (cosDeltaTheta_STAR_naive < -1.0) - cosDeltaTheta_STAR_naive = -1.0; + cosDeltaTheta_STAR_naive = -111.0; + + double cosDeltaTheta_hel = k1.Dot(k2); + if (cosDeltaTheta_hel > 1.0) + cosDeltaTheta_hel = 111.0; + if (cosDeltaTheta_hel < -1.0) + cosDeltaTheta_hel = -111.0; auto cosThetaDiff = -999.0; - auto costhetaz1costhetaz2 = -999.0; if (cosDef == 0) { cosThetaDiff = cosDeltaTheta_STAR_naive; - if (proton1LambdaRF.P() * proton2LambdaRF.P() != 0.0) { - costhetaz1costhetaz2 = (proton1LambdaRF.Pz() * proton2LambdaRF.Pz()) / (proton1LambdaRF.P() * proton2LambdaRF.P()); - } } else { cosThetaDiff = cosDeltaTheta_hel; - costhetaz1costhetaz2 = cosDeltaTheta_beam; } double deltaPhi = std::abs(RecoDecay::constrainAngle(particle1Dummy.Phi(), 0.0F, harmonic) - RecoDecay::constrainAngle(particle2Dummy.Phi(), 0.0F, harmonic)); @@ -423,20 +314,13 @@ struct lambdaspincorrderived { double deltaR = TMath::Sqrt(deltaEta * deltaEta + deltaPhi * deltaPhi); double epsWeightParticle1 = 1.0; - double epsWeightParticle2 = 1.0; - if (useweight && datatype == 1 && replacedFlag == 1) { + if (useweight && datatype == 1) { if (tag1 == 0) { epsWeightParticle1 = hEff_L->GetBinContent(hEff_L->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic))); } else { epsWeightParticle1 = hEff_AL->GetBinContent(hEff_AL->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic))); } - } else if (useweight && datatype == 1 && replacedFlag == 2) { - if (tag2 == 0) { - epsWeightParticle2 = hEff_L->GetBinContent(hEff_L->FindBin(particle2.Pt(), particle2.Eta(), RecoDecay::constrainAngle(particle2.Phi(), 0.0F, harmonic))); - } else { - epsWeightParticle2 = hEff_AL->GetBinContent(hEff_AL->FindBin(particle2.Pt(), particle2.Eta(), RecoDecay::constrainAngle(particle2.Phi(), 0.0F, harmonic))); - } } if (datatype == 0) { @@ -445,32 +329,19 @@ struct lambdaspincorrderived { if (tag1 == 0 && tag2 == 0) { histos.fill(HIST("hSparseLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); histos.fill(HIST("hSparseRapLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); - histos.fill(HIST("hSparsePhiLambdaLambda"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, mixpairweight); - // histos.fill(HIST("hLambdaSameForLL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), mixpairweight); } else if (tag1 == 0 && tag2 == 1) { histos.fill(HIST("hSparseLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); histos.fill(HIST("hSparseRapLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); - histos.fill(HIST("hSparsePhiLambdaAntiLambda"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, mixpairweight); - // histos.fill(HIST("hLambdaSameForLAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), mixpairweight); } else if (tag1 == 1 && tag2 == 0) { histos.fill(HIST("hSparseAntiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); histos.fill(HIST("hSparseRapAntiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); - histos.fill(HIST("hSparsePhiAntiLambdaLambda"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, mixpairweight); - // histos.fill(HIST("hLambdaSameForALL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), mixpairweight); } else if (tag1 == 1 && tag2 == 1) { histos.fill(HIST("hSparseAntiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); histos.fill(HIST("hSparseRapAntiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); - histos.fill(HIST("hSparsePhiAntiLambdaAntiLambda"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, mixpairweight); - // histos.fill(HIST("hAntiLambdaSameForALAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), mixpairweight); } } else if (datatype == 1) { double weight = mixpairweight; - if (useweight && replacedFlag == 1) { - weight = mixpairweight / epsWeightParticle1; - } - if (useweight && replacedFlag == 2) { - weight = mixpairweight / epsWeightParticle2; - } + weight = mixpairweight / epsWeightParticle1; if (weight <= 0.0) { weight = 1.0; } @@ -478,26 +349,18 @@ struct lambdaspincorrderived { histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight); histos.fill(HIST("hSparseLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); histos.fill(HIST("hSparseRapLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); - histos.fill(HIST("hSparsePhiLambdaLambdaMixed"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, weight); - // histos.fill(HIST("hLambdaMixForLL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), weight1); } else if (tag1 == 0 && tag2 == 1) { histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight); histos.fill(HIST("hSparseLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); histos.fill(HIST("hSparseRapLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); - histos.fill(HIST("hSparsePhiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, weight); - // histos.fill(HIST("hLambdaMixForLAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), weight2); } else if (tag1 == 1 && tag2 == 0) { histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight); histos.fill(HIST("hSparseAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); histos.fill(HIST("hSparseRapAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); - histos.fill(HIST("hSparsePhiAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, weight); - // histos.fill(HIST("hLambdaMixForALL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), weight3); } else if (tag1 == 1 && tag2 == 1) { histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight); histos.fill(HIST("hSparseAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); histos.fill(HIST("hSparseRapAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); - histos.fill(HIST("hSparsePhiAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), costhetaz1costhetaz2, deltaPhi, weight); - // histos.fill(HIST("hAntiLambdaMixForALAL"), particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic), weight4); } } } @@ -536,20 +399,26 @@ struct lambdaspincorrderived { if (v0.pionIndex() == v02.pionIndex()) { continue; } + if (v0.protonIndex() == v02.pionIndex()) { + continue; + } + if (v0.pionIndex() == v02.protonIndex()) { + continue; + } proton2 = ROOT::Math::PtEtaPhiMVector(v02.protonPt(), v02.protonEta(), v02.protonPhi(), o2::constants::physics::MassProton); lambda2 = ROOT::Math::PtEtaPhiMVector(v02.lambdaPt(), v02.lambdaEta(), v02.lambdaPhi(), v02.lambdaMass()); histos.fill(HIST("deltaPhiSame"), std::abs(RecoDecay::constrainAngle(v0.lambdaPhi(), 0.0F, harmonic) - RecoDecay::constrainAngle(v02.lambdaPhi(), 0.0F, harmonic))); if (v0.v0Status() == 0 && v02.v0Status() == 0) { - fillHistograms(0, 0, lambda, lambda2, proton, proton2, 0, 1.0, 0); + fillHistograms(0, 0, lambda, lambda2, proton, proton2, 0, 1.0); } if (v0.v0Status() == 0 && v02.v0Status() == 1) { - fillHistograms(0, 1, lambda, lambda2, proton, proton2, 0, 1.0, 0); + fillHistograms(0, 1, lambda, lambda2, proton, proton2, 0, 1.0); } if (v0.v0Status() == 1 && v02.v0Status() == 0) { - fillHistograms(1, 0, lambda, lambda2, proton, proton2, 0, 1.0, 0); + fillHistograms(1, 0, lambda, lambda2, proton, proton2, 0, 1.0); } if (v0.v0Status() == 1 && v02.v0Status() == 1) { - fillHistograms(1, 1, lambda, lambda2, proton, proton2, 0, 1.0, 0); + fillHistograms(1, 1, lambda, lambda2, proton, proton2, 0, 1.0); } } } @@ -612,16 +481,16 @@ struct lambdaspincorrderived { lambda2 = ROOT::Math::PtEtaPhiMVector(t2.lambdaPt(), t2.lambdaEta(), t2.lambdaPhi(), t2.lambdaMass()); histos.fill(HIST("deltaPhiMix"), std::abs(RecoDecay::constrainAngle(t3.lambdaPhi(), 0.0F, harmonic) - RecoDecay::constrainAngle(t2.lambdaPhi(), 0.0F, harmonic))); if (t3.v0Status() == 0 && t2.v0Status() == 0) { - fillHistograms(0, 0, lambda, lambda2, proton, proton2, 1, 1.0, 1); + fillHistograms(0, 0, lambda, lambda2, proton, proton2, 1, 1.0); } if (t3.v0Status() == 0 && t2.v0Status() == 1) { - fillHistograms(0, 1, lambda, lambda2, proton, proton2, 1, 1.0, 1); + fillHistograms(0, 1, lambda, lambda2, proton, proton2, 1, 1.0); } if (t3.v0Status() == 1 && t2.v0Status() == 0) { - fillHistograms(1, 0, lambda, lambda2, proton, proton2, 1, 1.0, 1); + fillHistograms(1, 0, lambda, lambda2, proton, proton2, 1, 1.0); } if (t3.v0Status() == 1 && t2.v0Status() == 1) { - fillHistograms(1, 1, lambda, lambda2, proton, proton2, 1, 1.0, 1); + fillHistograms(1, 1, lambda, lambda2, proton, proton2, 1, 1.0); } } } // replacement track pair @@ -692,16 +561,16 @@ struct lambdaspincorrderived { histos.fill(HIST("deltaPhiMix"), dPhi, invN); if (t3.v0Status() == 0 && t2.v0Status() == 0) { - fillHistograms(0, 0, lambda, lambda2, proton, proton2, 1, invN, 1); + fillHistograms(0, 0, lambda, lambda2, proton, proton2, 1, invN); } if (t3.v0Status() == 0 && t2.v0Status() == 1) { - fillHistograms(0, 1, lambda, lambda2, proton, proton2, 1, invN, 1); + fillHistograms(0, 1, lambda, lambda2, proton, proton2, 1, invN); } if (t3.v0Status() == 1 && t2.v0Status() == 0) { - fillHistograms(1, 0, lambda, lambda2, proton, proton2, 1, invN, 1); + fillHistograms(1, 0, lambda, lambda2, proton, proton2, 1, invN); } if (t3.v0Status() == 1 && t2.v0Status() == 1) { - fillHistograms(1, 1, lambda, lambda2, proton, proton2, 1, invN, 1); + fillHistograms(1, 1, lambda, lambda2, proton, proton2, 1, invN); } } } // end mixing-event loop @@ -726,10 +595,21 @@ struct lambdaspincorrderived { // select mixing bin for this event const int bin = colBinning.getBin(std::make_tuple(collision1.posz(), collision1.cent())); + // --- if pool is still empty, just store this event and skip mixing + if (eventPools[bin].empty()) { + auto sliced = V0s.sliceBy(tracksPerCollisionV0, collision1.index()); + eventPools[bin].emplace_back(collision1.index(), std::move(sliced)); + if (static_cast(eventPools[bin].size()) > nEvtMixing) { + eventPools[bin].pop_front(); + } + continue; // skip directly to the next event + } + // all V0s from the current event auto poolA = V0s.sliceBy(tracksPerCollisionV0, collision1.index()); // loop over same-event candidate pairs (t1,t2) + int oldindex = -555; for (auto& [t1, t2] : soa::combinations(o2::soa::CombinationsFullIndexPolicy(poolA, poolA))) { if (!selectionV0(t1) || !selectionV0(t2)) continue; @@ -740,106 +620,85 @@ struct lambdaspincorrderived { if (t1.pionIndex() == t2.pionIndex()) continue; - // --- Decide randomly which leg to replace: true=t1, false=t2 - const bool replaceFirst = (gRandom->Rndm() < 0.5); // requires or - - // Kinematics of the SE leg we attempt to replace - auto fillDen = [&](const auto& t) { - const double phiH = RecoDecay::constrainAngle(t.lambdaPhi(), 0.0F, harmonic); - if (t.v0Status() == 0) - histos.fill(HIST("hMatchDen_L"), t.lambdaPt(), t.lambdaEta(), phiH); - else - histos.fill(HIST("hMatchDen_AL"), t.lambdaPt(), t.lambdaEta(), phiH); - }; - - auto fillNum = [&](const auto& t) { - const double phiH = RecoDecay::constrainAngle(t.lambdaPhi(), 0.0F, harmonic); - if (t.v0Status() == 0) - histos.fill(HIST("hMatchNum_L"), t.lambdaPt(), t.lambdaEta(), phiH); - else - histos.fill(HIST("hMatchNum_AL"), t.lambdaPt(), t.lambdaEta(), phiH); - }; - - // Denominator: every SE leg we *try* to replace counts once - fillDen(replaceFirst ? t1 : t2); - - // --- First pass over previous events: count replacements for the chosen leg + // --- First pass over previous events: count replacements for t1 (first leg) int mixes = 0; + struct PoolView { - AllTrackCandidates* pool; - double nRepl; - int collIdx; + AllTrackCandidates* pool; // pointer to slice of V0s from a prior event + int nRepl; // how many tX match t1 by checkKinematics }; + std::vector usable; - double totalRepl = 0; + int totalRepl = 0; for (auto it = eventPools[bin].rbegin(); it != eventPools[bin].rend() && mixes < nEvtMixing; ++it, ++mixes) { const int collision2idx = it->first; - auto& poolB = it->second; - if (collision2idx == collision1.index()) - continue; // safety - - double nRepl = 0; + auto& poolB = it->second; // V0 slice of that prior event in this bin + if (collision2idx == collision1.index()) { + continue; // skip same-event mixing + } + int nRepl = 0; for (auto& tX : poolB) { if (!selectionV0(tX)) continue; - if (replaceFirst ? checkKinematics(t1, tX) : checkKinematics(t2, tX)) - ++nRepl; + if (checkKinematics(t1, tX)) + ++nRepl; // <-- match against t1 only } + if (nRepl > 0) { - usable.push_back(PoolView{&poolB, nRepl, collision2idx}); + usable.push_back(PoolView{&poolB, nRepl}); totalRepl += nRepl; } } - // Numerator: counts only if at least one replacement exists - if (totalRepl > 0) { - fillNum(replaceFirst ? t1 : t2); + // --- Track-by-track matching efficiency (count each t1 once in this event) + if (t1.index() != oldindex) { + const double phi1 = RecoDecay::constrainAngle(t1.lambdaPhi(), 0.0F, harmonic); + if (t1.v0Status() == 0) { + histos.fill(HIST("hMatchDen_L"), t1.lambdaPt(), t1.lambdaEta(), phi1); + } else { + histos.fill(HIST("hMatchDen_AL"), t1.lambdaPt(), t1.lambdaEta(), phi1); + } + + if (totalRepl > 0) { // success for this t1 this event + if (t1.v0Status() == 0) { + histos.fill(HIST("hMatchNum_L"), t1.lambdaPt(), t1.lambdaEta(), phi1); + } else { + histos.fill(HIST("hMatchNum_AL"), t1.lambdaPt(), t1.lambdaEta(), phi1); + } + } + oldindex = t1.index(); } if (totalRepl == 0) - continue; + continue; // no viable replacement for this t1 + + // --- Second pass: build mixed pairs (tX replaces t1), normalized per-SE-leg + const float wBase = 1.0f / static_cast(totalRepl); - const float wBase = 1.0f / totalRepl; - // --- Second pass: actually build mixed pairs for the chosen leg for (auto& pv : usable) { auto& poolB = *pv.pool; for (auto& tX : poolB) { if (!selectionV0(tX)) continue; - if (!(replaceFirst ? checkKinematics(t1, tX) : checkKinematics(t2, tX))) - continue; + if (!checkKinematics(t1, tX)) + continue; // defensive re-check - if (replaceFirst) { - // Replace t1 with tX; keep t2 - proton = ROOT::Math::PtEtaPhiMVector(tX.protonPt(), tX.protonEta(), tX.protonPhi(), o2::constants::physics::MassProton); - lambda = ROOT::Math::PtEtaPhiMVector(tX.lambdaPt(), tX.lambdaEta(), tX.lambdaPhi(), tX.lambdaMass()); - proton2 = ROOT::Math::PtEtaPhiMVector(t2.protonPt(), t2.protonEta(), t2.protonPhi(), o2::constants::physics::MassProton); - lambda2 = ROOT::Math::PtEtaPhiMVector(t2.lambdaPt(), t2.lambdaEta(), t2.lambdaPhi(), t2.lambdaMass()); - - const float dPhi = std::fabs(RecoDecay::constrainAngle(lambda.Phi(), 0.0F, harmonic) - - RecoDecay::constrainAngle(lambda2.Phi(), 0.0F, harmonic)); - histos.fill(HIST("deltaPhiMix"), dPhi, wBase); - - fillHistograms(tX.v0Status(), t2.v0Status(), lambda, lambda2, proton, proton2, 1, wBase, 1); - } else { - // Replace t2 with tX; keep t1 - proton = ROOT::Math::PtEtaPhiMVector(t1.protonPt(), t1.protonEta(), t1.protonPhi(), o2::constants::physics::MassProton); - lambda = ROOT::Math::PtEtaPhiMVector(t1.lambdaPt(), t1.lambdaEta(), t1.lambdaPhi(), t1.lambdaMass()); - proton2 = ROOT::Math::PtEtaPhiMVector(tX.protonPt(), tX.protonEta(), tX.protonPhi(), o2::constants::physics::MassProton); - lambda2 = ROOT::Math::PtEtaPhiMVector(tX.lambdaPt(), tX.lambdaEta(), tX.lambdaPhi(), tX.lambdaMass()); - - const float dPhi = std::fabs(RecoDecay::constrainAngle(lambda.Phi(), 0.0F, harmonic) - - RecoDecay::constrainAngle(lambda2.Phi(), 0.0F, harmonic)); - histos.fill(HIST("deltaPhiMix"), dPhi, wBase); + // Build mixed pair: tX (from prior event) replaces t1; t2 stays (current event) + proton = ROOT::Math::PtEtaPhiMVector(tX.protonPt(), tX.protonEta(), tX.protonPhi(), o2::constants::physics::MassProton); + lambda = ROOT::Math::PtEtaPhiMVector(tX.lambdaPt(), tX.lambdaEta(), tX.lambdaPhi(), tX.lambdaMass()); + proton2 = ROOT::Math::PtEtaPhiMVector(t2.protonPt(), t2.protonEta(), t2.protonPhi(), o2::constants::physics::MassProton); + lambda2 = ROOT::Math::PtEtaPhiMVector(t2.lambdaPt(), t2.lambdaEta(), t2.lambdaPhi(), t2.lambdaMass()); - fillHistograms(t1.v0Status(), tX.v0Status(), lambda, lambda2, proton, proton2, 1, wBase, 2); - } + const float dPhi = std::fabs( + RecoDecay::constrainAngle(lambda.Phi(), 0.0F, harmonic) - + RecoDecay::constrainAngle(lambda2.Phi(), 0.0F, harmonic)); + histos.fill(HIST("deltaPhiMix"), dPhi, wBase); + fillHistograms(tX.v0Status(), t2.v0Status(), lambda, lambda2, proton, proton2, 1, wBase); } } } // end same-event pair loop - // after mixing with prior events, push current event into the pool auto sliced = V0s.sliceBy(tracksPerCollisionV0, collision1.index()); eventPools[bin].emplace_back(collision1.index(), std::move(sliced)); From 5235c64079ecaa6debb90952b55d7578c6375b9a Mon Sep 17 00:00:00 2001 From: abmodak <67369858+abmodak@users.noreply.github.com> Date: Thu, 9 Oct 2025 08:24:42 +0200 Subject: [PATCH 672/986] [PWGCF] Modifications in longrange correlation task (#13293) --- .../Tasks/longrangeCorrelation.cxx | 562 +++++++++++++++--- 1 file changed, 489 insertions(+), 73 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx index a1eb8e9a3eb..7f01edb08b7 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx @@ -29,6 +29,7 @@ #include "Common/DataModel/FT0Corrected.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseITS.h" #include "Common/DataModel/TrackSelectionTables.h" #include "CCDB/BasicCCDBManager.h" @@ -42,13 +43,16 @@ #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" +#include "Framework/O2DatabasePDGPlugin.h" #include "Framework/StepTHn.h" #include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/PID.h" #include "ReconstructionDataFormats/Track.h" #include #include #include +#include #include #include @@ -88,11 +92,29 @@ enum KindOfCorrType { kFT0AFT0C }; +enum KindOfParticles { + PIONS, + KAONS, + PROTONS +}; + static constexpr std::string_view kCorrType[] = {"Ft0aGlobal/", "Ft0cGlobal/", "MftGlobal/", "Ft0aMft/", "Ft0aFt0c/"}; static constexpr std::string_view kEvntType[] = {"SE/", "ME/"}; auto static constexpr kMinFt0cCell = 96; +auto static constexpr kMinCharge = 3.f; AxisSpec axisEvent{10, 0.5, 9.5, "#Event", "EventAxis"}; +namespace o2::aod +{ +namespace longrangemultclass +{ +DECLARE_SOA_COLUMN(Multiplicity, multiplicity, float); //! Centrality/multiplicity value +} // namespace longrangemultclass +DECLARE_SOA_TABLE(LRMultTables, "AOD", "LRMULTTABLE", longrangemultclass::Multiplicity); //! Transient multiplicity table + +using LRMultTable = LRMultTables::iterator; +} // namespace o2::aod + struct LongrangeCorrelation { struct : ConfigurableGroup { @@ -102,7 +124,9 @@ struct LongrangeCorrelation { SliceCache cache; Service ccdb; + Service pdg; o2::ccdb::CcdbApi ccdbApi; + o2::ft0::Geometry ft0Det; std::vector* offsetFT0; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; Configurable cfgVtxCut{"cfgVtxCut", 10.0f, "Vertex Z range to consider"}; @@ -121,6 +145,16 @@ struct LongrangeCorrelation { Configurable isApplySameBunchPileup{"isApplySameBunchPileup", false, "Enable SameBunchPileup cut"}; Configurable isApplyGoodZvtxFT0vsPV{"isApplyGoodZvtxFT0vsPV", false, "Enable GoodZvtxFT0vsPV cut"}; Configurable isReadoutCenter{"isReadoutCenter", false, "Enable Readout Center"}; + Configurable isUseEffCorr{"isUseEffCorr", false, "Enable efficiency correction"}; + Configurable cfgLowEffCut{"cfgLowEffCut", 0.001f, "Low efficiency cut"}; + Configurable isUseItsPid{"isUseItsPid", false, "Use ITS PID for particle identification"}; + Configurable cfgTofPidPtCut{"cfgTofPidPtCut", 0.3f, "Minimum pt to use TOF N-sigma"}; + Configurable cfgTrackPid{"cfgTrackPid", 0, "1 = pion, 2 = kaon, 3 = proton, 0 for no PID"}; + Configurable> itsNsigmaPidCut{"itsNsigmaPidCut", std::vector{3, 2.5, 2, -3, -2.5, -2}, "ITS n-sigma cut for pions_posNsigma, kaons_posNsigma, protons_posNsigma, pions_negNsigma, kaons_negNsigma, protons_negNsigma"}; + Configurable> tpcNsigmaPidCut{"tpcNsigmaPidCut", std::vector{1.5, 1.5, 1.5, -1.5, -1.5, -1.5}, "TPC n-sigma cut for pions_posNsigma, kaons_posNsigma, protons_posNsigma, pions_negNsigma, kaons_negNsigma, protons_negNsigma"}; + Configurable> tofNsigmaPidCut{"tofNsigmaPidCut", std::vector{1.5, 1.5, 1.5, -1.5, -1.5, -1.5}, "TOF n-sigma cut for pions_posNsigma, kaons_posNsigma, protons_posNsigma, pions_negNsigma, kaons_negNsigma, protons_negNsigma"}; + Configurable cfgEffccdbPath{"cfgEffccdbPath", "/alice/data/CCDB/Users/a/abmodak/OO/Efficiency", "Browse track eff object from CCDB"}; + Configurable cfgMultccdbPath{"cfgMultccdbPath", "/alice/data/CCDB/Users/a/abmodak/OO/Multiplicity", "Browse mult efficiency object from CCDB"}; ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -PIHalf, PIHalf * 3}, "delta phi axis for histograms"}; ConfigurableAxis axisDeltaEta{"axisDeltaEta", {40, -6, -2}, "delta eta axis for histograms"}; ConfigurableAxis axisPtTrigger{"axisPtTrigger", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 10.0}, "pt trigger axis for histograms"}; @@ -139,12 +173,14 @@ struct LongrangeCorrelation { ConfigurableAxis amplitudeFt0a{"amplitudeFt0a", {5000, 0, 10000}, "FT0A amplitude"}; ConfigurableAxis channelFt0aAxis{"channelFt0aAxis", {96, 0.0, 96.0}, "FT0A channel"}; - using CollTable = soa::Join; - using TrksTable = soa::Filtered>; + using CollTable = soa::Join; + using TrksTable = soa::Filtered>; using MftTrkTable = soa::Filtered; + using CollTableMC = soa::SmallGroups>; + using TrksTableMC = soa::Filtered>; Preslice perColGlobal = aod::track::collisionId; + Preslice perColMC = aod::track::collisionId; Preslice perColMft = aod::fwdtrack::collisionId; - o2::ft0::Geometry ft0Det; OutputObj sameFt0aGlobal{Form("sameEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; OutputObj mixedFt0aGlobal{Form("mixedEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; @@ -157,6 +193,17 @@ struct LongrangeCorrelation { OutputObj sameFt0aFt0c{Form("sameEventFt0aFt0c_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; OutputObj mixedFt0aFt0c{Form("mixedEventFt0aFt0c_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; + // corrections + TH3D* hTrkEff = nullptr; + TH1D* hMultEff = nullptr; + bool fLoadTrkEffCorr = false; + bool fLoadMultEffCorr = false; + + std::vector tofNsigmaCut; + std::vector itsNsigmaCut; + std::vector tpcNsigmaCut; + o2::aod::ITSResponse itsResponse; + template void addHistos() { @@ -198,6 +245,10 @@ struct LongrangeCorrelation { std::vector userAxis; + tofNsigmaCut = tofNsigmaPidCut; + itsNsigmaCut = itsNsigmaPidCut; + tpcNsigmaCut = tpcNsigmaPidCut; + if (doprocessEventStat) { histos.add("QA/EventHist", "events", kTH1F, {axisEvent}, false); histos.add("QA/VtxZHist", "v_{z} (cm)", kTH1F, {axisVtxZ}, false); @@ -245,6 +296,13 @@ struct LongrangeCorrelation { sameFt0aFt0c.setObject(new CorrelationContainer(Form("sameEventFt0aFt0c_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFt0aFt0c_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); mixedFt0aFt0c.setObject(new CorrelationContainer(Form("mixedEventFt0aFt0c_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFt0aFt0c_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); } + + if (doprocessEff) { + histos.add("hmcgendndptPrimary", "hmcgendndptPrimary", kTHnSparseD, {axisEtaTrig, axisPtTrigger, axisMultiplicity, axisVtxZ}, false); + histos.add("hmcrecdndptRecoPrimary", "hmcrecdndptRecoPrimary", kTHnSparseD, {axisEtaTrig, axisPtTrigger, axisMultiplicity, axisVtxZ}, false); + histos.add("hmcrecdndptRecoAll", "hmcrecdndptRecoAll", kTHnSparseD, {axisEtaTrig, axisPtTrigger, axisMultiplicity, axisVtxZ}, false); + histos.add("hmcrecdndptFake", "hmcrecdndptFake", kTHnSparseD, {axisEtaTrig, axisPtTrigger, axisMultiplicity, axisVtxZ}, false); + } } Filter fTrackSelectionITS = ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) && @@ -309,14 +367,26 @@ struct LongrangeCorrelation { } template - void fillYield(TTracks tracks) + void fillYieldTpc(TTracks tracks) + { + histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("hMult"), tracks.size()); + for (auto const& iTrk : tracks) { + if (cfgTrackPid && getTrackPID(iTrk) != cfgTrackPid) + continue; // if PID is selected, check if the track has the right PID + histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_etavsphi"), iTrk.phi(), iTrk.eta()); + histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_eta"), iTrk.eta()); + histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_phi"), iTrk.phi()); + histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_pt"), iTrk.pt()); + } + } + + template + void fillYieldMft(TTracks tracks) { histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("hMult"), tracks.size()); for (auto const& iTrk : tracks) { auto phi = iTrk.phi(); - if constexpr (corrType == kFT0AMFT) { - o2::math_utils::bringTo02Pi(phi); - } + o2::math_utils::bringTo02Pi(phi); histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_etavsphi"), phi, iTrk.eta()); histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_eta"), iTrk.eta()); histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_phi"), phi); @@ -324,15 +394,134 @@ struct LongrangeCorrelation { } } + void loadEffCorrection(uint64_t timestamp) + { + if (fLoadTrkEffCorr) { + return; + } + if (cfgEffccdbPath.value.empty() == false) { + hTrkEff = ccdb->getForTimeStamp(cfgEffccdbPath, timestamp); + if (hTrkEff == nullptr) { + LOGF(fatal, "Could not load efficiency histogram for trigger particles from %s", cfgEffccdbPath.value.c_str()); + } + LOGF(info, "Loaded efficiency histogram from %s (%p)", cfgEffccdbPath.value.c_str(), (void*)hTrkEff); + } + fLoadTrkEffCorr = true; + } + + void loadMultCorrection(uint64_t timestamp) + { + if (fLoadMultEffCorr) { + return; + } + if (cfgMultccdbPath.value.empty() == false) { + hMultEff = ccdb->getForTimeStamp(cfgMultccdbPath, timestamp); + if (hMultEff == nullptr) { + LOGF(fatal, "Could not load efficiency histogram for multiplicity from %s", cfgMultccdbPath.value.c_str()); + } + LOGF(info, "Loaded efficiency histogram from %s (%p)", cfgMultccdbPath.value.c_str(), (void*)hMultEff); + } + fLoadMultEffCorr = true; + } + + float getTrkEffCorr(float eta, float pt, float posZ) + { + float eff = 1.; + if (hTrkEff) { + int etaBin = hTrkEff->GetXaxis()->FindBin(eta); + int ptBin = hTrkEff->GetYaxis()->FindBin(pt); + int zBin = hTrkEff->GetZaxis()->FindBin(posZ); + eff = hTrkEff->GetBinContent(etaBin, ptBin, zBin); + } else { + eff = 1.0; + } + if (eff < cfgLowEffCut) + eff = 1.0; + + return eff; + } + + float getMultEffCorr(float mult) + { + float eff = 1.; + if (hMultEff) { + int multBin = hMultEff->GetXaxis()->FindBin(mult); + eff = hMultEff->GetBinContent(multBin); + } else { + eff = 1.0; + } + if (eff < cfgLowEffCut) + eff = 1.0; + + return eff; + } + + template + int getTrackPID(TTrack track) + { + // Computing Nsigma arrays for pion, kaon, and protons + std::array nSigmaTPC = {track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()}; + std::array nSigmaTOF = {track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr()}; + std::array nSigmaITS = {itsResponse.nSigmaITS(track), itsResponse.nSigmaITS(track), itsResponse.nSigmaITS(track)}; + int pid = -1; + + std::array nSigmaToUse = isUseItsPid ? nSigmaITS : nSigmaTPC; // Choose which nSigma to use: TPC or ITS + std::vector detectorNsigmaCut = isUseItsPid ? itsNsigmaCut : tpcNsigmaCut; // Choose which nSigma to use: TPC or ITS + + bool isPion, isKaon, isProton; + bool isDetectedPion = nSigmaToUse[0] < detectorNsigmaCut[0] && nSigmaToUse[0] > detectorNsigmaCut[0 + 3]; + bool isDetectedKaon = nSigmaToUse[1] < detectorNsigmaCut[1] && nSigmaToUse[1] > detectorNsigmaCut[1 + 3]; + bool isDetectedProton = nSigmaToUse[2] < detectorNsigmaCut[2] && nSigmaToUse[2] > detectorNsigmaCut[2 + 3]; + + bool isTofPion = nSigmaTOF[0] < tofNsigmaCut[0] && nSigmaTOF[0] > tofNsigmaCut[0 + 3]; + bool isTofKaon = nSigmaTOF[1] < tofNsigmaCut[1] && nSigmaTOF[1] > tofNsigmaCut[1 + 3]; + bool isTofProton = nSigmaTOF[2] < tofNsigmaCut[2] && nSigmaTOF[2] > tofNsigmaCut[2 + 3]; + + if (track.pt() > cfgTofPidPtCut && !track.hasTOF()) { + return 0; + } else if (track.pt() > cfgTofPidPtCut && track.hasTOF()) { + isPion = isTofPion && isDetectedPion; + isKaon = isTofKaon && isDetectedKaon; + isProton = isTofProton && isDetectedProton; + } else { + isPion = isDetectedPion; + isKaon = isDetectedKaon; + isProton = isDetectedProton; + } + + if ((isPion && isKaon) || (isPion && isProton) || (isKaon && isProton)) { + return 0; // more than one particle satisfy the criteria + } + + if (isPion) { + pid = PIONS; + } else if (isKaon) { + pid = KAONS; + } else if (isProton) { + pid = PROTONS; + } else { + return 0; // no particle satisfies the criteria + } + + return pid + 1; // shift the pid by 1, 1 = pion, 2 = kaon, 3 = proton + } + template - void fillCorrFt0aGlobal(TTarget target, TTriggers const& triggers, TFT0s const& ft0, bool mixing, float vz) + void fillCorrFt0aGlobal(TTarget target, TTriggers const& triggers, TFT0s const& ft0, bool mixing, float vz, float multiplicity) { int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); if (!mixing) - histos.fill(HIST("Ft0aGlobal/SE/hMult_used"), triggers.size()); + histos.fill(HIST("Ft0aGlobal/SE/hMult_used"), multiplicity); + for (auto const& triggerTrack : triggers) { + if (cfgTrackPid && getTrackPID(triggerTrack) != cfgTrackPid) + continue; // if PID is selected, check if the track has the right PID + float trkeffw = 1.0f; + if (isUseEffCorr) + trkeffw = getTrkEffCorr(triggerTrack.eta(), triggerTrack.pt(), vz); + if (!mixing) - histos.fill(HIST("Ft0aGlobal/SE/Trig_hist"), fSampleIndex, vz, triggerTrack.pt()); + histos.fill(HIST("Ft0aGlobal/SE/Trig_hist"), fSampleIndex, vz, triggerTrack.pt(), trkeffw); for (std::size_t iCh = 0; iCh < ft0.channelA().size(); iCh++) { auto chanelid = ft0.channelA()[iCh]; @@ -358,23 +547,29 @@ struct LongrangeCorrelation { float deltaPhi = RecoDecay::constrainAngle(triggerTrack.phi() - phi, -PIHalf); float deltaEta = triggerTrack.eta() - eta; if (mixing) - histos.fill(HIST("Ft0aGlobal/ME/deltaEta_deltaPhi"), deltaPhi, deltaEta); + histos.fill(HIST("Ft0aGlobal/ME/deltaEta_deltaPhi"), deltaPhi, deltaEta, trkeffw); else - histos.fill(HIST("Ft0aGlobal/SE/deltaEta_deltaPhi"), deltaPhi, deltaEta); - target->getPairHist()->Fill(step, fSampleIndex, vz, triggerTrack.pt(), triggerTrack.pt(), deltaPhi, deltaEta); + histos.fill(HIST("Ft0aGlobal/SE/deltaEta_deltaPhi"), deltaPhi, deltaEta, trkeffw); + target->getPairHist()->Fill(step, fSampleIndex, vz, triggerTrack.pt(), triggerTrack.pt(), deltaPhi, deltaEta, trkeffw); } // associated ft0 tracks } // trigger tracks } // fillCorrFt0aGlobal template - void fillCorrFt0cGlobal(TTarget target, TTriggers const& triggers, TFT0s const& ft0, bool mixing, float vz) + void fillCorrFt0cGlobal(TTarget target, TTriggers const& triggers, TFT0s const& ft0, bool mixing, float vz, float multiplicity) { int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); if (!mixing) - histos.fill(HIST("Ft0cGlobal/SE/hMult_used"), triggers.size()); + histos.fill(HIST("Ft0cGlobal/SE/hMult_used"), multiplicity); for (auto const& triggerTrack : triggers) { + if (cfgTrackPid && getTrackPID(triggerTrack) != cfgTrackPid) + continue; // if PID is selected, check if the track has the right PID + float trkeffw = 1.0f; + if (isUseEffCorr) + trkeffw = getTrkEffCorr(triggerTrack.eta(), triggerTrack.pt(), vz); + if (!mixing) - histos.fill(HIST("Ft0cGlobal/SE/Trig_hist"), fSampleIndex, vz, triggerTrack.pt()); + histos.fill(HIST("Ft0cGlobal/SE/Trig_hist"), fSampleIndex, vz, triggerTrack.pt(), trkeffw); for (std::size_t iCh = 0; iCh < ft0.channelC().size(); iCh++) { auto chanelid = ft0.channelC()[iCh] + 96; @@ -400,23 +595,29 @@ struct LongrangeCorrelation { float deltaPhi = RecoDecay::constrainAngle(triggerTrack.phi() - phi, -PIHalf); float deltaEta = triggerTrack.eta() - eta; if (mixing) - histos.fill(HIST("Ft0cGlobal/ME/deltaEta_deltaPhi"), deltaPhi, deltaEta); + histos.fill(HIST("Ft0cGlobal/ME/deltaEta_deltaPhi"), deltaPhi, deltaEta, trkeffw); else - histos.fill(HIST("Ft0cGlobal/SE/deltaEta_deltaPhi"), deltaPhi, deltaEta); - target->getPairHist()->Fill(step, fSampleIndex, vz, triggerTrack.pt(), triggerTrack.pt(), deltaPhi, deltaEta); + histos.fill(HIST("Ft0cGlobal/SE/deltaEta_deltaPhi"), deltaPhi, deltaEta, trkeffw); + target->getPairHist()->Fill(step, fSampleIndex, vz, triggerTrack.pt(), triggerTrack.pt(), deltaPhi, deltaEta, trkeffw); } // associated ft0 tracks } // trigger tracks } // fillCorrFt0cGlobal template - void fillCorrMftGlobal(TTarget target, TTriggers const& triggers, TMFTs const& mft, bool mixing, float vz) + void fillCorrMftGlobal(TTarget target, TTriggers const& triggers, TMFTs const& mft, bool mixing, float vz, float multiplicity) { int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); if (!mixing) - histos.fill(HIST("MftGlobal/SE/hMult_used"), triggers.size()); + histos.fill(HIST("MftGlobal/SE/hMult_used"), multiplicity); for (auto const& triggerTrack : triggers) { + if (cfgTrackPid && getTrackPID(triggerTrack) != cfgTrackPid) + continue; // if PID is selected, check if the track has the right PID + float trkeffw = 1.0f; + if (isUseEffCorr) + trkeffw = getTrkEffCorr(triggerTrack.eta(), triggerTrack.pt(), vz); + if (!mixing) - histos.fill(HIST("MftGlobal/SE/Trig_hist"), fSampleIndex, vz, triggerTrack.pt()); + histos.fill(HIST("MftGlobal/SE/Trig_hist"), fSampleIndex, vz, triggerTrack.pt(), trkeffw); for (auto const& assoTrack : mft) { if (!isMftTrackSelected(assoTrack)) { @@ -436,20 +637,20 @@ struct LongrangeCorrelation { float deltaPhi = RecoDecay::constrainAngle(triggerTrack.phi() - phi, -PIHalf); float deltaEta = triggerTrack.eta() - assoTrack.eta(); if (mixing) - histos.fill(HIST("MftGlobal/ME/deltaEta_deltaPhi"), deltaPhi, deltaEta); + histos.fill(HIST("MftGlobal/ME/deltaEta_deltaPhi"), deltaPhi, deltaEta, trkeffw); else - histos.fill(HIST("MftGlobal/SE/deltaEta_deltaPhi"), deltaPhi, deltaEta); - target->getPairHist()->Fill(step, fSampleIndex, vz, triggerTrack.pt(), assoTrack.pt(), deltaPhi, deltaEta); + histos.fill(HIST("MftGlobal/SE/deltaEta_deltaPhi"), deltaPhi, deltaEta, trkeffw); + target->getPairHist()->Fill(step, fSampleIndex, vz, triggerTrack.pt(), assoTrack.pt(), deltaPhi, deltaEta, trkeffw); } // associated mft tracks } // trigger tracks } // fillCorrMftGlobal - template - void fillCorrFt0aMft(TTarget target, TTracks const& tracks, TTriggers const& triggers, TFT0s const& ft0, bool mixing, float vz) + template + void fillCorrFt0aMft(TTarget target, TTriggers const& triggers, TFT0s const& ft0, bool mixing, float vz, float multiplicity) { int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); if (!mixing) - histos.fill(HIST("Ft0aMft/SE/hMult_used"), tracks.size()); + histos.fill(HIST("Ft0aMft/SE/hMult_used"), multiplicity); for (auto const& triggerTrack : triggers) { if (!isMftTrackSelected(triggerTrack)) { continue; @@ -493,12 +694,12 @@ struct LongrangeCorrelation { } // trigger tracks } // fillCorrFt0aMft - template - void fillCorrFt0aFt0c(TTarget target, TTriggers const& triggers, TFT0As const& ft0a, TFT0Cs const& ft0c, bool mixing, float vz) + template + void fillCorrFt0aFt0c(TTarget target, TFT0As const& ft0a, TFT0Cs const& ft0c, bool mixing, float vz, float multiplicity) { int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); if (!mixing) - histos.fill(HIST("Ft0aFt0c/SE/hMult_used"), triggers.size()); + histos.fill(HIST("Ft0aFt0c/SE/hMult_used"), multiplicity); for (std::size_t iChA = 0; iChA < ft0a.channelA().size(); iChA++) { if (!mixing) @@ -573,79 +774,112 @@ struct LongrangeCorrelation { histos.fill(HIST("QA/VtxZHist"), col.posZ()); } - void processFt0aGlobalSE(CollTable::iterator const& col, aod::FT0s const&, TrksTable const& tracks) + void processFt0aGlobalSE(CollTable::iterator const& col, aod::FT0s const&, TrksTable const& tracks, aod::BCsWithTimestamps const&) { if (!isEventSelected(col)) { return; } if (col.has_foundFT0()) { - fillYield(tracks); + auto bc = col.bc_as(); + loadEffCorrection(bc.timestamp()); + loadMultCorrection(bc.timestamp()); + fillYieldTpc(tracks); const auto& ft0 = col.foundFT0(); - if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { + auto multiplicity = col.multiplicity(); + float multw = getMultEffCorr(multiplicity); + if (isUseEffCorr) + multiplicity = multiplicity * multw; + if (multiplicity < cfgMinMult || multiplicity >= cfgMaxMult) { return; } - fillCorrFt0aGlobal(sameFt0aGlobal, tracks, ft0, false, col.posZ()); + fillCorrFt0aGlobal(sameFt0aGlobal, tracks, ft0, false, col.posZ(), multiplicity); } } // same event - void processFt0cGlobalSE(CollTable::iterator const& col, aod::FT0s const&, TrksTable const& tracks) + void processFt0cGlobalSE(CollTable::iterator const& col, aod::FT0s const&, TrksTable const& tracks, aod::BCsWithTimestamps const&) { if (!isEventSelected(col)) { return; } if (col.has_foundFT0()) { - fillYield(tracks); + auto bc = col.bc_as(); + loadEffCorrection(bc.timestamp()); + loadMultCorrection(bc.timestamp()); + fillYieldTpc(tracks); const auto& ft0 = col.foundFT0(); - if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { + auto multiplicity = col.multiplicity(); + float multw = getMultEffCorr(multiplicity); + if (isUseEffCorr) + multiplicity = multiplicity * multw; + if (multiplicity < cfgMinMult || multiplicity >= cfgMaxMult) { return; } - fillCorrFt0cGlobal(sameFt0cGlobal, tracks, ft0, false, col.posZ()); + fillCorrFt0cGlobal(sameFt0cGlobal, tracks, ft0, false, col.posZ(), multiplicity); } } // same event - void processMftGlobalSE(CollTable::iterator const& col, MftTrkTable const& mfttracks, TrksTable const& tracks) + void processMftGlobalSE(CollTable::iterator const& col, MftTrkTable const& mfttracks, TrksTable const& tracks, aod::BCsWithTimestamps const&) { if (!isEventSelected(col)) { return; } - fillYield(tracks); - if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { + auto bc = col.bc_as(); + loadEffCorrection(bc.timestamp()); + loadMultCorrection(bc.timestamp()); + fillYieldTpc(tracks); + auto multiplicity = col.multiplicity(); + float multw = getMultEffCorr(multiplicity); + if (isUseEffCorr) + multiplicity = multiplicity * multw; + if (multiplicity < cfgMinMult || multiplicity >= cfgMaxMult) { return; } - fillCorrMftGlobal(sameMftGlobal, tracks, mfttracks, false, col.posZ()); + fillCorrMftGlobal(sameMftGlobal, tracks, mfttracks, false, col.posZ(), multiplicity); } // same event - void processFt0aMftSE(CollTable::iterator const& col, aod::FT0s const&, TrksTable const& tracks, MftTrkTable const& mfttracks) + void processFt0aMftSE(CollTable::iterator const& col, aod::FT0s const&, MftTrkTable const& mfttracks, aod::BCsWithTimestamps const&) { if (!isEventSelected(col)) { return; } if (col.has_foundFT0()) { - fillYield(mfttracks); + fillYieldMft(mfttracks); + auto bc = col.bc_as(); + loadMultCorrection(bc.timestamp()); const auto& ft0 = col.foundFT0(); - if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { + auto multiplicity = col.multiplicity(); + float multw = getMultEffCorr(multiplicity); + if (isUseEffCorr) + multiplicity = multiplicity * multw; + if (multiplicity < cfgMinMult || multiplicity >= cfgMaxMult) { return; } - fillCorrFt0aMft(sameFt0aMft, tracks, mfttracks, ft0, false, col.posZ()); + fillCorrFt0aMft(sameFt0aMft, mfttracks, ft0, false, col.posZ(), multiplicity); } } // same event - void processFt0aFt0cSE(CollTable::iterator const& col, aod::FT0s const&, TrksTable const& tracks) + void processFt0aFt0cSE(CollTable::iterator const& col, aod::FT0s const&, aod::BCsWithTimestamps const&) { if (!isEventSelected(col)) { return; } if (col.has_foundFT0()) { - histos.fill(HIST("Ft0aFt0c/SE/hMult"), tracks.size()); + auto bc = col.bc_as(); + loadMultCorrection(bc.timestamp()); + auto multiplicity = col.multiplicity(); + histos.fill(HIST("Ft0aFt0c/SE/hMult"), multiplicity); const auto& ft0 = col.foundFT0(); - if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { + float multw = getMultEffCorr(multiplicity); + if (isUseEffCorr) + multiplicity = multiplicity * multw; + if (multiplicity < cfgMinMult || multiplicity >= cfgMaxMult) { return; } - fillCorrFt0aFt0c(sameFt0aFt0c, tracks, ft0, ft0, false, col.posZ()); + fillCorrFt0aFt0c(sameFt0aFt0c, ft0, ft0, false, col.posZ(), multiplicity); } } // same event - void processFt0aGlobalME(CollTable const& col, aod::FT0s const&, TrksTable const& tracks) + void processFt0aGlobalME(CollTable const& col, aod::FT0s const&, TrksTable const& tracks, aod::BCsWithTimestamps const&) { auto getTracksSize = [&tracks, this](CollTable::iterator const& collision) { auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), this->cache); @@ -662,18 +896,25 @@ struct LongrangeCorrelation { continue; } if (col1.has_foundFT0() && col2.has_foundFT0()) { + auto bc = col1.bc_as(); + loadEffCorrection(bc.timestamp()); + loadMultCorrection(bc.timestamp()); auto slicedTriggerTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); - fillYield(slicedTriggerTracks); + fillYieldTpc(slicedTriggerTracks); const auto& ft0 = col2.foundFT0(); - if (slicedTriggerTracks.size() < cfgMinMult || slicedTriggerTracks.size() >= cfgMaxMult) { + auto multiplicity = col1.multiplicity(); + float multw = getMultEffCorr(multiplicity); + if (isUseEffCorr) + multiplicity = multiplicity * multw; + if (multiplicity < cfgMinMult || multiplicity >= cfgMaxMult) { continue; } - fillCorrFt0aGlobal(mixedFt0aGlobal, slicedTriggerTracks, ft0, true, col1.posZ()); + fillCorrFt0aGlobal(mixedFt0aGlobal, slicedTriggerTracks, ft0, true, col1.posZ(), multiplicity); } } } // mixed event - void processFt0cGlobalME(CollTable const& col, aod::FT0s const&, TrksTable const& tracks) + void processFt0cGlobalME(CollTable const& col, aod::FT0s const&, TrksTable const& tracks, aod::BCsWithTimestamps const&) { auto getTracksSize = [&tracks, this](CollTable::iterator const& collision) { auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), this->cache); @@ -690,18 +931,25 @@ struct LongrangeCorrelation { continue; } if (col1.has_foundFT0() && col2.has_foundFT0()) { + auto bc = col1.bc_as(); + loadEffCorrection(bc.timestamp()); + loadMultCorrection(bc.timestamp()); auto slicedTriggerTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); - fillYield(slicedTriggerTracks); + fillYieldTpc(slicedTriggerTracks); const auto& ft0 = col2.foundFT0(); - if (slicedTriggerTracks.size() < cfgMinMult || slicedTriggerTracks.size() >= cfgMaxMult) { + auto multiplicity = col1.multiplicity(); + float multw = getMultEffCorr(multiplicity); + if (isUseEffCorr) + multiplicity = multiplicity * multw; + if (multiplicity < cfgMinMult || multiplicity >= cfgMaxMult) { continue; } - fillCorrFt0cGlobal(mixedFt0cGlobal, slicedTriggerTracks, ft0, true, col1.posZ()); + fillCorrFt0cGlobal(mixedFt0cGlobal, slicedTriggerTracks, ft0, true, col1.posZ(), multiplicity); } } } // mixed event - void processMftGlobalME(CollTable const& col, MftTrkTable const& mfttracks, TrksTable const& tracks) + void processMftGlobalME(CollTable const& col, MftTrkTable const& mfttracks, TrksTable const& tracks, aod::BCsWithTimestamps const&) { auto getTracksSize = [&tracks, this](CollTable::iterator const& collision) { auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), this->cache); @@ -716,14 +964,21 @@ struct LongrangeCorrelation { if (!isEventSelected(col1) || !isEventSelected(col2)) { continue; } - if ((tracks1.size() < cfgMinMult || tracks1.size() >= cfgMaxMult)) { + auto bc = col1.bc_as(); + loadEffCorrection(bc.timestamp()); + loadMultCorrection(bc.timestamp()); + auto multiplicity = col1.multiplicity(); + float multw = getMultEffCorr(multiplicity); + if (isUseEffCorr) + multiplicity = multiplicity * multw; + if (multiplicity < cfgMinMult || multiplicity >= cfgMaxMult) { continue; } - fillCorrMftGlobal(mixedMftGlobal, tracks1, tracks2, true, col1.posZ()); + fillCorrMftGlobal(mixedMftGlobal, tracks1, tracks2, true, col1.posZ(), multiplicity); } } // mixed event - void processFt0aMftME(CollTable const& col, aod::FT0s const&, TrksTable const& tracks, MftTrkTable const& mfttracks) + void processFt0aMftME(CollTable const& col, aod::FT0s const&, TrksTable const& tracks, MftTrkTable const& mfttracks, aod::BCsWithTimestamps const&) { auto getTracksSize = [&tracks, this](CollTable::iterator const& collision) { auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), this->cache); @@ -740,19 +995,24 @@ struct LongrangeCorrelation { continue; } if (col1.has_foundFT0() && col2.has_foundFT0()) { - auto slicedGlobalTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); + auto bc = col1.bc_as(); + loadMultCorrection(bc.timestamp()); auto slicedTriggerMftTracks = mfttracks.sliceBy(perColMft, col1.globalIndex()); - fillYield(slicedTriggerMftTracks); + fillYieldMft(slicedTriggerMftTracks); const auto& ft0 = col2.foundFT0(); - if (slicedGlobalTracks.size() < cfgMinMult || slicedGlobalTracks.size() >= cfgMaxMult) { + auto multiplicity = col1.multiplicity(); + float multw = getMultEffCorr(multiplicity); + if (isUseEffCorr) + multiplicity = multiplicity * multw; + if (multiplicity < cfgMinMult || multiplicity >= cfgMaxMult) { continue; } - fillCorrFt0aMft(mixedFt0aMft, slicedGlobalTracks, slicedTriggerMftTracks, ft0, true, col1.posZ()); + fillCorrFt0aMft(mixedFt0aMft, slicedTriggerMftTracks, ft0, true, col1.posZ(), multiplicity); } } } // mixed event - void processFt0aFt0cME(CollTable const& col, aod::FT0s const&, TrksTable const& tracks) + void processFt0aFt0cME(CollTable const& col, aod::FT0s const&, TrksTable const& tracks, aod::BCsWithTimestamps const&) { auto getTracksSize = [&tracks, this](CollTable::iterator const& collision) { auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), this->cache); @@ -769,18 +1029,91 @@ struct LongrangeCorrelation { continue; } if (col1.has_foundFT0() && col2.has_foundFT0()) { - auto slicedTriggerTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); - histos.fill(HIST("Ft0aFt0c/ME/hMult"), slicedTriggerTracks.size()); + auto bc = col1.bc_as(); + loadMultCorrection(bc.timestamp()); + auto multiplicity = col1.multiplicity(); + histos.fill(HIST("Ft0aFt0c/ME/hMult"), multiplicity); const auto& ft0a = col1.foundFT0(); const auto& ft0c = col2.foundFT0(); - if (slicedTriggerTracks.size() < cfgMinMult || slicedTriggerTracks.size() >= cfgMaxMult) { + float multw = getMultEffCorr(multiplicity); + if (isUseEffCorr) + multiplicity = multiplicity * multw; + if (multiplicity < cfgMinMult || multiplicity >= cfgMaxMult) { continue; } - fillCorrFt0aFt0c(mixedFt0aFt0c, slicedTriggerTracks, ft0a, ft0c, true, col1.posZ()); + fillCorrFt0aFt0c(mixedFt0aFt0c, ft0a, ft0c, true, col1.posZ(), multiplicity); } } } // mixed event + template + bool isGenTrackSelected(CheckGenTrack const& track) + { + if (!track.isPhysicalPrimary()) { + return false; + } + if (!track.producedByGenerator()) { + return false; + } + auto pdgTrack = pdg->GetParticle(track.pdgCode()); + if (pdgTrack == nullptr) { + return false; + } + if (std::abs(pdgTrack->Charge()) < kMinCharge) { + return false; + } + if (std::abs(track.eta()) >= cfgEtaCut) { + return false; + } + return true; + } + + void processEff(aod::McCollisions::iterator const& mcCollision, CollTableMC const& RecCols, aod::McParticles const& GenParticles, TrksTableMC const& RecTracks) + { + if (std::abs(mcCollision.posZ()) >= cfgVtxCut) { + return; + } + + auto multiplicity = -999.; + auto numcontributors = -999; + for (const auto& RecCol : RecCols) { + if (!isEventSelected(RecCol)) { + continue; + } + if (RecCol.numContrib() <= numcontributors) { + continue; + } else { + numcontributors = RecCol.numContrib(); + } + multiplicity = RecCol.multiplicity(); + } + + for (const auto& particle : GenParticles) { + if (!isGenTrackSelected(particle)) { + continue; + } + histos.fill(HIST("hmcgendndptPrimary"), particle.eta(), particle.pt(), multiplicity, mcCollision.posZ()); + } // track (mcgen) loop + + for (const auto& RecCol : RecCols) { + if (!isEventSelected(RecCol)) { + continue; + } + auto recTracksPart = RecTracks.sliceBy(perColMC, RecCol.globalIndex()); + for (const auto& Rectrack : recTracksPart) { + if (Rectrack.has_mcParticle()) { + auto mcpart = Rectrack.mcParticle(); + histos.fill(HIST("hmcrecdndptRecoAll"), mcpart.eta(), mcpart.pt(), multiplicity, mcCollision.posZ()); + if (mcpart.isPhysicalPrimary()) { + histos.fill(HIST("hmcrecdndptRecoPrimary"), mcpart.eta(), mcpart.pt(), multiplicity, mcCollision.posZ()); + } + } else { + histos.fill(HIST("hmcrecdndptFake"), Rectrack.eta(), Rectrack.pt(), multiplicity, mcCollision.posZ()); + } + } // track (mcrec) loop + } // rec collision + } + PROCESS_SWITCH(LongrangeCorrelation, processEventStat, "event stat", false); PROCESS_SWITCH(LongrangeCorrelation, processFt0aGlobalSE, "same event FT0a vs global", false); PROCESS_SWITCH(LongrangeCorrelation, processFt0aGlobalME, "mixed event FT0a vs global", false); @@ -792,9 +1125,92 @@ struct LongrangeCorrelation { PROCESS_SWITCH(LongrangeCorrelation, processFt0aMftME, "mixed event FT0a vs MFT", false); PROCESS_SWITCH(LongrangeCorrelation, processFt0aFt0cSE, "same event FT0a vs FT0c", false); PROCESS_SWITCH(LongrangeCorrelation, processFt0aFt0cME, "mixed event FT0a vs FT0c", false); + PROCESS_SWITCH(LongrangeCorrelation, processEff, "Estimate efficiency", false); +}; + +struct MultiplicityClassifier { + Produces multvalue; + Configurable cfgEtaCut{"cfgEtaCut", 0.8f, "Eta range to consider"}; + Configurable dcaZ{"dcaZ", 0.2f, "Custom DCA Z cut (ignored if negative)"}; + Configurable cfgPtCutMin{"cfgPtCutMin", 0.2f, "minimum accepted track pT"}; + Configurable cfgPtCutMax{"cfgPtCutMax", 3.0f, "maximum accepted track pT"}; + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + Filter fTrackSelectionITS = ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) && + ncheckbit(aod::track::trackCutFlag, TrackSelectionIts); + Filter fTrackSelectionTPC = ifnode(ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC), + ncheckbit(aod::track::trackCutFlag, TrackSelectionTpc), true); + Filter fTrackSelectionDCA = ifnode(dcaZ.node() > 0.f, nabs(aod::track::dcaZ) <= dcaZ && ncheckbit(aod::track::trackCutFlag, TrackSelectionDcaxyOnly), + ncheckbit(aod::track::trackCutFlag, TrackSelectionDca)); + Filter fTracksEta = nabs(aod::track::eta) < cfgEtaCut; + Filter fTracksPt = (aod::track::pt > cfgPtCutMin) && (aod::track::pt < cfgPtCutMax); + + void init(InitContext const&) + { + int enabledFunctions = 0; + if (doprocessTracks) { + histos.add("htrackPt", "htrackPt", {HistType::kTH1F, {{10, 0., 10.}}}); + histos.add("htrackMult", "htrackMult", {HistType::kTH1F, {{500, 0., 500.}}}); + enabledFunctions++; + } + if (doprocessFT0C) { + histos.add("hCentFt0c", "hCentFt0c", {HistType::kTH1F, {{100, 0., 100.}}}); + enabledFunctions++; + } + if (doprocessFV0A) { + histos.add("hCentFv0a", "hCentFv0a", {HistType::kTH1F, {{100, 0., 100.}}}); + enabledFunctions++; + } + if (doprocessFT0M) { + histos.add("hCentFt0m", "hCentFt0m", {HistType::kTH1F, {{100, 0., 100.}}}); + enabledFunctions++; + } + if (enabledFunctions != 1) { + LOGP(fatal, "{} multiplicity classifier enabled but we need exactly 1.", enabledFunctions); + } + } + + void processTracks(aod::Collision const&, soa::Filtered> const& tracks) + { + multvalue(tracks.size()); + histos.fill(HIST("htrackMult"), tracks.size()); + for (auto const& iTrk : tracks) + histos.fill(HIST("htrackPt"), iTrk.pt()); + } + + void processFT0C(aod::CentFT0Cs const& centralities) + { + for (auto const& c : centralities) { + multvalue(c.centFT0C()); + histos.fill(HIST("hCentFt0c"), c.centFT0C()); + } + } + + void processFV0A(aod::CentFV0As const& centralities) + { + for (auto const& c : centralities) { + multvalue(c.centFV0A()); + histos.fill(HIST("hCentFv0a"), c.centFV0A()); + } + } + + void processFT0M(aod::CentFT0Ms const& centralities) + { + for (auto const& c : centralities) { + multvalue(c.centFT0M()); + histos.fill(HIST("hCentFt0m"), c.centFT0M()); + } + } + + PROCESS_SWITCH(MultiplicityClassifier, processTracks, "Select track count as multiplicity", false); + PROCESS_SWITCH(MultiplicityClassifier, processFT0C, "Select FT0C centrality as multiplicity", false); + PROCESS_SWITCH(MultiplicityClassifier, processFV0A, "Select FV0A centrality as multiplicity", false); + PROCESS_SWITCH(MultiplicityClassifier, processFT0M, "Select FT0M centrality as multiplicity", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{adaptAnalysisTask(cfgc)}; + return WorkflowSpec{ + adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc)}; } From b4796057e30c7aeb31251fd9c49a052fccc81057 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Thu, 9 Oct 2025 11:45:42 +0200 Subject: [PATCH 673/986] [DPG] Update DPG K0s QC task (#13261) Co-authored-by: ALICE Action Bot --- .../AOTTrack/V0Cascades/perfK0sResolution.cxx | 758 +++++++++++------- 1 file changed, 474 insertions(+), 284 deletions(-) diff --git a/DPG/Tasks/AOTTrack/V0Cascades/perfK0sResolution.cxx b/DPG/Tasks/AOTTrack/V0Cascades/perfK0sResolution.cxx index 6d2c5d80df1..1ab36ad9f71 100644 --- a/DPG/Tasks/AOTTrack/V0Cascades/perfK0sResolution.cxx +++ b/DPG/Tasks/AOTTrack/V0Cascades/perfK0sResolution.cxx @@ -8,11 +8,21 @@ // 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 perfK0sResolution.cxx +/// \brief V0s (K0s, Lambda and antiLambda) analysis task +/// +/// \author Nicolò Jacazio , Universita del Piemonte Orientale +/// \author Roman Nepeivoda , Lund University +/// \author Romain Schotter , Austrian Academy of Sciences & MBI +// +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" #include "PWGLF/DataModel/LFStrangenessTables.h" #include "Common/Core/RecoDecay.h" #include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/PIDResponseTOF.h" #include "Common/DataModel/PIDResponseTPC.h" @@ -52,9 +62,17 @@ using namespace o2::track; using namespace o2::framework; using namespace o2::framework::expressions; -using PIDTracks = soa::Join; +using PIDTracksIU = soa::Join; using PIDTracksIUMC = soa::Join; -using SelectedCollisions = soa::Join; +using SelectedCollisions = soa::Join; + +enum CentEstimator { + kCentFT0C = 0, + kCentFT0M, + kCentFT0CVariant1, + kCentMFT, + kCentNGlobal +}; struct perfK0sResolution { // Configurable bins @@ -69,38 +87,89 @@ struct perfK0sResolution { ConfigurableAxis etaBinsDauthers{"etaBinsDauthers", {100, -1.f, 1.f}, "eta binning for daughters"}; ConfigurableAxis phiBins{"phiBins", {100, 0.f, 6.28f}, "phi binning"}; ConfigurableAxis relpTResBins{"relpTResBins", {200, 0.f, 0.5f}, "rel. pT resolution binning"}; - - // Selection criteria - Configurable v0setting_cospa{"v0setting_cospa", 0.995, "V0 CosPA"}; // shoudl be double in future - Configurable v0setting_dcav0dau{"v0setting_dcav0dau", 1., "DCA V0 Daughters"}; - Configurable v0setting_dcapostopv{"v0setting_dcapostopv", 0.1, "DCA Pos To PV"}; - Configurable v0setting_dcanegtopv{"v0setting_dcanegtopv", 0.1, "DCA Neg To PV"}; - Configurable v0setting_radius{"v0setting_radius", 0.9, "V0 Radius"}; - Configurable v0setting_rapidity{"v0setting_rapidity", 0.5, "rapidity"}; - - Configurable nV0lifetime{"nV0lifetime", 3., "n ctau"}; - Configurable nMaxTPCNsigma{"nMaxTPCNsigma", 10., "Maximum TPC nsigma for pions"}; - Configurable itsIbSelectionPos{"itsIbSelectionPos", 0, "Flag for the ITS IB selection on positive daughters: -1 no ITS IB, 0 no selection, 1 ITS IB"}; - Configurable itsIbSelectionNeg{"itsIbSelectionNeg", 0, "Flag for the ITS IB selection on negative daughters: -1 no ITS IB, 0 no selection, 1 ITS IB"}; - Configurable itsAfterburnerPos{"itsAfterburnerPos", 0, "Flag for the ITS afterburner tracks on positive daughters: -1 no AB, 0 no selection, 1 AB"}; - Configurable itsAfterburnerNeg{"itsAfterburnerNeg", 0, "Flag for the ITS afterburner tracks on negative daughters: -1 no AB, 0 no selection, 1 AB"}; - Configurable trdSelectionPos{"trdSelectionPos", 0, "Flag for the TRD selection on positive daughters: -1 no TRD, 0 no selection, 1 TRD"}; - Configurable trdSelectionNeg{"trdSelectionNeg", 0, "Flag for the TRD selection on negative daughters: -1 no TRD, 0 no selection, 1 TRD"}; - Configurable tofSelectionPos{"tofSelectionPos", 0, "Flag for the TOF selection on positive daughters: -1 no TOF, 0 no selection, 1 TOF"}; - Configurable tofSelectionNeg{"tofSelectionNeg", 0, "Flag for the TOF selection on negative daughters: -1 no TOF, 0 no selection, 1 TOF"}; - Configurable pidHypoPos{"pidHypoPos", -1, "Index for the PID hypothesis used in tracking for the positive daughters: -1 no selection, 0 Electron, 1 Muon, 2 Pion, 3 Kaon, 4 Proton"}; - Configurable pidHypoNeg{"pidHypoNeg", -1, "Index for the PID hypothesis used in tracking for the negative daughters: -1 no selection, 0 Electron, 1 Muon, 2 Pion, 3 Kaon, 4 Proton"}; - Configurable extraCutTPCClusters{"extraCutTPCClusters", -1.0f, "Extra cut on daugthers for TPC clusters"}; + ConfigurableAxis centralityAxis{"centralityAxis", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.0f, 101.f}, "Centrality"}; + ConfigurableAxis occupancyAxis{"occupancyAxis", {VARIABLE_WIDTH, -1.0f, 0.0f, 250.0f, 500.0f, 750.0f, 1000.0f, 1500.0f, 2000.0f, 3000.0f, 4500.0f, 6000.0f, 8000.0f, 10000.0f, 50000.0f}, "Occupancy"}; + + struct : ConfigurableGroup { + std::string prefix = "eventSelections"; // JSON group name + Configurable requireSel8{"requireSel8", true, "require sel8 event selection"}; + Configurable requireTriggerTVX{"requireTriggerTVX", true, "require FT0 vertex (acceptable FT0C-FT0A time difference) at trigger level"}; + Configurable rejectITSROFBorder{"rejectITSROFBorder", true, "reject events at ITS ROF border (Run 3 only)"}; + Configurable rejectTFBorder{"rejectTFBorder", true, "reject events at TF border (Run 3 only)"}; + Configurable requireIsVertexITSTPC{"requireIsVertexITSTPC", false, "require events with at least one ITS-TPC track (Run 3 only)"}; + Configurable requireIsGoodZvtxFT0VsPV{"requireIsGoodZvtxFT0VsPV", true, "require events with PV position along z consistent (within 1 cm) between PV reconstructed using tracks and PV using FT0 A-C time difference (Run 3 only)"}; + Configurable requireIsVertexTOFmatched{"requireIsVertexTOFmatched", false, "require events with at least one of vertex contributors matched to TOF (Run 3 only)"}; + Configurable requireIsVertexTRDmatched{"requireIsVertexTRDmatched", false, "require events with at least one of vertex contributors matched to TRD (Run 3 only)"}; + Configurable rejectSameBunchPileup{"rejectSameBunchPileup", true, "reject collisions in case of pileup with another collision in the same foundBC (Run 3 only)"}; + Configurable requireNoCollInTimeRangeStd{"requireNoCollInTimeRangeStd", false, "reject collisions corrupted by the cannibalism, with other collisions within +/- 2 microseconds or mult above a certain threshold in -4 - -2 microseconds (Run 3 only)"}; + Configurable requireNoCollInTimeRangeStrict{"requireNoCollInTimeRangeStrict", false, "reject collisions corrupted by the cannibalism, with other collisions within +/- 10 microseconds (Run 3 only)"}; + Configurable requireNoCollInTimeRangeNarrow{"requireNoCollInTimeRangeNarrow", false, "reject collisions corrupted by the cannibalism, with other collisions within +/- 2 microseconds (Run 3 only)"}; + Configurable requireNoCollInROFStd{"requireNoCollInROFStd", false, "reject collisions corrupted by the cannibalism, with other collisions within the same ITS ROF with mult. above a certain threshold (Run 3 only)"}; + Configurable requireNoCollInROFStrict{"requireNoCollInROFStrict", false, "reject collisions corrupted by the cannibalism, with other collisions within the same ITS ROF (Run 3 only)"}; + Configurable requireINEL0{"requireINEL0", true, "require INEL>0 event selection"}; + Configurable requireINEL1{"requireINEL1", false, "require INEL>1 event selection"}; + + Configurable maxZVtxPosition{"maxZVtxPosition", 10., "max Z vtx position"}; + + Configurable centralityEstimator{"centralityEstimator", kCentFT0C, "Run 3 centrality estimator (0:CentFT0C, 1:CentFT0M, 2:CentFT0CVariant1, 3:CentMFT, 4:CentNGlobal)"}; + Configurable useFT0CbasedOccupancy{"useFT0CbasedOccupancy", false, "Use sum of FT0-C amplitudes for estimating occupancy? (if not, use track-based definition)"}; + // fast check on occupancy + Configurable minOccupancy{"minOccupancy", -1, "minimum occupancy from neighbouring collisions"}; + Configurable maxOccupancy{"maxOccupancy", -1, "maximum occupancy from neighbouring collisions"}; + } eventSelections; + + static constexpr float DefaultLifetimeCuts[1][2] = {{30., 20.}}; + + struct : ConfigurableGroup { + std::string prefix = "v0Selections"; // JSON group name + Configurable v0TypeSelection{"v0TypeSelection", 1, "select on a certain V0 type (leave negative if no selection desired)"}; + + // Selection criteria: acceptance + Configurable rapidityCut{"rapidityCut", 0.5, "rapidity"}; + Configurable daughterEtaCut{"daughterEtaCut", 0.8, "max eta for daughters"}; + + // Standard 5 topological criteria + Configurable v0cospa{"v0cospa", 0.995, "min V0 CosPA"}; + Configurable dcav0dau{"dcav0dau", 1.0, "max DCA V0 Daughters (cm)"}; + Configurable dcanegtopv{"dcanegtopv", 0.1, "min DCA Neg To PV (cm)"}; + Configurable dcapostopv{"dcapostopv", 0.1, "min DCA Pos To PV (cm)"}; + Configurable v0radius{"v0radius", 1.2, "minimum V0 radius (cm)"}; + Configurable v0radiusMax{"v0radiusMax", 1E5, "maximum V0 radius (cm)"}; + Configurable> lifetimecut{"lifetimecut", {DefaultLifetimeCuts[0], 2, {"lifetimecutLambda", "lifetimecutK0S"}}, "lifetimecut"}; + + // Additional selection on the AP plot (exclusive for K0Short) + // original equation: lArmPt*5>TMath::Abs(lArmAlpha) + Configurable armPodCut{"armPodCut", 5.0f, "pT * (cut) > |alpha|, AP cut. Negative: no cut"}; + + // Track quality + Configurable minTPCrows{"minTPCrows", 70, "minimum TPC crossed rows"}; + Configurable minITSclusters{"minITSclusters", -1, "minimum ITS clusters"}; + Configurable minTPCrowsOverFindableClusters{"minTPCrowsOverFindableClusters", -1, "minimum nbr of TPC crossed rows over findable clusters"}; + Configurable minTPCfoundOverFindableClusters{"minTPCfoundOverFindableClusters", -1, "minimum nbr of found over findable TPC clusters"}; + Configurable maxFractionTPCSharedClusters{"maxFractionTPCSharedClusters", 1e+09, "maximum fraction of TPC shared clusters"}; + Configurable maxITSchi2PerNcls{"maxITSchi2PerNcls", 1e+09, "maximum ITS chi2 per clusters"}; + Configurable maxTPCchi2PerNcls{"maxTPCchi2PerNcls", 1e+09, "maximum TPC chi2 per clusters"}; + Configurable requirePosITSib{"requirePosITSib", 0, "require ITS IB selection on positive daughters? -1: no ITS IB, 0: no selection, 1: ITS IB"}; + Configurable requireNegITSib{"requireNegITSib", 0, "require ITS IB selection on negative daughters? -1: no ITS IB, 0: no selection, 1: ITS IB"}; + Configurable requirePosITSafterburner{"requirePosITSafterburner", 0, "require positive track formed out of afterburner ITS tracks? -1: no AB, 0: no selection, 1: AB"}; + Configurable requireNegITSafterburner{"requireNegITSafterburner", 0, "require negative track formed out of afterburner ITS tracks? -1: no AB, 0: no selection, 1: AB"}; + Configurable requirePosTRD{"requirePosTRD", 0, "require TRD selection on positive daughters? -1: no TRD, 0: no selection, 1: TRD"}; + Configurable requireNegTRD{"requireNegTRD", 0, "require TRD selection on negative daughters? -1: no TRD, 0: no selection, 1: TRD"}; + Configurable requirePosTOF{"requirePosTOF", 0, "require TOF selection on positive daughters? -1: no TOF, 0: no selection, 1: TOF"}; + Configurable requireNegTOF{"requireNegTOF", 0, "require TOF selection on negative daughters? -1: no TOF, 0: no selection, 1: TOF"}; + Configurable requirePosPIDforTracking{"requirePosPIDforTracking", -1, "require specific PID hypothesis used in tracking for the positive daughters? -1: no selection, 0: Electron, 1: Muon, 2: Pion, 3: Kaon, 4: Proton"}; + Configurable requireNegPIDforTracking{"requireNegPIDforTracking", -1, "require specific PID hypothesis used in tracking for the negative daughters? -1: no selection, 0: Electron, 1: Muon, 2: Pion, 3: Kaon, 4: Proton"}; + + // PID (TPC/TOF) + Configurable tpcPidNsigmaCut{"tpcPidNsigmaCut", 10., "tpcPidNsigmaCut"}; + Configurable tofPidNsigmaCut{"tofPidNsigmaCut", 1e+6, "tofPidNsigmaCut"}; + } v0Selections; // Configure plots to enable Configurable useMultidimHisto{"useMultidimHisto", false, "use multidimentional histograms"}; Configurable enableTPCPlot{"enableTPCPlot", false, "Enable the TPC plot"}; - Configurable computeInvMassFromDaughters{"computeInvMassFromDaughters", false, "Compute the invariant mass from the daughters"}; - Configurable requireTrueK0s{"requireTrueK0s", false, "require rec. v0 to be true K0s"}; - - // Configurable for event selection - Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; - Configurable eventSelection{"eventSelection", true, "event selection"}; + Configurable requireTrueK0s{"requireTrueK0s", true, "require rec. v0 to be true K0s"}; + Configurable doTreatPiToMuon{"doTreatPiToMuon", false, "Take pi decay into muon into account in MC"}; HistogramRegistry rK0sResolution{"K0sResolution", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry rK0sDauResolution{"K0sDauResolution", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; @@ -116,11 +185,9 @@ struct perfK0sResolution { Configurable useTrackTuner{"useTrackTuner", false, "Apply Improver/DCA corrections to MC"}; Configurable trackTunerParams{"trackTunerParams", "debugInfo=0|updateTrackCovMat=0|updateCurvature=1|updatePulls=0|isInputFileFromCCDB=1|pathInputFile=Users/m/mfaggin/test/inputsTrackTuner/PbPb2022|nameInputFile=trackTuner_DataLHC22sPass5_McLHC22l1b2_run529397.root|usePvRefitCorrections=0|oneOverPtCurrent=1|oneOverPtUpgr=1.2", "TrackTuner parameter initialization (format: =|=)"}; OutputObj trackTunedTracks{TH1D("trackTunedTracks", "", 4, 0.5, 4.5), OutputObjHandlingPolicy::AnalysisObject}; - Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; - Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable lutPath{"lutPath", "GLO/Param/MatLUTInner", "Path of the Lut parametrization"}; + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; - Configurable minOccupancyCut{"minOccupancyCut", 1, "Minimum occupancy cut. Enabled if min < max"}; - Configurable maxOccupancyCut{"maxOccupancyCut", -1, "Maximum occupancy cut. Enabled if min < max"}; int runNumber = -1; @@ -141,45 +208,71 @@ struct perfK0sResolution { const AxisSpec phiAxis{phiBins, "#phi"}; const AxisSpec trueK0Axis{2, -0.5, 1.5, "True K0"}; - rK0sResolution.add("h1_stats", "h1_stats", {HistType::kTH1F, {statAxis}}); + // Event Counters + rK0sResolution.add("hEventSelection", "hEventSelection", kTH1D, {{21, -0.5f, +20.5f}}); + rK0sResolution.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(1, "All collisions"); + rK0sResolution.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(2, "sel8 cut"); + rK0sResolution.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(3, "kIsTriggerTVX"); + rK0sResolution.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(4, "kNoITSROFrameBorder"); + rK0sResolution.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(5, "kNoTimeFrameBorder"); + rK0sResolution.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(6, "posZ cut"); + rK0sResolution.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(7, "kIsVertexITSTPC"); + rK0sResolution.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(8, "kIsGoodZvtxFT0vsPV"); + rK0sResolution.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(9, "kIsVertexTOFmatched"); + rK0sResolution.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(10, "kIsVertexTRDmatched"); + rK0sResolution.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(11, "kNoSameBunchPileup"); + rK0sResolution.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(12, "kNoCollInTimeRangeStd"); + rK0sResolution.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(13, "kNoCollInTimeRangeStrict"); + rK0sResolution.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(14, "kNoCollInTimeRangeNarrow"); + rK0sResolution.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(15, "kNoCollInRofStd"); + rK0sResolution.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(16, "kNoCollInRofStrict"); + rK0sResolution.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(17, "INEL>0"); + rK0sResolution.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(18, "INEL>1"); + rK0sResolution.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(19, "Below min occup."); + rK0sResolution.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(20, "Above max occup."); + + rK0sResolution.add("hEventCentrality", "hEventCentrality", kTH1D, {{101, 0.0f, 101.0f}}); + rK0sResolution.add("hEventOccupancy", "hEventOccupancy", kTH1D, {occupancyAxis}); + + rK0sResolution.add("h1_stats", "h1_stats", {HistType::kTH1D, {statAxis}}); TString hStatsLabels[5] = {"Selected Events", "All V0s", "Selected V0s", "Daughters have MC particles", "Daughters corr. rec."}; - for (Int_t n = 1; n <= rK0sResolution.get(HIST("h1_stats"))->GetNbinsX(); n++) { + for (int n = 1; n <= rK0sResolution.get(HIST("h1_stats"))->GetNbinsX(); n++) { rK0sResolution.get(HIST("h1_stats"))->GetXaxis()->SetBinLabel(n, hStatsLabels[n - 1]); } if (doprocessMC) { - rK0sDauResolution.add("h2_massPosPtRes", "h2_massPosPtRes", {HistType::kTH2F, {mAxis, pTResAxis}}); - rK0sDauResolution.add("h2_massNegPtRes", "h2_massNegPtRes", {HistType::kTH2F, {mAxis, pTResAxis}}); - - rK0sDauResolution.add("h2_genPtPosPtResNorm", "h2_genPtPosPtResNorm", {HistType::kTH2F, {pTResRelAxis, pTAxis}}); - rK0sDauResolution.add("h2_genPxPosPxResNorm", "h2_genPxPosPxResNorm", {HistType::kTH2F, {pTResRelAxis, pTAxis}}); - rK0sDauResolution.add("h2_genPyPosPyResNorm", "h2_genPyPosPyResNorm", {HistType::kTH2F, {pTResRelAxis, pTAxis}}); - rK0sDauResolution.add("h2_genPzPosPzResNorm", "h2_genPzPosPzResNorm", {HistType::kTH2F, {pTResRelAxis, pTAxis}}); - - rK0sDauResolution.add("h2_genPtNegPtResNorm", "h2_genPtNegPtResNorm", {HistType::kTH2F, {pTResRelAxis, pTAxis}}); - rK0sDauResolution.add("h2_genPxNegPxResNorm", "h2_genPxNegPxResNorm", {HistType::kTH2F, {pTResRelAxis, pTAxis}}); - rK0sDauResolution.add("h2_genPyNegPyResNorm", "h2_genPyNegPyResNorm", {HistType::kTH2F, {pTResRelAxis, pTAxis}}); - rK0sDauResolution.add("h2_genPzNegPzResNorm", "h2_genPzNegPzResNorm", {HistType::kTH2F, {pTResRelAxis, pTAxis}}); - - rK0sDauResolution.add("h2_genPtPosPtRes", "h2_genPtPosPtRes", {HistType::kTH2F, {pTResAxis, pTAxis}}); - rK0sDauResolution.add("h2_genPxPosPxRes", "h2_genPxPosPxRes", {HistType::kTH2F, {pTResAxis, pTAxis}}); - rK0sDauResolution.add("h2_genPyPosPyRes", "h2_genPyPosPyRes", {HistType::kTH2F, {pTResAxis, pTAxis}}); - rK0sDauResolution.add("h2_genPzPosPzRes", "h2_genPzPosPzRes", {HistType::kTH2F, {pTResAxis, pTAxis}}); - - rK0sDauResolution.add("h2_genPtNegPtRes", "h2_genPtNegPtRes", {HistType::kTH2F, {pTResAxis, pTAxis}}); - rK0sDauResolution.add("h2_genPxNegPxRes", "h2_genPxNegPxRes", {HistType::kTH2F, {pTResAxis, pTAxis}}); - rK0sDauResolution.add("h2_genPyNegPyRes", "h2_genPyNegPyRes", {HistType::kTH2F, {pTResAxis, pTAxis}}); - rK0sDauResolution.add("h2_genPzNegPzRes", "h2_genPzNegPzRes", {HistType::kTH2F, {pTResAxis, pTAxis}}); - - rK0sDauResolution.add("h2_genPtPosPulls", "h2_GenPtPosPulls", {HistType::kTH2F, {invpTResNormAxis, invpTAxis}}); - rK0sDauResolution.add("h2_genPtNegPulls", "h2_GenPtNegPulls", {HistType::kTH2F, {invpTResNormAxis, invpTAxis}}); - - rK0sDauResolution.add("h2_PosRelPtRes", "h2_PosRelPtRes", {HistType::kTH2F, {pTAxis, relpTResAxis}}); - rK0sDauResolution.add("h2_NegRelPtRes", "h2_NegRelPtRes", {HistType::kTH2F, {pTAxis, relpTResAxis}}); - } - rK0sResolution.add("h2_masspT", "h2_masspT", {HistType::kTH2F, {mAxis, pTAxis}}); - rK0sResolution.add("h2_masseta", "h2_masseta", {HistType::kTH2F, {mAxis, etaAxis}}); - rK0sResolution.add("h2_massphi", "h2_massphi", {HistType::kTH2F, {mAxis, phiAxis}}); + rK0sDauResolution.add("h2_massPosPtRes", "h2_massPosPtRes", {HistType::kTH2D, {mAxis, pTResAxis}}); + rK0sDauResolution.add("h2_massNegPtRes", "h2_massNegPtRes", {HistType::kTH2D, {mAxis, pTResAxis}}); + + rK0sDauResolution.add("h2_genPtPosPtResNorm", "h2_genPtPosPtResNorm", {HistType::kTH2D, {pTResRelAxis, pTAxis}}); + rK0sDauResolution.add("h2_genPxPosPxResNorm", "h2_genPxPosPxResNorm", {HistType::kTH2D, {pTResRelAxis, pTAxis}}); + rK0sDauResolution.add("h2_genPyPosPyResNorm", "h2_genPyPosPyResNorm", {HistType::kTH2D, {pTResRelAxis, pTAxis}}); + rK0sDauResolution.add("h2_genPzPosPzResNorm", "h2_genPzPosPzResNorm", {HistType::kTH2D, {pTResRelAxis, pTAxis}}); + + rK0sDauResolution.add("h2_genPtNegPtResNorm", "h2_genPtNegPtResNorm", {HistType::kTH2D, {pTResRelAxis, pTAxis}}); + rK0sDauResolution.add("h2_genPxNegPxResNorm", "h2_genPxNegPxResNorm", {HistType::kTH2D, {pTResRelAxis, pTAxis}}); + rK0sDauResolution.add("h2_genPyNegPyResNorm", "h2_genPyNegPyResNorm", {HistType::kTH2D, {pTResRelAxis, pTAxis}}); + rK0sDauResolution.add("h2_genPzNegPzResNorm", "h2_genPzNegPzResNorm", {HistType::kTH2D, {pTResRelAxis, pTAxis}}); + + rK0sDauResolution.add("h2_genPtPosPtRes", "h2_genPtPosPtRes", {HistType::kTH2D, {pTResAxis, pTAxis}}); + rK0sDauResolution.add("h2_genPxPosPxRes", "h2_genPxPosPxRes", {HistType::kTH2D, {pTResAxis, pTAxis}}); + rK0sDauResolution.add("h2_genPyPosPyRes", "h2_genPyPosPyRes", {HistType::kTH2D, {pTResAxis, pTAxis}}); + rK0sDauResolution.add("h2_genPzPosPzRes", "h2_genPzPosPzRes", {HistType::kTH2D, {pTResAxis, pTAxis}}); + + rK0sDauResolution.add("h2_genPtNegPtRes", "h2_genPtNegPtRes", {HistType::kTH2D, {pTResAxis, pTAxis}}); + rK0sDauResolution.add("h2_genPxNegPxRes", "h2_genPxNegPxRes", {HistType::kTH2D, {pTResAxis, pTAxis}}); + rK0sDauResolution.add("h2_genPyNegPyRes", "h2_genPyNegPyRes", {HistType::kTH2D, {pTResAxis, pTAxis}}); + rK0sDauResolution.add("h2_genPzNegPzRes", "h2_genPzNegPzRes", {HistType::kTH2D, {pTResAxis, pTAxis}}); + + rK0sDauResolution.add("h2_genPtPosPulls", "h2_GenPtPosPulls", {HistType::kTH2D, {invpTResNormAxis, invpTAxis}}); + rK0sDauResolution.add("h2_genPtNegPulls", "h2_GenPtNegPulls", {HistType::kTH2D, {invpTResNormAxis, invpTAxis}}); + + rK0sDauResolution.add("h2_PosRelPtRes", "h2_PosRelPtRes", {HistType::kTH2D, {pTAxis, relpTResAxis}}); + rK0sDauResolution.add("h2_NegRelPtRes", "h2_NegRelPtRes", {HistType::kTH2D, {pTAxis, relpTResAxis}}); + } + rK0sResolution.add("h2_masspT", "h2_masspT", {HistType::kTH2D, {mAxis, pTAxis}}); + rK0sResolution.add("h2_masseta", "h2_masseta", {HistType::kTH2D, {mAxis, etaAxis}}); + rK0sResolution.add("h2_massphi", "h2_massphi", {HistType::kTH2D, {mAxis, phiAxis}}); if (useMultidimHisto) { if (doprocessMC) { rK0sResolution.add("thn_mass", "thn_mass", kTHnSparseF, {mAxis, pTAxis, etaAxis, phiAxis, etaAxisPosD, etaAxisNegD, invpTResAxis, invpTResAxis, trueK0Axis}); @@ -187,14 +280,16 @@ struct perfK0sResolution { rK0sResolution.add("thn_mass", "thn_mass", kTHnSparseF, {mAxis, pTAxis, etaAxis, phiAxis, etaAxisPosD, etaAxisNegD}); } } + rK0sResolution.add("h3_centralitypTmass", "h3_centralitypTmass", kTH3D, {centralityAxis, pTAxis, mAxis}); + rK0sResolution.add("h3_occupancypTmass", "h3_occupancypTmass", kTH3D, {occupancyAxis, pTAxis, mAxis}); if (enableTPCPlot) { - rK0sDauResolution.add("h3_tpc_vs_pid_hypothesis", "h3_tpc_vs_pid_hypothesis", {HistType::kTH3F, {{200, -10.f, 10.f, "#it{p}/Z (GeV/#it{c})"}, {1000, 0, 1000.f, "dE/dx (a.u.)"}, {10, -0.5, 9.5f, "PID hypothesis"}}}); + rK0sDauResolution.add("h3_tpc_vs_pid_hypothesis", "h3_tpc_vs_pid_hypothesis", {HistType::kTH3D, {{200, -10.f, 10.f, "#it{p}/Z (GeV/#it{c})"}, {1000, 0, 1000.f, "dE/dx (a.u.)"}, {10, -0.5, 9.5f, "PID hypothesis"}}}); } /// TrackTuner initialization if (useTrackTuner) { - ccdb->setURL(ccdburl); + ccdb->setURL(ccdbUrl); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); ccdb->setFatalWhenNull(false); @@ -208,6 +303,10 @@ struct perfK0sResolution { trackTunedTracks->GetXaxis()->SetBinLabel(3, "untouched tracks due to negative detXY"); trackTunedTracks->GetXaxis()->SetBinLabel(4, "original detXY<0"); } + + // inspect histogram sizes, please + rK0sResolution.print(); + rK0sDauResolution.print(); } void initCCDB(aod::BCsWithTimestamps::iterator const& bc) @@ -225,250 +324,332 @@ struct perfK0sResolution { runNumber = bc.runNumber(); } + // ______________________________________________________ + // Return slicing output + template + float getCentralityRun3(TCollision const& collision) + { + if (eventSelections.centralityEstimator == kCentFT0C) + return collision.centFT0C(); + else if (eventSelections.centralityEstimator == kCentFT0M) + return collision.centFT0M(); + else if (eventSelections.centralityEstimator == kCentFT0CVariant1) + return collision.centFT0CVariant1(); + else if (eventSelections.centralityEstimator == kCentMFT) + return collision.centMFT(); + else if (eventSelections.centralityEstimator == kCentNGlobal) + return collision.centNGlobal(); + + return -1.f; + } + + template + bool isEventAccepted(TCollision collision, bool fillHists) + // check whether the collision passes our collision selections + { + if (fillHists) + rK0sResolution.fill(HIST("hEventSelection"), 0. /* all collisions */); + + if (eventSelections.requireSel8 && !collision.sel8()) { + return false; + } + if (fillHists) + rK0sResolution.fill(HIST("hEventSelection"), 1 /* sel8 collisions */); + + if (eventSelections.requireTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { + return false; + } + if (fillHists) + rK0sResolution.fill(HIST("hEventSelection"), 2 /* FT0 vertex (acceptable FT0C-FT0A time difference) collisions */); + + if (eventSelections.rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + return false; + } + if (fillHists) + rK0sResolution.fill(HIST("hEventSelection"), 3 /* Not at ITS ROF border */); + + if (eventSelections.rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + return false; + } + if (fillHists) + rK0sResolution.fill(HIST("hEventSelection"), 4 /* Not at TF border */); + + if (std::abs(collision.posZ()) > eventSelections.maxZVtxPosition) { + return false; + } + if (fillHists) + rK0sResolution.fill(HIST("hEventSelection"), 5 /* vertex-Z selected */); + + if (eventSelections.requireIsVertexITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + return false; + } + if (fillHists) + rK0sResolution.fill(HIST("hEventSelection"), 6 /* Contains at least one ITS-TPC track */); + + if (eventSelections.requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + return false; + } + if (fillHists) + rK0sResolution.fill(HIST("hEventSelection"), 7 /* PV position consistency check */); + + if (eventSelections.requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { + return false; + } + if (fillHists) + rK0sResolution.fill(HIST("hEventSelection"), 8 /* PV with at least one contributor matched with TOF */); + + if (eventSelections.requireIsVertexTRDmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { + return false; + } + if (fillHists) + rK0sResolution.fill(HIST("hEventSelection"), 9 /* PV with at least one contributor matched with TRD */); + + if (eventSelections.rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + return false; + } + if (fillHists) + rK0sResolution.fill(HIST("hEventSelection"), 10 /* Not at same bunch pile-up */); + + if (eventSelections.requireNoCollInTimeRangeStd && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return false; + } + if (fillHists) + rK0sResolution.fill(HIST("hEventSelection"), 11 /* No other collision within +/- 2 microseconds or mult above a certain threshold in -4 - -2 microseconds*/); + + if (eventSelections.requireNoCollInTimeRangeStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStrict)) { + return false; + } + if (fillHists) + rK0sResolution.fill(HIST("hEventSelection"), 12 /* No other collision within +/- 10 microseconds */); + + if (eventSelections.requireNoCollInTimeRangeNarrow && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) { + return false; + } + if (fillHists) + rK0sResolution.fill(HIST("hEventSelection"), 13 /* No other collision within +/- 2 microseconds */); + + if (eventSelections.requireNoCollInROFStd && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { + return false; + } + if (fillHists) + rK0sResolution.fill(HIST("hEventSelection"), 14 /* No other collision within the same ITS ROF with mult. above a certain threshold */); + + if (eventSelections.requireNoCollInROFStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStrict)) { + return false; + } + if (fillHists) + rK0sResolution.fill(HIST("hEventSelection"), 15 /* No other collision within the same ITS ROF */); + + if (eventSelections.requireINEL0 && collision.multNTracksPVeta1() < 1) { + return false; + } + if (fillHists) + rK0sResolution.fill(HIST("hEventSelection"), 16 /* INEL > 0 */); + + if (eventSelections.requireINEL1 && collision.multNTracksPVeta1() < 2) { + return false; + } + if (fillHists) + rK0sResolution.fill(HIST("hEventSelection"), 17 /* INEL > 1 */); + + float collisionOccupancy = eventSelections.useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); + if (eventSelections.minOccupancy >= 0 && collisionOccupancy < eventSelections.minOccupancy) { + return false; + } + if (fillHists) + rK0sResolution.fill(HIST("hEventSelection"), 18 /* Below min occupancy */); + + if (eventSelections.maxOccupancy >= 0 && collisionOccupancy > eventSelections.maxOccupancy) { + return false; + } + if (fillHists) + rK0sResolution.fill(HIST("hEventSelection"), 19 /* Above max occupancy */); + + return true; + } + template bool acceptV0(const T1& v0, const T2& ntrack, const T2& ptrack, const C& collision) { // Apply selections on V0 - if (TMath::Abs(v0.yK0Short()) > v0setting_rapidity) { + if (std::abs(v0.yK0Short()) > v0Selections.rapidityCut) { return false; } - if (v0.v0radius() < v0setting_radius) { + + if (std::abs(v0.negativeeta()) > v0Selections.daughterEtaCut || std::abs(v0.positiveeta()) > v0Selections.daughterEtaCut) + return false; + + if (v0Selections.v0TypeSelection > -1 && v0.v0Type() != v0Selections.v0TypeSelection) + return false; // skip V0s that are not standard + + // Base topological variables + if (v0.v0radius() < v0Selections.v0radius) + return false; + if (v0.v0radius() > v0Selections.v0radiusMax) + return false; + if (std::abs(v0.dcapostopv()) < v0Selections.dcapostopv) + return false; + if (std::abs(v0.dcanegtopv()) < v0Selections.dcanegtopv) + return false; + if (v0.v0cosPA() < v0Selections.v0cospa) + return false; + if (v0.dcaV0daughters() > v0Selections.dcav0dau) + return false; + + if (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short > v0Selections.lifetimecut->get("lifetimecutK0S")) { return false; } - if (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * pid_constants::sMasses[PID::K0] > 2.684 * nV0lifetime) { + + if (v0Selections.armPodCut > 1e-4 && v0.qtarm() * v0Selections.armPodCut < std::abs(v0.alpha())) { return false; } // Apply selections on V0 daughters - // ITS selection - switch (itsIbSelectionPos) { - case -1: - if (ptrack.itsNClsInnerBarrel() > 0) { - return false; - } - break; - case 0: - break; - case 1: - if (ptrack.itsNClsInnerBarrel() < 1) { - return false; - } - break; - default: - LOG(fatal) << "Invalid ITS selection for positive daughter"; - break; - } - switch (itsIbSelectionNeg) { - case -1: - if (ntrack.itsNClsInnerBarrel() > 0) { - return false; - } - break; - case 0: - break; - case 1: - if (ntrack.itsNClsInnerBarrel() < 1) { - return false; - } - break; - default: - LOG(fatal) << "Invalid ITS selection for negative daughter"; - break; - } - switch (itsAfterburnerPos) { - case -1: - if (ptrack.itsChi2NCl() >= 0) { - return false; - } - break; - case 0: - break; - case 1: - if (ptrack.itsChi2NCl() < 0) { - return false; - } - break; - default: - LOG(fatal) << "Invalid AB selection for positive daughter"; - break; - } - switch (itsAfterburnerNeg) { - case -1: - if (ntrack.itsChi2NCl() >= 0) { - return false; - } - break; - case 0: - break; - case 1: - if (ntrack.itsChi2NCl() < 0) { - return false; - } - break; - default: - LOG(fatal) << "Invalid AB selection for negative daughter"; - break; + // ITS quality flags + // check minium ITS clusters + if (ptrack.itsNCls() < v0Selections.minITSclusters) + return false; + if (ntrack.itsNCls() < v0Selections.minITSclusters) + return false; + // check maximum ITS chi2 per clusters + if (ptrack.itsChi2NCl() > v0Selections.maxITSchi2PerNcls) + return false; + if (ntrack.itsChi2NCl() > v0Selections.maxITSchi2PerNcls) + return false; + + // TPC quality flags + // check minimum TPC crossed rows + if (ptrack.tpcNClsCrossedRows() < v0Selections.minTPCrows) + return false; + if (ntrack.tpcNClsCrossedRows() < v0Selections.minTPCrows) + return false; + // check maximum TPC chi2 per clusters + if (ptrack.tpcChi2NCl() > v0Selections.maxTPCchi2PerNcls) + return false; + if (ntrack.tpcChi2NCl() > v0Selections.maxTPCchi2PerNcls) + return false; + // check minimum fraction of TPC rows over findable + if (ptrack.tpcCrossedRowsOverFindableCls() < v0Selections.minTPCrowsOverFindableClusters) + return false; + if (ntrack.tpcCrossedRowsOverFindableCls() < v0Selections.minTPCrowsOverFindableClusters) + return false; + // check minimum fraction of found over findable TPC clusters + if (ptrack.tpcFoundOverFindableCls() < v0Selections.minTPCfoundOverFindableClusters) + return false; + if (ntrack.tpcFoundOverFindableCls() < v0Selections.minTPCfoundOverFindableClusters) + return false; + // check the maximum fraction of allowed shared TPC clusters + if (ptrack.tpcChi2NCl() > v0Selections.maxFractionTPCSharedClusters) + return false; + if (ntrack.tpcChi2NCl() > v0Selections.maxFractionTPCSharedClusters) + return false; + + // ITS Inner Barrel selection + if (std::abs(v0Selections.requirePosITSib) > 0) { + if (v0Selections.requirePosITSib < 0 && ptrack.itsNClsInnerBarrel() > 0) // require no ITS IB + return false; + if (v0Selections.requirePosITSib > 0 && ptrack.itsNClsInnerBarrel() < 1) // require ITS IB + return false; + } + if (std::abs(v0Selections.requireNegITSib) > 0) { + if (v0Selections.requireNegITSib < 0 && ntrack.itsNClsInnerBarrel() > 0) // require no ITS IB + return false; + if (v0Selections.requireNegITSib > 0 && ntrack.itsNClsInnerBarrel() < 1) // require ITS IB + return false; } - // TPC selection - if (!ntrack.hasTPC() || !ptrack.hasTPC()) { + // ITS AfterBurner selection + if (std::abs(v0Selections.requirePosITSafterburner) > 0) { + if (v0Selections.requirePosITSafterburner < 0 && ptrack.isITSAfterburner()) // require no ITS AB + return false; + if (v0Selections.requirePosITSafterburner > 0 && !ptrack.isITSAfterburner()) // require ITS AB + return false; + } + if (std::abs(v0Selections.requireNegITSafterburner) > 0) { + if (v0Selections.requireNegITSafterburner < 0 && ntrack.isITSAfterburner()) // require no ITS AB + return false; + if (v0Selections.requireNegITSafterburner > 0 && !ntrack.isITSAfterburner()) // require ITS AB + return false; + } + + // TPC PID selection + if (std::abs(ptrack.tpcNSigmaPi()) > v0Selections.tpcPidNsigmaCut) { return false; } - if (std::abs(ntrack.tpcNSigmaPi()) > nMaxTPCNsigma) { + if (std::abs(ntrack.tpcNSigmaPi()) > v0Selections.tpcPidNsigmaCut) { return false; } - if (std::abs(ptrack.tpcNSigmaPi()) > nMaxTPCNsigma) { + + // TOF PID selection + if (ptrack.hasTOF() && std::fabs(v0.tofNSigmaK0PiPlus()) > v0Selections.tofPidNsigmaCut) { return false; } - if (ntrack.tpcNClsCrossedRows() < extraCutTPCClusters || ptrack.tpcNClsCrossedRows() < extraCutTPCClusters) { + if (ntrack.hasTOF() && std::fabs(v0.tofNSigmaK0PiMinus()) > v0Selections.tofPidNsigmaCut) { return false; } // TOF selection - switch (tofSelectionPos) { - case -1: - if (ptrack.hasTOF()) { - return false; - } - break; - case 0: - break; - case 1: - if (!ptrack.hasTOF()) { - return false; - } - break; - default: - LOG(fatal) << "Invalid TOF selection for positive daughter"; - break; - } - switch (tofSelectionNeg) { - case -1: - if (ntrack.hasTOF()) { - return false; - } - break; - case 0: - break; - case 1: - if (!ntrack.hasTOF()) { - return false; - } - break; - default: - LOG(fatal) << "Invalid TOF selection for negative daughter"; - break; + if (std::abs(v0Selections.requirePosTOF) > 0) { + if (v0Selections.requirePosTOF < 0 && ptrack.hasTOF()) // require no TOF + return false; + if (v0Selections.requirePosTOF > 0 && !ptrack.hasTOF()) // require TOF + return false; + } + if (std::abs(v0Selections.requireNegTOF) > 0) { + if (v0Selections.requireNegTOF < 0 && ntrack.hasTOF()) // require no TOF + return false; + if (v0Selections.requireNegTOF > 0 && !ntrack.hasTOF()) // require TOF + return false; } // TRD selection - switch (trdSelectionPos) { - case -1: - if (ptrack.hasTRD()) { - return false; - } - break; - case 0: - break; - case 1: - if (!ptrack.hasTRD()) { - return false; - } - break; - default: - LOG(fatal) << "Invalid TRD selection for positive daughter"; - break; - } - switch (trdSelectionNeg) { - case -1: - if (ntrack.hasTRD()) { - return false; - } - break; - case 0: - break; - case 1: - if (!ntrack.hasTRD()) { - return false; - } - break; - default: - LOG(fatal) << "Invalid TRD selection for negative daughter"; - break; - } - - // PID hypothesis selection - switch (pidHypoPos) { - case -1: - break; - case 0: - case 1: - case 2: - case 3: - case 4: - if (ptrack.pidForTracking() != static_cast(pidHypoPos)) { - return false; - } - break; - default: - LOG(fatal) << "Invalid PID selection for positive daughter"; - break; - } - switch (pidHypoNeg) { - case -1: - break; - case 0: - case 1: - case 2: - case 3: - case 4: - if (ntrack.pidForTracking() != static_cast(pidHypoNeg)) { - return false; - } - break; - default: - LOG(fatal) << "Invalid PID selection for negative daughter"; - break; + if (std::abs(v0Selections.requirePosTRD) > 0) { + if (v0Selections.requirePosTRD < 0 && ptrack.hasTRD()) // require no TRD + return false; + if (v0Selections.requirePosTRD > 0 && !ptrack.hasTRD()) // require TRD + return false; + } + if (std::abs(v0Selections.requireNegTRD) > 0) { + if (v0Selections.requireNegTRD < 0 && ntrack.hasTRD()) // require no TRD + return false; + if (v0Selections.requireNegTRD > 0 && !ntrack.hasTRD()) // require TRD + return false; } - return true; - } - // Filters on V0s - Filter v0Filter = (nabs(aod::v0data::dcapostopv) > v0setting_dcapostopv && - nabs(aod::v0data::dcanegtopv) > v0setting_dcanegtopv && - aod::v0data::dcaV0daughters < v0setting_dcav0dau && - aod::v0data::v0cosPA > v0setting_cospa); + // Specific PID for tracking selection + if (v0Selections.requirePosPIDforTracking > -1 && ptrack.pidForTracking() != static_cast(v0Selections.requirePosPIDforTracking)) { + return false; + } + if (v0Selections.requireNegPIDforTracking > -1 && ntrack.pidForTracking() != static_cast(v0Selections.requireNegPIDforTracking)) { + return false; + } - // Event selection - Filter eventFilter = (eventSelection && o2::aod::evsel::sel8 == true); - Filter posZFilter = (nabs(o2::aod::collision::posZ) < cutzvertex); + return true; + } - void processData(soa::Filtered::iterator const& collision, - soa::Filtered const& fullV0s, - PIDTracks const&) + void processData(SelectedCollisions::iterator const& collision, + soa::Join const& fullV0s, + PIDTracksIU const&) { - const int occupancy = collision.trackOccupancyInTimeRange(); - if (minOccupancyCut < maxOccupancyCut) { - if (occupancy < minOccupancyCut || occupancy > maxOccupancyCut) { - return; - } - } + if (!isEventAccepted(collision, true)) + return; + + float centrality = getCentralityRun3(collision); + float occupancy = eventSelections.useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); + rK0sResolution.fill(HIST("hEventCentrality"), centrality); + rK0sResolution.fill(HIST("hEventOccupancy"), occupancy); rK0sResolution.fill(HIST("h1_stats"), 0.5); - for (auto& v0 : fullV0s) { + for (const auto& v0 : fullV0s) { rK0sResolution.fill(HIST("h1_stats"), 1.5); - const auto& posTrack = v0.posTrack_as(); - const auto& negTrack = v0.negTrack_as(); + const auto& posTrack = v0.posTrack_as(); + const auto& negTrack = v0.negTrack_as(); if (!acceptV0(v0, negTrack, posTrack, collision)) continue; rK0sResolution.fill(HIST("h1_stats"), 2.5); float mass = v0.mK0Short(); - if (computeInvMassFromDaughters) { - mass = RecoDecay::m(std::array{std::array{posTrack.px(), posTrack.py(), posTrack.pz()}, - std::array{negTrack.px(), negTrack.py(), negTrack.pz()}}, - std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassPionCharged}); - } rK0sResolution.fill(HIST("h2_masspT"), mass, v0.pt()); rK0sResolution.fill(HIST("h2_masseta"), mass, v0.eta()); @@ -476,6 +657,8 @@ struct perfK0sResolution { if (useMultidimHisto) { rK0sResolution.fill(HIST("thn_mass"), mass, v0.pt(), v0.eta(), v0.phi(), posTrack.eta(), negTrack.eta()); } + rK0sResolution.fill(HIST("h3_centralitypTmass"), centrality, v0.pt(), mass); + rK0sResolution.fill(HIST("h3_occupancypTmass"), occupancy, v0.pt(), mass); if (enableTPCPlot) { rK0sDauResolution.fill(HIST("h3_tpc_vs_pid_hypothesis"), posTrack.tpcInnerParam(), posTrack.tpcSignal(), posTrack.pidForTracking()); rK0sDauResolution.fill(HIST("h3_tpc_vs_pid_hypothesis"), -negTrack.tpcInnerParam(), negTrack.tpcSignal(), negTrack.pidForTracking()); @@ -520,14 +703,22 @@ struct perfK0sResolution { o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, mTrackParCovNeg, 2.f, matCorr, &mDcaInfoCovNeg); } - void processMC(soa::Filtered::iterator const& collision, - soa::Filtered> const& fullV0s, + void processMC(SelectedCollisions::iterator const& collision, + soa::Join const& fullV0s, PIDTracksIUMC const&, aod::McParticles const& mcParticles, aod::BCsWithTimestamps const& bcs) { + if (!isEventAccepted(collision, true)) + return; + + float centrality = getCentralityRun3(collision); + float occupancy = eventSelections.useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); + rK0sResolution.fill(HIST("hEventCentrality"), centrality); + rK0sResolution.fill(HIST("hEventOccupancy"), occupancy); + rK0sResolution.fill(HIST("h1_stats"), 0.5); - for (auto& v0 : fullV0s) { + for (const auto& v0 : fullV0s) { bool daughtersHaveMCParticles = false; bool daughtersCorrRec = false; rK0sResolution.fill(HIST("h1_stats"), 1.5); @@ -540,7 +731,9 @@ struct perfK0sResolution { if (posTrack.has_mcParticle() && negTrack.has_mcParticle()) { daughtersHaveMCParticles = true; rK0sResolution.fill(HIST("h1_stats"), 3.5); - if (posTrack.mcParticle().pdgCode() == 211 && negTrack.mcParticle().pdgCode() == -211) { + bool isPositivePion = posTrack.mcParticle().pdgCode() == PDG_t::kPiPlus || (doTreatPiToMuon && posTrack.mcParticle().pdgCode() == PDG_t::kMuonPlus); + bool isNegativePion = negTrack.mcParticle().pdgCode() == PDG_t::kPiMinus || (doTreatPiToMuon && negTrack.mcParticle().pdgCode() == PDG_t::kMuonMinus); + if (isPositivePion && isNegativePion) { daughtersCorrRec = true; rK0sResolution.fill(HIST("h1_stats"), 4.5); } @@ -552,11 +745,6 @@ struct perfK0sResolution { float mass = v0.mK0Short(); - if (computeInvMassFromDaughters) { - mass = RecoDecay::m(std::array{std::array{posTrack.px(), posTrack.py(), posTrack.pz()}, - std::array{negTrack.px(), negTrack.py(), negTrack.pz()}}, - std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassPionCharged}); - } if (useTrackTuner && daughtersHaveMCParticles) { std::array pPos{0., 0., 0.}; std::array pNeg{0., 0., 0.}; @@ -567,8 +755,8 @@ struct perfK0sResolution { std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassPionCharged}); } - const bool isTrueK0s = (v0.has_mcParticle() && v0.mcParticle().pdgCode() == 310); - if (!isTrueK0s && requireTrueK0s) { + bool isTrueK0s = (v0.has_mcParticle() && std::abs(v0.mcParticle().pdgCode()) == PDG_t::kK0Short && v0.mcParticle().isPhysicalPrimary() && daughtersCorrRec); + if (requireTrueK0s && !isTrueK0s) { continue; } @@ -614,6 +802,8 @@ struct perfK0sResolution { rK0sResolution.fill(HIST("h2_masspT"), mass, v0.pt()); rK0sResolution.fill(HIST("h2_masseta"), mass, v0.eta()); rK0sResolution.fill(HIST("h2_massphi"), mass, v0.phi()); + rK0sResolution.fill(HIST("h3_centralitypTmass"), centrality, v0.pt(), mass); + rK0sResolution.fill(HIST("h3_occupancypTmass"), occupancy, v0.pt(), mass); } } PROCESS_SWITCH(perfK0sResolution, processMC, "Process MC", false); From dbc42c597c02f6a0116bfd54ddeaff822dc55915 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Thu, 9 Oct 2025 12:29:02 +0200 Subject: [PATCH 674/986] [PWGLF] Add event selection vs centrality histogram (#13290) Co-authored-by: ALICE Action Bot --- .../derivedlambdakzeroanalysis.cxx | 243 +++++++++++++----- 1 file changed, 185 insertions(+), 58 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx index 0ec4fc8e3ca..4abbd193438 100644 --- a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx @@ -90,7 +90,8 @@ enum CentEstimator { kCentFT0M, kCentFT0CVariant1, kCentMFT, - kCentNGlobal + kCentNGlobal, + kCentFV0A }; struct derivedlambdakzeroanalysis { @@ -106,7 +107,7 @@ struct derivedlambdakzeroanalysis { Configurable doPPAnalysis{"doPPAnalysis", false, "if in pp, set to true"}; Configurable irSource{"irSource", "T0VTX", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"}; - Configurable centralityEstimator{"centralityEstimator", kCentFT0C, "Run 3 centrality estimator (0:CentFT0C, 1:CentFT0M, 3:CentFT0CVariant1, 4:CentMFT, 5:CentNGlobal)"}; + Configurable centralityEstimator{"centralityEstimator", kCentFT0C, "Run 3 centrality estimator (0:CentFT0C, 1:CentFT0M, 2:CentFT0CVariant1, 3:CentMFT, 4:CentNGlobal, 5:CentFV0A)"}; Configurable doEventQA{"doEventQA", false, "do event QA histograms"}; Configurable doCompleteTopoQA{"doCompleteTopoQA", false, "do topological variable QA histograms"}; @@ -643,6 +644,34 @@ struct derivedlambdakzeroanalysis { histos.add("hCentralityVsNch", "hCentralityVsNch", kTH2D, {{101, 0.0f, 101.0f}, axisConfigurations.axisNch}); if (doEventQA) { if (isRun3) { + histos.add("hEventSelectionVsCentrality", "hEventSelectionVsCentrality", kTH2D, {{21, -0.5f, +20.5f}, {101, 0.0f, 101.0f}}); + histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(1, "All collisions"); + histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(2, "sel8 cut"); + histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(3, "kIsTriggerTVX"); + histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(4, "kNoITSROFrameBorder"); + histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(5, "kNoTimeFrameBorder"); + histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(6, "posZ cut"); + histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(7, "kIsVertexITSTPC"); + histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(8, "kIsGoodZvtxFT0vsPV"); + histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(9, "kIsVertexTOFmatched"); + histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(10, "kIsVertexTRDmatched"); + histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(11, "kNoSameBunchPileup"); + histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(12, "kNoCollInTimeRangeStd"); + histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(13, "kNoCollInTimeRangeStrict"); + histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(14, "kNoCollInTimeRangeNarrow"); + histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(15, "kNoCollInRofStd"); + histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(16, "kNoCollInRofStrict"); + if (doPPAnalysis) { + histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(17, "INEL>0"); + histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(18, "INEL>1"); + } else { + histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(17, "Below min occup."); + histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(18, "Above max occup."); + } + histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(19, "Below min IR"); + histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(20, "Above max IR"); + histos.get(HIST("hEventSelectionVsCentrality"))->GetXaxis()->SetBinLabel(21, "RCT flags"); + histos.add("hCentralityVsNGlobal", "hCentralityVsNGlobal", kTH2D, {{101, 0.0f, 101.0f}, axisConfigurations.axisNch}); histos.add("hEventCentVsMultFT0M", "hEventCentVsMultFT0M", kTH2D, {{101, 0.0f, 101.0f}, axisConfigurations.axisMultFT0M}); histos.add("hEventCentVsMultFT0C", "hEventCentVsMultFT0C", kTH2D, {{101, 0.0f, 101.0f}, axisConfigurations.axisMultFT0C}); @@ -1099,6 +1128,8 @@ struct derivedlambdakzeroanalysis { return collision.centMFT(); else if (centralityEstimator == kCentNGlobal) return collision.centNGlobal(); + else if (centralityEstimator == kCentFV0A) + return collision.centFV0A(); return -1.f; } @@ -1155,14 +1186,14 @@ struct derivedlambdakzeroanalysis { // Calculation taken from CF: https://github.com/AliceO2Group/O2Physics/blob/376392cb87349886a300c75fa2492b50b7f46725/PWGCF/Flow/Tasks/flowAnalysisGF.cxx#L470 { if (magField < 0) // for negative polarity field - phi = TMath::TwoPi() - phi; + phi = o2::constants::math::TwoPI - phi; if (sign < 0) // for negative charge - phi = TMath::TwoPi() - phi; + phi = o2::constants::math::TwoPI - phi; if (phi < 0) LOGF(warning, "phi < 0: %g", phi); - phi += TMath::Pi() / 18.0; // to center gap in the middle - return fmod(phi, TMath::Pi() / 9.0); + phi += o2::constants::math::PI / 18.0; // to center gap in the middle + return fmod(phi, o2::constants::math::PI / 9.0); } bool isTrackFarFromTPCBoundary(double trackPt, double trackPhi, int sign) @@ -1308,22 +1339,22 @@ struct derivedlambdakzeroanalysis { // precalculate this information so that a check is one mask operation, not many { uint64_t bitMap = 0; - bool isPositiveProton = v0.pdgCodePositive() == 2212; - bool isPositivePion = v0.pdgCodePositive() == 211 || (doTreatPiToMuon && v0.pdgCodePositive() == -13); - bool isNegativeProton = v0.pdgCodeNegative() == -2212; - bool isNegativePion = v0.pdgCodeNegative() == -211 || (doTreatPiToMuon && v0.pdgCodeNegative() == 13); + bool isPositiveProton = v0.pdgCodePositive() == PDG_t::kProton; + bool isPositivePion = v0.pdgCodePositive() == PDG_t::kPiPlus || (doTreatPiToMuon && v0.pdgCodePositive() == PDG_t::kMuonPlus); + bool isNegativeProton = v0.pdgCodeNegative() == PDG_t::kProtonBar; + bool isNegativePion = v0.pdgCodeNegative() == PDG_t::kPiMinus || (doTreatPiToMuon && v0.pdgCodeNegative() == PDG_t::kMuonMinus); - if (v0.pdgCode() == 310 && isPositivePion && isNegativePion) { + if (v0.pdgCode() == PDG_t::kK0Short && isPositivePion && isNegativePion) { BITSET(bitMap, selConsiderK0Short); if (v0.isPhysicalPrimary()) BITSET(bitMap, selPhysPrimK0Short); } - if (v0.pdgCode() == 3122 && isPositiveProton && isNegativePion) { + if (v0.pdgCode() == PDG_t::kLambda0 && isPositiveProton && isNegativePion) { BITSET(bitMap, selConsiderLambda); if (v0.isPhysicalPrimary()) BITSET(bitMap, selPhysPrimLambda); } - if (v0.pdgCode() == -3122 && isPositivePion && isNegativeProton) { + if (v0.pdgCode() == PDG_t::kLambda0Bar && isPositivePion && isNegativeProton) { BITSET(bitMap, selConsiderAntiLambda); if (v0.isPhysicalPrimary()) BITSET(bitMap, selPhysPrimAntiLambda); @@ -1911,11 +1942,11 @@ struct derivedlambdakzeroanalysis { // __________________________________________ if (verifyMask(selMap, secondaryMaskSelectionLambda) && analyseLambda) { - if (v0mother.pdgCode() == 3312 && v0mother.isPhysicalPrimary()) + if (v0mother.pdgCode() == PDG_t::kXiMinus && v0mother.isPhysicalPrimary()) histos.fill(HIST("h3dLambdaFeeddown"), centrality, pt, std::hypot(v0mother.px(), v0mother.py())); } if (verifyMask(selMap, secondaryMaskSelectionAntiLambda) && analyseAntiLambda) { - if (v0mother.pdgCode() == -3312 && v0mother.isPhysicalPrimary()) + if (v0mother.pdgCode() == PDG_t::kXiPlusBar && v0mother.isPhysicalPrimary()) histos.fill(HIST("h3dAntiLambdaFeeddown"), centrality, pt, std::hypot(v0mother.px(), v0mother.py())); } } @@ -1924,126 +1955,210 @@ struct derivedlambdakzeroanalysis { bool isEventAccepted(TCollision collision, bool fillHists) // check whether the collision passes our collision selections { - if (fillHists) + float centrality = -1.0f; + if (fillHists) { histos.fill(HIST("hEventSelection"), 0. /* all collisions */); + if (doEventQA) { + if constexpr (requires { collision.centFT0C(); }) { // check if we are in Run 3 + centrality = getCentralityRun3(collision); + } + histos.fill(HIST("hEventSelectionVsCentrality"), 0. /* all collisions */, centrality); + } + } if constexpr (requires { collision.centFT0C(); }) { // check if we are in Run 3 if (eventSelections.requireSel8 && !collision.sel8()) { return false; } - if (fillHists) + if (fillHists) { histos.fill(HIST("hEventSelection"), 1 /* sel8 collisions */); + if (doEventQA) { + histos.fill(HIST("hEventSelectionVsCentrality"), 1 /* sel8 collisions */, centrality); + } + } if (eventSelections.requireTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { return false; } - if (fillHists) + if (fillHists) { histos.fill(HIST("hEventSelection"), 2 /* FT0 vertex (acceptable FT0C-FT0A time difference) collisions */); + if (doEventQA) { + histos.fill(HIST("hEventSelectionVsCentrality"), 2 /* FT0 vertex (acceptable FT0C-FT0A time difference) collisions */, centrality); + } + } if (eventSelections.rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { return false; } - if (fillHists) + if (fillHists) { histos.fill(HIST("hEventSelection"), 3 /* Not at ITS ROF border */); + if (doEventQA) { + histos.fill(HIST("hEventSelectionVsCentrality"), 3 /* Not at ITS ROF border */, centrality); + } + } if (eventSelections.rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { return false; } - if (fillHists) + if (fillHists) { histos.fill(HIST("hEventSelection"), 4 /* Not at TF border */); + if (doEventQA) { + histos.fill(HIST("hEventSelectionVsCentrality"), 4 /* Not at TF border */, centrality); + } + } if (std::abs(collision.posZ()) > eventSelections.maxZVtxPosition) { return false; } - if (fillHists) + if (fillHists) { histos.fill(HIST("hEventSelection"), 5 /* vertex-Z selected */); + if (doEventQA) { + histos.fill(HIST("hEventSelectionVsCentrality"), 5 /* vertex-Z selected */, centrality); + } + } if (eventSelections.requireIsVertexITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { return false; } - if (fillHists) + if (fillHists) { histos.fill(HIST("hEventSelection"), 6 /* Contains at least one ITS-TPC track */); + if (doEventQA) { + histos.fill(HIST("hEventSelectionVsCentrality"), 6 /* Contains at least one ITS-TPC track */, centrality); + } + } if (eventSelections.requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { return false; } - if (fillHists) + if (fillHists) { histos.fill(HIST("hEventSelection"), 7 /* PV position consistency check */); + if (doEventQA) { + histos.fill(HIST("hEventSelectionVsCentrality"), 7 /* PV position consistency check */, centrality); + } + } if (eventSelections.requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { return false; } - if (fillHists) + if (fillHists) { histos.fill(HIST("hEventSelection"), 8 /* PV with at least one contributor matched with TOF */); + if (doEventQA) { + histos.fill(HIST("hEventSelectionVsCentrality"), 8 /* PV with at least one contributor matched with TOF */, centrality); + } + } if (eventSelections.requireIsVertexTRDmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { return false; } - if (fillHists) + if (fillHists) { histos.fill(HIST("hEventSelection"), 9 /* PV with at least one contributor matched with TRD */); + if (doEventQA) { + histos.fill(HIST("hEventSelectionVsCentrality"), 9 /* PV with at least one contributor matched with TRD */, centrality); + } + } if (eventSelections.rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { return false; } - if (fillHists) + if (fillHists) { histos.fill(HIST("hEventSelection"), 10 /* Not at same bunch pile-up */); + if (doEventQA) { + histos.fill(HIST("hEventSelectionVsCentrality"), 10 /* Not at same bunch pile-up */, centrality); + } + } if (eventSelections.requireNoCollInTimeRangeStd && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { return false; } - if (fillHists) + if (fillHists) { histos.fill(HIST("hEventSelection"), 11 /* No other collision within +/- 2 microseconds or mult above a certain threshold in -4 - -2 microseconds*/); + if (doEventQA) { + histos.fill(HIST("hEventSelectionVsCentrality"), 11 /* No other collision within +/- 2 microseconds or mult above a certain threshold in -4 - -2 microseconds*/, centrality); + } + } if (eventSelections.requireNoCollInTimeRangeStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStrict)) { return false; } - if (fillHists) + if (fillHists) { histos.fill(HIST("hEventSelection"), 12 /* No other collision within +/- 10 microseconds */); + if (doEventQA) { + histos.fill(HIST("hEventSelectionVsCentrality"), 12 /* No other collision within +/- 10 microseconds */, centrality); + } + } if (eventSelections.requireNoCollInTimeRangeNarrow && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) { return false; } - if (fillHists) + if (fillHists) { histos.fill(HIST("hEventSelection"), 13 /* No other collision within +/- 2 microseconds */); + if (doEventQA) { + histos.fill(HIST("hEventSelectionVsCentrality"), 13 /* No other collision within +/- 2 microseconds */, centrality); + } + } if (eventSelections.requireNoCollInROFStd && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { return false; } - if (fillHists) + if (fillHists) { histos.fill(HIST("hEventSelection"), 14 /* No other collision within the same ITS ROF with mult. above a certain threshold */); + if (doEventQA) { + histos.fill(HIST("hEventSelectionVsCentrality"), 14 /* No other collision within the same ITS ROF with mult. above a certain threshold */, centrality); + } + } if (eventSelections.requireNoCollInROFStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStrict)) { return false; } - if (fillHists) + if (fillHists) { histos.fill(HIST("hEventSelection"), 15 /* No other collision within the same ITS ROF */); + if (doEventQA) { + histos.fill(HIST("hEventSelectionVsCentrality"), 15 /* No other collision within the same ITS ROF */, centrality); + } + } if (doPPAnalysis) { // we are in pp if (eventSelections.requireINEL0 && collision.multNTracksPVeta1() < 1) { return false; } - if (fillHists) + if (fillHists) { histos.fill(HIST("hEventSelection"), 16 /* INEL > 0 */); + if (doEventQA) { + histos.fill(HIST("hEventSelectionVsCentrality"), 16 /* INEL > 0 */, centrality); + } + } if (eventSelections.requireINEL1 && collision.multNTracksPVeta1() < 2) { return false; } - if (fillHists) + if (fillHists) { histos.fill(HIST("hEventSelection"), 17 /* INEL > 1 */); + if (doEventQA) { + histos.fill(HIST("hEventSelectionVsCentrality"), 17 /* INEL > 1 */, centrality); + } + } } else { // we are in Pb-Pb float collisionOccupancy = eventSelections.useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); if (eventSelections.minOccupancy >= 0 && collisionOccupancy < eventSelections.minOccupancy) { return false; } - if (fillHists) + if (fillHists) { histos.fill(HIST("hEventSelection"), 16 /* Below min occupancy */); + if (doEventQA) { + histos.fill(HIST("hEventSelectionVsCentrality"), 16 /* Below min occupancy */, centrality); + } + } if (eventSelections.maxOccupancy >= 0 && collisionOccupancy > eventSelections.maxOccupancy) { return false; } - if (fillHists) + if (fillHists) { histos.fill(HIST("hEventSelection"), 17 /* Above max occupancy */); + if (doEventQA) { + histos.fill(HIST("hEventSelectionVsCentrality"), 17 /* Above max occupancy */, centrality); + } + } } // Fetch interaction rate only if required (in order to limit ccdb calls) @@ -2051,20 +2166,32 @@ struct derivedlambdakzeroanalysis { if (eventSelections.minIR >= 0 && interactionRate < eventSelections.minIR) { return false; } - if (fillHists) + if (fillHists) { histos.fill(HIST("hEventSelection"), 18 /* Below min IR */); + if (doEventQA) { + histos.fill(HIST("hEventSelectionVsCentrality"), 18 /* Below min IR */, centrality); + } + } if (eventSelections.maxIR >= 0 && interactionRate > eventSelections.maxIR) { return false; } - if (fillHists) + if (fillHists) { histos.fill(HIST("hEventSelection"), 19 /* Above max IR */); + if (doEventQA) { + histos.fill(HIST("hEventSelectionVsCentrality"), 19 /* Above max IR */, centrality); + } + } if (!rctConfigurations.cfgRCTLabel.value.empty() && !rctFlagsChecker(collision)) { return false; } - if (fillHists) + if (fillHists) { histos.fill(HIST("hEventSelection"), 20 /* Pass CBT condition */); + if (doEventQA) { + histos.fill(HIST("hEventSelectionVsCentrality"), 20 /* Pass CBT condition */, centrality); + } + } } else { // we are in Run 2 if (eventSelections.requireSel8 && !collision.sel8()) { @@ -2459,9 +2586,9 @@ struct derivedlambdakzeroanalysis { float ptmc = RecoDecay::sqrtSumOfSquares(v0MC.pxPosMC() + v0MC.pxNegMC(), v0MC.pyPosMC() + v0MC.pyNegMC()); float ymc = 1e-3; - if (v0MC.pdgCode() == 310) + if (v0MC.pdgCode() == PDG_t::kK0Short) ymc = RecoDecay::y(std::array{v0MC.pxPosMC() + v0MC.pxNegMC(), v0MC.pyPosMC() + v0MC.pyNegMC(), v0MC.pzPosMC() + v0MC.pzNegMC()}, o2::constants::physics::MassKaonNeutral); - else if (std::abs(v0MC.pdgCode()) == 3122) + else if (std::abs(v0MC.pdgCode()) == PDG_t::kLambda0) ymc = RecoDecay::y(std::array{v0MC.pxPosMC() + v0MC.pxNegMC(), v0MC.pyPosMC() + v0MC.pyNegMC(), v0MC.pzPosMC() + v0MC.pzNegMC()}, o2::constants::physics::MassLambda); uint64_t selMap = computeReconstructionBitmap(v0, collision, ymc, ymc, ptmc); @@ -2526,9 +2653,9 @@ struct derivedlambdakzeroanalysis { float ptmc = v0MC.ptMC(); float ymc = 1e3; - if (v0MC.pdgCode() == 310) + if (v0MC.pdgCode() == PDG_t::kK0Short) ymc = v0MC.rapidityMC(0); - else if (std::abs(v0MC.pdgCode()) == 3122) + else if (std::abs(v0MC.pdgCode()) == PDG_t::kLambda0) ymc = v0MC.rapidityMC(1); if (std::abs(ymc) > v0Selections.rapidityCut) @@ -2557,26 +2684,26 @@ struct derivedlambdakzeroanalysis { centrality = eventSelections.useSPDTrackletsCent ? collision.centRun2SPDTracklets() : collision.centRun2V0M(); } - if (v0MC.pdgCode() == 310) { + if (v0MC.pdgCode() == PDG_t::kK0Short) { histos.fill(HIST("h2dGenK0ShortVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); } - if (v0MC.pdgCode() == 3122) { + if (v0MC.pdgCode() == PDG_t::kLambda0) { histos.fill(HIST("h2dGenLambdaVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); } - if (v0MC.pdgCode() == -3122) { + if (v0MC.pdgCode() == PDG_t::kLambda0Bar) { histos.fill(HIST("h2dGenAntiLambdaVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); } } - if (v0MC.pdgCode() == 310) { + if (v0MC.pdgCode() == PDG_t::kK0Short) { histos.fill(HIST("h2dGenK0Short"), centrality, ptmc); histos.fill(HIST("h2dGenK0ShortVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); } - if (v0MC.pdgCode() == 3122) { + if (v0MC.pdgCode() == PDG_t::kLambda0) { histos.fill(HIST("h2dGenLambda"), centrality, ptmc); histos.fill(HIST("h2dGenLambdaVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); } - if (v0MC.pdgCode() == -3122) { + if (v0MC.pdgCode() == PDG_t::kLambda0Bar) { histos.fill(HIST("h2dGenAntiLambda"), centrality, ptmc); histos.fill(HIST("h2dGenAntiLambdaVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); } @@ -2591,9 +2718,9 @@ struct derivedlambdakzeroanalysis { float ptmc = cascMC.ptMC(); float ymc = 1e3; - if (std::abs(cascMC.pdgCode()) == 3312) + if (std::abs(cascMC.pdgCode()) == PDG_t::kXiMinus) ymc = cascMC.rapidityMC(0); - else if (std::abs(cascMC.pdgCode()) == 3334) + else if (std::abs(cascMC.pdgCode()) == PDG_t::kOmegaMinus) ymc = cascMC.rapidityMC(2); if (std::abs(ymc) > v0Selections.rapidityCut) @@ -2622,33 +2749,33 @@ struct derivedlambdakzeroanalysis { centrality = eventSelections.useSPDTrackletsCent ? collision.centRun2SPDTracklets() : collision.centRun2V0M(); } - if (cascMC.pdgCode() == 3312) { + if (cascMC.pdgCode() == PDG_t::kXiMinus) { histos.fill(HIST("h2dGenXiMinusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); } - if (cascMC.pdgCode() == -3312) { + if (cascMC.pdgCode() == PDG_t::kXiPlusBar) { histos.fill(HIST("h2dGenXiPlusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); } - if (cascMC.pdgCode() == 3334) { + if (cascMC.pdgCode() == PDG_t::kOmegaMinus) { histos.fill(HIST("h2dGenOmegaMinusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); } - if (cascMC.pdgCode() == -3334) { + if (cascMC.pdgCode() == PDG_t::kOmegaPlusBar) { histos.fill(HIST("h2dGenOmegaPlusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); } } - if (cascMC.pdgCode() == 3312) { + if (cascMC.pdgCode() == PDG_t::kXiMinus) { histos.fill(HIST("h2dGenXiMinus"), centrality, ptmc); histos.fill(HIST("h2dGenXiMinusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); } - if (cascMC.pdgCode() == -3312) { + if (cascMC.pdgCode() == PDG_t::kXiPlusBar) { histos.fill(HIST("h2dGenXiPlus"), centrality, ptmc); histos.fill(HIST("h2dGenXiPlusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); } - if (cascMC.pdgCode() == 3334) { + if (cascMC.pdgCode() == PDG_t::kOmegaMinus) { histos.fill(HIST("h2dGenOmegaMinus"), centrality, ptmc); histos.fill(HIST("h2dGenOmegaMinusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); } - if (cascMC.pdgCode() == -3334) { + if (cascMC.pdgCode() == PDG_t::kOmegaPlusBar) { histos.fill(HIST("h2dGenOmegaPlus"), centrality, ptmc); histos.fill(HIST("h2dGenOmegaPlusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); } From 7bdf3e895bd9c1ebb0c664d38d1be60d62e9dd2f Mon Sep 17 00:00:00 2001 From: Chiara De Martin <39315597+ChiaraDeMartin95@users.noreply.github.com> Date: Thu, 9 Oct 2025 12:37:21 +0200 Subject: [PATCH 675/986] [PWGLF] compute resolution with V0A as reference detector (#13300) Co-authored-by: Chiara De Martin Co-authored-by: ALICE Action Bot --- .../TableProducer/Strangeness/cascadeflow.cxx | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx index af709e697a2..13e384ad210 100644 --- a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx @@ -183,6 +183,7 @@ struct cascadeFlow { struct : ConfigurableGroup { Configurable cfgShiftCorr{"cfgShiftCorr", 0, ""}; Configurable cfgShiftPathFT0C{"cfgShiftPathFT0C", "Users/c/chdemart/OOpass2Shift/ShiftFT0C", "Path for Shift"}; + Configurable cfgShiftPathFV0A{"cfgShiftPathFV0A", "Users/c/chdemart/OOpass2Shift/ShiftFV0A", "Path for Shift"}; Configurable cfgShiftPathTPCL{"cfgShiftPathTPCL", "Users/c/chdemart/OOpass2Shift/ShiftTPCL", "Path for Shift"}; Configurable cfgShiftPathTPCR{"cfgShiftPathTPCR", "Users/c/chdemart/OOpass2Shift/ShiftTPCR", "Path for Shift"}; } ShiftConfigs; @@ -493,10 +494,12 @@ struct cascadeFlow { int lastRunNumber = -999; TProfile3D* shiftprofile; TProfile3D* shiftprofileFT0C; + TProfile3D* shiftprofileFV0A; TProfile3D* shiftprofileTPCL; TProfile3D* shiftprofileTPCR; std::string fullCCDBShiftCorrPath; std::string fullCCDBShiftCorrPathFT0C; + std::string fullCCDBShiftCorrPathFV0A; std::string fullCCDBShiftCorrPathTPCL; std::string fullCCDBShiftCorrPathTPCR; @@ -516,10 +519,11 @@ struct cascadeFlow { } template - double ComputeEPResolutionwShifts(TCollision coll, double psiT0C, double psiTPCA, double psiTPCC, TProfile3D* shiftprofileA, TProfile3D* shiftprofileB, TProfile3D* shiftprofileC) + double ComputeEPResolutionwShifts(TCollision coll, double psiT0C, double psiV0A, double psiTPCA, double psiTPCC, TProfile3D* shiftprofileA, TProfile3D* shiftprofileB, TProfile3D* shiftprofileC, TProfile3D* shiftprofileD) { int nmode = 2; auto deltapsiFT0C = 0.0; + auto deltapsiFV0A = 0.0; auto deltapsiTPCA = 0.0; auto deltapsiTPCC = 0.0; for (int ishift = 1; ishift <= 10; ishift++) { @@ -529,7 +533,11 @@ struct cascadeFlow { auto coeffshiftyTPCA = shiftprofileB->GetBinContent(shiftprofileTPCL->FindBin(coll.centFT0C(), 3.5, ishift - 0.5)); auto coeffshiftxTPCC = shiftprofileC->GetBinContent(shiftprofileTPCR->FindBin(coll.centFT0C(), 4.5, ishift - 0.5)); auto coeffshiftyTPCC = shiftprofileC->GetBinContent(shiftprofileTPCR->FindBin(coll.centFT0C(), 5.5, ishift - 0.5)); + auto coeffshiftxFV0A = shiftprofileD->GetBinContent(shiftprofileFV0A->FindBin(coll.centFT0C(), 0.5, ishift - 0.5)); + auto coeffshiftyFV0A = shiftprofileD->GetBinContent(shiftprofileFV0A->FindBin(coll.centFT0C(), 1.5, ishift - 0.5)); + deltapsiFT0C += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0C * TMath::Cos(ishift * static_cast(nmode) * psiT0C) + coeffshiftyFT0C * TMath::Sin(ishift * static_cast(nmode) * psiT0C))); + deltapsiFV0A += ((1 / (1.0 * ishift)) * (-coeffshiftxFV0A * TMath::Cos(ishift * static_cast(nmode) * psiV0A) + coeffshiftyFV0A * TMath::Sin(ishift * static_cast(nmode) * psiV0A))); deltapsiTPCA += ((1 / (1.0 * ishift)) * (-coeffshiftxTPCA * TMath::Cos(ishift * static_cast(nmode) * psiTPCA) + coeffshiftyTPCA * TMath::Sin(ishift * static_cast(nmode) * psiTPCA))); deltapsiTPCC += ((1 / (1.0 * ishift)) * (-coeffshiftxTPCC * TMath::Cos(ishift * static_cast(nmode) * psiTPCC) + coeffshiftyTPCC * TMath::Sin(ishift * static_cast(nmode) * psiTPCC))); } @@ -537,6 +545,7 @@ struct cascadeFlow { // histos.fill(HIST("psi2/QA/EP_TPCA_shifted"), coll.centFT0C(), psiTPCA + deltapsiTPCA); // histos.fill(HIST("psi2/QA/EP_TPCC_shifted"), coll.centFT0C(), psiTPCC + deltapsiTPCC); resolution.fill(HIST("QVectorsT0CTPCA_Shifted"), coll.centFT0C(), TMath::Cos(static_cast(nmode) * (psiT0C + deltapsiFT0C - psiTPCA - deltapsiTPCA))); + resolution.fill(HIST("QVectorsT0CV0A_Shifted"), coll.centFT0C(), TMath::Cos(static_cast(nmode) * (psiT0C + deltapsiFT0C - psiV0A - deltapsiFV0A))); resolution.fill(HIST("QVectorsT0CTPCC_Shifted"), coll.centFT0C(), TMath::Cos(static_cast(nmode) * (psiT0C + deltapsiFT0C - psiTPCC - deltapsiTPCC))); resolution.fill(HIST("QVectorsTPCAC_Shifted"), coll.centFT0C(), TMath::Cos(static_cast(nmode) * (psiTPCA + deltapsiTPCA - psiTPCC - deltapsiTPCC))); return true; @@ -748,15 +757,19 @@ struct cascadeFlow { resolution.add("QVectorsT0CTPCA", "QVectorsT0CTPCA", HistType::kTH2F, {axisQVs, CentAxisPerCent}); resolution.add("QVectorsT0CTPCC", "QVectorsT0CTPCC", HistType::kTH2F, {axisQVs, CentAxisPerCent}); resolution.add("QVectorsTPCAC", "QVectorsTPCAC", HistType::kTH2F, {axisQVs, CentAxisPerCent}); + resolution.add("QVectorsT0CV0A", "QVectorsT0CV0A", HistType::kTH2F, {axisQVs, CentAxisPerCent}); resolution.add("QVectorsNormT0CTPCA", "QVectorsNormT0CTPCA", HistType::kTH2F, {axisQVsNorm, CentAxisPerCent}); resolution.add("QVectorsNormT0CTPCC", "QVectorsNormT0CTPCC", HistType::kTH2F, {axisQVsNorm, CentAxisPerCent}); resolution.add("QVectorsNormTPCAC", "QVectorsNormTPCCB", HistType::kTH2F, {axisQVsNorm, CentAxisPerCent}); + resolution.add("QVectorsNormT0CV0A", "QVectorsNormT0CV0A", HistType::kTH2F, {axisQVs, CentAxisPerCent}); resolution.add("QVectorsSpecPlane", "QVectorsSpecPlane", HistType::kTH2F, {axisQVsNorm, CentAxisPerCent}); resolution.add("QVectorsT0CTPCA_Shifted", "QVectorsT0CTPCA_Shifted", HistType::kTH2F, {axisQVs, CentAxisPerCent}); resolution.add("QVectorsT0CTPCC_Shifted", "QVectorsT0CTPCC_Shifted", HistType::kTH2F, {axisQVs, CentAxisPerCent}); resolution.add("QVectorsTPCAC_Shifted", "QVectorsTPCAC_Shifted", HistType::kTH2F, {axisQVs, CentAxisPerCent}); + resolution.add("QVectorsT0CV0A_Shifted", "QVectorsT0CV0A_Shifted", HistType::kTH2F, {axisQVs, CentAxisPerCent}); histos.add("ShiftFT0C", "ShiftFT0C", kTProfile3D, {CentAxis, basisAxis, shiftAxis}); + histos.add("ShiftFV0A", "ShiftFV0A", kTProfile3D, {CentAxis, basisAxis, shiftAxis}); histos.add("ShiftTPCL", "ShiftTPCL", kTProfile3D, {CentAxis, basisAxis, shiftAxis}); histos.add("ShiftTPCR", "ShiftTPCR", kTProfile3D, {CentAxis, basisAxis, shiftAxis}); @@ -1106,7 +1119,7 @@ struct cascadeFlow { if (ShiftConfigs.cfgShiftCorr) { psiT0CCorr = ApplyShiftCorrection(coll, psiT0C, shiftprofileFT0C); - ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC, shiftprofileFT0C, shiftprofileTPCL, shiftprofileTPCR); + ComputeEPResolutionwShifts(coll, psiT0C, psiT0C, psiTPCA, psiTPCC, shiftprofileFT0C, shiftprofileTPCL, shiftprofileTPCR, shiftprofileFT0C); } histos.fill(HIST("hPsiT0C"), psiT0CCorr); @@ -1419,7 +1432,7 @@ struct cascadeFlow { if (ShiftConfigs.cfgShiftCorr) { psiT0CCorr = ApplyShiftCorrection(coll, psiT0C, shiftprofileFT0C); - ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC, shiftprofileFT0C, shiftprofileTPCL, shiftprofileTPCR); + ComputeEPResolutionwShifts(coll, psiT0C, psiT0C, psiTPCA, psiTPCC, shiftprofileFT0C, shiftprofileTPCL, shiftprofileTPCR, shiftprofileFT0C); } histos.fill(HIST("hPsiT0C"), psiT0CCorr); @@ -1692,6 +1705,9 @@ struct cascadeFlow { qvecIm = coll.qvecFV0AIm(); } + double qvecReV0A = coll.qvecFV0ARe(); + double qvecImV0A = coll.qvecFV0AIm(); + histos.fill(HIST("hEventCentralityBefEPSel"), collisionCentrality); histos.fill(HIST("hEventCentralityBefEPSelT0M"), coll.centFT0M()); // select only events used for the calibration of the event plane @@ -1714,10 +1730,12 @@ struct cascadeFlow { histos.fill(HIST("hEventVertexZ"), coll.posZ()); ROOT::Math::XYZVector eventplaneVecT0C{qvecRe, qvecIm, 0}; + ROOT::Math::XYZVector eventplaneVecV0A{qvecReV0A, qvecImV0A, 0}; ROOT::Math::XYZVector eventplaneVecTPCA{coll.qvecBPosRe(), coll.qvecBPosIm(), 0}; ROOT::Math::XYZVector eventplaneVecTPCC{coll.qvecBNegRe(), coll.qvecBNegIm(), 0}; const float psiT0C = std::atan2(qvecIm, qvecRe) * 0.5f; + const float psiV0A = std::atan2(qvecImV0A, qvecReV0A) * 0.5f; const float psiTPCA = std::atan2(coll.qvecBPosIm(), coll.qvecBPosRe()) * 0.5f; const float psiTPCC = std::atan2(coll.qvecBNegIm(), coll.qvecBNegRe()) * 0.5f; float psiT0CCorr = psiT0C; @@ -1725,6 +1743,9 @@ struct cascadeFlow { histos.fill(HIST("ShiftFT0C"), collisionCentrality, 0.5, ishift - 0.5, std::sin(ishift * 2 * psiT0C)); histos.fill(HIST("ShiftFT0C"), collisionCentrality, 1.5, ishift - 0.5, std::cos(ishift * 2 * psiT0C)); + histos.fill(HIST("ShiftFV0A"), collisionCentrality, 0.5, ishift - 0.5, std::sin(ishift * 2 * psiV0A)); + histos.fill(HIST("ShiftFV0A"), collisionCentrality, 1.5, ishift - 0.5, std::cos(ishift * 2 * psiV0A)); + histos.fill(HIST("ShiftTPCL"), collisionCentrality, 0.5, ishift - 0.5, std::sin(ishift * 2 * psiTPCA)); histos.fill(HIST("ShiftTPCL"), collisionCentrality, 1.5, ishift - 0.5, std::cos(ishift * 2 * psiTPCA)); @@ -1738,16 +1759,18 @@ struct cascadeFlow { fullCCDBShiftCorrPathFT0C = ShiftConfigs.cfgShiftPathFT0C; fullCCDBShiftCorrPathTPCL = ShiftConfigs.cfgShiftPathTPCL; fullCCDBShiftCorrPathTPCR = ShiftConfigs.cfgShiftPathTPCR; + fullCCDBShiftCorrPathFV0A = ShiftConfigs.cfgShiftPathFV0A; shiftprofileFT0C = ccdb->getForTimeStamp(fullCCDBShiftCorrPathFT0C, coll.timestamp()); shiftprofileTPCL = ccdb->getForTimeStamp(fullCCDBShiftCorrPathTPCL, coll.timestamp()); shiftprofileTPCR = ccdb->getForTimeStamp(fullCCDBShiftCorrPathTPCR, coll.timestamp()); + shiftprofileFV0A = ccdb->getForTimeStamp(fullCCDBShiftCorrPathFV0A, coll.timestamp()); lastRunNumber = currentRunNumber; } } if (ShiftConfigs.cfgShiftCorr) { psiT0CCorr = ApplyShiftCorrection(coll, psiT0C, shiftprofileFT0C); - ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC, shiftprofileFT0C, shiftprofileTPCL, shiftprofileTPCR); + ComputeEPResolutionwShifts(coll, psiT0C, psiV0A, psiTPCA, psiTPCC, shiftprofileFT0C, shiftprofileTPCL, shiftprofileTPCR, shiftprofileFV0A); } histos.fill(HIST("hPsiT0C"), psiT0CCorr); @@ -1756,9 +1779,11 @@ struct cascadeFlow { resolution.fill(HIST("QVectorsT0CTPCA"), eventplaneVecT0C.Dot(eventplaneVecTPCA), collisionCentrality); resolution.fill(HIST("QVectorsT0CTPCC"), eventplaneVecT0C.Dot(eventplaneVecTPCC), collisionCentrality); resolution.fill(HIST("QVectorsTPCAC"), eventplaneVecTPCA.Dot(eventplaneVecTPCC), collisionCentrality); + resolution.fill(HIST("QVectorsT0CV0A"), eventplaneVecT0C.Dot(eventplaneVecV0A), collisionCentrality); resolution.fill(HIST("QVectorsNormT0CTPCA"), eventplaneVecT0C.Dot(eventplaneVecTPCA) / (coll.qTPCR() * coll.sumAmplFT0C()), collisionCentrality); resolution.fill(HIST("QVectorsNormT0CTPCC"), eventplaneVecT0C.Dot(eventplaneVecTPCC) / (coll.qTPCL() * coll.sumAmplFT0C()), collisionCentrality); resolution.fill(HIST("QVectorsNormTPCAC"), eventplaneVecTPCA.Dot(eventplaneVecTPCC) / (coll.qTPCR() * coll.qTPCL()), collisionCentrality); + resolution.fill(HIST("QVectorsNormT0CV0A"), eventplaneVecT0C.Dot(eventplaneVecV0A) / (coll.sumAmplFT0C() * coll.sumAmplFV0A()), collisionCentrality); std::vector bdtScore[nParticles]; for (auto const& v0 : V0s) { @@ -1974,7 +1999,7 @@ struct cascadeFlow { if (ShiftConfigs.cfgShiftCorr) { psiT0CCorr = ApplyShiftCorrection(coll, psiT0C, shiftprofileFT0C); - ComputeEPResolutionwShifts(coll, psiT0C, psiTPCA, psiTPCC, shiftprofileFT0C, shiftprofileTPCL, shiftprofileTPCR); + ComputeEPResolutionwShifts(coll, psiT0C, psiT0C, psiTPCA, psiTPCC, shiftprofileFT0C, shiftprofileTPCL, shiftprofileTPCR, shiftprofileFT0C); } histos.fill(HIST("hpsiT0C"), psiT0CCorr); From f0200c71769ab3ece7deb27d33632f369d131866 Mon Sep 17 00:00:00 2001 From: Dukhishyam Mallick <160018357+dmallick2@users.noreply.github.com> Date: Thu, 9 Oct 2025 12:56:37 +0200 Subject: [PATCH 676/986] [PWGDQ] HistogramsLibrary: Modify bin range of pseudo-proper decay length distribution in HistogramsLibrary (#13256) --- PWGDQ/Core/HistogramsLibrary.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/PWGDQ/Core/HistogramsLibrary.cxx b/PWGDQ/Core/HistogramsLibrary.cxx index 3bd3be0d6ce..b01443375fc 100644 --- a/PWGDQ/Core/HistogramsLibrary.cxx +++ b/PWGDQ/Core/HistogramsLibrary.cxx @@ -1093,8 +1093,8 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h if (subGroupStr.Contains("tauxy-midy-pol-he")) { int varspTHE[4] = {VarManager::kMass, VarManager::kPt, VarManager::kCosThetaHE, VarManager::kVertexingTauxyProjectedPoleJPsiMass}; int binspT[4] = {50, 10, 20, 1000}; - double xminpT[4] = {2., 0., -1., -0.05}; - double xmaxpT[4] = {4., 20., 1., 0.05}; + double xminpT[4] = {2., 0., -1., -0.5}; + double xmaxpT[4] = {4., 20., 1., 0.5}; hm->AddHistogram(histClass, "Tauxy_Mass_Pt_CosthetaHE", "", 4, varspTHE, binspT, xminpT, xmaxpT, 0, -1, kFALSE); } @@ -1102,8 +1102,8 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h int varspTRand[4] = {VarManager::kMass, VarManager::kPt, VarManager::kCosThetaRM, VarManager::kVertexingTauxyProjectedPoleJPsiMass}; int binspT[4] = {50, 10, 20, 1000}; - double xminpT[4] = {2., 0., -1., -0.05}; - double xmaxpT[4] = {4., 20., 1., 0.05}; + double xminpT[4] = {2., 0., -1., -0.5}; + double xmaxpT[4] = {4., 20., 1., 0.5}; hm->AddHistogram(histClass, "Tauxy_Mass_Pt_CosthetaRand", "", 4, varspTRand, binspT, xminpT, xmaxpT, 0, -1, kFALSE); } @@ -1111,8 +1111,8 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h int varspTCS[4] = {VarManager::kMass, VarManager::kPt, VarManager::kCosThetaCS, VarManager::kVertexingTauxyProjectedPoleJPsiMass}; int binspT[4] = {50, 10, 20, 1000}; - double xminpT[4] = {2., 0., -1., -0.05}; - double xmaxpT[4] = {4., 20., 1., 0.05}; + double xminpT[4] = {2., 0., -1., -0.5}; + double xmaxpT[4] = {4., 20., 1., 0.5}; hm->AddHistogram(histClass, "Tauxy_Mass_Pt_CosthetaCS", "", 4, varspTCS, binspT, xminpT, xmaxpT, 0, -1, kFALSE); } From 6c18a8a1fe773f00992e31a26fc21391cc695b97 Mon Sep 17 00:00:00 2001 From: abmodak <67369858+abmodak@users.noreply.github.com> Date: Thu, 9 Oct 2025 14:59:43 +0200 Subject: [PATCH 677/986] [PWGLF] Add centrality FT0C variant 2 (Run 2 like truncation) (#13295) --- .../Tasks/GlobalEventProperties/heavyionMultiplicity.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx b/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx index 1de0773fa0b..83bc4dc938b 100644 --- a/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx @@ -48,13 +48,13 @@ using namespace o2::framework::expressions; using namespace o2::aod::track; using namespace o2::aod::evsel; -using CollisionDataTable = soa::Join; +using CollisionDataTable = soa::Join; using ColDataTablepp = soa::Join; using TrackDataTable = soa::Join; using FilTrackDataTable = soa::Filtered; using CollisionMCTrueTable = aod::McCollisions; using TrackMCTrueTable = aod::McParticles; -using CollisionMCRecTable = soa::SmallGroups>; +using CollisionMCRecTable = soa::SmallGroups>; using ColMCRecTablepp = soa::SmallGroups>; using TrackMCRecTable = soa::Join; using FilTrackMCRecTable = soa::Filtered; @@ -162,6 +162,7 @@ struct HeavyionMultiplicity { Configurable isApplyCentFT0C{"isApplyCentFT0C", true, "Centrality based on FT0C"}; Configurable isApplyCentFV0A{"isApplyCentFV0A", false, "Centrality based on FV0A"}; Configurable isApplyCentFT0CVariant1{"isApplyCentFT0CVariant1", false, "Centrality based on FT0C variant1"}; + Configurable isApplyCentFT0CVariant2{"isApplyCentFT0CVariant2", false, "Centrality based on FT0C variant2 (Run2 like truncation)"}; Configurable isApplyCentFT0M{"isApplyCentFT0M", false, "Centrality based on FT0A + FT0C"}; Configurable isApplyCentNGlobal{"isApplyCentNGlobal", false, "Centrality based on global tracks"}; Configurable isApplyCentMFT{"isApplyCentMFT", false, "Centrality based on MFT tracks"}; @@ -351,6 +352,9 @@ struct HeavyionMultiplicity { if (isApplyCentFT0CVariant1) { cent = col.centFT0CVariant1(); } + if (isApplyCentFT0CVariant2) { + cent = col.centFT0CVariant2(); + } if (isApplyCentFT0M) { cent = col.centFT0M(); } From 346c08bc84e92f5665faffbe61f66173f1640804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= <26327373+vkucera@users.noreply.github.com> Date: Thu, 9 Oct 2025 15:51:24 +0200 Subject: [PATCH 678/986] [PWGHF] Cleanup and bug fixes using cppcheck and clang-tidy (#13287) --- PWGHF/D2H/Macros/runMassFitter.C | 9 +- PWGHF/D2H/Tasks/taskCharmPolarisation.cxx | 25 ++- PWGHF/D2H/Tasks/taskSigmacToCascade.cxx | 7 +- PWGHF/HFC/Macros/DhCorrelationExtraction.cxx | 26 +-- PWGHF/HFC/Macros/DhCorrelationFitter.cxx | 153 +++++++++--------- PWGHF/HFC/Macros/FitCorrel.C | 29 ++-- .../HFC/TableProducer/correlatorD0Hadrons.cxx | 20 +-- .../HFC/TableProducer/correlatorDsHadrons.cxx | 16 +- .../HFC/TableProducer/femtoDreamProducer.cxx | 7 +- PWGHF/HFC/Tasks/taskFlow.cxx | 5 +- .../computeFonllPlusPythiaPredictions.C | 2 +- .../TableProducer/candidateCreator2Prong.cxx | 30 ++-- .../TableProducer/candidateCreator3Prong.cxx | 32 ++-- PWGHF/TableProducer/candidateCreatorXicc.cxx | 19 +-- PWGHF/TableProducer/candidateSelectorLc.cxx | 10 +- .../candidateSelectorXicToPKPi.cxx | 10 +- .../candidateSelectorXicToXiPiPi.cxx | 10 +- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 12 +- PWGHF/Tasks/taskMcEfficiency.cxx | 4 +- PWGHF/Tasks/taskMcValidation.cxx | 11 +- 20 files changed, 182 insertions(+), 255 deletions(-) diff --git a/PWGHF/D2H/Macros/runMassFitter.C b/PWGHF/D2H/Macros/runMassFitter.C index d83c0f7b7a5..0b926b321f0 100644 --- a/PWGHF/D2H/Macros/runMassFitter.C +++ b/PWGHF/D2H/Macros/runMassFitter.C @@ -237,14 +237,14 @@ int runMassFitter(const TString& configFileName) hMass[iSliceVar] = inputFile->Get(inputHistoName[iSliceVar].data()); if (enableRefl) { hMassRefl[iSliceVar] = inputFileRefl->Get(reflHistoName[iSliceVar].data()); - hMassSgn[iSliceVar] = inputFileRefl->Get(fdHistoName[iSliceVar].data()); - hMassSgn[iSliceVar]->Add(inputFileRefl->Get(promptHistoName[iSliceVar].data())); if (hMassRefl[iSliceVar] == nullptr) { throw std::runtime_error("ERROR: MC reflection histogram not found! Exit!"); } + hMassSgn[iSliceVar] = inputFileRefl->Get(fdHistoName[iSliceVar].data()); if (hMassSgn[iSliceVar] == nullptr) { throw std::runtime_error("ERROR: MC prompt or FD histogram not found! Exit!"); } + hMassSgn[iSliceVar]->Add(inputFileRefl->Get(promptHistoName[iSliceVar].data())); } } else { hMass[iSliceVar] = inputFile->Get(promptHistoName[iSliceVar].data()); @@ -505,9 +505,6 @@ int runMassFitter(const TString& configFileName) hRawYieldsChiSquareTotal->SetBinError(iSliceVar + 1, 1.e-20); if (enableRefl) { hReflectionOverSignal->SetBinContent(iSliceVar + 1, reflOverSgn); - } - - if (enableRefl) { if (nSliceVarBins > 1) { canvasRefl[iCanvas]->cd(iSliceVar - nCanvasesMax * iCanvas + 1); } else { @@ -625,7 +622,7 @@ void divideCanvas(TCanvas* canvas, int nSliceVarBins) } } -int main(int argc, char* argv[]) +int main(int argc, const char* argv[]) { if (argc == 1) { throw std::runtime_error("Not enough arguments. Please use\n./runMassFitter configFileName"); diff --git a/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx b/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx index 60e8c1e6bb8..85168f089b5 100644 --- a/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx +++ b/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx @@ -1393,8 +1393,8 @@ struct HfTaskCharmPolarisation { template bool isInSignalRegion(float invMass) { - float invMassMin = 0.f; - float invMassMax = 100.f; + float invMassMin; + float invMassMax; if constexpr (Channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ invMassMin = 0.142f; invMassMax = 0.15f; @@ -1576,7 +1576,7 @@ struct HfTaskCharmPolarisation { // 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}, invMassKPiLc{0.f}, invMassPKLc{0.f}, invMassPPiLc{0.f}; + double massDau{0.}, invMassCharmHad{0.}, invMassCharmHadForSparse{0.}, invMassD0{0.}, invMassKPiLc{0.}, invMassPKLc{0.}, invMassPPiLc{0.}; float rapidity{-999.f}; std::array outputMl{-1.f, -1.f, -1.f}; int isRotatedCandidate = 0; // currently meaningful only for Lc->pKpi @@ -1834,12 +1834,11 @@ struct HfTaskCharmPolarisation { float const xQvec = (*qVecs).at(0); float const yQvec = (*qVecs).at(1); ROOT::Math::XYZVector const qVecNorm = ROOT::Math::XYZVector(yQvec, -xQvec, 0.f); - float cosThetaStarEP = -10.f; float const phiEP = -99.f; if (activateTHnSparseCosThStarEP) { // EP - cosThetaStarEP = qVecNorm.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(qVecNorm.Mag2()); + float cosThetaStarEP = qVecNorm.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(qVecNorm.Mag2()); fillRecoHistos(invMassCharmHadForSparse, ptCharmHad, numPvContributors, rapidity, invMassD0, invMassKPiLc, cosThetaStarEP, phiEP, outputMl, isRotatedCandidate, origin, ptBhadMother, resoChannelLc, absEtaTrackMin, numItsClsMin, numTpcClsMin, charge, nMuons, partRecoDstar); } } @@ -2310,8 +2309,7 @@ struct HfTaskCharmPolarisation { TracksWithExtra const& tracks) { for (const auto& collision : collisions) { - float centrality = {-1.f}; - centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); + const auto centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); if (centrality < centralityMin || centrality > centralityMax) { continue; // skip this collision if outside of the centrality range } @@ -2340,8 +2338,7 @@ struct HfTaskCharmPolarisation { TracksWithExtra const& tracks) { for (const auto& collision : collisions) { - float centrality = {-1.f}; - centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); + const auto centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); if (centrality < centralityMin || centrality > centralityMax) { continue; // skip this collision if outside of the centrality range } @@ -2371,11 +2368,10 @@ struct HfTaskCharmPolarisation { FilteredCandDstarWSelFlagAndMc const& dstarCandidates, TracksWithExtra const& tracks) { - float centrality = {-1.f}; int numPvContributorsGen{0}; for (const auto& collision : collisions) { // loop over reco collisions associated to this gen collision - centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); + const auto centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); if (centrality < centralityMin || centrality > centralityMax) { continue; // skip this collision if outside of the centrality range } @@ -2400,7 +2396,7 @@ struct HfTaskCharmPolarisation { } for (const auto& mcParticle : mcParticles) { const auto& recoCollsPerMcColl = collisions.sliceBy(colPerMcCollision, mcParticle.mcCollision().globalIndex()); - float const cent = o2::hf_centrality::getCentralityGenColl(recoCollsPerMcColl, centEstimator); + const auto cent = o2::hf_centrality::getCentralityGenColl(recoCollsPerMcColl, centEstimator); runMcGenPolarisationAnalysis(mcParticle, mcParticles, numPvContributorsGen, ¢); } } @@ -2412,11 +2408,10 @@ struct HfTaskCharmPolarisation { FilteredCandDstarWSelFlagAndMcAndMl const& dstarCandidates, TracksWithExtra const& tracks) { - float centrality = {-1.f}; int numPvContributorsGen{0}; for (const auto& collision : collisions) { // loop over reco collisions associated to this gen collision - centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); + const auto centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); if (centrality < centralityMin || centrality > centralityMax) { continue; // skip this collision if outside of the centrality range } @@ -2441,7 +2436,7 @@ struct HfTaskCharmPolarisation { } for (const auto& mcParticle : mcParticles) { const auto& recoCollsPerMcColl = collisions.sliceBy(colPerMcCollision, mcParticle.mcCollision().globalIndex()); - float const cent = o2::hf_centrality::getCentralityGenColl(recoCollsPerMcColl, centEstimator); + const auto cent = o2::hf_centrality::getCentralityGenColl(recoCollsPerMcColl, centEstimator); runMcGenPolarisationAnalysis(mcParticle, mcParticles, numPvContributorsGen, ¢); } } diff --git a/PWGHF/D2H/Tasks/taskSigmacToCascade.cxx b/PWGHF/D2H/Tasks/taskSigmacToCascade.cxx index 5d6a27f7141..8cb1013323e 100644 --- a/PWGHF/D2H/Tasks/taskSigmacToCascade.cxx +++ b/PWGHF/D2H/Tasks/taskSigmacToCascade.cxx @@ -140,7 +140,6 @@ struct HfTaskSigmacToCascade { { for (const auto& candSc : candScs) { const auto& candidateLc = candSc.prongLc_as(); - float massSc(-1.), massLc(-1.), deltaMass(-1.); float ptSc(candSc.pt()), ptLc(candidateLc.pt()); float const etaSc(candSc.eta()) /*, etaLc(candidateLc.eta())*/; float const phiSc(candSc.phi()) /*, phiLc(candidateLc.phi())*/; @@ -149,9 +148,9 @@ struct HfTaskSigmacToCascade { float cpaLc(candidateLc.cpa()), cpaXYLc(candidateLc.cpaXY()); float y(-1.); - massLc = hfHelper.invMassLcToK0sP(candidateLc); - massSc = hfHelper.invMassScRecoLcToK0sP(candSc, candidateLc); - deltaMass = massSc - massLc; + auto massLc = hfHelper.invMassLcToK0sP(candidateLc); + auto massSc = hfHelper.invMassScRecoLcToK0sP(candSc, candidateLc); + auto deltaMass = massSc - massLc; if (candSc.charge() == 0) { y = hfHelper.ySc0(candSc); } else if (candSc.charge() == 2) { diff --git a/PWGHF/HFC/Macros/DhCorrelationExtraction.cxx b/PWGHF/HFC/Macros/DhCorrelationExtraction.cxx index ebf50d0f10e..6459c54c437 100644 --- a/PWGHF/HFC/Macros/DhCorrelationExtraction.cxx +++ b/PWGHF/HFC/Macros/DhCorrelationExtraction.cxx @@ -116,6 +116,8 @@ DhCorrelationExtraction::DhCorrelationExtraction(const DhCorrelationExtraction& fFilePromptMc(source.fFilePromptMc), fFileNonPromptMc(source.fFileNonPromptMc), fDirMass(source.fDirMass), + fDirSE(source.fDirSE), + fDirME(source.fDirME), fDirSecPart(source.fDirSecPart), fCorrectedCorrHisto(source.fCorrectedCorrHisto), fCorrectedCorrHistoBaselineSubtr(source.fCorrectedCorrHistoBaselineSubtr), @@ -942,16 +944,15 @@ Bool_t DhCorrelationExtraction::readInputSecondaryPartContamination() TH1D* DhCorrelationExtraction::evaluateMcClosModulations(Double_t ptCandMin, Double_t ptCandMax, Double_t ptHadMin, Double_t ptHadMax) { - TH1D* hModul = new TH1D(); + TH1D* hModul = nullptr; fFilePromptMc = TFile::Open(fFilePromptMcRecName.Data()); - fFileNonPromptMc = TFile::Open(fFileNonPromptMcRecName.Data()); - if (fFilePromptMc == nullptr) { - std::cout << "[ERROR] File prompt MC rec cannot be opened! check your file path!" << std::endl; + throw std::runtime_error("[ERROR] File prompt MC rec cannot be opened! check your file path!"); } + fFileNonPromptMc = TFile::Open(fFileNonPromptMcRecName.Data()); if (fFileNonPromptMc == nullptr) { - std::cout << "[ERROR] File non-prompt MC rec cannot be opened! check your file path!" << std::endl; + throw std::runtime_error("[ERROR] File non-prompt MC rec cannot be opened! check your file path!"); } // TODO: generalise this part @@ -1019,7 +1020,7 @@ TH1D* DhCorrelationExtraction::evaluateMcClosModulations(Double_t ptCandMin, Dou TH2D* DhCorrelationExtraction::getCorrelHisto(Int_t sEorMe, Int_t sorSb, Int_t pool, Double_t ptCandMin, Double_t ptCandMax, Double_t ptHadMin, Double_t ptHadMax) { // TODO: Subtraction of softpion - TH2D* h2D = new TH2D(); // pointer to be returned + TH2D* h2D = nullptr; // pointer to be returned THnSparseD* hSparse = nullptr; if (sEorMe == kSE) { // Same Event @@ -1027,7 +1028,7 @@ TH2D* DhCorrelationExtraction::getCorrelHisto(Int_t sEorMe, Int_t sorSb, Int_t p hSparse = reinterpret_cast(fDirSE->Get(fSECorrelSignalRegionName.Data())); } else if (!fSidebandDivided) { hSparse = reinterpret_cast(fDirSE->Get(fSECorrelSidebandsName.Data())); - } else if (fSidebandDivided) { + } else { if (fUseSidebLeft && !fUseSidebRight) { hSparse = reinterpret_cast(fDirSE->Get(fSECorrelSidebandLeftName.Data())); } else if (!fUseSidebLeft && fUseSidebRight) { @@ -1044,7 +1045,7 @@ TH2D* DhCorrelationExtraction::getCorrelHisto(Int_t sEorMe, Int_t sorSb, Int_t p hSparse = reinterpret_cast(fDirME->Get(fMECorrelSignalRegionName.Data())); } else if (!fSidebandDivided) { hSparse = reinterpret_cast(fDirME->Get(fMECorrelSidebandsName.Data())); - } else if (fSidebandDivided) { + } else { if (fUseSidebLeft && !fUseSidebRight) { hSparse = reinterpret_cast(fDirME->Get(fMECorrelSidebandLeftName.Data())); } else if (!fUseSidebLeft && fUseSidebRight) { @@ -1183,7 +1184,7 @@ void DhCorrelationExtraction::getSignalAndBackgroundForNorm(Double_t ptCandMin, TH2D* DhCorrelationExtraction::getFdTemplateHisto(Int_t promptOrFd, Double_t ptCandMin, Double_t ptCandMax, Double_t ptHadMin, Double_t ptHadMax) { - TH2D* h2D = new TH2D(); // pointer to be returned + TH2D* h2D = nullptr; // pointer to be returned if (promptOrFd == kPrompt) { h2D = reinterpret_cast(fFileFDTemplate->Get(Form("%s%.0f_%.0f_ptassoc%.0f_%.0f", fHistoFDTemplatePromptName.Data(), ptCandMin, ptCandMax, ptHadMin, ptHadMax))); @@ -1215,7 +1216,7 @@ TH2D* DhCorrelationExtraction::getFdTemplateHisto(Int_t promptOrFd, Double_t ptC TH1D* DhCorrelationExtraction::getCorrelHistoSecondaryPart(Int_t partType, Double_t ptCandMin, Double_t ptCandMax, Double_t ptHadMin, Double_t ptHadMax) { - TH1D* h1D = new TH1D(); // pointer to be returned + TH1D* h1D = nullptr; // pointer to be returned THnSparseD* hSparse = nullptr; @@ -1329,8 +1330,7 @@ TH1D* DhCorrelationExtraction::reflectHistoRun2(TH1D* h, Double_t scale) Double_t DhCorrelationExtraction::getFdPromptFrac(Double_t ptCandMin, Double_t ptCandMax, Double_t /*ptHadMin*/, Double_t /*ptHadMax*/) { - TH1D* h1D = new TH1D(); - h1D = reinterpret_cast(fFileFDPromptFrac->Get(fHistoFDPromptFracName.Data())); + TH1D* h1D = reinterpret_cast(fFileFDPromptFrac->Get(fHistoFDPromptFracName.Data())); Int_t const binPtCandMin = h1D->GetXaxis()->FindBin(ptCandMin + 0.01); Int_t const binPtCandMax = h1D->GetXaxis()->FindBin(ptCandMax - 0.01); @@ -1380,7 +1380,7 @@ Double_t DhCorrelationExtraction::calculateBaseline(TH1D*& histo, Bool_t totalRa // total range = 2*Pi // half range = Pi , for histogram reflected under symmetric assumption - Double_t baseline, errBaseline; + Double_t baseline; Int_t const nBinsPhi = histo->GetNbinsX(); Int_t const binPhiHalf = nBinsPhi / 2; Int_t const binPhiHalfMinus1 = nBinsPhi / 2 - 1; diff --git a/PWGHF/HFC/Macros/DhCorrelationFitter.cxx b/PWGHF/HFC/Macros/DhCorrelationFitter.cxx index a69a1ab4a2e..35e023153d3 100644 --- a/PWGHF/HFC/Macros/DhCorrelationFitter.cxx +++ b/PWGHF/HFC/Macros/DhCorrelationFitter.cxx @@ -38,81 +38,79 @@ #include DhCorrelationFitter::DhCorrelationFitter() : // default constructor + fHist(nullptr), + fFit(nullptr), + fGausNS(nullptr), + fGausAS(nullptr), + fPed(nullptr), + fBaseTransvReg(nullptr), fIsReflected(kFALSE), - fTypeOfFitFunc(kConstwoGaus), - fFixBase(0), - fFixMean(0), - fMinCandPt(0.), - fMaxCandPt(99.), - fMinAssoPt(0.), - fMaxAssoPt(99.), - fNpars(0), - fExtParsVals(nullptr), - fExtParsLowBounds(nullptr), - fExtParsUppBounds(nullptr), fUseExternalPars(kFALSE), fShiftBaselineUp(kFALSE), fShiftBaselineDown(kFALSE), fIsTotal(kTRUE), + fTypeOfFitFunc(kConstwoGaus), + fFixBase(0), + fFixMean(0), + fNpars(0), fNbasleinePoints(0), fBinsBaseline(nullptr), - fHist(nullptr), fMinCorr(0), fMaxCorr(0), + fMinCandPt(0.), + fMaxCandPt(99.), + fMinAssoPt(0.), + fMaxAssoPt(99.), fBaseline(0.), fErrBaseline(0.), - fFit(nullptr), - fGausNS(nullptr), - fGausAS(nullptr), - fPed(nullptr), - fv2AssocPart(0.), - fv2Dmeson(0.), fNSyieldBinCount(0.), fErrNSyieldBinCount(0.), fASyieldBinCount(0.), - fErrASyieldBinCount(0.) + fErrASyieldBinCount(0.), + fv2AssocPart(0.), + fv2Dmeson(0.), + fExtParsVals(nullptr), + fExtParsLowBounds(nullptr), + fExtParsUppBounds(nullptr) { } DhCorrelationFitter::DhCorrelationFitter(TH1F* histoToFit, Double_t min, Double_t max) : // standard constructor + fHist(histoToFit), + fFit(nullptr), + fGausNS(nullptr), + fGausAS(nullptr), + fPed(nullptr), + fBaseTransvReg(nullptr), fIsReflected(kFALSE), + fUseExternalPars(kFALSE), + fShiftBaselineUp(kFALSE), + fShiftBaselineDown(kFALSE), + fIsTotal(kTRUE), fTypeOfFitFunc(kConstwoGaus), fFixBase(0), fFixMean(0), + fNpars(0), + fNbasleinePoints(0), + fBinsBaseline(nullptr), + fMinCorr(min), + fMaxCorr(max), fMinCandPt(0.), fMaxCandPt(99.), fMinAssoPt(0.), fMaxAssoPt(99.), - fNpars(0), - fExtParsVals(nullptr), - fExtParsLowBounds(nullptr), - fExtParsUppBounds(nullptr), - fUseExternalPars(kFALSE), - fShiftBaselineUp(kFALSE), - fShiftBaselineDown(kFALSE), - fIsTotal(kTRUE), - fNbasleinePoints(0), - fBinsBaseline(nullptr), - fHist(nullptr), - fMinCorr(0.), - fMaxCorr(0.), fBaseline(0.), fErrBaseline(0.), - fFit(nullptr), - fGausNS(nullptr), - fGausAS(nullptr), - fPed(nullptr), - fBaseTransvReg(nullptr), - fv2AssocPart(0.), - fv2Dmeson(0.), fNSyieldBinCount(0.), fErrNSyieldBinCount(0.), fASyieldBinCount(0.), - fErrASyieldBinCount(0.) + fErrASyieldBinCount(0.), + fv2AssocPart(0.), + fv2Dmeson(0.), + fExtParsVals(nullptr), + fExtParsLowBounds(nullptr), + fExtParsUppBounds(nullptr) { - fHist = histoToFit; - fMinCorr = min; - fMaxCorr = max; } DhCorrelationFitter::DhCorrelationFitter(const DhCorrelationFitter& source) @@ -163,6 +161,9 @@ DhCorrelationFitter& DhCorrelationFitter::operator=(const DhCorrelationFitter& c fExtParsLowBounds = cfit.fExtParsLowBounds; fExtParsUppBounds = cfit.fExtParsUppBounds; fUseExternalPars = cfit.fUseExternalPars; + fShiftBaselineUp = cfit.fShiftBaselineUp; + fShiftBaselineDown = cfit.fShiftBaselineDown; + fIsTotal = cfit.fIsTotal; fNbasleinePoints = cfit.fNbasleinePoints; fBinsBaseline = cfit.fBinsBaseline; fHist = cfit.fHist; @@ -174,6 +175,9 @@ DhCorrelationFitter& DhCorrelationFitter::operator=(const DhCorrelationFitter& c fGausNS = cfit.fGausNS; fGausAS = cfit.fGausAS; fPed = cfit.fPed; + fBaseTransvReg = cfit.fBaseTransvReg; + fv2AssocPart = cfit.fv2AssocPart; + fv2Dmeson = cfit.fv2Dmeson; fNSyieldBinCount = cfit.fNSyieldBinCount; fErrNSyieldBinCount = cfit.fErrNSyieldBinCount; fASyieldBinCount = cfit.fASyieldBinCount; @@ -622,6 +626,7 @@ Double_t DhCorrelationFitter::findBaseline() } Double_t errAv = 0., av = 0.; TMath::Sort(fHist->GetNbinsX(), hval, ind, kFALSE); // KFALSE -> increasing order + delete[] hval; // Average of abs(fFixBase) lower points for (Int_t k = 0; k < npointsAv; k++) { if (fHist->GetBinError(ind[k] + 1) == 0.) // in case of null entries which induce a crash. Could bias the basline in upward direction! @@ -633,6 +638,7 @@ Double_t DhCorrelationFitter::findBaseline() av += fHist->GetBinContent(ind[k] + 1) / (fHist->GetBinError(ind[k] + 1) * fHist->GetBinError(ind[k] + 1)); errAv += 1. / (fHist->GetBinError(ind[k] + 1) * fHist->GetBinError(ind[k] + 1)); } + delete[] ind; av /= errAv; errAv = TMath::Sqrt(1. / errAv); printf("[RESULT] Average fBaseline: %.3f +- %.3f", av, errAv); @@ -802,7 +808,7 @@ Double_t DhCorrelationFitter::calculateBaseline(TH1F*& histo, Bool_t totalRange) // total range = 2*Pi // half range = Pi , for histogram reflected under symmetric assumption - Double_t baseline, errBaseline; + Double_t baseline; Int_t const nBinsPhi = histo->GetNbinsX(); Int_t const binPhiHalf = nBinsPhi / 2; Int_t const binPhiHalfMinus1 = nBinsPhi / 2 - 1; @@ -956,11 +962,11 @@ void DhCorrelationFitter::setSingleTermsForDrawing(Bool_t draw) pvStatTests1->SetFillStyle(0); pvStatTests1->SetTextSize(0.045); pvStatTests1->SetBorderSize(0); - TText *t0, *t1, *t2, *t3; - t0 = pvStatTests1->AddText(0., 1.00, Form("#chi^{2}/ndf = %.1f/%d ", fFit->GetChisquare(), fFit->GetNDF())); - t1 = pvStatTests1->AddText(0., 0.80, Form("Ped = %.3f#pm%.3f ", fBaseline, fErrBaseline)); - t2 = pvStatTests1->AddText(0., 0.65, Form("AS Y = %.3f#pm%.3f ", fFit->GetParameter("AS Y"), fFit->GetParError(fFit->GetParNumber("AS Y")))); - t3 = pvStatTests1->AddText(0., 0.50, Form("AS #sigma = %.3f#pm%.3f ", fFit->GetParameter("AS #sigma"), fFit->GetParError(fFit->GetParNumber("AS #sigma")))); + // TText *t0, *t1, *t2, *t3; + // t0 = pvStatTests1->AddText(0., 1.00, Form("#chi^{2}/ndf = %.1f/%d ", fFit->GetChisquare(), fFit->GetNDF())); + // t1 = pvStatTests1->AddText(0., 0.80, Form("Ped = %.3f#pm%.3f ", fBaseline, fErrBaseline)); + // t2 = pvStatTests1->AddText(0., 0.65, Form("AS Y = %.3f#pm%.3f ", fFit->GetParameter("AS Y"), fFit->GetParError(fFit->GetParNumber("AS Y")))); + // t3 = pvStatTests1->AddText(0., 0.50, Form("AS #sigma = %.3f#pm%.3f ", fFit->GetParameter("AS #sigma"), fFit->GetParError(fFit->GetParNumber("AS #sigma")))); if (draw) { fFit->Draw("same"); @@ -996,14 +1002,14 @@ void DhCorrelationFitter::setSingleTermsForDrawing(Bool_t draw) pvStatTests1->SetFillStyle(0); pvStatTests1->SetTextSize(0.045); pvStatTests1->SetBorderSize(0); - TText *t0, *t1, *t2, *t3, *t4, *t5, *t6; - t0 = pvStatTests1->AddText(0., 1.00, Form("#chi^{2}/ndf = %.1f/%d ", fFit->GetChisquare(), fFit->GetNDF())); - t1 = pvStatTests1->AddText(0., 0.80, Form("Ped = %.3f#pm%.3f ", fBaseline, fErrBaseline)); - t2 = pvStatTests1->AddText(0., 0.65, Form("NS Y = %.3f#pm%.3f ", fFit->GetParameter("NS Y"), fFit->GetParError(fFit->GetParNumber("NS Y")))); - t3 = pvStatTests1->AddText(0., 0.50, Form("NS #sigma = %.3f#pm%.3f ", fFit->GetParameter("NS #sigma"), fFit->GetParError(fFit->GetParNumber("NS #sigma")))); - t4 = pvStatTests1->AddText(0., 0.35, Form("AS Y = %.3f#pm%.3f ", fFit->GetParameter("AS Y"), fFit->GetParError(fFit->GetParNumber("AS Y")))); - t5 = pvStatTests1->AddText(0., 0.20, Form("AS #sigma = %.3f#pm%.3f ", fFit->GetParameter("AS #sigma"), fFit->GetParError(fFit->GetParNumber("AS #sigma")))); - t6 = pvStatTests1->AddText(0., 0.05, Form("#beta = %.3f#pm%.3f ", fFit->GetParameter("NS shape par"), fFit->GetParError(fFit->GetParNumber("NS shape par")))); + // TText *t0, *t1, *t2, *t3, *t4, *t5, *t6; + // t0 = pvStatTests1->AddText(0., 1.00, Form("#chi^{2}/ndf = %.1f/%d ", fFit->GetChisquare(), fFit->GetNDF())); + // t1 = pvStatTests1->AddText(0., 0.80, Form("Ped = %.3f#pm%.3f ", fBaseline, fErrBaseline)); + // t2 = pvStatTests1->AddText(0., 0.65, Form("NS Y = %.3f#pm%.3f ", fFit->GetParameter("NS Y"), fFit->GetParError(fFit->GetParNumber("NS Y")))); + // t3 = pvStatTests1->AddText(0., 0.50, Form("NS #sigma = %.3f#pm%.3f ", fFit->GetParameter("NS #sigma"), fFit->GetParError(fFit->GetParNumber("NS #sigma")))); + // t4 = pvStatTests1->AddText(0., 0.35, Form("AS Y = %.3f#pm%.3f ", fFit->GetParameter("AS Y"), fFit->GetParError(fFit->GetParNumber("AS Y")))); + // t5 = pvStatTests1->AddText(0., 0.20, Form("AS #sigma = %.3f#pm%.3f ", fFit->GetParameter("AS #sigma"), fFit->GetParError(fFit->GetParNumber("AS #sigma")))); + // t6 = pvStatTests1->AddText(0., 0.05, Form("#beta = %.3f#pm%.3f ", fFit->GetParameter("NS shape par"), fFit->GetParError(fFit->GetParNumber("NS shape par")))); if (draw) { fFit->Draw("same"); @@ -1046,21 +1052,21 @@ void DhCorrelationFitter::setSingleTermsForDrawing(Bool_t draw) pvStatTests1->SetFillStyle(0); pvStatTests1->SetTextSize(0.045); pvStatTests1->SetBorderSize(0); - TText *t0, *t1, *t2, *t3, *t4, *t5, *t6, *t7, *t8; - t0 = pvStatTests1->AddText(0., 1.00, Form("#chi^{2}/ndf = %.1f/%d ", fFit->GetChisquare(), fFit->GetNDF())); - t2 = pvStatTests1->AddText(0., 0.80, Form("NS Y = %.3f#pm%.3f ", fFit->GetParameter("NS Y"), fFit->GetParError(fFit->GetParNumber("NS Y")))); - t3 = pvStatTests1->AddText(0., 0.65, Form("NS #sigma = %.3f#pm%.3f ", fFit->GetParameter("NS #sigma"), fFit->GetParError(fFit->GetParNumber("NS #sigma")))); - t4 = pvStatTests1->AddText(0., 0.50, Form("AS Y = %.3f#pm%.3f ", fFit->GetParameter("AS Y"), fFit->GetParError(fFit->GetParNumber("AS Y")))); - t5 = pvStatTests1->AddText(0., 0.35, Form("AS #sigma = %.3f#pm%.3f ", fFit->GetParameter("AS #sigma"), fFit->GetParError(fFit->GetParNumber("AS #sigma")))); + // TText *t0, *t1, *t2, *t3, *t4, *t5, *t6, *t7, *t8; + // t0 = pvStatTests1->AddText(0., 1.00, Form("#chi^{2}/ndf = %.1f/%d ", fFit->GetChisquare(), fFit->GetNDF())); + // t2 = pvStatTests1->AddText(0., 0.80, Form("NS Y = %.3f#pm%.3f ", fFit->GetParameter("NS Y"), fFit->GetParError(fFit->GetParNumber("NS Y")))); + // t3 = pvStatTests1->AddText(0., 0.65, Form("NS #sigma = %.3f#pm%.3f ", fFit->GetParameter("NS #sigma"), fFit->GetParError(fFit->GetParNumber("NS #sigma")))); + // t4 = pvStatTests1->AddText(0., 0.50, Form("AS Y = %.3f#pm%.3f ", fFit->GetParameter("AS Y"), fFit->GetParError(fFit->GetParNumber("AS Y")))); + // t5 = pvStatTests1->AddText(0., 0.35, Form("AS #sigma = %.3f#pm%.3f ", fFit->GetParameter("AS #sigma"), fFit->GetParError(fFit->GetParNumber("AS #sigma")))); // t6 = pvStatTests1 -> AddText(0., 0.20, Form("#beta = %.3f#pm%.3f ", fFit -> GetParameter("NS shape par"), fFit -> GetParError(fFit->GetParNumber("NS shape par")))); auto* pvStatTests2 = new TPaveText(0.51, 0.28, 0.85, 0.60, "NDC"); pvStatTests2->SetFillStyle(0); pvStatTests2->SetTextSize(0.045); pvStatTests2->SetBorderSize(0); - t1 = pvStatTests2->AddText(0., 1.00, Form("Ped = %.3f#pm%.3f ", fFit->GetParameter("ped"), fErrBaseline /*fFit -> GetParError(fFit->GetParNumber("ped")*/)); - t7 = pvStatTests2->AddText(0., 0.65, Form("v_{2}^{hadron} = %.3f#pm%.3f ", fFit->GetParameter("v_{2} hadron"), fFit->GetParError(fFit->GetParNumber("v_{2} hadron")))); - t8 = pvStatTests2->AddText(0., 0.35, Form("v_{2}^{D} = %.3f#pm%.3f ", fFit->GetParameter("v_{2} D meson"), fFit->GetParError(fFit->GetParNumber("v_{2} D meson")))); + // t1 = pvStatTests2->AddText(0., 1.00, Form("Ped = %.3f#pm%.3f ", fFit->GetParameter("ped"), fErrBaseline /*fFit -> GetParError(fFit->GetParNumber("ped")*/)); + // t7 = pvStatTests2->AddText(0., 0.65, Form("v_{2}^{hadron} = %.3f#pm%.3f ", fFit->GetParameter("v_{2} hadron"), fFit->GetParError(fFit->GetParNumber("v_{2} hadron")))); + // t8 = pvStatTests2->AddText(0., 0.35, Form("v_{2}^{D} = %.3f#pm%.3f ", fFit->GetParameter("v_{2} D meson"), fFit->GetParError(fFit->GetParNumber("v_{2} D meson")))); if (draw) { fFit->Draw("same"); @@ -1098,13 +1104,13 @@ void DhCorrelationFitter::setSingleTermsForDrawing(Bool_t draw) pvStatTests1->SetFillStyle(0); pvStatTests1->SetTextSize(0.045); pvStatTests1->SetBorderSize(0); - TText *t0, *t1, *t2, *t3, *t4, *t5, *t6; - t0 = pvStatTests1->AddText(0., 1.00, Form("#chi^{2}/ndf = %.1f/%d ", fFit->GetChisquare(), fFit->GetNDF())); - t1 = pvStatTests1->AddText(0., 0.80, Form("Ped = %.3f#pm%.3f ", fBaseline, fErrBaseline)); - t2 = pvStatTests1->AddText(0., 0.65, Form("NS Y = %.3f#pm%.3f ", fFit->GetParameter("NS Y"), fFit->GetParError(fFit->GetParNumber("NS Y")))); - t3 = pvStatTests1->AddText(0., 0.50, Form("NS #sigma = %.3f#pm%.3f ", fFit->GetParameter("NS #sigma"), fFit->GetParError(fFit->GetParNumber("NS #sigma")))); - t4 = pvStatTests1->AddText(0., 0.35, Form("AS Y = %.3f#pm%.3f ", fFit->GetParameter("AS Y"), fFit->GetParError(fFit->GetParNumber("AS Y")))); - t5 = pvStatTests1->AddText(0., 0.20, Form("AS #sigma = %.3f#pm%.3f ", fFit->GetParameter("AS #sigma"), fFit->GetParError(fFit->GetParNumber("AS #sigma")))); + // TText *t0, *t1, *t2, *t3, *t4, *t5, *t6; + // t0 = pvStatTests1->AddText(0., 1.00, Form("#chi^{2}/ndf = %.1f/%d ", fFit->GetChisquare(), fFit->GetNDF())); + // t1 = pvStatTests1->AddText(0., 0.80, Form("Ped = %.3f#pm%.3f ", fBaseline, fErrBaseline)); + // t2 = pvStatTests1->AddText(0., 0.65, Form("NS Y = %.3f#pm%.3f ", fFit->GetParameter("NS Y"), fFit->GetParError(fFit->GetParNumber("NS Y")))); + // t3 = pvStatTests1->AddText(0., 0.50, Form("NS #sigma = %.3f#pm%.3f ", fFit->GetParameter("NS #sigma"), fFit->GetParError(fFit->GetParNumber("NS #sigma")))); + // t4 = pvStatTests1->AddText(0., 0.35, Form("AS Y = %.3f#pm%.3f ", fFit->GetParameter("AS Y"), fFit->GetParError(fFit->GetParNumber("AS Y")))); + // t5 = pvStatTests1->AddText(0., 0.20, Form("AS #sigma = %.3f#pm%.3f ", fFit->GetParameter("AS #sigma"), fFit->GetParError(fFit->GetParNumber("AS #sigma")))); if (draw) { fFit->Draw("same"); @@ -1114,4 +1120,5 @@ void DhCorrelationFitter::setSingleTermsForDrawing(Bool_t draw) pvStatTests1->Draw("same"); } } + delete[] par; } diff --git a/PWGHF/HFC/Macros/FitCorrel.C b/PWGHF/HFC/Macros/FitCorrel.C index 11e5b0c5742..72461f06dc3 100644 --- a/PWGHF/HFC/Macros/FitCorrel.C +++ b/PWGHF/HFC/Macros/FitCorrel.C @@ -173,12 +173,11 @@ void fitCorrelDs(const TString cfgFileName = "config_CorrAnalysis.json") // Input parameters for fitting const int npars{10}; // PED NSY NSM NSW ASY ASM ASW BETA v2D v2h - Double_t vals[npars] = {3., 2., 0., 0.5, 2., 3.14, 0.3, 2., 0.1, 0.1}; - Double_t lowBounds[npars] = {0., 0., -1., 0., 0., 2., 0., 0.5, 0., 0.}; - Double_t uppBounds[npars] = {9999., 999., 1., 3.14 / 3., 999., 4., 3.14 / 2., 3.5, 0.5, 0.5}; - - Double_t const v2AssocPart[nBinsPtD] = {0.15, 0.15, 0.15, 0.15}; - Double_t const v2Dmeson[nBinsPtD] = {0.175, 0.09, 0.04, 0.04}; + const Double_t vals[npars] = {3., 2., 0., 0.5, 2., 3.14, 0.3, 2., 0.1, 0.1}; + const Double_t lowBounds[npars] = {0., 0., -1., 0., 0., 2., 0., 0.5, 0., 0.}; + const Double_t uppBounds[npars] = {9999., 999., 1., 3.14 / 3., 999., 4., 3.14 / 2., 3.5, 0.5, 0.5}; + const Double_t v2AssocPart[nBinsPtD] = {0.15, 0.15, 0.15, 0.15}; + const Double_t v2Dmeson[nBinsPtD] = {0.175, 0.09, 0.04, 0.04}; // Output histograms TH1D* hBaselin[nBinsPtHad]; @@ -347,8 +346,6 @@ void fitCorrelDs(const TString cfgFileName = "config_CorrAnalysis.json") pttext->Draw("same"); if (drawSystematicErrors) { tCorrUncDs->Draw("same"); - } - if (drawSystematicErrors) { tScaleUnc->Draw("same"); } } @@ -399,18 +396,12 @@ void fitCorrelDs(const TString cfgFileName = "config_CorrAnalysis.json") hBaselin[iBinPtHad]->SetMinimum(0); hBaselin[iBinPtHad]->Draw(); - TH1F* hBaselinSyst; - TH1F* hNSYieldSyst; - TH1F* hNSSigmaSyst; - TH1F* hASYieldSyst; - TH1F* hASSigmaSyst; - if (drawSystematicErrors) { - hBaselinSyst = reinterpret_cast(inFileFitSystematicErrors->Get(Form("hSystematicErrorsBaselinMerged_PtBinAssoc%d", iBinPtHad + 1))); - hNSYieldSyst = reinterpret_cast(inFileFitSystematicErrors->Get(Form("hSystematicErrorsNSYieldMerged_PtBinAssoc%d", iBinPtHad + 1))); - hNSSigmaSyst = reinterpret_cast(inFileFitSystematicErrors->Get(Form("hSystematicErrorsNSSigmaMerged_PtBinAssoc%d", iBinPtHad + 1))); - hASYieldSyst = reinterpret_cast(inFileFitSystematicErrors->Get(Form("hSystematicErrorsASYieldMerged_PtBinAssoc%d", iBinPtHad + 1))); - hASSigmaSyst = reinterpret_cast(inFileFitSystematicErrors->Get(Form("hSystematicErrorsASSigmaMerged_PtBinAssoc%d", iBinPtHad + 1))); + TH1F* hBaselinSyst = reinterpret_cast(inFileFitSystematicErrors->Get(Form("hSystematicErrorsBaselinMerged_PtBinAssoc%d", iBinPtHad + 1))); + TH1F* hNSYieldSyst = reinterpret_cast(inFileFitSystematicErrors->Get(Form("hSystematicErrorsNSYieldMerged_PtBinAssoc%d", iBinPtHad + 1))); + TH1F* hNSSigmaSyst = reinterpret_cast(inFileFitSystematicErrors->Get(Form("hSystematicErrorsNSSigmaMerged_PtBinAssoc%d", iBinPtHad + 1))); + TH1F* hASYieldSyst = reinterpret_cast(inFileFitSystematicErrors->Get(Form("hSystematicErrorsASYieldMerged_PtBinAssoc%d", iBinPtHad + 1))); + TH1F* hASSigmaSyst = reinterpret_cast(inFileFitSystematicErrors->Get(Form("hSystematicErrorsASSigmaMerged_PtBinAssoc%d", iBinPtHad + 1))); for (int iBinPtCand = 0; iBinPtCand < nBinsPtCand; iBinPtCand++) { hBaselinSyst->SetBinError(iBinPtCand + 1, hBaselinSyst->GetBinContent(iBinPtCand + 1) * hBaselin[iBinPtHad]->GetBinContent(iBinPtCand + 1)); diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index ab1618e8b82..7408b3f947b 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -130,11 +130,9 @@ struct HfCorrelatorD0HadronsSelection { } } if (useSel8) { - isSel8 = false; isSel8 = collision.sel8(); } if (selNoSameBunchPileUpColl) { - isNosameBunchPileUp = false; isNosameBunchPileUp = collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup); } isSelColl = isD0Found && isSel8 && isNosameBunchPileUp; @@ -449,7 +447,6 @@ struct HfCorrelatorD0Hadrons { // ========== soft pion removal =================================================== double invMassDstar1 = 0., invMassDstar2 = 0.; - bool isSoftPiD0 = false, isSoftPiD0bar = false; auto pSum2 = RecoDecay::p2(candidate.pVector(), track.pVector()); auto ePion = track.energy(massPi); invMassDstar1 = std::sqrt((ePiK + ePion) * (ePiK + ePion) - pSum2); @@ -457,24 +454,22 @@ struct HfCorrelatorD0Hadrons { if (candidate.isSelD0() >= selectionFlagD0) { if ((std::abs(invMassDstar1 - hfHelper.invMassD0ToPiK(candidate)) - softPiMass) < ptSoftPionMax) { - isSoftPiD0 = true; continue; } } if (candidate.isSelD0bar() >= selectionFlagD0bar) { if ((std::abs(invMassDstar2 - hfHelper.invMassD0barToKPi(candidate)) - softPiMass) < ptSoftPionMax) { - isSoftPiD0bar = true; continue; } } registry.fill(HIST("hTrackCounter"), 2); // fill no. of tracks after soft pion removal int signalStatus = 0; - if ((candidate.isSelD0() >= selectionFlagD0) && !isSoftPiD0) { + if (candidate.isSelD0() >= selectionFlagD0) { signalStatus += aod::hf_correlation_d0_hadron::ParticleTypeData::D0Only; } - if ((candidate.isSelD0bar() >= selectionFlagD0bar) && !isSoftPiD0bar) { + if (candidate.isSelD0bar() >= selectionFlagD0bar) { signalStatus += aod::hf_correlation_d0_hadron::ParticleTypeData::D0barOnly; } @@ -538,14 +533,12 @@ struct HfCorrelatorD0Hadrons { // MC reco level bool flagD0 = false; bool flagD0bar = false; - bool isD0Prompt = false; - bool isD0NonPrompt = false; std::vector outputMlD0 = {-1., -1., -1.}; std::vector outputMlD0bar = {-1., -1., -1.}; for (const auto& candidate : candidates) { - isD0Prompt = candidate.originMcRec() == RecoDecay::OriginType::Prompt; - isD0NonPrompt = candidate.originMcRec() == RecoDecay::OriginType::NonPrompt; + bool isD0Prompt = candidate.originMcRec() == RecoDecay::OriginType::Prompt; + bool isD0NonPrompt = candidate.originMcRec() == RecoDecay::OriginType::NonPrompt; // check decay channel flag for candidate if (!TESTBIT(candidate.hfflag(), aod::hf_cand_2prong::DecayType::D0ToPiK)) { continue; @@ -640,7 +633,6 @@ struct HfCorrelatorD0Hadrons { registry.fill(HIST("hTrackCounter"), 1); // fill no. of tracks before soft pion removal bool isPhysicalPrimary = false; - int trackOrigin = -1; // ===== soft pion removal =================================================== double invMassDstar1 = 0, invMassDstar2 = 0; bool isSoftPiD0 = false, isSoftPiD0bar = false; @@ -651,14 +643,12 @@ struct HfCorrelatorD0Hadrons { if (candidate.isSelD0() >= selectionFlagD0) { if ((std::abs(invMassDstar1 - hfHelper.invMassD0ToPiK(candidate)) - softPiMass) < ptSoftPionMax) { - isSoftPiD0 = true; continue; } } if (candidate.isSelD0bar() >= selectionFlagD0bar) { if ((std::abs(invMassDstar2 - hfHelper.invMassD0barToKPi(candidate)) - softPiMass) < ptSoftPionMax) { - isSoftPiD0bar = true; continue; } } @@ -704,7 +694,7 @@ struct HfCorrelatorD0Hadrons { if (track.has_mcParticle()) { auto mcParticle = track.template mcParticle_as(); isPhysicalPrimary = mcParticle.isPhysicalPrimary(); - trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, true); + auto trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, true); entryD0HadronGenInfo(isD0Prompt, isPhysicalPrimary, trackOrigin); } else { entryD0HadronGenInfo(isD0Prompt, isPhysicalPrimary, 0); diff --git a/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx index 7d40e1e4db1..b2368e55f04 100644 --- a/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx @@ -121,11 +121,9 @@ struct HfCorrelatorDsHadronsSelCollision { } } if (useSel8) { - isSel8 = false; isSel8 = collision.sel8(); } if (selNoSameBunchPileUpColl) { - isNosameBunchPileUp = false; isNosameBunchPileUp = collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup); } isSelColl = isDsFound && isSel8 && isNosameBunchPileUp; @@ -504,18 +502,15 @@ struct HfCorrelatorDsHadrons { registry.fill(HIST("hCollisionPoolBin"), poolBin); // MC reco level - bool isDsPrompt = false; - bool isDsSignal = false; bool isCorrectInvMassHypo = false; - bool isDecayChan = false; bool isAlreadyFilledEvent = false; float const multiplicityFT0M = collision.multFT0M(); for (const auto& candidate : candidates) { // prompt and non-prompt division - isDsPrompt = candidate.originMcRec() == RecoDecay::OriginType::Prompt; + bool isDsPrompt = candidate.originMcRec() == RecoDecay::OriginType::Prompt; // Ds Signal - isDsSignal = std::abs(candidate.flagMcMatchRec()) == hf_decay::hf_cand_3prong::DecayChannelMain::DsToPiKK; - isDecayChan = candidate.flagMcDecayChanRec() == channelsResonant[decayChannel]; + bool isDsSignal = std::abs(candidate.flagMcMatchRec()) == hf_decay::hf_cand_3prong::DecayChannelMain::DsToPiKK; + bool isDecayChan = candidate.flagMcDecayChanRec() == channelsResonant[decayChannel]; if (std::abs(hfHelper.yDs(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { continue; @@ -588,7 +583,6 @@ struct HfCorrelatorDsHadrons { continue; } bool isPhysicalPrimary = false; - int trackOrigin = -1; // DsToKKPi and DsToPiKK division if (isCorrectInvMassHypo && candidate.isSelDsToKKPi() >= selectionFlagDs) { entryDsHadronPair(getDeltaPhi(track.phi(), candidate.phi()), @@ -602,7 +596,7 @@ struct HfCorrelatorDsHadrons { if (track.has_mcParticle()) { auto mcParticle = track.template mcParticle_as(); isPhysicalPrimary = mcParticle.isPhysicalPrimary(); - trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, true); + auto trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, true); entryDsHadronGenInfo(isDsPrompt, isPhysicalPrimary, trackOrigin); } else { entryDsHadronGenInfo(isDsPrompt, isPhysicalPrimary, 0); @@ -628,7 +622,7 @@ struct HfCorrelatorDsHadrons { if (track.has_mcParticle()) { auto mcParticle = track.template mcParticle_as(); isPhysicalPrimary = mcParticle.isPhysicalPrimary(); - trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, true); + auto trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, true); entryDsHadronGenInfo(isDsPrompt, isPhysicalPrimary, trackOrigin); } else { entryDsHadronGenInfo(isDsPrompt, false, 0); diff --git a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx index f5cc68a3996..4aacaba7ec3 100644 --- a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx +++ b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx @@ -483,7 +483,7 @@ struct HfFemtoDreamProducer { float bdtScoreBkg, float bdtScorePrompt, float bdtScoreFd) { - if (functionSelection >= 1){ + if (functionSelection >= 1) { rowCandCharmHad( outputCollision.lastIndex(), timeStamp, @@ -511,7 +511,8 @@ struct HfFemtoDreamProducer { candidate.flagMcMatchRec(), candidate.originMcRec()); } - } }; + } + }; if constexpr (Channel == DecayChannel::DplusToPiKPi) { if constexpr (UseCharmMl) { @@ -576,7 +577,7 @@ struct HfFemtoDreamProducer { } } - if (!isTrackFilled) { + if (!isTrackFilled) { // FIXME: isTrackFilled is always false here isTrackFilled = fillTracksForCharmHadron(col, tracks); // If track filling was successful, fill the collision table } diff --git a/PWGHF/HFC/Tasks/taskFlow.cxx b/PWGHF/HFC/Tasks/taskFlow.cxx index f3a74f14e79..447c615f7b3 100644 --- a/PWGHF/HFC/Tasks/taskFlow.cxx +++ b/PWGHF/HFC/Tasks/taskFlow.cxx @@ -229,7 +229,6 @@ struct HfTaskFlow { o2::ccdb::CcdbApi ccdbApi; o2::ft0::Geometry ft0Det; o2::fv0::Geometry* fv0Det{}; - std::vector hfIndexCache; // ========================= // using declarations : DATA @@ -707,7 +706,7 @@ struct HfTaskFlow { double getPhiFV0(unsigned int chno) const { - int cellsInLeft[] = {0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27, 32, 40, 33, 41, 34, 42, 35, 43}; + int const cellsInLeft[] = {0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27, 32, 40, 33, 41, 34, 42, 35, 43}; bool const isChnoInLeft = std::find(std::begin(cellsInLeft), std::end(cellsInLeft), chno) != std::end(cellsInLeft); float offsetX, offsetY; if (isChnoInLeft) { @@ -743,7 +742,7 @@ struct HfTaskFlow { double getEtaFV0(unsigned int chno) const { - int cellsInLeft[] = {0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27, 32, 40, 33, 41, 34, 42, 35, 43}; + int const cellsInLeft[] = {0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27, 32, 40, 33, 41, 34, 42, 35, 43}; bool const isChnoInLeft = std::find(std::begin(cellsInLeft), std::end(cellsInLeft), chno) != std::end(cellsInLeft); float offsetX, offsetY, offsetZ; if (isChnoInLeft) { diff --git a/PWGHF/Macros/computeFonllPlusPythiaPredictions.C b/PWGHF/Macros/computeFonllPlusPythiaPredictions.C index 8b410b2b1e9..86caa6243e7 100644 --- a/PWGHF/Macros/computeFonllPlusPythiaPredictions.C +++ b/PWGHF/Macros/computeFonllPlusPythiaPredictions.C @@ -109,7 +109,7 @@ std::vector splitString(const std::string& str, char delimiter) } //__________________________________________________________________________________________________ -std::array readFonll(std::string inFile, std::string histName) +std::array readFonll(const std::string& inFile, const std::string& histName) { std::array hFonll{nullptr, nullptr, nullptr}; diff --git a/PWGHF/TableProducer/candidateCreator2Prong.cxx b/PWGHF/TableProducer/candidateCreator2Prong.cxx index dc93fc318bc..d7805b491ab 100644 --- a/PWGHF/TableProducer/candidateCreator2Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator2Prong.cxx @@ -115,22 +115,15 @@ struct HfCandidateCreator2Prong { o2::vertexing::DCAFitterN<2> df; // 2-prong vertex fitter Service ccdb; - using TracksWCovExtraPidPiKa = soa::Join; - int runNumber{0}; - float toMicrometers = 10000.; // from cm to µm - double massPi{0.}; - double massK{0.}; - double massE{0.}; - double massMu{0.}; - double massPiK{0.}; - double massKPi{0.}; - double massEE{0.}; - double massMuMu{0.}; double bz{0.}; + const float toMicrometers = 10000.; // from cm to µm + std::shared_ptr hCandidates; + using TracksWCovExtraPidPiKa = soa::Join; + ConfigurableAxis axisMass{"axisMass", {500, 1.6, 2.1}, "axis for mass (GeV/c^2)"}; HistogramRegistry registry{"registry"}; @@ -192,11 +185,6 @@ struct HfCandidateCreator2Prong { // init HF event selection helper hfEvSel.init(registry); - massPi = MassPiPlus; - massK = MassKPlus; - massE = MassElectron; - massMu = MassMuon; - if (std::accumulate(doprocessDF.begin(), doprocessDF.end(), 0) == 1) { registry.fill(HIST("hVertexerType"), aod::hf_cand::VertexerType::DCAFitter); // Configure DCAFitterN @@ -366,11 +354,11 @@ struct HfCandidateCreator2Prong { // fill histograms if (fillHistograms) { // calculate invariant masses - auto arrayMomenta = std::array{pvec0, pvec1}; - massPiK = RecoDecay::m(arrayMomenta, std::array{massPi, massK}); - massKPi = RecoDecay::m(arrayMomenta, std::array{massK, massPi}); - massEE = RecoDecay::m(arrayMomenta, std::array{massE, massE}); - massMuMu = RecoDecay::m(arrayMomenta, std::array{massMu, massMu}); + const auto arrayMomenta = std::array{pvec0, pvec1}; + const auto massPiK = RecoDecay::m(arrayMomenta, std::array{MassPiPlus, MassKPlus}); + const auto massKPi = RecoDecay::m(arrayMomenta, std::array{MassKPlus, MassPiPlus}); + const auto massEE = RecoDecay::m(arrayMomenta, std::array{MassElectron, MassElectron}); + const auto massMuMu = RecoDecay::m(arrayMomenta, std::array{MassMuon, MassMuon}); registry.fill(HIST("hMass2"), massPiK); registry.fill(HIST("hMass2"), massKPi); registry.fill(HIST("hMassEE"), massEE); diff --git a/PWGHF/TableProducer/candidateCreator3Prong.cxx b/PWGHF/TableProducer/candidateCreator3Prong.cxx index d2a852eeed9..0bf6c47fc91 100644 --- a/PWGHF/TableProducer/candidateCreator3Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator3Prong.cxx @@ -129,19 +129,9 @@ struct HfCandidateCreator3Prong { Service ccdb; int runNumber{0}; - float toMicrometers = 10000.; // from cm to µm - double massP{0.}; - double massPi{0.}; - double massK{0.}; - double massPKPi{0.}; - double massPiKP{0.}; - double massPiKPi{0.}; - double massKKPi{0.}; - double massPiKK{0.}; - double massKPi{0.}; - double massPiK{0.}; double bz{0.}; + const float toMicrometers = 10000.; // from cm to µm constexpr static float UndefValueFloat{-999.f}; using FilteredHf3Prongs = soa::Filtered; @@ -223,10 +213,6 @@ struct HfCandidateCreator3Prong { // init HF event selection helper hfEvSel.init(registry); - massP = MassProton; - massPi = MassPiPlus; - massK = MassKPlus; - // Configure DCAFitterN // df.setBz(bz); df.setPropagateToPCA(propagateToPCA); @@ -418,14 +404,14 @@ struct HfCandidateCreator3Prong { // fill histograms if (fillHistograms) { // calculate invariant mass - auto arrayMomenta = std::array{pvec0, pvec1, pvec2}; - massPKPi = RecoDecay::m(arrayMomenta, std::array{massP, massK, massPi}); - massPiKP = RecoDecay::m(arrayMomenta, std::array{massPi, massK, massP}); - massPiKPi = RecoDecay::m(arrayMomenta, std::array{massPi, massK, massPi}); - massKKPi = RecoDecay::m(arrayMomenta, std::array{massK, massK, massPi}); - massPiKK = RecoDecay::m(arrayMomenta, std::array{massPi, massK, massK}); - massKPi = RecoDecay::m(std::array{arrayMomenta.at(1), arrayMomenta.at(2)}, std::array{massK, massPi}); - massPiK = RecoDecay::m(std::array{arrayMomenta.at(0), arrayMomenta.at(1)}, std::array{massPi, massK}); + const auto arrayMomenta = std::array{pvec0, pvec1, pvec2}; + const auto massPKPi = RecoDecay::m(arrayMomenta, std::array{MassProton, MassKPlus, MassPiPlus}); + const auto massPiKP = RecoDecay::m(arrayMomenta, std::array{MassPiPlus, MassKPlus, MassProton}); + const auto massPiKPi = RecoDecay::m(arrayMomenta, std::array{MassPiPlus, MassKPlus, MassPiPlus}); + const auto massKKPi = RecoDecay::m(arrayMomenta, std::array{MassKPlus, MassKPlus, MassPiPlus}); + const auto massPiKK = RecoDecay::m(arrayMomenta, std::array{MassPiPlus, MassKPlus, MassKPlus}); + const auto massKPi = RecoDecay::m(std::array{arrayMomenta.at(1), arrayMomenta.at(2)}, std::array{MassKPlus, MassPiPlus}); + const auto massPiK = RecoDecay::m(std::array{arrayMomenta.at(0), arrayMomenta.at(1)}, std::array{MassPiPlus, MassKPlus}); registry.fill(HIST("hMass3PiKPi"), massPiKPi); registry.fill(HIST("hMass3PKPi"), massPKPi); registry.fill(HIST("hMass3PiKP"), massPiKP); diff --git a/PWGHF/TableProducer/candidateCreatorXicc.cxx b/PWGHF/TableProducer/candidateCreatorXicc.cxx index 380bae1445f..1d8058d09cb 100644 --- a/PWGHF/TableProducer/candidateCreatorXicc.cxx +++ b/PWGHF/TableProducer/candidateCreatorXicc.cxx @@ -80,11 +80,6 @@ struct HfCandidateCreatorXicc { o2::vertexing::DCAFitterN<2> df2; // 2-prong vertex fitter to build the Xicc vertex HfHelper hfHelper; - double massPi{0.}; - double massK{0.}; - double massXic{0.}; - double massXicc{0.}; - Filter filterSelectCandidates = (aod::hf_sel_candidate_xic::isSelXicToPKPi >= selectionFlagXic || aod::hf_sel_candidate_xic::isSelXicToPiKP >= selectionFlagXic); OutputObj hMassXic{TH1F("hMassXic", "xic candidates;inv. mass (#pi K #pi) (GeV/#it{c}^{2});entries", 500, 1.6, 2.6)}; @@ -93,10 +88,6 @@ struct HfCandidateCreatorXicc { void init(InitContext const&) { - massPi = MassPiPlus; - massK = MassKPlus; - massXic = MassXiCPlus; - df3.setBz(bz); df3.setPropagateToPCA(propagateToPCA); df3.setMaxR(maxR); @@ -232,17 +223,15 @@ struct HfCandidateCreatorXiccMc { aod::TracksWMc const&, aod::McParticles const& mcParticles) { - int indexRec = -1; int8_t sign = 0; - int8_t flag = 0; - int8_t origin = 0; - int8_t debug = 0; + int8_t flag; + int8_t origin; // Match reconstructed candidates. for (const auto& candidate : candidates) { + int8_t debug = 0; flag = 0; origin = 0; - debug = 0; auto xicCand = candidate.prong0(); auto arrayDaughters = std::array{xicCand.prong0_as(), xicCand.prong1_as(), @@ -252,7 +241,7 @@ struct HfCandidateCreatorXiccMc { xicCand.prong1_as(), xicCand.prong2_as()}; // Ξcc±± → p± K∓ π± π± - indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kXiCCPlusPlus, std::array{+kProton, -kKPlus, +kPiPlus, +kPiPlus}, true, &sign, 2); + auto indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kXiCCPlusPlus, std::array{+kProton, -kKPlus, +kPiPlus, +kPiPlus}, true, &sign, 2); if (indexRec > -1) { // Ξc± → p± K∓ π± indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersXic, Pdg::kXiCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 1); diff --git a/PWGHF/TableProducer/candidateSelectorLc.cxx b/PWGHF/TableProducer/candidateSelectorLc.cxx index ded5f282810..25a4ede94d3 100644 --- a/PWGHF/TableProducer/candidateSelectorLc.cxx +++ b/PWGHF/TableProducer/candidateSelectorLc.cxx @@ -517,11 +517,11 @@ struct HfCandidateSelectorLc { if (usePid) { // track-level PID selection - TrackSelectorPID::Status pidTrackPos1Proton = TrackSelectorPID::Accepted; - TrackSelectorPID::Status pidTrackPos2Proton = TrackSelectorPID::Accepted; - TrackSelectorPID::Status pidTrackPos1Pion = TrackSelectorPID::Accepted; - TrackSelectorPID::Status pidTrackPos2Pion = TrackSelectorPID::Accepted; - TrackSelectorPID::Status pidTrackNegKaon = TrackSelectorPID::Accepted; + TrackSelectorPID::Status pidTrackPos1Proton; + TrackSelectorPID::Status pidTrackPos2Proton; + TrackSelectorPID::Status pidTrackPos1Pion; + TrackSelectorPID::Status pidTrackPos2Pion; + TrackSelectorPID::Status pidTrackNegKaon; if (usePidTpcAndTof) { pidTrackPos1Proton = selectorProton.statusTpcAndTof(trackPos1, candidate.nSigTpcPr0(), candidate.nSigTofPr0()); pidTrackPos2Proton = selectorProton.statusTpcAndTof(trackPos2, candidate.nSigTpcPr2(), candidate.nSigTofPr2()); diff --git a/PWGHF/TableProducer/candidateSelectorXicToPKPi.cxx b/PWGHF/TableProducer/candidateSelectorXicToPKPi.cxx index 2ed4e2b329f..cf6593c7c66 100644 --- a/PWGHF/TableProducer/candidateSelectorXicToPKPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorXicToPKPi.cxx @@ -313,11 +313,11 @@ struct HfCandidateSelectorXicToPKPi { pidXicToPiKP = 1; } else { // track-level PID selection - TrackSelectorPID::Status pidTrackPos1Proton = TrackSelectorPID::Accepted; - TrackSelectorPID::Status pidTrackPos2Proton = TrackSelectorPID::Accepted; - TrackSelectorPID::Status pidTrackPos1Pion = TrackSelectorPID::Accepted; - TrackSelectorPID::Status pidTrackPos2Pion = TrackSelectorPID::Accepted; - TrackSelectorPID::Status pidTrackNegKaon = TrackSelectorPID::Accepted; + TrackSelectorPID::Status pidTrackPos1Proton; + TrackSelectorPID::Status pidTrackPos2Proton; + TrackSelectorPID::Status pidTrackPos1Pion; + TrackSelectorPID::Status pidTrackPos2Pion; + TrackSelectorPID::Status pidTrackNegKaon; if (usePidTpcAndTof) { pidTrackPos1Proton = selectorProton.statusTpcAndTof(trackPos1, candidate.nSigTpcPr0(), candidate.nSigTofPr0()); diff --git a/PWGHF/TableProducer/candidateSelectorXicToXiPiPi.cxx b/PWGHF/TableProducer/candidateSelectorXicToXiPiPi.cxx index b5f5c2cb64c..223d484d0a1 100644 --- a/PWGHF/TableProducer/candidateSelectorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorXicToXiPiPi.cxx @@ -603,11 +603,11 @@ struct HfCandidateSelectorXicToXiPiPi { // PID selection // //////////////////////////////////////////////// if (usePid) { - TrackSelectorPID::Status statusPidPi0 = TrackSelectorPID::NotApplicable; - TrackSelectorPID::Status statusPidPi1 = TrackSelectorPID::NotApplicable; - TrackSelectorPID::Status statusPidPiXi = TrackSelectorPID::NotApplicable; - TrackSelectorPID::Status statusPidPrLam = TrackSelectorPID::NotApplicable; - TrackSelectorPID::Status statusPidPiLam = TrackSelectorPID::NotApplicable; + TrackSelectorPID::Status statusPidPi0; + TrackSelectorPID::Status statusPidPi1; + TrackSelectorPID::Status statusPidPiXi; + TrackSelectorPID::Status statusPidPrLam; + TrackSelectorPID::Status statusPidPiLam; // assign proton and pion hypothesis to V0 daughters auto trackPr = trackV0PosDau; diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index 0bcb60aec6e..8bc26864059 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -958,10 +958,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { } if (config.debugPvRefit) { LOG(info) << "### vecPvContributorGlobId.size()=" << vecPvContributorGlobId.size() << ", vecPvContributorTrackParCov.size()=" << vecPvContributorTrackParCov.size() << ", N. original contributors=" << collision.numContrib(); - } - - /// Perform the PV refit only for tracks with an assigned collision - if (config.debugPvRefit) { + /// Perform the PV refit only for tracks with an assigned collision LOG(info) << "[BEFORE performPvRefitTrack] track.collision().globalIndex(): " << collision.globalIndex(); } performPvRefitTrack(collision, bcWithTimeStamps, vecPvContributorGlobId, vecPvContributorTrackParCov, track, pvRefitPvCoord, pvRefitPvCovMatrix, pvRefitDcaXYDcaZ); @@ -1964,12 +1961,11 @@ struct HfTrackIndexSkimCreator { /// PV refitting, if the tracks contributed to this at the beginning o2::dataformats::VertexBase primVtxBaseRecalc; - bool recalcPvRefit = false; if ((doprocess2And3ProngsWithPvRefit || doprocess2And3ProngsWithPvRefitWithPidForHfFiltersBdt) && pvRefitDoable) { if (config.fillHistograms) { registry.fill(HIST("PvRefit/verticesPerCandidate"), 2); } - recalcPvRefit = true; + bool recalcPvRefit = true; int nCandContr = 0; for (const uint64_t myGlobalID : vecCandPvContributorGlobId) { // o2-linter: disable=const-ref-in-for-loop (small type) auto trackIterator = std::find(vecPvContributorGlobId.begin(), vecPvContributorGlobId.end(), myGlobalID); /// track global index @@ -2007,10 +2003,6 @@ struct HfTrackIndexSkimCreator { registry.fill(HIST("PvRefit/hChi2vsNContrib"), primVtxRefitted.getNContributors(), primVtxRefitted.getChi2()); } - for (size_t i = 0; i < vecPvContributorGlobId.size(); i++) { - vecPvRefitContributorUsed[i] = true; /// restore the tracks for the next PV refitting (probably not necessary here) - } - if (recalcPvRefit) { // fill the histograms for refitted PV with good Chi2 const double deltaX = primVtx.getX() - primVtxRefitted.getX(); diff --git a/PWGHF/Tasks/taskMcEfficiency.cxx b/PWGHF/Tasks/taskMcEfficiency.cxx index 9cea8501366..b4d17250c8f 100644 --- a/PWGHF/Tasks/taskMcEfficiency.cxx +++ b/PWGHF/Tasks/taskMcEfficiency.cxx @@ -125,7 +125,7 @@ struct HfTaskMcEfficiency { } template - void candidate3ProngLoop(T1& candidates, T2& tracks, T3& mcParticles, std::vector pdgCodes) + void candidate3ProngLoop(T1 const& candidates, T2 const& tracks, T3 const& mcParticles, std::vector const& pdgCodes) { using TracksType = std::decay_t; @@ -325,7 +325,7 @@ struct HfTaskMcEfficiency { } template - void candidate2ProngLoop(T1 const& candidates, T2 const& tracks, T3 const& mcParticles, std::vector pdgCodes) + void candidate2ProngLoop(T1 const& candidates, T2 const& tracks, T3 const& mcParticles, std::vector const& pdgCodes) { using TracksType = std::decay_t; diff --git a/PWGHF/Tasks/taskMcValidation.cxx b/PWGHF/Tasks/taskMcValidation.cxx index 650452250db..a2cdaf659eb 100644 --- a/PWGHF/Tasks/taskMcValidation.cxx +++ b/PWGHF/Tasks/taskMcValidation.cxx @@ -953,8 +953,8 @@ struct HfTaskMcValidationRec { } uint const index = uint(track.collisionId() >= 0); if (track.has_mcParticle()) { - auto particle = track.mcParticle(); // get corresponding MC particle to check origin - auto mcCollision = particle.mcCollision_as(); + const auto& particle = track.mcParticle(); // get corresponding MC particle to check origin + const auto& mcCollision = particle.mcCollision_as(); if (eventGeneratorType >= 0 && mcCollision.getSubGeneratorId() != eventGeneratorType) { continue; } @@ -966,7 +966,7 @@ struct HfTaskMcValidationRec { histAmbiguousTracks->Fill(origin, track.pt()); std::vector ambCollPosZ{}; for (const auto& collIdx : track.compatibleCollIds()) { - auto ambCollision = collisions.rawIteratorAt(collIdx); + const auto& ambCollision = collisions.rawIteratorAt(collIdx); ambCollPosZ.push_back(ambCollision.posZ()); } // here we are only interested to tracks associated to multiple vertices @@ -976,8 +976,7 @@ struct HfTaskMcValidationRec { } float deltaZ = -999.f; if (index) { - auto collision = track.collision_as(); - auto mcCollision = particle.mcCollision_as(); + const auto& collision = track.collision_as(); deltaZ = collision.posZ() - mcCollision.posZ(); if (collision.has_mcCollision() && collision.mcCollisionId() == particle.mcCollisionId()) { histOriginTracks[index + 1]->Fill(origin, track.pt(), track.eta(), deltaZ, track.isPVContributor(), track.hasTOF(), nITSlayers); @@ -1101,7 +1100,7 @@ struct HfTaskMcValidationRec { continue; } int whichHad = -1; - if (isD0Sel && std::abs(cand2Prong.flagMcMatchRec()) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { + if (std::abs(cand2Prong.flagMcMatchRec()) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { whichHad = DzeroToKPi; } int whichOrigin; From 2fda5e33f28e9b340cd8e13d0bdfdedd95e184f5 Mon Sep 17 00:00:00 2001 From: spucillo <93769017+spucillo@users.noreply.github.com> Date: Thu, 9 Oct 2025 16:12:31 +0200 Subject: [PATCH 679/986] [PWGLF] Review and fix the brackets (#13302) Co-authored-by: ALICE Action Bot --- .../cascadeAnalysisLightIonsDerivedData.cxx | 44 +++++++++++++------ 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx b/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx index d6486d8c8ac..1a536b79547 100644 --- a/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx +++ b/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx @@ -185,7 +185,7 @@ struct CascadeAnalysisLightIonsDerivedData { registryData.get(HIST("number_of_events_data"))->GetXaxis()->SetBinLabel(9, "kIsVertexTRDmatched"); registryData.get(HIST("number_of_events_data"))->GetXaxis()->SetBinLabel(10, "kNoSameBunchPileup"); - registryData.add("number_of_events_data_vs_centrality", "number of events in data vs centrality", HistType::kTH2D, {{20, -0.5f, +19.5f}, axisCentEstimator}); + registryData.add("number_of_events_data_vs_centrality", "number of events in data vs centrality", HistType::kTH2D, {{20, -0.5f, +19.5f}, {101, 0.0f, 101.0f}}); registryData.get(HIST("number_of_events_data_vs_centrality"))->GetXaxis()->SetBinLabel(1, "All collisions"); registryData.get(HIST("number_of_events_data_vs_centrality"))->GetXaxis()->SetBinLabel(2, "sel8 cut"); registryData.get(HIST("number_of_events_data_vs_centrality"))->GetXaxis()->SetBinLabel(3, "posZ cut"); @@ -212,9 +212,9 @@ struct CascadeAnalysisLightIonsDerivedData { registryQC.add("hdcav0topvdata", "hdcav0topvdata", HistType::kTH1D, {{nBins, 0.0f, 2.0f}}); // Multiplicity Histograms - registryData.add("hCentEstimator", "hCentEstimator", HistType::kTH1D, {axisCentEstimator}); - registryData.add("hCentralityVsNch", "hCentralityVsNch", HistType::kTH2D, {axisCentEstimator, axisNch}); - registryData.add("hCentralityVsMultiplicity", "hCentralityVsMultiplicity", HistType::kTH2D, {axisCentEstimator, axisMult}); + registryData.add("hCentEstimator", "hCentEstimator", HistType::kTH1D, {{101, 0.0f, 101.0f}}); + registryData.add("hCentralityVsNch", "hCentralityVsNch", HistType::kTH2D, {{101, 0.0f, 101.0f}, axisNch}); + registryData.add("hCentralityVsMultiplicity", "hCentralityVsMultiplicity", HistType::kTH2D, {{101, 0.0f, 101.0f}, axisMult}); // Histograms for xi (data) registryData.add("hMassXipos", "hMassXipos", HistType::kTH3D, {centAxis, ptAxis, invMassXiAxis}); @@ -243,7 +243,7 @@ struct CascadeAnalysisLightIonsDerivedData { registryMC.get(HIST("number_of_events_mc_rec"))->GetXaxis()->SetBinLabel(9, "kIsVertexTRDmatched"); registryMC.get(HIST("number_of_events_mc_rec"))->GetXaxis()->SetBinLabel(10, "kNoSameBunchPileup"); - registryMC.add("number_of_events_mc_rec_vs_centrality", "number of events in mc_rec vs centrality", HistType::kTH2D, {{20, -0.5f, +19.5f}, axisCentEstimator}); + registryMC.add("number_of_events_mc_rec_vs_centrality", "number of events in mc_rec vs centrality", HistType::kTH2D, {{20, -0.5f, +19.5f}, {101, 0.0f, 101.0f}}); registryMC.get(HIST("number_of_events_mc_rec_vs_centrality"))->GetXaxis()->SetBinLabel(1, "All collisions"); registryMC.get(HIST("number_of_events_mc_rec_vs_centrality"))->GetXaxis()->SetBinLabel(2, "sel8 cut"); registryMC.get(HIST("number_of_events_mc_rec_vs_centrality"))->GetXaxis()->SetBinLabel(3, "posZ cut"); @@ -270,9 +270,9 @@ struct CascadeAnalysisLightIonsDerivedData { registryQC.add("hdcav0topvRec", "hdcav0topvRec", HistType::kTH1D, {{nBins, 0.0f, 2.0f}}); // Multiplicity Histograms - registryMC.add("hCentEstimator_truerec", "hCentEstimator_truerec", HistType::kTH1D, {axisCentEstimator}); - registryMC.add("hCentralityVsNch_truerec", "hCentralityVsNch_truerec", HistType::kTH2D, {axisCentEstimator, axisNch}); - registryMC.add("hCentralityVsMultiplicity_truerec", "hCentralityVsMultiplicity_truerec", HistType::kTH2D, {axisCentEstimator, axisMult}); + registryMC.add("hCentEstimator_truerec", "hCentEstimator_truerec", HistType::kTH1D, {{101, 0.0f, 101.0f}}); + registryMC.add("hCentralityVsNch_truerec", "hCentralityVsNch_truerec", HistType::kTH2D, {{101, 0.0f, 101.0f}, axisNch}); + registryMC.add("hCentralityVsMultiplicity_truerec", "hCentralityVsMultiplicity_truerec", HistType::kTH2D, {{101, 0.0f, 101.0f}, axisMult}); // Histograms for xi (mc) registryMC.add("hMassXipos_truerec", "hMassXipos_truerec", HistType::kTH3D, {centAxis, ptAxis, invMassXiAxis}); @@ -296,12 +296,16 @@ struct CascadeAnalysisLightIonsDerivedData { registryMC.add("h2dGenXiPlusVsMultMC_RecoedEvt", "h2dGenXiPlusVsMultMC_RecoedEvt", HistType::kTH2D, {axisNch, ptAxis}); registryMC.add("h2dGenXiMinusVsMultMC", "h2dGenXiMinusVsMultMC", HistType::kTH2D, {axisNch, ptAxis}); registryMC.add("h2dGenXiPlusVsMultMC", "h2dGenXiPlusVsMultMC", HistType::kTH2D, {axisNch, ptAxis}); + registryMC.add("h2dGenXiMinus", "h2dGenXiMinus", HistType::kTH2D, {{101, 0.0f, 101.0f}, ptAxis}); + registryMC.add("h2dGenXiPlus", "h2dGenXiPlus", HistType::kTH2D, {{101, 0.0f, 101.0f}, ptAxis}); // Histograms for omega (mc) registryMC.add("h2dGenOmegaMinusVsMultMC_RecoedEvt", "h2dGenOmegaMinusVsMultMC_RecoedEvt", HistType::kTH2D, {axisNch, ptAxis}); registryMC.add("h2dGenOmegaPlusVsMultMC_RecoedEvt", "h2dGenOmegaPlusVsMultMC_RecoedEvt", HistType::kTH2D, {axisNch, ptAxis}); registryMC.add("h2dGenOmegaMinusVsMultMC", "h2dGenOmegaMinusVsMultMC", HistType::kTH2D, {axisNch, ptAxis}); registryMC.add("h2dGenOmegaPlusVsMultMC", "h2dGenOmegaPlusVsMultMC", HistType::kTH2D, {axisNch, ptAxis}); + registryMC.add("h2dGenOmegaMinus", "h2dGenOmegaMinus", HistType::kTH2D, {{101, 0.0f, 101.0f}, ptAxis}); + registryMC.add("h2dGenOmegaPlus", "h2dGenOmegaPlus", HistType::kTH2D, {{101, 0.0f, 101.0f}, ptAxis}); // Histograms for event loss/splitting registryMC.add("hGenEvents", "hGenEvents", HistType::kTH2D, {{axisNch}, {2, -0.5f, +1.5f}}); @@ -751,6 +755,8 @@ struct CascadeAnalysisLightIonsDerivedData { multiplicity = collision.multNTracksGlobal(); } + registryData.fill(HIST("number_of_events_data_vs_centrality"), 0, centrality); + // event selections if (applySel8 && !collision.sel8()) return; @@ -893,6 +899,8 @@ struct CascadeAnalysisLightIonsDerivedData { multiplicityMcRec = RecCol.multNTracksGlobal(); } + registryMC.fill(HIST("number_of_events_mc_rec_vs_centrality"), 0, centralityMcRec); + // event selections if (applySel8 && !RecCol.sel8()) continue; @@ -1053,14 +1061,18 @@ struct CascadeAnalysisLightIonsDerivedData { // Store the Zvtx registryQC.fill(HIST("hVertexZGen"), mcCollision.posZ()); - // float centrality = 100.5f; + float centralityMC = 100.5f; if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) { - // auto collision = RecCols.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]); - // if (centralityEstimator == Option::kFT0C) centrality = collision.centFT0C(); - // if (centralityEstimator == Option::kFT0M) centrality = collision.centFT0M(); - // if (centralityEstimator == Option::kFV0A) centrality = collision.centFV0A(); - // if (centralityEstimator == Option::kNGlobal) centrality = collision.centNGlobal(); + auto collision = RecCols.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]); + if (centralityEstimator == Option::kFT0C) + centralityMC = collision.centFT0C(); + if (centralityEstimator == Option::kFT0M) + centralityMC = collision.centFT0M(); + if (centralityEstimator == Option::kFV0A) + centralityMC = collision.centFV0A(); + if (centralityEstimator == Option::kNGlobal) + centralityMC = collision.centNGlobal(); if (cascMC.pdgCode() == kXiMinus && std::abs(cascMC.rapidityMC(0)) < rapcut) { registryMC.fill(HIST("h2dGenXiMinusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); @@ -1077,15 +1089,19 @@ struct CascadeAnalysisLightIonsDerivedData { } if (cascMC.pdgCode() == kXiMinus && std::abs(cascMC.rapidityMC(0)) < rapcut) { + registryMC.fill(HIST("h2dGenXiMinus"), centralityMC, ptmc); registryMC.fill(HIST("h2dGenXiMinusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); } if (cascMC.pdgCode() == kXiPlusBar && std::abs(cascMC.rapidityMC(0)) < rapcut) { + registryMC.fill(HIST("h2dGenXiPlus"), centralityMC, ptmc); registryMC.fill(HIST("h2dGenXiPlusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); } if (cascMC.pdgCode() == kOmegaMinus && std::abs(cascMC.rapidityMC(2)) < rapcut) { + registryMC.fill(HIST("h2dGenOmegaMinus"), centralityMC, ptmc); registryMC.fill(HIST("h2dGenOmegaMinusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); } if (cascMC.pdgCode() == kOmegaPlusBar && std::abs(cascMC.rapidityMC(2)) < rapcut) { + registryMC.fill(HIST("h2dGenOmegaPlus"), centralityMC, ptmc); registryMC.fill(HIST("h2dGenOmegaPlusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); } } // cascMC loop From 4d3dcd56784bb1683cc10987e088b47fa7d5d724 Mon Sep 17 00:00:00 2001 From: gluparel Date: Thu, 9 Oct 2025 16:29:11 +0200 Subject: [PATCH 680/986] [Infrastructure] Add Xinye as CODEOWNER for HF (#13306) --- CODEOWNERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index 7b886ac2857..ebe63286c36 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -39,7 +39,7 @@ /PWGEM @alibuild @feisenhu @dsekihat @ivorobye /PWGEM/Dilepton @alibuild @mikesas @rbailhac @dsekihat @ivorobye @feisenhu @hscheid /PWGEM/PhotonMeson @alibuild @mikesas @rbailhac @m-c-danisch @novitzky @mhemmer-cern @dsekihat -/PWGHF @alibuild @vkucera @fcolamar @fgrosa @fcatalan92 @mfaggin @mmazzilli @deepathoms @NicoleBastid @hahassan7 @jpxrk @apalasciano @zhangbiao-phy @gluparel @stefanopolitano +/PWGHF @alibuild @vkucera @fcolamar @fgrosa @fcatalan92 @mfaggin @mmazzilli @deepathoms @NicoleBastid @hahassan7 @jpxrk @apalasciano @zhangbiao-phy @gluparel @stefanopolitano @xinyepeng # PWG-LF /PWGLF @alibuild @sustripathy @skundu692 @mpuccio /PWGLF/DataModel @alibuild @sustripathy @skundu692 @mpuccio @gbencedi @abmodak @fmazzasc @maciacco @dmallick2 @smaff92 @ercolessi @romainschotter @@ -68,7 +68,7 @@ /Tutorials/PWGCF @alibuild @jgrosseo @victor-gonzalez @zchochul /Tutorials/PWGDQ @alibuild @iarsene @mcoquet @lucamicheletti93 /Tutorials/PWGEM @alibuild @mikesas @rbailhac @dsekihat @ivorobye @feisenhu -/Tutorials/PWGHF @alibuild @vkucera @fcolamar @fgrosa @gluparel +/Tutorials/PWGHF @alibuild @vkucera @fcolamar @fgrosa @gluparel @xinyepeng /Tutorials/PWGJE @alibuild @lhavener @maoyx @nzardosh @mfasDa @fjonasALICE /Tutorials/PWGLF @alibuild @alcaliva @lbariogl @chiarapinto @BongHwi @lbarnby @ercolessi @iravasen @njacazio @romainschotter @skundu692 /Tutorials/PWGMM @alibuild @aalkin @ddobrigk From 04f493c7bf7ee3ab001fc143d9da9d3199645c51 Mon Sep 17 00:00:00 2001 From: Marvin Hemmer <53471402+mhemmer-cern@users.noreply.github.com> Date: Thu, 9 Oct 2025 17:53:46 +0200 Subject: [PATCH 681/986] [PWGEM,PWGEM-36] Fix filling of `hQVecMeanRVsPhi` histos (#13304) --- PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx b/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx index 4b576285531..cf5084a852b 100644 --- a/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx @@ -1245,12 +1245,12 @@ struct TaskPi0FlowEMC { registry.fill(HIST("hEventPlaneAngleTPCpos"), centrality, epBPoss); registry.fill(HIST("hEventPlaneAngleTPCneg"), centrality, epBNegs); - registry.fill(HIST("QVector/hQVecMeanRVsPhiFT0a"), centrality, std::atan2(yQVecFT0a, xQVecFT0a)); - registry.fill(HIST("QVector/hQVecMeanRVsPhiFT0c"), centrality, std::atan2(yQVecFT0c, xQVecFT0c)); - registry.fill(HIST("QVector/hQVecMeanRVsPhiFT0m"), centrality, std::atan2(yQVecFT0m, xQVecFT0m)); - registry.fill(HIST("QVector/hQVecMeanRVsPhiTPCpos"), centrality, std::atan2(yQVecBPos, xQVecBPos)); - registry.fill(HIST("QVector/hQVecMeanRVsPhiTPCneg"), centrality, std::atan2(yQVecBNeg, xQVecBNeg)); - registry.fill(HIST("QVector/hQVecMeanRVsPhiTPCTot"), centrality, std::atan2(yQVecBTot, xQVecBTot)); + registry.fill(HIST("QVector/hQVecMeanRVsPhiFT0a"), centrality, std::atan2(yQVecFT0a, xQVecFT0a), std::hypot(xQVecFT0a, yQVecFT0a)); + registry.fill(HIST("QVector/hQVecMeanRVsPhiFT0c"), centrality, std::atan2(yQVecFT0c, xQVecFT0c), std::hypot(xQVecFT0c, yQVecFT0c)); + registry.fill(HIST("QVector/hQVecMeanRVsPhiFT0m"), centrality, std::atan2(yQVecFT0m, xQVecFT0m), std::hypot(xQVecFT0m, yQVecFT0m)); + registry.fill(HIST("QVector/hQVecMeanRVsPhiTPCpos"), centrality, std::atan2(yQVecBPos, xQVecBPos), std::hypot(xQVecBPos, yQVecBPos)); + registry.fill(HIST("QVector/hQVecMeanRVsPhiTPCneg"), centrality, std::atan2(yQVecBNeg, xQVecBNeg), std::hypot(xQVecBNeg, yQVecBNeg)); + registry.fill(HIST("QVector/hQVecMeanRVsPhiTPCTot"), centrality, std::atan2(yQVecBTot, xQVecBTot), std::hypot(xQVecBTot, yQVecBTot)); registry.fill(HIST("epReso/hEpResoFT0cFT0a"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0c, epFT0a))); registry.fill(HIST("epReso/hEpResoFT0cTPCpos"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0c, epBPoss))); From fcf89858698995129ef7908daaffdaa24428e348 Mon Sep 17 00:00:00 2001 From: arvindkhuntia <31609955+arvindkhuntia@users.noreply.github.com> Date: Thu, 9 Oct 2025 19:38:45 +0200 Subject: [PATCH 682/986] [PWGLF] [PWGMM] CTP trigger mask included to FIT tables (#13266) Co-authored-by: Arvind Khuntia --- PWGMM/Lumi/Tasks/LumiFDDFT0.cxx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/PWGMM/Lumi/Tasks/LumiFDDFT0.cxx b/PWGMM/Lumi/Tasks/LumiFDDFT0.cxx index c67e36672b8..2fe4b62f51d 100644 --- a/PWGMM/Lumi/Tasks/LumiFDDFT0.cxx +++ b/PWGMM/Lumi/Tasks/LumiFDDFT0.cxx @@ -64,6 +64,7 @@ DECLARE_SOA_COLUMN(VertexXY, vertexXY, double); DECLARE_SOA_COLUMN(GlobalBC, globalBC, uint64_t); DECLARE_SOA_COLUMN(VertexChi2, vertexChi2, double); DECLARE_SOA_COLUMN(NContrib, nContrib, int); +DECLARE_SOA_COLUMN(InputMask, inputMask, uint64_t); //! CTP input mask // Information for FDD DECLARE_SOA_COLUMN(isFDD, isfdd, bool); @@ -90,7 +91,7 @@ DECLARE_SOA_COLUMN(TimeAFV0, timeAfv0, double); // Only FV0-A time DECLARE_SOA_COLUMN(ChargeAFV0, chargeAfv0, double); // Only FV0-A charge } // namespace full -DECLARE_SOA_TABLE(EventInfo, "AOD", "EventInfo", full::TimeStamp, full::VertexX, +DECLARE_SOA_TABLE(EventInfo, "AOD", "EventInfo", full::TimeStamp, full::InputMask, full::VertexX, full::VertexY, full::VertexZ, full::GlobalBC, full::VertexChi2, full::NContrib, full::isFDD, full::TCMTriggerFDD, @@ -103,20 +104,20 @@ DECLARE_SOA_TABLE(EventInfo, "AOD", "EventInfo", full::TimeStamp, full::VertexX, DECLARE_SOA_TABLE(EventInfoFDD, "AOD", "EventInfoFDD", full::TimeStamp, full::GlobalBC, - full::TCMTriggerFDD, full::TimeAFDD, + full::InputMask, full::TCMTriggerFDD, full::TimeAFDD, full::TimeCFDD, full::IsCoinAmpFDDA, full::IsCoinAmpFDDC, full::ChargeAFDD, full::ChargeCFDD); DECLARE_SOA_TABLE(EventInfoFT0, "AOD", "EventInfoFT0", full::TimeStamp, full::GlobalBC, - full::TCMTriggerFT0, full::TimeAFT0, + full::InputMask, full::TCMTriggerFT0, full::TimeAFT0, full::TimeCFT0, full::ChargeAFT0, full::ChargeCFT0); DECLARE_SOA_TABLE(EventInfoFV0, "AOD", "EventInfoFV0", full::TimeStamp, full::GlobalBC, - full::TCMTriggerFV0, full::TimeAFV0, + full::InputMask, full::TCMTriggerFV0, full::TimeAFV0, full::ChargeAFV0); } // namespace o2::aod @@ -304,7 +305,7 @@ struct LumiFDDFT0 { } } // fv0 - rowEventInfo(relTS, refitX, refitY, refitZ, globalBC, chi2, nContrib, collision.has_foundFDD(), + rowEventInfo(relTS, bc.inputMask(), refitX, refitY, refitZ, globalBC, chi2, nContrib, collision.has_foundFDD(), mTriggerFDD, timeaFDD, timecFDD, chargeaFDD, chargecFDD, collision.has_foundFT0(), mTriggerFT0, timeaFT0, timecFT0, chargeaFT0, chargecFT0, collision.has_foundFV0(), mTriggerFV0, timeaFV0, chargeaFV0); @@ -388,7 +389,7 @@ struct LumiFDDFT0 { bool isCoinA = checkAnyCoincidence(channelA); bool isCoinC = checkAnyCoincidence(channelC); - rowEventInfofdd(relTS, globalBC, fdd.triggerMask(), fdd.timeA(), fdd.timeC(), isCoinA, isCoinC, chargeaFDD, chargecFDD); + rowEventInfofdd(relTS, globalBC, bc.inputMask(), fdd.triggerMask(), fdd.timeA(), fdd.timeC(), isCoinA, isCoinC, chargeaFDD, chargecFDD); } // end of fdd table // Scan over the FT0 table and store charge and time along with globalBC @@ -408,7 +409,7 @@ struct LumiFDDFT0 { for (auto amplitude : ft0.amplitudeC()) { chargecFT0 += amplitude; } - rowEventInfoft0(relTS, globalBC, ft0.triggerMask(), ft0.timeA(), ft0.timeC(), chargeaFT0, chargecFT0); + rowEventInfoft0(relTS, globalBC, bc.inputMask(), ft0.triggerMask(), ft0.timeA(), ft0.timeC(), chargeaFT0, chargecFT0); } // end of ft0 table // Scan over the FV0 table and store charge and time along with globalBC @@ -425,7 +426,7 @@ struct LumiFDDFT0 { for (auto amplitude : fv0.amplitude()) { chargeaFV0 += amplitude; } - rowEventInfofv0(relTS, globalBC, fv0.triggerMask(), fv0.time(), chargeaFV0); + rowEventInfofv0(relTS, globalBC, bc.inputMask(), fv0.triggerMask(), fv0.time(), chargeaFV0); } // end of fv0 table }; PROCESS_SWITCH(LumiFDDFT0, processLite, "Process FDD and FT0 info", false); From c8733a857e67c1487d3f413a084f137f240b3743 Mon Sep 17 00:00:00 2001 From: Zhang Yuan Date: Fri, 10 Oct 2025 01:59:51 +0800 Subject: [PATCH 683/986] [PWGDQ] Move zorro selection after event selection (#13291) Co-authored-by: ALICE Action Bot --- PWGDQ/TableProducer/tableMaker_withAssoc.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PWGDQ/TableProducer/tableMaker_withAssoc.cxx b/PWGDQ/TableProducer/tableMaker_withAssoc.cxx index a8c39eeb184..2be35a784a8 100644 --- a/PWGDQ/TableProducer/tableMaker_withAssoc.cxx +++ b/PWGDQ/TableProducer/tableMaker_withAssoc.cxx @@ -888,11 +888,16 @@ struct TableMaker { zorro.setBCtolerance(fConfigZorro.fBcTolerance); zorro.initCCDB(fCCDB.service, fCurrentRun, bc.timestamp(), fConfigZorro.fConfigZorroTrigMask.value); zorro.populateExternalHists(fCurrentRun, reinterpret_cast(fStatsList->At(kStatsZorroInfo)), reinterpret_cast(fStatsList->At(kStatsZorroSel))); + + if (!fEventCut->IsSelected(VarManager::fgValues)) { + continue; + } + bool zorroSel = zorro.isSelected(bc.globalBC(), fConfigZorro.fBcTolerance, reinterpret_cast(fStatsList->At(kStatsZorroSel))); if (zorroSel) { tag |= (static_cast(true) << 56); // the same bit is used for this zorro selections from ccdb } - if (fConfigZorro.fConfigRunZorroSel && (!zorroSel || !fEventCut->IsSelected(VarManager::fgValues))) { + if (fConfigZorro.fConfigRunZorroSel && (!zorroSel)) { continue; } } else { From 429d54507fed4a585300104d808274a8a5b14e0c Mon Sep 17 00:00:00 2001 From: alcaliva <32872606+alcaliva@users.noreply.github.com> Date: Thu, 9 Oct 2025 22:13:26 +0200 Subject: [PATCH 684/986] [PWGLF] Refactor weight assignment: use first ancestor to avoid branching logic (#13309) --- PWGLF/Tasks/Nuspex/antinucleiInJets.cxx | 111 ++++++++++++++---------- 1 file changed, 66 insertions(+), 45 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx index c37bdc6aeb9..67771be88f3 100644 --- a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx +++ b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx @@ -500,6 +500,22 @@ struct AntinucleiInJets { LOGP(info, "Successfully loaded reweighting histograms from CCDB path"); } + // Get first ancestor + aod::McParticle getFirstAncestor(aod::McParticle const& particle, aod::McParticles const& mcParticles) + { + auto current = particle; + + while (current.has_mothers()) { + auto motherId = current.mothersIds()[0]; + if (motherId < 0 || motherId >= mcParticles.size()) { + break; + } + current = mcParticles.iteratorAt(motherId); + } + + return current; + } + // Compute two unit vectors perpendicular to p void getPerpendicularAxis(const TVector3& p, TVector3& u, double sign) { @@ -1428,56 +1444,61 @@ struct AntinucleiInJets { registryMC.fill(HIST("antip_prim_low"), track.pt(), wPrimLow); } - // Secondary antiprotons from week decays + // Secondary antiprotons from material + if (!particle.isPhysicalPrimary() && !particle.has_mothers()) { + + // Fill histograms + registryMC.fill(HIST("antip_sec_pythia"), track.pt()); + registryMC.fill(HIST("antip_sec_std"), track.pt()); + registryMC.fill(HIST("antip_sec_up"), track.pt()); + registryMC.fill(HIST("antip_sec_low"), track.pt()); + } + + // Secondary antiprotons from weak decays if (!particle.isPhysicalPrimary() && particle.has_mothers()) { - // Initialize weights + // Get first ancestor + auto ancestor = getFirstAncestor(particle, mcParticles); double wSecStd(1.0), wSecUp(1.0), wSecLow(1.0); - auto mother = mcParticles.iteratorAt(particle.mothersIds()[0]); - - // Antiprotons from sigma - if (std::abs(mother.pdgCode()) == PDG_t::kSigmaBarMinus) { - if (mother.pt() < primaryAntiSigma->GetXaxis()->GetXmax()) { - int ipt = primaryAntiSigma->FindBin(mother.pt()); - wSecStd = primaryAntiSigma->GetBinContent(ipt); - wSecUp = wSecStd + primaryAntiSigma->GetBinError(ipt); - wSecLow = wSecStd - primaryAntiSigma->GetBinError(ipt); - } + + // Antiprotons from antiSigma + if (ancestor.pdgCode() == PDG_t::kSigmaBarMinus && ancestor.pt() < primaryAntiSigma->GetXaxis()->GetXmax()) { + int ipt = primaryAntiSigma->FindBin(ancestor.pt()); + wSecStd = primaryAntiSigma->GetBinContent(ipt); + wSecUp = wSecStd + primaryAntiSigma->GetBinError(ipt); + wSecLow = wSecStd - primaryAntiSigma->GetBinError(ipt); + } + + // Antiprotons from antiLambda0 + if (ancestor.pdgCode() == PDG_t::kLambda0Bar && ancestor.pt() < primaryAntiLambda->GetXaxis()->GetXmax()) { + int ipt = primaryAntiLambda->FindBin(ancestor.pt()); + wSecStd = primaryAntiLambda->GetBinContent(ipt); + wSecUp = wSecStd + primaryAntiLambda->GetBinError(ipt); + wSecLow = wSecStd - primaryAntiLambda->GetBinError(ipt); + } + + // Antiprotons from antiXi + if (ancestor.pdgCode() == PDG_t::kXiPlusBar && ancestor.pt() < primaryAntiXi->GetXaxis()->GetXmax()) { + int ipt = primaryAntiXi->FindBin(ancestor.pt()); + wSecStd = primaryAntiXi->GetBinContent(ipt); + wSecUp = wSecStd + primaryAntiXi->GetBinError(ipt); + wSecLow = wSecStd - primaryAntiXi->GetBinError(ipt); + } + + // Antiprotons from antiXi0 + if (ancestor.pdgCode() == -o2::constants::physics::Pdg::kXi0 && ancestor.pt() < primaryAntiXi->GetXaxis()->GetXmax()) { + int ipt = primaryAntiXi->FindBin(ancestor.pt()); + wSecStd = primaryAntiXi->GetBinContent(ipt); + wSecUp = wSecStd + primaryAntiXi->GetBinError(ipt); + wSecLow = wSecStd - primaryAntiXi->GetBinError(ipt); } - // Antiprotons from primary Lambda0 - if (std::abs(mother.pdgCode()) == kLambda0Bar) { - if (mother.isPhysicalPrimary()) { - if (mother.pt() < primaryAntiLambda->GetXaxis()->GetXmax()) { - int ipt = primaryAntiLambda->FindBin(mother.pt()); - wSecStd = primaryAntiLambda->GetBinContent(ipt); - wSecUp = wSecStd + primaryAntiLambda->GetBinError(ipt); - wSecLow = wSecStd - primaryAntiLambda->GetBinError(ipt); - } - } - - // Antiprotons from secondary Lambda0 (Xi -> Lambda0) - if (!mother.isPhysicalPrimary()) { - auto grandmother = mcParticles.iteratorAt(mother.mothersIds()[0]); - if (std::abs(grandmother.pdgCode()) == kXiMinus) { - if (grandmother.pt() < primaryAntiXi->GetXaxis()->GetXmax()) { - int ipt = primaryAntiXi->FindBin(grandmother.pt()); - wSecStd = primaryAntiXi->GetBinContent(ipt); - wSecUp = wSecStd + primaryAntiXi->GetBinError(ipt); - wSecLow = wSecStd - primaryAntiXi->GetBinError(ipt); - } - } - - // Antiprotons from secondary Lambda0 (Omega -> Lambda0) - if (std::abs(grandmother.pdgCode()) == kOmegaMinus) { - if (grandmother.pt() < primaryAntiOmega->GetXaxis()->GetXmax()) { - int ipt = primaryAntiOmega->FindBin(grandmother.pt()); - wSecStd = primaryAntiOmega->GetBinContent(ipt); - wSecUp = wSecStd + primaryAntiOmega->GetBinError(ipt); - wSecLow = wSecStd - primaryAntiOmega->GetBinError(ipt); - } - } - } + // Antiprotons from antiOmega + if (ancestor.pdgCode() == PDG_t::kOmegaPlusBar && ancestor.pt() < primaryAntiOmega->GetXaxis()->GetXmax()) { + int ipt = primaryAntiOmega->FindBin(ancestor.pt()); + wSecStd = primaryAntiOmega->GetBinContent(ipt); + wSecUp = wSecStd + primaryAntiOmega->GetBinError(ipt); + wSecLow = wSecStd - primaryAntiOmega->GetBinError(ipt); } // Fill histograms From da73263ff10f8d98d4def8c260221b94177e63a8 Mon Sep 17 00:00:00 2001 From: Marvin Hemmer <53471402+mhemmer-cern@users.noreply.github.com> Date: Thu, 9 Oct 2025 23:40:54 +0200 Subject: [PATCH 685/986] [PWGEM,PWGEM-9] Fix `hCaloClusterFilter` filling and clean up of `emcalPi0Qc.cxx` (#13279) --- .../TableProducer/skimmerGammaCalo.cxx | 1 - PWGEM/PhotonMeson/Tasks/CMakeLists.txt | 4 +- .../Tasks/{emcalPi0QC.cxx => emcalPi0Qc.cxx} | 280 +++++++++--------- 3 files changed, 138 insertions(+), 147 deletions(-) rename PWGEM/PhotonMeson/Tasks/{emcalPi0QC.cxx => emcalPi0Qc.cxx} (66%) diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx index cc253c54746..5ef60cb26e9 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx @@ -191,7 +191,6 @@ struct SkimmerGammaCalo { historeg.fill(HIST("EOut"), emccluster.energy()); historeg.fill(HIST("M02Out"), emccluster.m02()); historeg.fill(HIST("TimeOut"), emccluster.time()); - historeg.fill(HIST("hCaloClusterFilter"), 6); tableGammaEMCReco(emccluster.collisionId(), emccluster.definition(), emccluster.energy(), emccluster.eta(), emccluster.phi(), emccluster.m02(), emccluster.nCells(), emccluster.time(), emccluster.isExotic(), vPhi, vEta, vP, vPt); diff --git a/PWGEM/PhotonMeson/Tasks/CMakeLists.txt b/PWGEM/PhotonMeson/Tasks/CMakeLists.txt index 8dc5bdc0e01..0f52d0ae9df 100644 --- a/PWGEM/PhotonMeson/Tasks/CMakeLists.txt +++ b/PWGEM/PhotonMeson/Tasks/CMakeLists.txt @@ -21,8 +21,8 @@ o2physics_add_dpl_workflow(gammaconversionstruthonlymc PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(emc-pi0-qc - SOURCES emcalPi0QC.cxx +o2physics_add_dpl_workflow(emcal-pi0-qc + SOURCES emcalPi0Qc.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::AnalysisCore COMPONENT_NAME Analysis) diff --git a/PWGEM/PhotonMeson/Tasks/emcalPi0QC.cxx b/PWGEM/PhotonMeson/Tasks/emcalPi0Qc.cxx similarity index 66% rename from PWGEM/PhotonMeson/Tasks/emcalPi0QC.cxx rename to PWGEM/PhotonMeson/Tasks/emcalPi0Qc.cxx index 509e74402b5..f2aa922ec90 100644 --- a/PWGEM/PhotonMeson/Tasks/emcalPi0QC.cxx +++ b/PWGEM/PhotonMeson/Tasks/emcalPi0Qc.cxx @@ -9,39 +9,10 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include -#include -#include -#include -#include -#include -#include -#include - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoA.h" -#include "Framework/HistogramRegistry.h" - -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Centrality.h" - -#include "EMCALBase/Geometry.h" -#include "PWGJE/DataModel/EMCALClusters.h" -#include "PWGJE/DataModel/EMCALMatchedCollisions.h" -#include "DataFormatsEMCAL/Cell.h" -#include "DataFormatsEMCAL/Constants.h" -#include "DataFormatsEMCAL/AnalysisCluster.h" - -#include "CommonDataFormat/InteractionRecord.h" - -#include "TLorentzVector.h" -#include "TVector3.h" - -// \struct Pi0QCTask +/// \file emcalPi0Qc.cxx /// \brief Simple monitoring task for EMCal clusters /// \author Joshua Koenig , Goethe University Frankfurt +/// \struct EmcalPi0Qc /// \since 25.05.2022 /// /// This task is meant to be used for QC for the emcal using properties of the pi0 @@ -50,15 +21,48 @@ /// For pilot beam data, instead of relying on the event selection, one can veto specific BC IDS using the flag /// fDoVetoBCID. +#include "PWGJE/DataModel/EMCALClusterDefinition.h" +#include "PWGJE/DataModel/EMCALClusters.h" +#include "PWGJE/DataModel/EMCALMatchedCollisions.h" + +#include "Common/CCDB/TriggerAliases.h" +#include "Common/DataModel/EventSelection.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + using namespace o2::framework; using namespace o2::framework::expressions; -using collisionEvSelIt = o2::aod::Collision; -using selectedClusters = o2::soa::Filtered; +using SelectedClusters = o2::soa::Filtered; using MyCollisions = o2::soa::Join; using MyBCs = o2::soa::Join; -using selectedCluster = o2::soa::Filtered; -using selectedAmbiguousClusters = o2::soa::Filtered; -using selectedAmbiguousCluster = o2::soa::Filtered; +using SelectedAmbiguousClusters = o2::soa::Filtered; struct Photon { Photon(float eta_tmp, float phi_tmp, float energy_tmp, int clusid = 0) @@ -106,7 +110,7 @@ struct Meson { struct EventMixVec { - void AddEvent(std::vector vecGamma) + void addEvent(std::vector vecGamma) { if (vecEvtMix.size() < nEVtMixSize) { vecEvtMix.push_back(vecGamma); @@ -115,20 +119,12 @@ struct EventMixVec { vecEvtMix.push_back(vecGamma); } } - Photon* getPhoton(unsigned int iEvt, unsigned int iGamma) - { - if (vecEvtMix.size() >= iEvt) - return nullptr; - if (vecEvtMix[iEvt].size() >= iGamma) - return nullptr; - return &vecEvtMix[iEvt][iGamma]; - } std::vector> vecEvtMix; unsigned int nEVtMixSize = 20; }; -struct Pi0QCTask { +struct EmcalPi0Qc { HistogramRegistry mHistManager{"NeutralMesonHistograms"}; o2::emcal::Geometry* mGeometry = nullptr; @@ -136,21 +132,21 @@ struct Pi0QCTask { // configurable parameters // TODO adapt mDoEventSel switch to also allow selection of other triggers (e.g. EMC7) - Configurable mDoEventSel{"doEventSel", 0, "demand kINT7"}; - Configurable mRequireCaloReadout{"RequireCaloReadout", 0, "require kTVXinEMC"}; - Configurable mRequireEMCalCells{"RequireEMCalCells", 0, "require at least one EMC cell in each collision"}; - Configurable mVetoBCID{"vetoBCID", "", "BC ID(s) to be excluded, this should be used as an alternative to the event selection"}; - Configurable mSelectBCID{"selectBCID", "all", "BC ID(s) to be included, this should be used as an alternative to the event selection"}; - Configurable mVertexCut{"vertexCut", -1, "apply z-vertex cut with value in cm"}; - Configurable mTimeMin{"TimeMinCut", -600, "apply min timing cut (in ns)"}; - Configurable mTimeMax{"TimeMaxCut", 900, "apply min timing cut (in ns)"}; - Configurable mClusterMinM02Cut{"MinM02Cut", 0.1, "apply min M02 cut"}; - Configurable mClusterMaxM02Cut{"MaxM02Cut", 0.7, "apply max M02 cut"}; - Configurable mMinEnergyCut{"MinEnergyCut", 0.7, "apply min cluster energy cut"}; - Configurable mMinNCellsCut{"MinNCellsCut", 1, "apply min cluster number of cell cut"}; - Configurable mMinOpenAngleCut{"OpeningAngleCut", 0.0202, "apply min opening angle cut"}; - Configurable mClusterDefinition{"clusterDefinition", "kV3Default", "cluster definition to be selected, e.g. V3Default"}; - Configurable mSplitEMCalDCal{"SplitEMCalDCal", 0, "Create and fill inv mass histograms for photons on EMCal and DCal individually"}; + Configurable mDoEventSel{"mDoEventSel", 0, "demand kINT7"}; + Configurable mRequireCaloReadout{"mRequireCaloReadout", 0, "require kTVXinEMC"}; + Configurable mRequireEMCalCells{"mRequireEMCalCells", 0, "require at least one EMC cell in each collision"}; + Configurable mVetoBCID{"mVetoBCID", "", "BC ID(s) to be excluded, this should be used as an alternative to the event selection"}; + Configurable mSelectBCID{"mSelectBCID", "all", "BC ID(s) to be included, this should be used as an alternative to the event selection"}; + Configurable mVertexCut{"mVertexCut", -1, "apply z-vertex cut with value in cm"}; + Configurable mTimeMin{"mTimeMin", -600, "apply min timing cut (in ns)"}; + Configurable mTimeMax{"mTimeMax", 900, "apply min timing cut (in ns)"}; + Configurable mClusterMinM02Cut{"mClusterMinM02Cut", 0.1, "apply min M02 cut"}; + Configurable mClusterMaxM02Cut{"mClusterMaxM02Cut", 0.7, "apply max M02 cut"}; + Configurable mMinEnergyCut{"mMinEnergyCut", 0.7, "apply min cluster energy cut"}; + Configurable mMinNCellsCut{"mMinNCellsCut", 1, "apply min cluster number of cell cut"}; + Configurable mMinOpenAngleCut{"mMinOpenAngleCut", 0.0202, "apply min opening angle cut"}; + Configurable mClusterDefinition{"mClusterDefinition", "kV3Default", "cluster definition to be selected, e.g. V3Default"}; + Configurable mSplitEMCalDCal{"mSplitEMCalDCal", 0, "Create and fill inv mass histograms for photons on EMCal and DCal individually"}; std::vector mVetoBCIDs; std::vector mSelectBCIDs; @@ -172,19 +168,15 @@ struct Pi0QCTask { /// \brief Create output histograms and initialize geometry void init(InitContext const&) { - // create histograms - using o2HistType = HistType; - using o2Axis = AxisSpec; - // load geometry just in case we need it mGeometry = o2::emcal::Geometry::GetInstanceFromRunNumber(300000); // create common axes LOG(info) << "Creating histograms"; - const o2Axis bcAxis{3501, -0.5, 3500.5}; - const o2Axis energyAxis{makeClusterBinning(), "#it{E} (GeV)"}; + const AxisSpec bcAxis{3501, -0.5, 3500.5}; + const AxisSpec energyAxis{makeClusterBinning(), "#it{E} (GeV)"}; - mHistManager.add("events", "events;;#it{count}", o2HistType::kTH1F, {{6, 0.5, 6.5}}); + mHistManager.add("events", "events;;#it{count}", HistType::kTH1F, {{6, 0.5, 6.5}}); auto heventType = mHistManager.get(HIST("events")); heventType->GetXaxis()->SetBinLabel(1, "All events"); heventType->GetXaxis()->SetBinLabel(2, "sel8 + readout"); @@ -192,37 +184,37 @@ struct Pi0QCTask { heventType->GetXaxis()->SetBinLabel(4, "z<10cm"); heventType->GetXaxis()->SetBinLabel(5, "unique col"); heventType->GetXaxis()->SetBinLabel(6, "EMCAL cell>0"); - mHistManager.add("eventBCAll", "Bunch crossing ID of event (all events)", o2HistType::kTH1F, {bcAxis}); - mHistManager.add("eventBCSelected", "Bunch crossing ID of event (selected events)", o2HistType::kTH1F, {bcAxis}); - mHistManager.add("eventVertexZAll", "z-vertex of event (all events)", o2HistType::kTH1F, {{200, -20, 20}}); - mHistManager.add("eventVertexZSelected", "z-vertex of event (selected events)", o2HistType::kTH1F, {{200, -20, 20}}); + mHistManager.add("eventBCAll", "Bunch crossing ID of event (all events)", HistType::kTH1F, {bcAxis}); + mHistManager.add("eventBCSelected", "Bunch crossing ID of event (selected events)", HistType::kTH1F, {bcAxis}); + mHistManager.add("eventVertexZAll", "z-vertex of event (all events)", HistType::kTH1F, {{200, -20, 20}}); + mHistManager.add("eventVertexZSelected", "z-vertex of event (selected events)", HistType::kTH1F, {{200, -20, 20}}); // cluster properties - for (bool iBeforeCuts : {false, true}) { - const char* ClusterDirectory = iBeforeCuts ? "ClustersBeforeCuts" : "ClustersAfterCuts"; - mHistManager.add(Form("%s/clusterE", ClusterDirectory), "Energy of cluster", o2HistType::kTH1F, {energyAxis}); - mHistManager.add(Form("%s/clusterE_SimpleBinning", ClusterDirectory), "Energy of cluster", o2HistType::kTH1F, {{400, 0, 100, "#it{E} (GeV)"}}); - mHistManager.add(Form("%s/clusterTime", ClusterDirectory), "Time of cluster", o2HistType::kTH1F, {{500, -250, 250, "#it{t}_{cls} (ns)"}}); - mHistManager.add(Form("%s/clusterEtaPhi", ClusterDirectory), "Eta and phi of cluster", o2HistType::kTH2F, {{100, -1, 1, "#eta"}, {100, 0, 2 * TMath::Pi(), "#phi"}}); - mHistManager.add(Form("%s/clusterM02", ClusterDirectory), "M02 of cluster", o2HistType::kTH1F, {{400, 0, 5, "#it{M}_{02}"}}); - mHistManager.add(Form("%s/clusterM20", ClusterDirectory), "M20 of cluster", o2HistType::kTH1F, {{400, 0, 2.5, "#it{M}_{20}"}}); - mHistManager.add(Form("%s/clusterNLM", ClusterDirectory), "Number of local maxima of cluster", o2HistType::kTH1I, {{10, 0, 10, "#it{N}_{local maxima}"}}); - mHistManager.add(Form("%s/clusterNCells", ClusterDirectory), "Number of cells in cluster", o2HistType::kTH1I, {{50, 0, 50, "#it{N}_{cells}"}}); - mHistManager.add(Form("%s/clusterDistanceToBadChannel", ClusterDirectory), "Distance to bad channel", o2HistType::kTH1F, {{100, 0, 100, "#it{d}"}}); + for (const bool& iBeforeCuts : {false, true}) { + const char* clusterDirectory = iBeforeCuts ? "ClustersBeforeCuts" : "ClustersAfterCuts"; + mHistManager.add(Form("%s/clusterE", clusterDirectory), "Energy of cluster", HistType::kTH1F, {energyAxis}); + mHistManager.add(Form("%s/clusterE_SimpleBinning", clusterDirectory), "Energy of cluster", HistType::kTH1F, {{400, 0, 100, "#it{E} (GeV)"}}); + mHistManager.add(Form("%s/clusterTime", clusterDirectory), "Time of cluster", HistType::kTH1F, {{500, -250, 250, "#it{t}_{cls} (ns)"}}); + mHistManager.add(Form("%s/clusterEtaPhi", clusterDirectory), "Eta and phi of cluster", HistType::kTH2F, {{100, -1, 1, "#eta"}, {100, 0, o2::constants::math::TwoPI, "#phi"}}); + mHistManager.add(Form("%s/clusterM02", clusterDirectory), "M02 of cluster", HistType::kTH1F, {{400, 0, 5, "#it{M}_{02}"}}); + mHistManager.add(Form("%s/clusterM20", clusterDirectory), "M20 of cluster", HistType::kTH1F, {{400, 0, 2.5, "#it{M}_{20}"}}); + mHistManager.add(Form("%s/clusterNLM", clusterDirectory), "Number of local maxima of cluster", HistType::kTH1I, {{10, 0, 10, "#it{N}_{local maxima}"}}); + mHistManager.add(Form("%s/clusterNCells", clusterDirectory), "Number of cells in cluster", HistType::kTH1I, {{50, 0, 50, "#it{N}_{cells}"}}); + mHistManager.add(Form("%s/clusterDistanceToBadChannel", clusterDirectory), "Distance to bad channel", HistType::kTH1F, {{100, 0, 100, "#it{d}"}}); } // meson related histograms - mHistManager.add("invMassVsPt", "invariant mass and pT of meson candidates", o2HistType::kTH2F, {invmassBinning, pTBinning}); - mHistManager.add("invMassVsPtBackground", "invariant mass and pT of background meson candidates", o2HistType::kTH2F, {invmassBinning, pTBinning}); - mHistManager.add("invMassVsPtMixedBackground", "invariant mass and pT of mixed background meson candidates", o2HistType::kTH2F, {invmassBinning, pTBinning}); + mHistManager.add("invMassVsPt", "invariant mass and pT of meson candidates", HistType::kTH2F, {invmassBinning, pTBinning}); + mHistManager.add("invMassVsPtBackground", "invariant mass and pT of background meson candidates", HistType::kTH2F, {invmassBinning, pTBinning}); + mHistManager.add("invMassVsPtMixedBackground", "invariant mass and pT of mixed background meson candidates", HistType::kTH2F, {invmassBinning, pTBinning}); if (mSplitEMCalDCal) { - mHistManager.add("invMassVsPt_EMCal", "invariant mass and pT of meson candidates with both clusters on EMCal", o2HistType::kTH2F, {invmassBinning, pTBinning}); - mHistManager.add("invMassVsPtBackground_EMCal", "invariant mass and pT of background meson candidates with both clusters on EMCal", o2HistType::kTH2F, {invmassBinning, pTBinning}); - mHistManager.add("invMassVsPtMixedBackground_EMCal", "invariant mass and pT of mixed background meson candidates with both clusters on EMCal", o2HistType::kTH2F, {invmassBinning, pTBinning}); - mHistManager.add("invMassVsPt_DCal", "invariant mass and pT of meson candidates with both clusters on DCal", o2HistType::kTH2F, {invmassBinning, pTBinning}); - mHistManager.add("invMassVsPtBackground_DCal", "invariant mass and pT of background meson candidates with both clusters on DCal", o2HistType::kTH2F, {invmassBinning, pTBinning}); - mHistManager.add("invMassVsPtMixedBackground_DCal", "invariant mass and pT of mixed background meson candidates with both clusters on DCal", o2HistType::kTH2F, {invmassBinning, pTBinning}); + mHistManager.add("invMassVsPt_EMCal", "invariant mass and pT of meson candidates with both clusters on EMCal", HistType::kTH2F, {invmassBinning, pTBinning}); + mHistManager.add("invMassVsPtBackground_EMCal", "invariant mass and pT of background meson candidates with both clusters on EMCal", HistType::kTH2F, {invmassBinning, pTBinning}); + mHistManager.add("invMassVsPtMixedBackground_EMCal", "invariant mass and pT of mixed background meson candidates with both clusters on EMCal", HistType::kTH2F, {invmassBinning, pTBinning}); + mHistManager.add("invMassVsPt_DCal", "invariant mass and pT of meson candidates with both clusters on DCal", HistType::kTH2F, {invmassBinning, pTBinning}); + mHistManager.add("invMassVsPtBackground_DCal", "invariant mass and pT of background meson candidates with both clusters on DCal", HistType::kTH2F, {invmassBinning, pTBinning}); + mHistManager.add("invMassVsPtMixedBackground_DCal", "invariant mass and pT of mixed background meson candidates with both clusters on DCal", HistType::kTH2F, {invmassBinning, pTBinning}); } if (mVetoBCID->length()) { @@ -247,10 +239,10 @@ struct Pi0QCTask { } } - PresliceUnsorted perCollision = o2::aod::emcalcluster::collisionId; + PresliceUnsorted perCollision = o2::aod::emcalcluster::collisionId; /// \brief Process EMCAL clusters that are matched to a collisions - void processCollision(MyBCs const&, MyCollisions const& collisions, selectedClusters const& clusters, o2::soa::Filtered const& cells) + void processCollision(MyBCs const&, MyCollisions const& collisions, SelectedClusters const& clusters, o2::soa::Filtered const& cells) { std::unordered_map cellGlobalBCs; // Build map of number of cells for corrected BCs using global BCs @@ -265,7 +257,7 @@ struct Pi0QCTask { } } - for (auto& collision : collisions) { + for (const auto& collision : collisions) { mHistManager.fill(HIST("events"), 1); // Fill "All events" bin of event histogram if (mDoEventSel && (!collision.sel8() || (mRequireCaloReadout && !collision.alias_bit(kTVXinEMC)))) { // Check sel8 and whether EMC was read out @@ -298,16 +290,16 @@ struct Pi0QCTask { } mHistManager.fill(HIST("events"), 6); // Fill at least one non0 cell in EMCal of event histogram (Selected) - auto clusters_per_coll = clusters.sliceBy(perCollision, collision.collisionId()); - ProcessClusters(clusters_per_coll); - ProcessMesons(); + auto clustersPerColl = clusters.sliceBy(perCollision, collision.collisionId()); + processClusters(clustersPerColl); + processMesons(); } } - PROCESS_SWITCH(Pi0QCTask, processCollision, "Process clusters from collision", false); + PROCESS_SWITCH(EmcalPi0Qc, processCollision, "Process clusters from collision", false); /// \brief Process EMCAL clusters that are not matched to a collision /// This is not needed for most users - void processAmbiguous(o2::aod::BCs::iterator const& bc, selectedAmbiguousClusters const& clusters) + void processAmbiguous(o2::aod::BCs::iterator const& bc, SelectedAmbiguousClusters const& clusters) { LOG(debug) << "processAmbiguous"; // TODO: remove this loop and put it in separate process function that only takes care of ambiguous clusters @@ -323,16 +315,16 @@ struct Pi0QCTask { } mHistManager.fill(HIST("eventBCSelected"), eventIR.bc); - ProcessAmbiguousClusters(clusters); - ProcessMesons(); + processAmbiguousClusters(clusters); + processMesons(); } - PROCESS_SWITCH(Pi0QCTask, processAmbiguous, "Process Ambiguous clusters", false); + PROCESS_SWITCH(EmcalPi0Qc, processAmbiguous, "Process Ambiguous clusters", false); /// \brief Process EMCAL clusters that are matched to a collisions template - void ProcessClusters(Clusters const& clusters) + void processClusters(Clusters const& clusters) { - LOG(debug) << "ProcessClusters"; + LOG(debug) << "processClusters"; // clear photon vector mPhotons.clear(); @@ -351,12 +343,12 @@ struct Pi0QCTask { LOG(info) << "Something went wrong with the collision ID"; } - FillClusterQAHistos(cluster); + fillClusterQAHistos(cluster); - if (ClusterRejectedByCut(cluster)) + if (clusterRejectedByCut(cluster)) continue; - FillClusterQAHistos(cluster); + fillClusterQAHistos(cluster); // put clusters in photon vector mPhotons.push_back(Photon(cluster.eta(), cluster.phi(), cluster.energy(), cluster.id())); @@ -365,21 +357,21 @@ struct Pi0QCTask { /// \brief Process EMCAL clusters that are not matched to a collisions template - void ProcessAmbiguousClusters(Clusters const& clusters) + void processAmbiguousClusters(Clusters const& clusters) { - LOG(debug) << "ProcessClusters"; + LOG(debug) << "processClusters"; // clear photon vector mPhotons.clear(); // loop over all clusters from accepted collision for (const auto& cluster : clusters) { - FillClusterQAHistos(cluster); + fillClusterQAHistos(cluster); - if (ClusterRejectedByCut(cluster)) + if (clusterRejectedByCut(cluster)) continue; - FillClusterQAHistos(cluster); + fillClusterQAHistos(cluster); // put clusters in photon vector mPhotons.push_back(Photon(cluster.eta(), cluster.phi(), cluster.energy(), cluster.id())); @@ -388,33 +380,33 @@ struct Pi0QCTask { /// \brief Fills the standard QA histograms for a given cluster template - void FillClusterQAHistos(Cluster const& cluster) + void fillClusterQAHistos(Cluster const& cluster) { // In this implementation the cluster properties are directly loaded from the flat table, // in the future one should consider using the AnalysisCluster object to work with after loading. - static constexpr std::string_view clusterQAHistEnergy[2] = {"ClustersBeforeCuts/clusterE", "ClustersAfterCuts/clusterE"}; - static constexpr std::string_view clusterQAHistEnergySimpleBinning[2] = {"ClustersBeforeCuts/clusterE_SimpleBinning", "ClustersAfterCuts/clusterE_SimpleBinning"}; - static constexpr std::string_view clusterQAHistTime[2] = {"ClustersBeforeCuts/clusterTime", "ClustersAfterCuts/clusterTime"}; - static constexpr std::string_view clusterQAHistEtaPhi[2] = {"ClustersBeforeCuts/clusterEtaPhi", "ClustersAfterCuts/clusterEtaPhi"}; - static constexpr std::string_view clusterQAHistM02[2] = {"ClustersBeforeCuts/clusterM02", "ClustersAfterCuts/clusterM02"}; - static constexpr std::string_view clusterQAHistM20[2] = {"ClustersBeforeCuts/clusterM20", "ClustersAfterCuts/clusterM20"}; - static constexpr std::string_view clusterQAHistNLM[2] = {"ClustersBeforeCuts/clusterNLM", "ClustersAfterCuts/clusterNLM"}; - static constexpr std::string_view clusterQAHistNCells[2] = {"ClustersBeforeCuts/clusterNCells", "ClustersAfterCuts/clusterNCells"}; - static constexpr std::string_view clusterQAHistDistanceToBadChannel[2] = {"ClustersBeforeCuts/clusterDistanceToBadChannel", "ClustersAfterCuts/clusterDistanceToBadChannel"}; - mHistManager.fill(HIST(clusterQAHistEnergy[BeforeCuts]), cluster.energy()); - mHistManager.fill(HIST(clusterQAHistEnergySimpleBinning[BeforeCuts]), cluster.energy()); - mHistManager.fill(HIST(clusterQAHistTime[BeforeCuts]), cluster.time()); - mHistManager.fill(HIST(clusterQAHistEtaPhi[BeforeCuts]), cluster.eta(), cluster.phi()); - mHistManager.fill(HIST(clusterQAHistM02[BeforeCuts]), cluster.m02()); - mHistManager.fill(HIST(clusterQAHistM20[BeforeCuts]), cluster.m20()); - mHistManager.fill(HIST(clusterQAHistNLM[BeforeCuts]), cluster.nlm()); - mHistManager.fill(HIST(clusterQAHistNCells[BeforeCuts]), cluster.nCells()); - mHistManager.fill(HIST(clusterQAHistDistanceToBadChannel[BeforeCuts]), cluster.distanceToBadChannel()); + static constexpr std::string_view kClusterQAHistEnergy[2] = {"ClustersBeforeCuts/clusterE", "ClustersAfterCuts/clusterE"}; + static constexpr std::string_view kClusterQAHistEnergySimpleBinning[2] = {"ClustersBeforeCuts/clusterE_SimpleBinning", "ClustersAfterCuts/clusterE_SimpleBinning"}; + static constexpr std::string_view kClusterQAHistTime[2] = {"ClustersBeforeCuts/clusterTime", "ClustersAfterCuts/clusterTime"}; + static constexpr std::string_view kClusterQAHistEtaPhi[2] = {"ClustersBeforeCuts/clusterEtaPhi", "ClustersAfterCuts/clusterEtaPhi"}; + static constexpr std::string_view kClusterQAHistM02[2] = {"ClustersBeforeCuts/clusterM02", "ClustersAfterCuts/clusterM02"}; + static constexpr std::string_view kClusterQAHistM20[2] = {"ClustersBeforeCuts/clusterM20", "ClustersAfterCuts/clusterM20"}; + static constexpr std::string_view kClusterQAHistNLM[2] = {"ClustersBeforeCuts/clusterNLM", "ClustersAfterCuts/clusterNLM"}; + static constexpr std::string_view kClusterQAHistNCells[2] = {"ClustersBeforeCuts/clusterNCells", "ClustersAfterCuts/clusterNCells"}; + static constexpr std::string_view kClusterQAHistDistanceToBadChannel[2] = {"ClustersBeforeCuts/clusterDistanceToBadChannel", "ClustersAfterCuts/clusterDistanceToBadChannel"}; + mHistManager.fill(HIST(kClusterQAHistEnergy[BeforeCuts]), cluster.energy()); + mHistManager.fill(HIST(kClusterQAHistEnergySimpleBinning[BeforeCuts]), cluster.energy()); + mHistManager.fill(HIST(kClusterQAHistTime[BeforeCuts]), cluster.time()); + mHistManager.fill(HIST(kClusterQAHistEtaPhi[BeforeCuts]), cluster.eta(), cluster.phi()); + mHistManager.fill(HIST(kClusterQAHistM02[BeforeCuts]), cluster.m02()); + mHistManager.fill(HIST(kClusterQAHistM20[BeforeCuts]), cluster.m20()); + mHistManager.fill(HIST(kClusterQAHistNLM[BeforeCuts]), cluster.nlm()); + mHistManager.fill(HIST(kClusterQAHistNCells[BeforeCuts]), cluster.nCells()); + mHistManager.fill(HIST(kClusterQAHistDistanceToBadChannel[BeforeCuts]), cluster.distanceToBadChannel()); } /// \brief Return a boolean that states, whether a cluster should be rejected by the applied cluster cuts template - bool ClusterRejectedByCut(Cluster const& cluster) + bool clusterRejectedByCut(Cluster const& cluster) { // apply basic cluster cuts if (cluster.energy() < mMinEnergyCut) { @@ -440,9 +432,9 @@ struct Pi0QCTask { } /// \brief Process meson candidates, calculate invariant mass and pT and fill histograms - void ProcessMesons() + void processMesons() { - LOG(debug) << "ProcessMesons " << mPhotons.size(); + LOG(debug) << "processMesons " << mPhotons.size(); // if less then 2 clusters are found, skip event if (mPhotons.size() < 2) @@ -467,22 +459,22 @@ struct Pi0QCTask { } // calculate background candidates (rotation background) - CalculateBackground(meson, ig1, ig2); + calculateBackground(meson, ig1, ig2); } - CalculateMixedBack(mPhotons[ig1]); + calculateMixedBack(mPhotons[ig1]); } - evtMix.AddEvent(mPhotons); + evtMix.addEvent(mPhotons); } /// \brief Calculate background (using rotation background method) - void CalculateBackground(const Meson& meson, unsigned int ig1, unsigned int ig2) + void calculateBackground(const Meson& meson, unsigned int ig1, unsigned int ig2) { // if less than 3 clusters are present, skip event if (mPhotons.size() < 3) { return; } - const double rotationAngle = M_PI / 2.0; // 0.78539816339; // rotaion angle 90° + const double rotationAngle = o2::constants::math::PIHalf; // 0.78539816339; // rotaion angle 90° TLorentzVector lvRotationPhoton1; // photon candidates which get rotated TLorentzVector lvRotationPhoton2; // photon candidates which get rotated @@ -535,7 +527,7 @@ struct Pi0QCTask { } } - void CalculateMixedBack(Photon gamma) + void calculateMixedBack(Photon gamma) { for (unsigned int i = 0; i < evtMix.vecEvtMix.size(); ++i) { for (unsigned int ig1 = 0; ig1 < evtMix.vecEvtMix[i].size(); ++ig1) { @@ -562,7 +554,7 @@ struct Pi0QCTask { std::vector result; int nBinsPt = 179; double maxPt = 60; - for (Int_t i = 0; i < nBinsPt + 1; i++) { + for (int i = 0; i < nBinsPt + 1; i++) { if (i < 100) { result.emplace_back(0.10 * i); } else if (i < 140) { @@ -580,7 +572,7 @@ struct Pi0QCTask { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { WorkflowSpec workflow{ - adaptAnalysisTask(cfgc, TaskName{"EMCPi0QCTask"}, SetDefaultProcesses{{{"processCollision", true}, {"processAmbiguous", false}}}), - adaptAnalysisTask(cfgc, TaskName{"EMCPi0QCTaskAmbiguous"}, SetDefaultProcesses{{{"processCollision", false}, {"processAmbiguous", true}}})}; + adaptAnalysisTask(cfgc, TaskName{"EmcalPi0QcAssociate"}, SetDefaultProcesses{{{"processCollision", true}, {"processAmbiguous", false}}}), // o2-linter: disable=name/o2-task (adapted multiple times) + adaptAnalysisTask(cfgc, TaskName{"EmcalPi0QcAmbiguous"}, SetDefaultProcesses{{{"processCollision", false}, {"processAmbiguous", true}}})}; // o2-linter: disable=name/o2-task (adapted multiple times) return workflow; } From 7ae959307e5a730aa780be2868e2ee7ee36fe7d2 Mon Sep 17 00:00:00 2001 From: ariedel-cern <85537041+ariedel-cern@users.noreply.github.com> Date: Fri, 10 Oct 2025 02:49:54 +0200 Subject: [PATCH 686/986] [PWGCF] Fix CMakeLists.txt in femtodream (#13284) --- PWGCF/FemtoDream/Tasks/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/PWGCF/FemtoDream/Tasks/CMakeLists.txt b/PWGCF/FemtoDream/Tasks/CMakeLists.txt index d3b0bc6a436..4e1485f4133 100644 --- a/PWGCF/FemtoDream/Tasks/CMakeLists.txt +++ b/PWGCF/FemtoDream/Tasks/CMakeLists.txt @@ -88,3 +88,8 @@ o2physics_add_dpl_workflow(femtodream-pair-v0-v0 SOURCES femtoDreamPairTaskV0V0.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(femto-dream-pair-efficiency + SOURCES femtoDreamPairEfficiency.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) From d319f6b41cde2a1235d15d08ae2ec92dee87fdf5 Mon Sep 17 00:00:00 2001 From: alicja-pp <101565842+alicja-pp@users.noreply.github.com> Date: Fri, 10 Oct 2025 04:18:15 +0200 Subject: [PATCH 687/986] [PWGCF] FemtoUniverse: Calculate fractions for track-V0 pairs for MC truth (#13299) --- .../femtoUniversePairTaskTrackV0Extended.cxx | 120 ++++++++++++------ 1 file changed, 79 insertions(+), 41 deletions(-) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Extended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Extended.cxx index cd7cf167027..2eb861818a0 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Extended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Extended.cxx @@ -86,11 +86,14 @@ struct FemtoUniversePairTaskTrackV0Extended { FemtoUniverseParticleHisto trackHistoPartOneNeg; /// Particle 2 (V0) - Configurable confV0PDGCodePartTwo{"confV0PDGCodePartTwo", 3122, "Particle 2 (V0) - PDG code"}; + struct : o2::framework::ConfigurableGroup { + Configurable confV0PDGCodePartTwo{"confV0PDGCodePartTwo", 3122, "Particle 2 (V0) - PDG code"}; + Configurable confV0Type1{"confV0Type1", 0, "select one of the V0s (lambda = 0, anti-lambda = 1, k0 = 2) for v0-v0 and Track-v0 combination"}; + Configurable confV0Type2{"confV0Type2", 0, "select one of the V0s (lambda = 0, anti-lambda = 1, k0 = 2) for v0-v0 combination"}; + } ConfV0Selection; + ConfigurableAxis confV0TempFitVarBins{"confV0TempFitVarBins", {300, 0.95, 1.}, "V0: binning of the TempFitVar in the pT vs. TempFitVar plot"}; ConfigurableAxis confV0TempFitVarpTBins{"confV0TempFitVarpTBins", {20, 0.5, 4.05}, "V0: pT binning of the pT vs. TempFitVar plot"}; - Configurable confV0Type1{"confV0Type1", 0, "select one of the V0s (lambda = 0, anti-lambda = 1, k0 = 2) for v0-v0 and Track-v0 combination"}; - Configurable confV0Type2{"confV0Type2", 0, "select one of the V0s (lambda = 0, anti-lambda = 1, k0 = 2) for v0-v0 combination"}; Configurable confV0InvMassLowLimit{"confV0InvMassLowLimit", 1.10, "Lower limit of the V0 invariant mass"}; Configurable confV0InvMassUpLimit{"confV0InvMassUpLimit", 1.13, "Upper limit of the V0 invariant mass"}; ConfigurableAxis confChildTempFitVarBins{"confChildTempFitVarBins", {300, -0.15, 0.15}, "V0 child: binning of the TempFitVar in the pT vs. TempFitVar plot"}; @@ -218,7 +221,7 @@ struct FemtoUniversePairTaskTrackV0Extended { qaRegistry.add("Tracks_neg/nSigmaTOF", "; #it{p} (GeV/#it{c}); n#sigma_{TOF}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); trackHistoPartOnePos.init(&qaRegistry, confTrkTempFitVarpTBins, confTrkTempFitVarBins, confIsMC, confTrkPDGCodePartOne); trackHistoPartOneNeg.init(&qaRegistry, confTrkTempFitVarpTBins, confTrkTempFitVarBins, confIsMC, confTrkPDGCodePartOne); - trackHistoPartTwo.init(&qaRegistry, confV0TempFitVarpTBins, confV0TempFitVarBins, confIsMC, confV0PDGCodePartTwo, true); + trackHistoPartTwo.init(&qaRegistry, confV0TempFitVarpTBins, confV0TempFitVarBins, confIsMC, ConfV0Selection.confV0PDGCodePartTwo, true); posChildHistos.init(&qaRegistry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, 0, true); negChildHistos.init(&qaRegistry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, 0, true); @@ -226,10 +229,10 @@ struct FemtoUniversePairTaskTrackV0Extended { qaRegistry.add("V0Type2/hInvMassLambdaVsCent", "; Centrality; M_{#Lambda}; Entries", kTH2F, {confMultBins, {2000, 1.f, 3.f}}); qaRegistry.add("V0Type1/hInvMassAntiLambdaVsCent", "; Centrality; M_{#Lambda}; Entries", kTH2F, {confMultBins, {2000, 1.f, 3.f}}); qaRegistry.add("V0Type2/hInvMassAntiLambdaVsCent", "; Centrality; M_{#Lambda}; Entries", kTH2F, {confMultBins, {2000, 1.f, 3.f}}); - trackHistoV0Type1.init(&qaRegistry, confV0TempFitVarpTBins, confV0TempFitVarBins, confIsMC, confV0PDGCodePartTwo, true, "V0Type1"); + trackHistoV0Type1.init(&qaRegistry, confV0TempFitVarpTBins, confV0TempFitVarBins, confIsMC, ConfV0Selection.confV0PDGCodePartTwo, true, "V0Type1"); posChildV0Type1.init(&qaRegistry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, 0, true, "posChildV0Type1"); negChildV0Type1.init(&qaRegistry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, 0, true, "negChildV0Type1"); - trackHistoV0Type2.init(&qaRegistry, confV0TempFitVarpTBins, confV0TempFitVarBins, confIsMC, confV0PDGCodePartTwo, true, "V0Type2"); + trackHistoV0Type2.init(&qaRegistry, confV0TempFitVarpTBins, confV0TempFitVarBins, confIsMC, ConfV0Selection.confV0PDGCodePartTwo, true, "V0Type2"); posChildV0Type2.init(&qaRegistry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, 0, true, "posChildV0Type2"); negChildV0Type2.init(&qaRegistry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, 0, true, "negChildV0Type2"); @@ -253,7 +256,7 @@ struct FemtoUniversePairTaskTrackV0Extended { registryMCtruth.add("minus/MCtruthPiPt", "MC truth pions;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); registryMCtruth.add("minus/MCtruthPrPt", "MC truth protons;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); - registryMCtruth.add("motherParticle", "pair fractions;part1 mother PDG;part2 mother PDG", {HistType::kTH2F, {{8001, -4000, 4000}, {8001, -4000, 4000}}}); + registryMCtruth.add("mothersTruth/motherParticle", "pair fractions;part1 mother PDG;part2 mother PDG", {HistType::kTH2F, {{8001, -4000, 4000}, {8001, -4000, 4000}}}); // MC reco registryMCreco.add("plus/MCrecoLambda", "MC reco Lambdas;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); @@ -277,12 +280,12 @@ struct FemtoUniversePairTaskTrackV0Extended { registryMCreco.add("minus/MCrecoPiPt", "MC reco pions;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); registryMCreco.add("minus/MCrecoPrPt", "MC reco protons;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); - registryMCreco.add("motherParticle", "pair fractions;part1 mother PDG;part2 mother PDG", {HistType::kTH2F, {{8001, -4000, 4000}, {8001, -4000, 4000}}}); + registryMCreco.add("mothersReco/motherParticle", "pair fractions;part1 mother PDG;part2 mother PDG", {HistType::kTH2F, {{8001, -4000, 4000}, {8001, -4000, 4000}}}); sameEventCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, confIsMC, confUse3D); - sameEventCont.setPDGCodes(confTrkPDGCodePartOne, confV0PDGCodePartTwo); + sameEventCont.setPDGCodes(confTrkPDGCodePartOne, ConfV0Selection.confV0PDGCodePartTwo); mixedEventCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, confIsMC, confUse3D); - mixedEventCont.setPDGCodes(confTrkPDGCodePartOne, confV0PDGCodePartTwo); + mixedEventCont.setPDGCodes(confTrkPDGCodePartOne, ConfV0Selection.confV0PDGCodePartTwo); pairCleaner.init(&qaRegistry); pairCleanerV0.init(&qaRegistry); @@ -297,11 +300,11 @@ struct FemtoUniversePairTaskTrackV0Extended { LOGF(fatal, "Could not load efficiency histogram from %s", confLocalEfficiency.value.c_str()); if (doprocessSameEvent || doprocessMixedEvent) { plocalEffp1 = (confChargePart1 > 0) ? std::unique_ptr(plocalEffFile.get()->Get("PrPlus")) : std::unique_ptr(plocalEffFile.get()->Get("PrMinus")); // note: works only for protons for now - plocalEffp2 = (confV0Type1 == 0) ? std::unique_ptr(plocalEffFile.get()->Get("Lambda")) : std::unique_ptr(plocalEffFile.get()->Get("AntiLambda")); + plocalEffp2 = (ConfV0Selection.confV0Type1 == 0) ? std::unique_ptr(plocalEffFile.get()->Get("Lambda")) : std::unique_ptr(plocalEffFile.get()->Get("AntiLambda")); LOGF(info, "Loaded efficiency histograms for track-V0."); } else if (doprocessSameEventV0 || doprocessMixedEventV0) { - plocalEffp1 = (confV0Type1 == 0) ? std::unique_ptr(plocalEffFile.get()->Get("Lambda")) : std::unique_ptr(plocalEffFile.get()->Get("AntiLambda")); - plocalEffp2 = (confV0Type2 == 0) ? std::unique_ptr(plocalEffFile.get()->Get("Lambda")) : std::unique_ptr(plocalEffFile.get()->Get("AntiLambda")); + plocalEffp1 = (ConfV0Selection.confV0Type1 == 0) ? std::unique_ptr(plocalEffFile.get()->Get("Lambda")) : std::unique_ptr(plocalEffFile.get()->Get("AntiLambda")); + plocalEffp2 = (ConfV0Selection.confV0Type2 == 0) ? std::unique_ptr(plocalEffFile.get()->Get("Lambda")) : std::unique_ptr(plocalEffFile.get()->Get("AntiLambda")); LOGF(info, "Loaded efficiency histograms for V0-V0."); } } @@ -325,7 +328,7 @@ struct FemtoUniversePairTaskTrackV0Extended { const auto& posChild = parts.iteratorAt(part.index() - 2); const auto& negChild = parts.iteratorAt(part.index() - 1); /// Daughters that do not pass this condition are not selected - if (!isParticleTPC(posChild, V0ChildTable[confV0Type1][0]) || !isParticleTPC(negChild, V0ChildTable[confV0Type1][1])) + if (!isParticleTPC(posChild, V0ChildTable[ConfV0Selection.confV0Type1][0]) || !isParticleTPC(negChild, V0ChildTable[ConfV0Selection.confV0Type1][1])) continue; trackHistoPartTwo.fillQA(part); @@ -372,7 +375,7 @@ struct FemtoUniversePairTaskTrackV0Extended { const auto& negChild = parts.iteratorAt(p2.index() - 1); /// Daughters that do not pass this condition are not selected - if (!isParticleTPC(posChild, V0ChildTable[confV0Type1][0]) || !isParticleTPC(negChild, V0ChildTable[confV0Type1][1])) + if (!isParticleTPC(posChild, V0ChildTable[ConfV0Selection.confV0Type1][0]) || !isParticleTPC(negChild, V0ChildTable[ConfV0Selection.confV0Type1][1])) continue; float weight = 1.0f; @@ -403,7 +406,7 @@ struct FemtoUniversePairTaskTrackV0Extended { const auto& negChild = parts.iteratorAt(part.index() - 1); /// Check daughters of first V0 particle - if (isParticleTPC(posChild, V0ChildTable[confV0Type1][0]) && isParticleTPC(negChild, V0ChildTable[confV0Type1][1])) { + if (isParticleTPC(posChild, V0ChildTable[ConfV0Selection.confV0Type1][0]) && isParticleTPC(negChild, V0ChildTable[ConfV0Selection.confV0Type1][1])) { trackHistoV0Type1.fillQABase(part, HIST("V0Type1")); posChildV0Type1.fillQABase(posChild, HIST("posChildV0Type1")); negChildV0Type1.fillQABase(negChild, HIST("negChildV0Type1")); @@ -414,7 +417,7 @@ struct FemtoUniversePairTaskTrackV0Extended { } } /// Check daughters of second V0 particle - if (isParticleTPC(posChild, V0ChildTable[confV0Type2][0]) && isParticleTPC(negChild, V0ChildTable[confV0Type2][1])) { + if (isParticleTPC(posChild, V0ChildTable[ConfV0Selection.confV0Type2][0]) && isParticleTPC(negChild, V0ChildTable[ConfV0Selection.confV0Type2][1])) { trackHistoV0Type2.fillQABase(part, HIST("V0Type2")); posChildV0Type2.fillQABase(posChild, HIST("posChildV0Type2")); negChildV0Type2.fillQABase(negChild, HIST("negChildV0Type2")); @@ -445,13 +448,13 @@ struct FemtoUniversePairTaskTrackV0Extended { const auto& posChild1 = parts.iteratorAt(p1.index() - 2); const auto& negChild1 = parts.iteratorAt(p1.index() - 1); /// Daughters that do not pass this condition are not selected - if (!isParticleTPC(posChild1, V0ChildTable[confV0Type1][0]) || !isParticleTPC(negChild1, V0ChildTable[confV0Type1][1])) + if (!isParticleTPC(posChild1, V0ChildTable[ConfV0Selection.confV0Type1][0]) || !isParticleTPC(negChild1, V0ChildTable[ConfV0Selection.confV0Type1][1])) return; const auto& posChild2 = parts.iteratorAt(p2.index() - 2); const auto& negChild2 = parts.iteratorAt(p2.index() - 1); /// Daughters that do not pass this condition are not selected - if (!isParticleTPC(posChild2, V0ChildTable[confV0Type2][0]) || !isParticleTPC(negChild2, V0ChildTable[confV0Type2][1])) + if (!isParticleTPC(posChild2, V0ChildTable[ConfV0Selection.confV0Type2][0]) || !isParticleTPC(negChild2, V0ChildTable[ConfV0Selection.confV0Type2][1])) return; if constexpr (std::is_same::value) @@ -460,7 +463,7 @@ struct FemtoUniversePairTaskTrackV0Extended { sameEventCont.setPair(p1, p2, multCol, confUse3D); }; - if (confV0Type1 == confV0Type2) { + if (ConfV0Selection.confV0Type1 == ConfV0Selection.confV0Type2) { /// Now build the combinations for identical V0s for (const auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsTwo, groupPartsTwo))) { pairProcessFunc(p1, p2); @@ -519,7 +522,7 @@ struct FemtoUniversePairTaskTrackV0Extended { /// Histogramming same event for (const auto& part : groupPartsTwo) { int pdgCode = static_cast(part.pidCut()); - if ((confV0Type1 == 0 && pdgCode != kLambda0) || (confV0Type1 == 1 && pdgCode != kLambda0Bar)) + if ((ConfV0Selection.confV0Type1 == 0 && pdgCode != kLambda0) || (ConfV0Selection.confV0Type1 == 1 && pdgCode != kLambda0Bar)) continue; trackHistoPartTwo.fillQA(part); } @@ -545,7 +548,7 @@ struct FemtoUniversePairTaskTrackV0Extended { if (static_cast(p1.pidCut()) != confTrkPDGCodePartOne) continue; int pdgCode2 = static_cast(p2.pidCut()); - if ((confV0Type1 == 0 && pdgCode2 != kLambda0) || (confV0Type1 == 1 && pdgCode2 != kLambda0Bar)) + if ((ConfV0Selection.confV0Type1 == 0 && pdgCode2 != kLambda0) || (ConfV0Selection.confV0Type1 == 1 && pdgCode2 != kLambda0Bar)) continue; // track cleaning if (confIsCPR.value) { @@ -572,7 +575,7 @@ struct FemtoUniversePairTaskTrackV0Extended { const auto& posChild = parts.iteratorAt(part.index() - 2); const auto& negChild = parts.iteratorAt(part.index() - 1); int pdgCode = static_cast(part.pidCut()); - if ((confV0Type1 == 0 && pdgCode == kLambda0) || (confV0Type1 == 1 && pdgCode == kLambda0Bar)) { + if ((ConfV0Selection.confV0Type1 == 0 && pdgCode == kLambda0) || (ConfV0Selection.confV0Type1 == 1 && pdgCode == kLambda0Bar)) { trackHistoV0Type1.fillQABase(part, HIST("V0Type1")); posChildV0Type1.fillQABase(posChild, HIST("posChildV0Type1")); negChildV0Type1.fillQABase(negChild, HIST("negChildV0Type1")); @@ -580,7 +583,7 @@ struct FemtoUniversePairTaskTrackV0Extended { qaRegistry.fill(HIST("V0Type1/hInvMassAntiLambdaVsCent"), multCol, part.mAntiLambda()); effCorrection.fillTruthHist(part); } - if ((confV0Type2 == 0 && pdgCode == kLambda0) || (confV0Type2 == 1 && pdgCode == kLambda0Bar)) { + if ((ConfV0Selection.confV0Type2 == 0 && pdgCode == kLambda0) || (ConfV0Selection.confV0Type2 == 1 && pdgCode == kLambda0Bar)) { trackHistoV0Type2.fillQABase(part, HIST("V0Type2")); posChildV0Type2.fillQABase(posChild, HIST("posChildV0Type2")); negChildV0Type2.fillQABase(negChild, HIST("negChildV0Type2")); @@ -592,15 +595,15 @@ struct FemtoUniversePairTaskTrackV0Extended { auto pairProcessFunc = [&](auto& p1, auto& p2) -> void { int pdgCode1 = static_cast(p1.pidCut()); - if ((confV0Type1 == 0 && pdgCode1 != kLambda0) || (confV0Type1 == 1 && pdgCode1 != kLambda0Bar)) + if ((ConfV0Selection.confV0Type1 == 0 && pdgCode1 != kLambda0) || (ConfV0Selection.confV0Type1 == 1 && pdgCode1 != kLambda0Bar)) return; int pdgCode2 = static_cast(p2.pidCut()); - if ((confV0Type2 == 0 && pdgCode2 != kLambda0) || (confV0Type2 == 1 && pdgCode2 != kLambda0Bar)) + if ((ConfV0Selection.confV0Type2 == 0 && pdgCode2 != kLambda0) || (ConfV0Selection.confV0Type2 == 1 && pdgCode2 != kLambda0Bar)) return; sameEventCont.setPair(p1, p2, multCol, confUse3D); }; /// Now build the combinations - if (confV0Type1 == confV0Type2) { + if (ConfV0Selection.confV0Type1 == ConfV0Selection.confV0Type2) { /// Now build the combinations for identical V0s for (const auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsTwo, groupPartsTwo))) { pairProcessFunc(p1, p2); @@ -646,7 +649,7 @@ struct FemtoUniversePairTaskTrackV0Extended { const auto& posChild = parts.iteratorAt(p2.globalIndex() - 2); const auto& negChild = parts.iteratorAt(p2.globalIndex() - 1); /// Daughters that do not pass this condition are not selected - if (!isParticleTPC(posChild, V0ChildTable[confV0Type1][0]) || !isParticleTPC(negChild, V0ChildTable[confV0Type1][1])) + if (!isParticleTPC(posChild, V0ChildTable[ConfV0Selection.confV0Type1][0]) || !isParticleTPC(negChild, V0ChildTable[ConfV0Selection.confV0Type1][1])) continue; // track cleaning @@ -715,13 +718,13 @@ struct FemtoUniversePairTaskTrackV0Extended { const auto& posChild1 = parts.iteratorAt(p1.globalIndex() - 2); const auto& negChild1 = parts.iteratorAt(p1.globalIndex() - 1); /// Daughters that do not pass this condition are not selected - if (!isParticleTPC(posChild1, V0ChildTable[confV0Type1][0]) || !isParticleTPC(negChild1, V0ChildTable[confV0Type1][1])) + if (!isParticleTPC(posChild1, V0ChildTable[ConfV0Selection.confV0Type1][0]) || !isParticleTPC(negChild1, V0ChildTable[ConfV0Selection.confV0Type1][1])) continue; const auto& posChild2 = parts.iteratorAt(p2.globalIndex() - 2); const auto& negChild2 = parts.iteratorAt(p2.globalIndex() - 1); /// Daughters that do not pass this condition are not selected - if (!isParticleTPC(posChild2, V0ChildTable[confV0Type2][0]) || !isParticleTPC(negChild2, V0ChildTable[confV0Type2][1])) + if (!isParticleTPC(posChild2, V0ChildTable[ConfV0Selection.confV0Type2][0]) || !isParticleTPC(negChild2, V0ChildTable[ConfV0Selection.confV0Type2][1])) continue; // track cleaning @@ -800,7 +803,7 @@ struct FemtoUniversePairTaskTrackV0Extended { if (static_cast(p1.pidCut()) != confTrkPDGCodePartOne) continue; int pdgCode2 = static_cast(p2.pidCut()); - if ((confV0Type1 == 0 && pdgCode2 != kLambda0) || (confV0Type1 == 1 && pdgCode2 != kLambda0Bar)) + if ((ConfV0Selection.confV0Type1 == 0 && pdgCode2 != kLambda0) || (ConfV0Selection.confV0Type1 == 1 && pdgCode2 != kLambda0Bar)) continue; if (confIsCPR.value) { if (pairCloseRejection.isClosePair(p1, p2, parts, magFieldTesla1, femto_universe_container::EventType::mixed)) { @@ -840,10 +843,10 @@ struct FemtoUniversePairTaskTrackV0Extended { for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { int pdgCode1 = static_cast(p1.pidCut()); - if ((confV0Type1 == 0 && pdgCode1 != kLambda0) || (confV0Type1 == 1 && pdgCode1 != kLambda0Bar)) + if ((ConfV0Selection.confV0Type1 == 0 && pdgCode1 != kLambda0) || (ConfV0Selection.confV0Type1 == 1 && pdgCode1 != kLambda0Bar)) continue; int pdgCode2 = static_cast(p2.pidCut()); - if ((confV0Type2 == 0 && pdgCode2 != kLambda0) || (confV0Type2 == 1 && pdgCode2 != kLambda0Bar)) + if ((ConfV0Selection.confV0Type2 == 0 && pdgCode2 != kLambda0) || (ConfV0Selection.confV0Type2 == 1 && pdgCode2 != kLambda0Bar)) continue; mixedEventCont.setPair(p1, p2, multCol, confUse3D); } @@ -943,7 +946,7 @@ struct FemtoUniversePairTaskTrackV0Extended { const auto& posChild = parts.iteratorAt(p2.globalIndex() - 2); const auto& negChild = parts.iteratorAt(p2.globalIndex() - 1); /// Daughters that do not pass this condition are not selected - if (!isParticleTPC(posChild, V0ChildTable[confV0Type1][0]) || !isParticleTPC(negChild, V0ChildTable[confV0Type1][1])) + if (!isParticleTPC(posChild, V0ChildTable[ConfV0Selection.confV0Type1][0]) || !isParticleTPC(negChild, V0ChildTable[ConfV0Selection.confV0Type1][1])) continue; // track cleaning @@ -955,7 +958,7 @@ struct FemtoUniversePairTaskTrackV0Extended { continue; } } - registryMCreco.fill(HIST("motherParticle"), p1.motherPDG(), p2.motherPDG()); + registryMCreco.fill(HIST("mothersReco/motherParticle"), p1.motherPDG(), p2.motherPDG()); } }; @@ -995,13 +998,13 @@ struct FemtoUniversePairTaskTrackV0Extended { const auto& posChild1 = parts.iteratorAt(p1.globalIndex() - 2); const auto& negChild1 = parts.iteratorAt(p1.globalIndex() - 1); /// Daughters that do not pass this condition are not selected - if (!isParticleTPC(posChild1, V0ChildTable[confV0Type1][0]) || !isParticleTPC(negChild1, V0ChildTable[confV0Type1][1])) + if (!isParticleTPC(posChild1, V0ChildTable[ConfV0Selection.confV0Type1][0]) || !isParticleTPC(negChild1, V0ChildTable[ConfV0Selection.confV0Type1][1])) continue; const auto& posChild2 = parts.iteratorAt(p2.globalIndex() - 2); const auto& negChild2 = parts.iteratorAt(p2.globalIndex() - 1); /// Daughters that do not pass this condition are not selected - if (!isParticleTPC(posChild2, V0ChildTable[confV0Type2][0]) || !isParticleTPC(negChild2, V0ChildTable[confV0Type2][1])) + if (!isParticleTPC(posChild2, V0ChildTable[ConfV0Selection.confV0Type2][0]) || !isParticleTPC(negChild2, V0ChildTable[ConfV0Selection.confV0Type2][1])) continue; // track cleaning @@ -1014,7 +1017,7 @@ struct FemtoUniversePairTaskTrackV0Extended { } } - registryMCreco.fill(HIST("motherParticle"), p1.motherPDG(), p2.motherPDG()); + registryMCreco.fill(HIST("mothersReco/motherParticle"), p1.motherPDG(), p2.motherPDG()); } }; @@ -1030,6 +1033,41 @@ struct FemtoUniversePairTaskTrackV0Extended { } PROCESS_SWITCH(FemtoUniversePairTaskTrackV0Extended, processPairFractionsV0, "Process MC data to obtain pair fractions for V0V0 pairs", false); + void processPairFractionsMCTruth(FilteredFDCollisions const& cols, FemtoFullParticles const& /*parts*/) + { + + ColumnBinningPolicy colBinningMult{{confVtxBins, confMultBins}, true}; + ColumnBinningPolicy colBinningCent{{confVtxBins, confMultBins}, true}; + + auto mixedCollProcessFunc = [&](auto& collision1, auto& collision2) -> void { + auto groupPartsOne = partsOneMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupPartsTwo = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); + + for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { + int pdgCode1 = static_cast(p1.pidCut()); + int pdgCode2 = static_cast(p2.pidCut()); + + if (pdgCode1 != confTrkPDGCodePartOne) + continue; + if (pdgCode2 != ConfV0Selection.confV0PDGCodePartTwo) + continue; + + registryMCtruth.fill(HIST("mothersTruth/motherParticle"), p1.tempFitVar(), p2.tempFitVar()); + } + }; + + if (confUseCent) { + for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningCent, confNEventsMix, -1, cols, cols)) { + mixedCollProcessFunc(collision1, collision2); + } + } else { + for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningMult, confNEventsMix, -1, cols, cols)) { + mixedCollProcessFunc(collision1, collision2); + } + } + } + PROCESS_SWITCH(FemtoUniversePairTaskTrackV0Extended, processPairFractionsMCTruth, "Process MC data to obtain pair fractions for MC truth pairs", false); + void processPairFractionsMCTruthV0(FilteredFDCollisions const& cols, FemtoFullParticles const& /*parts*/) { ColumnBinningPolicy colBinningMult{{confVtxBins, confMultBins}, true}; @@ -1041,13 +1079,13 @@ struct FemtoUniversePairTaskTrackV0Extended { for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { int pdgCode1 = static_cast(p1.pidCut()); - if ((confV0Type1 == 0 && pdgCode1 != kLambda0) || (confV0Type1 == 1 && pdgCode1 != kLambda0Bar)) + if ((ConfV0Selection.confV0Type1 == 0 && pdgCode1 != kLambda0) || (ConfV0Selection.confV0Type1 == 1 && pdgCode1 != kLambda0Bar)) continue; int pdgCode2 = static_cast(p2.pidCut()); - if ((confV0Type2 == 0 && pdgCode2 != kLambda0) || (confV0Type2 == 1 && pdgCode2 != kLambda0Bar)) + if ((ConfV0Selection.confV0Type2 == 0 && pdgCode2 != kLambda0) || (ConfV0Selection.confV0Type2 == 1 && pdgCode2 != kLambda0Bar)) continue; - registryMCtruth.fill(HIST("motherParticle"), p1.tempFitVar(), p2.tempFitVar()); + registryMCtruth.fill(HIST("mothersTruth/motherParticle"), p1.tempFitVar(), p2.tempFitVar()); } }; From c4d9a502e9adebd57e87450258408609b1e7d5ff Mon Sep 17 00:00:00 2001 From: yakparo Date: Fri, 10 Oct 2025 05:45:32 +0200 Subject: [PATCH 688/986] [PWGLF] Add task for primary multistrange production in Run 3 (#13315) Co-authored-by: Yakiv <5348341@upjs.sk> --- PWGLF/Tasks/Strangeness/CMakeLists.txt | 5 + PWGLF/Tasks/Strangeness/strangecasctrack.cxx | 171 +++++++++++++++++++ 2 files changed, 176 insertions(+) create mode 100644 PWGLF/Tasks/Strangeness/strangecasctrack.cxx diff --git a/PWGLF/Tasks/Strangeness/CMakeLists.txt b/PWGLF/Tasks/Strangeness/CMakeLists.txt index 3198993318b..31a0087b3fa 100644 --- a/PWGLF/Tasks/Strangeness/CMakeLists.txt +++ b/PWGLF/Tasks/Strangeness/CMakeLists.txt @@ -170,3 +170,8 @@ o2physics_add_dpl_workflow(cascadeanalysislightions SOURCES cascadeAnalysisLightIonsDerivedData.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(strangecasctrack + SOURCES strangecasctrack.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2Physics::EventFilteringUtils + COMPONENT_NAME myo2) diff --git a/PWGLF/Tasks/Strangeness/strangecasctrack.cxx b/PWGLF/Tasks/Strangeness/strangecasctrack.cxx new file mode 100644 index 00000000000..acce86c5847 --- /dev/null +++ b/PWGLF/Tasks/Strangeness/strangecasctrack.cxx @@ -0,0 +1,171 @@ +// 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 strangecasctrack.cxx +/// \brief Analysis of strangeness tracking efficiency via primary production of Omega and Xi in Run 3 +/// \author Yakiv Paroviak (yakiv.paroviak@cern.ch) + +#include "PWGLF/DataModel/LFStrangenessTables.h" + +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::constants::math; + +struct StrangeCascTrack { + + using TraCascDatas = soa::Join; + using CascDatas = soa::Join; + + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + Configurable doProcessPP{"doProcessPP", true, "true for pp, false for PbPb and OO"}; + Configurable doProcessPbPb{"doProcessPbPb", false, "true for PbPb, false for pp and OO"}; + Configurable doProcessOO{"doProcessOO", false, "true for OO, false for pp and PbPb"}; + + Configurable doProcessMC{"doProcessMC", false, "true for MC, false for data"}; + + Configurable doRequireFT0{"doRequireFT0", false, "true for offline trigger for Run 3"}; + Configurable doApplyPID{"doApplyPID", false, "true for offline trigger for Run 3"}; + Configurable doApplyCuts{"doApplyCuts", true, "true for offline trigger for Run 3"}; + + ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 10.0}, "p_{T} (GeV/c)"}; + ConfigurableAxis axisMult{"axisMult", {VARIABLE_WIDTH, 0.0f, 0.01f, 1.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 70.0f, 100.0f}, "Multiplicity"}; + ConfigurableAxis axisOmegaMass{"axisOmegaMass", {2000, 1.6, 1.8}, "#Omega M_{inv} (GeV/c^{2})"}; + ConfigurableAxis axisXiMass{"axisXiMass", {2000, 1.2, 1.4}, "#Xi M_{inv} (GeV/c^{2})"}; + + Configurable CutDCAtoPVxy{"CutDCAtoPVxy", 0.02f, "max cascade dca to PV in xy"}; + Configurable CutDCAtoPVz{"CutDCAtoPVz", 0.02f, "max cascade dca to PV in z"}; + + void init(InitContext const&) + { + histos.add("Events/EvCounter", "Event Counter", kTH1F, {{1, 0, 1}}); + histos.add("Events/PVx", "PV x position", kTH1F, {{200, -0.1, 0.1}}); + histos.add("Events/PVy", "PV y position", kTH1F, {{200, -0.1, 0.1}}); + histos.add("Events/PVz", "PV z position", kTH1F, {{100, -20, 20}}); + histos.add("Events/Mult", "Multiplicity", kTH1F, {axisMult}); + + histos.add("Tracked/Phi", "Phi", kTH1F, {{100, 0., 2 * M_PI}}); + histos.add("Tracked/Eta", "Eta", kTH1F, {{102, -2.01, 2.01}}); + histos.add("Tracked/DCAxy", "DCA to xy", kTH1F, {{500, 0., 0.5}}); + histos.add("Tracked/DCAz", "DCA to z", kTH1F, {{500, 0., 0.5}}); + histos.add("Tracked/EvMult", "Multiplicity of events with >=1 cascade", kTH1F, {axisMult}); + histos.add("Tracked/MassOmega", "Invariant mass hypothesis", kTH1F, {axisOmegaMass}); + histos.add("Tracked/MassXi", "Invariant mass hypothesis", kTH1F, {axisXiMass}); + histos.add("Tracked/Omega", "", kTHnD, {axisOmegaMass, axisPt, axisMult}); + histos.add("Tracked/Xi", "", kTHnD, {axisXiMass, axisPt, axisMult}); + + histos.add("All/Phi", "Phi", kTH1F, {{100, 0., 2 * M_PI}}); + histos.add("All/Eta", "Eta", kTH1F, {{102, -2.01, 2.01}}); + histos.add("All/DCAxy", "DCA to xy", kTH1F, {{1000, 0, 1.}}); + histos.add("All/DCAz", "DCA to z", kTH1F, {{1000, 0, 1.}}); + histos.add("All/EvMult", "Multiplicity of events with >=1 cascade", kTH1F, {axisMult}); + histos.add("All/MassOmega", "Invariant mass hypothesis", kTH1F, {axisOmegaMass}); + histos.add("All/MassXi", "Invariant mass hypothesis", kTH1F, {axisXiMass}); + histos.add("All/Omega", "", kTHnD, {axisOmegaMass, axisPt, axisMult}); + histos.add("All/Xi", "", kTHnD, {axisXiMass, axisPt, axisMult}); + } + + void processTracked(soa::Join::iterator const& collision, + aod::TraCascDatas const& tracascades) + { + double mult = doProcessPP ? collision.centFT0M() : collision.centFT0C(); + int64_t casccollid = 0; + for (auto const& cascade : tracascades) { + + double dcaxy = cascade.dcaXYCascToPV(); + double dcaz = cascade.dcaZCascToPV(); + if (doApplyCuts && ((dcaxy > CutDCAtoPVxy) || (dcaz > CutDCAtoPVz))) + continue; // DCA check + + if (collision.index() != casccollid) { + histos.fill(HIST("Tracked/EvMult"), mult); // count and list mult of events with at least one cascade + casccollid = collision.index(); + } + + double pt = cascade.pt(); + double phi = cascade.phi(); + double eta = cascade.eta(); + double massXi = cascade.mXi(); + double massOmega = cascade.mOmega(); + + histos.fill(HIST("Tracked/DCAxy"), dcaxy); + histos.fill(HIST("Tracked/DCAz"), dcaz); + histos.fill(HIST("Tracked/Phi"), phi); + histos.fill(HIST("Tracked/Eta"), eta); + histos.fill(HIST("Tracked/MassXi"), massXi); + histos.fill(HIST("Tracked/MassOmega"), massOmega); + histos.fill(HIST("Tracked/Xi"), massXi, pt, mult); + histos.fill(HIST("Tracked/Omega"), massOmega, pt, mult); + } + } + + void processAll(soa::Join::iterator const& collision, + aod::CascDatas const& cascades) + { + histos.fill(HIST("Events/EvCounter"), 0.5); + double mult = doProcessPP ? collision.centFT0M() : collision.centFT0C(); + histos.fill(HIST("Events/Mult"), mult); + double pvx = collision.posX(); + double pvy = collision.posY(); + double pvz = collision.posZ(); + histos.fill(HIST("Events/PVx"), pvx); + histos.fill(HIST("Events/PVy"), pvy); + histos.fill(HIST("Events/PVz"), pvz); + + int64_t casccollid = 0; + for (auto const& cascade : cascades) { + + double dcaxy = cascade.dcaXYCascToPV(); + double dcaz = cascade.dcaZCascToPV(); + if (doApplyCuts && ((dcaxy > CutDCAtoPVxy) || (dcaz > CutDCAtoPVz))) + continue; // DCA check + + if (collision.index() != casccollid) { + histos.fill(HIST("All/EvMult"), mult); // count and list mult of events with at least one cascade + casccollid = collision.index(); + } + + double pt = cascade.pt(); + double phi = cascade.phi(); + double eta = cascade.eta(); + double massXi = cascade.mXi(); + double massOmega = cascade.mOmega(); + + histos.fill(HIST("All/DCAxy"), dcaxy); + histos.fill(HIST("All/DCAz"), dcaz); + histos.fill(HIST("All/Phi"), phi); + histos.fill(HIST("All/Eta"), eta); + histos.fill(HIST("All/MassXi"), massXi); + histos.fill(HIST("All/MassOmega"), massOmega); + histos.fill(HIST("All/Xi"), massXi, pt, mult); + histos.fill(HIST("All/Omega"), massOmega, pt, mult); + } + } + PROCESS_SWITCH(StrangeCascTrack, processTracked, "process tracked cascades", true); + PROCESS_SWITCH(StrangeCascTrack, processAll, "process all cascades", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc), + }; +} From 04a004069017c3389628212b1de1eb8624bb2be7 Mon Sep 17 00:00:00 2001 From: Junlee Kim Date: Fri, 10 Oct 2025 15:33:47 +0900 Subject: [PATCH 689/986] [PWGCF] adding shift correction (#13297) Co-authored-by: ALICE Action Bot --- PWGCF/JCorran/Tasks/jEPFlowAnalysis.cxx | 177 ++++++++++++++++++------ 1 file changed, 134 insertions(+), 43 deletions(-) diff --git a/PWGCF/JCorran/Tasks/jEPFlowAnalysis.cxx b/PWGCF/JCorran/Tasks/jEPFlowAnalysis.cxx index f3f43744f19..baf4cc90f9d 100644 --- a/PWGCF/JCorran/Tasks/jEPFlowAnalysis.cxx +++ b/PWGCF/JCorran/Tasks/jEPFlowAnalysis.cxx @@ -8,23 +8,29 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. + /// \author Maxim Virta (maxim.virta@cern.ch) +/// \brief flow measurement with q-vectors +/// \file jEPFlowAnalysis.cxx /// \since Jul 2024 -#include "Framework/AnalysisTask.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/HistogramRegistry.h" +#include "FlowJHistManager.h" -#include "Common/DataModel/EventSelection.h" +#include "Common/Core/EventPlaneHelper.h" #include "Common/Core/TrackSelection.h" -#include "Framework/runDataProcessing.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Qvectors.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/Qvectors.h" -#include "Common/Core/EventPlaneHelper.h" +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CcdbApi.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" -#include "FlowJHistManager.h" -#include "JEPFlowAnalysis.h" +#include +#include using namespace o2; using namespace o2::framework; @@ -32,40 +38,54 @@ using namespace o2::framework::expressions; using namespace std; using MyCollisions = soa::Join; - using MyTracks = aod::Tracks; struct jEPFlowAnalysis { - HistogramRegistry EPFlowHistograms{"EPFlow", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - JEPFlowAnalysis epAnalysis; + HistogramRegistry epFlowHistograms{"EPFlow", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; EventPlaneHelper helperEP; FlowJHistManager histManager; - Bool_t debug = kFALSE; + bool debug = kFALSE; + Service ccdb; + o2::ccdb::CcdbApi ccdbApi; // Set Configurables here struct : ConfigurableGroup { Configurable cfgPtMin{"cfgPtMin", 0.2f, "Minimum pT used for track selection."}; - Configurable cfgPtMax{"cfgPtMax", 5.0f, "Maximum pT used for track selection."}; Configurable cfgEtaMax{"cfgEtaMax", 1.f, "Maximum eta used for track selection."}; } cfgTrackCuts; Configurable cfgAddEvtSel{"cfgAddEvtSel", true, "Use event selection"}; Configurable cfgnTotalSystem{"cfgnTotalSystem", 7, "Total number of detectors in qVectorsTable"}; + Configurable cfgnMode{"cfgnMode", 1, "the number of modulations"}; + + Configurable cfgShiftCorr{"cfgShiftCorr", false, "additional shift correction"}; + Configurable cfgShiftPath{"cfgShiftPath", "Users/j/junlee/Qvector/QvecCalib/Shift", "Path for Shift"}; + Configurable cfgSPmethod{"cfgSPmethod", false, "flag for scalar product"}; Configurable cfgDetName{"cfgDetName", "FT0C", "The name of detector to be analyzed"}; Configurable cfgRefAName{"cfgRefAName", "TPCPos", "The name of detector for reference A"}; Configurable cfgRefBName{"cfgRefBName", "TPCNeg", "The name of detector for reference B"}; - Filter trackFilter = (aod::track::pt > cfgTrackCuts.cfgPtMin) && (aod::track::pt < cfgTrackCuts.cfgPtMax) && (nabs(aod::track::eta) < cfgTrackCuts.cfgEtaMax); + ConfigurableAxis cfgAxisCent{"cfgAxisCent", {100, 0, 100}, ""}; + ConfigurableAxis cfgAxisPt{"cfgAxisPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 10.0, 12.0, 15.0, 30.0, 50.0, 70.0, 100.0}, ""}; + ConfigurableAxis cfgAxisCos{"cfgAxisCos", {102, -1.02, 1.02}, ""}; + + Filter trackFilter = (aod::track::pt > cfgTrackCuts.cfgPtMin) && (nabs(aod::track::eta) < cfgTrackCuts.cfgEtaMax); - int DetId; - int RefAId; - int RefBId; + int detId; + int refAId; + int refBId; int harmInd; + int currentRunNumber = -999; + int lastRunNumber = -999; + + std::vector shiftprofile{}; + std::string fullCCDBShiftCorrPath; + template - int GetDetId(const T& name) + int getdetId(const T& name) { if (name.value == "FT0C") { return 0; @@ -88,37 +108,108 @@ struct jEPFlowAnalysis { void init(InitContext const&) { - DetId = GetDetId(cfgDetName); - RefAId = GetDetId(cfgRefAName); - RefBId = GetDetId(cfgRefBName); + detId = getdetId(cfgDetName); + refAId = getdetId(cfgRefAName); + refBId = getdetId(cfgRefBName); + + AxisSpec axisMod{cfgnMode, 2., cfgnMode + 2.}; + AxisSpec axisEvtPl{360, -constants::math::PI * 1.1, constants::math::PI * 1.1}; + + AxisSpec axisCent{cfgAxisCent, "cent"}; + AxisSpec axisPt{cfgAxisPt, "pT"}; + AxisSpec axisCos{cfgAxisCos, "cos"}; + + epFlowHistograms.add("EpDet", "", {HistType::kTH3F, {axisMod, axisCent, axisEvtPl}}); + epFlowHistograms.add("EpRefA", "", {HistType::kTH3F, {axisMod, axisCent, axisEvtPl}}); + epFlowHistograms.add("EpRefB", "", {HistType::kTH3F, {axisMod, axisCent, axisEvtPl}}); - epAnalysis.SetHistRegistry(&EPFlowHistograms); - epAnalysis.CreateHistograms(); + epFlowHistograms.add("EpResDetRefA", "", {HistType::kTH3F, {axisMod, axisCent, axisEvtPl}}); + epFlowHistograms.add("EpResDetRefB", "", {HistType::kTH3F, {axisMod, axisCent, axisEvtPl}}); + epFlowHistograms.add("EpResRefARefB", "", {HistType::kTH3F, {axisMod, axisCent, axisEvtPl}}); + + epFlowHistograms.add("vncos", "", {HistType::kTHnSparseF, {axisMod, axisCent, axisPt, axisCos}}); + epFlowHistograms.add("vnsin", "", {HistType::kTHnSparseF, {axisMod, axisCent, axisPt, axisCos}}); } - void process(MyCollisions::iterator const& coll, soa::Filtered const& tracks) + void process(MyCollisions::iterator const& coll, soa::Filtered const& tracks, aod::BCsWithTimestamps const&) { if (cfgAddEvtSel && (!coll.sel8() || !coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !coll.selection_bit(aod::evsel::kNoSameBunchPileup))) return; - Float_t cent = coll.cent(); - EPFlowHistograms.fill(HIST("FullCentrality"), cent); - Float_t EPs[3] = {0.}; - for (int i = 2; i < 5; i++) { // loop over different harmonic orders - harmInd = cfgnTotalSystem * 4 * (i - 2) + 3; // harmonic index to access corresponding Q-vector as all Q-vectors are in same vector - EPs[0] = helperEP.GetEventPlane(coll.qvecRe()[DetId + harmInd], coll.qvecIm()[DetId + harmInd], i); - EPs[1] = helperEP.GetEventPlane(coll.qvecRe()[RefAId + harmInd], coll.qvecIm()[RefAId + harmInd], i); - EPs[2] = helperEP.GetEventPlane(coll.qvecRe()[RefBId + harmInd], coll.qvecIm()[RefBId + harmInd], i); - - Float_t resNumA = helperEP.GetResolution(EPs[0], EPs[1], i); - Float_t resNumB = helperEP.GetResolution(EPs[0], EPs[2], i); - Float_t resDenom = helperEP.GetResolution(EPs[1], EPs[2], i); - epAnalysis.FillResolutionHistograms(cent, static_cast(i), resNumA, resNumB, resDenom); - for (uint j = 0; j < 3; j++) { // loop over detectors used - for (auto& track : tracks) { - Float_t vn = TMath::Cos((i) * (track.phi() - EPs[j])); - Float_t vn_sin = TMath::Sin((i) * (track.phi() - EPs[j])); - epAnalysis.FillVnHistograms(i, cent, static_cast(j + 1), track.pt(), vn, vn_sin); + float cent = coll.cent(); + epFlowHistograms.fill(HIST("FullCentrality"), cent); + float eps[3] = {0.}; + + if (cfgShiftCorr) { + auto bc = coll.bc_as(); + currentRunNumber = bc.runNumber(); + if (currentRunNumber != lastRunNumber) { + shiftprofile.clear(); + for (int i = 0; i < cfgnMode; i++) { + fullCCDBShiftCorrPath = cfgShiftPath; + fullCCDBShiftCorrPath += "/v"; + fullCCDBShiftCorrPath += std::to_string(i + 2); + auto objshift = ccdb->getForTimeStamp(fullCCDBShiftCorrPath, bc.timestamp()); + shiftprofile.push_back(objshift); + } + lastRunNumber = currentRunNumber; + } + } + + for (int i = 0; i < cfgnMode; i++) { // loop over different harmonic orders + harmInd = cfgnTotalSystem * 4 * (i) + 3; // harmonic index to access corresponding Q-vector as all Q-vectors are in same vector + eps[0] = helperEP.GetEventPlane(coll.qvecRe()[detId + harmInd], coll.qvecIm()[detId + harmInd], i + 2); + eps[1] = helperEP.GetEventPlane(coll.qvecRe()[refAId + harmInd], coll.qvecIm()[refAId + harmInd], i + 2); + eps[2] = helperEP.GetEventPlane(coll.qvecRe()[refBId + harmInd], coll.qvecIm()[refBId + harmInd], i + 2); + + auto deltapsiDet = 0.0; + auto deltapsiRefA = 0.0; + auto deltapsiRefB = 0.0; + + float weight = 1.0; + + if (cfgShiftCorr) { + constexpr int kShiftBins = 10; + for (int ishift = 1; ishift <= kShiftBins; ishift++) { + auto coeffshiftxDet = shiftprofile.at(i)->GetBinContent(shiftprofile.at(i)->FindBin(cent, 0.5, ishift - 0.5)); + auto coeffshiftyDet = shiftprofile.at(i)->GetBinContent(shiftprofile.at(i)->FindBin(cent, 1.5, ishift - 0.5)); + auto coeffshiftxRefA = shiftprofile.at(i)->GetBinContent(shiftprofile.at(i)->FindBin(cent, 2.5, ishift - 0.5)); + auto coeffshiftyRefA = shiftprofile.at(i)->GetBinContent(shiftprofile.at(i)->FindBin(cent, 3.5, ishift - 0.5)); + auto coeffshiftxRefB = shiftprofile.at(i)->GetBinContent(shiftprofile.at(i)->FindBin(cent, 4.5, ishift - 0.5)); + auto coeffshiftyRefB = shiftprofile.at(i)->GetBinContent(shiftprofile.at(i)->FindBin(cent, 5.5, ishift - 0.5)); // currently only FT0C/TPCpos/TPCneg + + deltapsiDet += ((1 / (1.0 * ishift)) * (-coeffshiftxDet * std::cos(ishift * static_cast(i + 2) * eps[0]) + coeffshiftyDet * std::sin(ishift * static_cast(i + 2) * eps[0]))); + deltapsiRefA += ((1 / (1.0 * ishift)) * (-coeffshiftxRefA * std::cos(ishift * static_cast(i + 2) * eps[1]) + coeffshiftyRefA * std::sin(ishift * static_cast(i + 2) * eps[1]))); + deltapsiRefB += ((1 / (1.0 * ishift)) * (-coeffshiftxRefB * std::cos(ishift * static_cast(i + 2) * eps[2]) + coeffshiftyRefB * std::sin(ishift * static_cast(i + 2) * eps[2]))); + } + + eps[0] += deltapsiDet; + eps[1] += deltapsiRefA; + eps[2] += deltapsiRefB; + } + + if (cfgSPmethod) + weight *= std::sqrt(std::pow(coll.qvecRe()[detId + harmInd], 2) + std::pow(coll.qvecIm()[detId + harmInd], 2)); + + float resNumA = helperEP.GetResolution(eps[0], eps[1], i + 2); + float resNumB = helperEP.GetResolution(eps[0], eps[2], i + 2); + float resDenom = helperEP.GetResolution(eps[1], eps[2], i + 2); + + epFlowHistograms.fill(HIST("EpDet"), i + 2, cent, eps[0]); + epFlowHistograms.fill(HIST("EpRefA"), i + 2, cent, eps[1]); + epFlowHistograms.fill(HIST("EpRefB"), i + 2, cent, eps[2]); + + epFlowHistograms.fill(HIST("EpResDetRefA"), i + 2, cent, resNumA); + epFlowHistograms.fill(HIST("EpResDetRefB"), i + 2, cent, resNumB); + epFlowHistograms.fill(HIST("EpResRefARefB"), i + 2, cent, resDenom); + + for (int j = 0; j < cfgnMode; j++) { // loop over detectors used + for (const auto& track : tracks) { + float vn = std::cos((i + 2) * (track.phi() - eps[j])); + float vnSin = std::sin((i + 2) * (track.phi() - eps[j])); + + epFlowHistograms.fill(HIST("vncos"), i + 2, cent, track.pt(), vn * weight); + epFlowHistograms.fill(HIST("vnsin"), i + 2, cent, track.pt(), vnSin * weight); } } } From dd4ebbb0ed07a2495f2d2627226d8796541297eb Mon Sep 17 00:00:00 2001 From: gitchrishub-oss Date: Fri, 10 Oct 2025 09:22:49 +0200 Subject: [PATCH 690/986] [PWGCF] Further histograms for inv mass selection (#13280) Co-authored-by: Christopher Klumm --- .../FemtoDream/Core/femtoDreamResoSelection.h | 178 +++++------ .../femtoDreamProducerTaskReso.cxx | 302 +++++++++++++----- 2 files changed, 316 insertions(+), 164 deletions(-) diff --git a/PWGCF/FemtoDream/Core/femtoDreamResoSelection.h b/PWGCF/FemtoDream/Core/femtoDreamResoSelection.h index 7ec3bbb9505..b9bff7ac239 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamResoSelection.h +++ b/PWGCF/FemtoDream/Core/femtoDreamResoSelection.h @@ -50,11 +50,6 @@ enum Daughtertype { kPosdaugh, kNegdaugh }; - -enum ResoMothers { - kPhi, - kKStar -}; } // namespace femto_dream_reso_selection class FemtoDreamResoSelection @@ -70,7 +65,7 @@ class FemtoDreamResoSelection virtual ~FemtoDreamResoSelection() = default; template - uint32_t getType(V const& track1, V const& track2); + uint32_t getType(V const& track1, V const& track2, bool resoIsNotAnti); /// assigns value from configurbale to private class member template @@ -104,21 +99,19 @@ class FemtoDreamResoSelection bool daughterSelectionNeg(V const& track2); template - bool isSelectedMinimalPIDPos(V const& track1, T const& pids); + bool isSelectedMinimalPIDPos(V const& track1, T const& pidVector); template - bool isSelectedMinimalPIDNeg(V const& track2, T const& pids); + bool isSelectedMinimalPIDNeg(V const& track2, T const& pidVector); template std::array getCutContainer(V const& track1, V const& track2, float sign); - template - std::pair checkCombination(T const& PosTrack, T const& NegTrack, femto_dream_reso_selection::ResoMothers mother); - - std::pair getPIDPairFromMother(femto_dream_reso_selection::ResoMothers mother); + template + std::pair checkCombination(T const& PosTrack, T const& NegTrack, V const& pidVector, float massDiff, float massDiffAnti, bool useMassDiff); - template - bool checkPID(T const& Track, float nSigTPC, float nSigTOF, float nSig2TPC, float nSig2TOF, float PTPCThrvalue); + template + float getNSigTotal(T const& track, V const& pid, float const& threshold); void updateThreshold() { @@ -149,8 +142,6 @@ class FemtoDreamResoSelection } } - std::pair getMassDaughters(femto_dream_reso_selection::ResoMothers mother); - /// The following functions might not be needed, as right now there is only one ResoSel (sign). /// However all the other selections are implemented this way (also in the CutCulator). /// So for now this is implemented analogous (migth also be beneficial if further ResoSels want to be implemented). @@ -227,18 +218,28 @@ class FemtoDreamResoSelection }; // namespace femtoDream template -uint32_t FemtoDreamResoSelection::getType(V const& track1, V const& track2) +uint32_t FemtoDreamResoSelection::getType(V const& track1, V const& track2, bool resoIsNotAnti) { - if (track1.pt() <= mDaughPTPCThr[0] && track2.pt() <= mDaughPTPCThr[1]) { + float posThresh = 0.; + float negThresh = 0.; + if (resoIsNotAnti) { + posThresh = mDaughPTPCThr[0]; + negThresh = mDaughPTPCThr[1]; + } else { + posThresh = mDaughPTPCThr[1]; + negThresh = mDaughPTPCThr[0]; + } + + if (track1.pt() <= posThresh && track2.pt() <= negThresh) { return aod::femtodreamparticle::kResoPosdaughTPC_NegdaughTPC; } - if (track1.pt() <= mDaughPTPCThr[0] && track2.pt() > mDaughPTPCThr[1]) { + if (track1.pt() <= posThresh && track2.pt() > negThresh) { return aod::femtodreamparticle::kResoPosdaughTPC_NegdaughTOF; } - if (track1.pt() > mDaughPTPCThr[0] && track2.pt() <= mDaughPTPCThr[1]) { + if (track1.pt() > posThresh && track2.pt() <= negThresh) { return aod::femtodreamparticle::kResoPosdaughTOF_NegdaughTPC; } - if (track1.pt() > mDaughPTPCThr[0] && track2.pt() > mDaughPTPCThr[1]) { + if (track1.pt() > posThresh && track2.pt() > negThresh) { return aod::femtodreamparticle::kResoPosdaughTOF_NegdaughTOF; } return 255; // as error filler @@ -321,101 +322,94 @@ bool FemtoDreamResoSelection::daughterSelectionNeg(V const& track2) } template -bool FemtoDreamResoSelection::isSelectedMinimalPIDPos(V const& track1, T const& pid) +bool FemtoDreamResoSelection::isSelectedMinimalPIDPos(V const& track1, T const& pidVector) { - float pidTPC = posDaughTrack.getNsigmaTPC(track1, pid); // pids[0] for pos track - float pidTOF = posDaughTrack.getNsigmaTOF(track1, pid); - - bool pass = false; - if (track1.pt() < mDaughPTPCThr[0]) { - pass = std::fabs(pidTPC) < mSigmaPIDMax; - } else { - pass = std::sqrt(pidTPC * pidTPC + pidTOF * pidTOF) < mSigmaPIDMax; + int pidVecSize = pidVector.size(); + for (int i = 0; i < pidVecSize; i++) { + const float pidTPC = posDaughTrack.getNsigmaTPC(track1, pidVector[i]); + const float pidTOF = posDaughTrack.getNsigmaTOF(track1, pidVector[i]); + + if (track1.pt() < mDaughPTPCThr[i]) { + if (std::fabs(pidTPC) < mSigmaPIDMax) { + return true; + } + } else if ((std::sqrt(pidTPC * pidTPC + pidTOF * pidTOF) < mSigmaPIDMax)) { + return true; + } } - - return pass; + return false; } template -bool FemtoDreamResoSelection::isSelectedMinimalPIDNeg(V const& track2, T const& pid) +bool FemtoDreamResoSelection::isSelectedMinimalPIDNeg(V const& track2, T const& pidVector) { - float pidTPC = negDaughTrack.getNsigmaTPC(track2, pid); // pids[1] for neg track - float pidTOF = negDaughTrack.getNsigmaTOF(track2, pid); - - bool pass = false; - if (track2.pt() < mDaughPTPCThr[1]) { - pass = std::fabs(pidTPC) < mSigmaPIDMax; - } else { - pass = std::sqrt(pidTPC * pidTPC + pidTOF * pidTOF) < mSigmaPIDMax; + int pidVecSize = pidVector.size(); + for (int i = 0; i < pidVecSize; i++) { + const float pidTPC = negDaughTrack.getNsigmaTPC(track2, pidVector[i]); + const float pidTOF = negDaughTrack.getNsigmaTOF(track2, pidVector[i]); + + if (track2.pt() < mDaughPTPCThr[i]) { + if (std::fabs(pidTPC) < mSigmaPIDMax) { + return true; + } + } else if ((std::sqrt(pidTPC * pidTPC + pidTOF * pidTOF) < mSigmaPIDMax)) { + return true; + } } - - return pass; + return false; } -template -std::pair FemtoDreamResoSelection::checkCombination(T const& PosTrack, T const& NegTrack, femto_dream_reso_selection::ResoMothers mother) +template +std::pair FemtoDreamResoSelection::checkCombination(T const& PosTrack, T const& NegTrack, V const& pidVector, float massDiff, float massDiffAnti, bool useMassDiff) { - /// first bool: normal or anti + /// first bool: true (normal resonance) / false (anti resonance) /// second bool: is not a valid combination - auto [part1, part2] = getPIDPairFromMother(mother); + const auto part1 = pidVector[0]; /// particle type 1 + const auto part2 = pidVector[1]; /// particle type 2 + + float nSigPosPart1Total = getNSigTotal(PosTrack, part1, mDaughPTPCThr[0]); /// Total propability that PosTrack is of particle type 1 + float nSigPosPart2Total = getNSigTotal(PosTrack, part2, mDaughPTPCThr[1]); /// Total propability that PosTrack is of particle type 2 + float nSigNegPart1Total = getNSigTotal(NegTrack, part1, mDaughPTPCThr[0]); + float nSigNegPart2Total = getNSigTotal(NegTrack, part2, mDaughPTPCThr[1]); + + // check if PosTrack is more likely to be part1 than part2 (and vice versa for NegTrack) -> normal resonance + bool couldBeNormal = nSigPosPart1Total < nSigPosPart2Total && nSigNegPart2Total < nSigNegPart1Total; + // check if PosTrack is more likely to be part2 than part1 (and vice versa for NegTrack) -> anti resonance + bool couldBeAnti = nSigPosPart2Total < nSigPosPart1Total && nSigNegPart1Total < nSigNegPart2Total; - float nSigPosTPC1 = o2::aod::pidutils::tpcNSigma(part1, PosTrack) - mPIDoffsetTPC; - float nSigPosTOF1 = posDaughTrack.getNsigmaTOF(PosTrack, part1) - mPIDoffsetTOF; /// for TOF use function in TrackSelection, because it also checks hasTOF() - float nSigPosTPC2 = o2::aod::pidutils::tpcNSigma(part2, PosTrack) - mPIDoffsetTPC; - float nSigPosTOF2 = posDaughTrack.getNsigmaTOF(PosTrack, part2) - mPIDoffsetTOF; - float nSigNegTPC1 = o2::aod::pidutils::tpcNSigma(part1, NegTrack) - mPIDoffsetTPC; - float nSigNegTOF1 = negDaughTrack.getNsigmaTOF(NegTrack, part1) - mPIDoffsetTOF; - float nSigNegTPC2 = o2::aod::pidutils::tpcNSigma(part2, NegTrack) - mPIDoffsetTPC; - float nSigNegTOF2 = negDaughTrack.getNsigmaTOF(NegTrack, part2) - mPIDoffsetTOF; + if (useMassDiff) { + couldBeNormal = couldBeNormal && massDiff < massDiffAnti; + couldBeAnti = couldBeAnti && massDiffAnti < massDiff; + } - if (checkPID(PosTrack, nSigPosTPC1, nSigPosTOF1, nSigPosTPC2, nSigPosTOF2, mDaughPTPCThr[0]) && checkPID(NegTrack, nSigNegTPC2, nSigNegTOF2, nSigNegTPC1, nSigNegTOF1, mDaughPTPCThr[1])) { + if (couldBeNormal && !couldBeAnti) { return {true, false}; - } else if (checkPID(PosTrack, nSigPosTPC2, nSigPosTOF2, nSigPosTPC1, nSigPosTOF1, mDaughPTPCThr[0]) && checkPID(NegTrack, nSigNegTPC1, nSigNegTOF1, nSigNegTPC2, nSigNegTOF2, mDaughPTPCThr[1])) { + } + if (!couldBeNormal && couldBeAnti) { return {false, false}; - } else { - return {false, true}; } + // if ambiguous (both true) or invalid (both false) + return {false, true}; } -template -bool FemtoDreamResoSelection::checkPID(T const& Track, float nSig1TPC, float nSig1TOF, float nSig2TPC, float nSig2TOF, float PTPCThrvalue) +template +float FemtoDreamResoSelection::getNSigTotal(T const& track, V const& pid, float const& threshold) { - if (Track.pt() < PTPCThrvalue) { - return (std::abs(nSig1TPC) <= std::abs(nSig2TPC)); - } else { - return (std::sqrt(nSig1TPC * nSig1TPC + nSig1TOF * nSig1TOF) <= std::sqrt(nSig2TPC * nSig2TPC + nSig2TOF * nSig2TOF)); - } -} + float nSigTPC = o2::aod::pidutils::tpcNSigma(pid, track); + float pTtrack = track.pt(); -std::pair FemtoDreamResoSelection::getPIDPairFromMother(femto_dream_reso_selection::ResoMothers mother) -{ - /// return is structured this way: - /// The mother particle is assumed to be normal (not antiparticle). Then: - /// 1. return value is positive daughter - /// 2. return value is negative daughter - switch (mother) { - case (femto_dream_reso_selection::kPhi): - return {o2::track::PID::Kaon, o2::track::PID::Kaon}; - case (femto_dream_reso_selection::kKStar): - return {o2::track::PID::Kaon, o2::track::PID::Pion}; - default: - LOG(warn) << "MotherPID not implemented in femto_dream_reso_selection.getPIDPairFromMother"; - return {o2::track::PID::Kaon, o2::track::PID::Kaon}; + if (pTtrack < threshold) { + return std::abs(nSigTPC); } -} -std::pair FemtoDreamResoSelection::getMassDaughters(femto_dream_reso_selection::ResoMothers mother) -{ - switch (mother) { - case (femto_dream_reso_selection::kPhi): - return {o2::constants::physics::MassKPlus, o2::constants::physics::MassKPlus}; - case (femto_dream_reso_selection::kKStar): - return {o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}; - default: - LOG(warn) << "MotherPID not implemented in femto_dream_reso_selection.getMassDauhters"; - return {o2::constants::physics::MassKPlus, o2::constants::physics::MassKPlus}; + float nSigTOF = 0.; + if (!track.hasTOF()) { + nSigTOF = 999.f; + } else { + nSigTOF = o2::aod::pidutils::tofNSigma(pid, track); } + return std::sqrt(nSigTPC * nSigTPC + nSigTOF * nSigTOF); } //// new getCutContainer diff --git a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTaskReso.cxx b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTaskReso.cxx index fa2680acbf2..ecdbaeaee5f 100644 --- a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTaskReso.cxx +++ b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTaskReso.cxx @@ -185,7 +185,7 @@ struct FemtoDreamProducerTaskReso { Configurable confV0InvKaonMassUpLimit{"confV0InvKaonMassUpLimit", 0.515, "Upper limit of the V0 invariant mass for Kaon rejection"}; Configurable confV0MotherIsLambda{"confV0MotherIsLambda", true, "True: Lambda, False: K0Short"}; - Configurable> confChildCharge{"confChildCharge", std::vector{-1, 1}, "V0 Child sel: Charge"}; + Configurable> confChildSign{"confChildSign", std::vector{-1, 1}, "V0 Child sel: Charge"}; Configurable> confChildEtaMax{"confChildEtaMax", std::vector{0.8f}, "V0 Child sel: max eta"}; Configurable> confChildTPCnClsMin{"confChildTPCnClsMin", std::vector{80.f, 70.f, 60.f}, "V0 Child sel: Min. nCls TPC"}; Configurable> confChildDCAMin{"confChildDCAMin", std::vector{0.05f, 0.06f}, "V0 Child sel: Max. DCA Daugh to PV (cm)"}; @@ -197,10 +197,14 @@ struct FemtoDreamProducerTaskReso { struct : ConfigurableGroup { std::string prefix = std::string("Resonance"); + Configurable confResoInvMass{"confResoInvMass", o2::constants::physics::MassPhi, "Literature value of the Reso invariant mass"}; Configurable confResoInvMassLowLimit{"confResoInvMassLowLimit", 0.9, "Lower limit of the Reso invariant mass"}; // 1.011461 Configurable confResoInvMassUpLimit{"confResoInvMassUpLimit", 1.15, "Upper limit of the Reso invariant mass"}; // 1.027461 + Configurable confUseMassDiff{"confUseMassDiff", false, "(De)activates the usage of invMassDiff when checking combinations"}; + Configurable confDoLikeSign{"confDoLikeSign", false, "(De)activates likeSign histo filling"}; + Configurable confUseMassDiffLikeSign{"confUseMassDiffLikeSign", false, "(De)activates the usage of invMassDiff when checking combinations in LikeSign"}; + Configurable confMassQAPart2PID{"confMassQAPart2PID", o2::track::PID::Pion, "Daughter PID for massQAPart2 histograms"}; Configurable> confResoSign{"confResoSign", std::vector{-1., 1.}, "Reso Sign selection"}; - Configurable confResoMotherID{"confResoMotherID", static_cast(femto_dream_reso_selection::kPhi), "ResoID of Mother [0: Phi, 1: KStar]"}; Configurable> confDaughterCharge{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kSign, "confDaughter"), std::vector{-1, 1}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kSign, "Reso selection: ")}; Configurable> confDaughterPtMin{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kpTMin, "confDaughter"), std::vector{0.1, 0.15, 0.2}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kpTMin, "Reso selection: ")}; @@ -254,10 +258,10 @@ struct FemtoDreamProducerTaskReso { void init(InitContext&) { - if (doprocessData == false && doprocessData_noCentrality == false && doprocessData_CentPbPb == false && doprocessMC == false && doprocessMC_noCentrality == false && doprocessMC_CentPbPb == false) { + if (doprocessData == false && doprocessData_noCentrality == false && doprocessDataCentPbPb == false && doprocessMC == false && doprocessMCnoCentrality == false && doprocessMCCentPbPb == false) { LOGF(fatal, "Neither processData nor processMC enabled. Please choose one."); } - if ((doprocessData == true && doprocessMC == true) || (doprocessData == true && doprocessMC_noCentrality == true) || (doprocessMC == true && doprocessMC_noCentrality == true) || (doprocessData_noCentrality == true && doprocessData == true) || (doprocessData_noCentrality == true && doprocessMC == true) || (doprocessData_noCentrality == true && doprocessMC_noCentrality == true) || (doprocessData_CentPbPb == true && doprocessData == true) || (doprocessData_CentPbPb == true && doprocessData_noCentrality == true) || (doprocessData_CentPbPb == true && doprocessMC == true) || (doprocessData_CentPbPb == true && doprocessMC_noCentrality == true) || (doprocessData_CentPbPb == true && doprocessMC_CentPbPb == true)) { + if ((doprocessData == true && doprocessMC == true) || (doprocessData == true && doprocessMCnoCentrality == true) || (doprocessMC == true && doprocessMCnoCentrality == true) || (doprocessData_noCentrality == true && doprocessData == true) || (doprocessData_noCentrality == true && doprocessMC == true) || (doprocessData_noCentrality == true && doprocessMCnoCentrality == true) || (doprocessDataCentPbPb == true && doprocessData == true) || (doprocessDataCentPbPb == true && doprocessData_noCentrality == true) || (doprocessDataCentPbPb == true && doprocessMC == true) || (doprocessDataCentPbPb == true && doprocessMCnoCentrality == true) || (doprocessDataCentPbPb == true && doprocessMCCentPbPb == true)) { LOGF(fatal, "Cannot enable more than one process switch at the same time. " "Please choose one."); @@ -278,16 +282,56 @@ struct FemtoDreamProducerTaskReso { resoRegistry.add("AnalysisQA/Reso/InvMass_phi_selected", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.65, 1.5}}); resoRegistry.add("AnalysisQA/Reso/InvMassAnti_phi_selected", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.65, 1.5}}); - resoRegistry.add("AnalysisQA/Reso/Daughter1/Pt", "Transverse momentum of all tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - resoRegistry.add("AnalysisQA/Reso/Daughter1/Eta", "Pseudorapidity of all tracks;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); - resoRegistry.add("AnalysisQA/Reso/Daughter1/Phi", "Azimuthal angle of all tracks;#phi;Entries", HistType::kTH1F, {{720, 0, o2::constants::math::TwoPI}}); - resoRegistry.add("AnalysisQA/Reso/Daughter1/DcaXY", "dcaXY of all tracks;d_{XY} (cm);Entries", HistType::kTH1F, {{1000, 0, 1}}); // check if cm is correct here - resoRegistry.add("AnalysisQA/Reso/Daughter1/DcaZ", "dcaZ of all tracks;d_{Z} (cm);Entries", HistType::kTH1F, {{1000, 0, 1}}); // check if cm is correct here - resoRegistry.add("AnalysisQA/Reso/Daughter2/Pt", "Transverse momentum of all tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - resoRegistry.add("AnalysisQA/Reso/Daughter2/Eta", "Pseudorapidity of all tracks;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); - resoRegistry.add("AnalysisQA/Reso/Daughter2/Phi", "Azimuthal angle of all tracks;#phi;Entries", HistType::kTH1F, {{720, 0, o2::constants::math::TwoPI}}); - resoRegistry.add("AnalysisQA/Reso/Daughter2/DcaXY", "dcaXY of all tracks;d_{XY} (cm);Entries", HistType::kTH1F, {{1000, 0, 1}}); // check if cm is correct here - resoRegistry.add("AnalysisQA/Reso/Daughter2/DcaZ", "dcaZ of all tracks;d_{Z} (cm);Entries", HistType::kTH1F, {{1000, 0, 1}}); // check if cm is correct here + // Daughter-histos for normal resonance + // Histos for PosDaughter + resoRegistry.add("AnalysisQA/Reso/ResoQA/PosDaughter/Pt", "Transverse momentum of all tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); + resoRegistry.add("AnalysisQA/Reso/ResoQA/PosDaughter/Eta", "Pseudorapidity of all tracks;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); + resoRegistry.add("AnalysisQA/Reso/ResoQA/PosDaughter/Phi", "Azimuthal angle of all tracks;#phi;Entries", HistType::kTH1F, {{720, 0, o2::constants::math::TwoPI}}); + resoRegistry.add("AnalysisQA/Reso/ResoQA/PosDaughter/DcaXY", "dcaXY of all tracks;d_{XY} (cm);Entries", HistType::kTH1F, {{1000, 0, 1}}); // check if cm is correct here + resoRegistry.add("AnalysisQA/Reso/ResoQA/PosDaughter/DcaZ", "dcaZ of all tracks;d_{Z} (cm);Entries", HistType::kTH1F, {{1000, 0, 1}}); // check if cm is correct here + // Histos for NegDaughter + resoRegistry.add("AnalysisQA/Reso/ResoQA/NegDaughter/Pt", "Transverse momentum of all tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); + resoRegistry.add("AnalysisQA/Reso/ResoQA/NegDaughter/Eta", "Pseudorapidity of all tracks;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); + resoRegistry.add("AnalysisQA/Reso/ResoQA/NegDaughter/Phi", "Azimuthal angle of all tracks;#phi;Entries", HistType::kTH1F, {{720, 0, o2::constants::math::TwoPI}}); + resoRegistry.add("AnalysisQA/Reso/ResoQA/NegDaughter/DcaXY", "dcaXY of all tracks;d_{XY} (cm);Entries", HistType::kTH1F, {{1000, 0, 1}}); // check if cm is correct here + resoRegistry.add("AnalysisQA/Reso/ResoQA/NegDaughter/DcaZ", "dcaZ of all tracks;d_{Z} (cm);Entries", HistType::kTH1F, {{1000, 0, 1}}); // check if cm is correct here + + // Daughter-histos for anti resonance + // Histos for PosDaughter + resoRegistry.add("AnalysisQA/Reso/AntiResoQA/PosDaughter/Pt", "Transverse momentum of all tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); + resoRegistry.add("AnalysisQA/Reso/AntiResoQA/PosDaughter/Eta", "Pseudorapidity of all tracks;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); + resoRegistry.add("AnalysisQA/Reso/AntiResoQA/PosDaughter/Phi", "Azimuthal angle of all tracks;#phi;Entries", HistType::kTH1F, {{720, 0, o2::constants::math::TwoPI}}); + resoRegistry.add("AnalysisQA/Reso/AntiResoQA/PosDaughter/DcaXY", "dcaXY of all tracks;d_{XY} (cm);Entries", HistType::kTH1F, {{1000, 0, 1}}); // check if cm is correct here + resoRegistry.add("AnalysisQA/Reso/AntiResoQA/PosDaughter/DcaZ", "dcaZ of all tracks;d_{Z} (cm);Entries", HistType::kTH1F, {{1000, 0, 1}}); // check if cm is correct here + // Histos for NegDaughter + resoRegistry.add("AnalysisQA/Reso/AntiResoQA/NegDaughter/Pt", "Transverse momentum of all tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); + resoRegistry.add("AnalysisQA/Reso/AntiResoQA/NegDaughter/Eta", "Pseudorapidity of all tracks;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); + resoRegistry.add("AnalysisQA/Reso/AntiResoQA/NegDaughter/Phi", "Azimuthal angle of all tracks;#phi;Entries", HistType::kTH1F, {{720, 0, o2::constants::math::TwoPI}}); + resoRegistry.add("AnalysisQA/Reso/AntiResoQA/NegDaughter/DcaXY", "dcaXY of all tracks;d_{XY} (cm);Entries", HistType::kTH1F, {{1000, 0, 1}}); // check if cm is correct here + resoRegistry.add("AnalysisQA/Reso/AntiResoQA/NegDaughter/DcaZ", "dcaZ of all tracks;d_{Z} (cm);Entries", HistType::kTH1F, {{1000, 0, 1}}); // check if cm is correct here + + // SelectionQA + resoRegistry.add("AnalysisQA/Reso/ResoQA/InvMassSwitched", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.65, 1.5}}); // for opposite mass hypothesis (Reso is anti) + resoRegistry.add("AnalysisQA/Reso/ResoQA/InvMassBothPID1", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.65, 1.5}}); // both particles are of type confDaughterPIDspecies[0] + resoRegistry.add("AnalysisQA/Reso/ResoQA/InvMassBothPID2", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.65, 1.5}}); // both particles are of type confDaughterPIDspecies[1] + + // AntiSelectionQA + resoRegistry.add("AnalysisQA/Reso/AntiResoQA/InvMassSwitched", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.65, 1.5}}); // for opposite mass hypothesis (Reso is normal) + resoRegistry.add("AnalysisQA/Reso/AntiResoQA/InvMassBothPID1", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.65, 1.5}}); // both particles are of type confDaughterPIDspecies[0] + resoRegistry.add("AnalysisQA/Reso/AntiResoQA/InvMassBothPID2", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.65, 1.5}}); // both particles are of type confDaughterPIDspecies[1] + + // likeSign + if (Resonance.confDoLikeSign.value) { + resoRegistry.add("AnalysisQA/ResoLikeSign/ResoQA/InvMass", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.65, 1.5}}); + resoRegistry.add("AnalysisQA/ResoLikeSign/ResoQA/InvMassSwitched", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.65, 1.5}}); // for opposite mass hypothesis (Reso is anti) + resoRegistry.add("AnalysisQA/ResoLikeSign/ResoQA/InvMassBothPID1", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.65, 1.5}}); // both particles are of type confDaughterPIDspecies[0] + resoRegistry.add("AnalysisQA/ResoLikeSign/ResoQA/InvMassBothPID2", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.65, 1.5}}); // both particles are of type confDaughterPIDspecies[1] + + resoRegistry.add("AnalysisQA/ResoLikeSign/AntiResoQA/InvMass", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.65, 1.5}}); + resoRegistry.add("AnalysisQA/ResoLikeSign/AntiResoQA/InvMassSwitched", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.65, 1.5}}); // for opposite mass hypothesis (Reso is anti) + resoRegistry.add("AnalysisQA/ResoLikeSign/AntiResoQA/InvMassBothPID1", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.65, 1.5}}); // both particles are of type confDaughterPIDspecies[0] + resoRegistry.add("AnalysisQA/ResoLikeSign/AntiResoQA/InvMassBothPID2", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.65, 1.5}}); // both particles are of type confDaughterPIDspecies[1] + } resoRegistry.add("AnalysisQA/Reso/Pt_posdaughter_selected", "Transverse momentum of all processed tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); resoRegistry.add("AnalysisQA/Reso/Eta_posdaughter_selected", "Pseudorapidity of all processed tracks;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); @@ -345,13 +389,13 @@ struct FemtoDreamProducerTaskReso { v0Cuts.setSelection(confV0TranRadMin, femto_dream_v0_selection::kV0TranRadMin, femtoDreamSelection::kLowerLimit); v0Cuts.setSelection(confV0TranRadMax, femto_dream_v0_selection::kV0TranRadMax, femtoDreamSelection::kUpperLimit); v0Cuts.setSelection(confV0DecVtxMax, femto_dream_v0_selection::kV0DecVtxMax, femtoDreamSelection::kUpperLimit); - v0Cuts.setChildCuts(femto_dream_v0_selection::kPosTrack, confChildCharge, femtoDreamTrackSelection::kSign, femtoDreamSelection::kEqual); + v0Cuts.setChildCuts(femto_dream_v0_selection::kPosTrack, confChildSign, femtoDreamTrackSelection::kSign, femtoDreamSelection::kEqual); v0Cuts.setChildCuts(femto_dream_v0_selection::kPosTrack, confChildEtaMax, femtoDreamTrackSelection::kEtaMax, femtoDreamSelection::kAbsUpperLimit); v0Cuts.setChildCuts(femto_dream_v0_selection::kPosTrack, confChildTPCnClsMin, femtoDreamTrackSelection::kTPCnClsMin, femtoDreamSelection::kLowerLimit); v0Cuts.setChildCuts(femto_dream_v0_selection::kPosTrack, confChildDCAMin, femtoDreamTrackSelection::kDCAMin, femtoDreamSelection::kAbsLowerLimit); v0Cuts.setChildCuts(femto_dream_v0_selection::kPosTrack, confChildPIDnSigmaMax, femtoDreamTrackSelection::kPIDnSigmaMax, femtoDreamSelection::kAbsUpperLimit); - v0Cuts.setChildCuts(femto_dream_v0_selection::kNegTrack, confChildCharge, femtoDreamTrackSelection::kSign, femtoDreamSelection::kEqual); + v0Cuts.setChildCuts(femto_dream_v0_selection::kNegTrack, confChildSign, femtoDreamTrackSelection::kSign, femtoDreamSelection::kEqual); v0Cuts.setChildCuts(femto_dream_v0_selection::kNegTrack, confChildEtaMax, femtoDreamTrackSelection::kEtaMax, femtoDreamSelection::kAbsUpperLimit); v0Cuts.setChildCuts(femto_dream_v0_selection::kNegTrack, confChildTPCnClsMin, femtoDreamTrackSelection::kTPCnClsMin, femtoDreamSelection::kLowerLimit); v0Cuts.setChildCuts(femto_dream_v0_selection::kNegTrack, confChildDCAMin, femtoDreamTrackSelection::kDCAMin, femtoDreamSelection::kAbsLowerLimit); @@ -636,6 +680,74 @@ struct FemtoDreamProducerTaskReso { outputCollsMCLabels(-1); } } + + template + void fillLikeSign(P const& sliceDaughters) + { + for (const auto& track1 : sliceDaughters) { + if (!resoCuts.daughterSelectionPos(track1) || !resoCuts.isSelectedMinimalPIDPos(track1, Resonance.confDaughterPIDspecies.value)) { + continue; + } + for (const auto& track2 : sliceDaughters) { + if (!resoCuts.daughterSelectionPos(track2) || !resoCuts.isSelectedMinimalPIDPos(track2, Resonance.confDaughterPIDspecies.value)) { + continue; + } + + /// This only works for the case where the mass of opposite charged particles are the same (for example K+/K- have same mass) + float massPart1 = o2::track::PID::getMass(Resonance.confDaughterPIDspecies.value[0]); + float massPart2 = o2::track::PID::getMass(Resonance.confDaughterPIDspecies.value[1]); + + /// Resonance + ROOT::Math::PtEtaPhiMVector tempD1(track1.pt(), track1.eta(), track1.phi(), massPart1); + ROOT::Math::PtEtaPhiMVector tempD2(track2.pt(), track2.eta(), track2.phi(), massPart2); + ROOT::Math::PtEtaPhiMVector tempReso = tempD1 + tempD2; + /// Anti-resonance + ROOT::Math::PtEtaPhiMVector tempDA1(track1.pt(), track1.eta(), track1.phi(), massPart2); + ROOT::Math::PtEtaPhiMVector tempDA2(track2.pt(), track2.eta(), track2.phi(), massPart1); + ROOT::Math::PtEtaPhiMVector tempAntiReso = tempDA1 + tempDA2; + + /// For InvMassQA + ROOT::Math::PtEtaPhiMVector tempDaughter1MassQA1(track1.pt(), track1.eta(), track1.phi(), massPart1); + ROOT::Math::PtEtaPhiMVector tempDaughter2MassQA1(track2.pt(), track2.eta(), track2.phi(), massPart1); + ROOT::Math::PtEtaPhiMVector tempMassQA1 = tempDaughter1MassQA1 + tempDaughter2MassQA1; + + float massQAPart2 = massPart2; + if (Resonance.confDaughterPIDspecies.value[0] == Resonance.confDaughterPIDspecies.value[1]) { + massQAPart2 = o2::track::PID::getMass(Resonance.confMassQAPart2PID.value); + } + + ROOT::Math::PtEtaPhiMVector tempDaughter1MassQA2(track1.pt(), track1.eta(), track1.phi(), massQAPart2); + ROOT::Math::PtEtaPhiMVector tempDaughter2MassQA2(track2.pt(), track2.eta(), track2.phi(), massQAPart2); + ROOT::Math::PtEtaPhiMVector tempMassQA2 = tempDaughter1MassQA2 + tempDaughter2MassQA2; + + float massDiff = std::abs(Resonance.confResoInvMass.value - tempReso.M()); + float massDiffAnti = std::abs(Resonance.confResoInvMass.value - tempAntiReso.M()); + + bool resoIsNotAnti = true; /// bool for differentianting between particle/antiparticle + if ((Resonance.confDaughterPIDspecies->size() > 1) && (Resonance.confDaughterPIDspecies.value[0] != Resonance.confDaughterPIDspecies.value[1])) { + auto [isNormal, WrongCombination] = resoCuts.checkCombination(track1, track2, Resonance.confDaughterPIDspecies.value, massDiff, massDiffAnti, Resonance.confUseMassDiffLikeSign.value); + if (WrongCombination) { + continue; + } + resoIsNotAnti = isNormal; + } + /// Resos, where both daughters have the same PID are defaulted to sign 1. and resoIsNotAnti = true + + if (resoIsNotAnti) { + resoRegistry.fill(HIST("AnalysisQA/ResoLikeSign/ResoQA/InvMass"), tempReso.M()); + resoRegistry.fill(HIST("AnalysisQA/ResoLikeSign/ResoQA/InvMassSwitched"), tempAntiReso.M()); + resoRegistry.fill(HIST("AnalysisQA/ResoLikeSign/ResoQA/InvMassBothPID1"), tempMassQA1.M()); + resoRegistry.fill(HIST("AnalysisQA/ResoLikeSign/ResoQA/InvMassBothPID2"), tempMassQA2.M()); + } else { + resoRegistry.fill(HIST("AnalysisQA/ResoLikeSign/AntiResoQA/InvMass"), tempReso.M()); + resoRegistry.fill(HIST("AnalysisQA/ResoLikeSign/AntiResoQA/InvMassSwitched"), tempAntiReso.M()); + resoRegistry.fill(HIST("AnalysisQA/ResoLikeSign/AntiResoQA/InvMassBothPID1"), tempMassQA1.M()); + resoRegistry.fill(HIST("AnalysisQA/ResoLikeSign/AntiResoQA/InvMassBothPID2"), tempMassQA2.M()); + } + } // for (const &auto track2 : sliceDaughters) + } // for (const &auto track1 : sliceDaughters) + } + template void fillCollisionsAndTracksAndV0(CollisionType const& col, TrackType const& tracks, TrackTypeWithItsPid const& tracksWithItsPid, V0Type const& fullV0s) { @@ -849,19 +961,49 @@ struct FemtoDreamProducerTaskReso { auto sliceNegdaugh = daughter2.sliceByCached(aod::track::collisionId, col.globalIndex(), cache); for (const auto& track1 : slicePosdaugh) { - if (!resoCuts.daughterSelectionPos(track1) || !resoCuts.isSelectedMinimalPIDPos(track1, Resonance.confDaughterPIDspecies.value[0])) { + if (!resoCuts.daughterSelectionPos(track1) || !resoCuts.isSelectedMinimalPIDPos(track1, Resonance.confDaughterPIDspecies.value)) { continue; } for (const auto& track2 : sliceNegdaugh) { - if (!resoCuts.daughterSelectionNeg(track2) || !resoCuts.isSelectedMinimalPIDNeg(track2, Resonance.confDaughterPIDspecies.value[1])) { + if (!resoCuts.daughterSelectionNeg(track2) || !resoCuts.isSelectedMinimalPIDNeg(track2, Resonance.confDaughterPIDspecies.value)) { continue; /// loosest cuts for track2 } + /// This only works for the case where the mass of opposite charged particles are the same (for example K+/K- have same mass) + float massPart1 = o2::track::PID::getMass(Resonance.confDaughterPIDspecies.value[0]); + float massPart2 = o2::track::PID::getMass(Resonance.confDaughterPIDspecies.value[1]); + + /// Resonance + ROOT::Math::PtEtaPhiMVector tempD1(track1.pt(), track1.eta(), track1.phi(), massPart1); + ROOT::Math::PtEtaPhiMVector tempD2(track2.pt(), track2.eta(), track2.phi(), massPart2); + ROOT::Math::PtEtaPhiMVector tempReso = tempD1 + tempD2; + /// Anti-resonance + ROOT::Math::PtEtaPhiMVector tempDA1(track1.pt(), track1.eta(), track1.phi(), massPart2); + ROOT::Math::PtEtaPhiMVector tempDA2(track2.pt(), track2.eta(), track2.phi(), massPart1); + ROOT::Math::PtEtaPhiMVector tempAntiReso = tempDA1 + tempDA2; + + /// For InvMassQA + ROOT::Math::PtEtaPhiMVector tempDaughter1MassQA1(track1.pt(), track1.eta(), track1.phi(), massPart1); + ROOT::Math::PtEtaPhiMVector tempDaughter2MassQA1(track2.pt(), track2.eta(), track2.phi(), massPart1); + ROOT::Math::PtEtaPhiMVector tempMassQA1 = tempDaughter1MassQA1 + tempDaughter2MassQA1; + + float massQAPart2 = massPart2; + if (Resonance.confDaughterPIDspecies.value[0] == Resonance.confDaughterPIDspecies.value[1]) { + massQAPart2 = o2::track::PID::getMass(Resonance.confMassQAPart2PID.value); + } + + ROOT::Math::PtEtaPhiMVector tempDaughter1MassQA2(track1.pt(), track1.eta(), track1.phi(), massQAPart2); + ROOT::Math::PtEtaPhiMVector tempDaughter2MassQA2(track2.pt(), track2.eta(), track2.phi(), massQAPart2); + ROOT::Math::PtEtaPhiMVector tempMassQA2 = tempDaughter1MassQA2 + tempDaughter2MassQA2; + + float massDiff = std::abs(Resonance.confResoInvMass.value - tempReso.M()); + float massDiffAnti = std::abs(Resonance.confResoInvMass.value - tempAntiReso.M()); + bool resoIsNotAnti = true; /// bool for differentianting between particle/antiparticle float resoSign = 1.; if ((Resonance.confDaughterPIDspecies->size() > 1) && (Resonance.confDaughterPIDspecies.value[0] != Resonance.confDaughterPIDspecies.value[1])) { - auto [isNormal, WrongCombination] = resoCuts.checkCombination(track1, track2, static_cast(Resonance.confResoMotherID.value)); + auto [isNormal, WrongCombination] = resoCuts.checkCombination(track1, track2, Resonance.confDaughterPIDspecies.value, massDiff, massDiffAnti, Resonance.confUseMassDiff.value); if (WrongCombination) { continue; } @@ -872,39 +1014,49 @@ struct FemtoDreamProducerTaskReso { } /// Resos, where both daughters have the same PID are defaulted to sign 1. and resoIsNotAnti = true - resoRegistry.fill(HIST("AnalysisQA/Reso/Daughter1/Pt"), track1.pt()); - resoRegistry.fill(HIST("AnalysisQA/Reso/Daughter2/Pt"), track2.pt()); - resoRegistry.fill(HIST("AnalysisQA/Reso/Daughter1/Eta"), track1.eta()); - resoRegistry.fill(HIST("AnalysisQA/Reso/Daughter2/Eta"), track2.eta()); - resoRegistry.fill(HIST("AnalysisQA/Reso/Daughter1/DcaXY"), track1.dcaXY()); - resoRegistry.fill(HIST("AnalysisQA/Reso/Daughter2/DcaXY"), track2.dcaXY()); - resoRegistry.fill(HIST("AnalysisQA/Reso/Daughter1/DcaZ"), track1.dcaZ()); - resoRegistry.fill(HIST("AnalysisQA/Reso/Daughter2/DcaZ"), track2.dcaZ()); - resoRegistry.fill(HIST("AnalysisQA/Reso/Daughter1/Phi"), track1.phi()); - resoRegistry.fill(HIST("AnalysisQA/Reso/Daughter2/Phi"), track2.phi()); - - /// Get masses for calculating invariant Mass - /// This only works for the case where the mass of opposite charged particles are the same (for example K+/K- have same mass) - auto [MassPart1, MassPart2] = resoCuts.getMassDaughters(static_cast(Resonance.confResoMotherID.value)); - - /// Resonance - ROOT::Math::PtEtaPhiMVector tempD1(track1.pt(), track1.eta(), track1.phi(), MassPart1); - ROOT::Math::PtEtaPhiMVector tempD2(track2.pt(), track2.eta(), track2.phi(), MassPart2); - ROOT::Math::PtEtaPhiMVector tempReso = tempD1 + tempD2; - /// Anti-resonance - ROOT::Math::PtEtaPhiMVector tempDA1(track1.pt(), track1.eta(), track1.phi(), MassPart2); - ROOT::Math::PtEtaPhiMVector tempDA2(track2.pt(), track2.eta(), track2.phi(), MassPart1); - ROOT::Math::PtEtaPhiMVector tempAntiReso = tempDA1 + tempDA2; - if (resoIsNotAnti) { resoRegistry.fill(HIST("AnalysisQA/Reso/InvMass"), tempReso.M()); + // Fill DaughterQA histos + resoRegistry.fill(HIST("AnalysisQA/Reso/ResoQA/PosDaughter/Pt"), track1.pt()); + resoRegistry.fill(HIST("AnalysisQA/Reso/ResoQA/NegDaughter/Pt"), track2.pt()); + resoRegistry.fill(HIST("AnalysisQA/Reso/ResoQA/PosDaughter/Eta"), track1.eta()); + resoRegistry.fill(HIST("AnalysisQA/Reso/ResoQA/NegDaughter/Eta"), track2.eta()); + resoRegistry.fill(HIST("AnalysisQA/Reso/ResoQA/PosDaughter/DcaXY"), track1.dcaXY()); + resoRegistry.fill(HIST("AnalysisQA/Reso/ResoQA/NegDaughter/DcaXY"), track2.dcaXY()); + resoRegistry.fill(HIST("AnalysisQA/Reso/ResoQA/PosDaughter/DcaZ"), track1.dcaZ()); + resoRegistry.fill(HIST("AnalysisQA/Reso/ResoQA/NegDaughter/DcaZ"), track2.dcaZ()); + resoRegistry.fill(HIST("AnalysisQA/Reso/ResoQA/PosDaughter/Phi"), track1.phi()); + resoRegistry.fill(HIST("AnalysisQA/Reso/ResoQA/NegDaughter/Phi"), track2.phi()); + // Fill InvMassQA histos + resoRegistry.fill(HIST("AnalysisQA/Reso/ResoQA/InvMassSwitched"), tempAntiReso.M()); + resoRegistry.fill(HIST("AnalysisQA/Reso/ResoQA/InvMassBothPID1"), tempMassQA1.M()); + resoRegistry.fill(HIST("AnalysisQA/Reso/ResoQA/InvMassBothPID2"), tempMassQA2.M()); + + /// MassCut if (!(tempReso.M() > Resonance.confResoInvMassLowLimit.value && tempReso.M() < Resonance.confResoInvMassUpLimit.value)) - continue; /// MassCut + continue; resoRegistry.fill(HIST("AnalysisQA/Reso/InvMass_phi_selected"), tempReso.M()); } else { resoRegistry.fill(HIST("AnalysisQA/Reso/InvMassAnti"), tempAntiReso.M()); + // Fill DaughterQA histos + resoRegistry.fill(HIST("AnalysisQA/Reso/AntiResoQA/PosDaughter/Pt"), track1.pt()); + resoRegistry.fill(HIST("AnalysisQA/Reso/AntiResoQA/NegDaughter/Pt"), track2.pt()); + resoRegistry.fill(HIST("AnalysisQA/Reso/AntiResoQA/PosDaughter/Eta"), track1.eta()); + resoRegistry.fill(HIST("AnalysisQA/Reso/AntiResoQA/NegDaughter/Eta"), track2.eta()); + resoRegistry.fill(HIST("AnalysisQA/Reso/AntiResoQA/PosDaughter/DcaXY"), track1.dcaXY()); + resoRegistry.fill(HIST("AnalysisQA/Reso/AntiResoQA/NegDaughter/DcaXY"), track2.dcaXY()); + resoRegistry.fill(HIST("AnalysisQA/Reso/AntiResoQA/PosDaughter/DcaZ"), track1.dcaZ()); + resoRegistry.fill(HIST("AnalysisQA/Reso/AntiResoQA/NegDaughter/DcaZ"), track2.dcaZ()); + resoRegistry.fill(HIST("AnalysisQA/Reso/AntiResoQA/PosDaughter/Phi"), track1.phi()); + resoRegistry.fill(HIST("AnalysisQA/Reso/AntiResoQA/NegDaughter/Phi"), track2.phi()); + // Fill InvMassQA histos + resoRegistry.fill(HIST("AnalysisQA/Reso/AntiResoQA/InvMassSwitched"), tempReso.M()); + resoRegistry.fill(HIST("AnalysisQA/Reso/AntiResoQA/InvMassBothPID1"), tempMassQA1.M()); + resoRegistry.fill(HIST("AnalysisQA/Reso/AntiResoQA/InvMassBothPID2"), tempMassQA2.M()); + + /// MassCut if (!(tempAntiReso.M() > Resonance.confResoInvMassLowLimit.value && tempAntiReso.M() < Resonance.confResoInvMassUpLimit.value)) - continue; /// MassCut + continue; resoRegistry.fill(HIST("AnalysisQA/Reso/InvMassAnti_phi_selected"), tempAntiReso.M()); } @@ -923,10 +1075,10 @@ struct FemtoDreamProducerTaskReso { resoRegistry.fill(HIST("AnalysisQA/Reso/Phi_posdaughter_selected"), track1.phi()); resoRegistry.fill(HIST("AnalysisQA/Reso/Phi_negdaughter_selected"), track2.phi()); - auto type = resoCuts.getType(track1, track2); // kResoPosdaughTPC_NegdaughTPC - // kResoPosdaughTPC_NegdaughTOF - // kResoPosdaughTPC_NegdaughTPC - // kResoPosdaughTOF_NegdaughTOF as possible output + auto type = resoCuts.getType(track1, track2, resoIsNotAnti); // kResoPosdaughTPC_NegdaughTPC + // kResoPosdaughTPC_NegdaughTOF + // kResoPosdaughTPC_NegdaughTPC + // kResoPosdaughTOF_NegdaughTOF as possible output auto bitmask = resoCuts.getCutContainer(track1, track2, resoSign); @@ -998,10 +1150,16 @@ struct FemtoDreamProducerTaskReso { fillDebugParticle(track2); // QA for negative daughter fillDebugParticle(outputReso); } - } + } // for (const auto& track2 : sliceNegdaugh) + } // for (const auto& track1 : slicePosdaugh) + + if (Resonance.confDoLikeSign.value) { + fillLikeSign(slicePosdaugh); + fillLikeSign(sliceNegdaugh); } - } - } + + } // if (confIsActivatePhi.value) + } // void fillCollisionsAndTracksAndV0(...) void processData(aod::FemtoFullCollision const& col, @@ -1045,10 +1203,10 @@ struct FemtoDreamProducerTaskReso { PROCESS_SWITCH(FemtoDreamProducerTaskReso, processData_noCentrality, "Provide experimental data without centrality information", false); - void processData_CentPbPb(aod::FemtoFullCollisionCentPbPb const& col, // o2-linter: disable=name/function-variable (UpperCamelCase defined soa::JOIN) - aod::BCsWithTimestamps const&, - aod::FemtoFullTracks const& tracks, - o2::aod::V0Datas const& fullV0s) + void processDataCentPbPb(aod::FemtoFullCollisionCentPbPb const& col, + aod::BCsWithTimestamps const&, + aod::FemtoFullTracks const& tracks, + o2::aod::V0Datas const& fullV0s) { // get magnetic field for run initCcdbMagTrig(col.bc_as()); @@ -1062,7 +1220,7 @@ struct FemtoDreamProducerTaskReso { fillCollisionsAndTracksAndV0(col, tracks, tracks, fullV0s); } } - PROCESS_SWITCH(FemtoDreamProducerTaskReso, processData_CentPbPb, + PROCESS_SWITCH(FemtoDreamProducerTaskReso, processDataCentPbPb, "Provide experimental data with centrality information for PbPb collisions", false); void processMC(aod::FemtoFullCollisionMC const& col, @@ -1079,33 +1237,33 @@ struct FemtoDreamProducerTaskReso { } PROCESS_SWITCH(FemtoDreamProducerTaskReso, processMC, "Provide MC data", false); - void processMC_noCentrality(aod::FemtoFullCollisionNoCentMC const& col, // o2-linter: disable=name/function-variable (UpperCamelCase defined soa::JOIN) - aod::BCsWithTimestamps const&, - soa::Join const& tracks, - aod::FemtoFullMCgenCollisions const&, - aod::McParticles const&, - soa::Join const& fullV0s) /// \todo with FilteredFullV0s + void processMCnoCentrality(aod::FemtoFullCollisionNoCentMC const& col, + aod::BCsWithTimestamps const&, + soa::Join const& tracks, + aod::FemtoFullMCgenCollisions const&, + aod::McParticles const&, + soa::Join const& fullV0s) /// \todo with FilteredFullV0s { // get magnetic field for run initCcdbMagTrig(col.bc_as()); // fill the tables fillCollisionsAndTracksAndV0(col, tracks, tracks, fullV0s); } - PROCESS_SWITCH(FemtoDreamProducerTaskReso, processMC_noCentrality, "Provide MC data without requiring a centrality calibration", false); - - void processMC_CentPbPb(aod::FemtoFullCollisionMCCentPbPb const& col, // o2-linter: disable=name/function-variable (UpperCamelCase defined soa::JOIN) - aod::BCsWithTimestamps const&, - soa::Join const& tracks, - aod::FemtoFullMCgenCollisions const&, - aod::McParticles const&, - soa::Join const& fullV0s) /// \todo with FilteredFullV0s + PROCESS_SWITCH(FemtoDreamProducerTaskReso, processMCnoCentrality, "Provide MC data without requiring a centrality calibration", false); + + void processMCCentPbPb(aod::FemtoFullCollisionMCCentPbPb const& col, + aod::BCsWithTimestamps const&, + soa::Join const& tracks, + aod::FemtoFullMCgenCollisions const&, + aod::McParticles const&, + soa::Join const& fullV0s) /// \todo with FilteredFullV0s { // get magnetic field for run initCcdbMagTrig(col.bc_as()); // fill the tables fillCollisionsAndTracksAndV0(col, tracks, tracks, fullV0s); } - PROCESS_SWITCH(FemtoDreamProducerTaskReso, processMC_CentPbPb, "Provide MC data with centrality information for PbPb collisions", false); + PROCESS_SWITCH(FemtoDreamProducerTaskReso, processMCCentPbPb, "Provide MC data with centrality information for PbPb collisions", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { From 2a1aac7b2aa68e11f3d3616367d3e341e38a015a Mon Sep 17 00:00:00 2001 From: ariedel-cern <85537041+ariedel-cern@users.noreply.github.com> Date: Fri, 10 Oct 2025 09:30:01 +0200 Subject: [PATCH 691/986] [PWGCF,Trigger] Remove unused code (#13288) --- EventFiltering/CMakeLists.txt | 10 - EventFiltering/PWGCF/CFFilter.cxx | 595 -------- EventFiltering/PWGCF/CFFilterPPPhi.cxx | 543 -------- EventFiltering/PWGCF/CFFilterQA.cxx | 1726 ------------------------ EventFiltering/PWGCF/CFFilterTwoN.cxx | 550 -------- 5 files changed, 3424 deletions(-) delete mode 100644 EventFiltering/PWGCF/CFFilter.cxx delete mode 100644 EventFiltering/PWGCF/CFFilterPPPhi.cxx delete mode 100644 EventFiltering/PWGCF/CFFilterQA.cxx delete mode 100644 EventFiltering/PWGCF/CFFilterTwoN.cxx diff --git a/EventFiltering/CMakeLists.txt b/EventFiltering/CMakeLists.txt index 554431848c9..8805e893fea 100644 --- a/EventFiltering/CMakeLists.txt +++ b/EventFiltering/CMakeLists.txt @@ -57,16 +57,6 @@ o2physics_add_dpl_workflow(cf-filter PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore KFParticle::KFParticle O2::ReconstructionDataFormats O2::DetectorsBase COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(cf-filter-qa - SOURCES PWGCF/CFFilterQA.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - -o2physics_add_dpl_workflow(cf-filter-ppphi - SOURCES PWGCF/CFFilterPPPhi.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(je-filter SOURCES PWGJE/jetFilter.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::PWGJECore FastJet::FastJet FastJet::Contrib diff --git a/EventFiltering/PWGCF/CFFilter.cxx b/EventFiltering/PWGCF/CFFilter.cxx deleted file mode 100644 index 7219ba03d45..00000000000 --- a/EventFiltering/PWGCF/CFFilter.cxx +++ /dev/null @@ -1,595 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file CFFilter.cxx -/// \brief Selection of events with triplets for femtoscopic studies -/// -/// \author Laura Serksnyte, TU München, laura.serksnyte@cern.ch - -#include - -#include "../filterTables.h" -#include "../../PWGCF/FemtoDream/FemtoUtils.h" - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/HistogramRegistry.h" - -#include "PWGCF/DataModel/FemtoDerived.h" -#include "PWGCF/FemtoDream/FemtoDreamParticleHisto.h" -#include "PWGCF/FemtoDream/FemtoDreamMath.h" -#include "PWGCF/FemtoDream/FemtoDreamPairCleaner.h" -#include "PWGCF/FemtoDream/FemtoDreamDetaDphiStar.h" -#include "PWGCF/FemtoDream/FemtoDreamContainer.h" - -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Multiplicity.h" - -namespace -{ - -enum CFTriggers { - kPPP = 0, - kPPL, - kPLL, - kLLL, - kNTriggers -}; - -static const std::vector CfTriggerNames{"ppp", "ppL", "pLL", "LLL"}; -// uint8_t trackTypeSel = o2::aod::femtodreamparticle::ParticleType::kTrack; Fix this to work instead of below hardcoded lines -// uint V0TypeSel = o2::aod::femtodreamparticle::ParticleType::kV0; Fix this to work instead of below hardcoded lines -static constexpr uint8_t Track = 0; // Track -static constexpr uint8_t V0 = 1; // V0 -// static constexpr uint8_t V0Daughter = 2; // V0 daughters -static constexpr uint32_t kSignMinusMask = 1; -static constexpr uint32_t kSignPlusMask = 2; -// static constexpr uint32_t knSigmaProton = 48; -static constexpr uint32_t kValue0 = 0; - -} // namespace - -namespace o2::aod -{ -using FullCollision = soa::Join::iterator; -} // namespace o2::aod - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; -using namespace o2::analysis::femtoDream; - -struct CFFilter { - SliceCache cache; - - Produces tags; - - Configurable> confQ3TriggerLimit{"Q3TriggerLimitC", std::vector{0.6f, 0.6f, 0.6f, 0.6f}, "Q3 limit for selection"}; - Configurable Q3Trigger{"Q3Trigger", 0, "Choice which trigger to run"}; - Configurable performCPR{"performCPR", true, "Perform or not the close pair rejection"}; - Configurable ldeltaPhiMax{"ldeltaPhiMax", 0.010, "Max limit of delta phi"}; - Configurable ldeltaEtaMax{"ldeltaEtaMax", 0.010, "Max limit of delta eta"}; - Configurable> ConfPIDnSigmaMax{"PIDnSigmaMax", - std::vector{4.f, 3.f}, - "Vector of all possible nSigma values for Acceptance and Rejection (this needs to be in sync with FemtoDreamProducerTask.ConfTrkPIDnSigmaMax)"}; - Configurable ConfPIDProtonIndex{"PIDProtonIndex", 2, "Index of Proton PID in ConfTrkTPIDspecies of the FemtoDreamProducerTask"}; - Configurable ConfPIDIndexMax{"PIDIndexMax", 4, "Number of Indices in ConfTrkTPIDspecies of the FemtoDreamProducerTask"}; - Configurable ConfPIDThreshold{"PThreshold", 0.75f, "P threshold for TPC/TPC&TOF selection"}; - Configurable ConfPIDnSigma{"PIDnSigma", 4.f, "nSigma value for Proton PID"}; - - // Obtain particle and antiparticle candidates of protons and lambda hyperons for current femto collision - Partition partsProton0Part = (o2::aod::femtodreamparticle::partType == Track) && ((o2::aod::femtodreamparticle::cut & kSignPlusMask) > kValue0); // Consider later: && ((o2::aod::femtodreamparticle::pidcut & knSigmaProton) > kValue0); - Partition partsLambda0Part = (o2::aod::femtodreamparticle::partType == V0) && ((o2::aod::femtodreamparticle::cut & kSignPlusMask) > kValue0); - Partition partsProton1Part = (o2::aod::femtodreamparticle::partType == Track) && ((o2::aod::femtodreamparticle::cut & kSignMinusMask) > kValue0); // Consider later: && ((o2::aod::femtodreamparticle::pidcut & knSigmaProton) > kValue0); - Partition partsLambda1Part = (o2::aod::femtodreamparticle::partType == V0) && ((o2::aod::femtodreamparticle::cut & kSignMinusMask) > kValue0); - - Preslice perCol = aod::femtodreamparticle::femtoDreamCollisionId; - - HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry registryQA{"registryQA", {}, OutputObjHandlingPolicy::AnalysisObject}; - - // FemtoDreamPairCleaner pairCleanerTT; Currently not used, will be needed later - FemtoDreamPairCleaner pairCleanerTV; - FemtoDreamDetaDphiStar closePairRejectionTT; - FemtoDreamDetaDphiStar closePairRejectionTV0; - - void init(o2::framework::InitContext&) - { - bool plotPerRadii = true; - - closePairRejectionTT.init(®istry, ®istryQA, ldeltaPhiMax, ldeltaEtaMax, plotPerRadii); - closePairRejectionTV0.init(®istry, ®istryQA, ldeltaPhiMax, ldeltaEtaMax, plotPerRadii); - registry.add("fProcessedEvents", "CF - event filtered;;events", HistType::kTH1F, {{6, -0.5, 5.5}}); - // dont use hardcoded 6 - std::array eventTitles = {"all", "rejected", "p-p-p", "p-p-L", "p-L-L", "L-L-L"}; - for (size_t iBin = 0; iBin < eventTitles.size(); iBin++) { - registry.get(HIST("fProcessedEvents"))->GetXaxis()->SetBinLabel(iBin + 1, eventTitles[iBin].data()); - } - registry.add("fMultiplicityBefore", "Multiplicity of all processed events", HistType::kTH1F, {{1000, 0, 1000}}); - registry.add("fMultiplicityAfter", "Multiplicity of events which passed ppp trigger", HistType::kTH1F, {{1000, 0, 1000}}); - registry.add("fZvtxBefore", "Zvtx of all processed events", HistType::kTH1F, {{1000, -15, 15}}); - registry.add("fZvtxAfter", "Zvtx of events which passed ppp trigger", HistType::kTH1F, {{1000, -15, 15}}); - - registry.add("fPtBeforePPP", "Transverse momentum of all processed tracks", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("fPtAfterPPP", "Transverse momentum of processed tracks which passed selections", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("fPtBeforeAntiPPP", "Transverse momentum of all processed antitracks", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("fPtAfterAntiPPP", "Transverse momentum of processed antitracks passed selection", HistType::kTH1F, {{1000, 0, 10}}); - - if (Q3Trigger == 0 || Q3Trigger == 11 || Q3Trigger == 1111) { - registry.add("fSameEventPartPPP", "CF - same event ppp distribution for particles;;events", HistType::kTH1F, {{8000, 0, 8}}); - registry.add("fSameEventAntiPartPPP", "CF - same event ppp distribution for antiparticles;;events", HistType::kTH1F, {{8000, 0, 8}}); - } - if (Q3Trigger == 1 || Q3Trigger == 11 || Q3Trigger == 1111) { - registry.add("fSameEventPartPPL", "CF - same event ppL distribution for particles;;events", HistType::kTH1F, {{8000, 0, 8}}); - registry.add("fSameEventAntiPartPPL", "CF - same event ppL distribution for antiparticles;;events", HistType::kTH1F, {{8000, 0, 8}}); - - registry.add("fPtPPL", "Transverse momentum of all processed tracks", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("fPtAntiPPL", "Transverse momentum of all processed antitracks", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("fMinvLambda", "Invariant mass of lambdas ", HistType::kTH1F, {{1000, 0.7, 1.5}}); - registry.add("fMinvAntiLambda", "Invariant mass of antilambdas ", HistType::kTH1F, {{1000, 0.7, 1.5}}); - registry.add("fMinvLambdaBefore", "Invariant mass of lambdas before ", HistType::kTH1F, {{1000, 0.7, 1.5}}); - registry.add("fMinvAntiLambdaBefore", "Invariant mass of antilambdas before", HistType::kTH1F, {{1000, 0.7, 1.5}}); - } - if (Q3Trigger == 2 || Q3Trigger == 1111) { - registry.add("fSameEventPartPLL", "CF - same event pLL distribution for particles;;events", HistType::kTH1F, {{8000, 0, 8}}); - registry.add("fSameEventAntiPartPLL", "CF - same event pLL distribution for antiparticles;;events", HistType::kTH1F, {{8000, 0, 8}}); - } - if (Q3Trigger == 3 || Q3Trigger == 1111) { - registry.add("fSameEventPartLLL", "CF - same event LLL distribution for particles;;events", HistType::kTH1F, {{8000, 0, 8}}); - registry.add("fSameEventAntiPartLLL", "CF - same event LLL distribution for antiparticles;;events", HistType::kTH1F, {{8000, 0, 8}}); - } - } - - float mMassProton = TDatabasePDG::Instance()->GetParticle(2212)->Mass(); - float mMassLambda = TDatabasePDG::Instance()->GetParticle(3122)->Mass(); - - void process(o2::aod::FemtoDreamCollision& col, o2::aod::FemtoDreamParticles& partsFemto) - { - auto partsProton0 = partsProton0Part->sliceByCached(aod::femtodreamparticle::femtoDreamCollisionId, col.globalIndex(), cache); - auto partsLambda0 = partsLambda0Part->sliceByCached(aod::femtodreamparticle::femtoDreamCollisionId, col.globalIndex(), cache); - auto partsProton1 = partsProton1Part->sliceByCached(aod::femtodreamparticle::femtoDreamCollisionId, col.globalIndex(), cache); - auto partsLambda1 = partsLambda1Part->sliceByCached(aod::femtodreamparticle::femtoDreamCollisionId, col.globalIndex(), cache); - - auto magneticField = col.magField(); - - registry.get(HIST("fProcessedEvents"))->Fill(0); - registry.get(HIST("fMultiplicityBefore"))->Fill(col.multV0M()); - registry.get(HIST("fZvtxBefore"))->Fill(col.posZ()); - - int prot = 0; - int antiprot = 0; - for (auto p1pt : partsProton0) { - registry.get(HIST("fPtBeforePPP"))->Fill(p1pt.pt()); - if (isFullPIDSelected(p1pt.pidcut(), - p1pt.p(), - ConfPIDThreshold.value, - std::vector{ConfPIDProtonIndex.value}, - ConfPIDIndexMax.value, - ConfPIDnSigmaMax.value, - ConfPIDnSigma.value, - ConfPIDnSigma.value)) { - registry.get(HIST("fPtAfterPPP"))->Fill(p1pt.pt()); - prot++; - } - } - for (auto p1pt : partsProton1) { - registry.get(HIST("fPtBeforeAntiPPP"))->Fill(p1pt.pt()); - if (isFullPIDSelected(p1pt.pidcut(), - p1pt.p(), - ConfPIDThreshold.value, - std::vector{ConfPIDProtonIndex.value}, - ConfPIDIndexMax.value, - ConfPIDnSigmaMax.value, - ConfPIDnSigma.value, - ConfPIDnSigma.value)) { - registry.get(HIST("fPtAfterAntiPPP"))->Fill(p1pt.pt()); - antiprot++; - } - } - - for (auto lambda : partsLambda0) { - registry.get(HIST("fMinvLambdaBefore"))->Fill(lambda.mLambda()); - } - for (auto antilambda : partsLambda1) { - registry.get(HIST("fMinvAntiLambdaBefore"))->Fill(antilambda.mAntiLambda()); - } - - bool keepEvent[kNTriggers] = {false, false, false, false}; - int lowQ3Triplets[kNTriggers] = {0, 0, 0, 0}; - - if (partsFemto.size() != 0) { - registry.get(HIST("fMultiplicityAfter"))->Fill(col.multV0M()); - registry.get(HIST("fZvtxAfter"))->Fill(col.posZ()); - auto Q3TriggerLimit = (std::vector)confQ3TriggerLimit; - // __________________________________________________________________________________________________________ - // TRIGGER FOR PPP TRIPLETS - if (Q3Trigger == 0 || Q3Trigger == 1111 || Q3Trigger == 11) { - if (prot >= 3) { - // test default combinations options - for (auto& [p1, p2, p3] : combinations(partsProton0, partsProton0, partsProton0)) { - if (!isFullPIDSelected(p1.pidcut(), - p1.p(), - ConfPIDThreshold.value, - std::vector{ConfPIDProtonIndex.value}, - ConfPIDIndexMax.value, - ConfPIDnSigmaMax.value, - ConfPIDnSigma.value, - ConfPIDnSigma.value) || - !isFullPIDSelected(p2.pidcut(), - p2.p(), - ConfPIDThreshold.value, - std::vector{ConfPIDProtonIndex.value}, - ConfPIDIndexMax.value, - ConfPIDnSigmaMax.value, - ConfPIDnSigma.value, - ConfPIDnSigma.value) || - !isFullPIDSelected(p3.pidcut(), - p3.p(), - ConfPIDThreshold.value, - std::vector{ConfPIDProtonIndex.value}, - ConfPIDIndexMax.value, - ConfPIDnSigmaMax.value, - ConfPIDnSigma.value, - ConfPIDnSigma.value)) { - continue; - } - // Think if pair cleaning is needed in current framework - // Run close pair rejection - if (performCPR) { - if (closePairRejectionTT.isClosePair(p1, p2, partsFemto, magneticField)) { - continue; - } - if (closePairRejectionTT.isClosePair(p1, p3, partsFemto, magneticField)) { - continue; - } - if (closePairRejectionTT.isClosePair(p2, p3, partsFemto, magneticField)) { - continue; - } - } - auto Q3 = FemtoDreamMath::getQ3(p1, mMassProton, p2, mMassProton, p3, mMassProton); - registry.get(HIST("fSameEventPartPPP"))->Fill(Q3); - if (Q3 < Q3TriggerLimit.at(0)) { - lowQ3Triplets[0]++; - } - } - } // end if - - if (lowQ3Triplets[0] == 0) { // Use this in final version only, for testing comment { // if at least one triplet found in particles, no need to check antiparticles - if (antiprot >= 3) { - for (auto& [p1, p2, p3] : combinations(partsProton1, partsProton1, partsProton1)) { - - if (!isFullPIDSelected(p1.pidcut(), - p1.p(), - ConfPIDThreshold.value, - std::vector{ConfPIDProtonIndex.value}, - ConfPIDIndexMax.value, - ConfPIDnSigmaMax.value, - ConfPIDnSigma.value, - ConfPIDnSigma.value) || - !isFullPIDSelected(p2.pidcut(), - p2.p(), - ConfPIDThreshold.value, - std::vector{ConfPIDProtonIndex.value}, - ConfPIDIndexMax.value, - ConfPIDnSigmaMax.value, - ConfPIDnSigma.value, - ConfPIDnSigma.value) || - !isFullPIDSelected(p3.pidcut(), - p3.p(), - ConfPIDThreshold.value, - std::vector{ConfPIDProtonIndex.value}, - ConfPIDIndexMax.value, - ConfPIDnSigmaMax.value, - ConfPIDnSigma.value, - ConfPIDnSigma.value)) { - continue; - } - // Think if pair cleaning is needed in current framework - // Run close pair rejection - if (performCPR) { - if (closePairRejectionTT.isClosePair(p1, p2, partsFemto, magneticField)) { - continue; - } - if (closePairRejectionTT.isClosePair(p1, p3, partsFemto, magneticField)) { - continue; - } - if (closePairRejectionTT.isClosePair(p2, p3, partsFemto, magneticField)) { - continue; - } - } - auto Q3 = FemtoDreamMath::getQ3(p1, mMassProton, p2, mMassProton, p3, mMassProton); - registry.get(HIST("fSameEventAntiPartPPP"))->Fill(Q3); - if (Q3 < Q3TriggerLimit.at(0)) { - lowQ3Triplets[0]++; - } - } - } - } // end if - //} - } - // __________________________________________________________________________________________________________ - // TRIGGER FOR PPL TRIPLETS - if (Q3Trigger == 1 || Q3Trigger == 1111 || Q3Trigger == 11) { - if (partsLambda0.size() >= 1 && prot >= 2) { - for (auto& partLambda : partsLambda0) { - registry.get(HIST("fPtPPL"))->Fill(partLambda.pt()); - registry.get(HIST("fMinvLambda"))->Fill(partLambda.mLambda()); - if (!pairCleanerTV.isCleanPair(partLambda, partLambda, partsFemto)) { - continue; - } - for (auto& [p1, p2] : combinations(partsProton0, partsProton0)) { - if (!isFullPIDSelected(p1.pidcut(), - p1.p(), - ConfPIDThreshold.value, - std::vector{ConfPIDProtonIndex.value}, - ConfPIDIndexMax.value, - ConfPIDnSigmaMax.value, - ConfPIDnSigma.value, - ConfPIDnSigma.value) || - !isFullPIDSelected(p2.pidcut(), - p2.p(), - ConfPIDThreshold.value, - std::vector{ConfPIDProtonIndex.value}, - ConfPIDIndexMax.value, - ConfPIDnSigmaMax.value, - ConfPIDnSigma.value, - ConfPIDnSigma.value)) { - continue; - } - if (performCPR) { - if (closePairRejectionTT.isClosePair(p1, p2, partsFemto, magneticField)) { - continue; - } - if (closePairRejectionTV0.isClosePair(p1, partLambda, partsFemto, magneticField)) { - continue; - } - if (closePairRejectionTV0.isClosePair(p2, partLambda, partsFemto, magneticField)) { - continue; - } - } - auto Q3 = FemtoDreamMath::getQ3(p1, mMassProton, p2, mMassProton, partLambda, mMassLambda); - registry.get(HIST("fSameEventPartPPL"))->Fill(Q3); - if (Q3 < Q3TriggerLimit.at(1)) { - lowQ3Triplets[1]++; - } - } - } - } // end if - - if (lowQ3Triplets[1] == 0) { // if at least one triplet found in particles, no need to check antiparticles - if (partsLambda1.size() >= 1 && antiprot >= 2) { - for (auto& partLambda : partsLambda1) { - registry.get(HIST("fPtAntiPPL"))->Fill(partLambda.pt()); - registry.get(HIST("fMinvAntiLambda"))->Fill(partLambda.mAntiLambda()); - if (!pairCleanerTV.isCleanPair(partLambda, partLambda, partsFemto)) { - continue; - } - for (auto& [p1, p2] : combinations(partsProton1, partsProton1)) { - if (!isFullPIDSelected(p1.pidcut(), - p1.p(), - ConfPIDThreshold.value, - std::vector{ConfPIDProtonIndex.value}, - ConfPIDIndexMax.value, - ConfPIDnSigmaMax.value, - ConfPIDnSigma.value, - ConfPIDnSigma.value) || - !isFullPIDSelected(p2.pidcut(), - p2.p(), - ConfPIDThreshold.value, - std::vector{ConfPIDProtonIndex.value}, - ConfPIDIndexMax.value, - ConfPIDnSigmaMax.value, - ConfPIDnSigma.value, - ConfPIDnSigma.value)) { - continue; - } - if (performCPR) { - if (closePairRejectionTT.isClosePair(p1, p2, partsFemto, magneticField)) { - continue; - } - if (closePairRejectionTV0.isClosePair(p1, partLambda, partsFemto, magneticField)) { - continue; - } - if (closePairRejectionTV0.isClosePair(p2, partLambda, partsFemto, magneticField)) { - continue; - } - } - auto Q3 = FemtoDreamMath::getQ3(p1, mMassProton, p2, mMassProton, partLambda, mMassLambda); - registry.get(HIST("fSameEventAntiPartPPL"))->Fill(Q3); - if (Q3 < Q3TriggerLimit.at(1)) { - lowQ3Triplets[1]++; - } - } - } - } // end if - } - } - - // __________________________________________________________________________________________________________ - // TRIGGER FOR PLL TRIPLETS - if (Q3Trigger == 2 || Q3Trigger == 1111) { - if (partsLambda0.size() >= 2 && prot >= 1) { - for (auto& p1 : partsProton0) { - if (!isFullPIDSelected(p1.pidcut(), - p1.p(), - ConfPIDThreshold.value, - std::vector{ConfPIDProtonIndex.value}, - ConfPIDIndexMax.value, - ConfPIDnSigmaMax.value, - ConfPIDnSigma.value, - ConfPIDnSigma.value)) { - continue; - } - for (auto& [partLambda1, partLambda2] : combinations(partsLambda0, partsLambda0)) { - // maybe implement L1-L2 no shared tracks - if (!pairCleanerTV.isCleanPair(partLambda1, partLambda1, partsFemto)) { - continue; - } - if (!pairCleanerTV.isCleanPair(partLambda2, partLambda2, partsFemto)) { - continue; - } - - if (performCPR) { - if (closePairRejectionTV0.isClosePair(p1, partLambda1, partsFemto, magneticField)) { - continue; - } - if (closePairRejectionTV0.isClosePair(p1, partLambda2, partsFemto, magneticField)) { - continue; - } - // maybe implement L-L cpr - } - auto Q3 = FemtoDreamMath::getQ3(p1, mMassProton, partLambda1, mMassLambda, partLambda2, mMassLambda); - registry.get(HIST("fSameEventPartPLL"))->Fill(Q3); - if (Q3 < Q3TriggerLimit.at(2)) { - lowQ3Triplets[2]++; - } - } - } - } // end if - - if (lowQ3Triplets[2] == 0) { // if at least one triplet found in particles, no need to check antiparticles - if (partsLambda1.size() >= 2 && antiprot >= 1) { - for (auto& p1 : partsProton1) { - if (!isFullPIDSelected(p1.pidcut(), - p1.p(), - ConfPIDThreshold.value, - std::vector{ConfPIDProtonIndex.value}, - ConfPIDIndexMax.value, - ConfPIDnSigmaMax.value, - ConfPIDnSigma.value, - ConfPIDnSigma.value)) { - continue; - } - for (auto& [partLambda1, partLambda2] : combinations(partsLambda1, partsLambda1)) { - // maybe implement L1-L2 no shared tracks - if (!pairCleanerTV.isCleanPair(partLambda1, partLambda1, partsFemto)) { - continue; - } - if (!pairCleanerTV.isCleanPair(partLambda2, partLambda2, partsFemto)) { - continue; - } - - if (performCPR) { - if (closePairRejectionTV0.isClosePair(p1, partLambda1, partsFemto, magneticField)) { - continue; - } - if (closePairRejectionTV0.isClosePair(p1, partLambda2, partsFemto, magneticField)) { - continue; - } - // maybe implement L-L cpr - } - auto Q3 = FemtoDreamMath::getQ3(p1, mMassProton, partLambda1, mMassLambda, partLambda2, mMassLambda); - registry.get(HIST("fSameEventAntiPartPLL"))->Fill(Q3); - if (Q3 < Q3TriggerLimit.at(2)) { - lowQ3Triplets[2]++; - } - } - } - } // end if - } - } - - // __________________________________________________________________________________________________________ - // TRIGGER FOR LLL TRIPLETS - if (Q3Trigger == 3 || Q3Trigger == 1111) { - if (partsLambda0.size() >= 3) { - // test default combinations options - for (auto& [partLambda1, partLambda2, partLambda3] : combinations(partsLambda0, partsLambda0, partsLambda0)) { - if (!pairCleanerTV.isCleanPair(partLambda1, partLambda1, partsFemto)) { - continue; - } - if (!pairCleanerTV.isCleanPair(partLambda2, partLambda2, partsFemto)) { - continue; - } - if (!pairCleanerTV.isCleanPair(partLambda3, partLambda3, partsFemto)) { - continue; - } - // Run close pair rejection - if (performCPR) { - // check close pair rejection for L-L - } - auto Q3 = FemtoDreamMath::getQ3(partLambda1, mMassLambda, partLambda2, mMassLambda, partLambda3, mMassLambda); - registry.get(HIST("fSameEventPartLLL"))->Fill(Q3); - if (Q3 < Q3TriggerLimit.at(3)) { - lowQ3Triplets[3]++; - } - } - } // end if - - if (lowQ3Triplets[3] == 0) { // Use this in final version only, for testing comment { // if at least one triplet found in particles, no need to check antiparticles - - if (partsLambda1.size() >= 3) { - // test default combinations options - for (auto& [partLambda1, partLambda2, partLambda3] : combinations(partsLambda1, partsLambda1, partsLambda1)) { - if (!pairCleanerTV.isCleanPair(partLambda1, partLambda1, partsFemto)) { - continue; - } - if (!pairCleanerTV.isCleanPair(partLambda2, partLambda2, partsFemto)) { - continue; - } - if (!pairCleanerTV.isCleanPair(partLambda3, partLambda3, partsFemto)) { - continue; - } - // Run close pair rejection - if (performCPR) { - // check close pair rejection for L-L - } - auto Q3 = FemtoDreamMath::getQ3(partLambda1, mMassLambda, partLambda2, mMassLambda, partLambda3, mMassLambda); - registry.get(HIST("fSameEventAntiPartLLL"))->Fill(Q3); - if (Q3 < Q3TriggerLimit.at(3)) { - lowQ3Triplets[3]++; - } - } - } - - } // end if - //} - } - } - - if (lowQ3Triplets[0] > 0) { - keepEvent[kPPP] = true; - } - - if (lowQ3Triplets[1] > 0) { - keepEvent[kPPL] = true; - } - - if (lowQ3Triplets[2] > 0) { - keepEvent[kPLL] = true; - } - - if (lowQ3Triplets[3] > 0) { - keepEvent[kLLL] = true; - } - - tags(keepEvent[kPPP], keepEvent[kPPL], keepEvent[kPLL], keepEvent[kLLL]); - - if (!keepEvent[kPPP] && !keepEvent[kPPL] && !keepEvent[kPLL] && !keepEvent[kLLL]) { - registry.get(HIST("fProcessedEvents"))->Fill(1); - } else { - for (int iTrigger{0}; iTrigger < kNTriggers; iTrigger++) { - if (keepEvent[iTrigger]) { - registry.get(HIST("fProcessedEvents"))->Fill(iTrigger + 2); - } - } - } // end else - } -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfg) -{ - return WorkflowSpec{adaptAnalysisTask(cfg)}; -} diff --git a/EventFiltering/PWGCF/CFFilterPPPhi.cxx b/EventFiltering/PWGCF/CFFilterPPPhi.cxx deleted file mode 100644 index 623b5cb9086..00000000000 --- a/EventFiltering/PWGCF/CFFilterPPPhi.cxx +++ /dev/null @@ -1,543 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file CFFilterAll.cxx -/// \brief Selection of events with triplets and pairs for femtoscopic studies -/// -/// \author Anton Riedel, TU München, anton.riedel@cern.ch - -#include -#include -#include -#include -#include -#include - -#include "../filterTables.h" - -#include "Framework/Configurable.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" -#include "fairlogger/Logger.h" -#include "CommonConstants/MathConstants.h" -#include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/PIDResponse.h" -#include "DataFormatsTPC/BetheBlochAleph.h" - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; - -namespace o2::aod -{ -using FemtoFullCollision = - soa::Join::iterator; - -using FemtoFullTracks = - soa::Join; -} // namespace o2::aod - -struct CFFillterPPPhi { - - // Table for storing filter decisions - // Leave commented for now - /*Produces tags;*/ - - /*event selection*/ - Configurable ConfEvtSelectZvtx{ - "ConfEvtSelectZvtx", - true, - "Event selection includes max. z-Vertex"}; - - Configurable ConfEvtZvtx{"ConfEvtZvtx", 10.f, "Evt sel: Max. z-Vertex (cm)"}; - - Configurable ConfEvtOfflineCheck{ - "ConfEvtOfflineCheck", - false, - "Evt sel: check for offline selection"}; - - Configurable ConfResoInvMassLowLimit{"ConfResoInvMassLowLimit", 1.011461, "Lower limit of the Reso invariant mass"}; - Configurable ConfResoInvMassUpLimit{"ConfResoInvMassUpLimit", 1.027461, "Upper limit of the Reso invariant mass"}; - - Configurable Q3Max{"Q3Max", 1.f, "Max Q3"}; - - /*track selection*/ - - Configurable ConfTrkEtaPr{"ConfTrkEtaPr", 0.85, "Et protona"}; // 0.8 - Configurable ConfTrkDCAxyPr{"ConfTrkDCAxyPr", 0.15, "DCAxy proton"}; // 0.1 - Configurable ConfTrkDCAzPr{"ConfTrkDCAzPr", 0.3, "DCAz proton"}; // 0.2 - Configurable ConfNClusPr{"ConfNClusPr", 70, "NClusters proton"}; // 0.2 - Configurable ConfNCrossedPr{"ConfNCrossedPr", 65, "NCrossedRows proton"}; // 0.2 - Configurable ConfTrkTPCfClsPr{"ConfTrkTPCfClsPr", 0.83, "Minimum fraction of crossed rows over findable clusters proton"}; // 0.2 - - Configurable ConfTrkPtPrUp{"ConfTrkPtPrUp", 6.0, "Pt_up proton"}; // 2.0 - Configurable ConfTrkPtPrDown{"ConfTrkPtPrDown", 0.35, "Pt_down proton"}; // 0.5 - Configurable ConfTrkPTPCPrThr{"ConfTrkPTPCPrThr", 0.8, "p_TPC,Thr proton"}; // 0.75 - Configurable ConfTrkPrSigmaPID{"ConfTrkPrSigmaPID", 3.50, "n_sigma proton"}; // 3.0 - - Configurable ConfTrkEtaKa{"ConfTrkEtaKa", 0.85, "Eta kaon"}; // 0.8 - Configurable ConfTrkDCAxyKa{"ConfTrkDCAxyKa", 0.15, "DCAxy kaon"}; // 0.1 - Configurable ConfTrkDCAzKa{"ConfTrkDCAzKa", 0.3, "DCAz kaon"}; // 0.2 - Configurable ConfNClusKa{"ConfNClusKa", 70, "NClusters kaon"}; // 0.2 - Configurable ConfNCrossedKa{"ConfNCrossedKa", 65, "NCrossedRows kaon"}; // 0.2 - Configurable ConfTrkTPCfClsKa{"ConfTrkTPCfClsKa", 0.80, "Minimum fraction of crossed rows over findable clusters kaon"}; // 0.2 - - Configurable ConfTrkPtKaUp{"ConfTrkPtKaUp", 6.0, "Pt_up kaon"}; // 2.0 - Configurable ConfTrkPtKaDown{"ConfTrkPtKaDown", 0.05, "Pt_down kaon"}; // 0.15 - Configurable ConfTrkPTPCKaThr{"ConfTrkPTPCKaThr", 0.40, "p_TPC,Thr kaon"}; // 0.4 - Configurable ConfTrkKaSigmaPID{"ConfTrkKaSigmaPID", 3.50, "n_sigma kaon"}; // 3.0 - - HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; - - void init(o2::framework::InitContext&) - { - - // histograms - registry.add("fProcessedEvents", "CF - event filtered;;Events", HistType::kTH1F, {{3, -0.5, 2.5}}); - std::vector eventTitles = {"all", "rejected", "ppphi"}; - for (size_t iBin = 0; iBin < eventTitles.size(); iBin++) { - registry.get(HIST("fProcessedEvents"))->GetXaxis()->SetBinLabel(iBin + 1, eventTitles[iBin].data()); - } - - // event cuts - registry.add("EventCuts/fMultiplicityBefore", "Multiplicity of all processed events;Mult;Entries", HistType::kTH1F, {{1000, 0, 1000}}); - registry.add("EventCuts/fMultiplicityAfter", "Multiplicity after event cuts;Mult;Entries", HistType::kTH1F, {{1000, 0, 1000}}); - registry.add("EventCuts/fZvtxBefore", "Zvtx of all processed events;Z_{vtx};Entries", HistType::kTH1F, {{1000, -15, 15}}); - registry.add("EventCuts/fZvtxAfter", "Zvtx after event cuts;Z_{vtx};Entries", HistType::kTH1F, {{1000, -15, 15}}); - - registry.add("TrackCuts/fPtBefore", "Transverse momentum of all processed tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("TrackCuts/fEtaBefore", "Pseudorapidity of all processed tracks;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); - registry.add("TrackCuts/fPhiBefore", "Azimuthal angle of all processed tracks;#phi;Entries", HistType::kTH1F, {{720, 0, TMath::TwoPi()}}); - - // proton cuts - registry.add("TrackCuts/Proton/fPProton", "Momentum of protons at PV;p (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("TrackCuts/Proton/fPTPCProton", "Momentum of protons at PV;p (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("TrackCuts/Proton/fPtProton", "Transverse momentum of all processed tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("TrackCuts/Proton/fMomCorProtonDif", "Momentum correlation;p_{reco} (GeV/c); (p_{TPC} - p_{reco}) (GeV/c)", {HistType::kTH2F, {{500, 0, 10}, {600, -3, 3}}}); - registry.add("TrackCuts/Proton/fMomCorProtonRatio", "Momentum correlation;p_{reco} (GeV/c); p_{TPC} - p_{reco} / p_{reco}", {HistType::kTH2F, {{500, 0, 10}, {200, -1, 1}}}); - registry.add("TrackCuts/Proton/fEtaProton", "Pseudorapidity of all processed tracks;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); - registry.add("TrackCuts/Proton/fPhiProton", "Azimuthal angle of all processed tracks;#phi;Entries", HistType::kTH1F, {{720, 0, TMath::TwoPi()}}); - registry.add("TrackCuts/Proton/fDCAxyProton", "fDCAxy Proton;DCA_{XY};Entries", HistType::kTH1F, {{500, -0.5f, 0.5f}}); - registry.add("TrackCuts/Proton/fDCAzProton", "fDCAz Proton;DCA_{Z};Entries", HistType::kTH1F, {{500, -0.5f, 0.5f}}); - registry.add("TrackCuts/Proton/fNsigmaTPCvsPProton", "NSigmaTPC Proton;p_{TPC} (GeV/c);n#sigma_{TPC}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/Proton/fNsigmaTOFvsPProton", "NSigmaTOF Proton;p_{TPC} (GeV/c);n#sigma_{TOF}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/Proton/fNsigmaTPCTOFvsPProton", "NSigmaTPCTOF Proton;p_{TPC} (GeV/c);n#sigma_{comb}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, 0.f, 10.f}}}); - - registry.add("TrackCuts/Proton/fTPCsClsProton", "fTPCsCls Proton;TPC Shared Clusters;Entries", HistType::kTH1F, {{163, -1.0f, 162.0f}}); - registry.add("TrackCuts/Proton/fTPCcRowsProton", "fTPCcRows Proton;TPC Crossed Rows;Entries", HistType::kTH1F, {{163, -1.0f, 162.0f}}); - registry.add("TrackCuts/Proton/fTrkTPCfClsProton", "fTrkTPCfCls Proton;TPC Findable/CrossedRows;Entries", HistType::kTH1F, {{500, 0.0f, 3.0f}}); - registry.add("TrackCuts/Proton/fTPCnclsProton", "fTPCncls Proton;TPC Clusters;Entries", HistType::kTH1F, {{163, -1.0f, 162.0f}}); - - registry.add("TrackCuts/AntiProton/fPAntiProton", "Momentum of antiprotons at PV;p (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("TrackCuts/AntiProton/fPTPCAntiProton", "Momentum of protons at PV;p (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("TrackCuts/AntiProton/fPtAntiProton", "Transverse momentum of all processed tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("TrackCuts/AntiProton/fMomCorAntiProtonDif", "Momentum correlation;p_{reco} (GeV/c); (p_{TPC} - p_{reco}) (GeV/c)", {HistType::kTH2F, {{500, 0, 10}, {600, -3, 3}}}); - registry.add("TrackCuts/AntiProton/fMomCorAntiProtonRatio", "Momentum correlation;p_{reco} (GeV/c); p_{TPC} - p_{reco} / p_{reco}", {HistType::kTH2F, {{500, 0, 10}, {200, -1, 1}}}); - registry.add("TrackCuts/AntiProton/fEtaAntiProton", "Pseudorapidity of all processed tracks;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); - registry.add("TrackCuts/AntiProton/fPhiAntiProton", "Azimuthal angle of all processed tracks;#phi;Entries", HistType::kTH1F, {{720, 0, TMath::TwoPi()}}); - registry.add("TrackCuts/AntiProton/fDCAxyAntiProton", "fDCAxy AntiProton;DCA_{XY};Entries", HistType::kTH1F, {{500, -0.5f, 0.5f}}); - registry.add("TrackCuts/AntiProton/fDCAzAntiProton", "fDCAz AntiProton;DCA_{Z};Entries", HistType::kTH1F, {{500, -0.5f, 0.5f}}); - registry.add("TrackCuts/AntiProton/fNsigmaTPCvsPAntiProton", "NSigmaTPC AntiProton;p_{TPC} (GeV/c);n#sigma_{TPC}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/AntiProton/fNsigmaTOFvsPAntiProton", "NSigmaTOF AntiProton;p_{TPC} (GeV/c);n#sigma_{TOF}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/AntiProton/fNsigmaTPCTOFvsPAntiProton", "NSigmaTPCTOF AntiProton;p_{TPC} (GeV/c);n#sigma_{comb}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, 0.f, 10.f}}}); - - registry.add("TrackCuts/AntiProton/fTPCsClsAntiProton", "fTPCsCls AntiProton;TPC Shared Clusters;Entries", HistType::kTH1F, {{163, -1.0f, 162.0f}}); - registry.add("TrackCuts/AntiProton/fTPCcRowsAntiProton", "fTPCcRows AntiProton;TPC Crossed Rows;Entries", HistType::kTH1F, {{163, -1.0f, 162.0f}}); - registry.add("TrackCuts/AntiProton/fTrkTPCfClsAntiProton", "fTrkTPCfCls AntiProton;TPC Findable/CrossedRows;Entries", HistType::kTH1F, {{500, 0.0f, 3.0f}}); - registry.add("TrackCuts/AntiProton/fTPCnclsAntiProton", "fTPCncls AntiProton;TPC Clusters;Entries", HistType::kTH1F, {{163, -1.0f, 162.0f}}); - - // kaon cuts - registry.add("TrackCuts/Kaon/fPKaon", "Momentum of kaons at PV;p (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("TrackCuts/Kaon/fPTPCKaon", "Momentum of protons at PV;p (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("TrackCuts/Kaon/fPtKaon", "Transverse momentum of all processed tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("TrackCuts/Kaon/fMomCorKaonDif", "Momentum correlation;p_{reco} (GeV/c); (p_{TPC} - p_{reco}) (GeV/c)", {HistType::kTH2F, {{500, 0, 10}, {600, -3, 3}}}); - registry.add("TrackCuts/Kaon/fMomCorKaonRatio", "Momentum correlation;p_{reco} (GeV/c); p_{TPC} - p_{reco} / p_{reco}", {HistType::kTH2F, {{500, 0, 10}, {200, -1, 1}}}); - registry.add("TrackCuts/Kaon/fEtaKaon", "Pseudorapidity of all processed tracks;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); - registry.add("TrackCuts/Kaon/fPhiKaon", "Azimuthal angle of all processed tracks;#phi;Entries", HistType::kTH1F, {{720, 0, TMath::TwoPi()}}); - registry.add("TrackCuts/Kaon/fDCAxyKaon", "fDCAxy Kaon;DCA_{XY};Entries", HistType::kTH1F, {{500, -0.5f, 0.5f}}); - registry.add("TrackCuts/Kaon/fDCAzKaon", "fDCAz Kaon;DCA_{Z};Entries", HistType::kTH1F, {{500, -0.5f, 0.5f}}); - registry.add("TrackCuts/Kaon/fNsigmaTPCvsPKaon", "NSigmaTPC Kaon;p_{TPC} (GeV/c);n#sigma_{TPC}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/Kaon/fNsigmaTOFvsPKaon", "NSigmaTOF Kaon;p_{TPC} (GeV/c);n#sigma_{TOF}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/Kaon/fNsigmaTPCTOFvsPKaon", "NSigmaTPCTOF Kaon;p_{TPC} (GeV/c);n#sigma_{comb}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, 0.f, 10.f}}}); - - registry.add("TrackCuts/Kaon/fTPCsClsKaon", "fTPCsCls Kaon;TPC Shared Clusters;Entries", HistType::kTH1F, {{163, -1.0f, 162.0f}}); - registry.add("TrackCuts/Kaon/fTPCcRowsKaon", "fTPCcRows Kaon;TPC Crossed Rows;Entries", HistType::kTH1F, {{163, -1.0f, 162.0f}}); - registry.add("TrackCuts/Kaon/fTrkTPCfClsKaon", "fTrkTPCfCls Kaon;TPC Findable/CrossedRows;Entries", HistType::kTH1F, {{500, 0.0f, 3.0f}}); - registry.add("TrackCuts/Kaon/fTPCnclsKaon", "fTPCncls Kaon;TPC Clusters;Entries", HistType::kTH1F, {{163, -1.0f, 162.0f}}); - - registry.add("TrackCuts/AntiKaon/fPAntiKaon", "Momentum of antikaons at PV;p (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("TrackCuts/AntiKaon/fPTPCAntiKaon", "Momentum of protons at PV;p (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("TrackCuts/AntiKaon/fPtAntiKaon", "Transverse momentum of all processed tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("TrackCuts/AntiKaon/fMomCorAntiKaonDif", "Momentum correlation;p_{reco} (GeV/c); (p_{TPC} - p_{reco}) (GeV/c)", {HistType::kTH2F, {{500, 0, 10}, {600, -3, 3}}}); - registry.add("TrackCuts/AntiKaon/fMomCorAntiKaonRatio", "Momentum correlation;p_{reco} (GeV/c); p_{TPC} - p_{reco} / p_{reco}", {HistType::kTH2F, {{500, 0, 10}, {200, -1, 1}}}); - registry.add("TrackCuts/AntiKaon/fEtaAntiKaon", "Pseudorapidity of all processed tracks;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); - registry.add("TrackCuts/AntiKaon/fPhiAntiKaon", "Azimuthal angle of all processed tracks;#phi;Entries", HistType::kTH1F, {{720, 0, TMath::TwoPi()}}); - registry.add("TrackCuts/AntiKaon/fDCAxyAntiKaon", "fDCAxy AntiKaon;DCA_{XY};Entries", HistType::kTH1F, {{500, -0.5f, 0.5f}}); - registry.add("TrackCuts/AntiKaon/fDCAzAntiKaon", "fDCAz AntiKaon;DCA_{Z};Entries", HistType::kTH1F, {{500, -0.5f, 0.5f}}); - registry.add("TrackCuts/AntiKaon/fNsigmaTPCvsPAntiKaon", "NSigmaTPC AntiKaon;p_{TPC} (GeV/c);n#sigma_{TPC}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/AntiKaon/fNsigmaTOFvsPAntiKaon", "NSigmaTOF AntiKaon;p_{TPC} (GeV/c);n#sigma_{TOF}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/AntiKaon/fNsigmaTPCTOFvsPAntiKaon", "NSigmaTPCTOF AntiKaon;p_{TPC} (GeV/c);n#sigma_{comb}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, 0.f, 10.f}}}); - - registry.add("TrackCuts/AntiKaon/fTPCsClsAntiKaon", "fTPCsCls AntiKaon;TPC Shared Clusters;Entries", HistType::kTH1F, {{163, -1.0f, 162.0f}}); - registry.add("TrackCuts/AntiKaon/fTPCcRowsAntiKaon", "fTPCcRows AntiKaon;TPC Crossed Rows;Entries", HistType::kTH1F, {{163, -1.0f, 162.0f}}); - registry.add("TrackCuts/AntiKaon/fTrkTPCfClsAntiKaon", "fTrkTPCfCls AntiKaon;TPC Findable/CrossedRows;Entries", HistType::kTH1F, {{500, 0.0f, 3.0f}}); - registry.add("TrackCuts/AntiKaon/fTPCnclsAntiKaon", "fTPCncls AntiKaon;TPC Clusters;Entries", HistType::kTH1F, {{163, -1.0f, 162.0f}}); - - // phi cuts - registry.add("TrackCuts/Phi/fPtPhiBefore", "Transverse momentum V0s;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("TrackCuts/Phi/fInvMassPhiBefore", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.8, 1.5}}); - - registry.add("TrackCuts/Phi/fEtaPhiBefore", "Pseudorapidity of V0;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); - registry.add("TrackCuts/Phi/fPhiPhiBefore", "Azimuthal angle of V0;#phi;Entries", HistType::kTH1F, {{720, 0, TMath::TwoPi()}}); - - registry.add("TrackCuts/Phi/fPtPhi", "Transverse momentum V0s;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("TrackCuts/Phi/fInvMassPhi", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.8, 1.5}}); - registry.add("TrackCuts/Phi/fEtaPhi", "Pseudorapidity of V0;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); - registry.add("TrackCuts/Phi/fPhiPhi", "Azimuthal angle of V0;#phi;Entries", HistType::kTH1F, {{720, 0, TMath::TwoPi()}}); - - // phi daughter - registry.add("TrackCuts/Phi/PosDaughter/Pt", "Transverse momentum Pos Daugh tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("TrackCuts/Phi/PosDaughter/Eta", "Phi Pos Daugh Eta;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); - registry.add("TrackCuts/Phi/PosDaughter/Phi", "Azimuthal angle of Pos Daugh tracks;#phi;Entries", HistType::kTH1F, {{720, 0, TMath::TwoPi()}}); - - registry.add("TrackCuts/Phi/NegDaughter/Pt", "Transverse momentum Neg Daugh tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("TrackCuts/Phi/NegDaughter/Eta", "Phi Neg Daugh Eta;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); - registry.add("TrackCuts/Phi/NegDaughter/Phi", "Azimuthal angle of Neg Daugh tracks;#phi;Entries", HistType::kTH1F, {{720, 0, TMath::TwoPi()}}); - - // triggers - registry.add("ppphi/fMultiplicity", "Multiplicity of all triggered events;Mult;Entries", HistType::kTH1F, {{1000, 0, 1000}}); - registry.add("ppphi/fZvtx", "Zvtx of all triggered events;Z_{vtx};Entries", HistType::kTH1F, {{1000, -15, 15}}); - registry.add("ppphi/fSE_particle", "Same Event distribution;SE;Q_{3} (GeV/c)", HistType::kTH1F, {{8000, 0, 8}}); - registry.add("ppphi/fSE_antiparticle", "Same Event distribution;SE;Q_{3} (GeV/c)", HistType::kTH1F, {{8000, 0, 8}}); - registry.add("ppphi/fProtonPtVsQ3", "Same Event distribution;SE;Q_{3} (GeV/c)", HistType::kTH1F, {{8000, 0, 8}}); - registry.add("ppphi/fPhiPtVsQ3", "Same Event distribution;SE;Q_{3} (GeV/c)", HistType::kTH1F, {{8000, 0, 8}}); - registry.add("ppphi/fAntiProtonPtVsQ3", "Same Event distribution;SE;Q_{3} (GeV/c)", HistType::kTH1F, {{8000, 0, 8}}); - registry.add("ppphi/fAntiPhiPtVsQ3", "Same Event distribution;SE;Q_{3} (GeV/c)", HistType::kTH1F, {{8000, 0, 8}}); - } - - template - bool isSelectedEvent(T const& col) - { - if (ConfEvtSelectZvtx && std::abs(col.posZ()) > ConfEvtZvtx) { - return false; - } - if (ConfEvtOfflineCheck && !col.sel8()) { - return false; - } - return true; - } - - template - bool isSelectedTrackProton(T const& track) - { - bool isSelected = false; - if (track.pt() <= ConfTrkPtPrUp.value && track.pt() >= ConfTrkPtPrDown.value && std::abs(track.eta()) <= ConfTrkEtaPr.value && std::abs(track.dcaXY()) <= ConfTrkDCAxyPr.value && std::abs(track.dcaZ()) <= ConfTrkDCAzPr.value && track.tpcNClsCrossedRows() >= ConfNCrossedPr.value && track.tpcNClsFound() >= ConfNClusPr.value && track.tpcCrossedRowsOverFindableCls() >= ConfTrkTPCfClsPr.value) { - if (track.tpcInnerParam() < ConfTrkPTPCPrThr.value && std::abs(track.tpcNSigmaPr()) <= ConfTrkPrSigmaPID.value) { - isSelected = true; - } - if (track.tpcInnerParam() >= ConfTrkPTPCPrThr.value && std::abs(std::sqrt(track.tpcNSigmaPr() * track.tpcNSigmaPr() + track.tofNSigmaPr() * track.tofNSigmaPr())) <= ConfTrkPrSigmaPID.value) { - isSelected = true; - } - } - return isSelected; - } - - template - bool isSelectedTrackKaon(T const& track) - { - bool isSelected = false; - if (track.pt() <= ConfTrkPtKaUp.value && track.pt() >= ConfTrkPtKaDown.value && std::abs(track.eta()) <= ConfTrkEtaKa.value && std::abs(track.dcaXY()) <= ConfTrkDCAxyKa.value && std::abs(track.dcaZ()) <= ConfTrkDCAzKa.value && track.tpcNClsCrossedRows() >= ConfNCrossedKa.value && track.tpcNClsFound() >= ConfNClusKa.value && track.tpcCrossedRowsOverFindableCls() >= ConfTrkTPCfClsKa.value) { - if (track.tpcInnerParam() < ConfTrkPTPCKaThr.value && std::abs(track.tpcNSigmaKa()) <= ConfTrkKaSigmaPID.value) { - isSelected = true; - } - if (track.tpcInnerParam() >= ConfTrkPTPCKaThr.value && std::abs(std::sqrt(track.tpcNSigmaKa() * track.tpcNSigmaKa() + track.tofNSigmaKa() * track.tofNSigmaKa())) <= ConfTrkKaSigmaPID.value) { - isSelected = true; - } - } - return isSelected; - } - - float mMassProton = o2::constants::physics::MassProton; - float mMassKaonPlus = o2::constants::physics::MassKPlus; - float mMassKaonMinus = o2::constants::physics::MassKMinus; - - float mMassPhi = o2::constants::physics::MassPhi; - - float getkstar(const ROOT::Math::PtEtaPhiMVector part1, - const ROOT::Math::PtEtaPhiMVector part2) - { - const ROOT::Math::PtEtaPhiMVector trackSum = part1 + part2; - const float beta = trackSum.Beta(); - const float betax = - beta * std::cos(trackSum.Phi()) * std::sin(trackSum.Theta()); - const float betay = - beta * std::sin(trackSum.Phi()) * std::sin(trackSum.Theta()); - const float betaz = beta * std::cos(trackSum.Theta()); - ROOT::Math::PxPyPzMVector PartOneCMS(part1); - ROOT::Math::PxPyPzMVector PartTwoCMS(part2); - const ROOT::Math::Boost boostPRF = - ROOT::Math::Boost(-betax, -betay, -betaz); - PartOneCMS = boostPRF(PartOneCMS); - PartTwoCMS = boostPRF(PartTwoCMS); - const ROOT::Math::PxPyPzMVector trackRelK = PartOneCMS - PartTwoCMS; - return 0.5 * trackRelK.P(); - } - - ROOT::Math::PxPyPzEVector getqij(const ROOT::Math::PtEtaPhiMVector parti, - const ROOT::Math::PtEtaPhiMVector partj) - { - ROOT::Math::PxPyPzEVector vecparti(parti); - ROOT::Math::PxPyPzEVector vecpartj(partj); - ROOT::Math::PxPyPzEVector trackSum = vecparti + vecpartj; - ROOT::Math::PxPyPzEVector trackDifference = vecparti - vecpartj; - float scaling = trackDifference.Dot(trackSum) / trackSum.Dot(trackSum); - return trackDifference - scaling * trackSum; - } - float getQ3(const ROOT::Math::PtEtaPhiMVector part1, - const ROOT::Math::PtEtaPhiMVector part2, - const ROOT::Math::PtEtaPhiMVector part3) - { - ROOT::Math::PxPyPzEVector q12 = getqij(part1, part2); - ROOT::Math::PxPyPzEVector q23 = getqij(part2, part3); - ROOT::Math::PxPyPzEVector q31 = getqij(part3, part1); - float Q32 = q12.M2() + q23.M2() + q31.M2(); - return sqrt(-Q32); - } - - void process(aod::FemtoFullCollision const& col, aod::BCsWithTimestamps const&, aod::FemtoFullTracks const& tracks) - { - registry.fill(HIST("fProcessedEvents"), 0); - registry.fill(HIST("EventCuts/fMultiplicityBefore"), col.multNTracksPV()); - registry.fill(HIST("EventCuts/fZvtxBefore"), col.posZ()); - - int lowQ3Triplets = 0; - - if (isSelectedEvent(col)) { - - registry.fill(HIST("EventCuts/fMultiplicityAfter"), col.multNTracksPV()); - registry.fill(HIST("EventCuts/fZvtxAfter"), col.posZ()); - - std::vector protons, antiprotons, kaons, antikaons, phi; - - // keep track of proton indices - std::vector ProtonIndex = {}; - std::vector AntiProtonIndex = {}; - std::vector KaonIndex = {}; - std::vector AntiKaonIndex = {}; - - for (auto& track : tracks) { - registry.fill(HIST("TrackCuts/fPtBefore"), track.pt()); - registry.fill(HIST("TrackCuts/fEtaBefore"), track.eta()); - registry.fill(HIST("TrackCuts/fPhiBefore"), track.phi()); - - if (isSelectedTrackProton(track)) { - ROOT::Math::PtEtaPhiMVector temp(track.pt(), track.eta(), track.phi(), mMassProton); - if (track.sign() > 0) { - protons.push_back(temp); - - registry.fill(HIST("TrackCuts/Proton/fPProton"), track.p()); - registry.fill(HIST("TrackCuts/Proton/fPTPCProton"), track.tpcInnerParam()); - registry.fill(HIST("TrackCuts/Proton/fPtProton"), track.pt()); - registry.fill(HIST("TrackCuts/Proton/fMomCorProtonDif"), track.p(), track.tpcInnerParam() - track.p()); - registry.fill(HIST("TrackCuts/Proton/fMomCorProtonRatio"), track.p(), (track.tpcInnerParam() - track.p()) / track.p()); - registry.fill(HIST("TrackCuts/Proton/fEtaProton"), track.eta()); - registry.fill(HIST("TrackCuts/Proton/fPhiProton"), track.phi()); - registry.fill(HIST("TrackCuts/Proton/fNsigmaTPCvsPProton"), track.tpcInnerParam(), track.tpcNSigmaPr()); - registry.fill(HIST("TrackCuts/Proton/fNsigmaTOFvsPProton"), track.tpcInnerParam(), track.tofNSigmaPr()); - registry.fill(HIST("TrackCuts/Proton/fNsigmaTPCTOFvsPProton"), track.tpcInnerParam(), std::abs(std::sqrt(track.tpcNSigmaPr() * track.tpcNSigmaPr() + track.tofNSigmaPr() * track.tofNSigmaPr()))); - - registry.fill(HIST("TrackCuts/Proton/fDCAxyProton"), track.dcaXY()); - registry.fill(HIST("TrackCuts/Proton/fDCAzProton"), track.dcaZ()); - registry.fill(HIST("TrackCuts/Proton/fTPCsClsProton"), track.tpcNClsShared()); - registry.fill(HIST("TrackCuts/Proton/fTPCcRowsProton"), track.tpcNClsCrossedRows()); - registry.fill(HIST("TrackCuts/Proton/fTrkTPCfClsProton"), track.tpcCrossedRowsOverFindableCls()); - registry.fill(HIST("TrackCuts/Proton/fTPCnclsProton"), track.tpcNClsFound()); - // ProtonIndex.push_back(track.globalIndex()); - } - if (track.sign() < 0) { - antiprotons.push_back(temp); - - registry.fill(HIST("TrackCuts/AntiProton/fPAntiProton"), track.p()); - registry.fill(HIST("TrackCuts/AntiProton/fPTPCAntiProton"), track.tpcInnerParam()); - registry.fill(HIST("TrackCuts/AntiProton/fPtAntiProton"), track.pt()); - registry.fill(HIST("TrackCuts/AntiProton/fMomCorAntiProtonDif"), track.p(), track.tpcInnerParam() - track.p()); - registry.fill(HIST("TrackCuts/AntiProton/fMomCorAntiProtonRatio"), track.p(), (track.tpcInnerParam() - track.p()) / track.p()); - registry.fill(HIST("TrackCuts/AntiProton/fEtaAntiProton"), track.eta()); - registry.fill(HIST("TrackCuts/AntiProton/fPhiAntiProton"), track.phi()); - registry.fill(HIST("TrackCuts/AntiProton/fNsigmaTPCvsPAntiProton"), track.tpcInnerParam(), track.tpcNSigmaPr()); - registry.fill(HIST("TrackCuts/AntiProton/fNsigmaTOFvsPAntiProton"), track.tpcInnerParam(), track.tofNSigmaPr()); - registry.fill(HIST("TrackCuts/AntiProton/fNsigmaTPCTOFvsPAntiProton"), track.tpcInnerParam(), std::abs(std::sqrt(track.tpcNSigmaPr() * track.tpcNSigmaPr() + track.tofNSigmaPr() * track.tofNSigmaPr()))); - - registry.fill(HIST("TrackCuts/AntiProton/fDCAxyAntiProton"), track.dcaXY()); - registry.fill(HIST("TrackCuts/AntiProton/fDCAzAntiProton"), track.dcaZ()); - registry.fill(HIST("TrackCuts/AntiProton/fTPCsClsAntiProton"), track.tpcNClsShared()); - registry.fill(HIST("TrackCuts/AntiProton/fTPCcRowsAntiProton"), track.tpcNClsCrossedRows()); - registry.fill(HIST("TrackCuts/AntiProton/fTrkTPCfClsAntiProton"), track.tpcCrossedRowsOverFindableCls()); - registry.fill(HIST("TrackCuts/AntiProton/fTPCnclsAntiProton"), track.tpcNClsFound()); - // AntiProtonIndex.push_back(track.globalIndex()); - } - } - - if (isSelectedTrackKaon(track)) { - ROOT::Math::PtEtaPhiMVector temp(track.pt(), track.eta(), track.phi(), mMassKaonPlus); - if (track.sign() > 0) { - temp.SetM(mMassKaonPlus); - kaons.push_back(temp); - registry.fill(HIST("TrackCuts/Kaon/fPKaon"), track.p()); - registry.fill(HIST("TrackCuts/Kaon/fPTPCKaon"), track.tpcInnerParam()); - registry.fill(HIST("TrackCuts/Kaon/fPtKaon"), track.pt()); - registry.fill(HIST("TrackCuts/Kaon/fMomCorKaonDif"), track.p(), track.tpcInnerParam() - track.p()); - registry.fill(HIST("TrackCuts/Kaon/fMomCorKaonRatio"), track.p(), (track.tpcInnerParam() - track.p()) / track.p()); - registry.fill(HIST("TrackCuts/Kaon/fEtaKaon"), track.eta()); - registry.fill(HIST("TrackCuts/Kaon/fPhiKaon"), track.phi()); - registry.fill(HIST("TrackCuts/Kaon/fNsigmaTPCvsPKaon"), track.tpcInnerParam(), track.tpcNSigmaKa()); - registry.fill(HIST("TrackCuts/Kaon/fNsigmaTOFvsPKaon"), track.tpcInnerParam(), track.tofNSigmaKa()); - registry.fill(HIST("TrackCuts/Kaon/fNsigmaTPCTOFvsPKaon"), track.tpcInnerParam(), std::abs(std::sqrt(track.tpcNSigmaKa() * track.tpcNSigmaKa() + track.tofNSigmaKa() * track.tofNSigmaKa()))); - - registry.fill(HIST("TrackCuts/Kaon/fDCAxyKaon"), track.dcaXY()); - registry.fill(HIST("TrackCuts/Kaon/fDCAzKaon"), track.dcaZ()); - - registry.fill(HIST("TrackCuts/Kaon/fTPCsClsKaon"), track.tpcNClsShared()); - registry.fill(HIST("TrackCuts/Kaon/fTPCcRowsKaon"), track.tpcNClsCrossedRows()); - registry.fill(HIST("TrackCuts/Kaon/fTrkTPCfClsKaon"), track.tpcCrossedRowsOverFindableCls()); - registry.fill(HIST("TrackCuts/Kaon/fTPCnclsKaon"), track.tpcNClsFound()); - // KaonIndex.push_back(track.globalIndex()); - } - if (track.sign() < 0) { - temp.SetM(mMassKaonMinus); - - antikaons.push_back(temp); - registry.fill(HIST("TrackCuts/AntiKaon/fPAntiKaon"), track.p()); - registry.fill(HIST("TrackCuts/AntiKaon/fPTPCAntiKaon"), track.tpcInnerParam()); - registry.fill(HIST("TrackCuts/AntiKaon/fPtAntiKaon"), track.pt()); - registry.fill(HIST("TrackCuts/AntiKaon/fMomCorAntiKaonDif"), track.p(), track.tpcInnerParam() - track.p()); - registry.fill(HIST("TrackCuts/AntiKaon/fMomCorAntiKaonRatio"), track.p(), (track.tpcInnerParam() - track.p()) / track.p()); - registry.fill(HIST("TrackCuts/AntiKaon/fEtaAntiKaon"), track.eta()); - registry.fill(HIST("TrackCuts/AntiKaon/fPhiAntiKaon"), track.phi()); - registry.fill(HIST("TrackCuts/AntiKaon/fNsigmaTPCvsPAntiKaon"), track.tpcInnerParam(), track.tpcNSigmaKa()); - registry.fill(HIST("TrackCuts/AntiKaon/fNsigmaTOFvsPAntiKaon"), track.tpcInnerParam(), track.tofNSigmaKa()); - registry.fill(HIST("TrackCuts/AntiKaon/fNsigmaTPCTOFvsPAntiKaon"), track.tpcInnerParam(), std::abs(std::sqrt(track.tpcNSigmaKa() * track.tpcNSigmaKa() + track.tofNSigmaKa() * track.tofNSigmaKa()))); - - registry.fill(HIST("TrackCuts/AntiKaon/fDCAxyAntiKaon"), track.dcaXY()); - registry.fill(HIST("TrackCuts/AntiKaon/fDCAzAntiKaon"), track.dcaZ()); - registry.fill(HIST("TrackCuts/AntiKaon/fTPCsClsAntiKaon"), track.tpcNClsShared()); - registry.fill(HIST("TrackCuts/AntiKaon/fTPCcRowsAntiKaon"), track.tpcNClsCrossedRows()); - registry.fill(HIST("TrackCuts/AntiKaon/fTrkTPCfClsAntiKaon"), track.tpcCrossedRowsOverFindableCls()); - registry.fill(HIST("TrackCuts/AntiKaon/fTPCnclsAntiKaon"), track.tpcNClsFound()); - // AntiKaonIndex.push_back(track.globalIndex()); - } - } - - // end track - } - - for (const auto& postrack : kaons) { - for (const auto& negtrack : antikaons) { - - ROOT::Math::PtEtaPhiMVector temp = postrack + negtrack; - // temp.SetM(mMassPhi); - registry.fill(HIST("TrackCuts/Phi/fInvMassPhiBefore"), temp.M()); - - registry.fill(HIST("TrackCuts/Phi/fPtPhiBefore"), temp.pt()); - registry.fill(HIST("TrackCuts/Phi/fEtaPhiBefore"), temp.eta()); - registry.fill(HIST("TrackCuts/Phi/fPhiPhiBefore"), temp.phi()); - - if ((temp.M() >= ConfResoInvMassLowLimit.value) && (temp.M() <= ConfResoInvMassUpLimit.value)) { - // ROOT::Math::PtEtaPhiMVector temp = postrack + negtrack; - phi.push_back(temp); - - registry.fill(HIST("TrackCuts/Phi/fPtPhi"), temp.pt()); - registry.fill(HIST("TrackCuts/Phi/fEtaPhi"), temp.eta()); - registry.fill(HIST("TrackCuts/Phi/fPhiPhi"), temp.phi()); - registry.fill(HIST("TrackCuts/Phi/fInvMassPhi"), temp.M()); - - registry.fill(HIST("TrackCuts/Phi/PosDaughter/Pt"), postrack.pt()); - registry.fill(HIST("TrackCuts/Phi/PosDaughter/Eta"), postrack.eta()); - registry.fill(HIST("TrackCuts/Phi/PosDaughter/Phi"), postrack.phi()); - - registry.fill(HIST("TrackCuts/Phi/NegDaughter/Pt"), negtrack.pt()); - registry.fill(HIST("TrackCuts/Phi/NegDaughter/Eta"), negtrack.eta()); - registry.fill(HIST("TrackCuts/Phi/NegDaughter/Phi"), negtrack.phi()); - } - } - } - - // ppphi trigger - float Q3 = 999.f; - - for (auto iProton1 = protons.begin(); iProton1 != protons.end(); ++iProton1) { - auto iProton2 = iProton1 + 1; - // auto i1 = std::distance(protons.begin(), iProton1); - for (; iProton2 != protons.end(); ++iProton2) { - // auto i2 = std::distance(protons.begin(), iProton2); - for (auto iPhi1 = phi.begin(); iPhi1 != phi.end(); ++iPhi1) { - // auto i3 = std::distance(phi.begin(), iPhi1); - - Q3 = getQ3(*iProton1, *iProton2, *iPhi1); - registry.fill(HIST("ppphi/fSE_particle"), Q3); - registry.fill(HIST("ppphi/fProtonPtVsQ3"), Q3, (*iProton1).Pt()); - registry.fill(HIST("ppphi/fProtonPtVsQ3"), Q3, (*iProton2).Pt()); - registry.fill(HIST("ppphi/fPhiPtVsQ3"), Q3, (*iPhi1).Pt()); - if (Q3 < Q3Max.value) { - lowQ3Triplets += 1; - } - } - } - } - - // apapphi trigger - - for (auto iAntiProton1 = antiprotons.begin(); iAntiProton1 != antiprotons.end(); ++iAntiProton1) { - auto iAntiProton2 = iAntiProton1 + 1; - // auto i1 = std::distance(antiprotons.begin(), iAntiProton1); - for (; iAntiProton2 != antiprotons.end(); ++iAntiProton2) { - // auto i2 = std::distance(antiprotons.begin(), iAntiProton2); - for (auto iPhi1 = phi.begin(); iPhi1 != phi.end(); ++iPhi1) { - // auto i3 = std::distance(phi.begin(), iPhi1); - - Q3 = getQ3(*iAntiProton1, *iAntiProton2, *iPhi1); - registry.fill(HIST("ppphi/fSE_antiparticle"), Q3); - registry.fill(HIST("ppphi/fAntiProtonPtVsQ3"), Q3, (*iAntiProton1).Pt()); - registry.fill(HIST("ppphi/fAntiProtonPtVsQ3"), Q3, (*iAntiProton2).Pt()); - registry.fill(HIST("ppphi/fAntiPhiPtVsQ3"), Q3, (*iPhi1).Pt()); - if (Q3 < Q3Max.value) { - lowQ3Triplets += 1; - } - } - } - } - - // end event - } - - // create tags for three body triggers - if (lowQ3Triplets > 0) { - registry.fill(HIST("fProcessedEvents"), 2); - registry.fill(HIST("ppphi/fMultiplicity"), col.multNTracksPV()); - registry.fill(HIST("ppphi/fZvtx"), col.posZ()); - } else { - registry.fill(HIST("fProcessedEvents"), 1); - } - }; -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfg) -{ - return WorkflowSpec{adaptAnalysisTask(cfg)}; -} diff --git a/EventFiltering/PWGCF/CFFilterQA.cxx b/EventFiltering/PWGCF/CFFilterQA.cxx deleted file mode 100644 index fe084669b8a..00000000000 --- a/EventFiltering/PWGCF/CFFilterQA.cxx +++ /dev/null @@ -1,1726 +0,0 @@ -// Copyright 2019-2025 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 CFFilterAll.cxx -/// \brief Selection of events with triplets and pairs for femtoscopic studies -/// -/// \author Laura Serksnyte, TU München, laura.serksnyte@cern.ch; Anton Riedel, TU München, anton.riedel@cern.ch - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../filterTables.h" - -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" -#include "CommonConstants/MathConstants.h" -#include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/PIDResponse.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGCF/DataModel/FemtoDerived.h" -#include "DataFormatsTPC/BetheBlochAleph.h" -#include "CCDB/BasicCCDBManager.h" -#include "CCDB/CcdbApi.h" - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; - -namespace CFTrigger -{ -// enums -enum CFThreeBodyTriggers { kPPP, - kPPL, - kPLL, - kLLL, - kNThreeBodyTriggers }; -enum CFTwoBodyTriggers { kPP, - kPL, - kNTwoBodyTriggers -}; -enum ParticleSpecies { - kProton, - kDeuteron, - kLambda, - kNParticleSpecies -}; -enum V0Daughters { - kDaughPion, - kDaughProton, - kNV0Daughters -}; -enum ParticleRejection { kRejProton, - kRejPion, - kRejElectron, - kNParticleRejection -}; -enum PIDLimits { kTPCMin, - kTPCMax, - kTOFMin, - kTOFMax, - kTPCTOF, - kNPIDLimits -}; - -// For configurable tables -static const std::vector CFTriggerNamesALL{"ppp", "ppL", "pLL", "LLL", "pp", "pL"}; -static const std::vector SpeciesNameAll{"Proton", "Deuteron", "Lambda"}; -static const std::vector SpeciesName{"Proton", "Deuteron"}; -static const std::vector SpeciesNameAnti{"AntiProton", "AntiDeuteron"}; -static const std::vector SpeciesV0DaughterName{"Pion", "Proton"}; -static const std::vector SpeciesRejectionName{"Proton", "Pion", "Electron"}; -static const std::vector TPCCutName{"TPC min", "TPC max"}; -static const std::vector SpeciesMinTPCClustersName{"Proton", "Deuteron"}; -static const std::vector SpeciesAvgTPCTOFName{"Proton", "AntiProton", "Deuteron", "AntiDeuteron"}; -static const std::vector TPCTOFAvgName{"TPC Avg", "TOF Avg"}; -static const std::vector PidCutsName{"TPC min", "TPC max", "TOF min", "TOF max", "TPCTOF max"}; -static const std::vector PtCutsName{"Pt min", "Pt max", "P thres"}; -static const std::vector ThreeBodyFilterNames{"PPP", "PPL", "PLL", "LLL"}; -static const std::vector TwoBodyFilterNames{"pp", "pL"}; - -static const int nPidRejection = 2; -static const int nTracks = 2; -static const int nPidAvg = 4; -static const int nPidCutsDaughers = 2; -static const int nPtCuts = 3; -static const int nAllTriggers = 6; - -static const float pidcutsTable[nTracks][kNPIDLimits]{ - {-6.f, 6.f, -6.f, 6.f, 6.f}, - {-6.f, 6.f, -99.f, 99.f, 99.f}}; -static const float pidcutsTableAnti[nTracks][kNPIDLimits]{ - {-6.f, 6.f, -6.f, 6.f, 6.f}, - {-6.f, 6.f, -99.f, 99.f, 99.f}}; -static const float pidRejectionTable[kNParticleRejection][nPidRejection]{ - {-2.f, 2.f}, - {-2.f, 2.f}}; -static const float pidTPCTOFAvgTable[nPidAvg][nTracks]{ - {0.f, 0.f}, - {0.f, 0.f}, - {0.f, 0.f}, - {0.f, 0.f}}; -static const float pidcutsV0DaughterTable[kNV0Daughters][nPidCutsDaughers]{ - {-6.f, 6.f}, - {-6.f, 6.f}}; -static const float ptcutsTable[kNParticleRejection][nPtCuts]{ - {0.35f, 6.f, 0.75f}, - {0.35f, 1.6f, 99.f}, - {0.35f, 6.f, 99.f}}; -static const float NClustersMin[1][nTracks]{ - {60.0f, 60.0f}}; - -static const float triggerSwitches[1][kNThreeBodyTriggers]{ - {1, 1, 1, 1}}; - -static const float Q3Limits[1][kNThreeBodyTriggers]{ - {0.6f, 0.6f, 0.6f, 0.6f}}; -static const float KstarLimits[1][kNTwoBodyTriggers]{ - {1.2f, 1.2f}}; -} // namespace CFTrigger - -namespace o2::aod -{ -using FemtoFullCollision = - soa::Join::iterator; - -using FemtoFullTracks = - soa::Join; -} // namespace o2::aod - -struct CFFilterQA { - - Produces outputCollision; - Produces outputParts; - - Service ccdb; - o2::ccdb::CcdbApi ccdbApi; - - // Configs for events - Configurable ConfIsRun3{ - "ConfIsRun3", - true, - "Is Run3"}; - - Configurable ConfEvtSelectZvtx{ - "ConfEvtSelectZvtx", - true, - "Event selection includes max. z-Vertex"}; - Configurable ConfEvtZvtx{"ConfEvtZvtx", - 10.f, - "Evt sel: Max. z-Vertex (cm)"}; - Configurable ConfEvtOfflineCheck{ - "ConfEvtOfflineCheck", - false, - "Evt sel: check for offline selection"}; - Configurable ConfAutocorRejection{ - "ConfAutocorRejection", - true, - "Rejection autocorrelation pL pairs"}; - - Configurable ConfCutBitPart{ - "ConfCutBitPart", - 8190, - "Cutbit for particle (charge +1)"}; - Configurable ConfCutBitAntiPart{ - "ConfCutBitAntiPart", - 8189, - "Cutbit for antiparticle"}; - Configurable ConfCutBitV0{ - "ConfCutBitV0", - 8190, - "Cutbit for V0 "}; - Configurable ConfCutBitAntiV0{ - "ConfCutBitAntiV0", - 8190, - "Cutbit for Anti V0 "}; - Configurable ConfPidBitProton{ - "ConfPidBitProton", - 1, - "Pidbit for Proton"}; - Configurable ConfPidBitV0{ - "ConfPidBitV0", - 1, - "Pidbit for V0"}; - Configurable ConfKeepAllSelectedParticles{ - "ConfKeepAllSelectedParticles", - true, - "Switch to keep all particles, not only the ones in triggered events"}; - // Configs for tracks - Configurable ConfDeuteronThPVMom{ - "ConfDeuteronThPVMom", - false, - "True: use momentum at PV instead of TPCinnerparameter for threshold"}; - - Configurable ConfUseManualPIDproton{ - "ConfUseManualPIDproton", - false, - "True: use home-made PID solution for proton "}; - Configurable ConfPIDBBProton{ - "ConfPIDBBProton", - "Users/l/lserksny/PIDProton", - "Path to the CCDB ocject for proton BB param"}; - Configurable ConfPIDBBAntiProton{ - "ConfPIDBBAntiProton", - "Users/l/lserksny/PIDAntiProton", - "Path to the CCDB ocject for antiproton BB param"}; - - Configurable ConfUseManualPIDdeuteron{ - "ConfUseManualPIDdeuteron", - false, - "True: use home-made PID solution for deuteron "}; - Configurable ConfPIDBBDeuteron{ - "ConfPIDBBDeuteron", - "Users/l/lserksny/PIDDeuteron", - "Path to the CCDB ocject for Deuteron BB param"}; - Configurable ConfPIDBBAntiDeuteron{ - "ConfPIDBBAntiDeuteron", - "Users/l/lserksny/PIDAntiDeuteron", - "Path to the CCDB ocject for antiDeuteron BB param"}; - - Configurable ConfUseManualPIDpion{ - "ConfUseManualPIDpion", - false, - "True: use home-made PID solution for pions"}; - Configurable ConfPIDBBPion{ - "ConfPIDBBPion", - "Users/l/lserksny/PIDPion", - "Path to the CCDB ocject for Pion BB param"}; - Configurable ConfPIDBBAntiPion{ - "ConfPIDBBAntiPion", - "Users/l/lserksny/PIDAntiPion", - "Path to the CCDB ocject for antiPion BB param"}; - - Configurable ConfUseManualPIDel{ - "ConfUseManualPIDel", - false, - "True: use home-made PID solution for electron"}; - Configurable ConfPIDBBElectron{ - "ConfPIDBBElectron", - "Users/l/lserksny/PIDElectron", - "Path to the CCDB ocject for Electron BB param"}; - Configurable ConfPIDBBAntiElectron{ - "ConfPIDBBAntiElectron", - "Users/l/lserksny/PIDAntiElectron", - "Path to the CCDB ocject for antiElectron BB param"}; - - Configurable ConfUseManualPIDdaughterPion{ - "ConfUseManualPIDdaughterPion", - false, - "True: use home-made PID solution for pion from V0"}; - Configurable ConfUseManualPIDdaughterProton{ - "ConfUseManualPIDdaughterProton", - false, - "True: use home-made PID solution for proton from V0"}; - - Configurable ConfUseAvgFromCCDB{ - "ConfUseAvgFromCCDB", - false, - "True: use TOF and TPC averages from CCDB"}; - Configurable ConfAvgPath{ - "ConfAvgPath", - "Users/l/lserksny/TPCTOFAvg", - "Path to the CCDB ocject for TOF and TPC averages"}; - - Configurable ConfRejectNotPropagatedTracks{ - "ConfRejectNotPropagatedTracks", - false, - "True: reject not propagated tracks"}; - Configurable ConfTrkEta{ - "ConfTrkEta", - 0.85, - "Eta"}; - Configurable> ConfTPCNClustersMin{ - "ConfTPCNClustersMin", - {CFTrigger::NClustersMin[0], 1, CFTrigger::nTracks, std::vector{"TPCNClusMin"}, CFTrigger::SpeciesMinTPCClustersName}, - "kstar limit for two body trigger"}; - Configurable ConfTrkTPCfCls{ - "ConfTrkTPCfCls", - 0.83, - "Minimum fraction of crossed rows over findable clusters"}; - Configurable ConfTrkTPCcRowsMin{ - "ConfTrkTPCcRowsMin", - 70, - "Minimum number of crossed TPC rows"}; - Configurable ConfTrkTPCsClsMax{ - "ConfTrkTPCsClsMax", - 160, - "Maximum number of shared TPC clusters"}; - Configurable ConfTrkITSnclsMin{ - "ConfTrkITSnclsMin", - 0, - "Minimum number of ITS clusters"}; - Configurable ConfTrkITSnclsIbMin{ - "ConfTrkITSnclsIbMin", - 0, - "Minimum number of ITS clusters in the inner barrel"}; - Configurable ConfTrkDCAxyMax{ - "ConfTrkDCAxyMax", - 0.15, - "Maximum DCA_xy"}; - Configurable ConfTrkDCAzMax{ - "ConfTrkDCAzMax", - 0.3, - "Maximum DCA_z"}; - // Checks taken from global track definition - Configurable ConfTrkRequireChi2MaxTPC{ - "ConfTrkRequireChi2MaxTPC", false, - "True: require max chi2 per TPC cluster"}; - Configurable ConfTrkRequireChi2MaxITS{ - "ConfTrkRequireChi2MaxITS", false, - "True: require max chi2 per ITS cluster"}; - Configurable - ConfTrkMaxChi2PerClusterTPC{ - "ConfTrkMaxChi2PerClusterTPC", - 4.0f, - "Minimal track selection: max allowed chi2 per TPC cluster"}; // 4.0 is default of - // global tracks - // on 20.01.2023 - Configurable - ConfTrkMaxChi2PerClusterITS{ - "ConfTrkMaxChi2PerClusterITS", - 36.0f, - "Minimal track selection: max allowed chi2 per ITS cluster"}; // 36.0 is default of - // global tracks - // on 20.01.2023 - Configurable ConfTrkTPCRefit{ - "ConfTrkTPCRefit", - false, - "True: require TPC refit"}; - Configurable ConfTrkITSRefit{ - "ConfTrkITSRefit", - false, - "True: require ITS refit"}; - // PID selections - - Configurable> ConfPIDCuts{ - "ConfPIDCuts", - {CFTrigger::pidcutsTable[0], CFTrigger::nTracks, CFTrigger::kNPIDLimits, CFTrigger::SpeciesName, CFTrigger::PidCutsName}, - "Particle PID selections"}; - Configurable> ConfPIDCutsAnti{ - "ConfPIDCutsAnti", - {CFTrigger::pidcutsTableAnti[0], CFTrigger::nTracks, CFTrigger::kNPIDLimits, CFTrigger::SpeciesNameAnti, CFTrigger::PidCutsName}, - "Particle PID selections for antiparticles; perfect case scenario identical to particles"}; - Configurable> ConfPtCuts{ - "ConfPtCuts", - {CFTrigger::ptcutsTable[0], CFTrigger::kNParticleRejection, CFTrigger::nPtCuts, CFTrigger::SpeciesNameAll, CFTrigger::PtCutsName}, - "Particle Momentum selections"}; - Configurable ConfRejectNOTDeuteron{ - "ConfRejectNOTDeuteron", - false, - "Reject deuteron candidates if they are compatible with electron, pion, proton"}; - Configurable> ConfPIDRejection{ - "ConfPIDRejection", - {CFTrigger::pidRejectionTable[0], CFTrigger::kNParticleRejection, CFTrigger::nPidRejection, CFTrigger::SpeciesRejectionName, CFTrigger::TPCCutName}, - "Particle PID Rejection selections (Deuteron candidates only)"}; - Configurable> ConfPIDTPCTOFAvg{ - "ConfPIDTPCTOFAvg", - {CFTrigger::pidTPCTOFAvgTable[0], CFTrigger::nPidAvg, CFTrigger::nTracks, CFTrigger::SpeciesAvgTPCTOFName, CFTrigger::TPCTOFAvgName}, - "Average expected nSigma of TPC and TOF, which is substracted in calculation of combined TPC and TOF nSigma"}; - - // Configs for V0 - Configurable ConfV0PtMin{ - "ConfV0PtMin", - 0.f, - "Minimum transverse momentum of V0"}; - Configurable ConfV0DCADaughMax{ - "ConfV0DCADaughMax", - 1.8f, - "Maximum DCA between the V0 daughters"}; - Configurable ConfV0CPAMin{ - "ConfV0CPAMin", - 0.985f, - "Minimum CPA of V0"}; - Configurable ConfV0TranRadV0Min{ - "ConfV0TranRadV0Min", - 0.2f, - "Minimum transverse radius"}; - Configurable ConfV0TranRadV0Max{ - "ConfV0TranRadV0Max", - 100.f, - "Maximum transverse radius"}; - Configurable ConfV0DecVtxMax{"ConfV0DecVtxMax", - 100.f, - "Maximum distance from primary vertex"}; - Configurable ConfV0InvMassLowLimit{ - "ConfV0InvMassLowLimit", - 1.05, - "Lower limit of the V0 invariant mass"}; - Configurable ConfV0InvMassUpLimit{ - "ConfV0InvMassUpLimit", - 1.18, - "Upper limit of the V0 invariant mass"}; - - Configurable ConfV0RejectKaons{"ConfV0RejectKaons", - true, - "Switch to reject kaons"}; - Configurable ConfV0InvKaonMassLowLimit{ - "ConfV0InvKaonMassLowLimit", - 0.49, - "Lower limit of the V0 invariant mass for Kaon rejection"}; - Configurable ConfV0InvKaonMassUpLimit{ - "ConfV0InvKaonMassUpLimit", - 0.505, - "Upper limit of the V0 invariant mass for Kaon rejection"}; - - // config for V0 daughters - Configurable ConfDaughEta{ - "ConfDaughEta", - 0.85f, - "V0 Daugh sel: max eta"}; - Configurable ConfDaughTPCnclsMin{ - "ConfDaughTPCnclsMin", - 60.f, - "V0 Daugh sel: Min. nCls TPC"}; - Configurable ConfDaughDCAMin{ - "ConfDaughDCAMin", - 0.04f, - "V0 Daugh sel: Max. DCA Daugh to PV (cm)"}; - Configurable> ConfDaughPIDCuts{ - "ConfDaughPIDCuts", - {CFTrigger::pidcutsV0DaughterTable[0], CFTrigger::kNV0Daughters, CFTrigger::nPidCutsDaughers, CFTrigger::SpeciesV0DaughterName, CFTrigger::TPCCutName}, - "PID selections for Lambda daughters"}; - - // Trigger selections - Configurable> ConfTriggerSwitches{ - "ConfTriggerSwitches", - {CFTrigger::triggerSwitches[0], 1, CFTrigger::nAllTriggers, std::vector{"Switch"}, CFTrigger::CFTriggerNamesALL}, - "Turn on specific trigger"}; - - Configurable> ConfQ3Limits{ - "ConfQ3Limits", - {CFTrigger::Q3Limits[0], 1, CFTrigger::kNThreeBodyTriggers, std::vector{"Limit"}, CFTrigger::ThreeBodyFilterNames}, - "Q3 limits for three body trigger"}; - - Configurable> ConfKstarLimits{ - "ConfKstarLimits", - {CFTrigger::KstarLimits[0], 1, CFTrigger::kNTwoBodyTriggers, std::vector{"Limit"}, CFTrigger::TwoBodyFilterNames}, - "kstar limit for two body trigger"}; - - HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; - // HistogramRegistry registryQA{"registryQA", {}, OutputObjHandlingPolicy::AnalysisObject}; - - std::vector BBProton, BBAntiproton, BBDeuteron, BBAntideuteron, BBPion, BBAntipion, BBElectron, BBAntielectron, TPCTOFAvg; - void init(o2::framework::InitContext&) - { - - // init the ccdb - ccdb->setURL("http://alice-ccdb.cern.ch"); - ccdbApi.init("http://alice-ccdb.cern.ch"); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - - // Set avg if not taking from ccdb - if (!ConfUseAvgFromCCDB) { - TPCTOFAvg = {ConfPIDTPCTOFAvg->get("Proton", "TPC Avg"), - ConfPIDTPCTOFAvg->get("Proton", "TOF Avg"), - ConfPIDTPCTOFAvg->get("AntiProton", "TPC Avg"), - ConfPIDTPCTOFAvg->get("AntiProton", "TOF Avg"), - ConfPIDTPCTOFAvg->get("Deuteron", "TPC Avg"), - ConfPIDTPCTOFAvg->get("Deuteron", "TOF Avg"), - ConfPIDTPCTOFAvg->get("AntiDeuteron", "TPC Avg"), - ConfPIDTPCTOFAvg->get("AntiDeuteron", "TOF Avg")}; - } - - registry.add("fProcessedEvents", "CF - event filtered;;Events", HistType::kTH1F, {{8, -0.5, 7.5}}); - std::vector eventTitles = {"all", "accepted", "ppp", "ppL", "pLL", "LLL", "pp", "pL"}; - for (size_t iBin = 0; iBin < eventTitles.size(); iBin++) { - registry.get(HIST("fProcessedEvents"))->GetXaxis()->SetBinLabel(iBin + 1, eventTitles[iBin].data()); - } - - // event cuts - registry.add("EventCuts/fMultiplicityBefore", "Multiplicity of all processed events;Mult;Entries", HistType::kTH1F, {{1000, 0, 1000}}); - registry.add("EventCuts/fMultiplicityAfter", "Multiplicity after event cuts;Mult;Entries", HistType::kTH1F, {{1000, 0, 1000}}); - registry.add("EventCuts/fZvtxBefore", "Zvtx of all processed events;Z_{vtx};Entries", HistType::kTH1F, {{1000, -15, 15}}); - registry.add("EventCuts/fZvtxAfter", "Zvtx after event cuts;Z_{vtx};Entries", HistType::kTH1F, {{1000, -15, 15}}); - - // mom correlations p vs pTPC - registry.add("TrackCuts/TracksBefore/fMomCorrelationPos", "fMomCorrelation;p (GeV/c);p_{TPC} (GeV/c)", {HistType::kTH2F, {{1000, 0.0f, 20.0f}, {1000, 0.0f, 20.0f}}}); - registry.add("TrackCuts/TracksBefore/fMomCorrelationAfterCutsPos", "fMomCorrelationAfterCuts;p (GeV/c);p_{TPC} (GeV/c)", {HistType::kTH2F, {{1000, 0.0f, 20.0f}, {1000, 0.0f, 20.0f}}}); - registry.add("TrackCuts/TracksBefore/fMomCorrelationNeg", "fMomCorrelation;p (GeV/c);p_{TPC} (GeV/c)", {HistType::kTH2F, {{1000, 0.0f, 20.0f}, {1000, 0.0f, 20.0f}}}); - registry.add("TrackCuts/TracksBefore/fMomCorrelationAfterCutsNeg", "fMomCorrelationAfterCuts;p (GeV/c);p_{TPC} (GeV/c)", {HistType::kTH2F, {{1000, 0.0f, 20.0f}, {1000, 0.0f, 20.0f}}}); - - registry.add("TrackCuts/TracksBefore/fMomCorrelationAfterCutsProton", "fMomCorrelation;p (GeV/c);p_{TPC} (GeV/c)", {HistType::kTH2F, {{1000, 0.0f, 20.0f}, {1000, 0.0f, 20.0f}}}); - registry.add("TrackCuts/TracksBefore/fMomCorrelationAfterCutsAntiProton", "fMomCorrelation;p (GeV/c);p_{TPC} (GeV/c)", {HistType::kTH2F, {{1000, 0.0f, 20.0f}, {1000, 0.0f, 20.0f}}}); - registry.add("TrackCuts/TracksBefore/fMomCorrelationAfterCutsDeuteron", "fMomCorrelation;p (GeV/c);p_{TPC} (GeV/c)", {HistType::kTH2F, {{1000, 0.0f, 20.0f}, {1000, 0.0f, 20.0f}}}); - registry.add("TrackCuts/TracksBefore/fMomCorrelationAfterCutsAntiDeuteron", "fMomCorrelation;p (GeV/c);p_{TPC} (GeV/c)", {HistType::kTH2F, {{1000, 0.0f, 20.0f}, {1000, 0.0f, 20.0f}}}); - - // all tracks - registry.add("TrackCuts/TracksBefore/fPtTrackBefore", "Transverse momentum of all processed tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("TrackCuts/TracksBefore/fEtaTrackBefore", "Pseudorapidity of all processed tracks;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); - registry.add("TrackCuts/TracksBefore/fPhiTrackBefore", "Azimuthal angle of all processed tracks;#phi;Entries", HistType::kTH1F, {{720, 0, TMath::TwoPi()}}); - - // PID vs momentum before cuts - registry.add("TrackCuts/NSigmaBefore/fNsigmaTPCvsPProtonBefore", "NSigmaTPC Proton Before;p_{TPC} (GeV/c);n#sigma_{TPC}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/NSigmaBefore/fNsigmaTOFvsPProtonBefore", "NSigmaTOF Proton Before;p_{TPC} (GeV/c);n#sigma_{TOF}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/NSigmaBefore/fNsigmaTPCTOFvsPProtonBefore", "NSigmaTPCTOF Proton Before;p_{TPC} (GeV/c);n#sigma_{comb}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, 0.f, 10.f}}}); - registry.add("TrackCuts/NSigmaBefore/fNsigmaTPCvsPAntiProtonBefore", "NSigmaTPC AntiProton Before;p_{TPC} (GeV/c);n#sigma_{TPC}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/NSigmaBefore/fNsigmaTOFvsPAntiProtonBefore", "NSigmaTOF AntiProton Before;p_{TPC} (GeV/c);n#sigma_{TOF}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/NSigmaBefore/fNsigmaTPCTOFvsPAntiProtonBefore", "NSigmaTPCTOF AntiProton Before;p_{TPC} (GeV/c);n#sigma_{comb}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, 0.f, 10.f}}}); - - // TPC signal - registry.add("TrackCuts/TPCSignal/fTPCSignal", "TPCSignal;p_{TPC} (GeV/c);dE/dx", {HistType::kTH2F, {{1000, 0.0f, 6.0f}, {2000, -100.f, 1000.f}}}); - registry.add("TrackCuts/TPCSignal/fTPCSignalP", "TPCSignalP;p (GeV/c);dE/dx", {HistType::kTH2F, {{1000, 0.0f, 6.0f}, {2000, -100.f, 1000.f}}}); - registry.add("TrackCuts/TPCSignal/fTPCSignalALLCUTS", "TPCSignalALLCUTS;p_{TPC} (GeV/c);dE/dx", {HistType::kTH2F, {{1000, 0.0f, 6.0f}, {2000, -100.f, 1000.f}}}); - registry.add("TrackCuts/TPCSignal/fTPCSignalALLCUTSP", "TPCSignalALLCUTSP;p (GeV/c);dE/dx", {HistType::kTH2F, {{1000, 0.0f, 6.0f}, {2000, -100.f, 1000.f}}}); - - // TPC signal anti - registry.add("TrackCuts/TPCSignal/fTPCSignalAnti", "TPCSignal;p_{TPC} (GeV/c);dE/dx", {HistType::kTH2F, {{1000, 0.0f, 6.0f}, {2000, -100.f, 1000.f}}}); - registry.add("TrackCuts/TPCSignal/fTPCSignalAntiP", "TPCSignalP;p (GeV/c);dE/dx", {HistType::kTH2F, {{1000, 0.0f, 6.0f}, {2000, -100.f, 1000.f}}}); - registry.add("TrackCuts/TPCSignal/fTPCSignalAntiALLCUTS", "TPCSignalALLCUTS;p_{TPC} (GeV/c);dE/dx", {HistType::kTH2F, {{1000, 0.0f, 6.0f}, {2000, -100.f, 1000.f}}}); - registry.add("TrackCuts/TPCSignal/fTPCSignalAntiALLCUTSP", "TPCSignalALLCUTSP;p(GeV/c);dE/dx", {HistType::kTH2F, {{1000, 0.0f, 6.0f}, {2000, -100.f, 1000.f}}}); - - // TPC signal particles - registry.add("TrackCuts/TPCSignal/fTPCSignalProton", "fTPCSignalProton;p_{TPC} (GeV/c);dE/dx", {HistType::kTH2F, {{1000, 0.0f, 6.0f}, {20000, -100.f, 1000.f}}}); - registry.add("TrackCuts/TPCSignal/fTPCSignalAntiProton", "fTPCSignalAntiProton;p_{TPC} (GeV/c);dE/dx", {HistType::kTH2F, {{1000, 0.0f, 6.0f}, {20000, -100.f, 1000.f}}}); - registry.add("TrackCuts/TPCSignal/fTPCSignalPionMinusV0Daughter", "fTPCSignalPionMinusV0Daughter;p_{TPC} (GeV/c);dE/dx", {HistType::kTH2F, {{1000, 0.0f, 6.0f}, {20000, -100.f, 1000.f}}}); - registry.add("TrackCuts/TPCSignal/fTPCSignalPionPlusV0Daughter", "fTPCSignalPionPlusV0Daughter;p_{TPC} (GeV/c);dE/dx", {HistType::kTH2F, {{1000, 0.0f, 6.0f}, {20000, -100.f, 1000.f}}}); - registry.add("TrackCuts/TPCSignal/fTPCSignalProtonMinusV0Daughter", "fTPCSignalProtonMinusV0Daughter;p_{TPC} (GeV/c);dE/dx", {HistType::kTH2F, {{1000, 0.0f, 6.0f}, {20000, -100.f, 1000.f}}}); - registry.add("TrackCuts/TPCSignal/fTPCSignalProtonPlusV0Daughter", "fTPCSignalProtonPlusV0Daughter;p_{TPC} (GeV/c);dE/dx", {HistType::kTH2F, {{1000, 0.0f, 6.0f}, {20000, -100.f, 1000.f}}}); - - // PID vs momentum before cuts daughters - registry.add("TrackCuts/NSigmaBefore/fNsigmaTPCvsPProtonV0DaughBefore", "NSigmaTPC Proton V0Daught Before;p_{TPC} (GeV/c);n#sigma_{TPC}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/NSigmaBefore/fNsigmaTPCvsPPionMinusV0DaughBefore", "NSigmaTPC AntiPion V0Daught Before;p_{TPC} (GeV/c);n#sigma_{TPC}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/NSigmaBefore/fNsigmaTPCvsPAntiProtonAntiV0DaughBefore", "NSigmaTPC AntiProton antiV0Daught Before;p_{TPC} (GeV/c);n#sigma_{TPC}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/NSigmaBefore/fNsigmaTPCvsPPionPlusAntiV0DaughBefore", "NSigmaTPC Pion antiV0Daught Before;p_{TPC} (GeV/c);n#sigma_{TPC}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - - // proton - // TEST P TPC - registry.add("TrackCuts/Proton/fPProton", "Momentum of protons at PV;p (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("TrackCuts/Proton/fPTPCProton", "Momentum of protons at TPC inner wall;p_{TPC} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - - registry.add("TrackCuts/Proton/fPtProton", "Transverse momentum of all processed tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("TrackCuts/Proton/fEtaProton", "Pseudorapidity of all processed tracks;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); - registry.add("TrackCuts/Proton/fPhiProton", "Azimuthal angle of all processed tracks;#phi;Entries", HistType::kTH1F, {{720, 0, TMath::TwoPi()}}); - registry.add("TrackCuts/Proton/fNsigmaTPCvsPProton", "NSigmaTPC Proton;p_{TPC} (GeV/c);n#sigma_{TPC}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/Proton/fNsigmaTOFvsPProton", "NSigmaTOF Proton;p_{TPC} (GeV/c);n#sigma_{TOF}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/Proton/fNsigmaTPCTOFvsPProton", "NSigmaTPCTOF Proton;p_{TPC} (GeV/c);n#sigma_{comb}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, 0.f, 10.f}}}); - - registry.add("TrackCuts/Proton/fNsigmaTPCvsPProtonP", "NSigmaTPC Proton P;p (GeV/c);n#sigma_{TPC}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/Proton/fNsigmaTOFvsPProtonP", "NSigmaTOF Proton P;p (GeV/c);n#sigma_{TOF}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/Proton/fNsigmaTPCTOFvsPProtonP", "NSigmaTPCTOF Proton P;p (GeV/c);n#sigma_{comb}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, 0.f, 10.f}}}); - - registry.add("TrackCuts/Proton/fDCAxyProton", "fDCAxy Proton;DCA_{XY};Entries", HistType::kTH1F, {{500, -0.5f, 0.5f}}); - registry.add("TrackCuts/Proton/fDCAzProton", "fDCAz Proton;DCA_{Z};Entries", HistType::kTH1F, {{500, -0.5f, 0.5f}}); - registry.add("TrackCuts/Proton/fTPCsClsProton", "fTPCsCls Proton;TPC Shared Clusters;Entries", HistType::kTH1F, {{163, -1.0f, 162.0f}}); - registry.add("TrackCuts/Proton/fTPCcRowsProton", "fTPCcRows Proton;TPC Crossed Rows;Entries", HistType::kTH1F, {{163, -1.0f, 162.0f}}); - registry.add("TrackCuts/Proton/fTrkTPCfClsProton", "fTrkTPCfCls Proton;TPC Findable/CrossedRows;Entries", HistType::kTH1F, {{500, 0.0f, 3.0f}}); - registry.add("TrackCuts/Proton/fTPCnclsProton", "fTPCncls Proton;TPC Clusters;Entries", HistType::kTH1F, {{163, -1.0f, 162.0f}}); - - // antiproton - registry.add("TrackCuts/AntiProton/fPtAntiProton", "Transverse momentum of all processed tracks", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("TrackCuts/AntiProton/fEtaAntiProton", "Pseudorapidity of all processed tracks", HistType::kTH1F, {{1000, -2, 2}}); - registry.add("TrackCuts/AntiProton/fPhiAntiProton", "Azimuthal angle of all processed tracks", HistType::kTH1F, {{720, 0, TMath::TwoPi()}}); - registry.add("TrackCuts/AntiProton/fNsigmaTPCvsPAntiProton", "NSigmaTPC AntiProton", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/AntiProton/fNsigmaTOFvsPAntiProton", "NSigmaTOF AntiProton", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/AntiProton/fNsigmaTPCTOFvsPAntiProton", "NSigmaTPCTOF AntiProton", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, 0.f, 10.f}}}); - - registry.add("TrackCuts/AntiProton/fNsigmaTPCvsPAntiProtonP", "NSigmaTPC AntiProton P;p (GeV/c);n#sigma_{TPC}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/AntiProton/fNsigmaTOFvsPAntiProtonP", "NSigmaTOF AntiProton P;p (GeV/c);n#sigma_{TOF}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/AntiProton/fNsigmaTPCTOFvsPAntiProtonP", "NSigmaTPCTOF AntiProton P;p (GeV/c);n#sigma_{comb}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, 0.f, 10.f}}}); - - registry.add("TrackCuts/AntiProton/fDCAxyAntiProton", "fDCAxy AntiProton;DCA_{XY};Entries", HistType::kTH1F, {{500, -0.5f, 0.5f}}); - registry.add("TrackCuts/AntiProton/fDCAzAntiProton", "fDCAz AntiProton;DCA_{Z};Entries", HistType::kTH1F, {{500, -0.5f, 0.5f}}); - registry.add("TrackCuts/AntiProton/fTPCsClsAntiProton", "fTPCsCls AntiProton;TPC Shared Clusters;Entries", HistType::kTH1F, {{163, -1.0f, 162.0f}}); - registry.add("TrackCuts/AntiProton/fTPCcRowsAntiProton", "fTPCcRows AntiProton;TPC Crossed Rows;Entries", HistType::kTH1F, {{163, -1.0f, 162.0f}}); - registry.add("TrackCuts/AntiProton/fTrkTPCfClsAntiProton", "fTrkTPCfCls AntiProton;TPC Findable/CrossedRows;Entries", HistType::kTH1F, {{500, 0.0f, 3.0f}}); - registry.add("TrackCuts/AntiProton/fTPCnclsAntiProton", "fTPCncls AntiProton;TPC Clusters;Entries", HistType::kTH1F, {{163, -1.0f, 162.0f}}); - - // lambda before selections - registry.add("TrackCuts/V0Before/fInvMassLambdavsAntiLambda", "Invariant mass of Lambda vs AntiLambda;M_{#pi p};Entries", HistType::kTH2F, {{1000, 1.03, 1.5}, {1000, 1.03, 1.5}}); - registry.add("TrackCuts/V0Before/fPtLambdaBefore", "Transverse momentum of all processed V0s before cuts;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("TrackCuts/V0Before/fInvMassLambdaBefore", "Invariant mass of all processed V0s (Lambda) before cuts;M_{#pi p};Entries", HistType::kTH1F, {{1000, 1.03, 1.5}}); - registry.add("TrackCuts/V0Before/fInvMassAntiLambdaBefore", "Invariant mass of all processed V0s (antiLambda) before cuts;M_{#pi p};Entries", HistType::kTH1F, {{1000, 1.03, 1.5}}); - registry.add("TrackCuts/V0Before/fInvMassV0BeforeKaonvsV0Before", "Invariant mass of rejected K0 vs V0s (V0Before);M_{#pi p};;M_{#pi #pi}", HistType::kTH2F, {{1000, 1.03, 1.5}, {1000, 0.3, 0.6}}); - registry.add("TrackCuts/V0Before/fV0DCADaugh", "V0DCADaugh;DCA_{daugh};Entries", HistType::kTH1F, {{1000, -4, 4}}); - registry.add("TrackCuts/V0Before/fV0CPA", "V0 CPA;CPA;Entries", HistType::kTH1F, {{1000, 0.7, 1}}); - registry.add("TrackCuts/V0Before/fV0TranRad", "V0 TranRad;TranRad;Entries", HistType::kTH1F, {{1000, 0, 150}}); - registry.add("TrackCuts/V0Before/f0DecVtxX", "V0 DecVtxX;DecVtX;Entries", HistType::kTH1F, {{1000, 0, 150}}); - registry.add("TrackCuts/V0Before/f0DecVtxY", "V0 DecVtxY;DecVtY;Entries", HistType::kTH1F, {{1000, 0, 150}}); - registry.add("TrackCuts/V0Before/f0DecVtxZ", "V0 DecVtxZ;DecVtz;Entries", HistType::kTH1F, {{1000, 0, 150}}); - - registry.add("TrackCuts/V0Before/PosDaughter/Eta", "V0Before Pos Daugh Eta;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); - registry.add("TrackCuts/V0Before/PosDaughter/DCAXY", "V0Before Pos Daugh DCAXY;DCA_{XY};Entries", HistType::kTH1F, {{1000, -2.5f, 2.5f}}); - registry.add("TrackCuts/V0Before/PosDaughter/fTPCncls", "V0Before Pos Daugh TPCncls;TPC Clusters;Entries", HistType::kTH1F, {{163, -1.0f, 162.0f}}); - registry.add("TrackCuts/V0Before/NegDaughter/Eta", "V0Before Neg Daugh Eta;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); - registry.add("TrackCuts/V0Before/NegDaughter/DCAXY", "V0Before Neg Daugh DCAXY;DCA_{XY};Entries", HistType::kTH1F, {{1000, -2.5f, 2.5f}}); - registry.add("TrackCuts/V0Before/NegDaughter/fTPCncls", "V0Before Neg Daugh TPCncls;TPC Clusters;Entries", HistType::kTH1F, {{163, -1.0f, 162.0f}}); - registry.add("TrackCuts/V0Before/PosDaughter/fNsigmaTPCvsPProtonV0Daugh", "NSigmaTPC Proton V0Daught;p_{TPC} (GeV/c);n#sigma_{TPC}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/V0Before/NegDaughter/fNsigmaTPCvsPPionMinusV0Daugh", "NSigmaTPC AntiPion V0Daught;p_{TPC} (GeV/c);n#sigma_{TPC}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/V0Before/NegDaughter/fNsigmaTPCvsPAntiProtonV0Daugh", "NSigmaTPC Proton V0Daught;p_{TPC} (GeV/c);n#sigma_{TPC}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/V0Before/PosDaughter/fNsigmaTPCvsPPionPlusV0Daugh", "NSigmaTPC AntiPion V0Daught;p_{TPC} (GeV/c);n#sigma_{TPC}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - - // lambda - registry.add("TrackCuts/Lambda/fPtLambda", "Transverse momentum V0s;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("TrackCuts/Lambda/fInvMassLambda", "Invariant mass V0s (Lambda);M_{#pi p};Entries", HistType::kTH1F, {{1000, 1.03, 1.5}}); - registry.add("TrackCuts/Lambda/fInvMassLambdaKaonvsLambda", "Invariant mass of rejected K0 vs V0s (Lambda);M_{#pi p};M_{#pi #pi}", HistType::kTH2F, {{1000, 1.03, 1.5}, {1000, 0.3, 0.6}}); - registry.add("TrackCuts/Lambda/fV0DCADaugh", "V0DCADaugh;DCA_{daugh};Entries", HistType::kTH1F, {{1000, -4, 4}}); - registry.add("TrackCuts/Lambda/fV0CPA", "V0 CPA;CPA;Entries", HistType::kTH1F, {{1000, 0.7, 1}}); - registry.add("TrackCuts/Lambda/fV0TranRad", "V0 TranRad;TranRad;Entries", HistType::kTH1F, {{1000, 0, 150}}); - registry.add("TrackCuts/Lambda/f0DecVtxX", "V0 DecVtxX;DecVtX;Entries", HistType::kTH1F, {{1000, 0, 150}}); - registry.add("TrackCuts/Lambda/f0DecVtxY", "V0 DecVtxY;DecVtY;Entries", HistType::kTH1F, {{1000, 0, 150}}); - registry.add("TrackCuts/Lambda/f0DecVtxZ", "V0 DecVtxZ;DecVtZ;Entries", HistType::kTH1F, {{1000, 0, 150}}); - - // Lambda daughter - registry.add("TrackCuts/Lambda/PosDaughter/Eta", "Lambda Pos Daugh Eta;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); - registry.add("TrackCuts/Lambda/PosDaughter/DCAXY", "Lambda Pos Daugh DCAXY;DCA_{XY};Entries", HistType::kTH1F, {{1000, -2.5f, 2.5f}}); - registry.add("TrackCuts/Lambda/PosDaughter/fTPCncls", "Lambda Pos Daugh TPCncls;TPC Clusters;Entries", HistType::kTH1F, {{163, -1.0f, 162.0f}}); - registry.add("TrackCuts/Lambda/NegDaughter/Eta", "Lambda Neg Daugh Eta;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); - registry.add("TrackCuts/Lambda/NegDaughter/DCAXY", "Lambda Neg Daugh DCAXY;DCA_{XY};Entries", HistType::kTH1F, {{1000, -2.5f, 2.5f}}); - registry.add("TrackCuts/Lambda/NegDaughter/fTPCncls", "Lambda Neg Daugh TPCncls;TPC Clusters;Entries", HistType::kTH1F, {{163, -1.0f, 162.0f}}); - registry.add("TrackCuts/Lambda/PosDaughter/fNsigmaTPCvsPProtonV0Daugh", "NSigmaTPC Proton V0Daught;p_{TPC} (GeV/c);n#sigma_{TPC}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/Lambda/NegDaughter/fNsigmaTPCvsPPionMinusV0Daugh", "NSigmaTPC AntiPion V0Daught;p_{TPC} (GeV/c);n#sigma_{TPC}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - - // antilambda - registry.add("TrackCuts/AntiLambda/fPtAntiLambda", "Transverse momentum V0s;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - registry.add("TrackCuts/AntiLambda/fInvMassAntiLambda", "Invariant mass V0s (Lambda);M_{#pi p};Entries", HistType::kTH1F, {{1000, 1.03, 1.5}}); - registry.add("TrackCuts/AntiLambda/fInvMassAntiLambdaKaonvsAntiLambda", "Invariant mass of rejected K0 vs V0s (Lambda);M_{#pi p};M_{#pi #pi}", HistType::kTH2F, {{1000, 1.03, 1.5}, {1000, 0.3, 0.6}}); - registry.add("TrackCuts/AntiLambda/fV0DCADaugh", "V0DCADaugh;DCA_{daugh};Entries", HistType::kTH1F, {{1000, -4, 4}}); - registry.add("TrackCuts/AntiLambda/fV0CPA", "V0 CPA;CPA;Entries", HistType::kTH1F, {{1000, 0.7, 1}}); - registry.add("TrackCuts/AntiLambda/fV0TranRad", "V0 TranRad;TranRad;Entries", HistType::kTH1F, {{1000, 0, 150}}); - registry.add("TrackCuts/AntiLambda/f0DecVtxX", "V0 DecVtxX;DecVtX;Entries", HistType::kTH1F, {{1000, 0, 150}}); - registry.add("TrackCuts/AntiLambda/f0DecVtxY", "V0 DecVtxY;DecVtY;Entries", HistType::kTH1F, {{1000, 0, 150}}); - registry.add("TrackCuts/AntiLambda/f0DecVtxZ", "V0 DecVtxZ;DecVtZ;Entries", HistType::kTH1F, {{1000, 0, 150}}); - - // AntiLambda daughter - registry.add("TrackCuts/AntiLambda/PosDaughter/Eta", "AntiLambda Pos Daugh Eta;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); - registry.add("TrackCuts/AntiLambda/PosDaughter/DCAXY", "AntiLambda Pos Daugh DCAXY;DCA_{XY};Entries", HistType::kTH1F, {{1000, -2.5f, 2.5f}}); - registry.add("TrackCuts/AntiLambda/PosDaughter/fTPCncls", "AntiLambda Pos Daugh TPCncls;TPC Clusters;Entries", HistType::kTH1F, {{163, -1.0f, 162.0f}}); - registry.add("TrackCuts/AntiLambda/NegDaughter/Eta", "AntiLambda Neg Daugh Eta;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}}); - registry.add("TrackCuts/AntiLambda/NegDaughter/DCAXY", "AntiLambda Neg Daugh DCAXY;DCA_{XY};Entries", HistType::kTH1F, {{1000, -2.5f, 2.5f}}); - registry.add("TrackCuts/AntiLambda/NegDaughter/fTPCncls", "AntiLambda Neg Daugh TPCncls;TPC Clusters;Entries", HistType::kTH1F, {{163, -1.0f, 162.0f}}); - registry.add("TrackCuts/AntiLambda/NegDaughter/fNsigmaTPCvsPAntiProtonAntiV0Daugh", "NSigmaTPC AntiProton antiV0Daught;p_{TPC} (GeV/c);n#sigma_{TPC}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("TrackCuts/AntiLambda/PosDaughter/fNsigmaTPCvsPPionPlusAntiV0Daugh", "NSigmaTPC Pion antiV0Daught;p_{TPC} (GeV/c);n#sigma_{TPC}", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); - registry.add("ppp/fMultiplicity", "Multiplicity of all processed events;Mult;Entries", HistType::kTH1F, {{1000, 0, 1000}}); - registry.add("ppp/fZvtx", "Zvtx of all processed events;Z_{vtx};Entries", HistType::kTH1F, {{1000, -15, 15}}); - registry.add("ppp/fSE_particle", "Same Event distribution", HistType::kTH1F, {{8000, 0, 8}}); - registry.add("ppp/fSE_antiparticle", "Same Event distribution", HistType::kTH1F, {{8000, 0, 8}}); - - // for ppl - registry.add("ppl/fMultiplicity", "Multiplicity of all processed events;Mult;Entries", HistType::kTH1F, {{1000, 0, 1000}}); - registry.add("ppl/fZvtx", "Zvtx of all processed events;Z_{vtx};Entries", HistType::kTH1F, {{1000, -15, 15}}); - registry.add("ppl/fSE_particle", "Same Event distribution;SE;Q_{3} (GeV/c)", HistType::kTH1F, {{8000, 0, 8}}); - registry.add("ppl/fSE_antiparticle", "Same Event distribution;SE;Q_{3} (GeV/c)", HistType::kTH1F, {{8000, 0, 8}}); - - // for pll - registry.add("pll/fMultiplicity", "Multiplicity of all processed events;Mult;Entries", HistType::kTH1F, {{1000, 0, 1000}}); - registry.add("pll/fZvtx", "Zvtx of all processed events;Z_{vtx};Entries", HistType::kTH1F, {{1000, -15, 15}}); - registry.add("pll/fSE_particle", "Same Event distribution;SE;Q_{3} (GeV/c)", HistType::kTH1F, {{8000, 0, 8}}); - registry.add("pll/fSE_antiparticle", "Same Event distribution;SE;Q_{3} (GeV/c)", HistType::kTH1F, {{8000, 0, 8}}); - - // for pll - registry.add("lll/fMultiplicity", "Multiplicity of all processed events;Mult;Entries", HistType::kTH1F, {{1000, 0, 1000}}); - registry.add("lll/fZvtx", "Zvtx of all processed events;Z_{vtx};Entries", HistType::kTH1F, {{1000, -15, 15}}); - registry.add("lll/fSE_particle", "Same Event distribution;SE;Q_{3} (GeV/c)", HistType::kTH1F, {{8000, 0, 8}}); - registry.add("lll/fSE_antiparticle", "Same Event distribution;SE;Q_{3} (GeV/c)", HistType::kTH1F, {{8000, 0, 8}}); - - // for pp - registry.add("pp/fMultiplicity", "Multiplicity of all processed events;Mult;Entries", HistType::kTH1F, {{1000, 0, 1000}}); - registry.add("pp/fZvtx", "Zvtx of all processed events;Z_{vtx};Entries", HistType::kTH1F, {{1000, -15, 15}}); - registry.add("pp/fSE_particle", "Same Event distribution;SE;Q_{3} (GeV/c)", HistType::kTH1F, {{8000, 0, 8}}); - registry.add("pp/fSE_antiparticle", "Same Event distribution;SE;Q_{3} (GeV/c)", HistType::kTH1F, {{8000, 0, 8}}); - - // for pl - registry.add("pl/fMultiplicity", "Multiplicity of all processed events", HistType::kTH1F, {{1000, 0, 1000}}); - registry.add("pl/fZvtx", "Zvtx of all processed events;Z_{vtx};Entries", HistType::kTH1F, {{1000, -15, 15}}); - registry.add("pl/fSE_particle", "Same Event distribution;SE;Q_{3} (GeV/c)", HistType::kTH1F, {{8000, 0, 8}}); - registry.add("pl/fSE_antiparticle", "Same Event distribution;SE;Q_{3} (GeV/c)", HistType::kTH1F, {{8000, 0, 8}}); - } - - float mMassElectron = o2::constants::physics::MassElectron; - float mMassPion = o2::constants::physics::MassPionCharged; - float mMassProton = o2::constants::physics::MassProton; - float mMassLambda = o2::constants::physics::MassLambda; - float mMassDeuteron = o2::constants::physics::MassDeuteron; - int currentRunNumber = -999; - int lastRunNumber = -999; - - template - bool isSelectedEvent(T const& col) - { - if (ConfEvtSelectZvtx && std::abs(col.posZ()) > ConfEvtZvtx) { - return false; - } - if (ConfEvtOfflineCheck && !col.sel8()) { - return false; - } - return true; - } - - template - bool isSelectedTrack(T const& track, CFTrigger::ParticleSpecies partSpecies) - { - const auto pT = track.pt(); - const auto eta = track.eta(); - const auto tpcNClsF = track.tpcNClsFound(); - const auto tpcRClsC = track.tpcCrossedRowsOverFindableCls(); - const auto tpcNClsC = track.tpcNClsCrossedRows(); - const auto tpcNClsS = track.tpcNClsShared(); - const auto itsNCls = track.itsNCls(); - const auto itsNClsIB = track.itsNClsInnerBarrel(); - const auto dcaXY = track.dcaXY(); - const auto dcaZ = track.dcaZ(); - - if (pT < ConfPtCuts->get(partSpecies, "Pt min")) { - return false; - } - if (pT > ConfPtCuts->get(partSpecies, "Pt max")) { - return false; - } - if (std::abs(eta) > ConfTrkEta) { - return false; - } - if (tpcNClsF < ConfTPCNClustersMin->get("TPCNClusMin", partSpecies)) { - return false; - } - if (tpcRClsC < ConfTrkTPCfCls) { - return false; - } - if (tpcNClsC < ConfTrkTPCcRowsMin) { - return false; - } - if (tpcNClsS > ConfTrkTPCsClsMax) { - return false; - } - if (itsNCls < ConfTrkITSnclsMin) { - return false; - } - if (itsNClsIB < ConfTrkITSnclsIbMin) { - return false; - } - if (std::abs(dcaXY) > ConfTrkDCAxyMax) { - return false; - } - if (std::abs(dcaZ) > ConfTrkDCAzMax) { - return false; - } - // TODO: which dca, put dcaxy for now - if (ConfRejectNotPropagatedTracks && std::abs(dcaXY) > 1e3) { - return false; - } - if (ConfTrkRequireChi2MaxTPC && track.tpcChi2NCl() >= ConfTrkMaxChi2PerClusterTPC) { - return false; - } - if (ConfTrkRequireChi2MaxITS && track.itsChi2NCl() >= ConfTrkMaxChi2PerClusterITS) { - return false; - } - if (ConfTrkTPCRefit && !track.hasTPC()) { - return false; - } - if (ConfTrkITSRefit && !track.hasITS()) { - return false; - } - return true; - } - - template - bool isSelectedV0Daughter(T const& track, float charge, CFTrigger::V0Daughters species, double nSigmaTPCDaug[2]) - { - const auto eta = track.eta(); - const auto tpcNClsF = track.tpcNClsFound(); - const auto dcaXY = track.dcaXY(); - const auto sign = track.sign(); - double nSigmaTPC = -999.f; - - if (charge < 0 && sign > 0) { - return false; - } - if (charge > 0 && sign < 0) { - return false; - } - if (std::abs(eta) > ConfDaughEta) { - return false; - } - if (tpcNClsF < ConfDaughTPCnclsMin) { - return false; - } - if (std::abs(dcaXY) < ConfDaughDCAMin) { - return false; - } - - switch (species) { - case CFTrigger::kDaughPion: - nSigmaTPC = nSigmaTPCDaug[1]; - break; - case CFTrigger::kDaughProton: - nSigmaTPC = nSigmaTPCDaug[0]; - break; - default: - LOG(fatal) << "Particle species for V0 daughters not found"; - } - - if (nSigmaTPC < ConfDaughPIDCuts->get(species, "TPC min") || - nSigmaTPC > ConfDaughPIDCuts->get(species, "TPC max")) { - return false; - } - return true; - } - - template - bool isSelectedTrackPID(T const& track, CFTrigger::ParticleSpecies partSpecies, bool Rejection, double nSigmaTPC[2], int charge) - { - // nSigma should have entries [proton, deuteron] - bool isSelected = false; - bool pThres = true; - float nSigma = -999.; - - // check momentum threshold - if (track.tpcInnerParam() <= ConfPtCuts->get(partSpecies, "P thres")) { - pThres = true; - } else { - pThres = false; - } - if (CFTrigger::kDeuteron == partSpecies && ConfDeuteronThPVMom) { - if (track.p() <= ConfPtCuts->get(partSpecies, "P thres")) { - pThres = true; - } else { - pThres = false; - } - } - // compute nsigma - switch (partSpecies) { - case CFTrigger::kProton: - if (pThres) { - nSigma = nSigmaTPC[0]; - } else { - if (charge > 0) { - nSigma = std::sqrt(std::pow(nSigmaTPC[0] - TPCTOFAvg[0], 2) + std::pow(track.tofNSigmaPr() - TPCTOFAvg[1], 2)); - } else { - nSigma = std::sqrt(std::pow(nSigmaTPC[0] - TPCTOFAvg[2], 2) + std::pow(track.tofNSigmaPr() - TPCTOFAvg[3], 2)); - } - } - break; - case CFTrigger::kDeuteron: - if (pThres) { - nSigma = nSigmaTPC[1]; - } else { - if (charge > 0) { - nSigma = std::sqrt(std::pow(nSigmaTPC[1] - TPCTOFAvg[4], 2) + std::pow(track.tofNSigmaDe() - TPCTOFAvg[5], 2)); - } else { - nSigma = std::sqrt(std::pow(nSigmaTPC[1] - TPCTOFAvg[6], 2) + std::pow(track.tofNSigmaDe() - TPCTOFAvg[7], 2)); - } - } - break; - case CFTrigger::kLambda: - LOG(fatal) << "No PID selection for Lambdas"; - break; - default: - LOG(fatal) << "Particle species not known"; - } - // check if track is selected - - auto TPCmin = (charge > 0) ? ConfPIDCuts->get(partSpecies, CFTrigger::kTPCMin) - : ConfPIDCutsAnti->get(partSpecies, CFTrigger::kTPCMin); - - auto TPCmax = (charge > 0) ? ConfPIDCuts->get(partSpecies, CFTrigger::kTPCMax) - : ConfPIDCutsAnti->get(partSpecies, CFTrigger::kTPCMax); - - auto TPCTOFmax = (charge > 0) ? ConfPIDCuts->get(partSpecies, CFTrigger::kTPCTOF) - : ConfPIDCutsAnti->get(partSpecies, CFTrigger::kTPCTOF); - - if (pThres) { - if (nSigma > TPCmin && - nSigma < TPCmax) { - isSelected = true; - } - } else { - if (nSigma < TPCTOFmax) { - isSelected = true; - } - } - // for deuterons normally, we want to reject tracks that have a high - // probablilty of being another particle - if (Rejection) { - double nSigmaPi = track.tpcNSigmaPi(); - double nSigmaEl = track.tpcNSigmaEl(); - if (ConfUseManualPIDpion) { - auto bgScalingPion = 1 / mMassPion; // momentum scaling? - if (BBPion.size() == 6 && charge > 0) - nSigmaPi = updatePID(track, bgScalingPion, BBPion); - if (BBAntipion.size() == 6 && charge < 0) - nSigmaPi = updatePID(track, bgScalingPion, BBAntipion); - } - if (ConfUseManualPIDel) { - auto bgScalingElectron = 1 / mMassElectron; // momentum scaling? - if (BBElectron.size() == 6 && charge < 0) - nSigmaEl = updatePID(track, bgScalingElectron, BBElectron); - if (BBAntielectron.size() == 6 && charge > 0) - nSigmaEl = updatePID(track, bgScalingElectron, BBAntielectron); - } - if ((ConfPIDRejection->get(CFTrigger::kRejProton, CFTrigger::kTPCMin) < nSigmaTPC[0] && - ConfPIDRejection->get(CFTrigger::kRejProton, CFTrigger::kTPCMax) > nSigmaTPC[0]) || - (ConfPIDRejection->get(CFTrigger::kRejPion, CFTrigger::kTPCMin) < nSigmaPi && - ConfPIDRejection->get(CFTrigger::kRejPion, CFTrigger::kTPCMax) > nSigmaPi) || - (ConfPIDRejection->get(CFTrigger::kRejElectron, CFTrigger::kTPCMin) < nSigmaEl && - ConfPIDRejection->get(CFTrigger::kRejElectron, CFTrigger::kTPCMax) > nSigmaEl)) { - return false; - } - } - return isSelected; - } - - template - bool isSelectedMinimalV0(C const& /*col*/, V const& v0, T const& posTrack, - T const& negTrack, float charge, double nSigmaTPCPos[2], double nSigmaTPCNeg[2]) - { - const auto signPos = posTrack.sign(); - const auto signNeg = negTrack.sign(); - if (signPos < 0 || signNeg > 0) { - LOG(info) << "Something wrong in isSelectedMinimal"; - LOG(info) << "ERROR - Wrong sign for V0 daughters"; - } - const float pT = v0.pt(); - const std::vector decVtx = {v0.x(), v0.y(), v0.z()}; - const float tranRad = v0.v0radius(); - const float dcaDaughv0 = v0.dcaV0daughters(); - const float cpav0 = v0.v0cosPA(); - - const float invMassLambda = v0.mLambda(); - const float invMassAntiLambda = v0.mAntiLambda(); - - if (charge > 0 && (invMassLambda < ConfV0InvMassLowLimit || invMassLambda > ConfV0InvMassUpLimit)) { - return false; - } - if (charge < 0 && (invMassAntiLambda < ConfV0InvMassLowLimit || invMassAntiLambda > ConfV0InvMassUpLimit)) { - return false; - } - if (ConfV0RejectKaons) { - const float invMassKaon = v0.mK0Short(); - if (invMassKaon > ConfV0InvKaonMassLowLimit && invMassKaon < ConfV0InvKaonMassUpLimit) { - return false; - } - } - if (pT < ConfV0PtMin) { - return false; - } - if (dcaDaughv0 > ConfV0DCADaughMax) { - return false; - } - if (cpav0 < ConfV0CPAMin) { - return false; - } - if (tranRad < ConfV0TranRadV0Min) { - return false; - } - if (tranRad > ConfV0TranRadV0Max) { - return false; - } - for (size_t i = 0; i < decVtx.size(); i++) { - if (decVtx.at(i) > ConfV0DecVtxMax) { - return false; - } - } - if (charge > 0) { - if (!isSelectedV0Daughter(posTrack, 1, CFTrigger::kDaughProton, nSigmaTPCPos)) { - return false; - } - if (!isSelectedV0Daughter(negTrack, -1, CFTrigger::kDaughPion, nSigmaTPCNeg)) { - return false; - } - } - if (charge < 0) { - if (!isSelectedV0Daughter(posTrack, 1, CFTrigger::kDaughPion, nSigmaTPCPos)) { - return false; - } - if (!isSelectedV0Daughter(negTrack, -1, CFTrigger::kDaughProton, nSigmaTPCNeg)) { - return false; - } - } - return true; - } - - float getkstar(const ROOT::Math::PtEtaPhiMVector part1, - const ROOT::Math::PtEtaPhiMVector part2) - { - const ROOT::Math::PtEtaPhiMVector trackSum = part1 + part2; - const float beta = trackSum.Beta(); - const float betax = - beta * std::cos(trackSum.Phi()) * std::sin(trackSum.Theta()); - const float betay = - beta * std::sin(trackSum.Phi()) * std::sin(trackSum.Theta()); - const float betaz = beta * std::cos(trackSum.Theta()); - ROOT::Math::PxPyPzMVector PartOneCMS(part1); - ROOT::Math::PxPyPzMVector PartTwoCMS(part2); - const ROOT::Math::Boost boostPRF = - ROOT::Math::Boost(-betax, -betay, -betaz); - PartOneCMS = boostPRF(PartOneCMS); - PartTwoCMS = boostPRF(PartTwoCMS); - const ROOT::Math::PxPyPzMVector trackRelK = PartOneCMS - PartTwoCMS; - return 0.5 * trackRelK.P(); - } - - ROOT::Math::PxPyPzEVector getqij(const ROOT::Math::PtEtaPhiMVector parti, - const ROOT::Math::PtEtaPhiMVector partj) - { - ROOT::Math::PxPyPzEVector vecparti(parti); - ROOT::Math::PxPyPzEVector vecpartj(partj); - ROOT::Math::PxPyPzEVector trackSum = vecparti + vecpartj; - ROOT::Math::PxPyPzEVector trackDifference = vecparti - vecpartj; - float scaling = trackDifference.Dot(trackSum) / trackSum.Dot(trackSum); - return trackDifference - scaling * trackSum; - } - float getQ3(const ROOT::Math::PtEtaPhiMVector part1, - const ROOT::Math::PtEtaPhiMVector part2, - const ROOT::Math::PtEtaPhiMVector part3) - { - ROOT::Math::PxPyPzEVector q12 = getqij(part1, part2); - ROOT::Math::PxPyPzEVector q23 = getqij(part2, part3); - ROOT::Math::PxPyPzEVector q31 = getqij(part3, part1); - float Q32 = q12.M2() + q23.M2() + q31.M2(); - return sqrt(-Q32); - } - - std::vector setValuesBB(aod::BCsWithTimestamps::iterator const& bunchCrossing, const std::string ccdbPath) - { - std::map metadata; - auto h = ccdbApi.retrieveFromTFileAny(ccdbPath, metadata, bunchCrossing.timestamp()); - // auto h = ccdb->getForTimeStamp(ccdbPath, bunchCrossing.timestamp()); //check if possible to use this without getting fatal - if (!h) { - std::vector dummy; - LOG(info) << "File from CCDB in path " << ccdbPath << " was not found for run " << bunchCrossing.runNumber() << ". Will use default PID task values!"; - return dummy; - } - LOG(info) << "File from CCDB in path " << ccdbPath << " was found for run " << bunchCrossing.runNumber() << "!"; - - TAxis* axis = h->GetXaxis(); - std::vector v{static_cast(h->GetBinContent(axis->FindBin("bb1"))), - static_cast(h->GetBinContent(axis->FindBin("bb2"))), - static_cast(h->GetBinContent(axis->FindBin("bb3"))), - static_cast(h->GetBinContent(axis->FindBin("bb4"))), - static_cast(h->GetBinContent(axis->FindBin("bb5"))), - static_cast(h->GetBinContent(axis->FindBin("Resolution")))}; - return v; - } - - std::vector setValuesAvg(aod::BCsWithTimestamps::iterator const& bunchCrossing, const std::string ccdbPath) - { - std::map metadata; - auto h = ccdbApi.retrieveFromTFileAny(ccdbPath, metadata, bunchCrossing.timestamp()); - // auto h = ccdb->getForTimeStamp(ccdbPath, bunchCrossing.timestamp()); //check if possible to use this without getting fatal - if (!h) { - std::vector dummy{ConfPIDTPCTOFAvg->get("Proton", "TPC Avg"), - ConfPIDTPCTOFAvg->get("Proton", "TOF Avg"), - ConfPIDTPCTOFAvg->get("AntiProton", "TPC Avg"), - ConfPIDTPCTOFAvg->get("AntiProton", "TOF Avg"), - ConfPIDTPCTOFAvg->get("Deuteron", "TPC Avg"), - ConfPIDTPCTOFAvg->get("Deuteron", "TOF Avg"), - ConfPIDTPCTOFAvg->get("AntiDeuteron", "TPC Avg"), - ConfPIDTPCTOFAvg->get("AntiDeuteron", "TOF Avg")}; - LOG(info) << "File from CCDB in path " << ccdbPath << " was not found for run " << bunchCrossing.runNumber() << ". Will use constant values from ConfPIDTPCTOFAvg!"; - return dummy; - } - LOG(info) << "File from CCDB in path " << ccdbPath << " was found for run " << bunchCrossing.runNumber() << "!"; - - TAxis* axis = h->GetXaxis(); - std::vector v{static_cast(h->GetBinContent(axis->FindBin("TPCProton"))), - static_cast(h->GetBinContent(axis->FindBin("TOFProton"))), - static_cast(h->GetBinContent(axis->FindBin("TPCAntiproton"))), - static_cast(h->GetBinContent(axis->FindBin("TOFAntiproton"))), - static_cast(h->GetBinContent(axis->FindBin("TPCDeuteron"))), - static_cast(h->GetBinContent(axis->FindBin("TOFDeuteron"))), - static_cast(h->GetBinContent(axis->FindBin("TPCAntideuteron"))), - static_cast(h->GetBinContent(axis->FindBin("TOFAntideuteron")))}; - return v; - } - - template - double updatePID(T const& track, double bgScaling, std::vector BB) - { - double expBethe = tpc::BetheBlochAleph(static_cast(track.tpcInnerParam() * bgScaling), BB[0], BB[1], BB[2], BB[3], BB[4]); - double expSigma = expBethe * BB[5]; - return static_cast((track.tpcSignal() - expBethe) / expSigma); - } - - void process(aod::FemtoFullCollision const& col, aod::BCsWithTimestamps const&, aod::FemtoFullTracks const& tracks, o2::aod::V0Datas const& fullV0s) - { - - if (!ConfIsRun3) { - LOG(fatal) << "Run 2 processing is not implemented!"; - } - if (ConfUseManualPIDproton || ConfUseManualPIDdeuteron || ConfUseAvgFromCCDB) { - currentRunNumber = col.bc_as().runNumber(); - if (currentRunNumber != lastRunNumber) { - auto bc = col.bc_as(); - if (ConfUseManualPIDproton || ConfUseManualPIDdaughterProton) { - BBProton = setValuesBB(bc, ConfPIDBBProton); - BBAntiproton = setValuesBB(bc, ConfPIDBBAntiProton); - } - if (ConfUseManualPIDdeuteron) { - BBDeuteron = setValuesBB(bc, ConfPIDBBDeuteron); - BBAntideuteron = setValuesBB(bc, ConfPIDBBAntiDeuteron); - } - if (ConfUseManualPIDpion || ConfUseManualPIDdaughterPion) { - BBPion = setValuesBB(bc, ConfPIDBBPion); - BBAntipion = setValuesBB(bc, ConfPIDBBAntiPion); - } - if (ConfUseManualPIDpion) { - BBElectron = setValuesBB(bc, ConfPIDBBElectron); - BBAntielectron = setValuesBB(bc, ConfPIDBBAntiElectron); - } - if (ConfUseAvgFromCCDB) { - TPCTOFAvg = setValuesAvg(bc, ConfAvgPath); - } - lastRunNumber = currentRunNumber; - } - } - - registry.fill(HIST("fProcessedEvents"), 0); - registry.fill(HIST("EventCuts/fMultiplicityBefore"), col.multNTracksPV()); - registry.fill(HIST("EventCuts/fZvtxBefore"), col.posZ()); - - bool keepEvent3N[CFTrigger::kNThreeBodyTriggers] = {false, false, false, false}; - int lowQ3Triplets[CFTrigger::kNThreeBodyTriggers] = {0, 0, 0, 0}; - - bool keepEvent2N[CFTrigger::kNTwoBodyTriggers] = {false, false}; - int lowKstarPairs[CFTrigger::kNTwoBodyTriggers] = {0, 0}; - - std::vector childIDs = {0, 0}; - - // keep track of proton indices - std::vector ProtonIndex = {}; - std::vector AntiProtonIndex = {}; - - // keep track of daugher indices to avoid selfcorrelations - std::vector LambdaPosDaughIndex = {}; - std::vector LambdaNegDaughIndex = {}; - std::vector AntiLambdaPosDaughIndex = {}; - std::vector AntiLambdaNegDaughIndex = {}; - - // Prepare vectors for different species - std::vector protons, antiprotons, deuterons, antideuterons, lambdas, antilambdas; - - if (isSelectedEvent(col)) { - - registry.fill(HIST("EventCuts/fMultiplicityAfter"), col.multNTracksPV()); - registry.fill(HIST("EventCuts/fZvtxAfter"), col.posZ()); - - // create deuteron and proton vectors (and corresponding antiparticles) for pair and triplet creation - for (auto& track : tracks) { - - double nTPCSigmaP[2]{track.tpcNSigmaPr(), track.tpcNSigmaDe()}; - double nTPCSigmaN[2]{track.tpcNSigmaPr(), track.tpcNSigmaDe()}; - - if (ConfUseManualPIDproton) { - auto bgScalingProton = 1 / mMassProton; // momentum scaling? - if (BBProton.size() == 6) - nTPCSigmaP[0] = updatePID(track, bgScalingProton, BBProton); - if (BBAntiproton.size() == 6) - nTPCSigmaN[0] = updatePID(track, bgScalingProton, BBAntiproton); - } - if (ConfUseManualPIDdeuteron) { - auto bgScalingDeuteron = 1 / mMassDeuteron; // momentum scaling? - if (BBDeuteron.size() == 6) - nTPCSigmaP[1] = updatePID(track, bgScalingDeuteron, BBDeuteron); - if (BBAntideuteron.size() == 6) - nTPCSigmaN[1] = updatePID(track, bgScalingDeuteron, BBAntideuteron); - } - - registry.fill(HIST("TrackCuts/TracksBefore/fPtTrackBefore"), track.pt()); - registry.fill(HIST("TrackCuts/TracksBefore/fEtaTrackBefore"), track.eta()); - registry.fill(HIST("TrackCuts/TracksBefore/fPhiTrackBefore"), track.phi()); - - if (track.sign() > 0) { - // Fill PID info - registry.fill(HIST("TrackCuts/TPCSignal/fTPCSignal"), track.tpcInnerParam(), track.tpcSignal()); - registry.fill(HIST("TrackCuts/TPCSignal/fTPCSignalP"), track.p(), track.tpcSignal()); - if (isSelectedTrack(track, CFTrigger::kProton)) { - registry.fill(HIST("TrackCuts/TPCSignal/fTPCSignalALLCUTS"), track.tpcInnerParam(), track.tpcSignal()); - registry.fill(HIST("TrackCuts/TPCSignal/fTPCSignalALLCUTSP"), track.p(), track.tpcSignal()); - registry.fill(HIST("TrackCuts/TracksBefore/fMomCorrelationAfterCutsPos"), track.p(), track.tpcInnerParam()); - } - registry.fill(HIST("TrackCuts/NSigmaBefore/fNsigmaTPCvsPProtonBefore"), track.tpcInnerParam(), nTPCSigmaP[0]); - registry.fill(HIST("TrackCuts/NSigmaBefore/fNsigmaTOFvsPProtonBefore"), track.tpcInnerParam(), track.tofNSigmaPr()); - registry.fill(HIST("TrackCuts/NSigmaBefore/fNsigmaTPCTOFvsPProtonBefore"), track.tpcInnerParam(), std::sqrt(std::pow(nTPCSigmaP[0] - TPCTOFAvg[0], 2) + std::pow(track.tofNSigmaPr() - TPCTOFAvg[1], 2))); - registry.fill(HIST("TrackCuts/TracksBefore/fMomCorrelationPos"), track.p(), track.tpcInnerParam()); - } - if (track.sign() < 0) { - - registry.fill(HIST("TrackCuts/TPCSignal/fTPCSignalAnti"), track.tpcInnerParam(), track.tpcSignal()); - registry.fill(HIST("TrackCuts/TPCSignal/fTPCSignalAntiP"), track.p(), track.tpcSignal()); - if (isSelectedTrack(track, CFTrigger::kProton)) { - registry.fill(HIST("TrackCuts/TPCSignal/fTPCSignalAntiALLCUTS"), track.tpcInnerParam(), track.tpcSignal()); - registry.fill(HIST("TrackCuts/TPCSignal/fTPCSignalAntiALLCUTSP"), track.p(), track.tpcSignal()); - registry.fill(HIST("TrackCuts/TracksBefore/fMomCorrelationAfterCutsNeg"), track.p(), track.tpcInnerParam()); - } - - registry.fill(HIST("TrackCuts/NSigmaBefore/fNsigmaTPCvsPAntiProtonBefore"), track.tpcInnerParam(), nTPCSigmaN[0]); - registry.fill(HIST("TrackCuts/NSigmaBefore/fNsigmaTOFvsPAntiProtonBefore"), track.tpcInnerParam(), track.tofNSigmaPr()); - registry.fill(HIST("TrackCuts/NSigmaBefore/fNsigmaTPCTOFvsPAntiProtonBefore"), track.tpcInnerParam(), std::sqrt(std::pow(nTPCSigmaN[0] - TPCTOFAvg[2], 2) + std::pow(track.tofNSigmaPr() - TPCTOFAvg[3], 2))); - } - - // get protons - if (isSelectedTrack(track, CFTrigger::kProton)) { - ROOT::Math::PtEtaPhiMVector temp(track.pt(), track.eta(), track.phi(), mMassProton); - if (track.sign() > 0 && isSelectedTrackPID(track, CFTrigger::kProton, false, nTPCSigmaP, 1)) { - protons.push_back(temp); - ProtonIndex.push_back(track.globalIndex()); - - registry.fill(HIST("TrackCuts/TracksBefore/fMomCorrelationAfterCutsProton"), track.p(), track.tpcInnerParam()); - - registry.fill(HIST("TrackCuts/TPCSignal/fTPCSignalProton"), track.tpcInnerParam(), track.tpcSignal()); - registry.fill(HIST("TrackCuts/Proton/fPProton"), track.p()); - registry.fill(HIST("TrackCuts/Proton/fPTPCProton"), track.tpcInnerParam()); - registry.fill(HIST("TrackCuts/Proton/fPtProton"), track.pt()); - registry.fill(HIST("TrackCuts/Proton/fEtaProton"), track.eta()); - registry.fill(HIST("TrackCuts/Proton/fPhiProton"), track.phi()); - registry.fill(HIST("TrackCuts/Proton/fNsigmaTPCvsPProton"), track.tpcInnerParam(), nTPCSigmaP[0]); - registry.fill(HIST("TrackCuts/Proton/fNsigmaTOFvsPProton"), track.tpcInnerParam(), track.tofNSigmaPr()); - registry.fill(HIST("TrackCuts/Proton/fNsigmaTPCTOFvsPProton"), track.tpcInnerParam(), std::sqrt(std::pow(nTPCSigmaP[0] - TPCTOFAvg[0], 2) + std::pow(track.tofNSigmaPr() - TPCTOFAvg[1], 2))); - - registry.fill(HIST("TrackCuts/Proton/fNsigmaTPCvsPProtonP"), track.p(), nTPCSigmaP[0]); - registry.fill(HIST("TrackCuts/Proton/fNsigmaTOFvsPProtonP"), track.p(), track.tofNSigmaPr()); - registry.fill(HIST("TrackCuts/Proton/fNsigmaTPCTOFvsPProtonP"), track.p(), std::sqrt(std::pow(nTPCSigmaP[0] - TPCTOFAvg[0], 2) + std::pow(track.tofNSigmaPr() - TPCTOFAvg[1], 2))); - - registry.fill(HIST("TrackCuts/Proton/fDCAxyProton"), track.dcaXY()); - registry.fill(HIST("TrackCuts/Proton/fDCAzProton"), track.dcaZ()); - registry.fill(HIST("TrackCuts/Proton/fTPCsClsProton"), track.tpcNClsShared()); - registry.fill(HIST("TrackCuts/Proton/fTPCcRowsProton"), track.tpcNClsCrossedRows()); - registry.fill(HIST("TrackCuts/Proton/fTrkTPCfClsProton"), track.tpcCrossedRowsOverFindableCls()); - registry.fill(HIST("TrackCuts/Proton/fTPCnclsProton"), track.tpcNClsFound()); - } - if (track.sign() < 0 && isSelectedTrackPID(track, CFTrigger::kProton, false, nTPCSigmaN, -1)) { - antiprotons.push_back(temp); - AntiProtonIndex.push_back(track.globalIndex()); - - registry.fill(HIST("TrackCuts/TracksBefore/fMomCorrelationAfterCutsAntiProton"), track.p(), track.tpcInnerParam()); - - registry.fill(HIST("TrackCuts/TPCSignal/fTPCSignalAntiProton"), track.tpcInnerParam(), track.tpcSignal()); - registry.fill(HIST("TrackCuts/AntiProton/fPtAntiProton"), track.pt()); - registry.fill(HIST("TrackCuts/AntiProton/fEtaAntiProton"), track.eta()); - registry.fill(HIST("TrackCuts/AntiProton/fPhiAntiProton"), track.phi()); - registry.fill(HIST("TrackCuts/AntiProton/fNsigmaTPCvsPAntiProton"), track.tpcInnerParam(), nTPCSigmaN[0]); - registry.fill(HIST("TrackCuts/AntiProton/fNsigmaTOFvsPAntiProton"), track.tpcInnerParam(), track.tofNSigmaPr()); - registry.fill(HIST("TrackCuts/AntiProton/fNsigmaTPCTOFvsPAntiProton"), track.tpcInnerParam(), std::sqrt(std::pow(nTPCSigmaN[0] - TPCTOFAvg[2], 2) + std::pow(track.tofNSigmaPr() - TPCTOFAvg[3], 2))); - - registry.fill(HIST("TrackCuts/AntiProton/fNsigmaTPCvsPAntiProtonP"), track.p(), nTPCSigmaN[0]); - registry.fill(HIST("TrackCuts/AntiProton/fNsigmaTOFvsPAntiProtonP"), track.p(), track.tofNSigmaPr()); - registry.fill(HIST("TrackCuts/AntiProton/fNsigmaTPCTOFvsPAntiProtonP"), track.p(), std::sqrt(std::pow(nTPCSigmaN[0] - TPCTOFAvg[2], 2) + std::pow(track.tofNSigmaPr() - TPCTOFAvg[3], 2))); - - registry.fill(HIST("TrackCuts/AntiProton/fDCAxyAntiProton"), track.dcaXY()); - registry.fill(HIST("TrackCuts/AntiProton/fDCAzAntiProton"), track.dcaZ()); - registry.fill(HIST("TrackCuts/AntiProton/fTPCsClsAntiProton"), track.tpcNClsShared()); - registry.fill(HIST("TrackCuts/AntiProton/fTPCcRowsAntiProton"), track.tpcNClsCrossedRows()); - registry.fill(HIST("TrackCuts/AntiProton/fTrkTPCfClsAntiProton"), track.tpcCrossedRowsOverFindableCls()); - registry.fill(HIST("TrackCuts/AntiProton/fTPCnclsAntiProton"), track.tpcNClsFound()); - } - } - } - - for (auto& v0 : fullV0s) { - - auto postrack = v0.template posTrack_as(); - auto negtrack = v0.template negTrack_as(); - double nTPCSigmaPos[2]{postrack.tpcNSigmaPr(), postrack.tpcNSigmaPi()}; - double nTPCSigmaNeg[2]{negtrack.tpcNSigmaPr(), negtrack.tpcNSigmaPi()}; - if (ConfUseManualPIDdaughterPion) { - auto bgScalingPion = 1 / mMassPion; // momentum scaling? - if (BBPion.size() == 6) - nTPCSigmaPos[1] = updatePID(postrack, bgScalingPion, BBPion); - if (BBAntipion.size() == 6) - nTPCSigmaNeg[1] = updatePID(negtrack, bgScalingPion, BBAntipion); - } - if (ConfUseManualPIDdaughterProton) { - auto bgScalingProton = 1 / mMassProton; // momentum scaling? - if (BBProton.size() == 6) - nTPCSigmaPos[0] = updatePID(postrack, bgScalingProton, BBProton); - if (BBAntiproton.size() == 6) - nTPCSigmaNeg[0] = updatePID(negtrack, bgScalingProton, BBAntiproton); - } - registry.fill(HIST("TrackCuts/V0Before/fPtLambdaBefore"), v0.pt()); - registry.fill(HIST("TrackCuts/V0Before/fInvMassLambdaBefore"), v0.mLambda()); - registry.fill(HIST("TrackCuts/V0Before/fInvMassAntiLambdaBefore"), v0.mAntiLambda()); - registry.fill(HIST("TrackCuts/V0Before/fInvMassLambdavsAntiLambda"), v0.mLambda(), v0.mAntiLambda()); - registry.fill(HIST("TrackCuts/V0Before/fInvMassV0BeforeKaonvsV0Before"), v0.mK0Short(), v0.mLambda()); - registry.fill(HIST("TrackCuts/V0Before/fV0DCADaugh"), v0.dcaV0daughters()); - registry.fill(HIST("TrackCuts/V0Before/fV0CPA"), v0.v0cosPA()); - registry.fill(HIST("TrackCuts/V0Before/fV0TranRad"), v0.v0radius()); - registry.fill(HIST("TrackCuts/V0Before/f0DecVtxX"), v0.x()); - registry.fill(HIST("TrackCuts/V0Before/f0DecVtxY"), v0.y()); - registry.fill(HIST("TrackCuts/V0Before/f0DecVtxZ"), v0.z()); - - registry.fill(HIST("TrackCuts/V0Before/PosDaughter/Eta"), postrack.eta()); - registry.fill(HIST("TrackCuts/V0Before/PosDaughter/DCAXY"), postrack.dcaXY()); - registry.fill(HIST("TrackCuts/V0Before/PosDaughter/fTPCncls"), postrack.tpcNClsFound()); - registry.fill(HIST("TrackCuts/V0Before/NegDaughter/Eta"), negtrack.eta()); - registry.fill(HIST("TrackCuts/V0Before/NegDaughter/DCAXY"), negtrack.dcaXY()); - registry.fill(HIST("TrackCuts/V0Before/NegDaughter/fTPCncls"), negtrack.tpcNClsFound()); - registry.fill(HIST("TrackCuts/V0Before/PosDaughter/fNsigmaTPCvsPProtonV0Daugh"), postrack.tpcInnerParam(), nTPCSigmaPos[0]); - registry.fill(HIST("TrackCuts/V0Before/NegDaughter/fNsigmaTPCvsPPionMinusV0Daugh"), negtrack.tpcInnerParam(), nTPCSigmaNeg[1]); - registry.fill(HIST("TrackCuts/V0Before/NegDaughter/fNsigmaTPCvsPAntiProtonV0Daugh"), negtrack.tpcInnerParam(), nTPCSigmaNeg[0]); - registry.fill(HIST("TrackCuts/V0Before/PosDaughter/fNsigmaTPCvsPPionPlusV0Daugh"), postrack.tpcInnerParam(), nTPCSigmaPos[1]); - - registry.fill(HIST("TrackCuts/NSigmaBefore/fNsigmaTPCvsPProtonV0DaughBefore"), postrack.tpcInnerParam(), nTPCSigmaPos[0]); - registry.fill(HIST("TrackCuts/NSigmaBefore/fNsigmaTPCvsPPionPlusAntiV0DaughBefore"), postrack.tpcInnerParam(), nTPCSigmaNeg[1]); - - registry.fill(HIST("TrackCuts/NSigmaBefore/fNsigmaTPCvsPPionMinusV0DaughBefore"), negtrack.tpcInnerParam(), nTPCSigmaNeg[1]); - registry.fill(HIST("TrackCuts/NSigmaBefore/fNsigmaTPCvsPAntiProtonAntiV0DaughBefore"), negtrack.tpcInnerParam(), nTPCSigmaNeg[0]); - - if (isSelectedMinimalV0(col, v0, postrack, negtrack, 1, nTPCSigmaPos, nTPCSigmaNeg)) { - ROOT::Math::PtEtaPhiMVector temp(v0.pt(), v0.eta(), v0.phi(), mMassLambda); - lambdas.push_back(temp); - LambdaPosDaughIndex.push_back(postrack.globalIndex()); - LambdaNegDaughIndex.push_back(negtrack.globalIndex()); - registry.fill(HIST("TrackCuts/TPCSignal/fTPCSignalProtonPlusV0Daughter"), postrack.tpcInnerParam(), postrack.tpcSignal()); - registry.fill(HIST("TrackCuts/TPCSignal/fTPCSignalPionMinusV0Daughter"), negtrack.tpcInnerParam(), negtrack.tpcSignal()); - registry.fill(HIST("TrackCuts/Lambda/fPtLambda"), v0.pt()); - registry.fill(HIST("TrackCuts/Lambda/fInvMassLambda"), v0.mLambda()); - registry.fill(HIST("TrackCuts/Lambda/fInvMassLambdaKaonvsLambda"), v0.mK0Short(), v0.mLambda()); - registry.fill(HIST("TrackCuts/Lambda/fV0DCADaugh"), v0.dcaV0daughters()); - registry.fill(HIST("TrackCuts/Lambda/fV0CPA"), v0.v0cosPA()); - registry.fill(HIST("TrackCuts/Lambda/fV0TranRad"), v0.v0radius()); - registry.fill(HIST("TrackCuts/Lambda/f0DecVtxX"), v0.x()); - registry.fill(HIST("TrackCuts/Lambda/f0DecVtxY"), v0.y()); - registry.fill(HIST("TrackCuts/Lambda/f0DecVtxZ"), v0.z()); - - registry.fill(HIST("TrackCuts/Lambda/PosDaughter/Eta"), postrack.eta()); - registry.fill(HIST("TrackCuts/Lambda/PosDaughter/DCAXY"), postrack.dcaXY()); - registry.fill(HIST("TrackCuts/Lambda/PosDaughter/fTPCncls"), postrack.tpcNClsFound()); - registry.fill(HIST("TrackCuts/Lambda/NegDaughter/Eta"), negtrack.eta()); - registry.fill(HIST("TrackCuts/Lambda/NegDaughter/DCAXY"), negtrack.dcaXY()); - registry.fill(HIST("TrackCuts/Lambda/NegDaughter/fTPCncls"), negtrack.tpcNClsFound()); - registry.fill(HIST("TrackCuts/Lambda/PosDaughter/fNsigmaTPCvsPProtonV0Daugh"), postrack.tpcInnerParam(), nTPCSigmaPos[0]); - registry.fill(HIST("TrackCuts/Lambda/NegDaughter/fNsigmaTPCvsPPionMinusV0Daugh"), negtrack.tpcInnerParam(), nTPCSigmaNeg[1]); - } - - if (isSelectedMinimalV0(col, v0, postrack, negtrack, -1, nTPCSigmaPos, nTPCSigmaNeg)) { - ROOT::Math::PtEtaPhiMVector temp(v0.pt(), v0.eta(), v0.phi(), mMassLambda); - antilambdas.push_back(temp); - AntiLambdaPosDaughIndex.push_back(postrack.globalIndex()); - AntiLambdaNegDaughIndex.push_back(negtrack.globalIndex()); - registry.fill(HIST("TrackCuts/TPCSignal/fTPCSignalPionPlusV0Daughter"), postrack.tpcInnerParam(), postrack.tpcSignal()); - registry.fill(HIST("TrackCuts/TPCSignal/fTPCSignalProtonMinusV0Daughter"), negtrack.tpcInnerParam(), negtrack.tpcSignal()); - registry.fill(HIST("TrackCuts/AntiLambda/fPtAntiLambda"), v0.pt()); - registry.fill(HIST("TrackCuts/AntiLambda/fInvMassAntiLambda"), v0.mAntiLambda()); - registry.fill(HIST("TrackCuts/AntiLambda/fInvMassAntiLambdaKaonvsAntiLambda"), v0.mK0Short(), v0.mAntiLambda()); - registry.fill(HIST("TrackCuts/AntiLambda/fV0DCADaugh"), v0.dcaV0daughters()); - registry.fill(HIST("TrackCuts/AntiLambda/fV0CPA"), v0.v0cosPA()); - registry.fill(HIST("TrackCuts/AntiLambda/fV0TranRad"), v0.v0radius()); - registry.fill(HIST("TrackCuts/AntiLambda/f0DecVtxX"), v0.x()); - registry.fill(HIST("TrackCuts/AntiLambda/f0DecVtxY"), v0.y()); - registry.fill(HIST("TrackCuts/AntiLambda/f0DecVtxZ"), v0.z()); - - registry.fill(HIST("TrackCuts/AntiLambda/PosDaughter/Eta"), postrack.eta()); - registry.fill(HIST("TrackCuts/AntiLambda/PosDaughter/DCAXY"), postrack.dcaXY()); - registry.fill(HIST("TrackCuts/AntiLambda/PosDaughter/fTPCncls"), postrack.tpcNClsFound()); - registry.fill(HIST("TrackCuts/AntiLambda/NegDaughter/Eta"), negtrack.eta()); - registry.fill(HIST("TrackCuts/AntiLambda/NegDaughter/DCAXY"), negtrack.dcaXY()); - registry.fill(HIST("TrackCuts/AntiLambda/NegDaughter/fTPCncls"), negtrack.tpcNClsFound()); - registry.fill(HIST("TrackCuts/AntiLambda/NegDaughter/fNsigmaTPCvsPAntiProtonAntiV0Daugh"), negtrack.tpcInnerParam(), nTPCSigmaNeg[0]); - registry.fill(HIST("TrackCuts/AntiLambda/PosDaughter/fNsigmaTPCvsPPionPlusAntiV0Daugh"), postrack.tpcInnerParam(), nTPCSigmaPos[1]); - } - } - float Q3 = 999.f, kstar = 999.f; - if (ConfTriggerSwitches->get("Switch", "ppp") > 0.) { - // ppp trigger - for (auto iProton1 = protons.begin(); iProton1 != protons.end(); ++iProton1) { - auto iProton2 = iProton1 + 1; - for (; iProton2 != protons.end(); ++iProton2) { - auto iProton3 = iProton2 + 1; - for (; iProton3 != protons.end(); ++iProton3) { - Q3 = getQ3(*iProton1, *iProton2, *iProton3); - registry.fill(HIST("ppp/fSE_particle"), Q3); - if (Q3 < ConfQ3Limits->get(static_cast(0), CFTrigger::kPPP)) { - lowQ3Triplets[CFTrigger::kPPP] += 1; - } - } - } - } - for (auto iAntiProton1 = antiprotons.begin(); iAntiProton1 != antiprotons.end(); ++iAntiProton1) { - auto iAntiProton2 = iAntiProton1 + 1; - for (; iAntiProton2 != antiprotons.end(); ++iAntiProton2) { - auto iAntiProton3 = iAntiProton2 + 1; - for (; iAntiProton3 != antiprotons.end(); ++iAntiProton3) { - Q3 = getQ3(*iAntiProton1, *iAntiProton2, *iAntiProton3); - registry.fill(HIST("ppp/fSE_antiparticle"), Q3); - if (Q3 < ConfQ3Limits->get(static_cast(0), CFTrigger::kPPP)) { - lowQ3Triplets[CFTrigger::kPPP] += 1; - } - } - } - } - } - if (ConfTriggerSwitches->get("Switch", "ppL") > 0.) { - // ppl trigger - for (auto iProton1 = protons.begin(); iProton1 != protons.end(); ++iProton1) { - auto iProton2 = iProton1 + 1; - auto i1 = std::distance(protons.begin(), iProton1); - for (; iProton2 != protons.end(); ++iProton2) { - auto i2 = std::distance(protons.begin(), iProton2); - for (auto iLambda1 = lambdas.begin(); iLambda1 != lambdas.end(); ++iLambda1) { - auto i3 = std::distance(lambdas.begin(), iLambda1); - if (ConfAutocorRejection.value && - (ProtonIndex.at(i1) == LambdaPosDaughIndex.at(i3) || - ProtonIndex.at(i2) == LambdaPosDaughIndex.at(i3))) { - continue; - } - Q3 = getQ3(*iProton1, *iProton2, *iLambda1); - registry.fill(HIST("ppl/fSE_particle"), Q3); - if (Q3 < ConfQ3Limits->get(static_cast(0), CFTrigger::kPPL)) { - lowQ3Triplets[CFTrigger::kPPL] += 1; - } - } - } - } - for (auto iAntiProton1 = antiprotons.begin(); iAntiProton1 != antiprotons.end(); ++iAntiProton1) { - auto iAntiProton2 = iAntiProton1 + 1; - auto i1 = std::distance(antiprotons.begin(), iAntiProton1); - for (; iAntiProton2 != antiprotons.end(); ++iAntiProton2) { - auto i2 = std::distance(antiprotons.begin(), iAntiProton2); - for (auto iAntiLambda1 = antilambdas.begin(); iAntiLambda1 != antilambdas.end(); ++iAntiLambda1) { - auto i3 = std::distance(antilambdas.begin(), iAntiLambda1); - if (ConfAutocorRejection.value && - (AntiProtonIndex.at(i1) == AntiLambdaNegDaughIndex.at(i3) || - AntiProtonIndex.at(i2) == AntiLambdaNegDaughIndex.at(i3))) { - continue; - } - Q3 = getQ3(*iAntiProton1, *iAntiProton2, *iAntiLambda1); - registry.fill(HIST("ppl/fSE_antiparticle"), Q3); - if (Q3 < ConfQ3Limits->get(static_cast(0), CFTrigger::kPPL)) { - lowQ3Triplets[CFTrigger::kPPL] += 1; - } - } - } - } - } - if (ConfTriggerSwitches->get("Switch", "pLL") > 0.) { - // pll trigger - for (auto iLambda1 = lambdas.begin(); iLambda1 != lambdas.end(); ++iLambda1) { - auto iLambda2 = iLambda1 + 1; - auto i1 = std::distance(lambdas.begin(), iLambda1); - for (; iLambda2 != lambdas.end(); ++iLambda2) { - auto i2 = std::distance(lambdas.begin(), iLambda2); - if (ConfAutocorRejection.value && - (LambdaPosDaughIndex.at(i1) == LambdaPosDaughIndex.at(i2) || - LambdaNegDaughIndex.at(i1) == LambdaNegDaughIndex.at(i2))) { - continue; - } - for (auto iProton1 = protons.begin(); iProton1 != protons.end(); ++iProton1) { - auto i3 = std::distance(protons.begin(), iProton1); - if (ConfAutocorRejection.value && - (LambdaPosDaughIndex.at(i1) == ProtonIndex.at(i3) || - LambdaPosDaughIndex.at(i2) == ProtonIndex.at(i3))) { - continue; - } - Q3 = getQ3(*iLambda1, *iLambda2, *iProton1); - registry.fill(HIST("pll/fSE_particle"), Q3); - if (Q3 < ConfQ3Limits->get(static_cast(0), CFTrigger::kPLL)) { - lowQ3Triplets[CFTrigger::kPLL] += 1; - } - } - } - } - for (auto iAntiLambda1 = antilambdas.begin(); iAntiLambda1 != antilambdas.end(); ++iAntiLambda1) { - auto iAntiLambda2 = iAntiLambda1 + 1; - auto i1 = std::distance(antilambdas.begin(), iAntiLambda1); - for (; iAntiLambda2 != antilambdas.end(); ++iAntiLambda2) { - auto i2 = std::distance(antilambdas.begin(), iAntiLambda2); - if (ConfAutocorRejection.value && - (AntiLambdaPosDaughIndex.at(i1) == AntiLambdaPosDaughIndex.at(i2) || - AntiLambdaNegDaughIndex.at(i1) == AntiLambdaNegDaughIndex.at(i2))) { - continue; - } - for (auto iAntiProton1 = antiprotons.begin(); iAntiProton1 != antiprotons.end(); ++iAntiProton1) { - auto i3 = std::distance(antiprotons.begin(), iAntiProton1); - if (ConfAutocorRejection.value && - (AntiLambdaNegDaughIndex.at(i1) == AntiProtonIndex.at(i3) || - AntiLambdaNegDaughIndex.at(i2) == AntiProtonIndex.at(i3))) { - continue; - } - Q3 = getQ3(*iAntiLambda1, *iAntiLambda2, *iAntiProton1); - registry.fill(HIST("pll/fSE_antiparticle"), Q3); - if (Q3 < ConfQ3Limits->get(static_cast(0), CFTrigger::kPLL)) { - lowQ3Triplets[CFTrigger::kPLL] += 1; - } - } - } - } - } - if (ConfTriggerSwitches->get("Switch", "LLL") > 0.) { - // lll trigger - for (auto iLambda1 = lambdas.begin(); iLambda1 != lambdas.end(); ++iLambda1) { - auto iLambda2 = iLambda1 + 1; - auto i1 = std::distance(lambdas.begin(), iLambda1); - for (; iLambda2 != lambdas.end(); ++iLambda2) { - auto i2 = std::distance(lambdas.begin(), iLambda2); - if (ConfAutocorRejection.value && - (LambdaPosDaughIndex.at(i1) == LambdaPosDaughIndex.at(i2) || - LambdaNegDaughIndex.at(i1) == LambdaNegDaughIndex.at(i2))) { - continue; - } - auto iLambda3 = iLambda2 + 1; - for (; iLambda3 != lambdas.end(); ++iLambda3) { - auto i3 = std::distance(lambdas.begin(), iLambda3); - if (ConfAutocorRejection.value && - (LambdaPosDaughIndex.at(i1) == LambdaPosDaughIndex.at(i3) || - LambdaNegDaughIndex.at(i1) == LambdaNegDaughIndex.at(i3) || - LambdaPosDaughIndex.at(i2) == LambdaPosDaughIndex.at(i3) || - LambdaNegDaughIndex.at(i2) == LambdaNegDaughIndex.at(i3))) { - continue; - } - Q3 = getQ3(*iLambda1, *iLambda2, *iLambda3); - registry.fill(HIST("lll/fSE_particle"), Q3); - if (Q3 < ConfQ3Limits->get(static_cast(0), CFTrigger::kLLL)) { - lowQ3Triplets[CFTrigger::kLLL] += 1; - } - } - } - } - for (auto iAntiLambda1 = antilambdas.begin(); iAntiLambda1 != antilambdas.end(); ++iAntiLambda1) { - auto iAntiLambda2 = iAntiLambda1 + 1; - auto i1 = std::distance(antilambdas.begin(), iAntiLambda1); - for (; iAntiLambda2 != antilambdas.end(); ++iAntiLambda2) { - auto i2 = std::distance(antilambdas.begin(), iAntiLambda2); - if (ConfAutocorRejection.value && - (AntiLambdaPosDaughIndex.at(i1) == AntiLambdaPosDaughIndex.at(i2) || - AntiLambdaNegDaughIndex.at(i1) == AntiLambdaNegDaughIndex.at(i2))) { - continue; - } - auto iAntiLambda3 = iAntiLambda2 + 1; - for (; iAntiLambda3 != antilambdas.end(); ++iAntiLambda3) { - auto i3 = std::distance(antilambdas.begin(), iAntiLambda3); - if (ConfAutocorRejection.value && - (AntiLambdaPosDaughIndex.at(i1) == AntiLambdaPosDaughIndex.at(i3) || - AntiLambdaNegDaughIndex.at(i1) == AntiLambdaNegDaughIndex.at(i3) || - AntiLambdaPosDaughIndex.at(i2) == AntiLambdaPosDaughIndex.at(i3) || - AntiLambdaNegDaughIndex.at(i2) == AntiLambdaNegDaughIndex.at(i3))) { - continue; - } - Q3 = getQ3(*iAntiLambda1, *iAntiLambda2, *iAntiLambda3); - registry.fill(HIST("lll/fSE_antiparticle"), Q3); - if (Q3 < ConfQ3Limits->get(static_cast(0), CFTrigger::kLLL)) { - lowQ3Triplets[CFTrigger::kLLL] += 1; - } - } - } - } - } - if (ConfTriggerSwitches->get("Switch", "pp") > 0.) { - // pp trigger - for (auto iProton1 = protons.begin(); iProton1 != protons.end(); ++iProton1) { - auto iProton2 = iProton1 + 1; - for (; iProton2 != protons.end(); ++iProton2) { - kstar = getkstar(*iProton1, *iProton2); - registry.fill(HIST("pp/fSE_particle"), kstar); - if (kstar < ConfKstarLimits->get(static_cast(0), CFTrigger::kPP)) { - lowKstarPairs[CFTrigger::kPP] += 1; - } - } - } - for (auto iAntiProton1 = antiprotons.begin(); iAntiProton1 != antiprotons.end(); ++iAntiProton1) { - auto iAntiProton2 = iAntiProton1 + 1; - for (; iAntiProton2 != antiprotons.end(); ++iAntiProton2) { - kstar = getkstar(*iAntiProton1, *iAntiProton2); - registry.fill(HIST("pp/fSE_antiparticle"), kstar); - if (kstar < ConfKstarLimits->get(static_cast(0), CFTrigger::kPP)) { - lowKstarPairs[CFTrigger::kPP] += 1; - } - } - } - } - if (ConfTriggerSwitches->get("Switch", "pL") > 0.) { - // pL trigger - for (auto iProton = protons.begin(); iProton != protons.end(); ++iProton) { - auto i1 = std::distance(protons.begin(), iProton); - for (auto iLambda = lambdas.begin(); iLambda != lambdas.end(); ++iLambda) { - auto i2 = std::distance(lambdas.begin(), iLambda); - if (ConfAutocorRejection.value && - ProtonIndex.at(i1) == LambdaPosDaughIndex.at(i2)) { - continue; - } - kstar = getkstar(*iProton, *iLambda); - if (kstar < ConfKstarLimits->get(static_cast(0), CFTrigger::kPL)) { - registry.fill(HIST("pl/fSE_particle"), kstar); - lowKstarPairs[CFTrigger::kPL] += 1; - } - } - } - for (auto iAntiProton = antiprotons.begin(); iAntiProton != antiprotons.end(); ++iAntiProton) { - auto i1 = std::distance(antiprotons.begin(), iAntiProton); - for (auto iAntiLambda = antilambdas.begin(); iAntiLambda != antilambdas.end(); ++iAntiLambda) { - auto i2 = std::distance(antilambdas.begin(), iAntiLambda); - if (ConfAutocorRejection.value && - AntiProtonIndex.at(i1) == AntiLambdaNegDaughIndex.at(i2)) { - continue; - } - kstar = getkstar(*iAntiProton, *iAntiLambda); - if (kstar < ConfKstarLimits->get(static_cast(0), CFTrigger::kPL)) { - registry.fill(HIST("pl/fSE_antiparticle"), kstar); - lowKstarPairs[CFTrigger::kPL] += 1; - } - } - } - } - - // create tags for three body triggers - if (lowQ3Triplets[CFTrigger::kPPP] > 0) { - keepEvent3N[CFTrigger::kPPP] = true; - registry.fill(HIST("fProcessedEvents"), 2); - registry.fill(HIST("ppp/fMultiplicity"), col.multNTracksPV()); - registry.fill(HIST("ppp/fZvtx"), col.posZ()); - } - if (lowQ3Triplets[CFTrigger::kPPL] > 0) { - keepEvent3N[CFTrigger::kPPL] = true; - registry.fill(HIST("fProcessedEvents"), 3); - registry.fill(HIST("ppl/fMultiplicity"), col.multNTracksPV()); - registry.fill(HIST("ppl/fZvtx"), col.posZ()); - } - if (lowQ3Triplets[CFTrigger::kPLL] > 0) { - keepEvent3N[CFTrigger::kPLL] = true; - registry.fill(HIST("fProcessedEvents"), 4); - registry.fill(HIST("pll/fMultiplicity"), col.multNTracksPV()); - registry.fill(HIST("pll/fZvtx"), col.posZ()); - } - if (lowQ3Triplets[CFTrigger::kLLL] > 0) { - keepEvent3N[CFTrigger::kLLL] = true; - registry.fill(HIST("fProcessedEvents"), 5); - registry.fill(HIST("lll/fMultiplicity"), col.multNTracksPV()); - registry.fill(HIST("lll/fZvtx"), col.posZ()); - } - // create tags for two body triggers - if (lowKstarPairs[CFTrigger::kPP] > 0) { - keepEvent2N[CFTrigger::kPP] = true; - registry.fill(HIST("fProcessedEvents"), 6); - registry.fill(HIST("pp/fMultiplicity"), col.multNTracksPV()); - registry.fill(HIST("pp/fZvtx"), col.posZ()); - } - if (lowKstarPairs[CFTrigger::kPL] > 0) { - keepEvent2N[CFTrigger::kPL] = true; - registry.fill(HIST("fProcessedEvents"), 7); - registry.fill(HIST("pl/fMultiplicity"), col.multNTracksPV()); - registry.fill(HIST("pl/fZvtx"), col.posZ()); - } - - if (ConfKeepAllSelectedParticles.value || - keepEvent3N[CFTrigger::kPPP] || keepEvent3N[CFTrigger::kPPL] || keepEvent3N[CFTrigger::kPLL] || keepEvent3N[CFTrigger::kLLL] || - keepEvent2N[CFTrigger::kPP] || keepEvent2N[CFTrigger::kPL]) { - - outputCollision(col.posZ(), col.multFV0M(), col.multNTracksPV(), -2, -2); - - registry.fill(HIST("fProcessedEvents"), 1); - - for (auto proton : protons) { - outputParts(outputCollision.lastIndex(), - proton.pt(), - proton.eta(), - proton.phi(), - aod::femtodreamparticle::ParticleType::kTrack, - static_cast(ConfCutBitPart.value), // cutbit for particle - static_cast(ConfPidBitProton.value), - 0.f, - childIDs, - 0.f, - 0.f); - } - - for (auto antiproton : antiprotons) { - outputParts(outputCollision.lastIndex(), - antiproton.pt(), - antiproton.eta(), - antiproton.phi(), - aod::femtodreamparticle::ParticleType::kTrack, - static_cast(ConfCutBitAntiPart.value), // cutbit for antiparticle - static_cast(ConfPidBitProton.value), - 0.f, - childIDs, - 0.f, - 0.f); - } - - for (auto lambda : lambdas) { - outputParts(outputCollision.lastIndex(), - lambda.pt(), - lambda.eta(), - lambda.phi(), - aod::femtodreamparticle::ParticleType::kV0, - static_cast(ConfCutBitV0.value), - static_cast(ConfPidBitV0.value), - 0.f, - childIDs, - 0.f, - 0.f); - } - - for (auto antilambda : antilambdas) { - outputParts(outputCollision.lastIndex(), - antilambda.pt(), - antilambda.eta(), - antilambda.phi(), - aod::femtodreamparticle::ParticleType::kV0, - static_cast(ConfCutBitAntiV0.value), - static_cast(ConfPidBitV0.value), - 0.f, - childIDs, - 0.f, - 0.f); - } - } - } - } -}; - -WorkflowSpec - defineDataProcessing(ConfigContext const& cfg) -{ - return WorkflowSpec{adaptAnalysisTask(cfg)}; -} diff --git a/EventFiltering/PWGCF/CFFilterTwoN.cxx b/EventFiltering/PWGCF/CFFilterTwoN.cxx deleted file mode 100644 index 2d2b64a1088..00000000000 --- a/EventFiltering/PWGCF/CFFilterTwoN.cxx +++ /dev/null @@ -1,550 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file CFFilterTwoN.cxx -/// \brief Selection of events with different kind of pairs for femtoscopic studies -/// -/// \author Anton Riedel, TU München, anton.riedel@cern.ch - -#include -#include -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/HistogramRegistry.h" - -#include "../filterTables.h" -#include "../../PWGCF/FemtoDream/FemtoUtils.h" - -#include "PWGCF/DataModel/FemtoDerived.h" -#include "PWGCF/FemtoDream/FemtoDreamParticleHisto.h" -#include "PWGCF/FemtoDream/FemtoDreamPairCleaner.h" -#include "PWGCF/FemtoDream/FemtoDreamContainer.h" -#include "PWGCF/FemtoDream/FemtoDreamMath.h" -#include "PWGCF/FemtoDream/FemtoDreamPairCleaner.h" -#include "PWGCF/FemtoDream/FemtoDreamDetaDphiStar.h" -#include "PWGCF/FemtoDream/FemtoDreamContainer.h" - -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Multiplicity.h" -#include "CommonConstants/PhysicsConstants.h" - -#include - -namespace -{ - -enum kCFTwoBodyTriggers { - kPD, //=0 - kLD, //=1 - kLAST_CFTwoBodyTriggers -}; - -static const std::vector CfTriggerNames{"kPD", "kLD"}; -static constexpr uint8_t Track = 0; -static constexpr uint8_t V0 = 1; -// static constexpr uint8_t V0Daughter = 2; // V0 daughters - -static constexpr uint32_t kSignMinusMask = 1; -static constexpr uint32_t kSignPlusMask = 2; - -// static constexpr uint32_t knSigmaProton = 48; -static constexpr uint32_t kValue0 = 0; - -} // namespace - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; -using namespace o2::analysis::femtoDream; - -struct CFFilterTwoN { - SliceCache cache; - - Produces tags; - - Configurable confKstarTriggerLimit{"KstarTriggerLimitUpper", 1.0f, "Kstar limit for selection"}; - Configurable KstarTrigger{"KstarTrigger", 0, "Choice which trigger to run"}; - // 0 for pd - // 1 for ld - // 10 for both - - Configurable confProtonPtMin{"ProtonPtMin", 0.5, "Minimal Pt for Protons"}; - Configurable confProtonPtMax{"ProtonPtMax", 4.05, "Maximal Pt for Protons"}; - Configurable confPIDThreshold{"PThreshold", 0.75f, "P threshold for TPC/TPC&TOF selection (Protons only)"}; - - Configurable confDeuteronPtMin{"DeuteronPtMin", 0.5, "Minimal Pt for Deuterons"}; - Configurable confDeuteronPtMax{"DeuteronPtMax", 1.4, "Maximal Pt for Deuterons"}; - - Configurable confPIDnSigmaTPCAcceptance{"PIDnSigmaTPCPIDAcceptance", - 3., - "nSigmaTPC for accepting Protons and Deuterons (this value needs to be listed in PIDnSgimaTPCMax)"}; - // the value used in this configurable needs to one of the values listed in ConfPIDnSigmaTPCMax! - Configurable confPIDnSigmTPCTOFAcceptance{"PIDnSigmaTPCTOFPIDAcceptance", - 3., - "nSigmaTPCTOF for accepting Protons (this values needs to be listed in PIDnSigmaTPCMax)"}; - // the value used in this configurable needs to one of the values listed in ConfPIDnSigmaTPCMax! - - Configurable> ConfPIDnSigmaTPCMax{"PIDnSigmaTPCMax", - std::vector{3.5f, 3.f, 2.5f}, - "Vector of all possible nSigma values for Acceptance and Rejection (this needs to be in sync with FemtoDreamProducerTask.ConfTrkPIDnSigmaMax)"}; - // this configurable needs to be in sync with FemtoDreamProducerTask.ConfTrkPIDnSigmaMax - // do not use more than 3 values, otherwise the FemtoDreamProducerTask will break! - - Configurable confPIDRejection{"PIDRejection", 3.5, "nSigma for rejection bogus Deuterons (set it to a negative value to disable the rejection)"}; - // the value used in this configurable needs to one of the values listed in ConfPIDnSigmaTPCMax - // set it to a negative value to disable the rejection - - // suggestion for setting ConfTrkTPIDspecies of the FemtoDreamProducerTask - // ConfTrkTPIDspecies = {0, <- Electron PID at Index 0 - // 2, <- Pion PID at Index 1 - // 4, <- Proton PID at Index 2 - // 5} <- Deuteron PID at Index 3 - // total of 4 indices - // will become clear in the following - - Configurable confPIDProtonIndex{"PIDProtonIndex", 2, "Index of Proton PID in ConfTrkTPIDspecies of the FemtoDreamProducerTask"}; - Configurable confPIDDeuteronIndex{"PIDDeuteronIndex", 3, "Index of Deuteron PID in ConfTrkTPIDspecies of the FemtoDreamProducerTask"}; - Configurable confPIDIndexMax{"PIDIndexMax", 4, "Number of Indices in ConfTrkTPIDspecies of the FemtoDreamProducerTask"}; - - Configurable> ConfPIDRejectionSpeciesIndex{"PIDRejectionSpeciesIndex", std::vector{0, 1, 2}, "Indices of the particles we want to reject from the Deuteron signal"}; - // when configuring the FemtoDreamProducerTask, select for ConfTrkTPIDspecies at least Protons (=4) and Deuterons (=5) - // for the rejection to work properly also select electron (=0) and pions (=2) - // suppose the FemtoDreamProducerTask is configured as above - // and we want to rejection electrons (at index 0), pions (at index 1) and proton (at index 2) - // set this configurable to PIDRejectionSpeciesIndex = {1,2,3} - - Configurable ConfClosePairRejection{"ClosePairRejection", true, "Reject close pairs or not"}; - Configurable - ldeltaPhiMax{"ldeltaPhiMax", 0.010, "Max limit of delta phi"}; - Configurable ldeltaEtaMax{"ldeltaEtaMax", 0.010, "Max limit of delta eta"}; - - // obtain particle candidates of protons, deuterons as well as antiprotons and antideuterons - Partition partPD = (o2::aod::femtodreamparticle::partType == Track) && - ((o2::aod::femtodreamparticle::cut & kSignPlusMask) > kValue0); - Partition partAntiPD = (o2::aod::femtodreamparticle::partType == Track) && - ((o2::aod::femtodreamparticle::cut & kSignMinusMask) > kValue0); - // obtain lambdas and antilambdas - Partition partL = (o2::aod::femtodreamparticle::partType == V0) && - ((o2::aod::femtodreamparticle::cut & kSignPlusMask) > kValue0); - Partition partAntiL = (o2::aod::femtodreamparticle::partType == V0) && - ((o2::aod::femtodreamparticle::cut & kSignMinusMask) > kValue0); - - Preslice perCol = aod::femtodreamparticle::femtoDreamCollisionId; - - HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry registryQA{"registryQA", {}, OutputObjHandlingPolicy::AnalysisObject}; - - // containers for close pair rejection - FemtoDreamDetaDphiStar closePairRejectionTT; - FemtoDreamDetaDphiStar closePairRejectionTV0; - - bool SelectParticlePID(aod::femtodreamparticle::cutContainerType const& pidCut, int vSpecies, float momentum) - { - bool pidSelection = false; - bool rejectDeuteron = false; - if (vSpecies == o2::track::PID::Proton) { - // use momentum dependend (TPC or TPC&TOF) pid selection for protons - pidSelection = isFullPIDSelected(pidCut, - momentum, - confPIDThreshold.value, - std::vector{confPIDProtonIndex.value}, - confPIDIndexMax.value, - ConfPIDnSigmaTPCMax.value, - confPIDnSigmaTPCAcceptance.value, - confPIDnSigmTPCTOFAcceptance.value); - } else if (vSpecies == o2::track::PID::Deuteron) { - // use additional rejection for deuterons - if (confPIDRejection.value > 0.) { - for (auto rejectSpecies : ConfPIDRejectionSpeciesIndex.value) { - // if the PID is selected for another particle species, reject this candidate - rejectDeuteron = isPIDSelected(pidCut, std::vector{rejectSpecies}, - confPIDIndexMax.value, - confPIDRejection.value, - ConfPIDnSigmaTPCMax.value, - kDetector::kTPC); - // if a deuteron candidate is found which could also be another particle we want to reject, break out of the loop - if (rejectDeuteron) { - break; - } - } - } - // and reject the candidate, otherwise check if it is fullfills the deuteron hypothesis - if (!rejectDeuteron) { - pidSelection = isPIDSelected(pidCut, - std::vector{confPIDDeuteronIndex.value}, - confPIDIndexMax.value, - confPIDnSigmaTPCAcceptance.value, - ConfPIDnSigmaTPCMax.value, - kDetector::kTPC); - } - } else { - LOG(fatal) << "Other PID selections are not supported by this trigger" << std::endl; - } - return pidSelection; - } - - void - init(o2::framework::InitContext&) - { - registry.add("fProcessedEvents", "CF Two Body - event filtered;;events}", HistType::kTH1F, {{2 + kLAST_CFTwoBodyTriggers, 0, 2 + kLAST_CFTwoBodyTriggers}}); - - std::array eventTitles = {"all", "rejected", "p-d", "l-d"}; - for (size_t iBin = 0; iBin < eventTitles.size(); iBin++) { - registry.get(HIST("fProcessedEvents"))->GetXaxis()->SetBinLabel(iBin + 1, eventTitles[iBin].data()); - } - - registry.add("fMultiplicityBefore", "Multiplicity before trigger", HistType::kTH1F, {{1000, 0, 1000}}); - registry.add("fMultiplicityAfter", "Multiplicity after trigger", HistType::kTH1F, {{1000, 0, 1000}}); - registry.add("fZvtxBefore", "Zvtx before trigger", HistType::kTH1F, {{1000, -15, 15}}); - registry.add("fZvtxAfter", "Zvtx after trigger", HistType::kTH1F, {{1000, -15, 15}}); - - registry.add("fPtBeforeSel", "Transverse momentum of positive tracks", HistType::kTH1F, {{6000, 0, 6}}); - registry.add("fEtaBeforeSel", "Pseudorapidity of positive tracks", HistType::kTH1F, {{1000, -1, 1}}); - registry.add("fPhiBeforeSel", "Azimuthal angle of positive tracks", HistType::kTH1F, {{1000, 0, TMath::TwoPi()}}); - - registry.add("fPtAntiBeforeSel", "Transverse momentum of negative tracks", HistType::kTH1F, {{6000, 0, 6}}); - registry.add("fEtaAntiBeforeSel", "Pseudorapidity of negative tracks", HistType::kTH1F, {{1000, -1, 1}}); - registry.add("fPhiAntiBeforeSel", "Azimuthal angle of negative tracks", HistType::kTH1F, {{1000, 0, TMath::TwoPi()}}); - - bool plotPerRadii = true; - - if (KstarTrigger.value == 0 || KstarTrigger.value == 10) { - registry.add("fKstarPD", "CF - same event pd distribution for particles;;events", HistType::kTH1F, {{8000, 0, 8}}); - registry.add("fKstarAntiPD", "CF - same event pd distribution for antiparticles;;events", HistType::kTH1F, {{8000, 0, 8}}); - - registry.add("fPtProtonAfterSel", "Transverse momentum of Protons which passed selections", HistType::kTH1F, {{6000, 0, 6}}); - registry.add("fEtaProtonAfterSel", "Pseudorapidity of Protons which passed selections", HistType::kTH1F, {{1000, -1, 1}}); - registry.add("fPhiProtonAfterSel", "Azimuthal angle of Protons which passed selections", HistType::kTH1F, {{1000, 0, TMath::TwoPi()}}); - - registry.add("fPtAntiProtonAfterSel", "Transverse momentum of Protons which passed selections", HistType::kTH1F, {{6000, 0, 6}}); - registry.add("fEtaAntiProtonAfterSel", "Pseudorapidity of AntiProtons which passed selections", HistType::kTH1F, {{1000, -1, 1}}); - registry.add("fPhiAntiProtonAfterSel", "Azimuthal angle of AntiProtons which passed selections", HistType::kTH1F, {{1000, 0, TMath::TwoPi()}}); - - closePairRejectionTT.init(®istry, ®istryQA, ldeltaPhiMax, ldeltaEtaMax, plotPerRadii); - } - - if (KstarTrigger.value == 1 || KstarTrigger.value == 10) { - registry.add("fKstarLD", "CF - same event ld distribution for particles;;events", HistType::kTH1F, {{8000, 0, 8}}); - registry.add("fKstarAntiLD", "CF - same event ld distribution for antiparticles;;events", HistType::kTH1F, {{8000, 0, 8}}); - - registry.add("fPtLambdaAfterSel", "Transverse momentum of Lambdas which passed selections", HistType::kTH1F, {{6000, 0, 6}}); - registry.add("fPtAntiLambdaAfterSel", "Transverse momentum of AntidLambdas which passed selections", HistType::kTH1F, {{6000, 0, 6}}); - - registry.add("fMinvLambda", "Invariant mass of lambdas ", HistType::kTH1F, {{1000, 0.7, 1.5}}); - registry.add("fMinvAntiLambda", "Invariant mass of antilambdas ", HistType::kTH1F, {{1000, 0.7, 1.5}}); - - closePairRejectionTV0.init(®istry, ®istryQA, ldeltaPhiMax, ldeltaEtaMax, plotPerRadii); - } - - registry.add("fPtDeuteronAfterSel", "Transverse momentum of Deuterons which passed selections", HistType::kTH1F, {{6000, 0, 6}}); - registry.add("fEtaDeuteronAfterSel", "Pseudorapidity of Deuterons which passed selections", HistType::kTH1F, {{1000, -1, 1}}); - registry.add("fPhiDeuteronAfterSel", "Azimuthal angle of Deuterons which passed selections", HistType::kTH1F, {{1000, 0, TMath::TwoPi()}}); - - registry.add("fPtAntiDeuteronAfterSel", "Transverse momentum of Antideuterons which passed selections", HistType::kTH1F, {{6000, 0, 6}}); - registry.add("fEtaAntiDeuteronAfterSel", "Pseudorapidity of AntiDeuterons which passed selections", HistType::kTH1F, {{1000, -1, 1}}); - registry.add("fPhiAntiDeuteronAfterSel", "Azimuthal angle of AntiDeuterons which passed selections", HistType::kTH1F, {{1000, 0, TMath::TwoPi()}}); - } - - float mMassProton = TDatabasePDG::Instance()->GetParticle(2212)->Mass(); - float mMassDeuteron = o2::constants::physics::MassDeuteron; - float mMassLambda = TDatabasePDG::Instance()->GetParticle(3122)->Mass(); - - void process(o2::aod::FemtoDreamCollision& col, o2::aod::FemtoDreamParticles& partsFemto) - { - // get partitions of all paritcles and antiparticles - auto partsPD = partPD->sliceByCached(aod::femtodreamparticle::femtoDreamCollisionId, col.globalIndex(), cache); - auto partsAntiPD = partAntiPD->sliceByCached(aod::femtodreamparticle::femtoDreamCollisionId, col.globalIndex(), cache); - - // get partions of V0s - auto partsL = partL->sliceByCached(aod::femtodreamparticle::femtoDreamCollisionId, col.globalIndex(), cache); - auto partsAntiL = partAntiL->sliceByCached(aod::femtodreamparticle::femtoDreamCollisionId, col.globalIndex(), cache); - - // magnetic field is need for close pair rejection - auto magneticField = col.magField(); - - registry.fill(HIST("fProcessedEvents"), 0); - registry.fill(HIST("fMultiplicityBefore"), col.multV0M()); - registry.fill(HIST("fZvtxBefore"), col.posZ()); - - // pass through the particles once to check if there are any particles of interest in the first place - int Nproton = 0; - int Nantiproton = 0; - int Nlambda = 0; - int Nantilambda = 0; - int Ndeuteron = 0; - int Nantideuteron = 0; - - for (auto pd : partsPD) { - registry.fill(HIST("fPtBeforeSel"), pd.pt()); - registry.fill(HIST("fEtaBeforeSel"), pd.eta()); - registry.fill(HIST("fPhiBeforeSel"), pd.phi()); - - // select deuterons - if (SelectParticlePID(pd.pidcut(), o2::track::PID::Deuteron, pd.p()) && - pd.pt() < confDeuteronPtMax.value && - pd.pt() > confDeuteronPtMin.value) { - registry.fill(HIST("fPtDeuteronAfterSel"), pd.pt()); - registry.fill(HIST("fEtaDeuteronAfterSel"), pd.eta()); - registry.fill(HIST("fPhiDeuteronAfterSel"), pd.phi()); - Ndeuteron++; - } - - // select protons - if (KstarTrigger.value == 0 || KstarTrigger.value == 10) { - if (SelectParticlePID(pd.pidcut(), o2::track::PID::Proton, pd.p()) && - pd.pt() < confProtonPtMax.value && - pd.pt() > confProtonPtMin.value) { - registry.fill(HIST("fPtProtonAfterSel"), pd.pt()); - registry.fill(HIST("fEtaProtonAfterSel"), pd.eta()); - registry.fill(HIST("fPhiProtonAfterSel"), pd.phi()); - Nproton++; - } - } - } - - for (auto antipd : partsAntiPD) { - registry.fill(HIST("fPtAntiBeforeSel"), antipd.pt()); - registry.fill(HIST("fEtaAntiBeforeSel"), antipd.eta()); - registry.fill(HIST("fPhiAntiBeforeSel"), antipd.phi()); - - // select antideuterons - if (SelectParticlePID(antipd.pidcut(), o2::track::PID::Deuteron, antipd.p()) && - antipd.pt() < confDeuteronPtMax.value && - antipd.pt() > confDeuteronPtMin.value) { - registry.fill(HIST("fPtAntiDeuteronAfterSel"), antipd.pt()); - registry.fill(HIST("fEtaAntiDeuteronAfterSel"), antipd.eta()); - registry.fill(HIST("fPhiAntiDeuteronAfterSel"), antipd.phi()); - Nantideuteron++; - } - - // select antiprotons - if (KstarTrigger.value == 0 || KstarTrigger.value == 10) { - if (SelectParticlePID(antipd.pidcut(), o2::track::PID::Proton, antipd.p()) && - antipd.pt() < confProtonPtMax.value && - antipd.pt() > confProtonPtMin.value) { - registry.fill(HIST("fPtAntiProtonAfterSel"), antipd.pt()); - registry.fill(HIST("fEtaAntiProtonAfterSel"), antipd.eta()); - registry.fill(HIST("fPhiAntiProtonAfterSel"), antipd.phi()); - Nantiproton++; - } - } - } - - if (KstarTrigger.value == 1 || KstarTrigger.value == 10) { - // select lambdas - for (auto lambda : partsL) { - registry.fill(HIST("fPtLambdaAfterSel"), lambda.pt()); - registry.fill(HIST("fMinvLambda"), lambda.mLambda()); - Nlambda++; - } - for (auto antilambda : partsAntiL) { - // select antilambdas - registry.fill(HIST("fPtAntiLambdaAfterSel"), antilambda.pt()); - registry.fill(HIST("fMinvAntiLambda"), antilambda.mAntiLambda()); - Nantilambda++; - } - } - - bool keepEvent[kLAST_CFTwoBodyTriggers] = {false, false}; - int lowKstarPairs[kLAST_CFTwoBodyTriggers] = {0, 0}; - - bool pdPair = false; - bool dpPair = false; - double kStar = 0.; - - // trigger for pd pairs - if (KstarTrigger.value == 0 || KstarTrigger.value == 10) { - if (Ndeuteron > 0 && Nproton > 0) { - // loop over all unique combinations of particles, excluding the self combinations - for (auto& [p1, p2] : combinations(soa::CombinationsStrictlyUpperIndexPolicy(partsPD, partsPD))) { - - // check if it is a pd pair - // p1 => proton - // p2 => deuteron - if (SelectParticlePID(p1.pidcut(), o2::track::PID::Proton, p1.p()) && - SelectParticlePID(p2.pidcut(), o2::track::PID::Deuteron, p2.p()) && - p1.pt() < confProtonPtMax.value && - p1.pt() > confProtonPtMin.value && - p2.pt() < confDeuteronPtMax.value && - p2.pt() > confDeuteronPtMin.value) { - pdPair = true; - } else { - pdPair = false; - } - - // check if it is dp pair - // p1 => deuteron - // p2 => proton - if (SelectParticlePID(p1.pidcut(), o2::track::PID::Deuteron, p1.p()) && - SelectParticlePID(p2.pidcut(), o2::track::PID::Proton, p2.p()) && - p1.pt() < confDeuteronPtMax.value && - p1.pt() > confDeuteronPtMin.value && - p2.pt() < confProtonPtMax.value && - p2.pt() > confProtonPtMin.value) { - dpPair = true; - } else { - dpPair = false; - } - - // if neither is the case, skip - if (!(pdPair || dpPair)) { - continue; - } - - // reject close pairs - if (ConfClosePairRejection.value && closePairRejectionTT.isClosePair(p1, p2, partsFemto, magneticField)) { - continue; - } - - // compute kstar depending on the pairing - if (pdPair) { - kStar = FemtoDreamMath::getkstar(p1, mMassProton, p2, mMassDeuteron); - } else if (dpPair) { - kStar = FemtoDreamMath::getkstar(p1, mMassDeuteron, p2, mMassProton); - } else { - kStar = confKstarTriggerLimit; - } - // check if the kstar is below threshold - if (kStar < confKstarTriggerLimit.value) { - lowKstarPairs[kPD]++; - registry.fill(HIST("fKstarPD"), kStar); - } - } - } - - if (Nantideuteron > 0 && Nantiproton > 0) { - // loop over all unique combinations of antiparticles, excluding the self combinations - for (auto& [p1, p2] : combinations(soa::CombinationsStrictlyUpperIndexPolicy(partsAntiPD, partsAntiPD))) { - - // check if it is a (anti)pd pair - // p1 => antiproton - // p2 => antideuteron - if (SelectParticlePID(p1.pidcut(), o2::track::PID::Proton, p1.p()) && - SelectParticlePID(p2.pidcut(), o2::track::PID::Deuteron, p2.p()) && - p1.pt() < confProtonPtMax.value && - p1.pt() > confProtonPtMin.value && - p2.pt() < confDeuteronPtMax.value && - p2.pt() > confDeuteronPtMin.value) { - pdPair = true; - } else { - pdPair = false; - } - - // check if it is (anti)dp pair - // p1 => antideuteron - // p2 => antiproton - if (SelectParticlePID(p1.pidcut(), o2::track::PID::Deuteron, p1.p()) && - SelectParticlePID(p2.pidcut(), o2::track::PID::Proton, p2.p()) && - p1.pt() < confDeuteronPtMax.value && - p1.pt() > confDeuteronPtMin.value && - p2.pt() < confProtonPtMax.value && - p2.pt() > confProtonPtMin.value) { - dpPair = true; - } else { - dpPair = false; - } - - // if neither is the case, skip - if (!(pdPair || dpPair)) { - continue; - } - - // reject close pairs - if (ConfClosePairRejection.value && closePairRejectionTT.isClosePair(p1, p2, partsFemto, magneticField)) { - continue; - } - - // compute kstar depending on the pairing - if (pdPair) { - kStar = FemtoDreamMath::getkstar(p1, mMassProton, p2, mMassDeuteron); - } else if (dpPair) { - kStar = FemtoDreamMath::getkstar(p1, mMassDeuteron, p2, mMassProton); - } else { - kStar = confKstarTriggerLimit; - } - - // check if the kstar is below threshold - if (kStar < confKstarTriggerLimit.value) { - lowKstarPairs[kPD]++; - registry.fill(HIST("fKstarAntiPD"), kStar); - } - } - } - } - - // trigger for ld pairs - if (KstarTrigger.value == 1 || KstarTrigger.value == 10) { - if (Ndeuteron > 0 && Nlambda > 0) { - // loop over all unique combinations - for (auto& [p1, p2] : combinations(soa::CombinationsUpperIndexPolicy(partsPD, partsL))) { - // check if the particle is a deuteron - // we do not need to check the V0s - if (!SelectParticlePID(p1.pidcut(), o2::track::PID::Deuteron, p1.p())) { - continue; - } - if (ConfClosePairRejection.value && closePairRejectionTV0.isClosePair(p1, p2, partsFemto, magneticField)) { - continue; - } - kStar = FemtoDreamMath::getkstar(p1, mMassDeuteron, p2, mMassLambda); - // check if kstar is below threshold - if (kStar < confKstarTriggerLimit.value) { - lowKstarPairs[1]++; - registry.fill(HIST("fKstarLD"), kStar); - } - } - } - if (Nantideuteron > 0 && Nantilambda > 0) { - for (auto& [p1, p2] : combinations(soa::CombinationsStrictlyUpperIndexPolicy(partsAntiPD, partsAntiL))) { - // check if the particle is a antideuteron - if (!SelectParticlePID(p1.pidcut(), o2::track::PID::Deuteron, p1.p())) { - continue; - } - if (ConfClosePairRejection.value && closePairRejectionTV0.isClosePair(p1, p2, partsFemto, magneticField)) { - continue; - } - auto kstar = FemtoDreamMath::getkstar(p1, mMassDeuteron, p2, mMassLambda); - // check if kstar is below threshold - if (kStar < confKstarTriggerLimit.value) { - lowKstarPairs[1]++; - registry.fill(HIST("fKstarAntiLD"), kstar); - } - } - } - } - - // if we found any pair below the kstar limit, keep the event - if (lowKstarPairs[kPD] > 0) { - keepEvent[kPD] = true; - registry.fill(HIST("fProcessedEvents"), 2 + kPD); // first two bins are counter of all and rejected events - } - if (lowKstarPairs[kLD] > 0) { - keepEvent[kLD] = true; - registry.fill(HIST("fProcessedEvents"), 2 + kLD); // first two bins are counter of all and rejected events - } - - // fill table for the trigger - tags(keepEvent[kPD], keepEvent[kLD]); - - if (keepEvent[kPD] > 0 || keepEvent[kLD] > 0) { - registry.fill(HIST("fMultiplicityAfter"), col.multV0M()); - registry.fill(HIST("fZvtxAfter"), col.posZ()); - } else { - registry.fill(HIST("fProcessedEvents"), 1); - } - } -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfg) -{ - return WorkflowSpec{adaptAnalysisTask(cfg)}; -} From 2d2e92aa9360242944a0fafdf045d0cd64925fe3 Mon Sep 17 00:00:00 2001 From: "Paul Veen (paveen)" <80593165+ppoava@users.noreply.github.com> Date: Fri, 10 Oct 2025 09:57:49 +0200 Subject: [PATCH 692/986] [Common] Fix of small bug in muon QA (#13305) --- Common/Tasks/qaMuon.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Common/Tasks/qaMuon.cxx b/Common/Tasks/qaMuon.cxx index b8646f83291..ce694a2d24d 100644 --- a/Common/Tasks/qaMuon.cxx +++ b/Common/Tasks/qaMuon.cxx @@ -2591,8 +2591,15 @@ struct muonQa { double mass = GetMuMuInvariantMass(fgValuesMuonPV1, fgValuesMuonPV2); double pT = GetMuMuPt(fgValuesMuonPV1, fgValuesMuonPV2); double yPair = GetMuMuRap(fgValuesMuonPV1, fgValuesMuonPV2); - double dcaXPair = muonPosPV.dcaX - muonNegPV.dcaX; - double dcaYPair = muonPosPV.dcaY - muonNegPV.dcaY; + double dcaXPair; + double dcaYPair; + if (configRealign.fDoRealign) { + dcaXPair = muonPos.dcaX - muonNeg.dcaX; + dcaYPair = muonPos.dcaY - muonNeg.dcaY; + } else { + dcaXPair = muonPosPV.dcaX - muonNegPV.dcaX; + dcaYPair = muonPosPV.dcaY - muonNegPV.dcaY; + } // mass cuts only used for DCA of Jpsi candidates double minJpsiMass = 2.8; double maxJpsiMass = 3.4; From e85859a419b58c92cb40b38857f506506650aefa Mon Sep 17 00:00:00 2001 From: Bong-Hwi Lim Date: Fri, 10 Oct 2025 11:37:25 +0200 Subject: [PATCH 693/986] [PWGLF] omega2012Analysis.cxx - improve loop condition (#13314) --- PWGLF/Tasks/Resonances/omega2012Analysis.cxx | 156 +++++++++++++------ 1 file changed, 108 insertions(+), 48 deletions(-) diff --git a/PWGLF/Tasks/Resonances/omega2012Analysis.cxx b/PWGLF/Tasks/Resonances/omega2012Analysis.cxx index 77a9b57d3b0..10a16876418 100644 --- a/PWGLF/Tasks/Resonances/omega2012Analysis.cxx +++ b/PWGLF/Tasks/Resonances/omega2012Analysis.cxx @@ -28,6 +28,8 @@ #include +#include + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -129,6 +131,10 @@ struct Omega2012Analysis { Configurable> cPionTOFNSigmaCuts{"cPionTOFNSigmaCuts", {3.0f, 3.0f, 3.0f, 3.0f}, "TOF NSigma cuts per pT bin (pion)"}; Configurable> cPionTOFRequired{"cPionTOFRequired", {0, 0, 1, 1}, "Require TOF per pT bin (pion)"}; + // Xi1530 mass window cut + Configurable cXi1530Mass{"cXi1530Mass", 1.53, "Xi(1530) mass (GeV/c^2)"}; + Configurable cXi1530MassWindow{"cXi1530MassWindow", 0.01, "Xi(1530) mass window (GeV/c^2)"}; + // PDG masses double massK0 = MassK0Short; @@ -475,6 +481,21 @@ struct Omega2012Analysis { return true; } + // Xi1530 mass window cut + template + bool xi1530MassCut(const XiType& xi, const PionType& pion) + { + // Calculate Xi + pion invariant mass + ROOT::Math::PxPyPzEVector pXi, pPion, pXi1530; + pXi = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(xi.pt(), xi.eta(), xi.phi(), xi.mXi())); + pPion = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(pion.pt(), pion.eta(), pion.phi(), MassPionCharged)); + pXi1530 = pXi + pPion; + + // Check if mass is within Xi(1530) window + float massDiff = std::abs(pXi1530.M() - cXi1530Mass); + return massDiff < cXi1530MassWindow; + } + // Primary-level cascade kinematics template bool cascprimaryTrackCut(const CascT& c) @@ -801,67 +822,106 @@ struct Omega2012Analysis { { auto cent = collision.cent(); + // Collect track IDs used in xi and v0 construction to exclude them from pion selection + std::set usedTrackIds; + + // Collect track IDs from xi cascades for (const auto& xi : cascades) { if (!cascprimaryTrackCut(xi)) continue; if (!casctopCut(xi)) continue; - for (const auto& v0 : v0s) { - if (!v0CutEnhanced(collision, v0)) + // Add xi daughter track IDs from cascadeIndices array (ordered: positive, negative, bachelor) + auto cascIndices = xi.cascadeIndices(); + usedTrackIds.insert(cascIndices[0]); // positive track + usedTrackIds.insert(cascIndices[1]); // negative track + usedTrackIds.insert(cascIndices[2]); // bachelor track + } + + // Collect track IDs from v0s + for (const auto& v0 : v0s) { + if (!v0CutEnhanced(collision, v0)) + continue; + + // Add v0 daughter track IDs from indices array + auto v0Indices = v0.indices(); + usedTrackIds.insert(v0Indices[0]); // positive track + usedTrackIds.insert(v0Indices[1]); // negative track + } + + // First loop: xi + pion to check xi1530 mass window + for (const auto& xi : cascades) { + if (!cascprimaryTrackCut(xi)) + continue; + if (!casctopCut(xi)) + continue; + + for (const auto& pion : tracks) { + // Skip pion tracks that are already used in xi construction + if (usedTrackIds.find(pion.globalIndex()) != usedTrackIds.end()) { continue; + } + + // Pion QA before cuts + histos.fill(HIST("QAbefore/pionPt"), pion.pt()); + histos.fill(HIST("QAbefore/pionEta"), pion.eta()); - for (const auto& pion : tracks) { - // Pion QA before cuts - histos.fill(HIST("QAbefore/pionPt"), pion.pt()); - histos.fill(HIST("QAbefore/pionEta"), pion.eta()); - - if constexpr (IsResoMicrotrack) { - histos.fill(HIST("QAbefore/pionDCAxy"), pion.pt(), o2::aod::resomicrodaughter::ResoMicroTrackSelFlag::decodeDCAxy(pion.trackSelectionFlags())); - histos.fill(HIST("QAbefore/pionDCAz"), pion.pt(), o2::aod::resomicrodaughter::ResoMicroTrackSelFlag::decodeDCAz(pion.trackSelectionFlags())); - histos.fill(HIST("QAbefore/pionTPCNSigma"), pion.pt(), o2::aod::resomicrodaughter::PidNSigma::getTPCnSigma(pion.pidNSigmaPiFlag())); - if (pion.hasTOF()) { - histos.fill(HIST("QAbefore/pionTOFNSigma"), pion.pt(), o2::aod::resomicrodaughter::PidNSigma::getTOFnSigma(pion.pidNSigmaPiFlag())); - } - } else { - histos.fill(HIST("QAbefore/pionDCAxy"), pion.pt(), pion.dcaXY()); - histos.fill(HIST("QAbefore/pionDCAz"), pion.pt(), pion.dcaZ()); - histos.fill(HIST("QAbefore/pionTPCNSigma"), pion.pt(), pion.tpcNSigmaPi()); - if (pion.hasTOF()) { - histos.fill(HIST("QAbefore/pionTOFNSigma"), pion.pt(), pion.tofNSigmaPi()); - } - if constexpr (requires { pion.tpcNClsFound(); }) { - histos.fill(HIST("QAbefore/pionTPCNcls"), pion.tpcNClsFound()); - } + if constexpr (IsResoMicrotrack) { + histos.fill(HIST("QAbefore/pionDCAxy"), pion.pt(), o2::aod::resomicrodaughter::ResoMicroTrackSelFlag::decodeDCAxy(pion.trackSelectionFlags())); + histos.fill(HIST("QAbefore/pionDCAz"), pion.pt(), o2::aod::resomicrodaughter::ResoMicroTrackSelFlag::decodeDCAz(pion.trackSelectionFlags())); + histos.fill(HIST("QAbefore/pionTPCNSigma"), pion.pt(), o2::aod::resomicrodaughter::PidNSigma::getTPCnSigma(pion.pidNSigmaPiFlag())); + if (pion.hasTOF()) { + histos.fill(HIST("QAbefore/pionTOFNSigma"), pion.pt(), o2::aod::resomicrodaughter::PidNSigma::getTOFnSigma(pion.pidNSigmaPiFlag())); + } + } else { + histos.fill(HIST("QAbefore/pionDCAxy"), pion.pt(), pion.dcaXY()); + histos.fill(HIST("QAbefore/pionDCAz"), pion.pt(), pion.dcaZ()); + histos.fill(HIST("QAbefore/pionTPCNSigma"), pion.pt(), pion.tpcNSigmaPi()); + if (pion.hasTOF()) { + histos.fill(HIST("QAbefore/pionTOFNSigma"), pion.pt(), pion.tofNSigmaPi()); } + if constexpr (requires { pion.tpcNClsFound(); }) { + histos.fill(HIST("QAbefore/pionTPCNcls"), pion.tpcNClsFound()); + } + } - if (!pionCut(pion)) - continue; + if (!pionCut(pion)) + continue; - // Pion QA after cuts - histos.fill(HIST("QAafter/pionPt"), pion.pt()); - histos.fill(HIST("QAafter/pionEta"), pion.eta()); - - if constexpr (IsResoMicrotrack) { - histos.fill(HIST("QAafter/pionDCAxy"), pion.pt(), o2::aod::resomicrodaughter::ResoMicroTrackSelFlag::decodeDCAxy(pion.trackSelectionFlags())); - histos.fill(HIST("QAafter/pionDCAz"), pion.pt(), o2::aod::resomicrodaughter::ResoMicroTrackSelFlag::decodeDCAz(pion.trackSelectionFlags())); - histos.fill(HIST("QAafter/pionTPCNSigma"), pion.pt(), o2::aod::resomicrodaughter::PidNSigma::getTPCnSigma(pion.pidNSigmaPiFlag())); - if (pion.hasTOF()) { - histos.fill(HIST("QAafter/pionTOFNSigma"), pion.pt(), o2::aod::resomicrodaughter::PidNSigma::getTOFnSigma(pion.pidNSigmaPiFlag())); - } - } else { - histos.fill(HIST("QAafter/pionDCAxy"), pion.pt(), pion.dcaXY()); - histos.fill(HIST("QAafter/pionDCAz"), pion.pt(), pion.dcaZ()); - histos.fill(HIST("QAafter/pionTPCNSigma"), pion.pt(), pion.tpcNSigmaPi()); - if (pion.hasTOF()) { - histos.fill(HIST("QAafter/pionTOFNSigma"), pion.pt(), pion.tofNSigmaPi()); - } - if constexpr (requires { pion.tpcNClsFound(); }) { - histos.fill(HIST("QAafter/pionTPCNcls"), pion.tpcNClsFound()); - } + // Pion QA after cuts + histos.fill(HIST("QAafter/pionPt"), pion.pt()); + histos.fill(HIST("QAafter/pionEta"), pion.eta()); + + if constexpr (IsResoMicrotrack) { + histos.fill(HIST("QAafter/pionDCAxy"), pion.pt(), o2::aod::resomicrodaughter::ResoMicroTrackSelFlag::decodeDCAxy(pion.trackSelectionFlags())); + histos.fill(HIST("QAafter/pionDCAz"), pion.pt(), o2::aod::resomicrodaughter::ResoMicroTrackSelFlag::decodeDCAz(pion.trackSelectionFlags())); + histos.fill(HIST("QAafter/pionTPCNSigma"), pion.pt(), o2::aod::resomicrodaughter::PidNSigma::getTPCnSigma(pion.pidNSigmaPiFlag())); + if (pion.hasTOF()) { + histos.fill(HIST("QAafter/pionTOFNSigma"), pion.pt(), o2::aod::resomicrodaughter::PidNSigma::getTOFnSigma(pion.pidNSigmaPiFlag())); + } + } else { + histos.fill(HIST("QAafter/pionDCAxy"), pion.pt(), pion.dcaXY()); + histos.fill(HIST("QAafter/pionDCAz"), pion.pt(), pion.dcaZ()); + histos.fill(HIST("QAafter/pionTPCNSigma"), pion.pt(), pion.tpcNSigmaPi()); + if (pion.hasTOF()) { + histos.fill(HIST("QAafter/pionTOFNSigma"), pion.pt(), pion.tofNSigmaPi()); } + if constexpr (requires { pion.tpcNClsFound(); }) { + histos.fill(HIST("QAafter/pionTPCNcls"), pion.tpcNClsFound()); + } + } + + // Check xi1530 mass window cut + if (!xi1530MassCut(xi, pion)) + continue; + + // Second loop: v0 for the selected xi-pion pair + for (const auto& v0 : v0s) { + if (!v0CutEnhanced(collision, v0)) + continue; - // 4-vectors for 3-body + // 4-vectors for 3-body decay: Xi + K0s + pion ROOT::Math::PxPyPzEVector pXi, pK0s, pPion, pRes; pXi = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(xi.pt(), xi.eta(), xi.phi(), xi.mXi())); pK0s = ROOT::Math::PxPyPzEVector(ROOT::Math::PtEtaPhiMVector(v0.pt(), v0.eta(), v0.phi(), massK0)); From aa4012a308bc1de2a3b9fb2fc5dcadac3d6935ec Mon Sep 17 00:00:00 2001 From: sarjeetagami <162087855+sarjeetagami@users.noreply.github.com> Date: Fri, 10 Oct 2025 15:22:35 +0530 Subject: [PATCH 694/986] [PWGLF] modification of occupancy cut and signal loss (#13316) Co-authored-by: sarjeeta gami --- .../Tasks/Resonances/phianalysisrun3_PbPb.cxx | 74 +++++++++++++------ 1 file changed, 52 insertions(+), 22 deletions(-) diff --git a/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx b/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx index 0b5a8ffc4f4..38c96f49222 100644 --- a/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx +++ b/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx @@ -113,6 +113,7 @@ struct phianalysisrun3_PbPb { Configurable confMaxRot{"confMaxRot", 7.0f * 3.14159265f / 6.0f, "Maximum of rotation"}; Configurable pdgcheck{"pdgcheck", true, "pdgcheck"}; Configurable reco{"reco", true, "reco"}; + Configurable cfgDoSel8{"cfgDoSel8", true, "Apply sel8 selection"}; ConfigurableAxis ptAxisphi{"ptAxisphi", {200, 0.0f, 20.0f}, "phi pT axis"}; ConfigurableAxis centAxisphi{"centAxisphi", {200, 0.0, 200.0}, "phi centrality axis"}; ConfigurableAxis massAxisphi{"massAxisphi", {200, 0.9, 1.1}, "phi mass axis"}; @@ -120,7 +121,8 @@ struct phianalysisrun3_PbPb { ConfigurableAxis binsImpactPar{"binsImpactPar", {VARIABLE_WIDTH, 0, 3.5, 5.67, 7.45, 8.85, 10.0, 11.21, 12.26, 13.28, 14.23, 15.27}, "Binning of the impact parameter axis"}; ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 10.0, 12.0}, "Binning of the pT axis"}; ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"}; - Configurable cfgCutOccupancy{"cfgCutOccupancy", 3000, "Occupancy cut"}; + Configurable cfgMinOccupancy{"cfgMinOccupancy", 0, "Minimum occupancy cut"}; + Configurable cfgMaxOccupancy{"cfgMaxOccupancy", 3000, "Maximum occupancy cut"}; Configurable centestimator{"centestimator", 0, "Select multiplicity estimator: 0 - FT0C, 1 - FT0A, 2 - FT0M, 3 - FV0A, 4 - PVTracks"}; Configurable genacceptancecut{"genacceptancecut", true, "use acceptance cut for generated"}; @@ -346,7 +348,7 @@ struct phianalysisrun3_PbPb { if (additionalEvSel6 && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) return false; int occupancy = collision.trackOccupancyInTimeRange(); - if (fillOccupancy && (occupancy > cfgCutOccupancy)) + if (fillOccupancy && (occupancy < cfgMinOccupancy || occupancy > cfgMaxOccupancy)) return false; return true; @@ -469,7 +471,7 @@ struct phianalysisrun3_PbPb { } histos.fill(HIST("hEvtSelInfo"), 8.5); int occupancy = collision.trackOccupancyInTimeRange(); - if (fillOccupancy && (occupancy > cfgCutOccupancy)) { + if (fillOccupancy && (occupancy < cfgMinOccupancy || occupancy > cfgMaxOccupancy)) { return; } histos.fill(HIST("hEvtSelInfo"), 9.5); @@ -626,7 +628,9 @@ struct phianalysisrun3_PbPb { int occupancy1 = c1.trackOccupancyInTimeRange(); int occupancy2 = c2.trackOccupancyInTimeRange(); - if (fillOccupancy && (occupancy1 > cfgCutOccupancy || occupancy2 > cfgCutOccupancy)) { + if (fillOccupancy && + ((occupancy1 < cfgMinOccupancy || occupancy1 > cfgMaxOccupancy) || + (occupancy2 < cfgMinOccupancy || occupancy2 > cfgMaxOccupancy))) { continue; } float multiplicity; @@ -695,7 +699,9 @@ struct phianalysisrun3_PbPb { int occupancy1 = c1.trackOccupancyInTimeRange(); int occupancy2 = c2.trackOccupancyInTimeRange(); - if (fillOccupancy && (occupancy1 > cfgCutOccupancy || occupancy2 > cfgCutOccupancy)) { + if (fillOccupancy && + ((occupancy1 < cfgMinOccupancy || occupancy1 > cfgMaxOccupancy) || + (occupancy2 < cfgMinOccupancy || occupancy2 > cfgMaxOccupancy))) { continue; } float multiplicity; @@ -765,7 +771,9 @@ struct phianalysisrun3_PbPb { int occupancy1 = c1.trackOccupancyInTimeRange(); int occupancy2 = c2.trackOccupancyInTimeRange(); - if (fillOccupancy && (occupancy1 > cfgCutOccupancy || occupancy2 > cfgCutOccupancy)) { + if (fillOccupancy && + ((occupancy1 < cfgMinOccupancy || occupancy1 > cfgMaxOccupancy) || + (occupancy2 < cfgMinOccupancy || occupancy2 > cfgMaxOccupancy))) { continue; } float multiplicity; @@ -835,7 +843,9 @@ struct phianalysisrun3_PbPb { int occupancy1 = c1.trackOccupancyInTimeRange(); int occupancy2 = c2.trackOccupancyInTimeRange(); - if (fillOccupancy && (occupancy1 > cfgCutOccupancy || occupancy2 > cfgCutOccupancy)) { + if (fillOccupancy && + ((occupancy1 < cfgMinOccupancy || occupancy1 > cfgMaxOccupancy) || + (occupancy2 < cfgMinOccupancy || occupancy2 > cfgMaxOccupancy))) { continue; } float multiplicity; @@ -877,7 +887,7 @@ struct phianalysisrun3_PbPb { return; } int occupancy = collision.trackOccupancyInTimeRange(); - if (fillOccupancy && (occupancy > cfgCutOccupancy)) { + if (fillOccupancy && (occupancy < cfgMinOccupancy || occupancy > cfgMaxOccupancy)) { return; } float multiplicity{-1}; @@ -964,9 +974,13 @@ struct phianalysisrun3_PbPb { } for (const auto& RecCollision : RecCollisions) { histos.fill(HIST("hMC"), 3); - if (!RecCollision.sel8() || std::abs(RecCollision.posZ()) > cfgCutVertex) { + if (cfgDoSel8 && !RecCollision.sel8()) { continue; } + if (std::abs(RecCollision.posZ()) > cfgCutVertex) { + continue; + } + histos.fill(HIST("hMC"), 4); if (additionalEvSel1 && !RecCollision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { continue; @@ -993,7 +1007,7 @@ struct phianalysisrun3_PbPb { } histos.fill(HIST("hMC"), 10); int occupancy = RecCollision.trackOccupancyInTimeRange(); - if (fillOccupancy && (occupancy > cfgCutOccupancy)) { + if (fillOccupancy && (occupancy < cfgMinOccupancy || occupancy > cfgMaxOccupancy)) { continue; } histos.fill(HIST("hMC"), 11); @@ -1173,14 +1187,18 @@ struct phianalysisrun3_PbPb { int nevts = 0; auto multiplicity = 0; for (const auto& collision : collisions) { - if (!collision.sel8() || std::abs(collision.mcCollision().posZ()) > cfgCutVertex) { + if (cfgDoSel8 && !collision.sel8()) { + continue; + } + if (std::abs(collision.mcCollision().posZ()) > cfgCutVertex) { continue; } + if (additionalEvSel2 && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { continue; } int occupancy = collision.trackOccupancyInTimeRange(); - if (fillOccupancy && (occupancy > cfgCutOccupancy)) { + if (fillOccupancy && (occupancy < cfgMinOccupancy || occupancy > cfgMaxOccupancy)) { continue; } histos.fill(HIST("hOccupancy1"), occupancy); @@ -1249,14 +1267,18 @@ struct phianalysisrun3_PbPb { if (!collision.has_mcCollision()) { return; } - if (std::abs(collision.mcCollision().posZ()) > cfgCutVertex || !collision.sel8()) { + if (cfgDoSel8 && !collision.sel8()) { + return; + } + if (std::abs(collision.mcCollision().posZ()) > cfgCutVertex) { return; } + if (additionalEvSel2 && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { return; } int occupancy = collision.trackOccupancyInTimeRange(); - if (fillOccupancy && (occupancy > cfgCutOccupancy)) { + if (fillOccupancy && (occupancy < cfgMinOccupancy || occupancy > cfgMaxOccupancy)) { return; } auto multiplicity = collision.centFT0C(); @@ -1393,7 +1415,7 @@ struct phianalysisrun3_PbPb { return; } int occupancy = collision.trackOccupancyInTimeRange(); - if (fillOccupancy && (occupancy > cfgCutOccupancy)) { + if (fillOccupancy && (occupancy < cfgMinOccupancy || occupancy > cfgMaxOccupancy)) { return; } float multiplicity{-1}; @@ -1515,12 +1537,13 @@ struct phianalysisrun3_PbPb { } int occupancy1 = c1.trackOccupancyInTimeRange(); int occupancy2 = c2.trackOccupancyInTimeRange(); - if (fillOccupancy && (occupancy1 > cfgCutOccupancy)) { + if (fillOccupancy && (occupancy1 < cfgMinOccupancy || occupancy1 > cfgMaxOccupancy)) { continue; } - if (fillOccupancy && (occupancy2 > cfgCutOccupancy)) { + if (fillOccupancy && (occupancy2 < cfgMinOccupancy || occupancy2 > cfgMaxOccupancy)) { continue; } + auto multiplicity = c1.centFT0C(); histos.fill(HIST("Centmix"), multiplicity); for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { @@ -1574,11 +1597,15 @@ struct phianalysisrun3_PbPb { std::vector selectedEvents(collisions.size()); int nevts = 0; auto multiplicity = -1.0; - histos.fill(HIST("hMC1"), 2.5); for (const auto& collision : collisions) { - if (!collision.sel8() || std::abs(collision.mcCollision().posZ()) > cfgCutVertex) { + histos.fill(HIST("hMC1"), 2.5); + if (cfgDoSel8 && !collision.sel8()) { + continue; + } + if (std::abs(collision.mcCollision().posZ()) > cfgCutVertex) { continue; } + histos.fill(HIST("hMC1"), 3.5); if (additionalEvSel1 && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { continue; @@ -1605,7 +1632,7 @@ struct phianalysisrun3_PbPb { } histos.fill(HIST("hMC1"), 9.5); int occupancy = collision.trackOccupancyInTimeRange(); - if (fillOccupancy && (occupancy > cfgCutOccupancy)) { + if (fillOccupancy && (occupancy < cfgMinOccupancy || occupancy > cfgMaxOccupancy)) { continue; } histos.fill(HIST("hMC1"), 10.5); @@ -1674,7 +1701,10 @@ struct phianalysisrun3_PbPb { if (!collision.has_mcCollision()) { return; } - if (std::abs(collision.mcCollision().posZ()) > cfgCutVertex || !collision.sel8()) { + if (cfgDoSel8 && !collision.sel8()) { + return; + } + if (std::abs(collision.mcCollision().posZ()) > cfgCutVertex) { return; } if (additionalEvSel1 && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { @@ -1699,7 +1729,7 @@ struct phianalysisrun3_PbPb { return; } int occupancy = collision.trackOccupancyInTimeRange(); - if (fillOccupancy && (occupancy > cfgCutOccupancy)) { + if (fillOccupancy && (occupancy < cfgMinOccupancy || occupancy > cfgMaxOccupancy)) { return; } const int kCentFT0C = 0; From bdef18b02e7312be1bc71f2a5a34b65d1440c945 Mon Sep 17 00:00:00 2001 From: JimunLee Date: Fri, 10 Oct 2025 19:18:57 +0900 Subject: [PATCH 695/986] [PWGLF] Fixed reconstruction part of KstarInOO.cxx (#13283) Co-authored-by: jimun_lee --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 186 ++++++++++++++++++++------- 1 file changed, 141 insertions(+), 45 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 24ba298e3c9..bd5286986f5 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -179,21 +179,25 @@ struct kstarInOO { } if (cfgMcHistos) { + histos.add("hPion_PID_Purity", "hPion_PID_Purity", kTH1F, {{3, -1.5, 1.5}}); + histos.add("hKaon_PID_Purity", "hKaon_PID_Purity", kTH1F, {{3, -1.5, 1.5}}); + histos.add("hSimplePion_PID_Purity", "hSimplePion_PID_Purity", kTH1F, {{3, -1.5, 1.5}}); + histos.add("hSimpleKaon_PID_Purity", "hSimpleKaon_PID_Purity", kTH1F, {{3, -1.5, 1.5}}); + histos.add("nEvents_MC", "nEvents_MC", kTH1F, {{4, 0.0, 4.0}}); histos.add("nEvents_MC_True", "nEvents_MC_True", kTH1F, {{4, 0.0, 4.0}}); - histos.add("hMC_USS", "hMC_USS", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_LSS", "hMC_LSS", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_USS_Mix", "hMC_USS_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_LSS_Mix", "hMC_LSS_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_USS_True", "hMC_USS_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); histos.add("hMC_kstar_True", "hMC_kstar_True", kTHnSparseF, {cfgCentAxis, ptAxis}); - histos.add("hMC_USS_pion", "hMC_USS_pion", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_LSS_pion", "hMC_LSS_pion", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_USS_Mix_pion", "hMC_USS_Mix_pion", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_LSS_Mix_pion", "hMC_LSS_Mix_pion", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_USS_pion_True", "hMC_USS_pion_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_USS_True", "hMC_USS_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_USS_KPi", "hMC_USS_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_USS_PiK", "hMC_USS_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_LSS_KPi", "hMC_LSS_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_LSS_PiK", "hMC_LSS_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_USS_KPi_Mix", "hMC_USS_KPi_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_USS_PiK_Mix", "hMC_USS_PiK_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_USS_KPi_True", "hMC_USS_KPi_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_USS_PiK_True", "hMC_USS_PiK_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); } } // end of init @@ -226,7 +230,6 @@ struct kstarInOO { histos.fill(HIST("hPosZ_BC"), event.posZ()); histos.fill(HIST("hcentFT0C_BC"), event.centFT0C()); } - if (!event.sel8()) return false; if (std::abs(event.posZ()) > cfgEventVtxCut) @@ -264,6 +267,7 @@ struct kstarInOO { histos.fill(HIST("hTPCChi2_BC"), track.tpcChi2NCl()); histos.fill(HIST("QA_track_pT_BC"), track.pt()); } + if (cfgTrackGlobalSel && !track.isGlobalTrack()) return false; if (track.pt() < cfgTrackMinPt) @@ -278,11 +282,11 @@ struct kstarInOO { return false; if (cfgTrackGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) return false; - if (track.tpcNClsFindable() < cfgTracknFindableTPCClusters) + if (cfgTracknFindableTPCClusters > 0 && track.tpcNClsFindable() < cfgTracknFindableTPCClusters) return false; if (track.tpcNClsCrossedRows() < cfgTracknTPCCrossedRows) return false; - if (track.tpcCrossedRowsOverFindableCls() > cfgTracknRowsOverFindable) + if (cfgTracknRowsOverFindable > 0 && track.tpcCrossedRowsOverFindableCls() > cfgTracknRowsOverFindable) return false; if (track.tpcChi2NCl() > cfgTracknTPCChi2) return false; @@ -358,7 +362,7 @@ struct kstarInOO { } else { tofPIDPassed = true; } - // TPC & TOF + // TPC & TOF if (tpcPIDPassed && tofPIDPassed) { if (cfgTrackCutQA && QA) { histos.fill(HIST("QA_nSigma_pion_TPC_AC"), candidate.pt(), candidate.tpcNSigmaPi()); @@ -378,10 +382,8 @@ struct kstarInOO { auto centrality = collision1.centFT0C(); for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - if (std::fabs(trk1.signed1Pt()) <= 0.f || std::fabs(trk2.signed1Pt()) <= 0.f) - continue; - auto [KstarPt, Minv] = minvReconstruction(trk1, trk2, QA); + auto [KstarPt, Minv] = minvReconstruction(trk1, trk2, QA, false); double conjugate = trk1.sign() * trk2.sign(); if (cfgDataHistos) { @@ -411,28 +413,36 @@ struct kstarInOO { auto tracks2 = pionMC->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); auto centrality = collision1.centFT0C(); + std::vector mcMemory; + std::vector PIDPurityKey_Kaon; + std::vector PIDPurityKey_Pion; + + double KstarPt_Kpi, Minv_Kpi; + for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) continue; - if (std::fabs(trk1.signed1Pt()) <= 0.f || std::fabs(trk2.signed1Pt()) <= 0.f) + + // auto [KstarPt_Kpi, Minv_Kpi] = minvReconstruction(trk1, trk2, QA, false); + // auto [KstarPt_piK, Minv_piK] = minvReconstruction(trk1, trk2, QA, true); + + std::tie(KstarPt_Kpi, Minv_Kpi) = minvReconstruction(trk1, trk2, QA, false); + std::tie(KstarPt_Kpi, Minv_Kpi) = minvReconstruction(trk1, trk2, QA, true); + + if (Minv_Kpi < 0) continue; - auto [KstarPt_Kpi, Minv_Kpi] = minvReconstruction(trk1, trk2, QA); double conjugate = trk1.sign() * trk2.sign(); if (cfgMcHistos) { - if (Minv_Kpi > 0) { - if (!IsMix) { - if (conjugate < 0) { - histos.fill(HIST("hMC_USS"), centrality, KstarPt_Kpi, Minv_Kpi); - } else if (conjugate > 0) { - histos.fill(HIST("hMC_LSS"), centrality, KstarPt_Kpi, Minv_Kpi); - } - } else { - if (conjugate < 0) { - histos.fill(HIST("hMC_USS_Mix"), centrality, KstarPt_Kpi, Minv_Kpi); - } else if (conjugate > 0) { - histos.fill(HIST("hMC_LSS_Mix"), centrality, KstarPt_Kpi, Minv_Kpi); - } + if (!IsMix) { + if (conjugate < 0) { + histos.fill(HIST("hMC_USS_KPi"), centrality, KstarPt_Kpi, Minv_Kpi); + } else if (conjugate > 0) { + histos.fill(HIST("hMC_LSS_KPi"), centrality, KstarPt_Kpi, Minv_Kpi); + } + } else { + if (conjugate < 0) { + histos.fill(HIST("hMC_USS_KPi_Mix"), centrality, KstarPt_Kpi, Minv_Kpi); } } } @@ -440,14 +450,12 @@ struct kstarInOO { // Gen MC auto particle1 = trk1.mcParticle(); auto particle2 = trk2.mcParticle(); - if (std::fabs(particle1.pdgCode()) != 321) - continue; // Not Kaon - if (std::fabs(particle2.pdgCode()) != 211) - continue; // Not Pion if (!particle1.has_mothers() || !particle2.has_mothers()) { continue; } + int mcindex1 = trk1.globalIndex(); + int mcindex2 = trk2.globalIndex(); std::vector mothers1{}; std::vector mothers1PDG{}; @@ -471,27 +479,85 @@ struct kstarInOO { if (mothers1[0] != mothers2[0]) continue; // Kaon and pion not from the same K*0 + if (std::fabs(particle1.pdgCode()) != 211 && std::fabs(particle1.pdgCode()) != 321) + continue; + if (std::fabs(particle2.pdgCode()) != 211 && std::fabs(particle2.pdgCode()) != 321) + continue; + + double track1_mass, track2_mass; + bool track1f{false}; // true means pion + + if (std::fabs(particle1.pdgCode()) == 211) { + track1f = true; + track1_mass = massPi; + } else { + track1_mass = massKa; + } + + if (std::fabs(particle2.pdgCode()) == 211) { + track2_mass = massPi; + } else { + track2_mass = massKa; + } + + if (track1_mass == track2_mass) { + return; + } + + bool exists1 = std::find(mcMemory.begin(), mcMemory.end(), mcindex1) != mcMemory.end(); + bool exists2 = std::find(mcMemory.begin(), mcMemory.end(), mcindex2) != mcMemory.end(); + if (exists1 || exists2) { + continue; + } else { + mcMemory.push_back(trk1.globalIndex()); + mcMemory.push_back(trk2.globalIndex()); + } + + TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; + lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), track1_mass); + lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), track2_mass); + lResonance = lDecayDaughter1 + lDecayDaughter2; + if (cfgMcHistos) { - histos.fill(HIST("hMC_USS_True"), centrality, KstarPt_Kpi, Minv_Kpi); + histos.fill(HIST("hMC_USS_True"), centrality, lResonance.Pt(), lResonance.M()); + if (track1f) { + histos.fill(HIST("hMC_USS_PiK_True"), centrality, lResonance.Pt(), lResonance.M()); + } else { + histos.fill(HIST("hMC_USS_KPi_True"), centrality, lResonance.Pt(), lResonance.M()); + } } //====================== } // for } // TrackSlicingMC template - std::pair minvReconstruction(const TracksType& trk1, const TracksType& trk2, const bool QA) + std::pair minvReconstruction(const TracksType& trk1, const TracksType& trk2, const bool QA, const bool flip) { if (!trackSelection(trk1, false) || !trackSelection(trk2, false)) return {-1.0, -1.0}; - if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA)) - return {-1.0, -1.0}; - if (trk1.globalIndex() == trk2.globalIndex()) + + if (!flip) { + if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA)) { + return {-1.0, -1.0}; + } + } else { + if (!trackPIDPion(trk1, false) || !trackPIDKaon(trk2, false)) + return {-1.0, -1.0}; + } + + // if (trk1.globalIndex() == trk2.globalIndex()) + // return {-1.0, -1.0}; + if (trk1.index() >= trk2.index()) return {-1.0, -1.0}; TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; - - lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa); - lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massPi); + if (!flip) { + lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa); + lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massPi); + } else { + lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massPi); + lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massKa); + } lResonance = lDecayDaughter1 + lDecayDaughter2; if (std::abs(lResonance.Eta()) > cfgTrackMaxEta) @@ -573,7 +639,7 @@ struct kstarInOO { //| //| MC STUFF (SE) //| - //======================================================= + //========================================================= int nEventsMC = 0; void processSameEventMC(EventCandidates::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const&) { @@ -603,6 +669,36 @@ struct kstarInOO { if (!INELgt0) return; + auto tracks1 = kaonMC->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + for (const auto& kaon : tracks1) { + if (!trackSelection(kaon, false)) + continue; + if (!trackPIDKaon(kaon, false)) + continue; + auto particle1 = kaon.mcParticle(); + if (std::fabs(particle1.pdgCode()) == 321) + histos.fill(HIST("hSimpleKaon_PID_Purity"), 1); // histogram with two bins, -1.5, 1.5 fill 1 or -1 + else if (std::fabs(particle1.pdgCode()) == 211) + histos.fill(HIST("hSimpleKaon_PID_Purity"), -1); // histogram with two bins, -1.5, 1.5 fill 1 or -1 + else + histos.fill(HIST("hSimpleKaon_PID_Purity"), 0); // histogram with two bins, -1.5, 1.5 fill 1 or -1 + } + + auto tracks2 = pionMC->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + for (const auto& pion : tracks2) { + if (!trackSelection(pion, false)) + continue; + if (!trackPIDPion(pion, false)) + continue; + auto particle2 = pion.mcParticle(); + if (std::fabs(particle2.pdgCode()) == 211) + histos.fill(HIST("hSimplePion_PID_Purity"), 1); // histogram with two bins, -1.5, 1.5 fill 1 or -1 + else if (std::fabs(particle2.pdgCode()) == 321) + histos.fill(HIST("hSimplePion_PID_Purity"), -1); // histogram with two bins, -1.5, 1.5 fill 1 or -1 + else + histos.fill(HIST("hSimplePion_PID_Purity"), 0); // histogram with two bins, -1.5, 1.5 fill 1 or -1 + } + if (cfgMcHistos) { histos.fill(HIST("nEvents_MC"), 1.5); } From 5ede2ad9fb45eb72f9fb173ca2be8234a555b673 Mon Sep 17 00:00:00 2001 From: Mario Ciacco Date: Fri, 10 Oct 2025 12:54:07 +0200 Subject: [PATCH 696/986] [PWGLF] add centrality intervals + remove unused variables (#13326) --- PWGLF/TableProducer/Nuspex/ebyeMaker.cxx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/ebyeMaker.cxx b/PWGLF/TableProducer/Nuspex/ebyeMaker.cxx index c7f015fce80..4cbd5be02b7 100644 --- a/PWGLF/TableProducer/Nuspex/ebyeMaker.cxx +++ b/PWGLF/TableProducer/Nuspex/ebyeMaker.cxx @@ -214,6 +214,9 @@ struct EbyeMaker { Configurable kUsePileUpCut{"kUsePileUpCut", false, "toggle strong correlation cuts (Run 2)"}; Configurable kUseEstimatorsCorrelationCut{"kUseEstimatorsCorrelationCut", false, "toggle cut on the correlation between centrality estimators (2018 Pb-Pb)"}; + Configurable kCentCutMin{"kCentCutMin", 0, "minimum accepted centrality"}; + Configurable kCentCutMax{"kCentCutMax", 100, "maximum accepted centrality"}; + Configurable antidPtMin{"antidPtMin", 0.6f, "minimum antideuteron pT (GeV/c)"}; Configurable antidPtTof{"antidPtTof", 1.0f, "antideuteron pT to switch to TOF pid (GeV/c) "}; Configurable antidPtMax{"antidPtMax", 1.8f, "maximum antideuteron pT (GeV/c)"}; @@ -242,13 +245,10 @@ struct EbyeMaker { Configurable antidNsigmaTpcCutLow{"antidNsigmaTpcCutLow", -4.f, "TPC PID cut low"}; Configurable antidNsigmaTpcCutUp{"antidNsigmaTpcCutUp", 4.f, "TPC PID cut up"}; Configurable antidTpcInnerParamMax{"tpcInnerParamMax", 0.f, "(temporary) tpc inner param cut"}; - Configurable antidTofMassMax{"tofMassMax", 0.3f, "(temporary) tof mass cut"}; Configurable antipNsigmaTpcCutLow{"antipNsigmaTpcCutLow", -4.f, "TPC PID cut low"}; Configurable antipNsigmaTpcCutUp{"antipNsigmaTpcCutUp", 4.f, "TPC PID cut up"}; Configurable antipTpcInnerParamMax{"antipTpcInnerParamMax", 0.f, "(temporary) tpc inner param cut"}; - Configurable antipTofMassMax{"antipTofMassMax", 0.3f, "(temporary) tof mass cut"}; - Configurable tofMassMaxQA{"tofMassMaxQA", 0.6f, "(temporary) tof mass cut (for QA histograms)"}; Configurable v0settingDcaV0Dau{"v0setting_dcav0dau", 0.5f, "DCA V0 Daughters"}; Configurable v0settingDcaV0Pv{"v0setting_dcav0pv", 1.f, "DCA V0 to Pv"}; @@ -271,7 +271,6 @@ struct EbyeMaker { std::array nSigmaTpcCutLow; std::array nSigmaTpcCutUp; std::array tpcInnerParamMax; - std::array tofMassMax; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -339,6 +338,7 @@ struct EbyeMaker { { const float defItsChi2NClCut = 36.f; const float defNClCROverFind = 0.8f; + const float defMinChi2Cut = 0.f; if (std::abs(track.eta()) > etaMax) { return false; } @@ -350,6 +350,7 @@ struct EbyeMaker { track.tpcNClsCrossedRows() < trackNcrossedRows || track.tpcNClsCrossedRows() < defNClCROverFind * track.tpcNClsFindable() || track.tpcChi2NCl() > trackChi2Cut || + track.tpcChi2NCl() < defMinChi2Cut || track.itsChi2NCl() > defItsChi2NClCut) { return false; } @@ -533,7 +534,6 @@ struct EbyeMaker { nSigmaTpcCutLow = std::array{antipNsigmaTpcCutLow, antidNsigmaTpcCutLow}; nSigmaTpcCutUp = std::array{antipNsigmaTpcCutUp, antidNsigmaTpcCutUp}; tpcInnerParamMax = std::array{antipTpcInnerParamMax, antidTpcInnerParamMax}; - tofMassMax = std::array{antipTofMassMax, antidTofMassMax}; } template @@ -600,7 +600,7 @@ struct EbyeMaker { const float maxTofChi2 = 3.f; // TODO: check if this is still needed bool hasTof = track.hasTOF() && track.tofChi2() < maxTofChi2; - if ((trackPt <= ptTof[iP] || (trackPt > ptTof[iP] && hasTof && std::abs(mass - kPartMass[iP]) < tofMassMaxQA)) && nSigmaTPC > nSigmaTpcCutLow[iP] && nSigmaTPC < nSigmaTpcCutUp[iP]) { // for QA histograms + if ((trackPt <= ptTof[iP] || (trackPt > ptTof[iP] && hasTof)) && nSigmaTPC > nSigmaTpcCutLow[iP] && nSigmaTPC < nSigmaTpcCutUp[iP]) { // for QA histograms tofMass[iP]->Fill(centrality, trackPt, mass); } @@ -616,7 +616,7 @@ struct EbyeMaker { continue; } - if (trackPt <= ptTof[iP] || (trackPt > ptTof[iP] && hasTof && std::abs(mass - kPartMass[iP]) < tofMassMax[iP])) { + if (trackPt <= ptTof[iP] || (trackPt > ptTof[iP] && hasTof)) { CandidateTrack candTrack; candTrack.pt = track.sign() > 0. ? trackPt : -trackPt; candTrack.eta = trackEta; @@ -925,13 +925,16 @@ struct EbyeMaker { if (std::abs(collision.posZ()) > zVtxMax || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kIsTriggerTVX) || ((!collision.selection_bit(aod::evsel::kIsGoodITSLayersAll) || !collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) && useAllEvSel)) continue; + auto centrality = collision.centFT0C(); + if (centrality < kCentCutMin || centrality > kCentCutMax) + continue; + histos.fill(HIST("QA/zVtx"), collision.posZ()); const uint64_t collIdx = collision.globalIndex(); auto v0TableThisCollision = V0s.sliceBy(perCollisionV0, collIdx); v0TableThisCollision.bindExternalIndices(&tracks); - auto centrality = collision.centFT0C(); histos.fill(HIST("QA/PvMultVsCent"), centrality, collision.numContrib()); fillRecoEvent(collision, tracks, v0TableThisCollision, centrality); From 41d60bb2c10ad4bd83539ca96bdc94b4b1cf1d4e Mon Sep 17 00:00:00 2001 From: Rrantu <156880782+Rrantu@users.noreply.github.com> Date: Fri, 10 Oct 2025 20:27:12 +0800 Subject: [PATCH 697/986] [PWGHF] Add UPC process function and QA hists (#13328) --- PWGHF/D2H/Tasks/CMakeLists.txt | 2 +- PWGHF/D2H/Tasks/taskLc.cxx | 102 ++++++++++++++++++++++++++++++++- 2 files changed, 100 insertions(+), 4 deletions(-) diff --git a/PWGHF/D2H/Tasks/CMakeLists.txt b/PWGHF/D2H/Tasks/CMakeLists.txt index 24707fb011b..26e7b49ba8b 100644 --- a/PWGHF/D2H/Tasks/CMakeLists.txt +++ b/PWGHF/D2H/Tasks/CMakeLists.txt @@ -106,7 +106,7 @@ o2physics_add_dpl_workflow(task-lb-reduced o2physics_add_dpl_workflow(task-lc SOURCES taskLc.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::SGCutParHolder O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(task-lc-to-k0s-p diff --git a/PWGHF/D2H/Tasks/taskLc.cxx b/PWGHF/D2H/Tasks/taskLc.cxx index 8c391447428..5d587dcc090 100644 --- a/PWGHF/D2H/Tasks/taskLc.cxx +++ b/PWGHF/D2H/Tasks/taskLc.cxx @@ -17,6 +17,7 @@ /// \author Vít Kučera , CERN /// \author Annalena Kalteyer , GSI Darmstadt /// \author Biao Zhang , Heidelberg University +/// \author Ran Tu , Fudan University #include "PWGHF/Core/CentralityEstimation.h" #include "PWGHF/Core/DecayChannels.h" @@ -30,6 +31,7 @@ #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" +#include #include #include #include @@ -47,6 +49,7 @@ #include #include #include +#include #include // std::vector using namespace o2; @@ -55,6 +58,13 @@ using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::hf_centrality; using namespace o2::hf_occupancy; +using namespace o2::hf_evsel; + +enum class GapType { + GapA = 0, + GapC = 1, + DoubleGap = 2, +}; /// Λc± → p± K∓ π± analysis task struct HfTaskLc { @@ -77,9 +87,15 @@ struct HfTaskLc { MlClassNonPrompt, NumberOfMlClasses }; + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable ccdbPathGrp{"ccdbPathGrp", "GLO/GRP/GRP", "Path of the grp file (Run 2)"}; + Configurable ccdbPathGrpMag{"ccdbPathGrpMag", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object (Run 3)"}; + + HfEventSelection hfEvSel; // event selection and monitoring HfHelper hfHelper; SliceCache cache; + Service ccdb; using Collisions = soa::Join; using CollisionsMc = soa::Join; @@ -205,13 +221,14 @@ struct HfTaskLc { {"MC/generated/prompt/hPhiGenPrompt", "MC particles (matched, prompt);#it{#Phi};entries", {HistType::kTH1F, {{100, 0., 6.3}}}}, {"MC/generated/nonprompt/hPhiGenNonPrompt", "MC particles (matched, non-prompt);#it{#Phi};entries", {HistType::kTH1F, {{100, 0., 6.3}}}}}}; + HistogramRegistry qaRegistry{"QAHistos", {}, OutputObjHandlingPolicy::AnalysisObject}; + void init(InitContext&) { - std::array doprocess{doprocessDataStd, doprocessDataStdWithFT0C, doprocessDataStdWithFT0M, doprocessDataWithMl, doprocessDataWithMlWithFT0C, doprocessDataWithMlWithFT0M, doprocessMcStd, doprocessMcStdWithFT0C, doprocessMcStdWithFT0M, doprocessMcWithMl, doprocessMcWithMlWithFT0C, doprocessMcWithMlWithFT0M}; + std::array doprocess{doprocessDataStd, doprocessDataStdWithFT0C, doprocessDataStdWithFT0M, doprocessDataWithMl, doprocessDataWithMlWithFT0C, doprocessDataWithMlWithFT0M, doprocessMcStd, doprocessMcStdWithFT0C, doprocessMcStdWithFT0M, doprocessMcWithMl, doprocessMcWithMlWithFT0C, doprocessMcWithMlWithFT0M, doprocessDataWithMlWithUpc}; if ((std::accumulate(doprocess.begin(), doprocess.end(), 0)) != 1) { LOGP(fatal, "no or more than one process function enabled! Please check your configuration!"); } - auto vbins = (std::vector)binsPt; /// mass candidate registry.add("Data/hMassVsPtVsNPvContributors", "3-prong candidates;inv. mass (p K #pi) (GeV/#it{c}^{2}); p_{T}; Number of PV contributors", {HistType::kTH3F, {{600, 1.98, 2.58}, {vbins, "#it{p}_{T} (GeV/#it{c})"}, {5000, 0., 10000.}}}); @@ -312,6 +329,12 @@ struct HfTaskLc { registry.add("MC/reconstructed/prompt/hDecLenErrSigPrompt", "3-prong candidates (matched, prompt);decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("MC/reconstructed/nonprompt/hDecLenErrSigNonPrompt", "3-prong candidates (matched, non-prompt);decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + qaRegistry.add("Data/fitInfo/ampFT0A_vs_ampFT0C", "FT0-A vs FT0-C amplitude;FT0-A amplitude (a.u.);FT0-C amplitude (a.u.)", {HistType::kTH2F, {{2500, 0., 250}, {2500, 0., 250}}}); + qaRegistry.add("Data/zdc/energyZNA_vs_energyZNC", "ZNA vs ZNC common energy;E_{ZNA}^{common} (a.u.);E_{ZNC}^{common} (a.u.)", {HistType::kTH2F, {{200, 0., 20}, {200, 0., 20}}}); + qaRegistry.add("Data/hUpcGapAfterSelection", "UPC gap type after selection;Gap side;Counts", {HistType::kTH1F, {{3, -0.5, 2.5}}}); + qaRegistry.get(HIST("Data/hUpcGapAfterSelection"))->GetXaxis()->SetBinLabel(static_cast(GapType::GapA) + 1, "A"); + qaRegistry.get(HIST("Data/hUpcGapAfterSelection"))->GetXaxis()->SetBinLabel(static_cast(GapType::GapC) + 1, "C"); + qaRegistry.get(HIST("Data/hUpcGapAfterSelection"))->GetXaxis()->SetBinLabel(static_cast(GapType::DoubleGap) + 1, "Double"); if (fillTHn) { const AxisSpec thnAxisMass{thnConfigAxisMass, "inv. mass (p K #pi) (GeV/#it{c}^{2})"}; const AxisSpec thnAxisPt{thnConfigAxisPt, "#it{p}_{T}(#Lambda_{c}^{+}) (GeV/#it{c})"}; @@ -332,7 +355,7 @@ struct HfTaskLc { const AxisSpec thnAxisOccupancy{thnConfigAxisOccupancy, "Occupancy"}; const AxisSpec thnAxisProperLifetime{thnConfigAxisProperLifetime, "T_{proper} (ps)"}; - bool const isDataWithMl = doprocessDataWithMl || doprocessDataWithMlWithFT0C || doprocessDataWithMlWithFT0M; + bool const isDataWithMl = doprocessDataWithMl || doprocessDataWithMlWithFT0C || doprocessDataWithMlWithFT0M || doprocessDataWithMlWithUpc; bool const isMcWithMl = doprocessMcWithMl || doprocessMcWithMlWithFT0C || doprocessMcWithMlWithFT0M; bool const isDataStd = doprocessDataStd || doprocessDataStdWithFT0C || doprocessDataStdWithFT0M; bool const isMcStd = doprocessMcStd || doprocessMcStdWithFT0C || doprocessMcStdWithFT0M; @@ -382,6 +405,12 @@ struct HfTaskLc { registry.add("hnLcVarsGen", "THn for Generated Lambdac", HistType::kTHnSparseF, axesGen); } } + + hfEvSel.addHistograms(qaRegistry); // collision monitoring + + ccdb->setURL(ccdbUrl); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); } /// Evaluate centrality/multiplicity percentile (centrality estimator is automatically selected based on the used table) @@ -859,6 +888,60 @@ struct HfTaskLc { } } + template + void runAnalysisPerCollisionDataWithUpc(CollType const& collisions, + CandType const& candidates, + BCsType const& bcs, + aod::FT0s const& ft0s, + aod::FV0As const& fv0as, + aod::FDDs const& fdds + + ) + { + + for (const auto& collision : collisions) { + + uint32_t rejectionMask{0}; // 32 bits, in case new ev. selections will be added + float centrality{-1.f}; + rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, qaRegistry, bcs); + if (rejectionMask != 0) { + /// at least one event selection not satisfied --> reject the candidate + continue; + } + auto bc = collision.template bc_as(); + upchelpers::FITInfo fitInfo{}; + udhelpers::getFITinfo(fitInfo, bc, bcs, ft0s, fv0as, fdds); + + GapType gap = GapType::DoubleGap; + if (bc.has_zdc()) { + auto zdc = bc.zdc(); + qaRegistry.fill(HIST("Data/fitInfo/ampFT0A_vs_ampFT0C"), fitInfo.ampFT0A, fitInfo.ampFT0C); + qaRegistry.fill(HIST("Data/zdc/energyZNA_vs_energyZNC"), zdc.energyCommonZNA(), zdc.energyCommonZNC()); + gap = determineGapType(fitInfo.ampFT0A, fitInfo.ampFT0C, zdc.energyCommonZNA(), zdc.energyCommonZNC()); + qaRegistry.fill(HIST("Data/hUpcGapAfterSelection"), static_cast(gap)); + } + if (gap == GapType::GapA || gap == GapType::GapC) { + fillHistosData(collision, candidates); + } else { + continue; + } + } + } + + GapType determineGapType(float FT0A, float FT0C, float ZNA, float ZNC) + { + constexpr float FT0AThreshold = 100.0; + constexpr float FT0CThreshold = 50.0; + constexpr float ZDCThreshold = 1.0; + if (FT0A < FT0AThreshold && FT0C > FT0CThreshold && ZNA < ZDCThreshold && ZNC > ZDCThreshold) { + return GapType::GapA; + } + if (FT0A > FT0AThreshold && FT0C < FT0CThreshold && ZNA > ZDCThreshold && ZNC < ZDCThreshold) { + return GapType::GapC; + } + return GapType::DoubleGap; + } + /// Run the analysis on MC data /// \tparam fillMl switch to fill ML histograms template @@ -922,6 +1005,19 @@ struct HfTaskLc { } PROCESS_SWITCH(HfTaskLc, processDataWithMlWithFT0M, "Process real data with the ML method and with FT0M centrality", false); + void processDataWithMlWithUpc(soa::Join const& collisions, + aod::BcFullInfos const& bcs, + LcCandidatesMl const& selectedLcCandidatesMl, + aod::Tracks const&, + aod::FT0s const& ft0s, + aod::FV0As const& fv0as, + aod::FDDs const& fdds, + aod::Zdcs const& /*zdcs*/) + { + runAnalysisPerCollisionDataWithUpc(collisions, selectedLcCandidatesMl, bcs, ft0s, fv0as, fdds); + } + PROCESS_SWITCH(HfTaskLc, processDataWithMlWithUpc, "Process real data with the ML method with UPC", false); + void processMcStd(CollisionsMc const& collisions, LcCandidatesMc const& selectedLcCandidatesMc, McParticles3ProngMatched const& mcParticles, From 4139c47bef679e58e099bc75bd1789d1e386efc1 Mon Sep 17 00:00:00 2001 From: ilikmeta <152337132+ilikmeta@users.noreply.github.com> Date: Fri, 10 Oct 2025 08:20:05 -0500 Subject: [PATCH 698/986] [PWGCF] Set global tracks in track filter (#13317) Co-authored-by: ALICE Action Bot --- PWGCF/Flow/Tasks/flowGfwTask.cxx | 95 +++++++++++++++++--------------- 1 file changed, 50 insertions(+), 45 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowGfwTask.cxx b/PWGCF/Flow/Tasks/flowGfwTask.cxx index eacb6978329..c174711c4ab 100644 --- a/PWGCF/Flow/Tasks/flowGfwTask.cxx +++ b/PWGCF/Flow/Tasks/flowGfwTask.cxx @@ -14,40 +14,41 @@ /// \since Mar 28, 2024 /// \brief Multiparticle flow measurements with FT0 and ZDC -#include -#include -#include -#include -#include -#include -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/AnalysisDataModel.h" +#include "FlowContainer.h" +#include "GFW.h" +#include "GFWCumulant.h" +#include "GFWPowerArray.h" +#include "GFWWeights.h" -#include "Common/DataModel/EventSelection.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectionDefaults.h" -#include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" #include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/GlobalTrackID.h" #include "ReconstructionDataFormats/Track.h" -#include "TPDGCode.h" +#include +#include -#include "GFWPowerArray.h" -#include "GFW.h" -#include "GFWCumulant.h" -#include "GFWWeights.h" -#include "FlowContainer.h" #include "TList.h" +#include "TPDGCode.h" +#include #include #include -#include + +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -70,31 +71,31 @@ struct FlowGfwTask { O2_DEFINE_CONFIGURABLE(cfgCutPtMax, float, 3.0f, "Maximal pT for ref tracks") O2_DEFINE_CONFIGURABLE(cfgCutEta, float, 0.8f, "Eta range for tracks") O2_DEFINE_CONFIGURABLE(cfgCutChi2prTPCcls, float, 2.5, "Chi2 per TPC clusters") - O2_DEFINE_CONFIGURABLE(cfgCutTPCclu, float, 70.0f, "minimum TPC clusters") + O2_DEFINE_CONFIGURABLE(cfgCutTPCclu, float, 50.0f, "minimum TPC clusters") + O2_DEFINE_CONFIGURABLE(cfgCutTPCCrossedRows, float, 70.0f, "minimum TPC crossed rows") O2_DEFINE_CONFIGURABLE(cfgCutITSclu, float, 5.0f, "minimum ITS clusters") O2_DEFINE_CONFIGURABLE(cfgTrackSel, bool, false, "ITS and TPC cluster selection") O2_DEFINE_CONFIGURABLE(cfgMinCentFT0C, float, 0.0f, "Minimum FT0C Centrality") O2_DEFINE_CONFIGURABLE(cfgMaxCentFT0C, float, 100.0f, "Maximum FT0C Centrality") + O2_DEFINE_CONFIGURABLE(cfgCutOccupancyHigh, int, 500, "High cut on TPC occupancy") + O2_DEFINE_CONFIGURABLE(cfgCutOccupancyLow, int, 0, "Low cut on TPC occupancy") + O2_DEFINE_CONFIGURABLE(cfgCutDCAz, float, 2.0f, "Custom DCA Z cut") + O2_DEFINE_CONFIGURABLE(cfgNbootstrap, int, 10, "Number of subsamples") O2_DEFINE_CONFIGURABLE(cfgCentEstFt0c, bool, false, "Centrality estimator based on FT0C signal") O2_DEFINE_CONFIGURABLE(cfgCentEstFt0a, bool, false, "Centrality estimator based on FT0A signal") O2_DEFINE_CONFIGURABLE(cfgCentEstFt0m, bool, false, " A centrality estimator based on FT0A+FT0C signals.") O2_DEFINE_CONFIGURABLE(cfgCentEstFv0a, bool, false, "Centrality estimator based on FV0A signal") O2_DEFINE_CONFIGURABLE(cfgCentEstFt0cVariant1, bool, false, "A variant of FT0C") - O2_DEFINE_CONFIGURABLE(cfgUseAdditionalEventCut, bool, false, "Use additional event cut on mult correlations") - O2_DEFINE_CONFIGURABLE(cfgUseAdditionalTrackCut, bool, false, "Use additional track cut on phi") - O2_DEFINE_CONFIGURABLE(cfgTrackSelRun3ITSMatch, bool, false, "Track selection for ITS matches") - O2_DEFINE_CONFIGURABLE(cfgUseNch, bool, false, "Use Nch for flow observables") - O2_DEFINE_CONFIGURABLE(cfgNbootstrap, int, 10, "Number of subsamples") O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeights, bool, false, "Fill and output NUA weights") - O2_DEFINE_CONFIGURABLE(cfgEfficiency, std::string, "", "CCDB path to efficiency object") + O2_DEFINE_CONFIGURABLE(cfgEfficiencyPt, std::string, "", "CCDB path to efficiency object") O2_DEFINE_CONFIGURABLE(cfgEfficiencyNch, std::string, "", "CCDB path to Nch efficiency object") O2_DEFINE_CONFIGURABLE(cfgAcceptance, std::string, "", "CCDB path to acceptance object") O2_DEFINE_CONFIGURABLE(cfgMagnetField, std::string, "GLO/Config/GRPMagField", "CCDB path to Magnet field object") - O2_DEFINE_CONFIGURABLE(cfgCutOccupancyHigh, int, 500, "High cut on TPC occupancy") - O2_DEFINE_CONFIGURABLE(cfgCutOccupancyLow, int, 0, "Low cut on TPC occupancy") - O2_DEFINE_CONFIGURABLE(cfgCutDCAz, float, 2, "Custom DCA Z cut") - O2_DEFINE_CONFIGURABLE(cfgCutDCAxy, float, 0.2f, "Custom DCA XY cut") O2_DEFINE_CONFIGURABLE(cfgDCAzPt, bool, true, "switch for DCAz pt dependent") + O2_DEFINE_CONFIGURABLE(cfgTrackSelRun3ITSMatch, bool, false, "Track selection for ITS matches") + O2_DEFINE_CONFIGURABLE(cfgUseAdditionalEventCut, bool, false, "Use additional event cut on mult correlations") + O2_DEFINE_CONFIGURABLE(cfgUseAdditionalTrackCut, bool, false, "Use additional track cut on phi") + O2_DEFINE_CONFIGURABLE(cfgOccupancy, bool, false, "Bool for event selection on detector occupancy"); O2_DEFINE_CONFIGURABLE(cfgNoTimeFrameBorder, bool, false, "kNoTimeFrameBorder"); O2_DEFINE_CONFIGURABLE(cfgNoITSROFrameBorder, bool, false, "kNoITSROFrameBorder"); O2_DEFINE_CONFIGURABLE(cfgNoSameBunchPileup, bool, false, "kNoSameBunchPileup"); @@ -102,9 +103,9 @@ struct FlowGfwTask { O2_DEFINE_CONFIGURABLE(cfgIsVertexITSTPC, bool, false, "kIsVertexITSTPC"); O2_DEFINE_CONFIGURABLE(cfgNoCollInTimeRangeStandard, bool, false, "kNoCollInTimeRangeStandard"); O2_DEFINE_CONFIGURABLE(cfgEvSelkIsGoodITSLayersAll, bool, false, "kIsGoodITSLayersAll") - O2_DEFINE_CONFIGURABLE(cfgOccupancy, bool, false, "Bool for event selection on detector occupancy"); O2_DEFINE_CONFIGURABLE(cfgMultCut, bool, false, "Use additional event cut on mult correlations"); O2_DEFINE_CONFIGURABLE(cfgV0AT0A5Sigma, bool, false, "V0A T0A 5 sigma cut") + O2_DEFINE_CONFIGURABLE(cfgGlobalTracks, bool, false, "Global tracks") O2_DEFINE_CONFIGURABLE(cfgGlobalplusITS, bool, false, "Global and ITS tracks") O2_DEFINE_CONFIGURABLE(cfgGlobalonly, bool, false, "Global only tracks") O2_DEFINE_CONFIGURABLE(cfgITSonly, bool, false, "ITS only tracks") @@ -360,6 +361,7 @@ struct FlowGfwTask { registry.add("phi_Cen_ITSOnly", "phi_Cen_ITS;Centrality (%); #phi;", {HistType::kTH2D, {axisCentrality, axisPhi}}); // Track types + registry.add("GlobalTracks", "Global Tracks;Centrality FT0C;Nch", {HistType::kTH2D, {axisCentrality, axisNch}}); registry.add("GlobalplusITS", "Global plus ITS;Centrality FT0C;Nch", {HistType::kTH2D, {axisCentrality, axisNch}}); registry.add("Globalonly", "Global only;Centrality FT0C;Nch", {HistType::kTH2D, {axisCentrality, axisNch}}); registry.add("ITSonly", "ITS only;Centrality FT0C;Nch", {HistType::kTH2D, {axisCentrality, axisNch}}); @@ -620,12 +622,12 @@ struct FlowGfwTask { else LOGF(warning, "Could not load acceptance weights from %s (%p)", cfgAcceptance.value.c_str(), (void*)mAcceptance); } - if (cfgEfficiency.value.empty() == false) { - mEfficiency = ccdb->getForTimeStamp(cfgEfficiency, timestamp); + if (cfgEfficiencyPt.value.empty() == false) { + mEfficiency = ccdb->getForTimeStamp(cfgEfficiencyPt, timestamp); if (mEfficiency == nullptr) { - LOGF(fatal, "Could not load efficiency histogram for trigger particles from %s", cfgEfficiency.value.c_str()); + LOGF(fatal, "Could not load Pt efficiency histogram for trigger particles from %s", cfgEfficiencyPt.value.c_str()); } - LOGF(info, "Loaded efficiency histogram from %s (%p)", cfgEfficiency.value.c_str(), (void*)mEfficiency); + LOGF(info, "Loaded efficiency histogram from %s (%p)", cfgEfficiencyPt.value.c_str(), (void*)mEfficiency); } if (cfgEfficiencyNch.value.empty() == false) { @@ -809,20 +811,16 @@ struct FlowGfwTask { return ((track.tpcNClsFound() >= cfgCutTPCclu) && (track.itsNCls() >= cfgCutITSclu)); } else if (cfgITSonly) { return ((track.itsNCls() >= cfgCutITSclu)); + } else if (cfgGlobalTracks) { + return ((track.tpcNClsFound() >= cfgCutTPCclu) && (track.tpcNClsCrossedRows() >= cfgCutTPCCrossedRows) && (track.itsNCls() >= cfgCutITSclu)); } else { return false; } } - // Apply process filters + // Apply process filters GlobalTracks Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex && (aod::cent::centFT0C > cfgMinCentFT0C) && (aod::cent::centFT0C < cfgMaxCentFT0C); - Filter trackFilter = ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) && - ncheckbit(aod::track::trackCutFlag, TrackSelectionITS) && - ifnode(ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC), - ncheckbit(aod::track::trackCutFlag, TrackSelectionTPC), true) && - ifnode(dcaZ > 0.f, nabs(aod::track::dcaZ) <= dcaZ && ncheckbit(aod::track::trackCutFlag, TrackSelectionDCAXYonly), - ncheckbit(aod::track::trackCutFlag, TrackSelectionDCA)) && - (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls); + Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls) && (nabs(aod::track::dcaZ) < cfgCutDCAz); void processData(Colls::iterator const& collision, aod::BCsWithTimestamps const&, AodTracks const& tracks, aod::FT0s const&, aod::Zdcs const&, BCsRun3 const&) { @@ -1029,6 +1027,13 @@ struct FlowGfwTask { registry.fill(HIST("hDCAxy"), track.dcaXY(), track.pt()); } + if (cfgGlobalTracks) { + if (withinPtRef) { + registry.fill(HIST("GlobalTracks"), centrality, nch); + fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc * weff, 1); + } + } + if (cfgGlobalplusITS) { if (withinPtRef) { registry.fill(HIST("GlobalplusITS"), centrality, nch); From 3b8bfc8179e9d2f3630f2f1235f3a2d0d7f544f4 Mon Sep 17 00:00:00 2001 From: HANSEO PARK <53218370+hanseopark@users.noreply.github.com> Date: Sat, 11 Oct 2025 00:08:39 +0900 Subject: [PATCH 699/986] [PWGJE] revise histogram of type, axis and name (#13298) --- PWGJE/Tasks/jetTaggerHFQA.cxx | 40 ++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/PWGJE/Tasks/jetTaggerHFQA.cxx b/PWGJE/Tasks/jetTaggerHFQA.cxx index 8bb10a544b0..55d6c338b5a 100644 --- a/PWGJE/Tasks/jetTaggerHFQA.cxx +++ b/PWGJE/Tasks/jetTaggerHFQA.cxx @@ -382,10 +382,12 @@ struct JetTaggerHFQA { registry.add("h2_jet_phi_mult", "", {HistType::kTH2F, {{axisPhi}, {axisMult}}}); if (fillGeneralSVQA) { registry.add("h2_3prong_nprongs_mult", "", {HistType::kTH2F, {{axisNprongs}, {axisMult}}}); - registry.add("hn_jet_3prong_mult", "", {HistType::kTHnF, {{axisJetPt}, {axisLxy}, {axisSigmaLxy}, {axisSxy}, {axisLxyz}, {axisSigmaLxyz}, {axisSxyz}, {axisMult}}}); + registry.add("hn_jet_3prong_mult", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisLxy}, {axisSigmaLxy}, {axisSxy}, {axisLxyz}, {axisSigmaLxyz}, {axisSxyz}, {axisMult}}}); } - registry.add("hn_jet_pt_3prong_Sxy_N1_mult", "", {HistType::kTHnF, {{axisJetPt}, {axisSxy}, {axisMass}, {axisMult}}}); - registry.add("hn_jet_pt_3prong_Sxyz_N1_mult", "", {HistType::kTHnF, {{axisJetPt}, {axisSxyz}, {axisMass}, {axisMult}}}); + registry.add("hn_jet_3prong_Sxy_N1_mult", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisSxy}, {axisMass}, {axisMult}}}); + registry.add("hn_jet_3prong_Sxyz_N1_mult", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisSxyz}, {axisMass}, {axisMult}}}); + registry.add("hn_taggedjet_3prong_Sxy_N1_mult", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisSxy}, {axisMass}, {axisMult}}}); + registry.add("hn_taggedjet_3prong_Sxyz_N1_mult", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisSxyz}, {axisMass}, {axisMult}}}); } if (doprocessSV2ProngMCD || doprocessSV2ProngMCDWeighted || doprocessSV2ProngMCPMCDMatched || doprocessSV2ProngMCPMCDMatchedWeighted) { if (!(doprocessIPsMCD || doprocessIPsMCDWeighted || doprocessIPsMCPMCDMatched || doprocessIPsMCPMCDMatchedWeighted) && !(doprocessJPMCD || doprocessJPMCDWeighted || doprocessJPMCPMCDMatched || doprocessJPMCPMCDMatchedWeighted) && !(doprocessSV3ProngMCD || doprocessSV3ProngMCDWeighted || doprocessSV3ProngMCPMCDMatched || doprocessSV3ProngMCPMCDMatchedWeighted)) { @@ -435,18 +437,18 @@ struct JetTaggerHFQA { registry.add("h3_taggedjet_pt_3prong_mass_N1_flavour", "", {HistType::kTH3F, {{axisJetPt}, {axisMass}, {axisJetFlavour}}}); registry.add("h3_taggedjet_pt_3prong_mass_xyz_N1_flavour", "", {HistType::kTH3F, {{axisJetPt}, {axisMass}, {axisJetFlavour}}}); } - if (doprocessSV3ProngMCDMult) { - registry.add("h2_jet_pt_mult_flavour", "", {HistType::kTH3F, {{axisJetPt}, {axisJetFlavour}, {axisMult}}}); - registry.add("h2_jet_eta_mult_flavour", "", {HistType::kTH3F, {{axisEta}, {axisJetFlavour}, {axisMult}}}); - registry.add("h2_jet_phi_mult_flavour", "", {HistType::kTH3F, {{axisPhi}, {axisJetFlavour}, {axisMult}}}); + if (doprocessSV3ProngMCDMult || doprocessSV3ProngMCDMultWeighted || doprocessSV3ProngMCPMCDMatchedMult || doprocessSV3ProngMCPMCDMatchedMultWeighted) { + registry.add("h3_jet_pt_mult_flavour", "", {HistType::kTH3F, {{axisJetPt}, {axisMult}, {axisJetFlavour}}}); + registry.add("h3_jet_eta_mult_flavour", "", {HistType::kTH3F, {{axisEta}, {axisMult}, {axisJetFlavour}}}); + registry.add("h3_jet_phi_mult_flavour", "", {HistType::kTH3F, {{axisPhi}, {axisMult}, {axisJetFlavour}}}); if (fillGeneralSVQA) { registry.add("h3_3prong_nprongs_mult_flavour", "", {HistType::kTH3F, {{axisNprongs}, {axisMult}, {axisJetFlavour}}}); - registry.add("hn_jet_3prong_mult_flavour", "", {HistType::kTHnF, {{axisJetPt}, {axisLxy}, {axisSigmaLxy}, {axisSxy}, {axisLxyz}, {axisSigmaLxyz}, {axisSxyz}, {axisMult}, {axisJetFlavour}}}); + registry.add("hn_jet_3prong_mult_flavour", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisLxy}, {axisSigmaLxy}, {axisSxy}, {axisLxyz}, {axisSigmaLxyz}, {axisSxyz}, {axisMult}, {axisJetFlavour}}}); } - registry.add("hn_jet_3prong_Sxy_N1_mult_flavour", "", {HistType::kTHnF, {{axisJetPt}, {axisSxy}, {axisMass}, {axisMult}, {axisJetFlavour}}}); - registry.add("hn_jet_3prong_Sxyz_N1_mult_flavour", "", {HistType::kTHnF, {{axisJetPt}, {axisSxyz}, {axisMass}, {axisMult}, {axisJetFlavour}}}); - registry.add("hn_taggedjet_3prong_Sxy_N1_mult_flavour", "", {HistType::kTHnF, {{axisJetPt}, {axisSxy}, {axisSxyz}, {axisMass}, {axisMult}, {axisJetFlavour}}}); - registry.add("hn_taggedjet_3prong_Sxyz_N1_mult_flavour", "", {HistType::kTHnF, {{axisJetPt}, {axisSxy}, {axisSxyz}, {axisMass}, {axisMult}, {axisJetFlavour}}}); + registry.add("hn_jet_3prong_Sxy_N1_mult_flavour", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisSxy}, {axisMass}, {axisMult}, {axisJetFlavour}}}); + registry.add("hn_jet_3prong_Sxyz_N1_mult_flavour", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisSxyz}, {axisMass}, {axisMult}, {axisJetFlavour}}}); + registry.add("hn_taggedjet_3prong_Sxy_N1_mult_flavour", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisSxy}, {axisSxyz}, {axisMass}, {axisMult}, {axisJetFlavour}}}); + registry.add("hn_taggedjet_3prong_Sxyz_N1_mult_flavour", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisSxy}, {axisSxyz}, {axisMass}, {axisMult}, {axisJetFlavour}}}); } } @@ -1022,9 +1024,9 @@ struct JetTaggerHFQA { if (checkSv && jettaggingutilities::svAcceptance(bjetCand, svDispersionMax)) { auto maxSxy = bjetCand.decayLengthXY() / bjetCand.errorDecayLengthXY(); auto massSV = bjetCand.m(); - registry.fill(HIST("hn_jet_pt_3prong_Sxy_N1_mult"), jet.pt(), maxSxy, massSV, mult); + registry.fill(HIST("hn_jet_3prong_Sxy_N1_mult"), jet.pt(), maxSxy, massSV, mult); if (jet.isTagged(BJetTaggingMethod::SV)) { - registry.fill(HIST("hn_taggedjet_pt_3prong_Sxy_N1_mult"), jet.pt(), maxSxy, massSV, mult); + registry.fill(HIST("hn_taggedjet_3prong_Sxy_N1_mult"), jet.pt(), maxSxy, massSV, mult); } } if (fillSVxyz) { @@ -1033,9 +1035,9 @@ struct JetTaggerHFQA { if (checkSv && jettaggingutilities::svAcceptance(bjetCandXYZ, svDispersionMax)) { auto maxSxyz = bjetCandXYZ.decayLength() / bjetCandXYZ.errorDecayLength(); auto massSV = bjetCandXYZ.m(); - registry.fill(HIST("h2_jet_pt_3prong_Sxy_N1_mult"), jet.pt(), maxSxyz, massSV, mult); + registry.fill(HIST("hn_jet_3prong_Sxyz_N1_mult"), jet.pt(), maxSxyz, massSV, mult); if (jet.isTagged(BJetTaggingMethod::SV3D)) { - registry.fill(HIST("h2_taggedjet_pt_3prong_Sxyz_N1_mult"), jet.pt(), maxSxyz, massSV, mult); + registry.fill(HIST("hn_taggedjet_3prong_Sxyz_N1_mult"), jet.pt(), maxSxyz, massSV, mult); } } } @@ -1168,7 +1170,7 @@ struct JetTaggerHFQA { registry.fill(HIST("h3_jet_eta_mult_flavour"), mcdjet.eta(), mult, origin, eventWeight); registry.fill(HIST("h3_jet_phi_mult_flavour"), mcdjet.phi(), mult, origin, eventWeight); if (fillGeneralSVQA) { - registry.fill(HIST("h3_3prong_nprongs_mult_flavour"), mcdjet.template secondaryVertices_as().size(), mult, origin); + registry.fill(HIST("h3_3prong_nprongs_mult_flavour"), mcdjet.template secondaryVertices_as().size(), mult, origin, eventWeight); for (const auto& prong : mcdjet.template secondaryVertices_as()) { registry.fill(HIST("hn_jet_3prong_mult_flavour"), mcdjet.pt(), prong.decayLengthXY(), prong.errorDecayLengthXY(), prong.decayLengthXY() / prong.errorDecayLengthXY(), prong.decayLength(), prong.errorDecayLengthXY(), prong.decayLength() / prong.errorDecayLengthXY(), origin, eventWeight); } @@ -1180,7 +1182,7 @@ struct JetTaggerHFQA { auto massSV = bjetCand.m(); registry.fill(HIST("hn_jet_3prong_Sxy_N1_mult_flavour"), mcdjet.pt(), maxSxy, massSV, mult, origin, eventWeight); if (mcdjet.isTagged(BJetTaggingMethod::SV)) { - registry.fill(HIST("hn_taggedjet_pt_3prong_Sxy_N1_mult_flavour"), mcdjet.pt(), maxSxy, massSV, mult, origin, eventWeight); + registry.fill(HIST("hn_taggedjet_3prong_Sxy_N1_mult_flavour"), mcdjet.pt(), maxSxy, massSV, mult, origin, eventWeight); } } if (fillSVxyz) { @@ -1190,7 +1192,7 @@ struct JetTaggerHFQA { auto massSV = bjetCandXYZ.m(); registry.fill(HIST("hn_jet_3prong_Sxyz_N1_mult_flavour"), mcdjet.pt(), maxSxyz, massSV, mult, origin, eventWeight); if (mcdjet.isTagged(BJetTaggingMethod::SV3D)) { - registry.fill(HIST("hn_taggedjet_pt_3prong_Sxyz_N1_mult_flavour"), mcdjet.pt(), maxSxyz, massSV, mult, origin, eventWeight); + registry.fill(HIST("hn_taggedjet_3prong_Sxyz_N1_mult_flavour"), mcdjet.pt(), maxSxyz, massSV, mult, origin, eventWeight); } } } From aaa3fef1ca1e88ffd958b647c5b4a41ffbdd3d3c Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Fri, 10 Oct 2025 17:11:21 +0200 Subject: [PATCH 700/986] [PWGLF] Add information about pair mass (#13329) --- .../Strangeness/lambdaspincorrderived.cxx | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx index 111fa2b514f..ae2e7bb34a9 100644 --- a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx @@ -123,6 +123,7 @@ struct lambdaspincorrderived { ConfigurableAxis configThnAxisPol{"configThnAxisPol", {80, 0.0, 8.0}, "cos#it{#theta *}"}; ConfigurableAxis configThnAxisCentrality{"configThnAxisCentrality", {8, 0.0, 80.0}, "Centrality"}; ConfigurableAxis configThnAxisRapidity{"configThnAxisRapidity", {5, 0.0, 1.0}, "Rapidity"}; + ConfigurableAxis configThnAxisPairMass{"configThnAxisPairMass", {100, 2.0, 3.0}, "PairMass"}; ConfigurableAxis configThnAxisPhi{"configThnAxisPhi", {18, 0.0, 2.0 * TMath::Pi()}, "Phi"}; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -163,6 +164,16 @@ struct lambdaspincorrderived { histos.add("hSparseRapAntiLambdaLambdaMixed", "hSparseRapAntiLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); histos.add("hSparseRapAntiLambdaAntiLambdaMixed", "hSparseRapAntiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); + histos.add("hSparsePairMassLambdaLambda", "hSparsePairMassLambdaLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); + histos.add("hSparsePairMassLambdaAntiLambda", "hSparsePairMassLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); + histos.add("hSparsePairMassAntiLambdaLambda", "hSparsePairMassAntiLambdLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); + histos.add("hSparsePairMassAntiLambdaAntiLambda", "hSparsePairMassAntiLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); + + histos.add("hSparsePairMassLambdaLambdaMixed", "hSparsePairMassLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); + histos.add("hSparsePairMassLambdaAntiLambdaMixed", "hSparsePairMassLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); + histos.add("hSparsePairMassAntiLambdaLambdaMixed", "hSparsePairMassAntiLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); + histos.add("hSparsePairMassAntiLambdaAntiLambdaMixed", "hSparsePairMassAntiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); + ccdb->setURL(cfgCcdbParam.cfgURL); ccdbApi.init("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); @@ -329,15 +340,19 @@ struct lambdaspincorrderived { if (tag1 == 0 && tag2 == 0) { histos.fill(HIST("hSparseLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); histos.fill(HIST("hSparseRapLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); + histos.fill(HIST("hSparsePairMassLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), mixpairweight); } else if (tag1 == 0 && tag2 == 1) { histos.fill(HIST("hSparseLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); histos.fill(HIST("hSparseRapLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); + histos.fill(HIST("hSparsePairMassLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), mixpairweight); } else if (tag1 == 1 && tag2 == 0) { histos.fill(HIST("hSparseAntiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); histos.fill(HIST("hSparseRapAntiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); + histos.fill(HIST("hSparsePairMassAntiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), mixpairweight); } else if (tag1 == 1 && tag2 == 1) { histos.fill(HIST("hSparseAntiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); histos.fill(HIST("hSparseRapAntiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); + histos.fill(HIST("hSparsePairMassAntiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), mixpairweight); } } else if (datatype == 1) { double weight = mixpairweight; @@ -349,18 +364,22 @@ struct lambdaspincorrderived { histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight); histos.fill(HIST("hSparseLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); histos.fill(HIST("hSparseRapLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); + histos.fill(HIST("hSparsePairMassLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), weight); } else if (tag1 == 0 && tag2 == 1) { histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight); histos.fill(HIST("hSparseLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); histos.fill(HIST("hSparseRapLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); + histos.fill(HIST("hSparsePairMassLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), weight); } else if (tag1 == 1 && tag2 == 0) { histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight); histos.fill(HIST("hSparseAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); histos.fill(HIST("hSparseRapAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); + histos.fill(HIST("hSparsePairMassAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), weight); } else if (tag1 == 1 && tag2 == 1) { histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight); histos.fill(HIST("hSparseAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); histos.fill(HIST("hSparseRapAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); + histos.fill(HIST("hSparsePairMassAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), weight); } } } @@ -619,6 +638,10 @@ struct lambdaspincorrderived { continue; // no shared daughter if (t1.pionIndex() == t2.pionIndex()) continue; + if (t1.protonIndex() == t2.pionIndex()) + continue; + if (t1.pionIndex() == t2.protonIndex()) + continue; // --- First pass over previous events: count replacements for t1 (first leg) int mixes = 0; From b8f6456524c0b5d59b5e9260e6189c50bbf02d85 Mon Sep 17 00:00:00 2001 From: Rrantu <156880782+Rrantu@users.noreply.github.com> Date: Sat, 11 Oct 2025 00:46:18 +0800 Subject: [PATCH 701/986] [PWGHF] Use auto for values returned from functions (#13330) --- PWGHF/D2H/Tasks/taskLc.cxx | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskLc.cxx b/PWGHF/D2H/Tasks/taskLc.cxx index 5d587dcc090..68ff2ad4fa3 100644 --- a/PWGHF/D2H/Tasks/taskLc.cxx +++ b/PWGHF/D2H/Tasks/taskLc.cxx @@ -225,7 +225,7 @@ struct HfTaskLc { void init(InitContext&) { - std::array doprocess{doprocessDataStd, doprocessDataStdWithFT0C, doprocessDataStdWithFT0M, doprocessDataWithMl, doprocessDataWithMlWithFT0C, doprocessDataWithMlWithFT0M, doprocessMcStd, doprocessMcStdWithFT0C, doprocessMcStdWithFT0M, doprocessMcWithMl, doprocessMcWithMlWithFT0C, doprocessMcWithMlWithFT0M, doprocessDataWithMlWithUpc}; + std::array doprocess{doprocessDataStd, doprocessDataStdWithFT0C, doprocessDataStdWithFT0M, doprocessDataWithMl, doprocessDataWithMlWithFT0C, doprocessDataWithMlWithFT0M, doprocessMcStd, doprocessMcStdWithFT0C, doprocessMcStdWithFT0M, doprocessMcWithMl, doprocessMcWithMlWithFT0C, doprocessMcWithMlWithFT0M, doprocessDataWithMlWithUpc, doprocessDataStdWithUpc}; if ((std::accumulate(doprocess.begin(), doprocess.end(), 0)) != 1) { LOGP(fatal, "no or more than one process function enabled! Please check your configuration!"); } @@ -357,7 +357,7 @@ struct HfTaskLc { bool const isDataWithMl = doprocessDataWithMl || doprocessDataWithMlWithFT0C || doprocessDataWithMlWithFT0M || doprocessDataWithMlWithUpc; bool const isMcWithMl = doprocessMcWithMl || doprocessMcWithMlWithFT0C || doprocessMcWithMlWithFT0M; - bool const isDataStd = doprocessDataStd || doprocessDataStdWithFT0C || doprocessDataStdWithFT0M; + bool const isDataStd = doprocessDataStd || doprocessDataStdWithFT0C || doprocessDataStdWithFT0M || doprocessDataStdWithUpc; bool const isMcStd = doprocessMcStd || doprocessMcStdWithFT0C || doprocessMcStdWithFT0M; std::vector axesStd, axesWithBdt, axesGen; @@ -901,9 +901,8 @@ struct HfTaskLc { for (const auto& collision : collisions) { - uint32_t rejectionMask{0}; // 32 bits, in case new ev. selections will be added float centrality{-1.f}; - rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, qaRegistry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, qaRegistry, bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -1018,6 +1017,19 @@ struct HfTaskLc { } PROCESS_SWITCH(HfTaskLc, processDataWithMlWithUpc, "Process real data with the ML method with UPC", false); + void processDataStdWithUpc(soa::Join const& collisions, + aod::BcFullInfos const& bcs, + LcCandidatesMl const& selectedLcCandidatesMl, + aod::Tracks const&, + aod::FT0s const& ft0s, + aod::FV0As const& fv0as, + aod::FDDs const& fdds, + aod::Zdcs const& /*zdcs*/) + { + runAnalysisPerCollisionDataWithUpc(collisions, selectedLcCandidatesMl, bcs, ft0s, fv0as, fdds); + } + PROCESS_SWITCH(HfTaskLc, processDataStdWithUpc, "Process real data with the standard method with UPC", false); + void processMcStd(CollisionsMc const& collisions, LcCandidatesMc const& selectedLcCandidatesMc, McParticles3ProngMatched const& mcParticles, From 04586ece03e31a266f8892cc2bf699c6ca0ca4ce Mon Sep 17 00:00:00 2001 From: ynishida-style Date: Fri, 10 Oct 2025 19:19:11 +0200 Subject: [PATCH 702/986] [PWGJE] Add processes to get track efficiency (#13323) --- PWGJE/Tasks/jetShape.cxx | 87 +++++++++++++++++++++++++++++++++++----- 1 file changed, 76 insertions(+), 11 deletions(-) diff --git a/PWGJE/Tasks/jetShape.cxx b/PWGJE/Tasks/jetShape.cxx index 58741ddd769..a2d0f54b779 100644 --- a/PWGJE/Tasks/jetShape.cxx +++ b/PWGJE/Tasks/jetShape.cxx @@ -30,6 +30,8 @@ #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" +#include + #include #include #include @@ -49,6 +51,8 @@ struct JetShapeTask { Configurable nBinsTofBeta{"nBinsTofBeta", 350, "Number of Beta bins"}; Configurable pMax{"pMax", 7.0f, "Max value of p"}; Configurable ptMax{"ptMax", 5.0f, "Max value of pT"}; + Configurable nBinsP{"nBinsP", 70, "Number of p bins"}; + Configurable nBinsPt{"nBinsPt", 50, "Number of pT bins"}; Configurable nBinsDistance{"nBinsDistance", 7, "Number of distance bins"}; Configurable distanceMax{"distanceMax", 0.7f, "Max value of distance"}; Configurable nSigmaTofCut{"nSigmaTofCut", 2.0f, "Number of sigma cut for TOF PID"}; @@ -62,17 +66,17 @@ struct JetShapeTask { {"tpcTofPr", "tpcTofPr", {HistType::kTHnSparseD, {{35, 0, pMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}, {nBinsDistance, 0, distanceMax}}}}, {"tpcTofPiOutOfJet", "tpcTofPiOutOfJet", {HistType::kTH2F, {{35, 0, pMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}}, {"tpcTofPrOutOfJet", "tpcTofPrOutOfJet", {HistType::kTH2F, {{35, 0, pMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}}, - {"tpcPi", "tpcPi", {HistType::kTH2F, {{70, 0, pMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}}, - {"tofPi", "tofPi", {HistType::kTH2F, {{50, 0, ptMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}}, - {"tpcPr", "tpcPr", {HistType::kTH2F, {{70, 0, pMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}}, - {"tofPr", "tofPr", {HistType::kTH2F, {{50, 0, ptMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}}, + {"tpcPi", "tpcPi", {HistType::kTH2F, {{nBinsP, 0, pMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}}, + {"tofPi", "tofPi", {HistType::kTH2F, {{nBinsPt, 0, ptMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}}, + {"tpcPr", "tpcPr", {HistType::kTH2F, {{nBinsP, 0, pMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}}, + {"tofPr", "tofPr", {HistType::kTH2F, {{nBinsPt, 0, ptMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}}, {"tpcDedx", "tpcDedx", {HistType::kTHnSparseD, {{nBinsPForDedx, 0, pMax}, {nBinsTpcDedx, 0, 1000}, {nBinsDistance, 0, distanceMax}}}}, {"tpcDedxOutOfJet", "tpcDedxOutOfJet", {HistType::kTH2F, {{nBinsPForDedx, 0, pMax}, {nBinsTpcDedx, 0, 1000}}}}, {"tofBeta", "tofBeta", {HistType::kTH2F, {{nBinsPForBeta, 0, pMax}, {nBinsTofBeta, 0.4, 1.1}}}}, - {"pVsPtForPr", "pVsPtForPr", {HistType::kTHnSparseD, {{70, 0, pMax}, {50, 0, ptMax}, {nBinsDistance, 0, distanceMax}}}}, - {"pVsPtForPi", "pVsPtPi", {HistType::kTHnSparseD, {{70, 0, pMax}, {50, 0, ptMax}, {nBinsDistance, 0, distanceMax}}}}, - {"pVsPtForPrOutOfJet", "pVsPtForPrOutOfJet", {HistType::kTH2F, {{70, 0, pMax}, {50, 0, ptMax}}}}, - {"pVsPtForPiOutOfJet", "pVsPtPionOutOfJet", {HistType::kTH2F, {{70, 0, pMax}, {50, 0, ptMax}}}}, + {"pVsPtForPr", "pVsPtForPr", {HistType::kTHnSparseD, {{nBinsP, 0, pMax}, {nBinsPt, 0, ptMax}, {nBinsDistance, 0, distanceMax}}}}, + {"pVsPtForPi", "pVsPtPi", {HistType::kTHnSparseD, {{nBinsP, 0, pMax}, {nBinsPt, 0, ptMax}, {nBinsDistance, 0, distanceMax}}}}, + {"pVsPtForPrOutOfJet", "pVsPtForPrOutOfJet", {HistType::kTH2F, {{nBinsP, 0, pMax}, {nBinsPt, 0, ptMax}}}}, + {"pVsPtForPiOutOfJet", "pVsPtPionOutOfJet", {HistType::kTH2F, {{nBinsP, 0, pMax}, {nBinsPt, 0, ptMax}}}}, {"tofMass", "tofMass", {HistType::kTH1F, {{300, 0, 3}}}}, {"trackPhi", "trackPhi", {HistType::kTH1F, {{80, -1, 7}}}}, {"trackEta", "trackEta", {HistType::kTH1F, {{100, -1, 1}}}}, @@ -94,7 +98,15 @@ struct JetShapeTask { {"ptSumBg1", "ptSumBg1", {HistType::kTH2F, {{14, 0, 0.7}, {300, 0, 300}}}}, {"ptSumBg2", "ptSumBg2", {HistType::kTH2F, {{14, 0, 0.7}, {300, 0, 300}}}}, {"event/vertexz", ";Vtx_{z} (cm);Entries", {HistType::kTH1F, {{100, -20, 20}}}}, - {"ptVsCentrality", "ptvscentrality", {HistType::kTH2F, {{100, 0, 100}, {300, 0, 300}}}}}}; + {"eventCounter", "eventCounter", {HistType::kTH1F, {{1, 0, +1, ""}}}}, + {"ptVsCentrality", "ptvscentrality", {HistType::kTH2F, {{100, 0, 100}, {300, 0, 300}}}}, + {"ptResolution", "ptResolution", {HistType::kTH2F, {{50, 0, ptMax}, {100, -1.0, +1.0}}}}, + {"ptHistogramPion", "ptHistogramPion", {HistType::kTH1F, {{50, 0, ptMax}}}}, + {"ptHistogramKaon", "ptHistogramKaon", {HistType::kTH1F, {{50, 0, ptMax}}}}, + {"ptHistogramProton", "ptHistogramProton", {HistType::kTH1F, {{50, 0, ptMax}}}}, + {"ptGeneratedPion", "ptGeneratedPion", {HistType::kTH1F, {{50, 0, ptMax}}}}, + {"ptGeneratedKaon", "ptGeneratedKaon", {HistType::kTH1F, {{50, 0, ptMax}}}}, + {"ptGeneratedProton", "ptGeneratedProton", {HistType::kTH1F, {{50, 0, ptMax}}}}}}; Configurable vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"}; @@ -119,6 +131,7 @@ struct JetShapeTask { Configurable nclItsMin{"nclItsMin", 2.0f, "its # of cluster cut"}; Configurable nclTpcMin{"nclTpcMin", 100.0f, "tpc # if cluster cut"}; Configurable nclcrossTpcMin{"nclcrossTpcMin", 70.0f, "tpc # of crossedRows cut"}; + Configurable mcRapidityMax{"mcRapidityMax", 0.5f, "maximum mctrack y"}; Configurable triggerMasks{"triggerMasks", "", "possible JE Trigger masks: fJetChLowPt,fJetChHighPt,fTrackLowPt,fTrackHighPt,fJetD0ChLowPt,fJetD0ChHighPt,fJetLcChLowPt,fJetLcChHighPt,fEMCALReadout,fJetFullHighPt,fJetFullLowPt,fJetNeutralHighPt,fJetNeutralLowPt,fGammaVeryHighPtEMCAL,fGammaVeryHighPtDCAL,fGammaHighPtEMCAL,fGammaHighPtDCAL,fGammaLowPtEMCAL,fGammaLowPtDCAL,fGammaVeryLowPtEMCAL,fGammaVeryLowPtDCAL"}; @@ -258,7 +271,7 @@ struct JetShapeTask { } } } - PROCESS_SWITCH(JetShapeTask, processJetShape, "JetShape", true); + PROCESS_SWITCH(JetShapeTask, processJetShape, "JetShape", false); void processProductionRatio(soa::Filtered::iterator const& collision, soa::Join const& tracks, soa::Join const& jets) { @@ -366,7 +379,59 @@ struct JetShapeTask { } } } - PROCESS_SWITCH(JetShapeTask, processProductionRatio, "production ratio", true); + PROCESS_SWITCH(JetShapeTask, processProductionRatio, "production ratio", false); + + void processReco(soa::Join const& tracks, aod::McParticles const&) + { + registry.fill(HIST("eventCounter"), 0.5); + + for (const auto& track : tracks) { + if (track.has_mcParticle()) { + auto mcParticle = track.mcParticle(); + registry.fill(HIST("ptResolution"), track.pt(), track.pt() - mcParticle.pt()); + + if (std::abs(track.eta()) > etaTrUp) + continue; + if (track.tpcNClsCrossedRows() < nclcrossTpcMin) + continue; + if (std::abs(track.dcaXY()) > dcaxyMax) + continue; + if (track.itsChi2NCl() > chi2ItsMax) + continue; + if (track.tpcChi2NCl() > chi2TpcMax) + continue; + if (track.tpcNClsFound() < nclTpcMin) + continue; + if (track.itsNCls() < nclItsMin) + continue; + + if (mcParticle.isPhysicalPrimary() && std::fabs(mcParticle.y()) < mcRapidityMax) { // do this in the context of the track ! (context matters!!!) + if (std::abs(mcParticle.pdgCode()) == PDG_t::kPiPlus) + registry.fill(HIST("ptHistogramPion"), mcParticle.pt()); + if (std::abs(mcParticle.pdgCode()) == PDG_t::kKPlus) + registry.fill(HIST("ptHistogramKaon"), mcParticle.pt()); + if (std::abs(mcParticle.pdgCode()) == PDG_t::kProton) + registry.fill(HIST("ptHistogramProton"), mcParticle.pt()); + } + } + } + } + PROCESS_SWITCH(JetShapeTask, processReco, "process reconstructed information", true); + + void processSim(aod::McParticles const& mcParticles) + { + for (const auto& mcParticle : mcParticles) { + if (mcParticle.isPhysicalPrimary() && std::fabs(mcParticle.y()) < mcRapidityMax) { + if (std::abs(mcParticle.pdgCode()) == PDG_t::kPiPlus) + registry.fill(HIST("ptGeneratedPion"), mcParticle.pt()); + if (std::abs(mcParticle.pdgCode()) == PDG_t::kKPlus) + registry.fill(HIST("ptGeneratedKaon"), mcParticle.pt()); + if (std::abs(mcParticle.pdgCode()) == PDG_t::kProton) + registry.fill(HIST("ptGeneratedProton"), mcParticle.pt()); + } + } + } + PROCESS_SWITCH(JetShapeTask, processSim, "process pure simulation information", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } From bbd80355fe4bcb9b31466028a2e937750233d244 Mon Sep 17 00:00:00 2001 From: wefeng1110 <147308878+wefeng1110@users.noreply.github.com> Date: Sat, 11 Oct 2025 01:19:28 +0800 Subject: [PATCH 703/986] [PWGJE] Add configuration for centrality estimators (#13303) --- PWGJE/Tasks/jetSpectraCharged.cxx | 133 ++++++++++++++++++++++++++---- 1 file changed, 115 insertions(+), 18 deletions(-) diff --git a/PWGJE/Tasks/jetSpectraCharged.cxx b/PWGJE/Tasks/jetSpectraCharged.cxx index 70f73484b79..7fd0dd3cd1b 100644 --- a/PWGJE/Tasks/jetSpectraCharged.cxx +++ b/PWGJE/Tasks/jetSpectraCharged.cxx @@ -54,6 +54,7 @@ struct JetSpectraCharged { Configurable vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"}; Configurable centralityMin{"centralityMin", -999.0, "minimum centrality"}; Configurable centralityMax{"centralityMax", 999.0, "maximum centrality"}; + Configurable checkCentFT0M{"checkCentFT0M", false, "0: centFT0C as default, 1: use centFT0M estimator"}; Configurable trackEtaMin{"trackEtaMin", -0.9, "minimum eta acceptance for tracks"}; Configurable trackEtaMax{"trackEtaMax", 0.9, "maximum eta acceptance for tracks"}; Configurable trackPtMin{"trackPtMin", 0.15, "minimum pT acceptance for tracks"}; @@ -102,6 +103,7 @@ struct JetSpectraCharged { if (doprocessCollisions || doprocessCollisionsWeighted) { registry.add("h_collisions", "event status;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}); + registry.add("h_centrality_collisions", "event status vs. centrality;entries;centrality", {HistType::kTH2F, {centralityAxis, {4, 0.0, 4.0}}}); registry.add("h_fakecollisions", "event status;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}); registry.add("h2_centrality_occupancy", "centrality vs occupancy; centrality; occupancy", {HistType::kTH2F, {centralityAxis, {60, 0, 30000}}}); registry.add("h_collisions_Zvertex", "position of collision ;#it{Z} (cm)", {HistType::kTH1F, {{300, -15.0, 15.0}}}); @@ -244,7 +246,7 @@ struct JetSpectraCharged { } Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax); - Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centFT0M >= centralityMin && aod::jcollision::centFT0M < centralityMax); + Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut); Preslice mcdjetsPerJCollision = o2::aod::jet::collisionId; template @@ -415,7 +417,7 @@ struct JetSpectraCharged { continue; } if (jetMCD.r() == round(selectedJetsRadius * 100.0f)) { - double dpt = jetMCP.pt() - jetMCD.pt(); + double dpt = jetMCD.pt() - jetMCP.pt(); if (jetfindingutilities::isInEtaAcceptance(jetMCD, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { registry.fill(HIST("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_mcdetaconstraint"), jetMCD.pt(), jetMCP.pt(), weight); registry.fill(HIST("h2_jet_phi_mcd_jet_phi_mcp_matchedgeo_mcdetaconstraint"), jetMCD.phi(), jetMCP.phi(), weight); @@ -444,7 +446,7 @@ struct JetSpectraCharged { continue; } if (jetMCD.r() == round(selectedJetsRadius * 100.0f)) { - double dpt = jetMCP.pt() - jetMCD.pt(); + double dpt = jetMCD.pt() - jetMCP.pt(); if (jetfindingutilities::isInEtaAcceptance(jetMCD, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { registry.fill(HIST("h2_jet_pt_mcd_jet_pt_mcp_matchedpt_mcdetaconstraint"), jetMCD.pt(), jetMCP.pt(), weight); registry.fill(HIST("h2_jet_phi_mcd_jet_phi_mcp_matchedpt_mcdetaconstraint"), jetMCD.phi(), jetMCP.phi(), weight); @@ -473,7 +475,7 @@ struct JetSpectraCharged { continue; } if (jetMCD.template matchedJetGeo_first_as>().globalIndex() == jetMCD.template matchedJetPt_first_as>().globalIndex()) { // not a good way to do this - double dpt = jetMCP.pt() - jetMCD.pt(); + double dpt = jetMCD.pt() - jetMCP.pt(); if (jetfindingutilities::isInEtaAcceptance(jetMCD, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { registry.fill(HIST("h2_jet_pt_mcd_jet_pt_mcp_matchedgeopt_mcdetaconstraint"), jetMCD.pt(), jetMCP.pt(), weight); registry.fill(HIST("h2_jet_phi_mcd_jet_phi_mcp_matchedgeopt_mcdetaconstraint"), jetMCD.phi(), jetMCP.phi(), weight); @@ -508,7 +510,7 @@ struct JetSpectraCharged { if (jetMCD.r() == round(selectedJetsRadius * 100.0f)) { double corrTagjetpt = jetMCP.pt() - (mcrho * jetMCP.area()); double corrBasejetpt = jetMCD.pt() - (rho * jetMCD.area()); - double dcorrpt = corrTagjetpt - corrBasejetpt; + double dcorrpt = corrBasejetpt - corrTagjetpt; if (jetfindingutilities::isInEtaAcceptance(jetMCD, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { registry.fill(HIST("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_rhoareasubtracted_mcdetaconstraint"), corrBasejetpt, corrTagjetpt, weight); registry.fill(HIST("h2_jet_pt_mcd_jet_pt_diff_matchedgeo_rhoareasubtracted"), corrBasejetpt, dcorrpt / corrBasejetpt, weight); @@ -526,6 +528,15 @@ struct JetSpectraCharged { void processQC(soa::Filtered::iterator const& collision, soa::Filtered> const& tracks) { + float centrality = 0.0; + if (checkCentFT0M) { + centrality = collision.centFT0M(); + } else { + centrality = collision.centFT0C(); + } + if (centrality < centralityMin || centrality > centralityMax) { + return; + } if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { return; } @@ -563,16 +574,28 @@ struct JetSpectraCharged { void processCollisions(soa::Filtered::iterator const& collision) { + float centrality = 0.0; + if (checkCentFT0M) { + centrality = collision.centFT0M(); + } else { + centrality = collision.centFT0C(); + } + if (centrality < centralityMin || centrality > centralityMax) { + return; + } registry.fill(HIST("h_collisions"), 0.5); + registry.fill(HIST("h_centrality_collisions"), centrality, 0.5); if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { return; } registry.fill(HIST("h_collisions"), 1.5); + registry.fill(HIST("h_centrality_collisions"), centrality, 1.5); if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; } registry.fill(HIST("h_collisions"), 2.5); - registry.fill(HIST("h2_centrality_occupancy"), collision.centFT0M(), collision.trackOccupancyInTimeRange()); + registry.fill(HIST("h_centrality_collisions"), centrality, 2.5); + registry.fill(HIST("h2_centrality_occupancy"), centrality, collision.trackOccupancyInTimeRange()); registry.fill(HIST("h_collisions_Zvertex"), collision.posZ()); } PROCESS_SWITCH(JetSpectraCharged, processCollisions, "collisions Data and MCD", true); @@ -596,7 +619,6 @@ struct JetSpectraCharged { } registry.fill(HIST("h_collisions"), 2.5); registry.fill(HIST("h_collisions_weighted"), 2.5, eventWeight); - registry.fill(HIST("h2_centrality_occupancy"), collision.centFT0M(), collision.trackOccupancyInTimeRange()); registry.fill(HIST("h_collisions_Zvertex"), collision.posZ(), eventWeight); } PROCESS_SWITCH(JetSpectraCharged, processCollisionsWeighted, "weighted collsions for MCD", false); @@ -605,6 +627,15 @@ struct JetSpectraCharged { soa::Join const& jets, aod::JetTracks const&) { + float centrality = 0.0; + if (checkCentFT0M) { + centrality = collision.centFT0M(); + } else { + centrality = collision.centFT0C(); + } + if (centrality < centralityMin || centrality > centralityMax) { + return; + } if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { return; } @@ -618,7 +649,7 @@ struct JetSpectraCharged { if (!isAcceptedJet(jet)) { continue; } - fillJetHistograms(jet, collision.centFT0M()); + fillJetHistograms(jet, centrality); } } PROCESS_SWITCH(JetSpectraCharged, processSpectraData, "jet spectra for Data", false); @@ -627,6 +658,15 @@ struct JetSpectraCharged { soa::Join const& jets, aod::JetTracks const&) { + float centrality = 0.0; + if (checkCentFT0M) { + centrality = collision.centFT0M(); + } else { + centrality = collision.centFT0C(); + } + if (centrality < centralityMin || centrality > centralityMax) { + return; + } if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { return; } @@ -640,7 +680,7 @@ struct JetSpectraCharged { if (!isAcceptedJet(jet)) { continue; } - fillJetHistograms(jet, collision.centFT0M()); + fillJetHistograms(jet, centrality); } } PROCESS_SWITCH(JetSpectraCharged, processSpectraMCD, "jet spectra for MCD", false); @@ -649,6 +689,15 @@ struct JetSpectraCharged { soa::Join const& jets, aod::JetTracks const&) { + float centrality = 0.0; + if (checkCentFT0M) { + centrality = collision.centFT0M(); + } else { + centrality = collision.centFT0C(); + } + if (centrality < centralityMin || centrality > centralityMax) { + return; + } if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { return; } @@ -662,7 +711,7 @@ struct JetSpectraCharged { if (!isAcceptedJet(jet)) { continue; } - fillJetAreaSubHistograms(jet, collision.centFT0M(), collision.rho()); + fillJetAreaSubHistograms(jet, centrality, collision.rho()); } } PROCESS_SWITCH(JetSpectraCharged, processSpectraAreaSubData, "jet spectra with rho-area subtraction for Data", false); @@ -671,6 +720,15 @@ struct JetSpectraCharged { soa::Join const& jets, aod::JetTracks const&) { + float centrality = 0.0; + if (checkCentFT0M) { + centrality = collision.centFT0M(); + } else { + centrality = collision.centFT0C(); + } + if (centrality < centralityMin || centrality > centralityMax) { + return; + } if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { return; } @@ -684,7 +742,7 @@ struct JetSpectraCharged { if (!isAcceptedJet(jet)) { continue; } - fillJetAreaSubHistograms(jet, collision.centFT0M(), collision.rho()); + fillJetAreaSubHistograms(jet, centrality, collision.rho()); } } PROCESS_SWITCH(JetSpectraCharged, processSpectraAreaSubMCD, "jet spectra with rho-area subtraction for MCD", false); @@ -713,7 +771,7 @@ struct JetSpectraCharged { } registry.fill(HIST("h_jet_phat"), pTHat); registry.fill(HIST("h_jet_phat_weighted"), pTHat, jetweight); - fillJetHistograms(jet, collision.centFT0M(), jetweight); + fillJetHistograms(jet, collision.centFT0C(), jetweight); } } PROCESS_SWITCH(JetSpectraCharged, processSpectraMCDWeighted, "jet finder QA mcd with weighted events", false); @@ -746,7 +804,7 @@ struct JetSpectraCharged { if (jetderiveddatautilities::selectCollision(collisions.begin(), eventSelectionBits, skipMBGapEvents)) { hasSel8Coll = true; } - if ((centralityMin < collisions.begin().centFT0M()) && (collisions.begin().centFT0M() < centralityMax)) { + if ((centralityMin < collisions.begin().centFT0C()) && (collisions.begin().centFT0C() < centralityMax)) { centralityIsGood = true; } if ((trackOccupancyInTimeRangeMin < collisions.begin().trackOccupancyInTimeRange()) && (collisions.begin().trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMax)) { @@ -757,7 +815,7 @@ struct JetSpectraCharged { if (jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { hasSel8Coll = true; } - if ((centralityMin < collision.centFT0M()) && (collision.centFT0M() < centralityMax)) { + if ((centralityMin < collision.centFT0C()) && (collision.centFT0C() < centralityMax)) { centralityIsGood = true; } if ((trackOccupancyInTimeRangeMin < collision.trackOccupancyInTimeRange()) && (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMax)) { @@ -813,10 +871,16 @@ struct JetSpectraCharged { bool centralityIsGood = false; bool occupancyIsGood = false; for (auto const& collision : collisions) { + float centrality = 0.0; + if (checkCentFT0M) { + centrality = collision.centFT0M(); + } else { + centrality = collision.centFT0C(); + } if (jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { hasSel8Coll = true; } - if ((centralityMin < collision.centFT0M()) && (collision.centFT0M() < centralityMax)) { + if ((centralityMin < centrality) && (centralityMax > centrality)) { centralityIsGood = true; } if ((trackOccupancyInTimeRangeMin < collision.trackOccupancyInTimeRange()) && (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMax)) { @@ -907,6 +971,15 @@ struct JetSpectraCharged { soa::Join const& jets, aod::JetTracksSub const&) { + float centrality = 0.0; + if (checkCentFT0M) { + centrality = collision.centFT0M(); + } else { + centrality = collision.centFT0C(); + } + if (centrality < centralityMin || centrality > centralityMax) { + return; + } if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { return; } @@ -920,7 +993,7 @@ struct JetSpectraCharged { if (!isAcceptedJet(jet)) { continue; } - fillEventWiseConstituentSubtractedHistograms(jet, collision.centFT0M()); + fillEventWiseConstituentSubtractedHistograms(jet, centrality); } } PROCESS_SWITCH(JetSpectraCharged, processEvtWiseConstSubJetsData, "jet spectrum for eventwise constituent-subtracted jets data", false); @@ -929,6 +1002,15 @@ struct JetSpectraCharged { soa::Join const& jets, aod::JetTracksSub const&) { + float centrality = 0.0; + if (checkCentFT0M) { + centrality = collision.centFT0M(); + } else { + centrality = collision.centFT0C(); + } + if (centrality < centralityMin || centrality > centralityMax) { + return; + } if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { return; } @@ -942,7 +1024,7 @@ struct JetSpectraCharged { if (!isAcceptedJet(jet)) { continue; } - fillEventWiseConstituentSubtractedHistograms(jet, collision.centFT0M()); + fillEventWiseConstituentSubtractedHistograms(jet, centrality); } } PROCESS_SWITCH(JetSpectraCharged, processEvtWiseConstSubJetsMCD, "jet spectrum for eventwise constituent-subtracted mcd jets", false); @@ -952,6 +1034,15 @@ struct JetSpectraCharged { ChargedMCPMatchedJets const&, aod::JetTracks const&, aod::JetParticles const&) { + float centrality = 0.0; + if (checkCentFT0M) { + centrality = collision.centFT0M(); + } else { + centrality = collision.centFT0C(); + } + if (centrality < centralityMin || centrality > centralityMax) { + return; + } if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { return; } @@ -1006,12 +1097,18 @@ struct JetSpectraCharged { double mcrho = mccollision.rho(); registry.fill(HIST("h_mc_rho_matched"), mcrho); for (const auto& collision : collisions) { + float centrality = 0.0; + if (checkCentFT0M) { + centrality = collision.centFT0M(); + } else { + centrality = collision.centFT0C(); + } registry.fill(HIST("h_mcd_events_matched"), 0.5); if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents) || !(std::abs(collision.posZ()) < vertexZCut)) { continue; } registry.fill(HIST("h_mcd_events_matched"), 1.5); - if (collision.centFT0M() < centralityMin || collision.centFT0M() > centralityMax) { + if (centrality < centralityMin || centrality > centralityMax) { continue; } registry.fill(HIST("h_mcd_events_matched"), 2.5); From 46c62b1bf7addae428490eb77c4b4c11a0939cdc Mon Sep 17 00:00:00 2001 From: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Date: Fri, 10 Oct 2025 19:54:27 +0200 Subject: [PATCH 704/986] [PWGCF] add meanPt and deltaPt (#13332) --- PWGCF/Flow/Tasks/flowTask.cxx | 59 +++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/PWGCF/Flow/Tasks/flowTask.cxx b/PWGCF/Flow/Tasks/flowTask.cxx index 9ea88c465aa..bf36bfb11de 100644 --- a/PWGCF/Flow/Tasks/flowTask.cxx +++ b/PWGCF/Flow/Tasks/flowTask.cxx @@ -304,6 +304,12 @@ struct FlowTask { registry.add("hDCAz", "DCAz after cuts; DCAz (cm); Pt", {HistType::kTH2D, {{200, -0.5, 0.5}, {200, 0, 5}}}); registry.add("hDCAxy", "DCAxy after cuts; DCAxy (cm); Pt", {HistType::kTH2D, {{200, -0.5, 0.5}, {200, 0, 5}}}); registry.add("hTrackCorrection2d", "Correlation table for number of tracks table; uncorrected track; corrected track", {HistType::kTH2D, {axisNch, axisNch}}); + registry.add("hMeanPt", "", {HistType::kTProfile, {axisIndependent}}); + registry.add("hMeanPtWithinGap08", "", {HistType::kTProfile, {axisIndependent}}); + registry.add("c22_gap08_Weff", "", {HistType::kTProfile, {axisIndependent}}); + registry.add("c22_gap08_trackMeanPt", "", {HistType::kTProfile, {axisIndependent}}); + registry.add("PtVariance_partA_WithinGap08", "", {HistType::kTProfile, {axisIndependent}}); + registry.add("PtVariance_partB_WithinGap08", "", {HistType::kTProfile, {axisIndependent}}); if (doprocessMCGen) { registry.add("MCGen/MChPhi", "#phi distribution", {HistType::kTH1D, {axisPhi}}); registry.add("MCGen/MChEta", "#eta distribution", {HistType::kTH1D, {axisEta}}); @@ -555,6 +561,25 @@ struct FlowTask { return; } + template + void fillpTvnProfile(const GFW::CorrConfig& corrconf, const double& sum_pt, const double& WeffEvent, const ConstStr& vnWeff, const ConstStr& vnpT, const double& cent) + { + double meanPt = sum_pt / WeffEvent; + double dnx, val; + dnx = fGFW->Calculate(corrconf, 0, kTRUE).real(); + if (dnx == 0) + return; + if (!corrconf.pTDif) { + val = fGFW->Calculate(corrconf, 0, kFALSE).real() / dnx; + if (std::fabs(val) < 1) { + registry.fill(vnWeff, cent, val, dnx * WeffEvent); + registry.fill(vnpT, cent, val * meanPt, dnx * WeffEvent); + } + return; + } + return; + } + template void fillFC(const GFW::CorrConfig& corrconf, const double& cent, const double& rndm) { @@ -898,6 +923,10 @@ struct FlowTask { // track weights float weff = 1, wacc = 1; + double weffEvent = 0; + double ptSum = 0., ptSum_Gap08 = 0.; + double weffEventWithinGap08 = 0., weffEventSquareWithinGap08 = 0.; + double sumPtsquareWsquareWithinGap08 = 0., sumPtWsquareWithinGap08 = 0.; double nTracksCorrected = 0; int magnetfield = 0; float independent = cent; @@ -943,6 +972,7 @@ struct FlowTask { continue; bool withinPtPOI = (cfgCutPtPOIMin < track.pt()) && (track.pt() < cfgCutPtPOIMax); // within POI pT range bool withinPtRef = (cfgCutPtRefMin < track.pt()) && (track.pt() < cfgCutPtRefMax); // within RF pT range + bool withinEtaGap08 = (std::abs(track.eta()) < cfgEtaPtPt); if (cfgOutputNUAWeights) { if (cfgOutputNUAWeightsRefPt) { if (withinPtRef) @@ -978,7 +1008,16 @@ struct FlowTask { registry.fill(HIST("hnTPCCrossedRow"), track.tpcNClsCrossedRows()); registry.fill(HIST("hDCAz"), track.dcaZ(), track.pt()); registry.fill(HIST("hDCAxy"), track.dcaXY(), track.pt()); + weffEvent += weff; + ptSum += weff * track.pt(); nTracksCorrected += weff; + if (withinEtaGap08) { + ptSum_Gap08 += weff * track.pt(); + sumPtWsquareWithinGap08 += weff * weff * track.pt(); + sumPtsquareWsquareWithinGap08 += weff * weff * track.pt() * track.pt(); + weffEventWithinGap08 += weff; + weffEventSquareWithinGap08 += weff * weff; + } } if (withinPtRef) fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc * weff, 1); @@ -993,6 +1032,26 @@ struct FlowTask { } registry.fill(HIST("hTrackCorrection2d"), tracks.size(), nTracksCorrected); + double weffEventDiffWithGap08 = weffEventWithinGap08 * weffEventWithinGap08 - weffEventSquareWithinGap08; + // MeanPt + if (weffEvent) { + registry.fill(HIST("hMeanPt"), independent, ptSum / weffEvent, weffEvent); + } + if (weffEventWithinGap08) + registry.fill(HIST("hMeanPtWithinGap08"), independent, ptSum_Gap08 / weffEventWithinGap08, weffEventWithinGap08); + // c22_gap8 * pt_withGap8 + if (weffEventWithinGap08) + fillpTvnProfile(corrconfigs.at(7), ptSum_Gap08, weffEventWithinGap08, HIST("c22_gap08_Weff"), HIST("c22_gap08_trackMeanPt"), independent); + // PtVariance + if (weffEventDiffWithGap08) { + registry.fill(HIST("PtVariance_partA_WithinGap08"), independent, + (ptSum_Gap08 * ptSum_Gap08 - sumPtsquareWsquareWithinGap08) / weffEventDiffWithGap08, + weffEventDiffWithGap08); + registry.fill(HIST("PtVariance_partB_WithinGap08"), independent, + (weffEventWithinGap08 * ptSum_Gap08 - sumPtWsquareWithinGap08) / weffEventDiffWithGap08, + weffEventDiffWithGap08); + } + // Filling Flow Container for (uint l_ind = 0; l_ind < corrconfigs.size(); l_ind++) { fillFC(corrconfigs.at(l_ind), independent, lRandom); From f15a83f59ffd36ad785ae9ad790ce93346c14fc7 Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Fri, 10 Oct 2025 22:02:03 +0300 Subject: [PATCH 705/986] [DPG] Remove dependency on TrackQA table if not used in D0 calibration task (#13333) --- .../derivedDataCreatorD0Calibration.cxx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/DPG/Tasks/AOTTrack/derivedDataCreatorD0Calibration.cxx b/DPG/Tasks/AOTTrack/derivedDataCreatorD0Calibration.cxx index 17224a1545e..a8bd2c6d321 100644 --- a/DPG/Tasks/AOTTrack/derivedDataCreatorD0Calibration.cxx +++ b/DPG/Tasks/AOTTrack/derivedDataCreatorD0Calibration.cxx @@ -104,7 +104,8 @@ struct DerivedDataCreatorD0Calibration { std::string prefix = "ml"; } cfgMl; - using TracksWCovExtraPid = soa::Join; + using TracksWCovExtraPid = soa::Join; + using TracksWCovExtraPidAndQa = soa::Join; using CollisionsWEvSel = soa::Join; using TrackMeanOccs = soa::Join; @@ -169,10 +170,10 @@ struct DerivedDataCreatorD0Calibration { } // main function - template + template void runDataCreation(CollisionsWEvSel const& collisions, aod::TrackAssoc const& trackIndices, - TracksWCovExtraPid const&, + TTracks const&, aod::BCsWithTimestamps const&, TrackMeanOccs const&, TTrackQa const&) @@ -203,7 +204,7 @@ struct DerivedDataCreatorD0Calibration { auto groupedTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, collision.globalIndex()); for (auto const& trackIndexPos : groupedTrackIndices) { - auto trackPos = trackIndexPos.template track_as(); + auto trackPos = trackIndexPos.template track_as(); // track selections if (trackPos.sign() < 0) { // first positive track continue; @@ -239,7 +240,7 @@ struct DerivedDataCreatorD0Calibration { } for (auto const& trackIndexNeg : groupedTrackIndices) { - auto trackNeg = trackIndexNeg.template track_as(); + auto trackNeg = trackIndexNeg.template track_as(); // track selections if (trackNeg.sign() > 0) { // second negative track continue; @@ -484,7 +485,7 @@ struct DerivedDataCreatorD0Calibration { uint8_t tmoRobustT0V0PrimUnfm80{0u}; uint8_t twmoRobustT0V0PrimUnfm80{0u}; if (trackPos.has_tmo()) { - auto tmoFromTrack = trackPos.tmo_as(); // obtain track mean occupancies + auto tmoFromTrack = trackPos.template tmo_as(); // obtain track mean occupancies tmoPrimUnfm80 = getCompressedOccupancy(tmoFromTrack.tmoPrimUnfm80()); tmoFV0AUnfm80 = getCompressedOccupancy(tmoFromTrack.tmoFV0AUnfm80()); tmoFT0AUnfm80 = getCompressedOccupancy(tmoFromTrack.tmoFT0AUnfm80()); @@ -649,7 +650,7 @@ struct DerivedDataCreatorD0Calibration { uint8_t tmoRobustT0V0PrimUnfm80{0u}; uint8_t twmoRobustT0V0PrimUnfm80{0u}; if (trackNeg.has_tmo()) { - auto tmoFromTrack = trackNeg.tmo_as(); // obtain track mean occupancies + auto tmoFromTrack = trackNeg.template tmo_as(); // obtain track mean occupancies tmoPrimUnfm80 = getCompressedOccupancy(tmoFromTrack.tmoPrimUnfm80()); tmoFV0AUnfm80 = getCompressedOccupancy(tmoFromTrack.tmoFV0AUnfm80()); tmoFT0AUnfm80 = getCompressedOccupancy(tmoFromTrack.tmoFT0AUnfm80()); @@ -835,7 +836,7 @@ struct DerivedDataCreatorD0Calibration { // process functions void processWithTrackQa(CollisionsWEvSel const& collisions, aod::TrackAssoc const& trackIndices, - TracksWCovExtraPid const& tracks, + TracksWCovExtraPidAndQa const& tracks, aod::BCsWithTimestamps const& bcs, TrackMeanOccs const& occ, aod::TracksQAVersion const& trackQa) From 1add4e2783b4539d49afb8b9e881b6b076d5faa3 Mon Sep 17 00:00:00 2001 From: aimeric-landou <46970521+aimeric-landou@users.noreply.github.com> Date: Fri, 10 Oct 2025 21:10:28 +0100 Subject: [PATCH 706/986] [PWGJE] Track efficiency in jet finder (#13335) --- PWGJE/Core/JetFindingUtilities.h | 28 +++++++++------ PWGJE/JetFinders/jetFinder.cxx | 20 ++++++++--- PWGJE/JetFinders/jetFinderHF.cxx | 18 ++++++++-- PWGJE/JetFinders/jetFinderV0.cxx | 16 +++++++-- .../eventwiseConstituentSubtractor.cxx | 18 ++++++++-- PWGJE/TableProducer/rhoEstimator.cxx | 34 +++++++++++++------ 6 files changed, 101 insertions(+), 33 deletions(-) diff --git a/PWGJE/Core/JetFindingUtilities.h b/PWGJE/Core/JetFindingUtilities.h index 2bb9b8375b4..8c11ae2bbbb 100644 --- a/PWGJE/Core/JetFindingUtilities.h +++ b/PWGJE/Core/JetFindingUtilities.h @@ -92,7 +92,7 @@ constexpr bool isEMCALClusterTable() */ template -void analyseTracks(std::vector& inputParticles, T const& tracks, int trackSelection, double trackingEfficinecy, const U* candidate = nullptr) +void analyseTracks(std::vector& inputParticles, T const& tracks, int trackSelection, bool applyTrackingEfficiency, std::vector trackingEfficiency, std::vector trackingEfficiencyPtBinning, const U* candidate = nullptr) { for (auto& track : tracks) { if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { @@ -103,10 +103,14 @@ void analyseTracks(std::vector& inputParticles, T const& tra continue; } } - if (trackingEfficinecy < 0.999) { // this code is a bit ugly but it stops us needing to do the random generation unless asked for - TRandom3 randomNumber(0); - if (randomNumber.Rndm() > trackingEfficinecy) { // Is Rndm ok to use? - continue; + if (applyTrackingEfficiency) { + auto iter = std::upper_bound(trackingEfficiencyPtBinning.begin(), trackingEfficiencyPtBinning.end(), track.pt()); + if (iter != trackingEfficiencyPtBinning.begin() && iter != trackingEfficiencyPtBinning.end()) { + std::size_t index = std::distance(trackingEfficiencyPtBinning.begin(), iter) - 1; + TRandom3 randomNumber(0); + if (randomNumber.Rndm() > trackingEfficiency[index]) { + continue; + } } } fastjetutilities::fillTracks(track, inputParticles, track.globalIndex()); @@ -123,7 +127,7 @@ void analyseTracks(std::vector& inputParticles, T const& tra */ template -void analyseTracksMultipleCandidates(std::vector& inputParticles, T const& tracks, int trackSelection, double trackingEfficinecy, U const& candidates) +void analyseTracksMultipleCandidates(std::vector& inputParticles, T const& tracks, int trackSelection, bool applyTrackingEfficiency, std::vector trackingEfficiency, std::vector trackingEfficiencyPtBinning, U const& candidates) { for (auto& track : tracks) { if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { @@ -134,10 +138,14 @@ void analyseTracksMultipleCandidates(std::vector& inputParti continue; } } - if (trackingEfficinecy < 0.999) { // this code is a bit ugly but it stops us needing to do the random generation unless asked for - TRandom3 randomNumber(0); - if (randomNumber.Rndm() > trackingEfficinecy) { // Is Rndm ok to use? - continue; + if (applyTrackingEfficiency) { + auto iter = std::upper_bound(trackingEfficiencyPtBinning.begin(), trackingEfficiencyPtBinning.end(), track.pt()); + if (iter != trackingEfficiencyPtBinning.begin() && iter != trackingEfficiencyPtBinning.end()) { + std::size_t index = std::distance(trackingEfficiencyPtBinning.begin(), iter) - 1; + TRandom3 randomNumber(0); + if (randomNumber.Rndm() > trackingEfficiency[index]) { + continue; + } } } fastjetutilities::fillTracks(track, inputParticles, track.globalIndex()); diff --git a/PWGJE/JetFinders/jetFinder.cxx b/PWGJE/JetFinders/jetFinder.cxx index 93a257360c9..f30b2f33ff7 100644 --- a/PWGJE/JetFinders/jetFinder.cxx +++ b/PWGJE/JetFinders/jetFinder.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include #include // IWYU pragma: export @@ -72,7 +73,9 @@ struct JetFinderTask { Configurable trackEtaMax{"trackEtaMax", 0.9, "maximum track eta"}; Configurable trackPhiMin{"trackPhiMin", -999, "minimum track phi"}; Configurable trackPhiMax{"trackPhiMax", 999, "maximum track phi"}; - Configurable trackingEfficiency{"trackingEfficiency", 1.0, "tracking efficiency applied to jet finding"}; + Configurable applyTrackingEfficiency{"applyTrackingEfficiency", {false}, "configurable to decide whether to apply artificial tracking efficiency (discarding tracks) in jet finding"}; + Configurable> trackingEfficiencyPtBinning{"trackingEfficiencyPtBinning", {0., 10, 999.}, "pt binning of tracking efficiency array if applyTrackingEfficiency is true"}; + Configurable> trackingEfficiency{"trackingEfficiency", {1.0, 1.0}, "tracking efficiency array applied to jet finding if applyTrackingEfficiency is true"}; Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; Configurable particleSelections{"particleSelections", "PhysicalPrimary", "set particle selections"}; @@ -161,6 +164,15 @@ struct JetFinderTask { registry.add("hJetEWS", "sparse for data or mcd event-wise subtracted jets", {HistType::kTHnD, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); registry.add("hJetMCP", "sparse for mcp jets", {HistType::kTHnD, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); } + + if (applyTrackingEfficiency) { + if (trackingEfficiencyPtBinning->size() < 2) { + LOGP(fatal, "jetFinder workflow: trackingEfficiencyPtBinning configurable should have at least two bin edges"); + } + if (trackingEfficiency->size() + 1 != trackingEfficiencyPtBinning->size()) { + LOGP(fatal, "jetFinder workflow: trackingEfficiency configurable should have exactly one less entry than the number of bin edges set in trackingEfficiencyPtBinning configurable"); + } + } } aod::EMCALClusterDefinition clusterDefinition = aod::emcalcluster::getClusterDefinitionFromString(clusterDefinitionS.value); @@ -177,7 +189,7 @@ struct JetFinderTask { return; } inputParticles.clear(); - jetfindingutilities::analyseTracks, soa::Filtered::iterator>(inputParticles, tracks, trackSelection, trackingEfficiency); + jetfindingutilities::analyseTracks, soa::Filtered::iterator>(inputParticles, tracks, trackSelection, applyTrackingEfficiency, trackingEfficiency, trackingEfficiencyPtBinning); jetfindingutilities::findJets(jetFinder, inputParticles, jetPtMin, jetPtMax, jetRadius, jetAreaFractionMin, collision, jetsTable, constituentsTable, fillTHnSparse ? registry.get(HIST("hJet")) : std::shared_ptr(nullptr), fillTHnSparse); } @@ -190,7 +202,7 @@ struct JetFinderTask { return; } inputParticles.clear(); - jetfindingutilities::analyseTracks, soa::Filtered::iterator>(inputParticles, tracks, trackSelection, trackingEfficiency); + jetfindingutilities::analyseTracks, soa::Filtered::iterator>(inputParticles, tracks, trackSelection, applyTrackingEfficiency, trackingEfficiency, trackingEfficiencyPtBinning); jetfindingutilities::findJets(jetFinder, inputParticles, jetEWSPtMin, jetEWSPtMax, jetRadius, jetAreaFractionMin, collision, jetsEvtWiseSubTable, constituentsEvtWiseSubTable, fillTHnSparse ? registry.get(HIST("hJetEWS")) : std::shared_ptr(nullptr), fillTHnSparse); } @@ -216,7 +228,7 @@ struct JetFinderTask { return; } inputParticles.clear(); - jetfindingutilities::analyseTracks, soa::Filtered::iterator>(inputParticles, tracks, trackSelection, trackingEfficiency); + jetfindingutilities::analyseTracks, soa::Filtered::iterator>(inputParticles, tracks, trackSelection, applyTrackingEfficiency, trackingEfficiency, trackingEfficiencyPtBinning); jetfindingutilities::analyseClusters(inputParticles, &clusters, hadronicCorrectionType); jetfindingutilities::findJets(jetFinder, inputParticles, jetPtMin, jetPtMax, jetRadius, jetAreaFractionMin, collision, jetsTable, constituentsTable, fillTHnSparse ? registry.get(HIST("hJet")) : std::shared_ptr(nullptr), fillTHnSparse); } diff --git a/PWGJE/JetFinders/jetFinderHF.cxx b/PWGJE/JetFinders/jetFinderHF.cxx index b32921de7b7..7bf72f2a6ce 100644 --- a/PWGJE/JetFinders/jetFinderHF.cxx +++ b/PWGJE/JetFinders/jetFinderHF.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include // IWYU pragma: export @@ -70,7 +71,9 @@ struct JetFinderHFTask { Configurable trackEtaMax{"trackEtaMax", 0.9, "maximum track eta"}; Configurable trackPhiMin{"trackPhiMin", -999, "minimum track phi"}; Configurable trackPhiMax{"trackPhiMax", 999, "maximum track phi"}; - Configurable trackingEfficiency{"trackingEfficiency", 1.0, "tracking efficiency applied to jet finding"}; + Configurable applyTrackingEfficiency{"applyTrackingEfficiency", {false}, "configurable to decide whether to apply artificial tracking efficiency (discarding tracks) in jet finding"}; + Configurable> trackingEfficiencyPtBinning{"trackingEfficiencyPtBinning", {0., 10, 999.}, "pt binning of tracking efficiency array if applyTrackingEfficiency is true"}; + Configurable> trackingEfficiency{"trackingEfficiency", {1.0, 1.0}, "tracking efficiency array applied to jet finding if applyTrackingEfficiency is true"}; Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; Configurable particleSelections{"particleSelections", "PhysicalPrimary", "set particle selections"}; @@ -165,6 +168,15 @@ struct JetFinderHFTask { registry.add("hJet", "sparse for data or mcd jets", {HistType::kTHnD, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); registry.add("hJetMCP", "sparse for mcp jets", {HistType::kTHnD, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); + + if (applyTrackingEfficiency) { + if (trackingEfficiencyPtBinning->size() < 2) { + LOGP(fatal, "jetFinderHF workflow: trackingEfficiencyPtBinning configurable should have at least two bin edges"); + } + if (trackingEfficiency->size() + 1 != trackingEfficiencyPtBinning->size()) { + LOGP(fatal, "jetFinderHF workflow: trackingEfficiency configurable should have exactly one less entry than the number of bin edges set in trackingEfficiencyPtBinning configurable"); + } + } } aod::EMCALClusterDefinition clusterDefinition = aod::emcalcluster::getClusterDefinitionFromString(clusterDefinitionS.value); @@ -215,9 +227,9 @@ struct JetFinderHFTask { } } if constexpr (isEvtWiseSub) { - jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, trackingEfficiency); + jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, applyTrackingEfficiency, trackingEfficiency, trackingEfficiencyPtBinning); } else { - jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, trackingEfficiency, &candidate); + jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, applyTrackingEfficiency, trackingEfficiency, trackingEfficiencyPtBinning, &candidate); } jetfindingutilities::findJets(jetFinder, inputParticles, minJetPt, maxJetPt, jetRadius, jetAreaFractionMin, collision, jetsTableInput, constituentsTableInput, registry.get(HIST("hJet")), fillTHnSparse, true); } diff --git a/PWGJE/JetFinders/jetFinderV0.cxx b/PWGJE/JetFinders/jetFinderV0.cxx index 69e9f5680ee..651f05b2061 100644 --- a/PWGJE/JetFinders/jetFinderV0.cxx +++ b/PWGJE/JetFinders/jetFinderV0.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include // IWYU pragma: export @@ -65,7 +66,9 @@ struct JetFinderV0Task { Configurable trackEtaMax{"trackEtaMax", 0.9, "maximum track eta"}; Configurable trackPhiMin{"trackPhiMin", -999, "minimum track phi"}; Configurable trackPhiMax{"trackPhiMax", 999, "maximum track phi"}; - Configurable trackingEfficiency{"trackingEfficiency", 1.0, "tracking efficiency applied to jet finding"}; + Configurable applyTrackingEfficiency{"applyTrackingEfficiency", {false}, "configurable to decide whether to apply artificial tracking efficiency (discarding tracks) in jet finding"}; + Configurable> trackingEfficiencyPtBinning{"trackingEfficiencyPtBinning", {0., 10, 999.}, "pt binning of tracking efficiency array if applyTrackingEfficiency is true"}; + Configurable> trackingEfficiency{"trackingEfficiency", {1.0, 1.0}, "tracking efficiency array applied to jet finding if applyTrackingEfficiency is true"}; Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; Configurable particleSelections{"particleSelections", "PhysicalPrimary", "set particle selections"}; @@ -156,6 +159,15 @@ struct JetFinderV0Task { registry.add("hJet", "sparse for data or mcd jets", {HistType::kTHnD, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); registry.add("hJetMCP", "sparse for mcp jets", {HistType::kTHnD, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); + + if (applyTrackingEfficiency) { + if (trackingEfficiencyPtBinning->size() < 2) { + LOGP(fatal, "jetFinderV0 workflow: trackingEfficiencyPtBinning configurable should have at least two bin edges"); + } + if (trackingEfficiency->size() + 1 != trackingEfficiencyPtBinning->size()) { + LOGP(fatal, "jetFinderV0 workflow: trackingEfficiency configurable should have exactly one less entry than the number of bin edges set in trackingEfficiencyPtBinning configurable"); + } + } } Filter collisionFilter = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centFT0M >= centralityMin && aod::jcollision::centFT0M < centralityMax && aod::jcollision::trackOccupancyInTimeRange <= trackOccupancyInTimeRangeMax && ((skipMBGapEvents.node() == false) || (aod::jcollision::subGeneratorId != static_cast(jetderiveddatautilities::JCollisionSubGeneratorId::mbGap)))); @@ -184,7 +196,7 @@ struct JetFinderV0Task { } } */ - jetfindingutilities::analyseTracksMultipleCandidates(inputParticles, tracks, trackSelection, trackingEfficiency, candidates); + jetfindingutilities::analyseTracksMultipleCandidates(inputParticles, tracks, trackSelection, applyTrackingEfficiency, trackingEfficiency, trackingEfficiencyPtBinning, candidates); jetfindingutilities::findJets(jetFinder, inputParticles, minJetPt, maxJetPt, jetRadius, jetAreaFractionMin, collision, jetsTableInput, constituentsTableInput, registry.get(HIST("hJet")), fillTHnSparse, saveJetsWithCandidatesOnly); } diff --git a/PWGJE/TableProducer/eventwiseConstituentSubtractor.cxx b/PWGJE/TableProducer/eventwiseConstituentSubtractor.cxx index fb914aa0277..254421574ab 100644 --- a/PWGJE/TableProducer/eventwiseConstituentSubtractor.cxx +++ b/PWGJE/TableProducer/eventwiseConstituentSubtractor.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -67,7 +68,9 @@ struct eventWiseConstituentSubtractorTask { Configurable trackEtaMax{"trackEtaMax", 0.9, "maximum track eta"}; Configurable trackPhiMin{"trackPhiMin", -999, "minimum track phi"}; Configurable trackPhiMax{"trackPhiMax", 999, "maximum track phi"}; - Configurable trackingEfficiency{"trackingEfficiency", 1.0, "tracking efficiency applied to jet finding"}; + Configurable applyTrackingEfficiency{"applyTrackingEfficiency", {false}, "configurable to decide whether to apply artificial tracking efficiency (discarding tracks) in the collision analysed by this task"}; + Configurable> trackingEfficiencyPtBinning{"trackingEfficiencyPtBinning", {0., 10, 999.}, "pt binning of tracking efficiency array if applyTrackingEfficiency is true"}; + Configurable> trackingEfficiency{"trackingEfficiency", {1.0, 1.0}, "tracking efficiency array applied if applyTrackingEfficiency is true"}; Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; Configurable particleSelections{"particleSelections", "PhysicalPrimary", "set particle selections"}; @@ -95,6 +98,15 @@ struct eventWiseConstituentSubtractorTask { eventWiseConstituentSubtractor.setDoRhoMassSub(doRhoMassSub); eventWiseConstituentSubtractor.setConstSubAlphaRMax(alpha, rMax); eventWiseConstituentSubtractor.setMaxEtaEvent(eventEtaMax); + + if (applyTrackingEfficiency) { + if (trackingEfficiencyPtBinning->size() < 2) { + LOGP(fatal, "eventWiseConstituentSubtractor workflow: trackingEfficiencyPtBinning configurable should have at least two bin edges"); + } + if (trackingEfficiency->size() + 1 != trackingEfficiencyPtBinning->size()) { + LOGP(fatal, "eventWiseConstituentSubtractor workflow: trackingEfficiency configurable should have exactly one less entry than the number of bin edges set in trackingEfficiencyPtBinning configurable"); + } + } } Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax && aod::jtrack::phi >= trackPhiMin && aod::jtrack::phi <= trackPhiMax); @@ -106,7 +118,7 @@ struct eventWiseConstituentSubtractorTask { for (auto& candidate : candidates) { inputParticles.clear(); tracksSubtracted.clear(); - jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, trackingEfficiency, &candidate); + jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, applyTrackingEfficiency, trackingEfficiency, trackingEfficiencyPtBinning, &candidate); tracksSubtracted = eventWiseConstituentSubtractor.JetBkgSubUtils::doEventConstSub(inputParticles, candidate.rho(), candidate.rhoM()); for (auto const& trackSubtracted : tracksSubtracted) { @@ -137,7 +149,7 @@ struct eventWiseConstituentSubtractorTask { } inputParticles.clear(); tracksSubtracted.clear(); - jetfindingutilities::analyseTracks, soa::Filtered::iterator>(inputParticles, tracks, trackSelection, trackingEfficiency); + jetfindingutilities::analyseTracks, soa::Filtered::iterator>(inputParticles, tracks, trackSelection, applyTrackingEfficiency, trackingEfficiency, trackingEfficiencyPtBinning); tracksSubtracted = eventWiseConstituentSubtractor.JetBkgSubUtils::doEventConstSub(inputParticles, collision.rho(), collision.rhoM()); diff --git a/PWGJE/TableProducer/rhoEstimator.cxx b/PWGJE/TableProducer/rhoEstimator.cxx index e854868a840..14ec846b74f 100644 --- a/PWGJE/TableProducer/rhoEstimator.cxx +++ b/PWGJE/TableProducer/rhoEstimator.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -73,7 +74,9 @@ struct RhoEstimatorTask { Configurable trackEtaMax{"trackEtaMax", 0.9, "maximum track eta"}; Configurable trackPhiMin{"trackPhiMin", -99.0, "minimum track phi"}; Configurable trackPhiMax{"trackPhiMax", 99.0, "maximum track phi"}; - Configurable trackingEfficiency{"trackingEfficiency", 1.0, "tracking efficiency applied to jet finding"}; + Configurable applyTrackingEfficiency{"applyTrackingEfficiency", {false}, "configurable to decide whether to apply artificial tracking efficiency (discarding tracks) in the collision analysed by this task"}; + Configurable> trackingEfficiencyPtBinning{"trackingEfficiencyPtBinning", {0., 10, 999.}, "pt binning of tracking efficiency array if applyTrackingEfficiency is true"}; + Configurable> trackingEfficiency{"trackingEfficiency", {1.0, 1.0}, "tracking efficiency array applied if applyTrackingEfficiency is true"}; Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; Configurable particleSelections{"particleSelections", "PhysicalPrimary", "set particle selections"}; @@ -133,6 +136,15 @@ struct RhoEstimatorTask { bkgSub.setPhiMinMax(bkgPhiMin_, bkgPhiMax_); eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(static_cast(config.eventSelections)); triggerMaskBits = jetderiveddatautilities::initialiseTriggerMaskBits(config.triggerMasks); + + if (config.applyTrackingEfficiency) { + if (config.trackingEfficiencyPtBinning->size() < 2) { + LOGP(fatal, "rhoEstimator workflow: trackingEfficiencyPtBinning configurable should have at least two bin edges"); + } + if (config.trackingEfficiency->size() + 1 != config.trackingEfficiencyPtBinning->size()) { + LOGP(fatal, "rhoEstimator workflow: trackingEfficiency configurable should have exactly one less entry than the number of bin edges set in trackingEfficiencyPtBinning configurable"); + } + } } Filter trackCuts = (aod::jtrack::pt >= config.trackPtMin && aod::jtrack::pt < config.trackPtMax && aod::jtrack::eta > config.trackEtaMin && aod::jtrack::eta < config.trackEtaMax && aod::jtrack::phi >= config.trackPhiMin && aod::jtrack::phi <= config.trackPhiMax); @@ -208,7 +220,7 @@ struct RhoEstimatorTask { return; } inputParticles.clear(); - jetfindingutilities::analyseTracks, soa::Filtered::iterator>(inputParticles, tracks, trackSelection, config.trackingEfficiency); + jetfindingutilities::analyseTracks, soa::Filtered::iterator>(inputParticles, tracks, trackSelection, config.applyTrackingEfficiency, config.trackingEfficiency, config.trackingEfficiencyPtBinning); auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, config.doSparse); rhoChargedTable(rho, rhoM); } @@ -235,7 +247,7 @@ struct RhoEstimatorTask { continue; } inputParticles.clear(); - jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, config.trackingEfficiency, &candidate); + jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, config.applyTrackingEfficiency, config.trackingEfficiency, config.trackingEfficiencyPtBinning, &candidate); auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, config.doSparse); rhoD0Table(rho, rhoM); @@ -263,7 +275,7 @@ struct RhoEstimatorTask { continue; } inputParticles.clear(); - jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, config.trackingEfficiency, &candidate); + jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, config.applyTrackingEfficiency, config.trackingEfficiency, config.trackingEfficiencyPtBinning, &candidate); auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, config.doSparse); rhoDplusTable(rho, rhoM); @@ -291,7 +303,7 @@ struct RhoEstimatorTask { continue; } inputParticles.clear(); - jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, config.trackingEfficiency, &candidate); + jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, config.applyTrackingEfficiency, config.trackingEfficiency, config.trackingEfficiencyPtBinning, &candidate); auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, config.doSparse); rhoDsTable(rho, rhoM); @@ -319,7 +331,7 @@ struct RhoEstimatorTask { continue; } inputParticles.clear(); - jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, config.trackingEfficiency, &candidate); + jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, config.applyTrackingEfficiency, config.trackingEfficiency, config.trackingEfficiencyPtBinning, &candidate); auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, config.doSparse); rhoDstarTable(rho, rhoM); @@ -347,7 +359,7 @@ struct RhoEstimatorTask { continue; } inputParticles.clear(); - jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, config.trackingEfficiency, &candidate); + jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, config.applyTrackingEfficiency, config.trackingEfficiency, config.trackingEfficiencyPtBinning, &candidate); auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, config.doSparse); rhoLcTable(rho, rhoM); @@ -375,7 +387,7 @@ struct RhoEstimatorTask { continue; } inputParticles.clear(); - jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, config.trackingEfficiency, &candidate); + jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, config.applyTrackingEfficiency, config.trackingEfficiency, config.trackingEfficiencyPtBinning, &candidate); auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, config.doSparse); rhoB0Table(rho, rhoM); @@ -403,7 +415,7 @@ struct RhoEstimatorTask { continue; } inputParticles.clear(); - jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, config.trackingEfficiency, &candidate); + jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, config.applyTrackingEfficiency, config.trackingEfficiency, config.trackingEfficiencyPtBinning, &candidate); auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, config.doSparse); rhoBplusTable(rho, rhoM); @@ -431,7 +443,7 @@ struct RhoEstimatorTask { continue; } inputParticles.clear(); - jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, config.trackingEfficiency, &candidate); + jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, config.applyTrackingEfficiency, config.trackingEfficiency, config.trackingEfficiencyPtBinning, &candidate); auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, config.doSparse); rhoXicToXiPiPiTable(rho, rhoM); @@ -459,7 +471,7 @@ struct RhoEstimatorTask { continue; } inputParticles.clear(); - jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, config.trackingEfficiency, &candidate); + jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, config.applyTrackingEfficiency, config.trackingEfficiency, config.trackingEfficiencyPtBinning, &candidate); auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, config.doSparse); rhoDielectronTable(rho, rhoM); From d68db1168842876d9c60e9889f80cacbc2dd7505 Mon Sep 17 00:00:00 2001 From: Katarzyna <116073883+kgwizdzi@users.noreply.github.com> Date: Sat, 11 Oct 2025 00:53:41 +0200 Subject: [PATCH 707/986] [PWGCF] FU: adding y cut for D0s and possibility to run with prompt D0s (#13308) --- .../femtoUniverseProducerMCTruthTask.cxx | 27 ++- .../femtoUniverseProducerTask.cxx | 39 +++- .../Tasks/femtoUniversePairTaskTrackD0.cxx | 212 +++++++++++++++--- ...femtoUniversePairTaskTrackTrackMcTruth.cxx | 11 + 4 files changed, 242 insertions(+), 47 deletions(-) diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerMCTruthTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerMCTruthTask.cxx index 83c197ea0ad..b2d03f48998 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerMCTruthTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerMCTruthTask.cxx @@ -106,6 +106,9 @@ struct FemtoUniverseProducerMCTruthTask { Configurable confEtaFilterCut{"confEtaFilterCut", 0.8, "Eta cut for the filtering tracks"}; } ConfFilteringTracks; + // D0/D0bar cuts + Configurable yD0CandGenMax{"yD0CandGenMax", 0.5, "Rapidity cut for the D0/D0bar mesons"}; + FemtoUniverseCollisionSelection colCuts; FemtoUniverseTrackSelection trackCuts; HistogramRegistry qaRegistry{"QAHistos", {}, OutputObjHandlingPolicy::QAObject}; @@ -162,8 +165,6 @@ struct FemtoUniverseProducerMCTruthTask { /// if the most open selection criteria are not fulfilled there is no /// point looking further at the track - if (particle.eta() < -ConfFilteringTracks.confEtaFilterCut || particle.eta() > ConfFilteringTracks.confEtaFilterCut) - continue; if (particle.pt() < ConfFilteringTracks.confPtLowFilterCut || particle.pt() > ConfFilteringTracks.confPtHighFilterCut) continue; @@ -188,6 +189,24 @@ struct FemtoUniverseProducerMCTruthTask { continue; } + // check if D0/D0bar mesons pass the rapidity cut + // if pass then saving the orgin of D0/D0bar + // check if tracks (besides D0/D0bar) pass pseudorapidity cut + int8_t origin = -99; + if (std::abs(particle.pdgCode()) == Pdg::kD0) { + if (std::abs(particle.y()) > yD0CandGenMax) { + continue; + } else { + origin = RecoDecay::getCharmHadronOrigin(tracks, particle); + } + } else { + if (std::abs(particle.eta()) > ConfFilteringTracks.confEtaFilterCut) { + continue; + } else { + origin = -99; + } + } + /// check if we end-up with the correct final state using MC info int8_t sign = 0; if (std::abs(pdgCode) == Pdg::kD0 && !RecoDecay::isMatchedMCGen(tracks, particle, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &sign)) { @@ -216,8 +235,8 @@ struct FemtoUniverseProducerMCTruthTask { pdgCode, pdgCode, childIDs, - 0, - 0); + origin, + -999.); } } diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx index 4b6c0fef8e0..7b8a0b00a77 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx @@ -323,9 +323,12 @@ struct FemtoUniverseProducerTask { // D0/D0bar mesons struct : o2::framework::ConfigurableGroup { - Configurable confD0D0barCandEtaCut{"confD0D0barCandEtaCut", 0.8, "max. cand. pseudorapidity"}; + Configurable trackD0CandEtaMax{"trackD0CandEtaMax", 0.8, "max. track/D0 cand. pseudorapidity"}; + Configurable yD0CandGenMax{"yD0CandGenMax", 0.5, "max. gen. D0 cand. rapidity"}; + Configurable yD0CandMax{"yD0CandMax", 0.8, "max. D0 cand. rapidity"}; Configurable trackD0pTGenMin{"trackD0pTGenMin", 0.0, "MC Truth, min. pT for tracks and D0/D0bar cand."}; Configurable trackD0pTGenMax{"trackD0pTGenMax", 24.0, "MC Truth, max. pT for tracks and D0/D0bar cand."}; + Configurable useYCutD0Cand{"useYCutD0Cand", true, "True - apply cut on y of D0 cand./false - apply cut on eta"}; Configurable storeD0D0barDoubleMassHypo{"storeD0D0barDoubleMassHypo", false, "Store D0/D0bar cand. which pass selection criteria for both, D0 and D0bar"}; Configurable> classMlD0D0bar{"classMlD0D0bar", {0, 1, 2}, "Indexes of ML scores to be stored. Three indexes max."}; } ConfD0Selection; @@ -1484,7 +1487,11 @@ struct FemtoUniverseProducerTask { continue; } - if (std::abs(hfCand.eta()) > ConfD0Selection.confD0D0barCandEtaCut) { + if (ConfD0Selection.useYCutD0Cand && std::abs(hfHelper.yD0(hfCand)) > ConfD0Selection.yD0CandMax) { + continue; + } + + if (!(ConfD0Selection.useYCutD0Cand) && std::abs(hfCand.eta()) > ConfD0Selection.trackD0CandEtaMax) { continue; } @@ -1603,7 +1610,11 @@ struct FemtoUniverseProducerTask { continue; } - if (std::abs(hfCand.eta()) > ConfD0Selection.confD0D0barCandEtaCut) { + if (ConfD0Selection.useYCutD0Cand && std::abs(hfHelper.yD0(hfCand)) > ConfD0Selection.yD0CandMax) { + continue; + } + + if (!(ConfD0Selection.useYCutD0Cand) && std::abs(hfCand.eta()) > ConfD0Selection.trackD0CandEtaMax) { continue; } @@ -1729,7 +1740,11 @@ struct FemtoUniverseProducerTask { continue; } - if (std::abs(hfCand.eta()) > ConfD0Selection.confD0D0barCandEtaCut) { + if (ConfD0Selection.useYCutD0Cand && std::abs(hfHelper.yD0(hfCand)) > ConfD0Selection.yD0CandMax) { + continue; + } + + if (!(ConfD0Selection.useYCutD0Cand) && std::abs(hfCand.eta()) > ConfD0Selection.trackD0CandEtaMax) { continue; } @@ -2118,8 +2133,7 @@ struct FemtoUniverseProducerTask { std::vector tmpIDtrack; for (const auto& particle : mcParts) { - if (particle.eta() < -ConfFilterCuts.confEtaFilterCut || particle.eta() > ConfFilterCuts.confEtaFilterCut) - continue; + if (particle.pt() < ConfD0Selection.trackD0pTGenMin || particle.pt() > ConfD0Selection.trackD0pTGenMax) continue; @@ -2152,9 +2166,18 @@ struct FemtoUniverseProducerTask { /// check if we have D0(bar) → π± K∓ continue; } + if (std::abs(particle.pdgCode()) == Pdg::kD0) { - origin = RecoDecay::getCharmHadronOrigin(mcParts, particle); - mcGenFlag = particle.flagMcMatchGen(); + if (std::abs(particle.y()) > ConfD0Selection.yD0CandGenMax) { + continue; + } else { + origin = RecoDecay::getCharmHadronOrigin(mcParts, particle); + mcGenFlag = particle.flagMcMatchGen(); + } + } else { + if (std::abs(particle.eta()) > ConfD0Selection.trackD0CandEtaMax) { + continue; + } } outputParts(outputCollision.lastIndex(), diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx index 0c57bc7a485..6b6dab1c67d 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx @@ -111,6 +111,7 @@ struct FemtoUniversePairTaskTrackD0 { Configurable confIsTrackIdentified{"confIsTrackIdentified", true, "Enable PID for the track"}; Configurable confTrackLowPtCut{"confTrackLowPtCut", 0.5, "Low pT cut of the track"}; Configurable confTrackHighPtCut{"confTrackHighPtCut", 2.5, "High pT cut of the track"}; + Configurable confTrackEtaMax{"confTrackEtaMax", 0.8, "max. pseudorapidity of the track"}; Configurable minPtPidTpcTofProton{"minPtPidTpcTofProton", 0.5, "Momentum threshold for change of the PID method (from using TPC to TPC and TOF)."}; Configurable minPtPidTpcTofPion{"minPtPidTpcTofPion", 0.5, "Momentum threshold for change of the PID method (from using TPC to TPC and TOF)."}; Configurable minPtPidTpcTofKaonLF{"minPtPidTpcTofKaonLF", 0.5, "Momentum threshold for change of the PID method (from using TPC to TPC and TOF)."}; @@ -122,6 +123,7 @@ struct FemtoUniversePairTaskTrackD0 { Configurable confPDGCodeD0bar{"confPDGCodeD0bar", -421, "D0bar meson - PDG code"}; Configurable confMinPtD0D0bar{"confMinPtD0D0bar", 1.0, "D0/D0bar sel. - min. pT"}; Configurable confMaxPtD0D0bar{"confMaxPtD0D0bar", 3.0, "D0/D0bar sel. - max. pT"}; + Configurable confD0OriginFlag{"confD0OriginFlag", 0, "D0/D0bar origin: 0 - prompt, 1 - non-prompt"}; Configurable confMinPtD0D0barReco{"confMinPtD0D0barReco", 0.5, "MC Reco - D0/D0bar sel. - min. pT"}; Configurable confMaxPtD0D0barReco{"confMaxPtD0D0barReco", 24.0, "MC Reco - D0/D0bar sel. - max. pT"}; Configurable minInvMassD0D0barSignal{"minInvMassD0D0barSignal", 1.81, "Min. inv. mass of D0/D0bar for signal region"}; @@ -151,15 +153,13 @@ struct FemtoUniversePairTaskTrackD0 { Configurable doEfficiencyCorr{"doEfficiencyCorr", false, "Apply efficiency corrections"}; /// Partitions for particle 1 - Partition partsTrack = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == int8_t(ConfTrack.confTrackSign)) && (aod::femtouniverseparticle::pt > ConfTrack.confTrackLowPtCut) && (aod::femtouniverseparticle::pt < ConfTrack.confTrackHighPtCut); - Partition partsTrackMCReco = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == int8_t(ConfTrack.confTrackSign)) && (aod::femtouniverseparticle::pt > ConfTrack.confTrackLowPtCut) && (aod::femtouniverseparticle::pt < ConfTrack.confTrackHighPtCut); - Partition partsTrackMCTruth = (aod::femtouniverseparticle::partType == static_cast(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && (aod::femtouniverseparticle::pidCut == static_cast(ConfTrack.confPDGCodeTrack)) && (aod::femtouniverseparticle::pt > ConfTrack.confTrackLowPtCut) && (aod::femtouniverseparticle::pt < ConfTrack.confTrackHighPtCut); + Partition partsTrack = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == int8_t(ConfTrack.confTrackSign)) && (aod::femtouniverseparticle::pt > ConfTrack.confTrackLowPtCut) && (aod::femtouniverseparticle::pt < ConfTrack.confTrackHighPtCut) && (nabs(aod::femtouniverseparticle::eta) < ConfTrack.confTrackEtaMax); + Partition partsTrackMCReco = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == int8_t(ConfTrack.confTrackSign)) && (aod::femtouniverseparticle::pt > ConfTrack.confTrackLowPtCut) && (aod::femtouniverseparticle::pt < ConfTrack.confTrackHighPtCut) && (nabs(aod::femtouniverseparticle::eta) < ConfTrack.confTrackEtaMax); + Partition partsTrackMCTruth = (aod::femtouniverseparticle::partType == static_cast(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && (aod::femtouniverseparticle::pidCut == static_cast(ConfTrack.confPDGCodeTrack)) && (aod::femtouniverseparticle::pt > ConfTrack.confTrackLowPtCut) && (aod::femtouniverseparticle::pt < ConfTrack.confTrackHighPtCut) && (nabs(aod::femtouniverseparticle::eta) < ConfTrack.confTrackEtaMax); /// Partitions for particle 2 /// Partition with all D0/D0bar mesons (which pass one and double mass hypothesis) Partition partsAllDmesons = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && ((aod::femtouniverseparticle::mLambda > 0.0f) || (aod::femtouniverseparticle::mAntiLambda > 0.0f)) && (aod::femtouniverseparticle::decayVtxX < ConfMlOpt.confMaxProbMlClass1Bg) && (aod::femtouniverseparticle::decayVtxY > ConfMlOpt.confMinProbMlClass2Prompt); - /// Partition with D0/D0bar candidates, which pass only one mass hypothesis - Partition partsOnlyD0D0bar = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda < 0.0f || aod::femtouniverseparticle::mAntiLambda < 0.0f) && (aod::femtouniverseparticle::decayVtxX < ConfMlOpt.confMaxProbMlClass1Bg) && (aod::femtouniverseparticle::decayVtxY > ConfMlOpt.confMinProbMlClass2Prompt); /// Partition with D0 mesons only (one and double mass hypothesis) Partition partsAllD0s = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda > ConfDmesons.minInvMassD0D0barSignal) && (aod::femtouniverseparticle::mLambda < ConfDmesons.maxInvMassD0D0barSignal) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar); /// Partition with D0 mesons only (one mass hypothesis) @@ -172,15 +172,20 @@ struct FemtoUniversePairTaskTrackD0 { Partition partsD0bars = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda < 0.0f) && (aod::femtouniverseparticle::mAntiLambda > ConfDmesons.minInvMassD0D0barSignal) && (aod::femtouniverseparticle::mAntiLambda < ConfDmesons.maxInvMassD0D0barSignal) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar) && (aod::femtouniverseparticle::decayVtxX < ConfMlOpt.confMaxProbMlClass1Bg) && (aod::femtouniverseparticle::decayVtxY > ConfMlOpt.confMinProbMlClass2Prompt); /// Partition with D0bars selected from the side-band (SB) regions (candidates with double mass hypothesis included) Partition partsD0barsFromSB = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && ((aod::femtouniverseparticle::mAntiLambda > ConfDmesons.minInvMassD0D0barLeftSB && aod::femtouniverseparticle::mAntiLambda < ConfDmesons.maxInvMassD0D0barLeftSB) || (aod::femtouniverseparticle::mAntiLambda > ConfDmesons.minInvMassD0D0barRightSB && aod::femtouniverseparticle::mAntiLambda < ConfDmesons.maxInvMassD0D0barRightSB)) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar); - /// Partition for D0/D0bar mesons from MC - Partition partsD0D0barMCReco = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda < 0.0f || aod::femtouniverseparticle::mAntiLambda < 0.0f) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar) && (aod::femtouniverseparticle::decayVtxX < ConfMlOpt.confMaxProbMlClass1Bg) && (aod::femtouniverseparticle::decayVtxY > ConfMlOpt.confMinProbMlClass2Prompt); - Partition partsD0D0barMCTruth = (aod::femtouniverseparticle::partType == static_cast(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && (aod::femtouniverseparticle::pidCut == static_cast(ConfDmesons.confPDGCodeD0) || aod::femtouniverseparticle::pidCut == static_cast(ConfDmesons.confPDGCodeD0bar)) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar); + /// Partition for MC Reco prompt D0/D0bar mesons + Partition partsPromptD0MCReco = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda > ConfDmesons.minInvMassD0D0barSignal) && (aod::femtouniverseparticle::mLambda < ConfDmesons.maxInvMassD0D0barSignal) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar) && (aod::femtouniverseparticle::decayVtxX < ConfMlOpt.confMaxProbMlClass1Bg) && (aod::femtouniverseparticle::decayVtxY > ConfMlOpt.confMinProbMlClass2Prompt) && (aod::femtouniverseparticle::tpcNClsFound == ConfDmesons.confD0OriginFlag); + Partition partsPromptD0barMCReco = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mAntiLambda > ConfDmesons.minInvMassD0D0barSignal) && (aod::femtouniverseparticle::mAntiLambda < ConfDmesons.maxInvMassD0D0barSignal) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar) && (aod::femtouniverseparticle::decayVtxX < ConfMlOpt.confMaxProbMlClass1Bg) && (aod::femtouniverseparticle::decayVtxY > ConfMlOpt.confMinProbMlClass2Prompt) && (aod::femtouniverseparticle::tpcNClsFound == ConfDmesons.confD0OriginFlag); + /// Partition for MC Reco prompt D0/D0bar mesons (sideband candidates) + Partition partsPromptD0MCRecoSB = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && ((aod::femtouniverseparticle::mLambda > ConfDmesons.minInvMassD0D0barLeftSB && aod::femtouniverseparticle::mLambda < ConfDmesons.maxInvMassD0D0barLeftSB) || (aod::femtouniverseparticle::mLambda > ConfDmesons.minInvMassD0D0barRightSB && aod::femtouniverseparticle::mLambda < ConfDmesons.maxInvMassD0D0barRightSB)) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar) && (aod::femtouniverseparticle::decayVtxX < ConfMlOpt.confMaxProbMlClass1Bg) && (aod::femtouniverseparticle::decayVtxY > ConfMlOpt.confMinProbMlClass2Prompt) && (aod::femtouniverseparticle::tpcNClsFound == ConfDmesons.confD0OriginFlag); + Partition partsPromptD0barMCRecoSB = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && ((aod::femtouniverseparticle::mAntiLambda > ConfDmesons.minInvMassD0D0barLeftSB && aod::femtouniverseparticle::mAntiLambda < ConfDmesons.maxInvMassD0D0barLeftSB) || (aod::femtouniverseparticle::mAntiLambda > ConfDmesons.minInvMassD0D0barRightSB && aod::femtouniverseparticle::mAntiLambda < ConfDmesons.maxInvMassD0D0barRightSB)) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar) && (aod::femtouniverseparticle::decayVtxX < ConfMlOpt.confMaxProbMlClass1Bg) && (aod::femtouniverseparticle::decayVtxY > ConfMlOpt.confMinProbMlClass2Prompt) && (aod::femtouniverseparticle::tpcNClsFound == ConfDmesons.confD0OriginFlag); + // MC Truth D0/D0bar candidates + Partition partsD0MCTruth = (aod::femtouniverseparticle::partType == static_cast(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && (aod::femtouniverseparticle::pidCut == static_cast(ConfDmesons.confPDGCodeD0)) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar); + Partition partsD0barMCTruth = (aod::femtouniverseparticle::partType == static_cast(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && (aod::femtouniverseparticle::pidCut == static_cast(ConfDmesons.confPDGCodeD0bar)) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar); /// Partition for D0/D0bar daughters Partition partsDmesonsChildren = aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0Child); /// Histogramming for particle 1 FemtoUniverseParticleHisto trackHistoPartTrack; - FemtoUniverseParticleHisto hTrackDCA; /// Histogramming for particle 2 FemtoUniverseParticleHisto trackHistoPartD0D0bar; @@ -353,7 +358,6 @@ struct FemtoUniversePairTaskTrackD0 { void init(InitContext&) { efficiencyCalculator.init(); - hTrackDCA.init(®istryDCA, confTempFitVarpTBins, confTempFitVarDCABins, true, ConfTrack.confPDGCodeTrack, true); eventHisto.init(&qaRegistry); qaRegistry.add("QA_D0D0barSelection/hInvMassD0", ";#it{M}(K^{-}#pi^{+}) (GeV/#it{c}^{2});counts", kTH1F, {confInvMassBins}); @@ -487,10 +491,8 @@ struct FemtoUniversePairTaskTrackD0 { mcTruthRegistry.add("hMcGenPrPt", "MC Truth proton;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); mcTruthRegistry.add("hMcGenAntiPrPt", "MC Truth antiproton;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); + trackHistoPartTrack.init(&qaRegistry, confTempFitVarpTBins, confTempFitVarBins, ConfBothTracks.confIsMC, ConfTrack.confPDGCodeTrack); trackHistoPartD0D0bar.init(&qaRegistry, confTempFitVarpTBins, confTempFitVarInvMassBins, ConfBothTracks.confIsMC, ConfDmesons.confPDGCodeD0); - if (!ConfTrack.confIsSame) { - trackHistoPartTrack.init(&qaRegistry, confTempFitVarpTBins, confTempFitVarBins, ConfBothTracks.confIsMC, ConfTrack.confPDGCodeTrack); - } mixQaRegistry.add("MixingQA/hSECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); mixQaRegistry.add("MixingQA/hMECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); @@ -850,16 +852,16 @@ struct FemtoUniversePairTaskTrackD0 { { fillCollision(col); - auto thegroupPartsTrack = partsTrack->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + auto theGroupPartsTrack = partsTrack->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); auto theGroupPartsD0s = partsD0s->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); auto theGroupPartsD0bars = partsD0bars->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); switch (confChooseD0trackCorr) { case 0: - doSameEvent(thegroupPartsTrack, theGroupPartsD0s, parts, col.magField(), col.multNtr()); + doSameEvent(theGroupPartsTrack, theGroupPartsD0s, parts, col.magField(), col.multNtr()); break; case 1: - doSameEvent(thegroupPartsTrack, theGroupPartsD0bars, parts, col.magField(), col.multNtr()); + doSameEvent(theGroupPartsTrack, theGroupPartsD0bars, parts, col.magField(), col.multNtr()); break; default: break; @@ -876,16 +878,16 @@ struct FemtoUniversePairTaskTrackD0 { { fillCollision(col); - auto thegroupPartsTrack = partsTrack->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + auto theGroupPartsTrack = partsTrack->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); auto theGroupPartsD0s = partsAllD0s->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); auto theGroupPartsD0bars = partsAllD0bars->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); switch (confChooseD0trackCorr) { case 0: - doSameEvent(thegroupPartsTrack, theGroupPartsD0s, parts, col.magField(), col.multNtr()); + doSameEvent(theGroupPartsTrack, theGroupPartsD0s, parts, col.magField(), col.multNtr()); break; case 1: - doSameEvent(thegroupPartsTrack, theGroupPartsD0bars, parts, col.magField(), col.multNtr()); + doSameEvent(theGroupPartsTrack, theGroupPartsD0bars, parts, col.magField(), col.multNtr()); break; default: break; @@ -919,19 +921,79 @@ struct FemtoUniversePairTaskTrackD0 { PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processSameEventSB, "Enable processing same event", false); /// process function for to call doSameEvent with Monte Carlo - /// \param col subscribe to the collision table (Monte Carlo Reconstructed reconstructed) + /// \param col subscribe to the collision table (Monte Carlo Reconstructed) /// \param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth /// \param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table - void processSameEventMC(aod::FdCollision const& col, FemtoMcRecoParticles const& parts, aod::FdMCParticles const&) + void processSameEventMCRecoSignal(aod::FdCollision const& col, FemtoMcRecoParticles const& parts, aod::FdMCParticles const&) { fillCollision(col); - auto thegroupPartsD0 = partsD0D0barMCReco->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); - auto thegroupPartsTrack = partsTrackMCReco->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + auto theGroupPartsD0 = partsPromptD0MCReco->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + auto theGroupPartsD0bar = partsPromptD0barMCReco->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + auto theGroupPartsTrack = partsTrackMCReco->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + + switch (confChooseD0trackCorr) { + case 0: + doSameEvent(theGroupPartsTrack, theGroupPartsD0, parts, col.magField(), col.multNtr()); + break; + case 1: + doSameEvent(theGroupPartsTrack, theGroupPartsD0bar, parts, col.magField(), col.multNtr()); + break; + default: + break; + } + } + PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processSameEventMCRecoSignal, "MC Reco - enable processing same event for D0/D0bar signal cand.", false); + + /// process function for to call doSameEvent with Monte Carlo + /// \param col subscribe to the collision table (Monte Carlo Reconstructed) + /// \param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth + /// \param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table + void processSameEventMCRecoSB(aod::FdCollision const& col, FemtoMcRecoParticles const& parts, aod::FdMCParticles const&) + { + fillCollision(col); + + auto theGroupPartsD0 = partsPromptD0MCRecoSB->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + auto theGroupPartsD0bar = partsPromptD0barMCRecoSB->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + auto theGroupPartsTrack = partsTrackMCReco->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + + switch (confChooseD0trackCorr) { + case 0: + doSameEvent(theGroupPartsTrack, theGroupPartsD0, parts, col.magField(), col.multNtr()); + break; + case 1: + doSameEvent(theGroupPartsTrack, theGroupPartsD0bar, parts, col.magField(), col.multNtr()); + break; + default: + break; + } + } + PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processSameEventMCRecoSB, "MC Reco - enable processing same event for D0/D0bar side-band cand.", false); + + /// process function for to call doSameEvent with Monte Carlo + /// \param col subscribe to the collision table + /// \param parts subscribe to the joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth + /// \param FdMCParticles subscribe to the Monte Carlo truth table + void processSameEventMcTruth(aod::FdCollision const& col, FemtoMcRecoParticles const& parts, aod::FdMCParticles const&) + { + fillCollision(col); + /// !!! needs to be finished -> add possibility to change between D0 and D0bar + auto theGroupTruthD0s = partsD0MCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + auto theGroupTruthD0bars = partsD0barMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + auto theGroupTruthTracks = partsTrackMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); - doSameEvent(thegroupPartsTrack, thegroupPartsD0, parts, col.magField(), col.multNtr()); + switch (confChooseD0trackCorr) { + case 0: + doSameEvent(theGroupTruthTracks, theGroupTruthD0s, parts, col.magField(), col.multNtr()); + break; + case 1: + doSameEvent(theGroupTruthTracks, theGroupTruthD0bars, parts, col.magField(), col.multNtr()); + break; + default: + break; + } } - PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processSameEventMC, "Enable processing same event for Monte Carlo", false); + PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processSameEventMcTruth, "MC Truth - enable processing same event", false); /// This function processes the mixed event /// \todo the trivial loops over the collisions and tracks should be factored out since they will be common to all combinations of T-T, T-V0, V0-V0, ... @@ -1092,13 +1154,85 @@ struct FemtoUniversePairTaskTrackD0 { } } } - PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processMixedEventSB, "Enable processing mixed events", false); + PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processMixedEventSB, "Enable processing mixed events for data", false); /// brief process function for to call doMixedEvent with Monte Carlo + /// @param cols subscribe to the collisions table (Monte Carlo Reconstructed) + /// @param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth + /// @param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table + void processMixedEventMCRecoSignal(aod::FdCollisions const& cols, FemtoMcRecoParticles const& parts, aod::FdMCParticles const&) + { + for (auto const& [collision1, collision2] : soa::selfCombinations(colBinning, confNEventsMix, -1, cols, cols)) { + + const int multiplicityCol = collision1.multNtr(); + mixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinning.getBin({collision1.posZ(), multiplicityCol})); + + auto groupPartsTrack = partsTrackMCReco->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); + auto groupPartsD0 = partsPromptD0MCReco->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupPartsD0bar = partsPromptD0barMCReco->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + + const auto& magFieldTesla1 = collision1.magField(); + const auto& magFieldTesla2 = collision2.magField(); + + if (magFieldTesla1 != magFieldTesla2) { + continue; + } + + switch (confChooseD0trackCorr) { + case 0: + doMixedEvent(groupPartsTrack, groupPartsD0, parts, magFieldTesla1, multiplicityCol); + break; + case 1: + doMixedEvent(groupPartsTrack, groupPartsD0bar, parts, magFieldTesla1, multiplicityCol); + break; + default: + break; + } + } + } + PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processMixedEventMCRecoSignal, "MC Reco - enable processing mixed events for D0/D0bar signal cand.", false); + + /// brief process function for to call doMixedEvent with Monte Carlo Reco + /// @param cols subscribe to the collisions table (Monte Carlo Reconstructed) + /// @param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth + /// @param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table + void processMixedEventMCRecoSB(aod::FdCollisions const& cols, FemtoMcRecoParticles const& parts, aod::FdMCParticles const&) + { + for (auto const& [collision1, collision2] : soa::selfCombinations(colBinning, confNEventsMix, -1, cols, cols)) { + + const int multiplicityCol = collision1.multNtr(); + mixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinning.getBin({collision1.posZ(), multiplicityCol})); + + auto groupPartsTrack = partsTrackMCReco->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); + auto groupPartsD0 = partsPromptD0MCRecoSB->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupPartsD0bar = partsPromptD0barMCRecoSB->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + + const auto& magFieldTesla1 = collision1.magField(); + const auto& magFieldTesla2 = collision2.magField(); + + if (magFieldTesla1 != magFieldTesla2) { + continue; + } + + switch (confChooseD0trackCorr) { + case 0: + doMixedEvent(groupPartsTrack, groupPartsD0, parts, magFieldTesla1, multiplicityCol); + break; + case 1: + doMixedEvent(groupPartsTrack, groupPartsD0bar, parts, magFieldTesla1, multiplicityCol); + break; + default: + break; + } + } + } + PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processMixedEventMCRecoSB, "MC Reco - enable processing mixed events for D0/D0bar side-band cand.", false); + + /// brief process function for to call doMixedEvent with Monte Carlo Reco /// @param cols subscribe to the collisions table (Monte Carlo Reconstructed reconstructed) /// @param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth /// @param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table - void processMixedEventMC(aod::FdCollisions const& cols, FemtoMcRecoParticles const& parts, aod::FdMCParticles const&) + void processMixedEventMCTruth(aod::FdCollisions const& cols, FemtoMcRecoParticles const& parts, aod::FdMCParticles const&) { for (auto const& [collision1, collision2] : soa::selfCombinations(colBinning, confNEventsMix, -1, cols, cols)) { @@ -1106,7 +1240,8 @@ struct FemtoUniversePairTaskTrackD0 { mixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinning.getBin({collision1.posZ(), multiplicityCol})); auto groupPartsTrack = partsTrackMCReco->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); - auto groupPartsD0 = partsD0D0barMCReco->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupPartsD0 = partsD0MCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupPartsD0bar = partsD0barMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); const auto& magFieldTesla1 = collision1.magField(); const auto& magFieldTesla2 = collision2.magField(); @@ -1114,13 +1249,20 @@ struct FemtoUniversePairTaskTrackD0 { if (magFieldTesla1 != magFieldTesla2) { continue; } - /// \todo before mixing we should check whether both collisions contain a pair of particles! - // if (partsD0.size() == 0 || kNPart2Evt1 == 0 || kNPart1Evt2 == 0 || partsTrack.size() == 0 ) continue; - doMixedEvent(groupPartsTrack, groupPartsD0, parts, magFieldTesla1, multiplicityCol); + switch (confChooseD0trackCorr) { + case 0: + doMixedEvent(groupPartsTrack, groupPartsD0, parts, magFieldTesla1, multiplicityCol); + break; + case 1: + doMixedEvent(groupPartsTrack, groupPartsD0bar, parts, magFieldTesla1, multiplicityCol); + break; + default: + break; + } } } - PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processMixedEventMC, "Enable processing mixed events MC", false); + PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processMixedEventMCTruth, "MC Truth - enable processing mixed events for gen. D0/D0bar", false); void processMcReco(FemtoMcRecoParticles const& recoParts, aod::FdMCParticles const& mcParts) { @@ -1192,9 +1334,9 @@ struct FemtoUniversePairTaskTrackD0 { } } } - if (isParticleNSigma(part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon))) { - hTrackDCA.fillQA(part); - } + // if (isParticleNSigma(part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon))) { + // hTrackDCA.fillQA(part); + //} This part required change } } PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processMcReco, "Process MC reco data", false); diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMcTruth.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMcTruth.cxx index a678a6a078e..3d7a5f57b90 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMcTruth.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMcTruth.cxx @@ -35,6 +35,7 @@ using namespace o2; using namespace o2::analysis::femto_universe; +using namespace o2::constants::physics; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::soa; @@ -83,6 +84,10 @@ struct FemtoUniversePairTaskTrackTrackMcTruth { int vPIDPartOne, vPIDPartTwo; std::vector kNsigma; + // D0/D0bar options + Configurable confActiveD0OriginCheck{"confActiveD0OriginCheck", false, "If true - calculate correlation for D0/D0bar mesons with a given origin"}; + Configurable confD0OriginFlag{"confD0OriginFlag", 1, "D0/D0bar origin: 0 - none, 1 - prompt, 2 - non-prompt"}; + /// particle part ConfigurableAxis confTempFitVarpTBins{"confTempFitVarpTBins", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot"}; ConfigurableAxis confTempFitVarPDGBins{"confTempFitVarPDGBins", {6000, -2300, 2300}, "binning of the TempFitVar in the pT vs. TempFitVar plot"}; @@ -164,6 +169,9 @@ struct FemtoUniversePairTaskTrackTrackMcTruth { if (!confNoPDGPartOne && part.tempFitVar() != confPDGCodePartOne) { continue; } + if (static_cast(part.tempFitVar()) == static_cast(Pdg::kD0) && confActiveD0OriginCheck && part.mLambda() != confD0OriginFlag) { + continue; + } trackHistoPartOne.fillQA(part); } @@ -172,6 +180,9 @@ struct FemtoUniversePairTaskTrackTrackMcTruth { if (!confNoPDGPartTwo && part.tempFitVar() != confPDGCodePartTwo) { continue; } + if (static_cast(part.tempFitVar()) == static_cast(Pdg::kD0) && confActiveD0OriginCheck && part.mLambda() != confD0OriginFlag) { + continue; + } trackHistoPartTwo.fillQA(part); } } From 0931f70bb3daf09e589e1e49952a1c4892701434 Mon Sep 17 00:00:00 2001 From: omvazque Date: Fri, 10 Oct 2025 18:32:27 -0500 Subject: [PATCH 708/986] [PWGLF] Revised track selection secondaries (#13340) --- PWGLF/Tasks/Nuspex/piKpRAA.cxx | 383 +++++++++++++++++++++------------ 1 file changed, 249 insertions(+), 134 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/piKpRAA.cxx b/PWGLF/Tasks/Nuspex/piKpRAA.cxx index 39dfab21ec1..23c58f675e5 100644 --- a/PWGLF/Tasks/Nuspex/piKpRAA.cxx +++ b/PWGLF/Tasks/Nuspex/piKpRAA.cxx @@ -71,9 +71,9 @@ using BCsRun3 = soa::Join; -using TracksFull = soa::Join; +using TracksFull = soa::Join; -using TracksMC = soa::Join; +using TracksMC = soa::Join; // using SimTracks = soa::Join; static constexpr int kNEtaHists{8}; @@ -112,7 +112,7 @@ struct PiKpRAA { static constexpr float kMaxPtNchSel{3.0f}; static constexpr float kMinCharge{3.f}; static constexpr float kMinPElMIP{0.3f}; - static constexpr float kMaxPElMIP{0.4f}; + static constexpr float kMaxPElMIP{0.45f}; static constexpr float kMinPMIP{0.4f}; static constexpr float kMaxPMIP{0.6f}; static constexpr float kMindEdxMIP{40.0f}; @@ -137,9 +137,20 @@ struct PiKpRAA { Configurable maxEtaDaughter{"maxEtaDaughter", +0.8, "Daughter maximum-eta selection"}; Configurable minPt{"minPt", 0.15, "minimum pt of the tracks"}; Configurable maxPt{"maxPt", 20.0, "maximum pt of the tracks"}; + Configurable minPtDaughter{"minPtDaughter", 0.15, "minimum pt of the tracks"}; + Configurable maxPtDaughter{"maxPtDaughter", 20.0, "maximum pt of the tracks"}; Configurable useNclsPID{"useNclsPID", true, "Use Ncl for PID?"}; Configurable minNcl{"minNcl", 135, "minimum found Ncl in TPC"}; Configurable minNCrossedRows{"minNCrossedRows", 70, "minimum number of crossed rows"}; + Configurable minNCrossedRowsOverFindableCls{"minNCrossedRowsOverFindableCls", 0.8, "min N crossed rows over findable Cls"}; + Configurable maxChi2ClsTPC{"maxChi2ClsTPC", 4.0, "Max chi2 per Cls TPC"}; + Configurable maxChi2ClsITS{"maxChi2ClsITS", 36.0, "chi2 per Cls ITS"}; + Configurable maxDCAZ{"maxDCAZ", 2.0, "Max DCA Z"}; + Configurable itsRefit{"itsRefit", true, "Require ITS refit"}; + Configurable tpcRefit{"tpcRefit", true, "Require TPC refit"}; + Configurable chi2Golden{"chi2Golden", true, "Require Chi2 golde selection"}; + Configurable its1HitIB{"its1HitIB", true, "Require one hit in the ITS IB"}; + Configurable requireITShit{"requireITShit", true, "Apply requirement of one hit in the ITS IB?"}; // Standard 5 topological criteria Configurable v0cospa{"v0cospa", 0.995, "min V0 CosPA"}; @@ -165,7 +176,6 @@ struct PiKpRAA { Configurable dEdxPlateauSel{"dEdxPlateauSel", 50, "dEdx selection for electrons"}; Configurable tpcPidNsigmaCut{"tpcPidNsigmaCut", 5, "tpcPidNsigmaCut"}; Configurable maxExpTOFPi{"maxExpTOFPi", 0.00005, "Maximum beta TOF selection"}; - Configurable maxExpTOFEl{"maxExpTOFEl", 0.001, "Maximum beta TOF selection"}; Configurable applyTPCTOFCombinedCut{"applyTPCTOFCombinedCut", false, " Apply geometrical cut ? "}; // Phi cut @@ -245,6 +255,21 @@ struct PiKpRAA { NchSel }; + enum TrkSelLabel { + AllTrks = 1, + Eta, + Pt, + XRows, + XRowsOverFindableCls, + Chi2TPC, + Chi2ITS, + Itsrefit, + Tpcrefit, + Golden, + Itshit, + PassedAll + }; + enum V0sCounter { K0s = 1, Lambda, @@ -275,15 +300,14 @@ struct PiKpRAA { } etaCal; TrackSelection trkSelGlobalOpenDCAxy; - TrackSelection trkSelDaugthers; + // TrackSelection trkSelDaugthers; TrackSelection trkSelGlobal; - TrackSelection trkSelDaugthersV0s() - { - TrackSelection selectedTracks; - selectedTracks.SetEtaRange(-0.8f, 0.8f); - selectedTracks.SetMinNCrossedRowsTPC(70); - return selectedTracks; - } + // TrackSelection trkSelDaugthersV0s() { + // TrackSelection selectedTracks; + // selectedTracks.SetEtaRange(-0.8f, 0.8f); + // selectedTracks.SetMinNCrossedRowsTPC(70); + // return selectedTracks; + // } TrackSelection trkSelOpenDCAxy() { @@ -311,7 +335,7 @@ struct PiKpRAA { currentRunNumberNchSel = -1; currentRunNumberPhiSel = -1; trkSelGlobalOpenDCAxy = trkSelOpenDCAxy(); - trkSelDaugthers = trkSelDaugthersV0s(); + // trkSelDaugthers = trkSelDaugthersV0s(); trkSelGlobal = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSibAny, TrackSelection::GlobalTrackRun3DCAxyCut::Default); // define axes you want to use @@ -358,7 +382,7 @@ struct PiKpRAA { registry.add("NchVsNPV", ";Nch; NPV;", kTH2F, {{{nBinsNPV, minNpv, maxNpv}, {nBinsNch, minNch, maxNch}}}); registry.add("ExcludedEvtVsNch", ";Nch;Entries;", kTH1F, {{nBinsNch, minNch, maxNch}}); registry.add("ExcludedEvtVsNPV", ";NPV;Entries;", kTH1F, {{nBinsNPV, minNpv, maxNpv}}); - + registry.add("TrackDaughterCounter", "itsrefit, and itshit NOT appplied for electrons sel.;Trk Sel.; Entries;", kTH1F, {{14, 0.5, 14.5}}); registry.add("V0sCounter", ";V0 type; Entries;", kTH1F, {{4, 0.5, 4.5}}); registry.add("dcaDauVsPt", ";V0 #it{p}_{T} (GeV/#it{c});DCA_{xy} (cm) daughters;", kTH2F, {axisPt, axisDCAxy}); registry.add("nSigPiFromK0s", ";#it{n#sigma};;", kTH2F, {axisPtV0s, axisNsigmaTPC}); @@ -379,8 +403,8 @@ struct PiKpRAA { registry.add("MassALVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {axisPtV0s, axisLambdaMass}); registry.add("MassGVsPt", ";;Inv. Mass (GeV/#it{c}^{2});", kTH2F, {axisPtV0s, axisGammaMass}); - registry.add("NclFindable", ";;Findable Ncl TPC", kTH2F, {axisPtNcl, axisNcl}); - registry.add("NclFindablep", ";;Findable #LTNcl#GT TPC", kTProfile, {axisPtNcl}); + // registry.add("NclFindable", ";;Findable Ncl TPC", kTH2F, {axisPtNcl, axisNcl}); + // registry.add("NclFindablep", ";;Findable #LTNcl#GT TPC", kTProfile, {axisPtNcl}); registry.add("NclVsPhipBeforeCut", Form("Found #LTNcl#GT TPC;%s (GeV/#it{c});#varphi", titlePorPt.data()), kTProfile2D, {{{axisXPhiCut}, {350, 0.0, 0.35}}}); registry.add("NclVsPhipBeforeCutPID", Form("#LTNcl#GT used for PID;%s (GeV/#it{c});#varphi", titlePorPt.data()), kTProfile2D, {{{axisXPhiCut}, {350, 0.0, 0.35}}}); registry.add("NclVsPhipAfterCut", Form("Found #LTNcl#GT TPC;%s (GeV/#it{c});#varphi", titlePorPt.data()), kTProfile2D, {{{axisXPhiCut}, {350, 0.0, 0.35}}}); @@ -405,18 +429,20 @@ struct PiKpRAA { registry.add("EtaVsYPrAL", ";#eta;#it{y};", kTH2F, {axisEta, axisY}); registry.add("EtaVsYG", ";#eta;#it{y};", kTH2F, {axisEta, axisY}); - registry.add("TOFExpPi2TOF", ";Momentum (GeV/#it{c});t^{#pi}_{Exp}/t_{TOF}", kTH2F, {{{axisPtV0s}, {100, 0.2, 1.2}}}); - registry.add("TOFExpEl2TOF", ";Momentum (GeV/#it{c});t^{e}_{Exp}/t_{TOF}", kTH2F, {{{axisPtV0s}, {100, 0.2, 1.2}}}); + // registry.add("TOFExpPi2TOF", ";Momentum (GeV/#it{c});t^{#pi}_{Exp}/t_{TOF}", kTH2F, {{{axisPtV0s}, {100, 0.2, 1.2}}}); + registry.add("DCAxyDCAzPiK0s", ";DCA_{xy} (cm); DCA_{z} (cm)", kTH2F, {axisDCAxy, axisDCAxy}); + registry.add("DCAxyDCAzPrL", ";DCA_{xy} (cm); DCA_{z} (cm)", kTH2F, {axisDCAxy, axisDCAxy}); + registry.add("DCAxyDCAzPrAL", ";DCA_{xy} (cm); DCA_{z} (cm)", kTH2F, {axisDCAxy, axisDCAxy}); - registry.add("betaVsMomentum", ";Momentum (GeV/#it{c}); #beta", kTH2F, {{{axisPtV0s}, {500, 0, 1.2}}}); + // registry.add("betaVsMomentum", ";Momentum (GeV/#it{c}); #beta", kTH2F, {{{axisPtV0s}, {500, 0, 1.2}}}); registry.add("dEdxVsEtaPiMIP", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; dE/dx;", kTH2F, {{{axisEta}, {100, 0, 100}}}); registry.add("dEdxVsEtaPiMIPp", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; #LTdE/dx#GT", kTProfile, {axisEta}); - registry.add("dEdxVsEtaElMIP", "MIP e^{+} + e^{-} (0.3 < #it{p} < 0.4 GeV/#it{c});#eta; dE/dx;", kTH2F, {{{axisEta}, {100, 0, 100}}}); - registry.add("dEdxVsEtaElMIPp", "MIP e^{+} + e^{-} (0.3 < #it{p} < 0.4 GeV/#it{c});#eta; #LTdE/dx#GT", kTProfile, {axisEta}); + registry.add("dEdxVsEtaElMIP", "MIP e^{+} + e^{-} (0.3 < #it{p} < 0.45 GeV/#it{c});#eta; dE/dx;", kTH2F, {{{axisEta}, {100, 0, 100}}}); + registry.add("dEdxVsEtaElMIPp", "MIP e^{+} + e^{-} (0.3 < #it{p} < 0.45 GeV/#it{c});#eta; #LTdE/dx#GT", kTProfile, {axisEta}); registry.add("dEdxVsEtaPiMIPV0", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; dE/dx", kTH2F, {{{axisEta}, {100, 0, 100}}}); registry.add("dEdxVsEtaPiMIPV0p", "MIP #pi^{+} + #pi^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; #LTdE/dx#GT", kTProfile, {axisEta}); - registry.add("dEdxVsEtaElMIPV0", "e^{+} + e^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; dE/dx", kTH2F, {{{axisEta}, {100, 0, 100}}}); - registry.add("dEdxVsEtaElMIPV0p", "e^{+} + e^{-} (0.4 < #it{p} < 0.6 GeV/#it{c});#eta; #LTdE/dx#GT", kTProfile, {axisEta}); + registry.add("dEdxVsEtaElMIPV0", "e^{+} + e^{-} (0.15 <#it{p}_{T} < 50 GeV/#it{c});#eta; dE/dx", kTH2F, {{{axisEta}, {100, 0, 100}}}); + registry.add("dEdxVsEtaElMIPV0p", "e^{+} + e^{-} (0.15 <#it{p}_{T} < 50 GeV/#it{c});#eta; #LTdE/dx#GT", kTProfile, {axisEta}); registry.add("pTVsCent", "", kTH2F, {axisPt, axisCent}); @@ -442,6 +468,21 @@ struct PiKpRAA { nClVsdEdxpPiV0[i] = registry.add(Form("NclVsdEdxPiV0p_%s", endingEta[i]), Form("%s;;#LTd#it{E}/d#it{x}#GT", latexEta[i]), kTProfile, {axisNcl}); nClVsdEdxpPrV0[i] = registry.add(Form("NclVsdEdxPrV0p_%s", endingEta[i]), Form("%s;;#LTd#it{E}/d#it{x}#GT", latexEta[i]), kTProfile, {axisNcl}); } + + auto htrkSel = registry.get(HIST("TrackDaughterCounter")); + auto* xtrkSel = htrkSel->GetXaxis(); + xtrkSel->SetBinLabel(1, "All"); + xtrkSel->SetBinLabel(2, "Eta"); + xtrkSel->SetBinLabel(3, "Pt"); + xtrkSel->SetBinLabel(4, "XRows"); + xtrkSel->SetBinLabel(5, "XRowsOverFindableCls"); + xtrkSel->SetBinLabel(6, "Chi2TPC"); + xtrkSel->SetBinLabel(7, "Chi2ITS"); + xtrkSel->SetBinLabel(8, "Itsrefit"); + xtrkSel->SetBinLabel(9, "Tpcrefit"); + xtrkSel->SetBinLabel(10, "Golden"); + xtrkSel->SetBinLabel(11, "Itshit"); + xtrkSel->SetBinLabel(12, "Passed all"); } if (doprocessMC) { @@ -465,26 +506,8 @@ struct PiKpRAA { registry.add("PtPrVsCentMC", "", kTH2F, {axisPt, axisCent}); for (int i = 0; i < kNEtaHists; ++i) { - // dEdx[i] = registry.add(Form("dEdx_%s", endingEta[i]), Form("%s;Momentum (GeV/#it{c});dE/dx;", latexEta[i]), kTH3F, {axisPt, axisdEdx, axisCent}); - // pTVsP[i] = registry.add(Form("pTVsP_%s", endingEta[i]), Form("%s;Momentum (GeV/#it{c});#it{p}_{T} (GeV/#it{c});", latexEta[i]), kTH2F, {axisPt, axisPt}); - // dEdxPiV0[i] = registry.add(Form("dEdxPiV0_%s", endingEta[i]), Form("#pi^{+} + #pi^{-}, %s;Momentum (GeV/#it{c});dE/dx;", latexEta[i]), kTH3F, {axisPtV0s, axisdEdx, axisCent}); - // dEdxPrV0[i] = registry.add(Form("dEdxPrV0_%s", endingEta[i]), Form("p + #bar{p}, %s;Momentum (GeV/#it{c});dE/dx;", latexEta[i]), kTH3F, {axisPtV0s, axisdEdx, axisCent}); - // dEdxElV0[i] = registry.add(Form("dEdxElV0_%s", endingEta[i]), Form("e^{+} + e^{-}, %s;Momentum (GeV/#it{c});dE/dx;", latexEta[i]), kTH3F, {axisPtV0s, axisdEdx, axisCent}); - // dEdxPiTOF[i] = registry.add(Form("dEdxPiTOF_%s", endingEta[i]), Form("#pi^{+} + #pi^{-}, %s;Momentum (GeV/#it{c});dE/dx;", latexEta[i]), kTH3F, {axisPtV0s, axisdEdx, axisCent}); - // nClVsdEdxPiV0[i] = registry.add(Form("NclVsdEdxPiV0_%s", endingEta[i]), Form("%s;#it{N}_{cl} used for PID;dE/dx;", latexEta[i]), kTH2F, {axisNcl, axisdEdx}); - // nClVsdEdxElV0[i] = registry.add(Form("NclVsdEdxElV0_%s", endingEta[i]), Form("%s;#it{N}_{cl} used for PID;dE/dx;", latexEta[i]), kTH2F, {axisNcl, axisdEdx}); - // nClVsdEdxPrV0[i] = registry.add(Form("NclVsdEdxPrV0_%s", endingEta[i]), Form("%s;#it{N}_{cl} used for PID;dE/dx;", latexEta[i]), kTH2F, {axisNcl, axisdEdx}); nClVsP[i] = registry.add(Form("NclVsPPrimaries_%s", endingEta[i]), Form("%s;;Ncl TPC", latexEta[i]), kTH2F, {axisPtNcl, axisNcl}); - // nClVsPElV0[i] = registry.add(Form("NclVsPElV0_%s", endingEta[i]), Form("%s;;Ncl TPC", latexEta[i]), kTH2F, {axisPtNcl, axisNcl}); - // nClVsPPiV0[i] = registry.add(Form("NclVsPPiV0_%s", endingEta[i]), Form("%s;;Ncl TPC", latexEta[i]), kTH2F, {axisPtNcl, axisNcl}); - // nClVsPPrV0[i] = registry.add(Form("NclVsPPrV0_%s", endingEta[i]), Form("%s;;Ncl TPC", latexEta[i]), kTH2F, {axisPtNcl, axisNcl}); nClVsPp[i] = registry.add(Form("NclVsPrimariesp_%s", endingEta[i]), Form("%s;;#LT#it{N}_{cl}#GT TPC", latexEta[i]), kTProfile, {axisPtNcl}); - // nClVsPpElV0[i] = registry.add(Form("NclVsPElV0p_%s", endingEta[i]), Form("%s;;#LT#it{N}_{cl}#GT TPC", latexEta[i]), kTProfile, {axisPtNcl}); - // nClVsPpPiV0[i] = registry.add(Form("NclVsPPiV0p_%s", endingEta[i]), Form("%s;;#LT#it{N}_{cl}#GT TPC", latexEta[i]), kTProfile, {axisPtNcl}); - // nClVsPpPrV0[i] = registry.add(Form("NclVsPPrV0p_%s", endingEta[i]), Form("%s;;#LT#it{N}_{cl}#GT TPC", latexEta[i]), kTProfile, {axisPtNcl}); - // nClVsdEdxpElV0[i] = registry.add(Form("NclVsdEdxElV0p_%s", endingEta[i]), Form("%s;;#LTd#it{E}/d#it{x}#GT", latexEta[i]), kTProfile, {axisNcl}); - // nClVsdEdxpPiV0[i] = registry.add(Form("NclVsdEdxPiV0p_%s", endingEta[i]), Form("%s;;#LTd#it{E}/d#it{x}#GT", latexEta[i]), kTProfile, {axisNcl}); - // nClVsdEdxpPrV0[i] = registry.add(Form("NclVsdEdxPrV0p_%s", endingEta[i]), Form("%s;;#LTd#it{E}/d#it{x}#GT", latexEta[i]), kTProfile, {axisNcl}); } } @@ -492,8 +515,12 @@ struct PiKpRAA { LOG(info) << "\tapplyNchSel=" << applyNchSel.value; LOG(info) << "\tdetector4Calibration=" << detector4Calibration.value; LOG(info) << "\tv0TypeSelection=" << static_cast(v0Selections.v0TypeSelection); + LOG(info) << "\tselElecFromGammas=" << v0Selections.selElecFromGammas; + LOG(info) << "\trequireITShit=" << v0Selections.requireITShit; LOG(info) << "\tminPt=" << v0Selections.minPt; LOG(info) << "\tmaxPt=" << v0Selections.maxPt; + LOG(info) << "\tminPtDaughter=" << v0Selections.minPtDaughter; + LOG(info) << "\tmaxPtDaughter=" << v0Selections.maxPtDaughter; LOG(info) << "\tuseNclsPID=" << v0Selections.useNclsPID; LOG(info) << "\tqTSel=" << v0Selections.qTSel; LOG(info) << "\tarmAlphaSel=" << v0Selections.armAlphaSel; @@ -528,12 +555,14 @@ struct PiKpRAA { LOG(info) << "\tLoading Eta Cal!"; LOG(info) << "\tpathEtaCal=" << pathEtaCal.value; loadEtaCalibration(); + LOG(info) << "\tisMIPCalLoaded=" << etaCal.isMIPCalLoaded; } if (v0Selections.applyPlateauSel) { LOG(info) << "\tLoading Eta Plateau Cal!"; LOG(info) << "\tpathEtaCalPlateau=" << pathEtaCalPlateau.value; loadEtaPlateauCalibration(); + LOG(info) << "\tisCalPlateauLoaded=" << etaCal.isCalPlateauLoaded; } if (v0Selections.applyNclSel) @@ -579,28 +608,6 @@ struct PiKpRAA { nch++; } - for (const auto& track : tracks) { - // Track Selection - if (!trkSelGlobalOpenDCAxy.IsSelected(track)) { - continue; - } - if (track.pt() < kMinPtNchSel || track.pt() > kMaxPtNchSel) { - continue; - } - - const float piTPCNsigma{std::fabs(track.tpcNSigmaPi())}; - const float prTPCNsigma{std::fabs(track.tpcNSigmaPr())}; - const float piTOFNsigma{std::fabs(track.tofNSigmaPi())}; - const float prTOFNsigma{std::fabs(track.tofNSigmaPr())}; - const double piRadiusNsigma{std::sqrt(std::pow(piTPCNsigma, 2.) + std::pow(piTOFNsigma, 2.))}; - const double prRadiusNsigma{std::sqrt(std::pow(prTPCNsigma, 2.) + std::pow(prTOFNsigma, 2.))}; - - if (piRadiusNsigma < kThree) - registry.fill(HIST("dcaVsPtPi"), track.pt(), track.dcaXY()); - if (prRadiusNsigma < kThree) - registry.fill(HIST("dcaVsPtPr"), track.pt(), track.dcaXY()); - } - bool skipEvent{false}; if (applyNchSel) { if (!cfgNch.calibrationsLoaded) @@ -629,7 +636,6 @@ struct PiKpRAA { registry.fill(HIST("NchVsNPV"), nPV, nch); registry.fill(HIST("zPos"), collision.posZ()); - registry.fill(HIST("T0Ccent"), collision.centFT0C()); const float centrality{collision.centFT0C()}; if (v0Selections.applyPhiCut) { @@ -645,6 +651,52 @@ struct PiKpRAA { return; } + registry.fill(HIST("T0Ccent"), centrality); + // Fill DCAxy vs pT for secondary-particle contamination correction + for (const auto& track : tracks) { + // Track Selection + if (!trkSelGlobalOpenDCAxy.IsSelected(track)) + continue; + + if (track.pt() < v0Selections.minPt || track.pt() > v0Selections.maxPt) + continue; + + if (track.eta() < v0Selections.minEtaDaughter || track.eta() > v0Selections.maxEtaDaughter) + continue; + + const float momentum{track.p()}; + const float pt{track.pt()}; + const float phi{track.phi()}; + const float pOrPt{v0Selections.usePinPhiSelection ? momentum : pt}; + const int16_t nclFound{track.tpcNClsFound()}; + const int16_t nclPID{track.tpcNClsPID()}; + const int16_t ncl{v0Selections.useNclsPID ? nclPID : nclFound}; + + if (v0Selections.applyNclSel && ncl < v0Selections.minNcl) + continue; + + float phiPrime{phi}; + const int charge{track.sign()}; + phiPrimeFunc(phiPrime, magField, charge); + + if (v0Selections.applyPhiCut) { + if (!passesPhiSelection(pOrPt, phiPrime)) + continue; + } + + const float piTPCNsigma{std::fabs(track.tpcNSigmaPi())}; + const float prTPCNsigma{std::fabs(track.tpcNSigmaPr())}; + const float piTOFNsigma{std::fabs(track.tofNSigmaPi())}; + const float prTOFNsigma{std::fabs(track.tofNSigmaPr())}; + const double piRadiusNsigma{std::sqrt(std::pow(piTPCNsigma, 2.) + std::pow(piTOFNsigma, 2.))}; + const double prRadiusNsigma{std::sqrt(std::pow(prTPCNsigma, 2.) + std::pow(prTOFNsigma, 2.))}; + + if (piRadiusNsigma < kThree) + registry.fill(HIST("dcaVsPtPi"), track.pt(), track.dcaXY()); + if (prRadiusNsigma < kThree) + registry.fill(HIST("dcaVsPtPr"), track.pt(), track.dcaXY()); + } + for (const auto& track : tracks) { if (!trkSelGlobal.IsSelected(track)) @@ -653,6 +705,9 @@ struct PiKpRAA { if (track.pt() < v0Selections.minPt || track.pt() > v0Selections.maxPt) continue; + if (track.eta() < v0Selections.minEtaDaughter || track.eta() > v0Selections.maxEtaDaughter) + continue; + const float momentum{track.p()}; const float pt{track.pt()}; const float phi{track.phi()}; @@ -662,8 +717,8 @@ struct PiKpRAA { const float pOrPt{v0Selections.usePinPhiSelection ? momentum : pt}; const int16_t nclFound{track.tpcNClsFound()}; const int16_t nclPID{track.tpcNClsPID()}; + const int16_t ncl{v0Selections.useNclsPID ? nclPID : nclFound}; - const int16_t ncl = v0Selections.useNclsPID ? nclPID : nclFound; if (v0Selections.applyNclSel && ncl < v0Selections.minNcl) continue; @@ -704,18 +759,8 @@ struct PiKpRAA { } if (momentum > kMinPElMIP && momentum < kMaxPElMIP && dedx > kMindEdxMIPPlateau && dedx < kMaxdEdxMIPPlateau) { - if (track.hasTOF() && track.goodTOFMatch()) { - const float tTOF{track.tofSignal()}; - const float trkLength{track.length()}; - const float tExpElTOF{track.tofExpSignalEl(tTOF)}; - - if (trkLength > kZero && tTOF > kZero) { - if (std::abs((tExpElTOF / tTOF) - kOne) < v0Selections.maxExpTOFEl) { - registry.fill(HIST("dEdxVsEtaElMIP"), eta, dedx); - registry.fill(HIST("dEdxVsEtaElMIPp"), eta, dedx); - } - } - } + registry.fill(HIST("dEdxVsEtaElMIP"), eta, dedx); + registry.fill(HIST("dEdxVsEtaElMIPp"), eta, dedx); } dEdx[indexEta]->Fill(momentum, dedx, centrality); @@ -728,8 +773,8 @@ struct PiKpRAA { registry.fill(HIST("NclVsEtap"), eta, nclFound); registry.fill(HIST("NclVsEtaPID"), eta, nclPID); registry.fill(HIST("NclVsEtaPIDp"), eta, nclPID); - registry.fill(HIST("NclFindable"), pOrPt, track.tpcNClsFindable()); - registry.fill(HIST("NclFindablep"), pOrPt, track.tpcNClsFindable()); + // registry.fill(HIST("NclFindable"), pOrPt, track.tpcNClsFindable()); + // registry.fill(HIST("NclFindablep"), pOrPt, track.tpcNClsFindable()); registry.fill(HIST("NclVsPhipAfterCut"), pOrPt, phiPrime, nclFound); registry.fill(HIST("NclVsPhipAfterCutPID"), pOrPt, phiPrime, nclPID); @@ -737,12 +782,12 @@ struct PiKpRAA { const float tTOF{track.tofSignal()}; const float trkLength{track.length()}; const float tExpPiTOF{track.tofExpSignalPi(tTOF)}; - const float tExpElTOF{track.tofExpSignalEl(tTOF)}; + // const float tExpElTOF{track.tofExpSignalEl(tTOF)}; if (trkLength > kZero && tTOF > kZero) { - registry.fill(HIST("betaVsMomentum"), momentum, track.beta()); - registry.fill(HIST("TOFExpPi2TOF"), momentum, tExpPiTOF / tTOF); - registry.fill(HIST("TOFExpEl2TOF"), momentum, tExpElTOF / tTOF); + // registry.fill(HIST("betaVsMomentum"), momentum, track.beta()); + // registry.fill(HIST("TOFExpPi2TOF"), momentum, tExpPiTOF / tTOF); + // registry.fill(HIST("TOFExpEl2TOF"), momentum, tExpElTOF / tTOF); if (std::abs((tExpPiTOF / tTOF) - kOne) < v0Selections.maxExpTOFPi) { dEdxPiTOF[indexEta]->Fill(momentum, dedx, centrality); @@ -904,6 +949,7 @@ struct PiKpRAA { nClVsPpPiV0[negIndexEta]->Fill(negPorPt, negNcl); dEdxPiV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); dEdxPiV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); + registry.fill(HIST("DCAxyDCAzPiK0s"), posTrack.dcaXY(), posTrack.dcaZ()); if (posTrkP > kMinPMIP && posTrkP < kMaxPMIP && posTrkdEdx > kMindEdxMIP && posTrkdEdx < kMaxdEdxMIP) { registry.fill(HIST("dEdxVsEtaPiMIPV0"), posTrkEta, posTrkdEdx); @@ -922,22 +968,27 @@ struct PiKpRAA { registry.fill(HIST("V0sCounter"), V0sCounter::Lambda); registry.fill(HIST("ArmL"), alpha, qT); registry.fill(HIST("MassLVsPt"), v0.pt(), v0.mLambda()); - registry.fill(HIST("nSigPrFromL"), posTrkPt, posTrack.tpcNSigmaPr()); - registry.fill(HIST("nSigPiFromL"), negTrkPt, negTrack.tpcNSigmaPi()); - registry.fill(HIST("NclVsEtaPrV0"), posTrkEta, posNcl); - registry.fill(HIST("NclVsEtaPrV0p"), posTrkEta, posNcl); - registry.fill(HIST("NclVsEtaPiV0"), negTrkEta, negNcl); - registry.fill(HIST("NclVsEtaPiV0p"), negTrkEta, negNcl); - nClVsPPrV0[posIndexEta]->Fill(posPorPt, posNcl); - nClVsPpPrV0[posIndexEta]->Fill(posPorPt, posNcl); - nClVsPPiV0[negIndexEta]->Fill(negPorPt, negNcl); - nClVsPpPiV0[negIndexEta]->Fill(negPorPt, negNcl); - nClVsdEdxPiV0[negIndexEta]->Fill(negNcl, negTrkdEdx); - nClVsdEdxpPiV0[negIndexEta]->Fill(negNcl, negTrkdEdx); - nClVsdEdxPrV0[posIndexEta]->Fill(posNcl, posTrkdEdx); - nClVsdEdxpPrV0[posIndexEta]->Fill(posNcl, posTrkdEdx); - dEdxPrV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); - // dEdxPiV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); + if (posTrackCharge > kZero) { + registry.fill(HIST("nSigPrFromL"), posTrkPt, posTrack.tpcNSigmaPr()); + registry.fill(HIST("NclVsEtaPrV0"), posTrkEta, posNcl); + registry.fill(HIST("NclVsEtaPrV0p"), posTrkEta, posNcl); + nClVsPPrV0[posIndexEta]->Fill(posPorPt, posNcl); + nClVsPpPrV0[posIndexEta]->Fill(posPorPt, posNcl); + nClVsdEdxPrV0[posIndexEta]->Fill(posNcl, posTrkdEdx); + nClVsdEdxpPrV0[posIndexEta]->Fill(posNcl, posTrkdEdx); + dEdxPrV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); + registry.fill(HIST("DCAxyDCAzPrL"), posTrack.dcaXY(), posTrack.dcaZ()); + } + if (negTrackCharge < kZero) { + registry.fill(HIST("nSigPiFromL"), negTrkPt, negTrack.tpcNSigmaPi()); + registry.fill(HIST("NclVsEtaPiV0"), negTrkEta, negNcl); + registry.fill(HIST("NclVsEtaPiV0p"), negTrkEta, negNcl); + nClVsPPiV0[negIndexEta]->Fill(negPorPt, negNcl); + nClVsPpPiV0[negIndexEta]->Fill(negPorPt, negNcl); + nClVsdEdxPiV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + nClVsdEdxpPiV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + dEdxPiV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); + } } } @@ -946,22 +997,27 @@ struct PiKpRAA { registry.fill(HIST("V0sCounter"), V0sCounter::AntiLambda); registry.fill(HIST("ArmAL"), alpha, qT); registry.fill(HIST("MassALVsPt"), v0.pt(), v0.mAntiLambda()); - registry.fill(HIST("nSigPrFromAL"), negTrkPt, negTrack.tpcNSigmaPr()); - registry.fill(HIST("nSigPiFromAL"), posTrkPt, posTrack.tpcNSigmaPi()); - registry.fill(HIST("NclVsEtaPiV0"), posTrkEta, posNcl); - registry.fill(HIST("NclVsEtaPiV0p"), posTrkEta, posNcl); - registry.fill(HIST("NclVsEtaPrV0"), negTrkEta, negNcl); - registry.fill(HIST("NclVsEtaPrV0p"), negTrkEta, negNcl); - nClVsPPrV0[negIndexEta]->Fill(negPorPt, negNcl); - nClVsPpPrV0[negIndexEta]->Fill(negPorPt, negNcl); - nClVsPPiV0[posIndexEta]->Fill(posPorPt, posNcl); - nClVsPpPiV0[posIndexEta]->Fill(posPorPt, posNcl); - nClVsdEdxPrV0[negIndexEta]->Fill(negNcl, negTrkdEdx); - nClVsdEdxpPrV0[negIndexEta]->Fill(negNcl, negTrkdEdx); - nClVsdEdxPiV0[posIndexEta]->Fill(posNcl, posTrkdEdx); - nClVsdEdxpPiV0[posIndexEta]->Fill(posNcl, posTrkdEdx); - dEdxPrV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); - // dEdxPiV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); + if (posTrackCharge > kZero) { + registry.fill(HIST("nSigPiFromAL"), posTrkPt, posTrack.tpcNSigmaPi()); + registry.fill(HIST("NclVsEtaPiV0"), posTrkEta, posNcl); + registry.fill(HIST("NclVsEtaPiV0p"), posTrkEta, posNcl); + nClVsPPiV0[posIndexEta]->Fill(posPorPt, posNcl); + nClVsPpPiV0[posIndexEta]->Fill(posPorPt, posNcl); + nClVsdEdxPiV0[posIndexEta]->Fill(posNcl, posTrkdEdx); + nClVsdEdxpPiV0[posIndexEta]->Fill(posNcl, posTrkdEdx); + dEdxPiV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); + } + if (negTrackCharge < kZero) { + registry.fill(HIST("nSigPrFromAL"), negTrkPt, negTrack.tpcNSigmaPr()); + registry.fill(HIST("NclVsEtaPrV0"), negTrkEta, negNcl); + registry.fill(HIST("NclVsEtaPrV0p"), negTrkEta, negNcl); + nClVsPPrV0[negIndexEta]->Fill(negPorPt, negNcl); + nClVsPpPrV0[negIndexEta]->Fill(negPorPt, negNcl); + nClVsdEdxPrV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + nClVsdEdxpPrV0[negIndexEta]->Fill(negNcl, negTrkdEdx); + registry.fill(HIST("DCAxyDCAzPrAL"), negTrack.dcaXY(), negTrack.dcaZ()); + dEdxPrV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); + } } } @@ -993,14 +1049,10 @@ struct PiKpRAA { nClVsdEdxpElV0[negIndexEta]->Fill(negNcl, negTrkdEdx); nClVsdEdxElV0[posIndexEta]->Fill(posNcl, posTrkdEdx); nClVsdEdxpElV0[posIndexEta]->Fill(posNcl, posTrkdEdx); - if (posTrkP > kMinPMIP && posTrkP < kMaxPMIP) { - registry.fill(HIST("dEdxVsEtaElMIPV0"), posTrkEta, posTrkdEdx); - registry.fill(HIST("dEdxVsEtaElMIPV0p"), posTrkEta, posTrkdEdx); - } - if (negTrkP > kMinPMIP && negTrkP < kMaxPMIP) { - registry.fill(HIST("dEdxVsEtaElMIPV0"), negTrkEta, negTrkdEdx); - registry.fill(HIST("dEdxVsEtaElMIPV0p"), negTrkEta, negTrkdEdx); - } + registry.fill(HIST("dEdxVsEtaElMIPV0"), posTrkEta, posTrkdEdx); + registry.fill(HIST("dEdxVsEtaElMIPV0p"), posTrkEta, posTrkdEdx); + registry.fill(HIST("dEdxVsEtaElMIPV0"), negTrkEta, negTrkdEdx); + registry.fill(HIST("dEdxVsEtaElMIPV0p"), negTrkEta, negTrkdEdx); dEdxElV0[posIndexEta]->Fill(posTrkP, posTrkdEdx, centrality); dEdxElV0[negIndexEta]->Fill(negTrkP, negTrkdEdx, centrality); } @@ -1306,13 +1358,6 @@ struct PiKpRAA { { bool isSelected{false}; - // const double ptPos{std::sqrt(std::pow(v0.pxpos(), 2.0) + std::pow(v0.pypos(), 2.0))}; - // const double ptNeg{std::sqrt(std::pow(v0.pxneg(), 2.0) + std::pow(v0.pyneg(), 2.0))}; - // const double dcaPtDepPos{0.0105 + 0.035 * std::pow(ptPos, -1.1)}; - // const double dcaPtDepNeg{0.0105 + 0.035 * std::pow(ptNeg, -1.1)}; - // const double dcaSelPos = std::max(0.1, dcaPtDepPos); - // const double dcaSelNeg = std::max(0.1, dcaPtDepNeg); - const double dcaPos{std::fabs(v0.dcapostopv())}; const double dcaNeg{std::fabs(v0.dcanegtopv())}; @@ -1324,14 +1369,84 @@ struct PiKpRAA { bool passesTrackSelectionDaughters(const T& track) { + // Secondary particle selection are basically Global tracks excluding the DCAxy selection + // This approach was used in the Run 2 analyses + // https://github.com/AliceO2Group/O2Physics/blob/b178c96d03ede873ee769ef8a4d7c1e21bf78332/Common/Core/TrackSelectionDefaults.cxx + const float pt{track.pt()}; const float eta{track.eta()}; const int16_t nCrossedRows{track.tpcNClsCrossedRows()}; + const float nCrossedRowsOverFindableCls{track.tpcCrossedRowsOverFindableCls()}; + const float chi2PerClsTPC{track.tpcChi2NCl()}; + const float chi2PerClsITS{track.itsChi2NCl()}; + const bool refitITS{track.passedITSRefit()}; + const bool refitTPC{track.passedTPCRefit()}; + const bool goldeChi2{track.passedGoldenChi2()}; + const bool oneHitITSib{track.passedITSHitsFB1()}; + + bool etaSel{false}; + bool ptSel{false}; + bool xRows{false}; + bool xRowsToFindCls{false}; + bool chi2TPC{false}; + bool chi2ITS{false}; + bool itsrefit{false}; + bool tpcrefit{false}; + bool golden{false}; + bool itshit{false}; + + registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::AllTrks); + if (eta > v0Selections.minEtaDaughter && eta < v0Selections.maxEtaDaughter) { + etaSel = true; + registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::Eta); + } + if (pt > v0Selections.minPtDaughter && pt < v0Selections.maxPtDaughter) { + ptSel = true; + registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::Pt); + } + if (nCrossedRows >= v0Selections.minNCrossedRows) { + xRows = true; + registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::XRows); + } + if (nCrossedRowsOverFindableCls >= v0Selections.minNCrossedRowsOverFindableCls) { + xRowsToFindCls = true; + registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::XRowsOverFindableCls); + } + if (chi2PerClsTPC < v0Selections.maxChi2ClsTPC) { + chi2TPC = true; + registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::Chi2TPC); + } + if (chi2PerClsITS < v0Selections.maxChi2ClsITS) { + chi2ITS = true; + registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::Chi2ITS); + } + if (refitITS == v0Selections.itsRefit) { + itsrefit = true; + registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::Itsrefit); + } + if (refitTPC == v0Selections.tpcRefit) { + tpcrefit = true; + registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::Tpcrefit); + } + if (goldeChi2 == v0Selections.chi2Golden) { + golden = true; + registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::Golden); + } + if (oneHitITSib == v0Selections.its1HitIB) { + itshit = true; + registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::Itshit); + } bool isSelected{false}; - if (v0Selections.selElecFromGammas) - isSelected = std::abs(eta) < v0Selections.maxEtaDaughter && nCrossedRows >= v0Selections.minNCrossedRows ? true : false; - if (!v0Selections.selElecFromGammas) - isSelected = trkSelDaugthers.IsSelected(track) ? true : false; + if (!v0Selections.selElecFromGammas && v0Selections.requireITShit) + isSelected = etaSel && ptSel && xRows && xRowsToFindCls && chi2TPC && chi2ITS && itsrefit && tpcrefit && golden && itshit ? true : false; + if (!v0Selections.selElecFromGammas && !v0Selections.requireITShit) + isSelected = etaSel && ptSel && xRows && xRowsToFindCls && chi2TPC && chi2ITS && itsrefit && tpcrefit && golden ? true : false; + if (v0Selections.selElecFromGammas) { + isSelected = etaSel && ptSel && xRows && xRowsToFindCls && chi2TPC && chi2ITS && tpcrefit && golden ? true : false; + } + + if (isSelected == true) + registry.fill(HIST("TrackDaughterCounter"), TrkSelLabel::PassedAll); return isSelected; } From 5f9f9f21a7cfcf906db5c841887a5b0331f57c58 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sat, 11 Oct 2025 05:40:37 +0200 Subject: [PATCH 709/986] [PWGEM/Dilepton] update muon histograms (#13313) --- PWGEM/Dilepton/Core/SingleTrackQC.h | 7 ++++--- PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx | 8 +++++++- PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx | 6 ++++-- PWGEM/Dilepton/Tasks/createResolutionMap.cxx | 6 ++++-- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/PWGEM/Dilepton/Core/SingleTrackQC.h b/PWGEM/Dilepton/Core/SingleTrackQC.h index 5d9aa898951..d76cd2088b8 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQC.h @@ -299,7 +299,7 @@ struct SingleTrackQC { // track info fRegistry.add("Track/positive/hs", "rec. single muon", kTHnSparseD, {axis_pt, axis_eta, axis_phi, axis_dca}, true); fRegistry.add("Track/positive/hEtaPhi_MatchMCHMID", "#eta vs. #varphi of matched MCHMID", kTH2F, {{180, 0, 2.f * M_PI}, {100, -6, -1}}, false); - fRegistry.add("Track/positive/hdEtadPhi", "#Delta#eta vs. #Delta#varphi between MFT-MCH-MID and MCH-MID;#varphi_{sa} - #varphi_{gl} (rad.);#eta_{sa} - #eta_{gl}", kTH2F, {{90, -M_PI / 4, M_PI / 4}, {100, -0.5, +0.5}}, false); + fRegistry.add("Track/positive/hsDelta", "diff. between GL and associated SA;p_{T}^{gl} (GeV/c);(p_{T}^{sa} - p_{T}^{gl})/p_{T}^{gl};#Delta#eta;#Delta#varphi (rad.);", kTHnSparseF, {axis_pt, {100, -0.5, +0.5}, {100, -0.5, +0.5}, {90, -M_PI / 4, M_PI / 4}}, false); fRegistry.add("Track/positive/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{1000, -5, 5}}, false); fRegistry.add("Track/positive/hTrackType", "track type", kTH1F, {{6, -0.5f, 5.5}}, false); fRegistry.add("Track/positive/hDCAxy", "DCA x vs. y;DCA_{x} (cm);DCA_{y} (cm)", kTH2F, {{200, -0.5f, 0.5f}, {200, -0.5f, 0.5f}}, false); @@ -636,6 +636,7 @@ struct SingleTrackQC { } float dca_xy = fwdDcaXYinSigma(track); + float reldpt = (track.ptMatchedMCHMID() - track.pt()) / track.pt(); float deta = track.etaMatchedMCHMID() - track.eta(); float dphi = track.phiMatchedMCHMID() - track.phi(); o2::math_utils::bringToPMPi(dphi); @@ -643,7 +644,7 @@ struct SingleTrackQC { if (track.sign() > 0) { fRegistry.fill(HIST("Track/positive/hs"), track.pt(), track.eta(), track.phi(), dca_xy, weight); fRegistry.fill(HIST("Track/positive/hEtaPhi_MatchMCHMID"), track.phiMatchedMCHMID(), track.etaMatchedMCHMID(), weight); - fRegistry.fill(HIST("Track/positive/hdEtadPhi"), dphi, deta, weight); + fRegistry.fill(HIST("Track/positive/hsDelta"), track.pt(), reldpt, deta, dphi, weight); fRegistry.fill(HIST("Track/positive/hQoverPt"), track.sign() / track.pt()); fRegistry.fill(HIST("Track/positive/hTrackType"), track.trackType()); fRegistry.fill(HIST("Track/positive/hDCAxy"), track.fwdDcaX(), track.fwdDcaY()); @@ -661,7 +662,7 @@ struct SingleTrackQC { } else { fRegistry.fill(HIST("Track/negative/hs"), track.pt(), track.eta(), track.phi(), dca_xy, weight); fRegistry.fill(HIST("Track/negative/hEtaPhi_MatchMCHMID"), track.phiMatchedMCHMID(), track.etaMatchedMCHMID(), weight); - fRegistry.fill(HIST("Track/negative/hdEtadPhi"), dphi, deta, weight); + fRegistry.fill(HIST("Track/negative/hsDelta"), track.pt(), reldpt, deta, dphi, weight); fRegistry.fill(HIST("Track/negative/hQoverPt"), track.sign() / track.pt()); fRegistry.fill(HIST("Track/negative/hTrackType"), track.trackType()); fRegistry.fill(HIST("Track/negative/hDCAxy"), track.fwdDcaX(), track.fwdDcaY()); diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx index 7edde399dbe..37cb5acd78e 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx @@ -85,10 +85,12 @@ struct skimmerPrimaryElectronQC { Configurable max_frac_shared_clusters_tpc{"max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; Configurable maxchi2tpc{"maxchi2tpc", 5.0, "max. chi2/NclsTPC"}; Configurable maxchi2its{"maxchi2its", 36.0, "max. chi2/NclsITS"}; + Configurable minchi2its{"minchi2its", -1e+10, "min. chi2/NclsITS"}; Configurable minpt{"minpt", 0.05, "min pt for ITS-TPC track"}; Configurable maxeta{"maxeta", 0.9, "eta acceptance"}; Configurable dca_xy_max{"dca_xy_max", 1.0, "max DCAxy in cm"}; Configurable dca_z_max{"dca_z_max", 1.0, "max DCAz in cm"}; + Configurable includeITSsa{"includeITSsa", false, "Flag to include ITSsa tracks"}; Configurable minTPCNsigmaEl{"minTPCNsigmaEl", -3.5, "min. TPC n sigma for electron inclusion"}; Configurable maxTPCNsigmaEl{"maxTPCNsigmaEl", +3.5, "max. TPC n sigma for electron inclusion"}; } trackcut; @@ -293,7 +295,7 @@ struct skimmerPrimaryElectronQC { return false; } - if (trackcut.maxchi2its < track.itsChi2NCl()) { // accept ITS afterburner (itsChi2NCl = -999) + if (track.itsChi2NCl() < trackcut.minchi2its || trackcut.maxchi2its < track.itsChi2NCl()) { // accept ITS afterburner (itsChi2NCl = -999) return false; } if (track.itsNCls() < trackcut.min_ncluster_its) { @@ -303,6 +305,10 @@ struct skimmerPrimaryElectronQC { return false; } + if (!trackcut.includeITSsa && (!track.hasITS() || !track.hasTPC())) { + return false; + } + if (track.hasTPC()) { if (track.tpcChi2NCl() < 0.f || trackcut.maxchi2tpc < track.tpcChi2NCl()) { return false; diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx index b63e93e26e0..280c80b8320 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx @@ -296,9 +296,11 @@ struct skimmerPrimaryMuon { if (refitGlobalMuon) { eta = mfttrack.eta(); - phi = mfttrack.phi(); - o2::math_utils::bringTo02Pi(phi); + // phi = mfttrack.phi(); + // o2::math_utils::bringTo02Pi(phi); pt = propmuonAtPV_Matched.getP() * std::sin(2.f * std::atan(std::exp(-eta))); + phi = propmuonAtDCA.getPhi(); + o2::math_utils::bringTo02Pi(phi); // x = mfttrack.x(); // y = mfttrack.y(); diff --git a/PWGEM/Dilepton/Tasks/createResolutionMap.cxx b/PWGEM/Dilepton/Tasks/createResolutionMap.cxx index 482c78314ef..09dc09f37a0 100644 --- a/PWGEM/Dilepton/Tasks/createResolutionMap.cxx +++ b/PWGEM/Dilepton/Tasks/createResolutionMap.cxx @@ -591,9 +591,11 @@ struct CreateResolutionMap { } if (muoncuts.refitGlobalMuon) { eta = mfttrack.eta(); - phi = mfttrack.phi(); - o2::math_utils::bringTo02Pi(phi); + // phi = mfttrack.phi(); + // o2::math_utils::bringTo02Pi(phi); pt = propmuonAtPV_Matched.getP() * std::sin(2.f * std::atan(std::exp(-eta))); + phi = propmuonAtDCA.getPhi(); + o2::math_utils::bringTo02Pi(phi); } float dpt = (ptMatchedMCHMID - pt) / pt; From 7f81952ccd0d4b3316c1fbbfa23d3970f50bb721 Mon Sep 17 00:00:00 2001 From: alcaliva <32872606+alcaliva@users.noreply.github.com> Date: Sat, 11 Oct 2025 08:42:31 +0200 Subject: [PATCH 710/986] [PWGLF] Modify getFirstAncestor to return the first physical primary in the ancestry chain (#13322) --- PWGLF/Tasks/Nuspex/antinucleiInJets.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx index 67771be88f3..4c26eb5e2d8 100644 --- a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx +++ b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx @@ -505,12 +505,23 @@ struct AntinucleiInJets { { auto current = particle; + // If already physical primary, return it + if (current.isPhysicalPrimary()) + return current; + while (current.has_mothers()) { auto motherId = current.mothersIds()[0]; + + // Stop if motherId is invalid if (motherId < 0 || motherId >= mcParticles.size()) { break; } + + // Move up the chain current = mcParticles.iteratorAt(motherId); + + if (current.isPhysicalPrimary()) + break; } return current; From 3e05f1fcdac52151bdf0c70976b4083cd514c734 Mon Sep 17 00:00:00 2001 From: Archita-Dash <91664849+Archita-Dash@users.noreply.github.com> Date: Sat, 11 Oct 2025 11:06:12 +0200 Subject: [PATCH 711/986] [PWGJE] added corrected cluster energy tables in my task (#13324) Co-authored-by: ALICE Action Bot --- PWGJE/Tasks/fullJetSpectra.cxx | 279 +++++++++++++++++++++++++-------- 1 file changed, 210 insertions(+), 69 deletions(-) diff --git a/PWGJE/Tasks/fullJetSpectra.cxx b/PWGJE/Tasks/fullJetSpectra.cxx index 457715e679a..6500cea42eb 100644 --- a/PWGJE/Tasks/fullJetSpectra.cxx +++ b/PWGJE/Tasks/fullJetSpectra.cxx @@ -13,6 +13,8 @@ /// \brief Task for full jet spectra studies in pp collisions. /// \author Archita Rani Dash +/// TO DO : include histograms for cluster correction modes in the MC Mult processes. + #include "PWGJE/Core/JetDerivedDataUtilities.h" #include "PWGJE/Core/JetFindingUtilities.h" #include "PWGJE/Core/JetUtilities.h" @@ -51,6 +53,7 @@ using namespace std; using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +using ClusterWithCorrections = soa::Join; struct FullJetSpectra { @@ -398,8 +401,17 @@ struct FullJetSpectra { registry.add("h_cluster_pt", "cluster pT;#it{p}_{T_cluster} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}, doSumw2); registry.add("h_cluster_eta", "cluster #eta;#eta_{cluster};entries", {HistType::kTH1F, {{100, -1., 1.}}}, doSumw2); registry.add("h_cluster_phi", "cluster #varphi;#varphi_{cluster};entries", {HistType::kTH1F, {{160, 0., 7.}}}, doSumw2); - registry.add("h_cluster_energy", "cluster energy;Energy of cluster;entries", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); - registry.add("h_cluster_energysum", "cluster energy sum;Sum of cluster energy per event;entries", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); + registry.add("h_cluster_energysum_uncorr", "cluster energy sum;Sum of cluster energy per event;entries", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); + registry.add("h_cluster_energysum_corr_oneTrack100", "cluster energy sum;Sum of cluster energy per event;entries", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); + registry.add("h_cluster_energysum_corr_oneTrack70", "cluster energy sum;Sum of cluster energy per event;entries", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); + registry.add("h_cluster_energysum_corr_allTracks100", "cluster energy sum;Sum of cluster energy per event;entries", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); + registry.add("h_cluster_energysum_corr_allTracks70", "cluster energy sum;Sum of cluster energy per event;entries", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); + + registry.add("h_cluster_energy_uncorr", "Cluster Energy (uncorrected); E_{cluster} [GeV]; N_{clusters}", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); + registry.add("h_cluster_energy_corr_oneTrack100", "Cluster Energy (HadCorr, 1track, 100%); E_{cluster}^{corr,1,100} [GeV]; N_{clusters}", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); + registry.add("h_cluster_energy_corr_oneTrack70", "Cluster Energy (HadCorr, 1track, 70%); E_{cluster}^{corr,1,70} [GeV]; N_{clusters}", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); + registry.add("h_cluster_energy_corr_allTracks100", "Cluster Energy (HadCorr, alltracks, 100%); E_{cluster}^{corr,all,100} [GeV]; N_{clusters}", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); + registry.add("h_cluster_energy_corr_allTracks70", "Cluster Energy (HadCorr, alltracks, 70%); E_{cluster}^{corr,all,70} [GeV]; N_{clusters}", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); if (doprocessTracksWeighted) { registry.add("hCollisionsWeighted", "event status;event status;entries", {HistType::kTH1F, {{12, 0.0, 12.0}}}, doSumw2); @@ -427,7 +439,13 @@ struct FullJetSpectra { registry.add("h_full_jet_chargedconstituents_phi", "track #varphi;#varphi^{jet}_{track};entries", {HistType::kTH1F, {{160, 0., 7.}}}, doSumw2); registry.add("h_full_jet_chargedconstituents_energy", "track energy;Energy of tracks;entries", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); registry.add("h_full_jet_chargedconstituents_energysum", "track energy sum;Sum of track energy per event;entries", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); - registry.add("h_full_jet_neutralconstituents_pt", "cluster pT;#it{p}^{T,jet}_{cluster} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}, doSumw2); + + registry.add("h_full_jet_neutralconstituents_pt_uncorr", "cluster pT;#it{p}^{T,jet}_{cluster} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}, doSumw2); + registry.add("h_full_jet_neutralconstituents_pt_corr_oneTrack100", "cluster pT;#it{p}^{T,jet}_{cluster} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}, doSumw2); + registry.add("h_full_jet_neutralconstituents_pt_corr_oneTrack70", "cluster pT;#it{p}^{T,jet}_{cluster} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}, doSumw2); + registry.add("h_full_jet_neutralconstituents_pt_corr_allTracks100", "cluster pT;#it{p}^{T,jet}_{cluster} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}, doSumw2); + registry.add("h_full_jet_neutralconstituents_pt_corr_allTracks70", "cluster pT;#it{p}^{T,jet}_{cluster} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}, doSumw2); + registry.add("h_full_jet_neutralconstituents_eta", "cluster #eta;#eta^{jet}_{cluster};entries", {HistType::kTH1F, {{100, -1., 1.}}}, doSumw2); registry.add("h_full_jet_neutralconstituents_phi", "cluster #varphi;#varphi^{jet}_{cluster};entries", {HistType::kTH1F, {{160, 0., 7.}}}, doSumw2); registry.add("h_full_jet_neutralconstituents_energy", "cluster energy;Energy of cluster;entries", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); @@ -438,6 +456,19 @@ struct FullJetSpectra { registry.add("h2_track_etaphi", "jet_track #eta vs jet_track #varphi; #eta_{track};#varphi_{track}", {HistType::kTH2F, {{500, -5., 5.}, {160, -1., 7.}}}, doSumw2); registry.add("h2_jet_etaphi", "jet #eta vs jet #varphi; #eta_{jet};#varphi_{jet}", {HistType::kTH2F, {{100, -1., 1.}, {160, -1., 7.}}}, doSumw2); + + // NEW: Jet constituent histograms for each hadronic correction mode + registry.add("h_full_jet_neutralconstituents_energy_uncorr", "Jet neutral cluster energy (uncorr)", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); + registry.add("h_full_jet_neutralconstituents_energy_corr_oneTrack100", "Jet neutral cluster energy (corr 1track100)", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); + registry.add("h_full_jet_neutralconstituents_energy_corr_oneTrack70", "Jet neutral cluster energy (corr 1track70)", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); + registry.add("h_full_jet_neutralconstituents_energy_corr_allTracks100", "Jet neutral cluster energy (corr alltracks100)", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); + registry.add("h_full_jet_neutralconstituents_energy_corr_allTracks70", "Jet neutral cluster energy (corr alltracks70)", {HistType::kTH1F, {{400, 0., 400.}}}, doSumw2); + // Corrected NEF histograms for the corresponding correction mode + registry.add("h2_full_jet_nef_uncorr", "Jet pT vs NEF (uncorr); p_{T,jet}; NEF", {HistType::kTH2F, {{350, 0., 350.}, {100, 0., 1.}}}, doSumw2); + registry.add("h2_full_jet_nef_corr_oneTrack100", "Jet pT vs NEF (corr, 1track100); p_{T,jet}; NEF", {HistType::kTH2F, {{350, 0., 350.}, {100, 0., 1.}}}, doSumw2); + registry.add("h2_full_jet_nef_corr_oneTrack70", "Jet pT vs NEF (corr, 1track70); p_{T,jet}; NEF", {HistType::kTH2F, {{350, 0., 350.}, {100, 0., 1.}}}, doSumw2); + registry.add("h2_full_jet_nef_corr_allTracks100", "Jet pT vs NEF (corr, alltracks100); p_{T,jet}; NEF", {HistType::kTH2F, {{350, 0., 350.}, {100, 0., 1.}}}, doSumw2); + registry.add("h2_full_jet_nef_corr_allTracks70", "Jet pT vs NEF (corr, alltracks70); p_{T,jet}; NEF", {HistType::kTH2F, {{350, 0., 350.}, {100, 0., 1.}}}, doSumw2); } if (doprocessJetsTriggeredData) { registry.add("hDetTrigcollisionCounter", "event status;;entries", {HistType::kTH1F, {{14, 0.0, 14.}}}, doSumw2); @@ -469,8 +500,6 @@ struct FullJetSpectra { registry.add("h2_track_etaphi_part", "jet_track #eta vs jet_track #varphi; #eta_{track};#varphi_{track}", {HistType::kTH2F, {{500, -5., 5.}, {160, -1., 7.}}}, doSumw2); registry.add("h2_jet_etaphi_part", "jet #eta vs jet #varphi; #eta_{jet};#varphi_{jet}", {HistType::kTH2F, {{100, -1., 1.}, {160, -1., 7.}}}, doSumw2); - // registry.add("h_NOmcpemcalcollisions", "event status;entries", {HistType::kTH1F, {{100, 0., 100.}}}); - // registry.add("h_mcpemcalcollisions", "event status;entries", {HistType::kTH1F, {{100, 0., 100.}}}); registry.add("h2_full_mcpjetOutsideFiducial_pt", "MCP jet outside EMC Fiducial Acceptance #it{p}_{T,part};#it{p}_{T,part} (GeV/c); Ncounts", {HistType::kTH2F, {{350, 0., 350.}, {10000, 0., 10000.}}}, doSumw2); registry.add("h_full_mcpjetOutside_eta_part", "MCP jet #eta outside EMC Fiducial Acceptance;#eta_{jet};entries", {HistType::kTH1F, {{100, -1., 1.}}}, doSumw2); registry.add("h_full_mcpjetOutside_phi_part", "MCP jet #varphi outside EMC Fiducial Acceptance;#varphi_{jet};entries", {HistType::kTH1F, {{160, 0., 7.}}}, doSumw2); @@ -528,10 +557,19 @@ struct FullJetSpectra { // CASE 1: registry.add("h_all_fulljet_pt", "#it{p}_{T,fulljet};#it{p}_{T_fulljet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}, doSumw2); registry.add("h_all_fulljet_Nch", ";N_{ch};", {HistType::kTH1F, {{50, 0., 50.}}}, doSumw2); - registry.add("h_all_fulljet_NEF", ";NEF;", {HistType::kTH1F, {{105, 0., 1.05}}}, doSumw2); + registry.add("h_all_fulljet_NEF_uncorr", ";NEF;", {HistType::kTH1F, {{105, 0., 1.05}}}, doSumw2); + registry.add("h_all_fulljet_NEF_corr_oneTrack100", ";NEF;", {HistType::kTH1F, {{105, 0., 1.05}}}, doSumw2); + registry.add("h_all_fulljet_NEF_corr_oneTrack70", ";NEF;", {HistType::kTH1F, {{105, 0., 1.05}}}, doSumw2); + registry.add("h_all_fulljet_NEF_corr_allTracks100", ";NEF;", {HistType::kTH1F, {{105, 0., 1.05}}}, doSumw2); + registry.add("h_all_fulljet_NEF_corr_allTracks70", ";NEF;", {HistType::kTH1F, {{105, 0., 1.05}}}, doSumw2); + registry.add("h2_all_fulljet_jetpTDet_vs_FT0Mults", "; p_{T,det} (GeV/c); FT0M Multiplicity", {HistType::kTH2F, {{350, 0., 350.}, {3500, 0., 3500.}}}, doSumw2); registry.add("h2_all_fulljet_jetpTDet_vs_Nch", ";#it{p}_{T_fulljet} (GeV/#it{c}); N_{ch}", {HistType::kTH2F, {{350, 0., 350.}, {50, 0., 50.}}}, doSumw2); - registry.add("h3_full_jet_jetpTDet_FT0Mults_nef", "; p_{T,det} (GeV/c); FT0M Multiplicity, nef", {HistType::kTH3F, {{350, 0., 350.}, {50, 0., 50.}, {105, 0.0, 1.05}}}, doSumw2); + registry.add("h3_full_jet_jetpTDet_FT0Mults_nef_uncorr", "; p_{T,det} (GeV/c); FT0M Multiplicity, nef", {HistType::kTH3F, {{350, 0., 350.}, {50, 0., 50.}, {105, 0.0, 1.05}}}, doSumw2); + registry.add("h3_full_jet_jetpTDet_FT0Mults_nef_corr_oneTrack100", "; p_{T,det} (GeV/c); FT0M Multiplicity, nef", {HistType::kTH3F, {{350, 0., 350.}, {50, 0., 50.}, {105, 0.0, 1.05}}}, doSumw2); + registry.add("h3_full_jet_jetpTDet_FT0Mults_nef_corr_oneTrack70", "; p_{T,det} (GeV/c); FT0M Multiplicity, nef", {HistType::kTH3F, {{350, 0., 350.}, {50, 0., 50.}, {105, 0.0, 1.05}}}, doSumw2); + registry.add("h3_full_jet_jetpTDet_FT0Mults_nef_corr_allTracks100", "; p_{T,det} (GeV/c); FT0M Multiplicity, nef", {HistType::kTH3F, {{350, 0., 350.}, {50, 0., 50.}, {105, 0.0, 1.05}}}, doSumw2); + registry.add("h3_full_jet_jetpTDet_FT0Mults_nef_corr_allTracks70", "; p_{T,det} (GeV/c); FT0M Multiplicity, nef", {HistType::kTH3F, {{350, 0., 350.}, {50, 0., 50.}, {105, 0.0, 1.05}}}, doSumw2); // CASE 2: registry.add("h_leading_fulljet_pt", "#it{p}_{T,Leading fulljet};#it{p}_{T_Leadingfulljet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}, doSumw2); registry.add("h_leading_fulljet_Nch", ";N_{ch};", {HistType::kTH1F, {{50, 0., 50.}}}, doSumw2); @@ -730,7 +768,7 @@ struct FullJetSpectra { template void fillJetHistograms(T const& jet, float weight = 1.0) { - float neutralEnergy = 0.0; + // float neutralEnergy = 0.0; double sumtrackE = 0.0; if (jet.r() == round(selectedJetsRadius * 100.0f)) { registry.fill(HIST("h_full_jet_pt"), jet.pt(), weight); @@ -738,20 +776,71 @@ struct FullJetSpectra { registry.fill(HIST("h_full_jet_phi"), jet.phi(), weight); registry.fill(HIST("h2_jet_etaphi"), jet.eta(), jet.phi(), weight); - for (const auto& cluster : jet.template clusters_as()) { + // Sums for each correction mode + double neutralEnergy_uncorr = 0.0; + double neutralEnergy_corr_oneTrack100 = 0.0; + double neutralEnergy_corr_oneTrack70 = 0.0; + double neutralEnergy_corr_allTracks100 = 0.0; + double neutralEnergy_corr_allTracks70 = 0.0; + + for (const auto& cluster : jet.template clusters_as()) { registry.fill(HIST("h2_full_jet_neutralconstituents"), jet.pt(), jet.clustersIds().size(), weight); - neutralEnergy += cluster.energy(); - double clusterpt = cluster.energy() / std::cosh(cluster.eta()); + // Sum energies for NEF calculation for each correction mode + neutralEnergy_uncorr += cluster.energy(); + neutralEnergy_corr_oneTrack100 += cluster.energyCorrectedOneTrack1(); + neutralEnergy_corr_oneTrack70 += cluster.energyCorrectedOneTrack2(); + neutralEnergy_corr_allTracks100 += cluster.energyCorrectedAllTracks1(); + neutralEnergy_corr_allTracks70 += cluster.energyCorrectedAllTracks2(); + + // neutralEnergy += cluster.energy(); + double clusterpt_uncorr = cluster.energy() / std::cosh(cluster.eta()); + double clusterpt_corr_oneTrack100 = cluster.energyCorrectedOneTrack1() / std::cosh(cluster.eta()); + double clusterpt_corr_oneTrack70 = cluster.energyCorrectedOneTrack2() / std::cosh(cluster.eta()); + double clusterpt_corr_allTracks100 = cluster.energyCorrectedAllTracks1() / std::cosh(cluster.eta()); + double clusterpt_corr_allTracks70 = cluster.energyCorrectedAllTracks2() / std::cosh(cluster.eta()); + registry.fill(HIST("h_full_jet_clusterTime"), cluster.time(), weight); - registry.fill(HIST("h_full_jet_neutralconstituents_pt"), clusterpt, weight); + registry.fill(HIST("h_full_jet_neutralconstituents_pt_uncorr"), clusterpt_uncorr, weight); + registry.fill(HIST("h_full_jet_neutralconstituents_pt_corr_oneTrack100"), clusterpt_corr_oneTrack100, weight); + registry.fill(HIST("h_full_jet_neutralconstituents_pt_corr_oneTrack70"), clusterpt_corr_oneTrack70, weight); + registry.fill(HIST("h_full_jet_neutralconstituents_pt_corr_allTracks100"), clusterpt_corr_allTracks100, weight); + registry.fill(HIST("h_full_jet_neutralconstituents_pt_corr_allTracks70"), clusterpt_corr_allTracks70, weight); + registry.fill(HIST("h_full_jet_neutralconstituents_eta"), cluster.eta(), weight); registry.fill(HIST("h_full_jet_neutralconstituents_phi"), cluster.phi(), weight); - registry.fill(HIST("h_full_jet_neutralconstituents_energy"), cluster.energy(), weight); - registry.fill(HIST("h_full_jet_neutralconstituents_energysum"), neutralEnergy, weight); + registry.fill(HIST("h_full_jet_neutralconstituents_energysum"), neutralEnergy_uncorr, weight); + + registry.fill(HIST("h_full_jet_neutralconstituents_energy_uncorr"), cluster.energy(), weight); + + if (cluster.energyCorrectedOneTrack1()) { + registry.fill(HIST("h_full_jet_neutralconstituents_energy_corr_oneTrack100"), cluster.energyCorrectedOneTrack1(), weight); + } + if (cluster.energyCorrectedOneTrack2()) { + registry.fill(HIST("h_full_jet_neutralconstituents_energy_corr_oneTrack70"), cluster.energyCorrectedOneTrack2(), weight); + } + if (cluster.energyCorrectedAllTracks1()) { + registry.fill(HIST("h_full_jet_neutralconstituents_energy_corr_allTracks100"), cluster.energyCorrectedAllTracks1(), weight); + } + if (cluster.energyCorrectedAllTracks2()) { + registry.fill(HIST("h_full_jet_neutralconstituents_energy_corr_allTracks70"), cluster.energyCorrectedAllTracks2(), weight); + } } - auto nef = neutralEnergy / jet.energy(); - registry.fill(HIST("h2_full_jet_nef"), jet.pt(), nef, weight); + // auto nef = neutralEnergy / jet.energy(); + // registry.fill(HIST("h2_full_jet_nef"), jet.pt(), nef, weight); + auto jetEnergy = jet.energy(); + + auto nef_uncorr = neutralEnergy_uncorr / jetEnergy; + auto nef_corr_oneTrack100 = neutralEnergy_corr_oneTrack100 / jetEnergy; + auto nef_corr_oneTrack70 = neutralEnergy_corr_oneTrack70 / jetEnergy; + auto nef_corr_allTracks100 = neutralEnergy_corr_allTracks100 / jetEnergy; + auto nef_corr_allTracks70 = neutralEnergy_corr_allTracks70 / jetEnergy; + + registry.fill(HIST("h2_full_jet_nef_uncorr"), jet.pt(), nef_uncorr, weight); + registry.fill(HIST("h2_full_jet_nef_corr_oneTrack100"), jet.pt(), nef_corr_oneTrack100, weight); + registry.fill(HIST("h2_full_jet_nef_corr_oneTrack70"), jet.pt(), nef_corr_oneTrack70, weight); + registry.fill(HIST("h2_full_jet_nef_corr_allTracks100"), jet.pt(), nef_corr_allTracks100, weight); + registry.fill(HIST("h2_full_jet_nef_corr_allTracks70"), jet.pt(), nef_corr_allTracks70, weight); for (const auto& jettrack : jet.template tracks_as()) { sumtrackE += jettrack.energy(); @@ -778,7 +867,7 @@ struct FullJetSpectra { { float neutralEnergy = 0.0; if (jet.r() == round(selectedJetsRadius * 100.0f)) { - for (const auto& cluster : jet.template clusters_as()) { + for (const auto& cluster : jet.template clusters_as()) { neutralEnergy += cluster.energy(); } auto nef = neutralEnergy / jet.energy(); @@ -864,17 +953,44 @@ struct FullJetSpectra { registry.fill(HIST("h_track_phi"), track.phi(), weight); registry.fill(HIST("h_track_energysum"), sumtrackE, weight); } - double sumclusterE = 0.0; + double sumclusterE_uncorr = 0.0; + double sumclusterE_corr_oneTrack100 = 0.0; + double sumclusterE_corr_oneTrack70 = 0.0; + double sumclusterE_corr_allTracks100 = 0.0; + double sumclusterE_corr_allTracks70 = 0.0; + for (auto const& cluster : clusters) { + double clusterpt = cluster.energy() / std::cosh(cluster.eta()); - sumclusterE += cluster.energy(); + sumclusterE_uncorr += cluster.energy(); + sumclusterE_corr_oneTrack100 += cluster.energyCorrectedOneTrack1(); + sumclusterE_corr_oneTrack70 += cluster.energyCorrectedOneTrack2(); + sumclusterE_corr_allTracks100 += cluster.energyCorrectedAllTracks1(); + sumclusterE_corr_allTracks70 += cluster.energyCorrectedAllTracks2(); + + registry.fill(HIST("h_cluster_energy_uncorr"), cluster.energy(), weight); + if (cluster.energyCorrectedOneTrack1()) { + registry.fill(HIST("h_cluster_energy_corr_oneTrack100"), cluster.energyCorrectedOneTrack1(), weight); + } + if (cluster.energyCorrectedOneTrack2()) { + registry.fill(HIST("h_cluster_energy_corr_oneTrack70"), cluster.energyCorrectedOneTrack2(), weight); + } + if (cluster.energyCorrectedAllTracks1()) { + registry.fill(HIST("h_cluster_energy_corr_allTracks100"), cluster.energyCorrectedAllTracks1(), weight); + } + if (cluster.energyCorrectedAllTracks2()) { + registry.fill(HIST("h_cluster_energy_corr_allTracks70"), cluster.energyCorrectedAllTracks2(), weight); + } registry.fill(HIST("h_clusterTime"), cluster.time(), weight); registry.fill(HIST("h_cluster_pt"), clusterpt, weight); registry.fill(HIST("h_cluster_eta"), cluster.eta(), weight); registry.fill(HIST("h_cluster_phi"), cluster.phi(), weight); - registry.fill(HIST("h_cluster_energy"), cluster.energy(), weight); - registry.fill(HIST("h_cluster_energysum"), sumclusterE, weight); + registry.fill(HIST("h_cluster_energysum_uncorr"), sumclusterE_uncorr, weight); + registry.fill(HIST("h_cluster_energysum_corr_oneTrack100"), sumclusterE_corr_oneTrack100, weight); + registry.fill(HIST("h_cluster_energysum_corr_oneTrack70"), sumclusterE_corr_oneTrack70, weight); + registry.fill(HIST("h_cluster_energysum_corr_allTracks100"), sumclusterE_corr_allTracks100, weight); + registry.fill(HIST("h_cluster_energysum_corr_allTracks70"), sumclusterE_corr_allTracks70, weight); } } @@ -952,7 +1068,8 @@ struct FullJetSpectra { } PROCESS_SWITCH(FullJetSpectra, processBCs, "BCs for 0 vertex QA", false); - void processJetsData(soa::Filtered::iterator const& collision, FullJetTableDataJoined const& jets, aod::JetTracks const&, aod::JetClusters const&) + void processJetsData(soa::Filtered::iterator const& collision, FullJetTableDataJoined const& jets, + aod::JetTracks const&, ClusterWithCorrections const&) { bool eventAccepted = false; @@ -982,7 +1099,7 @@ struct FullJetSpectra { if (!eventAccepted) { for (auto const& jet : jets) { - if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax) || !isAcceptedRecoJet(jet)) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax) || !isAcceptedRecoJet(jet)) { fillRejectedJetHistograms(jet, 1.0); } } @@ -998,7 +1115,7 @@ struct FullJetSpectra { if (jet.phi() < jetPhiMin || jet.phi() > jetPhiMax) { continue; } - if (!isAcceptedRecoJet(jet)) { + if (!isAcceptedRecoJet(jet)) { continue; } fillJetHistograms(jet); @@ -1007,7 +1124,7 @@ struct FullJetSpectra { PROCESS_SWITCH(FullJetSpectra, processJetsData, "Full Jets Data", false); void processJetsTriggeredData(soa::Filtered::iterator const& collision, FullJetTableDataJoined const& /*jets*/, - aod::JetTracks const&, aod::JetClusters const&, aod::JBCs const&) + aod::JetTracks const&, ClusterWithCorrections const&, aod::JBCs const&) { // bool eventAccepted = false; @@ -1126,7 +1243,8 @@ struct FullJetSpectra { } PROCESS_SWITCH(FullJetSpectra, processJetsTriggeredData, "Full Jets Triggered Data", false); - void processJetsMCD(soa::Filtered::iterator const& collision, JetTableMCDJoined const& jets, aod::JetTracks const&, aod::JetClusters const&) + void processJetsMCD(soa::Filtered::iterator const& collision, JetTableMCDJoined const& jets, + aod::JetTracks const&, ClusterWithCorrections const&) { bool eventAccepted = false; double weight = 1.0; @@ -1198,7 +1316,7 @@ struct FullJetSpectra { if (!eventAccepted) { for (auto const& jet : jets) { - if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax) || !isAcceptedRecoJet(jet)) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax) || !isAcceptedRecoJet(jet)) { fillRejectedJetHistograms(jet, 1.0); } } @@ -1214,7 +1332,7 @@ struct FullJetSpectra { if (jet.phi() < jetPhiMin || jet.phi() > jetPhiMax) { continue; } - if (!isAcceptedRecoJet(jet)) { + if (!isAcceptedRecoJet(jet)) { continue; } fillJetHistograms(jet); @@ -1222,7 +1340,8 @@ struct FullJetSpectra { } PROCESS_SWITCH(FullJetSpectra, processJetsMCD, "Full Jets at Detector Level", false); - void processJetsMCDWeighted(soa::Filtered::iterator const& collision, JetTableMCDWeightedJoined const& jets, aod::JMcCollisions const&, aod::JetTracks const&, aod::JetClusters const&) + void processJetsMCDWeighted(soa::Filtered::iterator const& collision, JetTableMCDWeightedJoined const& jets, aod::JMcCollisions const&, + aod::JetTracks const&, ClusterWithCorrections const&) { bool eventAccepted = false; double pTHat = 10. / (std::pow(collision.mcCollision().weight(), 1.0 / pTHatExponent)); @@ -1292,7 +1411,7 @@ struct FullJetSpectra { if (!eventAccepted) { for (auto const& jet : jets) { - if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax) || !isAcceptedRecoJet(jet)) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax) || !isAcceptedRecoJet(jet)) { fillRejectedJetHistograms(jet, collision.mcCollision().weight()); } } @@ -1308,7 +1427,7 @@ struct FullJetSpectra { if (jet.phi() < jetPhiMin || jet.phi() > jetPhiMax) { continue; } - if (!isAcceptedRecoJet(jet)) { + if (!isAcceptedRecoJet(jet)) { continue; } fillJetHistograms(jet, collision.mcCollision().weight()); @@ -1515,7 +1634,8 @@ struct FullJetSpectra { } PROCESS_SWITCH(FullJetSpectra, processJetsMCPWeighted, "Full Jets at Particle Level on weighted events", false); - void processJetsMCPMCDMatched(soa::Filtered::iterator const& collision, JetTableMCDMatchedJoined const& mcdjets, jetMcpPerMcCollision const& mcpjets, aod::JMcCollisions const&, aod::JetTracks const&, aod::JetClusters const&, aod::JetParticles const&) + void processJetsMCPMCDMatched(soa::Filtered::iterator const& collision, JetTableMCDMatchedJoined const& mcdjets, jetMcpPerMcCollision const& mcpjets, aod::JMcCollisions const&, + aod::JetTracks const&, ClusterWithCorrections const&, aod::JetParticles const&) { bool eventAccepted = false; int fakeMcdJet = 0; @@ -1600,7 +1720,7 @@ struct FullJetSpectra { registry.fill(HIST("hMatchedcollisionCounter"), 8.5); // EMCAcceptedDetColl for (const auto& mcdjet : mcdjets) { - if (!isAcceptedRecoJet(mcdjet)) { + if (!isAcceptedRecoJet(mcdjet)) { continue; } if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { @@ -1629,7 +1749,8 @@ struct FullJetSpectra { } PROCESS_SWITCH(FullJetSpectra, processJetsMCPMCDMatched, "Full Jet finder MCP matched to MCD", false); - void processJetsMCPMCDMatchedWeighted(soa::Filtered::iterator const& collision, JetTableMCDMatchedWeightedJoined const& mcdjets, JetTableMCPMatchedWeightedJoined const& mcpjets, aod::JMcCollisions const&, aod::JetTracks const&, aod::JetClusters const&, aod::JetParticles const&) + void processJetsMCPMCDMatchedWeighted(soa::Filtered::iterator const& collision, JetTableMCDMatchedWeightedJoined const& mcdjets, JetTableMCPMatchedWeightedJoined const& mcpjets, aod::JMcCollisions const&, + aod::JetTracks const&, ClusterWithCorrections const&, aod::JetParticles const&) { bool eventAccepted = false; int fakeMcdJet = 0; @@ -1720,7 +1841,7 @@ struct FullJetSpectra { registry.fill(HIST("hMatchedcollisionCounter"), 8.5, eventWeight); // EMCAcceptedDetColl for (const auto& mcdjet : mcdjets) { - if (!isAcceptedRecoJet(mcdjet)) { + if (!isAcceptedRecoJet(mcdjet)) { continue; } // Check if MCD jet is within the EMCAL fiducial region; if not then flag it as a fake jet @@ -1779,7 +1900,8 @@ struct FullJetSpectra { } PROCESS_SWITCH(FullJetSpectra, processCleanup, "Periodic cleanup", true); */ - void processDataTracks(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, soa::Filtered const& clusters) + void processDataTracks(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, + ClusterWithCorrections const& clusters) // replaced "soa::Filtered" with ClusterWithCorrections to include the hadcorr tables { bool eventAccepted = false; @@ -1830,14 +1952,13 @@ struct FullJetSpectra { if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { continue; } - // Fill Accepted events histos - fillTrackHistograms(tracks, clusters, 1.0); } + fillTrackHistograms(tracks, clusters, 1.0); registry.fill(HIST("hCollisionsUnweighted"), 7.5); // EMCAcceptedCollAfterTrackSel } PROCESS_SWITCH(FullJetSpectra, processDataTracks, "Full Jet tracks for Data", false); - void processMCTracks(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, soa::Filtered const& clusters) + void processMCTracks(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, soa::Filtered const& clusters) { bool eventAccepted = false; double weight = 1.0; @@ -1887,9 +2008,8 @@ struct FullJetSpectra { if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { continue; } - // Fill Accepted events histos - fillTrackHistograms(tracks, clusters, 1.0); } + fillTrackHistograms(tracks, clusters, 1.0); registry.fill(HIST("hCollisionsUnweighted"), 7.5); // EMCAcceptedCollAfterTrackSel } PROCESS_SWITCH(FullJetSpectra, processMCTracks, "Full Jet tracks for MC", false); @@ -1897,7 +2017,7 @@ struct FullJetSpectra { void processTracksWeighted(soa::Filtered::iterator const& collision, aod::JMcCollisions const&, soa::Filtered const& tracks, - soa::Filtered const& clusters) + soa::Filtered const& clusters) { bool eventAccepted = false; float eventWeight = collision.mcCollision().weight(); @@ -1909,11 +2029,10 @@ struct FullJetSpectra { } registry.fill(HIST("hCollisionsWeighted"), 1.5, eventWeight); // WeightedCollWithVertexZ - // for (auto const& track : tracks) { if (pTHat < pTHatAbsoluteMin) { // Track outlier rejection: should this be for every track iteration or for every collision? return; } - // } + if (doMBGapTrigger && collision.subGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) { registry.fill(HIST("hCollisionsWeighted"), 2.5, eventWeight); // MBRejectedDetEvents return; @@ -1952,14 +2071,14 @@ struct FullJetSpectra { if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { continue; } - // Fill Accepted events histos - fillTrackHistograms(tracks, clusters, eventWeight); } + fillTrackHistograms(tracks, clusters, eventWeight); registry.fill(HIST("hCollisionsWeighted"), 7.5, eventWeight); // EMCAcceptedWeightedCollAfterTrackSel } PROCESS_SWITCH(FullJetSpectra, processTracksWeighted, "Full Jet tracks weighted", false); - void processMBCollisionsDATAWithMultiplicity(soa::Filtered::iterator const& collision, FullJetTableDataJoined const& jets, aod::JetTracks const& /*tracks*/, aod::JetClusters const& /*clusters*/) + void processMBCollisionsDATAWithMultiplicity(soa::Filtered::iterator const& collision, + FullJetTableDataJoined const& jets, aod::JetTracks const& /*tracks*/, ClusterWithCorrections const& /*clusters*/) { bool eventAccepted = false; @@ -2014,7 +2133,7 @@ struct FullJetSpectra { continue; if (jet.phi() < jetPhiMin || jet.phi() > jetPhiMax) continue; - if (!isAcceptedRecoJet(jet)) + if (!isAcceptedRecoJet(jet)) continue; selectedJets.push_back(jet); @@ -2080,47 +2199,72 @@ struct FullJetSpectra { } // Calculate neutral energy fraction for this jet - float neutralEnergy = 0.0; - for (const auto& jetcluster : jet.clusters_as()) { - neutralEnergy += jetcluster.energy(); - } - float nef = neutralEnergy / jet.energy(); + // float neutralEnergy = 0.0; + double neutralEnergy_uncorr = 0.0; + double neutralEnergy_corr_oneTrack100 = 0.0; + double neutralEnergy_corr_oneTrack70 = 0.0; + double neutralEnergy_corr_allTracks100 = 0.0; + double neutralEnergy_corr_allTracks70 = 0.0; + + for (const auto& jetcluster : jet.clusters_as()) { + // Sum energies for NEF calculation for each correction mode + neutralEnergy_uncorr += jetcluster.energy(); + neutralEnergy_corr_oneTrack100 += jetcluster.energyCorrectedOneTrack1(); + neutralEnergy_corr_oneTrack70 += jetcluster.energyCorrectedOneTrack2(); + neutralEnergy_corr_allTracks100 += jetcluster.energyCorrectedAllTracks1(); + neutralEnergy_corr_allTracks70 += jetcluster.energyCorrectedAllTracks2(); + } + auto jetEnergy = jet.energy(); + + auto nef_uncorr = neutralEnergy_uncorr / jetEnergy; + auto nef_corr_oneTrack100 = neutralEnergy_corr_oneTrack100 / jetEnergy; + auto nef_corr_oneTrack70 = neutralEnergy_corr_oneTrack70 / jetEnergy; + auto nef_corr_allTracks100 = neutralEnergy_corr_allTracks100 / jetEnergy; + auto nef_corr_allTracks70 = neutralEnergy_corr_allTracks70 / jetEnergy; // CASE 1: Fill histograms for ALL selected jets registry.fill(HIST("h_all_fulljet_pt"), jetPt, 1.0); registry.fill(HIST("h_all_fulljet_Nch"), numberOfChargedParticles, 1.0); - registry.fill(HIST("h_all_fulljet_NEF"), nef, 1.0); + registry.fill(HIST("h_all_fulljet_NEF_uncorr"), nef_uncorr, 1.0); + registry.fill(HIST("h_all_fulljet_NEF_corr_oneTrack100"), nef_corr_oneTrack100, 1.0); + registry.fill(HIST("h_all_fulljet_NEF_corr_oneTrack70"), nef_corr_oneTrack70, 1.0); + registry.fill(HIST("h_all_fulljet_NEF_corr_allTracks100"), nef_corr_allTracks100, 1.0); + registry.fill(HIST("h_all_fulljet_NEF_corr_allTracks70"), nef_corr_allTracks70, 1.0); + registry.fill(HIST("h2_all_fulljet_jetpTDet_vs_FT0Mults"), jetPt, collision.multFT0M(), 1.0); registry.fill(HIST("h2_all_fulljet_jetpTDet_vs_Nch"), jetPt, numberOfChargedParticles, 1.0); - registry.fill(HIST("h3_full_jet_jetpTDet_FT0Mults_nef"), jetPt, collision.multFT0M(), nef, 1.0); + registry.fill(HIST("h3_full_jet_jetpTDet_FT0Mults_nef_uncorr"), jetPt, collision.multFT0M(), nef_uncorr, 1.0); + registry.fill(HIST("h3_full_jet_jetpTDet_FT0Mults_nef_corr_oneTrack100"), jetPt, collision.multFT0M(), nef_corr_oneTrack100, 1.0); + registry.fill(HIST("h3_full_jet_jetpTDet_FT0Mults_nef_corr_oneTrack70"), jetPt, collision.multFT0M(), nef_corr_oneTrack70, 1.0); + registry.fill(HIST("h3_full_jet_jetpTDet_FT0Mults_nef_corr_allTracks100"), jetPt, collision.multFT0M(), nef_corr_allTracks100, 1.0); + registry.fill(HIST("h3_full_jet_jetpTDet_FT0Mults_nef_corr_allTracks70"), jetPt, collision.multFT0M(), nef_corr_allTracks70, 1.0); // CASE 2: Additional leading jet processing if (isLeading) { registry.fill(HIST("h_leading_fulljet_pt"), jetPt, 1.0); registry.fill(HIST("h_leading_fulljet_Nch"), numberOfChargedParticles, 1.0); - registry.fill(HIST("h_leading_fulljet_NEF"), nef, 1.0); + registry.fill(HIST("h_leading_fulljet_NEF"), nef_uncorr, 1.0); registry.fill(HIST("h2_leading_fulljet_jetpTDet_vs_FT0Mults"), jetPt, collision.multFT0M(), 1.0); registry.fill(HIST("h2_leading_fulljet_jetpTDet_vs_Nch"), jetPt, numberOfChargedParticles, 1.0); - registry.fill(HIST("h3_leading_fulljet_jetpTDet_FT0Mults_nef"), jetPt, collision.multFT0M(), nef, 1.0); + registry.fill(HIST("h3_leading_fulljet_jetpTDet_FT0Mults_nef"), jetPt, collision.multFT0M(), nef_uncorr, 1.0); } // CASE 3: Additional first sub-leading jet processing if (isSubLeading) { registry.fill(HIST("h_subleading_fulljet_pt"), jetPt, 1.0); registry.fill(HIST("h_subleading_fulljet_Nch"), numberOfChargedParticles, 1.0); - registry.fill(HIST("h_subleading_fulljet_NEF"), nef, 1.0); + registry.fill(HIST("h_subleading_fulljet_NEF"), nef_uncorr, 1.0); registry.fill(HIST("h2_subleading_fulljet_jetpTDet_vs_FT0Mults"), jetPt, collision.multFT0M(), 1.0); registry.fill(HIST("h2_subleading_fulljet_jetpTDet_vs_Nch"), jetPt, numberOfChargedParticles, 1.0); - registry.fill(HIST("h3_subleading_fulljet_jetpTDet_FT0Mults_nef"), jetPt, collision.multFT0M(), nef, 1.0); + registry.fill(HIST("h3_subleading_fulljet_jetpTDet_FT0Mults_nef"), jetPt, collision.multFT0M(), nef_uncorr, 1.0); } } } PROCESS_SWITCH(FullJetSpectra, processMBCollisionsDATAWithMultiplicity, "MB DATA Collisions for Full Jets Multiplicity Studies", false); - void processMBMCDCollisionsWithMultiplicity(soa::Filtered::iterator const& collision, JetTableMCDJoined const& mcdjets, aod::JMcCollisions const&, aod::JetTracks const& /*tracks*/, aod::JetClusters const& /*clusters*/) + void processMBMCDCollisionsWithMultiplicity(soa::Filtered::iterator const& collision, JetTableMCDJoined const& mcdjets, aod::JMcCollisions const&, aod::JetTracks const& /*tracks*/, ClusterWithCorrections const& /*clusters*/) { bool eventAccepted = false; - // float pTHat = 10. / (std::pow(1.0, 1.0 / pTHatExponent)); registry.fill(HIST("hEventmultiplicityCounter"), 0.5); // allDetColl if (std::fabs(collision.posZ()) > vertexZCut) { @@ -2173,7 +2317,7 @@ struct FullJetSpectra { continue; if (mcdjet.phi() < jetPhiMin || mcdjet.phi() > jetPhiMax) continue; - if (!isAcceptedRecoJet(mcdjet)) + if (!isAcceptedRecoJet(mcdjet)) continue; selectedJets.push_back(mcdjet); @@ -2225,7 +2369,7 @@ struct FullJetSpectra { // Calculate neutral energy fraction for this jet float neutralEnergy = 0.0; - for (const auto& jetcluster : jet.clusters_as()) { + for (const auto& jetcluster : jet.clusters_as()) { neutralEnergy += jetcluster.energy(); } float nef = neutralEnergy / jet.energy(); @@ -2261,7 +2405,7 @@ struct FullJetSpectra { } PROCESS_SWITCH(FullJetSpectra, processMBMCDCollisionsWithMultiplicity, "MB MCD Collisions for Full Jets Multiplicity Studies", false); - void processMCDCollisionsWeightedWithMultiplicity(soa::Filtered::iterator const& collision, JetTableMCDWeightedJoined const& mcdjets, aod::JMcCollisions const&, aod::JetTracks const& tracks, aod::JetClusters const& clusters) + void processMCDCollisionsWeightedWithMultiplicity(soa::Filtered::iterator const& collision, JetTableMCDWeightedJoined const& mcdjets, aod::JMcCollisions const&, aod::JetTracks const& tracks, ClusterWithCorrections const& clusters) { bool eventAccepted = false; float eventWeight = collision.mcCollision().weight(); @@ -2334,7 +2478,7 @@ struct FullJetSpectra { if (mcdjet.phi() < jetPhiMin || mcdjet.phi() > jetPhiMax) { continue; } - if (!isAcceptedRecoJet(mcdjet)) { + if (!isAcceptedRecoJet(mcdjet)) { continue; } selectedJets.push_back(mcdjet); @@ -2354,7 +2498,6 @@ struct FullJetSpectra { // Select Leading Jet for N_ch calculation (for every leading jet that is found). There's always one leading jet per event! auto const& leadingJet = *selectedJets[0]; auto const& leadingJetPt = leadingJet.pt(); // jet pT distribution of the leading jet - // std::cout << "Leading Jet pT: " << leadingJetPt << std::endl; registry.fill(HIST("h_Leading_full_jet_pt"), leadingJetPt, eventWeight); registry.fill(HIST("h2_full_jet_leadingJetPt_vs_counts"), leadingJetPt, nJetsThisEvent, eventWeight); } @@ -2384,7 +2527,7 @@ struct FullJetSpectra { // Calculate neutral energy fraction for this jet float neutralEnergy = 0.0; - for (const auto& jetcluster : jet.clusters_as()) { + for (const auto& jetcluster : jet.clusters_as()) { neutralEnergy += jetcluster.energy(); } float nef = neutralEnergy / jet.energy(); @@ -2519,7 +2662,6 @@ struct FullJetSpectra { // Select Leading Jet for N_ch calculation (for every leading jet that is found). There's always one leading jet per event! auto const& leadingJet = *selectedJets[0]; auto const& leadingJetPt = leadingJet.pt(); // jet pT distribution of the leading jet - // std::cout << "Leading Jet pT: " << leadingJetPt << std::endl; registry.fill(HIST("h_Leading_full_jet_pt_part"), leadingJetPt, 1.0); registry.fill(HIST("h2_full_jet_leadingJetPt_vs_counts_part"), leadingJetPt, nJetsThisEvent, 1.0); } @@ -2684,7 +2826,6 @@ struct FullJetSpectra { // Select Leading Jet for N_ch calculation (for every leading jet that is found). There's always one leading jet per event! auto const& leadingJet = *selectedJets[0]; auto const& leadingJetPt = leadingJet.pt(); // jet pT distribution of the leading jet - // std::cout << "Leading Jet pT: " << leadingJetPt << std::endl; registry.fill(HIST("h_Leading_full_jet_pt_part"), leadingJetPt, mccollision.weight()); registry.fill(HIST("h2_full_jet_leadingJetPt_vs_counts_part"), leadingJetPt, nJetsThisEvent, mccollision.weight()); } From 936addb2e058455ec3b2bfcfcbfb0f8c5da85cc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= <26327373+vkucera@users.noreply.github.com> Date: Sat, 11 Oct 2025 15:43:57 +0200 Subject: [PATCH 712/986] O2 linter: Add config with warning categories (#13294) --- o2linter_config | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 o2linter_config diff --git a/o2linter_config b/o2linter_config new file mode 100644 index 00000000000..66b2d074f62 --- /dev/null +++ b/o2linter_config @@ -0,0 +1,15 @@ +# O2 linter warning categories +root/entity +external-pi +pi-multiple-fraction +doc/file +name/function-variable +name/macro +name/constexpr-constant +name/namespace +name/type +name/enum +name/class +name/struct +name/file-cpp +name/file-python From 2cfae55cd274e685e416f22c26923104f74980e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= <26327373+vkucera@users.noreply.github.com> Date: Sat, 11 Oct 2025 15:44:06 +0200 Subject: [PATCH 713/986] [Infrastructure] .clang-tidy: Fix ignore patterns for special names (#13209) --- .clang-tidy | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 490b82a880b..9519cb1cef6 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,17 +1,16 @@ CheckOptions: - - { key: CheckPathRegex, value: ".*/O2/.*" } # Naming conventions - { key: readability-identifier-naming.ClassCase, value: CamelCase } - { key: readability-identifier-naming.ClassMemberPrefix, value: m } - { key: readability-identifier-naming.ConceptCase, value: CamelCase } - { key: readability-identifier-naming.ConstexprVariableCase, value: CamelCase } - - { key: readability-identifier-naming.ConstexprVariableIgnoredRegexp, value: "^k[A-Z].*$" } # Allow "k" prefix. + - { key: readability-identifier-naming.ConstexprVariableIgnoredRegexp, value: "^k[A-Z][a-zA-Z0-9]*$" } # Allow "k" prefix. - { key: readability-identifier-naming.EnumCase, value: CamelCase } - { key: readability-identifier-naming.EnumConstantCase, value: CamelCase } - - { key: readability-identifier-naming.EnumConstantIgnoredRegexp, value: "^k[A-Z].*$" } # Allow "k" prefix. + - { key: readability-identifier-naming.EnumConstantIgnoredRegexp, value: "^k?[A-Z][a-zA-Z0-9_]*$" } # Allow "k" prefix and underscores. - { key: readability-identifier-naming.FunctionCase, value: camelBack } - { key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE } - - { key: readability-identifier-naming.MacroDefinitionIgnoredRegexp, value: "^[A-Z]+(_[A-Z]+)*_$" } # Allow the trailing underscore in header guards. + - { key: readability-identifier-naming.MacroDefinitionIgnoredRegexp, value: "^[A-Z][A-Z0-9_]*_$" } # Allow the trailing underscore in header guards. - { key: readability-identifier-naming.MemberCase, value: camelBack } - { key: readability-identifier-naming.NamespaceCase, value: lower_case } - { key: readability-identifier-naming.ParameterCase, value: camelBack } From 731aa17ebb991d062903b80793559003a5c5a734 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= <26327373+vkucera@users.noreply.github.com> Date: Sat, 11 Oct 2025 16:16:42 +0200 Subject: [PATCH 714/986] [Infrastructure] Cppcheck config: Silence false positives. Add list of C++ extensions. (#13247) --- .mega-linter.yml | 1 + cppcheck_config | 3 +++ 2 files changed, 4 insertions(+) diff --git a/.mega-linter.yml b/.mega-linter.yml index f0e21bd5c23..b9a956bd20a 100644 --- a/.mega-linter.yml +++ b/.mega-linter.yml @@ -39,5 +39,6 @@ PYTHON_PYRIGHT_CONFIG_FILE: pyproject.toml PYTHON_RUFF_CONFIG_FILE: pyproject.toml CPP_CPPLINT_FILE_EXTENSIONS: [".C", ".c", ".c++", ".cc", ".cl", ".cpp", ".cu", ".cuh", ".cxx", ".cxx.in", ".h", ".h++", ".hh", ".h.in", ".hpp", ".hxx", ".inc", ".inl", ".macro"] CPP_CLANG_FORMAT_FILE_EXTENSIONS: [".C", ".c", ".c++", ".cc", ".cl", ".cpp", ".cu", ".cuh", ".cxx", ".cxx.in", ".h", ".h++", ".hh", ".h.in", ".hpp", ".hxx", ".inc", ".inl", ".macro"] +CPP_CPPCHECK_FILE_EXTENSIONS: [".C", ".c", ".c++", ".cc", ".cl", ".cpp", ".cu", ".cuh", ".cxx", ".cxx.in", ".h", ".h++", ".hh", ".h.in", ".hpp", ".hxx", ".inc", ".inl", ".macro"] CPP_CPPCHECK_ARGUMENTS: --language=c++ --std=c++20 --check-level=exhaustive --suppressions-list=cppcheck_config REPOSITORY_GITLEAKS_PR_COMMITS_SCAN: true diff --git a/cppcheck_config b/cppcheck_config index 1ca9f8a8952..506d113f69d 100644 --- a/cppcheck_config +++ b/cppcheck_config @@ -1,2 +1,5 @@ syntaxError unknownMacro +missingIncludeSystem +missingInclude +unusedStructMember:*.h From 422df256dcac255d4a2bde67b319c46c87cebde7 Mon Sep 17 00:00:00 2001 From: arvindkhuntia <31609955+arvindkhuntia@users.noreply.github.com> Date: Sat, 11 Oct 2025 17:40:26 +0200 Subject: [PATCH 715/986] [PWGLF] [PWGMM] Separate table added for CTP info (#13321) Co-authored-by: Arvind Khuntia --- PWGMM/Lumi/Tasks/LumiFDDFT0.cxx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/PWGMM/Lumi/Tasks/LumiFDDFT0.cxx b/PWGMM/Lumi/Tasks/LumiFDDFT0.cxx index 2fe4b62f51d..50bef7a255b 100644 --- a/PWGMM/Lumi/Tasks/LumiFDDFT0.cxx +++ b/PWGMM/Lumi/Tasks/LumiFDDFT0.cxx @@ -120,6 +120,10 @@ DECLARE_SOA_TABLE(EventInfoFV0, "AOD", "EventInfoFV0", full::InputMask, full::TCMTriggerFV0, full::TimeAFV0, full::ChargeAFV0); +DECLARE_SOA_TABLE(EventInfoCTP, "AOD", "EventInfoCTP", + full::TimeStamp, full::GlobalBC, + full::InputMask); + } // namespace o2::aod struct LumiFDDFT0 { @@ -127,6 +131,7 @@ struct LumiFDDFT0 { Produces rowEventInfofdd; Produces rowEventInfoft0; Produces rowEventInfofv0; + Produces rowEventInfoCTP; Service ccdb; const char* ccdbpath_grp = "GLO/Config/GRPMagField"; const char* ccdburl = "http://alice-ccdb.cern.ch"; @@ -135,6 +140,7 @@ struct LumiFDDFT0 { Configurable fttimestamp{"fttimestamp", 1668080173000, "First time of time stamp"}; Configurable nContribMax{"nContribMax", 2500, "Maximum number of contributors"}; Configurable nContribMin{"nContribMin", 10, "Minimum number of contributors"}; + Configurable useRelTimeStamp{"useRelTimeStamp", false, "timestamp info stored as relative to fttimestamp"}; HistogramRegistry histos{ "histos", @@ -340,8 +346,19 @@ struct LumiFDDFT0 { }; PROCESS_SWITCH(LumiFDDFT0, processFull, "Process FDD", true); - void processLite(aod::FDDs const& fdds, aod::FT0s const& ft0s, aod::FV0As const& fv0s, aod::BCsWithTimestamps const&) + void processLite(aod::FDDs const& fdds, aod::FT0s const& ft0s, aod::FV0As const& fv0s, aod::BCsWithTimestamps const& bcs) { + // table to store CTP input mask, globalBC and timestamp + for (const auto& bc : bcs) { + if (!bc.timestamp()) + continue; + if (useRelTimeStamp) { + Long64_t relTS = bc.timestamp() - fttimestamp; + rowEventInfoCTP(relTS, bc.globalBC(), bc.inputMask()); + } else { + rowEventInfoCTP(bc.timestamp(), bc.globalBC(), bc.inputMask()); + } + } // Scan over the FDD table and store charge and time along with globalBC for (auto& fdd : fdds) { From a1a74aab9c6555619790b85b3a8580c426359900 Mon Sep 17 00:00:00 2001 From: abmodak <67369858+abmodak@users.noreply.github.com> Date: Sat, 11 Oct 2025 18:46:36 +0200 Subject: [PATCH 716/986] [PWGCF] Remove tableproducer of multiplicity classifier (#13345) --- .../Tasks/longrangeCorrelation.cxx | 214 +++++++++--------- 1 file changed, 102 insertions(+), 112 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx index 7f01edb08b7..e17a88c1cab 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx @@ -104,17 +104,6 @@ auto static constexpr kMinFt0cCell = 96; auto static constexpr kMinCharge = 3.f; AxisSpec axisEvent{10, 0.5, 9.5, "#Event", "EventAxis"}; -namespace o2::aod -{ -namespace longrangemultclass -{ -DECLARE_SOA_COLUMN(Multiplicity, multiplicity, float); //! Centrality/multiplicity value -} // namespace longrangemultclass -DECLARE_SOA_TABLE(LRMultTables, "AOD", "LRMULTTABLE", longrangemultclass::Multiplicity); //! Transient multiplicity table - -using LRMultTable = LRMultTables::iterator; -} // namespace o2::aod - struct LongrangeCorrelation { struct : ConfigurableGroup { @@ -159,8 +148,8 @@ struct LongrangeCorrelation { ConfigurableAxis axisDeltaEta{"axisDeltaEta", {40, -6, -2}, "delta eta axis for histograms"}; ConfigurableAxis axisPtTrigger{"axisPtTrigger", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 10.0}, "pt trigger axis for histograms"}; ConfigurableAxis axisPtAssoc{"axisPtAssoc", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 10.0}, "pt associated axis for histograms"}; - ConfigurableAxis axisMultME{"axisMultME", {VARIABLE_WIDTH, 0, 5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 80, 100}, "Mixing bins - multiplicity"}; - ConfigurableAxis axisVtxZME{"axisVtxZME", {VARIABLE_WIDTH, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, "Mixing bins - z-vertex"}; + ConfigurableAxis axisMultME{"axisMultME", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 1000}, "Mixing bins - multiplicity"}; + ConfigurableAxis axisVtxZME{"axisVtxZME", {VARIABLE_WIDTH, -10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10}, "Mixing bins - z-vertex"}; ConfigurableAxis axisVertexEfficiency{"axisVertexEfficiency", {10, -10, 10}, "vertex axis for efficiency histograms"}; ConfigurableAxis axisEtaEfficiency{"axisEtaEfficiency", {20, -1.0, 1.0}, "eta axis for efficiency histograms"}; ConfigurableAxis axisPtEfficiency{"axisPtEfficiency", {VARIABLE_WIDTH, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 2.75, 3.0, 3.25, 3.5, 3.75, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0}, "pt axis for efficiency histograms"}; @@ -169,14 +158,20 @@ struct LongrangeCorrelation { ConfigurableAxis axisEtaTrig{"axisEtaTrig", {40, -1., 1.}, "#eta trig axis"}; ConfigurableAxis axisEtaAssoc{"axisEtaAssoc", {96, 3.5, 4.9}, "#eta assoc axis"}; ConfigurableAxis axisSample{"axisSample", {cfgSampleSize, 0, cfgSampleSize}, "sample axis for histograms"}; - ConfigurableAxis axisMultiplicity{"axisMultiplicity", {VARIABLE_WIDTH, 0, 5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 80, 100}, "multiplicity / centrality axis for histograms"}; + ConfigurableAxis axisMultiplicity{"axisMultiplicity", {VARIABLE_WIDTH, 0, 10, 15, 25, 50, 60, 1000}, "multiplicity / centrality axis for histograms"}; ConfigurableAxis amplitudeFt0a{"amplitudeFt0a", {5000, 0, 10000}, "FT0A amplitude"}; ConfigurableAxis channelFt0aAxis{"channelFt0aAxis", {96, 0.0, 96.0}, "FT0A channel"}; - using CollTable = soa::Join; + Configurable isApplyCentFT0C{"isApplyCentFT0C", true, "Centrality based on FT0C"}; + Configurable isApplyCentFV0A{"isApplyCentFV0A", false, "Centrality based on FV0A"}; + Configurable isApplyCentFT0M{"isApplyCentFT0M", false, "Centrality based on FT0A + FT0C"}; + Configurable isUseCentEst{"isUseCentEst", false, "Centrality based classification"}; + Configurable cfgPtCutMult{"cfgPtCutMult", 3.0f, "maximum track pT for multiplicity classification"}; + + using CollTable = soa::Join; using TrksTable = soa::Filtered>; using MftTrkTable = soa::Filtered; - using CollTableMC = soa::SmallGroups>; + using CollTableMC = soa::SmallGroups>; using TrksTableMC = soa::Filtered>; Preslice perColGlobal = aod::track::collisionId; Preslice perColMC = aod::track::collisionId; @@ -394,6 +389,35 @@ struct LongrangeCorrelation { } } + template + int countNTracks(countTrk const& tracks) + { + auto nTrk = 0; + for (const auto& track : tracks) { + if (track.pt() < cfgPtCutMin || track.pt() > cfgPtCutMult) { + continue; + } + nTrk++; + } + return nTrk; + } + + template + float selColCent(CheckColCent const& col) + { + auto cent = -1; + if (isApplyCentFT0C) { + cent = col.centFT0C(); + } + if (isApplyCentFV0A) { + cent = col.centFV0A(); + } + if (isApplyCentFT0M) { + cent = col.centFT0M(); + } + return cent; + } + void loadEffCorrection(uint64_t timestamp) { if (fLoadTrkEffCorr) { @@ -785,7 +809,11 @@ struct LongrangeCorrelation { loadMultCorrection(bc.timestamp()); fillYieldTpc(tracks); const auto& ft0 = col.foundFT0(); - auto multiplicity = col.multiplicity(); + auto multiplicity = 1.0f; + if (isUseCentEst) + multiplicity = selColCent(col); + else + multiplicity = countNTracks(tracks); float multw = getMultEffCorr(multiplicity); if (isUseEffCorr) multiplicity = multiplicity * multw; @@ -807,7 +835,11 @@ struct LongrangeCorrelation { loadMultCorrection(bc.timestamp()); fillYieldTpc(tracks); const auto& ft0 = col.foundFT0(); - auto multiplicity = col.multiplicity(); + auto multiplicity = 1.0f; + if (isUseCentEst) + multiplicity = selColCent(col); + else + multiplicity = countNTracks(tracks); float multw = getMultEffCorr(multiplicity); if (isUseEffCorr) multiplicity = multiplicity * multw; @@ -827,7 +859,11 @@ struct LongrangeCorrelation { loadEffCorrection(bc.timestamp()); loadMultCorrection(bc.timestamp()); fillYieldTpc(tracks); - auto multiplicity = col.multiplicity(); + auto multiplicity = 1.0f; + if (isUseCentEst) + multiplicity = selColCent(col); + else + multiplicity = countNTracks(tracks); float multw = getMultEffCorr(multiplicity); if (isUseEffCorr) multiplicity = multiplicity * multw; @@ -837,7 +873,7 @@ struct LongrangeCorrelation { fillCorrMftGlobal(sameMftGlobal, tracks, mfttracks, false, col.posZ(), multiplicity); } // same event - void processFt0aMftSE(CollTable::iterator const& col, aod::FT0s const&, MftTrkTable const& mfttracks, aod::BCsWithTimestamps const&) + void processFt0aMftSE(CollTable::iterator const& col, aod::FT0s const&, MftTrkTable const& mfttracks, TrksTable const& tracks, aod::BCsWithTimestamps const&) { if (!isEventSelected(col)) { return; @@ -847,7 +883,11 @@ struct LongrangeCorrelation { auto bc = col.bc_as(); loadMultCorrection(bc.timestamp()); const auto& ft0 = col.foundFT0(); - auto multiplicity = col.multiplicity(); + auto multiplicity = 1.0f; + if (isUseCentEst) + multiplicity = selColCent(col); + else + multiplicity = countNTracks(tracks); float multw = getMultEffCorr(multiplicity); if (isUseEffCorr) multiplicity = multiplicity * multw; @@ -858,17 +898,21 @@ struct LongrangeCorrelation { } } // same event - void processFt0aFt0cSE(CollTable::iterator const& col, aod::FT0s const&, aod::BCsWithTimestamps const&) + void processFt0aFt0cSE(CollTable::iterator const& col, aod::FT0s const&, TrksTable const& tracks, aod::BCsWithTimestamps const&) { if (!isEventSelected(col)) { return; } if (col.has_foundFT0()) { auto bc = col.bc_as(); + const auto& ft0 = col.foundFT0(); loadMultCorrection(bc.timestamp()); - auto multiplicity = col.multiplicity(); + auto multiplicity = 1.0f; + if (isUseCentEst) + multiplicity = selColCent(col); + else + multiplicity = countNTracks(tracks); histos.fill(HIST("Ft0aFt0c/SE/hMult"), multiplicity); - const auto& ft0 = col.foundFT0(); float multw = getMultEffCorr(multiplicity); if (isUseEffCorr) multiplicity = multiplicity * multw; @@ -902,7 +946,11 @@ struct LongrangeCorrelation { auto slicedTriggerTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); fillYieldTpc(slicedTriggerTracks); const auto& ft0 = col2.foundFT0(); - auto multiplicity = col1.multiplicity(); + auto multiplicity = 1.0f; + if (isUseCentEst) + multiplicity = selColCent(col1); + else + multiplicity = countNTracks(slicedTriggerTracks); float multw = getMultEffCorr(multiplicity); if (isUseEffCorr) multiplicity = multiplicity * multw; @@ -937,7 +985,11 @@ struct LongrangeCorrelation { auto slicedTriggerTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); fillYieldTpc(slicedTriggerTracks); const auto& ft0 = col2.foundFT0(); - auto multiplicity = col1.multiplicity(); + auto multiplicity = 1.0f; + if (isUseCentEst) + multiplicity = selColCent(col1); + else + multiplicity = countNTracks(slicedTriggerTracks); float multw = getMultEffCorr(multiplicity); if (isUseEffCorr) multiplicity = multiplicity * multw; @@ -967,7 +1019,11 @@ struct LongrangeCorrelation { auto bc = col1.bc_as(); loadEffCorrection(bc.timestamp()); loadMultCorrection(bc.timestamp()); - auto multiplicity = col1.multiplicity(); + auto multiplicity = 1.0f; + if (isUseCentEst) + multiplicity = selColCent(col1); + else + multiplicity = countNTracks(tracks1); float multw = getMultEffCorr(multiplicity); if (isUseEffCorr) multiplicity = multiplicity * multw; @@ -998,9 +1054,14 @@ struct LongrangeCorrelation { auto bc = col1.bc_as(); loadMultCorrection(bc.timestamp()); auto slicedTriggerMftTracks = mfttracks.sliceBy(perColMft, col1.globalIndex()); + auto slicedTriggerTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); fillYieldMft(slicedTriggerMftTracks); const auto& ft0 = col2.foundFT0(); - auto multiplicity = col1.multiplicity(); + auto multiplicity = 1.0f; + if (isUseCentEst) + multiplicity = selColCent(col1); + else + multiplicity = countNTracks(slicedTriggerTracks); float multw = getMultEffCorr(multiplicity); if (isUseEffCorr) multiplicity = multiplicity * multw; @@ -1031,7 +1092,12 @@ struct LongrangeCorrelation { if (col1.has_foundFT0() && col2.has_foundFT0()) { auto bc = col1.bc_as(); loadMultCorrection(bc.timestamp()); - auto multiplicity = col1.multiplicity(); + auto slicedTriggerTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); + auto multiplicity = 1.0f; + if (isUseCentEst) + multiplicity = selColCent(col1); + else + multiplicity = countNTracks(slicedTriggerTracks); histos.fill(HIST("Ft0aFt0c/ME/hMult"), multiplicity); const auto& ft0a = col1.foundFT0(); const auto& ft0c = col2.foundFT0(); @@ -1085,7 +1151,12 @@ struct LongrangeCorrelation { } else { numcontributors = RecCol.numContrib(); } - multiplicity = RecCol.multiplicity(); + if (isUseCentEst) + multiplicity = selColCent(RecCol); + else { + auto recTracksPart = RecTracks.sliceBy(perColMC, RecCol.globalIndex()); + multiplicity = countNTracks(recTracksPart); + } } for (const auto& particle : GenParticles) { @@ -1128,89 +1199,8 @@ struct LongrangeCorrelation { PROCESS_SWITCH(LongrangeCorrelation, processEff, "Estimate efficiency", false); }; -struct MultiplicityClassifier { - Produces multvalue; - Configurable cfgEtaCut{"cfgEtaCut", 0.8f, "Eta range to consider"}; - Configurable dcaZ{"dcaZ", 0.2f, "Custom DCA Z cut (ignored if negative)"}; - Configurable cfgPtCutMin{"cfgPtCutMin", 0.2f, "minimum accepted track pT"}; - Configurable cfgPtCutMax{"cfgPtCutMax", 3.0f, "maximum accepted track pT"}; - HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - - Filter fTrackSelectionITS = ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) && - ncheckbit(aod::track::trackCutFlag, TrackSelectionIts); - Filter fTrackSelectionTPC = ifnode(ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC), - ncheckbit(aod::track::trackCutFlag, TrackSelectionTpc), true); - Filter fTrackSelectionDCA = ifnode(dcaZ.node() > 0.f, nabs(aod::track::dcaZ) <= dcaZ && ncheckbit(aod::track::trackCutFlag, TrackSelectionDcaxyOnly), - ncheckbit(aod::track::trackCutFlag, TrackSelectionDca)); - Filter fTracksEta = nabs(aod::track::eta) < cfgEtaCut; - Filter fTracksPt = (aod::track::pt > cfgPtCutMin) && (aod::track::pt < cfgPtCutMax); - - void init(InitContext const&) - { - int enabledFunctions = 0; - if (doprocessTracks) { - histos.add("htrackPt", "htrackPt", {HistType::kTH1F, {{10, 0., 10.}}}); - histos.add("htrackMult", "htrackMult", {HistType::kTH1F, {{500, 0., 500.}}}); - enabledFunctions++; - } - if (doprocessFT0C) { - histos.add("hCentFt0c", "hCentFt0c", {HistType::kTH1F, {{100, 0., 100.}}}); - enabledFunctions++; - } - if (doprocessFV0A) { - histos.add("hCentFv0a", "hCentFv0a", {HistType::kTH1F, {{100, 0., 100.}}}); - enabledFunctions++; - } - if (doprocessFT0M) { - histos.add("hCentFt0m", "hCentFt0m", {HistType::kTH1F, {{100, 0., 100.}}}); - enabledFunctions++; - } - if (enabledFunctions != 1) { - LOGP(fatal, "{} multiplicity classifier enabled but we need exactly 1.", enabledFunctions); - } - } - - void processTracks(aod::Collision const&, soa::Filtered> const& tracks) - { - multvalue(tracks.size()); - histos.fill(HIST("htrackMult"), tracks.size()); - for (auto const& iTrk : tracks) - histos.fill(HIST("htrackPt"), iTrk.pt()); - } - - void processFT0C(aod::CentFT0Cs const& centralities) - { - for (auto const& c : centralities) { - multvalue(c.centFT0C()); - histos.fill(HIST("hCentFt0c"), c.centFT0C()); - } - } - - void processFV0A(aod::CentFV0As const& centralities) - { - for (auto const& c : centralities) { - multvalue(c.centFV0A()); - histos.fill(HIST("hCentFv0a"), c.centFV0A()); - } - } - - void processFT0M(aod::CentFT0Ms const& centralities) - { - for (auto const& c : centralities) { - multvalue(c.centFT0M()); - histos.fill(HIST("hCentFt0m"), c.centFT0M()); - } - } - - PROCESS_SWITCH(MultiplicityClassifier, processTracks, "Select track count as multiplicity", false); - PROCESS_SWITCH(MultiplicityClassifier, processFT0C, "Select FT0C centrality as multiplicity", false); - PROCESS_SWITCH(MultiplicityClassifier, processFV0A, "Select FV0A centrality as multiplicity", false); - PROCESS_SWITCH(MultiplicityClassifier, processFT0M, "Select FT0M centrality as multiplicity", false); -}; - WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(cfgc)}; } From ec19fdc8c85a72ce83696993f60ea9e260cf85ef Mon Sep 17 00:00:00 2001 From: dajones2 <140733426+dajones2@users.noreply.github.com> Date: Sat, 11 Oct 2025 19:38:58 +0100 Subject: [PATCH 717/986] [PWGJE] Adding matched track histograms (#13312) --- PWGJE/Tasks/jetHadronRecoil.cxx | 164 ++++++++++++++++++++++++++++++-- 1 file changed, 156 insertions(+), 8 deletions(-) diff --git a/PWGJE/Tasks/jetHadronRecoil.cxx b/PWGJE/Tasks/jetHadronRecoil.cxx index 0536eadd0da..7624859900b 100644 --- a/PWGJE/Tasks/jetHadronRecoil.cxx +++ b/PWGJE/Tasks/jetHadronRecoil.cxx @@ -182,6 +182,8 @@ struct JetHadronRecoil { registry.add("hDeltaRpTReference", "jet p_{T} vs #DeltaR;p_{T,jet};#DeltaR", {HistType::kTH2F, {{500, -100, 400}, dRAxis}}, doSumw); registry.add("hDeltaRpTDPhiReference", "jet p_{T} vs #DeltaR vs #Delta#phi;p_{T,jet};#Delta#phi;#DeltaR", {HistType::kTH3F, {{500, -100, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis}}, doSumw); registry.add("hDeltaRpTDPhiReferenceShifts", "testing shifts;p_{T,jet};#Delta#phi;#DeltaR;shifts", {HistType::kTHnSparseD, {{500, -100, 400}, {100, 0, o2::constants::math::TwoPI}, dRAxis, {20, 0.0, 2.0}}}, doSumw); + registry.add("hPtTrackMatched", "Track p_{T};p_{T};entries", {HistType::kTH1F, {{200, 0, 200}}}, doSumw); + registry.add("hPtTrackMatchedToCollisions", "Track p_{T};p_{T};entries", {HistType::kTH1F, {{200, 0, 200}}}, doSumw); } if (doprocessMCP || doprocessMCPWeighted || doprocessMCPWeightedWithMatchedTracks) { @@ -265,7 +267,149 @@ struct JetHadronRecoil { registry.fill(HIST("hTrack3D"), track.pt(), track.eta(), track.phi(), weight); registry.fill(HIST("hPtTrackPtHard"), track.pt() / pTHat, track.pt(), weight); } + if (nTT > 0) { + trigNumber = rand->Integer(nTT); + phiTT = phiTTAr[trigNumber]; + ptTT = ptTTAr[trigNumber]; + if (isSigCol) { + registry.fill(HIST("hNtrig"), 1.5, weight); + registry.fill(HIST("hSigEventTriggers"), nTT, weight); + registry.fill(HIST("hRhoSignal"), rho, weight); + registry.fill(HIST("hSignalTriggersPtHard"), ptTT / pTHat, weight); + } + if (!isSigCol) { + registry.fill(HIST("hNtrig"), 0.5, weight); + registry.fill(HIST("hRefEventTriggers"), nTT, weight); + registry.fill(HIST("hRhoReference"), rhoReference, weight); + for (double shift = 0.0; shift <= 2.0; shift += 0.1) { + registry.fill(HIST("hRhoReferenceShift"), rho + shift, shift, weight); + } + registry.fill(HIST("hReferenceTriggersPtHard"), ptTT / pTHat, weight); + } + } + for (const auto& jet : jets) { + if (jet.pt() > leadingJetPt) { + leadingJetPt = jet.pt(); + } + if (jet.pt() > pTHatMaxMCD * pTHat) { + if (outlierRejectEvent) { + return; + } else { + continue; + } + } + for (const auto& constituent : jet.template tracks_as()) { + if (constituent.pt() > leadingPT) { + leadingPT = constituent.pt(); + } + registry.fill(HIST("hConstituents3D"), constituent.pt(), constituent.eta(), constituent.phi()); + } + if (leadingPT > maxLeadingTrackPt) { + continue; + } + registry.fill(HIST("hJetPt"), jet.pt() - (rho * jet.area()), weight); + registry.fill(HIST("hJetEta"), jet.eta(), weight); + registry.fill(HIST("hJetPhi"), jet.phi(), weight); + registry.fill(HIST("hJet3D"), jet.pt() - (rho * jet.area()), jet.eta(), jet.phi(), weight); + if (nTT > 0) { + float dphi = RecoDecay::constrainAngle(jet.phi() - phiTT); + double dR = getWTAaxisDifference(jet, tracks); + if (isSigCol) { + if (std::abs(dphi - o2::constants::math::PI) < 0.6) { + registry.fill(HIST("hDeltaRpTSignal"), jet.pt() - (rho * jet.area()), dR, weight); + registry.fill(HIST("hDeltaRSignal"), dR, weight); + } + registry.fill(HIST("hDeltaRpTDPhiSignal"), jet.pt() - (rho * jet.area()), dphi, dR, weight); + registry.fill(HIST("hSignalPtDPhi"), dphi, jet.pt() - (rho * jet.area()), weight); + if (std::abs(dphi - o2::constants::math::PI) < 0.6) { + registry.fill(HIST("hSignalPt"), jet.pt() - (rho * jet.area()), weight); + registry.fill(HIST("hSignalPtHard"), jet.pt() - (rho * jet.area()), ptTT / pTHat, weight); + } + } + if (!isSigCol) { + if (std::abs(dphi - o2::constants::math::PI) < 0.6) { + registry.fill(HIST("hDeltaRpTReference"), jet.pt() - (rhoReference * jet.area()), dR, weight); + registry.fill(HIST("hDeltaRReference"), dR, weight); + } + registry.fill(HIST("hDeltaRpTDPhiReference"), jet.pt() - (rhoReference * jet.area()), dphi, dR, weight); + for (double shift = 0.0; shift <= 2.0; shift += 0.1) { + registry.fill(HIST("hDeltaRpTDPhiReferenceShifts"), jet.pt() - ((rho + shift) * jet.area()), dphi, dR, shift, weight); + } + registry.fill(HIST("hReferencePtDPhi"), dphi, jet.pt() - (rhoReference * jet.area()), weight); + for (double shift = 0.0; shift <= 2.0; shift += 0.1) { + registry.fill(HIST("hReferencePtDPhiShifts"), dphi, jet.pt() - ((rho + shift) * jet.area()), shift, weight); + } + if (std::abs(dphi - o2::constants::math::PI) < 0.6) { + registry.fill(HIST("hReferencePt"), jet.pt() - (rhoReference * jet.area()), weight); + registry.fill(HIST("hReferencePtHard"), jet.pt() - (rhoReference * jet.area()), ptTT / pTHat, weight); + } + } + } + } + registry.fill(HIST("hTracksvsJets"), leadingTrackPt, leadingJetPt, pTHat, weight); + } + + template + void fillHistogramsMCD(T const& jets, U const& tracks, P const&, float weight = 1.0, float rho = 0.0, float pTHat = 999.0) + { + bool isSigCol; + std::vector phiTTAr; + std::vector ptTTAr; + double phiTT = 0; + double ptTT = 0; + int trigNumber = 0; + int nTT = 0; + double leadingPT = 0; + double leadingTrackPt = 0; + double leadingJetPt = 0; + float rhoReference = rho + rhoReferenceShift; + + float dice = rand->Rndm(); + if (dice < fracSig) + isSigCol = true; + else + isSigCol = false; + + for (const auto& track : tracks) { + if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { + continue; + } + if (track.pt() > leadingTrackPt) { + leadingTrackPt = track.pt(); + } + if (track.pt() > pTHatTrackMaxMCD * pTHat) { + if (outlierRejectEvent) { + return; + } else { + continue; + } + } + if (isSigCol && track.pt() < ptTTsigMax && track.pt() > ptTTsigMin) { + phiTTAr.push_back(track.phi()); + ptTTAr.push_back(track.pt()); + registry.fill(HIST("hSignalTriggers"), track.pt(), weight); + nTT++; + } + if (!isSigCol && track.pt() < ptTTrefMax && track.pt() > ptTTrefMin) { + phiTTAr.push_back(track.phi()); + ptTTAr.push_back(track.pt()); + registry.fill(HIST("hReferenceTriggers"), track.pt(), weight); + nTT++; + } + registry.fill(HIST("hPtTrack"), track.pt(), weight); + registry.fill(HIST("hEtaTrack"), track.eta(), weight); + registry.fill(HIST("hPhiTrack"), track.phi(), weight); + registry.fill(HIST("hTrack3D"), track.pt(), track.eta(), track.phi(), weight); + registry.fill(HIST("hPtTrackPtHard"), track.pt() / pTHat, track.pt(), weight); + if (track.has_mcParticle()) { + registry.fill(HIST("hPtTrackMatched"), track.pt(), weight); + auto particle = track.template mcParticle_as

(); + if (track.collisionId() == particle.mcCollisionId()) { + registry.fill(HIST("hPtTrackMatchedToCollisions"), track.pt(), weight); + } + } + } if (nTT > 0) { trigNumber = rand->Integer(nTT); phiTT = phiTTAr[trigNumber]; @@ -765,7 +909,8 @@ struct JetHadronRecoil { void processMCD(soa::Filtered>::iterator const& collision, aod::JMcCollisions const&, soa::Filtered> const& jets, - soa::Filtered const& tracks) + soa::Filtered const& tracks, + soa::Filtered const& particles) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { return; @@ -783,14 +928,15 @@ struct JetHadronRecoil { return; } registry.fill(HIST("hZvtxSelected"), collision.posZ()); - fillHistograms(jets, tracks, 1.0, 0.0, collision.mcCollision().ptHard()); + fillHistogramsMCD(jets, tracks, particles, 1.0, 0.0, collision.mcCollision().ptHard()); } PROCESS_SWITCH(JetHadronRecoil, processMCD, "process MC detector level", false); void processMCDWithRhoSubtraction(soa::Filtered>::iterator const& collision, aod::JMcCollisions const&, soa::Filtered> const& jets, - soa::Filtered const& tracks) + soa::Filtered const& tracks, + soa::Filtered const& particles) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { return; @@ -808,14 +954,15 @@ struct JetHadronRecoil { return; } registry.fill(HIST("hZvtxSelected"), collision.posZ()); - fillHistograms(jets, tracks, 1.0, collision.rho(), collision.mcCollision().ptHard()); + fillHistogramsMCD(jets, tracks, particles, 1.0, collision.rho(), collision.mcCollision().ptHard()); } PROCESS_SWITCH(JetHadronRecoil, processMCDWithRhoSubtraction, "process MC detector level with rho subtraction", false); void processMCDWeighted(soa::Filtered>::iterator const& collision, aod::JMcCollisions const&, soa::Filtered> const& jets, - soa::Filtered const& tracks) + soa::Filtered const& tracks, + soa::Filtered const& particles) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { return; @@ -833,14 +980,15 @@ struct JetHadronRecoil { return; } registry.fill(HIST("hZvtxSelected"), collision.posZ(), collision.mcCollision().weight()); - fillHistograms(jets, tracks, collision.mcCollision().weight(), 0.0, collision.mcCollision().ptHard()); + fillHistogramsMCD(jets, tracks, particles, collision.mcCollision().weight(), 0.0, collision.mcCollision().ptHard()); } PROCESS_SWITCH(JetHadronRecoil, processMCDWeighted, "process MC detector level with event weights", false); void processMCDWeightedWithRhoSubtraction(soa::Filtered>::iterator const& collision, aod::JMcCollisions const&, soa::Filtered> const& jets, - soa::Filtered const& tracks) + soa::Filtered const& tracks, + soa::Filtered const& particles) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { return; @@ -858,7 +1006,7 @@ struct JetHadronRecoil { return; } registry.fill(HIST("hZvtxSelected"), collision.posZ(), collision.mcCollision().weight()); - fillHistograms(jets, tracks, collision.mcCollision().weight(), collision.rho(), collision.mcCollision().ptHard()); + fillHistogramsMCD(jets, tracks, particles, collision.mcCollision().weight(), collision.rho(), collision.mcCollision().ptHard()); } PROCESS_SWITCH(JetHadronRecoil, processMCDWeightedWithRhoSubtraction, "process MC detector level with event weights and rho subtraction", false); From f0e998d2d776175cf2d16cd62731d48a8532b9fc Mon Sep 17 00:00:00 2001 From: hernasab Date: Sat, 11 Oct 2025 16:06:36 -0500 Subject: [PATCH 718/986] [PWGCF] added tdc cuts and removed obsolete variables (#13339) Co-authored-by: Sabrina Hernandez --- PWGCF/Flow/Tasks/flowZdcTask.cxx | 259 ++++++++++++++++++------------- 1 file changed, 152 insertions(+), 107 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowZdcTask.cxx b/PWGCF/Flow/Tasks/flowZdcTask.cxx index 4bd2d179a1a..3c9c85c1d0f 100644 --- a/PWGCF/Flow/Tasks/flowZdcTask.cxx +++ b/PWGCF/Flow/Tasks/flowZdcTask.cxx @@ -15,11 +15,9 @@ /// \brief task to evaluate flow and neutron skin with information from ZDC #include "Common/CCDB/EventSelectionParams.h" -#include "Common/CCDB/TriggerAliases.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" #include "CommonConstants/MathConstants.h" @@ -39,7 +37,6 @@ #include #include -#include #include #include @@ -56,12 +53,12 @@ struct FlowZdcTask { SliceCache cache; O2_DEFINE_CONFIGURABLE(cfgCutVertex, float, 10.0f, "Accepted z-vertex range") - Configurable eventSelection{"eventSelection", 1, "event selection"}; Configurable maxZp{"maxZp", 125.5, "Max ZP signal"}; Configurable maxZem{"maxZem", 3099.5, "Max ZEM signal"}; // for ZDC info and analysis Configurable nBinsAmp{"nBinsAmp", 1025, "nbinsAmp"}; + Configurable nBinsADC{"nBinsADC", 1000, "nbinsADC"}; Configurable nBinsCent{"nBinsCent", 90, "nBinsCent"}; Configurable maxZn{"maxZn", 125.5, "Max ZN signal"}; // configs for process QA @@ -75,8 +72,10 @@ struct FlowZdcTask { Configurable minNch{"minNch", 0, "Min Nch (|eta|<0.8)"}; Configurable maxNch{"maxNch", 2500, "Max Nch (|eta|<0.8)"}; Configurable nBinsTDC{"nBinsTDC", 150, "nbinsTDC"}; - Configurable minTdc{"minTdc", -15.0, "minimum TDC"}; - Configurable maxTdc{"maxTdc", 15.0, "maximum TDC"}; + Configurable minTdcZn{"minTdcZn", -4.0, "minimum TDC for ZN"}; + Configurable maxTdcZn{"maxTdcZn", -4.0, "maximum TDC for ZN"}; + Configurable minTdcZp{"minTdcZp", -4.0, "minimum TDC for ZP"}; + Configurable maxTdcZp{"maxTdcZp", -4.0, "maximum TDC for ZP"}; Configurable cfgCollisionEnergy{"cfgCollisionEnergy", 2.68, "cfgCollisionEnergy"}; // event selection Configurable isNoCollInTimeRangeStrict{"isNoCollInTimeRangeStrict", true, "isNoCollInTimeRangeStrict?"}; @@ -121,7 +120,6 @@ struct FlowZdcTask { Partition tracksIUWithTPC = (aod::track::tpcNClsFindable > (uint8_t)0); using TracksSel = soa::Join; using BCsRun3 = soa::Join; - using AodZDCs = soa::Join; using CollisionDataTable = soa::Join; using TrackDataTable = soa::Join; using FilTrackDataTable = soa::Filtered; @@ -169,7 +167,6 @@ struct FlowZdcTask { const AxisSpec axisZpos{48, -12., 12., "Vtx_{z} (cm)"}; const AxisSpec axisEta{40, -1., +1., "#eta"}; const AxisSpec axisPt{binsPt, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec axisVtxZ{40, -20, 20, "Vertex Z", "VzAxis"}; // create histograms @@ -241,24 +238,24 @@ struct FlowZdcTask { } if (doprocessQA) { - histos.add("ZNVsFT0A", ";T0A (#times 1/100);ZNA+ZNC Sector Energy;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZn}}}); - histos.add("ZNVsFT0C", ";T0C (#times 1/100);ZNA+ZNC Sector Energy;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZn}}}); - histos.add("ZNVsFT0M", ";T0A+T0C (#times 1/100);ZNA+ZNC Sector Energy;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0M}, {nBinsZDC, -0.5, maxZn}}}); - histos.add("ZPVsFT0A", ";T0A (#times 1/100);ZPA+ZPC Sector Energy;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZp}}}); - histos.add("ZPVsFT0C", ";T0C (#times 1/100);ZPA+ZPC Sector Energy;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZp}}}); - histos.add("ZPVsFT0M", ";T0A+T0C (#times 1/100);ZPA+ZPC Sector Energy;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0M}, {nBinsZDC, -0.5, maxZp}}}); - histos.add("ZNAVsFT0A", ";T0A (#times 1/100);ZNA Sector;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZn}}}); - histos.add("ZNAVsFT0C", ";T0C (#times 1/100);ZNA Sector;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZn}}}); - histos.add("ZNAVsFT0M", ";T0A+T0C (#times 1/100);ZNA Sector;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0M}, {nBinsZDC, -0.5, maxZn}}}); - histos.add("ZNCVsFT0A", ";T0A (#times 1/100);ZNC Sector;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZn}}}); - histos.add("ZNCVsFT0C", ";T0C (#times 1/100);ZNC Sector;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZn}}}); - histos.add("ZNCVsFT0M", ";T0A+T0C (#times 1/100);ZNC Sector;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0M}, {nBinsZDC, -0.5, maxZn}}}); - histos.add("ZPAVsFT0A", ";T0A (#times 1/100);ZPA Sector;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZp}}}); - histos.add("ZPAVsFT0C", ";T0C (#times 1/100);ZPA Sector;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZp}}}); - histos.add("ZPAVsFT0M", ";T0A+T0C (#times 1/100);ZPA Sector;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0M}, {nBinsZDC, -0.5, maxZp}}}); - histos.add("ZPCVsFT0A", ";T0A (#times 1/100);ZPC Sector;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZp}}}); - histos.add("ZPCVsFT0C", ";T0C (#times 1/100);ZPC Sector;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZp}}}); - histos.add("ZPCVsFT0M", ";T0A+T0C (#times 1/100);ZPC Sector;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0M}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("ZNVsFT0A", ";T0A (#times 1/100);ZNA+ZNC Amplitude;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZNVsFT0C", ";T0C (#times 1/100);ZNA+ZNC Amplitude;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZNVsFT0M", ";T0A+T0C (#times 1/100);ZNA+ZNC Amplitude;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0M}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZPVsFT0A", ";T0A (#times 1/100);ZPA+ZPC Amplitude;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("ZPVsFT0C", ";T0C (#times 1/100);ZPA+ZPC Amplitude;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("ZPVsFT0M", ";T0A+T0C (#times 1/100);ZPA+ZPC Amplitude;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0M}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("ZNAVsFT0A", ";T0A (#times 1/100);ZNA Amplitude;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZNAVsFT0C", ";T0C (#times 1/100);ZNA Amplitude;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZNAVsFT0M", ";T0A+T0C (#times 1/100);ZNA Amplitude;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0M}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZNCVsFT0A", ";T0A (#times 1/100);ZNC Amplitude;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZNCVsFT0C", ";T0C (#times 1/100);ZNC Amplitude;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZNCVsFT0M", ";T0A+T0C (#times 1/100);ZNC Amplitude;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0M}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZPAVsFT0A", ";T0A (#times 1/100);ZPA Amplitude;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("ZPAVsFT0C", ";T0C (#times 1/100);ZPA Amplitude;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("ZPAVsFT0M", ";T0A+T0C (#times 1/100);ZPA Amplitude;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0M}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("ZPCVsFT0A", ";T0A (#times 1/100);ZPC Amplitude;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("ZPCVsFT0C", ";T0C (#times 1/100);ZPC Amplitude;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("ZPCVsFT0M", ";T0A+T0C (#times 1/100);ZPC Amplitude;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0M}, {nBinsZDC, -0.5, maxZp}}}); histos.add("ZN", ";ZNA+ZNC;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); histos.add("ZNA", ";ZNA Amplitude;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); histos.add("ZPA", ";ZPA Amplitude;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZp}}); @@ -268,10 +265,10 @@ struct FlowZdcTask { histos.add("ZPACommon", ";ZPA Common Energy;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZp}}); histos.add("ZNCCommon", ";ZNC Common Energy;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); histos.add("ZPCCommon", ";ZPC Common Energy;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZp}}); - histos.add("ZNAVsZNC", ";ZNC;ZNA", kTH2F, {{{30, -0.5, maxZn}, {30, -0.5, maxZn}}}); - histos.add("ZPAVsZPC", ";ZPC;ZPA;", kTH2F, {{{100, -0.5, maxZp}, {100, -0.5, maxZp}}}); - histos.add("ZNAVsZPA", ";ZPA;ZNA;", kTH2F, {{{20, -0.5, maxZp}, {30, -0.5, maxZn}}}); - histos.add("ZNCVsZPC", ";ZPC;ZNC;", kTH2F, {{{20, -0.5, maxZp}, {30, -0.5, maxZn}}}); + histos.add("ZNAVsZNC", ";ZNC;ZNA", kTH2F, {{{nBinsZDC, -0.5, maxZn}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZPAVsZPC", ";ZPC;ZPA;", kTH2F, {{{nBinsZDC, -0.5, maxZp}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("ZNAVsZPA", ";ZPA;ZNA;", kTH2F, {{{nBinsZDC, -0.5, maxZp}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZNCVsZPC", ";ZPC;ZNC;", kTH2F, {{{nBinsZDC, -0.5, maxZp}, {nBinsZDC, -0.5, maxZn}}}); histos.add("ZNASector", ";ZNA;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); histos.add("ZPASector", ";ZPA;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZp}}); histos.add("ZNCSector", ";ZNC;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); @@ -281,13 +278,15 @@ struct FlowZdcTask { histos.add("ZPCcvsZPCsum", ";ZPC common;ZPC sum towers;", kTH2F, {{{30, -0.5, maxZp}, {30, -0.5, maxZp}}}); histos.add("ZPAcvsZPAsum", ";ZPA common;ZPA sum towers;", kTH2F, {{{30, -0.5, maxZp}, {30, -0.5, maxZp}}}); histos.add("ZNVsZEM", ";ZEM;ZNA+ZNC;", kTH2F, {{{60, -0.5, maxZem}, {60, -0.5, maxZn}}}); - histos.add("ZNCVstdc", ";t_{ZNC};ZNC;", kTH2F, {{{30, -15., 15.}, {nBinsZDC, -0.5, maxZn}}}); - histos.add("ZNAVstdc", ";t_{ZNA};ZNA;", kTH2F, {{{30, -15., 15.}, {30, -0.5, maxZn}}}); - histos.add("ZPCVstdc", ";t_{ZPC};ZPC;", kTH2F, {{{30, -15., 15}, {20, -0.5, maxZp}}}); - histos.add("ZPAVstdc", ";t_{ZPA};ZPA;", kTH2F, {{{30, -15., 15.}, {20, -0.5, maxZp}}}); - histos.add("ZEM1Vstdc", ";t_{ZEM1};ZEM1;", kTH2F, {{{30, -15., 15.}, {30, -0.5, 2000.5}}}); - histos.add("ZEM2Vstdc", ";t_{ZEM2};ZEM2;", kTH2F, {{{30, -15., 15.}, {30, -0.5, 2000.5}}}); - histos.add("debunch", ";t_{ZDC}-t_{ZDA};t_{ZDC}+t_{ZDA}", kTH2F, {{{nBinsTDC, minTdc, maxTdc}, {nBinsTDC, minTdc, maxTdc}}}); + histos.add("ZNCVstdccoll", ";t_{ZNC};ZNC;", kTH2F, {{{nBinsTDC, -13.5, 11.45}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZNAVstdccoll", ";t_{ZNA};ZNA;", kTH2F, {{{nBinsTDC, -13.5, 11.45}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZPCVstdccoll", ";t_{ZPC};ZPC;", kTH2F, {{{nBinsTDC, -13.5, 11.45}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("ZPAVstdccoll", ";t_{ZPA};ZPA;", kTH2F, {{{nBinsTDC, -13.5, 11.45}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("ZEM1", ";ZEM1 Amplitude;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZem}}); + histos.add("ZEM2", ";ZEM2 Amplitude;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZem}}); + histos.add("ZEM1Vstdc", ";t_{ZEM1};ZEM1;", kTH2F, {{{480, -13.5, 11.45}, {30, -0.5, 2000.5}}}); + histos.add("ZEM2Vstdc", ";t_{ZEM2};ZEM2;", kTH2F, {{{480, -13.5, 11.45}, {30, -0.5, 2000.5}}}); + histos.add("debunch", ";t_{ZDC}-t_{ZDA};t_{ZDC}+t_{ZDA}", kTH2F, {{{nBinsTDC, minTdcZn, maxTdcZn}, {nBinsTDC, minTdcZp, maxTdcZp}}}); histos.add("GlbTracks", "Nch", kTH1F, {{nBinsNch, minNch, maxNch}}); histos.add("ampFT0C", ";T0C (#times 1/100);", kTH1F, {{nBinsAmpFT0, 0., maxAmpFT0}}); histos.add("ampFT0A", ";T0A (#times 1/100);", kTH1F, {{nBinsAmpFT0, 0., maxAmpFT0}}); @@ -319,18 +318,27 @@ struct FlowZdcTask { histos.add("hZNSectorvsGlbTrack", ";Global Tracks (ITS + TPC);(ZNA + ZNC) Sector Energy", kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsZDC, minNch, maxZn}}}); } if (doprocessZdc) { - histos.add("commonZna", ";ZNA Common Energy;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); - histos.add("commonZpa", ";ZPA Common Energy;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZp}}); - histos.add("commonZnc", ";ZNC Common Energy;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); - histos.add("commonZpc", ";ZPC Common Energy;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZp}}); - histos.add("sectorZna", ";ZNA;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); - histos.add("sectorZpa", ";ZPA;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZp}}); - histos.add("sectorZnc", ";ZNC;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); - histos.add("sectorZpc", ";ZPC;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZp}}); histos.add("ampZna", ";ZNA Amplitude;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); histos.add("ampZpa", ";ZPA Amplitude;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZp}}); histos.add("ampZnc", ";ZNC Amplitude;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); histos.add("ampZpc", ";ZPC Amplitude;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZp}}); + histos.add("ampZEM1", ";ZEM1 Amplitude;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZem}}); + histos.add("ampZEM2", ";ZEM2 Amplitude;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZem}}); + histos.add("ZnVsZem", "ZnVsZEM; ZEM; ZNA + ZNC", kTH2F, {{{nBinsZDC, -0.5, maxZem}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZnaVsZnc", "ZNAvsZNC; ZNC; ZNA;", kTH2F, {{{nBinsZDC, -0.5, maxZn}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZpaVsZpc", "ZPAvsZPC; ZPC; ZPA;", kTH2F, {{{nBinsZDC, -0.5, maxZp}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("ZnaVsZpa", "ZNAvsZPA; ZNA; ZPA;", kTH2F, {{{nBinsZDC, -0.5, maxZn}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("ZncVsZpc", "ZNCvsZPC; ZNC; ZPC;", kTH2F, {{{nBinsZDC, -0.5, maxZn}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("ZnccVsZncSum", "ZNCcVsZNCsum; ZNCC ADC; ZNCsum", kTH2F, {{{nBinsADC, -0.5, 3. * maxZn}, {nBinsADC, -0.5, 3. * maxZn}}}); + histos.add("ZnacVsZnaSum", "ZNAcVsZNAsum; ZNAC ADC; ZNAsum", kTH2F, {{{nBinsADC, -0.5, 3. * maxZn}, {nBinsADC, -0.5, 3. * maxZn}}}); + histos.add("ZpacVsZpaSum", "ZPAcVsZPAsum; ZPAC ADC; ZPAsum", kTH2F, {{{nBinsADC, -0.5, 3. * maxZp}, {nBinsADC, -0.5, 3. * maxZp}}}); + histos.add("ZpccVsZpcSum", "ZPCcVsZPCsum; ZPCC ADC; ZPCsum", kTH2F, {{{nBinsADC, -0.5, 3. * maxZp}, {nBinsADC, -0.5, 3. * maxZp}}}); + histos.add("ZncVsTdc", "ZNCvsTDC; ZNC Amp; ZNC TDC", kTH2F, {{{480, -13.5, 11.45}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZnaVsTdc", "ZNAvsTDC; ZNA Amp; ZNA TDC", kTH2F, {{{480, -13.5, 11.45}, {nBinsZDC, -0.5, maxZn}}}); + histos.add("ZpcVsTdc", "ZPCvsTDC; ZPC Amp; ZPC TDC", kTH2F, {{{480, -13.5, 11.45}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("ZpaVsTdc", "ZPAvsTDC; ZPA Amp; ZPA TDC", kTH2F, {{{480, -13.5, 11.45}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("Zem1VsTdc", "ZEM1vsTDC; ZEM1 Amp; ZEM1 TDC", kTH2F, {{{480, -13.5, 11.45}, {nBinsZDC, -0.5, maxZem}}}); + histos.add("Zem2VsTdc", "ZEM2vsTDC; ZEM2 Amp; ZEM2 TDC", kTH2F, {{{480, -13.5, 11.45}, {nBinsZDC, -0.5, maxZem}}}); } ccdb->setURL("http://alice-ccdb.cern.ch"); @@ -460,8 +468,6 @@ struct FlowZdcTask { float tZNC{zdc.timeZNC()}; float tZPA{zdc.timeZPA()}; float tZPC{zdc.timeZPC()}; - float tZDCdif{tZNC + tZPC - tZNA - tZPA}; - float tZDCsum{tZNC + tZPC + tZNA + tZPA}; const double normT0M{(aT0A + aT0C) / 100.}; float znA = zdc.amplitudeZNA() / cfgCollisionEnergy; float znC = zdc.amplitudeZNC() / cfgCollisionEnergy; @@ -484,14 +490,70 @@ struct FlowZdcTask { float sumSectZN = (sumZNC + sumZNA); float sumSectZP = (sumZPC + sumZPA); - // TDC cut - if (isTDCcut) { - if (std::sqrt(std::pow(tZDCdif, 2.) + std::pow(tZDCsum, 2.)) > tdcCut) { - return; - } - histos.fill(HIST("hEventCounter"), EvCutLabel::Tdc); + if (sumZEMs > zemCut) { + if (isTDCcut) { + if ((tZNA >= minTdcZn) && (tZNA <= maxTdcZn)) { + histos.fill(HIST("ZNA"), znA); + histos.fill(HIST("ZNACommon"), commonSumZna); + histos.fill(HIST("ZNASector"), sumZNA); + } + if ((tZNC >= minTdcZn) && (tZNC <= maxTdcZn)) { + histos.fill(HIST("ZNC"), znC); + histos.fill(HIST("ZNCCommon"), commonSumZnc); + histos.fill(HIST("ZNCSector"), sumZNC); + } + if ((tZPA >= minTdcZp) && (tZPA <= maxTdcZp)) { + histos.fill(HIST("ZPA"), zpA); + histos.fill(HIST("ZPACommon"), commonSumZpa); + histos.fill(HIST("ZPASector"), sumZPA); + } + if ((tZPC >= minTdcZp) && (tZPC <= maxTdcZp)) { + histos.fill(HIST("ZPC"), zpC); + histos.fill(HIST("ZPCCommon"), commonSumZpc); + histos.fill(HIST("ZPCSector"), sumZPC); + } + if (((tZNA >= minTdcZn) && (tZNA <= maxTdcZn)) && ((tZNC >= minTdcZn) && (tZNC <= maxTdcZn))) + histos.fill(HIST("ZNVsZEM"), sumZEMs, sumZNs); + if (((tZNA >= minTdcZn) && (tZNA <= maxTdcZn)) && ((tZNC >= minTdcZn) && (tZNC <= maxTdcZn))) { + histos.fill(HIST("ZNAVsZNC"), znC, znA); + histos.fill(HIST("ZN"), znA + znC); + } + if ((tZNA >= minTdcZn) && (tZNA <= maxTdcZn)) + histos.fill(HIST("ZNAVsZPA"), zpA, znA); + if ((tZNC >= minTdcZn) && (tZNC <= maxTdcZn)) + histos.fill(HIST("ZNCVsZPC"), zpC, znC); + if (((tZPA >= minTdcZp) && (tZPA <= maxTdcZp)) && ((tZPC >= minTdcZp) && (tZPC <= maxTdcZp))) + histos.fill(HIST("ZPAVsZPC"), zpC, zpA); + } else { + histos.fill(HIST("ZNA"), znA); + histos.fill(HIST("ZNC"), znC); + histos.fill(HIST("ZPA"), zpA); + histos.fill(HIST("ZPC"), zpC); + histos.fill(HIST("ZNVsZEM"), sumZEMs, sumZNs); + histos.fill(HIST("ZNAVsZNC"), znC, znA); + histos.fill(HIST("ZNAVsZPA"), zpA, znA); + histos.fill(HIST("ZNCVsZPC"), zpC, znC); + histos.fill(HIST("ZPAVsZPC"), zpC, zpA); + histos.fill(HIST("ZNACommon"), commonSumZna); + histos.fill(HIST("ZNASector"), sumZNA); + histos.fill(HIST("ZNCCommon"), commonSumZnc); + histos.fill(HIST("ZNCSector"), sumZNC); + histos.fill(HIST("ZPACommon"), commonSumZpa); + histos.fill(HIST("ZPASector"), sumZPA); + histos.fill(HIST("ZPCCommon"), commonSumZpc); + histos.fill(HIST("ZPCSector"), sumZPC); + histos.fill(HIST("ZN"), znA + znC); + } + histos.fill(HIST("ZEM1"), aZEM1); + histos.fill(HIST("ZEM2"), aZEM2); + histos.fill(HIST("ZNCVstdccoll"), tZNC, znC); + histos.fill(HIST("ZNAVstdccoll"), tZNA, znA); + histos.fill(HIST("ZPCVstdccoll"), tZPC, zpC); + histos.fill(HIST("ZPAVstdccoll"), tZPA, zpA); + histos.fill(HIST("ZEM1Vstdc"), tZEM1, aZEM1); + histos.fill(HIST("ZEM2Vstdc"), tZEM2, aZEM2); + histos.fill(HIST("debunch"), tZNA - tZNC, tZNA + tZNC); } - float et = 0., meanpt = 0.; int itsTracks = 0, glbTracks = 0; for (const auto& track : tracks) { @@ -563,45 +625,25 @@ struct FlowZdcTask { histos.fill(HIST("GlbTracks"), glbTracks); if (sumZEMs > zemCut) { - histos.fill(HIST("ZNA"), znA); - histos.fill(HIST("ZNC"), znC); - histos.fill(HIST("ZNACommon"), commonSumZna); - histos.fill(HIST("ZNCCommon"), commonSumZnc); - histos.fill(HIST("ZNASector"), sumZNA); - histos.fill(HIST("ZNCSector"), sumZNC); - histos.fill(HIST("ZN"), znA + znC); - histos.fill(HIST("ZNVsZEM"), sumZEMs, sumZNs); - histos.fill(HIST("ZNCVstdc"), tZNC, znC); - histos.fill(HIST("ZNAVstdc"), tZNA, znA); - histos.fill(HIST("ZPCVstdc"), tZPC, zpC); - histos.fill(HIST("ZNVsFT0A"), aT0A / 100., sumSectZN); - histos.fill(HIST("ZNVsFT0C"), aT0C / 100., sumSectZN); - histos.fill(HIST("ZNVsFT0M"), (aT0A + aT0C) / 100., sumSectZN); - histos.fill(HIST("ZPVsFT0A"), aT0A / 100., sumSectZP); - histos.fill(HIST("ZPVsFT0C"), aT0C / 100., sumSectZP); - histos.fill(HIST("ZPVsFT0M"), (aT0A + aT0C) / 100., sumSectZP); - histos.fill(HIST("ZPAVsFT0A"), aT0A / 100., sumZPA); - histos.fill(HIST("ZPAVsFT0C"), aT0C / 100., sumZPA); - histos.fill(HIST("ZPAVsFT0M"), (aT0A + aT0C) / 100., sumZPA); - histos.fill(HIST("ZPCVsFT0A"), aT0A / 100., sumZPC); - histos.fill(HIST("ZPCVsFT0C"), aT0C / 100., sumZPC); - histos.fill(HIST("ZPCVsFT0M"), (aT0A + aT0C) / 100., sumZPC); - histos.fill(HIST("ZNCVsFT0A"), aT0A / 100., sumZNC); - histos.fill(HIST("ZNCVsFT0C"), aT0C / 100., sumZNC); - histos.fill(HIST("ZNCVsFT0M"), (aT0A + aT0C) / 100., sumZNC); - histos.fill(HIST("ZNAVsFT0A"), aT0A / 100., sumZNA); - histos.fill(HIST("ZNAVsFT0C"), aT0C / 100., sumZNA); - histos.fill(HIST("ZNAVsFT0M"), (aT0A + aT0C) / 100., sumZNA); - histos.fill(HIST("ZPA"), zpA); - histos.fill(HIST("ZPACommon"), commonSumZpa); - histos.fill(HIST("ZPASector"), sumZPA); - histos.fill(HIST("ZPAVstdc"), tZPA, zpA); + histos.fill(HIST("ZNVsFT0C"), aT0C / 100., znA + znC); + histos.fill(HIST("ZNVsFT0M"), (aT0A + aT0C) / 100., znA + znC); + histos.fill(HIST("ZPVsFT0A"), aT0A / 100., zpA + zpC); + histos.fill(HIST("ZPVsFT0C"), aT0C / 100., zpA + zpC); + histos.fill(HIST("ZPVsFT0M"), (aT0A + aT0C) / 100., zpA + zpC); + histos.fill(HIST("ZPAVsFT0A"), aT0A / 100., zpA); + histos.fill(HIST("ZPAVsFT0C"), aT0C / 100., zpA); + histos.fill(HIST("ZPAVsFT0M"), (aT0A + aT0C) / 100., zpA); + histos.fill(HIST("ZPCVsFT0A"), aT0A / 100., zpC); + histos.fill(HIST("ZPCVsFT0C"), aT0C / 100., zpC); + histos.fill(HIST("ZPCVsFT0M"), (aT0A + aT0C) / 100., zpC); + histos.fill(HIST("ZNCVsFT0A"), aT0A / 100., znC); + histos.fill(HIST("ZNCVsFT0C"), aT0C / 100., znC); + histos.fill(HIST("ZNCVsFT0M"), (aT0A + aT0C) / 100., znC); + histos.fill(HIST("ZNAVsFT0A"), aT0A / 100., znA); + histos.fill(HIST("ZNAVsFT0C"), aT0C / 100., znA); + histos.fill(HIST("ZNAVsFT0M"), (aT0A + aT0C) / 100., znA); histos.fill(HIST("ZPAvsCent"), cent, zpA); - histos.fill(HIST("ZPC"), zpC); - histos.fill(HIST("ZPCCommon"), commonSumZpc); - histos.fill(HIST("ZPCSector"), sumZPC); histos.fill(HIST("ZPCvsCent"), cent, zpC); - histos.fill(HIST("debunch"), tZDCdif, tZDCsum); if (std::isfinite(zpA) && !std::isnan(zpA) && cent >= minT0CcentCut && cent < maxT0CcentCut && glbTracks >= minNch && glbTracks < maxNch) { histos.fill(HIST("pZPAvsFT0Ccent"), cent, zpA); histos.fill(HIST("pZPAvsGlbTrack"), glbTracks, zpA); @@ -617,12 +659,6 @@ struct FlowZdcTask { histos.fill(HIST("hZPSectorvsGlbTrack"), glbTracks, sumSectZP); histos.fill(HIST("hZNSectorvsGlbTrack"), glbTracks, sumSectZN); // ZDC Correlations - histos.fill(HIST("ZNAVsZNC"), znC, znA); - histos.fill(HIST("ZNAVsZPA"), zpA, znA); - histos.fill(HIST("ZNCVsZPC"), zpC, znC); - histos.fill(HIST("ZPAVsZPC"), zpC, zpA); - histos.fill(HIST("ZEM1Vstdc"), tZEM1, aZEM1); - histos.fill(HIST("ZEM2Vstdc"), tZEM2, aZEM2); histos.fill(HIST("ZNAVsNch"), glbTracks, znA); histos.fill(HIST("ZNCVsNch"), glbTracks, znC); histos.fill(HIST("ZNVsNch"), glbTracks, sumZNs); @@ -849,21 +885,30 @@ struct FlowZdcTask { if (sumZEMs > zemCut) { histos.fill(HIST("ampZna"), znA); histos.fill(HIST("ampZnc"), znC); - histos.fill(HIST("commonZna"), commonSumZna); - histos.fill(HIST("commonZnc"), commonSumZnc); - histos.fill(HIST("sectorZna"), sumZNA); - histos.fill(HIST("sectorZnc"), sumZNC); - // fill histos for proton zdc histos.fill(HIST("ampZpa"), zpA); - histos.fill(HIST("commonZpa"), commonSumZpa); - histos.fill(HIST("sectorZpa"), sumZPA); histos.fill(HIST("ampZpc"), zpC); - histos.fill(HIST("commonZpc"), commonSumZpc); - histos.fill(HIST("sectorZpc"), sumZPC); + histos.fill(HIST("ampZEM1"), aZEM1); + histos.fill(HIST("ampZEM2"), aZEM2); + histos.fill(HIST("ZnVsZem"), sumZEMs, znC + znA); + histos.fill(HIST("ZnaVsZnc"), znA, znC); + histos.fill(HIST("ZpaVsZpc"), zpA, zpC); + histos.fill(HIST("ZnaVsZpa"), znA, zpA); + histos.fill(HIST("ZncVsZpc"), znC, zpC); + histos.fill(HIST("ZnccVsZncSum"), sumZNC, commonSumZnc); + histos.fill(HIST("ZnacVsZnaSum"), sumZNA, commonSumZna); + histos.fill(HIST("ZpccVsZpcSum"), sumZPC, commonSumZpc); + histos.fill(HIST("ZpacVsZpaSum"), sumZPA, commonSumZpa); + histos.fill(HIST("ZncVsTdc"), zdc.timeZNC(), znC); + histos.fill(HIST("ZnaVsTdc"), zdc.timeZNA(), znA); + histos.fill(HIST("ZpcVsTdc"), zdc.timeZPC(), zpC); + histos.fill(HIST("ZpaVsTdc"), zdc.timeZPA(), zpA); + histos.fill(HIST("Zem1VsTdc"), zdc.timeZEM1(), aZEM1); + histos.fill(HIST("Zem2VsTdc"), zdc.timeZEM2(), aZEM2); } } - PROCESS_SWITCH(FlowZdcTask, processZdcCollAssoc, "Processing ZDC w. collision association", false); + PROCESS_SWITCH(FlowZdcTask, processQA, "Process QA", true); + PROCESS_SWITCH(FlowZdcTask, processZdcCollAssoc, "Processing ZDC w. collision association", false); PROCESS_SWITCH(FlowZdcTask, processZdc, "Process ZDC without corrections or associations", true); }; // end of struct function From e349c05c41b04626c2031936a2dbaee23267f55e Mon Sep 17 00:00:00 2001 From: Roman Lietava Date: Sun, 12 Oct 2025 00:31:18 +0200 Subject: [PATCH 719/986] [PWGLF] Omegahm - reduced output (#13292) --- PWGLF/Tasks/Strangeness/nonPromptCascade.cxx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx b/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx index d5ada008d62..30932ca14a2 100644 --- a/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx +++ b/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx @@ -201,8 +201,13 @@ struct NonPromptCascadeTask { Configurable cfgMinCosPA{"cfgMinCosPA", -1.f, "Minimum cosine of pointing angle"}; Configurable> cfgCutsPID{"particlesCutsPID", {cutsPID[0], nParticles, nCutsPID, particlesNames, cutsNames}, "Nuclei PID selections"}; Configurable cfgSkimmedProcessing{"cfgSkimmedProcessing", true, "Skimmed dataset processing"}; + Configurable cfgTriggersOfInterest{"cfgTriggersOfInterest", "fTrackedOmega,fOmegaHighMult", "Triggers of interest, comma separated for Zorro"}; + Configurable cfgMaxMult{"cfgMaxMult", 8000.f, "Upper range of multiplicty histo"}; + Configurable cfgMinMult{"cfgMinMult", 3000.f, "Lower range of FT0M histo in zoomed histo"}; + Configurable cfgMaxCent{"cfgMaxCent", 8.0025f, "Upper range of FT0M histo"}; + Zorro mZorro; OutputObj mZorroSummary{"ZorroSummary"}; SliceCache cache; @@ -218,10 +223,13 @@ struct NonPromptCascadeTask { std::unordered_map> mHistsPerRunNtracktVsCent; std::unordered_map> mHistsPerRunNtracktVsCentZoom; - AxisSpec multAxis = {10000, 0, 10000, "Multiplicity FT0M"}; - AxisSpec centAxis = {2021, -0.025, 101.025, "Centrality"}; - AxisSpec centAxisZoom = {2000, -0.0025, 10.0025, "Centrality"}; - AxisSpec multAxisZoom = {7000, 3000, 10000, "Multiplicity FT0M"}; + int nBinsMult = cfgMaxMult; + int nBinsMultZoom = cfgMaxMult - cfgMinMult; + int nBinsCentZoom = (cfgMaxCent + 0.0025) / 0.005; + AxisSpec multAxis = {nBinsMult, 0, cfgMaxMult, "Multiplicity FT0M"}; + AxisSpec centAxis = {101, -0.025, 101.025, "Centrality"}; + AxisSpec centAxisZoom = {nBinsCentZoom, -0.0025, cfgMaxCent, "Centrality"}; + AxisSpec multAxisZoom = {nBinsMultZoom, cfgMinMult, cfgMaxMult, "Multiplicity FT0M"}; AxisSpec nTracksAxis = {100, 0., 100., "NTracksGlobal"}; void initCCDB(aod::BCsWithTimestamps::iterator const& bc) From 60eb3004eeba2ce3ce67a526388ae89e52aa6ffc Mon Sep 17 00:00:00 2001 From: Marcello Di Costanzo <96481191+Marcellocosti@users.noreply.github.com> Date: Sun, 12 Oct 2025 01:25:09 +0200 Subject: [PATCH 720/986] [PWGHF] Add process function for per-trigger normalization (#13334) Co-authored-by: ALICE Action Bot --- .../DataModel/DerivedDataCorrelationTables.h | 3 +- .../correlatorFlowCharmHadronsReduced.cxx | 126 +++++++++++------- .../derivedDataCreatorCorrelationsReduced.cxx | 10 +- 3 files changed, 88 insertions(+), 51 deletions(-) diff --git a/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h b/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h index c32049c3976..555d86f34c8 100644 --- a/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h +++ b/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h @@ -139,17 +139,18 @@ DECLARE_SOA_COLUMN(DcaZAssoc, dcaZAssoc, float); //! Impact DECLARE_SOA_TABLE(HfcRedTrigBases, "AOD", "HFCREDTRIGBASE", //! Table with trigger candidate base info soa::Index<>, - aod::hf_correl_charm_had_reduced::HfcRedCorrCollId, aod::hf_correl_charm_had_reduced::PhiTrig, aod::hf_correl_charm_had_reduced::EtaTrig); DECLARE_SOA_TABLE(HfcRedTrigCharms, "AOD", "HFCREDTRIGCHARM", //! Table with Same Event Charm-Hadron pairs information + aod::hf_correl_charm_had_reduced::HfcRedCorrCollId, aod::hf_correl_charm_had_reduced::PtTrig, aod::hf_correl_charm_had_reduced::InvMassTrig, aod::hf_correl_charm_had_reduced::BdtScore0Trig, aod::hf_correl_charm_had_reduced::BdtScore1Trig); DECLARE_SOA_TABLE(HfcRedTrigTracks, "AOD", "HFCREDTRIGTRACK", //! Table with Same Event Charm-Hadron pairs information + aod::hf_correl_charm_had_reduced::HfcRedCorrCollId, aod::hf_correl_charm_had_reduced::PtTrig, aod::hf_correl_charm_had_reduced::NTpcCrossedRowsTrig, aod::hf_correl_charm_had_reduced::ItsClsMapTrig, diff --git a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx index f1d2fc578b4..77281b0ad40 100644 --- a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx +++ b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx @@ -84,18 +84,21 @@ double getPhi(const TTrack& track) } struct HfCorrelatorFlowCharmHadronsReduced { - Produces rowPairSECharmHads; //! Correlation pairs information Same Event - Produces rowPairMECharmHads; //! Correlation pairs information Mixed Event - Produces rowPairSEHadHads; //! Correlation pairs information Same Event - Produces rowPairMEHadHads; //! Correlation pairs information Mixed Event - Produces rowCollInfos; //! Collision info + // Produces rowPairSECharmHads; //! Correlation pairs information Same Event + // Produces rowPairMECharmHads; //! Correlation pairs information Mixed Event + // Produces rowPairSEHadHads; //! Correlation pairs information Same Event + // Produces rowPairMEHadHads; //! Correlation pairs information Mixed Event + // Produces rowCollInfos; //! Collision info Configurable fillSparses{"fillSparses", true, "Fill sparse histograms"}; Configurable fillTables{"fillTables", false, "Fill tables"}; Configurable numberEventsMixed{"numberEventsMixed", 5, "Number of events mixed in ME process"}; Configurable> binsPtTrig{"binsPtTrig", std::vector{0., 3., 5., 8., 16., 36.}, "pT bin limits for trigger candidates"}; - Configurable> bkgScoresPtMaxs{"bkgScoresPtMaxs", std::vector{0.1, 0.1, 0.1, 0.1, 0.1}, "pT-differential maximum bkg scores for charm candidates"}; + Configurable> bdtScore0PtMaxs{"bdtScore0PtMaxs", std::vector{0.1, 0.1, 0.1, 0.1, 0.1}, "pT-differential maximum score 0 for charm candidates"}; + Configurable> bdtScore1PtMins{"bdtScore1PtMins", std::vector{0.1, 0.1, 0.1, 0.1, 0.1}, "pT-differential minimum score 1 for charm candidates"}; Configurable> binsPtAssoc{"binsPtAssoc", std::vector{0.3, 1., 2., 50.}, "pT bin limits for associated particles"}; + Configurable centralityMin{"centralityMin", 0, "min. centrality"}; + Configurable centralityMax{"centralityMax", 10., "max. centrality"}; Configurable deltaEtaAbsMin{"deltaEtaAbsMin", 0.5, "min. pair delta eta"}; Configurable deltaEtaAbsMax{"deltaEtaAbsMax", 2., "max. pair delta eta"}; Configurable dcaXYTrackMax{"dcaXYTrackMax", 1., "max. track DCA XY"}; @@ -138,9 +141,6 @@ struct HfCorrelatorFlowCharmHadronsReduced { HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; - BinningMultPosZ binPolicyPosZMult{{zPoolBins, multPoolBins}, true}; - BinningCentPosZ binPolicyPosZCent{{zPoolBins, centPoolBins}, true}; - void init(InitContext&) { if ((doprocessSameEventCharmHadWCentMix && doprocessMixedEventCharmHadWMultMix) || @@ -152,14 +152,14 @@ struct HfCorrelatorFlowCharmHadronsReduced { if (!fillSparses && !fillTables) { LOGP(fatal, "At least one of fillSparses or fillTables must be true!"); } - if (binsPtTrig.value.size() != (bkgScoresPtMaxs.value.size() + 1)) { - LOGP(fatal, "The size of binsPtTrig must be the one of bkgScorePtMaxs plus one!"); + if ((binsPtTrig.value.size() != (bdtScore0PtMaxs.value.size() + 1) || binsPtTrig.value.size() != (bdtScore1PtMins.value.size() + 1))) { + LOGP(fatal, "The size of bdtScore0PtMaxs and bdtScore1PtMins must be the one of binsPtTrig minus one!"); } if (doprocessSameEventCharmHadWCentMix || doprocessSameEventHadHadWCentMix || doprocessMixedEventCharmHadWCentMix || doprocessMixedEventHadHadWCentMix) { - poolBins = (centPoolBins->size() - 1) * (zPoolBins->size() - 1); + poolBins = (centPoolBins->size() - 2) * (zPoolBins->size() - 2); } else { - poolBins = (multPoolBins->size() - 1) * (zPoolBins->size() - 1); + poolBins = (multPoolBins->size() - 2) * (zPoolBins->size() - 2); } const AxisSpec axisInvMass{binsInvMass, "Inv. mass (GeV/#it{c}^{2})"}; @@ -191,18 +191,23 @@ struct HfCorrelatorFlowCharmHadronsReduced { registry.add("hPoolBinAssocSE", "Associated particles pool bin SE", {HistType::kTH1F, {axisPoolBin}}); registry.add("hPoolBinAssocME", "Associated particles pool bin ME", {HistType::kTH1F, {axisPoolBin}}); if (fillSparses) { + std::vector axesTrigger = {axisInvMass, axisPtTrig, axisMlOne, axisMlTwo}; std::vector axes = {axisPoolBin, axisPtTrig, axisPtAssoc, axisDeltaEta, axisDeltaPhi}; if (doprocessSameEventHadHadWCentMix || doprocessSameEventHadHadWMultMix) { registry.add("hSparseCorrelationsSEHadHad", "THn for SE Had-Had correlations", HistType::kTHnSparseF, axes); } else if (doprocessMixedEventHadHadWCentMix || doprocessMixedEventHadHadWMultMix) { registry.add("hSparseCorrelationsMEHadHad", "THn for ME Had-Had correlations", HistType::kTHnSparseF, axes); } else { - axes.insert(axes.end(), {axisInvMass, axisMlOne, axisMlTwo}); + axes.insert(axes.end(), {axisInvMass}); + // axes.insert(axes.end(), {axisInvMass, axisMlOne, axisMlTwo}); if (doprocessSameEventCharmHadWCentMix || doprocessSameEventCharmHadWMultMix) { registry.add("hSparseCorrelationsSECharmHad", "THn for SE Charm-Had correlations", HistType::kTHnSparseF, axes); } else if (doprocessMixedEventCharmHadWCentMix || doprocessMixedEventCharmHadWMultMix) { registry.add("hSparseCorrelationsMECharmHad", "THn for ME Charm-Had correlations", HistType::kTHnSparseF, axes); } + if (doprocessCharmTriggers) { + registry.add("hSparseTrigCandsCharm", "THn for Charm trigger candidates", HistType::kTHnSparseF, axesTrigger); + } } } } @@ -239,12 +244,12 @@ struct HfCorrelatorFlowCharmHadronsReduced { /// Apply pT-differential ML BDT bkg score cut /// \param ptTrig is the pT of the charm candidate template - bool isSelBdtBkgScoreCut(TCand const& cand, - double ptTrig) + bool isSelBdtScoreCut(TCand const& cand, + double ptTrig) { for (size_t iPt = 0; iPt < binsPtTrig.value.size() - 1; iPt++) { if (ptTrig >= binsPtTrig.value[iPt] && ptTrig < binsPtTrig.value[iPt + 1]) { - return cand.bdtScore0Trig() < bkgScoresPtMaxs.value[iPt]; + return (cand.bdtScore0Trig() < bdtScore0PtMaxs.value[iPt]) && (cand.bdtScore1Trig() > bdtScore1PtMins.value[iPt]); } } return false; @@ -261,9 +266,12 @@ struct HfCorrelatorFlowCharmHadronsReduced { TBinningType binPolicy) { auto collision = pair.template hfcRedCorrColl_as(); + if (collision.centrality() < centralityMin || collision.centrality() > centralityMax) { + return; + } double const ptTrig = trigCand.ptTrig(); if constexpr (requires { trigCand.bdtScore0Trig(); }) { // ML selection on bkg score for Charm-Had case - if (!isSelBdtBkgScoreCut(trigCand, ptTrig)) { + if (!isSelBdtScoreCut(trigCand, ptTrig)) { return; } } @@ -276,22 +284,22 @@ struct HfCorrelatorFlowCharmHadronsReduced { int const poolBin = getPoolBin(collision, binPolicy); registry.fill(HIST("hPoolBinTrigSE"), poolBin); registry.fill(HIST("hPoolBinAssocSE"), poolBin); - if constexpr (FillTables) { - if constexpr (requires { trigCand.bdtScore0Trig(); }) { // Separate Charm-Had and Had-Had cases - rowPairSECharmHads(poolBin, ptTrig, pair.ptAssoc(), pair.deltaEta(), pair.deltaPhi(), - trigCand.invMassTrig(), trigCand.bdtScore0Trig(), trigCand.bdtScore1Trig(), - pair.nTpcCrossedRowsAssoc(), pair.itsClsMapAssoc(), pair.itsNClsAssoc(), pair.dcaXYAssoc(), pair.dcaZAssoc()); - } else { - rowPairSEHadHads(poolBin, ptTrig, pair.ptAssoc(), pair.deltaEta(), pair.deltaPhi(), - trigCand.nTpcCrossedRowsTrig(), trigCand.itsClsMapTrig(), trigCand.itsNClsTrig(), trigCand.dcaXYTrig(), trigCand.dcaZTrig(), - pair.nTpcCrossedRowsAssoc(), pair.itsClsMapAssoc(), pair.itsNClsAssoc(), pair.dcaXYAssoc(), pair.dcaZAssoc()); - } - rowCollInfos(collision.multiplicity(), collision.numPvContrib(), collision.centrality()); - } + // if constexpr (FillTables) { + // if constexpr (requires { trigCand.bdtScore0Trig(); }) { // Separate Charm-Had and Had-Had cases + // rowPairSECharmHads(poolBin, ptTrig, pair.ptAssoc(), pair.deltaEta(), pair.deltaPhi(), + // trigCand.invMassTrig(), trigCand.bdtScore0Trig(), trigCand.bdtScore1Trig(), + // pair.nTpcCrossedRowsAssoc(), pair.itsClsMapAssoc(), pair.itsNClsAssoc(), pair.dcaXYAssoc(), pair.dcaZAssoc()); + // } else { + // rowPairSEHadHads(poolBin, ptTrig, pair.ptAssoc(), pair.deltaEta(), pair.deltaPhi(), + // trigCand.nTpcCrossedRowsTrig(), trigCand.itsClsMapTrig(), trigCand.itsNClsTrig(), trigCand.dcaXYTrig(), trigCand.dcaZTrig(), + // pair.nTpcCrossedRowsAssoc(), pair.itsClsMapAssoc(), pair.itsNClsAssoc(), pair.dcaXYAssoc(), pair.dcaZAssoc()); + // } + // rowCollInfos(collision.multiplicity(), collision.numPvContrib(), collision.centrality()); + // } if constexpr (FillSparses) { if constexpr (requires { trigCand.bdtScore0Trig(); }) { // Separate Charm-Had and Had-Had cases registry.fill(HIST("hSparseCorrelationsSECharmHad"), poolBin, ptTrig, pair.ptAssoc(), pair.deltaEta(), - pair.deltaPhi(), trigCand.invMassTrig(), trigCand.bdtScore0Trig(), trigCand.bdtScore1Trig()); + pair.deltaPhi(), trigCand.invMassTrig()); // , trigCand.bdtScore0Trig(), trigCand.bdtScore1Trig()); } else { registry.fill(HIST("hSparseCorrelationsSEHadHad"), poolBin, ptTrig, pair.ptAssoc(), pair.deltaEta(), pair.deltaPhi()); } @@ -310,6 +318,10 @@ struct HfCorrelatorFlowCharmHadronsReduced { if (trigCands.size() == 0 || assocTracks.size() == 0) { continue; } + if (trigColl.centrality() < centralityMin || trigColl.centrality() > centralityMax || + assocColl.centrality() < centralityMin || assocColl.centrality() > centralityMax) { + continue; + } int const poolBinTrig = getPoolBin(trigColl, binPolicy); int const poolBinAssoc = getPoolBin(assocColl, binPolicy); if (poolBinAssoc != poolBinTrig) { @@ -327,7 +339,7 @@ struct HfCorrelatorFlowCharmHadronsReduced { } double const ptTrig = getPt(trigCand); if constexpr (requires { trigCand.bdtScore0Trig(); }) { // ML selection on bkg score for Charm-Had case - if (!isSelBdtBkgScoreCut(trigCand, ptTrig)) { + if (!isSelBdtScoreCut(trigCand, ptTrig)) { continue; } } @@ -340,22 +352,22 @@ struct HfCorrelatorFlowCharmHadronsReduced { } } double const deltaPhi = RecoDecay::constrainAngle(getPhi(assocTrack) - getPhi(trigCand), -o2::constants::math::PIHalf); - if constexpr (FillTables) { - if constexpr (requires { trigCand.bdtScore0Trig(); }) { // Separate Charm-Had and Had-Had cases - rowPairMECharmHads(poolBinTrig, ptTrig, ptAssoc, deltaEta, deltaPhi, - trigCand.invMassTrig(), trigCand.bdtScore0Trig(), trigCand.bdtScore1Trig(), - assocTrack.nTpcCrossedRowsAssoc(), assocTrack.itsClsMapAssoc(), assocTrack.itsNClsAssoc(), assocTrack.dcaXYAssoc(), assocTrack.dcaZAssoc()); - } else { - rowPairMEHadHads(poolBinTrig, ptTrig, ptAssoc, deltaEta, deltaPhi, - trigCand.nTpcCrossedRowsAssoc(), trigCand.itsClsMapAssoc(), trigCand.itsNClsAssoc(), trigCand.dcaXYAssoc(), trigCand.dcaZAssoc(), - assocTrack.nTpcCrossedRowsAssoc(), assocTrack.itsClsMapAssoc(), assocTrack.itsNClsAssoc(), assocTrack.dcaXYAssoc(), assocTrack.dcaZAssoc()); - } - rowCollInfos(trigColl.multiplicity(), trigColl.numPvContrib(), trigColl.centrality()); - } + // if constexpr (FillTables) { + // if constexpr (requires { trigCand.bdtScore0Trig(); }) { // Separate Charm-Had and Had-Had cases + // rowPairMECharmHads(poolBinTrig, ptTrig, ptAssoc, deltaEta, deltaPhi, + // trigCand.invMassTrig(), trigCand.bdtScore0Trig(), trigCand.bdtScore1Trig(), + // assocTrack.nTpcCrossedRowsAssoc(), assocTrack.itsClsMapAssoc(), assocTrack.itsNClsAssoc(), assocTrack.dcaXYAssoc(), assocTrack.dcaZAssoc()); + // } else { + // rowPairMEHadHads(poolBinTrig, ptTrig, ptAssoc, deltaEta, deltaPhi, + // trigCand.nTpcCrossedRowsAssoc(), trigCand.itsClsMapAssoc(), trigCand.itsNClsAssoc(), trigCand.dcaXYAssoc(), trigCand.dcaZAssoc(), + // assocTrack.nTpcCrossedRowsAssoc(), assocTrack.itsClsMapAssoc(), assocTrack.itsNClsAssoc(), assocTrack.dcaXYAssoc(), assocTrack.dcaZAssoc()); + // } + // rowCollInfos(trigColl.multiplicity(), trigColl.numPvContrib(), trigColl.centrality()); + // } if constexpr (FillSparses) { if constexpr (requires { trigCand.bdtScore0Trig(); }) { // Separate Charm-Had and Had-Had cases registry.fill(HIST("hSparseCorrelationsMECharmHad"), poolBinTrig, ptTrig, ptAssoc, deltaEta, - deltaPhi, trigCand.invMassTrig(), trigCand.bdtScore0Trig(), trigCand.bdtScore1Trig()); + deltaPhi, trigCand.invMassTrig()); //, trigCand.bdtScore0Trig(), trigCand.bdtScore1Trig()); } else { registry.fill(HIST("hSparseCorrelationsMEHadHad"), poolBinTrig, ptTrig, ptAssoc, deltaEta, deltaPhi); } @@ -368,6 +380,7 @@ struct HfCorrelatorFlowCharmHadronsReduced { aod::HfcRedTrigCharms const&, aod::HfcRedCorrColls const&) { + BinningMultPosZ binPolicyPosZMult{{zPoolBins, multPoolBins}, true}; auto trigCand = pair.template hfcRedTrigCharm_as(); if (fillSparses && fillTables) { fillSameEvent(pair, trigCand, binPolicyPosZMult); @@ -383,6 +396,7 @@ struct HfCorrelatorFlowCharmHadronsReduced { aod::HfcRedTrigTracks const&, aod::HfcRedCorrColls const&) { + BinningMultPosZ binPolicyPosZMult{{zPoolBins, multPoolBins}, true}; auto trigCand = pair.template hfcRedTrigTrack_as(); if (fillSparses && fillTables) { fillSameEvent(pair, trigCand, binPolicyPosZMult); @@ -398,6 +412,7 @@ struct HfCorrelatorFlowCharmHadronsReduced { aod::HfcRedTrigCharms const&, aod::HfcRedCorrColls const&) { + BinningCentPosZ binPolicyPosZCent{{zPoolBins, centPoolBins}, true}; auto trigCand = pair.template hfcRedTrigCharm_as(); if (fillSparses && fillTables) { fillSameEvent(pair, trigCand, binPolicyPosZCent); @@ -413,6 +428,7 @@ struct HfCorrelatorFlowCharmHadronsReduced { aod::HfcRedTrigTracks const&, aod::HfcRedCorrColls const&) { + BinningCentPosZ binPolicyPosZCent{{zPoolBins, centPoolBins}, true}; auto trigCand = pair.template hfcRedTrigTrack_as(); if (fillSparses && fillTables) { fillSameEvent(pair, trigCand, binPolicyPosZCent); @@ -428,6 +444,7 @@ struct HfCorrelatorFlowCharmHadronsReduced { TrigCharmCands const& candidates, AssocTracks const& tracks) { + BinningCentPosZ binPolicyPosZCent{{zPoolBins, centPoolBins}, true}; auto pairsTuple = std::make_tuple(candidates, tracks); Pair const pairs{binPolicyPosZCent, numberEventsMixed, -1, collisions, pairsTuple, &cache}; if (fillSparses && fillTables) { @@ -444,6 +461,7 @@ struct HfCorrelatorFlowCharmHadronsReduced { TrigCharmCands const& candidates, AssocTracks const& tracks) { + BinningMultPosZ binPolicyPosZMult{{zPoolBins, multPoolBins}, true}; auto pairsTuple = std::make_tuple(candidates, tracks); Pair const pairs{binPolicyPosZMult, numberEventsMixed, -1, collisions, pairsTuple, &cache}; if (fillSparses && fillTables) { @@ -459,6 +477,7 @@ struct HfCorrelatorFlowCharmHadronsReduced { void processMixedEventHadHadWCentMix(aod::HfcRedCorrColls const& collisions, AssocTracks const& tracks) { + BinningCentPosZ binPolicyPosZCent{{zPoolBins, centPoolBins}, true}; auto tracksTuple = std::make_tuple(tracks); SameKindPair const pairs{binPolicyPosZCent, numberEventsMixed, -1, collisions, tracksTuple, &cache}; if (fillSparses && fillTables) { @@ -474,6 +493,7 @@ struct HfCorrelatorFlowCharmHadronsReduced { void processMixedEventHadHadWMultMix(aod::HfcRedCorrColls const& collisions, AssocTracks const& tracks) { + BinningMultPosZ binPolicyPosZMult{{zPoolBins, multPoolBins}, true}; auto tracksTuple = std::make_tuple(tracks); SameKindPair const pairs{binPolicyPosZMult, numberEventsMixed, -1, collisions, tracksTuple, &cache}; if (fillSparses && fillTables) { @@ -485,6 +505,22 @@ struct HfCorrelatorFlowCharmHadronsReduced { } } PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processMixedEventHadHadWMultMix, "Process Mixed Event for Had-Had with multiplicity pools", false); + + void processCharmTriggers(aod::HfcRedTrigCharms const& trigCands, + aod::HfcRedCorrColls const&) + { + for (const auto& trigCand : trigCands) { + auto collision = trigCand.template hfcRedCorrColl_as(); + if (collision.centrality() < centralityMin || collision.centrality() > centralityMax) { + continue; + } + if (!isSelBdtScoreCut(trigCand, trigCand.ptTrig())) { + continue; + } + registry.fill(HIST("hSparseTrigCandsCharm"), trigCand.invMassTrig(), trigCand.ptTrig(), trigCand.bdtScore0Trig(), trigCand.bdtScore1Trig()); + } + } + PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processCharmTriggers, "Process charm trigger info", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx b/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx index 0ae49453a27..df5feed033e 100644 --- a/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx +++ b/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx @@ -324,10 +324,10 @@ struct HfDerivedDataCreatorCorrelationsReduced { registry.fill(HIST("hPhiVsPtTrig"), RecoDecay::constrainAngle(trigCand.phi(), -o2::constants::math::PIHalf), trigCandPt); registry.fill(HIST("hEtaVsPtTrig"), trigCand.eta(), trigCandPt); if constexpr (CandType == CandidateType::Hadron) { - rowTrigHads(trigCandPt, trigCand.tpcNClsCrossedRows(), trigCand.itsClusterMap(), trigCand.itsNCls(), trigCand.dcaXY(), trigCand.dcaZ()); + rowTrigHads(rowCollisions.lastIndex(), trigCandPt, trigCand.tpcNClsCrossedRows(), trigCand.itsClusterMap(), trigCand.itsNCls(), trigCand.dcaXY(), trigCand.dcaZ()); } else { std::array outputMl = getCandMlScores(trigCand); - rowTrigCharms(trigCandPt, getCandMass(trigCand), outputMl[0], outputMl[1]); + rowTrigCharms(rowCollisions.lastIndex(), trigCandPt, getCandMass(trigCand), outputMl[0], outputMl[1]); } for (const auto& assTrk : assTrks) { @@ -377,8 +377,8 @@ struct HfDerivedDataCreatorCorrelationsReduced { registry.fill(HIST("hEtaVsPtTrig"), trigCand.eta(), trigCand.pt()); std::array outputMl = getCandMlScores(trigCand); - rowTrigBases(rowCollisions.lastIndex(), trigCand.phi(), trigCand.eta()); - rowTrigCharms(trigCand.pt(), getCandMass(trigCand), outputMl[0], outputMl[1]); + rowTrigBases(trigCand.phi(), trigCand.eta()); + rowTrigCharms(rowCollisions.lastIndex(), trigCand.pt(), getCandMass(trigCand), outputMl[0], outputMl[1]); } } @@ -545,7 +545,7 @@ struct HfDerivedDataCreatorCorrelationsReduced { rowCollisions(mult, coll.numContrib(), cent, coll.posZ()); fillSameEvent(tracks, tracks, cent); } - PROCESS_SWITCH(HfDerivedDataCreatorCorrelationsReduced, processHadronHadronSameEvent, "Process Same Event for hadron candidates", true); + PROCESS_SWITCH(HfDerivedDataCreatorCorrelationsReduced, processHadronHadronSameEvent, "Process Same Event for hadron candidates", false); // Hadron Hadron Mixed Event void processHadronHadronMixedEvent(CollsWithCentMult::iterator const& coll, From a980e1519abfd3e59ad6c8d3d30b2ab6665ef1e9 Mon Sep 17 00:00:00 2001 From: fuchuncui <162277233+fuchuncui@users.noreply.github.com> Date: Sun, 12 Oct 2025 12:10:38 +0800 Subject: [PATCH 721/986] [PWGCF] Fix two bugs at flowGfwOmegaXi.cxx (#13337) --- PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx b/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx index 7b4dc59e5cc..c8f697d0015 100644 --- a/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx +++ b/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx @@ -423,6 +423,8 @@ struct FlowGfwOmegaXi { registry.add("QAhisto/V0/hqadcanegtoPVbefore", "", {HistType::kTH1D, {{1000, -10, 10}}}); registry.add("QAhisto/V0/hqadcanegtoPVafter", "", {HistType::kTH1D, {{1000, -10, 10}}}); // Cascade QA + registry.add("QAhisto/Xi/hqaCascRadiusbefore", "", {HistType::kTH1D, {{200, -10, 10}}}); + registry.add("QAhisto/Xi/hqaCascRadiusafter", "", {HistType::kTH1D, {{200, -10, 10}}}); registry.add("QAhisto/Xi/hqaCasccosPAbefore", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); registry.add("QAhisto/Xi/hqaCasccosPAafter", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); registry.add("QAhisto/Xi/hqaCascV0cosPAbefore", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); @@ -436,6 +438,8 @@ struct FlowGfwOmegaXi { registry.add("QAhisto/Xi/hqadcaCascV0daubefore", "", {HistType::kTH1D, {{100, 0, 1}}}); registry.add("QAhisto/Xi/hqadcaCascV0dauafter", "", {HistType::kTH1D, {{100, 0, 1}}}); + registry.add("QAhisto/Xi/hqaCascRadiusbefore", "", {HistType::kTH1D, {{200, -10, 10}}}); + registry.add("QAhisto/Xi/hqaCascRadiusafter", "", {HistType::kTH1D, {{200, -10, 10}}}); registry.add("QAhisto/Omega/hqaCasccosPAbefore", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); registry.add("QAhisto/Omega/hqaCasccosPAafter", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); registry.add("QAhisto/Omega/hqaCascV0cosPAbefore", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); @@ -996,7 +1000,7 @@ struct FlowGfwOmegaXi { if (!collision.sel8()) return; registry.fill(HIST("hEventCount"), 1.5); - if (eventSelected(collision, cent, interactionRate)) + if (!eventSelected(collision, cent, interactionRate)) return; TH1D* hLocalDensity = new TH1D("hphi", "hphi", 400, -constants::math::TwoPI, constants::math::TwoPI); loadCorrections(bc.timestamp()); @@ -1254,6 +1258,7 @@ struct FlowGfwOmegaXi { // fill QA if (cfgOutputQA) { if (isXi) { + registry.fill(HIST("QAhisto/Xi/hqaCascRadiusbefore"), casc.cascradius()); registry.fill(HIST("QAhisto/Xi/hqaCasccosPAbefore"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); registry.fill(HIST("QAhisto/Xi/hqaCascV0cosPAbefore"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); registry.fill(HIST("QAhisto/Xi/hqadcaCascV0toPVbefore"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); @@ -1262,6 +1267,7 @@ struct FlowGfwOmegaXi { registry.fill(HIST("QAhisto/Xi/hqadcaCascV0daubefore"), casc.dcaV0daughters()); } if (isOmega) { + registry.fill(HIST("QAhisto/Omega/hqaCascRadiusbefore"), casc.cascradius()); registry.fill(HIST("QAhisto/Omega/hqaCasccosPAbefore"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); registry.fill(HIST("QAhisto/Omega/hqaCascV0cosPAbefore"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); registry.fill(HIST("QAhisto/Omega/hqadcaCascV0toPVbefore"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); @@ -1326,6 +1332,7 @@ struct FlowGfwOmegaXi { // fill QA if (cfgOutputQA) { if (isXi) { + registry.fill(HIST("QAhisto/Xi/hqaCascRadiusafter"), casc.cascradius()); registry.fill(HIST("QAhisto/Xi/hqaCasccosPAafter"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); registry.fill(HIST("QAhisto/Xi/hqaCascV0cosPAafter"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); registry.fill(HIST("QAhisto/Xi/hqadcaCascV0toPVafter"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); @@ -1334,6 +1341,7 @@ struct FlowGfwOmegaXi { registry.fill(HIST("QAhisto/Xi/hqadcaCascV0dauafter"), casc.dcaV0daughters()); } if (isOmega) { + registry.fill(HIST("QAhisto/Omega/hqaCascRadiusafter"), casc.cascradius()); registry.fill(HIST("QAhisto/Omega/hqaCasccosPAafter"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); registry.fill(HIST("QAhisto/Omega/hqaCascV0cosPAafter"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); registry.fill(HIST("QAhisto/Omega/hqadcaCascV0toPVafter"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); @@ -1688,6 +1696,7 @@ struct FlowGfwOmegaXi { // fill QA if (cfgOutputQA) { if (std::abs(pdgCode) == kXiMinus) { + registry.fill(HIST("QAhisto/Xi/hqaCascRadiusbefore"), casc.dcabachtopv()); registry.fill(HIST("QAhisto/Xi/hqaCasccosPAbefore"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); registry.fill(HIST("QAhisto/Xi/hqaCascV0cosPAbefore"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); registry.fill(HIST("QAhisto/Xi/hqadcaCascV0toPVbefore"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); @@ -1696,6 +1705,7 @@ struct FlowGfwOmegaXi { registry.fill(HIST("QAhisto/Xi/hqadcaCascV0daubefore"), casc.dcaV0daughters()); } if (std::abs(pdgCode) == kOmegaMinus) { + registry.fill(HIST("QAhisto/Omega/hqaCascRadiusbefore"), casc.dcabachtopv()); registry.fill(HIST("QAhisto/Omega/hqaCasccosPAbefore"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); registry.fill(HIST("QAhisto/Omega/hqaCascV0cosPAbefore"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); registry.fill(HIST("QAhisto/Omega/hqadcaCascV0toPVbefore"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); @@ -1767,6 +1777,7 @@ struct FlowGfwOmegaXi { } // fill QA if (cfgOutputQA) { + registry.fill(HIST("QAhisto/Omega/hqaCascRadiusafter"), casc.cascradius()); registry.fill(HIST("QAhisto/Omega/hqaCasccosPAafter"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); registry.fill(HIST("QAhisto/Omega/hqaCascV0cosPAafter"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); registry.fill(HIST("QAhisto/Omega/hqadcaCascV0toPVafter"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); @@ -1789,6 +1800,7 @@ struct FlowGfwOmegaXi { } // fill QA if (cfgOutputQA) { + registry.fill(HIST("QAhisto/Omega/hqaCascRadiusafter"), casc.cascradius()); registry.fill(HIST("QAhisto/Omega/hqaCasccosPAafter"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); registry.fill(HIST("QAhisto/Omega/hqaCascV0cosPAafter"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); registry.fill(HIST("QAhisto/Omega/hqadcaCascV0toPVafter"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); @@ -1815,6 +1827,7 @@ struct FlowGfwOmegaXi { } // fill QA if (cfgOutputQA) { + registry.fill(HIST("QAhisto/Xi/hqaCascRadiusafter"), casc.cascradius()); registry.fill(HIST("QAhisto/Xi/hqaCasccosPAafter"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); registry.fill(HIST("QAhisto/Xi/hqaCascV0cosPAafter"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); registry.fill(HIST("QAhisto/Xi/hqadcaCascV0toPVafter"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); @@ -1836,6 +1849,7 @@ struct FlowGfwOmegaXi { registry.fill(HIST("MC/densityMCRecXi"), cascPt, nch, density, casc.mXi()); } if (cfgOutputQA) { + registry.fill(HIST("QAhisto/Xi/hqaCascRadiusafter"), casc.cascradius()); registry.fill(HIST("QAhisto/Xi/hqaCasccosPAafter"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); registry.fill(HIST("QAhisto/Xi/hqaCascV0cosPAafter"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); registry.fill(HIST("QAhisto/Xi/hqadcaCascV0toPVafter"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); From 1023ee8d48fd76e0f8836a2b6aca7a190a584bf8 Mon Sep 17 00:00:00 2001 From: Subhadeep Mandal <147193283+5ub-Man@users.noreply.github.com> Date: Sun, 12 Oct 2025 12:42:31 +0530 Subject: [PATCH 722/986] [PWGLF] Added Signal Loss and Event Loss (#13338) --- PWGLF/Tasks/Resonances/kstarqa.cxx | 115 +++++++++++++++++++++++------ 1 file changed, 92 insertions(+), 23 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarqa.cxx b/PWGLF/Tasks/Resonances/kstarqa.cxx index 36a712c26d7..c5acaef8095 100644 --- a/PWGLF/Tasks/Resonances/kstarqa.cxx +++ b/PWGLF/Tasks/Resonances/kstarqa.cxx @@ -229,22 +229,27 @@ struct Kstarqa { rEventSelection.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexZAxis}}); rEventSelection.add("hMultiplicity", "Multiplicity percentile", kTH1F, {{110, 0, 110}}); - rEventSelection.add("hEventCut", "No. of event after cuts", kTH1I, {{20, 0, 20}}); + rEventSelection.add("hEventCut", "No. of event after cuts", kTH1D, {{20, 0, 20}}); std::shared_ptr hCutFlow = rEventSelection.get(HIST("hEventCut")); - hCutFlow->GetXaxis()->SetBinLabel(1, "All Events"); - hCutFlow->GetXaxis()->SetBinLabel(2, "|Vz| < cut"); - hCutFlow->GetXaxis()->SetBinLabel(3, "sel8"); - hCutFlow->GetXaxis()->SetBinLabel(4, "kNoTimeFrameBorder"); - hCutFlow->GetXaxis()->SetBinLabel(5, "kNoITSROFrameBorder"); - hCutFlow->GetXaxis()->SetBinLabel(6, "kNoSameBunchPileup"); - hCutFlow->GetXaxis()->SetBinLabel(7, "kIsGoodITSLayersAll"); - hCutFlow->GetXaxis()->SetBinLabel(8, "Occupancy Cut"); - hCutFlow->GetXaxis()->SetBinLabel(9, "rctChecker"); - hCutFlow->GetXaxis()->SetBinLabel(10, "kIsTriggerTVX"); - hCutFlow->GetXaxis()->SetBinLabel(11, "kIsGoodZvtxFT0vsPV"); - hCutFlow->GetXaxis()->SetBinLabel(12, "IsINELgt0"); - hCutFlow->GetXaxis()->SetBinLabel(13, "isVertexITSTPC"); - hCutFlow->GetXaxis()->SetBinLabel(14, "isVertexTOFMatched"); + std::vector eveCutLabels = { + "All Events", + Form("|Vz| < %.1f", selectionConfig.cutzvertex.value), + "sel8", + "kNoTimeFrameBorder", + "kNoITSROFrameBorder", + "kNoSameBunchPileup", + "kIsGoodITSLayersAll", + Form("Occupancy < %.0f", selectionConfig.configOccCut.value), + "rctChecker", + "kIsTriggerTVX", + "kIsGoodZvtxFT0vsPV", + "IsINELgt0", + "isVertexITSTPC", + "isVertexTOFMatched"}; + // assign labels + for (size_t i = 0; i < eveCutLabels.size(); ++i) { + hCutFlow->GetXaxis()->SetBinLabel(i + 1, eveCutLabels[i].c_str()); + } // for primary tracksbinsMultPlot if (cQAplots) { @@ -322,8 +327,6 @@ struct Kstarqa { hInvMass.add("h1RecMult", "Multiplicity reconstructed", kTH1F, {multiplicityAxis}); hInvMass.add("h1RecMult2", "Multiplicity reconstructed", kTH1F, {multiplicityAxis}); hInvMass.add("h1KSRecsplit", "KS meson Rec split", kTH1F, {{100, 0.0f, 10.0f}}); - hInvMass.add("MCcorrections/hSignalLossDenominator", "Kstar generated before event selection", kTH2F, {{ptAxis}, {multiplicityAxis}}); - hInvMass.add("MCcorrections/hSignalLossNumerator", "Kstar generated after event selection", kTH2F, {{ptAxis}, {multiplicityAxis}}); // hInvMass.add("hAllGenCollisionsImpact", "All generated collisions vs impact parameter", kTH1F, {multiplicityAxis}); hInvMass.add("hAllGenCollisions", "All generated events", kTH1F, {multiplicityAxis}); hInvMass.add("hAllGenCollisions1Rec", "All gen events with at least one rec event", kTH1F, {multiplicityAxis}); @@ -331,12 +334,27 @@ struct Kstarqa { hInvMass.add("hAllKstarGenCollisisons1Rec", "All generated Kstar in events with at least one rec event in rapidity in 0.5", kTH2F, {{multiplicityAxis}, {ptAxis}}); hInvMass.add("hAllRecCollisions", "All reconstructed events", kTH1F, {multiplicityAxis}); hInvMass.add("hAllRecCollisionsCalib", "All reconstructed events", kTH1F, {multiplicityAxis}); - hInvMass.add("MCcorrections/hImpactParameterRec", "Impact parameter in reconstructed MC", kTH1F, {impactParAxis}); - hInvMass.add("MCcorrections/MultiplicityRec", "Multiplicity in generated MC with at least 1 reconstruction", kTH1F, {multiplicityAxis}); - hInvMass.add("MCcorrections/MultiplicityRec2", "Multiplicity in reconstructed MC", kTH1F, {multiplicityAxis}); - hInvMass.add("MCcorrections/hImpactParameterGen", "Impact parameter in generated MC", kTH1F, {impactParAxis}); - hInvMass.add("MCcorrections/MultiplicityGen", "Multiplicity in generated MC", kTH1F, {multiplicityAxis}); - hInvMass.add("MCcorrections/hImpactParametervsMultiplicity", "Impact parameter vs multiplicity in reconstructed MC", kTH2F, {{impactParAxis}, {multiplicityAxis}}); + + if (doprocessEvtLossSigLossMC || doprocessEvtLossSigLossMCPhi) { + hInvMass.add("MCcorrections/hSignalLossDenominator", "Kstar generated before event selection", kTH2F, {{ptAxis}, {multiplicityAxis}}); + hInvMass.add("MCcorrections/hSignalLossNumerator", "Kstar generated after event selection", kTH2F, {{ptAxis}, {multiplicityAxis}}); + hInvMass.add("MCcorrections/hImpactParameterRec", "Impact parameter in reconstructed MC", kTH1F, {impactParAxis}); + hInvMass.add("MCcorrections/MultiplicityRec", "Multiplicity in generated MC with at least 1 reconstruction", kTH1F, {multiplicityAxis}); + hInvMass.add("MCcorrections/MultiplicityRec2", "Multiplicity in reconstructed MC", kTH1F, {multiplicityAxis}); + hInvMass.add("MCcorrections/hImpactParameterGen", "Impact parameter in generated MC", kTH1F, {impactParAxis}); + hInvMass.add("MCcorrections/MultiplicityGen", "Multiplicity in generated MC", kTH1F, {multiplicityAxis}); + hInvMass.add("MCcorrections/hImpactParametervsMultiplicity", "Impact parameter vs multiplicity in reconstructed MC", kTH2F, {{impactParAxis}, {multiplicityAxis}}); + } + + // Signal Loss & Event Loss in Light Ion Collisions + if (doprocessEvtLossSigLossLightIonMC) { + hInvMass.add("MCcorrections/hImpactParameterGen", "Impact parameter of generated MC events", kTH1F, {impactParAxis}); + hInvMass.add("MCcorrections/hImpactParameterRec", "Impact parameter of selected MC events", kTH1F, {impactParAxis}); + hInvMass.add("MCcorrections/hImpactParvsCentrRec", "Impact parameter of selected MC events vs centrality", kTH2F, {{multiplicityAxis}, impactParAxis}); + hInvMass.add("MCcorrections/hKstarGenBeforeEvtSel", "K*0 before event selections", kTH2F, {ptAxis, impactParAxis}); + hInvMass.add("MCcorrections/hKstarGenAfterEvtSel", "K*0 after event selections", kTH2F, {ptAxis, impactParAxis}); + } + rEventSelection.add("tracksCheckData", "No. of events in the data", kTH1I, {{10, 0, 10}}); rEventSelection.add("eventsCheckGen", "No. of events in the generated MC", kTH1I, {{10, 0, 10}}); rEventSelection.add("recMCparticles", "No. of events in the reconstructed MC", kTH1I, {{20, 0, 20}}); @@ -2110,6 +2128,57 @@ struct Kstarqa { } PROCESS_SWITCH(Kstarqa, processEvtLossSigLossMC, "Process Signal Loss, Event Loss", false); + void processEvtLossSigLossLightIonMC(aod::McCollisions::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions) + { + + // Event loss estimation + auto impactPar = mcCollision.impactParameter(); + hInvMass.fill(HIST("MCcorrections/hImpactParameterGen"), impactPar); + + bool isSelectedEvent = false; + auto centrality = -999.; + for (const auto& RecCollision : recCollisions) { + if (!RecCollision.has_mcCollision()) + continue; + if (!selectionEvent(RecCollision, false)) // don't fill event cut histogram + continue; + + if (cSelectMultEstimator == kFT0M) { + centrality = RecCollision.centFT0M(); + } else if (cSelectMultEstimator == kFT0A) { + centrality = RecCollision.centFT0A(); + } else if (cSelectMultEstimator == kFT0C) { + centrality = RecCollision.centFT0C(); + } else if (cSelectMultEstimator == kFV0A) { + centrality = RecCollision.centFV0A(); + } else { + centrality = RecCollision.centFT0M(); // default + } + + isSelectedEvent = true; + } + + if (isSelectedEvent) { + hInvMass.fill(HIST("MCcorrections/hImpactParameterRec"), impactPar); + hInvMass.fill(HIST("MCcorrections/hImpactParvsCentrRec"), centrality, impactPar); + } + + // Generated MC + for (const auto& mcPart : mcParticles) { + + if (std::abs(mcPart.y()) >= selectionConfig.rapidityMotherData || std::abs(mcPart.pdgCode()) != o2::constants::physics::kK0Star892) + continue; + + // signal loss estimation + hInvMass.fill(HIST("MCcorrections/hKstarGenBeforeEvtSel"), mcPart.pt(), impactPar); + if (isSelectedEvent) { + // signal loss estimation + hInvMass.fill(HIST("MCcorrections/hKstarGenAfterEvtSel"), mcPart.pt(), impactPar); + } + } // end loop on gen particles + } + PROCESS_SWITCH(Kstarqa, processEvtLossSigLossLightIonMC, "Process Signal Loss, Event Loss for Kstar in Light Ion", false); + void processEvtLossSigLossMCPhi(EventMCGenerated::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions) // void processEvtLossSigLossMCPhi(aod::McCollisions::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions) { From d2cc45b1521c7ec50c106ce3f46d7e42089e9a99 Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Sun, 12 Oct 2025 13:26:35 +0200 Subject: [PATCH 723/986] [PWGLF] Improve mix event weight (#13352) --- .../Strangeness/lambdaspincorrderived.cxx | 179 ++++++++---------- 1 file changed, 82 insertions(+), 97 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx index ae2e7bb34a9..770c2c7291e 100644 --- a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx @@ -67,24 +67,14 @@ struct lambdaspincorrderived { // Enable access to the CCDB for the offset and correction constants and save them in dedicated variables. Service ccdb; o2::ccdb::CcdbApi ccdbApi; - // TH3D* hweightNUAL; - // TH3D* hweightNUAAL; - // TH3D* hweight1; - // TH3D* hweight2; - // TH3D* hweight3; - // TH3D* hweight4; - // Configurable ConfWeightPathNUAL{"ConfWeightPathNUAL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; - // Configurable ConfWeightPathNUAAL{"ConfWeightPathNUAAL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; - // Configurable ConfWeightPathLL{"ConfWeightPathLL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; - // Configurable ConfWeightPathALAL{"ConfWeightPathALAL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; - // Configurable ConfWeightPathLAL{"ConfWeightPathLAL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; - // Configurable ConfWeightPathALL{"ConfWeightPathALL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; - - Configurable ConfEffPathL{"ConfEffPathL", "", "CCDB path to Eff (optional)"}; - Configurable ConfEffPathAL{"ConfEffPathAL", "", "CCDB path to Eff (optional)"}; - - TH3D* hEff_L = nullptr; - TH3D* hEff_AL = nullptr; + TH3D* hweight1; + TH3D* hweight2; + TH3D* hweight3; + TH3D* hweight4; + Configurable ConfWeightPathLL{"ConfWeightPathLL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; + Configurable ConfWeightPathALAL{"ConfWeightPathALAL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; + Configurable ConfWeightPathLAL{"ConfWeightPathLAL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; + Configurable ConfWeightPathALL{"ConfWeightPathALL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; // event sel///////// Configurable centMin{"centMin", 0, "Minimum Centrality"}; @@ -117,6 +107,10 @@ struct lambdaspincorrderived { Configurable phiMix{"phiMix", 0.1, "Phi cut on event mixing"}; Configurable massMix{"massMix", 0.0028, "Masscut on event mixing"}; + ConfigurableAxis ax_dphi_h{"ax_dphi_h", {72, 0.0, 2.0 * TMath::Pi()}, "Δφ_h"}; + ConfigurableAxis ax_deta{"ax_deta", {32, -1.6, 1.6}, "Δη"}; + ConfigurableAxis ax_ptpair{"ax_ptpair", {100, 0.0, 10.0}, "p_{T,pair} (GeV/c)"}; + // THnsparse bining ConfigurableAxis configThnAxisInvMass{"configThnAxisInvMass", {50, 1.09, 1.14}, "#it{M} (GeV/#it{c}^{2})"}; ConfigurableAxis configThnAxisR{"configThnAxisR", {80, 0.0, 8.0}, "#it{R}"}; @@ -137,12 +131,16 @@ struct lambdaspincorrderived { histos.add("ptCent", "ptCent", HistType::kTH2D, {{100, 0.0, 10.0}, {8, 0.0, 80.0}}, true); histos.add("etaCent", "etaCent", HistType::kTH2D, {{32, -0.8, 0.8}, {8, 0.0, 80.0}}, true); - // Attempted-for-replacement (Den) and Succeeded (Num) per SE leg kinematics - histos.add("hMatchDen_L", "Attempted #Lambda; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {40, -1.0, 1.0}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - histos.add("hMatchDen_AL", "Attempted #bar{#Lambda}; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {40, -1.0, 1.0}, {72, 0.0, 2.0 * TMath::Pi()}}, true); + // --- 3D SE/ME pair-space maps per category (LL, LAL, ALL, ALAL) + histos.add("SE_LL", "SE pairs LL;Δφ_h;Δη;p_{T,pair}", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); + histos.add("SE_LAL", "SE pairs LAL;Δφ_h;Δη;p_{T,pair}", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); + histos.add("SE_ALL", "SE pairs ALL;Δφ_h;Δη;p_{T,pair}", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); + histos.add("SE_ALAL", "SE pairs ALAL;Δφ_h;Δη;p_{T,pair}", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); - histos.add("hMatchNum_L", "Succeeded #Lambda; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {40, -1.0, 1.0}, {72, 0.0, 2.0 * TMath::Pi()}}, true); - histos.add("hMatchNum_AL", "Succeeded #bar{#Lambda}; p_{T}; #eta; #varphi", kTH3D, {{50, 0.0, 5.0}, {40, -1.0, 1.0}, {72, 0.0, 2.0 * TMath::Pi()}}, true); + histos.add("ME_LL", "ME pairs LL;Δφ_h;Δη;p_{T,pair}", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); + histos.add("ME_LAL", "ME pairs LAL;Δφ_h;Δη;p_{T,pair}", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); + histos.add("ME_ALL", "ME pairs ALL;Δφ_h;Δη;p_{T,pair}", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); + histos.add("ME_ALAL", "ME pairs ALAL;Δφ_h;Δη;p_{T,pair}", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); histos.add("hSparseLambdaLambda", "hSparseLambdaLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisR}, true); histos.add("hSparseLambdaAntiLambda", "hSparseLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisR}, true); @@ -181,8 +179,10 @@ struct lambdaspincorrderived { ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); LOGF(info, "Getting alignment offsets from the CCDB..."); if (useweight) { - hEff_L = ccdb->getForTimeStamp(ConfEffPathL.value, cfgCcdbParam.nolaterthan.value); - hEff_AL = ccdb->getForTimeStamp(ConfEffPathAL.value, cfgCcdbParam.nolaterthan.value); + hweight1 = ccdb->getForTimeStamp(ConfWeightPathLL.value, cfgCcdbParam.nolaterthan.value); + hweight2 = ccdb->getForTimeStamp(ConfWeightPathLAL.value, cfgCcdbParam.nolaterthan.value); + hweight3 = ccdb->getForTimeStamp(ConfWeightPathALL.value, cfgCcdbParam.nolaterthan.value); + hweight4 = ccdb->getForTimeStamp(ConfWeightPathALAL.value, cfgCcdbParam.nolaterthan.value); } } @@ -319,18 +319,26 @@ struct lambdaspincorrderived { cosThetaDiff = cosDeltaTheta_hel; } - double deltaPhi = std::abs(RecoDecay::constrainAngle(particle1Dummy.Phi(), 0.0F, harmonic) - RecoDecay::constrainAngle(particle2Dummy.Phi(), 0.0F, harmonic)); - double deltaEta = particle1Dummy.Eta() - particle2Dummy.Eta(); + // --- helper to compute pair-space variables + auto phi1h = RecoDecay::constrainAngle(particle1Dummy.Phi(), 0.0F, harmonic); + auto phi2h = RecoDecay::constrainAngle(particle2Dummy.Phi(), 0.0F, harmonic); + double dphi_h = std::abs(phi1h - phi2h); + double deta_pair = particle1Dummy.Eta() - particle2Dummy.Eta(); + double pt_pair = (particle1Dummy + particle2Dummy).Pt(); double deltaRap = std::abs(particle1Dummy.Rapidity() - particle2Dummy.Rapidity()); - double deltaR = TMath::Sqrt(deltaEta * deltaEta + deltaPhi * deltaPhi); + double deltaR = TMath::Sqrt(deta_pair * deta_pair + dphi_h * dphi_h); - double epsWeightParticle1 = 1.0; + double epsWeight = 1.0; if (useweight && datatype == 1) { - if (tag1 == 0) { - epsWeightParticle1 = hEff_L->GetBinContent(hEff_L->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic))); - } else { - epsWeightParticle1 = hEff_AL->GetBinContent(hEff_AL->FindBin(particle1.Pt(), particle1.Eta(), RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic))); + if (tag1 == 0 && tag2 == 0) { + epsWeight = hweight1->GetBinContent(hweight1->FindBin(dphi_h, deta_pair, pt_pair)); + } else if (tag1 == 0 && tag2 == 1) { + epsWeight = hweight2->GetBinContent(hweight2->FindBin(dphi_h, deta_pair, pt_pair)); + } else if (tag1 == 1 && tag2 == 0) { + epsWeight = hweight3->GetBinContent(hweight3->FindBin(dphi_h, deta_pair, pt_pair)); + } else if (tag1 == 1 && tag2 == 1) { + epsWeight = hweight4->GetBinContent(hweight4->FindBin(dphi_h, deta_pair, pt_pair)); } } @@ -341,22 +349,26 @@ struct lambdaspincorrderived { histos.fill(HIST("hSparseLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); histos.fill(HIST("hSparseRapLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); histos.fill(HIST("hSparsePairMassLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), mixpairweight); + histos.fill(HIST("SE_LL"), dphi_h, deta_pair, pt_pair); } else if (tag1 == 0 && tag2 == 1) { histos.fill(HIST("hSparseLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); histos.fill(HIST("hSparseRapLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); histos.fill(HIST("hSparsePairMassLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), mixpairweight); + histos.fill(HIST("SE_LAL"), dphi_h, deta_pair, pt_pair); } else if (tag1 == 1 && tag2 == 0) { histos.fill(HIST("hSparseAntiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); histos.fill(HIST("hSparseRapAntiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); histos.fill(HIST("hSparsePairMassAntiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), mixpairweight); + histos.fill(HIST("SE_ALL"), dphi_h, deta_pair, pt_pair); } else if (tag1 == 1 && tag2 == 1) { histos.fill(HIST("hSparseAntiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); histos.fill(HIST("hSparseRapAntiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); histos.fill(HIST("hSparsePairMassAntiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), mixpairweight); + histos.fill(HIST("SE_ALAL"), dphi_h, deta_pair, pt_pair); } } else if (datatype == 1) { double weight = mixpairweight; - weight = mixpairweight / epsWeightParticle1; + weight = mixpairweight / epsWeight; if (weight <= 0.0) { weight = 1.0; } @@ -365,21 +377,25 @@ struct lambdaspincorrderived { histos.fill(HIST("hSparseLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); histos.fill(HIST("hSparseRapLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); histos.fill(HIST("hSparsePairMassLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), weight); + histos.fill(HIST("ME_LL"), dphi_h, deta_pair, pt_pair); } else if (tag1 == 0 && tag2 == 1) { histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight); histos.fill(HIST("hSparseLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); histos.fill(HIST("hSparseRapLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); histos.fill(HIST("hSparsePairMassLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), weight); + histos.fill(HIST("ME_LAL"), dphi_h, deta_pair, pt_pair); } else if (tag1 == 1 && tag2 == 0) { histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight); histos.fill(HIST("hSparseAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); histos.fill(HIST("hSparseRapAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); histos.fill(HIST("hSparsePairMassAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), weight); + histos.fill(HIST("ME_ALL"), dphi_h, deta_pair, pt_pair); } else if (tag1 == 1 && tag2 == 1) { histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight); histos.fill(HIST("hSparseAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); histos.fill(HIST("hSparseRapAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); histos.fill(HIST("hSparsePairMassAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), weight); + histos.fill(HIST("ME_ALAL"), dphi_h, deta_pair, pt_pair); } } } @@ -606,36 +622,32 @@ struct lambdaspincorrderived { void processMEV3(EventCandidates const& collisions, AllTrackCandidates const& V0s) { - // one pool (deque) per mixing bin; each entry holds (collision index, slice of its V0s) auto nBins = colBinning.getAllBinsCount(); std::vector>> eventPools(nBins); for (auto& collision1 : collisions) { - // select mixing bin for this event const int bin = colBinning.getBin(std::make_tuple(collision1.posz(), collision1.cent())); - // --- if pool is still empty, just store this event and skip mixing + // if pool empty, push and continue if (eventPools[bin].empty()) { auto sliced = V0s.sliceBy(tracksPerCollisionV0, collision1.index()); eventPools[bin].emplace_back(collision1.index(), std::move(sliced)); - if (static_cast(eventPools[bin].size()) > nEvtMixing) { + if ((int)eventPools[bin].size() > nEvtMixing) eventPools[bin].pop_front(); - } - continue; // skip directly to the next event + continue; } - // all V0s from the current event + // current event slice auto poolA = V0s.sliceBy(tracksPerCollisionV0, collision1.index()); - // loop over same-event candidate pairs (t1,t2) - int oldindex = -555; + // loop over SE unordered pairs (t1,t2) for (auto& [t1, t2] : soa::combinations(o2::soa::CombinationsFullIndexPolicy(poolA, poolA))) { if (!selectionV0(t1) || !selectionV0(t2)) continue; if (t2.index() <= t1.index()) - continue; // unique unordered pairs + continue; if (t1.protonIndex() == t2.protonIndex()) - continue; // no shared daughter + continue; if (t1.pionIndex() == t2.pionIndex()) continue; if (t1.protonIndex() == t2.pionIndex()) @@ -643,94 +655,67 @@ struct lambdaspincorrderived { if (t1.pionIndex() == t2.protonIndex()) continue; - // --- First pass over previous events: count replacements for t1 (first leg) - int mixes = 0; - - struct PoolView { - AllTrackCandidates* pool; // pointer to slice of V0s from a prior event - int nRepl; // how many tX match t1 by checkKinematics + // scan prior events for replacements for t1 + struct PV { + AllTrackCandidates* pool; + int nRepl; }; - - std::vector usable; + std::vector usable; int totalRepl = 0; + int mixes = 0; for (auto it = eventPools[bin].rbegin(); it != eventPools[bin].rend() && mixes < nEvtMixing; ++it, ++mixes) { const int collision2idx = it->first; - auto& poolB = it->second; // V0 slice of that prior event in this bin - if (collision2idx == collision1.index()) { - continue; // skip same-event mixing - } + auto& poolB = it->second; + if (collision2idx == collision1.index()) + continue; + int nRepl = 0; for (auto& tX : poolB) { if (!selectionV0(tX)) continue; if (checkKinematics(t1, tX)) - ++nRepl; // <-- match against t1 only + ++nRepl; } - if (nRepl > 0) { - usable.push_back(PoolView{&poolB, nRepl}); + usable.push_back(PV{&poolB, nRepl}); totalRepl += nRepl; } } - // --- Track-by-track matching efficiency (count each t1 once in this event) - if (t1.index() != oldindex) { - const double phi1 = RecoDecay::constrainAngle(t1.lambdaPhi(), 0.0F, harmonic); - if (t1.v0Status() == 0) { - histos.fill(HIST("hMatchDen_L"), t1.lambdaPt(), t1.lambdaEta(), phi1); - } else { - histos.fill(HIST("hMatchDen_AL"), t1.lambdaPt(), t1.lambdaEta(), phi1); - } - - if (totalRepl > 0) { // success for this t1 this event - if (t1.v0Status() == 0) { - histos.fill(HIST("hMatchNum_L"), t1.lambdaPt(), t1.lambdaEta(), phi1); - } else { - histos.fill(HIST("hMatchNum_AL"), t1.lambdaPt(), t1.lambdaEta(), phi1); - } - } - oldindex = t1.index(); - } - if (totalRepl == 0) - continue; // no viable replacement for this t1 - - // --- Second pass: build mixed pairs (tX replaces t1), normalized per-SE-leg + continue; const float wBase = 1.0f / static_cast(totalRepl); + // emit mixed pairs: tX replaces t1; t2 stays for (auto& pv : usable) { auto& poolB = *pv.pool; for (auto& tX : poolB) { if (!selectionV0(tX)) continue; if (!checkKinematics(t1, tX)) - continue; // defensive re-check + continue; - // Build mixed pair: tX (from prior event) replaces t1; t2 stays (current event) - proton = ROOT::Math::PtEtaPhiMVector(tX.protonPt(), tX.protonEta(), tX.protonPhi(), o2::constants::physics::MassProton); - lambda = ROOT::Math::PtEtaPhiMVector(tX.lambdaPt(), tX.lambdaEta(), tX.lambdaPhi(), tX.lambdaMass()); - proton2 = ROOT::Math::PtEtaPhiMVector(t2.protonPt(), t2.protonEta(), t2.protonPhi(), o2::constants::physics::MassProton); - lambda2 = ROOT::Math::PtEtaPhiMVector(t2.lambdaPt(), t2.lambdaEta(), t2.lambdaPhi(), t2.lambdaMass()); + auto proton = ROOT::Math::PtEtaPhiMVector(tX.protonPt(), tX.protonEta(), tX.protonPhi(), o2::constants::physics::MassProton); + auto lambda = ROOT::Math::PtEtaPhiMVector(tX.lambdaPt(), tX.lambdaEta(), tX.lambdaPhi(), tX.lambdaMass()); + auto proton2 = ROOT::Math::PtEtaPhiMVector(t2.protonPt(), t2.protonEta(), t2.protonPhi(), o2::constants::physics::MassProton); + auto lambda2 = ROOT::Math::PtEtaPhiMVector(t2.lambdaPt(), t2.lambdaEta(), t2.lambdaPhi(), t2.lambdaMass()); - const float dPhi = std::fabs( - RecoDecay::constrainAngle(lambda.Phi(), 0.0F, harmonic) - - RecoDecay::constrainAngle(lambda2.Phi(), 0.0F, harmonic)); + const float dPhi = std::fabs(RecoDecay::constrainAngle(lambda.Phi(), 0.0F, harmonic) - RecoDecay::constrainAngle(lambda2.Phi(), 0.0F, harmonic)); histos.fill(HIST("deltaPhiMix"), dPhi, wBase); fillHistograms(tX.v0Status(), t2.v0Status(), lambda, lambda2, proton, proton2, 1, wBase); } } - } // end same-event pair loop - // after mixing with prior events, push current event into the pool + } + // push current event into pool auto sliced = V0s.sliceBy(tracksPerCollisionV0, collision1.index()); eventPools[bin].emplace_back(collision1.index(), std::move(sliced)); - if (static_cast(eventPools[bin].size()) > nEvtMixing) { + if ((int)eventPools[bin].size() > nEvtMixing) eventPools[bin].pop_front(); - } - } // end primary-event loop + } } - PROCESS_SWITCH(lambdaspincorrderived, processMEV3, "Process data ME", false); + PROCESS_SWITCH(lambdaspincorrderived, processMEV3, "Process data ME (first-leg, pair-3D maps)", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { From 40a29fec8222f1597d0dd5b751157ed491834c8c Mon Sep 17 00:00:00 2001 From: JimunLee Date: Sun, 12 Oct 2025 21:42:17 +0900 Subject: [PATCH 724/986] [PWGLF] Return the previous code of KstarInOO.cxx (#13349) Co-authored-by: jimun_lee --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 161 +++++---------------------- 1 file changed, 27 insertions(+), 134 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index bd5286986f5..9fc92e56d31 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -179,25 +179,16 @@ struct kstarInOO { } if (cfgMcHistos) { - histos.add("hPion_PID_Purity", "hPion_PID_Purity", kTH1F, {{3, -1.5, 1.5}}); - histos.add("hKaon_PID_Purity", "hKaon_PID_Purity", kTH1F, {{3, -1.5, 1.5}}); - histos.add("hSimplePion_PID_Purity", "hSimplePion_PID_Purity", kTH1F, {{3, -1.5, 1.5}}); - histos.add("hSimpleKaon_PID_Purity", "hSimpleKaon_PID_Purity", kTH1F, {{3, -1.5, 1.5}}); histos.add("nEvents_MC", "nEvents_MC", kTH1F, {{4, 0.0, 4.0}}); histos.add("nEvents_MC_True", "nEvents_MC_True", kTH1F, {{4, 0.0, 4.0}}); - histos.add("hMC_kstar_True", "hMC_kstar_True", kTHnSparseF, {cfgCentAxis, ptAxis}); + histos.add("hMC_USS", "hMC_USS", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_LSS", "hMC_LSS", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_USS_Mix", "hMC_USS_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_LSS_Mix", "hMC_LSS_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); histos.add("hMC_USS_True", "hMC_USS_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_USS_KPi", "hMC_USS_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_USS_PiK", "hMC_USS_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_LSS_KPi", "hMC_LSS_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_LSS_PiK", "hMC_LSS_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_USS_KPi_Mix", "hMC_USS_KPi_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_USS_PiK_Mix", "hMC_USS_PiK_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_USS_KPi_True", "hMC_USS_KPi_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_USS_PiK_True", "hMC_USS_PiK_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); } } // end of init @@ -382,8 +373,7 @@ struct kstarInOO { auto centrality = collision1.centFT0C(); for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - - auto [KstarPt, Minv] = minvReconstruction(trk1, trk2, QA, false); + auto [KstarPt, Minv] = minvReconstruction(trk1, trk2, QA); double conjugate = trk1.sign() * trk2.sign(); if (cfgDataHistos) { @@ -413,36 +403,26 @@ struct kstarInOO { auto tracks2 = pionMC->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); auto centrality = collision1.centFT0C(); - std::vector mcMemory; - std::vector PIDPurityKey_Kaon; - std::vector PIDPurityKey_Pion; - - double KstarPt_Kpi, Minv_Kpi; - for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) continue; - - // auto [KstarPt_Kpi, Minv_Kpi] = minvReconstruction(trk1, trk2, QA, false); - // auto [KstarPt_piK, Minv_piK] = minvReconstruction(trk1, trk2, QA, true); - - std::tie(KstarPt_Kpi, Minv_Kpi) = minvReconstruction(trk1, trk2, QA, false); - std::tie(KstarPt_Kpi, Minv_Kpi) = minvReconstruction(trk1, trk2, QA, true); - - if (Minv_Kpi < 0) - continue; + auto [KstarPt_Kpi, Minv_Kpi] = minvReconstruction(trk1, trk2, QA); double conjugate = trk1.sign() * trk2.sign(); if (cfgMcHistos) { - if (!IsMix) { - if (conjugate < 0) { - histos.fill(HIST("hMC_USS_KPi"), centrality, KstarPt_Kpi, Minv_Kpi); - } else if (conjugate > 0) { - histos.fill(HIST("hMC_LSS_KPi"), centrality, KstarPt_Kpi, Minv_Kpi); - } - } else { - if (conjugate < 0) { - histos.fill(HIST("hMC_USS_KPi_Mix"), centrality, KstarPt_Kpi, Minv_Kpi); + if (Minv_Kpi > 0) { + if (!IsMix) { + if (conjugate < 0) { + histos.fill(HIST("hMC_USS"), centrality, KstarPt_Kpi, Minv_Kpi); + } else if (conjugate > 0) { + histos.fill(HIST("hMC_LSS"), centrality, KstarPt_Kpi, Minv_Kpi); + } + } else { + if (conjugate < 0) { + histos.fill(HIST("hMC_USS_Mix"), centrality, KstarPt_Kpi, Minv_Kpi); + } else if (conjugate > 0) { + histos.fill(HIST("hMC_LSS_Mix"), centrality, KstarPt_Kpi, Minv_Kpi); + } } } } @@ -454,8 +434,6 @@ struct kstarInOO { if (!particle1.has_mothers() || !particle2.has_mothers()) { continue; } - int mcindex1 = trk1.globalIndex(); - int mcindex2 = trk2.globalIndex(); std::vector mothers1{}; std::vector mothers1PDG{}; @@ -479,85 +457,30 @@ struct kstarInOO { if (mothers1[0] != mothers2[0]) continue; // Kaon and pion not from the same K*0 - if (std::fabs(particle1.pdgCode()) != 211 && std::fabs(particle1.pdgCode()) != 321) - continue; - if (std::fabs(particle2.pdgCode()) != 211 && std::fabs(particle2.pdgCode()) != 321) - continue; - - double track1_mass, track2_mass; - bool track1f{false}; // true means pion - - if (std::fabs(particle1.pdgCode()) == 211) { - track1f = true; - track1_mass = massPi; - } else { - track1_mass = massKa; - } - - if (std::fabs(particle2.pdgCode()) == 211) { - track2_mass = massPi; - } else { - track2_mass = massKa; - } - - if (track1_mass == track2_mass) { - return; - } - - bool exists1 = std::find(mcMemory.begin(), mcMemory.end(), mcindex1) != mcMemory.end(); - bool exists2 = std::find(mcMemory.begin(), mcMemory.end(), mcindex2) != mcMemory.end(); - if (exists1 || exists2) { - continue; - } else { - mcMemory.push_back(trk1.globalIndex()); - mcMemory.push_back(trk2.globalIndex()); - } - - TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; - lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), track1_mass); - lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), track2_mass); - lResonance = lDecayDaughter1 + lDecayDaughter2; - if (cfgMcHistos) { - histos.fill(HIST("hMC_USS_True"), centrality, lResonance.Pt(), lResonance.M()); - if (track1f) { - histos.fill(HIST("hMC_USS_PiK_True"), centrality, lResonance.Pt(), lResonance.M()); - } else { - histos.fill(HIST("hMC_USS_KPi_True"), centrality, lResonance.Pt(), lResonance.M()); - } + histos.fill(HIST("hMC_USS_True"), centrality, KstarPt_Kpi, Minv_Kpi); } //====================== } // for } // TrackSlicingMC template - std::pair minvReconstruction(const TracksType& trk1, const TracksType& trk2, const bool QA, const bool flip) + std::pair minvReconstruction(const TracksType& trk1, const TracksType& trk2, const bool QA) { if (!trackSelection(trk1, false) || !trackSelection(trk2, false)) return {-1.0, -1.0}; - if (!flip) { - if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA)) { - return {-1.0, -1.0}; - } - } else { - if (!trackPIDPion(trk1, false) || !trackPIDKaon(trk2, false)) - return {-1.0, -1.0}; + if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA)) { + return {-1.0, -1.0}; } - // if (trk1.globalIndex() == trk2.globalIndex()) - // return {-1.0, -1.0}; - if (trk1.index() >= trk2.index()) + if (trk1.globalIndex() == trk2.globalIndex()) return {-1.0, -1.0}; TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; - if (!flip) { - lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa); - lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massPi); - } else { - lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massPi); - lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massKa); - } + lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa); + lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massPi); + lResonance = lDecayDaughter1 + lDecayDaughter2; if (std::abs(lResonance.Eta()) > cfgTrackMaxEta) @@ -669,36 +592,6 @@ struct kstarInOO { if (!INELgt0) return; - auto tracks1 = kaonMC->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - for (const auto& kaon : tracks1) { - if (!trackSelection(kaon, false)) - continue; - if (!trackPIDKaon(kaon, false)) - continue; - auto particle1 = kaon.mcParticle(); - if (std::fabs(particle1.pdgCode()) == 321) - histos.fill(HIST("hSimpleKaon_PID_Purity"), 1); // histogram with two bins, -1.5, 1.5 fill 1 or -1 - else if (std::fabs(particle1.pdgCode()) == 211) - histos.fill(HIST("hSimpleKaon_PID_Purity"), -1); // histogram with two bins, -1.5, 1.5 fill 1 or -1 - else - histos.fill(HIST("hSimpleKaon_PID_Purity"), 0); // histogram with two bins, -1.5, 1.5 fill 1 or -1 - } - - auto tracks2 = pionMC->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - for (const auto& pion : tracks2) { - if (!trackSelection(pion, false)) - continue; - if (!trackPIDPion(pion, false)) - continue; - auto particle2 = pion.mcParticle(); - if (std::fabs(particle2.pdgCode()) == 211) - histos.fill(HIST("hSimplePion_PID_Purity"), 1); // histogram with two bins, -1.5, 1.5 fill 1 or -1 - else if (std::fabs(particle2.pdgCode()) == 321) - histos.fill(HIST("hSimplePion_PID_Purity"), -1); // histogram with two bins, -1.5, 1.5 fill 1 or -1 - else - histos.fill(HIST("hSimplePion_PID_Purity"), 0); // histogram with two bins, -1.5, 1.5 fill 1 or -1 - } - if (cfgMcHistos) { histos.fill(HIST("nEvents_MC"), 1.5); } From 475dab0c4db2e7b7e639386b02a2a92e3d27e505 Mon Sep 17 00:00:00 2001 From: suyoupeng <109774812+15071832337@users.noreply.github.com> Date: Sun, 12 Oct 2025 22:22:46 +0800 Subject: [PATCH 725/986] [PWGLF] Local polarization of Lambda induced by jets in Run3 pp collisions at 13.6 TeV (#13341) --- .../Strangeness/lambdaJetpolarization.cxx | 79 +++++++++++++++++-- 1 file changed, 72 insertions(+), 7 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx b/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx index 2e66bc08385..0dab522e35f 100644 --- a/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx @@ -245,8 +245,8 @@ struct LfMyV0s { registryData.add("LambdaPtMass", "LambdaPtMass", HistType::kTH2F, {ptAxis, invMassLambdaAxis}); registryData.add("AntiLambdaPtMass", "AntiLambdaPtMass", HistType::kTH2F, {ptAxis, invMassLambdaAxis}); - registryData.add("hMassLambda", "hMassLambda", {HistType::kTH1F, {{200, 0.9f, 1.2f}}}); - registryData.add("hMassAntiLambda", "hMassAntiLambda", {HistType::kTH1F, {{200, 0.9f, 1.2f}}}); + registryData.add("hMassLambda", "hMassLambda", {HistType::kTH1F, {{invMassLambdaAxis}}}); + registryData.add("hMassAntiLambda", "hMassAntiLambda", {HistType::kTH1F, {{invMassLambdaAxis}}}); registryData.add("V0pTInLab", "V0pTInLab", kTH1F, {axisPT}); registryData.add("V0pxInLab", "V0pxInLab", kTH1F, {axisPx}); @@ -267,6 +267,11 @@ struct LfMyV0s { registryData.add("protonQA/profileprotonsinthetaInLab", "Invariant Mass vs sin(theta)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); registryData.add("protonQA/profileprotonsinphiInLab", "Invariant Mass vs sin(phi)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); registryData.add("protonQA/profileprotoncosSquarethetaInLab", "Invariant Mass vs cos^2(theta)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); + registryData.add("JetQA/JetthetaInLab", "JetthetaInLab", kTH1F, {axisTheta}); + registryData.add("JetQA/JetphiInLab", "JetphiInLab", kTH1F, {axisPhi}); + registryData.add("JetQA/JetpxInLab", "JetpxInLab", kTH1F, {axisPx}); + registryData.add("JetQA/JetpyInLab", "JetpyInLab", kTH1F, {axisPy}); + registryData.add("JetQA/JetpzInLab", "JetpzInLab", kTH1F, {axisPz}); registryData.add("protonQA/V0protonpxInRest_frame", "V0protonpxInRest_frame", kTH1F, {axisPx}); registryData.add("protonQA/V0protonpyInRest_frame", "V0protonpyInRest_frame", kTH1F, {axisPy}); @@ -278,6 +283,11 @@ struct LfMyV0s { registryData.add("protonQA/profileprotonsinthetaInV0frame", "Invariant Mass vs sin(theta)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); registryData.add("protonQA/profileprotonsinphiInV0frame", "Invariant Mass vs sin(phi)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); registryData.add("protonQA/profileprotoncosSquarethetaInV0frame", "Invariant Mass vs cos^2(theta)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); + registryData.add("JetQA/JetthetaInV0", "JetthetaInV0", kTH1F, {axisTheta}); + registryData.add("JetQA/JetphiInV0", "JetphiInV0", kTH1F, {axisPhi}); + registryData.add("JetQA/JetpxInV0", "JetpxInV0", kTH1F, {axisPx}); + registryData.add("JetQA/JetpyInV0", "JetpyInV0", kTH1F, {axisPy}); + registryData.add("JetQA/JetpzInV0", "JetpzInV0", kTH1F, {axisPz}); registryData.add("protonQA/V0protonpxInJetframe", "V0protonpxInJetframe", kTH1F, {axisPx}); registryData.add("protonQA/V0protonpyInJetframe", "V0protonpyInJetframe", kTH1F, {axisPy}); @@ -289,6 +299,11 @@ struct LfMyV0s { registryData.add("protonQA/profileprotonsinphiInJetframe", "Invariant Mass vs sin(phi)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); registryData.add("protonQA/profileprotoncosSquarethetaInJetframe", "Invariant Mass vs cos^2(theta)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); registryData.add("protonQA/V0protonMassInJetframe", "V0protonMassInJetframe", kTH1F, {axisMass}); + registryData.add("JetQA/JetthetaInJetframe", "JetthetaInJetframe", kTH1F, {axisTheta}); + registryData.add("JetQA/JetphiInJetframe", "JetphiInJetframe", kTH1F, {axisPhi}); + registryData.add("JetQA/JetpxInJetframe", "JetpxInJetframe", kTH1F, {axisPx}); + registryData.add("JetQA/JetpyInJetframe", "JetpyInJetframe", kTH1F, {axisPy}); + registryData.add("JetQA/JetpzInJetframe", "JetpzInJetframe", kTH1F, {axisPz}); registryData.add("protonQA/V0protonpxInJetV0frame", "V0protonpxInJetV0frame", kTH1F, {axisPx}); registryData.add("protonQA/V0protonpyInJetV0frame", "V0protonpyInJetV0frame", kTH1F, {axisPy}); @@ -300,6 +315,11 @@ struct LfMyV0s { registryData.add("protonQA/profileprotonsinthetaInJetV0frame", "Invariant Mass vs sin(theta)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); registryData.add("protonQA/profileprotonsinphiInJetV0frame", "Invariant Mass vs sin(phi)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); registryData.add("protonQA/profileprotoncosSquarethetaInJetV0frame", "Invariant Mass vs cos^2(theta)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); + registryData.add("JetQA/JetthetaInJetV0frame", "JetthetaInJetV0frame", kTH1F, {axisTheta}); + registryData.add("JetQA/JetphiInJetV0frame", "JetphiInJetV0frame", kTH1F, {axisPhi}); + registryData.add("JetQA/JetpxInJetV0frame", "JetpxInJetV0frame", kTH1F, {axisPx}); + registryData.add("JetQA/JetpyInJetV0frame", "JetpyInJetV0frame", kTH1F, {axisPy}); + registryData.add("JetQA/JetpzInJetV0frame", "JetpzInJetV0frame", kTH1F, {axisPz}); registryData.add("V0LambdapxInJetV0frame", "V0LambdapxInJetV0frame", kTH1F, {axisPx}); registryData.add("V0LambdapyInJetV0frame", "V0LambdapyInJetV0frame", kTH1F, {axisPy}); @@ -376,7 +396,7 @@ struct LfMyV0s { registryV0Data.add("hprotoncosthetainLab", "hprotoncosthetainLab", kTH1F, {{200, -1.f, 1.f}}); registryV0Data.add("hprotonsinthetainLab", "hprotonsinthetainLab", kTH1F, {{200, -1.f, 1.f}}); - registryV0Data.add("hprotonthetainLab", "hprotonthetainLab", kTH1F, {{200, 0.f, TMath::Pi()}}); + registryV0Data.add("hprotonthetainLab", "hprotonthetainLab", kTH1F, {axisTheta}); registryV0Data.add("hprotoncosthetainV0", "hprotoncosthetainV0", kTH1F, {{200, -1.f, 1.f}}); registryV0Data.add("hprotonsinthetainV0", "hprotonsinthetainV0", kTH1F, {{200, -1.f, 1.f}}); @@ -1516,6 +1536,7 @@ struct LfMyV0s { float maxJetpz = 0; float maxJeteta = 0; float maxJetphi = 0; + float maxJetE = 0; float maxJetpT = 0; float maxJetPt = -999; for (auto& jet : jets) { @@ -1541,6 +1562,7 @@ struct LfMyV0s { maxJetpy = jet.py(); maxJetpz = jet.pz(); maxJeteta = jet.eta(); + maxJetE = jet.E(); maxJetphi = jet.phi(); maxJetpT = jet.pt(); maxJetPt = maxJetpT; @@ -1609,6 +1631,12 @@ struct LfMyV0s { double ELambda = sqrt(candidate.mLambda() * candidate.mLambda() + PLambda * PLambda); double protonE = sqrt(massPr * massPr + pos.px() * pos.px() + pos.py() * pos.py() + pos.pz() * pos.pz()); + TMatrixD pLabJet(4, 1); + pLabJet(0, 0) = maxJetE; + pLabJet(1, 0) = maxJetpx; + pLabJet(2, 0) = maxJetpy; + pLabJet(3, 0) = maxJetpz; + TMatrixD pLabV0(4, 1); pLabV0(0, 0) = ELambda; pLabV0(1, 0) = candidate.px(); @@ -1641,9 +1669,16 @@ struct LfMyV0s { double protonPInLab = sqrt(pLabproton(1, 0) * pLabproton(1, 0) + pLabproton(2, 0) * pLabproton(2, 0) + pLabproton(3, 0) * pLabproton(3, 0)); double protonsinThetaInLab = protonPtInLab / protonPInLab; double protonMassInLab = sqrt(pLabproton(0, 0) * pLabproton(0, 0) - pLabproton(1, 0) * pLabproton(1, 0) - pLabproton(2, 0) * pLabproton(2, 0) - pLabproton(3, 0) * pLabproton(3, 0)); + double jettheta = maxJetpz / sqrt(pLabJet(1, 0) * pLabJet(1, 0) + pLabJet(2, 0) * pLabJet(2, 0) + pLabJet(3, 0) * pLabJet(3, 0)); + double jetphi = maxJetpy / sqrt(pLabJet(1, 0) * pLabJet(1, 0) + pLabJet(2, 0) * pLabJet(2, 0)); + registryData.fill(HIST("JetQA/JetthetaInLab"), TMath::ASin(jettheta)); + registryData.fill(HIST("JetQA/JetphiInLab"), TMath::ASin(jetphi)); + registryData.fill(HIST("JetQA/JetpxInLab"), pLabJet(1, 0)); + registryData.fill(HIST("JetQA/JetpyInLab"), pLabJet(2, 0)); + registryData.fill(HIST("JetQA/JetpzInLab"), pLabJet(3, 0)); registryData.fill(HIST("protonQA/V0protonphiInLab"), TMath::ASin(protonsinPhiInLab)); - registryData.fill(HIST("protonQA/V0protonThetaInLab"), TMath::ASin(protonsinThetaInLab)); + registryData.fill(HIST("protonQA/V0protonthetaInLab"), TMath::ASin(protonsinThetaInLab)); registryData.fill(HIST("protonQA/V0protoncosthetaInLab"), protoncosthetaInLab); registryData.fill(HIST("protonQA/profileprotonsinthetaInLab"), candidate.mLambda(), protonsinThetaInLab); registryData.fill(HIST("protonQA/profileprotonsinphiInLab"), candidate.mLambda(), protonsinPhiInLab); @@ -1657,6 +1692,16 @@ struct LfMyV0s { double protonPtInV0 = sqrt(protonInV0(1, 0) * protonInV0(1, 0) + protonInV0(2, 0) * protonInV0(2, 0)); double protonsinThetaInV0 = protonPtInV0 / protonPInV0; + TMatrixD JetInV0(4, 1); + JetInV0 = LorentzTransInV0frame(ELambda, candidate.px(), candidate.py(), candidate.pz()) * pLabJet; + double jetthetaInV0 = JetInV0(3, 0) / sqrt(JetInV0(1, 0) * JetInV0(1, 0) + JetInV0(2, 0) * JetInV0(2, 0) + JetInV0(3, 0) * JetInV0(3, 0)); + double jetphiInV0 = JetInV0(2, 0) / sqrt(JetInV0(1, 0) * JetInV0(1, 0) + JetInV0(2, 0) * JetInV0(2, 0)); + registryData.fill(HIST("JetQA/JetthetaInV0"), TMath::ASin(jetthetaInV0)); + registryData.fill(HIST("JetQA/JetphiInV0"), TMath::ASin(jetphiInV0)); + registryData.fill(HIST("JetQA/JetpxInV0"), JetInV0(1, 0)); + registryData.fill(HIST("JetQA/JetpyInV0"), JetInV0(2, 0)); + registryData.fill(HIST("JetQA/JetpzInV0"), JetInV0(3, 0)); + registryData.fill(HIST("protonQA/V0protonMassInRest_frame"), protonMassInV0); registryData.fill(HIST("protonQA/V0protonpxInRest_frame"), protonInV0(1, 0)); registryData.fill(HIST("protonQA/V0protonpyInRest_frame"), protonInV0(2, 0)); @@ -1664,7 +1709,7 @@ struct LfMyV0s { double protonsinPhiInV0frame = protonInV0(2, 0) / sqrt(protonInV0(1, 0) * protonInV0(1, 0) + protonInV0(2, 0) * protonInV0(2, 0)); double protoncosthetaInV0frame = protonInV0(3, 0) / sqrt(protonInV0(1, 0) * protonInV0(1, 0) + protonInV0(2, 0) * protonInV0(2, 0) + protonInV0(3, 0) * protonInV0(3, 0)); registryData.fill(HIST("protonQA/V0protonphiInRest_frame"), TMath::ASin(protonsinPhiInV0frame)); - registryData.fill(HIST("protonQA/V0protonThetaInRest_frame"), TMath::ASin(protonsinThetaInV0)); + registryData.fill(HIST("protonQA/V0protonthetaInRest_frame"), TMath::ASin(protonsinThetaInV0)); registryData.fill(HIST("protonQA/V0protoncosthetaInV0frame"), protoncosthetaInV0frame); registryData.fill(HIST("protonQA/profileprotonsinthetaInV0frame"), candidate.mLambda(), protonsinThetaInV0); registryData.fill(HIST("protonQA/profileprotonsinphiInV0frame"), candidate.mLambda(), protonsinPhiInV0frame); @@ -1679,11 +1724,21 @@ struct LfMyV0s { double protonSinThetainJet = protonPtinJet / protonPinJet; double protonMassInJetframe = sqrt(protonInJet(0, 0) * protonInJet(0, 0) - protonInJet(1, 0) * protonInJet(1, 0) - protonInJet(2, 0) * protonInJet(2, 0) - protonInJet(3, 0) * protonInJet(3, 0)); + TMatrixD pInJet(4, 1); + pInJet = MyTMatrixTranslationToJet(maxJetpx, maxJetpy, maxJetpz, candidate.px(), candidate.py(), candidate.pz()) * pLabJet; + double jetthetaInJet = pInJet(3, 0) / sqrt(pInJet(1, 0) * pInJet(1, 0) + pInJet(2, 0) * pInJet(2, 0) + pInJet(3, 0) * pInJet(3, 0)); + double jetphiInJet = pInJet(2, 0) / sqrt(pInJet(1, 0) * pInJet(1, 0) + pInJet(2, 0) * pInJet(2, 0)); + registryData.fill(HIST("JetQA/JetthetaInJetframe"), TMath::ASin(jetthetaInJet)); + registryData.fill(HIST("JetQA/JetphiInJetframe"), TMath::ASin(jetphiInJet)); + registryData.fill(HIST("JetQA/JetpxInJetframe"), pInJet(1, 0)); + registryData.fill(HIST("JetQA/JetpyInJetframe"), pInJet(2, 0)); + registryData.fill(HIST("JetQA/JetpzInJetframe"), pInJet(3, 0)); + registryData.fill(HIST("protonQA/V0protonpxInJetframe"), protonInJet(1, 0)); registryData.fill(HIST("protonQA/V0protonpyInJetframe"), protonInJet(2, 0)); registryData.fill(HIST("protonQA/V0protonpzInJetframe"), protonInJet(3, 0)); registryData.fill(HIST("protonQA/V0protonphiInJetframe"), TMath::ASin(protonsinPhiInJet)); - registryData.fill(HIST("protonQA/V0protonThetaInJetframe"), TMath::ASin(protonSinThetainJet)); + registryData.fill(HIST("protonQA/V0protonthetaInJetframe"), TMath::ASin(protonSinThetainJet)); registryData.fill(HIST("protonQA/V0protoncosthetaInJetframe"), protoncosthetaInJet); registryData.fill(HIST("protonQA/profileprotonsinthetaInJetframe"), candidate.mLambda(), protonSinThetainJet); registryData.fill(HIST("protonQA/profileprotonsinphiInJetframe"), candidate.mLambda(), protonsinPhiInJet); @@ -1699,11 +1754,21 @@ struct LfMyV0s { double protonSinThetainJetV0 = protonPtinJetV0 / protonPinJetV0; double protonMassInJetV0frame = sqrt(protonInJetV0(0, 0) * protonInJetV0(0, 0) - protonInJetV0(1, 0) * protonInJetV0(1, 0) - protonInJetV0(2, 0) * protonInJetV0(2, 0) - protonInJetV0(3, 0) * protonInJetV0(3, 0)); + TMatrixD JetInJetV0(4, 1); + JetInJetV0 = LorentzTransInV0frame(ELambda, lambdaInJet(1, 0), lambdaInJet(2, 0), lambdaInJet(3, 0)) * MyTMatrixTranslationToJet(maxJetpx, maxJetpy, maxJetpz, candidate.px(), candidate.py(), candidate.pz()) * pLabJet; + double jetthetaInJetV0 = JetInJetV0(3, 0) / sqrt(JetInJetV0(1, 0) * JetInJetV0(1, 0) + JetInJetV0(2, 0) * JetInJetV0(2, 0) + JetInJetV0(3, 0) * JetInJetV0(3, 0)); + double jetphiInJetV0 = JetInJetV0(2, 0) / sqrt(JetInJetV0(1, 0) * JetInJetV0(1, 0) + JetInJetV0(2, 0) * JetInJetV0(2, 0)); + registryData.fill(HIST("JetQA/JetthetaInJetV0frame"), TMath::ASin(jetthetaInJetV0)); + registryData.fill(HIST("JetQA/JetphiInJetV0frame"), TMath::ASin(jetphiInJetV0)); + registryData.fill(HIST("JetQA/JetpxInJetV0frame"), JetInJetV0(1, 0)); + registryData.fill(HIST("JetQA/JetpyInJetV0frame"), JetInJetV0(2, 0)); + registryData.fill(HIST("JetQA/JetpzInJetV0frame"), JetInJetV0(3, 0)); + registryData.fill(HIST("protonQA/V0protonpxInJetV0frame"), protonInJetV0(1, 0)); registryData.fill(HIST("protonQA/V0protonpyInJetV0frame"), protonInJetV0(2, 0)); registryData.fill(HIST("protonQA/V0protonpzInJetV0frame"), protonInJetV0(3, 0)); registryData.fill(HIST("protonQA/V0protonphiInJetV0frame"), TMath::ASin(protonsinphiInJetV0)); - registryData.fill(HIST("protonQA/V0protonThetaInJetV0frame"), TMath::ASin(protonSinThetainJetV0)); + registryData.fill(HIST("protonQA/V0protonthetaInJetV0frame"), TMath::ASin(protonSinThetainJetV0)); registryData.fill(HIST("protonQA/V0protoncosthetaInJetV0"), protoncosthetaInJetV0); registryData.fill(HIST("protonQA/V0protonMassInJetV0frame"), protonMassInJetV0frame); registryData.fill(HIST("protonQA/profileprotonsinthetaInJetV0frame"), candidate.mLambda(), protonSinThetainJetV0); From 8e4454ce1060d3e92b629470fe96535cc0be1e85 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sun, 12 Oct 2025 23:10:42 +0200 Subject: [PATCH 726/986] [PWGEM/Dilepton] fix axis titles (#13360) Co-authored-by: ALICE Action Bot --- PWGEM/Dilepton/Core/Dilepton.h | 6 +++--- PWGEM/Dilepton/Core/DileptonMC.h | 4 ++-- PWGEM/Dilepton/Core/SingleTrackQC.h | 6 +++--- PWGEM/Dilepton/Core/SingleTrackQCMC.h | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 8a8b8806b43..9595a43c493 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -583,7 +583,7 @@ struct Dilepton { } else { LOG(fatal) << "set 0 or 1 to cfgPolarizationFrame!"; } - const AxisSpec axis_cos_theta{ConfPolarizationCosThetaBins, Form("|cos(#theta^{%s})|", frameName.data())}; + const AxisSpec axis_cos_theta{ConfPolarizationCosThetaBins, Form("cos(#theta^{%s})", frameName.data())}; fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_cos_theta}, true); fRegistry.addClone("Pair/same/uls/", "Pair/same/lspp/"); fRegistry.addClone("Pair/same/uls/", "Pair/same/lsmm/"); @@ -615,8 +615,8 @@ struct Dilepton { LOG(fatal) << "set 0 or 1 to cfgPolarizationFrame!"; } - const AxisSpec axis_cos_theta{ConfPolarizationCosThetaBins, Form("|cos(#theta^{%s})|", frameName.data())}; - const AxisSpec axis_phi{ConfPolarizationPhiBins, Form("|#varphi^{%s}| (rad.)", frameName.data())}; + const AxisSpec axis_cos_theta{ConfPolarizationCosThetaBins, Form("cos(#theta^{%s})", frameName.data())}; + const AxisSpec axis_phi{ConfPolarizationPhiBins, Form("#varphi^{%s} (rad.)", frameName.data())}; const AxisSpec axis_quadmom{ConfPolarizationQuadMomBins, Form("#frac{3 cos^{2}(#theta^{%s}) -1}{2}", frameName.data())}; fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y, axis_cos_theta, axis_phi, axis_quadmom}, true); fRegistry.addClone("Pair/same/uls/", "Pair/same/lspp/"); diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index 3e8b51e572d..cf2c0214f0b 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -368,8 +368,8 @@ struct DileptonMC { const AxisSpec axis_dphi_ee{cfg_nbin_dphi_ee, -M_PI / 2., 3. / 2. * M_PI, "#Delta#varphi = #varphi_{l1} - #varphi_{l2} (rad.)"}; // for kHFll const AxisSpec axis_deta_ee{cfg_nbin_deta_ee, -2., 2., "#Delta#eta = #eta_{l1} - #eta_{l2}"}; // for kHFll - const AxisSpec axis_cos_theta_pol{ConfPolarizationCosThetaBins, Form("|cos(#theta^{%s})|", frameName.data())}; // for kPolarization, kUPC - const AxisSpec axis_phi_pol{ConfPolarizationPhiBins, Form("|#varphi^{%s}| (rad.)", frameName.data())}; // for kPolarization + const AxisSpec axis_cos_theta_pol{ConfPolarizationCosThetaBins, Form("cos(#theta^{%s})", frameName.data())}; // for kPolarization, kUPC + const AxisSpec axis_phi_pol{ConfPolarizationPhiBins, Form("#varphi^{%s} (rad.)", frameName.data())}; // for kPolarization const AxisSpec axis_quadmom{ConfPolarizationQuadMomBins, Form("#frac{3 cos^{2}(#theta^{%s}) -1}{2}", frameName.data())}; // for kPolarization const AxisSpec axis_aco{cfg_nbin_aco, 0, 1.f, "#alpha = 1 - #frac{|#varphi_{l^{+}} - #varphi_{l^{-}}|}{#pi}"}; // for kUPC const AxisSpec axis_asym_pt{cfg_nbin_asym_pt, 0, 1.f, "A = #frac{|p_{T,l^{+}} - p_{T,l^{-}}|}{|p_{T,l^{+}} + p_{T,l^{-}}|}"}; // for kUPC diff --git a/PWGEM/Dilepton/Core/SingleTrackQC.h b/PWGEM/Dilepton/Core/SingleTrackQC.h index d76cd2088b8..2efb5e467f0 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQC.h @@ -88,9 +88,9 @@ struct SingleTrackQC { Configurable cfgApplyWeightTTCA{"cfgApplyWeightTTCA", false, "flag to apply weighting by 1/N"}; ConfigurableAxis ConfPtlBins{"ConfPtlBins", {VARIABLE_WIDTH, 0.00, 0.05, 0.10, 0.15, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.50, 3.00, 3.50, 4.00, 4.50, 5.00, 6.00, 7.00, 8.00, 9.00, 10.00}, "pTl bins for output histograms"}; - ConfigurableAxis ConfDCA3DBins{"ConfDCA3DBins", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, "DCA3d bins in sigma for output histograms"}; - ConfigurableAxis ConfDCAXYBins{"ConfDCAXYBins", {VARIABLE_WIDTH, -10.0, -9.0, -8.0, -7.0, -6.0, -5.0, -4.5, -4.0, -3.5, -3.0, -2.5, -2.0, -1.9, -1.8, -1.7, -1.6, -1.5, -1.4, -1.3, -1.2, -1.1, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, "DCAxy bins in sigma for output histograms"}; - ConfigurableAxis ConfDCAZBins{"ConfDCAZBins", {VARIABLE_WIDTH, -10.0, -9.0, -8.0, -7.0, -6.0, -5.0, -4.5, -4.0, -3.5, -3.0, -2.5, -2.0, -1.9, -1.8, -1.7, -1.6, -1.5, -1.4, -1.3, -1.2, -1.1, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, "DCAz bins in sigma for output histograms"}; + ConfigurableAxis ConfDCA3DBins{"ConfDCA3DBins", {VARIABLE_WIDTH, 0.0, 10.0}, "DCA3d bins in sigma for output histograms"}; + ConfigurableAxis ConfDCAXYBins{"ConfDCAXYBins", {VARIABLE_WIDTH, -10.0, 10.0}, "DCAxy bins in sigma for output histograms"}; + ConfigurableAxis ConfDCAZBins{"ConfDCAZBins", {VARIABLE_WIDTH, -10.0, 10.0}, "DCAz bins in sigma for output histograms"}; EMEventCut fEMEventCut; struct : ConfigurableGroup { diff --git a/PWGEM/Dilepton/Core/SingleTrackQCMC.h b/PWGEM/Dilepton/Core/SingleTrackQCMC.h index 973eb681663..69eb429ac64 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQCMC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQCMC.h @@ -96,9 +96,9 @@ struct SingleTrackQCMC { Configurable cfgRequireTrueAssociation{"cfgRequireTrueAssociation", false, "flag to require true mc collision association"}; ConfigurableAxis ConfPtlBins{"ConfPtlBins", {VARIABLE_WIDTH, 0.00, 0.05, 0.10, 0.15, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.50, 3.00, 3.50, 4.00, 4.50, 5.00, 6.00, 7.00, 8.00, 9.00, 10.00}, "pTl bins for output histograms"}; - ConfigurableAxis ConfDCA3DBins{"ConfDCA3DBins", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, "DCA3d bins in sigma for output histograms"}; - ConfigurableAxis ConfDCAXYBins{"ConfDCAXYBins", {VARIABLE_WIDTH, -10.0, -9.0, -8.0, -7.0, -6.0, -5.0, -4.5, -4.0, -3.5, -3.0, -2.5, -2.0, -1.9, -1.8, -1.7, -1.6, -1.5, -1.4, -1.3, -1.2, -1.1, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, "DCAxy bins in sigma for output histograms"}; - ConfigurableAxis ConfDCAZBins{"ConfDCAZBins", {VARIABLE_WIDTH, -10.0, -9.0, -8.0, -7.0, -6.0, -5.0, -4.5, -4.0, -3.5, -3.0, -2.5, -2.0, -1.9, -1.8, -1.7, -1.6, -1.5, -1.4, -1.3, -1.2, -1.1, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, "DCAz bins in sigma for output histograms"}; + ConfigurableAxis ConfDCA3DBins{"ConfDCA3DBins", {VARIABLE_WIDTH, 0.0, 10.0}, "DCA3d bins in sigma for output histograms"}; + ConfigurableAxis ConfDCAXYBins{"ConfDCAXYBins", {VARIABLE_WIDTH, -10.0, 10.0}, "DCAxy bins in sigma for output histograms"}; + ConfigurableAxis ConfDCAZBins{"ConfDCAZBins", {VARIABLE_WIDTH, -10.0, 10.0}, "DCAz bins in sigma for output histograms"}; EMEventCut fEMEventCut; struct : ConfigurableGroup { From d721d3cf2638289da6995a7047e30df624767c55 Mon Sep 17 00:00:00 2001 From: jaelpark Date: Mon, 13 Oct 2025 05:30:49 +0800 Subject: [PATCH 727/986] [PWGCF] JCorran: Fix multiplicity correlations histogram naming (#13355) --- PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.cxx | 4 ++-- PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.h | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.cxx b/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.cxx index 468b2cf5cce..56c4c925a7f 100644 --- a/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.cxx +++ b/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.cxx @@ -21,6 +21,7 @@ #include using namespace o2; +using namespace o2::framework; JFFlucAnalysisO2Hist::JFFlucAnalysisO2Hist(HistogramRegistry& registry, AxisSpec& axisMultiplicity, AxisSpec& phiAxis, AxisSpec& etaAxis, AxisSpec& zvtAxis, AxisSpec& ptAxis, AxisSpec& massAxis, uint16_t multCorrMask, const TString& folder) : JFFlucAnalysis() { @@ -39,8 +40,7 @@ JFFlucAnalysisO2Hist::JFFlucAnalysisO2Hist(HistogramRegistry& registry, AxisSpec multAxes.emplace_back(100, 0, 1000, "Nch PV"); if (multCorrMask & aod::cfmultset::MultNTracksGlobal) multAxes.emplace_back(100, 0, 1000, "Nch Global"); - registry.add("multCorrelations", "Multiplicity correlations", {HistType::kTHnSparseF, multAxes}); - phs[HIST_THN_SPARSE_MULTCORR] = std::get>(registry.add(Form("%s/h_multcorr", folder.Data()), "multiplicity/centrality correlations", {HistType::kTHnSparseF, multAxes})).get(); + phs[HIST_THN_SPARSE_MULTCORR] = std::get>(registry.add(Form("%s/multCorrelations", folder.Data()), "multiplicity/centrality correlations", {HistType::kTHnSparseF, multAxes})).get(); } else { phs[HIST_THN_SPARSE_MULTCORR] = 0; } diff --git a/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.h b/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.h index 8821c64a225..867486ae90a 100644 --- a/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.h +++ b/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.h @@ -18,13 +18,10 @@ #include "Framework/HistogramRegistry.h" -using namespace o2; -using namespace o2::framework; - class JFFlucAnalysisO2Hist : public JFFlucAnalysis { public: - JFFlucAnalysisO2Hist(HistogramRegistry&, AxisSpec&, AxisSpec&, AxisSpec&, AxisSpec&, AxisSpec&, AxisSpec&, uint16_t, const TString&); + JFFlucAnalysisO2Hist(o2::framework::HistogramRegistry&, o2::framework::AxisSpec&, o2::framework::AxisSpec&, o2::framework::AxisSpec&, o2::framework::AxisSpec&, o2::framework::AxisSpec&, o2::framework::AxisSpec&, uint16_t, const TString&); ~JFFlucAnalysisO2Hist(); }; From 080c6d6254e3e1bb50d33c8a8ae1ad42ac4433e0 Mon Sep 17 00:00:00 2001 From: Francesca Ercolessi Date: Sun, 12 Oct 2025 23:32:10 +0200 Subject: [PATCH 728/986] [PWGLF] Nuspex, deuteron proton correlation: add signal loss and fix mixed event in generated collisions (#13346) --- .../Tasks/Nuspex/hadronnucleicorrelation.cxx | 639 +++++++++--------- 1 file changed, 310 insertions(+), 329 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx index ee383900901..8c3ef349645 100644 --- a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx +++ b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx @@ -27,6 +27,7 @@ #include "Framework/DataTypes.h" #include "Framework/Expressions.h" #include "Framework/HistogramRegistry.h" +#include "Framework/O2DatabasePDGPlugin.h" #include "Framework/StaticFor.h" #include "Framework/runDataProcessing.h" #include "MathUtils/Utils.h" @@ -105,6 +106,7 @@ struct hadronnucleicorrelation { // Mixing parameters Configurable _vertexNbinsToMix{"vertexNbinsToMix", 10, "Number of vertexZ bins for the mixing"}; Configurable _multNsubBins{"multSubBins", 10, "number of sub-bins to perform the mixing within"}; + Configurable maxmultmix{"maxmultmix", 20, "maximum multiplicity to mix"}; // pT/A bins Configurable> pTBins{"pTBins", {0.6f, 1.0f, 1.2f, 2.f}, "p_{T} bins"}; @@ -139,25 +141,16 @@ struct hadronnucleicorrelation { std::map> selectedparticlesMC_antid; std::map> selectedparticlesMC_antip; - // key: int64_t - value: vector of trkType objects - std::map> selectedtracksMC_d; - std::map> selectedtracksMC_p; - std::map> selectedtracksMC_antid; - std::map> selectedtracksMC_antip; - std::map> selectedtracksPIDMC_d; - std::map> selectedtracksPIDMC_p; - std::map> selectedtracksPIDMC_antid; - std::map> selectedtracksPIDMC_antip; - // key: pair of an integer and a float - value: vector of colType objects // for each key I have a vector of collisions std::map, std::vector> mixbins_antid; std::map, std::vector> mixbins_d; std::map, std::vector> mixbins_antip; std::map, std::vector> mixbins_p; - std::map, std::vector> mixbinsPID_antidantip; - std::map> mixbinsMC_antidantip; - std::map> mixbinsMC_dp; + std::map, std::vector> mixbinsMC_antid; + std::map, std::vector> mixbinsMC_d; + std::map, std::vector> mixbinsMC_antip; + std::map, std::vector> mixbinsMC_p; std::unique_ptr> Pair = std::make_unique>(); std::unique_ptr> PairMC = std::make_unique>(); @@ -169,18 +162,20 @@ struct hadronnucleicorrelation { std::vector> hCorrEtaPhi_ME; // MC histograms - std::vector> hEtaPhiRec_AntiDeAntiPr_SE; std::vector> hEtaPhiGen_AntiDeAntiPr_SE; - std::vector> hEtaPhiRec_AntiDeAntiPr_ME; std::vector> hEtaPhiGen_AntiDeAntiPr_ME; - std::vector> hPIDEtaPhiRec_AntiDeAntiPr_SE; - std::vector> hPIDEtaPhiGen_AntiDeAntiPr_SE; - std::vector> hPIDEtaPhiRec_AntiDeAntiPr_ME; - std::vector> hPIDEtaPhiGen_AntiDeAntiPr_ME; std::vector> hEtaPhiGen_AntiPrAntiPr_SE; std::vector> hEtaPhiGen_AntiPrAntiPr_ME; + std::vector> hEtaPhiGen_PrPr_SE; + std::vector> hEtaPhiGen_PrPr_ME; std::vector> hEtaPhiGen_AntiPrPr_SE; std::vector> hEtaPhiGen_AntiPrPr_ME; + std::vector> hEtaPhiGen_AntiDePr_SE; + std::vector> hEtaPhiGen_AntiDePr_ME; + std::vector> hEtaPhiGen_DeAntiPr_SE; + std::vector> hEtaPhiGen_DeAntiPr_ME; + std::vector> hEtaPhiGen_DePr_SE; + std::vector> hEtaPhiGen_DePr_ME; int nBinspT; TH2F* hEffpTEta_proton; @@ -191,6 +186,8 @@ struct hadronnucleicorrelation { Service ccdb; o2::ccdb::CcdbApi ccdbApi; + Service pdgDB; + void init(o2::framework::InitContext&) { ccdb->setURL(url.value); @@ -227,32 +224,9 @@ struct hadronnucleicorrelation { nBinspT = pTBins.value.size() - 1; - if (mcCorrelation) { - for (int i = 0; i < nBinspT; i++) { - auto htempSERec_AntiDeAntiPr = registry.add(Form("hEtaPhiRec_AntiDeAntiPr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), - Form("Rec #Delta#eta#Delta#phi (%.1f(Form("hEtaPhiRec_AntiDeAntiPr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), - Form("Rec #Delta#eta#Delta#phi (%.1f(Form("hPIDEtaPhiRec_AntiDeAntiPr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), - Form("Rec #Delta#eta#Delta#phi (%.1f(Form("hPIDEtaPhiGen_AntiDeAntiPr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), - Form("Gen #Delta#eta#Delta#phi (%.1f(Form("hPIDEtaPhiRec_AntiDeAntiPr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), - Form("Rec #Delta#eta#Delta#phi (%.1f(Form("hPIDEtaPhiGen_AntiDeAntiPr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), - Form("Gen #Delta#eta#Delta#phi (%.1f(Form("hEtaPhiGen_AntiDeAntiPr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("Gen #Delta#eta#Delta#phi (%.1f(Form("hEtaPhiGen_AntiPrAntiPr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("Gen #Delta#eta#Delta#phi (%.1f(Form("hEtaPhiGen_PrPr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), + Form("Gen #Delta#eta#Delta#phi (%.1f(Form("hEtaPhiGen_PrPr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), + Form("Gen #Delta#eta#Delta#phi (%.1f(Form("hEtaPhiGen_AntiPrPr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), - Form("Gen #Delta#eta#Delta#phi (%.1f(Form("hEtaPhiGen_AntiPrPr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), - Form("Gen #Delta#eta#Delta#phi (%.1f(Form("hEtaPhiGen_DePr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), + Form("Gen #Delta#eta#Delta#phi (%.1f(Form("hEtaPhiGen_DePr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), + Form("Gen #Delta#eta#Delta#phi (%.1f(Form("hEtaPhiGen_AntiDePr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), + Form("Gen #Delta#eta#Delta#phi (%.1f(Form("hEtaPhiGen_AntiDePr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), + Form("Gen #Delta#eta#Delta#phi (%.1f(Form("hEtaPhiGen_DeAntiPr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), + Form("Gen #Delta#eta#Delta#phi (%.1f(Form("hEtaPhiGen_DeAntiPr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), + Form("Gen #Delta#eta#Delta#phi (%.1f(HIST("Generated/hNEventsMC"))->GetXaxis()->SetBinLabel(1, "All"); + registry.add("hGen_EtaPhiPt_Proton", "Gen (anti)protons in gen collisions", {HistType::kTH3F, {etaAxis, phiAxis, pTAxis_small}}); + registry.add("hGen_EtaPhiPt_Deuteron", "Gen (anti)deuteron in gen collisions", {HistType::kTH3F, {etaAxis, phiAxis, pTAxis_small}}); + registry.add("Generated/hQAProtons", "hQAProtons", {HistType::kTH1D, {{5, 0.f, 5.f}}}); registry.get(HIST("Generated/hQAProtons"))->GetXaxis()->SetBinLabel(1, "All"); registry.get(HIST("Generated/hQAProtons"))->GetXaxis()->SetBinLabel(2, "PhysicalPrimary"); @@ -665,64 +677,7 @@ struct hadronnucleicorrelation { } template - void mixTracksMC(Type const& tracks1, Type const& tracks2, bool isIdentical, bool isMCPID) - { // last value: 0 -- SE; 1 -- ME - for (auto const& it1 : tracks1) { - for (auto const& it2 : tracks2) { - - PairMC->SetPair(it1, it2); - PairMC->SetIdentical(isIdentical); - - // if Identical (pp and antip-antip) - if (isIdentical && PairMC->IsClosePair(deta, dphi, radiusTPC)) { - QA.fill(HIST("QA/hdetadphistar"), PairMC->GetPhiStarDiff(radiusTPC), PairMC->GetEtaDiff()); - continue; - } - - // Calculate Delta-eta Delta-phi (reco) - float deltaEta = it2->eta() - it1->eta(); - float deltaPhi = it2->phi() - it1->phi(); - deltaPhi = RecoDecay::constrainAngle(deltaPhi, -1 * o2::constants::math::PIHalf); - - // Calculate Delta-eta Delta-phi (gen) - float deltaEtaGen = -999.; - float deltaPhiGen = -999.; - deltaEtaGen = it2->eta_MC() - it1->eta_MC(); - deltaPhiGen = it2->phi_MC() - it1->phi_MC(); - deltaPhiGen = RecoDecay::constrainAngle(deltaPhiGen, -1 * o2::constants::math::PIHalf); - - for (int k = 0; k < nBinspT; k++) { - - if (it1->pt() >= pTBins.value.at(k) && it1->pt() < pTBins.value.at(k + 1)) { - - if (ME) { - if (isMCPID) { - hPIDEtaPhiRec_AntiDeAntiPr_ME[k]->Fill(deltaEta, deltaPhi, it2->pt()); - hPIDEtaPhiGen_AntiDeAntiPr_ME[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); - } else { - hEtaPhiRec_AntiDeAntiPr_ME[k]->Fill(deltaEta, deltaPhi, it2->pt()); - hEtaPhiGen_AntiDeAntiPr_ME[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); - } - } else { - if (isMCPID) { - hPIDEtaPhiRec_AntiDeAntiPr_SE[k]->Fill(deltaEta, deltaPhi, it2->pt()); - hPIDEtaPhiGen_AntiDeAntiPr_SE[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); - } else { - hEtaPhiRec_AntiDeAntiPr_SE[k]->Fill(deltaEta, deltaPhi, it2->pt()); - hEtaPhiGen_AntiDeAntiPr_SE[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); - } - } // SE - } // pT condition - } // nBinspT loop - - Pair->ResetPair(); - - } // tracks 2 - } // tracks 1 - } - - template - void mixMCParticles(Type const& particles1, Type const& particles2, bool ispap) + void mixMCParticles(Type const& particles1, Type const& particles2, int mode) { for (auto const& it1 : particles1) { for (auto const& it2 : particles2) { @@ -735,15 +690,27 @@ struct hadronnucleicorrelation { if (it1->pt() >= pTBins.value.at(k) && it1->pt() < pTBins.value.at(k + 1)) { // Use correct histogram based on ME flag if constexpr (ME) { - if (ispap) + if (mode == 0) hEtaPhiGen_AntiPrPr_ME[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); - else + else if (mode == 1) hEtaPhiGen_AntiDeAntiPr_ME[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); + else if (mode == 2) + hEtaPhiGen_AntiDePr_ME[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); + else if (mode == 3) + hEtaPhiGen_DeAntiPr_ME[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); + else if (mode == 4) + hEtaPhiGen_DePr_ME[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); } else { - if (ispap) + if (mode == 0) hEtaPhiGen_AntiPrPr_SE[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); - else + else if (mode == 1) hEtaPhiGen_AntiDeAntiPr_SE[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); + else if (mode == 2) + hEtaPhiGen_AntiDePr_SE[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); + else if (mode == 3) + hEtaPhiGen_DeAntiPr_SE[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); + else if (mode == 4) + hEtaPhiGen_DePr_SE[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); } } } @@ -752,7 +719,7 @@ struct hadronnucleicorrelation { } template - void mixMCParticlesIdentical(Type const& particles1, Type const& particles2) + void mixMCParticlesIdentical(Type const& particles1, Type const& particles2, bool ismatter) { for (auto const& it1 : particles1) { for (auto const& it2 : particles2) { @@ -760,7 +727,7 @@ struct hadronnucleicorrelation { float deltaEtaGen = it2->eta() - it1->eta(); float deltaPhiGen = RecoDecay::constrainAngle(it2->phi() - it1->phi(), -1 * o2::constants::math::PIHalf); - if (!ME && std::abs(deltaPhiGen) < 0.001 && std::abs(deltaEtaGen) < 0.001) { + if (!ME && std::abs(deltaPhiGen) < 0.0001 && std::abs(deltaEtaGen) < 0.0001) { continue; } @@ -769,9 +736,15 @@ struct hadronnucleicorrelation { if (it1->pt() >= pTBins.value.at(k) && it1->pt() < pTBins.value.at(k + 1)) { // Use correct histogram based on ME flag if constexpr (ME) { - hEtaPhiGen_AntiPrAntiPr_ME[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); + if (ismatter) + hEtaPhiGen_PrPr_ME[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); + else + hEtaPhiGen_AntiPrAntiPr_ME[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); } else { - hEtaPhiGen_AntiPrAntiPr_SE[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); + if (ismatter) + hEtaPhiGen_PrPr_SE[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); + else + hEtaPhiGen_AntiPrAntiPr_SE[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); } } } @@ -921,6 +894,7 @@ struct hadronnucleicorrelation { continue; registry.fill(HIST("hNEvents"), 0.5); + registry.fill(HIST("hMult"), collision.mult()); if (selectedtracks_antid.find(collision.globalIndex()) != selectedtracks_antid.end() && selectedtracks_antip.find(collision.globalIndex()) != selectedtracks_antip.end()) { @@ -1212,7 +1186,7 @@ struct hadronnucleicorrelation { } PROCESS_SWITCH(hadronnucleicorrelation, processData, "processData", true); - void processMC(FilteredCollisions const& collisions, FilteredTracksMC const& tracks) + void processMC(FilteredCollisions const&, FilteredTracksMC const& tracks) { for (auto track : tracks) { if (std::abs(track.template singleCollSel_as().posZ()) > cutzvertex) @@ -1574,74 +1548,141 @@ struct hadronnucleicorrelation { track.sign() < 0) registry.fill(HIST("hDenominatorPurity_Deuteron_TPCEl_or_TOF"), track.pt() * -1); } + } // track + } + PROCESS_SWITCH(hadronnucleicorrelation, processMC, "processMC", false); + + Preslice perMCCol = aod::mcparticle::mcCollisionId; - if (!mcCorrelation) { + void processGen(SimCollisions const& mcCollisions, + SimParticles const& mcParticles) + { + for (auto particle : mcParticles) { + + if (std::abs(particle.template mcCollision_as().posZ()) > cutzvertex) continue; + + if (particle.pdgCode() == pdgProton) { + registry.fill(HIST("Generated/hQAProtons"), 0.5); + } + if (particle.pdgCode() == pdgDeuteron) { + registry.fill(HIST("Generated/hQADeuterons"), 0.5); } - if (isDe) { - selectedtracksPIDMC_d[track.singleCollSelId()].push_back(std::make_shared(track)); + if (isPrim && !particle.isPhysicalPrimary()) { + continue; } - if (track.pdgCode() == pdgDeuteron) { - selectedtracksMC_d[track.singleCollSelId()].push_back(std::make_shared(track)); + if (particle.pdgCode() == pdgProton) { + registry.fill(HIST("Generated/hQAProtons"), 1.5); } - if (isAntiDe) { - selectedtracksPIDMC_antid[track.singleCollSelId()].push_back(std::make_shared(track)); + if (particle.pdgCode() == pdgDeuteron) { + registry.fill(HIST("Generated/hQADeuterons"), 1.5); } - if (track.pdgCode() == -pdgDeuteron) { - selectedtracksMC_antid[track.singleCollSelId()].push_back(std::make_shared(track)); + + if (particle.pdgCode() == pdgDeuteron && std::abs(particle.y()) < 0.5) { + registry.fill(HIST("Generated/hDeuteronsVsPt"), particle.pt()); } - if (isPr) { - selectedtracksPIDMC_p[track.singleCollSelId()].push_back(std::make_shared(track)); + if (particle.pdgCode() == -pdgDeuteron && std::abs(particle.y()) < 0.5) { + registry.fill(HIST("Generated/hAntiDeuteronsVsPt"), particle.pt()); } - if (track.pdgCode() == pdgProton) { - selectedtracksMC_p[track.singleCollSelId()].push_back(std::make_shared(track)); + + if (std::abs(particle.eta()) > etacut) { + continue; } - if (isAntiPr) { - selectedtracksPIDMC_antip[track.singleCollSelId()].push_back(std::make_shared(track)); + if (particle.pdgCode() == pdgProton) { + registry.fill(HIST("Generated/hQAProtons"), 2.5); } - if (track.pdgCode() == -pdgProton) { - selectedtracksMC_antip[track.singleCollSelId()].push_back(std::make_shared(track)); + if (particle.pdgCode() == pdgDeuteron) { + registry.fill(HIST("Generated/hQADeuterons"), 2.5); } - } // track - if (!mcCorrelation) { - return; + if (particle.pdgCode() == pdgDeuteron) { + registry.fill(HIST("hGen_EtaPhiPt_Deuteron"), particle.eta(), particle.phi(), particle.pt()); + selectedparticlesMC_d[particle.mcCollisionId()].push_back(std::make_shared(particle)); + } + if (particle.pdgCode() == -pdgDeuteron) { + registry.fill(HIST("hGen_EtaPhiPt_Deuteron"), particle.eta(), particle.phi(), -1. * particle.pt()); + selectedparticlesMC_antid[particle.mcCollisionId()].push_back(std::make_shared(particle)); + } + if (particle.pdgCode() == pdgProton) { + registry.fill(HIST("hGen_EtaPhiPt_Proton"), particle.eta(), particle.phi(), particle.pt()); + selectedparticlesMC_p[particle.mcCollisionId()].push_back(std::make_shared(particle)); + } + if (particle.pdgCode() == -pdgProton) { + registry.fill(HIST("hGen_EtaPhiPt_Proton"), particle.eta(), particle.phi(), -1. * particle.pt()); + selectedparticlesMC_antip[particle.mcCollisionId()].push_back(std::make_shared(particle)); + } } - for (auto collision : collisions) { - if (std::abs(collision.posZ()) > cutzvertex) + for (auto collision1 : mcCollisions) { // loop on collisions + + registry.fill(HIST("Generated/hNEventsMC"), 0.5); + + if (std::abs(collision1.posZ()) > cutzvertex) { continue; - registry.fill(HIST("hNEvents"), 0.5); + } - int vertexBinToMix = std::floor((collision.posZ() + cutzvertex) / (2 * cutzvertex / _vertexNbinsToMix)); - int centBinToMix = std::floor(collision.multPerc() / (100.0 / _multNsubBins)); + const auto particlesInCollision = mcParticles.sliceBy(perMCCol, collision1.globalIndex()); - if (selectedtracksMC_antid.find(collision.globalIndex()) != selectedtracksMC_antid.end()) { - mixbins_antid[std::pair{vertexBinToMix, centBinToMix}].push_back(std::make_shared(collision)); + float Ncharged = 0.; + for (auto& mcParticle : particlesInCollision) { + + if (!mcParticle.isPhysicalPrimary()) { + continue; + } + + if (std::abs(mcParticle.eta()) > 0.5f) { + continue; + } + + TParticlePDG* p = pdgDB->GetParticle(mcParticle.pdgCode()); + if (std::abs(p->Charge()) > 1E-3) { + Ncharged++; + } + } + + registry.fill(HIST("hMult"), Ncharged); + + int vertexBinToMix = std::floor((collision1.posZ() + cutzvertex) / (2 * cutzvertex / _vertexNbinsToMix)); + int centBinToMix = std::floor(Ncharged / (maxmultmix / _multNsubBins)); + + if (Ncharged > maxmultmix) + centBinToMix = _multNsubBins - 1; // to avoid overflow in centrality bin + if (centBinToMix < 0) + centBinToMix = 0; // to avoid underflow in centrality bin + + if (selectedparticlesMC_antid.find(collision1.globalIndex()) != selectedparticlesMC_antid.end()) { + mixbinsMC_antid[std::pair{vertexBinToMix, centBinToMix}].push_back(std::make_shared(collision1)); + } + + if (selectedparticlesMC_d.find(collision1.globalIndex()) != selectedparticlesMC_d.end()) { + mixbinsMC_d[std::pair{vertexBinToMix, centBinToMix}].push_back(std::make_shared(collision1)); } - if (selectedtracksPIDMC_antid.find(collision.globalIndex()) != selectedtracksPIDMC_antid.end()) { - mixbinsPID_antidantip[std::pair{vertexBinToMix, centBinToMix}].push_back(std::make_shared(collision)); + if (selectedparticlesMC_antip.find(collision1.globalIndex()) != selectedparticlesMC_antip.end()) { + mixbinsMC_antip[std::pair{vertexBinToMix, centBinToMix}].push_back(std::make_shared(collision1)); + } + + if (selectedparticlesMC_p.find(collision1.globalIndex()) != selectedparticlesMC_p.end()) { + mixbinsMC_p[std::pair{vertexBinToMix, centBinToMix}].push_back(std::make_shared(collision1)); } - PairMC->SetMagField1(collision.magField()); - PairMC->SetMagField2(collision.magField()); } // coll - if (!mixbins_antid.empty()) { + if (!mixbinsMC_antip.empty()) { - for (auto i = mixbins_antid.begin(); i != mixbins_antid.end(); i++) { // iterating over all vertex&mult bins + // antip-antip + for (auto i = mixbinsMC_antip.begin(); i != mixbinsMC_antip.end(); i++) { // iterating over all vertex&mult bins - std::vector value = i->second; + std::vector value = i->second; int EvPerBin = value.size(); // number of collisions in each vertex&mult bin for (int indx1 = 0; indx1 < EvPerBin; indx1++) { // loop over all the events in each vertex&mult bin auto col1 = value[indx1]; - if (selectedtracksMC_antip.find(col1->index()) != selectedtracksMC_antip.end()) { - mixTracksMC<0>(selectedtracksMC_antid[col1->index()], selectedtracksMC_antip[col1->index()], 0, 0); // mixing SE + if (selectedparticlesMC_antip.find(col1->index()) != selectedparticlesMC_antip.end()) { + mixMCParticlesIdentical<0>(selectedparticlesMC_antip[col1->index()], selectedparticlesMC_antip[col1->index()], 0); // mixing SE } for (int indx2 = indx1 + 1; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin @@ -1652,27 +1693,25 @@ struct hadronnucleicorrelation { continue; } - if (selectedtracksMC_antip.find(col2->index()) != selectedtracksMC_antip.end()) { - mixTracksMC<1>(selectedtracksMC_antid[col1->index()], selectedtracksMC_antip[col2->index()], 0, 0); // mixing ME + if (selectedparticlesMC_antip.find(col2->index()) != selectedparticlesMC_antip.end()) { + mixMCParticlesIdentical<1>(selectedparticlesMC_antip[col1->index()], selectedparticlesMC_antip[col2->index()], 0); // mixing SE } } } } - } - if (!mixbinsPID_antidantip.empty()) { + // antip-p + for (auto i = mixbinsMC_antip.begin(); i != mixbinsMC_antip.end(); i++) { // iterating over all vertex&mult bins - for (auto i = mixbinsPID_antidantip.begin(); i != mixbinsPID_antidantip.end(); i++) { // iterating over all vertex&mult bins - - std::vector value = i->second; + std::vector value = i->second; int EvPerBin = value.size(); // number of collisions in each vertex&mult bin for (int indx1 = 0; indx1 < EvPerBin; indx1++) { // loop over all the events in each vertex&mult bin auto col1 = value[indx1]; - if (selectedtracksPIDMC_antip.find(col1->index()) != selectedtracksPIDMC_antip.end()) { - mixTracksMC<0>(selectedtracksPIDMC_antid[col1->index()], selectedtracksPIDMC_antip[col1->index()], 0, 1); // mixing SE + if (selectedparticlesMC_antip.find(col1->index()) != selectedparticlesMC_antip.end()) { + mixMCParticles<0>(selectedparticlesMC_antip[col1->index()], selectedparticlesMC_p[col1->index()], 0); // mixing SE } for (int indx2 = indx1 + 1; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin @@ -1683,247 +1722,170 @@ struct hadronnucleicorrelation { continue; } - if (selectedtracksPIDMC_antip.find(col2->index()) != selectedtracksPIDMC_antip.end()) { - mixTracksMC<1>(selectedtracksPIDMC_antid[col1->index()], selectedtracksPIDMC_antip[col2->index()], 0, 1); // mixing ME + if (selectedparticlesMC_antip.find(col2->index()) != selectedparticlesMC_antip.end()) { + mixMCParticles<1>(selectedparticlesMC_antip[col1->index()], selectedparticlesMC_p[col2->index()], 0); // mixing SE } } } } - } - - // clearing up - for (auto i = selectedtracksMC_antid.begin(); i != selectedtracksMC_antid.end(); i++) - (i->second).clear(); - selectedtracksMC_antid.clear(); - for (auto i = selectedtracksMC_d.begin(); i != selectedtracksMC_d.end(); i++) - (i->second).clear(); - selectedtracksMC_d.clear(); + } // mixbinsMC_antip - for (auto i = selectedtracksMC_antip.begin(); i != selectedtracksMC_antip.end(); i++) - (i->second).clear(); - selectedtracksMC_antip.clear(); + if (!mixbinsMC_p.empty()) { - for (auto i = selectedtracksMC_p.begin(); i != selectedtracksMC_p.end(); i++) - (i->second).clear(); - selectedtracksMC_p.clear(); + // p-p + for (auto i = mixbinsMC_p.begin(); i != mixbinsMC_p.end(); i++) { // iterating over all vertex&mult bins - for (auto i = selectedtracksPIDMC_antid.begin(); i != selectedtracksPIDMC_antid.end(); i++) - (i->second).clear(); - selectedtracksPIDMC_antid.clear(); + std::vector value = i->second; + int EvPerBin = value.size(); // number of collisions in each vertex&mult bin - for (auto i = selectedtracksPIDMC_d.begin(); i != selectedtracksPIDMC_d.end(); i++) - (i->second).clear(); - selectedtracksPIDMC_d.clear(); + for (int indx1 = 0; indx1 < EvPerBin; indx1++) { // loop over all the events in each vertex&mult bin - for (auto i = selectedtracksPIDMC_antip.begin(); i != selectedtracksPIDMC_antip.end(); i++) - (i->second).clear(); - selectedtracksPIDMC_antip.clear(); + auto col1 = value[indx1]; - for (auto i = selectedtracksPIDMC_p.begin(); i != selectedtracksPIDMC_p.end(); i++) - (i->second).clear(); - selectedtracksPIDMC_p.clear(); + if (selectedparticlesMC_p.find(col1->index()) != selectedparticlesMC_p.end()) { + mixMCParticlesIdentical<0>(selectedparticlesMC_p[col1->index()], selectedparticlesMC_p[col1->index()], 1); // mixing SE + } - for (auto& pair : mixbinsPID_antidantip) { - pair.second.clear(); // clear the vector associated with the key - } - mixbinsPID_antidantip.clear(); // clear the map + for (int indx2 = indx1 + 1; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin - for (auto& pair : mixbins_antid) { - pair.second.clear(); // clear the vector associated with the key - } - mixbins_antid.clear(); // clear the map - } - PROCESS_SWITCH(hadronnucleicorrelation, processMC, "processMC", false); + auto col2 = (i->second)[indx2]; - void processGen(SimCollisions const& mcCollisions, - SimParticles const& mcParticles) - { - for (auto particle : mcParticles) { + if (col1 == col2) { + continue; + } - if (particle.pdgCode() == pdgProton) { - registry.fill(HIST("Generated/hQAProtons"), 0.5); - } - if (particle.pdgCode() == pdgDeuteron) { - registry.fill(HIST("Generated/hQADeuterons"), 0.5); + if (selectedparticlesMC_p.find(col2->index()) != selectedparticlesMC_p.end()) { + mixMCParticlesIdentical<1>(selectedparticlesMC_p[col1->index()], selectedparticlesMC_p[col2->index()], 1); // mixing SE + } + } + } } + } // mixbinsMC_p - if (isPrim && !particle.isPhysicalPrimary()) { - continue; - } - if (particle.pdgCode() == pdgProton) { - registry.fill(HIST("Generated/hQAProtons"), 1.5); - } - if (particle.pdgCode() == pdgDeuteron) { - registry.fill(HIST("Generated/hQADeuterons"), 1.5); - } + if (!mixbinsMC_antid.empty()) { - if (particle.pdgCode() == pdgDeuteron && std::abs(particle.y()) < 0.5) { - registry.fill(HIST("Generated/hDeuteronsVsPt"), particle.pt()); - } - if (particle.pdgCode() == -pdgDeuteron && std::abs(particle.y()) < 0.5) { - registry.fill(HIST("Generated/hAntiDeuteronsVsPt"), particle.pt()); - } + // antid-antip + for (auto i = mixbinsMC_antid.begin(); i != mixbinsMC_antid.end(); i++) { // iterating over all vertex&mult bins - if (std::abs(particle.eta()) > etacut) { - continue; - } - if (particle.pdgCode() == pdgProton) { - registry.fill(HIST("Generated/hQAProtons"), 2.5); - } - if (particle.pdgCode() == pdgDeuteron) { - registry.fill(HIST("Generated/hQADeuterons"), 2.5); - } + std::vector value = i->second; + int EvPerBin = value.size(); // number of collisions in each vertex&mult bin - if (particle.pdgCode() == pdgDeuteron) { - selectedparticlesMC_d[particle.mcCollisionId()].push_back(std::make_shared(particle)); - } - if (particle.pdgCode() == -pdgDeuteron) { - selectedparticlesMC_antid[particle.mcCollisionId()].push_back(std::make_shared(particle)); - } - if (particle.pdgCode() == pdgProton) { - selectedparticlesMC_p[particle.mcCollisionId()].push_back(std::make_shared(particle)); - } - if (particle.pdgCode() == -pdgProton) { - selectedparticlesMC_antip[particle.mcCollisionId()].push_back(std::make_shared(particle)); - } - } + for (int indx1 = 0; indx1 < EvPerBin; indx1++) { // loop over all the events in each vertex&mult bin - for (auto collision1 : mcCollisions) { // loop on collisions + auto col1 = value[indx1]; - registry.fill(HIST("Generated/hNEventsMC"), 0.5); + if (selectedparticlesMC_antid.find(col1->index()) != selectedparticlesMC_antid.end()) { + mixMCParticles<0>(selectedparticlesMC_antid[col1->index()], selectedparticlesMC_antip[col1->index()], 1); // mixing SE + } - // anti-d - anti-p correlation - if (selectedparticlesMC_antid.find(collision1.globalIndex()) != selectedparticlesMC_antid.end()) { - if (selectedparticlesMC_antip.find(collision1.globalIndex()) != selectedparticlesMC_antip.end()) { - mixMCParticles<0>(selectedparticlesMC_antid[collision1.globalIndex()], selectedparticlesMC_antip[collision1.globalIndex()], 0); // mixing SE - } + for (int indx2 = indx1 + 1; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin - int stop1 = 0; + auto col2 = (i->second)[indx2]; - for (auto collision2 : mcCollisions) { // nested loop on collisions + if (col1 == col2) { + continue; + } - if (collision1.globalIndex() == collision2.globalIndex()) { - continue; + if (selectedparticlesMC_antid.find(col2->index()) != selectedparticlesMC_antid.end()) { + mixMCParticles<1>(selectedparticlesMC_antid[col1->index()], selectedparticlesMC_antip[col2->index()], 1); // mixing SE + } } + } + } - if (stop1 > maxmixcollsGen) { - break; - } + // antid-p + for (auto i = mixbinsMC_antid.begin(); i != mixbinsMC_antid.end(); i++) { // iterating over all vertex&mult bins - if (selectedparticlesMC_antip.find(collision2.globalIndex()) != selectedparticlesMC_antip.end()) { - mixMCParticles<1>(selectedparticlesMC_antid[collision1.globalIndex()], selectedparticlesMC_antip[collision2.globalIndex()], 0); // mixing ME - } + std::vector value = i->second; + int EvPerBin = value.size(); // number of collisions in each vertex&mult bin - stop1++; - } - } + for (int indx1 = 0; indx1 < EvPerBin; indx1++) { // loop over all the events in each vertex&mult bin + + auto col1 = value[indx1]; - // d - p correlation - if (domatterGen) { - if (selectedparticlesMC_d.find(collision1.globalIndex()) != selectedparticlesMC_d.end()) { - if (selectedparticlesMC_p.find(collision1.globalIndex()) != selectedparticlesMC_p.end()) { - mixMCParticles<0>(selectedparticlesMC_d[collision1.globalIndex()], selectedparticlesMC_p[collision1.globalIndex()], 0); // mixing SE + if (selectedparticlesMC_antid.find(col1->index()) != selectedparticlesMC_antid.end()) { + mixMCParticles<0>(selectedparticlesMC_antid[col1->index()], selectedparticlesMC_p[col1->index()], 2); // mixing SE } - int stop2 = 0; + for (int indx2 = indx1 + 1; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin - for (auto collision2 : mcCollisions) { // nested loop on collisions + auto col2 = (i->second)[indx2]; - if (collision1.globalIndex() == collision2.globalIndex()) { + if (col1 == col2) { continue; } - if (stop2 > maxmixcollsGen) { - break; - } - - if (selectedparticlesMC_p.find(collision2.globalIndex()) != selectedparticlesMC_p.end()) { - mixMCParticles<1>(selectedparticlesMC_d[collision1.globalIndex()], selectedparticlesMC_p[collision2.globalIndex()], 0); // mixing ME + if (selectedparticlesMC_antid.find(col2->index()) != selectedparticlesMC_antid.end()) { + mixMCParticles<1>(selectedparticlesMC_antid[col1->index()], selectedparticlesMC_p[col2->index()], 2); // mixing SE } - - stop2++; } } } - // anti-p - anti-p correlation - if (selectedparticlesMC_antip.find(collision1.globalIndex()) != selectedparticlesMC_antip.end()) { + } // mixbinsMC_antid - mixMCParticlesIdentical<0>(selectedparticlesMC_antip[collision1.globalIndex()], selectedparticlesMC_antip[collision1.globalIndex()]); // mixing SE + if (!mixbinsMC_d.empty()) { - int stop3 = 0; + // d-antip + for (auto i = mixbinsMC_d.begin(); i != mixbinsMC_d.end(); i++) { // iterating over all vertex&mult bins - for (auto collision2 : mcCollisions) { // nested loop on collisions + std::vector value = i->second; + int EvPerBin = value.size(); // number of collisions in each vertex&mult bin - if (collision1.globalIndex() == collision2.globalIndex()) { - continue; - } + for (int indx1 = 0; indx1 < EvPerBin; indx1++) { // loop over all the events in each vertex&mult bin - if (stop3 > maxmixcollsGen) { - break; - } + auto col1 = value[indx1]; - if (selectedparticlesMC_antip.find(collision2.globalIndex()) != selectedparticlesMC_antip.end()) { - mixMCParticlesIdentical<1>(selectedparticlesMC_antip[collision1.globalIndex()], selectedparticlesMC_antip[collision2.globalIndex()]); // mixing ME + if (selectedparticlesMC_d.find(col1->index()) != selectedparticlesMC_d.end()) { + mixMCParticles<0>(selectedparticlesMC_d[col1->index()], selectedparticlesMC_antip[col1->index()], 3); // mixing SE } - stop3++; - } - } - // p - p correlation - if (domatterGen) { - if (selectedparticlesMC_p.find(collision1.globalIndex()) != selectedparticlesMC_p.end()) { - - mixMCParticlesIdentical<0>(selectedparticlesMC_p[collision1.globalIndex()], selectedparticlesMC_p[collision1.globalIndex()]); // mixing SE - - int stop4 = 0; + for (int indx2 = indx1 + 1; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin - for (auto collision2 : mcCollisions) { // nested loop on collisions + auto col2 = (i->second)[indx2]; - if (collision1.globalIndex() == collision2.globalIndex()) { + if (col1 == col2) { continue; } - if (stop4 > maxmixcollsGen) { - break; + if (selectedparticlesMC_d.find(col2->index()) != selectedparticlesMC_d.end()) { + mixMCParticles<1>(selectedparticlesMC_d[col1->index()], selectedparticlesMC_antip[col2->index()], 3); // mixing SE } - - if (selectedparticlesMC_p.find(collision2.globalIndex()) != selectedparticlesMC_p.end()) { - mixMCParticlesIdentical<1>(selectedparticlesMC_p[collision1.globalIndex()], selectedparticlesMC_p[collision2.globalIndex()]); // mixing ME - } - - stop4++; } } } - // p-antip correlation - if (selectedparticlesMC_p.find(collision1.globalIndex()) != selectedparticlesMC_p.end()) { - if (selectedparticlesMC_antip.find(collision1.globalIndex()) != selectedparticlesMC_antip.end()) { - mixMCParticles<0>(selectedparticlesMC_p[collision1.globalIndex()], selectedparticlesMC_antip[collision1.globalIndex()], 1); // mixing SE - } + // d-p + for (auto i = mixbinsMC_d.begin(); i != mixbinsMC_d.end(); i++) { // iterating over all vertex&mult bins - int stop5 = 0; + std::vector value = i->second; + int EvPerBin = value.size(); // number of collisions in each vertex&mult bin - for (auto collision2 : mcCollisions) { // nested loop on collisions + for (int indx1 = 0; indx1 < EvPerBin; indx1++) { // loop over all the events in each vertex&mult bin - if (collision1.globalIndex() == collision2.globalIndex()) { - continue; - } + auto col1 = value[indx1]; - if (stop5 > maxmixcollsGen) { - break; + if (selectedparticlesMC_d.find(col1->index()) != selectedparticlesMC_d.end()) { + mixMCParticles<0>(selectedparticlesMC_d[col1->index()], selectedparticlesMC_p[col1->index()], 4); // mixing SE } - if (selectedparticlesMC_antip.find(collision2.globalIndex()) != selectedparticlesMC_antip.end()) { - mixMCParticles<1>(selectedparticlesMC_p[collision1.globalIndex()], selectedparticlesMC_antip[collision2.globalIndex()], 1); // mixing ME - } + for (int indx2 = indx1 + 1; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin + + auto col2 = (i->second)[indx2]; + + if (col1 == col2) { + continue; + } - stop5++; + if (selectedparticlesMC_d.find(col2->index()) != selectedparticlesMC_d.end()) { + mixMCParticles<1>(selectedparticlesMC_d[col1->index()], selectedparticlesMC_p[col2->index()], 4); // mixing SE + } + } } } - } + + } // mixbinsMC_d // clearing up for (auto i = selectedparticlesMC_antid.begin(); i != selectedparticlesMC_antid.end(); i++) @@ -1941,6 +1903,25 @@ struct hadronnucleicorrelation { for (auto i = selectedparticlesMC_p.begin(); i != selectedparticlesMC_p.end(); i++) (i->second).clear(); selectedparticlesMC_p.clear(); + + for (auto& pair : mixbinsMC_antip) { + pair.second.clear(); // clear the vector associated with the key + } + mixbinsMC_antip.clear(); // clear the map + + for (auto& pair : mixbinsMC_p) { + pair.second.clear(); // clear the vector associated with the key + } + mixbinsMC_p.clear(); // clear the map + for (auto& pair : mixbinsMC_antid) { + pair.second.clear(); // clear the vector associated with the key + } + mixbinsMC_antid.clear(); // clear the map + + for (auto& pair : mixbinsMC_d) { + pair.second.clear(); // clear the vector associated with the key + } + mixbinsMC_d.clear(); // clear the map } PROCESS_SWITCH(hadronnucleicorrelation, processGen, "processGen", false); }; From e7af6b1caebadc15e15e922cd9abe22495c0457e Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Mon, 13 Oct 2025 01:55:59 +0200 Subject: [PATCH 729/986] [PWGCF] FemtoUniverse: Add function to fill only MCTruthTracks (#13350) --- .../femtoUniverseProducerTask.cxx | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx index 7b8a0b00a77..2609a03fcc9 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx @@ -188,6 +188,7 @@ struct FemtoUniverseProducerTask { Configurable> confTrkDCAzMax{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kDCAzMax, "ConfTrk"), std::vector{0.2f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kDCAzMax, "Track selection: ")}; /// \todo Reintegrate PID to the general selection container Configurable> confTrkPIDnSigmaMax{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kPIDnSigmaMax, "ConfTrk"), std::vector{3.5f, 3.f, 2.5f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kPIDnSigmaMax, "Track selection: ")}; Configurable> confTrkPIDspecies{"confTrkPIDspecies", std::vector{o2::track::PID::Pion, o2::track::PID::Kaon, o2::track::PID::Proton, o2::track::PID::Deuteron}, "Trk sel: Particles species for PID (Pion=2, Kaon=3, Proton=4, Deuteron=5)"}; + Configurable confIsOnlyMCTrack{"confIsOnlyMCTrack", false, "Enable filling of only MC Tracks"}; // Numbers from ~/alice/O2/DataFormats/Reconstruction/include/ReconstructionDataFormats/PID.h //static constexpr ID Pion = 2; static constexpr ID Kaon = 3; static constexpr ID Proton = 4; static constexpr ID Deuteron = 5; } ConfTrkSelection; @@ -1349,6 +1350,27 @@ struct FemtoUniverseProducerTask { } } + template + void fillTracksMCTruth(MCParticlesType const& mcParticles) + { + for (const auto& mc : mcParticles) { // Loop over all MC Truth particles + + std::vector childIDs = {0, 0}; + outputParts(outputCollision.lastIndex(), + mc.pt(), + mc.eta(), + mc.phi(), + aod::femtouniverseparticle::ParticleType::kMCTruthTrack, + 0, + 0, + mc.pdgCode(), + childIDs, + 0, + 0); + fillMCTruthParticle(mc, aod::femtouniverseparticle::ParticleType::kMCTruthTrack); + } + } + template void fillCascade(CollisionType const& col, CascadeType const& fullCascades, TrackType const&) { @@ -2534,7 +2556,11 @@ struct FemtoUniverseProducerTask { if (colcheck) { auto groupedMCParticles = mcParticles.sliceBy(perMCCollision, mccol.globalIndex()); outputCollExtra(1.0, 1.0); - fillParticles(groupedMCParticles, recoMcIds); // fills mc particles + if (!ConfTrkSelection.confIsOnlyMCTrack) { + fillParticles(groupedMCParticles, recoMcIds); // fills mc particles + } else { + fillTracksMCTruth(groupedMCParticles); + } } } } From 5a8843fc3c95fa771c4e0b09e6f7eef452d18cd9 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Mon, 13 Oct 2025 07:21:05 +0200 Subject: [PATCH 730/986] [PWGEM/Dilepton,Common] update muon analyses (#13348) Co-authored-by: ALICE Action Bot --- Common/Core/fwdtrackUtilities.h | 93 +++-- PWGEM/Dilepton/DataModel/dileptonTables.h | 44 ++- .../TableProducer/skimmerPrimaryMuon.cxx | 235 ++++++++++-- .../Dilepton/Tasks/Converters/CMakeLists.txt | 5 + .../Tasks/Converters/muonConverter1.cxx | 53 +++ .../Tasks/Converters/trackConverter1.cxx | 2 +- PWGEM/Dilepton/Tasks/createResolutionMap.cxx | 166 +++++++- PWGEM/Dilepton/Tasks/matchingMFT.cxx | 362 ++++++++++++++---- 8 files changed, 825 insertions(+), 135 deletions(-) create mode 100644 PWGEM/Dilepton/Tasks/Converters/muonConverter1.cxx diff --git a/Common/Core/fwdtrackUtilities.h b/Common/Core/fwdtrackUtilities.h index 0533bfea89c..a07f461394d 100644 --- a/Common/Core/fwdtrackUtilities.h +++ b/Common/Core/fwdtrackUtilities.h @@ -18,6 +18,7 @@ #ifndef COMMON_CORE_FWDTRACKUTILITIES_H_ #define COMMON_CORE_FWDTRACKUTILITIES_H_ +#include "Framework/AnalysisDataModel.h" #include #include #include @@ -29,6 +30,7 @@ #include #include +#include #include namespace o2::aod @@ -40,30 +42,71 @@ enum class propagationPoint : int { kToVertex = 0, kToDCA = 1, kToRabs = 2, + kToMatchingPlane = 3, }; using SMatrix55 = ROOT::Math::SMatrix>; using SMatrix55Std = ROOT::Math::SMatrix; using SMatrix5 = ROOT::Math::SVector; -/// propagate fwdtrack to a certain point. -template -o2::dataformats::GlobalFwdTrack propagateMuon(TFwdTrack const& muon, TCollision const& collision, const propagationPoint endPoint) +template +o2::track::TrackParCovFwd getTrackParCovFwd(TFwdTrack const& track, TFwdTrackCov const& cov) { - double chi2 = muon.chi2(); - SMatrix5 tpars(muon.x(), muon.y(), muon.phi(), muon.tgl(), muon.signed1Pt()); - std::vector v1{muon.cXX(), muon.cXY(), muon.cYY(), muon.cPhiX(), muon.cPhiY(), - muon.cPhiPhi(), muon.cTglX(), muon.cTglY(), muon.cTglPhi(), muon.cTglTgl(), - muon.c1PtX(), muon.c1PtY(), muon.c1PtPhi(), muon.c1PtTgl(), muon.c1Pt21Pt2()}; + // This function works for both (saMuon, saMuon) and (MFTTrack, MFTTrackCov). + // Don't use covariant matrix of global muons stored in AO2D.root. + + double chi2 = track.chi2(); + if constexpr (std::is_same_v, aod::MFTTracksCov::iterator>) { + chi2 = track.chi2(); + } else { + if (track.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) { + chi2 = track.chi2(); + } else if (track.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) { + chi2 = track.chi2() * (2.f * track.nClusters() - 5.f); + } + } + + SMatrix5 tpars(track.x(), track.y(), track.phi(), track.tgl(), track.signed1Pt()); + std::vector v1{cov.cXX(), cov.cXY(), cov.cYY(), cov.cPhiX(), cov.cPhiY(), + cov.cPhiPhi(), cov.cTglX(), cov.cTglY(), cov.cTglPhi(), cov.cTglTgl(), + cov.c1PtX(), cov.c1PtY(), cov.c1PtPhi(), cov.c1PtTgl(), cov.c1Pt21Pt2()}; SMatrix55 tcovs(v1.begin(), v1.end()); - o2::track::TrackParCovFwd fwdtrack{muon.z(), tpars, tcovs, chi2}; + o2::track::TrackParCovFwd trackparCov{track.z(), tpars, tcovs, chi2}; // this is chi2! Not chi2/ndf. + v1.clear(); + v1.shrink_to_fit(); + return trackparCov; +} + +/// propagate fwdtrack to a certain point. +template +o2::dataformats::GlobalFwdTrack propagateMuon(TFwdTrack const& muon, TFwdTrackCov const& cov, TCollision const& collision, const propagationPoint endPoint, const float matchingZ, const float bzkG) +{ + o2::track::TrackParCovFwd trackParCovFwd; + if (muon.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) { + trackParCovFwd = getTrackParCovFwd(muon, cov); + } else if (muon.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) { + trackParCovFwd = getTrackParCovFwd(muon, muon); + } else { + trackParCovFwd = getTrackParCovFwd(muon, muon); + } + + o2::dataformats::GlobalFwdTrack propmuon = propagateTrackParCovFwd(trackParCovFwd, muon.trackType(), collision, endPoint, matchingZ, bzkG); + return propmuon; +} + +template +o2::dataformats::GlobalFwdTrack propagateTrackParCovFwd(TFwdTrackParCov const& fwdtrackORG, uint8_t trackType, TCollision const& collision, const propagationPoint endPoint, const float matchingZ, const float bzkG) +{ + // TFwdTrackParCov is o2::track::TrackParCovFwd + + o2::track::TrackParCovFwd fwdtrack(fwdtrackORG); o2::dataformats::GlobalFwdTrack propmuon; o2::globaltracking::MatchGlobalFwd mMatching; - if (static_cast(muon.trackType()) > 2) { // MCH-MID or MCH standalone + if (trackType > 2) { // MCH-MID or MCH standalone o2::dataformats::GlobalFwdTrack track; - track.setParameters(tpars); + track.setParameters(fwdtrack.getParameters()); track.setZ(fwdtrack.getZ()); - track.setCovariances(tcovs); + track.setCovariances(fwdtrack.getCovariances()); auto mchTrack = mMatching.FwdtoMCH(track); if (endPoint == propagationPoint::kToVertex) { @@ -72,37 +115,42 @@ o2::dataformats::GlobalFwdTrack propagateMuon(TFwdTrack const& muon, TCollision o2::mch::TrackExtrap::extrapToVertexWithoutBranson(mchTrack, collision.posZ()); } else if (endPoint == propagationPoint::kToRabs) { o2::mch::TrackExtrap::extrapToZ(mchTrack, -505.); + } else if (endPoint == propagationPoint::kToMatchingPlane) { + o2::mch::TrackExtrap::extrapToVertexWithoutBranson(mchTrack, matchingZ); } auto proptrack = mMatching.MCHtoFwd(mchTrack); propmuon.setParameters(proptrack.getParameters()); propmuon.setZ(proptrack.getZ()); propmuon.setCovariances(proptrack.getCovariances()); - } else if (static_cast(muon.trackType()) < 2) { // MFT-MCH-MID - const double centerMFT[3] = {0, 0, -61.4}; - o2::field::MagneticField* field = static_cast(TGeoGlobalMagField::Instance()->GetField()); - auto Bz = field->getBz(centerMFT); // Get field at centre of MFT - auto geoMan = o2::base::GeometryManager::meanMaterialBudget(muon.x(), muon.y(), muon.z(), collision.posX(), collision.posY(), collision.posZ()); + } else if (trackType < 2) { // MFT-MCH-MID + // const double centerMFT[3] = {0, 0, -61.4}; + // o2::field::MagneticField* field = static_cast(TGeoGlobalMagField::Instance()->GetField()); + // auto Bz = field->getBz(centerMFT); // Get field at centre of MFT in kG. + + auto geoMan = o2::base::GeometryManager::meanMaterialBudget(fwdtrack.getX(), fwdtrack.getY(), fwdtrack.getZ(), collision.posX(), collision.posY(), collision.posZ()); auto x2x0 = static_cast(geoMan.meanX2X0); + if (endPoint == propagationPoint::kToVertex) { - fwdtrack.propagateToVtxhelixWithMCS(collision.posZ(), {collision.posX(), collision.posY()}, {collision.covXX(), collision.covYY()}, Bz, x2x0); + fwdtrack.propagateToVtxhelixWithMCS(collision.posZ(), {collision.posX(), collision.posY()}, {collision.covXX(), collision.covYY()}, bzkG, x2x0); } else if (endPoint == propagationPoint::kToDCA) { - fwdtrack.propagateToZhelix(collision.posZ(), Bz); + fwdtrack.propagateToZhelix(collision.posZ(), bzkG); + } else if (endPoint == propagationPoint::kToMatchingPlane) { + fwdtrack.propagateToZhelix(matchingZ, bzkG); } propmuon.setParameters(fwdtrack.getParameters()); propmuon.setZ(fwdtrack.getZ()); propmuon.setCovariances(fwdtrack.getCovariances()); } - v1.clear(); - v1.shrink_to_fit(); - return propmuon; } template o2::dataformats::GlobalFwdTrack refitGlobalMuonCov(TFwdTrack const& muon, TMFTTrack const& mft) { + // TFwdTrack and TMFTTrack are o2::track::TrackParCovFwd. + auto muonCov = muon.getCovariances(); auto mftCov = mft.getCovariances(); @@ -135,6 +183,7 @@ o2::dataformats::GlobalFwdTrack refitGlobalMuonCov(TFwdTrack const& muon, TMFTTr o2::dataformats::GlobalFwdTrack globalTrack; globalTrack.setParameters(mft.getParameters()); + globalTrack.setZ(mft.getZ()); globalTrack.setInvQPt(invQPtGlob); globalTrack.setCovariances(globalCov); diff --git a/PWGEM/Dilepton/DataModel/dileptonTables.h b/PWGEM/Dilepton/DataModel/dileptonTables.h index 9d03b354d77..ce9a36977b3 100644 --- a/PWGEM/Dilepton/DataModel/dileptonTables.h +++ b/PWGEM/Dilepton/DataModel/dileptonTables.h @@ -706,12 +706,17 @@ DECLARE_SOA_COLUMN(MFTTrackId, mfttrackId, int); DECLARE_SOA_COLUMN(MCHTrackId, mchtrackId, int); //! DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN(GlobalMuonsWithSameMFT, globalMuonsWithSameMFT); //! self indices to global muons that have the same MFTTrackId DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN(AmbiguousMuons, ambiguousMuons); -DECLARE_SOA_COLUMN(CXXatDCA, cXXatDCA, float); //! DCAx resolution squared at DCA -DECLARE_SOA_COLUMN(CYYatDCA, cYYatDCA, float); //! DCAy resolution squared at DCA -DECLARE_SOA_COLUMN(CXYatDCA, cXYatDCA, float); //! correlation term of DCAx,y resolution at DCA -DECLARE_SOA_COLUMN(PtMatchedMCHMID, ptMatchedMCHMID, float); //! pt of MCH-MID track in MFT-MCH-MID track at PV -DECLARE_SOA_COLUMN(EtaMatchedMCHMID, etaMatchedMCHMID, float); //! eta of MCH-MID track in MFT-MCH-MID track at PV -DECLARE_SOA_COLUMN(PhiMatchedMCHMID, phiMatchedMCHMID, float); //! phi of MCH-MID track in MFT-MCH-MID track at PV +DECLARE_SOA_COLUMN(CXXatDCA, cXXatDCA, float); //! DCAx resolution squared at DCA +DECLARE_SOA_COLUMN(CYYatDCA, cYYatDCA, float); //! DCAy resolution squared at DCA +DECLARE_SOA_COLUMN(CXYatDCA, cXYatDCA, float); //! correlation term of DCAx,y resolution at DCA +DECLARE_SOA_COLUMN(PtMatchedMCHMID, ptMatchedMCHMID, float); //! pt of MCH-MID track in MFT-MCH-MID track at PV +DECLARE_SOA_COLUMN(EtaMatchedMCHMID, etaMatchedMCHMID, float); //! eta of MCH-MID track in MFT-MCH-MID track at PV +DECLARE_SOA_COLUMN(PhiMatchedMCHMID, phiMatchedMCHMID, float); //! phi of MCH-MID track in MFT-MCH-MID track at PV +DECLARE_SOA_COLUMN(EtaMatchedMCHMIDatMP, etaMatchedMCHMIDatMP, float); //! eta of MCH-MID track in MFT-MCH-MID track at matching plane +DECLARE_SOA_COLUMN(PhiMatchedMCHMIDatMP, phiMatchedMCHMIDatMP, float); //! phi of MCH-MID track in MFT-MCH-MID track at matching plane +DECLARE_SOA_COLUMN(EtaMatchedMFTatMP, etaMatchedMFTatMP, float); //! eta of MFT track in MFT-MCH-MID track at matching plane +DECLARE_SOA_COLUMN(PhiMatchedMFTatMP, phiMatchedMFTatMP, float); //! phi of MFT track in MFT-MCH-MID track at matching plane + DECLARE_SOA_COLUMN(IsAssociatedToMPC, isAssociatedToMPC, bool); //! is associated to most probable collision DECLARE_SOA_COLUMN(IsAmbiguous, isAmbiguous, bool); //! is ambiguous DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! @@ -742,7 +747,7 @@ DECLARE_SOA_DYNAMIC_COLUMN(MFTClusterMap, mftClusterMap, //! MFT cluster map, on return clmap; }); } // namespace emprimarymuon -DECLARE_SOA_TABLE(EMPrimaryMuons, "AOD", "EMPRIMARYMU", //! +DECLARE_SOA_TABLE(EMPrimaryMuons_000, "AOD", "EMPRIMARYMU", //! o2::soa::Index<>, emprimarymuon::CollisionId, emprimarymuon::FwdTrackId, emprimarymuon::MFTTrackId, emprimarymuon::MCHTrackId, fwdtrack::TrackType, fwdtrack::Pt, fwdtrack::Eta, fwdtrack::Phi, emprimarymuon::Sign, @@ -763,6 +768,31 @@ DECLARE_SOA_TABLE(EMPrimaryMuons, "AOD", "EMPRIMARYMU", //! emprimarymuon::Px, emprimarymuon::Py, emprimarymuon::Pz); + +DECLARE_SOA_TABLE_VERSIONED(EMPrimaryMuons_001, "AOD", "EMPRIMARYMU", 1, //! + o2::soa::Index<>, emprimarymuon::CollisionId, + emprimarymuon::FwdTrackId, emprimarymuon::MFTTrackId, emprimarymuon::MCHTrackId, fwdtrack::TrackType, + fwdtrack::Pt, fwdtrack::Eta, fwdtrack::Phi, emprimarymuon::Sign, + fwdtrack::FwdDcaX, fwdtrack::FwdDcaY, emprimarymuon::CXXatDCA, emprimarymuon::CYYatDCA, emprimarymuon::CXYatDCA, + emprimarymuon::PtMatchedMCHMID, emprimarymuon::EtaMatchedMCHMID, emprimarymuon::PhiMatchedMCHMID, + emprimarymuon::EtaMatchedMCHMIDatMP, emprimarymuon::PhiMatchedMCHMIDatMP, + emprimarymuon::EtaMatchedMFTatMP, emprimarymuon::PhiMatchedMFTatMP, + + fwdtrack::NClusters, fwdtrack::PDca, fwdtrack::RAtAbsorberEnd, + fwdtrack::Chi2, fwdtrack::Chi2MatchMCHMID, fwdtrack::Chi2MatchMCHMFT, + fwdtrack::MCHBitMap, fwdtrack::MIDBitMap, fwdtrack::MIDBoards, + fwdtrack::MFTClusterSizesAndTrackFlags, emprimarymuon::Chi2MFT, emprimarymuon::IsAssociatedToMPC, emprimarymuon::IsAmbiguous, + + // dynamic column + emprimarymuon::Signed1Pt, + emprimarymuon::NClustersMFT, + emprimarymuon::MFTClusterMap, + emprimarymuon::P, + emprimarymuon::Px, + emprimarymuon::Py, + emprimarymuon::Pz); + +using EMPrimaryMuons = EMPrimaryMuons_001; // iterators using EMPrimaryMuon = EMPrimaryMuons::iterator; diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx index 280c80b8320..656f9136e12 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx @@ -63,7 +63,7 @@ struct skimmerPrimaryMuon { using MFTTracksMC = soa::Join; using MFTTrackMC = MFTTracksMC::iterator; - Produces emprimarymuons; + Produces emprimarymuons; Produces emprimarymuonscov; // Configurables @@ -71,7 +71,7 @@ struct skimmerPrimaryMuon { Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; Configurable fillQAHistograms{"fillQAHistograms", false, "flag to fill QA histograms"}; - Configurable minPt{"minPt", 0.2, "min pt for muon"}; + Configurable minPt{"minPt", 0.1, "min pt for muon"}; Configurable maxPt{"maxPt", 1e+10, "max pt for muon"}; Configurable minEtaSA{"minEtaSA", -4.0, "min. eta acceptance for MCH-MID"}; Configurable maxEtaSA{"maxEtaSA", -2.5, "max. eta acceptance for MCH-MID"}; @@ -81,17 +81,19 @@ struct skimmerPrimaryMuon { Configurable minRabs{"minRabs", 17.6, "min. R at absorber end"}; Configurable midRabs{"midRabs", 26.5, "middle R at absorber end for pDCA cut"}; Configurable maxRabs{"maxRabs", 89.5, "max. R at absorber end"}; - Configurable maxDCAxy{"maxDCAxy", 1e+10, "max. DCAxy for global muons"}; + Configurable maxDCAxy{"maxDCAxy", 1, "max. DCAxy for global muons"}; Configurable maxPDCAforLargeR{"maxPDCAforLargeR", 324.f, "max. pDCA for large R at absorber end"}; Configurable maxPDCAforSmallR{"maxPDCAforSmallR", 594.f, "max. pDCA for small R at absorber end"}; Configurable maxMatchingChi2MCHMFT{"maxMatchingChi2MCHMFT", 50.f, "max. chi2 for MCH-MFT matching"}; Configurable maxChi2SA{"maxChi2SA", 1e+6, "max. chi2 for standalone muon"}; - Configurable maxChi2GL{"maxChi2GL", 1e+6, "max. chi2 for global muon"}; + Configurable maxChi2GL{"maxChi2GL", 10, "max. chi2 for global muon"}; Configurable refitGlobalMuon{"refitGlobalMuon", true, "flag to refit global muon"}; + Configurable matchingZ{"matchingZ", -77.5, "z position where matching is performed"}; o2::ccdb::CcdbApi ccdbApi; Service ccdb; - int mRunNumber; + int mRunNumber = 0; + float mBz = 0; HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; static constexpr std::string_view muon_types[5] = {"MFTMCHMID/", "MFTMCHMIDOtherMatch/", "MFTMCH/", "MCHMID/", "MCH/"}; @@ -108,6 +110,7 @@ struct skimmerPrimaryMuon { addHistograms(); } mRunNumber = 0; + mBz = 0; } void initCCDB(aod::BCsWithTimestamps::iterator const& bc) @@ -126,6 +129,10 @@ struct skimmerPrimaryMuon { ccdb->get(geoPath); } o2::mch::TrackExtrap::setField(); + const double centerMFT[3] = {0, 0, -61.4}; + o2::field::MagneticField* field = static_cast(TGeoGlobalMagField::Instance()->GetField()); + mBz = field->getBz(centerMFT); // Get field at centre of MFT + LOGF(info, "Bz at center of MFT = %f kZG", mBz); } void addHistograms() @@ -143,6 +150,8 @@ struct skimmerPrimaryMuon { fRegistry.add("MFTMCHMID/hDeltaPt_Pt", "#Deltap_{T}/p_{T} vs. p_{T};p_{T}^{gl} (GeV/c);(p_{T}^{sa} - p_{T}^{gl})/p_{T}^{gl}", kTH2F, {{100, 0, 10}, {200, -0.5, +0.5}}, false); fRegistry.add("MFTMCHMID/hDeltaEta_Pt", "#Delta#eta vs. p_{T};p_{T}^{gl} (GeV/c);#Delta#eta", kTH2F, {{100, 0, 10}, {200, -0.5, +0.5}}, false); fRegistry.add("MFTMCHMID/hDeltaPhi_Pt", "#Delta#varphi vs. p_{T};p_{T}^{gl} (GeV/c);#Delta#varphi (rad.)", kTH2F, {{100, 0, 10}, {200, -0.5, +0.5}}, false); + fRegistry.add("MFTMCHMID/hDeltaEtaAtMP_Pt", "#Delta#eta vs. p_{T} at MP;p_{T}^{gl} (GeV/c);#Delta#eta", kTH2F, {{100, 0, 10}, {200, -0.5, +0.5}}, false); + fRegistry.add("MFTMCHMID/hDeltaPhiAtMP_Pt", "#Delta#varphi vs. p_{T} at MP;p_{T}^{gl} (GeV/c);#Delta#varphi (rad.)", kTH2F, {{100, 0, 10}, {200, -0.5, +0.5}}, false); fRegistry.add("MFTMCHMID/hSign", "sign;sign", kTH1F, {{3, -1.5, +1.5}}, false); fRegistry.add("MFTMCHMID/hNclusters", "Nclusters;Nclusters", kTH1F, {{21, -0.5f, 20.5}}, false); fRegistry.add("MFTMCHMID/hNclustersMFT", "NclustersMFT;Nclusters MFT", kTH1F, {{11, -0.5f, 10.5}}, false); @@ -204,8 +213,8 @@ struct skimmerPrimaryMuon { return true; } - template - void fillFwdTrackTable(TCollision const& collision, TFwdTrack fwdtrack, const bool isAmbiguous) + template + void fillFwdTrackTable(TCollision const& collision, TFwdTrack fwdtrack, TMFTTracksCov const& mftCovs, const bool isAmbiguous) { if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && fwdtrack.chi2MatchMCHMFT() > maxMatchingChi2MCHMFT) { return; @@ -219,13 +228,13 @@ struct skimmerPrimaryMuon { return; } - o2::dataformats::GlobalFwdTrack propmuonAtPV = propagateMuon(fwdtrack, collision, propagationPoint::kToVertex); + o2::dataformats::GlobalFwdTrack propmuonAtPV = propagateMuon(fwdtrack, fwdtrack, collision, propagationPoint::kToVertex, matchingZ, mBz); float pt = propmuonAtPV.getPt(); float eta = propmuonAtPV.getEta(); float phi = propmuonAtPV.getPhi(); o2::math_utils::bringTo02Pi(phi); - o2::dataformats::GlobalFwdTrack propmuonAtDCA = propagateMuon(fwdtrack, collision, propagationPoint::kToDCA); + o2::dataformats::GlobalFwdTrack propmuonAtDCA = propagateMuon(fwdtrack, fwdtrack, collision, propagationPoint::kToDCA, matchingZ, mBz); float cXXatDCA = propmuonAtDCA.getSigma2X(); float cYYatDCA = propmuonAtDCA.getSigma2Y(); float cXYatDCA = propmuonAtDCA.getSigmaXY(); @@ -257,6 +266,12 @@ struct skimmerPrimaryMuon { float chi2mft = 0.f; uint64_t mftClusterSizesAndTrackFlags = 0; int ndf_mchmft = 1; + int ndf_mft = 1; + + float etaMatchedMCHMIDatMP = 999.f; + float phiMatchedMCHMIDatMP = 999.f; + float etaMatchedMFTatMP = 999.f; + float phiMatchedMFTatMP = 999.f; if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) { // apply r-absorber cut here to minimize the number of calling propagateMuon. @@ -274,6 +289,7 @@ struct skimmerPrimaryMuon { nClustersMFT = mfttrack.nClusters(); mftClusterSizesAndTrackFlags = mfttrack.mftClusterSizesAndTrackFlags(); ndf_mchmft = 2.f * (mchtrack.nClusters() + nClustersMFT) - 5.f; + ndf_mft = 2.f * nClustersMFT - 5.f; chi2mft = mfttrack.chi2(); // chi2mft = mfttrack.chi2() / (2.f * nClustersMFT - 5.f); @@ -282,13 +298,13 @@ struct skimmerPrimaryMuon { return; } - o2::dataformats::GlobalFwdTrack propmuonAtPV_Matched = propagateMuon(mchtrack, collision, propagationPoint::kToVertex); + o2::dataformats::GlobalFwdTrack propmuonAtPV_Matched = propagateMuon(mchtrack, mchtrack, collision, propagationPoint::kToVertex, matchingZ, mBz); ptMatchedMCHMID = propmuonAtPV_Matched.getPt(); etaMatchedMCHMID = propmuonAtPV_Matched.getEta(); phiMatchedMCHMID = propmuonAtPV_Matched.getPhi(); o2::math_utils::bringTo02Pi(phiMatchedMCHMID); - o2::dataformats::GlobalFwdTrack propmuonAtDCA_Matched = propagateMuon(mchtrack, collision, propagationPoint::kToDCA); + o2::dataformats::GlobalFwdTrack propmuonAtDCA_Matched = propagateMuon(mchtrack, mchtrack, collision, propagationPoint::kToDCA, matchingZ, mBz); float dcaX_Matched = propmuonAtDCA_Matched.getX() - collision.posX(); float dcaY_Matched = propmuonAtDCA_Matched.getY() - collision.posY(); float dcaXY_Matched = std::sqrt(dcaX_Matched * dcaX_Matched + dcaY_Matched * dcaY_Matched); @@ -306,9 +322,35 @@ struct skimmerPrimaryMuon { // y = mfttrack.y(); // z = mfttrack.z(); // tgl = mfttrack.tgl(); + + if constexpr (withMFTCov) { + auto mfttrackcov = mftCovs.rawIteratorAt(map_mfttrackcovs[mfttrack.globalIndex()]); + auto muonAtMP = propagateMuon(mchtrack, mchtrack, collision, propagationPoint::kToMatchingPlane, matchingZ, mBz); // propagated to matching plane + o2::track::TrackParCovFwd mftsaAtMP = getTrackParCovFwd(mfttrack, mfttrackcov); // values at innermost update + mftsaAtMP.propagateToZhelix(matchingZ, mBz); // propagated to matching plane + etaMatchedMFTatMP = mftsaAtMP.getEta(); + phiMatchedMFTatMP = mftsaAtMP.getPhi(); + etaMatchedMCHMIDatMP = muonAtMP.getEta(); + phiMatchedMCHMIDatMP = muonAtMP.getPhi(); + o2::math_utils::bringTo02Pi(phiMatchedMCHMIDatMP); + o2::math_utils::bringTo02Pi(phiMatchedMFTatMP); + + // o2::track::TrackParCovFwd mftsa = getTrackParCovFwd(mfttrack, mfttrackcov); // values at innermost update + // o2::dataformats::GlobalFwdTrack globalMuonRefit = o2::aod::fwdtrackutils::refitGlobalMuonCov(propmuonAtPV_Matched, mftsa); // this is track at IU. + // auto globalMuonAtDCA = o2::aod::fwdtrackutils::propagateTrackParCovFwd(globalMuonRefit, fwdtrack.trackType(), collision, propagationPoint::kToDCA, matchingZ, mBz); + // pt = globalMuonAtDCA.getPt(); + // eta = globalMuonAtDCA.getEta(); + // phi = globalMuonAtDCA.getPhi(); + // o2::math_utils::bringTo02Pi(phi); + // cXXatDCA = globalMuonAtDCA.getSigma2X(); + // cYYatDCA = globalMuonAtDCA.getSigma2Y(); + // cXYatDCA = globalMuonAtDCA.getSigmaXY(); + // dcaX = globalMuonAtDCA.getX() - collision.posX(); + // dcaY = globalMuonAtDCA.getY() - collision.posY(); + } } } else if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) { - o2::dataformats::GlobalFwdTrack propmuonAtRabs = propagateMuon(fwdtrack, collision, propagationPoint::kToRabs); // this is necessary only for MuonStandaloneTrack + o2::dataformats::GlobalFwdTrack propmuonAtRabs = propagateMuon(fwdtrack, fwdtrack, collision, propagationPoint::kToRabs, matchingZ, mBz); // this is necessary only for MuonStandaloneTrack float xAbs = propmuonAtRabs.getX(); float yAbs = propmuonAtRabs.getY(); rAtAbsorberEnd = std::sqrt(xAbs * xAbs + yAbs * yAbs); // Redo propagation only for muon tracks // propagation of MFT tracks alredy done in reconstruction @@ -325,12 +367,16 @@ struct skimmerPrimaryMuon { float dphi = phiMatchedMCHMID - phi; o2::math_utils::bringToPMPi(dphi); + float detaMP = etaMatchedMCHMIDatMP - etaMatchedMFTatMP; + float dphiMP = phiMatchedMCHMIDatMP - phiMatchedMFTatMP; + o2::math_utils::bringToPMPi(dphiMP); + bool isAssociatedToMPC = fwdtrack.collisionId() == collision.globalIndex(); // LOGF(info, "isAmbiguous = %d, isAssociatedToMPC = %d, fwdtrack.globalIndex() = %d, fwdtrack.collisionId() = %d, collision.globalIndex() = %d", isAmbiguous, isAssociatedToMPC, fwdtrack.globalIndex(), fwdtrack.collisionId(), collision.globalIndex()); emprimarymuons(collision.globalIndex(), fwdtrack.globalIndex(), fwdtrack.matchMFTTrackId(), fwdtrack.matchMCHTrackId(), fwdtrack.trackType(), pt, eta, phi, fwdtrack.sign(), dcaX, dcaY, cXXatDCA, cYYatDCA, cXYatDCA, ptMatchedMCHMID, etaMatchedMCHMID, phiMatchedMCHMID, - // x, y, z, tgl, + etaMatchedMCHMIDatMP, phiMatchedMCHMIDatMP, etaMatchedMFTatMP, phiMatchedMFTatMP, fwdtrack.nClusters(), pDCA, rAtAbsorberEnd, fwdtrack.chi2(), fwdtrack.chi2MatchMCHMID(), fwdtrack.chi2MatchMCHMFT(), fwdtrack.mchBitMap(), fwdtrack.midBitMap(), fwdtrack.midBoards(), mftClusterSizesAndTrackFlags, chi2mft, isAssociatedToMPC, isAmbiguous); @@ -359,13 +405,15 @@ struct skimmerPrimaryMuon { fRegistry.fill(HIST("MFTMCHMID/hDeltaPt_Pt"), pt, dpt); fRegistry.fill(HIST("MFTMCHMID/hDeltaEta_Pt"), pt, deta); fRegistry.fill(HIST("MFTMCHMID/hDeltaPhi_Pt"), pt, dphi); + fRegistry.fill(HIST("MFTMCHMID/hDeltaEtaAtMP_Pt"), pt, detaMP); + fRegistry.fill(HIST("MFTMCHMID/hDeltaPhiAtMP_Pt"), pt, dphiMP); fRegistry.fill(HIST("MFTMCHMID/hSign"), fwdtrack.sign()); fRegistry.fill(HIST("MFTMCHMID/hNclusters"), fwdtrack.nClusters()); fRegistry.fill(HIST("MFTMCHMID/hNclustersMFT"), nClustersMFT); fRegistry.fill(HIST("MFTMCHMID/hPDCA_Rabs"), rAtAbsorberEnd, pDCA); fRegistry.fill(HIST("MFTMCHMID/hRatAbsorberEnd"), rAtAbsorberEnd); fRegistry.fill(HIST("MFTMCHMID/hChi2"), fwdtrack.chi2() / ndf_mchmft); - fRegistry.fill(HIST("MFTMCHMID/hChi2MFT"), chi2mft); + fRegistry.fill(HIST("MFTMCHMID/hChi2MFT"), chi2mft / ndf_mft); fRegistry.fill(HIST("MFTMCHMID/hChi2MatchMCHMID"), fwdtrack.chi2MatchMCHMID()); fRegistry.fill(HIST("MFTMCHMID/hChi2MatchMCHMFT"), fwdtrack.chi2MatchMCHMFT()); fRegistry.fill(HIST("MFTMCHMID/hDCAxy2D"), dcaX, dcaY); @@ -382,13 +430,15 @@ struct skimmerPrimaryMuon { fRegistry.fill(HIST("MCHMID/hDeltaPt_Pt"), pt, dpt); fRegistry.fill(HIST("MCHMID/hDeltaEta_Pt"), pt, deta); fRegistry.fill(HIST("MCHMID/hDeltaPhi_Pt"), pt, dphi); + fRegistry.fill(HIST("MCHMID/hDeltaEtaAtMP_Pt"), pt, detaMP); + fRegistry.fill(HIST("MCHMID/hDeltaPhiAtMP_Pt"), pt, dphiMP); fRegistry.fill(HIST("MCHMID/hSign"), fwdtrack.sign()); fRegistry.fill(HIST("MCHMID/hNclusters"), fwdtrack.nClusters()); fRegistry.fill(HIST("MCHMID/hNclustersMFT"), nClustersMFT); fRegistry.fill(HIST("MCHMID/hPDCA_Rabs"), rAtAbsorberEnd, pDCA); fRegistry.fill(HIST("MCHMID/hRatAbsorberEnd"), rAtAbsorberEnd); fRegistry.fill(HIST("MCHMID/hChi2"), fwdtrack.chi2()); - fRegistry.fill(HIST("MCHMID/hChi2MFT"), chi2mft); + fRegistry.fill(HIST("MCHMID/hChi2MFT"), chi2mft / ndf_mft); fRegistry.fill(HIST("MCHMID/hChi2MatchMCHMID"), fwdtrack.chi2MatchMCHMID()); fRegistry.fill(HIST("MCHMID/hChi2MatchMCHMFT"), fwdtrack.chi2MatchMCHMFT()); fRegistry.fill(HIST("MCHMID/hDCAxy2D"), dcaX, dcaY); @@ -402,7 +452,7 @@ struct skimmerPrimaryMuon { } } - // std::map, float> mCandidates; // std::pair -> chi2MatchMCHMFT; + std::unordered_map map_mfttrackcovs; std::vector> vec_min_chi2MatchMCHMFT; // std::pair -> chi2MatchMCHMFT; template void findBestMatchPerMCHMID(TMuons const& muons) @@ -426,7 +476,6 @@ struct skimmerPrimaryMuon { } } vec_min_chi2MatchMCHMFT.emplace_back(tupleIds_at_min); - // mCandidates[tupleIds_at_min] = min_chi2MatchMCHMFT; // LOGF(info, "min: muon_tmp.globalIndex() = %d, muon_tmp.matchMCHTrackId() = %d, muon_tmp.matchMFTTrackId() = %d, muon_tmp.chi2MatchMCHMFT() = %f", std::get<0>(tupleIds_at_min), std::get<1>(tupleIds_at_min), std::get<2>(tupleIds_at_min), min_chi2MatchMCHMFT); } } // end of muon loop @@ -460,10 +509,11 @@ struct skimmerPrimaryMuon { continue; } - fillFwdTrackTable(collision, fwdtrack, false); + fillFwdTrackTable(collision, fwdtrack, nullptr, false); } // end of fwdtrack loop } // end of collision loop + map_mfttrackcovs.clear(); vec_min_chi2MatchMCHMFT.clear(); vec_min_chi2MatchMCHMFT.shrink_to_fit(); } @@ -498,15 +548,59 @@ struct skimmerPrimaryMuon { continue; } - fillFwdTrackTable(collision, fwdtrack, mapAmb[fwdtrack.globalIndex()]); + fillFwdTrackTable(collision, fwdtrack, nullptr, mapAmb[fwdtrack.globalIndex()]); } // end of fwdtrack loop } // end of collision loop + mapAmb.clear(); + map_mfttrackcovs.clear(); vec_min_chi2MatchMCHMFT.clear(); vec_min_chi2MatchMCHMFT.shrink_to_fit(); } PROCESS_SWITCH(skimmerPrimaryMuon, processRec_TTCA, "process reconstructed info", false); + void processRec_TTCA_withMFTCov(MyCollisions const& collisions, MyFwdTracks const& fwdtracks, aod::MFTTracks const&, aod::BCsWithTimestamps const&, aod::FwdTrackAssoc const& fwdtrackIndices, aod::MFTTracksCov const& mftCovs) + { + for (const auto& mfttrackConv : mftCovs) { + map_mfttrackcovs[mfttrackConv.matchMFTTrackId()] = mfttrackConv.globalIndex(); + } + findBestMatchPerMCHMID(fwdtracks); + + std::unordered_map mapAmb; // fwdtrack.globalIndex() -> bool isAmb; + for (const auto& fwdtrack : fwdtracks) { + const auto& fwdtrackIdsPerFwdTrack = fwdtrackIndices.sliceBy(fwdtrackIndicesPerFwdTrack, fwdtrack.globalIndex()); + mapAmb[fwdtrack.globalIndex()] = fwdtrackIdsPerFwdTrack.size() > 1; + // LOGF(info, "fwdtrack.globalIndex() = %d, ntimes = %d, isAmbiguous = %d", fwdtrack.globalIndex(), fwdtrackIdsPerFwdTrack.size(), mapAmb[fwdtrack.globalIndex()]); + } // end of fwdtrack loop + + for (const auto& collision : collisions) { + const auto& bc = collision.template bc_as(); + initCCDB(bc); + + if (!collision.isSelected()) { + continue; + } + + const auto& fwdtrackIdsThisCollision = fwdtrackIndices.sliceBy(fwdtrackIndicesPerCollision, collision.globalIndex()); + for (const auto& fwdtrackId : fwdtrackIdsThisCollision) { + const auto& fwdtrack = fwdtrackId.template fwdtrack_as(); + if (fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) { + continue; + } + if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && std::find(vec_min_chi2MatchMCHMFT.begin(), vec_min_chi2MatchMCHMFT.end(), std::make_tuple(fwdtrack.globalIndex(), fwdtrack.matchMCHTrackId(), fwdtrack.matchMFTTrackId())) == vec_min_chi2MatchMCHMFT.end()) { + continue; + } + + fillFwdTrackTable(collision, fwdtrack, mftCovs, mapAmb[fwdtrack.globalIndex()]); + } // end of fwdtrack loop + } // end of collision loop + mapAmb.clear(); + map_mfttrackcovs.clear(); + vec_min_chi2MatchMCHMFT.clear(); + vec_min_chi2MatchMCHMFT.shrink_to_fit(); + } + PROCESS_SWITCH(skimmerPrimaryMuon, processRec_TTCA_withMFTCov, "process reconstructed info", false); + void processRec_SA_SWT(MyCollisionsWithSWT const& collisions, MyFwdTracks const& fwdtracks, aod::MFTTracks const&, aod::BCsWithTimestamps const&) { findBestMatchPerMCHMID(fwdtracks); @@ -532,9 +626,10 @@ struct skimmerPrimaryMuon { continue; } - fillFwdTrackTable(collision, fwdtrack, false); + fillFwdTrackTable(collision, fwdtrack, nullptr, false); } // end of fwdtrack loop } // end of collision loop + map_mfttrackcovs.clear(); vec_min_chi2MatchMCHMFT.clear(); vec_min_chi2MatchMCHMFT.shrink_to_fit(); } @@ -571,15 +666,60 @@ struct skimmerPrimaryMuon { continue; } - fillFwdTrackTable(collision, fwdtrack, mapAmb[fwdtrack.globalIndex()]); + fillFwdTrackTable(collision, fwdtrack, nullptr, mapAmb[fwdtrack.globalIndex()]); } // end of fwdtrack loop } // end of collision loop mapAmb.clear(); + map_mfttrackcovs.clear(); vec_min_chi2MatchMCHMFT.clear(); vec_min_chi2MatchMCHMFT.shrink_to_fit(); } PROCESS_SWITCH(skimmerPrimaryMuon, processRec_TTCA_SWT, "process reconstructed info", false); + void processRec_TTCA_SWT_withMFTCov(MyCollisionsWithSWT const& collisions, MyFwdTracks const& fwdtracks, aod::MFTTracks const&, aod::BCsWithTimestamps const&, aod::FwdTrackAssoc const& fwdtrackIndices, aod::MFTTracksCov const& mftCovs) + { + for (const auto& mfttrackConv : mftCovs) { + map_mfttrackcovs[mfttrackConv.matchMFTTrackId()] = mfttrackConv.globalIndex(); + } + findBestMatchPerMCHMID(fwdtracks); + + std::unordered_map mapAmb; // fwdtrack.globalIndex() -> bool isAmb; + for (const auto& fwdtrack : fwdtracks) { + const auto& fwdtrackIdsPerFwdTrack = fwdtrackIndices.sliceBy(fwdtrackIndicesPerFwdTrack, fwdtrack.globalIndex()); + mapAmb[fwdtrack.globalIndex()] = fwdtrackIdsPerFwdTrack.size() > 1; + // LOGF(info, "fwdtrack.globalIndex() = %d, ntimes = %d, isAmbiguous = %d", fwdtrack.globalIndex(), fwdtrackIdsPerFwdTrack.size(), mapAmb[fwdtrack.globalIndex()]); + } // end of fwdtrack loop + + for (const auto& collision : collisions) { + const auto& bc = collision.template bc_as(); + initCCDB(bc); + if (!collision.isSelected()) { + continue; + } + if (collision.swtaliastmp_raw() == 0) { + continue; + } + + const auto& fwdtrackIdsThisCollision = fwdtrackIndices.sliceBy(fwdtrackIndicesPerCollision, collision.globalIndex()); + for (const auto& fwdtrackId : fwdtrackIdsThisCollision) { + const auto& fwdtrack = fwdtrackId.template fwdtrack_as(); + if (fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) { + continue; + } + if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && std::find(vec_min_chi2MatchMCHMFT.begin(), vec_min_chi2MatchMCHMFT.end(), std::make_tuple(fwdtrack.globalIndex(), fwdtrack.matchMCHTrackId(), fwdtrack.matchMFTTrackId())) == vec_min_chi2MatchMCHMFT.end()) { + continue; + } + + fillFwdTrackTable(collision, fwdtrack, mftCovs, mapAmb[fwdtrack.globalIndex()]); + } // end of fwdtrack loop + } // end of collision loop + mapAmb.clear(); + map_mfttrackcovs.clear(); + vec_min_chi2MatchMCHMFT.clear(); + vec_min_chi2MatchMCHMFT.shrink_to_fit(); + } + PROCESS_SWITCH(skimmerPrimaryMuon, processRec_TTCA_SWT_withMFTCov, "process reconstructed info", false); + void processMC_SA(soa::Join const& collisions, MyFwdTracksMC const& fwdtracks, MFTTracksMC const&, aod::BCsWithTimestamps const&) { findBestMatchPerMCHMID(fwdtracks); @@ -606,9 +746,10 @@ struct skimmerPrimaryMuon { continue; } - fillFwdTrackTable(collision, fwdtrack, false); + fillFwdTrackTable(collision, fwdtrack, nullptr, false); } // end of fwdtrack loop } // end of collision loop + map_mfttrackcovs.clear(); vec_min_chi2MatchMCHMFT.clear(); vec_min_chi2MatchMCHMFT.shrink_to_fit(); } @@ -648,15 +789,63 @@ struct skimmerPrimaryMuon { continue; } - fillFwdTrackTable(collision, fwdtrack, mapAmb[fwdtrack.globalIndex()]); + fillFwdTrackTable(collision, fwdtrack, nullptr, mapAmb[fwdtrack.globalIndex()]); } // end of fwdtrack loop } // end of collision loop mapAmb.clear(); + map_mfttrackcovs.clear(); vec_min_chi2MatchMCHMFT.clear(); vec_min_chi2MatchMCHMFT.shrink_to_fit(); } PROCESS_SWITCH(skimmerPrimaryMuon, processMC_TTCA, "process reconstructed and MC info", false); + void processMC_TTCA_withMFTCov(soa::Join const& collisions, MyFwdTracksMC const& fwdtracks, MFTTracksMC const&, aod::BCsWithTimestamps const&, aod::FwdTrackAssoc const& fwdtrackIndices, aod::MFTTracksCov const& mftCovs) + { + for (const auto& mfttrackConv : mftCovs) { + map_mfttrackcovs[mfttrackConv.matchMFTTrackId()] = mfttrackConv.globalIndex(); + } + findBestMatchPerMCHMID(fwdtracks); + + std::unordered_map mapAmb; // fwdtrack.globalIndex() -> bool isAmb; + for (const auto& fwdtrack : fwdtracks) { + const auto& fwdtrackIdsPerFwdTrack = fwdtrackIndices.sliceBy(fwdtrackIndicesPerFwdTrack, fwdtrack.globalIndex()); + mapAmb[fwdtrack.globalIndex()] = fwdtrackIdsPerFwdTrack.size() > 1; + // LOGF(info, "fwdtrack.globalIndex() = %d, ntimes = %d, isAmbiguous = %d", fwdtrack.globalIndex(), fwdtrackIdsPerFwdTrack.size(), mapAmb[fwdtrack.globalIndex()]); + } // end of fwdtrack loop + + for (const auto& collision : collisions) { + const auto& bc = collision.template bc_as(); + initCCDB(bc); + if (!collision.isSelected()) { + continue; + } + if (!collision.has_mcCollision()) { + continue; + } + + const auto& fwdtrackIdsThisCollision = fwdtrackIndices.sliceBy(fwdtrackIndicesPerCollision, collision.globalIndex()); + for (const auto& fwdtrackId : fwdtrackIdsThisCollision) { + const auto& fwdtrack = fwdtrackId.template fwdtrack_as(); + if (!fwdtrack.has_mcParticle()) { + continue; + } + if (fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) { + continue; + } + if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && std::find(vec_min_chi2MatchMCHMFT.begin(), vec_min_chi2MatchMCHMFT.end(), std::make_tuple(fwdtrack.globalIndex(), fwdtrack.matchMCHTrackId(), fwdtrack.matchMFTTrackId())) == vec_min_chi2MatchMCHMFT.end()) { + continue; + } + + fillFwdTrackTable(collision, fwdtrack, mftCovs, mapAmb[fwdtrack.globalIndex()]); + } // end of fwdtrack loop + } // end of collision loop + mapAmb.clear(); + map_mfttrackcovs.clear(); + vec_min_chi2MatchMCHMFT.clear(); + vec_min_chi2MatchMCHMFT.shrink_to_fit(); + } + PROCESS_SWITCH(skimmerPrimaryMuon, processMC_TTCA_withMFTCov, "process reconstructed and MC with MFTCov info", false); + void processDummy(aod::Collisions const&) {} PROCESS_SWITCH(skimmerPrimaryMuon, processDummy, "process dummy", true); }; diff --git a/PWGEM/Dilepton/Tasks/Converters/CMakeLists.txt b/PWGEM/Dilepton/Tasks/Converters/CMakeLists.txt index b41943ef7ff..489839883ec 100644 --- a/PWGEM/Dilepton/Tasks/Converters/CMakeLists.txt +++ b/PWGEM/Dilepton/Tasks/Converters/CMakeLists.txt @@ -45,3 +45,8 @@ o2physics_add_dpl_workflow(track-converter1 PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(muon-converter1 + SOURCES muonConverter1.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + diff --git a/PWGEM/Dilepton/Tasks/Converters/muonConverter1.cxx b/PWGEM/Dilepton/Tasks/Converters/muonConverter1.cxx new file mode 100644 index 00000000000..527faf7c723 --- /dev/null +++ b/PWGEM/Dilepton/Tasks/Converters/muonConverter1.cxx @@ -0,0 +1,53 @@ +// 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. +// +// ======================== +// +// This code produces muon table 001 from 000. +// Please write to: daiki.sekihata@cern.ch + +#include "PWGEM/Dilepton/DataModel/dileptonTables.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +using namespace o2; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; + +struct muonConverter1 { + Produces muon_001; + + void process(aod::EMPrimaryMuons_000 const& muons) + { + for (const auto& muon : muons) { + muon_001( + muon.collisionId(), + muon.fwdtrackId(), muon.mfttrackId(), muon.mchtrackId(), muon.trackType(), + muon.pt(), muon.eta(), muon.phi(), muon.sign(), + muon.fwdDcaX(), muon.fwdDcaY(), muon.cXXatDCA(), muon.cYYatDCA(), muon.cXYatDCA(), + muon.ptMatchedMCHMID(), muon.etaMatchedMCHMID(), muon.phiMatchedMCHMID(), + 0, 0, 0, 0, + muon.nClusters(), muon.pDca(), muon.rAtAbsorberEnd(), + muon.chi2(), muon.chi2MatchMCHMID(), muon.chi2MatchMCHMFT(), + muon.mchBitMap(), muon.midBitMap(), muon.midBoards(), + muon.mftClusterSizesAndTrackFlags(), muon.chi2MFT(), muon.isAssociatedToMPC(), muon.isAmbiguous()); + } // end of muon loop + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"muon-converter1"})}; +} diff --git a/PWGEM/Dilepton/Tasks/Converters/trackConverter1.cxx b/PWGEM/Dilepton/Tasks/Converters/trackConverter1.cxx index fda87265b3c..c6f7bfce634 100644 --- a/PWGEM/Dilepton/Tasks/Converters/trackConverter1.cxx +++ b/PWGEM/Dilepton/Tasks/Converters/trackConverter1.cxx @@ -31,7 +31,7 @@ struct trackConverter1 { void process(aod::EMPrimaryTracks_000 const& tracks) { - for (auto& track : tracks) { + for (const auto& track : tracks) { track_001(track.collisionId(), track.trackId(), track.sign() / track.pt(), diff --git a/PWGEM/Dilepton/Tasks/createResolutionMap.cxx b/PWGEM/Dilepton/Tasks/createResolutionMap.cxx index 09dc09f37a0..cc93bbccde9 100644 --- a/PWGEM/Dilepton/Tasks/createResolutionMap.cxx +++ b/PWGEM/Dilepton/Tasks/createResolutionMap.cxx @@ -16,6 +16,7 @@ #include "PWGEM/Dilepton/Utils/MCUtilities.h" #include "Common/CCDB/RCTSelectionFlags.h" +#include "Common/Core/RecoDecay.h" #include "Common/Core/fwdtrackUtilities.h" #include "Common/Core/trackUtilities.h" #include "Common/DataModel/Centrality.h" @@ -46,6 +47,8 @@ #include #include #include +#include +#include #include #include @@ -167,9 +170,12 @@ struct CreateResolutionMap { Configurable cfg_max_reldpt{"cfg_max_reldpt", 1e+10f, "max. relative dpt between MFT-MCH-MID and MCH-MID"}; Configurable cfg_max_deta{"cfg_max_deta", 1e+10f, "max. deta between MFT-MCH-MID and MCH-MID"}; Configurable cfg_max_dphi{"cfg_max_dphi", 1e+10f, "max. dphi between MFT-MCH-MID and MCH-MID"}; + Configurable cfg_max_detaMP{"cfg_max_detaMP", 1e+10f, "max. deta between MFT and MCH-MID at matching plane"}; + Configurable cfg_max_dphiMP{"cfg_max_dphiMP", 1e+10f, "max. dphi between MFT and MCH-MID at matching plane"}; Configurable refitGlobalMuon{"refitGlobalMuon", true, "flag to refit global muon"}; Configurable requireMFTHitMap{"requireMFTHitMap", false, "flag to require MFT hit map"}; Configurable> requiredMFTDisks{"requiredMFTDisks", std::vector{4}, "hit map on MFT disks [0,1,2,3,4]. logical-OR of each double-sided disk"}; + Configurable matchingZ{"matchingZ", -77.5, "z position where matching is performed"}; } muoncuts; HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -180,7 +186,8 @@ struct CreateResolutionMap { o2::ccdb::CcdbApi ccdbApi; Service ccdb; int mRunNumber = 0; - float d_bz; + float mBzMFT = 0; + float d_bz = 0; // o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; o2::dataformats::VertexBase mVtx; @@ -215,6 +222,7 @@ struct CreateResolutionMap { mRunNumber = 0; d_bz = 0; + mBzMFT = 0; if (ConfPhiPositionCBGenBins.value[0] == VARIABLE_WIDTH) { phiPosition_bin_edges = std::vector(ConfPhiPositionCBGenBins.value.begin(), ConfPhiPositionCBGenBins.value.end()); @@ -305,7 +313,10 @@ struct CreateResolutionMap { ccdb->get(geoPath); } o2::mch::TrackExtrap::setField(); - return; + const double centerMFT[3] = {0, 0, -61.4}; + o2::field::MagneticField* field = static_cast(TGeoGlobalMagField::Instance()->GetField()); + mBzMFT = field->getBz(centerMFT); // Get field at centre of MFT + LOGF(info, "Bz at center of MFT = %f kZG", mBzMFT); } auto run3grp_timestamp = bc.timestamp(); @@ -518,8 +529,8 @@ struct CreateResolutionMap { return true; } - template - void fillMuon(TCollision const& collision, TMuon const& muon, const float centrality) + template + void fillMuon(TCollision const& collision, TMuon const& muon, TMFTTracksCov const& mftCovs, const float centrality) { auto mcparticle = muon.template mcParticle_as(); if (std::abs(mcparticle.pdgCode()) != 13 || !(mcparticle.isPhysicalPrimary() || mcparticle.producedByGenerator())) { @@ -532,11 +543,15 @@ struct CreateResolutionMap { return; } + if (muon.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && std::find(vec_min_chi2MatchMCHMFT.begin(), vec_min_chi2MatchMCHMFT.end(), std::make_tuple(muon.globalIndex(), muon.matchMCHTrackId(), muon.matchMFTTrackId())) == vec_min_chi2MatchMCHMFT.end()) { + return; + } + if (muon.chi2MatchMCHMID() < 0.f) { // this should never happen. only for protection. return; } - o2::dataformats::GlobalFwdTrack propmuonAtPV = propagateMuon(muon, collision, propagationPoint::kToVertex); - o2::dataformats::GlobalFwdTrack propmuonAtDCA = propagateMuon(muon, collision, propagationPoint::kToDCA); + o2::dataformats::GlobalFwdTrack propmuonAtPV = propagateMuon(muon, muon, collision, propagationPoint::kToVertex, muoncuts.matchingZ, mBzMFT); + o2::dataformats::GlobalFwdTrack propmuonAtDCA = propagateMuon(muon, muon, collision, propagationPoint::kToDCA, muoncuts.matchingZ, mBzMFT); float pt = propmuonAtPV.getPt(); float eta = propmuonAtPV.getEta(); @@ -555,10 +570,15 @@ struct CreateResolutionMap { float phiMatchedMCHMID = propmuonAtPV.getPhi(); o2::math_utils::bringTo02Pi(phiMatchedMCHMID); + float etaMatchedMCHMIDatMP = 999.f; + float phiMatchedMCHMIDatMP = 999.f; + float etaMatchedMFTatMP = 999.f; + float phiMatchedMFTatMP = 999.f; + if (muon.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) { // mcparticle for global MFT-MCH-MID is identical to mcparticle of MCH-MID track. If not, mismatch. - const auto& mchtrack = muon.template matchMCHTrack_as(); // MCH-MID - const auto& mfttrack = muon.template matchMFTTrack_as(); // MFTsa + auto mchtrack = muon.template matchMCHTrack_as(); // MCH-MID + auto mfttrack = muon.template matchMFTTrack_as(); // MFTsa if (!mchtrack.has_mcParticle() || !mfttrack.has_mcParticle()) { return; } @@ -571,12 +591,12 @@ struct CreateResolutionMap { return; } - o2::dataformats::GlobalFwdTrack propmuonAtPV_Matched = propagateMuon(mchtrack, collision, propagationPoint::kToVertex); + o2::dataformats::GlobalFwdTrack propmuonAtPV_Matched = propagateMuon(mchtrack, mchtrack, collision, propagationPoint::kToVertex, muoncuts.matchingZ, mBzMFT); ptMatchedMCHMID = propmuonAtPV_Matched.getPt(); etaMatchedMCHMID = propmuonAtPV_Matched.getEta(); phiMatchedMCHMID = propmuonAtPV_Matched.getPhi(); o2::math_utils::bringTo02Pi(phiMatchedMCHMID); - o2::dataformats::GlobalFwdTrack propmuonAtDCA_Matched = propagateMuon(mchtrack, collision, propagationPoint::kToDCA); + o2::dataformats::GlobalFwdTrack propmuonAtDCA_Matched = propagateMuon(mchtrack, mchtrack, collision, propagationPoint::kToDCA, muoncuts.matchingZ, mBzMFT); float dcaX_Matched = propmuonAtDCA_Matched.getX() - collision.posX(); float dcaY_Matched = propmuonAtDCA_Matched.getY() - collision.posY(); float dcaXY_Matched = std::sqrt(dcaX_Matched * dcaX_Matched + dcaY_Matched * dcaY_Matched); @@ -589,6 +609,7 @@ struct CreateResolutionMap { if (muon.chi2MatchMCHMFT() > muoncuts.cfg_max_matching_chi2_mftmch) { return; } + if (muoncuts.refitGlobalMuon) { eta = mfttrack.eta(); // phi = mfttrack.phi(); @@ -596,13 +617,49 @@ struct CreateResolutionMap { pt = propmuonAtPV_Matched.getP() * std::sin(2.f * std::atan(std::exp(-eta))); phi = propmuonAtDCA.getPhi(); o2::math_utils::bringTo02Pi(phi); + + if constexpr (withMFTCov) { + auto mfttrackcov = mftCovs.rawIteratorAt(map_mfttrackcovs[mfttrack.globalIndex()]); + auto muonAtMP = propagateMuon(mchtrack, mchtrack, collision, propagationPoint::kToMatchingPlane, muoncuts.matchingZ, mBzMFT); // propagated to matching plane + o2::track::TrackParCovFwd mftsaAtMP = getTrackParCovFwd(mfttrack, mfttrackcov); // values at innermost update + mftsaAtMP.propagateToZhelix(muoncuts.matchingZ, mBzMFT); // propagated to matching plane + etaMatchedMFTatMP = mftsaAtMP.getEta(); + phiMatchedMFTatMP = mftsaAtMP.getPhi(); + etaMatchedMCHMIDatMP = muonAtMP.getEta(); + phiMatchedMCHMIDatMP = muonAtMP.getPhi(); + o2::math_utils::bringTo02Pi(phiMatchedMCHMIDatMP); + o2::math_utils::bringTo02Pi(phiMatchedMFTatMP); + + // o2::track::TrackParCovFwd mftsa = getTrackParCovFwd(mfttrack, mfttrackcov); // values at innermost update + // o2::dataformats::GlobalFwdTrack globalMuonRefit = o2::aod::fwdtrackutils::refitGlobalMuonCov(propmuonAtPV_Matched, mftsa); // this is track at IU. + // auto globalMuonAtDCA = o2::aod::fwdtrackutils::propagateTrackParCovFwd(globalMuonRefit, fwdtrack.trackType(), collision, propagationPoint::kToDCA, matchingZ, mBz); + // pt = globalMuonAtDCA.getPt(); + // eta = globalMuonAtDCA.getEta(); + // phi = globalMuonAtDCA.getPhi(); + // o2::math_utils::bringTo02Pi(phi); + // cXXatDCA = globalMuonAtDCA.getSigma2X(); + // cYYatDCA = globalMuonAtDCA.getSigma2Y(); + // cXYatDCA = globalMuonAtDCA.getSigmaXY(); + // dcaX = globalMuonAtDCA.getX() - collision.posX(); + // dcaY = globalMuonAtDCA.getY() - collision.posY(); + } } float dpt = (ptMatchedMCHMID - pt) / pt; + if (std::fabs(dpt) > muoncuts.cfg_max_reldpt) { + return; + } float deta = etaMatchedMCHMID - eta; float dphi = phiMatchedMCHMID - phi; o2::math_utils::bringToPMPi(dphi); - if (std::sqrt(std::pow(deta / muoncuts.cfg_max_deta, 2) + std::pow(dphi / muoncuts.cfg_max_dphi, 2)) > 1.f || std::fabs(dpt) > muoncuts.cfg_max_reldpt) { + if (std::sqrt(std::pow(deta / muoncuts.cfg_max_deta, 2) + std::pow(dphi / muoncuts.cfg_max_dphi, 2)) > 1.f) { + return; + } + + float detaMP = etaMatchedMCHMIDatMP - etaMatchedMFTatMP; + float dphiMP = phiMatchedMCHMIDatMP - phiMatchedMFTatMP; + o2::math_utils::bringToPMPi(dphiMP); + if (std::sqrt(std::pow(detaMP / muoncuts.cfg_max_detaMP, 2) + std::pow(dphiMP / muoncuts.cfg_max_dphiMP, 2)) > 1.f) { return; } @@ -616,7 +673,7 @@ struct CreateResolutionMap { } } else if (muon.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) { - o2::dataformats::GlobalFwdTrack propmuonAtRabs = propagateMuon(muon, collision, propagationPoint::kToRabs); // this is necessary only for MuonStandaloneTrack + o2::dataformats::GlobalFwdTrack propmuonAtRabs = propagateMuon(muon, muon, collision, propagationPoint::kToRabs, muoncuts.matchingZ, mBzMFT); // this is necessary only for MuonStandaloneTrack float xAbs = propmuonAtRabs.getX(); float yAbs = propmuonAtRabs.getY(); rAtAbsorberEnd = std::sqrt(xAbs * xAbs + yAbs * yAbs); // Redo propagation only for muon tracks // propagation of MFT tracks alredy done in reconstruction @@ -729,6 +786,7 @@ struct CreateResolutionMap { SliceCache cache; Preslice perCollision_mid = o2::aod::track::collisionId; Preslice perCollision_fwd = o2::aod::fwdtrack::collisionId; + PresliceUnsorted fwdtracksPerMCHTrack = aod::fwdtrack::matchMCHTrackId; using MyCollisions = Join; using MyCollision = MyCollisions::iterator; @@ -802,6 +860,34 @@ struct CreateResolutionMap { } } + std::vector> vec_min_chi2MatchMCHMFT; // std::pair -> chi2MatchMCHMFT; + template + void findBestMatchPerMCHMID(TMuons const& muons) + { + vec_min_chi2MatchMCHMFT.reserve(muons.size()); + for (const auto& muon : muons) { + if (muon.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) { + const auto& muons_per_MCHMID = muons.sliceBy(fwdtracksPerMCHTrack, muon.globalIndex()); + // LOGF(info, "stanadalone: muon.globalIndex() = %d, muon.chi2MatchMCHMFT() = %f", muon.globalIndex(), muon.chi2MatchMCHMFT()); + // LOGF(info, "muons_per_MCHMID.size() = %d", muons_per_MCHMID.size()); + + float min_chi2MatchMCHMFT = 1e+10; + std::tuple tupleIds_at_min; + for (const auto& muon_tmp : muons_per_MCHMID) { + if (muon_tmp.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) { + // LOGF(info, "muon_tmp.globalIndex() = %d, muon_tmp.matchMCHTrackId() = %d, muon_tmp.matchMFTTrackId() = %d, muon_tmp.chi2MatchMCHMFT() = %f", muon_tmp.globalIndex(), muon_tmp.matchMCHTrackId(), muon_tmp.matchMFTTrackId(), muon_tmp.chi2MatchMCHMFT()); + if (0.f < muon_tmp.chi2MatchMCHMFT() && muon_tmp.chi2MatchMCHMFT() < min_chi2MatchMCHMFT) { + min_chi2MatchMCHMFT = muon_tmp.chi2MatchMCHMFT(); + tupleIds_at_min = std::make_tuple(muon_tmp.globalIndex(), muon_tmp.matchMCHTrackId(), muon_tmp.matchMFTTrackId()); + } + } + } + vec_min_chi2MatchMCHMFT.emplace_back(tupleIds_at_min); + // LOGF(info, "min: muon_tmp.globalIndex() = %d, muon_tmp.matchMCHTrackId() = %d, muon_tmp.matchMFTTrackId() = %d, muon_tmp.chi2MatchMCHMFT() = %f", std::get<0>(tupleIds_at_min), std::get<1>(tupleIds_at_min), std::get<2>(tupleIds_at_min), min_chi2MatchMCHMFT); + } + } // end of muon loop + } + void processElectronSA(MyCollisions const& collisions, aod::BCsWithTimestamps const&, MyTracks const& tracks, aod::McCollisions const&, aod::McParticles const&) { for (const auto& collision : collisions) { @@ -879,6 +965,7 @@ struct CreateResolutionMap { void processMuonSA(MyCollisions const& collisions, aod::BCsWithTimestamps const&, MyFwdTracks const& fwdtracks, MyMFTTracks const&, aod::McCollisions const&, aod::McParticles const&) { + findBestMatchPerMCHMID(fwdtracks); for (const auto& collision : collisions) { auto bc = collision.template foundBC_as(); initCCDB(bc); @@ -906,16 +993,19 @@ struct CreateResolutionMap { if (cfgEventGeneratorType >= 0 && mccollision_from_mctrack.getSubGeneratorId() != cfgEventGeneratorType) { continue; } - fillMuon(collision, muon, centrality); + fillMuon(collision, muon, nullptr, centrality); } // end of standalone muon loop } // end of collision loop + vec_min_chi2MatchMCHMFT.clear(); + vec_min_chi2MatchMCHMFT.shrink_to_fit(); } PROCESS_SWITCH(CreateResolutionMap, processMuonSA, "create resolution map for muon at forward rapidity", true); Preslice fwdtrackIndicesPerCollision = aod::track_association::collisionId; - void processMuonTTCA(MyCollisions const& collisions, aod::BCsWithTimestamps const&, MyFwdTracks const&, MyMFTTracks const&, aod::FwdTrackAssoc const& fwdtrackIndices, aod::McCollisions const&, aod::McParticles const&) + void processMuonTTCA(MyCollisions const& collisions, aod::BCsWithTimestamps const&, MyFwdTracks const& fwdtracks, MyMFTTracks const&, aod::FwdTrackAssoc const& fwdtrackIndices, aod::McCollisions const&, aod::McParticles const&) { + findBestMatchPerMCHMID(fwdtracks); for (const auto& collision : collisions) { auto bc = collision.template foundBC_as(); initCCDB(bc); @@ -943,12 +1033,58 @@ struct CreateResolutionMap { if (cfgEventGeneratorType >= 0 && mccollision_from_mctrack.getSubGeneratorId() != cfgEventGeneratorType) { continue; } - fillMuon(collision, muon, centrality); + fillMuon(collision, muon, nullptr, centrality); } // end of fwdtrack loop } // end of collision loop + vec_min_chi2MatchMCHMFT.clear(); + vec_min_chi2MatchMCHMFT.shrink_to_fit(); } PROCESS_SWITCH(CreateResolutionMap, processMuonTTCA, "create resolution map for muon at forward rapidity", false); + std::unordered_map map_mfttrackcovs; + void processMuonTTCA_withMFTCov(MyCollisions const& collisions, aod::BCsWithTimestamps const&, MyFwdTracks const& fwdtracks, MyMFTTracks const&, aod::MFTTracksCov const& mftCovs, aod::FwdTrackAssoc const& fwdtrackIndices, aod::McCollisions const&, aod::McParticles const&) + { + for (const auto& mfttrackConv : mftCovs) { + map_mfttrackcovs[mfttrackConv.matchMFTTrackId()] = mfttrackConv.globalIndex(); + } + findBestMatchPerMCHMID(fwdtracks); + + for (const auto& collision : collisions) { + auto bc = collision.template foundBC_as(); + initCCDB(bc); + + if (!isSelectedEvent(collision)) { + continue; + } + + if (!collision.has_mcCollision()) { + continue; + } + + float centrality = std::array{collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}[cfgCentEstimator]; + // auto mccollision = collision.template mcCollision_as(); + // registry.fill(HIST("Event/Muon/hImpPar_Centrality"), mccollision.impactParameter(), centrality); + + auto fwdtrackIdsThisCollision = fwdtrackIndices.sliceBy(fwdtrackIndicesPerCollision, collision.globalIndex()); + for (const auto& fwdtrackId : fwdtrackIdsThisCollision) { + auto muon = fwdtrackId.template fwdtrack_as(); + if (!muon.has_mcParticle()) { + continue; + } + auto mctrack = muon.template mcParticle_as(); + auto mccollision_from_mctrack = mctrack.template mcCollision_as(); + if (cfgEventGeneratorType >= 0 && mccollision_from_mctrack.getSubGeneratorId() != cfgEventGeneratorType) { + continue; + } + fillMuon(collision, muon, mftCovs, centrality); + } // end of fwdtrack loop + } // end of collision loop + map_mfttrackcovs.clear(); + vec_min_chi2MatchMCHMFT.clear(); + vec_min_chi2MatchMCHMFT.shrink_to_fit(); + } + PROCESS_SWITCH(CreateResolutionMap, processMuonTTCA_withMFTCov, "create resolution map for muon at forward rapidity", false); + void processGen(aod::McCollisions const& mcCollisions) { for (const auto& mccollision : mcCollisions) { diff --git a/PWGEM/Dilepton/Tasks/matchingMFT.cxx b/PWGEM/Dilepton/Tasks/matchingMFT.cxx index e9f6dadc28f..9c2307f417c 100644 --- a/PWGEM/Dilepton/Tasks/matchingMFT.cxx +++ b/PWGEM/Dilepton/Tasks/matchingMFT.cxx @@ -16,6 +16,7 @@ #include "TableHelper.h" #include "Common/CCDB/RCTSelectionFlags.h" +#include "Common/Core/RecoDecay.h" #include "Common/Core/fwdtrackUtilities.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/CollisionAssociationTables.h" @@ -36,6 +37,7 @@ #include "TGeoGlobalMagField.h" +#include #include #include #include @@ -79,8 +81,12 @@ struct matchingMFT { Configurable maxRelDPt{"maxRelDPt", 1e+10f, "max. relative dpt between MFT-MCH-MID and MCH-MID"}; Configurable maxDEta{"maxDEta", 1e+10f, "max. deta between MFT-MCH-MID and MCH-MID"}; Configurable maxDPhi{"maxDPhi", 1e+10f, "max. dphi between MFT-MCH-MID and MCH-MID"}; + Configurable maxDEtaMP{"maxDEtaMP", 1e+10f, "max. deta between MFT and MCH-MID at matching plane Z"}; + Configurable maxDPhiMP{"maxDPhiMP", 1e+10f, "max. dphi between MFT and MCH-MID at matching plane Z"}; Configurable requireMFTHitMap{"requireMFTHitMap", false, "flag to require MFT hit map"}; Configurable> requiredMFTDisks{"requiredMFTDisks", std::vector{0}, "hit map on MFT disks [0,1,2,3,4]. logical-OR of each double-sided disk"}; + Configurable matchingZ{"matchingZ", -77.5, "z position where matching is performed"}; + Configurable cfgBestMatchFinder{"cfgBestMatchFinder", 0, "matching chi2:0, dr:1"}; Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; Configurable cfgCentMin{"cfgCentMin", -1.f, "min. centrality"}; @@ -118,6 +124,7 @@ struct matchingMFT { o2::ccdb::CcdbApi ccdbApi; Service ccdb; int mRunNumber = -1; + float mBz = 0; template void initCCDB(TBC const& bc) @@ -136,6 +143,10 @@ struct matchingMFT { ccdb->get(geoPath); } o2::mch::TrackExtrap::setField(); + const double centerMFT[3] = {0, 0, -61.4}; + o2::field::MagneticField* field = static_cast(TGeoGlobalMagField::Instance()->GetField()); + mBz = field->getBz(centerMFT); // Get field at centre of MFT + LOGF(info, "Bz at center of MFT = %f kZG", mBz); } void addHistograms() @@ -161,12 +172,13 @@ struct matchingMFT { hMuonType->GetXaxis()->SetBinLabel(4, "MCH-MID"); hMuonType->GetXaxis()->SetBinLabel(5, "MCH standalone"); - const AxisSpec axis_pt{{0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 3, 4, 5, 6, 7, 8, 9, 10}, "p_{T}^{gl} (GeV/c)"}; + const AxisSpec axis_pt{{0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.5, 3, 3.5, 4, 4.5, 5, 6, 7, 8, 9, 10}, "p_{T}^{gl} (GeV/c)"}; fRegistry.add("MFTMCHMID/primary/correct/hPt", "pT;p_{T} (GeV/c)", kTH1F, {{100, 0.0f, 10}}, false); fRegistry.add("MFTMCHMID/primary/correct/hEtaPhi", "#eta vs. #varphi;#varphi (rad.);#eta", kTH2F, {{180, 0, 2 * M_PI}, {80, -5.f, -1.f}}, false); fRegistry.add("MFTMCHMID/primary/correct/hEtaPhi_MatchedMCHMID", "#eta vs. #varphi;#varphi (rad.);#eta", kTH2F, {{180, 0, 2 * M_PI}, {80, -5.f, -1.f}}, false); - fRegistry.add("MFTMCHMID/primary/correct/hsDelta", "diff. between GL and associated SA;p_{T}^{gl} (GeV/c);(p_{T}^{sa} - p_{T}^{gl})/p_{T}^{gl};#Delta#eta;#Delta#varphi (rad.);", kTHnSparseF, {axis_pt, {100, -0.5, +0.5}, {100, -0.5, +0.5}, {90, -M_PI / 4, M_PI / 4}}, false); + fRegistry.add("MFTMCHMID/primary/correct/hsDelta", "diff. between GL and associated SA;p_{T}^{gl} (GeV/c);(p_{T}^{sa} - p_{T}^{gl})/p_{T}^{gl};#eta^{sa} - #eta^{gl};#varphi^{sa} - #varphi^{gl} (rad.);", kTHnSparseF, {axis_pt, {200, -0.5, +0.5}, {200, -1, +1}, {90, -M_PI / 4, M_PI / 4}}, false); + fRegistry.add("MFTMCHMID/primary/correct/hsDeltaAtMP", "diff. between MFT and MCH-MID;p_{T}^{gl} (GeV/c);#varphi^{MCH-MID} - #varphi^{MFT} (rad.);#eta^{MCH-MID} - #eta^{MFT};", kTHnSparseF, {axis_pt, {90, -M_PI / 4, M_PI / 4}, {200, -1, +1}}, false); fRegistry.add("MFTMCHMID/primary/correct/hDiffCollId", "difference in collision index;collisionId_{TTCA} - collisionId_{MP}", kTH1F, {{41, -20.5, +20.5}}, false); fRegistry.add("MFTMCHMID/primary/correct/hSign", "sign;sign", kTH1F, {{3, -1.5, +1.5}}, false); fRegistry.add("MFTMCHMID/primary/correct/hNclusters", "Nclusters;Nclusters", kTH1F, {{21, -0.5f, 20.5}}, false); @@ -179,7 +191,6 @@ struct matchingMFT { fRegistry.add("MFTMCHMID/primary/correct/hChi2MatchMCHMID", "chi2 match MCH-MID;chi2", kTH1F, {{100, 0.0f, 100}}, false); fRegistry.add("MFTMCHMID/primary/correct/hChi2MatchMCHMFT", "chi2 match MCH-MFT;chi2", kTH1F, {{100, 0.0f, 100}}, false); fRegistry.add("MFTMCHMID/primary/correct/hDCAxy2D", "DCA x vs. y;DCA_{x} (cm);DCA_{y} (cm)", kTH2F, {{200, -0.5, 0.5}, {200, -0.5, +0.5}}, false); - fRegistry.add("MFTMCHMID/primary/correct/hDCAz", "DCA z;DCA_{z} (cm);", kTH1F, {{1000, 0, 10}}, false); fRegistry.add("MFTMCHMID/primary/correct/hDCAxy2DinSigma", "DCA x vs. y in sigma;DCA_{x} (#sigma);DCA_{y} (#sigma)", kTH2F, {{200, -10, 10}, {200, -10, +10}}, false); fRegistry.add("MFTMCHMID/primary/correct/hDCAxy", "DCAxy;DCA_{xy} (cm);", kTH1F, {{100, 0, 1}}, false); fRegistry.add("MFTMCHMID/primary/correct/hDCAxyinSigma", "DCAxy in sigma;DCA_{xy} (#sigma);", kTH1F, {{100, 0, 10}}, false); @@ -188,7 +199,7 @@ struct matchingMFT { fRegistry.add("MFTMCHMID/primary/correct/hDCAxyResolutionvsPt", "DCA_{xy} resolution vs. p_{T};p_{T} (GeV/c);DCA_{xy} resolution (#mum);", kTH2F, {{100, 0, 10.f}, {500, 0, 500}}, false); fRegistry.add("MFTMCHMID/primary/correct/hMCHBitMap", "MCH bit map;MCH bit map", kTH1F, {{1024, -0.5, 1023.5}}, false); fRegistry.add("MFTMCHMID/primary/correct/hMIDBitMap", "MID bit map;MID bit map", kTH1F, {{256, -0.5, 255.5}}, false); - fRegistry.add("MFTMCHMID/primary/correct/hMeanMFTClusterSize", "mean MFT cluster size vs. p;p (GeV/c); #times cos(#lambda)", kTH2F, {{100, 0, 100}, {100, 0, 1}}, false); + fRegistry.add("MFTMCHMID/primary/correct/hMeanMFTClusterSize", "mean MFT cluster size vs. p;p (GeV/c); #times sin(#lambda)", kTH2F, {{100, 0, 100}, {100, 0, 10}}, false); fRegistry.add("MFTMCHMID/primary/correct/hProdVtxZ", "prod. vtx Z of muon;V_{z} (cm)", kTH1F, {{200, -100, 100}}, false); fRegistry.add("MFTMCHMID/primary/correct/hRelDeltaPt", "pT resolution;p_{T}^{gen} (GeV/c);(p_{T}^{rec} - p_{T}^{gen})/p_{T}^{gen}", kTH2F, {{100, 0, 10}, {400, -1, +1}}, false); @@ -198,6 +209,7 @@ struct matchingMFT { fRegistry.add("MFTMCHMID/primary/correct/hDeltaPhi_Neg", "#varphi resolution;p_{T}^{gen} (GeV/c);#varphi^{rec} - #varphi^{gen} (rad.)", kTH2F, {{100, 0, 10}, {400, -0.2, +0.2}}, false); fRegistry.addClone("MFTMCHMID/primary/correct/", "MFTMCHMID/primary/wrong/"); fRegistry.addClone("MFTMCHMID/primary/", "MFTMCHMID/secondary/"); + fRegistry.addClone("MFTMCHMID/", "MCHMID/"); } bool isSelected(const float pt, const float eta, const float rAtAbsorberEnd, const float pDCA, const float chi2_per_ndf, const uint8_t trackType, const float dcaXY) @@ -279,25 +291,67 @@ struct matchingMFT { } if (n > 0) { - return static_cast(clsSize) / static_cast(n) * std::cos(std::atan(track.tgl())); + return static_cast(clsSize) / static_cast(n) * std::fabs(std::sin(std::atan(track.tgl()))); } else { return 0.f; } } - template - void fillHistograms(TCollision const& collision, TFwdTrack fwdtrack, TFwdTracks const&, TMFTTracks const&) + template + void getDeltaEtaDeltaPhiAtMatchingPlane(TCollision const& collision, TFwdTrack const& fwdtrack, TMFTrackCov const& mftCovs, float& deta, float& dphi) { - const auto& mchtrack = fwdtrack.template matchMCHTrack_as(); // MCH-MID - const auto& mfttrack = fwdtrack.template matchMFTTrack_as(); + if (fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) { + deta = 999.f; + dphi = 999.f; + return; // do nothing + } + + auto mchtrack = fwdtrack.template matchMCHTrack_as(); // MCH-MID + auto mfttrack = fwdtrack.template matchMFTTrack_as(); + + if (mchtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) { + deta = 999.f; + dphi = 999.f; + return; // do nothing + } + + o2::dataformats::GlobalFwdTrack propmuonAtPV = propagateMuon(mchtrack, mchtrack, collision, propagationPoint::kToMatchingPlane, matchingZ, mBz); + auto mfttrackcov = mftCovs.rawIteratorAt(map_mfttrackcovs[mfttrack.globalIndex()]); + + auto muonAtMP = propagateMuon(mchtrack, mchtrack, collision, propagationPoint::kToMatchingPlane, matchingZ, mBz); // propagated to matching plane + o2::track::TrackParCovFwd mftsaAtMP = getTrackParCovFwd(mfttrack, mfttrackcov); // values at innermost update + mftsaAtMP.propagateToZhelix(matchingZ, mBz); // propagated to matching plane + deta = muonAtMP.getEta() - mftsaAtMP.getEta(); + dphi = muonAtMP.getPhi() - mftsaAtMP.getPhi(); + o2::math_utils::bringToPMPi(dphi); + // reldpt = (muonAtMP.getPt() - mftsaAtMP.getPt()) / muonAtMP.getPt(); + + // o2::track::TrackParCovFwd mftsa = getTrackParCovFwd(mfttrack, mfttrackcov); // values at innermost update + // o2::dataformats::GlobalFwdTrack globalMuonRefit = o2::aod::fwdtrackutils::refitGlobalMuonCov(propmuonAtPV, mftsa); // this is track at IU. + // auto globalMuonAtDCA = o2::aod::fwdtrackutils::propagateTrackParCovFwd(globalMuonRefit, fwdtrack.trackType(), collision, propagationPoint::kToMatchingPlane, matchingZ); + // deta = propmuonAtPV.getEta() - globalMuonAtDCA.getEta(); + // dphi = propmuonAtPV.getPhi() - globalMuonAtDCA.getPhi(); + // o2::math_utils::bringToPMPi(dphi); + // reldpt = (globalMuonAtDCA.getPt() - propmuonAtPV.getPt()) / propmuonAtPV.getPt(); + } + + template + void fillHistograms(TCollision const& collision, TFwdTrack fwdtrack, TFwdTracks const&, TMFTTracks const&, TMFTTracksCov const& mftCovs) + { + if (fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) { // only for protection + return; + } + + auto mchtrack = fwdtrack.template matchMCHTrack_as(); // MCH-MID + auto mfttrack = fwdtrack.template matchMFTTrack_as(); if (!fwdtrack.has_mcParticle() || !mchtrack.has_mcParticle() || !mfttrack.has_mcParticle()) { return; } - const auto& mcParticle_MFTMCHMID = fwdtrack.template mcParticle_as(); // this is identical to mcParticle_MCHMID - const auto& mcParticle_MCHMID = mchtrack.template mcParticle_as(); // this is identical to mcParticle_MFTMCHMID - const auto& mcParticle_MFT = mfttrack.template mcParticle_as(); + auto mcParticle_MFTMCHMID = fwdtrack.template mcParticle_as(); // this is identical to mcParticle_MCHMID + auto mcParticle_MCHMID = mchtrack.template mcParticle_as(); // this is identical to mcParticle_MFTMCHMID + auto mcParticle_MFT = mfttrack.template mcParticle_as(); // LOGF(info, "mcParticle_MFTMCHMID.pdgCode() = %d, mcParticle_MCHMID.pdgCode() = %d, mcParticle_MFT.pdgCode() = %d", mcParticle_MFTMCHMID.pdgCode(), mcParticle_MCHMID.pdgCode(), mcParticle_MFT.pdgCode()); // LOGF(info, "mcParticle_MFTMCHMID.globalIndex() = %d, mcParticle_MCHMID.globalIndex() = %d, mcParticle_MFT.globalIndex() = %d", mcParticle_MFTMCHMID.globalIndex(), mcParticle_MCHMID.globalIndex(), mcParticle_MFT.globalIndex()); @@ -334,8 +388,10 @@ struct matchingMFT { bool isPrimary = mcParticle_MCHMID.isPhysicalPrimary() || mcParticle_MCHMID.producedByGenerator(); bool isMatched = (mcParticle_MFT.globalIndex() == mcParticle_MCHMID.globalIndex()) && (mcParticle_MFT.mcCollisionId() == mcParticle_MCHMID.mcCollisionId()); - o2::dataformats::GlobalFwdTrack propmuonAtPV = propagateMuon(fwdtrack, collision, propagationPoint::kToVertex); - o2::dataformats::GlobalFwdTrack propmuonAtDCA = propagateMuon(fwdtrack, collision, propagationPoint::kToDCA); + o2::dataformats::GlobalFwdTrack propmuonAtPV = propagateMuon(fwdtrack, fwdtrack, collision, propagationPoint::kToVertex, matchingZ, mBz); + o2::dataformats::GlobalFwdTrack propmuonAtDCA = propagateMuon(fwdtrack, fwdtrack, collision, propagationPoint::kToDCA, matchingZ, mBz); + o2::dataformats::GlobalFwdTrack propmuonAtDCA_Matched = propagateMuon(mchtrack, mchtrack, collision, propagationPoint::kToDCA, matchingZ, mBz); + o2::dataformats::GlobalFwdTrack propmuonAtPV_Matched = propagateMuon(mchtrack, mchtrack, collision, propagationPoint::kToVertex, matchingZ, mBz); float p = propmuonAtPV.getP(); float pt = propmuonAtPV.getPt(); @@ -351,7 +407,6 @@ struct matchingMFT { float dcaY = propmuonAtDCA.getY() - collision.posY(); float rAtAbsorberEnd = fwdtrack.rAtAbsorberEnd(); // this works only for GlobalMuonTrack float dcaXY = std::sqrt(dcaX * dcaX + dcaY * dcaY); - float dcaZ = -dcaXY * std::sinh(eta); float det = cXXatDCA * cYYatDCA - cXYatDCA * cXYatDCA; // determinanat float dcaXYinSigma = 999.f; @@ -362,19 +417,72 @@ struct matchingMFT { } float sigma_dcaXY = dcaXY / dcaXYinSigma; - o2::dataformats::GlobalFwdTrack propmuonAtDCA_Matched = propagateMuon(mchtrack, collision, propagationPoint::kToDCA); float dcaX_Matched = propmuonAtDCA_Matched.getX() - collision.posX(); float dcaY_Matched = propmuonAtDCA_Matched.getY() - collision.posY(); float dcaXY_Matched = std::sqrt(dcaX_Matched * dcaX_Matched + dcaY_Matched * dcaY_Matched); float pDCA = mchtrack.p() * dcaXY_Matched; + float dphiMP = 999.f, detaMP = 999.f; - o2::dataformats::GlobalFwdTrack propmuonAtPV_Matched = propagateMuon(mchtrack, collision, propagationPoint::kToVertex); if (refitGlobalMuon) { eta = mfttrack.eta(); - phi = mfttrack.phi(); - o2::math_utils::bringTo02Pi(phi); + // phi = mfttrack.phi(); + // o2::math_utils::bringTo02Pi(phi); pt = propmuonAtPV_Matched.getP() * std::sin(2.f * std::atan(std::exp(-eta))); p = propmuonAtPV_Matched.getP(); + phi = propmuonAtDCA.getPhi(); + o2::math_utils::bringTo02Pi(phi); + + if constexpr (withMFTCov) { + // auto mfttrackcov = mftCovs.rawIteratorAt(map_mfttrackcovs[mfttrack.globalIndex()]); + // o2::track::TrackParCovFwd mftsa = getTrackParCovFwd(mfttrack, mfttrackcov); // values at innermost update + // o2::dataformats::GlobalFwdTrack globalMuonRefit = o2::aod::fwdtrackutils::refitGlobalMuonCov(propmuonAtPV_Matched, mftsa); // this is track at IU. + // auto globalMuonAtDCA = o2::aod::fwdtrackutils::propagateTrackParCovFwd(globalMuonRefit, fwdtrack.trackType(), collision, propagationPoint::kToDCA, matchingZ, mBz); + + // eta = globalMuonAtDCA.getEta(); + // phi = globalMuonAtDCA.getPhi(); + // o2::math_utils::bringTo02Pi(phi); + // pt = globalMuonAtDCA.getPt(); + // p = globalMuonAtDCA.getP(); + + // eta = globalMuonRefit.getEta(); + // phi = globalMuonRefit.getPhi(); + // o2::math_utils::bringTo02Pi(phi); + // pt = globalMuonRefit.getPt(); + // p = globalMuonRefit.getP(); + + // cXXatDCA = globalMuonAtDCA.getSigma2X(); + // cYYatDCA = globalMuonAtDCA.getSigma2Y(); + // cXYatDCA = globalMuonAtDCA.getSigmaXY(); + // dcaX = globalMuonAtDCA.getX() - collision.posX(); + // dcaY = globalMuonAtDCA.getY() - collision.posY(); + // dcaXY = std::sqrt(dcaX * dcaX + dcaY * dcaY); + // det = cXXatDCA * cYYatDCA - cXYatDCA * cXYatDCA; // determinanat + // if (det < 0) { + // dcaXYinSigma = 999.f; + // } else { + // dcaXYinSigma = std::sqrt(std::fabs((dcaX * dcaX * cYYatDCA + dcaY * dcaY * cXXatDCA - 2. * dcaX * dcaY * cXYatDCA) / det / 2.)); // dca xy in sigma + // } + // sigma_dcaXY = dcaXY / dcaXYinSigma; + + // o2::track::TrackParCovFwd mftsaAtDCA = getTrackParCovFwd(mfttrack, mfttrackcov); // values at innermost update + // mftsaAtDCA.propagateToZhelix(collision.posZ(), mBz); // propagated to matching plane + // cXXatDCA = mftsaAtDCA.getSigma2X(); + // cYYatDCA = mftsaAtDCA.getSigma2Y(); + // cXYatDCA = mftsaAtDCA.getSigmaXY(); + // dcaX = mftsaAtDCA.getX() - collision.posX(); + // dcaY = mftsaAtDCA.getY() - collision.posY(); + // dcaXY = std::sqrt(dcaX * dcaX + dcaY * dcaY); + // det = cXXatDCA * cYYatDCA - cXYatDCA * cXYatDCA; // determinanat + // if (det < 0) { + // dcaXYinSigma = 999.f; + // } else { + // dcaXYinSigma = std::sqrt(std::fabs((dcaX * dcaX * cYYatDCA + dcaY * dcaY * cXXatDCA - 2. * dcaX * dcaY * cXYatDCA) / det / 2.)); // dca xy in sigma + // } + // sigma_dcaXY = dcaXY / dcaXYinSigma; + + getDeltaEtaDeltaPhiAtMatchingPlane(collision, fwdtrack, mftCovs, detaMP, dphiMP); + o2::math_utils::bringToPMPi(dphiMP); + } } float ptMatchedMCHMID = propmuonAtPV_Matched.getPt(); @@ -385,7 +493,13 @@ struct matchingMFT { float deta = etaMatchedMCHMID - eta; float dphi = phiMatchedMCHMID - phi; o2::math_utils::bringToPMPi(dphi); - if (std::sqrt(std::pow(deta / maxDEta, 2) + std::pow(dphi / maxDPhi, 2)) > 1.f || std::fabs(dpt) > maxRelDPt) { + if (std::sqrt(std::pow(deta / maxDEta, 2) + std::pow(dphi / maxDPhi, 2)) > 1.f) { + return; + } + if (std::sqrt(std::pow(detaMP / maxDEtaMP, 2) + std::pow(dphiMP / maxDPhiMP, 2)) > 1.f) { + return; + } + if (std::fabs(dpt) > maxRelDPt) { return; } @@ -409,6 +523,7 @@ struct matchingMFT { fRegistry.fill(HIST("MFTMCHMID/primary/correct/hEtaPhi"), phi, eta); fRegistry.fill(HIST("MFTMCHMID/primary/correct/hEtaPhi_MatchedMCHMID"), phiMatchedMCHMID, etaMatchedMCHMID); fRegistry.fill(HIST("MFTMCHMID/primary/correct/hsDelta"), pt, dpt, deta, dphi); + fRegistry.fill(HIST("MFTMCHMID/primary/correct/hsDeltaAtMP"), pt, dphiMP, detaMP); fRegistry.fill(HIST("MFTMCHMID/primary/correct/hDiffCollId"), collision.globalIndex() - fwdtrack.collisionId()); fRegistry.fill(HIST("MFTMCHMID/primary/correct/hSign"), fwdtrack.sign()); fRegistry.fill(HIST("MFTMCHMID/primary/correct/hNclusters"), fwdtrack.nClusters()); @@ -421,7 +536,6 @@ struct matchingMFT { fRegistry.fill(HIST("MFTMCHMID/primary/correct/hChi2MatchMCHMID"), fwdtrack.chi2MatchMCHMID()); fRegistry.fill(HIST("MFTMCHMID/primary/correct/hChi2MatchMCHMFT"), fwdtrack.chi2MatchMCHMFT()); fRegistry.fill(HIST("MFTMCHMID/primary/correct/hDCAxy2D"), dcaX, dcaY); - fRegistry.fill(HIST("MFTMCHMID/primary/correct/hDCAz"), dcaZ); fRegistry.fill(HIST("MFTMCHMID/primary/correct/hDCAxy2DinSigma"), dcaX / std::sqrt(cXXatDCA), dcaY / std::sqrt(cYYatDCA)); fRegistry.fill(HIST("MFTMCHMID/primary/correct/hDCAxy"), dcaXY); fRegistry.fill(HIST("MFTMCHMID/primary/correct/hDCAxyinSigma"), dcaXYinSigma); @@ -446,6 +560,7 @@ struct matchingMFT { fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hEtaPhi"), phi, eta); fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hEtaPhi_MatchedMCHMID"), phiMatchedMCHMID, etaMatchedMCHMID); fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hsDelta"), pt, dpt, deta, dphi); + fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hsDeltaAtMP"), pt, dphiMP, detaMP); fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hDiffCollId"), collision.globalIndex() - fwdtrack.collisionId()); fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hSign"), fwdtrack.sign()); fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hNclusters"), fwdtrack.nClusters()); @@ -458,7 +573,6 @@ struct matchingMFT { fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hChi2MatchMCHMID"), fwdtrack.chi2MatchMCHMID()); fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hChi2MatchMCHMFT"), fwdtrack.chi2MatchMCHMFT()); fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hDCAxy2D"), dcaX, dcaY); - fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hDCAz"), dcaZ); fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hDCAxy2DinSigma"), dcaX / std::sqrt(cXXatDCA), dcaY / std::sqrt(cYYatDCA)); fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hDCAxy"), dcaXY); fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hDCAxyinSigma"), dcaXYinSigma); @@ -469,6 +583,7 @@ struct matchingMFT { fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hDCAyResolutionvsPt"), pt, std::sqrt(cYYatDCA) * 1e+4); // convert cm to um fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hDCAxyResolutionvsPt"), pt, sigma_dcaXY * 1e+4); // convert cm to um fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hProdVtxZ"), mcParticle_MFTMCHMID.vz()); + fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hRelDeltaPt"), mcParticle_MFTMCHMID.pt(), (pt - mcParticle_MFTMCHMID.pt()) / mcParticle_MFTMCHMID.pt()); if (mcParticle_MFTMCHMID.pdgCode() > 0) { fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hDeltaEta_Neg"), mcParticle_MFTMCHMID.pt(), eta - mcParticle_MFTMCHMID.eta()); @@ -484,6 +599,7 @@ struct matchingMFT { fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hEtaPhi"), phi, eta); fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hEtaPhi_MatchedMCHMID"), phiMatchedMCHMID, etaMatchedMCHMID); fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hsDelta"), pt, dpt, deta, dphi); + fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hsDeltaAtMP"), pt, dphiMP, detaMP); fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hDiffCollId"), collision.globalIndex() - fwdtrack.collisionId()); fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hSign"), fwdtrack.sign()); fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hNclusters"), fwdtrack.nClusters()); @@ -496,7 +612,6 @@ struct matchingMFT { fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hChi2MatchMCHMID"), fwdtrack.chi2MatchMCHMID()); fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hChi2MatchMCHMFT"), fwdtrack.chi2MatchMCHMFT()); fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hDCAxy2D"), dcaX, dcaY); - fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hDCAz"), dcaZ); fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hDCAxy2DinSigma"), dcaX / std::sqrt(cXXatDCA), dcaY / std::sqrt(cYYatDCA)); fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hDCAxy"), dcaXY); fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hDCAxyinSigma"), dcaXYinSigma); @@ -507,6 +622,7 @@ struct matchingMFT { fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hDCAyResolutionvsPt"), pt, std::sqrt(cYYatDCA) * 1e+4); // convert cm to um fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hDCAxyResolutionvsPt"), pt, sigma_dcaXY * 1e+4); // convert cm to um fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hProdVtxZ"), mcParticle_MFTMCHMID.vz()); + fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hRelDeltaPt"), mcParticle_MFTMCHMID.pt(), (pt - mcParticle_MFTMCHMID.pt()) / mcParticle_MFTMCHMID.pt()); if (mcParticle_MFTMCHMID.pdgCode() > 0) { fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hDeltaEta_Neg"), mcParticle_MFTMCHMID.pt(), eta - mcParticle_MFTMCHMID.eta()); @@ -520,6 +636,7 @@ struct matchingMFT { fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hEtaPhi"), phi, eta); fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hEtaPhi_MatchedMCHMID"), phiMatchedMCHMID, etaMatchedMCHMID); fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hsDelta"), pt, dpt, deta, dphi); + fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hsDeltaAtMP"), pt, dphiMP, detaMP); fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hDiffCollId"), collision.globalIndex() - fwdtrack.collisionId()); fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hSign"), fwdtrack.sign()); fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hNclusters"), fwdtrack.nClusters()); @@ -532,7 +649,6 @@ struct matchingMFT { fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hChi2MatchMCHMID"), fwdtrack.chi2MatchMCHMID()); fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hChi2MatchMCHMFT"), fwdtrack.chi2MatchMCHMFT()); fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hDCAxy2D"), dcaX, dcaY); - fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hDCAz"), dcaZ); fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hDCAxy2DinSigma"), dcaX / std::sqrt(cXXatDCA), dcaY / std::sqrt(cYYatDCA)); fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hDCAxy"), dcaXY); fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hDCAxyinSigma"), dcaXYinSigma); @@ -543,6 +659,7 @@ struct matchingMFT { fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hDCAyResolutionvsPt"), pt, std::sqrt(cYYatDCA) * 1e+4); // convert cm to um fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hDCAxyResolutionvsPt"), pt, sigma_dcaXY * 1e+4); // convert cm to um fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hProdVtxZ"), mcParticle_MFTMCHMID.vz()); + fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hRelDeltaPt"), mcParticle_MFTMCHMID.pt(), (pt - mcParticle_MFTMCHMID.pt()) / mcParticle_MFTMCHMID.pt()); if (mcParticle_MFTMCHMID.pdgCode() > 0) { fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hDeltaEta_Neg"), mcParticle_MFTMCHMID.pt(), eta - mcParticle_MFTMCHMID.eta()); @@ -570,32 +687,81 @@ struct matchingMFT { } std::vector> vec_min_chi2MatchMCHMFT; // std::pair -> chi2MatchMCHMFT; - template - void findBestMatchPerMCHMID(TMuons const& muons) + std::vector> vec_min_dr; // std::pair -> deta + dphi; + std::map, bool> mapCorrectMatch; + + template + void findBestMatchPerMCHMID(TCollision const& collision, TFwdTrack const& fwdtrack, TFwdTracks const& fwdtracks, TMFTTracks const&, TMFTTracksCov const& mftCovs) { - vec_min_chi2MatchMCHMFT.reserve(muons.size()); - for (const auto& muon : muons) { - if (muon.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) { - const auto& muons_per_MCHMID = muons.sliceBy(fwdtracksPerMCHTrack, muon.globalIndex()); - // LOGF(info, "stanadalone: muon.globalIndex() = %d, muon.chi2MatchMCHMFT() = %f", muon.globalIndex(), muon.chi2MatchMCHMFT()); - // LOGF(info, "muons_per_MCHMID.size() = %d", muons_per_MCHMID.size()); - - float min_chi2MatchMCHMFT = 1e+10; - std::tuple tupleIds_at_min; - for (const auto& muon_tmp : muons_per_MCHMID) { - if (muon_tmp.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) { - // LOGF(info, "muon_tmp.globalIndex() = %d, muon_tmp.matchMCHTrackId() = %d, muon_tmp.matchMFTTrackId() = %d, muon_tmp.chi2MatchMCHMFT() = %f", muon_tmp.globalIndex(), muon_tmp.matchMCHTrackId(), muon_tmp.matchMFTTrackId(), muon_tmp.chi2MatchMCHMFT()); - if (0.f < muon_tmp.chi2MatchMCHMFT() && muon_tmp.chi2MatchMCHMFT() < min_chi2MatchMCHMFT) { - min_chi2MatchMCHMFT = muon_tmp.chi2MatchMCHMFT(); - tupleIds_at_min = std::make_tuple(muon_tmp.globalIndex(), muon_tmp.matchMCHTrackId(), muon_tmp.matchMFTTrackId()); - } - } + if (fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) { + return; + } + if (!fwdtrack.has_mcParticle()) { + return; + } + + std::tuple tupleIds_at_min_chi2mftmch; + std::tuple tupleIds_at_min_dr; + float min_chi2MatchMCHMFT = 1e+10; + float min_dr = 1e+10; + auto muons_per_MCHMID = fwdtracks.sliceBy(fwdtracksPerMCHTrack, fwdtrack.globalIndex()); + // LOGF(info, "muons_per_MCHMID.size() = %d", muons_per_MCHMID.size()); + + for (const auto& muon_tmp : muons_per_MCHMID) { + if (muon_tmp.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) { + + auto tupleId = std::make_tuple(muon_tmp.globalIndex(), muon_tmp.matchMCHTrackId(), muon_tmp.matchMFTTrackId()); + auto mchtrack = muon_tmp.template matchMCHTrack_as(); // MCH-MID + auto mfttrack = muon_tmp.template matchMFTTrack_as(); + + if (!muon_tmp.has_mcParticle() || !mchtrack.has_mcParticle() || !mfttrack.has_mcParticle()) { + continue; } - vec_min_chi2MatchMCHMFT.emplace_back(tupleIds_at_min); - // mCandidates[tupleIds_at_min] = min_chi2MatchMCHMFT; - // LOGF(info, "min: muon_tmp.globalIndex() = %d, muon_tmp.matchMCHTrackId() = %d, muon_tmp.matchMFTTrackId() = %d, muon_tmp.chi2MatchMCHMFT() = %f", std::get<0>(tupleIds_at_min), std::get<1>(tupleIds_at_min), std::get<2>(tupleIds_at_min), min_chi2MatchMCHMFT); - } - } // end of muon loop + + float deta = 999.f, dphi = 999.f; + getDeltaEtaDeltaPhiAtMatchingPlane(collision, muon_tmp, mftCovs, deta, dphi); + float dr = std::sqrt(deta * deta + dphi * dphi); + + // auto mcParticle_MFTMCHMID = muon_tmp.template mcParticle_as(); // this is identical to mcParticle_MCHMID + auto mcParticle_MCHMID = mchtrack.template mcParticle_as(); // this is identical to mcParticle_MFTMCHMID + auto mcParticle_MFT = mfttrack.template mcParticle_as(); + // float chi2ndf = muon_tmp.chi2() / (2.f * (mchtrack.nClusters() + mfttrack.nClusters()) - 5.f); + + if (mcParticle_MFT.globalIndex() == mcParticle_MCHMID.globalIndex()) { + mapCorrectMatch[tupleId] = true; + } else { + mapCorrectMatch[tupleId] = false; + } + + // if (std::abs(mcParticle_MCHMID.pdgCode()) == 13 && mcParticle_MCHMID.isPhysicalPrimary()) { + // if (mcParticle_MFT.globalIndex() == mcParticle_MCHMID.globalIndex()) { + // LOGF(info, "This is correct match between MFT and MCH-MID: muon_tmp.globalIndex() = %d, chi2/ndf = %f, matching chi2/ndf = %f, mcParticle.pt() = %f, mcParticle.eta() = %f, mcParticle.phi() = %f, reldpt = %f, deta = %f, dphi = %f, dr = %f", muon_tmp.globalIndex(), chi2ndf, muon_tmp.chi2MatchMCHMFT(), mcParticle_MCHMID.pt(), mcParticle_MCHMID.eta(), mcParticle_MCHMID.phi(), reldpt, deta, dphi, dr); + // } else { + // LOGF(info, "This is wrong match between MFT and MCH-MID: muon_tmp.globalIndex() = %d, chi2/ndf = %f, matching chi2/ndf = %f , mcParticle.pt() = %f, mcParticle.eta() = %f, mcParticle.phi() = %f, reldpt = %f, deta = %f, dphi = %f, dr = %f" , muon_tmp.globalIndex(), chi2ndf, muon_tmp.chi2MatchMCHMFT(), mcParticle_MCHMID.pt(), mcParticle_MCHMID.eta(), mcParticle_MCHMID.phi(), reldpt, deta, dphi, dr); + // } + // } + + if (0.f < muon_tmp.chi2MatchMCHMFT() && muon_tmp.chi2MatchMCHMFT() < min_chi2MatchMCHMFT) { + min_chi2MatchMCHMFT = muon_tmp.chi2MatchMCHMFT(); + tupleIds_at_min_chi2mftmch = tupleId; + } + + if (dr < min_dr) { + min_dr = dr; + tupleIds_at_min_dr = tupleId; + } + + } // end of if global muon + } // end of candidates loop + + vec_min_chi2MatchMCHMFT.emplace_back(tupleIds_at_min_chi2mftmch); + vec_min_dr.emplace_back(tupleIds_at_min_dr); + + // auto mcParticleTMP = fwdtrack.template mcParticle_as(); // this is identical to mcParticle_MFTMCHMID + // if (std::abs(mcParticleTMP.pdgCode()) == 13 && mcParticleTMP.isPhysicalPrimary()) { + // LOGF(info, "min chi2: muon_tmp.globalIndex() = %d, muon_tmp.matchMCHTrackId() = %d, muon_tmp.matchMFTTrackId() = %d, muon_tmp.chi2MatchMCHMFT() = %f, correct match = %d", std::get<0>(tupleIds_at_min_chi2mftmch), std::get<1>(tupleIds_at_min_chi2mftmch), std::get<2>(tupleIds_at_min_chi2mftmch), min_chi2MatchMCHMFT, mapCorrectMatch[tupleIds_at_min_chi2mftmch]); + // LOGF(info, "min dr: muon_tmp.globalIndex() = %d, muon_tmp.matchMCHTrackId() = %d, muon_tmp.matchMFTTrackId() = %d, dr = %f, correct match = %d", std::get<0>(tupleIds_at_min_dr), std::get<1>(tupleIds_at_min_dr), std::get<2>(tupleIds_at_min_dr), min_dr, mapCorrectMatch[tupleIds_at_min_dr]); + // } } SliceCache cache; @@ -611,10 +777,8 @@ struct matchingMFT { void processWithoutFTTCA(FilteredMyCollisions const& collisions, MyFwdTracks const& fwdtracks, MyMFTTracks const& mfttracks, aod::BCsWithTimestamps const&, aod::McParticles const&) { - findBestMatchPerMCHMID(fwdtracks); - for (const auto& collision : collisions) { - const auto& bc = collision.template bc_as(); + auto bc = collision.template bc_as(); initCCDB(bc); fRegistry.fill(HIST("Event/hCollisionCounter"), 0); if (!collision.has_mcCollision()) { @@ -623,36 +787,34 @@ struct matchingMFT { if (cfgRequireGoodRCT && !rctChecker.checkTable(collision)) { continue; } - const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; + float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; } fRegistry.fill(HIST("Event/hCollisionCounter"), 1); fillEventHistograms(collision); - const auto& fwdtracks_per_coll = fwdtracks.sliceBy(perCollision, collision.globalIndex()); + auto fwdtracks_per_coll = fwdtracks.sliceBy(perCollision, collision.globalIndex()); + for (const auto& fwdtrack : fwdtracks_per_coll) { if (fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) { continue; } - if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && std::find(vec_min_chi2MatchMCHMFT.begin(), vec_min_chi2MatchMCHMFT.end(), std::make_tuple(fwdtrack.globalIndex(), fwdtrack.matchMCHTrackId(), fwdtrack.matchMFTTrackId())) == vec_min_chi2MatchMCHMFT.end()) { - continue; - } - fillHistograms(collision, fwdtrack, fwdtracks, mfttracks); + fillHistograms(collision, fwdtrack, fwdtracks, mfttracks, nullptr); } // end of fwdtrack loop } // end of collision loop vec_min_chi2MatchMCHMFT.clear(); vec_min_chi2MatchMCHMFT.shrink_to_fit(); + vec_min_dr.clear(); + vec_min_dr.shrink_to_fit(); } PROCESS_SWITCH(matchingMFT, processWithoutFTTCA, "process without FTTCA", false); void processWithFTTCA(FilteredMyCollisions const& collisions, MyFwdTracks const& fwdtracks, MyMFTTracks const& mfttracks, aod::BCsWithTimestamps const&, aod::FwdTrackAssoc const& fwdtrackIndices, aod::McParticles const&) { - findBestMatchPerMCHMID(fwdtracks); - for (const auto& collision : collisions) { - const auto& bc = collision.template bc_as(); + auto bc = collision.template bc_as(); initCCDB(bc); fRegistry.fill(HIST("Event/hCollisionCounter"), 0); if (!collision.has_mcCollision()) { @@ -661,30 +823,96 @@ struct matchingMFT { if (cfgRequireGoodRCT && !rctChecker.checkTable(collision)) { continue; } - const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; + float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; } fRegistry.fill(HIST("Event/hCollisionCounter"), 1); fillEventHistograms(collision); - const auto& fwdtrackIdsThisCollision = fwdtrackIndices.sliceBy(fwdtrackIndicesPerCollision, collision.globalIndex()); + auto fwdtrackIdsThisCollision = fwdtrackIndices.sliceBy(fwdtrackIndicesPerCollision, collision.globalIndex()); for (const auto& fwdtrackId : fwdtrackIdsThisCollision) { - const auto& fwdtrack = fwdtrackId.template fwdtrack_as(); + auto fwdtrack = fwdtrackId.template fwdtrack_as(); if (fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) { continue; } - if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && std::find(vec_min_chi2MatchMCHMFT.begin(), vec_min_chi2MatchMCHMFT.end(), std::make_tuple(fwdtrack.globalIndex(), fwdtrack.matchMCHTrackId(), fwdtrack.matchMFTTrackId())) == vec_min_chi2MatchMCHMFT.end()) { - continue; - } - fillHistograms(collision, fwdtrack, fwdtracks, mfttracks); + fillHistograms(collision, fwdtrack, fwdtracks, mfttracks, nullptr); } // end of fwdtrack loop } // end of collision loop vec_min_chi2MatchMCHMFT.clear(); vec_min_chi2MatchMCHMFT.shrink_to_fit(); + vec_min_dr.clear(); + vec_min_dr.shrink_to_fit(); } PROCESS_SWITCH(matchingMFT, processWithFTTCA, "process with FTTCA", true); + + std::unordered_map map_mfttrackcovs; + + void processWithFTTCA_withMFTCov(FilteredMyCollisions const& collisions, MyFwdTracks const& fwdtracks, MyMFTTracks const& mfttracks, aod::MFTTracksCov const& mftCovs, aod::BCsWithTimestamps const&, aod::FwdTrackAssoc const& fwdtrackIndices, aod::McParticles const&) + { + for (const auto& mfttrackConv : mftCovs) { + map_mfttrackcovs[mfttrackConv.matchMFTTrackId()] = mfttrackConv.globalIndex(); + } + + vec_min_chi2MatchMCHMFT.reserve(fwdtracks.size()); + vec_min_dr.reserve(fwdtracks.size()); + + for (const auto& collision : collisions) { + auto bc = collision.template bc_as(); + initCCDB(bc); + auto fwdtrackIdsThisCollision = fwdtrackIndices.sliceBy(fwdtrackIndicesPerCollision, collision.globalIndex()); + for (const auto& fwdtrackId : fwdtrackIdsThisCollision) { + auto fwdtrack = fwdtrackId.template fwdtrack_as(); + findBestMatchPerMCHMID(collision, fwdtrack, fwdtracks, mfttracks, mftCovs); + } // end of fwdtrack loop + } // end of collision loop + + for (const auto& collision : collisions) { + auto bc = collision.template bc_as(); + initCCDB(bc); + fRegistry.fill(HIST("Event/hCollisionCounter"), 0); + if (!collision.has_mcCollision()) { + continue; + } + if (cfgRequireGoodRCT && !rctChecker.checkTable(collision)) { + continue; + } + float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; + if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { + continue; + } + fRegistry.fill(HIST("Event/hCollisionCounter"), 1); + fillEventHistograms(collision); + + auto fwdtrackIdsThisCollision = fwdtrackIndices.sliceBy(fwdtrackIndicesPerCollision, collision.globalIndex()); + for (const auto& fwdtrackId : fwdtrackIdsThisCollision) { + auto fwdtrack = fwdtrackId.template fwdtrack_as(); + + if (cfgBestMatchFinder == 0) { // chi2 + if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && std::find(vec_min_chi2MatchMCHMFT.begin(), vec_min_chi2MatchMCHMFT.end(), std::make_tuple(fwdtrack.globalIndex(), fwdtrack.matchMCHTrackId(), fwdtrack.matchMFTTrackId())) == vec_min_chi2MatchMCHMFT.end()) { + continue; + } + } else if (cfgBestMatchFinder == 1) { // dr + if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && std::find(vec_min_dr.begin(), vec_min_dr.end(), std::make_tuple(fwdtrack.globalIndex(), fwdtrack.matchMCHTrackId(), fwdtrack.matchMFTTrackId())) == vec_min_dr.end()) { + continue; + } + } else { // best match is not selected. Histograms are filled with all global muons. + if (fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) { + continue; + } + } + fillHistograms(collision, fwdtrack, fwdtracks, mfttracks, mftCovs); + } // end of fwdtrack loop + } // end of collision loop + + map_mfttrackcovs.clear(); + vec_min_chi2MatchMCHMFT.clear(); + vec_min_chi2MatchMCHMFT.shrink_to_fit(); + vec_min_dr.clear(); + vec_min_dr.shrink_to_fit(); + } + PROCESS_SWITCH(matchingMFT, processWithFTTCA_withMFTCov, "process with FTTCA with MFTCov", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { From 0aeb1e33f843a791aae5b897e423be3add77d774 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?BiaoZhang=20=28=E5=BC=A0=E5=BD=AA=29?= <52267892+zhangbiao-phy@users.noreply.github.com> Date: Mon, 13 Oct 2025 10:46:43 +0200 Subject: [PATCH 731/986] [PWGHF] Store interaction rate per BC in D0 task (#13347) Co-authored-by: ALICE Action Bot --- PWGHF/D2H/Tasks/CMakeLists.txt | 4 +- PWGHF/D2H/Tasks/taskD0.cxx | 237 ++++++++++++++++++--------------- 2 files changed, 135 insertions(+), 106 deletions(-) diff --git a/PWGHF/D2H/Tasks/CMakeLists.txt b/PWGHF/D2H/Tasks/CMakeLists.txt index 26e7b49ba8b..3fb53720168 100644 --- a/PWGHF/D2H/Tasks/CMakeLists.txt +++ b/PWGHF/D2H/Tasks/CMakeLists.txt @@ -66,7 +66,7 @@ o2physics_add_dpl_workflow(task-charm-reso-to-d-trk-reduced o2physics_add_dpl_workflow(task-d0 SOURCES taskD0.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::AnalysisCCDB COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(task-directed-flow-charm-hadrons @@ -147,4 +147,4 @@ o2physics_add_dpl_workflow(task-xicc o2physics_add_dpl_workflow(task-xic0-to-xi-pi SOURCES taskXic0ToXiPi.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore - COMPONENT_NAME Analysis) \ No newline at end of file + COMPONENT_NAME Analysis) diff --git a/PWGHF/D2H/Tasks/taskD0.cxx b/PWGHF/D2H/Tasks/taskD0.cxx index e5ed97171b1..c6b495d5fd7 100644 --- a/PWGHF/D2H/Tasks/taskD0.cxx +++ b/PWGHF/D2H/Tasks/taskD0.cxx @@ -23,6 +23,7 @@ #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/Utils/utilsEvSelHf.h" +#include "Common/CCDB/ctpRateFetcher.h" #include "Common/Core/RecoDecay.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" @@ -45,6 +46,7 @@ #include // std::min #include #include +#include #include using namespace o2; @@ -79,14 +81,19 @@ struct HfTaskD0 { Configurable centEstimator{"centEstimator", 0, "Centrality estimation (None: 0, FT0C: 2, FT0M: 3)"}; Configurable occEstimator{"occEstimator", 0, "Occupancy estimation (None: 0, ITS: 1, FT0C: 2)"}; Configurable storeCentrality{"storeCentrality", false, "Flag to store centrality information"}; - Configurable storeOccupancy{"storeOccupancy", false, "Flag to store occupancy information"}; + Configurable storeOccupancyAndIR{"storeOccupancyAndIR", false, "Flag to store occupancy information and interaction rate"}; Configurable storeTrackQuality{"storeTrackQuality", false, "Flag to store track quality information"}; // ML inference Configurable applyMl{"applyMl", false, "Flag to apply ML selections"}; + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable irSource{"irSource", "ZNC hadronic", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"}; HfHelper hfHelper; + ctpRateFetcher mRateFetcher; SliceCache cache; + Service ccdb; + using D0Candidates = soa::Join; using D0CandidatesMc = soa::Join; using D0CandidatesKF = soa::Join; @@ -132,6 +139,7 @@ struct HfTaskD0 { ConfigurableAxis thnConfigAxisOccupancy{"thnConfigAxisOccupancy", {14, 0, 14000}, "axis for centrality"}; ConfigurableAxis thnConfigAxisMinItsNCls{"thnConfigAxisMinItsNCls", {5, 3, 8}, "axis for minimum ITS NCls of candidate prongs"}; ConfigurableAxis thnConfigAxisMinTpcNCrossedRows{"thnConfigAxisMinTpcNCrossedRows", {10, 70, 180}, "axis for minimum TPC NCls crossed rows of candidate prongs"}; + ConfigurableAxis thnConfigAxisIR{"thnConfigAxisIR", {5000, 0, 500}, "Interaction rate (kHz)"}; HistogramRegistry registry{ "registry", @@ -218,7 +226,7 @@ struct HfTaskD0 { if ((doprocessDataWithDCAFitterN || doprocessDataWithDCAFitterNCent || doprocessMcWithDCAFitterN || doprocessMcWithDCAFitterNCent || doprocessDataWithDCAFitterNMl || doprocessDataWithDCAFitterNMlCent || doprocessMcWithDCAFitterNMl || doprocessMcWithDCAFitterNMlCent) && (doprocessDataWithKFParticle || doprocessMcWithKFParticle || doprocessDataWithKFParticleMl || doprocessMcWithKFParticleMl)) { LOGP(fatal, "DCAFitterN and KFParticle can not be enabled at a time."); } - if ((storeCentrality || storeOccupancy) && !(doprocessDataWithDCAFitterNCent || doprocessMcWithDCAFitterNCent || doprocessDataWithDCAFitterNMlCent || doprocessMcWithDCAFitterNMlCent)) { + if ((storeCentrality || storeOccupancyAndIR) && !(doprocessDataWithDCAFitterNCent || doprocessMcWithDCAFitterNCent || doprocessDataWithDCAFitterNMlCent || doprocessMcWithDCAFitterNMlCent)) { LOGP(fatal, "Can't enable the storeCentrality and storeOccupancu without cent process"); } auto vbins = (std::vector)binsPt; @@ -273,6 +281,7 @@ struct HfTaskD0 { const AxisSpec thnAxisOccupancy{thnConfigAxisOccupancy, "Occupancy"}; const AxisSpec thnAxisMinItsNCls{thnConfigAxisMinItsNCls, "Minimum ITS cluster found"}; const AxisSpec thnAxisMinTpcNCrossedRows{thnConfigAxisMinTpcNCrossedRows, "Minimum TPC crossed rows"}; + const AxisSpec thnAxisIR{thnConfigAxisIR, "Interaction rate"}; if (doprocessMcWithDCAFitterN || doprocessMcWithDCAFitterNCent || doprocessMcWithKFParticle || doprocessMcWithDCAFitterNMl || doprocessMcWithDCAFitterNMlCent || doprocessMcWithKFParticleMl) { std::vector axesAcc = {thnAxisGenPtD, thnAxisGenPtB, thnAxisY, thnAxisOrigin, thnAxisNumPvContr}; @@ -280,7 +289,8 @@ struct HfTaskD0 { if (storeCentrality) { axesAcc.push_back(thnAxisCent); } - if (storeOccupancy) { + // interaction rate only store in Data and MC Reco. Level + if (storeOccupancyAndIR) { axesAcc.push_back(thnAxisOccupancy); } @@ -297,8 +307,9 @@ struct HfTaskD0 { if (storeCentrality) { axes.push_back(thnAxisCent); } - if (storeOccupancy) { + if (storeOccupancyAndIR) { axes.push_back(thnAxisOccupancy); + axes.push_back(thnAxisIR); } if (storeTrackQuality) { axes.push_back(thnAxisMinItsNCls); @@ -319,12 +330,17 @@ struct HfTaskD0 { registry.add("hMassVsPtVsPtBVsYVsOriginVsD0Type", "Thn for D0 candidates", HistType::kTHnSparseD, axes); registry.get(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"))->Sumw2(); } + + ccdb->setURL(ccdbUrl); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); } - template + template void processData(CandType const& candidates, CollType const&, - aod::TracksWExtra const&) + aod::TracksWExtra const&, + BCsType const&) { for (const auto& candidate : candidates) { if (!(candidate.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { @@ -385,13 +401,16 @@ struct HfTaskD0 { float cent{-1.f}; float occ{-1.f}; - if (storeCentrality || storeOccupancy) { + float ir{-1.f}; + if (storeCentrality || storeOccupancyAndIR) { auto collision = candidate.template collision_as(); if (storeCentrality && centEstimator != CentralityEstimator::None) { cent = getCentralityColl(collision, centEstimator); } - if (storeOccupancy && occEstimator != OccupancyEstimator::None) { + if (storeOccupancyAndIR && occEstimator != OccupancyEstimator::None) { occ = o2::hf_occupancy::getOccupancyColl(collision, occEstimator); + auto bc = collision.template foundBC_as(); + ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), irSource, true) * 1.e-3; // kHz } } @@ -400,16 +419,16 @@ struct HfTaskD0 { int const minItsClustersOfProngs = std::min(trackPos.itsNCls(), trackNeg.itsNCls()); int const minTpcCrossedRowsOfProngs = std::min(trackPos.tpcNClsCrossedRows(), trackNeg.tpcNClsCrossedRows()); if constexpr (ApplyMl) { - if (storeCentrality && storeOccupancy) { + if (storeCentrality && storeOccupancyAndIR) { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent, occ); - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent, occ); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent, occ, ir); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent, occ, ir); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent, occ); - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent, occ); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent, occ, ir); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent, occ, ir); } - } else if (storeCentrality && !storeOccupancy) { + } else if (storeCentrality && !storeOccupancyAndIR) { if (candidate.isSelD0() >= selectionFlagD0) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent); registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent); @@ -418,14 +437,14 @@ struct HfTaskD0 { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent); registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent); } - } else if (!storeCentrality && storeOccupancy) { + } else if (!storeCentrality && storeOccupancyAndIR) { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, occ); - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, occ); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, occ, ir); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, occ, ir); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, occ); - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, occ); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, occ, ir); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, occ, ir); } } else if (storeTrackQuality) { if (candidate.isSelD0() >= selectionFlagD0) { @@ -447,16 +466,16 @@ struct HfTaskD0 { } } } else { - if (storeCentrality && storeOccupancy) { + if (storeCentrality && storeOccupancyAndIR) { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent, occ); - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent, occ); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent, occ, ir); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent, occ, ir); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent, occ); - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent, occ); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent, occ, ir); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent, occ, ir); } - } else if (storeCentrality && !storeOccupancy) { + } else if (storeCentrality && !storeOccupancyAndIR) { if (candidate.isSelD0() >= selectionFlagD0) { registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent); registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent); @@ -465,14 +484,14 @@ struct HfTaskD0 { registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent); registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent); } - } else if (!storeCentrality && storeOccupancy) { + } else if (!storeCentrality && storeOccupancyAndIR) { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, occ); - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, occ); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, occ, ir); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, occ, ir); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, occ); - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, occ); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, occ, ir); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, occ, ir); } } else if (storeTrackQuality) { if (candidate.isSelD0() >= selectionFlagD0) { @@ -496,50 +515,51 @@ struct HfTaskD0 { } } } - void processDataWithDCAFitterN(D0Candidates const&, Collisions const& collisions, aod::TracksWExtra const& tracks) + void processDataWithDCAFitterN(D0Candidates const&, Collisions const& collisions, aod::TracksWExtra const& tracks, aod::BcFullInfos const& bcs) { - processData(selectedD0Candidates, collisions, tracks); + processData(selectedD0Candidates, collisions, tracks, bcs); } PROCESS_SWITCH(HfTaskD0, processDataWithDCAFitterN, "process taskD0 with DCAFitterN", true); - void processDataWithDCAFitterNCent(D0Candidates const&, CollisionsCent const& collisions, aod::TracksWExtra const& tracks) + void processDataWithDCAFitterNCent(D0Candidates const&, CollisionsCent const& collisions, aod::TracksWExtra const& tracks, aod::BcFullInfos const& bcs) { - processData(selectedD0Candidates, collisions, tracks); + processData(selectedD0Candidates, collisions, tracks, bcs); } PROCESS_SWITCH(HfTaskD0, processDataWithDCAFitterNCent, "process taskD0 with DCAFitterN and centrality", false); - void processDataWithKFParticle(D0CandidatesKF const&, Collisions const& collisions, aod::TracksWExtra const& tracks) + void processDataWithKFParticle(D0CandidatesKF const&, Collisions const& collisions, aod::TracksWExtra const& tracks, aod::BcFullInfos const& bcs) { - processData(selectedD0CandidatesKF, collisions, tracks); + processData(selectedD0CandidatesKF, collisions, tracks, bcs); } PROCESS_SWITCH(HfTaskD0, processDataWithKFParticle, "process taskD0 with KFParticle", false); // TODO: add processKFParticleCent - void processDataWithDCAFitterNMl(D0CandidatesMl const&, Collisions const& collisions, aod::TracksWExtra const& tracks) + void processDataWithDCAFitterNMl(D0CandidatesMl const&, Collisions const& collisions, aod::TracksWExtra const& tracks, aod::BcFullInfos const& bcs) { - processData(selectedD0CandidatesMl, collisions, tracks); + processData(selectedD0CandidatesMl, collisions, tracks, bcs); } PROCESS_SWITCH(HfTaskD0, processDataWithDCAFitterNMl, "process taskD0 with DCAFitterN and ML selections", false); - void processDataWithDCAFitterNMlCent(D0CandidatesMl const&, CollisionsCent const& collisions, aod::TracksWExtra const& tracks) + void processDataWithDCAFitterNMlCent(D0CandidatesMl const&, CollisionsCent const& collisions, aod::TracksWExtra const& tracks, aod::BcFullInfos const& bcs) { - processData(selectedD0CandidatesMl, collisions, tracks); + processData(selectedD0CandidatesMl, collisions, tracks, bcs); } PROCESS_SWITCH(HfTaskD0, processDataWithDCAFitterNMlCent, "process taskD0 with DCAFitterN and ML selections and centrality", false); - void processDataWithKFParticleMl(D0CandidatesMlKF const&, Collisions const& collisions, aod::TracksWExtra const& tracks) + void processDataWithKFParticleMl(D0CandidatesMlKF const&, Collisions const& collisions, aod::TracksWExtra const& tracks, aod::BcFullInfos const& bcs) { - processData(selectedD0CandidatesMlKF, collisions, tracks); + processData(selectedD0CandidatesMlKF, collisions, tracks, bcs); } PROCESS_SWITCH(HfTaskD0, processDataWithKFParticleMl, "process taskD0 with KFParticle and ML selections", false); // TODO: add processKFParticleMlCent - template + template void processMc(CandType const& candidates, soa::Join const& mcParticles, TracksSelQuality const&, CollType const& collisions, - aod::McCollisions const&) + aod::McCollisions const&, + BCsType const&) { // MC rec. for (const auto& candidate : candidates) { @@ -552,13 +572,16 @@ struct HfTaskD0 { float cent{-1.f}; float occ{-1.f}; + float ir{-1.f}; auto collision = candidate.template collision_as(); auto numPvContributors = collision.numContrib(); if (storeCentrality && centEstimator != CentralityEstimator::None) { cent = getCentralityColl(collision, centEstimator); } - if (storeOccupancy && occEstimator != OccupancyEstimator::None) { + if (storeOccupancyAndIR && occEstimator != OccupancyEstimator::None) { occ = o2::hf_occupancy::getOccupancyColl(collision, occEstimator); + auto bc = collision.template foundBC_as(); + ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), irSource, true) * 1.e-3; // kHz } float massD0, massD0bar; if constexpr (ReconstructionType == aod::hf_cand::VertexerType::KfParticle) { @@ -689,24 +712,24 @@ struct HfTaskD0 { registry.fill(HIST("hDecLengthxyVsPtSig"), declengthxyCandidate, ptCandidate); registry.fill(HIST("hMassSigD0"), massD0, ptCandidate, rapidityCandidate); if constexpr (ApplyMl) { - if (storeCentrality && storeOccupancy) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); - } else if (storeCentrality && !storeOccupancy) { + if (storeCentrality && storeOccupancyAndIR) { + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ, ir); + } else if (storeCentrality && !storeOccupancyAndIR) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); - } else if (!storeCentrality && storeOccupancy) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + } else if (!storeCentrality && storeOccupancyAndIR) { + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ, ir); } else if (storeTrackQuality) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, minItsClustersOfProngs, minTpcCrossedRowsOfProngs); } else { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } else { - if (storeCentrality && storeOccupancy) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); - } else if (storeCentrality && !storeOccupancy) { + if (storeCentrality && storeOccupancyAndIR) { + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ, ir); + } else if (storeCentrality && !storeOccupancyAndIR) { registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); - } else if (!storeCentrality && storeOccupancy) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + } else if (!storeCentrality && storeOccupancyAndIR) { + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ, ir); } else if (storeTrackQuality) { registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, minItsClustersOfProngs, minTpcCrossedRowsOfProngs); } else { @@ -731,24 +754,24 @@ struct HfTaskD0 { if (candidate.flagMcMatchRec() == -o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { registry.fill(HIST("hMassReflBkgD0"), massD0, ptCandidate, rapidityCandidate); if constexpr (ApplyMl) { - if (storeCentrality && storeOccupancy) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); - } else if (storeCentrality && !storeOccupancy) { + if (storeCentrality && storeOccupancyAndIR) { + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ, ir); + } else if (storeCentrality && !storeOccupancyAndIR) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); - } else if (!storeCentrality && storeOccupancy) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + } else if (!storeCentrality && storeOccupancyAndIR) { + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ, ir); } else if (storeTrackQuality) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, minItsClustersOfProngs, minTpcCrossedRowsOfProngs); } else { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } else { - if (storeCentrality && storeOccupancy) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); - } else if (storeCentrality && !storeOccupancy) { + if (storeCentrality && storeOccupancyAndIR) { + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ, ir); + } else if (storeCentrality && !storeOccupancyAndIR) { registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); - } else if (!storeCentrality && storeOccupancy) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + } else if (!storeCentrality && storeOccupancyAndIR) { + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ, ir); } else if (storeTrackQuality) { registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, minItsClustersOfProngs, minTpcCrossedRowsOfProngs); } else { @@ -763,24 +786,24 @@ struct HfTaskD0 { if (candidate.flagMcMatchRec() == -o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { registry.fill(HIST("hMassSigD0bar"), massD0bar, ptCandidate, rapidityCandidate); if constexpr (ApplyMl) { - if (storeCentrality && storeOccupancy) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); - } else if (storeCentrality && !storeOccupancy) { + if (storeCentrality && storeOccupancyAndIR) { + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ, ir); + } else if (storeCentrality && !storeOccupancyAndIR) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); - } else if (!storeCentrality && storeOccupancy) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + } else if (!storeCentrality && storeOccupancyAndIR) { + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ, ir); } else if (storeTrackQuality) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, minItsClustersOfProngs, minTpcCrossedRowsOfProngs); } else { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } else { - if (storeCentrality && storeOccupancy) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); - } else if (storeCentrality && !storeOccupancy) { + if (storeCentrality && storeOccupancyAndIR) { + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ, ir); + } else if (storeCentrality && !storeOccupancyAndIR) { registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); - } else if (!storeCentrality && storeOccupancy) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + } else if (!storeCentrality && storeOccupancyAndIR) { + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ, ir); } else if (storeTrackQuality) { registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, minItsClustersOfProngs, minTpcCrossedRowsOfProngs); } else { @@ -792,24 +815,24 @@ struct HfTaskD0 { if (candidate.flagMcMatchRec() == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { registry.fill(HIST("hMassReflBkgD0bar"), massD0bar, ptCandidate, rapidityCandidate); if constexpr (ApplyMl) { - if (storeCentrality && storeOccupancy) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); - } else if (storeCentrality && !storeOccupancy) { + if (storeCentrality && storeOccupancyAndIR) { + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ, ir); + } else if (storeCentrality && !storeOccupancyAndIR) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); - } else if (!storeCentrality && storeOccupancy) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + } else if (!storeCentrality && storeOccupancyAndIR) { + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ, ir); } else if (storeTrackQuality) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, minItsClustersOfProngs, minTpcCrossedRowsOfProngs); } else { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } else { - if (storeCentrality && storeOccupancy) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); - } else if (storeCentrality && !storeOccupancy) { + if (storeCentrality && storeOccupancyAndIR) { + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ, ir); + } else if (storeCentrality && !storeOccupancyAndIR) { registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); - } else if (!storeCentrality && storeOccupancy) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + } else if (!storeCentrality && storeOccupancyAndIR) { + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ, ir); } else if (storeTrackQuality) { registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, minItsClustersOfProngs, minTpcCrossedRowsOfProngs); } else { @@ -843,7 +866,7 @@ struct HfTaskD0 { if (storeCentrality && centEstimator != CentralityEstimator::None) { cent = getCentralityGenColl(recoCollsPerMcCollCent, centEstimator); } - if (storeOccupancy && occEstimator != OccupancyEstimator::None) { + if (storeOccupancyAndIR && occEstimator != OccupancyEstimator::None) { occ = o2::hf_occupancy::getOccupancyGenColl(recoCollsPerMcCollCent, occEstimator); } } else { @@ -857,11 +880,11 @@ struct HfTaskD0 { registry.fill(HIST("hPtGenPrompt"), ptGen); registry.fill(HIST("hYGenPrompt"), yGen); registry.fill(HIST("hPtVsYGenPrompt"), ptGen, yGen); - if (storeCentrality && storeOccupancy) { + if (storeCentrality && storeOccupancyAndIR) { registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, 1, maxNumContrib, cent, occ); - } else if (storeCentrality && !storeOccupancy) { + } else if (storeCentrality && !storeOccupancyAndIR) { registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, 1, maxNumContrib, cent); - } else if (!storeCentrality && storeOccupancy) { + } else if (!storeCentrality && storeOccupancyAndIR) { registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, 1, maxNumContrib, occ); } else { registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, 1, maxNumContrib); @@ -871,11 +894,11 @@ struct HfTaskD0 { registry.fill(HIST("hPtGenNonPrompt"), ptGen); registry.fill(HIST("hYGenNonPrompt"), yGen); registry.fill(HIST("hPtVsYGenNonPrompt"), ptGen, yGen); - if (storeCentrality && storeOccupancy) { + if (storeCentrality && storeOccupancyAndIR) { registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, 2, maxNumContrib, cent, occ); - } else if (storeCentrality && !storeOccupancy) { + } else if (storeCentrality && !storeOccupancyAndIR) { registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, 2, maxNumContrib, cent); - } else if (!storeCentrality && storeOccupancy) { + } else if (!storeCentrality && storeOccupancyAndIR) { registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, 2, maxNumContrib, occ); } else { registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, 2, maxNumContrib); @@ -890,9 +913,10 @@ struct HfTaskD0 { soa::Join const& mcParticles, TracksSelQuality const& tracks, CollisionsWithMcLabels const& collisions, - aod::McCollisions const& mcCollisions) + aod::McCollisions const& mcCollisions, + aod::BcFullInfos const& bcs) { - processMc(selectedD0CandidatesMc, mcParticles, tracks, collisions, mcCollisions); + processMc(selectedD0CandidatesMc, mcParticles, tracks, collisions, mcCollisions, bcs); } PROCESS_SWITCH(HfTaskD0, processMcWithDCAFitterN, "Process MC with DCAFitterN", false); @@ -900,9 +924,10 @@ struct HfTaskD0 { soa::Join const& mcParticles, TracksSelQuality const& tracks, CollisionsWithMcLabelsCent const& collisions, - aod::McCollisions const& mcCollisions) + aod::McCollisions const& mcCollisions, + aod::BcFullInfos const& bcs) { - processMc(selectedD0CandidatesMc, mcParticles, tracks, collisions, mcCollisions); + processMc(selectedD0CandidatesMc, mcParticles, tracks, collisions, mcCollisions, bcs); } PROCESS_SWITCH(HfTaskD0, processMcWithDCAFitterNCent, "Process MC with DCAFitterN and centrality", false); @@ -910,9 +935,10 @@ struct HfTaskD0 { soa::Join const& mcParticles, TracksSelQuality const& tracks, CollisionsWithMcLabels const& collisions, - aod::McCollisions const& mcCollisions) + aod::McCollisions const& mcCollisions, + aod::BcFullInfos const& bcs) { - processMc(selectedD0CandidatesMcKF, mcParticles, tracks, collisions, mcCollisions); + processMc(selectedD0CandidatesMcKF, mcParticles, tracks, collisions, mcCollisions, bcs); } PROCESS_SWITCH(HfTaskD0, processMcWithKFParticle, "Process MC with KFParticle", false); // TODO: add the processMcWithKFParticleCent @@ -921,9 +947,10 @@ struct HfTaskD0 { soa::Join const& mcParticles, TracksSelQuality const& tracks, CollisionsWithMcLabels const& collisions, - aod::McCollisions const& mcCollisions) + aod::McCollisions const& mcCollisions, + aod::BcFullInfos const& bcs) { - processMc(selectedD0CandidatesMlMc, mcParticles, tracks, collisions, mcCollisions); + processMc(selectedD0CandidatesMlMc, mcParticles, tracks, collisions, mcCollisions, bcs); } PROCESS_SWITCH(HfTaskD0, processMcWithDCAFitterNMl, "Process MC with DCAFitterN and ML selection", false); @@ -931,9 +958,10 @@ struct HfTaskD0 { soa::Join const& mcParticles, TracksSelQuality const& tracks, CollisionsWithMcLabelsCent const& collisions, - aod::McCollisions const& mcCollisions) + aod::McCollisions const& mcCollisions, + aod::BcFullInfos const& bcs) { - processMc(selectedD0CandidatesMlMc, mcParticles, tracks, collisions, mcCollisions); + processMc(selectedD0CandidatesMlMc, mcParticles, tracks, collisions, mcCollisions, bcs); } PROCESS_SWITCH(HfTaskD0, processMcWithDCAFitterNMlCent, "Process MC with DCAFitterN and ML selection and centrality", false); @@ -941,9 +969,10 @@ struct HfTaskD0 { soa::Join const& mcParticles, TracksSelQuality const& tracks, CollisionsWithMcLabels const& collisions, - aod::McCollisions const& mcCollisions) + aod::McCollisions const& mcCollisions, + aod::BcFullInfos const& bcs) { - processMc(selectedD0CandidatesMlMcKF, mcParticles, tracks, collisions, mcCollisions); + processMc(selectedD0CandidatesMlMcKF, mcParticles, tracks, collisions, mcCollisions, bcs); } PROCESS_SWITCH(HfTaskD0, processMcWithKFParticleMl, "Process MC with KFParticle and ML selections", false); // TODO: add the processMcWithKFParticleMlCent From 794d6afb96b1550d7515b8927c33116ced0fb9d9 Mon Sep 17 00:00:00 2001 From: basiach <74355517+basiach@users.noreply.github.com> Date: Mon, 13 Oct 2025 11:01:04 +0200 Subject: [PATCH 732/986] [PWGCF] FemtoUniverse - Fixing mismatched table sizes for cascades with default TOF signal (#13331) Co-authored-by: Barbara Chytla --- .../TableProducer/femtoUniverseProducerTask.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx index 2609a03fcc9..239e39e587e 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx @@ -738,6 +738,12 @@ struct FemtoUniverseProducerTask { particle.tofNSigmaOmLaPr(), particle.tofNSigmaOmKa(), particle.dcacascdaughters(), particle.cascradius(), particle.x(), particle.y(), particle.z(), -999.); + } else { + outputDebugParts(-999., -999., -999., -999., -999., -999., -999., -999., -999., + -999., -999., -999., -999., -999., -999., -999., -999., + -999., -999., -999., -999., -999., + particle.dcacascdaughters(), particle.cascradius(), + particle.x(), particle.y(), particle.z(), -999.); } } else { // LOGF(info, "isTrack0orV0: %d, isPhi: %d", isTrackOrV0, isPhiOrD0); From 93d1ce7d1454b4af6f612657ed218b2485f22639 Mon Sep 17 00:00:00 2001 From: SuJeong Ji <120470463+SuJeong-Ji@users.noreply.github.com> Date: Mon, 13 Oct 2025 18:39:09 +0900 Subject: [PATCH 733/986] [PWGLF] chk892pp.cxx update on centrality and add QA plots for MC (#13364) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Resonances/chk892pp.cxx | 251 ++++++++++++++-------------- 1 file changed, 124 insertions(+), 127 deletions(-) diff --git a/PWGLF/Tasks/Resonances/chk892pp.cxx b/PWGLF/Tasks/Resonances/chk892pp.cxx index ca235de8ff9..e888723a6b3 100644 --- a/PWGLF/Tasks/Resonances/chk892pp.cxx +++ b/PWGLF/Tasks/Resonances/chk892pp.cxx @@ -109,6 +109,7 @@ struct Chk892pp { SliceCache cache; Preslice perCollision = aod::track::collisionId; + Preslice perCollisionV0 = aod::v0data::collisionId; using EventCandidates = soa::Join; using TrackCandidates = soa::Join; @@ -153,7 +154,7 @@ struct Chk892pp { Configurable cfgEvtOccupancyInTimeRangeMax{"cfgEvtOccupancyInTimeRangeMax", -1, "Evt sel: maximum track occupancy"}; Configurable cfgEvtOccupancyInTimeRangeMin{"cfgEvtOccupancyInTimeRangeMin", -1, "Evt sel: minimum track occupancy"}; Configurable cfgEvtTriggerCheck{"cfgEvtTriggerCheck", false, "Evt sel: check for trigger"}; - Configurable cfgEvtOfflineCheck{"cfgEvtOfflineCheck", true, "Evt sel: check for offline selection"}; + Configurable cfgEvtOfflineCheck{"cfgEvtOfflineCheck", false, "Evt sel: check for offline selection"}; Configurable cfgEvtTriggerTVXSel{"cfgEvtTriggerTVXSel", true, "Evt sel: triggerTVX selection (MB)"}; Configurable cfgEvtTFBorderCut{"cfgEvtTFBorderCut", true, "Evt sel: apply TF border cut"}; Configurable cfgEvtUseITSTPCvertex{"cfgEvtUseITSTPCvertex", false, "Evt sel: use at lease on ITS-TPC track for vertexing"}; @@ -171,6 +172,7 @@ struct Chk892pp { } EventCuts; RCTFlagsChecker rctChecker; + Configurable cfgFillQAPlots{"cfgFillQAPlots", false, "Fill QA plots"}; Configurable cfgCentEst{"cfgCentEst", 2, "Centrality estimator, 1: FT0C, 2: FT0M"}; /// PID Selections, pion @@ -211,7 +213,7 @@ struct Chk892pp { // Secondary Selection struct : ConfigurableGroup { - Configurable cfgReturnFlag{"cfgReturnFlag", true, "Return Flag for debugging"}; + Configurable cfgReturnFlag{"cfgReturnFlag", false, "Return Flag for debugging"}; Configurable cfgSecondaryRequire{"cfgSecondaryRequire", true, "Secondary cuts on/off"}; Configurable cfgSecondaryArmenterosCut{"cfgSecondaryArmenterosCut", true, "cut on Armenteros-Podolanski graph"}; Configurable cfgSecondaryCrossMassHypothesisCut{"cfgSecondaryCrossMassHypothesisCut", false, "Apply cut based on the lambda mass hypothesis"}; @@ -300,8 +302,8 @@ struct Chk892pp { histos.add("QA/K0sCutCheck", "Check K0s cut", HistType::kTH1D, {AxisSpec{13, -0.5, 12.5, "Check"}}); histos.add("QA/K0sCutFlow", "Check K0s cut (first-fail or pass)", HistType::kTH1F, {cutAxis}); auto hcut = histos.get(HIST("QA/K0sCutFlow")); - hcut->GetXaxis()->SetBinLabel(1, "TOTAL"); // 총 후보 수 - hcut->GetXaxis()->SetBinLabel(2, "PASS"); // 최종 통과 + hcut->GetXaxis()->SetBinLabel(1, "TOTAL"); + hcut->GetXaxis()->SetBinLabel(2, "PASS"); hcut->GetXaxis()->SetBinLabel(3, "DauDCA>max"); hcut->GetXaxis()->SetBinLabel(4, "PosDCAtoPVGetXaxis()->SetBinLabel(5, "NegDCAtoPVsetURL(CCDBConfig.cfgURL); @@ -448,9 +445,9 @@ struct Chk892pp { float getCentrality(CollisionType const& collision) { if (cfgCentEst == kCentFT0C) { - return collision.multFT0C(); + return collision.centFT0C(); } else if (cfgCentEst == kCentFT0M) { - return collision.multFT0M(); + return collision.centFT0M(); } else { return kInvalidCentrality; } @@ -865,12 +862,7 @@ struct Chk892pp { if (std::abs(part.y()) > KstarCuts.cfgKstarMaxRap) continue; - const double px = part.px(), py = part.py(), pz = part.pz(), e = part.e(); - const double mgen2 = e * e - (px * px + py * py + pz * pz); - const double mgen = (mgen2 > 0.0) ? std::sqrt(mgen2) : 0.0; - histos.fill(HIST("EffKstar/genKstar"), part.pt(), lCentrality); - histos.fill(HIST("EffKstar/genKstar_m"), mgen); } } // effKstarProcessGen @@ -921,22 +913,6 @@ struct Chk892pp { lDecayDaughter_bach = LorentzVectorSetXYZM(bTrack.px(), bTrack.py(), bTrack.pz(), MassPionCharged); lResoKstar = lResoSecondary + lDecayDaughter_bach; - histos.fill(HIST("EffKstar/recoKstar_m"), lResoKstar.Pt(), lResoKstar.M()); - - if (BkgEstimationConfig.cfgFillRotBkg) { - for (int i = 0; i < BkgEstimationConfig.cfgNrotBkg; i++) { - auto lRotAngle = BkgEstimationConfig.cfgMinRot + i * ((BkgEstimationConfig.cfgMaxRot - BkgEstimationConfig.cfgMinRot) / (BkgEstimationConfig.cfgNrotBkg - 1)); - - lDaughterRot = lDecayDaughter_bach; - ROOT::Math::RotationZ rot(lRotAngle); - auto p3 = rot * lDaughterRot.Vect(); - lDaughterRot = LorentzVectorSetXYZM(p3.X(), p3.Y(), p3.Z(), lDaughterRot.M()); - lResonanceRot = lDaughterRot + lResoSecondary; - - histos.fill(HIST("EffKstar/recoKstar_m_rot"), lResonanceRot.Pt(), lResonanceRot.M()); - } - } - double ptgen = 0, ygen = 0; if (!matchRecoToTruthKstar(v0, bTrack, ptgen, ygen)) continue; @@ -947,7 +923,6 @@ struct Chk892pp { if (std::abs(yreco) > KstarCuts.cfgKstarMaxRap) continue; histos.fill(HIST("EffKstar/recoKstar"), ptreco, lCentrality); - histos.fill(HIST("EffKstar/recoKstar_m_matched"), ptreco, lResoKstar.M()); } } } // effKstarProcessReco @@ -972,15 +947,17 @@ struct Chk892pp { auto trkbNSigmaPiTOF = (istrkbhasTOF) ? bTrack.tofNSigmaPi() : -999.; if constexpr (!IsMix) { - // Bachelor pion QA plots - histos.fill(HIST("QA/before/trkbpionTPCPID"), trkbpt, trkbNSigmaPiTPC); - if (istrkbhasTOF) { - histos.fill(HIST("QA/before/trkbpionTOFPID"), trkbpt, trkbNSigmaPiTOF); - histos.fill(HIST("QA/before/trkbpionTPCTOFPID"), trkbNSigmaPiTPC, trkbNSigmaPiTOF); + if (cfgFillQAPlots) { + // Bachelor pion QA plots + histos.fill(HIST("QA/before/trkbpionTPCPID"), trkbpt, trkbNSigmaPiTPC); + if (istrkbhasTOF) { + histos.fill(HIST("QA/before/trkbpionTOFPID"), trkbpt, trkbNSigmaPiTOF); + histos.fill(HIST("QA/before/trkbpionTPCTOFPID"), trkbNSigmaPiTPC, trkbNSigmaPiTOF); + } + histos.fill(HIST("QA/before/trkbpionpT"), trkbpt); + histos.fill(HIST("QA/before/trkbpionDCAxy"), bTrack.dcaXY()); + histos.fill(HIST("QA/before/trkbpionDCAz"), bTrack.dcaZ()); } - histos.fill(HIST("QA/before/trkbpionpT"), trkbpt); - histos.fill(HIST("QA/before/trkbpionDCAxy"), bTrack.dcaXY()); - histos.fill(HIST("QA/before/trkbpionDCAz"), bTrack.dcaZ()); } if (!trackCut(bTrack)) @@ -989,22 +966,23 @@ struct Chk892pp { continue; if constexpr (!IsMix) { - // Bachelor pion QA plots after applying cuts - histos.fill(HIST("QA/after/trkbpionTPCPID"), trkbpt, trkbNSigmaPiTPC); - if (istrkbhasTOF) { - histos.fill(HIST("QA/after/trkbpionTOFPID"), trkbpt, trkbNSigmaPiTOF); - histos.fill(HIST("QA/after/trkbpionTPCTOFPID"), trkbNSigmaPiTPC, trkbNSigmaPiTOF); + if (cfgFillQAPlots) { + // Bachelor pion QA plots after applying cuts + histos.fill(HIST("QA/after/trkbpionTPCPID"), trkbpt, trkbNSigmaPiTPC); + if (istrkbhasTOF) { + histos.fill(HIST("QA/after/trkbpionTOFPID"), trkbpt, trkbNSigmaPiTOF); + histos.fill(HIST("QA/after/trkbpionTPCTOFPID"), trkbNSigmaPiTPC, trkbNSigmaPiTOF); + } + histos.fill(HIST("QA/after/trkbpionpT"), trkbpt); + histos.fill(HIST("QA/after/trkbpionDCAxy"), bTrack.dcaXY()); + histos.fill(HIST("QA/after/trkbpionDCAz"), bTrack.dcaZ()); } - histos.fill(HIST("QA/after/trkbpionpT"), trkbpt); - histos.fill(HIST("QA/after/trkbpionDCAxy"), bTrack.dcaXY()); - histos.fill(HIST("QA/after/trkbpionDCAz"), bTrack.dcaZ()); } trackIndicies.push_back(bTrack.index()); } for (const auto& k0sCand : dTracks2) { - // auto posDauTrack = k0sCand.template posTrack_as(); - // auto negDauTrack = k0sCand.template negTrack_as(); + auto posDauTrack = k0sCand.template posTrack_as(); auto negDauTrack = k0sCand.template negTrack_as(); @@ -1035,36 +1013,38 @@ struct Chk892pp { lResoSecondary = LorentzVectorSetXYZM(k0sCand.px(), k0sCand.py(), k0sCand.pz(), trkkMass); if constexpr (!IsMix) { - // Seconddary QA plots - histos.fill(HIST("QA/before/trkppionTPCPID"), trkppt, trkpNSigmaPiTPC); - if (istrkphasTOF) { - histos.fill(HIST("QA/before/trkppionTOFPID"), trkppt, trkpNSigmaPiTOF); - histos.fill(HIST("QA/before/trkppionTPCTOFPID"), trkpNSigmaPiTPC, trkpNSigmaPiTOF); - } - histos.fill(HIST("QA/before/trkppionpT"), trkppt); - histos.fill(HIST("QA/before/trkppionDCAxy"), posDauTrack.dcaXY()); - histos.fill(HIST("QA/before/trkppionDCAz"), posDauTrack.dcaZ()); - - histos.fill(HIST("QA/before/trknpionTPCPID"), trknpt, trknNSigmaPiTPC); - if (istrknhasTOF) { - histos.fill(HIST("QA/before/trknpionTOFPID"), trknpt, trknNSigmaPiTOF); - histos.fill(HIST("QA/before/trknpionTPCTOFPID"), trknNSigmaPiTPC, trknNSigmaPiTOF); + if (cfgFillQAPlots) { + // Seconddary QA plots + histos.fill(HIST("QA/before/trkppionTPCPID"), trkppt, trkpNSigmaPiTPC); + if (istrkphasTOF) { + histos.fill(HIST("QA/before/trkppionTOFPID"), trkppt, trkpNSigmaPiTOF); + histos.fill(HIST("QA/before/trkppionTPCTOFPID"), trkpNSigmaPiTPC, trkpNSigmaPiTOF); + } + histos.fill(HIST("QA/before/trkppionpT"), trkppt); + histos.fill(HIST("QA/before/trkppionDCAxy"), posDauTrack.dcaXY()); + histos.fill(HIST("QA/before/trkppionDCAz"), posDauTrack.dcaZ()); + + histos.fill(HIST("QA/before/trknpionTPCPID"), trknpt, trknNSigmaPiTPC); + if (istrknhasTOF) { + histos.fill(HIST("QA/before/trknpionTOFPID"), trknpt, trknNSigmaPiTOF); + histos.fill(HIST("QA/before/trknpionTPCTOFPID"), trknNSigmaPiTPC, trknNSigmaPiTOF); + } + histos.fill(HIST("QA/before/trknpionpT"), trknpt); + histos.fill(HIST("QA/before/trknpionDCAxy"), negDauTrack.dcaXY()); + histos.fill(HIST("QA/before/trknpionDCAz"), negDauTrack.dcaZ()); + + histos.fill(HIST("QA/before/hDauDCASecondary"), trkkDauDCA); + histos.fill(HIST("QA/before/hDauPosDCAtoPVSecondary"), trkkDauDCAPostoPV); + histos.fill(HIST("QA/before/hDauNegDCAtoPVSecondary"), trkkDauDCANegtoPV); + + histos.fill(HIST("QA/before/hpT_Secondary"), trkkpt); + histos.fill(HIST("QA/before/hy_Secondary"), trkky); + histos.fill(HIST("QA/before/hRadiusSecondary"), trkkRadius); + histos.fill(HIST("QA/before/hDCAtoPVSecondary"), trkkDCAtoPV); + histos.fill(HIST("QA/before/hCPASecondary"), trkkCPA); + histos.fill(HIST("QA/before/hPropTauSecondary"), trkkPropTau); + histos.fill(HIST("QA/before/hInvmassSecondary"), trkkMass); } - histos.fill(HIST("QA/before/trknpionpT"), trknpt); - histos.fill(HIST("QA/before/trknpionDCAxy"), negDauTrack.dcaXY()); - histos.fill(HIST("QA/before/trknpionDCAz"), negDauTrack.dcaZ()); - - histos.fill(HIST("QA/before/hDauDCASecondary"), trkkDauDCA); - histos.fill(HIST("QA/before/hDauPosDCAtoPVSecondary"), trkkDauDCAPostoPV); - histos.fill(HIST("QA/before/hDauNegDCAtoPVSecondary"), trkkDauDCANegtoPV); - - histos.fill(HIST("QA/before/hpT_Secondary"), trkkpt); - histos.fill(HIST("QA/before/hy_Secondary"), trkky); - histos.fill(HIST("QA/before/hRadiusSecondary"), trkkRadius); - histos.fill(HIST("QA/before/hDCAtoPVSecondary"), trkkDCAtoPV); - histos.fill(HIST("QA/before/hCPASecondary"), trkkCPA); - histos.fill(HIST("QA/before/hPropTauSecondary"), trkkPropTau); - histos.fill(HIST("QA/before/hInvmassSecondary"), trkkMass); } if (!SecondaryCuts.cfgByPassDauPIDSelection && !selectionPIDPion(posDauTrack)) @@ -1075,46 +1055,49 @@ struct Chk892pp { continue; if constexpr (!IsMix) { - // Seconddary QA plots after applying cuts + if (cfgFillQAPlots) { + // Seconddary QA plots after applying cuts - histos.fill(HIST("QA/after/trkppionTPCPID"), trkppt, trkpNSigmaPiTPC); - if (istrkphasTOF) { - histos.fill(HIST("QA/after/trkppionTOFPID"), trkppt, trkpNSigmaPiTOF); - histos.fill(HIST("QA/after/trkppionTPCTOFPID"), trkpNSigmaPiTPC, trkpNSigmaPiTOF); - } - histos.fill(HIST("QA/after/trkppionpT"), trkppt); - histos.fill(HIST("QA/after/trkppionDCAxy"), posDauTrack.dcaXY()); - histos.fill(HIST("QA/after/trkppionDCAz"), posDauTrack.dcaZ()); - - histos.fill(HIST("QA/after/trknpionTPCPID"), trknpt, trknNSigmaPiTPC); - if (istrknhasTOF) { - histos.fill(HIST("QA/after/trknpionTOFPID"), trknpt, trknNSigmaPiTOF); - histos.fill(HIST("QA/after/trknpionTPCTOFPID"), trknNSigmaPiTPC, trknNSigmaPiTOF); + histos.fill(HIST("QA/after/trkppionTPCPID"), trkppt, trkpNSigmaPiTPC); + if (istrkphasTOF) { + histos.fill(HIST("QA/after/trkppionTOFPID"), trkppt, trkpNSigmaPiTOF); + histos.fill(HIST("QA/after/trkppionTPCTOFPID"), trkpNSigmaPiTPC, trkpNSigmaPiTOF); + } + histos.fill(HIST("QA/after/trkppionpT"), trkppt); + histos.fill(HIST("QA/after/trkppionDCAxy"), posDauTrack.dcaXY()); + histos.fill(HIST("QA/after/trkppionDCAz"), posDauTrack.dcaZ()); + + histos.fill(HIST("QA/after/trknpionTPCPID"), trknpt, trknNSigmaPiTPC); + if (istrknhasTOF) { + histos.fill(HIST("QA/after/trknpionTOFPID"), trknpt, trknNSigmaPiTOF); + histos.fill(HIST("QA/after/trknpionTPCTOFPID"), trknNSigmaPiTPC, trknNSigmaPiTOF); + } + histos.fill(HIST("QA/after/trknpionpT"), trknpt); + histos.fill(HIST("QA/after/trknpionDCAxy"), negDauTrack.dcaXY()); + histos.fill(HIST("QA/after/trknpionDCAz"), negDauTrack.dcaZ()); + + histos.fill(HIST("QA/after/hDauDCASecondary"), trkkDauDCA); + histos.fill(HIST("QA/after/hDauPosDCAtoPVSecondary"), trkkDauDCAPostoPV); + histos.fill(HIST("QA/after/hDauNegDCAtoPVSecondary"), trkkDauDCANegtoPV); + + histos.fill(HIST("QA/after/hpT_Secondary"), trkkpt); + histos.fill(HIST("QA/after/hy_Secondary"), trkky); + histos.fill(HIST("QA/after/hRadiusSecondary"), trkkRadius); + histos.fill(HIST("QA/after/hDCAtoPVSecondary"), trkkDCAtoPV); + histos.fill(HIST("QA/after/hCPASecondary"), trkkCPA); + histos.fill(HIST("QA/after/hPropTauSecondary"), trkkPropTau); + histos.fill(HIST("QA/after/hInvmassSecondary"), trkkMass); } - histos.fill(HIST("QA/after/trknpionpT"), trknpt); - histos.fill(HIST("QA/after/trknpionDCAxy"), negDauTrack.dcaXY()); - histos.fill(HIST("QA/after/trknpionDCAz"), negDauTrack.dcaZ()); - - histos.fill(HIST("QA/after/hDauDCASecondary"), trkkDauDCA); - histos.fill(HIST("QA/after/hDauPosDCAtoPVSecondary"), trkkDauDCAPostoPV); - histos.fill(HIST("QA/after/hDauNegDCAtoPVSecondary"), trkkDauDCANegtoPV); - - histos.fill(HIST("QA/after/hpT_Secondary"), trkkpt); - histos.fill(HIST("QA/after/hy_Secondary"), trkky); - histos.fill(HIST("QA/after/hRadiusSecondary"), trkkRadius); - histos.fill(HIST("QA/after/hDCAtoPVSecondary"), trkkDCAtoPV); - histos.fill(HIST("QA/after/hCPASecondary"), trkkCPA); - histos.fill(HIST("QA/after/hPropTauSecondary"), trkkPropTau); - histos.fill(HIST("QA/after/hInvmassSecondary"), trkkMass); histos.fill(HIST("hInvmass_K0s"), lCentrality, lResoSecondary.Pt(), lResoSecondary.M()); } k0sIndicies.push_back(k0sCand.index()); } for (const auto& trackIndex : trackIndicies) { + auto bTrack = dTracks1.rawIteratorAt(trackIndex); for (const auto& k0sIndex : k0sIndicies) { - auto bTrack = dTracks1.rawIteratorAt(trackIndex); auto k0sCand = dTracks2.rawIteratorAt(k0sIndex); + auto trkkMass = k0sCand.mK0Short(); lDecayDaughter_bach = LorentzVectorSetXYZM(bTrack.px(), bTrack.py(), bTrack.pz(), MassPionCharged); @@ -1123,8 +1106,10 @@ struct Chk892pp { // QA plots if constexpr (!IsMix) { - histos.fill(HIST("QA/before/KstarRapidity"), lResoKstar.Rapidity()); - histos.fill(HIST("QA/before/kstarinvmass"), lResoKstar.M()); + if (cfgFillQAPlots) { + histos.fill(HIST("QA/before/KstarRapidity"), lResoKstar.Rapidity()); + histos.fill(HIST("QA/before/kstarinvmass"), lResoKstar.M()); + } } if (lResoKstar.Rapidity() > KstarCuts.cfgKstarMaxRap || lResoKstar.Rapidity() < KstarCuts.cfgKstarMinRap) @@ -1132,15 +1117,19 @@ struct Chk892pp { if constexpr (!IsMix) { unsigned int typeKstar = bTrack.sign() > 0 ? BinType::kKstarP : BinType::kKstarN; + if (cfgFillQAPlots) { - histos.fill(HIST("QA/after/KstarRapidity"), lResoKstar.Rapidity()); - histos.fill(HIST("QA/after/kstarinvmass"), lResoKstar.M()); + histos.fill(HIST("QA/after/KstarRapidity"), lResoKstar.Rapidity()); + histos.fill(HIST("QA/after/kstarinvmass"), lResoKstar.M()); + } histos.fill(HIST("hInvmass_Kstar"), typeKstar, lCentrality, lResoKstar.Pt(), lResoKstar.M()); if (BkgEstimationConfig.cfgFillRotBkg) { for (int i = 0; i < BkgEstimationConfig.cfgNrotBkg; i++) { auto lRotAngle = BkgEstimationConfig.cfgMinRot + i * ((BkgEstimationConfig.cfgMaxRot - BkgEstimationConfig.cfgMinRot) / (BkgEstimationConfig.cfgNrotBkg - 1)); - histos.fill(HIST("QA/RotBkg/hRotBkg"), lRotAngle); + if (cfgFillQAPlots) { + histos.fill(HIST("QA/RotBkg/hRotBkg"), lRotAngle); + } if (BkgEstimationConfig.cfgRotPion) { lDaughterRot = lDecayDaughter_bach; // lDaughterRot.RotateZ(lRotAngle); @@ -1186,7 +1175,7 @@ struct Chk892pp { return; colCuts.fillQA(collision); - fillHistograms(collision, tracks, v0s); // second order + fillHistograms(collision, tracks, v0s); } PROCESS_SWITCH(Chk892pp, processData, "Process Event for data without Partitioning", false); @@ -1201,21 +1190,29 @@ struct Chk892pp { effK0sProcessReco(v0s); effKstarProcessGen(mcpart); effKstarProcessReco(v0s, tracks); + } + PROCESS_SWITCH(Chk892pp, processMC, "Process Event for MC", false); - for (auto const& collision : events) { - if (!collision.has_mcCollision()) - continue; - const auto mcid = collision.mcCollisionId(); + void processMCQA(MCEventCandidates::iterator const& collision, + MCTrackCandidates const& tracks, + MCV0Candidates const& v0s, + aod::BCsWithTimestamps const&) + { + if (!colCuts.isSelected(collision)) + return; + if (EventCuts.cfgEvtUseRCTFlagChecker && !rctChecker(collision)) + return; - auto it = centByMcIds.find(mcid); - if (it == centByMcIds.end()) - continue; + lCentrality = getCentrality(collision); + if (lCentrality < EventCuts.cfgEventCentralityMin || lCentrality > EventCuts.cfgEventCentralityMax) + return; + if (!collision.isInelGt0()) + return; + colCuts.fillQA(collision); - lCentrality = it->second; - fillHistograms(collision, tracks, v0s); - } + fillHistograms(collision, tracks, v0s); } - PROCESS_SWITCH(Chk892pp, processMC, "Process Event for MC", true); + PROCESS_SWITCH(Chk892pp, processMCQA, "Process Event for MC and fill QA plots", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From b777eb023f4998c742fd09083643945c6d05b5ae Mon Sep 17 00:00:00 2001 From: Zhengqing Wang Date: Mon, 13 Oct 2025 19:37:18 +0800 Subject: [PATCH 734/986] [PWGCF] update with FT0C q2 info (#13354) --- PWGCF/Flow/Tasks/flowEsePHe3.cxx | 61 ++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 11 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowEsePHe3.cxx b/PWGCF/Flow/Tasks/flowEsePHe3.cxx index 2a4955c1419..c23b179a616 100644 --- a/PWGCF/Flow/Tasks/flowEsePHe3.cxx +++ b/PWGCF/Flow/Tasks/flowEsePHe3.cxx @@ -64,6 +64,7 @@ DECLARE_SOA_COLUMN(EseCentFT0C, eseCentFT0C, float); DECLARE_SOA_COLUMN(EsePsi2FT0C, esePsi2FT0C, float); DECLARE_SOA_COLUMN(Eseq2Tar, eseq2Tar, float); DECLARE_SOA_COLUMN(Eseq2Ref, eseq2Ref, float); +DECLARE_SOA_COLUMN(Eseq2FT0C, eseq2FT0C, float); DECLARE_SOA_COLUMN(EseTarSign, eseTarSign, int8_t); DECLARE_SOA_COLUMN(EseTarTPCInnerParam, eseTarTPCInnerParam, float); DECLARE_SOA_COLUMN(EseTarTPCSignal, eseTarTPCSignal, float); @@ -88,6 +89,7 @@ DECLARE_SOA_TABLE(ESETable, "AOD", "ESETable", ese_var_table::EsePsi2FT0C, ese_var_table::Eseq2Tar, ese_var_table::Eseq2Ref, + ese_var_table::Eseq2FT0C, ese_var_table::EseTarSign, ese_var_table::EseTarTPCInnerParam, ese_var_table::EseTarTPCSignal, @@ -112,6 +114,7 @@ struct ESECandidate { float psi2FT0C; float q2Tar; float q2Ref; + float q2FT0C; int8_t signTar; float tpcInnerParamTar; float tpcSignalTar; @@ -297,16 +300,19 @@ std::shared_ptr hPIDQATar1D[12]; std::shared_ptr hPIDQATar2D[4]; std::shared_ptr hPIDQATar3D[3]; std::shared_ptr hv2Tar[2]; -std::shared_ptr hESEQATar1D[4]; -std::shared_ptr hESEQATar2D; +std::shared_ptr hESEQATar1D[8]; +std::shared_ptr hESEQATar2D[2]; std::shared_ptr hESETar; // Ref ptr std::shared_ptr hPIDQARef1D[12]; std::shared_ptr hPIDQARef2D[4]; std::shared_ptr hPIDQARef3D[3]; std::shared_ptr hv2Ref[2]; -std::shared_ptr hESEQARef1D[4]; -std::shared_ptr hESEQARef2D; +std::shared_ptr hESEQARef1D[8]; +std::shared_ptr hESEQARef2D[2]; +// FT0C general q2 QA +std::shared_ptr hESEQAFT0C1D[2]; +std::shared_ptr hESEQAFT0C2D[2]; } // namespace ese_parameters using TracksPIDFull = soa::Join; @@ -396,6 +402,7 @@ struct FlowEsePHe3 { ConfigurableAxis cfgaxisCent{"cfgaxisCent", {90, 0, 90}, ""}; ConfigurableAxis cfgaxisq2Tar{"cfgaxisq2Tar", {100, 0, 2}, "Binning for q_{2} traget particle"}; ConfigurableAxis cfgaxisq2Ref{"cfgaxisq2Ref", {120, 0, 12}, "Binning for q_{2} reference particle"}; + ConfigurableAxis cfgaxisq2FT0C{"cfgaxisq2FT0C", {900, 0, 900}, "Binning for q_{2} FT0C"}; ConfigurableAxis cfgq2NumeratorTar{"cfgq2NumeratorTar", {20, 0, 2}, "q2 Numerator bin for tar particle"}; ConfigurableAxis cfgq2NumeratorRef{"cfgq2NumeratorRef", {100, 0, 10}, "q2 Numerator bin for ref particle"}; ConfigurableAxis cfgq2DenominatorTar{"cfgq2DenominatorTar", {20, 0, 2}, "q2 Denominator bin for tar particle"}; @@ -962,6 +969,7 @@ struct FlowEsePHe3 { float psi2 = helperEP.GetEventPlane(collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], 2); float q2Tarinit{0.f}; float q2Refinit{0.f}; + float q2FT0Cinit{0.f}; for (const auto& track : tracks) { // loop on tracks if (!trackSelBasic(track)) { continue; @@ -1016,7 +1024,7 @@ struct FlowEsePHe3 { } } ese_parameters::eseCandidates.emplace_back(ESECandidate{ - collision.posZ(), collision.centFT0C(), psi2, q2Tarinit, q2Refinit, static_cast(track.sign()), correctedTpcInnerParam, track.tpcSignal(), ese_parameters::Charges[poiTar] * track.pt(), track.eta(), track.phi(), + collision.posZ(), collision.centFT0C(), psi2, q2Tarinit, q2Refinit, q2FT0Cinit, static_cast(track.sign()), correctedTpcInnerParam, track.tpcSignal(), ese_parameters::Charges[poiTar] * track.pt(), track.eta(), track.phi(), track.dcaXY(), track.dcaZ(), static_cast(track.tpcNClsFound()), track.itsNCls(), track.tpcChi2NCl(), track.itsChi2NCl(), nSigmaTPCTar, nSigmaTOFTar, nSigmaITSTar, track.itsClusterSizes()}); } @@ -1245,19 +1253,33 @@ struct FlowEsePHe3 { ese_parameters::hESEQATar1D[1] = histsESE.add(Form("ESE/ESEQA/hist_%sq2", cfgTarName.value.c_str()), ";#it{q}_{2};counts", HistType::kTH1F, {cfgaxisq2Tar}); ese_parameters::hESEQATar1D[2] = histsESE.add(Form("ESE/ESEQA/hist_%sq2Numerator", cfgTarName.value.c_str()), ";#it{q}_{2} numerator;counts", HistType::kTH1F, {cfgq2NumeratorTar}); ese_parameters::hESEQATar1D[3] = histsESE.add(Form("ESE/ESEQA/hist_%sq2Denominator", cfgTarName.value.c_str()), ";#it{q}_{2} denominator;counts", HistType::kTH1F, {cfgq2DenominatorTar}); - ese_parameters::hESEQATar2D = histsESE.add(Form("ESE/ESEQA/hist_%sq2_Cent", cfgTarName.value.c_str()), ";#it{q}_{2};Centrality (%)", HistType::kTH2F, {cfgaxisq2Tar, cfgaxisCent}); + ese_parameters::hESEQATar1D[4] = histsESE.add(Form("ESE/ESEQA/hist_%sNum_Survived", cfgTarName.value.c_str()), ";Num_{Proton}/Event;counts", HistType::kTH1F, {{100, 0, 100}}); + ese_parameters::hESEQATar1D[5] = histsESE.add(Form("ESE/ESEQA/hist_%sq2_Survived", cfgTarName.value.c_str()), ";#it{q}_{2};counts", HistType::kTH1F, {cfgaxisq2Tar}); + ese_parameters::hESEQATar1D[6] = histsESE.add(Form("ESE/ESEQA/hist_%sq2Numerator_Survived", cfgTarName.value.c_str()), ";#it{q}_{2} numerator;counts", HistType::kTH1F, {cfgq2NumeratorTar}); + ese_parameters::hESEQATar1D[7] = histsESE.add(Form("ESE/ESEQA/hist_%sq2Denominator_Survived", cfgTarName.value.c_str()), ";#it{q}_{2} denominator;counts", HistType::kTH1F, {cfgq2DenominatorTar}); + ese_parameters::hESEQATar2D[0] = histsESE.add(Form("ESE/ESEQA/hist_%sq2_Cent", cfgTarName.value.c_str()), ";#it{q}_{2};Centrality (%)", HistType::kTH2F, {cfgaxisq2Tar, cfgaxisCent}); + ese_parameters::hESEQATar2D[1] = histsESE.add(Form("ESE/ESEQA/hist_%sq2_Cent_Survived", cfgTarName.value.c_str()), ";#it{q}_{2};Centrality (%)", HistType::kTH2F, {cfgaxisq2Tar, cfgaxisCent}); ese_parameters::hESEQARef1D[0] = histsESE.add(Form("ESE/ESEQA/hist_%sNum", cfgRefName.value.c_str()), ";Num_{He3}/Event;counts", HistType::kTH1F, {{10, 0, 10}}); ese_parameters::hESEQARef1D[1] = histsESE.add(Form("ESE/ESEQA/hist_%sq2", cfgRefName.value.c_str()), ";#it{q}_{2};counts", HistType::kTH1F, {cfgaxisq2Ref}); ese_parameters::hESEQARef1D[2] = histsESE.add(Form("ESE/ESEQA/hist_%sq2Numerator", cfgRefName.value.c_str()), ";#it{q}_{2} numerator;counts", HistType::kTH1F, {cfgq2NumeratorRef}); ese_parameters::hESEQARef1D[3] = histsESE.add(Form("ESE/ESEQA/hist_%sq2Denominator", cfgRefName.value.c_str()), ";#it{q}_{2} denominator;counts", HistType::kTH1F, {cfgq2DenominatorRef}); - ese_parameters::hESEQARef2D = histsESE.add(Form("ESE/ESEQA/hist_%sq2_Cent", cfgRefName.value.c_str()), ";#it{q}_{2};Centrality (%)", HistType::kTH2F, {cfgaxisq2Ref, cfgaxisCent}); + ese_parameters::hESEQARef1D[4] = histsESE.add(Form("ESE/ESEQA/hist_%sNum_Survived", cfgRefName.value.c_str()), ";Num_{He3}/Event;counts", HistType::kTH1F, {{10, 0, 10}}); + ese_parameters::hESEQARef1D[5] = histsESE.add(Form("ESE/ESEQA/hist_%sq2_Survived", cfgRefName.value.c_str()), ";#it{q}_{2};counts", HistType::kTH1F, {cfgaxisq2Ref}); + ese_parameters::hESEQARef1D[6] = histsESE.add(Form("ESE/ESEQA/hist_%sq2Numerator_Survived", cfgRefName.value.c_str()), ";#it{q}_{2} numerator;counts", HistType::kTH1F, {cfgq2NumeratorRef}); + ese_parameters::hESEQARef1D[7] = histsESE.add(Form("ESE/ESEQA/hist_%sq2Denominator_Survived", cfgRefName.value.c_str()), ";#it{q}_{2} denominator;counts", HistType::kTH1F, {cfgq2DenominatorRef}); + ese_parameters::hESEQARef2D[0] = histsESE.add(Form("ESE/ESEQA/hist_%sq2_Cent", cfgRefName.value.c_str()), ";#it{q}_{2};Centrality (%)", HistType::kTH2F, {cfgaxisq2Ref, cfgaxisCent}); + ese_parameters::hESEQARef2D[1] = histsESE.add(Form("ESE/ESEQA/hist_%sq2_Cent_Survived", cfgRefName.value.c_str()), ";#it{q}_{2};Centrality (%)", HistType::kTH2F, {cfgaxisq2Ref, cfgaxisCent}); + ese_parameters::hESEQAFT0C1D[0] = histsESE.add("ESE/ESEQA/hist_q2FT0C", ";#it{q}_{2} (FT0C)", HistType::kTH1F, {cfgaxisq2FT0C}); + ese_parameters::hESEQAFT0C1D[1] = histsESE.add("ESE/ESEQA/hist_q2FT0C_Survived", ";#it{q}_{2} (FT0C)", HistType::kTH1F, {cfgaxisq2FT0C}); + ese_parameters::hESEQAFT0C2D[0] = histsESE.add("ESE/ESEQA/hist_q2FT0C_Cent", ";#it{q}_{2} (FT0C);Centrality (%)", HistType::kTH2F, {cfgaxisq2FT0C, cfgaxisCent}); + ese_parameters::hESEQAFT0C2D[1] = histsESE.add("ESE/ESEQA/hist_q2FT0C_Cent_Survived", ";#it{q}_{2} (FT0C);Centrality (%)", HistType::kTH2F, {cfgaxisq2FT0C, cfgaxisCent}); } if (cfgOpenESE) { ese_parameters::hESETar = histsESE.add(Form("ESE/ESE/histESE_%s", cfgTarName.value.c_str()), ";#it{p}_{T};Centrality (%);#it{q}_{2};cos(#phi-#Psi_{2});Charge", HistType::kTHnSparseF, {cfgaxispt, cfgaxisCent, cfgaxisq2Ref, axisCos, axisCharge}); } } - void process(soa::Filtered>::iterator const& collision, TracksPIDFull const& tracks) + void process(soa::Filtered>::iterator const& collision, TracksPIDFull const& tracks) { ese_parameters::eseCandidates.clear(); ese_parameters::eseReferences.clear(); @@ -1269,6 +1291,7 @@ struct FlowEsePHe3 { return; if (cfgOpenFullEventQA) fillEventQAhistAf(collision, multTrk, centrality); + float q2FT0C{std::sqrt(collision.qvecFT0CReVec()[0] * collision.qvecFT0CReVec()[0] + collision.qvecFT0CImVec()[0] * collision.qvecFT0CImVec()[0]) * std::sqrt(collision.sumAmplFT0C())}; float q2Tarx{0.}; float q2Tary{0.}; float q2Refx{0.}; @@ -1284,12 +1307,14 @@ struct FlowEsePHe3 { ese_parameters::hESEQATar1D[1]->Fill(q2Tar); ese_parameters::hESEQATar1D[2]->Fill(std::hypot(q2Tarx, q2Tary)); ese_parameters::hESEQATar1D[3]->Fill(std::sqrt(static_cast(multiTar))); - ese_parameters::hESEQATar2D->Fill(q2Tar, centrality); + ese_parameters::hESEQATar2D[0]->Fill(q2Tar, centrality); ese_parameters::hESEQARef1D[0]->Fill(multiRef); ese_parameters::hESEQARef1D[1]->Fill(q2Ref); - ese_parameters::hESEQARef2D->Fill(q2Ref, centrality); ese_parameters::hESEQARef1D[2]->Fill(std::hypot(q2Refx, q2Refy)); ese_parameters::hESEQARef1D[3]->Fill(std::sqrt(static_cast(multiRef))); + ese_parameters::hESEQARef2D[0]->Fill(q2Ref, centrality); + ese_parameters::hESEQAFT0C1D[0]->Fill(q2FT0C); + ese_parameters::hESEQAFT0C2D[0]->Fill(q2FT0C, centrality); } if (cfgOpenv2Ref) { for (const auto& c : ese_parameters::eseReferences) { @@ -1302,8 +1327,22 @@ struct FlowEsePHe3 { } if (multiTar == 0) return; + if (cfgOpenESEQA) { + ese_parameters::hESEQATar1D[4]->Fill(multiTar); + ese_parameters::hESEQATar1D[5]->Fill(q2Tar); + ese_parameters::hESEQATar1D[6]->Fill(std::hypot(q2Tarx, q2Tary)); + ese_parameters::hESEQATar1D[7]->Fill(std::sqrt(static_cast(multiTar))); + ese_parameters::hESEQATar2D[1]->Fill(q2Tar, centrality); + ese_parameters::hESEQARef1D[4]->Fill(multiRef); + ese_parameters::hESEQARef1D[5]->Fill(q2Ref); + ese_parameters::hESEQARef1D[6]->Fill(std::hypot(q2Refx, q2Refy)); + ese_parameters::hESEQARef1D[7]->Fill(std::sqrt(static_cast(multiRef))); + ese_parameters::hESEQARef2D[1]->Fill(q2Ref, centrality); + ese_parameters::hESEQAFT0C1D[1]->Fill(q2FT0C); + ese_parameters::hESEQAFT0C2D[1]->Fill(q2FT0C, centrality); + } for (const auto& c : ese_parameters::eseCandidates) { - eseTable(c.vtz, c.centFT0C, c.psi2FT0C, q2Tar, q2Ref, c.signTar, c.tpcInnerParamTar, c.tpcSignalTar, c.ptTar, c.etaTar, c.phiTar, c.dcaXYTar, c.dcaZTar, c.tpcNclsTar, c.itsNclsTar, c.tpcChi2NDFTar, c.itsChi2NDFTar, c.tpcNSigmaTar, c.tofNSigmaTar, c.itsNSigmaTar, c.itsClusSizeTar); + eseTable(c.vtz, c.centFT0C, c.psi2FT0C, q2Tar, q2Ref, q2FT0C, c.signTar, c.tpcInnerParamTar, c.tpcSignalTar, c.ptTar, c.etaTar, c.phiTar, c.dcaXYTar, c.dcaZTar, c.tpcNclsTar, c.itsNclsTar, c.tpcChi2NDFTar, c.itsChi2NDFTar, c.tpcNSigmaTar, c.tofNSigmaTar, c.itsNSigmaTar, c.itsClusSizeTar); if (cfgOpenESE) { ese_parameters::hESETar->Fill(c.ptTar, c.centFT0C, q2Ref, std::cos(2 * (c.phiTar - c.psi2FT0C)), c.signTar); } From f2e857adb0e00b177dfeeb77f259bb237c33885f Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Mon, 13 Oct 2025 14:30:57 +0200 Subject: [PATCH 735/986] [PWGEM/Dilepton] update pfb (#13358) --- PWGEM/Dilepton/Core/Dilepton.h | 20 ++++++++++---------- PWGEM/Dilepton/Core/DileptonMC.h | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 9595a43c493..14b0fab9e2d 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -191,7 +191,7 @@ struct Dilepton { Configurable cfg_require_diff_sides{"cfg_require_diff_sides", false, "flag to require 2 tracks are from different sides."}; Configurable cfg_apply_cuts_from_prefilter{"cfg_apply_cuts_from_prefilter", false, "flag to apply prefilter set when producing derived data"}; - Configurable cfg_prefilter_bits{"cfg_prefilter_bits", 0, "prefilter bits [kNone : 0, kElFromPC : 1, kElFromPi0_20MeV : 2, kElFromPi0_40MeV : 4, kElFromPi0_60MeV : 8, kElFromPi0_80MeV : 16, kElFromPi0_100MeV : 32, kElFromPi0_120MeV : 64, kElFromPi0_140MeV : 128] Please consider logical-OR among them."}; // see PairUtilities.h + Configurable cfg_prefilter_bits{"cfg_prefilter_bits", 0, "prefilter bits [kNone : 0, kElFromPC : 1, kElFromPi0_20MeV : 2, kElFromPi0_40MeV : 4, kElFromPi0_60MeV : 8, kElFromPi0_80MeV : 16, kElFromPi0_100MeV : 32, kElFromPi0_120MeV : 64, kElFromPi0_140MeV : 128] Please consider logical-OR among them."}; // see PairUtilities.h Configurable cfg_apply_cuts_from_prefilter_derived{"cfg_apply_cuts_from_prefilter_derived", false, "flag to apply pair cut same as prefilter set in derived data"}; Configurable cfg_prefilter_bits_derived{"cfg_prefilter_bits_derived", 0, "prefilter bits [kNone : 0, kMee : 1, kPhiV : 2, kSplitOrMergedTrackLS : 4, kSplitOrMergedTrackULS : 8] Please consider logical-OR among them."}; // see PairUtilities.h @@ -1158,15 +1158,15 @@ struct Dilepton { ifnode((dielectroncuts.cfg_prefilter_bits_derived.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackULS))) > static_cast(0), (o2::aod::emprimaryelectron::pfbderived & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackULS))) <= static_cast(0), true), o2::aod::emprimaryelectron::pfbderived >= static_cast(0)); - Filter prefilter_electron = ifnode(dielectroncuts.cfg_apply_cuts_from_prefilter.node() && dielectroncuts.cfg_prefilter_bits.node() >= static_cast(1), - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_20MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_20MeV))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_40MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_40MeV))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_60MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_60MeV))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_80MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_80MeV))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_100MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_100MeV))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_120MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_120MeV))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_140MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_140MeV))) <= static_cast(0), true), + Filter prefilter_electron = ifnode(dielectroncuts.cfg_apply_cuts_from_prefilter.node() && dielectroncuts.cfg_prefilter_bits.node() >= static_cast(1), + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_20MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_20MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_40MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_40MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_60MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_60MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_80MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_80MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_100MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_100MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_120MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_120MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_140MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_140MeV))) <= static_cast(0), true), o2::aod::emprimaryelectron::pfb >= static_cast(0)); Partition positive_electrons = o2::aod::emprimaryelectron::sign > int8_t(0); diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index cf2c0214f0b..16aba3b8991 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -186,7 +186,7 @@ struct DileptonMC { Configurable cfg_require_diff_sides{"cfg_require_diff_sides", false, "flag to require 2 tracks are from different sides."}; Configurable cfg_apply_cuts_from_prefilter{"cfg_apply_cuts_from_prefilter", false, "flag to apply prefilter set when producing derived data"}; - Configurable cfg_prefilter_bits{"cfg_prefilter_bits", 0, "prefilter bits [kNone : 0, kElFromPC : 1, kElFromPi0_20MeV : 2, kElFromPi0_40MeV : 4, kElFromPi0_60MeV : 8, kElFromPi0_80MeV : 16, kElFromPi0_100MeV : 32, kElFromPi0_120MeV : 64, kElFromPi0_140MeV : 128] Please consider logical-OR among them."}; // see PairUtilities.h + Configurable cfg_prefilter_bits{"cfg_prefilter_bits", 0, "prefilter bits [kNone : 0, kElFromPC : 1, kElFromPi0_20MeV : 2, kElFromPi0_40MeV : 4, kElFromPi0_60MeV : 8, kElFromPi0_80MeV : 16, kElFromPi0_100MeV : 32, kElFromPi0_120MeV : 64, kElFromPi0_140MeV : 128] Please consider logical-OR among them."}; // see PairUtilities.h Configurable cfg_apply_cuts_from_prefilter_derived{"cfg_apply_cuts_from_prefilter_derived", false, "flag to apply phiv cut inherited from prefilter"}; Configurable cfg_prefilter_bits_derived{"cfg_prefilter_bits_derived", 0, "prefilter bits [kNone : 0, kMee : 1, kPhiV : 2, kSplitOrMergedTrackLS : 4, kSplitOrMergedTrackULS : 8] Please consider logical-OR among them."}; // see PairUtilities.h @@ -1277,15 +1277,15 @@ struct DileptonMC { ifnode((dielectroncuts.cfg_prefilter_bits_derived.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackULS))) > static_cast(0), (o2::aod::emprimaryelectron::pfbderived & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackULS))) <= static_cast(0), true), o2::aod::emprimaryelectron::pfbderived >= static_cast(0)); - Filter prefilter_electron = ifnode(dielectroncuts.cfg_apply_cuts_from_prefilter.node() && dielectroncuts.cfg_prefilter_bits.node() >= static_cast(1), - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_20MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_20MeV))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_40MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_40MeV))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_60MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_60MeV))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_80MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_80MeV))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_100MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_100MeV))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_120MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_120MeV))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_140MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_140MeV))) <= static_cast(0), true), + Filter prefilter_electron = ifnode(dielectroncuts.cfg_apply_cuts_from_prefilter.node() && dielectroncuts.cfg_prefilter_bits.node() >= static_cast(1), + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_20MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_20MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_40MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_40MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_60MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_60MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_80MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_80MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_100MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_100MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_120MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_120MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_140MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_140MeV))) <= static_cast(0), true), o2::aod::emprimaryelectron::pfb >= static_cast(0)); Preslice perCollision_muon = aod::emprimarymuon::emeventId; From 9640428bb78c01e133aa09bcf741bef39fbc74f3 Mon Sep 17 00:00:00 2001 From: alcaliva <32872606+alcaliva@users.noreply.github.com> Date: Mon, 13 Oct 2025 15:22:50 +0200 Subject: [PATCH 736/986] [PWGLF] Reduce MC memory usage: reuse vectors per event and shrink every 1000 events (#13342) --- PWGLF/Tasks/Nuspex/antinucleiInJets.cxx | 51 ++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 6 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx index 4c26eb5e2d8..29473a44283 100644 --- a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx +++ b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx @@ -151,6 +151,9 @@ struct AntinucleiInJets { Configurable weightsXi{"weightsXi", "", "weightsXi"}; Configurable weightsOmega{"weightsOmega", "", "weightsOmega"}; + // Number of events + Configurable shrinkInterval{"shrinkInterval", 1000, "variable that controls how often shrinking happens"}; + // Reweighting histograms TH1F* primaryAntiprotons; TH1F* primaryAntiLambda; @@ -1616,9 +1619,23 @@ struct AntinucleiInJets { // Generated events void processJetsMCgen(GenCollisionsMc const& collisions, aod::McParticles const& mcParticles) { + // Define per-event particle containers + std::vector fjParticles; + std::vector protonMomentum; + + // Event counter + int eventCounter = 0; + // Loop over all simulated collisions for (const auto& collision : collisions) { + // Increment event counter + eventCounter++; + + // Clear containers at the start of the event loop + fjParticles.clear(); + protonMomentum.clear(); + // Event counter: before event selection registryMC.fill(HIST("genEvents"), 0.5); @@ -1629,9 +1646,7 @@ struct AntinucleiInJets { // Event counter: after event selection registryMC.fill(HIST("genEvents"), 1.5); - // Loop over all MC particles - std::vector fjParticles; - std::vector protonMomentum; + // Loop over MC particles for (const auto& particle : mcParticles) { // Select physical primaries within acceptance @@ -1644,7 +1659,7 @@ struct AntinucleiInJets { // Store 3-momentum vectors of antiprotons for further analysis if (particle.pdgCode() == PDG_t::kProtonBar) { TVector3 pVec(particle.px(), particle.py(), particle.pz()); - protonMomentum.push_back(pVec); + protonMomentum.emplace_back(pVec); } // 4-momentum representation of a particle @@ -1754,6 +1769,12 @@ struct AntinucleiInJets { if (isAtLeastOneJetSelected) { registryMC.fill(HIST("genEvents"), 3.5); } + + // Shrink large vectors + if (eventCounter % shrinkInterval == 0) { + fjParticles.shrink_to_fit(); + protonMomentum.shrink_to_fit(); + } } } PROCESS_SWITCH(AntinucleiInJets, processJetsMCgen, "process jets mc gen", false); @@ -1761,9 +1782,23 @@ struct AntinucleiInJets { // Reconstructed events void processJetsMCrec(RecCollisionsMc const& collisions, AntiNucleiTracksMc const& mcTracks, McParticles const&) { + // Define per-event containers + std::vector fjParticles; + std::vector antiprotonTrackIndex; + + // Event counter + int eventCounter = 0; + // Loop over all reconstructed collisions for (const auto& collision : collisions) { + // Increment event counter + eventCounter++; + + // Clear containers at the start of the event loop + fjParticles.clear(); + antiprotonTrackIndex.clear(); + // Event counter: before event selection registryMC.fill(HIST("recEvents"), 0.5); @@ -1806,8 +1841,6 @@ struct AntinucleiInJets { // Loop over reconstructed tracks int id(-1); - std::vector fjParticles; - std::vector antiprotonTrackIndex; for (auto const& track : mcTracks) { id++; @@ -2028,6 +2061,12 @@ struct AntinucleiInJets { if (isAtLeastOneJetSelected) { registryMC.fill(HIST("recEvents"), 9.5); } + + // Shrink large vectors + if (eventCounter % shrinkInterval == 0) { + fjParticles.shrink_to_fit(); + antiprotonTrackIndex.shrink_to_fit(); + } } } PROCESS_SWITCH(AntinucleiInJets, processJetsMCrec, "process jets MC rec", false); From 28dfc98fd1291d0a89d27a263fbd854f72d2b298 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?BiaoZhang=20=28=E5=BC=A0=E5=BD=AA=29?= <52267892+zhangbiao-phy@users.noreply.github.com> Date: Mon, 13 Oct 2025 16:26:18 +0200 Subject: [PATCH 737/986] [PWGHF] loose the FIT amplitude threshold for UPC event pre-selection (#13367) --- PWGHF/Utils/utilsEvSelHf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index cda1d9f9766..b51fe9423a3 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -215,7 +215,7 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { sgCuts.SetMaxFITtime(34.f); // Maximum FIT time in ns // Set FIT amplitudes: FV0, FT0A, FT0C, FDDA, FDDC - sgCuts.SetFITAmpLimits({-1.f, 150.f, 50.f, -1.f, -1.f}); + sgCuts.SetFITAmpLimits({-1.f, 1000.f, 1000.f, -1.f, -1.f}); return sgCuts; } From 894709ed615eda71a91816b6b2fb21ef04b6c282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20L=C3=B6mker?= Date: Mon, 13 Oct 2025 17:03:11 +0200 Subject: [PATCH 738/986] [PWGJE] Substructure analysis for formationtime reclustering (#13327) Co-authored-by: ALICE Action Bot --- PWGJE/Tasks/CMakeLists.txt | 4 + PWGJE/Tasks/jetFormationTimeReclustering.cxx | 436 +++++++++++++++++++ 2 files changed, 440 insertions(+) create mode 100644 PWGJE/Tasks/jetFormationTimeReclustering.cxx diff --git a/PWGJE/Tasks/CMakeLists.txt b/PWGJE/Tasks/CMakeLists.txt index f23f26b7ad5..7aab726fbf1 100644 --- a/PWGJE/Tasks/CMakeLists.txt +++ b/PWGJE/Tasks/CMakeLists.txt @@ -330,6 +330,10 @@ if(FastJet_FOUND) SOURCES jetShape.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-formationtimereclustering + SOURCES jetFormationTimeReclustering.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) endif() if(pythia_FOUND) diff --git a/PWGJE/Tasks/jetFormationTimeReclustering.cxx b/PWGJE/Tasks/jetFormationTimeReclustering.cxx new file mode 100644 index 00000000000..6e1b4fcc859 --- /dev/null +++ b/PWGJE/Tasks/jetFormationTimeReclustering.cxx @@ -0,0 +1,436 @@ +// 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. + +// jet analysis tasks (subscribing to jet finder task) +// +/// \author Morgan Knuesel & Johanna Lömker +// + +//********************************************************* +// * +// Table definitions * +// * +//********************************************************* + +#ifndef PWGJE_TASKS_JETFORMATIONTIMERECLUSTERING_H_ +#define PWGJE_TASKS_JETFORMATIONTIMERECLUSTERING_H_ + +#include "PWGDQ/DataModel/ReducedInfoTables.h" +#include "PWGHF/DataModel/DerivedTables.h" +#include "PWGJE/DataModel/Jet.h" // IWYU pragma: keep +#include "PWGJE/DataModel/JetReducedData.h" +#include "PWGJE/DataModel/JetReducedDataDQ.h" + +#include + +#include +#include +#include + +namespace o2::aod +{ + +namespace jetcollision +{ //! +DECLARE_SOA_COLUMN(PosZ, posZ, float); //! +DECLARE_SOA_COLUMN(Centrality, centrality, float); //! +DECLARE_SOA_COLUMN(EventSel, eventSel, uint8_t); //! +DECLARE_SOA_COLUMN(EventWeight, eventWeight, float); //! +} // namespace jetcollision + +namespace jetmccollision +{ +DECLARE_SOA_COLUMN(PosZ, posZ, float); //! +DECLARE_SOA_COLUMN(Accepted, accepted, uint64_t); //! +DECLARE_SOA_COLUMN(Attempted, attempted, uint64_t); //! +DECLARE_SOA_COLUMN(XsectGen, xsectGen, float); //! +DECLARE_SOA_COLUMN(XsectErr, xsectErr, float); //! +DECLARE_SOA_COLUMN(EventWeight, eventWeight, float); //! +} // namespace jetmccollision + +namespace jetsubstructure +{ //! +DECLARE_SOA_COLUMN(EnergyMother, energyMother, std::vector); //! +DECLARE_SOA_COLUMN(PtLeading, ptLeading, std::vector); //! +DECLARE_SOA_COLUMN(PtSubLeading, ptSubLeading, std::vector); //! +DECLARE_SOA_COLUMN(Theta, theta, std::vector); //! +DECLARE_SOA_COLUMN(PtLeadingConstituent, ptLeadingConstituent, float); //! +DECLARE_SOA_COLUMN(TauForm, tauForm, std::vector); //! + +DECLARE_SOA_COLUMN(Z, z, std::vector); //! +DECLARE_SOA_COLUMN(Ptg, ptg, std::vector); //! +DECLARE_SOA_COLUMN(Thetag, thetag, std::vector); //! +DECLARE_SOA_COLUMN(Zg, zg, std::vector); //! +DECLARE_SOA_COLUMN(TauFormg, tauFormg, std::vector); //! + //! +} // namespace jetsubstructure + +namespace splitting +{ //! +DECLARE_SOA_COLUMN(Pt, pt, float); //! +DECLARE_SOA_COLUMN(Eta, eta, float); //! +DECLARE_SOA_COLUMN(Phi, phi, float); //! +DECLARE_SOA_COLUMN(R, r, int); //! +DECLARE_SOA_COLUMN(SplittingMatchingGeo, splittingMatchingGeo, std::vector); //! +DECLARE_SOA_COLUMN(SplittingMatchingPt, splittingMatchingPt, std::vector); //! +DECLARE_SOA_COLUMN(SplittingMatchingHF, splittingMatchingHF, std::vector); //! +} // namespace splitting + +// Defines the jet table definition +#define JETSPLITTING_TABLE_DEF(_jet_type_, _jet_description_, _name_, _track_type_, _cand_type_) \ + \ + namespace _name_##splitting \ + { \ + DECLARE_SOA_INDEX_COLUMN(_jet_type_##Jet, jet); \ + } \ + namespace _name_##splittingconstituents \ + { \ + DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL(Tracks, tracks, int32_t, _track_type_, "_tracks"); \ + DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL(Clusters, clusters, int32_t, JClusters, "_clusters"); \ + DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL(Candidates, candidates, int32_t, _cand_type_, "_cand"); \ + } \ + DECLARE_SOA_TABLE(_jet_type_##SPs, "AOD", _jet_description_ "SP", \ + o2::soa::Index<>, \ + _name_##splitting::_jet_type_##JetId, \ + _name_##splittingconstituents::TracksIds, \ + _name_##splittingconstituents::ClustersIds, \ + _name_##splittingconstituents::CandidatesIds, \ + splitting::Pt, \ + splitting::Eta, \ + splitting::Phi, \ + splitting::R); + +namespace jetoutput +{ +DECLARE_SOA_COLUMN(JetPt, jetPt, float); //! +DECLARE_SOA_COLUMN(JetPhi, jetPhi, float); //! +DECLARE_SOA_COLUMN(JetEta, jetEta, float); //! +DECLARE_SOA_COLUMN(JetY, jetY, float); //! +DECLARE_SOA_COLUMN(JetR, jetR, float); //! +DECLARE_SOA_COLUMN(JetArea, jetArea, float); //! +DECLARE_SOA_COLUMN(JetRho, jetRho, float); //! +DECLARE_SOA_COLUMN(JetPerpConeRho, jetPerpConeRho, float); //! +DECLARE_SOA_COLUMN(JetNConstituents, jetNConstituents, int); //! +} // namespace jetoutput + +#define MCCOLL_TABLE_DEF(_jet_type_, _jet_description_, _name_) \ + namespace _name_##mccollisionoutput \ + { \ + DECLARE_SOA_DYNAMIC_COLUMN(Dummy##_jet_type_, dummy##_jet_type_, []() -> int { return 0; }); \ + } \ + DECLARE_SOA_TABLE(_jet_type_##MCCOs, "AOD", _jet_description_ "MCCO", \ + jetmccollision::PosZ, \ + jetmccollision::Accepted, \ + jetmccollision::Attempted, \ + jetmccollision::XsectGen, \ + jetmccollision::XsectErr, \ + jetmccollision::EventWeight, \ + _name_##mccollisionoutput::Dummy##_jet_type_<>); + +// Defines the jet substrcuture table definition +#define JETSUBSTRUCTURE_TABLE_DEF(_jet_type_, _jet_description_, _name_, _cand_type_, _cand_description_) \ + \ + namespace _name_##collisionoutput \ + { \ + DECLARE_SOA_DYNAMIC_COLUMN(Dummy##_jet_type_, dummy##_jet_type_, []() -> int { return 0; }); \ + } \ + \ + DECLARE_SOA_TABLE(_jet_type_##COs, "AOD", _jet_description_ "CO", jetcollision::PosZ, jetcollision::Centrality, jetcollision::EventSel, jetcollision::EventWeight, _name_##collisionoutput::Dummy##_jet_type_<>); \ + using _jet_type_##CO = _jet_type_##COs::iterator; \ + \ + namespace _name_##jetoutput \ + { \ + DECLARE_SOA_INDEX_COLUMN_CUSTOM(_jet_type_##CO, collision, _jet_description_ "COS"); \ + DECLARE_SOA_INDEX_COLUMN_FULL_CUSTOM(Candidate, candidate, int, _cand_type_, _cand_description_ "S", "_0"); \ + } \ + DECLARE_SOA_TABLE(_jet_type_##Os, "AOD", _jet_description_ "O", _name_##jetoutput::_jet_type_##COId, _name_##jetoutput::CandidateId, jetoutput::JetPt, jetoutput::JetPhi, jetoutput::JetEta, jetoutput::JetY, jetoutput::JetR, jetoutput::JetArea, jetoutput::JetRho, jetoutput::JetPerpConeRho, jetoutput::JetNConstituents); \ + using _jet_type_##O = _jet_type_##Os::iterator; \ + namespace _name_##substructure \ + { \ + DECLARE_SOA_INDEX_COLUMN_CUSTOM(_jet_type_##O, outputTable, _jet_description_ "OS"); \ + DECLARE_SOA_DYNAMIC_COLUMN(Dummy##_jet_type_, dummy##_jet_type_, []() -> int { return 0; }); \ + } \ + DECLARE_SOA_TABLE(_jet_type_##SSs, "AOD", _jet_description_ "SS", jetoutput::JetPt, jetoutput::JetPhi, jetoutput::JetEta, jetsubstructure::EnergyMother, jetsubstructure::PtLeading, jetsubstructure::PtSubLeading, jetsubstructure::Theta, jetsubstructure::PtLeadingConstituent, jetsubstructure::TauForm, jetsubstructure::Z, jetsubstructure::Ptg, jetsubstructure::Thetag, jetsubstructure::Zg, jetsubstructure::TauFormg, _name_##substructure::Dummy##_jet_type_<>); \ + DECLARE_SOA_TABLE(_jet_type_##SSOs, "AOD", _jet_description_ "SSO", _name_##substructure::_jet_type_##OId, jetoutput::JetPt, jetoutput::JetPhi, jetoutput::JetEta, jetsubstructure::EnergyMother, jetsubstructure::PtLeading, jetsubstructure::PtSubLeading, jetsubstructure::Theta, jetsubstructure::PtLeadingConstituent, jetsubstructure::TauForm, jetsubstructure::Z, jetsubstructure::Ptg, jetsubstructure::Thetag, jetsubstructure::Zg, jetsubstructure::TauFormg); \ + \ + using _jet_type_##O = _jet_type_##Os::iterator; \ + using _jet_type_##SSO = _jet_type_##SSOs::iterator; + +#define JETSUBSTRUCTURE_TABLES_DEF(_jet_type_, _jet_description_, _jet_type_full_, _jet_full_description_, _track_type_data_, _cand_type_data_, _cand_description_data_, _track_type_ewsdata_, _cand_type_ewsdata_, _cand_description_ewsdata_, _track_type_mcd_, _cand_type_mcd_, _cand_description_mcd_, _particle_type_, _hfparticle_type_, _hfparticle_description_) \ + JETSUBSTRUCTURE_TABLE_DEF(_jet_type_##Jet, _jet_description_ "JET", _jet_type_##jet, _cand_type_data_, _cand_description_data_) \ + JETSUBSTRUCTURE_TABLE_DEF(_jet_type_##EWSJet, _jet_description_ "EWSJET", _jet_type_##ewsjet, _cand_type_ewsdata_, _cand_description_ewsdata_) \ + JETSPLITTING_TABLE_DEF(_jet_type_full_, _jet_description_, _jet_full_description_, _track_type_data_, _cand_type_data_) \ + JETSPLITTING_TABLE_DEF(_jet_type_full_##EventWiseSubtracted, _jet_description_ "EWS", _jet_full_description_##eventwisesubtracted, _cand_type_ewsdata_, _cand_type_ewsdata_) \ + JETSUBSTRUCTURE_TABLE_DEF(_jet_type_##MCDJet, _jet_description_ "MCDJET", _jet_type_##mcdjet, _cand_type_mcd_, _cand_description_mcd_) \ + JETSUBSTRUCTURE_TABLE_DEF(_jet_type_##MCPJet, _jet_description_ "MCPJET", _jet_type_##mcpjet, _hfparticle_type_, _hfparticle_description_) \ + MCCOLL_TABLE_DEF(_jet_type_##MCPJet, _jet_description_ "MCPJET", _jet_type_##mcpjet) \ + JETSPLITTING_TABLE_DEF(_jet_type_full_##MCDetectorLevel, _jet_description_ "D", _jet_full_description_##mcdetectorlevel, _track_type_mcd_, _cand_type_mcd_) \ + JETSPLITTING_TABLE_DEF(_jet_type_full_##MCParticleLevel, _jet_description_ "P", _jet_full_description_##mcparticlelevel, _particle_type_, _hfparticle_type_) + +JETSUBSTRUCTURE_TABLES_DEF(C, "C", Charged, charged, JTracks, CJetCOs, "CJETCO", JTrackSubs, CEWSJetCOs, "CEWSJETCO", JTracks, CMCDJetCOs, "CMCDJETCO", JMcParticles, CMCPJetCOs, "CMCPJETCO"); + +} // namespace o2::aod + +#endif // PWGJE_DATAMODEL_JETFORMATIONTIMERECLUSTERING_H_ + +//********************************************************* +// * +// Begin of the task * +// * +//********************************************************* + +#include "PWGJE/Core/FastJetUtilities.h" +#include "PWGJE/Core/JetFinder.h" +#include "PWGJE/Core/JetSubstructureUtilities.h" +#include "PWGJE/Core/JetUtilities.h" + +#include "Framework/ASoA.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include +#include +#include +#include +#include + +#include + +#include "fastjet/ClusterSequenceArea.hh" +#include "fastjet/PseudoJet.hh" +#include + +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +struct FormationTimeReclustering { + + Produces jetSubstructureDataTable; + Produces jetSubstructureMCDTable; + Produces jetSubstructureMCPTable; + Produces jetSubstructureDataSubTable; + + Produces jetSplittingsDataTable; + Produces jetSplittingsMCDTable; + Produces jetSplittingsMCPTable; + Produces jetSplittingsDataSubTable; + + Configurable zCut{"zCut", 0.1, "soft drop z cut"}; + Configurable beta{"beta", 0.0, "soft drop beta"}; + Configurable genKTp{"genKTp", 0., "select p value for generalized kT alogrithm"}; // CA: p=0, tau: p=0.5 + + Service pdg; + std::vector jetConstituents; + std::vector jetReclustered; + JetFinder jetReclusterer; + + std::vector energyMotherVec; + std::vector ptLeadingVec; + std::vector ptSubLeadingVec; + std::vector thetaVec; + std::vector zVec; + std::vector tauFormVec; + + // groomed vectors: + std::vector ptgVec; + std::vector thetagVec; + std::vector zgVec; + std::vector taugVec; + + float leadingConstituentPt; + float ptJet; + float phiJet; + float etaJet; + HistogramRegistry registry; + + void init(InitContext const&) + { + registry.add("h2_jet_pt_jet_zg", ";#it{p}_{T,jet} (GeV/#it{c});#it{z}_{g}", {HistType::kTH2F, {{200, 0., 200.}, {22, 0.0, 1.1}}}); + registry.add("h2_jet_pt_jet_rg", ";#it{p}_{T,jet} (GeV/#it{c});#it{R}_{g}", {HistType::kTH2F, {{200, 0., 200.}, {22, 0.0, 1.1}}}); + registry.add("h2_jet_pt_jet_tg", ";#it{p}_{T,jet} (GeV/#it{c});#it{#tau}_{g} (fm/#it{c})", {HistType::kTH2F, {{200, 0., 200.}, {20, 0.0, 10}}}); + registry.add("h2_jet_pt_jet_nsd", ";#it{p}_{T,jet} (GeV/#it{c});#it{n}_{SD}", {HistType::kTH2F, {{200, 0., 200.}, {15, -0.5, 14.5}}}); + + registry.add("h2_jet_pt_part_jet_zg_part", ";#it{p}_{T,jet}^{part} (GeV/#it{c});#it{z}_{g}^{part}", {HistType::kTH2F, {{200, 0., 200.}, {22, 0.0, 1.1}}}); + registry.add("h2_jet_pt_part_jet_rg_part", ";#it{p}_{T,jet}^{part} (GeV/#it{c});#it{R}_{g}^{part}", {HistType::kTH2F, {{200, 0., 200.}, {22, 0.0, 1.1}}}); + registry.add("h2_jet_pt_part_jet_tg_part", ";#it{p}_{T,jet}^{part} (GeV/#it{c});#it{#tau}_{g}^{part} (fm/#it{c})", {HistType::kTH2F, {{200, 0., 200.}, {20, 0.0, 10}}}); + registry.add("h2_jet_pt_part_jet_nsd_part", ";#it{p}_{T,jet}^{part} (GeV/#it{c});#it{n}_{SD}^{part}", {HistType::kTH2F, {{200, 0., 200.}, {15, -0.5, 14.5}}}); + + registry.add("h2_jet_pt_jet_zg_eventwiseconstituentsubtracted", ";#it{p}_{T,jet} (GeV/#it{c});#it{z}_{g}", {HistType::kTH2F, {{200, 0., 200.}, {22, 0.0, 1.1}}}); + registry.add("h2_jet_pt_jet_rg_eventwiseconstituentsubtracted", ";#it{p}_{T,jet} (GeV/#it{c});#it{R}_{g}", {HistType::kTH2F, {{200, 0., 200.}, {22, 0.0, 1.1}}}); + registry.add("h2_jet_pt_jet_tg_eventwiseconstituentsubtracted", ";#it{p}_{T,jet} (GeV/#it{c});#it{#tau}_{g} (fm/#it{c})", {HistType::kTH2F, {{200, 0., 200.}, {20, 0.0, 10}}}); + registry.add("h2_jet_pt_jet_nsd_eventwiseconstituentsubtracted", ";#it{p}_{T,jet} (GeV/#it{c});#it{n}_{SD}", {HistType::kTH2F, {{200, 0., 200.}, {15, -0.5, 14.5}}}); + + jetReclusterer.isReclustering = true; + jetReclusterer.fastjetExtraParam = genKTp; // in jetfinder we use p = -1 for anti kt jetfinding. Then we do time recl. with p=0.5, kt p =1, ca p=0 + jetReclusterer.algorithm = fastjet::JetAlgorithm::genkt_algorithm; // gen kt is enum 3 in jetfinder setup + } + + Preslice TracksPerCollision = aod::jtrack::collisionId; + Preslice TracksPerCollisionDataSub = aod::bkgcharged::collisionId; + Preslice ParticlesPerMcCollision = aod::jmcparticle::mcCollisionId; + + template + void jetReclustering(T const& jet, U& splittingTable) + { + energyMotherVec.clear(); + ptLeadingVec.clear(); + ptSubLeadingVec.clear(); + thetaVec.clear(); + jetReclustered.clear(); + tauFormVec.clear(); + zVec.clear(); + // groomed + ptgVec.clear(); + thetagVec.clear(); + zgVec.clear(); + taugVec.clear(); + + fastjet::ClusterSequenceArea clusterSeq(jetReclusterer.findJets(jetConstituents, jetReclustered)); + jetReclustered = sorted_by_pt(jetReclustered); + fastjet::PseudoJet daughterSubJet = jetReclustered[0]; + fastjet::PseudoJet parentSubJet1; + fastjet::PseudoJet parentSubJet2; + bool softDropped = false; + auto nsd = 0.0; + auto zg = -1.0; + auto rg = -1.0; + auto tg = -1.0; + + while (daughterSubJet.has_parents(parentSubJet1, parentSubJet2)) { + if (parentSubJet1.perp() < parentSubJet2.perp()) { + std::swap(parentSubJet1, parentSubJet2); + } + std::vector tracks; + std::vector candidates; + std::vector clusters; + for (const auto& constituent : sorted_by_pt(parentSubJet2.constituents())) { + if (constituent.template user_info().getStatus() == static_cast(JetConstituentStatus::track)) { + tracks.push_back(constituent.template user_info().getIndex()); + } + } + splittingTable(jet.globalIndex(), tracks, clusters, candidates, parentSubJet2.perp(), parentSubJet2.eta(), parentSubJet2.phi(), 0); + auto z = parentSubJet2.perp() / (parentSubJet1.perp() + parentSubJet2.perp()); + auto theta = parentSubJet1.delta_R(parentSubJet2); + auto tau = (parentSubJet1.perp() + parentSubJet2.perp()) / (parentSubJet1.perp() * parentSubJet2.perp() * theta * theta); // as in run2 aliphysics + energyMotherVec.push_back(daughterSubJet.e()); + ptLeadingVec.push_back(parentSubJet1.pt()); + ptSubLeadingVec.push_back(parentSubJet2.pt()); + thetaVec.push_back(theta); + tauFormVec.push_back(tau); + zVec.push_back(z); + + if (z >= zCut * TMath::Power(theta / (jet.r() / 100.f), beta)) { + if (!softDropped) { + zg = z; + rg = theta; + tg = tau; + ptgVec.push_back(jet.pt()); + thetagVec.push_back(rg); + taugVec.push_back(tg); + zgVec.push_back(zg); + if constexpr (!isSubtracted && !isMCP) { + registry.fill(HIST("h2_jet_pt_jet_zg"), jet.pt(), zg); + registry.fill(HIST("h2_jet_pt_jet_rg"), jet.pt(), rg); + registry.fill(HIST("h2_jet_pt_jet_tg"), jet.pt(), tg); + } + if constexpr (!isSubtracted && isMCP) { + registry.fill(HIST("h2_jet_pt_part_jet_zg_part"), jet.pt(), zg); + registry.fill(HIST("h2_jet_pt_part_jet_rg_part"), jet.pt(), rg); + registry.fill(HIST("h2_jet_pt_part_jet_tg_part"), jet.pt(), tg); + } + if constexpr (isSubtracted && !isMCP) { + registry.fill(HIST("h2_jet_pt_jet_zg_eventwiseconstituentsubtracted"), jet.pt(), zg); + registry.fill(HIST("h2_jet_pt_jet_rg_eventwiseconstituentsubtracted"), jet.pt(), rg); + registry.fill(HIST("h2_jet_pt_jet_tg_eventwiseconstituentsubtracted"), jet.pt(), tg); + } + softDropped = true; + } + nsd++; + } + daughterSubJet = parentSubJet1; + } + if constexpr (!isSubtracted && !isMCP) { + registry.fill(HIST("h2_jet_pt_jet_nsd"), jet.pt(), nsd); + } + if constexpr (!isSubtracted && isMCP) { + registry.fill(HIST("h2_jet_pt_part_jet_nsd_part"), jet.pt(), nsd); + } + if constexpr (isSubtracted && !isMCP) { + registry.fill(HIST("h2_jet_pt_jet_nsd_eventwiseconstituentsubtracted"), jet.pt(), nsd); + } + } + + template + void analyseCharged(T const& jet, U const&, V const&, M& outputTable, N& splittingTable) + { + jetConstituents.clear(); + ptJet = jet.pt(); + phiJet = jet.phi(); + etaJet = jet.eta(); + for (auto& jetConstituent : jet.template tracks_as()) { + fastjetutilities::fillTracks(jetConstituent, jetConstituents, jetConstituent.globalIndex()); + } + jetReclustering(jet, splittingTable); + outputTable(ptJet, phiJet, etaJet, energyMotherVec, ptLeadingVec, ptSubLeadingVec, thetaVec, leadingConstituentPt, tauFormVec, zVec, ptgVec, thetagVec, zgVec, taugVec); + } + + void processDummy(aod::JetTracks const&) + { + } + PROCESS_SWITCH(FormationTimeReclustering, processDummy, "Dummy process function turned on by default", true); + + void processChargedJetsData(soa::Join::iterator const& jet, + aod::JetTracks const& tracks) + { + analyseCharged(jet, tracks, TracksPerCollision, jetSubstructureDataTable, jetSplittingsDataTable); + } + PROCESS_SWITCH(FormationTimeReclustering, processChargedJetsData, "charged jet substructure", false); + + void processChargedJetsEventWiseSubData(soa::Join::iterator const& jet, + aod::JetTracksSub const& tracks) + { + analyseCharged(jet, tracks, TracksPerCollisionDataSub, jetSubstructureDataSubTable, jetSplittingsDataSubTable); + } + PROCESS_SWITCH(FormationTimeReclustering, processChargedJetsEventWiseSubData, "eventwise-constituent subtracted charged jet substructure", false); + + void processChargedJetsMCD(typename soa::Join::iterator const& jet, + aod::JetTracks const& tracks) + { + analyseCharged(jet, tracks, TracksPerCollision, jetSubstructureMCDTable, jetSplittingsMCDTable); + } + PROCESS_SWITCH(FormationTimeReclustering, processChargedJetsMCD, "charged jet substructure", false); + + void processChargedJetsMCP(typename soa::Join::iterator const& jet) + { + jetConstituents.clear(); + ptJet = jet.pt(); + phiJet = jet.phi(); + etaJet = jet.eta(); + for (auto& jetConstituent : jet.template tracks_as()) { + fastjetutilities::fillTracks(jetConstituent, jetConstituents, jetConstituent.globalIndex(), static_cast(JetConstituentStatus::track), pdg->Mass(jetConstituent.pdgCode())); + } + jetReclustering(jet, jetSplittingsMCPTable); + jetSubstructureMCPTable(ptJet, phiJet, etaJet, energyMotherVec, ptLeadingVec, ptSubLeadingVec, thetaVec, leadingConstituentPt, tauFormVec, zVec, ptgVec, thetagVec, zgVec, taugVec); + } + PROCESS_SWITCH(FormationTimeReclustering, processChargedJetsMCP, "charged jet substructure on MC particle level", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + + return WorkflowSpec{adaptAnalysisTask( + cfgc, TaskName{"jet-formationtimereclustering"})}; +} From ecb37c84552a90360eea68936acf6f9647dbcdfe Mon Sep 17 00:00:00 2001 From: nepeivodaRS <94179174+nepeivodaRS@users.noreply.github.com> Date: Tue, 14 Oct 2025 10:33:54 +0200 Subject: [PATCH 739/986] [PWGLF] str-in-pp-and-upc-update (#13373) Co-authored-by: ALICE Action Bot --- .../Strangeness/cascqaanalysis.cxx | 67 ++- .../Tasks/Strangeness/derivedupcanalysis.cxx | 419 ++++++++++-------- 2 files changed, 292 insertions(+), 194 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx b/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx index 6a3310d316f..2d4e02dd783 100644 --- a/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx +++ b/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx @@ -13,27 +13,33 @@ /// \brief Analysis of cascades in pp collisions /// \author Roman Nepeivoda (roman.nepeivoda@cern.ch) -#include -#include -#include +#include "PWGLF/DataModel/cascqaanalysis.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Common/DataModel/TrackSelectionTables.h" #include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/mcCentrality.h" +#include "PWGLF/Utils/inelGt.h" + +#include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" -#include "PWGLF/DataModel/cascqaanalysis.h" -#include "TRandom2.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "Framework/AnalysisTask.h" #include "Framework/O2DatabasePDGPlugin.h" -#include "PWGLF/Utils/inelGt.h" -#include "PWGLF/DataModel/mcCentrality.h" +#include "Framework/runDataProcessing.h" + +#include "TRandom2.h" +#include + +#include +#include +#include using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace o2::aod::rctsel; // using DauTracks = soa::Join; using TrkPidInfo = soa::Join; @@ -79,6 +85,14 @@ struct Cascqaanalysis { Configurable isNoITSROFrameBorder{"isNoITSROFrameBorder", 1, "ITS ROF border cut"}; Configurable isNoCollInTimeRangeNarrow{"isNoCollInTimeRangeNarrow", 1, "No collisions in +-2us window"}; + Configurable requireRCTFlagChecker{"requireRCTFlagChecker", true, "Check event quality in run condition table"}; + Configurable cfgEvtRCTFlagCheckerLabel{"cfgEvtRCTFlagCheckerLabel", "CBT_hadronPID", "Evt sel: RCT flag checker label"}; + Configurable cfgEvtRCTFlagCheckerZDCCheck{"cfgEvtRCTFlagCheckerZDCCheck", false, "Evt sel: RCT flag checker ZDC check"}; + Configurable cfgEvtRCTFlagCheckerFV0Check{"cfgEvtRCTFlagCheckerFV0Check", false, "Evt sel: RCT flag checker FV0 check"}; + Configurable cfgEvtRCTFlagCheckerLimitAcceptAsBad{"cfgEvtRCTFlagCheckerLimitAcceptAsBad", false, "Evt sel: RCT flag checker treat Limited Acceptance As Bad"}; + + RCTFlagsChecker rctChecker; + // Cascade selection criteria Configurable scalefactor{"scalefactor", 1.0, "Scaling factor"}; Configurable casccospa{"casccospa", 0.97, "Casc CosPA"}; @@ -119,9 +133,9 @@ struct Cascqaanalysis { { TString hCandidateCounterLabels[4] = {"All candidates", "passed topo cuts", "has associated MC particle", "associated with Xi(Omega)"}; TString hNEventsMCLabels[6] = {"All", "z vrtx", "INEL", "INEL>0", "INEL>1", "Associated with rec. collision"}; - TString hNEventsLabels[13] = {"All", "kIsTriggerTVX", "kNoTimeFrameBorder", "kNoITSROFrameBorder", "kIsVertexITSTPC", "kNoSameBunchPileup", "kIsGoodZvtxFT0vsPV", "isVertexTOFmatched", "kNoCollInTimeRangeNarrow", "z vrtx", "INEL", "INEL>0", "INEL>1"}; + TString hNEventsLabels[14] = {"All", "kIsTriggerTVX", "kNoTimeFrameBorder", "kNoITSROFrameBorder", "kIsVertexITSTPC", "kNoSameBunchPileup", "kIsGoodZvtxFT0vsPV", "isVertexTOFmatched", "kNoCollInTimeRangeNarrow", "z vrtx", "RCTFlagsChecker", "INEL", "INEL>0", "INEL>1"}; - registry.add("hNEvents", "hNEvents", {HistType::kTH1D, {{13, 0.f, 13.f}}}); + registry.add("hNEvents", "hNEvents", {HistType::kTH1D, {{14, 0.f, 14.f}}}); for (int n = 1; n <= registry.get(HIST("hNEvents"))->GetNbinsX(); n++) { registry.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(n, hNEventsLabels[n - 1]); @@ -169,6 +183,11 @@ struct Cascqaanalysis { registry.add("hFT0MFV0Asignal", "hFT0MFV0Asignal", {HistType::kTH2D, {signalFT0MAxis, signalFV0AAxis}}); registry.add("hFT0MsignalPVContr", "hFT0MsignalPVContr", {HistType::kTH3D, {signalFT0MAxis, multNTracksAxis, eventTypeAxis}}); } + + rctChecker.init(cfgEvtRCTFlagCheckerLabel, cfgEvtRCTFlagCheckerZDCCheck, cfgEvtRCTFlagCheckerLimitAcceptAsBad); + if (cfgEvtRCTFlagCheckerFV0Check) { + rctChecker.set(o2::aod::rctsel::kFV0Bad); + } } Filter preFilter = @@ -256,14 +275,14 @@ struct Cascqaanalysis { { // 0 - INEL, 1 - INEL>0, 2 - INEL>1 int evFlag = 0; - registry.fill(HIST("hNEvents"), 10.5); // INEL + registry.fill(HIST("hNEvents"), 11.5); // INEL if (collision.isInelGt0()) { evFlag += 1; - registry.fill(HIST("hNEvents"), 11.5); // INEL>0 + registry.fill(HIST("hNEvents"), 12.5); // INEL>0 } if (collision.isInelGt1()) { evFlag += 1; - registry.fill(HIST("hNEvents"), 12.5); // INEL>1 + registry.fill(HIST("hNEvents"), 13.5); // INEL>1 } return evFlag; } @@ -347,6 +366,14 @@ struct Cascqaanalysis { registry.fill(HIST("hZCollision"), collision.posZ()); } + // RCTFlagChecker selection + if (requireRCTFlagChecker && !rctChecker(collision)) { + return false; + } + if (isFillEventSelectionQA) { + registry.fill(HIST("hNEvents"), 10.5); + } + return true; } @@ -483,15 +510,15 @@ struct Cascqaanalysis { uint16_t nchFV0 = getGenNchInFV0Aregion(mcPartSlice); int evType = 0; - registry.fill(HIST("hNEvents"), 10.5); // INEL + registry.fill(HIST("hNEvents"), 11.5); // INEL // Rec. collision associated with INEL>0 gen. one if (pwglf::isINELgtNmc(mcPartSlice, 0, pdgDB)) { - registry.fill(HIST("hNEvents"), 11.5); // INEL + registry.fill(HIST("hNEvents"), 12.5); // INEL evType++; } // Rec. collision associated with INEL>1 gen. one if (pwglf::isINELgtNmc(mcPartSlice, 1, pdgDB)) { - registry.fill(HIST("hNEvents"), 12.5); // INEL + registry.fill(HIST("hNEvents"), 13.5); // INEL evType++; } diff --git a/PWGLF/Tasks/Strangeness/derivedupcanalysis.cxx b/PWGLF/Tasks/Strangeness/derivedupcanalysis.cxx index b3021033d32..12ea48cadc4 100644 --- a/PWGLF/Tasks/Strangeness/derivedupcanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/derivedupcanalysis.cxx @@ -13,34 +13,38 @@ /// \brief Analysis of strangeness production in UPC collisions /// \author Roman Nepeivoda (roman.nepeivoda@cern.ch) -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/Utils/strangenessMasks.h" +#include "PWGUD/Core/SGSelector.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "ReconstructionDataFormats/Track.h" #include "Common/Core/RecoDecay.h" -#include "Common/Core/trackUtilities.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/DataModel/LFStrangenessPIDTables.h" #include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/EventSelection.h" +#include "Common/Core/trackUtilities.h" #include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" #include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/O2DatabasePDGPlugin.h" #include "Framework/StaticFor.h" -#include "PWGUD/Core/SGSelector.h" -#include "PWGLF/Utils/strangenessMasks.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -62,10 +66,11 @@ using NeutronsMC = soa::Join; using CascMCCoresFull = soa::Join; +using StraCollisonsFull = soa::Join; using StraCollisonFull = soa::Join::iterator; -using StraCollisonFullMC = soa::Join::iterator; using StraCollisonsFullMC = soa::Join; +using StraCollisonFullMC = soa::Join::iterator; using StraMCCollisionsFull = soa::Join; using V0MCCoresFull = soa::Join; @@ -102,11 +107,16 @@ struct Derivedupcanalysis { Configurable requireRCTFlagChecker{"requireRCTFlagChecker", true, "Check event quality in run condition table"}; Configurable cfgEvtRCTFlagCheckerLabel{"cfgEvtRCTFlagCheckerLabel", "CBT_hadronPID", "Evt sel: RCT flag checker label"}; Configurable cfgEvtRCTFlagCheckerZDCCheck{"cfgEvtRCTFlagCheckerZDCCheck", true, "Evt sel: RCT flag checker ZDC check"}; + Configurable cfgEvtRCTFlagCheckerFV0Check{"cfgEvtRCTFlagCheckerFV0Check", true, "Evt sel: RCT flag checker FV0 check"}; Configurable cfgEvtRCTFlagCheckerLimitAcceptAsBad{"cfgEvtRCTFlagCheckerLimitAcceptAsBad", false, "Evt sel: RCT flag checker treat Limited Acceptance As Bad"}; } evSels; RCTFlagsChecker rctChecker; + // Custom grouping + std::vector> v0sGrouped; + std::vector> cascadesGrouped; + Configurable verbose{"verbose", false, "additional printouts"}; // Acceptance selections @@ -744,6 +754,9 @@ struct Derivedupcanalysis { } rctChecker.init(evSels.cfgEvtRCTFlagCheckerLabel, evSels.cfgEvtRCTFlagCheckerZDCCheck, evSels.cfgEvtRCTFlagCheckerLimitAcceptAsBad); + if (evSels.cfgEvtRCTFlagCheckerFV0Check) { + rctChecker.set(o2::aod::rctsel::kFV0Bad); + } // initialise bit masks setBits(maskTopologicalV0, {selV0CosPA, selDCANegToPV, selDCAPosToPV, selDCAV0Dau, selV0Radius, selV0RadiusMax}); @@ -933,6 +946,7 @@ struct Derivedupcanalysis { histos.add("eventQA/mc/hGenEventFT0ampl", "hGenEventFT0ampl", kTH1D, {axisDetectors.axisFT0Aampl}); histos.add("eventQA/mc/hGenEventCentrality", "hGenEventCentrality", kTH1D, {axisFT0Cqa}); histos.add("eventQA/mc/hGeneratorsId", "hGeneratorsId", kTH1D, {axisGeneratorIds}); + histos.add("eventQA/mc/hSelGeneratorsId", "hSelGeneratorsId", kTH1D, {axisGeneratorIds}); } if (doprocessV0sMC || doprocessCascadesMC) { @@ -1073,7 +1087,19 @@ struct Derivedupcanalysis { histos.fill(HIST("eventQA/hSelGapSide"), gap); histos.fill(HIST("eventQA/hFT0"), collision.totalFT0AmplitudeA(), collision.totalFT0AmplitudeC(), gap); histos.fill(HIST("eventQA/hFDD"), collision.totalFDDAmplitudeA(), collision.totalFDDAmplitudeC(), gap); - histos.fill(HIST("eventQA/hZN"), collision.energyCommonZNA(), collision.energyCommonZNC(), gap); + + auto zna = collision.energyCommonZNA(); + auto znc = collision.energyCommonZNC(); + constexpr float inf_f = std::numeric_limits::infinity(); + + if (zna == -inf_f) + histos.fill(HIST("eventQA/hZN"), -1, znc, gap); + else if (znc == -inf_f) + histos.fill(HIST("eventQA/hZN"), zna, -1, gap); + else if (zna == -999 && znc == -999) + histos.fill(HIST("eventQA/hZN"), -2, -2, gap); + else if (zna == -999 || znc == -999) + LOG(warning) << "Only one ZDC signal is -999"; } template @@ -1791,6 +1817,8 @@ struct Derivedupcanalysis { continue; } + histos.fill(HIST("eventQA/mc/hSelGeneratorsId"), mcCollision.generatorsID()); + histos.fill(HIST("eventQA/mc/hEventSelectionMC"), 0.0, mcCollision.multMCNParticlesEta08(), mcCollision.generatorsID()); if (std::abs(mcCollision.posZ()) > maxZVtxPosition) @@ -1907,35 +1935,45 @@ struct Derivedupcanalysis { } } - void processV0s(StraCollisonFull const& collision, V0Candidates const& fullV0s, DauTracks const&) + void processV0s(StraCollisonsFull const& collisions, V0Candidates const& fullV0s, DauTracks const&) { - if (!acceptEvent(collision, true)) { - return; - } // event is accepted + v0sGrouped.clear(); + v0sGrouped.resize(collisions.size()); + for (const auto& v0 : fullV0s) { + v0sGrouped[v0.straCollisionId()].push_back(v0.globalIndex()); + } + for (const auto& collision : collisions) { + if (!acceptEvent(collision, true)) { + continue; + } // event is accepted - histos.fill(HIST("eventQA/hRawGapSide"), collision.gapSide()); + histos.fill(HIST("eventQA/hRawGapSide"), collision.gapSide()); - int selGapSide = collision.isUPC() ? getGapSide(collision) : -1; - if (evSels.studyUPConly && (selGapSide < -0.5)) - return; + int selGapSide = collision.isUPC() ? getGapSide(collision) : -1; + if (evSels.studyUPConly && (selGapSide < -0.5)) + continue; - fillHistogramsQA(collision, selGapSide); + fillHistogramsQA(collision, selGapSide); - for (const auto& v0 : fullV0s) { - if ((v0.v0Type() != v0cuts.v0TypeSelection) && (v0cuts.v0TypeSelection > 0)) - continue; // skip V0s that are not standard + std::size_t nV0sThisColl = v0sGrouped[collision.globalIndex()].size(); - std::bitset selMap = computeBitmapV0(v0, collision); + for (std::size_t i = 0; i < nV0sThisColl; i++) { + auto v0 = fullV0s.rawIteratorAt(v0sGrouped[collision.globalIndex()][i]); + if ((v0.v0Type() != v0cuts.v0TypeSelection) && (v0cuts.v0TypeSelection > 0)) + continue; // skip V0s that are not standard - // consider all species for the candidate - setBits(selMap, {selConsiderK0Short, selConsiderLambda, selConsiderAntiLambda, - selPhysPrimK0Short, selPhysPrimLambda, selPhysPrimAntiLambda}); + std::bitset selMap = computeBitmapV0(v0, collision); - analyseV0Candidate(v0, collision, selGapSide, selMap); - } // end v0 loop + // consider all species for the candidate + setBits(selMap, {selConsiderK0Short, selConsiderLambda, selConsiderAntiLambda, + selPhysPrimK0Short, selPhysPrimLambda, selPhysPrimAntiLambda}); + + analyseV0Candidate(v0, collision, selGapSide, selMap); + } // end v0 loop + } } - void processV0sMC(StraCollisonFullMC const& collision, + void processV0sMC(StraCollisonsFullMC const& collisions, V0CandidatesMC const& fullV0s, DauTracks const&, aod::MotherMCParts const&, @@ -1943,114 +1981,136 @@ struct Derivedupcanalysis { V0MCCoresFull const&, NeutronsMC const& neutrons) { - if (!collision.has_straMCCollision()) { - histos.fill(HIST("eventQA/mc/hFakeEvents"), 0); // no assoc. MC collisions - return; + v0sGrouped.clear(); + v0sGrouped.resize(collisions.size()); + for (const auto& v0 : fullV0s) { + v0sGrouped[v0.straCollisionId()].push_back(v0.globalIndex()); } - const auto& mcCollision = collision.straMCCollision_as(); // take gen. collision associated to the rec. collision + for (const auto& collision : collisions) { + if (!collision.has_straMCCollision()) { + histos.fill(HIST("eventQA/mc/hFakeEvents"), 0); // no assoc. MC collisions + continue; + } - if (std::find(generatorIds->begin(), generatorIds->end(), mcCollision.generatorsID()) == generatorIds->end()) { - return; - } + const auto& mcCollision = collision.straMCCollision_as(); // take gen. collision associated to the rec. collision - if (!acceptEvent(collision, true)) { - return; - } // event is accepted + if (std::find(generatorIds->begin(), generatorIds->end(), mcCollision.generatorsID()) == generatorIds->end()) { + continue; + } - histos.fill(HIST("eventQA/hRawGapSide"), collision.gapSide()); + if (!acceptEvent(collision, true)) { + continue; + } // event is accepted - int selGapSide = collision.isUPC() ? getGapSide(collision) : -1; - int selGapSideNoNeutrons = selGapSide; + histos.fill(HIST("eventQA/hRawGapSide"), collision.gapSide()); - auto groupedNeutrons = neutrons.sliceBy(neutronsPerMcCollision, mcCollision.globalIndex()); - if (checkNeutronsInMC) { - for (const auto& neutron : groupedNeutrons) { - if (selGapSide < -0.5) - break; + int selGapSide = collision.isUPC() ? getGapSide(collision) : -1; + int selGapSideNoNeutrons = selGapSide; - const float eta = neutron.eta(); - switch (selGapSide) { - case 0: // SGA - if (eta > neutronEtaCut) - selGapSide = -1; - break; - case 1: // SGC - if (eta < -neutronEtaCut) - selGapSide = -1; - break; - case 2: // DG - if (eta > neutronEtaCut) - selGapSide = 1; - else if (eta < -neutronEtaCut) - selGapSide = 0; + auto groupedNeutrons = neutrons.sliceBy(neutronsPerMcCollision, mcCollision.globalIndex()); + if (checkNeutronsInMC) { + for (const auto& neutron : groupedNeutrons) { + if (selGapSide < -0.5) break; + + const float eta = neutron.eta(); + switch (selGapSide) { + case 0: // SGA + if (eta > neutronEtaCut) + selGapSide = -1; + break; + case 1: // SGC + if (eta < -neutronEtaCut) + selGapSide = -1; + break; + case 2: // DG + if (eta > neutronEtaCut) + selGapSide = 1; + else if (eta < -neutronEtaCut) + selGapSide = 0; + break; + } } } - } - if (evSels.studyUPConly && (selGapSide < -0.5)) - return; + if (evSels.studyUPConly && (selGapSide < -0.5)) + continue; - histos.fill(HIST("eventQA/hSelGapSideNoNeutrons"), selGapSideNoNeutrons); - fillHistogramsQA(collision, selGapSide); + histos.fill(HIST("eventQA/hSelGapSideNoNeutrons"), selGapSideNoNeutrons); + fillHistogramsQA(collision, selGapSide); - histos.fill(HIST("eventQA/mc/hNTracksGlobalvsMCNParticlesEta08rec"), collision.multNTracksGlobal(), mcCollision.multMCNParticlesEta08()); - histos.fill(HIST("eventQA/mc/hNTracksPVeta1vsMCNParticlesEta10rec"), collision.multNTracksPVeta1(), mcCollision.multMCNParticlesEta10()); - histos.fill(HIST("eventQA/mc/hNTracksGlobalvstotalMultMCParticles"), collision.multNTracksGlobal(), mcCollision.totalMultMCParticles()); - histos.fill(HIST("eventQA/mc/hNTracksPVeta1vstotalMultMCParticles"), collision.multNTracksPVeta1(), mcCollision.totalMultMCParticles()); + histos.fill(HIST("eventQA/mc/hNTracksGlobalvsMCNParticlesEta08rec"), collision.multNTracksGlobal(), mcCollision.multMCNParticlesEta08()); + histos.fill(HIST("eventQA/mc/hNTracksPVeta1vsMCNParticlesEta10rec"), collision.multNTracksPVeta1(), mcCollision.multMCNParticlesEta10()); + histos.fill(HIST("eventQA/mc/hNTracksGlobalvstotalMultMCParticles"), collision.multNTracksGlobal(), mcCollision.totalMultMCParticles()); + histos.fill(HIST("eventQA/mc/hNTracksPVeta1vstotalMultMCParticles"), collision.multNTracksPVeta1(), mcCollision.totalMultMCParticles()); - for (const auto& v0 : fullV0s) { - if ((v0.v0Type() != v0cuts.v0TypeSelection) && (v0cuts.v0TypeSelection > 0)) - continue; // skip V0s that are not standard + std::size_t nV0sThisColl = v0sGrouped[collision.globalIndex()].size(); - std::bitset selMap = computeBitmapV0(v0, collision); + for (std::size_t i = 0; i < nV0sThisColl; i++) { + auto v0 = fullV0s.rawIteratorAt(v0sGrouped[collision.globalIndex()][i]); + if ((v0.v0Type() != v0cuts.v0TypeSelection) && (v0cuts.v0TypeSelection > 0)) + continue; // skip V0s that are not standard - if (doMCAssociation) { - if (v0.has_v0MCCore()) { - const auto& v0MC = v0.v0MCCore_as(); - computeV0MCAssociation(v0MC, selMap); - if (calculateFeeddownMatrix) { - fillFeeddownMatrix(collision, v0, selMap); + std::bitset selMap = computeBitmapV0(v0, collision); + + if (doMCAssociation) { + if (v0.has_v0MCCore()) { + const auto& v0MC = v0.v0MCCore_as(); + computeV0MCAssociation(v0MC, selMap); + if (calculateFeeddownMatrix) { + fillFeeddownMatrix(collision, v0, selMap); + } } + } else { + // consider all species for the candidate + setBits(selMap, {selConsiderK0Short, selConsiderLambda, selConsiderAntiLambda, + selPhysPrimK0Short, selPhysPrimLambda, selPhysPrimAntiLambda}); } - } else { - // consider all species for the candidate - setBits(selMap, {selConsiderK0Short, selConsiderLambda, selConsiderAntiLambda, - selPhysPrimK0Short, selPhysPrimLambda, selPhysPrimAntiLambda}); - } - analyseV0Candidate(v0, collision, selGapSide, selMap); - } // end v0 loop + analyseV0Candidate(v0, collision, selGapSide, selMap); + } // end v0 loop + } } - void processCascades(StraCollisonFull const& collision, + void processCascades(StraCollisonsFull const& collisions, CascadeCandidates const& fullCascades, DauTracks const&) { - if (!acceptEvent(collision, true)) { - return; - } // event is accepted + cascadesGrouped.clear(); + cascadesGrouped.resize(collisions.size()); + for (const auto& cascade : fullCascades) { + cascadesGrouped[cascade.straCollisionId()].push_back(cascade.globalIndex()); + } - histos.fill(HIST("eventQA/hRawGapSide"), collision.gapSide()); + for (const auto& collision : collisions) { + if (!acceptEvent(collision, true)) { + continue; + } // event is accepted - int selGapSide = collision.isUPC() ? getGapSide(collision) : -1; - if (evSels.studyUPConly && (selGapSide < -0.5)) - return; + histos.fill(HIST("eventQA/hRawGapSide"), collision.gapSide()); + + int selGapSide = collision.isUPC() ? getGapSide(collision) : -1; + if (evSels.studyUPConly && (selGapSide < -0.5)) + continue; - fillHistogramsQA(collision, selGapSide); + fillHistogramsQA(collision, selGapSide); - for (const auto& casc : fullCascades) { - std::bitset selMap = computeBitmapCascade(casc, collision); - // the candidate may belong to any particle species - setBits(selMap, {selConsiderXi, selConsiderAntiXi, selConsiderOmega, selConsiderAntiOmega, - selPhysPrimXi, selPhysPrimAntiXi, selPhysPrimOmega, selPhysPrimAntiOmega}); + std::size_t nCascadesThisColl = cascadesGrouped[collision.globalIndex()].size(); - analyseCascCandidate(casc, collision, selGapSide, selMap); - } // end casc loop + for (std::size_t i = 0; i < nCascadesThisColl; i++) { + auto casc = fullCascades.rawIteratorAt(cascadesGrouped[collision.globalIndex()][i]); + std::bitset selMap = computeBitmapCascade(casc, collision); + // the candidate may belong to any particle species + setBits(selMap, {selConsiderXi, selConsiderAntiXi, selConsiderOmega, selConsiderAntiOmega, + selPhysPrimXi, selPhysPrimAntiXi, selPhysPrimOmega, selPhysPrimAntiOmega}); + + analyseCascCandidate(casc, collision, selGapSide, selMap); + } // end casc loop + } } - void processCascadesMC(StraCollisonFullMC const& collision, + void processCascadesMC(StraCollisonsFullMC const& collisions, CascadeCandidatesMC const& fullCascades, DauTracks const&, aod::MotherMCParts const&, @@ -2058,79 +2118,90 @@ struct Derivedupcanalysis { CascMCCoresFull const&, NeutronsMC const& neutrons) { - if (!collision.has_straMCCollision()) { - histos.fill(HIST("eventQA/mc/hFakeEvents"), 0); // no assoc. MC collisions - return; + cascadesGrouped.clear(); + cascadesGrouped.resize(collisions.size()); + for (const auto& cascade : fullCascades) { + cascadesGrouped[cascade.straCollisionId()].push_back(cascade.globalIndex()); } - const auto& mcCollision = collision.straMCCollision_as(); // take gen. collision associated to the rec. collision + for (const auto& collision : collisions) { + if (!collision.has_straMCCollision()) { + histos.fill(HIST("eventQA/mc/hFakeEvents"), 0); // no assoc. MC collisions + continue; + } - if (std::find(generatorIds->begin(), generatorIds->end(), mcCollision.generatorsID()) == generatorIds->end()) { - return; - } + const auto& mcCollision = collision.straMCCollision_as(); // take gen. collision associated to the rec. collision - if (!acceptEvent(collision, true)) { - return; - } // event is accepted + if (std::find(generatorIds->begin(), generatorIds->end(), mcCollision.generatorsID()) == generatorIds->end()) { + continue; + } - histos.fill(HIST("eventQA/hRawGapSide"), collision.gapSide()); + if (!acceptEvent(collision, true)) { + continue; + } // event is accepted - int selGapSide = collision.isUPC() ? getGapSide(collision) : -1; - int selGapSideNoNeutrons = selGapSide; + histos.fill(HIST("eventQA/hRawGapSide"), collision.gapSide()); - auto groupedNeutrons = neutrons.sliceBy(neutronsPerMcCollision, mcCollision.globalIndex()); - if (checkNeutronsInMC) { - for (const auto& neutron : groupedNeutrons) { - if (selGapSide < -0.5) - break; + int selGapSide = collision.isUPC() ? getGapSide(collision) : -1; + int selGapSideNoNeutrons = selGapSide; - const float eta = neutron.eta(); - switch (selGapSide) { - case 0: // SGA - if (eta > neutronEtaCut) - selGapSide = -1; - break; - case 1: // SGC - if (eta < -neutronEtaCut) - selGapSide = -1; - break; - case 2: // DG - if (eta > neutronEtaCut) - selGapSide = 1; - else if (eta < -neutronEtaCut) - selGapSide = 0; + auto groupedNeutrons = neutrons.sliceBy(neutronsPerMcCollision, mcCollision.globalIndex()); + if (checkNeutronsInMC) { + for (const auto& neutron : groupedNeutrons) { + if (selGapSide < -0.5) break; + + const float eta = neutron.eta(); + switch (selGapSide) { + case 0: // SGA + if (eta > neutronEtaCut) + selGapSide = -1; + break; + case 1: // SGC + if (eta < -neutronEtaCut) + selGapSide = -1; + break; + case 2: // DG + if (eta > neutronEtaCut) + selGapSide = 1; + else if (eta < -neutronEtaCut) + selGapSide = 0; + break; + } } } - } - if (evSels.studyUPConly && (selGapSide < -0.5)) - return; + if (evSels.studyUPConly && (selGapSide < -0.5)) + continue; - histos.fill(HIST("eventQA/hSelGapSideNoNeutrons"), selGapSideNoNeutrons); - fillHistogramsQA(collision, selGapSide); + histos.fill(HIST("eventQA/hSelGapSideNoNeutrons"), selGapSideNoNeutrons); + fillHistogramsQA(collision, selGapSide); - histos.fill(HIST("eventQA/mc/hNTracksGlobalvsMCNParticlesEta08rec"), collision.multNTracksGlobal(), mcCollision.multMCNParticlesEta08()); - histos.fill(HIST("eventQA/mc/hNTracksPVeta1vsMCNParticlesEta10rec"), collision.multNTracksPVeta1(), mcCollision.multMCNParticlesEta10()); - histos.fill(HIST("eventQA/mc/hNTracksGlobalvstotalMultMCParticles"), collision.multNTracksGlobal(), mcCollision.totalMultMCParticles()); - histos.fill(HIST("eventQA/mc/hNTracksPVeta1vstotalMultMCParticles"), collision.multNTracksPVeta1(), mcCollision.totalMultMCParticles()); + histos.fill(HIST("eventQA/mc/hNTracksGlobalvsMCNParticlesEta08rec"), collision.multNTracksGlobal(), mcCollision.multMCNParticlesEta08()); + histos.fill(HIST("eventQA/mc/hNTracksPVeta1vsMCNParticlesEta10rec"), collision.multNTracksPVeta1(), mcCollision.multMCNParticlesEta10()); + histos.fill(HIST("eventQA/mc/hNTracksGlobalvstotalMultMCParticles"), collision.multNTracksGlobal(), mcCollision.totalMultMCParticles()); + histos.fill(HIST("eventQA/mc/hNTracksPVeta1vstotalMultMCParticles"), collision.multNTracksPVeta1(), mcCollision.totalMultMCParticles()); - for (const auto& casc : fullCascades) { - std::bitset selMap = computeBitmapCascade(casc, collision); + std::size_t nCascadesThisColl = cascadesGrouped[collision.globalIndex()].size(); - if (doMCAssociation) { - if (casc.has_cascMCCore()) { - const auto& cascMC = casc.cascMCCore_as(); - computeCascadeMCAssociation(cascMC, selMap); + for (std::size_t i = 0; i < nCascadesThisColl; i++) { + auto casc = fullCascades.rawIteratorAt(cascadesGrouped[collision.globalIndex()][i]); + std::bitset selMap = computeBitmapCascade(casc, collision); + + if (doMCAssociation) { + if (casc.has_cascMCCore()) { + const auto& cascMC = casc.cascMCCore_as(); + computeCascadeMCAssociation(cascMC, selMap); + } + } else { + // the candidate may belong to any particle species + setBits(selMap, {selConsiderXi, selConsiderAntiXi, selConsiderOmega, selConsiderAntiOmega, + selPhysPrimXi, selPhysPrimAntiXi, selPhysPrimOmega, selPhysPrimAntiOmega}); } - } else { - // the candidate may belong to any particle species - setBits(selMap, {selConsiderXi, selConsiderAntiXi, selConsiderOmega, selConsiderAntiOmega, - selPhysPrimXi, selPhysPrimAntiXi, selPhysPrimOmega, selPhysPrimAntiOmega}); - } - analyseCascCandidate(casc, collision, selGapSide, selMap); - } // end casc loop + analyseCascCandidate(casc, collision, selGapSide, selMap); + } // end casc loop + } } void processGenerated(StraMCCollisionsFull const& mcCollisions, From 3dbee43cdb499f2673754d471162b475f516b221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Kr=C3=BCger?= <26876110+mario-krueger@users.noreply.github.com> Date: Tue, 14 Oct 2025 11:20:42 +0200 Subject: [PATCH 740/986] [PWGLF] add particle-composition correction (#13371) --- .../particleCompositionCorrectionTable.h | 35 +++ PWGLF/TableProducer/Nuspex/CMakeLists.txt | 5 + .../Nuspex/particleCompositionCorrection.cxx | 221 ++++++++++++++++++ 3 files changed, 261 insertions(+) create mode 100644 PWGLF/DataModel/particleCompositionCorrectionTable.h create mode 100644 PWGLF/TableProducer/Nuspex/particleCompositionCorrection.cxx diff --git a/PWGLF/DataModel/particleCompositionCorrectionTable.h b/PWGLF/DataModel/particleCompositionCorrectionTable.h new file mode 100644 index 00000000000..b91ee3df50d --- /dev/null +++ b/PWGLF/DataModel/particleCompositionCorrectionTable.h @@ -0,0 +1,35 @@ +// 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 ParticleCompositionCorrectionTable.h +/// \brief Table for scaling MC particle abundances to match measurements +/// \author Mario Krüger +/// + +#ifndef PWGLF_DATAMODEL_PARTICLECOMPOSITIONCORRECTIONTABLE_H_ +#define PWGLF_DATAMODEL_PARTICLECOMPOSITIONCORRECTIONTABLE_H_ + +#include "Framework/ASoA.h" +#include "Framework/AnalysisDataModel.h" + +namespace o2::aod +{ +namespace PCC +{ +DECLARE_SOA_COLUMN(Pccweight, pccweight, float); +DECLARE_SOA_COLUMN(Pccweightsysup, pccweightsysup, float); +DECLARE_SOA_COLUMN(Pccweightsysdown, pccweightsysdown, float); +} // namespace PCC +DECLARE_SOA_TABLE(ParticleCompositionCorrection, "AOD", "PARTICLECOMPOSITIONCORRECTION", PCC::Pccweight, PCC::Pccweightsysup, PCC::Pccweightsysdown); +} // namespace o2::aod + +#endif // PWGLF_DATAMODEL_PARTICLECOMPOSITIONCORRECTIONTABLE_H_ diff --git a/PWGLF/TableProducer/Nuspex/CMakeLists.txt b/PWGLF/TableProducer/Nuspex/CMakeLists.txt index 127b4d465de..39fe1fd7a3c 100644 --- a/PWGLF/TableProducer/Nuspex/CMakeLists.txt +++ b/PWGLF/TableProducer/Nuspex/CMakeLists.txt @@ -108,3 +108,8 @@ o2physics_add_dpl_workflow(nuclei-antineutron-cex SOURCES nucleiAntineutronCex.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(particle-composition-correction + SOURCES particleCompositionCorrection.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore + COMPONENT_NAME Analysis) diff --git a/PWGLF/TableProducer/Nuspex/particleCompositionCorrection.cxx b/PWGLF/TableProducer/Nuspex/particleCompositionCorrection.cxx new file mode 100644 index 00000000000..c8cdb79bb57 --- /dev/null +++ b/PWGLF/TableProducer/Nuspex/particleCompositionCorrection.cxx @@ -0,0 +1,221 @@ +// 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 particleCompositionCorrection.cxx +/// \brief Task to generate a table of dNdEta, pt and PID dependent weigths for MC particles to reflect the measured particle abundances +/// \author Mario Krüger + +#include + +#include "Tools/ML/model.h" + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::ml; + +struct ParticleCompositionCorrection { + // produces table of (dNdEta, pt, PID)-dependent weights for adjusting the particle composition in MC to better match the measured particle chemistry + // applying these weights in the analysis allows mitigating on event-by-event basis the corresponding biases in efficiency and contamination of unidentified particles + // weights are determined using measured pi,K,p,labda(as basis for sigma) spectra togehter with their counterpart from pythia simulations + // they are interpolated in dNdEta and pt dimension using DNNs, which then provide particle fractions in data and MC and are stored as .onnx in the CCDB + // weigths are assigned to the primary generated particle as well as its daughter particles (both from decay and material interactions) + // weights are calculated only for particles within the configured kineamatic range and only for a distinct set of mother particles (see code) + // assumes neutral particles require the same scaling as their charged counterparts (e.g. pi0 is scaled the same as pi+) + // multi-strange baryons are assigned scaling factors of the sigma, which should be better than no scaling at all + + /* + backlog: + - store final neural networks in ccdb and implement accessing them + - support collision systems beyond pp + - add QA task illustrating improved mc/data matching of DCA distributions after scaling of secondaries + - extend PCC weight table by columns with systematic variations (up/down) + - investigate why particles can be their own mothers + - investigate why histogram registry writing does not respect subfolder structure + */ + + Service pdg; + Configurable etaCut{"etaCut", 0.8f, "eta cut"}; + Configurable ptMinCut{"ptMinCut", 0.15f, "pt min cut"}; + Configurable ptMaxCut{"ptMaxCut", 10.f, "pt max cut"}; + Configurable skipSec{"skipSec", false, "dont calculate weights for secondaries"}; + Configurable enableQAHistos{"enableQAHistos", true, "enable qa histograms showing the effect of the PCC"}; + + Configurable modelNameData{"modelNameData", "ParticleFractions_pp_data.onnx", "Path to the .onnx file containing the particle fractions in data"}; + Configurable modelNameMC{"modelNameMC", "ParticleFractions_pp_pythia.onnx", "Path to the .onnx file containing the particle fractions in MC"}; + + OnnxModel particleFractionsData; + OnnxModel particleFractionsMC; + + Produces pccTable; + void init(InitContext const& cfgc); + void process(aod::McCollisions::iterator const& mcCollision, aod::McParticles const& particles); + + HistogramRegistry histos; +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} + +void ParticleCompositionCorrection::init(InitContext const&) +{ + particleFractionsData.initModel(modelNameData.value, true); + particleFractionsMC.initModel(modelNameMC.value, true); + + if (enableQAHistos) { + std::vector ptBinEdges = {0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, + 0.8, 0.85, 0.9, 0.95, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, + 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.5, 5.0, 5.5, + 6.0, 6.5, 7.0, 8.0, 9.0, 10.0}; + const AxisSpec ptAxis{ptBinEdges, "#it{p}_{T} (GeV/#it{c})", "pt"}; + + histos.add("frac/data/pion", "", kTProfile, {ptAxis}); + histos.add("frac/data/kaon", "", kTProfile, {ptAxis}); + histos.add("frac/data/proton", "", kTProfile, {ptAxis}); + histos.add("frac/data/sigma", "", kTProfile, {ptAxis}); + histos.addClone("frac/data/", "frac/mc/"); // FIXME: bug in writer/registry moves one histogram out of subfolder... + + histos.add("weight/pion", "", kTProfile, {ptAxis}); + histos.add("weight/kaon", "", kTProfile, {ptAxis}); + histos.add("weight/proton", "", kTProfile, {ptAxis}); + histos.add("weight/sigma", "", kTProfile, {ptAxis}); + + histos.add("weight/secDec", "", kTProfile, {ptAxis}); + histos.add("weight/secMat", "", kTProfile, {ptAxis}); + } +} + +void ParticleCompositionCorrection::process(aod::McCollisions::iterator const&, aod::McParticles const& particles) +{ + // determine dNdEta of the collision + float dNdEta = 0.f; + for (const auto& particle : particles) { + if (!particle.isPhysicalPrimary()) { + continue; + } + auto pdgParticle = pdg->GetParticle(particle.pdgCode()); + if (!pdgParticle || pdgParticle->Charge() == 0.) { + continue; + } + if (std::abs(particle.eta()) >= 0.5) { // o2-linter: disable=magic-number (particle density at mid-rapidity) + continue; + } + ++dNdEta; + } + + // fill particle composition table with corresponding weights + for (const auto& particle : particles) { + float weight = 1.f; + + // calculate weights only inside the configured kinematic range + if (std::abs(particle.eta()) < etaCut && particle.pt() > ptMinCut && particle.pt() < ptMaxCut) { + auto refParticleID = particle.index(); + + // find initial particle of secondaries from decays or interactions with material + while (!particles.iteratorAt(refParticleID).producedByGenerator() && particles.iteratorAt(refParticleID).has_mothers()) { + if (skipSec) { + break; + } + const auto& mother = particle.mothers_first_as(); + auto motherID = mother.globalIndex() - particles.offset(); + if (motherID == static_cast(refParticleID)) { + // FIXME: this needs to be investigated! + // LOGP(error, " - !!! particle is its own mother: {} (pdg: {}) status: {} ; process: {}", motherID, mother.pdgCode(), mother.getGenStatusCode(), mother.getProcess()); + break; + } + refParticleID = motherID; + } + + if (const auto& refParticle = particles.iteratorAt(refParticleID); refParticle.producedByGenerator()) { + + auto absPDGCode = std::abs(refParticle.pdgCode()); + // translate abs PDG code to PID variable of neural networks (0: pion, 1: kaon, 2: proton, 3: sigma) + static const std::map mapPID = { + {PDG_t::kPiPlus, 0.f}, + {PDG_t::kPi0, 0.f}, + {PDG_t::kKPlus, 1.f}, + {PDG_t::kK0Short, 1.f}, + {PDG_t::kK0Long, 1.f}, + {PDG_t::kProton, 2.f}, + {PDG_t::kNeutron, 2.f}, + {PDG_t::kSigmaPlus, 3.f}, + {PDG_t::kSigmaMinus, 3.f}, + {PDG_t::kLambda0, 3.f}, + {PDG_t::kSigma0, 3.f}, + {PDG_t::kXiMinus, 3.f}, + // TODO: potentially extend by xi0/eta/omega/rho/phi/Delta... + }; + + if (auto iterMapPID = mapPID.find(absPDGCode); iterMapPID != mapPID.end()) { + // LOGP(info, "scaling a {} with status code {} from process {}", particle.pdgCode(), particle.getGenStatusCode(), particle.getProcess()); + float pt = refParticle.pt(); + + // calculate particle fractions and corresponding weight for given reference particle + std::vector> input = {{dNdEta}, {pt}, {iterMapPID->second}}; + float fracData = particleFractionsData.evalModel(input)[0]; + float fracMC = particleFractionsMC.evalModel(input)[0]; + if (fracMC) { + weight = fracData / fracMC; + } + + if (enableQAHistos && std::abs(particle.eta()) < 0.8) { // o2-linter: disable=magic-number (usual range of charged-partilce measurements) + if (particle.isPhysicalPrimary()) { + if (iterMapPID->first == PDG_t::kPiPlus) { + histos.fill(HIST("frac/data/pion"), pt, fracData); + histos.fill(HIST("frac/mc/pion"), pt, fracMC); + histos.fill(HIST("weight/pion"), pt, weight); + } + if (iterMapPID->first == PDG_t::kKPlus) { + histos.fill(HIST("frac/data/kaon"), pt, fracData); + histos.fill(HIST("frac/mc/kaon"), pt, fracMC); + histos.fill(HIST("weight/kaon"), pt, weight); + } + if (iterMapPID->first == PDG_t::kProton) { + histos.fill(HIST("frac/data/proton"), pt, fracData); + histos.fill(HIST("frac/mc/proton"), pt, fracMC); + histos.fill(HIST("weight/proton"), pt, weight); + } + if (iterMapPID->first == PDG_t::kSigmaPlus || iterMapPID->first == PDG_t::kSigmaMinus) { + histos.fill(HIST("frac/data/sigma"), pt, fracData); + histos.fill(HIST("frac/mc/sigma"), pt, fracMC); + histos.fill(HIST("weight/sigma"), pt, weight); + } + } else { + auto pdgParticle = pdg->GetParticle(particle.pdgCode()); + if (pdgParticle && pdgParticle->Charge() != 0.) { + // fill the decay daughter info only (usually there is max. one parent generation so no relevant double counting here) + if (particle.getProcess() == TMCProcess::kPDecay) { + histos.fill(HIST("weight/secDec"), pt, weight); + } else if (particle.getProcess() == TMCProcess::kPHInhelastic) { + histos.fill(HIST("weight/secMat"), pt, weight); + } + } + } + } + } + } + } + pccTable(weight, weight, weight); // TODO: put here systematic variations of the weights + } +} From 9ec069f0045a4eae79289c66f5feb6c0bc863538 Mon Sep 17 00:00:00 2001 From: gitchrishub-oss Date: Tue, 14 Oct 2025 11:54:17 +0200 Subject: [PATCH 741/986] [PWGCF] Suggested improvements for resonance implementation (#13361) Co-authored-by: Christopher Klumm --- PWGCF/FemtoDream/Core/femtoDreamContainer.h | 2 +- PWGCF/FemtoDream/Core/femtoDreamResoSelection.h | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/PWGCF/FemtoDream/Core/femtoDreamContainer.h b/PWGCF/FemtoDream/Core/femtoDreamContainer.h index 75582365f37..2b58f0e9c5c 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamContainer.h +++ b/PWGCF/FemtoDream/Core/femtoDreamContainer.h @@ -270,7 +270,7 @@ class FemtoDreamContainer } if (extendedplots) { mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/relPairkstarmTPtPart1PtPart2MultPercentile"), femtoObs, mT, part1.pt(), part2.pt(), multPercentile); - if constexpr (std::is_same_v && std::is_same_v) { + if constexpr (requires { part1.mLambda(); part2.mLambda(); }) { mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/invMassPart1invMassPart2kstar"), part1.mLambda(), part2.mLambda(), femtoObs); } } diff --git a/PWGCF/FemtoDream/Core/femtoDreamResoSelection.h b/PWGCF/FemtoDream/Core/femtoDreamResoSelection.h index b9bff7ac239..ad18bbf9ff8 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamResoSelection.h +++ b/PWGCF/FemtoDream/Core/femtoDreamResoSelection.h @@ -65,7 +65,7 @@ class FemtoDreamResoSelection virtual ~FemtoDreamResoSelection() = default; template - uint32_t getType(V const& track1, V const& track2, bool resoIsNotAnti); + int getType(V const& track1, V const& track2, bool resoIsNotAnti); /// assigns value from configurbale to private class member template @@ -218,7 +218,7 @@ class FemtoDreamResoSelection }; // namespace femtoDream template -uint32_t FemtoDreamResoSelection::getType(V const& track1, V const& track2, bool resoIsNotAnti) +int FemtoDreamResoSelection::getType(V const& track1, V const& track2, bool resoIsNotAnti) { float posThresh = 0.; float negThresh = 0.; @@ -403,13 +403,9 @@ float FemtoDreamResoSelection::getNSigTotal(T const& track, V const& pid, float return std::abs(nSigTPC); } - float nSigTOF = 0.; - if (!track.hasTOF()) { - nSigTOF = 999.f; - } else { - nSigTOF = o2::aod::pidutils::tofNSigma(pid, track); - } - return std::sqrt(nSigTPC * nSigTPC + nSigTOF * nSigTOF); + float nSigTOF = track.hasTOF() ? o2::aod::pidutils::tofNSigma(pid, track) : 999.f; + + return std::hypot(nSigTPC, nSigTOF); } //// new getCutContainer From d4b6f53c6b418d65878c40554f4a9943e27cb8af Mon Sep 17 00:00:00 2001 From: Chiara De Martin <39315597+ChiaraDeMartin95@users.noreply.github.com> Date: Tue, 14 Oct 2025 14:10:03 +0200 Subject: [PATCH 742/986] [PWGLF] add additional histogram for resolution computation (#13370) Co-authored-by: Chiara De Martin --- PWGLF/TableProducer/Strangeness/cascadeflow.cxx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx index 13e384ad210..a2e7f295a3b 100644 --- a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx @@ -546,6 +546,8 @@ struct cascadeFlow { // histos.fill(HIST("psi2/QA/EP_TPCC_shifted"), coll.centFT0C(), psiTPCC + deltapsiTPCC); resolution.fill(HIST("QVectorsT0CTPCA_Shifted"), coll.centFT0C(), TMath::Cos(static_cast(nmode) * (psiT0C + deltapsiFT0C - psiTPCA - deltapsiTPCA))); resolution.fill(HIST("QVectorsT0CV0A_Shifted"), coll.centFT0C(), TMath::Cos(static_cast(nmode) * (psiT0C + deltapsiFT0C - psiV0A - deltapsiFV0A))); + resolution.fill(HIST("QVectorsV0ATPCC_Shifted"), coll.centFT0C(), TMath::Cos(static_cast(nmode) * (psiV0A + deltapsiFV0A - psiTPCC - deltapsiTPCC))); + resolution.fill(HIST("QVectorsV0ATPCA_Shifted"), coll.centFT0C(), TMath::Cos(static_cast(nmode) * (psiV0A + deltapsiFV0A - psiTPCA - deltapsiTPCA))); resolution.fill(HIST("QVectorsT0CTPCC_Shifted"), coll.centFT0C(), TMath::Cos(static_cast(nmode) * (psiT0C + deltapsiFT0C - psiTPCC - deltapsiTPCC))); resolution.fill(HIST("QVectorsTPCAC_Shifted"), coll.centFT0C(), TMath::Cos(static_cast(nmode) * (psiTPCA + deltapsiTPCA - psiTPCC - deltapsiTPCC))); return true; @@ -758,15 +760,21 @@ struct cascadeFlow { resolution.add("QVectorsT0CTPCC", "QVectorsT0CTPCC", HistType::kTH2F, {axisQVs, CentAxisPerCent}); resolution.add("QVectorsTPCAC", "QVectorsTPCAC", HistType::kTH2F, {axisQVs, CentAxisPerCent}); resolution.add("QVectorsT0CV0A", "QVectorsT0CV0A", HistType::kTH2F, {axisQVs, CentAxisPerCent}); + resolution.add("QVectorsV0ATPCC", "QVectorsV0ATPCC", HistType::kTH2F, {axisQVs, CentAxisPerCent}); + resolution.add("QVectorsV0ATPCA", "QVectorsV0ATPCA", HistType::kTH2F, {axisQVs, CentAxisPerCent}); resolution.add("QVectorsNormT0CTPCA", "QVectorsNormT0CTPCA", HistType::kTH2F, {axisQVsNorm, CentAxisPerCent}); resolution.add("QVectorsNormT0CTPCC", "QVectorsNormT0CTPCC", HistType::kTH2F, {axisQVsNorm, CentAxisPerCent}); resolution.add("QVectorsNormTPCAC", "QVectorsNormTPCCB", HistType::kTH2F, {axisQVsNorm, CentAxisPerCent}); resolution.add("QVectorsNormT0CV0A", "QVectorsNormT0CV0A", HistType::kTH2F, {axisQVs, CentAxisPerCent}); + resolution.add("QVectorsNormV0ATPCC", "QVectorsNormV0ATPCC", HistType::kTH2F, {axisQVs, CentAxisPerCent}); + resolution.add("QVectorsNormV0ATPCA", "QVectorsNormV0ATPCA", HistType::kTH2F, {axisQVs, CentAxisPerCent}); resolution.add("QVectorsSpecPlane", "QVectorsSpecPlane", HistType::kTH2F, {axisQVsNorm, CentAxisPerCent}); resolution.add("QVectorsT0CTPCA_Shifted", "QVectorsT0CTPCA_Shifted", HistType::kTH2F, {axisQVs, CentAxisPerCent}); resolution.add("QVectorsT0CTPCC_Shifted", "QVectorsT0CTPCC_Shifted", HistType::kTH2F, {axisQVs, CentAxisPerCent}); resolution.add("QVectorsTPCAC_Shifted", "QVectorsTPCAC_Shifted", HistType::kTH2F, {axisQVs, CentAxisPerCent}); resolution.add("QVectorsT0CV0A_Shifted", "QVectorsT0CV0A_Shifted", HistType::kTH2F, {axisQVs, CentAxisPerCent}); + resolution.add("QVectorsV0ATPCC_Shifted", "QVectorsV0ATPCC_Shifted", HistType::kTH2F, {axisQVs, CentAxisPerCent}); + resolution.add("QVectorsV0ATPCA_Shifted", "QVectorsV0ATPCA_Shifted", HistType::kTH2F, {axisQVs, CentAxisPerCent}); histos.add("ShiftFT0C", "ShiftFT0C", kTProfile3D, {CentAxis, basisAxis, shiftAxis}); histos.add("ShiftFV0A", "ShiftFV0A", kTProfile3D, {CentAxis, basisAxis, shiftAxis}); @@ -1780,10 +1788,15 @@ struct cascadeFlow { resolution.fill(HIST("QVectorsT0CTPCC"), eventplaneVecT0C.Dot(eventplaneVecTPCC), collisionCentrality); resolution.fill(HIST("QVectorsTPCAC"), eventplaneVecTPCA.Dot(eventplaneVecTPCC), collisionCentrality); resolution.fill(HIST("QVectorsT0CV0A"), eventplaneVecT0C.Dot(eventplaneVecV0A), collisionCentrality); + resolution.fill(HIST("QVectorsV0ATPCC"), eventplaneVecV0A.Dot(eventplaneVecTPCC), collisionCentrality); + resolution.fill(HIST("QVectorsV0ATPCA"), eventplaneVecV0A.Dot(eventplaneVecTPCA), collisionCentrality); + resolution.fill(HIST("QVectorsNormT0CTPCA"), eventplaneVecT0C.Dot(eventplaneVecTPCA) / (coll.qTPCR() * coll.sumAmplFT0C()), collisionCentrality); resolution.fill(HIST("QVectorsNormT0CTPCC"), eventplaneVecT0C.Dot(eventplaneVecTPCC) / (coll.qTPCL() * coll.sumAmplFT0C()), collisionCentrality); resolution.fill(HIST("QVectorsNormTPCAC"), eventplaneVecTPCA.Dot(eventplaneVecTPCC) / (coll.qTPCR() * coll.qTPCL()), collisionCentrality); resolution.fill(HIST("QVectorsNormT0CV0A"), eventplaneVecT0C.Dot(eventplaneVecV0A) / (coll.sumAmplFT0C() * coll.sumAmplFV0A()), collisionCentrality); + resolution.fill(HIST("QVectorsNormV0ATPCC"), eventplaneVecV0A.Dot(eventplaneVecTPCC) / (coll.qTPCL() * coll.sumAmplFV0A()), collisionCentrality); + resolution.fill(HIST("QVectorsNormV0ATPCA"), eventplaneVecV0A.Dot(eventplaneVecTPCA) / (coll.qTPCR() * coll.sumAmplFV0A()), collisionCentrality); std::vector bdtScore[nParticles]; for (auto const& v0 : V0s) { From eb76c69edc02f8d0637944bd11a59d39fe28fdb9 Mon Sep 17 00:00:00 2001 From: JStaa <39123272+JStaa@users.noreply.github.com> Date: Tue, 14 Oct 2025 15:54:29 +0200 Subject: [PATCH 743/986] [PWGCF] Added a finer centrality binning for the particle spectra (#13368) Co-authored-by: ALICE Action Bot --- .../Tasks/threeParticleCorrelations.cxx | 44 +++++++++++-------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx b/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx index 1d48979d432..dabfe3205af 100644 --- a/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx +++ b/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx @@ -13,20 +13,24 @@ /// \brief Task for producing particle correlations /// \author Joey Staa -#include +#include "RecoDecay.h" + +#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "CCDB/BasicCCDBManager.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/McCollisionExtra.h" #include "Common/DataModel/PIDResponse.h" + +#include "CCDB/BasicCCDBManager.h" #include "DataFormatsParameters/GRPMagField.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" -#include "RecoDecay.h" #include "TPDGCode.h" +#include +#include + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -161,8 +165,12 @@ struct ThreeParticleCorrelations { void init(InitContext const&) { + // Bins of variable width + std::vector fineCentBins = {0.0, 2.0, 4.0, 7.0, 10.0, 15.0, 20.0, 25.0, 30.0, 35.0, 40.0, 45.0, 50.0, 60.0, 70.0, 80.0, 90.0}; + // Histograms axes const AxisSpec centralityAxis{confCentBins}; + const AxisSpec fineCentralityAxis{fineCentBins}; const AxisSpec zvtxAxis{confZvtxBins}; const AxisSpec dPhiAxis{36, (-1. / 2) * constants::math::PI, (3. / 2) * constants::math::PI}; const AxisSpec dEtaAxis{32, -1.52, 1.52}; @@ -187,18 +195,18 @@ struct ThreeParticleCorrelations { rQARegistry.add("hTrackPhi", "hTrackPhi", {HistType::kTH1D, {{100, (-1. / 2) * constants::math::PI, (5. / 2) * constants::math::PI}}}); rQARegistry.add("hTrackNSharedClusters", "hTrackNSharedClusters", {HistType::kTH1D, {{200, 0, 200}}}); - rQARegistry.add("hPtPion_Uncorrected", "hPtPion_Uncorrected", {HistType::kTH3D, {{trackPtAxis}, {centralityAxis}, {2, -2, 2}}}); - rQARegistry.add("hPtKaon_Uncorrected", "hPtKaon_Uncorrected", {HistType::kTH3D, {{trackPtAxis}, {centralityAxis}, {2, -2, 2}}}); - rQARegistry.add("hPtProton_Uncorrected", "hPtProton_Uncorrected", {HistType::kTH3D, {{trackPtAxis}, {centralityAxis}, {2, -2, 2}}}); - rQARegistry.add("hPtV0_Uncorrected", "hPtV0_Uncorrected", {HistType::kTH3D, {{v0PtAxis}, {centralityAxis}, {2, -2, 2}}}); - rQARegistry.add("hPtPion_Corrected", "hPtPion_Corrected", {HistType::kTH3D, {{trackPtAxis}, {centralityAxis}, {2, -2, 2}}}); - rQARegistry.add("hPtKaon_Corrected", "hPtKaon_Corrected", {HistType::kTH3D, {{trackPtAxis}, {centralityAxis}, {2, -2, 2}}}); - rQARegistry.add("hPtProton_Corrected", "hPtProton_Corrected", {HistType::kTH3D, {{trackPtAxis}, {centralityAxis}, {2, -2, 2}}}); - rQARegistry.add("hPtV0_Corrected", "hPtV0_Corrected", {HistType::kTH3D, {{v0PtAxis}, {centralityAxis}, {2, -2, 2}}}); - rQARegistry.add("hPtPion_MC", "hPtPion_MC", {HistType::kTH3D, {{trackPtAxis}, {centralityAxis}, {2, -2, 2}}}); - rQARegistry.add("hPtKaon_MC", "hPtKaon_MC", {HistType::kTH3D, {{trackPtAxis}, {centralityAxis}, {2, -2, 2}}}); - rQARegistry.add("hPtProton_MC", "hPtProton_MC", {HistType::kTH3D, {{trackPtAxis}, {centralityAxis}, {2, -2, 2}}}); - rQARegistry.add("hPtV0_MC", "hPtV0_MC", {HistType::kTH3D, {{v0PtAxis}, {centralityAxis}, {2, -2, 2}}}); + rQARegistry.add("hPtPion_Uncorrected", "hPtPion_Uncorrected", {HistType::kTH3D, {{trackPtAxis}, {fineCentralityAxis}, {2, -2, 2}}}); + rQARegistry.add("hPtKaon_Uncorrected", "hPtKaon_Uncorrected", {HistType::kTH3D, {{trackPtAxis}, {fineCentralityAxis}, {2, -2, 2}}}); + rQARegistry.add("hPtProton_Uncorrected", "hPtProton_Uncorrected", {HistType::kTH3D, {{trackPtAxis}, {fineCentralityAxis}, {2, -2, 2}}}); + rQARegistry.add("hPtV0_Uncorrected", "hPtV0_Uncorrected", {HistType::kTH3D, {{v0PtAxis}, {fineCentralityAxis}, {2, -2, 2}}}); + rQARegistry.add("hPtPion_Corrected", "hPtPion_Corrected", {HistType::kTH3D, {{trackPtAxis}, {fineCentralityAxis}, {2, -2, 2}}}); + rQARegistry.add("hPtKaon_Corrected", "hPtKaon_Corrected", {HistType::kTH3D, {{trackPtAxis}, {fineCentralityAxis}, {2, -2, 2}}}); + rQARegistry.add("hPtProton_Corrected", "hPtProton_Corrected", {HistType::kTH3D, {{trackPtAxis}, {fineCentralityAxis}, {2, -2, 2}}}); + rQARegistry.add("hPtV0_Corrected", "hPtV0_Corrected", {HistType::kTH3D, {{v0PtAxis}, {fineCentralityAxis}, {2, -2, 2}}}); + rQARegistry.add("hPtPion_MC", "hPtPion_MC", {HistType::kTH3D, {{trackPtAxis}, {fineCentralityAxis}, {2, -2, 2}}}); + rQARegistry.add("hPtKaon_MC", "hPtKaon_MC", {HistType::kTH3D, {{trackPtAxis}, {fineCentralityAxis}, {2, -2, 2}}}); + rQARegistry.add("hPtProton_MC", "hPtProton_MC", {HistType::kTH3D, {{trackPtAxis}, {fineCentralityAxis}, {2, -2, 2}}}); + rQARegistry.add("hPtV0_MC", "hPtV0_MC", {HistType::kTH3D, {{v0PtAxis}, {fineCentralityAxis}, {2, -2, 2}}}); rQARegistry.add("hdEdx", "hdEdx", {HistType::kTH2D, {{120, -3.0, 3.0}, {180, 20, 200}}}); rQARegistry.add("hdEdxPion", "hdEdxPion", {HistType::kTH2D, {{120, -3.0, 3.0}, {180, 20, 200}}}); From 82ed8da26247722ef05a5cf74c137f81ccf70797 Mon Sep 17 00:00:00 2001 From: Giorgio Alberto Lucia <87222843+GiorgioAlbertoLucia@users.noreply.github.com> Date: Tue, 14 Oct 2025 16:27:21 +0200 Subject: [PATCH 744/986] [PWGLF] fixed issues in nucleiqc (#13382) Co-authored-by: ALICE Action Bot --- PWGLF/TableProducer/QC/nucleiQC.cxx | 4 ++-- PWGLF/Utils/nucleiUtils.h | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/PWGLF/TableProducer/QC/nucleiQC.cxx b/PWGLF/TableProducer/QC/nucleiQC.cxx index 86460ba0688..398d57de0ec 100644 --- a/PWGLF/TableProducer/QC/nucleiQC.cxx +++ b/PWGLF/TableProducer/QC/nucleiQC.cxx @@ -380,7 +380,7 @@ struct nucleiQC { mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3DCAzVsPtVsCentrality"), candidate.pt, candidate.DCAz, candidate.centrality); mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3BetaVsPtVsCentrality"), candidate.pt, candidate.beta, candidate.centrality); mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3dEdxVsPVsCentrality"), candidate.pt, candidate.TPCsignal, candidate.centrality); - mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3ClusterSizeVsPtVsCentrality"), mPidManagers[kIndex].getClusterSizeCosLambdaITS(candidate.clusterSizesITS, candidate.eta), candidate.pt, candidate.centrality); + mHistograms.fill(HIST(nuclei::cNames[kIndex]) + HIST("/h3ClusterSizeVsPtVsCentrality"), candidate.pt, mPidManagers[kIndex].getClusterSizeCosLambdaITS(candidate.clusterSizesITS, candidate.eta), candidate.centrality); } } @@ -409,7 +409,7 @@ struct nucleiQC { if (track.has_mcParticle()) { const auto& particle = track.mcParticle(); if (cfgDoCheckPdgCode) { - if (particle.pdgCode() != nuclei::pdgCodes[kSpeciesRt]) + if (std::abs(particle.pdgCode()) != nuclei::pdgCodes[kSpeciesRt]) return; } if ((particle.y() - cfgRapidityCenterMass) < cfgRapidityMin || (particle.y() - cfgRapidityCenterMass) > cfgRapidityMax) { diff --git a/PWGLF/Utils/nucleiUtils.h b/PWGLF/Utils/nucleiUtils.h index 5a54390067d..9f98c60e69a 100644 --- a/PWGLF/Utils/nucleiUtils.h +++ b/PWGLF/Utils/nucleiUtils.h @@ -348,7 +348,7 @@ bool eventSelection(const Tcollision& collision, HistogramRegistry& registry, La template float getCentrality(Tcollision const& collision, const int centralityEstimator) { - if constexpr (!o2::aod::HasCentrality) { + if constexpr (!o2::aod::HasCentrality) { // requires aod::CentFV0As, aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs, aod::CentNTPVs return -1.f; } if (centralityEstimator == centDetectors::kFV0A) { @@ -475,6 +475,7 @@ class PidManager } } + // ITS template float getClusterSizeCosLambdaITS(const Ttrack& track) { @@ -508,7 +509,7 @@ class PidManager // TPC float getExpectedTPCsignal(const float p) { - if (!mUseTpcCentralCalibration) + if (mUseTpcCentralCalibration) return -999.f; float pScaled = p * mMomScaling[0] + mMomScaling[1]; @@ -524,7 +525,7 @@ class PidManager template float getNSigmaTPC(const Ttrack& track) { - if (!mUseTpcCentralCalibration) { + if (mUseTpcCentralCalibration) { return getNSigmaTPCcentral(track); } float expectedSignal = getExpectedTPCsignal(track.tpcInnerParam()); From 7e358b19125c42247aa46a68e383a6561b8d8f97 Mon Sep 17 00:00:00 2001 From: Gyula Bencedi Date: Tue, 14 Oct 2025 16:37:03 +0200 Subject: [PATCH 745/986] [PWGLF] Add more efficiency histos for reassociation (#13374) --- PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx | 574 +++++++++++++++++++++++------ 1 file changed, 471 insertions(+), 103 deletions(-) diff --git a/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx b/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx index 85dd80b7bf8..20be3691600 100644 --- a/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx +++ b/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx @@ -85,9 +85,21 @@ enum TrkBestSel { nTrkBestSel }; +enum AmbTrkType { + kNonAmb = 0, + kOrphan = 1, + kNonAmbSame = 2, + kAmb = 3, + kAmbGt1 = 4, + nAmbTrkType +}; + struct DndetaMFTPbPb { SliceCache cache; + std::array, 4> hCollAssoc; + std::array, 4> hReAssoc; + enum OccupancyEst { TrkITS = 1, Ft0C }; @@ -108,6 +120,7 @@ struct DndetaMFTPbPb { Configurable cfgIRSource{"cfgIRSource", "ZNC hadronic", "Estimator of the interaction rate (Pb-Pb: ZNC hadronic)"}; Configurable cfgUseTrackSel{"cfgUseTrackSel", false, "Flag to apply track selection"}; Configurable cfgUseParticleSel{"cfgUseParticleSel", false, "Flag to apply particle selection"}; + Configurable cfgRemoveTrivialAssoc{"cfgRemoveTrivialAssoc", false, "Skip trivial associations"}; struct : ConfigurableGroup { ConfigurableAxis interactionRateBins{"interactionRateBins", {500, 0, 50}, "Binning for the interaction rate (kHz)"}; @@ -121,7 +134,7 @@ struct DndetaMFTPbPb { ConfigurableAxis ptBins{"ptBins", {101, -0.5, 10.5}, "pT binning (GeV/c)"}; ConfigurableAxis multBins{"multBins", {701, -0.5, 700.5}, "Multiplicity binning"}; ConfigurableAxis zvtxBins{"zvtxBins", {60, -30., 30.}, "Z-vtx binning (cm)"}; - ConfigurableAxis deltaZBins{"deltaZBins", {120, -6., 6.}, "Delta Z-vtx binning (cm)"}; + ConfigurableAxis deltaZBins{"deltaZBins", {800, -10., 10.}, "Delta Z-vtx binning (cm)"}; ConfigurableAxis dcaXYBins{"dcaXYBins", {800, -1., 1.}, "DCAxy binning (cm)"}; ConfigurableAxis dcaZBins{"dcaZBins", {800, -1., 1.}, "DCAz binning (cm)"}; ConfigurableAxis phiBins{"phiBins", {629, 0., TwoPI}, "#varphi binning (rad)"}; @@ -397,6 +410,22 @@ struct DndetaMFTPbPb { {"Tracks/ReTracksPhiEta", "; #varphi; #eta; occupancy", {HistType::kTHnSparseF, {phiAxis, etaAxis, occupancyAxis}}}); + qaregistry.add( + {"Tracks/OrigTracksEtaZvtx", + "; #eta; #it{z}_{vtx} (cm); occupancy", + {HistType::kTHnSparseF, {etaAxis, zAxis, occupancyAxis}}}); + qaregistry.add( + {"Tracks/OrigTracksPhiEta", + "; #varphi; #eta; occupancy", + {HistType::kTHnSparseF, {phiAxis, etaAxis, occupancyAxis}}}); + qaregistry.add( + {"Tracks/RestTracksEtaZvtx", + "; #eta; #it{z}_{vtx} (cm); occupancy", + {HistType::kTHnSparseF, {etaAxis, zAxis, occupancyAxis}}}); + qaregistry.add( + {"Tracks/RestTracksPhiEta", + "; #varphi; #eta; occupancy", + {HistType::kTHnSparseF, {phiAxis, etaAxis, occupancyAxis}}}); qaregistry.add({"Tracks/TrackAmbDegree", "; N_{coll}^{comp}; occupancy", {HistType::kTH2F, {{51, -0.5, 50.5}, occupancyAxis}}}); @@ -519,6 +548,22 @@ struct DndetaMFTPbPb { "; #varphi; #eta; occupancy", {HistType::kTHnSparseF, {phiAxis, etaAxis, centralityAxis, occupancyAxis}}}); + qaregistry.add({"Tracks/Centrality/OrigTracksEtaZvtx", + "; #eta; #it{z}_{vtx} (cm); occupancy", + {HistType::kTHnSparseF, + {etaAxis, zAxis, centralityAxis, occupancyAxis}}}); + qaregistry.add({"Tracks/Centrality/OrigTracksPhiEta", + "; #varphi; #eta; occupancy", + {HistType::kTHnSparseF, + {phiAxis, etaAxis, centralityAxis, occupancyAxis}}}); + qaregistry.add({"Tracks/Centrality/RestTracksEtaZvtx", + "; #eta; #it{z}_{vtx} (cm); occupancy", + {HistType::kTHnSparseF, + {etaAxis, zAxis, centralityAxis, occupancyAxis}}}); + qaregistry.add({"Tracks/Centrality/RestTracksPhiEta", + "; #varphi; #eta; occupancy", + {HistType::kTHnSparseF, + {phiAxis, etaAxis, centralityAxis, occupancyAxis}}}); } } @@ -618,6 +663,64 @@ struct DndetaMFTPbPb { {HistType::kTHnSparseF, {multAxis, zAxis, centralityAxis}}}); } + if (doprocessTrkEffIdxBestInlusive) { + qaregistry.add({"Tracks/hPtEtaEffGenBest", + "; p_{T} (GeV/c); #eta", + {HistType::kTH2F, + {ptAxis, etaAxis}}}); + qaregistry.add({"Tracks/hPtEtaEffPrimBest", + "; p_{T} (GeV/c); #eta", + {HistType::kTH2F, + {ptAxis, etaAxis}}}); + qaregistry.add({"Tracks/hPtEtaEffSecBest", + "; p_{T} (GeV/c); #eta", + {HistType::kTH2F, + {ptAxis, etaAxis}}}); + qaregistry.add({"Tracks/hPtEtaEffGenDuplBest", + "; p_{T} (GeV/c); #eta", + {HistType::kTH2F, + {ptAxis, etaAxis}}}); + qaregistry.add({"Tracks/hPtEtaEffDuplBest", + "; p_{T} (GeV/c); #eta", + {HistType::kTH2F, + {ptAxis, etaAxis}}}); + qaregistry.add({"Tracks/NmftTrkPerPartBest", + "; #it{N}_{mft tracks per particle}", + {HistType::kTH1F, {multAxis}}}); + } + + if (doprocessTrkEffIdxBestCentFT0C) { + qaregistry.add( + {"Tracks/Centrality/hPtEtaEffGenBest", + "; p_{T} (GeV/c); #eta; centrality", + {HistType::kTHnSparseF, + {ptAxis, etaAxis, centralityAxis}}}); + qaregistry.add( + {"Tracks/Centrality/hPtEtaEffPrimBest", + "; p_{T} (GeV/c); #eta; centrality", + {HistType::kTHnSparseF, + {ptAxis, etaAxis, centralityAxis}}}); + qaregistry.add( + {"Tracks/Centrality/hPtEtaEffSecBest", + "; p_{T} (GeV/c); #eta; Z_{vtx} (cm)", + {HistType::kTHnSparseF, + {ptAxis, etaAxis, centralityAxis}}}); + qaregistry.add( + {"Tracks/Centrality/hPtEtaEffGenDuplBest", + "; p_{T} (GeV/c); #eta; centrality", + {HistType::kTHnSparseF, + {ptAxis, etaAxis, centralityAxis}}}); + qaregistry.add( + {"Tracks/Centrality/hPtEtaEffDuplBest", + "; p_{T} (GeV/c); #eta; centrality", + {HistType::kTHnSparseF, + {ptAxis, etaAxis, centralityAxis}}}); + qaregistry.add( + {"Tracks/Centrality/NmftTrkPerPartBest", + "; #it{N}_{mft tracks per particle}; centrality", + {HistType::kTHnSparseF, {multAxis, centralityAxis}}}); + } + if (doprocessTrkEffIdxInlusive) { qaregistry.add({"Tracks/hPtEtaEffGen", "; p_{T} (GeV/c); #eta; occupancy", @@ -743,36 +846,71 @@ struct DndetaMFTPbPb { {{100, 0., 1.}, centralityAxis, occupancyAxis}}}); } - if (doprocessCheckAmbiguousMftTracksInclusive) { + if (doprocessCheckAmbiguousMftTracks) { qaregistry.add({"Tracks/hMftTracksAmbDegree", " ; N_{coll}^{comp}", {HistType::kTH1F, {{41, -0.5, 40.5}}}}); - qaregistry.add({"Tracks/hMftTracksAmbDegreeWoTrivial", + qaregistry.add({"Tracks/hMftTracksAmbDegreeWithTrivial", " ; N_{coll}^{comp}", {HistType::kTH1F, {{41, -0.5, 40.5}}}}); - qaregistry.add({"Tracks/hAmbTrackType", - " ; Ambiguous track type; occupancy", - {HistType::kTH1F, {{5, -0.5, 4.5}}}}); - qaregistry.add({"Tracks/histAmbZvtx", - "#it{z}_{vtx} of collisions associated to a " - "track;#it{z}_{vtx} (cm);", - {HistType::kTH1F, {zAxis}}}); - } - - if (doprocessCheckAmbiguousMftTracksCentFT0C) { - qaregistry.add({"Tracks/Centrality/hMftTracksAmbDegree", - " ; N_{coll}^{comp}; centrality", - {HistType::kTH2F, - {{41, -0.5, 40.5}, centralityAxis}}}); - qaregistry.add({"Tracks/Centrality/hMftTracksAmbDegreeWoTrivial", - " ; N_{coll}^{comp}; centrality", - {HistType::kTH2F, - {{41, -0.5, 40.5}, centralityAxis}}}); - qaregistry.add({"Tracks/Centrality/hAmbTrackType", - " ; Ambiguous track type; centrality", - {HistType::kTH2F, - {{5, -0.5, 4.5}, centralityAxis}}}); - } + // qaregistry.add({"Tracks/hAmbTrackType", + // " ; Ambiguous track type", + // {HistType::kTH1F, {{5, -0.5, 4.5}}}}); + + qaregistry.add("Tracks/hAmbTrackType", "hAmbTrackType", {HistType::kTH1F, {{AmbTrkType::nAmbTrkType, -0.5, +AmbTrkType::nAmbTrkType - 0.5}}}); + std::string labelAmbiguity[AmbTrkType::nAmbTrkType]; + labelAmbiguity[AmbTrkType::kOrphan] = "orphan"; + labelAmbiguity[AmbTrkType::kNonAmb] = "nonAmbiguous"; + labelAmbiguity[AmbTrkType::kNonAmbSame] = "trkInCollTabHasSameAssoc"; + labelAmbiguity[AmbTrkType::kAmb] = "trkInCollTabHasDiffAssoc"; + labelAmbiguity[AmbTrkType::kAmbGt1] = "trkInCollTabHasGt1Assoc"; + qaregistry.get(HIST("Tracks/hAmbTrackType"))->SetMinimum(0.1); + + for (int iBin = 0; iBin < AmbTrkType::nAmbTrkType; iBin++) { + qaregistry.get(HIST("Tracks/hAmbTrackType"))->GetXaxis()->SetBinLabel(iBin + 1, labelAmbiguity[iBin].data()); + } + } + + if (doprocessCollAssocMC) { + // tracks not associated to any collision + hCollAssoc[0] = qaregistry.add("TrackToColl/hNonAssocTracks", ";#it{p}_{T}^{reco} (GeV/#it{c});#it{#eta}^{reco};#it{Z}_{vtx}^{reco}#minus#it{Z}_{vtx}^{gen} (cm)", HistType::kTHnSparseF, {ptAxis, etaAxis, deltaZAxis}); + // tracks associasted to a collision + hCollAssoc[1] = qaregistry.add("TrackToColl/hAssocTracks", ";#it{p}_{T}^{reco} (GeV/#it{c});#it{#eta}^{reco};#it{Z}_{vtx}^{reco}#minus#it{Z}_{vtx}^{gen} (cm)", HistType::kTHnSparseF, {ptAxis, etaAxis, deltaZAxis}); + // tracks associated to the correct collision considering only first reco collision (based on the MC collision index) + hCollAssoc[2] = qaregistry.add("TrackToColl/hGoodAssocTracks", ";#it{p}_{T}^{reco} (GeV/#it{c});#it{#eta}^{reco};#it{Z}_{vtx}^{reco}#minus#it{Z}_{vtx}^{gen} (cm)", HistType::kTHnSparseF, {ptAxis, etaAxis, deltaZAxis}); + // tracks associated to the correct collision considering all ambiguous reco collisions (based on the MC collision index) + hCollAssoc[3] = qaregistry.add("TrackToColl/hGoodAssocTracksAmb", ";#it{p}_{T}^{reco} (GeV/#it{c});#it{#eta}^{reco};#it{Z}_{vtx}^{reco}#minus#it{Z}_{vtx}^{gen} (cm)", HistType::kTHnSparseF, {ptAxis, etaAxis, deltaZAxis}); + + qaregistry.add("TrackToColl/histFracTracksFakeMcColl", "Fraction of tracks originating from fake collision; fraction; entries", {HistType::kTH1F, {{101, 0., 1.01}}}); + qaregistry.add("TrackToColl/histFracGoodTracks", "Fraction of tracks originating from the correct collision; fraction; entries", {HistType::kTH1F, {{101, 0., 1.01}}}); + qaregistry.add("TrackToColl/histAmbTrackNumColls", "Number of collisions associated to an ambiguous track; no. collisions; entries", {HistType::kTH1F, {{30, -0.5, 29.5}}}); + } + + if (doprocessReAssocMC) { + // tracks not associated to any collision + hReAssoc[0] = qaregistry.add("ReAssoc/hNonAssocTracks", ";#it{p}_{T}^{reco} (GeV/#it{c});#it{#eta}^{reco};#it{Z}_{vtx}^{reco}#minus#it{Z}_{vtx}^{gen} (cm)", HistType::kTHnSparseF, {ptAxis, etaAxis, deltaZAxis}); + // tracks associasted to a collision + hReAssoc[1] = qaregistry.add("ReAssoc/hAssocTracks", ";#it{p}_{T}^{reco} (GeV/#it{c});#it{#eta}^{reco};#it{Z}_{vtx}^{reco}#minus#it{Z}_{vtx}^{gen} (cm)", HistType::kTHnSparseF, {ptAxis, etaAxis, deltaZAxis}); + // tracks associated to the correct collision considering only first reco collision (based on the MC collision index) + hReAssoc[2] = qaregistry.add("ReAssoc/hGoodAssocTracks", ";#it{p}_{T}^{reco} (GeV/#it{c});#it{#eta}^{reco};#it{Z}_{vtx}^{reco}#minus#it{Z}_{vtx}^{gen} (cm)", HistType::kTHnSparseF, {ptAxis, etaAxis, deltaZAxis}); + // tracks associated to the correct collision considering all ambiguous reco collisions (based on the MC collision index) + hReAssoc[3] = qaregistry.add("ReAssoc/hGoodAssocTracksAmb", ";#it{p}_{T}^{reco} (GeV/#it{c});#it{#eta}^{reco};#it{Z}_{vtx}^{reco}#minus#it{Z}_{vtx}^{gen} (cm)", HistType::kTHnSparseF, {ptAxis, etaAxis, deltaZAxis}); + } + + // if (doprocessCheckAmbiguousMftTracksCentFT0C) { + // qaregistry.add({"Tracks/Centrality/hMftTracksAmbDegree", + // " ; N_{coll}^{comp}; centrality", + // {HistType::kTH2F, + // {{41, -0.5, 40.5}, centralityAxis}}}); + // qaregistry.add({"Tracks/Centrality/hMftTracksAmbDegreeWithTrivial", + // " ; N_{coll}^{comp}; centrality", + // {HistType::kTH2F, + // {{41, -0.5, 40.5}, centralityAxis}}}); + // qaregistry.add({"Tracks/Centrality/hAmbTrackType", + // " ; Ambiguous track type; centrality", + // {HistType::kTH2F, + // {{5, -0.5, 4.5}, centralityAxis}}}); + // } if (doprocessEfficiencyInclusive) { qaregistry.add({"Tracks/hEffRec", @@ -824,6 +962,11 @@ struct DndetaMFTPbPb { qaregistry.add({"Tracks/hDCAzBestPtRec", "; p_{T} (GeV/c) ; DCA_{Z} (cm)", {HistType::kTH2F, {ptAxis, dcazAxis}}}); qaregistry.add({"Tracks/hDCAxyBestRec", "; DCA_{XY} (cm)", {HistType::kTH1F, {dcaxyAxis}}}); qaregistry.add({"Tracks/hDCAzBestRec", "; DCA_{Z} (cm)", {HistType::kTH1F, {dcazAxis}}}); + // + qaregistry.add({"Tracks/THnDCAxyBestGenPrim", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); DCA_{XY} (cm); DCA_{Z} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, dcaxyAxis, dcazAxis}}}); + qaregistry.add({"Tracks/THnDCAxyBestGenSecWeak", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); DCA_{XY} (cm); DCA_{Z} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, dcaxyAxis, dcazAxis}}}); + qaregistry.add({"Tracks/THnDCAxyBestGenSecMat", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); DCA_{XY} (cm); DCA_{Z} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, dcaxyAxis, dcazAxis}}}); + qaregistry.add({"Tracks/THnDCAxyBestRec", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); DCA_{XY} (cm); DCA_{Z} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, dcaxyAxis, dcazAxis}}}); } if (doprocessDCAMcCentFT0C) { qaregistry.add({"Tracks/Centrality/hDCAxBestGenPrim", "; DCA_{x}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); @@ -845,6 +988,11 @@ struct DndetaMFTPbPb { qaregistry.add({"Tracks/Centrality/hDCAzBestPtRec", "; p_{T} (GeV/c) ; DCA_{Z} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, dcazAxis, centralityAxis}}}); qaregistry.add({"Tracks/Centrality/hDCAxyBestRec", "; DCA_{XY} (cm); centrality", {HistType::kTH2F, {dcaxyAxis, centralityAxis}}}); qaregistry.add({"Tracks/Centrality/hDCAzBestRec", "; DCA_{Z} (cm); centrality", {HistType::kTH2F, {dcazAxis, centralityAxis}}}); + // + qaregistry.add({"Tracks/Centrality/THnDCAxyBestGenPrim", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); DCA_{XY} (cm); DCA_{Z} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, dcaxyAxis, dcazAxis, centralityAxis}}}); + qaregistry.add({"Tracks/Centrality/THnDCAxyBestGenSecWeak", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); DCA_{XY} (cm); DCA_{Z} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, dcaxyAxis, dcazAxis, centralityAxis}}}); + qaregistry.add({"Tracks/Centrality/THnDCAxyBestGenSecMat", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); DCA_{XY} (cm); DCA_{Z} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, dcaxyAxis, dcazAxis, centralityAxis}}}); + qaregistry.add({"Tracks/Centrality/THnDCAxyBestRec", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); DCA_{XY} (cm); DCA_{Z} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, dcaxyAxis, dcazAxis, centralityAxis}}}); } } @@ -874,16 +1022,23 @@ struct DndetaMFTPbPb { using CollCentFT0C = CollsCentFT0C::iterator; using CollsGenCentFT0C = soa::Join; + using CollisionsWithMCLabels = soa::Join; + using CollGenCent = CollsGenCentFT0C::iterator; using CollsCorr = soa::Join; // Tracks using MFTTracksLabeled = soa::Join; using MftTracksWColls = soa::Join; + using MftTracksWCollsMC = soa::Join; + + using BestTracksMC = soa::Join; /// Filtered tables using FiltMftTracks = soa::Filtered; using FiltMcMftTracks = soa::Filtered; using FiltBestTracks = soa::Filtered; + using FiltMcBestTracks = soa::Filtered; + using FiltParticles = soa::Filtered; template @@ -1087,30 +1242,43 @@ struct DndetaMFTPbPb { } for (auto const& track : tracks) { - if (std::find(ambiguousTrkIds.begin(), ambiguousTrkIds.end(), track.globalIndex()) != ambiguousTrkIds.end()) { + if (!isTrackSelected(track)) { continue; } - if (std::find(reassignedTrkIds.begin(), reassignedTrkIds.end(), track.globalIndex()) != reassignedTrkIds.end()) { + float phi = track.phi(); + o2::math_utils::bringTo02Pi(phi); + if (phi < kZero || TwoPI < phi) { continue; } - if (!isTrackSelected(track)) { + if (fillHis) { + if constexpr (has_reco_cent) { + qaregistry.fill(HIST("Tracks/Centrality/OrigTracksEtaZvtx"), track.eta(), z, c, occ); + qaregistry.fill(HIST("Tracks/Centrality/OrigTracksPhiEta"), phi, track.eta(), c, occ); + } else { + qaregistry.fill(HIST("Tracks/OrigTracksEtaZvtx"), track.eta(), z, occ); + qaregistry.fill(HIST("Tracks/OrigTracksPhiEta"), phi, track.eta(), occ); + } + } + if (std::find(ambiguousTrkIds.begin(), ambiguousTrkIds.end(), track.globalIndex()) != ambiguousTrkIds.end()) { + continue; + } + if (std::find(reassignedTrkIds.begin(), reassignedTrkIds.end(), track.globalIndex()) != reassignedTrkIds.end()) { continue; } ++nATrk; if (fillHis) { - float phi = track.phi(); - o2::math_utils::bringTo02Pi(phi); - if (phi < kZero || TwoPI < phi) { - continue; - } if constexpr (has_reco_cent) { - registry.fill(HIST("Tracks/Centrality/EtaZvtxBest"), track.eta(), z, c, occ); - registry.fill(HIST("Tracks/Centrality/PhiEtaBest"), phi, track.eta(), c, occ); - qaregistry.fill(HIST("Tracks/Centrality/NclustersEtaBest"), track.nClusters(), track.eta(), c, occ); + qaregistry.fill(HIST("Tracks/Centrality/RestTracksEtaZvtx"), track.eta(), z, c, occ); + qaregistry.fill(HIST("Tracks/Centrality/RestTracksPhiEta"), phi, track.eta(), c, occ); + // registry.fill(HIST("Tracks/Centrality/EtaZvtxBest"), track.eta(), z, c, occ); + // registry.fill(HIST("Tracks/Centrality/PhiEtaBest"), phi, track.eta(), c, occ); + // qaregistry.fill(HIST("Tracks/Centrality/NclustersEtaBest"), track.nClusters(), track.eta(), c, occ); } else { - registry.fill(HIST("Tracks/EtaZvtxBest"), track.eta(), z, occ); - registry.fill(HIST("Tracks/PhiEtaBest"), phi, track.eta(), occ); - qaregistry.fill(HIST("Tracks/NclustersEtaBest"), track.nClusters(), track.eta(), occ); + qaregistry.fill(HIST("Tracks/RestTracksEtaZvtx"), track.eta(), z, occ); + qaregistry.fill(HIST("Tracks/RestTracksPhiEta"), phi, track.eta(), occ); + // registry.fill(HIST("Tracks/EtaZvtxBest"), track.eta(), z, occ); + // registry.fill(HIST("Tracks/PhiEtaBest"), phi, track.eta(), occ); + // qaregistry.fill(HIST("Tracks/NclustersEtaBest"), track.nClusters(), track.eta(), occ); } } } @@ -2011,6 +2179,124 @@ struct DndetaMFTPbPb { using ParticlesI = soa::Join; Partition primariesI = (aod::mcparticle::flags & (uint8_t)o2::aod::mcparticle::enums::PhysicalPrimary) == (uint8_t)o2::aod::mcparticle::enums::PhysicalPrimary && (aod::mcparticle::eta < trackCuts.maxEta) && (aod::mcparticle::eta > trackCuts.minEta); + Preslice perMCCol = aod::mcparticle::mcCollisionId; + + template + void processTrkEffIdxBest( + typename soa::Join const& collisions, + MC const& /*mccollisions*/, ParticlesI const& /*particles*/, + BestTracksMC const& atracks) + { + for (auto const& collision : collisions) { + if (!isGoodEvent(collision)) { + continue; + } + if (!collision.has_mcCollision()) { + continue; + } + float crec = getRecoCent(collision); + auto mcCollision = collision.mcCollision(); + auto partsPerCol = primariesI->sliceByCached(aod::mcparticle::mcCollisionId, mcCollision.globalIndex(), cache); + partsPerCol.bindExternalIndices(&atracks); + for (auto const& particle : partsPerCol) { + if (!isChrgParticle(particle.pdgCode())) { + continue; + } + // MC gen + if constexpr (has_reco_cent) { + if (particle.eta() > trackCuts.minEta && particle.eta() < trackCuts.maxEta) { + if (std::abs(mcCollision.posZ()) < eventCuts.maxZvtx) { + qaregistry.fill(HIST("Tracks/Centrality/hPtEtaEffGenBest"), particle.pt(), particle.eta(), crec); + } + } + } else { + if (particle.eta() > trackCuts.minEta && particle.eta() < trackCuts.maxEta) { + if (std::abs(mcCollision.posZ()) < eventCuts.maxZvtx) { + qaregistry.fill(HIST("Tracks/hPtEtaEffGenBest"), particle.pt(), particle.eta()); + } + } + } + // MC rec + if (particle.has_mfttracks()) { + auto iscounted = false; + auto ncnt = 0; + auto relatedTracks = particle.template mfttracks_as(); + for (auto const& track : relatedTracks) { + ++ncnt; + + if constexpr (has_reco_cent) { + if (track.eta() > trackCuts.minEta && track.eta() < trackCuts.maxEta) { + if (!iscounted) { // primaries + if (std::abs(mcCollision.posZ()) < eventCuts.maxZvtx) { + qaregistry.fill(HIST("Tracks/Centrality/hPtEtaEffPrimBest"), particle.pt(), particle.eta(), crec); + } + iscounted = true; + } + } + if (ncnt > 1) { // secondaries + if (track.eta() > trackCuts.minEta && track.eta() < trackCuts.maxEta) { + qaregistry.fill(HIST("Tracks/Centrality/hPtEtaEffSecBest"), particle.pt(), particle.eta(), crec); + } + } + } else { + if (track.eta() > trackCuts.minEta && track.eta() < trackCuts.maxEta) { + if (!iscounted) { // primaries + if (std::abs(mcCollision.posZ()) < eventCuts.maxZvtx) { + qaregistry.fill(HIST("Tracks/hPtEtaEffPrimBest"), particle.pt(), particle.eta()); + } + iscounted = true; + } + } + if (ncnt > 1) { // secondaries + if (track.eta() > trackCuts.minEta && track.eta() < trackCuts.maxEta) { + qaregistry.fill(HIST("Tracks/hPtEtaEffSecBest"), particle.pt(), particle.eta()); + } + } + } + + if constexpr (has_reco_cent) { + qaregistry.fill(HIST("Tracks/Centrality/NmftTrkPerPartBest"), ncnt, crec); + } else { + qaregistry.fill(HIST("Tracks/NmftTrkPerPartBest"), ncnt); + } + + if (relatedTracks.size() > 1) { // duplicates + if constexpr (has_reco_cent) { + qaregistry.fill(HIST("Tracks/Centrality/hPtEtaEffGenDuplBest"), particle.pt(), particle.eta(), crec); + for (auto const& track : relatedTracks) { + qaregistry.fill(HIST("Tracks/Centrality/hPtEtaEffDuplBest"), track.pt(), track.eta(), crec); + } + } else { + qaregistry.fill(HIST("Tracks/hPtEtaEffGenDuplBest"), particle.pt(), particle.eta()); + for (auto const& track : relatedTracks) { + qaregistry.fill(HIST("Tracks/hPtEtaEffDuplBest"), track.pt(), track.eta()); + } + } + } + } + } + } + } + } + + void processTrkEffIdxBestInlusive( + soa::Join const& collisions, + aod::McCollisions const& mccollisions, ParticlesI const& particles, + BestTracksMC const& atracks) + { + processTrkEffIdxBest(collisions, mccollisions, particles, atracks); + } + PROCESS_SWITCH(DndetaMFTPbPb, processTrkEffIdxBestInlusive, "Process tracking efficiency best (inclusive, indexed)", false); + + void processTrkEffIdxBestCentFT0C( + soa::Join const& collisions, + aod::McCollisions const& mccollisions, ParticlesI const& particles, + BestTracksMC const& atracks) + { + processTrkEffIdxBest(collisions, mccollisions, particles, atracks); + } + PROCESS_SWITCH(DndetaMFTPbPb, processTrkEffIdxBestCentFT0C, "Process tracking efficiency best (in FT0C centrality bins, indexed)", false); + /// @brief process template function to calculate tracking efficiency (indexed /// as particle-to-MFT-tracks) template @@ -2361,98 +2647,173 @@ struct DndetaMFTPbPb { "Process efficiencies in FT0C centrality bins", false); /// @brief process function to check ambiguous tracks - template - void processCheckAmbiguousMftTracks(typename C::iterator const& collision, - allC const& allcollisions, - MftTracksWColls const& tracks) + void processCheckAmbiguousMftTracks(aod::Collisions const&, MftTracksWColls const& tracks) { - float c = getRecoCent(collision); - bool ambTrk = false; - int typeAmbTrk = -1; - - if (tracks.size() == 0) { - return; - } - for (auto const& track : tracks) { auto trkCollId = track.has_collision() ? track.collisionId() : -1; auto ids = track.compatibleCollIds(); if (ids.empty() || (ids.size() == 1 && trkCollId == ids[0])) { - if constexpr (has_reco_cent) { - qaregistry.fill(HIST("Tracks/Centrality/hMftTracksAmbDegreeWoTrivial"), track.compatibleColl().size(), c); - } else { - qaregistry.fill(HIST("Tracks/hMftTracksAmbDegreeWoTrivial"), track.compatibleColl().size()); + qaregistry.fill(HIST("Tracks/hMftTracksAmbDegreeWithTrivial"), track.compatibleCollIds().size()); + if (ids.empty()) { + qaregistry.fill(HIST("Tracks/hAmbTrackType"), AmbTrkType::kOrphan); + } + if (ids.size() == 1 && trkCollId == ids[0]) { + qaregistry.fill(HIST("Tracks/hAmbTrackType"), AmbTrkType::kNonAmb); } continue; } - - if constexpr (has_reco_cent) { - qaregistry.fill(HIST("Tracks/Centrality/hMftTracksAmbDegree"), - track.compatibleColl().size(), c); - } else { - qaregistry.fill(HIST("Tracks/hMftTracksAmbDegree"), - track.compatibleColl().size()); - } + qaregistry.fill(HIST("Tracks/hMftTracksAmbDegree"), track.compatibleCollIds().size()); if (track.compatibleCollIds().size() > 0) { if (track.compatibleCollIds().size() == 1) { if (track.collisionId() != track.compatibleCollIds()[0]) { - ambTrk = true; - typeAmbTrk = 2; + qaregistry.fill(HIST("Tracks/hAmbTrackType"), AmbTrkType::kAmb); } else { - typeAmbTrk = 1; + qaregistry.fill(HIST("Tracks/hAmbTrackType"), AmbTrkType::kNonAmbSame); } } else { - ambTrk = true; - typeAmbTrk = 3; - - for (const auto& collIdx : track.compatibleCollIds()) { - auto ambColl = allcollisions.rawIteratorAt(collIdx); - qaregistry.fill(HIST("Tracks/histAmbZvtx"), ambColl.posZ()); - } + qaregistry.fill(HIST("Tracks/hAmbTrackType"), AmbTrkType::kAmbGt1); } - } else { - typeAmbTrk = 0; } } + } - if (ambTrk) { - if constexpr (has_reco_cent) { - qaregistry.fill(HIST("Tracks/Centrality/hAmbTrackType"), typeAmbTrk, c); - } else { - qaregistry.fill(HIST("Tracks/hAmbTrackType"), typeAmbTrk); + PROCESS_SWITCH(DndetaMFTPbPb, processCheckAmbiguousMftTracks, "Process checks for Ambiguous MFT tracks (inclusive)", false); + + Partition tracksInAcc = (aod::fwdtrack::eta < trackCuts.maxEta) && (aod::fwdtrack::eta > trackCuts.minEta); + + template + void processCheckAssocMC(C const& collisions, + MftTracksWCollsMC const& tracks, + aod::McParticles const& /*particles*/, + aod::McCollisions const& /*mccollisions*/ + ) + { + for (const auto& collision : collisions) { + if (!collision.has_mcCollision()) { + continue; } - } else { - if constexpr (has_reco_cent) { - qaregistry.fill(HIST("Tracks/Centrality/hAmbTrackType"), typeAmbTrk, c); + // auto mcCollision = collision.template mcCollision_as(); + auto tracksInColl = tracksInAcc->sliceByCached(aod::fwdtrack::collisionId, collision.globalIndex(), cache); + int nTrk = 0, nFakeTrk = 0, nGoodTrk = 0; + for (const auto& track : tracksInColl) { + if (!track.has_mcParticle()) { + continue; + } + nTrk++; + auto particle = track.mcParticle(); + + if ((particle.mcCollisionId() != collision.mcCollision().globalIndex())) { + nFakeTrk++; + continue; + } + if (collision.mcCollisionId() == particle.mcCollisionId()) { + nGoodTrk++; + } + } + float frac = (nTrk > 0) ? static_cast(nGoodTrk) / nTrk : -1.; + qaregistry.fill(HIST("TrackToColl/histFracGoodTracks"), frac); + float fracFake = (nTrk > 0) ? static_cast(nFakeTrk) / nTrk : -1.; + qaregistry.fill(HIST("TrackToColl/histFracTracksFakeMcColl"), fracFake); + } + + for (auto const& track : tracks) { + uint index = uint(track.collisionId() >= 0); + if (track.has_mcParticle()) { + // auto particle = track.mcParticle_as(); + auto particle = track.mcParticle(); + bool isAmbiguous = (track.compatibleCollIds().size() != 1); + if (isAmbiguous) { + qaregistry.fill(HIST("TrackToColl/histAmbTrackNumColls"), track.compatibleCollIds().size()); + } + float deltaZ = -999.f; + if (index) { + auto collision = track.collision_as(); + auto mcCollision = particle.mcCollision_as(); + deltaZ = collision.posZ() - mcCollision.posZ(); + if (collision.has_mcCollision() && collision.mcCollisionId() == particle.mcCollisionId()) { + hCollAssoc[index + 1]->Fill(track.pt(), track.eta(), deltaZ); + } else { + if (isAmbiguous) { + for (const auto& collIdx : track.compatibleCollIds()) { + auto ambCollision = collisions.rawIteratorAt(collIdx); + if (ambCollision.has_mcCollision() && ambCollision.mcCollisionId() == particle.mcCollisionId()) { + hCollAssoc[index + 2]->Fill(track.pt(), track.eta(), deltaZ); + break; + } + } + } + } + } + hCollAssoc[index]->Fill(track.pt(), track.eta(), deltaZ); } else { - qaregistry.fill(HIST("Tracks/hAmbTrackType"), typeAmbTrk); + hCollAssoc[index]->Fill(track.pt(), track.eta(), -999.f); } } } - void processCheckAmbiguousMftTracksInclusive(Colls::iterator const& collision, - Colls const& allcollisions, - MftTracksWColls const& track) + void processCollAssocMC(CollisionsWithMCLabels const& collisions, + MftTracksWCollsMC const& tracks, + aod::McParticles const& particles, + aod::McCollisions const& mccollisions) { - processCheckAmbiguousMftTracks(collision, allcollisions, - track); + processCheckAssocMC(collisions, tracks, particles, mccollisions); } + PROCESS_SWITCH(DndetaMFTPbPb, processCollAssocMC, "Process collision-association information, requires extra table from TrackToCollisionAssociation task (fillTableOfCollIdsPerTrack=true)", false); - PROCESS_SWITCH(DndetaMFTPbPb, processCheckAmbiguousMftTracksInclusive, - "Process checks for Ambiguous MFT tracks (inclusive)", false); - - void processCheckAmbiguousMftTracksCentFT0C( - CollsCentFT0C::iterator const& collision, - CollsCentFT0C const& allcollisions, MftTracksWColls const& track) + template + void processCheckReAssocMC(C const& /*collisions*/, + soa::SmallGroups const& besttracks, + FiltMcMftTracks const& /*tracks*/, + FiltParticles const& /*particles*/, + aod::McCollisions const& /*mccollisions*/ + ) { - processCheckAmbiguousMftTracks( - collision, allcollisions, track); + for (auto const& track : besttracks) { + uint index = uint(track.bestCollisionId() >= 0); // assigned + if (!isBestTrackSelected(track)) { + continue; + } + auto itrack = track.mfttrack_as(); + + if (cfgRemoveTrivialAssoc) { + if (itrack.collisionId() != track.bestCollisionId()) { + continue; + } + } + if (!isTrackSelected(itrack)) { + continue; + } + if (itrack.has_mcParticle()) { + auto particle = itrack.mcParticle_as(); + + float deltaZ = -999.f; + if (index) { + auto collision = itrack.collision_as(); + auto mcCollision = particle.mcCollision_as(); + deltaZ = collision.posZ() - mcCollision.posZ(); + if (collision.has_mcCollision() && collision.mcCollisionId() == particle.mcCollisionId()) { + hReAssoc[index + 1]->Fill(itrack.pt(), itrack.eta(), deltaZ); + } else { + hReAssoc[index + 2]->Fill(itrack.pt(), itrack.eta(), deltaZ); + } + } + hReAssoc[index]->Fill(itrack.pt(), itrack.eta(), deltaZ); + } else { + hReAssoc[index]->Fill(itrack.pt(), itrack.eta(), -999.f); + } + } } - PROCESS_SWITCH(DndetaMFTPbPb, processCheckAmbiguousMftTracksCentFT0C, - "Process checks for Ambiguous MFT tracks (in FT0C centrality bins)", - false); + void processReAssocMC(CollisionsWithMCLabels const& collisions, + soa::SmallGroups const& besttracks, + FiltMcMftTracks const& tracks, + FiltParticles const& particles, + aod::McCollisions const& mccollisions) + { + processCheckReAssocMC(collisions, besttracks, tracks, particles, mccollisions); + } + PROCESS_SWITCH(DndetaMFTPbPb, processReAssocMC, "Process re-association information based on BestCollisionsFwd3d table", false); Preslice filtTrkperCol = o2::aod::fwdtrack::collisionId; @@ -2563,11 +2924,13 @@ struct DndetaMFTPbPb { } if constexpr (has_reco_cent) { + qaregistry.fill(HIST("Tracks/Centrality/THnDCAxyBestRec"), itrack.pt(), itrack.eta(), collision.posZ(), atrack.bestDCAXY(), atrack.bestDCAZ(), crec); qaregistry.fill(HIST("Tracks/Centrality/hDCAxyBestPtRec"), itrack.pt(), atrack.bestDCAXY(), crec); qaregistry.fill(HIST("Tracks/Centrality/hDCAzBestPtRec"), itrack.pt(), atrack.bestDCAZ(), crec); qaregistry.fill(HIST("Tracks/Centrality/hDCAxyBestRec"), atrack.bestDCAXY(), crec); qaregistry.fill(HIST("Tracks/Centrality/hDCAzBestRec"), atrack.bestDCAZ(), crec); } else { + qaregistry.fill(HIST("Tracks/THnDCAxyBestRec"), itrack.pt(), itrack.eta(), collision.posZ(), atrack.bestDCAXY(), atrack.bestDCAZ()); qaregistry.fill(HIST("Tracks/hDCAxyBestPtRec"), itrack.pt(), atrack.bestDCAXY()); qaregistry.fill(HIST("Tracks/hDCAzBestPtRec"), itrack.pt(), atrack.bestDCAZ()); qaregistry.fill(HIST("Tracks/hDCAxyBestRec"), atrack.bestDCAXY()); @@ -2575,11 +2938,10 @@ struct DndetaMFTPbPb { } if (!itrack.has_mcParticle()) { - LOGF(warning, "No MC particle for ambiguous itrack, skip..."); + LOGP(debug, "No MC particle for ambiguous itrack, skip..."); continue; } - // auto particle = track.mcParticle(); auto particle = itrack.mcParticle_as(); if (!isChrgParticle(particle.pdgCode())) { @@ -2600,11 +2962,13 @@ struct DndetaMFTPbPb { if (!particle.isPhysicalPrimary()) { // Secondaries (weak decays and material) if (particle.getProcess() == kNumDecay) { // Particles from decay if constexpr (has_reco_cent) { + qaregistry.fill(HIST("Tracks/Centrality/THnDCAxyBestGenSecWeak"), particle.pt(), particle.eta(), particle.mcCollision().posZ(), dcaXtruth, dcaZtruth, crec); qaregistry.fill(HIST("Tracks/Centrality/hDCAxBestGenSecWeak"), dcaXtruth, crec); qaregistry.fill(HIST("Tracks/Centrality/hDCAyBestGenSecWeak"), dcaYtruth, crec); qaregistry.fill(HIST("Tracks/Centrality/hDCAxyBestGenSecWeak"), dcaXYtruth, crec); qaregistry.fill(HIST("Tracks/Centrality/hDCAzBestGenSecWeak"), dcaZtruth, crec); } else { + qaregistry.fill(HIST("Tracks/THnDCAxyBestGenSecWeak"), particle.pt(), particle.eta(), particle.mcCollision().posZ(), dcaXtruth, dcaZtruth); qaregistry.fill(HIST("Tracks/hDCAxBestGenSecWeak"), dcaXtruth); qaregistry.fill(HIST("Tracks/hDCAyBestGenSecWeak"), dcaYtruth); qaregistry.fill(HIST("Tracks/hDCAxyBestGenSecWeak"), dcaXYtruth); @@ -2612,11 +2976,13 @@ struct DndetaMFTPbPb { } } else { // Particles from the material if constexpr (has_reco_cent) { + qaregistry.fill(HIST("Tracks/Centrality/THnDCAxyBestGenSecMat"), particle.pt(), particle.eta(), particle.mcCollision().posZ(), dcaXtruth, dcaZtruth, crec); qaregistry.fill(HIST("Tracks/Centrality/hDCAxBestGenSecMat"), dcaXtruth, crec); qaregistry.fill(HIST("Tracks/Centrality/hDCAyBestGenSecMat"), dcaYtruth, crec); qaregistry.fill(HIST("Tracks/Centrality/hDCAxyBestGenSecMat"), dcaXYtruth, crec); qaregistry.fill(HIST("Tracks/Centrality/hDCAzBestGenSecMat"), dcaZtruth, crec); } else { + qaregistry.fill(HIST("Tracks/THnDCAxyBestGenSecMat"), particle.pt(), particle.eta(), particle.mcCollision().posZ(), dcaXtruth, dcaZtruth); qaregistry.fill(HIST("Tracks/hDCAxBestGenSecMat"), dcaXtruth); qaregistry.fill(HIST("Tracks/hDCAyBestGenSecMat"), dcaYtruth); qaregistry.fill(HIST("Tracks/hDCAxyBestGenSecMat"), dcaXYtruth); @@ -2625,11 +2991,13 @@ struct DndetaMFTPbPb { } } else { // Primaries if constexpr (has_reco_cent) { + qaregistry.fill(HIST("Tracks/Centrality/THnDCAxyBestGenPrim"), particle.pt(), particle.eta(), particle.mcCollision().posZ(), dcaXtruth, dcaZtruth, crec); qaregistry.fill(HIST("Tracks/Centrality/hDCAxBestGenPrim"), dcaXtruth, crec); qaregistry.fill(HIST("Tracks/Centrality/hDCAyBestGenPrim"), dcaYtruth, crec); qaregistry.fill(HIST("Tracks/Centrality/hDCAxyBestGenPrim"), dcaXYtruth, crec); qaregistry.fill(HIST("Tracks/Centrality/hDCAzBestGenPrim"), dcaZtruth, crec); } else { + qaregistry.fill(HIST("Tracks/THnDCAxyBestGenPrim"), particle.pt(), particle.eta(), particle.mcCollision().posZ(), dcaXtruth, dcaZtruth); qaregistry.fill(HIST("Tracks/hDCAxBestGenPrim"), dcaXtruth); qaregistry.fill(HIST("Tracks/hDCAyBestGenPrim"), dcaYtruth); qaregistry.fill(HIST("Tracks/hDCAxyBestGenPrim"), dcaXYtruth); From 3dcc789b267857d1e7016f6e54763e99c9cff18e Mon Sep 17 00:00:00 2001 From: jaelpark Date: Wed, 15 Oct 2025 00:15:44 +0800 Subject: [PATCH 746/986] [PWGCF] Configurable correlation axes (#13221) --- PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.cxx | 11 +++++------ PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.h | 2 +- PWGCF/JCorran/Tasks/jflucAnalysisTask.cxx | 13 +++++++++++-- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.cxx b/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.cxx index 56c4c925a7f..0439b5e2931 100644 --- a/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.cxx +++ b/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.cxx @@ -23,7 +23,7 @@ using namespace o2; using namespace o2::framework; -JFFlucAnalysisO2Hist::JFFlucAnalysisO2Hist(HistogramRegistry& registry, AxisSpec& axisMultiplicity, AxisSpec& phiAxis, AxisSpec& etaAxis, AxisSpec& zvtAxis, AxisSpec& ptAxis, AxisSpec& massAxis, uint16_t multCorrMask, const TString& folder) : JFFlucAnalysis() +JFFlucAnalysisO2Hist::JFFlucAnalysisO2Hist(HistogramRegistry& registry, AxisSpec& axisMultiplicity, AxisSpec& phiAxis, AxisSpec& etaAxis, AxisSpec& zvtAxis, AxisSpec& ptAxis, AxisSpec& massAxis, AxisSpec& vnAxis, AxisSpec& fourAxisSC, AxisSpec& mixedAxis, AxisSpec& twoAxisSC, uint16_t multCorrMask, const TString& folder) : JFFlucAnalysis() { ph1[HIST_TH1_CENTRALITY] = std::get>(registry.add(Form("%s/h_cent", folder.Data()), "multiplicity/centrality", {HistType::kTH1F, {axisMultiplicity}})).get(); @@ -51,12 +51,11 @@ JFFlucAnalysisO2Hist::JFFlucAnalysisO2Hist(HistogramRegistry& registry, AxisSpec pht[HIST_THN_PTETA] = std::get>(registry.add(Form("%s/h_pteta", folder.Data()), "(corrected) multiplicity/centrality, pT, eta, charge", {HistType::kTHnSparseF, {axisMultiplicity, ptAxis, etaAxis, chgAxis}})).get(); AxisSpec hAxis = {kNH, -0.5, static_cast(kNH - 1) + 0.5, "#it{n}"}; AxisSpec kAxis = {nKL, -0.5, static_cast(nKL - 1) + 0.5, "#it{k}"}; - AxisSpec vnAxis = {2048, -0.1, 0.1, "#it{V}_#it{n}"}; - pht[HIST_THN_SC_with_QC_4corr] = std::get>(registry.add(Form("%s/h_SC_with_QC_4corr", folder.Data()), "SC_with_QC_4corr", {HistType::kTHnSparseF, {axisMultiplicity, massAxis, hAxis, hAxis, {2048, -0.001, 0.001, "correlation"}}})).get(); - pht[HIST_THN_SC_with_QC_2corr] = std::get>(registry.add(Form("%s/h_SC_with_QC_2corr", folder.Data()), "SC_with_QC_2corr", {HistType::kTHnSparseF, {axisMultiplicity, massAxis, hAxis, {2048, -0.1, 0.1, "correlation"}}})).get(); - pht[HIST_THN_SC_with_QC_2corr_gap] = std::get>(registry.add(Form("%s/h_SC_with_QC_2corr_gap", folder.Data()), "SC_with_QC_2corr_gap", {HistType::kTHnSparseF, {axisMultiplicity, massAxis, hAxis, {2048, -0.1, 0.1, "correlation"}}})).get(); + pht[HIST_THN_SC_with_QC_4corr] = std::get>(registry.add(Form("%s/h_SC_with_QC_4corr", folder.Data()), "SC_with_QC_4corr", {HistType::kTHnSparseF, {axisMultiplicity, massAxis, hAxis, hAxis, fourAxisSC}})).get(); + pht[HIST_THN_SC_with_QC_2corr] = std::get>(registry.add(Form("%s/h_SC_with_QC_2corr", folder.Data()), "SC_with_QC_2corr", {HistType::kTHnSparseF, {axisMultiplicity, massAxis, hAxis, twoAxisSC}})).get(); + pht[HIST_THN_SC_with_QC_2corr_gap] = std::get>(registry.add(Form("%s/h_SC_with_QC_2corr_gap", folder.Data()), "SC_with_QC_2corr_gap", {HistType::kTHnSparseF, {axisMultiplicity, massAxis, hAxis, twoAxisSC}})).get(); for (UInt_t i = HIST_THN_V4V2star_2; i < HIST_THN_COUNT; ++i) - pht[i] = std::get>(registry.add(Form("%s/h_corrC%02u", folder.Data(), i - HIST_THN_V4V2star_2), "correlator", {HistType::kTHnSparseF, {axisMultiplicity, massAxis, {2048, -3.0, 3.0, "correlation"}}})).get(); + pht[i] = std::get>(registry.add(Form("%s/h_corrC%02u", folder.Data(), i - HIST_THN_V4V2star_2), "correlator", {HistType::kTHnSparseF, {axisMultiplicity, massAxis, mixedAxis}})).get(); for (UInt_t i = 0; i < HIST_THN_COUNT; ++i) pht[i]->Sumw2(); diff --git a/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.h b/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.h index 867486ae90a..3bc0a1a225e 100644 --- a/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.h +++ b/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.h @@ -21,7 +21,7 @@ class JFFlucAnalysisO2Hist : public JFFlucAnalysis { public: - JFFlucAnalysisO2Hist(o2::framework::HistogramRegistry&, o2::framework::AxisSpec&, o2::framework::AxisSpec&, o2::framework::AxisSpec&, o2::framework::AxisSpec&, o2::framework::AxisSpec&, o2::framework::AxisSpec&, uint16_t, const TString&); + JFFlucAnalysisO2Hist(o2::framework::HistogramRegistry&, o2::framework::AxisSpec&, o2::framework::AxisSpec&, o2::framework::AxisSpec&, o2::framework::AxisSpec&, o2::framework::AxisSpec&, o2::framework::AxisSpec&, o2::framework::AxisSpec&, o2::framework::AxisSpec&, o2::framework::AxisSpec&, o2::framework::AxisSpec&, uint16_t, const TString&); ~JFFlucAnalysisO2Hist(); }; diff --git a/PWGCF/JCorran/Tasks/jflucAnalysisTask.cxx b/PWGCF/JCorran/Tasks/jflucAnalysisTask.cxx index aca62b7aa82..c6a213163d5 100644 --- a/PWGCF/JCorran/Tasks/jflucAnalysisTask.cxx +++ b/PWGCF/JCorran/Tasks/jflucAnalysisTask.cxx @@ -70,6 +70,11 @@ struct jflucAnalysisTask { ConfigurableAxis ptAxis{"axisPt", {60, 0.0, 300.0}, "pt axis for histograms"}; ConfigurableAxis massAxis{"axisMass", {1, 0.0, 10.0}, "mass axis for histograms"}; + ConfigurableAxis vnCorrAxis{"vnCorrAxis", {2048, -0.1, 0.1}, "vn correlation axis"}; + ConfigurableAxis fourCorrSCAxis{"4pCorrAxisSC", {2048, -0.001, 0.001}, "4-particle correlation axis for SC"}; + ConfigurableAxis twoCorrSCAxis{"2pCorrAxisSC", {2048, -0.1, 0.1}, "2-particle correlation axis for SC"}; + ConfigurableAxis mixedCorrAxis{"mixedCorrAxis", {2048, -3.0, 3.0}, "N-particle correlation axis"}; + Filter jtrackFilter = (aod::jtrack::pt > ptmin) && (aod::jtrack::pt < ptmax); // eta cuts done by jfluc Filter cftrackFilter = (aod::cftrack::pt > ptmin) && (aod::cftrack::pt < ptmax); // eta cuts done by jfluc Filter cfmcparticleFilter = (aod::cfmcparticle::pt > ptmin) && (aod::cfmcparticle::pt < ptmax) && (aod::cfmcparticle::sign != 0); // eta cuts done by jfluc @@ -88,15 +93,19 @@ struct jflucAnalysisTask { auto axisSpecZvt = AxisSpec(zvtAxis); auto axisSpecPt = AxisSpec(ptAxis); auto axisSpecMass = AxisSpec(massAxis); + auto axisSpecVn = AxisSpec(vnCorrAxis); + auto axisSpec4pSC = AxisSpec(fourCorrSCAxis); + auto axisSpec2pSC = AxisSpec(twoCorrSCAxis); + auto axisSpecMixed = AxisSpec(mixedCorrAxis); if (doprocessJDerived || doprocessJDerivedCorrected || doprocessCFDerived || doprocessCFDerivedCorrected || doprocessCFDerivedMultSet || doprocessCFDerivedMultSetCorrected || doprocessMCCFDerived) { - pcf = new JFFlucAnalysisO2Hist(registry, axisSpecMult, axisSpecPhi, axisSpecEta, axisSpecZvt, axisSpecPt, axisSpecMass, cfgMultCorrelationsMask, "jfluc"); + pcf = new JFFlucAnalysisO2Hist(registry, axisSpecMult, axisSpecPhi, axisSpecEta, axisSpecZvt, axisSpecPt, axisSpecMass, axisSpecVn, axisSpec4pSC, axisSpec2pSC, axisSpecMixed, cfgMultCorrelationsMask, "jfluc"); pcf->AddFlags(JFFlucAnalysis::kFlucEbEWeighting); pcf->UserCreateOutputObjects(); } else { pcf = 0; } if (doprocessCF2ProngDerived || doprocessCF2ProngDerivedCorrected) { - pcf2Prong = new JFFlucAnalysisO2Hist(registry, axisSpecMult, axisSpecPhi, axisSpecEta, axisSpecZvt, axisSpecPt, axisSpecMass, cfgMultCorrelationsMask, "jfluc2prong"); + pcf2Prong = new JFFlucAnalysisO2Hist(registry, axisSpecMult, axisSpecPhi, axisSpecEta, axisSpecZvt, axisSpecPt, axisSpecMass, axisSpecVn, axisSpec4pSC, axisSpec2pSC, axisSpecMixed, cfgMultCorrelationsMask, "jfluc2prong"); pcf2Prong->AddFlags(JFFlucAnalysis::kFlucEbEWeighting); pcf2Prong->UserCreateOutputObjects(); From 747d7dbc80d0d5082da7b423fe4496a23a412f20 Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Tue, 14 Oct 2025 21:00:39 +0200 Subject: [PATCH 747/986] [PWGCF] FemtoUniverse: Add function to pair MCTruth particles (#13376) --- ...irTaskTrackTrackSpherHarMultKtExtended.cxx | 252 ++++++++++++++++-- 1 file changed, 232 insertions(+), 20 deletions(-) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx index 83497834459..60161fe04a6 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx @@ -61,6 +61,7 @@ static const float cutsTable[nPart][nCuts]{ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { Service pdg; + Service pdgMC; /// Particle selection part @@ -101,6 +102,9 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { SliceCache cache; Preslice perCol = aod::femtouniverseparticle::fdCollisionId; + using FemtoTruthParticles = soa::Join; + Preslice perColMCTruth = aod::femtouniverseparticle::fdCollisionId; + /// Particle 1 struct : o2::framework::ConfigurableGroup { Configurable ConfPDGCodePartOne{"ConfPDGCodePartOne", 211, "Particle 1 - PDG code"}; @@ -114,6 +118,8 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { /// Partition for particle 1 Partition partsOne = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && aod::femtouniverseparticle::sign == as(trackonefilter.ConfChargePart1) && aod::femtouniverseparticle::pt < trackonefilter.ConfPtHighPart1 && aod::femtouniverseparticle::pt > trackonefilter.ConfPtLowPart1; Partition partsOneMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && aod::femtouniverseparticle::sign == as(trackonefilter.ConfChargePart1) && aod::femtouniverseparticle::pt < trackonefilter.ConfPtHighPart1 && aod::femtouniverseparticle::pt > trackonefilter.ConfPtLowPart1; + Partition partsOneMCTruth = aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack); + // /// Histogramming for particle 1 @@ -133,6 +139,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { /// Partition for particle 2 Partition partsTwo = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == as(tracktwofilter.ConfChargePart2)) && aod::femtouniverseparticle::pt < tracktwofilter.ConfPtHighPart2 && aod::femtouniverseparticle::pt > tracktwofilter.ConfPtLowPart2; Partition partsTwoMC = aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack) && (aod::femtouniverseparticle::sign == as(tracktwofilter.ConfChargePart2)) && aod::femtouniverseparticle::pt < tracktwofilter.ConfPtHighPart2 && aod::femtouniverseparticle::pt > tracktwofilter.ConfPtLowPart2; + Partition partsTwoMCTruth = aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack); /// Histogramming for particle 2 FemtoUniverseParticleHisto trackHistoPartTwo; @@ -695,6 +702,138 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { } PROCESS_SWITCH(femtoUniversePairTaskTrackTrackSpherHarMultKtExtended, processSameEventMC, "Enable processing same event for Monte Carlo", false); + /// This function processes the same event and takes care of all the histogramming + /// \todo the trivial loops over the tracks should be factored out since they will be common to all combinations of T-T, T-V0, V0-V0, ... + /// @tparam PartitionType + /// @tparam PartType + /// @tparam isMC: enables Monte Carlo truth specific histograms + /// @param groupPartsOne partition for the first particle passed by the process function + /// @param groupPartsTwo partition for the second particle passed by the process function + /// @param parts femtoUniverseParticles table (in case of Monte Carlo joined with FemtoUniverseMCLabels) + /// @param magFieldTesla magnetic field of the collision + /// @param multCol multiplicity of the collision + template + void doSameEventMCTruth(PartitionType groupPartsOne, PartitionType groupPartsTwo, int multCol, int ContType, bool fillQA) + { + + /// Histogramming same event + if ((ContType == 1 || ContType == 2) && fillQA) { + for (const auto& part : groupPartsOne) { + if (part.partType() == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) { + int pdgCode = static_cast(part.tempFitVar()); + const auto& pdgParticle = pdgMC->GetParticle(pdgCode); + if (pdgParticle) { + trackHistoPartOne.fillQA(part); + } + } + } + } + + if ((ContType == 1 || ContType == 3) && fillQA) { + for (const auto& part : groupPartsTwo) { + if (part.partType() == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) { + int pdgCode = static_cast(part.tempFitVar()); + const auto& pdgParticle = pdgMC->GetParticle(pdgCode); + if (pdgParticle) { + trackHistoPartTwo.fillQA(part); + } + } + } + } + + if (ContType == 1) { + + /// Now build the combinations for non-identical particle pairs + for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { + + int pdgCodePartOne = static_cast(p1.tempFitVar()); + const auto& pdgParticleOne = pdgMC->GetParticle(pdgCodePartOne); + int pdgCodePartTwo = static_cast(p2.tempFitVar()); + const auto& pdgParticleTwo = pdgMC->GetParticle(pdgCodePartTwo); + if (pdgParticleOne && pdgParticleTwo && (pdgCodePartOne == trackonefilter.ConfPDGCodePartOne) && (pdgCodePartTwo == tracktwofilter.ConfPDGCodePartTwo)) { + float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); + sameEventMultCont.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); + } + } + } else { + for (const auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsOne, groupPartsOne))) { + + int pdgCodePartOne = static_cast(p1.tempFitVar()); + const auto& pdgParticleOne = pdgMC->GetParticle(pdgCodePartOne); + int pdgCodePartTwo = static_cast(p2.tempFitVar()); + const auto& pdgParticleTwo = pdgMC->GetParticle(pdgCodePartTwo); + + float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); + double rand; + rand = randgen->Rndm(); + std::vector f3d; + if (pdgParticleOne && pdgParticleTwo && (pdgCodePartOne == trackonefilter.ConfPDGCodePartOne) && (pdgCodePartTwo == tracktwofilter.ConfPDGCodePartTwo)) { + + switch (ContType) { + case 2: { + if (rand > 0.5) { + sameEventMultContPP.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); + } else if (rand <= 0.5) { + sameEventMultContPP.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); + } + break; + } + + case 3: { + if (rand > 0.5) { + sameEventMultContMM.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); + } else if (rand <= 0.5) { + sameEventMultContMM.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); + } + break; + } + default: + break; + } + } + } + } + } + + /// process function for to call doSameEvent with Monte Carlo + /// \param col subscribe to the collision table (Monte Carlo Reconstructed reconstructed) + /// \param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth + /// \param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table + void processSameEventMCTruth(o2::aod::FdCollision const& col, + FemtoTruthParticles const&) + { + fillCollision(col, ConfIsCent); + + auto thegroupPartsOne = partsOneMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + auto thegroupPartsTwo = partsTwoMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + bool fillQA = true; + randgen = new TRandom2(0); + + if (ConfIsCent) { + if (cfgProcessPM) { + doSameEventMCTruth(thegroupPartsOne, thegroupPartsTwo, col.multV0M(), 1, fillQA); + } + if (cfgProcessPP) { + doSameEventMCTruth(thegroupPartsOne, thegroupPartsOne, col.multV0M(), 2, fillQA); + } + if (cfgProcessMM) { + doSameEventMCTruth(thegroupPartsTwo, thegroupPartsTwo, col.multV0M(), 3, fillQA); + } + } else { + if (cfgProcessPM) { + doSameEventMCTruth(thegroupPartsOne, thegroupPartsTwo, col.multNtr(), 1, fillQA); + } + if (cfgProcessPP) { + doSameEventMCTruth(thegroupPartsOne, thegroupPartsOne, col.multNtr(), 2, fillQA); + } + if (cfgProcessMM) { + doSameEventMCTruth(thegroupPartsTwo, thegroupPartsTwo, col.multNtr(), 3, fillQA); + } + } + delete randgen; + } + PROCESS_SWITCH(femtoUniversePairTaskTrackTrackSpherHarMultKtExtended, processSameEventMCTruth, "Enable processing same event for MC truth", false); + /// This function processes the mixed event /// \todo the trivial loops over the collisions and tracks should be factored out since they will be common to all combinations of T-T, T-V0, V0-V0, ... /// \tparam PartitionType @@ -864,26 +1003,6 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { } PROCESS_SWITCH(femtoUniversePairTaskTrackTrackSpherHarMultKtExtended, processMixedEventNtr, "Enable processing mixed events for centrality", false); - /// process function for to fill covariance histograms - /// \param col subscribe to the collision table (Data) - /// \param parts subscribe to the femtoUniverseParticleTable - void processCov(soa::Filtered::iterator const& /*col*/, - FilteredFemtoFullParticles const& /*parts*/) - { - int JMax = (ConfLMax + 1) * (ConfLMax + 1); - if (cfgProcessMM) { - sameEventMultContMM.fillMultkTCov(femto_universe_sh_container::EventType::same, JMax); - mixedEventMultContMM.fillMultkTCov(femto_universe_sh_container::EventType::mixed, JMax); - } else if (cfgProcessPP) { - sameEventMultContPP.fillMultkTCov(femto_universe_sh_container::EventType::same, JMax); - mixedEventMultContPP.fillMultkTCov(femto_universe_sh_container::EventType::mixed, JMax); - } else if (cfgProcessPM) { - sameEventMultCont.fillMultkTCov(femto_universe_sh_container::EventType::same, JMax); - mixedEventMultCont.fillMultkTCov(femto_universe_sh_container::EventType::mixed, JMax); - } - } - PROCESS_SWITCH(femtoUniversePairTaskTrackTrackSpherHarMultKtExtended, processCov, "Enable processing same event covariance", false); - /// brief process function for to call doMixedEvent with Monte Carlo /// @param cols subscribe to the collisions table (Monte Carlo Reconstructed reconstructed) /// @param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth @@ -971,6 +1090,99 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { delete randgen; } PROCESS_SWITCH(femtoUniversePairTaskTrackTrackSpherHarMultKtExtended, processMixedEventMCNtr, "Enable processing mixed events MC", false); + + /// This function processes the mixed event + /// \todo the trivial loops over the collisions and tracks should be factored out since they will be common to all combinations of T-T, T-V0, V0-V0, ... + /// \tparam PartitionType + /// \tparam PartType + /// \tparam isMC: enables Monte Carlo truth specific histograms + /// \param groupPartsOne partition for the first particle passed by the process function + /// \param groupPartsTwo partition for the second particle passed by the process function + /// \param parts femtoUniverseParticles table (in case of Monte Carlo joined with FemtoUniverseMCLabels) + /// \param magFieldTesla magnetic field of the collision + /// \param multCol multiplicity of the collision + template + void doMixedEventMCTruth(PartitionType groupPartsOne, PartitionType groupPartsTwo, int multCol, int ContType) + { + + for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { + + int pdgCodePartOne = static_cast(p1.tempFitVar()); + const auto& pdgParticleOne = pdgMC->GetParticle(pdgCodePartOne); + int pdgCodePartTwo = static_cast(p2.tempFitVar()); + const auto& pdgParticleTwo = pdgMC->GetParticle(pdgCodePartTwo); + + float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); + double rand; + rand = randgen->Rndm(); + if (pdgParticleOne && pdgParticleTwo && (pdgCodePartOne == trackonefilter.ConfPDGCodePartOne) && (pdgCodePartTwo == tracktwofilter.ConfPDGCodePartTwo)) { + + switch (ContType) { + case 1: { + if (rand > 0.5) { + mixedEventMultCont.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); + } else { + mixedEventMultCont.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); + } + break; + } + + case 2: { + if (rand > 0.5) { + mixedEventMultContPP.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); + } else { + mixedEventMultContPP.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); + } + break; + } + + case 3: { + if (rand > 0.5) { + mixedEventMultContMM.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); + } else { + mixedEventMultContMM.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); + } + break; + } + default: + break; + } + } + } + } + + /// process function for to call doMixedEvent with Data + /// @param cols subscribe to the collisions table (Data) + /// @param parts subscribe to the femtoUniverseParticleTable + void processMixedEventNtrMCTruth(o2::aod::FdCollisions const& cols, + FemtoTruthParticles const&) + { + randgen = new TRandom2(0); + + for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningNtr, ConfNEventsMix, -1, cols, cols)) { + + const int multiplicityCol = collision1.multNtr(); + MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningNtr.getBin({collision1.posZ(), multiplicityCol})); + + if (cfgProcessPM) { + auto groupPartsOne = partsOneMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupPartsTwo = partsTwoMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); + doMixedEventMCTruth(groupPartsOne, groupPartsTwo, multiplicityCol, 1); + } + if (cfgProcessPP) { + auto groupPartsOne = partsOneMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupPartsTwo = partsOneMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); + doMixedEventMCTruth(groupPartsOne, groupPartsTwo, multiplicityCol, 2); + } + if (cfgProcessMM) { + auto groupPartsOne = partsTwoMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupPartsTwo = partsTwoMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); + doMixedEventMCTruth(groupPartsOne, groupPartsTwo, multiplicityCol, 3); + } + } + delete randgen; + } + PROCESS_SWITCH(femtoUniversePairTaskTrackTrackSpherHarMultKtExtended, processMixedEventNtrMCTruth, "Enable processing MC Truth mixed events for multiplicity", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From c1e8911d53e8cd426011d17da9be194a567b64d0 Mon Sep 17 00:00:00 2001 From: Joachim Carlo Kristian Bjerg Hansen <50103987+joachimckh@users.noreply.github.com> Date: Tue, 14 Oct 2025 22:09:26 +0200 Subject: [PATCH 748/986] [PWGCF] fix deta bug (#13319) --- .../Tasks/longRangeDihadronCor.cxx | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx b/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx index 7d7000a5862..5cd920840fb 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx @@ -164,7 +164,7 @@ struct LongRangeDihadronCor { // FT0 geometry o2::ft0::Geometry ft0Det; - const uint64_t ft0IndexA = 96; + static constexpr uint64_t Ft0IndexA = 96; std::vector* offsetFT0; std::vector cstFT0RelGain{}; @@ -283,8 +283,6 @@ struct LongRangeDihadronCor { registry.add("Trig_hist_TPC_FT0C", "", {HistType::kTHnSparseF, {{axisSample, axisVertex, axisPtTrigger}}}); registry.add("FT0Amp", "", {HistType::kTH2F, {axisChID, axisFit}}); registry.add("FT0AmpCorrect", "", {HistType::kTH2F, {axisChID, axisFit}}); - registry.add("FT0Cmp", "", {HistType::kTH2F, {axisChID, axisFit}}); - registry.add("FT0CmpCorrect", "", {HistType::kTH2F, {axisChID, axisFit}}); } if (doprocessSameTpcFt0a) { registry.add("deltaEta_deltaPhi_same_TPC_FT0A", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEtaTpcFt0a}}); // check to see the delta eta and delta phi distribution @@ -369,7 +367,7 @@ struct LongRangeDihadronCor { auto x = chPos.X() + (*offsetFT0)[i].getX(); auto y = chPos.Y() + (*offsetFT0)[i].getY(); auto z = chPos.Z() + (*offsetFT0)[i].getZ(); - if (chno >= ft0IndexA) { + if (chno >= Ft0IndexA) { z = -z; } auto r = std::sqrt(x * x + y * y); @@ -519,21 +517,19 @@ struct LongRangeDihadronCor { template void getChannel(TFT0s const& ft0, std::size_t const& iCh, int& id, float& ampl, int fitType) { - int rID{0}; if (fitType == kFT0C) { id = ft0.channelC()[iCh]; - rID = id + 96; + id = id + Ft0IndexA; ampl = ft0.amplitudeC()[iCh]; - registry.fill(HIST("FT0Cmp"), rID, ampl); + registry.fill(HIST("FT0Amp"), id, ampl); ampl = ampl / cstFT0RelGain[iCh]; - registry.fill(HIST("FT0CmpCorrect"), rID, ampl); + registry.fill(HIST("FT0AmpCorrect"), id, ampl); } else if (fitType == kFT0A) { id = ft0.channelA()[iCh]; - rID = id; ampl = ft0.amplitudeA()[iCh]; - registry.fill(HIST("FT0Amp"), rID, ampl); + registry.fill(HIST("FT0Amp"), id, ampl); ampl = ampl / cstFT0RelGain[iCh]; - registry.fill(HIST("FT0AmpCorrect"), rID, ampl); + registry.fill(HIST("FT0AmpCorrect"), id, ampl); } else { LOGF(fatal, "Cor Index %d out of range", fitType); } From bc31c8706628dbd684fce149a6e55c9ac066b309 Mon Sep 17 00:00:00 2001 From: Junlee Kim Date: Wed, 15 Oct 2025 05:09:52 +0900 Subject: [PATCH 749/986] [PWGCF] adding event selections (#13366) Co-authored-by: ALICE Action Bot --- PWGCF/JCorran/Tasks/jEPFlowAnalysis.cxx | 41 ++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/PWGCF/JCorran/Tasks/jEPFlowAnalysis.cxx b/PWGCF/JCorran/Tasks/jEPFlowAnalysis.cxx index baf4cc90f9d..b2b52a35182 100644 --- a/PWGCF/JCorran/Tasks/jEPFlowAnalysis.cxx +++ b/PWGCF/JCorran/Tasks/jEPFlowAnalysis.cxx @@ -55,7 +55,11 @@ struct jEPFlowAnalysis { Configurable cfgEtaMax{"cfgEtaMax", 1.f, "Maximum eta used for track selection."}; } cfgTrackCuts; - Configurable cfgAddEvtSel{"cfgAddEvtSel", true, "Use event selection"}; + Configurable cfgAddEvtSel{"cfgAddEvtSel", true, "event selection"}; + Configurable cfgEvtSel{"cfgEvtSel", 0, "Event selection flags\n0: Sel8\n1: Sel8+kIsGoodZvtxFT0vsPV+kNoSameBunchPileup\n2: Sel8+kIsGoodZvtxFT0vsPV+kNoSameBunchPileup+kNoCollInTimeRangeStandard\n3: Sel8+kNoSameBunchPileup"}; + Configurable cfgMaxOccupancy{"cfgMaxOccupancy", 999999, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; + Configurable cfgMinOccupancy{"cfgMinOccupancy", 0, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; + Configurable cfgnTotalSystem{"cfgnTotalSystem", 7, "Total number of detectors in qVectorsTable"}; Configurable cfgnMode{"cfgnMode", 1, "the number of modulations"}; @@ -114,6 +118,7 @@ struct jEPFlowAnalysis { AxisSpec axisMod{cfgnMode, 2., cfgnMode + 2.}; AxisSpec axisEvtPl{360, -constants::math::PI * 1.1, constants::math::PI * 1.1}; + AxisSpec axisVertex{150, -12.5, 12.5}; AxisSpec axisCent{cfgAxisCent, "cent"}; AxisSpec axisPt{cfgAxisPt, "pT"}; @@ -129,15 +134,43 @@ struct jEPFlowAnalysis { epFlowHistograms.add("vncos", "", {HistType::kTHnSparseF, {axisMod, axisCent, axisPt, axisCos}}); epFlowHistograms.add("vnsin", "", {HistType::kTHnSparseF, {axisMod, axisCent, axisPt, axisCos}}); + + epFlowHistograms.add("hCentrality", "", {HistType::kTH1F, {axisCent}}); + epFlowHistograms.add("hVertex", "", {HistType::kTH1F, {axisVertex}}); } void process(MyCollisions::iterator const& coll, soa::Filtered const& tracks, aod::BCsWithTimestamps const&) { - if (cfgAddEvtSel && (!coll.sel8() || !coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !coll.selection_bit(aod::evsel::kNoSameBunchPileup))) - return; + if (cfgAddEvtSel) { + switch (cfgEvtSel) { + case 0: // Sel8 + if (!coll.sel8()) + return; + break; + case 1: // PbPb standard + if (!coll.sel8() || !coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !coll.selection_bit(aod::evsel::kNoSameBunchPileup)) + return; + break; + case 2: // PbPb with pileup + if (!coll.sel8() || !coll.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) || + !coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !coll.selection_bit(aod::evsel::kNoSameBunchPileup)) + return; + break; + case 3: // Small systems (OO, NeNe, pp) + if (!coll.sel8() || !coll.selection_bit(aod::evsel::kNoSameBunchPileup)) + return; + break; + default: + LOGF(warning, "Event selection flag was not found, continuing without basic event selections!\n"); + } + // Check occupancy + if (coll.trackOccupancyInTimeRange() > cfgMaxOccupancy || coll.trackOccupancyInTimeRange() < cfgMinOccupancy) + return; + } float cent = coll.cent(); - epFlowHistograms.fill(HIST("FullCentrality"), cent); + epFlowHistograms.fill(HIST("hCentrality"), cent); + epFlowHistograms.fill(HIST("hVertex"), coll.posZ()); float eps[3] = {0.}; if (cfgShiftCorr) { From 7919d991cdc05f746a5f1c9150e03603fb0fd064 Mon Sep 17 00:00:00 2001 From: Lucia Anna Tarasovicova Date: Tue, 14 Oct 2025 23:24:40 +0200 Subject: [PATCH 750/986] [PWGLF] change in hStrangeCorrelation.cxx (#13377) Co-authored-by: Lucia Anna Tarasovicova --- .../Tasks/Strangeness/hStrangeCorrelation.cxx | 152 ++++++++++++------ 1 file changed, 105 insertions(+), 47 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx b/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx index 42297eb61e3..6adee0c193c 100644 --- a/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx +++ b/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx @@ -133,6 +133,7 @@ struct HStrangeCorrelation { Configurable applyEfficiencyPropagation{"applyEfficiencyPropagation", false, "propagate also the efficiency uncertainty"}; Configurable applyPurityHadron{"applyPurityHadron", false, "apply the purity correction for associated hadrons"}; Configurable applyPurityTrigger{"applyPurityTrigger", false, "apply the purity correction for trigger particle"}; + Configurable applyEffAsFunctionOfMult{"applyEffAsFunctionOfMult", false, "apply efficiency as a function of multiplicity as well"}; } efficiencyFlags; Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository to use"}; Configurable efficiencyCCDBPath{"efficiencyCCDBPath", "GLO/Config/GeometryAligned", "Path of the efficiency corrections"}; @@ -215,6 +216,7 @@ struct HStrangeCorrelation { // objects to use for efficiency corrections TH2F* hEfficiencyTrigger; + TH3F* hEfficiencyTriggerMult; TH2F* hEfficiencyPion; TH2F* hEfficiencyK0Short; TH2F* hEfficiencyLambda; @@ -224,9 +226,12 @@ struct HStrangeCorrelation { TH2F* hEfficiencyOmegaMinus; TH2F* hEfficiencyOmegaPlus; TH2F* hEfficiencyHadron; + TH3F* hEfficiencyHadronMult; TH1F* hPurityHadron; + TH2F* hPurityHadronMult; // objects to propagate the efficiency uncertainty TH2F* hEfficiencyUncertaintyTrigger; + TH3F* hEfficiencyUncertaintyTriggerMult; TH2F* hEfficiencyUncertaintyPion; TH2F* hEfficiencyUncertaintyK0Short; TH2F* hEfficiencyUncertaintyLambda; @@ -236,7 +241,9 @@ struct HStrangeCorrelation { TH2F* hEfficiencyUncertaintyOmegaMinus; TH2F* hEfficiencyUncertaintyOmegaPlus; TH2F* hEfficiencyUncertaintyHadron; + TH3F* hEfficiencyUncertaintyHadronMult; TH1F* hPurityUncertaintyHadron; + TH2F* hPurityUncertaintyHadronMult; using BinningType = ColumnBinningPolicy; using BinningTypePbPb = ColumnBinningPolicy; @@ -307,6 +314,7 @@ struct HStrangeCorrelation { } hEfficiencyTrigger = static_cast(listEfficiencies->FindObject("hEfficiencyTrigger")); + hEfficiencyTriggerMult = static_cast(listEfficiencies->FindObject("hEfficiencyTriggerMult")); hEfficiencyK0Short = static_cast(listEfficiencies->FindObject("hEfficiencyK0Short")); hEfficiencyLambda = static_cast(listEfficiencies->FindObject("hEfficiencyLambda")); hEfficiencyAntiLambda = static_cast(listEfficiencies->FindObject("hEfficiencyAntiLambda")); @@ -315,9 +323,12 @@ struct HStrangeCorrelation { hEfficiencyOmegaMinus = static_cast(listEfficiencies->FindObject("hEfficiencyOmegaMinus")); hEfficiencyOmegaPlus = static_cast(listEfficiencies->FindObject("hEfficiencyOmegaPlus")); hEfficiencyHadron = static_cast(listEfficiencies->FindObject("hEfficiencyHadron")); + hEfficiencyHadronMult = static_cast(listEfficiencies->FindObject("hEfficiencyHadronMult")); hEfficiencyPion = static_cast(listEfficiencies->FindObject("hEfficiencyPion")); hPurityHadron = static_cast(listEfficiencies->FindObject("hPurityHadron")); + hPurityHadronMult = static_cast(listEfficiencies->FindObject("hPurityHadronMult")); hEfficiencyUncertaintyTrigger = static_cast(listEfficiencies->FindObject("hEfficiencyUncertaintyTrigger")); + hEfficiencyUncertaintyTriggerMult = static_cast(listEfficiencies->FindObject("hEfficiencyUncertaintyTriggerMult")); hEfficiencyUncertaintyK0Short = static_cast(listEfficiencies->FindObject("hEfficiencyUncertaintyK0Short")); hEfficiencyUncertaintyLambda = static_cast(listEfficiencies->FindObject("hEfficiencyUncertaintyLambda")); hEfficiencyUncertaintyAntiLambda = static_cast(listEfficiencies->FindObject("hEfficiencyUncertaintyAntiLambda")); @@ -327,7 +338,9 @@ struct HStrangeCorrelation { hEfficiencyUncertaintyOmegaPlus = static_cast(listEfficiencies->FindObject("hEfficiencyUncertaintyOmegaPlus")); hEfficiencyUncertaintyPion = static_cast(listEfficiencies->FindObject("hEfficiencyUncertaintyPion")); hEfficiencyUncertaintyHadron = static_cast(listEfficiencies->FindObject("hEfficiencyUncertaintyHadron")); + hEfficiencyUncertaintyHadronMult = static_cast(listEfficiencies->FindObject("hEfficiencyUncertaintyHadronMult")); hPurityUncertaintyHadron = static_cast(listEfficiencies->FindObject("hPurityUncertaintyHadron")); + hPurityUncertaintyHadronMult = static_cast(listEfficiencies->FindObject("hPurityUncertaintyHadronMult")); if (efficiencyFlags.applyEfficiencyPropagation && !hEfficiencyUncertaintyTrigger) LOG(fatal) << "Problem getting hEfficiencyUncertaintyTrigger!"; LOG(info) << "Efficiencies now loaded for " << mRunNumber; @@ -806,13 +819,28 @@ struct HStrangeCorrelation { float purityTriggErr = 0.0f; if (!mixing) { if (efficiencyFlags.applyEfficiencyForTrigger) { - efficiencyTrigg = hEfficiencyTrigger->Interpolate(trigg.pt(), trigg.eta()); - if (efficiencyFlags.applyPurityTrigger) - purityTrigg = hPurityHadron->Interpolate(trigg.pt()); + if (efficiencyFlags.applyEffAsFunctionOfMult) { + efficiencyTrigg = hEfficiencyTriggerMult->Interpolate(trigg.pt(), trigg.eta(), mult); + } else { + efficiencyTrigg = hEfficiencyTrigger->Interpolate(trigg.pt(), trigg.eta()); + } + if (efficiencyFlags.applyPurityTrigger) { + if (efficiencyFlags.applyEffAsFunctionOfMult) + purityTrigg = hPurityHadronMult->Interpolate(trigg.pt(), mult); + else + purityTrigg = hPurityHadron->Interpolate(trigg.pt()); + } if (efficiencyFlags.applyEfficiencyPropagation) { - efficiencyTriggError = hEfficiencyUncertaintyTrigger->Interpolate(trigg.pt(), trigg.eta()); - if (efficiencyFlags.applyPurityTrigger) - purityTriggErr = hPurityUncertaintyHadron->Interpolate(trigg.pt()); + if (efficiencyFlags.applyEffAsFunctionOfMult) + efficiencyTriggError = hEfficiencyUncertaintyTriggerMult->Interpolate(trigg.pt(), trigg.eta(), mult); + else + efficiencyTriggError = hEfficiencyUncertaintyTrigger->Interpolate(trigg.pt(), trigg.eta()); + if (efficiencyFlags.applyPurityTrigger) { + if (efficiencyFlags.applyEffAsFunctionOfMult) + purityTriggErr = hPurityUncertaintyHadronMult->Interpolate(trigg.pt(), mult); + else + purityTriggErr = hPurityUncertaintyHadron->Interpolate(trigg.pt()); + } } if (efficiencyTrigg == 0) { // check for zero efficiency, do not apply if the case efficiencyTrigg = 1; @@ -984,13 +1012,27 @@ struct HStrangeCorrelation { if (!mixing) { if (efficiencyFlags.applyEfficiencyForTrigger) { - efficiencyTrigger = hEfficiencyTrigger->Interpolate(trigg.pt(), trigg.eta()); - if (efficiencyFlags.applyPurityTrigger) - purityTrigger = hPurityHadron->Interpolate(trigg.pt()); + if (efficiencyFlags.applyEffAsFunctionOfMult) + efficiencyTrigger = hEfficiencyTriggerMult->Interpolate(trigg.pt(), trigg.eta(), mult); + else + efficiencyTrigger = hEfficiencyTrigger->Interpolate(trigg.pt(), trigg.eta()); + if (efficiencyFlags.applyPurityTrigger) { + if (efficiencyFlags.applyEffAsFunctionOfMult) + purityTrigger = hPurityHadronMult->Interpolate(trigg.pt(), mult); + else + purityTrigger = hPurityHadron->Interpolate(trigg.pt()); + } if (efficiencyFlags.applyEfficiencyPropagation) { - efficiencyTriggerError = hEfficiencyUncertaintyTrigger->Interpolate(trigg.pt(), trigg.eta()); - if (efficiencyFlags.applyPurityTrigger) - purityTriggerError = hPurityUncertaintyHadron->Interpolate(trigg.pt()); + if (efficiencyFlags.applyEffAsFunctionOfMult) + efficiencyTriggerError = hEfficiencyUncertaintyTriggerMult->Interpolate(trigg.pt(), trigg.eta(), mult); + else + efficiencyTriggerError = hEfficiencyUncertaintyTrigger->Interpolate(trigg.pt(), trigg.eta()); + if (efficiencyFlags.applyPurityTrigger) { + if (efficiencyFlags.applyEffAsFunctionOfMult) + purityTriggerError = hPurityUncertaintyHadronMult->Interpolate(trigg.pt(), mult); + else + purityTriggerError = hPurityUncertaintyHadron->Interpolate(trigg.pt()); + } } if (efficiencyTrigger == 0) { // check for zero efficiency, do not apply if the case efficiencyTrigger = 1; @@ -1057,13 +1099,27 @@ struct HStrangeCorrelation { if (efficiencyFlags.applyEfficiencyPropagation) efficiencyUncertainty = hEfficiencyUncertaintyPion->Interpolate(ptassoc, assoc.eta()); } else { - efficiency = hEfficiencyHadron->Interpolate(ptassoc, assoc.eta()); - if (efficiencyFlags.applyPurityHadron) - purity = hPurityHadron->Interpolate(ptassoc); + if (efficiencyFlags.applyEffAsFunctionOfMult) + efficiency = hEfficiencyHadronMult->Interpolate(ptassoc, assoc.eta(), mult); + else + efficiency = hEfficiencyHadron->Interpolate(ptassoc, assoc.eta()); + if (efficiencyFlags.applyPurityHadron) { + if (efficiencyFlags.applyEffAsFunctionOfMult) + purity = hPurityHadronMult->Interpolate(ptassoc, mult); + else + purity = hPurityHadron->Interpolate(ptassoc); + } if (efficiencyFlags.applyEfficiencyPropagation) { - efficiencyUncertainty = hEfficiencyUncertaintyHadron->Interpolate(ptassoc, assoc.eta()); - if (efficiencyFlags.applyPurityHadron) - purityUncertainty = hPurityUncertaintyHadron->Interpolate(ptassoc); + if (efficiencyFlags.applyEffAsFunctionOfMult) + efficiencyUncertainty = hEfficiencyUncertaintyHadronMult->Interpolate(ptassoc, assoc.eta(), mult); + else + efficiencyUncertainty = hEfficiencyUncertaintyHadron->Interpolate(ptassoc, assoc.eta()); + if (efficiencyFlags.applyPurityHadron) { + if (efficiencyFlags.applyEffAsFunctionOfMult) + purityUncertainty = hPurityUncertaintyHadronMult->Interpolate(ptassoc, mult); + else + purityUncertainty = hPurityUncertaintyHadron->Interpolate(ptassoc); + } } } } @@ -1409,9 +1465,9 @@ struct HStrangeCorrelation { // MC generated plots if (doprocessMCGenerated) { - histos.add("Generated/hTrigger", "", kTH2F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta}); + histos.add("Generated/hTrigger", "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult}); for (int i = 0; i < 9; i++) { - histos.add(fmt::format("Generated/h{}", kParticlenames[i]).c_str(), "", kTH2F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta}); + histos.add(fmt::format("Generated/h{}", kParticlenames[i]).c_str(), "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult}); } histos.addClone("Generated/", "GeneratedWithPV/"); @@ -1675,28 +1731,28 @@ struct HStrangeCorrelation { histos.fill(HIST("hTriggerPrimaryEtaVsPt"), track.pt(), track.eta(), collision.centFT0M()); histos.fill(HIST("hTrackEtaVsPtVsPhi"), track.pt(), track.eta(), track.phi(), weight); } - for (auto const& assocTrack : assocHadrons) { - auto assoc = assocTrack.track_as(); - if (!isValidAssocHadron(assoc)) - continue; - float efficiency = 1.0f; - float purity = 1.0f; - if (efficiencyFlags.applyEfficiencyCorrection) { - efficiency = hEfficiencyHadron->Interpolate(assoc.pt(), assoc.eta()); - if (efficiencyFlags.applyPurityHadron) - purity = hPurityHadron->Interpolate(assoc.pt()); - } - if (efficiency == 0) { // check for zero efficiency, do not apply if the case - efficiency = 1; - } - float weight = efficiencyFlags.applyEfficiencyCorrection ? purity / efficiency : 1.0f; - histos.fill(HIST("hAssocHadronsAllSelectedEtaVsPt"), assoc.pt(), assoc.eta(), collision.centFT0M()); - histos.fill(HIST("hAssocPtResolution"), assoc.pt(), assocTrack.mcOriginalPt()); - if (doAssocPhysicalPrimary && !assocTrack.mcPhysicalPrimary()) - continue; - histos.fill(HIST("hAssocPrimaryEtaVsPt"), assoc.pt(), assoc.eta(), collision.centFT0M()); - histos.fill(HIST("hAsssocTrackEtaVsPtVsPhi"), assoc.pt(), assoc.eta(), assoc.phi(), weight); + } + for (auto const& assocTrack : assocHadrons) { + auto assoc = assocTrack.track_as(); + if (!isValidAssocHadron(assoc)) + continue; + float efficiency = 1.0f; + float purity = 1.0f; + if (efficiencyFlags.applyEfficiencyCorrection) { + efficiency = hEfficiencyHadron->Interpolate(assoc.pt(), assoc.eta()); + if (efficiencyFlags.applyPurityHadron) + purity = hPurityHadron->Interpolate(assoc.pt()); + } + if (efficiency == 0) { // check for zero efficiency, do not apply if the case + efficiency = 1; } + float weight = efficiencyFlags.applyEfficiencyCorrection ? purity / efficiency : 1.0f; + histos.fill(HIST("hAssocHadronsAllSelectedEtaVsPt"), assoc.pt(), assoc.eta(), collision.centFT0M(), weight); + histos.fill(HIST("hAssocPtResolution"), assoc.pt(), assocTrack.mcOriginalPt()); + if (doAssocPhysicalPrimary && !assocTrack.mcPhysicalPrimary()) + continue; + histos.fill(HIST("hAssocPrimaryEtaVsPt"), assoc.pt(), assoc.eta(), collision.centFT0M()); + histos.fill(HIST("hAsssocTrackEtaVsPtVsPhi"), assoc.pt(), assoc.eta(), assoc.phi(), weight); } // ________________________________________________ @@ -2172,10 +2228,10 @@ struct HStrangeCorrelation { constexpr int Index = i.value; if (i == 0 || i == 7) { if (std::abs(mcParticle.pdgCode()) == kPdgCodes[i]) - histos.fill(HIST("Generated/h") + HIST(kParticlenames[Index]), mcParticle.pt(), mcParticle.eta()); + histos.fill(HIST("Generated/h") + HIST(kParticlenames[Index]), mcParticle.pt(), mcParticle.eta(), 1); } else { if (mcParticle.pdgCode() == kPdgCodes[i]) - histos.fill(HIST("Generated/h") + HIST(kParticlenames[Index]), mcParticle.pt(), mcParticle.eta()); + histos.fill(HIST("Generated/h") + HIST(kParticlenames[Index]), mcParticle.pt(), mcParticle.eta(), 1); } }); } @@ -2265,7 +2321,7 @@ struct HStrangeCorrelation { double geta = mcParticle.eta(); double gpt = mcParticle.pt(); if (std::abs(mcParticle.pdgCode()) == PDG_t::kPiPlus || std::abs(mcParticle.pdgCode()) == PDG_t::kKPlus || std::abs(mcParticle.pdgCode()) == PDG_t::kProton || std::abs(mcParticle.pdgCode()) == PDG_t::kElectron || std::abs(mcParticle.pdgCode()) == PDG_t::kMuonMinus) - histos.fill(HIST("GeneratedWithPV/hTrigger"), gpt, geta); + histos.fill(HIST("GeneratedWithPV/hTrigger"), gpt, geta, bestCollisionFT0Mpercentile); if (mcParticle.pdgCode() == PDG_t::kLambda0 && !doAssocPhysicalPrimaryInGen && !mcParticle.isPhysicalPrimary()) { if (std::abs(geta) > etaSel) { continue; @@ -2311,14 +2367,14 @@ struct HStrangeCorrelation { constexpr int Index = i.value; if (i == 0 || i == 7) { if (std::abs(mcParticle.pdgCode()) == kPdgCodes[i]) { - histos.fill(HIST("GeneratedWithPV/h") + HIST(kParticlenames[Index]), gpt, geta); + histos.fill(HIST("GeneratedWithPV/h") + HIST(kParticlenames[Index]), gpt, geta, bestCollisionFT0Mpercentile); if (std::abs(mcParticle.y()) < ySel) histos.fill(HIST("GeneratedWithPV/h") + HIST(kParticlenames[Index]) + HIST("_MidYVsMult"), gpt, bestCollisionFT0Mpercentile); } } else { if (mcParticle.pdgCode() == kPdgCodes[i]) { - histos.fill(HIST("GeneratedWithPV/h") + HIST(kParticlenames[Index]), gpt, geta); + histos.fill(HIST("GeneratedWithPV/h") + HIST(kParticlenames[Index]), gpt, geta, bestCollisionFT0Mpercentile); if (std::abs(mcParticle.y()) < ySel) histos.fill(HIST("GeneratedWithPV/h") + HIST(kParticlenames[Index]) + HIST("_MidYVsMult"), gpt, bestCollisionFT0Mpercentile); } @@ -2432,7 +2488,9 @@ struct HStrangeCorrelation { if (!doTriggPhysicalPrimary || mcParticle.isPhysicalPrimary()) { triggerIndices.emplace_back(iteratorNum); histos.fill(HIST("ClosureTest/hTrigger"), gpt, geta, bestCollisionFT0Mpercentile); - if (doCorrelationHadron) { + } + if (doCorrelationHadron) { + if (!doAssocPhysicalPrimary || mcParticle.isPhysicalPrimary()) { assocHadronIndices.emplace_back(iteratorNum); histos.fill(HIST("ClosureTest/hHadron"), gpt, geta, gphi); } From 08b26f1f6d8316a4c435b6f30e23c9bf6a674b68 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Wed, 15 Oct 2025 00:42:04 +0200 Subject: [PATCH 751/986] [PWGEM/Dilepton] update MC (#13387) --- PWGEM/Dilepton/Core/Dilepton.h | 12 - PWGEM/Dilepton/Core/DileptonMC.h | 2202 ++++++++++++------------- PWGEM/Dilepton/Core/SingleTrackQC.h | 27 - PWGEM/Dilepton/Core/SingleTrackQCMC.h | 27 - 4 files changed, 1063 insertions(+), 1205 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 14b0fab9e2d..37e16c5ff25 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -238,14 +238,6 @@ struct Dilepton { Configurable cfg_max_TOFNsigmaEl{"cfg_max_TOFNsigmaEl", +3.0, "max. TOF n sigma for electron inclusion"}; Configurable cfg_min_pin_pirejTPC{"cfg_min_pin_pirejTPC", 0.f, "min. pin for pion rejection in TPC"}; Configurable cfg_max_pin_pirejTPC{"cfg_max_pin_pirejTPC", 1e+10, "max. pin for pion rejection in TPC"}; - // Configurable cfg_min_ITSNsigmaKa{"cfg_min_ITSNsigmaKa", -1.0, "min. ITS n sigma for kaon exclusion"}; - // Configurable cfg_max_ITSNsigmaKa{"cfg_max_ITSNsigmaKa", 1e+10, "max. ITS n sigma for kaon exclusion"}; - // Configurable cfg_min_ITSNsigmaPr{"cfg_min_ITSNsigmaPr", -1.0, "min. ITS n sigma for proton exclusion"}; - // Configurable cfg_max_ITSNsigmaPr{"cfg_max_ITSNsigmaPr", 1e+10, "max. ITS n sigma for proton exclusion"}; - // Configurable cfg_min_p_ITSNsigmaKa{"cfg_min_p_ITSNsigmaKa", 0.0, "min p for kaon exclusion in ITS"}; - // Configurable cfg_max_p_ITSNsigmaKa{"cfg_max_p_ITSNsigmaKa", 0.0, "max p for kaon exclusion in ITS"}; - // Configurable cfg_min_p_ITSNsigmaPr{"cfg_min_p_ITSNsigmaPr", 0.0, "min p for proton exclusion in ITS"}; - // Configurable cfg_max_p_ITSNsigmaPr{"cfg_max_p_ITSNsigmaPr", 0.0, "max p for proton exclusion in ITS"}; Configurable enableTTCA{"enableTTCA", true, "Flag to enable or disable TTCA"}; Configurable includeITSsa{"includeITSsa", false, "Flag to enable ITSsa tracks"}; Configurable cfg_max_pt_track_ITSsa{"cfg_max_pt_track_ITSsa", 0.15, "max pt for ITSsa tracks"}; @@ -715,10 +707,6 @@ struct Dilepton { fDielectronCut.SetTPCNsigmaPrRange(dielectroncuts.cfg_min_TPCNsigmaPr, dielectroncuts.cfg_max_TPCNsigmaPr); fDielectronCut.SetTOFNsigmaElRange(dielectroncuts.cfg_min_TOFNsigmaEl, dielectroncuts.cfg_max_TOFNsigmaEl); fDielectronCut.SetPinRangeForPionRejectionTPC(dielectroncuts.cfg_min_pin_pirejTPC, dielectroncuts.cfg_max_pin_pirejTPC); - // fDielectronCut.SetITSNsigmaKaRange(dielectroncuts.cfg_min_ITSNsigmaKa, dielectroncuts.cfg_max_ITSNsigmaKa); - // fDielectronCut.SetITSNsigmaPrRange(dielectroncuts.cfg_min_ITSNsigmaPr, dielectroncuts.cfg_max_ITSNsigmaPr); - // fDielectronCut.SetPRangeForITSNsigmaKa(dielectroncuts.cfg_min_p_ITSNsigmaKa, dielectroncuts.cfg_max_p_ITSNsigmaKa); - // fDielectronCut.SetPRangeForITSNsigmaPr(dielectroncuts.cfg_min_p_ITSNsigmaPr, dielectroncuts.cfg_max_p_ITSNsigmaPr); if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { // please call this at the end of DefineDileptonCut std::vector binsML{}; diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index 16aba3b8991..51de312162f 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -48,6 +48,7 @@ #include "TString.h" #include +#include #include #include #include @@ -105,6 +106,7 @@ struct DileptonMC { Configurable cfgDCAType{"cfgDCAType", 0, "type of DCA for output. 0:3D, 1:XY, 2:Z, else:3D"}; Configurable cfgFillUnfolding{"cfgFillUnfolding", false, "flag to fill histograms for unfolding"}; Configurable cfgRequireTrueAssociation{"cfgRequireTrueAssociation", false, "flag to require true mc collision association"}; + Configurable cfgFillSeparateCharmHadronPairs{"cfgFillSeparateCharmHadronPairs", false, "flag to fill different ccbar pairs separately"}; ConfigurableAxis ConfMllBins{"ConfMllBins", {VARIABLE_WIDTH, 0.00, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.50, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.70, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.80, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.00, 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.10, 2.20, 2.30, 2.40, 2.50, 2.60, 2.70, 2.75, 2.80, 2.85, 2.90, 2.95, 3.00, 3.05, 3.10, 3.15, 3.20, 3.25, 3.30, 3.35, 3.40, 3.45, 3.50, 3.55, 3.60, 3.65, 3.70, 3.75, 3.80, 3.85, 3.90, 3.95, 4.00}, "mll bins for output histograms"}; ConfigurableAxis ConfPtllBins{"ConfPtllBins", {VARIABLE_WIDTH, 0.00, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.50, 3.00, 3.50, 4.00, 4.50, 5.00, 6.00, 7.00, 8.00, 9.00, 10.00}, "pTll bins for output histograms"}; @@ -233,14 +235,6 @@ struct DileptonMC { Configurable cfg_max_TOFNsigmaEl{"cfg_max_TOFNsigmaEl", +3.0, "max. TOF n sigma for electron inclusion"}; Configurable cfg_min_pin_pirejTPC{"cfg_min_pin_pirejTPC", 0.f, "min. pin for pion rejection in TPC"}; Configurable cfg_max_pin_pirejTPC{"cfg_max_pin_pirejTPC", 1e+10, "max. pin for pion rejection in TPC"}; - // Configurable cfg_min_ITSNsigmaKa{"cfg_min_ITSNsigmaKa", -1.0, "min. ITS n sigma for kaon exclusion"}; - // Configurable cfg_max_ITSNsigmaKa{"cfg_max_ITSNsigmaKa", 1e+10, "max. ITS n sigma for kaon exclusion"}; - // Configurable cfg_min_ITSNsigmaPr{"cfg_min_ITSNsigmaPr", -1.0, "min. ITS n sigma for proton exclusion"}; - // Configurable cfg_max_ITSNsigmaPr{"cfg_max_ITSNsigmaPr", 1e+10, "max. ITS n sigma for proton exclusion"}; - // Configurable cfg_min_p_ITSNsigmaKa{"cfg_min_p_ITSNsigmaKa", 0.0, "min p for kaon exclusion in ITS"}; - // Configurable cfg_max_p_ITSNsigmaKa{"cfg_max_p_ITSNsigmaKa", 0.0, "max p for kaon exclusion in ITS"}; - // Configurable cfg_min_p_ITSNsigmaPr{"cfg_min_p_ITSNsigmaPr", 0.0, "min p for proton exclusion in ITS"}; - // Configurable cfg_max_p_ITSNsigmaPr{"cfg_max_p_ITSNsigmaPr", 0.0, "max p for proton exclusion in ITS"}; Configurable enableTTCA{"enableTTCA", true, "Flag to enable or disable TTCA"}; Configurable includeITSsa{"includeITSsa", false, "Flag to enable ITSsa tracks"}; Configurable cfg_max_pt_track_ITSsa{"cfg_max_pt_track_ITSsa", 0.15, "max pt for ITSsa tracks"}; @@ -313,6 +307,30 @@ struct DileptonMC { HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; static constexpr std::string_view event_cut_types[2] = {"before/", "after/"}; + static constexpr std::string_view pair_sign_types[3] = {"uls/", "lspp/", "lsmm/"}; + static constexpr std::string_view dilepton_source_types[20] = { + "sm/Photon/", // 0 + "sm/PromptPi0/", // 1 + "sm/NonPromptPi0/", // 2 + "sm/Eta/", // 3 + "sm/EtaPrime/", // 4 + "sm/Rho/", // 5 + "sm/Omega/", // 6 + "sm/Phi/", // 7 + "sm/PromptJPsi/", // 8 + "sm/NonPromptJPsi/", // 9 + "sm/PromptPsi2S/", // 10 + "sm/NonPromptPsi2S/", // 11 + "sm/Upsilon1S/", // 12 + "sm/Upsilon2S/", // 13 + "sm/Upsilon3S/", // 14 + "ccbar/c2l_c2l/", // 15 + "bbbar/b2l_b2l/", // 16 + "bbbar/b2c2l_b2c2l/", // 17 + "bbbar/b2c2l_b2l_sameb/", // 18 + "bbbar/b2c2l_b2l_diffb/" // 19 + }; // unordered_map is better, but cannot be constexpr. + static constexpr std::string_view unfolding_dilepton_source_types[3] = {"sm/", "ccbar/", "bbbar/"}; ~DileptonMC() {} @@ -376,7 +394,10 @@ struct DileptonMC { const AxisSpec axis_dphi_e_ee{cfg_nbin_dphi_e_ee, 0, M_PI, "#Delta#varphi = #varphi_{l} - #varphi_{ll} (rad.)"}; // for kUPC // generated info - fRegistry.add("Generated/sm/PromptPi0/hs", "generated dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_quadmom, axis_aco, axis_asym_pt, axis_dphi_e_ee}, true); + fRegistry.add("Generated/sm/PromptPi0/uls/hs", "gen. dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_quadmom, axis_aco, axis_asym_pt, axis_dphi_e_ee}, true); + fRegistry.addClone("Generated/sm/PromptPi0/uls/", "Generated/sm/PromptPi0/lspp/"); + fRegistry.addClone("Generated/sm/PromptPi0/uls/", "Generated/sm/PromptPi0/lsmm/"); + fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/NonPromptPi0/"); fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/Eta/"); fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/EtaPrime/"); @@ -389,13 +410,17 @@ struct DileptonMC { fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/NonPromptJPsi/"); fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/PromptPsi2S/"); fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/NonPromptPsi2S/"); - fRegistry.add("Generated/sm/Omega2ll/hPtY", "pT of #omega meson", kTH2D, {axis_y, axis_pt_meson}, true); - fRegistry.add("Generated/sm/Phi2ll/hPtY", "pT of #phi meson", kTH2D, {axis_y, axis_pt_meson}, true); + // fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/Upsilon1S/"); + // fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/Upsilon2S/"); + // fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/Upsilon3S/"); + + fRegistry.add("Generated/sm/Omega2ll/uls/hPtY", "pT of #omega meson", kTH2D, {axis_y, axis_pt_meson}, true); + fRegistry.add("Generated/sm/Phi2ll/uls/hPtY", "pT of #phi meson", kTH2D, {axis_y, axis_pt_meson}, true); + + fRegistry.add("Generated/ccbar/c2l_c2l/uls/hs", "generated dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_quadmom, axis_aco, axis_asym_pt, axis_dphi_e_ee}, true); + fRegistry.addClone("Generated/ccbar/c2l_c2l/uls/", "Generated/ccbar/c2l_c2l/lspp/"); + fRegistry.addClone("Generated/ccbar/c2l_c2l/uls/", "Generated/ccbar/c2l_c2l/lsmm/"); - fRegistry.add("Generated/ccbar/c2l_c2l/hadron_hadron/hs", "generated dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_quadmom, axis_aco, axis_asym_pt, axis_dphi_e_ee}, true); - fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", "Generated/ccbar/c2l_c2l/meson_meson/"); - fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", "Generated/ccbar/c2l_c2l/baryon_baryon/"); - fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", "Generated/ccbar/c2l_c2l/meson_baryon/"); fRegistry.addClone("Generated/ccbar/c2l_c2l/", "Generated/bbbar/b2l_b2l/"); fRegistry.addClone("Generated/ccbar/c2l_c2l/", "Generated/bbbar/b2c2l_b2c2l/"); fRegistry.addClone("Generated/ccbar/c2l_c2l/", "Generated/bbbar/b2c2l_b2l_sameb/"); @@ -411,30 +436,35 @@ struct DileptonMC { static constexpr std::string_view sum_charmed_mesons[] = {"Dpm", "D0", "Dspm"}; static constexpr std::string_view sum_charmed_baryons[] = {"Lcpm", "Xicpm", "Xic0", "Omegac0"}; - for (int im = 0; im < nm; im++) { - fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", Form("Generated/ccbar/c2l_c2l/%s_%s/", charmed_mesons[im].data(), anti_charmed_mesons[im].data())); - } - for (int ib = 0; ib < nb; ib++) { - fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", Form("Generated/ccbar/c2l_c2l/%s_%s/", charmed_baryons[ib].data(), anti_charmed_baryons[ib].data())); - } - for (int im1 = 0; im1 < nm - 1; im1++) { - for (int im2 = im1 + 1; im2 < nm; im2++) { - fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", Form("Generated/ccbar/c2l_c2l/%s_%s/", sum_charmed_mesons[im1].data(), sum_charmed_mesons[im2].data())); - } - } - for (int ib1 = 0; ib1 < nb - 1; ib1++) { - for (int ib2 = ib1 + 1; ib2 < nb; ib2++) { - fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", Form("Generated/ccbar/c2l_c2l/%s_%s/", sum_charmed_baryons[ib1].data(), sum_charmed_baryons[ib2].data())); + if (cfgFillSeparateCharmHadronPairs) { + for (int im = 0; im < nm; im++) { + fRegistry.addClone("Generated/ccbar/c2l_c2l/", Form("Generated/ccbar/%s_%s/", charmed_mesons[im].data(), anti_charmed_mesons[im].data())); } - } - for (int im = 0; im < nm; im++) { for (int ib = 0; ib < nb; ib++) { - fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", Form("Generated/ccbar/c2l_c2l/%s_%s/", sum_charmed_mesons[im].data(), sum_charmed_baryons[ib].data())); + fRegistry.addClone("Generated/ccbar/c2l_c2l/", Form("Generated/ccbar/%s_%s/", charmed_baryons[ib].data(), anti_charmed_baryons[ib].data())); + } + for (int im1 = 0; im1 < nm - 1; im1++) { + for (int im2 = im1 + 1; im2 < nm; im2++) { + fRegistry.addClone("Generated/ccbar/c2l_c2l/", Form("Generated/ccbar/%s_%s/", sum_charmed_mesons[im1].data(), sum_charmed_mesons[im2].data())); + } + } + for (int ib1 = 0; ib1 < nb - 1; ib1++) { + for (int ib2 = ib1 + 1; ib2 < nb; ib2++) { + fRegistry.addClone("Generated/ccbar/c2l_c2l/", Form("Generated/ccbar/%s_%s/", sum_charmed_baryons[ib1].data(), sum_charmed_baryons[ib2].data())); + } + } + for (int im = 0; im < nm; im++) { + for (int ib = 0; ib < nb; ib++) { + fRegistry.addClone("Generated/ccbar/c2l_c2l/", Form("Generated/ccbar/%s_%s/", sum_charmed_mesons[im].data(), sum_charmed_baryons[ib].data())); + } } } // reconstructed pair info - fRegistry.add("Pair/sm/Photon/hs", "rec. dilepton signal", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_quadmom, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_dca}, true); + fRegistry.add("Pair/sm/Photon/uls/hs", "rec. dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_quadmom, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_dca}, true); + + fRegistry.addClone("Pair/sm/Photon/uls/", "Pair/sm/Photon/lspp/"); + fRegistry.addClone("Pair/sm/Photon/uls/", "Pair/sm/Photon/lsmm/"); fRegistry.addClone("Pair/sm/Photon/", "Pair/sm/PromptPi0/"); fRegistry.addClone("Pair/sm/Photon/", "Pair/sm/NonPromptPi0/"); fRegistry.addClone("Pair/sm/Photon/", "Pair/sm/Eta/"); @@ -448,48 +478,59 @@ struct DileptonMC { fRegistry.addClone("Pair/sm/Photon/", "Pair/sm/NonPromptJPsi/"); fRegistry.addClone("Pair/sm/Photon/", "Pair/sm/PromptPsi2S/"); fRegistry.addClone("Pair/sm/Photon/", "Pair/sm/NonPromptPsi2S/"); + // fRegistry.addClone("Pair/sm/Photon/", "Pair/sm/Upsilon1S/"); + // fRegistry.addClone("Pair/sm/Photon/", "Pair/sm/Upsilon2S/"); + // fRegistry.addClone("Pair/sm/Photon/", "Pair/sm/Upsilon3S/"); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - fRegistry.add("Pair/sm/Photon/hMvsPhiV", "m_{ee} vs. #varphi_{V};#varphi (rad.);m_{ee} (GeV/c^{2})", kTH2F, {{90, 0, M_PI}, {100, 0.0f, 1.0f}}, true); - fRegistry.add("Pair/sm/Photon/hMvsRxy", "m_{ee} vs. r_{xy};r_{xy}^{true} (cm);m_{ee} (GeV/c^{2})", kTH2F, {{100, 0, 100}, {100, 0.0f, 1.0f}}, true); - fRegistry.add("Pair/sm/PromptPi0/hMvsPhiV", "m_{ee} vs. #varphi_{V};#varphi (rad.);m_{ee} (GeV/c^{2})", kTH2F, {{90, 0, M_PI}, {100, 0.0f, 1.0f}}, true); - fRegistry.add("Pair/sm/NonPromptPi0/hMvsPhiV", "m_{ee} vs. #varphi_{V};#varphi (rad.);m_{ee} (GeV/c^{2})", kTH2F, {{90, 0, M_PI}, {100, 0.0f, 1.0f}}, true); - fRegistry.add("Pair/sm/PromptPi0/hDeltaPtvsDCA", "#Delta p_{T,1}^{gen-rec} + #Delta p_{T,2}^{gen-rec} vs. DCA_{ee}", kTH2F, {axis_dca_narrow, axis_dpt}, true); - fRegistry.add("Pair/sm/NonPromptPi0/hDeltaPtvsDCA", "#Delta p_{T,1}^{gen-rec} + #Delta p_{T,2}^{gen-rec} vs. DCA_{ee}", kTH2F, {axis_dca_narrow, axis_dpt}, true); - fRegistry.add("Pair/sm/PromptJPsi/hDeltaPtvsDCA", "#Delta p_{T,1}^{gen-rec} + #Delta p_{T,2}^{gen-rec} vs. DCA_{ee}", kTH2F, {axis_dca_narrow, axis_dpt}, true); - fRegistry.add("Pair/sm/NonPromptJPsi/hDeltaPtvsDCA", "#Delta p_{T,1}^{gen-rec} + #Delta p_{T,2}^{gen-rec} vs. DCA_{ee}", kTH2F, {axis_dca_narrow, axis_dpt}, true); - fRegistry.add("Pair/sm/PromptPi0/hDCAz1vsDCAz2", "DCA_{z,1} vs DCA_{z,2}", kTH2F, {axis_dca_track1, axis_dca_track2}, true); - fRegistry.add("Pair/sm/PromptJPsi/hDCAz1vsDCAz2", "DCA_{z,1} vs DCA_{z,2}", kTH2F, {axis_dca_track1, axis_dca_track2}, true); + fRegistry.add("Pair/sm/Photon/uls/hMvsPhiV", "m_{ee} vs. #varphi_{V};#varphi (rad.);m_{ee} (GeV/c^{2})", kTH2F, {{90, 0, M_PI}, {100, 0.0f, 1.0f}}, true); + fRegistry.add("Pair/sm/Photon/uls/hMvsRxy", "m_{ee} vs. r_{xy};r_{xy}^{true} (cm);m_{ee} (GeV/c^{2})", kTH2F, {{100, 0, 100}, {100, 0.0f, 1.0f}}, true); + for (const auto& strSign : pair_sign_types) { + fRegistry.add(std::format("Pair/sm/PromptPi0/{0}hMvsPhiV", strSign), "m_{ee} vs. #varphi_{V};#varphi (rad.);m_{ee} (GeV/c^{2})", kTH2F, {{90, 0, M_PI}, {100, 0.0f, 1.0f}}, true); + fRegistry.add(std::format("Pair/sm/PromptPi0/{0}hDeltaPtvsDCA", strSign), "#Delta p_{T,1}^{gen-rec} + #Delta p_{T,2}^{gen-rec} vs. DCA_{ee}", kTH2F, {axis_dca_narrow, axis_dpt}, true); + fRegistry.add(std::format("Pair/sm/PromptPi0/{0}hDCAz1vsDCAz2", strSign), "DCA_{z,1} vs DCA_{z,2}", kTH2F, {axis_dca_track1, axis_dca_track2}, true); + + fRegistry.add(std::format("Pair/sm/NonPromptPi0/{0}hMvsPhiV", strSign), "m_{ee} vs. #varphi_{V};#varphi (rad.);m_{ee} (GeV/c^{2})", kTH2F, {{90, 0, M_PI}, {100, 0.0f, 1.0f}}, true); + fRegistry.add(std::format("Pair/sm/NonPromptPi0/{0}hDeltaPtvsDCA", strSign), "#Delta p_{T,1}^{gen-rec} + #Delta p_{T,2}^{gen-rec} vs. DCA_{ee}", kTH2F, {axis_dca_narrow, axis_dpt}, true); + fRegistry.add(std::format("Pair/sm/NonPromptPi0/{0}hDCAz1vsDCAz2", strSign), "DCA_{z,1} vs DCA_{z,2}", kTH2F, {axis_dca_track1, axis_dca_track2}, true); + + fRegistry.add(std::format("Pair/sm/PromptJPsi/{0}hDeltaPtvsDCA", strSign), "#Delta p_{T,1}^{gen-rec} + #Delta p_{T,2}^{gen-rec} vs. DCA_{ee}", kTH2F, {axis_dca_narrow, axis_dpt}, true); + fRegistry.add(std::format("Pair/sm/PromptJPsi/{0}hDCAz1vsDCAz2", strSign), "DCA_{z,1} vs DCA_{z,2}", kTH2F, {axis_dca_track1, axis_dca_track2}, true); + fRegistry.add(std::format("Pair/sm/NonPromptJPsi/{0}hDeltaPtvsDCA", strSign), "#Delta p_{T,1}^{gen-rec} + #Delta p_{T,2}^{gen-rec} vs. DCA_{ee}", kTH2F, {axis_dca_narrow, axis_dpt}, true); + fRegistry.add(std::format("Pair/sm/NonPromptJPsi/{0}hDCAz1vsDCAz2", strSign), "DCA_{z,1} vs DCA_{z,2}", kTH2F, {axis_dca_track1, axis_dca_track2}, true); + } } - fRegistry.add("Pair/ccbar/c2l_c2l/hadron_hadron/hs", "hs pair", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_quadmom, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_dca}, true); - fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", "Pair/ccbar/c2l_c2l/meson_meson/"); - fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", "Pair/ccbar/c2l_c2l/baryon_baryon/"); - fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", "Pair/ccbar/c2l_c2l/meson_baryon/"); + fRegistry.add("Pair/ccbar/c2l_c2l/uls/hs", "rec. dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_quadmom, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_dca}, true); + fRegistry.addClone("Pair/ccbar/c2l_c2l/uls/", "Pair/ccbar/c2l_c2l/lspp/"); + fRegistry.addClone("Pair/ccbar/c2l_c2l/uls/", "Pair/ccbar/c2l_c2l/lsmm/"); + fRegistry.addClone("Pair/ccbar/c2l_c2l/", "Pair/bbbar/b2l_b2l/"); fRegistry.addClone("Pair/ccbar/c2l_c2l/", "Pair/bbbar/b2c2l_b2c2l/"); fRegistry.addClone("Pair/ccbar/c2l_c2l/", "Pair/bbbar/b2c2l_b2l_sameb/"); fRegistry.addClone("Pair/ccbar/c2l_c2l/", "Pair/bbbar/b2c2l_b2l_diffb/"); // LS - for (int im = 0; im < nm; im++) { - fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", Form("Pair/ccbar/c2l_c2l/%s_%s/", charmed_mesons[im].data(), anti_charmed_mesons[im].data())); - } - for (int ib = 0; ib < nb; ib++) { - fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", Form("Pair/ccbar/c2l_c2l/%s_%s/", charmed_baryons[ib].data(), anti_charmed_baryons[ib].data())); - } - for (int im1 = 0; im1 < nm - 1; im1++) { - for (int im2 = im1 + 1; im2 < nm; im2++) { - fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", Form("Pair/ccbar/c2l_c2l/%s_%s/", sum_charmed_mesons[im1].data(), sum_charmed_mesons[im2].data())); - } - } - for (int ib1 = 0; ib1 < nb - 1; ib1++) { - for (int ib2 = ib1 + 1; ib2 < nb; ib2++) { - fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", Form("Pair/ccbar/c2l_c2l/%s_%s/", sum_charmed_baryons[ib1].data(), sum_charmed_baryons[ib2].data())); + if (cfgFillSeparateCharmHadronPairs) { + for (int im = 0; im < nm; im++) { + fRegistry.addClone("Pair/ccbar/c2l_c2l/", Form("Pair/ccbar/%s_%s/", charmed_mesons[im].data(), anti_charmed_mesons[im].data())); } - } - for (int im = 0; im < nm; im++) { for (int ib = 0; ib < nb; ib++) { - fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", Form("Pair/ccbar/c2l_c2l/%s_%s/", sum_charmed_mesons[im].data(), sum_charmed_baryons[ib].data())); + fRegistry.addClone("Pair/ccbar/c2l_c2l/", Form("Pair/ccbar/%s_%s/", charmed_baryons[ib].data(), anti_charmed_baryons[ib].data())); + } + for (int im1 = 0; im1 < nm - 1; im1++) { + for (int im2 = im1 + 1; im2 < nm; im2++) { + fRegistry.addClone("Pair/ccbar/c2l_c2l/", Form("Pair/ccbar/%s_%s/", sum_charmed_mesons[im1].data(), sum_charmed_mesons[im2].data())); + } + } + for (int ib1 = 0; ib1 < nb - 1; ib1++) { + for (int ib2 = ib1 + 1; ib2 < nb; ib2++) { + fRegistry.addClone("Pair/ccbar/c2l_c2l/", Form("Pair/ccbar/%s_%s/", sum_charmed_baryons[ib1].data(), sum_charmed_baryons[ib2].data())); + } + } + for (int im = 0; im < nm; im++) { + for (int ib = 0; ib < nb; ib++) { + fRegistry.addClone("Pair/ccbar/c2l_c2l/", Form("Pair/ccbar/%s_%s/", sum_charmed_mesons[im].data(), sum_charmed_baryons[ib].data())); + } } } @@ -506,16 +547,13 @@ struct DileptonMC { const AxisSpec axis_pt_gen{ConfPtllBins, "p_{T,ll}^{gen} (GeV/c)"}; const AxisSpec axis_mass_rec{ConfMllBins, "m_{ll}^{rec} (GeV/c^{2})"}; const AxisSpec axis_pt_rec{ConfPtllBins, "p_{T,ll}^{rec} (GeV/c)"}; - fRegistry.add("Unfold/lf/hsRM", "response matrix for unfolding", kTHnSparseD, {axis_mass_gen, axis_pt_gen, axis_mass_rec, axis_pt_rec}, true); - fRegistry.add("Unfold/lf/hMiss", "missing dilepton for unfolding", kTH2D, {axis_mass_gen, axis_pt_gen}, true); // e.g. true eta is in acceptance, but reconstructed eta is out of acceptance. - fRegistry.add("Unfold/lf/hFake", "fake dilepton for unfolding", kTH2D, {axis_mass_rec, axis_pt_rec}, true); // e.g. true eta is out of acceptance, but reconstructed eta is in acceptance. - fRegistry.addClone("Unfold/lf/", "Unfold/PromptJPsi/"); - fRegistry.addClone("Unfold/lf/", "Unfold/NonPromptJPsi/"); - fRegistry.addClone("Unfold/lf/", "Unfold/PromptPsi2S/"); - fRegistry.addClone("Unfold/lf/", "Unfold/NonPromptPsi2S/"); - fRegistry.addClone("Unfold/lf/", "Unfold/ccbar_uls/"); - fRegistry.addClone("Unfold/lf/", "Unfold/bbbar_uls/"); - fRegistry.addClone("Unfold/lf/", "Unfold/bbbar_ls/"); + fRegistry.add("Unfold/sm/uls/hsRM", "response matrix", kTHnSparseD, {axis_mass_gen, axis_pt_gen, axis_mass_rec, axis_pt_rec}, true); + fRegistry.add("Unfold/sm/uls/hMiss", "missing dilepton", kTH2D, {axis_mass_gen, axis_pt_gen}, true); // e.g. true eta is in acceptance, but reconstructed eta is out of acceptance. + fRegistry.add("Unfold/sm/uls/hFake", "fake dilepton", kTH2D, {axis_mass_rec, axis_pt_rec}, true); // e.g. true eta is out of acceptance, but reconstructed eta is in acceptance. + fRegistry.addClone("Unfold/sm/uls/", "Unfold/sm/lspp/"); + fRegistry.addClone("Unfold/sm/uls/", "Unfold/sm/lsmm/"); + fRegistry.addClone("Unfold/sm/", "Unfold/ccbar/"); + fRegistry.addClone("Unfold/sm/", "Unfold/bbbar/"); } } @@ -614,13 +652,6 @@ struct DileptonMC { mRunNumber = collision.runNumber(); fDielectronCut.SetTrackPhiPositionRange(dielectroncuts.cfg_min_phiposition_track, dielectroncuts.cfg_max_phiposition_track, dielectroncuts.cfgRefR, d_bz, dielectroncuts.cfg_mirror_phi_track); - //// for muon - // o2::base::Propagator::initFieldFromGRP(grpmag); - // if (!o2::base::GeometryManager::isGeometryLoaded()) { - // ccdb->get(geoPath); - // } - // o2::mch::TrackExtrap::setField(); - auto grplhcif = ccdb->getForTimeStamp("GLO/Config/GRPLHCIF", collision.timestamp()); int beamZ1 = grplhcif->getBeamZ(o2::constants::lhc::BeamC); int beamZ2 = grplhcif->getBeamZ(o2::constants::lhc::BeamA); @@ -702,10 +733,6 @@ struct DileptonMC { fDielectronCut.SetTPCNsigmaPrRange(dielectroncuts.cfg_min_TPCNsigmaPr, dielectroncuts.cfg_max_TPCNsigmaPr); fDielectronCut.SetTOFNsigmaElRange(dielectroncuts.cfg_min_TOFNsigmaEl, dielectroncuts.cfg_max_TOFNsigmaEl); fDielectronCut.SetPinRangeForPionRejectionTPC(dielectroncuts.cfg_min_pin_pirejTPC, dielectroncuts.cfg_max_pin_pirejTPC); - // fDielectronCut.SetITSNsigmaKaRange(dielectroncuts.cfg_min_ITSNsigmaKa, dielectroncuts.cfg_max_ITSNsigmaKa); - // fDielectronCut.SetITSNsigmaPrRange(dielectroncuts.cfg_min_ITSNsigmaPr, dielectroncuts.cfg_max_ITSNsigmaPr); - // fDielectronCut.SetPRangeForITSNsigmaKa(dielectroncuts.cfg_min_p_ITSNsigmaKa, dielectroncuts.cfg_max_p_ITSNsigmaKa); - // fDielectronCut.SetPRangeForITSNsigmaPr(dielectroncuts.cfg_min_p_ITSNsigmaPr, dielectroncuts.cfg_max_p_ITSNsigmaPr); if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { // please call this at the end of DefineDileptonCut std::vector binsML{}; @@ -787,11 +814,11 @@ struct DileptonMC { FindCommonMotherFrom2Prongs(posmc, negmc, -pdg_lepton, pdg_lepton, 223, mcparticles), FindCommonMotherFrom2Prongs(posmc, negmc, -pdg_lepton, pdg_lepton, 333, mcparticles), FindCommonMotherFrom2Prongs(posmc, negmc, -pdg_lepton, pdg_lepton, 443, mcparticles), - FindCommonMotherFrom2Prongs(posmc, negmc, -pdg_lepton, pdg_lepton, 100443, mcparticles), - FindCommonMotherFrom2Prongs(posmc, negmc, -pdg_lepton, pdg_lepton, 553, mcparticles), - FindCommonMotherFrom2Prongs(posmc, negmc, -pdg_lepton, pdg_lepton, 100553, mcparticles), - FindCommonMotherFrom2Prongs(posmc, negmc, -pdg_lepton, pdg_lepton, 200553, mcparticles), - FindCommonMotherFrom2Prongs(posmc, negmc, -pdg_lepton, pdg_lepton, 300553, mcparticles)}; + FindCommonMotherFrom2Prongs(posmc, negmc, -pdg_lepton, pdg_lepton, 100443, mcparticles) + // FindCommonMotherFrom2Prongs(posmc, negmc, -pdg_lepton, pdg_lepton, 553, mcparticles), + // FindCommonMotherFrom2Prongs(posmc, negmc, -pdg_lepton, pdg_lepton, 100553, mcparticles), + // FindCommonMotherFrom2Prongs(posmc, negmc, -pdg_lepton, pdg_lepton, 200553, mcparticles) + }; int size = sizeof(arr) / sizeof(*arr); int max = *std::max_element(arr, arr + size); return max; @@ -829,6 +856,486 @@ struct DileptonMC { } } + template + void fillGenHistograms(const int sign1, const int sign2, const int pdgMotherC1, const int pdgMotherC2, const float mass, const float pt, const float rapidity, const float dphi, const float deta, const float cos_thetaPol, const float phiPol, const float quadmom, const float aco, const float asym, const float dphi_e_ee, const float weight) + { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/") + HIST(dilepton_source_types[sourceId]) + HIST("uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/") + HIST(dilepton_source_types[sourceId]) + HIST("lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/") + HIST(dilepton_source_types[sourceId]) + HIST("lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + + if (dilepton_source_types[sourceId].find("ccbar") != std::string_view::npos && cfgFillSeparateCharmHadronPairs) { + if (std::abs(pdgMotherC1) == 411 && std::abs(pdgMotherC2) == 411) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/Dplus_Dminus/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/Dplus_Dminus/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/Dplus_Dminus/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if (std::abs(pdgMotherC1) == 421 && std::abs(pdgMotherC2) == 421) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/D0_D0bar/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/D0_D0bar/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/D0_D0bar/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if (std::abs(pdgMotherC1) == 431 && std::abs(pdgMotherC2) == 431) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/Dsplus_Dsminus/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/Dsplus_Dsminus/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/Dsplus_Dsminus/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if ((std::abs(pdgMotherC1) == 411 && std::abs(pdgMotherC2) == 421) || (std::abs(pdgMotherC2) == 411 && std::abs(pdgMotherC1) == 421)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/Dpm_D0/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/Dpm_D0/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/Dpm_D0/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if ((std::abs(pdgMotherC1) == 411 && std::abs(pdgMotherC2) == 431) || (std::abs(pdgMotherC2) == 411 && std::abs(pdgMotherC1) == 431)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/Dpm_Dspm/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/Dpm_Dspm/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/Dpm_Dspm/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if ((std::abs(pdgMotherC1) == 421 && std::abs(pdgMotherC2) == 431) || (std::abs(pdgMotherC2) == 421 && std::abs(pdgMotherC1) == 431)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/D0_Dspm/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/D0_Dspm/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/D0_Dspm/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if (std::abs(pdgMotherC1) == 4122 && std::abs(pdgMotherC2) == 4122) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/Lcplus_Lcminus/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/Lcplus_Lcminus/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/Lcplus_Lcminus/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if (std::abs(pdgMotherC1) == 4232 && std::abs(pdgMotherC2) == 4232) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/Xicplus_Xicminus/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/Xicplus_Xicminus/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/Xicplus_Xicminus/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if (std::abs(pdgMotherC1) == 4132 && std::abs(pdgMotherC2) == 4132) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/Xic0_Xic0bar/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/Xic0_Xic0bar/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/Xic0_Xic0bar/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if (std::abs(pdgMotherC1) == 4332 && std::abs(pdgMotherC2) == 4332) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/Omegac0_Omegac0bar/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/Omegac0_Omegac0bar/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/Omegac0_Omegac0bar/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if ((std::abs(pdgMotherC1) == 4122 && std::abs(pdgMotherC2) == 4232) || (std::abs(pdgMotherC2) == 4122 && std::abs(pdgMotherC1) == 4232)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/Lcpm_Xicpm/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/Lcpm_Xicpm/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/Lcpm_Xicpm/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if ((std::abs(pdgMotherC1) == 4122 && std::abs(pdgMotherC2) == 4132) || (std::abs(pdgMotherC2) == 4122 && std::abs(pdgMotherC1) == 4132)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/Lcpm_Xic0/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/Lcpm_Xic0/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/Lcpm_Xic0/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if ((std::abs(pdgMotherC1) == 4122 && std::abs(pdgMotherC2) == 4332) || (std::abs(pdgMotherC2) == 4122 && std::abs(pdgMotherC1) == 4332)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/Lcpm_Omegac0/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/Lcpm_Omegac0/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/Lcpm_Omegac0/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if ((std::abs(pdgMotherC1) == 4232 && std::abs(pdgMotherC2) == 4132) || (std::abs(pdgMotherC2) == 4232 && std::abs(pdgMotherC1) == 4132)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/Xicpm_Xic0/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/Xicpm_Xic0/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/Xicpm_Xic0/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if ((std::abs(pdgMotherC1) == 4232 && std::abs(pdgMotherC2) == 4332) || (std::abs(pdgMotherC2) == 4232 && std::abs(pdgMotherC1) == 4332)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/Xicpm_Omegac0/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/Xicpm_Omegac0/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/Xicpm_Omegac0/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if ((std::abs(pdgMotherC1) == 4132 && std::abs(pdgMotherC2) == 4332) || (std::abs(pdgMotherC2) == 4132 && std::abs(pdgMotherC1) == 4332)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/Xic0_Omegac0/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/Xic0_Omegac0/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/Xic0_Omegac0/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if ((std::abs(pdgMotherC1) == 411 && std::abs(pdgMotherC2) == 4122) || (std::abs(pdgMotherC2) == 411 && std::abs(pdgMotherC1) == 4122)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/Dpm_Lcpm/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/Dpm_Lcpm/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/Dpm_Lcpm/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if ((std::abs(pdgMotherC1) == 411 && std::abs(pdgMotherC2) == 4232) || (std::abs(pdgMotherC2) == 411 && std::abs(pdgMotherC1) == 4232)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/Dpm_Xicpm/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/Dpm_Xicpm/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/Dpm_Xicpm/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if ((std::abs(pdgMotherC1) == 411 && std::abs(pdgMotherC2) == 4132) || (std::abs(pdgMotherC2) == 411 && std::abs(pdgMotherC1) == 4132)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/Dpm_Xic0/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/Dpm_Xic0/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/Dpm_Xic0/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if ((std::abs(pdgMotherC1) == 411 && std::abs(pdgMotherC2) == 4332) || (std::abs(pdgMotherC2) == 411 && std::abs(pdgMotherC1) == 4332)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/Dpm_Omegac0/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/Dpm_Omegac0/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/Dpm_Omegac0/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if ((std::abs(pdgMotherC1) == 421 && std::abs(pdgMotherC2) == 4122) || (std::abs(pdgMotherC2) == 421 && std::abs(pdgMotherC1) == 4122)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/D0_Lcpm/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/D0_Lcpm/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/D0_Lcpm/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if ((std::abs(pdgMotherC1) == 421 && std::abs(pdgMotherC2) == 4232) || (std::abs(pdgMotherC2) == 421 && std::abs(pdgMotherC1) == 4232)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/D0_Xicpm/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/D0_Xicpm/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/D0_Xicpm/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if ((std::abs(pdgMotherC1) == 421 && std::abs(pdgMotherC2) == 4132) || (std::abs(pdgMotherC2) == 421 && std::abs(pdgMotherC1) == 4132)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/D0_Xic0/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/D0_Xic0/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/D0_Xic0/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if ((std::abs(pdgMotherC1) == 421 && std::abs(pdgMotherC2) == 4332) || (std::abs(pdgMotherC2) == 421 && std::abs(pdgMotherC1) == 4332)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/D0_Omegac0/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/D0_Omegac0/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/D0_Omegac0/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if ((std::abs(pdgMotherC1) == 431 && std::abs(pdgMotherC2) == 4122) || (std::abs(pdgMotherC2) == 431 && std::abs(pdgMotherC1) == 4122)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/Dspm_Lcpm/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/Dspm_Lcpm/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/Dspm_Lcpm/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if ((std::abs(pdgMotherC1) == 431 && std::abs(pdgMotherC2) == 4232) || (std::abs(pdgMotherC2) == 431 && std::abs(pdgMotherC1) == 4232)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/Dspm_Xicpm/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/Dspm_Xicpm/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/Dspm_Xicpm/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if ((std::abs(pdgMotherC1) == 431 && std::abs(pdgMotherC2) == 4132) || (std::abs(pdgMotherC2) == 431 && std::abs(pdgMotherC1) == 4132)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/Dspm_Xic0/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/Dspm_Xic0/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/Dspm_Xic0/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } else if ((std::abs(pdgMotherC1) == 431 && std::abs(pdgMotherC2) == 4332) || (std::abs(pdgMotherC2) == 431 && std::abs(pdgMotherC1) == 4332)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Generated/ccbar/Dspm_Omegac0/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Generated/ccbar/Dspm_Omegac0/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Generated/ccbar/Dspm_Omegac0/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, weight); + } + } + } + } + + template + void fillRecHistograms(const int sign1, const int sign2, const int pdgMotherC1, const int pdgMotherC2, const float mass, const float pt, const float rapidity, const float dphi, const float deta, const float cos_thetaPol, const float phiPol, const float quadmom, const float aco, const float asym, const float dphi_e_ee, const float pair_dca, const float weight) + { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/") + HIST(dilepton_source_types[sourceId]) + HIST("uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/") + HIST(dilepton_source_types[sourceId]) + HIST("lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/") + HIST(dilepton_source_types[sourceId]) + HIST("lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + + if (dilepton_source_types[sourceId].find("ccbar") != std::string_view::npos && cfgFillSeparateCharmHadronPairs) { + if (std::abs(pdgMotherC1) == 411 && std::abs(pdgMotherC2) == 411) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/Dplus_Dminus/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/Dplus_Dminus/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/Dplus_Dminus/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if (std::abs(pdgMotherC1) == 421 && std::abs(pdgMotherC2) == 421) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/D0_D0bar/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/D0_D0bar/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/D0_D0bar/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if (std::abs(pdgMotherC1) == 431 && std::abs(pdgMotherC2) == 431) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/Dsplus_Dsminus/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/Dsplus_Dsminus/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/Dsplus_Dsminus/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if ((std::abs(pdgMotherC1) == 411 && std::abs(pdgMotherC2) == 421) || (std::abs(pdgMotherC2) == 411 && std::abs(pdgMotherC1) == 421)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/Dpm_D0/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/Dpm_D0/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/Dpm_D0/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if ((std::abs(pdgMotherC1) == 411 && std::abs(pdgMotherC2) == 431) || (std::abs(pdgMotherC2) == 411 && std::abs(pdgMotherC1) == 431)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/Dpm_Dspm/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/Dpm_Dspm/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/Dpm_Dspm/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if ((std::abs(pdgMotherC1) == 421 && std::abs(pdgMotherC2) == 431) || (std::abs(pdgMotherC2) == 421 && std::abs(pdgMotherC1) == 431)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/D0_Dspm/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/D0_Dspm/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/D0_Dspm/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if (std::abs(pdgMotherC1) == 4122 && std::abs(pdgMotherC2) == 4122) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/Lcplus_Lcminus/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/Lcplus_Lcminus/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/Lcplus_Lcminus/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if (std::abs(pdgMotherC1) == 4232 && std::abs(pdgMotherC2) == 4232) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/Xicplus_Xicminus/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/Xicplus_Xicminus/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/Xicplus_Xicminus/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if (std::abs(pdgMotherC1) == 4132 && std::abs(pdgMotherC2) == 4132) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/Xic0_Xic0bar/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/Xic0_Xic0bar/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/Xic0_Xic0bar/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if (std::abs(pdgMotherC1) == 4332 && std::abs(pdgMotherC2) == 4332) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/Omegac0_Omegac0bar/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/Omegac0_Omegac0bar/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/Omegac0_Omegac0bar/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if ((std::abs(pdgMotherC1) == 4122 && std::abs(pdgMotherC2) == 4232) || (std::abs(pdgMotherC2) == 4122 && std::abs(pdgMotherC1) == 4232)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/Lcpm_Xicpm/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/Lcpm_Xicpm/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/Lcpm_Xicpm/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if ((std::abs(pdgMotherC1) == 4122 && std::abs(pdgMotherC2) == 4132) || (std::abs(pdgMotherC2) == 4122 && std::abs(pdgMotherC1) == 4132)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/Lcpm_Xic0/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/Lcpm_Xic0/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/Lcpm_Xic0/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if ((std::abs(pdgMotherC1) == 4122 && std::abs(pdgMotherC2) == 4332) || (std::abs(pdgMotherC2) == 4122 && std::abs(pdgMotherC1) == 4332)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/Lcpm_Omegac0/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/Lcpm_Omegac0/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/Lcpm_Omegac0/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if ((std::abs(pdgMotherC1) == 4232 && std::abs(pdgMotherC2) == 4132) || (std::abs(pdgMotherC2) == 4232 && std::abs(pdgMotherC1) == 4132)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/Xicpm_Xic0/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/Xicpm_Xic0/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/Xicpm_Xic0/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if ((std::abs(pdgMotherC1) == 4232 && std::abs(pdgMotherC2) == 4332) || (std::abs(pdgMotherC2) == 4232 && std::abs(pdgMotherC1) == 4332)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/Xicpm_Omegac0/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/Xicpm_Omegac0/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/Xicpm_Omegac0/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if ((std::abs(pdgMotherC1) == 4132 && std::abs(pdgMotherC2) == 4332) || (std::abs(pdgMotherC2) == 4132 && std::abs(pdgMotherC1) == 4332)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/Xic0_Omegac0/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/Xic0_Omegac0/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/Xic0_Omegac0/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if ((std::abs(pdgMotherC1) == 411 && std::abs(pdgMotherC2) == 4122) || (std::abs(pdgMotherC2) == 411 && std::abs(pdgMotherC1) == 4122)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/Dpm_Lcpm/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/Dpm_Lcpm/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/Dpm_Lcpm/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if ((std::abs(pdgMotherC1) == 411 && std::abs(pdgMotherC2) == 4232) || (std::abs(pdgMotherC2) == 411 && std::abs(pdgMotherC1) == 4232)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/Dpm_Xicpm/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/Dpm_Xicpm/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/Dpm_Xicpm/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if ((std::abs(pdgMotherC1) == 411 && std::abs(pdgMotherC2) == 4132) || (std::abs(pdgMotherC2) == 411 && std::abs(pdgMotherC1) == 4132)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/Dpm_Xic0/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/Dpm_Xic0/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/Dpm_Xic0/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if ((std::abs(pdgMotherC1) == 411 && std::abs(pdgMotherC2) == 4332) || (std::abs(pdgMotherC2) == 411 && std::abs(pdgMotherC1) == 4332)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/Dpm_Omegac0/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/Dpm_Omegac0/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/Dpm_Omegac0/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if ((std::abs(pdgMotherC1) == 421 && std::abs(pdgMotherC2) == 4122) || (std::abs(pdgMotherC2) == 421 && std::abs(pdgMotherC1) == 4122)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/D0_Lcpm/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/D0_Lcpm/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/D0_Lcpm/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if ((std::abs(pdgMotherC1) == 421 && std::abs(pdgMotherC2) == 4232) || (std::abs(pdgMotherC2) == 421 && std::abs(pdgMotherC1) == 4232)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/D0_Xicpm/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/D0_Xicpm/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/D0_Xicpm/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if ((std::abs(pdgMotherC1) == 421 && std::abs(pdgMotherC2) == 4132) || (std::abs(pdgMotherC2) == 421 && std::abs(pdgMotherC1) == 4132)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/D0_Xic0/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/D0_Xic0/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/D0_Xic0/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if ((std::abs(pdgMotherC1) == 421 && std::abs(pdgMotherC2) == 4332) || (std::abs(pdgMotherC2) == 421 && std::abs(pdgMotherC1) == 4332)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/D0_Omegac0/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/D0_Omegac0/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/D0_Omegac0/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if ((std::abs(pdgMotherC1) == 431 && std::abs(pdgMotherC2) == 4122) || (std::abs(pdgMotherC2) == 431 && std::abs(pdgMotherC1) == 4122)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/Dspm_Lcpm/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/Dspm_Lcpm/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/Dspm_Lcpm/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if ((std::abs(pdgMotherC1) == 431 && std::abs(pdgMotherC2) == 4232) || (std::abs(pdgMotherC2) == 431 && std::abs(pdgMotherC1) == 4232)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/Dspm_Xicpm/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/Dspm_Xicpm/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/Dspm_Xicpm/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if ((std::abs(pdgMotherC1) == 431 && std::abs(pdgMotherC2) == 4132) || (std::abs(pdgMotherC2) == 431 && std::abs(pdgMotherC1) == 4132)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/Dspm_Xic0/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/Dspm_Xic0/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/Dspm_Xic0/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } else if ((std::abs(pdgMotherC1) == 431 && std::abs(pdgMotherC2) == 4332) || (std::abs(pdgMotherC2) == 431 && std::abs(pdgMotherC1) == 4332)) { + if (sign1 * sign2 < 0) { // ULS + fRegistry.fill(HIST("Pair/ccbar/Dspm_Omegac0/uls/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 > 0 && sign2 > 0) { // LS++ + fRegistry.fill(HIST("Pair/ccbar/Dspm_Omegac0/lspp/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } else if (sign1 < 0 && sign2 < 0) { // LS-- + fRegistry.fill(HIST("Pair/ccbar/Dspm_Omegac0/lsmm/hs"), mass, pt, rapidity, dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, dphi_e_ee, pair_dca, weight); + } + } + } + } + template bool fillTruePairInfo(TCollision const& collision, TMCCollisions const&, TTrack1 const& t1, TTrack2 const& t2, TCut const& cut, TAllTracks const& tracks, TMCParticles const& mcparticles) { @@ -1032,7 +1539,7 @@ struct DileptonMC { return false; } - if (mother_id > -1 && t1mc.pdgCode() * t2mc.pdgCode() < 0) { + if (mother_id > -1) { auto mcmother = mcparticles.iteratorAt(mother_id); if (mcmother.isPhysicalPrimary() || mcmother.producedByGenerator()) { if ((t1mc.isPhysicalPrimary() || t1mc.producedByGenerator()) && (t2mc.isPhysicalPrimary() || t2mc.producedByGenerator())) { @@ -1040,62 +1547,104 @@ struct DileptonMC { float deltaPt2 = t2mc.pt() - t2.pt(); switch (std::abs(mcmother.pdgCode())) { case 111: - if (IsFromCharm(mcmother, mcparticles) < 0 && IsFromBeauty(mcmother, mcparticles) < 0) { // prompt pi0 - fRegistry.fill(HIST("Pair/sm/PromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + if (IsFromCharm(mcmother, mcparticles) < 0 && IsFromBeauty(mcmother, mcparticles) < 0) { // prompt pi0 + fillRecHistograms<1>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // prompt pi0 if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - fRegistry.fill(HIST("Pair/sm/PromptPi0/hDeltaPtvsDCA"), pair_dca, deltaPt1 + deltaPt2); - fRegistry.fill(HIST("Pair/sm/PromptPi0/hMvsPhiV"), phiv, v12.M()); - fRegistry.fill(HIST("Pair/sm/PromptPi0/hDCAz1vsDCAz2"), dcaZinSigma(t1), dcaZinSigma(t2)); + if (t1.sign() * t2.sign() < 0) { // ULS + fRegistry.fill(HIST("Pair/sm/PromptPi0/uls/hMvsPhiV"), phiv, v12.M()); + fRegistry.fill(HIST("Pair/sm/PromptPi0/uls/hDeltaPtvsDCA"), pair_dca, deltaPt1 + deltaPt2); + fRegistry.fill(HIST("Pair/sm/PromptPi0/uls/hDCAz1vsDCAz2"), dcaZinSigma(t1), dcaZinSigma(t2)); + } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ + fRegistry.fill(HIST("Pair/sm/PromptPi0/lspp/hMvsPhiV"), phiv, v12.M()); + fRegistry.fill(HIST("Pair/sm/PromptPi0/lspp/hDeltaPtvsDCA"), pair_dca, deltaPt1 + deltaPt2); + fRegistry.fill(HIST("Pair/sm/PromptPi0/lspp/hDCAz1vsDCAz2"), dcaZinSigma(t1), dcaZinSigma(t2)); + } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- + fRegistry.fill(HIST("Pair/sm/PromptPi0/lsmm/hMvsPhiV"), phiv, v12.M()); + fRegistry.fill(HIST("Pair/sm/PromptPi0/lsmm/hDeltaPtvsDCA"), pair_dca, deltaPt1 + deltaPt2); + fRegistry.fill(HIST("Pair/sm/PromptPi0/lsmm/hDCAz1vsDCAz2"), dcaZinSigma(t1), dcaZinSigma(t2)); + } } - } else { // non-prompt pi0 - fRegistry.fill(HIST("Pair/sm/NonPromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + } else { // non-prompt pi0 + fillRecHistograms<2>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // non-prompt pi0 if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - fRegistry.fill(HIST("Pair/sm/NonPromptPi0/hDeltaPtvsDCA"), pair_dca, deltaPt1 + deltaPt2); - fRegistry.fill(HIST("Pair/sm/NonPromptPi0/hMvsPhiV"), phiv, v12.M()); + if (t1.sign() * t2.sign() < 0) { // ULS + fRegistry.fill(HIST("Pair/sm/NonPromptPi0/uls/hMvsPhiV"), phiv, v12.M()); + fRegistry.fill(HIST("Pair/sm/NonPromptPi0/uls/hDeltaPtvsDCA"), pair_dca, deltaPt1 + deltaPt2); + fRegistry.fill(HIST("Pair/sm/NonPromptPi0/uls/hDCAz1vsDCAz2"), dcaZinSigma(t1), dcaZinSigma(t2)); + } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ + fRegistry.fill(HIST("Pair/sm/NonPromptPi0/lspp/hMvsPhiV"), phiv, v12.M()); + fRegistry.fill(HIST("Pair/sm/NonPromptPi0/lspp/hDeltaPtvsDCA"), pair_dca, deltaPt1 + deltaPt2); + fRegistry.fill(HIST("Pair/sm/NonPromptPi0/lspp/hDCAz1vsDCAz2"), dcaZinSigma(t1), dcaZinSigma(t2)); + } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- + fRegistry.fill(HIST("Pair/sm/NonPromptPi0/lsmm/hMvsPhiV"), phiv, v12.M()); + fRegistry.fill(HIST("Pair/sm/NonPromptPi0/lsmm/hDeltaPtvsDCA"), pair_dca, deltaPt1 + deltaPt2); + fRegistry.fill(HIST("Pair/sm/NonPromptPi0/lsmm/hDCAz1vsDCAz2"), dcaZinSigma(t1), dcaZinSigma(t2)); + } } } break; case 221: - fRegistry.fill(HIST("Pair/sm/Eta/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fillRecHistograms<3>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // eta break; case 331: - fRegistry.fill(HIST("Pair/sm/EtaPrime/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fillRecHistograms<4>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // eta' break; case 113: - fRegistry.fill(HIST("Pair/sm/Rho/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fillRecHistograms<5>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // rho break; case 223: - fRegistry.fill(HIST("Pair/sm/Omega/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - if (mcmother.daughtersIds().size() == 2) { // omeag->ee - fRegistry.fill(HIST("Pair/sm/Omega2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fillRecHistograms<6>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // omega + if (mcmother.daughtersIds().size() == 2) { + if (t1.sign() * t2.sign() < 0) { // ULS + fRegistry.fill(HIST("Pair/sm/Omega2ll/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // omeag->ee + } } break; case 333: - fRegistry.fill(HIST("Pair/sm/Phi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - if (mcmother.daughtersIds().size() == 2) { // phi->ee - fRegistry.fill(HIST("Pair/sm/Phi2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fillRecHistograms<7>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // phi + if (mcmother.daughtersIds().size() == 2) { + if (t1.sign() * t2.sign() < 0) { // ULS + fRegistry.fill(HIST("Pair/sm/Phi2ll/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // phi->ee + } } break; case 443: { if (IsFromBeauty(mcmother, mcparticles) > 0) { - fRegistry.fill(HIST("Pair/sm/NonPromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fillRecHistograms<9>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // non-prompt J/psi if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - fRegistry.fill(HIST("Pair/sm/NonPromptJPsi/hDeltaPtvsDCA"), pair_dca, deltaPt1 + deltaPt2); + if (t1.sign() * t2.sign() < 0) { // ULS + fRegistry.fill(HIST("Pair/sm/NonPromptJPsi/uls/hDeltaPtvsDCA"), pair_dca, deltaPt1 + deltaPt2); + fRegistry.fill(HIST("Pair/sm/NonPromptJPsi/uls/hDCAz1vsDCAz2"), dcaZinSigma(t1), dcaZinSigma(t2)); + } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ + fRegistry.fill(HIST("Pair/sm/NonPromptJPsi/lspp/hDeltaPtvsDCA"), pair_dca, deltaPt1 + deltaPt2); + fRegistry.fill(HIST("Pair/sm/NonPromptJPsi/lspp/hDCAz1vsDCAz2"), dcaZinSigma(t1), dcaZinSigma(t2)); + } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- + fRegistry.fill(HIST("Pair/sm/NonPromptJPsi/lsmm/hDeltaPtvsDCA"), pair_dca, deltaPt1 + deltaPt2); + fRegistry.fill(HIST("Pair/sm/NonPromptJPsi/lsmm/hDCAz1vsDCAz2"), dcaZinSigma(t1), dcaZinSigma(t2)); + } } } else { - fRegistry.fill(HIST("Pair/sm/PromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fillRecHistograms<8>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // prompt J/psi if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - fRegistry.fill(HIST("Pair/sm/PromptJPsi/hDeltaPtvsDCA"), pair_dca, deltaPt1 + deltaPt2); - fRegistry.fill(HIST("Pair/sm/PromptJPsi/hDCAz1vsDCAz2"), dcaZinSigma(t1), dcaZinSigma(t2)); + if (t1.sign() * t2.sign() < 0) { // ULS + fRegistry.fill(HIST("Pair/sm/PromptJPsi/uls/hDeltaPtvsDCA"), pair_dca, deltaPt1 + deltaPt2); + fRegistry.fill(HIST("Pair/sm/PromptJPsi/uls/hDCAz1vsDCAz2"), dcaZinSigma(t1), dcaZinSigma(t2)); + } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ + fRegistry.fill(HIST("Pair/sm/PromptJPsi/lspp/hDeltaPtvsDCA"), pair_dca, deltaPt1 + deltaPt2); + fRegistry.fill(HIST("Pair/sm/PromptJPsi/lspp/hDCAz1vsDCAz2"), dcaZinSigma(t1), dcaZinSigma(t2)); + } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- + fRegistry.fill(HIST("Pair/sm/PromptJPsi/lsmm/hDeltaPtvsDCA"), pair_dca, deltaPt1 + deltaPt2); + fRegistry.fill(HIST("Pair/sm/PromptJPsi/lsmm/hDCAz1vsDCAz2"), dcaZinSigma(t1), dcaZinSigma(t2)); + } } } break; } case 100443: { if (IsFromBeauty(mcmother, mcparticles) > 0) { - fRegistry.fill(HIST("Pair/sm/NonPromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fillRecHistograms<11>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // non-prompt psi2S } else { - fRegistry.fill(HIST("Pair/sm/PromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fillRecHistograms<10>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // prompt psi2S } break; } @@ -1105,11 +1654,11 @@ struct DileptonMC { } else if (!(t1mc.isPhysicalPrimary() || t1mc.producedByGenerator()) && !(t2mc.isPhysicalPrimary() || t2mc.producedByGenerator())) { switch (std::abs(mcmother.pdgCode())) { case 22: - fRegistry.fill(HIST("Pair/sm/Photon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); + fillRecHistograms<0>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // photon conversion if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - fRegistry.fill(HIST("Pair/sm/Photon/hMvsPhiV"), phiv, v12.M()); + fRegistry.fill(HIST("Pair/sm/Photon/uls/hMvsPhiV"), phiv, v12.M()); float rxy_gen = std::sqrt(std::pow(t1mc.vx(), 2) + std::pow(t1mc.vy(), 2)); - fRegistry.fill(HIST("Pair/sm/Photon/hMvsRxy"), rxy_gen, v12.M()); + fRegistry.fill(HIST("Pair/sm/Photon/uls/hMvsRxy"), rxy_gen, v12.M()); } break; default: @@ -1121,182 +1670,223 @@ struct DileptonMC { if ((t1mc.isPhysicalPrimary() || t1mc.producedByGenerator()) && (t2mc.isPhysicalPrimary() || t2mc.producedByGenerator())) { auto mp1 = mcparticles.iteratorAt(t1mc.mothersIds()[0]); auto mp2 = mcparticles.iteratorAt(t2mc.mothersIds()[0]); - if (t1mc.pdgCode() * t2mc.pdgCode() < 0) { // ULS - switch (hfee_type) { - case static_cast(EM_HFeeType::kCe_Ce): { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - if (isCharmMeson(mp1) && isCharmMeson(mp2)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - if (std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 411) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dplus_Dminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if (std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 421) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_D0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if (std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 431) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dsplus_Dsminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 421) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 421)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_D0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 431)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 431)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } - } else if (isCharmBaryon(mp1) && isCharmBaryon(mp2)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - if (std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4122) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcplus_Lcminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if (std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4232) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicplus_Xicminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if (std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4132) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xic0_Xic0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if (std::abs(mp1.pdgCode()) == 4332 && std::abs(mp2.pdgCode()) == 4332) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Omegac0_Omegac0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Lcpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xicpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4132 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Xic0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } - } else { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/D0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/Dspm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } - } - break; - } - case static_cast(EM_HFeeType::kBe_Be): { - fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - if (isBeautyMeson(mp1) && isBeautyMeson(mp2)) { - fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if (isBeautyBaryon(mp1) && isBeautyBaryon(mp2)) { - fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else { - fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } - break; - } - case static_cast(EM_HFeeType::kBCe_BCe): { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - if (isCharmMeson(mp1) && isCharmMeson(mp2)) { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if (isCharmBaryon(mp1) && isCharmBaryon(mp2)) { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } - break; - } - case static_cast(EM_HFeeType::kBCe_Be_SameB): { // ULS - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } - break; - } - case static_cast(EM_HFeeType::kBCe_Be_DiffB): // LS - LOGF(info, "You should not see kBCe_Be_DiffB in ULS. Good luck."); - break; - default: - break; + switch (hfee_type) { + case static_cast(EM_HFeeType::kCe_Ce): { // ULS + fillRecHistograms<15>(t1.sign(), t2.sign(), mp1.pdgCode(), mp2.pdgCode(), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // c2l_c2l + break; } - } else { // LS - switch (hfee_type) { - case static_cast(EM_HFeeType::kCe_Ce): - LOGF(info, "You should not see kCe_Ce in LS. Good luck."); - break; - case static_cast(EM_HFeeType::kBe_Be): - LOGF(info, "You should not see kBe_Be in LS. Good luck."); - break; - case static_cast(EM_HFeeType::kBCe_BCe): - LOGF(info, "You should not see kBCe_BCe in LS. Good luck."); - break; - case static_cast(EM_HFeeType::kBCe_Be_SameB): // ULS - LOGF(info, "You should not see kBCe_Be_SameB in LS. Good luck."); - break; - case static_cast(EM_HFeeType::kBCe_Be_DiffB): { // LS - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } else { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); - } - break; - } - default: - break; + case static_cast(EM_HFeeType::kBe_Be): { // ULS + fillRecHistograms<16>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // b2l_b2l + break; + } + case static_cast(EM_HFeeType::kBCe_BCe): { // ULS + fillRecHistograms<17>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // b2c2l_b2c2l + break; + } + case static_cast(EM_HFeeType::kBCe_Be_SameB): { // ULS + fillRecHistograms<18>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // b2c2l_b2l_sameb + break; } + case static_cast(EM_HFeeType::kBCe_Be_DiffB): // LS + fillRecHistograms<19>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // b2c2l_b2l_diffb + break; + default: + break; } } } // end of HF evaluation return true; } - SliceCache cache; - Preslice perCollision_electron = aod::emprimaryelectron::emeventId; - Filter trackFilter_electron = nabs(o2::aod::track::dcaXY) < dielectroncuts.cfg_max_dcaxy && nabs(o2::aod::track::dcaZ) < dielectroncuts.cfg_max_dcaz; - Filter ttcaFilter_electron = ifnode(dielectroncuts.enableTTCA.node(), o2::aod::emprimaryelectron::isAssociatedToMPC == true || o2::aod::emprimaryelectron::isAssociatedToMPC == false, o2::aod::emprimaryelectron::isAssociatedToMPC == true); - Filter prefilter_derived_electron = ifnode(dielectroncuts.cfg_apply_cuts_from_prefilter_derived.node() && dielectroncuts.cfg_prefilter_bits_derived.node() >= static_cast(1), - ifnode((dielectroncuts.cfg_prefilter_bits_derived.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kMee))) > static_cast(0), (o2::aod::emprimaryelectron::pfbderived & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kMee))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits_derived.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kPhiV))) > static_cast(0), (o2::aod::emprimaryelectron::pfbderived & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kPhiV))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits_derived.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackLS))) > static_cast(0), (o2::aod::emprimaryelectron::pfbderived & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackLS))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits_derived.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackULS))) > static_cast(0), (o2::aod::emprimaryelectron::pfbderived & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackULS))) <= static_cast(0), true), - o2::aod::emprimaryelectron::pfbderived >= static_cast(0)); + template + bool fillGenPairInfo(TMCParticle const& t1, TMCParticle const& t2, TMCParticles const& mcparticles) + { + if (!t1.isPhysicalPrimary() && !t1.producedByGenerator()) { + return false; + } + if (!t2.isPhysicalPrimary() && !t2.producedByGenerator()) { + return false; + } - Filter prefilter_electron = ifnode(dielectroncuts.cfg_apply_cuts_from_prefilter.node() && dielectroncuts.cfg_prefilter_bits.node() >= static_cast(1), - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_20MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_20MeV))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_40MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_40MeV))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_60MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_60MeV))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_80MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_80MeV))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_100MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_100MeV))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_120MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_120MeV))) <= static_cast(0), true) && - ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_140MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_140MeV))) <= static_cast(0), true), - o2::aod::emprimaryelectron::pfb >= static_cast(0)); + int mother_id = FindLF(t1, t2, mcparticles); + int hfee_type = IsHF(t1, t2, mcparticles); + if (mother_id < 0 && hfee_type < 0) { + return false; + } - Preslice perCollision_muon = aod::emprimarymuon::emeventId; - Filter trackFilter_muon = o2::aod::fwdtrack::trackType == dimuoncuts.cfg_track_type; - Filter ttcaFilter_muon = ifnode(dimuoncuts.enableTTCA.node(), o2::aod::emprimarymuon::isAssociatedToMPC == true || o2::aod::emprimarymuon::isAssociatedToMPC == false, o2::aod::emprimarymuon::isAssociatedToMPC == true); + float pt1 = 0.f, eta1 = 0.f, phi1 = 0.f, pt2 = 0.f, eta2 = 0.f, phi2 = 0.f; + if constexpr (isSmeared) { + if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { + pt1 = t1.ptSmeared(); + eta1 = t1.etaSmeared(); + phi1 = t1.phiSmeared(); + pt2 = t2.ptSmeared(); + eta2 = t2.etaSmeared(); + phi2 = t2.phiSmeared(); + } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { + if (dimuoncuts.cfg_track_type == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack)) { + pt1 = t1.ptSmeared_sa_muon(); + eta1 = t1.etaSmeared_sa_muon(); + phi1 = t1.phiSmeared_sa_muon(); + pt2 = t2.ptSmeared_sa_muon(); + eta2 = t2.etaSmeared_sa_muon(); + phi2 = t2.phiSmeared_sa_muon(); + } else if (dimuoncuts.cfg_track_type == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack)) { + pt1 = t1.ptSmeared_gl_muon(); + eta1 = t1.etaSmeared_gl_muon(); + phi1 = t1.phiSmeared_gl_muon(); + pt2 = t2.ptSmeared_gl_muon(); + eta2 = t2.etaSmeared_gl_muon(); + phi2 = t2.phiSmeared_gl_muon(); + } else { + pt1 = t1.pt(); + eta1 = t1.eta(); + phi1 = t1.phi(); + pt2 = t2.pt(); + eta2 = t2.eta(); + phi2 = t2.phi(); + } + } + } else { + pt1 = t1.pt(); + eta1 = t1.eta(); + phi1 = t1.phi(); + pt2 = t2.pt(); + eta2 = t2.eta(); + phi2 = t2.phi(); + } - Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); - Filter collisionFilter_numContrib = cfgNumContribMin <= o2::aod::collision::numContrib && o2::aod::collision::numContrib < cfgNumContribMax; - Filter collisionFilter_occupancy_track = eventcuts.cfgTrackOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgTrackOccupancyMax; - Filter collisionFilter_occupancy_ft0c = eventcuts.cfgFT0COccupancyMin <= o2::aod::evsel::ft0cOccupancyInTimeRange && o2::aod::evsel::ft0cOccupancyInTimeRange < eventcuts.cfgFT0COccupancyMax; - using FilteredMyCollisions = soa::Filtered; + ROOT::Math::PtEtaPhiMVector v1(pt1, eta1, phi1, leptonM1); + ROOT::Math::PtEtaPhiMVector v2(pt2, eta2, phi2, leptonM2); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + + float deta = v1.Eta() - v2.Eta(); + float dphi = v1.Phi() - v2.Phi(); + o2::math_utils::bringToPMPi(dphi); + + if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { + if (v12.Rapidity() < dielectroncuts.cfg_min_pair_y || dielectroncuts.cfg_max_pair_y < v12.Rapidity()) { + return false; + } + // if (dielectroncuts.cfg_apply_detadphi && std::pow(deta / dielectroncuts.cfg_min_deta, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi, 2) < 1.f) { + // continue; + // } + } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { + if (v12.Rapidity() < dimuoncuts.cfg_min_pair_y || dimuoncuts.cfg_max_pair_y < v12.Rapidity()) { + return false; + } + // if (dimuoncuts.cfg_apply_detadphi && std::pow(deta / dimuoncuts.cfg_min_deta, 2) + std::pow(dphi / dimuoncuts.cfg_min_dphi, 2) < 1.f) { + // continue; + // } + } + + int sign1 = -t1.pdgCode() / pdg_lepton; + int sign2 = -t2.pdgCode() / pdg_lepton; + + float aco = 1.f - std::fabs(dphi) / M_PI; + float asym = std::fabs(v1.Pt() - v2.Pt()) / (v1.Pt() + v2.Pt()); + float dphi_e_ee = v1.Phi() - v12.Phi(); + o2::math_utils::bringToPMPi(dphi_e_ee); + dphi = RecoDecay::constrainAngle(dphi, -o2::constants::math::PIHalf, 1); // shift dphi in [-pi/2, +3pi/2] rad. after deta-dphi cut. + + std::array arrP1 = {static_cast(v1.Px()), static_cast(v1.Py()), static_cast(v1.Pz()), leptonM1}; + std::array arrP2 = {static_cast(v2.Px()), static_cast(v2.Py()), static_cast(v2.Pz()), leptonM2}; + float cos_thetaPol = 999, phiPol = 999.f; + if (cfgPolarizationFrame == 0) { + o2::aod::pwgem::dilepton::utils::pairutil::getAngleCS(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, -t1.pdgCode() / pdg_lepton, cos_thetaPol, phiPol); + } else if (cfgPolarizationFrame == 1) { + o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, -t1.pdgCode() / pdg_lepton, cos_thetaPol, phiPol); + } + o2::math_utils::bringTo02Pi(phiPol); + float quadmom = (3.f * std::pow(cos_thetaPol, 2) - 1.f) / 2.f; + + // bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); + if (!isInAcceptance(t1) || !isInAcceptance(t2)) { + return false; + } + + float weight = 1.f; + if (mother_id > -1) { + auto mcmother = mcparticles.iteratorAt(mother_id); + if (mcmother.isPhysicalPrimary() || mcmother.producedByGenerator()) { + switch (std::abs(mcmother.pdgCode())) { + case 111: + if (IsFromCharm(mcmother, mcparticles) < 0 && IsFromBeauty(mcmother, mcparticles) < 0) { // prompt pi0 + fillGenHistograms<1>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // prompt pi0 + } else { // non-prompt pi0 + fillGenHistograms<2>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // non-prompt pi0 + } + break; + case 221: + fillGenHistograms<3>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // eta + break; + case 331: + fillGenHistograms<4>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // eta' + break; + case 113: + fillGenHistograms<5>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // rho + break; + case 223: + fillGenHistograms<6>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // omega + if (mcmother.daughtersIds().size() == 2) { + fRegistry.fill(HIST("Generated/sm/Omega2ll/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // omega->ee + } + break; + case 333: + fillGenHistograms<7>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // phi + if (mcmother.daughtersIds().size() == 2) { + fRegistry.fill(HIST("Generated/sm/Phi2ll/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); // phi->ee + } + break; + case 443: { + if (IsFromBeauty(mcmother, mcparticles) > 0) { + fillGenHistograms<9>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // non-prompt J/psi + } else { + fillGenHistograms<8>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // prompt J/psi + } + break; + } + case 100443: { + if (IsFromBeauty(mcmother, mcparticles) > 0) { + fillGenHistograms<11>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // non-prompt psi2S + } else { + fillGenHistograms<10>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // prompt psi2S + } + break; + } + default: + break; + } + } + } else if (hfee_type > -1) { + auto mp1 = mcparticles.iteratorAt(t1.mothersIds()[0]); + auto mp2 = mcparticles.iteratorAt(t2.mothersIds()[0]); + switch (hfee_type) { + case static_cast(EM_HFeeType::kCe_Ce): { + fillGenHistograms<15>(sign1, sign2, mp1.pdgCode(), mp2.pdgCode(), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // c2l_c2l + break; + } + case static_cast(EM_HFeeType::kBe_Be): { + fillGenHistograms<16>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // b2l_b2l + break; + } + case static_cast(EM_HFeeType::kBCe_BCe): { + fillGenHistograms<17>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // b2c2l_b2c2l + break; + } + case static_cast(EM_HFeeType::kBCe_Be_SameB): { // ULS + fillGenHistograms<18>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // b2c2l_b2l_sameb + break; + } + case static_cast(EM_HFeeType::kBCe_Be_DiffB): // LS + fillGenHistograms<19>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // b2c2l_b2l_diffb + break; + default: + break; + } + } // end of HF evaluation + return false; + } template void runTruePairing(TCollisions const& collisions, TMCLeptons const& posTracks, TMCLeptons const& negTracks, TPreslice const& perCollision, TCut const& cut, TAllTracks const& tracks, TMCCollisions const& mccollisions, TMCParticles const& mcparticles) @@ -1368,583 +1958,30 @@ struct DileptonMC { auto negTracks_per_coll = negTracksMC.sliceByCachedUnsorted(aod::emmcparticle::emmceventId, mccollision.globalIndex(), cache); for (const auto& [t1, t2] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { // ULS - // LOGF(info, "pdg1 = %d, pdg2 = %d", t1.pdgCode(), t2.pdgCode()); + fillGenPairInfo(t1, t2, mcparticles); + } // end of true ULS pair loop - if (!t1.isPhysicalPrimary() && !t1.producedByGenerator()) { - continue; - } - if (!t2.isPhysicalPrimary() && !t2.producedByGenerator()) { - continue; - } + for (const auto& [t1, t2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { // LS++ + fillGenPairInfo(t1, t2, mcparticles); + } // end of true LS++ pair loop - int mother_id = FindLF(t1, t2, mcparticles); - int hfee_type = IsHF(t1, t2, mcparticles); - if (mother_id < 0 && hfee_type < 0) { - continue; - } + for (const auto& [t1, t2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { // LS-- + fillGenPairInfo(t1, t2, mcparticles); + } // end of true LS++ pair loop + } // end of collision loop + } - float pt1 = 0.f, eta1 = 0.f, phi1 = 0.f, pt2 = 0.f, eta2 = 0.f, phi2 = 0.f; - if constexpr (isSmeared) { - if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - pt1 = t1.ptSmeared(); - eta1 = t1.etaSmeared(); - phi1 = t1.phiSmeared(); - pt2 = t2.ptSmeared(); - eta2 = t2.etaSmeared(); - phi2 = t2.phiSmeared(); - } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - if (dimuoncuts.cfg_track_type == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack)) { - pt1 = t1.ptSmeared_sa_muon(); - eta1 = t1.etaSmeared_sa_muon(); - phi1 = t1.phiSmeared_sa_muon(); - pt2 = t2.ptSmeared_sa_muon(); - eta2 = t2.etaSmeared_sa_muon(); - phi2 = t2.phiSmeared_sa_muon(); - } else if (dimuoncuts.cfg_track_type == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack)) { - pt1 = t1.ptSmeared_gl_muon(); - eta1 = t1.etaSmeared_gl_muon(); - phi1 = t1.phiSmeared_gl_muon(); - pt2 = t2.ptSmeared_gl_muon(); - eta2 = t2.etaSmeared_gl_muon(); - phi2 = t2.phiSmeared_gl_muon(); - } else { - pt1 = t1.pt(); - eta1 = t1.eta(); - phi1 = t1.phi(); - pt2 = t2.pt(); - eta2 = t2.eta(); - phi2 = t2.phi(); - } - } - } else { - pt1 = t1.pt(); - eta1 = t1.eta(); - phi1 = t1.phi(); - pt2 = t2.pt(); - eta2 = t2.eta(); - phi2 = t2.phi(); + template + bool isPairOK(TTrack1 const& t1, TTrack2 const& t2, TCut const& cut, TAllTracks const& tracks) + { + if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { + if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { + if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { + return false; } - - ROOT::Math::PtEtaPhiMVector v1(pt1, eta1, phi1, leptonM1); - ROOT::Math::PtEtaPhiMVector v2(pt2, eta2, phi2, leptonM2); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - - float deta = v1.Eta() - v2.Eta(); - float dphi = v1.Phi() - v2.Phi(); - o2::math_utils::bringToPMPi(dphi); - - if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - if (v12.Rapidity() < dielectroncuts.cfg_min_pair_y || dielectroncuts.cfg_max_pair_y < v12.Rapidity()) { - continue; - } - // if (dielectroncuts.cfg_apply_detadphi && std::pow(deta / dielectroncuts.cfg_min_deta, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi, 2) < 1.f) { - // continue; - // } - } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - if (v12.Rapidity() < dimuoncuts.cfg_min_pair_y || dimuoncuts.cfg_max_pair_y < v12.Rapidity()) { - continue; - } - // if (dimuoncuts.cfg_apply_detadphi && std::pow(deta / dimuoncuts.cfg_min_deta, 2) + std::pow(dphi / dimuoncuts.cfg_min_dphi, 2) < 1.f) { - // continue; - // } - } - - float aco = 1.f - std::fabs(dphi) / M_PI; - float asym = std::fabs(v1.Pt() - v2.Pt()) / (v1.Pt() + v2.Pt()); - float dphi_e_ee = v1.Phi() - v12.Phi(); - o2::math_utils::bringToPMPi(dphi_e_ee); - dphi = RecoDecay::constrainAngle(dphi, -o2::constants::math::PIHalf, 1); // shift dphi in [-pi/2, +3pi/2] rad. after deta-dphi cut. - - std::array arrP1 = {static_cast(v1.Px()), static_cast(v1.Py()), static_cast(v1.Pz()), leptonM1}; - std::array arrP2 = {static_cast(v2.Px()), static_cast(v2.Py()), static_cast(v2.Pz()), leptonM2}; - float cos_thetaPol = 999, phiPol = 999.f; - if (cfgPolarizationFrame == 0) { - o2::aod::pwgem::dilepton::utils::pairutil::getAngleCS(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, -t1.pdgCode() / pdg_lepton, cos_thetaPol, phiPol); - } else if (cfgPolarizationFrame == 1) { - o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, -t1.pdgCode() / pdg_lepton, cos_thetaPol, phiPol); - } - o2::math_utils::bringTo02Pi(phiPol); - float quadmom = (3.f * std::pow(cos_thetaPol, 2) - 1.f) / 2.f; - - // bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); - if (!isInAcceptance(t1) || !isInAcceptance(t2)) { - continue; - } - - if (mother_id > -1) { - auto mcmother = mcparticles.iteratorAt(mother_id); - if (mcmother.isPhysicalPrimary() || mcmother.producedByGenerator()) { - - switch (std::abs(mcmother.pdgCode())) { - case 111: - if (IsFromCharm(mcmother, mcparticles) < 0 && IsFromBeauty(mcmother, mcparticles) < 0) { // prompt pi0 - fRegistry.fill(HIST("Generated/sm/PromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else { // non-prompt pi0 - fRegistry.fill(HIST("Generated/sm/NonPromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } - break; - case 221: - fRegistry.fill(HIST("Generated/sm/Eta/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - break; - case 331: - fRegistry.fill(HIST("Generated/sm/EtaPrime/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - break; - case 113: - fRegistry.fill(HIST("Generated/sm/Rho/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - break; - case 223: - fRegistry.fill(HIST("Generated/sm/Omega/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - if (mcmother.daughtersIds().size() == 2) { // omega->ee - fRegistry.fill(HIST("Generated/sm/Omega2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } - break; - case 333: - fRegistry.fill(HIST("Generated/sm/Phi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - if (mcmother.daughtersIds().size() == 2) { // phi->ee - fRegistry.fill(HIST("Generated/sm/Phi2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } - break; - case 443: { - if (IsFromBeauty(mcmother, mcparticles) > 0) { - fRegistry.fill(HIST("Generated/sm/NonPromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else { - fRegistry.fill(HIST("Generated/sm/PromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } - break; - } - case 100443: { - if (IsFromBeauty(mcmother, mcparticles) > 0) { - fRegistry.fill(HIST("Generated/sm/NonPromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else { - fRegistry.fill(HIST("Generated/sm/PromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } - break; - } - default: - break; - } - } - } else if (hfee_type > -1) { - auto mp1 = mcparticles.iteratorAt(t1.mothersIds()[0]); - auto mp2 = mcparticles.iteratorAt(t2.mothersIds()[0]); - switch (hfee_type) { - case static_cast(EM_HFeeType::kCe_Ce): { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - if (isCharmMeson(mp1) && isCharmMeson(mp2)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - if (std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 411) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dplus_Dminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if (std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 421) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_D0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if (std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 431) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dsplus_Dsminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 421) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 421)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_D0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 431)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 431) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 431)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Dspm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } - } else if (isCharmBaryon(mp1) && isCharmBaryon(mp2)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - if (std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4122) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcplus_Lcminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if (std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4232) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicplus_Xicminus/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if (std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4132) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xic0_Xic0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if (std::abs(mp1.pdgCode()) == 4332 && std::abs(mp2.pdgCode()) == 4332) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Omegac0_Omegac0bar/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 4122 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4122 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Lcpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 4232 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4232 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xicpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 4132 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 4132 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Xic0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } - } else { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 411 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 411 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dpm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 421 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 421 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/D0_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4122) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4122)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Lcpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4232) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4232)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Xicpm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4132) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4132)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Xic0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if ((std::abs(mp1.pdgCode()) == 431 && std::abs(mp2.pdgCode()) == 4332) || (std::abs(mp2.pdgCode()) == 431 && std::abs(mp1.pdgCode()) == 4332)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/Dspm_Omegac0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } - } - break; - } - case static_cast(EM_HFeeType::kBe_Be): { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - if (isBeautyMeson(mp1) && isBeautyMeson(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if (isBeautyBaryon(mp1) && isBeautyBaryon(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } - break; - } - case static_cast(EM_HFeeType::kBCe_BCe): { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - if (isCharmMeson(mp1) && isCharmMeson(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if (isCharmBaryon(mp1) && isCharmBaryon(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } - break; - } - case static_cast(EM_HFeeType::kBCe_Be_SameB): { // ULS - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } - break; - } - case static_cast(EM_HFeeType::kBCe_Be_DiffB): // LS - LOGF(info, "You should not see kBCe_Be_DiffB in ULS. Good luck."); - break; - default: - break; - } - } // end of HF evaluation - } // end of true ULS pair loop - - for (const auto& [t1, t2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { - // LOGF(info, "pdg1 = %d, pdg2 = %d", t1.pdgCode(), t2.pdgCode()); - - if (!t1.isPhysicalPrimary() && !t1.producedByGenerator()) { - continue; - } - if (!t2.isPhysicalPrimary() && !t2.producedByGenerator()) { - continue; - } - - int hfee_type = IsHF(t1, t2, mcparticles); - if (hfee_type < 0) { - continue; - } - - float pt1 = 0.f, eta1 = 0.f, phi1 = 0.f, pt2 = 0.f, eta2 = 0.f, phi2 = 0.f; - if constexpr (isSmeared) { - if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - pt1 = t1.ptSmeared(); - eta1 = t1.etaSmeared(); - phi1 = t1.phiSmeared(); - pt2 = t2.ptSmeared(); - eta2 = t2.etaSmeared(); - phi2 = t2.phiSmeared(); - } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - if (dimuoncuts.cfg_track_type == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack)) { - pt1 = t1.ptSmeared_sa_muon(); - eta1 = t1.etaSmeared_sa_muon(); - phi1 = t1.phiSmeared_sa_muon(); - pt2 = t2.ptSmeared_sa_muon(); - eta2 = t2.etaSmeared_sa_muon(); - phi2 = t2.phiSmeared_sa_muon(); - } else if (dimuoncuts.cfg_track_type == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack)) { - pt1 = t1.ptSmeared_gl_muon(); - eta1 = t1.etaSmeared_gl_muon(); - phi1 = t1.phiSmeared_gl_muon(); - pt2 = t2.ptSmeared_gl_muon(); - eta2 = t2.etaSmeared_gl_muon(); - phi2 = t2.phiSmeared_gl_muon(); - } else { - pt1 = t1.pt(); - eta1 = t1.eta(); - phi1 = t1.phi(); - pt2 = t2.pt(); - eta2 = t2.eta(); - phi2 = t2.phi(); - } - } - } else { - pt1 = t1.pt(); - eta1 = t1.eta(); - phi1 = t1.phi(); - pt2 = t2.pt(); - eta2 = t2.eta(); - phi2 = t2.phi(); - } - - ROOT::Math::PtEtaPhiMVector v1(pt1, eta1, phi1, leptonM1); - ROOT::Math::PtEtaPhiMVector v2(pt2, eta2, phi2, leptonM2); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - - float deta = v1.Eta() - v2.Eta(); - float dphi = v1.Phi() - v2.Phi(); - o2::math_utils::bringToPMPi(dphi); - - if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - if (v12.Rapidity() < dielectroncuts.cfg_min_pair_y || dielectroncuts.cfg_max_pair_y < v12.Rapidity()) { - continue; - } - // if (dielectroncuts.cfg_apply_detadphi && std::pow(deta / dielectroncuts.cfg_min_deta, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi, 2) < 1.f) { - // continue; - // } - } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - if (v12.Rapidity() < dimuoncuts.cfg_min_pair_y || dimuoncuts.cfg_max_pair_y < v12.Rapidity()) { - continue; - } - // if (dimuoncuts.cfg_apply_detadphi && std::pow(deta / dimuoncuts.cfg_min_deta, 2) + std::pow(dphi / dimuoncuts.cfg_min_dphi, 2) < 1.f) { - // continue; - // } - } - - // if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - // if (v12.Rapidity() < dielectroncuts.cfg_min_pair_y || dielectroncuts.cfg_max_pair_y < v12.Rapidity()) { - // continue; - // } - // } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - // if (v12.Rapidity() < dimuoncuts.cfg_min_pair_y || dimuoncuts.cfg_max_pair_y < v12.Rapidity()) { - // continue; - // } - // } - - float aco = 1.f - std::fabs(dphi) / M_PI; - float asym = std::fabs(v1.Pt() - v2.Pt()) / (v1.Pt() + v2.Pt()); - float dphi_e_ee = v1.Phi() - v12.Phi(); - o2::math_utils::bringToPMPi(dphi_e_ee); - dphi = RecoDecay::constrainAngle(dphi, -o2::constants::math::PIHalf, 1); // shift dphi in [-pi/2, +3pi/2] rad. after deta-dphi cut. - - std::array arrP1 = {static_cast(v1.Px()), static_cast(v1.Py()), static_cast(v1.Pz()), leptonM1}; - std::array arrP2 = {static_cast(v2.Px()), static_cast(v2.Py()), static_cast(v2.Pz()), leptonM2}; - float cos_thetaPol = 999, phiPol = 999.f; - if (cfgPolarizationFrame == 0) { - o2::aod::pwgem::dilepton::utils::pairutil::getAngleCS(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, -t1.pdgCode() / pdg_lepton, cos_thetaPol, phiPol); - } else if (cfgPolarizationFrame == 1) { - o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, -t1.pdgCode() / pdg_lepton, cos_thetaPol, phiPol); - } - o2::math_utils::bringTo02Pi(phiPol); - float quadmom = (3.f * std::pow(cos_thetaPol, 2) - 1.f) / 2.f; - - // bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); - if (!isInAcceptance(t1) || !isInAcceptance(t2)) { - continue; - } - - if (hfee_type > -1) { - auto mp1 = mcparticles.iteratorAt(t1.mothersIds()[0]); - auto mp2 = mcparticles.iteratorAt(t2.mothersIds()[0]); - switch (hfee_type) { - case static_cast(EM_HFeeType::kCe_Ce): - LOGF(info, "You should not see kCe_Ce in LS++. Good luck."); - break; - case static_cast(EM_HFeeType::kBe_Be): - LOGF(info, "You should not see kBe_Be in LS++. Good luck."); - break; - case static_cast(EM_HFeeType::kBCe_BCe): - LOGF(info, "You should not see kBCe_BCe in LS++. Good luck."); - break; - case static_cast(EM_HFeeType::kBCe_Be_SameB): // ULS - LOGF(info, "You should not see kBCe_Be_SameB in LS++. Good luck."); - break; - case static_cast(EM_HFeeType::kBCe_Be_DiffB): { // LS - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } - break; - } - default: - break; - } - } - } // end of true LS++ pair loop - - for (const auto& [t1, t2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { - // LOGF(info, "pdg1 = %d, pdg2 = %d", t1.pdgCode(), t2.pdgCode()); - - if (!t1.isPhysicalPrimary() && !t1.producedByGenerator()) { - continue; - } - if (!t2.isPhysicalPrimary() && !t2.producedByGenerator()) { - continue; - } - - int hfee_type = IsHF(t1, t2, mcparticles); - if (hfee_type < 0) { - continue; - } - - float pt1 = 0.f, eta1 = 0.f, phi1 = 0.f, pt2 = 0.f, eta2 = 0.f, phi2 = 0.f; - if constexpr (isSmeared) { - if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - pt1 = t1.ptSmeared(); - eta1 = t1.etaSmeared(); - phi1 = t1.phiSmeared(); - pt2 = t2.ptSmeared(); - eta2 = t2.etaSmeared(); - phi2 = t2.phiSmeared(); - } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - if (dimuoncuts.cfg_track_type == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack)) { - pt1 = t1.ptSmeared_sa_muon(); - eta1 = t1.etaSmeared_sa_muon(); - phi1 = t1.phiSmeared_sa_muon(); - pt2 = t2.ptSmeared_sa_muon(); - eta2 = t2.etaSmeared_sa_muon(); - phi2 = t2.phiSmeared_sa_muon(); - } else if (dimuoncuts.cfg_track_type == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack)) { - pt1 = t1.ptSmeared_gl_muon(); - eta1 = t1.etaSmeared_gl_muon(); - phi1 = t1.phiSmeared_gl_muon(); - pt2 = t2.ptSmeared_gl_muon(); - eta2 = t2.etaSmeared_gl_muon(); - phi2 = t2.phiSmeared_gl_muon(); - } else { - pt1 = t1.pt(); - eta1 = t1.eta(); - phi1 = t1.phi(); - pt2 = t2.pt(); - eta2 = t2.eta(); - phi2 = t2.phi(); - } - } - } else { - pt1 = t1.pt(); - eta1 = t1.eta(); - phi1 = t1.phi(); - pt2 = t2.pt(); - eta2 = t2.eta(); - phi2 = t2.phi(); - } - - ROOT::Math::PtEtaPhiMVector v1(pt1, eta1, phi1, leptonM1); - ROOT::Math::PtEtaPhiMVector v2(pt2, eta2, phi2, leptonM2); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - - float deta = v1.Eta() - v2.Eta(); - float dphi = v1.Phi() - v2.Phi(); - o2::math_utils::bringToPMPi(dphi); - - if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - if (v12.Rapidity() < dielectroncuts.cfg_min_pair_y || dielectroncuts.cfg_max_pair_y < v12.Rapidity()) { - continue; - } - // if (dielectroncuts.cfg_apply_detadphi && std::pow(deta / dielectroncuts.cfg_min_deta, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi, 2) < 1.f) { - // continue; - // } - } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - if (v12.Rapidity() < dimuoncuts.cfg_min_pair_y || dimuoncuts.cfg_max_pair_y < v12.Rapidity()) { - continue; - } - // if (dimuoncuts.cfg_apply_detadphi && std::pow(deta / dimuoncuts.cfg_min_deta, 2) + std::pow(dphi / dimuoncuts.cfg_min_dphi, 2) < 1.f) { - // continue; - // } - } - - // if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - // if (v12.Rapidity() < dielectroncuts.cfg_min_pair_y || dielectroncuts.cfg_max_pair_y < v12.Rapidity()) { - // continue; - // } - // } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - // if (v12.Rapidity() < dimuoncuts.cfg_min_pair_y || dimuoncuts.cfg_max_pair_y < v12.Rapidity()) { - // continue; - // } - // } - - float aco = 1.f - std::fabs(dphi) / M_PI; - float asym = std::fabs(v1.Pt() - v2.Pt()) / (v1.Pt() + v2.Pt()); - float dphi_e_ee = v1.Phi() - v12.Phi(); - o2::math_utils::bringToPMPi(dphi_e_ee); - dphi = RecoDecay::constrainAngle(dphi, -o2::constants::math::PIHalf, 1); // shift dphi in [-pi/2, +3pi/2] rad. after deta-dphi cut. - - std::array arrP1 = {static_cast(v1.Px()), static_cast(v1.Py()), static_cast(v1.Pz()), leptonM1}; - std::array arrP2 = {static_cast(v2.Px()), static_cast(v2.Py()), static_cast(v2.Pz()), leptonM2}; - float cos_thetaPol = 999, phiPol = 999.f; - if (cfgPolarizationFrame == 0) { - o2::aod::pwgem::dilepton::utils::pairutil::getAngleCS(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, -t1.pdgCode() / pdg_lepton, cos_thetaPol, phiPol); - } else if (cfgPolarizationFrame == 1) { - o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, -t1.pdgCode() / pdg_lepton, cos_thetaPol, phiPol); - } - o2::math_utils::bringTo02Pi(phiPol); - float quadmom = (3.f * std::pow(cos_thetaPol, 2) - 1.f) / 2.f; - - // bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); - if (!isInAcceptance(t1) || !isInAcceptance(t2)) { - continue; - } - - if (hfee_type > -1) { - auto mp1 = mcparticles.iteratorAt(t1.mothersIds()[0]); - auto mp2 = mcparticles.iteratorAt(t2.mothersIds()[0]); - switch (hfee_type) { - case static_cast(EM_HFeeType::kCe_Ce): - LOGF(info, "You should not see kCe_Ce in LS--. Good luck."); - break; - case static_cast(EM_HFeeType::kBe_Be): - LOGF(info, "You should not see kBe_Be in LS--. Good luck."); - break; - case static_cast(EM_HFeeType::kBCe_BCe): - LOGF(info, "You should not see kBCe_BCe in LS--. Good luck."); - break; - case static_cast(EM_HFeeType::kBCe_Be_SameB): // ULS - LOGF(info, "You should not see kBCe_Be_SameB in LS--. Good luck."); - break; - case static_cast(EM_HFeeType::kBCe_Be_DiffB): { // LS - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } else { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); - } - break; - } - default: - break; - } - } - } // end of true LS++ pair loop - } // end of collision loop - } - - template - bool isPairOK(TTrack1 const& t1, TTrack2 const& t2, TCut const& cut, TAllTracks const& tracks) - { - if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { - if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { - return false; - } - } else { // cut-based - if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { - return false; + } else { // cut-based + if (!cut.template IsSelectedTrack(t1) || !cut.template IsSelectedTrack(t2)) { + return false; } } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { @@ -2119,12 +2156,143 @@ struct DileptonMC { return true; } + template + void fillHistogramsUnfolding(TTrack const& t1, TTrack const& t2, TMCParticles const& mcparticles) + { + auto t1mc = mcparticles.iteratorAt(t1.emmcparticleId()); + auto t2mc = mcparticles.iteratorAt(t2.emmcparticleId()); + + ROOT::Math::PtEtaPhiMVector v1rec(t1.pt(), t1.eta(), t1.phi(), leptonM1); + ROOT::Math::PtEtaPhiMVector v2rec(t2.pt(), t2.eta(), t2.phi(), leptonM2); + ROOT::Math::PtEtaPhiMVector v12rec = v1rec + v2rec; + + ROOT::Math::PtEtaPhiMVector v1mc(t1mc.pt(), t1mc.eta(), t1mc.phi(), leptonM1); + ROOT::Math::PtEtaPhiMVector v2mc(t2mc.pt(), t2mc.eta(), t2mc.phi(), leptonM2); + ROOT::Math::PtEtaPhiMVector v12mc = v1mc + v2mc; + + float weight = 1.f; + if (cfgApplyWeightTTCA) { + weight = map_weight[std::make_pair(t1.globalIndex(), t2.globalIndex())]; + } + + if (isPairInAcc(t1, t2) && isPairInAcc(t1mc, t2mc)) { // both rec and mc info are in acceptance. + if (t1.sign() * t2.sign() < 0) { // ULS + fRegistry.fill(HIST("Unfold/") + HIST(unfolding_dilepton_source_types[sourceId]) + HIST("uls/hsRM"), v12mc.M(), v12mc.Pt(), v12rec.M(), v12rec.Pt(), weight); + } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ + fRegistry.fill(HIST("Unfold/") + HIST(unfolding_dilepton_source_types[sourceId]) + HIST("lspp/hsRM"), v12mc.M(), v12mc.Pt(), v12rec.M(), v12rec.Pt(), weight); + } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- + fRegistry.fill(HIST("Unfold/") + HIST(unfolding_dilepton_source_types[sourceId]) + HIST("lsmm/hsRM"), v12mc.M(), v12mc.Pt(), v12rec.M(), v12rec.Pt(), weight); + } + } else if (!isPairInAcc(t1, t2) && isPairInAcc(t1mc, t2mc)) { + if (t1.sign() * t2.sign() < 0) { // ULS + fRegistry.fill(HIST("Unfold/") + HIST(unfolding_dilepton_source_types[sourceId]) + HIST("uls/hMiss"), v12mc.M(), v12mc.Pt(), weight); + } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ + fRegistry.fill(HIST("Unfold/") + HIST(unfolding_dilepton_source_types[sourceId]) + HIST("lspp/hMiss"), v12mc.M(), v12mc.Pt(), weight); + } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- + fRegistry.fill(HIST("Unfold/") + HIST(unfolding_dilepton_source_types[sourceId]) + HIST("lsmm/hMiss"), v12mc.M(), v12mc.Pt(), weight); + } + } else if (isPairInAcc(t1, t2) && !isPairInAcc(t1mc, t2mc)) { + if (t1.sign() * t2.sign() < 0) { // ULS + fRegistry.fill(HIST("Unfold/") + HIST(unfolding_dilepton_source_types[sourceId]) + HIST("uls/hFake"), v12rec.M(), v12rec.Pt(), weight); + } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ + fRegistry.fill(HIST("Unfold/") + HIST(unfolding_dilepton_source_types[sourceId]) + HIST("lspp/hFake"), v12rec.M(), v12rec.Pt(), weight); + } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- + fRegistry.fill(HIST("Unfold/") + HIST(unfolding_dilepton_source_types[sourceId]) + HIST("lsmm/hFake"), v12rec.M(), v12rec.Pt(), weight); + } + } + } + + template + bool fillPairUnfolding(TTrack const& t1, TTrack const& t2, TTracks const& tracks, TCut const& cut, TMCCollisions const&, TMCParticles const& mcparticles) + { + auto t1mc = mcparticles.iteratorAt(t1.emmcparticleId()); + auto mccollision_from_t1 = t1mc.template emmcevent_as(); + if (cfgEventGeneratorType >= 0 && mccollision_from_t1.getSubGeneratorId() != cfgEventGeneratorType) { + return false; + } + + auto t2mc = mcparticles.iteratorAt(t2.emmcparticleId()); + auto mccollision_from_t2 = t2mc.template emmcevent_as(); + if (cfgEventGeneratorType >= 0 && mccollision_from_t2.getSubGeneratorId() != cfgEventGeneratorType) { + return false; + } + + if ((std::abs(t1mc.pdgCode()) != pdg_lepton || std::abs(t2mc.pdgCode()) != pdg_lepton) || (t1mc.emmceventId() != t2mc.emmceventId())) { + return false; + } + if (t1mc.pdgCode() * t2mc.pdgCode() > 0) { // ULS + return false; + } + if (!((t1mc.isPhysicalPrimary() || t1mc.producedByGenerator()) && (t2mc.isPhysicalPrimary() || t2mc.producedByGenerator()))) { + return false; + } + int mother_id = FindLF(t1mc, t2mc, mcparticles); + int hfee_type = IsHF(t1mc, t2mc, mcparticles); + if (mother_id < 0 && hfee_type < 0) { + return false; + } + + if (!isPairOK(t1, t2, cut, tracks)) { // without acceptance + return false; + } + + // ROOT::Math::PtEtaPhiMVector v1rec(t1.pt(), t1.eta(), t1.phi(), leptonM1); + // ROOT::Math::PtEtaPhiMVector v2rec(t2.pt(), t2.eta(), t2.phi(), leptonM2); + // ROOT::Math::PtEtaPhiMVector v12rec = v1rec + v2rec; + + // ROOT::Math::PtEtaPhiMVector v1mc(t1mc.pt(), t1mc.eta(), t1mc.phi(), leptonM1); + // ROOT::Math::PtEtaPhiMVector v2mc(t2mc.pt(), t2mc.eta(), t2mc.phi(), leptonM2); + // ROOT::Math::PtEtaPhiMVector v12mc = v1mc + v2mc; + + if (mother_id > -1) { + auto mcmother = mcparticles.iteratorAt(mother_id); + if (!(mcmother.isPhysicalPrimary() || mcmother.producedByGenerator())) { + return false; + } + switch (std::abs(mcmother.pdgCode())) { + case 111: + case 221: + case 331: + case 113: + case 223: + case 333: + case 443: + case 100443: + fillHistogramsUnfolding<0>(t1, t2, mcparticles); + break; + default: + break; + } + } else if (hfee_type > -1) { + switch (hfee_type) { + case static_cast(EM_HFeeType::kCe_Ce): + fillHistogramsUnfolding<1>(t1, t2, mcparticles); + break; + case static_cast(EM_HFeeType::kBe_Be): + fillHistogramsUnfolding<2>(t1, t2, mcparticles); + break; + case static_cast(EM_HFeeType::kBCe_BCe): + fillHistogramsUnfolding<2>(t1, t2, mcparticles); + break; + case static_cast(EM_HFeeType::kBCe_Be_SameB): + fillHistogramsUnfolding<2>(t1, t2, mcparticles); + break; + case static_cast(EM_HFeeType::kBCe_Be_DiffB): + fillHistogramsUnfolding<2>(t1, t2, mcparticles); + break; + default: + break; + } + } + return true; + } + template - void fillUnfolding(TCollisions const& collisions, TTracks1 const& posTracks, TTracks2 const& negTracks, TPresilce const& perCollision, TCut const& cut, TAllTracks const& tracks, TMCCollisions const&, TMCParticles const& mcparticles) + void fillUnfolding(TCollisions const& collisions, TTracks1 const& posTracks, TTracks2 const& negTracks, TPresilce const& perCollision, TCut const& cut, TAllTracks const& tracks, TMCCollisions const& mcCollisions, TMCParticles const& mcparticles) { for (const auto& collision : collisions) { initCCDB(collision); - const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; + float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; } @@ -2140,292 +2308,48 @@ struct DileptonMC { auto negTracks_per_coll = negTracks.sliceByCached(perCollision, collision.globalIndex(), cache); // reconstructed neg tracks for (const auto& [pos, neg] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { // ULS - auto mcpos = mcparticles.iteratorAt(pos.emmcparticleId()); - auto mccollision_from_pos = mcpos.template emmcevent_as(); - if (cfgEventGeneratorType >= 0 && mccollision_from_pos.getSubGeneratorId() != cfgEventGeneratorType) { - continue; - } - - auto mcneg = mcparticles.iteratorAt(neg.emmcparticleId()); - auto mccollision_from_neg = mcneg.template emmcevent_as(); - if (cfgEventGeneratorType >= 0 && mccollision_from_neg.getSubGeneratorId() != cfgEventGeneratorType) { - continue; - } - - if ((std::abs(mcpos.pdgCode()) != pdg_lepton || std::abs(mcneg.pdgCode()) != pdg_lepton) || (mcpos.emmceventId() != mcneg.emmceventId())) { - continue; - } - if (mcpos.pdgCode() * mcneg.pdgCode() > 0) { // ULS - continue; - } - if (!((mcpos.isPhysicalPrimary() || mcpos.producedByGenerator()) && (mcneg.isPhysicalPrimary() || mcneg.producedByGenerator()))) { - continue; - } - int mother_id = FindLF(mcpos, mcneg, mcparticles); - int hfee_type = IsHF(mcpos, mcneg, mcparticles); - if (mother_id < 0 && hfee_type < 0) { - continue; - } - - if (!isPairOK(pos, neg, cut, tracks)) { // without acceptance - continue; - } - - ROOT::Math::PtEtaPhiMVector v1rec(pos.pt(), pos.eta(), pos.phi(), leptonM1); - ROOT::Math::PtEtaPhiMVector v2rec(neg.pt(), neg.eta(), neg.phi(), leptonM2); - ROOT::Math::PtEtaPhiMVector v12rec = v1rec + v2rec; - - ROOT::Math::PtEtaPhiMVector v1mc(mcpos.pt(), mcpos.eta(), mcpos.phi(), leptonM1); - ROOT::Math::PtEtaPhiMVector v2mc(mcneg.pt(), mcneg.eta(), mcneg.phi(), leptonM2); - ROOT::Math::PtEtaPhiMVector v12mc = v1mc + v2mc; - float weight = 1.f; - if (cfgApplyWeightTTCA) { - weight = map_weight[std::make_pair(pos.globalIndex(), neg.globalIndex())]; - } - - if (mother_id > -1) { - auto mcmother = mcparticles.iteratorAt(mother_id); - if (mcmother.isPhysicalPrimary() || mcmother.producedByGenerator()) { - switch (std::abs(mcmother.pdgCode())) { - case 111: - case 221: - case 331: - case 113: - case 223: - case 333: { - if (isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { // both rec and mc info are in acceptance. - fRegistry.fill(HIST("Unfold/lf/hsRM"), v12mc.M(), v12mc.Pt(), v12rec.M(), v12rec.Pt(), weight); - } else if (!isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { - fRegistry.fill(HIST("Unfold/lf/hMiss"), v12mc.M(), v12mc.Pt(), weight); - } else if (isPairInAcc(pos, neg) && !isPairInAcc(mcpos, mcneg)) { - fRegistry.fill(HIST("Unfold/lf/hFake"), v12rec.M(), v12rec.Pt(), weight); - } - break; - } - case 443: { - if (IsFromBeauty(mcmother, mcparticles) > 0) { - if (isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { // both rec and mc info are in acceptance. - fRegistry.fill(HIST("Unfold/NonPromptJPsi/hsRM"), v12mc.M(), v12mc.Pt(), v12rec.M(), v12rec.Pt(), weight); - } else if (!isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { - fRegistry.fill(HIST("Unfold/NonPromptJPsi/hMiss"), v12mc.M(), v12mc.Pt(), weight); - } else if (isPairInAcc(pos, neg) && !isPairInAcc(mcpos, mcneg)) { - fRegistry.fill(HIST("Unfold/NonPromptJPsi/hFake"), v12rec.M(), v12rec.Pt(), weight); - } - } else { - if (isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { // both rec and mc info are in acceptance. - fRegistry.fill(HIST("Unfold/PromptJPsi/hsRM"), v12mc.M(), v12mc.Pt(), v12rec.M(), v12rec.Pt(), weight); - } else if (!isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { - fRegistry.fill(HIST("Unfold/PromptJPsi/hMiss"), v12mc.M(), v12mc.Pt(), weight); - } else if (isPairInAcc(pos, neg) && !isPairInAcc(mcpos, mcneg)) { - fRegistry.fill(HIST("Unfold/PromptJPsi/hFake"), v12rec.M(), v12rec.Pt(), weight); - } - } - break; - } - case 100443: { - if (IsFromBeauty(mcmother, mcparticles) > 0) { - if (isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { // both rec and mc info are in acceptance. - fRegistry.fill(HIST("Unfold/NonPromptPsi2S/hsRM"), v12mc.M(), v12mc.Pt(), v12rec.M(), v12rec.Pt(), weight); - } else if (!isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { - fRegistry.fill(HIST("Unfold/NonPromptPsi2S/hMiss"), v12mc.M(), v12mc.Pt(), weight); - } else if (isPairInAcc(pos, neg) && !isPairInAcc(mcpos, mcneg)) { - fRegistry.fill(HIST("Unfold/NonPromptPsi2S/hFake"), v12rec.M(), v12rec.Pt(), weight); - } - } else { - if (isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { // both rec and mc info are in acceptance. - fRegistry.fill(HIST("Unfold/PromptPsi2S/hsRM"), v12mc.M(), v12mc.Pt(), v12rec.M(), v12rec.Pt(), weight); - } else if (!isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { - fRegistry.fill(HIST("Unfold/PromptPsi2S/hMiss"), v12mc.M(), v12mc.Pt(), weight); - } else if (isPairInAcc(pos, neg) && !isPairInAcc(mcpos, mcneg)) { - fRegistry.fill(HIST("Unfold/PromptPsi2S/hFake"), v12rec.M(), v12rec.Pt(), weight); - } - } - break; - } - default: - break; - } - } - } else if (hfee_type > -1) { - switch (hfee_type) { - case static_cast(EM_HFeeType::kCe_Ce): { - if (isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { // both rec and mc info are in acceptance. - fRegistry.fill(HIST("Unfold/ccbar_uls/hsRM"), v12mc.M(), v12mc.Pt(), v12rec.M(), v12rec.Pt(), weight); - } else if (!isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { - fRegistry.fill(HIST("Unfold/ccbar_uls/hMiss"), v12mc.M(), v12mc.Pt(), weight); - } else if (isPairInAcc(pos, neg) && !isPairInAcc(mcpos, mcneg)) { - fRegistry.fill(HIST("Unfold/ccbar_uls/hFake"), v12rec.M(), v12rec.Pt(), weight); - } - break; - } - case static_cast(EM_HFeeType::kBe_Be): - case static_cast(EM_HFeeType::kBCe_BCe): - case static_cast(EM_HFeeType::kBCe_Be_SameB): { // ULS - if (isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { // both rec and mc info are in acceptance. - fRegistry.fill(HIST("Unfold/bbbar_uls/hsRM"), v12mc.M(), v12mc.Pt(), v12rec.M(), v12rec.Pt(), weight); - } else if (!isPairInAcc(pos, neg) && isPairInAcc(mcpos, mcneg)) { - fRegistry.fill(HIST("Unfold/bbbar_uls/hMiss"), v12mc.M(), v12mc.Pt(), weight); - } else if (isPairInAcc(pos, neg) && !isPairInAcc(mcpos, mcneg)) { - fRegistry.fill(HIST("Unfold/bbbar_uls/hFake"), v12rec.M(), v12rec.Pt(), weight); - } - break; - } - case static_cast(EM_HFeeType::kBCe_Be_DiffB): // LS - LOGF(info, "You should not see kBCe_Be_DiffB in ULS. Good luck."); - break; - default: - break; - } - } + fillPairUnfolding(pos, neg, tracks, cut, mcCollisions, mcparticles); } // end of ULS pairing - for (const auto& [pos1, pos2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { // LS++ - auto mcpos1 = mcparticles.iteratorAt(pos1.emmcparticleId()); - auto mccollision_from_pos1 = mcpos1.template emmcevent_as(); - if (cfgEventGeneratorType >= 0 && mccollision_from_pos1.getSubGeneratorId() != cfgEventGeneratorType) { - continue; - } - auto mcpos2 = mcparticles.iteratorAt(pos2.emmcparticleId()); - auto mccollision_from_pos2 = mcpos2.template emmcevent_as(); - if (cfgEventGeneratorType >= 0 && mccollision_from_pos2.getSubGeneratorId() != cfgEventGeneratorType) { - continue; - } - - if ((std::abs(mcpos1.pdgCode()) != pdg_lepton || std::abs(mcpos2.pdgCode()) != pdg_lepton) || (mcpos1.emmceventId() != mcpos2.emmceventId())) { - continue; - } - if (mcpos1.pdgCode() * mcpos2.pdgCode() < 0) { // LS - continue; - } - if (!((mcpos1.isPhysicalPrimary() || mcpos1.producedByGenerator()) && (mcpos2.isPhysicalPrimary() || mcpos2.producedByGenerator()))) { - continue; - } - int hfee_type = IsHF(mcpos1, mcpos2, mcparticles); - if (hfee_type < 0) { - continue; - } - - if (!isPairOK(pos1, pos2, cut, tracks)) { // without acceptance - continue; - } - - ROOT::Math::PtEtaPhiMVector v1rec(pos1.pt(), pos1.eta(), pos1.phi(), leptonM1); - ROOT::Math::PtEtaPhiMVector v2rec(pos2.pt(), pos2.eta(), pos2.phi(), leptonM2); - ROOT::Math::PtEtaPhiMVector v12rec = v1rec + v2rec; - - ROOT::Math::PtEtaPhiMVector v1mc(mcpos1.pt(), mcpos1.eta(), mcpos1.phi(), leptonM1); - ROOT::Math::PtEtaPhiMVector v2mc(mcpos2.pt(), mcpos2.eta(), mcpos2.phi(), leptonM2); - ROOT::Math::PtEtaPhiMVector v12mc = v1mc + v2mc; - float weight = 1.f; - if (cfgApplyWeightTTCA) { - weight = map_weight[std::make_pair(pos1.globalIndex(), pos2.globalIndex())]; - } - - if (hfee_type > -1) { - switch (hfee_type) { - case static_cast(EM_HFeeType::kCe_Ce): - LOGF(info, "You should not see kCe_Ce in LS. Good luck."); - break; - case static_cast(EM_HFeeType::kBe_Be): - LOGF(info, "You should not see kBe_Be in LS. Good luck."); - break; - case static_cast(EM_HFeeType::kBCe_BCe): - LOGF(info, "You should not see kBCe_BCe in LS. Good luck."); - break; - case static_cast(EM_HFeeType::kBCe_Be_SameB): // ULS - LOGF(info, "You should not see kBCe_Be_SameB in LS. Good luck."); - break; - case static_cast(EM_HFeeType::kBCe_Be_DiffB): { // LS - if (isPairInAcc(pos1, pos2) && isPairInAcc(mcpos1, mcpos2)) { // both rec and mc info are in acceptance. - fRegistry.fill(HIST("Unfold/bbbar_ls/hsRM"), v12mc.M(), v12mc.Pt(), v12rec.M(), v12rec.Pt(), weight); - } else if (!isPairInAcc(pos1, pos2) && isPairInAcc(mcpos1, mcpos2)) { - fRegistry.fill(HIST("Unfold/bbbar_ls/hMiss"), v12mc.M(), v12mc.Pt(), weight); - } else if (isPairInAcc(pos1, pos2) && !isPairInAcc(mcpos1, mcpos2)) { - fRegistry.fill(HIST("Unfold/bbbar_ls/hFake"), v12rec.M(), v12rec.Pt(), weight); - } - break; - } - default: - break; - } - } + fillPairUnfolding(pos1, pos2, tracks, cut, mcCollisions, mcparticles); } // end of LS++ pairing - for (const auto& [neg1, neg2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { // LS-- - auto mcneg1 = mcparticles.iteratorAt(neg1.emmcparticleId()); - auto mccollision_from_neg1 = mcneg1.template emmcevent_as(); - if (cfgEventGeneratorType >= 0 && mccollision_from_neg1.getSubGeneratorId() != cfgEventGeneratorType) { - continue; - } - auto mcneg2 = mcparticles.iteratorAt(neg2.emmcparticleId()); - auto mccollision_from_neg2 = mcneg2.template emmcevent_as(); - if (cfgEventGeneratorType >= 0 && mccollision_from_neg2.getSubGeneratorId() != cfgEventGeneratorType) { - continue; - } - if (!isPairOK(neg1, neg2, cut, tracks)) { // without acceptance - continue; - } - if ((std::abs(mcneg1.pdgCode()) != pdg_lepton || std::abs(mcneg2.pdgCode()) != pdg_lepton) || (mcneg1.emmceventId() != mcneg2.emmceventId())) { - continue; - } - if (mcneg1.pdgCode() * mcneg2.pdgCode() < 0) { // LS - continue; - } - if (!((mcneg1.isPhysicalPrimary() || mcneg1.producedByGenerator()) && (mcneg2.isPhysicalPrimary() || mcneg2.producedByGenerator()))) { - continue; - } - int hfee_type = IsHF(mcneg1, mcneg2, mcparticles); - if (hfee_type < 0) { - continue; - } + fillPairUnfolding(neg1, neg2, tracks, cut, mcCollisions, mcparticles); + } // end of LS-- pairing + } // end of collision loop + } - if (!isPairOK(neg1, neg2, cut, tracks)) { // without acceptance - continue; - } + SliceCache cache; + Preslice perCollision_electron = aod::emprimaryelectron::emeventId; + Filter trackFilter_electron = nabs(o2::aod::track::dcaXY) < dielectroncuts.cfg_max_dcaxy && nabs(o2::aod::track::dcaZ) < dielectroncuts.cfg_max_dcaz; + Filter ttcaFilter_electron = ifnode(dielectroncuts.enableTTCA.node(), o2::aod::emprimaryelectron::isAssociatedToMPC == true || o2::aod::emprimaryelectron::isAssociatedToMPC == false, o2::aod::emprimaryelectron::isAssociatedToMPC == true); + Filter prefilter_derived_electron = ifnode(dielectroncuts.cfg_apply_cuts_from_prefilter_derived.node() && dielectroncuts.cfg_prefilter_bits_derived.node() >= static_cast(1), + ifnode((dielectroncuts.cfg_prefilter_bits_derived.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kMee))) > static_cast(0), (o2::aod::emprimaryelectron::pfbderived & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kMee))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits_derived.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kPhiV))) > static_cast(0), (o2::aod::emprimaryelectron::pfbderived & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kPhiV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits_derived.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackLS))) > static_cast(0), (o2::aod::emprimaryelectron::pfbderived & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackLS))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits_derived.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackULS))) > static_cast(0), (o2::aod::emprimaryelectron::pfbderived & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackULS))) <= static_cast(0), true), + o2::aod::emprimaryelectron::pfbderived >= static_cast(0)); - ROOT::Math::PtEtaPhiMVector v1rec(neg1.pt(), neg1.eta(), neg1.phi(), leptonM1); - ROOT::Math::PtEtaPhiMVector v2rec(neg2.pt(), neg2.eta(), neg2.phi(), leptonM2); - ROOT::Math::PtEtaPhiMVector v12rec = v1rec + v2rec; + Filter prefilter_electron = ifnode(dielectroncuts.cfg_apply_cuts_from_prefilter.node() && dielectroncuts.cfg_prefilter_bits.node() >= static_cast(1), + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_20MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_20MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_40MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_40MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_60MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_60MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_80MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_80MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_100MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_100MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_120MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_120MeV))) <= static_cast(0), true) && + ifnode((dielectroncuts.cfg_prefilter_bits.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_140MeV))) > static_cast(0), (o2::aod::emprimaryelectron::pfb & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_140MeV))) <= static_cast(0), true), + o2::aod::emprimaryelectron::pfb >= static_cast(0)); - ROOT::Math::PtEtaPhiMVector v1mc(mcneg1.pt(), mcneg1.eta(), mcneg1.phi(), leptonM1); - ROOT::Math::PtEtaPhiMVector v2mc(mcneg2.pt(), mcneg2.eta(), mcneg2.phi(), leptonM2); - ROOT::Math::PtEtaPhiMVector v12mc = v1mc + v2mc; - float weight = 1.f; - if (cfgApplyWeightTTCA) { - weight = map_weight[std::make_pair(neg1.globalIndex(), neg2.globalIndex())]; - } + Preslice perCollision_muon = aod::emprimarymuon::emeventId; + Filter trackFilter_muon = o2::aod::fwdtrack::trackType == dimuoncuts.cfg_track_type; + Filter ttcaFilter_muon = ifnode(dimuoncuts.enableTTCA.node(), o2::aod::emprimarymuon::isAssociatedToMPC == true || o2::aod::emprimarymuon::isAssociatedToMPC == false, o2::aod::emprimarymuon::isAssociatedToMPC == true); - if (hfee_type > -1) { - switch (hfee_type) { - case static_cast(EM_HFeeType::kCe_Ce): - LOGF(info, "You should not see kCe_Ce in LS. Good luck."); - break; - case static_cast(EM_HFeeType::kBe_Be): - LOGF(info, "You should not see kBe_Be in LS. Good luck."); - break; - case static_cast(EM_HFeeType::kBCe_BCe): - LOGF(info, "You should not see kBCe_BCe in LS. Good luck."); - break; - case static_cast(EM_HFeeType::kBCe_Be_SameB): // ULS - LOGF(info, "You should not see kBCe_Be_SameB in LS. Good luck."); - break; - case static_cast(EM_HFeeType::kBCe_Be_DiffB): { // LS - if (isPairInAcc(neg1, neg2) && isPairInAcc(mcneg1, mcneg2)) { // both rec and mc info are in acceptance. - fRegistry.fill(HIST("Unfold/bbbar_ls/hsRM"), v12mc.M(), v12mc.Pt(), v12rec.M(), v12rec.Pt(), weight); - } else if (!isPairInAcc(neg1, neg2) && isPairInAcc(mcneg1, mcneg2)) { - fRegistry.fill(HIST("Unfold/bbbar_ls/hMiss"), v12mc.M(), v12mc.Pt(), weight); - } else if (isPairInAcc(neg1, neg2) && !isPairInAcc(mcneg1, mcneg2)) { - fRegistry.fill(HIST("Unfold/bbbar_ls/hFake"), v12rec.M(), v12rec.Pt(), weight); - } - break; - } - default: - break; - } - } - } // end of LS-- pairing - } // end of collision loop - } + Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); + Filter collisionFilter_numContrib = cfgNumContribMin <= o2::aod::collision::numContrib && o2::aod::collision::numContrib < cfgNumContribMax; + Filter collisionFilter_occupancy_track = eventcuts.cfgTrackOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgTrackOccupancyMax; + Filter collisionFilter_occupancy_ft0c = eventcuts.cfgFT0COccupancyMin <= o2::aod::evsel::ft0cOccupancyInTimeRange && o2::aod::evsel::ft0cOccupancyInTimeRange < eventcuts.cfgFT0COccupancyMax; + using FilteredMyCollisions = soa::Filtered; Partition positive_electrons = o2::aod::emprimaryelectron::sign > int8_t(0); // reconstructed tracks Partition negative_electrons = o2::aod::emprimaryelectron::sign < int8_t(0); // reconstructed tracks @@ -2536,10 +2460,10 @@ struct DileptonMC { switch (std::abs(mctrack.pdgCode())) { case 223: - fRegistry.fill(HIST("Generated/sm/Omega2ll/hPtY"), mctrack.y(), mctrack.pt(), 1.f / mctrack.dsf()); + fRegistry.fill(HIST("Generated/sm/Omega2ll/uls/hPtY"), mctrack.y(), mctrack.pt(), 1.f / mctrack.dsf()); break; case 333: - fRegistry.fill(HIST("Generated/sm/Phi2ll/hPtY"), mctrack.y(), mctrack.pt(), 1.f / mctrack.dsf()); + fRegistry.fill(HIST("Generated/sm/Phi2ll/uls/hPtY"), mctrack.y(), mctrack.pt(), 1.f / mctrack.dsf()); break; default: break; diff --git a/PWGEM/Dilepton/Core/SingleTrackQC.h b/PWGEM/Dilepton/Core/SingleTrackQC.h index 2efb5e467f0..0b8e67435fc 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQC.h @@ -170,14 +170,6 @@ struct SingleTrackQC { Configurable cfg_max_TOFNsigmaEl{"cfg_max_TOFNsigmaEl", +3.0, "max. TOF n sigma for electron inclusion"}; Configurable cfg_min_pin_pirejTPC{"cfg_min_pin_pirejTPC", 0.f, "min. pin for pion rejection in TPC"}; Configurable cfg_max_pin_pirejTPC{"cfg_max_pin_pirejTPC", 1e+10, "max. pin for pion rejection in TPC"}; - // Configurable cfg_min_ITSNsigmaKa{"cfg_min_ITSNsigmaKa", -1.0, "min. ITS n sigma for kaon exclusion"}; - // Configurable cfg_max_ITSNsigmaKa{"cfg_max_ITSNsigmaKa", 1e+10, "max. ITS n sigma for kaon exclusion"}; - // Configurable cfg_min_ITSNsigmaPr{"cfg_min_ITSNsigmaPr", -1.0, "min. ITS n sigma for proton exclusion"}; - // Configurable cfg_max_ITSNsigmaPr{"cfg_max_ITSNsigmaPr", 1e+10, "max. ITS n sigma for proton exclusion"}; - // Configurable cfg_min_p_ITSNsigmaKa{"cfg_min_p_ITSNsigmaKa", 0.0, "min p for kaon exclusion in ITS"}; - // Configurable cfg_max_p_ITSNsigmaKa{"cfg_max_p_ITSNsigmaKa", 0.0, "max p for kaon exclusion in ITS"}; - // Configurable cfg_min_p_ITSNsigmaPr{"cfg_min_p_ITSNsigmaPr", 0.0, "min p for proton exclusion in ITS"}; - // Configurable cfg_max_p_ITSNsigmaPr{"cfg_max_p_ITSNsigmaPr", 0.0, "max p for proton exclusion in ITS"}; Configurable enableTTCA{"enableTTCA", true, "Flag to enable or disable TTCA"}; Configurable includeITSsa{"includeITSsa", false, "Flag to enable ITSsa tracks"}; Configurable cfg_max_pt_track_ITSsa{"cfg_max_pt_track_ITSsa", 0.15, "max pt for ITSsa tracks"}; @@ -283,11 +275,6 @@ struct SingleTrackQC { fRegistry.add("Track/positive/hMeanClusterSizeITS", "mean cluster size ITS;p_{pv} (GeV/c); on ITS #times cos(#lambda);", kTH2F, {{1000, 0.f, 10.f}, {150, 0, 15}}, false); fRegistry.add("Track/positive/hMeanClusterSizeITSib", "mean cluster size ITS inner barrel;p_{pv} (GeV/c); on ITS #times cos(#lambda);", kTH2F, {{1000, 0.f, 10.f}, {150, 0, 15}}, false); fRegistry.add("Track/positive/hMeanClusterSizeITSob", "mean cluster size ITS outer barrel;p_{pv} (GeV/c); on ITS #times cos(#lambda);", kTH2F, {{1000, 0.f, 10.f}, {150, 0, 15}}, false); - // fRegistry.add("Track/positive/hITSNsigmaEl", "ITS n sigma el;p_{pv} (GeV/c);n #sigma_{e}^{ITS}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - // fRegistry.add("Track/positive/hITSNsigmaMu", "ITS n sigma mu;p_{pv} (GeV/c);n #sigma_{#mu}^{ITS}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - // fRegistry.add("Track/positive/hITSNsigmaPi", "ITS n sigma pi;p_{pv} (GeV/c);n #sigma_{#pi}^{ITS}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - // fRegistry.add("Track/positive/hITSNsigmaKa", "ITS n sigma ka;p_{pv} (GeV/c);n #sigma_{K}^{ITS}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - // fRegistry.add("Track/positive/hITSNsigmaPr", "ITS n sigma pr;p_{pv} (GeV/c);n #sigma_{p}^{ITS}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.addClone("Track/positive/", "Track/negative/"); } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { @@ -456,10 +443,6 @@ struct SingleTrackQC { fDielectronCut.SetTPCNsigmaPrRange(dielectroncuts.cfg_min_TPCNsigmaPr, dielectroncuts.cfg_max_TPCNsigmaPr); fDielectronCut.SetTOFNsigmaElRange(dielectroncuts.cfg_min_TOFNsigmaEl, dielectroncuts.cfg_max_TOFNsigmaEl); fDielectronCut.SetPinRangeForPionRejectionTPC(dielectroncuts.cfg_min_pin_pirejTPC, dielectroncuts.cfg_max_pin_pirejTPC); - // fDielectronCut.SetITSNsigmaKaRange(dielectroncuts.cfg_min_ITSNsigmaKa, dielectroncuts.cfg_max_ITSNsigmaKa); - // fDielectronCut.SetITSNsigmaPrRange(dielectroncuts.cfg_min_ITSNsigmaPr, dielectroncuts.cfg_max_ITSNsigmaPr); - // fDielectronCut.SetPRangeForITSNsigmaKa(dielectroncuts.cfg_min_p_ITSNsigmaKa, dielectroncuts.cfg_max_p_ITSNsigmaKa); - // fDielectronCut.SetPRangeForITSNsigmaPr(dielectroncuts.cfg_min_p_ITSNsigmaPr, dielectroncuts.cfg_max_p_ITSNsigmaPr); if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { // please call this at the end of DefineDileptonCut std::vector binsML{}; @@ -575,11 +558,6 @@ struct SingleTrackQC { // fRegistry.fill(HIST("Track/positive/hTOFNsigmaPi"), track.p(), track.tofNSigmaPi()); // fRegistry.fill(HIST("Track/positive/hTOFNsigmaKa"), track.p(), track.tofNSigmaKa()); // fRegistry.fill(HIST("Track/positive/hTOFNsigmaPr"), track.p(), track.tofNSigmaPr()); - // fRegistry.fill(HIST("Track/positive/hITSNsigmaEl"), track.p(), track.itsNSigmaEl()); - // fRegistry.fill(HIST("Track/positive/hITSNsigmaMu"), track.p(), track.itsNSigmaMu()); - // fRegistry.fill(HIST("Track/positive/hITSNsigmaPi"), track.p(), track.itsNSigmaPi()); - // fRegistry.fill(HIST("Track/positive/hITSNsigmaKa"), track.p(), track.itsNSigmaKa()); - // fRegistry.fill(HIST("Track/positive/hITSNsigmaPr"), track.p(), track.itsNSigmaPr()); } else { fRegistry.fill(HIST("Track/negative/hs"), track.pt(), track.eta(), track.phi(), dca3D, dcaXY, dcaZ, weight); fRegistry.fill(HIST("Track/negative/hPhiPosition"), phiPosition); @@ -619,11 +597,6 @@ struct SingleTrackQC { // fRegistry.fill(HIST("Track/negative/hTOFNsigmaPi"), track.p(), track.tofNSigmaPi()); // fRegistry.fill(HIST("Track/negative/hTOFNsigmaKa"), track.p(), track.tofNSigmaKa()); // fRegistry.fill(HIST("Track/negative/hTOFNsigmaPr"), track.p(), track.tofNSigmaPr()); - // fRegistry.fill(HIST("Track/negative/hITSNsigmaEl"), track.p(), track.itsNSigmaEl()); - // fRegistry.fill(HIST("Track/negative/hITSNsigmaMu"), track.p(), track.itsNSigmaMu()); - // fRegistry.fill(HIST("Track/negative/hITSNsigmaPi"), track.p(), track.itsNSigmaPi()); - // fRegistry.fill(HIST("Track/negative/hITSNsigmaKa"), track.p(), track.itsNSigmaKa()); - // fRegistry.fill(HIST("Track/negative/hITSNsigmaPr"), track.p(), track.itsNSigmaPr()); } } diff --git a/PWGEM/Dilepton/Core/SingleTrackQCMC.h b/PWGEM/Dilepton/Core/SingleTrackQCMC.h index 69eb429ac64..5f5fce49270 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQCMC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQCMC.h @@ -177,14 +177,6 @@ struct SingleTrackQCMC { Configurable cfg_max_TOFNsigmaEl{"cfg_max_TOFNsigmaEl", +3.0, "max. TOF n sigma for electron inclusion"}; Configurable cfg_min_pin_pirejTPC{"cfg_min_pin_pirejTPC", 0.f, "min. pin for pion rejection in TPC"}; Configurable cfg_max_pin_pirejTPC{"cfg_max_pin_pirejTPC", 1e+10, "max. pin for pion rejection in TPC"}; - // Configurable cfg_min_ITSNsigmaKa{"cfg_min_ITSNsigmaKa", -1.0, "min. ITS n sigma for kaon exclusion"}; - // Configurable cfg_max_ITSNsigmaKa{"cfg_max_ITSNsigmaKa", 1e+10, "max. ITS n sigma for kaon exclusion"}; - // Configurable cfg_min_ITSNsigmaPr{"cfg_min_ITSNsigmaPr", -1.0, "min. ITS n sigma for proton exclusion"}; - // Configurable cfg_max_ITSNsigmaPr{"cfg_max_ITSNsigmaPr", 1e+10, "max. ITS n sigma for proton exclusion"}; - // Configurable cfg_min_p_ITSNsigmaKa{"cfg_min_p_ITSNsigmaKa", 0.0, "min p for kaon exclusion in ITS"}; - // Configurable cfg_max_p_ITSNsigmaKa{"cfg_max_p_ITSNsigmaKa", 0.0, "max p for kaon exclusion in ITS"}; - // Configurable cfg_min_p_ITSNsigmaPr{"cfg_min_p_ITSNsigmaPr", 0.0, "min p for proton exclusion in ITS"}; - // Configurable cfg_max_p_ITSNsigmaPr{"cfg_max_p_ITSNsigmaPr", 0.0, "max p for proton exclusion in ITS"}; Configurable enableTTCA{"enableTTCA", true, "Flag to enable or disable TTCA"}; Configurable includeITSsa{"includeITSsa", false, "Flag to enable ITSsa tracks"}; Configurable cfg_max_pt_track_ITSsa{"cfg_max_pt_track_ITSsa", 0.15, "max pt for ITSsa tracks"}; @@ -332,11 +324,6 @@ struct SingleTrackQCMC { fRegistry.add("Track/PID/positive/hMeanClusterSizeITS", "mean cluster size ITS;p_{pv} (GeV/c); on ITS #times cos(#lambda)", kTH2F, {{1000, 0.f, 10.f}, {150, 0, 15}}, false); fRegistry.add("Track/PID/positive/hMeanClusterSizeITSib", "mean cluster size ITS inner barrel;p_{pv} (GeV/c); on ITS #times cos(#lambda)", kTH2F, {{1000, 0.f, 10.f}, {150, 0, 15}}, false); fRegistry.add("Track/PID/positive/hMeanClusterSizeITSob", "mean cluster size ITS outer barrel;p_{pv} (GeV/c); on ITS #times cos(#lambda)", kTH2F, {{1000, 0.f, 10.f}, {150, 0, 15}}, false); - // fRegistry.add("Track/PID/positive/hITSNsigmaEl", "ITS n sigma el;p_{pv} (GeV/c);n #sigma_{e}^{ITS}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - // fRegistry.add("Track/PID/positive/hITSNsigmaMu", "ITS n sigma mu;p_{pv} (GeV/c);n #sigma_{#mu}^{ITS}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - // fRegistry.add("Track/PID/positive/hITSNsigmaPi", "ITS n sigma pi;p_{pv} (GeV/c);n #sigma_{#pi}^{ITS}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - // fRegistry.add("Track/PID/positive/hITSNsigmaKa", "ITS n sigma ka;p_{pv} (GeV/c);n #sigma_{K}^{ITS}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - // fRegistry.add("Track/PID/positive/hITSNsigmaPr", "ITS n sigma pr;p_{pv} (GeV/c);n #sigma_{p}^{ITS}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.addClone("Track/PID/positive/", "Track/PID/negative/"); } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { @@ -541,10 +528,6 @@ struct SingleTrackQCMC { fDielectronCut.SetTPCNsigmaPrRange(dielectroncuts.cfg_min_TPCNsigmaPr, dielectroncuts.cfg_max_TPCNsigmaPr); fDielectronCut.SetTOFNsigmaElRange(dielectroncuts.cfg_min_TOFNsigmaEl, dielectroncuts.cfg_max_TOFNsigmaEl); fDielectronCut.SetPinRangeForPionRejectionTPC(dielectroncuts.cfg_min_pin_pirejTPC, dielectroncuts.cfg_max_pin_pirejTPC); - // fDielectronCut.SetITSNsigmaKaRange(dielectroncuts.cfg_min_ITSNsigmaKa, dielectroncuts.cfg_max_ITSNsigmaKa); - // fDielectronCut.SetITSNsigmaPrRange(dielectroncuts.cfg_min_ITSNsigmaPr, dielectroncuts.cfg_max_ITSNsigmaPr); - // fDielectronCut.SetPRangeForITSNsigmaKa(dielectroncuts.cfg_min_p_ITSNsigmaKa, dielectroncuts.cfg_max_p_ITSNsigmaKa); - // fDielectronCut.SetPRangeForITSNsigmaPr(dielectroncuts.cfg_min_p_ITSNsigmaPr, dielectroncuts.cfg_max_p_ITSNsigmaPr); if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { // please call this at the end of DefineDileptonCut std::vector binsML{}; @@ -714,11 +697,6 @@ struct SingleTrackQCMC { // fRegistry.fill(HIST("Track/PID/positive/hTOFNsigmaPi"), track.p(), track.tofNSigmaPi()); // fRegistry.fill(HIST("Track/PID/positive/hTOFNsigmaKa"), track.p(), track.tofNSigmaKa()); // fRegistry.fill(HIST("Track/PID/positive/hTOFNsigmaPr"), track.p(), track.tofNSigmaPr()); - // fRegistry.fill(HIST("Track/PID/positive/hITSNsigmaEl"), track.p(), track.itsNSigmaEl()); - // fRegistry.fill(HIST("Track/PID/positive/hITSNsigmaMu"), track.p(), track.itsNSigmaMu()); - // fRegistry.fill(HIST("Track/PID/positive/hITSNsigmaPi"), track.p(), track.itsNSigmaPi()); - // fRegistry.fill(HIST("Track/PID/positive/hITSNsigmaKa"), track.p(), track.itsNSigmaKa()); - // fRegistry.fill(HIST("Track/PID/positive/hITSNsigmaPr"), track.p(), track.itsNSigmaPr()); } } else { fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hs"), track.pt(), track.eta(), track.phi(), dca3D, dcaXY, dcaZ, -mctrack.pdgCode() / pdg_lepton, weight); @@ -768,11 +746,6 @@ struct SingleTrackQCMC { // fRegistry.fill(HIST("Track/PID/negative/hTOFNsigmaPi"), track.p(), track.tofNSigmaPi()); // fRegistry.fill(HIST("Track/PID/negative/hTOFNsigmaKa"), track.p(), track.tofNSigmaKa()); // fRegistry.fill(HIST("Track/PID/negative/hTOFNsigmaPr"), track.p(), track.tofNSigmaPr()); - // fRegistry.fill(HIST("Track/PID/negative/hITSNsigmaEl"), track.p(), track.itsNSigmaEl()); - // fRegistry.fill(HIST("Track/PID/negative/hITSNsigmaMu"), track.p(), track.itsNSigmaMu()); - // fRegistry.fill(HIST("Track/PID/negative/hITSNsigmaPi"), track.p(), track.itsNSigmaPi()); - // fRegistry.fill(HIST("Track/PID/negative/hITSNsigmaKa"), track.p(), track.itsNSigmaKa()); - // fRegistry.fill(HIST("Track/PID/negative/hITSNsigmaPr"), track.p(), track.itsNSigmaPr()); } } } From 47af7237442fb4b989b68edd8fa2aea9f479e0a6 Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Wed, 15 Oct 2025 01:48:23 +0200 Subject: [PATCH 752/986] [PWGLF] Add delta phi info and improved mixed event weight (#13378) --- .../Strangeness/lambdaspincorrderived.cxx | 80 ++++++++++++------- 1 file changed, 51 insertions(+), 29 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx index 770c2c7291e..8a75b7205e7 100644 --- a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx @@ -108,7 +108,7 @@ struct lambdaspincorrderived { Configurable massMix{"massMix", 0.0028, "Masscut on event mixing"}; ConfigurableAxis ax_dphi_h{"ax_dphi_h", {72, 0.0, 2.0 * TMath::Pi()}, "Δφ_h"}; - ConfigurableAxis ax_deta{"ax_deta", {32, -1.6, 1.6}, "Δη"}; + ConfigurableAxis ax_deta{"ax_deta", {40, -1.0, 1.0}, "Δη"}; ConfigurableAxis ax_ptpair{"ax_ptpair", {100, 0.0, 10.0}, "p_{T,pair} (GeV/c)"}; // THnsparse bining @@ -132,15 +132,15 @@ struct lambdaspincorrderived { histos.add("etaCent", "etaCent", HistType::kTH2D, {{32, -0.8, 0.8}, {8, 0.0, 80.0}}, true); // --- 3D SE/ME pair-space maps per category (LL, LAL, ALL, ALAL) - histos.add("SE_LL", "SE pairs LL;Δφ_h;Δη;p_{T,pair}", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); - histos.add("SE_LAL", "SE pairs LAL;Δφ_h;Δη;p_{T,pair}", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); - histos.add("SE_ALL", "SE pairs ALL;Δφ_h;Δη;p_{T,pair}", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); - histos.add("SE_ALAL", "SE pairs ALAL;Δφ_h;Δη;p_{T,pair}", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); + histos.add("SE_LL", "SE pairs", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); + histos.add("SE_LAL", "SE pairs", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); + histos.add("SE_ALL", "SE pairs", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); + histos.add("SE_ALAL", "SE pairs", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); - histos.add("ME_LL", "ME pairs LL;Δφ_h;Δη;p_{T,pair}", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); - histos.add("ME_LAL", "ME pairs LAL;Δφ_h;Δη;p_{T,pair}", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); - histos.add("ME_ALL", "ME pairs ALL;Δφ_h;Δη;p_{T,pair}", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); - histos.add("ME_ALAL", "ME pairs ALAL;Δφ_h;Δη;p_{T,pair}", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); + histos.add("ME_LL", "ME pairs", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); + histos.add("ME_LAL", "ME pairs", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); + histos.add("ME_ALL", "ME pairs", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); + histos.add("ME_ALAL", "ME pairs", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); histos.add("hSparseLambdaLambda", "hSparseLambdaLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisR}, true); histos.add("hSparseLambdaAntiLambda", "hSparseLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisR}, true); @@ -162,6 +162,16 @@ struct lambdaspincorrderived { histos.add("hSparseRapAntiLambdaLambdaMixed", "hSparseRapAntiLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); histos.add("hSparseRapAntiLambdaAntiLambdaMixed", "hSparseRapAntiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); + histos.add("hSparsePhiLambdaLambda", "hSparsePhiLambdaLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, ax_dphi_h}, true); + histos.add("hSparsePhiLambdaAntiLambda", "hSparsePhiLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, ax_dphi_h}, true); + histos.add("hSparsePhiAntiLambdaLambda", "hSparsePhiAntiLambdLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, ax_dphi_h}, true); + histos.add("hSparsePhiAntiLambdaAntiLambda", "hSparsePhiAntiLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, ax_dphi_h}, true); + + histos.add("hSparsePhiLambdaLambdaMixed", "hSparsePhiLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, ax_dphi_h}, true); + histos.add("hSparsePhiLambdaAntiLambdaMixed", "hSparsePhiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, ax_dphi_h}, true); + histos.add("hSparsePhiAntiLambdaLambdaMixed", "hSparsePhiAntiLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, ax_dphi_h}, true); + histos.add("hSparsePhiAntiLambdaAntiLambdaMixed", "hSparsePhiAntiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, ax_dphi_h}, true); + histos.add("hSparsePairMassLambdaLambda", "hSparsePairMassLambdaLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); histos.add("hSparsePairMassLambdaAntiLambda", "hSparsePairMassLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); histos.add("hSparsePairMassAntiLambdaLambda", "hSparsePairMassAntiLambdLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); @@ -319,26 +329,30 @@ struct lambdaspincorrderived { cosThetaDiff = cosDeltaTheta_hel; } - // --- helper to compute pair-space variables - auto phi1h = RecoDecay::constrainAngle(particle1Dummy.Phi(), 0.0F, harmonic); - auto phi2h = RecoDecay::constrainAngle(particle2Dummy.Phi(), 0.0F, harmonic); - double dphi_h = std::abs(phi1h - phi2h); - double deta_pair = particle1Dummy.Eta() - particle2Dummy.Eta(); - double pt_pair = (particle1Dummy + particle2Dummy).Pt(); - double deltaRap = std::abs(particle1Dummy.Rapidity() - particle2Dummy.Rapidity()); - double deltaR = TMath::Sqrt(deta_pair * deta_pair + dphi_h * dphi_h); + double pt1 = particle1.Pt(); + double dphi1 = RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic); + double deta1 = particle1.Eta(); + + double dphi2 = RecoDecay::constrainAngle(particle2.Phi(), 0.0F, harmonic); + double deta2 = particle2.Eta(); + + double deta_pair = std::abs(deta1 - deta2); + double dphi_pair = std::abs(dphi1 - dphi2); + + double deltaR = TMath::Sqrt(deta_pair * deta_pair + dphi_pair * dphi_pair); + double deltaRap = std::abs(particle1.Rapidity() - particle2.Rapidity()); double epsWeight = 1.0; if (useweight && datatype == 1) { if (tag1 == 0 && tag2 == 0) { - epsWeight = hweight1->GetBinContent(hweight1->FindBin(dphi_h, deta_pair, pt_pair)); + epsWeight = hweight1->GetBinContent(hweight1->FindBin(dphi1, deta1, pt1)); } else if (tag1 == 0 && tag2 == 1) { - epsWeight = hweight2->GetBinContent(hweight2->FindBin(dphi_h, deta_pair, pt_pair)); + epsWeight = hweight2->GetBinContent(hweight2->FindBin(dphi1, deta1, pt1)); } else if (tag1 == 1 && tag2 == 0) { - epsWeight = hweight3->GetBinContent(hweight3->FindBin(dphi_h, deta_pair, pt_pair)); + epsWeight = hweight3->GetBinContent(hweight3->FindBin(dphi1, deta1, pt1)); } else if (tag1 == 1 && tag2 == 1) { - epsWeight = hweight4->GetBinContent(hweight4->FindBin(dphi_h, deta_pair, pt_pair)); + epsWeight = hweight4->GetBinContent(hweight4->FindBin(dphi1, deta1, pt1)); } } @@ -348,23 +362,27 @@ struct lambdaspincorrderived { if (tag1 == 0 && tag2 == 0) { histos.fill(HIST("hSparseLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); histos.fill(HIST("hSparseRapLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); + histos.fill(HIST("hSparsePhiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, dphi_pair, mixpairweight); histos.fill(HIST("hSparsePairMassLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), mixpairweight); - histos.fill(HIST("SE_LL"), dphi_h, deta_pair, pt_pair); + histos.fill(HIST("SE_LL"), dphi1, deta1, pt1, mixpairweight); } else if (tag1 == 0 && tag2 == 1) { histos.fill(HIST("hSparseLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); histos.fill(HIST("hSparseRapLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); + histos.fill(HIST("hSparsePhiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, dphi_pair, mixpairweight); histos.fill(HIST("hSparsePairMassLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), mixpairweight); - histos.fill(HIST("SE_LAL"), dphi_h, deta_pair, pt_pair); + histos.fill(HIST("SE_LAL"), dphi1, deta1, pt1, mixpairweight); } else if (tag1 == 1 && tag2 == 0) { histos.fill(HIST("hSparseAntiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); histos.fill(HIST("hSparseRapAntiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); + histos.fill(HIST("hSparsePhiAntiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, dphi_pair, mixpairweight); histos.fill(HIST("hSparsePairMassAntiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), mixpairweight); - histos.fill(HIST("SE_ALL"), dphi_h, deta_pair, pt_pair); + histos.fill(HIST("SE_ALL"), dphi1, deta1, pt1, mixpairweight); } else if (tag1 == 1 && tag2 == 1) { histos.fill(HIST("hSparseAntiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); histos.fill(HIST("hSparseRapAntiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); + histos.fill(HIST("hSparsePhiAntiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, dphi_pair, mixpairweight); histos.fill(HIST("hSparsePairMassAntiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), mixpairweight); - histos.fill(HIST("SE_ALAL"), dphi_h, deta_pair, pt_pair); + histos.fill(HIST("SE_ALAL"), dphi1, deta1, pt1, mixpairweight); } } else if (datatype == 1) { double weight = mixpairweight; @@ -376,26 +394,30 @@ struct lambdaspincorrderived { histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight); histos.fill(HIST("hSparseLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); histos.fill(HIST("hSparseRapLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); + histos.fill(HIST("hSparsePhiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, dphi_pair, weight); histos.fill(HIST("hSparsePairMassLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), weight); - histos.fill(HIST("ME_LL"), dphi_h, deta_pair, pt_pair); + histos.fill(HIST("ME_LL"), dphi1, deta1, pt1, mixpairweight); } else if (tag1 == 0 && tag2 == 1) { histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight); histos.fill(HIST("hSparseLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); histos.fill(HIST("hSparseRapLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); + histos.fill(HIST("hSparsePhiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, dphi_pair, weight); histos.fill(HIST("hSparsePairMassLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), weight); - histos.fill(HIST("ME_LAL"), dphi_h, deta_pair, pt_pair); + histos.fill(HIST("ME_LAL"), dphi1, deta1, pt1, mixpairweight); } else if (tag1 == 1 && tag2 == 0) { histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight); histos.fill(HIST("hSparseAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); histos.fill(HIST("hSparseRapAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); + histos.fill(HIST("hSparsePhiAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, dphi_pair, weight); histos.fill(HIST("hSparsePairMassAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), weight); - histos.fill(HIST("ME_ALL"), dphi_h, deta_pair, pt_pair); + histos.fill(HIST("ME_ALL"), dphi1, deta1, pt1, mixpairweight); } else if (tag1 == 1 && tag2 == 1) { histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight); histos.fill(HIST("hSparseAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); histos.fill(HIST("hSparseRapAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); + histos.fill(HIST("hSparsePhiAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, dphi_pair, weight); histos.fill(HIST("hSparsePairMassAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), weight); - histos.fill(HIST("ME_ALAL"), dphi_h, deta_pair, pt_pair); + histos.fill(HIST("ME_ALAL"), dphi1, deta1, pt1, mixpairweight); } } } From 8350ceeb00838332b7fbe8a7509d0fbae1ab652e Mon Sep 17 00:00:00 2001 From: Swadhinkumar49 <108603227+Swadhinkumar49@users.noreply.github.com> Date: Wed, 15 Oct 2025 05:28:02 +0530 Subject: [PATCH 753/986] [PWGLF] phi1020SpherocityAnalysis.cxx (#13271) --- .../Resonances/phi1020SpherocityAnalysis.cxx | 473 ++++++++++++++++++ 1 file changed, 473 insertions(+) create mode 100644 PWGLF/Tasks/Resonances/phi1020SpherocityAnalysis.cxx diff --git a/PWGLF/Tasks/Resonances/phi1020SpherocityAnalysis.cxx b/PWGLF/Tasks/Resonances/phi1020SpherocityAnalysis.cxx new file mode 100644 index 00000000000..4adab07963c --- /dev/null +++ b/PWGLF/Tasks/Resonances/phi1020SpherocityAnalysis.cxx @@ -0,0 +1,473 @@ +// 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 phi1020SpherocityAnalysis.cxx +/// \brief Invariant Mass Reconstruction of phi(1020) Resonance in K+K- channel and Spherocity dependence study in pp collision at 13.6 TeV. +/// \author Swadhin Behera , Balaram Singh + +#include "PWGLF/DataModel/LFResonanceTables.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/PIDResponse.h" + +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::constants::physics; + +struct Phi1020SpherocityAnalysis { + + // Named constants to avoid magic numbers + static constexpr float kRapidityCut = 0.5F; + static constexpr float kRotateMin = 0.01F; + static constexpr float kRotateMax = 0.1F; + static constexpr float kMaxMcPosZ = 10.0F; + + SliceCache cache; + Preslice perRCol = aod::resodaughter::resoCollisionId; + Preslice perCollision = aod::track::collisionId; + + // Configurables. + Configurable nBinsPt{"nBinsPt", 200, "N bins in pT histogram"}; + Configurable nBinsInvM{"nBinsInvM", 200, "N bins in InvMass histogram"}; + Configurable nBinsSp{"nBinsSp", 120, "N bins in spherocity histogram"}; + Configurable doRotate{"doRotate", true, "rotated inv mass spectra"}; + + // Tracks + Configurable ptMin{"ptMin", 0.15, "Minimum Track pT"}; + Configurable etaCut{"etaCut", 0.8, "Pseudorapidity cut"}; + Configurable dcazMin{"dcazMin", 1., "Minimum DCAz"}; + Configurable dcaxyMin{"dcaxyMin", 0.1, "Minimum DCAxy"}; + Configurable primaryTrack{"primaryTrack", true, "Primary track selection"}; + Configurable globalWoDCATrack{"globalWoDCATrack", true, "Global track selection without DCA"}; + Configurable pvContributor{"pvContributor", true, "PV contributor track selection"}; + + // PID Selections (Kaons) + Configurable useOnlyTOFTrackK{"useOnlyTOFTrackK", false, "Use only TOF track for PID selection (Kaon)"}; + Configurable useTpcOnly{"useTpcOnly", false, "Use TPC Only selection"}; + Configurable rejNsigma{"rejNsigma", 1.0, "Reject tracks to improve purity of PID"}; + Configurable maxTPCnSigmaKaon{"maxTPCnSigmaKaon", 3.0, "TPC nSigma cut for Kaon"}; + Configurable maxTOFnSigmaKaon{"maxTOFnSigmaKaon", 3.0, "TOF nSigma cut for Kaon"}; + Configurable nsigmaCutCombinedKaon{"nsigmaCutCombinedKaon", 3.0, "Combined nSigma cut for Kaon"}; + Configurable> kaonTPCPIDp{"kaonTPCPIDp", {0.0, 0.25, 0.5, 1.0}, "pT dependent TPC cuts kaons"}; + Configurable> kaonTPCPIDcut{"kaonTPCPIDcut", {6., 3.5, 2.5}, "TPC nsigma cuts kaons"}; + + // Event Mixing. + Configurable mixSph{"mixSph", true, "Include Sph Bins to be mixed"}; + Configurable numMixEv{"numMixEv", 20, "Number of Events to be mixed"}; + ConfigurableAxis mixVtxBins{"mixVtxBins", {VARIABLE_WIDTH, -10.0f, -9.f, -8.f, -7.f, -6.f, -5.f, -4.f, -3.f, -2.f, -1.f, 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f, 10.f}, "Mixing bins - z-vertex"}; + ConfigurableAxis mixMultBins{"mixMultBins", {VARIABLE_WIDTH, 0.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.0f, 200.0f}, "Mixing bins - multiplicity"}; + ConfigurableAxis mixSphBins{"mixSphBins", {VARIABLE_WIDTH, 0.0f, 0.2f, 0.4f, 0.6f, 0.8f, 1.0f}, "Mixing bins - spherocity"}; + + // Histogram Registry. + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + void init(InitContext const&) + { + const AxisSpec axisSp(nBinsSp, 0., 1., "S_{0}"); + const AxisSpec axisCent(105, 0, 105, "FT0M (%)"); + const AxisSpec axisPpid(400, 0., 4., "p (GeV/c)"); + const AxisSpec axisPtPid(400, 0., 4., "p_{T} (GeV/c)"); + const AxisSpec axisPt(nBinsPt, 0., 10., "p_{T} (GeV/c)"); + const AxisSpec axisEta(40, -1, 1, "#eta"); + const AxisSpec axisDCAz(500, -0.5, 0.5, {"DCA_{z} (cm)"}); + const AxisSpec axisDCAxy(240, -0.12, 0.12, {"DCA_{xy} (cm)"}); + const AxisSpec axisTPCNCls(200, 0, 200, {"TPCNCls"}); + const AxisSpec axisTPCNsigma(120, -6, 6, {"n#sigma^{TPC}"}); + const AxisSpec axisTOFNsigma(120, -6, 6, {"n#sigma^{TOF}"}); + const AxisSpec axisdEdx(380, 10, 200, {"#frac{dE}{dx}"}); + const AxisSpec axisInvM(nBinsInvM, 0.98, 1.06, {"M_{inv} (GeV/#it{c}^{2})"}); + + // Event + histos.add("Event/h1d_ft0m_mult_percentile", "FT0M (%)", kTH1F, {axisCent}); + histos.add("Event/h1d_spherocity", "Event Spherocity", kTH1F, {axisSp}); + histos.add("Event/h2d_sph_vs_multpercentile", "Spherocity vs FT0M(%)", kTH2F, {axisCent, axisSp}); + + // QA Before + histos.add("QAbefore/Kaon/h2d_ka_nsigma_tpc_p", "n#sigma^{TPC} Kaons", kTH2F, {axisPpid, axisTPCNsigma}); + histos.add("QAbefore/Kaon/h2d_ka_nsigma_tof_p", "n#sigma^{TOF} Kaons", kTH2F, {axisPpid, axisTOFNsigma}); + histos.add("QAbefore/Kaon/h2d_ka_nsigma_tof_vs_tpc", "n#sigma^{TPC} vs n#sigma^{TOF} Kaons", kTH2F, {axisTPCNsigma, axisTOFNsigma}); + + // QA After + histos.add("QAafter/Kaon/h1d_ka_pt", "p_{T}-spectra Kaons", kTH1F, {axisPt}); + histos.add("QAafter/Kaon/h2d_ka_dca_z", "dca_{z} Kaons", kTH2F, {axisPtPid, axisDCAz}); + histos.add("QAafter/Kaon/h2d_ka_dca_xy", "dca_{xy} Kaons", kTH2F, {axisPtPid, axisDCAxy}); + histos.add("QAafter/Kaon/h2d_ka_dEdx_p", "TPC Signal Kaon", kTH2F, {axisPpid, axisdEdx}); + histos.add("QAafter/Kaon/h2d_ka_nsigma_tpc_pt", " Kaons", kTH2F, {axisPtPid, axisTPCNsigma}); + histos.add("QAafter/Kaon/h2d_ka_nsigma_tpc_p", " Kaons", kTH2F, {axisPpid, axisTPCNsigma}); + histos.add("QAafter/Kaon/h2d_ka_nsigma_tof_pt", " Kaons", kTH2F, {axisPtPid, axisTOFNsigma}); + histos.add("QAafter/Kaon/h2d_ka_nsigma_tof_p", " Kaons", kTH2F, {axisPpid, axisTOFNsigma}); + histos.add("QAafter/Kaon/h2d_ka_nsigma_tof_vs_tpc", "n#sigma(TOF) vs n#sigma(TPC) Kaons", kTH2F, {axisTPCNsigma, axisTOFNsigma}); + + // Analysis - phi(1020) -> K+ K- + histos.add("Analysis/h1d_phi_invm_US", "phi(1020) M_{inv} unlike-sign", kTH1D, {axisInvM}); + histos.add("Analysis/h1d_phi_invm_PP", "Like Signs M_{inv} K^{+}K^{+}", kTH1D, {axisInvM}); + histos.add("Analysis/h1d_phi_invm_MM", "Like Signs M_{inv} K^{-}K^{-}", kTH1D, {axisInvM}); + histos.add("Analysis/h1d_phi_invm_rot", "Rotated Spectra", kTH1D, {axisInvM}); + histos.add("Analysis/h1d_phi_invm_US_mix", "Mixed Events M_{inv}", kTH1D, {axisInvM}); + histos.add("Analysis/h1d_phi_invm_LS_mix", "Mixed Events M_{inv}", kTH1D, {axisInvM}); + histos.add("Analysis/h4d_phi_invm_US", "THn #phi(1020)", kTHnSparseD, {axisInvM, axisPt, axisSp, axisCent}); + histos.add("Analysis/h4d_phi_invm_PP", "THn Like Signs K^{+}K^{+}", kTHnSparseD, {axisInvM, axisPt, axisSp, axisCent}); + histos.add("Analysis/h4d_phi_invm_MM", "THn Like Signs K^{-}K^{-}", kTHnSparseD, {axisInvM, axisPt, axisSp, axisCent}); + histos.add("Analysis/h4d_phi_invm_rot", "THn Rotated", kTHnSparseD, {axisInvM, axisPt, axisSp, axisCent}); + histos.add("Analysis/h4d_phi_invm_US_mix", "THn Mixed Events", kTHnSparseD, {axisInvM, axisPt, axisSp, axisCent}); + histos.add("Analysis/h4d_phi_invm_LS_mix", "THn Mixed Events", kTHnSparseD, {axisInvM, axisPt, axisSp, axisCent}); + + // MC + if (doprocessMC) { + histos.add("Event/h1d_rec_sph", "Reconstructed S_{0}", kTH1F, {axisSp}); + histos.add("Analysis/h1d_gen_phi", "Generated phi(1020) p_{T}", kTH1D, {axisPt}); + histos.add("Analysis/h1d_rec_phi", "Reconstructed phi(1020) p_{T}", kTH1D, {axisPt}); + histos.add("Analysis/h1d_rec_invm_phi", "Recostructed phi(1020)", kTH1D, {axisInvM}); + // MC truth histograms for daughters + histos.add("MCTruth/h1d_gen_posZ", "Generated PosZ", kTH1F, {{240, -12., 12.}}); + histos.add("MCTruth/h1d_ch_gen_phi", "Generated #phi distribution", kTH1F, {{128, -0.05, 6.35}}); + histos.add("MCTruth/h1d_ka_gen_eta", "Generated #eta Kaons", kTH1F, {{40, -1, 1}}); + histos.add("QAChecks/h1d_ka_gen_pt", "Generated p_{T}-spectra Kaons", kTH1F, {{400, 0., 4.}}); + } + } + + template + bool selTracks(T const& track) + { + if (track.pt() < ptMin) + return false; + if (std::abs(track.eta()) > etaCut) + return false; + if (std::abs(track.dcaZ()) > dcazMin) + return false; + if (std::abs(track.dcaXY()) > dcaxyMin) + return false; + if (primaryTrack && !track.isPrimaryTrack()) + return false; + if (globalWoDCATrack && !track.isGlobalTrackWoDCA()) + return false; + if (pvContributor && !track.isPVContributor()) + return false; + return true; + } + + // PID selection tools (Kaon focused) + template + bool selectionPIDKaon(const T& candidate, float p) + { + bool tpcPIDPassed{false}, tofPIDPassed{false}; + auto tpcPIDp = static_cast>(kaonTPCPIDp); + auto tpcPIDcut = static_cast>(kaonTPCPIDcut); + int nitr = static_cast(tpcPIDp.size()); + + float tpcNsigmaPi = std::abs(candidate.tpcNSigmaPi()); + float tpcNsigmaKa = std::abs(candidate.tpcNSigmaKa()); + float tpcNsigmaPr = std::abs(candidate.tpcNSigmaPr()); + float tofNsigmaPi = std::abs(candidate.tofNSigmaPi()); + float tofNsigmaKa = std::abs(candidate.tofNSigmaKa()); + float tofNsigmaPr = std::abs(candidate.tofNSigmaPr()); + + float tpcTofNsigmaPi = tpcNsigmaPi * tpcNsigmaPi + tofNsigmaPi * tofNsigmaPi; + float tpcTofNsigmaKa = tpcNsigmaKa * tpcNsigmaKa + tofNsigmaKa * tofNsigmaKa; + float tpcTofNsigmaPr = tpcNsigmaPr * tpcNsigmaPr + tofNsigmaPr * tofNsigmaPr; + float combinedCut = nsigmaCutCombinedKaon * nsigmaCutCombinedKaon; + float combinedRejCut = rejNsigma * rejNsigma; + + if (!useTpcOnly && candidate.hasTOF()) { + if (tofNsigmaKa < maxTOFnSigmaKaon && tofNsigmaPi > rejNsigma && tofNsigmaPr > rejNsigma) { + tofPIDPassed = true; + } + // square cut + if ((nsigmaCutCombinedKaon < 0) && (tpcNsigmaKa < maxTPCnSigmaKaon)) { + tpcPIDPassed = true; + } + // circular + if ((nsigmaCutCombinedKaon > 0) && (tpcTofNsigmaKa < combinedCut && tpcTofNsigmaPi > combinedRejCut && tpcTofNsigmaPr > combinedRejCut)) { + tofPIDPassed = true; + tpcPIDPassed = true; + } + } else { + tofPIDPassed = true; + if (useTpcOnly) { + if (tpcNsigmaKa < maxTPCnSigmaKaon && tpcNsigmaPi > rejNsigma && tpcNsigmaPr > rejNsigma) { + tpcPIDPassed = true; + } + } else { + for (int i = 0; i < nitr - 1; ++i) { + if (p >= tpcPIDp[i] && p < tpcPIDp[i + 1] && (tpcNsigmaKa < tpcPIDcut[i] && tpcNsigmaPi > rejNsigma && tpcNsigmaPr > rejNsigma)) { + tpcPIDPassed = true; + } + } + } + } + if (tpcPIDPassed && tofPIDPassed) { + return true; + } + return false; + } + + template + void fillQAHistos(T const& track) + { + // get total momentum + float p = RecoDecay::p(track.px(), track.py(), track.pz()); + + // fill before QA + histos.fill(HIST("QAbefore/Kaon/h2d_ka_nsigma_tpc_p"), p, track.tpcNSigmaKa()); + if (track.hasTOF()) { + histos.fill(HIST("QAbefore/Kaon/h2d_ka_nsigma_tof_p"), p, track.tofNSigmaKa()); + histos.fill(HIST("QAbefore/Kaon/h2d_ka_nsigma_tof_vs_tpc"), track.tpcNSigmaKa(), track.tofNSigmaKa()); + } + + // fill after QA if it passes PID + if (selectionPIDKaon(track, p)) { + histos.fill(HIST("QAafter/Kaon/h1d_ka_pt"), track.pt()); + histos.fill(HIST("QAafter/Kaon/h2d_ka_dca_z"), track.pt(), track.dcaZ()); + histos.fill(HIST("QAafter/Kaon/h2d_ka_dca_xy"), track.pt(), track.dcaXY()); + histos.fill(HIST("QAafter/Kaon/h2d_ka_dEdx_p"), p, track.tpcSignal()); + histos.fill(HIST("QAafter/Kaon/h2d_ka_nsigma_tpc_p"), p, track.tpcNSigmaKa()); + histos.fill(HIST("QAafter/Kaon/h2d_ka_nsigma_tpc_pt"), track.pt(), track.tpcNSigmaKa()); + if (track.hasTOF() && !useTpcOnly) { + histos.fill(HIST("QAafter/Kaon/h2d_ka_nsigma_tof_p"), p, track.tofNSigmaKa()); + histos.fill(HIST("QAafter/Kaon/h2d_ka_nsigma_tof_pt"), track.pt(), track.tofNSigmaKa()); + histos.fill(HIST("QAafter/Kaon/h2d_ka_nsigma_tof_vs_tpc"), track.tpcNSigmaKa(), track.tofNSigmaKa()); + } + } + } + + template + void fillInvMassHistos(trackType const& trk1, trackType const& trk2, float const& sph, float const& mult) + { + // use std random for rotation + static thread_local std::mt19937 rng{std::random_device{}()}; + std::uniform_real_distribution distRotate(kRotateMin, kRotateMax); + float k1Ptot = 0., k2Ptot = 0.; + + for (auto const& pair : soa::combinations(soa::CombinationsFullIndexPolicy(trk1, trk2))) { + auto const& trkK1 = std::get<0>(pair); + auto const& trkK2 = std::get<1>(pair); + // Do not analyse same index tracks. + if (trkK1.index() == trkK2.index()) + continue; + + // pT, DCA, Global Tracks and PVcontrib selection. + if (!selTracks(trkK1) || !selTracks(trkK2)) + continue; + + k1Ptot = RecoDecay::p(trkK1.px(), trkK1.py(), trkK1.pz()); + k2Ptot = RecoDecay::p(trkK2.px(), trkK2.py(), trkK2.pz()); + + // Apply PID Selection + if (useOnlyTOFTrackK && !trkK1.hasTOF()) + continue; + if (useOnlyTOFTrackK && !trkK2.hasTOF()) + continue; + if (!selectionPIDKaon(trkK1, k1Ptot) || !selectionPIDKaon(trkK2, k2Ptot)) + continue; + + // Invariant mass reconstruction using RecoDecay utilities. + std::array mom1{trkK1.px(), trkK1.py(), trkK1.pz()}; + std::array mom2{trkK2.px(), trkK2.py(), trkK2.pz()}; + auto momTot = RecoDecay::pVec(mom1, mom2); + double mass = RecoDecay::m(std::array{mom1, mom2}, std::array{MassKaonCharged, MassKaonCharged}); + double rap = RecoDecay::y(momTot, mass); + double ptTot = RecoDecay::pt(momTot); + + // rapidity cut + if (std::abs(rap) > kRapidityCut) + continue; + + // Fill Invariant Mass Histograms. + if constexpr (!mix && !mc) { + if (trkK1.sign() * trkK2.sign() < 0) { + histos.fill(HIST("Analysis/h1d_phi_invm_US"), mass); + histos.fill(HIST("Analysis/h4d_phi_invm_US"), mass, ptTot, sph, mult); + if (doRotate) { + float theta = distRotate(rng); + // rotate first daughter's transverse momentum + float px1 = mom1[0]; + float py1 = mom1[1]; + float px1r = px1 * std::cos(theta) - py1 * std::sin(theta); + float py1r = px1 * std::sin(theta) + py1 * std::cos(theta); + std::array mom1r{px1r, py1r, mom1[2]}; + auto momTotR = RecoDecay::pVec(mom1r, mom2); + double massR = RecoDecay::m(std::array{mom1r, mom2}, std::array{MassKaonCharged, MassKaonCharged}); + double rapR = RecoDecay::y(momTotR, massR); + double ptR = RecoDecay::pt(momTotR); + if (std::abs(rapR) < kRapidityCut) { + histos.fill(HIST("Analysis/h1d_phi_invm_rot"), massR); + histos.fill(HIST("Analysis/h4d_phi_invm_rot"), massR, ptR, sph, mult); + } + } + } else { + if (trkK1.sign() == 1) { + histos.fill(HIST("Analysis/h1d_phi_invm_PP"), mass); + histos.fill(HIST("Analysis/h4d_phi_invm_PP"), mass, ptTot, sph, mult); + } else { + histos.fill(HIST("Analysis/h1d_phi_invm_MM"), mass); + histos.fill(HIST("Analysis/h4d_phi_invm_MM"), mass, ptTot, sph, mult); + } + } + } + + if constexpr (mix) { + if (trkK1.sign() * trkK2.sign() < 0) { + histos.fill(HIST("Analysis/h1d_phi_invm_US_mix"), mass); + histos.fill(HIST("Analysis/h4d_phi_invm_US_mix"), mass, ptTot, sph, mult); + } else { + histos.fill(HIST("Analysis/h1d_phi_invm_LS_mix"), mass); + histos.fill(HIST("Analysis/h4d_phi_invm_LS_mix"), mass, ptTot, sph, mult); + } + } + + if constexpr (mc) { + if (std::abs(trkK1.pdgCode()) != static_cast(PDG_t::kKPlus) || std::abs(trkK2.pdgCode()) != static_cast(PDG_t::kKPlus)) + continue; + + if (trkK1.motherId() != trkK2.motherId()) + continue; + + if (std::abs(trkK1.motherPDG()) != static_cast(Pdg::kPhi)) // phi pdg + continue; + + // MC histograms + histos.fill(HIST("Analysis/h1d_rec_phi"), ptTot); + histos.fill(HIST("Analysis/h1d_rec_invm_phi"), mass); + } + } + } + + using ResoCols = soa::Join; + using ResoTracks = aod::ResoTracks; + + void processData(ResoCols::iterator const& collision, ResoTracks const& tracks) + { + histos.fill(HIST("Event/h1d_ft0m_mult_percentile"), collision.cent()); + histos.fill(HIST("Event/h1d_spherocity"), collision.spherocity()); + histos.fill(HIST("Event/h2d_sph_vs_multpercentile"), collision.cent(), collision.spherocity()); + + // QA per track + for (auto const& track : tracks) { + if (!selTracks(track)) + continue; + fillQAHistos(track); + } + + // get invariant mass histograms + fillInvMassHistos(tracks, tracks, collision.spherocity(), collision.cent()); + } + + PROCESS_SWITCH(Phi1020SpherocityAnalysis, processData, "Process for Same Event Data", true); + + void processMC(ResoCols::iterator const& collision, + soa::Join const& tracks) + { + histos.fill(HIST("Event/h1d_rec_sph"), collision.spherocity()); + + // get MC reco pT-spectra and QA + for (auto const& track : tracks) { + if (!selTracks(track)) + continue; + fillQAHistos(track); + } + + // get invariant mass histograms + fillInvMassHistos(tracks, tracks, collision.spherocity(), collision.cent()); + } + PROCESS_SWITCH(Phi1020SpherocityAnalysis, processMC, "Process Event for MC", false); + + void processMCTrue(aod::ResoMCParents const& resoParents) + { + for (auto const& part : resoParents) { + if (std::abs(part.pdgCode()) != static_cast(Pdg::kPhi)) // phi pdg + continue; + if (std::abs(part.y()) > kRapidityCut) + continue; + + bool passKa1 = false; + bool passKa2 = false; + if (std::abs(part.daughterPDG1()) == static_cast(PDG_t::kKPlus) || std::abs(part.daughterPDG2()) == static_cast(PDG_t::kKPlus)) + passKa1 = true; + if (std::abs(part.daughterPDG1()) == static_cast(PDG_t::kKPlus) || std::abs(part.daughterPDG2()) == static_cast(PDG_t::kKPlus)) + passKa2 = true; + + if (!passKa1 || !passKa2) + continue; + + histos.fill(HIST("Analysis/h1d_gen_phi"), part.pt()); + } + } + PROCESS_SWITCH(Phi1020SpherocityAnalysis, processMCTrue, "Process Event for MC", false); + + void processMCTrueDaughters(aod::McCollisions::iterator const& McCollision, aod::McParticles const& McParts) + { + // IP range selection + if (std::abs(McCollision.posZ()) > kMaxMcPosZ) + return; + + histos.fill(HIST("MCTruth/h1d_gen_posZ"), McCollision.posZ()); + + for (auto const& part : McParts) { + // kinematic acceptance of particles + if (part.pt() < ptMin || std::abs(part.eta()) > etaCut || !part.isPhysicalPrimary()) + continue; + + histos.fill(HIST("MCTruth/h1d_ch_gen_phi"), part.phi()); + + if (std::abs(part.pdgCode()) == static_cast(PDG_t::kKPlus)) { + histos.fill(HIST("MCTruth/h1d_ka_gen_eta"), part.eta()); + histos.fill(HIST("QAChecks/h1d_ka_gen_pt"), part.pt()); + } + } + } + PROCESS_SWITCH(Phi1020SpherocityAnalysis, processMCTrueDaughters, "Process Event for MC truth of kaons", false); + + // Processing Event Mixing + using BinningType1 = ColumnBinningPolicy; + using BinningType2 = ColumnBinningPolicy; + void processMix(ResoCols const& collisions, ResoTracks const& tracks) + { + LOGF(debug, "Event Mixing Started"); + BinningType1 binningPositions1{{mixVtxBins, mixMultBins, mixSphBins}, true}; + BinningType2 binningPositions2{{mixVtxBins, mixMultBins}, true}; + auto tracksTuple = std::make_tuple(tracks); + if (mixSph) { + SameKindPair pairs{binningPositions1, numMixEv, -1, collisions, tracksTuple, &cache}; + for (auto const& item : pairs) { + auto const& c1 = std::get<0>(item); + auto const& t1 = std::get<1>(item); + auto const& t2 = std::get<3>(item); + fillInvMassHistos(t1, t2, c1.spherocity(), c1.cent()); + } + } else { + SameKindPair pairs{binningPositions2, numMixEv, -1, collisions, tracksTuple, &cache}; + for (auto const& item : pairs) { + auto const& c1 = std::get<0>(item); + auto const& t1 = std::get<1>(item); + auto const& t2 = std::get<3>(item); + fillInvMassHistos(t1, t2, c1.spherocity(), c1.cent()); + } + } + } + PROCESS_SWITCH(Phi1020SpherocityAnalysis, processMix, "Process for Mixed Events", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From fa9b8b4c6a1ef130a8c7dafd5087766c890cbf58 Mon Sep 17 00:00:00 2001 From: ynishida-style Date: Wed, 15 Oct 2025 04:12:11 +0200 Subject: [PATCH 754/986] [PWGJE] add new histograms to calculate tof matching efficiency (#13379) --- PWGJE/Tasks/jetShape.cxx | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/PWGJE/Tasks/jetShape.cxx b/PWGJE/Tasks/jetShape.cxx index a2d0f54b779..8aa1614be08 100644 --- a/PWGJE/Tasks/jetShape.cxx +++ b/PWGJE/Tasks/jetShape.cxx @@ -100,13 +100,16 @@ struct JetShapeTask { {"event/vertexz", ";Vtx_{z} (cm);Entries", {HistType::kTH1F, {{100, -20, 20}}}}, {"eventCounter", "eventCounter", {HistType::kTH1F, {{1, 0, +1, ""}}}}, {"ptVsCentrality", "ptvscentrality", {HistType::kTH2F, {{100, 0, 100}, {300, 0, 300}}}}, - {"ptResolution", "ptResolution", {HistType::kTH2F, {{50, 0, ptMax}, {100, -1.0, +1.0}}}}, - {"ptHistogramPion", "ptHistogramPion", {HistType::kTH1F, {{50, 0, ptMax}}}}, - {"ptHistogramKaon", "ptHistogramKaon", {HistType::kTH1F, {{50, 0, ptMax}}}}, - {"ptHistogramProton", "ptHistogramProton", {HistType::kTH1F, {{50, 0, ptMax}}}}, - {"ptGeneratedPion", "ptGeneratedPion", {HistType::kTH1F, {{50, 0, ptMax}}}}, - {"ptGeneratedKaon", "ptGeneratedKaon", {HistType::kTH1F, {{50, 0, ptMax}}}}, - {"ptGeneratedProton", "ptGeneratedProton", {HistType::kTH1F, {{50, 0, ptMax}}}}}}; + {"ptResolution", "ptResolution", {HistType::kTH2F, {{nBinsPt, 0, ptMax}, {100, -1.0, +1.0}}}}, + {"ptHistogramPion", "ptHistogramPion", {HistType::kTH1F, {{nBinsPt, 0, ptMax}}}}, + {"ptHistogramKaon", "ptHistogramKaon", {HistType::kTH1F, {{nBinsPt, 0, ptMax}}}}, + {"ptHistogramProton", "ptHistogramProton", {HistType::kTH1F, {{nBinsPt, 0, ptMax}}}}, + {"ptHistogramPionTof", "ptHistogramPionTof", {HistType::kTH1F, {{nBinsPt, 0, ptMax}}}}, + {"ptHistogramKaonTof", "ptHistogramKaonTof", {HistType::kTH1F, {{nBinsPt, 0, ptMax}}}}, + {"ptHistogramProtonTof", "ptHistogramProtonTof", {HistType::kTH1F, {{nBinsPt, 0, ptMax}}}}, + {"ptGeneratedPion", "ptGeneratedPion", {HistType::kTH1F, {{nBinsPt, 0, ptMax}}}}, + {"ptGeneratedKaon", "ptGeneratedKaon", {HistType::kTH1F, {{nBinsPt, 0, ptMax}}}}, + {"ptGeneratedProton", "ptGeneratedProton", {HistType::kTH1F, {{nBinsPt, 0, ptMax}}}}}}; Configurable vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"}; @@ -413,6 +416,17 @@ struct JetShapeTask { if (std::abs(mcParticle.pdgCode()) == PDG_t::kProton) registry.fill(HIST("ptHistogramProton"), mcParticle.pt()); } + + if (track.hasTOF()) { + if (mcParticle.isPhysicalPrimary() && std::fabs(mcParticle.y()) < mcRapidityMax) { + if (std::abs(mcParticle.pdgCode()) == PDG_t::kPiPlus) + registry.fill(HIST("ptHistogramPionTof"), mcParticle.pt()); + if (std::abs(mcParticle.pdgCode()) == PDG_t::kKPlus) + registry.fill(HIST("ptHistogramKaonTof"), mcParticle.pt()); + if (std::abs(mcParticle.pdgCode()) == PDG_t::kProton) + registry.fill(HIST("ptHistogramProtonTof"), mcParticle.pt()); + } + } } } } From 551d6ff9a1126259e75a67bb8f7e872298c14722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jura=C4=8Dka?= <137087737+jjuracka@users.noreply.github.com> Date: Wed, 15 Oct 2025 07:15:08 +0200 Subject: [PATCH 755/986] [PWGUD] updates to upcRhoAnalysis.cxx (#13375) Co-authored-by: ALICE Action Bot --- PWGUD/Tasks/upcRhoAnalysis.cxx | 172 ++++++++++++++++++++++----------- 1 file changed, 114 insertions(+), 58 deletions(-) diff --git a/PWGUD/Tasks/upcRhoAnalysis.cxx b/PWGUD/Tasks/upcRhoAnalysis.cxx index 244096b0a1b..247cdc27d2e 100644 --- a/PWGUD/Tasks/upcRhoAnalysis.cxx +++ b/PWGUD/Tasks/upcRhoAnalysis.cxx @@ -122,7 +122,9 @@ struct UpcRhoAnalysis { SGSelector sgSelector; - float pcEtaCut = 0.9; // physics coordination recommendation + const float pcEtaCut = 0.9; // physics coordination recommendation + const std::vector runNumbers = {544013, 544028, 544032, 544091, 544095, 544098, 544116, 544121, 544122, 544123, 544124, 544184, 544185, 544389, 544390, 544391, 544392, 544451, 544454, 544474, 544475, 544476, 544477, 544490, 544491, 544492, 544508, 544510, 544511, 544512, 544514, 544515, 544518, 544548, 544549, 544550, 544551, 544564, 544565, 544567, 544568, 544580, 544582, 544583, 544585, 544614, 544640, 544652, 544653, 544672, 544674, 544692, 544693, 544694, 544696, 544739, 544742, 544754, 544767, 544794, 544795, 544797, 544813, 544868, 544886, 544887, 544896, 544911, 544913, 544914, 544917, 544931, 544947, 544961, 544963, 544964, 544968, 544991, 544992, 545004, 545008, 545009, 545041, 545042, 545044, 545047, 545060, 545062, 545063, 545064, 545066, 545086, 545103, 545117, 545171, 545184, 545185, 545210, 545222, 545223, 545246, 545249, 545262, 545289, 545291, 545294, 545295, 545296, 545311, 545312, 545332, 545345, 545367}; + AxisSpec runNumberAxis = {static_cast(runNumbers.size()), 0.5, static_cast(runNumbers.size()) + 0.5, "run number"}; Configurable numPions{"numPions", 2, "required number of pions in the event"}; @@ -141,6 +143,9 @@ struct UpcRhoAnalysis { Configurable useRctFlag{"useRctFlag", false, "use RCT flags for event selection"}; Configurable cutRctFlag{"cutRctFlag", 0, "0 = off, 1 = CBT, 2 = CBT+ZDC, 3 = CBThadron, 4 = CBThadron+ZDC"}; + Configurable selectRuns{"selectRuns", false, "select runs from the list"}; + Configurable> selectedRuns{"selectedRuns", {544013, 544028, 544032, 544091, 544095, 544098, 544116, 544121, 544122, 544123, 544124, 544184, 544185, 544389, 544390, 544391, 544392, 544451, 544454, 544474, 544475, 544476, 544477, 544490, 544491, 544492, 544508, 544510, 544511, 544512, 544514, 544515, 544518, 544548, 544549, 544550, 544551, 544564, 544565, 544567, 544568, 544580, 544582, 544583, 544585, 544614, 544640, 544652, 544653, 544672, 544674, 544692, 544693, 544694, 544696, 544739, 544742, 544754, 544767, 544794, 544795, 544797, 544813, 544868, 544886, 544887, 544896, 544913, 544914, 544917, 544931, 544947, 544961, 544963, 544964, 544968, 544992, 545009, 545044, 545047, 545063, 545064, 545066, 545185, 545210, 545223, 545249, 545291, 545294, 545295, 545296, 545312}, "list of selected runs"}; + Configurable collisionsPosZMaxCut{"collisionsPosZMaxCut", 10.0, "max Z position cut on collisions"}; Configurable cutNumContribs{"cutNumContribs", true, "cut on number of contributors"}; Configurable collisionsNumContribsMaxCut{"collisionsNumContribsMaxCut", 2, "max number of contributors cut on collisions"}; @@ -148,6 +153,7 @@ struct UpcRhoAnalysis { Configurable znTimeCut{"znTimeCut", 2.0, "ZN time cut"}; Configurable tracksTpcNSigmaPiCut{"tracksTpcNSigmaPiCut", 3.0, "TPC nSigma pion cut"}; + Configurable rejectLowerProbPairs{"rejectLowerProbPairs", false, "reject track pairs with lower El or Ka PID radii"}; Configurable tracksDcaMaxCut{"tracksDcaMaxCut", 1.0, "max DCA cut on tracks"}; Configurable tracksMinItsNClsCut{"tracksMinItsNClsCut", 4, "min ITS clusters cut"}; Configurable tracksMaxItsChi2NClCut{"tracksMaxItsChi2NClCut", 3.0, "max ITS chi2/Ncls cut"}; @@ -172,7 +178,6 @@ struct UpcRhoAnalysis { ConfigurableAxis deltaPhiAxis{"deltaPhiAxis", {182, -o2::constants::math::PI, o2::constants::math::PI}, "#Delta#it{#phi} (rad)"}; ConfigurableAxis znCommonEnergyAxis{"znCommonEnergyAxis", {250, -5.0, 20.0}, "ZN common energy (TeV)"}; ConfigurableAxis znTimeAxis{"znTimeAxis", {200, -10.0, 10.0}, "ZN time (ns)"}; - ConfigurableAxis runNumberAxis{"runNumberAxis", {1355, 544012.5, 545367.5}, "run number"}; ConfigurableAxis nSigmaAxis{"nSigmaAxis", {600, -30.0, 30.0}, "TPC #it{n#sigma}"}; HistogramRegistry rQC{"rQC", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -237,11 +242,18 @@ struct UpcRhoAnalysis { rQC.get(HIST("QC/tracks/hSelectionCounter"))->GetXaxis()->SetBinLabel(i + 1, selectionCounterLabels[i].c_str()); rQC.get(HIST("QC/tracks/hSelectionCounterPerRun"))->GetXaxis()->SetBinLabel(i + 1, selectionCounterLabels[i].c_str()); } + for (int i = 0; i < static_cast(runNumbers.size()); ++i) { + rQC.get(HIST("QC/tracks/hSelectionCounterPerRun"))->GetYaxis()->SetBinLabel(i + 1, std::to_string(runNumbers[i]).c_str()); + } rQC.add("QC/tracks/hTofHitCheck", ";leading track TOF hit;subleading track TOF hit;counts", kTH2D, {{2, -0.5, 1.5}, {2, -0.5, 1.5}}); rQC.get(HIST("QC/tracks/hTofHitCheck"))->GetXaxis()->SetBinLabel(1, "no hit"); rQC.get(HIST("QC/tracks/hTofHitCheck"))->GetXaxis()->SetBinLabel(2, "hit"); rQC.get(HIST("QC/tracks/hTofHitCheck"))->GetYaxis()->SetBinLabel(1, "no hit"); rQC.get(HIST("QC/tracks/hTofHitCheck"))->GetYaxis()->SetBinLabel(2, "hit"); + // PID "radii" plots + rQC.add("QC/tracks/hPiPIDRadius", ";#it{n#sigma}(#pi) radius;counts", kTH1D, {{1000, 0.0, 10.0}}); + rQC.add("QC/tracks/hElPIDRadius", ";#it{n#sigma}(e) radius;counts", kTH1D, {{1000, 0.0, 10.0}}); + rQC.add("QC/tracks/hKaPIDRadius", ";#it{n#sigma}(K) radius;counts", kTH1D, {{1000, 0.0, 10.0}}); // TRACKS (2D) rTracks.add("tracks/trackSelections/unlike-sign/hPt", ";#it{p}_{T leading} (GeV/#it{c});#it{p}_{T subleading} (GeV/#it{c});counts", kTH2D, {ptAxis, ptAxis}); @@ -253,6 +265,7 @@ struct UpcRhoAnalysis { // SYSTEM rSystem.add("system/all/unlike-sign/hM", ";#it{m} (GeV/#it{c}^{2});counts", kTH1D, {mAxis}); + rSystem.add("system/all/unlike-sign/hRecoSettingVsM", ";#it{m} (GeV/#it{c}^{2});reco setting;counts", kTH2D, {mAxis, {2, -0.5, 1.5}}); rSystem.add("system/all/unlike-sign/hPt", ";#it{p}_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); rSystem.add("system/all/unlike-sign/hPt2", ";#it{p}_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); rSystem.add("system/all/unlike-sign/hPtVsM", ";#it{m} (GeV/#it{c}^{2});#it{p}_{T} (GeV/#it{c});counts", kTH2D, {mAxis, ptAxis}); @@ -279,17 +292,23 @@ struct UpcRhoAnalysis { rMC.add("MC/collisions/hPosZ", ";vertex #it{z} (cm);counts", kTH1D, {{400, -20.0, 20.0}}); rMC.add("MC/collisions/hNPions", ";number of pions;counts", kTH1D, {{11, -0.5, 10.5}}); rMC.add("MC/collisions/hNumOfCollisionRecos", ";number of collision reconstructions;counts", kTH1D, {{6, -0.5, 5.5}}); - rMC.add("MC/collisions/hRunNumberVsNumOfCollisionRecos", ";number of collision reconstructions;run number;counts", kTH2D, {{6, -0.5, 5.5}, runNumberAxis}); // tracks rMC.add("MC/tracks/all/hPdgCode", ";pdg code;counts", kTH1D, {{2001, -1000.5, 1000.5}}); + rMC.add("MC/tracks/all/hMotherPdgCode", ";mother pdg code;counts", kTH1D, {{2001, -1000.5, 1000.5}}); rMC.add("MC/tracks/all/hProducedByGenerator", ";produced by generator;counts", kTH1D, {{2, -0.5, 1.5}}); rMC.add("MC/tracks/all/hIsPhysicalPrimary", ";is physical primary;counts", kTH1D, {{2, -0.5, 1.5}}); rMC.add("MC/tracks/all/hPt", ";#it{p}_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); rMC.add("MC/tracks/all/hEta", ";#it{#eta};counts", kTH1D, {etaAxis}); rMC.add("MC/tracks/all/hPhi", ";#it{#phi};counts", kTH1D, {phiAxis}); + rMC.addClone("MC/tracks/all/", "MC/tracks/primaries/"); + rMC.addClone("MC/tracks/all/", "MC/tracks/prodByGen/"); rMC.add("MC/tracks/hPt", ";#it{p}_{T leading} (GeV/#it{c});#it{p}_{T subleading} (GeV/#it{c});counts", kTH2D, {ptAxis, ptAxis}); rMC.add("MC/tracks/hEta", ";#it{#eta}_{leading};#it{#eta}_{subleading};counts", kTH2D, {etaAxis, etaAxis}); rMC.add("MC/tracks/hPhi", ";#it{#phi}_{leading};#it{#phi}_{subleading};counts", kTH2D, {phiAxis, phiAxis}); + // resolution + rMC.add("MC/resolution/tracks/hPt", ";#it{p}_{T, reco} - #it{p}_{T, true} (GeV/#it{c});counts", kTH1D, {{200, -1.0, 1.0}}); + rMC.add("MC/resolution/tracks/hEta", ";#it{#eta}_{reco} - #it{#eta}_{true};counts", kTH1D, {{200, -0.2, 0.2}}); + rMC.add("MC/resolution/tracks/hPhi", ";#it{#phi}_{reco} - #it{#phi}_{true} (rad);counts", kTH1D, {{200, -0.2, 0.2}}); // system rMC.add("MC/system/hM", ";#it{m} (GeV/#it{c}^{2});counts", kTH1D, {mAxis}); rMC.add("MC/system/hPt", ";#it{p}_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); @@ -304,10 +323,6 @@ struct UpcRhoAnalysis { rMC.addClone("MC/system/", "MC/system/selected/"); } - std::unordered_set goldenRuns = {544491, 544474, 544123, 544098, 544121, 544389, 544032, 544454, 544122, - 544510, 544476, 544091, 544095, 544490, 544124, 544508, 544391, 544013, - 544390, 544184, 544451, 544116, 544185, 544492, 544475, 544392, 544477, 544028}; - static constexpr std::string_view AppliedSelections[3] = {"all/", "trackSelections/", "systemSelections/"}; static constexpr std::string_view ChargeLabel[3] = {"unlike-sign/", "like-sign/positive/", "like-sign/negative/"}; static constexpr std::string_view NeutronClass[5] = {"no-selection/", "0n0n/", "Xn0n/", "0nXn/", "XnXn/"}; @@ -441,89 +456,98 @@ struct UpcRhoAnalysis { return true; } - template - bool trackPassesCuts(const T& track, const C& collision) // track cuts (PID done separately) + template + bool trackPassesCuts(const T& track, int runIndex) // track cuts (PID done separately) { if (!track.isPVContributor()) return false; rQC.fill(HIST("QC/tracks/hSelectionCounter"), 1); - rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 1, collision.runNumber()); + rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 1, runIndex); if (!track.hasITS()) return false; rQC.fill(HIST("QC/tracks/hSelectionCounter"), 2); - rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 2, collision.runNumber()); + rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 2, runIndex); if (track.itsNCls() < tracksMinItsNClsCut) return false; rQC.fill(HIST("QC/tracks/hSelectionCounter"), 3); - rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 3, collision.runNumber()); + rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 3, runIndex); if (!cutItsLayers(track.itsClusterMap())) return false; rQC.fill(HIST("QC/tracks/hSelectionCounter"), 4); - rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 4, collision.runNumber()); + rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 4, runIndex); if (track.itsChi2NCl() > tracksMaxItsChi2NClCut) return false; rQC.fill(HIST("QC/tracks/hSelectionCounter"), 5); - rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 5, collision.runNumber()); + rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 5, runIndex); if (!track.hasTPC()) return false; rQC.fill(HIST("QC/tracks/hSelectionCounter"), 6); - rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 6, collision.runNumber()); + rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 6, runIndex); if ((track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()) < tracksMinTpcNClsCut) return false; rQC.fill(HIST("QC/tracks/hSelectionCounter"), 7); - rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 7, collision.runNumber()); + rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 7, runIndex); if (track.tpcChi2NCl() > tracksMaxTpcChi2NClCut || track.tpcChi2NCl() < tracksMinTpcChi2NClCut) return false; rQC.fill(HIST("QC/tracks/hSelectionCounter"), 8); - rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 8, collision.runNumber()); + rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 8, runIndex); if (track.tpcNClsCrossedRows() < tracksMinTpcNClsCrossedRowsCut) return false; rQC.fill(HIST("QC/tracks/hSelectionCounter"), 9); - rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 9, collision.runNumber()); + rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 9, runIndex); if ((static_cast(track.tpcNClsCrossedRows()) / static_cast(track.tpcNClsFindable())) < tracksMinTpcNClsCrossedOverFindableCut) return false; rQC.fill(HIST("QC/tracks/hSelectionCounter"), 10); - rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 10, collision.runNumber()); + rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 10, runIndex); if (requireTof && !track.hasTOF()) return false; rQC.fill(HIST("QC/tracks/hSelectionCounter"), 11); - rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 11, collision.runNumber()); + rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 11, runIndex); if (track.pt() < tracksMinPtCut) return false; rQC.fill(HIST("QC/tracks/hSelectionCounter"), 12); - rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 12, collision.runNumber()); + rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 12, runIndex); if (std::abs(track.dcaZ()) > tracksDcaMaxCut || std::abs(track.dcaXY()) > (0.0105 + 0.0350 / std::pow(track.pt(), 1.01))) return false; rQC.fill(HIST("QC/tracks/hSelectionCounter"), 13); - rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 13, collision.runNumber()); + rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 13, runIndex); if (std::abs(eta(track.px(), track.py(), track.pz())) > pcEtaCut) return false; rQC.fill(HIST("QC/tracks/hSelectionCounter"), 14); - rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 14, collision.runNumber()); + rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 14, runIndex); // if all selections passed return true; } template - bool tracksPassPiPID(const T& cutTracks) // n-dimensional pion PID cut + bool tracksPassPID(const T& cutTracks) // n-dimensional pion PID cut { - float radius = 0.0; - for (const auto& track : cutTracks) - radius += std::pow(track.tpcNSigmaPi(), 2); - return radius < std::pow(tracksTpcNSigmaPiCut, 2); + float radiusPi = 0.0, radiusEl = 0.0, radiusKa = 0.0; + for (const auto& track : cutTracks) { + radiusEl += std::pow(track.tpcNSigmaEl(), 2); + radiusKa += std::pow(track.tpcNSigmaKa(), 2); + radiusPi += std::pow(track.tpcNSigmaPi(), 2); + } + rQC.fill(HIST("QC/tracks/hPiPIDRadius"), std::sqrt(radiusPi)); + rQC.fill(HIST("QC/tracks/hElPIDRadius"), std::sqrt(radiusEl)); + rQC.fill(HIST("QC/tracks/hKaPIDRadius"), std::sqrt(radiusKa)); + if (rejectLowerProbPairs) + return ((radiusPi < std::pow(tracksTpcNSigmaPiCut, 2)) && (radiusPi < radiusEl) && (radiusPi < radiusKa)); + else + return radiusPi < std::pow(tracksTpcNSigmaPiCut, 2); } template @@ -540,7 +564,7 @@ struct UpcRhoAnalysis { { int charge = 0; for (const auto& track : cutTracks) - charge += track.pdgCode(); + charge += track.pdgCode() / std::abs(track.pdgCode()); return charge; } @@ -576,41 +600,50 @@ struct UpcRhoAnalysis { unsigned seed = std::chrono::system_clock::now().time_since_epoch().count(); // get time-based seed std::shuffle(std::begin(indices), std::end(indices), std::default_random_engine(seed)); // shuffle indices // calculate phi - ROOT::Math::PxPyPzMVector pOne = cutTracksLVs[indices[0]]; - ROOT::Math::PxPyPzMVector pTwo = cutTracksLVs[indices[1]]; - ROOT::Math::PxPyPzMVector pPlus = pOne + pTwo; - ROOT::Math::PxPyPzMVector pMinus = pOne - pTwo; + ROOT::Math::PxPyPzMVector p1 = cutTracksLVs[indices[0]], p2 = cutTracksLVs[indices[1]]; + ROOT::Math::PxPyPzMVector pPlus = p1 + p2, pMinus = p1 - p2; return deltaPhi(pPlus, pMinus); } template float getPhiCharge(const T& cutTracks, const std::vector& cutTracksLVs) { // two possible definitions of phi: charge-based assignment - ROOT::Math::PxPyPzMVector pOne, pTwo; - pOne = (cutTracks[0].sign() > 0) ? cutTracksLVs[0] : cutTracksLVs[1]; - pTwo = (cutTracks[0].sign() > 0) ? cutTracksLVs[1] : cutTracksLVs[0]; - ROOT::Math::PxPyPzMVector pPlus = pOne + pTwo; - ROOT::Math::PxPyPzMVector pMinus = pOne - pTwo; + ROOT::Math::PxPyPzMVector p1, p2; + p1 = (cutTracks[0].sign() > 0) ? cutTracksLVs[0] : cutTracksLVs[1]; + p2 = (cutTracks[0].sign() > 0) ? cutTracksLVs[1] : cutTracksLVs[0]; + ROOT::Math::PxPyPzMVector pPlus = p1 + p2, pMinus = p1 - p2; return deltaPhi(pPlus, pMinus); } template float getPhiChargeMC(const T& cutTracks, const std::vector& cutTracksLVs) { // the same as for data but using pdg code instead of charge - ROOT::Math::PxPyPzMVector pOne, pTwo; - pOne = (cutTracks[0].pdgCode() > 0) ? cutTracksLVs[0] : cutTracksLVs[1]; - pTwo = (cutTracks[0].pdgCode() > 0) ? cutTracksLVs[1] : cutTracksLVs[0]; - ROOT::Math::PxPyPzMVector pPlus = pOne + pTwo; - ROOT::Math::PxPyPzMVector pMinus = pOne - pTwo; + ROOT::Math::PxPyPzMVector p1, p2; + p1 = (cutTracks[0].pdgCode() > 0) ? cutTracksLVs[0] : cutTracksLVs[1]; + p2 = (cutTracks[0].pdgCode() > 0) ? cutTracksLVs[1] : cutTracksLVs[0]; + ROOT::Math::PxPyPzMVector pPlus = p1 + p2, pMinus = p1 - p2; return deltaPhi(pPlus, pMinus); } + // function to obtain index of run from the run number vector + // search for passed run number in the vector and return its index +1 to use in the filling of a histogram + int getRunIndex(int runNumber, const std::vector& runNumbers) + { + auto it = std::find(runNumbers.begin(), runNumbers.end(), runNumber); + if (it != runNumbers.end()) { + return std::distance(runNumbers.begin(), it) + 1; // +1 to avoid 0 bin in histogram + } else { + return 0; // return 0 if run number not found + } + } + template void processReco(C const& collision, T const& tracks) { - // check if the collision run number is contained within the goldenRuns set - if (onlyGoldenRuns && !goldenRuns.contains(collision.runNumber())) + // check if the collision run number is contained within the selectedRuns vector + if (selectRuns && getRunIndex(collision.runNumber(), selectedRuns) == 0) return; + int runIndex = getRunIndex(collision.runNumber(), runNumbers); fillCollisionQcHistos<0>(collision); // fill QC histograms before cuts if (!collisionPassesCuts(collision)) @@ -650,10 +683,10 @@ struct UpcRhoAnalysis { std::vector cutTracks; // store selected tracks for (const auto& track : tracks) { rQC.fill(HIST("QC/tracks/hSelectionCounter"), 0); - rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 0, collision.runNumber()); + rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 0, runIndex); fillTrackQcHistos<0>(track); // fill QC histograms before cuts - if (!trackPassesCuts(track, collision)) // apply track cuts + if (!trackPassesCuts(track, runIndex)) // apply track cuts continue; cutTracks.push_back(track); } @@ -663,7 +696,7 @@ struct UpcRhoAnalysis { return; for (int i = 0; i < numPions; i++) { rQC.fill(HIST("QC/tracks/hSelectionCounter"), 15); - rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 15, collision.runNumber()); + rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 15, runIndex); } rQC.fill(HIST("QC/tracks/trackSelections/hTpcNSigmaPi2D"), cutTracks[0].tpcNSigmaPi(), cutTracks[1].tpcNSigmaPi()); rQC.fill(HIST("QC/tracks/trackSelections/hTpcNSigmaEl2D"), cutTracks[0].tpcNSigmaEl(), cutTracks[1].tpcNSigmaEl()); @@ -709,12 +742,12 @@ struct UpcRhoAnalysis { energyCommonZNA, energyCommonZNC, timeZNA, timeZNC, neutronClass, phiRandom, phiCharge, trackSigns, trackPts, trackEtas, trackPhis, trackPiPIDs, trackElPIDs, trackKaPIDs, trackDcaXYs, trackDcaZs, trackTpcSignals); - if (!tracksPassPiPID(cutTracks)) // apply PID cut + if (!tracksPassPID(cutTracks)) // apply PID cut return; for (const auto& cutTrack : cutTracks) { rQC.fill(HIST("QC/tracks/hSelectionCounter"), 16); - rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 16, collision.runNumber()); + rQC.fill(HIST("QC/tracks/hSelectionCounterPerRun"), 16, runIndex); fillTrackQcHistos<1>(cutTrack); // fill QC histograms after cuts } rQC.fill(HIST("QC/tracks/hTofHitCheck"), leadingMomentumTrack.hasTOF(), subleadingMomentumTrack.hasTOF()); @@ -732,6 +765,7 @@ struct UpcRhoAnalysis { case 0: fillTrack2dHistos<1, 0>(leadingPt, subleadingPt, leadingEta, subleadingEta, leadingPhi, subleadingPhi); fillSystemHistos<0, 0, 0>(mass, pT, rapidity, systemPhi, phiRandom, phiCharge); + rSystem.fill(HIST("system/all/unlike-sign/hRecoSettingVsM"), mass, collision.flags()); break; case 2: @@ -817,18 +851,41 @@ struct UpcRhoAnalysis { rMC.fill(HIST("MC/tracks/all/hPt"), pt(mcParticle.px(), mcParticle.py())); rMC.fill(HIST("MC/tracks/all/hEta"), eta(mcParticle.px(), mcParticle.py(), mcParticle.pz())); rMC.fill(HIST("MC/tracks/all/hPhi"), phi(mcParticle.px(), mcParticle.py())); - if (!mcParticle.isPhysicalPrimary() || std::abs(mcParticle.pdgCode()) != kPiPlus) - continue; - cutMcParticles.push_back(mcParticle); - ROOT::Math::PxPyPzMVector pionLV; - pionLV.SetPxPyPzE(mcParticle.px(), mcParticle.py(), mcParticle.pz(), mcParticle.e()); - mcParticlesLVs.push_back(pionLV); + if (mcParticle.producedByGenerator()) { + rMC.fill(HIST("MC/tracks/prodByGen/hPdgCode"), mcParticle.pdgCode()); + rMC.fill(HIST("MC/tracks/prodByGen/hProducedByGenerator"), mcParticle.producedByGenerator()); + rMC.fill(HIST("MC/tracks/prodByGen/hIsPhysicalPrimary"), mcParticle.isPhysicalPrimary()); + rMC.fill(HIST("MC/tracks/prodByGen/hPt"), pt(mcParticle.px(), mcParticle.py())); + rMC.fill(HIST("MC/tracks/prodByGen/hEta"), eta(mcParticle.px(), mcParticle.py(), mcParticle.pz())); + rMC.fill(HIST("MC/tracks/prodByGen/hPhi"), phi(mcParticle.px(), mcParticle.py())); + } + if (mcParticle.isPhysicalPrimary()) { + rMC.fill(HIST("MC/tracks/primaries/hPdgCode"), mcParticle.pdgCode()); + rMC.fill(HIST("MC/tracks/primaries/hProducedByGenerator"), mcParticle.producedByGenerator()); + rMC.fill(HIST("MC/tracks/primaries/hIsPhysicalPrimary"), mcParticle.isPhysicalPrimary()); + rMC.fill(HIST("MC/tracks/primaries/hPt"), pt(mcParticle.px(), mcParticle.py())); + rMC.fill(HIST("MC/tracks/primaries/hEta"), eta(mcParticle.px(), mcParticle.py(), mcParticle.pz())); + rMC.fill(HIST("MC/tracks/primaries/hPhi"), phi(mcParticle.px(), mcParticle.py())); + } + if (mcParticle.has_daughters()) { + rMC.fill(HIST("MC/tracks/all/hMotherPdgCode"), mcParticle.pdgCode()); + if (mcParticle.pdgCode() != kRho770_0) + continue; // consider only rho0s + for (const auto& daughter : mcParticle.template daughters_as()) { + if (!daughter.isPhysicalPrimary() || std::abs(daughter.pdgCode()) != kPiPlus) + continue; + cutMcParticles.push_back(daughter); + ROOT::Math::PxPyPzMVector pionLV; + pionLV.SetPxPyPzE(daughter.px(), daughter.py(), daughter.pz(), daughter.e()); + mcParticlesLVs.push_back(pionLV); + } + } } rMC.fill(HIST("MC/collisions/hNPions"), cutMcParticles.size()); if (static_cast(cutMcParticles.size()) != numPions) return; - if (mcParticlesLVs.size() != cutMcParticles.size()) + if (mcParticlesLVs.size() != cutMcParticles.size()) // sanity check return; if (tracksTotalChargeMC(cutMcParticles) != 0) // shouldn't happen in theory return; @@ -888,7 +945,6 @@ struct UpcRhoAnalysis { void checkNumberOfCollisionReconstructions(C const& collisions) { rMC.fill(HIST("MC/collisions/hNumOfCollisionRecos"), collisions.size()); - rMC.fill(HIST("MC/collisions/hRunNumberVsNumOfCollisionRecos"), collisions.size(), collisions.begin().runNumber()); } void processSGdata(FullUdSgCollision const& collision, FullUdTracks const& tracks) From 8961541bd5b90b8ead63d3d0facc14c5a8476525 Mon Sep 17 00:00:00 2001 From: Luca Aglietta <75362880+Luca610@users.noreply.github.com> Date: Wed, 15 Oct 2025 09:25:50 +0200 Subject: [PATCH 756/986] [PWGHF] Fixed MC matching of partly reconstructed resonances (#13380) --- PWGHF/D2H/DataModel/ReducedDataModel.h | 1 + .../candidateCreatorCharmResoReduced.cxx | 29 +++++------ .../dataCreatorCharmResoReduced.cxx | 50 ++++++++++++++++--- .../D2H/Tasks/taskCharmResoToDTrkReduced.cxx | 10 ++-- PWGHF/D2H/Tasks/taskCharmResoToDV0Reduced.cxx | 10 ++-- 5 files changed, 72 insertions(+), 28 deletions(-) diff --git a/PWGHF/D2H/DataModel/ReducedDataModel.h b/PWGHF/D2H/DataModel/ReducedDataModel.h index cb1c82afb41..f3fcbc188d1 100644 --- a/PWGHF/D2H/DataModel/ReducedDataModel.h +++ b/PWGHF/D2H/DataModel/ReducedDataModel.h @@ -1646,6 +1646,7 @@ DECLARE_SOA_TABLE(HfMcRecRedResos, "AOD", "HFMCRECREDRESO", //! Reconstruction-l hf_reso_cand_reduced::Origin, hf_reso_cand_reduced::PtGen, hf_reso_cand_reduced::InvMassGen, + hf_cand::NTracksDecayed, o2::soa::Marker<1>); } // namespace aod diff --git a/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx index 68e3f176736..46fd5998702 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx @@ -957,23 +957,24 @@ struct HfCandidateCreatorCharmResoReducedExpressions { { for (const auto& candReso : candsReso) { bool filledMcInfo{false}; - for (const auto& rowDV0McRec : rowsMcRec) { - if ((rowDV0McRec.prong0Id() != candReso.prong0Id()) || (rowDV0McRec.prong1Id() != candReso.prong1Id())) { + for (const auto& rowMcRec : rowsMcRec) { + if ((rowMcRec.prong0Id() != candReso.prong0Id()) || (rowMcRec.prong1Id() != candReso.prong1Id())) { continue; } - rowResoMcRec(rowDV0McRec.flagMcMatchRec(), - rowDV0McRec.flagMcMatchRecD(), - rowDV0McRec.flagMcMatchChanD(), - rowDV0McRec.debugMcRec(), - rowDV0McRec.origin(), - rowDV0McRec.ptGen(), - rowDV0McRec.invMassGen()); + rowResoMcRec(rowMcRec.flagMcMatchRec(), + rowMcRec.flagMcMatchRecD(), + rowMcRec.flagMcMatchChanD(), + rowMcRec.debugMcRec(), + rowMcRec.origin(), + rowMcRec.ptGen(), + rowMcRec.invMassGen(), + rowMcRec.nTracksDecayed()); filledMcInfo = true; - if (std::abs(rowDV0McRec.flagMcMatchRec()) > 0 && - !TESTBIT(rowDV0McRec.debugMcRec(), hf_decay::hf_cand_reso::PartialMatchMc::ResoPartlyMatched)) { + if (std::abs(rowMcRec.flagMcMatchRec()) > 0 && + !TESTBIT(rowMcRec.debugMcRec(), hf_decay::hf_cand_reso::PartialMatchMc::ResoPartlyMatched)) { registry.fill(HIST("hMassMcMatched"), candReso.invMass(), candReso.pt()); - } else if (std::abs(rowDV0McRec.flagMcMatchRec()) > 0 && - TESTBIT(rowDV0McRec.debugMcRec(), hf_decay::hf_cand_reso::PartialMatchMc::ResoPartlyMatched)) { + } else if (std::abs(rowMcRec.flagMcMatchRec()) > 0 && + TESTBIT(rowMcRec.debugMcRec(), hf_decay::hf_cand_reso::PartialMatchMc::ResoPartlyMatched)) { registry.fill(HIST("hMassMcMatchedIncomplete"), candReso.invMass(), candReso.pt()); } else { registry.fill(HIST("hMassMcUnmatched"), candReso.invMass(), candReso.pt()); @@ -981,7 +982,7 @@ struct HfCandidateCreatorCharmResoReducedExpressions { break; } if (!filledMcInfo) { // protection to get same size tables in case something went wrong: we created a candidate that was not preselected in the D-Pi creator - rowResoMcRec(0, 0, 0, 0, 0, -1.f, -1.f); + rowResoMcRec(0, 0, 0, 0, 0, -1.f, -1.f, 0); registry.fill(HIST("hMassMcNoEntry"), candReso.invMass(), candReso.pt()); } } diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx index 9cb426b3a31..5a0050914af 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx @@ -680,7 +680,7 @@ struct HfDataCreatorCharmResoReduced { std::array const pdgCodesDaughters = {+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}; auto arrDaughtersReso = std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2], vecDaughtersReso[3], vecDaughtersReso[4]}; for (const auto& [decayChannelFlag, pdgCodeReso] : hf_decay::hf_cand_reso::particlesToDstarK0s) { - indexRec = RecoDecay::getMatchedMCRec(particlesMc, arrDaughtersReso, pdgCodeReso, pdgCodesDaughters, true, &sign, 3, &nKinkedTracks); + indexRec = RecoDecay::getMatchedMCRec(particlesMc, arrDaughtersReso, pdgCodeReso, pdgCodesDaughters, true, &sign, 3, &nKinkedTracks); if (indexRec > -1) { flagReso = sign * decayChannelFlag; break; @@ -734,19 +734,31 @@ struct HfDataCreatorCharmResoReduced { auto pdgCodesDplusDaughters = hf_decay::hf_cand_3prong::daughtersDplusMain.at(static_cast(std::abs(flagCharmBach))); auto pdgCodesDaughters = std::array{pdgCodesDplusDaughters[0], pdgCodesDplusDaughters[1], pdgCodesDplusDaughters[2], +kPiPlus, -kPiPlus}; for (const auto& [decayChannelFlag, pdgCodeReso] : hf_decay::hf_cand_reso::particlesToDplusK0s) { - indexRec = RecoDecay::getMatchedMCRec(particlesMc, arrDaughtersReso, pdgCodeReso, pdgCodesDaughters, true, &sign, 3, &nKinkedTracks); + indexRec = RecoDecay::getMatchedMCRec(particlesMc, arrDaughtersReso, pdgCodeReso, pdgCodesDaughters, true, &sign, 3, &nKinkedTracks); if (indexRec > -1) { flagReso = sign * decayChannelFlag; break; } } + // Partial matching of Dsj -> D*K0s -> (D+ pi0) (K0s) with missing neutral + if (indexRec < 0) { + for (const auto& [decayChannelFlag, pdgCodeReso] : hf_decay::hf_cand_reso::particlesToDstarK0s) { + indexRec = RecoDecay::getMatchedMCRec(particlesMc, arrDaughtersReso, pdgCodeReso, pdgCodesDaughters, true, &sign, 3, &nKinkedTracks); + if (indexRec > -1) { + flagReso = sign * decayChannelFlag; + SETBIT(debugMcRec, hf_decay::hf_cand_reso::PartialMatchMc::ResoPartlyMatched); + break; + } + } + } + } else if (hf_decay::hf_cand_3prong::daughtersDplusMain.contains(static_cast(std::abs(flagCharmBach))) && std::abs(flagV0) == hf_decay::hf_cand_reso::PartialMatchMc::LambdaMatched) { // Peaking background of D+Lambda <- Ds* with spurious soft pion auto arrDaughtersReso = std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2], vecDaughtersReso[3], vecDaughtersReso[4]}; auto pdgCodesDplusDaughters = hf_decay::hf_cand_3prong::daughtersDplusMain.at(static_cast(std::abs(flagCharmBach))); auto pdgCodesDaughters = std::array{pdgCodesDplusDaughters[0], pdgCodesDplusDaughters[1], pdgCodesDplusDaughters[2], +kProton, -kPiPlus}; for (const auto& [decayChannelFlag, pdgCodeReso] : hf_decay::hf_cand_reso::particlesToDplusLambda) { - indexRec = RecoDecay::getMatchedMCRec(particlesMc, arrDaughtersReso, pdgCodeReso, pdgCodesDaughters, true, &sign, 3, &nKinkedTracks); + indexRec = RecoDecay::getMatchedMCRec(particlesMc, arrDaughtersReso, pdgCodeReso, pdgCodesDaughters, true, &sign, 3, &nKinkedTracks); if (indexRec > -1) { flagReso = sign * decayChannelFlag; break; @@ -787,7 +799,7 @@ struct HfDataCreatorCharmResoReduced { auto pdgCodesDzeroDaughters = hf_decay::hf_cand_2prong::daughtersD0Main.at(static_cast(std::abs(flagCharmBach))); auto pdgCodesDaughters = std::array{pdgCodesDzeroDaughters[0], pdgCodesDzeroDaughters[1], +kProton, -kPiPlus}; for (const auto& [decayChannelFlag, pdgCodeReso] : hf_decay::hf_cand_reso::particlesToD0Lambda) { - indexRec = RecoDecay::getMatchedMCRec(particlesMc, arrDaughtersReso, pdgCodeReso, pdgCodesDaughters, true, &sign, 3, &nKinkedTracks); + indexRec = RecoDecay::getMatchedMCRec(particlesMc, arrDaughtersReso, pdgCodeReso, pdgCodesDaughters, true, &sign, 3, &nKinkedTracks); if (indexRec > -1) { flagReso = sign * decayChannelFlag; break; @@ -878,7 +890,7 @@ struct HfDataCreatorCharmResoReduced { auto arrDaughtersReso = std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2], bachelorTrack}; auto pdgCodesDaughters = std::array{+kPiPlus, -kKPlus, +kPiPlus, -kPiPlus}; for (const auto& [decayChannelFlag, pdgCodeReso] : hf_decay::hf_cand_reso::particlesToDstarPi) { - indexRec = RecoDecay::getMatchedMCRec(particlesMc, arrDaughtersReso, pdgCodeReso, pdgCodesDaughters, true, &sign, 3, &nKinkedTracks); + indexRec = RecoDecay::getMatchedMCRec(particlesMc, arrDaughtersReso, pdgCodeReso, pdgCodesDaughters, true, &sign, 3, &nKinkedTracks); if (indexRec > -1) { flagReso = sign * decayChannelFlag; break; @@ -918,12 +930,23 @@ struct HfDataCreatorCharmResoReduced { auto pdgCodesDplusDaughters = hf_decay::hf_cand_3prong::daughtersDplusMain.at(static_cast(std::abs(flagCharmBach))); auto pdgCodesDaughters = std::array{pdgCodesDplusDaughters[0], pdgCodesDplusDaughters[1], pdgCodesDplusDaughters[2], -kPiPlus}; for (const auto& [decayChannelFlag, pdgCodeReso] : hf_decay::hf_cand_reso::particlesToDplusPi) { - indexRec = RecoDecay::getMatchedMCRec(particlesMc, arrDaughtersReso, pdgCodeReso, pdgCodesDaughters, true, &sign, 3, &nKinkedTracks); + indexRec = RecoDecay::getMatchedMCRec(particlesMc, arrDaughtersReso, pdgCodeReso, pdgCodesDaughters, true, &sign, 3, &nKinkedTracks); if (indexRec > -1) { flagReso = sign * decayChannelFlag; break; } } + // Partial matching of Dj -> D*Pi -> (D+ pi0) (pi) with missing neutral + if (indexRec < 0) { + for (const auto& [decayChannelFlag, pdgCodeReso] : hf_decay::hf_cand_reso::particlesToDstarPi) { + indexRec = RecoDecay::getMatchedMCRec(particlesMc, arrDaughtersReso, pdgCodeReso, pdgCodesDaughters, true, &sign, 3, &nKinkedTracks); + if (indexRec > -1) { + flagReso = sign * decayChannelFlag; + SETBIT(debugMcRec, hf_decay::hf_cand_reso::PartialMatchMc::ResoPartlyMatched); + break; + } + } + } } // No channels in D+K+ or D+Pr if (indexRec > -1) { @@ -955,18 +978,29 @@ struct HfDataCreatorCharmResoReduced { auto pdgCodesDzeroDaughters = hf_decay::hf_cand_2prong::daughtersD0Main.at(static_cast(std::abs(flagCharmBach))); auto pdgCodesDaughters = std::array{pdgCodesDzeroDaughters[0], pdgCodesDzeroDaughters[1], +kPiPlus}; for (const auto& [decayChannelFlag, pdgCodeReso] : hf_decay::hf_cand_reso::particlesToD0Pi) { - indexRec = RecoDecay::getMatchedMCRec(particlesMc, arrDaughtersReso, pdgCodeReso, pdgCodesDaughters, true, &sign, 3, &nKinkedTracks); + indexRec = RecoDecay::getMatchedMCRec(particlesMc, arrDaughtersReso, pdgCodeReso, pdgCodesDaughters, true, &sign, 3, &nKinkedTracks); if (indexRec > -1) { flagReso = sign * decayChannelFlag; break; } } + // Partial matching of Dj -> D*Pi -> (D0 pi) (pi) with missing pion + if (indexRec < 0) { + for (const auto& [decayChannelFlag, pdgCodeReso] : hf_decay::hf_cand_reso::particlesToDstarPi) { + indexRec = RecoDecay::getMatchedMCRec(particlesMc, arrDaughtersReso, pdgCodeReso, pdgCodesDaughters, true, &sign, 3, &nKinkedTracks); + if (indexRec > -1) { + flagReso = sign * decayChannelFlag; + SETBIT(debugMcRec, hf_decay::hf_cand_reso::PartialMatchMc::ResoPartlyMatched); + break; + } + } + } } else if (hf_decay::hf_cand_2prong::daughtersD0Main.contains(static_cast(std::abs(flagCharmBach))) && flagTrack == hf_decay::hf_cand_reso::PartialMatchMc::KaonMatched) { auto arrDaughtersReso = std::array{vecDaughtersReso[0], vecDaughtersReso[1], bachelorTrack}; auto pdgCodesDzeroDaughters = hf_decay::hf_cand_2prong::daughtersD0Main.at(static_cast(std::abs(flagCharmBach))); auto pdgCodesDaughters = std::array{pdgCodesDzeroDaughters[0], pdgCodesDzeroDaughters[1], +kKPlus}; for (const auto& [decayChannelFlag, pdgCodeReso] : hf_decay::hf_cand_reso::particlesToD0Kplus) { - indexRec = RecoDecay::getMatchedMCRec(particlesMc, arrDaughtersReso, pdgCodeReso, pdgCodesDaughters, true, &sign, 3, &nKinkedTracks); + indexRec = RecoDecay::getMatchedMCRec(particlesMc, arrDaughtersReso, pdgCodeReso, pdgCodesDaughters, true, &sign, 3, &nKinkedTracks); if (indexRec > -1) { flagReso = sign * decayChannelFlag; break; diff --git a/PWGHF/D2H/Tasks/taskCharmResoToDTrkReduced.cxx b/PWGHF/D2H/Tasks/taskCharmResoToDTrkReduced.cxx index be096e1da49..860825fdb75 100644 --- a/PWGHF/D2H/Tasks/taskCharmResoToDTrkReduced.cxx +++ b/PWGHF/D2H/Tasks/taskCharmResoToDTrkReduced.cxx @@ -83,6 +83,7 @@ DECLARE_SOA_COLUMN(PtGen, ptGen, float); DECLARE_SOA_COLUMN(InvMassGen, invMassGen, float); //! Invariant mass of candidate (GeV/c2) DECLARE_SOA_COLUMN(FlagCharmBach, flagCharmBach, int8_t); //! Flag for charm bachelor classification DECLARE_SOA_COLUMN(FlagCharmBachInterm, flagCharmBachInterm, int8_t); //! Flag for charm bachelor classification intermediate +DECLARE_SOA_COLUMN(NKinkedTracks, nKinkedTracks, int8_t); //! Number of kinked tracks found in MC matching } // namespace hf_cand_reso_to_trk_lite DECLARE_SOA_TABLE(HfCandDTrkLites, "AOD", "HFCANDDTRKLITE", //! Table with some B0 properties @@ -119,7 +120,8 @@ DECLARE_SOA_TABLE(HfCandDTrkLites, "AOD", "HFCANDDTRKLITE", //! Table with some hf_cand_reso_to_trk_lite::PtGen, hf_cand_reso_to_trk_lite::InvMassGen, hf_cand_reso_to_trk_lite::FlagCharmBach, - hf_cand_reso_to_trk_lite::FlagCharmBachInterm); + hf_cand_reso_to_trk_lite::FlagCharmBachInterm, + hf_cand_reso_to_trk_lite::NKinkedTracks); DECLARE_SOA_TABLE(HfGenResoLites, "AOD", "HFGENRESOLITE", //! Table with some B0 properties hf_cand_reso_to_trk_lite::Pt, @@ -227,7 +229,7 @@ struct HfTaskCharmResoToDTrkReduced { // MC Rec float ptGen{-1.}, invMassGen{-1}; - int8_t origin{0}, flagMcMatchRec{0}, flagCharmBach{0}, flagCharmBachInterm{0}; + int8_t origin{0}, flagMcMatchRec{0}, flagCharmBach{0}, flagCharmBachInterm{0}, nKinkedTracks{0}; int debugMcRec{-1}; if constexpr (DoMc) { ptGen = candidate.ptGen(); @@ -237,6 +239,7 @@ struct HfTaskCharmResoToDTrkReduced { invMassGen = candidate.invMassGen(); flagCharmBach = candidate.flagMcMatchRecD(); flagCharmBachInterm = candidate.flagMcMatchChanD(); + nKinkedTracks = candidate.nTracksDecayed(); if (fillOnlySignal) { if (Channel == DecayChannel::D0Kplus && !hf_decay::hf_cand_reso::particlesToD0Kplus.contains(static_cast(std::abs(flagMcMatchRec)))) { @@ -324,7 +327,8 @@ struct HfTaskCharmResoToDTrkReduced { ptGen, invMassGen, flagCharmBach, - flagCharmBachInterm); + flagCharmBachInterm, + nKinkedTracks); } } // fillCand diff --git a/PWGHF/D2H/Tasks/taskCharmResoToDV0Reduced.cxx b/PWGHF/D2H/Tasks/taskCharmResoToDV0Reduced.cxx index 4c01573ace8..84ef61e84ba 100644 --- a/PWGHF/D2H/Tasks/taskCharmResoToDV0Reduced.cxx +++ b/PWGHF/D2H/Tasks/taskCharmResoToDV0Reduced.cxx @@ -88,6 +88,7 @@ DECLARE_SOA_COLUMN(PtGen, ptGen, float); DECLARE_SOA_COLUMN(InvMassGen, invMassGen, float); //! Invariant mass of candidate (GeV/c2) DECLARE_SOA_COLUMN(FlagCharmBach, flagCharmBach, int8_t); //! Flag for charm bachelor classification DECLARE_SOA_COLUMN(FlagCharmBachInterm, flagCharmBachInterm, int8_t); //! Flag for charm bachelor classification intermediate +DECLARE_SOA_COLUMN(NKinkedTracks, nKinkedTracks, int8_t); //! Number of kinked tracks found in MC matching } // namespace hf_cand_reso_to_v0_lite DECLARE_SOA_TABLE(HfCandDV0Lites, "AOD", "HFCANDDV0LITE", //! Table with some Resonances properties @@ -128,7 +129,8 @@ DECLARE_SOA_TABLE(HfCandDV0Lites, "AOD", "HFCANDDV0LITE", //! Table with some Re hf_cand_reso_to_v0_lite::PtGen, hf_cand_reso_to_v0_lite::InvMassGen, hf_cand_reso_to_v0_lite::FlagCharmBach, - hf_cand_reso_to_v0_lite::FlagCharmBachInterm); + hf_cand_reso_to_v0_lite::FlagCharmBachInterm, + hf_cand_reso_to_v0_lite::NKinkedTracks); DECLARE_SOA_TABLE(HfGenResoLites, "AOD", "HFGENRESOLITE", //! Table with some B0 properties hf_cand_reso_to_v0_lite::Pt, @@ -258,7 +260,7 @@ struct HfTaskCharmResoToDV0Reduced { // MC Rec float ptGen{-1.}, invMassGen{-1}; - int8_t origin{0}, flagMcMatchRec{0}, flagCharmBach{0}, flagCharmBachInterm{0}; + int8_t origin{0}, flagMcMatchRec{0}, flagCharmBach{0}, flagCharmBachInterm{0}, nKinkedTracks{0}; int debugMcRec{-1}; if constexpr (DoMc) { ptGen = candidate.ptGen(); @@ -268,6 +270,7 @@ struct HfTaskCharmResoToDV0Reduced { invMassGen = candidate.invMassGen(); flagCharmBach = candidate.flagMcMatchRecD(); flagCharmBachInterm = candidate.flagMcMatchChanD(); + nKinkedTracks = candidate.nTracksDecayed(); if (fillOnlySignal) { if (Channel == DecayChannel::DstarK0s && !hf_decay::hf_cand_reso::particlesToDstarK0s.contains(static_cast(std::abs(flagMcMatchRec)))) { @@ -372,7 +375,8 @@ struct HfTaskCharmResoToDV0Reduced { ptGen, invMassGen, flagCharmBach, - flagCharmBachInterm); + flagCharmBachInterm, + nKinkedTracks); } } // fillCand From 1a38df2348f092e12c9006a4ba3830b00b4837a3 Mon Sep 17 00:00:00 2001 From: Sahil Upadhyaya <36447687+sahilupadhyaya92@users.noreply.github.com> Date: Wed, 15 Oct 2025 09:39:12 +0200 Subject: [PATCH 757/986] [PWGDQ] Add processMCGenWithGrouping for 1-Gen 2-Prong MC signal (#13389) Co-authored-by: Sahil Upadhyaya Co-authored-by: ALICE Action Bot --- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 106 ++++++++++++++++++++++++- 1 file changed, 105 insertions(+), 1 deletion(-) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index 475bc6d6f8e..9b62826a66a 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -1386,7 +1386,7 @@ struct AnalysisSameEventPairing { if (context.mOptions.get("processDummy")) { return; } - bool isMCGen = context.mOptions.get("processMCGen"); + bool isMCGen = context.mOptions.get("processMCGen") || context.mOptions.get("processMCGenWithGrouping"); VarManager::SetDefaultVarNames(); fEnableBarrelHistos = context.mOptions.get("processAllSkimmed") || context.mOptions.get("processBarrelOnlySkimmed") || context.mOptions.get("processBarrelOnlyWithCollSkimmed"); @@ -2318,6 +2318,109 @@ struct AnalysisSameEventPairing { } // end loop over reconstructed events } + void processMCGenWithGrouping(soa::Filtered const& events, ReducedMCEvents const& mcEvents, ReducedMCTracks const& mcTracks) + { + uint32_t mcDecision = 0; + int isig = 0; + + for (auto& mctrack : mcTracks) { + VarManager::FillTrackMC(mcTracks, mctrack); + // NOTE: Signals are checked here mostly based on the skimmed MC stack, so depending on the requested signal, the stack could be incomplete. + // NOTE: However, the working model is that the decisions on MC signals are precomputed during skimming and are stored in the mcReducedFlags member. + // TODO: Use the mcReducedFlags to select signals + for (auto& sig : fGenMCSignals) { + if (sig->CheckSignal(true, mctrack)) { + fHistMan->FillHistClass(Form("MCTruthGen_%s", sig->GetName()), VarManager::fgValues); + } + } + } + // Fill Generated histograms taking into account selected collisions + for (auto& event : events) { + if (!event.isEventSelected_bit(0)) { + continue; + } + if (!event.has_reducedMCevent()) { + continue; + } + + for (auto& track : mcTracks) { + if (track.reducedMCeventId() != event.reducedMCeventId()) { + continue; + } + VarManager::FillTrackMC(mcTracks, track); + auto track_raw = mcTracks.rawIteratorAt(track.globalIndex()); + mcDecision = 0; + isig = 0; + for (auto& sig : fGenMCSignals) { + if (sig->CheckSignal(true, track_raw)) { + mcDecision |= (static_cast(1) << isig); + fHistMan->FillHistClass(Form("MCTruthGenSel_%s", sig->GetName()), VarManager::fgValues); + MCTruthTableEffi(VarManager::fgValues[VarManager::kMCPt], VarManager::fgValues[VarManager::kMCEta], VarManager::fgValues[VarManager::kMCY], VarManager::fgValues[VarManager::kMCPhi], VarManager::fgValues[VarManager::kMCVz], VarManager::fgValues[VarManager::kMCVtxZ], VarManager::fgValues[VarManager::kMultFT0A], VarManager::fgValues[VarManager::kMultFT0C], VarManager::fgValues[VarManager::kCentFT0M], VarManager::fgValues[VarManager::kVtxNcontribReal]); + + if (useMiniTree.fConfigMiniTree) { + auto mcEvent = mcEvents.rawIteratorAt(track_raw.reducedMCeventId()); + dileptonMiniTreeGen(mcDecision, mcEvent.impactParameter(), track_raw.pt(), track_raw.eta(), track_raw.phi(), -999, -999, -999); + } + } + isig++; + } + } + } // end loop over reconstructed events + if (fHasTwoProngGenMCsignals) { + for (auto& [t1, t2] : combinations(mcTracks, mcTracks)) { + auto t1_raw = mcTracks.rawIteratorAt(t1.globalIndex()); + auto t2_raw = mcTracks.rawIteratorAt(t2.globalIndex()); + if (t1_raw.reducedMCeventId() == t2_raw.reducedMCeventId()) { + for (auto& sig : fGenMCSignals) { + if (sig->GetNProngs() != 2) { // NOTE: 2-prong signals required here + continue; + } + if (sig->CheckSignal(true, t1_raw, t2_raw)) { + VarManager::FillPairMC(t1, t2); // NOTE: This feature will only work for muons + fHistMan->FillHistClass(Form("MCTruthGenPair_%s", sig->GetName()), VarManager::fgValues); + } + } + } + } + } + for (auto& event : events) { + if (!event.isEventSelected_bit(0)) { + continue; + } + if (!event.has_reducedMCevent()) { + continue; + } + // CURRENTLY ONLY FOR 1-GENERATION 2-PRONG SIGNALS + if (fHasTwoProngGenMCsignals) { + auto groupedMCTracks = mcTracks.sliceBy(perReducedMcEvent, event.reducedMCeventId()); + groupedMCTracks.bindInternalIndicesTo(&mcTracks); + for (auto& [t1, t2] : combinations(groupedMCTracks, groupedMCTracks)) { + auto t1_raw = groupedMCTracks.rawIteratorAt(t1.globalIndex()); + auto t2_raw = groupedMCTracks.rawIteratorAt(t2.globalIndex()); + if (t1_raw.reducedMCeventId() == t2_raw.reducedMCeventId()) { + mcDecision = 0; + isig = 0; + for (auto& sig : fGenMCSignals) { + if (sig->GetNProngs() != 2) { // NOTE: 2-prong signals required here + continue; + } + if (sig->CheckSignal(true, t1_raw, t2_raw)) { + mcDecision |= (static_cast(1) << isig); + VarManager::FillPairMC(t1, t2); // NOTE: This feature will only work for muons + fHistMan->FillHistClass(Form("MCTruthGenPairSel_%s", sig->GetName()), VarManager::fgValues); + if (useMiniTree.fConfigMiniTree) { + // WARNING! To be checked + dileptonMiniTreeGen(mcDecision, -999, t1.pt(), t1.eta(), t1.phi(), t2.pt(), t2.eta(), t2.phi()); + } + } + isig++; + } + } + } + } // end loop over reconstructed events + } + } + void processDummy(MyEvents&) { // do nothing @@ -2328,6 +2431,7 @@ struct AnalysisSameEventPairing { PROCESS_SWITCH(AnalysisSameEventPairing, processBarrelOnlyWithCollSkimmed, "Run barrel only pairing, with skimmed tracks and with collision information", false); PROCESS_SWITCH(AnalysisSameEventPairing, processMuonOnlySkimmed, "Run muon only pairing, with skimmed tracks", false); PROCESS_SWITCH(AnalysisSameEventPairing, processMCGen, "Loop over MC particle stack and fill generator level histograms", false); + PROCESS_SWITCH(AnalysisSameEventPairing, processMCGenWithGrouping, "Loop over MC particle stack (grouped MCTracks) and fill generator level histograms", false); PROCESS_SWITCH(AnalysisSameEventPairing, processDummy, "Dummy function, enabled only if none of the others are enabled", true); }; From 8b1c8cbd198b160e2f2b5c571cb9a448291f958c Mon Sep 17 00:00:00 2001 From: mcoquet642 <74600025+mcoquet642@users.noreply.github.com> Date: Wed, 15 Oct 2025 09:52:12 +0200 Subject: [PATCH 758/986] [PWGDQ] Fixing includes and unitilialized variable in VarManager (#13318) Co-authored-by: Maurice Coquet --- PWGDQ/Core/VarManager.h | 62 ++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/PWGDQ/Core/VarManager.h b/PWGDQ/Core/VarManager.h index 1f5f7d0c59c..af1b1f2c262 100644 --- a/PWGDQ/Core/VarManager.h +++ b/PWGDQ/Core/VarManager.h @@ -17,9 +17,6 @@ #ifndef PWGDQ_CORE_VARMANAGER_H_ #define PWGDQ_CORE_VARMANAGER_H_ -#include -#include -#include #ifndef HomogeneousField #define HomogeneousField #endif @@ -31,40 +28,43 @@ #include "Common/Core/fwdtrackUtilities.h" #include "Common/Core/trackUtilities.h" -#include "CommonConstants/LHCConstants.h" -#include "CommonConstants/PhysicsConstants.h" -#include "DCAFitter/DCAFitterN.h" -#include "DCAFitter/FwdDCAFitterN.h" -#include "DetectorsBase/Propagator.h" -#include "Field/MagneticField.h" -#include "Framework/DataTypes.h" -#include "GlobalTracking/MatchGlobalFwd.h" -#include "ReconstructionDataFormats/DCA.h" -#include "ReconstructionDataFormats/Track.h" -#include "ReconstructionDataFormats/TrackFwd.h" -#include "ReconstructionDataFormats/Vertex.h" - -#include "Math/GenVector/Boost.h" -#include "Math/SMatrix.h" -#include "Math/Vector3D.h" -#include "Math/Vector4D.h" -#include "Math/VectorUtil.h" -#include "TGeoGlobalMagField.h" -#include "TH3F.h" -#include "THn.h" -#include "TRandom.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include #include -#include "KFPTrack.h" -#include "KFPVertex.h" -#include "KFParticle.h" -#include "KFParticleBase.h" -#include "KFVertex.h" +#include +#include +#include +#include +#include #include #include #include +#include #include #include #include @@ -3740,7 +3740,7 @@ void VarManager::FillPairVertexing(C const& collision, T const& t1, T const& t2, if constexpr (eventHasVtxCov) { - std::array covMatrixPCA; + std::array covMatrixPCA{}; // get track impact parameters // This modifies track momenta! o2::math_utils::Point3D vtxXYZ(collision.posX(), collision.posY(), collision.posZ()); From 21ca0eebe52980a0bf0966b7520fe7eec9626bd7 Mon Sep 17 00:00:00 2001 From: shreyasiacharya <34233706+shreyasiacharya@users.noreply.github.com> Date: Wed, 15 Oct 2025 09:54:10 +0200 Subject: [PATCH 759/986] [PWGDQ] Update dqEfficiency_withAssoc.cxx (#13285) --- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index 9b62826a66a..4f5b368d6f9 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -2230,7 +2230,8 @@ struct AnalysisSameEventPairing { if (!event.has_reducedMCevent()) { continue; } - + VarManager::FillEvent(event, VarManager::fgValues); + VarManager::FillEvent(event.reducedMCevent(), VarManager::fgValues); // auto groupedMCTracks = mcTracks.sliceBy(perReducedMcGenEvent, event.reducedMCeventId()); // groupedMCTracks.bindInternalIndicesTo(&mcTracks); // for (auto& track : groupedMCTracks) { From a455cf5686ffdeaddb37e270cd944f30f7e59a8c Mon Sep 17 00:00:00 2001 From: lucamicheletti93 <38209984+lucamicheletti93@users.noreply.github.com> Date: Wed, 15 Oct 2025 10:12:32 +0200 Subject: [PATCH 760/986] [PWGDQ] Adding MC centrality to table-maker-mc-with-assoc (#13372) Co-authored-by: Lucamicheletti93 --- PWGDQ/Core/HistogramsLibrary.cxx | 5 +- PWGDQ/Core/VarManager.cxx | 2 + PWGDQ/Core/VarManager.h | 13 ++- .../TableProducer/tableMakerMC_withAssoc.cxx | 96 ++++++++++++------- 4 files changed, 75 insertions(+), 41 deletions(-) diff --git a/PWGDQ/Core/HistogramsLibrary.cxx b/PWGDQ/Core/HistogramsLibrary.cxx index b01443375fc..e2c73f7e9ac 100644 --- a/PWGDQ/Core/HistogramsLibrary.cxx +++ b/PWGDQ/Core/HistogramsLibrary.cxx @@ -222,6 +222,7 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "MCVtxZ_VtxX", "Vtx X vs Vtx Z", false, 60, -15.0, 15.0, VarManager::kMCVtxZ, 200, -0.2, 0.2, VarManager::kMCVtxX); hm->AddHistogram(histClass, "MCVtxX_VtxY", "Vtx X vs Vtx Y", false, 200, 15.0, 15.0, VarManager::kMCVtxZ, 200, -0.2, 0.2, VarManager::kMCVtxY); hm->AddHistogram(histClass, "MCImpPar", "MC impact param", false, 20, 0.0, 20.0, VarManager::kMCEventImpParam); + hm->AddHistogram(histClass, "MCCentrFT0C", "MC Centrality FT0C", false, 100, 0.0, 100.0, VarManager::kMCEventCentrFT0C); } if (subGroupStr.Contains("subgen")) { hm->AddHistogram(histClass, "SubGenID", "SubGenerator ID", false, 11, -0.5, 10.5, VarManager::kMCEventSubGeneratorId); @@ -950,13 +951,13 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "EtaMC", "MC #eta", false, 50, -5.0, 5.0, VarManager::kMCEta); hm->AddHistogram(histClass, "PhiMC", "MC #phi", false, 50, -6.3, 6.3, VarManager::kMCPhi); hm->AddHistogram(histClass, "YMC", "MC y", false, 50, -5.0, 5.0, VarManager::kMCY); - hm->AddHistogram(histClass, "CentFT0CMC", "MC Cent. FT0C", false, 18, 0., 90., VarManager::kCentFT0C); + hm->AddHistogram(histClass, "CentFT0CMC", "MC Cent. FT0C", false, 18, 0., 90., VarManager::kMCEventCentrFT0C); hm->AddHistogram(histClass, "PtMC_YMC", "MC pT vs MC y", false, 120, 0.0, 30.0, VarManager::kMCPt, 1000, -5.0, 5.0, VarManager::kMCY); hm->AddHistogram(histClass, "EtaMC_PtMC", "", false, 40, -2.0, 2.0, VarManager::kMCEta, 200, 0.0, 20.0, VarManager::kMCPt); hm->AddHistogram(histClass, "VzMC", "MC vz", false, 100, -15.0, 15.0, VarManager::kMCVz); hm->AddHistogram(histClass, "VzMC_VtxZMC", "MC vz vs MC vtxZ", false, 50, -15.0, 15.0, VarManager::kMCVz, 50, -15.0, 15.0, VarManager::kMCVtxZ); hm->AddHistogram(histClass, "Weight", "", false, 50, 0.0, 5.0, VarManager::kMCParticleWeight); - hm->AddHistogram(histClass, "MCImpPar_CentFT0CMC", "MC impact param vs MC Cent. FT0C", false, 20, 0.0, 20.0, VarManager::kMCEventImpParam, 100, 0.0, 100.0, VarManager::kCentFT0C); + hm->AddHistogram(histClass, "MCImpPar_CentFT0CMC", "MC impact param vs MC Cent. FT0C", false, 20, 0.0, 20.0, VarManager::kMCEventImpParam, 100, 0.0, 100.0, VarManager::kMCEventCentrFT0C); } if (!groupStr.CompareTo("pair")) { diff --git a/PWGDQ/Core/VarManager.cxx b/PWGDQ/Core/VarManager.cxx index 4a5769e0560..7c87739b009 100644 --- a/PWGDQ/Core/VarManager.cxx +++ b/PWGDQ/Core/VarManager.cxx @@ -445,6 +445,7 @@ void VarManager::SetDefaultVarNames() fgVariableNames[kMCEventTime] = "MC event time"; fgVariableNames[kMCEventWeight] = "MC event weight"; fgVariableNames[kMCEventImpParam] = "MC impact parameter"; + fgVariableNames[kMCEventCentrFT0C] = "MC Centrality FT0C"; fgVariableUnits[kMCEventGeneratorId] = ""; fgVariableUnits[kMCEventSubGeneratorId] = ""; fgVariableUnits[kMCVtxX] = "cm"; @@ -453,6 +454,7 @@ void VarManager::SetDefaultVarNames() fgVariableUnits[kMCEventTime] = ""; // TODO: add proper unit fgVariableUnits[kMCEventWeight] = ""; fgVariableUnits[kMCEventImpParam] = "b"; + fgVariableUnits[kMCEventCentrFT0C] = "%"; fgVariableNames[kTwoEvPosZ1] = "vtx-z_{1}"; fgVariableUnits[kTwoEvPosZ1] = "cm"; fgVariableNames[kTwoEvPosZ2] = "vtx-z_{2}"; diff --git a/PWGDQ/Core/VarManager.h b/PWGDQ/Core/VarManager.h index af1b1f2c262..a4d9f540370 100644 --- a/PWGDQ/Core/VarManager.h +++ b/PWGDQ/Core/VarManager.h @@ -282,6 +282,7 @@ class VarManager : public TObject kMCEventTime, kMCEventWeight, kMCEventImpParam, + kMCEventCentrFT0C, kQ1ZNAX, kQ1ZNAY, kQ1ZNCX, @@ -1655,9 +1656,11 @@ void VarManager::FillEvent(T const& event, float* values) } if constexpr ((fillMap & CollisionCent) > 0 || (fillMap & ReducedEventExtended) > 0) { - values[kCentFT0C] = event.centFT0C(); - values[kCentFT0A] = event.centFT0A(); - values[kCentFT0M] = event.centFT0M(); + if constexpr ((fillMap & CollisionMC) == 0) { + values[kCentFT0C] = event.centFT0C(); + values[kCentFT0A] = event.centFT0A(); + values[kCentFT0M] = event.centFT0M(); + } } if constexpr ((fillMap & CollisionMult) > 0 || (fillMap & ReducedEventExtended) > 0) { @@ -1982,6 +1985,10 @@ void VarManager::FillEvent(T const& event, float* values) values[kMCEventTime] = event.t(); values[kMCEventWeight] = event.weight(); values[kMCEventImpParam] = event.impactParameter(); + if constexpr ((fillMap & CollisionCent) > 0) { + // WARNING: temporary solution, ongoing work to provide proper MC gen. centrality + values[kMCEventCentrFT0C] = event.bestCollisionCentFT0C(); + } } if constexpr ((fillMap & ReducedEventMC) > 0) { diff --git a/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx b/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx index f9be380c416..39fc41ec2ce 100644 --- a/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx +++ b/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx @@ -32,6 +32,7 @@ #include "Common/DataModel/CollisionAssociationTables.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/FwdTrackReAlignTables.h" +#include "Common/DataModel/McCollisionExtra.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" @@ -98,6 +99,7 @@ using MyEventsWithMultsAndRapidityGapFilter = soa::Join; using MyEventsWithCentAndMults = soa::Join; using MFTTrackLabeled = soa::Join; +using MyEventsMcWithMults = soa::Join; // Declare bit maps containing information on the table joins content (used as argument in templated functions) constexpr static uint32_t gkEventFillMap = VarManager::ObjTypes::BC | VarManager::ObjTypes::Collision; @@ -105,7 +107,8 @@ constexpr static uint32_t gkEventFillMapWithMults = VarManager::ObjTypes::BC | V // constexpr static uint32_t gkEventFillMapWithCent = VarManager::ObjTypes::BC | VarManager::ObjTypes::Collision | VarManager::ObjTypes::CollisionCent; constexpr static uint32_t gkEventFillMapWithCentAndMults = VarManager::ObjTypes::BC | VarManager::ObjTypes::Collision | VarManager::ObjTypes::CollisionCent | VarManager::CollisionMult | VarManager::CollisionMultExtra; constexpr static uint32_t gkEventFillMapWithMultsRapidityGapFilter = VarManager::ObjTypes::BC | VarManager::ObjTypes::Collision | VarManager::ObjTypes::CollisionMult | VarManager::ObjTypes::CollisionMultExtra | VarManager::ObjTypes::RapidityGapFilter; -// constexpr static uint32_t gkEventMCFillMap = VarManager::ObjTypes::CollisionMC; +constexpr static uint32_t gkEventMcFillMap = VarManager::ObjTypes::CollisionMC; +constexpr static uint32_t gkEventMcFillMapWithCent = VarManager::ObjTypes::CollisionMC | VarManager::ObjTypes::CollisionCent; // constexpr static uint32_t gkTrackFillMap = VarManager::ObjTypes::Track | VarManager::ObjTypes::TrackExtra | VarManager::ObjTypes::TrackDCA | VarManager::ObjTypes::TrackSelection | VarManager::ObjTypes::TrackPID; constexpr static uint32_t gkTrackFillMapWithCov = VarManager::ObjTypes::Track | VarManager::ObjTypes::TrackExtra | VarManager::ObjTypes::TrackDCA | VarManager::ObjTypes::TrackSelection | VarManager::ObjTypes::TrackCov | VarManager::ObjTypes::TrackPID; // constexpr static uint32_t gkTrackFillMapWithDalitzBits = gkTrackFillMap | VarManager::ObjTypes::DalitzBits; @@ -451,7 +454,8 @@ struct TableMakerMC { Preslice fwdtrackIndicesPerCollision = aod::track_association::collisionId; Preslice mfttrackIndicesPerCollision = aod::track_association::collisionId; - void skimMCCollisions(aod::McCollisions const& mcCollisions) + template + void skimMCCollisions(TEventsMC const& mcCollisions) { // skim MC collisions // NOTE: So far, all MC collisions are skimmed. In case there will be filtering based on MC collisions, @@ -461,7 +465,7 @@ struct TableMakerMC { // Loop over MC collisions for (auto& mcCollision : mcCollisions) { // Get MC collision information into the VarManager - VarManager::FillEvent(mcCollision); + VarManager::FillEvent(mcCollision); // Fill histograms fHistMan->FillHistClass("Event_MCTruth", VarManager::fgValues); // Create the skimmed table entry for this collision @@ -470,7 +474,8 @@ struct TableMakerMC { } } - void skimMCParticles(aod::McParticles const& mcTracks, aod::McCollisions const&) + template + void skimMCParticles(aod::McParticles const& mcTracks, TEventsMC const&) { // Select MC particles which fulfill at least one of the user specified MC signals // In this function we just fill a map with the labels of selected particles, not creating the tables themselves. @@ -547,7 +552,8 @@ struct TableMakerMC { // fill histograms for each of the signals, if found if (fConfigHistOutput.fConfigQA) { VarManager::FillTrackMC(mcTracks, mctrack); - VarManager::FillEvent(mctrack.mcCollision()); + auto mcCollision = mctrack.template mcCollision_as(); + VarManager::FillEvent(mcCollision); int j = 0; for (auto signal = fMCSignals.begin(); signal != fMCSignals.end(); signal++, j++) { if (mcflags & (static_cast(1) << j)) { @@ -559,7 +565,7 @@ struct TableMakerMC { } // end loop over mc stack } - template + template void skimCollisions(TEvents const& collisions, BCsWithTimestamps const& /*bcs*/) { // Skim reconstructed collisions which are selected by the user specified cuts @@ -618,7 +624,8 @@ struct TableMakerMC { VarManager::FillBC(bc); VarManager::FillEvent(collision); // extract event information and place it in the fValues array if (collision.has_mcCollision()) { - VarManager::FillEvent(collision.mcCollision()); + auto mcCollision = collision.template mcCollision_as(); + VarManager::FillEvent(mcCollision); } if (fDoDetailedQA) { fHistMan->FillHistClass("Event_BeforeCuts", VarManager::fgValues); @@ -1172,12 +1179,12 @@ struct TableMakerMC { } // end loop over selected muons } // end skimMuons - template + template void fullSkimming(TEvents const& collisions, BCsWithTimestamps const& bcs, TTracks const& tracksBarrel, TMuons const& muons, TMFTTracks const& mftTracks, TTrackAssoc const& trackAssocs, TFwdTrackAssoc const& fwdTrackAssocs, TMFTTrackAssoc const& mftAssocs, - aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles, TMFTCov const& mftCovs) + TEventsMC const& mcCollisions, aod::McParticles const& mcParticles, TMFTCov const& mftCovs) { // Check whether the run changed and update CCDB if it did if (bcs.size() > 0 && fCurrentRun != bcs.begin().runNumber()) { @@ -1207,11 +1214,11 @@ struct TableMakerMC { // skim MC Collisions eventMC.reserve(mcCollisions.size()); - skimMCCollisions(mcCollisions); + skimMCCollisions(mcCollisions); // select MC particles to be written using the specified MC signals // NOTE: tables are not written at this point, only label maps are being created - skimMCParticles(mcParticles, mcCollisions); + skimMCParticles(mcParticles, mcCollisions); // skim collisions event.reserve(collisions.size()); @@ -1219,7 +1226,7 @@ struct TableMakerMC { eventVtxCov.reserve(collisions.size()); eventMClabels.reserve(collisions.size()); eventInfo.reserve(collisions.size()); - skimCollisions(collisions, bcs); + skimCollisions(collisions, bcs); if (fCollIndexMap.size() == 0) { return; } @@ -1344,7 +1351,8 @@ struct TableMakerMC { } // NOTE: Here we assume that MC collisions are not filtered, so there is no new vs old index map for translation - trackMC(mctrack.mcCollision().globalIndex(), mctrack.pdgCode(), mctrack.statusCode(), mctrack.flags(), + auto mcCollision = mctrack.template mcCollision_as(); + trackMC(mcCollision.globalIndex(), mctrack.pdgCode(), mctrack.statusCode(), mctrack.flags(), mothers, daughterRange, mctrack.weight(), mctrack.pt(), mctrack.eta(), mctrack.phi(), mctrack.e(), mctrack.vx(), mctrack.vy(), mctrack.vz(), mctrack.vt(), mcflags); @@ -1443,86 +1451,102 @@ struct TableMakerMC { void processPP(MyEventsWithMults const& collisions, aod::BCsWithTimestamps const& bcs, MyBarrelTracksWithCov const& tracksBarrel, MyMuonsWithCov const& tracksMuon, MFTTrackLabeled const& mftTracks, aod::TrackAssoc const& trackAssocs, aod::FwdTrackAssoc const& fwdTrackAssocs, aod::MFTTrackAssoc const& mftAssocs, - aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) + MyEventsMcWithMults const& mcCollisions, aod::McParticles const& mcParticles) { - fullSkimming(collisions, bcs, tracksBarrel, tracksMuon, mftTracks, trackAssocs, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles, nullptr); + fullSkimming(collisions, bcs, tracksBarrel, tracksMuon, mftTracks, trackAssocs, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles, nullptr); } void processPPBarrelOnly(MyEventsWithMults const& collisions, aod::BCsWithTimestamps const& bcs, MyBarrelTracksWithCov const& tracksBarrel, aod::TrackAssoc const& trackAssocs, - aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) + MyEventsMcWithMults const& mcCollisions, aod::McParticles const& mcParticles) { - fullSkimming(collisions, bcs, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr, mcCollisions, mcParticles, nullptr); + fullSkimming(collisions, bcs, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr, mcCollisions, mcParticles, nullptr); } void processPPMuonOnlyBasic(MyEvents const& collisions, aod::BCsWithTimestamps const& bcs, MyMuonsWithCov const& tracksMuon, MFTTrackLabeled const& mftTracks, aod::FwdTrackAssoc const& fwdTrackAssocs, aod::MFTTrackAssoc const& mftAssocs, - aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) + MyEventsMcWithMults const& mcCollisions, aod::McParticles const& mcParticles) { - fullSkimming(collisions, bcs, nullptr, tracksMuon, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles, nullptr); + fullSkimming(collisions, bcs, nullptr, tracksMuon, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles, nullptr); } void processPPMuonOnly(MyEventsWithMults const& collisions, aod::BCsWithTimestamps const& bcs, MyMuonsWithCov const& tracksMuon, MFTTrackLabeled const& mftTracks, aod::FwdTrackAssoc const& fwdTrackAssocs, aod::MFTTrackAssoc const& mftAssocs, - aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) + MyEventsMcWithMults const& mcCollisions, aod::McParticles const& mcParticles) { - fullSkimming(collisions, bcs, nullptr, tracksMuon, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles, nullptr); + fullSkimming(collisions, bcs, nullptr, tracksMuon, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles, nullptr); } void processPPMuonRefit(MyEventsWithMults const& collisions, aod::BCsWithTimestamps const& bcs, MyMuonsWithCov const& tracksMuon, MFTTrackLabeled const& mftTracks, aod::FwdTrackAssoc const& fwdTrackAssocs, aod::MFTTrackAssoc const& mftAssocs, - aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles, aod::MFTTracksCov const& mftCovs) + MyEventsMcWithMults const& mcCollisions, aod::McParticles const& mcParticles, aod::MFTTracksCov const& mftCovs) { - fullSkimming(collisions, bcs, nullptr, tracksMuon, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles, mftCovs); + fullSkimming(collisions, bcs, nullptr, tracksMuon, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles, mftCovs); } void processPPRealignedMuonOnly(MyEventsWithMults const& collisions, aod::BCsWithTimestamps const& bcs, MyMuonsRealignWithCov const& tracksMuon, MFTTrackLabeled const& mftTracks, aod::FwdTrackAssoc const& fwdTrackAssocs, aod::MFTTrackAssoc const& mftAssocs, - aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) + MyEventsMcWithMults const& mcCollisions, aod::McParticles const& mcParticles) { - fullSkimming(collisions, bcs, nullptr, tracksMuon, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles, nullptr); + fullSkimming(collisions, bcs, nullptr, tracksMuon, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles, nullptr); } void processPbPb(MyEventsWithCentAndMults const& collisions, aod::BCsWithTimestamps const& bcs, MyBarrelTracksWithCov const& tracksBarrel, MyMuonsWithCov const& tracksMuon, MFTTrackLabeled const& mftTracks, aod::TrackAssoc const& trackAssocs, aod::FwdTrackAssoc const& fwdTrackAssocs, aod::MFTTrackAssoc const& mftAssocs, - aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) + MyEventsMcWithMults const& mcCollisions, aod::McParticles const& mcParticles) { - fullSkimming(collisions, bcs, tracksBarrel, tracksMuon, mftTracks, trackAssocs, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles, nullptr); + fullSkimming(collisions, bcs, tracksBarrel, tracksMuon, mftTracks, trackAssocs, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles, nullptr); } void processPbPbBarrelOnly(MyEventsWithCentAndMults const& collisions, aod::BCsWithTimestamps const& bcs, MyBarrelTracksWithCov const& tracksBarrel, aod::TrackAssoc const& trackAssocs, - aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) + MyEventsMcWithMults const& mcCollisions, aod::McParticles const& mcParticles) { - fullSkimming(collisions, bcs, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr, mcCollisions, mcParticles, nullptr); + fullSkimming(collisions, bcs, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr, mcCollisions, mcParticles, nullptr); } void processPbPbWithFilterBarrelOnly(MyEventsWithMultsAndRapidityGapFilter const& collisions, aod::BCsWithTimestamps const& bcs, MyBarrelTracksWithCov const& tracksBarrel, aod::TrackAssoc const& trackAssocs, - aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) + MyEventsMcWithMults const& mcCollisions, aod::McParticles const& mcParticles) { - fullSkimming(collisions, bcs, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr, mcCollisions, mcParticles, nullptr); + fullSkimming(collisions, bcs, tracksBarrel, nullptr, nullptr, trackAssocs, nullptr, nullptr, mcCollisions, mcParticles, nullptr); } void processPbPbMuonOnly(MyEventsWithCentAndMults const& collisions, aod::BCsWithTimestamps const& bcs, MyMuonsWithCov const& tracksMuon, MFTTrackLabeled const& mftTracks, aod::FwdTrackAssoc const& fwdTrackAssocs, aod::MFTTrackAssoc const& mftAssocs, - aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) + MyEventsMcWithMults const& mcCollisions, aod::McParticles const& mcParticles) { - fullSkimming(collisions, bcs, nullptr, tracksMuon, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles, nullptr); + fullSkimming(collisions, bcs, nullptr, tracksMuon, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles, nullptr); + /*LOGP(info, "---------------------------"); + for (auto& mcCollision : mcCollisions) { + LOGP(info, "Gen. FT0C centrality = {}", mcCollision.bestCollisionCentFT0C()); + //LOGP(info, "Gen. FT0C centrality = {}", mcCollision.posZ()); + } + for (const auto& collision : collisions) { + if (collision.has_mcCollision()) { + LOGP(info, "*************************"); + auto mcCollision = collision.template mcCollision_as(); + //LOGP(info, "Gen. FT0C centrality = {}", collision.mcCollision().posZ()); + LOGP(info, "Gen. FT0C centrality = {}", mcCollision.bestCollisionCentFT0C()); + LOGP(info, "Rec. FT0C centrality = {}", collision.centFT0C()); + LOGP(info, "*************************"); + } + } + LOGP(info, "---------------------------");*/ } void processPbPbRealignedMuonOnly(MyEventsWithCentAndMults const& collisions, aod::BCsWithTimestamps const& bcs, MyMuonsRealignWithCov const& tracksMuon, MFTTrackLabeled const& mftTracks, aod::FwdTrackAssoc const& fwdTrackAssocs, aod::MFTTrackAssoc const& mftAssocs, - aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) + MyEventsMcWithMults const& mcCollisions, aod::McParticles const& mcParticles) { - fullSkimming(collisions, bcs, nullptr, tracksMuon, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles, nullptr); + fullSkimming(collisions, bcs, nullptr, tracksMuon, mftTracks, nullptr, fwdTrackAssocs, mftAssocs, mcCollisions, mcParticles, nullptr); } // Process the BCs and store stats for luminosity retrieval ----------------------------------------------------------------------------------- From 1923ab48778540289e71ebea96c1225612603b30 Mon Sep 17 00:00:00 2001 From: FDUEnrich <23210190047@m.fudan.edu.cn> Date: Wed, 15 Oct 2025 13:55:22 +0200 Subject: [PATCH 761/986] [PWGHF] candidateSelectorOmegac0Xic0ToOmegaKa.cxx: Fix configuration key name mismatch and O2linter errors. (#13353) Co-authored-by: ALICE Action Bot --- .../candidateSelectorOmegac0Xic0ToOmegaKa.cxx | 47 +++++++++---------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/PWGHF/TableProducer/candidateSelectorOmegac0Xic0ToOmegaKa.cxx b/PWGHF/TableProducer/candidateSelectorOmegac0Xic0ToOmegaKa.cxx index 1dd9ad697e3..6e716cb1c91 100644 --- a/PWGHF/TableProducer/candidateSelectorOmegac0Xic0ToOmegaKa.cxx +++ b/PWGHF/TableProducer/candidateSelectorOmegac0Xic0ToOmegaKa.cxx @@ -9,8 +9,8 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file candidateSelectorOmegaKa0Xic0ToOmegaKa.cxx -/// \brief OmegaKa0 Xic0 → Omega Ka selection task +/// \file candidateSelectorOmegac0Xic0ToOmegaKa.cxx +/// \brief Omegac0 Xic0 → Omega Ka selection task /// \author Federica Zanone , Heidelberg University /// \author Ruiqi Yin , Fudan University @@ -57,15 +57,15 @@ enum PidInfoStored { }; /// Struct for applying OmegaKa -> Omega Ka selection cuts -struct HfCandidateSelectorToOmegaKa { +struct HfCandidateSelectorOmegac0Xic0ToOmegaKa { Produces hfSelToOmegaKaKf; // Produces hfMlSelToOmegaKa; // LF analysis selections - Configurable radiusCascMin{"radiusCascMin", 0.5, "Min cascade radius"}; + Configurable radiusCascMin{"radiusCascMin", 0.1, "Min cascade radius"}; Configurable radiusV0Min{"radiusV0Min", 1.1, "Min V0 radius"}; - Configurable cosPAV0Min{"cosPAV0Min", 0.97, "Min valueCosPA V0"}; - Configurable cosPACascMin{"cosPACascMin", 0.97, "Min value CosPA cascade"}; + Configurable cosPAV0Min{"cosPAV0Min", 0.95, "Min valueCosPA V0"}; + Configurable cosPACascMin{"cosPACascMin", 0.95, "Min value CosPA cascade"}; Configurable dcaCascDauMax{"dcaCascDauMax", 1.0, "Max DCA cascade daughters"}; Configurable dcaV0DauMax{"dcaV0DauMax", 1.0, "Max DCA V0 daughters"}; Configurable dcaBachToPvMin{"dcaBachToPvMin", 0.04, "DCA Bach To PV"}; @@ -92,8 +92,8 @@ struct HfCandidateSelectorToOmegaKa { Configurable impactParameterXYCascMin{"impactParameterXYCascMin", 0., "Min dcaxy cascade track to PV"}; Configurable impactParameterXYCascMax{"impactParameterXYCascMax", 10., "Max dcaxy cascade track to PV"}; - Configurable ptCandMin{"ptCandMin", 0., "Lower bound of candidate pT"}; - Configurable ptCandMax{"ptCandMax", 50., "Upper bound of candidate pT"}; + Configurable ptCandMin{"ptCandMin", 1., "Lower bound of candidate pT"}; + Configurable ptCandMax{"ptCandMax", 12., "Upper bound of candidate pT"}; Configurable dcaCharmBaryonDauMax{"dcaCharmBaryonDauMax", 2.0, "Max DCA charm baryon daughters"}; @@ -142,11 +142,6 @@ struct HfCandidateSelectorToOmegaKa { Configurable nClustersItsInnBarrMin{"nClustersItsInnBarrMin", 1, "Minimum number of ITS clusters in inner barrel requirement for pi <- charm baryon"}; Configurable itsChi2PerClusterMax{"itsChi2PerClusterMax", 36, "Maximum value of chi2 fit over ITS clusters for pi <- charm baryon"}; - ConfigurableAxis thnConfigAxisMass{"thnConfigAxisMass", {120, 2.4, 3.1}, "Cand. inv-mass bins"}; - ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {100, 0, 20}, "Cand. pT bins"}; - ConfigurableAxis thnConfigAxisCent{"thnConfigAxisCent", {100, 0, 100}, "Centrality bins"}; - ConfigurableAxis thnConfigAxisPtKaon{"thnConfigAxisPtKaon", {100, 0, 10}, "PtPion from Omegac0 bins"}; - struct : ConfigurableGroup { //// KF selection std::string prefix = "kfSel"; @@ -180,6 +175,11 @@ struct HfCandidateSelectorToOmegaKa { using TracksSel = soa::Join; using TracksSelLf = soa::Join; + ConfigurableAxis thnConfigAxisMass{"thnConfigAxisMass", {120, 2.4, 3.1}, "Cand. inv-mass bins"}; + ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {100, 0, 20}, "Cand. pT bins"}; + ConfigurableAxis thnConfigAxisCent{"thnConfigAxisCent", {100, 0, 100}, "Centrality bins"}; + ConfigurableAxis thnConfigAxisPtKaon{"thnConfigAxisPtKaon", {100, 0, 10}, "PtPion from Omegac0 bins"}; + HistogramRegistry registry{"registry"}; // for QA of selections OutputObj hInvMassCharmBaryon{TH1D("hInvMassCharmBaryon", "Charm baryon invariant mass;inv mass;entries", 500, 2.0, 3.1)}; @@ -248,7 +248,6 @@ struct HfCandidateSelectorToOmegaKa { registry.add("hSelMassCasc", "hSelMassCasc;status;entries", {HistType::kTH1D, {axisSel}}); registry.add("hSelMassCharmBaryon", "hSelMassCharmBaryon;status;entries", {HistType::kTH1D, {axisSel}}); registry.add("hSelDcaXYToPvKaFromCasc", "hSelDcaXYToPvKaFromCasc;status;entries", {HistType::kTH1D, {axisSel}}); - registry.add("hSelPtOmegaKa", "hSelPtOmegaKa;status;entries", {HistType::kTH1D, {axisSel}}); registry.add("hSelCompetingCasc", "hSelCompetingCasc;status;entries", {HistType::kTH1D, {axisSel}}); registry.add("hSelV0_Casc_OmegaKaldl", "hSelV0_Casc_OmegaKaldl;status;entries", {HistType::kTH1D, {axisSel}}); registry.add("hSelctauOmegaKa", "hSelctauOmegaKa;status;entries", {HistType::kTH1D, {axisSel}}); @@ -265,6 +264,10 @@ struct HfCandidateSelectorToOmegaKa { bool selectionTopol(const T1& hfCandOmegaKa) { auto candpT = hfCandOmegaKa.kfPtOmegaKa(); + // check that the candidate pT is within the analysis range + if (candpT < ptCandMin || candpT > ptCandMax) { + return false; + } auto kaPtFromOmegaKa = hfCandOmegaKa.kfPtKaFromOmegaKa(); int const pTBin = findBin(binsPt, candpT); if (pTBin == -1) { @@ -272,14 +275,7 @@ struct HfCandidateSelectorToOmegaKa { } // check that the candidate pT is within the analysis range - if (candpT <= ptCandMin || candpT >= ptCandMax) { - registry.fill(HIST("hSelPtOmegaKa"), 0); - return false; - } - registry.fill(HIST("hSelPtOmegaKa"), 1); - - // check that the candidate pT is within the analysis range - if (kaPtFromOmegaKa < cuts->get(pTBin, "pT ka from OmegaKa")) { + if (kaPtFromOmegaKa < cuts->get(pTBin, "pT Ka from Omegac")) { registry.fill(HIST("hSelPtKaFromCharm"), 0); return false; } @@ -329,10 +325,13 @@ struct HfCandidateSelectorToOmegaKa { } else if (signDecay < 0) { registry.fill(HIST("hSelSignDec"), 0); // particle decay } - // pt-dependent selection if (!selectionTopol(candidate)) { resultSelections = false; + hfSelToOmegaKaKf(statusPidLambda, statusPidCascade, statusPidCharmBaryon, statusInvMassLambda, statusInvMassCascade, statusInvMassCharmBaryon, resultSelections, infoTpcStored, infoTofStored, + trackKaFromCharm.tpcNSigmaKa(), trackKaFromCasc.tpcNSigmaKa(), trackPiFromLam.tpcNSigmaPi(), trackPrFromLam.tpcNSigmaPr(), + trackKaFromCharm.tofNSigmaKa(), trackKaFromCasc.tofNSigmaKa(), trackPiFromLam.tofNSigmaPi(), trackPrFromLam.tofNSigmaPr()); + continue; } // eta selection @@ -714,5 +713,5 @@ struct HfCandidateSelectorToOmegaKa { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(cfgc)}; } From 92b1e88fb8eda5930b81dc552cb546e5643e13b3 Mon Sep 17 00:00:00 2001 From: Swadhinkumar49 <108603227+Swadhinkumar49@users.noreply.github.com> Date: Wed, 15 Oct 2025 18:50:22 +0530 Subject: [PATCH 762/986] [PWGLF] Updated CMakelist with the phi1020SpherocityAnalysis.cxx work flow (#13391) --- PWGLF/Tasks/Resonances/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PWGLF/Tasks/Resonances/CMakeLists.txt b/PWGLF/Tasks/Resonances/CMakeLists.txt index d7e30e875ef..c04f076bef2 100644 --- a/PWGLF/Tasks/Resonances/CMakeLists.txt +++ b/PWGLF/Tasks/Resonances/CMakeLists.txt @@ -263,3 +263,7 @@ o2physics_add_dpl_workflow(phispectrapbpbqa SOURCES phispectrapbpbqa.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(phi-1020-spherocity-analysis + SOURCES phi1020SpherocityAnalysis.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) From 1a8285d6561e69b40ba7762d55f111d9680db411 Mon Sep 17 00:00:00 2001 From: Sandeep Dudi <69388148+sdudi123@users.noreply.github.com> Date: Wed, 15 Oct 2025 15:32:57 +0200 Subject: [PATCH 763/986] [PWGLF] Memory loss problem resolve due to histogram (#13383) Co-authored-by: sandeep dudi --- PWGLF/Tasks/Nuspex/spectraKinkPiKa.cxx | 111 +++++++++++++------------ 1 file changed, 58 insertions(+), 53 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/spectraKinkPiKa.cxx b/PWGLF/Tasks/Nuspex/spectraKinkPiKa.cxx index e522e206093..1a77474882f 100644 --- a/PWGLF/Tasks/Nuspex/spectraKinkPiKa.cxx +++ b/PWGLF/Tasks/Nuspex/spectraKinkPiKa.cxx @@ -381,13 +381,13 @@ struct spectraKinkPiKa { Configurable centestimator{"centestimator", 0, "Select multiplicity estimator: 0 - FT0C, 1 - FT0A, 2 - FT0M, 3 - FV0A, 4 - PVTracks"}; Configurable pid{"pidMother", 321, ""}; Configurable dpid{"pidDaughter", 13, ""}; - Configurable d0pid{"dopid", 0, ""}; Configurable dptCut{"dptCut", 0, ""}; Configurable qa{"qa", 0, ""}; Configurable maxtpcncle{"maxtpcncle", 0, "max tpc find ncle"}; Configurable mintpcncle{"mintpcncle", 0, "min tpc find ncle"}; Configurable onlykaon{"onlykaon", 0, "kaon"}; Configurable onlypion{"onlypion", 0, "pion"}; + Configurable additionalhist{"additionalhist", 1, "additional histogram"}; ConfigurableAxis ptAxis{"ptAxis", {150, 0, 15}, ""}; ConfigurableAxis qtAxis{"qtAxis", {2000, 0.0, 2.0}, ""}; @@ -470,6 +470,9 @@ struct spectraKinkPiKa { rpiKkink.add("tr_tpcnclfindM_m", "tpcnclfindm", {HistType::kTH1F, {{300, 0.0, 300.0}}}); rpiKkink.add("tr_tpcnclfindD_m", "tpcnclfindd", {HistType::kTH1F, {{300, 0.0, 300.0}}}); rpiKkink.add("tr_itsChi2NClM_m", "itsChi2NClm", {HistType::kTH1F, {{200, 0.0, 200.0}}}); + + rpiKkink.add("h2_kinkradius_vs_pt_m", "kinkradius_vs_pt", {HistType::kTH2F, {{250, 0.0, 250.0}, ptAxis}}); + rpiKkink.add("h2_kinkradius_vs_ncl_m", "kinkradius_vs_ncl", {HistType::kTH2F, {{250, 0.0, 250.0}, {300, 0.0, 300.0}}}); } if (doprocessMC) { rpiKkink.add("h2_dau_pt_vs_eta_gen", "pt_vs_eta_dau", {HistType::kTH2F, {ptAxis, etaAxis}}); @@ -489,8 +492,6 @@ struct spectraKinkPiKa { rpiKkink.add("h2_kink_angle_m", "kink angle", {HistType::kTH2F, {kinkAxis, multAxis}}); rpiKkink.add("h2_invmass_kaon_m", "Inv mass vs Pt", {HistType::kTH3F, {massAxis, ptAxis, ptAxis}}); rpiKkink.add("h2_kaon_mc_rec_m", "h2_kaon_mc_rec_m", HistType::kTHnSparseF, {massAxis, ptAxis, etaAxis, qtAxis, multAxis}, true); - - // qa } } @@ -576,14 +577,14 @@ struct spectraKinkPiKa { rpiKkink.fill(HIST("tr_chi2nclM"), mothTrack.tpcChi2NCl()); rpiKkink.fill(HIST("tr_chi2nclD"), dauTrack.tpcChi2NCl()); - rpiKkink.fill(HIST("tr_tpcnclfindM"), mothTrack.tpcNClsFindable()); - rpiKkink.fill(HIST("tr_tpcnclfindD"), dauTrack.tpcNClsFindable()); + rpiKkink.fill(HIST("tr_tpcnclfindM"), mothTrack.tpcNClsFound()); + rpiKkink.fill(HIST("tr_tpcnclfindD"), dauTrack.tpcNClsFound()); rpiKkink.fill(HIST("tr_itsChi2NClM"), mothTrack.itsChi2NCl()); } if (mothTrack.tpcChi2NCl() > tpcChi2Cut) continue; - if (mothTrack.tpcNClsFindable() > maxtpcncle || mothTrack.tpcNClsFindable() < mintpcncle) + if (mothTrack.tpcNClsFound() > maxtpcncle || mothTrack.tpcNClsFound() < mintpcncle) continue; if (std::abs(mothTrack.tpcNSigmaKa()) < cutNSigmaKa) { @@ -610,9 +611,9 @@ struct spectraKinkPiKa { rpiKkink.fill(HIST("h2_kinkradius_vs_vz"), kinkCand.zDecVtx(), radiusxy); rpiKkink.fill(HIST("h2_kink_vx_vs_vy"), kinkCand.xDecVtx(), kinkCand.yDecVtx()); rpiKkink.fill(HIST("h2_kinkradius_vs_pt"), radiusxy, v0.Pt()); - rpiKkink.fill(HIST("h2_kinkradius_vs_ncl"), radiusxy, mothTrack.tpcNClsFindable()); + rpiKkink.fill(HIST("h2_kinkradius_vs_ncl"), radiusxy, mothTrack.tpcNClsFound()); } - if (kinkCand.dcaMothPv() > dcaXYcut) + if (std::abs(kinkCand.dcaMothPv()) > dcaXYcut) continue; if (kinkCand.dcaKinkTopo() > dcaXYcutkink) @@ -632,12 +633,14 @@ struct spectraKinkPiKa { if (kaon && onlykaon && std::abs(v0.Rapidity()) < rapCut) { v0.SetCoordinates(mothTrack.px(), mothTrack.py(), mothTrack.pz(), o2::constants::physics::MassKaonCharged); - rpiKkink.fill(HIST("h2_moth_pt_vs_eta_rec"), v0.Pt(), v0.Eta(), multiplicity); - rpiKkink.fill(HIST("h2_dau_pt_vs_eta_rec"), v1.Pt(), v1.Eta(), multiplicity); - rpiKkink.fill(HIST("h2_pt_moth_vs_dau_rec"), v0.Pt(), v1.Pt()); - rpiKkink.fill(HIST("h2_kink_angle"), kinkangle, multiplicity); + if (additionalhist) { + rpiKkink.fill(HIST("h2_moth_pt_vs_eta_rec"), v0.Pt(), v0.Eta(), multiplicity); + rpiKkink.fill(HIST("h2_dau_pt_vs_eta_rec"), v1.Pt(), v1.Eta(), multiplicity); + rpiKkink.fill(HIST("h2_pt_moth_vs_dau_rec"), v0.Pt(), v1.Pt()); + rpiKkink.fill(HIST("h2_kink_angle"), kinkangle, multiplicity); + rpiKkink.fill(HIST("h2_qt_vs_pt"), ptd, v1.Pt()); + } double mass = computeMotherMass(v0, v1); - rpiKkink.fill(HIST("h2_qt_vs_pt"), ptd, v1.Pt()); rpiKkink.fill(HIST("h2_kaon_data"), mass, v0.Pt(), v0.Rapidity(), ptd, multiplicity); if (qa && ptd > minqt && ptd < maxqt) { @@ -650,8 +653,8 @@ struct spectraKinkPiKa { rpiKkink.fill(HIST("tr_chi2nclM_m"), mothTrack.tpcChi2NCl()); rpiKkink.fill(HIST("tr_chi2nclD_m"), dauTrack.tpcChi2NCl()); - rpiKkink.fill(HIST("tr_tpcnclfindM_m"), mothTrack.tpcNClsFindable()); - rpiKkink.fill(HIST("tr_tpcnclfindD_m"), dauTrack.tpcNClsFindable()); + rpiKkink.fill(HIST("tr_tpcnclfindM_m"), mothTrack.tpcNClsFound()); + rpiKkink.fill(HIST("tr_tpcnclfindD_m"), dauTrack.tpcNClsFound()); rpiKkink.fill(HIST("tr_itsChi2NClM_m"), mothTrack.itsChi2NCl()); rpiKkink.fill(HIST("tr_dcaxyM_m"), kinkCand.dcaMothPv()); @@ -659,17 +662,19 @@ struct spectraKinkPiKa { rpiKkink.fill(HIST("tr_dcaxykink_topo_m"), kinkCand.dcaKinkTopo()); rpiKkink.fill(HIST("h2_kinkradius_vs_pt"), radiusxy, v0.Pt()); - rpiKkink.fill(HIST("h2_kinkradius_vs_ncl"), radiusxy, mothTrack.tpcNClsFindable()); + rpiKkink.fill(HIST("h2_kinkradius_vs_ncl"), radiusxy, mothTrack.tpcNClsFound()); } } if (pion && onlypion && std::abs(v0.Rapidity()) < rapCut) { - rpiKkink.fill(HIST("h2_moth_pt_vs_eta_rec_pion"), v0.Pt(), v0.Eta(), multiplicity); - rpiKkink.fill(HIST("h2_dau_pt_vs_eta_rec_pion"), v1.Pt(), v1.Eta(), multiplicity); - rpiKkink.fill(HIST("h2_pt_moth_vs_dau_rec_pion"), v0.Pt(), v1.Pt()); - rpiKkink.fill(HIST("h2_kink_angle_pion"), kinkangle, multiplicity); v0.SetCoordinates(mothTrack.px(), mothTrack.py(), mothTrack.pz(), o2::constants::physics::MassPionCharged); + if (additionalhist) { + rpiKkink.fill(HIST("h2_moth_pt_vs_eta_rec_pion"), v0.Pt(), v0.Eta(), multiplicity); + rpiKkink.fill(HIST("h2_dau_pt_vs_eta_rec_pion"), v1.Pt(), v1.Eta(), multiplicity); + rpiKkink.fill(HIST("h2_pt_moth_vs_dau_rec_pion"), v0.Pt(), v1.Pt()); + rpiKkink.fill(HIST("h2_kink_angle_pion"), kinkangle, multiplicity); + rpiKkink.fill(HIST("h2_qt_vs_ptpion"), ptd, v1.Pt()); + } double mass = computeMotherMass(v0, v1); - rpiKkink.fill(HIST("h2_qt_vs_ptpion"), ptd, v1.Pt()); rpiKkink.fill(HIST("h2_pion_data"), mass, v0.Pt(), v0.Rapidity(), ptd, multiplicity); } } @@ -724,14 +729,14 @@ struct spectraKinkPiKa { rpiKkink.fill(HIST("tr_chi2nclM"), mothTrack.tpcChi2NCl()); rpiKkink.fill(HIST("tr_chi2nclD"), dauTrack.tpcChi2NCl()); - rpiKkink.fill(HIST("tr_tpcnclfindM"), mothTrack.tpcNClsFindable()); - rpiKkink.fill(HIST("tr_tpcnclfindD"), dauTrack.tpcNClsFindable()); + rpiKkink.fill(HIST("tr_tpcnclfindM"), mothTrack.tpcNClsFound()); + rpiKkink.fill(HIST("tr_tpcnclfindD"), dauTrack.tpcNClsFound()); rpiKkink.fill(HIST("tr_itsChi2NClM"), mothTrack.itsChi2NCl()); } if (mothTrack.tpcChi2NCl() > tpcChi2Cut) continue; - if (mothTrack.tpcNClsFindable() > maxtpcncle || mothTrack.tpcNClsFindable() < mintpcncle) + if (mothTrack.tpcNClsFound() > maxtpcncle || mothTrack.tpcNClsFound() < mintpcncle) continue; bool kaon = false; @@ -756,9 +761,9 @@ struct spectraKinkPiKa { rpiKkink.fill(HIST("h2_kink_vx_vs_vy"), kinkCand.xDecVtx(), kinkCand.yDecVtx()); rpiKkink.fill(HIST("h2_kinkradius_vs_pt"), radiusxy, v0.Pt()); - rpiKkink.fill(HIST("h2_kinkradius_vs_ncl"), radiusxy, mothTrack.tpcNClsFindable()); + rpiKkink.fill(HIST("h2_kinkradius_vs_ncl"), radiusxy, mothTrack.tpcNClsFound()); } - if (kinkCand.dcaMothPv() > dcaXYcut) + if (std::abs(kinkCand.dcaMothPv()) > dcaXYcut) continue; if (kinkCand.dcaKinkTopo() > dcaXYcutkink) @@ -771,12 +776,12 @@ struct spectraKinkPiKa { float radToDeg = o2::constants::math::Rad2Deg; if (kinkangle * radToDeg < kinkanglecut) continue; - - rpiKkink.fill(HIST("h2_moth_pt_vs_eta_rec"), v0.Pt(), v0.Eta(), multiplicity); - rpiKkink.fill(HIST("h2_dau_pt_vs_eta_rec"), v1.Pt(), v1.Eta(), multiplicity); - rpiKkink.fill(HIST("h2_pt_moth_vs_dau_rec"), v0.Pt(), v1.Pt()); - rpiKkink.fill(HIST("h2_kink_angle"), kinkangle, multiplicity); - + if (additionalhist) { + rpiKkink.fill(HIST("h2_moth_pt_vs_eta_rec"), v0.Pt(), v0.Eta(), multiplicity); + rpiKkink.fill(HIST("h2_dau_pt_vs_eta_rec"), v1.Pt(), v1.Eta(), multiplicity); + rpiKkink.fill(HIST("h2_pt_moth_vs_dau_rec"), v0.Pt(), v1.Pt()); + rpiKkink.fill(HIST("h2_kink_angle"), kinkangle, multiplicity); + } TVector3 pdlab(v1.Px(), v1.Py(), v1.Pz()); // Compute transverse component TVector3 motherDir(v0.Px(), v0.Py(), v0.Pz()); @@ -796,6 +801,7 @@ struct spectraKinkPiKa { auto mcTrackMoth = mcLabMoth.mcParticle_as(); auto mcTrackDau = mcLabDau.mcParticle_as(); + if (!mcTrackDau.has_mothers()) { continue; } @@ -806,10 +812,12 @@ struct spectraKinkPiKa { if (std::abs(mcTrackMoth.pdgCode()) != pid || std::abs(mcTrackDau.pdgCode()) != dpid) { continue; } - rpiKkink.fill(HIST("h2_moth_pt_vs_eta_rec_m"), v0.Pt(), v0.Eta(), multiplicity); - rpiKkink.fill(HIST("h2_dau_pt_vs_eta_rec_m"), v1.Pt(), v1.Eta(), multiplicity); - rpiKkink.fill(HIST("h2_pt_moth_vs_dau_rec_m"), v0.Pt(), v1.Pt()); - rpiKkink.fill(HIST("h2_kink_angle_m"), kinkangle, multiplicity); + if (additionalhist) { + rpiKkink.fill(HIST("h2_moth_pt_vs_eta_rec_m"), v0.Pt(), v0.Eta(), multiplicity); + rpiKkink.fill(HIST("h2_dau_pt_vs_eta_rec_m"), v1.Pt(), v1.Eta(), multiplicity); + rpiKkink.fill(HIST("h2_pt_moth_vs_dau_rec_m"), v0.Pt(), v1.Pt()); + rpiKkink.fill(HIST("h2_kink_angle_m"), kinkangle, multiplicity); + } rpiKkink.fill(HIST("h2_kaon_mc_rec_m"), mass, v0.Pt(), v0.Rapidity(), ptd, multiplicity); if (qa && ptd > minqt && ptd < maxqt) { @@ -822,8 +830,8 @@ struct spectraKinkPiKa { rpiKkink.fill(HIST("tr_chi2nclM_m"), mothTrack.tpcChi2NCl()); rpiKkink.fill(HIST("tr_chi2nclD_m"), dauTrack.tpcChi2NCl()); - rpiKkink.fill(HIST("tr_tpcnclfindM_m"), mothTrack.tpcNClsFindable()); - rpiKkink.fill(HIST("tr_tpcnclfindD_m"), dauTrack.tpcNClsFindable()); + rpiKkink.fill(HIST("tr_tpcnclfindM_m"), mothTrack.tpcNClsFound()); + rpiKkink.fill(HIST("tr_tpcnclfindD_m"), dauTrack.tpcNClsFound()); rpiKkink.fill(HIST("tr_itsChi2NClM_m"), mothTrack.itsChi2NCl()); rpiKkink.fill(HIST("tr_dcaxyM_m"), kinkCand.dcaMothPv()); @@ -831,7 +839,7 @@ struct spectraKinkPiKa { rpiKkink.fill(HIST("tr_dcaxykink_topo_m"), kinkCand.dcaKinkTopo()); rpiKkink.fill(HIST("h2_kinkradius_vs_pt_m"), radiusxy, v0.Pt()); - rpiKkink.fill(HIST("h2_kinkradius_vs_ncl_m"), radiusxy, mothTrack.tpcNClsFindable()); + rpiKkink.fill(HIST("h2_kinkradius_vs_ncl_m"), radiusxy, mothTrack.tpcNClsFound()); } } } @@ -842,13 +850,10 @@ struct spectraKinkPiKa { ROOT::Math::PxPyPzMVector v0; ROOT::Math::PxPyPzMVector v1; - if (!d0pid && (std::abs(mcPart.pdgCode()) != pid || std::abs(mcPart.eta()) > etaCut)) { - continue; - } - bool isDmeson = std::abs(mcPart.pdgCode()) == kD0 || std::abs(mcPart.pdgCode()) == kDPlus || std::abs(mcPart.pdgCode()) == kDStar; - if (d0pid && (!isDmeson || std::abs(mcPart.eta()) > etaCut)) { + if (std::abs(mcPart.pdgCode()) != pid) { continue; } + if (!mcPart.has_daughters()) { continue; // Skip if no daughters } @@ -863,16 +868,14 @@ struct spectraKinkPiKa { if (!hasKaonpionDaughter) { continue; // Skip if no muon daughter found } - if (!d0pid && pid == kKPlus) { + if (pid == kKPlus) { v0.SetCoordinates(mcPart.px(), mcPart.py(), mcPart.pz(), o2::constants::physics::MassKaonCharged); } - if (!d0pid && pid == kPiPlus) { + if (pid == kPiPlus) { v0.SetCoordinates(mcPart.px(), mcPart.py(), mcPart.pz(), o2::constants::physics::MassPionCharged); } - if (d0pid) { - v0.SetCoordinates(mcPart.px(), mcPart.py(), mcPart.pz(), o2::constants::physics::MassD0); - } + float pMoth = v0.P(); float pDaug = v1.P(); float spKink = v0.Px() * v1.Px() + v0.Py() * v1.Py() + v0.Pz() * v1.Pz(); @@ -880,10 +883,12 @@ struct spectraKinkPiKa { float radToDeg = o2::constants::math::Rad2Deg; if (kinkangle * radToDeg < kinkanglecut) continue; - rpiKkink.fill(HIST("h2_moth_pt_vs_eta_gen"), v0.Pt(), v0.Eta()); - rpiKkink.fill(HIST("h2_dau_pt_vs_eta_gen"), v1.Pt(), v1.Eta()); - rpiKkink.fill(HIST("h2_pt_moth_vs_dau_gen"), v0.Pt(), v1.Pt()); - rpiKkink.fill(HIST("h2_kink_angle_gen"), kinkangle); + if (additionalhist) { + rpiKkink.fill(HIST("h2_moth_pt_vs_eta_gen"), v0.Pt(), v0.Eta()); + rpiKkink.fill(HIST("h2_dau_pt_vs_eta_gen"), v1.Pt(), v1.Eta()); + rpiKkink.fill(HIST("h2_pt_moth_vs_dau_gen"), v0.Pt(), v1.Pt()); + rpiKkink.fill(HIST("h2_kink_angle_gen"), kinkangle); + } TVector3 pdlab(v1.Px(), v1.Py(), v1.Pz()); // Compute transverse component TVector3 motherDir(v0.Px(), v0.Py(), v0.Pz()); From e1ebbe57e9c207fb8172ac0317b3279dcf9b2acd Mon Sep 17 00:00:00 2001 From: Jesper Karlsson Gumprecht <113693781+jesgum@users.noreply.github.com> Date: Wed, 15 Oct 2025 15:53:59 +0200 Subject: [PATCH 764/986] [ALICE3] Add option to fasttrack primaries (#13325) --- ALICE3/TableProducer/OTF/onTheFlyTracker.cxx | 257 +++++++++++-------- 1 file changed, 147 insertions(+), 110 deletions(-) diff --git a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx index 1be815b2411..e77655680c4 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx @@ -148,6 +148,17 @@ struct OnTheFlyTracker { Configurable> pixelRes{"pixelRes", {0.00025, 0.00025, 0.001, 0.001}, "RPhiIT, ZIT, RPhiOT, ZOT"}; } fastTrackerSettings; // allows for gap between peak and bg in case someone wants to + struct : ConfigurableGroup { + std::string prefix = "fastPrimaryTrackerSettings"; + Configurable fastTrackPrimaries{"fastTrackPrimaries", false, "Use fasttracker for primary tracks. Enable with care"}; + Configurable minSiliconHits{"minSiliconHits", 4, "minimum number of silicon hits to accept track"}; + Configurable alice3geo{"alice3geo", "2", "0: ALICE 3 v1, 1: ALICE 3 v4, 2: ALICE 3 Sep 2025, or path to ccdb with a3 geo"}; + Configurable applyZacceptance{"applyZacceptance", false, "apply z limits to detector layers or not"}; + Configurable applyMSCorrection{"applyMSCorrection", true, "apply ms corrections for secondaries or not"}; + Configurable applyElossCorrection{"applyElossCorrection", true, "apply eloss corrections for secondaries or not"}; + Configurable applyEffCorrection{"applyEffCorrection", true, "apply efficiency correction or not"}; + } fastPrimaryTrackerSettings; + struct : ConfigurableGroup { std::string prefix = "cascadeDecaySettings"; // Cascade decay settings Configurable decayXi{"decayXi", false, "Manually decay Xi and fill tables with daughters"}; @@ -163,6 +174,7 @@ struct OnTheFlyTracker { // FastTracker machinery o2::fastsim::FastTracker fastTracker; + o2::fastsim::FastTracker fastPrimaryTracker; // Class to hold the track information for the O2 vertexing class TrackAlice3 : public o2::track::TrackParCov @@ -258,15 +270,17 @@ struct OnTheFlyTracker { LOG(fatal) << "Having issue with loading the LUT " << pdg << " " << lutFile; } }; - loadLUT(11, lutEl.value); - loadLUT(13, lutMu.value); - loadLUT(211, lutPi.value); - loadLUT(321, lutKa.value); - loadLUT(2212, lutPr.value); - loadLUT(1000010020, lutDe.value); - loadLUT(1000010030, lutTr.value); - loadLUT(1000020030, lutHe3.value); - loadLUT(1000020040, lutAl.value); + loadLUT(kElectron, lutEl.value); + loadLUT(kMuonMinus, lutMu.value); + loadLUT(kPiPlus, lutPi.value); + loadLUT(kKPlus, lutKa.value); + loadLUT(kProton, lutPr.value); + if (enableNucleiSmearing) { + loadLUT(o2::constants::physics::kDeuteron, lutDe.value); + loadLUT(o2::constants::physics::kTriton, lutTr.value); + loadLUT(o2::constants::physics::kHelium3, lutHe3.value); + loadLUT(o2::constants::physics::kAlpha, lutAl.value); + } // interpolate efficiencies if requested to do so mSmearer.interpolateEfficiency(static_cast(interpolateLutEfficiencyVsNch)); @@ -377,7 +391,6 @@ struct OnTheFlyTracker { // Cross-check LOGF(info, "Check field at (0, 0, 0): %.1f kG, nominal: %.1f", static_cast(fieldInstance->GetBz(0, 0, 0)), static_cast(field)); - LOGF(info, "Initializing empty material cylinder LUT - could be better in the future"); o2::base::MatLayerCylSet* lut = new o2::base::MatLayerCylSet(); lut->addLayer(200, 200.1, 2, 1.0f, 100.0f); @@ -430,6 +443,27 @@ struct OnTheFlyTracker { // print fastTracker settings fastTracker.Print(); } + + if (fastPrimaryTrackerSettings.fastTrackPrimaries) { + fastPrimaryTracker.SetMagneticField(magneticField); + fastPrimaryTracker.SetApplyZacceptance(fastPrimaryTrackerSettings.applyZacceptance); + fastPrimaryTracker.SetApplyMSCorrection(fastPrimaryTrackerSettings.applyMSCorrection); + fastPrimaryTracker.SetApplyElossCorrection(fastPrimaryTrackerSettings.applyElossCorrection); + + if (fastPrimaryTrackerSettings.alice3geo.value == "0") { + fastPrimaryTracker.AddSiliconALICE3v2({0.00025, 0.00025, 0.001, 0.001}); + } else if (fastPrimaryTrackerSettings.alice3geo.value == "1") { + fastPrimaryTracker.AddSiliconALICE3v4({0.00025, 0.00025, 0.001, 0.001}); + fastPrimaryTracker.AddTPC(0.1, 0.1); + } else if (fastPrimaryTrackerSettings.alice3geo.value == "2") { + fastPrimaryTracker.AddSiliconALICE3(1., {0.00025, 0.00025, 0.001, 0.001}); + } else { + fastPrimaryTracker.AddGenericDetector(fastPrimaryTrackerSettings.alice3geo, ccdb.operator->()); + } + + // print fastTracker settings + fastPrimaryTracker.Print(); + } } /// Function to decay the xi @@ -503,15 +537,16 @@ struct OnTheFlyTracker { auto ir = irSampler.generateCollisionTime(); const float eventCollisionTime = ir.timeInBCNS; - constexpr std::array longLivedHandledPDGs = {kElectron, + constexpr std::array longLivedHandledPDGs = {kElectron, kMuonMinus, kPiPlus, kKPlus, - kProton, - o2::constants::physics::kDeuteron, - o2::constants::physics::kTriton, - o2::constants::physics::kHelium3, - o2::constants::physics::kAlpha}; + kProton}; + + constexpr std::array nucleiPDGs = {o2::constants::physics::kDeuteron, + o2::constants::physics::kTriton, + o2::constants::physics::kHelium3, + o2::constants::physics::kAlpha}; // First we compute the number of charged particles in the event dNdEta = 0.f; @@ -519,18 +554,19 @@ struct OnTheFlyTracker { if (std::abs(mcParticle.eta()) > multEtaRange) { continue; } + if (!mcParticle.isPhysicalPrimary()) { continue; } + const auto pdg = std::abs(mcParticle.pdgCode()); const bool longLivedToBeHandled = std::find(longLivedHandledPDGs.begin(), longLivedHandledPDGs.end(), pdg) != longLivedHandledPDGs.end(); - if (!longLivedToBeHandled) { - if (!cascadeDecaySettings.decayXi) { - continue; - } else if (pdg != 3312) { - continue; - } + const bool nucleiToBeHandled = std::find(nucleiPDGs.begin(), nucleiPDGs.end(), pdg) != nucleiPDGs.end(); + const bool pdgsToBeHandled = longLivedToBeHandled || (enableNucleiSmearing && nucleiToBeHandled) || (cascadeDecaySettings.decayXi && mcParticle.pdgCode() == kXiMinus); + if (!pdgsToBeHandled) { + continue; } + const auto& pdgInfo = pdgDB->GetParticle(mcParticle.pdgCode()); if (!pdgInfo) { LOG(warning) << "PDG code " << mcParticle.pdgCode() << " not found in the database"; @@ -552,33 +588,28 @@ struct OnTheFlyTracker { double laDecayRadius2D = 0; std::vector decayProducts; std::vector xiDecayVertex, laDecayVertex; - std::vector layers = {0.50, 1.20, 2.50, 3.75, 7.00, 12.0, 20.0}; if (cascadeDecaySettings.decayXi) { - if (mcParticle.pdgCode() == 3312) { + if (mcParticle.pdgCode() == kXiMinus) { o2::track::TrackParCov xiTrackParCov; o2::upgrade::convertMCParticleToO2Track(mcParticle, xiTrackParCov, pdgDB); decayParticle(mcParticle, xiTrackParCov, decayProducts, xiDecayVertex, laDecayVertex); - xiDecayRadius2D = sqrt(xiDecayVertex[0] * xiDecayVertex[0] + xiDecayVertex[1] * xiDecayVertex[1]); - laDecayRadius2D = sqrt(laDecayVertex[0] * laDecayVertex[0] + laDecayVertex[1] * laDecayVertex[1]); + xiDecayRadius2D = std::hypot(xiDecayVertex[0], xiDecayVertex[1]); + laDecayRadius2D = std::hypot(laDecayVertex[0], laDecayVertex[1]); } } - const auto pdg = std::abs(mcParticle.pdgCode()); if (!mcParticle.isPhysicalPrimary()) { - if (!cascadeDecaySettings.decayXi) { - continue; - } else if (pdg != 3312) { - continue; - } + continue; } + + const auto pdg = std::abs(mcParticle.pdgCode()); const bool longLivedToBeHandled = std::find(longLivedHandledPDGs.begin(), longLivedHandledPDGs.end(), pdg) != longLivedHandledPDGs.end(); - if (!longLivedToBeHandled) { - if (!cascadeDecaySettings.decayXi) { - continue; - } else if (pdg != 3312) { - continue; - } + const bool nucleiToBeHandled = std::find(nucleiPDGs.begin(), nucleiPDGs.end(), pdg) != nucleiPDGs.end(); + const bool pdgsToBeHandled = longLivedToBeHandled || (enableNucleiSmearing && nucleiToBeHandled) || (cascadeDecaySettings.decayXi && mcParticle.pdgCode() == kXiMinus); + if (!pdgsToBeHandled) { + continue; } + if (std::fabs(mcParticle.eta()) > maxEta) { continue; } @@ -593,7 +624,7 @@ struct OnTheFlyTracker { if (TMath::Abs(mcParticle.pdgCode()) == 2212) histos.fill(HIST("hPtGeneratedPr"), mcParticle.pt()); - if (cascadeDecaySettings.doXiQA && mcParticle.pdgCode() == 3312) { + if (cascadeDecaySettings.doXiQA && mcParticle.pdgCode() == kXiMinus) { histos.fill(HIST("hGenXi"), xiDecayRadius2D, mcParticle.pt()); histos.fill(HIST("hGenPiFromXi"), xiDecayRadius2D, decayProducts[0].Pt()); histos.fill(HIST("hGenPiFromLa"), laDecayRadius2D, decayProducts[1].Pt()); @@ -613,24 +644,23 @@ struct OnTheFlyTracker { multiplicityCounter++; const float t = (eventCollisionTime + gRandom->Gaus(0., 100.)) * 1e-3; + const int nCascProngs = 3; std::vector xiDaughterTrackParCovsPerfect(3); std::vector xiDaughterTrackParCovsTracked(3); - std::vector isReco(3); - std::vector nHits(3); // total - std::vector nSiliconHits(3); // silicon type - std::vector nTPCHits(3); // TPC type - if (cascadeDecaySettings.decayXi && mcParticle.pdgCode() == 3312) { - if (cascadeDecaySettings.doXiQA) + std::vector isReco(nCascProngs); + std::vector nHits(nCascProngs); // total + std::vector nSiliconHits(nCascProngs); // silicon type + std::vector nTPCHits(nCascProngs); // TPC type + if (cascadeDecaySettings.decayXi && mcParticle.pdgCode() == kXiMinus) { + if (cascadeDecaySettings.doXiQA) { histos.fill(HIST("hXiBuilding"), 0.0f); - if (xiDecayRadius2D > 20) { - continue; } - o2::upgrade::convertTLorentzVectorToO2Track(-211, decayProducts[0], xiDecayVertex, xiDaughterTrackParCovsPerfect[0], pdgDB); - o2::upgrade::convertTLorentzVectorToO2Track(-211, decayProducts[1], laDecayVertex, xiDaughterTrackParCovsPerfect[1], pdgDB); - o2::upgrade::convertTLorentzVectorToO2Track(2212, decayProducts[2], laDecayVertex, xiDaughterTrackParCovsPerfect[2], pdgDB); + o2::upgrade::convertTLorentzVectorToO2Track(kPiMinus, decayProducts[0], xiDecayVertex, xiDaughterTrackParCovsPerfect[0], pdgDB); + o2::upgrade::convertTLorentzVectorToO2Track(kPiMinus, decayProducts[1], laDecayVertex, xiDaughterTrackParCovsPerfect[1], pdgDB); + o2::upgrade::convertTLorentzVectorToO2Track(kProton, decayProducts[2], laDecayVertex, xiDaughterTrackParCovsPerfect[2], pdgDB); - for (int i = 0; i < 3; i++) { + for (int i = 0; i < nCascProngs; i++) { isReco[i] = false; nHits[i] = 0; nSiliconHits[i] = 0; @@ -669,7 +699,7 @@ struct OnTheFlyTracker { } } - if (cascadeDecaySettings.doXiQA && mcParticle.pdgCode() == 3312) { + if (cascadeDecaySettings.doXiQA && mcParticle.pdgCode() == kXiMinus) { if (isReco[0] && isReco[1] && isReco[2]) { histos.fill(HIST("hXiBuilding"), 2.0f); histos.fill(HIST("hRecoXi"), xiDecayRadius2D, mcParticle.pt()); @@ -685,7 +715,7 @@ struct OnTheFlyTracker { // +-~-+-~-+-~-+-~-+-~-+-~-+-~-+-~-+-~-+-~-+-~-+-~-+-~-+ // combine particles into actual Xi candidate // cascade building starts here - if (cascadeDecaySettings.findXi && mcParticle.pdgCode() == 3312 && isReco[0] && isReco[1] && isReco[2]) { + if (cascadeDecaySettings.findXi && mcParticle.pdgCode() == kXiMinus && isReco[0] && isReco[1] && isReco[2]) { if (cascadeDecaySettings.doXiQA) histos.fill(HIST("hXiBuilding"), 3.0f); // assign indices of the particles we've used @@ -793,65 +823,67 @@ struct OnTheFlyTracker { if (cascadeDecaySettings.trackXi) { // optionally, add the points in the layers before the decay of the Xi // will back-track the perfect MC cascade to relevant layers, find hit, smear and add to smeared cascade - for (int i = layers.size() - 1; i >= 0; i--) { - if (thisCascade.cascradiusMC > layers[i]) { - // will add this layer, since cascade decayed after the corresponding radius - thisCascade.findableClusters++; // add to findable - - // find perfect intercept XYZ - float targetX = 1e+3; - trackParCov.getXatLabR(layers[i], targetX, magneticField); - if (targetX > 999) - continue; // failed to find intercept - - if (!trackParCov.propagateTo(targetX, magneticField)) { - continue; // failed to propagate - } - - // get potential cluster position - std::array posClusterCandidate; - trackParCov.getXYZGlo(posClusterCandidate); - float r{std::hypot(posClusterCandidate[0], posClusterCandidate[1])}; - float phi{std::atan2(-posClusterCandidate[1], -posClusterCandidate[0]) + o2::constants::math::PI}; - o2::fastsim::DetLayer currentTrackingLayer = fastTracker.GetLayer(i); - - if (currentTrackingLayer.getResolutionRPhi() > 1e-8 && currentTrackingLayer.getResolutionZ() > 1e-8) { // catch zero (though should not really happen...) - phi = gRandom->Gaus(phi, std::asin(currentTrackingLayer.getResolutionRPhi() / r)); - posClusterCandidate[0] = r * std::cos(phi); - posClusterCandidate[1] = r * std::sin(phi); - posClusterCandidate[2] = gRandom->Gaus(posClusterCandidate[2], currentTrackingLayer.getResolutionZ()); - } - - if (std::isnan(phi)) - continue; // Catch when getXatLabR misses layer[i] - - // towards adding cluster: move to track alpha - double alpha = cascadeTrack.getAlpha(); - double xyz1[3]{ - TMath::Cos(alpha) * posClusterCandidate[0] + TMath::Sin(alpha) * posClusterCandidate[1], - -TMath::Sin(alpha) * posClusterCandidate[0] + TMath::Cos(alpha) * posClusterCandidate[1], - posClusterCandidate[2]}; - - if (!(cascadeTrack.propagateTo(xyz1[0], magneticField))) - continue; - const o2::track::TrackParametrization::dim2_t hitpoint = { - static_cast(xyz1[1]), - static_cast(xyz1[2])}; - const o2::track::TrackParametrization::dim3_t hitpointcov = {currentTrackingLayer.getResolutionRPhi() * currentTrackingLayer.getResolutionRPhi(), 0.f, currentTrackingLayer.getResolutionZ() * currentTrackingLayer.getResolutionZ()}; - if (currentTrackingLayer.isInDeadPhiRegion(phi)) { - continue; // No hit for strangeness tracking update - } - - cascadeTrack.update(hitpoint, hitpointcov); - thisCascade.foundClusters++; // add to findable + for (int i = fastTracker.GetLayers().size() - 1; i >= 0; --i) { + o2::fastsim::DetLayer layer = fastTracker.GetLayer(i); + if (layer.isInert()) { + continue; // Not an active tracking layer + } + + if (thisCascade.cascradiusMC < layer.getRadius()) { + continue; // Cascade did not reach this layer } + + // cascade decayed after the corresponding radius + thisCascade.findableClusters++; // add to findable + + // find perfect intercept XYZ + float targetX = 1e+3; + trackParCov.getXatLabR(layer.getRadius(), targetX, magneticField); + if (targetX > 999) + continue; // failed to find intercept + + if (!trackParCov.propagateTo(targetX, magneticField)) { + continue; // failed to propagate + } + + // get potential cluster position + std::array posClusterCandidate; + trackParCov.getXYZGlo(posClusterCandidate); + float r{std::hypot(posClusterCandidate[0], posClusterCandidate[1])}; + float phi{std::atan2(-posClusterCandidate[1], -posClusterCandidate[0]) + o2::constants::math::PI}; + + if (layer.getResolutionRPhi() > 1e-8 && layer.getResolutionZ() > 1e-8) { // catch zero (though should not really happen...) + phi = gRandom->Gaus(phi, std::asin(layer.getResolutionRPhi() / r)); + posClusterCandidate[0] = r * std::cos(phi); + posClusterCandidate[1] = r * std::sin(phi); + posClusterCandidate[2] = gRandom->Gaus(posClusterCandidate[2], layer.getResolutionZ()); + } + + if (std::isnan(phi)) + continue; // Catch when getXatLabR misses layer[i] + + // towards adding cluster: move to track alpha + double alpha = cascadeTrack.getAlpha(); + double xyz1[3]{ + TMath::Cos(alpha) * posClusterCandidate[0] + TMath::Sin(alpha) * posClusterCandidate[1], + -TMath::Sin(alpha) * posClusterCandidate[0] + TMath::Cos(alpha) * posClusterCandidate[1], + posClusterCandidate[2]}; + + if (!(cascadeTrack.propagateTo(xyz1[0], magneticField))) + continue; + const o2::track::TrackParametrization::dim2_t hitpoint = {static_cast(xyz1[1]), static_cast(xyz1[2])}; + const o2::track::TrackParametrization::dim3_t hitpointcov = {layer.getResolutionRPhi() * layer.getResolutionRPhi(), 0.f, layer.getResolutionZ() * layer.getResolutionZ()}; + if (layer.isInDeadPhiRegion(phi)) { + continue; // No hit for strangeness tracking update + } + + cascadeTrack.update(hitpoint, hitpointcov); + thisCascade.foundClusters++; // add to findable } } // add cascade track - thisCascade.cascadeTrackId = lastTrackIndex + tracksAlice3.size(); // this is the next index to be filled -> should be it - tracksAlice3.push_back(TrackAlice3{cascadeTrack, mcParticle.globalIndex(), t, 100.f * 1e-3, false, false, 1, thisCascade.foundClusters}); if (cascadeDecaySettings.doXiQA) { @@ -870,8 +902,7 @@ struct OnTheFlyTracker { } } // end cascade building // +-~-+-~-+-~-+-~-+-~-+-~-+-~-+-~-+-~-+-~-+-~-+-~-+-~-+ - - continue; // Not filling the tables with the xi itself + continue; // Cascade handling done, should not be considered anymore } if (doExtraQA) { @@ -879,8 +910,15 @@ struct OnTheFlyTracker { } bool reconstructed = true; - if (enablePrimarySmearing) { + if (enablePrimarySmearing && !fastPrimaryTrackerSettings.fastTrackPrimaries) { reconstructed = mSmearer.smearTrack(trackParCov, mcParticle.pdgCode(), dNdEta); + } else if (fastPrimaryTrackerSettings.fastTrackPrimaries) { + o2::track::TrackParCov o2Track; + o2::upgrade::convertMCParticleToO2Track(mcParticle, o2Track, pdgDB); + int nHits = fastPrimaryTracker.FastTrack(o2Track, trackParCov, dNdEta); + if (nHits < fastPrimaryTrackerSettings.minSiliconHits) { + reconstructed = false; + } } if (!reconstructed && !processUnreconstructedTracks) { @@ -921,7 +959,6 @@ struct OnTheFlyTracker { // Calculate primary vertex with tracks from this collision // data preparation o2::vertexing::PVertex primaryVertex; - if (enablePrimaryVertexing) { std::vector lblTracks; std::vector vertices; From b7e0e121346b5f352b0934191531281b4c0ad2b5 Mon Sep 17 00:00:00 2001 From: Roman Lietava Date: Wed, 15 Oct 2025 17:56:34 +0200 Subject: [PATCH 765/986] [PWGLF] fix: avoiding run=0 (#13385) --- PWGLF/Tasks/Strangeness/nonPromptCascade.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx b/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx index 30932ca14a2..b575e26a972 100644 --- a/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx +++ b/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx @@ -735,10 +735,10 @@ struct NonPromptCascadeTask { aod::BCsWithTimestamps const&) { mProcessCounter[1]++; - fillMultHistos(collisions); zorroAccounting(collisions); fillCandidatesVector(collisions, tracks, cascades, gCandidatesNT); fillDataTable(gCandidatesNT); + fillMultHistos(collisions); } PROCESS_SWITCH(NonPromptCascadeTask, processCascadesData, "process cascades: Data analysis", false); }; From 88f0ceb4784ef067ce9fc49a7d58eacb3af64915 Mon Sep 17 00:00:00 2001 From: Oleksii Lubynets Date: Wed, 15 Oct 2025 18:13:42 +0200 Subject: [PATCH 766/986] [PWGHF] Refactor taskLc (#13091) --- PWGHF/D2H/Tasks/taskLc.cxx | 730 ++++++++++++++----------------------- 1 file changed, 271 insertions(+), 459 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskLc.cxx b/PWGHF/D2H/Tasks/taskLc.cxx index 68ff2ad4fa3..12463440087 100644 --- a/PWGHF/D2H/Tasks/taskLc.cxx +++ b/PWGHF/D2H/Tasks/taskLc.cxx @@ -18,6 +18,7 @@ /// \author Annalena Kalteyer , GSI Darmstadt /// \author Biao Zhang , Heidelberg University /// \author Ran Tu , Fudan University +/// \author Oleksii Lubynets , Heidelberg University, GSI Darmstadt #include "PWGHF/Core/CentralityEstimation.h" #include "PWGHF/Core/DecayChannels.h" @@ -60,12 +61,6 @@ using namespace o2::hf_centrality; using namespace o2::hf_occupancy; using namespace o2::hf_evsel; -enum class GapType { - GapA = 0, - GapC = 1, - DoubleGap = 2, -}; - /// Λc± → p± K∓ π± analysis task struct HfTaskLc { Configurable selectionFlagLc{"selectionFlagLc", 1, "Selection Flag for Lc"}; @@ -77,23 +72,13 @@ struct HfTaskLc { Configurable storeOccupancy{"storeOccupancy", true, "Flag to store occupancy information"}; Configurable occEstimator{"occEstimator", 2, "Occupancy estimation (None: 0, ITS: 1, FT0C: 2)"}; Configurable storeProperLifetime{"storeProperLifetime", false, "Flag to store proper lifetime"}; - - constexpr static float CtToProperLifetimePs = 1.f / o2::constants::physics::LightSpeedCm2PS; - constexpr static float NanoToPico = 1000.f; - - enum MlClasses : int { - MlClassBackground = 0, - MlClassPrompt, - MlClassNonPrompt, - NumberOfMlClasses - }; + // CCDB configuration Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable ccdbPathGrp{"ccdbPathGrp", "GLO/GRP/GRP", "Path of the grp file (Run 2)"}; Configurable ccdbPathGrpMag{"ccdbPathGrpMag", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object (Run 3)"}; - HfEventSelection hfEvSel; // event selection and monitoring - HfHelper hfHelper; + HfEventSelection hfEvSel; // event selection and monitoring SliceCache cache; Service ccdb; @@ -110,6 +95,7 @@ struct HfTaskLc { using LcCandidatesMc = soa::Filtered>; using LcCandidatesMlMc = soa::Filtered>; using McParticles3ProngMatched = soa::Join; + Filter filterSelectCandidates = aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLc; Preslice candLcPerCollision = aod::hf_cand::collisionId; PresliceUnsorted colPerMcCollision = aod::mcparticle::mcCollisionId; @@ -130,211 +116,154 @@ struct HfTaskLc { ConfigurableAxis thnConfigAxisOccupancy{"thnConfigAxisOccupancy", {14, 0, 14000}, "axis for centrality"}; ConfigurableAxis thnConfigAxisProperLifetime{"thnConfigAxisProperLifetime", {200, 0, 2}, "Proper lifetime, ps"}; - HistogramRegistry registry{ - "registry", - {/// mass candidate - {"Data/hMass", "3-prong candidates;inv. mass (p K #pi) (GeV/#it{c}^{2})", {HistType::kTH1F, {{600, 1.98, 2.58}}}}, - {"MC/reconstructed/signal/hMassRecSig", "3-prong candidates (matched);inv. mass (p K #pi) (GeV/#it{c}^{2})", {HistType::kTH1F, {{600, 1.98, 2.58}}}}, - {"MC/reconstructed/prompt/hMassRecSigPrompt", "3-prong candidates (matched, prompt);inv. mass (p K #pi) (GeV/#it{c}^{2})", {HistType::kTH1F, {{600, 1.98, 2.58}}}}, - {"MC/reconstructed/nonprompt/hMassRecSigNonPrompt", "3-prong candidates (matched, non-prompt);inv. mass (p K #pi) (GeV/#it{c}^{2})", {HistType::kTH1F, {{600, 1.98, 2.58}}}}, - /// pT - {"Data/hPt", "3-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - {"MC/reconstructed/signal/hPtRecSig", "3-prong candidates (matched);#it{p}_{T}^{rec.} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - {"MC/reconstructed/prompt/hPtRecSigPrompt", "3-prong candidates (matched, prompt);#it{p}_{T}^{rec.} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - {"MC/reconstructed/nonprompt/hPtRecSigNonPrompt", "3-prong candidates (matched, non-prompt);#it{p}_{T}^{rec.} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - {"MC/generated/signal/hPtGen", "MC particles (matched);#it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - {"MC/generated/prompt/hPtGenPrompt", "MC particles (matched, prompt);#it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - {"MC/generated/nonprompt/hPtGenNonPrompt", "MC particles (matched, non-prompt);#it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - {"MC/generated/signal/hPtGenSig", "3-prong candidates (matched);#it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - {"Data/hPtProng0", "3-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - {"MC/reconstructed/signal/hPtRecProng0Sig", "3-prong candidates (matched);prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - {"MC/reconstructed/prompt/hPtRecProng0SigPrompt", "3-prong candidates (matched, prompt);prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - {"MC/reconstructed/nonprompt/hPtRecProng0SigNonPrompt", "3-prong candidates (matched, non-prompt);prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - {"Data/hPtProng1", "3-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - {"MC/reconstructed/signal/hPtRecProng1Sig", "3-prong candidates (matched);prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - {"MC/reconstructed/prompt/hPtRecProng1SigPrompt", "3-prong candidates (matched, prompt);prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - {"MC/reconstructed/nonprompt/hPtRecProng1SigNonPrompt", "3-prong candidates (matched, non-prompt);prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - {"Data/hPtProng2", "3-prong candidates;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - {"MC/reconstructed/signal/hPtRecProng2Sig", "3-prong candidates (matched);prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - {"MC/reconstructed/prompt/hPtRecProng2SigPrompt", "3-prong candidates (matched, prompt);prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - {"MC/reconstructed/nonprompt/hPtRecProng2SigNonPrompt", "3-prong candidates (matched, non-prompt);prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - /// DCAxy to prim. vertex prongs - {"Data/hd0Prong0", "3-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{600, -0.4, 0.4}}}}, - {"MC/reconstructed/signal/hd0RecProng0Sig", "3-prong candidates (matched);prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{600, -0.4, 0.4}}}}, - {"MC/reconstructed/prompt/hd0RecProng0SigPrompt", "3-prong candidates (matched, prompt);prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{600, -0.4, 0.4}}}}, - {"MC/reconstructed/nonprompt/hd0RecProng0SigNonPrompt", "3-prong candidates (matched, non-prompt);prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{600, -0.4, 0.4}}}}, - {"Data/hd0Prong1", "3-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{600, -0.4, 0.4}}}}, - {"MC/reconstructed/signal/hd0RecProng1Sig", "3-prong candidates (matched);prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{600, -0.4, 0.4}}}}, - {"MC/reconstructed/prompt/hd0RecProng1SigPrompt", "3-prong candidates (matched, prompt);prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{600, -0.4, 0.4}}}}, - {"MC/reconstructed/nonprompt/hd0RecProng1SigNonPrompt", "3-prong candidates (matched, non-prompt);prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{600, -0.4, 0.4}}}}, - {"Data/hd0Prong2", "3-prong candidates;prong 2 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{600, -0.4, 0.4}}}}, - {"MC/reconstructed/signal/hd0RecProng2Sig", "3-prong candidates (matched);prong 2 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{600, -0.4, 0.4}}}}, - {"MC/reconstructed/prompt/hd0RecProng2SigPrompt", "3-prong candidates (matched, prompt);prong 2 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{600, -0.4, 0.4}}}}, - {"MC/reconstructed/nonprompt/hd0RecProng2SigNonPrompt", "3-prong candidates (matched, non-prompt);prong 2 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{600, -0.4, 0.4}}}}, - /// decay length candidate - {"Data/hDecLength", "3-prong candidates;decay length (cm);entries", {HistType::kTH1F, {{400, 0., 1.}}}}, - {"MC/reconstructed/signal/hDecLengthRecSig", "3-prong candidates (matched);decay length (cm);entries", {HistType::kTH1F, {{400, 0., 1.}}}}, - {"MC/reconstructed/prompt/hDecLengthRecSigPrompt", "3-prong candidates (matched, prompt);decay length (cm);entries", {HistType::kTH1F, {{400, 0., 1.}}}}, - {"MC/reconstructed/nonprompt/hDecLengthRecSigNonPrompt", "3-prong candidates (matched, non-prompt);decay length (cm);entries", {HistType::kTH1F, {{400, 0., 1.}}}}, - /// decay length xy candidate - {"Data/hDecLengthxy", "3-prong candidates;decay length xy (cm);entries", {HistType::kTH1F, {{400, 0., 1.}}}}, - {"MC/reconstructed/signal/hDecLengthxyRecSig", "3-prong candidates (matched);decay length xy (cm);entries", {HistType::kTH1F, {{400, 0., 1.}}}}, - {"MC/reconstructed/prompt/hDecLengthxyRecSigPrompt", "3-prong candidates (matched, prompt);decay length xy (cm);entries", {HistType::kTH1F, {{400, 0., 1.}}}}, - {"MC/reconstructed/nonprompt/hDecLengthxyRecSigNonPrompt", "3-prong candidates (matched, non-prompt);decay length xy (cm);entries", {HistType::kTH1F, {{400, 0., 1.}}}}, - /// proper lifetime - {"Data/hCt", "3-prong candidates;proper lifetime (#Lambda_{c}) * #it{c} (cm);entries", {HistType::kTH1F, {{100, 0., 0.2}}}}, - {"MC/reconstructed/signal/hCtRecSig", "3-prong candidates (matched);proper lifetime (#Lambda_{c}) * #it{c} (cm);entries", {HistType::kTH1F, {{100, 0., 0.2}}}}, - {"MC/reconstructed/prompt/hCtRecSigPrompt", "3-prong candidates (matched, prompt);proper lifetime (#Lambda_{c}) * #it{c} (cm);entries", {HistType::kTH1F, {{100, 0., 0.2}}}}, - {"MC/reconstructed/nonprompt/hCtRecSigNonPrompt", "3-prong candidates (matched, non-prompt);proper lifetime (#Lambda_{c}) * #it{c} (cm);entries", {HistType::kTH1F, {{100, 0., 0.2}}}}, - /// cosine of pointing angle - {"Data/hCPA", "3-prong candidates;cosine of pointing angle;entries", {HistType::kTH1F, {{110, -1.1, 1.1}}}}, - {"MC/reconstructed/signal/hCPARecSig", "3-prong candidates;cosine of pointing angle;entries", {HistType::kTH1F, {{110, -1.1, 1.1}}}}, - {"MC/reconstructed/prompt/hCPARecSigPrompt", "3-prong candidates;cosine of pointing angle;entries", {HistType::kTH1F, {{110, -1.1, 1.1}}}}, - {"MC/reconstructed/nonprompt/hCPARecSigNonPrompt", "3-prong candidates;cosine of pointing angle;entries", {HistType::kTH1F, {{110, -1.1, 1.1}}}}, - /// cosine of pointing angle xy - {"Data/hCPAxy", "3-prong candidates;cosine of pointing angle xy;entries", {HistType::kTH1F, {{110, -1.1, 1.1}}}}, - {"MC/reconstructed/signal/hCPAxyRecSig", "3-prong candidates;cosine of pointing angle xy;entries", {HistType::kTH1F, {{110, -1.1, 1.1}}}}, - {"MC/reconstructed/prompt/hCPAxyRecSigPrompt", "3-prong candidates;cosine of pointing angle xy;entries", {HistType::kTH1F, {{110, -1.1, 1.1}}}}, - {"MC/reconstructed/nonprompt/hCPAxyRecSigNonPrompt", "3-prong candidates;cosine of pointing angle xy;entries", {HistType::kTH1F, {{110, -1.1, 1.1}}}}, - /// Chi 2 PCA to sec. vertex - {"Data/hDca2", "3-prong candidates;prong Chi2PCA to sec. vertex (cm);entries", {HistType::kTH1F, {{400, 0., 20.}}}}, - {"MC/reconstructed/signal/hDca2RecSig", "3-prong candidates (matched);prong Chi2PCA to sec. vertex (cm);entries", {HistType::kTH1F, {{400, 0., 20.}}}}, - {"MC/reconstructed/prompt/hDca2RecSigPrompt", "3-prong candidates (matched);prong Chi2PCA to sec. vertex (cm);entries", {HistType::kTH1F, {{400, 0., 20.}}}}, - {"MC/reconstructed/nonprompt/hDca2RecSigNonPrompt", "3-prong candidates (matched);prong Chi2PCA to sec. vertex (cm);entries", {HistType::kTH1F, {{400, 0., 20.}}}}, - /// eta - {"Data/hEta", "3-prong candidates;#it{#eta};entries", {HistType::kTH1F, {{100, -2., 2.}}}}, - {"MC/reconstructed/signal/hEtaRecSig", "3-prong candidates (matched);#it{#eta};entries", {HistType::kTH1F, {{100, -2., 2.}}}}, - {"MC/reconstructed/prompt/hEtaRecSigPrompt", "3-prong candidates (matched, prompt);#it{#eta};entries", {HistType::kTH1F, {{100, -2., 2.}}}}, - {"MC/reconstructed/nonprompt/hEtaRecSigNonPrompt", "3-prong candidates (matched, non-prompt);#it{#eta};entries", {HistType::kTH1F, {{100, -2., 2.}}}}, - {"MC/generated/signal/hEtaGen", "MC particles (matched);#it{#eta};entries", {HistType::kTH1F, {{100, -2., 2.}}}}, - {"MC/generated/prompt/hEtaGenPrompt", "MC particles (matched, prompt);#it{#eta};entries", {HistType::kTH1F, {{100, -2., 2.}}}}, - {"MC/generated/nonprompt/hEtaGenNonPrompt", "MC particles (matched, non-prompt);#it{#eta};entries", {HistType::kTH1F, {{100, -2., 2.}}}}, - {"MC/generated/signal/hYGen", "MC particles (matched);#it{y};entries", {HistType::kTH1F, {{100, -2., 2.}}}}, - {"MC/generated/prompt/hYGenPrompt", "MC particles (matched, prompt);#it{y};entries", {HistType::kTH1F, {{100, -2., 2.}}}}, - {"MC/generated/nonprompt/hYGenNonPrompt", "MC particles (matched, non-prompt);#it{y};entries", {HistType::kTH1F, {{100, -2., 2.}}}}, - /// phi - {"Data/hPhi", "3-prong candidates;#it{#Phi};entries", {HistType::kTH1F, {{100, 0., 6.3}}}}, - {"MC/reconstructed/signal/hPhiRecSig", "3-prong candidates (matched);#it{#Phi};entries", {HistType::kTH1F, {{100, 0., 6.3}}}}, - {"MC/reconstructed/prompt/hPhiRecSigPrompt", "3-prong candidates (matched, prompt);#it{#Phi};entries", {HistType::kTH1F, {{100, 0., 6.3}}}}, - {"MC/reconstructed/nonprompt/hPhiRecSigNonPrompt", "3-prong candidates (matched, non-prompt);#it{#Phi};entries", {HistType::kTH1F, {{100, 0., 6.3}}}}, - {"MC/generated/signal/hPhiGen", "MC particles (matched);#it{#Phi};entries", {HistType::kTH1F, {{100, 0., 6.3}}}}, - {"MC/generated/prompt/hPhiGenPrompt", "MC particles (matched, prompt);#it{#Phi};entries", {HistType::kTH1F, {{100, 0., 6.3}}}}, - {"MC/generated/nonprompt/hPhiGenNonPrompt", "MC particles (matched, non-prompt);#it{#Phi};entries", {HistType::kTH1F, {{100, 0., 6.3}}}}}}; - + HistogramRegistry registry{"registry", {}}; HistogramRegistry qaRegistry{"QAHistos", {}, OutputObjHandlingPolicy::AnalysisObject}; + // Factors for conversion between units + constexpr static float CtToProperLifetimePs = 1.f / o2::constants::physics::LightSpeedCm2PS; + constexpr static float NanoToPico = 1000.f; + // Names of folders and suffixes for MC signal histograms + constexpr static std::string_view SignalFolders[] = {"signal", "prompt", "nonprompt"}; + constexpr static std::string_view SignalSuffixes[] = {"", "Prompt", "NonPrompt"}; + + enum MlClasses : int { + MlClassBackground = 0, + MlClassPrompt, + MlClassNonPrompt, + NumberOfMlClasses + }; + + enum SignalClasses : int { + Signal = 0, + Prompt, + NonPrompt + }; + + enum class GapType { + GapA = 0, + GapC = 1, + DoubleGap = 2, + }; + void init(InitContext&) { - std::array doprocess{doprocessDataStd, doprocessDataStdWithFT0C, doprocessDataStdWithFT0M, doprocessDataWithMl, doprocessDataWithMlWithFT0C, doprocessDataWithMlWithFT0M, doprocessMcStd, doprocessMcStdWithFT0C, doprocessMcStdWithFT0M, doprocessMcWithMl, doprocessMcWithMlWithFT0C, doprocessMcWithMlWithFT0M, doprocessDataWithMlWithUpc, doprocessDataStdWithUpc}; + const std::array doprocess{doprocessDataStd, doprocessDataStdWithFT0C, doprocessDataStdWithFT0M, doprocessDataWithMl, doprocessDataWithMlWithFT0C, doprocessDataWithMlWithFT0M, doprocessDataWithMlWithUpc, doprocessMcStd, doprocessMcStdWithFT0C, doprocessMcStdWithFT0M, doprocessMcWithMl, doprocessMcWithMlWithFT0C, doprocessMcWithMlWithFT0M, doprocessDataStdWithUpc}; if ((std::accumulate(doprocess.begin(), doprocess.end(), 0)) != 1) { LOGP(fatal, "no or more than one process function enabled! Please check your configuration!"); } + + const bool isData = doprocessDataStd || doprocessDataStdWithFT0C || doprocessDataStdWithFT0M || doprocessDataWithMl || doprocessDataWithMlWithFT0C || doprocessDataWithMlWithFT0M || doprocessDataWithMlWithUpc; + const bool isUpc = doprocessDataWithMlWithUpc || doprocessDataStdWithUpc; + + auto addHistogramsRec = [&](const std::string& histoName, const std::string& xAxisTitle, const std::string& yAxisTitle, const HistogramConfigSpec& configSpec) { + if (isData) { + registry.add(("Data/" + histoName).c_str(), ("3-prong candidates;" + xAxisTitle + ";" + yAxisTitle).c_str(), configSpec); + } else { + registry.add(("MC/reconstructed/signal/" + histoName + "RecSig").c_str(), ("3-prong candidates (matched);" + xAxisTitle + ";" + yAxisTitle).c_str(), configSpec); + registry.add(("MC/reconstructed/prompt/" + histoName + "RecSigPrompt").c_str(), ("3-prong candidates (matched, prompt);" + xAxisTitle + ";" + yAxisTitle).c_str(), configSpec); + registry.add(("MC/reconstructed/nonprompt/" + histoName + "RecSigNonPrompt").c_str(), ("3-prong candidates (matched, non-prompt);" + xAxisTitle + ";" + yAxisTitle).c_str(), configSpec); + } + }; + + auto addHistogramsGen = [&](const std::string& histoName, const std::string& xAxisTitle, const std::string& yAxisTitle, const HistogramConfigSpec& configSpec) { + if (!isData) { + registry.add(("MC/generated/signal/" + histoName + "Gen").c_str(), ("MC particles (matched);" + xAxisTitle + ";" + yAxisTitle).c_str(), configSpec); + registry.add(("MC/generated/prompt/" + histoName + "GenPrompt").c_str(), ("MC particles (matched, prompt);" + xAxisTitle + ";" + yAxisTitle).c_str(), configSpec); + registry.add(("MC/generated/nonprompt/" + histoName + "GenNonPrompt").c_str(), ("MC particles (matched, non-prompt);" + xAxisTitle + ";" + yAxisTitle).c_str(), configSpec); + } + }; + + /// mass candidate + addHistogramsRec("hMass", "inv. mass (p K #pi) (GeV/#it{c}^{2})", "", {HistType::kTH1F, {{600, 1.98, 2.58}}}); + /// pT + addHistogramsRec("hPt", "#it{p}_{T}^{rec.} (GeV/#it{c})", "entries", {HistType::kTH1F, {{360, 0., 36.}}}); + addHistogramsGen("hPt", "#it{p}_{T}^{gen.} (GeV/#it{c})", "entries", {HistType::kTH1F, {{360, 0., 36.}}}); + if (!isData) { + registry.add("MC/generated/signal/hPtGenSig", "3-prong candidates (matched);#it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}); + } + addHistogramsRec("hPtProng0", "prong 0 #it{p}_{T} (GeV/#it{c})", "entries", {HistType::kTH1F, {{360, 0., 36.}}}); + addHistogramsRec("hPtProng1", "prong 1 #it{p}_{T} (GeV/#it{c})", "entries", {HistType::kTH1F, {{360, 0., 36.}}}); + addHistogramsRec("hPtProng2", "prong 2 #it{p}_{T} (GeV/#it{c})", "entries", {HistType::kTH1F, {{360, 0., 36.}}}); + /// DCAxy to prim. vertex prongs + addHistogramsRec("hd0Prong0", "prong 0 DCAxy to prim. vertex (cm)", "entries", {HistType::kTH1F, {{600, -0.4, 0.4}}}); + addHistogramsRec("hd0Prong1", "prong 1 DCAxy to prim. vertex (cm)", "entries", {HistType::kTH1F, {{600, -0.4, 0.4}}}); + addHistogramsRec("hd0Prong2", "prong 2 DCAxy to prim. vertex (cm)", "entries", {HistType::kTH1F, {{600, -0.4, 0.4}}}); + /// decay length candidate + addHistogramsRec("hDecLength", "decay length (cm)", "entries", {HistType::kTH1F, {{400, 0., 1.}}}); + /// decay length xy candidate + addHistogramsRec("hDecLengthxy", "decay length xy (cm)", "entries", {HistType::kTH1F, {{400, 0., 1.}}}); + /// proper lifetime + addHistogramsRec("hCt", "proper lifetime (#Lambda_{c}) * #it{c} (cm)", "entries", {HistType::kTH1F, {{100, 0., 0.2}}}); + /// cosine of pointing angle + addHistogramsRec("hCPA", "cosine of pointing angle", "entries", {HistType::kTH1F, {{110, -1.1, 1.1}}}); + /// cosine of pointing angle xy + addHistogramsRec("hCPAxy", "cosine of pointing angle xy", "entries", {HistType::kTH1F, {{110, -1.1, 1.1}}}); + /// Chi 2 PCA to sec. vertex + addHistogramsRec("hDca2", "prong Chi2PCA to sec. vertex (cm)", "entries", {HistType::kTH1F, {{400, 0., 20.}}}); + /// eta + addHistogramsRec("hEta", "#it{#eta}", "entries", {HistType::kTH1F, {{100, -2., 2.}}}); + addHistogramsGen("hEta", "#it{#eta}", "entries", {HistType::kTH1F, {{100, -2., 2.}}}); + addHistogramsGen("hY", "#it{y}", "entries", {HistType::kTH1F, {{100, -2., 2.}}}); + /// phi + addHistogramsRec("hPhi", "#it{#Phi}", "entries", {HistType::kTH1F, {{100, 0., 6.3}}}); + addHistogramsGen("hPhi", "#it{#Phi}", "entries", {HistType::kTH1F, {{100, 0., 6.3}}}); + auto vbins = (std::vector)binsPt; /// mass candidate - registry.add("Data/hMassVsPtVsNPvContributors", "3-prong candidates;inv. mass (p K #pi) (GeV/#it{c}^{2}); p_{T}; Number of PV contributors", {HistType::kTH3F, {{600, 1.98, 2.58}, {vbins, "#it{p}_{T} (GeV/#it{c})"}, {5000, 0., 10000.}}}); - registry.add("Data/hMassVsPt", "3-prong candidates;inv. mass (p K #pi) (GeV/#it{c}^{2}); p_{T}", {HistType::kTH2F, {{600, 1.98, 2.58}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/signal/hMassVsPtRecSig", "3-prong candidates (matched);inv. mass (p K #pi) (GeV/#it{c}^{2}); p_{T}", {HistType::kTH2F, {{600, 1.98, 2.58}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/prompt/hMassVsPtRecSigPrompt", "3-prong candidates (matched, prompt);inv. mass (p K #pi) (GeV/#it{c}^{2}); p_{T}", {HistType::kTH2F, {{600, 1.98, 2.58}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/nonprompt/hMassVsPtRecSigNonPrompt", "3-prong candidates (matched, non-prompt);inv. mass (p K #pi) (GeV/#it{c}^{2}); p_{T}", {HistType::kTH2F, {{600, 1.98, 2.58}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + if (isData) { + registry.add("Data/hMassVsPtVsNPvContributors", "3-prong candidates;inv. mass (p K #pi) (GeV/#it{c}^{2}); p_{T}; Number of PV contributors", {HistType::kTH3F, {{600, 1.98, 2.58}, {vbins, "#it{p}_{T} (GeV/#it{c})"}, {5000, 0., 10000.}}}); + } + addHistogramsRec("hMassVsPt", "inv. mass (p K #pi) (GeV/#it{c}^{2})", "#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{600, 1.98, 2.58}, {vbins}}}); /// DCAxy to prim. vertex prongs - registry.add("Data/hd0VsPtProng0", "3-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{600, -0.4, 0.4}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/signal/hd0VsPtRecProng0Sig", "3-prong candidates (matched);prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{600, -0.4, 0.4}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/prompt/hd0VsPtRecProng0SigPrompt", "3-prong candidates (matched, prompt);prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{600, -0.4, 0.4}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/nonprompt/hd0VsPtRecProng0SigNonPrompt", "3-prong candidates (matched, non-prompt);prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{600, -0.4, 0.4}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/hd0VsPtProng1", "3-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{600, -0.4, 0.4}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/signal/hd0VsPtRecProng1Sig", "3-prong candidates (matched);prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{600, -0.4, 0.4}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/prompt/hd0VsPtRecProng1SigPrompt", "3-prong candidates (matched, prompt);prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{600, -0.4, 0.4}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/nonprompt/hd0VsPtRecProng1SigNonPrompt", "3-prong candidates (matched, non-prompt);prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{600, -0.4, 0.4}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/hd0VsPtProng2", "3-prong candidates;prong 2 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{600, -0.4, 0.4}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/signal/hd0VsPtRecProng2Sig", "3-prong candidates (matched);prong 2 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{600, -0.4, 0.4}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/prompt/hd0VsPtRecProng2SigPrompt", "3-prong candidates (matched, prompt);prong 2 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{600, -0.4, 0.4}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/nonprompt/hd0VsPtRecProng2SigNonPrompt", "3-prong candidates (matched, non-prompt);prong 2 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{600, -0.4, 0.4}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + addHistogramsRec("hd0VsPtProng0", "prong 0 DCAxy to prim. vertex (cm)", "#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{600, -0.4, 0.4}, {vbins}}}); + addHistogramsRec("hd0VsPtProng1", "prong 1 DCAxy to prim. vertex (cm)", "#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{600, -0.4, 0.4}, {vbins}}}); + addHistogramsRec("hd0VsPtProng2", "prong 2 DCAxy to prim. vertex (cm)", "#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{600, -0.4, 0.4}, {vbins}}}); /// decay length candidate - registry.add("Data/hDecLengthVsPt", "3-prong candidates;decay length (cm);entries", {HistType::kTH2F, {{400, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/signal/hDecLengthVsPtRecSig", "3-prong candidates (matched);decay length (cm);entries", {HistType::kTH2F, {{400, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/prompt/hDecLengthVsPtRecSigPrompt", "3-prong candidates (matched, prompt);decay length (cm);entries", {HistType::kTH2F, {{400, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/nonprompt/hDecLengthVsPtRecSigNonPrompt", "3-prong candidates (matched, non-prompt);decay length (cm);entries", {HistType::kTH2F, {{400, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + addHistogramsRec("hDecLengthVsPt", "decay length (cm)", "#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{400, 0., 1.}, {vbins}}}); /// decay length xy candidate - registry.add("Data/hDecLengthxyVsPt", "3-prong candidates;decay length xy(cm);entries", {HistType::kTH2F, {{400, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/signal/hDecLengthxyVsPtRecSig", "3-prong candidates (matched);decay length xy(cm);entries", {HistType::kTH2F, {{400, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/prompt/hDecLengthxyVsPtRecSigPrompt", "3-prong candidates (matched, prompt);decay length xy(cm);entries", {HistType::kTH2F, {{400, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/nonprompt/hDecLengthxyVsPtRecSigNonPrompt", "3-prong candidates (matched, non-prompt);decay length xy(cm);entries", {HistType::kTH2F, {{400, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + addHistogramsRec("hDecLengthxyVsPt", "decay length xy (cm)", "#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{400, 0., 1.}, {vbins}}}); /// proper lifetime - registry.add("Data/hCtVsPt", "3-prong candidates;proper lifetime (#Lambda_{c}) * #it{c} (cm);entries", {HistType::kTH2F, {{100, 0., 0.2}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/signal/hCtVsPtRecSig", "3-prong candidates (matched);proper lifetime (#Lambda_{c}) * #it{c} (cm);entries", {HistType::kTH2F, {{100, 0., 0.2}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/prompt/hCtVsPtRecSigPrompt", "3-prong candidates (matched, prompt);proper lifetime (#Lambda_{c}) * #it{c} (cm);entries", {HistType::kTH2F, {{100, 0., 0.2}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/nonprompt/hCtVsPtRecSigNonPrompt", "3-prong candidates (matched, non-prompt);proper lifetime (#Lambda_{c}) * #it{c} (cm);entries", {HistType::kTH2F, {{100, 0., 0.2}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + addHistogramsRec("hCtVsPt", "proper lifetime (#Lambda_{c}) * #it{c} (cm)", "#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{100, 0., 0.2}, {vbins}}}); /// cosine of pointing angle - registry.add("Data/hCPAVsPt", "3-prong candidates;cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/signal/hCPAVsPtRecSig", "3-prong candidates (matched);cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/prompt/hCPAVsPtRecSigPrompt", "3-prong candidates (matched, prompt);cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/nonprompt/hCPAVsPtRecSigNonPrompt", "3-prong candidates (matched, non-prompt);cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + addHistogramsRec("hCPAVsPt", "cosine of pointing angle", "#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins}}}); /// cosine of pointing angle xy - registry.add("Data/hCPAxyVsPt", "3-prong candidates;cosine of pointing angle xy;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/signal/hCPAxyVsPtRecSig", "3-prong candidates (matched);cosine of pointing angle xy;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/prompt/hCPAxyVsPtRecSigPrompt", "3-prong candidates (matched, prompt);cosine of pointing angle xy;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/nonprompt/hCPAxyVsPtRecSigNonPrompt", "3-prong candidates (matched, non-prompt);cosine of pointing angle xy;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + addHistogramsRec("hCPAxyVsPt", "cosine of pointing angle xy", "#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins}}}); /// Chi 2 PCA to sec. vertex - registry.add("Data/hDca2VsPt", "3-prong candidates;prong Chi2PCA to sec. vertex (cm);entries", {HistType::kTH2F, {{400, 0., 20.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/signal/hDca2VsPtRecSig", "3-prong candidates (matched);prong Chi2PCA to sec. vertex (cm);entries", {HistType::kTH2F, {{400, 0., 20.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/prompt/hDca2VsPtRecSigPrompt", "3-prong candidates (matched, prompt);prong Chi2PCA to sec. vertex (cm);entries", {HistType::kTH2F, {{400, 0., 20.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/nonprompt/hDca2VsPtRecSigNonPrompt", "3-prong candidates (matched, non-prompt);prong Chi2PCA to sec. vertex (cm);entries", {HistType::kTH2F, {{400, 0., 20.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + addHistogramsRec("hDca2VsPt", "prong Chi2PCA to sec. vertex (cm)", "#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{400, 0., 20.}, {vbins}}}); /// eta - registry.add("Data/hEtaVsPt", "3-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/signal/hEtaVsPtRecSig", "3-prong candidates (matched);candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/prompt/hEtaVsPtRecSigPrompt", "3-prong candidates (matched, prompt);candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/nonprompt/hEtaVsPtRecSigNonPrompt", "3-prong candidates (matched, non-prompt);candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/generated/signal/hEtaVsPtGenSig", "3-prong candidates (matched);candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/generated/prompt/hEtaVsPtGenSigPrompt", "3-prong candidates (matched, prompt);candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/generated/nonprompt/hEtaVsPtGenSigNonPrompt", "3-prong candidates (matched, non-prompt);candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + addHistogramsRec("hEtaVsPt", "candidate #it{#eta}", "#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{100, -2., 2.}, {vbins}}}); + addHistogramsGen("hEtaVsPt", "#it{#eta}", "#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{100, -2., 2.}, {vbins}}}); /// y - registry.add("MC/generated/signal/hYVsPtGenSig", "3-prong candidates (matched);candidate #it{y};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/generated/prompt/hYVsPtGenSigPrompt", "3-prong candidates (matched, prompt);candidate #it{y};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/generated/nonprompt/hYVsPtGenSigNonPrompt", "3-prong candidates (matched, non-prompt);candidate #it{y};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + addHistogramsGen("hYVsPt", "#it{y}", "#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{100, -2., 2.}, {vbins}}}); /// phi - registry.add("Data/hPhiVsPt", "3-prong candidates;candidate #it{#Phi};entries", {HistType::kTH2F, {{100, 0., 6.3}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/signal/hPhiVsPtRecSig", "3-prong candidates (matched);candidate #it{#Phi};entries", {HistType::kTH2F, {{100, 0., 6.3}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/prompt/hPhiVsPtRecSigPrompt", "3-prong candidates (matched, prompt);candidate #it{#Phi};entries", {HistType::kTH2F, {{100, 0., 6.3}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/nonprompt/hPhiVsPtRecSigNonPrompt", "3-prong candidates (matched, non-prompt);candidate #it{#Phi};entries", {HistType::kTH2F, {{100, 0., 6.3}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/generated/signal/hPhiVsPtGenSig", "3-prong candidates (matched);candidate #it{#Phi};entries", {HistType::kTH2F, {{100, 0., 6.3}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/generated/prompt/hPhiVsPtGenSigPrompt", "3-prong candidates (matched, prompt);candidate #it{#Phi};entries", {HistType::kTH2F, {{100, 0., 6.3}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/generated/nonprompt/hPhiVsPtGenSigNonPrompt", "3-prong candidates (matched, non-prompt);candidate #it{#Phi};entries", {HistType::kTH2F, {{100, 0., 6.3}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + addHistogramsRec("hPhiVsPt", "candidate #it{#Phi}", "#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{100, 0., 6.3}, {vbins}}}); + addHistogramsGen("hPhiVsPt", "#it{#Phi}", "#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{100, 0., 6.3}, {vbins}}}); /// selection status registry.add("hSelectionStatus", "3-prong candidates;selection status;entries", {HistType::kTH2F, {{5, -0.5, 4.5}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); /// impact parameter error - registry.add("Data/hImpParErrProng0", "3-prong candidates;prong 0 impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/hImpParErrProng1", "3-prong candidates;prong 1 impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/hImpParErrProng2", "3-prong candidates;prong 2 impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/signal/hImpParErrProng0Sig", "3-prong candidates (matched);prong 0 impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/prompt/hImpParErrProng0SigPrompt", "3-prong candidates (matched, prompt);prong 0 impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/nonprompt/hImpParErrProng0SigNonPrompt", "3-prong candidates (matched, non-prompt);prong 0 impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/signal/hImpParErrProng1Sig", "3-prong candidates (matched);prong 1 impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/prompt/hImpParErrProng1SigPrompt", "3-prong candidates (matched, prompt);prong 1 impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/nonprompt/hImpParErrProng1SigNonPrompt", "3-prong candidates (matched, non-prompt);prong 1 impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/signal/hImpParErrProng2Sig", "3-prong candidates (matched);prong 2 impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/prompt/hImpParErrProng2SigPrompt", "3-prong candidates (matched, prompt);prong 2 impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/nonprompt/hImpParErrProng2SigNonPrompt", "3-prong candidates (matched, non-prompt);prong 2 impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + addHistogramsRec("hImpParErrProng0VsPt", "prong 0 impact parameter error (cm)", "#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{100, -1., 1.}, {vbins}}}); + addHistogramsRec("hImpParErrProng1VsPt", "prong 1 impact parameter error (cm)", "#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{100, -1., 1.}, {vbins}}}); + addHistogramsRec("hImpParErrProng2VsPt", "prong 2 impact parameter error (cm)", "#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{100, -1., 1.}, {vbins}}}); /// decay length error - registry.add("Data/hDecLenErr", "3-prong candidates;decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/signal/hDecLenErrSig", "3-prong candidates (matched);decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/prompt/hDecLenErrSigPrompt", "3-prong candidates (matched, prompt);decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("MC/reconstructed/nonprompt/hDecLenErrSigNonPrompt", "3-prong candidates (matched, non-prompt);decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - - qaRegistry.add("Data/fitInfo/ampFT0A_vs_ampFT0C", "FT0-A vs FT0-C amplitude;FT0-A amplitude (a.u.);FT0-C amplitude (a.u.)", {HistType::kTH2F, {{2500, 0., 250}, {2500, 0., 250}}}); - qaRegistry.add("Data/zdc/energyZNA_vs_energyZNC", "ZNA vs ZNC common energy;E_{ZNA}^{common} (a.u.);E_{ZNC}^{common} (a.u.)", {HistType::kTH2F, {{200, 0., 20}, {200, 0., 20}}}); - qaRegistry.add("Data/hUpcGapAfterSelection", "UPC gap type after selection;Gap side;Counts", {HistType::kTH1F, {{3, -0.5, 2.5}}}); - qaRegistry.get(HIST("Data/hUpcGapAfterSelection"))->GetXaxis()->SetBinLabel(static_cast(GapType::GapA) + 1, "A"); - qaRegistry.get(HIST("Data/hUpcGapAfterSelection"))->GetXaxis()->SetBinLabel(static_cast(GapType::GapC) + 1, "C"); - qaRegistry.get(HIST("Data/hUpcGapAfterSelection"))->GetXaxis()->SetBinLabel(static_cast(GapType::DoubleGap) + 1, "Double"); + addHistogramsRec("hDecLenErrVsPt", "decay length error (cm)", "#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{100, 0., 1.}, {vbins}}}); + + if (isUpc) { + qaRegistry.add("Data/fitInfo/ampFT0A_vs_ampFT0C", "FT0-A vs FT0-C amplitude;FT0-A amplitude (a.u.);FT0-C amplitude (a.u.)", {HistType::kTH2F, {{2500, 0., 250}, {2500, 0., 250}}}); + qaRegistry.add("Data/zdc/energyZNA_vs_energyZNC", "ZNA vs ZNC common energy;E_{ZNA}^{common} (a.u.);E_{ZNC}^{common} (a.u.)", {HistType::kTH2F, {{200, 0., 20}, {200, 0., 20}}}); + qaRegistry.add("Data/hUpcGapAfterSelection", "UPC gap type after selection;Gap side;Counts", {HistType::kTH1F, {{3, -0.5, 2.5}}}); + qaRegistry.get(HIST("Data/hUpcGapAfterSelection"))->GetXaxis()->SetBinLabel(static_cast(GapType::GapA) + 1, "A"); + qaRegistry.get(HIST("Data/hUpcGapAfterSelection"))->GetXaxis()->SetBinLabel(static_cast(GapType::GapC) + 1, "C"); + qaRegistry.get(HIST("Data/hUpcGapAfterSelection"))->GetXaxis()->SetBinLabel(static_cast(GapType::DoubleGap) + 1, "Double"); + } if (fillTHn) { const AxisSpec thnAxisMass{thnConfigAxisMass, "inv. mass (p K #pi) (GeV/#it{c}^{2})"}; const AxisSpec thnAxisPt{thnConfigAxisPt, "#it{p}_{T}(#Lambda_{c}^{+}) (GeV/#it{c})"}; @@ -406,7 +335,9 @@ struct HfTaskLc { } } - hfEvSel.addHistograms(qaRegistry); // collision monitoring + if (isUpc) { + hfEvSel.addHistograms(qaRegistry); // collision monitoring + } ccdb->setURL(ccdbUrl); ccdb->setCaching(true); @@ -414,7 +345,7 @@ struct HfTaskLc { } /// Evaluate centrality/multiplicity percentile (centrality estimator is automatically selected based on the used table) - /// \param candidate is candidate + /// \param collision is collision /// \return centrality/multiplicity percentile of the collision template float evaluateCentralityColl(const Coll& collision) @@ -422,14 +353,62 @@ struct HfTaskLc { return o2::hf_centrality::getCentralityColl(collision); } + /// Helper function for filling MC reconstructed histograms for prompt, nonpromt and common (signal) + /// \param candidate is a reconstructed candidate + /// \tparam SignalType is an enum defining which histogram in which folder (signal, prompt or nonpromt) to fill + template + void fillHistogramsRecSig(CandidateType const& candidate) + { + const auto& mcParticleProng0 = candidate.template prong0_as().template mcParticle_as>(); + const auto pdgCodeProng0 = std::abs(mcParticleProng0.pdgCode()); + if ((candidate.isSelLcToPKPi() >= selectionFlagLc) && pdgCodeProng0 == kProton) { + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hMassRecSig") + HIST(SignalSuffixes[SignalType]), hfHelper.invMassLcToPKPi(candidate)); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hMassVsPtRecSig") + HIST(SignalSuffixes[SignalType]), hfHelper.invMassLcToPKPi(candidate), candidate.pt()); + } + if ((candidate.isSelLcToPiKP() >= selectionFlagLc) && pdgCodeProng0 == kPiPlus) { + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hMassRecSig") + HIST(SignalSuffixes[SignalType]), hfHelper.invMassLcToPiKP(candidate)); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hMassVsPtRecSig") + HIST(SignalSuffixes[SignalType]), hfHelper.invMassLcToPiKP(candidate), candidate.pt()); + } + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hPtRecSig") + HIST(SignalSuffixes[SignalType]), candidate.pt()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hPtProng0RecSig") + HIST(SignalSuffixes[SignalType]), candidate.ptProng0()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hPtProng1RecSig") + HIST(SignalSuffixes[SignalType]), candidate.ptProng1()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hPtProng2RecSig") + HIST(SignalSuffixes[SignalType]), candidate.ptProng2()); + + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hd0Prong0RecSig") + HIST(SignalSuffixes[SignalType]), candidate.impactParameter0()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hd0Prong1RecSig") + HIST(SignalSuffixes[SignalType]), candidate.impactParameter1()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hd0Prong2RecSig") + HIST(SignalSuffixes[SignalType]), candidate.impactParameter2()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hd0VsPtProng0RecSig") + HIST(SignalSuffixes[SignalType]), candidate.impactParameter0(), candidate.pt()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hd0VsPtProng1RecSig") + HIST(SignalSuffixes[SignalType]), candidate.impactParameter1(), candidate.pt()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hd0VsPtProng2RecSig") + HIST(SignalSuffixes[SignalType]), candidate.impactParameter2(), candidate.pt()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hDecLengthRecSig") + HIST(SignalSuffixes[SignalType]), candidate.decayLength()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hDecLengthVsPtRecSig") + HIST(SignalSuffixes[SignalType]), candidate.decayLength(), candidate.pt()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hDecLengthxyRecSig") + HIST(SignalSuffixes[SignalType]), candidate.decayLengthXY()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hDecLengthxyVsPtRecSig") + HIST(SignalSuffixes[SignalType]), candidate.decayLengthXY(), candidate.pt()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hCtRecSig") + HIST(SignalSuffixes[SignalType]), hfHelper.ctLc(candidate)); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hCtVsPtRecSig") + HIST(SignalSuffixes[SignalType]), hfHelper.ctLc(candidate), candidate.pt()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hCPARecSig") + HIST(SignalSuffixes[SignalType]), candidate.cpa()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hCPAVsPtRecSig") + HIST(SignalSuffixes[SignalType]), candidate.cpa(), candidate.pt()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hCPAxyRecSig") + HIST(SignalSuffixes[SignalType]), candidate.cpaXY()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hCPAxyVsPtRecSig") + HIST(SignalSuffixes[SignalType]), candidate.cpaXY(), candidate.pt()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hDca2RecSig") + HIST(SignalSuffixes[SignalType]), candidate.chi2PCA()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hDca2VsPtRecSig") + HIST(SignalSuffixes[SignalType]), candidate.chi2PCA(), candidate.pt()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hEtaRecSig") + HIST(SignalSuffixes[SignalType]), candidate.eta()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hEtaVsPtRecSig") + HIST(SignalSuffixes[SignalType]), candidate.eta(), candidate.pt()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hPhiRecSig") + HIST(SignalSuffixes[SignalType]), candidate.phi()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hPhiVsPtRecSig") + HIST(SignalSuffixes[SignalType]), candidate.phi(), candidate.pt()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hImpParErrProng0VsPtRecSig") + HIST(SignalSuffixes[SignalType]), candidate.errorImpactParameter0(), candidate.pt()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hImpParErrProng1VsPtRecSig") + HIST(SignalSuffixes[SignalType]), candidate.errorImpactParameter1(), candidate.pt()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hImpParErrProng2VsPtRecSig") + HIST(SignalSuffixes[SignalType]), candidate.errorImpactParameter2(), candidate.pt()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hDecLenErrVsPtRecSig") + HIST(SignalSuffixes[SignalType]), candidate.errorDecayLength(), candidate.pt()); + } + /// Fill MC histograms at reconstruction level - /// \tparam fillMl switch to fill ML histograms + /// \tparam FillMl switch to fill ML histograms template void fillHistosMcRec(CollType const& collision, CandLcMcRec const& candidates, CandLcMcGen const& mcParticles) { - - auto thisCollId = collision.globalIndex(); - auto groupedLcCandidates = candidates.sliceBy(candLcPerCollision, thisCollId); + const auto thisCollId = collision.globalIndex(); + const auto& groupedLcCandidates = candidates.sliceBy(candLcPerCollision, thisCollId); for (const auto& candidate : groupedLcCandidates) { /// Select Lc @@ -443,146 +422,34 @@ struct HfTaskLc { if (std::abs(candidate.flagMcMatchRec()) == hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi) { // Get the corresponding MC particle. - auto mcParticleProng0 = candidate.template prong0_as().template mcParticle_as>(); - auto pdgCodeProng0 = std::abs(mcParticleProng0.pdgCode()); - auto indexMother = RecoDecay::getMother(mcParticles, mcParticleProng0, o2::constants::physics::Pdg::kLambdaCPlus, true); - auto particleMother = mcParticles.rawIteratorAt(indexMother); + const auto& mcParticleProng0 = candidate.template prong0_as().template mcParticle_as>(); + const auto pdgCodeProng0 = std::abs(mcParticleProng0.pdgCode()); + const auto indexMother = RecoDecay::getMother(mcParticles, mcParticleProng0, o2::constants::physics::Pdg::kLambdaCPlus, true); + const auto particleMother = mcParticles.rawIteratorAt(indexMother); registry.fill(HIST("MC/generated/signal/hPtGenSig"), particleMother.pt()); // gen. level pT - auto pt = candidate.pt(); - auto ptProng0 = candidate.ptProng0(); - auto ptProng1 = candidate.ptProng1(); - auto ptProng2 = candidate.ptProng2(); - auto decayLength = candidate.decayLength(); - auto decayLengthXY = candidate.decayLengthXY(); - auto chi2PCA = candidate.chi2PCA(); - auto cpa = candidate.cpa(); - auto cpaXY = candidate.cpaXY(); - auto originType = candidate.originMcRec(); - auto numPvContributors = collision.numContrib(); - auto ptRecB = candidate.ptBhadMotherPart(); + const auto pt = candidate.pt(); + const auto ptProng0 = candidate.ptProng0(); + const auto ptProng1 = candidate.ptProng1(); + const auto ptProng2 = candidate.ptProng2(); + const auto decayLength = candidate.decayLength(); + const auto chi2PCA = candidate.chi2PCA(); + const auto cpa = candidate.cpa(); + const auto originType = candidate.originMcRec(); + const auto numPvContributors = collision.numContrib(); + const auto ptRecB = candidate.ptBhadMotherPart(); /// MC reconstructed signal - if ((candidate.isSelLcToPKPi() >= selectionFlagLc) && pdgCodeProng0 == kProton) { - registry.fill(HIST("MC/reconstructed/signal/hMassRecSig"), hfHelper.invMassLcToPKPi(candidate)); - registry.fill(HIST("MC/reconstructed/signal/hMassVsPtRecSig"), hfHelper.invMassLcToPKPi(candidate), pt); - } - if ((candidate.isSelLcToPiKP() >= selectionFlagLc) && pdgCodeProng0 == kPiPlus) { - registry.fill(HIST("MC/reconstructed/signal/hMassRecSig"), hfHelper.invMassLcToPiKP(candidate)); - registry.fill(HIST("MC/reconstructed/signal/hMassVsPtRecSig"), hfHelper.invMassLcToPiKP(candidate), pt); - } - registry.fill(HIST("MC/reconstructed/signal/hPtRecSig"), pt); - registry.fill(HIST("MC/reconstructed/signal/hPtRecProng0Sig"), ptProng0); - registry.fill(HIST("MC/reconstructed/signal/hPtRecProng1Sig"), ptProng1); - registry.fill(HIST("MC/reconstructed/signal/hPtRecProng2Sig"), ptProng2); - - registry.fill(HIST("MC/reconstructed/signal/hd0RecProng0Sig"), candidate.impactParameter0()); - registry.fill(HIST("MC/reconstructed/signal/hd0RecProng1Sig"), candidate.impactParameter1()); - registry.fill(HIST("MC/reconstructed/signal/hd0RecProng2Sig"), candidate.impactParameter2()); - registry.fill(HIST("MC/reconstructed/signal/hd0VsPtRecProng0Sig"), candidate.impactParameter0(), pt); - registry.fill(HIST("MC/reconstructed/signal/hd0VsPtRecProng1Sig"), candidate.impactParameter1(), pt); - registry.fill(HIST("MC/reconstructed/signal/hd0VsPtRecProng2Sig"), candidate.impactParameter2(), pt); - registry.fill(HIST("MC/reconstructed/signal/hDecLengthRecSig"), decayLength); - registry.fill(HIST("MC/reconstructed/signal/hDecLengthVsPtRecSig"), decayLength, pt); - registry.fill(HIST("MC/reconstructed/signal/hDecLengthxyRecSig"), decayLengthXY); - registry.fill(HIST("MC/reconstructed/signal/hDecLengthxyVsPtRecSig"), decayLengthXY, pt); - registry.fill(HIST("MC/reconstructed/signal/hCtRecSig"), hfHelper.ctLc(candidate)); - registry.fill(HIST("MC/reconstructed/signal/hCtVsPtRecSig"), hfHelper.ctLc(candidate), pt); - registry.fill(HIST("MC/reconstructed/signal/hCPARecSig"), cpa); - registry.fill(HIST("MC/reconstructed/signal/hCPAVsPtRecSig"), cpa, pt); - registry.fill(HIST("MC/reconstructed/signal/hCPAxyRecSig"), cpaXY); - registry.fill(HIST("MC/reconstructed/signal/hCPAxyVsPtRecSig"), cpaXY, pt); - registry.fill(HIST("MC/reconstructed/signal/hDca2RecSig"), chi2PCA); - registry.fill(HIST("MC/reconstructed/signal/hDca2VsPtRecSig"), chi2PCA, pt); - registry.fill(HIST("MC/reconstructed/signal/hEtaRecSig"), candidate.eta()); - registry.fill(HIST("MC/reconstructed/signal/hEtaVsPtRecSig"), candidate.eta(), pt); - registry.fill(HIST("MC/reconstructed/signal/hPhiRecSig"), candidate.phi()); - registry.fill(HIST("MC/reconstructed/signal/hPhiVsPtRecSig"), candidate.phi(), pt); - registry.fill(HIST("MC/reconstructed/signal/hImpParErrProng0Sig"), candidate.errorImpactParameter0(), pt); - registry.fill(HIST("MC/reconstructed/signal/hImpParErrProng1Sig"), candidate.errorImpactParameter1(), pt); - registry.fill(HIST("MC/reconstructed/signal/hImpParErrProng2Sig"), candidate.errorImpactParameter2(), pt); - registry.fill(HIST("MC/reconstructed/signal/hDecLenErrSig"), candidate.errorDecayLength(), pt); + fillHistogramsRecSig(candidate); /// reconstructed signal prompt if (candidate.originMcRec() == RecoDecay::OriginType::Prompt) { - if ((candidate.isSelLcToPKPi() >= selectionFlagLc) && pdgCodeProng0 == kProton) { - registry.fill(HIST("MC/reconstructed/prompt/hMassRecSigPrompt"), hfHelper.invMassLcToPKPi(candidate)); - registry.fill(HIST("MC/reconstructed/prompt/hMassVsPtRecSigPrompt"), hfHelper.invMassLcToPKPi(candidate), pt); - } - if ((candidate.isSelLcToPiKP() >= selectionFlagLc) && pdgCodeProng0 == kPiPlus) { - registry.fill(HIST("MC/reconstructed/prompt/hMassRecSigPrompt"), hfHelper.invMassLcToPiKP(candidate)); - registry.fill(HIST("MC/reconstructed/prompt/hMassVsPtRecSigPrompt"), hfHelper.invMassLcToPiKP(candidate), pt); - } - registry.fill(HIST("MC/reconstructed/prompt/hPtRecSigPrompt"), pt); - registry.fill(HIST("MC/reconstructed/prompt/hPtRecProng0SigPrompt"), ptProng0); - registry.fill(HIST("MC/reconstructed/prompt/hPtRecProng1SigPrompt"), ptProng1); - registry.fill(HIST("MC/reconstructed/prompt/hPtRecProng2SigPrompt"), ptProng2); - registry.fill(HIST("MC/reconstructed/prompt/hd0RecProng0SigPrompt"), candidate.impactParameter0()); - registry.fill(HIST("MC/reconstructed/prompt/hd0RecProng1SigPrompt"), candidate.impactParameter1()); - registry.fill(HIST("MC/reconstructed/prompt/hd0RecProng2SigPrompt"), candidate.impactParameter2()); - registry.fill(HIST("MC/reconstructed/prompt/hd0VsPtRecProng0SigPrompt"), candidate.impactParameter0(), pt); - registry.fill(HIST("MC/reconstructed/prompt/hd0VsPtRecProng1SigPrompt"), candidate.impactParameter1(), pt); - registry.fill(HIST("MC/reconstructed/prompt/hd0VsPtRecProng2SigPrompt"), candidate.impactParameter2(), pt); - registry.fill(HIST("MC/reconstructed/prompt/hDecLengthRecSigPrompt"), decayLength); - registry.fill(HIST("MC/reconstructed/prompt/hDecLengthVsPtRecSigPrompt"), decayLength, pt); - registry.fill(HIST("MC/reconstructed/prompt/hDecLengthxyRecSigPrompt"), decayLengthXY); - registry.fill(HIST("MC/reconstructed/prompt/hDecLengthxyVsPtRecSigPrompt"), decayLengthXY, pt); - registry.fill(HIST("MC/reconstructed/prompt/hCtRecSigPrompt"), hfHelper.ctLc(candidate)); - registry.fill(HIST("MC/reconstructed/prompt/hCtVsPtRecSigPrompt"), hfHelper.ctLc(candidate), pt); - registry.fill(HIST("MC/reconstructed/prompt/hCPARecSigPrompt"), cpa); - registry.fill(HIST("MC/reconstructed/prompt/hCPAVsPtRecSigPrompt"), cpa, pt); - registry.fill(HIST("MC/reconstructed/prompt/hCPAxyRecSigPrompt"), cpaXY); - registry.fill(HIST("MC/reconstructed/prompt/hCPAxyVsPtRecSigPrompt"), cpaXY, pt); - registry.fill(HIST("MC/reconstructed/prompt/hDca2RecSigPrompt"), chi2PCA); - registry.fill(HIST("MC/reconstructed/prompt/hDca2VsPtRecSigPrompt"), chi2PCA, pt); - registry.fill(HIST("MC/reconstructed/prompt/hEtaRecSigPrompt"), candidate.eta()); - registry.fill(HIST("MC/reconstructed/prompt/hEtaVsPtRecSigPrompt"), candidate.eta(), pt); - registry.fill(HIST("MC/reconstructed/prompt/hPhiRecSigPrompt"), candidate.phi()); - registry.fill(HIST("MC/reconstructed/prompt/hPhiVsPtRecSigPrompt"), candidate.phi(), pt); - registry.fill(HIST("MC/reconstructed/prompt/hImpParErrProng0SigPrompt"), candidate.errorImpactParameter0(), pt); - registry.fill(HIST("MC/reconstructed/prompt/hImpParErrProng1SigPrompt"), candidate.errorImpactParameter1(), pt); - registry.fill(HIST("MC/reconstructed/prompt/hImpParErrProng2SigPrompt"), candidate.errorImpactParameter2(), pt); - registry.fill(HIST("MC/reconstructed/prompt/hDecLenErrSigPrompt"), candidate.errorDecayLength(), pt); - } else { - if ((candidate.isSelLcToPKPi() >= selectionFlagLc) && pdgCodeProng0 == kProton) { - registry.fill(HIST("MC/reconstructed/nonprompt/hMassRecSigNonPrompt"), hfHelper.invMassLcToPKPi(candidate)); - registry.fill(HIST("MC/reconstructed/nonprompt/hMassVsPtRecSigNonPrompt"), hfHelper.invMassLcToPKPi(candidate), pt); - } - if ((candidate.isSelLcToPiKP() >= selectionFlagLc) && pdgCodeProng0 == kPiPlus) { - registry.fill(HIST("MC/reconstructed/nonprompt/hMassRecSigNonPrompt"), hfHelper.invMassLcToPiKP(candidate)); - registry.fill(HIST("MC/reconstructed/nonprompt/hMassVsPtRecSigNonPrompt"), hfHelper.invMassLcToPiKP(candidate), pt); - } - registry.fill(HIST("MC/reconstructed/nonprompt/hPtRecSigNonPrompt"), pt); - registry.fill(HIST("MC/reconstructed/nonprompt/hPtRecProng0SigNonPrompt"), ptProng0); - registry.fill(HIST("MC/reconstructed/nonprompt/hPtRecProng1SigNonPrompt"), ptProng1); - registry.fill(HIST("MC/reconstructed/nonprompt/hPtRecProng2SigNonPrompt"), ptProng2); - registry.fill(HIST("MC/reconstructed/nonprompt/hd0RecProng0SigNonPrompt"), candidate.impactParameter0()); - registry.fill(HIST("MC/reconstructed/nonprompt/hd0RecProng1SigNonPrompt"), candidate.impactParameter1()); - registry.fill(HIST("MC/reconstructed/nonprompt/hd0RecProng2SigNonPrompt"), candidate.impactParameter2()); - registry.fill(HIST("MC/reconstructed/nonprompt/hd0VsPtRecProng0SigNonPrompt"), candidate.impactParameter0(), pt); - registry.fill(HIST("MC/reconstructed/nonprompt/hd0VsPtRecProng1SigNonPrompt"), candidate.impactParameter1(), pt); - registry.fill(HIST("MC/reconstructed/nonprompt/hd0VsPtRecProng2SigNonPrompt"), candidate.impactParameter2(), pt); - registry.fill(HIST("MC/reconstructed/nonprompt/hDecLengthRecSigNonPrompt"), decayLength); - registry.fill(HIST("MC/reconstructed/nonprompt/hDecLengthVsPtRecSigNonPrompt"), decayLength, pt); - registry.fill(HIST("MC/reconstructed/nonprompt/hDecLengthxyRecSigNonPrompt"), decayLengthXY); - registry.fill(HIST("MC/reconstructed/nonprompt/hDecLengthxyVsPtRecSigNonPrompt"), decayLengthXY, pt); - registry.fill(HIST("MC/reconstructed/nonprompt/hCtRecSigNonPrompt"), hfHelper.ctLc(candidate)); - registry.fill(HIST("MC/reconstructed/nonprompt/hCtVsPtRecSigNonPrompt"), hfHelper.ctLc(candidate), pt); - registry.fill(HIST("MC/reconstructed/nonprompt/hCPARecSigNonPrompt"), cpa); - registry.fill(HIST("MC/reconstructed/nonprompt/hCPAVsPtRecSigNonPrompt"), cpa, pt); - registry.fill(HIST("MC/reconstructed/nonprompt/hCPAxyRecSigNonPrompt"), cpaXY); - registry.fill(HIST("MC/reconstructed/nonprompt/hCPAxyVsPtRecSigNonPrompt"), cpaXY, pt); - registry.fill(HIST("MC/reconstructed/nonprompt/hDca2RecSigNonPrompt"), chi2PCA); - registry.fill(HIST("MC/reconstructed/nonprompt/hDca2VsPtRecSigNonPrompt"), chi2PCA, pt); - registry.fill(HIST("MC/reconstructed/nonprompt/hEtaRecSigNonPrompt"), candidate.eta()); - registry.fill(HIST("MC/reconstructed/nonprompt/hEtaVsPtRecSigNonPrompt"), candidate.eta(), pt); - registry.fill(HIST("MC/reconstructed/nonprompt/hPhiRecSigNonPrompt"), candidate.phi()); - registry.fill(HIST("MC/reconstructed/nonprompt/hPhiVsPtRecSigNonPrompt"), candidate.phi(), pt); - registry.fill(HIST("MC/reconstructed/nonprompt/hImpParErrProng0SigNonPrompt"), candidate.errorImpactParameter0(), pt); - registry.fill(HIST("MC/reconstructed/nonprompt/hImpParErrProng1SigNonPrompt"), candidate.errorImpactParameter1(), pt); - registry.fill(HIST("MC/reconstructed/nonprompt/hImpParErrProng2SigNonPrompt"), candidate.errorImpactParameter2(), pt); - registry.fill(HIST("MC/reconstructed/nonprompt/hDecLenErrSigNonPrompt"), candidate.errorDecayLength(), pt); + fillHistogramsRecSig(candidate); + /// reconstructed signal nonprompt + } else if (candidate.originMcRec() == RecoDecay::OriginType::NonPrompt) { + fillHistogramsRecSig(candidate); } + if (fillTHn) { float const cent = evaluateCentralityColl(collision); float occ{-1.}; @@ -592,14 +459,15 @@ struct HfTaskLc { double massLc(-1); double outputBkg(-1), outputPrompt(-1), outputFD(-1); const float properLifetime = hfHelper.ctLc(candidate) * CtToProperLifetimePs; - if ((candidate.isSelLcToPKPi() >= selectionFlagLc) && pdgCodeProng0 == kProton) { - massLc = hfHelper.invMassLcToPKPi(candidate); + + auto fillTHnRecSig = [&](bool isPKPi) { + massLc = isPKPi ? hfHelper.invMassLcToPKPi(candidate) : hfHelper.invMassLcToPiKP(candidate); if constexpr (FillMl) { if (candidate.mlProbLcToPKPi().size() == NumberOfMlClasses) { - outputBkg = candidate.mlProbLcToPKPi()[MlClassBackground]; /// bkg score - outputPrompt = candidate.mlProbLcToPKPi()[MlClassPrompt]; /// prompt score - outputFD = candidate.mlProbLcToPKPi()[MlClassNonPrompt]; /// non-prompt score + outputBkg = isPKPi ? candidate.mlProbLcToPKPi()[MlClassBackground] : candidate.mlProbLcToPiKP()[MlClassBackground]; /// bkg score + outputPrompt = isPKPi ? candidate.mlProbLcToPKPi()[MlClassPrompt] : candidate.mlProbLcToPiKP()[MlClassPrompt]; /// prompt score + outputFD = isPKPi ? candidate.mlProbLcToPKPi()[MlClassNonPrompt] : candidate.mlProbLcToPiKP()[MlClassNonPrompt]; /// non-prompt score } /// Fill the ML outputScores and variables of candidate std::vector valuesToFill{massLc, pt, cent, outputBkg, outputPrompt, outputFD, static_cast(numPvContributors), ptRecB, static_cast(originType)}; @@ -620,43 +488,35 @@ struct HfTaskLc { } registry.get(HIST("hnLcVars"))->Fill(valuesToFill.data()); } + }; + + if ((candidate.isSelLcToPKPi() >= selectionFlagLc) && pdgCodeProng0 == kProton) { + fillTHnRecSig(true); } if ((candidate.isSelLcToPiKP() >= selectionFlagLc) && pdgCodeProng0 == kPiPlus) { - massLc = hfHelper.invMassLcToPiKP(candidate); - - if constexpr (FillMl) { - if (candidate.mlProbLcToPiKP().size() == NumberOfMlClasses) { - outputBkg = candidate.mlProbLcToPiKP()[MlClassBackground]; /// bkg score - outputPrompt = candidate.mlProbLcToPiKP()[MlClassPrompt]; /// prompt score - outputFD = candidate.mlProbLcToPiKP()[MlClassNonPrompt]; /// non-prompt score - } - /// Fill the ML outputScores and variables of candidate (todo: add multiplicity) - std::vector valuesToFill{massLc, pt, cent, outputBkg, outputPrompt, outputFD, static_cast(numPvContributors), ptRecB, static_cast(originType)}; - if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) { - valuesToFill.push_back(occ); - } - if (storeProperLifetime) { - valuesToFill.push_back(properLifetime); - } - registry.get(HIST("hnLcVarsWithBdt"))->Fill(valuesToFill.data()); - } else { - std::vector valuesToFill{massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, static_cast(numPvContributors), ptRecB, static_cast(originType)}; - if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) { - valuesToFill.push_back(occ); - } - if (storeProperLifetime) { - valuesToFill.push_back(properLifetime); - } - registry.get(HIST("hnLcVars"))->Fill(valuesToFill.data()); - } + fillTHnRecSig(false); } } } } } + /// Helper function for filling MC generated histograms for prompt, nonpromt and common (signal) + /// \param particle is a generated particle + /// \tparam SignalType is an enum defining which histogram in which folder (signal, prompt or nonpromt) to fill + template + void fillHistogramsGen(ParticleType const& particle) + { + registry.fill(HIST("MC/generated/") + HIST(SignalFolders[SignalType]) + HIST("/hPtGen") + HIST(SignalSuffixes[SignalType]), particle.pt()); + registry.fill(HIST("MC/generated/") + HIST(SignalFolders[SignalType]) + HIST("/hEtaGen") + HIST(SignalSuffixes[SignalType]), particle.eta()); + registry.fill(HIST("MC/generated/") + HIST(SignalFolders[SignalType]) + HIST("/hYGen") + HIST(SignalSuffixes[SignalType]), RecoDecay::y(particle.pVector(), o2::constants::physics::MassLambdaCPlus)); + registry.fill(HIST("MC/generated/") + HIST(SignalFolders[SignalType]) + HIST("/hPhiGen") + HIST(SignalSuffixes[SignalType]), particle.phi()); + registry.fill(HIST("MC/generated/") + HIST(SignalFolders[SignalType]) + HIST("/hEtaVsPtGen") + HIST(SignalSuffixes[SignalType]), particle.eta(), particle.pt()); + registry.fill(HIST("MC/generated/") + HIST(SignalFolders[SignalType]) + HIST("/hYVsPtGen") + HIST(SignalSuffixes[SignalType]), RecoDecay::y(particle.pVector(), o2::constants::physics::MassLambdaCPlus), particle.pt()); + registry.fill(HIST("MC/generated/") + HIST(SignalFolders[SignalType]) + HIST("/hPhiVsPtGen") + HIST(SignalSuffixes[SignalType]), particle.phi(), particle.pt()); + } + /// Fill MC histograms at generated level - /// \tparam fillMl switch to fill ML histograms template void fillHistosMcGen(CandLcMcGen const& mcParticles, Coll const& recoCollisions) { @@ -667,8 +527,8 @@ struct HfTaskLc { if (yCandGenMax >= 0. && std::abs(yGen) > yCandGenMax) { continue; } - auto ptGen = particle.pt(); - auto originType = particle.originMcGen(); + const auto ptGen = particle.pt(); + const auto originType = particle.originMcGen(); float ptGenB = -1.; unsigned int numPvContributors = 0; const auto& recoCollsPerMcColl = recoCollisions.sliceBy(colPerMcCollision, particle.mcCollision().globalIndex()); @@ -681,40 +541,16 @@ struct HfTaskLc { occ = o2::hf_occupancy::getOccupancyGenColl(recoCollsPerMcColl, occEstimator); } - const auto mcDaughter0 = particle.template daughters_as>().begin(); + const auto& mcDaughter0 = particle.template daughters_as>().begin(); const float p2m = particle.p() / o2::constants::physics::MassLambdaCPlus; const float gamma = std::sqrt(1 + p2m * p2m); // mother's particle Lorentz factor const float properLifetime = mcDaughter0.vt() * NanoToPico / gamma; // from ns to ps * from lab time to proper time - registry.fill(HIST("MC/generated/signal/hPtGen"), ptGen); - registry.fill(HIST("MC/generated/signal/hEtaGen"), particle.eta()); - registry.fill(HIST("MC/generated/signal/hYGen"), yGen); - registry.fill(HIST("MC/generated/signal/hPhiGen"), particle.phi()); - registry.fill(HIST("MC/generated/signal/hEtaVsPtGenSig"), particle.eta(), ptGen); - registry.fill(HIST("MC/generated/signal/hYVsPtGenSig"), yGen, ptGen); - registry.fill(HIST("MC/generated/signal/hPhiVsPtGenSig"), particle.phi(), ptGen); + fillHistogramsGen(particle); + + auto fillTHnGen = [&](bool isPrompt) { + ptGenB = isPrompt ? -1. : mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt(); - if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { - if (fillTHn) { - std::vector valuesToFill{ptGen, cent, yGen, static_cast(numPvContributors), ptGenB, static_cast(originType)}; - if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) { - valuesToFill.push_back(occ); - } - if (storeProperLifetime) { - valuesToFill.push_back(properLifetime); - } - registry.get(HIST("hnLcVarsGen"))->Fill(valuesToFill.data()); - } - registry.fill(HIST("MC/generated/prompt/hPtGenPrompt"), ptGen); - registry.fill(HIST("MC/generated/prompt/hEtaGenPrompt"), particle.eta()); - registry.fill(HIST("MC/generated/prompt/hYGenPrompt"), yGen); - registry.fill(HIST("MC/generated/prompt/hPhiGenPrompt"), particle.phi()); - registry.fill(HIST("MC/generated/prompt/hEtaVsPtGenSigPrompt"), particle.eta(), ptGen); - registry.fill(HIST("MC/generated/prompt/hYVsPtGenSigPrompt"), yGen, ptGen); - registry.fill(HIST("MC/generated/prompt/hPhiVsPtGenSigPrompt"), particle.phi(), ptGen); - } - if (particle.originMcGen() == RecoDecay::OriginType::NonPrompt) { - ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt(); if (fillTHn) { std::vector valuesToFill{ptGen, cent, yGen, static_cast(numPvContributors), ptGenB, static_cast(originType)}; if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) { @@ -725,26 +561,27 @@ struct HfTaskLc { } registry.get(HIST("hnLcVarsGen"))->Fill(valuesToFill.data()); } - registry.fill(HIST("MC/generated/nonprompt/hPtGenNonPrompt"), ptGen); - registry.fill(HIST("MC/generated/nonprompt/hEtaGenNonPrompt"), particle.eta()); - registry.fill(HIST("MC/generated/nonprompt/hYGenNonPrompt"), yGen); - registry.fill(HIST("MC/generated/nonprompt/hPhiGenNonPrompt"), particle.phi()); - registry.fill(HIST("MC/generated/nonprompt/hEtaVsPtGenSigNonPrompt"), particle.eta(), ptGen); - registry.fill(HIST("MC/generated/nonprompt/hYVsPtGenSigNonPrompt"), yGen, ptGen); - registry.fill(HIST("MC/generated/nonprompt/hPhiVsPtGenSigNonPrompt"), particle.phi(), ptGen); + }; + + if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { + fillTHnGen(true); + fillHistogramsGen(particle); + } else if (particle.originMcGen() == RecoDecay::OriginType::NonPrompt) { + fillTHnGen(false); + fillHistogramsGen(particle); } } } } /// Fill histograms for real data - /// \tparam fillMl switch to fill ML histograms + /// \tparam FillMl switch to fill ML histograms template void fillHistosData(CollType const& collision, CandType const& candidates) { - auto thisCollId = collision.globalIndex(); - auto groupedLcCandidates = candidates.sliceBy(candLcPerCollision, thisCollId); - auto numPvContributors = collision.numContrib(); + const auto thisCollId = collision.globalIndex(); + const auto& groupedLcCandidates = candidates.sliceBy(candLcPerCollision, thisCollId); + const auto numPvContributors = collision.numContrib(); for (const auto& candidate : groupedLcCandidates) { if (!(candidate.hfflag() & 1 << aod::hf_cand_3prong::DecayType::LcToPKPi)) { @@ -753,15 +590,15 @@ struct HfTaskLc { if (yCandRecoMax >= 0. && std::abs(hfHelper.yLc(candidate)) > yCandRecoMax) { continue; } - auto pt = candidate.pt(); - auto ptProng0 = candidate.ptProng0(); - auto ptProng1 = candidate.ptProng1(); - auto ptProng2 = candidate.ptProng2(); - auto decayLength = candidate.decayLength(); - auto decayLengthXY = candidate.decayLengthXY(); - auto chi2PCA = candidate.chi2PCA(); - auto cpa = candidate.cpa(); - auto cpaXY = candidate.cpaXY(); + const auto pt = candidate.pt(); + const auto ptProng0 = candidate.ptProng0(); + const auto ptProng1 = candidate.ptProng1(); + const auto ptProng2 = candidate.ptProng2(); + const auto decayLength = candidate.decayLength(); + const auto decayLengthXY = candidate.decayLengthXY(); + const auto chi2PCA = candidate.chi2PCA(); + const auto cpa = candidate.cpa(); + const auto cpaXY = candidate.cpaXY(); if (candidate.isSelLcToPKPi() >= selectionFlagLc) { registry.fill(HIST("Data/hMass"), hfHelper.invMassLcToPKPi(candidate)); @@ -801,10 +638,10 @@ struct HfTaskLc { registry.fill(HIST("Data/hPhiVsPt"), candidate.phi(), pt); registry.fill(HIST("hSelectionStatus"), candidate.isSelLcToPKPi(), pt); registry.fill(HIST("hSelectionStatus"), candidate.isSelLcToPiKP(), pt); - registry.fill(HIST("Data/hImpParErrProng0"), candidate.errorImpactParameter0(), pt); - registry.fill(HIST("Data/hImpParErrProng1"), candidate.errorImpactParameter1(), pt); - registry.fill(HIST("Data/hImpParErrProng2"), candidate.errorImpactParameter2(), pt); - registry.fill(HIST("Data/hDecLenErr"), candidate.errorDecayLength(), pt); + registry.fill(HIST("Data/hImpParErrProng0VsPt"), candidate.errorImpactParameter0(), pt); + registry.fill(HIST("Data/hImpParErrProng1VsPt"), candidate.errorImpactParameter1(), pt); + registry.fill(HIST("Data/hImpParErrProng2VsPt"), candidate.errorImpactParameter2(), pt); + registry.fill(HIST("Data/hDecLenErrVsPt"), candidate.errorDecayLength(), pt); if (fillTHn) { float const cent = evaluateCentralityColl(collision); @@ -815,14 +652,15 @@ struct HfTaskLc { double massLc(-1); double outputBkg(-1), outputPrompt(-1), outputFD(-1); const float properLifetime = hfHelper.ctLc(candidate) * CtToProperLifetimePs; - if (candidate.isSelLcToPKPi() >= selectionFlagLc) { - massLc = hfHelper.invMassLcToPKPi(candidate); + + auto fillTHnData = [&](bool isPKPi) { + massLc = isPKPi ? hfHelper.invMassLcToPKPi(candidate) : hfHelper.invMassLcToPiKP(candidate); if constexpr (FillMl) { if (candidate.mlProbLcToPKPi().size() == NumberOfMlClasses) { - outputBkg = candidate.mlProbLcToPKPi()[MlClassBackground]; /// bkg score - outputPrompt = candidate.mlProbLcToPKPi()[MlClassPrompt]; /// prompt score - outputFD = candidate.mlProbLcToPKPi()[MlClassNonPrompt]; /// non-prompt score + outputBkg = isPKPi ? candidate.mlProbLcToPKPi()[MlClassBackground] : candidate.mlProbLcToPiKP()[MlClassBackground]; /// bkg score + outputPrompt = isPKPi ? candidate.mlProbLcToPKPi()[MlClassPrompt] : candidate.mlProbLcToPiKP()[MlClassPrompt]; /// prompt score + outputFD = isPKPi ? candidate.mlProbLcToPKPi()[MlClassNonPrompt] : candidate.mlProbLcToPiKP()[MlClassNonPrompt]; /// non-prompt score } /// Fill the ML outputScores and variables of candidate std::vector valuesToFill{massLc, pt, cent, outputBkg, outputPrompt, outputFD, static_cast(numPvContributors)}; @@ -843,41 +681,19 @@ struct HfTaskLc { } registry.get(HIST("hnLcVars"))->Fill(valuesToFill.data()); } + }; + + if (candidate.isSelLcToPKPi() >= selectionFlagLc) { + fillTHnData(true); } if (candidate.isSelLcToPiKP() >= selectionFlagLc) { - massLc = hfHelper.invMassLcToPiKP(candidate); - - if constexpr (FillMl) { - if (candidate.mlProbLcToPiKP().size() == NumberOfMlClasses) { - outputBkg = candidate.mlProbLcToPiKP()[MlClassBackground]; /// bkg score - outputPrompt = candidate.mlProbLcToPiKP()[MlClassPrompt]; /// prompt score - outputFD = candidate.mlProbLcToPiKP()[MlClassNonPrompt]; /// non-prompt score - } - /// Fill the ML outputScores and variables of candidate - std::vector valuesToFill{massLc, pt, cent, outputBkg, outputPrompt, outputFD, static_cast(numPvContributors)}; - if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) { - valuesToFill.push_back(occ); - } - if (storeProperLifetime) { - valuesToFill.push_back(properLifetime); - } - registry.get(HIST("hnLcVarsWithBdt"))->Fill(valuesToFill.data()); - } else { - std::vector valuesToFill{massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, static_cast(numPvContributors)}; - if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) { - valuesToFill.push_back(occ); - } - if (storeProperLifetime) { - valuesToFill.push_back(properLifetime); - } - registry.get(HIST("hnLcVars"))->Fill(valuesToFill.data()); - } + fillTHnData(false); } } } } /// Run the analysis on real data - /// \tparam fillMl switch to fill ML histograms + /// \tparam FillMl switch to fill ML histograms template void runAnalysisPerCollisionData(CollType const& collisions, CandType const& candidates) @@ -888,7 +704,7 @@ struct HfTaskLc { } } - template + template void runAnalysisPerCollisionDataWithUpc(CollType const& collisions, CandType const& candidates, BCsType const& bcs, @@ -898,31 +714,27 @@ struct HfTaskLc { ) { - for (const auto& collision : collisions) { - float centrality{-1.f}; const auto rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, qaRegistry, bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; } - auto bc = collision.template bc_as(); + const auto& bc = collision.template bc_as(); upchelpers::FITInfo fitInfo{}; udhelpers::getFITinfo(fitInfo, bc, bcs, ft0s, fv0as, fdds); GapType gap = GapType::DoubleGap; if (bc.has_zdc()) { - auto zdc = bc.zdc(); + const auto zdc = bc.zdc(); qaRegistry.fill(HIST("Data/fitInfo/ampFT0A_vs_ampFT0C"), fitInfo.ampFT0A, fitInfo.ampFT0C); qaRegistry.fill(HIST("Data/zdc/energyZNA_vs_energyZNC"), zdc.energyCommonZNA(), zdc.energyCommonZNC()); gap = determineGapType(fitInfo.ampFT0A, fitInfo.ampFT0C, zdc.energyCommonZNA(), zdc.energyCommonZNC()); qaRegistry.fill(HIST("Data/hUpcGapAfterSelection"), static_cast(gap)); } if (gap == GapType::GapA || gap == GapType::GapC) { - fillHistosData(collision, candidates); - } else { - continue; + fillHistosData(collision, candidates); } } } @@ -942,7 +754,7 @@ struct HfTaskLc { } /// Run the analysis on MC data - /// \tparam fillMl switch to fill ML histograms + /// \tparam FillMl switch to fill ML histograms template void runAnalysisPerCollisionMc(CollType const& collisions, CandType const& candidates, From 2609dfb0acb8ee53304edcf9a780e812ae6aa50b Mon Sep 17 00:00:00 2001 From: Victor Gonzalez Date: Wed, 15 Oct 2025 18:52:22 +0200 Subject: [PATCH 767/986] [PWGCF] DptDpt - Proper axes bins for tracks and FW multiplicities (#13404) Co-authored-by: Victor --- PWGCF/TableProducer/dptDptFilter.cxx | 29 ++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/PWGCF/TableProducer/dptDptFilter.cxx b/PWGCF/TableProducer/dptDptFilter.cxx index d0feab6ac6d..c962b78e50b 100644 --- a/PWGCF/TableProducer/dptDptFilter.cxx +++ b/PWGCF/TableProducer/dptDptFilter.cxx @@ -674,31 +674,32 @@ struct DptDptFilter { /* helpers for the multiplicity/centrality axes definition */ #define DPTDPTCENTRALITYAXIS 105, -0.5f, 104.5f -#define DPTDPTMULTIPLICITYAXIS(est) 1001, -0.5f, cfgEventSelection.multiplicityUpperLimit->getData()[fSystem][est] - 0.5f +#define DPTDPTFWMULTIPLICITYAXIS(est) 1000, 0.0f, cfgEventSelection.multiplicityUpperLimit->getData()[fSystem][est] +#define DPTDPTMULTIPLICITYAXIS(est) cfgEventSelection.multiplicityUpperLimit->getData()[fSystem][est] + 1, -0.5f, cfgEventSelection.multiplicityUpperLimit->getData()[fSystem][est] + 0.5f std::string_view multestimator = getCentMultEstimatorName(fCentMultEstimator); fhCentMultB = new TH1F("CentralityB", "Centrality before cut; centrality (%)", DPTDPTCENTRALITYAXIS); fhCentMultA = new TH1F("CentralityA", "Centrality; centrality (%)", DPTDPTCENTRALITYAXIS); - fhMultB = new TH1F("MultB", TString::Format("%s Multiplicity before cut;%s Multiplicity;Collisions", multestimator.data(), multestimator.data()), DPTDPTMULTIPLICITYAXIS(estimatorMultiplicitySourceMap.at(fCentMultEstimator))); - fhMultA = new TH1F("MultA", TString::Format("%s Multiplicity;%s Multiplicity;Collisions", multestimator.data(), multestimator.data()), DPTDPTMULTIPLICITYAXIS(estimatorMultiplicitySourceMap.at(fCentMultEstimator))); + fhMultB = new TH1F("MultB", TString::Format("%s Multiplicity before cut;%s Multiplicity;Collisions", multestimator.data(), multestimator.data()), DPTDPTFWMULTIPLICITYAXIS(estimatorMultiplicitySourceMap.at(fCentMultEstimator))); + fhMultA = new TH1F("MultA", TString::Format("%s Multiplicity;%s Multiplicity;Collisions", multestimator.data(), multestimator.data()), DPTDPTFWMULTIPLICITYAXIS(estimatorMultiplicitySourceMap.at(fCentMultEstimator))); if (cfgEventSelection.fillQc) { /* the quality control histograms */ for (int i = 0; i < BeforeAfterNOOFTIMES; ++i) { fhMultiplicityVsCentrality[i] = new TH2F(TString::Format("MultiplicityVsCentrality%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);Global tracks", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); - fhMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsT0cMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;T0C Multiplicity;Global tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0C), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); - fhMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsT0aMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;T0A Multiplicity;Global tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0A), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); - fhMultiplicityVsV0aMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsV0aMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;V0A Multiplicity;Global tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceV0A), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); + fhMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsT0cMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;T0C Multiplicity;Global tracks", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS(MultSourceT0C), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); + fhMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsT0aMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;T0A Multiplicity;Global tracks", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS(MultSourceT0A), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); + fhMultiplicityVsV0aMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsV0aMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;V0A Multiplicity;Global tracks", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS(MultSourceV0A), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); fhMultiplicityVsPvMultiplicity[i] = new TH2F(TString::Format("MultiplicityVsPvMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;PV contributors;Global tracks", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors), DPTDPTMULTIPLICITYAXIS(MultSourceNtracks)); fhPvMultiplicityVsCentrality[i] = new TH2F(TString::Format("PvMultiplicityVsCentrality%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);PV contributors", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); - fhPvMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("PvMultiplicityVsT0cMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;T0C multiplicity;PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0C), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); - fhPvMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("PvMultiplicityVsT0aMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;T0A multiplicity;PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0A), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); - fhPvMultiplicityVsV0aMultiplicity[i] = new TH2F(TString::Format("PvMultiplicityVsV0aMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;V0A multiplicity;PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceV0A), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); - fhV0aMultiplicityVsCentrality[i] = new TH2F(TString::Format("V0aMultiplicityVsCentrality%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);V0A multiplicity", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourceV0A)); - fhV0aMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("V0aMultiplicityVsT0cMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;T0C multiplicity;V0A multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0C), DPTDPTMULTIPLICITYAXIS(MultSourceV0A)); - fhV0aMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("V0aMultiplicityVsT0aMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;T0A multiplicity;V0A multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0A), DPTDPTMULTIPLICITYAXIS(MultSourceV0A)); - fhT0cMultiplicityVsCentrality[i] = new TH2F(TString::Format("T0cMultiplicityVsCentrality%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);T0C multiplicity", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTMULTIPLICITYAXIS(MultSourceT0C)); - fhT0cMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("T0cMultiplicityVsT0aMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;T0A multiplicity;T0C multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTMULTIPLICITYAXIS(MultSourceT0A), DPTDPTMULTIPLICITYAXIS(MultSourceT0C)); + fhPvMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("PvMultiplicityVsT0cMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;T0C multiplicity;PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS(MultSourceT0C), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); + fhPvMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("PvMultiplicityVsT0aMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;T0A multiplicity;PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS(MultSourceT0A), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); + fhPvMultiplicityVsV0aMultiplicity[i] = new TH2F(TString::Format("PvMultiplicityVsV0aMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;V0A multiplicity;PV contributors", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS(MultSourceV0A), DPTDPTMULTIPLICITYAXIS(MultSourcePvContributors)); + fhV0aMultiplicityVsCentrality[i] = new TH2F(TString::Format("V0aMultiplicityVsCentrality%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);V0A multiplicity", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTFWMULTIPLICITYAXIS(MultSourceV0A)); + fhV0aMultiplicityVsT0cMultiplicity[i] = new TH2F(TString::Format("V0aMultiplicityVsT0cMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;T0C multiplicity;V0A multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS(MultSourceT0C), DPTDPTFWMULTIPLICITYAXIS(MultSourceV0A)); + fhV0aMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("V0aMultiplicityVsT0aMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;T0A multiplicity;V0A multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS(MultSourceT0A), DPTDPTFWMULTIPLICITYAXIS(MultSourceV0A)); + fhT0cMultiplicityVsCentrality[i] = new TH2F(TString::Format("T0cMultiplicityVsCentrality%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);T0C multiplicity", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTFWMULTIPLICITYAXIS(MultSourceT0C)); + fhT0cMultiplicityVsT0aMultiplicity[i] = new TH2F(TString::Format("T0cMultiplicityVsT0aMultiplicity%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;T0A multiplicity;T0C multiplicity", beforeAfterName[i].c_str()).Data(), DPTDPTFWMULTIPLICITYAXIS(MultSourceT0A), DPTDPTFWMULTIPLICITYAXIS(MultSourceT0C)); fhT0CentralityVsCentrality[i] = new TH2F(TString::Format("T0CentralityVsCentrality%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);T0 centrality(%%)", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTCENTRALITYAXIS); fhV0aCentralityVsCentrality[i] = new TH2F(TString::Format("V0aCentralityVsCentrality%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);V0A centrality (%%)", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTCENTRALITYAXIS); fhNtpvCentralityVsCentrality[i] = new TH2F(TString::Format("NtpvCentralityVsCentrality%s", beforeAfterSuffix[i].c_str()).Data(), TString::Format("%s;%s centrality (%%);NTPV centrality (%%)", beforeAfterName[i].c_str(), multestimator.data()).Data(), DPTDPTCENTRALITYAXIS, DPTDPTCENTRALITYAXIS); From 28b0ec063350b0183d0a237476301f737f8e76e9 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Wed, 15 Oct 2025 20:01:51 +0200 Subject: [PATCH 768/986] [Common] Centrality: further protection against MC quadratic mapping overshooting (#13395) --- Common/Tools/Multiplicity/MultModule.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Common/Tools/Multiplicity/MultModule.h b/Common/Tools/Multiplicity/MultModule.h index 6df1bd366de..3fc13db0d7f 100644 --- a/Common/Tools/Multiplicity/MultModule.h +++ b/Common/Tools/Multiplicity/MultModule.h @@ -772,7 +772,7 @@ class MultModule //_______________________________________________________________________ // vertex-Z equalized signals if (internalOpts.mEnabledTables[kFV0MultZeqs]) { - if (std::fabs(collision.posZ()) < 15.0f && lCalibLoaded) { + if (mults.multFV0A > -1.0f && std::fabs(collision.posZ()) < 15.0f && lCalibLoaded) { mults.multFV0AZeq = hVtxZFV0A->Interpolate(0.0) * mults.multFV0A / hVtxZFV0A->Interpolate(collision.posZ()); } else { mults.multFV0AZeq = 0.0f; @@ -780,21 +780,27 @@ class MultModule cursors.tableFV0Zeqs(mults.multFV0AZeq); } if (internalOpts.mEnabledTables[kFT0MultZeqs]) { - if (std::fabs(collision.posZ()) < 15.0f && lCalibLoaded) { + if (mults.multFT0A > -1.0f && std::fabs(collision.posZ()) < 15.0f && lCalibLoaded) { mults.multFT0AZeq = hVtxZFT0A->Interpolate(0.0) * mults.multFT0A / hVtxZFT0A->Interpolate(collision.posZ()); - mults.multFT0CZeq = hVtxZFT0C->Interpolate(0.0) * mults.multFT0C / hVtxZFT0C->Interpolate(collision.posZ()); } else { mults.multFT0AZeq = 0.0f; + } + if (mults.multFT0C > -1.0f && std::fabs(collision.posZ()) < 15.0f && lCalibLoaded) { + mults.multFT0CZeq = hVtxZFT0C->Interpolate(0.0) * mults.multFT0C / hVtxZFT0C->Interpolate(collision.posZ()); + } else { mults.multFT0CZeq = 0.0f; } cursors.tableFT0Zeqs(mults.multFT0AZeq, mults.multFT0CZeq); } if (internalOpts.mEnabledTables[kFDDMultZeqs]) { - if (std::fabs(collision.posZ()) < 15.0f && lCalibLoaded) { + if (mults.multFDDA > -1.0f && std::fabs(collision.posZ()) < 15.0f && lCalibLoaded) { mults.multFDDAZeq = hVtxZFDDA->Interpolate(0.0) * mults.multFDDA / hVtxZFDDA->Interpolate(collision.posZ()); - mults.multFDDCZeq = hVtxZFDDC->Interpolate(0.0) * mults.multFDDC / hVtxZFDDC->Interpolate(collision.posZ()); } else { mults.multFDDAZeq = 0.0f; + } + if (mults.multFDDC > -1.0f && std::fabs(collision.posZ()) < 15.0f && lCalibLoaded) { + mults.multFDDCZeq = hVtxZFDDC->Interpolate(0.0) * mults.multFDDC / hVtxZFDDC->Interpolate(collision.posZ()); + } else { mults.multFDDCZeq = 0.0f; } cursors.tableFDDZeqs(mults.multFDDAZeq, mults.multFDDCZeq); From 8eecbe1e66ce72b28bef5fbfb7fe03a93f081362 Mon Sep 17 00:00:00 2001 From: alcaliva <32872606+alcaliva@users.noreply.github.com> Date: Wed, 15 Oct 2025 20:20:20 +0200 Subject: [PATCH 769/986] [PWGLF] [PWGLF]Optimize memory usage: move jet/area definitions outside event loop and use swap() to release vectors (#13386) --- PWGLF/Tasks/Nuspex/antinucleiInJets.cxx | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx index 29473a44283..f964137285b 100644 --- a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx +++ b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx @@ -1626,6 +1626,10 @@ struct AntinucleiInJets { // Event counter int eventCounter = 0; + // Jet and area definitions + fastjet::JetDefinition jetDef(fastjet::antikt_algorithm, rJet); + fastjet::AreaDefinition areaDef(fastjet::active_area, fastjet::GhostedAreaSpec(1.0)); + // Loop over all simulated collisions for (const auto& collision : collisions) { @@ -1675,8 +1679,6 @@ struct AntinucleiInJets { registryMC.fill(HIST("genEvents"), 2.5); // Cluster MC particles into jets using anti-kt algorithm - fastjet::JetDefinition jetDef(fastjet::antikt_algorithm, rJet); - fastjet::AreaDefinition areaDef(fastjet::active_area, fastjet::GhostedAreaSpec(1.0)); fastjet::ClusterSequenceArea cs(fjParticles, jetDef, areaDef); std::vector jets = fastjet::sorted_by_pt(cs.inclusive_jets()); auto [rhoPerp, rhoMPerp] = backgroundSub.estimateRhoPerpCone(fjParticles, jets); @@ -1772,8 +1774,8 @@ struct AntinucleiInJets { // Shrink large vectors if (eventCounter % shrinkInterval == 0) { - fjParticles.shrink_to_fit(); - protonMomentum.shrink_to_fit(); + std::vector().swap(fjParticles); + std::vector().swap(protonMomentum); } } } @@ -1786,6 +1788,10 @@ struct AntinucleiInJets { std::vector fjParticles; std::vector antiprotonTrackIndex; + // Jet and area definitions + fastjet::JetDefinition jetDef(fastjet::antikt_algorithm, rJet); + fastjet::AreaDefinition areaDef(fastjet::active_area, fastjet::GhostedAreaSpec(1.0)); + // Event counter int eventCounter = 0; @@ -1870,8 +1876,6 @@ struct AntinucleiInJets { registryMC.fill(HIST("recEvents"), 8.5); // Cluster particles using the anti-kt algorithm - fastjet::JetDefinition jetDef(fastjet::antikt_algorithm, rJet); - fastjet::AreaDefinition areaDef(fastjet::active_area, fastjet::GhostedAreaSpec(1.0)); fastjet::ClusterSequenceArea cs(fjParticles, jetDef, areaDef); std::vector jets = fastjet::sorted_by_pt(cs.inclusive_jets()); auto [rhoPerp, rhoMPerp] = backgroundSub.estimateRhoPerpCone(fjParticles, jets); @@ -2064,8 +2068,8 @@ struct AntinucleiInJets { // Shrink large vectors if (eventCounter % shrinkInterval == 0) { - fjParticles.shrink_to_fit(); - antiprotonTrackIndex.shrink_to_fit(); + std::vector().swap(fjParticles); + std::vector().swap(antiprotonTrackIndex); } } } From 4e0bbc7b84fa8ba3df299e05409d7723b6f49c38 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Wed, 15 Oct 2025 22:49:18 +0200 Subject: [PATCH 770/986] [PWGEM/Dilepton] update muon analyses (#13369) --- .../TableProducer/skimmerPrimaryMuon.cxx | 7 ++- PWGEM/Dilepton/Tasks/createResolutionMap.cxx | 5 +- PWGEM/Dilepton/Tasks/matchingMFT.cxx | 58 ++++++++----------- 3 files changed, 32 insertions(+), 38 deletions(-) diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx index 656f9136e12..0c97c573394 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx @@ -132,7 +132,7 @@ struct skimmerPrimaryMuon { const double centerMFT[3] = {0, 0, -61.4}; o2::field::MagneticField* field = static_cast(TGeoGlobalMagField::Instance()->GetField()); mBz = field->getBz(centerMFT); // Get field at centre of MFT - LOGF(info, "Bz at center of MFT = %f kZG", mBz); + LOGF(info, "Bz at center of MFT = %f kZG", mBz); // this is dummy comment. // dummy2 } void addHistograms() @@ -311,12 +311,13 @@ struct skimmerPrimaryMuon { pDCA = mchtrack.p() * dcaXY_Matched; if (refitGlobalMuon) { - eta = mfttrack.eta(); + // eta = mfttrack.eta(); // phi = mfttrack.phi(); // o2::math_utils::bringTo02Pi(phi); - pt = propmuonAtPV_Matched.getP() * std::sin(2.f * std::atan(std::exp(-eta))); + eta = propmuonAtDCA.getEta(); phi = propmuonAtDCA.getPhi(); o2::math_utils::bringTo02Pi(phi); + pt = propmuonAtPV_Matched.getP() * std::sin(2.f * std::atan(std::exp(-eta))); // x = mfttrack.x(); // y = mfttrack.y(); diff --git a/PWGEM/Dilepton/Tasks/createResolutionMap.cxx b/PWGEM/Dilepton/Tasks/createResolutionMap.cxx index cc93bbccde9..7c0883c977c 100644 --- a/PWGEM/Dilepton/Tasks/createResolutionMap.cxx +++ b/PWGEM/Dilepton/Tasks/createResolutionMap.cxx @@ -611,12 +611,13 @@ struct CreateResolutionMap { } if (muoncuts.refitGlobalMuon) { - eta = mfttrack.eta(); + // eta = mfttrack.eta(); // phi = mfttrack.phi(); // o2::math_utils::bringTo02Pi(phi); - pt = propmuonAtPV_Matched.getP() * std::sin(2.f * std::atan(std::exp(-eta))); + eta = propmuonAtDCA.getEta(); phi = propmuonAtDCA.getPhi(); o2::math_utils::bringTo02Pi(phi); + pt = propmuonAtPV_Matched.getP() * std::sin(2.f * std::atan(std::exp(-eta))); if constexpr (withMFTCov) { auto mfttrackcov = mftCovs.rawIteratorAt(map_mfttrackcovs[mfttrack.globalIndex()]); diff --git a/PWGEM/Dilepton/Tasks/matchingMFT.cxx b/PWGEM/Dilepton/Tasks/matchingMFT.cxx index 9c2307f417c..35a84f31c89 100644 --- a/PWGEM/Dilepton/Tasks/matchingMFT.cxx +++ b/PWGEM/Dilepton/Tasks/matchingMFT.cxx @@ -199,10 +199,9 @@ struct matchingMFT { fRegistry.add("MFTMCHMID/primary/correct/hDCAxyResolutionvsPt", "DCA_{xy} resolution vs. p_{T};p_{T} (GeV/c);DCA_{xy} resolution (#mum);", kTH2F, {{100, 0, 10.f}, {500, 0, 500}}, false); fRegistry.add("MFTMCHMID/primary/correct/hMCHBitMap", "MCH bit map;MCH bit map", kTH1F, {{1024, -0.5, 1023.5}}, false); fRegistry.add("MFTMCHMID/primary/correct/hMIDBitMap", "MID bit map;MID bit map", kTH1F, {{256, -0.5, 255.5}}, false); - fRegistry.add("MFTMCHMID/primary/correct/hMeanMFTClusterSize", "mean MFT cluster size vs. p;p (GeV/c); #times sin(#lambda)", kTH2F, {{100, 0, 100}, {100, 0, 10}}, false); fRegistry.add("MFTMCHMID/primary/correct/hProdVtxZ", "prod. vtx Z of muon;V_{z} (cm)", kTH1F, {{200, -100, 100}}, false); - fRegistry.add("MFTMCHMID/primary/correct/hRelDeltaPt", "pT resolution;p_{T}^{gen} (GeV/c);(p_{T}^{rec} - p_{T}^{gen})/p_{T}^{gen}", kTH2F, {{100, 0, 10}, {400, -1, +1}}, false); + fRegistry.add("MFTMCHMID/primary/correct/hRelDeltaPt", "pT resolution;p_{T}^{gen} (GeV/c);(p_{T}^{rec} - p_{T}^{gen})/p_{T}^{gen}", kTH2F, {{100, 0, 10}, {200, -1, +1}}, false); fRegistry.add("MFTMCHMID/primary/correct/hDeltaEta_Pos", "#eta resolution;p_{T}^{gen} (GeV/c);#eta^{rec} - #eta^{gen}", kTH2F, {{100, 0, 10}, {400, -0.2, +0.2}}, false); fRegistry.add("MFTMCHMID/primary/correct/hDeltaEta_Neg", "#eta resolution;p_{T}^{gen} (GeV/c);#eta^{rec} - #eta^{gen}", kTH2F, {{100, 0, 10}, {400, -0.2, +0.2}}, false); fRegistry.add("MFTMCHMID/primary/correct/hDeltaPhi_Pos", "#varphi resolution;p_{T}^{gen} (GeV/c);#varphi^{rec} - #varphi^{gen} (rad.)", kTH2F, {{100, 0, 10}, {400, -0.2, +0.2}}, false); @@ -275,27 +274,27 @@ struct matchingMFT { return (clmap > 0); } - template - float meanClusterSizeMFT(T const& track) - { - uint64_t mftClusterSizesAndTrackFlags = track.mftClusterSizesAndTrackFlags(); - uint16_t clsSize = 0; - uint16_t n = 0; - for (unsigned int layer = 0; layer < 10; layer++) { - uint16_t size_per_layer = (mftClusterSizesAndTrackFlags >> (layer * 6)) & 0x3f; - clsSize += size_per_layer; - if (size_per_layer > 0) { - n++; - } - // LOGF(info, "track.globalIndex() = %d, layer = %d, size_per_layer = %d", track.globalIndex(), layer, size_per_layer); - } - - if (n > 0) { - return static_cast(clsSize) / static_cast(n) * std::fabs(std::sin(std::atan(track.tgl()))); - } else { - return 0.f; - } - } + // template + // float meanClusterSizeMFT(T const& track) + // { + // uint64_t mftClusterSizesAndTrackFlags = track.mftClusterSizesAndTrackFlags(); + // uint16_t clsSize = 0; + // uint16_t n = 0; + // for (unsigned int layer = 0; layer < 10; layer++) { + // uint16_t size_per_layer = (mftClusterSizesAndTrackFlags >> (layer * 6)) & 0x3f; + // clsSize += size_per_layer; + // if (size_per_layer > 0) { + // n++; + // } + // // LOGF(info, "track.globalIndex() = %d, layer = %d, size_per_layer = %d", track.globalIndex(), layer, size_per_layer); + // } + + // if (n > 0) { + // return static_cast(clsSize) / static_cast(n) * std::fabs(std::sin(std::atan(track.tgl()))); + // } else { + // return 0.f; + // } + // } template void getDeltaEtaDeltaPhiAtMatchingPlane(TCollision const& collision, TFwdTrack const& fwdtrack, TMFTrackCov const& mftCovs, float& deta, float& dphi) @@ -393,7 +392,6 @@ struct matchingMFT { o2::dataformats::GlobalFwdTrack propmuonAtDCA_Matched = propagateMuon(mchtrack, mchtrack, collision, propagationPoint::kToDCA, matchingZ, mBz); o2::dataformats::GlobalFwdTrack propmuonAtPV_Matched = propagateMuon(mchtrack, mchtrack, collision, propagationPoint::kToVertex, matchingZ, mBz); - float p = propmuonAtPV.getP(); float pt = propmuonAtPV.getPt(); float eta = propmuonAtPV.getEta(); float phi = propmuonAtPV.getPhi(); @@ -424,13 +422,13 @@ struct matchingMFT { float dphiMP = 999.f, detaMP = 999.f; if (refitGlobalMuon) { - eta = mfttrack.eta(); + // eta = mfttrack.eta(); // phi = mfttrack.phi(); // o2::math_utils::bringTo02Pi(phi); - pt = propmuonAtPV_Matched.getP() * std::sin(2.f * std::atan(std::exp(-eta))); - p = propmuonAtPV_Matched.getP(); + eta = propmuonAtDCA.getEta(); phi = propmuonAtDCA.getPhi(); o2::math_utils::bringTo02Pi(phi); + pt = propmuonAtPV_Matched.getP() * std::sin(2.f * std::atan(std::exp(-eta))); if constexpr (withMFTCov) { // auto mfttrackcov = mftCovs.rawIteratorAt(map_mfttrackcovs[mfttrack.globalIndex()]); @@ -464,8 +462,6 @@ struct matchingMFT { // } // sigma_dcaXY = dcaXY / dcaXYinSigma; - // o2::track::TrackParCovFwd mftsaAtDCA = getTrackParCovFwd(mfttrack, mfttrackcov); // values at innermost update - // mftsaAtDCA.propagateToZhelix(collision.posZ(), mBz); // propagated to matching plane // cXXatDCA = mftsaAtDCA.getSigma2X(); // cYYatDCA = mftsaAtDCA.getSigma2Y(); // cXYatDCA = mftsaAtDCA.getSigmaXY(); @@ -541,7 +537,6 @@ struct matchingMFT { fRegistry.fill(HIST("MFTMCHMID/primary/correct/hDCAxyinSigma"), dcaXYinSigma); fRegistry.fill(HIST("MFTMCHMID/primary/correct/hMCHBitMap"), fwdtrack.mchBitMap()); fRegistry.fill(HIST("MFTMCHMID/primary/correct/hMIDBitMap"), fwdtrack.midBitMap()); - fRegistry.fill(HIST("MFTMCHMID/primary/correct/hMeanMFTClusterSize"), p, meanClusterSizeMFT(mfttrack)); fRegistry.fill(HIST("MFTMCHMID/primary/correct/hDCAxResolutionvsPt"), pt, std::sqrt(cXXatDCA) * 1e+4); // convert cm to um fRegistry.fill(HIST("MFTMCHMID/primary/correct/hDCAyResolutionvsPt"), pt, std::sqrt(cYYatDCA) * 1e+4); // convert cm to um fRegistry.fill(HIST("MFTMCHMID/primary/correct/hDCAxyResolutionvsPt"), pt, sigma_dcaXY * 1e+4); // convert cm to um @@ -578,7 +573,6 @@ struct matchingMFT { fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hDCAxyinSigma"), dcaXYinSigma); fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hMCHBitMap"), fwdtrack.mchBitMap()); fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hMIDBitMap"), fwdtrack.midBitMap()); - fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hMeanMFTClusterSize"), p, meanClusterSizeMFT(mfttrack)); fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hDCAxResolutionvsPt"), pt, std::sqrt(cXXatDCA) * 1e+4); // convert cm to um fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hDCAyResolutionvsPt"), pt, std::sqrt(cYYatDCA) * 1e+4); // convert cm to um fRegistry.fill(HIST("MFTMCHMID/primary/wrong/hDCAxyResolutionvsPt"), pt, sigma_dcaXY * 1e+4); // convert cm to um @@ -617,7 +611,6 @@ struct matchingMFT { fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hDCAxyinSigma"), dcaXYinSigma); fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hMCHBitMap"), fwdtrack.mchBitMap()); fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hMIDBitMap"), fwdtrack.midBitMap()); - fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hMeanMFTClusterSize"), p, meanClusterSizeMFT(mfttrack)); fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hDCAxResolutionvsPt"), pt, std::sqrt(cXXatDCA) * 1e+4); // convert cm to um fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hDCAyResolutionvsPt"), pt, std::sqrt(cYYatDCA) * 1e+4); // convert cm to um fRegistry.fill(HIST("MFTMCHMID/secondary/correct/hDCAxyResolutionvsPt"), pt, sigma_dcaXY * 1e+4); // convert cm to um @@ -654,7 +647,6 @@ struct matchingMFT { fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hDCAxyinSigma"), dcaXYinSigma); fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hMCHBitMap"), fwdtrack.mchBitMap()); fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hMIDBitMap"), fwdtrack.midBitMap()); - fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hMeanMFTClusterSize"), p, meanClusterSizeMFT(mfttrack)); fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hDCAxResolutionvsPt"), pt, std::sqrt(cXXatDCA) * 1e+4); // convert cm to um fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hDCAyResolutionvsPt"), pt, std::sqrt(cYYatDCA) * 1e+4); // convert cm to um fRegistry.fill(HIST("MFTMCHMID/secondary/wrong/hDCAxyResolutionvsPt"), pt, sigma_dcaXY * 1e+4); // convert cm to um From 9add62c14383bca57d384181faf9779dd9df4258 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Thu, 16 Oct 2025 01:07:45 +0200 Subject: [PATCH 771/986] [Common] Adjust CCDB loading to capture Run 2 GRPObject for MagField (#13384) Co-authored-by: ALICE Builder --- .../TableProducer/propagationServiceRun2.cxx | 1 + Common/Tools/StandardCCDBLoader.h | 33 +++++++++++++------ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/Common/TableProducer/propagationServiceRun2.cxx b/Common/TableProducer/propagationServiceRun2.cxx index 9c7765280c0..a2075355200 100644 --- a/Common/TableProducer/propagationServiceRun2.cxx +++ b/Common/TableProducer/propagationServiceRun2.cxx @@ -91,6 +91,7 @@ struct propagationServiceRun2 { ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); ccdb->setURL(ccdburl.value); + ccdb->setFatalWhenNull(false); // task-specific strangenessBuilderModule.init(baseOpts, v0BuilderOpts, cascadeBuilderOpts, preSelectOpts, histos, initContext); diff --git a/Common/Tools/StandardCCDBLoader.h b/Common/Tools/StandardCCDBLoader.h index b215fc70569..058342ce527 100644 --- a/Common/Tools/StandardCCDBLoader.h +++ b/Common/Tools/StandardCCDBLoader.h @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -43,6 +44,7 @@ struct StandardCCDBLoaderConfigurables : o2::framework::ConfigurableGroup { o2::framework::Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; o2::framework::Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; o2::framework::Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + o2::framework::Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; o2::framework::Configurable mVtxPath{"mVtxPath", "GLO/Calib/MeanVertex", "Path of the mean vertex file"}; }; @@ -81,6 +83,27 @@ class StandardCCDBLoader return; } + grpmag = ccdb->template getForRun(cGroup.grpmagPath.value, currentRunNumber); + if (grpmag) { + LOG(info) << "Setting global propagator magnetic field to current " << grpmag->getL3Current() << " A for run " << currentRunNumber << " from its GRPMagField CCDB object"; + o2::base::Propagator::initFieldFromGRP(grpmag); + } else { + LOGF(info, "GRPMagField object returned nullptr, will attempt alternate method"); + + o2::parameters::GRPObject* grpo = 0x0; + grpo = ccdb->template getForRun(cGroup.grpPath.value, currentRunNumber); + if (!grpo) { + LOG(fatal) << "Alternate path failed! Got nullptr from CCDB for path " << cGroup.grpPath << " of object GRPObject for run " << currentRunNumber; + } + o2::base::Propagator::initFieldFromGRP(grpo); + } + if (getMeanVertex) { + // only try this if explicitly requested + mMeanVtx = ccdb->template getForRun(cGroup.mVtxPath.value, currentRunNumber); + } else { + mMeanVtx = nullptr; + } + // load matLUT for this timestamp if (!lut) { LOG(info) << "Loading material look-up table for timestamp: " << currentRunNumber; @@ -88,18 +111,8 @@ class StandardCCDBLoader } else { LOG(info) << "Material look-up table already in place. Not reloading."; } - - grpmag = ccdb->template getForRun(cGroup.grpmagPath.value, currentRunNumber); - LOG(info) << "Setting global propagator magnetic field to current " << grpmag->getL3Current() << " A for run " << currentRunNumber << " from its GRPMagField CCDB object"; - o2::base::Propagator::initFieldFromGRP(grpmag); LOG(info) << "Setting global propagator material propagation LUT"; o2::base::Propagator::Instance()->setMatLUT(lut); - if (getMeanVertex) { - // only try this if explicitly requested - mMeanVtx = ccdb->template getForRun(cGroup.mVtxPath.value, currentRunNumber); - } else { - mMeanVtx = nullptr; - } runNumber = currentRunNumber; } From d0e2559d59a8b1e42241bbf09dc57514af5308e4 Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Thu, 16 Oct 2025 03:31:25 +0200 Subject: [PATCH 772/986] [PWGCF] FemtoUniverse: Fix some O2 linter errors (#13388) --- ...irTaskTrackTrackSpherHarMultKtExtended.cxx | 67 ++++++++++++------- 1 file changed, 41 insertions(+), 26 deletions(-) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx index 60161fe04a6..ccbc8c01882 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx @@ -61,7 +61,6 @@ static const float cutsTable[nPart][nCuts]{ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { Service pdg; - Service pdgMC; /// Particle selection part @@ -716,12 +715,13 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { void doSameEventMCTruth(PartitionType groupPartsOne, PartitionType groupPartsTwo, int multCol, int ContType, bool fillQA) { + randgen = new TRandom2(0); /// Histogramming same event - if ((ContType == 1 || ContType == 2) && fillQA) { + if ((cfgProcessPM || cfgProcessPP) && fillQA) { for (const auto& part : groupPartsOne) { if (part.partType() == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) { int pdgCode = static_cast(part.tempFitVar()); - const auto& pdgParticle = pdgMC->GetParticle(pdgCode); + const auto& pdgParticle = pdg->GetParticle(pdgCode); if (pdgParticle) { trackHistoPartOne.fillQA(part); } @@ -729,11 +729,11 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { } } - if ((ContType == 1 || ContType == 3) && fillQA) { + if ((cfgProcessPM || cfgProcessMM) && fillQA) { for (const auto& part : groupPartsTwo) { if (part.partType() == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) { int pdgCode = static_cast(part.tempFitVar()); - const auto& pdgParticle = pdgMC->GetParticle(pdgCode); + const auto& pdgParticle = pdg->GetParticle(pdgCode); if (pdgParticle) { trackHistoPartTwo.fillQA(part); } @@ -741,15 +741,15 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { } } - if (ContType == 1) { + if (cfgProcessPM) { /// Now build the combinations for non-identical particle pairs for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { int pdgCodePartOne = static_cast(p1.tempFitVar()); - const auto& pdgParticleOne = pdgMC->GetParticle(pdgCodePartOne); + const auto& pdgParticleOne = pdg->GetParticle(pdgCodePartOne); int pdgCodePartTwo = static_cast(p2.tempFitVar()); - const auto& pdgParticleTwo = pdgMC->GetParticle(pdgCodePartTwo); + const auto& pdgParticleTwo = pdg->GetParticle(pdgCodePartTwo); if (pdgParticleOne && pdgParticleTwo && (pdgCodePartOne == trackonefilter.ConfPDGCodePartOne) && (pdgCodePartTwo == tracktwofilter.ConfPDGCodePartTwo)) { float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); sameEventMultCont.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); @@ -759,9 +759,9 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { for (const auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsOne, groupPartsOne))) { int pdgCodePartOne = static_cast(p1.tempFitVar()); - const auto& pdgParticleOne = pdgMC->GetParticle(pdgCodePartOne); + const auto& pdgParticleOne = pdg->GetParticle(pdgCodePartOne); int pdgCodePartTwo = static_cast(p2.tempFitVar()); - const auto& pdgParticleTwo = pdgMC->GetParticle(pdgCodePartTwo); + const auto& pdgParticleTwo = pdg->GetParticle(pdgCodePartTwo); float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); double rand; @@ -793,6 +793,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { } } } + delete randgen; } /// process function for to call doSameEvent with Monte Carlo @@ -807,30 +808,37 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { auto thegroupPartsOne = partsOneMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); auto thegroupPartsTwo = partsTwoMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); bool fillQA = true; - randgen = new TRandom2(0); + + int pairType = 0; + if (cfgProcessPM) { + pairType = 1; + } else if (cfgProcessPP) { + pairType = 2; + } else if (cfgProcessMM) { + pairType = 3; + } if (ConfIsCent) { if (cfgProcessPM) { - doSameEventMCTruth(thegroupPartsOne, thegroupPartsTwo, col.multV0M(), 1, fillQA); + doSameEventMCTruth(thegroupPartsOne, thegroupPartsTwo, col.multV0M(), pairType, fillQA); } if (cfgProcessPP) { - doSameEventMCTruth(thegroupPartsOne, thegroupPartsOne, col.multV0M(), 2, fillQA); + doSameEventMCTruth(thegroupPartsOne, thegroupPartsOne, col.multV0M(), pairType, fillQA); } if (cfgProcessMM) { - doSameEventMCTruth(thegroupPartsTwo, thegroupPartsTwo, col.multV0M(), 3, fillQA); + doSameEventMCTruth(thegroupPartsTwo, thegroupPartsTwo, col.multV0M(), pairType, fillQA); } } else { if (cfgProcessPM) { - doSameEventMCTruth(thegroupPartsOne, thegroupPartsTwo, col.multNtr(), 1, fillQA); + doSameEventMCTruth(thegroupPartsOne, thegroupPartsTwo, col.multNtr(), pairType, fillQA); } if (cfgProcessPP) { - doSameEventMCTruth(thegroupPartsOne, thegroupPartsOne, col.multNtr(), 2, fillQA); + doSameEventMCTruth(thegroupPartsOne, thegroupPartsOne, col.multNtr(), pairType, fillQA); } if (cfgProcessMM) { - doSameEventMCTruth(thegroupPartsTwo, thegroupPartsTwo, col.multNtr(), 3, fillQA); + doSameEventMCTruth(thegroupPartsTwo, thegroupPartsTwo, col.multNtr(), pairType, fillQA); } } - delete randgen; } PROCESS_SWITCH(femtoUniversePairTaskTrackTrackSpherHarMultKtExtended, processSameEventMCTruth, "Enable processing same event for MC truth", false); @@ -1104,13 +1112,13 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { template void doMixedEventMCTruth(PartitionType groupPartsOne, PartitionType groupPartsTwo, int multCol, int ContType) { - + randgen = new TRandom2(0); for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { int pdgCodePartOne = static_cast(p1.tempFitVar()); - const auto& pdgParticleOne = pdgMC->GetParticle(pdgCodePartOne); + const auto& pdgParticleOne = pdg->GetParticle(pdgCodePartOne); int pdgCodePartTwo = static_cast(p2.tempFitVar()); - const auto& pdgParticleTwo = pdgMC->GetParticle(pdgCodePartTwo); + const auto& pdgParticleTwo = pdg->GetParticle(pdgCodePartTwo); float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); double rand; @@ -1149,6 +1157,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { } } } + delete randgen; } /// process function for to call doMixedEvent with Data @@ -1157,7 +1166,14 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { void processMixedEventNtrMCTruth(o2::aod::FdCollisions const& cols, FemtoTruthParticles const&) { - randgen = new TRandom2(0); + int pairType = 0; + if (cfgProcessPM) { + pairType = 1; + } else if (cfgProcessPP) { + pairType = 2; + } else if (cfgProcessMM) { + pairType = 3; + } for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningNtr, ConfNEventsMix, -1, cols, cols)) { @@ -1167,20 +1183,19 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { if (cfgProcessPM) { auto groupPartsOne = partsOneMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); auto groupPartsTwo = partsTwoMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); - doMixedEventMCTruth(groupPartsOne, groupPartsTwo, multiplicityCol, 1); + doMixedEventMCTruth(groupPartsOne, groupPartsTwo, multiplicityCol, pairType); } if (cfgProcessPP) { auto groupPartsOne = partsOneMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); auto groupPartsTwo = partsOneMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); - doMixedEventMCTruth(groupPartsOne, groupPartsTwo, multiplicityCol, 2); + doMixedEventMCTruth(groupPartsOne, groupPartsTwo, multiplicityCol, pairType); } if (cfgProcessMM) { auto groupPartsOne = partsTwoMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); auto groupPartsTwo = partsTwoMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); - doMixedEventMCTruth(groupPartsOne, groupPartsTwo, multiplicityCol, 3); + doMixedEventMCTruth(groupPartsOne, groupPartsTwo, multiplicityCol, pairType); } } - delete randgen; } PROCESS_SWITCH(femtoUniversePairTaskTrackTrackSpherHarMultKtExtended, processMixedEventNtrMCTruth, "Enable processing MC Truth mixed events for multiplicity", false); }; From 4abec76bbb4402bd4eeefd9db4d96c88292f20fd Mon Sep 17 00:00:00 2001 From: JimunLee Date: Thu, 16 Oct 2025 13:19:29 +0900 Subject: [PATCH 773/986] [PWGLF] Return the current code of KstarInOO.cxx (#13390) Co-authored-by: jimun_lee --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 165 ++++++++++++++++++++++----- 1 file changed, 136 insertions(+), 29 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 9fc92e56d31..6cab67014aa 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -179,16 +179,22 @@ struct kstarInOO { } if (cfgMcHistos) { + // histos.add("hPion_PID_Purity", "hPion_PID_Purity", kTH1F, {{3, -1.5, 1.5}}); + // histos.add("hKaon_PID_Purity", "hKaon_PID_Purity", kTH1F, {{3, -1.5, 1.5}}); + // histos.add("hSimplePion_PID_Purity", "hSimplePion_PID_Purity", kTH1F, {{3, -1.5, 1.5}}); + // histos.add("hSimpleKaon_PID_Purity", "hSimpleKaon_PID_Purity", kTH1F, {{3, -1.5, 1.5}}); histos.add("nEvents_MC", "nEvents_MC", kTH1F, {{4, 0.0, 4.0}}); histos.add("nEvents_MC_True", "nEvents_MC_True", kTH1F, {{4, 0.0, 4.0}}); + histos.add("hMC_kstar_True", "hMC_kstar_True", kTHnSparseF, {cfgCentAxis, ptAxis}); - histos.add("hMC_USS", "hMC_USS", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_LSS", "hMC_LSS", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_USS_Mix", "hMC_USS_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_LSS_Mix", "hMC_LSS_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); histos.add("hMC_USS_True", "hMC_USS_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_USS_KPi", "hMC_USS_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_LSS_KPi", "hMC_LSS_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_USS_KPi_Mix", "hMC_USS_KPi_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_USS_KPi_True", "hMC_USS_KPi_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_USS_PiK_True", "hMC_USS_PiK_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); } } // end of init @@ -273,11 +279,13 @@ struct kstarInOO { return false; if (cfgTrackGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) return false; - if (cfgTracknFindableTPCClusters > 0 && track.tpcNClsFindable() < cfgTracknFindableTPCClusters) + // if (cfgTracknFindableTPCClusters > 0 && track.tpcNClsFindable() < cfgTracknFindableTPCClusters) + if (track.tpcNClsFindable() < cfgTracknFindableTPCClusters) return false; if (track.tpcNClsCrossedRows() < cfgTracknTPCCrossedRows) return false; - if (cfgTracknRowsOverFindable > 0 && track.tpcCrossedRowsOverFindableCls() > cfgTracknRowsOverFindable) + // if (cfgTracknRowsOverFindable > 0 && track.tpcCrossedRowsOverFindableCls() > cfgTracknRowsOverFindable) + if (track.tpcCrossedRowsOverFindableCls() > cfgTracknRowsOverFindable) return false; if (track.tpcChi2NCl() > cfgTracknTPCChi2) return false; @@ -373,7 +381,8 @@ struct kstarInOO { auto centrality = collision1.centFT0C(); for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - auto [KstarPt, Minv] = minvReconstruction(trk1, trk2, QA); + + auto [KstarPt, Minv] = minvReconstruction(trk1, trk2, QA, false); double conjugate = trk1.sign() * trk2.sign(); if (cfgDataHistos) { @@ -403,26 +412,36 @@ struct kstarInOO { auto tracks2 = pionMC->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); auto centrality = collision1.centFT0C(); + std::vector mcMemory; + std::vector PIDPurityKey_Kaon; + std::vector PIDPurityKey_Pion; + + double KstarPt_Kpi, Minv_Kpi; + for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) continue; - auto [KstarPt_Kpi, Minv_Kpi] = minvReconstruction(trk1, trk2, QA); + + // auto [KstarPt_Kpi, Minv_Kpi] = minvReconstruction(trk1, trk2, QA, false); + // auto [KstarPt_piK, Minv_piK] = minvReconstruction(trk1, trk2, QA, true); + + std::tie(KstarPt_Kpi, Minv_Kpi) = minvReconstruction(trk1, trk2, QA, false); + std::tie(KstarPt_Kpi, Minv_Kpi) = minvReconstruction(trk1, trk2, QA, true); + + if (Minv_Kpi < 0) + continue; double conjugate = trk1.sign() * trk2.sign(); if (cfgMcHistos) { - if (Minv_Kpi > 0) { - if (!IsMix) { - if (conjugate < 0) { - histos.fill(HIST("hMC_USS"), centrality, KstarPt_Kpi, Minv_Kpi); - } else if (conjugate > 0) { - histos.fill(HIST("hMC_LSS"), centrality, KstarPt_Kpi, Minv_Kpi); - } - } else { - if (conjugate < 0) { - histos.fill(HIST("hMC_USS_Mix"), centrality, KstarPt_Kpi, Minv_Kpi); - } else if (conjugate > 0) { - histos.fill(HIST("hMC_LSS_Mix"), centrality, KstarPt_Kpi, Minv_Kpi); - } + if (!IsMix) { + if (conjugate < 0) { + histos.fill(HIST("hMC_USS_KPi"), centrality, KstarPt_Kpi, Minv_Kpi); + } else if (conjugate > 0) { + histos.fill(HIST("hMC_LSS_KPi"), centrality, KstarPt_Kpi, Minv_Kpi); + } + } else { + if (conjugate < 0) { + histos.fill(HIST("hMC_USS_KPi_Mix"), centrality, KstarPt_Kpi, Minv_Kpi); } } } @@ -434,6 +453,8 @@ struct kstarInOO { if (!particle1.has_mothers() || !particle2.has_mothers()) { continue; } + int mcindex1 = trk1.globalIndex(); + int mcindex2 = trk2.globalIndex(); std::vector mothers1{}; std::vector mothers1PDG{}; @@ -457,30 +478,86 @@ struct kstarInOO { if (mothers1[0] != mothers2[0]) continue; // Kaon and pion not from the same K*0 + if (std::fabs(particle1.pdgCode()) != 211 && std::fabs(particle1.pdgCode()) != 321) + continue; + if (std::fabs(particle2.pdgCode()) != 211 && std::fabs(particle2.pdgCode()) != 321) + continue; + + double track1_mass, track2_mass; + bool track1f{false}; // true means pion + + if (std::fabs(particle1.pdgCode()) == 211) { + track1f = true; + track1_mass = massPi; + } else { + track1_mass = massKa; + } + + if (std::fabs(particle2.pdgCode()) == 211) { + track2_mass = massPi; + } else { + track2_mass = massKa; + } + + if (track1_mass == track2_mass) { + return; + } + + bool exists1 = std::find(mcMemory.begin(), mcMemory.end(), mcindex1) != mcMemory.end(); + bool exists2 = std::find(mcMemory.begin(), mcMemory.end(), mcindex2) != mcMemory.end(); + if (exists1 || exists2) { + continue; + } else { + mcMemory.push_back(trk1.globalIndex()); + mcMemory.push_back(trk2.globalIndex()); + } + + TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; + lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), track1_mass); + lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), track2_mass); + lResonance = lDecayDaughter1 + lDecayDaughter2; + if (cfgMcHistos) { - histos.fill(HIST("hMC_USS_True"), centrality, KstarPt_Kpi, Minv_Kpi); + histos.fill(HIST("hMC_USS_True"), centrality, lResonance.Pt(), lResonance.M()); + if (track1f) { + histos.fill(HIST("hMC_USS_PiK_True"), centrality, lResonance.Pt(), lResonance.M()); + } else { + histos.fill(HIST("hMC_USS_KPi_True"), centrality, lResonance.Pt(), lResonance.M()); + } } //====================== } // for } // TrackSlicingMC template - std::pair minvReconstruction(const TracksType& trk1, const TracksType& trk2, const bool QA) + std::pair minvReconstruction(const TracksType& trk1, const TracksType& trk2, const bool QA, const bool flip) { if (!trackSelection(trk1, false) || !trackSelection(trk2, false)) return {-1.0, -1.0}; - if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA)) { - return {-1.0, -1.0}; + if (!flip) { + if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA)) { + return {-1.0, -1.0}; + } + } else { + if (!trackPIDPion(trk1, false) || !trackPIDKaon(trk2, false)) + return {-1.0, -1.0}; } - if (trk1.globalIndex() == trk2.globalIndex()) + if (trk1.index() >= trk2.index()) return {-1.0, -1.0}; - TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; - lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa); - lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massPi); + // if (trk1.globalIndex() == trk2.globalIndex()) + // return {-1.0, -1.0}; + TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; + if (!flip) { + lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa); + lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massPi); + } else { + lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massPi); + lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massKa); + } lResonance = lDecayDaughter1 + lDecayDaughter2; if (std::abs(lResonance.Eta()) > cfgTrackMaxEta) @@ -592,6 +669,36 @@ struct kstarInOO { if (!INELgt0) return; + auto tracks1 = kaonMC->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + for (const auto& kaon : tracks1) { + if (!trackSelection(kaon, false)) + continue; + if (!trackPIDKaon(kaon, false)) + continue; + auto particle1 = kaon.mcParticle(); + if (std::fabs(particle1.pdgCode()) == 321) + histos.fill(HIST("hSimpleKaon_PID_Purity"), 1); // histogram with two bins, -1.5, 1.5 fill 1 or -1 + else if (std::fabs(particle1.pdgCode()) == 211) + histos.fill(HIST("hSimpleKaon_PID_Purity"), -1); // histogram with two bins, -1.5, 1.5 fill 1 or -1 + else + histos.fill(HIST("hSimpleKaon_PID_Purity"), 0); // histogram with two bins, -1.5, 1.5 fill 1 or -1 + } + + auto tracks2 = pionMC->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + for (const auto& pion : tracks2) { + if (!trackSelection(pion, false)) + continue; + if (!trackPIDPion(pion, false)) + continue; + auto particle2 = pion.mcParticle(); + if (std::fabs(particle2.pdgCode()) == 211) + histos.fill(HIST("hSimplePion_PID_Purity"), 1); // histogram with two bins, -1.5, 1.5 fill 1 or -1 + else if (std::fabs(particle2.pdgCode()) == 321) + histos.fill(HIST("hSimplePion_PID_Purity"), -1); // histogram with two bins, -1.5, 1.5 fill 1 or -1 + else + histos.fill(HIST("hSimplePion_PID_Purity"), 0); // histogram with two bins, -1.5, 1.5 fill 1 or -1 + } + if (cfgMcHistos) { histos.fill(HIST("nEvents_MC"), 1.5); } From 113ee0f4c8cea88c4d2ebfa2c572c1aa160c9b6f Mon Sep 17 00:00:00 2001 From: lucamicheletti93 <38209984+lucamicheletti93@users.noreply.github.com> Date: Thu, 16 Oct 2025 11:21:38 +0200 Subject: [PATCH 774/986] [PWGDQ] Adding extra events selections (#13394) Co-authored-by: Lucamicheletti93 --- PWGDQ/Core/CutsLibrary.cxx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/PWGDQ/Core/CutsLibrary.cxx b/PWGDQ/Core/CutsLibrary.cxx index ee152f11b6b..73bbed6cf69 100644 --- a/PWGDQ/Core/CutsLibrary.cxx +++ b/PWGDQ/Core/CutsLibrary.cxx @@ -3782,6 +3782,19 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName) return cut; } + if (!nameStr.compare("eventSel8NoSameBunch")) { + cut->AddCut(VarManager::kIsSel8, 0.5, 1.5); + cut->AddCut(VarManager::kIsNoSameBunch, 0.5, 1.5); + return cut; + } + + if (!nameStr.compare("eventSel8NoSameBunchGoodZvtx")) { + cut->AddCut(VarManager::kIsSel8, 0.5, 1.5); + cut->AddCut(VarManager::kIsNoSameBunch, 0.5, 1.5); + cut->AddCut(VarManager::kIsGoodZvtxFT0vsPV, 0.5, 1.5); + return cut; + } + if (!nameStr.compare("eventStandardSel8PbPbQuality")) { cut->AddCut(VarManager::kVtxZ, -10.0, 10.0); cut->AddCut(VarManager::kIsSel8, 0.5, 1.5); From d0de9d7a5211df53633d53d3fbf9c69cec159465 Mon Sep 17 00:00:00 2001 From: Maximiliano Puccio Date: Thu, 16 Oct 2025 11:25:11 +0200 Subject: [PATCH 775/986] [PWGLF] feat(hypernuclei): Add two-body decay flag for hypernuclei analysis (#13402) Co-authored-by: ALICE Builder --- PWGLF/DataModel/LFHypernucleiTables.h | 4 +++- PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/PWGLF/DataModel/LFHypernucleiTables.h b/PWGLF/DataModel/LFHypernucleiTables.h index 6f673326b2e..2ec1e718df5 100644 --- a/PWGLF/DataModel/LFHypernucleiTables.h +++ b/PWGLF/DataModel/LFHypernucleiTables.h @@ -85,6 +85,7 @@ DECLARE_SOA_COLUMN(IsFakeHeOnITSLayer, isFakeHeOnITSLayer, uint8_t); // uint8_t DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); // bool: true for signal DECLARE_SOA_COLUMN(IsRecoMCCollision, isRecoMCCollision, bool); // bool: true for reco MC collision DECLARE_SOA_COLUMN(IsSurvEvSel, isSurvEvSel, bool); // bool: true for survived event selection +DECLARE_SOA_COLUMN(IsTwoBodyDecay, isTwoBodyDecay, bool); // bool: true for two body decay } // namespace hyperrec DECLARE_SOA_TABLE(DataHypCands, "AOD", "HYPCANDS", @@ -148,7 +149,8 @@ DECLARE_SOA_TABLE(MCHypCands, "AOD", "MCHYPCANDS", hyperrec::IsFakeHeOnITSLayer, hyperrec::IsSignal, hyperrec::IsRecoMCCollision, - hyperrec::IsSurvEvSel); + hyperrec::IsSurvEvSel, + hyperrec::IsTwoBodyDecay); DECLARE_SOA_TABLE(DataHypCandsWColl, "AOD", "HYPCANDSWCOLL", o2::soa::Index<>, diff --git a/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx b/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx index 80854f81617..de6d3e599bf 100644 --- a/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx @@ -798,7 +798,7 @@ struct hyperRecoTask { hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags, trackedHypClSize, chargeFactor * hypCand.genPt(), hypCand.genPhi(), hypCand.genEta(), hypCand.genPtHe3(), hypCand.gDecVtx[0], hypCand.gDecVtx[1], hypCand.gDecVtx[2], - hypCand.isReco, hypCand.isFakeHeOnITSLayer, hypCand.isSignal, hypCand.isRecoMCCollision, hypCand.isSurvEvSelection); + hypCand.isReco, hypCand.isFakeHeOnITSLayer, hypCand.isSignal, hypCand.isRecoMCCollision, hypCand.isSurvEvSelection, 1); } // now we fill only the signal candidates that were not reconstructed @@ -826,7 +826,6 @@ struct hyperRecoTask { } if (!isHeFound) { hDecayChannel->Fill(1.); - continue; } hDecayChannel->Fill(0.); if (mcPart.pdgCode() > 0) { @@ -871,7 +870,7 @@ struct hyperRecoTask { -1, -1, -1, false, chargeFactor * hypCand.genPt(), hypCand.genPhi(), hypCand.genEta(), hypCand.genPtHe3(), hypCand.gDecVtx[0], hypCand.gDecVtx[1], hypCand.gDecVtx[2], - hypCand.isReco, -1, hypCand.isSignal, hypCand.isRecoMCCollision, hypCand.isSurvEvSelection); + hypCand.isReco, -1, hypCand.isSignal, hypCand.isRecoMCCollision, hypCand.isSurvEvSelection, isHeFound); } } PROCESS_SWITCH(hyperRecoTask, processMC, "MC analysis", false); From e2d8b720012f5231f6d3bb5eca7c149074f2cf41 Mon Sep 17 00:00:00 2001 From: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Date: Thu, 16 Oct 2025 13:45:40 +0200 Subject: [PATCH 776/986] [PWGCF] add trigger histogran for FT0A-FT0C (#13397) --- .../Tasks/longRangeDihadronCor.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx b/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx index 5cd920840fb..e2ed5a4cfe0 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx @@ -279,8 +279,6 @@ struct LongRangeDihadronCor { registry.add("Centrality_used", hCentTitle.c_str(), {HistType::kTH1D, {{100, 0, 100}}}); // histogram to see how many events are in the same and mixed event registry.add("zVtx", "zVtx", {HistType::kTH1D, {axisVertex}}); registry.add("zVtx_used", "zVtx_used", {HistType::kTH1D, {axisVertex}}); - registry.add("Trig_hist_TPC_FT0A", "", {HistType::kTHnSparseF, {{axisSample, axisVertex, axisPtTrigger}}}); - registry.add("Trig_hist_TPC_FT0C", "", {HistType::kTHnSparseF, {{axisSample, axisVertex, axisPtTrigger}}}); registry.add("FT0Amp", "", {HistType::kTH2F, {axisChID, axisFit}}); registry.add("FT0AmpCorrect", "", {HistType::kTH2F, {axisChID, axisFit}}); } @@ -289,16 +287,19 @@ struct LongRangeDihadronCor { registry.add("deltaEta_deltaPhi_mixed_TPC_FT0A", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEtaTpcFt0a}}); registry.add("Assoc_amp_same_TPC_FT0A", "", {HistType::kTH2D, {axisChannelFt0aAxis, axisAmplitudeFt0a}}); registry.add("Assoc_amp_mixed_TPC_FT0A", "", {HistType::kTH2D, {axisChannelFt0aAxis, axisAmplitudeFt0a}}); + registry.add("Trig_hist_TPC_FT0A", "", {HistType::kTHnSparseF, {{axisSample, axisVertex, axisPtTrigger}}}); } if (doprocessSameTpcFt0c) { registry.add("deltaEta_deltaPhi_same_TPC_FT0C", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEtaTpcFt0c}}); // check to see the delta eta and delta phi distribution registry.add("deltaEta_deltaPhi_mixed_TPC_FT0C", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEtaTpcFt0c}}); registry.add("Assoc_amp_same_TPC_FT0C", "", {HistType::kTH2D, {axisChannelFt0aAxis, axisAmplitudeFt0a}}); registry.add("Assoc_amp_mixed_TPC_FT0C", "", {HistType::kTH2D, {axisChannelFt0aAxis, axisAmplitudeFt0a}}); + registry.add("Trig_hist_TPC_FT0C", "", {HistType::kTHnSparseF, {{axisSample, axisVertex, axisPtTrigger}}}); } if (doprocessSameFt0aFt0c) { registry.add("deltaEta_deltaPhi_same_FT0A_FT0C", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEtaFt0aFt0c}}); // check to see the delta eta and delta phi distribution registry.add("deltaEta_deltaPhi_mixed_FT0A_FT0C", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEtaFt0aFt0c}}); + registry.add("Trig_hist_FT0A_FT0C", "", {HistType::kTHnSparseF, {{axisSample, axisVertex, axisPtTrigger}}}); } registry.add("eventcount", "bin", {HistType::kTH1F, {{4, 0, 4, "bin"}}}); // histogram to see how many events are in the same and mixed event @@ -621,6 +622,10 @@ struct LongRangeDihadronCor { auto phiA = getPhiFT0(chanelAid, kFT0A); auto etaA = getEtaFT0(chanelAid, kFT0A); + if (system == SameEvent) { + registry.fill(HIST("Trig_hist_FT0A_FT0C"), fSampleIndex, posZ, 0.5, eventWeight * amplA); + } + for (std::size_t iChC = 0; iChC < channelCSize; iChC++) { int chanelCid = 0; float amplC = 0.; From 8cb767337953f84c6277ff081c1ccbe1d7142a4f Mon Sep 17 00:00:00 2001 From: Mingyu Zhang <83645570+Mingyu3360715@users.noreply.github.com> Date: Thu, 16 Oct 2025 14:03:30 +0200 Subject: [PATCH 777/986] [PWGHF] Add normalised variable to Lc tree creator lite table (#13407) --- PWGHF/TableProducer/treeCreatorLcToPKPi.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx b/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx index f1986fe72e3..7bc710c8a9e 100644 --- a/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx @@ -223,6 +223,7 @@ DECLARE_SOA_TABLE(HfCandLcLites, "AOD", "HFCANDLCLITE", hf_cand::Chi2PCA, full::DecayLength, full::DecayLengthXY, + full::DecayLengthXYNormalised, full::PtProng0, full::PtProng1, full::PtProng2, @@ -644,6 +645,7 @@ struct HfTreeCreatorLcToPKPi { candidate.chi2PCA(), candidate.decayLength(), candidate.decayLengthXY(), + candidate.decayLengthXYNormalised(), candidate.ptProng0(), candidate.ptProng1(), candidate.ptProng2(), From e3deb22786f24a3d947fa6650f8186f129fa4c18 Mon Sep 17 00:00:00 2001 From: mcoquet642 <74600025+mcoquet642@users.noreply.github.com> Date: Thu, 16 Oct 2025 14:20:29 +0200 Subject: [PATCH 778/986] [PWGDQ] Adding protection to dqEfficiency_withAssoc for empty TF (#13393) Co-authored-by: Maurice Coquet --- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index 4f5b368d6f9..09908da4777 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -1725,6 +1725,10 @@ struct AnalysisSameEventPairing { template void runSameEventPairing(TEvents const& events, Preslice& preslice, TTrackAssocs const& assocs, TTracks const& /*tracks*/, ReducedMCEvents const& /*mcEvents*/, ReducedMCTracks const& /*mcTracks*/) { + if (events.size() == 0) { + LOG(warning) << "No events in this TF, going to the next one ..."; + return; + } if (fCurrentRun != events.begin().runNumber()) { initParamsFromCCDB(events.begin().timestamp(), TTwoProngFitter); fCurrentRun = events.begin().runNumber(); From ac2da1334e985d66be49b77a4083464042a03a89 Mon Sep 17 00:00:00 2001 From: a-m-andrushko <96832230+a-m-andrushko@users.noreply.github.com> Date: Thu, 16 Oct 2025 14:43:43 +0200 Subject: [PATCH 779/986] [PWGCF] FemtoUniverse -- Add bins to helicity angle analysis. (#13412) --- .../femtoUniversePairTaskTrackV0Helicity.cxx | 359 +++++++++++++----- 1 file changed, 272 insertions(+), 87 deletions(-) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Helicity.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Helicity.cxx index 0801d404a4a..93a88a70071 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Helicity.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Helicity.cxx @@ -14,6 +14,7 @@ /// \author Andi Mathis, TU München, andreas.mathis@ph.tum.de /// \author Zuzanna Chochulska, WUT Warsaw & CTU Prague, zchochul@cern.ch /// \author Shirajum Monira, WUT Warsaw, shirajum.monira.dokt@pw.edu.pl +/// \author Anna-Mariia Andrushko, WUT Warsaw, anna-mariia.andrushko@cern.ch #include "PWGCF/FemtoUniverse/Core/FemtoUniverseContainer.h" #include "PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h" @@ -63,30 +64,32 @@ struct FemtoUniversePairTaskTrackV0Helicity { using FemtoTruthParticles = soa::Join; Preslice perColMCTruth = aod::femtouniverseparticle::fdCollisionId; - /// To apply narrow cut - Configurable confZVertexCut{"confZVertexCut", 10.f, "Event sel: Maximum z-Vertex (cm)"}; + /// To apply a narrow cut + Configurable confZVertexCut{"confZVertexCut", 10.f, "Event selection -- maximum z-vertex (cm)"}; Configurable confEta{"confEta", 0.8, "Eta cut for the global track"}; /// Particle 1 (track) - Configurable confTrkPDGCodePartOne{"confTrkPDGCodePartOne", 211, "Particle 1 (Track) - PDG code"}; - Configurable confTrackChoicePartOne{"confTrackChoicePartOne", 1, "0:Proton, 1:Pion, 2:Kaon"}; - ConfigurableAxis confTrkTempFitVarBins{"confTrkTempFitVarBins", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot"}; - ConfigurableAxis confTrkTempFitVarpTBins{"confTrkTempFitVarpTBins", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot"}; - Configurable confChargePart1{"confChargePart1", 0, "sign of particle 1"}; - Configurable confHPtPart1{"confHPtPart1", 4.0f, "higher limit for pt of particle 1"}; - Configurable confLPtPart1{"confLPtPart1", 0.3f, "lower limit for pt of particle 1"}; - Configurable confmom{"confmom", 0.5, "momentum threshold for particle identification using TOF"}; - Configurable confNsigmaTPCParticle{"confNsigmaTPCParticle", 3.0, "TPC Sigma for particle momentum < confmom"}; - Configurable confNsigmaCombinedParticle{"confNsigmaCombinedParticle", 3.0, "TPC and TOF Sigma (combined) for particle momentum > confmom"}; + struct : o2::framework::ConfigurableGroup { + Configurable confTrkPDGCodePartOne{"confTrkPDGCodePartOne", 211, "Particle 1 (track) -- PDG code"}; + Configurable confTrackChoicePartOne{"confTrackChoicePartOne", 1, "0: Proton, 1: Pion, 2: Kaon"}; + ConfigurableAxis confTrkTempFitVarBins{"confTrkTempFitVarBins", {300, -0.15, 0.15}, "TempFitVar binning in the pT vs. TempFitVar plot"}; + ConfigurableAxis confTrkTempFitVarpTBins{"confTrkTempFitVarpTBins", {20, 0.5, 4.05}, "pT binning in the pT vs. TempFitVar plot"}; + Configurable confChargePart1{"confChargePart1", 0, "Particle 1 sign"}; + Configurable confHPtPart1{"confHPtPart1", 4.0f, "Particle 1 pT higher limit"}; + Configurable confLPtPart1{"confLPtPart1", 0.3f, "Particle 1 pT lower limit"}; + Configurable confTOFmom{"confTOFmom", 0.5, "Momentum threshold for particle identification using TOF"}; + Configurable confNsigmaTPCParticle{"confNsigmaTPCParticle", 3.0, "TPC nSigma for particle momentum < confTOFmom"}; + Configurable confNsigmaCombinedParticle{"confNsigmaCombinedParticle", 3.0, "TPC and TOF nSigma (combined) for particle momentum > confTOFmom"}; + } trackconfigs; Filter collisionFilter = (nabs(aod::collision::posZ) < confZVertexCut); using FilteredFDCollisions = soa::Filtered; using FilteredFDCollision = FilteredFDCollisions::iterator; - /// Partition for particle 1 - Partition partsOne = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == confChargePart1) && (nabs(aod::femtouniverseparticle::eta) < confEta) && (aod::femtouniverseparticle::pt < confHPtPart1) && (aod::femtouniverseparticle::pt > confLPtPart1); - Partition partsOneMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && (nabs(aod::femtouniverseparticle::eta) < confEta) && (aod::femtouniverseparticle::pt < confHPtPart1) && (aod::femtouniverseparticle::pt > confLPtPart1); - Partition partsOneMCReco = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == confChargePart1) && (nabs(aod::femtouniverseparticle::eta) < confEta) && (aod::femtouniverseparticle::pt < confHPtPart1) && (aod::femtouniverseparticle::pt > confLPtPart1); + /// Partitioning for particle 1 + Partition partsOne = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == trackconfigs.confChargePart1) && (nabs(aod::femtouniverseparticle::eta) < confEta) && (aod::femtouniverseparticle::pt < trackconfigs.confHPtPart1) && (aod::femtouniverseparticle::pt > trackconfigs.confLPtPart1); + Partition partsOneMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && (nabs(aod::femtouniverseparticle::eta) < confEta) && (aod::femtouniverseparticle::pt < trackconfigs.confHPtPart1) && (aod::femtouniverseparticle::pt > trackconfigs.confLPtPart1); + Partition partsOneMCReco = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == trackconfigs.confChargePart1) && (nabs(aod::femtouniverseparticle::eta) < confEta) && (aod::femtouniverseparticle::pt < trackconfigs.confHPtPart1) && (aod::femtouniverseparticle::pt > trackconfigs.confLPtPart1); /// Histogramming for particle 1 FemtoUniverseParticleHisto trackHistoPartOnePos; @@ -94,33 +97,35 @@ struct FemtoUniversePairTaskTrackV0Helicity { /// Particle 2 (V0) struct : o2::framework::ConfigurableGroup { - Configurable confV0PDGCodePartTwo{"confV0PDGCodePartTwo", 3122, "Particle 2 (V0) - PDG code"}; - ConfigurableAxis confV0TempFitVarBins{"confV0TempFitVarBins", {300, 0.95, 1.}, "V0: binning of the TempFitVar in the pT vs. TempFitVar plot"}; - ConfigurableAxis confV0TempFitVarpTBins{"confV0TempFitVarpTBins", {20, 0.5, 4.05}, "V0: pT binning of the pT vs. TempFitVar plot"}; - Configurable confV0Type1{"confV0Type1", 0, "select one of the V0s (lambda = 0, anti-lambda = 1, k0 = 2) for v0-v0 and Track-v0 combination"}; - Configurable confV0Type2{"confV0Type2", 0, "select one of the V0s (lambda = 0, anti-lambda = 1, k0 = 2) for v0-v0 combination"}; - Configurable confV0InvMassLowLimit{"confV0InvMassLowLimit", 1.10, "Lower limit of the V0 invariant mass"}; - Configurable confV0InvMassUpLimit{"confV0InvMassUpLimit", 1.13, "Upper limit of the V0 invariant mass"}; - ConfigurableAxis confChildTempFitVarBins{"confChildTempFitVarBins", {300, -0.15, 0.15}, "V0 child: binning of the TempFitVar in the pT vs. TempFitVar plot"}; - ConfigurableAxis confChildTempFitVarpTBins{"confChildTempFitVarpTBins", {20, 0.5, 4.05}, "V0 child: pT binning of the pT vs. TempFitVar plot"}; - Configurable confHPtPart2{"confHPtPart2", 4.0f, "higher limit for pt of particle 2"}; - Configurable confLPtPart2{"confLPtPart2", 0.3f, "lower limit for pt of particle 2"}; + Configurable confV0PDGCodePartTwo{"confV0PDGCodePartTwo", 3122, "Particle 2 (V0) -- PDG code"}; + ConfigurableAxis confV0TempFitVarBins{"confV0TempFitVarBins", {300, 0.95, 1.}, "V0: TempFitVar binning in the pT vs. TempFitVar plot"}; + ConfigurableAxis confV0TempFitVarpTBins{"confV0TempFitVarpTBins", {20, 0.5, 4.05}, "V0: pT binning in the pT vs. TempFitVar plot"}; + Configurable confV0Type1{"confV0Type1", 0, "Select V0 (Lambda = 0, Anti-lambda = 1, K0 = 2) for Track-V0 and V0-V0 combinations"}; + Configurable confV0Type2{"confV0Type2", 0, "Select V0 (Lambda = 0, Anti-lambda = 1, K0 = 2) for V0-V0 combinations"}; + Configurable confV0InvMassLowLimit{"confV0InvMassLowLimit", 1.10, "Invariant mass lower limit"}; + Configurable confV0InvMassUpLimit{"confV0InvMassUpLimit", 1.13, "Invariant mass upper limit"}; + ConfigurableAxis confChildTempFitVarBins{"confChildTempFitVarBins", {300, -0.15, 0.15}, "V0 child: TempFitVar binning in the pT vs. TempFitVar plot"}; + ConfigurableAxis confChildTempFitVarpTBins{"confChildTempFitVarpTBins", {20, 0.5, 4.05}, "V0 child: pT binning in the pT vs. TempFitVar plot"}; + Configurable confHPtPart2{"confHPtPart2", 4.0f, "Particle 2 pT higher limit"}; + Configurable confLPtPart2{"confLPtPart2", 0.3f, "Particle 2 pT higher limit"}; Configurable confPDGCodeV0{"confPDGCodeV0", 3122, "V0 -- PDG code"}; Configurable confPDGCodePosChild{"confPDGCodePosChild", 2212, "Positive Child -- PDG code"}; Configurable confPDGCodeNegChild{"confPDGCodeNegChild", 211, "Negative Child -- PDG code"}; } V0configs; - /// Partition for particle 2 + /// Partitioning for particle 2 Partition partsTwo = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kV0)) && (aod::femtouniverseparticle::pt < V0configs.confHPtPart2) && (aod::femtouniverseparticle::pt > V0configs.confLPtPart2); Partition partsTwoMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && (aod::femtouniverseparticle::pt < V0configs.confHPtPart2) && (aod::femtouniverseparticle::pt > V0configs.confLPtPart2); Partition partsTwoMCReco = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kV0)) && (aod::femtouniverseparticle::pt < V0configs.confHPtPart2) && (aod::femtouniverseparticle::pt > V0configs.confLPtPart2); Partition partsTwoMCTruth = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && (aod::femtouniverseparticle::pt < V0configs.confHPtPart2) && (aod::femtouniverseparticle::pt > V0configs.confLPtPart2); /// Histogramming for particle 2 + /// Track-V0 FemtoUniverseParticleHisto trackHistoPartTwo; FemtoUniverseParticleHisto posChildHistos; FemtoUniverseParticleHisto negChildHistos; + /// V0-V0 FemtoUniverseParticleHisto trackHistoV0Type1; FemtoUniverseParticleHisto posChildV0Type1; FemtoUniverseParticleHisto negChildV0Type1; @@ -128,50 +133,76 @@ struct FemtoUniversePairTaskTrackV0Helicity { FemtoUniverseParticleHisto posChildV0Type2; FemtoUniverseParticleHisto negChildV0Type2; - /// Histogramming for Event + /// Histogramming for event FemtoUniverseEventHisto eventHisto; /// Correlation part - // Configurable confTrackChoicePartTwo{"confTrackChoicePartTwo", 1, "0:Proton, 1:Pion, 2:Kaon"}; //not used - Configurable confIsMC{"confIsMC", false, "Enable additional Histograms in the case of a MonteCarlo Run"}; + // Configurable confTrackChoicePartTwo{"confTrackChoicePartTwo", 1, "0: Proton, 1: Pion, 2: Kaon"}; // not used + Configurable confIsMC{"confIsMC", false, "Enable additional histograms in the case of Monte Carlo data"}; Configurable confUse3D{"confUse3D", false, "Enable three dimensional histogramms (to be used only for analysis with high statistics): k* vs mT vs multiplicity"}; Configurable confUseCent{"confUseCent", false, "Use centrality in place of multiplicity"}; - ConfigurableAxis confMultBins{"confMultBins", {VARIABLE_WIDTH, 0.0f, 20.0f, 40.0f, 60.0f, 80.0f, 100.0f, 200.0f, 99999.f}, "Mixing bins - multiplicity"}; - ConfigurableAxis confVtxBins{"confVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; + ConfigurableAxis confMultBins{"confMultBins", {VARIABLE_WIDTH, 0.0f, 20.0f, 40.0f, 60.0f, 80.0f, 100.0f, 200.0f, 99999.f}, "Mixing bins -- multiplicity"}; + ConfigurableAxis confVtxBins{"confVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins -- z-vertex"}; Configurable confNEventsMix{"confNEventsMix", 5, "Number of events for mixing"}; - ConfigurableAxis confkstarBins{"confkstarBins", {1500, 0., 6.}, "binning kstar"}; - ConfigurableAxis confkTBins{"confkTBins", {150, 0., 9.}, "binning kT"}; - ConfigurableAxis confmTBins{"confmTBins", {225, 0., 7.5}, "binning mT"}; + ConfigurableAxis confkstarBins{"confkstarBins", {1500, 0., 6.}, "k* binning"}; + ConfigurableAxis confkTBins{"confkTBins", {150, 0., 9.}, "kT binning"}; + ConfigurableAxis confmTBins{"confmTBins", {225, 0., 7.5}, "mT binning"}; Configurable confIsCPR{"confIsCPR", true, "Close Pair Rejection"}; Configurable confCPRPlotPerRadii{"confCPRPlotPerRadii", false, "Plot CPR per radii"}; - Configurable confCPRdeltaPhiCutMax{"confCPRdeltaPhiCutMax", 0.0, "Delta Phi max cut for Close Pair Rejection"}; - Configurable confCPRdeltaPhiCutMin{"confCPRdeltaPhiCutMin", 0.0, "Delta Phi min cut for Close Pair Rejection"}; - Configurable confCPRdeltaEtaCutMax{"confCPRdeltaEtaCutMax", 0.0, "Delta Eta max cut for Close Pair Rejection"}; - Configurable confCPRdeltaEtaCutMin{"confCPRdeltaEtaCutMin", 0.0, "Delta Eta min cut for Close Pair Rejection"}; - Configurable confCPRChosenRadii{"confCPRChosenRadii", 0.80, "Delta Eta cut for Close Pair Rejection"}; + Configurable confCPRdeltaPhiCutMax{"confCPRdeltaPhiCutMax", 0.0, "Delta Phi max cut for CPR"}; + Configurable confCPRdeltaPhiCutMin{"confCPRdeltaPhiCutMin", 0.0, "Delta Phi min cut for CPR"}; + Configurable confCPRdeltaEtaCutMax{"confCPRdeltaEtaCutMax", 0.0, "Delta Eta max cut for CPR"}; + Configurable confCPRdeltaEtaCutMin{"confCPRdeltaEtaCutMin", 0.0, "Delta Eta min cut for CPR"}; + Configurable confCPRChosenRadii{"confCPRChosenRadii", 0.80, "Delta Eta cut for CPR"}; Configurable confPhiBins{"confPhiBins", 29, "Number of phi bins in deta dphi"}; Configurable confEtaBins{"confEtaBins", 29, "Number of eta bins in deta dphi"}; - ConfigurableAxis confmTBins3D{"confmTBins3D", {VARIABLE_WIDTH, 1.02f, 1.14f, 1.20f, 1.26f, 1.38f, 1.56f, 1.86f, 4.50f}, "mT Binning for the 3Dimensional plot: k* vs multiplicity vs mT (set <> to true in order to use)"}; - ConfigurableAxis confMultBins3D{"confMultBins3D", {VARIABLE_WIDTH, 0.0f, 20.0f, 30.0f, 40.0f, 99999.0f}, "multiplicity Binning for the 3Dimensional plot: k* vs multiplicity vs mT (set <> to true in order to use)"}; + ConfigurableAxis confmTBins3D{"confmTBins3D", {VARIABLE_WIDTH, 1.02f, 1.14f, 1.20f, 1.26f, 1.38f, 1.56f, 1.86f, 4.50f}, "mT binning for the 3D plot: k* vs multiplicity vs mT (set to true in order to use)"}; + ConfigurableAxis confMultBins3D{"confMultBins3D", {VARIABLE_WIDTH, 0.0f, 20.0f, 30.0f, 40.0f, 99999.0f}, "multiplicity binning for the 3D plot: k* vs multiplicity vs mT (set to true in order to use)"}; + + /// Helicity ranges (approximate) + Configurable cfgProcessHel{"cfgProcessHel", true, "Process particle pairs from all helicity ranges"}; + Configurable cfgProcessHel1{"cfgProcessHel1", false, "Process particle pairs from the helicity range 1"}; // 1.0 > cosineTheta >= 0.1 + Configurable cfgProcessHel2{"cfgProcessHel2", false, "Process particle pairs from the helicity range 2"}; // 0.1 > cosineTheta >= -0.1 + Configurable cfgProcessHel3{"cfgProcessHel3", false, "Process particle pairs from the helicity range 3"}; // -0.1 > cosineTheta >= -0.5 + Configurable cfgProcessHel4{"cfgProcessHel4", false, "Process particle pairs from the helicity range 4"}; // -0.5 > cosineTheta >= -1.0 - // Efficiency + /// Efficiency Configurable confLocalEfficiency{"confLocalEfficiency", "", "Local path to efficiency .root file"}; - static constexpr unsigned int V0ChildTable[][2] = {{0, 1}, {1, 0}, {1, 1}}; // Table to select the V0 children + static constexpr unsigned int V0ChildTable[][2] = {{0, 1}, {1, 0}, {1, 1}}; // table to select V0 children + /// Containers FemtoUniverseContainer sameEventCont; FemtoUniverseContainer mixedEventCont; + + FemtoUniverseContainer sameEventContHel1; + FemtoUniverseContainer mixedEventContHel1; + + FemtoUniverseContainer sameEventContHel2; + FemtoUniverseContainer mixedEventContHel2; + + FemtoUniverseContainer sameEventContHel3; + FemtoUniverseContainer mixedEventContHel3; + + FemtoUniverseContainer sameEventContHel4; + FemtoUniverseContainer mixedEventContHel4; + FemtoUniversePairCleaner pairCleaner; FemtoUniversePairCleaner pairCleanerV0; + FemtoUniverseDetaDphiStar pairCloseRejection; FemtoUniverseDetaDphiStar pairCloseRejectionV0; /// Histogram output HistogramRegistry qaRegistry{"TrackQA", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry thetaRegistry{"ThetaQA", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry resultRegistry{"Correlations", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry registryMCtruth{"MCtruthHistos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; HistogramRegistry registryMCreco{"MCrecoHistos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; + HistogramRegistry resultRegistry{"Correlations", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry resultRegistryHel1{"CorrelationsHel1", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry resultRegistryHel2{"CorrelationsHel2", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry resultRegistryHel3{"CorrelationsHel3", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry resultRegistryHel4{"CorrelationsHel4", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry mixQaRegistry{"mixQaRegistry", {}, OutputObjHandlingPolicy::AnalysisObject}; std::unique_ptr plocalEffFile; @@ -180,10 +211,10 @@ struct FemtoUniversePairTaskTrackV0Helicity { bool isNSigmaCombined(float mom, float nsigmaTPCParticle, float nsigmaTOFParticle) { - if (mom <= confmom) { - return (std::abs(nsigmaTPCParticle) < confNsigmaTPCParticle); + if (mom <= trackconfigs.confTOFmom) { + return (std::abs(nsigmaTPCParticle) < trackconfigs.confNsigmaTPCParticle); } else { - return (std::hypot(nsigmaTOFParticle, nsigmaTPCParticle) < confNsigmaCombinedParticle); + return (std::hypot(nsigmaTOFParticle, nsigmaTPCParticle) < trackconfigs.confNsigmaCombinedParticle); } } @@ -197,7 +228,7 @@ struct FemtoUniversePairTaskTrackV0Helicity { bool isNSigmaTPC(float nsigmaTPCParticle) { - if (std::abs(nsigmaTPCParticle) < confNsigmaTPCParticle) { + if (std::abs(nsigmaTPCParticle) < trackconfigs.confNsigmaTPCParticle) { return true; } else { return false; @@ -225,16 +256,20 @@ struct FemtoUniversePairTaskTrackV0Helicity { void init(InitContext&) { eventHisto.init(&qaRegistry); + qaRegistry.add("Tracks_pos/nSigmaTPC", "; #it{p} (GeV/#it{c}); n#sigma_{TPC}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); qaRegistry.add("Tracks_pos/nSigmaTOF", "; #it{p} (GeV/#it{c}); n#sigma_{TOF}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); qaRegistry.add("Tracks_neg/nSigmaTPC", "; #it{p} (GeV/#it{c}); n#sigma_{TPC}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); qaRegistry.add("Tracks_neg/nSigmaTOF", "; #it{p} (GeV/#it{c}); n#sigma_{TOF}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); - trackHistoPartOnePos.init(&qaRegistry, confTrkTempFitVarpTBins, confTrkTempFitVarBins, confIsMC, confTrkPDGCodePartOne); - trackHistoPartOneNeg.init(&qaRegistry, confTrkTempFitVarpTBins, confTrkTempFitVarBins, confIsMC, confTrkPDGCodePartOne); + + /// Track-V0 + trackHistoPartOnePos.init(&qaRegistry, trackconfigs.confTrkTempFitVarpTBins, trackconfigs.confTrkTempFitVarBins, confIsMC, trackconfigs.confTrkPDGCodePartOne); + trackHistoPartOneNeg.init(&qaRegistry, trackconfigs.confTrkTempFitVarpTBins, trackconfigs.confTrkTempFitVarBins, confIsMC, trackconfigs.confTrkPDGCodePartOne); trackHistoPartTwo.init(&qaRegistry, V0configs.confV0TempFitVarpTBins, V0configs.confV0TempFitVarBins, confIsMC, V0configs.confV0PDGCodePartTwo, true); posChildHistos.init(&qaRegistry, V0configs.confChildTempFitVarpTBins, V0configs.confChildTempFitVarBins, false, 0, true); negChildHistos.init(&qaRegistry, V0configs.confChildTempFitVarpTBins, V0configs.confChildTempFitVarBins, false, 0, true); + /// V0-V0 trackHistoV0Type1.init(&qaRegistry, V0configs.confV0TempFitVarpTBins, V0configs.confV0TempFitVarBins, confIsMC, V0configs.confV0PDGCodePartTwo, true, "V0Type1"); posChildV0Type1.init(&qaRegistry, V0configs.confChildTempFitVarpTBins, V0configs.confChildTempFitVarBins, false, 0, true, "posChildV0Type1"); negChildV0Type1.init(&qaRegistry, V0configs.confChildTempFitVarpTBins, V0configs.confChildTempFitVarBins, false, 0, true, "negChildV0Type1"); @@ -242,7 +277,7 @@ struct FemtoUniversePairTaskTrackV0Helicity { posChildV0Type2.init(&qaRegistry, V0configs.confChildTempFitVarpTBins, V0configs.confChildTempFitVarBins, false, 0, true, "posChildV0Type2"); negChildV0Type2.init(&qaRegistry, V0configs.confChildTempFitVarpTBins, V0configs.confChildTempFitVarBins, false, 0, true, "negChildV0Type2"); - // Helicity angle + /// Helicity angle thetaRegistry.add("Theta/hTheta", " ; p (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}}); thetaRegistry.add("Theta/hTheta3D_PosChild", " ; p_{V0} (GeV/#it{c}); cos(#theta); p_{Positive Child} (GeV/#it{c})", kTH3F, {{100, 0, 10}, {110, -1.1, 1.1}, {100, 0, 10}}); thetaRegistry.add("Theta/hTheta3D_NegChild", " ; p_{V0} (GeV/#it{c}); cos(#theta); p_{Negative Child} (GeV/#it{c})", kTH3F, {{100, 0, 10}, {110, -1.1, 1.1}, {100, 0, 10}}); @@ -253,9 +288,7 @@ struct FemtoUniversePairTaskTrackV0Helicity { thetaRegistry.add("Theta/NegativeChild/hThetaEta", " ; #eta; cos(#theta)", kTH2F, {{100, -1, 1}, {110, -1.1, 1.1}}); thetaRegistry.add("Theta/NegativeChild/hThetaPhi", " ; #phi; cos(#theta)", kTH2F, {{100, -1, 7}, {110, -1.1, 1.1}}); - mixQaRegistry.add("MixingQA/hMECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); - - // MC truth + /// MC Truth registryMCtruth.add("plus/MCtruthLambda", "MC truth Lambdas;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); registryMCtruth.add("minus/MCtruthLambda", "MC truth Lambdas;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); @@ -286,7 +319,7 @@ struct FemtoUniversePairTaskTrackV0Helicity { registryMCtruth.add("ThetaMCTruth/NegativeChild/hThetaEta", " ; #eta; cos(#theta)", kTH2F, {{100, -1, 1}, {110, -1.1, 1.1}}); registryMCtruth.add("ThetaMCTruth/NegativeChild/hThetaPhi", " ; #phi; cos(#theta)", kTH2F, {{100, -1, 7}, {110, -1.1, 1.1}}); - // MC reco + /// MC Reco registryMCreco.add("plus/MCrecoLambda", "MC reco Lambdas;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); registryMCreco.add("plus/MCrecoLambdaChildPr", "MC reco Lambdas;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); registryMCreco.add("plus/MCrecoLambdaChildPi", "MC reco Lambdas;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); @@ -316,10 +349,48 @@ struct FemtoUniversePairTaskTrackV0Helicity { registryMCreco.add("ThetaMCReco/NegativeChild/hThetaEta", " ; #eta; cos(#theta)", kTH2F, {{100, -1, 1}, {110, -1.1, 1.1}}); registryMCreco.add("ThetaMCReco/NegativeChild/hThetaPhi", " ; #phi; cos(#theta)", kTH2F, {{100, -1, 7}, {110, -1.1, 1.1}}); - sameEventCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, confIsMC, confUse3D); - sameEventCont.setPDGCodes(confTrkPDGCodePartOne, V0configs.confV0PDGCodePartTwo); - mixedEventCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, confIsMC, confUse3D); - mixedEventCont.setPDGCodes(confTrkPDGCodePartOne, V0configs.confV0PDGCodePartTwo); + /// Correlations + if (cfgProcessHel) { + sameEventCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, confIsMC, confUse3D); + sameEventCont.setPDGCodes(trackconfigs.confTrkPDGCodePartOne, V0configs.confV0PDGCodePartTwo); + + mixedEventCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, confIsMC, confUse3D); + mixedEventCont.setPDGCodes(trackconfigs.confTrkPDGCodePartOne, V0configs.confV0PDGCodePartTwo); + } + + if (cfgProcessHel1) { + sameEventContHel1.init(&resultRegistryHel1, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, confIsMC, confUse3D); + sameEventContHel1.setPDGCodes(trackconfigs.confTrkPDGCodePartOne, V0configs.confV0PDGCodePartTwo); + + mixedEventContHel1.init(&resultRegistryHel1, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, confIsMC, confUse3D); + mixedEventContHel1.setPDGCodes(trackconfigs.confTrkPDGCodePartOne, V0configs.confV0PDGCodePartTwo); + } + + if (cfgProcessHel2) { + sameEventContHel2.init(&resultRegistryHel2, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, confIsMC, confUse3D); + sameEventContHel2.setPDGCodes(trackconfigs.confTrkPDGCodePartOne, V0configs.confV0PDGCodePartTwo); + + mixedEventContHel2.init(&resultRegistryHel2, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, confIsMC, confUse3D); + mixedEventContHel2.setPDGCodes(trackconfigs.confTrkPDGCodePartOne, V0configs.confV0PDGCodePartTwo); + } + + if (cfgProcessHel3) { + sameEventContHel3.init(&resultRegistryHel3, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, confIsMC, confUse3D); + sameEventContHel3.setPDGCodes(trackconfigs.confTrkPDGCodePartOne, V0configs.confV0PDGCodePartTwo); + + mixedEventContHel3.init(&resultRegistryHel3, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, confIsMC, confUse3D); + mixedEventContHel3.setPDGCodes(trackconfigs.confTrkPDGCodePartOne, V0configs.confV0PDGCodePartTwo); + } + + if (cfgProcessHel4) { + sameEventContHel4.init(&resultRegistryHel4, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, confIsMC, confUse3D); + sameEventContHel4.setPDGCodes(trackconfigs.confTrkPDGCodePartOne, V0configs.confV0PDGCodePartTwo); + + mixedEventContHel4.init(&resultRegistryHel4, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, confIsMC, confUse3D); + mixedEventContHel4.setPDGCodes(trackconfigs.confTrkPDGCodePartOne, V0configs.confV0PDGCodePartTwo); + } + + mixQaRegistry.add("MixingQA/hMECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); pairCleaner.init(&qaRegistry); pairCleanerV0.init(&qaRegistry); @@ -333,7 +404,7 @@ struct FemtoUniversePairTaskTrackV0Helicity { if (!plocalEffFile || plocalEffFile.get()->IsZombie()) LOGF(fatal, "Could not load efficiency histogram from %s", confLocalEfficiency.value.c_str()); if (doprocessSameEvent || doprocessMixedEvent) { - plocalEffp1 = (confChargePart1 > 0) ? std::unique_ptr(plocalEffFile.get()->Get("PrPlus")) : std::unique_ptr(plocalEffFile.get()->Get("PrMinus")); // note: works only for protons for now + plocalEffp1 = (trackconfigs.confChargePart1 > 0) ? std::unique_ptr(plocalEffFile.get()->Get("PrPlus")) : std::unique_ptr(plocalEffFile.get()->Get("PrMinus")); // note: works only for protons for now plocalEffp2 = (V0configs.confV0Type1 == 0) ? std::unique_ptr(plocalEffFile.get()->Get("Lambda")) : std::unique_ptr(plocalEffFile.get()->Get("AntiLambda")); LOGF(info, "Loaded efficiency histograms for track-V0."); } else if (doprocessSameEventV0 || doprocessMixedEventV0) { @@ -343,9 +414,10 @@ struct FemtoUniversePairTaskTrackV0Helicity { } } } - /// This function processes the same event for track - V0 + + /// This function processes the same event for Track-V0 template - void doSameEvent(FilteredFDCollision const& col, PartType const& parts, PartitionType& groupPartsOne, PartitionType& groupPartsTwo, [[maybe_unused]] MCParticles mcParts = nullptr) + void doSameEvent(FilteredFDCollision const& col, PartType const& parts, PartitionType& groupPartsOne, PartitionType& groupPartsTwo, int helRange, [[maybe_unused]] MCParticles mcParts = nullptr) { const auto& magFieldTesla = col.magField(); @@ -388,15 +460,15 @@ struct FemtoUniversePairTaskTrackV0Helicity { const float tpcNSigmas[3] = {unPackInTable(part.tpcNSigmaStorePr()), unPackInTable(part.tpcNSigmaStorePi()), unPackInTable(part.tpcNSigmaStoreKa())}; const float tofNSigmas[3] = {unPackInTable(part.tofNSigmaStorePr()), unPackInTable(part.tofNSigmaStorePi()), unPackInTable(part.tofNSigmaStoreKa())}; - if (!isNSigmaCombined(part.p(), tpcNSigmas[confTrackChoicePartOne], tofNSigmas[confTrackChoicePartOne])) + if (!isNSigmaCombined(part.p(), tpcNSigmas[trackconfigs.confTrackChoicePartOne], tofNSigmas[trackconfigs.confTrackChoicePartOne])) continue; if (part.sign() > 0) { - qaRegistry.fill(HIST("Tracks_pos/nSigmaTPC"), part.p(), tpcNSigmas[confTrackChoicePartOne]); - qaRegistry.fill(HIST("Tracks_pos/nSigmaTOF"), part.p(), tofNSigmas[confTrackChoicePartOne]); + qaRegistry.fill(HIST("Tracks_pos/nSigmaTPC"), part.p(), tpcNSigmas[trackconfigs.confTrackChoicePartOne]); + qaRegistry.fill(HIST("Tracks_pos/nSigmaTOF"), part.p(), tofNSigmas[trackconfigs.confTrackChoicePartOne]); trackHistoPartOnePos.fillQA(part); } else if (part.sign() < 0) { - qaRegistry.fill(HIST("Tracks_neg/nSigmaTPC"), part.p(), tpcNSigmas[confTrackChoicePartOne]); - qaRegistry.fill(HIST("Tracks_neg/nSigmaTOF"), part.p(), tofNSigmas[confTrackChoicePartOne]); + qaRegistry.fill(HIST("Tracks_neg/nSigmaTPC"), part.p(), tpcNSigmas[trackconfigs.confTrackChoicePartOne]); + qaRegistry.fill(HIST("Tracks_neg/nSigmaTOF"), part.p(), tofNSigmas[trackconfigs.confTrackChoicePartOne]); trackHistoPartOneNeg.fillQA(part); } } @@ -407,7 +479,7 @@ struct FemtoUniversePairTaskTrackV0Helicity { if (!invMLambda(p2.mLambda(), p2.mAntiLambda())) continue; /// PID using stored binned nsigma - if (!isParticleCombined(p1, confTrackChoicePartOne)) + if (!isParticleCombined(p1, trackconfigs.confTrackChoicePartOne)) continue; // track cleaning if (!pairCleaner.isCleanPair(p1, p2, parts)) { @@ -428,10 +500,53 @@ struct FemtoUniversePairTaskTrackV0Helicity { float weight = 1.0f; if (plocalEffp1) weight = plocalEffp1.get()->GetBinContent(plocalEffp1->FindBin(p1.pt(), p1.eta())) * plocalEffp2.get()->GetBinContent(plocalEffp2->FindBin(p2.pt(), p2.eta())); - if constexpr (std::is_same::value) - sameEventCont.setPair(p1, p2, multCol, confUse3D, weight); - else - sameEventCont.setPair(p1, p2, multCol, confUse3D, weight); + + auto posChildMass = pdg->Mass(V0configs.confPDGCodePosChild); + auto negChildMass = pdg->Mass(V0configs.confPDGCodeNegChild); + auto posChildBoosted = FemtoUniverseMath::boostPRF(posChild, posChildMass, negChild, negChildMass); + auto cosineTheta = (posChildBoosted.Px() * p2.px() + posChildBoosted.Py() * p2.py() + posChildBoosted.Pz() * p2.pz()) / (posChildBoosted.P() * p2.p()); + + switch (helRange) { + case 0: { + if constexpr (std::is_same::value) + sameEventCont.setPair(p1, p2, multCol, confUse3D, weight); + else + sameEventCont.setPair(p1, p2, multCol, confUse3D, weight); + + break; + } + + case 1: { + if (cosineTheta < 1.0 && cosineTheta >= 0.1) + sameEventContHel1.setPair(p1, p2, multCol, confUse3D, weight); + + break; + } + + case 2: { + if (cosineTheta < 0.1 && cosineTheta >= -0.1) + sameEventContHel2.setPair(p1, p2, multCol, confUse3D, weight); + + break; + } + + case 3: { + if (cosineTheta < -0.1 && cosineTheta >= -0.5) + sameEventContHel3.setPair(p1, p2, multCol, confUse3D, weight); + + break; + } + + case 4: { + if (cosineTheta < -0.5 && cosineTheta >= -1.0) + sameEventContHel4.setPair(p1, p2, multCol, confUse3D, weight); + + break; + } + + default: + break; + } } } @@ -439,7 +554,21 @@ struct FemtoUniversePairTaskTrackV0Helicity { { auto groupPartsOne = partsOne->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); auto groupPartsTwo = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); - doSameEvent(col, parts, groupPartsOne, groupPartsTwo); + + if (cfgProcessHel) + doSameEvent(col, parts, groupPartsOne, groupPartsTwo, 0); + + if (cfgProcessHel1) + doSameEvent(col, parts, groupPartsOne, groupPartsTwo, 1); + + if (cfgProcessHel2) + doSameEvent(col, parts, groupPartsOne, groupPartsTwo, 2); + + if (cfgProcessHel3) + doSameEvent(col, parts, groupPartsOne, groupPartsTwo, 3); + + if (cfgProcessHel4) + doSameEvent(col, parts, groupPartsOne, groupPartsTwo, 4); } PROCESS_SWITCH(FemtoUniversePairTaskTrackV0Helicity, processSameEvent, "Enable processing same event for track - V0", false); @@ -447,7 +576,7 @@ struct FemtoUniversePairTaskTrackV0Helicity { { auto groupPartsOne = partsOneMCReco->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); auto groupPartsTwo = partsTwoMCReco->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); - doSameEvent(col, parts, groupPartsOne, groupPartsTwo, mcparts); + doSameEvent(col, parts, groupPartsOne, groupPartsTwo, 0, mcparts); } PROCESS_SWITCH(FemtoUniversePairTaskTrackV0Helicity, processSameEventMCReco, "Enable processing same event for track - V0 MC Reco", false); @@ -548,7 +677,7 @@ struct FemtoUniversePairTaskTrackV0Helicity { for (const auto& part : groupPartsOne) { int pdgCode = static_cast(part.pidCut()); - if (pdgCode != confTrkPDGCodePartOne) + if (pdgCode != trackconfigs.confTrkPDGCodePartOne) continue; const auto& pdgParticle = pdgMC->GetParticle(pdgCode); if (!pdgParticle) { @@ -564,7 +693,7 @@ struct FemtoUniversePairTaskTrackV0Helicity { /// Now build the combinations for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { - if (static_cast(p1.pidCut()) != confTrkPDGCodePartOne) + if (static_cast(p1.pidCut()) != trackconfigs.confTrkPDGCodePartOne) continue; int pdgCode2 = static_cast(p2.pidCut()); if ((V0configs.confV0Type1 == 0 && pdgCode2 != V0configs.confPDGCodeV0) || (V0configs.confV0Type1 == 1 && pdgCode2 != -V0configs.confPDGCodeV0)) @@ -624,7 +753,7 @@ struct FemtoUniversePairTaskTrackV0Helicity { /// This function processes the mixed event for track - V0 template - void doMixedEvent(FilteredFDCollisions const& cols, PartType const& parts, PartitionType& partitionOne, PartitionType& partitionTwo, [[maybe_unused]] MCParticles mcParts = nullptr) + void doMixedEvent(FilteredFDCollisions const& cols, PartType const& parts, PartitionType& partitionOne, PartitionType& partitionTwo, int helRange, [[maybe_unused]] MCParticles mcParts = nullptr) { ColumnBinningPolicy colBinningMult{{confVtxBins, confMultBins}, true}; ColumnBinningPolicy colBinningCent{{confVtxBins, confMultBins}, true}; @@ -647,7 +776,7 @@ struct FemtoUniversePairTaskTrackV0Helicity { if (!invMLambda(p2.mLambda(), p2.mAntiLambda())) continue; /// PID using stored binned nsigma - if (!isParticleCombined(p1, confTrackChoicePartOne)) + if (!isParticleCombined(p1, trackconfigs.confTrackChoicePartOne)) continue; const auto& posChild = parts.iteratorAt(p2.globalIndex() - 2); @@ -665,14 +794,57 @@ struct FemtoUniversePairTaskTrackV0Helicity { continue; } } + float weight = 1.0f; if (plocalEffp1) weight = plocalEffp1.get()->GetBinContent(plocalEffp1->FindBin(p1.pt(), p1.eta())) * plocalEffp2.get()->GetBinContent(plocalEffp2->FindBin(p2.pt(), p2.eta())); - if constexpr (std::is_same::value) - mixedEventCont.setPair(p1, p2, multCol, confUse3D, weight); - else - mixedEventCont.setPair(p1, p2, multCol, confUse3D, weight); + auto posChildMass = pdg->Mass(V0configs.confPDGCodePosChild); + auto negChildMass = pdg->Mass(V0configs.confPDGCodeNegChild); + auto posChildBoosted = FemtoUniverseMath::boostPRF(posChild, posChildMass, negChild, negChildMass); + auto cosineTheta = (posChildBoosted.Px() * p2.px() + posChildBoosted.Py() * p2.py() + posChildBoosted.Pz() * p2.pz()) / (posChildBoosted.P() * p2.p()); + + switch (helRange) { + case 0: { + if constexpr (std::is_same::value) + mixedEventCont.setPair(p1, p2, multCol, confUse3D, weight); + else + mixedEventCont.setPair(p1, p2, multCol, confUse3D, weight); + + break; + } + + case 1: { + if (cosineTheta < 1.0 && cosineTheta >= 0.1) + mixedEventContHel1.setPair(p1, p2, multCol, confUse3D, weight); + + break; + } + + case 2: { + if (cosineTheta < 0.1 && cosineTheta >= -0.1) + mixedEventContHel2.setPair(p1, p2, multCol, confUse3D, weight); + + break; + } + + case 3: { + if (cosineTheta < -0.1 && cosineTheta >= -0.5) + mixedEventContHel3.setPair(p1, p2, multCol, confUse3D, weight); + + break; + } + + case 4: { + if (cosineTheta < -0.5 && cosineTheta >= -1.0) + mixedEventContHel4.setPair(p1, p2, multCol, confUse3D, weight); + + break; + } + + default: + break; + } } }; @@ -691,13 +863,26 @@ struct FemtoUniversePairTaskTrackV0Helicity { void processMixedEvent(FilteredFDCollisions const& cols, FemtoFullParticles const& parts) { - doMixedEvent(cols, parts, partsOne, partsTwo); + if (cfgProcessHel) + doMixedEvent(cols, parts, partsOne, partsTwo, 0); + + if (cfgProcessHel1) + doMixedEvent(cols, parts, partsOne, partsTwo, 1); + + if (cfgProcessHel2) + doMixedEvent(cols, parts, partsOne, partsTwo, 2); + + if (cfgProcessHel3) + doMixedEvent(cols, parts, partsOne, partsTwo, 3); + + if (cfgProcessHel4) + doMixedEvent(cols, parts, partsOne, partsTwo, 4); } PROCESS_SWITCH(FemtoUniversePairTaskTrackV0Helicity, processMixedEvent, "Enable processing mixed event for track - V0", false); void processMixedEventMCReco(FilteredFDCollisions const& cols, FemtoRecoParticles const& parts, aod::FdMCParticles const& mcparts) { - doMixedEvent(cols, parts, partsOneMCReco, partsTwoMCReco, mcparts); + doMixedEvent(cols, parts, partsOneMCReco, partsTwoMCReco, 0, mcparts); } PROCESS_SWITCH(FemtoUniversePairTaskTrackV0Helicity, processMixedEventMCReco, "Enable processing mixed event for track - V0 for MC Reco", false); @@ -788,7 +973,7 @@ struct FemtoUniversePairTaskTrackV0Helicity { return; } for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { - if (static_cast(p1.pidCut()) != confTrkPDGCodePartOne) + if (static_cast(p1.pidCut()) != trackconfigs.confTrkPDGCodePartOne) continue; int pdgCode2 = static_cast(p2.pidCut()); if ((V0configs.confV0Type1 == 0 && pdgCode2 != V0configs.confPDGCodeV0) || (V0configs.confV0Type1 == 1 && pdgCode2 != -V0configs.confPDGCodeV0)) From 19742f52adb9e9c914b21e08268248ff85d2fa54 Mon Sep 17 00:00:00 2001 From: dajones2 <140733426+dajones2@users.noreply.github.com> Date: Thu, 16 Oct 2025 14:45:41 +0100 Subject: [PATCH 780/986] [PWGJE] Changed for better efficiency correction (#13399) --- PWGJE/Tasks/jetHadronRecoil.cxx | 207 +++++--------------------------- 1 file changed, 29 insertions(+), 178 deletions(-) diff --git a/PWGJE/Tasks/jetHadronRecoil.cxx b/PWGJE/Tasks/jetHadronRecoil.cxx index 7624859900b..c2c086cbdce 100644 --- a/PWGJE/Tasks/jetHadronRecoil.cxx +++ b/PWGJE/Tasks/jetHadronRecoil.cxx @@ -143,7 +143,7 @@ struct JetHadronRecoil { registry.add("hZvtxSelected", "Z vertex position;Z_{vtx};entries", {HistType::kTH1F, {{80, -20, 20}}}, doSumw); - if (doprocessData || doprocessDataWithRhoSubtraction || doprocessMCD || doprocessMCDWithRhoSubtraction || doprocessMCDWeighted || doprocessMCDWeightedWithRhoSubtraction || doprocessMCP || doprocessMCPWeighted || doprocessMCPWeightedWithMatchedTracks) { + if (doprocessData || doprocessDataWithRhoSubtraction || doprocessMCD || doprocessMCDWithRhoSubtraction || doprocessMCDWeighted || doprocessMCDWeightedWithRhoSubtraction || doprocessMCP || doprocessMCPWeighted) { registry.add("hNtrig", "number of triggers;trigger type;entries", {HistType::kTH1F, {{2, 0, 2}}}, doSumw); registry.add("hSignalTriggersPtHard", "Signal triggers vs PtHard", {HistType::kTH1F, {pThatAxis}}, doSumw); registry.add("hReferenceTriggersPtHard", "Reference triggers vs PtHard", {HistType::kTH1F, {pThatAxis}}, doSumw); @@ -186,7 +186,7 @@ struct JetHadronRecoil { registry.add("hPtTrackMatchedToCollisions", "Track p_{T};p_{T};entries", {HistType::kTH1F, {{200, 0, 200}}}, doSumw); } - if (doprocessMCP || doprocessMCPWeighted || doprocessMCPWeightedWithMatchedTracks) { + if (doprocessMCP || doprocessMCPWeighted) { registry.add("hPartvsJets", "comparing leading particles and jets;p_{T,part};p_{T,jet};#hat{p}", {HistType::kTH3F, {{200, 0, 200}, {500, -100, 400}, {195, 5, 200}}}, doSumw); registry.add("hPtPart", "Particle p_{T};p_{T};entries", {HistType::kTH1F, {{200, 0, 200}}}, doSumw); registry.add("hEtaPart", "Particle #eta;#eta;entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}, doSumw); @@ -204,6 +204,7 @@ struct JetHadronRecoil { if (doprocessJetsMCPMCDMatched || doprocessJetsMCPMCDMatchedWithRhoSubtraction || doprocessJetsMCPMCDMatchedWeighted || doprocessJetsMCPMCDMatchedWeightedWithRhoSubtraction || doprocessRecoilJetsMCPMCDMatched || doprocessRecoilJetsMCPMCDMatchedWeighted || doprocessRecoilJetsMCPMCDMatchedWeightedWithRhoSubtraction) { registry.add("hPtMatched", "p_{T} matching;p_{T,det};p_{T,part}", {HistType::kTH2F, {{500, -100, 400}, {400, 0, 400}}}, doSumw); registry.add("hPhiMatched", "#phi matching;#phi_{det};#phi_{part}", {HistType::kTH2F, {{100, 0.0, o2::constants::math::TwoPI}, {100, 0.0, o2::constants::math::TwoPI}}}, doSumw); + registry.add("hPhiMatched2d", "#phi matching 2d;#phi;p_{T}", {HistType::kTH2F, {{100, 0.0, o2::constants::math::TwoPI}, {400, 0, 400}}}, doSumw); registry.add("hDeltaRMatched", "#DeltaR matching;#DeltaR_{det};#DeltaR_{part}", {HistType::kTH2F, {dRAxisDet, dRAxisPart}}, doSumw); registry.add("hPtMatched1d", "p_{T} matching 1d;p_{T,part}", {HistType::kTH1F, {{400, 0, 400}}}, doSumw); registry.add("hDeltaRMatched1d", "#DeltaR matching 1d;#DeltaR_{part}", {HistType::kTH1F, {dRAxisPart}}, doSumw); @@ -350,8 +351,8 @@ struct JetHadronRecoil { registry.fill(HIST("hTracksvsJets"), leadingTrackPt, leadingJetPt, pTHat, weight); } - template - void fillHistogramsMCD(T const& jets, U const& tracks, P const&, float weight = 1.0, float rho = 0.0, float pTHat = 999.0) + template + void fillHistogramsMCD(T const& jets, U const& tracks, float weight = 1.0, float rho = 0.0, float pTHat = 999.0, auto collisionID = 0) { bool isSigCol; std::vector phiTTAr; @@ -404,8 +405,8 @@ struct JetHadronRecoil { registry.fill(HIST("hPtTrackPtHard"), track.pt() / pTHat, track.pt(), weight); if (track.has_mcParticle()) { registry.fill(HIST("hPtTrackMatched"), track.pt(), weight); - auto particle = track.template mcParticle_as

(); - if (track.collisionId() == particle.mcCollisionId()) { + auto mcParticle = track.mcParticle(); + if (mcParticle.mcCollisionId() == collisionID) { registry.fill(HIST("hPtTrackMatchedToCollisions"), track.pt(), weight); } } @@ -615,132 +616,6 @@ struct JetHadronRecoil { registry.fill(HIST("hPartvsJets"), leadingPartPt, leadingJetPt, pTHat, weight); } - template - void fillMCPHistogramsWithMatchedTracks(T const& jets, U const& particles, V const& tracks, float weight = 1.0, float pTHat = 999.0) - { - bool isSigCol; - std::vector phiTTAr; - std::vector ptTTAr; - double phiTT = 0; - double ptTT = 0; - int trigNumber = 0; - int nTT = 0; - double leadingPartPt = 0; - double leadingJetPt = 0; - float dice = rand->Rndm(); - if (dice < fracSig) - isSigCol = true; - else - isSigCol = false; - - for (const auto& track : tracks) { - if (!track.has_mcParticle()) { - continue; - } - auto particle = track.template mcParticle_as(); - if (particle.pt() > leadingPartPt) { - leadingPartPt = particle.pt(); - } - if (particle.pt() > pTHatTrackMaxMCD * pTHat) { - if (outlierRejectEvent) { - return; - } else { - continue; - } - } - auto pdgParticle = pdg->GetParticle(particle.pdgCode()); - if (!pdgParticle) { - continue; - } - if ((pdgParticle->Charge() == 0.0) || (!particle.isPhysicalPrimary())) { - continue; - } - if (isSigCol && particle.pt() < ptTTsigMax && particle.pt() > ptTTsigMin && track.pt() < ptTTsigMax && track.pt() > ptTTsigMin) { - phiTTAr.push_back(particle.phi()); - ptTTAr.push_back(particle.pt()); - nTT++; - registry.fill(HIST("hSignalTriggers"), particle.pt(), weight); - } - if (!isSigCol && particle.pt() < ptTTrefMax && particle.pt() > ptTTrefMin && track.pt() < ptTTrefMax && track.pt() > ptTTrefMin) { - phiTTAr.push_back(particle.phi()); - ptTTAr.push_back(particle.pt()); - nTT++; - registry.fill(HIST("hReferenceTriggers"), particle.pt(), weight); - } - registry.fill(HIST("hPtPart"), particle.pt(), weight); - registry.fill(HIST("hEtaPart"), particle.eta(), weight); - registry.fill(HIST("hPhiPart"), particle.phi(), weight); - registry.fill(HIST("hPart3D"), particle.pt(), particle.eta(), particle.phi(), weight); - registry.fill(HIST("hPtPartPtHard"), particle.pt(), particle.pt() / pTHat, weight); - } - - if (nTT > 0) { - trigNumber = rand->Integer(nTT); - phiTT = phiTTAr[trigNumber]; - ptTT = ptTTAr[trigNumber]; - if (isSigCol) { - registry.fill(HIST("hNtrig"), 1.5, weight); - registry.fill(HIST("hSigEventTriggers"), nTT, weight); - registry.fill(HIST("hSignalTriggersPtHard"), ptTT / pTHat, weight); - } - if (!isSigCol) { - registry.fill(HIST("hNtrig"), 0.5, weight); - registry.fill(HIST("hRefEventTriggers"), nTT, weight); - registry.fill(HIST("hReferenceTriggersPtHard"), ptTT / pTHat, weight); - } - } - - for (const auto& jet : jets) { - if (jet.pt() > leadingJetPt) { - leadingJetPt = jet.pt(); - } - if (jet.pt() > pTHatMaxMCP * pTHat) { - if (outlierRejectEvent) { - return; - } else { - continue; - } - } - for (const auto& constituent : jet.template tracks_as()) { - registry.fill(HIST("hConstituents3D"), constituent.pt(), constituent.eta(), constituent.phi()); - } - registry.fill(HIST("hJetPt"), jet.pt(), weight); - registry.fill(HIST("hJetEta"), jet.eta(), weight); - registry.fill(HIST("hJetPhi"), jet.phi(), weight); - registry.fill(HIST("hJet3D"), jet.pt(), jet.eta(), jet.phi(), weight); - - if (nTT > 0) { - float dphi = RecoDecay::constrainAngle(jet.phi() - phiTT); - double dR = getWTAaxisDifference(jet, particles); - if (isSigCol) { - if (std::abs(dphi - o2::constants::math::PI) < 0.6) { - registry.fill(HIST("hDeltaRpTSignalPart"), jet.pt(), dR, weight); - registry.fill(HIST("hDeltaRSignalPart"), dR, weight); - } - registry.fill(HIST("hDeltaRpTDPhiSignalPart"), jet.pt(), dphi, dR, weight); - registry.fill(HIST("hSignalPtDPhi"), dphi, jet.pt(), weight); - if (std::abs(dphi - o2::constants::math::PI) < 0.6) { - registry.fill(HIST("hSignalPt"), jet.pt(), weight); - registry.fill(HIST("hSignalPtHard"), jet.pt(), ptTT / pTHat, weight); - } - } - if (!isSigCol) { - if (std::abs(dphi - o2::constants::math::PI) < 0.6) { - registry.fill(HIST("hDeltaRpTPartReference"), jet.pt(), dR, weight); - registry.fill(HIST("hDeltaRPartReference"), dR, weight); - } - registry.fill(HIST("hDeltaRpTDPhiReferencePart"), jet.pt(), dphi, dR, weight); - registry.fill(HIST("hReferencePtDPhi"), dphi, jet.pt(), weight); - if (std::abs(dphi - o2::constants::math::PI) < 0.6) { - registry.fill(HIST("hReferencePt"), jet.pt(), weight); - registry.fill(HIST("hReferencePtHard"), jet.pt(), ptTT / pTHat, weight); - } - } - } - } - registry.fill(HIST("hPartvsJets"), leadingPartPt, leadingJetPt, pTHat, weight); - } - template void fillMatchedHistograms(T const& jetsBase, U const&, X const& tracks, Y const& particles, float weight = 1.0, float rho = 0.0, float pTHat = 999.0) { @@ -808,20 +683,18 @@ struct JetHadronRecoil { continue; } } - if (track.pt() < ptTTsigMax && track.pt() > ptTTsigMin) { - auto particle = track.template mcParticle_as(); - auto pdgParticle = pdg->GetParticle(particle.pdgCode()); - if (!pdgParticle) { - continue; - } - if ((pdgParticle->Charge() == 0.0) || (!particle.isPhysicalPrimary())) { - continue; - } - if (particle.pt() < ptTTsigMax && particle.pt() > ptTTsigMin) { - nTT++; - phiTTAr.push_back(track.phi()); - phiTTArPart.push_back(particle.phi()); - } + auto particle = track.template mcParticle_as(); + auto pdgParticle = pdg->GetParticle(particle.pdgCode()); + if (!pdgParticle) { + continue; + } + if ((pdgParticle->Charge() == 0.0) || (!particle.isPhysicalPrimary())) { + continue; + } + if (particle.pt() < ptTTsigMax && particle.pt() > ptTTsigMin) { + nTT++; + phiTTAr.push_back(track.phi()); + phiTTArPart.push_back(particle.phi()); } } @@ -861,9 +734,10 @@ struct JetHadronRecoil { float dphip = RecoDecay::constrainAngle(jetTag.phi() - phiTTPart); dRp = getWTAaxisDifference(jetTag, particles); registry.fill(HIST("hPhiMatched"), dphi, dphip, weight); + registry.fill(HIST("hPhiMatched2d"), jetTag.phi(), jetTag.pt(), weight); registry.fill(HIST("hPhiResolution"), jetTag.pt(), dphip - dphi, weight); registry.fill(HIST("hFullMatching"), jetBase.pt() - (rho * jetBase.area()), jetTag.pt(), dphi, dphip, dR, dRp, weight); - if ((std::abs(dphi - o2::constants::math::PI) < 0.6) || (std::abs(dphip - o2::constants::math::PI) < 0.6)) { + if ((std::abs(dphip - o2::constants::math::PI) < 0.6)) { registry.fill(HIST("hPtMatched1d"), jetTag.pt(), weight); registry.fill(HIST("hDeltaRMatched1d"), dRp, weight); registry.fill(HIST("hPtMatched"), jetBase.pt() - (rho * jetBase.area()), jetTag.pt(), weight); @@ -909,8 +783,7 @@ struct JetHadronRecoil { void processMCD(soa::Filtered>::iterator const& collision, aod::JMcCollisions const&, soa::Filtered> const& jets, - soa::Filtered const& tracks, - soa::Filtered const& particles) + soa::Filtered> const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { return; @@ -928,15 +801,14 @@ struct JetHadronRecoil { return; } registry.fill(HIST("hZvtxSelected"), collision.posZ()); - fillHistogramsMCD(jets, tracks, particles, 1.0, 0.0, collision.mcCollision().ptHard()); + fillHistogramsMCD(jets, tracks, 1.0, 0.0, collision.mcCollision().ptHard(), collision.mcCollisionId()); } PROCESS_SWITCH(JetHadronRecoil, processMCD, "process MC detector level", false); void processMCDWithRhoSubtraction(soa::Filtered>::iterator const& collision, aod::JMcCollisions const&, soa::Filtered> const& jets, - soa::Filtered const& tracks, - soa::Filtered const& particles) + soa::Filtered> const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { return; @@ -954,15 +826,14 @@ struct JetHadronRecoil { return; } registry.fill(HIST("hZvtxSelected"), collision.posZ()); - fillHistogramsMCD(jets, tracks, particles, 1.0, collision.rho(), collision.mcCollision().ptHard()); + fillHistogramsMCD(jets, tracks, 1.0, collision.rho(), collision.mcCollision().ptHard(), collision.mcCollisionId()); } PROCESS_SWITCH(JetHadronRecoil, processMCDWithRhoSubtraction, "process MC detector level with rho subtraction", false); void processMCDWeighted(soa::Filtered>::iterator const& collision, aod::JMcCollisions const&, soa::Filtered> const& jets, - soa::Filtered const& tracks, - soa::Filtered const& particles) + soa::Filtered> const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { return; @@ -980,15 +851,14 @@ struct JetHadronRecoil { return; } registry.fill(HIST("hZvtxSelected"), collision.posZ(), collision.mcCollision().weight()); - fillHistogramsMCD(jets, tracks, particles, collision.mcCollision().weight(), 0.0, collision.mcCollision().ptHard()); + fillHistogramsMCD(jets, tracks, collision.mcCollision().weight(), 0.0, collision.mcCollision().ptHard(), collision.mcCollisionId()); } PROCESS_SWITCH(JetHadronRecoil, processMCDWeighted, "process MC detector level with event weights", false); void processMCDWeightedWithRhoSubtraction(soa::Filtered>::iterator const& collision, aod::JMcCollisions const&, soa::Filtered> const& jets, - soa::Filtered const& tracks, - soa::Filtered const& particles) + soa::Filtered> const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { return; @@ -1006,7 +876,7 @@ struct JetHadronRecoil { return; } registry.fill(HIST("hZvtxSelected"), collision.posZ(), collision.mcCollision().weight()); - fillHistogramsMCD(jets, tracks, particles, collision.mcCollision().weight(), collision.rho(), collision.mcCollision().ptHard()); + fillHistogramsMCD(jets, tracks, collision.mcCollision().weight(), collision.rho(), collision.mcCollision().ptHard(), collision.mcCollisionId()); } PROCESS_SWITCH(JetHadronRecoil, processMCDWeightedWithRhoSubtraction, "process MC detector level with event weights and rho subtraction", false); @@ -1046,25 +916,6 @@ struct JetHadronRecoil { } PROCESS_SWITCH(JetHadronRecoil, processMCPWeighted, "process MC particle level with event weights", false); - void processMCPWeightedWithMatchedTracks(aod::JetMcCollision const& collision, - soa::Filtered> const& jets, - soa::Filtered const& particles, - soa::Filtered const& tracks) - { - if (std::abs(collision.posZ()) > vertexZCut) { - return; - } - if (skipMBGapEvents && collision.subGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) { - return; - } - if (collision.ptHard() < pTHatMinEvent) { - return; - } - registry.fill(HIST("hZvtxSelected"), collision.posZ(), collision.weight()); - fillMCPHistogramsWithMatchedTracks(jets, particles, tracks, collision.weight(), collision.ptHard()); - } - PROCESS_SWITCH(JetHadronRecoil, processMCPWeightedWithMatchedTracks, "process MC particle level with event weights - only triggers matched with detector level tracks", false); - void processJetsMCPMCDMatched(soa::Filtered>::iterator const& collision, soa::Filtered> const& mcdjets, aod::JetTracks const& tracks, From 2e56617f90b9ba8fdefaf0ed5d4ab37f21d49e10 Mon Sep 17 00:00:00 2001 From: blacwovie Date: Thu, 16 Oct 2025 23:23:16 +0800 Subject: [PATCH 781/986] [PWGCF] enable track ID output (#13414) Co-authored-by: blacw Co-authored-by: ALICE Action Bot --- .../FemtoNuclei/DataModel/PionNucleiTables.h | 32 ++----------------- .../TableProducer/PiNucleiFemto.cxx | 31 ++---------------- 2 files changed, 5 insertions(+), 58 deletions(-) diff --git a/PWGCF/Femto/FemtoNuclei/DataModel/PionNucleiTables.h b/PWGCF/Femto/FemtoNuclei/DataModel/PionNucleiTables.h index c1e128190fd..7c0d3efc7a6 100644 --- a/PWGCF/Femto/FemtoNuclei/DataModel/PionNucleiTables.h +++ b/PWGCF/Femto/FemtoNuclei/DataModel/PionNucleiTables.h @@ -57,6 +57,7 @@ DECLARE_SOA_COLUMN(MassTOFPi, massTOFPi, float); DECLARE_SOA_COLUMN(PidTrkNu, pidTrkNu, uint32_t); DECLARE_SOA_COLUMN(PidTrkPi, pidTrkPi, uint32_t); DECLARE_SOA_COLUMN(TrackIDPi, trackIDPi, int); +DECLARE_SOA_COLUMN(TrackIDNu, trackIDNu, int); DECLARE_SOA_COLUMN(ItsClusterSizeNu, itsClusterSizeNu, uint32_t); DECLARE_SOA_COLUMN(ItsClusterSizePi, itsClusterSizePi, uint32_t); @@ -76,35 +77,8 @@ DECLARE_SOA_COLUMN(MultiplicityFT0C, multiplicityFT0C, float); } // namespace pion_nuclei_tables DECLARE_SOA_TABLE(PionNucleiTable, "AOD", "PINUCLEITABLE", - pion_nuclei_tables::PtNu, - pion_nuclei_tables::EtaNu, - pion_nuclei_tables::PhiNu, - pion_nuclei_tables::PtPi, - pion_nuclei_tables::EtaPi, - pion_nuclei_tables::PhiPi, - pion_nuclei_tables::DcaxyNu, - pion_nuclei_tables::DcazNu, - pion_nuclei_tables::DcaxyPi, - pion_nuclei_tables::DcazPi, - pion_nuclei_tables::SignalTPCNu, - pion_nuclei_tables::InnerParamTPCNu, - pion_nuclei_tables::SignalTPCPi, - pion_nuclei_tables::InnerParamTPCPi, - pion_nuclei_tables::NClsTPCNu, - pion_nuclei_tables::NSigmaTPCNu, - pion_nuclei_tables::NSigmaTPCPi, - pion_nuclei_tables::Chi2TPCNu, - pion_nuclei_tables::Chi2TPCPi, - pion_nuclei_tables::MassTOFNu, - pion_nuclei_tables::MassTOFPi, - pion_nuclei_tables::PidTrkNu, - pion_nuclei_tables::PidTrkPi, - pion_nuclei_tables::ItsClusterSizeNu, - pion_nuclei_tables::ItsClusterSizePi, - pion_nuclei_tables::SharedClustersNu, - pion_nuclei_tables::SharedClustersPi, - pion_nuclei_tables::IsBkgUS, - pion_nuclei_tables::IsBkgEM) + pion_nuclei_tables::TrackIDPi, + pion_nuclei_tables::TrackIDNu) DECLARE_SOA_TABLE(PionHyperTable, "AOD", "PIHYPERTABLE", pion_nuclei_tables::PtHyp, pion_nuclei_tables::EtaHyp, diff --git a/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx b/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx index da4af042a64..c4edea3721e 100644 --- a/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx +++ b/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx @@ -947,35 +947,8 @@ struct PiNucleiFemto { void fillTable(const PiNucandidate& piNucand, const Tcoll& collision) { mOutputDataTable( - piNucand.recoPtNu(), - piNucand.recoEtaNu(), - piNucand.recoPhiNu(), - piNucand.recoPtPi(), - piNucand.recoEtaPi(), - piNucand.recoPhiPi(), - piNucand.dcaxyNu, - piNucand.dcazNu, - piNucand.dcaxyPi, - piNucand.dcazPi, - piNucand.tpcSignalNu, - piNucand.momNuTPC, - piNucand.tpcSignalPi, - piNucand.momPiTPC, - piNucand.nTPCClustersNu, - piNucand.nSigmaNu, - piNucand.nSigmaPi, - piNucand.chi2TPCNu, - piNucand.chi2TPCPi, - piNucand.massTOFNu, - piNucand.massTOFPi, - piNucand.pidTrkNu, - piNucand.pidTrkPi, - piNucand.itsClSizeNu, - piNucand.itsClSizePi, - piNucand.sharedClustersNu, - piNucand.sharedClustersPi, - piNucand.isBkgUS, - piNucand.isBkgEM); + piNucand.trackIDPi, + piNucand.trackIDNu); if (settingFillMultiplicity) { mOutputMultiplicityTable( collision.globalIndex(), From 7b8296ab409e94393028e869b242761935f54680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Thu, 16 Oct 2025 20:42:47 +0200 Subject: [PATCH 782/986] [ALICE3] Update LUT configurations to default empty values for nuclei (#13400) --- ALICE3/TableProducer/OTF/onTheFlyTracker.cxx | 260 ++++++++++--------- 1 file changed, 132 insertions(+), 128 deletions(-) diff --git a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx index e77655680c4..838aa081132 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx @@ -33,20 +33,21 @@ #include "Common/Core/RecoDecay.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "CommonConstants/MathConstants.h" -#include "DCAFitter/DCAFitterN.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsVertexing/PVertexer.h" -#include "DetectorsVertexing/PVertexerHelpers.h" -#include "Field/MagneticField.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/DCA.h" -#include "SimulationDataFormat/InteractionSampler.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -65,24 +66,24 @@ using namespace o2::framework; using std::array; struct OnTheFlyTracker { - Produces collisions; - Produces collLabels; - Produces tracksPar; - Produces tracksParExtension; - Produces tracksParCov; - Produces tracksParCovExtension; - Produces tracksLabels; - Produces tracksDCA; - Produces tracksDCACov; - Produces collisionsAlice3; - Produces TracksAlice3; - Produces TracksExtraA3; - Produces upgradeCascades; + Produces tableCollisions; + Produces tableMcCollisionLabels; + Produces tableStoredTracks; + Produces tableTracksExtension; + Produces tableStoredTracksCov; + Produces tableTracksCovExtension; + Produces tableMcTrackLabels; + Produces tableTracksDCA; + Produces tableTracksDCACov; + Produces tableCollisionsAlice3; + Produces tableTracksAlice3; + Produces tableTracksExtraA3; + Produces tableUpgradeCascades; // optionally produced, empty (to be tuned later) - Produces tracksExtra; // base table, extend later - Produces trackSelection; - Produces trackSelectionExtension; + Produces tableStoredTracksExtra; // base table, extend later + Produces tableTrackSelection; + Produces tableTrackSelectionExtension; Configurable seed{"seed", 0, "TGenPhaseSpace seed"}; Configurable magneticField{"magneticField", 20.0f, "magnetic field in kG"}; @@ -105,15 +106,15 @@ struct OnTheFlyTracker { Configurable doExtraQA{"doExtraQA", false, "do extra 2D QA plots"}; Configurable extraQAwithoutDecayDaughters{"extraQAwithoutDecayDaughters", false, "remove decay daughters from qa plots (yes/no)"}; - Configurable lutEl{"lutEl", "lutCovm.el.dat", "LUT for electrons"}; - Configurable lutMu{"lutMu", "lutCovm.mu.dat", "LUT for muons"}; - Configurable lutPi{"lutPi", "lutCovm.pi.dat", "LUT for pions"}; - Configurable lutKa{"lutKa", "lutCovm.ka.dat", "LUT for kaons"}; - Configurable lutPr{"lutPr", "lutCovm.pr.dat", "LUT for protons"}; - Configurable lutDe{"lutDe", "lutCovm.de.dat", "LUT for deuterons"}; - Configurable lutTr{"lutTr", "lutCovm.tr.dat", "LUT for tritons"}; - Configurable lutHe3{"lutHe3", "lutCovm.he3.dat", "LUT for Helium-3"}; - Configurable lutAl{"lutAl", "lutCovm.he3.dat", "LUT for Alphas"}; + Configurable lutEl{"lutEl", "lutCovm.el.dat", "LUT for electrons (if emtpy no LUT is taken)"}; + Configurable lutMu{"lutMu", "lutCovm.mu.dat", "LUT for muons (if emtpy no LUT is taken)"}; + Configurable lutPi{"lutPi", "lutCovm.pi.dat", "LUT for pions (if emtpy no LUT is taken)"}; + Configurable lutKa{"lutKa", "lutCovm.ka.dat", "LUT for kaons (if emtpy no LUT is taken)"}; + Configurable lutPr{"lutPr", "lutCovm.pr.dat", "LUT for protons (if emtpy no LUT is taken)"}; + Configurable lutDe{"lutDe", "", "LUT for deuterons (if emtpy no LUT is taken)"}; + Configurable lutTr{"lutTr", "", "LUT for tritons (if emtpy no LUT is taken)"}; + Configurable lutHe3{"lutHe3", "", "LUT for Helium-3 (if emtpy no LUT is taken)"}; + Configurable lutAl{"lutAl", "", "LUT for Alphas (if emtpy no LUT is taken)"}; struct : ConfigurableGroup { ConfigurableAxis axisMomentum{"axisMomentum", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "#it{p} (GeV/#it{c})"}; @@ -275,12 +276,10 @@ struct OnTheFlyTracker { loadLUT(kPiPlus, lutPi.value); loadLUT(kKPlus, lutKa.value); loadLUT(kProton, lutPr.value); - if (enableNucleiSmearing) { - loadLUT(o2::constants::physics::kDeuteron, lutDe.value); - loadLUT(o2::constants::physics::kTriton, lutTr.value); - loadLUT(o2::constants::physics::kHelium3, lutHe3.value); - loadLUT(o2::constants::physics::kAlpha, lutAl.value); - } + loadLUT(o2::constants::physics::kDeuteron, lutDe.value); + loadLUT(o2::constants::physics::kTriton, lutTr.value); + loadLUT(o2::constants::physics::kHelium3, lutHe3.value); + loadLUT(o2::constants::physics::kAlpha, lutAl.value); // interpolate efficiencies if requested to do so mSmearer.interpolateEfficiency(static_cast(interpolateLutEfficiencyVsNch)); @@ -481,13 +480,13 @@ struct OnTheFlyTracker { double pi_mass = o2::constants::physics::MassPionCharged; double pr_mass = o2::constants::physics::MassProton; - double xi_gamma = 1 / sqrt(1 + (particle.p() * particle.p()) / (xi_mass * xi_mass)); + double xi_gamma = 1 / std::sqrt(1 + (particle.p() * particle.p()) / (xi_mass * xi_mass)); double xi_ctau = 4.91 * xi_gamma; double xi_rxyz = (-xi_ctau * log(1 - u)); float sna, csa; o2::math_utils::CircleXYf_t xi_circle; track.getCircleParams(magneticField, xi_circle, sna, csa); - double xi_rxy = xi_rxyz / sqrt(1. + track.getTgl() * track.getTgl()); + double xi_rxy = xi_rxyz / std::sqrt(1. + track.getTgl() * track.getTgl()); double theta = xi_rxy / xi_circle.rC; double newX = ((particle.vx() - xi_circle.xC) * std::cos(theta) - (particle.vy() - xi_circle.yC) * std::sin(theta)) + xi_circle.xC; double newY = ((particle.vy() - xi_circle.yC) * std::cos(theta) + (particle.vx() - xi_circle.xC) * std::sin(theta)) + xi_circle.yC; @@ -505,7 +504,7 @@ struct OnTheFlyTracker { decayDaughters.push_back(*xiDecay.GetDecay(1)); TLorentzVector la = *xiDecay.GetDecay(0); - double la_gamma = 1 / sqrt(1 + (la.P() * la.P()) / (la_mass * la_mass)); + double la_gamma = 1 / std::sqrt(1 + (la.P() * la.P()) / (la_mass * la_mass)); double la_ctau = 7.89 * la_gamma; std::vector laDaughters = {pi_mass, pr_mass}; double la_rxyz = (-la_ctau * log(1 - u)); @@ -523,7 +522,7 @@ struct OnTheFlyTracker { float dNdEta = 0.f; // Charged particle multiplicity to use in the efficiency evaluation void process(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles) { - int lastTrackIndex = tracksParCov.lastIndex() + 1; // bookkeep the last added track + int lastTrackIndex = tableStoredTracksCov.lastIndex() + 1; // bookkeep the last added track tracksAlice3.clear(); ghostTracksAlice3.clear(); @@ -615,13 +614,13 @@ struct OnTheFlyTracker { } histos.fill(HIST("hPtGenerated"), mcParticle.pt()); - if (TMath::Abs(mcParticle.pdgCode()) == 11) + if (std::abs(mcParticle.pdgCode()) == kElectron) histos.fill(HIST("hPtGeneratedEl"), mcParticle.pt()); - if (TMath::Abs(mcParticle.pdgCode()) == 211) + if (std::abs(mcParticle.pdgCode()) == kPiPlus) histos.fill(HIST("hPtGeneratedPi"), mcParticle.pt()); - if (TMath::Abs(mcParticle.pdgCode()) == 321) + if (std::abs(mcParticle.pdgCode()) == kKPlus) histos.fill(HIST("hPtGeneratedKa"), mcParticle.pt()); - if (TMath::Abs(mcParticle.pdgCode()) == 2212) + if (std::abs(mcParticle.pdgCode()) == kProton) histos.fill(HIST("hPtGeneratedPr"), mcParticle.pt()); if (cascadeDecaySettings.doXiQA && mcParticle.pdgCode() == kXiMinus) { @@ -639,18 +638,18 @@ struct OnTheFlyTracker { o2::upgrade::convertMCParticleToO2Track(mcParticle, trackParCov, pdgDB); bool isDecayDaughter = false; - if (mcParticle.getProcess() == 4) + if (mcParticle.getProcess() == TMCProcess::kPDecay) isDecayDaughter = true; multiplicityCounter++; const float t = (eventCollisionTime + gRandom->Gaus(0., 100.)) * 1e-3; - const int nCascProngs = 3; + static constexpr int kCascProngs = 3; std::vector xiDaughterTrackParCovsPerfect(3); std::vector xiDaughterTrackParCovsTracked(3); - std::vector isReco(nCascProngs); - std::vector nHits(nCascProngs); // total - std::vector nSiliconHits(nCascProngs); // silicon type - std::vector nTPCHits(nCascProngs); // TPC type + std::vector isReco(kCascProngs); + std::vector nHits(kCascProngs); // total + std::vector nSiliconHits(kCascProngs); // silicon type + std::vector nTPCHits(kCascProngs); // TPC type if (cascadeDecaySettings.decayXi && mcParticle.pdgCode() == kXiMinus) { if (cascadeDecaySettings.doXiQA) { histos.fill(HIST("hXiBuilding"), 0.0f); @@ -660,7 +659,7 @@ struct OnTheFlyTracker { o2::upgrade::convertTLorentzVectorToO2Track(kPiMinus, decayProducts[1], laDecayVertex, xiDaughterTrackParCovsPerfect[1], pdgDB); o2::upgrade::convertTLorentzVectorToO2Track(kProton, decayProducts[2], laDecayVertex, xiDaughterTrackParCovsPerfect[2], pdgDB); - for (int i = 0; i < nCascProngs; i++) { + for (int i = 0; i < kCascProngs; i++) { isReco[i] = false; nHits[i] = 0; nSiliconHits[i] = 0; @@ -764,7 +763,10 @@ struct OnTheFlyTracker { // DCA to PV taken care of in daughter tracks already, not necessary thisCascade.dcaV0dau = TMath::Sqrt(fitter.getChi2AtPCACandidate()); thisCascade.v0radius = std::hypot(pos[0], pos[1]); - thisCascade.mLambda = RecoDecay::m(array{array{posP[0], posP[1], posP[2]}, array{negP[0], negP[1], negP[2]}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged}); + thisCascade.mLambda = RecoDecay::m(std::array{std::array{posP[0], posP[1], posP[2]}, + std::array{negP[0], negP[1], negP[2]}}, + std::array{o2::constants::physics::MassProton, + o2::constants::physics::MassPionCharged}); // go for cascade: create V0 (pseudo)track from reconstructed V0 std::array covV = {0.}; @@ -809,7 +811,10 @@ struct OnTheFlyTracker { thisCascade.cascradius = std::hypot(posCascade[0], posCascade[1]); bachelorTrackAtPCA.getPxPyPzGlo(bachP); - thisCascade.mXi = RecoDecay::m(array{array{bachP[0], bachP[1], bachP[2]}, array{posP[0] + negP[0], posP[1] + negP[1], posP[2] + negP[2]}}, array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassLambda}); + thisCascade.mXi = RecoDecay::m(std::array{std::array{bachP[0], bachP[1], bachP[2]}, + std::array{posP[0] + negP[0], posP[1] + negP[1], posP[2] + negP[2]}}, + std::array{o2::constants::physics::MassPionCharged, + o2::constants::physics::MassLambda}); // initialize cascade track o2::track::TrackParCov cascadeTrack = fitter.createParentTrackParCov(); @@ -934,13 +939,13 @@ struct OnTheFlyTracker { // Base QA (note: reco pT here) histos.fill(HIST("hPtReconstructed"), trackParCov.getPt()); - if (TMath::Abs(mcParticle.pdgCode()) == 11) + if (std::abs(mcParticle.pdgCode()) == kElectron) histos.fill(HIST("hPtReconstructedEl"), mcParticle.pt()); - if (TMath::Abs(mcParticle.pdgCode()) == 211) + if (std::abs(mcParticle.pdgCode()) == kPiPlus) histos.fill(HIST("hPtReconstructedPi"), mcParticle.pt()); - if (TMath::Abs(mcParticle.pdgCode()) == 321) + if (std::abs(mcParticle.pdgCode()) == kKPlus) histos.fill(HIST("hPtReconstructedKa"), mcParticle.pt()); - if (TMath::Abs(mcParticle.pdgCode()) == 2212) + if (std::abs(mcParticle.pdgCode()) == kProton) histos.fill(HIST("hPtReconstructedPr"), mcParticle.pt()); if (doExtraQA) { @@ -1015,14 +1020,14 @@ struct OnTheFlyTracker { // *+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+* // populate collisions - collisions(-1, // BC is irrelevant in synthetic MC tests for now, could be adjusted in future - primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ(), - primaryVertex.getSigmaX2(), primaryVertex.getSigmaXY(), primaryVertex.getSigmaY2(), - primaryVertex.getSigmaXZ(), primaryVertex.getSigmaYZ(), primaryVertex.getSigmaZ2(), - 0, primaryVertex.getChi2(), primaryVertex.getNContributors(), - eventCollisionTime, 0.f); // For the moment the event collision time is taken as the "GEANT" time, the computation of the event time is done a posteriori from the tracks in the OTF TOF PID task - collLabels(mcCollision.globalIndex(), 0); - collisionsAlice3(dNdEta); + tableCollisions(-1, // BC is irrelevant in synthetic MC tests for now, could be adjusted in future + primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ(), + primaryVertex.getSigmaX2(), primaryVertex.getSigmaXY(), primaryVertex.getSigmaY2(), + primaryVertex.getSigmaXZ(), primaryVertex.getSigmaYZ(), primaryVertex.getSigmaZ2(), + 0, primaryVertex.getChi2(), primaryVertex.getNContributors(), + eventCollisionTime, 0.f); // For the moment the event collision time is taken as the "GEANT" time, the computation of the event time is done a posteriori from the tracks in the OTF TOF PID task + tableMcCollisionLabels(mcCollision.globalIndex(), 0); + tableCollisionsAlice3(dNdEta); // *+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+* // *+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+* @@ -1061,36 +1066,36 @@ struct OnTheFlyTracker { histos.fill(HIST("h2dDCAzCascadePositive"), trackParametrization.getPt(), dcaZ * 1e+4); // in microns, please } } - tracksDCA(dcaXY, dcaZ); + tableTracksDCA(dcaXY, dcaZ); if (populateTracksDCACov) { - tracksDCACov(dcaInfo.getSigmaY2(), dcaInfo.getSigmaZ2()); + tableTracksDCACov(dcaInfo.getSigmaY2(), dcaInfo.getSigmaZ2()); } } - tracksPar(collisions.lastIndex(), trackType, trackParCov.getX(), trackParCov.getAlpha(), trackParCov.getY(), trackParCov.getZ(), trackParCov.getSnp(), trackParCov.getTgl(), trackParCov.getQ2Pt()); - tracksParExtension(trackParCov.getPt(), trackParCov.getP(), trackParCov.getEta(), trackParCov.getPhi()); + tableStoredTracks(tableCollisions.lastIndex(), trackType, trackParCov.getX(), trackParCov.getAlpha(), trackParCov.getY(), trackParCov.getZ(), trackParCov.getSnp(), trackParCov.getTgl(), trackParCov.getQ2Pt()); + tableTracksExtension(trackParCov.getPt(), trackParCov.getP(), trackParCov.getEta(), trackParCov.getPhi()); // TODO do we keep the rho as 0? Also the sigma's are duplicated information - tracksParCov(std::sqrt(trackParCov.getSigmaY2()), std::sqrt(trackParCov.getSigmaZ2()), std::sqrt(trackParCov.getSigmaSnp2()), - std::sqrt(trackParCov.getSigmaTgl2()), std::sqrt(trackParCov.getSigma1Pt2()), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - tracksParCovExtension(trackParCov.getSigmaY2(), trackParCov.getSigmaZY(), trackParCov.getSigmaZ2(), trackParCov.getSigmaSnpY(), - trackParCov.getSigmaSnpZ(), trackParCov.getSigmaSnp2(), trackParCov.getSigmaTglY(), trackParCov.getSigmaTglZ(), trackParCov.getSigmaTglSnp(), - trackParCov.getSigmaTgl2(), trackParCov.getSigma1PtY(), trackParCov.getSigma1PtZ(), trackParCov.getSigma1PtSnp(), trackParCov.getSigma1PtTgl(), - trackParCov.getSigma1Pt2()); - tracksLabels(trackParCov.mcLabel, 0); - TracksExtraA3(trackParCov.nSiliconHits, trackParCov.nTPCHits); + tableStoredTracksCov(std::sqrt(trackParCov.getSigmaY2()), std::sqrt(trackParCov.getSigmaZ2()), std::sqrt(trackParCov.getSigmaSnp2()), + std::sqrt(trackParCov.getSigmaTgl2()), std::sqrt(trackParCov.getSigma1Pt2()), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + tableTracksCovExtension(trackParCov.getSigmaY2(), trackParCov.getSigmaZY(), trackParCov.getSigmaZ2(), trackParCov.getSigmaSnpY(), + trackParCov.getSigmaSnpZ(), trackParCov.getSigmaSnp2(), trackParCov.getSigmaTglY(), trackParCov.getSigmaTglZ(), trackParCov.getSigmaTglSnp(), + trackParCov.getSigmaTgl2(), trackParCov.getSigma1PtY(), trackParCov.getSigma1PtZ(), trackParCov.getSigma1PtSnp(), trackParCov.getSigma1PtTgl(), + trackParCov.getSigma1Pt2()); + tableMcTrackLabels(trackParCov.mcLabel, 0); + tableTracksExtraA3(trackParCov.nSiliconHits, trackParCov.nTPCHits); // populate extra tables if required to do so if (populateTracksExtra) { - tracksExtra(0.0f, static_cast(0), static_cast(0), static_cast(0), static_cast(0), - static_cast(0), static_cast(0), static_cast(0), static_cast(0), - 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + tableStoredTracksExtra(0.0f, static_cast(0), static_cast(0), static_cast(0), static_cast(0), + static_cast(0), static_cast(0), static_cast(0), static_cast(0), + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); } if (populateTrackSelection) { - trackSelection(static_cast(0), false, false, false, false, false, false); - trackSelectionExtension(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false); + tableTrackSelection(static_cast(0), false, false, false, false, false, false); + tableTrackSelectionExtension(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false); } - TracksAlice3(true); + tableTracksAlice3(true); } // populate ghost tracks for (const auto& trackParCov : ghostTracksAlice3) { @@ -1109,55 +1114,54 @@ struct OnTheFlyTracker { histos.fill(HIST("h2dDCAz"), trackParametrization.getPt(), dcaZ * 1e+4); // in microns, please histos.fill(HIST("hTrackXatDCA"), trackParametrization.getX()); } - tracksDCA(dcaXY, dcaZ); + tableTracksDCA(dcaXY, dcaZ); if (populateTracksDCACov) { - tracksDCACov(dcaInfo.getSigmaY2(), dcaInfo.getSigmaZ2()); + tableTracksDCACov(dcaInfo.getSigmaY2(), dcaInfo.getSigmaZ2()); } } - tracksPar(collisions.lastIndex(), trackType, trackParCov.getX(), trackParCov.getAlpha(), trackParCov.getY(), trackParCov.getZ(), trackParCov.getSnp(), trackParCov.getTgl(), trackParCov.getQ2Pt()); - tracksParExtension(trackParCov.getPt(), trackParCov.getP(), trackParCov.getEta(), trackParCov.getPhi()); + tableStoredTracks(tableCollisions.lastIndex(), trackType, trackParCov.getX(), trackParCov.getAlpha(), trackParCov.getY(), trackParCov.getZ(), trackParCov.getSnp(), trackParCov.getTgl(), trackParCov.getQ2Pt()); + tableTracksExtension(trackParCov.getPt(), trackParCov.getP(), trackParCov.getEta(), trackParCov.getPhi()); // TODO do we keep the rho as 0? Also the sigma's are duplicated information - tracksParCov(std::sqrt(trackParCov.getSigmaY2()), std::sqrt(trackParCov.getSigmaZ2()), std::sqrt(trackParCov.getSigmaSnp2()), - std::sqrt(trackParCov.getSigmaTgl2()), std::sqrt(trackParCov.getSigma1Pt2()), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - tracksParCovExtension(trackParCov.getSigmaY2(), trackParCov.getSigmaZY(), trackParCov.getSigmaZ2(), trackParCov.getSigmaSnpY(), - trackParCov.getSigmaSnpZ(), trackParCov.getSigmaSnp2(), trackParCov.getSigmaTglY(), trackParCov.getSigmaTglZ(), trackParCov.getSigmaTglSnp(), - trackParCov.getSigmaTgl2(), trackParCov.getSigma1PtY(), trackParCov.getSigma1PtZ(), trackParCov.getSigma1PtSnp(), trackParCov.getSigma1PtTgl(), - trackParCov.getSigma1Pt2()); - tracksLabels(trackParCov.mcLabel, 0); - TracksExtraA3(trackParCov.nSiliconHits, trackParCov.nTPCHits); + tableStoredTracksCov(std::sqrt(trackParCov.getSigmaY2()), std::sqrt(trackParCov.getSigmaZ2()), std::sqrt(trackParCov.getSigmaSnp2()), + std::sqrt(trackParCov.getSigmaTgl2()), std::sqrt(trackParCov.getSigma1Pt2()), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + tableTracksCovExtension(trackParCov.getSigmaY2(), trackParCov.getSigmaZY(), trackParCov.getSigmaZ2(), trackParCov.getSigmaSnpY(), + trackParCov.getSigmaSnpZ(), trackParCov.getSigmaSnp2(), trackParCov.getSigmaTglY(), trackParCov.getSigmaTglZ(), trackParCov.getSigmaTglSnp(), + trackParCov.getSigmaTgl2(), trackParCov.getSigma1PtY(), trackParCov.getSigma1PtZ(), trackParCov.getSigma1PtSnp(), trackParCov.getSigma1PtTgl(), + trackParCov.getSigma1Pt2()); + tableMcTrackLabels(trackParCov.mcLabel, 0); + tableTracksExtraA3(trackParCov.nSiliconHits, trackParCov.nTPCHits); // populate extra tables if required to do so if (populateTracksExtra) { - tracksExtra(0.0f, static_cast(0), static_cast(0), static_cast(0), static_cast(0), - static_cast(0), static_cast(0), static_cast(0), static_cast(0), - 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + tableStoredTracksExtra(0.0f, static_cast(0), static_cast(0), static_cast(0), static_cast(0), + static_cast(0), static_cast(0), static_cast(0), static_cast(0), + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); } if (populateTrackSelection) { - trackSelection(static_cast(0), false, false, false, false, false, false); - trackSelectionExtension(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false); + tableTrackSelection(static_cast(0), false, false, false, false, false, false); + tableTrackSelectionExtension(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false); } - TracksAlice3(false); + tableTracksAlice3(false); } for (const auto& cascade : cascadesAlice3) { - upgradeCascades( - collisions.lastIndex(), // now we know the collision index -> populate table - cascade.cascadeTrackId, - cascade.positiveId, - cascade.negativeId, - cascade.bachelorId, - cascade.dcaV0dau, - cascade.dcacascdau, - cascade.v0radius, - cascade.cascradius, - cascade.cascradiusMC, - cascade.mLambda, - cascade.mXi, - cascade.findableClusters, - cascade.foundClusters); + tableUpgradeCascades(tableCollisions.lastIndex(), // now we know the collision index -> populate table + cascade.cascadeTrackId, + cascade.positiveId, + cascade.negativeId, + cascade.bachelorId, + cascade.dcaV0dau, + cascade.dcacascdau, + cascade.v0radius, + cascade.cascradius, + cascade.cascradiusMC, + cascade.mLambda, + cascade.mXi, + cascade.findableClusters, + cascade.foundClusters); } // do bookkeeping of fastTracker tracking @@ -1168,7 +1172,7 @@ struct OnTheFlyTracker { /// Extends TracksExtra if necessary struct onTheFlyTrackerInitializer { - Spawns tracksExtra; + Spawns tableStoredTracksExtra; void init(InitContext const&) {} }; From a5ba6251a36cf893f18a23b20c85ba293abd3d14 Mon Sep 17 00:00:00 2001 From: GijsvWeelden <55794847+GijsvWeelden@users.noreply.github.com> Date: Thu, 16 Oct 2025 23:07:25 +0200 Subject: [PATCH 783/986] [PWGJE] V0 QA (#13405) --- PWGJE/Tasks/v0QA.cxx | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/PWGJE/Tasks/v0QA.cxx b/PWGJE/Tasks/v0QA.cxx index 193227d24d4..fe4cb4f57eb 100644 --- a/PWGJE/Tasks/v0QA.cxx +++ b/PWGJE/Tasks/v0QA.cxx @@ -69,6 +69,7 @@ struct V0QA { Configurable evSel{"evSel", "sel8WithoutTimeFrameBorderCut", "choose event selection"}; Configurable yPartMax{"yPartMax", 0.5, "Maximum rapidity of particles"}; + Configurable etaV0Max{"etaV0Max", 0.75, "Maximum pseudorapidity of V0s"}; Configurable vertexZCut{"vertexZCut", 10.0, "Vertex Z cut"}; Configurable v0Fraction{"v0Fraction", 1.0, "Fraction of V0s to be kept inside jets"}; @@ -265,6 +266,7 @@ struct V0QA { registry.add("tests/weighted/AntiLambdaPtEtaPhi", "AntiLambda Pt Eta Phi", HistType::kTH3D, {axisV0Pt, axisEta, axisPhi}); registry.add("tests/weighted/JetPtEtaPhi", "Jet Pt, Eta, Phi", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); + registry.add("tests/weighted/inclJetPtEtaPhi", "Jet Pt, Eta, Phi, inclusive jets", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); registry.add("tests/weighted/JetPtEtaV0Pt", "Jet Pt, Eta, V0 Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); registry.add("tests/weighted/JetPtEtaV0Z", "Jet Pt, Eta, V0 Z", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); registry.add("tests/weighted/JetPtEtaK0SPt", "Jet Pt, Eta, K0S Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); @@ -286,6 +288,7 @@ struct V0QA { registry.add("tests/sub/AntiLambdaPtEtaPhi", "AntiLambda Pt, Eta, Phi", HistType::kTH3D, {axisV0Pt, axisEta, axisPhi}); registry.add("tests/nosub/JetPtEtaPhi", "Jet Pt, Eta, Phi", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); + registry.add("tests/nosub/inclJetPtEtaPhi", "Jet Pt, Eta, Phi, inclusive jets", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); registry.add("tests/nosub/JetPtEtaV0Pt", "Jet Pt, Eta, V0 Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); registry.add("tests/nosub/JetPtEtaV0Z", "Jet Pt, Eta, V0 Z", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); registry.add("tests/nosub/JetPtEtaK0SPt", "Jet Pt, Eta, K0S Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); @@ -296,6 +299,7 @@ struct V0QA { registry.add("tests/nosub/JetPtEtaAntiLambdaZ", "Jet Pt, Eta, AntiLambda Z", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); registry.add("tests/sub/JetPtEtaPhi", "Jet Pt, Eta, Phi", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); + registry.add("tests/sub/JetPtEtaPhiAllV0sSubtracted", "Jet Pt, Eta, Phi (All V0s Subtracted)", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); registry.add("tests/sub/JetPtEtaV0Pt", "Jet Pt, Eta, V0 Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); registry.add("tests/sub/JetPtEtaV0Z", "Jet Pt, Eta, V0 Z", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); registry.add("tests/sub/JetPtEtaK0SPt", "Jet Pt, Eta, K0S Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); @@ -331,10 +335,10 @@ struct V0QA { registry.add("sharing/JetPtEtaPhiShared", "JetPtEtaPhiShared", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); registry.add("sharing/JetPtEtaPhiNoShared", "JetPtEtaPhiNoShared", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); - registry.add("sharing/JetPtEtaV0Pt", "JetPtEtaV0Pt", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); - registry.add("sharing/JetPtEtaK0SPt", "JetPtEtaK0SPt", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); - registry.add("sharing/JetPtEtaLambdaPt", "JetPtEtaLambdaPt", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); - registry.add("sharing/JetPtEtaAntiLambdaPt", "JetPtEtaAntiLambdaPt", HistType::kTH3D, {axisJetPt, axisEta, axisPhi}); + registry.add("sharing/JetPtEtaV0Pt", "JetPtEtaV0Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); + registry.add("sharing/JetPtEtaK0SPt", "JetPtEtaK0SPt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); + registry.add("sharing/JetPtEtaLambdaPt", "JetPtEtaLambdaPt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); + registry.add("sharing/JetPtEtaAntiLambdaPt", "JetPtEtaAntiLambdaPt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); registry.add("sharing/JetPtEtaV0PtPt", "JetPtEtaV0PtPt", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisV0Pt}); registry.add("sharing/JetPtEtaV0PtPtDaughterPt", "JetPtEtaV0PtPtDaughterPt", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisV0Pt, axisV0Pt}); registry.add("sharing/JetK0SK0S", "JetK0SK0S", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisV0Pt}); @@ -741,7 +745,9 @@ struct V0QA { template void fillWeightedJetFinderJet(T const& jet) { - registry.fill(HIST("tests/weighted/JetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi()); + registry.fill(HIST("tests/weighted/inclJetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi()); + if (jet.candidatesIds().size() > 0) + registry.fill(HIST("tests/weighted/JetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi()); } template @@ -794,7 +800,9 @@ struct V0QA { template void fillSubtractedJetFinderJetNoSubtraction(T const& jet) { - registry.fill(HIST("tests/nosub/JetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi()); + registry.fill(HIST("tests/nosub/inclJetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi()); + if (jet.candidatesIds().size() > 0) + registry.fill(HIST("tests/nosub/JetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi()); } template @@ -818,9 +826,11 @@ struct V0QA { } template - void fillSubtractedJetFinderJetSubtracted(T const& jet, double ptjetsub) + void fillSubtractedJetFinderJetSubtracted(T const& jet, double ptjetsub, bool allV0sSubtracted) { registry.fill(HIST("tests/sub/JetPtEtaPhi"), ptjetsub, jet.eta(), jet.phi()); + if (allV0sSubtracted) + registry.fill(HIST("tests/sub/JetPtEtaPhiAllV0sSubtracted"), ptjetsub, jet.eta(), jet.phi()); } void fillSubtractedJetFinderV0InJetSubtracted(const double ptjetsub, const double etajet, const double v0Pt, const int v0Type) @@ -1739,7 +1749,8 @@ struct V0QA { } } // V0s in jet loop - fillSubtractedJetFinderJetSubtracted(jet, ptjetsub); + bool allV0sSubtracted = (v0Pt.size() == 0); + fillSubtractedJetFinderJetSubtracted(jet, ptjetsub, allV0sSubtracted); for (unsigned int i = 0; i < v0Pt.size(); ++i) { fillSubtractedJetFinderV0InJetSubtracted(ptjetsub, jet.eta(), v0Pt[i], v0Type[i]); } // Accepted V0s in jet loop @@ -1759,12 +1770,18 @@ struct V0QA { if (trigger.isRejectedCandidate()) continue; + if (abs(trigger.eta()) > etaV0Max) + continue; + fillV0DaughterSharingInclusive(trigger); for (const auto& associate : v0s) { if (associate.isRejectedCandidate()) continue; + if (abs(associate.eta()) > etaV0Max) + continue; + if (trigger == associate) continue; From a3001cea8504af8d8d6bac694335f6e7b9f6bd8e Mon Sep 17 00:00:00 2001 From: choich08365 <157435123+choich08365@users.noreply.github.com> Date: Fri, 17 Oct 2025 08:32:40 +0900 Subject: [PATCH 784/986] [PWGJE] Updated GNN b-jet analysis histograms, applied proper event selections (#13418) Co-authored-by: Changhwan Choi --- PWGJE/TableProducer/jetTaggerHF.cxx | 6 +- PWGJE/Tasks/bjetTaggingGnn.cxx | 230 +++++++++++++++++++++------- 2 files changed, 179 insertions(+), 57 deletions(-) diff --git a/PWGJE/TableProducer/jetTaggerHF.cxx b/PWGJE/TableProducer/jetTaggerHF.cxx index 70d88de3e45..44899e4c702 100644 --- a/PWGJE/TableProducer/jetTaggerHF.cxx +++ b/PWGJE/TableProducer/jetTaggerHF.cxx @@ -280,10 +280,10 @@ struct JetTaggerHFTask { if (jet.pt() >= jetpTMin) { if (scoreML[jet.globalIndex()] < dbMin) { dbRange = 0.5; // underflow - } else if (scoreML[jet.globalIndex()] >= dbMax) { - dbRange = 2.5; // overflow - } else { + } else if (scoreML[jet.globalIndex()] < dbMax) { dbRange = 1.5; // in range + } else { + dbRange = 2.5; // overflow } registry.fill(HIST("h2_count_db"), 3.5, dbRange); // incl jet if constexpr (isMC) { diff --git a/PWGJE/Tasks/bjetTaggingGnn.cxx b/PWGJE/Tasks/bjetTaggingGnn.cxx index a71c0d7f75b..9d2c82b47c9 100644 --- a/PWGJE/Tasks/bjetTaggingGnn.cxx +++ b/PWGJE/Tasks/bjetTaggingGnn.cxx @@ -45,6 +45,7 @@ struct BjetTaggingGnn { // event level configurables Configurable vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"}; Configurable eventSelections{"eventSelections", "sel8", "choose event selection"}; + Configurable eventSelectionsSel{"eventSelectionsSel", "sel8", "choose event selection"}; Configurable useEventWeight{"useEventWeight", true, "Flag whether to scale histograms with the event weight"}; Configurable pTHatMaxMCD{"pTHatMaxMCD", 999.0, "maximum fraction of hard scattering for jet acceptance in detector MC"}; @@ -92,7 +93,7 @@ struct BjetTaggingGnn { jetRadiiValues = (std::vector)jetRadii; eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(static_cast(eventSelections)); - eventSelectionBitsSel = jetderiveddatautilities::initialiseEventSelectionBits("sel8"); + eventSelectionBitsSel = jetderiveddatautilities::initialiseEventSelectionBits(static_cast(eventSelectionsSel)); registry.add("h_vertexZ", "Vertex Z;#it{Z} (cm)", {HistType::kTH1F, {{100, -20.0, 20.0}}}, callSumw2); // registry.add("h_vertexZ_truth", "Vertex Z truth;#it{Z} (cm)", {HistType::kTH1F, {{100, -20.0, 20.0}}}, callSumw2); @@ -160,6 +161,11 @@ struct BjetTaggingGnn { registry.add("h_Db_npp_b", "NotPhysPrim b-jet", {HistType::kTH1F, {axisDbFine}}); registry.add("h_Db_npp_c", "NotPhysPrim c-jet", {HistType::kTH1F, {axisDbFine}}); registry.add("h_Db_npp_lf", "NotPhysPrim lf-jet", {HistType::kTH1F, {axisDbFine}}); + registry.add("h_jetpT_matched", "", {HistType::kTH1F, {axisJetpT}}, callSumw2); + registry.add("h_jetpT_particle_matched", "", {HistType::kTH1F, {axisJetpT}}, callSumw2); + registry.add("h_jetpT_b_matched", "b-jet", {HistType::kTH1F, {axisJetpT}}, callSumw2); + registry.add("h_jetpT_particle_b_matched", "b-jet", {HistType::kTH1F, {axisJetpT}}, callSumw2); + registry.add("hSparse_overflow_b", "", {HistType::kTHnSparseF, {axisJetpT, axisJetpT, axisNTracks}}); } if (doprocessMCJetsSel) { @@ -182,14 +188,32 @@ struct BjetTaggingGnn { registry.add("h_jetpT_particle_b_tvx", "particle b-jet", {HistType::kTH1F, {axisJetpT}}, callSumw2); } + if (doprocessMCTruthJetsOld) { + registry.add("h_jetpT_particle_old", "", {HistType::kTH1F, {axisJetpT}}, callSumw2); + registry.add("h_jetpT_particle_b_old", "particle b-jet", {HistType::kTH1F, {axisJetpT}}, callSumw2); + registry.add("h_jetpT_particle_c_old", "particle c-jet", {HistType::kTH1F, {axisJetpT}}, callSumw2); + registry.add("h_jetpT_particle_lf_old", "particle lf-jet", {HistType::kTH1F, {axisJetpT}}, callSumw2); + } + + if (doprocessMCCollision) { + registry.add("h_jetpT_particle2", "", {HistType::kTH1F, {axisJetpT}}, callSumw2); + registry.add("h_jetpT_particle_b2", "particle b-jet", {HistType::kTH1F, {axisJetpT}}, callSumw2); + registry.add("h_jetpT_particle_c2", "particle c-jet", {HistType::kTH1F, {axisJetpT}}, callSumw2); + registry.add("h_jetpT_particle_lf2", "particle lf-jet", {HistType::kTH1F, {axisJetpT}}, callSumw2); + registry.add("h_jetpT_particle_sel2", "", {HistType::kTH1F, {axisJetpT}}, callSumw2); + registry.add("h_jetpT_particle_b_sel2", "particle b-jet", {HistType::kTH1F, {axisJetpT}}, callSumw2); + registry.add("h_jetpT_particle_tvx2", "", {HistType::kTH1F, {axisJetpT}}, callSumw2); + registry.add("h_jetpT_particle_b_tvx2", "particle b-jet", {HistType::kTH1F, {axisJetpT}}, callSumw2); + } + if (doDataDriven) { - registry.add("hSparse_Incljets", "", {HistType::kTHnSparseF, {axisJetpT, axisDbFine, axisSVMass, axisJetMass, axisNTracks}}, callSumw2); + registry.add("hSparse_Incljets", "", {HistType::kTHnSparseF, {axisJetpT, axisDbFine, axisNTracks}}, callSumw2); if (doprocessMCJets) { - registry.add("hSparse_bjets", "", {HistType::kTHnSparseF, {axisJetpT, axisDbFine, axisSVMass, axisJetMass, axisNTracks}}, callSumw2); - registry.add("hSparse_cjets", "", {HistType::kTHnSparseF, {axisJetpT, axisDbFine, axisSVMass, axisJetMass, axisNTracks}}, callSumw2); - registry.add("hSparse_lfjets", "", {HistType::kTHnSparseF, {axisJetpT, axisDbFine, axisSVMass, axisJetMass, axisNTracks}}, callSumw2); - registry.add("hSparse_lfjets_none", "", {HistType::kTHnSparseF, {axisJetpT, axisDbFine, axisSVMass, axisJetMass, axisNTracks}}, callSumw2); - registry.add("hSparse_lfjets_matched", "", {HistType::kTHnSparseF, {axisJetpT, axisDbFine, axisSVMass, axisJetMass, axisNTracks}}, callSumw2); + registry.add("hSparse_bjets", "", {HistType::kTHnSparseF, {axisJetpT, axisDbFine, axisNTracks}}, callSumw2); + registry.add("hSparse_cjets", "", {HistType::kTHnSparseF, {axisJetpT, axisDbFine, axisNTracks}}, callSumw2); + registry.add("hSparse_lfjets", "", {HistType::kTHnSparseF, {axisJetpT, axisDbFine, axisNTracks}}, callSumw2); + registry.add("hSparse_lfjets_none", "", {HistType::kTHnSparseF, {axisJetpT, axisDbFine, axisNTracks}}, callSumw2); + registry.add("hSparse_lfjets_matched", "", {HistType::kTHnSparseF, {axisJetpT, axisDbFine, axisNTracks}}, callSumw2); } } } @@ -210,7 +234,11 @@ struct BjetTaggingGnn { using AnalysisCollisionsMCD = soa::Join; using FilteredCollisionsMCD = soa::Filtered; + + Filter mccollisionFilter = nabs(aod::jmccollision::posZ) < vertexZCut; + using FilteredCollisionMCP = soa::Filtered; using MCPJets = soa::Join; + using FilteredMCPJets = soa::Filtered; using SVTable = aod::DataSecondaryVertex3Prongs; using MCDSVTable = aod::MCDSecondaryVertex3Prongs; @@ -232,40 +260,40 @@ struct BjetTaggingGnn { return nTracks; } - template - SecondaryVertices::iterator analyzeJetSVInfo(AnalysisJet const& analysisJet, SecondaryVertices const& allSVs, bool& checkSV /*, int8_t jetFlavor = 0, double weight = 1.0*/) - { - using SVType = typename SecondaryVertices::iterator; + // template + // SecondaryVertices::iterator analyzeJetSVInfo(AnalysisJet const& analysisJet, SecondaryVertices const& allSVs, bool& checkSV /*, int8_t jetFlavor = 0, double weight = 1.0*/) + // { + // using SVType = typename SecondaryVertices::iterator; - auto compare = [](SVType& sv1, SVType& sv2) { - return (sv1.decayLengthXY() / sv1.errorDecayLengthXY()) > (sv2.decayLengthXY() / sv2.errorDecayLengthXY()); - }; + // auto compare = [](SVType& sv1, SVType& sv2) { + // return (sv1.decayLengthXY() / sv1.errorDecayLengthXY()) > (sv2.decayLengthXY() / sv2.errorDecayLengthXY()); + // }; - auto svs = analysisJet.template secondaryVertices_as(); + // auto svs = analysisJet.template secondaryVertices_as(); - std::sort(svs.begin(), svs.end(), compare); + // std::sort(svs.begin(), svs.end(), compare); - checkSV = false; - for (const auto& candSV : svs) { + // checkSV = false; + // for (const auto& candSV : svs) { - if (candSV.pt() < svPtMin) { - continue; - } + // if (candSV.pt() < svPtMin) { + // continue; + // } - checkSV = true; - return candSV; - } + // checkSV = true; + // return candSV; + // } - // No SV found - return *allSVs.begin(); - } + // // No SV found + // return *allSVs.begin(); + // } void processDummy(FilteredCollisions::iterator const& /*collision*/) { } PROCESS_SWITCH(BjetTaggingGnn, processDummy, "Dummy process function turned on by default", true); - void processDataJets(FilteredCollisions::iterator const& collision, FilteredDataJets const& alljets, JetTrackswID const& allTracks, SVTable const& allSVs) + void processDataJets(FilteredCollisions::iterator const& collision, FilteredDataJets const& alljets, JetTrackswID const& allTracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { return; @@ -290,21 +318,21 @@ struct BjetTaggingGnn { int nTracks = analyzeJetTrackInfo(collision, analysisJet, allTracks); - float mSV = -1.f; + // float mSV = -1.f; - bool checkSV; - auto sv = analyzeJetSVInfo(analysisJet, allSVs, checkSV); + // bool checkSV; + // auto sv = analyzeJetSVInfo(analysisJet, allSVs, checkSV); - if (checkSV) { - mSV = sv.m(); - } + // if (checkSV) { + // mSV = sv.m(); + // } registry.fill(HIST("h_jetpT"), analysisJet.pt()); registry.fill(HIST("h_Db"), analysisJet.scoreML()); registry.fill(HIST("h2_jetpT_Db"), analysisJet.pt(), analysisJet.scoreML()); if (doDataDriven) { - registry.fill(HIST("hSparse_Incljets"), analysisJet.pt(), analysisJet.scoreML(), mSV, analysisJet.mass(), nTracks); + registry.fill(HIST("hSparse_Incljets"), analysisJet.pt(), analysisJet.scoreML(), nTracks); } } } @@ -355,7 +383,7 @@ struct BjetTaggingGnn { } PROCESS_SWITCH(BjetTaggingGnn, processDataJetsSel, "jet information in Data (sel8)", false); - void processMCJets(FilteredCollisionsMCD::iterator const& collision, FilteredMCDJets const& MCDjets, MCPJets const& /*MCPjets*/, JetTracksMCDwID const& /*allTracks*/, MCDSVTable const& allSVs, aod::JetParticles const& /*MCParticles*/) + void processMCJets(FilteredCollisionsMCD::iterator const& collision, FilteredMCDJets const& MCDjets, JetTracksMCDwID const& /*allTracks*/, FilteredMCPJets const& /*MCPjets*/, aod::JetParticles const& /*MCParticles*/) { float weightEvt = useEventWeight ? collision.weight() : 1.f; if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { @@ -406,14 +434,14 @@ struct BjetTaggingGnn { ++nTracks; } - float mSV = -1.f; + // float mSV = -1.f; - bool checkSV; - auto sv = analyzeJetSVInfo(analysisJet, allSVs, checkSV /*, jetFlavor, weight*/); + // bool checkSV; + // auto sv = analyzeJetSVInfo(analysisJet, allSVs, checkSV /*, jetFlavor, weight*/); - if (checkSV) { - mSV = sv.m(); - } + // if (checkSV) { + // mSV = sv.m(); + // } registry.fill(HIST("h_jetpT"), analysisJet.pt(), weight); registry.fill(HIST("h_Db"), analysisJet.scoreML(), weight); @@ -454,29 +482,33 @@ struct BjetTaggingGnn { } if (doDataDriven) { - registry.fill(HIST("hSparse_Incljets"), analysisJet.pt(), analysisJet.scoreML(), mSV, analysisJet.mass(), nTracks, weight); + registry.fill(HIST("hSparse_Incljets"), analysisJet.pt(), analysisJet.scoreML(), nTracks, weight); if (jetFlavor == JetTaggingSpecies::beauty) { - registry.fill(HIST("hSparse_bjets"), analysisJet.pt(), analysisJet.scoreML(), mSV, analysisJet.mass(), nTracks, weight); + registry.fill(HIST("hSparse_bjets"), analysisJet.pt(), analysisJet.scoreML(), nTracks, weight); } else if (jetFlavor == JetTaggingSpecies::charm) { - registry.fill(HIST("hSparse_cjets"), analysisJet.pt(), analysisJet.scoreML(), mSV, analysisJet.mass(), nTracks, weight); + registry.fill(HIST("hSparse_cjets"), analysisJet.pt(), analysisJet.scoreML(), nTracks, weight); } else { - registry.fill(HIST("hSparse_lfjets"), analysisJet.pt(), analysisJet.scoreML(), mSV, analysisJet.mass(), nTracks, weight); + registry.fill(HIST("hSparse_lfjets"), analysisJet.pt(), analysisJet.scoreML(), nTracks, weight); if (jetFlavor == JetTaggingSpecies::none) { - registry.fill(HIST("hSparse_lfjets_none"), analysisJet.pt(), analysisJet.scoreML(), mSV, analysisJet.mass(), nTracks, weight); + registry.fill(HIST("hSparse_lfjets_none"), analysisJet.pt(), analysisJet.scoreML(), nTracks, weight); } else { - registry.fill(HIST("hSparse_lfjets_matched"), analysisJet.pt(), analysisJet.scoreML(), mSV, analysisJet.mass(), nTracks, weight); + registry.fill(HIST("hSparse_lfjets_matched"), analysisJet.pt(), analysisJet.scoreML(), nTracks, weight); } } } - for (const auto& mcpjet : analysisJet.template matchedJetGeo_as()) { + for (const auto& mcpjet : analysisJet.template matchedJetGeo_as()) { if (mcpjet.pt() > pTHatMaxMCP * pTHat) { continue; } registry.fill(HIST("h2_Response_DetjetpT_PartjetpT"), analysisJet.pt(), mcpjet.pt(), weight); + registry.fill(HIST("h_jetpT_matched"), analysisJet.pt(), weight); + registry.fill(HIST("h_jetpT_particle_matched"), mcpjet.pt(), weight); if (jetFlavor == JetTaggingSpecies::beauty) { registry.fill(HIST("h2_Response_DetjetpT_PartjetpT_b"), analysisJet.pt(), mcpjet.pt(), weight); + registry.fill(HIST("h_jetpT_b_matched"), analysisJet.pt(), weight); + registry.fill(HIST("h_jetpT_particle_b_matched"), mcpjet.pt(), weight); } else if (jetFlavor == JetTaggingSpecies::charm) { registry.fill(HIST("h2_Response_DetjetpT_PartjetpT_c"), analysisJet.pt(), mcpjet.pt(), weight); } else { @@ -487,7 +519,7 @@ struct BjetTaggingGnn { } PROCESS_SWITCH(BjetTaggingGnn, processMCJets, "jet information in MC", false); - void processMCJetsSel(AnalysisCollisionsMCD::iterator const& collision, FilteredMCDJets const& MCDjets, MCPJets const& /*MCPjets*/) + void processMCJetsSel(AnalysisCollisionsMCD::iterator const& collision, FilteredMCDJets const& MCDjets, FilteredMCPJets const& /*MCPjets*/) { float weightEvt = useEventWeight ? collision.weight() : 1.f; registry.fill(HIST("h_event_counter"), 0.5, weightEvt); @@ -520,7 +552,7 @@ struct BjetTaggingGnn { registry.fill(HIST("h_jetpT_b_tvx"), analysisJet.pt(), weight); } - for (const auto& mcpjet : analysisJet.template matchedJetGeo_as()) { + for (const auto& mcpjet : analysisJet.template matchedJetGeo_as()) { if (mcpjet.pt() > pTHatMaxMCP * pTHat) { continue; } @@ -565,7 +597,7 @@ struct BjetTaggingGnn { registry.fill(HIST("h_jetpT_b_sel"), analysisJet.pt(), weight); } - for (const auto& mcpjet : analysisJet.template matchedJetGeo_as()) { + for (const auto& mcpjet : analysisJet.template matchedJetGeo_as()) { if (mcpjet.pt() > pTHatMaxMCP * pTHat) { continue; } @@ -581,7 +613,7 @@ struct BjetTaggingGnn { PresliceUnsorted collisionsPerMCPCollision = aod::jmccollisionlb::mcCollisionId; - void processMCTruthJets(MCPJets::iterator const& mcpjet, aod::JetParticles const& /*MCParticles*/, aod::JetMcCollisions const& /*mcCollisions*/, AnalysisCollisionsMCD const& collisions) + void processMCTruthJets(FilteredMCPJets::iterator const& mcpjet, aod::JetParticles const& /*MCParticles*/, aod::JetMcCollisions const& /*mcCollisions*/, AnalysisCollisionsMCD const& collisions) { bool jetIncluded = false; for (const auto& jetR : jetRadiiValues) { @@ -635,7 +667,9 @@ struct BjetTaggingGnn { } PROCESS_SWITCH(BjetTaggingGnn, processMCTruthJets, "truth jet information", false); - void processMCCollision(aod::McCollisions::iterator const& mcCollision, AnalysisCollisionsMCD const& collisions) + Preslice mcpjetsPerMCPCollision = aod::jmccollisionlb::mcCollisionId; + + void processMCCollision(aod::McCollisions::iterator const& mcCollision, FilteredMCPJets const& mcpjets, AnalysisCollisionsMCD const& collisions, aod::JetParticles const& /*MCParticles*/) { float weightEvt = useEventWeight ? mcCollision.weight() : 1.f; registry.fill(HIST("h_event_counter"), 3.5, weightEvt); // McColl(INEL) @@ -648,9 +682,97 @@ struct BjetTaggingGnn { registry.fill(HIST("h_event_counter"), 5.5, weightEvt); // McColl(-> Coll+TVX+Sel8+...) } } + auto mcpjetspermcpcollision = mcpjets.sliceBy(mcpjetsPerMCPCollision, mcCollision.globalIndex()); + for (const auto& mcpjet : mcpjetspermcpcollision) { + bool jetIncluded = false; + for (const auto& jetR : jetRadiiValues) { + if (mcpjet.r() == static_cast(jetR * 100)) { + jetIncluded = true; + break; + } + } + + if (!jetIncluded) { + continue; + } + + float weight = useEventWeight ? mcpjet.eventWeight() : 1.0; + float pTHat = 10. / (std::pow(mcpjet.eventWeight(), 1.0 / pTHatExponent)); + if (mcpjet.pt() > pTHatMaxMCP * pTHat) { + continue; + } + + int8_t jetFlavor = mcpjet.origin(); + + registry.fill(HIST("h_jetpT_particle_tvx2"), mcpjet.pt(), weight); + + if (jetFlavor == JetTaggingSpecies::beauty) { + registry.fill(HIST("h_jetpT_particle_b_tvx2"), mcpjet.pt(), weight); + } + + if (collisionspermccollision.size() >= 1) { + if (jetderiveddatautilities::selectCollision(collisionspermccollision.begin(), eventSelectionBitsSel)) { + registry.fill(HIST("h_jetpT_particle_sel2"), mcpjet.pt(), weight); + + if (jetFlavor == JetTaggingSpecies::beauty) { + registry.fill(HIST("h_jetpT_particle_b_sel2"), mcpjet.pt(), weight); + } + } + + if (jetderiveddatautilities::selectCollision(collisionspermccollision.begin(), eventSelectionBits) && std::fabs(collisionspermccollision.begin().posZ()) < vertexZCut) { + registry.fill(HIST("h_jetpT_particle2"), mcpjet.pt(), weight); + + if (jetFlavor == JetTaggingSpecies::beauty) { + registry.fill(HIST("h_jetpT_particle_b2"), mcpjet.pt(), weight); + } else if (jetFlavor == JetTaggingSpecies::charm) { + registry.fill(HIST("h_jetpT_particle_c2"), mcpjet.pt(), weight); + } else { + registry.fill(HIST("h_jetpT_particle_lf2"), mcpjet.pt(), weight); + } + } + } + } } PROCESS_SWITCH(BjetTaggingGnn, processMCCollision, "mc collision information", false); + void processMCTruthJetsOld(FilteredCollisionMCP::iterator const& /*collision*/, FilteredMCPJets const& MCPjets, aod::JetParticles const& /*MCParticles*/) + { + + for (const auto& mcpjet : MCPjets) { + + bool jetIncluded = false; + for (const auto& jetR : jetRadiiValues) { + if (mcpjet.r() == static_cast(jetR * 100)) { + jetIncluded = true; + break; + } + } + + if (!jetIncluded) { + continue; + } + + float weight = useEventWeight ? mcpjet.eventWeight() : 1.0; + float pTHat = 10. / (std::pow(mcpjet.eventWeight(), 1.0 / pTHatExponent)); + if (mcpjet.pt() > pTHatMaxMCP * pTHat) { + continue; + } + + int8_t jetFlavor = mcpjet.origin(); + + registry.fill(HIST("h_jetpT_particle_old"), mcpjet.pt(), weight); + + if (jetFlavor == JetTaggingSpecies::beauty) { + registry.fill(HIST("h_jetpT_particle_b_old"), mcpjet.pt(), weight); + } else if (jetFlavor == JetTaggingSpecies::charm) { + registry.fill(HIST("h_jetpT_particle_c_old"), mcpjet.pt(), weight); + } else { + registry.fill(HIST("h_jetpT_particle_lf_old"), mcpjet.pt(), weight); + } + } + } + PROCESS_SWITCH(BjetTaggingGnn, processMCTruthJetsOld, "truth jet information", false); + PresliceUnsorted> perFoundBC = aod::evsel::foundBCId; void processBCs(soa::Join const& bcs, soa::Join const& collisions) From bc5950bf7ed54f6cb9585bd546ef8b9e3480117c Mon Sep 17 00:00:00 2001 From: Ida Storehaug <38440296+torkjellsdatter@users.noreply.github.com> Date: Fri, 17 Oct 2025 04:27:37 +0200 Subject: [PATCH 785/986] [PWGDQ] MC Acceptance check added to DileptonTrack + minor fixes (#13419) Co-authored-by: Ida Torkjellsdatter Storehaug Co-authored-by: Ida Torkjellsdatter Storehaug Co-authored-by: ALICE Action Bot --- PWGDQ/Core/HistogramsLibrary.cxx | 1 + PWGDQ/Core/VarManager.cxx | 3 + PWGDQ/Core/VarManager.h | 2 + PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 84 +++++++++++++------------- PWGDQ/Tasks/tableReader_withAssoc.cxx | 37 ++---------- 5 files changed, 53 insertions(+), 74 deletions(-) diff --git a/PWGDQ/Core/HistogramsLibrary.cxx b/PWGDQ/Core/HistogramsLibrary.cxx index e2c73f7e9ac..c103d576840 100644 --- a/PWGDQ/Core/HistogramsLibrary.cxx +++ b/PWGDQ/Core/HistogramsLibrary.cxx @@ -1808,6 +1808,7 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "Pt_Track", "", false, 120, 0.0, 30.0, VarManager::kPt); hm->AddHistogram(histClass, "Mass", "", false, 750, 0.0, 30.0, VarManager::kPairMass); hm->AddHistogram(histClass, "Pt", "", false, 750, 0.0, 30.0, VarManager::kPairPt); + hm->AddHistogram(histClass, "Rap", "", false, 100, -10.0, 10.0, VarManager::kPairRap); hm->AddHistogram(histClass, "Mass_Pt", "", false, 100, 0.0, 20.0, VarManager::kPairMass, 40, 0.0, 20.0, VarManager::kPairPt); hm->AddHistogram(histClass, "Pt_Dilepton__Pt", "", false, 40, 0.0, 20.0, VarManager::kPairPtDau, 40, 0.0, 20.0, VarManager::kPairPt); hm->AddHistogram(histClass, "Pt_Track__Pt", "", false, 40, 0.0, 20.0, VarManager::kPt, 40, 0.0, 20.0, VarManager::kPairPt); diff --git a/PWGDQ/Core/VarManager.cxx b/PWGDQ/Core/VarManager.cxx index 7c87739b009..496a6ca18ae 100644 --- a/PWGDQ/Core/VarManager.cxx +++ b/PWGDQ/Core/VarManager.cxx @@ -1142,6 +1142,8 @@ void VarManager::SetDefaultVarNames() fgVariableUnits[kPairPt] = "GeV/c"; fgVariableNames[kPairEta] = "#eta"; fgVariableUnits[kPairEta] = ""; + fgVariableNames[kPairRap] = "#rap"; + fgVariableUnits[kPairRap] = ""; fgVariableNames[kPairPhi] = "#varphi"; fgVariableUnits[kPairPhi] = "rad."; fgVariableNames[kPairPhiv] = "#varphi_{V}"; @@ -1881,6 +1883,7 @@ void VarManager::SetDefaultVarNames() fgVarNamesMap["kPairPt"] = kPairPt; fgVarNamesMap["kPairPtDau"] = kPairPtDau; fgVarNamesMap["kPairEta"] = kPairEta; + fgVarNamesMap["kPairRap"] = kPairRap; fgVarNamesMap["kPairPhi"] = kPairPhi; fgVarNamesMap["kPairPhiv"] = kPairPhiv; fgVarNamesMap["kDileptonHadronKstar"] = kDileptonHadronKstar; diff --git a/PWGDQ/Core/VarManager.h b/PWGDQ/Core/VarManager.h index a4d9f540370..42531168bad 100644 --- a/PWGDQ/Core/VarManager.h +++ b/PWGDQ/Core/VarManager.h @@ -814,6 +814,7 @@ class VarManager : public TObject kPairPt, kPairPtDau, kPairEta, + kPairRap, kPairPhi, kPairPhiv, kDeltaEta, @@ -4336,6 +4337,7 @@ void VarManager::FillDileptonTrackVertexing(C const& collision, T1 const& lepton values[VarManager::kMassDau] = mtrack; values[VarManager::kDeltaMass] = v123.M() - v12.M(); values[VarManager::kPairPt] = v123.Pt(); + values[VarManager::kPairRap] = -v123.Rapidity(); values[VarManager::kPairEta] = v123.Eta(); if (fgUsedVars[kPairMassDau] || fgUsedVars[kPairPtDau]) { values[VarManager::kPairMassDau] = v12.M(); diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index 09908da4777..5fe815bb08b 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -84,6 +84,9 @@ DECLARE_SOA_COLUMN(massBcandidate, MBcandidate, float); DECLARE_SOA_COLUMN(MassDileptonCandidate, massDileptonCandidate, float); DECLARE_SOA_COLUMN(deltaMassBcandidate, deltaMBcandidate, float); DECLARE_SOA_COLUMN(pTBcandidate, PtBcandidate, float); +DECLARE_SOA_COLUMN(EtaBcandidate, etaBcandidate, float); +DECLARE_SOA_COLUMN(PhiBcandidate, phiBcandidate, float); +DECLARE_SOA_COLUMN(RapBcandidate, rapBcandidate, float); DECLARE_SOA_COLUMN(LxyBcandidate, lxyBcandidate, float); DECLARE_SOA_COLUMN(LxyzBcandidate, lxyzBcandidate, float); DECLARE_SOA_COLUMN(LzBcandidate, lzBcandidate, float); @@ -118,12 +121,6 @@ DECLARE_SOA_COLUMN(TPCnsigmaPrleg1, tpcnsigmaPrleg1, float); DECLARE_SOA_COLUMN(TPCnsigmaElleg2, tpcnsigmaElleg2, float); DECLARE_SOA_COLUMN(TPCnsigmaPileg2, tpcnsigmaPileg2, float); DECLARE_SOA_COLUMN(TPCnsigmaPrleg2, tpcnsigmaPrleg2, float); -DECLARE_SOA_COLUMN(DCAXYassoc, dcaXYassoc, float); -DECLARE_SOA_COLUMN(DCAZassoc, dcaZassoc, float); -DECLARE_SOA_COLUMN(DCAXYleg1, dcaXYleg1, float); -DECLARE_SOA_COLUMN(DCAZleg1, dcaZleg1, float); -DECLARE_SOA_COLUMN(DCAXYleg2, dcaXYleg2, float); -DECLARE_SOA_COLUMN(DCAZleg2, dcaZleg2, float); DECLARE_SOA_COLUMN(ITSClusterMapassoc, itsClusterMapassoc, uint8_t); DECLARE_SOA_COLUMN(ITSClusterMapleg1, itsClusterMapleg1, uint8_t); DECLARE_SOA_COLUMN(ITSClusterMapleg2, itsClusterMapleg2, uint8_t); @@ -173,7 +170,7 @@ DECLARE_SOA_TABLE(MuonAmbiguities, "AOD", "DQMUONAMB", dqanalysisflags::MuonAmbi DECLARE_SOA_TABLE(Prefilter, "AOD", "DQPREFILTER", dqanalysisflags::IsBarrelSelectedPrefilter); //! joinable to ReducedTracksAssoc DECLARE_SOA_TABLE(BmesonCandidates, "AOD", "DQBMESONS", dqanalysisflags::RunNumber, dqanalysisflags::EventIdx, dqanalysisflags::EventTimestamp, - dqanalysisflags::massBcandidate, dqanalysisflags::MassDileptonCandidate, dqanalysisflags::deltaMassBcandidate, dqanalysisflags::pTBcandidate, + dqanalysisflags::massBcandidate, dqanalysisflags::MassDileptonCandidate, dqanalysisflags::deltaMassBcandidate, dqanalysisflags::pTBcandidate, dqanalysisflags::EtaBcandidate, dqanalysisflags::PhiBcandidate, dqanalysisflags::RapBcandidate, dqanalysisflags::LxyBcandidate, dqanalysisflags::LxyzBcandidate, dqanalysisflags::LzBcandidate, dqanalysisflags::TauxyBcandidate, dqanalysisflags::TauzBcandidate, dqanalysisflags::CosPBcandidate, dqanalysisflags::Chi2Bcandidate, dqanalysisflags::GlobalIndexassoc, dqanalysisflags::GlobalIndexleg1, dqanalysisflags::GlobalIndexleg2, @@ -182,7 +179,6 @@ DECLARE_SOA_TABLE(BmesonCandidates, "AOD", "DQBMESONS", dqanalysisflags::TPCnsigmaKaassoc, dqanalysisflags::TPCnsigmaPiassoc, dqanalysisflags::TPCnsigmaPrassoc, dqanalysisflags::TOFnsigmaKaassoc, dqanalysisflags::TPCnsigmaElleg1, dqanalysisflags::TPCnsigmaPileg1, dqanalysisflags::TPCnsigmaPrleg1, dqanalysisflags::TPCnsigmaElleg2, dqanalysisflags::TPCnsigmaPileg2, dqanalysisflags::TPCnsigmaPrleg2, - dqanalysisflags::DCAXYassoc, dqanalysisflags::DCAZassoc, dqanalysisflags::DCAXYleg1, dqanalysisflags::DCAZleg1, dqanalysisflags::DCAXYleg2, dqanalysisflags::DCAZleg2, dqanalysisflags::ITSClusterMapassoc, dqanalysisflags::ITSClusterMapleg1, dqanalysisflags::ITSClusterMapleg2, dqanalysisflags::ITSChi2assoc, dqanalysisflags::ITSChi2leg1, dqanalysisflags::ITSChi2leg2, dqanalysisflags::TPCNclsassoc, dqanalysisflags::TPCNclsleg1, dqanalysisflags::TPCNclsleg2, @@ -3803,7 +3799,10 @@ struct AnalysisDileptonTrack { DefineHistograms(fHistMan, Form("MCTruthGen_%s", sig->GetName()), ""); DefineHistograms(fHistMan, Form("MCTruthGenSel_%s", sig->GetName()), ""); } - DefineHistograms(fHistMan, "MCTruthGenAccepted", ""); + for (auto& sig : fRecMCSignals) { + DefineHistograms(fHistMan, Form("MCTruthGenSelBR_%s", sig->GetName()), ""); + DefineHistograms(fHistMan, Form("MCTruthGenSelBRAccepted_%s", sig->GetName()), ""); + } } TString addHistsStr = fConfigAddJSONHistograms.value; @@ -3929,7 +3928,7 @@ struct AnalysisDileptonTrack { } // table to be written out for ML analysis BmesonsTable(event.runNumber(), event.globalIndex(), event.timestamp(), - fValuesHadron[VarManager::kPairMass], dilepton.mass(), fValuesHadron[VarManager::kDeltaMass], fValuesHadron[VarManager::kPairPt], + fValuesHadron[VarManager::kPairMass], dilepton.mass(), fValuesHadron[VarManager::kDeltaMass], fValuesHadron[VarManager::kPairPt], fValuesHadron[VarManager::kPairEta], fValuesHadron[VarManager::kPairPhi], fValuesHadron[VarManager::kPairRap], fValuesHadron[VarManager::kVertexingLxy], fValuesHadron[VarManager::kVertexingLxyz], fValuesHadron[VarManager::kVertexingLz], fValuesHadron[VarManager::kVertexingTauxy], fValuesHadron[VarManager::kVertexingTauz], fValuesHadron[VarManager::kCosPointingAngle], fValuesHadron[VarManager::kVertexingChi2PCA], @@ -3938,7 +3937,6 @@ struct AnalysisDileptonTrack { track.tpcNSigmaKa(), track.tpcNSigmaPi(), track.tpcNSigmaPr(), track.tofNSigmaKa(), lepton1.tpcNSigmaEl(), lepton1.tpcNSigmaPi(), lepton1.tpcNSigmaPr(), lepton2.tpcNSigmaEl(), lepton2.tpcNSigmaPi(), lepton2.tpcNSigmaPr(), - track.dcaXY(), track.dcaZ(), lepton1.dcaXY(), lepton1.dcaZ(), lepton2.dcaXY(), lepton2.dcaZ(), track.itsClusterMap(), lepton1.itsClusterMap(), lepton2.itsClusterMap(), track.itsChi2NCl(), lepton1.itsChi2NCl(), lepton2.itsChi2NCl(), track.tpcNClsFound(), lepton1.tpcNClsFound(), lepton2.tpcNClsFound(), @@ -4209,40 +4207,44 @@ struct AnalysisDileptonTrack { } } - /*for (auto& [t1, t2, t3] : combinations(groupedMCTracks, groupedMCTracks, groupedMCTracks)) { + // make a list of all MC tracks in the MC collision corresponding to the current reconstructed event + std::vector mcTrackIndices; + for (auto& t : groupedMCTracks) { + mcTrackIndices.push_back(t.globalIndex()); + } - if (! (t1.mcReducedFlags() & (uint16_t(1) << fConfigMCGenSignalDileptonLegPos.value))) { - continue; - } - if (t1.pt() < fConfigMCGenDileptonLegPtMin.value) { - continue; - } - if (std::abs(t1.eta()) > fConfigMCGenDileptonLegEtaAbs.value) { - continue; - } + // make a three nested for loop over all MC tracks in the vector + for (auto t1 : mcTrackIndices) { + auto track1 = mcTracks.rawIteratorAt(*(&t1)); + for (auto t2 : mcTrackIndices) { + if (t1 == t2 || t2 < t1) + continue; + auto track2 = mcTracks.rawIteratorAt(*(&t2)); + for (auto t3 : mcTrackIndices) { + if (t3 == t1 || t3 == t2) + continue; + auto track3 = mcTracks.rawIteratorAt(*(&t3)); - if (! (t2.mcReducedFlags() & (uint16_t(1) << fConfigMCGenSignalDileptonLegNeg.value))) { - continue; - } - if (t2.pt() < fConfigMCGenDileptonLegPtMin.value) { - continue; - } - if (std::abs(t2.eta()) > fConfigMCGenDileptonLegEtaAbs.value) { - continue; - } + for (auto& sig : fRecMCSignals) { + if (sig->CheckSignal(true, track1, track2, track3)) { + fHistMan->FillHistClass(Form("MCTruthGenSelBR_%s", sig->GetName()), VarManager::fgValues); - if (! (t3.mcReducedFlags() & (uint16_t(1) << fConfigMCGenSignalHadron.value))) { - continue; - } - if (t3.pt() < fConfigMCGenHadronPtMin.value) { - continue; - } - if (std::abs(t3.eta()) > fConfigMCGenHadronEtaAbs.value) { - continue; + // apply kinematic cuts + if (track1.pt() < fConfigMCGenDileptonLegPtMin.value || std::abs(track1.eta()) > fConfigMCGenDileptonLegEtaAbs.value) { + continue; + } + if (track2.pt() < fConfigMCGenDileptonLegPtMin.value || std::abs(track2.eta()) > fConfigMCGenDileptonLegEtaAbs.value) { + continue; + } + if (track3.pt() < fConfigMCGenHadronPtMin.value || std::abs(track3.eta()) > fConfigMCGenHadronEtaAbs.value) { + continue; + } + fHistMan->FillHistClass(Form("MCTruthGenSelBRAccepted_%s", sig->GetName()), VarManager::fgValues); + } + } + } } - - fHistMan->FillHistClass("MCTruthGenSelAccepted", VarManager::fgValues); - }*/ + } } // end loop over reconstructed events } diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index e3cf391ff44..db2ef8b7a2a 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -94,6 +94,8 @@ DECLARE_SOA_COLUMN(MassDileptonCandidate, massDileptonCandidate, float); DECLARE_SOA_COLUMN(deltamassBcandidate, deltaMBcandidate, float); DECLARE_SOA_COLUMN(pTBcandidate, PtBcandidate, float); DECLARE_SOA_COLUMN(EtaBcandidate, etaBcandidate, float); +DECLARE_SOA_COLUMN(PhiBcandidate, phiBcandidate, float); +DECLARE_SOA_COLUMN(RapBcandidate, rapBcandidate, float); DECLARE_SOA_COLUMN(LxyBcandidate, lxyBcandidate, float); DECLARE_SOA_COLUMN(LxyzBcandidate, lxyzBcandidate, float); DECLARE_SOA_COLUMN(LzBcandidate, lzBcandidate, float); @@ -128,12 +130,6 @@ DECLARE_SOA_COLUMN(TPCnsigmaPrleg1, tpcnsigmaPrleg1, float); DECLARE_SOA_COLUMN(TPCnsigmaElleg2, tpcnsigmaElleg2, float); DECLARE_SOA_COLUMN(TPCnsigmaPileg2, tpcnsigmaPileg2, float); DECLARE_SOA_COLUMN(TPCnsigmaPrleg2, tpcnsigmaPrleg2, float); -DECLARE_SOA_COLUMN(DCAXYassoc, dcaXYassoc, float); -DECLARE_SOA_COLUMN(DCAZassoc, dcaZassoc, float); -DECLARE_SOA_COLUMN(DCAXYleg1, dcaXYleg1, float); -DECLARE_SOA_COLUMN(DCAZleg1, dcaZleg1, float); -DECLARE_SOA_COLUMN(DCAXYleg2, dcaXYleg2, float); -DECLARE_SOA_COLUMN(DCAZleg2, dcaZleg2, float); DECLARE_SOA_COLUMN(ITSClusterMapassoc, itsClusterMapassoc, uint8_t); DECLARE_SOA_COLUMN(ITSClusterMapleg1, itsClusterMapleg1, uint8_t); DECLARE_SOA_COLUMN(ITSClusterMapleg2, itsClusterMapleg2, uint8_t); @@ -173,7 +169,7 @@ DECLARE_SOA_TABLE(MuonAmbiguities, "AOD", "DQMUONAMBA", dqanalysisflags::MuonAmb DECLARE_SOA_TABLE(Prefilter, "AOD", "DQPREFILTERA", dqanalysisflags::IsBarrelSelectedPrefilter); //! joinable to ReducedTracksAssoc DECLARE_SOA_TABLE(BmesonCandidates, "AOD", "DQBMESONSA", dqanalysisflags::RunNumber, dqanalysisflags::EventIdx, dqanalysisflags::EventTimestamp, - dqanalysisflags::massBcandidate, dqanalysisflags::MassDileptonCandidate, dqanalysisflags::deltamassBcandidate, dqanalysisflags::pTBcandidate, dqanalysisflags::EtaBcandidate, + dqanalysisflags::massBcandidate, dqanalysisflags::MassDileptonCandidate, dqanalysisflags::deltamassBcandidate, dqanalysisflags::pTBcandidate, dqanalysisflags::EtaBcandidate, dqanalysisflags::PhiBcandidate, dqanalysisflags::RapBcandidate, dqanalysisflags::LxyBcandidate, dqanalysisflags::LxyzBcandidate, dqanalysisflags::LzBcandidate, dqanalysisflags::TauxyBcandidate, dqanalysisflags::TauzBcandidate, dqanalysisflags::CosPBcandidate, dqanalysisflags::Chi2Bcandidate, dqanalysisflags::GlobalIndexassoc, dqanalysisflags::GlobalIndexleg1, dqanalysisflags::GlobalIndexleg2, @@ -182,7 +178,6 @@ DECLARE_SOA_TABLE(BmesonCandidates, "AOD", "DQBMESONSA", dqanalysisflags::TPCnsigmaKaassoc, dqanalysisflags::TPCnsigmaPiassoc, dqanalysisflags::TPCnsigmaPrassoc, dqanalysisflags::TOFnsigmaKaassoc, dqanalysisflags::TPCnsigmaElleg1, dqanalysisflags::TPCnsigmaPileg1, dqanalysisflags::TPCnsigmaPrleg1, dqanalysisflags::TPCnsigmaElleg2, dqanalysisflags::TPCnsigmaPileg2, dqanalysisflags::TPCnsigmaPrleg2, - dqanalysisflags::DCAXYassoc, dqanalysisflags::DCAZassoc, dqanalysisflags::DCAXYleg1, dqanalysisflags::DCAZleg1, dqanalysisflags::DCAXYleg2, dqanalysisflags::DCAZleg2, dqanalysisflags::ITSClusterMapassoc, dqanalysisflags::ITSClusterMapleg1, dqanalysisflags::ITSClusterMapleg2, dqanalysisflags::ITSChi2assoc, dqanalysisflags::ITSChi2leg1, dqanalysisflags::ITSChi2leg2, dqanalysisflags::TPCNclsassoc, dqanalysisflags::TPCNclsleg1, dqanalysisflags::TPCNclsleg2, @@ -306,7 +301,6 @@ struct AnalysisEventSelection { void init(o2::framework::InitContext& context) { - LOG(info) << "Starting initialization of AnalysisEventSelection (idstoreh)"; bool isAnyProcessEnabled = context.mOptions.get("processSkimmed") || context.mOptions.get("processSkimmedWithZdc") || context.mOptions.get("processSkimmedWithMultExtra") || context.mOptions.get("processSkimmedWithMultExtraZdc") || context.mOptions.get("processSkimmedWithQvectorCentr"); bool isDummyEnabled = context.mOptions.get("processDummy"); @@ -372,7 +366,6 @@ struct AnalysisEventSelection { fCCDB->setLocalObjectValidityChecking(); fCCDB->setCreatedNotAfter(fConfigNoLaterThan.value); fCCDBApi.init(fConfigCcdbUrl.value); - LOG(info) << "Initialization of AnalysisEventSelection finished (idstoreh)"; } template @@ -601,7 +594,6 @@ struct AnalysisTrackSelection { void init(o2::framework::InitContext& context) { - LOG(info) << "Starting initialization of AnalysisTrackSelection (idstoreh)"; if (context.mOptions.get("processDummy")) { return; } @@ -651,7 +643,6 @@ struct AnalysisTrackSelection { fCCDB->setLocalObjectValidityChecking(); fCCDB->setCreatedNotAfter(fConfigNoLaterThan.value); fCCDBApi.init(fConfigCcdbUrl.value); - LOG(info) << "Initialization of AnalysisTrackSelection finished (idstoreh)"; } template @@ -854,7 +845,6 @@ struct AnalysisMuonSelection { void init(o2::framework::InitContext& context) { - LOG(info) << "Starting initialization of AnalysisMuonSelection (idstoreh)"; if (context.mOptions.get("processDummy")) { return; } @@ -906,7 +896,6 @@ struct AnalysisMuonSelection { if (!o2::base::GeometryManager::isGeometryLoaded()) { fCCDB->get(fConfigGeoPath); } - LOG(info) << "Initialization of AnalysisMuonSelection finished (idstoreh)"; } template @@ -1057,7 +1046,6 @@ struct AnalysisPrefilterSelection { void init(o2::framework::InitContext& context) { - LOG(info) << "Starting initialization of AnalysisPrefilterSelection (idstoreh)"; if (context.mOptions.get("processDummy")) { return; } @@ -1131,7 +1119,6 @@ struct AnalysisPrefilterSelection { VarManager::SetUseVars(AnalysisCut::fgUsedVars); // provide the list of required variables so that VarManager knows what to fill VarManager::SetupTwoProngDCAFitter(5.0f, true, 200.0f, 4.0f, 1.0e-3f, 0.9f, true); // TODO: get these parameters from Configurables // VarManager::SetupTwoProngFwdDCAFitter(5.0f, true, 200.0f, 1.0e-3f, 0.9f, true); - LOG(info) << "Initialization of AnalysisPrefilterSelection finished (idstoreh)"; } template @@ -1324,7 +1311,6 @@ struct AnalysisSameEventPairing { void init(o2::framework::InitContext& context) { - LOG(info) << "Starting initialization of AnalysisSameEventPairing (idstoreh)"; fEnableBarrelHistos = context.mOptions.get("processAllSkimmed") || context.mOptions.get("processBarrelOnlySkimmed") || context.mOptions.get("processBarrelOnlyWithCollSkimmed") || context.mOptions.get("processBarrelOnlySkimmedNoCov") || context.mOptions.get("processBarrelOnlySkimmedNoCovWithMultExtra") || context.mOptions.get("processBarrelOnlyWithQvectorCentrSkimmedNoCov"); fEnableBarrelMixingHistos = context.mOptions.get("processMixingAllSkimmed") || context.mOptions.get("processMixingBarrelSkimmed") || context.mOptions.get("processMixingBarrelSkimmedFlow") || context.mOptions.get("processMixingBarrelWithQvectorCentrSkimmedNoCov"); fEnableMuonHistos = context.mOptions.get("processAllSkimmed") || context.mOptions.get("processMuonOnlySkimmed") || context.mOptions.get("processMuonOnlySkimmedMultExtra") || context.mOptions.get("processMixingMuonSkimmed"); @@ -1470,7 +1456,6 @@ struct AnalysisSameEventPairing { } } } - LOG(info) << "Initialization of AnalysisSameEventPairing 1 (idstoreh)"; // get the muon track selection cuts getTaskOptionValue(context, "analysis-muon-selection", "cfgMuonCuts", tempCuts, false); @@ -1552,8 +1537,6 @@ struct AnalysisSameEventPairing { } } - LOG(info) << "Initialization of AnalysisSameEventPairing 2 (idstoreh)"; - fCurrentRun = 0; fCCDB->setURL(fConfigCCDB.url.value); @@ -1615,7 +1598,6 @@ struct AnalysisSameEventPairing { VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill fOutputList.setObject(fHistMan->GetMainHistogramList()); } - LOG(info) << "Finished initialization of AnalysisSameEventPairing (idstoreh)"; } void initParamsFromCCDB(uint64_t timestamp, int runNumber, bool withTwoProngFitter = true) @@ -2441,7 +2423,6 @@ struct AnalysisAsymmetricPairing { void init(o2::framework::InitContext& context) { - LOG(info) << "Initialization of AnalysisAsymmetricPairing started (idstoreh)"; if (context.mOptions.get("processDummy")) { return; } @@ -2670,7 +2651,6 @@ struct AnalysisAsymmetricPairing { dqhistograms::AddHistogramsFromJSON(fHistMan, fConfigAddJSONHistograms.value.c_str()); // ad-hoc histograms via JSON VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill fOutputList.setObject(fHistMan->GetMainHistogramList()); - LOG(info) << "Initialization of AnalysisAsymmetricPairing finished (idstoreh)"; } void initParamsFromCCDB(uint64_t timestamp, bool isTriplets) @@ -3153,7 +3133,6 @@ struct AnalysisDileptonTrack { void init(o2::framework::InitContext& context) { - LOG(info) << "Initialization of AnalysisDileptonTrack started (idstoreh)"; bool isBarrel = context.mOptions.get("processBarrelSkimmed"); bool isBarrelME = context.mOptions.get("processBarrelMixedEvent"); bool isBarrelAsymmetric = context.mOptions.get("processDstarToD0Pi"); @@ -3179,7 +3158,6 @@ struct AnalysisDileptonTrack { // For each track/muon selection used to produce dileptons, create a separate histogram directory using the // name of the track/muon cut. - LOG(info) << "Initialization of AnalysisDileptonTrack 1 (idstoreh)"; if (isBarrel || isMuon || isBarrelAsymmetric) { // Get the list of single track and muon cuts computed in the dedicated tasks upstream // We need this to know the order in which they were computed, and also to make sure that in this task we do not ask @@ -3218,7 +3196,6 @@ struct AnalysisDileptonTrack { for (int icut = 0; icut < cfgTrackSelection_objArrayTrackCuts->GetEntries(); icut++) { fTrackCutNames.push_back(cfgTrackSelection_objArrayTrackCuts->At(icut)->GetName()); } - LOG(info) << "Initialization of AnalysisDileptonTrack 2 (idstoreh)"; // get the list of associated track cuts to be combined with the dileptons and // check that these were computed upstream and create a bit mask TObjArray* cfgDileptonTrack_objArrayTrackCuts = nullptr; @@ -3258,7 +3235,6 @@ struct AnalysisDileptonTrack { getTaskOptionValue(context, "analysis-asymmetric-pairing", "cfgPairCuts", cfgPairing_PairCuts, false); getTaskOptionValue(context, "analysis-asymmetric-pairing", "cfgCommonTrackCuts", cfgPairing_CommonTrackCuts, false); } - LOG(info) << "Initialization of AnalysisDileptonTrack 3 (idstoreh)"; if (cfgPairing_TrackCuts.empty()) { LOG(fatal) << "There are no dilepton cuts specified in the upstream in the same-event-pairing or asymmetric-pairing"; } @@ -3277,7 +3253,6 @@ struct AnalysisDileptonTrack { } } } // end if (common cuts) - LOG(info) << "Initialization of AnalysisDileptonTrack 4 (idstoreh)"; // Get also the pair cuts specified via the JSON parameters if (isBarrelAsymmetric) { getTaskOptionValue(context, "analysis-asymmetric-pairing", "cfgPairCutsJSON", cfgPairing_PairCutsJSON, false); @@ -3304,7 +3279,6 @@ struct AnalysisDileptonTrack { } else { fNLegCuts = fNCuts; } - LOG(info) << "Initialization of AnalysisDileptonTrack 5 (idstoreh)"; // loop over single lepton cuts for (int icut = 0; icut < fNLegCuts; ++icut) { @@ -3378,8 +3352,6 @@ struct AnalysisDileptonTrack { LOG(info) << "Loading geometry from CCDB in dilepton-track task"; fCCDB->get(fConfigGeoPath); } - - LOG(info) << "Initialization of AnalysisDileptonTrack finished (idstoreh)"; } // init parameters from CCDB @@ -3477,7 +3449,7 @@ struct AnalysisDileptonTrack { VarManager::FillDileptonHadron(dilepton, track, fValuesHadron); VarManager::FillDileptonTrackVertexing(event, lepton1, lepton2, track, fValuesHadron); // table to be written out for ML analysis - BmesonsTable(event.runNumber(), event.globalIndex(), event.timestamp(), fValuesHadron[VarManager::kPairMass], dilepton.mass(), fValuesHadron[VarManager::kDeltaMass], fValuesHadron[VarManager::kPairPt], fValuesHadron[VarManager::kPairEta], + BmesonsTable(event.runNumber(), event.globalIndex(), event.timestamp(), fValuesHadron[VarManager::kPairMass], dilepton.mass(), fValuesHadron[VarManager::kDeltaMass], fValuesHadron[VarManager::kPairPt], fValuesHadron[VarManager::kPairEta], fValuesHadron[VarManager::kPairPhi], fValuesHadron[VarManager::kPairRap], fValuesHadron[VarManager::kVertexingLxy], fValuesHadron[VarManager::kVertexingLxyz], fValuesHadron[VarManager::kVertexingLz], fValuesHadron[VarManager::kVertexingTauxy], fValuesHadron[VarManager::kVertexingTauz], fValuesHadron[VarManager::kCosPointingAngle], fValuesHadron[VarManager::kVertexingChi2PCA], @@ -3486,7 +3458,6 @@ struct AnalysisDileptonTrack { track.tpcNSigmaKa(), track.tpcNSigmaPi(), track.tpcNSigmaPr(), track.tofNSigmaKa(), lepton1.tpcNSigmaEl(), lepton1.tpcNSigmaPi(), lepton1.tpcNSigmaPr(), lepton2.tpcNSigmaEl(), lepton2.tpcNSigmaPi(), lepton2.tpcNSigmaPr(), - track.dcaXY(), track.dcaZ(), lepton1.dcaXY(), lepton1.dcaZ(), lepton2.dcaXY(), lepton2.dcaZ(), track.itsClusterMap(), lepton1.itsClusterMap(), lepton2.itsClusterMap(), track.itsChi2NCl(), lepton1.itsChi2NCl(), lepton2.itsChi2NCl(), track.tpcNClsFound(), lepton1.tpcNClsFound(), lepton2.tpcNClsFound(), From 5b9b9a3dc7050dc1f43ecbc725f9df02848b88ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Fri, 17 Oct 2025 09:16:54 +0200 Subject: [PATCH 786/986] [ALICE3] A3 OTF: Check available LUT before smearing (#13420) --- ALICE3/Core/DelphesO2TrackSmearer.cxx | 31 ++--- ALICE3/Core/DelphesO2TrackSmearer.h | 25 +++-- ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx | 112 ++++++++++--------- ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx | 46 +++++--- 4 files changed, 122 insertions(+), 92 deletions(-) diff --git a/ALICE3/Core/DelphesO2TrackSmearer.cxx b/ALICE3/Core/DelphesO2TrackSmearer.cxx index 0002160a49b..599d9cd9413 100644 --- a/ALICE3/Core/DelphesO2TrackSmearer.cxx +++ b/ALICE3/Core/DelphesO2TrackSmearer.cxx @@ -153,12 +153,13 @@ bool TrackSmearer::loadTable(int pdg, const char* filename, bool forceReload) /*****************************************************************/ -lutEntry_t* - TrackSmearer::getLUTEntry(int pdg, float nch, float radius, float eta, float pt, float& interpolatedEff) +lutEntry_t* TrackSmearer::getLUTEntry(const int pdg, const float nch, const float radius, const float eta, const float pt, float& interpolatedEff) { - auto ipdg = getIndexPDG(pdg); - if (!mLUTHeader[ipdg]) + const int ipdg = getIndexPDG(pdg); + if (!mLUTHeader[ipdg]) { + LOG(error) << " --- getLUTEntry: LUT header not loaded for pdg=" << pdg << ". Returning nullptr."; return nullptr; + } auto inch = mLUTHeader[ipdg]->nchmap.find(nch); auto irad = mLUTHeader[ipdg]->radmap.find(radius); auto ieta = mLUTHeader[ipdg]->etamap.find(eta); @@ -290,7 +291,7 @@ bool TrackSmearer::smearTrack(O2Track& o2track, int pdg, float nch) } auto eta = o2track.getEta(); float interpolatedEff = 0.0f; - auto lutEntry = getLUTEntry(pdg, nch, 0., eta, pt, interpolatedEff); + lutEntry_t* lutEntry = getLUTEntry(pdg, nch, 0., eta, pt, interpolatedEff); if (!lutEntry || !lutEntry->valid) return false; return smearTrack(o2track, lutEntry, interpolatedEff); @@ -298,20 +299,20 @@ bool TrackSmearer::smearTrack(O2Track& o2track, int pdg, float nch) /*****************************************************************/ // relative uncertainty on pt -double TrackSmearer::getPtRes(int pdg, float nch, float eta, float pt) +double TrackSmearer::getPtRes(const int pdg, const float nch, const float eta, const float pt) { float dummy = 0.0f; - auto lutEntry = getLUTEntry(pdg, nch, 0., eta, pt, dummy); + lutEntry_t* lutEntry = getLUTEntry(pdg, nch, 0., eta, pt, dummy); auto val = std::sqrt(lutEntry->covm[14]) * lutEntry->pt; return val; } /*****************************************************************/ // relative uncertainty on eta -double TrackSmearer::getEtaRes(int pdg, float nch, float eta, float pt) +double TrackSmearer::getEtaRes(const int pdg, const float nch, const float eta, const float pt) { float dummy = 0.0f; - auto lutEntry = getLUTEntry(pdg, nch, 0., eta, pt, dummy); + lutEntry_t* lutEntry = getLUTEntry(pdg, nch, 0., eta, pt, dummy); auto sigmatgl = std::sqrt(lutEntry->covm[9]); // sigmatgl2 auto etaRes = std::fabs(std::sin(2.0 * std::atan(std::exp(-eta)))) * sigmatgl; // propagate tgl to eta uncertainty etaRes /= lutEntry->eta; // relative uncertainty @@ -319,27 +320,27 @@ double TrackSmearer::getEtaRes(int pdg, float nch, float eta, float pt) } /*****************************************************************/ // absolute uncertainty on pt -double TrackSmearer::getAbsPtRes(int pdg, float nch, float eta, float pt) +double TrackSmearer::getAbsPtRes(const int pdg, const float nch, const float eta, const float pt) { float dummy = 0.0f; - auto lutEntry = getLUTEntry(pdg, nch, 0., eta, pt, dummy); + lutEntry_t* lutEntry = getLUTEntry(pdg, nch, 0., eta, pt, dummy); auto val = std::sqrt(lutEntry->covm[14]) * lutEntry->pt * lutEntry->pt; return val; } /*****************************************************************/ // absolute uncertainty on eta -double TrackSmearer::getAbsEtaRes(int pdg, float nch, float eta, float pt) +double TrackSmearer::getAbsEtaRes(const int pdg, const float nch, const float eta, const float pt) { float dummy = 0.0f; - auto lutEntry = getLUTEntry(pdg, nch, 0., eta, pt, dummy); + lutEntry_t* lutEntry = getLUTEntry(pdg, nch, 0., eta, pt, dummy); auto sigmatgl = std::sqrt(lutEntry->covm[9]); // sigmatgl2 auto etaRes = std::fabs(std::sin(2.0 * std::atan(std::exp(-eta)))) * sigmatgl; // propagate tgl to eta uncertainty return etaRes; } /*****************************************************************/ // efficiency -double TrackSmearer::getEfficiency(int pdg, float nch, float eta, float pt) +double TrackSmearer::getEfficiency(const int pdg, const float nch, const float eta, const float pt) { float efficiency = 0.0f; getLUTEntry(pdg, nch, 0., eta, pt, efficiency); @@ -360,7 +361,7 @@ double TrackSmearer::getEfficiency(int pdg, float nch, float eta, float pt) // return true; // #if 0 -// auto lutEntry = getLUTEntry(track.PID, 0., 0., track.Eta, track.PT); +// lutEntry_t* lutEntry = getLUTEntry(track.PID, 0., 0., track.Eta, track.PT); // if (!lutEntry) // return; diff --git a/ALICE3/Core/DelphesO2TrackSmearer.h b/ALICE3/Core/DelphesO2TrackSmearer.h index 770b51e75a6..027809fa004 100644 --- a/ALICE3/Core/DelphesO2TrackSmearer.h +++ b/ALICE3/Core/DelphesO2TrackSmearer.h @@ -180,23 +180,24 @@ class TrackSmearer /** LUT methods **/ bool loadTable(int pdg, const char* filename, bool forceReload = false); - void useEfficiency(bool val) { mUseEfficiency = val; } //; - void interpolateEfficiency(bool val) { mInterpolateEfficiency = val; } //; - void skipUnreconstructed(bool val) { mSkipUnreconstructed = val; } //; - void setWhatEfficiency(int val) { mWhatEfficiency = val; } //; - lutHeader_t* getLUTHeader(int pdg) { return mLUTHeader[getIndexPDG(pdg)]; } //; - lutEntry_t* getLUTEntry(int pdg, float nch, float radius, float eta, float pt, float& interpolatedEff); + bool hasTable(int pdg) { return (mLUTHeader[getIndexPDG(pdg)] != nullptr); } //; + void useEfficiency(bool val) { mUseEfficiency = val; } //; + void interpolateEfficiency(bool val) { mInterpolateEfficiency = val; } //; + void skipUnreconstructed(bool val) { mSkipUnreconstructed = val; } //; + void setWhatEfficiency(int val) { mWhatEfficiency = val; } //; + lutHeader_t* getLUTHeader(int pdg) { return mLUTHeader[getIndexPDG(pdg)]; } //; + lutEntry_t* getLUTEntry(const int pdg, const float nch, const float radius, const float eta, const float pt, float& interpolatedEff); bool smearTrack(O2Track& o2track, lutEntry_t* lutEntry, float interpolatedEff); bool smearTrack(O2Track& o2track, int pdg, float nch); // bool smearTrack(Track& track, bool atDCA = true); // Only in DelphesO2 - double getPtRes(int pdg, float nch, float eta, float pt); - double getEtaRes(int pdg, float nch, float eta, float pt); - double getAbsPtRes(int pdg, float nch, float eta, float pt); - double getAbsEtaRes(int pdg, float nch, float eta, float pt); - double getEfficiency(int pdg, float nch, float eta, float pt); + double getPtRes(const int pdg, const float nch, const float eta, const float pt); + double getEtaRes(const int pdg, const float nch, const float eta, const float pt); + double getAbsPtRes(const int pdg, const float nch, const float eta, const float pt); + double getAbsEtaRes(const int pdg, const float nch, const float eta, const float pt); + double getEfficiency(const int pdg, const float nch, const float eta, const float pt); - int getIndexPDG(int pdg) + int getIndexPDG(const int pdg) { switch (abs(pdg)) { case 11: diff --git a/ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx b/ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx index ad7dccc6748..357e208f95f 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx @@ -48,7 +48,6 @@ #include #include #include -#include #include #include #include @@ -57,6 +56,7 @@ #include #include #include +#include #include #include @@ -812,21 +812,29 @@ struct OnTheFlyRichPid { float nSigmaBarrelRich[kNspecies] = {kErrorValue, kErrorValue, kErrorValue, kErrorValue, kErrorValue, kErrorValue, kErrorValue, kErrorValue, kErrorValue}; bool signalBarrelRich[kNspecies] = {false, false, false, false, false, false, false, false, false}; float deltaThetaBarrelRich[kNspecies]; //, nSigmaBarrelRich[kNspecies]; - static constexpr int kPdgArray[kNspecies] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton, o2::constants::physics::kDeuteron, o2::constants::physics::kTriton, o2::constants::physics::kHelium3, o2::constants::physics::kAlpha}; - static constexpr float kMasses[kNspecies] = {o2::track::pid_constants::sMasses[o2::track::PID::Electron], - o2::track::pid_constants::sMasses[o2::track::PID::Muon], - o2::track::pid_constants::sMasses[o2::track::PID::Pion], - o2::track::pid_constants::sMasses[o2::track::PID::Kaon], - o2::track::pid_constants::sMasses[o2::track::PID::Proton], - o2::track::pid_constants::sMasses[o2::track::PID::Deuteron], - o2::track::pid_constants::sMasses[o2::track::PID::Triton], - o2::track::pid_constants::sMasses[o2::track::PID::Helium3], - o2::track::pid_constants::sMasses[o2::track::PID::Alpha]}; + static constexpr int kParticlePdgs[kNspecies] = {kElectron, + kMuonMinus, + kPiPlus, + kKPlus, + kProton, + o2::constants::physics::kDeuteron, + o2::constants::physics::kTriton, + o2::constants::physics::kHelium3, + o2::constants::physics::kAlpha}; + static constexpr float kParticleMasses[kNspecies] = {o2::track::pid_constants::sMasses[o2::track::PID::Electron], + o2::track::pid_constants::sMasses[o2::track::PID::Muon], + o2::track::pid_constants::sMasses[o2::track::PID::Pion], + o2::track::pid_constants::sMasses[o2::track::PID::Kaon], + o2::track::pid_constants::sMasses[o2::track::PID::Proton], + o2::track::pid_constants::sMasses[o2::track::PID::Deuteron], + o2::track::pid_constants::sMasses[o2::track::PID::Triton], + o2::track::pid_constants::sMasses[o2::track::PID::Helium3], + o2::track::pid_constants::sMasses[o2::track::PID::Alpha]}; for (int ii = 0; ii < kNspecies; ii++) { // Loop on the particle hypotheses float hypothesisAngleBarrelRich = kErrorValue; - const bool hypothesisAngleBarrelRichOk = cherenkovAngle(recoTrack.getP(), kMasses[ii], aerogelRindex[iSecor], hypothesisAngleBarrelRich); + const bool hypothesisAngleBarrelRichOk = cherenkovAngle(recoTrack.getP(), kParticleMasses[ii], aerogelRindex[iSecor], hypothesisAngleBarrelRich); signalBarrelRich[ii] = hypothesisAngleBarrelRichOk; // Particle is above the threshold and enough photons // Evaluate total sigma (layer + tracking resolution) @@ -836,11 +844,13 @@ struct OnTheFlyRichPid { double ptResolution = transverseMomentum * transverseMomentum * std::sqrt(recoTrack.getSigma1Pt2()); double etaResolution = std::fabs(std::sin(2.0 * std::atan(std::exp(-recoTrack.getEta())))) * std::sqrt(recoTrack.getSigmaTgl2()); if (flagRICHLoadDelphesLUTs) { - ptResolution = mSmearer.getAbsPtRes(kPdgArray[ii], dNdEta, recoTrack.getEta(), transverseMomentum); - etaResolution = mSmearer.getAbsEtaRes(kPdgArray[ii], dNdEta, recoTrack.getEta(), transverseMomentum); + if (mSmearer.hasTable(kParticlePdgs[ii])) { + ptResolution = mSmearer.getAbsPtRes(kParticlePdgs[ii], dNdEta, recoTrack.getEta(), transverseMomentum); + etaResolution = mSmearer.getAbsEtaRes(kParticlePdgs[ii], dNdEta, recoTrack.getEta(), transverseMomentum); + } } // cout << endl << "Pt resolution: " << ptResolution << ", Eta resolution: " << etaResolution << endl << endl; - const float barrelTrackAngularReso = calculateTrackAngularResolutionAdvanced(recoTrack.getP() / std::cosh(recoTrack.getEta()), recoTrack.getEta(), ptResolution, etaResolution, kMasses[ii], aerogelRindex[iSecor]); + const float barrelTrackAngularReso = calculateTrackAngularResolutionAdvanced(recoTrack.getP() / std::cosh(recoTrack.getEta()), recoTrack.getEta(), ptResolution, etaResolution, kParticleMasses[ii], aerogelRindex[iSecor]); barrelTotalAngularReso = std::hypot(barrelRICHAngularResolution, barrelTrackAngularReso); if (doQAplots && hypothesisAngleBarrelRich > kErrorValue + 1. && @@ -848,64 +858,64 @@ struct OnTheFlyRichPid { barrelRICHAngularResolution > kErrorValue + 1. && flagReachesRadiator) { switch (mcParticle.pdgCode()) { - case kPdgArray[kEl]: // Electron - case -kPdgArray[kEl]: // Positron + case kParticlePdgs[kEl]: // Electron + case -kParticlePdgs[kEl]: // Positron if (ii == kEl) { histos.fill(HIST("h2dBarrelAngularResTrackElecVsP"), recoTrack.getP(), 1000.0 * barrelTrackAngularReso); histos.fill(HIST("h2dBarrelAngularResTotalElecVsP"), recoTrack.getP(), 1000.0 * barrelTotalAngularReso); } break; - case kPdgArray[kMu]: // Muon - case -kPdgArray[kMu]: // AntiMuon + case kParticlePdgs[kMu]: // Muon + case -kParticlePdgs[kMu]: // AntiMuon if (ii == kMu) { histos.fill(HIST("h2dBarrelAngularResTrackMuonVsP"), recoTrack.getP(), 1000.0 * barrelTrackAngularReso); histos.fill(HIST("h2dBarrelAngularResTotalMuonVsP"), recoTrack.getP(), 1000.0 * barrelTotalAngularReso); } break; - case kPdgArray[kPi]: // Pion - case -kPdgArray[kPi]: // AntiPion + case kParticlePdgs[kPi]: // Pion + case -kParticlePdgs[kPi]: // AntiPion if (ii == kPi) { histos.fill(HIST("h2dBarrelAngularResTrackPionVsP"), recoTrack.getP(), 1000.0 * barrelTrackAngularReso); histos.fill(HIST("h2dBarrelAngularResTotalPionVsP"), recoTrack.getP(), 1000.0 * barrelTotalAngularReso); } break; - case kPdgArray[kKa]: // Kaon - case -kPdgArray[kKa]: // AntiKaon + case kParticlePdgs[kKa]: // Kaon + case -kParticlePdgs[kKa]: // AntiKaon if (ii == kKa) { histos.fill(HIST("h2dBarrelAngularResTrackKaonVsP"), recoTrack.getP(), 1000.0 * barrelTrackAngularReso); histos.fill(HIST("h2dBarrelAngularResTotalKaonVsP"), recoTrack.getP(), 1000.0 * barrelTotalAngularReso); } break; - case kPdgArray[kPr]: // Proton - case -kPdgArray[kPr]: // AntiProton + case kParticlePdgs[kPr]: // Proton + case -kParticlePdgs[kPr]: // AntiProton if (ii == kPr) { histos.fill(HIST("h2dBarrelAngularResTrackProtVsP"), recoTrack.getP(), 1000.0 * barrelTrackAngularReso); histos.fill(HIST("h2dBarrelAngularResTotalProtVsP"), recoTrack.getP(), 1000.0 * barrelTotalAngularReso); } break; - case kPdgArray[kDe]: // Deuteron - case -kPdgArray[kDe]: // AntiDeuteron + case kParticlePdgs[kDe]: // Deuteron + case -kParticlePdgs[kDe]: // AntiDeuteron if (ii == kDe) { histos.fill(HIST("h2dBarrelAngularResTrackDeutVsP"), recoTrack.getP(), 1000.0 * barrelTrackAngularReso); histos.fill(HIST("h2dBarrelAngularResTotalDeutVsP"), recoTrack.getP(), 1000.0 * barrelTotalAngularReso); } break; - case kPdgArray[kTr]: // Triton - case -kPdgArray[kTr]: // AntiTriton + case kParticlePdgs[kTr]: // Triton + case -kParticlePdgs[kTr]: // AntiTriton if (ii == kTr) { histos.fill(HIST("h2dBarrelAngularResTrackTritVsP"), recoTrack.getP(), 1000.0 * barrelTrackAngularReso); histos.fill(HIST("h2dBarrelAngularResTotalTritVsP"), recoTrack.getP(), 1000.0 * barrelTotalAngularReso); } break; - case kPdgArray[kHe3]: // Helium3 - case -kPdgArray[kHe3]: // AntiHelium3 + case kParticlePdgs[kHe3]: // Helium3 + case -kParticlePdgs[kHe3]: // AntiHelium3 if (ii == kHe3) { histos.fill(HIST("h2dBarrelAngularResTrackHe3VsP"), recoTrack.getP(), 1000.0 * barrelTrackAngularReso); histos.fill(HIST("h2dBarrelAngularResTotalHe3VsP"), recoTrack.getP(), 1000.0 * barrelTotalAngularReso); } break; - case kPdgArray[kAl]: // Alpha - case -kPdgArray[kAl]: // AntiAlpha + case kParticlePdgs[kAl]: // Alpha + case -kParticlePdgs[kAl]: // AntiAlpha if (ii == kAl) { histos.fill(HIST("h2dBarrelAngularResTrackAlVsP"), recoTrack.getP(), 1000.0 * barrelTrackAngularReso); histos.fill(HIST("h2dBarrelAngularResTotalAlVsP"), recoTrack.getP(), 1000.0 * barrelTotalAngularReso); @@ -941,40 +951,40 @@ struct OnTheFlyRichPid { histos.fill(HIST("hSectorID"), iSecor); switch (mcParticle.pdgCode()) { - case kPdgArray[kEl]: // Electron - case -kPdgArray[kEl]: // Positron + case kParticlePdgs[kEl]: // Electron + case -kParticlePdgs[kEl]: // Positron histos.fill(HIST("h2dBarrelNsigmaTrueElecVsElecHypothesis"), recoTrack.getP(), nSigmaBarrelRich[0]); histos.fill(HIST("h2dBarrelNsigmaTrueElecVsMuonHypothesis"), recoTrack.getP(), nSigmaBarrelRich[1]); histos.fill(HIST("h2dBarrelNsigmaTrueElecVsPionHypothesis"), recoTrack.getP(), nSigmaBarrelRich[2]); histos.fill(HIST("h2dBarrelNsigmaTrueElecVsKaonHypothesis"), recoTrack.getP(), nSigmaBarrelRich[3]); histos.fill(HIST("h2dBarrelNsigmaTrueElecVsProtHypothesis"), recoTrack.getP(), nSigmaBarrelRich[4]); break; - case kPdgArray[kMu]: // Muon - case -kPdgArray[kMu]: // AntiMuon + case kParticlePdgs[kMu]: // Muon + case -kParticlePdgs[kMu]: // AntiMuon histos.fill(HIST("h2dBarrelNsigmaTrueMuonVsElecHypothesis"), recoTrack.getP(), nSigmaBarrelRich[0]); histos.fill(HIST("h2dBarrelNsigmaTrueMuonVsMuonHypothesis"), recoTrack.getP(), nSigmaBarrelRich[1]); histos.fill(HIST("h2dBarrelNsigmaTrueMuonVsPionHypothesis"), recoTrack.getP(), nSigmaBarrelRich[2]); histos.fill(HIST("h2dBarrelNsigmaTrueMuonVsKaonHypothesis"), recoTrack.getP(), nSigmaBarrelRich[3]); histos.fill(HIST("h2dBarrelNsigmaTrueMuonVsProtHypothesis"), recoTrack.getP(), nSigmaBarrelRich[4]); break; - case kPdgArray[kPi]: // Pion - case -kPdgArray[kPi]: // AntiPion + case kParticlePdgs[kPi]: // Pion + case -kParticlePdgs[kPi]: // AntiPion histos.fill(HIST("h2dBarrelNsigmaTruePionVsElecHypothesis"), recoTrack.getP(), nSigmaBarrelRich[0]); histos.fill(HIST("h2dBarrelNsigmaTruePionVsMuonHypothesis"), recoTrack.getP(), nSigmaBarrelRich[1]); histos.fill(HIST("h2dBarrelNsigmaTruePionVsPionHypothesis"), recoTrack.getP(), nSigmaBarrelRich[2]); histos.fill(HIST("h2dBarrelNsigmaTruePionVsKaonHypothesis"), recoTrack.getP(), nSigmaBarrelRich[3]); histos.fill(HIST("h2dBarrelNsigmaTruePionVsProtHypothesis"), recoTrack.getP(), nSigmaBarrelRich[4]); break; - case kPdgArray[kKa]: // Kaon - case -kPdgArray[kKa]: // AntiKaon + case kParticlePdgs[kKa]: // Kaon + case -kParticlePdgs[kKa]: // AntiKaon histos.fill(HIST("h2dBarrelNsigmaTrueKaonVsElecHypothesis"), recoTrack.getP(), nSigmaBarrelRich[0]); histos.fill(HIST("h2dBarrelNsigmaTrueKaonVsMuonHypothesis"), recoTrack.getP(), nSigmaBarrelRich[1]); histos.fill(HIST("h2dBarrelNsigmaTrueKaonVsPionHypothesis"), recoTrack.getP(), nSigmaBarrelRich[2]); histos.fill(HIST("h2dBarrelNsigmaTrueKaonVsKaonHypothesis"), recoTrack.getP(), nSigmaBarrelRich[3]); histos.fill(HIST("h2dBarrelNsigmaTrueKaonVsProtHypothesis"), recoTrack.getP(), nSigmaBarrelRich[4]); break; - case kPdgArray[kPr]: // Proton - case -kPdgArray[kPr]: // AntiProton + case kParticlePdgs[kPr]: // Proton + case -kParticlePdgs[kPr]: // AntiProton histos.fill(HIST("h2dBarrelNsigmaTrueProtVsElecHypothesis"), recoTrack.getP(), nSigmaBarrelRich[0]); histos.fill(HIST("h2dBarrelNsigmaTrueProtVsMuonHypothesis"), recoTrack.getP(), nSigmaBarrelRich[1]); histos.fill(HIST("h2dBarrelNsigmaTrueProtVsPionHypothesis"), recoTrack.getP(), nSigmaBarrelRich[2]); @@ -982,31 +992,31 @@ struct OnTheFlyRichPid { histos.fill(HIST("h2dBarrelNsigmaTrueProtVsProtHypothesis"), recoTrack.getP(), nSigmaBarrelRich[4]); histos.fill(HIST("h2dBarrelNsigmaTrueProtVsDeutHypothesis"), recoTrack.getP(), nSigmaBarrelRich[5]); break; - case kPdgArray[kDe]: // Deuteron - case -kPdgArray[kDe]: // AntiDeuteron + case kParticlePdgs[kDe]: // Deuteron + case -kParticlePdgs[kDe]: // AntiDeuteron histos.fill(HIST("h2dBarrelNsigmaTrueDeutVsProtHypothesis"), recoTrack.getP(), nSigmaBarrelRich[4]); histos.fill(HIST("h2dBarrelNsigmaTrueDeutVsDeutHypothesis"), recoTrack.getP(), nSigmaBarrelRich[5]); histos.fill(HIST("h2dBarrelNsigmaTrueDeutVsTritHypothesis"), recoTrack.getP(), nSigmaBarrelRich[6]); histos.fill(HIST("h2dBarrelNsigmaTrueDeutVsHe3Hypothesis"), recoTrack.getP(), nSigmaBarrelRich[7]); histos.fill(HIST("h2dBarrelNsigmaTrueDeutVsAlHypothesis"), recoTrack.getP(), nSigmaBarrelRich[8]); break; - case kPdgArray[kTr]: // Triton - case -kPdgArray[kTr]: // AntiTriton + case kParticlePdgs[kTr]: // Triton + case -kParticlePdgs[kTr]: // AntiTriton histos.fill(HIST("h2dBarrelNsigmaTrueTritVsProtHypothesis"), recoTrack.getP(), nSigmaBarrelRich[4]); histos.fill(HIST("h2dBarrelNsigmaTrueTritVsDeutHypothesis"), recoTrack.getP(), nSigmaBarrelRich[5]); histos.fill(HIST("h2dBarrelNsigmaTrueTritVsTritHypothesis"), recoTrack.getP(), nSigmaBarrelRich[6]); histos.fill(HIST("h2dBarrelNsigmaTrueTritVsHe3Hypothesis"), recoTrack.getP(), nSigmaBarrelRich[7]); histos.fill(HIST("h2dBarrelNsigmaTrueTritVsAlHypothesis"), recoTrack.getP(), nSigmaBarrelRich[8]); break; - case kPdgArray[kHe3]: // Helium3 - case -kPdgArray[kHe3]: // AntiHelium3 + case kParticlePdgs[kHe3]: // Helium3 + case -kParticlePdgs[kHe3]: // AntiHelium3 histos.fill(HIST("h2dBarrelNsigmaTrueHe3VsDeutHypothesis"), recoTrack.getP(), nSigmaBarrelRich[5]); histos.fill(HIST("h2dBarrelNsigmaTrueHe3VsTritHypothesis"), recoTrack.getP(), nSigmaBarrelRich[6]); histos.fill(HIST("h2dBarrelNsigmaTrueHe3VsHe3Hypothesis"), recoTrack.getP(), nSigmaBarrelRich[7]); histos.fill(HIST("h2dBarrelNsigmaTrueHe3VsAlHypothesis"), recoTrack.getP(), nSigmaBarrelRich[8]); break; - case kPdgArray[kAl]: // Alpha - case -kPdgArray[kAl]: // AntiAlpha + case kParticlePdgs[kAl]: // Alpha + case -kParticlePdgs[kAl]: // AntiAlpha histos.fill(HIST("h2dBarrelNsigmaTrueAlVsDeutHypothesis"), recoTrack.getP(), nSigmaBarrelRich[5]); histos.fill(HIST("h2dBarrelNsigmaTrueAlVsTritHypothesis"), recoTrack.getP(), nSigmaBarrelRich[6]); histos.fill(HIST("h2dBarrelNsigmaTrueAlVsHe3Hypothesis"), recoTrack.getP(), nSigmaBarrelRich[7]); diff --git a/ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx b/ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx index f1755937566..2b091aae532 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx @@ -42,7 +42,6 @@ #include #include #include -#include #include #include #include @@ -51,6 +50,7 @@ #include #include #include +#include #include #include @@ -583,8 +583,25 @@ struct OnTheFlyTofPid { static std::array expectedTimeInnerTOF, expectedTimeOuterTOF; static std::array deltaTimeInnerTOF, deltaTimeOuterTOF; static std::array nSigmaInnerTOF, nSigmaOuterTOF; - static constexpr int kParticlePdgs[kParticles] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton, o2::constants::physics::kDeuteron, o2::constants::physics::kTriton, o2::constants::physics::kHelium3, o2::constants::physics::kAlpha}; - float masses[kParticles]; + static constexpr int kParticlePdgs[kParticles] = {kElectron, + kMuonMinus, + kPiPlus, + kKPlus, + kProton, + o2::constants::physics::kDeuteron, + o2::constants::physics::kTriton, + o2::constants::physics::kHelium3, + o2::constants::physics::kAlpha}; + static constexpr float kParticleMasses[kParticles] = {o2::constants::physics::MassElectron, + o2::constants::physics::MassMuon, + o2::constants::physics::MassPionCharged, + o2::constants::physics::MassKaonCharged, + o2::constants::physics::MassProton, + o2::constants::physics::MassDeuteron, + o2::constants::physics::MassTriton, + o2::constants::physics::MassHelium3, + o2::constants::physics::MassAlpha}; + static constexpr float kParticleCharges[kParticles] = {1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 2.f, 2.f}; float momentumHypotheses[kParticles]; // Store momentum hypothesis for each particle auto truePdgInfo = pdg->GetParticle(mcParticle.pdgCode()); @@ -616,6 +633,7 @@ struct OnTheFlyTofPid { } } + // For every mass hypothesis compute the expected time, the delta with respect to it and the nsigma for (int ii = 0; ii < kParticles; ii++) { expectedTimeInnerTOF[ii] = -100; expectedTimeOuterTOF[ii] = -100; @@ -624,10 +642,8 @@ struct OnTheFlyTofPid { nSigmaInnerTOF[ii] = -100; nSigmaOuterTOF[ii] = -100; - auto pdgInfoThis = pdg->GetParticle(kParticlePdgs[ii]); - masses[ii] = pdgInfoThis->Mass(); - momentumHypotheses[ii] = rigidity * (std::abs(pdgInfoThis->Charge()) / 3.0f); // Total momentum for this hypothesis - const float v = computeParticleVelocity(momentumHypotheses[ii], masses[ii]); + momentumHypotheses[ii] = rigidity * kParticleCharges[ii]; // Total momentum for this hypothesis + const float v = computeParticleVelocity(momentumHypotheses[ii], kParticleMasses[ii]); expectedTimeInnerTOF[ii] = trackLengthInnerTOF / v; expectedTimeOuterTOF[ii] = trackLengthOuterTOF / v; @@ -639,25 +655,27 @@ struct OnTheFlyTofPid { float innerTotalTimeReso = simConfig.innerTOFTimeReso; float outerTotalTimeReso = simConfig.outerTOFTimeReso; if (simConfig.flagIncludeTrackTimeRes) { - double ptResolution = std::pow(momentumHypotheses[ii] / std::cosh(pseudorapidity), 2) * std::sqrt(trkWithTime.mMomentum.second); + const float transverseMomentum = momentumHypotheses[ii] / std::cosh(pseudorapidity); + double ptResolution = transverseMomentum * transverseMomentum * std::sqrt(trkWithTime.mMomentum.second); double etaResolution = std::fabs(std::sin(2.0 * std::atan(std::exp(-pseudorapidity)))) * std::sqrt(trkWithTime.mPseudorapidity.second); if (simConfig.flagTOFLoadDelphesLUTs) { - ptResolution = mSmearer.getAbsPtRes(pdgInfoThis->PdgCode(), dNdEta, pseudorapidity, momentumHypotheses[ii] / std::cosh(pseudorapidity)); - etaResolution = mSmearer.getAbsEtaRes(pdgInfoThis->PdgCode(), dNdEta, pseudorapidity, momentumHypotheses[ii] / std::cosh(pseudorapidity)); + if (mSmearer.hasTable(kParticlePdgs[ii])) { // Only if the LUT for this particle was loaded + ptResolution = mSmearer.getAbsPtRes(kParticlePdgs[ii], dNdEta, pseudorapidity, transverseMomentum); + etaResolution = mSmearer.getAbsEtaRes(kParticlePdgs[ii], dNdEta, pseudorapidity, transverseMomentum); + } } - float innerTrackTimeReso = calculateTrackTimeResolutionAdvanced(momentumHypotheses[ii] / std::cosh(pseudorapidity), pseudorapidity, ptResolution, etaResolution, masses[ii], simConfig.innerTOFRadius, simConfig.magneticField); - float outerTrackTimeReso = calculateTrackTimeResolutionAdvanced(momentumHypotheses[ii] / std::cosh(pseudorapidity), pseudorapidity, ptResolution, etaResolution, masses[ii], simConfig.outerTOFRadius, simConfig.magneticField); + const float innerTrackTimeReso = calculateTrackTimeResolutionAdvanced(transverseMomentum, pseudorapidity, ptResolution, etaResolution, kParticleMasses[ii], simConfig.innerTOFRadius, simConfig.magneticField); + const float outerTrackTimeReso = calculateTrackTimeResolutionAdvanced(transverseMomentum, pseudorapidity, ptResolution, etaResolution, kParticleMasses[ii], simConfig.outerTOFRadius, simConfig.magneticField); innerTotalTimeReso = std::hypot(simConfig.innerTOFTimeReso, innerTrackTimeReso); outerTotalTimeReso = std::hypot(simConfig.outerTOFTimeReso, outerTrackTimeReso); if (plotsConfig.doQAplots) { - if (std::fabs(mcParticle.pdgCode()) == pdg->GetParticle(kParticlePdgs[ii])->PdgCode()) { + if (std::fabs(mcParticle.pdgCode()) == kParticlePdgs[ii]) { if (trackLengthRecoInnerTOF > 0) { h2dInnerTimeResTrack[ii]->Fill(momentumHypotheses[ii], innerTrackTimeReso); h2dInnerTimeResTotal[ii]->Fill(momentumHypotheses[ii], innerTotalTimeReso); } if (trackLengthRecoOuterTOF > 0) { - const float transverseMomentum = momentumHypotheses[ii] / std::cosh(pseudorapidity); h2dOuterTimeResTrack[ii]->Fill(momentumHypotheses[ii], outerTrackTimeReso); h2dOuterTimeResTotal[ii]->Fill(momentumHypotheses[ii], outerTotalTimeReso); static constexpr int kIdPion = 2; From 1841bff47252e3457de400e045a44473afbf2fe1 Mon Sep 17 00:00:00 2001 From: AlexianL <123153896+AlexianL@users.noreply.github.com> Date: Fri, 17 Oct 2025 09:34:55 +0200 Subject: [PATCH 787/986] [PWGHF] taskFlow.cxx: add FT0C, add cuts, remove MC gen for now (#13359) --- PWGHF/HFC/Tasks/taskFlow.cxx | 1611 +++++++++++++++++++--------------- 1 file changed, 911 insertions(+), 700 deletions(-) diff --git a/PWGHF/HFC/Tasks/taskFlow.cxx b/PWGHF/HFC/Tasks/taskFlow.cxx index 447c615f7b3..0c7fa65cee4 100644 --- a/PWGHF/HFC/Tasks/taskFlow.cxx +++ b/PWGHF/HFC/Tasks/taskFlow.cxx @@ -16,6 +16,7 @@ /// \author Maja Kabus , CERN #include "PWGCF/Core/CorrelationContainer.h" +#include "PWGCF/Core/PairCuts.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" @@ -25,7 +26,6 @@ #include "Common/CCDB/EventSelectionParams.h" #include "Common/Core/RecoDecay.h" #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/McCollisionExtra.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/TrackSelectionTables.h" @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -78,26 +79,26 @@ using namespace o2::constants::math; using namespace o2::framework; using namespace o2::framework::expressions; -enum MftTrackSelectionStep { - NoSelection = 0, - Eta, - Cluster, - NMftTrackSelectionSteps +enum CorrelationCase { + TpcTpc, + TpcMft, + TpcFv0a, + MftFv0a, + TpcFt0a, + MftFt0a, + TpcFt0c, + Ft0aFt0c }; -enum MftTrackAmbiguityStep { - AllMftTracks = 0, - AfterTrackSelection, - NumberOfAmbiguousTracks, - NumberOfNonAmbiguousTracks, - NMftAmbiguitySteps +enum CorrelatedParticles { + ChPartChPart, + D0ChPart, + LcChPart }; -enum MultiplicityEstimators { - MultNTracksPV = 0, - MultNumContrib, - MultFT0C, - MultFT0M +enum DataType { + Data, + Mc }; enum ReassociationMftTracks { @@ -112,36 +113,46 @@ enum EventSelectionStep { NEventSelectionSteps }; -enum DataType { - Data, - Mc +enum FITIndex { + isFT0A = 0, + isFT0C = 1, + isFV0A = 2 }; -// enum EventType { -// SameEvent, -// MixedEvent -// }; +enum MftTrackAmbiguityStep { + AllMftTracks = 0, + AfterTrackSelection, + NumberOfAmbiguousTracks, + NumberOfNonAmbiguousTracks, + NMftAmbiguitySteps +}; -enum CorrelationCase { - TpcTpc, - TpcMft, - TpcFv0a, - MftFv0a, - TpcFt0a, - MftFt0a +enum MftTrackSelectionStep { + NoSelection = 0, + Eta, + Cluster, + Pt, + NMftTrackSelectionSteps }; -enum CorrelatedParticles { - ChPartChPart, - D0ChPart, - LcChPart +enum MultiplicityEstimators { + MultNTracksPV = 0, + MultNumContrib, + MultFT0C, + MultFT0M +}; + +enum TrackSelection { + TrackSelectionNoCut = 0, + TrackSelectionGlobalTrack }; // static constexpr std::string_view whatEventType[] = {"SameEvent/", "MixedEvent/"}; static constexpr std::string_view WhatDataType[] = {"Data/", "MC/"}; -static constexpr std::string_view WhatCorrelationCase[] = {"TpcTpc/", "TpcMft/", "TpcFv0a/", "MftFv0a/", "TpcFt0a/", "MftFt0a/"}; +static constexpr std::string_view WhatCorrelationCase[] = {"TpcTpc/", "TpcMft/", "TpcFv0a/", "MftFv0a/", "TpcFt0a/", "MftFt0a/", "TpcFt0c/", "Ft0aFt0c/"}; static constexpr std::string_view WhatParticles[] = {"ChPartChPart/", "D0ChPart/", "LcChPart/"}; static constexpr std::string_view WhatMultiplicityEstimator[] = {"multNTracksPV", "multNumContrib", "multFT0C", "multFT0M"}; +auto static constexpr kMinFt0cCell = 96; static constexpr TrackSelectionFlags::flagtype TrackSelectionIts = TrackSelectionFlags::kITSNCls | TrackSelectionFlags::kITSChi2NDF | @@ -155,7 +166,7 @@ static constexpr TrackSelectionFlags::flagtype TrackSelectionDca = static constexpr TrackSelectionFlags::flagtype TrackSelectionDcaxyOnly = TrackSelectionFlags::kDCAxy; -// static constexpr float kPairCutDefaults[1][5] = {{-1, -1, -1, -1, -1}}; +static constexpr float PairCutDefaults[1][5] = {{-1, -1, -1, -1, -1}}; struct HfTaskFlow { @@ -169,33 +180,49 @@ struct HfTaskFlow { struct : ConfigurableGroup { std::string prefix = "ConfigTask_group"; - Configurable centralityBinsForMc{"centralityBinsForMc", false, "false = OFF, true = ON for data like multiplicity/centrality bins for MC steps"}; + Configurable centralityBinsForMc{"centralityBinsForMc", false, "falsce = OFF, true = ON for data like multiplicity/centrality bins for MC steps"}; Configurable doHeavyFlavor{"doHeavyFlavor", false, "Flag to know we in the heavy flavor case or not"}; Configurable doReferenceFlow{"doReferenceFlow", false, "Flag to know if reference flow should be done"}; Configurable isReadoutCenter{"isReadoutCenter", false, "Enable Readout Center"}; - // Configurable doTwoTrackCut{"doTwoTrackCut", -1, "Two track cut: -1 = off; >0 otherwise distance value (suggested: 0.02)"}; - Configurable processMc{"processMc", false, "Flag to run on MC"}; Configurable nMixedEvents{"nMixedEvents", 5, "Number of mixed events per event"}; - // Configurable twoTrackCutMinRadius{"twoTrackCutMinRadius", 0.8f, "Two track cut : radius in m from which two tracks cuts are applied"}; } configTask; // configurables for collisions struct : ConfigurableGroup { std::string prefix = "ConfigCollision_group"; + Configurable isApplyGoodItsLayersAll{"isApplyGoodItsLayersAll", false, "Enable GoodITSLayersAll"}; Configurable isApplyGoodZvtxFT0vsPV{"isApplyGoodZvtxFT0vsPV", false, "Enable GoodZvtxFT0vsPV cut"}; Configurable isApplySameBunchPileup{"isApplySameBunchPileup", false, "Enable SameBunchPileup cut"}; + Configurable maxMultiplicity{"maxMultiplicity", 300, "maximum multiplicity selection for collision"}; + Configurable minMultiplicity{"minMultiplicity", 0, "minimum multiplicity selection for collision"}; Configurable multiplicityEstimator{"multiplicityEstimator", 0, "0: multNTracksPV, 1: numContrib, 2: multFT0C, 3: multFT0M, 4: centFT0C, 5: centFT0CVariants1s, 6: centFT0M, 7: centFV0A, 8: centNTracksPV, 9: centNGlobal, 10: centMFT"}; Configurable isApplyNoCollInTimeRangeStrict{"isApplyNoCollInTimeRangeStrict", false, ""}; - Configurable zVertexMax{"zVertexMax", 7.0f, "Accepted z-vertex range"}; + Configurable zVertexMax{"zVertexMax", 10.0f, "Accepted z-vertex range"}; } configCollision; // configurables for central barrel tracks struct : ConfigurableGroup { - std::string prefix = "ConfigCentralTracks_group"; + std::string prefix = "ConfigCentral_group"; + Configurable dcaZCentralTrackMax{"dcaZCentralTrackMax", 0.2f, "max dcaZ of central tracks"}; Configurable etaCentralTrackMax{"etaCentralTrackMax", 0.8f, "max. eta of central tracks"}; + Configurable isApplyConversionCut{"isApplyConversionCut", false, "apply pair conversion cuts"}; + Configurable isApplyTwoTrackCut{"isApplyTwoTrackCut", false, "apply two track cut"}; + Configurable isApplyIndexOrdering{"isApplyIndexOrdering", false, "apply track1.index() <= track2.index() cut"}; + Configurable isApplyPtOrderingSameEvent{"isApplyPtOrderingSameEvent", false, "apply track1.pt() <= track2.pt() cut"}; + Configurable isApplyPtOrderingMixedEvent{"isApplyPtOrderingMixedEvent", false, "apply track1.pt() <= track2.pt() cut"}; + Configurable isApplySameTrackCut{"isApplySameTrackCut", false, "apply track1 == track2 cut"}; + Configurable maxChi2ItsClusters{"maxChi2ItsClusters", 36.f, "max chi2 per ITS clusters"}; + Configurable maxChi2TpcClusters{"maxChi2TpcClusters", 2.5f, "max chi2 per TPC clusters"}; + Configurable maxMergingRadius{"maxMergingRadius", 2.5, "max radius for merging cut"}; + Configurable mergingCut{"mergingCut", 0.02, "merging cut on track merge"}; + Configurable minItsClusters{"minItsClusters", 5.0f, "cut for minimum ITS clusters"}; + Configurable minMergingRadius{"minMergingRadius", 0.8, "max radius for merging cut"}; + Configurable minTpcClusters{"minTpcClusters", 50.0f, "cut for minimum TPC clusters"}; + Configurable minTpcCrossedRows{"minTpcCrossedRows", 70.0f, "cut for minimum TOC crossed rows"}; + Configurable> pairCut{"pairCut", {PairCutDefaults[0], 5, {"Photon", "K0", "Lambda", "Phi", "Rho"}}, "Pair cuts on various particles"}; Configurable ptCentralTrackMin{"ptCentralTrackMin", 0.2f, "min. pT of central tracks"}; Configurable ptCentralTrackMax{"ptCentralTrackMax", 10.0f, "max. pT of central tracks"}; - Configurable dcaZCentralTrackMax{"dcaZCentralTrackMax", 0.2f, "max dcaZ of central tracks"}; + Configurable trackSelectionType{"trackSelectionType", 1, "Track selection: 0 -> kGlobalTrack or isGlobalTrackSDD , 1 -> kGlobalTrack, 2 -> kGlobalTrackWoPtEta, 3 -> kGlobalTrackWoDCA, 4 -> No globalTrack selection"}; } configCentral; // configurables for HF candidates @@ -211,15 +238,21 @@ struct HfTaskFlow { // configurables for MFT tracks struct : ConfigurableGroup { std::string prefix = "ConfigMft_group"; - Configurable etaMftTrackMax{"etaMftTrackMax", -2.4f, "Maximum value for the eta of MFT tracks"}; - Configurable etaMftTrackMin{"etaMftTrackMin", -3.36f, "Minimum value for the eta of MFT tracks"}; - Configurable etaMftTrackMaxFilter{"etaMftTrackMaxFilter", -2.0f, "Maximum value for the eta of MFT tracks"}; - Configurable etaMftTrackMinFilter{"etaMftTrackMinFilter", -3.9f, "Minimum value for the eta of MFT tracks"}; + Configurable cutBestCollisionId{"cutBestCollisionId", 0, "cut on the best collision Id used in a filter"}; + Configurable etaMftTrackMax{"etaMftTrackMax", -2.4f, "Maximum value for the eta of MFT tracks when used in cut function"}; + Configurable etaMftTrackMin{"etaMftTrackMin", -3.36f, "Minimum value for the eta of MFT tracks when used in cut function"}; + Configurable etaMftTrackMaxFilter{"etaMftTrackMaxFilter", -2.0f, "Maximum value for the eta of MFT tracks when used in filter"}; + Configurable etaMftTrackMinFilter{"etaMftTrackMinFilter", -3.9f, "Minimum value for the eta of MFT tracks when used in filter"}; Configurable mftMaxDCAxy{"mftMaxDCAxy", 2.0f, "Cut on dcaXY for MFT tracks"}; Configurable mftMaxDCAz{"mftMaxDCAz", 2.0f, "Cut on dcaZ for MFT tracks"}; Configurable nClustersMftTrack{"nClustersMftTrack", 5, "Minimum number of clusters for the reconstruction of MFT tracks"}; + Configurable ptMftTrackMax{"ptMftTrackMax", 10.0f, "max value of MFT tracks pT when used in cut function"}; + Configurable ptMftTrackMin{"ptMftTrackMin", 0.2f, "min value of MFT tracks pT when used in cut function"}; + Configurable useMftPtCut{"useMftPtCut", false, "if true, use the Mft pt function cut"}; } configMft; + TF1* fPtDepDCAxy = nullptr; + HfHelper hfHelper; SliceCache cache; Service pdg; @@ -240,23 +273,6 @@ struct HfTaskFlow { using FilteredTracksWDcaSel = soa::Filtered>; using FilteredMftTracks = soa::Filtered; - // using FilteredMftTracksWColls = soa::Filtered>; - // using FilteredAndReassociatedMftTracks = soa::Filtered>; - - // ========================= - // using declarations : MONTE CARLO - // ========================= - - using FilteredCollisionsWSelMultMcLabels = soa::Filtered>; - using FilteredMcCollisions = soa::Filtered>; - using HfCandidatesSelD0McRec = soa::Join; - using HfCandidatesSelLcMcRec = soa::Join; - using McParticles = aod::McParticles; - using McParticles2ProngMatched = soa::Join; - using McParticles3ProngMatched = soa::Join; - using MftTracksMcLabels = soa::Join; - using FilteredTracksWDcaSelMC = soa::Filtered>; - // using FilteredMftTracksWCollsMcLabels = soa::Filtered>; // ========================= // Filters & partitions : DATA @@ -274,46 +290,27 @@ struct HfTaskFlow { Filter collisionVtxZFilter = nabs(aod::collision::posZ) < configCollision.zVertexMax; // Central tracks filter - Filter centralTrackEtaPtFilter = (nabs(aod::track::eta) < configCentral.etaCentralTrackMax) && (aod::track::pt > configCentral.ptCentralTrackMin); - Filter centralTrackTpcFilter = ifnode(ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC), - ncheckbit(aod::track::trackCutFlag, TrackSelectionTpc), true); - Filter centralTrackItsFilter = ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) && - ncheckbit(aod::track::trackCutFlag, TrackSelectionIts); - Filter centralTrackDcaFilter = ifnode(configCentral.dcaZCentralTrackMax.node() > 0.f, nabs(aod::track::dcaZ) <= configCentral.dcaZCentralTrackMax && ncheckbit(aod::track::trackCutFlag, TrackSelectionDcaxyOnly), - ncheckbit(aod::track::trackCutFlag, TrackSelectionDca)); + Filter trackFilter = (nabs(aod::track::eta) < configCentral.etaCentralTrackMax) && + (aod::track::pt > configCentral.ptCentralTrackMin) && + (aod::track::pt < configCentral.ptCentralTrackMax) && + requireGlobalTrackInFilter(); - Filter mftTrackFilter = (aod::fwdtrack::eta < configMft.etaMftTrackMaxFilter) && - (aod::fwdtrack::eta > configMft.etaMftTrackMinFilter); + Filter centralTrackItsTpcMatchingFilter = ifnode(ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC), ncheckbit(aod::track::trackCutFlag, TrackSelectionTpc), true) && + ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) && + ncheckbit(aod::track::trackCutFlag, TrackSelectionIts); - // Filters below will be used for uncertainties - Filter mftTrackCollisionIdFilter = (aod::fwdtrack::bestCollisionId >= 0); - Filter mftTrackDcaXYFilter = (nabs(aod::fwdtrack::bestDCAXY) < configMft.mftMaxDCAxy); - // Filter mftTrackDcaZFilter = (nabs(aod::fwdtrack::bestDCAZ) < configMft.mftMaxDCAz); + Filter centralTrackDcaFilter = (ifnode(configCentral.dcaZCentralTrackMax.node() > 0.f, nabs(aod::track::dcaZ) <= configCentral.dcaZCentralTrackMax && ncheckbit(aod::track::trackCutFlag, TrackSelectionDcaxyOnly), ncheckbit(aod::track::trackCutFlag, TrackSelectionDca))); - // ========================= - // Filters & partitions : MC - // ========================= + Filter centralTrackChi2TpcClusterFilter = (aod::track::tpcChi2NCl < configCentral.maxChi2TpcClusters); - Filter candidateFilterD0Mc = (aod::hf_sel_candidate_d0::isRecoHfFlag >= configCandidates.selectionFlagHf) || - (aod::hf_sel_candidate_d0::isRecoHfFlag >= configCandidates.selectionFlagHf); + Filter centralTrackChi2ItsClusterFilter = (aod::track::itsChi2NCl < configCentral.maxChi2ItsClusters); - Filter candidateFilterLcMc = (aod::hf_sel_candidate_lc::isSelLcToPKPi >= configCandidates.selectionFlagHf) || - (aod::hf_sel_candidate_lc::isSelLcToPiKP >= configCandidates.selectionFlagHf); + Filter mftTrackEtaFilter = ((aod::fwdtrack::eta < configMft.etaMftTrackMaxFilter) && (aod::fwdtrack::eta > configMft.etaMftTrackMinFilter)); - // From Katarina's code, but not sure if I use it - Filter mcCollisionFilter = nabs(aod::mccollision::posZ) < configCollision.zVertexMax; - - // Filter mcParticlesFilter = (nabs(aod::mcparticle::eta) < configCentral.etaCentralTrackMax) && - // (aod::mcparticle::pt > configCentral.ptCentralTrackMin); - - // I didn't manage to make partitions work with my mixed event, as I am pair my tracks BEFORE looping over collisions - // I am thus not able to group tracks with sliceBy and can't use this method - // For now I am fine as I am doing only TPC-MFT correlations and using only McParticles with MFT acceptance - // However at some point I will have to use tracks from the other side (FV0, FT0-A) and I will have to do something about it - // TO-DO : either change how I do mixed event, or implement isAcceptedTpcMcParticle, isAcceptedMftMcParticle - // Partition mcParticlesMft = (aod::mcparticle::eta > configMft.etaMftTrackMin) && (aod::mcparticle::eta < configMft.etaMftTrackMax); - // Partition mcParticlesTpc = (nabs(aod::mcparticle::eta) < configCentral.etaCentralTrackMax) && - // (aod::mcparticle::pt > configCentral.ptCentralTrackMin); + // Filters below will be used for uncertainties + Filter mftTrackCollisionIdFilter = (aod::fwdtrack::bestCollisionId >= 0); + Filter mftTrackDcaXYFilter = (nabs(aod::fwdtrack::bestDCAXY) < configMft.mftMaxDCAxy); + // Filter mftTrackDcaZFilter = (nabs(aod::fwdtrack::bestDCAZ) < configMft.mftMaxDCAz); // ========================= // Preslice : DATA @@ -324,34 +321,33 @@ struct HfTaskFlow { Preslice perColMftTracks = o2::aod::fwdtrack::collisionId; Preslice perColTracks = aod::track::collisionId; - // ========================= - // Preslice : MC - // ========================= - - Preslice mftTracksPerCollision = aod::fwdtrack::collisionId; - // configurables for containers // TODO: flow of HF will need to be done vs. invariant mass, in the signal and side-band regions // either 1) add invariant mass axis or 2) define several containers for different inv. mass regions // Note: don't forget to check inv. mass separately for D0 and D0bar candidate - ConfigurableAxis axisMass{"axisMass", {120, 1.5848, 2.1848}, "axis of invariant mass of candidates"}; - ConfigurableAxis binsMixingMultiplicity{"binsMixingMultiplicity", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 100.1}, "multiplicity bins for event mixing"}; - ConfigurableAxis binsMixingVertex{"binsMixingVertex", {14, -7, 7}, "vertex bins for event mixing"}; - ConfigurableAxis axisEtaEfficiency{"axisEtaEfficiency", {20, -1.0, 1.0}, "eta axis for efficiency histograms"}; - ConfigurableAxis axisEtaAssociated{"axisEtaAssociated", {48, -4, -2}, "eta axis for MFT histograms"}; - ConfigurableAxis axisEtaTrigger{"axisEtaTrigger", {48, -1, 1}, "eta axis for TPC histograms"}; - ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -PIHalf, PIHalf * 3}, "delta phi axis for histograms"}; - ConfigurableAxis axisDeltaEta{"axisDeltaEta", {48, -2.4, 2.4}, "delta eta axis for histograms"}; - ConfigurableAxis axisMultiplicity{"axisMultiplicity", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 100.1}, "multiplicity axis for histograms"}; - ConfigurableAxis axisPhi{"axisPhi", {72, 0, TwoPI}, "phi axis for histograms"}; - ConfigurableAxis axisPt{"axisPt", {72, 0, 36}, "pt axis for histograms"}; - ConfigurableAxis axisPtAssoc{"axisPtAssoc", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0}, "pt associated axis for histograms"}; - ConfigurableAxis axisPtEfficiency{"axisPtEfficiency", {VARIABLE_WIDTH, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 2.75, 3.0, 3.25, 3.5, 3.75, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0}, "pt axis for efficiency histograms"}; - ConfigurableAxis axisPtTrigger{"axisPtTrigger", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 8.0}, "pt trigger axis for histograms"}; - ConfigurableAxis axisVertex{"axisVertex", {14, -7, 7}, "vertex axis for histograms"}; - ConfigurableAxis axisVertexEfficiency{"axisVertexEfficiency", {10, -10, 10}, "vertex axis for efficiency histograms"}; + + struct : ConfigurableGroup { + std::string prefix = "ConfigAxis_group"; + ConfigurableAxis axisMass{"axisMass", {120, 1.5848, 2.1848}, "axis of invariant mass of candidates"}; + ConfigurableAxis binsMixingMultiplicity{"binsMixingMultiplicity", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 100.1}, "multiplicity bins for event mixing"}; + ConfigurableAxis binsMixingVertex{"binsMixingVertex", {14, -7, 7}, "vertex bins for event mixing"}; + ConfigurableAxis axisEtaEfficiency{"axisEtaEfficiency", {20, -1.0, 1.0}, "eta axis for efficiency histograms"}; + ConfigurableAxis axisEtaAssociated{"axisEtaAssociated", {48, -4, -2}, "eta axis for MFT histograms"}; + ConfigurableAxis axisEtaTrigger{"axisEtaTrigger", {48, -1, 1}, "eta axis for TPC histograms"}; + ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -PIHalf, PIHalf * 3}, "delta phi axis for histograms"}; + ConfigurableAxis axisDeltaEta{"axisDeltaEta", {48, -2.4, 2.4}, "delta eta axis for histograms"}; + ConfigurableAxis axisMultiplicity{"axisMultiplicity", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 100.1}, "multiplicity axis for histograms"}; + ConfigurableAxis axisPhi{"axisPhi", {72, 0, TwoPI}, "phi axis for histograms"}; + ConfigurableAxis axisPt{"axisPt", {72, 0, 36}, "pt axis for histograms"}; + ConfigurableAxis axisPtAssoc{"axisPtAssoc", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0}, "pt associated axis for histograms"}; + ConfigurableAxis axisPtEfficiency{"axisPtEfficiency", {VARIABLE_WIDTH, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 2.75, 3.0, 3.25, 3.5, 3.75, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0}, "pt axis for efficiency histograms"}; + ConfigurableAxis axisPtTrigger{"axisPtTrigger", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 8.0}, "pt trigger axis for histograms"}; + ConfigurableAxis axisVertex{"axisVertex", {14, -7, 7}, "vertex axis for histograms"}; + ConfigurableAxis axisVertexEfficiency{"axisVertexEfficiency", {10, -10, 10}, "vertex axis for efficiency histograms"}; + } configAxis; HistogramRegistry registry{"registry"}; + PairCuts mPairCuts; // Correlation containers used for data OutputObj sameEvent{"sameEvent"}; @@ -366,14 +362,55 @@ struct HfTaskFlow { template void addHistograms() { - registry.add(Form("%s%s%shEtaTrigger", WhatDataType[DataType].data(), WhatCorrelationCase[CorrelationCase].data(), WhatParticles[CorrelatedParticles].data()), "", {HistType::kTH1D, {axisEtaTrigger}}); - registry.add(Form("%s%s%shPhiTrigger", WhatDataType[DataType].data(), WhatCorrelationCase[CorrelationCase].data(), WhatParticles[CorrelatedParticles].data()), "", {HistType::kTH1D, {axisPhi}}); - registry.add(Form("%s%s%shPtTrigger", WhatDataType[DataType].data(), WhatCorrelationCase[CorrelationCase].data(), WhatParticles[CorrelatedParticles].data()), "", {HistType::kTH1D, {axisPt}}); - registry.add(Form("%s%s%shYieldsTrigger", WhatDataType[DataType].data(), WhatCorrelationCase[CorrelationCase].data(), WhatParticles[CorrelatedParticles].data()), "", {HistType::kTH3F, {axisMultiplicity, axisPt, axisEtaTrigger}}); - registry.add(Form("%s%s%shEtaPhiTrigger", WhatDataType[DataType].data(), WhatCorrelationCase[CorrelationCase].data(), WhatParticles[CorrelatedParticles].data()), "", {HistType::kTH3F, {axisMultiplicity, axisEtaTrigger, axisPhi}}); - registry.add(Form("%s%s%shEtaAssociated", WhatDataType[DataType].data(), WhatCorrelationCase[CorrelationCase].data(), WhatParticles[CorrelatedParticles].data()), "", {HistType::kTH1D, {axisEtaAssociated}}); - registry.add(Form("%s%s%shPhiAssociated", WhatDataType[DataType].data(), WhatCorrelationCase[CorrelationCase].data(), WhatParticles[CorrelatedParticles].data()), "", {HistType::kTH1D, {axisPhi}}); - registry.add(Form("%s%s%shEtaPhiAssociated", WhatDataType[DataType].data(), WhatCorrelationCase[CorrelationCase].data(), WhatParticles[CorrelatedParticles].data()), "", {HistType::kTH3F, {axisMultiplicity, axisEtaAssociated, axisPhi}}); + registry.add(Form("%s%s%shEtaTrigger", WhatDataType[DataType].data(), WhatCorrelationCase[CorrelationCase].data(), WhatParticles[CorrelatedParticles].data()), "", {HistType::kTH1D, {configAxis.axisEtaTrigger}}); + registry.add(Form("%s%s%shPhiTrigger", WhatDataType[DataType].data(), WhatCorrelationCase[CorrelationCase].data(), WhatParticles[CorrelatedParticles].data()), "", {HistType::kTH1D, {configAxis.axisPhi}}); + registry.add(Form("%s%s%shPtTrigger", WhatDataType[DataType].data(), WhatCorrelationCase[CorrelationCase].data(), WhatParticles[CorrelatedParticles].data()), "", {HistType::kTH1D, {configAxis.axisPt}}); + registry.add(Form("%s%s%shYieldsTrigger", WhatDataType[DataType].data(), WhatCorrelationCase[CorrelationCase].data(), WhatParticles[CorrelatedParticles].data()), "", {HistType::kTH3F, {configAxis.axisMultiplicity, configAxis.axisPt, configAxis.axisEtaTrigger}}); + registry.add(Form("%s%s%shEtaPhiTrigger", WhatDataType[DataType].data(), WhatCorrelationCase[CorrelationCase].data(), WhatParticles[CorrelatedParticles].data()), "", {HistType::kTH3F, {configAxis.axisMultiplicity, configAxis.axisEtaTrigger, configAxis.axisPhi}}); + registry.add(Form("%s%s%shEtaAssociated", WhatDataType[DataType].data(), WhatCorrelationCase[CorrelationCase].data(), WhatParticles[CorrelatedParticles].data()), "", {HistType::kTH1D, {configAxis.axisEtaAssociated}}); + registry.add(Form("%s%s%shPhiAssociated", WhatDataType[DataType].data(), WhatCorrelationCase[CorrelationCase].data(), WhatParticles[CorrelatedParticles].data()), "", {HistType::kTH1D, {configAxis.axisPhi}}); + registry.add(Form("%s%s%shEtaPhiAssociated", WhatDataType[DataType].data(), WhatCorrelationCase[CorrelationCase].data(), WhatParticles[CorrelatedParticles].data()), "", {HistType::kTH3F, {configAxis.axisMultiplicity, configAxis.axisEtaAssociated, configAxis.axisPhi}}); + } + + void addMftHistograms() + { + registry.add("Data/Mft/hAmbiguityOfMftTracks", "hAmbiguityOfMftTracks", {HistType::kTH1D, {{MftTrackAmbiguityStep::NMftAmbiguitySteps, -0.5, +MftTrackAmbiguityStep::NMftAmbiguitySteps - 0.5}}}); + std::string labelsAmbiguityOfMftTracks[MftTrackAmbiguityStep::NMftAmbiguitySteps]; + labelsAmbiguityOfMftTracks[MftTrackAmbiguityStep::AllMftTracks] = "all MFT tracks"; + labelsAmbiguityOfMftTracks[MftTrackAmbiguityStep::AfterTrackSelection] = "MFT tracks after selection"; + labelsAmbiguityOfMftTracks[MftTrackAmbiguityStep::NumberOfAmbiguousTracks] = "how much tracks are ambigous"; + labelsAmbiguityOfMftTracks[MftTrackAmbiguityStep::NumberOfNonAmbiguousTracks] = "how much tracks are non-ambiguous"; + registry.get(HIST("Data/Mft/hAmbiguityOfMftTracks"))->SetMinimum(0); + + for (int iBin = 0; iBin < MftTrackAmbiguityStep::NMftAmbiguitySteps; iBin++) { + registry.get(HIST("Data/Mft/hAmbiguityOfMftTracks"))->GetXaxis()->SetBinLabel(iBin + 1, labelsAmbiguityOfMftTracks[iBin].data()); + } + + registry.add("Data/Mft/hMftTracksSelection", "hMftTracksSelection", {HistType::kTH1D, {{MftTrackSelectionStep::NMftTrackSelectionSteps, -0.5, +MftTrackSelectionStep::NMftTrackSelectionSteps - 0.5}}}); + std::string labelsMftTracksSelection[MftTrackSelectionStep::NMftTrackSelectionSteps]; + labelsMftTracksSelection[MftTrackSelectionStep::NoSelection] = "all MFT tracks"; + labelsMftTracksSelection[MftTrackSelectionStep::Eta] = "MFT tracks after eta selection"; + labelsMftTracksSelection[MftTrackSelectionStep::Cluster] = "MFT tracks after clusters selection"; + labelsMftTracksSelection[MftTrackSelectionStep::Pt] = "MFT tracks after pT selection"; + registry.get(HIST("Data/Mft/hMftTracksSelection"))->SetMinimum(0); + + for (int iBin = 0; iBin < MftTrackSelectionStep::NMftTrackSelectionSteps; iBin++) { + registry.get(HIST("Data/Mft/hMftTracksSelection"))->GetXaxis()->SetBinLabel(iBin + 1, labelsMftTracksSelection[iBin].data()); + } + + registry.add("Data/Mft/hReassociationMftTracks", "hReassociationMftTracks", {HistType::kTH1D, {{ReassociationMftTracks::NReassociationMftTracksSteps, -0.5, +ReassociationMftTracks::NReassociationMftTracksSteps - 0.5}}}); + std::string labelsReassociationMftTracks[ReassociationMftTracks::NReassociationMftTracksSteps]; + labelsReassociationMftTracks[ReassociationMftTracks::NotReassociatedMftTracks] = "Ambiguous MFT tracks after track selection"; + labelsReassociationMftTracks[ReassociationMftTracks::ReassociatedMftTracks] = "Reassociated MFT tracks by DCAxy method"; + registry.get(HIST("Data/Mft/hReassociationMftTracks"))->SetMinimum(0); + + for (int iBin = 0; iBin < ReassociationMftTracks::NReassociationMftTracksSteps; iBin++) { + registry.get(HIST("Data/Mft/hReassociationMftTracks"))->GetXaxis()->SetBinLabel(iBin + 1, labelsReassociationMftTracks[iBin].data()); + } + + registry.add("Data/Mft/hPtMft", "", {HistType::kTH1D, {configAxis.axisPt}}); + registry.add("Data/Mft/hNMftTracks", "", {HistType::kTH1F, {configAxis.axisMultiplicity}}); + registry.add("Data/Mft/hNBestCollisionFwd", "", {HistType::kTH1F, {configAxis.axisMultiplicity}}); } // ========================= @@ -394,12 +431,15 @@ struct HfTaskFlow { LOGF(info, "Offset for FV0-left: x = %.3f y = %.3f z = %.3f\n", (*offsetFV0)[0].getX(), (*offsetFV0)[0].getY(), (*offsetFV0)[0].getZ()); LOGF(info, "Offset for FV0-right: x = %.3f y = %.3f z = %.3f\n", (*offsetFV0)[1].getX(), (*offsetFV0)[1].getY(), (*offsetFV0)[1].getZ()); + fv0Det = o2::fv0::Geometry::instance(o2::fv0::Geometry::eUninitialized); + // ========================= // Event histograms // ========================= - registry.add("Data/hVtxZ", "v_{z} (cm)", {HistType::kTH1D, {axisVertex}}); - registry.add(Form("Data/hMultiplicity_%s", WhatMultiplicityEstimator[configCollision.multiplicityEstimator].data()), "", {HistType::kTH1D, {axisMultiplicity}}); + registry.add("Data/hVtxZ", "v_{z} (cm)", {HistType::kTH1D, {configAxis.axisVertex}}); + registry.add("Data/hNTracks", "", {HistType::kTH1F, {configAxis.axisMultiplicity}}); + registry.add(Form("Data/hMultiplicity_%s", WhatMultiplicityEstimator[configCollision.multiplicityEstimator].data()), "", {HistType::kTH1D, {configAxis.axisMultiplicity}}); registry.add("Data/hEventCounter", "hEventCounter", {HistType::kTH1D, {{EventSelectionStep::NEventSelectionSteps, -0.5, +EventSelectionStep::NEventSelectionSteps - 0.5}}}); std::string labels[EventSelectionStep::NEventSelectionSteps]; @@ -411,59 +451,29 @@ struct HfTaskFlow { registry.get(HIST("Data/hEventCounter"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data()); } - registry.add("Data/Mft/hAmbiguityOfMftTracks", "hAmbiguityOfMftTracks", {HistType::kTH1D, {{MftTrackAmbiguityStep::NMftAmbiguitySteps, -0.5, +MftTrackAmbiguityStep::NMftAmbiguitySteps - 0.5}}}); - std::string labelsAmbiguityOfMftTracks[MftTrackAmbiguityStep::NMftAmbiguitySteps]; - labelsAmbiguityOfMftTracks[MftTrackAmbiguityStep::AllMftTracks] = "all MFT tracks"; - labelsAmbiguityOfMftTracks[MftTrackAmbiguityStep::AfterTrackSelection] = "MFT tracks after selection"; - labelsAmbiguityOfMftTracks[MftTrackAmbiguityStep::NumberOfAmbiguousTracks] = "how much tracks are ambigous"; - labelsAmbiguityOfMftTracks[MftTrackAmbiguityStep::NumberOfNonAmbiguousTracks] = "how much tracks are non-ambiguous"; - registry.get(HIST("Data/Mft/hAmbiguityOfMftTracks"))->SetMinimum(0); - - for (int iBin = 0; iBin < MftTrackAmbiguityStep::NMftAmbiguitySteps; iBin++) { - registry.get(HIST("Data/Mft/hAmbiguityOfMftTracks"))->GetXaxis()->SetBinLabel(iBin + 1, labelsAmbiguityOfMftTracks[iBin].data()); - } - - registry.add("Data/Mft/hMftTracksSelection", "hMftTracksSelection", {HistType::kTH1D, {{MftTrackSelectionStep::NMftTrackSelectionSteps, -0.5, +MftTrackSelectionStep::NMftTrackSelectionSteps - 0.5}}}); - std::string labelsMftTracksSelection[MftTrackSelectionStep::NMftTrackSelectionSteps]; - labelsMftTracksSelection[MftTrackSelectionStep::NoSelection] = "all MFT tracks"; - labelsMftTracksSelection[MftTrackSelectionStep::Eta] = "MFT tracks after eta selection"; - labelsMftTracksSelection[MftTrackSelectionStep::Cluster] = "MFT tracks after clusters selection"; - registry.get(HIST("Data/Mft/hMftTracksSelection"))->SetMinimum(0); - - for (int iBin = 0; iBin < MftTrackSelectionStep::NMftTrackSelectionSteps; iBin++) { - registry.get(HIST("Data/Mft/hMftTracksSelection"))->GetXaxis()->SetBinLabel(iBin + 1, labelsMftTracksSelection[iBin].data()); - } - - registry.add("Data/Mft/hReassociationMftTracks", "hReassociationMftTracks", {HistType::kTH1D, {{ReassociationMftTracks::NReassociationMftTracksSteps, -0.5, +ReassociationMftTracks::NReassociationMftTracksSteps - 0.5}}}); - std::string labelsReassociationMftTracks[ReassociationMftTracks::NReassociationMftTracksSteps]; - labelsReassociationMftTracks[ReassociationMftTracks::NotReassociatedMftTracks] = "MFT tracks after track selection"; - labelsReassociationMftTracks[ReassociationMftTracks::ReassociatedMftTracks] = "Reassociated MFT tracks by DCAxy method"; - registry.get(HIST("Data/Mft/hReassociationMftTracks"))->SetMinimum(0); - - for (int iBin = 0; iBin < ReassociationMftTracks::NReassociationMftTracksSteps; iBin++) { - registry.get(HIST("Data/Mft/hReassociationMftTracks"))->GetXaxis()->SetBinLabel(iBin + 1, labelsReassociationMftTracks[iBin].data()); + mPairCuts.SetHistogramRegistry(®istry); + if (configCentral.pairCut->get("Photon") > 0 || configCentral.pairCut->get("K0") > 0 || configCentral.pairCut->get("Lambda") > 0 || configCentral.pairCut->get("Phi") > 0 || configCentral.pairCut->get("Rho") > 0) { + mPairCuts.SetPairCut(PairCuts::Photon, configCentral.pairCut->get("Photon")); + mPairCuts.SetPairCut(PairCuts::K0, configCentral.pairCut->get("K0")); + mPairCuts.SetPairCut(PairCuts::Lambda, configCentral.pairCut->get("Lambda")); + mPairCuts.SetPairCut(PairCuts::Phi, configCentral.pairCut->get("Phi")); + mPairCuts.SetPairCut(PairCuts::Rho, configCentral.pairCut->get("Rho")); } - registry.add("Data/Mft/hNTracks", "", {HistType::kTH1F, {axisMultiplicity}}); - registry.add("Data/Mft/hNMftTracks", "", {HistType::kTH1F, {axisMultiplicity}}); - registry.add("Data/Mft/hNBestCollisionFwd", "", {HistType::kTH1F, {axisMultiplicity}}); - // ========================= // Declaration of correlation containers and their respective axis // ========================= - std::vector const corrAxis = {{axisDeltaEta, "#Delta#eta"}, - {axisPtAssoc, "p_{T} (GeV/c)"}, - {axisPtTrigger, "p_{T} (GeV/c)"}, - {axisMultiplicity, "multiplicity"}, - {axisDeltaPhi, "#Delta#varphi (rad)"}, - {axisVertex, "z-vtx (cm)"}}; - std::vector const effAxis = {{axisEtaEfficiency, "#eta"}, - {axisPtEfficiency, "p_{T} (GeV/c)"}, - {axisVertexEfficiency, "z-vtx (cm)"}}; - std::vector const userAxis = {{axisMass, "m_{inv} (GeV/c^{2})"}}; - - fv0Det = o2::fv0::Geometry::instance(o2::fv0::Geometry::eUninitialized); + std::vector const corrAxis = {{configAxis.axisDeltaEta, "#Delta#eta"}, + {configAxis.axisPtAssoc, "p_{T} (GeV/c)"}, + {configAxis.axisPtTrigger, "p_{T} (GeV/c)"}, + {configAxis.axisMultiplicity, "multiplicity"}, + {configAxis.axisDeltaPhi, "#Delta#varphi (rad)"}, + {configAxis.axisVertex, "z-vtx (cm)"}}; + std::vector const effAxis = {{configAxis.axisEtaEfficiency, "#eta"}, + {configAxis.axisPtEfficiency, "p_{T} (GeV/c)"}, + {configAxis.axisVertexEfficiency, "z-vtx (cm)"}}; + std::vector const userAxis = {{configAxis.axisMass, "m_{inv} (GeV/c^{2})"}}; // ========================= // Initialization of histograms and CorrelationContainers for TpcTpc cases @@ -494,14 +504,7 @@ struct HfTaskFlow { // if (doprocessSameTpcMftChCh || doprocessSameTpcMftChChReassociated || doprocessSameTpcMftChChReassociated3d || doprocessSameTpcMftChChNonAmbiguous) { if (doprocessSameTpcMftChCh || doprocessSameTpcMftChChReassociated || doprocessSameTpcMftChChNonAmbiguous) { addHistograms(); - - // All MFT tracks - registry.add("Data/Mft/kCFStepAll/hEta", "eta", {HistType::kTH1D, {axisEtaAssociated}}); - registry.add("Data/Mft/kCFStepAll/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); - - // Only non-ambiguous MFT tracks - registry.add("Data/Mft/kCFStepTracked/hEta", "eta", {HistType::kTH1D, {axisEtaAssociated}}); - registry.add("Data/Mft/kCFStepTracked/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); + addMftHistograms(); sameEvent.setObject(new CorrelationContainer("sameEvent", "sameEvent", corrAxis, effAxis, {})); mixedEvent.setObject(new CorrelationContainer("mixedEvent", "mixedEvent", corrAxis, effAxis, {})); @@ -509,14 +512,7 @@ struct HfTaskFlow { if (doprocessSameTpcMftD0Ch || doprocessSameTpcMftD0ChReassociated) { addHistograms(); - - // All MFT tracks - registry.add("Data/Mft/kCFStepAll/hEta", "eta", {HistType::kTH1D, {axisEtaAssociated}}); - registry.add("Data/Mft/kCFStepAll/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); - - // Only non-ambiguous MFT tracks - registry.add("Data/Mft/kCFStepTracked/hEta", "eta", {HistType::kTH1D, {axisEtaAssociated}}); - registry.add("Data/Mft/kCFStepTracked/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); + addMftHistograms(); sameEventHf.setObject(new CorrelationContainer("sameEventHf", "sameEventHf", corrAxis, effAxis, userAxis)); mixedEventHf.setObject(new CorrelationContainer("mixedEventHf", "mixedEventHf", corrAxis, effAxis, userAxis)); @@ -524,14 +520,7 @@ struct HfTaskFlow { if (doprocessSameTpcMftLcCh || doprocessSameTpcMftLcChReassociated) { addHistograms(); - - // All MFT tracks - registry.add("Data/Mft/kCFStepAll/hEta", "eta", {HistType::kTH1D, {axisEtaAssociated}}); - registry.add("Data/Mft/kCFStepAll/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); - - // Only non-ambiguous MFT tracks - registry.add("Data/Mft/kCFStepTracked/hEta", "eta", {HistType::kTH1D, {axisEtaAssociated}}); - registry.add("Data/Mft/kCFStepTracked/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); + addMftHistograms(); sameEventHf.setObject(new CorrelationContainer("sameEventHf", "sameEventHf", corrAxis, effAxis, userAxis)); mixedEventHf.setObject(new CorrelationContainer("mixedEventHf", "mixedEventHf", corrAxis, effAxis, userAxis)); @@ -569,6 +558,7 @@ struct HfTaskFlow { // if (doprocessSameMftFv0aChCh || doprocessSameMftFv0aChChReassociated || doprocessSameMftFv0aReassociated3d || doprocessSameMftFv0aChChNonAmbiguous) { if (doprocessSameMftFv0aChCh || doprocessSameMftFv0aChChReassociated || doprocessSameMftFv0aChChNonAmbiguous) { addHistograms(); + addMftHistograms(); sameEvent.setObject(new CorrelationContainer("sameEvent", "sameEvent", corrAxis, effAxis, {})); mixedEvent.setObject(new CorrelationContainer("mixedEvent", "mixedEvent", corrAxis, effAxis, {})); @@ -605,25 +595,46 @@ struct HfTaskFlow { if (doprocessSameMftFt0aChCh || doprocessSameMftFt0aChChReassociated || doprocessSameMftFt0aChChNonAmbiguous) { addHistograms(); + addMftHistograms(); sameEvent.setObject(new CorrelationContainer("sameEvent", "sameEvent", corrAxis, effAxis, {})); mixedEvent.setObject(new CorrelationContainer("mixedEvent", "mixedEvent", corrAxis, effAxis, {})); } // ========================= - // Initialization of histograms and CorrelationContainers for TpcMft MONTE-CARLO cases + // Initialization of histograms and CorrelationContainers for TpcFt0c cases // ========================= - if (doprocessSameTpcMftD0ChMcGen) { - addHistograms(); - sameEventHfMc.setObject(new CorrelationContainer("sameEventHfMc", "sameEventHfMc", corrAxis, effAxis, userAxis)); - mixedEventHfMc.setObject(new CorrelationContainer("mixedEventHfMc", "mixedEventHfMc", corrAxis, effAxis, userAxis)); + if (doprocessSameTpcFt0cChCh) { + addHistograms(); + + sameEvent.setObject(new CorrelationContainer("sameEvent", "sameEvent", corrAxis, effAxis, {})); + mixedEvent.setObject(new CorrelationContainer("mixedEvent", "mixedEvent", corrAxis, effAxis, {})); } - if (doprocessSameTpcMftLcChMcGen) { - addHistograms(); - sameEventHfMc.setObject(new CorrelationContainer("sameEventHfMc", "sameEventHfMc", corrAxis, effAxis, userAxis)); - mixedEventHfMc.setObject(new CorrelationContainer("mixedEventHfMc", "mixedEventHfMc", corrAxis, effAxis, userAxis)); + if (doprocessSameTpcFt0cD0Ch) { + addHistograms(); + + sameEventHf.setObject(new CorrelationContainer("sameEventHf", "sameEventHf", corrAxis, effAxis, userAxis)); + mixedEventHf.setObject(new CorrelationContainer("mixedEventHf", "mixedEventHf", corrAxis, effAxis, userAxis)); + } + + if (doprocessSameTpcFt0cLcCh) { + addHistograms(); + + sameEventHf.setObject(new CorrelationContainer("sameEventHf", "sameEventHf", corrAxis, effAxis, userAxis)); + mixedEventHf.setObject(new CorrelationContainer("mixedEventHf", "mixedEventHf", corrAxis, effAxis, userAxis)); + } + + // ========================= + // Initialization of histograms and CorrelationContainers for Ft0aFt0c cases + // ========================= + + if (doprocessSameFt0aFt0cChCh) { + addHistograms(); + + sameEvent.setObject(new CorrelationContainer("sameEvent", "sameEvent", corrAxis, effAxis, {})); + mixedEvent.setObject(new CorrelationContainer("mixedEvent", "mixedEvent", corrAxis, effAxis, {})); } } // End of init() function @@ -697,6 +708,45 @@ struct HfTaskFlow { } } + template + float getDPhiStar(TTrack const& track1, TTrackAssoc const& track2, float radius, int magField) + { + float charge1 = track1.sign(); + float charge2 = track2.sign(); + + float phi1 = track1.phi(); + float phi2 = track2.phi(); + + float pt1 = track1.pt(); + float pt2 = track2.pt(); + + int fbSign = (magField > 0) ? 1 : -1; + + float dPhiStar = phi1 - phi2 - charge1 * fbSign * std::asin(0.075 * radius / pt1) + charge2 * fbSign * std::asin(0.075 * radius / pt2); + + if (dPhiStar > constants::math::PI) + dPhiStar = constants::math::TwoPI - dPhiStar; + if (dPhiStar < -constants::math::PI) + dPhiStar = -constants::math::TwoPI - dPhiStar; + + return dPhiStar; + } + + int getMagneticField(uint64_t timestamp) + { + // Get the magnetic field + static o2::parameters::GRPMagField* grpo = nullptr; + if (grpo == nullptr) { + grpo = ccdb->getForTimeStamp("/GLO/Config/GRPMagField", timestamp); + if (grpo == nullptr) { + LOGF(fatal, "GRP object not found for timestamp %llu", timestamp); + return 0; + } + LOGF(info, "Retrieved GRP for timestamp %llu with magnetic field of %d kG", timestamp, grpo->getNominalL3Field()); + } + return grpo->getNominalL3Field(); + } + double getPhiFT0(uint chno, int i) { ft0Det.calculateChannelCenter(); @@ -735,6 +785,9 @@ struct HfTaskFlow { auto x = chPos.X() + (*offsetFT0)[i].getX(); auto y = chPos.Y() + (*offsetFT0)[i].getY(); auto z = chPos.Z() + (*offsetFT0)[i].getZ(); + if (chno >= kMinFt0cCell) { + z = -z; + } auto r = std::sqrt(x * x + y * y); auto theta = std::atan2(r, z); return -std::log(std::tan(0.5 * theta)); @@ -770,6 +823,18 @@ struct HfTaskFlow { return -std::log(std::tan(0.5 * theta)); } + template + void getChannel(TFT0s const& ft0, std::size_t const& iCh, int& id, int fitType) + { + if (fitType == isFT0C) { + id = ft0.channelC()[iCh]; + } else if (fitType == isFT0A) { + id = ft0.channelA()[iCh]; + } else { + LOGF(fatal, "Cor Index %d out of range", fitType); + } + } + // ========================= // Cuts with functions // ========================= @@ -782,23 +847,21 @@ struct HfTaskFlow { registry.fill(HIST("Data/hEventCounter"), EventSelectionStep::AllEvents); } - if (!configTask.processMc) { - if (!collision.sel8()) { - return false; - } + if (!collision.sel8()) { + return false; } - if (configCollision.isApplySameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { return false; } - if (configCollision.isApplyGoodZvtxFT0vsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { return false; } - if (configCollision.isApplyNoCollInTimeRangeStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStrict)) { return false; } + if (configCollision.isApplyGoodItsLayersAll && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + return false; + } if (fillHistograms) { registry.fill(HIST("Data/hEventCounter"), EventSelectionStep::AfterEventSelection); @@ -809,7 +872,21 @@ struct HfTaskFlow { return true; } - // TODO: Check how to put this into a Filter + template + bool isAcceptedCentralTrack(TTrack const& track) + { + if (track.tpcNClsFound() < configCentral.minTpcClusters) { + return false; + } + if (track.tpcNClsCrossedRows() < configCentral.minTpcCrossedRows) { + return false; + } + if (track.itsNCls() < configCentral.minItsClusters) { + return false; + } + return true; + } + template bool isAcceptedCandidate(TTrack const& candidate) { @@ -865,6 +942,15 @@ struct HfTaskFlow { registry.fill(HIST("Data/Mft/hMftTracksSelection"), MftTrackSelectionStep::Cluster); } + // cut on the pT of MFT tracks (for test purposes) + if (configMft.useMftPtCut && (mftTrack.pt() > configMft.ptMftTrackMax || mftTrack.pt() < configMft.ptMftTrackMin)) { + return false; + } + + if (fillHistograms) { + registry.fill(HIST("Data/Mft/hMftTracksSelection"), MftTrackSelectionStep::Pt); + } + return true; } @@ -885,76 +971,6 @@ struct HfTaskFlow { return false; } - // I am not sure if to template McParticles is useful, I'll address this when doing the MC Gen case of HF-h correlations - template - bool isAcceptedMcCandidate(TMcTrack& mcCandidate) - { - auto etaCandidate = mcCandidate.eta(); - - if constexpr (std::is_same_v) { // For now, that means we do D0 - if (std::abs(mcCandidate.flagMcMatchGen()) == 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) { - - if (configCandidates.etaCandidateMax >= 0. && std::abs(etaCandidate) > configCandidates.etaCandidateMax) { - return false; - } - - if (configCandidates.yCandGenMax >= 0. && std::abs(RecoDecay::y(mcCandidate.pVector(), o2::constants::physics::MassD0)) > configCandidates.yCandGenMax) { - return false; - } - - // Later on, if I want to add prompt/non-prompt selection, below is how to select prompt only - // if (!(particle.originMcGen() == RecoDecay::OriginType::Prompt)){ - // return false; - // } - } - } else { // For now, that means we do LambdaC - if (std::abs(mcCandidate.flagMcMatchGen()) == 1 << aod::hf_cand_3prong::DecayType::LcToPKPi) { - - if (configCandidates.etaCandidateMax >= 0. && std::abs(etaCandidate) > configCandidates.etaCandidateMax) { - return false; - } - - if (configCandidates.yCandGenMax >= 0. && std::abs(RecoDecay::y(mcCandidate.pVector(), o2::constants::physics::MassLambdaCPlus)) > configCandidates.yCandGenMax) { - return false; - } - - // Later on, if I want to add prompt/non-prompt selection, below is how to select prompt only - // if (!(particle.originMcGen() == RecoDecay::OriginType::Prompt)){ - // return false; - // } - } - } - - return true; - } - - // I am not sure if to template McParticles is useful, I'll address this when doing the MC Gen case of HF-h correlations - template - bool isAcceptedMftMcParticle(TMcParticle& mcParticle) - { - // remove MC particles with charge = 0 - TParticlePDG* pdgparticle = pdg->GetParticle(mcParticle.pdgCode()); - if (pdgparticle != nullptr) { - if (pdgparticle->Charge() == 0) { - return false; - } - } - - /* - // MC particle has to be primary - if constexpr (step <= CorrelationContainer::kCFStepAnaTopology) { - return mcParticle.isPhysicalPrimary(); - } - */ - - if (mcParticle.eta() > configMft.etaMftTrackMax || mcParticle.eta() < configMft.etaMftTrackMin) { - return false; - } - - // return true; - return mcParticle.isPhysicalPrimary(); - } - // =============================================================================================================================================================================== // =============================================================================================================================================================================== // Correlation functions @@ -968,20 +984,22 @@ struct HfTaskFlow { template void fillCorrelations(TTarget target, CorrelationContainer::CFStep step, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, - float multiplicity, float posZ, bool sameEvent) + float multiplicity, float posZ, bool sameEvent, int magneticField) { auto triggerWeight = 1; auto associatedWeight = 1; - - // To avoid filling associated tracks QA many times - // I fill it only for the first trigger track of the collision - auto loopCounter = 0; + auto loopCounter = 0; // To avoid filling associated tracks QA many times, I fill it only for the first trigger track of the collision // TRIGGER PARTICLE for (const auto& track1 : tracks1) { - loopCounter++; + if constexpr (std::is_same_v) { + if (!isAcceptedCentralTrack(track1)) { + continue; + } + } + float const eta1 = track1.eta(); float const pt1 = track1.pt(); float const phi1 = track1.phi(); @@ -1004,20 +1022,6 @@ struct HfTaskFlow { } } - // Selections for MC GENERATED - if constexpr (std::is_same_v || std::is_same_v) { - // TODO: Check how to put this into a Filter -> Pretty sure it cannot be a filter - if (!isAcceptedMcCandidate(track1)) { - continue; - } - fillingHFcontainer = true; - if constexpr (std::is_same_v) { // If D0 - invmass = o2::constants::physics::MassD0; - } else { // If Lc - invmass = o2::constants::physics::MassLambdaCPlus; - } - } - // fill single-track distributions if (!fillingHFcontainer) { // if not HF-h case target->getTriggerHist()->Fill(step, pt1, multiplicity, posZ, triggerWeight); @@ -1027,31 +1031,34 @@ struct HfTaskFlow { // FILL QA PLOTS for trigger particle if (sameEvent && (step == CorrelationContainer::kCFStepReconstructed)) { - if (!configTask.processMc) { // If DATA - if constexpr (!std::is_same_v) { // IF TPC-TPC case - if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-TPC D0-h - fillTriggerQa(multiplicity, eta1, phi1, pt1); - } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-TPC Lc-h - fillTriggerQa(multiplicity, eta1, phi1, pt1); - } else { // IF NEITHER D0 NOR LC -> TPC-TPC h-h - fillTriggerQa(multiplicity, eta1, phi1, pt1); - } - } else { // IF TPC-MFT case - if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-MFT D0-h - fillTriggerQa(multiplicity, eta1, phi1, pt1); - } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-MFT Lc-h - fillTriggerQa(multiplicity, eta1, phi1, pt1); - } else { // IF NEITHER D0 NOR LC -> TPC-MFT h-h - fillTriggerQa(multiplicity, eta1, phi1, pt1); - } // end of if condition for TPC-TPC or TPC-MFT case + if constexpr (!std::is_same_v) { // IF TPC-TPC case + if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-TPC D0-h + fillTriggerQa(multiplicity, eta1, phi1, pt1); + } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-TPC Lc-h + fillTriggerQa(multiplicity, eta1, phi1, pt1); + } else { // IF NEITHER D0 NOR LC -> TPC-TPC h-h + fillTriggerQa(multiplicity, eta1, phi1, pt1); } - // Maybe I won't need it for MC (first files are way lighter in MC, but also I need to loop over all tracks in MC GEN) + } else { // IF TPC-MFT case + if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-MFT D0-h + fillTriggerQa(multiplicity, eta1, phi1, pt1); + } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-MFT Lc-h + fillTriggerQa(multiplicity, eta1, phi1, pt1); + } else { // IF NEITHER D0 NOR LC -> TPC-MFT h-h + fillTriggerQa(multiplicity, eta1, phi1, pt1); + } // end of if condition for TPC-TPC or TPC-MFT case } } // ASSOCIATED PARTICLE for (const auto& track2 : tracks2) { + if constexpr (std::is_same_v) { + if (!isAcceptedCentralTrack(track2)) { + continue; + } + } + // apply cuts for MFT tracks if constexpr (std::is_same_v) { @@ -1068,14 +1075,53 @@ struct HfTaskFlow { } } - // case of h-h correlations where the two types of tracks are the same - // this avoids autocorrelations and double counting of particle pairs + if (configCentral.isApplySameTrackCut && (track1 == track2)) { + continue; + } + + if (configCentral.isApplyPtOrderingSameEvent && sameEvent && (track1.pt() <= track2.pt())) { + continue; + } + if (configCentral.isApplyPtOrderingMixedEvent && !sameEvent && (track1.pt() <= track2.pt())) { + continue; + } + + if (configCentral.isApplyIndexOrdering && (track1.index() <= track2.index())) { + continue; + } + + // I have to add this condition, because ConversionCut is template to get the same type of tracks for both tracks if constexpr (std::is_same_v) { - if (track1.index() <= track2.index()) { + if (configCentral.isApplyConversionCut && mPairCuts.conversionCuts(track1, track2)) { continue; } } + // I have to add this condition, because PhiStar need track1.sign() + if constexpr (std::is_same_v) { + if (configCentral.isApplyTwoTrackCut && std::abs(eta1 - track2.eta()) < configCentral.mergingCut) { + + double dPhiStarHigh = getDPhiStar(track1, track2, configCentral.maxMergingRadius, magneticField); + double dPhiStarLow = getDPhiStar(track1, track2, configCentral.minMergingRadius, magneticField); + + const double kLimit = 3.0 * configCentral.mergingCut; + + bool bIsBelow = false; + + if (std::abs(dPhiStarLow) < kLimit || std::abs(dPhiStarHigh) < kLimit || dPhiStarLow * dPhiStarHigh < 0) { + for (double rad(configCentral.minMergingRadius); rad < configCentral.maxMergingRadius; rad += 0.01) { + double dPhiStar = getDPhiStar(track1, track2, rad, magneticField); + if (std::abs(dPhiStar) < kLimit) { + bIsBelow = true; + break; + } + } + if (bIsBelow) + continue; + } + } + } + // in case of HF-h correlations, remove candidate daughters from the pool of associated hadrons // with which the candidate is being correlated (will not have to do it for TPC-MFT case) if constexpr (!std::is_same_v) { // if NOT TPC-MFT case -> TPC-TPC case @@ -1091,14 +1137,6 @@ struct HfTaskFlow { } } - // in case of MC-generated, do additional selection on MCparticles : charge and isPhysicalPrimary - // if (configTask.processMc) { - if constexpr (std::is_same_v || std::is_same_v) { - if (!isAcceptedMftMcParticle(track2)) { - continue; - } - } - float const eta2 = track2.eta(); float const pt2 = track2.pt(); float phi2 = track2.phi(); @@ -1106,8 +1144,6 @@ struct HfTaskFlow { // TODO: add getter for NUE associated efficiency here - // TODO: add pair cuts on phi* - float deltaPhi = phi1 - phi2; // set range of delta phi in (-pi/2 , 3/2*pi) deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); @@ -1128,25 +1164,23 @@ struct HfTaskFlow { fillAssociatedQa(multiplicity, eta2, phi2); } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-TPC Lc-h fillAssociatedQa(multiplicity, eta2, phi2); + } else { + fillAssociatedQa(multiplicity, eta2, phi2); } - // No if condition if it is h-h, because it would be the same plots than for the trigger particle } else { // IF TPC-MFT case if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-MFT D0-h fillAssociatedQa(multiplicity, eta2, phi2); + registry.fill(HIST("Data/Mft/hPtMft"), pt2); } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-MFT Lc-h fillAssociatedQa(multiplicity, eta2, phi2); + registry.fill(HIST("Data/Mft/hPtMft"), pt2); } else { // IF NEITHER D0 NOR LC -> TPC-MFT h-h fillAssociatedQa(multiplicity, eta2, phi2); + registry.fill(HIST("Data/Mft/hPtMft"), pt2); } // end of if condition for TPC-TPC or TPC-MFT case } } - if (sameEvent && (loopCounter == 1) && std::is_same_v) { - // FILL USUAL MFT DISTRIBUTIONS - registry.fill(HIST("Data/Mft/kCFStepAll/hEta"), eta2); - registry.fill(HIST("Data/Mft/kCFStepAll/hPhi"), phi2); - } - } // end of loop over tracks2 } // end of loop over tracks 1 } @@ -1158,16 +1192,18 @@ struct HfTaskFlow { { auto triggerWeight = 1; auto associatedWeight = 1; - - // To avoid filling associated tracks QA many times - // I fill it only for the first trigger track of the collision - auto loopCounter = 0; + auto loopCounter = 0; // To avoid filling associated tracks QA many times, I fill it only for the first trigger track of the collision // TRIGGER PARTICLE for (const auto& track1 : tracks1) { - loopCounter++; + if constexpr (std::is_same_v) { + if (!isAcceptedCentralTrack(track1)) { + continue; + } + } + float const eta1 = track1.eta(); float const pt1 = track1.pt(); float const phi1 = track1.phi(); @@ -1194,7 +1230,7 @@ struct HfTaskFlow { } // FILL QA PLOTS for trigger particle - if (sameEvent && (!cutAmbiguousTracks)) { + if (sameEvent && (cutAmbiguousTracks == false)) { if constexpr (std::is_same_v) { fillTriggerQa(multiplicity, eta1, phi1, pt1); } else if constexpr (std::is_same_v) { @@ -1221,13 +1257,15 @@ struct HfTaskFlow { // Fill QA plot for MFT tracks after physical selection (eta + clusters) if (!cutAmbiguousTracks && sameEvent && (loopCounter == 1)) { registry.fill(HIST("Data/Mft/hAmbiguityOfMftTracks"), MftTrackAmbiguityStep::AfterTrackSelection); - registry.fill(HIST("Data/Mft/hReassociationMftTracks"), ReassociationMftTracks::NotReassociatedMftTracks); } // We check if the track is ambiguous or non-ambiguous (QA plots are filled in isAmbiguousMftTrack) // Fill plots only if cutAmbiguousTracks is false (to avoid double counting) if (isAmbiguousMftTrack(track2, (!cutAmbiguousTracks && sameEvent && (loopCounter == 1)))) { // If the MFT track is ambiguous we may cut or not on the ambiguous track + if (sameEvent && (loopCounter == 1)) { + registry.fill(HIST("Data/Mft/hReassociationMftTracks"), ReassociationMftTracks::NotReassociatedMftTracks); + } if (cutAmbiguousTracks) { continue; } @@ -1252,15 +1290,28 @@ struct HfTaskFlow { } } - float const eta2 = reassociatedMftTrack.eta(); - float const pt2 = reassociatedMftTrack.pt(); + if (configCentral.isApplySameTrackCut && (track1 == reassociatedMftTrack)) { + continue; + } + + if (configCentral.isApplyPtOrderingSameEvent && sameEvent && (track1.pt() <= reassociatedMftTrack.pt())) { + continue; + } + if (configCentral.isApplyPtOrderingMixedEvent && !sameEvent && (track1.pt() <= reassociatedMftTrack.pt())) { + continue; + } + + if (configCentral.isApplyIndexOrdering && (track1.index() <= reassociatedMftTrack.index())) { + continue; + } + + float eta2 = reassociatedMftTrack.eta(); + float pt2 = reassociatedMftTrack.pt(); float phi2 = reassociatedMftTrack.phi(); o2::math_utils::bringTo02Pi(phi2); // TODO: add getter for NUE associated efficiency here - // TODO: add pair cuts on phi* - float deltaPhi = phi1 - phi2; // set range of delta phi in (-pi/2 , 3/2*pi) deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); @@ -1277,19 +1328,15 @@ struct HfTaskFlow { if (sameEvent && (loopCounter == 1) && (!cutAmbiguousTracks)) { if constexpr (std::is_same_v) { fillAssociatedQa(multiplicity, eta2, phi2); + registry.fill(HIST("Data/Mft/hPtMft"), pt2); } else if constexpr (std::is_same_v) { fillAssociatedQa(multiplicity, eta2, phi2); + registry.fill(HIST("Data/Mft/hPtMft"), pt2); } else { fillAssociatedQa(multiplicity, eta2, phi2); + registry.fill(HIST("Data/Mft/hPtMft"), pt2); } - } - - // QA plots for basic MFT distributions for non-ambiguous tracks only (kCFStepTracked) - if (cutAmbiguousTracks && sameEvent && (loopCounter == 1)) { - registry.fill(HIST("Data/Mft/kCFStepTracked/hEta"), eta2); - registry.fill(HIST("Data/Mft/kCFStepTracked/hPhi"), phi2); - } - + } // end of fill QA } // end of loop over tracks2 } // end of loop over tracks 1 } @@ -1297,20 +1344,26 @@ struct HfTaskFlow { template void fillCorrelationsFIT(TTarget target, CorrelationContainer::CFStep step, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, TFits const&, - float multiplicity, float posZ, bool sameEvent) + float multiplicity, float posZ, bool sameEvent, int fitType) { auto triggerWeight = 1; auto associatedWeight = 1; - - // To avoid filling associated tracks QA many times - // I fill it only for the first trigger track of the collision - auto loopCounter = 0; + auto loopCounter = 0; // To avoid filling associated tracks QA many times, I fill it only for the first trigger track of the collision // TRIGGER PARTICLE for (auto const& track1 : tracks1) { - loopCounter++; + if constexpr (std::is_same_v) { + if (!isAcceptedCentralTrack(track1)) { + continue; + } + } else if constexpr (std::is_same_v) { + if (!isAcceptedMftTrack(track1, true)) { + continue; + } + } + float const eta1 = track1.eta(); float const pt1 = track1.pt(); float phi1 = track1.phi(); @@ -1341,29 +1394,44 @@ struct HfTaskFlow { // FILL QA PLOTS for trigger particle if (sameEvent && (step == CorrelationContainer::kCFStepReconstructed)) { - if (!configTask.processMc) { // If DATA - if constexpr (!std::is_same_v) { // If not FilteredMftTracks as trigger -> TPC-FV0a correlations - if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-FV0a D0-h - if constexpr (std::is_same_v) { // IF NEITHER D0 NOR LC -> - fillTriggerQa(multiplicity, eta1, phi1, pt1); - } else if constexpr (std::is_same_v) { + if constexpr (!std::is_same_v) { // If not FilteredMftTracks as trigger -> TPC-FV0a correlations + if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-FV0a D0-h + if constexpr (std::is_same_v) { // IF NEITHER D0 NOR LC -> + fillTriggerQa(multiplicity, eta1, phi1, pt1); + } else if constexpr (std::is_same_v) { + if (fitType == isFT0A) { fillTriggerQa(multiplicity, eta1, phi1, pt1); } - } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-FV0a Lc-h - if constexpr (std::is_same_v) { // IF NEITHER D0 NOR LC -> - fillTriggerQa(multiplicity, eta1, phi1, pt1); - } else if constexpr (std::is_same_v) { - fillTriggerQa(multiplicity, eta1, phi1, pt1); + if (fitType == isFT0C) { + fillTriggerQa(multiplicity, eta1, phi1, pt1); } - } else if constexpr (std::is_same_v) { // IF NEITHER D0 NOR LC - - fillTriggerQa(multiplicity, eta1, phi1, pt1); + } + } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-FV0a Lc-h + if constexpr (std::is_same_v) { // IF NEITHER D0 NOR LC -> + fillTriggerQa(multiplicity, eta1, phi1, pt1); } else if constexpr (std::is_same_v) { + if (fitType == isFT0A) { + fillTriggerQa(multiplicity, eta1, phi1, pt1); + } + if (fitType == isFT0C) { + fillTriggerQa(multiplicity, eta1, phi1, pt1); + } + } + } else if constexpr (std::is_same_v) { // IF NEITHER D0 NOR LC - + fillTriggerQa(multiplicity, eta1, phi1, pt1); + } else if constexpr (std::is_same_v) { + if (fitType == isFT0A) { fillTriggerQa(multiplicity, eta1, phi1, pt1); } - } else { // If FilteredMftTracks as trigger - if constexpr (std::is_same_v) { - fillTriggerQa(multiplicity, eta1, phi1, pt1); - } else if constexpr (std::is_same_v) { + if (fitType == isFT0C) { + fillTriggerQa(multiplicity, eta1, phi1, pt1); + } + } + } else { // If FilteredMftTracks as trigger + if constexpr (std::is_same_v) { + fillTriggerQa(multiplicity, eta1, phi1, pt1); + } else if constexpr (std::is_same_v) { + if (fitType == isFT0A) { fillTriggerQa(multiplicity, eta1, phi1, pt1); } } @@ -1375,17 +1443,10 @@ struct HfTaskFlow { for (std::size_t indexChannel = 0; indexChannel < tracks2.channel().size(); indexChannel++) { auto channelId = tracks2.channel()[indexChannel]; - // float fv0Amplitude = tracks2.amplitude()[indexChannel]; - // if (fv0Amplitude <= 0) { - // continue; - // } - auto phi2 = getPhiFV0(channelId); auto eta2 = getEtaFV0(channelId); - float deltaPhi = phi1 - phi2; - // set range of delta phi in (-pi/2 , 3/2*pi) - deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); + deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); // set range of delta phi in (-pi/2 , 3/2*pi) if (!fillingHFcontainer) { target->getPairHist()->Fill(step, eta1 - eta2, pt1, pt1, multiplicity, deltaPhi, posZ, @@ -1414,20 +1475,25 @@ struct HfTaskFlow { // ASSOCIATED PARTICLE IF USING FT0 if constexpr (std::is_same_v) { - for (std::size_t indexChannel = 0; indexChannel < tracks2.channelA().size(); indexChannel++) { - auto channelId = tracks2.channelA()[indexChannel]; - // float fv0Amplitude = tracks2.amplitudeA()[indexChannel]; - // if (fv0Amplitude <= 0) { - // continue; - // } + // select the right channel size if it is FT0a or FT0c + std::size_t channelSize = 0; + if (fitType == isFT0C) { + channelSize = tracks2.channelC().size(); + } else if (fitType == isFT0A) { + channelSize = tracks2.channelA().size(); + } else { + LOGF(fatal, "Cor Index %d out of range", fitType); + } - auto phi2 = getPhiFT0(channelId, 0); - auto eta2 = getEtaFT0(channelId, 0); + for (std::size_t indexChannel = 0; indexChannel < channelSize; indexChannel++) { + int channelId = 0; + getChannel(tracks2, indexChannel, channelId, fitType); + auto phi2 = getPhiFT0(channelId, fitType); + auto eta2 = getEtaFT0(channelId, fitType); float deltaPhi = phi1 - phi2; - // set range of delta phi in (-pi/2 , 3/2*pi) - deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); + deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); // set range of delta phi in (-pi/2 , 3/2*pi) if (!fillingHFcontainer) { target->getPairHist()->Fill(step, eta1 - eta2, pt1, pt1, multiplicity, deltaPhi, posZ, @@ -1441,14 +1507,31 @@ struct HfTaskFlow { if (sameEvent && (loopCounter == 1) && (step == CorrelationContainer::kCFStepReconstructed)) { if constexpr (!std::is_same_v) { // If not FilteredMftTracks as trigger -> TPC-Ft0a correlations if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-FV0a D0-h - fillAssociatedQa(multiplicity, eta2, phi2); + if (fitType == isFT0A) { + fillAssociatedQa(multiplicity, eta2, phi2); + } + if (fitType == isFT0C) { + fillAssociatedQa(multiplicity, eta2, phi2); + } } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-FV0a Lc-h - fillAssociatedQa(multiplicity, eta2, phi2); + if (fitType == isFT0A) { + fillAssociatedQa(multiplicity, eta2, phi2); + } + if (fitType == isFT0C) { + fillAssociatedQa(multiplicity, eta2, phi2); + } } else if constexpr (std::is_same_v) { // IF NEITHER D0 NOR LC -> ch. part. - ch. part - fillAssociatedQa(multiplicity, eta2, phi2); + if (fitType == isFT0A) { + fillAssociatedQa(multiplicity, eta2, phi2); + } + if (fitType == isFT0C) { + fillAssociatedQa(multiplicity, eta2, phi2); + } } } else if constexpr (std::is_same_v) { // If FilteredMftTracks as trigger -> MFT-Ft0a (non reassoc/ambiguous) correlations - fillAssociatedQa(multiplicity, eta2, phi2); + if (fitType == isFT0A) { + fillAssociatedQa(multiplicity, eta2, phi2); + } } } // end of if condition to fill QA plots for associated particle } // end of loop over FT0 channel indices @@ -1459,14 +1542,11 @@ struct HfTaskFlow { template void fillCorrelationsFITReassociatedMftTracks(TTarget target, CorrelationContainer::CFStep step, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, TFits const&, - float multiplicity, float posZ, bool sameEvent, bool cutAmbiguousTracks) + float multiplicity, float posZ, bool sameEvent, bool cutAmbiguousTracks, int fitType) { auto triggerWeight = 1; auto associatedWeight = 1; - - // To avoid filling associated tracks QA many times - // I fill it only for the first trigger track of the collision - auto loopCounter = 0; + auto loopCounter = 0; // To avoid filling associated tracks QA many times, I fill it only for the first trigger track of the collision // TRIGGER PARTICLE for (auto const& track1 : tracks1) { @@ -1474,14 +1554,11 @@ struct HfTaskFlow { auto reassociatedMftTrack = track1.template mfttrack_as(); - if (!isAcceptedMftTrack(reassociatedMftTrack, false)) { + if (!isAcceptedMftTrack(reassociatedMftTrack, true)) { continue; } - // We check if the track is ambiguous or non-ambiguous (QA plots are filled in isAmbiguousMftTrack) - // Fill plots only if cutAmbiguousTracks is false (to avoid double counting) if (isAmbiguousMftTrack(track1, false)) { - // If the MFT track is ambiguous we may cut or not on the ambiguous track if (cutAmbiguousTracks) { continue; } @@ -1499,7 +1576,9 @@ struct HfTaskFlow { if constexpr (std::is_same_v) { fillTriggerQa(multiplicity, eta1, phi1, pt1); } else if constexpr (std::is_same_v) { - fillTriggerQa(multiplicity, eta1, phi1, pt1); + if (fitType == isFT0A) { + fillTriggerQa(multiplicity, eta1, phi1, pt1); + } } } // end of if condition to fill QA plots for trigger particle @@ -1508,17 +1587,11 @@ struct HfTaskFlow { for (std::size_t indexChannel = 0; indexChannel < tracks2.channel().size(); indexChannel++) { auto channelId = tracks2.channel()[indexChannel]; - // float fv0Amplitude = tracks2.amplitude()[indexChannel]; - // if (fv0Amplitude <= 0) { - // continue; - // } - auto phi2 = getPhiFV0(channelId); auto eta2 = getEtaFV0(channelId); float deltaPhi = phi1 - phi2; - // set range of delta phi in (-pi/2 , 3/2*pi) - deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); + deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); // set range of delta phi in (-pi/2 , 3/2*pi) target->getPairHist()->Fill(step, eta1 - eta2, pt1, pt1, multiplicity, deltaPhi, posZ, triggerWeight * associatedWeight); @@ -1532,33 +1605,82 @@ struct HfTaskFlow { // ASSOCIATED PARTICLE FOR FT0s if constexpr (std::is_same_v) { - for (std::size_t indexChannel = 0; indexChannel < tracks2.channelA().size(); indexChannel++) { - auto channelId = tracks2.channelA()[indexChannel]; - // float ft0Amplitude = tracks2.amplitudeA()[indexChannel]; - // if (ft0Amplitude <= 0) { - // continue; - // } + // select the right channel size if it is FT0a or FT0c + std::size_t channelSize = 0; + if (fitType == isFT0C) { + channelSize = tracks2.channelC().size(); + } else if (fitType == isFT0A) { + channelSize = tracks2.channelA().size(); + } else { + LOGF(fatal, "Cor Index %d out of range", fitType); + } - auto phi2 = getPhiFT0(channelId, 0); - auto eta2 = getEtaFT0(channelId, 0); + for (std::size_t indexChannel = 0; indexChannel < channelSize; indexChannel++) { + int channelId = 0; + getChannel(tracks2, indexChannel, channelId, fitType); + auto phi2 = getPhiFT0(channelId, fitType); + auto eta2 = getEtaFT0(channelId, fitType); float deltaPhi = phi1 - phi2; - // set range of delta phi in (-pi/2 , 3/2*pi) - deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); + deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); // set range of delta phi in (-pi/2 , 3/2*pi) target->getPairHist()->Fill(step, eta1 - eta2, pt1, pt1, multiplicity, deltaPhi, posZ, triggerWeight * associatedWeight); // FILL QA PLOTS for associated particle if (sameEvent && (loopCounter == 1) && (step == CorrelationContainer::kCFStepReconstructed)) { - fillAssociatedQa(multiplicity, eta2, phi2); + if (fitType == isFT0A) { + fillAssociatedQa(multiplicity, eta2, phi2); + } } // end of if condition to fill QA plots for associated particle } // end of loop over FT0 channel indices } // end of if condition for FT0s } // end of loop over tracks 1 } + template + void fillCorrelationsFt0aFt0c(TTarget target, CorrelationContainer::CFStep step, + TFT0As const& ft0as, TFT0Cs const& ft0cs, + float multiplicity, float posZ, bool sameEvent) + { + auto triggerWeight = 1; + auto associatedWeight = 1; + auto loopCounter = 0; // To avoid filling associated tracks QA many times, I fill it only for the first trigger track of the collision + + // TRIGGER PARTICLE FROM FT0A + for (std::size_t indexChannelA = 0; indexChannelA < ft0as.channelA().size(); indexChannelA++) { + loopCounter++; + int channelIdA = 0; + getChannel(ft0as, indexChannelA, channelIdA, isFT0A); + auto phiA = getPhiFT0(channelIdA, isFT0A); + auto etaA = getEtaFT0(channelIdA, isFT0A); + + target->getTriggerHist()->Fill(step, 0.f, multiplicity, posZ, triggerWeight); + + if (sameEvent && (step == CorrelationContainer::kCFStepReconstructed)) { + fillTriggerQa(multiplicity, etaA, phiA, 0.f); + } // end of fill trigger QA + + // ASSOCIATED PARTICLE FROM FT0C + for (std::size_t indexChannelC = 0; indexChannelC < ft0cs.channelC().size(); indexChannelC++) { + + int channelIdC = 0; + getChannel(ft0cs, indexChannelC, channelIdC, isFT0C); + auto phiC = getPhiFT0(channelIdC, isFT0C); + auto etaC = getEtaFT0(channelIdC, isFT0C); + float deltaPhi = RecoDecay::constrainAngle(phiA - phiC, -PIHalf); + + target->getPairHist()->Fill(step, etaA - etaC, 0.f, 0.f, multiplicity, deltaPhi, posZ, + triggerWeight * associatedWeight); + + if (sameEvent && (loopCounter == 1) && (step == CorrelationContainer::kCFStepReconstructed)) { + fillAssociatedQa(multiplicity, etaC, phiC); + } // end of fill associated QA + } // end of associated loop + } // end of trigger loop + } // end of fillCorrelationsFt0aFt0c + // =============================================================================================================================================================================== // mixCollisions for RECONSTRUCTED events // =============================================================================================================================================================================== @@ -1566,7 +1688,7 @@ struct HfTaskFlow { template void mixCollisions(TCollisions const& collisions, CorrelationContainer::CFStep step, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, - OutputObj& corrContainer) + OutputObj& corrContainer, aod::BCsWithTimestamps const&) { auto getMultiplicity = [this](FilteredCollisionsWSelMult::iterator const& collision) { auto multiplicity = getMultiplicityEstimator(collision, false); @@ -1576,32 +1698,35 @@ struct HfTaskFlow { // The first one that I call "Data" should work for data and mc rec using BinningTypeData = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getMultiplicity)>; - BinningTypeData const binningWithTracksSize{{getMultiplicity}, {binsMixingVertex, binsMixingMultiplicity}, true}; + BinningTypeData binningWithTracksSize{{getMultiplicity}, {configAxis.binsMixingVertex, configAxis.binsMixingMultiplicity}, true}; auto tracksTuple = std::make_tuple(tracks1, tracks2); - Pair const pair{binningWithTracksSize, configTask.nMixedEvents, -1, collisions, tracksTuple, &cache}; + Pair pair{binningWithTracksSize, configTask.nMixedEvents, -1, collisions, tracksTuple, &cache}; for (const auto& [collision1, tracks1, collision2, tracks2] : pair) { - if constexpr (!std::is_same_v) { // if NOT MC -> do collision cut - if (!(isAcceptedCollision(collision1, false))) { - continue; - } - if (!(isAcceptedCollision(collision2, false))) { - continue; - } + if (!(isAcceptedCollision(collision1, false))) { + continue; + } + if (!(isAcceptedCollision(collision2, false))) { + continue; } + auto bc = collision1.template bc_as(); const auto multiplicity = getMultiplicityEstimator(collision1, false); + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } + corrContainer->fillEvent(multiplicity, step); - fillCorrelations(corrContainer, step, tracks1, tracks2, multiplicity, collision1.posZ(), false); + fillCorrelations(corrContainer, step, tracks1, tracks2, multiplicity, collision1.posZ(), false, getMagneticField(bc.timestamp())); } } template void mixCollisionsFIT(TCollisions const& collisions, CorrelationContainer::CFStep step, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, TPreslice const& preslice, - OutputObj& corrContainer) + OutputObj& corrContainer, int fitType) { auto getMultiplicity = [this](FilteredCollisionsWSelMult::iterator const& collision) { auto multiplicity = getMultiplicityEstimator(collision, false); @@ -1609,7 +1734,7 @@ struct HfTaskFlow { }; using MixedBinning = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getMultiplicity)>; - MixedBinning const binningOnVtxAndMult{{getMultiplicity}, {binsMixingVertex, binsMixingMultiplicity}, true}; + MixedBinning const binningOnVtxAndMult{{getMultiplicity}, {configAxis.binsMixingVertex, configAxis.binsMixingMultiplicity}, true}; for (auto const& [collision1, collision2] : soa::selfCombinations(binningOnVtxAndMult, configTask.nMixedEvents, -1, collisions, collisions)) { @@ -1625,12 +1750,15 @@ struct HfTaskFlow { if (collision1.has_foundFV0() && collision2.has_foundFV0()) { const auto multiplicity = getMultiplicityEstimator(collision1, false); - auto slicedTriggerTracks = tracks1.sliceBy(preslice, collision1.globalIndex()); const auto& fv0 = collision2.foundFV0(); + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } + corrContainer->fillEvent(multiplicity, step); - fillCorrelationsFIT(corrContainer, step, slicedTriggerTracks, fv0, tracks2, multiplicity, collision1.posZ(), false); + fillCorrelationsFIT(corrContainer, step, slicedTriggerTracks, fv0, tracks2, multiplicity, collision1.posZ(), false, fitType); } } // end of if condition for FV0s @@ -1638,74 +1766,53 @@ struct HfTaskFlow { if (collision1.has_foundFT0() && collision2.has_foundFT0()) { const auto multiplicity = getMultiplicityEstimator(collision1, false); - auto slicedTriggerTracks = tracks1.sliceBy(preslice, collision1.globalIndex()); const auto& ft0 = collision2.foundFT0(); corrContainer->fillEvent(multiplicity, step); - fillCorrelationsFIT(corrContainer, step, slicedTriggerTracks, ft0, tracks2, multiplicity, collision1.posZ(), false); + fillCorrelationsFIT(corrContainer, step, slicedTriggerTracks, ft0, tracks2, multiplicity, collision1.posZ(), false, fitType); } - } // end of if condition for FT0s + } // end of if condition for TPC-FT0 or MFT-FT0s } // end of for loop } - /* - template - void mixCollisionsReassociatedMftTracks(TCollisions const& collisions, int step, - TTracksTrig const& tracks1, TTracksAssoc const& tracks2, - TLambda getPartsSize, - OutputObj& corrContainer, - bool cutAmbiguousTracks) + template + void mixCollisionsFt0aFt0c(TCollisions const& collisions, CorrelationContainer::CFStep step, + TFT0as const&, TFT0cs const&, + OutputObj& corrContainer) { + auto getMultiplicity = [this](FilteredCollisionsWSelMult::iterator const& collision) { + auto multiplicity = getMultiplicityEstimator(collision, false); + return multiplicity; + }; - // The first one that I call "Data" should work for data and mc rec - using BinningTypeData = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getPartsSize)>; - - BinningTypeData binningWithTracksSize{{getPartsSize}, {binsMixingVertex, binsMixingMultiplicity}, true}; - auto tracksTuple = std::make_tuple(tracks1, tracks2); - Pair pair{binningWithTracksSize, configTask.nMixedEvents, -1, collisions, tracksTuple, &cache}; + using MixedBinning = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getMultiplicity)>; + MixedBinning const binningOnVtxAndMult{{getMultiplicity}, {configAxis.binsMixingVertex, configAxis.binsMixingMultiplicity}, true}; - for (const auto& [collision1, tracks1, collision2, tracks2] : pair) { + for (auto const& [collision1, collision2] : soa::selfCombinations(binningOnVtxAndMult, configTask.nMixedEvents, -1, collisions, collisions)) { - if constexpr (!std::is_same_v) { // if NOT MC -> do collision cut - if (!(isAcceptedCollision(collision1, false))) { - continue; - } - if (!(isAcceptedCollision(collision2, false))) { - continue; - } + if (!isAcceptedCollision(collision1) || !isAcceptedCollision(collision2)) { + continue; } - const auto multiplicity = collision1.multNTracksPV(); - - corrContainer->fillEvent(multiplicity, step); - fillCorrelationsReassociatedMftTracks(corrContainer, step, tracks1, tracks2, true, multiplicity, collision1.posZ(), false, cutAmbiguousTracks, field ); - } - } - */ - - // =============================================================================================================================================================================== - // mixCollisions for GENERATED events - // =============================================================================================================================================================================== - - template - void mixCollisionsMcTruth(TMcCollisions const& mcCollisions, - TTracksTrig const& tracks1, TTracksAssoc const& tracks2, - TLambda getPartsSize, OutputObj& corrContainer) - { - using BinningTypeMcTruth = FlexibleBinningPolicy, aod::mccollision::PosZ, decltype(getPartsSize)>; + if (collision1.globalIndex() == collision2.globalIndex()) { + continue; + } - BinningTypeMcTruth const binningWithTracksSize{{getPartsSize}, {binsMixingVertex, binsMixingMultiplicity}, true}; - auto tracksTuple = std::make_tuple(tracks1, tracks2); - Pair const pair{binningWithTracksSize, configTask.nMixedEvents, -1, mcCollisions, tracksTuple, &cache}; + if (collision1.has_foundFT0() && collision2.has_foundFT0()) { - for (const auto& [collision1, tracks1, collision2, tracks2] : pair) { + const auto multiplicity = getMultiplicityEstimator(collision1, false); + const auto& ft0as = collision1.foundFT0(); + const auto& ft0cs = collision2.foundFT0(); - const auto multiplicity = collision1.multMCPVz(); + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } - corrContainer->fillEvent(multiplicity, CorrelationContainer::kCFStepAll); - fillCorrelations(corrContainer, CorrelationContainer::CFStep::kCFStepAll, tracks1, tracks2, multiplicity, collision1.posZ(), false); - } + corrContainer->fillEvent(multiplicity, step); + fillCorrelationsFt0aFt0c(corrContainer, step, ft0as, ft0cs, multiplicity, collision1.posZ(), true); + } + } // end of for loop } // =================================================================================================================================================================================================================================================================== @@ -1723,22 +1830,23 @@ struct HfTaskFlow { // ===================================== void processSameTpcTpcChCh(FilteredCollisionsWSelMult::iterator const& collision, - FilteredTracksWDcaSel const& tracks) + FilteredTracksWDcaSel const& tracks, + aod::BCsWithTimestamps const&) { if (!(isAcceptedCollision(collision, true))) { return; } - // the event histograms below are only filled for h-h case - // because there is a possibility of double-filling if more correlation - // options are ran at the same time - // temporary solution, since other correlation options always have to be ran with h-h, too - // TODO: rewrite it in a more intelligent way + registry.fill(HIST("Data/hNTracks"), tracks.size()); + auto bc = collision.template bc_as(); const auto multiplicity = getMultiplicityEstimator(collision, true); - // registry.fill(HIST(Form("Data/hMultiplicity_%s", WhatMultiplicityEstimator[HfTaskFlow::configCollision.multiplicityEstimator].data())), multiplicity); + + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelations(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, tracks, multiplicity, collision.posZ(), true); + fillCorrelations(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, tracks, multiplicity, collision.posZ(), true, getMagneticField(bc.timestamp())); } PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcChCh, "DATA : Process same-event correlations for TPC-TPC h-h case", false); @@ -1748,7 +1856,8 @@ struct HfTaskFlow { void processSameTpcTpcD0Ch(FilteredCollisionsWSelMult::iterator const& collision, FilteredTracksWDcaSel const& tracks, - HfCandidatesSelD0 const& candidates) + HfCandidatesSelD0 const& candidates, + aod::BCsWithTimestamps const&) { auto fillEventSelectionPlots = true; @@ -1761,10 +1870,16 @@ struct HfTaskFlow { return; } + registry.fill(HIST("Data/hNTracks"), tracks.size()); + auto bc = collision.template bc_as(); const auto multiplicity = getMultiplicityEstimator(collision, true); + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } + sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelations(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, tracks, multiplicity, collision.posZ(), true); + fillCorrelations(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, tracks, multiplicity, collision.posZ(), true, getMagneticField(bc.timestamp())); } PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcD0Ch, "DATA : Process same-event correlations for TPC-TPC D0-h case", false); @@ -1774,7 +1889,8 @@ struct HfTaskFlow { void processSameTpcTpcLcCh(FilteredCollisionsWSelMult::iterator const& collision, FilteredTracksWDcaSel const& tracks, - HfCandidatesSelLc const& candidates) + HfCandidatesSelLc const& candidates, + aod::BCsWithTimestamps const&) { auto fillEventSelectionPlots = true; @@ -1787,10 +1903,16 @@ struct HfTaskFlow { return; } + registry.fill(HIST("Data/hNTracks"), tracks.size()); + auto bc = collision.template bc_as(); const auto multiplicity = getMultiplicityEstimator(collision, true); + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } + sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelations(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, tracks, multiplicity, collision.posZ(), true); + fillCorrelations(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, tracks, multiplicity, collision.posZ(), true, getMagneticField(bc.timestamp())); } PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcLcCh, "DATA : Process same-event correlations for TPC-TPC Lc-h case", false); @@ -1800,18 +1922,23 @@ struct HfTaskFlow { void processSameTpcMftChCh(FilteredCollisionsWSelMult::iterator const& collision, FilteredTracksWDcaSel const& tracks, - FilteredMftTracks const& mftTracks) + FilteredMftTracks const& mftTracks, + aod::BCsWithTimestamps const&) { if (!(isAcceptedCollision(collision, true))) { return; } + registry.fill(HIST("Data/hNTracks"), tracks.size()); + auto bc = collision.template bc_as(); const auto multiplicity = getMultiplicityEstimator(collision, true); - // I use kCFStepAll for running my code with all MFTTracks were the reassociation process was not applied - // We don't fill "normal" QA plots with these tracks, only specific plots to compare with other type of MFTTracks + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } + sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelations(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, mftTracks, multiplicity, collision.posZ(), true); + fillCorrelations(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, mftTracks, multiplicity, collision.posZ(), true, getMagneticField(bc.timestamp())); } PROCESS_SWITCH(HfTaskFlow, processSameTpcMftChCh, "DATA : Process same-event correlations for TPC-MFT h-h case", false); @@ -1824,14 +1951,15 @@ struct HfTaskFlow { return; } - registry.fill(HIST("Data/Mft/hNTracks"), tracks.size()); + registry.fill(HIST("Data/hNTracks"), tracks.size()); registry.fill(HIST("Data/Mft/hNMftTracks"), mftTracks.size()); registry.fill(HIST("Data/Mft/hNBestCollisionFwd"), reassociatedMftTracks.size()); - - // const auto multiplicity = collision.multNTracksPV(); const auto multiplicity = getMultiplicityEstimator(collision, true); - // I use the step kCFStepReconstructed for reassociatedMftTracks (most likely the ones we will use in the end) + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } + sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); fillCorrelationsReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, reassociatedMftTracks, multiplicity, collision.posZ(), true, false); } @@ -1847,14 +1975,17 @@ struct HfTaskFlow { return; } - registry.fill(HIST("Data/Mft/hNTracks"), tracks.size()); + registry.fill(HIST("Data/hNTracks"), tracks.size()); registry.fill(HIST("Data/Mft/hNMftTracks"), mftTracks.size()); registry.fill(HIST("Data/Mft/hNBestCollisionFwd"), reassociatedMftTracks.size()); // const auto multiplicity = collision.multNTracksPV(); const auto multiplicity = getMultiplicityEstimator(collision, true); - // I use the step kCFStepReconstructed for reassociatedMftTracks (most likely the ones we will use in the end) + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } + sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); fillCorrelationsReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, reassociatedMftTracks, multiplicity, collision.posZ(), true, false); } @@ -1870,15 +2001,15 @@ struct HfTaskFlow { return; // when process function has iterator } - registry.fill(HIST("Data/Mft/hNTracks"), tracks.size()); + registry.fill(HIST("Data/hNTracks"), tracks.size()); registry.fill(HIST("Data/Mft/hNMftTracks"), mftTracks.size()); registry.fill(HIST("Data/Mft/hNBestCollisionFwd"), reassociatedMftTracks.size()); - const auto multiplicity = getMultiplicityEstimator(collision, true); - // I use kCFStepTracked for running my code with only non-ambiguous MFTTracks - // This is the same as running with reassociatedMftTracks, but applying one more cut in the fillCorrelations function - // We don't fill "normal" QA plots with these tracks, only specific plots to compare with other type of MFTTracks + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } + sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); fillCorrelationsReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, reassociatedMftTracks, multiplicity, collision.posZ(), true, true); } @@ -1891,7 +2022,8 @@ struct HfTaskFlow { void processSameTpcMftD0Ch(FilteredCollisionsWSelMult::iterator const& collision, HfCandidatesSelD0 const& candidates, FilteredTracksWDcaSel const& /*tracks*/, - FilteredMftTracks const& mftTracks) + FilteredMftTracks const& mftTracks, + aod::BCsWithTimestamps const&) { auto fillEventSelectionPlots = true; @@ -1904,10 +2036,15 @@ struct HfTaskFlow { return; } + auto bc = collision.template bc_as(); const auto multiplicity = getMultiplicityEstimator(collision, true); + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } + sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelations(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, mftTracks, multiplicity, collision.posZ(), true); + fillCorrelations(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, mftTracks, multiplicity, collision.posZ(), true, getMagneticField(bc.timestamp())); } PROCESS_SWITCH(HfTaskFlow, processSameTpcMftD0Ch, "DATA : Process same-event correlations for TPC-MFT D0-h case", false); @@ -1922,7 +2059,10 @@ struct HfTaskFlow { const auto multiplicity = getMultiplicityEstimator(collision, true); - // I use the step kCFStepReconstructed for reassociatedMftTracks (most likely the ones we will use in the end) + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } + sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); fillCorrelationsReassociatedMftTracks(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, reassociatedMftTracks, multiplicity, collision.posZ(), true, false); } @@ -1935,7 +2075,8 @@ struct HfTaskFlow { void processSameTpcMftLcCh(FilteredCollisionsWSelMult::iterator const& collision, HfCandidatesSelLc const& candidates, FilteredTracksWDcaSel const& /*tracks*/, - FilteredMftTracks const& mftTracks) + FilteredMftTracks const& mftTracks, + aod::BCsWithTimestamps const&) { auto fillEventSelectionPlots = true; @@ -1948,10 +2089,15 @@ struct HfTaskFlow { return; } + auto bc = collision.template bc_as(); const auto multiplicity = getMultiplicityEstimator(collision, true); + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } + sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelations(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, mftTracks, multiplicity, collision.posZ(), true); + fillCorrelations(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, mftTracks, multiplicity, collision.posZ(), true, getMagneticField(bc.timestamp())); } PROCESS_SWITCH(HfTaskFlow, processSameTpcMftLcCh, "DATA : Process same-event correlations for TPC-MFT Lc-h case", false); @@ -1966,7 +2112,10 @@ struct HfTaskFlow { const auto multiplicity = getMultiplicityEstimator(collision, true); - // I use the step kCFStepReconstructed for reassociatedMftTracks (most likely the ones we will use in the end) + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } + sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); fillCorrelationsReassociatedMftTracks(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, reassociatedMftTracks, multiplicity, collision.posZ(), true, false); } @@ -1984,13 +2133,18 @@ struct HfTaskFlow { return; } - const auto multiplicity = getMultiplicityEstimator(collision, true); - if (collision.has_foundFV0()) { const auto& fv0 = collision.foundFV0(); + registry.fill(HIST("Data/hNTracks"), tracks.size()); + const auto multiplicity = getMultiplicityEstimator(collision, true); + + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } + sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelationsFIT(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, fv0, fv0as, multiplicity, collision.posZ(), true); + fillCorrelationsFIT(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, fv0, fv0as, multiplicity, collision.posZ(), true, isFV0A); } } PROCESS_SWITCH(HfTaskFlow, processSameTpcFv0aChCh, "DATA : Process same-event correlations for TPC-FV0-A h-h case", false); @@ -2007,13 +2161,16 @@ struct HfTaskFlow { return; } - const auto multiplicity = getMultiplicityEstimator(collision, true); - if (collision.has_foundFV0()) { const auto& fv0 = collision.foundFV0(); + const auto multiplicity = getMultiplicityEstimator(collision, true); + + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelationsFIT(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, fv0, fv0as, multiplicity, collision.posZ(), true); + fillCorrelationsFIT(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, fv0, fv0as, multiplicity, collision.posZ(), true, isFV0A); } } PROCESS_SWITCH(HfTaskFlow, processSameTpcFv0aD0Ch, "DATA : Process same-event correlations for TPC-FV0-A D0-h case", false); @@ -2030,13 +2187,16 @@ struct HfTaskFlow { return; } - const auto multiplicity = getMultiplicityEstimator(collision, true); - if (collision.has_foundFV0()) { const auto& fv0 = collision.foundFV0(); + const auto multiplicity = getMultiplicityEstimator(collision, true); + + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelationsFIT(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, fv0, fv0as, multiplicity, collision.posZ(), true); + fillCorrelationsFIT(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, fv0, fv0as, multiplicity, collision.posZ(), true, isFV0A); } } PROCESS_SWITCH(HfTaskFlow, processSameTpcFv0aLcCh, "DATA : Process same-event correlations for TPC-FV0-A Lc-h case", false); @@ -2053,13 +2213,16 @@ struct HfTaskFlow { return; } - const auto multiplicity = getMultiplicityEstimator(collision, true); - if (collision.has_foundFV0()) { const auto& fv0 = collision.foundFV0(); + const auto multiplicity = getMultiplicityEstimator(collision, true); + + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelationsFIT(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, mftTracks, fv0, fv0as, multiplicity, collision.posZ(), true); + fillCorrelationsFIT(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, mftTracks, fv0, fv0as, multiplicity, collision.posZ(), true, isFV0A); } } PROCESS_SWITCH(HfTaskFlow, processSameMftFv0aChCh, "DATA : Process same-event correlations for MFT-FV0-A h-h case", false); @@ -2073,13 +2236,16 @@ struct HfTaskFlow { return; } - const auto multiplicity = getMultiplicityEstimator(collision, true); - if (collision.has_foundFV0()) { const auto& fv0 = collision.foundFV0(); + const auto multiplicity = getMultiplicityEstimator(collision, true); + + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelationsFITReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, reassociatedMftTracks, fv0, fv0as, multiplicity, collision.posZ(), true, false); + fillCorrelationsFITReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, reassociatedMftTracks, fv0, fv0as, multiplicity, collision.posZ(), true, false, isFV0A); } } PROCESS_SWITCH(HfTaskFlow, processSameMftFv0aChChReassociated, "DATA : Process same-event correlations for MFT-FV0a h-h case reassociated", false); @@ -2094,13 +2260,16 @@ struct HfTaskFlow { return; } - const auto multiplicity = getMultiplicityEstimator(collision, true); - if (collision.has_foundFV0()) { const auto& fv0 = collision.foundFV0(); + const auto multiplicity = getMultiplicityEstimator(collision, true); + + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelationsFITReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, reassociatedMftTracks, fv0, fv0as, multiplicity, collision.posZ(), true, false); + fillCorrelationsFITReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, reassociatedMftTracks, fv0, fv0as, multiplicity, collision.posZ(), true, false, isFV0A); } } PROCESS_SWITCH(HfTaskFlow, processSameMftFv0aChChReassociated3d, "DATA : Process same-event correlations for MFT-FV0a h-h case 3d reassociated", false); @@ -2115,13 +2284,16 @@ struct HfTaskFlow { return; } - const auto multiplicity = getMultiplicityEstimator(collision, true); - if (collision.has_foundFV0()) { const auto& fv0 = collision.foundFV0(); + const auto multiplicity = getMultiplicityEstimator(collision, true); + + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelationsFITReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, reassociatedMftTracks, fv0, fv0as, multiplicity, collision.posZ(), true, true); + fillCorrelationsFITReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, reassociatedMftTracks, fv0, fv0as, multiplicity, collision.posZ(), true, true, isFV0A); } } PROCESS_SWITCH(HfTaskFlow, processSameMftFv0aChChNonAmbiguous, "DATA : Process same-event correlations for MFT-FV0a h-h non-ambiguous case", false); @@ -2138,19 +2310,23 @@ struct HfTaskFlow { return; } - const auto multiplicity = getMultiplicityEstimator(collision, true); - if (collision.has_foundFT0()) { const auto& ft0 = collision.foundFT0(); + registry.fill(HIST("Data/hNTracks"), tracks.size()); + const auto multiplicity = getMultiplicityEstimator(collision, true); + + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelationsFIT(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, ft0, ft0as, multiplicity, collision.posZ(), true); + fillCorrelationsFIT(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, ft0, ft0as, multiplicity, collision.posZ(), true, isFT0A); } } PROCESS_SWITCH(HfTaskFlow, processSameTpcFt0aChCh, "DATA : Process same-event correlations for TPC-FT0-A h-h case", false); // ===================================== - // DATA : process same event correlations: TPC-FT0A Ch. Part. - Ch. Part + // DATA : process same event correlations: TPC-FT0A D0 - Ch. Part // ===================================== void processSameTpcFt0aD0Ch(FilteredCollisionsWSelMult::iterator const& collision, @@ -2161,19 +2337,22 @@ struct HfTaskFlow { return; } - const auto multiplicity = getMultiplicityEstimator(collision, true); - if (collision.has_foundFT0()) { const auto& ft0 = collision.foundFT0(); + const auto multiplicity = getMultiplicityEstimator(collision, true); + + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelationsFIT(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, ft0, ft0as, multiplicity, collision.posZ(), true); + fillCorrelationsFIT(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, ft0, ft0as, multiplicity, collision.posZ(), true, isFT0A); } } PROCESS_SWITCH(HfTaskFlow, processSameTpcFt0aD0Ch, "DATA : Process same-event correlations for TPC-FT0-A D0-h case", false); // ===================================== - // DATA : process same event correlations: TPC-FT0A Ch. Part. - Ch. Part + // DATA : process same event correlations: TPC-FT0A Lc - Ch. Part // ===================================== void processSameTpcFt0aLcCh(FilteredCollisionsWSelMult::iterator const& collision, @@ -2184,13 +2363,16 @@ struct HfTaskFlow { return; } - const auto multiplicity = getMultiplicityEstimator(collision, true); - if (collision.has_foundFT0()) { const auto& ft0 = collision.foundFT0(); + const auto multiplicity = getMultiplicityEstimator(collision, true); + + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelationsFIT(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, ft0, ft0as, multiplicity, collision.posZ(), true); + fillCorrelationsFIT(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, ft0, ft0as, multiplicity, collision.posZ(), true, isFT0A); } } PROCESS_SWITCH(HfTaskFlow, processSameTpcFt0aLcCh, "DATA : Process same-event correlations for TPC-FT0-A Lc-h case", false); @@ -2207,13 +2389,16 @@ struct HfTaskFlow { return; } - const auto multiplicity = getMultiplicityEstimator(collision, true); - if (collision.has_foundFT0()) { const auto& ft0 = collision.foundFT0(); + const auto multiplicity = getMultiplicityEstimator(collision, true); + + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelationsFIT(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, mftTracks, ft0, ft0as, multiplicity, collision.posZ(), true); + fillCorrelationsFIT(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, mftTracks, ft0, ft0as, multiplicity, collision.posZ(), true, isFT0A); } } PROCESS_SWITCH(HfTaskFlow, processSameMftFt0aChCh, "DATA : Process same-event correlations for MFT-FT0-A h-h case", false); @@ -2227,13 +2412,16 @@ struct HfTaskFlow { return; } - const auto multiplicity = getMultiplicityEstimator(collision, true); - if (collision.has_foundFT0()) { const auto& ft0 = collision.foundFT0(); + const auto multiplicity = getMultiplicityEstimator(collision, true); + + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelationsFITReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, reassociatedMftTracks, ft0, ft0as, multiplicity, collision.posZ(), true, false); + fillCorrelationsFITReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, reassociatedMftTracks, ft0, ft0as, multiplicity, collision.posZ(), true, false, isFT0A); } } PROCESS_SWITCH(HfTaskFlow, processSameMftFt0aChChReassociated, "DATA : Process same-event correlations for MFT-FT0-A h-h case reassociated", false); @@ -2247,54 +2435,123 @@ struct HfTaskFlow { return; } - const auto multiplicity = getMultiplicityEstimator(collision, true); - if (collision.has_foundFT0()) { const auto& ft0 = collision.foundFT0(); + const auto multiplicity = getMultiplicityEstimator(collision, true); + + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelationsFITReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, reassociatedMftTracks, ft0, ft0as, multiplicity, collision.posZ(), true, true); + fillCorrelationsFITReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, reassociatedMftTracks, ft0, ft0as, multiplicity, collision.posZ(), true, true, isFT0A); } } PROCESS_SWITCH(HfTaskFlow, processSameMftFt0aChChNonAmbiguous, "DATA : Process same-event correlations for MFT-FT0-A h-h case non ambiguous", false); - // =================================================================================================================================================================================================================================================================== - // MONTE-CARLO - // =================================================================================================================================================================================================================================================================== + // ===================================== + // DATA : process same event correlations: TPC-FT0C Ch. Part. - Ch. Part + // ===================================== + + void processSameTpcFt0cChCh(FilteredCollisionsWSelMult::iterator const& collision, + FilteredTracksWDcaSel const& tracks, + aod::FT0s const& ft0cs) + { + if (!(isAcceptedCollision(collision, true))) { + return; + } + + if (collision.has_foundFT0()) { + const auto& ft0 = collision.foundFT0(); + registry.fill(HIST("Data/hNTracks"), tracks.size()); + const auto multiplicity = getMultiplicityEstimator(collision, true); + + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } + + sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelationsFIT(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, ft0, ft0cs, multiplicity, collision.posZ(), true, isFT0C); + } + } + PROCESS_SWITCH(HfTaskFlow, processSameTpcFt0cChCh, "DATA : Process same-event correlations for TPC-FT0C h-h case", false); + + // ===================================== + // DATA : process same event correlations: TPC-FT0C D0 - Ch. Part + // ===================================== + + void processSameTpcFt0cD0Ch(FilteredCollisionsWSelMult::iterator const& collision, + HfCandidatesSelD0 const& candidates, + aod::FT0s const& ft0cs) + { + if (!(isAcceptedCollision(collision, true))) { + return; + } + + if (collision.has_foundFT0()) { + const auto& ft0 = collision.foundFT0(); + const auto multiplicity = getMultiplicityEstimator(collision, true); + + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } + + sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelationsFIT(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, ft0, ft0cs, multiplicity, collision.posZ(), true, isFT0C); + } + } + PROCESS_SWITCH(HfTaskFlow, processSameTpcFt0cD0Ch, "DATA : Process same-event correlations for TPC-FT0C D0-h case", false); // ===================================== - // MONTE-CARLO GENERATED : process same event correlations : TPC-MFT D0-ch. part. case + // DATA : process same event correlations: TPC-FT0C D0 - Ch. Part // ===================================== - void processSameTpcMftD0ChMcGen(FilteredMcCollisions::iterator const& mcCollision, - McParticles2ProngMatched const& mcParticles2Prong, - McParticles const& mcParticles) + void processSameTpcFt0cLcCh(FilteredCollisionsWSelMult::iterator const& collision, + HfCandidatesSelLc const& candidates, + aod::FT0s const& ft0cs) { - const auto multiplicity = mcCollision.multMCPVz(); + if (!(isAcceptedCollision(collision, true))) { + return; + } + + if (collision.has_foundFT0()) { + const auto& ft0 = collision.foundFT0(); + const auto multiplicity = getMultiplicityEstimator(collision, true); - BinningPolicyBase<2> const baseBinning{{axisVertex, axisMultiplicity}, true}; + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } - sameEventHfMc->fillEvent(multiplicity, CorrelationContainer::kCFStepAll); - fillCorrelations(sameEventHfMc, CorrelationContainer::CFStep::kCFStepAll, mcParticles2Prong, mcParticles, multiplicity, mcCollision.posZ(), true); + sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelationsFIT(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, ft0, ft0cs, multiplicity, collision.posZ(), true, isFT0C); + } } - PROCESS_SWITCH(HfTaskFlow, processSameTpcMftD0ChMcGen, "MONTE-CARLO : Process same-event correlations for TPC-MFT D0-h case", false); + PROCESS_SWITCH(HfTaskFlow, processSameTpcFt0cLcCh, "DATA : Process same-event correlations for TPC-FT0C Lc-h case", false); // ===================================== - // MONTE-CARLO GENERATED : process same event correlations : TPC-MFT Lc-ch. part. case + // DATA : process same event correlations: FT0A-FT0C Ch. Part. - Ch. Part // ===================================== - void processSameTpcMftLcChMcGen(FilteredMcCollisions::iterator const& mcCollision, - McParticles3ProngMatched const& mcParticles3Prong, - McParticles const& mcParticles) + void processSameFt0aFt0cChCh(FilteredCollisionsWSelMult::iterator const& collision, + aod::FT0s const&) { - const auto multiplicity = mcCollision.multMCPVz(); + if (!(isAcceptedCollision(collision, true))) { + return; + } - BinningPolicyBase<2> const baseBinning{{axisVertex, axisMultiplicity}, true}; + if (collision.has_foundFT0()) { + const auto& ft0 = collision.foundFT0(); + const auto multiplicity = getMultiplicityEstimator(collision, true); + + if (multiplicity < configCollision.minMultiplicity || multiplicity > configCollision.maxMultiplicity) { + return; + } - sameEventHfMc->fillEvent(multiplicity, CorrelationContainer::kCFStepAll); - fillCorrelations(sameEventHfMc, CorrelationContainer::CFStep::kCFStepAll, mcParticles3Prong, mcParticles, multiplicity, mcCollision.posZ(), true); + sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelationsFt0aFt0c(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, ft0, ft0, multiplicity, collision.posZ(), true); + } } - PROCESS_SWITCH(HfTaskFlow, processSameTpcMftLcChMcGen, "MONTE-CARLO : Process same-event correlations for TPC-MFT Lc-h case", false); + PROCESS_SWITCH(HfTaskFlow, processSameFt0aFt0cChCh, "DATA : Process same-event correlations for FT0A-FT0C h-h case", false); // =================================================================================================================================================================================================================================================================== // =================================================================================================================================================================================================================================================================== @@ -2311,9 +2568,10 @@ struct HfTaskFlow { // ===================================== void processMixedTpcTpcChCh(FilteredCollisionsWSelMult const& collisions, - FilteredTracksWDcaSel const& tracks) + FilteredTracksWDcaSel const& tracks, + aod::BCsWithTimestamps const& bcs) { - mixCollisions(collisions, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, tracks, mixedEvent); + mixCollisions(collisions, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, tracks, mixedEvent, bcs); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcChCh, "DATA : Process mixed-event correlations for TPC-TPC h-h case", false); @@ -2323,9 +2581,10 @@ struct HfTaskFlow { void processMixedTpcTpcD0Ch(FilteredCollisionsWSelMult const& collisions, FilteredTracksWDcaSel const& tracks, - HfCandidatesSelD0 const& candidates) + HfCandidatesSelD0 const& candidates, + aod::BCsWithTimestamps const& bcs) { - mixCollisions(collisions, CorrelationContainer::kCFStepReconstructed, candidates, tracks, mixedEventHf); + mixCollisions(collisions, CorrelationContainer::kCFStepReconstructed, candidates, tracks, mixedEventHf, bcs); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcD0Ch, "DATA : Process mixed-event correlations for TPC-TPC D0-h case", false); @@ -2335,9 +2594,10 @@ struct HfTaskFlow { void processMixedTpcTpcLcCh(FilteredCollisionsWSelMult const& collisions, FilteredTracksWDcaSel const& tracks, - HfCandidatesSelLc const& candidates) + HfCandidatesSelLc const& candidates, + aod::BCsWithTimestamps const& bcs) { - mixCollisions(collisions, CorrelationContainer::kCFStepReconstructed, candidates, tracks, mixedEventHf); + mixCollisions(collisions, CorrelationContainer::kCFStepReconstructed, candidates, tracks, mixedEventHf, bcs); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcLcCh, "DATA : Process mixed-event correlations for TPC-TPC Lc-h case", false); @@ -2347,18 +2607,10 @@ struct HfTaskFlow { void processMixedTpcMftChCh(FilteredCollisionsWSelMult const& collisions, FilteredTracksWDcaSel const& tracks, - FilteredMftTracks const& mftTracks) + FilteredMftTracks const& mftTracks, + aod::BCsWithTimestamps const& bcs) { - mixCollisions(collisions, CorrelationContainer::kCFStepReconstructed, tracks, mftTracks, mixedEvent); - // mixCollisions(collisions, CorrelationContainer::kCFStepAll, tracks, mftTracks, getMultiplicity, mixedEvent); - - // The next following two lines were supposed to be used to do mixed event with the reassociated MFT tracks - // However it seems the O2physics framework cannot handle how these combinations requests grouping according to Anton Alkin - // So I leave them commented for now until it is solved, and put the "normal" mixCollisions back with kCFStepReconstructed - - // mixCollisionsReassociatedMftTracks(collisions, CorrelationContainer::kCFStepReconstructed, tracks, reassociatedMftTracks, getMultiplicity, mixedEvent, false); - - // mixCollisionsReassociatedMftTracks(collisions, CorrelationContainer::kCFStepTracked, tracks, reassociatedMftTracks, getMultiplicity, mixedEvent, true); + mixCollisions(collisions, CorrelationContainer::kCFStepReconstructed, tracks, mftTracks, mixedEvent, bcs); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcMftChCh, "DATA : Process mixed-event correlations for TPC-MFT h-h case", false); @@ -2369,9 +2621,10 @@ struct HfTaskFlow { void processMixedTpcMftD0Ch(FilteredCollisionsWSelMult const& collisions, HfCandidatesSelD0 const& candidates, FilteredMftTracks const& mftTracks, - FilteredTracksWDcaSel const& /*tracks*/) + FilteredTracksWDcaSel const& /*tracks*/, + aod::BCsWithTimestamps const& bcs) { - mixCollisions(collisions, CorrelationContainer::kCFStepReconstructed, candidates, mftTracks, mixedEventHf); + mixCollisions(collisions, CorrelationContainer::kCFStepReconstructed, candidates, mftTracks, mixedEventHf, bcs); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcMftD0Ch, "DATA : Process mixed-event correlations for TPC-MFT D0-h case", false); @@ -2381,9 +2634,10 @@ struct HfTaskFlow { void processMixedTpcMftLcCh(FilteredCollisionsWSelMult const& collisions, HfCandidatesSelLc const& candidates, - FilteredMftTracks const& mftTracks) + FilteredMftTracks const& mftTracks, + aod::BCsWithTimestamps const& bcs) { - mixCollisions(collisions, CorrelationContainer::kCFStepReconstructed, candidates, mftTracks, mixedEventHf); + mixCollisions(collisions, CorrelationContainer::kCFStepReconstructed, candidates, mftTracks, mixedEventHf, bcs); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcMftLcCh, "DATA : Process mixed-event correlations for TPC-MFT Lc-h case", false); @@ -2395,7 +2649,7 @@ struct HfTaskFlow { FilteredTracksWDcaSel const& tracks, aod::FV0As const& fv0as) { - mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, tracks, fv0as, perColTracks, mixedEvent); + mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, tracks, fv0as, perColTracks, mixedEvent, isFV0A); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcFv0aChCh, "DATA : Process mixed-event correlations for TPC-FV0-A h-h case", false); @@ -2407,7 +2661,7 @@ struct HfTaskFlow { HfCandidatesSelD0 const& candidates, aod::FV0As const& fv0as) { - mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, candidates, fv0as, perColD0s, mixedEventHf); + mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, candidates, fv0as, perColD0s, mixedEventHf, isFV0A); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcFv0aD0Ch, "DATA : Process mixed-event correlations for TPC-FV0-A D0-h case", false); @@ -2419,7 +2673,7 @@ struct HfTaskFlow { HfCandidatesSelLc const& candidates, aod::FV0As const& fv0as) { - mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, candidates, fv0as, perColLcs, mixedEventHf); + mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, candidates, fv0as, perColLcs, mixedEventHf, isFV0A); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcFv0aLcCh, "DATA : Process mixed-event correlations for TPC-FV0-A Lc-h case", false); @@ -2431,7 +2685,7 @@ struct HfTaskFlow { FilteredMftTracks const& mftTracks, aod::FV0As const& fv0as) { - mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, mftTracks, fv0as, perColMftTracks, mixedEvent); + mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, mftTracks, fv0as, perColMftTracks, mixedEvent, isFV0A); } PROCESS_SWITCH(HfTaskFlow, processMixedMftFv0aChCh, "DATA : Process mixed-event correlations for Mft-FV0-A h-h case", false); @@ -2443,7 +2697,7 @@ struct HfTaskFlow { FilteredTracksWDcaSel const& tracks, aod::FT0s const& ft0s) { - mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, tracks, ft0s, perColTracks, mixedEvent); + mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, tracks, ft0s, perColTracks, mixedEvent, isFT0A); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcFt0aChCh, "DATA : Process mixed-event correlations for TPC-FT0-A h-h case", false); @@ -2455,7 +2709,7 @@ struct HfTaskFlow { HfCandidatesSelD0 const& candidates, aod::FT0s const& ft0s) { - mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, candidates, ft0s, perColD0s, mixedEventHf); + mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, candidates, ft0s, perColD0s, mixedEventHf, isFT0A); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcFt0aD0Ch, "DATA : Process mixed-event correlations for TPC-FT0-A D0-h case", false); @@ -2467,7 +2721,7 @@ struct HfTaskFlow { HfCandidatesSelLc const& candidates, aod::FT0s const& ft0s) { - mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, candidates, ft0s, perColLcs, mixedEventHf); + mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, candidates, ft0s, perColLcs, mixedEventHf, isFT0A); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcFt0aLcCh, "DATA : Process mixed-event correlations for TPC-FT0-A Lc-h case", false); @@ -2479,99 +2733,56 @@ struct HfTaskFlow { FilteredMftTracks const& mftTracks, aod::FT0s const& ft0s) { - mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, mftTracks, ft0s, perColMftTracks, mixedEvent); + mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, mftTracks, ft0s, perColMftTracks, mixedEvent, isFT0A); } PROCESS_SWITCH(HfTaskFlow, processMixedMftFt0aChCh, "DATA : Process mixed-event correlations for MFT-FT0-A h-h case", false); - // =================================================================================================================================================================================================================================================================== - // MONTE-CARLO - // =================================================================================================================================================================================================================================================================== - // ===================================== - // MONTE-CARLO GENERATED : process mixed event correlations: TPC-MFT D0-ch. part. case + // DATA : process mixed event correlations: TPC-FT0C ch part. - ch. part. case // ===================================== - void processMixedTpcMftD0ChMcGen(FilteredMcCollisions const& mcCollisions, - McParticles2ProngMatched const& mcParticles2Prong, - McParticles const& mcParticles) + void processMixedTpcFt0cChCh(FilteredCollisionsWSelMult const& collisions, + FilteredTracksWDcaSel const& tracks, + aod::FT0s const& ft0s) { - auto getMultiplicity = [](FilteredMcCollisions::iterator const& mcCollision) { - auto multiplicity = mcCollision.multMCPVz(); - return multiplicity; - }; - - mixCollisionsMcTruth(mcCollisions, mcParticles2Prong, mcParticles, getMultiplicity, mixedEventHfMc); + mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, tracks, ft0s, perColTracks, mixedEvent, isFT0C); } - PROCESS_SWITCH(HfTaskFlow, processMixedTpcMftD0ChMcGen, "MONTE-CARLO : Process mixed-event correlations for TPC-MFT D0-h case", false); + PROCESS_SWITCH(HfTaskFlow, processMixedTpcFt0cChCh, "DATA : Process mixed-event correlations for TPC-FT0C h-h case", false); // ===================================== - // MONTE-CARLO GENERATED : process mixed event correlations: TPC-MFT Lc-ch. part. case + // DATA : process mixed event correlations: TPC-FT0C D0 - ch. part. case // ===================================== - void processMixedTpcMftLcChMcGen(FilteredMcCollisions const& mcCollisions, - McParticles3ProngMatched const& mcParticles3Prong, - McParticles const& mcParticles) + void processMixedTpcFt0cD0Ch(FilteredCollisionsWSelMult const& collisions, + HfCandidatesSelD0 const& candidates, + aod::FT0s const& ft0s) { - auto getMultiplicity = [](FilteredMcCollisions::iterator const& mcCollision) { - auto multiplicity = mcCollision.multMCPVz(); - return multiplicity; - }; - - mixCollisionsMcTruth(mcCollisions, mcParticles3Prong, mcParticles, getMultiplicity, mixedEventHfMc); + mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, candidates, ft0s, perColD0s, mixedEventHf, isFT0C); } - PROCESS_SWITCH(HfTaskFlow, processMixedTpcMftLcChMcGen, "MONTE-CARLO : Process mixed-event correlations for TPC-MFT D0-h case", false); + PROCESS_SWITCH(HfTaskFlow, processMixedTpcFt0cD0Ch, "DATA : Process mixed-event correlations for TPC-FT0C D0-h case", false); - // =================================================================================================================================================================================================================================================================== - // =================================================================================================================================================================================================================================================================== - // EFFICIENCIES PROCESS FUNCTIONS - // =================================================================================================================================================================================================================================================================== - // =================================================================================================================================================================================================================================================================== + // ===================================== + // DATA : process mixed event correlations: TPC-FT0C Lc - ch. part. case + // ===================================== - // NOTE SmallGroups includes soa::Filtered always -> in the smallGroups there is the equivalent of FilteredCollisionsWSelMultMcLabels - void processMcEfficiencyMft(FilteredMcCollisions::iterator const& mcCollision, - McParticles const& mcParticles, - soa::SmallGroups> const& collisionsMcLabels, - MftTracksMcLabels const& mftTTracksMcLabels) + void processMixedTpcFt0cLcCh(FilteredCollisionsWSelMult const& collisions, + HfCandidatesSelLc const& candidates, + aod::FT0s const& ft0s) { - LOGF(info, "MC collision at vtx-z = %f with %d mc particles and %d reconstructed collisions", mcCollision.posZ(), mcParticles.size(), collisionsMcLabels.size()); - - auto multiplicity = mcCollision.multMCPVz(); - if (configTask.centralityBinsForMc) { - if (collisionsMcLabels.size() == 0) { - return; - } - for (const auto& collision : collisionsMcLabels) { - multiplicity = collision.multNTracksPV(); - } - } + mixCollisionsFIT(collisions, CorrelationContainer::kCFStepReconstructed, candidates, ft0s, perColLcs, mixedEventHf, isFT0C); + } + PROCESS_SWITCH(HfTaskFlow, processMixedTpcFt0cLcCh, "DATA : Process mixed-event correlations for TPC-FT0C Lc-h case", false); - // Primaries - for (const auto& mcParticle : mcParticles) { - if (!isAcceptedMftMcParticle(mcParticle)) { - sameEventHf->getTrackHistEfficiency()->Fill(CorrelationContainer::MC, mcParticle.eta(), mcParticle.pt(), getSpecies(mcParticle.pdgCode()), multiplicity, mcCollision.posZ()); - } - } - for (const auto& collision : collisionsMcLabels) { - auto groupedMftTTracksMcLabels = mftTTracksMcLabels.sliceBy(mftTracksPerCollision, collision.globalIndex()); - LOGF(info, " Reconstructed collision at vtx-z = %f", collision.posZ()); - LOGF(info, " which has %d mft tracks", groupedMftTTracksMcLabels.size()); + // ===================================== + // DATA : process mixed event correlations: FT0A-FT0C ch part. - ch. part. case + // ===================================== - for (const auto& mftTrack : groupedMftTTracksMcLabels) { - if (mftTrack.has_mcParticle()) { - const auto& mcParticle = mftTrack.mcParticle(); - if (!isAcceptedMftMcParticle(mcParticle)) { - sameEventHf->getTrackHistEfficiency()->Fill(CorrelationContainer::RecoPrimaries, mcParticle.eta(), mcParticle.pt(), getSpecies(mcParticle.pdgCode()), multiplicity, mcCollision.posZ()); - } - sameEventHf->getTrackHistEfficiency()->Fill(CorrelationContainer::RecoAll, mcParticle.eta(), mcParticle.pt(), getSpecies(mcParticle.pdgCode()), multiplicity, mcCollision.posZ()); - } else { - // fake track - // In the MFT the measurement of pT is not precise - sameEventHf->getTrackHistEfficiency()->Fill(CorrelationContainer::Fake, mftTrack.eta(), mftTrack.pt(), 0, multiplicity, mcCollision.posZ()); - } - } - } + void processMixedFt0aFt0cChCh(FilteredCollisionsWSelMult const& collisions, + aod::FT0s const& ft0s) + { + mixCollisionsFt0aFt0c(collisions, CorrelationContainer::kCFStepReconstructed, ft0s, ft0s, mixedEvent); } - PROCESS_SWITCH(HfTaskFlow, processMcEfficiencyMft, "MONTE-CARLO : Extract efficiencies for MFT tracks", false); + PROCESS_SWITCH(HfTaskFlow, processMixedFt0aFt0cChCh, "DATA : Process mixed-event correlations for FT0A-FT0C h-h case", false); }; // End of struct From b6d000c44cd745b483b12ca7f93ada69ce18d627 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 17 Oct 2025 11:34:24 +0200 Subject: [PATCH 788/986] [PWGEM/Dilepton] fix B field in createResolutionMap.cxx (#13424) --- PWGEM/Dilepton/Tasks/createResolutionMap.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/PWGEM/Dilepton/Tasks/createResolutionMap.cxx b/PWGEM/Dilepton/Tasks/createResolutionMap.cxx index 7c0883c977c..2b59fa8975a 100644 --- a/PWGEM/Dilepton/Tasks/createResolutionMap.cxx +++ b/PWGEM/Dilepton/Tasks/createResolutionMap.cxx @@ -313,10 +313,8 @@ struct CreateResolutionMap { ccdb->get(geoPath); } o2::mch::TrackExtrap::setField(); - const double centerMFT[3] = {0, 0, -61.4}; - o2::field::MagneticField* field = static_cast(TGeoGlobalMagField::Instance()->GetField()); - mBzMFT = field->getBz(centerMFT); // Get field at centre of MFT - LOGF(info, "Bz at center of MFT = %f kZG", mBzMFT); + mBzMFT = d_bz; + LOGF(info, "Bz at center of MFT = %f kZG manually", mBzMFT); } auto run3grp_timestamp = bc.timestamp(); @@ -345,7 +343,6 @@ struct CreateResolutionMap { d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; } - mRunNumber = bc.runNumber(); // std::map metadata; // auto soreor = o2::ccdb::BasicCCDBManager::getRunDuration(ccdbApi, mRunNumber); @@ -357,6 +354,11 @@ struct CreateResolutionMap { ccdb->get(geoPath); } o2::mch::TrackExtrap::setField(); + const double centerMFT[3] = {0, 0, -61.4}; + o2::field::MagneticField* field = static_cast(TGeoGlobalMagField::Instance()->GetField()); + mBzMFT = field->getBz(centerMFT); // Get field at centre of MFT + LOGF(info, "Bz at center of MFT = %f kZG", mBzMFT); + mRunNumber = bc.runNumber(); } template From 155c01334517e8028928b687ccd45fe4e3f347b3 Mon Sep 17 00:00:00 2001 From: Shirajum Monira <38348689+Eloviyo@users.noreply.github.com> Date: Fri, 17 Oct 2025 12:10:38 +0200 Subject: [PATCH 789/986] [PWGCF] FemtoUniverse Cascade Task -- removed separate bachelor TOF check & implemented strangenessTOF (#13357) Co-authored-by: Shirajum Monira --- ...toUniversePairTaskTrackCascadeExtended.cxx | 201 +++++++++++------- 1 file changed, 126 insertions(+), 75 deletions(-) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx index 966c3ae0bac..7a6ee60ec05 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx @@ -88,8 +88,8 @@ struct femtoUniversePairTaskTrackCascadeExtended { Configurable confNsigmaTPCParticle{"confNsigmaTPCParticle", 3.0, "TPC Sigma for particle (track) momentum < Confmom"}; Configurable confNsigmaCombinedParticle{"confNsigmaCombinedParticle", 3.0, "TPC and TOF Sigma (combined) for particle (track) momentum > Confmom"}; Configurable confNsigmaTPCParticleChild{"confNsigmaTPCParticleChild", 3.0, "TPC Sigma for particle (daugh & bach) momentum < Confmom"}; - Configurable confCheckTOFBachelorOnly{"confCheckTOFBachelorOnly", false, "Enable TOF for Cascade bachelor only"}; Configurable confNsigmaTOFParticleChild{"confNsigmaTOFParticleChild", 3.0, "TOF Sigma for particle (daugh & bach) momentum > Confmom"}; + Configurable confUseStrangenessTOF{"confUseStrangenessTOF", true, "Use strangeness TOF for cascade PID"}; ConfigurableAxis confkstarBins{"confkstarBins", {1500, 0., 6.}, "binning kstar"}; ConfigurableAxis confMultBins{"confMultBins", {VARIABLE_WIDTH, 0.0f, 20.0f, 40.0f, 60.0f, 80.0f, 100.0f, 200.0f, 99999.f}, "Mixing bins - multiplicity"}; @@ -355,7 +355,7 @@ struct femtoUniversePairTaskTrackCascadeExtended { if (!isParticleTPC(posChild, CascChildTable[confCascType1][0], &posChildTPC) || !isParticleTPC(negChild, CascChildTable[confCascType1][1], &negChildTPC) || !isParticleTPC(bachelor, CascChildTable[confCascType1][2], &bachelorTPC)) continue; - if ((!confCheckTOFBachelorOnly && (!isParticleTOF(posChild, CascChildTable[confCascType1][0], &posChildTOF) || !isParticleTOF(negChild, CascChildTable[confCascType1][1], &negChildTOF))) || !isParticleTOF(bachelor, CascChildTable[confCascType1][2], &bachelorTOF)) + if (!isParticleTOF(posChild, CascChildTable[confCascType1][0], &posChildTOF) || !isParticleTOF(negChild, CascChildTable[confCascType1][1], &negChildTOF) || !isParticleTOF(bachelor, CascChildTable[confCascType1][2], &bachelorTOF)) continue; rXiQA.fill(HIST("hPtXi"), part.pt()); @@ -406,7 +406,7 @@ struct femtoUniversePairTaskTrackCascadeExtended { if (!isParticleTPC(posChild, CascChildTable[confCascType1][0], &posChildTPC) || !isParticleTPC(negChild, CascChildTable[confCascType1][1], &negChildTPC) || !isParticleTPC(bachelor, CascChildTable[confCascType1][2], &bachelorTPC)) continue; - if ((!confCheckTOFBachelorOnly && (!isParticleTOF(posChild, CascChildTable[confCascType1][0], &posChildTOF) || !isParticleTOF(negChild, CascChildTable[confCascType1][1], &negChildTOF))) || !isParticleTOF(bachelor, CascChildTable[confCascType1][2], &bachelorTOF)) + if (!isParticleTOF(posChild, CascChildTable[confCascType1][0], &posChildTOF) || !isParticleTOF(negChild, CascChildTable[confCascType1][1], &negChildTOF) || !isParticleTOF(bachelor, CascChildTable[confCascType1][2], &bachelorTOF)) continue; posChildHistos.fillQA(posChild); @@ -416,10 +416,8 @@ struct femtoUniversePairTaskTrackCascadeExtended { qaRegistry.fill(HIST("V0Child_pos/nSigmaTPC"), posChild.p(), posChildTPC); qaRegistry.fill(HIST("V0Child_neg/nSigmaTPC"), negChild.p(), negChildTPC); qaRegistry.fill(HIST("hBachelor/nSigmaTPC"), bachelor.p(), bachelorTPC); - if (!confCheckTOFBachelorOnly) { - qaRegistry.fill(HIST("V0Child_pos/nSigmaTOF"), posChild.p(), posChildTOF); - qaRegistry.fill(HIST("V0Child_neg/nSigmaTOF"), negChild.p(), negChildTOF); - } + qaRegistry.fill(HIST("V0Child_pos/nSigmaTOF"), posChild.p(), posChildTOF); + qaRegistry.fill(HIST("V0Child_neg/nSigmaTOF"), negChild.p(), negChildTOF); qaRegistry.fill(HIST("hBachelor/nSigmaTOF"), bachelor.p(), bachelorTOF); cascQAHistos.fillQA(part); @@ -428,8 +426,13 @@ struct femtoUniversePairTaskTrackCascadeExtended { if ((posChild.pidCut() & (1u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (1u << CascChildTable[confCascType1][1])) == 0 || (bachelor.pidCut() & (1u << CascChildTable[confCascType1][2])) == 0) continue; - if ((!confCheckTOFBachelorOnly && ((posChild.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0)) || (bachelor.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) - continue; + if (confUseStrangenessTOF) { + if (((confCascType1 == 1 || confCascType1 == 3) && (part.pidCut() & 7) != 7) || ((confCascType1 == 0 || confCascType1 == 2) && (part.pidCut() & 56) != 56)) + continue; + } else { + if ((posChild.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0 || (bachelor.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) + continue; + } posChildHistos.fillQA(posChild); negChildHistos.fillQA(negChild); @@ -488,13 +491,18 @@ struct femtoUniversePairTaskTrackCascadeExtended { if constexpr (std::experimental::is_detected::value) { if (!isParticleTPC(posChild, CascChildTable[confCascType1][0]) || !isParticleTPC(negChild, CascChildTable[confCascType1][1]) || !isParticleTPC(bachelor, CascChildTable[confCascType1][2])) continue; - if ((!confCheckTOFBachelorOnly && (!isParticleTOF(posChild, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild, CascChildTable[confCascType1][1]))) || !isParticleTOF(bachelor, CascChildTable[confCascType1][2])) + if (!isParticleTOF(posChild, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild, CascChildTable[confCascType1][1]) || !isParticleTOF(bachelor, CascChildTable[confCascType1][2])) continue; } else { if ((posChild.pidCut() & (1u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (1u << CascChildTable[confCascType1][1])) == 0 || (bachelor.pidCut() & (1u << CascChildTable[confCascType1][2])) == 0) continue; - if ((!confCheckTOFBachelorOnly && ((posChild.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0)) || (bachelor.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) - continue; + if (confUseStrangenessTOF) { + if (((confCascType1 == 1 || confCascType1 == 3) && (p2.pidCut() & 7) != 7) || ((confCascType1 == 0 || confCascType1 == 2) && (p2.pidCut() & 56) != 56)) + continue; + } else { + if ((posChild.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0 || (bachelor.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) + continue; + } } float weight = 1.0f; if (plocalEffp1) @@ -543,7 +551,7 @@ struct femtoUniversePairTaskTrackCascadeExtended { if constexpr (std::experimental::is_detected::value) { if (!isParticleTPC(posChild, CascChildTable[confCascType1][0]) || !isParticleTPC(negChild, CascChildTable[confCascType1][1]) || !isParticleTPC(bachelor, CascChildTable[confCascType1][2])) continue; - if ((!confCheckTOFBachelorOnly && (!isParticleTOF(posChild, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild, CascChildTable[confCascType1][1]))) || !isParticleTOF(bachelor, CascChildTable[confCascType1][2])) + if (!isParticleTOF(posChild, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild, CascChildTable[confCascType1][1]) || !isParticleTOF(bachelor, CascChildTable[confCascType1][2])) continue; posChildHistos.fillQA(posChild); @@ -552,8 +560,13 @@ struct femtoUniversePairTaskTrackCascadeExtended { } else { if ((posChild.pidCut() & (1u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (1u << CascChildTable[confCascType1][1])) == 0 || (bachelor.pidCut() & (1u << CascChildTable[confCascType1][2])) == 0) continue; - if ((!confCheckTOFBachelorOnly && ((posChild.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0)) || (bachelor.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) - continue; + if (confUseStrangenessTOF) { + if (((confCascType1 == 1 || confCascType1 == 3) && (part.pidCut() & 7) != 7) || ((confCascType1 == 0 || confCascType1 == 2) && (part.pidCut() & 56) != 56)) + continue; + } else { + if ((posChild.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0 || (bachelor.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) + continue; + } posChildHistos.fillQA(posChild); negChildHistos.fillQA(negChild); @@ -596,13 +609,18 @@ struct femtoUniversePairTaskTrackCascadeExtended { if constexpr (std::experimental::is_detected::value) { if (!isParticleTPC(posChild1, CascChildTable[confCascType1][0]) || !isParticleTPC(negChild1, CascChildTable[confCascType1][1]) || !isParticleTPC(bachelor1, CascChildTable[confCascType1][2])) return; - if ((!confCheckTOFBachelorOnly && (!isParticleTOF(posChild1, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild1, CascChildTable[confCascType1][1]))) || !isParticleTOF(bachelor1, CascChildTable[confCascType1][2])) + if (!isParticleTOF(posChild1, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild1, CascChildTable[confCascType1][1]) || !isParticleTOF(bachelor1, CascChildTable[confCascType1][2])) return; } else { if ((posChild1.pidCut() & (1u << CascChildTable[confCascType1][0])) == 0 || (negChild1.pidCut() & (1u << CascChildTable[confCascType1][1])) == 0 || (bachelor1.pidCut() & (1u << CascChildTable[confCascType1][2])) == 0) return; - if ((!confCheckTOFBachelorOnly && ((posChild1.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild1.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0)) || (bachelor1.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) - return; + if (confUseStrangenessTOF) { + if (((confCascType1 == 1 || confCascType1 == 3) && (p1.pidCut() & 7) != 7) || ((confCascType1 == 0 || confCascType1 == 2) && (p1.pidCut() & 56) != 56)) + return; + } else { + if ((posChild1.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild1.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0 || (bachelor1.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) + return; + } } const auto& posChild2 = parts.iteratorAt(p2.globalIndex() - 3 - parts.begin().globalIndex()); @@ -612,13 +630,18 @@ struct femtoUniversePairTaskTrackCascadeExtended { if constexpr (std::experimental::is_detected::value) { if (!isParticleTPC(posChild2, CascChildTable[confCascType2][0]) || !isParticleTPC(negChild2, CascChildTable[confCascType2][1]) || !isParticleTPC(bachelor2, CascChildTable[confCascType2][2])) return; - if ((!confCheckTOFBachelorOnly && (!isParticleTOF(posChild2, CascChildTable[confCascType2][0]) || !isParticleTOF(negChild2, CascChildTable[confCascType2][1]))) || !isParticleTOF(bachelor2, CascChildTable[confCascType2][2])) + if (!isParticleTOF(posChild2, CascChildTable[confCascType2][0]) || !isParticleTOF(negChild2, CascChildTable[confCascType2][1]) || !isParticleTOF(bachelor2, CascChildTable[confCascType2][2])) return; } else { - if ((posChild2.pidCut() & (1u << CascChildTable[confCascType1][0])) == 0 || (negChild2.pidCut() & (1u << CascChildTable[confCascType1][1])) == 0 || (bachelor2.pidCut() & (1u << CascChildTable[confCascType1][2])) == 0) - return; - if ((!confCheckTOFBachelorOnly && ((posChild2.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild2.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0)) || (bachelor2.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) + if ((posChild2.pidCut() & (1u << CascChildTable[confCascType2][0])) == 0 || (negChild2.pidCut() & (1u << CascChildTable[confCascType2][1])) == 0 || (bachelor2.pidCut() & (1u << CascChildTable[confCascType2][2])) == 0) return; + if (confUseStrangenessTOF) { + if (((confCascType2 == 1 || confCascType2 == 3) && (p2.pidCut() & 7) != 7) || ((confCascType2 == 0 || confCascType2 == 2) && (p2.pidCut() & 56) != 56)) + return; + } else { + if ((posChild2.pidCut() & (8u << CascChildTable[confCascType2][0])) == 0 || (negChild2.pidCut() & (8u << CascChildTable[confCascType2][1])) == 0 || (bachelor2.pidCut() & (8u << CascChildTable[confCascType2][2])) == 0) + return; + } } float weight = 1.0f; @@ -697,13 +720,18 @@ struct femtoUniversePairTaskTrackCascadeExtended { if constexpr (std::experimental::is_detected::value) { if (!isParticleTPC(posChild, CascChildTable[confCascType1][0]) || !isParticleTPC(negChild, CascChildTable[confCascType1][1]) || !isParticleTPC(bachelor, CascChildTable[confCascType1][2])) continue; - if ((!confCheckTOFBachelorOnly && (!isParticleTOF(posChild, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild, CascChildTable[confCascType1][1]))) || !isParticleTOF(bachelor, CascChildTable[confCascType1][2])) + if (!isParticleTOF(posChild, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild, CascChildTable[confCascType1][1]) || !isParticleTOF(bachelor, CascChildTable[confCascType1][2])) continue; } else { if ((posChild.pidCut() & (1u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (1u << CascChildTable[confCascType1][1])) == 0 || (bachelor.pidCut() & (1u << CascChildTable[confCascType1][2])) == 0) continue; - if ((!confCheckTOFBachelorOnly && ((posChild.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0)) || (bachelor.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) - continue; + if (confUseStrangenessTOF) { + if (((confCascType1 == 1 || confCascType1 == 3) && (p2.pidCut() & 7) != 7) || ((confCascType1 == 0 || confCascType1 == 2) && (p2.pidCut() & 56) != 56)) + continue; + } else { + if ((posChild.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0 || (bachelor.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) + continue; + } } // track cleaning @@ -781,13 +809,18 @@ struct femtoUniversePairTaskTrackCascadeExtended { if constexpr (std::experimental::is_detected::value) { if (!isParticleTPC(posChild1, CascChildTable[confCascType1][0]) || !isParticleTPC(negChild1, CascChildTable[confCascType1][1]) || !isParticleTPC(bachelor1, CascChildTable[confCascType1][2])) continue; - if ((!confCheckTOFBachelorOnly && (!isParticleTOF(posChild1, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild1, CascChildTable[confCascType1][1]))) || !isParticleTOF(bachelor1, CascChildTable[confCascType1][2])) + if (!isParticleTOF(posChild1, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild1, CascChildTable[confCascType1][1]) || !isParticleTOF(bachelor1, CascChildTable[confCascType1][2])) continue; } else { if ((posChild1.pidCut() & (1u << CascChildTable[confCascType1][0])) == 0 || (negChild1.pidCut() & (1u << CascChildTable[confCascType1][1])) == 0 || (bachelor1.pidCut() & (1u << CascChildTable[confCascType1][2])) == 0) continue; - if ((!confCheckTOFBachelorOnly && ((posChild1.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild1.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0)) || (bachelor1.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) - continue; + if (confUseStrangenessTOF) { + if (((confCascType1 == 1 || confCascType1 == 3) && (p1.pidCut() & 7) != 7) || ((confCascType1 == 0 || confCascType1 == 2) && (p1.pidCut() & 56) != 56)) + continue; + } else { + if ((posChild1.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild1.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0 || (bachelor1.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) + continue; + } } const auto& posChild2 = parts.iteratorAt(p2.globalIndex() - 3 - parts.begin().globalIndex()); @@ -797,13 +830,18 @@ struct femtoUniversePairTaskTrackCascadeExtended { if constexpr (std::experimental::is_detected::value) { if (!isParticleTPC(posChild2, CascChildTable[confCascType2][0]) || !isParticleTPC(negChild2, CascChildTable[confCascType2][1]) || !isParticleTPC(bachelor2, CascChildTable[confCascType2][2])) continue; - if ((!confCheckTOFBachelorOnly && (!isParticleTOF(posChild2, CascChildTable[confCascType2][0]) || !isParticleTOF(negChild2, CascChildTable[confCascType2][1]))) || !isParticleTOF(bachelor2, CascChildTable[confCascType2][2])) + if (!isParticleTOF(posChild2, CascChildTable[confCascType2][0]) || !isParticleTOF(negChild2, CascChildTable[confCascType2][1]) || !isParticleTOF(bachelor2, CascChildTable[confCascType2][2])) continue; } else { - if ((posChild2.pidCut() & (1u << CascChildTable[confCascType1][0])) == 0 || (negChild2.pidCut() & (1u << CascChildTable[confCascType1][1])) == 0 || (bachelor2.pidCut() & (1u << CascChildTable[confCascType1][2])) == 0) - continue; - if ((!confCheckTOFBachelorOnly && ((posChild2.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild2.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0)) || (bachelor2.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) + if ((posChild2.pidCut() & (1u << CascChildTable[confCascType2][0])) == 0 || (negChild2.pidCut() & (1u << CascChildTable[confCascType2][1])) == 0 || (bachelor2.pidCut() & (1u << CascChildTable[confCascType2][2])) == 0) continue; + if (confUseStrangenessTOF) { + if (((confCascType2 == 1 || confCascType2 == 3) && (p2.pidCut() & 7) != 7) || ((confCascType2 == 0 || confCascType2 == 2) && (p2.pidCut() & 56) != 56)) + continue; + } else { + if ((posChild2.pidCut() & (8u << CascChildTable[confCascType2][0])) == 0 || (negChild2.pidCut() & (8u << CascChildTable[confCascType2][1])) == 0 || (bachelor2.pidCut() & (8u << CascChildTable[confCascType2][2])) == 0) + continue; + } } // track cleaning if (!pairCleanerCasc.isCleanPair(p1, p2, parts)) { @@ -851,30 +889,31 @@ struct femtoUniversePairTaskTrackCascadeExtended { continue; cascQAHistos.fillQA(part); - } - for (const auto& part : groupPartsOne) { - int pdgCode = static_cast(part.pidCut()); - if (pdgCode != confTrkPDGCodePartOne) - continue; - const auto& pdgTrackParticle = pdgMC->GetParticle(pdgCode); - if (!pdgTrackParticle) { - continue; - } - if (pdgTrackParticle->Charge() > 0) { - trackHistoPartOnePos.fillQA(part); - } else if (pdgTrackParticle->Charge() < 0) { - trackHistoPartOneNeg.fillQA(part); + for (const auto& part : groupPartsOne) { + int pdgCode = static_cast(part.pidCut()); + if (pdgCode != confTrkPDGCodePartOne) + continue; + const auto& pdgTrackParticle = pdgMC->GetParticle(pdgCode); + if (!pdgTrackParticle) { + continue; + } + + if (pdgTrackParticle->Charge() > 0) { + trackHistoPartOnePos.fillQA(part); + } else if (pdgTrackParticle->Charge() < 0) { + trackHistoPartOneNeg.fillQA(part); + } } - } - for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { - if (static_cast(p1.pidCut()) != confTrkPDGCodePartOne) - continue; - int pdgCodeCasc = static_cast(p2.pidCut()); - if ((confCascType1 == 0 && pdgCodeCasc != kOmegaMinus) || (confCascType1 == 2 && pdgCodeCasc != kOmegaPlusBar) || (confCascType1 == 1 && pdgCodeCasc != kXiMinus) || (confCascType1 == 3 && pdgCodeCasc != kXiPlusBar)) - continue; - sameEventCont.setPair(p1, p2, multCol, confUse3D, 1.0f); + for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { + if (static_cast(p1.pidCut()) != confTrkPDGCodePartOne) + continue; + int pdgCodeCasc = static_cast(p2.pidCut()); + if ((confCascType1 == 0 && pdgCodeCasc != kOmegaMinus) || (confCascType1 == 2 && pdgCodeCasc != kOmegaPlusBar) || (confCascType1 == 1 && pdgCodeCasc != kXiMinus) || (confCascType1 == 3 && pdgCodeCasc != kXiPlusBar)) + continue; + sameEventCont.setPair(p1, p2, multCol, confUse3D, 1.0f); + } } } PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processSameEventMCgen, "Enable processing same event MC truth for track - cascade", false); @@ -894,24 +933,24 @@ struct femtoUniversePairTaskTrackCascadeExtended { continue; cascQAHistos.fillQA(part); - } - auto pairProcessFunc = [&](auto& p1, auto& p2) -> void { - int pdgCodeCasc1 = static_cast(p1.pidCut()); - if ((confCascType1 == 0 && pdgCodeCasc1 != kOmegaMinus) || (confCascType1 == 2 && pdgCodeCasc1 != kOmegaPlusBar) || (confCascType1 == 1 && pdgCodeCasc1 != kXiMinus) || (confCascType1 == 3 && pdgCodeCasc1 != kXiPlusBar)) - return; - int pdgCodeCasc2 = static_cast(p2.pidCut()); - if ((confCascType2 == 0 && pdgCodeCasc2 != kOmegaMinus) || (confCascType2 == 2 && pdgCodeCasc2 != kOmegaPlusBar) || (confCascType2 == 1 && pdgCodeCasc2 != kXiMinus) || (confCascType2 == 3 && pdgCodeCasc2 != kXiPlusBar)) - return; - sameEventCont.setPair(p1, p2, multCol, confUse3D, 1.0f); - }; + auto pairProcessFunc = [&](auto& p1, auto& p2) -> void { + int pdgCodeCasc1 = static_cast(p1.pidCut()); + if ((confCascType1 == 0 && pdgCodeCasc1 != kOmegaMinus) || (confCascType1 == 2 && pdgCodeCasc1 != kOmegaPlusBar) || (confCascType1 == 1 && pdgCodeCasc1 != kXiMinus) || (confCascType1 == 3 && pdgCodeCasc1 != kXiPlusBar)) + return; + int pdgCodeCasc2 = static_cast(p2.pidCut()); + if ((confCascType2 == 0 && pdgCodeCasc2 != kOmegaMinus) || (confCascType2 == 2 && pdgCodeCasc2 != kOmegaPlusBar) || (confCascType2 == 1 && pdgCodeCasc2 != kXiMinus) || (confCascType2 == 3 && pdgCodeCasc2 != kXiPlusBar)) + return; + sameEventCont.setPair(p1, p2, multCol, confUse3D, 1.0f); + }; - if (confCascType1 == confCascType2) { - for (const auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsTwo, groupPartsTwo))) - pairProcessFunc(p1, p2); - } else { - for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsTwo, groupPartsTwo))) - pairProcessFunc(p1, p2); + if (confCascType1 == confCascType2) { + for (const auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsTwo, groupPartsTwo))) + pairProcessFunc(p1, p2); + } else { + for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsTwo, groupPartsTwo))) + pairProcessFunc(p1, p2); + } } } PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processSameEventCascMCgen, "Enable processing same event MC truth for cascade - cascade", false); @@ -1026,6 +1065,8 @@ struct femtoUniversePairTaskTrackCascadeExtended { const auto& mcpart = mcparts.iteratorAt(mcPartId); // if (part.partType() == aod::femtouniverseparticle::ParticleType::kCascade) { + if (!invMCascade(part.mLambda(), part.mAntiLambda(), confCascType1)) /// mLambda stores Xi mass, mAntiLambda stores Omega mass + continue; if ((confCascType1 == 0 && mcpart.pdgMCTruth() == kOmegaMinus) || (confCascType1 == 1 && mcpart.pdgMCTruth() == kXiMinus)) { const auto& posChild = parts.iteratorAt(part.globalIndex() - 3 - parts.begin().globalIndex()); const auto& negChild = parts.iteratorAt(part.globalIndex() - 2 - parts.begin().globalIndex()); @@ -1034,13 +1075,18 @@ struct femtoUniversePairTaskTrackCascadeExtended { if constexpr (std::experimental::is_detected::value) { if (!isParticleTPC(posChild, CascChildTable[confCascType1][0]) || !isParticleTPC(negChild, CascChildTable[confCascType1][1]) || !isParticleTPC(bachelor, CascChildTable[confCascType1][2])) continue; - if ((!confCheckTOFBachelorOnly && (!isParticleTOF(posChild, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild, CascChildTable[confCascType1][1]))) || !isParticleTOF(bachelor, CascChildTable[confCascType1][2])) + if (!isParticleTOF(posChild, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild, CascChildTable[confCascType1][1]) || !isParticleTOF(bachelor, CascChildTable[confCascType1][2])) continue; } else { if ((posChild.pidCut() & (1u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (1u << CascChildTable[confCascType1][1])) == 0 || (bachelor.pidCut() & (1u << CascChildTable[confCascType1][2])) == 0) continue; - if ((!confCheckTOFBachelorOnly && ((posChild.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0)) || (bachelor.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) - continue; + if (confUseStrangenessTOF) { + if (((confCascType1 == 1) && (part.pidCut() & 7) != 7) || ((confCascType1 == 0) && (part.pidCut() & 56) != 56)) + continue; + } else { + if ((posChild.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0 || (bachelor.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) + continue; + } } registryMCreco.fill(HIST("plus/MCrecoCascade"), mcpart.pt(), mcpart.eta()); @@ -1051,13 +1097,18 @@ struct femtoUniversePairTaskTrackCascadeExtended { if constexpr (std::experimental::is_detected::value) { if (!isParticleTPC(posChild, CascChildTable[confCascType1 + 2][0]) && !isParticleTPC(negChild, CascChildTable[confCascType1 + 2][1]) && !isParticleTPC(bachelor, CascChildTable[confCascType1 + 2][2])) continue; - if ((!confCheckTOFBachelorOnly && (!isParticleTOF(posChild, CascChildTable[confCascType1 + 2][0]) || !isParticleTOF(negChild, CascChildTable[confCascType1 + 2][1]))) || !isParticleTOF(bachelor, CascChildTable[confCascType1 + 2][2])) + if (!isParticleTOF(posChild, CascChildTable[confCascType1 + 2][0]) || !isParticleTOF(negChild, CascChildTable[confCascType1 + 2][1]) || !isParticleTOF(bachelor, CascChildTable[confCascType1 + 2][2])) continue; } else { if ((posChild.pidCut() & (1u << CascChildTable[confCascType1 + 2][0])) == 0 || (negChild.pidCut() & (1u << CascChildTable[confCascType1 + 2][1])) == 0 || (bachelor.pidCut() & (1u << CascChildTable[confCascType1 + 2][2])) == 0) continue; - if ((!confCheckTOFBachelorOnly && ((posChild.pidCut() & (8u << CascChildTable[confCascType1 + 2][0])) == 0 || (negChild.pidCut() & (8u << CascChildTable[confCascType1 + 2][1])) == 0)) || (bachelor.pidCut() & (8u << CascChildTable[confCascType1 + 2][2])) == 0) - continue; + if (confUseStrangenessTOF) { + if (((confCascType1 == 1) && (part.pidCut() & 7) != 7) || ((confCascType1 == 0) && (part.pidCut() & 56) != 56)) + continue; + } else { + if ((posChild.pidCut() & (8u << CascChildTable[confCascType1 + 2][0])) == 0 || (negChild.pidCut() & (8u << CascChildTable[confCascType1 + 2][1])) == 0 || (bachelor.pidCut() & (8u << CascChildTable[confCascType1 + 2][2])) == 0) + continue; + } } registryMCreco.fill(HIST("minus/MCrecoCascade"), mcpart.pt(), mcpart.eta()); } From d41749afc97cf7fe533379d4354a74547b378200 Mon Sep 17 00:00:00 2001 From: Chiara De Martin <39315597+ChiaraDeMartin95@users.noreply.github.com> Date: Fri, 17 Oct 2025 13:50:09 +0200 Subject: [PATCH 790/986] remove T0M for Xi analyssi in PbPb (#13429) Co-authored-by: Chiara De Martin --- PWGLF/TableProducer/Strangeness/cascadeflow.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx index a2e7f295a3b..1ef86aa7901 100644 --- a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx @@ -48,6 +48,7 @@ using std::array; using DauTracks = soa::Join; using CollEventPlane = soa::Join::iterator; using CollEventPlaneCentralFW = soa::Join::iterator; +using CollEventPlaneCentralFWOnlyFT0C = soa::Join::iterator; using CollEventAndSpecPlane = soa::Join::iterator; using CollEventAndSpecPlaneCentralFW = soa::Join::iterator; using MCCollisionsStra = soa::Join; @@ -1379,7 +1380,7 @@ struct cascadeFlow { } } - void processAnalyseDataEP2CentralFW(CollEventPlaneCentralFW const& coll, CascCandidates const& Cascades, DauTracks const&) + void processAnalyseDataEP2CentralFW(CollEventPlaneCentralFWOnlyFT0C const& coll, CascCandidates const& Cascades, DauTracks const&) { if (!AcceptEvent(coll, 1)) { From 3f3f16b3ff2e32ea9e3e2917deb330f9499ed934 Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Fri, 17 Oct 2025 14:25:55 +0200 Subject: [PATCH 791/986] [PWGCF] FemtoUniverse: Add flag to choose cent. or mult. to fill col table (#13416) --- .../TableProducer/femtoUniverseProducerTask.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx index 239e39e587e..78234e1ea41 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx @@ -160,6 +160,7 @@ struct FemtoUniverseProducerTask { Configurable confEvIsVertexITSTPC{"confEvIsVertexITSTPC", true, "Require kIsVertexITSTPC selection on Events"}; Configurable confTPCOccupancyMin{"confTPCOccupancyMin", 0, "Minimum value for TPC Occupancy selection"}; Configurable confTPCOccupancyMax{"confTPCOccupancyMax", 500, "Maximum value for TPC Occupancy selection"}; + Configurable confIsCent{"confIsCent", true, "Centrality or multiplicity selection"}; } ConfGeneral; Filter customCollCentFilter = (aod::cent::centFT0C > ConfGeneral.confCentFT0Min) && (aod::cent::centFT0C < ConfGeneral.confCentFT0Max); @@ -2541,9 +2542,15 @@ struct FemtoUniverseProducerTask { auto bc = col.bc_as(); getMagneticFieldTesla(bc); const auto ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), mRunNumber, "ZNC hadronic") * 1.e-3; // fetch IR - + bool colcheck = false; // fill the tables - const auto colcheck = fillCollisionsCentRun3(col); + + if (ConfGeneral.confIsCent) { + colcheck = fillCollisionsCentRun3(col); + } else { + colcheck = fillCollisions(col, groupedTracks); + } + if (colcheck) { fillCollisionsCentRun3ColExtra(col, ir); fillTracks(groupedTracks); From fe2d1c06a57bfea3594d43e26bd6e94706c1e0ec Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Fri, 17 Oct 2025 15:14:37 +0200 Subject: [PATCH 792/986] [PWGLF] Use kinematic differential pool for event mixing to reproduce better the acceptance effect (#13430) --- .../Strangeness/lambdaspincorrderived.cxx | 445 +++++++++++++++--- 1 file changed, 373 insertions(+), 72 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx index 8a75b7205e7..bb3e564bc82 100644 --- a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx @@ -38,9 +38,12 @@ #include #include // for std::fabs +#include #include #include #include +#include +#include #include // <<< CHANGED: for dedup sets #include #include @@ -71,20 +74,34 @@ struct lambdaspincorrderived { TH3D* hweight2; TH3D* hweight3; TH3D* hweight4; + + TH3D* hweight12; + TH3D* hweight22; + TH3D* hweight32; + TH3D* hweight42; + Configurable ConfWeightPathLL{"ConfWeightPathLL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; Configurable ConfWeightPathALAL{"ConfWeightPathALAL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; Configurable ConfWeightPathLAL{"ConfWeightPathLAL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; Configurable ConfWeightPathALL{"ConfWeightPathALL", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path"}; + Configurable ConfWeightPathLL2{"ConfWeightPathLL2", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path 2"}; + Configurable ConfWeightPathALAL2{"ConfWeightPathALAL2", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path 2"}; + Configurable ConfWeightPathLAL2{"ConfWeightPathLAL2", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path 2"}; + Configurable ConfWeightPathALL2{"ConfWeightPathALL2", "Users/s/skundu/My/Object/spincorr/cent010LL", "Weight path 2"}; + // event sel///////// Configurable centMin{"centMin", 0, "Minimum Centrality"}; Configurable centMax{"centMax", 80, "Maximum Centrality"}; - + Configurable rngSeed{"rngSeed", 12345, "Seed for random mixing (reproducible)"}; + std::mt19937 rng{12345}; // Lambda selection //////////// Configurable harmonic{"harmonic", 1, "Harmonic delta phi"}; Configurable useweight{"useweight", 0, "Use weight"}; + Configurable usebothweight{"usebothweight", 1, "Use both weight"}; // Configurable useNUA{"useNUA", 0, "Use NUA weight"}; Configurable usePDGM{"usePDGM", 1, "Use PDG mass"}; + Configurable useAdditionalHisto{"useAdditionalHisto", 0, "Use additional histogram"}; Configurable checkDoubleStatus{"checkDoubleStatus", 0, "Check Double status"}; Configurable cosPA{"cosPA", 0.995, "Cosine Pointing Angle"}; Configurable radiusMin{"radiusMin", 3, "Minimum V0 radius"}; @@ -94,6 +111,8 @@ struct lambdaspincorrderived { Configurable dcaDaughters{"dcaDaughters", 1.0, "DCA between daughters"}; Configurable ptMin{"ptMin", 0.5, "V0 Pt minimum"}; Configurable ptMax{"ptMax", 3.0, "V0 Pt maximum"}; + Configurable MassMin{"MassMin", 1.09, "V0 Mass minimum"}; + Configurable MassMax{"MassMax", 1.14, "V0 Mass maximum"}; Configurable rapidity{"rapidity", 0.5, "Rapidity cut on lambda"}; Configurable v0eta{"v0eta", 0.8, "Eta cut on lambda"}; @@ -142,6 +161,16 @@ struct lambdaspincorrderived { histos.add("ME_ALL", "ME pairs", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); histos.add("ME_ALAL", "ME pairs", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); + histos.add("SE_LL2", "SE pairs 2", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); + histos.add("SE_LAL2", "SE pairs 2", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); + histos.add("SE_ALL2", "SE pairs 2", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); + histos.add("SE_ALAL2", "SE pairs 2", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); + + histos.add("ME_LL2", "ME pairs 2", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); + histos.add("ME_LAL2", "ME pairs 2", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); + histos.add("ME_ALL2", "ME pairs 2", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); + histos.add("ME_ALAL2", "ME pairs 2", HistType::kTH3D, {ax_dphi_h, ax_deta, ax_ptpair}, true); + histos.add("hSparseLambdaLambda", "hSparseLambdaLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisR}, true); histos.add("hSparseLambdaAntiLambda", "hSparseLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisR}, true); histos.add("hSparseAntiLambdaLambda", "hSparseAntiLambdLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisR}, true); @@ -151,37 +180,38 @@ struct lambdaspincorrderived { histos.add("hSparseLambdaAntiLambdaMixed", "hSparseLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisR}, true); histos.add("hSparseAntiLambdaLambdaMixed", "hSparseAntiLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisR}, true); histos.add("hSparseAntiLambdaAntiLambdaMixed", "hSparseAntiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisR}, true); - - histos.add("hSparseRapLambdaLambda", "hSparseRapLambdaLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); - histos.add("hSparseRapLambdaAntiLambda", "hSparseRapLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); - histos.add("hSparseRapAntiLambdaLambda", "hSparseRapAntiLambdLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); - histos.add("hSparseRapAntiLambdaAntiLambda", "hSparseRapAntiLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); - - histos.add("hSparseRapLambdaLambdaMixed", "hSparseRapLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); - histos.add("hSparseRapLambdaAntiLambdaMixed", "hSparseRapLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); - histos.add("hSparseRapAntiLambdaLambdaMixed", "hSparseRapAntiLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); - histos.add("hSparseRapAntiLambdaAntiLambdaMixed", "hSparseRapAntiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); - - histos.add("hSparsePhiLambdaLambda", "hSparsePhiLambdaLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, ax_dphi_h}, true); - histos.add("hSparsePhiLambdaAntiLambda", "hSparsePhiLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, ax_dphi_h}, true); - histos.add("hSparsePhiAntiLambdaLambda", "hSparsePhiAntiLambdLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, ax_dphi_h}, true); - histos.add("hSparsePhiAntiLambdaAntiLambda", "hSparsePhiAntiLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, ax_dphi_h}, true); - - histos.add("hSparsePhiLambdaLambdaMixed", "hSparsePhiLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, ax_dphi_h}, true); - histos.add("hSparsePhiLambdaAntiLambdaMixed", "hSparsePhiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, ax_dphi_h}, true); - histos.add("hSparsePhiAntiLambdaLambdaMixed", "hSparsePhiAntiLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, ax_dphi_h}, true); - histos.add("hSparsePhiAntiLambdaAntiLambdaMixed", "hSparsePhiAntiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, ax_dphi_h}, true); - - histos.add("hSparsePairMassLambdaLambda", "hSparsePairMassLambdaLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); - histos.add("hSparsePairMassLambdaAntiLambda", "hSparsePairMassLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); - histos.add("hSparsePairMassAntiLambdaLambda", "hSparsePairMassAntiLambdLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); - histos.add("hSparsePairMassAntiLambdaAntiLambda", "hSparsePairMassAntiLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); - - histos.add("hSparsePairMassLambdaLambdaMixed", "hSparsePairMassLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); - histos.add("hSparsePairMassLambdaAntiLambdaMixed", "hSparsePairMassLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); - histos.add("hSparsePairMassAntiLambdaLambdaMixed", "hSparsePairMassAntiLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); - histos.add("hSparsePairMassAntiLambdaAntiLambdaMixed", "hSparsePairMassAntiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); - + if (useAdditionalHisto) { + histos.add("hSparseRapLambdaLambda", "hSparseRapLambdaLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); + histos.add("hSparseRapLambdaAntiLambda", "hSparseRapLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); + histos.add("hSparseRapAntiLambdaLambda", "hSparseRapAntiLambdLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); + histos.add("hSparseRapAntiLambdaAntiLambda", "hSparseRapAntiLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); + + histos.add("hSparseRapLambdaLambdaMixed", "hSparseRapLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); + histos.add("hSparseRapLambdaAntiLambdaMixed", "hSparseRapLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); + histos.add("hSparseRapAntiLambdaLambdaMixed", "hSparseRapAntiLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); + histos.add("hSparseRapAntiLambdaAntiLambdaMixed", "hSparseRapAntiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisRapidity}, true); + + histos.add("hSparsePhiLambdaLambda", "hSparsePhiLambdaLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, ax_dphi_h}, true); + histos.add("hSparsePhiLambdaAntiLambda", "hSparsePhiLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, ax_dphi_h}, true); + histos.add("hSparsePhiAntiLambdaLambda", "hSparsePhiAntiLambdLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, ax_dphi_h}, true); + histos.add("hSparsePhiAntiLambdaAntiLambda", "hSparsePhiAntiLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, ax_dphi_h}, true); + + histos.add("hSparsePhiLambdaLambdaMixed", "hSparsePhiLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, ax_dphi_h}, true); + histos.add("hSparsePhiLambdaAntiLambdaMixed", "hSparsePhiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, ax_dphi_h}, true); + histos.add("hSparsePhiAntiLambdaLambdaMixed", "hSparsePhiAntiLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, ax_dphi_h}, true); + histos.add("hSparsePhiAntiLambdaAntiLambdaMixed", "hSparsePhiAntiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, ax_dphi_h}, true); + + histos.add("hSparsePairMassLambdaLambda", "hSparsePairMassLambdaLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); + histos.add("hSparsePairMassLambdaAntiLambda", "hSparsePairMassLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); + histos.add("hSparsePairMassAntiLambdaLambda", "hSparsePairMassAntiLambdLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); + histos.add("hSparsePairMassAntiLambdaAntiLambda", "hSparsePairMassAntiLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); + + histos.add("hSparsePairMassLambdaLambdaMixed", "hSparsePairMassLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); + histos.add("hSparsePairMassLambdaAntiLambdaMixed", "hSparsePairMassLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); + histos.add("hSparsePairMassAntiLambdaLambdaMixed", "hSparsePairMassAntiLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); + histos.add("hSparsePairMassAntiLambdaAntiLambdaMixed", "hSparsePairMassAntiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisPairMass}, true); + } + rng.seed(static_cast(rngSeed.value)); ccdb->setURL(cfgCcdbParam.cfgURL); ccdbApi.init("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); @@ -193,6 +223,11 @@ struct lambdaspincorrderived { hweight2 = ccdb->getForTimeStamp(ConfWeightPathLAL.value, cfgCcdbParam.nolaterthan.value); hweight3 = ccdb->getForTimeStamp(ConfWeightPathALL.value, cfgCcdbParam.nolaterthan.value); hweight4 = ccdb->getForTimeStamp(ConfWeightPathALAL.value, cfgCcdbParam.nolaterthan.value); + + hweight12 = ccdb->getForTimeStamp(ConfWeightPathLL2.value, cfgCcdbParam.nolaterthan.value); + hweight22 = ccdb->getForTimeStamp(ConfWeightPathLAL2.value, cfgCcdbParam.nolaterthan.value); + hweight32 = ccdb->getForTimeStamp(ConfWeightPathALL2.value, cfgCcdbParam.nolaterthan.value); + hweight42 = ccdb->getForTimeStamp(ConfWeightPathALAL2.value, cfgCcdbParam.nolaterthan.value); } } @@ -203,6 +238,9 @@ struct lambdaspincorrderived { if (std::abs(particle.Rapidity()) > rapidity || std::abs(particle.Eta()) > v0eta) { return false; } + if (candidate.lambdaMass() < MassMin || candidate.lambdaMass() > MassMax) { + return false; + } if (candidate.v0Cospa() < cosPA) { return false; } @@ -333,6 +371,7 @@ struct lambdaspincorrderived { double dphi1 = RecoDecay::constrainAngle(particle1.Phi(), 0.0F, harmonic); double deta1 = particle1.Eta(); + double pt2 = particle2.Pt(); double dphi2 = RecoDecay::constrainAngle(particle2.Phi(), 0.0F, harmonic); double deta2 = particle2.Eta(); @@ -342,17 +381,22 @@ struct lambdaspincorrderived { double deltaR = TMath::Sqrt(deta_pair * deta_pair + dphi_pair * dphi_pair); double deltaRap = std::abs(particle1.Rapidity() - particle2.Rapidity()); - double epsWeight = 1.0; + double epsWeight1 = 1.0; + double epsWeight2 = 1.0; if (useweight && datatype == 1) { if (tag1 == 0 && tag2 == 0) { - epsWeight = hweight1->GetBinContent(hweight1->FindBin(dphi1, deta1, pt1)); + epsWeight1 = hweight1->GetBinContent(hweight1->FindBin(dphi1, deta1, pt1)); + epsWeight2 = hweight2->GetBinContent(hweight12->FindBin(dphi2, deta2, pt2)); } else if (tag1 == 0 && tag2 == 1) { - epsWeight = hweight2->GetBinContent(hweight2->FindBin(dphi1, deta1, pt1)); + epsWeight1 = hweight2->GetBinContent(hweight2->FindBin(dphi1, deta1, pt1)); + epsWeight2 = hweight22->GetBinContent(hweight22->FindBin(dphi2, deta2, pt2)); } else if (tag1 == 1 && tag2 == 0) { - epsWeight = hweight3->GetBinContent(hweight3->FindBin(dphi1, deta1, pt1)); + epsWeight1 = hweight3->GetBinContent(hweight3->FindBin(dphi1, deta1, pt1)); + epsWeight2 = hweight32->GetBinContent(hweight32->FindBin(dphi2, deta2, pt2)); } else if (tag1 == 1 && tag2 == 1) { - epsWeight = hweight4->GetBinContent(hweight4->FindBin(dphi1, deta1, pt1)); + epsWeight1 = hweight4->GetBinContent(hweight4->FindBin(dphi1, deta1, pt1)); + epsWeight2 = hweight42->GetBinContent(hweight42->FindBin(dphi2, deta2, pt2)); } } @@ -360,64 +404,91 @@ struct lambdaspincorrderived { mixpairweight = 1.0; histos.fill(HIST("hPtYSame"), particle1.Pt(), particle1.Rapidity(), mixpairweight); if (tag1 == 0 && tag2 == 0) { - histos.fill(HIST("hSparseLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); - histos.fill(HIST("hSparseRapLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); - histos.fill(HIST("hSparsePhiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, dphi_pair, mixpairweight); - histos.fill(HIST("hSparsePairMassLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), mixpairweight); histos.fill(HIST("SE_LL"), dphi1, deta1, pt1, mixpairweight); + histos.fill(HIST("SE_LL2"), dphi2, deta2, pt2, mixpairweight); + histos.fill(HIST("hSparseLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); + if (useAdditionalHisto) { + histos.fill(HIST("hSparseRapLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); + histos.fill(HIST("hSparsePhiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, dphi_pair, mixpairweight); + histos.fill(HIST("hSparsePairMassLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), mixpairweight); + } } else if (tag1 == 0 && tag2 == 1) { - histos.fill(HIST("hSparseLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); - histos.fill(HIST("hSparseRapLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); - histos.fill(HIST("hSparsePhiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, dphi_pair, mixpairweight); - histos.fill(HIST("hSparsePairMassLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), mixpairweight); histos.fill(HIST("SE_LAL"), dphi1, deta1, pt1, mixpairweight); + histos.fill(HIST("SE_LAL2"), dphi2, deta2, pt2, mixpairweight); + histos.fill(HIST("hSparseLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); + if (useAdditionalHisto) { + histos.fill(HIST("hSparseRapLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); + histos.fill(HIST("hSparsePhiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, dphi_pair, mixpairweight); + histos.fill(HIST("hSparsePairMassLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), mixpairweight); + } } else if (tag1 == 1 && tag2 == 0) { histos.fill(HIST("hSparseAntiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); - histos.fill(HIST("hSparseRapAntiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); - histos.fill(HIST("hSparsePhiAntiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, dphi_pair, mixpairweight); - histos.fill(HIST("hSparsePairMassAntiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), mixpairweight); histos.fill(HIST("SE_ALL"), dphi1, deta1, pt1, mixpairweight); + histos.fill(HIST("SE_ALL2"), dphi2, deta2, pt2, mixpairweight); + if (useAdditionalHisto) { + histos.fill(HIST("hSparseRapAntiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); + histos.fill(HIST("hSparsePhiAntiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, dphi_pair, mixpairweight); + histos.fill(HIST("hSparsePairMassAntiLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), mixpairweight); + } } else if (tag1 == 1 && tag2 == 1) { histos.fill(HIST("hSparseAntiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, mixpairweight); - histos.fill(HIST("hSparseRapAntiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); - histos.fill(HIST("hSparsePhiAntiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, dphi_pair, mixpairweight); - histos.fill(HIST("hSparsePairMassAntiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), mixpairweight); histos.fill(HIST("SE_ALAL"), dphi1, deta1, pt1, mixpairweight); + histos.fill(HIST("SE_ALAL2"), dphi2, deta2, pt2, mixpairweight); + if (useAdditionalHisto) { + histos.fill(HIST("hSparseRapAntiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, mixpairweight); + histos.fill(HIST("hSparsePhiAntiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, dphi_pair, mixpairweight); + histos.fill(HIST("hSparsePairMassAntiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), mixpairweight); + } } } else if (datatype == 1) { double weight = mixpairweight; - weight = mixpairweight / epsWeight; + if (useweight) { + if (usebothweight) { + weight = mixpairweight / (epsWeight1 * epsWeight2); + } else { + weight = mixpairweight / (epsWeight1); + } + } if (weight <= 0.0) { weight = 1.0; } + histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight); if (tag1 == 0 && tag2 == 0) { - histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight); - histos.fill(HIST("hSparseLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); - histos.fill(HIST("hSparseRapLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); - histos.fill(HIST("hSparsePhiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, dphi_pair, weight); - histos.fill(HIST("hSparsePairMassLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), weight); histos.fill(HIST("ME_LL"), dphi1, deta1, pt1, mixpairweight); + histos.fill(HIST("ME_LL2"), dphi2, deta2, pt2, mixpairweight); + histos.fill(HIST("hSparseLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); + if (useAdditionalHisto) { + histos.fill(HIST("hSparseRapLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); + histos.fill(HIST("hSparsePhiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, dphi_pair, weight); + histos.fill(HIST("hSparsePairMassLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), weight); + } } else if (tag1 == 0 && tag2 == 1) { - histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight); - histos.fill(HIST("hSparseLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); - histos.fill(HIST("hSparseRapLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); - histos.fill(HIST("hSparsePhiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, dphi_pair, weight); - histos.fill(HIST("hSparsePairMassLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), weight); histos.fill(HIST("ME_LAL"), dphi1, deta1, pt1, mixpairweight); + histos.fill(HIST("ME_LAL2"), dphi2, deta2, pt2, mixpairweight); + histos.fill(HIST("hSparseLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); + if (useAdditionalHisto) { + histos.fill(HIST("hSparseRapLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); + histos.fill(HIST("hSparsePhiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, dphi_pair, weight); + histos.fill(HIST("hSparsePairMassLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), weight); + } } else if (tag1 == 1 && tag2 == 0) { - histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight); - histos.fill(HIST("hSparseAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); - histos.fill(HIST("hSparseRapAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); - histos.fill(HIST("hSparsePhiAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, dphi_pair, weight); - histos.fill(HIST("hSparsePairMassAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), weight); histos.fill(HIST("ME_ALL"), dphi1, deta1, pt1, mixpairweight); + histos.fill(HIST("ME_ALL2"), dphi2, deta2, pt2, mixpairweight); + histos.fill(HIST("hSparseAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); + if (useAdditionalHisto) { + histos.fill(HIST("hSparseRapAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); + histos.fill(HIST("hSparsePhiAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, dphi_pair, weight); + histos.fill(HIST("hSparsePairMassAntiLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), weight); + } } else if (tag1 == 1 && tag2 == 1) { - histos.fill(HIST("hPtYMix"), particle1.Pt(), particle1.Rapidity(), weight); - histos.fill(HIST("hSparseAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); - histos.fill(HIST("hSparseRapAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); - histos.fill(HIST("hSparsePhiAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, dphi_pair, weight); - histos.fill(HIST("hSparsePairMassAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), weight); histos.fill(HIST("ME_ALAL"), dphi1, deta1, pt1, mixpairweight); + histos.fill(HIST("ME_ALAL2"), dphi2, deta2, pt2, mixpairweight); + histos.fill(HIST("hSparseAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaR, weight); + if (useAdditionalHisto) { + histos.fill(HIST("hSparseRapAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, deltaRap, weight); + histos.fill(HIST("hSparsePhiAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, dphi_pair, weight); + histos.fill(HIST("hSparsePairMassAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, pairDummy.M(), weight); + } } } } @@ -738,6 +809,236 @@ struct lambdaspincorrderived { } } PROCESS_SWITCH(lambdaspincorrderived, processMEV3, "Process data ME (first-leg, pair-3D maps)", false); + + static constexpr int N_STATUS = 2; // v0Status ∈ {0,1} + + struct MixBinner { + // constructed from the task's configurables; φ is assumed already constrained into [0, 2π) + float ptMin, ptMax, ptStep; + float etaMin, etaMax, etaStep; + float phiMin, phiMax, phiStep; + + // Mass binning: [1.09, 1.14) with 50 bins (1e-3 GeV/c^2) + static constexpr float mMin = 1.09f; + static constexpr float mMax = 1.14f; // exclusive + static constexpr int nM_ = 1; + static constexpr float mStep = (mMax - mMin) / nM_; + + int nPt_, nEta_, nPhi_; + + MixBinner(float ptMin_, float ptMax_, float ptStep_, + float etaAbsMax, float etaStep_, + float phiStep_) + : ptMin(ptMin_), ptMax(ptMax_), ptStep(ptStep_), etaMin(-etaAbsMax), etaMax(+etaAbsMax), etaStep(etaStep_), phiMin(0.f), phiMax(static_cast(2.0 * TMath::Pi())), phiStep(phiStep_) + { + ptStep = (ptStep > 0.f ? ptStep : 0.1f); + etaStep = (etaStep > 0.f ? etaStep : 0.1f); + phiStep = (phiStep > 0.f ? phiStep : 0.1f); + + nPt_ = std::max(1, static_cast(std::floor((ptMax - ptMin) / ptStep + 0.5f))); + nEta_ = std::max(1, static_cast(std::floor((etaMax - etaMin) / etaStep + 0.5f))); + nPhi_ = std::max(1, static_cast(std::ceil((phiMax - phiMin) / phiStep))); + } + + inline int nPt() const { return nPt_; } + inline int nEta() const { return nEta_; } + inline int nPhi() const { return nPhi_; } + inline int nM() const { return nM_; } + + inline int binFromValue(float v, float vmin, float step, int nBins) const + { + if (!std::isfinite(v)) + return -1; + const float x = (v - vmin) / step; + int b = static_cast(std::floor(x + 1e-6f)); + if (b < 0) + return -1; + if (b >= nBins) + b = nBins - 1; // clamp exact-top edge + return b; + } + + inline int ptBin(float pt) const { return binFromValue(pt, ptMin, ptStep, nPt_); } + inline int etaBin(float eta) const { return binFromValue(eta, etaMin, etaStep, nEta_); } + inline int phiBin(float phi) const { return binFromValue(phi, phiMin, phiStep, nPhi_); } // φ already constrained upstream + inline int massBin(float m) const { return binFromValue(m, mMin, mStep, nM_); } + }; + + struct BufferCand { + int64_t collisionIdx; // from col.index() + int64_t rowIndex; // global row id in V0s + uint8_t v0Status; + uint16_t ptBin, etaBin, phiBin, mBin; + }; + + struct MatchRef { + int64_t collisionIdx; + int64_t rowIndex; + }; + + // 6D key: (colBin, status, pt, eta, phi, mass) + static inline size_t linearKey(int colBin, int statBin, + int ptBin, int etaBin, int phiBin, int mBin, + int nStatus, int nPt, int nEta, int nPhi, int nM) + { + return ((((((static_cast(colBin) * nStatus + statBin) * nPt + ptBin) * nEta + etaBin) * nPhi + phiBin) * nM + mBin)); + } + + // ===================== Main mixing (with mass-bin + random unique sampling) ===================== + void processMEV4(EventCandidates const& collisions, AllTrackCandidates const& V0s) + { + // Build binner from your existing configurables + MixBinner mb{ + ptMin.value, ptMax.value, ptMix.value, // pT range & step + v0eta.value, etaMix.value, // |eta| max & step + phiMix.value // φ step; φ range fixed to [0, 2π) + }; + + const int nCol = colBinning.getAllBinsCount(); // event-class bins (vz, centrality) + const int nStat = N_STATUS; // 2 + const int nPt = mb.nPt(); + const int nEta = mb.nEta(); + const int nPhi = mb.nPhi(); + const int nM = mb.nM(); + + const size_t nKeys = static_cast(nCol) * nStat * nPt * nEta * nPhi * nM; + std::vector> buffer(nKeys); + + // ---- PASS 1: fill 6D buffer ---- + for (auto const& col : collisions) { + const int colBin = colBinning.getBin(std::make_tuple(col.posz(), col.cent())); + auto slice = V0s.sliceBy(tracksPerCollisionV0, col.index()); + + for (auto const& t : slice) { + if (!selectionV0(t)) + continue; + + const int status = static_cast(t.v0Status()); + if (status < 0 || status >= nStat) + continue; + + // Bin kinematics (φ already constrained via your call-site) + const int ptB = mb.ptBin(t.lambdaPt()); + const int etaB = mb.etaBin(t.lambdaEta()); + const int phiB = mb.phiBin(RecoDecay::constrainAngle(t.lambdaPhi(), 0.0F, harmonic)); + const int mB = mb.massBin(t.lambdaMass()); + if (ptB < 0 || etaB < 0 || phiB < 0 || mB < 0) + continue; + + const size_t key = linearKey(colBin, status, ptB, etaB, phiB, mB, + nStat, nPt, nEta, nPhi, nM); + + buffer[key].push_back(BufferCand{ + .collisionIdx = static_cast(col.index()), + .rowIndex = static_cast(t.globalIndex()), // adapt accessor if needed + .v0Status = static_cast(status), + .ptBin = static_cast(ptB), + .etaBin = static_cast(etaB), + .phiBin = static_cast(phiB), + .mBin = static_cast(mB)}); + } + } + + // ---- PASS 2: mixing over same-event pairs ---- + for (auto const& collision1 : collisions) { + const int colBin = colBinning.getBin(std::make_tuple(collision1.posz(), collision1.cent())); + auto poolA = V0s.sliceBy(tracksPerCollisionV0, collision1.index()); + + for (auto const& [t1, t2] : + soa::combinations(o2::soa::CombinationsFullIndexPolicy(poolA, poolA))) { + + if (!selectionV0(t1) || !selectionV0(t2)) + continue; + if (t2.index() <= t1.index()) + continue; + + // no shared daughters + if (t1.protonIndex() == t2.protonIndex()) + continue; + if (t1.pionIndex() == t2.pionIndex()) + continue; + if (t1.protonIndex() == t2.pionIndex()) + continue; + if (t1.pionIndex() == t2.protonIndex()) + continue; + + const int status = static_cast(t1.v0Status()); + if (status < 0 || status >= nStat) + continue; + + // Bin of t1 defines where to search (exact 6D bin) + const int ptB = mb.ptBin(t1.lambdaPt()); + const int etaB = mb.etaBin(t1.lambdaEta()); + const int phiB = mb.phiBin(RecoDecay::constrainAngle(t1.lambdaPhi(), 0.0F, harmonic)); // φ already constrained upstream + const int mB = mb.massBin(t1.lambdaMass()); + if (ptB < 0 || etaB < 0 || phiB < 0 || mB < 0) + continue; + + const size_t key = linearKey(colBin, status, ptB, etaB, phiB, mB, + nStat, nPt, nEta, nPhi, nM); + auto const& binVec = buffer[key]; + if (binVec.empty()) + continue; + + // Collect all partners from this 6D bin but different collision + std::vector matches; + matches.reserve(binVec.size()); + const int64_t curColIdx = static_cast(collision1.index()); + + for (const auto& bc : binVec) { + if (bc.collisionIdx == curColIdx) + continue; // ensure different event + matches.push_back(MatchRef{bc.collisionIdx, bc.rowIndex}); + } + if (matches.empty()) + continue; + + // ---------- YOUR PREFERRED RANDOM UNIQUE SAMPLING BLOCK ---------- + const int cap = nEvtMixing.value; + const int n = static_cast(matches.size()); + if (cap > 0 && cap < n) { + std::uniform_int_distribution dist(0, n - 1); + // pick cap unique indices + std::unordered_set chosen; + chosen.reserve(cap * 2); + while ((int)chosen.size() < cap) { + chosen.insert(dist(rng)); + } + std::vector subset; + subset.reserve(cap); + for (int idx : chosen) + subset.push_back(matches[idx]); + matches.swap(subset); + } else { + std::shuffle(matches.begin(), matches.end(), rng); + } + // ---------------------------------------------------------------- + + const float wBase = 1.0f / static_cast(matches.size()); + + // Emit mixed pairs: tX replaces t1; keep t2 + for (const auto& m : matches) { + auto tX = V0s.iteratorAt(m.rowIndex); // replace accessor if different + if (!selectionV0(tX)) + continue; // optional extra guard + if (!checkKinematics(t1, tX)) + continue; + + auto proton = ROOT::Math::PtEtaPhiMVector(tX.protonPt(), tX.protonEta(), tX.protonPhi(), o2::constants::physics::MassProton); + auto lambda = ROOT::Math::PtEtaPhiMVector(tX.lambdaPt(), tX.lambdaEta(), tX.lambdaPhi(), tX.lambdaMass()); + auto proton2 = ROOT::Math::PtEtaPhiMVector(t2.protonPt(), t2.protonEta(), t2.protonPhi(), o2::constants::physics::MassProton); + auto lambda2 = ROOT::Math::PtEtaPhiMVector(t2.lambdaPt(), t2.lambdaEta(), t2.lambdaPhi(), t2.lambdaMass()); + + const float dPhi = std::fabs( + RecoDecay::constrainAngle(lambda.Phi(), 0.0F, harmonic) - + RecoDecay::constrainAngle(lambda2.Phi(), 0.0F, harmonic)); + histos.fill(HIST("deltaPhiMix"), dPhi, wBase); + fillHistograms(tX.v0Status(), t2.v0Status(), lambda, lambda2, proton, proton2, 1, wBase); + } + } + } + } + PROCESS_SWITCH(lambdaspincorrderived, processMEV4, "Process data ME (5d buffer)", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { From d65af686170a4e619dc74e581791d6721f712f41 Mon Sep 17 00:00:00 2001 From: Deependra Sharma <38365215+deependra170598@users.noreply.github.com> Date: Fri, 17 Oct 2025 21:30:27 +0530 Subject: [PATCH 793/986] [PWGHF/D2H] Investigation of D0ToPiKPi0 contribution in D* prompt fraction (#13307) --- PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx | 55 +++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx b/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx index 35b9f9dee4a..f5a3884f5fa 100644 --- a/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx +++ b/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx @@ -59,6 +59,7 @@ struct HfTaskDstarToD0Pi { Configurable selectionFlagDstarToD0Pi{"selectionFlagDstarToD0Pi", true, "Selection Flag for D* decay to D0 & Pi"}; Configurable isCentStudy{"isCentStudy", true, "Flag to select centrality study"}; Configurable qaEnabled{"qaEnabled", true, "Flag to enable QA histograms"}; + Configurable studyD0ToPiKPi0{"studyD0ToPiKPi0", false, "Flag to study D*->D0(piKpi0)pi channel"}; // CCDB configuration Configurable useWeight{"useWeight", true, "Flag to use weights from CCDB"}; @@ -262,6 +263,28 @@ struct HfTaskDstarToD0Pi { } } + if (studyD0ToPiKPi0) { + // inclusive D0ToPiKPi0 study + if (doprocessMcWML && isCentStudy) { + registry.add("D0ToPiKPi0/hDeltaInvMassVsPtVsCentVsBDTScore", "#Delta #it{M}_{inv} Vs Pt Vs Cent Vs BDTScore for D0ToPiKPi0", {HistType::kTHnSparseF, {{axisDeltaInvMass}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {axisCentrality}, {axisBDTScoreBackground}, {axisBDTScorePrompt}, {axisBDTScoreNonPrompt}}}, true); + } else if (doprocessMcWoMl && isCentStudy) { + registry.add("D0ToPiKPi0/hDeltaInvMassDstar3D", "#Delta #it{M}_{inv} D* Candidate for D0ToPiKPi0; inv. mass ((#pi #pi k) - (#pi k)) (GeV/#it{c}^{2});#it{p}_{T} (GeV/#it{c}); FT0M centrality", {HistType::kTH3F, {{axisDeltaInvMass}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {axisCentrality}}}, true); + } else if (doprocessMcWML && !isCentStudy) { + registry.add("D0ToPiKPi0/hDeltaInvMassVsPtVsBDTScore", "#Delta #it{M}_{inv} Vs Pt Vs BDTScore for D0ToPiKPi0", {HistType::kTHnSparseF, {{axisDeltaInvMass}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {axisBDTScoreBackground}, {axisBDTScorePrompt}, {axisBDTScoreNonPrompt}}}, true); + } else if (doprocessMcWoMl && !isCentStudy) { + registry.add("D0ToPiKPi0/hDeltaInvMassDstar2D", "#Delta #it{M}_{inv} D* Candidate for D0ToPiKPi0; inv. mass ((#pi #pi k) - (#pi k)) (GeV/#it{c}^{2});#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{axisDeltaInvMass}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}, true); + } + + // differential (prompt/Non-prompt) D0ToPiKPi0 study + if (doprocessMcWML) { + registry.add("D0ToPiKPi0/hPromptDeltaInvMassVsPtVsBDTScore", "Prompt #Delta #it{M}_{inv} Vs Pt Vs BDTScore for D0ToPiKPi0", {HistType::kTHnSparseF, {{axisDeltaInvMass}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {axisBDTScoreBackground}, {axisBDTScorePrompt}, {axisBDTScoreNonPrompt}}}, true); + registry.add("D0ToPiKPi0/hNonPromptDeltaInvMassVsPtVsBDTScore", "Non-Prompt #Delta #it{M}_{inv} Vs Pt Vs BDTScore for D0ToPiKPi0", {HistType::kTHnSparseF, {{axisDeltaInvMass}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {axisBDTScoreBackground}, {axisBDTScorePrompt}, {axisBDTScoreNonPrompt}}}, true); + } else if (doprocessMcWoMl) { + registry.add("D0ToPiKPi0/hPromptDeltaInvMassDstar2D", "Prompt #Delta #it{M}_{inv} D* Candidate for D0ToPiKPi0; inv. mass ((#pi #pi k) - (#pi k)) (GeV/#it{c}^{2});#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{axisDeltaInvMass}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}, true); + registry.add("D0ToPiKPi0/hNonPromptDeltaInvMassDstar2D", "Non-Prompt #Delta #it{M}_{inv} D* Candidate for D0ToPiKPi0; inv. mass ((#pi #pi k) - (#pi k)) (GeV/#it{c}^{2});#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{axisDeltaInvMass}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}, true); + } + } + // if weights to be applied if (useWeight) { ccdbApi.init(ccdbUrl); @@ -542,6 +565,38 @@ struct HfTaskDstarToD0Pi { } } } + } else if (studyD0ToPiKPi0 && candDstarMcRec.isSelDstarToD0Pi() && (std::abs(candDstarMcRec.flagMcMatchRec()) == hf_decay::hf_cand_dstar::DecayChannelMain::DstarToPiKPiPi0) && (std::abs(candDstarMcRec.flagMcMatchRecD0()) == hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiKPi0)) { + // Aplly all selection to study D*->D0(piKpi0)pi channel same as signal channel + // MC Matched but to D*->D0(piKpi0)pi channel + auto deltaMDstar = std::abs(candDstarMcRec.invMassDstar() - candDstarMcRec.invMassD0()); + if constexpr (ApplyMl) { + auto bdtScore = candDstarMcRec.mlProbDstarToD0Pi(); + // inclusive study + if (isCentStudy) { + registry.fill(HIST("D0ToPiKPi0/hDeltaInvMassVsPtVsCentVsBDTScore"), deltaMDstar, candDstarMcRec.pt(), centrality, bdtScore[0], bdtScore[1], bdtScore[2]); + } else { + registry.fill(HIST("D0ToPiKPi0/hDeltaInvMassVsPtVsBDTScore"), deltaMDstar, candDstarMcRec.pt(), bdtScore[0], bdtScore[1], bdtScore[2]); + } + // differential (prompt/Non-prompt) study + if (candDstarMcRec.originMcRec() == RecoDecay::OriginType::Prompt) { + registry.fill(HIST("D0ToPiKPi0/hPromptDeltaInvMassVsPtVsBDTScore"), deltaMDstar, candDstarMcRec.pt(), bdtScore[0], bdtScore[1], bdtScore[2]); + } else if (candDstarMcRec.originMcRec() == RecoDecay::OriginType::NonPrompt) { + registry.fill(HIST("D0ToPiKPi0/hNonPromptDeltaInvMassVsPtVsBDTScore"), deltaMDstar, candDstarMcRec.pt(), bdtScore[0], bdtScore[1], bdtScore[2]); + } + } else { // without ML + // inclusive study + if (isCentStudy) { + registry.fill(HIST("D0ToPiKPi0/hDeltaInvMassDstar3D"), deltaMDstar, candDstarMcRec.pt(), centrality); + } else { + registry.fill(HIST("D0ToPiKPi0/hDeltaInvMassDstar2D"), deltaMDstar, candDstarMcRec.pt()); + } + // differential (prompt/Non-prompt) study + if (candDstarMcRec.originMcRec() == RecoDecay::OriginType::Prompt) { + registry.fill(HIST("D0ToPiKPi0/hPromptDeltaInvMassDstar2D"), deltaMDstar, candDstarMcRec.pt()); + } else if (candDstarMcRec.originMcRec() == RecoDecay::OriginType::NonPrompt) { + registry.fill(HIST("D0ToPiKPi0/hNonPromptDeltaInvMassDstar2D"), deltaMDstar, candDstarMcRec.pt()); + } + } } else { // MC Unmatched (Baground at Reconstruction Level) if (qaEnabled) { registry.fill(HIST("QA/hCPASkimD0RecBg"), candDstarMcRec.cpaD0()); From 605336aaefe39603cd64cc3c8172ac9743ca5a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?BiaoZhang=20=28=E5=BC=A0=E5=BD=AA=29?= <52267892+zhangbiao-phy@users.noreply.github.com> Date: Fri, 17 Oct 2025 18:41:08 +0200 Subject: [PATCH 794/986] [PWGHF] Fix potential bug in Dstar candidate selection in debug mode (#13436) Co-authored-by: ALICE Action Bot --- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index 8bc26864059..f95eb86a58a 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -1884,9 +1884,8 @@ struct HfTrackIndexSkimCreator { isSelected = 0; if (config.debug) { CLRBIT(cutStatus, 0); - } else { - return isSelected; } + return isSelected; } // D0 mass From ae0dc8baecb5ae38cf9fee8d4235a3156230879f Mon Sep 17 00:00:00 2001 From: Ravindra Singh <56298081+singhra1994@users.noreply.github.com> Date: Fri, 17 Oct 2025 18:46:52 +0200 Subject: [PATCH 795/986] [PWGHF] Fixed the issue of timeout for V0 process (#13421) Co-authored-by: ALICE Action Bot --- .../TableProducer/correlatorLcScHadrons.cxx | 196 +++++++++--------- 1 file changed, 102 insertions(+), 94 deletions(-) diff --git a/PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx index e7557429c3a..bf1b3b1aa0b 100644 --- a/PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx @@ -93,6 +93,19 @@ struct HfCorrelatorLcScHadronsSelection { Configurable yCandMax{"yCandMax", 0.8, "max. cand. rapidity"}; Configurable ptCandMin{"ptCandMin", 1., "min. cand. pT"}; + struct : ConfigurableGroup { + Configurable cfgV0radiusMin{"cfgV0radiusMin", 1.2, "minimum decay radius"}; + Configurable cfgDCAPosToPVMin{"cfgDCAPosToPVMin", 0.05, "minimum DCA to PV for positive track"}; + Configurable cfgDCANegToPVMin{"cfgDCANegToPVMin", 0.2, "minimum DCA to PV for negative track"}; + Configurable cfgV0CosPA{"cfgV0CosPA", 0.995, "minimum v0 cosine"}; + Configurable cfgDCAV0Dau{"cfgDCAV0Dau", 1.0, "maximum DCA between daughters"}; + Configurable cfgV0PtMin{"cfgV0PtMin", 0, "minimum pT for lambda"}; + Configurable cfgV0LifeTime{"cfgV0LifeTime", 30., "maximum lambda lifetime"}; + Configurable cfgPV{"cfgPV", 10., "maximum z-vertex"}; + Configurable cfgMaxOccupancy{"cfgMaxOccupancy", 999999, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; + Configurable cfgMinOccupancy{"cfgMinOccupancy", 0, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; + } cfgV0; + HfHelper hfHelper; SliceCache cache; @@ -172,7 +185,88 @@ struct HfCorrelatorLcScHadronsSelection { candSel(isCandFound); } + template + bool selectionV0(TCollision const& collision, V0 const& candidate) + { + if (candidate.v0radius() < cfgV0.cfgV0radiusMin) { + return false; + } + if (std::abs(candidate.dcapostopv()) < cfgV0.cfgDCAPosToPVMin) { + return false; + } + if (std::abs(candidate.dcanegtopv()) < cfgV0.cfgDCANegToPVMin) { + return false; + } + if (candidate.v0cosPA() < cfgV0.cfgV0CosPA) { + return false; + } + if (std::abs(candidate.dcaV0daughters()) > cfgV0.cfgDCAV0Dau) { + return false; + } + if (candidate.pt() < cfgV0.cfgV0PtMin) { + return false; + } + if (std::abs(candidate.yLambda()) > yCandMax) { + return false; + } + if (candidate.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda > cfgV0.cfgV0LifeTime) { + return false; + } + + return true; + } + + template + bool eventSelV0(TCollision collision) + { + if (!collision.sel8()) { + return 0; + } + + if (!collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + return 0; + } + if (!collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { + return 0; + } + if (std::abs(collision.posZ()) > cfgV0.cfgPV) { + return 0; + } + if (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return 0; + } + if (collision.trackOccupancyInTimeRange() > cfgV0.cfgMaxOccupancy || collision.trackOccupancyInTimeRange() < cfgV0.cfgMinOccupancy) { + return 0; + } + + return 1; + } // event selection V0 + /// Code to select collisions with at least one Lc - for real data and data-like analysis + void processV0Selection(SelCollisions::iterator const& collision, + aod::V0Datas const& V0s) + { + bool isCandFound = false; + const int64_t kMinV0Candidates = 1; + + if (!eventSelV0(collision)) { + candSel(isCandFound); + return; + } + if (V0s.size() < kMinV0Candidates) { + candSel(isCandFound); + return; + } + for (const auto& v0 : V0s) { + if (selectionV0(collision, v0)) { + isCandFound = true; + break; + } + } + candSel(isCandFound); + } + PROCESS_SWITCH(HfCorrelatorLcScHadronsSelection, processV0Selection, "Process V0 Collision Selection for Data", true); + void processLcSelection(SelCollisions::iterator const& collision, CandsLcDataFiltered const& candidates) { @@ -274,24 +368,12 @@ struct HfCorrelatorLcScHadrons { Configurable cfgDaughPIDCutsTPCPr{"cfgDaughPIDCutsTPCPr", 3., "max. TPCnSigma Proton"}; Configurable cfgDaughPIDCutsTPCPi{"cfgDaughPIDCutsTPCPi", 2., "max. TPCnSigma Pion"}; Configurable cfgDaughPIDCutsTOFPi{"cfgDaughPIDCutsTOFPi", 2., "max. TOFnSigma Pion"}; - - Configurable cfgV0radiusMin{"cfgV0radiusMin", 1.2, "minimum decay radius"}; - Configurable cfgDCAPosToPVMin{"cfgDCAPosToPVMin", 0.05, "minimum DCA to PV for positive track"}; - Configurable cfgDCANegToPVMin{"cfgDCANegToPVMin", 0.2, "minimum DCA to PV for negative track"}; - Configurable cfgV0CosPA{"cfgV0CosPA", 0.995, "minimum v0 cosine"}; - Configurable cfgDCAV0Dau{"cfgDCAV0Dau", 1.0, "maximum DCA between daughters"}; Configurable cfgHypMassWindow{"cfgHypMassWindow", 0.5, "single lambda mass selection"}; - Configurable cfgV0PtMin{"cfgV0PtMin", 0, "minimum pT for lambda"}; - Configurable cfgV0LifeTime{"cfgV0LifeTime", 30., "maximum lambda lifetime"}; - Configurable cfgPV{"cfgPV", 10., "maximum z-vertex"}; - Configurable cfgMaxOccupancy{"cfgMaxOccupancy", 999999, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; - Configurable cfgMinOccupancy{"cfgMinOccupancy", 0, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; } cfgV0; HfHelper hfHelper; SliceCache cache; Service pdg; - double massLambda = o2::constants::physics::MassLambda; int8_t chargeCand = 3; int8_t signSoftPion = 0; int leadingIndex = 0; @@ -471,37 +553,6 @@ struct HfCorrelatorLcScHadrons { return y; } - template - bool selectionV0(TCollision const& collision, V0 const& candidate) - { - if (candidate.v0radius() < cfgV0.cfgV0radiusMin) { - return false; - } - if (std::abs(candidate.dcapostopv()) < cfgV0.cfgDCAPosToPVMin) { - return false; - } - if (std::abs(candidate.dcanegtopv()) < cfgV0.cfgDCANegToPVMin) { - return false; - } - if (candidate.v0cosPA() < cfgV0.cfgV0CosPA) { - return false; - } - if (std::abs(candidate.dcaV0daughters()) > cfgV0.cfgDCAV0Dau) { - return false; - } - if (candidate.pt() < cfgV0.cfgV0PtMin) { - return false; - } - if (std::abs(candidate.yLambda()) > yCandMax) { - return false; - } - if (candidate.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * massLambda > cfgV0.cfgV0LifeTime) { - return false; - } - - return true; - } - template bool isSelectedV0Daughter(T const& track, int pid) { @@ -532,20 +583,15 @@ struct HfCorrelatorLcScHadrons { return true; } - template - void fillV0Histograms(CollType const& collV0, V0 const& v0s, TrackType const&) + template + void fillV0Histograms(V0 const& v0s, TrackType const&) { for (const auto& v0 : v0s) { - - if (!selectionV0(collV0, v0)) { - continue; - } - auto posTrackV0 = v0.template posTrack_as(); auto negTrackV0 = v0.template negTrack_as(); if (isSelectedV0Daughter(posTrackV0, kProton) && isSelectedV0Daughter(negTrackV0, kPiPlus)) { - if (std::abs(massLambda - v0.mLambda()) < cfgV0.cfgHypMassWindow) { + if (std::abs(o2::constants::physics::MassLambda - v0.mLambda()) < cfgV0.cfgHypMassWindow) { registry.fill(HIST("hV0Lambda"), v0.mLambda(), v0.pt(), posTrackV0.pt()); registry.fill(HIST("hV0LambdaRefl"), v0.mAntiLambda(), v0.pt(), negTrackV0.pt()); @@ -556,7 +602,7 @@ struct HfCorrelatorLcScHadrons { } } if (isSelectedV0Daughter(negTrackV0, kProton) && isSelectedV0Daughter(posTrackV0, kPiPlus)) { - if (std::abs(massLambda - v0.mAntiLambda()) > cfgV0.cfgHypMassWindow) { + if (std::abs(o2::constants::physics::MassLambda - v0.mAntiLambda()) > cfgV0.cfgHypMassWindow) { registry.fill(HIST("hV0Lambda"), v0.mAntiLambda(), v0.pt(), negTrackV0.pt()); registry.fill(HIST("hV0LambdaRefl"), v0.mLambda(), v0.pt(), posTrackV0.pt()); @@ -598,32 +644,6 @@ struct HfCorrelatorLcScHadrons { } } - template - bool eventSelV0(TCollision collision) - { - if (!collision.sel8()) { - return 0; - } - - if (!collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { - return 0; - } - if (!collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { - return 0; - } - if (std::abs(collision.posZ()) > cfgV0.cfgPV) { - return 0; - } - if (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { - return 0; - } - if (collision.trackOccupancyInTimeRange() > cfgV0.cfgMaxOccupancy || collision.trackOccupancyInTimeRange() < cfgV0.cfgMinOccupancy) { - return 0; - } - - return 1; - } // event selection V0 - template void calculateTrkEff(T1 const& trackPos1, T2 const& trackPos2, McPart const& mcParticles) { @@ -1389,29 +1409,17 @@ struct HfCorrelatorLcScHadrons { } PROCESS_SWITCH(HfCorrelatorLcScHadrons, processMcGenMixedEvent, "Process Mixed Event McGen", false); - void processDataLambdaV0(soa::Join::iterator const& collision, + void processDataLambdaV0(SelCollisions::iterator const&, TracksData const& tracks, aod::V0Datas const& v0s) { - registry.fill(HIST("hEventLambdaV0"), 0.5); - if (!eventSelV0(collision)) { - return; - } - registry.fill(HIST("hEventLambdaV0"), 1.5); - - fillV0Histograms(collision, v0s, tracks); + fillV0Histograms(v0s, tracks); } PROCESS_SWITCH(HfCorrelatorLcScHadrons, processDataLambdaV0, "Data process for v0 lambda", false); - void processMcLambdaV0(soa::Join::iterator const& collision, + void processMcLambdaV0(SelCollisions::iterator const&, TracksWithMc const& tracks, soa::Join const& v0s, aod::McParticles const&) { - registry.fill(HIST("hEventLambdaV0"), 0.5); - if (!eventSelV0(collision)) { - return; - } - registry.fill(HIST("hEventLambdaV0"), 1.5); - - fillV0Histograms(collision, v0s, tracks); + fillV0Histograms(v0s, tracks); } PROCESS_SWITCH(HfCorrelatorLcScHadrons, processMcLambdaV0, "Mc process for v0 lambda", false); }; From ad048726fd41a782aa1cfa7057a5ae1839755112 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 17 Oct 2025 19:54:27 +0200 Subject: [PATCH 796/986] [PWGEM/Dilepton] implement protection against failed track propagation (#13437) --- .../TableProducer/skimmerPrimaryElectron.cxx | 51 +++++++++++++++---- .../skimmerPrimaryElectronQC.cxx | 25 +++++++-- 2 files changed, 60 insertions(+), 16 deletions(-) diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx index b6cb2d76d78..8539b0295ce 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx @@ -325,7 +325,10 @@ struct skimmerPrimaryElectron { trackParCov.setPID(o2::track::PID::Electron); mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + bool isPropOK = o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + if (!isPropOK) { + return false; + } float dcaXY = mDcaInfoCov.getY(); float dcaZ = mDcaInfoCov.getZ(); @@ -387,8 +390,10 @@ struct skimmerPrimaryElectron { trackParCov.setPID(o2::track::PID::Electron); mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); - + bool isPropOK = o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + if (!isPropOK) { + return false; + } std::vector inputFeatures = mlResponseSingleTrack.getInputFeatures(track, trackParCov, collision); float binningFeature = mlResponseSingleTrack.getBinningFeature(track, trackParCov, collision); @@ -465,7 +470,10 @@ struct skimmerPrimaryElectron { trackParCov.setPID(o2::track::PID::Electron); mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + bool isPropOK = o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + if (!isPropOK) { + return; + } float dcaXY = mDcaInfoCov.getY(); float dcaZ = mDcaInfoCov.getZ(); @@ -983,7 +991,10 @@ struct prefilterPrimaryElectron { trackParCov.setPID(o2::track::PID::Electron); mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + bool isPropOK = o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + if (!isPropOK) { + return false; + } float dcaXY = mDcaInfoCov.getY(); float dcaZ = mDcaInfoCov.getZ(); @@ -1024,7 +1035,10 @@ struct prefilterPrimaryElectron { if constexpr (loose_track_sign > 0) { // positive track is loose track auto trackParCov = getTrackParCov(pos); trackParCov.setPID(o2::track::PID::Electron); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + bool isPropOK = o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + if (!isPropOK) { + return false; + } getPxPyPz(trackParCov, pVec_recalc); ROOT::Math::PtEtaPhiMVector v1(ele.pt(), ele.eta(), ele.phi(), o2::constants::physics::MassElectron); @@ -1035,7 +1049,10 @@ struct prefilterPrimaryElectron { } else { auto trackParCov = getTrackParCov(ele); trackParCov.setPID(o2::track::PID::Electron); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + bool isPropOK = o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + if (!isPropOK) { + return false; + } getPxPyPz(trackParCov, pVec_recalc); ROOT::Math::PtEtaPhiMVector v1(trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi(), o2::constants::physics::MassElectron); @@ -1109,7 +1126,10 @@ struct prefilterPrimaryElectron { trackParCov.setPID(o2::track::PID::Electron); mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + bool isPropOK = o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + if (!isPropOK) { + continue; + } getPxPyPz(trackParCov, pVec_recalc); for (const auto& empos : positrons_per_coll) { @@ -1154,7 +1174,10 @@ struct prefilterPrimaryElectron { trackParCov.setPID(o2::track::PID::Electron); mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + bool isPropOK = o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + if (!isPropOK) { + continue; + } getPxPyPz(trackParCov, pVec_recalc); for (const auto& emele : electrons_per_coll) { if (emele.trackId() == pos.globalIndex()) { @@ -1197,7 +1220,10 @@ struct prefilterPrimaryElectron { trackParCov.setPID(o2::track::PID::Electron); mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + bool isPropOK = o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + if (!isPropOK) { + continue; + } getPxPyPz(trackParCov, pVec_recalc); for (const auto& empos : positrons_per_coll) { if (empos.trackId() == pos.globalIndex()) { @@ -1226,7 +1252,10 @@ struct prefilterPrimaryElectron { trackParCov.setPID(o2::track::PID::Electron); mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + bool isPropOK = o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + if (!isPropOK) { + continue; + } getPxPyPz(trackParCov, pVec_recalc); for (const auto& emele : electrons_per_coll) { diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx index 37cb5acd78e..c662ec755a1 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectronQC.cxx @@ -336,7 +336,10 @@ struct skimmerPrimaryElectronQC { trackParCov.setPID(o2::track::PID::Electron); mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + bool isPropOK = o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + if (!isPropOK) { + return false; + } float dcaXY = mDcaInfoCov.getY(); float dcaZ = mDcaInfoCov.getZ(); @@ -409,7 +412,10 @@ struct skimmerPrimaryElectronQC { trackParCov.setPID(o2::track::PID::Electron); mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + bool isPropOK = o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + if (!isPropOK) { + return false; + } float dcaXY = mDcaInfoCov.getY(); float dcaZ = mDcaInfoCov.getZ(); @@ -455,7 +461,10 @@ struct skimmerPrimaryElectronQC { trackParCov.setPID(o2::track::PID::Electron); mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + bool isPropOK = o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); + if (!isPropOK) { + return; + } float dcaXY = mDcaInfoCov.getY(); float dcaZ = mDcaInfoCov.getZ(); @@ -596,12 +605,18 @@ struct skimmerPrimaryElectronQC { auto t1ParCov = getTrackParCov(t1); t1ParCov.setPID(o2::track::PID::Electron); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, t1ParCov, 2.f, matCorr, &mDcaInfoCov); + bool isPropOK = o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, t1ParCov, 2.f, matCorr, &mDcaInfoCov); + if (!isPropOK) { + return false; + } getPxPyPz(t1ParCov, pVec1); auto t2ParCov = getTrackParCov(t2); t2ParCov.setPID(o2::track::PID::Electron); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, t2ParCov, 2.f, matCorr, &mDcaInfoCov); + isPropOK = o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, t2ParCov, 2.f, matCorr, &mDcaInfoCov); + if (!isPropOK) { + return false; + } getPxPyPz(t2ParCov, pVec2); ROOT::Math::PtEtaPhiMVector v1(t1ParCov.getPt(), t1ParCov.getEta(), t1ParCov.getPhi(), o2::constants::physics::MassElectron); From 7d08aef47f277e595a87a0acc5d77b971a2c501f Mon Sep 17 00:00:00 2001 From: suyoupeng <109774812+15071832337@users.noreply.github.com> Date: Sat, 18 Oct 2025 02:22:26 +0800 Subject: [PATCH 797/986] [PWGLF] Local polarization of Lambda induced by jets in Run3 pp collisions at 13.6 TeV (#13427) --- .../Strangeness/lambdaJetpolarization.cxx | 552 +----------------- 1 file changed, 23 insertions(+), 529 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx b/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx index 0dab522e35f..d399b213435 100644 --- a/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx @@ -60,10 +60,8 @@ using namespace o2::framework; using namespace o2::framework::expressions; struct LfMyV0s { - HistogramRegistry registry{"registry"}; + HistogramRegistry registryData{"registryData", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry registryV0Data{"registryV0Data", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry registryLongitudinalPolarization{"registryLongitudinalPolarization", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; Configurable zVtx{"zVtx", 10.0, "Maximum zVertex"}; Configurable rJet{"rJet", 0.4, "Jet resolution parameter R"}; @@ -166,60 +164,6 @@ struct LfMyV0s { ConfigurableAxis TProfile2DaxisPt{"#it{p}_{T} (GeV/#it{c})", {VARIABLE_WIDTH, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.2, 3.7, 4.2, 5, 6, 8, 10, 12}, "pt axis for histograms"}; ConfigurableAxis TProfile2DaxisMass{"Mass p#pi (GeV/#it{c^{2}})", {VARIABLE_WIDTH, 1.10068, 1.10668, 1.11068, 1.11268, 1.11368, 1.11468, 1.11568, 1.11668, 1.11768, 1.11868, 1.12068, 1.12468, 1.13068}, "Mass axis for histograms"}; - registry.add("hMassLambda", "hMassLambda", {HistType::kTH1F, {invMassLambdaAxis}}); - registry.add("V0pTInLab", "V0pTInLab", kTH1F, {axisPT}); - registry.add("hMassVsPtLambda", "hMassVsPtLambda", {HistType::kTH2F, {ptAxis, invMassLambdaAxis}}); - registry.add("hMassVsPtAntiLambda", "hMassVsPtAntiLambda", {HistType::kTH2F, {ptAxis, invMassLambdaAxis}}); - - registry.add("V0pxInLab", "V0pxInLab", kTH1F, {axisPx}); - registry.add("V0pyInLab", "V0pyInLab", kTH1F, {axisPy}); - registry.add("V0pzInLab", "V0pzInLab", kTH1F, {axisPz}); - - registry.add("V0pxInRest_frame", "V0pxInRest_frame", kTH1F, {axisPx}); - registry.add("V0pyInRest_frame", "V0pyInRest_frame", kTH1F, {axisPy}); - registry.add("V0pzInRest_frame", "V0pzInRest_frame", kTH1F, {axisPz}); - - registry.add("JetpxInLab", "JetpxInLab", kTH1F, {axisPx}); - registry.add("JetpyInLab", "JetpyInLab", kTH1F, {axisPy}); - registry.add("JetpzInLab", "JetpzInLab", kTH1F, {axisPz}); - registry.add("JetpTInLab", "JetpTInLab", kTH1F, {axisPT}); - - registry.add("LeadingJetpx", "LeadingJetpx", kTH1F, {axisPx}); - registry.add("LeadingJetpy", "LeadingJetpy", kTH1F, {axisPy}); - registry.add("LeadingJetpz", "LeadingJetpz", kTH1F, {axisPz}); - registry.add("LeadingJetpT", "LeadingJetpT", kTH1F, {axisPT}); - - registry.add("V0protonpxInLab", "V0protonpxInLab", kTH1F, {axisPx}); - registry.add("V0protonpyInLab", "V0protonpyInLab", kTH1F, {axisPy}); - registry.add("V0protonpzInLab", "V0protonpzInLab", kTH1F, {axisPz}); - registry.add("V0protonphiInLab", "V0protonphiInLab", kTH1F, {axisPhi}); - - registry.add("V0protonpxInRest_frame", "V0protonpxInRest_frame", kTH1F, {axisPx}); - registry.add("V0protonpyInRest_frame", "V0protonpyInRest_frame", kTH1F, {axisPy}); - registry.add("V0protonpzInRest_frame", "V0protonpzInRest_frame", kTH1F, {axisPz}); - registry.add("V0protonMassInRest_frame", "V0protonMassInRest_frame", kTH1F, {axisMass}); - registry.add("V0protonphiInRest_frame", "V0protonphiInRest_frame", kTH1F, {axisPhi}); - - registry.add("V0protonpxInJetV0frame", "V0protonpxInJetV0frame", kTH1F, {axisPx}); - registry.add("V0protonpyInJetV0frame", "V0protonpyInJetV0frame", kTH1F, {axisPy}); - registry.add("V0protonpzInJetV0frame", "V0protonpzInJetV0frame", kTH1F, {axisPz}); - registry.add("V0protonphiInJetV0frame", "V0protonphiInJetV0frame", kTH1F, {axisPhi}); - registry.add("V0antiprotonphiInJetV0frame", "V0antiprotonphiInJetV0frame", kTH1F, {axisPhi}); - - registry.add("V0LambdapxInJetV0frame", "V0LambdapxInJetV0frame", kTH1F, {axisPx}); - registry.add("V0LambdapyInJetV0frame", "V0LambdapyInJetV0frame", kTH1F, {axisPy}); - registry.add("V0LambdapzInJetV0frame", "V0LambdapzInJetV0frame", kTH1F, {axisPz}); - - registry.add("hLambdamassandSinPhi", "hLambdamassandSinPhi", kTH2F, {{200, 0.9, 1.2}, {200, -1, 1}}); - registry.add("hAntiLambdamassandSinPhi", "hAntiLambdamassandSinPhi", kTH2F, {{200, 0.9, 1.2}, {200, -1, 1}}); - registry.add("profile", "Invariant Mass vs sin(phi)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); - registry.add("profileAntiV0", "Invariant Mass vs sin(phi)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); - registry.add("hLambdaPhiandSinPhi", "hLambdaPhiandSinPhi", kTH2F, {{200, -TMath::Pi() / 2, TMath::Pi() / 2}, {200, -1, 1}}); - registry.add("hAntiLambdaPhiandSinPhi", "hAntiLambdaPhiandSinPhi", kTH2F, {{200, -TMath::Pi() / 2, TMath::Pi() / 2}, {200, -1, 1}}); - - registry.add("V0LambdaprotonPhi", "V0LambdaprotonPhi", {HistType::kTH1F, {{200, -TMath::Pi() / 2, TMath::Pi() / 2}}}); - registry.add("V0AntiLambdaprotonPhi", "V0AntiLambdaprotonPhi", {HistType::kTH1F, {{200, -TMath::Pi() / 2, TMath::Pi() / 2}}}); - registryData.add("number_of_events_vsmultiplicity", "number of events in data vs multiplicity", HistType::kTH1D, {{101, 0, 101, "Multiplicity percentile"}}); registryData.add("h_track_pt", "track pT;#it{p}_{T,track} (GeV/#it{c});entries", kTH1F, {{200, 0., 200.}}); registryData.add("h_track_eta", "track #eta;#eta_{track};entries", kTH1F, {{100, -1.f, 1.f}}); @@ -245,8 +189,8 @@ struct LfMyV0s { registryData.add("LambdaPtMass", "LambdaPtMass", HistType::kTH2F, {ptAxis, invMassLambdaAxis}); registryData.add("AntiLambdaPtMass", "AntiLambdaPtMass", HistType::kTH2F, {ptAxis, invMassLambdaAxis}); - registryData.add("hMassLambda", "hMassLambda", {HistType::kTH1F, {{invMassLambdaAxis}}}); - registryData.add("hMassAntiLambda", "hMassAntiLambda", {HistType::kTH1F, {{invMassLambdaAxis}}}); + registryData.add("hMassLambda", "hMassLambda", {HistType::kTH1F, {invMassLambdaAxis}}); + registryData.add("hMassAntiLambda", "hMassAntiLambda", {HistType::kTH1F, {invMassLambdaAxis}}); registryData.add("V0pTInLab", "V0pTInLab", kTH1F, {axisPT}); registryData.add("V0pxInLab", "V0pxInLab", kTH1F, {axisPx}); @@ -272,6 +216,7 @@ struct LfMyV0s { registryData.add("JetQA/JetpxInLab", "JetpxInLab", kTH1F, {axisPx}); registryData.add("JetQA/JetpyInLab", "JetpyInLab", kTH1F, {axisPy}); registryData.add("JetQA/JetpzInLab", "JetpzInLab", kTH1F, {axisPz}); + registryData.add("JetQA/JetptInLab", "JetptInLab", kTH1F, {axisPT}); registryData.add("protonQA/V0protonpxInRest_frame", "V0protonpxInRest_frame", kTH1F, {axisPx}); registryData.add("protonQA/V0protonpyInRest_frame", "V0protonpyInRest_frame", kTH1F, {axisPy}); @@ -288,6 +233,7 @@ struct LfMyV0s { registryData.add("JetQA/JetpxInV0", "JetpxInV0", kTH1F, {axisPx}); registryData.add("JetQA/JetpyInV0", "JetpyInV0", kTH1F, {axisPy}); registryData.add("JetQA/JetpzInV0", "JetpzInV0", kTH1F, {axisPz}); + registryData.add("JetQA/JetptInV0", "JetptInV0", kTH1F, {axisPT}); registryData.add("protonQA/V0protonpxInJetframe", "V0protonpxInJetframe", kTH1F, {axisPx}); registryData.add("protonQA/V0protonpyInJetframe", "V0protonpyInJetframe", kTH1F, {axisPy}); @@ -304,6 +250,7 @@ struct LfMyV0s { registryData.add("JetQA/JetpxInJetframe", "JetpxInJetframe", kTH1F, {axisPx}); registryData.add("JetQA/JetpyInJetframe", "JetpyInJetframe", kTH1F, {axisPy}); registryData.add("JetQA/JetpzInJetframe", "JetpzInJetframe", kTH1F, {axisPz}); + registryData.add("JetQA/JetptInJetframe", "JetptInJetframe", kTH1F, {axisPT}); registryData.add("protonQA/V0protonpxInJetV0frame", "V0protonpxInJetV0frame", kTH1F, {axisPx}); registryData.add("protonQA/V0protonpyInJetV0frame", "V0protonpyInJetV0frame", kTH1F, {axisPy}); @@ -320,6 +267,7 @@ struct LfMyV0s { registryData.add("JetQA/JetpxInJetV0frame", "JetpxInJetV0frame", kTH1F, {axisPx}); registryData.add("JetQA/JetpyInJetV0frame", "JetpyInJetV0frame", kTH1F, {axisPy}); registryData.add("JetQA/JetpzInJetV0frame", "JetpzInJetV0frame", kTH1F, {axisPz}); + registryData.add("JetQA/JetptInJetV0frame", "JetptInJetV0frame", kTH1F, {axisPT}); registryData.add("V0LambdapxInJetV0frame", "V0LambdapxInJetV0frame", kTH1F, {axisPx}); registryData.add("V0LambdapyInJetV0frame", "V0LambdapyInJetV0frame", kTH1F, {axisPy}); @@ -383,122 +331,6 @@ struct LfMyV0s { registryData.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(19, "TPC nsigma Pos Dau"); registryData.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(20, "Armenteros-Podolansky"); } - - registryV0Data.add("hLambdaPt", "hLambdaPt", {HistType::kTH1F, {ptAxis}}); - registryV0Data.add("hAntiLambdaPt", "hAntiLambdaPt", {HistType::kTH1F, {ptAxis}}); - - registryV0Data.add("hMassVsPtLambda", "hMassVsPtLambda", {HistType::kTH2F, {ptAxis, invMassLambdaAxis}}); - registryV0Data.add("hMassVsPtAntiLambda", "hMassVsPtAntiLambda", {HistType::kTH2F, {ptAxis, invMassLambdaAxis}}); - registryV0Data.add("hMassLambda", "hMassLambda", {HistType::kTH1F, {invMassLambdaAxis}}); - registryV0Data.add("hMassAntiLambda", "hMassAntiLambda", {HistType::kTH1F, {invMassLambdaAxis}}); - registryV0Data.add("nV0sPerEvent", "nV0sPerEvent", kTH1F, {{10, 0.0, 10.0}}); - registryV0Data.add("nV0sPerEventsel", "nV0sPerEventsel", kTH1F, {{10, 0.0, 10.0}}); - - registryV0Data.add("hprotoncosthetainLab", "hprotoncosthetainLab", kTH1F, {{200, -1.f, 1.f}}); - registryV0Data.add("hprotonsinthetainLab", "hprotonsinthetainLab", kTH1F, {{200, -1.f, 1.f}}); - registryV0Data.add("hprotonthetainLab", "hprotonthetainLab", kTH1F, {axisTheta}); - - registryV0Data.add("hprotoncosthetainV0", "hprotoncosthetainV0", kTH1F, {{200, -1.f, 1.f}}); - registryV0Data.add("hprotonsinthetainV0", "hprotonsinthetainV0", kTH1F, {{200, -1.f, 1.f}}); - registryV0Data.add("hprotonthetainV0", "hprotonthetainV0", kTH1F, {{200, 0.f, TMath::Pi()}}); - - registryV0Data.add("hprotoncosthetainJetV0", "hprotoncosthetainJetV0", kTH1F, {{200, -1.f, 1.f}}); - registryV0Data.add("hprotonsinthetainJetV0", "hprotonsinthetainJetV0", kTH1F, {{200, -1.f, 1.f}}); - registryV0Data.add("hprotonthetainJetV0", "hprotonthetainJetV0", kTH1F, {{200, 0.f, TMath::Pi()}}); - - registryV0Data.add("hprotoncosSquarethetainLab", "hprotoncosSquarethetainLab", kTH1F, {{200, -1.f, 1.f}}); - registryV0Data.add("hprotoncosSquarethetainV0", "hprotoncosSquarethetainV0", kTH1F, {{200, -1.f, 1.f}}); - registryV0Data.add("hprotoncosSquarethetainJetV0", "hprotoncosSquarethetainJetV0", kTH1F, {{200, -1.f, 1.f}}); - - registryV0Data.add("hLambdamassandSinthetainV0", "hLambdamassandSinthetainV0", kTH2F, {{200, 0.9, 1.2}, {200, -1, 1}}); - registryV0Data.add("hLambdamassandCosthetainV0", "hLambdamassandCosthetainV0", kTH2F, {{200, 0.9, 1.2}, {200, -1, 1}}); - registryV0Data.add("hLambdamassandCosSquarethetainV0", "hLambdamassandCosSquarethetainV0", kTH2F, {{200, 0.9, 1.2}, {200, -1, 1}}); - - registryV0Data.add("hLambdamassandSinthetainJetV0", "hLambdamassandSinthetainJetV0", kTH2F, {{200, 0.9, 1.2}, {200, -1, 1}}); - registryV0Data.add("hLambdamassandCosthetainJetV0", "hLambdamassandCosthetainJetV0", kTH2F, {{200, 0.9, 1.2}, {200, -1, 1}}); - registryV0Data.add("hLambdamassandCosSquarethetainJetV0", "hLambdamassandCosSquarethetainJetV0", kTH2F, {{200, 0.9, 1.2}, {200, -1, 1}}); - - registryV0Data.add("AverageSinthetainV0", "AverageSinthetainV0", {HistType::kTProfile, {{200, 0.9, 1.2}}}); - registryV0Data.add("AverageCosSquarethetainV0", "AverageCosSquarethetainV0", {HistType::kTProfile, {{200, 0.9, 1.2}}}); - - registryV0Data.add("AverageSinthetainJetV0", "AverageSinthetainJetV0", {HistType::kTProfile, {{200, 0.9, 1.2}}}); - registryV0Data.add("AverageCosSquarethetainJetV0", "AverageCosSquarethetainJetV0", {HistType::kTProfile, {{200, 0.9, 1.2}}}); - - // LongitudinalPolarization event selection - registryLongitudinalPolarization.add("hNEvents", "hNEvents", {HistType::kTH1D, {{10, 0.f, 10.f}}}); - registryLongitudinalPolarization.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(1, "all"); - registryLongitudinalPolarization.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(2, "sel8"); - registryLongitudinalPolarization.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(3, "TVX"); - registryLongitudinalPolarization.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(4, "zvertex"); - registryLongitudinalPolarization.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(5, "TFBorder"); - registryLongitudinalPolarization.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(6, "ITSROFBorder"); - registryLongitudinalPolarization.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(7, "isTOFVertexMatched"); - registryLongitudinalPolarization.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(8, "isNoSameBunchPileup"); - registryLongitudinalPolarization.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(9, "Applied selection"); - - registryLongitudinalPolarization.add("hMassVsPtLambda", "hMassVsPtLambda", {HistType::kTH2F, {ptAxis, invMassLambdaAxis}}); - registryLongitudinalPolarization.add("hMassLambda", "hMassLambda", {HistType::kTH1F, {invMassLambdaAxis}}); - registryLongitudinalPolarization.add("hMassVsPtAntiLambda", "hMassVsPtAntiLambda", {HistType::kTH2F, {ptAxis, invMassLambdaAxis}}); - - registryLongitudinalPolarization.add("hMassLambdasel", "hMassLambdasel", {HistType::kTH1F, {invMassLambdaAxis}}); - registryLongitudinalPolarization.add("hMassAntiLambdasel", "hMassAntiLambdasel", {HistType::kTH1F, {invMassLambdaAxis}}); - registryLongitudinalPolarization.add("hMassVsPtLambdasel", "hMassVsPtLambdasel", {HistType::kTH2F, {ptAxis, invMassLambdaAxis}}); - registryLongitudinalPolarization.add("hMassVsPtAntiLambdasel", "hMassVsPtAntiLambdasel", {HistType::kTH2F, {ptAxis, invMassLambdaAxis}}); - - registryLongitudinalPolarization.add("V0pxInRest_frame", "V0pxInRest_frame", kTH1F, {axisPx}); - registryLongitudinalPolarization.add("V0pyInRest_frame", "V0pyInRest_frame", kTH1F, {axisPy}); - registryLongitudinalPolarization.add("V0pzInRest_frame", "V0pzInRest_frame", kTH1F, {axisPz}); - - registryLongitudinalPolarization.add("nV0sPerEvent", "nV0sPerEvent", kTH1F, {{10, 0.0, 10.0}}); - registryLongitudinalPolarization.add("nV0sPerEventsel", "nV0sPerEventsel", kTH1F, {{10, 0.0, 10.0}}); - - registryLongitudinalPolarization.add("hprotoncosthetainV0", "hprotoncosthetainV0", kTH1F, {{200, -1.f, 1.f}}); - registryLongitudinalPolarization.add("hprotoncosSquarethetainV0", "hprotoncosSquarethetainV0", kTH1F, {{200, -1.f, 1.f}}); - registryLongitudinalPolarization.add("hLambdamassandCosthetaInV0", "hLambdamassandCosthetaInV0", kTH2F, {{200, 0.9, 1.2}, {200, -1, 1}}); - registryLongitudinalPolarization.add("TProfile2DLambdaPtMassCostheta", "", kTProfile2D, {TProfile2DaxisMass, TProfile2DaxisPt}); - registryLongitudinalPolarization.add("TProfile2DLambdaPtMassCosSquareTheta", "", kTProfile2D, {TProfile2DaxisMass, TProfile2DaxisPt}); - registryLongitudinalPolarization.add("TH2FLambdaPtCostheta", "", kTH2F, {axisCostheta, TProfile2DaxisPt}); - - registryLongitudinalPolarization.add("hprotonThetaInLab", "hprotonThetaInLab", kTH1F, {axisTheta}); - registryLongitudinalPolarization.add("hprotonPhiInLab", "hprotonPhiInLab", kTH1F, {axisPhi}); - registryLongitudinalPolarization.add("hprotonPhiInV0", "hprotonPhiInV0", kTH1F, {axisPhi}); - registryLongitudinalPolarization.add("hAntiprotonThetaInLab", "hAntiprotonThetaInLab", kTH1F, {axisTheta}); - - registryLongitudinalPolarization.add("hprotonTheta", "hprotonTheta", kTH1F, {axisTheta}); - registryLongitudinalPolarization.add("hAntiprotonTheta", "hAntiprotonTheta", kTH1F, {axisTheta}); - - registryLongitudinalPolarization.add("hantiprotoncosthetainV0", "hantiprotoncosthetainV0", kTH1F, {{200, -1.f, 1.f}}); - registryLongitudinalPolarization.add("hantiprotoncosSquarethetainV0", "hantiprotoncosSquarethetainV0", kTH1F, {{200, -1.f, 1.f}}); - registryLongitudinalPolarization.add("hAntiLambdamassandCosthetaInV0", "hAntiLambdamassandCosthetaInV0", kTH2F, {{200, 0.9, 1.2}, {200, -1, 1}}); - registryLongitudinalPolarization.add("TProfile2DAntiLambdaPtMassCostheta", "TProfile2DAntiLambdaPtMassCostheta", kTProfile2D, {TProfile2DaxisMass, TProfile2DaxisPt}); - registryLongitudinalPolarization.add("TProfile2DAntiLambdaPtMassCosSquareTheta", "TProfile2DAntiLambdaPtMassCosSquareTheta", kTProfile2D, {TProfile2DaxisMass, TProfile2DaxisPt}); - registryLongitudinalPolarization.add("TProfile1DLambdaPtMassCostheta", "Invariant Mass vs cos(#theta)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); - registryLongitudinalPolarization.add("TProfile1DAntiLambdaPtMassCostheta", "Invariant Mass vs cos(#theta)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); - registryLongitudinalPolarization.add("TH2FAntiLambdaPtCostheta", "", kTH2F, {axisCostheta, TProfile2DaxisPt}); - - if (doQA) { - registryLongitudinalPolarization.add("QA/hv0sSelection", ";Sel", {HistType::kTH1D, {{22, 0., 22.}}}); - registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(1, "all"); - registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(2, "Event selection"); - registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(3, "Radius"); - registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(4, "Eta Daughters"); - registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(5, "Dau DCA to PV"); - registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(6, "DCA Daughters"); - registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(7, "min ITS hits"); - registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(8, "has TOF 1 Leg"); - registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(9, "has TOF 2 Legs"); - registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(10, "TPC NCl"); - registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(11, "TPC Cls Shared"); - registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(12, "ITS Chi2"); - registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(13, "TPC Chi2"); - registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(14, "cosPA"); - registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(15, "rapidity"); - registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(16, "ctau"); - registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(17, "v0 rej"); - registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(18, "TPC nsigma Neg Dau"); - registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(19, "TPC nsigma Pos Dau"); - registryLongitudinalPolarization.get(HIST("QA/hv0sSelection"))->GetXaxis()->SetBinLabel(20, "Armenteros-Podolansky"); - } } double massPr = o2::constants::physics::MassProton; double massLambda = o2::constants::physics::MassLambda; @@ -564,171 +396,6 @@ struct LfMyV0s { } // aod::MyCollision const& collision - void processJetV0Analysis(aod::MyTable const& myv0s, aod::MyTableJet const& myJets) - { - - for (auto& candidate : myv0s) { - registry.fill(HIST("hMassLambda"), candidate.v0Lambdamass()); - registry.fill(HIST("V0pTInLab"), candidate.v0pt()); - registry.fill(HIST("hMassVsPtLambda"), candidate.v0pt(), candidate.v0Lambdamass()); - registry.fill(HIST("V0pxInLab"), candidate.v0px()); - registry.fill(HIST("V0pyInLab"), candidate.v0py()); - registry.fill(HIST("V0pzInLab"), candidate.v0pz()); - registry.fill(HIST("V0protonpxInLab"), candidate.v0protonpx()); - registry.fill(HIST("V0protonpyInLab"), candidate.v0protonpy()); - registry.fill(HIST("V0protonpzInLab"), candidate.v0protonpz()); - double protonsinPhiInLab = candidate.v0protonpy() / sqrt(candidate.v0protonpx() * candidate.v0protonpx() + candidate.v0protonpy() * candidate.v0protonpy()); - registry.fill(HIST("V0protonphiInLab"), protonsinPhiInLab); - double PLambda = sqrt(candidate.v0px() * candidate.v0px() + candidate.v0py() * candidate.v0py() + candidate.v0pz() * candidate.v0pz()); - double ELambda = sqrt(candidate.v0Lambdamass() * candidate.v0Lambdamass() + PLambda * PLambda); - TMatrixD pLabV0(4, 1); - pLabV0(0, 0) = ELambda; - pLabV0(1, 0) = candidate.v0px(); - pLabV0(2, 0) = candidate.v0py(); - pLabV0(3, 0) = candidate.v0pz(); - TMatrixD V0InV0(4, 1); - V0InV0 = LorentzTransInV0frame(ELambda, candidate.v0px(), candidate.v0py(), candidate.v0pz()) * pLabV0; - registry.fill(HIST("V0pxInRest_frame"), V0InV0(1, 0)); - registry.fill(HIST("V0pyInRest_frame"), V0InV0(2, 0)); - registry.fill(HIST("V0pzInRest_frame"), V0InV0(3, 0)); - } - for (auto& candidate : myv0s) { - double PLambda = sqrt(candidate.v0px() * candidate.v0px() + candidate.v0py() * candidate.v0py() + candidate.v0pz() * candidate.v0pz()); - double ELambda = sqrt(candidate.v0Lambdamass() * candidate.v0Lambdamass() + PLambda * PLambda); - TMatrixD pLabproton(4, 1); - double protonE = sqrt(massPr * massPr + candidate.v0protonpx() * candidate.v0protonpx() + candidate.v0protonpy() * candidate.v0protonpy() + candidate.v0protonpz() * candidate.v0protonpz()); - pLabproton(0, 0) = protonE; - pLabproton(1, 0) = candidate.v0protonpx(); - pLabproton(2, 0) = candidate.v0protonpy(); - pLabproton(3, 0) = candidate.v0protonpz(); - TMatrixD protonInV0(4, 1); - protonInV0 = LorentzTransInV0frame(ELambda, candidate.v0px(), candidate.v0py(), candidate.v0pz()) * pLabproton; - double protonMassInV0 = sqrt(protonInV0(0, 0) * protonInV0(0, 0) - protonInV0(1, 0) * protonInV0(1, 0) - protonInV0(2, 0) * protonInV0(2, 0) - protonInV0(3, 0) * protonInV0(3, 0)); - registry.fill(HIST("V0protonMassInRest_frame"), protonMassInV0); - registry.fill(HIST("V0protonpxInRest_frame"), protonInV0(1, 0)); - registry.fill(HIST("V0protonpyInRest_frame"), protonInV0(2, 0)); - registry.fill(HIST("V0protonpzInRest_frame"), protonInV0(3, 0)); - double protonsinPhiInV0frame = protonInV0(2, 0) / sqrt(protonInV0(1, 0) * protonInV0(1, 0) + protonInV0(2, 0) * protonInV0(2, 0)); - registry.fill(HIST("V0protonphiInRest_frame"), protonsinPhiInV0frame); - } - - for (auto& Jet : myJets) { - registry.fill(HIST("JetpxInLab"), Jet.jetpx()); - registry.fill(HIST("JetpyInLab"), Jet.jetpy()); - registry.fill(HIST("JetpzInLab"), Jet.jetpz()); - registry.fill(HIST("JetpTInLab"), Jet.jetpt()); - } - } - PROCESS_SWITCH(LfMyV0s, processJetV0Analysis, "processJetV0Analysis", true); - void processLeadingJetV0Analysis(aod::MyTable const& myv0s, aod::MyTableLeadingJet const& myleadingJets) - { - for (auto& LeadingJet : myleadingJets) { - int V0Numbers = 0; - double protonsinPhiInJetV0frame = 0; - for (auto& candidate : myv0s) { - if (candidate.mycollisionv0() == LeadingJet.mycollisionleadingjet()) { - V0Numbers = V0Numbers + 1; - double PLambda = sqrt(candidate.v0px() * candidate.v0px() + candidate.v0py() * candidate.v0py() + candidate.v0pz() * candidate.v0pz()); - double ELambda = sqrt(candidate.v0Lambdamass() * candidate.v0Lambdamass() + PLambda * PLambda); - double protonE = sqrt(massPr * massPr + candidate.v0protonpx() * candidate.v0protonpx() + candidate.v0protonpy() * candidate.v0protonpy() + candidate.v0protonpz() * candidate.v0protonpz()); - - TMatrixD pLabV0(4, 1); - pLabV0(0, 0) = ELambda; - pLabV0(1, 0) = candidate.v0px(); - pLabV0(2, 0) = candidate.v0py(); - pLabV0(3, 0) = candidate.v0pz(); - - TMatrixD lambdaInJet(4, 1); - lambdaInJet = MyTMatrixTranslationToJet(LeadingJet.leadingjetpx(), LeadingJet.leadingjetpy(), LeadingJet.leadingjetpz(), candidate.v0px(), candidate.v0py(), candidate.v0pz()) * pLabV0; - - TMatrixD lambdaInJetV0(4, 1); - lambdaInJetV0 = LorentzTransInV0frame(ELambda, lambdaInJet(1, 0), lambdaInJet(2, 0), lambdaInJet(3, 0)) * MyTMatrixTranslationToJet(LeadingJet.leadingjetpx(), LeadingJet.leadingjetpy(), LeadingJet.leadingjetpz(), candidate.v0px(), candidate.v0py(), candidate.v0pz()) * pLabV0; - registry.fill(HIST("V0LambdapxInJetV0frame"), lambdaInJetV0(1, 0)); - registry.fill(HIST("V0LambdapyInJetV0frame"), lambdaInJetV0(2, 0)); - registry.fill(HIST("V0LambdapzInJetV0frame"), lambdaInJetV0(3, 0)); - - TMatrixD pLabproton(4, 1); - pLabproton(0, 0) = protonE; - pLabproton(1, 0) = candidate.v0protonpx(); - pLabproton(2, 0) = candidate.v0protonpy(); - pLabproton(3, 0) = candidate.v0protonpz(); - TMatrixD protonInJetV0(4, 1); - protonInJetV0 = LorentzTransInV0frame(ELambda, lambdaInJet(1, 0), lambdaInJet(2, 0), lambdaInJet(3, 0)) * MyTMatrixTranslationToJet(LeadingJet.leadingjetpx(), LeadingJet.leadingjetpy(), LeadingJet.leadingjetpz(), candidate.v0px(), candidate.v0py(), candidate.v0pz()) * pLabproton; - registry.fill(HIST("V0protonpxInJetV0frame"), protonInJetV0(1, 0)); - registry.fill(HIST("V0protonpyInJetV0frame"), protonInJetV0(2, 0)); - registry.fill(HIST("V0protonpzInJetV0frame"), protonInJetV0(3, 0)); - protonsinPhiInJetV0frame = protonsinPhiInJetV0frame + protonInJetV0(2, 0) / sqrt(protonInJetV0(1, 0) * protonInJetV0(1, 0) + protonInJetV0(2, 0) * protonInJetV0(2, 0)); - } - } - for (auto& candidate : myv0s) { - if (candidate.mycollisionv0() == LeadingJet.mycollisionleadingjet()) { - registry.fill(HIST("V0protonphiInJetV0frame"), protonsinPhiInJetV0frame / V0Numbers); - registry.fill(HIST("hLambdamassandSinPhi"), candidate.v0Lambdamass(), protonsinPhiInJetV0frame / V0Numbers); - registry.fill(HIST("hLambdaPhiandSinPhi"), TMath::ASin(protonsinPhiInJetV0frame / V0Numbers), protonsinPhiInJetV0frame / V0Numbers); - registry.fill(HIST("V0LambdaprotonPhi"), TMath::ASin(protonsinPhiInJetV0frame / V0Numbers)); - registry.fill(HIST("profile"), candidate.v0Lambdamass(), protonsinPhiInJetV0frame / V0Numbers); - } - } - } - for (auto& LeadingJet : myleadingJets) { - registry.fill(HIST("LeadingJetpx"), LeadingJet.leadingjetpx()); - registry.fill(HIST("LeadingJetpy"), LeadingJet.leadingjetpy()); - registry.fill(HIST("LeadingJetpz"), LeadingJet.leadingjetpz()); - registry.fill(HIST("LeadingJetpT"), LeadingJet.leadingjetpt()); - } - } - PROCESS_SWITCH(LfMyV0s, processLeadingJetV0Analysis, "processLeadingJetV0Analysis", true); - - void processLeadingJetAntiV0Analysis(aod::MyTableAnti const& myv0s, aod::MyTableLeadingJet const& myleadingJets) - { - for (auto& LeadingJet : myleadingJets) { - int V0Numbers = 0; - double protonsinPhiInJetV0frame = 0; - for (auto& candidate : myv0s) { - if (candidate.mycollisionv0() == LeadingJet.mycollisionleadingjet()) { - V0Numbers = V0Numbers + 1; - double PLambda = sqrt(candidate.v0px() * candidate.v0px() + candidate.v0py() * candidate.v0py() + candidate.v0pz() * candidate.v0pz()); - double ELambda = sqrt(candidate.v0Lambdamass() * candidate.v0Lambdamass() + PLambda * PLambda); - double protonE = sqrt(massPr * massPr + candidate.v0protonpx() * candidate.v0protonpx() + candidate.v0protonpy() * candidate.v0protonpy() + candidate.v0protonpz() * candidate.v0protonpz()); - - TMatrixD pLabV0(4, 1); - pLabV0(0, 0) = ELambda; - pLabV0(1, 0) = candidate.v0px(); - pLabV0(2, 0) = candidate.v0py(); - pLabV0(3, 0) = candidate.v0pz(); - - TMatrixD lambdaInJet(4, 1); - lambdaInJet = MyTMatrixTranslationToJet(LeadingJet.leadingjetpx(), LeadingJet.leadingjetpy(), LeadingJet.leadingjetpz(), candidate.v0px(), candidate.v0py(), candidate.v0pz()) * pLabV0; - - TMatrixD lambdaInJetV0(4, 1); - lambdaInJetV0 = LorentzTransInV0frame(ELambda, lambdaInJet(1, 0), lambdaInJet(2, 0), lambdaInJet(3, 0)) * MyTMatrixTranslationToJet(LeadingJet.leadingjetpx(), LeadingJet.leadingjetpy(), LeadingJet.leadingjetpz(), candidate.v0px(), candidate.v0py(), candidate.v0pz()) * pLabV0; - - TMatrixD pLabproton(4, 1); - pLabproton(0, 0) = protonE; - pLabproton(1, 0) = candidate.v0protonpx(); - pLabproton(2, 0) = candidate.v0protonpy(); - pLabproton(3, 0) = candidate.v0protonpz(); - TMatrixD protonInJetV0(4, 1); - protonInJetV0 = LorentzTransInV0frame(ELambda, lambdaInJet(1, 0), lambdaInJet(2, 0), lambdaInJet(3, 0)) * MyTMatrixTranslationToJet(LeadingJet.leadingjetpx(), LeadingJet.leadingjetpy(), LeadingJet.leadingjetpz(), candidate.v0px(), candidate.v0py(), candidate.v0pz()) * pLabproton; - protonsinPhiInJetV0frame = protonsinPhiInJetV0frame + protonInJetV0(2, 0) / sqrt(protonInJetV0(1, 0) * protonInJetV0(1, 0) + protonInJetV0(2, 0) * protonInJetV0(2, 0)); - } - } - for (auto& candidate : myv0s) { - if (candidate.mycollisionv0() == LeadingJet.mycollisionleadingjet()) { - registry.fill(HIST("V0antiprotonphiInJetV0frame"), protonsinPhiInJetV0frame / V0Numbers); - registry.fill(HIST("hAntiLambdamassandSinPhi"), candidate.v0Lambdamass(), protonsinPhiInJetV0frame / V0Numbers); - registry.fill(HIST("hAntiLambdaPhiandSinPhi"), TMath::ASin(protonsinPhiInJetV0frame / V0Numbers), protonsinPhiInJetV0frame / V0Numbers); - registry.fill(HIST("V0AntiLambdaprotonPhi"), TMath::ASin(protonsinPhiInJetV0frame / V0Numbers)); - registry.fill(HIST("profileAntiV0"), candidate.v0Lambdamass(), protonsinPhiInJetV0frame / V0Numbers); - } - } - } - for (auto& candidate : myv0s) { - registry.fill(HIST("hMassVsPtAntiLambda"), candidate.v0pt(), candidate.v0Lambdamass()); - } - } - PROCESS_SWITCH(LfMyV0s, processLeadingJetAntiV0Analysis, "processLeadingJetAntiV0Analysis", true); - // ITS hit template bool hasITSHit(const TrackIts& track, int layer) @@ -812,84 +479,65 @@ struct LfMyV0s { evFlag = 1; } - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 0.5); - if (evSel && evFlag < 1) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 1.5); - if (v0.v0radius() < minimumV0Radius || v0.v0radius() > maximumV0Radius) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 2.5); - if (TMath::Abs(ptrack.eta()) > V0tracketaMax || TMath::Abs(ntrack.eta()) > V0tracketaMax) { return false; } - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 3.5); if (std::fabs(v0.dcapostopv()) < dcapostoPVmin) return false; if (std::fabs(v0.dcanegtopv()) < dcanegtoPVmin) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 4.5); if (std::fabs(v0.dcaV0daughters()) > dcaV0DaughtersMax) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 5.5); if (requireITS && ptrack.itsNCls() < minITSnCls) return false; if (requireITS && ntrack.itsNCls() < minITSnCls) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 6.5); if (hasTOF1Leg && !ptrack.hasTOF() && !ntrack.hasTOF()) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 7.5); if (hasTOF2Leg && (!ptrack.hasTOF() || !ntrack.hasTOF())) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 8.5); if (ptrack.tpcNClsCrossedRows() < minNCrossedRowsTPC) return false; if (ntrack.tpcNClsCrossedRows() < minNCrossedRowsTPC) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 9.5); if (ptrack.tpcNClsShared() > max_tpcSharedCls) return false; if (ntrack.tpcNClsShared() > max_tpcSharedCls) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 10.5); if (ptrack.itsChi2NCl() > max_chi2_ITS) return false; if (ntrack.itsChi2NCl() > max_chi2_ITS) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 11.5); if (ptrack.tpcChi2NCl() > max_chi2_TPC) return false; if (ntrack.tpcChi2NCl() > max_chi2_TPC) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 12.5); if (v0.v0cosPA() < v0cospaMin) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 13.5); if (v0.yLambda() < yMin || v0.yLambda() > yMax) { return false; } - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 14.5); float ctauLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0; if (ctauLambda >= CtauLambda) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 15.5); if (TMath::Abs(v0.mK0Short() - o2::constants::physics::MassK0Short) < v0rejLambda) { return false; @@ -898,19 +546,14 @@ struct LfMyV0s { return false; } - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 16.5); - if (ntrack.tpcNSigmaPi() < nsigmaTPCmin || ntrack.tpcNSigmaPi() > nsigmaTPCmax) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 17.5); if (ptrack.tpcNSigmaPr() < nsigmaTPCmin || ptrack.tpcNSigmaPr() > nsigmaTPCmax) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 18.5); if (doArmenterosCut && v0.qtarm() > (paramArmenterosCut * std::abs(v0.alpha()))) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 19.5); return true; } @@ -1216,74 +859,58 @@ struct LfMyV0s { if (requirepassedSingleTrackSelection && !passedSingleTrackSelection(ntrack)) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 1.5); - if (v0.v0radius() < minimumV0Radius || v0.v0radius() > maximumV0Radius) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 2.5); - if (TMath::Abs(ptrack.eta()) > V0tracketaMax || TMath::Abs(ntrack.eta()) > V0tracketaMax) { return false; } - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 3.5); if (std::fabs(v0.dcapostopv()) < dcapostoPVmin) return false; if (std::fabs(v0.dcanegtopv()) < dcanegtoPVmin) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 4.5); if (std::fabs(v0.dcaV0daughters()) > dcaV0DaughtersMax) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 5.5); if (requireITS && ptrack.itsNCls() < minITSnCls) return false; if (requireITS && ntrack.itsNCls() < minITSnCls) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 6.5); if (hasTOF1Leg && !ptrack.hasTOF() && !ntrack.hasTOF()) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 7.5); if (hasTOF2Leg && (!ptrack.hasTOF() || !ntrack.hasTOF())) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 8.5); if (ptrack.tpcNClsCrossedRows() < minNCrossedRowsTPC) return false; if (ntrack.tpcNClsCrossedRows() < minNCrossedRowsTPC) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 9.5); if (ptrack.tpcNClsShared() > max_tpcSharedCls) return false; if (ntrack.tpcNClsShared() > max_tpcSharedCls) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 10.5); if (ptrack.itsChi2NCl() > max_chi2_ITS) return false; if (ntrack.itsChi2NCl() > max_chi2_ITS) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 11.5); if (ptrack.tpcChi2NCl() > max_chi2_TPC) return false; if (ntrack.tpcChi2NCl() > max_chi2_TPC) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 12.5); if (v0.v0cosPA() < v0cospaMin) return false; - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 13.5); if (v0.yLambda() < yMin || v0.yLambda() > yMax) { return false; } - registryLongitudinalPolarization.fill(HIST("QA/hv0sSelection"), 14.5); // PID Selections (TPC) if (requireTPC) { @@ -1456,35 +1083,34 @@ struct LfMyV0s { template bool AcceptEventForLongitudinalPolarization(TCollision const& collision) { - registryLongitudinalPolarization.fill(HIST("hNEvents"), 0.5); + if (sel8 && !collision.sel8()) { return false; } - registryLongitudinalPolarization.fill(HIST("hNEvents"), 1.5); + if (isTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { return false; } - registryLongitudinalPolarization.fill(HIST("hNEvents"), 2.5); + if (std::abs(collision.posZ()) > cutzvertex) { return false; } - registryLongitudinalPolarization.fill(HIST("hNEvents"), 3.5); + if (isNoTimeFrameBorder && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { return false; } - registryLongitudinalPolarization.fill(HIST("hNEvents"), 4.5); + if (isNoITSROFrameBorder && !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { return false; } - registryLongitudinalPolarization.fill(HIST("hNEvents"), 5.5); + if (isVertexTOFmatched && !collision.selection_bit(aod::evsel::kIsVertexTOFmatched)) { return false; } - registryLongitudinalPolarization.fill(HIST("hNEvents"), 6.5); + if (isNoSameBunchPileup && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { return false; } - registryLongitudinalPolarization.fill(HIST("hNEvents"), 7.5); return true; } @@ -1671,11 +1297,13 @@ struct LfMyV0s { double protonMassInLab = sqrt(pLabproton(0, 0) * pLabproton(0, 0) - pLabproton(1, 0) * pLabproton(1, 0) - pLabproton(2, 0) * pLabproton(2, 0) - pLabproton(3, 0) * pLabproton(3, 0)); double jettheta = maxJetpz / sqrt(pLabJet(1, 0) * pLabJet(1, 0) + pLabJet(2, 0) * pLabJet(2, 0) + pLabJet(3, 0) * pLabJet(3, 0)); double jetphi = maxJetpy / sqrt(pLabJet(1, 0) * pLabJet(1, 0) + pLabJet(2, 0) * pLabJet(2, 0)); + double jetptInLab = sqrt(pLabJet(1, 0) * pLabJet(1, 0) + pLabJet(2, 0) * pLabJet(2, 0)); registryData.fill(HIST("JetQA/JetthetaInLab"), TMath::ASin(jettheta)); registryData.fill(HIST("JetQA/JetphiInLab"), TMath::ASin(jetphi)); registryData.fill(HIST("JetQA/JetpxInLab"), pLabJet(1, 0)); registryData.fill(HIST("JetQA/JetpyInLab"), pLabJet(2, 0)); registryData.fill(HIST("JetQA/JetpzInLab"), pLabJet(3, 0)); + registryData.fill(HIST("JetQA/JetptInLab"), jetptInLab); registryData.fill(HIST("protonQA/V0protonphiInLab"), TMath::ASin(protonsinPhiInLab)); registryData.fill(HIST("protonQA/V0protonthetaInLab"), TMath::ASin(protonsinThetaInLab)); @@ -1696,11 +1324,13 @@ struct LfMyV0s { JetInV0 = LorentzTransInV0frame(ELambda, candidate.px(), candidate.py(), candidate.pz()) * pLabJet; double jetthetaInV0 = JetInV0(3, 0) / sqrt(JetInV0(1, 0) * JetInV0(1, 0) + JetInV0(2, 0) * JetInV0(2, 0) + JetInV0(3, 0) * JetInV0(3, 0)); double jetphiInV0 = JetInV0(2, 0) / sqrt(JetInV0(1, 0) * JetInV0(1, 0) + JetInV0(2, 0) * JetInV0(2, 0)); + double jetptInV0 = sqrt(JetInV0(1, 0) * JetInV0(1, 0) + JetInV0(2, 0) * JetInV0(2, 0)); registryData.fill(HIST("JetQA/JetthetaInV0"), TMath::ASin(jetthetaInV0)); registryData.fill(HIST("JetQA/JetphiInV0"), TMath::ASin(jetphiInV0)); registryData.fill(HIST("JetQA/JetpxInV0"), JetInV0(1, 0)); registryData.fill(HIST("JetQA/JetpyInV0"), JetInV0(2, 0)); registryData.fill(HIST("JetQA/JetpzInV0"), JetInV0(3, 0)); + registryData.fill(HIST("JetQA/JetptInV0"), jetptInV0); registryData.fill(HIST("protonQA/V0protonMassInRest_frame"), protonMassInV0); registryData.fill(HIST("protonQA/V0protonpxInRest_frame"), protonInV0(1, 0)); @@ -1728,11 +1358,13 @@ struct LfMyV0s { pInJet = MyTMatrixTranslationToJet(maxJetpx, maxJetpy, maxJetpz, candidate.px(), candidate.py(), candidate.pz()) * pLabJet; double jetthetaInJet = pInJet(3, 0) / sqrt(pInJet(1, 0) * pInJet(1, 0) + pInJet(2, 0) * pInJet(2, 0) + pInJet(3, 0) * pInJet(3, 0)); double jetphiInJet = pInJet(2, 0) / sqrt(pInJet(1, 0) * pInJet(1, 0) + pInJet(2, 0) * pInJet(2, 0)); + double jetptInJet = sqrt(pInJet(1, 0) * pInJet(1, 0) + pInJet(2, 0) * pInJet(2, 0)); registryData.fill(HIST("JetQA/JetthetaInJetframe"), TMath::ASin(jetthetaInJet)); registryData.fill(HIST("JetQA/JetphiInJetframe"), TMath::ASin(jetphiInJet)); registryData.fill(HIST("JetQA/JetpxInJetframe"), pInJet(1, 0)); registryData.fill(HIST("JetQA/JetpyInJetframe"), pInJet(2, 0)); registryData.fill(HIST("JetQA/JetpzInJetframe"), pInJet(3, 0)); + registryData.fill(HIST("JetQA/JetptInJetframe"), jetptInJet); registryData.fill(HIST("protonQA/V0protonpxInJetframe"), protonInJet(1, 0)); registryData.fill(HIST("protonQA/V0protonpyInJetframe"), protonInJet(2, 0)); @@ -1758,11 +1390,13 @@ struct LfMyV0s { JetInJetV0 = LorentzTransInV0frame(ELambda, lambdaInJet(1, 0), lambdaInJet(2, 0), lambdaInJet(3, 0)) * MyTMatrixTranslationToJet(maxJetpx, maxJetpy, maxJetpz, candidate.px(), candidate.py(), candidate.pz()) * pLabJet; double jetthetaInJetV0 = JetInJetV0(3, 0) / sqrt(JetInJetV0(1, 0) * JetInJetV0(1, 0) + JetInJetV0(2, 0) * JetInJetV0(2, 0) + JetInJetV0(3, 0) * JetInJetV0(3, 0)); double jetphiInJetV0 = JetInJetV0(2, 0) / sqrt(JetInJetV0(1, 0) * JetInJetV0(1, 0) + JetInJetV0(2, 0) * JetInJetV0(2, 0)); + double jetptInJetV0 = sqrt(JetInJetV0(1, 0) * JetInJetV0(1, 0) + JetInJetV0(2, 0) * JetInJetV0(2, 0)); registryData.fill(HIST("JetQA/JetthetaInJetV0frame"), TMath::ASin(jetthetaInJetV0)); registryData.fill(HIST("JetQA/JetphiInJetV0frame"), TMath::ASin(jetphiInJetV0)); registryData.fill(HIST("JetQA/JetpxInJetV0frame"), JetInJetV0(1, 0)); registryData.fill(HIST("JetQA/JetpyInJetV0frame"), JetInJetV0(2, 0)); registryData.fill(HIST("JetQA/JetpzInJetV0frame"), JetInJetV0(3, 0)); + registryData.fill(HIST("JetQA/JetptInJetV0frame"), jetptInJetV0); registryData.fill(HIST("protonQA/V0protonpxInJetV0frame"), protonInJetV0(1, 0)); registryData.fill(HIST("protonQA/V0protonpyInJetV0frame"), protonInJetV0(2, 0)); @@ -1776,18 +1410,7 @@ struct LfMyV0s { registryData.fill(HIST("protonQA/profileprotoncosSquarethetaInJetV0frame"), candidate.mLambda(), protoncosthetaInJetV0 * protoncosthetaInJetV0); double protonCosThetainJetV0 = protonInJetV0(3, 0) / protonPinJetV0; - double protonthetainJetV0 = TMath::ASin(protonSinThetainJetV0); - registryV0Data.fill(HIST("hprotoncosthetainJetV0"), protonCosThetainJetV0); - registryV0Data.fill(HIST("hprotonsinthetainJetV0"), protonSinThetainJetV0); - registryV0Data.fill(HIST("hprotonthetainJetV0"), protonthetainJetV0); - registryV0Data.fill(HIST("hprotoncosSquarethetainJetV0"), protonCosThetainJetV0 * protonCosThetainJetV0); - - registryV0Data.fill(HIST("hLambdamassandSinthetainJetV0"), candidate.mLambda(), protonSinThetainJetV0); - registryV0Data.fill(HIST("hLambdamassandCosthetainJetV0"), candidate.mLambda(), protonCosThetainJetV0); - registryV0Data.fill(HIST("hLambdamassandCosSquarethetainJetV0"), candidate.mLambda(), protonCosThetainJetV0 * protonCosThetainJetV0); - - registryV0Data.fill(HIST("AverageSinthetainJetV0"), candidate.mLambda(), protonSinThetainJetV0); - registryV0Data.fill(HIST("AverageCosSquarethetainJetV0"), candidate.mLambda(), protonCosThetainJetV0 * protonCosThetainJetV0); + protonsinPhiInJetV0frame = protonsinPhiInJetV0frame + protonInJetV0(2, 0) / sqrt(protonInJetV0(1, 0) * protonInJetV0(1, 0) + protonInJetV0(2, 0) * protonInJetV0(2, 0)); registryData.fill(HIST("TProfile2DLambdaPtMassSinPhi"), candidate.mLambda(), candidate.pt(), protonInJetV0(2, 0) / sqrt(protonInJetV0(1, 0) * protonInJetV0(1, 0) + protonInJetV0(2, 0) * protonInJetV0(2, 0))); @@ -1856,80 +1479,6 @@ struct LfMyV0s { } PROCESS_SWITCH(LfMyV0s, processData, "processData", true); - void processDataV0(SelCollisions::iterator const& collision, aod::V0Datas const& fullV0s, StrHadronDaughterTracks const&) - { - registryData.fill(HIST("hNEvents"), 0.5); - if (!AcceptEvent(collision)) { - return; - } - registryData.fill(HIST("hNEvents"), 8.5); - int V0NumbersPerEvent = 0; - int V0NumbersPerEventsel = 0; - for (const auto& v0 : fullV0s) { - V0NumbersPerEvent++; - float ctauLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0; - float ctauAntiLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0Bar; - const auto& pos = v0.posTrack_as(); - const auto& neg = v0.negTrack_as(); - if (passedLambdaSelection(v0, pos, neg) && ctauLambda < CtauLambda && ifpasslambda) { - V0NumbersPerEventsel++; - registryV0Data.fill(HIST("hLambdaPt"), v0.pt()); - registryV0Data.fill(HIST("hMassVsPtLambda"), v0.pt(), v0.mLambda()); - registryV0Data.fill(HIST("hMassLambda"), v0.mLambda()); - } else if (passedInitLambdaSelection(v0, pos, neg) && ifinitpasslambda) { - registryV0Data.fill(HIST("hLambdaPt"), v0.pt()); - registryV0Data.fill(HIST("hMassVsPtLambda"), v0.pt(), v0.mLambda()); - registryV0Data.fill(HIST("hMassLambda"), v0.mLambda()); - double PLambda = sqrt(v0.px() * v0.px() + v0.py() * v0.py() + v0.pz() * v0.pz()); - double ELambda = sqrt(v0.mLambda() * v0.mLambda() + PLambda * PLambda); - double protonE = sqrt(massPr * massPr + pos.px() * pos.px() + pos.py() * pos.py() + pos.pz() * pos.pz()); - TMatrixD pLabproton(4, 1); - pLabproton(0, 0) = protonE; - pLabproton(1, 0) = pos.px(); - pLabproton(2, 0) = pos.py(); - pLabproton(3, 0) = pos.pz(); - double protonCosThetainLab = pLabproton(3, 0) / pos.p(); - double protonSinThetainLab = pos.pt() / pos.p(); - double protonthetainLab = TMath::ASin(protonSinThetainLab); - registryV0Data.fill(HIST("hprotoncosthetainLab"), protonCosThetainLab); - registryV0Data.fill(HIST("hprotonsinthetainLab"), protonSinThetainLab); - registryV0Data.fill(HIST("hprotonthetainLab"), protonthetainLab); - registryV0Data.fill(HIST("hprotoncosSquarethetainLab"), protonCosThetainLab * protonCosThetainLab); - - TMatrixD protonInV0(4, 1); - protonInV0 = LorentzTransInV0frame(ELambda, v0.px(), v0.py(), v0.pz()) * pLabproton; - double protonPinV0 = sqrt(protonInV0(1, 0) * protonInV0(1, 0) + protonInV0(2, 0) * protonInV0(2, 0) + protonInV0(3, 0) * protonInV0(3, 0)); - double protonPtinV0 = sqrt(protonInV0(1, 0) * protonInV0(1, 0) + protonInV0(2, 0) * protonInV0(2, 0)); - double protonCosThetainV0 = protonInV0(3, 0) / protonPinV0; - double protonSinThetainV0 = protonPtinV0 / protonPinV0; - double protonthetainV0 = TMath::ASin(protonSinThetainV0); - registryV0Data.fill(HIST("hprotoncosthetainV0"), protonCosThetainV0); - registryV0Data.fill(HIST("hprotonsinthetainV0"), protonSinThetainV0); - registryV0Data.fill(HIST("hprotonthetainV0"), protonthetainV0); - registryV0Data.fill(HIST("hprotoncosSquarethetainV0"), protonCosThetainV0 * protonCosThetainV0); - - registryV0Data.fill(HIST("hLambdamassandSinthetainV0"), v0.mLambda(), protonSinThetainV0); - registryV0Data.fill(HIST("hLambdamassandCosthetainV0"), v0.mLambda(), protonCosThetainV0); - registryV0Data.fill(HIST("hLambdamassandCosSquarethetainV0"), v0.mLambda(), protonCosThetainV0 * protonCosThetainV0); - - registryV0Data.fill(HIST("AverageSinthetainV0"), v0.mLambda(), protonSinThetainV0); - registryV0Data.fill(HIST("AverageCosSquarethetainV0"), v0.mLambda(), protonCosThetainV0 * protonCosThetainV0); - } - if (passedAntiLambdaSelection(v0, pos, neg) && ctauAntiLambda < CtauLambda && ifpasslambda) { - registryV0Data.fill(HIST("hAntiLambdaPt"), v0.pt()); - registryV0Data.fill(HIST("hMassVsPtAntiLambda"), v0.pt(), v0.mAntiLambda()); - registryV0Data.fill(HIST("hMassAntiLambda"), v0.mAntiLambda()); - } else if (passedInitLambdaSelection(v0, pos, neg) && ifinitpasslambda) { - registryV0Data.fill(HIST("hAntiLambdaPt"), v0.pt()); - registryV0Data.fill(HIST("hMassVsPtAntiLambda"), v0.pt(), v0.mAntiLambda()); - registryV0Data.fill(HIST("hMassAntiLambda"), v0.mAntiLambda()); - } - } - registryV0Data.fill(HIST("nV0sPerEvent"), V0NumbersPerEvent); - registryV0Data.fill(HIST("nV0sPerEventsel"), V0NumbersPerEventsel); - } - PROCESS_SWITCH(LfMyV0s, processDataV0, "processDataV0", true); - // V0Collisions // SelCollisions using V0Collisions = soa::Join; @@ -1939,33 +1488,21 @@ struct LfMyV0s { if (!AcceptEventForLongitudinalPolarization(collision)) { return; } - registryLongitudinalPolarization.fill(HIST("hNEvents"), 8.5); - int V0NumbersPerEvent = 0; - int V0NumbersPerEventsel = 0; for (const auto& v0 : fullV0s) { // loop over V0s if (v0.v0Type() != v0TypeSelection) { continue; } - V0NumbersPerEvent++; const auto& pos = v0.posTrack_as(); const auto& neg = v0.negTrack_as(); if (NotITSAfterburner && (v0.negTrack_as().isITSAfterburner() || v0.posTrack_as().isITSAfterburner())) { continue; } - if (passedInitLambdaSelection(v0, pos, neg) && ifinitpasslambda) { - registryLongitudinalPolarization.fill(HIST("hMassVsPtLambda"), v0.pt(), v0.mLambda()); - registryLongitudinalPolarization.fill(HIST("hMassVsPtAntiLambda"), v0.pt(), v0.mAntiLambda()); - registryLongitudinalPolarization.fill(HIST("hMassLambda"), v0.mLambda()); - } if (AcceptV0Lambda(v0, pos, neg, collision) && ifpasslambda) { - V0NumbersPerEventsel++; - registryLongitudinalPolarization.fill(HIST("hMassLambdasel"), v0.mLambda()); - registryLongitudinalPolarization.fill(HIST("hMassVsPtLambdasel"), v0.pt(), v0.mLambda()); ProtonVec = ROOT::Math::PxPyPzMVector(v0.pxpos(), v0.pypos(), v0.pzpos(), massPr); PionVec = ROOT::Math::PxPyPzMVector(v0.pxneg(), v0.pyneg(), v0.pzneg(), massPi); @@ -1974,35 +1511,8 @@ struct LfMyV0s { ROOT::Math::Boost boost{LambdaVec.BoostToCM()}; ProtonBoostedVec = boost(ProtonVec); LambdaBoostedVec = boost(LambdaVec); - - registryLongitudinalPolarization.fill(HIST("V0pxInRest_frame"), LambdaBoostedVec.Px()); - registryLongitudinalPolarization.fill(HIST("V0pyInRest_frame"), LambdaBoostedVec.Py()); - registryLongitudinalPolarization.fill(HIST("V0pzInRest_frame"), LambdaBoostedVec.Pz()); - - double protonCosThetainV0 = ProtonBoostedVec.Pz() / ProtonBoostedVec.P(); - double protonCosThetainLab = ProtonVec.Pz() / ProtonVec.P(); - double protonSinPhiInLab = ProtonVec.Py() / sqrt(ProtonVec.Px() * ProtonVec.Px() + ProtonVec.Py() * ProtonVec.Py()); - double protonSinPhiInV0 = ProtonBoostedVec.Py() / sqrt(ProtonBoostedVec.Px() * ProtonBoostedVec.Px() + ProtonBoostedVec.Py() * ProtonBoostedVec.Py()); - - registryLongitudinalPolarization.fill(HIST("hprotoncosthetainV0"), protonCosThetainV0); - registryLongitudinalPolarization.fill(HIST("hprotoncosSquarethetainV0"), protonCosThetainV0 * protonCosThetainV0); - registryLongitudinalPolarization.fill(HIST("hLambdamassandCosthetaInV0"), v0.mLambda(), protonCosThetainV0); - - registryLongitudinalPolarization.fill(HIST("TProfile2DLambdaPtMassCostheta"), v0.mLambda(), v0.pt(), protonCosThetainV0); - registryLongitudinalPolarization.fill(HIST("TProfile2DLambdaPtMassCosSquareTheta"), v0.mLambda(), v0.pt(), protonCosThetainV0 * protonCosThetainV0); - - registryLongitudinalPolarization.fill(HIST("TProfile1DLambdaPtMassCostheta"), v0.mLambda(), protonCosThetainV0); - - registryLongitudinalPolarization.fill(HIST("TH2FLambdaPtCostheta"), protonCosThetainV0, v0.pt()); - registryLongitudinalPolarization.fill(HIST("hprotonThetaInLab"), TMath::ACos(protonCosThetainLab)); - registryLongitudinalPolarization.fill(HIST("hprotonPhiInLab"), TMath::ASin(protonSinPhiInLab)); - registryLongitudinalPolarization.fill(HIST("hprotonPhiInV0"), TMath::ASin(protonSinPhiInV0)); - - registryLongitudinalPolarization.fill(HIST("hprotonTheta"), TMath::ACos(protonCosThetainV0)); } if (AcceptV0AntiLambda(v0, pos, neg, collision) && ifpasslambda) { - registryLongitudinalPolarization.fill(HIST("hMassAntiLambdasel"), v0.mAntiLambda()); - registryLongitudinalPolarization.fill(HIST("hMassVsPtAntiLambdasel"), v0.pt(), v0.mAntiLambda()); ProtonVec = ROOT::Math::PxPyPzMVector(v0.pxneg(), v0.pyneg(), v0.pzneg(), massPr); PionVec = ROOT::Math::PxPyPzMVector(v0.pxpos(), v0.pypos(), v0.pzpos(), massPi); @@ -2011,24 +1521,8 @@ struct LfMyV0s { ROOT::Math::Boost boost{LambdaVec.BoostToCM()}; ProtonBoostedVec = boost(ProtonVec); LambdaBoostedVec = boost(LambdaVec); - - double protonCosThetainV0 = ProtonBoostedVec.Pz() / ProtonBoostedVec.P(); - double protonCosThetainLab = ProtonVec.Pz() / ProtonVec.P(); - - registryLongitudinalPolarization.fill(HIST("hantiprotoncosthetainV0"), protonCosThetainV0); - registryLongitudinalPolarization.fill(HIST("hantiprotoncosSquarethetainV0"), protonCosThetainV0 * protonCosThetainV0); - registryLongitudinalPolarization.fill(HIST("hAntiLambdamassandCosthetaInV0"), v0.mAntiLambda(), protonCosThetainV0); - - registryLongitudinalPolarization.fill(HIST("TProfile2DAntiLambdaPtMassCostheta"), v0.mAntiLambda(), v0.pt(), protonCosThetainV0); - registryLongitudinalPolarization.fill(HIST("TProfile2DAntiLambdaPtMassCosSquareTheta"), v0.mAntiLambda(), v0.pt(), protonCosThetainV0 * protonCosThetainV0); - registryLongitudinalPolarization.fill(HIST("TProfile1DAntiLambdaPtMassCostheta"), v0.mAntiLambda(), protonCosThetainV0); - registryLongitudinalPolarization.fill(HIST("TH2FAntiLambdaPtCostheta"), protonCosThetainV0, v0.pt()); - registryLongitudinalPolarization.fill(HIST("hAntiprotonThetaInLab"), TMath::ACos(protonCosThetainLab)); - registryLongitudinalPolarization.fill(HIST("hAntiprotonTheta"), TMath::ACos(protonCosThetainV0)); } } - registryLongitudinalPolarization.fill(HIST("nV0sPerEvent"), V0NumbersPerEvent); - registryLongitudinalPolarization.fill(HIST("nV0sPerEventsel"), V0NumbersPerEventsel); } PROCESS_SWITCH(LfMyV0s, processLongitudinalPolarization, "processLongitudinalPolarization", true); }; From a30cd83ca0352f4e0f333aeb2d399f2ac66e7c94 Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Sat, 18 Oct 2025 03:37:04 +0200 Subject: [PATCH 798/986] [PWGCF] FemtoUniverse: Add asymmetric deta-dphi cut for track-track (#13431) --- PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h index 778e0c4772b..4689373ec61 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h @@ -585,7 +585,7 @@ class FemtoUniverseDetaDphiStar } if (IsDphiAvgOrDist) { - if (std::pow(dphiAvg, 2) / std::pow(cutDeltaPhiStarMax, 2) + std::pow(deta, 2) / std::pow(cutDeltaEtaMax, 2) < 1.) { + if ((dphiAvg > cutDeltaPhiStarMin) && (dphiAvg < cutDeltaPhiStarMax) && (deta > cutDeltaEtaMin) && (deta < cutDeltaEtaMax)) { return true; } else { if (ChosenEventType == femto_universe_container::EventType::same) { From f6fc7eba2d9148443e13961d7a6b914b422b024e Mon Sep 17 00:00:00 2001 From: vbarbaso <146095385+vbarbaso@users.noreply.github.com> Date: Sat, 18 Oct 2025 09:24:11 +0200 Subject: [PATCH 799/986] [PWGLF] Normalization factors and optimalization of rotational BG (#13440) Signed-off-by: Veronika Barbasova Co-authored-by: Veronika Barbasova --- .../Tasks/Resonances/phianalysisTHnSparse.cxx | 290 +++++++++++++----- 1 file changed, 209 insertions(+), 81 deletions(-) diff --git a/PWGLF/Tasks/Resonances/phianalysisTHnSparse.cxx b/PWGLF/Tasks/Resonances/phianalysisTHnSparse.cxx index 14994cd0c16..8ae1d89dd78 100644 --- a/PWGLF/Tasks/Resonances/phianalysisTHnSparse.cxx +++ b/PWGLF/Tasks/Resonances/phianalysisTHnSparse.cxx @@ -68,6 +68,7 @@ struct PhianalysisTHnSparse { Configurable dcaXY{"dcaXY", 1.0f, "Cut: Maximal value of tracks DCA XY."}; Configurable dcaZ{"dcaZ", 1.0f, "Cut: Maximal value of tracks DCA Z."}; Configurable globalTrack{"globalTrack", false, "Use global track selection."}; + Configurable inelGrater0{"inelGrater0", true, "Select events with INEL>0."}; Configurable tpcNClsFound{"tpcNClsFound", 70, "Cut: Minimal value of found TPC clasters"}; } cut; @@ -101,6 +102,9 @@ struct PhianalysisTHnSparse { // rotational Configurable numberofRotations{"numberofRotations", 1, "Number of rotations for rotational background estimation."}; + // Normalization factors + ConfigurableAxis axisNch{"axisNch", {100, 0.0f, +100.0f}, "Number of charged particles in |y| < 0.5"}; + // Axes specifications AxisSpec posZaxis = {400, -20., 20., "V_{z} (cm)"}; AxisSpec dcaXYaxis = {800, -2.0, 2.0, "DCA_{xy} (cm)"}; @@ -119,7 +123,7 @@ struct PhianalysisTHnSparse { double* pointPair = nullptr; double* pointSys = nullptr; ROOT::Math::PxPyPzMVector d1, d2, mother; - bool produceTrue, produceLikesign, produceQA, produceStats, produceRotational, dataQA, MCTruthQA, globalTrack, tpcPidOnly = false; + bool produceTrue, produceLikesign, produceQA, produceStats, produceRotational, dataQA, MCTruthQA, globalTrack, inelGrater0, tpcPidOnly = false; float tpcnSigmaPos = 100.0f; float tpcnSigmaNeg = 100.0f; float combinedNSigma = 100.0f; @@ -133,14 +137,15 @@ struct PhianalysisTHnSparse { Filter triggerFilter = (o2::aod::evsel::sel8 == true); Filter vtxFilter = (nabs(o2::aod::collision::posZ) < vzCut); - using EventCandidates = soa::Filtered>; + using EventCandidates = soa::Filtered>; using EventCandidate = EventCandidates::iterator; using TrackCandidates = soa::Join; - using EventCandidatesMC = soa::Filtered>; - using TrackCandidatesMC = soa::Join; + using EventCandidatesMC = soa::Filtered>; + using TrackCandidatesMC = soa::Join; - using EventCandidatesMCGen = soa::Join; + using EventCandidatesMCGen = soa::Join; + using McCollisionMults = soa::Join; using LabeledTracks = soa::Join; Preslice perCollision = aod::track::collisionId; @@ -191,6 +196,7 @@ struct PhianalysisTHnSparse { tpcnSigmaNeg = static_cast(cut.tpcnSigmaNeg); tpcNClsFound = static_cast(cut.tpcNClsFound); globalTrack = static_cast(cut.globalTrack); + inelGrater0 = static_cast(cut.inelGrater0); combinedNSigma = static_cast(cut.combinedNSigma); tpcPidOnly = static_cast(cut.tpcPidOnly); ptTOFThreshold = static_cast(cut.ptTOFThreshold); @@ -221,6 +227,7 @@ struct PhianalysisTHnSparse { LOGF(info, "dcaXY: %.2f", static_cast(cut.dcaXY)); LOGF(info, "dcaZ: %.2f", static_cast(cut.dcaZ)); LOGF(info, "globalTrack: %s", globalTrack ? "true" : "false"); + LOGF(info, "inelGrater0: %s", inelGrater0 ? "true" : "false"); LOGF(info, "tpcNClsFound: %d", tpcNClsFound); LOGF(info, "mixingType: %d", static_cast(mixingType)); LOGF(info, "numberofMixedEvents: %d", static_cast(numberofMixedEvents)); @@ -237,11 +244,12 @@ struct PhianalysisTHnSparse { if (produceQA) { // Event QA - registry.add("QAEvent/hSelection", "Event selection statistics", kTH1D, {{3, 0.0f, 3.0f}}); + registry.add("QAEvent/hSelection", "Event selection statistics", kTH1D, {{4, 0.0f, 4.0f}}); auto hEvent = registry.get(HIST("QAEvent/hSelection")); hEvent->GetXaxis()->SetBinLabel(1, "Full event statistics"); - hEvent->GetXaxis()->SetBinLabel(2, "Events with at least one #phi candidate"); - hEvent->GetXaxis()->SetBinLabel(3, "#phi candidates"); + hEvent->GetXaxis()->SetBinLabel(2, "Events with at least one primary vertex"); + hEvent->GetXaxis()->SetBinLabel(3, "Events with at least one #phi candidate"); + hEvent->GetXaxis()->SetBinLabel(4, "Number of #phi candidates"); hEvent->SetMinimum(0.1); registry.add("QAEvent/hVtxZ", "Vertex position along the z-axis", kTH1F, {posZaxis}); @@ -269,6 +277,28 @@ struct PhianalysisTHnSparse { registry.add("QATrack/hDCAz", "Distribution of DCA_{z} of K^{+} and K^{-}", kTH1F, {dcaZaxis}); registry.add("QATrack/hPt", "Distribution of p_{T} of K^{+} and K^{-}", kTH1F, {ptaxis}); + // General Phi distributions + registry.add("QAPhi/hRapidity", "Rapidity distribution of #phi candidates", kTH1F, {rapidityaxis}); + registry.add("QAPhi/hEta", "Pseudorapidity distribution of #phi candidates", kTH1F, {etaaxis}); + + registry.add("QAPhi/hdPhi", "Azimuthal distribution of #phi candidates", kTH1F, {{100, -o2::constants::math::TwoPI, o2::constants::math::TwoPI}}); + auto hdPhi = registry.get(HIST("QAPhi/hdPhi")); + hdPhi->GetXaxis()->SetTitle("#phi (rad)"); + + registry.add("QAPhi/h2dPhiPt", "Azimuthal distribution of #Delta#phi candidates vs p_{T}", kTH2F, {ptaxis, {100, -o2::constants::math::TwoPI, o2::constants::math::TwoPI}}); + auto h2dPhiPt = registry.get(HIST("QAPhi/h2dPhiPt")); + h2dPhiPt->GetXaxis()->SetTitle("p_{T} (GeV/c)"); + h2dPhiPt->GetYaxis()->SetTitle("#Delta#phi (rad)"); + + registry.add("QAPhi/hTheta", "Polar distribution of #phi candidates", kTH1F, {{100, 0.0f, o2::constants::math::PI}}); + auto hTheta = registry.get(HIST("QAPhi/hTheta")); + hTheta->GetXaxis()->SetTitle("#theta (rad)"); + + registry.add("QAPhi/h2dThetaPt", "Polar distribution of #phi candidates vs p_{T}", kTH2F, {{12, 0, 12}, {100, -o2::constants::math::PI, o2::constants::math::PI}}); + auto h2dThetaPt = registry.get(HIST("QAPhi/h2dThetaPt")); + h2dThetaPt->GetXaxis()->SetTitle("p_{T} (GeV/c)"); + h2dThetaPt->GetYaxis()->SetTitle("#theta (rad)"); + // TPC PID registry.add("QATrack/hTPCnSigma", "Distribution of TPC nSigma of K^{+} and K^{-}", kTH1F, {{200, -10, 10}}); @@ -302,15 +332,7 @@ struct PhianalysisTHnSparse { hMCEventTruth->GetXaxis()->SetBinLabel(1, "Full MC Truth event statistics"); hMCEventTruth->SetMinimum(0.1); - registry.add("QAMC/hInvMassTrueFalse", "", kTH1F, {invAxis}); // not written events in True distribution due to repetition of mothers?? - - // MC Gen - registry.add("QAMC/Gen/hMCEvent", "MC Gen Event statistics", kTH1F, {{3, 0.0f, 3.0f}}); - auto hMCEventGen = registry.get(HIST("QAMC/Gen/hMCEvent")); - hMCEventGen->GetXaxis()->SetBinLabel(1, "Full McCollision statistics"); - hMCEventGen->GetXaxis()->SetBinLabel(2, "McCollision V_{z} cut"); - hMCEventGen->GetXaxis()->SetBinLabel(3, "collisions"); - hMCEventGen->SetMinimum(0.1); + registry.add("QAMC/Truth/hInvMassTrueFalse", "", kTH1F, {invAxis}); // not written events in True distribution due to repetition of mothers?? } // Mixing QA if (mixingType != rsn::MixingType::none) { @@ -334,10 +356,51 @@ struct PhianalysisTHnSparse { hEMTvz->GetXaxis()->SetTitle("1.Event V_{z}"); hEMTvz->GetYaxis()->SetTitle("2.Event V_{z}"); } - } - pointSys[static_cast(o2::analysis::rsn::SystematicsAxisType::ncl)] = tpcNClsFound; - rsnOutput->fillSystematics(pointSys); + if (produceRotational) { + registry.add("QARotational/hSelection", "Rotational background selection statistics", kTH1D, {{1, 0.0f, 1.0f}}); + auto hRB = registry.get(HIST("QARotational/hSelection")); + hRB->GetXaxis()->SetBinLabel(1, "Full rotational background statistics"); + hRB->SetMinimum(0.1); + + // General rotational distributions + registry.add("QARotational/hRapidity", "Rapidity distribution of #phi candidates from rotational background", kTH1F, {rapidityaxis}); + registry.add("QARotational/hEta", "Pseudorapidity distribution of #phi candidates from rotational background", kTH1F, {etaaxis}); + + // Angular distributions for rotational background + registry.add("QARotational/hdPhi", "Rotational background #Delta#phi distribution", kTH1F, {{100, -o2::constants::math::TwoPI, o2::constants::math::TwoPI}}); + auto hRPhi = registry.get(HIST("QARotational/hdPhi")); + hRPhi->GetXaxis()->SetTitle("#Delta#phi"); + hRPhi->GetYaxis()->SetTitle("Counts"); + + registry.add("QARotational/h2dPhiPt", "Rotational background #Delta#phi vs p_{T}", kTH2F, {ptaxis, {100, -o2::constants::math::TwoPI, o2::constants::math::TwoPI}}); + auto hR2dPhiPt = registry.get(HIST("QARotational/h2dPhiPt")); + hR2dPhiPt->GetXaxis()->SetTitle("p_{T} (GeV/c)"); + hR2dPhiPt->GetYaxis()->SetTitle("#Delta#phi"); + + registry.add("QARotational/hTheta", "Rotational background #Delta#theta distribution", kTH1F, {{100, 0.0f, o2::constants::math::PI}}); + auto hRdTheta = registry.get(HIST("QARotational/hTheta")); + hRdTheta->GetXaxis()->SetTitle("#Delta#theta"); + hRdTheta->GetYaxis()->SetTitle("Counts"); + + registry.add("QARotational/h2dThetaPt", "Rotational background #Delta#theta vs p_{T}", kTH2F, {{12, 0, 12}, {100, -o2::constants::math::PI, o2::constants::math::PI}}); + auto hR2dThetaPt = registry.get(HIST("QARotational/h2dThetaPt")); + hR2dThetaPt->GetXaxis()->SetTitle("p_{T} (GeV/c)"); + hR2dThetaPt->GetYaxis()->SetTitle("#Delta#theta"); + } + } + // Event/Signal loss histograms + registry.add("Factors/hCentralityVsMultMC", "Event centrality vs MC multiplicity", kTH2F, {{101, 0.0f, 101.0f}, axisNch}); + registry.add("Factors/hEventCentrality", "Event centrality", kTH1F, {{101, 0, 101}}); + registry.add("Factors/hNrecInGen", "Number of collisions in MC", kTH1F, {{4, -0.5, 3.5}}); + registry.add("Factors/hGenEvents", "Generated events", HistType::kTH2F, {{axisNch}, {4, 0, 4}}); + auto hGenEvents = registry.get(HIST("Factors/hGenEvents")); + hGenEvents->GetYaxis()->SetBinLabel(1, "All generated events"); + hGenEvents->GetYaxis()->SetBinLabel(2, "Generated events with Mc collision V_{z} cut"); + hGenEvents->GetYaxis()->SetBinLabel(3, "Generated events with Mc collision V_{z} cut and INEL>0"); + hGenEvents->GetYaxis()->SetBinLabel(4, "Generated events with at least one reconstructed event"); + registry.add("Factors/h2dGenPhi", "Centrality vs p_{T}", kTH2D, {{101, 0.0f, 101.0f}, ptaxis}); + registry.add("Factors/h3dGenPhiVsMultMCVsCentrality", "MC multiplicity vs centrality vs p_{T}", kTH3D, {axisNch, {101, 0.0f, 101.0f}, ptaxis}); } template @@ -430,7 +493,6 @@ struct PhianalysisTHnSparse { float centrality = collision.centFT0M(); return centrality; } - double* fillPointPair(double im, double pt, double mu, double ce, double ns1, double ns2, double eta, double y, double vz, double mum, double cem, double vzm) { pointPair[static_cast(o2::analysis::rsn::PairAxisType::im)] = im; @@ -454,8 +516,17 @@ struct PhianalysisTHnSparse { auto posDaughters = positive->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); auto negDaughters = negative->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); n = 0; - if (produceQA) { + + if (produceQA) registry.fill(HIST("QAEvent/hSelection"), 0.5); + + if (inelGrater0 && !collision.isInelGt0()) + return; + + registry.fill(HIST("Factors/hEventCentrality"), collision.centFT0M()); + + if (produceQA) { + registry.fill(HIST("QAEvent/hSelection"), 1.5); registry.fill(HIST("QAEvent/hVtxZ"), collision.posZ()); registry.fill(HIST("QAEvent/hMult"), getMultiplicity(collision)); registry.fill(HIST("QAEvent/hCent"), getCentrality(collision)); @@ -512,6 +583,13 @@ struct PhianalysisTHnSparse { registry.fill(HIST("QATrack/hTPCNClsFound"), track2.tpcNClsFound()); registry.fill(HIST("QATrack/hRapidity"), track1.rapidity(massPos)); registry.fill(HIST("QATrack/hRapidity"), track2.rapidity(massNeg)); + + registry.fill(HIST("QAPhi/hRapidity"), mother.Rapidity()); + registry.fill(HIST("QAPhi/hEta"), mother.Eta()); + registry.fill(HIST("QAPhi/hdPhi"), track1.phi() - track2.phi()); + registry.fill(HIST("QAPhi/h2dPhiPt"), mother.Pt(), track1.phi() - track2.phi()); + registry.fill(HIST("QAPhi/hTheta"), mother.Theta()); + registry.fill(HIST("QAPhi/h2dThetaPt"), mother.Pt(), d1.Theta() - d2.Theta()); } pointPair = fillPointPair(mother.M(), @@ -529,11 +607,47 @@ struct PhianalysisTHnSparse { rsnOutput->fillUnlikepm(pointPair); if (produceQA) { - registry.fill(HIST("QAEvent/hSelection"), 2.5); + registry.fill(HIST("QAEvent/hSelection"), 3.5); if (n == 0) - registry.fill(HIST("QAEvent/hSelection"), 1.5); + registry.fill(HIST("QAEvent/hSelection"), 2.5); } n = n + 1; + + if (produceRotational) { + for (int i = 1; i <= static_cast(numberofRotations); i++) { + // compute rotation angle in radians using o2::constants::math::PI + float angleDeg = i * (360.0f / (static_cast(numberofRotations) + 1)); + float angleRad = angleDeg * (o2::constants::math::PI / 180.0f); + float px2new = track2.px() * std::cos(angleRad) - track2.py() * std::sin(angleRad); + float py2new = track2.px() * std::sin(angleRad) + track2.py() * std::cos(angleRad); + d2 = ROOT::Math::PxPyPzMVector(px2new, py2new, track2.pz(), massNeg); + mother = d1 + d2; + + if (produceQA) { + registry.fill(HIST("QARotational/hSelection"), 0.5); + registry.fill(HIST("QARotational/hRapidity"), mother.Rapidity()); + registry.fill(HIST("QARotational/hEta"), mother.Eta()); + registry.fill(HIST("QARotational/hdPhi"), track1.phi() - track2.phi()); + registry.fill(HIST("QARotational/h2dPhiPt"), mother.Pt(), track1.phi() - track2.phi()); + registry.fill(HIST("QARotational/hTheta"), mother.Theta()); + registry.fill(HIST("QARotational/h2dThetaPt"), mother.Pt(), d1.Theta() - d2.Theta()); + } + pointPair = fillPointPair(mother.M(), + mother.Pt(), + getMultiplicity(collision), + getCentrality(collision), + track1.tpcNSigmaKa(), + track2.tpcNSigmaKa(), + mother.Eta(), + mother.Rapidity(), + collision.posZ(), + 0, + 0, + 0); + + rsnOutput->fillRotationpm(pointPair); + } + } } if (produceLikesign) { @@ -594,46 +708,6 @@ struct PhianalysisTHnSparse { rsnOutput->fillLikemm(pointPair); } } - - if (produceRotational) { - for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(posDaughters, negDaughters))) { - - if (!selectedTrack(track1, true)) - continue; - if (!selectedTrack(track2, false)) - continue; - - d1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massPos); - d2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massNeg); - mother = d1 + d2; - - if (std::abs(mother.Rapidity()) > static_cast(cut.rapidity)) - continue; - - for (int i = 1; i <= static_cast(numberofRotations); i++) { - float angle = i * (360.0f / (static_cast(numberofRotations) + 1)); - float px2new = track2.px() * std::cos(angle * TMath::DegToRad()) - track2.py() * std::sin(angle * TMath::DegToRad()); - float py2new = track2.px() * std::sin(angle * TMath::DegToRad()) + track2.py() * std::cos(angle * TMath::DegToRad()); - d2 = ROOT::Math::PxPyPzMVector(px2new, py2new, track2.pz(), massNeg); - mother = d1 + d2; - - pointPair = fillPointPair(mother.M(), - mother.Pt(), - getMultiplicity(collision), - getCentrality(collision), - track1.tpcNSigmaKa(), - track2.tpcNSigmaKa(), - mother.Eta(), - mother.Rapidity(), - collision.posZ(), - 0, - 0, - 0); - - rsnOutput->fillRotationpm(pointPair); - } - } - } } PROCESS_SWITCH(PhianalysisTHnSparse, processData, "Process Event for Data", true); @@ -652,6 +726,11 @@ struct PhianalysisTHnSparse { LOGF(warning, "No MC collision for this collision, skip..."); return; } + auto mcCollision = collision.mcCollision(); + if (std::abs(mcCollision.posZ()) > vzCut) + return; + if (inelGrater0 && !collision.isInelGt0()) + return; for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(posDaughtersMC, negDaughtersMC))) { @@ -706,7 +785,7 @@ struct PhianalysisTHnSparse { if (n > 0) { if (produceQA) - registry.fill(HIST("QAMC/hInvMassTrueFalse"), mother.M()); + registry.fill(HIST("QAMC/Truth/hInvMassTrueFalse"), mother.M()); continue; } @@ -731,31 +810,18 @@ struct PhianalysisTHnSparse { } PROCESS_SWITCH(PhianalysisTHnSparse, processTrue, "Process Event for MC reconstruction.", false); - void processGen(aod::McCollision const& mcCollision, soa::SmallGroups const& collisions, LabeledTracks const& /*particles*/, aod::McParticles const& mcParticles) + void processGen(McCollisionMults::iterator const& mcCollision, soa::SmallGroups const& collisions, LabeledTracks const& /*particles*/, aod::McParticles const& mcParticles) { - - if (produceQA) - registry.fill(HIST("QAMC/Gen/hMCEvent"), 0.5); - if (std::abs(mcCollision.posZ()) > vzCut) return; - if (produceQA) - registry.fill(HIST("QAMC/Gen/hMCEvent"), 1.5); + if (inelGrater0 && !mcCollision.isInelGt0()) + return; if (collisions.size() == 0) return; for (const auto& collision : collisions) { - if (produceQA) - registry.fill(HIST("QAMC/Gen/hMCEvent"), 2.5); - - if (!collision.has_mcCollision()) { - if (static_cast(verbose.verboselevel) > 0) - LOGF(warning, "No McCollision for this collision, skip..."); - return; - } - auto centralityGen = getCentrality(collision); auto multiplicityGen = getMultiplicity(collision); @@ -962,6 +1028,68 @@ struct PhianalysisTHnSparse { } } PROCESS_SWITCH(PhianalysisTHnSparse, processMixed, "Process Mixing Event.", false); + + void processFactors(McCollisionMults::iterator const& mcCollision, soa::SmallGroups const& collisions, LabeledTracks const& /*particles*/, aod::McParticles const& mcParticles) + { + registry.fill(HIST("Factors/hGenEvents"), mcCollision.multMCNParticlesEta08(), 0.5); + + if (std::abs(mcCollision.posZ()) > vzCut) + return; + + registry.fill(HIST("Factors/hGenEvents"), mcCollision.multMCNParticlesEta08(), 1.5); + + if (inelGrater0 && !mcCollision.isInelGt0()) + return; + + registry.fill(HIST("Factors/hGenEvents"), mcCollision.multMCNParticlesEta08(), 2.5); + + float centrality = 100.5f; + for (auto const& collision : collisions) { + centrality = collision.centFT0M(); + } + + registry.fill(HIST("Factors/hCentralityVsMultMC"), centrality, mcCollision.multMCNParticlesEta08()); + registry.fill(HIST("Factors/hNrecInGen"), collisions.size()); + + for (const auto& particle : mcParticles) { + + if (std::abs(particle.y()) > static_cast(cut.rapidity)) + continue; + + if (particle.pdgCode() == motherPDG) { + + auto daughters = particle.daughters_as(); + if (daughters.size() != dauSize) + continue; + + auto daup = false; + auto daun = false; + + for (const auto& dau : daughters) { + if (dau.pdgCode() == daughterPosPDG) { + daup = true; + d1 = ROOT::Math::PxPyPzMVector(dau.px(), dau.py(), dau.pz(), massPos); + } else if (dau.pdgCode() == -daughterNegPDG) { + daun = true; + d2 = ROOT::Math::PxPyPzMVector(dau.px(), dau.py(), dau.pz(), massNeg); + } + } + if (!daup || !daun) + continue; + + mother = d1 + d2; + + registry.fill(HIST("Factors/h2dGenPhi"), centrality, mother.Pt()); + registry.fill(HIST("Factors/h3dGenPhiVsMultMCVsCentrality"), mcCollision.multMCNParticlesEta08(), centrality, mother.Pt()); + } + } + + if (collisions.size() == 0) + return; + + registry.fill(HIST("Factors/hGenEvents"), mcCollision.multMCNParticlesEta08(), 3.5); + } + PROCESS_SWITCH(PhianalysisTHnSparse, processFactors, "Process to obtain normalization factors from MC.", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { From 3c24231a45278eeac17b84fb798379aa96ca58fa Mon Sep 17 00:00:00 2001 From: JimunLee Date: Sat, 18 Oct 2025 16:24:40 +0900 Subject: [PATCH 800/986] [PWGLF] Added a few histograms of KstarInOO.cxx (#13415) Co-authored-by: jimun_lee --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 48 ++++++++++++++-------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 6cab67014aa..c924acc15f4 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -179,10 +179,10 @@ struct kstarInOO { } if (cfgMcHistos) { - // histos.add("hPion_PID_Purity", "hPion_PID_Purity", kTH1F, {{3, -1.5, 1.5}}); - // histos.add("hKaon_PID_Purity", "hKaon_PID_Purity", kTH1F, {{3, -1.5, 1.5}}); - // histos.add("hSimplePion_PID_Purity", "hSimplePion_PID_Purity", kTH1F, {{3, -1.5, 1.5}}); - // histos.add("hSimpleKaon_PID_Purity", "hSimpleKaon_PID_Purity", kTH1F, {{3, -1.5, 1.5}}); + histos.add("hPion_PID_Purity", "hPion_PID_Purity", kTH1F, {{3, -1.5, 1.5}}); + histos.add("hKaon_PID_Purity", "hKaon_PID_Purity", kTH1F, {{3, -1.5, 1.5}}); + histos.add("hSimplePion_PID_Purity", "hSimplePion_PID_Purity", kTH1F, {{3, -1.5, 1.5}}); + histos.add("hSimpleKaon_PID_Purity", "hSimpleKaon_PID_Purity", kTH1F, {{3, -1.5, 1.5}}); histos.add("nEvents_MC", "nEvents_MC", kTH1F, {{4, 0.0, 4.0}}); histos.add("nEvents_MC_True", "nEvents_MC_True", kTH1F, {{4, 0.0, 4.0}}); @@ -191,8 +191,13 @@ struct kstarInOO { histos.add("hMC_USS_True", "hMC_USS_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); histos.add("hMC_USS_KPi", "hMC_USS_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_USS_PiK", "hMC_USS_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); histos.add("hMC_LSS_KPi", "hMC_LSS_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_LSS_PiK", "hMC_LSS_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_USS_KPi_Mix", "hMC_USS_KPi_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_USS_PiK_Mix", "hMC_USS_PiK_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_USS_KPi_True", "hMC_USS_KPi_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); histos.add("hMC_USS_PiK_True", "hMC_USS_PiK_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); } @@ -279,13 +284,11 @@ struct kstarInOO { return false; if (cfgTrackGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) return false; - // if (cfgTracknFindableTPCClusters > 0 && track.tpcNClsFindable() < cfgTracknFindableTPCClusters) - if (track.tpcNClsFindable() < cfgTracknFindableTPCClusters) + if (cfgTracknFindableTPCClusters > 0 && track.tpcNClsFindable() < cfgTracknFindableTPCClusters) return false; if (track.tpcNClsCrossedRows() < cfgTracknTPCCrossedRows) return false; - // if (cfgTracknRowsOverFindable > 0 && track.tpcCrossedRowsOverFindableCls() > cfgTracknRowsOverFindable) - if (track.tpcCrossedRowsOverFindableCls() > cfgTracknRowsOverFindable) + if (cfgTracknRowsOverFindable > 0 && track.tpcCrossedRowsOverFindableCls() > cfgTracknRowsOverFindable) return false; if (track.tpcChi2NCl() > cfgTracknTPCChi2) return false; @@ -416,17 +419,17 @@ struct kstarInOO { std::vector PIDPurityKey_Kaon; std::vector PIDPurityKey_Pion; - double KstarPt_Kpi, Minv_Kpi; + // double KstarPt_Kpi, Minv_Kpi; for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) continue; - // auto [KstarPt_Kpi, Minv_Kpi] = minvReconstruction(trk1, trk2, QA, false); - // auto [KstarPt_piK, Minv_piK] = minvReconstruction(trk1, trk2, QA, true); + auto [KstarPt_Kpi, Minv_Kpi] = minvReconstruction(trk1, trk2, QA, false); + auto [KstarPt_piK, Minv_piK] = minvReconstruction(trk1, trk2, QA, true); - std::tie(KstarPt_Kpi, Minv_Kpi) = minvReconstruction(trk1, trk2, QA, false); - std::tie(KstarPt_Kpi, Minv_Kpi) = minvReconstruction(trk1, trk2, QA, true); + // std::tie(KstarPt_Kpi, Minv_Kpi) = minvReconstruction(trk1, trk2, QA, false); + // std::tie(KstarPt_Kpi, Minv_Kpi) = minvReconstruction(trk1, trk2, QA, true); if (Minv_Kpi < 0) continue; @@ -436,12 +439,15 @@ struct kstarInOO { if (!IsMix) { if (conjugate < 0) { histos.fill(HIST("hMC_USS_KPi"), centrality, KstarPt_Kpi, Minv_Kpi); + histos.fill(HIST("hMC_USS_PiK"), centrality, KstarPt_piK, Minv_piK); } else if (conjugate > 0) { histos.fill(HIST("hMC_LSS_KPi"), centrality, KstarPt_Kpi, Minv_Kpi); + histos.fill(HIST("hMC_LSS_PiK"), centrality, KstarPt_piK, Minv_piK); } } else { if (conjugate < 0) { histos.fill(HIST("hMC_USS_KPi_Mix"), centrality, KstarPt_Kpi, Minv_Kpi); + histos.fill(HIST("hMC_USS_PiK_Mix"), centrality, KstarPt_piK, Minv_piK); } } } @@ -535,20 +541,14 @@ struct kstarInOO { if (!trackSelection(trk1, false) || !trackSelection(trk2, false)) return {-1.0, -1.0}; - if (!flip) { - if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA)) { - return {-1.0, -1.0}; - } - } else { - if (!trackPIDPion(trk1, false) || !trackPIDKaon(trk2, false)) - return {-1.0, -1.0}; - } - - if (trk1.index() >= trk2.index()) + if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA)) return {-1.0, -1.0}; - // if (trk1.globalIndex() == trk2.globalIndex()) + // if (trk1.index() >= trk2.index()) // return {-1.0, -1.0}; + // I checked that index and globalIndex was same function + if (trk1.globalIndex() >= trk2.globalIndex()) + return {-1.0, -1.0}; TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; if (!flip) { From ebe3f7ab78dd261dc2fbe9a3503d3097895f2313 Mon Sep 17 00:00:00 2001 From: lucamicheletti93 <38209984+lucamicheletti93@users.noreply.github.com> Date: Sat, 18 Oct 2025 11:29:45 +0200 Subject: [PATCH 801/986] [PWGDQ] Adding process function for muon flow (#13439) Co-authored-by: Lucamicheletti93 --- PWGDQ/Tasks/tableReader_withAssoc.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index db2ef8b7a2a..5423591e7d9 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -1313,7 +1313,7 @@ struct AnalysisSameEventPairing { { fEnableBarrelHistos = context.mOptions.get("processAllSkimmed") || context.mOptions.get("processBarrelOnlySkimmed") || context.mOptions.get("processBarrelOnlyWithCollSkimmed") || context.mOptions.get("processBarrelOnlySkimmedNoCov") || context.mOptions.get("processBarrelOnlySkimmedNoCovWithMultExtra") || context.mOptions.get("processBarrelOnlyWithQvectorCentrSkimmedNoCov"); fEnableBarrelMixingHistos = context.mOptions.get("processMixingAllSkimmed") || context.mOptions.get("processMixingBarrelSkimmed") || context.mOptions.get("processMixingBarrelSkimmedFlow") || context.mOptions.get("processMixingBarrelWithQvectorCentrSkimmedNoCov"); - fEnableMuonHistos = context.mOptions.get("processAllSkimmed") || context.mOptions.get("processMuonOnlySkimmed") || context.mOptions.get("processMuonOnlySkimmedMultExtra") || context.mOptions.get("processMixingMuonSkimmed"); + fEnableMuonHistos = context.mOptions.get("processAllSkimmed") || context.mOptions.get("processMuonOnlySkimmed") || context.mOptions.get("processMuonOnlySkimmedMultExtra") || context.mOptions.get("processMuonOnlySkimmedFlow") || context.mOptions.get("processMixingMuonSkimmed"); fEnableMuonMixingHistos = context.mOptions.get("processMixingAllSkimmed") || context.mOptions.get("processMixingMuonSkimmed"); if (context.mOptions.get("processDummy")) { @@ -2291,6 +2291,12 @@ struct AnalysisSameEventPairing { runSameEventPairing(events, muonAssocsPerCollision, muonAssocs, muons); } + void processMuonOnlySkimmedFlow(MyEventsQvectorCentrSelected const& events, + soa::Join const& muonAssocs, MyMuonTracksWithCovWithAmbiguities const& muons) + { + runSameEventPairing(events, muonAssocsPerCollision, muonAssocs, muons); + } + void processMixingAllSkimmed(soa::Filtered& events, soa::Join const& trackAssocs, MyBarrelTracksWithCov const& tracks, soa::Join const& muonAssocs, MyMuonTracksWithCovWithAmbiguities const& muons) @@ -2337,6 +2343,7 @@ struct AnalysisSameEventPairing { PROCESS_SWITCH(AnalysisSameEventPairing, processBarrelOnlySkimmedFlow, "Run barrel only pairing, with skimmed tracks and with flow", false); PROCESS_SWITCH(AnalysisSameEventPairing, processMuonOnlySkimmed, "Run muon only pairing, with skimmed tracks", false); PROCESS_SWITCH(AnalysisSameEventPairing, processMuonOnlySkimmedMultExtra, "Run muon only pairing, with skimmed tracks", false); + PROCESS_SWITCH(AnalysisSameEventPairing, processMuonOnlySkimmedFlow, "Run muon only pairing, with skimmed tracks and flow", false); PROCESS_SWITCH(AnalysisSameEventPairing, processMixingAllSkimmed, "Run all types of mixed pairing, with skimmed tracks/muons", false); PROCESS_SWITCH(AnalysisSameEventPairing, processMixingBarrelSkimmed, "Run barrel type mixing pairing, with skimmed tracks", false); PROCESS_SWITCH(AnalysisSameEventPairing, processMixingBarrelSkimmedFlow, "Run barrel type mixing pairing, with flow, with skimmed tracks", false); From 389e3eccf83896beb6de98085121068ec6aa6a2f Mon Sep 17 00:00:00 2001 From: Gyula Bencedi Date: Sat, 18 Oct 2025 22:44:55 +0200 Subject: [PATCH 802/986] [PWGLF] Added process for checking secondaries (#13444) --- PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx | 448 +++++++++++++++++++---------- 1 file changed, 291 insertions(+), 157 deletions(-) diff --git a/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx b/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx index 20be3691600..0abdc236183 100644 --- a/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx +++ b/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx @@ -99,6 +99,7 @@ struct DndetaMFTPbPb { std::array, 4> hCollAssoc; std::array, 4> hReAssoc; + std::array, 6> hDCAMc; enum OccupancyEst { TrkITS = 1, Ft0C }; @@ -120,7 +121,7 @@ struct DndetaMFTPbPb { Configurable cfgIRSource{"cfgIRSource", "ZNC hadronic", "Estimator of the interaction rate (Pb-Pb: ZNC hadronic)"}; Configurable cfgUseTrackSel{"cfgUseTrackSel", false, "Flag to apply track selection"}; Configurable cfgUseParticleSel{"cfgUseParticleSel", false, "Flag to apply particle selection"}; - Configurable cfgRemoveTrivialAssoc{"cfgRemoveTrivialAssoc", false, "Skip trivial associations"}; + Configurable cfgRemoveReassigned{"cfgRemoveReassigned", false, "Remove reassgined tracks"}; struct : ConfigurableGroup { ConfigurableAxis interactionRateBins{"interactionRateBins", {500, 0, 50}, "Binning for the interaction rate (kHz)"}; @@ -880,7 +881,6 @@ struct DndetaMFTPbPb { hCollAssoc[2] = qaregistry.add("TrackToColl/hGoodAssocTracks", ";#it{p}_{T}^{reco} (GeV/#it{c});#it{#eta}^{reco};#it{Z}_{vtx}^{reco}#minus#it{Z}_{vtx}^{gen} (cm)", HistType::kTHnSparseF, {ptAxis, etaAxis, deltaZAxis}); // tracks associated to the correct collision considering all ambiguous reco collisions (based on the MC collision index) hCollAssoc[3] = qaregistry.add("TrackToColl/hGoodAssocTracksAmb", ";#it{p}_{T}^{reco} (GeV/#it{c});#it{#eta}^{reco};#it{Z}_{vtx}^{reco}#minus#it{Z}_{vtx}^{gen} (cm)", HistType::kTHnSparseF, {ptAxis, etaAxis, deltaZAxis}); - qaregistry.add("TrackToColl/histFracTracksFakeMcColl", "Fraction of tracks originating from fake collision; fraction; entries", {HistType::kTH1F, {{101, 0., 1.01}}}); qaregistry.add("TrackToColl/histFracGoodTracks", "Fraction of tracks originating from the correct collision; fraction; entries", {HistType::kTH1F, {{101, 0., 1.01}}}); qaregistry.add("TrackToColl/histAmbTrackNumColls", "Number of collisions associated to an ambiguous track; no. collisions; entries", {HistType::kTH1F, {{30, -0.5, 29.5}}}); @@ -897,21 +897,6 @@ struct DndetaMFTPbPb { hReAssoc[3] = qaregistry.add("ReAssoc/hGoodAssocTracksAmb", ";#it{p}_{T}^{reco} (GeV/#it{c});#it{#eta}^{reco};#it{Z}_{vtx}^{reco}#minus#it{Z}_{vtx}^{gen} (cm)", HistType::kTHnSparseF, {ptAxis, etaAxis, deltaZAxis}); } - // if (doprocessCheckAmbiguousMftTracksCentFT0C) { - // qaregistry.add({"Tracks/Centrality/hMftTracksAmbDegree", - // " ; N_{coll}^{comp}; centrality", - // {HistType::kTH2F, - // {{41, -0.5, 40.5}, centralityAxis}}}); - // qaregistry.add({"Tracks/Centrality/hMftTracksAmbDegreeWithTrivial", - // " ; N_{coll}^{comp}; centrality", - // {HistType::kTH2F, - // {{41, -0.5, 40.5}, centralityAxis}}}); - // qaregistry.add({"Tracks/Centrality/hAmbTrackType", - // " ; Ambiguous track type; centrality", - // {HistType::kTH2F, - // {{5, -0.5, 4.5}, centralityAxis}}}); - // } - if (doprocessEfficiencyInclusive) { qaregistry.add({"Tracks/hEffRec", "; p_{T} (GeV/c); #varphi; #eta; Z_{vtx} (cm); occupancy", @@ -942,57 +927,50 @@ struct DndetaMFTPbPb { qaregistry.add("Events/hNPVtracksVsMultMFT", "NPVtracks_vs_MultMFT", {HistType::kTH2F, {pvAxis, multAxis}}); } - if (doprocessDCAMcInlcusive) { - qaregistry.add({"Tracks/hDCAxBestGenPrim", "; DCA_{x}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); - qaregistry.add({"Tracks/hDCAyBestGenPrim", "; DCA_{y}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); - qaregistry.add({"Tracks/hDCAxyBestGenPrim", "; DCA_{xy}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); - qaregistry.add({"Tracks/hDCAzBestGenPrim", "; DCA_{z}^{gen} (cm); counts", {HistType::kTH1F, {dcazAxis}}}); - // - qaregistry.add({"Tracks/hDCAxBestGenSecWeak", "; DCA_{x}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); - qaregistry.add({"Tracks/hDCAyBestGenSecWeak", "; DCA_{y}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); - qaregistry.add({"Tracks/hDCAxyBestGenSecWeak", "; DCA_{xy}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); - qaregistry.add({"Tracks/hDCAzBestGenSecWeak", "; DCA_{z}^{gen} (cm); counts", {HistType::kTH1F, {dcazAxis}}}); - // - qaregistry.add({"Tracks/hDCAxBestGenSecMat", "; DCA_{x}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); - qaregistry.add({"Tracks/hDCAyBestGenSecMat", "; DCA_{y}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); - qaregistry.add({"Tracks/hDCAxyBestGenSecMat", "; DCA_{xy}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); - qaregistry.add({"Tracks/hDCAzBestGenSecMat", "; DCA_{z}^{gen} (cm); counts", {HistType::kTH1F, {dcazAxis}}}); - // - qaregistry.add({"Tracks/hDCAxyBestPtRec", "; p_{T} (GeV/c) ; DCA_{XY} (cm)", {HistType::kTH2F, {ptAxis, dcaxyAxis}}}); - qaregistry.add({"Tracks/hDCAzBestPtRec", "; p_{T} (GeV/c) ; DCA_{Z} (cm)", {HistType::kTH2F, {ptAxis, dcazAxis}}}); - qaregistry.add({"Tracks/hDCAxyBestRec", "; DCA_{XY} (cm)", {HistType::kTH1F, {dcaxyAxis}}}); - qaregistry.add({"Tracks/hDCAzBestRec", "; DCA_{Z} (cm)", {HistType::kTH1F, {dcazAxis}}}); - // - qaregistry.add({"Tracks/THnDCAxyBestGenPrim", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); DCA_{XY} (cm); DCA_{Z} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, dcaxyAxis, dcazAxis}}}); - qaregistry.add({"Tracks/THnDCAxyBestGenSecWeak", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); DCA_{XY} (cm); DCA_{Z} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, dcaxyAxis, dcazAxis}}}); - qaregistry.add({"Tracks/THnDCAxyBestGenSecMat", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); DCA_{XY} (cm); DCA_{Z} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, dcaxyAxis, dcazAxis}}}); - qaregistry.add({"Tracks/THnDCAxyBestRec", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); DCA_{XY} (cm); DCA_{Z} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, dcaxyAxis, dcazAxis}}}); - } - if (doprocessDCAMcCentFT0C) { - qaregistry.add({"Tracks/Centrality/hDCAxBestGenPrim", "; DCA_{x}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); - qaregistry.add({"Tracks/Centrality/hDCAyBestGenPrim", "; DCA_{y}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); - qaregistry.add({"Tracks/Centrality/hDCAxyBestGenPrim", "; DCA_{xy}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); - qaregistry.add({"Tracks/Centrality/hDCAzBestGenPrim", "; DCA_{z}^{gen} (cm); counts", {HistType::kTH1F, {dcazAxis}}}); - // - qaregistry.add({"Tracks/Centrality/hDCAxBestGenSecWeak", "; DCA_{x}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); - qaregistry.add({"Tracks/Centrality/hDCAyBestGenSecWeak", "; DCA_{y}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); - qaregistry.add({"Tracks/Centrality/hDCAxyBestGenSecWeak", "; DCA_{xy}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); - qaregistry.add({"Tracks/Centrality/hDCAzBestGenSecWeak", "; DCA_{z}^{gen} (cm); counts", {HistType::kTH1F, {dcazAxis}}}); - // - qaregistry.add({"Tracks/Centrality/hDCAxBestGenSecMat", "; DCA_{x}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); - qaregistry.add({"Tracks/Centrality/hDCAyBestGenSecMat", "; DCA_{y}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); - qaregistry.add({"Tracks/Centrality/hDCAxyBestGenSecMat", "; DCA_{xy}^{gen} (cm); counts", {HistType::kTH1F, {dcaxyAxis}}}); - qaregistry.add({"Tracks/Centrality/hDCAzBestGenSecMat", "; DCA_{z}^{gen} (cm); counts", {HistType::kTH1F, {dcazAxis}}}); - // - qaregistry.add({"Tracks/Centrality/hDCAxyBestPtRec", "; p_{T} (GeV/c) ; DCA_{XY} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, dcaxyAxis, centralityAxis}}}); - qaregistry.add({"Tracks/Centrality/hDCAzBestPtRec", "; p_{T} (GeV/c) ; DCA_{Z} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, dcazAxis, centralityAxis}}}); - qaregistry.add({"Tracks/Centrality/hDCAxyBestRec", "; DCA_{XY} (cm); centrality", {HistType::kTH2F, {dcaxyAxis, centralityAxis}}}); - qaregistry.add({"Tracks/Centrality/hDCAzBestRec", "; DCA_{Z} (cm); centrality", {HistType::kTH2F, {dcazAxis, centralityAxis}}}); - // - qaregistry.add({"Tracks/Centrality/THnDCAxyBestGenPrim", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); DCA_{XY} (cm); DCA_{Z} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, dcaxyAxis, dcazAxis, centralityAxis}}}); - qaregistry.add({"Tracks/Centrality/THnDCAxyBestGenSecWeak", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); DCA_{XY} (cm); DCA_{Z} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, dcaxyAxis, dcazAxis, centralityAxis}}}); - qaregistry.add({"Tracks/Centrality/THnDCAxyBestGenSecMat", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); DCA_{XY} (cm); DCA_{Z} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, dcaxyAxis, dcazAxis, centralityAxis}}}); - qaregistry.add({"Tracks/Centrality/THnDCAxyBestRec", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); DCA_{XY} (cm); DCA_{Z} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, dcaxyAxis, dcazAxis, centralityAxis}}}); + if (doprocessSecondariesMCInlcusive || doprocessSecondariesMCCentFT0C) { + auto hNevt = registry.add("Events/hNGenRecColls", "Number of generated and reconstructed MC collisions", HistType::kTH1F, {{3, 0.5, 3.5}}); + hNevt->GetXaxis()->SetBinLabel(1, "Reconstructed collisions"); + hNevt->GetXaxis()->SetBinLabel(2, "Generated collisions"); + if (doprocessSecondariesMCInlcusive) { + registry.add({"Tracks/THnRecAmb", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis}}}); + registry.add({"Tracks/THnRec", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis}}}); + registry.add({"Tracks/THnRecNonAmb", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis}}}); + registry.add({"Tracks/THnRecAmbRest", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis}}}); + registry.add({"Tracks/THnGenPrim", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis}}}); + registry.add({"Tracks/THnGenSecWeak", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis}}}); + registry.add({"Tracks/THnGenSecMat", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis}}}); + registry.add({"Tracks/THnGenPrimAmb", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis}}}); + registry.add({"Tracks/THnGenSecWeakAmb", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis}}}); + registry.add({"Tracks/THnGenSecMatAmb", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis}}}); + } + if (doprocessSecondariesMCCentFT0C) { + registry.add({"Tracks/Centrality/THnRecAmb", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, centralityAxis}}}); + registry.add({"Tracks/Centrality/THnRec", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, centralityAxis}}}); + registry.add({"Tracks/Centrality/THnRecNonAmb", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, centralityAxis}}}); + registry.add({"Tracks/Centrality/THnRecAmbRest", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, centralityAxis}}}); + registry.add({"Tracks/Centrality/THnGenPrim", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, centralityAxis}}}); + registry.add({"Tracks/Centrality/THnGenSecWeak", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, centralityAxis}}}); + registry.add({"Tracks/Centrality/THnGenSecMat", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, centralityAxis}}}); + registry.add({"Tracks/Centrality/THnGenPrimAmb", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, centralityAxis}}}); + registry.add({"Tracks/Centrality/THnGenSecWeakAmb", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, centralityAxis}}}); + registry.add({"Tracks/Centrality/THnGenSecMatAmb", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, centralityAxis}}}); + } + } + + if (doprocessDCAReassocMcInclusive) { + registry.add({"Tracks/THnDCAxyBestRec", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); DCA_{XY} (cm); DCA_{Z} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, dcaxyAxis, dcazAxis}}}); + registry.add({"Tracks/THnDCAxyBestRecFake", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); DCA_{XY} (cm); DCA_{Z} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, dcaxyAxis, dcazAxis}}}); + registry.add({"Tracks/THnDCAxyBestGenPrim", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); DCA_{XY} (cm); DCA_{Z} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, dcaxyAxis, dcazAxis}}}); + registry.add({"Tracks/THnDCAxyBestGenSecWeak", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); DCA_{XY} (cm); DCA_{Z} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, dcaxyAxis, dcazAxis}}}); + registry.add({"Tracks/THnDCAxyBestGenSecMat", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); DCA_{XY} (cm); DCA_{Z} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, dcaxyAxis, dcazAxis}}}); + } + + if (doprocessDCAReassocMcCentFT0C) { + registry.add({"Tracks/Centrality/THnDCAxyBestRec", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); DCA_{XY} (cm); DCA_{Z} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, dcaxyAxis, dcazAxis, centralityAxis}}}); + registry.add({"Tracks/Centrality/THnDCAxyBestRecFake", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); DCA_{XY} (cm); DCA_{Z} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, dcaxyAxis, dcazAxis, centralityAxis}}}); + registry.add({"Tracks/Centrality/THnDCAxyBestGenPrim", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); DCA_{XY} (cm); DCA_{Z} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, dcaxyAxis, dcazAxis, centralityAxis}}}); + registry.add({"Tracks/Centrality/THnDCAxyBestGenSecWeak", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); DCA_{XY} (cm); DCA_{Z} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, dcaxyAxis, dcazAxis, centralityAxis}}}); + registry.add({"Tracks/Centrality/THnDCAxyBestGenSecMat", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); DCA_{XY} (cm); DCA_{Z} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, dcaxyAxis, dcazAxis, centralityAxis}}}); } } @@ -2776,7 +2754,7 @@ struct DndetaMFTPbPb { } auto itrack = track.mfttrack_as(); - if (cfgRemoveTrivialAssoc) { + if (cfgRemoveReassigned) { if (itrack.collisionId() != track.bestCollisionId()) { continue; } @@ -2892,13 +2870,180 @@ struct DndetaMFTPbPb { PROCESS_SWITCH(DndetaMFTPbPb, processMcQACentFT0C, "Process MC QA checks (in FT0 centrality bins)", false); + Preslice mftTrkCompCollperCol = o2::aod::fwdtrack::collisionId; + /// @brief process template function for DCA MC checks template - void processDCAMc(typename soa::Join::iterator const& collision, - FiltMcMftTracks const& /*tracks*/, - soa::SmallGroups const& besttracks, - MC const& /*mcCollisions*/, - aod::McParticles const& /*particles*/ + void processSecondariesMC(typename soa::Join const& collisions, + MftTracksWCollsMC const& tracks, + MC const& mcCollisions, + aod::McParticles const& /*particles*/ + ) + { + registry.fill(HIST("Events/hNGenRecColls"), 1.f, collisions.size()); + registry.fill(HIST("Events/hNGenRecColls"), 2.f, mcCollisions.size()); + + for (const auto& collision : collisions) { + float crec = getRecoCent(collision); + if (!isGoodEvent(collision)) { + continue; + } + if (!collision.has_mcCollision()) { + continue; + } + + auto trkPerColl = tracks.sliceBy(mftTrkCompCollperCol, collision.globalIndex()); + for (auto const& track : trkPerColl) { + if (!isTrackSelected(track)) { + continue; + } + if (!track.has_collision()) { + continue; + } + auto trkCollId = track.has_collision() ? track.collisionId() : -1; + auto ids = track.compatibleCollIds(); + bool isAmbiguous = (ids.size() != 1); + + if (isAmbiguous) { + if constexpr (has_reco_cent) { + registry.fill(HIST("Tracks/Centrality/THnRecAmb"), track.pt(), track.eta(), collision.posZ(), crec); + } else { + registry.fill(HIST("Tracks/THnRecAmb"), track.pt(), track.eta(), collision.posZ()); + } + } else { + if constexpr (has_reco_cent) { + registry.fill(HIST("Tracks/Centrality/THnRec"), track.pt(), track.eta(), collision.posZ(), crec); + } else { + registry.fill(HIST("Tracks/THnRec"), track.pt(), track.eta(), collision.posZ()); + } + if (trkCollId == ids[0]) { + if constexpr (has_reco_cent) { + registry.fill(HIST("Tracks/Centrality/THnRecNonAmb"), track.pt(), track.eta(), collision.posZ(), crec); + } else { + registry.fill(HIST("Tracks/THnRecNonAmb"), track.pt(), track.eta(), collision.posZ()); + } + } + if (trkCollId != ids[0]) { + if constexpr (has_reco_cent) { + registry.fill(HIST("Tracks/Centrality/THnRecAmbRest"), track.pt(), track.eta(), collision.posZ(), crec); + } else { + registry.fill(HIST("Tracks/THnRecAmbRest"), track.pt(), track.eta(), collision.posZ()); + } + } + } + + uint index = uint(track.collisionId() >= 0); + + if (!track.has_mcParticle()) { + LOGP(debug, "No MC particle for track, skip..."); + continue; + } + + auto particle = track.template mcParticle_as(); + if (!isChrgParticle(particle.pdgCode())) { + continue; + } + if (particle.eta() <= trackCuts.minEta || particle.eta() >= trackCuts.maxEta) { + continue; + } + if (cfgUseParticleSel && !isParticleSelected(particle)) { + continue; + } + + if (index) { + auto collision = track.template collision_as>(); + auto mcCollision = particle.template mcCollision_as(); + + if (eventCuts.useZDiffCut) { + if (std::abs(collision.posZ() - mcCollision.posZ()) > eventCuts.maxZvtxDiff) { + continue; + } + } + + if (collision.has_mcCollision() && collision.mcCollisionId() == particle.mcCollisionId()) { + if (!particle.isPhysicalPrimary()) { // Secondaries (weak decays and material) + if (particle.getProcess() == kNumDecay) { // Particles from decay + if constexpr (has_reco_cent) { + registry.fill(HIST("Tracks/Centrality/THnGenSecWeak"), particle.pt(), particle.eta(), particle.mcCollision().posZ(), crec); + } else { + registry.fill(HIST("Tracks/THnGenSecWeak"), particle.pt(), particle.eta(), particle.mcCollision().posZ()); + } + } else { // Particles from the material + if constexpr (has_reco_cent) { + registry.fill(HIST("Tracks/Centrality/THnGenSecMat"), particle.pt(), particle.eta(), particle.mcCollision().posZ(), crec); + } else { + registry.fill(HIST("Tracks/THnGenSecMat"), particle.pt(), particle.eta(), particle.mcCollision().posZ()); + } + } + } else { // Primaries + if constexpr (has_reco_cent) { + registry.fill(HIST("Tracks/Centrality/THnGenPrim"), particle.pt(), particle.eta(), particle.mcCollision().posZ(), crec); + } else { + registry.fill(HIST("Tracks/THnGenPrim"), particle.pt(), particle.eta(), particle.mcCollision().posZ()); + } + } + } else { + if (isAmbiguous) { + for (const auto& collIdx : track.compatibleCollIds()) { + auto ambCollision = collisions.rawIteratorAt(collIdx); + if (ambCollision.has_mcCollision() && ambCollision.mcCollisionId() == particle.mcCollisionId()) { + if (!particle.isPhysicalPrimary()) { // Secondaries (weak decays and material) + if (particle.getProcess() == kNumDecay) { // Particles from decay + if constexpr (has_reco_cent) { + registry.fill(HIST("Tracks/Centrality/THnGenSecWeakAmb"), particle.pt(), particle.eta(), particle.mcCollision().posZ(), crec); + } else { + registry.fill(HIST("Tracks/THnGenSecWeakAmb"), particle.pt(), particle.eta(), particle.mcCollision().posZ()); + } + } else { // Particles from the material + if constexpr (has_reco_cent) { + registry.fill(HIST("Tracks/Centrality/THnGenSecMatAmb"), particle.pt(), particle.eta(), particle.mcCollision().posZ(), crec); + } else { + registry.fill(HIST("Tracks/THnGenSecMatAmb"), particle.pt(), particle.eta(), particle.mcCollision().posZ()); + } + } + } else { // Primaries + if constexpr (has_reco_cent) { + registry.fill(HIST("Tracks/Centrality/THnGenPrimAmb"), particle.pt(), particle.eta(), particle.mcCollision().posZ(), crec); + } else { + registry.fill(HIST("Tracks/THnGenPrimAmb"), particle.pt(), particle.eta(), particle.mcCollision().posZ()); + } + } + break; + } + } + } + } + } + } + } + } + + void processSecondariesMCInlcusive(soa::Join const& collisions, + MftTracksWCollsMC const& tracks, + aod::McCollisions const& mccollisions, + aod::McParticles const& particles) + { + processSecondariesMC(collisions, tracks, mccollisions, particles); + } + + PROCESS_SWITCH(DndetaMFTPbPb, processSecondariesMCInlcusive, "Process secondaries checks (Inclusive)", false); + + void processSecondariesMCCentFT0C(soa::Join const& collisions, + MftTracksWCollsMC const& tracks, + aod::McCollisions const& mccollisions, + aod::McParticles const& particles) + { + processSecondariesMC(collisions, tracks, mccollisions, particles); + } + + PROCESS_SWITCH(DndetaMFTPbPb, processSecondariesMCCentFT0C, "Process secondaries checks (in FT0C centrality bins)", false); + + template + void processDCAReassocMc(typename soa::Join::iterator const& collision, + FiltMcMftTracks const& /*tracks*/, + soa::SmallGroups const& besttracks, + MC const& /*mcCollisions*/, + aod::McParticles const& /*particles*/ ) { if (!isGoodEvent(collision)) { @@ -2908,126 +3053,115 @@ struct DndetaMFTPbPb { return; } float crec = getRecoCent(collision); - // auto mcCollision = collision.mcCollision(); if (besttracks.size() == 0) { return; } for (auto const& atrack : besttracks) { + if (!isBestTrackSelected(atrack)) { + continue; + } auto itrack = atrack.mfttrack_as(); + if (!isTrackSelected(itrack)) { continue; } if (!itrack.has_collision()) { continue; } + if (cfgRemoveReassigned) { + if (itrack.collisionId() != atrack.bestCollisionId()) { + continue; + } + } if constexpr (has_reco_cent) { - qaregistry.fill(HIST("Tracks/Centrality/THnDCAxyBestRec"), itrack.pt(), itrack.eta(), collision.posZ(), atrack.bestDCAXY(), atrack.bestDCAZ(), crec); - qaregistry.fill(HIST("Tracks/Centrality/hDCAxyBestPtRec"), itrack.pt(), atrack.bestDCAXY(), crec); - qaregistry.fill(HIST("Tracks/Centrality/hDCAzBestPtRec"), itrack.pt(), atrack.bestDCAZ(), crec); - qaregistry.fill(HIST("Tracks/Centrality/hDCAxyBestRec"), atrack.bestDCAXY(), crec); - qaregistry.fill(HIST("Tracks/Centrality/hDCAzBestRec"), atrack.bestDCAZ(), crec); + registry.fill(HIST("Tracks/Centrality/THnDCAxyBestRec"), itrack.pt(), itrack.eta(), collision.posZ(), atrack.bestDCAXY(), atrack.bestDCAZ(), crec); } else { - qaregistry.fill(HIST("Tracks/THnDCAxyBestRec"), itrack.pt(), itrack.eta(), collision.posZ(), atrack.bestDCAXY(), atrack.bestDCAZ()); - qaregistry.fill(HIST("Tracks/hDCAxyBestPtRec"), itrack.pt(), atrack.bestDCAXY()); - qaregistry.fill(HIST("Tracks/hDCAzBestPtRec"), itrack.pt(), atrack.bestDCAZ()); - qaregistry.fill(HIST("Tracks/hDCAxyBestRec"), atrack.bestDCAXY()); - qaregistry.fill(HIST("Tracks/hDCAzBestRec"), atrack.bestDCAZ()); + registry.fill(HIST("Tracks/THnDCAxyBestRec"), itrack.pt(), itrack.eta(), collision.posZ(), atrack.bestDCAXY(), atrack.bestDCAZ()); } - if (!itrack.has_mcParticle()) { - LOGP(debug, "No MC particle for ambiguous itrack, skip..."); - continue; - } - - auto particle = itrack.mcParticle_as(); - - if (!isChrgParticle(particle.pdgCode())) { - continue; - } - if (particle.eta() <= trackCuts.minEta || particle.eta() >= trackCuts.maxEta) { - continue; - } - if (cfgUseParticleSel && !isParticleSelected(particle)) { - continue; - } + if (itrack.has_mcParticle()) { + auto particle = itrack.mcParticle_as(); + if (!isChrgParticle(particle.pdgCode())) { + continue; + } + if (particle.eta() <= trackCuts.minEta || particle.eta() >= trackCuts.maxEta) { + continue; + } + if (cfgUseParticleSel && !isParticleSelected(particle)) { + continue; + } - const auto dcaXtruth(particle.vx() - particle.mcCollision().posX()); - const auto dcaYtruth(particle.vy() - particle.mcCollision().posY()); - const auto dcaZtruth(particle.vz() - particle.mcCollision().posZ()); - auto dcaXYtruth = std::sqrt(dcaXtruth * dcaXtruth + dcaYtruth * dcaYtruth); + const auto dcaXtruth(particle.vx() - particle.mcCollision().posX()); + const auto dcaYtruth(particle.vy() - particle.mcCollision().posY()); + const auto dcaZtruth(particle.vz() - particle.mcCollision().posZ()); + auto dcaXYtruth = std::sqrt(dcaXtruth * dcaXtruth + dcaYtruth * dcaYtruth); + auto collision = itrack.collision_as>(); + auto mcCollision = particle.mcCollision_as(); - if (!particle.isPhysicalPrimary()) { // Secondaries (weak decays and material) - if (particle.getProcess() == kNumDecay) { // Particles from decay - if constexpr (has_reco_cent) { - qaregistry.fill(HIST("Tracks/Centrality/THnDCAxyBestGenSecWeak"), particle.pt(), particle.eta(), particle.mcCollision().posZ(), dcaXtruth, dcaZtruth, crec); - qaregistry.fill(HIST("Tracks/Centrality/hDCAxBestGenSecWeak"), dcaXtruth, crec); - qaregistry.fill(HIST("Tracks/Centrality/hDCAyBestGenSecWeak"), dcaYtruth, crec); - qaregistry.fill(HIST("Tracks/Centrality/hDCAxyBestGenSecWeak"), dcaXYtruth, crec); - qaregistry.fill(HIST("Tracks/Centrality/hDCAzBestGenSecWeak"), dcaZtruth, crec); - } else { - qaregistry.fill(HIST("Tracks/THnDCAxyBestGenSecWeak"), particle.pt(), particle.eta(), particle.mcCollision().posZ(), dcaXtruth, dcaZtruth); - qaregistry.fill(HIST("Tracks/hDCAxBestGenSecWeak"), dcaXtruth); - qaregistry.fill(HIST("Tracks/hDCAyBestGenSecWeak"), dcaYtruth); - qaregistry.fill(HIST("Tracks/hDCAxyBestGenSecWeak"), dcaXYtruth); - qaregistry.fill(HIST("Tracks/hDCAzBestGenSecWeak"), dcaZtruth); + if (eventCuts.useZDiffCut) { + if (std::abs(collision.posZ() - mcCollision.posZ()) > eventCuts.maxZvtxDiff) { + continue; } - } else { // Particles from the material - if constexpr (has_reco_cent) { - qaregistry.fill(HIST("Tracks/Centrality/THnDCAxyBestGenSecMat"), particle.pt(), particle.eta(), particle.mcCollision().posZ(), dcaXtruth, dcaZtruth, crec); - qaregistry.fill(HIST("Tracks/Centrality/hDCAxBestGenSecMat"), dcaXtruth, crec); - qaregistry.fill(HIST("Tracks/Centrality/hDCAyBestGenSecMat"), dcaYtruth, crec); - qaregistry.fill(HIST("Tracks/Centrality/hDCAxyBestGenSecMat"), dcaXYtruth, crec); - qaregistry.fill(HIST("Tracks/Centrality/hDCAzBestGenSecMat"), dcaZtruth, crec); - } else { - qaregistry.fill(HIST("Tracks/THnDCAxyBestGenSecMat"), particle.pt(), particle.eta(), particle.mcCollision().posZ(), dcaXtruth, dcaZtruth); - qaregistry.fill(HIST("Tracks/hDCAxBestGenSecMat"), dcaXtruth); - qaregistry.fill(HIST("Tracks/hDCAyBestGenSecMat"), dcaYtruth); - qaregistry.fill(HIST("Tracks/hDCAxyBestGenSecMat"), dcaXYtruth); - qaregistry.fill(HIST("Tracks/hDCAzBestGenSecMat"), dcaZtruth); + } + + if (collision.has_mcCollision() && collision.mcCollisionId() == particle.mcCollisionId()) { + if (!particle.isPhysicalPrimary()) { // Secondaries (weak decays and material) + if (particle.getProcess() == kNumDecay) { // Particles from decay + if constexpr (has_reco_cent) { + registry.fill(HIST("Tracks/Centrality/THnDCAxyBestGenPrim"), itrack.pt(), itrack.eta(), mcCollision.posZ(), atrack.bestDCAXY(), atrack.bestDCAZ(), crec); + } else { + registry.fill(HIST("Tracks/THnDCAxyBestGenPrim"), itrack.pt(), itrack.eta(), mcCollision.posZ(), atrack.bestDCAXY(), atrack.bestDCAZ()); + } + } else { // Particles from the material + if constexpr (has_reco_cent) { + registry.fill(HIST("Tracks/Centrality/THnDCAxyBestGenSecMat"), particle.pt(), particle.eta(), particle.mcCollision().posZ(), dcaXYtruth, dcaZtruth, crec); + } else { + registry.fill(HIST("Tracks/THnDCAxyBestGenSecMat"), particle.pt(), particle.eta(), particle.mcCollision().posZ(), dcaXYtruth, dcaZtruth); + } + } + } else { // Primaries + if constexpr (has_reco_cent) { + registry.fill(HIST("Tracks/Centrality/THnDCAxyBestGenPrim"), particle.pt(), particle.eta(), particle.mcCollision().posZ(), dcaXYtruth, dcaZtruth, crec); + } else { + registry.fill(HIST("Tracks/THnDCAxyBestGenPrim"), particle.pt(), particle.eta(), particle.mcCollision().posZ(), dcaXYtruth, dcaZtruth); + } } } - } else { // Primaries + } else { + LOGP(debug, "No MC particle for ambiguous itrack, skip..."); if constexpr (has_reco_cent) { - qaregistry.fill(HIST("Tracks/Centrality/THnDCAxyBestGenPrim"), particle.pt(), particle.eta(), particle.mcCollision().posZ(), dcaXtruth, dcaZtruth, crec); - qaregistry.fill(HIST("Tracks/Centrality/hDCAxBestGenPrim"), dcaXtruth, crec); - qaregistry.fill(HIST("Tracks/Centrality/hDCAyBestGenPrim"), dcaYtruth, crec); - qaregistry.fill(HIST("Tracks/Centrality/hDCAxyBestGenPrim"), dcaXYtruth, crec); - qaregistry.fill(HIST("Tracks/Centrality/hDCAzBestGenPrim"), dcaZtruth, crec); + registry.fill(HIST("Tracks/Centrality/THnDCAxyBestRecFake"), itrack.pt(), itrack.eta(), collision.posZ(), atrack.bestDCAXY(), atrack.bestDCAZ(), crec); } else { - qaregistry.fill(HIST("Tracks/THnDCAxyBestGenPrim"), particle.pt(), particle.eta(), particle.mcCollision().posZ(), dcaXtruth, dcaZtruth); - qaregistry.fill(HIST("Tracks/hDCAxBestGenPrim"), dcaXtruth); - qaregistry.fill(HIST("Tracks/hDCAyBestGenPrim"), dcaYtruth); - qaregistry.fill(HIST("Tracks/hDCAxyBestGenPrim"), dcaXYtruth); - qaregistry.fill(HIST("Tracks/hDCAzBestGenPrim"), dcaZtruth); + registry.fill(HIST("Tracks/THnDCAxyBestRecFake"), itrack.pt(), itrack.eta(), collision.posZ(), atrack.bestDCAXY(), atrack.bestDCAZ()); } } } } - void processDCAMcInlcusive(soa::Join::iterator const& collision, - FiltMcMftTracks const& tracks, - soa::SmallGroups const& besttracks, - aod::McCollisions const& mccollisions, - aod::McParticles const& particles) + void processDCAReassocMcInclusive(soa::Join::iterator const& collision, + FiltMcMftTracks const& tracks, + soa::SmallGroups const& besttracks, + aod::McCollisions const& mccollisions, + aod::McParticles const& particles) { - processDCAMc(collision, tracks, besttracks, mccollisions, particles); + processDCAReassocMc(collision, tracks, besttracks, mccollisions, particles); } - PROCESS_SWITCH(DndetaMFTPbPb, processDCAMcInlcusive, "Process MC DCA checks (Inclusive)", false); + PROCESS_SWITCH(DndetaMFTPbPb, processDCAReassocMcInclusive, "Process MC DCA checks using re-association information based on BestCollisionsFwd3d table (Inclusive)", false); - void processDCAMcCentFT0C(soa::Join::iterator const& collision, - FiltMcMftTracks const& tracks, - soa::SmallGroups const& besttracks, - aod::McCollisions const& mccollisions, - aod::McParticles const& particles) + void processDCAReassocMcCentFT0C(soa::Join::iterator const& collision, + FiltMcMftTracks const& tracks, + soa::SmallGroups const& besttracks, + aod::McCollisions const& mccollisions, + aod::McParticles const& particles) { - processDCAMc(collision, tracks, besttracks, mccollisions, particles); + processDCAReassocMc(collision, tracks, besttracks, mccollisions, particles); } - PROCESS_SWITCH(DndetaMFTPbPb, processDCAMcCentFT0C, "Process MC DCA checks (in FT0C centrality bins)", false); + PROCESS_SWITCH(DndetaMFTPbPb, processDCAReassocMcCentFT0C, "Process MC DCA checks using re-association information based on BestCollisionsFwd3d table (in FT0C centrality bins)", false); template void processCorrelationwBestTracks(typename C::iterator const& collision, FiltMftTracks const& /*tracks*/, soa::SmallGroups const& besttracks) From 3383b4ee51482c08eeb677acec3f12fb6693f680 Mon Sep 17 00:00:00 2001 From: prottayCMT <61418725+prottayCMT@users.noreply.github.com> Date: Sun, 19 Oct 2025 01:09:22 +0200 Subject: [PATCH 803/986] [PWGLF] calculating polarization by scalar product and adding pt dependent efficiency calculation (#13411) Co-authored-by: Prottay Das --- PWGLF/Tasks/Strangeness/lambdapolsp.cxx | 367 +++++++++++++----------- 1 file changed, 204 insertions(+), 163 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/lambdapolsp.cxx b/PWGLF/Tasks/Strangeness/lambdapolsp.cxx index 4846108dc2f..90ff34ad553 100644 --- a/PWGLF/Tasks/Strangeness/lambdapolsp.cxx +++ b/PWGLF/Tasks/Strangeness/lambdapolsp.cxx @@ -109,6 +109,7 @@ struct lambdapolsp { Configurable etaMix{"etaMix", 0.1, "eta difference in mixing"}; Configurable ptMix{"ptMix", 0.1, "pt difference in mixing"}; Configurable phiMix{"phiMix", 0.1, "phi difference in mixing"}; + Configurable useSP{"useSP", false, "use scalar product"}; } randGrp; // events Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; @@ -232,6 +233,7 @@ struct lambdapolsp { std::vector runaxes = {thnAxisInvMass, axisGrp.configthnAxispT, axisGrp.configthnAxisPol, axisGrp.configcentAxis}; if (needetaaxis) runaxes.insert(runaxes.end(), {axisGrp.configbinAxis}); + std::vector runaxes2 = {thnAxisInvMass, axisGrp.configthnAxispT, axisGrp.configcentAxis}; if (checkwithpub) { if (useprofile == 2) { @@ -428,6 +430,11 @@ struct lambdapolsp { histos.add("hptnegantilambda", "hptnegantilambda", HistType::kTH1D, {distGrp.axispt}, true); } + histos.add("hSparseGenLambda", "hSparseGenLambda", HistType::kTHnSparseF, runaxes2, true); + histos.add("hSparseGenAntiLambda", "hSparseGenAntiLambda", HistType::kTHnSparseF, runaxes2, true); + histos.add("hSparseRecLambda", "hSparseRecLambda", HistType::kTHnSparseF, runaxes2, true); + histos.add("hSparseRecAntiLambda", "hSparseRecAntiLambda", HistType::kTHnSparseF, runaxes2, true); + ccdb->setURL(cfgCcdbParam.cfgURL); ccdbApi.init("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); @@ -672,6 +679,10 @@ struct lambdapolsp { if (randGrp.doRandomPhi) { phiangle = randPhi.Uniform(0, 2 * TMath::Pi()); } + + auto ux = TMath::Cos(phiangle); + auto uy = TMath::Sin(phiangle); + auto phiminuspsiC = GetPhiInRange(phiangle - psiZDCC); auto phiminuspsiA = GetPhiInRange(phiangle - psiZDCA); auto phiminuspsi = GetPhiInRange(phiangle - psiZDC); @@ -680,6 +691,7 @@ struct lambdapolsp { auto PolC = TMath::Sin(phiminuspsiC); auto PolA = TMath::Sin(phiminuspsiA); auto Pol = TMath::Sin(phiminuspsi); + auto PolSP = uy * TMath::Cos(psiZDC) - ux * TMath::Sin(psiZDC); auto sinPhiStar = TMath::Sin(GetPhiInRange(phiangle)); auto cosPhiStar = TMath::Cos(GetPhiInRange(phiangle)); @@ -694,6 +706,9 @@ struct lambdapolsp { auto PolAwgt = PolA / acvalue; auto PolCwgt = PolC / acvalue; + if (randGrp.useSP) + Polwgt = PolSP / acvalue; + // Fill histograms using constructed names if (tag2) { if (needetaaxis) { @@ -807,6 +822,7 @@ struct lambdapolsp { Filter dcaCutFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz); using EventCandidates = soa::Filtered>; + using EventCandidatesMC = soa::Filtered>; using AllTrackCandidates = soa::Filtered>; using ResoV0s = aod::V0Datas; @@ -859,6 +875,7 @@ struct lambdapolsp { if (rctCut.requireRCTFlagChecker && !rctChecker(collision)) { return; } + // currentRunNumber = collision.foundBC_as().runNumber(); auto bc = collision.foundBC_as(); @@ -886,7 +903,7 @@ struct lambdapolsp { modqyZDCC = qyZDCC; } - auto psiZDC = TMath::ATan2((modqyZDCC - modqyZDCA), (modqxZDCC - modqxZDCA)); // full event plane + auto psiZDC = TMath::ATan2((modqyZDCC - modqyZDCA), (modqxZDCC - modqxZDCA)); // full event plane*/ /*if (useonlypsis) { psiZDC = psiZDCC - psiZDCA; }*/ @@ -895,6 +912,8 @@ struct lambdapolsp { if (!checkwithpub) { // histos.fill(HIST("hVtxZ"), collision.posZ()); histos.fill(HIST("hpRes"), centrality, (TMath::Cos(GetPhiInRange(psiZDCA - psiZDCC)))); + if (randGrp.useSP) + histos.fill(HIST("hpRes"), centrality, ((modqxZDCA * modqxZDCC) + (modqyZDCA * modqyZDCC))); // histos.fill(HIST("hpResSin"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA - psiZDCC)))); /*histos.fill(HIST("hpCosPsiA"), centrality, (TMath::Cos(GetPhiInRange(psiZDCA)))); histos.fill(HIST("hpCosPsiC"), centrality, (TMath::Cos(GetPhiInRange(psiZDCC)))); @@ -1105,6 +1124,7 @@ struct lambdapolsp { accprofileL = ccdb->getForTimeStamp(ConfAccPathL.value, bc.timestamp()); accprofileAL = ccdb->getForTimeStamp(ConfAccPathAL.value, bc.timestamp()); } + double acvalue = 1.0; int binxwgt; double wgtvalue; if (useyldwgt) { @@ -1168,9 +1188,14 @@ struct lambdapolsp { if (LambdaTag) { Lambda = Proton + AntiPion; tagb = 0; - int binx = accprofileL->GetXaxis()->FindBin(v0.eta()); - int biny = accprofileL->GetYaxis()->FindBin(v0.pt()); - double acvalue = accprofileL->GetBinContent(binx, biny); + if (useAccCorr) { + int binx = accprofileL->GetXaxis()->FindBin(v0.eta()); + int biny = accprofileL->GetYaxis()->FindBin(v0.pt()); + acvalue = accprofileL->GetBinContent(binx, biny); + } else { + acvalue = 1.0; + } + fillHistograms(taga, tagb, Lambda, Proton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mLambda(), v0.pt(), desbinvalue, acvalue, 1.0); } @@ -1178,20 +1203,27 @@ struct lambdapolsp { if (aLambdaTag) { AntiLambda = AntiProton + Pion; taga = 0; - int binx = accprofileAL->GetXaxis()->FindBin(v0.eta()); - int biny = accprofileAL->GetYaxis()->FindBin(v0.pt()); - double acvalue = accprofileAL->GetBinContent(binx, biny); + if (useAccCorr) { + int binx = accprofileAL->GetXaxis()->FindBin(v0.eta()); + int biny = accprofileAL->GetYaxis()->FindBin(v0.pt()); + acvalue = accprofileAL->GetBinContent(binx, biny); + } else { + acvalue = 1.0; + } fillHistograms(taga, tagb, AntiLambda, AntiProton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mAntiLambda(), v0.pt(), desbinvalue, acvalue, 1.0); } } } else { - if (LambdaTag) { Lambda = Proton + AntiPion; tagb = 0; - int binx = accprofileL->GetXaxis()->FindBin(v0.eta()); - int biny = accprofileL->GetYaxis()->FindBin(v0.pt()); - double acvalue = accprofileL->GetBinContent(binx, biny); + if (useAccCorr) { + int binx = accprofileL->GetXaxis()->FindBin(v0.eta()); + int biny = accprofileL->GetYaxis()->FindBin(v0.pt()); + acvalue = accprofileL->GetBinContent(binx, biny); + } else { + acvalue = 1.0; + } if (distGrp.filldist && aLambdaTag == 0 && Lambda.M() > distGrp.lowmasscut && Lambda.M() < distGrp.highmasscut) { histos.fill(HIST("hcosinelambda"), v0.v0cosPA()); histos.fill(HIST("hdcabwv0daughlambda"), v0.dcaV0daughters()); @@ -1212,9 +1244,13 @@ struct lambdapolsp { if (aLambdaTag) { AntiLambda = AntiProton + Pion; taga = 0; - int binx = accprofileAL->GetXaxis()->FindBin(v0.eta()); - int biny = accprofileAL->GetYaxis()->FindBin(v0.pt()); - double acvalue = accprofileAL->GetBinContent(binx, biny); + if (useAccCorr) { + int binx = accprofileAL->GetXaxis()->FindBin(v0.eta()); + int biny = accprofileAL->GetYaxis()->FindBin(v0.pt()); + acvalue = accprofileAL->GetBinContent(binx, biny); + } else { + acvalue = 1.0; + } if (distGrp.filldist && LambdaTag == 0 && AntiLambda.M() > distGrp.lowmasscut && AntiLambda.M() < distGrp.highmasscut) { histos.fill(HIST("hcosineantilambda"), v0.v0cosPA()); histos.fill(HIST("hdcabwv0daughantilambda"), v0.dcaV0daughters()); @@ -1482,9 +1518,14 @@ struct lambdapolsp { if (analyzeLambda && LambdaTag) { Lambda = Proton + AntiPion; tagb = 0; - int binx = accprofileL->GetXaxis()->FindBin(v0.eta()); - int biny = accprofileL->GetYaxis()->FindBin(v0.pt()); - double acvalue = accprofileL->GetBinContent(binx, biny); + double acvalue = 1.0; + if (useAccCorr) { + int binx = accprofileL->GetXaxis()->FindBin(v0.eta()); + int biny = accprofileL->GetYaxis()->FindBin(v0.pt()); + acvalue = accprofileL->GetBinContent(binx, biny); + } else { + acvalue = 1.0; + } // double acvalue = 1.0; fillHistograms(taga, tagb, Lambda, Proton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mLambda(), v0.pt(), v0.eta(), acvalue, 1.0); } @@ -1493,9 +1534,14 @@ struct lambdapolsp { if (analyzeLambda && aLambdaTag) { AntiLambda = AntiProton + Pion; taga = 0; - int binx = accprofileAL->GetXaxis()->FindBin(v0.eta()); - int biny = accprofileAL->GetYaxis()->FindBin(v0.pt()); - double acvalue = accprofileAL->GetBinContent(binx, biny); + double acvalue = 1.0; + if (useAccCorr) { + int binx = accprofileAL->GetXaxis()->FindBin(v0.eta()); + int biny = accprofileAL->GetYaxis()->FindBin(v0.pt()); + acvalue = accprofileAL->GetBinContent(binx, biny); + } else { + acvalue = 1.0; + } // double acvalue = 1.0; fillHistograms(taga, tagb, AntiLambda, AntiProton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mAntiLambda(), v0.pt(), v0.eta(), acvalue, wgtvalue); } @@ -1505,7 +1551,142 @@ struct lambdapolsp { } PROCESS_SWITCH(lambdapolsp, processDerivedData, "Process derived data", false); + using TrackMCTrueTable = aod::McParticles; + ROOT::Math::PxPyPzMVector lambdadummymc, antiLambdadummymc, protonmc, pionmc, antiProtonmc, antiPionmc; + + void processMC(EventCandidatesMC::iterator const& collision, AllTrackCandidates const& /*tracks*/, TrackMCTrueTable const& GenParticles, ResoV0s const& V0s) + { + if (!collision.sel8()) { + return; + } + double centrality = -999.; + centrality = collision.centFT0C(); + + if (additionalEvSel && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { + return; + } + + if (additionalEvSel2 && (collision.trackOccupancyInTimeRange() > cfgMaxOccupancy || collision.trackOccupancyInTimeRange() < cfgMinOccupancy)) { + return; + } + + if (additionalEvSel3 && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { + return; + } + if (additionalEvSel4 && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + return; + } + + if (rctCut.requireRCTFlagChecker && !rctChecker(collision)) { + return; + } + + histos.fill(HIST("hCentrality"), centrality); + + for (const auto& v0 : V0s) { + + auto postrack = v0.template posTrack_as(); + auto negtrack = v0.template negTrack_as(); + + int LambdaTag = 0; + int aLambdaTag = 0; + + const auto signpos = postrack.sign(); + const auto signneg = negtrack.sign(); + + if (signpos < 0 || signneg > 0) { + continue; + } + + if (isSelectedV0Daughter(v0, postrack, 0, 0) && isSelectedV0Daughter(v0, negtrack, 1, 0)) { + LambdaTag = 1; + } + if (isSelectedV0Daughter(v0, negtrack, 0, 1) && isSelectedV0Daughter(v0, postrack, 1, 1)) { + aLambdaTag = 1; + } + + if (!LambdaTag && !aLambdaTag) + continue; + + if (!SelectionV0(collision, v0)) { + continue; + } + + if (LambdaTag) { + Proton = ROOT::Math::PxPyPzMVector(v0.pxpos(), v0.pypos(), v0.pzpos(), massPr); + AntiPion = ROOT::Math::PxPyPzMVector(v0.pxneg(), v0.pyneg(), v0.pzneg(), massPi); + Lambdadummy = Proton + AntiPion; + } + if (aLambdaTag) { + AntiProton = ROOT::Math::PxPyPzMVector(v0.pxneg(), v0.pyneg(), v0.pzneg(), massPr); + Pion = ROOT::Math::PxPyPzMVector(v0.pxpos(), v0.pypos(), v0.pzpos(), massPi); + AntiLambdadummy = AntiProton + Pion; + } + + if (shouldReject(LambdaTag, aLambdaTag, Lambdadummy, AntiLambdadummy)) { + continue; + } + + if (TMath::Abs(v0.eta()) > 0.8) + continue; + + if (LambdaTag) { + Lambda = Proton + AntiPion; + histos.fill(HIST("hSparseRecLambda"), v0.mLambda(), v0.pt(), centrality); + } + if (aLambdaTag) { + AntiLambda = AntiProton + Pion; + histos.fill(HIST("hSparseRecAntiLambda"), v0.mAntiLambda(), v0.pt(), centrality); + } + } + + for (const auto& mcParticle : GenParticles) { + if (std::abs(mcParticle.pdgCode()) != PDG_t::kLambda0) { + continue; + } + if (std::abs(mcParticle.y()) > ConfV0Rap) { + continue; + } + auto pdg1 = mcParticle.pdgCode(); + auto kDaughters = mcParticle.daughters_as(); + int daughsize = 2; + if (kDaughters.size() != daughsize) { + continue; + } + for (const auto& kCurrentDaughter : kDaughters) { + + if (std::abs(kCurrentDaughter.pdgCode()) != PDG_t::kProton && std::abs(kCurrentDaughter.pdgCode()) != PDG_t::kPiPlus) { + continue; + } + if (kCurrentDaughter.pdgCode() == PDG_t::kProton) { + protonmc = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), o2::constants::physics::MassProton); + } + if (kCurrentDaughter.pdgCode() == PDG_t::kPiMinus) { + antiPionmc = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), o2::constants::physics::MassPionCharged); + } + + if (kCurrentDaughter.pdgCode() == PDG_t::kProtonBar) { + antiProtonmc = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), o2::constants::physics::MassProton); + } + if (kCurrentDaughter.pdgCode() == PDG_t::kPiPlus) { + pionmc = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), o2::constants::physics::MassPionCharged); + } + } + if (pdg1 == PDG_t::kLambda0) { + lambdadummymc = protonmc + antiPionmc; + histos.fill(HIST("hSparseGenLambda"), lambdadummymc.M(), lambdadummymc.Pt(), centrality); + } + + if (pdg1 == PDG_t::kLambda0Bar) { + antiLambdadummymc = antiProtonmc + pionmc; + histos.fill(HIST("hSparseGenAntiLambda"), antiLambdadummymc.M(), antiLambdadummymc.Pt(), centrality); + } + } + } + PROCESS_SWITCH(lambdapolsp, processMC, "Process MC", false); + // Processing Event Mixing + /* using BinningType = ColumnBinningPolicy; BinningType colBinning{{meGrp.axisVertex, meGrp.axisMultiplicityClass}, true}; Preslice tracksPerCollisionV0Mixed = o2::aod::v0data::straCollisionId; // for derived data only @@ -1644,6 +1825,7 @@ struct lambdapolsp { } PROCESS_SWITCH(lambdapolsp, processDerivedDataMixed, "Process mixed event using derived data", false); + void processDerivedDataMixed2(soa::Join const& collisions, v0Candidates const& V0s, dauTracks const&) { TRandom3 randGen(0); @@ -1795,150 +1977,9 @@ struct lambdapolsp { } } PROCESS_SWITCH(lambdapolsp, processDerivedDataMixed2, "Process mixed event2 using derived data", false); - - void processDerivedDataMixedFIFO(soa::Join const& collisions, v0Candidates const& V0s, dauTracks const&) - { - - auto nBins = colBinning.getAllBinsCount(); - std::vector> eventPools(nBins); // Pool per bin holding just event indices - - for (auto& collision1 : collisions) { - - if (!collision1.sel8()) { - continue; - } - if (!collision1.triggereventsp()) { // provided by StraZDCSP - continue; - } - if (rctCut.requireRCTFlagChecker && !rctChecker(collision1)) { - continue; - } - - if (additionalEvSel && (!collision1.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { - continue; - } - if (additionalEvSel2 && (collision1.trackOccupancyInTimeRange() > cfgMaxOccupancy || collision1.trackOccupancyInTimeRange() < cfgMinOccupancy)) { - continue; - } - if (additionalEvSel3 && (!collision1.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision1.selection_bit(aod::evsel::kNoITSROFrameBorder))) { - continue; - } - if (additionalEvSel4 && !collision1.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { - continue; - } - - int bin = colBinning.getBin(std::make_tuple(collision1.posZ(), collision1.centFT0C())); - auto groupV0_evt1 = V0s.sliceBy(tracksPerCollisionV0Mixed, collision1.index()); - float centrality = collision1.centFT0C(); - auto qxZDCA = collision1.qxZDCA(); - auto qxZDCC = collision1.qxZDCC(); - auto qyZDCA = collision1.qyZDCA(); - auto qyZDCC = collision1.qyZDCC(); - auto psiZDCC = collision1.psiZDCC(); - auto psiZDCA = collision1.psiZDCA(); - double modqxZDCA; - double modqyZDCA; - double modqxZDCC; - double modqyZDCC; - - if (bin < 0) - continue; - modqxZDCA = TMath::Sqrt((qxZDCA * qxZDCA) + (qyZDCA * qyZDCA)) * TMath::Cos(psiZDCA); - modqyZDCA = TMath::Sqrt((qxZDCA * qxZDCA) + (qyZDCA * qyZDCA)) * TMath::Sin(psiZDCA); - modqxZDCC = TMath::Sqrt((qxZDCC * qxZDCC) + (qyZDCC * qyZDCC)) * TMath::Cos(psiZDCC); - modqyZDCC = TMath::Sqrt((qxZDCC * qxZDCC) + (qyZDCC * qyZDCC)) * TMath::Sin(psiZDCC); - - auto psiZDC = TMath::ATan2((modqyZDCC - modqyZDCA), (modqxZDCC - modqxZDCA)); // full event plane from collision - - histos.fill(HIST("hCentrality"), centrality); - histos.fill(HIST("hpRes"), centrality, (TMath::Cos(GetPhiInRange(psiZDCA - psiZDCC)))); - - // For deduplication of (v0_evt1, v0_evt2) pairs per mixed event - std::unordered_map>> seenMap; - - // Loop over Λ candidates in collision1 (keep psi from here) - - for (auto& v0_evt1 : groupV0_evt1) { - if (!SelectionV0(collision1, v0_evt1)) - continue; - bool LambdaTag1 = isCompatible(v0_evt1, 0); - bool aLambdaTag1 = isCompatible(v0_evt1, 1); - ROOT::Math::PxPyPzMVector proton1, pion1, antiproton1, antipion1, LambdaTag1dummy, AntiLambdaTag1dummy; - if (LambdaTag1) { - proton1 = {v0_evt1.pxpos(), v0_evt1.pypos(), v0_evt1.pzpos(), massPr}; - antipion1 = {v0_evt1.pxneg(), v0_evt1.pyneg(), v0_evt1.pzneg(), massPi}; - LambdaTag1dummy = proton1 + antipion1; - } - if (aLambdaTag1) { - antiproton1 = {v0_evt1.pxneg(), v0_evt1.pyneg(), v0_evt1.pzneg(), massPr}; - pion1 = {v0_evt1.pxpos(), v0_evt1.pypos(), v0_evt1.pzpos(), massPi}; - AntiLambdaTag1dummy = antiproton1 + pion1; - } - if (shouldReject(LambdaTag1, aLambdaTag1, LambdaTag1dummy, AntiLambdaTag1dummy)) { - continue; - } - if (TMath::Abs(v0_evt1.eta()) > 0.8) - continue; - - // Loop over all FIFO pool events (mixed events) for this centrality bin - int nMixedEvents = 0; - for (auto it = eventPools[bin].rbegin(); it != eventPools[bin].rend() && nMixedEvents < meGrp.nMix; ++it, ++nMixedEvents) { - int collision2idx = *it; - if (collision1.index() == collision2idx) - continue; - auto groupV0_evt2 = V0s.sliceBy(tracksPerCollisionV0Mixed, collision2idx); - - // Now loop over Λ candidates in collision2 to randomize proton phi* (randomize decay angle) - for (auto& v0_evt2 : groupV0_evt2) { - if (!SelectionV0(collision1, v0_evt2)) - continue; - bool LambdaTag2 = isCompatible(v0_evt2, 0); - bool aLambdaTag2 = isCompatible(v0_evt2, 1); - if (!LambdaTag2 && !aLambdaTag2) - continue; - - // Deduplicate (v0_evt1, v0_evt2) pairs per collision2idx - auto key = std::make_pair(v0_evt1.index(), v0_evt2.index()); - if (!seenMap[collision2idx].insert(key).second) - continue; - - ROOT::Math::PxPyPzMVector proton_mix, antiproton_mix, pion_mix, antipion_mix, LambdaTag2dummy, AntiLambdaTag2dummy; - if (LambdaTag2) { - proton_mix = {v0_evt2.pxpos(), v0_evt2.pypos(), v0_evt2.pzpos(), massPr}; - antipion_mix = {v0_evt2.pxneg(), v0_evt2.pyneg(), v0_evt2.pzneg(), massPi}; - LambdaTag2dummy = proton_mix + antipion_mix; - } - if (aLambdaTag2) { - antiproton_mix = {v0_evt2.pxneg(), v0_evt2.pyneg(), v0_evt2.pzneg(), massPr}; - pion_mix = {v0_evt2.pxpos(), v0_evt2.pypos(), v0_evt2.pzpos(), massPi}; - AntiLambdaTag2dummy = antiproton_mix + pion_mix; - } - if (shouldReject(LambdaTag2, aLambdaTag2, LambdaTag2dummy, AntiLambdaTag2dummy)) { - continue; - } - if (TMath::Abs(v0_evt2.eta()) > 0.8) - continue; - if (LambdaTag1) { - double acvalue = 1.0; - fillHistograms(1, 0, LambdaTag1dummy, proton_mix, psiZDCC, psiZDCA, psiZDC, centrality, v0_evt1.mLambda(), v0_evt1.pt(), v0_evt1.eta(), acvalue, 1.0); - } - if (aLambdaTag1) { - double acvalue = 1.0; - fillHistograms(0, 1, AntiLambdaTag1dummy, antiproton_mix, psiZDCC, psiZDCA, psiZDC, centrality, v0_evt1.mAntiLambda(), v0_evt1.pt(), v0_evt1.eta(), acvalue, 1.0); - } - } - } - } - // After processing all mixes, add current event V0s to pool for future mixing - eventPools[bin].push_back(collision1.index()); - // Keep only N last events in FIFO queue - if (static_cast(eventPools[bin].size()) > meGrp.nMix) { - eventPools[bin].pop_front(); - } - } - } - PROCESS_SWITCH(lambdapolsp, processDerivedDataMixedFIFO, "Process mixed event using derived data with FIFO method", false); + */ }; + WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ From b5ded3b4d9a8ee61505bf46b43554e360e6503a5 Mon Sep 17 00:00:00 2001 From: ariedel-cern <85537041+ariedel-cern@users.noreply.github.com> Date: Sun, 19 Oct 2025 03:33:31 +0200 Subject: [PATCH 804/986] [PWGCF] FemtoFramework update (#13446) --- PWGCF/Femto/Core/cascadeBuilder.h | 6 +- PWGCF/Femto/Core/cascadeHistManager.h | 80 ++--- PWGCF/Femto/Core/closePairRejection.h | 96 ++++-- PWGCF/Femto/Core/collisionBuilder.h | 4 + PWGCF/Femto/Core/collisionHistManager.h | 60 ++-- PWGCF/Femto/Core/histManager.h | 52 ++-- PWGCF/Femto/Core/kinkBuilder.h | 5 +- PWGCF/Femto/Core/kinkHistManager.h | 100 +++--- PWGCF/Femto/Core/pairBuilder.h | 220 ++++++++++++-- PWGCF/Femto/Core/pairCleaner.h | 27 +- PWGCF/Femto/Core/pairHistManager.h | 58 ++-- PWGCF/Femto/Core/pairProcessHelpers.h | 241 +++++++-------- PWGCF/Femto/Core/selectionContainer.h | 11 +- PWGCF/Femto/Core/trackBuilder.h | 15 +- PWGCF/Femto/Core/trackHistManager.h | 286 +++++++++--------- PWGCF/Femto/Core/twoTrackResonanceBuilder.h | 2 +- .../Femto/Core/twoTrackResonanceHistManager.h | 44 +-- PWGCF/Femto/Core/v0Builder.h | 16 +- PWGCF/Femto/Core/v0HistManager.h | 130 ++++---- PWGCF/Femto/DataModel/FemtoTables.h | 37 +-- PWGCF/Femto/TableProducer/femtoProducer.cxx | 100 +++--- .../femtoProducerDerivedToDerived.cxx | 11 +- PWGCF/Femto/Tasks/CMakeLists.txt | 5 + PWGCF/Femto/Tasks/femtoCascadeQa.cxx | 8 +- PWGCF/Femto/Tasks/femtoKinkQa.cxx | 4 +- PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx | 10 +- PWGCF/Femto/Tasks/femtoPairTrackKink.cxx | 8 +- PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx | 8 +- .../Tasks/femtoPairTrackTwoTrackResonance.cxx | 12 +- PWGCF/Femto/Tasks/femtoPairTrackV0.cxx | 18 +- PWGCF/Femto/Tasks/femtoPairV0V0.cxx | 204 +++++++++++++ PWGCF/Femto/Tasks/femtoTrackQa.cxx | 8 +- .../Femto/Tasks/femtoTwotrackresonanceQa.cxx | 16 +- PWGCF/Femto/Tasks/femtoV0Qa.cxx | 13 +- 34 files changed, 1206 insertions(+), 709 deletions(-) create mode 100644 PWGCF/Femto/Tasks/femtoPairV0V0.cxx diff --git a/PWGCF/Femto/Core/cascadeBuilder.h b/PWGCF/Femto/Core/cascadeBuilder.h index 6a3a6722879..c65611da008 100644 --- a/PWGCF/Femto/Core/cascadeBuilder.h +++ b/PWGCF/Femto/Core/cascadeBuilder.h @@ -367,9 +367,9 @@ class CascadeBuilder return; } - int64_t bachelorIndex = 0; - int64_t posDaughterIndex = 0; - int64_t negDaughterIndex = 0; + int32_t bachelorIndex = 0; + int32_t posDaughterIndex = 0; + int32_t negDaughterIndex = 0; for (const auto& cascade : fullCascades) { if (!mCascadeSelection.checkFilters(cascade)) { continue; diff --git a/PWGCF/Femto/Core/cascadeHistManager.h b/PWGCF/Femto/Core/cascadeHistManager.h index 91b2413ff08..3429a9de3c2 100644 --- a/PWGCF/Femto/Core/cascadeHistManager.h +++ b/PWGCF/Femto/Core/cascadeHistManager.h @@ -168,7 +168,7 @@ template add(analysisDir + GetHistNamev2(kPt, HistTable), GetHistDesc(kPt, HistTable), GetHistType(kPt, HistTable), {cascadeSpecs[kPt]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kEta, HistTable), GetHistDesc(kEta, HistTable), GetHistType(kEta, HistTable), {cascadeSpecs[kEta]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kPhi, HistTable), GetHistDesc(kPhi, HistTable), GetHistType(kPhi, HistTable), {cascadeSpecs[kPhi]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kMass, HistTable), GetHistDesc(kMass, HistTable), GetHistType(kMass, HistTable), {cascadeSpecs[kMass]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kSign, HistTable), GetHistDesc(kSign, HistTable), GetHistType(kSign, HistTable), {cascadeSpecs[kSign]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {cascadeSpecs[kPt]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {cascadeSpecs[kEta]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {cascadeSpecs[kPhi]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kMass, HistTable), getHistDesc(kMass, HistTable), getHistType(kMass, HistTable), {cascadeSpecs[kMass]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {cascadeSpecs[kSign]}); } if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { std::string qaDir = std::string(cascadePrefix) + std::string(QaDir); - mHistogramRegistry->add(qaDir + GetHistNamev2(kCosPa, HistTable), GetHistDesc(kCosPa, HistTable), GetHistType(kCosPa, HistTable), {cascadeSpecs[kCosPa]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kDecayDauDca, HistTable), GetHistDesc(kDecayDauDca, HistTable), GetHistType(kDecayDauDca, HistTable), {cascadeSpecs[kDecayDauDca]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kTransRadius, HistTable), GetHistDesc(kTransRadius, HistTable), GetHistType(kTransRadius, HistTable), {cascadeSpecs[kTransRadius]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kCosPa, HistTable), getHistDesc(kCosPa, HistTable), getHistType(kCosPa, HistTable), {cascadeSpecs[kCosPa]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayDauDca, HistTable), getHistDesc(kDecayDauDca, HistTable), getHistType(kDecayDauDca, HistTable), {cascadeSpecs[kDecayDauDca]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTransRadius, HistTable), getHistDesc(kTransRadius, HistTable), getHistType(kTransRadius, HistTable), {cascadeSpecs[kTransRadius]}); // qa 2d - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsEta, HistTable), GetHistDesc(kPtVsEta, HistTable), GetHistType(kPtVsEta, HistTable), {cascadeSpecs[kPtVsEta]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsPhi, HistTable), GetHistDesc(kPtVsPhi, HistTable), GetHistType(kPtVsPhi, HistTable), {cascadeSpecs[kPtVsPhi]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPhiVsEta, HistTable), GetHistDesc(kPhiVsEta, HistTable), GetHistType(kPhiVsEta, HistTable), {cascadeSpecs[kPhiVsEta]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsCosPa, HistTable), GetHistDesc(kPtVsCosPa, HistTable), GetHistType(kPtVsCosPa, HistTable), {cascadeSpecs[kPtVsCosPa]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsEta, HistTable), getHistDesc(kPtVsEta, HistTable), getHistType(kPtVsEta, HistTable), {cascadeSpecs[kPtVsEta]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPhi, HistTable), getHistDesc(kPtVsPhi, HistTable), getHistType(kPtVsPhi, HistTable), {cascadeSpecs[kPtVsPhi]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPhiVsEta, HistTable), getHistDesc(kPhiVsEta, HistTable), getHistType(kPhiVsEta, HistTable), {cascadeSpecs[kPhiVsEta]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsCosPa, HistTable), getHistDesc(kPtVsCosPa, HistTable), getHistType(kPtVsCosPa, HistTable), {cascadeSpecs[kPtVsCosPa]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kMassXi, HistTable), GetHistDesc(kMassXi, HistTable), GetHistType(kMassXi, HistTable), {cascadeSpecs[kMassXi]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kMassOmega, HistTable), GetHistDesc(kMassOmega, HistTable), GetHistType(kMassOmega, HistTable), {cascadeSpecs[kMassOmega]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsMassXi, HistTable), GetHistDesc(kPtVsMassXi, HistTable), GetHistType(kPtVsMassXi, HistTable), {cascadeSpecs[kPtVsMassXi]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsMassOmega, HistTable), GetHistDesc(kPtVsMassOmega, HistTable), GetHistType(kPtVsMassOmega, HistTable), {cascadeSpecs[kPtVsMassOmega]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kMassXiVsMassOmega, HistTable), GetHistDesc(kMassXiVsMassOmega, HistTable), GetHistType(kMassXiVsMassOmega, HistTable), {cascadeSpecs[kMassXiVsMassOmega]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kMassXi, HistTable), getHistDesc(kMassXi, HistTable), getHistType(kMassXi, HistTable), {cascadeSpecs[kMassXi]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kMassOmega, HistTable), getHistDesc(kMassOmega, HistTable), getHistType(kMassOmega, HistTable), {cascadeSpecs[kMassOmega]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsMassXi, HistTable), getHistDesc(kPtVsMassXi, HistTable), getHistType(kPtVsMassXi, HistTable), {cascadeSpecs[kPtVsMassXi]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsMassOmega, HistTable), getHistDesc(kPtVsMassOmega, HistTable), getHistType(kPtVsMassOmega, HistTable), {cascadeSpecs[kPtVsMassOmega]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kMassXiVsMassOmega, HistTable), getHistDesc(kMassXiVsMassOmega, HistTable), getHistType(kMassXiVsMassOmega, HistTable), {cascadeSpecs[kMassXiVsMassOmega]}); } } template - void fill(T1 const& cascadeCandidate, T2 const& /*tracks*/) + void fill(T1 const& cascadeCandidate, T2 const& tracks) { auto bachelor = cascadeCandidate.template bachelor_as(); - mBachelorManager.fill(bachelor); + mBachelorManager.fill(bachelor, tracks); auto posDaughter = cascadeCandidate.template posDau_as(); - mPosDauManager.fill(posDaughter); + mPosDauManager.fill(posDaughter, tracks); auto negDaughter = cascadeCandidate.template negDau_as(); - mNegDauManager.fill(negDaughter); + mNegDauManager.fill(negDaughter, tracks); if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(GetHistName(kPt, HistTable)), cascadeCandidate.pt()); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(GetHistName(kEta, HistTable)), cascadeCandidate.eta()); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(GetHistName(kPhi, HistTable)), cascadeCandidate.phi()); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(GetHistName(kMass, HistTable)), cascadeCandidate.mass()); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(GetHistName(kSign, HistTable)), cascadeCandidate.sign()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kPt, HistTable)), cascadeCandidate.pt()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kEta, HistTable)), cascadeCandidate.eta()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kPhi, HistTable)), cascadeCandidate.phi()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kMass, HistTable)), cascadeCandidate.mass()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), cascadeCandidate.sign()); } if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { float massXi, massOmega; @@ -241,23 +241,23 @@ class CascadeHistManager massXi = cascadeCandidate.massXi(); massOmega = cascadeCandidate.mass(); } - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(GetHistName(kCosPa, HistTable)), cascadeCandidate.cascadeCosPa()); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(GetHistName(kDecayDauDca, HistTable)), cascadeCandidate.cascadeDauDca()); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(GetHistName(kTransRadius, HistTable)), cascadeCandidate.cascadeTransRadius()); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(GetHistName(kPtVsEta, HistTable)), cascadeCandidate.pt(), cascadeCandidate.eta()); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(GetHistName(kPtVsPhi, HistTable)), cascadeCandidate.pt(), cascadeCandidate.phi()); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(GetHistName(kPhiVsEta, HistTable)), cascadeCandidate.phi(), cascadeCandidate.eta()); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(GetHistName(kPtVsCosPa, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadeCosPa()); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(GetHistName(kMassXi, HistTable)), massXi); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(GetHistName(kMassOmega, HistTable)), massOmega); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(GetHistName(kPtVsMassXi, HistTable)), cascadeCandidate.pt(), massXi); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(GetHistName(kPtVsMassOmega, HistTable)), cascadeCandidate.pt(), massOmega); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(GetHistName(kMassXiVsMassOmega, HistTable)), massXi, massOmega); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kCosPa, HistTable)), cascadeCandidate.cascadeCosPa()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kDecayDauDca, HistTable)), cascadeCandidate.cascadeDauDca()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kTransRadius, HistTable)), cascadeCandidate.cascadeTransRadius()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kPtVsEta, HistTable)), cascadeCandidate.pt(), cascadeCandidate.eta()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kPtVsPhi, HistTable)), cascadeCandidate.pt(), cascadeCandidate.phi()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kPhiVsEta, HistTable)), cascadeCandidate.phi(), cascadeCandidate.eta()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kPtVsCosPa, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadeCosPa()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kMassXi, HistTable)), massXi); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kMassOmega, HistTable)), massOmega); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kPtVsMassXi, HistTable)), cascadeCandidate.pt(), massXi); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kPtVsMassOmega, HistTable)), cascadeCandidate.pt(), massOmega); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kMassXiVsMassOmega, HistTable)), massXi, massOmega); } } private: - o2::framework::HistogramRegistry* mHistogramRegistry; + o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; trackhistmanager::TrackHistManager mBachelorManager; trackhistmanager::TrackHistManager mPosDauManager; diff --git a/PWGCF/Femto/Core/closePairRejection.h b/PWGCF/Femto/Core/closePairRejection.h index 147c55fa6a1..3cf20930ef4 100644 --- a/PWGCF/Femto/Core/closePairRejection.h +++ b/PWGCF/Femto/Core/closePairRejection.h @@ -19,9 +19,13 @@ #include "PWGCF/Femto/Core/femtoUtils.h" #include "PWGCF/Femto/Core/histManager.h" +#include "Framework/Configurable.h" #include "Framework/HistogramRegistry.h" +#include "Framework/HistogramSpec.h" #include +#include +#include #include #include #include @@ -65,6 +69,10 @@ constexpr char PrefixTrackTrackSe[] = "CPR_TrackTrack/SE/"; constexpr char PrefixTrackTrackMe[] = "CPR_TrackTrack/ME/"; constexpr char PrefixTrackV0Se[] = "CPR_TrackV0Daughter/SE/"; constexpr char PrefixTrackV0Me[] = "CPR_TrackV0Daughter/ME/"; +constexpr char PrefixV0V0PosSe[] = "CPR_V0V0_PosDau/SE/"; +constexpr char PrefixV0V0NegSe[] = "CPR_V0V0_NegDau/SE/"; +constexpr char PrefixV0V0PosMe[] = "CPR_V0V0_PosDau/ME/"; +constexpr char PrefixV0V0NegMe[] = "CPR_V0V0_NegDau/ME/"; constexpr char PrefixTrackTwoTrackResonanceSe[] = "CPR_TrackResonanceDaughter/SE/"; constexpr char PrefixTrackTwoTrackResonnaceMe[] = "CPR_TrackResonanceDaughter/ME/"; constexpr char PrefixTrackCascadeSe[] = "CPR_TrackCascadeBachelor/SE/"; @@ -119,16 +127,16 @@ class CloseTrackRejection mHistogramRegistry = registry; - mHistogramRegistry->add(std::string(prefix) + GetHistNamev2(kAverage, HistTable), GetHistDesc(kAverage, HistTable), GetHistType(kAverage, HistTable), {specs.at(kAverage)}); - mHistogramRegistry->add(std::string(prefix) + GetHistNamev2(kRadius0, HistTable), GetHistDesc(kRadius0, HistTable), GetHistType(kRadius0, HistTable), {specs.at(kRadius0)}); - mHistogramRegistry->add(std::string(prefix) + GetHistNamev2(kRadius1, HistTable), GetHistDesc(kRadius1, HistTable), GetHistType(kRadius1, HistTable), {specs.at(kRadius1)}); - mHistogramRegistry->add(std::string(prefix) + GetHistNamev2(kRadius2, HistTable), GetHistDesc(kRadius2, HistTable), GetHistType(kRadius2, HistTable), {specs.at(kRadius2)}); - mHistogramRegistry->add(std::string(prefix) + GetHistNamev2(kRadius3, HistTable), GetHistDesc(kRadius3, HistTable), GetHistType(kRadius3, HistTable), {specs.at(kRadius3)}); - mHistogramRegistry->add(std::string(prefix) + GetHistNamev2(kRadius4, HistTable), GetHistDesc(kRadius4, HistTable), GetHistType(kRadius4, HistTable), {specs.at(kRadius4)}); - mHistogramRegistry->add(std::string(prefix) + GetHistNamev2(kRadius5, HistTable), GetHistDesc(kRadius5, HistTable), GetHistType(kRadius5, HistTable), {specs.at(kRadius5)}); - mHistogramRegistry->add(std::string(prefix) + GetHistNamev2(kRadius6, HistTable), GetHistDesc(kRadius6, HistTable), GetHistType(kRadius6, HistTable), {specs.at(kRadius6)}); - mHistogramRegistry->add(std::string(prefix) + GetHistNamev2(kRadius7, HistTable), GetHistDesc(kRadius7, HistTable), GetHistType(kRadius7, HistTable), {specs.at(kRadius7)}); - mHistogramRegistry->add(std::string(prefix) + GetHistNamev2(kRadius8, HistTable), GetHistDesc(kRadius8, HistTable), GetHistType(kRadius8, HistTable), {specs.at(kRadius8)}); + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kAverage, HistTable), getHistDesc(kAverage, HistTable), getHistType(kAverage, HistTable), {specs.at(kAverage)}); + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius0, HistTable), getHistDesc(kRadius0, HistTable), getHistType(kRadius0, HistTable), {specs.at(kRadius0)}); + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius1, HistTable), getHistDesc(kRadius1, HistTable), getHistType(kRadius1, HistTable), {specs.at(kRadius1)}); + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius2, HistTable), getHistDesc(kRadius2, HistTable), getHistType(kRadius2, HistTable), {specs.at(kRadius2)}); + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius3, HistTable), getHistDesc(kRadius3, HistTable), getHistType(kRadius3, HistTable), {specs.at(kRadius3)}); + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius4, HistTable), getHistDesc(kRadius4, HistTable), getHistType(kRadius4, HistTable), {specs.at(kRadius4)}); + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius5, HistTable), getHistDesc(kRadius5, HistTable), getHistType(kRadius5, HistTable), {specs.at(kRadius5)}); + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius6, HistTable), getHistDesc(kRadius6, HistTable), getHistType(kRadius6, HistTable), {specs.at(kRadius6)}); + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius7, HistTable), getHistDesc(kRadius7, HistTable), getHistType(kRadius7, HistTable), {specs.at(kRadius7)}); + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius8, HistTable), getHistDesc(kRadius8, HistTable), getHistType(kRadius8, HistTable), {specs.at(kRadius8)}); } void setMagField(float magField) { mMagField = magField; } @@ -157,18 +165,18 @@ class CloseTrackRejection void fill() { // fill average hist - mHistogramRegistry->fill(HIST(prefix) + HIST(GetHistName(kAverage, HistTable)), mDeta, mAverageDphistar); + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kAverage, HistTable)), mDeta, mAverageDphistar); // fill radii hists - mHistogramRegistry->fill(HIST(prefix) + HIST(GetHistName(kRadius0, HistTable)), mDeta, mDphistar.at(0)); - mHistogramRegistry->fill(HIST(prefix) + HIST(GetHistName(kRadius1, HistTable)), mDeta, mDphistar.at(1)); - mHistogramRegistry->fill(HIST(prefix) + HIST(GetHistName(kRadius2, HistTable)), mDeta, mDphistar.at(2)); - mHistogramRegistry->fill(HIST(prefix) + HIST(GetHistName(kRadius3, HistTable)), mDeta, mDphistar.at(3)); - mHistogramRegistry->fill(HIST(prefix) + HIST(GetHistName(kRadius4, HistTable)), mDeta, mDphistar.at(4)); - mHistogramRegistry->fill(HIST(prefix) + HIST(GetHistName(kRadius5, HistTable)), mDeta, mDphistar.at(5)); - mHistogramRegistry->fill(HIST(prefix) + HIST(GetHistName(kRadius6, HistTable)), mDeta, mDphistar.at(6)); - mHistogramRegistry->fill(HIST(prefix) + HIST(GetHistName(kRadius7, HistTable)), mDeta, mDphistar.at(7)); - mHistogramRegistry->fill(HIST(prefix) + HIST(GetHistName(kRadius8, HistTable)), mDeta, mDphistar.at(8)); + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius0, HistTable)), mDeta, mDphistar.at(0)); + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius1, HistTable)), mDeta, mDphistar.at(1)); + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius2, HistTable)), mDeta, mDphistar.at(2)); + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius3, HistTable)), mDeta, mDphistar.at(3)); + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius4, HistTable)), mDeta, mDphistar.at(4)); + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius5, HistTable)), mDeta, mDphistar.at(5)); + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius6, HistTable)), mDeta, mDphistar.at(6)); + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius7, HistTable)), mDeta, mDphistar.at(7)); + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius8, HistTable)), mDeta, mDphistar.at(8)); } bool isClosePair() const @@ -202,8 +210,8 @@ class ClosePairRejectionTrackTrack } void setMagField(float magField) { mCtr.setMagField(magField); } - template - void setPair(const T1& track1, const T2& track2) + template + void setPair(T1 const& track1, T2 const& track2, T3 const& /*tracks*/) { mCtr.compute(track1, track2); } @@ -216,6 +224,50 @@ class ClosePairRejectionTrackTrack bool mIsActivated = true; }; +template +class ClosePairRejectionV0V0 +{ + public: + void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, bool isActivated) + { + mIsActivated = isActivated; + if (mIsActivated) { + mCtrPos.init(registry, specs, detaMax, dphistarMax, 1, 1); + mCtrNeg.init(registry, specs, detaMax, dphistarMax, 1, 1); + } + } + + void setMagField(float magField) + { + mCtrPos.setMagField(magField); + mCtrNeg.setMagField(magField); + } + template + void setPair(T1 const& v01, T2 const& v02, T3 const& /*tracks*/) + { + auto posDau1 = v01.template posDau_as(); + auto negDau1 = v01.template posDau_as(); + + auto posDau2 = v02.template posDau_as(); + auto negDau2 = v02.template posDau_as(); + + mCtrPos.compute(posDau1, posDau2); + mCtrNeg.compute(negDau1, negDau2); + } + bool isClosePair() const { return mCtrPos.isClosePair() && mCtrNeg.isClosePair(); } + void fill() + { + mCtrPos.fill(); + mCtrNeg.fill(); + } + bool isActivated() const { return mIsActivated; } + + private: + CloseTrackRejection mCtrPos; + CloseTrackRejection mCtrNeg; + bool mIsActivated = true; +}; + template class ClosePairRejectionTrackV0 // can also be used for any particle type that has pos/neg daughters, like resonances { diff --git a/PWGCF/Femto/Core/collisionBuilder.h b/PWGCF/Femto/Core/collisionBuilder.h index 71f9bc48028..cd6fc90fc05 100644 --- a/PWGCF/Femto/Core/collisionBuilder.h +++ b/PWGCF/Femto/Core/collisionBuilder.h @@ -20,9 +20,11 @@ #include "PWGCF/Femto/Core/dataTypes.h" #include "PWGCF/Femto/Core/femtoUtils.h" #include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/selectionContainer.h" #include "PWGCF/Femto/DataModel/FemtoTables.h" #include "Common/CCDB/EventSelectionParams.h" +#include "Common/CCDB/RCTSelectionFlags.h" #include "EventFiltering/Zorro.h" #include "DataFormatsParameters/GRPMagField.h" @@ -33,6 +35,8 @@ #include #include +#include +#include #include #include #include diff --git a/PWGCF/Femto/Core/collisionHistManager.h b/PWGCF/Femto/Core/collisionHistManager.h index b08972c4202..38e261069fd 100644 --- a/PWGCF/Femto/Core/collisionHistManager.h +++ b/PWGCF/Femto/Core/collisionHistManager.h @@ -125,7 +125,7 @@ template class CollisionHistManager { public: - /// Destructor + CollisionHistManager() = default; virtual ~CollisionHistManager() = default; /// Initializes histograms for the task /// \param registry Histogram registry to be passed @@ -134,25 +134,25 @@ class CollisionHistManager mHistogramRegistry = registry; if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { std::string analysisDir = std::string(ColAnalysisDir); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kPosZ, HistTable), GetHistDesc(kPosZ, HistTable), GetHistType(kPosZ, HistTable), {Specs[kPosZ]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kMult, HistTable), GetHistDesc(kMult, HistTable), GetHistType(kMult, HistTable), {Specs[kMult]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kCent, HistTable), GetHistDesc(kCent, HistTable), GetHistType(kCent, HistTable), {Specs[kCent]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kMagField, HistTable), GetHistDesc(kMagField, HistTable), GetHistType(kMagField, HistTable), {Specs[kMagField]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPosZ, HistTable), getHistDesc(kPosZ, HistTable), getHistType(kPosZ, HistTable), {Specs[kPosZ]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kMult, HistTable), getHistDesc(kMult, HistTable), getHistType(kMult, HistTable), {Specs[kMult]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kCent, HistTable), getHistDesc(kCent, HistTable), getHistType(kCent, HistTable), {Specs[kCent]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kMagField, HistTable), getHistDesc(kMagField, HistTable), getHistType(kMagField, HistTable), {Specs[kMagField]}); } if constexpr (isFlagSet(mode, modes::Mode::kQa)) { std::string qaDir = std::string(ColQaDir); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPosX, HistTable), GetHistDesc(kPosX, HistTable), GetHistType(kPosX, HistTable), {Specs[kPosX]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPosY, HistTable), GetHistDesc(kPosY, HistTable), GetHistType(kPosY, HistTable), {Specs[kPosY]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPos, HistTable), GetHistDesc(kPos, HistTable), GetHistType(kPos, HistTable), {Specs[kPos]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kSphericity, HistTable), GetHistDesc(kSphericity, HistTable), GetHistType(kSphericity, HistTable), {Specs[kSphericity]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kOccupancy, HistTable), GetHistDesc(kOccupancy, HistTable), GetHistType(kOccupancy, HistTable), {Specs[kOccupancy]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPoszVsMult, HistTable), GetHistDesc(kPoszVsMult, HistTable), GetHistType(kPoszVsMult, HistTable), {Specs[kPoszVsMult]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPoszVsCent, HistTable), GetHistDesc(kPoszVsCent, HistTable), GetHistType(kPoszVsCent, HistTable), {Specs[kPoszVsCent]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kCentVsMult, HistTable), GetHistDesc(kCentVsMult, HistTable), GetHistType(kCentVsMult, HistTable), {Specs[kCentVsMult]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kMultVsSphericity, HistTable), GetHistDesc(kMultVsSphericity, HistTable), GetHistType(kMultVsSphericity, HistTable), {Specs[kMultVsSphericity]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kCentVsSphericity, HistTable), GetHistDesc(kCentVsSphericity, HistTable), GetHistType(kCentVsSphericity, HistTable), {Specs[kCentVsSphericity]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPosX, HistTable), getHistDesc(kPosX, HistTable), getHistType(kPosX, HistTable), {Specs[kPosX]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPosY, HistTable), getHistDesc(kPosY, HistTable), getHistType(kPosY, HistTable), {Specs[kPosY]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPos, HistTable), getHistDesc(kPos, HistTable), getHistType(kPos, HistTable), {Specs[kPos]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kSphericity, HistTable), getHistDesc(kSphericity, HistTable), getHistType(kSphericity, HistTable), {Specs[kSphericity]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kOccupancy, HistTable), getHistDesc(kOccupancy, HistTable), getHistType(kOccupancy, HistTable), {Specs[kOccupancy]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPoszVsMult, HistTable), getHistDesc(kPoszVsMult, HistTable), getHistType(kPoszVsMult, HistTable), {Specs[kPoszVsMult]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPoszVsCent, HistTable), getHistDesc(kPoszVsCent, HistTable), getHistType(kPoszVsCent, HistTable), {Specs[kPoszVsCent]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kCentVsMult, HistTable), getHistDesc(kCentVsMult, HistTable), getHistType(kCentVsMult, HistTable), {Specs[kCentVsMult]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kMultVsSphericity, HistTable), getHistDesc(kMultVsSphericity, HistTable), getHistType(kMultVsSphericity, HistTable), {Specs[kMultVsSphericity]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kCentVsSphericity, HistTable), getHistDesc(kCentVsSphericity, HistTable), getHistType(kCentVsSphericity, HistTable), {Specs[kCentVsSphericity]}); } } // namespace o2::analysis::femtounited @@ -160,28 +160,28 @@ class CollisionHistManager void fill(T const& col) { if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { - mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kPosZ, HistTable)), col.posZ()); - mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kMult, HistTable)), col.mult()); - mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kCent, HistTable)), col.cent()); - mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(GetHistName(kMagField, HistTable)), col.magField()); + mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(getHistName(kPosZ, HistTable)), col.posZ()); + mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(getHistName(kMult, HistTable)), col.mult()); + mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(getHistName(kCent, HistTable)), col.cent()); + mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(getHistName(kMagField, HistTable)), col.magField()); } if constexpr (isFlagSet(mode, modes::Mode::kQa)) { - mHistogramRegistry->fill(HIST(ColQaDir) + HIST(GetHistName(kPosX, HistTable)), col.posX()); - mHistogramRegistry->fill(HIST(ColQaDir) + HIST(GetHistName(kPosY, HistTable)), col.posY()); - mHistogramRegistry->fill(HIST(ColQaDir) + HIST(GetHistName(kPos, HistTable)), std::hypot(col.posX(), col.posY(), col.posZ())); - mHistogramRegistry->fill(HIST(ColQaDir) + HIST(GetHistName(kSphericity, HistTable)), col.sphericity()); - mHistogramRegistry->fill(HIST(ColQaDir) + HIST(GetHistName(kOccupancy, HistTable)), col.trackOccupancyInTimeRange()); - mHistogramRegistry->fill(HIST(ColQaDir) + HIST(GetHistName(kPoszVsMult, HistTable)), col.posZ(), col.mult()); - mHistogramRegistry->fill(HIST(ColQaDir) + HIST(GetHistName(kPoszVsCent, HistTable)), col.posZ(), col.cent()); - mHistogramRegistry->fill(HIST(ColQaDir) + HIST(GetHistName(kCentVsMult, HistTable)), col.cent(), col.mult()); - mHistogramRegistry->fill(HIST(ColQaDir) + HIST(GetHistName(kMultVsSphericity, HistTable)), col.mult(), col.sphericity()); - mHistogramRegistry->fill(HIST(ColQaDir) + HIST(GetHistName(kCentVsSphericity, HistTable)), col.cent(), col.sphericity()); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kPosX, HistTable)), col.posX()); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kPosY, HistTable)), col.posY()); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kPos, HistTable)), std::hypot(col.posX(), col.posY(), col.posZ())); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kSphericity, HistTable)), col.sphericity()); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kOccupancy, HistTable)), col.trackOccupancyInTimeRange()); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kPoszVsMult, HistTable)), col.posZ(), col.mult()); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kPoszVsCent, HistTable)), col.posZ(), col.cent()); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kCentVsMult, HistTable)), col.cent(), col.mult()); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kMultVsSphericity, HistTable)), col.mult(), col.sphericity()); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kCentVsSphericity, HistTable)), col.cent(), col.sphericity()); } } private: - o2::framework::HistogramRegistry* mHistogramRegistry; + o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; }; // namespace femtounitedcolhistmanager }; // namespace colhistmanager }; // namespace o2::analysis::femto diff --git a/PWGCF/Femto/Core/histManager.h b/PWGCF/Femto/Core/histManager.h index 8c22277d642..55630d1bb75 100644 --- a/PWGCF/Femto/Core/histManager.h +++ b/PWGCF/Femto/Core/histManager.h @@ -35,47 +35,43 @@ struct HistInfo { }; template -constexpr o2::framework::HistType GetHistType(EnumType variable, const ArrayType& array) +constexpr o2::framework::HistType getHistType(EnumType variable, const ArrayType& array) { - for (const auto& entry : array) { - if (entry.hist == variable) { - return entry.histtype; - } - } - return o2::framework::kUndefinedHist; + const auto it = std::find_if(array.begin(), array.end(), [=](const auto& entry) { + return entry.hist == variable; + }); + + return it != array.end() ? it->histtype : o2::framework::kUndefinedHist; } template -constexpr std::string_view GetHistName(EnumType variable, const ArrayType& array) +constexpr std::string_view getHistName(EnumType variable, const ArrayType& array) { - for (const auto& entry : array) { - if (entry.hist == variable) { - return entry.histname; - } - } - return ""; // Return an empty string or a default name if not found + auto it = std::find_if(array.begin(), array.end(), [=](const auto& entry) { + return entry.hist == variable; + }); + + return (it != array.end()) ? it->histname : std::string_view{}; } template -constexpr std::string GetHistNamev2(EnumType variable, const ArrayType& array) +std::string getHistNameV2(EnumType variable, const ArrayType& array) { - for (const auto& entry : array) { - if (entry.hist == variable) { - return std::string(entry.histname); - } - } - return std::string(""); // Return an empty string or a default name if not found + auto it = std::find_if(array.begin(), array.end(), [=](const auto& entry) { + return entry.hist == variable; + }); + + return (it != array.end()) ? std::string(it->histname) : std::string{}; } template -constexpr const char* GetHistDesc(EnumType variable, const ArrayType& array) +constexpr const char* getHistDesc(EnumType variable, const ArrayType& array) { - for (const auto& entry : array) { - if (entry.hist == variable) { - return entry.histdesc.data(); - } - } - return ""; // Return an empty string or a default description if not found + auto it = std::find_if(array.begin(), array.end(), [=](const auto& entry) { + return entry.hist == variable; + }); + + return it != array.end() ? it->histdesc.data() : ""; } } // namespace histmanager } // namespace o2::analysis::femto diff --git a/PWGCF/Femto/Core/kinkBuilder.h b/PWGCF/Femto/Core/kinkBuilder.h index f9f3581da3f..22514f77f20 100644 --- a/PWGCF/Femto/Core/kinkBuilder.h +++ b/PWGCF/Femto/Core/kinkBuilder.h @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -242,7 +243,7 @@ class KinkSelection : public BaseSelection 0.f) ? 0.5f * std::log((p + pz) / (p - pz)) : 0.f; - float phi = std::atan2(py, px); + float phi = RecoDecay::constrainAngle(std::atan2(py, px)); return ((pt > mPtMin && pt < mPtMax) && (eta > mEtaMin && eta < mEtaMax) && @@ -371,7 +372,7 @@ class KinkBuilder float pt = std::hypot(px, py); float p = std::sqrt(px * px + py * py + pz * pz); float eta = (p > 0.f) ? 0.5f * std::log((p + pz) / (p - pz)) : 0.f; - float phi = std::atan2(py, px); + float phi = RecoDecay::constrainAngle(std::atan2(py, px)); kinkProducts.producedSigmas(collisionProducts.producedCollision.lastIndex(), kink.mothSign() * pt, diff --git a/PWGCF/Femto/Core/kinkHistManager.h b/PWGCF/Femto/Core/kinkHistManager.h index c32e23ba5dd..879edf32e43 100644 --- a/PWGCF/Femto/Core/kinkHistManager.h +++ b/PWGCF/Femto/Core/kinkHistManager.h @@ -166,7 +166,7 @@ template add(analysisDir + GetHistNamev2(kPt, HistTable), GetHistDesc(kPt, HistTable), GetHistType(kPt, HistTable), {KinkSpecs[kPt]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kEta, HistTable), GetHistDesc(kEta, HistTable), GetHistType(kEta, HistTable), {KinkSpecs[kEta]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kPhi, HistTable), GetHistDesc(kPhi, HistTable), GetHistType(kPhi, HistTable), {KinkSpecs[kPhi]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kMass, HistTable), GetHistDesc(kMass, HistTable), GetHistType(kMass, HistTable), {KinkSpecs[kMass]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kSign, HistTable), GetHistDesc(kSign, HistTable), GetHistType(kSign, HistTable), {KinkSpecs[kSign]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {KinkSpecs[kPt]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {KinkSpecs[kEta]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {KinkSpecs[kPhi]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kMass, HistTable), getHistDesc(kMass, HistTable), getHistType(kMass, HistTable), {KinkSpecs[kMass]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {KinkSpecs[kSign]}); } if constexpr (isFlagSet(mode, modes::Mode::kQa)) { std::string qaDir = std::string(kinkPrefix) + std::string(QaDir); // Basic kinematic histograms - mHistogramRegistry->add(qaDir + GetHistNamev2(kPt, HistTable), GetHistDesc(kPt, HistTable), GetHistType(kPt, HistTable), {KinkSpecs[kPt]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kEta, HistTable), GetHistDesc(kEta, HistTable), GetHistType(kEta, HistTable), {KinkSpecs[kEta]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPhi, HistTable), GetHistDesc(kPhi, HistTable), GetHistType(kPhi, HistTable), {KinkSpecs[kPhi]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kMass, HistTable), GetHistDesc(kMass, HistTable), GetHistType(kMass, HistTable), {KinkSpecs[kMass]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kSign, HistTable), GetHistDesc(kSign, HistTable), GetHistType(kSign, HistTable), {KinkSpecs[kSign]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {KinkSpecs[kPt]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {KinkSpecs[kEta]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {KinkSpecs[kPhi]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kMass, HistTable), getHistDesc(kMass, HistTable), getHistType(kMass, HistTable), {KinkSpecs[kMass]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {KinkSpecs[kSign]}); // Kink-specific QA histograms - mHistogramRegistry->add(qaDir + GetHistNamev2(kKinkAngle, HistTable), GetHistDesc(kKinkAngle, HistTable), GetHistType(kKinkAngle, HistTable), {KinkSpecs[kKinkAngle]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kDcaMothToPV, HistTable), GetHistDesc(kDcaMothToPV, HistTable), GetHistType(kDcaMothToPV, HistTable), {KinkSpecs[kDcaMothToPV]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kDcaDaugToPV, HistTable), GetHistDesc(kDcaDaugToPV, HistTable), GetHistType(kDcaDaugToPV, HistTable), {KinkSpecs[kDcaDaugToPV]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kDecayVtxX, HistTable), GetHistDesc(kDecayVtxX, HistTable), GetHistType(kDecayVtxX, HistTable), {KinkSpecs[kDecayVtxX]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kDecayVtxY, HistTable), GetHistDesc(kDecayVtxY, HistTable), GetHistType(kDecayVtxY, HistTable), {KinkSpecs[kDecayVtxY]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kDecayVtxZ, HistTable), GetHistDesc(kDecayVtxZ, HistTable), GetHistType(kDecayVtxZ, HistTable), {KinkSpecs[kDecayVtxZ]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kDecayVtx, HistTable), GetHistDesc(kDecayVtx, HistTable), GetHistType(kDecayVtx, HistTable), {KinkSpecs[kDecayVtx]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kTransRadius, HistTable), GetHistDesc(kTransRadius, HistTable), GetHistType(kTransRadius, HistTable), {KinkSpecs[kTransRadius]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kKinkAngle, HistTable), getHistDesc(kKinkAngle, HistTable), getHistType(kKinkAngle, HistTable), {KinkSpecs[kKinkAngle]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDcaMothToPV, HistTable), getHistDesc(kDcaMothToPV, HistTable), getHistType(kDcaMothToPV, HistTable), {KinkSpecs[kDcaMothToPV]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDcaDaugToPV, HistTable), getHistDesc(kDcaDaugToPV, HistTable), getHistType(kDcaDaugToPV, HistTable), {KinkSpecs[kDcaDaugToPV]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxX, HistTable), getHistDesc(kDecayVtxX, HistTable), getHistType(kDecayVtxX, HistTable), {KinkSpecs[kDecayVtxX]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxY, HistTable), getHistDesc(kDecayVtxY, HistTable), getHistType(kDecayVtxY, HistTable), {KinkSpecs[kDecayVtxY]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxZ, HistTable), getHistDesc(kDecayVtxZ, HistTable), getHistType(kDecayVtxZ, HistTable), {KinkSpecs[kDecayVtxZ]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtx, HistTable), getHistDesc(kDecayVtx, HistTable), getHistType(kDecayVtx, HistTable), {KinkSpecs[kDecayVtx]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTransRadius, HistTable), getHistDesc(kTransRadius, HistTable), getHistType(kTransRadius, HistTable), {KinkSpecs[kTransRadius]}); // 2D QA histograms - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsEta, HistTable), GetHistDesc(kPtVsEta, HistTable), GetHistType(kPtVsEta, HistTable), {KinkSpecs[kPtVsEta]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsPhi, HistTable), GetHistDesc(kPtVsPhi, HistTable), GetHistType(kPtVsPhi, HistTable), {KinkSpecs[kPtVsPhi]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPhiVsEta, HistTable), GetHistDesc(kPhiVsEta, HistTable), GetHistType(kPhiVsEta, HistTable), {KinkSpecs[kPhiVsEta]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsKinkAngle, HistTable), GetHistDesc(kPtVsKinkAngle, HistTable), GetHistType(kPtVsKinkAngle, HistTable), {KinkSpecs[kPtVsKinkAngle]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsDecayRadius, HistTable), GetHistDesc(kPtVsDecayRadius, HistTable), GetHistType(kPtVsDecayRadius, HistTable), {KinkSpecs[kPtVsDecayRadius]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsEta, HistTable), getHistDesc(kPtVsEta, HistTable), getHistType(kPtVsEta, HistTable), {KinkSpecs[kPtVsEta]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPhi, HistTable), getHistDesc(kPtVsPhi, HistTable), getHistType(kPtVsPhi, HistTable), {KinkSpecs[kPtVsPhi]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPhiVsEta, HistTable), getHistDesc(kPhiVsEta, HistTable), getHistType(kPhiVsEta, HistTable), {KinkSpecs[kPhiVsEta]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsKinkAngle, HistTable), getHistDesc(kPtVsKinkAngle, HistTable), getHistType(kPtVsKinkAngle, HistTable), {KinkSpecs[kPtVsKinkAngle]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsDecayRadius, HistTable), getHistDesc(kPtVsDecayRadius, HistTable), getHistType(kPtVsDecayRadius, HistTable), {KinkSpecs[kPtVsDecayRadius]}); } } @@ -223,48 +223,48 @@ class KinkHistManager void fill(T const& kinkcandidate) { if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(GetHistName(kPt, HistTable)), kinkcandidate.pt()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(GetHistName(kEta, HistTable)), kinkcandidate.eta()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(GetHistName(kPhi, HistTable)), kinkcandidate.phi()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(GetHistName(kMass, HistTable)), kinkcandidate.mass()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(getHistName(kPt, HistTable)), kinkcandidate.pt()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(getHistName(kEta, HistTable)), kinkcandidate.eta()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(getHistName(kPhi, HistTable)), kinkcandidate.phi()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(getHistName(kMass, HistTable)), kinkcandidate.mass()); if constexpr (isEqual(kink, modes::Kink::kSigma)) { - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(GetHistName(kSign, HistTable)), kinkcandidate.sign()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), kinkcandidate.sign()); } } if constexpr (isFlagSet(mode, modes::Mode::kQa)) { // Basic kinematic histograms - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kPt, HistTable)), kinkcandidate.pt()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kEta, HistTable)), kinkcandidate.eta()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kPhi, HistTable)), kinkcandidate.phi()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kMass, HistTable)), kinkcandidate.mass()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kPt, HistTable)), kinkcandidate.pt()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kEta, HistTable)), kinkcandidate.eta()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kPhi, HistTable)), kinkcandidate.phi()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kMass, HistTable)), kinkcandidate.mass()); if constexpr (isEqual(kink, modes::Kink::kSigma)) { - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kSign, HistTable)), kinkcandidate.sign()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kSign, HistTable)), kinkcandidate.sign()); } // Kink-specific QA histograms - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kKinkAngle, HistTable)), kinkcandidate.kinkAngle()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kDcaMothToPV, HistTable)), kinkcandidate.dcaMothToPV()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kDcaDaugToPV, HistTable)), kinkcandidate.dcaDaugToPV()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kDecayVtxX, HistTable)), kinkcandidate.decayVtxX()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kDecayVtxY, HistTable)), kinkcandidate.decayVtxY()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kDecayVtxZ, HistTable)), kinkcandidate.decayVtxZ()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kKinkAngle, HistTable)), kinkcandidate.kinkAngle()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDcaMothToPV, HistTable)), kinkcandidate.dcaMothToPV()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDcaDaugToPV, HistTable)), kinkcandidate.dcaDaugToPV()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxX, HistTable)), kinkcandidate.decayVtxX()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxY, HistTable)), kinkcandidate.decayVtxY()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxZ, HistTable)), kinkcandidate.decayVtxZ()); // Calculate decay distance from PV float decayDistance = std::sqrt(kinkcandidate.decayVtxX() * kinkcandidate.decayVtxX() + kinkcandidate.decayVtxY() * kinkcandidate.decayVtxY() + kinkcandidate.decayVtxZ() * kinkcandidate.decayVtxZ()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kDecayVtx, HistTable)), decayDistance); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kTransRadius, HistTable)), kinkcandidate.transRadius()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDecayVtx, HistTable)), decayDistance); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kTransRadius, HistTable)), kinkcandidate.transRadius()); // 2D QA histograms - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kPtVsEta, HistTable)), kinkcandidate.pt(), kinkcandidate.eta()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kPtVsPhi, HistTable)), kinkcandidate.pt(), kinkcandidate.phi()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kPhiVsEta, HistTable)), kinkcandidate.phi(), kinkcandidate.eta()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kPtVsKinkAngle, HistTable)), kinkcandidate.pt(), kinkcandidate.kinkAngle()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(GetHistName(kPtVsDecayRadius, HistTable)), kinkcandidate.pt(), kinkcandidate.transRadius()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kPtVsEta, HistTable)), kinkcandidate.pt(), kinkcandidate.eta()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kPtVsPhi, HistTable)), kinkcandidate.pt(), kinkcandidate.phi()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kPhiVsEta, HistTable)), kinkcandidate.phi(), kinkcandidate.eta()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kPtVsKinkAngle, HistTable)), kinkcandidate.pt(), kinkcandidate.kinkAngle()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kPtVsDecayRadius, HistTable)), kinkcandidate.pt(), kinkcandidate.transRadius()); } } @@ -272,15 +272,15 @@ class KinkHistManager /// \param kinkcandidate Kink candidate to fill histograms for /// \param tracks Track table for daughter access template - void fill(T1 const& kinkcandidate, T2 const& /*tracks*/) + void fill(T1 const& kinkcandidate, T2 const& tracks) { auto chaDaughter = kinkcandidate.template chaDau_as(); - mChaDauManager.fill(chaDaughter); + mChaDauManager.fill(chaDaughter, tracks); fill(kinkcandidate); } private: - o2::framework::HistogramRegistry* mHistogramRegistry; + o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; trackhistmanager::TrackHistManager mChaDauManager; }; }; // namespace kinkhistmanager diff --git a/PWGCF/Femto/Core/pairBuilder.h b/PWGCF/Femto/Core/pairBuilder.h index 8d2e9af0641..51a361a75ec 100644 --- a/PWGCF/Femto/Core/pairBuilder.h +++ b/PWGCF/Femto/Core/pairBuilder.h @@ -30,7 +30,12 @@ #include "PWGCF/Femto/DataModel/FemtoTables.h" #include "Framework/HistogramRegistry.h" +#include "Framework/HistogramSpec.h" +#include "fairlogger/Logger.h" + +#include +#include #include #include #include @@ -52,6 +57,7 @@ class PairTrackTrackBuilder { public: PairTrackTrackBuilder() = default; + ~PairTrackTrackBuilder() = default; template - void processSameEvent(T1 const& col, T2& /*trackTable*/, T3& partition1, T4& partition2, T5& cache) + void processSameEvent(T1 const& col, T2& trackTable, T3& partition1, T4& partition2, T5& cache) { if (mSameSpecies) { - auto trackSlice1 = partition1->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto trackSlice1 = partition1->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); if (trackSlice1.size() == 0) { return; } mColHistManager.fill(col); mCprSe.setMagField(col.magField()); - pairprocesshelpers::processSameEvent(trackSlice1, mTrackHistManager1, mPairHistManagerSe, mCprSe, mRng, mMixIdenticalParticles); + pairprocesshelpers::processSameEvent(trackSlice1, trackTable, mTrackHistManager1, mPairHistManagerSe, mCprSe, mRng, mMixIdenticalParticles); } else { - auto trackSlice1 = partition1->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); - auto trackSlice2 = partition2->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto trackSlice1 = partition1->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto trackSlice2 = partition2->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); if (trackSlice1.size() == 0 || trackSlice2.size() == 0) { return; } mColHistManager.fill(col); mCprSe.setMagField(col.magField()); - pairprocesshelpers::processSameEvent(trackSlice1, trackSlice2, mTrackHistManager1, mTrackHistManager2, mPairHistManagerSe, mCprSe, mPc); + pairprocesshelpers::processSameEvent(trackSlice1, trackSlice2, trackTable, mTrackHistManager1, mTrackHistManager2, mPairHistManagerSe, mCprSe, mPc); } } template - void processMixedEvent(T1 const& cols, T2& /*trackTable*/, T3& partition1, T4& partition2, T5& cache, T6& binsVtxMult, T7& binsVtxCent, T8& binsVtxMultCent) + void processMixedEvent(T1 const& cols, T2& trackTable, T3& partition1, T4& partition2, T5& cache, T6& binsVtxMult, T7& binsVtxCent, T8& binsVtxMultCent) { if (mSameSpecies) { switch (mMixingPolicy) { case static_cast(pairhistmanager::kVtxMult): - pairprocesshelpers::processMixedEvent(cols, partition1, cache, binsVtxMult, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + pairprocesshelpers::processMixedEvent(cols, partition1, trackTable, cache, binsVtxMult, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); break; case static_cast(pairhistmanager::kVtxCent): - pairprocesshelpers::processMixedEvent(cols, partition1, cache, binsVtxCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + pairprocesshelpers::processMixedEvent(cols, partition1, trackTable, cache, binsVtxCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); break; case static_cast(pairhistmanager::kVtxMultCent): - pairprocesshelpers::processMixedEvent(cols, partition1, cache, binsVtxMultCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + pairprocesshelpers::processMixedEvent(cols, partition1, trackTable, cache, binsVtxMultCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); break; default: LOG(fatal) << "Invalid binning policiy specifed. Breaking..."; @@ -165,13 +171,13 @@ class PairTrackTrackBuilder } else { switch (mMixingPolicy) { case static_cast(pairhistmanager::kVtxMult): - pairprocesshelpers::processMixedEvent(cols, partition1, partition2, cache, binsVtxMult, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + pairprocesshelpers::processMixedEvent(cols, partition1, partition2, trackTable, cache, binsVtxMult, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); break; case static_cast(pairhistmanager::kVtxCent): - pairprocesshelpers::processMixedEvent(cols, partition1, partition2, cache, binsVtxCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + pairprocesshelpers::processMixedEvent(cols, partition1, partition2, trackTable, cache, binsVtxCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); break; case static_cast(pairhistmanager::kVtxMultCent): - pairprocesshelpers::processMixedEvent(cols, partition1, partition2, cache, binsVtxMultCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + pairprocesshelpers::processMixedEvent(cols, partition1, partition2, trackTable, cache, binsVtxMultCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); break; default: LOG(fatal) << "Invalid binning policiy specifed. Breaking..."; @@ -195,6 +201,174 @@ class PairTrackTrackBuilder bool mMixIdenticalParticles = false; }; +template < + const char* prefixV01, + const char* prefixPosDau1, + const char* prefixNegDau1, + const char* prefixV02, + const char* prefixPosDau2, + const char* prefixNegDau2, + const char* prefixSe, + const char* prefixMe, + const char* prefixCprPosSe, + const char* prefixCprNegSe, + const char* prefixCprPosMe, + const char* prefixCprNegMe, + modes::V0 v0Type1, + modes::V0 v0Type2, + modes::Mode mode> +class PairV0V0Builder +{ + public: + PairV0V0Builder() = default; + ~PairV0V0Builder() = default; + + template + void init(o2::framework::HistogramRegistry* registry, + T1& confV0Selection1, + T2& confV0Selection2, + T3& confCpr, + T4& confMixing, + std::map>& colHistSpec, + std::map>& V0HistSpec1, + std::map>& V0HistSpec2, + std::map>& PosDauHistSpec, + std::map>& NegDauHistSpec, + std::map>& pairHistSpec, + std::map>& cprHistSpec) + { + + // check if correlate the same tracks or not + mSameSpecies = confMixing.sameSpecies.value; + + mColHistManager.init(registry, colHistSpec); + mPairHistManagerSe.init(registry, pairHistSpec); + mPairHistManagerMe.init(registry, pairHistSpec); + + if (mSameSpecies) { + mV0HistManager1.init(registry, V0HistSpec1, PosDauHistSpec, NegDauHistSpec); + + mPairHistManagerSe.setMass(confV0Selection1.pdgCode.value, confV0Selection1.pdgCode.value); + mPairHistManagerSe.setCharge(1, 1); + mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confCpr.on.value); + + mPairHistManagerMe.setMass(confV0Selection1.pdgCode.value, confV0Selection1.pdgCode.value); + mPairHistManagerMe.setCharge(1, 1); + mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confCpr.on.value); + } else { + mV0HistManager1.init(registry, V0HistSpec1, PosDauHistSpec, NegDauHistSpec); + mV0HistManager2.init(registry, V0HistSpec2, PosDauHistSpec, NegDauHistSpec); + + mPairHistManagerSe.setMass(confV0Selection1.pdgCode.value, confV0Selection2.pdgCode.value); + mPairHistManagerSe.setCharge(1, 1); + mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confCpr.on.value); + + mPairHistManagerMe.setMass(confV0Selection1.pdgCode.value, confV0Selection2.pdgCode.value); + mPairHistManagerMe.setCharge(1, 1); + mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confCpr.on.value); + } + + // setup mixing + mMixingPolicy = static_cast(confMixing.policy.value); + mMixingDepth = confMixing.depth.value; + + // setup rng if necessary + if (confMixing.seed.value >= 0) { + uint64_t randomSeed = 0; + mMixIdenticalParticles = true; + if (confMixing.seed.value == 0) { + randomSeed = static_cast(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + } else { + randomSeed = static_cast(confMixing.seed.value); + } + mRng = std::mt19937(randomSeed); + } + } + + template + void processSameEvent(T1 const& col, T2& trackTable, T3& /*lambdaTable*/, T4& partition1, T5& partition2, T6& cache) + { + if (mSameSpecies) { + auto v0Slice1 = partition1->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + if (v0Slice1.size() == 0) { + return; + } + mColHistManager.fill(col); + mCprSe.setMagField(col.magField()); + pairprocesshelpers::processSameEvent(v0Slice1, trackTable, mV0HistManager1, mPairHistManagerSe, mCprSe, mRng, mMixIdenticalParticles); + } else { + auto v0Slice1 = partition1->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto v0Slice2 = partition2->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + if (v0Slice1.size() == 0 || v0Slice2.size() == 0) { + return; + } + mColHistManager.fill(col); + mCprSe.setMagField(col.magField()); + pairprocesshelpers::processSameEvent(v0Slice1, v0Slice2, trackTable, mV0HistManager1, mV0HistManager2, mPairHistManagerSe, mCprSe, mPc); + } + } + + template + void processMixedEvent(T1 const& cols, T2& trackTable, T3& partition1, T4& partition2, T5& cache, T6& binsVtxMult, T7& binsVtxCent, T8& binsVtxMultCent) + { + + if (mSameSpecies) { + switch (mMixingPolicy) { + case static_cast(pairhistmanager::kVtxMult): + pairprocesshelpers::processMixedEvent(cols, partition1, trackTable, cache, binsVtxMult, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + break; + case static_cast(pairhistmanager::kVtxCent): + pairprocesshelpers::processMixedEvent(cols, partition1, trackTable, cache, binsVtxCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + break; + case static_cast(pairhistmanager::kVtxMultCent): + pairprocesshelpers::processMixedEvent(cols, partition1, trackTable, cache, binsVtxMultCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + break; + default: + LOG(fatal) << "Invalid binning policiy specifed. Breaking..."; + } + } else { + switch (mMixingPolicy) { + case static_cast(pairhistmanager::kVtxMult): + pairprocesshelpers::processMixedEvent(cols, partition1, partition2, trackTable, cache, binsVtxMult, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + break; + case static_cast(pairhistmanager::kVtxCent): + pairprocesshelpers::processMixedEvent(cols, partition1, partition2, trackTable, cache, binsVtxCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + break; + case static_cast(pairhistmanager::kVtxMultCent): + pairprocesshelpers::processMixedEvent(cols, partition1, partition2, trackTable, cache, binsVtxMultCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + break; + default: + LOG(fatal) << "Invalid binning policiy specifed. Breaking..."; + } + } + } + + private: + colhistmanager::CollisionHistManager mColHistManager; + v0histmanager::V0HistManager mV0HistManager1; + v0histmanager::V0HistManager mV0HistManager2; + pairhistmanager::PairHistManager mPairHistManagerSe; + pairhistmanager::PairHistManager mPairHistManagerMe; + closepairrejection::ClosePairRejectionV0V0 mCprSe; + closepairrejection::ClosePairRejectionV0V0 mCprMe; + paircleaner::V0V0PairCleaner mPc; + std::mt19937 mRng; + pairhistmanager::MixingPoliciy mMixingPolicy = pairhistmanager::MixingPoliciy::kVtxMult; + bool mSameSpecies = false; + int mMixingDepth = 5; + bool mMixIdenticalParticles = false; +}; + template < const char* prefixTrack, const char* prefixV0, @@ -210,6 +384,7 @@ class PairTrackV0Builder { public: PairTrackV0Builder() = default; + ~PairTrackV0Builder() = default; template void processSameEvent(T1 const& col, T2& trackTable, T3& trackPartition, T4& /*v0table*/, T5& v0Partition, T6& cache) { - auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); - auto v0Slice = v0Partition->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto v0Slice = v0Partition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); if (trackSlice.size() == 0 || v0Slice.size() == 0) { return; } @@ -314,6 +489,7 @@ class PairTrackTwoTrackResonanceBuilder { public: PairTrackTwoTrackResonanceBuilder() = default; + ~PairTrackTwoTrackResonanceBuilder() = default; template void processSameEvent(T1 const& col, T2& trackTable, T3& trackPartition, T4& /*resonanceTable*/, T5& resonancePartition, T6& cache) { - auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); - auto v0Slice = resonancePartition->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto v0Slice = resonancePartition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); if (trackSlice.size() == 0 || v0Slice.size() == 0) { return; } @@ -417,6 +593,7 @@ class PairTrackKinkBuilder { public: PairTrackKinkBuilder() = default; + ~PairTrackKinkBuilder() = default; template void processSameEvent(T1 const& col, T2& trackTable, T3& trackPartition, T4& /*kinktable*/, T5& kinkPartition, T6& cache) { - auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); - auto kinkSlice = kinkPartition->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto kinkSlice = kinkPartition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); if (trackSlice.size() == 0 || kinkSlice.size() == 0) { return; } @@ -520,6 +697,7 @@ class PairTrackCascadeBuilder { public: PairTrackCascadeBuilder() = default; + ~PairTrackCascadeBuilder() = default; template void processSameEvent(T1 const& col, T2& trackTable, T3& trackPartition, T4& /*cascadeTable*/, T5& v0Partition, T6& cache) { - auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); - auto v0Slice = v0Partition->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto v0Slice = v0Partition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); if (trackSlice.size() == 0 || v0Slice.size() == 0) { return; } diff --git a/PWGCF/Femto/Core/pairCleaner.h b/PWGCF/Femto/Core/pairCleaner.h index 7a72b187d6a..4079489d93e 100644 --- a/PWGCF/Femto/Core/pairCleaner.h +++ b/PWGCF/Femto/Core/pairCleaner.h @@ -29,7 +29,7 @@ class BasePairCleaner protected: template - bool isCleanTrackPair(const T1& track1, const T2& track2) const + bool isCleanTrackPair(T1 const& track1, T2 const& track2) const { return track1.globalIndex() != track2.globalIndex(); }; @@ -39,19 +39,34 @@ class TrackTrackPairCleaner : public BasePairCleaner { public: TrackTrackPairCleaner() = default; - template - bool isCleanPair(const T& track1, const T& track2) const + template + bool isCleanPair(T1 const& track1, T2 const& track2, T3 const& /*trackTable*/) const { return this->isCleanTrackPair(track1, track2); } }; +class V0V0PairCleaner : public BasePairCleaner +{ + public: + V0V0PairCleaner() = default; + template + bool isCleanPair(const T1& v01, const T2& v02, const T3& /*tracks*/) const + { + auto posDaughter1 = v01.template posDau_as(); + auto negDaughter1 = v01.template negDau_as(); + auto posDaughter2 = v02.template posDau_as(); + auto negDaughter2 = v02.template negDau_as(); + return this->isCleanTrackPair(posDaughter1, posDaughter2) && this->isCleanTrackPair(negDaughter1, negDaughter2); + } +}; + class TrackV0PairCleaner : public BasePairCleaner // also works for particles decaying into a positive and negative daughter, like resonances { public: TrackV0PairCleaner() = default; template - bool isCleanPair(const T1& track, const T2& v0, const T3& /*trackTable */) const + bool isCleanPair(const T1& track, const T2& v0, const T3& /*trackTable*/) const { auto posDaughter = v0.template posDau_as(); auto negDaughter = v0.template negDau_as(); @@ -64,7 +79,7 @@ class TrackKinkPairCleaner : public BasePairCleaner public: TrackKinkPairCleaner() = default; template - bool isCleanPair(const T1& track, const T2& kink, const T3& /*trackTable */) const + bool isCleanPair(const T1& track, const T2& kink, const T3& /*trackTable*/) const { auto chaDaughter = kink.template chaDau_as(); return this->isCleanTrackPair(chaDaughter, track); @@ -76,7 +91,7 @@ class TrackCascadePairCleaner : public BasePairCleaner public: TrackCascadePairCleaner() = default; template - bool isCleanPair(const T1& track, const T2& cascade, const T3& /*trackTable */) const + bool isCleanPair(const T1& track, const T2& cascade, const T3& /*trackTable*/) const { auto bachelor = cascade.template bachelor_as(); auto posDaughter = cascade.template posDau_as(); diff --git a/PWGCF/Femto/Core/pairHistManager.h b/PWGCF/Femto/Core/pairHistManager.h index 0e0862499f4..8a4f58b44b1 100644 --- a/PWGCF/Femto/Core/pairHistManager.h +++ b/PWGCF/Femto/Core/pairHistManager.h @@ -16,27 +16,22 @@ #ifndef PWGCF_FEMTO_CORE_PAIRHISTMANAGER_H_ #define PWGCF_FEMTO_CORE_PAIRHISTMANAGER_H_ -#include "PWGCF/Femto/Core/closePairRejection.h" -#include "PWGCF/Femto/Core/collisionHistManager.h" #include "PWGCF/Femto/Core/femtoUtils.h" #include "PWGCF/Femto/Core/histManager.h" #include "PWGCF/Femto/Core/modes.h" -#include "PWGCF/Femto/Core/pairCleaner.h" -#include "PWGCF/Femto/Core/trackHistManager.h" -#include "PWGCF/Femto/DataModel/FemtoTables.h" #include "Framework/Configurable.h" -#include "Framework/GroupedCombinations.h" #include "Framework/HistogramRegistry.h" +#include "Framework/HistogramSpec.h" -#include "Math/Boost.h" -#include "Math/Vector4D.h" -#include "TMath.h" +#include +#include #include +#include #include -#include #include +#include #include namespace o2::analysis::femto @@ -122,6 +117,9 @@ constexpr char PrefixTrackTrackMe[] = "TrackTrack/ME/"; constexpr char PrefixTrackV0Se[] = "TrackV0/SE/"; constexpr char PrefixTrackV0Me[] = "TrackV0/ME/"; +constexpr char PrefixV0V0Se[] = "V0V0/SE/"; +constexpr char PrefixV0V0Me[] = "V0V0/ME/"; + constexpr char PrefixTrackResonanceSe[] = "TrackResonance/SE/"; constexpr char PrefixTrackResonanceMe[] = "TrackResonance/ME/"; @@ -150,15 +148,15 @@ class PairHistManager if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { std::string analysisDir = std::string(prefix) + std::string(AnalysisDir); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kKstar, HistTable), GetHistDesc(kKstar, HistTable), GetHistType(kKstar, HistTable), {Specs[kKstar]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kMt, HistTable), GetHistDesc(kMt, HistTable), GetHistType(kMt, HistTable), {Specs[kMt]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kPt1VsPt2, HistTable), GetHistDesc(kPt1VsPt2, HistTable), GetHistType(kPt1VsPt2, HistTable), {Specs[kPt1VsPt2]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kPt1VsKstar, HistTable), GetHistDesc(kPt1VsKstar, HistTable), GetHistType(kPt1VsKstar, HistTable), {Specs[kPt1VsKstar]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kPt2VsKstar, HistTable), GetHistDesc(kPt2VsKstar, HistTable), GetHistType(kPt2VsKstar, HistTable), {Specs[kPt2VsKstar]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kPt1VsKt, HistTable), GetHistDesc(kPt1VsKt, HistTable), GetHistType(kPt1VsKt, HistTable), {Specs[kPt1VsKt]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kPt2VsKt, HistTable), GetHistDesc(kPt2VsKt, HistTable), GetHistType(kPt2VsKt, HistTable), {Specs[kPt2VsKt]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kPt1VsMt, HistTable), GetHistDesc(kPt1VsMt, HistTable), GetHistType(kPt1VsMt, HistTable), {Specs[kPt1VsMt]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kPt2VsMt, HistTable), GetHistDesc(kPt2VsMt, HistTable), GetHistType(kPt2VsMt, HistTable), {Specs[kPt2VsMt]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstar, HistTable), getHistDesc(kKstar, HistTable), getHistType(kKstar, HistTable), {Specs[kKstar]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kMt, HistTable), getHistDesc(kMt, HistTable), getHistType(kMt, HistTable), {Specs[kMt]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsPt2, HistTable), getHistDesc(kPt1VsPt2, HistTable), getHistType(kPt1VsPt2, HistTable), {Specs[kPt1VsPt2]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsKstar, HistTable), getHistDesc(kPt1VsKstar, HistTable), getHistType(kPt1VsKstar, HistTable), {Specs[kPt1VsKstar]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt2VsKstar, HistTable), getHistDesc(kPt2VsKstar, HistTable), getHistType(kPt2VsKstar, HistTable), {Specs[kPt2VsKstar]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsKt, HistTable), getHistDesc(kPt1VsKt, HistTable), getHistType(kPt1VsKt, HistTable), {Specs[kPt1VsKt]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt2VsKt, HistTable), getHistDesc(kPt2VsKt, HistTable), getHistType(kPt2VsKt, HistTable), {Specs[kPt2VsKt]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsMt, HistTable), getHistDesc(kPt1VsMt, HistTable), getHistType(kPt1VsMt, HistTable), {Specs[kPt1VsMt]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt2VsMt, HistTable), getHistDesc(kPt2VsMt, HistTable), getHistType(kPt2VsMt, HistTable), {Specs[kPt2VsMt]}); } // if constexpr (isFlagSet(mode, modes::Mode::kQA)) { @@ -204,24 +202,24 @@ class PairHistManager void fill() { if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kKstar, HistTable)), mKstar); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kMt, HistTable)), mMt); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kPt1VsPt2, HistTable)), mParticle1.Pt(), mParticle2.Pt()); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kPt1VsKstar, HistTable)), mParticle1.Pt(), mKstar); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kPt1VsMt, HistTable)), mParticle1.Pt(), mMt); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kPt1VsKt, HistTable)), mParticle1.Pt(), mKt); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kPt2VsKstar, HistTable)), mParticle2.Pt(), mKstar); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kPt2VsMt, HistTable)), mParticle2.Pt(), mMt); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kPt2VsKt, HistTable)), mParticle2.Pt(), mKt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstar, HistTable)), mKstar); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kMt, HistTable)), mMt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsPt2, HistTable)), mParticle1.Pt(), mParticle2.Pt()); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsKstar, HistTable)), mParticle1.Pt(), mKstar); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsMt, HistTable)), mParticle1.Pt(), mMt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsKt, HistTable)), mParticle1.Pt(), mKt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt2VsKstar, HistTable)), mParticle2.Pt(), mKstar); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt2VsMt, HistTable)), mParticle2.Pt(), mMt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt2VsKt, HistTable)), mParticle2.Pt(), mKt); } // if constexpr (isFlagSet(mode, modes::Mode::kQA)) { - // mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsDcaz, HistTable)), track.pt(), track.dcaZ()); + // mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsDcaz, HistTable)), track.pt(), track.dcaZ()); // } } private: - o2::framework::HistogramRegistry* mHistogramRegistry; + o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; float mMass1 = 0.f; float mMass2 = 0.f; float mAbsCharge1 = 1.f; diff --git a/PWGCF/Femto/Core/pairProcessHelpers.h b/PWGCF/Femto/Core/pairProcessHelpers.h index f2f1debbd2a..2d4a6f38bdd 100644 --- a/PWGCF/Femto/Core/pairProcessHelpers.h +++ b/PWGCF/Femto/Core/pairProcessHelpers.h @@ -18,6 +18,7 @@ #include "PWGCF/Femto/DataModel/FemtoTables.h" +#include "CommonConstants/MathConstants.h" #include "Framework/ASoAHelpers.h" #include @@ -27,37 +28,35 @@ namespace o2::analysis::femto namespace pairprocesshelpers { -// process same event for identical tracks +// process same event for identical particles template -void processSameEvent(const T1& SliceParticle, - T2& ParticleHistManager, - T3& PairHistManager, - T4& CprManager, - T5& rng, + typename T5, + typename T6> +void processSameEvent(T1 const& SliceParticle, + T2 const& TrackTable, + T3& ParticleHistManager, + T4& PairHistManager, + T5& CprManager, + T6& rng, bool randomize) { // Fill single particle histograms for (auto const& part : SliceParticle) { - ParticleHistManager.fill(part); + ParticleHistManager.fill(part, TrackTable); } - std::uniform_real_distribution dist(0.f, 1.f); - for (auto const& [p1, p2] : o2::soa::combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(SliceParticle, SliceParticle))) { - // Close pair rejection if (CprManager.isActivated()) { - CprManager.setPair(p1, p2); + CprManager.setPair(p1, p2, TrackTable); if (CprManager.isClosePair()) { continue; } } CprManager.fill(); - // Randomize pair order if enabled float threshold = 0.5f; bool swapPair = randomize ? (dist(rng) > threshold) : false; @@ -70,50 +69,7 @@ void processSameEvent(const T1& SliceParticle, } } -// process same event for non-identical tracks -template -void processSameEvent(T1& SliceParticle1, - T2& SliceParticle2, - T3& ParticleHistManager1, - T4& ParticleHistManager2, - T5& PairHistManager, - T6& CprManager, - T7& PcManager) -{ - // Fill single particle histograms - for (auto const& part : SliceParticle1) { - ParticleHistManager1.fill(part); - } - - for (auto const& part : SliceParticle2) { - ParticleHistManager2.fill(part); - } - - for (auto const& [p1, p2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(SliceParticle1, SliceParticle2))) { - // pair cleaning - if (!PcManager.isCleanPair(p1, p2)) { - continue; - } - // Close pair rejection - if (CprManager.isActivated()) { - CprManager.setPair(p1, p2); - if (CprManager.isClosePair()) { - continue; - } - } - CprManager.fill(); - PairHistManager.setPair(p1, p2); - PairHistManager.fill(); - } -} - -// process same event for tracks and particles decaying into tracks +// process same event for non-identical particles template -void processSameEvent(T1& SliceParticle1, - T2& SliceParticle2, - T3& TrackTable, +void processSameEvent(T1 const& SliceParticle1, + T2 const& SliceParticle2, + T3 const& TrackTable, T4& ParticleHistManager1, T5& ParticleHistManager2, T6& PairHistManager, @@ -133,13 +89,11 @@ void processSameEvent(T1& SliceParticle1, { // Fill single particle histograms for (auto const& part : SliceParticle1) { - ParticleHistManager1.fill(part); + ParticleHistManager1.fill(part, TrackTable); } - for (auto const& part : SliceParticle2) { ParticleHistManager2.fill(part, TrackTable); } - for (auto const& [p1, p2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(SliceParticle1, SliceParticle2))) { // pair cleaning if (!PcManager.isCleanPair(p1, p2, TrackTable)) { @@ -158,54 +112,52 @@ void processSameEvent(T1& SliceParticle1, } } -// process mixed event identical tracks -template -void processMixedEvent(T1& Collisions, - T2& Partition, - T3& cache, - T4& policy, - T5& depth, - T6& PairHistManager, - T7& CprManager, - T8& PcManager) -{ - for (auto const& [collision1, collision2] : o2::soa::selfCombinations(policy, depth, -1, Collisions, Collisions)) { - if (!(std::fabs(collision1.magField() - collision2.magField()) < o2::constants::math::Epsilon)) { - continue; - } - CprManager.setMagField(collision1.magField()); - auto sliceParticle1 = Partition->sliceByCached(o2::aod::femtobase::stored::fColId, collision1.globalIndex(), cache); - auto sliceParticle2 = Partition->sliceByCached(o2::aod::femtobase::stored::fColId, collision2.globalIndex(), cache); - if (sliceParticle1.size() == 0 || sliceParticle2.size() == 0) { - continue; - } - for (auto const& [p1, p2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(sliceParticle1, sliceParticle2))) { - // pair cleaning - if (!PcManager.isCleanPair(p1, p2)) { - continue; - } - // Close pair rejection - if (CprManager.isActivated()) { - CprManager.setPair(p1, p2); - if (CprManager.isClosePair()) { - continue; - } - } - CprManager.fill(); - PairHistManager.setPair(p1, p2); - PairHistManager.fill(); - } - } -} +// process same event for tracks and particles decaying into tracks +// template +// void processSameEvent(T1& SliceParticle1, +// T2& SliceParticle2, +// T3& TrackTable, +// T4& ParticleHistManager1, +// T5& ParticleHistManager2, +// T6& PairHistManager, +// T7& CprManager, +// T8& PcManager) +// { +// // Fill single particle histograms +// for (auto const& part : SliceParticle1) { +// ParticleHistManager1.fill(part); +// } +// +// for (auto const& part : SliceParticle2) { +// ParticleHistManager2.fill(part, TrackTable); +// } +// +// for (auto const& [p1, p2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(SliceParticle1, SliceParticle2))) { +// // pair cleaning +// if (!PcManager.isCleanPair(p1, p2, TrackTable)) { +// continue; +// } +// // Close pair rejection +// if (CprManager.isActivated()) { +// CprManager.setPair(p1, p2, TrackTable); +// if (CprManager.isClosePair()) { +// continue; +// } +// } +// CprManager.fill(); +// PairHistManager.setPair(p1, p2); +// PairHistManager.fill(); +// } +// } -// process mixed event different tracks +// process mixed event for identical particles template void processMixedEvent(T1& Collisions, - T2& Partition1, - T3& Partition2, + T2& Partition, + T3& TrackTable, T4& cache, T5& policy, T6& depth, @@ -230,19 +182,19 @@ void processMixedEvent(T1& Collisions, continue; } CprManager.setMagField(collision1.magField()); - auto sliceParticle1 = Partition1->sliceByCached(o2::aod::femtobase::stored::fColId, collision1.globalIndex(), cache); - auto sliceParticle2 = Partition2->sliceByCached(o2::aod::femtobase::stored::fColId, collision2.globalIndex(), cache); + auto sliceParticle1 = Partition->sliceByCached(o2::aod::femtobase::stored::collisionId, collision1.globalIndex(), cache); + auto sliceParticle2 = Partition->sliceByCached(o2::aod::femtobase::stored::collisionId, collision2.globalIndex(), cache); if (sliceParticle1.size() == 0 || sliceParticle2.size() == 0) { continue; } for (auto const& [p1, p2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(sliceParticle1, sliceParticle2))) { // pair cleaning - if (!PcManager.isCleanPair(p1, p2)) { + if (!PcManager.isCleanPair(p1, p2, TrackTable)) { continue; } // Close pair rejection if (CprManager.isActivated()) { - CprManager.setPair(p1, p2); + CprManager.setPair(p1, p2, TrackTable); if (CprManager.isClosePair()) { continue; } @@ -254,7 +206,7 @@ void processMixedEvent(T1& Collisions, } } -// process mixed event for track and particles decaying into tracks +// process mixed event different particles template sliceByCached(o2::aod::femtobase::stored::fColId, collision1.globalIndex(), cache); - auto sliceParticle2 = Partition2->sliceByCached(o2::aod::femtobase::stored::fColId, collision2.globalIndex(), cache); + auto sliceParticle1 = Partition1->sliceByCached(o2::aod::femtobase::stored::collisionId, collision1.globalIndex(), cache); + auto sliceParticle2 = Partition2->sliceByCached(o2::aod::femtobase::stored::collisionId, collision2.globalIndex(), cache); if (sliceParticle1.size() == 0 || sliceParticle2.size() == 0) { continue; } @@ -304,6 +256,57 @@ void processMixedEvent(T1& Collisions, } } } + +// // process mixed event for track and particles decaying into tracks +// template +// void processMixedEvent(T1& Collisions, +// T2& Partition1, +// T3& Partition2, +// T4& TrackTable, +// T5& cache, +// T6& policy, +// T7& depth, +// T8& PairHistManager, +// T9& CprManager, +// T10& PcManager) +// { +// for (auto const& [collision1, collision2] : o2::soa::selfCombinations(policy, depth, -1, Collisions, Collisions)) { +// if (!(std::fabs(collision1.magField() - collision2.magField()) < o2::constants::math::Epsilon)) { +// continue; +// } +// CprManager.setMagField(collision1.magField()); +// auto sliceParticle1 = Partition1->sliceByCached(o2::aod::femtobase::stored::collisionId, collision1.globalIndex(), cache); +// auto sliceParticle2 = Partition2->sliceByCached(o2::aod::femtobase::stored::collisionId, collision2.globalIndex(), cache); +// if (sliceParticle1.size() == 0 || sliceParticle2.size() == 0) { +// continue; +// } +// for (auto const& [p1, p2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(sliceParticle1, sliceParticle2))) { +// // pair cleaning +// if (!PcManager.isCleanPair(p1, p2, TrackTable)) { +// continue; +// } +// // Close pair rejection +// if (CprManager.isActivated()) { +// CprManager.setPair(p1, p2, TrackTable); +// if (CprManager.isClosePair()) { +// continue; +// } +// } +// CprManager.fill(); +// PairHistManager.setPair(p1, p2); +// PairHistManager.fill(); +// } +// } +// } } // namespace pairprocesshelpers } // namespace o2::analysis::femto diff --git a/PWGCF/Femto/Core/selectionContainer.h b/PWGCF/Femto/Core/selectionContainer.h index 0ebeb803b0e..f97dfc4f6fd 100644 --- a/PWGCF/Femto/Core/selectionContainer.h +++ b/PWGCF/Femto/Core/selectionContainer.h @@ -47,6 +47,7 @@ enum LimitType { kUpperLimit, ///< simple upper limit for the value, kAbsLowerFunctionLimit, ///< lower limit of an absolute value given by a function, e.g. |DCA_xy| < f(pt) kEqual, ///< values need to be equal, e.g. sign = 1 kEqualArray, ///< values inside an array need to be equal + kLimitTypeLast }; std::unordered_map limitTypeAsStrings = { @@ -175,7 +176,7 @@ class SelectionContainer mComments = comments; } - std::vector getComments() const { return mComments; } + std::vector const& getComments() const { return mComments; } /// \brief Update selection limits using internal functions evaluated at a given value. /// \param value Input value to evaluate functions at. @@ -250,7 +251,7 @@ class SelectionContainer /// \brief Evaluate which selection criteria are fulfilled for a given value. /// \param values Values of the observable to evaluate - void evaluate(std::vector& values) + void evaluate(std::vector const& values) { if (values.size() != mSelectionValues.size()) { LOG(fatal) << "Wrong number of values have been passed"; @@ -341,11 +342,11 @@ class SelectionContainer /// \brief Get a copy of all selection values. /// \return Vector of selection values. - std::vector getSelectionValues() const { return mSelectionValues; } + std::vector const& getSelectionValues() const { return mSelectionValues; } /// \brief Get a copy of all selection values. /// \return Vector of selection values. - std::vector getSelectionFunction() const { return mSelectionFunctions; } + std::vector const& getSelectionFunction() const { return mSelectionFunctions; } /// \brief Check if this container is marked as minimal cut. /// \return True if minimal cut, false otherwise. @@ -359,7 +360,7 @@ class SelectionContainer std::vector mSelectionValues = {}; ///< Values used for the selection std::vector mComments = {}; ///< Comments for the values std::vector mSelectionFunctions = {}; ///< Function used for the selection - limits::LimitType mLimitType; ///< Limit type of selection + limits::LimitType mLimitType = limits::kLimitTypeLast; ///< Limit type of selection std::bitset mBitmask = {}; ///< bitmask for the observable bool mSkipMostPermissiveBit = false; ///< whether to skip the last bit or not bool mIsMinimalCut = false; ///< whether to use this observable for minimal selection or not diff --git a/PWGCF/Femto/Core/trackBuilder.h b/PWGCF/Femto/Core/trackBuilder.h index 826ccbbc9ca..dbf670459eb 100644 --- a/PWGCF/Femto/Core/trackBuilder.h +++ b/PWGCF/Femto/Core/trackBuilder.h @@ -375,7 +375,7 @@ class TrackSelection : public BaseSelectionevaluateObservable(kTpcKaon, Track.tpcNSigmaKa()); this->evaluateObservable(kTpcProton, Track.tpcNSigmaPr()); this->evaluateObservable(kTpcDeuteron, Track.tpcNSigmaDe()); - this->evaluateObservable(kTpctofTriton, Track.tpcNSigmaTr()); + this->evaluateObservable(kTpcTriton, Track.tpcNSigmaTr()); this->evaluateObservable(kTpcHelium, Track.tpcNSigmaHe()); // tof pid @@ -506,8 +506,8 @@ class TrackBuilder track.pt() * track.sign(), track.eta(), track.phi()); + indexMap.emplace(track.globalIndex(), trackProducts.producedTracks.lastIndex()); } - if (mProduceTrackMasks) { if constexpr (type == modes::Track::kPrimaryTrack) { trackProducts.producedTrackMasks(mTrackSelection.getBitmask()); @@ -515,7 +515,6 @@ class TrackBuilder trackProducts.producedTrackMasks(static_cast(0u)); } } - if (mProduceTrackDcas) { trackProducts.producedTrackDcas(track.dcaXY(), track.dcaZ()); } @@ -533,7 +532,6 @@ class TrackBuilder track.beta(), track.mass()); } - if (mProduceElectronPids) { if constexpr (type == modes::Track::kPrimaryTrack) { trackProducts.producedElectronPids(track.itsNSigmaEl(), track.tpcNSigmaEl(), track.tofNSigmaEl()); @@ -583,7 +581,6 @@ class TrackBuilder trackProducts.producedHeliumPids(0, track.tpcNSigmaHe(), track.tofNSigmaHe()); } } - indexMap.emplace(track.globalIndex(), trackProducts.producedTracks.lastIndex()); } template @@ -643,8 +640,8 @@ class TrackBuilderDerivedToDerived template bool collisionHasTooFewTracks(T1& col, T2& /*trackTable*/, T3& partitionTrack1, T4& partitionTrack2, T5& cache) { - auto trackSlice1 = partitionTrack1->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); - auto trackSlice2 = partitionTrack2->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto trackSlice1 = partitionTrack1->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto trackSlice2 = partitionTrack2->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); if (trackSlice1.size() >= mLimitTrack1 && trackSlice2.size() >= mLimitTrack2) { return false; } @@ -654,8 +651,8 @@ class TrackBuilderDerivedToDerived template void processTracks(T1& col, T2& /*trackTable*/, T3& partitionTrack1, T4& partitionTrack2, T5& indexMap, T6& cache, T7& newTrackTable, T8& newCollisionTable) { - auto trackSlice1 = partitionTrack1->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); - auto trackSlice2 = partitionTrack2->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto trackSlice1 = partitionTrack1->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto trackSlice2 = partitionTrack2->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); for (auto const& track : trackSlice1) { this->fillTrack(track, newTrackTable, newCollisionTable, indexMap); diff --git a/PWGCF/Femto/Core/trackHistManager.h b/PWGCF/Femto/Core/trackHistManager.h index 3d3bd8ac6bb..73016325cb4 100644 --- a/PWGCF/Femto/Core/trackHistManager.h +++ b/PWGCF/Femto/Core/trackHistManager.h @@ -384,8 +384,10 @@ constexpr char PrefixResonanceNegDaughter[] = "ResonanceNegDau/"; constexpr char PrefixResonancePosDaughterQa[] = "ResonancePosDauQa/"; constexpr char PrefixResonanceNegDaughterQa[] = "ResonanceNegDauQa/"; -constexpr char PrefixV0PosDaughter[] = "V0PosDau/"; -constexpr char PrefixV0NegDaughter[] = "V0NegDau/"; +constexpr char PrefixV0PosDaughter1[] = "V0PosDau1/"; +constexpr char PrefixV0NegDaughter1[] = "V0NegDau1/"; +constexpr char PrefixV0PosDaughter2[] = "V0PosDau2/"; +constexpr char PrefixV0NegDaughter2[] = "V0NegDau2/"; constexpr char PrefixV0PosDaughterQa[] = "V0PosDauQa/"; constexpr char PrefixV0NegDaughterQa[] = "V0NegDauQa/"; @@ -421,126 +423,126 @@ class TrackHistManager if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { std::string analysisDir = std::string(prefix) + std::string(AnalysisDir); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kPt, HistTable), GetHistDesc(kPt, HistTable), GetHistType(kPt, HistTable), {Specs[kPt]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kEta, HistTable), GetHistDesc(kEta, HistTable), GetHistType(kEta, HistTable), {Specs[kEta]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kPhi, HistTable), GetHistDesc(kPhi, HistTable), GetHistType(kPhi, HistTable), {Specs[kPhi]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kSign, HistTable), GetHistDesc(kSign, HistTable), GetHistType(kSign, HistTable), {Specs[kSign]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {Specs[kPt]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {Specs[kEta]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {Specs[kPhi]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {Specs[kSign]}); } if constexpr (isFlagSet(mode, modes::Mode::kQa)) { std::string qaDir = std::string(prefix) + std::string(QaDir); - mHistogramRegistry->add(qaDir + GetHistNamev2(kItsCluster, HistTable), GetHistDesc(kItsCluster, HistTable), GetHistType(kItsCluster, HistTable), {Specs[kItsCluster]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kItsClusterIb, HistTable), GetHistDesc(kItsClusterIb, HistTable), GetHistType(kItsClusterIb, HistTable), {Specs[kItsClusterIb]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kTpcCrossedRows, HistTable), GetHistDesc(kTpcCrossedRows, HistTable), GetHistType(kTpcCrossedRows, HistTable), {Specs[kTpcCrossedRows]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kTpcCluster, HistTable), GetHistDesc(kTpcCluster, HistTable), GetHistType(kTpcCluster, HistTable), {Specs[kTpcCluster]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kTpcClusterOverCrossedRows, HistTable), GetHistDesc(kTpcClusterOverCrossedRows, HistTable), GetHistType(kTpcClusterOverCrossedRows, HistTable), {Specs[kTpcClusterOverCrossedRows]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kTpcClusterShared, HistTable), GetHistDesc(kTpcClusterShared, HistTable), GetHistType(kTpcClusterShared, HistTable), {Specs[kTpcClusterShared]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kTpcClusterFractionShared, HistTable), GetHistDesc(kTpcClusterFractionShared, HistTable), GetHistType(kTpcClusterFractionShared, HistTable), {Specs[kTpcClusterFractionShared]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kItsCluster, HistTable), getHistDesc(kItsCluster, HistTable), getHistType(kItsCluster, HistTable), {Specs[kItsCluster]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kItsClusterIb, HistTable), getHistDesc(kItsClusterIb, HistTable), getHistType(kItsClusterIb, HistTable), {Specs[kItsClusterIb]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTpcCrossedRows, HistTable), getHistDesc(kTpcCrossedRows, HistTable), getHistType(kTpcCrossedRows, HistTable), {Specs[kTpcCrossedRows]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTpcCluster, HistTable), getHistDesc(kTpcCluster, HistTable), getHistType(kTpcCluster, HistTable), {Specs[kTpcCluster]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTpcClusterOverCrossedRows, HistTable), getHistDesc(kTpcClusterOverCrossedRows, HistTable), getHistType(kTpcClusterOverCrossedRows, HistTable), {Specs[kTpcClusterOverCrossedRows]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTpcClusterShared, HistTable), getHistDesc(kTpcClusterShared, HistTable), getHistType(kTpcClusterShared, HistTable), {Specs[kTpcClusterShared]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTpcClusterFractionShared, HistTable), getHistDesc(kTpcClusterFractionShared, HistTable), getHistType(kTpcClusterFractionShared, HistTable), {Specs[kTpcClusterFractionShared]}); // qa 2d - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsEta, HistTable), GetHistDesc(kPtVsEta, HistTable), GetHistType(kPtVsEta, HistTable), {Specs[kPtVsEta]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsPhi, HistTable), GetHistDesc(kPtVsPhi, HistTable), GetHistType(kPtVsPhi, HistTable), {Specs[kPtVsPhi]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPhiVsEta, HistTable), GetHistDesc(kPhiVsEta, HistTable), GetHistType(kPhiVsEta, HistTable), {Specs[kPhiVsEta]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsItsCluster, HistTable), GetHistDesc(kPtVsItsCluster, HistTable), GetHistType(kPtVsItsCluster, HistTable), {Specs[kPtVsItsCluster]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsTpcCluster, HistTable), GetHistDesc(kPtVsTpcCluster, HistTable), GetHistType(kPtVsTpcCluster, HistTable), {Specs[kPtVsTpcCluster]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsTpcCrossedRows, HistTable), GetHistDesc(kPtVsTpcCrossedRows, HistTable), GetHistType(kPtVsTpcCrossedRows, HistTable), {Specs[kPtVsTpcCrossedRows]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsTpcClusterOverCrossedRows, HistTable), GetHistDesc(kPtVsTpcClusterOverCrossedRows, HistTable), GetHistType(kPtVsTpcClusterOverCrossedRows, HistTable), {Specs[kPtVsTpcClusterOverCrossedRows]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsTpcClusterShared, HistTable), GetHistDesc(kPtVsTpcClusterShared, HistTable), GetHistType(kPtVsTpcClusterShared, HistTable), {Specs[kPtVsTpcClusterShared]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsTpcClusterFractionShared, HistTable), GetHistDesc(kPtVsTpcClusterFractionShared, HistTable), GetHistType(kPtVsTpcClusterFractionShared, HistTable), {Specs[kPtVsTpcClusterFractionShared]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kTpcClusterVsTpcCrossedRows, HistTable), GetHistDesc(kTpcClusterVsTpcCrossedRows, HistTable), GetHistType(kTpcClusterVsTpcCrossedRows, HistTable), {Specs[kTpcClusterVsTpcCrossedRows]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kTpcClusterVsTpcClusterShared, HistTable), GetHistDesc(kTpcClusterVsTpcClusterShared, HistTable), GetHistType(kTpcClusterVsTpcClusterShared, HistTable), {Specs[kTpcClusterVsTpcClusterShared]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsEta, HistTable), getHistDesc(kPtVsEta, HistTable), getHistType(kPtVsEta, HistTable), {Specs[kPtVsEta]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPhi, HistTable), getHistDesc(kPtVsPhi, HistTable), getHistType(kPtVsPhi, HistTable), {Specs[kPtVsPhi]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPhiVsEta, HistTable), getHistDesc(kPhiVsEta, HistTable), getHistType(kPhiVsEta, HistTable), {Specs[kPhiVsEta]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsItsCluster, HistTable), getHistDesc(kPtVsItsCluster, HistTable), getHistType(kPtVsItsCluster, HistTable), {Specs[kPtVsItsCluster]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsTpcCluster, HistTable), getHistDesc(kPtVsTpcCluster, HistTable), getHistType(kPtVsTpcCluster, HistTable), {Specs[kPtVsTpcCluster]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsTpcCrossedRows, HistTable), getHistDesc(kPtVsTpcCrossedRows, HistTable), getHistType(kPtVsTpcCrossedRows, HistTable), {Specs[kPtVsTpcCrossedRows]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsTpcClusterOverCrossedRows, HistTable), getHistDesc(kPtVsTpcClusterOverCrossedRows, HistTable), getHistType(kPtVsTpcClusterOverCrossedRows, HistTable), {Specs[kPtVsTpcClusterOverCrossedRows]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsTpcClusterShared, HistTable), getHistDesc(kPtVsTpcClusterShared, HistTable), getHistType(kPtVsTpcClusterShared, HistTable), {Specs[kPtVsTpcClusterShared]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsTpcClusterFractionShared, HistTable), getHistDesc(kPtVsTpcClusterFractionShared, HistTable), getHistType(kPtVsTpcClusterFractionShared, HistTable), {Specs[kPtVsTpcClusterFractionShared]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTpcClusterVsTpcCrossedRows, HistTable), getHistDesc(kTpcClusterVsTpcCrossedRows, HistTable), getHistType(kTpcClusterVsTpcCrossedRows, HistTable), {Specs[kTpcClusterVsTpcCrossedRows]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTpcClusterVsTpcClusterShared, HistTable), getHistDesc(kTpcClusterVsTpcClusterShared, HistTable), getHistType(kTpcClusterVsTpcClusterShared, HistTable), {Specs[kTpcClusterVsTpcClusterShared]}); // dca - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsDcaxy, HistTable), GetHistDesc(kPtVsDcaxy, HistTable), GetHistType(kPtVsDcaxy, HistTable), {Specs[kPtVsDcaxy]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsDcaz, HistTable), GetHistDesc(kPtVsDcaz, HistTable), GetHistType(kPtVsDcaz, HistTable), {Specs[kPtVsDcaz]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsDca, HistTable), GetHistDesc(kPtVsDca, HistTable), GetHistType(kPtVsDca, HistTable), {Specs[kPtVsDca]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsDcaxy, HistTable), getHistDesc(kPtVsDcaxy, HistTable), getHistType(kPtVsDcaxy, HistTable), {Specs[kPtVsDcaxy]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsDcaz, HistTable), getHistDesc(kPtVsDcaz, HistTable), getHistType(kPtVsDcaz, HistTable), {Specs[kPtVsDcaz]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsDca, HistTable), getHistDesc(kPtVsDca, HistTable), getHistType(kPtVsDca, HistTable), {Specs[kPtVsDca]}); std::string pidDir = std::string(prefix) + std::string(PidDir); mMomentumType = static_cast(momentumTypeForPid); - mHistogramRegistry->add(pidDir + GetHistNamev2(kItsSignal, HistTable), GetHistDesc(kItsSignal, HistTable), GetHistType(kItsSignal, HistTable), {Specs[kItsSignal]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kItsElectron, HistTable), GetHistDesc(kItsElectron, HistTable), GetHistType(kItsElectron, HistTable), {Specs[kItsElectron]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kItsPion, HistTable), GetHistDesc(kItsPion, HistTable), GetHistType(kItsPion, HistTable), {Specs[kItsPion]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kItsKaon, HistTable), GetHistDesc(kItsKaon, HistTable), GetHistType(kItsKaon, HistTable), {Specs[kItsKaon]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kItsProton, HistTable), GetHistDesc(kItsProton, HistTable), GetHistType(kItsProton, HistTable), {Specs[kItsProton]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kItsDeuteron, HistTable), GetHistDesc(kItsDeuteron, HistTable), GetHistType(kItsDeuteron, HistTable), {Specs[kItsDeuteron]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kItsTriton, HistTable), GetHistDesc(kItsTriton, HistTable), GetHistType(kItsTriton, HistTable), {Specs[kItsTriton]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kItsHelium, HistTable), GetHistDesc(kItsHelium, HistTable), GetHistType(kItsHelium, HistTable), {Specs[kItsHelium]}); - - mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcSignal, HistTable), GetHistDesc(kTpcSignal, HistTable), GetHistType(kTpcSignal, HistTable), {Specs[kTpcSignal]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcElectron, HistTable), GetHistDesc(kTpcElectron, HistTable), GetHistType(kTpcElectron, HistTable), {Specs[kTpcElectron]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcPion, HistTable), GetHistDesc(kTpcPion, HistTable), GetHistType(kTpcPion, HistTable), {Specs[kTpcPion]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcKaon, HistTable), GetHistDesc(kTpcKaon, HistTable), GetHistType(kTpcKaon, HistTable), {Specs[kTpcKaon]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcProton, HistTable), GetHistDesc(kTpcProton, HistTable), GetHistType(kTpcProton, HistTable), {Specs[kTpcProton]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcDeuteron, HistTable), GetHistDesc(kTpcDeuteron, HistTable), GetHistType(kTpcDeuteron, HistTable), {Specs[kTpcDeuteron]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcTriton, HistTable), GetHistDesc(kTpcTriton, HistTable), GetHistType(kTpcTriton, HistTable), {Specs[kTpcTriton]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcHelium, HistTable), GetHistDesc(kTpcHelium, HistTable), GetHistType(kTpcHelium, HistTable), {Specs[kTpcHelium]}); - - mHistogramRegistry->add(pidDir + GetHistNamev2(kTofBeta, HistTable), GetHistDesc(kTofBeta, HistTable), GetHistType(kTofBeta, HistTable), {Specs[kTofBeta]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTofMass, HistTable), GetHistDesc(kTofMass, HistTable), GetHistType(kTofMass, HistTable), {Specs[kTofMass]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTofElectron, HistTable), GetHistDesc(kTofElectron, HistTable), GetHistType(kTofElectron, HistTable), {Specs[kTofElectron]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTofPion, HistTable), GetHistDesc(kTofPion, HistTable), GetHistType(kTofPion, HistTable), {Specs[kTofPion]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTofKaon, HistTable), GetHistDesc(kTofKaon, HistTable), GetHistType(kTofKaon, HistTable), {Specs[kTofKaon]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTofProton, HistTable), GetHistDesc(kTofProton, HistTable), GetHistType(kTofProton, HistTable), {Specs[kTofProton]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTofDeuteron, HistTable), GetHistDesc(kTofDeuteron, HistTable), GetHistType(kTofDeuteron, HistTable), {Specs[kTofDeuteron]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTofTriton, HistTable), GetHistDesc(kTofTriton, HistTable), GetHistType(kTofTriton, HistTable), {Specs[kTofTriton]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTofHelium, HistTable), GetHistDesc(kTofHelium, HistTable), GetHistType(kTofHelium, HistTable), {Specs[kTofHelium]}); - - mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcitsElectron, HistTable), GetHistDesc(kTpcitsElectron, HistTable), GetHistType(kTpcitsElectron, HistTable), {Specs[kTpcitsElectron]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcitsPion, HistTable), GetHistDesc(kTpcitsPion, HistTable), GetHistType(kTpcitsPion, HistTable), {Specs[kTpcitsPion]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcitsKaon, HistTable), GetHistDesc(kTpcitsKaon, HistTable), GetHistType(kTpcitsKaon, HistTable), {Specs[kTpcitsKaon]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcitsProton, HistTable), GetHistDesc(kTpcitsProton, HistTable), GetHistType(kTpcitsProton, HistTable), {Specs[kTpcitsProton]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcitsDeuteron, HistTable), GetHistDesc(kTpcitsDeuteron, HistTable), GetHistType(kTpcitsDeuteron, HistTable), {Specs[kTpcitsDeuteron]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcitsTriton, HistTable), GetHistDesc(kTpcitsTriton, HistTable), GetHistType(kTpcitsTriton, HistTable), {Specs[kTpcitsTriton]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTpcitsHelium, HistTable), GetHistDesc(kTpcitsHelium, HistTable), GetHistType(kTpcitsHelium, HistTable), {Specs[kTpcitsHelium]}); - - mHistogramRegistry->add(pidDir + GetHistNamev2(kTpctofElectron, HistTable), GetHistDesc(kTpctofElectron, HistTable), GetHistType(kTpctofElectron, HistTable), {Specs[kTpctofElectron]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTpctofPion, HistTable), GetHistDesc(kTpctofPion, HistTable), GetHistType(kTpctofPion, HistTable), {Specs[kTpctofPion]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTpctofKaon, HistTable), GetHistDesc(kTpctofKaon, HistTable), GetHistType(kTpctofKaon, HistTable), {Specs[kTpctofKaon]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTpctofProton, HistTable), GetHistDesc(kTpctofProton, HistTable), GetHistType(kTpctofProton, HistTable), {Specs[kTpctofProton]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTpctofDeuteron, HistTable), GetHistDesc(kTpctofDeuteron, HistTable), GetHistType(kTpctofDeuteron, HistTable), {Specs[kTpctofDeuteron]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTpctofTriton, HistTable), GetHistDesc(kTpctofTriton, HistTable), GetHistType(kTpctofTriton, HistTable), {Specs[kTpctofTriton]}); - mHistogramRegistry->add(pidDir + GetHistNamev2(kTpctofHelium, HistTable), GetHistDesc(kTpctofHelium, HistTable), GetHistType(kTpctofHelium, HistTable), {Specs[kTpctofHelium]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kItsSignal, HistTable), getHistDesc(kItsSignal, HistTable), getHistType(kItsSignal, HistTable), {Specs[kItsSignal]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kItsElectron, HistTable), getHistDesc(kItsElectron, HistTable), getHistType(kItsElectron, HistTable), {Specs[kItsElectron]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kItsPion, HistTable), getHistDesc(kItsPion, HistTable), getHistType(kItsPion, HistTable), {Specs[kItsPion]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kItsKaon, HistTable), getHistDesc(kItsKaon, HistTable), getHistType(kItsKaon, HistTable), {Specs[kItsKaon]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kItsProton, HistTable), getHistDesc(kItsProton, HistTable), getHistType(kItsProton, HistTable), {Specs[kItsProton]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kItsDeuteron, HistTable), getHistDesc(kItsDeuteron, HistTable), getHistType(kItsDeuteron, HistTable), {Specs[kItsDeuteron]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kItsTriton, HistTable), getHistDesc(kItsTriton, HistTable), getHistType(kItsTriton, HistTable), {Specs[kItsTriton]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kItsHelium, HistTable), getHistDesc(kItsHelium, HistTable), getHistType(kItsHelium, HistTable), {Specs[kItsHelium]}); + + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcSignal, HistTable), getHistDesc(kTpcSignal, HistTable), getHistType(kTpcSignal, HistTable), {Specs[kTpcSignal]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcElectron, HistTable), getHistDesc(kTpcElectron, HistTable), getHistType(kTpcElectron, HistTable), {Specs[kTpcElectron]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcPion, HistTable), getHistDesc(kTpcPion, HistTable), getHistType(kTpcPion, HistTable), {Specs[kTpcPion]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcKaon, HistTable), getHistDesc(kTpcKaon, HistTable), getHistType(kTpcKaon, HistTable), {Specs[kTpcKaon]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcProton, HistTable), getHistDesc(kTpcProton, HistTable), getHistType(kTpcProton, HistTable), {Specs[kTpcProton]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcDeuteron, HistTable), getHistDesc(kTpcDeuteron, HistTable), getHistType(kTpcDeuteron, HistTable), {Specs[kTpcDeuteron]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcTriton, HistTable), getHistDesc(kTpcTriton, HistTable), getHistType(kTpcTriton, HistTable), {Specs[kTpcTriton]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcHelium, HistTable), getHistDesc(kTpcHelium, HistTable), getHistType(kTpcHelium, HistTable), {Specs[kTpcHelium]}); + + mHistogramRegistry->add(pidDir + getHistNameV2(kTofBeta, HistTable), getHistDesc(kTofBeta, HistTable), getHistType(kTofBeta, HistTable), {Specs[kTofBeta]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTofMass, HistTable), getHistDesc(kTofMass, HistTable), getHistType(kTofMass, HistTable), {Specs[kTofMass]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTofElectron, HistTable), getHistDesc(kTofElectron, HistTable), getHistType(kTofElectron, HistTable), {Specs[kTofElectron]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTofPion, HistTable), getHistDesc(kTofPion, HistTable), getHistType(kTofPion, HistTable), {Specs[kTofPion]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTofKaon, HistTable), getHistDesc(kTofKaon, HistTable), getHistType(kTofKaon, HistTable), {Specs[kTofKaon]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTofProton, HistTable), getHistDesc(kTofProton, HistTable), getHistType(kTofProton, HistTable), {Specs[kTofProton]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTofDeuteron, HistTable), getHistDesc(kTofDeuteron, HistTable), getHistType(kTofDeuteron, HistTable), {Specs[kTofDeuteron]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTofTriton, HistTable), getHistDesc(kTofTriton, HistTable), getHistType(kTofTriton, HistTable), {Specs[kTofTriton]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTofHelium, HistTable), getHistDesc(kTofHelium, HistTable), getHistType(kTofHelium, HistTable), {Specs[kTofHelium]}); + + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsElectron, HistTable), getHistDesc(kTpcitsElectron, HistTable), getHistType(kTpcitsElectron, HistTable), {Specs[kTpcitsElectron]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsPion, HistTable), getHistDesc(kTpcitsPion, HistTable), getHistType(kTpcitsPion, HistTable), {Specs[kTpcitsPion]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsKaon, HistTable), getHistDesc(kTpcitsKaon, HistTable), getHistType(kTpcitsKaon, HistTable), {Specs[kTpcitsKaon]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsProton, HistTable), getHistDesc(kTpcitsProton, HistTable), getHistType(kTpcitsProton, HistTable), {Specs[kTpcitsProton]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsDeuteron, HistTable), getHistDesc(kTpcitsDeuteron, HistTable), getHistType(kTpcitsDeuteron, HistTable), {Specs[kTpcitsDeuteron]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsTriton, HistTable), getHistDesc(kTpcitsTriton, HistTable), getHistType(kTpcitsTriton, HistTable), {Specs[kTpcitsTriton]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsHelium, HistTable), getHistDesc(kTpcitsHelium, HistTable), getHistType(kTpcitsHelium, HistTable), {Specs[kTpcitsHelium]}); + + mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofElectron, HistTable), getHistDesc(kTpctofElectron, HistTable), getHistType(kTpctofElectron, HistTable), {Specs[kTpctofElectron]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofPion, HistTable), getHistDesc(kTpctofPion, HistTable), getHistType(kTpctofPion, HistTable), {Specs[kTpctofPion]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofKaon, HistTable), getHistDesc(kTpctofKaon, HistTable), getHistType(kTpctofKaon, HistTable), {Specs[kTpctofKaon]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofProton, HistTable), getHistDesc(kTpctofProton, HistTable), getHistType(kTpctofProton, HistTable), {Specs[kTpctofProton]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofDeuteron, HistTable), getHistDesc(kTpctofDeuteron, HistTable), getHistType(kTpctofDeuteron, HistTable), {Specs[kTpctofDeuteron]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofTriton, HistTable), getHistDesc(kTpctofTriton, HistTable), getHistType(kTpctofTriton, HistTable), {Specs[kTpctofTriton]}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofHelium, HistTable), getHistDesc(kTpctofHelium, HistTable), getHistType(kTpctofHelium, HistTable), {Specs[kTpctofHelium]}); } } - template - void fill(T const& track) + template + void fill(T1 const& track, T2 const& /*trackTable*/) { if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kPt, HistTable)), mAbsCharge * track.pt()); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kEta, HistTable)), track.eta()); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kPhi, HistTable)), track.phi()); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(GetHistName(kSign, HistTable)), track.sign()); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt, HistTable)), mAbsCharge * track.pt()); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kEta, HistTable)), track.eta()); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPhi, HistTable)), track.phi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), track.sign()); } if constexpr (isFlagSet(mode, modes::Mode::kQa)) { - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kItsCluster, HistTable)), static_cast(track.itsNCls())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kItsClusterIb, HistTable)), static_cast(track.itsNClsInnerBarrel())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kTpcCrossedRows, HistTable)), static_cast(track.tpcNClsCrossedRows())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kTpcCluster, HistTable)), static_cast(track.tpcNClsFound())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kTpcClusterOverCrossedRows, HistTable)), static_cast(track.tpcNClsFound()) / static_cast(track.tpcNClsCrossedRows())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kTpcClusterShared, HistTable)), static_cast(track.tpcNClsShared())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kTpcClusterFractionShared, HistTable)), track.tpcSharedOverFound()); - - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsEta, HistTable)), mAbsCharge * track.pt(), track.eta()); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsPhi, HistTable)), mAbsCharge * track.pt(), track.phi()); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPhiVsEta, HistTable)), track.phi(), track.eta()); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsItsCluster, HistTable)), mAbsCharge * track.pt(), static_cast(track.itsNCls())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsTpcCluster, HistTable)), mAbsCharge * track.pt(), static_cast(track.tpcNClsFound())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsTpcCrossedRows, HistTable)), mAbsCharge * track.pt(), static_cast(track.tpcNClsCrossedRows())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsTpcClusterOverCrossedRows, HistTable)), mAbsCharge * track.pt(), static_cast(track.tpcNClsFound()) / static_cast(track.tpcNClsCrossedRows())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsTpcClusterShared, HistTable)), mAbsCharge * track.pt(), static_cast(track.tpcNClsShared())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsTpcClusterFractionShared, HistTable)), mAbsCharge * track.pt(), static_cast(track.tpcNClsShared()) / static_cast(track.tpcNClsFound())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kTpcClusterVsTpcCrossedRows, HistTable)), static_cast(track.tpcNClsFound()), static_cast(track.tpcNClsCrossedRows())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kTpcClusterVsTpcClusterShared, HistTable)), static_cast(track.tpcNClsFound()), static_cast(track.tpcNClsShared())); - - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsDcaxy, HistTable)), mAbsCharge * track.pt(), track.dcaXY()); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsDcaz, HistTable)), mAbsCharge * track.pt(), track.dcaZ()); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsDca, HistTable)), mAbsCharge * track.pt(), track.dca()); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kItsCluster, HistTable)), static_cast(track.itsNCls())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kItsClusterIb, HistTable)), static_cast(track.itsNClsInnerBarrel())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcCrossedRows, HistTable)), static_cast(track.tpcNClsCrossedRows())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcCluster, HistTable)), static_cast(track.tpcNClsFound())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcClusterOverCrossedRows, HistTable)), static_cast(track.tpcNClsFound()) / static_cast(track.tpcNClsCrossedRows())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcClusterShared, HistTable)), static_cast(track.tpcNClsShared())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcClusterFractionShared, HistTable)), track.tpcSharedOverFound()); + + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsEta, HistTable)), mAbsCharge * track.pt(), track.eta()); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsPhi, HistTable)), mAbsCharge * track.pt(), track.phi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPhiVsEta, HistTable)), track.phi(), track.eta()); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsItsCluster, HistTable)), mAbsCharge * track.pt(), static_cast(track.itsNCls())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsTpcCluster, HistTable)), mAbsCharge * track.pt(), static_cast(track.tpcNClsFound())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsTpcCrossedRows, HistTable)), mAbsCharge * track.pt(), static_cast(track.tpcNClsCrossedRows())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsTpcClusterOverCrossedRows, HistTable)), mAbsCharge * track.pt(), static_cast(track.tpcNClsFound()) / static_cast(track.tpcNClsCrossedRows())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsTpcClusterShared, HistTable)), mAbsCharge * track.pt(), static_cast(track.tpcNClsShared())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsTpcClusterFractionShared, HistTable)), mAbsCharge * track.pt(), static_cast(track.tpcNClsShared()) / static_cast(track.tpcNClsFound())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcClusterVsTpcCrossedRows, HistTable)), static_cast(track.tpcNClsFound()), static_cast(track.tpcNClsCrossedRows())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcClusterVsTpcClusterShared, HistTable)), static_cast(track.tpcNClsFound()), static_cast(track.tpcNClsShared())); + + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsDcaxy, HistTable)), mAbsCharge * track.pt(), track.dcaXY()); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsDcaz, HistTable)), mAbsCharge * track.pt(), track.dcaZ()); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsDca, HistTable)), mAbsCharge * track.pt(), track.dca()); float momentum = 0.f; if (mMomentumType == modes::MomentumType::kPAtPv) { @@ -549,49 +551,49 @@ class TrackHistManager momentum = mAbsCharge * track.pt(); } - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsSignal, HistTable)), momentum, o2::analysis::femto::utils::itsSignal(track)); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsElectron, HistTable)), momentum, track.itsNSigmaEl()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsPion, HistTable)), momentum, track.itsNSigmaPi()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsKaon, HistTable)), momentum, track.itsNSigmaKa()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsProton, HistTable)), momentum, track.itsNSigmaPr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsDeuteron, HistTable)), momentum, track.itsNSigmaDe()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsTriton, HistTable)), momentum, track.itsNSigmaTr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kItsHelium, HistTable)), momentum, track.itsNSigmaHe()); - - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcSignal, HistTable)), momentum, track.tpcSignal()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcElectron, HistTable)), momentum, track.tpcNSigmaEl()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcPion, HistTable)), momentum, track.tpcNSigmaPi()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcKaon, HistTable)), momentum, track.tpcNSigmaKa()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcProton, HistTable)), momentum, track.tpcNSigmaPr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcDeuteron, HistTable)), momentum, track.tpcNSigmaDe()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcTriton, HistTable)), momentum, track.tpcNSigmaTr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcHelium, HistTable)), momentum, track.tpcNSigmaHe()); - - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofBeta, HistTable)), momentum, track.tofBeta()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofMass, HistTable)), momentum, track.tofMass()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofElectron, HistTable)), momentum, track.tofNSigmaEl()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofPion, HistTable)), momentum, track.tofNSigmaPi()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofKaon, HistTable)), momentum, track.tofNSigmaKa()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofProton, HistTable)), momentum, track.tofNSigmaPr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofDeuteron, HistTable)), momentum, track.tofNSigmaDe()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofTriton, HistTable)), momentum, track.tofNSigmaTr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTofHelium, HistTable)), momentum, track.tofNSigmaHe()); - - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsElectron, HistTable)), momentum, track.tpcitsNSigmaEl()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsPion, HistTable)), momentum, track.tpcitsNSigmaPi()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsKaon, HistTable)), momentum, track.tpcitsNSigmaKa()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsProton, HistTable)), momentum, track.tpcitsNSigmaPr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsDeuteron, HistTable)), momentum, track.tpcitsNSigmaDe()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsTriton, HistTable)), momentum, track.tpcitsNSigmaTr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpcitsHelium, HistTable)), momentum, track.tpcitsNSigmaHe()); - - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofElectron, HistTable)), momentum, track.tpctofNSigmaEl()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofPion, HistTable)), momentum, track.tpctofNSigmaPi()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofKaon, HistTable)), momentum, track.tpctofNSigmaKa()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofProton, HistTable)), momentum, track.tpctofNSigmaPr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofDeuteron, HistTable)), momentum, track.tpctofNSigmaDe()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofTriton, HistTable)), momentum, track.tpctofNSigmaTr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(GetHistName(kTpctofHelium, HistTable)), momentum, track.tpctofNSigmaHe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsSignal, HistTable)), momentum, o2::analysis::femto::utils::itsSignal(track)); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsElectron, HistTable)), momentum, track.itsNSigmaEl()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsPion, HistTable)), momentum, track.itsNSigmaPi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsKaon, HistTable)), momentum, track.itsNSigmaKa()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsProton, HistTable)), momentum, track.itsNSigmaPr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsDeuteron, HistTable)), momentum, track.itsNSigmaDe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsTriton, HistTable)), momentum, track.itsNSigmaTr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsHelium, HistTable)), momentum, track.itsNSigmaHe()); + + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcSignal, HistTable)), momentum, track.tpcSignal()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcElectron, HistTable)), momentum, track.tpcNSigmaEl()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcPion, HistTable)), momentum, track.tpcNSigmaPi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcKaon, HistTable)), momentum, track.tpcNSigmaKa()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcProton, HistTable)), momentum, track.tpcNSigmaPr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcDeuteron, HistTable)), momentum, track.tpcNSigmaDe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcTriton, HistTable)), momentum, track.tpcNSigmaTr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcHelium, HistTable)), momentum, track.tpcNSigmaHe()); + + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofBeta, HistTable)), momentum, track.tofBeta()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofMass, HistTable)), momentum, track.tofMass()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofElectron, HistTable)), momentum, track.tofNSigmaEl()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofPion, HistTable)), momentum, track.tofNSigmaPi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofKaon, HistTable)), momentum, track.tofNSigmaKa()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofProton, HistTable)), momentum, track.tofNSigmaPr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofDeuteron, HistTable)), momentum, track.tofNSigmaDe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofTriton, HistTable)), momentum, track.tofNSigmaTr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofHelium, HistTable)), momentum, track.tofNSigmaHe()); + + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsElectron, HistTable)), momentum, track.tpcitsNSigmaEl()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsPion, HistTable)), momentum, track.tpcitsNSigmaPi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsKaon, HistTable)), momentum, track.tpcitsNSigmaKa()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsProton, HistTable)), momentum, track.tpcitsNSigmaPr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsDeuteron, HistTable)), momentum, track.tpcitsNSigmaDe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsTriton, HistTable)), momentum, track.tpcitsNSigmaTr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsHelium, HistTable)), momentum, track.tpcitsNSigmaHe()); + + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpctofElectron, HistTable)), momentum, track.tpctofNSigmaEl()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpctofPion, HistTable)), momentum, track.tpctofNSigmaPi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpctofKaon, HistTable)), momentum, track.tpctofNSigmaKa()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpctofProton, HistTable)), momentum, track.tpctofNSigmaPr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpctofDeuteron, HistTable)), momentum, track.tpctofNSigmaDe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpctofTriton, HistTable)), momentum, track.tpctofNSigmaTr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpctofHelium, HistTable)), momentum, track.tpctofNSigmaHe()); } } diff --git a/PWGCF/Femto/Core/twoTrackResonanceBuilder.h b/PWGCF/Femto/Core/twoTrackResonanceBuilder.h index 69477f86666..185611e12f1 100644 --- a/PWGCF/Femto/Core/twoTrackResonanceBuilder.h +++ b/PWGCF/Femto/Core/twoTrackResonanceBuilder.h @@ -30,7 +30,7 @@ #include "Framework/AnalysisHelpers.h" #include "Framework/Configurable.h" -#include "Math/Vector4D.h" +#include #include "fairlogger/Logger.h" diff --git a/PWGCF/Femto/Core/twoTrackResonanceHistManager.h b/PWGCF/Femto/Core/twoTrackResonanceHistManager.h index 1df3af003a4..38e4c6e3460 100644 --- a/PWGCF/Femto/Core/twoTrackResonanceHistManager.h +++ b/PWGCF/Femto/Core/twoTrackResonanceHistManager.h @@ -142,50 +142,50 @@ class TwoTrackResonanceHistManager if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { std::string analysisDir = std::string(resoPrefix) + std::string(AnalysisDir); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kPt, HistTable), GetHistDesc(kPt, HistTable), GetHistType(kPt, HistTable), {ResoSpecs[kPt]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kEta, HistTable), GetHistDesc(kEta, HistTable), GetHistType(kEta, HistTable), {ResoSpecs[kEta]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kPhi, HistTable), GetHistDesc(kPhi, HistTable), GetHistType(kPhi, HistTable), {ResoSpecs[kPhi]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kMass, HistTable), GetHistDesc(kMass, HistTable), GetHistType(kMass, HistTable), {ResoSpecs[kMass]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kSign, HistTable), GetHistDesc(kSign, HistTable), GetHistType(kSign, HistTable), {ResoSpecs[kSign]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {ResoSpecs[kPt]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {ResoSpecs[kEta]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {ResoSpecs[kPhi]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kMass, HistTable), getHistDesc(kMass, HistTable), getHistType(kMass, HistTable), {ResoSpecs[kMass]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {ResoSpecs[kSign]}); } if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { std::string qaDir = std::string(resoPrefix) + std::string(QaDir); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsEta, HistTable), GetHistDesc(kPtVsEta, HistTable), GetHistType(kPtVsEta, HistTable), {ResoSpecs[kPtVsEta]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsPhi, HistTable), GetHistDesc(kPtVsPhi, HistTable), GetHistType(kPtVsPhi, HistTable), {ResoSpecs[kPtVsPhi]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPhiVsEta, HistTable), GetHistDesc(kPhiVsEta, HistTable), GetHistType(kPhiVsEta, HistTable), {ResoSpecs[kPhiVsEta]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsMass, HistTable), GetHistDesc(kPtVsMass, HistTable), GetHistType(kPtVsMass, HistTable), {ResoSpecs[kPtVsMass]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsEta, HistTable), getHistDesc(kPtVsEta, HistTable), getHistType(kPtVsEta, HistTable), {ResoSpecs[kPtVsEta]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPhi, HistTable), getHistDesc(kPtVsPhi, HistTable), getHistType(kPtVsPhi, HistTable), {ResoSpecs[kPtVsPhi]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPhiVsEta, HistTable), getHistDesc(kPhiVsEta, HistTable), getHistType(kPhiVsEta, HistTable), {ResoSpecs[kPhiVsEta]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsMass, HistTable), getHistDesc(kPtVsMass, HistTable), getHistType(kPtVsMass, HistTable), {ResoSpecs[kPtVsMass]}); } } template - void fill(T1 const& resonance, T2 const& /*tracks*/) + void fill(T1 const& resonance, T2 const& tracks) { auto posDaughter = resonance.template posDau_as(); - mPosDauManager.fill(posDaughter); + mPosDauManager.fill(posDaughter, tracks); auto negDaughter = resonance.template negDau_as(); - mNegDauManager.fill(negDaughter); + mNegDauManager.fill(negDaughter, tracks); if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(GetHistName(kPt, HistTable)), resonance.pt()); - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(GetHistName(kEta, HistTable)), resonance.eta()); - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(GetHistName(kPhi, HistTable)), resonance.phi()); - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(GetHistName(kMass, HistTable)), resonance.mass()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kPt, HistTable)), resonance.pt()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kEta, HistTable)), resonance.eta()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kPhi, HistTable)), resonance.phi()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kMass, HistTable)), resonance.mass()); if constexpr (modes::isEqual(reso, modes::TwoTrackResonance::kPhi) || modes::isEqual(reso, modes::TwoTrackResonance::kRho0)) { - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(GetHistName(kSign, HistTable)), 0); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), 0); } if constexpr (modes::isEqual(reso, modes::TwoTrackResonance::kKstar0) || modes::isEqual(reso, modes::TwoTrackResonance::kKstar0Bar)) { - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(GetHistName(kSign, HistTable)), resonance.sign()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), resonance.sign()); } } if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(GetHistName(kPtVsEta, HistTable)), resonance.pt(), resonance.eta()); - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(GetHistName(kPtVsPhi, HistTable)), resonance.pt(), resonance.phi()); - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(GetHistName(kPhiVsEta, HistTable)), resonance.phi(), resonance.eta()); - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(GetHistName(kPtVsMass, HistTable)), resonance.pt(), resonance.mass()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(getHistName(kPtVsEta, HistTable)), resonance.pt(), resonance.eta()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(getHistName(kPtVsPhi, HistTable)), resonance.pt(), resonance.phi()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(getHistName(kPhiVsEta, HistTable)), resonance.phi(), resonance.eta()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(getHistName(kPtVsMass, HistTable)), resonance.pt(), resonance.mass()); } } diff --git a/PWGCF/Femto/Core/v0Builder.h b/PWGCF/Femto/Core/v0Builder.h index 305759070c2..0364c3c5a0a 100644 --- a/PWGCF/Femto/Core/v0Builder.h +++ b/PWGCF/Femto/Core/v0Builder.h @@ -127,7 +127,7 @@ constexpr const char PrefixLambdaSelection2[] = "LambdaSelection2"; using ConfLambdaSelection1 = ConfLambdaSelection; using ConfLambdaSelection2 = ConfLambdaSelection; constexpr const char PrefixK0shortSelection1[] = "K0shortSelection1"; -constexpr const char PrefixK0shortSelection2[] = "K0shortSelection1"; +constexpr const char PrefixK0shortSelection2[] = "K0shortSelection2"; using ConfK0shortSelection1 = ConfK0shortSelection; using ConfK0shortSelection2 = ConfK0shortSelection; @@ -330,8 +330,8 @@ template class V0Builder { public: - V0Builder() {} - virtual ~V0Builder() = default; + V0Builder() = default; + ~V0Builder() = default; template void init(T1& config, T2& filter, T3& table, T4& initContext) @@ -395,7 +395,7 @@ class V0Builder } template - void fillLambda(T1& collisionProducts, T2& v0products, T3 const& v0, float sign, int posDaughterIndex, int negDaughterIndex) + void fillLambda(T1& collisionProducts, T2& v0products, T3 const& v0, float sign, int32_t posDaughterIndex, int32_t negDaughterIndex) { float mass, massAnti; if (sign > 0.f) { @@ -500,7 +500,7 @@ class V0BuilderDerivedToDerived template bool collisionHasTooFewLambdas(T1& col, T2& /*lambdaTable*/, T3& partitionLambda, T4& cache) { - auto lambdaSlice = partitionLambda->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto lambdaSlice = partitionLambda->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); if (lambdaSlice.size() >= mLimitLambda) { return false; } @@ -510,7 +510,7 @@ class V0BuilderDerivedToDerived template bool collisionHasTooFewK0shorts(T1& col, T2& /*k0shortTable*/, T3& partitionK0short, T4& cache) { - auto k0shortSlice = partitionK0short->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto k0shortSlice = partitionK0short->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); if (k0shortSlice.size() >= mLimitK0short) { return false; } @@ -520,7 +520,7 @@ class V0BuilderDerivedToDerived template void processLambdas(T1& col, T2& /*lambdaTable*/, T3& /*oldTrackTable*/, T4& partitionLambda, T5& trackBuilder, T6& indexMap, T7& cache, T8& newLambdaTable, T9& newTrackTable, T10& newCollisionTable) { - auto lambdaSlice = partitionLambda->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto lambdaSlice = partitionLambda->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); for (auto const& lambda : lambdaSlice) { @@ -544,7 +544,7 @@ class V0BuilderDerivedToDerived template void processK0shorts(T1& col, T2& /*k0shortTable*/, T3& /*oldTrackTable*/, T4& partitionK0short, T5& trackBuilder, T6& indexMap, T7& cache, T8& newK0shortTable, T9& newTrackTable, T10& newCollisionTable) { - auto k0shortSlice = partitionK0short->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto k0shortSlice = partitionK0short->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); for (auto const& k0short : k0shortSlice) { diff --git a/PWGCF/Femto/Core/v0HistManager.h b/PWGCF/Femto/Core/v0HistManager.h index d767791d558..f402b8e0fab 100644 --- a/PWGCF/Femto/Core/v0HistManager.h +++ b/PWGCF/Femto/Core/v0HistManager.h @@ -220,77 +220,76 @@ class V0HistManager if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { std::string analysisDir = std::string(v0Prefix) + std::string(AnalysisDir); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kPt, HistTable), GetHistDesc(kPt, HistTable), GetHistType(kPt, HistTable), {V0Specs[kPt]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kEta, HistTable), GetHistDesc(kEta, HistTable), GetHistType(kEta, HistTable), {V0Specs[kEta]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kPhi, HistTable), GetHistDesc(kPhi, HistTable), GetHistType(kPhi, HistTable), {V0Specs[kPhi]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kMass, HistTable), GetHistDesc(kMass, HistTable), GetHistType(kMass, HistTable), {V0Specs[kMass]}); - mHistogramRegistry->add(analysisDir + GetHistNamev2(kSign, HistTable), GetHistDesc(kSign, HistTable), GetHistType(kSign, HistTable), {V0Specs[kSign]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {V0Specs[kPt]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {V0Specs[kEta]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {V0Specs[kPhi]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kMass, HistTable), getHistDesc(kMass, HistTable), getHistType(kMass, HistTable), {V0Specs[kMass]}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {V0Specs[kSign]}); } if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { std::string qaDir = std::string(v0Prefix) + std::string(QaDir); - mHistogramRegistry->add(qaDir + GetHistNamev2(kCosPa, HistTable), GetHistDesc(kCosPa, HistTable), GetHistType(kCosPa, HistTable), {V0Specs[kCosPa]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kDecayDauDca, HistTable), GetHistDesc(kDecayDauDca, HistTable), GetHistType(kDecayDauDca, HistTable), {V0Specs[kDecayDauDca]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kDecayVtxX, HistTable), GetHistDesc(kDecayVtxX, HistTable), GetHistType(kDecayVtxX, HistTable), {V0Specs[kDecayVtxX]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kDecayVtxY, HistTable), GetHistDesc(kDecayVtxY, HistTable), GetHistType(kDecayVtxY, HistTable), {V0Specs[kDecayVtxY]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kDecayVtxZ, HistTable), GetHistDesc(kDecayVtxZ, HistTable), GetHistType(kDecayVtxZ, HistTable), {V0Specs[kDecayVtxZ]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kDecayVtx, HistTable), GetHistDesc(kDecayVtx, HistTable), GetHistType(kDecayVtx, HistTable), {V0Specs[kDecayVtx]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kTransRadius, HistTable), GetHistDesc(kTransRadius, HistTable), GetHistType(kTransRadius, HistTable), {V0Specs[kTransRadius]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kCosPa, HistTable), getHistDesc(kCosPa, HistTable), getHistType(kCosPa, HistTable), {V0Specs[kCosPa]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayDauDca, HistTable), getHistDesc(kDecayDauDca, HistTable), getHistType(kDecayDauDca, HistTable), {V0Specs[kDecayDauDca]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxX, HistTable), getHistDesc(kDecayVtxX, HistTable), getHistType(kDecayVtxX, HistTable), {V0Specs[kDecayVtxX]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxY, HistTable), getHistDesc(kDecayVtxY, HistTable), getHistType(kDecayVtxY, HistTable), {V0Specs[kDecayVtxY]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxZ, HistTable), getHistDesc(kDecayVtxZ, HistTable), getHistType(kDecayVtxZ, HistTable), {V0Specs[kDecayVtxZ]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtx, HistTable), getHistDesc(kDecayVtx, HistTable), getHistType(kDecayVtx, HistTable), {V0Specs[kDecayVtx]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTransRadius, HistTable), getHistDesc(kTransRadius, HistTable), getHistType(kTransRadius, HistTable), {V0Specs[kTransRadius]}); // qa 2d - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsEta, HistTable), GetHistDesc(kPtVsEta, HistTable), GetHistType(kPtVsEta, HistTable), {V0Specs[kPtVsEta]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsPhi, HistTable), GetHistDesc(kPtVsPhi, HistTable), GetHistType(kPtVsPhi, HistTable), {V0Specs[kPtVsPhi]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPhiVsEta, HistTable), GetHistDesc(kPhiVsEta, HistTable), GetHistType(kPhiVsEta, HistTable), {V0Specs[kPhiVsEta]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsCosPa, HistTable), GetHistDesc(kPtVsCosPa, HistTable), GetHistType(kPtVsCosPa, HistTable), {V0Specs[kPtVsCosPa]}); - - mHistogramRegistry->add(qaDir + GetHistNamev2(kMassLambda, HistTable), GetHistDesc(kMassLambda, HistTable), GetHistType(kMassLambda, HistTable), {V0Specs[kMassLambda]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kMassAntiLambda, HistTable), GetHistDesc(kMassAntiLambda, HistTable), GetHistType(kMassAntiLambda, HistTable), {V0Specs[kMassAntiLambda]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kMassK0short, HistTable), GetHistDesc(kMassK0short, HistTable), GetHistType(kMassK0short, HistTable), {V0Specs[kMassK0short]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsLambdaMass, HistTable), GetHistDesc(kPtVsLambdaMass, HistTable), GetHistType(kPtVsLambdaMass, HistTable), {V0Specs[kPtVsLambdaMass]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsAntiLambdaMass, HistTable), GetHistDesc(kPtVsAntiLambdaMass, HistTable), GetHistType(kPtVsAntiLambdaMass, HistTable), {V0Specs[kPtVsAntiLambdaMass]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kPtVsK0shortMass, HistTable), GetHistDesc(kPtVsK0shortMass, HistTable), GetHistType(kPtVsK0shortMass, HistTable), {V0Specs[kPtVsK0shortMass]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kLambdaMassVsAntiLambdaMass, HistTable), GetHistDesc(kLambdaMassVsAntiLambdaMass, HistTable), GetHistType(kLambdaMassVsAntiLambdaMass, HistTable), {V0Specs[kLambdaMassVsAntiLambdaMass]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kK0shortMassVsLambdaMass, HistTable), GetHistDesc(kK0shortMassVsLambdaMass, HistTable), GetHistType(kK0shortMassVsLambdaMass, HistTable), {V0Specs[kK0shortMassVsLambdaMass]}); - mHistogramRegistry->add(qaDir + GetHistNamev2(kK0shortMassVsAntiLambdaMass, HistTable), GetHistDesc(kK0shortMassVsAntiLambdaMass, HistTable), GetHistType(kK0shortMassVsAntiLambdaMass, HistTable), {V0Specs[kK0shortMassVsAntiLambdaMass]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsEta, HistTable), getHistDesc(kPtVsEta, HistTable), getHistType(kPtVsEta, HistTable), {V0Specs[kPtVsEta]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPhi, HistTable), getHistDesc(kPtVsPhi, HistTable), getHistType(kPtVsPhi, HistTable), {V0Specs[kPtVsPhi]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPhiVsEta, HistTable), getHistDesc(kPhiVsEta, HistTable), getHistType(kPhiVsEta, HistTable), {V0Specs[kPhiVsEta]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsCosPa, HistTable), getHistDesc(kPtVsCosPa, HistTable), getHistType(kPtVsCosPa, HistTable), {V0Specs[kPtVsCosPa]}); + + mHistogramRegistry->add(qaDir + getHistNameV2(kMassLambda, HistTable), getHistDesc(kMassLambda, HistTable), getHistType(kMassLambda, HistTable), {V0Specs[kMassLambda]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kMassAntiLambda, HistTable), getHistDesc(kMassAntiLambda, HistTable), getHistType(kMassAntiLambda, HistTable), {V0Specs[kMassAntiLambda]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kMassK0short, HistTable), getHistDesc(kMassK0short, HistTable), getHistType(kMassK0short, HistTable), {V0Specs[kMassK0short]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsLambdaMass, HistTable), getHistDesc(kPtVsLambdaMass, HistTable), getHistType(kPtVsLambdaMass, HistTable), {V0Specs[kPtVsLambdaMass]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsAntiLambdaMass, HistTable), getHistDesc(kPtVsAntiLambdaMass, HistTable), getHistType(kPtVsAntiLambdaMass, HistTable), {V0Specs[kPtVsAntiLambdaMass]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsK0shortMass, HistTable), getHistDesc(kPtVsK0shortMass, HistTable), getHistType(kPtVsK0shortMass, HistTable), {V0Specs[kPtVsK0shortMass]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kLambdaMassVsAntiLambdaMass, HistTable), getHistDesc(kLambdaMassVsAntiLambdaMass, HistTable), getHistType(kLambdaMassVsAntiLambdaMass, HistTable), {V0Specs[kLambdaMassVsAntiLambdaMass]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kK0shortMassVsLambdaMass, HistTable), getHistDesc(kK0shortMassVsLambdaMass, HistTable), getHistType(kK0shortMassVsLambdaMass, HistTable), {V0Specs[kK0shortMassVsLambdaMass]}); + mHistogramRegistry->add(qaDir + getHistNameV2(kK0shortMassVsAntiLambdaMass, HistTable), getHistDesc(kK0shortMassVsAntiLambdaMass, HistTable), getHistType(kK0shortMassVsAntiLambdaMass, HistTable), {V0Specs[kK0shortMassVsAntiLambdaMass]}); } } template - void fill(T1 const& v0candidate, T2 const& /*tracks*/) + void fill(T1 const& v0candidate, T2 const& tracks) { - auto posDaughter = v0candidate.template posDau_as(); - mPosDauManager.fill(posDaughter); + mPosDauManager.fill(posDaughter, tracks); auto negDaughter = v0candidate.template negDau_as(); - mNegDauManager.fill(negDaughter); + mNegDauManager.fill(negDaughter, tracks); if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(GetHistName(kPt, HistTable)), v0candidate.pt()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(GetHistName(kEta, HistTable)), v0candidate.eta()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(GetHistName(kPhi, HistTable)), v0candidate.phi()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(GetHistName(kMass, HistTable)), v0candidate.mass()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt, HistTable)), v0candidate.pt()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kEta, HistTable)), v0candidate.eta()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kPhi, HistTable)), v0candidate.phi()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kMass, HistTable)), v0candidate.mass()); if constexpr (modes::isEqual(v0, modes::V0::kLambda) || modes::isEqual(v0, modes::V0::kAntiLambda)) { - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(GetHistName(kSign, HistTable)), v0candidate.sign()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), v0candidate.sign()); } if constexpr (modes::isEqual(v0, modes::V0::kK0short)) { - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(GetHistName(kSign, HistTable)), 0); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), 0); } } if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kCosPa, HistTable)), v0candidate.cosPa()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kDecayDauDca, HistTable)), v0candidate.dauDca()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kDecayVtxX, HistTable)), v0candidate.decayVtxX()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kDecayVtxY, HistTable)), v0candidate.decayVtxY()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kDecayVtxZ, HistTable)), v0candidate.decayVtxZ()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kDecayVtx, HistTable)), v0candidate.decayVtx()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kTransRadius, HistTable)), v0candidate.transRadius()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsEta, HistTable)), v0candidate.pt(), v0candidate.eta()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsPhi, HistTable)), v0candidate.pt(), v0candidate.phi()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kPhiVsEta, HistTable)), v0candidate.phi(), v0candidate.eta()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsCosPa, HistTable)), v0candidate.pt(), v0candidate.cosPa()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kCosPa, HistTable)), v0candidate.cosPa()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kDecayDauDca, HistTable)), v0candidate.dauDca()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxX, HistTable)), v0candidate.decayVtxX()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxY, HistTable)), v0candidate.decayVtxY()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxZ, HistTable)), v0candidate.decayVtxZ()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kDecayVtx, HistTable)), v0candidate.decayVtx()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kTransRadius, HistTable)), v0candidate.transRadius()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kPtVsEta, HistTable)), v0candidate.pt(), v0candidate.eta()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kPtVsPhi, HistTable)), v0candidate.pt(), v0candidate.phi()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kPhiVsEta, HistTable)), v0candidate.phi(), v0candidate.eta()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kPtVsCosPa, HistTable)), v0candidate.pt(), v0candidate.cosPa()); if constexpr (modes::isEqual(v0, modes::V0::kLambda) || modes::isEqual(v0, modes::V0::kAntiLambda)) { float massLambda, massAntiLambda; @@ -301,26 +300,27 @@ class V0HistManager massLambda = v0candidate.massAnti(); massAntiLambda = v0candidate.mass(); } - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kMassLambda, HistTable)), massLambda); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kMassAntiLambda, HistTable)), massAntiLambda); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kMassK0short, HistTable)), v0candidate.massK0short()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsLambdaMass, HistTable)), v0candidate.pt(), massLambda); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsAntiLambdaMass, HistTable)), v0candidate.pt(), massAntiLambda); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsK0shortMass, HistTable)), v0candidate.pt(), v0candidate.massK0short()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kLambdaMassVsAntiLambdaMass, HistTable)), massLambda, massAntiLambda); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kK0shortMassVsLambdaMass, HistTable)), v0candidate.massK0short(), massLambda); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kK0shortMassVsAntiLambdaMass, HistTable)), v0candidate.massK0short(), massAntiLambda); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kMassLambda, HistTable)), massLambda); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kMassAntiLambda, HistTable)), massAntiLambda); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kMassK0short, HistTable)), v0candidate.massK0short()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kPtVsLambdaMass, HistTable)), v0candidate.pt(), massLambda); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kPtVsAntiLambdaMass, HistTable)), v0candidate.pt(), massAntiLambda); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kPtVsK0shortMass, HistTable)), v0candidate.pt(), v0candidate.massK0short()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kLambdaMassVsAntiLambdaMass, HistTable)), massLambda, massAntiLambda); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kK0shortMassVsLambdaMass, HistTable)), v0candidate.massK0short(), massLambda); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kK0shortMassVsAntiLambdaMass, HistTable)), v0candidate.massK0short(), massAntiLambda); } + if constexpr (modes::isEqual(v0, modes::V0::kK0short)) { - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kMassLambda, HistTable)), v0candidate.massLambda()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kMassAntiLambda, HistTable)), v0candidate.massAntiLambda()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kMassK0short, HistTable)), v0candidate.mass()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsLambdaMass, HistTable)), v0candidate.pt(), v0candidate.massLambda()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsAntiLambdaMass, HistTable)), v0candidate.pt(), v0candidate.massAntiLambda()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kPtVsK0shortMass, HistTable)), v0candidate.pt(), v0candidate.mass()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kLambdaMassVsAntiLambdaMass, HistTable)), v0candidate.massLambda(), v0candidate.massAntiLambda()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kK0shortMassVsLambdaMass, HistTable)), v0candidate.mass(), v0candidate.massLambda()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(GetHistName(kK0shortMassVsAntiLambdaMass, HistTable)), v0candidate.mass(), v0candidate.massAntiLambda()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kMassLambda, HistTable)), v0candidate.massLambda()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kMassAntiLambda, HistTable)), v0candidate.massAntiLambda()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kMassK0short, HistTable)), v0candidate.mass()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kPtVsLambdaMass, HistTable)), v0candidate.pt(), v0candidate.massLambda()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kPtVsAntiLambdaMass, HistTable)), v0candidate.pt(), v0candidate.massAntiLambda()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kPtVsK0shortMass, HistTable)), v0candidate.pt(), v0candidate.mass()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kLambdaMassVsAntiLambdaMass, HistTable)), v0candidate.massLambda(), v0candidate.massAntiLambda()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kK0shortMassVsLambdaMass, HistTable)), v0candidate.mass(), v0candidate.massLambda()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kK0shortMassVsAntiLambdaMass, HistTable)), v0candidate.mass(), v0candidate.massAntiLambda()); } } } diff --git a/PWGCF/Femto/DataModel/FemtoTables.h b/PWGCF/Femto/DataModel/FemtoTables.h index 2d288f13cbb..fb0d7d85a47 100644 --- a/PWGCF/Femto/DataModel/FemtoTables.h +++ b/PWGCF/Femto/DataModel/FemtoTables.h @@ -31,7 +31,6 @@ namespace o2::aod { - namespace femtocollisions { DECLARE_SOA_COLUMN(CollisionMask, collisionMask, femtodatatypes::CollisionMaskType); //! Bitmask for collision selections @@ -55,8 +54,8 @@ DECLARE_SOA_TABLE_STAGED_VERSIONED(FCols_001, "FCOL", 1, //! femto collisions femtocollisions::Cent, femtocollisions::MagField); using FCols = FCols_001; +using FCol = FCols::iterator; using StoredFCols = StoredFCols_001; -using FCol = FCols::iterator; // needed so we can define the index column further down properly // table for collisions selections DECLARE_SOA_TABLE_STAGED_VERSIONED(FColMasks_001, "FCOLMASK", 1, //! track masks @@ -101,13 +100,14 @@ namespace femtobase namespace stored { // static columns -DECLARE_SOA_INDEX_COLUMN(FCol, fCol); //! collision index of femto collision table -DECLARE_SOA_COLUMN(SignedPt, signedPt, float); //! signed pt -DECLARE_SOA_COLUMN(Pt, pt, float); //! pt -DECLARE_SOA_COLUMN(Eta, eta, float); //! eta -DECLARE_SOA_COLUMN(Phi, phi, float); //! phi -DECLARE_SOA_COLUMN(Mass, mass, float); //! mass of particle -DECLARE_SOA_COLUMN(MassAnti, massAnti, float); //! mass of antiparticle +// +DECLARE_SOA_INDEX_COLUMN(Collision, collision); //! collision index of femto collision table +DECLARE_SOA_COLUMN(SignedPt, signedPt, float); //! signed pt +DECLARE_SOA_COLUMN(Pt, pt, float); //! pt +DECLARE_SOA_COLUMN(Eta, eta, float); //! eta +DECLARE_SOA_COLUMN(Phi, phi, float); //! phi +DECLARE_SOA_COLUMN(Mass, mass, float); //! mass of particle +DECLARE_SOA_COLUMN(MassAnti, massAnti, float); //! mass of antiparticle } // namespace stored namespace dynamic @@ -227,7 +227,7 @@ DECLARE_SOA_DYNAMIC_COLUMN(TpctofNSigmaHe, tpctofNSigmaHe, [](float tpc, float t // table for basic track information DECLARE_SOA_TABLE_STAGED_VERSIONED(FTracks_001, "FTRACK", 1, //! femto tracks o2::soa::Index<>, - femtobase::stored::FColId, + femtobase::stored::CollisionId, femtobase::stored::SignedPt, femtobase::stored::Eta, femtobase::stored::Phi, @@ -239,6 +239,7 @@ DECLARE_SOA_TABLE_STAGED_VERSIONED(FTracks_001, "FTRACK", 1, //! femto tracks femtobase::dynamic::Pz, femtobase::dynamic::Theta); using FTracks = FTracks_001; +using FTrack = FTracks::iterator; using StoredFTracks = StoredFTracks_001; // table for track selections and PID selections @@ -337,7 +338,7 @@ DECLARE_SOA_INDEX_COLUMN_FULL(NegDau, negDau, int32_t, FTracks, "_NegDau"); //! // table for phis DECLARE_SOA_TABLE_STAGED_VERSIONED(FPhis_001, "FPHI", 1, //! femto phis o2::soa::Index<>, - femtobase::stored::FColId, + femtobase::stored::CollisionId, femtobase::stored::Pt, femtobase::stored::Eta, femtobase::stored::Phi, @@ -357,7 +358,7 @@ using FPhiMasks = FPhiMasks_001; // table for kstars DECLARE_SOA_TABLE_STAGED_VERSIONED(FKstar0s_001, "FKSTAR0", 1, //! femto k0star o2::soa::Index<>, - femtobase::stored::FColId, + femtobase::stored::CollisionId, femtobase::stored::SignedPt, //! +1 for k0star and -1 for k0starbar femtobase::stored::Eta, femtobase::stored::Phi, @@ -378,7 +379,7 @@ using FKstar0Masks = FKstar0Masks_001; DECLARE_SOA_TABLE_STAGED_VERSIONED(FRho0s_001, "FRHO0", 1, //! femto rho0s o2::soa::Index<>, - femtobase::stored::FColId, + femtobase::stored::CollisionId, femtobase::stored::Pt, femtobase::stored::Eta, femtobase::stored::Phi, @@ -424,7 +425,7 @@ DECLARE_SOA_INDEX_COLUMN_FULL(NegDau, negDau, int32_t, FTracks, "_NegDau"); //! // table for basic lambda information DECLARE_SOA_TABLE_STAGED_VERSIONED(FLambdas_001, "FLAMBDA", 1, //! femto lambdas o2::soa::Index<>, - femtobase::stored::FColId, + femtobase::stored::CollisionId, femtobase::stored::SignedPt, // use sign to differentiate between lambda (+1) and antilambda (-1) femtobase::stored::Eta, femtobase::stored::Phi, @@ -462,7 +463,7 @@ using FLambdaExtras = FLambdaExtras_001; // table for basic k0short information DECLARE_SOA_TABLE_STAGED_VERSIONED(FK0shorts_001, "FK0SHORT", 1, //! femto k0shorts o2::soa::Index<>, - femtobase::stored::FColId, + femtobase::stored::CollisionId, femtobase::stored::Pt, femtobase::stored::Eta, femtobase::stored::Phi, @@ -516,7 +517,7 @@ DECLARE_SOA_INDEX_COLUMN_FULL(ChaDau, chaDau, int32_t, FTracks, "_ChaDau"); //! // table for basic sigma minus information DECLARE_SOA_TABLE_STAGED_VERSIONED(FSigmas_001, "FSIGMA", 1, o2::soa::Index<>, - femtobase::stored::FColId, // use sign to differentiate between sigma minus (-1) and anti sigma minus (+1) + femtobase::stored::CollisionId, // use sign to differentiate between sigma minus (-1) and anti sigma minus (+1) femtobase::stored::SignedPt, femtobase::stored::Eta, femtobase::stored::Phi, @@ -570,7 +571,7 @@ DECLARE_SOA_INDEX_COLUMN_FULL(Bachelor, bachelor, int32_t, FTracks, "_Bachelor") DECLARE_SOA_TABLE_STAGED_VERSIONED(FXis_001, "FXI", 1, //! femto xis o2::soa::Index<>, - femtobase::stored::FColId, + femtobase::stored::CollisionId, femtobase::stored::SignedPt, femtobase::stored::Eta, femtobase::stored::Phi, @@ -604,7 +605,7 @@ using FXiExtras = FXiExtras_001; DECLARE_SOA_TABLE_STAGED_VERSIONED(FOmegas_001, "FOMEGA", 1, //! femto omegas o2::soa::Index<>, - femtobase::stored::FColId, + femtobase::stored::CollisionId, femtobase::stored::SignedPt, femtobase::stored::Eta, femtobase::stored::Phi, diff --git a/PWGCF/Femto/TableProducer/femtoProducer.cxx b/PWGCF/Femto/TableProducer/femtoProducer.cxx index c21281d0616..457706ac058 100644 --- a/PWGCF/Femto/TableProducer/femtoProducer.cxx +++ b/PWGCF/Femto/TableProducer/femtoProducer.cxx @@ -37,7 +37,9 @@ #include "Framework/AnalysisTask.h" #include "Framework/Configurable.h" #include "Framework/Expressions.h" +#include "Framework/HistogramRegistry.h" #include "Framework/InitContext.h" +#include "Framework/OutputObjHeader.h" #include "Framework/runDataProcessing.h" #include "fairlogger/Logger.h" @@ -195,29 +197,35 @@ struct FemtoProducer { LOG(fatal) << "At least one cascade table is enabled, but wrong process function is enabled. Breaking..."; } if ((lambdaBuilder.fillAnyTable() || antilambdaBuilder.fillAnyTable() || k0shortBuilder.fillAnyTable()) && (!doprocessTracksV0sCascadesRun3pp && !doprocessTracksV0sRun3pp && !doprocessTracksV0sCascadesKinksRun3pp)) { - LOG(info) << "At least one v0 table is enabled, but wrong process function is enabled. Breaking..."; + LOG(fatal) << "At least one v0 table is enabled, but wrong process function is enabled. Breaking..."; } - if (sigmaBuilder.fillAnyTable() && !doprocessTracksKinksRun3pp && !doprocessTracksV0sCascadesKinksRun3pp) { + if (sigmaBuilder.fillAnyTable() && (!doprocessTracksKinksRun3pp && !doprocessTracksV0sCascadesKinksRun3pp)) { LOG(fatal) << "At least one kink table is enabled, but wrong process function is enabled. Breaking..."; } } - // Core implementation, parameterized by builders to call - template - void processTracks(T1 const& col, T2 const& /* bcs*/, T3 const& tracks, T4 const& tracksWithItsPid) + // Core implementations + template + bool processCollisions(T1 const& col, T2 const& /* bcs*/, T3 const& tracks) { auto bc = col.template bc_as(); collisionBuilder.initCollision(bc, col, tracks, ccdb, hRegistry); if (!collisionBuilder.checkCollision(col)) { - return; + return false; } collisionBuilder.fillCollision(collisionBuilderProducts, col); + return true; + } - // tracks - indexMapTracks.clear(); + template + void processTracks(T1 const& tracksWithItsPid) + { trackBuilder.fillTracks(tracksWithItsPid, trackBuilderProducts, collisionBuilderProducts, indexMapTracks); + } - // resonances + template + void processResonances(T1 const& col, T2 const& /*tracks*/) + { auto groupPositiveTracks = partitionPositiveDaughters->sliceByCached(o2::aod::track::collisionId, col.globalIndex(), cache); auto groupNegativeTracks = partitionNegativeDaughters->sliceByCached(o2::aod::track::collisionId, col.globalIndex(), cache); rho0Builder.fillResonances(collisionBuilderProducts, trackBuilderProducts, twoTrackResonanceBuilderProducts, groupPositiveTracks, groupNegativeTracks, trackBuilder, indexMapTracks); @@ -227,40 +235,25 @@ struct FemtoProducer { } // add v0s - template - void processTracksV0s(T1 const& col, T2 const& bcs, T3 const& tracks, T4 const& tracksWithItsPid, T5 const& v0s) + template + void processV0s(T1 const& tracks, T2 const& v0s) { - processTracks(col, bcs, tracks, tracksWithItsPid); lambdaBuilder.fillV0s(collisionBuilderProducts, trackBuilderProducts, v0builderProducts, v0s, tracks, trackBuilder, indexMapTracks); antilambdaBuilder.fillV0s(collisionBuilderProducts, trackBuilderProducts, v0builderProducts, v0s, tracks, trackBuilder, indexMapTracks); k0shortBuilder.fillV0s(collisionBuilderProducts, trackBuilderProducts, v0builderProducts, v0s, tracks, trackBuilder, indexMapTracks); } // add kinks - template - void processTracksKinks(T1 const& col, T2 const& bcs, T3 const& tracks, T4 const& tracksWithItsPid, T5 const& kinks) + template + void processKinks(T1 const& tracks, T2 const& kinks) { - processTracks(col, bcs, tracks, tracksWithItsPid); sigmaBuilder.fillKinks(collisionBuilderProducts, trackBuilderProducts, kinkBuilderProducts, kinks, tracks, trackBuilder, indexMapTracks); } // add cascades - template - void processTracksV0sCascades(T1 const& col, T2 const& bcs, T3 const& tracks, T4 const& tracksWithItsPid, T5 const& v0s, T6 const& cascades) + template + void processCascades(T1 const& col, T2 const& tracks, T3 const& cascades) { - processTracksV0s(col, bcs, tracks, tracksWithItsPid, v0s); - xiBuilder.fillCascades(collisionBuilderProducts, trackBuilderProducts, cascadeBuilderProducts, - cascades, tracks, col, trackBuilder, indexMapTracks); - omegaBuilder.fillCascades(collisionBuilderProducts, trackBuilderProducts, cascadeBuilderProducts, - cascades, tracks, col, trackBuilder, indexMapTracks); - } - - // add kinks - template - void processTracksV0sCascadesKinks(T1 const& col, T2 const& bcs, T3 const& tracks, T4 const& tracksWithItsPid, T5 const& v0s, T6 const& cascades, T7 const& kinks) - { - processTracksV0s(col, bcs, tracks, tracksWithItsPid, v0s); - sigmaBuilder.fillKinks(collisionBuilderProducts, trackBuilderProducts, kinkBuilderProducts, kinks, tracks, trackBuilder, indexMapTracks); xiBuilder.fillCascades(collisionBuilderProducts, trackBuilderProducts, cascadeBuilderProducts, cascades, tracks, col, trackBuilder, indexMapTracks); omegaBuilder.fillCascades(collisionBuilderProducts, trackBuilderProducts, cascadeBuilderProducts, @@ -272,10 +265,14 @@ struct FemtoProducer { BCsWithTimestamps const& bcs, consumeddata::Run3FullPidTracks const& tracks) { - // its pid information is generated dynamically, so we need to add it here + if (!processCollisions(col, bcs, tracks)) { + return; + } + indexMapTracks.clear(); auto tracksWithItsPid = o2::soa::Attach(tracks); - processTracks(col, bcs, tracks, tracksWithItsPid); + processTracks(tracksWithItsPid); + processResonances(col, tracks); } PROCESS_SWITCH(FemtoProducer, processTracksRun3pp, "Process tracks", true); @@ -285,10 +282,15 @@ struct FemtoProducer { consumeddata::Run3FullPidTracks const& tracks, consumeddata::Run3PpVzeros const& v0s) { - // its pid information is generated dynamically, so we need to add it here + if (!processCollisions(col, bcs, tracks)) { + return; + } + indexMapTracks.clear(); auto tracksWithItsPid = o2::soa::Attach(tracks); - processTracksV0s(col, bcs, tracks, tracksWithItsPid, v0s); + processTracks(tracksWithItsPid); + processResonances(col, tracks); + processV0s(tracks, v0s); }; PROCESS_SWITCH(FemtoProducer, processTracksV0sRun3pp, "Process tracks and v0s", false); @@ -298,10 +300,15 @@ struct FemtoProducer { consumeddata::Run3FullPidTracks const& tracks, consumeddata::Run3PpKinks const& kinks) { - // its pid information is generated dynamically, so we need to add it here + if (!processCollisions(col, bcs, tracks)) { + return; + } + indexMapTracks.clear(); auto tracksWithItsPid = o2::soa::Attach(tracks); - processTracksKinks(col, bcs, tracks, tracksWithItsPid, kinks); + processTracks(tracksWithItsPid); + processResonances(col, tracks); + processKinks(tracks, kinks); } PROCESS_SWITCH(FemtoProducer, processTracksKinksRun3pp, "Process tracks and kinks", false); @@ -312,10 +319,16 @@ struct FemtoProducer { consumeddata::Run3PpVzeros const& v0s, consumeddata::Run3PpCascades const& cascades) { - // its pid information is generated dynamically, so we need to add it here + if (!processCollisions(col, bcs, tracks)) { + return; + } + indexMapTracks.clear(); auto tracksWithItsPid = o2::soa::Attach(tracks); - processTracksV0sCascades(col, bcs, tracks, tracksWithItsPid, v0s, cascades); + processTracks(tracksWithItsPid); + processResonances(col, tracks); + processV0s(tracks, v0s); + processCascades(col, tracks, cascades); } PROCESS_SWITCH(FemtoProducer, processTracksV0sCascadesRun3pp, "Provide Tracks, V0s and Cascades for Run3", false); @@ -327,10 +340,17 @@ struct FemtoProducer { consumeddata::Run3PpCascades const& cascades, consumeddata::Run3PpKinks const& kinks) { - // its pid information is generated dynamically, so we need to add it here + if (!processCollisions(col, bcs, tracks)) { + return; + } + indexMapTracks.clear(); auto tracksWithItsPid = o2::soa::Attach(tracks); - processTracksV0sCascadesKinks(col, bcs, tracks, tracksWithItsPid, v0s, cascades, kinks); + processTracks(tracksWithItsPid); + processResonances(col, tracks); + processV0s(tracks, v0s); + processKinks(tracks, kinks); + processCascades(col, tracks, cascades); } PROCESS_SWITCH(FemtoProducer, processTracksV0sCascadesKinksRun3pp, "Provide Tracks, V0s and Cascades for Run3", false); }; diff --git a/PWGCF/Femto/TableProducer/femtoProducerDerivedToDerived.cxx b/PWGCF/Femto/TableProducer/femtoProducerDerivedToDerived.cxx index 13893bf3f5a..bbeac637531 100644 --- a/PWGCF/Femto/TableProducer/femtoProducerDerivedToDerived.cxx +++ b/PWGCF/Femto/TableProducer/femtoProducerDerivedToDerived.cxx @@ -13,14 +13,11 @@ /// \brief Tasks that produces the femto tables from derived data /// \author Anton Riedel, TU München, anton.riedel@tum.de -#include "PWGCF/Femto/Core/cascadeBuilder.h" #include "PWGCF/Femto/Core/collisionBuilder.h" -#include "PWGCF/Femto/Core/kinkBuilder.h" -#include "PWGCF/Femto/Core/modes.h" #include "PWGCF/Femto/Core/partitions.h" #include "PWGCF/Femto/Core/trackBuilder.h" -#include "PWGCF/Femto/Core/twoTrackResonanceBuilder.h" #include "PWGCF/Femto/Core/v0Builder.h" +#include "PWGCF/Femto/DataModel/FemtoTables.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisHelpers.h" @@ -70,7 +67,7 @@ struct FemtoProducerDerivedToDerived { Partition trackPartition1 = MAKE_TRACK_PARTITION(trackSelections1); Partition trackPartition2 = MAKE_TRACK_PARTITION(trackSelections2); - Preslice perColTracks = femtobase::stored::fColId; + Preslice perColTracks = femtobase::stored::collisionId; // v0 builder v0builder::V0BuilderDerivedToDerived v0Builder; @@ -79,11 +76,11 @@ struct FemtoProducerDerivedToDerived { v0builder::ConfLambdaSelection1 lambdaSelection1; Partition lambdaPartition = MAKE_LAMBDA_PARTITION(lambdaSelection1); - Preslice perColLambdas = femtobase::stored::fColId; + Preslice perColLambdas = femtobase::stored::collisionId; v0builder::ConfK0shortSelection1 k0shortSelection1; Partition k0shortPartition = MAKE_K0SHORT_PARTITION(k0shortSelection1); - Preslice perColK0shorts = femtobase::stored::fColId; + Preslice perColK0shorts = femtobase::stored::collisionId; std::unordered_map indexMapTracks; // for mapping tracks to lambdas, cascades and resonances diff --git a/PWGCF/Femto/Tasks/CMakeLists.txt b/PWGCF/Femto/Tasks/CMakeLists.txt index 8fdc9dacae4..1cee38e9eee 100644 --- a/PWGCF/Femto/Tasks/CMakeLists.txt +++ b/PWGCF/Femto/Tasks/CMakeLists.txt @@ -58,3 +58,8 @@ o2physics_add_dpl_workflow(femto-pair-track-kink SOURCES femtoPairTrackKink.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(femto-pair-v0-v0 + SOURCES femtoPairV0V0.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGCF/Femto/Tasks/femtoCascadeQa.cxx b/PWGCF/Femto/Tasks/femtoCascadeQa.cxx index 984094e065e..a9cfcc78b9d 100644 --- a/PWGCF/Femto/Tasks/femtoCascadeQa.cxx +++ b/PWGCF/Femto/Tasks/femtoCascadeQa.cxx @@ -68,7 +68,7 @@ struct FemtoCascadeQa { // setup for xis cascadebuilder::ConfXiSelection confXiSelection; Partition xiPartition = MAKE_CASCADE_PARTITION(confXiSelection); - Preslice preColXis = aod::femtobase::stored::fColId; + Preslice preColXis = aod::femtobase::stored::collisionId; cascadehistmanager::ConfXiBinning confXiBinning; cascadehistmanager::ConfXiQaBinning confXiQaBinning; @@ -84,7 +84,7 @@ struct FemtoCascadeQa { // setup for omegas cascadebuilder::ConfOmegaSelection confOmegaSelection; Partition omegaPartition = MAKE_CASCADE_PARTITION(confOmegaSelection); - Preslice preColOmegas = aod::femtobase::stored::fColId; + Preslice preColOmegas = aod::femtobase::stored::collisionId; cascadehistmanager::ConfOmegaBinning confOmegaBinning; cascadehistmanager::ConfOmegaQaBinning confOmegaQaBinning; @@ -135,7 +135,7 @@ struct FemtoCascadeQa { void processXis(FilteredCollision const& col, Xis const& /*xis*/, Tracks const& tracks) { colHistManager.fill(col); - auto xiSlice = xiPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); + auto xiSlice = xiPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); for (auto const& xi : xiSlice) { xiHistManager.fill(xi, tracks); } @@ -145,7 +145,7 @@ struct FemtoCascadeQa { void processOmegas(FilteredCollision const& col, Omegas const& /*omegas*/, Tracks const& tracks) { colHistManager.fill(col); - auto omegaSlice = omegaPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); + auto omegaSlice = omegaPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); for (auto const& omega : omegaSlice) { omegaHistManager.fill(omega, tracks); } diff --git a/PWGCF/Femto/Tasks/femtoKinkQa.cxx b/PWGCF/Femto/Tasks/femtoKinkQa.cxx index febd696e3fe..2b4316159f8 100644 --- a/PWGCF/Femto/Tasks/femtoKinkQa.cxx +++ b/PWGCF/Femto/Tasks/femtoKinkQa.cxx @@ -71,7 +71,7 @@ struct FemtoKinkQa { kinkbuilder::ConfSigmaSelection1 confSigmaSelection; Partition sigmaPartition = MAKE_SIGMA_PARTITION(confSigmaSelection); - Preslice perColSigmas = aod::femtobase::stored::fColId; + Preslice perColSigmas = aod::femtobase::stored::collisionId; kinkhistmanager::ConfSigmaBinning1 confSigmaBinning; kinkhistmanager::ConfSigmaQaBinning1 confSigmaQaBinning; @@ -103,7 +103,7 @@ struct FemtoKinkQa { void processSigma(FilteredCollision const& col, Sigmas const& /*sigmas*/, Tracks const& tracks) { colHistManager.fill(col); - auto sigmaSlice = sigmaPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); + auto sigmaSlice = sigmaPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); for (auto const& sigma : sigmaSlice) { sigmaHistManager.fill(sigma, tracks); } diff --git a/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx b/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx index 8884a1edc01..f033eca7dc8 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx @@ -27,10 +27,14 @@ #include "PWGCF/Femto/DataModel/FemtoTables.h" #include "Framework/ASoA.h" +#include "Framework/AnalysisHelpers.h" #include "Framework/AnalysisTask.h" +#include "Framework/BinningPolicy.h" #include "Framework/Configurable.h" #include "Framework/Expressions.h" #include "Framework/HistogramRegistry.h" +#include "Framework/InitContext.h" +#include "Framework/OutputObjHeader.h" #include "Framework/runDataProcessing.h" #include @@ -67,7 +71,7 @@ struct FemtoPairTrackCascade { trackbuilder::ConfTrackSelection1 trackSelection; trackhistmanager::ConfTrackBinning1 confTrackBinning; Partition trackPartition = MAKE_TRACK_PARTITION(trackSelection); - Preslice perColTracks = aod::femtobase::stored::fColId; + Preslice perColTracks = aod::femtobase::stored::collisionId; // setup for daughters/bachelor trackhistmanager::ConfCascadePosDauBinning confPosDauBinning; @@ -78,13 +82,13 @@ struct FemtoPairTrackCascade { cascadebuilder::ConfXiSelection xiSelection; cascadehistmanager::ConfXiBinning confXiBinning; Partition xiPartition = MAKE_CASCADE_PARTITION(xiSelection); - Preslice perColXis = aod::femtobase::stored::fColId; + Preslice perColXis = aod::femtobase::stored::collisionId; // setup omegas cascadebuilder::ConfOmegaSelection omegaSelection; cascadehistmanager::ConfOmegaBinning confOmegaBinning; Partition omegaPartition = MAKE_CASCADE_PARTITION(omegaSelection); - Preslice perColOmegas = aod::femtobase::stored::fColId; + Preslice perColOmegas = aod::femtobase::stored::collisionId; // setup pairs pairhistmanager::ConfPairBinning confPairBinning; diff --git a/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx b/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx index 2c1448a6764..e5a049824d6 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx @@ -28,10 +28,14 @@ #include "PWGCF/Femto/DataModel/FemtoTables.h" #include "Framework/ASoA.h" +#include "Framework/AnalysisHelpers.h" #include "Framework/AnalysisTask.h" +#include "Framework/BinningPolicy.h" #include "Framework/Configurable.h" #include "Framework/Expressions.h" #include "Framework/HistogramRegistry.h" +#include "Framework/InitContext.h" +#include "Framework/OutputObjHeader.h" #include "Framework/runDataProcessing.h" #include @@ -67,7 +71,7 @@ struct FemtoPairTrackKink { trackbuilder::ConfTrackSelection1 trackSelection; trackhistmanager::ConfTrackBinning1 confTrackBinning; Partition trackPartition = MAKE_TRACK_PARTITION(trackSelection); - Preslice perColTracks = aod::femtobase::stored::fColId; + Preslice perColTracks = aod::femtobase::stored::collisionId; // setup for daughters trackhistmanager::ConfKinkChaDauBinning confChaDauBinning; @@ -76,7 +80,7 @@ struct FemtoPairTrackKink { kinkbuilder::ConfSigmaSelection1 sigmaSelection; kinkhistmanager::ConfSigmaBinning1 confSigmaBinning; Partition sigmaPartition = MAKE_SIGMA_PARTITION(sigmaSelection); - Preslice perColSigmas = aod::femtobase::stored::fColId; + Preslice perColSigmas = aod::femtobase::stored::collisionId; // setup pairs pairhistmanager::ConfPairBinning confPairBinning; diff --git a/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx b/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx index 511bd4f8c1c..1e96f2617d5 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx @@ -16,17 +16,23 @@ #include "PWGCF/Femto/Core/closePairRejection.h" #include "PWGCF/Femto/Core/collisionBuilder.h" #include "PWGCF/Femto/Core/collisionHistManager.h" +#include "PWGCF/Femto/Core/modes.h" #include "PWGCF/Femto/Core/pairBuilder.h" +#include "PWGCF/Femto/Core/pairHistManager.h" #include "PWGCF/Femto/Core/partitions.h" #include "PWGCF/Femto/Core/trackBuilder.h" #include "PWGCF/Femto/Core/trackHistManager.h" #include "PWGCF/Femto/DataModel/FemtoTables.h" #include "Framework/ASoA.h" +#include "Framework/AnalysisHelpers.h" #include "Framework/AnalysisTask.h" +#include "Framework/BinningPolicy.h" #include "Framework/Configurable.h" #include "Framework/Expressions.h" #include "Framework/HistogramRegistry.h" +#include "Framework/InitContext.h" +#include "Framework/OutputObjHeader.h" #include "Framework/runDataProcessing.h" #include @@ -66,7 +72,7 @@ struct FemtoPairTrackTrack { Partition trackPartition1 = MAKE_TRACK_PARTITION(trackSelections1); Partition trackPartition2 = MAKE_TRACK_PARTITION(trackSelections2); - Preslice perColReco = aod::femtobase::stored::fColId; + Preslice perColReco = aod::femtobase::stored::collisionId; // setup pairs pairhistmanager::ConfPairBinning confPairBinning; diff --git a/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx b/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx index a9b534c3488..516499cd801 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx @@ -27,10 +27,14 @@ #include "PWGCF/Femto/DataModel/FemtoTables.h" #include "Framework/ASoA.h" +#include "Framework/AnalysisHelpers.h" #include "Framework/AnalysisTask.h" +#include "Framework/BinningPolicy.h" #include "Framework/Configurable.h" #include "Framework/Expressions.h" #include "Framework/HistogramRegistry.h" +#include "Framework/InitContext.h" +#include "Framework/OutputObjHeader.h" #include "Framework/runDataProcessing.h" #include @@ -68,7 +72,7 @@ struct FemtoPairTrackTwoTrackResonance { trackbuilder::ConfTrackSelection1 trackSelection; trackhistmanager::ConfTrackBinning1 confTrackBinning; Partition trackPartition = MAKE_TRACK_PARTITION(trackSelection); - Preslice perColTracks = aod::femtobase::stored::fColId; + Preslice perColTracks = aod::femtobase::stored::collisionId; // setup for daughters trackhistmanager::ConfResonancePosDauBinning confPosDauBinning; @@ -78,19 +82,19 @@ struct FemtoPairTrackTwoTrackResonance { twotrackresonancebuilder::ConfPhiSelection phiSelection; twotrackresonancehistmanager::ConfPhiBinning confPhiBinning; Partition phiPartition = MAKE_RESONANCE_0_PARTITON(phiSelection); - Preslice perColPhis = aod::femtobase::stored::fColId; + Preslice perColPhis = aod::femtobase::stored::collisionId; // setup kstar0 twotrackresonancebuilder::ConfKstar0Selection kstar0Selection; twotrackresonancehistmanager::ConfKstar0Binning confKstar0Binning; Partition kstar0Partition = MAKE_RESONANCE_1_PARTITON(kstar0Selection); - Preslice perColKstar0s = aod::femtobase::stored::fColId; + Preslice perColKstar0s = aod::femtobase::stored::collisionId; // rho0s twotrackresonancebuilder::ConfRho0Selection rho0Selection; twotrackresonancehistmanager::ConfRho0Binning confRho0Binning; Partition rho0Partition = MAKE_RESONANCE_0_PARTITON(rho0Selection); - Preslice perColRho0s = aod::femtobase::stored::fColId; + Preslice perColRho0s = aod::femtobase::stored::collisionId; // setup pairs pairhistmanager::ConfPairBinning confPairBinning; diff --git a/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx b/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx index 6fc0e83060a..b792421c058 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx @@ -27,10 +27,14 @@ #include "PWGCF/Femto/DataModel/FemtoTables.h" #include "Framework/ASoA.h" +#include "Framework/AnalysisHelpers.h" #include "Framework/AnalysisTask.h" +#include "Framework/BinningPolicy.h" #include "Framework/Configurable.h" #include "Framework/Expressions.h" #include "Framework/HistogramRegistry.h" +#include "Framework/InitContext.h" +#include "Framework/OutputObjHeader.h" #include "Framework/runDataProcessing.h" #include @@ -67,7 +71,7 @@ struct FemtoPairTrackV0 { trackbuilder::ConfTrackSelection1 trackSelection; trackhistmanager::ConfTrackBinning1 confTrackBinning; Partition trackPartition = MAKE_TRACK_PARTITION(trackSelection); - Preslice perColTracks = aod::femtobase::stored::fColId; + Preslice perColTracks = aod::femtobase::stored::collisionId; // setup for daughters trackhistmanager::ConfV0PosDauBinning confPosDauBinning; @@ -77,13 +81,13 @@ struct FemtoPairTrackV0 { v0builder::ConfLambdaSelection1 lambdaSelection; v0histmanager::ConfLambdaBinning1 confLambdaBinning; Partition lambdaPartition = MAKE_LAMBDA_PARTITION(lambdaSelection); - Preslice perColLambdas = aod::femtobase::stored::fColId; + Preslice perColLambdas = aod::femtobase::stored::collisionId; // setup k0shorts v0builder::ConfK0shortSelection1 k0shortSelection; v0histmanager::ConfK0shortBinning1 confK0shortBinning; Partition k0shortPartition = MAKE_K0SHORT_PARTITION(k0shortSelection); - Preslice perColk0shorts = aod::femtobase::stored::fColId; + Preslice perColk0shorts = aod::femtobase::stored::collisionId; // setup pairs pairhistmanager::ConfPairBinning confPairBinning; @@ -91,8 +95,8 @@ struct FemtoPairTrackV0 { pairbuilder::PairTrackV0Builder< trackhistmanager::PrefixTrack1, v0histmanager::PrefixLambda1, - trackhistmanager::PrefixV0PosDaughter, - trackhistmanager::PrefixV0NegDaughter, + trackhistmanager::PrefixV0PosDaughter1, + trackhistmanager::PrefixV0NegDaughter1, pairhistmanager::PrefixTrackV0Se, pairhistmanager::PrefixTrackV0Me, closepairrejection::PrefixTrackV0Se, @@ -104,8 +108,8 @@ struct FemtoPairTrackV0 { pairbuilder::PairTrackV0Builder< trackhistmanager::PrefixTrack1, v0histmanager::PrefixK0short1, - trackhistmanager::PrefixV0PosDaughter, - trackhistmanager::PrefixV0NegDaughter, + trackhistmanager::PrefixV0PosDaughter1, + trackhistmanager::PrefixV0NegDaughter1, pairhistmanager::PrefixTrackV0Se, pairhistmanager::PrefixTrackV0Me, closepairrejection::PrefixTrackV0Se, diff --git a/PWGCF/Femto/Tasks/femtoPairV0V0.cxx b/PWGCF/Femto/Tasks/femtoPairV0V0.cxx new file mode 100644 index 00000000000..0f2da302f7e --- /dev/null +++ b/PWGCF/Femto/Tasks/femtoPairV0V0.cxx @@ -0,0 +1,204 @@ +// Copyright 2019-2025 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 femtoPairV0V0.cxx +/// \brief Tasks that computes correlation between two v0s +/// \author Anton Riedel, TU München, anton.riedel@cern.ch + +#include "PWGCF/Femto/Core/closePairRejection.h" +#include "PWGCF/Femto/Core/collisionBuilder.h" +#include "PWGCF/Femto/Core/collisionHistManager.h" +#include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/pairBuilder.h" +#include "PWGCF/Femto/Core/pairHistManager.h" +#include "PWGCF/Femto/Core/partitions.h" +#include "PWGCF/Femto/Core/trackBuilder.h" +#include "PWGCF/Femto/Core/trackHistManager.h" +#include "PWGCF/Femto/Core/v0Builder.h" +#include "PWGCF/Femto/Core/v0HistManager.h" +#include "PWGCF/Femto/DataModel/FemtoTables.h" + +#include "Framework/ASoA.h" +#include "Framework/AnalysisHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/BinningPolicy.h" +#include "Framework/Configurable.h" +#include "Framework/Expressions.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/InitContext.h" +#include "Framework/OutputObjHeader.h" +#include "Framework/runDataProcessing.h" + +#include +#include + +using namespace o2; +using namespace o2::aod; +using namespace o2::soa; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::analysis::femto; + +struct FemtoPairV0V0 { + + // setup tables + using Collisions = Join; + using Collision = Collisions::iterator; + + using FilteredCollisions = o2::soa::Filtered; + using FilteredCollision = FilteredCollisions::iterator; + + using Tracks = o2::soa::Join; + using Lambdas = o2::soa::Join; + using K0shorts = o2::soa::Join; + + SliceCache cache; + + // setup collisions + collisionbuilder::ConfCollisionSelection collisionSelection; + Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); + colhistmanager::ConfCollisionBinning confCollisionBinning; + + // setup for daughters + trackhistmanager::ConfV0PosDauBinning confPosDauBinning; + trackhistmanager::ConfV0NegDauBinning confNegDauBinning; + + // setup lambdas + v0builder::ConfLambdaSelection1 lambdaSelection; + v0histmanager::ConfLambdaBinning1 confLambdaBinning; + Partition lambdaPartition = MAKE_LAMBDA_PARTITION(lambdaSelection); + Preslice perColLambdas = aod::femtobase::stored::collisionId; + + // setup k0shorts + v0builder::ConfK0shortSelection1 k0shortSelection; + v0histmanager::ConfK0shortBinning1 confK0shortBinning; + Partition k0shortPartition = MAKE_K0SHORT_PARTITION(k0shortSelection); + Preslice perColk0shorts = aod::femtobase::stored::collisionId; + + // setup pairs + pairhistmanager::ConfPairBinning confPairBinning; + + pairbuilder::PairV0V0Builder< + v0histmanager::PrefixLambda1, + trackhistmanager::PrefixV0PosDaughter1, + trackhistmanager::PrefixV0NegDaughter2, + v0histmanager::PrefixLambda2, + trackhistmanager::PrefixV0PosDaughter1, + trackhistmanager::PrefixV0NegDaughter2, + pairhistmanager::PrefixV0V0Se, + pairhistmanager::PrefixV0V0Me, + closepairrejection::PrefixV0V0PosSe, + closepairrejection::PrefixV0V0NegSe, + closepairrejection::PrefixV0V0PosMe, + closepairrejection::PrefixV0V0NegMe, + modes::V0::kLambda, + modes::V0::kLambda, + modes::Mode::kAnalysis> + pairLambdaLambdaBuilder; + + pairbuilder::PairV0V0Builder< + v0histmanager::PrefixK0short1, + trackhistmanager::PrefixV0PosDaughter1, + trackhistmanager::PrefixV0NegDaughter2, + v0histmanager::PrefixK0short2, + trackhistmanager::PrefixV0PosDaughter1, + trackhistmanager::PrefixV0NegDaughter2, + pairhistmanager::PrefixV0V0Se, + pairhistmanager::PrefixV0V0Me, + closepairrejection::PrefixV0V0PosSe, + closepairrejection::PrefixV0V0NegSe, + closepairrejection::PrefixV0V0PosMe, + closepairrejection::PrefixV0V0NegMe, + modes::V0::kK0short, + modes::V0::kK0short, + modes::Mode::kAnalysis> + pairK0shortK0shortBuilder; + + // setup mixing + std::vector defaultVtxBins{10, -10, 10}; + std::vector defaultMultBins{50, 0, 200}; + std::vector defaultCentBins{10, 0, 100}; + ColumnBinningPolicy mixBinsVtxMult{{defaultVtxBins, defaultMultBins}, true}; + ColumnBinningPolicy mixBinsVtxCent{{defaultVtxBins, defaultCentBins}, true}; + ColumnBinningPolicy mixBinsVtxMultCent{{defaultVtxBins, defaultMultBins, defaultCentBins}, true}; + pairhistmanager::ConfMixing confMixing; + + HistogramRegistry hRegistry{"FemtoTrackV0", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // setup cpr + closepairrejection::ConfCpr confCpr; + + void init(InitContext&) + { + + // setup columnpolicy for binning + // default values are used during instantiation, so we need to explicity update them here + mixBinsVtxMult = {{confMixing.vtxBins, confMixing.multBins.value}, true}; + mixBinsVtxCent = {{confMixing.vtxBins.value, confMixing.centBins.value}, true}; + mixBinsVtxMultCent = {{confMixing.vtxBins.value, confMixing.multBins.value, confMixing.centBins.value}, true}; + + // setup histograms + auto colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); + auto posDauSpec = trackhistmanager::makeTrackHistSpecMap(confPosDauBinning); + auto negDauSpec = trackhistmanager::makeTrackHistSpecMap(confNegDauBinning); + auto cprHistSpec = closepairrejection::makeCprHistSpecMap(confCpr); + + // setup for lambda + if (doprocessLambdaLambdaSameEvent || doprocessLambdaLambdaMixedEvent) { + auto lambdaHistSpec = v0histmanager::makeV0HistSpecMap(confLambdaBinning); + auto pairLambdaLambdaHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confLambdaBinning, confLambdaBinning); + pairLambdaLambdaBuilder.init(&hRegistry, lambdaSelection, lambdaSelection, confCpr, confMixing, colHistSpec, lambdaHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairLambdaLambdaHistSpec, cprHistSpec); + } + + // setup for k0short + if (doprocessK0shortK0shortSameEvent || doprocessK0shortK0shortMixedEvent) { + auto k0shortHistSpec = v0histmanager::makeV0HistSpecMap(confK0shortBinning); + auto pairLambdaLambdaHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confLambdaBinning, confLambdaBinning); + pairLambdaLambdaBuilder.init(&hRegistry, k0shortSelection, k0shortSelection, confCpr, confMixing, colHistSpec, k0shortHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairLambdaLambdaHistSpec, cprHistSpec); + } + + if (((doprocessLambdaLambdaSameEvent || doprocessLambdaLambdaMixedEvent) + (doprocessK0shortK0shortSameEvent || doprocessK0shortK0shortMixedEvent)) > 1) { + LOG(fatal) << "Can only process lambda-tracks Or k0short-tracks"; + } + }; + + void processLambdaLambdaSameEvent(FilteredCollision const& col, Tracks const& tracks, Lambdas const& lambdas) + { + pairLambdaLambdaBuilder.processSameEvent(col, tracks, lambdas, lambdaPartition, lambdaPartition, cache); + } + PROCESS_SWITCH(FemtoPairV0V0, processLambdaLambdaSameEvent, "Enable processing same event processing for lambdas", true); + + void processLambdaLambdaMixedEvent(FilteredCollisions const& cols, Tracks const& tracks, Lambdas const& /*lambas*/) + { + pairLambdaLambdaBuilder.processMixedEvent(cols, tracks, lambdaPartition, lambdaPartition, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + } + PROCESS_SWITCH(FemtoPairV0V0, processLambdaLambdaMixedEvent, "Enable processing mixed event processing for lambdas", true); + + void processK0shortK0shortSameEvent(FilteredCollision const& col, Tracks const& tracks, K0shorts const& k0shorts) + { + pairK0shortK0shortBuilder.processSameEvent(col, tracks, k0shorts, k0shortPartition, lambdaPartition, cache); + } + PROCESS_SWITCH(FemtoPairV0V0, processK0shortK0shortSameEvent, "Enable processing same event processing for lambdas", true); + + void processK0shortK0shortMixedEvent(FilteredCollisions const& cols, Tracks const& tracks, K0shorts const& /*k0shorts*/) + { + pairK0shortK0shortBuilder.processMixedEvent(cols, tracks, k0shortPartition, k0shortPartition, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + } + PROCESS_SWITCH(FemtoPairV0V0, processK0shortK0shortMixedEvent, "Enable processing mixed event processing for lambdas", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{ + adaptAnalysisTask(cfgc), + }; + return workflow; +} diff --git a/PWGCF/Femto/Tasks/femtoTrackQa.cxx b/PWGCF/Femto/Tasks/femtoTrackQa.cxx index f68141e9349..4ae2deb4cc9 100644 --- a/PWGCF/Femto/Tasks/femtoTrackQa.cxx +++ b/PWGCF/Femto/Tasks/femtoTrackQa.cxx @@ -67,7 +67,7 @@ struct FemtoTrackQa { trackhistmanager::TrackHistManager trackHistManager; Partition trackPartition = MAKE_TRACK_PARTITION(trackSelections); - Preslice perColReco = aod::femtobase::stored::fColId; + Preslice perColReco = aod::femtobase::stored::collisionId; HistogramRegistry hRegistry{"FemtoTrackQA", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -80,12 +80,12 @@ struct FemtoTrackQa { trackHistManager.init(&hRegistry, trackHistSpec, trackSelections.chargeAbs.value, confTrackQaBinning.momentumType.value); }; - void process(FilteredCollision const& col, Tracks const& /*tracks*/) + void process(FilteredCollision const& col, Tracks const& tracks) { colHistManager.fill(col); - auto trackSlice = trackPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); + auto trackSlice = trackPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); for (auto const& track : trackSlice) { - trackHistManager.fill(track); + trackHistManager.fill(track, tracks); } } }; diff --git a/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx b/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx index ef9121df21a..fdc2d45accc 100644 --- a/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx +++ b/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx @@ -15,7 +15,6 @@ #include "PWGCF/Femto/Core/collisionBuilder.h" #include "PWGCF/Femto/Core/collisionHistManager.h" -#include "PWGCF/Femto/Core/dataTypes.h" #include "PWGCF/Femto/Core/modes.h" #include "PWGCF/Femto/Core/partitions.h" #include "PWGCF/Femto/Core/trackHistManager.h" @@ -24,10 +23,13 @@ #include "PWGCF/Femto/DataModel/FemtoTables.h" #include "Framework/ASoA.h" +#include "Framework/AnalysisHelpers.h" #include "Framework/AnalysisTask.h" #include "Framework/Configurable.h" #include "Framework/Expressions.h" #include "Framework/HistogramRegistry.h" +#include "Framework/InitContext.h" +#include "Framework/OutputObjHeader.h" #include "Framework/runDataProcessing.h" #include @@ -67,7 +69,7 @@ struct FemtoTwotrackresonanceQa { // setup for phis twotrackresonancebuilder::ConfPhiSelection confPhiSelection; Partition phiPartition = MAKE_RESONANCE_0_PARTITON(confPhiSelection); - Preslice perColPhis = aod::femtobase::stored::fColId; + Preslice perColPhis = aod::femtobase::stored::collisionId; twotrackresonancehistmanager::ConfPhiBinning confPhiBinning; twotrackresonancehistmanager::TwoTrackResonanceHistManager< @@ -81,7 +83,7 @@ struct FemtoTwotrackresonanceQa { // setup for rho0s twotrackresonancebuilder::ConfRho0Selection confRho0Selection; Partition rho0Partition = MAKE_RESONANCE_0_PARTITON(confRho0Selection); - Preslice perColRhos = aod::femtobase::stored::fColId; + Preslice perColRhos = aod::femtobase::stored::collisionId; twotrackresonancehistmanager::ConfRho0Binning confRho0Binning; twotrackresonancehistmanager::TwoTrackResonanceHistManager< @@ -95,7 +97,7 @@ struct FemtoTwotrackresonanceQa { // setup for kstar0s twotrackresonancebuilder::ConfKstar0Selection confKstar0Selection; Partition kstar0Partition = MAKE_RESONANCE_1_PARTITON(confKstar0Selection); - Preslice perColKstars = aod::femtobase::stored::fColId; + Preslice perColKstars = aod::femtobase::stored::collisionId; twotrackresonancehistmanager::ConfKstar0Binning confKstar0Binning; twotrackresonancehistmanager::TwoTrackResonanceHistManager< @@ -145,7 +147,7 @@ struct FemtoTwotrackresonanceQa { void processPhis(FilteredCollision const& col, Phis const& /*phis*/, Tracks const& tracks) { colHistManager.fill(col); - auto phiSlice = phiPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); + auto phiSlice = phiPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); for (auto const& phi : phiSlice) { phiHistManager.fill(phi, tracks); } @@ -155,7 +157,7 @@ struct FemtoTwotrackresonanceQa { void processRho0s(FilteredCollision const& col, Rho0s const& /*rho0s*/, Tracks const& tracks) { colHistManager.fill(col); - auto rho0Slice = rho0Partition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); + auto rho0Slice = rho0Partition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); for (auto const& rho0 : rho0Slice) { rho0HistManager.fill(rho0, tracks); } @@ -165,7 +167,7 @@ struct FemtoTwotrackresonanceQa { void processKstar0s(FilteredCollision const& col, Kstar0s const& /*kstar0s*/, Tracks const& tracks) { colHistManager.fill(col); - auto kstar0Slice = kstar0Partition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); + auto kstar0Slice = kstar0Partition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); for (auto const& kstar0 : kstar0Slice) { kstar0HistManager.fill(kstar0, tracks); } diff --git a/PWGCF/Femto/Tasks/femtoV0Qa.cxx b/PWGCF/Femto/Tasks/femtoV0Qa.cxx index 2b290ee93b6..27cafaa761c 100644 --- a/PWGCF/Femto/Tasks/femtoV0Qa.cxx +++ b/PWGCF/Femto/Tasks/femtoV0Qa.cxx @@ -46,7 +46,6 @@ using namespace o2::analysis::femto; struct FemtoV0Qa { using Collisions = o2::soa::Join; - using Collision = Collisions::iterator; using FilteredCollisions = o2::soa::Filtered; using FilteredCollision = FilteredCollisions::iterator; @@ -68,7 +67,7 @@ struct FemtoV0Qa { v0builder::ConfLambdaSelection1 confLambdaSelection; Partition lambdaPartition = MAKE_LAMBDA_PARTITION(confLambdaSelection); - Preslice perColLambdas = aod::femtobase::stored::fColId; + Preslice perColLambdas = aod::femtobase::stored::collisionId; v0histmanager::ConfLambdaBinning1 confLambdaBinning; v0histmanager::ConfLambdaQaBinning1 confLambdaQaBinning; @@ -84,7 +83,7 @@ struct FemtoV0Qa { v0builder::ConfK0shortSelection1 confK0shortSelection; Partition k0shortPartition = MAKE_K0SHORT_PARTITION(confK0shortSelection); - Preslice perColK0shorts = aod::femtobase::stored::fColId; + Preslice perColK0shorts = aod::femtobase::stored::collisionId; v0histmanager::ConfK0shortBinning1 confK0shortBinning; v0histmanager::ConfK0shortQaBinning1 confK0shortQaBinning; @@ -129,20 +128,20 @@ struct FemtoV0Qa { } }; - void processK0short(FilteredCollision const& col, K0shorts const& /*k0shorts*/, Tracks const& tracks) + void processK0short(FilteredCollision const& col, Tracks const& tracks, K0shorts const& /*k0shorts*/) { colHistManager.fill(col); - auto k0shortSlice = k0shortPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); + auto k0shortSlice = k0shortPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); for (auto const& k0short : k0shortSlice) { k0shortHistManager.fill(k0short, tracks); } } PROCESS_SWITCH(FemtoV0Qa, processK0short, "Process k0shorts", false); - void processLambda(FilteredCollision const& col, Lambdas const& /*lambdas*/, Tracks const& tracks) + void processLambda(FilteredCollision const& col, Tracks const& tracks, Lambdas const& /*lambdas*/) { colHistManager.fill(col); - auto lambdaSlice = lambdaPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); + auto lambdaSlice = lambdaPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); for (auto const& lambda : lambdaSlice) { lambdaHistManager.fill(lambda, tracks); } From 724b5d364667345c0686e6b91f80b4ead48f5368 Mon Sep 17 00:00:00 2001 From: Fan Si <147278151+fsii@users.noreply.github.com> Date: Sun, 19 Oct 2025 05:58:03 +0200 Subject: [PATCH 805/986] [PWGCF] Add a task for particle number fluctuation analysis (#13445) --- PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt | 5 + PWGCF/EbyEFluctuations/Tasks/partNumFluc.cxx | 1684 ++++++++++++++++++ 2 files changed, 1689 insertions(+) create mode 100644 PWGCF/EbyEFluctuations/Tasks/partNumFluc.cxx diff --git a/PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt b/PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt index 14dc66b22f0..2afcf9e4afc 100644 --- a/PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt +++ b/PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt @@ -73,3 +73,8 @@ o2physics_add_dpl_workflow(v0pt-had-pi-ka-prot SOURCES v0ptHadPiKaProt.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(part-num-fluc + SOURCES partNumFluc.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2Physics::PWGCFCore + COMPONENT_NAME Analysis) diff --git a/PWGCF/EbyEFluctuations/Tasks/partNumFluc.cxx b/PWGCF/EbyEFluctuations/Tasks/partNumFluc.cxx new file mode 100644 index 00000000000..7230fcbd76d --- /dev/null +++ b/PWGCF/EbyEFluctuations/Tasks/partNumFluc.cxx @@ -0,0 +1,1684 @@ +// 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 partNumFluc.cxx +/// \brief Task for particle number fluctuation analysis +/// \author Fan Si + +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/McCollisionExtra.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/MathConstants.h" +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/ASoA.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +namespace o2 +{ +namespace aod +{ +using JoinedCollisions = soa::Join; +using JoinedTracks = soa::Join; +using JoinedCollisionsWithMc = soa::Join; +using JoinedTracksWithMc = soa::Join; +using JoinedMcCollisions = soa::Join; +} // namespace aod +} // namespace o2 + +namespace fluctuation_calculator_base +{ +inline constexpr std::int8_t kMaxOrder = 8; +inline constexpr std::uint8_t kNExponentPairs = 36; +inline constexpr std::uint16_t kNOrderVectors = 342; +inline constexpr std::array, kNExponentPairs> kExponentPairs = {{{1, 1}, {2, 1}, {2, 2}, {3, 1}, {3, 2}, {3, 3}, {4, 1}, {4, 2}, {4, 3}, {4, 4}, {5, 1}, {5, 2}, {5, 3}, {5, 4}, {5, 5}, {6, 1}, {6, 2}, {6, 3}, {6, 4}, {6, 5}, {6, 6}, {7, 1}, {7, 2}, {7, 3}, {7, 4}, {7, 5}, {7, 6}, {7, 7}, {8, 1}, {8, 2}, {8, 3}, {8, 4}, {8, 5}, {8, 6}, {8, 7}, {8, 8}}}; +inline constexpr std::array, kNOrderVectors> kOrderVectors = {{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}}; +} // namespace fluctuation_calculator_base + +class FluctuationCalculatorTrack +{ + public: + FluctuationCalculatorTrack() : mQs{} {} + virtual ~FluctuationCalculatorTrack() {} + + double getProductFast(const std::int32_t orderVectorIndex, const double weight = 1.) const + { + double product = 1.; + for (std::int32_t const& iExponentPair : std::views::iota(0, static_cast(fluctuation_calculator_base::kNExponentPairs))) { + if (fluctuation_calculator_base::kOrderVectors[orderVectorIndex][iExponentPair]) { + product *= std::pow(mQs[iExponentPair], fluctuation_calculator_base::kOrderVectors[orderVectorIndex][iExponentPair]); + } + } + return product * weight; + } + void init() { mQs.fill(0.); } + void fill(const double charge, const double efficiency, const double weight = 1.) + { + for (std::int32_t const& iExponentPair : std::views::iota(0, static_cast(fluctuation_calculator_base::kNExponentPairs))) { + mQs[iExponentPair] += std::pow(charge, fluctuation_calculator_base::kExponentPairs[iExponentPair].first) / std::pow(efficiency, fluctuation_calculator_base::kExponentPairs[iExponentPair].second) * weight; + } + } + + protected: + std::array mQs; +}; + +struct QuantityHolderEvent { + std::int32_t runNumber = 0; + std::int32_t runIndex = 0; + std::int32_t nGlobalTracks = 0; + std::int32_t nPvContributors = 0; + std::int32_t nTofBeta = 0; + double meanDcaXy = 0.; + double meanSquareDcaXy = 0.; + double meanDcaZ = 0.; + double meanSquareDcaZ = 0.; + double vz = 0.; + double centrality = 0.; + std::int32_t subgroupIndex = 0; + std::int32_t nChP = 0; + std::int32_t nChM = 0; + std::int32_t nKaP = 0; + std::int32_t nKaM = 0; + std::int32_t nPrP = 0; + std::int32_t nPrM = 0; + std::vector mcParticleIndicesMatchedTpcPiP; + std::vector mcParticleIndicesMatchedTpcPiM; + std::vector mcParticleIndicesMatchedTpcKaP; + std::vector mcParticleIndicesMatchedTpcKaM; + std::vector mcParticleIndicesMatchedTpcPrP; + std::vector mcParticleIndicesMatchedTpcPrM; + std::vector mcParticleIndicesMatchedTpcTofPiP; + std::vector mcParticleIndicesMatchedTpcTofPiM; + std::vector mcParticleIndicesMatchedTpcTofKaP; + std::vector mcParticleIndicesMatchedTpcTofKaM; + std::vector mcParticleIndicesMatchedTpcTofPrP; + std::vector mcParticleIndicesMatchedTpcTofPrM; + + void clear() + { + runNumber = runIndex = nGlobalTracks = nPvContributors = nTofBeta = 0; + meanDcaXy = meanSquareDcaXy = meanDcaZ = meanSquareDcaZ = vz = centrality = 0.; + nChP = nChM = nKaP = nKaM = nPrP = nPrM = 0; + mcParticleIndicesMatchedTpcPiP.clear(); + mcParticleIndicesMatchedTpcPiM.clear(); + mcParticleIndicesMatchedTpcKaP.clear(); + mcParticleIndicesMatchedTpcKaM.clear(); + mcParticleIndicesMatchedTpcPrP.clear(); + mcParticleIndicesMatchedTpcPrM.clear(); + mcParticleIndicesMatchedTpcTofPiP.clear(); + mcParticleIndicesMatchedTpcTofPiM.clear(); + mcParticleIndicesMatchedTpcTofKaP.clear(); + mcParticleIndicesMatchedTpcTofKaM.clear(); + mcParticleIndicesMatchedTpcTofPrP.clear(); + mcParticleIndicesMatchedTpcTofPrM.clear(); + } +}; + +struct QuantityHolderTrack { + std::int32_t sign = 0; + double pt = 0.; + double eta = 0.; + double phi = 0.; + double ptOverQ = 0.; + double pOverQ = 0.; + double rapidityPi = 0.; + double rapidityKa = 0.; + double rapidityPr = 0.; + bool hasTpcPid = false; + double tpcNSigmaPi = 0.; + double tpcNSigmaKa = 0.; + double tpcNSigmaPr = 0.; + bool hasTofPid = false; + double tofNSigmaPi = 0.; + double tofNSigmaKa = 0.; + double tofNSigmaPr = 0.; + double tpcTofNSigmaPi = 0.; + double tpcTofNSigmaKa = 0.; + double tpcTofNSigmaPr = 0.; + std::int32_t mcParticleId = 0; + + void clear() + { + sign = 0; + pt = eta = phi = ptOverQ = pOverQ = rapidityPi = rapidityKa = rapidityPr = 0.; + hasTpcPid = false; + tpcNSigmaPi = tpcNSigmaKa = tpcNSigmaPr = 0.; + hasTofPid = false; + tofNSigmaPi = tofNSigmaKa = tofNSigmaPr = tpcTofNSigmaPi = tpcTofNSigmaKa = tpcTofNSigmaPr = 0.; + mcParticleId = 0; + } +}; + +struct QuantityHolderMcParticle { + std::int32_t globalIndex = 0; + std::int32_t pdgCode = 0; + double pt = 0.; + double eta = 0.; + + void clear() + { + globalIndex = pdgCode = 0; + pt = eta = 0.; + } +}; + +struct PartNumFluc { + Service ccdb; + + Configurable cfgFlagQaRun{"cfgFlagQaRun", false, "Run QA flag"}; + Configurable cfgFlagQaEvent{"cfgFlagQaEvent", false, "Event QA flag"}; + Configurable cfgFlagQaCentrality{"cfgFlagQaCentrality", false, "Centrality QA flag"}; + Configurable cfgFlagQaTrack{"cfgFlagQaTrack", false, "Track QA flag"}; + Configurable cfgFlagQaPid{"cfgFlagQaPid", false, "PID QA flag"}; + Configurable cfgFlagQaAcceptance{"cfgFlagQaAcceptance", false, "Acceptance QA flag"}; + Configurable cfgFlagAnalysisFluctuationCh{"cfgFlagAnalysisFluctuationCh", false, "Charge number fLuctuation analysis flag"}; + Configurable cfgFlagAnalysisFluctuationKa{"cfgFlagAnalysisFluctuationKa", false, "Kaon number fLuctuation analysis flag"}; + Configurable cfgFlagAnalysisFluctuationPr{"cfgFlagAnalysisFluctuationPr", false, "(Anti)proton number fLuctuation analysis flag"}; + Configurable cfgFlagCalculationEfficiency{"cfgFlagCalculationEfficiency", true, "Efficiency calculation flag"}; + + Configurable> cfgListRun{"cfgListRun", {551759, 551760, 551761, 551780, 551843, 551856, 551874, 551875, 551877, 551889, 551890, 551894, 551921, 551922, 551923, 551924, 551925, 551926, 551931, 551943, 551958, 551977, 551979, 551982, 551983, 551989, 551992, 551993, 551997, 552005, 552029, 552080, 552102, 552103, 552138, 552139, 552140, 552141, 552142, 552156, 552176, 552177, 552178, 552179, 552197, 552198, 552200, 552201, 552203, 552204, 552205, 552206, 552283, 552285, 552304, 552340, 552341, 552353, 552369, 552381, 552382, 552383, 552384, 552400, 552401, 552402, 552403}, "List of run numbers"}; + Configurable> cfgListRunBad{"cfgListRunBad", {}, "List of bad run numbers"}; + + Configurable cfgFlagEventSel{"cfgFlagEventSel", 0b00000000001111110100000000000000000000000000000000ULL, "Event selection flag"}; + Configurable cfgCutMaxAbsVertexZ{"cfgCutMaxAbsVertexZ", 6., "Maximum absolute vertex z position (cm)"}; + Configurable cfgCutMinNPvContributorsDeviation{"cfgCutMinNPvContributorsDeviation", -4, "Minimum nPvContributors deviation from nGlobalTracks"}; + + Configurable cfgFlagPvContributor{"cfgFlagPvContributor", true, "Flag of requiring PV contributor"}; + Configurable cfgCutMinItsNCls{"cfgCutMinItsNCls", 5, "Minimum number of clusters ITS"}; + Configurable cfgCutMaxItsChi2NCls{"cfgCutMaxItsChi2NCls", 30., "Maximum chi2 per cluster ITS"}; + Configurable cfgCutMinTpcNCls{"cfgCutMinTpcNCls", 55, "Minimum number of clusters TPC"}; // 50, 60 + Configurable cfgCutMaxTpcChi2NCls{"cfgCutMaxTpcChi2NCls", 3.5, "Maximum chi2 per cluster TPC"}; // 3., 4. + Configurable cfgCutMaxTpcNClsSharedRatio{"cfgCutMaxTpcNClsSharedRatio", 0.2, "Maximum ratio of shared clusters over clusters TPC"}; + Configurable cfgCutMinTpcNClsCrossedRows{"cfgCutMinTpcNClsCrossedRows", 75, "Minimum number of crossed rows TPC"}; // 70, 80 + Configurable cfgCutMinTpcNClsCrossedRowsRatio{"cfgCutMinTpcNClsCrossedRowsRatio", 0.8, "Minimum ratio of crossed rows over findable clusters TPC"}; + Configurable> cfgParSigmaDcaXy{"cfgParSigmaDcaXy", {0.0015, 0.005, 1.1}, "Parameters of sigma of DCAxy (cm) in [0]+[1]*pt^[2]"}; + Configurable cfgCutMaxAbsNSigmaDcaXy{"cfgCutMaxAbsNSigmaDcaXy", 6., "Maximum absolute nSigma of DCAxy (cm)"}; // 5., 7. + Configurable cfgCutMaxAbsDcaZ{"cfgCutMaxAbsDcaZ", 0.2, "Maximum absolute DCAz (cm)"}; // 0.15, 0.25 + Configurable cfgCutMinPt{"cfgCutMinPt", 0.4, "Minimum pT (GeV/c)"}; + Configurable cfgCutMaxPt{"cfgCutMaxPt", 2., "Maximum pT (GeV/c)"}; + Configurable cfgCutMaxAbsEta{"cfgCutMaxAbsEta", 0.8, "Maximum absolute eta"}; + Configurable cfgThresholdPtTofPi{"cfgThresholdPtTofPi", 0.5, "pT (GeV/c) threshold for TOF pions"}; + Configurable cfgThresholdPtTofKa{"cfgThresholdPtTofKa", 0.5, "pT (GeV/c) threshold for TOF kaons"}; + Configurable cfgThresholdPtTofPr{"cfgThresholdPtTofPr", 0.8, "pT (GeV/c) threshold for TOF (anti)protons"}; + Configurable cfgCutMaxAbsNSigmaPid{"cfgCutMaxAbsNSigmaPid", 2., "Maximum absolute nSigma for PID"}; // 1.5, 2.5 + + Configurable cfgNCentralityBins{"cfgNCentralityBins", 20, "Number of centrality bins in fluctuation analysis"}; + Configurable cfgNSubgroups{"cfgNSubgroups", 20, "Number of subgroups in fluctuation analysis"}; + + Configurable cfgCcdbPathEfficiencyFile{"cfgCcdbPathEfficiencyFile", "Users/f/fasi/test", "Path of the efficiency file in CCDB"}; + + const TProfile3D* pVzPtEtaEfficiencyTpcPiP = nullptr; + const TProfile3D* pVzPtEtaEfficiencyTpcPiM = nullptr; + const TProfile3D* pVzPtEtaEfficiencyTpcKaP = nullptr; + const TProfile3D* pVzPtEtaEfficiencyTpcKaM = nullptr; + const TProfile3D* pVzPtEtaEfficiencyTpcPrP = nullptr; + const TProfile3D* pVzPtEtaEfficiencyTpcPrM = nullptr; + const TProfile3D* pVzPtEtaEfficiencyTpcTofPiP = nullptr; + const TProfile3D* pVzPtEtaEfficiencyTpcTofPiM = nullptr; + const TProfile3D* pVzPtEtaEfficiencyTpcTofKaP = nullptr; + const TProfile3D* pVzPtEtaEfficiencyTpcTofKaM = nullptr; + const TProfile3D* pVzPtEtaEfficiencyTpcTofPrP = nullptr; + const TProfile3D* pVzPtEtaEfficiencyTpcTofPrM = nullptr; + + std::unique_ptr fluctuationCalculatorTrackChP; + std::unique_ptr fluctuationCalculatorTrackChM; + std::unique_ptr fluctuationCalculatorTrackChT; + std::unique_ptr fluctuationCalculatorTrackChN; + std::unique_ptr fluctuationCalculatorTrackKaP; + std::unique_ptr fluctuationCalculatorTrackKaM; + std::unique_ptr fluctuationCalculatorTrackKaT; + std::unique_ptr fluctuationCalculatorTrackKaN; + std::unique_ptr fluctuationCalculatorTrackPrP; + std::unique_ptr fluctuationCalculatorTrackPrM; + std::unique_ptr fluctuationCalculatorTrackPrT; + std::unique_ptr fluctuationCalculatorTrackPrN; + + QuantityHolderEvent quantityHolderEvent; + QuantityHolderTrack quantityHolderTrack; + QuantityHolderMcParticle quantityHolderMcParticle; + + HistogramRegistry hrCalculationEfficiency{"hrCalculationEfficiency", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry hrAnalysisFluctuation{"hrAnalysisFluctuation", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry hrQaAcceptance{"hrQaAcceptance", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry hrQaPid{"hrQaPid", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry hrQaTrack{"hrQaTrack", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry hrQaCentrality{"hrQaCentrality", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry hrQaEvent{"hrQaEvent", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry hrQaRun{"hrQaRun", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry hrCounter{"hrCounter", {}, OutputObjHandlingPolicy::AnalysisObject}; + + Filter filterCollision = (aod::evsel::sel8 == true); + Filter filterfTrack = requireGlobalTrackWoPtEtaInFilter(); + Filter filterfMcCollision = (aod::mccollisionprop::numRecoCollision > 0); + + void init(InitContext&) + { + assert(doprocessRaw ^ doprocessMc); + + ccdb->setURL("https://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setFatalWhenNull(false); + + hrCounter.add("hNEvents", ";;No. of Events", {HistType::kTH1D, {{10 + aod::evsel::kNsel, -0.5, 9.5 + static_cast(aod::evsel::kNsel), "Selection"}}}); + + if (doprocessRaw) { + if (cfgFlagQaRun.value) { + LOG(info) << "Enabling run QA"; + + HistogramConfigSpec hcsQaRun(HistType::kTProfile, {{static_cast(cfgListRun.value.size()), -0.5, cfgListRun.value.size() - 0.5, "Run Index"}}); + hrQaRun.add("QaRun/pRunIndexVx", ";;#LT#it{V}_{#it{x}}#GT (cm)", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexVy", ";;#LT#it{V}_{#it{y}}#GT (cm)", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexVz", ";;#LT#it{V}_{#it{z}}#GT (cm)", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexMultFv0a", ";;FV0A #LTMultiplicity#GT", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexMultFt0a", ";;FT0A #LTMultiplicity#GT", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexMultFt0c", ";;FT0C #LTMultiplicity#GT", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexNGlobalTracks", ";;#LTnGlobalTracks#GT", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexNPvContributors", ";;#LTnPvContributors#GT", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexNTofBeta", ";;#LTnTofBeta#GT", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexMeanDcaXy", ";;#LT#LTDCA_{#it{xy}}#GT_{event}#GT (cm)", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexSigmaDcaXy", ";;#LT#it{#sigma}(DCA_{#it{xy}})_{event}#GT (cm)", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexMeanDcaZ", ";;#LT#LTDCA_{#it{z}}#GT_{event}#GT (cm)", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexSigmaDcaZ", ";;#LT#it{#sigma}(DCA_{#it{z}})_{event}#GT (cm)", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexItsNCls", ";;ITS #LTnClusters#GT", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexItsChi2NCls", ";;ITS #LT#it{#chi}^{2}/nClusters#GT", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexTpcNCls", ";;TPC #LTnClusters#GT", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexTpcChi2NCls", ";;TPC #LT#it{#chi}^{2}/nClusters#GT", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexTpcNClsSharedRatio", ";;TPC #LTnSharedClusters/nClusters#GT", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexTpcNClsCrossedRows", ";;TPC #LTnCrossedRows#GT", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexTpcNClsCrossedRowsRatio", ";;TPC #LTnCrossedRows/nFindableClusters#GT", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexDcaXy", ";;#LTDCA_{#it{xy}}#GT (cm)", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexDcaZ", ";;#LTDCA_{#it{z}}#GT (cm)", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexPt", ";;#LT#it{p}_{T}#GT (GeV/#it{c})", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexEta", ";;#LT#it{#eta}#GT", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexPhi", ";;#LT#it{#varphi}#GT", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexTpcDeDx", ";;TPC #LTd#it{E}/d#it{x}#GT (a.u.)", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexTpcNSigmaPi", ";;TPC #LT#it{n}#it{#sigma}_{#pi}#GT", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexTpcNSigmaKa", ";;TPC #LT#it{n}#it{#sigma}_{K}#GT", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexTpcNSigmaPr", ";;TPC #LT#it{n}#it{#sigma}_{p}#GT", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexTofInverseBeta", ";;TOF #LT1/#it{#beta}#GT", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexTofNSigmaPi", ";;TOF #LT#it{n}#it{#sigma}_{#pi}#GT", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexTofNSigmaKa", ";;TOF #LT#it{n}#it{#sigma}_{K}#GT", hcsQaRun); + hrQaRun.add("QaRun/pRunIndexTofNSigmaPr", ";;TOF #LT#it{n}#it{#sigma}_{p}#GT", hcsQaRun); + } + + if (cfgFlagQaEvent.value) { + LOG(info) << "Enabling event QA"; + + AxisSpec asRunIndex(static_cast(cfgListRun.value.size()), -0.5, cfgListRun.value.size() - 0.5, "Run Index"); + AxisSpec asNGlobalTracks(160, -0.5, 159.5, "nGlobalTracks"); + hrQaEvent.add("QaEvent/hRunIndexVxVy", "", {HistType::kTHnSparseF, {asRunIndex, {150, -0.15, 0.15, "#it{V}_{#it{x}} (cm)"}, {150, -0.15, 0.15, "#it{V}_{#it{y}} (cm)"}}}); + hrQaEvent.add("QaEvent/hRunIndexVz", "", {HistType::kTH2F, {asRunIndex, {300, -15., 15., "#it{V}_{#it{z}} (cm)"}}}); + hrQaEvent.add("QaEvent/hRunIndexNTofBetaNGlobalTracks", "", {HistType::kTHnSparseF, {asRunIndex, {40, -0.5, 39.5, "nTofBeta"}, asNGlobalTracks}}); + hrQaEvent.add("QaEvent/hRunIndexNPvContributorsNGlobalTracks", "", {HistType::kTHnSparseF, {asRunIndex, {160, -0.5, 159.5, "nPvContributors"}, asNGlobalTracks}}); + hrQaEvent.add("QaEvent/hRunIndexNGlobalTracksMeanDcaXy", "", {HistType::kTHnSparseF, {asRunIndex, asNGlobalTracks, {200, -0.5, 0.5, "#LTDCA_{#it{xy}}#GT_{event} (cm)"}}}); + hrQaEvent.add("QaEvent/pRunIndexNGlobalTracksMeanDcaXy", ";;#LT#LTDCA_{#it{xy}}#GT_{event}#GT (cm)", {HistType::kTProfile2D, {asRunIndex, asNGlobalTracks}}); + hrQaEvent.add("QaEvent/hRunIndexNGlobalTracksMeanDcaXy_nPvContributorsCut", "", {HistType::kTHnSparseF, {asRunIndex, asNGlobalTracks, {200, -2., 2., "#LTDCA_{#it{z}}#GT_{event} (cm)"}}}); + hrQaEvent.add("QaEvent/pRunIndexNGlobalTracksMeanDcaXy_nPvContributorsCut", ";;#LT#LTDCA_{#it{xy}}#GT_{event}#GT (cm)", {HistType::kTProfile2D, {asRunIndex, asNGlobalTracks}}); + hrQaEvent.add("QaEvent/hRunIndexNGlobalTracksMeanDcaZ", "", {HistType::kTHnSparseF, {asRunIndex, asNGlobalTracks, {200, -2., 2., "#LTDCA_{#it{z}}#GT_{event} (cm)"}}}); + hrQaEvent.add("QaEvent/pRunIndexNGlobalTracksMeanDcaZ", ";;#LT#LTDCA_{#it{z}}#GT_{event}#GT (cm)", {HistType::kTProfile2D, {asRunIndex, asNGlobalTracks}}); + hrQaEvent.add("QaEvent/hRunIndexNGlobalTracksMeanDcaZ_nPvContributorsCut", "", {HistType::kTHnSparseF, {asRunIndex, asNGlobalTracks, {200, -2., 2., "#LTDCA_{#it{z}}#GT_{event} (cm)"}}}); + hrQaEvent.add("QaEvent/pRunIndexNGlobalTracksMeanDcaZ_nPvContributorsCut", ";;#LT#LTDCA_{#it{z}}#GT_{event}#GT (cm)", {HistType::kTProfile2D, {asRunIndex, asNGlobalTracks}}); + } + + if (cfgFlagQaCentrality.value) { + LOG(info) << "Enabling centrality QA"; + + AxisSpec asQaCentrality(20, 0., 100., "Centrality (%)"); + hrQaCentrality.add("QaCentrality/hCentralityFv0a", "", {HistType::kTHnSparseF, {asQaCentrality, {2400, 0., 24000., "FV0A Multiplicity"}}}); + hrQaCentrality.add("QaCentrality/hCentralityFt0a", "", {HistType::kTHnSparseF, {asQaCentrality, {1600, 0., 8000., "FT0A Multiplicity"}}}); + hrQaCentrality.add("QaCentrality/hCentralityFt0c", "", {HistType::kTHnSparseF, {asQaCentrality, {400, 0., 2000., "FT0C Multiplicity"}}}); + hrQaCentrality.add("QaCentrality/hCentralityFt0m", "", {HistType::kTHnSparseF, {asQaCentrality, {2000, 0., 10000., "FT0A+FT0C Multiplicity"}}}); + } + + if (cfgFlagQaTrack.value) { + LOG(info) << "Enabling track QA"; + + AxisSpec asPt(250, 0., 2.5, "#it{p}_{T} (GeV/#it{c})"); + hrQaTrack.add("QaTrack/hItsNCls", "", {HistType::kTH1D, {{10, -0.5, 9.5, "ITS nClusters"}}}); + hrQaTrack.add("QaTrack/hItsChi2NCls", "", {HistType::kTH1D, {{80, 0., 40., "ITS #it{#chi}^{2}/nClusters"}}}); + hrQaTrack.add("QaTrack/hTpcNClsNClsSharedNClsFindableNClsCrossedRows", "", {HistType::kTHnSparseF, {{180, -0.5, 179.5, "TPC nClusters"}, {180, -0.5, 179.5, "TPC nSharedClusters"}, {180, -0.5, 179.5, "TPC nFindableClusters"}, {180, -0.5, 179.5, "TPC nCrossedRows"}}}); + hrQaTrack.add("QaTrack/hTpcChi2NCls", "", {HistType::kTH1D, {{100, 0., 5., "TPC #it{#chi}^{2}/nClusters"}}}); + hrQaTrack.add("QaTrack/hPtDcaXy", "", {HistType::kTH2D, {asPt, {200, -0.5, 0.5, "DCA_{#it{xy}} (cm)"}}}); + hrQaTrack.add("QaTrack/hPtDcaXy_pvContributor", "", {HistType::kTH2D, {asPt, {200, -0.5, 0.5, "DCA_{#it{xy}} (cm)"}}}); + hrQaTrack.add("QaTrack/hPtDcaZ", "", {HistType::kTH2D, {asPt, {200, -2., 2., "DCA_{#it{z}} (cm)"}}}); + hrQaTrack.add("QaTrack/hPtDcaZ_pvContributor", "", {HistType::kTH2D, {asPt, {200, -0.5, 0.5, "DCA_{#it{xy}} (cm)"}}}); + } + + if (cfgFlagQaPid.value) { + LOG(info) << "Enabling PID QA"; + + AxisSpec asPOverQ(140, -3.5, 3.5, "#it{p}/#it{q} (GeV/#it{c})"); + AxisSpec asPtOverQ(80, -2., 2., "#it{p}_{T}/#it{q} (GeV/#it{c})"); + AxisSpec asEta(60, -1.5, 1.5, "#it{#eta}"); + HistogramConfigSpec hcsQaPid(HistType::kTH3F, {asPtOverQ, asEta, {200, -10., 10.}}); + hrQaPid.add("QaPid/hPOverQEtaTpcLnDeDx", "", {HistType::kTH3F, {asPOverQ, asEta, {240, 3., 9., "TPC ln(d#it{E}/d#it{x} (a.u.))"}}}); + hrQaPid.add("QaPid/hPtOverQEtaTpcNSigmaPi", ";;;TPC #it{n}#it{#sigma}_{#pi}", hcsQaPid); + hrQaPid.add("QaPid/hPtOverQEtaTpcNSigmaPi_tofPi", ";;;TPC #it{n}#it{#sigma}_{#pi}", hcsQaPid); + hrQaPid.add("QaPid/hPtOverQEtaTpcNSigmaKa", ";;;TPC #it{n}#it{#sigma}_{K}", hcsQaPid); + hrQaPid.add("QaPid/hPtOverQEtaTpcNSigmaKa_tofKa", ";;;TPC #it{n}#it{#sigma}_{K}", hcsQaPid); + hrQaPid.add("QaPid/hPtOverQEtaTpcNSigmaPr", ";;;TPC #it{n}#it{#sigma}_{p}", hcsQaPid); + hrQaPid.add("QaPid/hPtOverQEtaTpcNSigmaPr_tofPr", ";;;TPC #it{n}#it{#sigma}_{p}", hcsQaPid); + hrQaPid.add("QaPid/hPOverQEtaTofInverseBeta", "", {HistType::kTH3F, {asPOverQ, asEta, {120, 0.5, 3.5, "TOF 1/#it{#beta}"}}}); + hrQaPid.add("QaPid/hPtOverQEtaTofNSigmaPi_tpcPi", ";;;TOF #it{n}#it{#sigma}_{#pi}", hcsQaPid); + hrQaPid.add("QaPid/hPtOverQEtaTofNSigmaKa_tpcKa", ";;;TOF #it{n}#it{#sigma}_{K}", hcsQaPid); + hrQaPid.add("QaPid/hPtOverQEtaTofNSigmaPr_tpcPr", ";;;TOF #it{n}#it{#sigma}_{p}", hcsQaPid); + hrQaPid.add("QaPid/hPtOverQEtaTpcTofNSigmaPi", ";;;TPC-TOF #it{n}#it{#sigma}_{#pi}", hcsQaPid); + hrQaPid.add("QaPid/hPtOverQEtaTpcTofNSigmaKa", ";;;TPC-TOF #it{n}#it{#sigma}_{K}", hcsQaPid); + hrQaPid.add("QaPid/hPtOverQEtaTpcTofNSigmaPr", ";;;TPC-TOF #it{n}#it{#sigma}_{p}", hcsQaPid); + } + + if (cfgFlagQaAcceptance.value) { + LOG(info) << "Enabling acceptance QA"; + + AxisSpec asPt(250, 0., 2.5, "#it{p}_{T} (GeV/#it{c})"); + HistogramConfigSpec hcsQaAcceptanceEta(HistType::kTH2D, {{300, -1.5, 1.5, "#it{#eta}"}, asPt}); + HistogramConfigSpec hcsQaAcceptancePhi(HistType::kTH1D, {{360, 0., constants::math::TwoPI, "#it{#varphi} (rad)"}}); + HistogramConfigSpec hcsQaAcceptanceY(HistType::kTH2D, {{300, -1.5, 1.5, "#it{y}"}, asPt}); + hrQaAcceptance.add("QaAcceptance/hEtaPt_tpc", "", hcsQaAcceptanceEta); + hrQaAcceptance.add("QaAcceptance/hPhi_tpc", "", hcsQaAcceptancePhi); + hrQaAcceptance.add("QaAcceptance/hYPt_tpc_pi", "", hcsQaAcceptanceY); + hrQaAcceptance.add("QaAcceptance/hYPt_tpc_ka", "", hcsQaAcceptanceY); + hrQaAcceptance.add("QaAcceptance/hYPt_tpc_pr", "", hcsQaAcceptanceY); + hrQaAcceptance.add("QaAcceptance/hYPt_tpc_pr_tighter", "", hcsQaAcceptanceY); + hrQaAcceptance.add("QaAcceptance/hEtaPt_tpcTof", "", hcsQaAcceptanceEta); + hrQaAcceptance.add("QaAcceptance/hPhi_tpcTof", "", hcsQaAcceptancePhi); + hrQaAcceptance.add("QaAcceptance/hYPt_tpcTof_pi", "", hcsQaAcceptanceY); + hrQaAcceptance.add("QaAcceptance/hYPt_tpcTof_ka", "", hcsQaAcceptanceY); + hrQaAcceptance.add("QaAcceptance/hYPt_tpcTof_pr", "", hcsQaAcceptanceY); + } + + if (cfgFlagAnalysisFluctuationCh.value || cfgFlagAnalysisFluctuationKa.value || cfgFlagAnalysisFluctuationPr.value) { + gRandom->SetSeed(0); + + HistogramConfigSpec hcsAnalysisFluctuation(HistType::kTH3F, {{cfgNCentralityBins.value, 0., 100., "Centrality (%)"}, {60, -0.5, 59.5}, {60, -0.5, 59.5}}); + HistogramConfigSpec hcsFluctuationCalculator(HistType::kTH3D, {{cfgNCentralityBins.value, 0., 100., "Centrality (%)"}, {cfgNSubgroups.value, -0.5, cfgNSubgroups.value - 0.5, "Subgroup Index"}, {fluctuation_calculator_base::kNOrderVectors, -0.5, fluctuation_calculator_base::kNOrderVectors - 0.5, "Order Vector Index"}}); + + const TList* const efficiencyList(ccdb->getForTimeStamp(cfgCcdbPathEfficiencyFile.value, -1)); + if (cfgFlagAnalysisFluctuationCh.value) { + pVzPtEtaEfficiencyTpcPiP = static_cast(efficiencyList->FindObject("pVzPtEtaEfficiencyTpcPiP")); + assert(pVzPtEtaEfficiencyTpcPiP && pVzPtEtaEfficiencyTpcPiP->IsA() == TProfile3D::Class()); + pVzPtEtaEfficiencyTpcPiM = static_cast(efficiencyList->FindObject("pVzPtEtaEfficiencyTpcPiM")); + assert(pVzPtEtaEfficiencyTpcPiM && pVzPtEtaEfficiencyTpcPiM->IsA() == TProfile3D::Class()); + pVzPtEtaEfficiencyTpcTofPiP = static_cast(efficiencyList->FindObject("pVzPtEtaEfficiencyTpcTofPiP")); + assert(pVzPtEtaEfficiencyTpcTofPiP && pVzPtEtaEfficiencyTpcTofPiP->IsA() == TProfile3D::Class()); + pVzPtEtaEfficiencyTpcTofPiM = static_cast(efficiencyList->FindObject("pVzPtEtaEfficiencyTpcTofPiM")); + assert(pVzPtEtaEfficiencyTpcTofPiM && pVzPtEtaEfficiencyTpcTofPiM->IsA() == TProfile3D::Class()); + } + if (cfgFlagAnalysisFluctuationCh.value || cfgFlagAnalysisFluctuationKa.value) { + pVzPtEtaEfficiencyTpcKaP = static_cast(efficiencyList->FindObject("pVzPtEtaEfficiencyTpcKaP")); + assert(pVzPtEtaEfficiencyTpcKaP && pVzPtEtaEfficiencyTpcKaP->IsA() == TProfile3D::Class()); + pVzPtEtaEfficiencyTpcKaM = static_cast(efficiencyList->FindObject("pVzPtEtaEfficiencyTpcKaM")); + assert(pVzPtEtaEfficiencyTpcKaM && pVzPtEtaEfficiencyTpcKaM->IsA() == TProfile3D::Class()); + pVzPtEtaEfficiencyTpcTofKaP = static_cast(efficiencyList->FindObject("pVzPtEtaEfficiencyTpcTofKaP")); + assert(pVzPtEtaEfficiencyTpcTofKaP && pVzPtEtaEfficiencyTpcTofKaP->IsA() == TProfile3D::Class()); + pVzPtEtaEfficiencyTpcTofKaM = static_cast(efficiencyList->FindObject("pVzPtEtaEfficiencyTpcTofKaM")); + assert(pVzPtEtaEfficiencyTpcTofKaM && pVzPtEtaEfficiencyTpcTofKaM->IsA() == TProfile3D::Class()); + } + if (cfgFlagAnalysisFluctuationCh.value || cfgFlagAnalysisFluctuationPr.value) { + pVzPtEtaEfficiencyTpcPrP = static_cast(efficiencyList->FindObject("pVzPtEtaEfficiencyTpcPrP")); + assert(pVzPtEtaEfficiencyTpcPrP && pVzPtEtaEfficiencyTpcPrP->IsA() == TProfile3D::Class()); + pVzPtEtaEfficiencyTpcPrM = static_cast(efficiencyList->FindObject("pVzPtEtaEfficiencyTpcPrM")); + assert(pVzPtEtaEfficiencyTpcPrM && pVzPtEtaEfficiencyTpcPrM->IsA() == TProfile3D::Class()); + pVzPtEtaEfficiencyTpcTofPrP = static_cast(efficiencyList->FindObject("pVzPtEtaEfficiencyTpcTofPrP")); + assert(pVzPtEtaEfficiencyTpcTofPrP && pVzPtEtaEfficiencyTpcTofPrP->IsA() == TProfile3D::Class()); + pVzPtEtaEfficiencyTpcTofPrM = static_cast(efficiencyList->FindObject("pVzPtEtaEfficiencyTpcTofPrM")); + assert(pVzPtEtaEfficiencyTpcTofPrM && pVzPtEtaEfficiencyTpcTofPrM->IsA() == TProfile3D::Class()); + } + + if (cfgFlagAnalysisFluctuationCh.value) { + LOG(info) << "Enabling charge number fluctuation analysis"; + + fluctuationCalculatorTrackChP = std::make_unique(); + fluctuationCalculatorTrackChM = std::make_unique(); + fluctuationCalculatorTrackChT = std::make_unique(); + fluctuationCalculatorTrackChN = std::make_unique(); + + hrAnalysisFluctuation.add("AnalysisFluctuation/hCentralityNChPNChM", ";;No. of h^{+};No. of h^{#minus}", hcsAnalysisFluctuation); + hrAnalysisFluctuation.add("AnalysisFluctuation/hFluctuationCalculatorChP", "", hcsFluctuationCalculator); + hrAnalysisFluctuation.add("AnalysisFluctuation/hFluctuationCalculatorChM", "", hcsFluctuationCalculator); + hrAnalysisFluctuation.add("AnalysisFluctuation/hFluctuationCalculatorChT", "", hcsFluctuationCalculator); + hrAnalysisFluctuation.add("AnalysisFluctuation/hFluctuationCalculatorChN", "", hcsFluctuationCalculator); + } + + if (cfgFlagAnalysisFluctuationKa.value) { + LOG(info) << "Enabling kaon number fluctuation analysis"; + + fluctuationCalculatorTrackKaP = std::make_unique(); + fluctuationCalculatorTrackKaM = std::make_unique(); + fluctuationCalculatorTrackKaT = std::make_unique(); + fluctuationCalculatorTrackKaN = std::make_unique(); + + hrAnalysisFluctuation.add("AnalysisFluctuation/hCentralityNKaPNKaM", ";;No. of K^{+};No. of K^{#minus}", hcsAnalysisFluctuation); + hrAnalysisFluctuation.add("AnalysisFluctuation/hFluctuationCalculatorKaP", "", hcsFluctuationCalculator); + hrAnalysisFluctuation.add("AnalysisFluctuation/hFluctuationCalculatorKaM", "", hcsFluctuationCalculator); + hrAnalysisFluctuation.add("AnalysisFluctuation/hFluctuationCalculatorKaT", "", hcsFluctuationCalculator); + hrAnalysisFluctuation.add("AnalysisFluctuation/hFluctuationCalculatorKaN", "", hcsFluctuationCalculator); + } + + if (cfgFlagAnalysisFluctuationPr.value) { + LOG(info) << "Enabling (anti)proton number fluctuation analysis"; + + fluctuationCalculatorTrackPrP = std::make_unique(); + fluctuationCalculatorTrackPrM = std::make_unique(); + fluctuationCalculatorTrackPrT = std::make_unique(); + fluctuationCalculatorTrackPrN = std::make_unique(); + + hrAnalysisFluctuation.add("AnalysisFluctuation/hCentralityNPrPNPrM", ";;No. of p;No. of #bar{p}", hcsAnalysisFluctuation); + hrAnalysisFluctuation.add("AnalysisFluctuation/hFluctuationCalculatorPrP", "", hcsFluctuationCalculator); + hrAnalysisFluctuation.add("AnalysisFluctuation/hFluctuationCalculatorPrM", "", hcsFluctuationCalculator); + hrAnalysisFluctuation.add("AnalysisFluctuation/hFluctuationCalculatorPrT", "", hcsFluctuationCalculator); + hrAnalysisFluctuation.add("AnalysisFluctuation/hFluctuationCalculatorPrN", "", hcsFluctuationCalculator); + } + } + } else if (doprocessMc) { + if (cfgFlagCalculationEfficiency.value) { + LOG(info) << "Enabling efficiency calculation"; + + quantityHolderEvent.mcParticleIndicesMatchedTpcPiP.reserve(60); + quantityHolderEvent.mcParticleIndicesMatchedTpcPiM.reserve(60); + quantityHolderEvent.mcParticleIndicesMatchedTpcKaP.reserve(30); + quantityHolderEvent.mcParticleIndicesMatchedTpcKaM.reserve(30); + quantityHolderEvent.mcParticleIndicesMatchedTpcPrP.reserve(30); + quantityHolderEvent.mcParticleIndicesMatchedTpcPrM.reserve(30); + quantityHolderEvent.mcParticleIndicesMatchedTpcTofPiP.reserve(40); + quantityHolderEvent.mcParticleIndicesMatchedTpcTofPiM.reserve(40); + quantityHolderEvent.mcParticleIndicesMatchedTpcTofKaP.reserve(20); + quantityHolderEvent.mcParticleIndicesMatchedTpcTofKaM.reserve(20); + quantityHolderEvent.mcParticleIndicesMatchedTpcTofPrP.reserve(20); + quantityHolderEvent.mcParticleIndicesMatchedTpcTofPrM.reserve(20); + + HistogramConfigSpec hcsCalculationEfficiency(HistType::kTProfile3D, {{4, -cfgCutMaxAbsVertexZ.value, cfgCutMaxAbsVertexZ.value, "#it{V}_{#it{z}} (cm)"}, {25, 0., 2.5, "#it{p}_{T} (GeV/#it{c})"}, {30, -1.5, 1.5, "#it{#eta}"}}); + hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcPiP", "", hcsCalculationEfficiency); + hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcPiM", "", hcsCalculationEfficiency); + hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcKaP", "", hcsCalculationEfficiency); + hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcKaM", "", hcsCalculationEfficiency); + hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcPrP", "", hcsCalculationEfficiency); + hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcPrM", "", hcsCalculationEfficiency); + hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofPiP", "", hcsCalculationEfficiency); + hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofPiM", "", hcsCalculationEfficiency); + hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofKaP", "", hcsCalculationEfficiency); + hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofKaM", "", hcsCalculationEfficiency); + hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofPrP", "", hcsCalculationEfficiency); + hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofPrM", "", hcsCalculationEfficiency); + } + } + + if (cfgListRun.value.empty()) { + LOG(info) << "No run process enabled."; + } else { + for (std::int32_t const& run : cfgListRun.value) { + LOG(info) << "Enabling processing run: " << run; + } + } + + if (cfgListRunBad.value.empty()) { + LOG(info) << "No run rejection enabled."; + } else { + for (std::int32_t const& runBad : cfgListRunBad.value) { + LOG(info) << "Enabling rejecting run: " << runBad; + } + } + + if ((cfgFlagEventSel.value & ((1ULL << aod::evsel::kNsel) - 1)) == 0) { + LOG(info) << "No event selection bit enabled."; + } else { + for (std::int32_t const& iEvSel : std::views::iota(0, aod::evsel::kNsel)) { + if ((cfgFlagEventSel.value >> iEvSel) & 1) { + LOG(info) << "Enabling event selection bit: " << aod::evsel::selectionLabels[iEvSel]; + } + } + } + } + + template + bool isPi() + { + if constexpr (doRequiringTof && doRejectingOthers) { + return (std::fabs(quantityHolderTrack.tpcTofNSigmaPi) < std::min(cfgCutMaxAbsNSigmaPid.value, std::min(std::fabs(quantityHolderTrack.tpcTofNSigmaKa), std::fabs(quantityHolderTrack.tpcTofNSigmaPr)))); + } + if constexpr (doRequiringTof && !doRejectingOthers) { + return (std::fabs(quantityHolderTrack.tpcTofNSigmaPi) < cfgCutMaxAbsNSigmaPid.value); + } + if constexpr (!doRequiringTof && doRejectingOthers) { + return (std::fabs(quantityHolderTrack.tpcNSigmaPi) < std::min(cfgCutMaxAbsNSigmaPid.value, std::min(std::fabs(quantityHolderTrack.tpcNSigmaKa), std::fabs(quantityHolderTrack.tpcNSigmaPr)))); + } + return (std::fabs(quantityHolderTrack.tpcNSigmaPi) < cfgCutMaxAbsNSigmaPid.value); + } + + template + bool isKa() + { + if constexpr (doRequiringTof && doRejectingOthers) { + return (std::fabs(quantityHolderTrack.tpcTofNSigmaKa) < std::min(cfgCutMaxAbsNSigmaPid.value, std::min(std::fabs(quantityHolderTrack.tpcTofNSigmaPi), std::fabs(quantityHolderTrack.tpcTofNSigmaPr)))); + } + if constexpr (doRequiringTof && !doRejectingOthers) { + return (std::fabs(quantityHolderTrack.tpcTofNSigmaKa) < cfgCutMaxAbsNSigmaPid.value); + } + if constexpr (!doRequiringTof && doRejectingOthers) { + return (std::fabs(quantityHolderTrack.tpcNSigmaKa) < std::min(cfgCutMaxAbsNSigmaPid.value, std::min(std::fabs(quantityHolderTrack.tpcNSigmaPi), std::fabs(quantityHolderTrack.tpcNSigmaPr)))); + } + return (std::fabs(quantityHolderTrack.tpcNSigmaKa) < cfgCutMaxAbsNSigmaPid.value); + } + + template + bool isPr() + { + if constexpr (doRequiringTof && doRejectingOthers) { + return (std::fabs(quantityHolderTrack.tpcTofNSigmaPr) < std::min(cfgCutMaxAbsNSigmaPid.value, std::min(std::fabs(quantityHolderTrack.tpcTofNSigmaPi), std::fabs(quantityHolderTrack.tpcTofNSigmaKa)))); + } + if constexpr (doRequiringTof && !doRejectingOthers) { + return (std::fabs(quantityHolderTrack.tpcTofNSigmaPr) < cfgCutMaxAbsNSigmaPid.value); + } + if constexpr (!doRequiringTof && doRejectingOthers) { + return (std::fabs(quantityHolderTrack.tpcNSigmaPr) < std::min(cfgCutMaxAbsNSigmaPid.value, std::min(std::fabs(quantityHolderTrack.tpcNSigmaPi), std::fabs(quantityHolderTrack.tpcNSigmaKa)))); + } + return (std::fabs(quantityHolderTrack.tpcNSigmaPr) < cfgCutMaxAbsNSigmaPid.value); + } + + bool isGoodMomentum() + { + return (cfgCutMinPt.value < quantityHolderTrack.pt && quantityHolderTrack.pt < cfgCutMaxPt.value && std::fabs(quantityHolderTrack.eta) < cfgCutMaxAbsEta.value); + } + + template + bool isGoodTrack(const T& track) + { + if ((cfgFlagPvContributor.value && !track.isPVContributor())) { + return false; + } + if (!(track.itsNCls() > cfgCutMinItsNCls.value)) { + return false; + } + if (!(track.itsChi2NCl() < cfgCutMaxItsChi2NCls.value)) { + return false; + } + if (!(track.tpcNClsFound() > cfgCutMinTpcNCls.value)) { + return false; + } + if (!(track.tpcChi2NCl() < cfgCutMaxTpcChi2NCls.value)) { + return false; + } + if (!(track.tpcFractionSharedCls() < cfgCutMaxTpcNClsSharedRatio.value)) { + return false; + } + if (!(track.tpcNClsCrossedRows() > cfgCutMinTpcNClsCrossedRows.value)) { + return false; + } + if (!(track.tpcCrossedRowsOverFindableCls() > cfgCutMinTpcNClsCrossedRowsRatio.value)) { + return false; + } + if (!(std::fabs(track.dcaXY()) < cfgCutMaxAbsNSigmaDcaXy.value * (cfgParSigmaDcaXy.value[0] + cfgParSigmaDcaXy.value[1] * std::pow(track.pt(), cfgParSigmaDcaXy.value[2])))) { + return false; + } + if (!(std::fabs(track.dcaZ()) < cfgCutMaxAbsDcaZ.value)) { + return false; + } + return true; + } + + template + bool initTrack(const T& track) + { + quantityHolderTrack.clear(); + quantityHolderTrack.sign = track.sign(); + quantityHolderTrack.pt = track.pt(); + quantityHolderTrack.eta = track.eta(); + quantityHolderTrack.phi = track.phi(); + quantityHolderTrack.ptOverQ = quantityHolderTrack.pt / quantityHolderTrack.sign; + quantityHolderTrack.pOverQ = track.p() / quantityHolderTrack.sign; + quantityHolderTrack.rapidityPi = track.rapidity(constants::physics::MassPiPlus); + quantityHolderTrack.rapidityKa = track.rapidity(constants::physics::MassKPlus); + quantityHolderTrack.rapidityPr = track.rapidity(constants::physics::MassProton); + quantityHolderTrack.hasTpcPid = (track.hasTPC() && track.tpcSignal() > 0.); + quantityHolderTrack.tpcNSigmaPi = track.tpcNSigmaPi(); + quantityHolderTrack.tpcNSigmaKa = track.tpcNSigmaKa(); + quantityHolderTrack.tpcNSigmaPr = track.tpcNSigmaPr(); + quantityHolderTrack.hasTofPid = (track.hasTOF() && track.beta() > 0.); + quantityHolderTrack.tofNSigmaPi = track.tofNSigmaPi(); + quantityHolderTrack.tofNSigmaKa = track.tofNSigmaKa(); + quantityHolderTrack.tofNSigmaPr = track.tofNSigmaPr(); + quantityHolderTrack.tpcTofNSigmaPi = std::sqrt(std::pow(quantityHolderTrack.tpcNSigmaPi, 2.) + std::pow(quantityHolderTrack.tofNSigmaPi, 2.)); + quantityHolderTrack.tpcTofNSigmaKa = std::sqrt(std::pow(quantityHolderTrack.tpcNSigmaKa, 2.) + std::pow(quantityHolderTrack.tofNSigmaKa, 2.)); + quantityHolderTrack.tpcTofNSigmaPr = std::sqrt(std::pow(quantityHolderTrack.tpcNSigmaPr, 2.) + std::pow(quantityHolderTrack.tofNSigmaPr, 2.)); + if constexpr (doProcessingMc) { + quantityHolderTrack.mcParticleId = track.mcParticleId(); + } + + if constexpr (doInitingEvent) { + quantityHolderEvent.nGlobalTracks++; + if (track.isPVContributor()) { + quantityHolderEvent.nPvContributors++; + } + if (quantityHolderTrack.hasTofPid) { + quantityHolderEvent.nTofBeta++; + } + quantityHolderEvent.meanDcaXy += track.dcaXY(); + quantityHolderEvent.meanSquareDcaXy += std::pow(track.dcaXY(), 2.); + quantityHolderEvent.meanDcaZ += track.dcaZ(); + quantityHolderEvent.meanSquareDcaZ += std::pow(track.dcaZ(), 2.); + } + + if constexpr (!doProcessingMc && doInitingEvent) { + if (cfgFlagQaRun.value) { + hrQaRun.fill(HIST("QaRun/pRunIndexItsNCls"), quantityHolderEvent.runIndex, track.itsNCls()); + hrQaRun.fill(HIST("QaRun/pRunIndexItsChi2NCls"), quantityHolderEvent.runIndex, track.itsChi2NCl()); + hrQaRun.fill(HIST("QaRun/pRunIndexTpcNCls"), quantityHolderEvent.runIndex, track.tpcNClsFound()); + hrQaRun.fill(HIST("QaRun/pRunIndexTpcChi2NCls"), quantityHolderEvent.runIndex, track.tpcChi2NCl()); + hrQaRun.fill(HIST("QaRun/pRunIndexTpcNClsSharedRatio"), quantityHolderEvent.runIndex, track.tpcFractionSharedCls()); + hrQaRun.fill(HIST("QaRun/pRunIndexTpcNClsCrossedRows"), quantityHolderEvent.runIndex, track.tpcNClsCrossedRows()); + hrQaRun.fill(HIST("QaRun/pRunIndexTpcNClsCrossedRowsRatio"), quantityHolderEvent.runIndex, track.tpcCrossedRowsOverFindableCls()); + hrQaRun.fill(HIST("QaRun/pRunIndexDcaXy"), quantityHolderEvent.runIndex, track.dcaXY()); + hrQaRun.fill(HIST("QaRun/pRunIndexDcaZ"), quantityHolderEvent.runIndex, track.dcaZ()); + hrQaRun.fill(HIST("QaRun/pRunIndexPt"), quantityHolderEvent.runIndex, quantityHolderTrack.pt); + hrQaRun.fill(HIST("QaRun/pRunIndexEta"), quantityHolderEvent.runIndex, quantityHolderTrack.eta); + hrQaRun.fill(HIST("QaRun/pRunIndexPhi"), quantityHolderEvent.runIndex, quantityHolderTrack.phi); + if (quantityHolderTrack.hasTpcPid) { + hrQaRun.fill(HIST("QaRun/pRunIndexTpcDeDx"), quantityHolderEvent.runIndex, track.tpcSignal()); + hrQaRun.fill(HIST("QaRun/pRunIndexTpcNSigmaPi"), quantityHolderEvent.runIndex, quantityHolderTrack.tpcNSigmaPi); + hrQaRun.fill(HIST("QaRun/pRunIndexTpcNSigmaKa"), quantityHolderEvent.runIndex, quantityHolderTrack.tpcNSigmaKa); + hrQaRun.fill(HIST("QaRun/pRunIndexTpcNSigmaPr"), quantityHolderEvent.runIndex, quantityHolderTrack.tpcNSigmaPr); + } + if (quantityHolderTrack.hasTofPid) { + hrQaRun.fill(HIST("QaRun/pRunIndexTofInverseBeta"), quantityHolderEvent.runIndex, 1. / track.beta()); + hrQaRun.fill(HIST("QaRun/pRunIndexTofNSigmaPi"), quantityHolderEvent.runIndex, quantityHolderTrack.tofNSigmaPi); + hrQaRun.fill(HIST("QaRun/pRunIndexTofNSigmaKa"), quantityHolderEvent.runIndex, quantityHolderTrack.tofNSigmaKa); + hrQaRun.fill(HIST("QaRun/pRunIndexTofNSigmaPr"), quantityHolderEvent.runIndex, quantityHolderTrack.tofNSigmaPr); + } + } + } + + if constexpr (!doProcessingMc && !doInitingEvent) { + if (cfgFlagQaTrack.value) { + hrQaTrack.fill(HIST("QaTrack/hItsNCls"), track.itsNCls()); + hrQaTrack.fill(HIST("QaTrack/hItsChi2NCls"), track.itsChi2NCl()); + hrQaTrack.fill(HIST("QaTrack/hTpcNClsNClsSharedNClsFindableNClsCrossedRows"), track.tpcNClsFound(), track.tpcNClsShared(), track.tpcNClsFindable(), track.tpcNClsCrossedRows()); + hrQaTrack.fill(HIST("QaTrack/hTpcChi2NCls"), track.tpcChi2NCl()); + hrQaTrack.fill(HIST("QaTrack/hPtDcaXy"), quantityHolderTrack.pt, track.dcaXY()); + hrQaTrack.fill(HIST("QaTrack/hPtDcaZ"), quantityHolderTrack.pt, track.dcaZ()); + if (track.isPVContributor()) { + hrQaTrack.fill(HIST("QaTrack/hPtDcaXy_pvContributor"), quantityHolderTrack.pt, track.dcaXY()); + hrQaTrack.fill(HIST("QaTrack/hPtDcaZ_pvContributor"), quantityHolderTrack.pt, track.dcaZ()); + } + } + } + + if (!isGoodTrack(track)) { + return false; + } + + if constexpr (doProcessingMc && doInitingEvent) { + if (cfgFlagCalculationEfficiency.value) { + if (quantityHolderTrack.hasTpcPid) { + if (isPi()) { + if (quantityHolderTrack.sign == 1) { + quantityHolderEvent.mcParticleIndicesMatchedTpcPiP.push_back(quantityHolderTrack.mcParticleId); + } else if (quantityHolderTrack.sign == -1) { + quantityHolderEvent.mcParticleIndicesMatchedTpcPiM.push_back(quantityHolderTrack.mcParticleId); + } + } + if (isKa()) { + if (quantityHolderTrack.sign == 1) { + quantityHolderEvent.mcParticleIndicesMatchedTpcKaP.push_back(quantityHolderTrack.mcParticleId); + } else if (quantityHolderTrack.sign == -1) { + quantityHolderEvent.mcParticleIndicesMatchedTpcKaM.push_back(quantityHolderTrack.mcParticleId); + } + } + if (isPr()) { + if (quantityHolderTrack.sign == 1) { + quantityHolderEvent.mcParticleIndicesMatchedTpcPrP.push_back(quantityHolderTrack.mcParticleId); + } else if (quantityHolderTrack.sign == -1) { + quantityHolderEvent.mcParticleIndicesMatchedTpcPrM.push_back(quantityHolderTrack.mcParticleId); + } + } + if (quantityHolderTrack.hasTofPid) { + if (isPi()) { + if (quantityHolderTrack.sign == 1) { + quantityHolderEvent.mcParticleIndicesMatchedTpcTofPiP.push_back(quantityHolderTrack.mcParticleId); + } else if (quantityHolderTrack.sign == -1) { + quantityHolderEvent.mcParticleIndicesMatchedTpcTofPiM.push_back(quantityHolderTrack.mcParticleId); + } + } + if (isKa()) { + if (quantityHolderTrack.sign == 1) { + quantityHolderEvent.mcParticleIndicesMatchedTpcTofKaP.push_back(quantityHolderTrack.mcParticleId); + } else if (quantityHolderTrack.sign == -1) { + quantityHolderEvent.mcParticleIndicesMatchedTpcTofKaM.push_back(quantityHolderTrack.mcParticleId); + } + } + if (isPr()) { + if (quantityHolderTrack.sign == 1) { + quantityHolderEvent.mcParticleIndicesMatchedTpcTofPrP.push_back(quantityHolderTrack.mcParticleId); + } else if (quantityHolderTrack.sign == -1) { + quantityHolderEvent.mcParticleIndicesMatchedTpcTofPrM.push_back(quantityHolderTrack.mcParticleId); + } + } + } + } + } + } + + if constexpr (!doProcessingMc && !doInitingEvent) { + if (cfgFlagQaPid.value) { + if (quantityHolderTrack.hasTpcPid) { + hrQaPid.fill(HIST("QaPid/hPOverQEtaTpcLnDeDx"), quantityHolderTrack.pOverQ, quantityHolderTrack.eta, std::log(track.tpcSignal())); + hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcNSigmaPi"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcNSigmaPi); + if (std::fabs(quantityHolderTrack.tofNSigmaPi) < cfgCutMaxAbsNSigmaPid.value) { + hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcNSigmaPi_tofPi"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcNSigmaPi); + } + hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcNSigmaKa"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcNSigmaKa); + if (std::fabs(quantityHolderTrack.tofNSigmaKa) < cfgCutMaxAbsNSigmaPid.value) { + hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcNSigmaKa_tofKa"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcNSigmaKa); + } + hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcNSigmaPr"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcNSigmaPr); + if (std::fabs(quantityHolderTrack.tofNSigmaPr) < cfgCutMaxAbsNSigmaPid.value) { + hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcNSigmaPr_tofPr"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcNSigmaPr); + } + if (track.beta() > 0.) { + hrQaPid.fill(HIST("QaPid/hPOverQEtaTofInverseBeta"), quantityHolderTrack.pOverQ, quantityHolderTrack.eta, 1. / track.beta()); + if (std::fabs(quantityHolderTrack.tpcNSigmaPi) < cfgCutMaxAbsNSigmaPid.value) { + hrQaPid.fill(HIST("QaPid/hPtOverQEtaTofNSigmaPi_tpcPi"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tofNSigmaPi); + } + if (std::fabs(quantityHolderTrack.tpcNSigmaKa) < cfgCutMaxAbsNSigmaPid.value) { + hrQaPid.fill(HIST("QaPid/hPtOverQEtaTofNSigmaKa_tpcKa"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tofNSigmaKa); + } + if (std::fabs(quantityHolderTrack.tpcNSigmaPr) < cfgCutMaxAbsNSigmaPid.value) { + hrQaPid.fill(HIST("QaPid/hPtOverQEtaTofNSigmaPr_tpcPr"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tofNSigmaPr); + } + hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcTofNSigmaPi"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcTofNSigmaPi); + hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcTofNSigmaKa"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcTofNSigmaKa); + hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcTofNSigmaPr"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcTofNSigmaPr); + } + } + } + + if (cfgFlagQaAcceptance.value) { + if ((quantityHolderTrack.eta > 0. && quantityHolderEvent.vz > cfgCutMaxAbsVertexZ.value - 0.5) || (quantityHolderTrack.eta < 0. && quantityHolderEvent.vz < -cfgCutMaxAbsVertexZ.value + 0.5)) { + if (quantityHolderTrack.hasTpcPid) { + hrQaAcceptance.fill(HIST("QaAcceptance/hEtaPt_tpc"), quantityHolderTrack.eta, quantityHolderTrack.pt); + hrQaAcceptance.fill(HIST("QaAcceptance/hPhi_tpc"), quantityHolderTrack.phi); + if (isPi()) { + hrQaAcceptance.fill(HIST("QaAcceptance/hYPt_tpc_pi"), quantityHolderTrack.rapidityPi, quantityHolderTrack.pt); + } + if (isKa()) { + hrQaAcceptance.fill(HIST("QaAcceptance/hYPt_tpc_ka"), quantityHolderTrack.rapidityKa, quantityHolderTrack.pt); + } + if (isPr()) { + hrQaAcceptance.fill(HIST("QaAcceptance/hYPt_tpc_pr"), quantityHolderTrack.rapidityPr, quantityHolderTrack.pt); + if (track.tpcNClsCrossedRows() > cfgCutMinTpcNClsCrossedRows.value + 10) { + hrQaAcceptance.fill(HIST("QaAcceptance/hYPt_tpc_pr_tighter"), quantityHolderTrack.rapidityPr, quantityHolderTrack.pt); + } + } + if (quantityHolderTrack.hasTofPid) { + hrQaAcceptance.fill(HIST("QaAcceptance/hEtaPt_tpcTof"), quantityHolderTrack.eta, quantityHolderTrack.pt); + hrQaAcceptance.fill(HIST("QaAcceptance/hPhi_tpcTof"), quantityHolderTrack.phi); + if (isPi()) { + hrQaAcceptance.fill(HIST("QaAcceptance/hYPt_tpcTof_pi"), quantityHolderTrack.rapidityPi, quantityHolderTrack.pt); + } + if (isKa()) { + hrQaAcceptance.fill(HIST("QaAcceptance/hYPt_tpcTof_ka"), quantityHolderTrack.rapidityKa, quantityHolderTrack.pt); + } + if (isPr()) { + hrQaAcceptance.fill(HIST("QaAcceptance/hYPt_tpcTof_pr"), quantityHolderTrack.rapidityPr, quantityHolderTrack.pt); + } + } + } + } + } + } + + return true; + } + + template + bool initEvent(const C& collision, const Ts& tracks) + { + quantityHolderEvent.clear(); + + hrCounter.fill(HIST("hNEvents"), 0.); + + if (!collision.has_foundBC()) { + hrCounter.fill(HIST("hNEvents"), 2.); + return false; + } + + const auto& bc = collision.template bc_as(); + quantityHolderEvent.runNumber = bc.runNumber(); + quantityHolderEvent.runIndex = std::distance(cfgListRun.value.begin(), std::ranges::find(cfgListRun.value, quantityHolderEvent.runNumber)); + + if (std::ranges::find(cfgListRun.value, quantityHolderEvent.runNumber) == cfgListRun.value.end() || std::ranges::find(cfgListRunBad.value, quantityHolderEvent.runNumber) != cfgListRunBad.value.end()) { + hrCounter.fill(HIST("hNEvents"), 2.); + return false; + } + + for (std::int32_t const& iEvSel : std::views::iota(0, aod::evsel::kNsel)) { + if (((cfgFlagEventSel.value >> iEvSel) & 1) && !collision.selection_bit(iEvSel)) { + hrCounter.fill(HIST("hNEvents"), 3); + hrCounter.fill(HIST("hNEvents"), 10 + iEvSel); + return false; + } + } + + quantityHolderEvent.vz = collision.posZ(); + + if constexpr (!doProcessingMc) { + if (cfgFlagQaEvent.value) { + hrQaEvent.fill(HIST("QaEvent/hRunIndexVxVy"), quantityHolderEvent.runIndex, collision.posX(), collision.posY()); + hrQaEvent.fill(HIST("QaEvent/hRunIndexVz"), quantityHolderEvent.runIndex, quantityHolderEvent.vz); + } + } + + if (!(std::fabs(quantityHolderEvent.vz) < cfgCutMaxAbsVertexZ.value)) { + hrCounter.fill(HIST("hNEvents"), 4); + return false; + } + + if constexpr (!doProcessingMc) { + if (cfgFlagQaRun.value) { + hrQaRun.fill(HIST("QaRun/pRunIndexVx"), quantityHolderEvent.runIndex, collision.posX()); + hrQaRun.fill(HIST("QaRun/pRunIndexVy"), quantityHolderEvent.runIndex, collision.posY()); + hrQaRun.fill(HIST("QaRun/pRunIndexVz"), quantityHolderEvent.runIndex, quantityHolderEvent.vz); + hrQaRun.fill(HIST("QaRun/pRunIndexMultFv0a"), quantityHolderEvent.runIndex, collision.multZeqFV0A()); + hrQaRun.fill(HIST("QaRun/pRunIndexMultFt0a"), quantityHolderEvent.runIndex, collision.multZeqFT0A()); + hrQaRun.fill(HIST("QaRun/pRunIndexMultFt0c"), quantityHolderEvent.runIndex, collision.multZeqFT0C()); + } + } + + for (const auto& track : tracks) { + initTrack(track); + } + if (quantityHolderEvent.nGlobalTracks > 0.) { + quantityHolderEvent.meanDcaXy /= quantityHolderEvent.nGlobalTracks; + quantityHolderEvent.meanSquareDcaXy /= quantityHolderEvent.nGlobalTracks; + quantityHolderEvent.meanDcaZ /= quantityHolderEvent.nGlobalTracks; + quantityHolderEvent.meanSquareDcaZ /= quantityHolderEvent.nGlobalTracks; + } + + if constexpr (!doProcessingMc) { + if (cfgFlagQaRun.value) { + hrQaRun.fill(HIST("QaRun/pRunIndexNGlobalTracks"), quantityHolderEvent.runIndex, quantityHolderEvent.nGlobalTracks); + hrQaRun.fill(HIST("QaRun/pRunIndexNPvContributors"), quantityHolderEvent.runIndex, quantityHolderEvent.nPvContributors); + hrQaRun.fill(HIST("QaRun/pRunIndexNTofBeta"), quantityHolderEvent.runIndex, quantityHolderEvent.nTofBeta); + if (quantityHolderEvent.nGlobalTracks > 0) { + hrQaRun.fill(HIST("QaRun/pRunIndexMeanDcaXy"), quantityHolderEvent.runIndex, quantityHolderEvent.meanDcaXy); + hrQaRun.fill(HIST("QaRun/pRunIndexSigmaDcaXy"), quantityHolderEvent.runIndex, std::sqrt(quantityHolderEvent.meanSquareDcaXy - std::pow(quantityHolderEvent.meanDcaXy, 2.))); + hrQaRun.fill(HIST("QaRun/pRunIndexMeanDcaZ"), quantityHolderEvent.runIndex, quantityHolderEvent.meanDcaZ); + hrQaRun.fill(HIST("QaRun/pRunIndexSigmaDcaZ"), quantityHolderEvent.runIndex, std::sqrt(quantityHolderEvent.meanSquareDcaZ - std::pow(quantityHolderEvent.meanDcaZ, 2.))); + } + } + } + + if constexpr (!doProcessingMc) { + if (cfgFlagQaEvent.value) { + hrQaEvent.fill(HIST("QaEvent/hRunIndexNTofBetaNGlobalTracks"), quantityHolderEvent.runIndex, quantityHolderEvent.nTofBeta, quantityHolderEvent.nGlobalTracks); + hrQaEvent.fill(HIST("QaEvent/hRunIndexNPvContributorsNGlobalTracks"), quantityHolderEvent.runIndex, quantityHolderEvent.nPvContributors, quantityHolderEvent.nGlobalTracks); + if (quantityHolderEvent.nGlobalTracks > 0) { + hrQaEvent.fill(HIST("QaEvent/hRunIndexNGlobalTracksMeanDcaXy"), quantityHolderEvent.runIndex, quantityHolderEvent.nGlobalTracks, quantityHolderEvent.meanDcaXy); + hrQaEvent.fill(HIST("QaEvent/pRunIndexNGlobalTracksMeanDcaXy"), quantityHolderEvent.runIndex, quantityHolderEvent.nGlobalTracks, quantityHolderEvent.meanDcaXy); + hrQaEvent.fill(HIST("QaEvent/hRunIndexNGlobalTracksMeanDcaZ"), quantityHolderEvent.runIndex, quantityHolderEvent.nGlobalTracks, quantityHolderEvent.meanDcaZ); + hrQaEvent.fill(HIST("QaEvent/pRunIndexNGlobalTracksMeanDcaZ"), quantityHolderEvent.runIndex, quantityHolderEvent.nGlobalTracks, quantityHolderEvent.meanDcaZ); + } + } + } + + if (!(quantityHolderEvent.nPvContributors - quantityHolderEvent.nGlobalTracks > cfgCutMinNPvContributorsDeviation.value)) { + hrCounter.fill(HIST("hNEvents"), 5); + return false; + } + + hrCounter.fill(HIST("hNEvents"), 1.); + + if constexpr (!doProcessingMc) { + if (cfgFlagQaEvent.value) { + if (quantityHolderEvent.nGlobalTracks > 0) { + hrQaEvent.fill(HIST("QaEvent/hRunIndexNGlobalTracksMeanDcaXy_nPvContributorsCut"), quantityHolderEvent.runIndex, quantityHolderEvent.nGlobalTracks, quantityHolderEvent.meanDcaXy); + hrQaEvent.fill(HIST("QaEvent/pRunIndexNGlobalTracksMeanDcaXy_nPvContributorsCut"), quantityHolderEvent.runIndex, quantityHolderEvent.nGlobalTracks, quantityHolderEvent.meanDcaXy); + hrQaEvent.fill(HIST("QaEvent/hRunIndexNGlobalTracksMeanDcaZ_nPvContributorsCut"), quantityHolderEvent.runIndex, quantityHolderEvent.nGlobalTracks, quantityHolderEvent.meanDcaZ); + hrQaEvent.fill(HIST("QaEvent/pRunIndexNGlobalTracksMeanDcaZ_nPvContributorsCut"), quantityHolderEvent.runIndex, quantityHolderEvent.nGlobalTracks, quantityHolderEvent.meanDcaZ); + } + } + } + + quantityHolderEvent.centrality = collision.centFT0M(); + + if constexpr (!doProcessingMc) { + if (cfgFlagQaCentrality.value) { + hrQaCentrality.fill(HIST("QaCentrality/hCentralityFv0a"), collision.centFV0A(), collision.multZeqFV0A()); + hrQaCentrality.fill(HIST("QaCentrality/hCentralityFt0a"), collision.centFT0A(), collision.multZeqFT0A()); + hrQaCentrality.fill(HIST("QaCentrality/hCentralityFt0c"), collision.centFT0C(), collision.multZeqFT0C()); + hrQaCentrality.fill(HIST("QaCentrality/hCentralityFt0m"), quantityHolderEvent.centrality, collision.multZeqFT0A() + collision.multZeqFT0C()); + } + } + + return true; + } + + void processRaw(const soa::Filtered::iterator& collision, const soa::Filtered& tracks, const aod::BCsWithTimestamps&) + { + if (!initEvent(collision, tracks)) { + return; + } + + if (!cfgFlagQaTrack.value && !cfgFlagQaPid.value && !cfgFlagQaAcceptance.value && !cfgFlagAnalysisFluctuationCh.value && !cfgFlagAnalysisFluctuationKa.value && !cfgFlagAnalysisFluctuationPr.value) { + return; + } + + if (cfgFlagAnalysisFluctuationCh.value || cfgFlagAnalysisFluctuationKa.value || cfgFlagAnalysisFluctuationPr.value) { + quantityHolderEvent.subgroupIndex = gRandom->Integer(cfgNSubgroups.value); + if (cfgFlagAnalysisFluctuationCh.value) { + fluctuationCalculatorTrackChP->init(); + fluctuationCalculatorTrackChM->init(); + fluctuationCalculatorTrackChT->init(); + fluctuationCalculatorTrackChN->init(); + } + if (cfgFlagAnalysisFluctuationKa.value) { + fluctuationCalculatorTrackKaP->init(); + fluctuationCalculatorTrackKaM->init(); + fluctuationCalculatorTrackKaT->init(); + fluctuationCalculatorTrackKaN->init(); + } + if (cfgFlagAnalysisFluctuationPr.value) { + fluctuationCalculatorTrackPrP->init(); + fluctuationCalculatorTrackPrM->init(); + fluctuationCalculatorTrackPrT->init(); + fluctuationCalculatorTrackPrN->init(); + } + } + for (const auto& track : tracks) { + if (!initTrack(track)) { + continue; + } + + if (cfgFlagAnalysisFluctuationCh.value) { + if (isGoodMomentum() && quantityHolderTrack.hasTpcPid) { + if (quantityHolderTrack.pt < cfgThresholdPtTofPi.value) { + if (isPi()) { + if (quantityHolderTrack.sign == 1) { + quantityHolderEvent.nChP++; + + const double efficiency = pVzPtEtaEfficiencyTpcPiP->GetBinContent(pVzPtEtaEfficiencyTpcPiP->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcPiP->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcPiP->GetZaxis()->FindBin(quantityHolderTrack.eta)); + + fluctuationCalculatorTrackChP->fill(1., efficiency); + fluctuationCalculatorTrackChT->fill(1., efficiency); + fluctuationCalculatorTrackChN->fill(1., efficiency); + } else if (quantityHolderTrack.sign == -1) { + quantityHolderEvent.nChM++; + + const double efficiency = pVzPtEtaEfficiencyTpcPiM->GetBinContent(pVzPtEtaEfficiencyTpcPiM->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcPiM->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcPiM->GetZaxis()->FindBin(quantityHolderTrack.eta)); + + fluctuationCalculatorTrackChM->fill(1., efficiency); + fluctuationCalculatorTrackChT->fill(1., efficiency); + fluctuationCalculatorTrackChN->fill(-1., efficiency); + } + } + } else if (quantityHolderTrack.hasTofPid) { + if (isPi()) { + if (quantityHolderTrack.sign == 1) { + quantityHolderEvent.nChP++; + + const double efficiency = pVzPtEtaEfficiencyTpcTofPiP->GetBinContent(pVzPtEtaEfficiencyTpcTofPiP->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcTofPiP->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcTofPiP->GetZaxis()->FindBin(quantityHolderTrack.eta)); + + fluctuationCalculatorTrackChP->fill(1., efficiency); + fluctuationCalculatorTrackChT->fill(1., efficiency); + fluctuationCalculatorTrackChN->fill(1., efficiency); + } else if (quantityHolderTrack.sign == -1) { + quantityHolderEvent.nChM++; + + const double efficiency = pVzPtEtaEfficiencyTpcTofPiM->GetBinContent(pVzPtEtaEfficiencyTpcTofPiM->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcTofPiM->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcTofPiM->GetZaxis()->FindBin(quantityHolderTrack.eta)); + + fluctuationCalculatorTrackChM->fill(1., efficiency); + fluctuationCalculatorTrackChT->fill(1., efficiency); + fluctuationCalculatorTrackChN->fill(-1., efficiency); + } + } + } + if (quantityHolderTrack.pt < cfgThresholdPtTofKa.value) { + if (isKa()) { + if (quantityHolderTrack.sign == 1) { + quantityHolderEvent.nChP++; + + const double efficiency = pVzPtEtaEfficiencyTpcKaP->GetBinContent(pVzPtEtaEfficiencyTpcKaP->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcKaP->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcKaP->GetZaxis()->FindBin(quantityHolderTrack.eta)); + + fluctuationCalculatorTrackChP->fill(1., efficiency); + fluctuationCalculatorTrackChT->fill(1., efficiency); + fluctuationCalculatorTrackChN->fill(1., efficiency); + } else if (quantityHolderTrack.sign == -1) { + quantityHolderEvent.nChM++; + + const double efficiency = pVzPtEtaEfficiencyTpcKaM->GetBinContent(pVzPtEtaEfficiencyTpcKaM->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcKaM->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcKaM->GetZaxis()->FindBin(quantityHolderTrack.eta)); + + fluctuationCalculatorTrackChM->fill(1., efficiency); + fluctuationCalculatorTrackChT->fill(1., efficiency); + fluctuationCalculatorTrackChN->fill(-1., efficiency); + } + } + } else if (quantityHolderTrack.hasTofPid) { + if (isKa()) { + if (quantityHolderTrack.sign == 1) { + quantityHolderEvent.nChP++; + + const double efficiency = pVzPtEtaEfficiencyTpcTofKaP->GetBinContent(pVzPtEtaEfficiencyTpcTofKaP->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcTofKaP->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcTofKaP->GetZaxis()->FindBin(quantityHolderTrack.eta)); + + fluctuationCalculatorTrackChP->fill(1., efficiency); + fluctuationCalculatorTrackChT->fill(1., efficiency); + fluctuationCalculatorTrackChN->fill(1., efficiency); + } else if (quantityHolderTrack.sign == -1) { + quantityHolderEvent.nChM++; + + const double efficiency = pVzPtEtaEfficiencyTpcTofKaM->GetBinContent(pVzPtEtaEfficiencyTpcTofKaM->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcTofKaM->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcTofKaM->GetZaxis()->FindBin(quantityHolderTrack.eta)); + + fluctuationCalculatorTrackChM->fill(1., efficiency); + fluctuationCalculatorTrackChT->fill(1., efficiency); + fluctuationCalculatorTrackChN->fill(-1., efficiency); + } + } + } + if (quantityHolderTrack.pt < cfgThresholdPtTofPr.value) { + if (isPr()) { + if (quantityHolderTrack.sign == 1) { + quantityHolderEvent.nChP++; + + const double efficiency = pVzPtEtaEfficiencyTpcPrP->GetBinContent(pVzPtEtaEfficiencyTpcPrP->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcPrP->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcPrP->GetZaxis()->FindBin(quantityHolderTrack.eta)); + + fluctuationCalculatorTrackChP->fill(1., efficiency); + fluctuationCalculatorTrackChT->fill(1., efficiency); + fluctuationCalculatorTrackChN->fill(1., efficiency); + } else if (quantityHolderTrack.sign == -1) { + quantityHolderEvent.nChM++; + + const double efficiency = pVzPtEtaEfficiencyTpcPrM->GetBinContent(pVzPtEtaEfficiencyTpcPrM->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcPrM->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcPrM->GetZaxis()->FindBin(quantityHolderTrack.eta)); + + fluctuationCalculatorTrackChM->fill(1., efficiency); + fluctuationCalculatorTrackChT->fill(1., efficiency); + fluctuationCalculatorTrackChN->fill(-1., efficiency); + } + } + } else if (quantityHolderTrack.hasTofPid) { + if (isPr()) { + if (quantityHolderTrack.sign == 1) { + quantityHolderEvent.nChP++; + + const double efficiency = pVzPtEtaEfficiencyTpcTofPrP->GetBinContent(pVzPtEtaEfficiencyTpcTofPrP->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcTofPrP->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcTofPrP->GetZaxis()->FindBin(quantityHolderTrack.eta)); + + fluctuationCalculatorTrackChP->fill(1., efficiency); + fluctuationCalculatorTrackChT->fill(1., efficiency); + fluctuationCalculatorTrackChN->fill(1., efficiency); + } else if (quantityHolderTrack.sign == -1) { + quantityHolderEvent.nChM++; + + const double efficiency = pVzPtEtaEfficiencyTpcTofPrM->GetBinContent(pVzPtEtaEfficiencyTpcTofPrM->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcTofPrM->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcTofPrM->GetZaxis()->FindBin(quantityHolderTrack.eta)); + + fluctuationCalculatorTrackChM->fill(1., efficiency); + fluctuationCalculatorTrackChT->fill(1., efficiency); + fluctuationCalculatorTrackChN->fill(-1., efficiency); + } + } + } + } + } + + if (cfgFlagAnalysisFluctuationKa.value) { + if (isGoodMomentum() && quantityHolderTrack.hasTpcPid) { + if (quantityHolderTrack.pt < cfgThresholdPtTofKa.value) { + if (isKa()) { + if (quantityHolderTrack.sign == 1) { + quantityHolderEvent.nKaP++; + + const double efficiency = pVzPtEtaEfficiencyTpcKaP->GetBinContent(pVzPtEtaEfficiencyTpcKaP->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcKaP->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcKaP->GetZaxis()->FindBin(quantityHolderTrack.eta)); + + fluctuationCalculatorTrackKaP->fill(1., efficiency); + fluctuationCalculatorTrackKaT->fill(1., efficiency); + fluctuationCalculatorTrackKaN->fill(1., efficiency); + } else if (quantityHolderTrack.sign == -1) { + quantityHolderEvent.nKaM++; + + const double efficiency = pVzPtEtaEfficiencyTpcKaM->GetBinContent(pVzPtEtaEfficiencyTpcKaM->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcKaM->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcKaM->GetZaxis()->FindBin(quantityHolderTrack.eta)); + + fluctuationCalculatorTrackKaM->fill(1., efficiency); + fluctuationCalculatorTrackKaT->fill(1., efficiency); + fluctuationCalculatorTrackKaN->fill(-1., efficiency); + } + } + } else if (quantityHolderTrack.hasTofPid) { + if (isKa()) { + if (quantityHolderTrack.sign == 1) { + quantityHolderEvent.nKaP++; + + const double efficiency = pVzPtEtaEfficiencyTpcTofKaP->GetBinContent(pVzPtEtaEfficiencyTpcTofKaP->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcTofKaP->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcTofKaP->GetZaxis()->FindBin(quantityHolderTrack.eta)); + + fluctuationCalculatorTrackKaP->fill(1., efficiency); + fluctuationCalculatorTrackKaT->fill(1., efficiency); + fluctuationCalculatorTrackKaN->fill(1., efficiency); + } else if (quantityHolderTrack.sign == -1) { + quantityHolderEvent.nKaM++; + + const double efficiency = pVzPtEtaEfficiencyTpcTofKaM->GetBinContent(pVzPtEtaEfficiencyTpcTofKaM->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcTofKaM->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcTofKaM->GetZaxis()->FindBin(quantityHolderTrack.eta)); + + fluctuationCalculatorTrackKaM->fill(1., efficiency); + fluctuationCalculatorTrackKaT->fill(1., efficiency); + fluctuationCalculatorTrackKaN->fill(-1., efficiency); + } + } + } + } + } + + if (cfgFlagAnalysisFluctuationPr.value) { + if (isGoodMomentum() && quantityHolderTrack.hasTpcPid) { + if (quantityHolderTrack.pt < cfgThresholdPtTofPr.value) { + if (isPr()) { + if (quantityHolderTrack.sign == 1) { + quantityHolderEvent.nPrP++; + + const double efficiency = pVzPtEtaEfficiencyTpcPrP->GetBinContent(pVzPtEtaEfficiencyTpcPrP->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcPrP->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcPrP->GetZaxis()->FindBin(quantityHolderTrack.eta)); + + fluctuationCalculatorTrackPrP->fill(1., efficiency); + fluctuationCalculatorTrackPrT->fill(1., efficiency); + fluctuationCalculatorTrackPrN->fill(1., efficiency); + } else if (quantityHolderTrack.sign == -1) { + quantityHolderEvent.nPrM++; + + const double efficiency = pVzPtEtaEfficiencyTpcPrM->GetBinContent(pVzPtEtaEfficiencyTpcPrM->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcPrM->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcPrM->GetZaxis()->FindBin(quantityHolderTrack.eta)); + + fluctuationCalculatorTrackPrM->fill(1., efficiency); + fluctuationCalculatorTrackPrT->fill(1., efficiency); + fluctuationCalculatorTrackPrN->fill(-1., efficiency); + } + } + } else if (quantityHolderTrack.hasTofPid) { + if (isPr()) { + if (quantityHolderTrack.sign == 1) { + quantityHolderEvent.nPrP++; + + const double efficiency = pVzPtEtaEfficiencyTpcTofPrP->GetBinContent(pVzPtEtaEfficiencyTpcTofPrP->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcTofPrP->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcTofPrP->GetZaxis()->FindBin(quantityHolderTrack.eta)); + + fluctuationCalculatorTrackPrP->fill(1., efficiency); + fluctuationCalculatorTrackPrT->fill(1., efficiency); + fluctuationCalculatorTrackPrN->fill(1., efficiency); + } else if (quantityHolderTrack.sign == -1) { + quantityHolderEvent.nPrM++; + + const double efficiency = pVzPtEtaEfficiencyTpcTofPrM->GetBinContent(pVzPtEtaEfficiencyTpcTofPrM->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcTofPrM->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcTofPrM->GetZaxis()->FindBin(quantityHolderTrack.eta)); + + fluctuationCalculatorTrackPrM->fill(1., efficiency); + fluctuationCalculatorTrackPrT->fill(1., efficiency); + fluctuationCalculatorTrackPrN->fill(-1., efficiency); + } + } + } + } + } + } + if (cfgFlagAnalysisFluctuationCh.value) { + hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hCentralityNChPNChM"), quantityHolderEvent.centrality, quantityHolderEvent.nChP, quantityHolderEvent.nChM); + for (std::int32_t const& iOrderVector : std::views::iota(0, static_cast(fluctuation_calculator_base::kNOrderVectors))) { + hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hFluctuationCalculatorChP"), quantityHolderEvent.centrality, quantityHolderEvent.subgroupIndex, iOrderVector, fluctuationCalculatorTrackChP->getProductFast(iOrderVector)); + hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hFluctuationCalculatorChM"), quantityHolderEvent.centrality, quantityHolderEvent.subgroupIndex, iOrderVector, fluctuationCalculatorTrackChM->getProductFast(iOrderVector)); + hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hFluctuationCalculatorChT"), quantityHolderEvent.centrality, quantityHolderEvent.subgroupIndex, iOrderVector, fluctuationCalculatorTrackChT->getProductFast(iOrderVector)); + hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hFluctuationCalculatorChN"), quantityHolderEvent.centrality, quantityHolderEvent.subgroupIndex, iOrderVector, fluctuationCalculatorTrackChN->getProductFast(iOrderVector)); + } + } + if (cfgFlagAnalysisFluctuationKa.value) { + hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hCentralityNKaPNKaM"), quantityHolderEvent.centrality, quantityHolderEvent.nKaP, quantityHolderEvent.nKaM); + for (std::int32_t const& iOrderVector : std::views::iota(0, static_cast(fluctuation_calculator_base::kNOrderVectors))) { + hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hFluctuationCalculatorKaP"), quantityHolderEvent.centrality, quantityHolderEvent.subgroupIndex, iOrderVector, fluctuationCalculatorTrackKaP->getProductFast(iOrderVector)); + hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hFluctuationCalculatorKaM"), quantityHolderEvent.centrality, quantityHolderEvent.subgroupIndex, iOrderVector, fluctuationCalculatorTrackKaM->getProductFast(iOrderVector)); + hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hFluctuationCalculatorKaT"), quantityHolderEvent.centrality, quantityHolderEvent.subgroupIndex, iOrderVector, fluctuationCalculatorTrackKaT->getProductFast(iOrderVector)); + hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hFluctuationCalculatorKaN"), quantityHolderEvent.centrality, quantityHolderEvent.subgroupIndex, iOrderVector, fluctuationCalculatorTrackKaN->getProductFast(iOrderVector)); + } + } + if (cfgFlagAnalysisFluctuationPr.value) { + hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hCentralityNPrPNPrM"), quantityHolderEvent.centrality, quantityHolderEvent.nPrP, quantityHolderEvent.nPrM); + for (std::int32_t const& iOrderVector : std::views::iota(0, static_cast(fluctuation_calculator_base::kNOrderVectors))) { + hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hFluctuationCalculatorPrP"), quantityHolderEvent.centrality, quantityHolderEvent.subgroupIndex, iOrderVector, fluctuationCalculatorTrackPrP->getProductFast(iOrderVector)); + hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hFluctuationCalculatorPrM"), quantityHolderEvent.centrality, quantityHolderEvent.subgroupIndex, iOrderVector, fluctuationCalculatorTrackPrM->getProductFast(iOrderVector)); + hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hFluctuationCalculatorPrT"), quantityHolderEvent.centrality, quantityHolderEvent.subgroupIndex, iOrderVector, fluctuationCalculatorTrackPrT->getProductFast(iOrderVector)); + hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hFluctuationCalculatorPrN"), quantityHolderEvent.centrality, quantityHolderEvent.subgroupIndex, iOrderVector, fluctuationCalculatorTrackPrN->getProductFast(iOrderVector)); + } + } + } + PROCESS_SWITCH(PartNumFluc, processRaw, "Process raw data", false); + + Preslice presliceTracksPerCollision = aod::track::collisionId; + void processMc(const soa::Filtered::iterator& mcCollision, const aod::McParticles& mcParticles, const soa::SmallGroups& collisions, const soa::Filtered& tracksUngrouped, const aod::BCsWithTimestamps&) + { + for (const auto& collision : collisions) { + if (collision.globalIndex() != mcCollision.bestCollisionIndex()) { + continue; + } + + const auto& tracks = tracksUngrouped.sliceBy(presliceTracksPerCollision, collision.globalIndex()); + + if (!initEvent(collision, tracks)) { + return; + } + + for (const auto& mcParticle : mcParticles) { + quantityHolderMcParticle.clear(); + quantityHolderMcParticle.globalIndex = mcParticle.globalIndex(); + quantityHolderMcParticle.pdgCode = mcParticle.pdgCode(); + quantityHolderMcParticle.pt = mcParticle.pt(); + quantityHolderMcParticle.eta = mcParticle.eta(); + + if (!mcParticle.isPhysicalPrimary()) { + continue; + } + + if (cfgFlagCalculationEfficiency.value) { + switch (quantityHolderMcParticle.pdgCode) { + case PDG_t::kPiPlus: + hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcPiP"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcPiP, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcPiP.end() ? 1. : 0.); + hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofPiP"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcTofPiP, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcTofPiP.end() ? 1. : 0.); + break; + case PDG_t::kPiMinus: + hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcPiM"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcPiM, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcPiM.end() ? 1. : 0.); + hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofPiM"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcTofPiM, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcTofPiM.end() ? 1. : 0.); + break; + case PDG_t::kKPlus: + hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcKaP"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcKaP, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcKaP.end() ? 1. : 0.); + hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofKaP"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcTofKaP, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcTofKaP.end() ? 1. : 0.); + break; + case PDG_t::kKMinus: + hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcKaM"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcKaM, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcKaM.end() ? 1. : 0.); + hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofKaM"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcTofKaM, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcTofKaM.end() ? 1. : 0.); + break; + case PDG_t::kProton: + hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcPrP"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcPrP, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcPrP.end() ? 1. : 0.); + hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofPrP"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcTofPrP, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcTofPrP.end() ? 1. : 0.); + break; + case PDG_t::kProtonBar: + hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcPrM"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcPrM, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcPrM.end() ? 1. : 0.); + hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofPrM"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcTofPrM, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcTofPrM.end() ? 1. : 0.); + break; + default: + break; + } + } + } + } + } + PROCESS_SWITCH(PartNumFluc, processMc, "Process MC data", true); +}; + +WorkflowSpec defineDataProcessing(const ConfigContext& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From 82bd6347bd9694f354f49b277107917f00c7d0f8 Mon Sep 17 00:00:00 2001 From: alcaliva <32872606+alcaliva@users.noreply.github.com> Date: Sun, 19 Oct 2025 08:23:36 +0200 Subject: [PATCH 806/986] [PWGLF] added multiplicity axis for correlation analysis (#13443) --- PWGLF/Tasks/Nuspex/antinucleiInJets.cxx | 69 ++++++++++++++----------- 1 file changed, 39 insertions(+), 30 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx index f964137285b..1258c5cf330 100644 --- a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx +++ b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx @@ -448,6 +448,9 @@ struct AntinucleiInJets { // Event counter registryCorr.add("eventCounter", "number of events", HistType::kTH1F, {{20, 0, 20, "counter"}}); + registryCorr.add("eventCounter_centrality_fullEvent", "Number of events per centrality (Full Event)", HistType::kTH1F, {multiplicityAxis}); + registryCorr.add("eventCounter_centrality_jet", "Number of events per centrality (Jet)", HistType::kTH1F, {multiplicityAxis}); + registryCorr.add("eventCounter_centrality_ue", "Number of events per centrality (Underlying Event)", HistType::kTH1F, {multiplicityAxis}); // Correlation histograms: antiproton vs. antideuteron number vs. event multiplicity registryCorr.add("rho_jet", "rho_jet", HistType::kTH3F, {nAntideuteronsAxis, nAntiprotonsAxis, multiplicityAxis}); @@ -460,25 +463,25 @@ struct AntinucleiInJets { registryCorr.add("rho_netP_netD_fullEvent", "rho_netP_netD_fullEvent", HistType::kTH2F, {nAntideuteronsAxis, nAntiprotonsAxis}); // Efficiency histograms jet - registryCorr.add("q1d_jet", "q1d_jet", HistType::kTH2F, {nAntideuteronsAxis, ptPerNucleonAxis}); - registryCorr.add("q1p_jet", "q1p_jet", HistType::kTH2F, {nAntiprotonsAxis, ptPerNucleonAxis}); - registryCorr.add("q1d_square_jet", "q1d_square_jet", HistType::kTH3F, {ptPerNucleonAxis, ptPerNucleonAxis, nBarD2Axis}); - registryCorr.add("q1p_square_jet", "q1p_square_jet", HistType::kTH3F, {ptPerNucleonAxis, ptPerNucleonAxis, nBarP2Axis}); - registryCorr.add("q1d_q1p_jet", "q1d_q1p_jet", HistType::kTH3F, {ptPerNucleonAxis, ptPerNucleonAxis, nBarDnBarPAxis}); + registryCorr.add("q1d_jet", "q1d_jet", HistType::kTH3F, {nAntideuteronsAxis, ptPerNucleonAxis, multiplicityAxis}); + registryCorr.add("q1p_jet", "q1p_jet", HistType::kTH3F, {nAntiprotonsAxis, ptPerNucleonAxis, multiplicityAxis}); + registryCorr.add("q1d_square_jet", "q1d_square_jet", HistType::kTHnSparseD, {ptPerNucleonAxis, ptPerNucleonAxis, nBarD2Axis, multiplicityAxis}); + registryCorr.add("q1p_square_jet", "q1p_square_jet", HistType::kTHnSparseD, {ptPerNucleonAxis, ptPerNucleonAxis, nBarP2Axis, multiplicityAxis}); + registryCorr.add("q1d_q1p_jet", "q1d_q1p_jet", HistType::kTHnSparseD, {ptPerNucleonAxis, ptPerNucleonAxis, nBarDnBarPAxis, multiplicityAxis}); // Efficiency histograms UE - registryCorr.add("q1d_ue", "q1d_ue", HistType::kTH2F, {nAntideuteronsAxis, ptPerNucleonAxis}); - registryCorr.add("q1p_ue", "q1p_ue", HistType::kTH2F, {nAntiprotonsAxis, ptPerNucleonAxis}); - registryCorr.add("q1d_square_ue", "q1d_square_ue", HistType::kTH3F, {ptPerNucleonAxis, ptPerNucleonAxis, nBarD2Axis}); - registryCorr.add("q1p_square_ue", "q1p_square_ue", HistType::kTH3F, {ptPerNucleonAxis, ptPerNucleonAxis, nBarP2Axis}); - registryCorr.add("q1d_q1p_ue", "q1d_q1p_ue", HistType::kTH3F, {ptPerNucleonAxis, ptPerNucleonAxis, nBarDnBarPAxis}); + registryCorr.add("q1d_ue", "q1d_ue", HistType::kTH3F, {nAntideuteronsAxis, ptPerNucleonAxis, multiplicityAxis}); + registryCorr.add("q1p_ue", "q1p_ue", HistType::kTH3F, {nAntiprotonsAxis, ptPerNucleonAxis, multiplicityAxis}); + registryCorr.add("q1d_square_ue", "q1d_square_ue", HistType::kTHnSparseD, {ptPerNucleonAxis, ptPerNucleonAxis, nBarD2Axis, multiplicityAxis}); + registryCorr.add("q1p_square_ue", "q1p_square_ue", HistType::kTHnSparseD, {ptPerNucleonAxis, ptPerNucleonAxis, nBarP2Axis, multiplicityAxis}); + registryCorr.add("q1d_q1p_ue", "q1d_q1p_ue", HistType::kTHnSparseD, {ptPerNucleonAxis, ptPerNucleonAxis, nBarDnBarPAxis, multiplicityAxis}); // Efficiency histograms full event - registryCorr.add("q1d_fullEvent", "q1d_fullEvent", HistType::kTH2F, {nAntideuteronsAxis, ptPerNucleonAxis}); - registryCorr.add("q1p_fullEvent", "q1p_fullEvent", HistType::kTH2F, {nAntiprotonsAxis, ptPerNucleonAxis}); - registryCorr.add("q1d_square_fullEvent", "q1d_square_fullEvent", HistType::kTH3F, {ptPerNucleonAxis, ptPerNucleonAxis, nBarD2Axis}); - registryCorr.add("q1p_square_fullEvent", "q1p_square_fullEvent", HistType::kTH3F, {ptPerNucleonAxis, ptPerNucleonAxis, nBarP2Axis}); - registryCorr.add("q1d_q1p_fullEvent", "q1d_q1p_fullEvent", HistType::kTH3F, {ptPerNucleonAxis, ptPerNucleonAxis, nBarDnBarPAxis}); + registryCorr.add("q1d_fullEvent", "q1d_fullEvent", HistType::kTH3F, {nAntideuteronsAxis, ptPerNucleonAxis, multiplicityAxis}); + registryCorr.add("q1p_fullEvent", "q1p_fullEvent", HistType::kTH3F, {nAntiprotonsAxis, ptPerNucleonAxis, multiplicityAxis}); + registryCorr.add("q1d_square_fullEvent", "q1d_square_fullEvent", HistType::kTHnSparseD, {ptPerNucleonAxis, ptPerNucleonAxis, nBarD2Axis, multiplicityAxis}); + registryCorr.add("q1p_square_fullEvent", "q1p_square_fullEvent", HistType::kTHnSparseD, {ptPerNucleonAxis, ptPerNucleonAxis, nBarP2Axis, multiplicityAxis}); + registryCorr.add("q1d_q1p_fullEvent", "q1d_q1p_fullEvent", HistType::kTHnSparseD, {ptPerNucleonAxis, ptPerNucleonAxis, nBarDnBarPAxis, multiplicityAxis}); } } @@ -2475,6 +2478,9 @@ struct AntinucleiInJets { // Multiplicity percentile const float multiplicity = collision.centFT0M(); + // Fill event counter vs centrality (full Event region) + registryCorr.fill(HIST("eventCounter_centrality_fullEvent"), multiplicity); + // pt/A bins std::vector ptOverAbins = {0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}; const int nBins = ptOverAbins.size() - 1; @@ -2559,13 +2565,13 @@ struct AntinucleiInJets { for (int i = 0; i < nBins; i++) { double ptAcenteri = 0.5 * (ptOverAbins[i] + ptOverAbins[i + 1]); - registryCorr.fill(HIST("q1d_fullEvent"), nAntideuteronFullEvent[i], ptAcenteri); - registryCorr.fill(HIST("q1p_fullEvent"), nAntiprotonFullEvent[i], ptAcenteri); + registryCorr.fill(HIST("q1d_fullEvent"), nAntideuteronFullEvent[i], ptAcenteri, multiplicity); + registryCorr.fill(HIST("q1p_fullEvent"), nAntiprotonFullEvent[i], ptAcenteri, multiplicity); for (int j = 0; j < nBins; j++) { double ptAcenterj = 0.5 * (ptOverAbins[j] + ptOverAbins[j + 1]); - registryCorr.fill(HIST("q1d_square_fullEvent"), ptAcenteri, ptAcenterj, nAntideuteronFullEvent[i] * nAntideuteronFullEvent[j]); - registryCorr.fill(HIST("q1p_square_fullEvent"), ptAcenteri, ptAcenterj, nAntiprotonFullEvent[i] * nAntiprotonFullEvent[j]); - registryCorr.fill(HIST("q1d_q1p_fullEvent"), ptAcenteri, ptAcenterj, nAntideuteronFullEvent[i] * nAntiprotonFullEvent[j]); + registryCorr.fill(HIST("q1d_square_fullEvent"), ptAcenteri, ptAcenterj, nAntideuteronFullEvent[i] * nAntideuteronFullEvent[j], multiplicity); + registryCorr.fill(HIST("q1p_square_fullEvent"), ptAcenteri, ptAcenterj, nAntiprotonFullEvent[i] * nAntiprotonFullEvent[j], multiplicity); + registryCorr.fill(HIST("q1d_q1p_fullEvent"), ptAcenteri, ptAcenterj, nAntideuteronFullEvent[i] * nAntiprotonFullEvent[j], multiplicity); } } @@ -2707,13 +2713,13 @@ struct AntinucleiInJets { for (int i = 0; i < nBins; i++) { double ptAcenteri = 0.5 * (ptOverAbins[i] + ptOverAbins[i + 1]); - registryCorr.fill(HIST("q1d_jet"), nAntideuteronJet[i], ptAcenteri); - registryCorr.fill(HIST("q1p_jet"), nAntiprotonJet[i], ptAcenteri); + registryCorr.fill(HIST("q1d_jet"), nAntideuteronJet[i], ptAcenteri, multiplicity); + registryCorr.fill(HIST("q1p_jet"), nAntiprotonJet[i], ptAcenteri, multiplicity); for (int j = 0; j < nBins; j++) { double ptAcenterj = 0.5 * (ptOverAbins[j] + ptOverAbins[j + 1]); - registryCorr.fill(HIST("q1d_square_jet"), ptAcenteri, ptAcenterj, nAntideuteronJet[i] * nAntideuteronJet[j]); - registryCorr.fill(HIST("q1p_square_jet"), ptAcenteri, ptAcenterj, nAntiprotonJet[i] * nAntiprotonJet[j]); - registryCorr.fill(HIST("q1d_q1p_jet"), ptAcenteri, ptAcenterj, nAntideuteronJet[i] * nAntiprotonJet[j]); + registryCorr.fill(HIST("q1d_square_jet"), ptAcenteri, ptAcenterj, nAntideuteronJet[i] * nAntideuteronJet[j], multiplicity); + registryCorr.fill(HIST("q1p_square_jet"), ptAcenteri, ptAcenterj, nAntiprotonJet[i] * nAntiprotonJet[j], multiplicity); + registryCorr.fill(HIST("q1d_q1p_jet"), ptAcenteri, ptAcenterj, nAntideuteronJet[i] * nAntiprotonJet[j], multiplicity); } } @@ -2815,19 +2821,22 @@ struct AntinucleiInJets { for (int i = 0; i < nBins; i++) { double ptAcenteri = 0.5 * (ptOverAbins[i] + ptOverAbins[i + 1]); - registryCorr.fill(HIST("q1d_ue"), nAntideuteronUE[i], ptAcenteri); - registryCorr.fill(HIST("q1p_ue"), nAntiprotonUE[i], ptAcenteri); + registryCorr.fill(HIST("q1d_ue"), nAntideuteronUE[i], ptAcenteri, multiplicity); + registryCorr.fill(HIST("q1p_ue"), nAntiprotonUE[i], ptAcenteri, multiplicity); for (int j = 0; j < nBins; j++) { double ptAcenterj = 0.5 * (ptOverAbins[j] + ptOverAbins[j + 1]); - registryCorr.fill(HIST("q1d_square_ue"), ptAcenteri, ptAcenterj, nAntideuteronUE[i] * nAntideuteronUE[j]); - registryCorr.fill(HIST("q1p_square_ue"), ptAcenteri, ptAcenterj, nAntiprotonUE[i] * nAntiprotonUE[j]); - registryCorr.fill(HIST("q1d_q1p_ue"), ptAcenteri, ptAcenterj, nAntideuteronUE[i] * nAntiprotonUE[j]); + registryCorr.fill(HIST("q1d_square_ue"), ptAcenteri, ptAcenterj, nAntideuteronUE[i] * nAntideuteronUE[j], multiplicity); + registryCorr.fill(HIST("q1p_square_ue"), ptAcenteri, ptAcenterj, nAntiprotonUE[i] * nAntiprotonUE[j], multiplicity); + registryCorr.fill(HIST("q1d_q1p_ue"), ptAcenteri, ptAcenterj, nAntideuteronUE[i] * nAntiprotonUE[j], multiplicity); } } + // Fill event counter vs centrality (ue region) + registryCorr.fill(HIST("eventCounter_centrality_ue"), multiplicity); } // Event counter: events with at least one jet selected if (isAtLeastOneJetSelected) { registryCorr.fill(HIST("eventCounter"), 9.5); + registryCorr.fill(HIST("eventCounter_centrality_jet"), multiplicity); } } PROCESS_SWITCH(AntinucleiInJets, processCorr, "Process Correlation analysis", false); From 644fdef424a43962ebdce19e40450342eb72df59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Kr=C3=BCger?= <26876110+mario-krueger@users.noreply.github.com> Date: Sun, 19 Oct 2025 08:24:46 +0200 Subject: [PATCH 807/986] [PWGLF] read PCC weights from CCDB (#13442) --- .../particleCompositionCorrectionTable.h | 8 ++--- .../Nuspex/particleCompositionCorrection.cxx | 30 ++++++++++++++----- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/PWGLF/DataModel/particleCompositionCorrectionTable.h b/PWGLF/DataModel/particleCompositionCorrectionTable.h index b91ee3df50d..f57d2165e76 100644 --- a/PWGLF/DataModel/particleCompositionCorrectionTable.h +++ b/PWGLF/DataModel/particleCompositionCorrectionTable.h @@ -25,11 +25,11 @@ namespace o2::aod { namespace PCC { -DECLARE_SOA_COLUMN(Pccweight, pccweight, float); -DECLARE_SOA_COLUMN(Pccweightsysup, pccweightsysup, float); -DECLARE_SOA_COLUMN(Pccweightsysdown, pccweightsysdown, float); +DECLARE_SOA_COLUMN(PccWeight, pccWeight, float); +DECLARE_SOA_COLUMN(PccWeightSysUp, pccWeightSysUp, float); +DECLARE_SOA_COLUMN(PccWeightSysDown, pccWeightSysDown, float); } // namespace PCC -DECLARE_SOA_TABLE(ParticleCompositionCorrection, "AOD", "PARTICLECOMPOSITIONCORRECTION", PCC::Pccweight, PCC::Pccweightsysup, PCC::Pccweightsysdown); +DECLARE_SOA_TABLE(ParticleCompositionCorrection, "AOD", "PARTICLECOMPOSITIONCORRECTION", PCC::PccWeight, PCC::PccWeightSysUp, PCC::PccWeightSysDown); } // namespace o2::aod #endif // PWGLF_DATAMODEL_PARTICLECOMPOSITIONCORRECTIONTABLE_H_ diff --git a/PWGLF/TableProducer/Nuspex/particleCompositionCorrection.cxx b/PWGLF/TableProducer/Nuspex/particleCompositionCorrection.cxx index c8cdb79bb57..457cee3120a 100644 --- a/PWGLF/TableProducer/Nuspex/particleCompositionCorrection.cxx +++ b/PWGLF/TableProducer/Nuspex/particleCompositionCorrection.cxx @@ -17,6 +17,7 @@ #include "Tools/ML/model.h" +#include #include #include #include @@ -45,7 +46,6 @@ struct ParticleCompositionCorrection { /* backlog: - - store final neural networks in ccdb and implement accessing them - support collision systems beyond pp - add QA task illustrating improved mc/data matching of DCA distributions after scaling of secondaries - extend PCC weight table by columns with systematic variations (up/down) @@ -54,14 +54,18 @@ struct ParticleCompositionCorrection { */ Service pdg; + o2::ccdb::CcdbApi ccdbApi; + + Configurable skipAll{"skipAll", false, "run table producer in dummy mode, i.e. skip all computations and fill with 1"}; + Configurable skipSec{"skipSec", false, "dont calculate weights for secondaries"}; Configurable etaCut{"etaCut", 0.8f, "eta cut"}; Configurable ptMinCut{"ptMinCut", 0.15f, "pt min cut"}; Configurable ptMaxCut{"ptMaxCut", 10.f, "pt max cut"}; - Configurable skipSec{"skipSec", false, "dont calculate weights for secondaries"}; Configurable enableQAHistos{"enableQAHistos", true, "enable qa histograms showing the effect of the PCC"}; - Configurable modelNameData{"modelNameData", "ParticleFractions_pp_data.onnx", "Path to the .onnx file containing the particle fractions in data"}; - Configurable modelNameMC{"modelNameMC", "ParticleFractions_pp_pythia.onnx", "Path to the .onnx file containing the particle fractions in MC"}; + Configurable ccdbBasePath{"ccdbBasePath", "/Users/m/makruger/", "ccdb directory contianing the particle fraction networks"}; + Configurable modelPathData{"modelPathData", "PCC/data/pp", "Path to the .onnx file containing the particle fractions in data"}; + Configurable modelPathMC{"modelPathMC", "PCC/pythia/pp", "Path to the .onnx file containing the particle fractions in MC"}; OnnxModel particleFractionsData; OnnxModel particleFractionsMC; @@ -80,8 +84,18 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) void ParticleCompositionCorrection::init(InitContext const&) { - particleFractionsData.initModel(modelNameData.value, true); - particleFractionsMC.initModel(modelNameMC.value, true); + if (skipAll) { + return; + } + if (!ccdbBasePath.value.empty()) { + ccdbApi.init("http://ccdb-test.cern.ch:8080"); + static const int64_t dummyTimeStamp = 2; + if (!ccdbApi.retrieveBlob(ccdbBasePath.value + modelPathData.value, modelPathData.value, {}, dummyTimeStamp, false, "ParticleFractions_Data.onnx") || !ccdbApi.retrieveBlob(ccdbBasePath.value + modelPathMC.value, modelPathMC.value, {}, dummyTimeStamp, false, "ParticleFractions_MC.onnx")) { + LOGP(fatal, "Could not download particle fraction networks!"); + } + } + particleFractionsData.initModel(modelPathData.value + "/ParticleFractions_Data.onnx", true); + particleFractionsMC.initModel(modelPathMC.value + "/ParticleFractions_MC.onnx", true); if (enableQAHistos) { std::vector ptBinEdges = {0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, @@ -129,7 +143,7 @@ void ParticleCompositionCorrection::process(aod::McCollisions::iterator const&, float weight = 1.f; // calculate weights only inside the configured kinematic range - if (std::abs(particle.eta()) < etaCut && particle.pt() > ptMinCut && particle.pt() < ptMaxCut) { + if (!skipAll && std::abs(particle.eta()) < etaCut && particle.pt() > ptMinCut && particle.pt() < ptMaxCut) { auto refParticleID = particle.index(); // find initial particle of secondaries from decays or interactions with material @@ -165,6 +179,8 @@ void ParticleCompositionCorrection::process(aod::McCollisions::iterator const&, {PDG_t::kSigma0, 3.f}, {PDG_t::kXiMinus, 3.f}, // TODO: potentially extend by xi0/eta/omega/rho/phi/Delta... + // pdg codes defined in AliceO2/Common/Constants/include/CommonConstants/PhysicsConstants.h + // e.g. o2::constants::physics::Pdg::kEta }; if (auto iterMapPID = mapPID.find(absPDGCode); iterMapPID != mapPID.end()) { From 335635a5f792233c04e808c64743f909eaf86905 Mon Sep 17 00:00:00 2001 From: Giovanni Malfattore <89481844+giovannimalfattore@users.noreply.github.com> Date: Sun, 19 Oct 2025 08:25:12 +0200 Subject: [PATCH 808/986] [PWGLF] NucleiTask - Optimize cuts (#13434) --- PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx | 169 ++++++++------------------ 1 file changed, 53 insertions(+), 116 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx b/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx index 0a750cc3045..8966c65e23b 100644 --- a/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx +++ b/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx @@ -66,9 +66,9 @@ struct LFNucleiBATask { HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry spectraGen{"spectraGen", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; - HistogramRegistry debugHistos{"debugHistos", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry evtimeHistos{"evtimeHistos", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry evLossHistos{"evLossHistos", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry debugHistos{"debugHistos", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; + HistogramRegistry evtimeHistos{"evtimeHistos", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; + HistogramRegistry evLossHistos{"evLossHistos", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; // Enable particle for analysis Configurable enablePr{"enablePr", true, "Flag to enable proton analysis."}; @@ -77,7 +77,7 @@ struct LFNucleiBATask { Configurable enableHe{"enableHe", true, "Flag to enable helium-3 analysis."}; Configurable enableAl{"enableAl", true, "Flag to enable alpha analysis."}; - Configurable enableTrackingEff{"enableTrackingEff", 0, "Flag to enable tracking efficiency hitos."}; + Configurable enableTrackingEff{"enableTrackingEff", 0, "Flag to enable tracking efficiency histos."}; Configurable ccdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; // Set the triggered events skimming scheme @@ -406,12 +406,14 @@ struct LFNucleiBATask { histos.add("tracks/h1p", "Track momentum; p (GeV/#it{c}); counts", HistType::kTH1F, {{500, 0., 10.}}); } - histos.add("qa/h1ITSncr", "number of crossed rows in ITS; ITSncr; counts", HistType::kTH1F, {{12, 0, 12}}); - histos.add("qa/h1TPCncr", "number of crossed rows in TPC; TPCncr; counts", HistType::kTH1F, {{150, 60, 170}}); - histos.add("qa/h1rTPC", "ratio of ncr over findable in TPC; rTPC; counts", HistType::kTH1F, {{200, 0.9, 1.8}}); - histos.add("qa/h1TPCnfound", "ratio of found cluster in TPC; TPCnfound; counts", HistType::kTH1F, {{150, 60, 170}}); - histos.add("qa/h1chi2ITS", "#chi^{2}_{ITS}/n_{ITS}; #chi^{2}_{ITS}/n_{ITS};counts", HistType::kTH1F, {{51, -0.5, 50.5}}); - histos.add("qa/h1chi2TPC", "#chi^{2}_{TPC}/n_{TPC}; #chi^{2}_{TPC}/n_{TPC}; counts", HistType::kTH1F, {{11, -0.5, 10.5}}); + if (enableDebug) { + histos.add("qa/h1ITSncr", "number of crossed rows in ITS; ITSncr; counts", HistType::kTH1F, {{12, 0, 12}}); + histos.add("qa/h1TPCncr", "number of crossed rows in TPC; TPCncr; counts", HistType::kTH1F, {{150, 60, 170}}); + histos.add("qa/h1rTPC", "ratio of ncr over findable in TPC; rTPC; counts", HistType::kTH1F, {{200, 0.9, 1.8}}); + histos.add("qa/h1TPCnfound", "ratio of found cluster in TPC; TPCnfound; counts", HistType::kTH1F, {{150, 60, 170}}); + histos.add("qa/h1chi2ITS", "#chi^{2}_{ITS}/n_{ITS}; #chi^{2}_{ITS}/n_{ITS};counts", HistType::kTH1F, {{51, -0.5, 50.5}}); + histos.add("qa/h1chi2TPC", "#chi^{2}_{TPC}/n_{TPC}; #chi^{2}_{TPC}/n_{TPC}; counts", HistType::kTH1F, {{11, -0.5, 10.5}}); + } if (outFlagOptions.enableEffPlots) { histos.add("tracks/eff/h2pVsTPCmomentum", "#it{p}_{TPC} vs #it{p}; #it{p}_{TPC}; #it{p}", HistType::kTH2F, {{200, 0.f, 8.f}, {200, 0.f, 8.f}}); @@ -473,14 +475,9 @@ struct LFNucleiBATask { if (enableDebug) { debugHistos.add("tracks/eff/hPtP", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{400, 0., 8.}}); debugHistos.add("tracks/eff/hPtantiP", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{400, 0., 8.}}); - debugHistos.add("tracks/eff/hPtPrebinned", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{50, 0., 5.}}); - debugHistos.add("tracks/eff/hPtantiPrebinned", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{50, 0., 5.}}); - if (outFlagOptions.doTOFplots) { debugHistos.add("tracks/eff/hPtPTOF", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{400, 0., 8.}}); debugHistos.add("tracks/eff/hPtantiPTOF", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{400, 0., 8.}}); - debugHistos.add("tracks/eff/hPtPTOFrebinned", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{50, 0., 5.}}); - debugHistos.add("tracks/eff/hPtantiPTOFrebinned", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{50, 0., 5.}}); } } @@ -489,10 +486,6 @@ struct LFNucleiBATask { histos.add("tracks/eff/proton/hPtantiPr", "Track #it{p}_{T} (#bar{p}); #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{400, 0., 8.}}); histos.add("tracks/eff/proton/hPtPrTOF", "Track #it{p}_{T} (p); #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{400, 0., 8.}}); histos.add("tracks/eff/proton/hPtantiPrTOF", "Track #it{p}_{T} (#bar{p}); #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{400, 0., 8.}}); - histos.add("tracks/eff/proton/hPtPrrebinned", "Track #it{p}_{T} (p); #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{50, 0., 5.}}); - histos.add("tracks/eff/proton/hPtantiPrrebinned", "Track #it{p}_{T} (#bar{p}); #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{50, 0., 5.}}); - histos.add("tracks/eff/proton/hPtPrTOFrebinned", "Track #it{p}_{T} (p); #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{50, 0., 5.}}); - histos.add("tracks/eff/proton/hPtantiPrTOFrebinned", "Track #it{p}_{T} (#bar{p}); #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{50, 0., 5.}}); } if (enableDe) { histos.add("tracks/eff/deuteron/hPtDe", "Track #it{p}_{T} (d); #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{400, 0., 8.}}); @@ -519,8 +512,6 @@ struct LFNucleiBATask { histos.add("tracks/dca/before/hDCAxyVsDCAzVsPt", "DCAxy vs DCAz vs Pt/z; DCAxy; DCAz", HistType::kTH3F, {{140, -0.7f, 0.7f}, {160, -0.8f, 0.8f}, {binsPtHe}}); histos.add("tracks/dca/before/hDCAxyVsDCAz", "DCAxy vs DCAz (before cuts)", HistType::kTH2F, {{550, -1.1, 1.1}, {550, -1.1, 1.1}}); - histos.add("tracks/dca/before/hDCAxy", "DCAxy", HistType::kTH1F, {dcaxyAxis}); - histos.add("tracks/dca/before/hDCAz", "DCAz", HistType::kTH1F, {dcazAxis}); histos.add("tracks/dca/before/hDCAxyVsPt", "DCAxy vs Pt", HistType::kTH2F, {{ptAxis}, {dcaxyAxis}}); histos.add("tracks/dca/before/hDCAzVsPt", "DCAz vs Pt", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); @@ -555,8 +546,6 @@ struct LFNucleiBATask { histos.add("tracks/triton/dca/before/hDCAzVsPtantiTriton", "DCAz vs Pt (#bar{t})", HistType::kTH2F, {{ptAxis}, {dcazAxis}}); } if (enableHe) { - histos.add("tracks/helium/dca/before/hDCAxyVsDCAzVsPtHelium", "DCAxy vs DCAz vs Pt/z (He); DCAxy; DCAz", HistType::kTH3F, {{140, -0.7f, 0.7f}, {160, -0.8f, 0.8f}, {binsPtZHe}}); - histos.add("tracks/helium/dca/before/hDCAxyVsDCAzVsPtantiHelium", "DCAxy vs DCAz vs Pt/z (#bar{He}); DCAxy; DCAz", HistType::kTH3F, {{140, -0.7f, 0.7f}, {160, -0.8f, 0.8f}, {binsPtZHe}}); histos.add("tracks/helium/dca/before/h3DCAvsPtHelium", "", HistType::kTHnSparseD, {dcaxyAxis, dcazAxis, ptZHeAxis}); histos.add("tracks/helium/dca/before/h3DCAvsPtantiHelium", "", HistType::kTHnSparseD, {dcaxyAxis, dcazAxis, ptZHeAxis}); @@ -1679,15 +1668,9 @@ struct LFNucleiBATask { histos.add("tracks/helium/h2HeliumVspTNSigmaITSHe", "NSigmaITS(He) vs p/z; #it{p}/z (GeV/#it{c}); NSigmaITS(He)", HistType::kTH2F, {{pZAxis}, {sigmaITSAxis}}); histos.add("tracks/helium/h2antiHeliumVspTNSigmaITSHe", "NSigmaITS(#bar{He}) vs p/z; #it{p}/z (GeV/#it{c}); NSigmaITS(#bar{He})", HistType::kTH2F, {{pZAxis}, {sigmaITSAxis}}); - histos.add("tracks/helium/h2HeliumVspTNSigmaITSTr", "NSigmaITS(t) vs p/z; #it{p}/z (GeV/#it{c}); NSigmaITS(t)", HistType::kTH2F, {{pZAxis}, {sigmaITSAxis}}); - histos.add("tracks/helium/h2antiHeliumVspTNSigmaITSTr", "NSigmaITS(#bar{t}) vs p/z; #it{p}/z (GeV/#it{c}); NSigmaITS(#bar{t})", HistType::kTH2F, {{pZAxis}, {sigmaITSAxis}}); - histos.add("tracks/helium/h2HeliumVspTNSigmaITSHe_wTPCpid", "NSigmaITS(He) vs p/z; #it{p}/z (GeV/#it{c}); NSigmaITS(He)", HistType::kTH2F, {{pZAxis}, {sigmaITSAxis}}); histos.add("tracks/helium/h2antiHeliumVspTNSigmaITSHe_wTPCpid", "NSigmaITS(#bar{He}) vs p/z; #it{p}/z (GeV/#it{c}); NSigmaITS(#bar{He})", HistType::kTH2F, {{pZAxis}, {sigmaITSAxis}}); - histos.add("tracks/helium/h2HeliumVspTNSigmaITSTr_wTPCpid", "NSigmaITS(t) vs p/z; #it{p}/z (GeV/#it{c}); NSigmaITS(t)", HistType::kTH2F, {{pZAxis}, {sigmaITSAxis}}); - histos.add("tracks/helium/h2antiHeliumVspTNSigmaITSTr_wTPCpid", "NSigmaITS(#bar{t}) vs p/z; #it{p}/z (GeV/#it{c}); NSigmaITS(#bar{t})", HistType::kTH2F, {{pZAxis}, {sigmaITSAxis}}); - histos.add("tracks/helium/h2HeliumVspTNSigmaTPC", "NSigmaTPC(He) vs pT/z; #it{p}_{T}/z (GeV/#it{c}); NSigmaTPC", HistType::kTH2F, {{ptZHeAxis}, {sigmaTPCAxis}}); histos.add("tracks/helium/h2antiHeliumVspTNSigmaTPC", "NSigmaTPC(#bar{He}) vs pT/z; #it{p}_{T}/z (GeV/#it{c}); NSigmaTPC", HistType::kTH2F, {{ptZHeAxis}, {sigmaTPCAxis}}); } @@ -2147,6 +2130,8 @@ struct LFNucleiBATask { } LOG(info) << "Histograms of LFNucleiBATask:"; histos.print(); + if (doprocessMCGen) + spectraGen.print(); } template @@ -2369,12 +2354,10 @@ struct LFNucleiBATask { } float nITSDe = 99.f; - float nITSTr = 99.f; float nITSHe = 99.f; if (!IsFilteredData) { nITSDe = track.itsNSigmaDe(); - nITSTr = track.itsNSigmaTr(); nITSHe = track.itsNSigmaHe(); } heP = track.p(); @@ -2382,8 +2365,10 @@ struct LFNucleiBATask { heTPCmomentum = track.tpcInnerParam(); antiheTPCmomentum = track.tpcInnerParam(); - auto parDCAxy = (std::vector)parDCAxycuts; - auto parDCAz = (std::vector)parDCAzcuts; + // auto parDCAxy = (std::vector)parDCAxycuts; + // auto parDCAz = (std::vector)parDCAzcuts; + const auto& parDCAxy = parDCAxycuts.value; + const auto& parDCAz = parDCAzcuts.value; bool passDCAxyCut = false; bool passDCAzCut = false; @@ -2435,20 +2420,13 @@ struct LFNucleiBATask { bool passDCAxyzCut = false; + const float dcaXY2 = track.dcaXY() * track.dcaXY(); + const float dcaZ2 = track.dcaZ() * track.dcaZ(); + switch (dcaConfOptions.cfgCustomDCA) { case 0: - passDCAxyCut = (std::abs(track.dcaXY()) <= dcaConfOptions.cfgCustomDCAxy); - passDCAzCut = (std::abs(track.dcaZ()) <= dcaConfOptions.cfgCustomDCAz); - - passDCAxyCutDe = (std::abs(track.dcaXY()) <= dcaConfOptions.cfgCustomDCAxy); - passDCAzCutDe = (std::abs(track.dcaZ()) <= dcaConfOptions.cfgCustomDCAz); - passDCAxyCutAntiDe = (std::abs(track.dcaXY()) <= dcaConfOptions.cfgCustomDCAxy); - passDCAzCutAntiDe = (std::abs(track.dcaZ()) <= dcaConfOptions.cfgCustomDCAz); - - passDCAxyCutHe = (std::abs(track.dcaXY()) <= dcaConfOptions.cfgCustomDCAxy); - passDCAzCutHe = (std::abs(track.dcaZ()) <= dcaConfOptions.cfgCustomDCAz); - passDCAxyCutAntiHe = (std::abs(track.dcaXY()) <= dcaConfOptions.cfgCustomDCAxy); - passDCAzCutAntiHe = (std::abs(track.dcaZ()) <= dcaConfOptions.cfgCustomDCAz); + passDCAxyCut = passDCAxyCutDe = passDCAxyCutAntiDe = passDCAxyCutHe = passDCAxyCutAntiHe = (std::abs(track.dcaXY()) <= dcaConfOptions.cfgCustomDCAxy); + passDCAzCut = passDCAzCutDe = passDCAzCutAntiDe = passDCAzCutHe = passDCAzCutAntiHe = (std::abs(track.dcaZ()) <= dcaConfOptions.cfgCustomDCAz); break; case 1: passDCAxyCut = (std::abs(track.dcaXY()) <= parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(track.pt(), parDCAxy[2]))); @@ -2465,60 +2443,41 @@ struct LFNucleiBATask { passDCAzCutAntiHe = (std::abs(track.dcaZ()) <= parDCAz[3] * (parDCAz[0] + parDCAz[1] / std::pow(antihePt, parDCAz[2]))); break; case 2: - passDCAxyCut = (std::abs(track.dcaXY()) <= parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(track.pt(), parDCAxy[2]))); - passDCAzCut = (std::abs(track.dcaZ()) <= dcaConfOptions.cfgCustomDCAz); - passDCAxyCutDe = (std::abs(track.dcaXY()) <= parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(DPt, parDCAxy[2]))); - passDCAzCutDe = (std::abs(track.dcaZ()) <= dcaConfOptions.cfgCustomDCAz); passDCAxyCutAntiDe = (std::abs(track.dcaXY()) <= parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(antiDPt, parDCAxy[2]))); - passDCAzCutAntiDe = (std::abs(track.dcaZ()) <= dcaConfOptions.cfgCustomDCAz); passDCAxyCutHe = (std::abs(track.dcaXY()) <= parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(hePt, parDCAxy[2]))); - passDCAzCutHe = (std::abs(track.dcaZ()) <= dcaConfOptions.cfgCustomDCAz); passDCAxyCutAntiHe = (std::abs(track.dcaXY()) <= parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(antihePt, parDCAxy[2]))); - passDCAzCutAntiHe = (std::abs(track.dcaZ()) <= dcaConfOptions.cfgCustomDCAz); + + passDCAxyCut = (std::abs(track.dcaXY()) <= parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(track.pt(), parDCAxy[2]))); + passDCAzCut = passDCAzCutDe = passDCAzCutAntiDe = passDCAzCutHe = passDCAzCutAntiHe = (std::abs(track.dcaZ()) <= dcaConfOptions.cfgCustomDCAz); break; case 3: - passDCAxyCut = (std::abs(track.dcaXY()) <= dcaConfOptions.cfgCustomDCAxy); + passDCAxyCut = passDCAxyCutDe = passDCAxyCutAntiDe = passDCAxyCutHe = passDCAxyCutAntiHe = (std::abs(track.dcaXY()) <= dcaConfOptions.cfgCustomDCAxy); passDCAzCut = (std::abs(track.dcaZ()) <= parDCAz[3] * (parDCAz[0] + parDCAz[1] / std::pow(track.pt(), parDCAz[2]))); - passDCAxyCutDe = (std::abs(track.dcaXY()) <= dcaConfOptions.cfgCustomDCAxy); passDCAzCutDe = (std::abs(track.dcaZ()) <= parDCAz[3] * (parDCAz[0] + parDCAz[1] / std::pow(DPt, parDCAz[2]))); - passDCAxyCutAntiDe = (std::abs(track.dcaXY()) <= dcaConfOptions.cfgCustomDCAxy); passDCAzCutAntiDe = (std::abs(track.dcaZ()) <= parDCAz[3] * (parDCAz[0] + parDCAz[1] / std::pow(antiDPt, parDCAz[2]))); - passDCAxyCutHe = (std::abs(track.dcaXY()) <= dcaConfOptions.cfgCustomDCAxy); passDCAzCutHe = (std::abs(track.dcaZ()) <= parDCAz[3] * (parDCAz[0] + parDCAz[1] / std::pow(hePt, parDCAz[2]))); - passDCAxyCutAntiHe = (std::abs(track.dcaXY()) <= dcaConfOptions.cfgCustomDCAxy); passDCAzCutAntiHe = (std::abs(track.dcaZ()) <= parDCAz[3] * (parDCAz[0] + parDCAz[1] / std::pow(antihePt, parDCAz[2]))); break; case 4: - passDCAxyCut = std::pow(track.dcaXY(), 2) / std::pow(dcaConfOptions.cfgCustomDCAxy, 2) + std::pow(track.dcaZ(), 2) / std::pow(dcaConfOptions.cfgCustomDCAz, 2) <= 1; - passDCAzCut = std::pow(track.dcaXY(), 2) / std::pow(dcaConfOptions.cfgCustomDCAxy, 2) + std::pow(track.dcaZ(), 2) / std::pow(dcaConfOptions.cfgCustomDCAz, 2) <= 1; - - passDCAxyCutDe = std::pow(track.dcaXY(), 2) / std::pow(dcaConfOptions.cfgCustomDCAxy, 2) + std::pow(track.dcaZ(), 2) / std::pow(dcaConfOptions.cfgCustomDCAz, 2) <= 1; - passDCAzCutDe = std::pow(track.dcaXY(), 2) / std::pow(dcaConfOptions.cfgCustomDCAxy, 2) + std::pow(track.dcaZ(), 2) / std::pow(dcaConfOptions.cfgCustomDCAz, 2) <= 1; - passDCAxyCutAntiDe = std::pow(track.dcaXY(), 2) / std::pow(dcaConfOptions.cfgCustomDCAxy, 2) + std::pow(track.dcaZ(), 2) / std::pow(dcaConfOptions.cfgCustomDCAz, 2) <= 1; - passDCAzCutAntiDe = std::pow(track.dcaXY(), 2) / std::pow(dcaConfOptions.cfgCustomDCAxy, 2) + std::pow(track.dcaZ(), 2) / std::pow(dcaConfOptions.cfgCustomDCAz, 2) <= 1; - - passDCAxyCutHe = std::pow(track.dcaXY(), 2) / std::pow(dcaConfOptions.cfgCustomDCAxy, 2) + std::pow(track.dcaZ(), 2) / std::pow(dcaConfOptions.cfgCustomDCAz, 2) <= 1; - passDCAzCutHe = std::pow(track.dcaXY(), 2) / std::pow(dcaConfOptions.cfgCustomDCAxy, 2) + std::pow(track.dcaZ(), 2) / std::pow(dcaConfOptions.cfgCustomDCAz, 2) <= 1; - passDCAxyCutAntiHe = std::pow(track.dcaXY(), 2) / std::pow(dcaConfOptions.cfgCustomDCAxy, 2) + std::pow(track.dcaZ(), 2) / std::pow(dcaConfOptions.cfgCustomDCAz, 2) <= 1; - passDCAzCutAntiHe = std::pow(track.dcaXY(), 2) / std::pow(dcaConfOptions.cfgCustomDCAxy, 2) + std::pow(track.dcaZ(), 2) / std::pow(dcaConfOptions.cfgCustomDCAz, 2) <= 1; + passDCAxyCut = passDCAzCut = passDCAxyCutDe = passDCAzCutDe = passDCAxyCutAntiDe = passDCAzCutAntiDe = passDCAxyCutHe = passDCAzCutHe = passDCAxyCutAntiHe = passDCAzCutAntiHe = dcaXY2 / std::pow(dcaConfOptions.cfgCustomDCAxy, 2) + dcaZ2 / std::pow(dcaConfOptions.cfgCustomDCAz, 2) <= 1; break; case 5: - passDCAxyCut = std::pow(track.dcaXY(), 2) / std::pow(parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(track.pt(), parDCAxy[2])), 2) + std::pow(track.dcaZ(), 2) / std::pow(parDCAz[3] * (parDCAz[0] + parDCAz[1] / std::pow(track.pt(), parDCAz[2])), 2) <= 1; - passDCAzCut = std::pow(track.dcaXY(), 2) / std::pow(parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(track.pt(), parDCAxy[2])), 2) + std::pow(track.dcaZ(), 2) / std::pow(parDCAz[3] * (parDCAz[0] + parDCAz[1] / std::pow(track.pt(), parDCAz[2])), 2) <= 1; - - passDCAxyCutDe = std::pow(track.dcaXY(), 2) / std::pow(parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(DPt, parDCAxy[2])), 2) + std::pow(track.dcaZ(), 2) / std::pow(parDCAz[3] * (parDCAz[0] + parDCAz[1] / std::pow(DPt, parDCAz[2])), 2) <= 1; - passDCAzCutDe = std::pow(track.dcaXY(), 2) / std::pow(parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(DPt, parDCAxy[2])), 2) + std::pow(track.dcaZ(), 2) / std::pow(parDCAz[3] * (parDCAz[0] + parDCAz[1] / std::pow(DPt, parDCAz[2])), 2) <= 1; - passDCAxyCutAntiDe = std::pow(track.dcaXY(), 2) / std::pow(parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(antiDPt, parDCAxy[2])), 2) + std::pow(track.dcaZ(), 2) / std::pow(parDCAz[3] * (parDCAz[0] + parDCAz[1] / std::pow(antiDPt, parDCAz[2])), 2) <= 1; - passDCAzCutAntiDe = std::pow(track.dcaXY(), 2) / std::pow(parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(antiDPt, parDCAxy[2])), 2) + std::pow(track.dcaZ(), 2) / std::pow(parDCAz[3] * (parDCAz[0] + parDCAz[1] / std::pow(antiDPt, parDCAz[2])), 2) <= 1; - - passDCAxyCutHe = std::pow(track.dcaXY(), 2) / std::pow(parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(hePt, parDCAxy[2])), 2) + std::pow(track.dcaZ(), 2) / std::pow(parDCAz[3] * (parDCAz[0] + parDCAz[1] / std::pow(hePt, parDCAz[2])), 2) <= 1; - passDCAzCutHe = std::pow(track.dcaXY(), 2) / std::pow(parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(hePt, parDCAxy[2])), 2) + std::pow(track.dcaZ(), 2) / std::pow(parDCAz[3] * (parDCAz[0] + parDCAz[1] / std::pow(hePt, parDCAz[2])), 2) <= 1; - passDCAxyCutAntiHe = std::pow(track.dcaXY(), 2) / std::pow(parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(antihePt, parDCAxy[2])), 2) + std::pow(track.dcaZ(), 2) / std::pow(parDCAz[3] * (parDCAz[0] + parDCAz[1] / std::pow(antihePt, parDCAz[2])), 2) <= 1; - passDCAzCutAntiHe = std::pow(track.dcaXY(), 2) / std::pow(parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(antihePt, parDCAxy[2])), 2) + std::pow(track.dcaZ(), 2) / std::pow(parDCAz[3] * (parDCAz[0] + parDCAz[1] / std::pow(antihePt, parDCAz[2])), 2) <= 1; + passDCAxyCut = dcaXY2 / std::pow(parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(track.pt(), parDCAxy[2])), 2) + dcaZ2 / std::pow(parDCAz[3] * (parDCAz[0] + parDCAz[1] / std::pow(track.pt(), parDCAz[2])), 2) <= 1; + passDCAzCut = dcaXY2 / std::pow(parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(track.pt(), parDCAxy[2])), 2) + dcaZ2 / std::pow(parDCAz[3] * (parDCAz[0] + parDCAz[1] / std::pow(track.pt(), parDCAz[2])), 2) <= 1; + + passDCAxyCutDe = dcaXY2 / std::pow(parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(DPt, parDCAxy[2])), 2) + dcaZ2 / std::pow(parDCAz[3] * (parDCAz[0] + parDCAz[1] / std::pow(DPt, parDCAz[2])), 2) <= 1; + passDCAzCutDe = dcaXY2 / std::pow(parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(DPt, parDCAxy[2])), 2) + dcaZ2 / std::pow(parDCAz[3] * (parDCAz[0] + parDCAz[1] / std::pow(DPt, parDCAz[2])), 2) <= 1; + passDCAxyCutAntiDe = dcaXY2 / std::pow(parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(antiDPt, parDCAxy[2])), 2) + dcaZ2 / std::pow(parDCAz[3] * (parDCAz[0] + parDCAz[1] / std::pow(antiDPt, parDCAz[2])), 2) <= 1; + passDCAzCutAntiDe = dcaXY2 / std::pow(parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(antiDPt, parDCAxy[2])), 2) + dcaZ2 / std::pow(parDCAz[3] * (parDCAz[0] + parDCAz[1] / std::pow(antiDPt, parDCAz[2])), 2) <= 1; + + passDCAxyCutHe = dcaXY2 / std::pow(parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(hePt, parDCAxy[2])), 2) + dcaZ2 / std::pow(parDCAz[3] * (parDCAz[0] + parDCAz[1] / std::pow(hePt, parDCAz[2])), 2) <= 1; + passDCAzCutHe = dcaXY2 / std::pow(parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(hePt, parDCAxy[2])), 2) + dcaZ2 / std::pow(parDCAz[3] * (parDCAz[0] + parDCAz[1] / std::pow(hePt, parDCAz[2])), 2) <= 1; + passDCAxyCutAntiHe = dcaXY2 / std::pow(parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(antihePt, parDCAxy[2])), 2) + dcaZ2 / std::pow(parDCAz[3] * (parDCAz[0] + parDCAz[1] / std::pow(antihePt, parDCAz[2])), 2) <= 1; + passDCAzCutAntiHe = dcaXY2 / std::pow(parDCAxy[3] * (parDCAxy[0] + parDCAxy[1] / std::pow(antihePt, parDCAxy[2])), 2) + dcaZ2 / std::pow(parDCAz[3] * (parDCAz[0] + parDCAz[1] / std::pow(antihePt, parDCAz[2])), 2) <= 1; break; } @@ -2605,22 +2564,18 @@ struct LFNucleiBATask { histos.fill(HIST("tracks/dca/before/hDCAxyVsDCAz"), track.dcaZ(), track.dcaXY()); if (isHe && std::abs(track.tpcNSigmaHe()) < nsigmaTPCvar.nsigmaTPCHe) { - histos.fill(HIST("tracks/helium/dca/before/hDCAxyVsDCAzVsPtHelium"), track.dcaXY(), track.dcaZ(), hePt); histos.fill(HIST("tracks/helium/dca/before/h3DCAvsPtHelium"), track.dcaXY(), track.dcaZ(), hePt); if (track.hasTOF() && outFlagOptions.doTOFplots) { histos.fill(HIST("tracks/helium/dca/before/TOF/hDCAxyVsDCAzVsPtHelium"), track.dcaXY(), track.dcaZ(), hePt); } } if (isAntiHe && std::abs(track.tpcNSigmaHe()) < nsigmaTPCvar.nsigmaTPCHe) { - histos.fill(HIST("tracks/helium/dca/before/hDCAxyVsDCAzVsPtantiHelium"), track.dcaXY(), track.dcaZ(), antihePt); histos.fill(HIST("tracks/helium/dca/before/h3DCAvsPtantiHelium"), track.dcaXY(), track.dcaZ(), antihePt); if (track.hasTOF() && outFlagOptions.doTOFplots) { histos.fill(HIST("tracks/helium/dca/before/TOF/hDCAxyVsDCAzVsPtantiHelium"), track.dcaXY(), track.dcaZ(), antihePt); } } - if (passDCAxyCut) { - histos.fill(HIST("tracks/dca/before/hDCAz"), track.dcaZ()); histos.fill(HIST("tracks/dca/before/hDCAzVsPt"), track.pt(), track.dcaZ()); if (enablePr && prRapCut && (std::abs(track.tpcNSigmaPr()) < nsigmaTPCvar.nsigmaTPCPr)) { @@ -3105,7 +3060,6 @@ struct LFNucleiBATask { // Tracks DCA histos fill if (outFlagOptions.makeDCABeforeCutPlots) { if (passDCAzCut) { - histos.fill(HIST("tracks/dca/before/hDCAxy"), track.dcaXY()); histos.fill(HIST("tracks/dca/before/hDCAxyVsPt"), track.pt(), track.dcaXY()); if (enablePr && prRapCut) { @@ -3203,7 +3157,7 @@ struct LFNucleiBATask { isProdByGen = track.producedByGenerator(); isWeakDecay = (track.getProcess() == TMCProcess::kPDecay); pdgCode = track.pdgCode(); - genPt = std::sqrt(std::pow(track.px(), 2) + std::pow(track.py(), 2)); + genPt = std::sqrt(track.px() * track.px() + track.py() * track.py()); } else { if (!track.has_mcParticle()) { @@ -3944,14 +3898,13 @@ struct LFNucleiBATask { if (passDCAxyzCut) { // QA histos fill - histos.fill(HIST("qa/h1ITSncr"), track.itsNCls()); - histos.fill(HIST("qa/h1TPCnfound"), track.tpcNClsFound()); - histos.fill(HIST("qa/h1TPCncr"), track.tpcNClsCrossedRows()); - histos.fill(HIST("qa/h1rTPC"), track.tpcCrossedRowsOverFindableCls()); - histos.fill(HIST("qa/h1chi2ITS"), track.tpcChi2NCl()); - histos.fill(HIST("qa/h1chi2TPC"), track.itsChi2NCl()); - if (enableDebug) { + histos.fill(HIST("qa/h1ITSncr"), track.itsNCls()); + histos.fill(HIST("qa/h1TPCnfound"), track.tpcNClsFound()); + histos.fill(HIST("qa/h1TPCncr"), track.tpcNClsCrossedRows()); + histos.fill(HIST("qa/h1rTPC"), track.tpcCrossedRowsOverFindableCls()); + histos.fill(HIST("qa/h1chi2ITS"), track.tpcChi2NCl()); + histos.fill(HIST("qa/h1chi2TPC"), track.itsChi2NCl()); debugHistos.fill(HIST("debug/h2TPCsignVsTPCmomentum_AllTracks"), track.tpcInnerParam() / (1.f * track.sign()), track.tpcSignal()); } @@ -4424,23 +4377,19 @@ struct LFNucleiBATask { if (isHeWoTPCpid) { if (outFlagOptions.enableExpSignalTPC) histos.fill(HIST("tracks/helium/h2HeliumTPCExpSignalDiffVsPt"), hePt, track.tpcExpSignalDiffHe()); - histos.fill(HIST("tracks/helium/h2HeliumVspTNSigmaITSTr"), track.p(), nITSTr); histos.fill(HIST("tracks/helium/h2HeliumVspTNSigmaITSHe"), track.p(), nITSHe); histos.fill(HIST("tracks/helium/h2HeliumVspTNSigmaTPC"), hePt, track.tpcNSigmaHe()); } if (isAntiHeWoTPCpid) { if (outFlagOptions.enableExpSignalTPC) histos.fill(HIST("tracks/helium/h2antiHeliumTPCExpSignalDiffVsPt"), antihePt, track.tpcExpSignalDiffHe()); - histos.fill(HIST("tracks/helium/h2antiHeliumVspTNSigmaITSTr"), track.p(), nITSTr); histos.fill(HIST("tracks/helium/h2antiHeliumVspTNSigmaITSHe"), track.p(), nITSHe); histos.fill(HIST("tracks/helium/h2antiHeliumVspTNSigmaTPC"), antihePt, track.tpcNSigmaHe()); } if (isHeWTPCpid) { - histos.fill(HIST("tracks/helium/h2HeliumVspTNSigmaITSTr_wTPCpid"), track.p(), nITSTr); histos.fill(HIST("tracks/helium/h2HeliumVspTNSigmaITSHe_wTPCpid"), track.p(), nITSHe); } if (isAntiHeWTPCpid) { - histos.fill(HIST("tracks/helium/h2antiHeliumVspTNSigmaITSTr_wTPCpid"), track.p(), nITSTr); histos.fill(HIST("tracks/helium/h2antiHeliumVspTNSigmaITSHe_wTPCpid"), track.p(), nITSHe); } if constexpr (!IsFilteredData) { @@ -4511,13 +4460,10 @@ struct LFNucleiBATask { if (passDCAxyzCut) { // PID if (outFlagOptions.enableEffPlots && enableDebug) { - if (track.sign() > 0) { + if (track.sign() > 0) debugHistos.fill(HIST("tracks/eff/hPtP"), track.pt()); - debugHistos.fill(HIST("tracks/eff/hPtPrebinned"), track.pt()); - } else { + else debugHistos.fill(HIST("tracks/eff/hPtantiP"), track.pt()); - debugHistos.fill(HIST("tracks/eff/hPtantiPrebinned"), track.pt()); - } } if (enablePr) { @@ -4525,7 +4471,6 @@ struct LFNucleiBATask { if (track.sign() > 0) { if (outFlagOptions.enableEffPlots) { histos.fill(HIST("tracks/eff/proton/hPtPr"), track.pt()); - histos.fill(HIST("tracks/eff/proton/hPtPrrebinned"), track.pt()); histos.fill(HIST("tracks/eff/proton/h2pVsTPCmomentumPr"), track.tpcInnerParam(), track.p()); } histos.fill(HIST("tracks/proton/h1ProtonSpectra"), track.pt()); @@ -4537,7 +4482,6 @@ struct LFNucleiBATask { } else { if (outFlagOptions.enableEffPlots) { histos.fill(HIST("tracks/eff/proton/hPtantiPr"), track.pt()); - histos.fill(HIST("tracks/eff/proton/hPtantiPrrebinned"), track.pt()); histos.fill(HIST("tracks/eff/proton/h2pVsTPCmomentumantiPr"), track.tpcInnerParam(), track.p()); } histos.fill(HIST("tracks/proton/h1antiProtonSpectra"), track.pt()); @@ -4586,13 +4530,10 @@ struct LFNucleiBATask { if (outFlagOptions.doTOFplots && track.hasTOF()) { if (outFlagOptions.enableEffPlots && enableDebug) { - if (track.sign() > 0) { + if (track.sign() > 0) debugHistos.fill(HIST("tracks/eff/hPtPTOF"), track.pt()); - debugHistos.fill(HIST("tracks/eff/hPtPTOFrebinned"), track.pt()); - } else { + else debugHistos.fill(HIST("tracks/eff/hPtantiPTOF"), track.pt()); - debugHistos.fill(HIST("tracks/eff/hPtantiPTOFrebinned"), track.pt()); - } } if (outFlagOptions.enableBetaCut && (track.beta() > cfgBetaCut) && outFlagOptions.enablePIDplot) @@ -4793,10 +4734,8 @@ struct LFNucleiBATask { if (enablePr) { if ((std::abs(track.tpcNSigmaPr()) < nsigmaTPCvar.nsigmaTPCPr) && prRapCut) { if (track.sign() > 0) { - if (outFlagOptions.enableEffPlots) { + if (outFlagOptions.enableEffPlots) histos.fill(HIST("tracks/eff/proton/hPtPrTOF"), track.pt()); - histos.fill(HIST("tracks/eff/proton/hPtPrTOFrebinned"), track.pt()); - } histos.fill(HIST("tracks/proton/h2TOFmassProtonVsPt"), massTOF, track.pt()); histos.fill(HIST("tracks/proton/h2TOFmass2ProtonVsPt"), massTOF * massTOF - MassProtonVal * MassProtonVal, track.pt()); if (outFlagOptions.enableBetaCut && (track.beta() > cfgBetaCut)) { @@ -4817,10 +4756,8 @@ struct LFNucleiBATask { } } } else { - if (outFlagOptions.enableEffPlots) { + if (outFlagOptions.enableEffPlots) histos.fill(HIST("tracks/eff/proton/hPtantiPrTOF"), track.pt()); - histos.fill(HIST("tracks/eff/proton/hPtantiPrTOFrebinned"), track.pt()); - } histos.fill(HIST("tracks/proton/h2TOFmassantiProtonVsPt"), massTOF, track.pt()); histos.fill(HIST("tracks/proton/h2TOFmass2antiProtonVsPt"), massTOF * massTOF - MassProtonVal * MassProtonVal, track.pt()); if (outFlagOptions.enableBetaCut && (track.beta() > cfgBetaCut)) { From c2d6a6b938fa9da24f7b58c3bee9c801b8a3c16d Mon Sep 17 00:00:00 2001 From: Francesca Ercolessi Date: Sun, 19 Oct 2025 08:25:25 +0200 Subject: [PATCH 809/986] [PWGLF] Nuclei: Remove mcCorrelation and adjust DeltaEtaAxis (#13365) --- PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx index 8c3ef349645..e4dca56605a 100644 --- a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx +++ b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx @@ -66,8 +66,6 @@ struct hadronnucleicorrelation { Configurable isMC{"isMC", false, "is MC"}; Configurable isMCGen{"isMCGen", false, "is isMCGen"}; Configurable isPrim{"isPrim", true, "is isPrim"}; - Configurable domatterGen{"domatterGen", true, "domatterGen"}; - Configurable mcCorrelation{"mcCorrelation", false, "true: build the correlation function only for SE"}; Configurable docorrection{"docorrection", false, "do efficiency correction"}; Configurable fCorrectionPath{"fCorrectionPath", "", "Correction path to file"}; @@ -211,7 +209,7 @@ struct hadronnucleicorrelation { AxisSpec pTAxis = {200, -10.f, 10.f, "p_{T} GeV/c"}; AxisSpec pTAxis_small = {100, -5.f, 5.f, "p_{T} GeV/c"}; - AxisSpec DeltaEtaAxis = {100, -1.5, 1.5, "#Delta#eta"}; + AxisSpec DeltaEtaAxis = {300, -1.5, 1.5, "#Delta#eta"}; registry.add("hNEvents", "hNEvents", {HistType::kTH1D, {{7, 0.f, 7.f}}}); registry.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(1, "Selected"); From f2b837725e9961dbde2aaba898c50cefb2ac1e0a Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sun, 19 Oct 2025 18:12:17 +0200 Subject: [PATCH 810/986] [PWGLF] Strangeness tof pid: QA additions (#13449) Co-authored-by: ALICE Builder --- .../Strangeness/strangenesstofpid.cxx | 101 +++++++++++++++--- 1 file changed, 87 insertions(+), 14 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx index 5d6c360bf09..15e2b439344 100644 --- a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx @@ -101,6 +101,7 @@ struct strangenesstofpid { Configurable calculationMethod{"calculationMethod", 0, "algorithm for TOF calculation. 0: fast analytical withouot eloss, 1: O2 Propagator + trackLTIntegral (slow), 2: both methods and do comparison studies (slow)"}; Configurable calculateV0s{"calculateV0s", -1, "calculate V0-related TOF PID (0: no, 1: yes, -1: auto)"}; Configurable calculateCascades{"calculateCascades", -1, "calculate cascade-related TOF PID (0: no, 1: yes, -1: auto)"}; + Configurable reassociateTracks{"reassociateTracks", true, "if true, reassociate tracks to the collision the V0 or cascade belongs to. Relevant especially at high IR"}; // auxiliary / debug tables as desired Configurable calculateV0TOFPIDs{"calculateV0TOFPIDs", -1, "calculate V0TOFPIDs table (0: no, 1: yes, -1: auto)"}; @@ -199,6 +200,14 @@ struct strangenesstofpid { kHasTOF, kNEnums }; + // bookkeep propagation failures and successes + enum typesOfPropagation { kPropagPosV0 = 0, + kPropagNegV0, + kPropagPosCasc, + kPropagNegCasc, + kPropagBachCasc, + kPropagTypes }; + /// function to calculate track length of this track up to a certain segment of a detector /// to be used internally in another function that calculates length until it finds the proper one /// warning: this could be optimised further for speed @@ -405,6 +414,11 @@ struct strangenesstofpid { // measured vs expected total time QA if (doQA) { + // if in mode 1, bookkeep the failures of propagation + if (calculationMethod.value == 1) { + histos.add("hPropagationBookkeeping", "hPropagationBookkeeping", kTProfile, {{5, -0.5f, 4.5f}}); + } + // standard deltaTime values if (calculateV0s.value > 0) { histos.add("h2dDeltaTimePositiveLambdaPi", "h2dDeltaTimePositiveLambdaPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); @@ -776,6 +790,7 @@ struct strangenesstofpid { const o2::math_utils::Point3D trackVertex{trackCollision.posX(), trackCollision.posY(), trackCollision.posZ()}; o2::track::TrackLTIntegral ltIntegral; bool successPropag = o2::base::Propagator::Instance()->propagateToDCA(trackVertex, posTrack, d_bz, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrNONE, nullptr, <Integral); + histos.fill(HIST("hPropagationBookkeeping"), kPropagPosV0, static_cast(successPropag)); if (successPropag) { lengthPositive = pTof.length - ltIntegral.getL(); v0tof.timePositivePr = o2::framework::pid::tof::MassToExpTime(pTof.tofExpMom, lengthPositive, o2::constants::physics::MassProton * o2::constants::physics::MassProton); @@ -806,16 +821,25 @@ struct strangenesstofpid { histos.fill(HIST("h2dDeltaTimePositiveLambdaPr"), v0.p(), v0.eta(), v0tof.deltaTimePositiveLambdaPr); histos.fill(HIST("h2dCorrectAssocPositiveLambdaPr"), v0.p(), static_cast(collisionId == pTof.collisionId)); histos.fill(HIST("h2dDiffFromPrimCalcPositiveLambdaPr"), v0.p(), (pTof.tofSignal - pTof.tofEvTime) - v0tof.timeAsPrimaryPositivePr); + if (doQANSigma && std::fabs(v0tof.nSigmaPositiveLambdaPr - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { + histos.fill(HIST("h2dNSigmaPositiveLambdaPr"), v0.pt(), v0tof.nSigmaPositiveLambdaPr); + } } if (antiLambdaCandidate) { histos.fill(HIST("h2dDeltaTimePositiveLambdaPi"), v0.p(), v0.eta(), v0tof.deltaTimePositiveLambdaPi); histos.fill(HIST("h2dCorrectAssocPositiveLambdaPi"), v0.p(), static_cast(collisionId == pTof.collisionId)); histos.fill(HIST("h2dDiffFromPrimCalcPositiveLambdaPi"), v0.p(), (pTof.tofSignal - pTof.tofEvTime) - v0tof.timeAsPrimaryPositivePi); + if (doQANSigma && std::fabs(v0tof.nSigmaPositiveLambdaPi - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { + histos.fill(HIST("h2dNSigmaPositiveLambdaPi"), v0.pt(), v0tof.nSigmaPositiveLambdaPi); + } } if (k0ShortCandidate) { histos.fill(HIST("h2dDeltaTimePositiveK0ShortPi"), v0.p(), v0.eta(), v0tof.deltaTimePositiveK0ShortPi); histos.fill(HIST("h2dCorrectAssocPositiveK0ShortPi"), v0.p(), static_cast(collisionId == pTof.collisionId)); histos.fill(HIST("h2dDiffFromPrimCalcPositiveK0ShortPi"), v0.p(), (pTof.tofSignal - pTof.tofEvTime) - v0tof.timeAsPrimaryPositivePi); + if (doQANSigma && std::fabs(v0tof.nSigmaPositiveK0ShortPi - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { + histos.fill(HIST("h2dNSigmaPositiveK0ShortPi"), v0.pt(), v0tof.nSigmaPositiveK0ShortPi); + } } } } @@ -842,6 +866,7 @@ struct strangenesstofpid { const o2::math_utils::Point3D trackVertex{trackCollision.posX(), trackCollision.posY(), trackCollision.posZ()}; o2::track::TrackLTIntegral ltIntegral; bool successPropag = o2::base::Propagator::Instance()->propagateToDCA(trackVertex, negTrack, d_bz, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrNONE, nullptr, <Integral); + histos.fill(HIST("hPropagationBookkeeping"), kPropagNegV0, static_cast(successPropag)); if (successPropag) { lengthNegative = nTof.length - ltIntegral.getL(); v0tof.timeNegativePr = o2::framework::pid::tof::MassToExpTime(nTof.tofExpMom, lengthNegative, o2::constants::physics::MassProton * o2::constants::physics::MassProton); @@ -872,16 +897,25 @@ struct strangenesstofpid { histos.fill(HIST("h2dDeltaTimeNegativeLambdaPi"), v0.p(), v0.eta(), v0tof.deltaTimeNegativeLambdaPi); histos.fill(HIST("h2dCorrectAssocNegativeLambdaPi"), v0.p(), static_cast(collisionId == nTof.collisionId)); histos.fill(HIST("h2dDiffFromPrimCalcNegativeLambdaPi"), v0.p(), (nTof.tofSignal - nTof.tofEvTime) - v0tof.timeAsPrimaryNegativePi); + if (doQANSigma && std::fabs(v0tof.nSigmaNegativeLambdaPi - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { + histos.fill(HIST("h2dNSigmaNegativeLambdaPi"), v0.pt(), v0tof.nSigmaNegativeLambdaPi); + } } if (antiLambdaCandidate) { histos.fill(HIST("h2dDeltaTimeNegativeLambdaPr"), v0.p(), v0.eta(), v0tof.deltaTimeNegativeLambdaPr); histos.fill(HIST("h2dCorrectAssocNegativeLambdaPr"), v0.p(), static_cast(collisionId == nTof.collisionId)); histos.fill(HIST("h2dDiffFromPrimCalcNegativeLambdaPr"), v0.p(), (nTof.tofSignal - nTof.tofEvTime) - v0tof.timeAsPrimaryNegativePr); + if (doQANSigma && std::fabs(v0tof.nSigmaNegativeLambdaPr - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { + histos.fill(HIST("h2dNSigmaNegativeLambdaPr"), v0.pt(), v0tof.nSigmaNegativeLambdaPr); + } } if (k0ShortCandidate) { histos.fill(HIST("h2dDeltaTimeNegativeK0ShortPi"), v0.p(), v0.eta(), v0tof.deltaTimeNegativeK0ShortPi); histos.fill(HIST("h2dCorrectAssocNegativeK0ShortPi"), v0.p(), static_cast(collisionId == nTof.collisionId)); histos.fill(HIST("h2dDiffFromPrimCalcNegativeK0ShortPi"), v0.p(), (nTof.tofSignal - nTof.tofEvTime) - v0tof.timeAsPrimaryNegativePi); + if (doQANSigma && std::fabs(v0tof.nSigmaNegativeK0ShortPi - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { + histos.fill(HIST("h2dNSigmaNegativeK0ShortPi"), v0.pt(), v0tof.nSigmaNegativeK0ShortPi); + } } } } @@ -1004,6 +1038,7 @@ struct strangenesstofpid { const o2::math_utils::Point3D trackVertex{trackCollision.posX(), trackCollision.posY(), trackCollision.posZ()}; o2::track::TrackLTIntegral ltIntegral; bool successPropag = o2::base::Propagator::Instance()->propagateToDCA(trackVertex, posTrack, d_bz, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrNONE, nullptr, <Integral); + histos.fill(HIST("hPropagationBookkeeping"), kPropagPosCasc, static_cast(successPropag)); if (successPropag) { lengthPositive = pTof.length - ltIntegral.getL(); casctof.posFlightPr = o2::framework::pid::tof::MassToExpTime(pTof.tofExpMom, pTof.length - ltIntegral.getL(), o2::constants::physics::MassProton * o2::constants::physics::MassProton); @@ -1039,21 +1074,33 @@ struct strangenesstofpid { histos.fill(HIST("h2dposDeltaTimeAsXiPr"), cascade.p(), cascade.eta(), casctof.posDeltaTimeAsXiPr); histos.fill(HIST("h2dposCorrectAssocAsXiPr"), cascade.p(), static_cast(collisionId == pTof.collisionId)); histos.fill(HIST("h2dposDiffFromPrimCalcAsXiPr"), cascade.p(), (pTof.tofSignal - pTof.tofEvTime) - casctof.posFlightAsPrimaryPr); + if (doQANSigma && std::fabs(casctof.nSigmaXiLaPr - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { + histos.fill(HIST("h2dNSigmaXiLaPr"), cascade.pt(), casctof.nSigmaXiLaPr); + } } if (xiPlusCandidate) { histos.fill(HIST("h2dposDeltaTimeAsXiPi"), cascade.p(), cascade.eta(), casctof.posDeltaTimeAsXiPi); histos.fill(HIST("h2dposCorrectAssocAsXiPi"), cascade.p(), static_cast(collisionId == pTof.collisionId)); histos.fill(HIST("h2dposDiffFromPrimCalcAsXiPi"), cascade.p(), (pTof.tofSignal - pTof.tofEvTime) - casctof.posFlightAsPrimaryPi); + if (doQANSigma && std::fabs(casctof.nSigmaXiLaPi - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { + histos.fill(HIST("h2dNSigmaXiLaPi"), cascade.pt(), casctof.nSigmaXiLaPi); + } } if (omegaMinusCandidate) { histos.fill(HIST("h2dposDeltaTimeAsOmPr"), cascade.p(), cascade.eta(), casctof.posDeltaTimeAsOmPr); histos.fill(HIST("h2dposCorrectAssocAsOmPr"), cascade.p(), static_cast(collisionId == pTof.collisionId)); histos.fill(HIST("h2dposDiffFromPrimCalcAsOmPr"), cascade.p(), (pTof.tofSignal - pTof.tofEvTime) - casctof.posFlightAsPrimaryPr); + if (doQANSigma && std::fabs(casctof.nSigmaOmLaPr - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { + histos.fill(HIST("h2dNSigmaOmLaPr"), cascade.pt(), casctof.nSigmaOmLaPr); + } } if (omegaPlusCandidate) { histos.fill(HIST("h2dposDeltaTimeAsOmPi"), cascade.p(), cascade.eta(), casctof.posDeltaTimeAsOmPi); histos.fill(HIST("h2dposCorrectAssocAsOmPi"), cascade.p(), static_cast(collisionId == pTof.collisionId)); histos.fill(HIST("h2dposDiffFromPrimCalcAsOmPi"), cascade.p(), (pTof.tofSignal - pTof.tofEvTime) - casctof.posFlightAsPrimaryPi); + if (doQANSigma && std::fabs(casctof.nSigmaOmLaPi - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { + histos.fill(HIST("h2dNSigmaOmLaPi"), cascade.pt(), casctof.nSigmaOmLaPi); + } } } } @@ -1081,6 +1128,7 @@ struct strangenesstofpid { const o2::math_utils::Point3D trackVertex{trackCollision.posX(), trackCollision.posY(), trackCollision.posZ()}; o2::track::TrackLTIntegral ltIntegral; bool successPropag = o2::base::Propagator::Instance()->propagateToDCA(trackVertex, negTrack, d_bz, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrNONE, nullptr, <Integral); + histos.fill(HIST("hPropagationBookkeeping"), kPropagNegCasc, static_cast(successPropag)); if (successPropag) { lengthNegative = nTof.length - ltIntegral.getL(); casctof.negFlightPr = o2::framework::pid::tof::MassToExpTime(nTof.tofExpMom, nTof.length - ltIntegral.getL(), o2::constants::physics::MassProton * o2::constants::physics::MassProton); @@ -1101,11 +1149,11 @@ struct strangenesstofpid { // de facto nsigma if (nSigmaCalibLoaded) { if (cascade.sign() < 0) { - casctof.nSigmaXiLaPr = (casctof.negDeltaTimeAsXiPr - hMeanPosXiPr->Interpolate(cascade.p())) / hSigmaPosXiPr->Interpolate(cascade.p()); - casctof.nSigmaOmLaPr = (casctof.negDeltaTimeAsOmPr - hMeanPosOmPr->Interpolate(cascade.p())) / hSigmaPosOmPr->Interpolate(cascade.p()); + casctof.nSigmaXiLaPi = (casctof.negDeltaTimeAsXiPi - hMeanNegXiPi->Interpolate(cascade.p())) / hSigmaNegXiPi->Interpolate(cascade.p()); + casctof.nSigmaOmLaPi = (casctof.negDeltaTimeAsOmPi - hMeanNegOmPi->Interpolate(cascade.p())) / hSigmaNegOmPi->Interpolate(cascade.p()); } else { - casctof.nSigmaXiLaPi = (casctof.negDeltaTimeAsXiPi - hMeanPosXiPi->Interpolate(cascade.p())) / hSigmaPosXiPi->Interpolate(cascade.p()); - casctof.nSigmaOmLaPi = (casctof.negDeltaTimeAsOmPi - hMeanPosOmPi->Interpolate(cascade.p())) / hSigmaPosOmPi->Interpolate(cascade.p()); + casctof.nSigmaXiLaPr = (casctof.negDeltaTimeAsXiPr - hMeanNegXiPr->Interpolate(cascade.p())) / hSigmaNegXiPr->Interpolate(cascade.p()); + casctof.nSigmaOmLaPr = (casctof.negDeltaTimeAsOmPr - hMeanNegOmPr->Interpolate(cascade.p())) / hSigmaNegOmPr->Interpolate(cascade.p()); } } @@ -1116,21 +1164,33 @@ struct strangenesstofpid { histos.fill(HIST("h2dnegDeltaTimeAsXiPi"), cascade.p(), cascade.eta(), casctof.negDeltaTimeAsXiPi); histos.fill(HIST("h2dnegCorrectAssocAsXiPi"), cascade.p(), static_cast(collisionId == nTof.collisionId)); histos.fill(HIST("h2dnegDiffFromPrimCalcAsXiPi"), cascade.p(), (nTof.tofSignal - nTof.tofEvTime) - casctof.negFlightAsPrimaryPi); + if (doQANSigma && std::fabs(casctof.nSigmaXiLaPi - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { + histos.fill(HIST("h2dNSigmaXiLaPi"), cascade.pt(), casctof.nSigmaXiLaPi); + } } if (xiPlusCandidate) { histos.fill(HIST("h2dnegDeltaTimeAsXiPr"), cascade.p(), cascade.eta(), casctof.negDeltaTimeAsXiPr); histos.fill(HIST("h2dnegCorrectAssocAsXiPr"), cascade.p(), static_cast(collisionId == nTof.collisionId)); histos.fill(HIST("h2dnegDiffFromPrimCalcAsXiPr"), cascade.p(), (nTof.tofSignal - nTof.tofEvTime) - casctof.negFlightAsPrimaryPr); + if (doQANSigma && std::fabs(casctof.nSigmaXiLaPr - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { + histos.fill(HIST("h2dNSigmaXiLaPr"), cascade.pt(), casctof.nSigmaXiLaPr); + } } if (omegaMinusCandidate) { histos.fill(HIST("h2dnegDeltaTimeAsOmPi"), cascade.p(), cascade.eta(), casctof.negDeltaTimeAsOmPi); histos.fill(HIST("h2dnegCorrectAssocAsOmPi"), cascade.p(), static_cast(collisionId == nTof.collisionId)); histos.fill(HIST("h2dnegDiffFromPrimCalcAsOmPi"), cascade.p(), (nTof.tofSignal - nTof.tofEvTime) - casctof.negFlightAsPrimaryPi); + if (doQANSigma && std::fabs(casctof.nSigmaOmLaPi - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { + histos.fill(HIST("h2dNSigmaOmLaPi"), cascade.pt(), casctof.nSigmaOmLaPi); + } } if (omegaPlusCandidate) { histos.fill(HIST("h2dnegDeltaTimeAsOmPr"), cascade.p(), cascade.eta(), casctof.negDeltaTimeAsOmPr); histos.fill(HIST("h2dnegCorrectAssocAsOmPr"), cascade.p(), static_cast(collisionId == nTof.collisionId)); histos.fill(HIST("h2dnegDiffFromPrimCalcAsOmPr"), cascade.p(), (nTof.tofSignal - nTof.tofEvTime) - casctof.negFlightAsPrimaryPr); + if (doQANSigma && std::fabs(casctof.nSigmaOmLaPr - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { + histos.fill(HIST("h2dNSigmaOmLaPr"), cascade.pt(), casctof.nSigmaOmLaPr); + } } } } @@ -1158,6 +1218,7 @@ struct strangenesstofpid { const o2::math_utils::Point3D trackVertex{trackCollision.posX(), trackCollision.posY(), trackCollision.posZ()}; o2::track::TrackLTIntegral ltIntegral; bool successPropag = o2::base::Propagator::Instance()->propagateToDCA(trackVertex, bachTrack, d_bz, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrNONE, nullptr, <Integral); + histos.fill(HIST("hPropagationBookkeeping"), kPropagBachCasc, static_cast(successPropag)); if (successPropag) { lengthBachelor = bTof.length - ltIntegral.getL(); casctof.bachFlightPi = o2::framework::pid::tof::MassToExpTime(bTof.tofExpMom, bTof.length - ltIntegral.getL(), o2::constants::physics::MassPionCharged * o2::constants::physics::MassPionCharged); @@ -1191,21 +1252,33 @@ struct strangenesstofpid { histos.fill(HIST("h2dbachDeltaTimeAsXiPi"), cascade.p(), cascade.eta(), casctof.bachDeltaTimeAsXiPi); histos.fill(HIST("h2dbachCorrectAssocAsXiPi"), cascade.p(), static_cast(collisionId == bTof.collisionId)); histos.fill(HIST("h2dbachDiffFromPrimCalcAsXiPi"), cascade.p(), (bTof.tofSignal - bTof.tofEvTime) - casctof.bachFlightAsPrimaryPi); + if (doQANSigma && std::fabs(casctof.nSigmaXiPi - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { + histos.fill(HIST("h2dNSigmaXiPi"), cascade.pt(), casctof.nSigmaXiPi); + } } if (xiPlusCandidate) { histos.fill(HIST("h2dbachDeltaTimeAsXiPi"), cascade.p(), cascade.eta(), casctof.bachDeltaTimeAsXiPi); histos.fill(HIST("h2dbachCorrectAssocAsXiPi"), cascade.p(), static_cast(collisionId == bTof.collisionId)); histos.fill(HIST("h2dbachDiffFromPrimCalcAsXiPi"), cascade.p(), (bTof.tofSignal - bTof.tofEvTime) - casctof.bachFlightAsPrimaryPi); + if (doQANSigma && std::fabs(casctof.nSigmaXiPi - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { + histos.fill(HIST("h2dNSigmaXiPi"), cascade.pt(), casctof.nSigmaXiPi); + } } if (omegaMinusCandidate) { histos.fill(HIST("h2dbachDeltaTimeAsOmKa"), cascade.p(), cascade.eta(), casctof.bachDeltaTimeAsOmKa); histos.fill(HIST("h2dbachCorrectAssocAsOmKa"), cascade.p(), static_cast(collisionId == bTof.collisionId)); histos.fill(HIST("h2dbachDiffFromPrimCalcAsOmKa"), cascade.p(), (bTof.tofSignal - bTof.tofEvTime) - casctof.bachFlightAsPrimaryKa); + if (doQANSigma && std::fabs(casctof.nSigmaOmKa - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { + histos.fill(HIST("h2dNSigmaOmKa"), cascade.pt(), casctof.nSigmaOmKa); + } } if (omegaPlusCandidate) { histos.fill(HIST("h2dbachDeltaTimeAsOmKa"), cascade.p(), cascade.eta(), casctof.bachDeltaTimeAsOmKa); histos.fill(HIST("h2dbachCorrectAssocAsOmKa"), cascade.p(), static_cast(collisionId == bTof.collisionId)); histos.fill(HIST("h2dbachDiffFromPrimCalcAsOmKa"), cascade.p(), (bTof.tofSignal - bTof.tofEvTime) - casctof.bachFlightAsPrimaryKa); + if (doQANSigma && std::fabs(casctof.nSigmaOmKa - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon) { + histos.fill(HIST("h2dNSigmaOmKa"), cascade.pt(), casctof.nSigmaOmKa); + } } } } @@ -1257,7 +1330,7 @@ struct strangenesstofpid { pTof.hasTPC = pTra.hasTPC(); pTof.hasTOF = pTra.hasTOF(); pTof.tofExpMom = pTra.tofExpMom(); - pTof.tofEvTime = collisionEventTime[V0.collisionId()]; + pTof.tofEvTime = reassociateTracks ? collisionEventTime[V0.collisionId()] : pTra.tofEvTime(); pTof.tofSignal = pTra.tofSignal(); pTof.length = pTra.length(); pTof.tpcNSigmaPi = pTra.tpcNSigmaPi(); @@ -1268,7 +1341,7 @@ struct strangenesstofpid { nTof.hasTPC = nTra.hasTPC(); nTof.hasTOF = nTra.hasTOF(); nTof.tofExpMom = nTra.tofExpMom(); - nTof.tofEvTime = collisionEventTime[V0.collisionId()]; + nTof.tofEvTime = reassociateTracks ? collisionEventTime[V0.collisionId()] : nTra.tofEvTime(); nTof.tofSignal = nTra.tofSignal(); nTof.length = nTra.length(); nTof.tpcNSigmaPi = nTra.tpcNSigmaPi(); @@ -1312,7 +1385,7 @@ struct strangenesstofpid { pTof.hasTPC = pTra.hasTPC(); pTof.hasTOF = pTra.hasTOF(); pTof.tofExpMom = pTra.tofExpMom(); - pTof.tofEvTime = collisionEventTime[cascade.collisionId()]; + pTof.tofEvTime = reassociateTracks ? collisionEventTime[cascade.collisionId()] : pTra.tofEvTime(); pTof.tofSignal = pTra.tofSignal(); pTof.length = pTra.length(); pTof.tpcNSigmaPi = pTra.tpcNSigmaPi(); @@ -1323,7 +1396,7 @@ struct strangenesstofpid { nTof.hasTPC = nTra.hasTPC(); nTof.hasTOF = nTra.hasTOF(); nTof.tofExpMom = nTra.tofExpMom(); - nTof.tofEvTime = collisionEventTime[cascade.collisionId()]; + nTof.tofEvTime = reassociateTracks ? collisionEventTime[cascade.collisionId()] : nTra.tofEvTime(); nTof.tofSignal = nTra.tofSignal(); nTof.length = nTra.length(); nTof.tpcNSigmaPi = nTra.tpcNSigmaPi(); @@ -1334,7 +1407,7 @@ struct strangenesstofpid { bTof.hasTPC = bTra.hasTPC(); bTof.hasTOF = bTra.hasTOF(); bTof.tofExpMom = bTra.tofExpMom(); - bTof.tofEvTime = collisionEventTime[cascade.collisionId()]; + bTof.tofEvTime = reassociateTracks ? collisionEventTime[cascade.collisionId()] : bTra.tofEvTime(); bTof.tofSignal = bTra.tofSignal(); bTof.length = bTra.length(); bTof.tpcNSigmaPi = bTra.tpcNSigmaPi(); @@ -1410,7 +1483,7 @@ struct strangenesstofpid { auto pTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[V0.posTrackExtraId()]); pTof.collisionId = pTofExt.straCollisionId(); pTof.tofExpMom = pTofExt.tofExpMom(); - pTof.tofEvTime = collision.eventTime(); + pTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : pTofExt.tofEvTime(); pTof.tofSignal = pTofExt.tofSignal(); pTof.length = pTofExt.length(); } @@ -1424,7 +1497,7 @@ struct strangenesstofpid { auto nTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[V0.negTrackExtraId()]); nTof.collisionId = nTofExt.straCollisionId(); nTof.tofExpMom = nTofExt.tofExpMom(); - nTof.tofEvTime = collision.eventTime(); + nTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : nTofExt.tofEvTime(); nTof.tofSignal = nTofExt.tofSignal(); nTof.length = nTofExt.length(); } @@ -1472,7 +1545,7 @@ struct strangenesstofpid { auto pTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[cascade.posTrackExtraId()]); pTof.collisionId = pTofExt.straCollisionId(); pTof.tofExpMom = pTofExt.tofExpMom(); - pTof.tofEvTime = collision.eventTime(); + pTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : pTofExt.tofEvTime(); pTof.tofSignal = pTofExt.tofSignal(); pTof.length = pTofExt.length(); } @@ -1486,7 +1559,7 @@ struct strangenesstofpid { auto nTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[cascade.negTrackExtraId()]); nTof.collisionId = nTofExt.straCollisionId(); nTof.tofExpMom = nTofExt.tofExpMom(); - nTof.tofEvTime = collision.eventTime(); + nTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : nTofExt.tofEvTime(); nTof.tofSignal = nTofExt.tofSignal(); nTof.length = nTofExt.length(); } @@ -1500,7 +1573,7 @@ struct strangenesstofpid { auto bTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[cascade.bachTrackExtraId()]); bTof.collisionId = bTofExt.straCollisionId(); bTof.tofExpMom = bTofExt.tofExpMom(); - bTof.tofEvTime = collision.eventTime(); + bTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : bTofExt.tofEvTime(); bTof.tofSignal = bTofExt.tofSignal(); bTof.length = bTofExt.length(); } From b0fc6ebc7460499c53860d4d245aa6dff20f8265 Mon Sep 17 00:00:00 2001 From: suyoupeng <109774812+15071832337@users.noreply.github.com> Date: Mon, 20 Oct 2025 01:35:31 +0800 Subject: [PATCH 811/986] [PWGLF] Local polarization of Lambda induced by jets in Run3 pp collisions at 13.6 TeV (#13450) --- PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx b/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx index d399b213435..16af3ee5bcc 100644 --- a/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx @@ -150,7 +150,7 @@ struct LfMyV0s { const AxisSpec axisPz{100, -10, 10, "#pz (GeV/c)"}; const AxisSpec axisPT{200, 0, 50, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec axisPhi{100, -3.14, 3.14, "#Phi"}; - const AxisSpec axisTheta{100, 0, 3.14, "#Theta"}; + const AxisSpec axisTheta{100, -TMath::Pi(), TMath::Pi(), "#Theta"}; const AxisSpec axisMass{100, 0.9, 1.0, "Mass(GeV/c^{2})"}; const AxisSpec axisCostheta{100, -1, 1, "Cos(#theta^{*}_{p})"}; const AxisSpec axisSinPhi{100, -1, 1, "Sin(#phi^{*}_{p})"}; @@ -1120,9 +1120,11 @@ struct LfMyV0s { using StrHadronDaughterTracks = soa::Join; void processData(SelV0Collisions::iterator const& collision, aod::V0Datas const& fullV0s, StrHadronDaughterTracks const& tracks) { + registryData.fill(HIST("hNEvents"), 0.5); if (!AcceptEvent(collision)) { return; } + registryData.fill(HIST("hNEvents"), 8.5); // event selection // loop over reconstructed tracks std::vector fjParticles; @@ -1306,7 +1308,7 @@ struct LfMyV0s { registryData.fill(HIST("JetQA/JetptInLab"), jetptInLab); registryData.fill(HIST("protonQA/V0protonphiInLab"), TMath::ASin(protonsinPhiInLab)); - registryData.fill(HIST("protonQA/V0protonthetaInLab"), TMath::ASin(protonsinThetaInLab)); + registryData.fill(HIST("protonQA/V0protonthetaInLab"), TMath::ACos(protoncosthetaInLab)); registryData.fill(HIST("protonQA/V0protoncosthetaInLab"), protoncosthetaInLab); registryData.fill(HIST("protonQA/profileprotonsinthetaInLab"), candidate.mLambda(), protonsinThetaInLab); registryData.fill(HIST("protonQA/profileprotonsinphiInLab"), candidate.mLambda(), protonsinPhiInLab); @@ -1339,7 +1341,7 @@ struct LfMyV0s { double protonsinPhiInV0frame = protonInV0(2, 0) / sqrt(protonInV0(1, 0) * protonInV0(1, 0) + protonInV0(2, 0) * protonInV0(2, 0)); double protoncosthetaInV0frame = protonInV0(3, 0) / sqrt(protonInV0(1, 0) * protonInV0(1, 0) + protonInV0(2, 0) * protonInV0(2, 0) + protonInV0(3, 0) * protonInV0(3, 0)); registryData.fill(HIST("protonQA/V0protonphiInRest_frame"), TMath::ASin(protonsinPhiInV0frame)); - registryData.fill(HIST("protonQA/V0protonthetaInRest_frame"), TMath::ASin(protonsinThetaInV0)); + registryData.fill(HIST("protonQA/V0protonthetaInRest_frame"), TMath::ACos(protoncosthetaInV0frame)); registryData.fill(HIST("protonQA/V0protoncosthetaInV0frame"), protoncosthetaInV0frame); registryData.fill(HIST("protonQA/profileprotonsinthetaInV0frame"), candidate.mLambda(), protonsinThetaInV0); registryData.fill(HIST("protonQA/profileprotonsinphiInV0frame"), candidate.mLambda(), protonsinPhiInV0frame); @@ -1370,7 +1372,7 @@ struct LfMyV0s { registryData.fill(HIST("protonQA/V0protonpyInJetframe"), protonInJet(2, 0)); registryData.fill(HIST("protonQA/V0protonpzInJetframe"), protonInJet(3, 0)); registryData.fill(HIST("protonQA/V0protonphiInJetframe"), TMath::ASin(protonsinPhiInJet)); - registryData.fill(HIST("protonQA/V0protonthetaInJetframe"), TMath::ASin(protonSinThetainJet)); + registryData.fill(HIST("protonQA/V0protonthetaInJetframe"), TMath::ACos(protoncosthetaInJet)); registryData.fill(HIST("protonQA/V0protoncosthetaInJetframe"), protoncosthetaInJet); registryData.fill(HIST("protonQA/profileprotonsinthetaInJetframe"), candidate.mLambda(), protonSinThetainJet); registryData.fill(HIST("protonQA/profileprotonsinphiInJetframe"), candidate.mLambda(), protonsinPhiInJet); @@ -1402,7 +1404,7 @@ struct LfMyV0s { registryData.fill(HIST("protonQA/V0protonpyInJetV0frame"), protonInJetV0(2, 0)); registryData.fill(HIST("protonQA/V0protonpzInJetV0frame"), protonInJetV0(3, 0)); registryData.fill(HIST("protonQA/V0protonphiInJetV0frame"), TMath::ASin(protonsinphiInJetV0)); - registryData.fill(HIST("protonQA/V0protonthetaInJetV0frame"), TMath::ASin(protonSinThetainJetV0)); + registryData.fill(HIST("protonQA/V0protonthetaInJetV0frame"), TMath::ACos(protoncosthetaInJetV0)); registryData.fill(HIST("protonQA/V0protoncosthetaInJetV0"), protoncosthetaInJetV0); registryData.fill(HIST("protonQA/V0protonMassInJetV0frame"), protonMassInJetV0frame); registryData.fill(HIST("protonQA/profileprotonsinthetaInJetV0frame"), candidate.mLambda(), protonSinThetainJetV0); From 6f5d441b6f8f13e5f56c3b43402fe60af8c59bbf Mon Sep 17 00:00:00 2001 From: fuchuncui <162277233+fuchuncui@users.noreply.github.com> Date: Mon, 20 Oct 2025 03:28:50 +0800 Subject: [PATCH 812/986] [PWGCF] update the PIDTOF of cascades' daughter in flowGfwOmegaXi.cxx (#13428) --- PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx | 32 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx b/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx index c8f697d0015..2e31bc0939a 100644 --- a/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx +++ b/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx @@ -19,6 +19,7 @@ #include "GFWPowerArray.h" #include "GFWWeights.h" +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" #include "PWGLF/DataModel/LFStrangenessTables.h" #include "PWGMM/Mult/DataModel/Index.h" @@ -143,8 +144,8 @@ struct FlowGfwOmegaXi { O2_DEFINE_CONFIGURABLE(cfgCutPtOmegaMax, float, 10.0f, "Maximal pT for Omega") O2_DEFINE_CONFIGURABLE(cfgCutPtPIDDauMin, float, 0.15f, "Minimal pT for daughter PID") O2_DEFINE_CONFIGURABLE(cfgCutPtPIDbachMin, float, 0.15f, "Minimal pT for daughter PID") - O2_DEFINE_CONFIGURABLE(cfgCutPtPIDposdauMin, float, 0.15f, "Minimal pT for daughter PID") - O2_DEFINE_CONFIGURABLE(cfgCutPtPIDnegdauMin, float, 0.15f, "Minimal pT for daughter PID") + O2_DEFINE_CONFIGURABLE(cfgCutPtPIDdauLaPrMin, float, 0.15f, "Minimal pT for daughter PID") + O2_DEFINE_CONFIGURABLE(cfgCutPtPIDdauLaPiMin, float, 0.15f, "Minimal pT for daughter PID") // track quality selections for daughter track O2_DEFINE_CONFIGURABLE(cfgCheckITSNCls, bool, false, "check minimum number of ITS clusters") O2_DEFINE_CONFIGURABLE(cfgCheckITSHits, bool, false, "check minimum number of ITS hits") @@ -438,8 +439,8 @@ struct FlowGfwOmegaXi { registry.add("QAhisto/Xi/hqadcaCascV0daubefore", "", {HistType::kTH1D, {{100, 0, 1}}}); registry.add("QAhisto/Xi/hqadcaCascV0dauafter", "", {HistType::kTH1D, {{100, 0, 1}}}); - registry.add("QAhisto/Xi/hqaCascRadiusbefore", "", {HistType::kTH1D, {{200, -10, 10}}}); - registry.add("QAhisto/Xi/hqaCascRadiusafter", "", {HistType::kTH1D, {{200, -10, 10}}}); + registry.add("QAhisto/Omega/hqaCascRadiusbefore", "", {HistType::kTH1D, {{200, -10, 10}}}); + registry.add("QAhisto/Omega/hqaCascRadiusafter", "", {HistType::kTH1D, {{200, -10, 10}}}); registry.add("QAhisto/Omega/hqaCasccosPAbefore", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); registry.add("QAhisto/Omega/hqaCasccosPAafter", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); registry.add("QAhisto/Omega/hqaCascV0cosPAbefore", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); @@ -984,7 +985,7 @@ struct FlowGfwOmegaXi { return true; } - void processData(AodCollisions::iterator const& collision, aod::BCsWithTimestamps const&, AodTracks const& tracks, aod::CascDataExt const& Cascades, aod::V0Datas const& V0s, DaughterTracks const&) + void processData(AodCollisions::iterator const& collision, aod::BCsWithTimestamps const&, AodTracks const& tracks, soa::Join const& Cascades, aod::V0Datas const& V0s, DaughterTracks const&) { o2::aod::ITSResponse itsResponse; int nTot = tracks.size(); @@ -1051,8 +1052,8 @@ struct FlowGfwOmegaXi { // fill GFW of V0 flow double lowpt = trkQualityOpts.cfgCutPtPIDDauMin.value; double bachPtcut = trkQualityOpts.cfgCutPtPIDbachMin.value; - double posdauPtcut = trkQualityOpts.cfgCutPtPIDposdauMin.value; - double negdauPtcut = trkQualityOpts.cfgCutPtPIDnegdauMin.value; + double dauLaPrPtcut = trkQualityOpts.cfgCutPtPIDdauLaPrMin.value; + double dauLaPiPtcut = trkQualityOpts.cfgCutPtPIDdauLaPiMin.value; if (cfgOutputV0) { for (const auto& v0 : V0s) { @@ -1061,7 +1062,6 @@ struct FlowGfwOmegaXi { // check tpc bool isK0s = false; bool isLambda = false; - if (v0posdau.pt() < trkQualityOpts.cfgCutPtDauMin.value || v0posdau.pt() > trkQualityOpts.cfgCutPtDauMax.value) continue; if (v0negdau.pt() < trkQualityOpts.cfgCutPtDauMin.value || v0negdau.pt() > trkQualityOpts.cfgCutPtDauMax.value) @@ -1227,14 +1227,14 @@ struct FlowGfwOmegaXi { if (casc.pt() > trkQualityOpts.cfgCutPtOmegaMin.value && casc.pt() < trkQualityOpts.cfgCutPtOmegaMax.value) { if (casc.sign() < 0 && std::fabs(casc.yOmega()) < cfgCasc_rapidity && (std::fabs(bachelor.tpcNSigmaKa()) < cfgNSigma[2] && std::fabs(posdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(negdau.tpcNSigmaPi()) < cfgNSigma[0]) && - ((std::fabs(bachelor.tofNSigmaKa()) < cfgNSigma[5] || bachelor.pt() < bachPtcut) && (std::fabs(posdau.tofNSigmaPr()) < cfgNSigma[4] || posdau.pt() < posdauPtcut) && (std::fabs(negdau.tofNSigmaPi()) < cfgNSigma[3] || negdau.pt() < negdauPtcut)) && - ((std::fabs(itsResponse.nSigmaITS(bachelor)) < cfgNSigma[8]) || bachelor.pt() < bachPtcut) && ((std::fabs(itsResponse.nSigmaITS(posdau)) < cfgNSigma[7]) || posdau.pt() < posdauPtcut) && ((std::fabs(itsResponse.nSigmaITS(negdau)) < cfgNSigma[6]) || negdau.pt() < negdauPtcut)) { + ((std::fabs(casc.tofNSigmaOmKa()) < cfgNSigma[5] || bachelor.pt() < bachPtcut) && (std::fabs(casc.tofNSigmaOmLaPr()) < cfgNSigma[4] || posdau.pt() < dauLaPrPtcut) && (std::fabs(casc.tofNSigmaOmLaPi()) < cfgNSigma[3] || negdau.pt() < dauLaPiPtcut)) && + ((std::fabs(itsResponse.nSigmaITS(bachelor)) < cfgNSigma[8]) || bachelor.pt() < bachPtcut) && ((std::fabs(itsResponse.nSigmaITS(posdau)) < cfgNSigma[7]) || posdau.pt() < dauLaPrPtcut) && ((std::fabs(itsResponse.nSigmaITS(negdau)) < cfgNSigma[6]) || negdau.pt() < dauLaPiPtcut)) { registry.fill(HIST("InvMassOmega_all"), casc.pt(), casc.mOmega(), casc.eta(), cent); isOmega = true; } else if (casc.sign() > 0 && std::fabs(casc.yOmega()) < cfgCasc_rapidity && (std::fabs(bachelor.tpcNSigmaKa()) < cfgNSigma[2] && std::fabs(negdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(posdau.tpcNSigmaPi()) < cfgNSigma[0]) && - ((std::fabs(bachelor.tofNSigmaKa()) < cfgNSigma[5] || bachelor.pt() < bachPtcut) && (std::fabs(negdau.tofNSigmaPr()) < cfgNSigma[4] || negdau.pt() < negdauPtcut) && (std::fabs(posdau.tofNSigmaPi()) < cfgNSigma[3] || posdau.pt() < posdauPtcut)) && - ((std::fabs(itsResponse.nSigmaITS(bachelor)) < cfgNSigma[8]) || bachelor.pt() < bachPtcut) && ((std::fabs(itsResponse.nSigmaITS(posdau)) < cfgNSigma[7]) || posdau.pt() < posdauPtcut) && ((std::fabs(itsResponse.nSigmaITS(negdau)) < cfgNSigma[6]) || negdau.pt() < negdauPtcut)) { + ((std::fabs(casc.tofNSigmaOmKa()) < cfgNSigma[5] || bachelor.pt() < bachPtcut) && (std::fabs(casc.tofNSigmaOmLaPr()) < cfgNSigma[4] || negdau.pt() < dauLaPrPtcut) && (std::fabs(casc.tofNSigmaOmLaPi()) < cfgNSigma[3] || posdau.pt() < dauLaPiPtcut)) && + ((std::fabs(itsResponse.nSigmaITS(bachelor)) < cfgNSigma[8]) || bachelor.pt() < bachPtcut) && ((std::fabs(itsResponse.nSigmaITS(negdau)) < cfgNSigma[7]) || negdau.pt() < dauLaPrPtcut) && ((std::fabs(itsResponse.nSigmaITS(posdau)) < cfgNSigma[6]) || posdau.pt() < dauLaPiPtcut)) { registry.fill(HIST("InvMassOmega_all"), casc.pt(), casc.mOmega(), casc.eta(), cent); isOmega = true; } @@ -1243,14 +1243,14 @@ struct FlowGfwOmegaXi { if (casc.pt() > trkQualityOpts.cfgCutPtXiMin.value && casc.pt() < trkQualityOpts.cfgCutPtXiMax.value) { if (casc.sign() < 0 && std::fabs(casc.yXi()) < cfgCasc_rapidity && (std::fabs(bachelor.tpcNSigmaPi()) < cfgNSigma[0] && std::fabs(posdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(negdau.tpcNSigmaPi()) < cfgNSigma[0]) && - ((std::fabs(bachelor.tofNSigmaPi()) < cfgNSigma[3] || bachelor.pt() < bachPtcut) && (std::fabs(posdau.tofNSigmaPr()) < cfgNSigma[4] || posdau.pt() < posdauPtcut) && (std::fabs(negdau.tofNSigmaPi()) < cfgNSigma[3] || negdau.pt() < negdauPtcut)) && - ((std::fabs(itsResponse.nSigmaITS(bachelor)) < cfgNSigma[6]) || bachelor.pt() < bachPtcut) && ((std::fabs(itsResponse.nSigmaITS(posdau)) < cfgNSigma[7]) || posdau.pt() < posdauPtcut) && ((std::fabs(itsResponse.nSigmaITS(negdau)) < cfgNSigma[6]) || negdau.pt() < negdauPtcut)) { + ((std::fabs(casc.tofNSigmaXiPi()) < cfgNSigma[3] || bachelor.pt() < bachPtcut) && (std::fabs(casc.tofNSigmaXiLaPr()) < cfgNSigma[4] || posdau.pt() < dauLaPrPtcut) && (std::fabs(casc.tofNSigmaXiLaPi()) < cfgNSigma[3] || negdau.pt() < dauLaPiPtcut)) && + ((std::fabs(itsResponse.nSigmaITS(bachelor)) < cfgNSigma[6]) || bachelor.pt() < bachPtcut) && ((std::fabs(itsResponse.nSigmaITS(posdau)) < cfgNSigma[7]) || posdau.pt() < dauLaPrPtcut) && ((std::fabs(itsResponse.nSigmaITS(negdau)) < cfgNSigma[6]) || negdau.pt() < dauLaPiPtcut)) { registry.fill(HIST("InvMassXi_all"), casc.pt(), casc.mXi(), casc.eta(), cent); isXi = true; } else if (casc.sign() > 0 && std::fabs(casc.yXi()) < cfgCasc_rapidity && (std::fabs(bachelor.tpcNSigmaPi()) < cfgNSigma[0] && std::fabs(negdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(posdau.tpcNSigmaPi()) < cfgNSigma[0]) && - ((std::fabs(bachelor.tofNSigmaPi()) < cfgNSigma[3] || bachelor.pt() < bachPtcut) && (std::fabs(negdau.tofNSigmaPr()) < cfgNSigma[4] || negdau.pt() < negdauPtcut) && (std::fabs(posdau.tofNSigmaPi()) < cfgNSigma[3] || posdau.pt() < posdauPtcut)) && - ((std::fabs(itsResponse.nSigmaITS(bachelor)) < cfgNSigma[6]) || bachelor.pt() < bachPtcut) && ((std::fabs(itsResponse.nSigmaITS(posdau)) < cfgNSigma[7]) || posdau.pt() < posdauPtcut) && ((std::fabs(itsResponse.nSigmaITS(negdau)) < cfgNSigma[6]) || negdau.pt() < negdauPtcut)) { + ((std::fabs(casc.tofNSigmaXiPi()) < cfgNSigma[3] || bachelor.pt() < bachPtcut) && (std::fabs(casc.tofNSigmaXiLaPr()) < cfgNSigma[4] || negdau.pt() < dauLaPrPtcut) && (std::fabs(casc.tofNSigmaXiLaPi()) < cfgNSigma[3] || posdau.pt() < dauLaPiPtcut)) && + ((std::fabs(itsResponse.nSigmaITS(bachelor)) < cfgNSigma[6]) || bachelor.pt() < bachPtcut) && ((std::fabs(itsResponse.nSigmaITS(negdau)) < cfgNSigma[7]) || negdau.pt() < dauLaPrPtcut) && ((std::fabs(itsResponse.nSigmaITS(posdau)) < cfgNSigma[6]) || posdau.pt() < dauLaPiPtcut)) { registry.fill(HIST("InvMassXi_all"), casc.pt(), casc.mXi(), casc.eta(), cent); isXi = true; } From ea82a81320f81b968ea587216a5348736c2c74cd Mon Sep 17 00:00:00 2001 From: Sweta Singh <122526337+sweta29singh@users.noreply.github.com> Date: Sun, 19 Oct 2025 21:31:57 +0200 Subject: [PATCH 813/986] [PWGCF] Added some configurables and histograms in Mean pT fluctuations in PbPb (#13441) --- .../EbyEFluctuations/Tasks/eventMeanPtId.cxx | 832 +++++++++--------- 1 file changed, 417 insertions(+), 415 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/eventMeanPtId.cxx b/PWGCF/EbyEFluctuations/Tasks/eventMeanPtId.cxx index 7f9797e493f..717a5a46cae 100644 --- a/PWGCF/EbyEFluctuations/Tasks/eventMeanPtId.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/eventMeanPtId.cxx @@ -72,49 +72,50 @@ struct EventMeanPtId { Configurable cDcaZcut{"cDcaZcut", 2.0f, "DCA Z cut"}; Configurable cCentmincut{"cCentmincut", 0.0, "Min cent cut"}; Configurable cCentmaxcut{"cCentmaxcut", 90.0, "Max cent cut"}; - Configurable cTPCcrosscut{"cTPCcrosscut", 70, "TPC crossrows cut"}; - Configurable cItsChiCut{"cItsChiCut", 36, "ITS chi2 cluster cut"}; - Configurable cTpcChiCut{"cTpcChiCut", 4, "TPC chi2 cluster cut"}; - Configurable cnITSClustersCut{"cnITSClustersCut", 5, "Number of ITS clusters cut"}; - Configurable ctpcNClsCut{"ctpcNClsCut", 80, "No. of TPC clusters cut"}; + Configurable csyTPCcrosscut{"csyTPCcrosscut", 70, "TPC crossrows cut"}; + Configurable csysItsChiCut{"csysItsChiCut", 36, "ITS chi2 cluster cut"}; + Configurable csysTpcChiCut{"csysTpcChiCut", 4, "TPC chi2 cluster cut"}; + Configurable csysnITSClustersCut{"csysnITSClustersCut", 5, "Number of ITS clusters cut"}; + Configurable csystpcNClsCut{"csystpcNClsCut", 80, "No. of TPC clusters cut"}; Configurable threshold{"threshold", 1e-6, "Delta eta bin count"}; Configurable ptMax{"ptMax", 2.0, "maximum pT"}; Configurable ptMin{"ptMin", 0.15, "minimum pT"}; Configurable> ptBins{"ptBins", {0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.90, 0.95, 1.00, 1.05, 1.10, 1.15, 1.20, 1.25, 1.30, 1.35, 1.40, 1.45, 1.50, 1.55, 1.60, 1.65, 1.70, 1.75, 1.80, 1.85, 1.90, 1.95, 2.00}, "p_{T} bins"}; - Configurable piluprejection{"piluprejection", false, "Pileup rejection"}; // Event selections Configurable cSel8Trig{"cSel8Trig", true, "Sel8 (T0A + T0C) Selection Run3"}; - Configurable cTFBorder{"cTFBorder", true, "Timeframe Border Selection"}; - Configurable cNoItsROBorder{"cNoItsROBorder", true, "No ITSRO Border Cut"}; - Configurable cItsTpcVtx{"cItsTpcVtx", true, "ITS+TPC Vertex Selection"}; - Configurable cPileupReject{"cPileupReject", true, "Pileup rejection"}; - Configurable cZVtxTimeDiff{"cZVtxTimeDiff", true, "z-vtx time diff selection"}; + Configurable cpileupTFBorder{"cpileupTFBorder", true, "Timeframe Border Selection"}; + Configurable cpileupNoItsROBorder{"cpileupNoItsROBorder", true, "No ITSRO Border Cut"}; + Configurable cpileupItsTpcVtx{"cpileupItsTpcVtx", true, "ITS+TPC Vertex Selection"}; + Configurable cpileupSameBunch{"cpileupSameBunch", true, "Pileup rejection"}; + Configurable cpileupZVtxTimeDiff{"cpileupZVtxTimeDiff", true, "z-vtx time diff selection"}; Configurable cIsGoodITSLayers{"cIsGoodITSLayers", true, "Good ITS Layers All"}; - Configurable cItslayerall{"cItslayerall", true, "dead staves of ITS removed"}; - Configurable cvtxtofmatched{"cvtxtofmatched", true, "TOF vertex matched"}; - Configurable cfgRejEl{"cfgRejEl", false, "Rejected electrons"}; - Configurable cdata{"cdata", false, "Enable histogram filling for processData"}; + Configurable cpileupItslayerall{"cpileupItslayerall", true, "dead staves of ITS removed"}; + Configurable cpileupvtxtofmatched{"cpileupvtxtofmatched", true, "TOF vertex matched"}; Configurable citsNCluster{"citsNCluster", false, "Enable Number of ITS clusters"}; Configurable ctpcNClusterFound{"ctpcNClusterFound", false, "Enable Number of TPC clusters"}; Configurable cPVContributor{"cPVContributor", false, "Enable Primary Vertex Contributor"}; - Configurable cDCAxy{"cDCAxy", true, "DCAxy cut"}; - Configurable cDCAz{"cDCAz", true, "DCAz cut"}; - Configurable cTPCcr{"cTPCcr", true, "tpc crossed rows"}; - Configurable cITSchi{"cITSchi", true, "ITS chi2"}; - Configurable cTPCchi{"cTPCchi", true, "TPC chi2"}; + Configurable csyDCAxy{"csyDCAxy", true, "DCAxy cut"}; + Configurable csyDCAz{"csyDCAz", true, "DCAz cut"}; + Configurable csyTPCcr{"csyTPCcr", true, "tpc crossed rows"}; + Configurable csyITSchi{"csyITSchi", true, "ITS chi2"}; + Configurable csyTPCchi{"csyTPCchi", true, "TPC chi2"}; Configurable ccentFT0C{"ccentFT0C", true, "Use FT0C centraity"}; + Configurable pidSwitch{"pidSwitch", false, "pid calculations"}; + Configurable pidSwitchHistoFill{"pidSwitchHistoFill", false, "pid histogram filling"}; + Configurable effSwitch{"effSwitch", false, "efficiency calculations"}; + Configurable effSwitchHistoFill{"effSwitchHistoFill", false, "efficiency histogram filling"}; // PID selection configurables - Configurable cPionPmincut{"cPionPmincut", 0.15, "pion min cut of pion"}; - Configurable cKaonPmincut{"cKaonPmincut", 0.15, "kaon min cut of kaon"}; - Configurable cProtonPmincut{"cProtonPmincut", 0.15, "proton min cut of proton"}; - Configurable cPionPmaxcut{"cPionPmaxcut", 2.0, "pion min cut of pion"}; - Configurable cKaonPmaxcut{"cKaonPmaxcut", 2.0, "kaon min cut of kaon"}; - Configurable cProtonPmaxcut{"cProtonPmaxcut", 2.0, "proton min cut of proton"}; - Configurable cPionPthcut{"cPionPthcut", 0.65, "pion threshold cut of pion"}; - Configurable cKaonPthcut{"cKaonPthcut", 0.65, "kaon threshold cut of kaon"}; - Configurable cProtonPthcut{"cProtonPthcut", 1.0, "proton threshold cut of proton"}; + Configurable cpidPionPmincut{"cpidPionPmincut", 0.15, "pion min cut of pion"}; + Configurable cpidKaonPmincut{"cpidKaonPmincut", 0.15, "kaon min cut of kaon"}; + Configurable cpidProtonPmincut{"cpidProtonPmincut", 0.15, "proton min cut of proton"}; + Configurable cpidPionPmaxcut{"cpidPionPmaxcut", 2.0, "pion min cut of pion"}; + Configurable cpidKaonPmaxcut{"cpidKaonPmaxcut", 2.0, "kaon min cut of kaon"}; + Configurable cpidProtonPmaxcut{"cpidProtonPmaxcut", 2.0, "proton min cut of proton"}; + Configurable cpidPionPthcut{"cpidPionPthcut", 0.65, "pion threshold cut of pion"}; + Configurable cpidKaonPthcut{"cpidKaonPthcut", 0.65, "kaon threshold cut of kaon"}; + Configurable cpidProtonPthcut{"cpidProtonPthcut", 1.0, "proton threshold cut of proton"}; Configurable cNSigCut2{"cNSigCut2", 2.0, "nSigma cut (2)"}; Configurable cNSigCut3{"cNSigCut3", 3.0, "nSigma cut (3)"}; Configurable cElMinCut{"cElMinCut", -3.0, "electron min cut"}; @@ -124,6 +125,7 @@ struct EventMeanPtId { Configurable nchBins{"nchBins", 4000, "Number of bins for nch axis"}; Configurable nchMin{"nchMin", 0.0, "Minimum value for nch axis"}; Configurable nchMax{"nchMax", 4000.0, "Maximum value for nch axis"}; + Configurable cSigmaLowHighcut{"cSigmaLowHighcut", 3.0f, "lower and upper sigma cut"}; O2_DEFINE_CONFIGURABLE(cfgEvSelMultCorrelation, bool, true, "Multiplicity correlation cut") struct : ConfigurableGroup { @@ -187,7 +189,7 @@ struct EventMeanPtId { Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable cfgUrlCCDB{"cfgUrlCCDB", "http://alice-ccdb.cern.ch", "url of ccdb"}; - Configurable cfgPathCCDB{"cfgPathCCDB", "Users/s/swsingh/My/Object/test", "Path for ccdb-object"}; + Configurable cfgPathCCDB{"cfgPathCCDB", "Users/s/swsingh/My/Object/GlobalRun3DCAcuts", "Path for ccdb-object"}; Configurable cfgLoadEff{"cfgLoadEff", true, "Load efficiency"}; HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -202,17 +204,15 @@ struct EventMeanPtId { ccdb->setLocalObjectValidityChecking(); // ccdb->setCreatedNotAfter(ccdbNoLaterThan.value); // LOGF(info, "Getting object %s", ccdbPath.value.data()); - TList* lst = ccdb->getForTimeStamp(cfgPathCCDB.value, -1); ptHistogramAllchargeRec = reinterpret_cast(lst->FindObject("hPtEta_rec")); } std::vector ptBinning = {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0}; - // AxisSpec ptAxis = {ptBinning, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec vtxZAxis = {100, -20.0, 20.0, "Z (cm)"}; AxisSpec dcaAxis = {1002, -5.01, 5.01, "DCA_{xy} (cm)"}; AxisSpec dcazAxis = {1002, -5.01, 5.01, "DCA_{z} (cm)"}; - AxisSpec ptAxis = {600, 0.0, 6.0, "#it{p}_{T} (GeV/#it{c})"}; // 600,0,6 + AxisSpec ptAxis = {600, 0.0, 6.0, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec pAxis = {400, 0.0, 4.0, "#it{p} (GeV/#it{c})"}; AxisSpec betaAxis = {200, 0.0, 2.0, "TOF_{#beta} (GeV/#it{c})"}; AxisSpec dEdxAxis = {2000, 0.0, 200.0, "dE/dx (GeV/#it{c})"}; @@ -261,7 +261,6 @@ struct EventMeanPtId { histos.add("Data/hEta", ";hEta", kTH1D, {etaAxis}); histos.add("Data/hPt", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); histos.add("Data/hPtvar", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); - histos.add("Data/hNsigmaTPC", "hNsigmaTPC", kTH2D, {pAxis, nSigmaTPCAxis}); histos.add("Data/hDCAxy", "hDCAxy", kTH1D, {dcaAxis}); histos.add("Data/hDCAz", "hDCAz", kTH1D, {dcazAxis}); histos.add("Data/hPtDCAxy", "hPtDCAxy", kTH2D, {ptAxis, dcaAxis}); @@ -358,7 +357,6 @@ struct EventMeanPtId { histos.add("Data/hNchPV_NchGlobal_after5", "hNchPV_NchGlobal_after5", kTH2D, {nchAxis, nchAxis}); histos.addClone("Data/", "Rec/"); - // rec histograms histos.add("hcent_nacc_corr", "hcent_nacc_corr", kTH2D, {centAxis, nchAxis}); histos.add("NSigamaTPCpion_rec", "NSigamaTPCpion_rec", kTH2D, {pAxis, nSigmaTPCAxispid}); histos.add("NSigamaTPCkaon_rec", "NSigamaTPCkaon_rec", kTH2D, {pAxis, nSigmaTPCAxispid}); @@ -490,8 +488,6 @@ struct EventMeanPtId { cfgFunCoeff.multGlobalFT0CPars = cfgFunCoeff.cfgMultGlobalFT0CCutPars; cfgFunCoeff.multGlobalPVCutPars = cfgFunCoeff.cfgMultGlobalPVCutPars; - Configurable cSigmaLowHighcut{"cSigmaLowHighcut", 3.0f, "lower and upper sigma cut"}; - cfgFunCoeff.fMultPVFT0CCutLow = new TF1("fMultPVFT0CCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 3.0*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", @@ -532,7 +528,6 @@ struct EventMeanPtId { bool eventSelected(const float& globalNch, const float& pvTrack, const float& centrality) { if (cfgFunCoeff.cfgMultPVFT0CCutEnabled) { - if (pvTrack < cfgFunCoeff.fMultPVFT0CCutLow->Eval(centrality)) return false; if (pvTrack > cfgFunCoeff.fMultPVFT0CCutHigh->Eval(centrality)) @@ -540,7 +535,6 @@ struct EventMeanPtId { } if (cfgFunCoeff.cfgMultGlobalFT0CCutEnabled) { - if (globalNch < cfgFunCoeff.fMultGlobalFT0CCutLow->Eval(centrality)) return false; if (globalNch > cfgFunCoeff.fMultGlobalFT0CCutHigh->Eval(centrality)) @@ -548,20 +542,17 @@ struct EventMeanPtId { } if (cfgFunCoeff.cfgMultGlobalPVCutEnabled) { - if (globalNch < cfgFunCoeff.fMultGlobalPVCutLow->Eval(pvTrack)) return false; if (globalNch > cfgFunCoeff.fMultGlobalPVCutHigh->Eval(pvTrack)) return false; } - return true; } template bool selCollision(C const& coll, float& cent) { - if (std::abs(coll.posZ()) >= cVtxZcut) { return false; } // Reject the collisions with large vertex-z @@ -578,33 +569,33 @@ struct EventMeanPtId { } // require min bias trigger histos.fill(HIST("hEventcounter"), 3.); - if (cTFBorder && !coll.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + if (cpileupTFBorder && !coll.selection_bit(aod::evsel::kNoTimeFrameBorder)) { return false; } - if (cNoItsROBorder && !coll.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + if (cpileupNoItsROBorder && !coll.selection_bit(aod::evsel::kNoITSROFrameBorder)) { return false; } histos.fill(HIST("trackSelRec"), 4); - if (cPileupReject && !coll.selection_bit(aod::evsel::kNoSameBunchPileup)) { + if (cpileupSameBunch && !coll.selection_bit(aod::evsel::kNoSameBunchPileup)) { return false; } histos.fill(HIST("trackSelRec"), 5); - if (cZVtxTimeDiff && !coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + if (cpileupZVtxTimeDiff && !coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { return false; } histos.fill(HIST("trackSelRec"), 6); - if (cItsTpcVtx && !coll.selection_bit(aod::evsel::kIsVertexITSTPC)) { + if (cpileupItsTpcVtx && !coll.selection_bit(aod::evsel::kIsVertexITSTPC)) { return false; } histos.fill(HIST("trackSelRec"), 7); - // if (cItslayerall && !coll.selection_bit(aod::evsel::kIsGoodITSLayersAll)) {return false;} + // if (cpileupItslayerall && !coll.selection_bit(aod::evsel::kIsGoodITSLayersAll)) {return false;} histos.fill(HIST("trackSelRec"), 8); - if (cvtxtofmatched && !coll.selection_bit(aod::evsel::kIsVertexTOFmatched)) { + if (cpileupvtxtofmatched && !coll.selection_bit(aod::evsel::kIsVertexTOFmatched)) { return false; } histos.fill(HIST("trackSelRec"), 9); @@ -620,12 +611,12 @@ struct EventMeanPtId { } // accept only global tracks histos.fill(HIST("tracksel"), 2); - if (cDCAxy && std::fabs(track.dcaXY()) > cDcaXYcut) { + if (csyDCAxy && std::fabs(track.dcaXY()) > cDcaXYcut) { return false; } histos.fill(HIST("tracksel"), 3); - if (cDCAz && std::fabs(track.dcaZ()) > cDcaZcut) { + if (csyDCAz && std::fabs(track.dcaZ()) > cDcaZcut) { return false; } histos.fill(HIST("tracksel"), 4); @@ -635,17 +626,17 @@ struct EventMeanPtId { } histos.fill(HIST("tracksel"), 5); - if (cTPCcr && track.tpcNClsCrossedRows() < cTPCcrosscut) { + if (csyTPCcr && track.tpcNClsCrossedRows() < csyTPCcrosscut) { return false; } histos.fill(HIST("tracksel"), 6); - if (cITSchi && track.itsChi2NCl() >= cItsChiCut) { + if (csyITSchi && track.itsChi2NCl() >= csysItsChiCut) { return false; } histos.fill(HIST("tracksel"), 7); - if (cTPCchi && track.tpcChi2NCl() >= cTpcChiCut) { + if (csyTPCchi && track.tpcChi2NCl() >= csysTpcChiCut) { return false; } histos.fill(HIST("tracksel"), 8); @@ -662,14 +653,14 @@ struct EventMeanPtId { } if (citsNCluster) { - if (track.itsNCls() < cnITSClustersCut) { + if (track.itsNCls() < csysnITSClustersCut) { return false; } histos.fill(HIST("tracksel"), 10); } if (ctpcNClusterFound) { - if (track.tpcNClsFound() < ctpcNClsCut) { + if (track.tpcNClsFound() < csystpcNClsCut) { return false; } histos.fill(HIST("tracksel"), 11); @@ -691,21 +682,21 @@ struct EventMeanPtId { bool selProton(T const& track) { //! if pt < threshold (For tracks without TOF information) - if (track.p() > cProtonPmincut && track.p() <= cProtonPthcut) { + if (track.p() > cpidProtonPmincut && track.p() <= cpidProtonPthcut) { if (track.hasTPC() && std::fabs(track.tpcNSigmaPr()) < cNSigCut2 && std::fabs(track.tpcNSigmaPi()) > cNSigCut2 && std::fabs(track.tpcNSigmaKa()) > cNSigCut2) { return true; } } //! if pt < threshold (For tracks with TOF information) - if (track.p() > cProtonPmincut && track.p() <= cProtonPthcut) { + if (track.p() > cpidProtonPmincut && track.p() <= cpidProtonPthcut) { if (track.hasTOF() && std::fabs(track.tpcNSigmaPr()) < cNSigCut2 && std::fabs(track.tofNSigmaPr()) < cNSigCut2 && std::fabs(track.tpcNSigmaPi()) > cNSigCut2 && std::fabs(track.tpcNSigmaKa()) > cNSigCut2) { return true; } } //! if pt > threshold (For tracks with TOF information) - if (track.p() > cProtonPthcut && track.p() <= cProtonPmaxcut) { + if (track.p() > cpidProtonPthcut && track.p() <= cpidProtonPmaxcut) { if (track.hasTPC() && track.hasTOF() && std::fabs(track.tpcNSigmaPr()) < cNSigCut2 && std::fabs(track.tofNSigmaPr()) < cNSigCut2 && std::hypot(track.tofNSigmaPi(), track.tpcNSigmaPi()) > cNSigCut2 && std::hypot(track.tofNSigmaKa(), track.tpcNSigmaKa()) > cNSigCut2) { return true; } @@ -718,21 +709,21 @@ struct EventMeanPtId { bool selKaon(T const& track) { //! if pt < threshold (For tracks without TOF information) - if (track.p() > cKaonPmincut && track.p() <= cKaonPthcut) { + if (track.p() > cpidKaonPmincut && track.p() <= cpidKaonPthcut) { if (track.hasTPC() && std::fabs(track.tpcNSigmaKa()) < cNSigCut2 && std::fabs(track.tpcNSigmaPi()) > cNSigCut2 && std::fabs(track.tpcNSigmaPr()) > cNSigCut2) { return true; } } //! if pt < threshold (For tracks with TOF information) - if (track.p() > cKaonPmincut && track.p() <= cKaonPthcut) { + if (track.p() > cpidKaonPmincut && track.p() <= cpidKaonPthcut) { if (track.hasTOF() && std::fabs(track.tpcNSigmaKa()) < cNSigCut2 && std::fabs(track.tofNSigmaKa()) < cNSigCut2 && std::fabs(track.tpcNSigmaPi()) > cNSigCut2 && std::fabs(track.tpcNSigmaPr()) > cNSigCut2) { return true; } } //! if pt > threshold (For tracks with TOF information) - if (track.p() > cKaonPthcut && track.p() <= cKaonPmaxcut) { + if (track.p() > cpidKaonPthcut && track.p() <= cpidKaonPmaxcut) { if (track.hasTPC() && track.hasTOF() && std::fabs(track.tpcNSigmaKa()) < cNSigCut2 && std::fabs(track.tofNSigmaKa()) < cNSigCut2 && std::hypot(track.tofNSigmaPi(), track.tpcNSigmaPi()) > cNSigCut2 && std::hypot(track.tofNSigmaPr(), track.tpcNSigmaPr()) > cNSigCut2) { return true; } @@ -745,21 +736,21 @@ struct EventMeanPtId { bool selPion(T const& track) { //! if pt < threshold (For tracks without TOF information) - if (track.p() > cPionPmincut && track.p() <= cPionPthcut) { + if (track.p() > cpidPionPmincut && track.p() <= cpidPionPthcut) { if (track.hasTPC() && std::fabs(track.tpcNSigmaPi()) < cNSigCut2 && std::fabs(track.tpcNSigmaKa()) > cNSigCut2 && std::fabs(track.tpcNSigmaPr()) > cNSigCut2) { return true; } } //! if pt < threshold (For tracks with TOF information) - if (track.p() > cPionPmincut && track.p() <= cPionPthcut) { + if (track.p() > cpidPionPmincut && track.p() <= cpidPionPthcut) { if (track.hasTOF() && std::fabs(track.tpcNSigmaPi()) < cNSigCut2 && std::fabs(track.tofNSigmaPi()) < cNSigCut2 && std::fabs(track.tpcNSigmaKa()) > cNSigCut2 && std::fabs(track.tpcNSigmaPr()) > cNSigCut2) { return true; } } //! if pt > threshold (For tracks with TOF information) - if (track.p() > cPionPthcut && track.p() <= cPionPmaxcut) { + if (track.p() > cpidPionPthcut && track.p() <= cpidPionPmaxcut) { if (track.hasTPC() && track.hasTOF() && std::fabs(track.tpcNSigmaPi()) < cNSigCut2 && std::fabs(track.tofNSigmaPi()) < cNSigCut2 && std::hypot(track.tofNSigmaKa(), track.tpcNSigmaKa()) > cNSigCut2 && std::hypot(track.tofNSigmaPr(), track.tpcNSigmaPr()) > cNSigCut2) { return true; } @@ -868,97 +859,99 @@ struct EventMeanPtId { histos.fill(HIST("Data/hPtDCAz"), track.pt(), track.dcaZ()); histos.fill(HIST("Data/hPtEta"), track.pt(), track.eta()); histos.fill(HIST("Data/hPEta"), track.p(), track.eta()); - histos.fill(HIST("Data/hNsigmaTPC"), track.p(), track.tpcNSigmaPr()); - double eff = getEfficiency(track.pt(), track.eta(), ptHistogramAllchargeRec); - if (eff < threshold) - continue; - double weight = 1. / eff; - sumPtWeight += track.pt() / eff; - sumPtPtWeight += (track.pt() * track.pt()) / (eff * eff); - sumWeight += weight; - - // only TPC tracks: Pion, Kaon, Proton - if (track.hasTPC() && std::abs(track.tpcNSigmaPi()) < cNSigCut3) - histos.fill(HIST("Data/NSigamaTPCpion"), track.pt(), track.tpcNSigmaPi()); - if (track.hasTPC() && std::abs(track.tpcNSigmaKa()) < cNSigCut3) - histos.fill(HIST("Data/NSigamaTPCkaon"), track.pt(), track.tpcNSigmaKa()); - if (track.hasTPC() && std::abs(track.tpcNSigmaPr()) < cNSigCut3) - histos.fill(HIST("Data/NSigamaTPCproton"), track.pt(), track.tpcNSigmaPr()); - - // only TOF tracks: Pion, Kaon, Proton - if (track.hasTOF() && std::abs(track.tofNSigmaPi()) < cNSigCut3) - histos.fill(HIST("Data/NSigamaTOFpion"), track.pt(), track.tofNSigmaPi()); - if (track.hasTOF() && std::abs(track.tofNSigmaKa()) < cNSigCut3) - histos.fill(HIST("Data/NSigamaTOFkaon"), track.pt(), track.tofNSigmaKa()); - if (track.hasTOF() && std::abs(track.tofNSigmaPr()) < cNSigCut3) - histos.fill(HIST("Data/NSigamaTOFproton"), track.pt(), track.tofNSigmaPr()); - - if (track.hasTPC()) - histos.fill(HIST("Data/hdEdx"), track.p(), track.tpcSignal()); - if (track.hasTOF()) - histos.fill(HIST("Data/hTOFbeta"), track.p(), track.beta()); - - //===================================pion============================================================== - // only TPC+TOF tracks: Pion, Kaon, Proton - if ((track.hasTPC() && std::abs(track.tpcNSigmaPi()) < cNSigCut3) && (track.hasTOF() && std::abs(track.tofNSigmaPi()) < cNSigCut3)) { - histos.fill(HIST("Data/NSigamaTPCTOFpion"), track.tpcNSigmaPi(), track.tofNSigmaPi()); - - histos.fill(HIST("Data/hdEdx_afterselection"), track.p(), track.tpcSignal()); - histos.fill(HIST("Data/hTOFbeta_afterselection"), track.p(), track.beta()); - } - if (selPion(track)) { - histos.fill(HIST("Data/hPtPion"), track.pt()); - histos.fill(HIST("Data/hEtaPion"), track.eta()); - histos.fill(HIST("Data/hyPion"), track.rapidity(massPi)); - histos.fill(HIST("Data/hPtyPion"), track.pt(), track.rapidity(massPi)); - nchPi += 1.; - q1Pi += track.pt(); - q2Pi += (track.pt() * track.pt()); - if (track.beta() > 1) + if (effSwitch) { + double eff = getEfficiency(track.pt(), track.eta(), ptHistogramAllchargeRec); + if (eff < threshold) continue; - histos.fill(HIST("Data/hdEdx_afterselection1"), track.p(), track.tpcSignal()); - histos.fill(HIST("Data/hTOFbeta_afterselection1"), track.p(), track.beta()); + double weight = 1. / eff; + sumPtWeight += track.pt() / eff; + sumPtPtWeight += (track.pt() * track.pt()) / (eff * eff); + sumWeight += weight; } - //===========================kaon=============================================================== - if ((track.hasTPC() && std::abs(track.tpcNSigmaKa()) < cNSigCut3) && (track.hasTOF() && std::abs(track.tofNSigmaKa()) < cNSigCut3)) { - histos.fill(HIST("Data/NSigamaTPCTOFkaon"), track.tpcNSigmaKa(), track.tofNSigmaKa()); - histos.fill(HIST("Data/hdEdx_afterselection"), track.p(), track.tpcSignal()); - histos.fill(HIST("Data/hTOFbeta_afterselection"), track.p(), track.beta()); - } - if (selKaon(track)) { - histos.fill(HIST("Data/hPtKaon"), track.pt()); - histos.fill(HIST("Data/hEtaKaon"), track.eta()); - histos.fill(HIST("Data/hyKaon"), track.rapidity(massKa)); - histos.fill(HIST("Data/hPtyKaon"), track.pt(), track.rapidity(massKa)); - nchKa += 1.; - q1Ka += track.pt(); - q2Ka += (track.pt() * track.pt()); - if (track.beta() > 1) - continue; - histos.fill(HIST("Data/hdEdx_afterselection1"), track.p(), track.tpcSignal()); - histos.fill(HIST("Data/hTOFbeta_afterselection1"), track.p(), track.beta()); - } + if (pidSwitch) { + // only TPC tracks: Pion, Kaon, Proton + if (track.hasTPC() && std::abs(track.tpcNSigmaPi()) < cNSigCut3) + histos.fill(HIST("Data/NSigamaTPCpion"), track.pt(), track.tpcNSigmaPi()); + if (track.hasTPC() && std::abs(track.tpcNSigmaKa()) < cNSigCut3) + histos.fill(HIST("Data/NSigamaTPCkaon"), track.pt(), track.tpcNSigmaKa()); + if (track.hasTPC() && std::abs(track.tpcNSigmaPr()) < cNSigCut3) + histos.fill(HIST("Data/NSigamaTPCproton"), track.pt(), track.tpcNSigmaPr()); + + // only TOF tracks: Pion, Kaon, Proton + if (track.hasTOF() && std::abs(track.tofNSigmaPi()) < cNSigCut3) + histos.fill(HIST("Data/NSigamaTOFpion"), track.pt(), track.tofNSigmaPi()); + if (track.hasTOF() && std::abs(track.tofNSigmaKa()) < cNSigCut3) + histos.fill(HIST("Data/NSigamaTOFkaon"), track.pt(), track.tofNSigmaKa()); + if (track.hasTOF() && std::abs(track.tofNSigmaPr()) < cNSigCut3) + histos.fill(HIST("Data/NSigamaTOFproton"), track.pt(), track.tofNSigmaPr()); + + if (track.hasTPC()) + histos.fill(HIST("Data/hdEdx"), track.p(), track.tpcSignal()); + if (track.hasTOF()) + histos.fill(HIST("Data/hTOFbeta"), track.p(), track.beta()); + + //===================================pion=========================================================== + // only TPC+TOF tracks: Pion, Kaon, Proton + if ((track.hasTPC() && std::abs(track.tpcNSigmaPi()) < cNSigCut3) && (track.hasTOF() && std::abs(track.tofNSigmaPi()) < cNSigCut3)) { + histos.fill(HIST("Data/NSigamaTPCTOFpion"), track.tpcNSigmaPi(), track.tofNSigmaPi()); + histos.fill(HIST("Data/hdEdx_afterselection"), track.p(), track.tpcSignal()); + histos.fill(HIST("Data/hTOFbeta_afterselection"), track.p(), track.beta()); + } + if (selPion(track)) { + histos.fill(HIST("Data/hPtPion"), track.pt()); + histos.fill(HIST("Data/hEtaPion"), track.eta()); + histos.fill(HIST("Data/hyPion"), track.rapidity(massPi)); + histos.fill(HIST("Data/hPtyPion"), track.pt(), track.rapidity(massPi)); + nchPi += 1.; + q1Pi += track.pt(); + q2Pi += (track.pt() * track.pt()); + if (track.beta() > 1) + continue; + histos.fill(HIST("Data/hdEdx_afterselection1"), track.p(), track.tpcSignal()); + histos.fill(HIST("Data/hTOFbeta_afterselection1"), track.p(), track.beta()); + } - //============================proton=========================================================== - if ((track.hasTPC() && std::abs(track.tpcNSigmaPr()) < cNSigCut3) && (track.hasTOF() && std::abs(track.tofNSigmaPr()) < cNSigCut3)) { - histos.fill(HIST("Data/NSigamaTPCTOFproton"), track.tpcNSigmaPr(), track.tofNSigmaPr()); - histos.fill(HIST("Data/hdEdx_afterselection"), track.p(), track.tpcSignal()); - histos.fill(HIST("Data/hTOFbeta_afterselection"), track.p(), track.beta()); - } - if (selProton(track)) { - histos.fill(HIST("Data/hPtProton"), track.pt()); - histos.fill(HIST("Data/hEtaProton"), track.eta()); - histos.fill(HIST("Data/hyProton"), track.rapidity(massPr)); - histos.fill(HIST("Data/hPtyProton"), track.pt(), track.rapidity(massPr)); - nchPr += 1.; - q1Pr += track.pt(); - q2Pr += (track.pt() * track.pt()); - if (track.beta() > 1) - continue; - histos.fill(HIST("Data/hdEdx_afterselection1"), track.p(), track.tpcSignal()); - histos.fill(HIST("Data/hTOFbeta_afterselection1"), track.p(), track.beta()); + //===========================kaon=============================================================== + if ((track.hasTPC() && std::abs(track.tpcNSigmaKa()) < cNSigCut3) && (track.hasTOF() && std::abs(track.tofNSigmaKa()) < cNSigCut3)) { + histos.fill(HIST("Data/NSigamaTPCTOFkaon"), track.tpcNSigmaKa(), track.tofNSigmaKa()); + histos.fill(HIST("Data/hdEdx_afterselection"), track.p(), track.tpcSignal()); + histos.fill(HIST("Data/hTOFbeta_afterselection"), track.p(), track.beta()); + } + if (selKaon(track)) { + histos.fill(HIST("Data/hPtKaon"), track.pt()); + histos.fill(HIST("Data/hEtaKaon"), track.eta()); + histos.fill(HIST("Data/hyKaon"), track.rapidity(massKa)); + histos.fill(HIST("Data/hPtyKaon"), track.pt(), track.rapidity(massKa)); + nchKa += 1.; + q1Ka += track.pt(); + q2Ka += (track.pt() * track.pt()); + if (track.beta() > 1) + continue; + histos.fill(HIST("Data/hdEdx_afterselection1"), track.p(), track.tpcSignal()); + histos.fill(HIST("Data/hTOFbeta_afterselection1"), track.p(), track.beta()); + } + + //============================proton=========================================================== + if ((track.hasTPC() && std::abs(track.tpcNSigmaPr()) < cNSigCut3) && (track.hasTOF() && std::abs(track.tofNSigmaPr()) < cNSigCut3)) { + histos.fill(HIST("Data/NSigamaTPCTOFproton"), track.tpcNSigmaPr(), track.tofNSigmaPr()); + histos.fill(HIST("Data/hdEdx_afterselection"), track.p(), track.tpcSignal()); + histos.fill(HIST("Data/hTOFbeta_afterselection"), track.p(), track.beta()); + } + if (selProton(track)) { + histos.fill(HIST("Data/hPtProton"), track.pt()); + histos.fill(HIST("Data/hEtaProton"), track.eta()); + histos.fill(HIST("Data/hyProton"), track.rapidity(massPr)); + histos.fill(HIST("Data/hPtyProton"), track.pt(), track.rapidity(massPr)); + nchPr += 1.; + q1Pr += track.pt(); + q2Pr += (track.pt() * track.pt()); + if (track.beta() > 1) + continue; + histos.fill(HIST("Data/hdEdx_afterselection1"), track.p(), track.tpcSignal()); + histos.fill(HIST("Data/hTOFbeta_afterselection1"), track.p(), track.beta()); + } } } // Track loop ends! @@ -972,10 +965,6 @@ struct EventMeanPtId { var1 = (q1 * q1 - q2) / (nchAll * (nchAll - 1)); var2 = (q1 / nchAll); - //------------------ Efficiency corrected histograms --------------- - var1Eff = (sumPtWeight * sumPtWeight - sumPtPtWeight) / (sumWeight * (sumWeight - 1)); - var2Eff = (sumPtWeight / sumWeight); - //---------------------- pions ---------------------------------------- if (nchPi >= cTwoPtlCut2) { var1Pi = (q1Pi * q1Pi - q2Pi) / (nchPi * (nchPi - 1)); @@ -997,15 +986,6 @@ struct EventMeanPtId { histos.fill(HIST("Data/hVar2"), sample, cent, var2); histos.fill(HIST("Data/hVarc"), sample, cent); histos.fill(HIST("Data/hVar2meanpt"), cent, var2); - histos.fill(HIST("Data/hVar1pi"), sample, cent, var1Pi); - histos.fill(HIST("Data/hVar2pi"), sample, cent, var2Pi); - histos.fill(HIST("Data/hVar2meanptpi"), cent, var2Pi); - histos.fill(HIST("Data/hVar1k"), sample, cent, var1Ka); - histos.fill(HIST("Data/hVar2k"), sample, cent, var2Ka); - histos.fill(HIST("Data/hVar2meanptk"), cent, var2Ka); - histos.fill(HIST("Data/hVar1p"), sample, cent, var1Pr); - histos.fill(HIST("Data/hVar2p"), sample, cent, var2Pr); - histos.fill(HIST("Data/hVar2meanptp"), cent, var2Pr); //-----------------------nch------------------------------------- histos.fill(HIST("Data/hVar1x"), sample, nchAll, var1); @@ -1016,34 +996,50 @@ struct EventMeanPtId { histos.fill(HIST("Data/hdiffVar2x"), sample, nch, var2); histos.fill(HIST("Data/hdiffVarx"), sample, nch); - histos.fill(HIST("hEffVar1x_data"), sample, nchAll, var1Eff); - histos.fill(HIST("hEffVar2x_data"), sample, nchAll, var2Eff); - histos.fill(HIST("hEffVarx_data"), sample, nchAll); - histos.fill(HIST("hEffVar2Meanptx_data"), nchAll, var2Eff); - histos.fill(HIST("hEffVar1x_Naccorr_data"), sample, sumWeight, var1Eff); - histos.fill(HIST("hEffVar2x_Naccorr_data"), sample, sumWeight, var2Eff); - histos.fill(HIST("hEffVarx_Naccorr_data"), sample, sumWeight); - histos.fill(HIST("hEffVar1x_Naccorr_data"), sample, nchAll, var1Eff); - histos.fill(HIST("hEffVar2x_Naccorr_data"), sample, nchAll, var2Eff); - histos.fill(HIST("hEffVarx_Naccorr_data"), sample, nchAll, sumWeight); - histos.fill(HIST("hEffVar1x_Naccorr_xaxis_data"), sample, sumWeight, var1); - histos.fill(HIST("hEffVar2x_Naccorr_xaxis_data"), sample, sumWeight, var2); - histos.fill(HIST("hEffVarx_Naccorr_xaxis_data"), sample, sumWeight); - - histos.fill(HIST("Data/hVar1pix"), sample, nchAll, var1Pi); - histos.fill(HIST("Data/hVar2pix"), sample, nchAll, var2Pi); - histos.fill(HIST("Data/hVarpix"), sample, nchPi); - histos.fill(HIST("Data/hVar2meanptpix"), nchAll, var2Pi); - - histos.fill(HIST("Data/hVar1kx"), sample, nchAll, var1Ka); - histos.fill(HIST("Data/hVar2kx"), sample, nchAll, var2Ka); - histos.fill(HIST("Data/hVarkx"), sample, nchKa); - histos.fill(HIST("Data/hVar2meanptkx"), nchAll, var2Ka); - - histos.fill(HIST("Data/hVar1px"), sample, nchAll, var1Pr); - histos.fill(HIST("Data/hVar2px"), sample, nchAll, var2Pr); - histos.fill(HIST("Data/hVarpx"), sample, nchPr); - histos.fill(HIST("Data/hVar2meanptpx"), nchAll, var2Pr); + if (effSwitchHistoFill) { + //------------------ Efficiency corrected histograms --------------- + var1Eff = (sumPtWeight * sumPtWeight - sumPtPtWeight) / (sumWeight * (sumWeight - 1)); + var2Eff = (sumPtWeight / sumWeight); + + histos.fill(HIST("hEffVar1x_data"), sample, nchAll, var1Eff); + histos.fill(HIST("hEffVar2x_data"), sample, nchAll, var2Eff); + histos.fill(HIST("hEffVarx_data"), sample, nchAll); + histos.fill(HIST("hEffVar2Meanptx_data"), nchAll, var2Eff); + histos.fill(HIST("hEffVar1x_Naccorr_data"), sample, sumWeight, var1Eff); + histos.fill(HIST("hEffVar2x_Naccorr_data"), sample, sumWeight, var2Eff); + histos.fill(HIST("hEffVarx_Naccorr_data"), sample, sumWeight); + histos.fill(HIST("hEffVar1x_Naccorr_data"), sample, nchAll, var1Eff); + histos.fill(HIST("hEffVar2x_Naccorr_data"), sample, nchAll, var2Eff); + histos.fill(HIST("hEffVarx_Naccorr_data"), sample, nchAll, sumWeight); + histos.fill(HIST("hEffVar1x_Naccorr_xaxis_data"), sample, sumWeight, var1); + histos.fill(HIST("hEffVar2x_Naccorr_xaxis_data"), sample, sumWeight, var2); + histos.fill(HIST("hEffVarx_Naccorr_xaxis_data"), sample, sumWeight); + } + + if (pidSwitchHistoFill) { + histos.fill(HIST("Data/hVar1pi"), sample, cent, var1Pi); + histos.fill(HIST("Data/hVar2pi"), sample, cent, var2Pi); + histos.fill(HIST("Data/hVar2meanptpi"), cent, var2Pi); + histos.fill(HIST("Data/hVar1k"), sample, cent, var1Ka); + histos.fill(HIST("Data/hVar2k"), sample, cent, var2Ka); + histos.fill(HIST("Data/hVar2meanptk"), cent, var2Ka); + histos.fill(HIST("Data/hVar1p"), sample, cent, var1Pr); + histos.fill(HIST("Data/hVar2p"), sample, cent, var2Pr); + histos.fill(HIST("Data/hVar2meanptp"), cent, var2Pr); + histos.fill(HIST("Data/hVar1pix"), sample, nchAll, var1Pi); + histos.fill(HIST("Data/hVar2pix"), sample, nchAll, var2Pi); + histos.fill(HIST("Data/hVarpix"), sample, nchPi); + histos.fill(HIST("Data/hVar2meanptpix"), nchAll, var2Pi); + histos.fill(HIST("Data/hVar1kx"), sample, nchAll, var1Ka); + histos.fill(HIST("Data/hVar2kx"), sample, nchAll, var2Ka); + histos.fill(HIST("Data/hVarkx"), sample, nchKa); + histos.fill(HIST("Data/hVar2meanptkx"), nchAll, var2Ka); + histos.fill(HIST("Data/hVar1px"), sample, nchAll, var1Pr); + histos.fill(HIST("Data/hVar2px"), sample, nchAll, var2Pr); + histos.fill(HIST("Data/hVarpx"), sample, nchPr); + histos.fill(HIST("Data/hVar2meanptpx"), nchAll, var2Pr); + } + } // event loop ends! PROCESS_SWITCH(EventMeanPtId, processData, "process real data information", true); @@ -1125,16 +1121,18 @@ struct EventMeanPtId { histos.fill(HIST("hPt_rec"), track.pt()); histos.fill(HIST("hEta_rec"), track.eta()); - double eff = getEfficiency(track.pt(), track.eta(), ptHistogramAllchargeRec); - if (eff < threshold) - continue; - double weight = 1.0 / eff; - sumPtWeight += track.pt() * weight; - sumPtPtWeight += (track.pt() * track.pt() * weight * weight); - sumWeight += weight; + if (effSwitch) { + double eff = getEfficiency(track.pt(), track.eta(), ptHistogramAllchargeRec); + if (eff < threshold) + continue; + double weight = 1.0 / eff; + sumPtWeight += track.pt() * weight; + sumPtPtWeight += (track.pt() * track.pt() * weight * weight); + sumWeight += weight; - histos.fill(HIST("hPt_rec_corr"), track.pt(), weight); - histos.fill(HIST("hEta_rec_corr"), track.eta(), weight); + histos.fill(HIST("hPt_rec_corr"), track.pt(), weight); + histos.fill(HIST("hEta_rec_corr"), track.eta(), weight); + } auto mcParticle = track.mcParticle(); nchAll += 1.; @@ -1155,150 +1153,149 @@ struct EventMeanPtId { histos.fill(HIST("Rec/hPtDCAz"), track.pt(), track.dcaZ()); histos.fill(HIST("Rec/hPtEta"), track.pt(), track.eta()); histos.fill(HIST("Rec/hPEta"), track.p(), track.eta()); - histos.fill(HIST("Rec/hNsigmaTPC"), track.p(), track.tpcNSigmaPr()); histos.fill(HIST("hPtEta_rec"), track.pt(), track.eta()); - if (std::abs(mcParticle.pdgCode()) == PDG_t::kPiPlus) - histos.fill(HIST("ptHistogramPionrec_pdg"), track.pt()); - if (std::abs(mcParticle.pdgCode()) == PDG_t::kKPlus) - histos.fill(HIST("ptHistogramKaonrec_pdg"), track.pt()); - if (std::abs(mcParticle.pdgCode()) == PDG_t::kProton) - histos.fill(HIST("ptHistogramProtonrec_pdg"), track.pt()); - - // only TPC tracks: Pion, Kaon, Proton - if (track.hasTPC() && std::abs(track.tpcNSigmaPi()) < cNSigCut3) - histos.fill(HIST("Rec/NSigamaTPCpion"), track.pt(), track.tpcNSigmaPi()); - if (track.hasTPC() && std::abs(track.tpcNSigmaKa()) < cNSigCut3) - histos.fill(HIST("Rec/NSigamaTPCkaon"), track.pt(), track.tpcNSigmaKa()); - if (track.hasTPC() && std::abs(track.tpcNSigmaPr()) < cNSigCut3) - histos.fill(HIST("Rec/NSigamaTPCproton"), track.pt(), track.tpcNSigmaPr()); - - // only TOF tracks: Pion, Kaon, Proton - if (track.hasTOF() && std::abs(track.tofNSigmaPi()) < cNSigCut3) - histos.fill(HIST("Rec/NSigamaTOFpion"), track.pt(), track.tofNSigmaPi()); - if (track.hasTOF() && std::abs(track.tofNSigmaKa()) < cNSigCut3) - histos.fill(HIST("Rec/NSigamaTOFkaon"), track.pt(), track.tofNSigmaKa()); - if (track.hasTOF() && std::abs(track.tofNSigmaPr()) < cNSigCut3) - histos.fill(HIST("Rec/NSigamaTOFproton"), track.pt(), track.tofNSigmaPr()); - - if (track.hasTPC()) - histos.fill(HIST("Rec/hdEdx"), track.p(), track.tpcSignal()); - if (track.hasTOF()) - histos.fill(HIST("Rec/hTOFbeta"), track.p(), track.beta()); - if (track.hasTPC()) - histos.fill(HIST("hdEdx_afterselection_rec_beforepidcut"), track.p(), track.tpcSignal()); - if (track.hasTOF()) - histos.fill(HIST("hTOFbeta_afterselection_rec_beforepidcut"), track.p(), track.beta()); - - //===================================pion============================================================== - if ((track.hasTPC() && std::abs(track.tpcNSigmaPi()) < cNSigCut3) && (track.hasTOF() && std::abs(track.tofNSigmaPi()) < cNSigCut3)) { - histos.fill(HIST("Rec/NSigamaTPCTOFpion"), track.tpcNSigmaPi(), track.tofNSigmaPi()); - - histos.fill(HIST("Rec/hdEdx_afterselection"), track.p(), track.tpcSignal()); - histos.fill(HIST("Rec/hTOFbeta_afterselection"), track.p(), track.beta()); - } - - if (selPion(track)) { - if (std::fabs(track.y()) > cRapidityCut05) - continue; - if (track.beta() > 1) - continue; - histos.fill(HIST("ptHistogramPionrec"), track.pt()); - histos.fill(HIST("hPtEta_pi_rec"), track.pt(), track.eta()); - histos.fill(HIST("Rec/hPtPion"), track.pt()); - histos.fill(HIST("Rec/hEtaPion"), track.eta()); - histos.fill(HIST("Rec/hyPion"), track.rapidity(massPi)); - histos.fill(HIST("Rec/hPtyPion"), track.pt(), track.rapidity(massPi)); - histos.fill(HIST("NSigamaTPCpion_rec"), track.p(), track.tpcNSigmaPi()); - histos.fill(HIST("NSigamaTOFpion_rec"), track.p(), track.tofNSigmaPi()); - histos.fill(HIST("NSigamaTPCTOFpion_rec"), track.tpcNSigmaPi(), track.tofNSigmaPi()); - histos.fill(HIST("Rec/hdEdx_afterselection1"), track.p(), track.tpcSignal()); - histos.fill(HIST("Rec/hTOFbeta_afterselection1"), track.p(), track.beta()); - if (std::abs(track.mcParticle().pdgCode()) == PDG_t::kPiPlus) { - histos.fill(HIST("ptHistogramPionrec_purity"), track.pt()); + if (pidSwitch) { + if (std::abs(mcParticle.pdgCode()) == PDG_t::kPiPlus) + histos.fill(HIST("ptHistogramPionrec_pdg"), track.pt()); + if (std::abs(mcParticle.pdgCode()) == PDG_t::kKPlus) + histos.fill(HIST("ptHistogramKaonrec_pdg"), track.pt()); + if (std::abs(mcParticle.pdgCode()) == PDG_t::kProton) + histos.fill(HIST("ptHistogramProtonrec_pdg"), track.pt()); + + // only TPC tracks: Pion, Kaon, Proton + if (track.hasTPC() && std::abs(track.tpcNSigmaPi()) < cNSigCut3) + histos.fill(HIST("Rec/NSigamaTPCpion"), track.pt(), track.tpcNSigmaPi()); + if (track.hasTPC() && std::abs(track.tpcNSigmaKa()) < cNSigCut3) + histos.fill(HIST("Rec/NSigamaTPCkaon"), track.pt(), track.tpcNSigmaKa()); + if (track.hasTPC() && std::abs(track.tpcNSigmaPr()) < cNSigCut3) + histos.fill(HIST("Rec/NSigamaTPCproton"), track.pt(), track.tpcNSigmaPr()); + + // only TOF tracks: Pion, Kaon, Proton + if (track.hasTOF() && std::abs(track.tofNSigmaPi()) < cNSigCut3) + histos.fill(HIST("Rec/NSigamaTOFpion"), track.pt(), track.tofNSigmaPi()); + if (track.hasTOF() && std::abs(track.tofNSigmaKa()) < cNSigCut3) + histos.fill(HIST("Rec/NSigamaTOFkaon"), track.pt(), track.tofNSigmaKa()); + if (track.hasTOF() && std::abs(track.tofNSigmaPr()) < cNSigCut3) + histos.fill(HIST("Rec/NSigamaTOFproton"), track.pt(), track.tofNSigmaPr()); + + if (track.hasTPC()) + histos.fill(HIST("Rec/hdEdx"), track.p(), track.tpcSignal()); + if (track.hasTOF()) + histos.fill(HIST("Rec/hTOFbeta"), track.p(), track.beta()); + if (track.hasTPC()) + histos.fill(HIST("hdEdx_afterselection_rec_beforepidcut"), track.p(), track.tpcSignal()); + if (track.hasTOF()) + histos.fill(HIST("hTOFbeta_afterselection_rec_beforepidcut"), track.p(), track.beta()); + + //===================================pion============================================================== + if ((track.hasTPC() && std::abs(track.tpcNSigmaPi()) < cNSigCut3) && (track.hasTOF() && std::abs(track.tofNSigmaPi()) < cNSigCut3)) { + histos.fill(HIST("Rec/NSigamaTPCTOFpion"), track.tpcNSigmaPi(), track.tofNSigmaPi()); + + histos.fill(HIST("Rec/hdEdx_afterselection"), track.p(), track.tpcSignal()); + histos.fill(HIST("Rec/hTOFbeta_afterselection"), track.p(), track.beta()); } - nchPi += 1.; - q1Pi += track.pt(); - q2Pi += (track.pt() * track.pt()); - - histos.fill(HIST("hPyPion_rec"), track.p(), track.rapidity(massPi)); - histos.fill(HIST("hPtyPion_rec"), track.pt(), track.rapidity(massPi)); - } - //===========================kaon=============================================================== + if (selPion(track)) { + if (std::fabs(track.y()) > cRapidityCut05) + continue; + if (track.beta() > 1) + continue; + histos.fill(HIST("ptHistogramPionrec"), track.pt()); + histos.fill(HIST("hPtEta_pi_rec"), track.pt(), track.eta()); + histos.fill(HIST("Rec/hPtPion"), track.pt()); + histos.fill(HIST("Rec/hEtaPion"), track.eta()); + histos.fill(HIST("Rec/hyPion"), track.rapidity(massPi)); + histos.fill(HIST("Rec/hPtyPion"), track.pt(), track.rapidity(massPi)); + histos.fill(HIST("NSigamaTPCpion_rec"), track.p(), track.tpcNSigmaPi()); + histos.fill(HIST("NSigamaTOFpion_rec"), track.p(), track.tofNSigmaPi()); + histos.fill(HIST("NSigamaTPCTOFpion_rec"), track.tpcNSigmaPi(), track.tofNSigmaPi()); + histos.fill(HIST("Rec/hdEdx_afterselection1"), track.p(), track.tpcSignal()); + histos.fill(HIST("Rec/hTOFbeta_afterselection1"), track.p(), track.beta()); + if (std::abs(track.mcParticle().pdgCode()) == PDG_t::kPiPlus) { + histos.fill(HIST("ptHistogramPionrec_purity"), track.pt()); + } + nchPi += 1.; + q1Pi += track.pt(); + q2Pi += (track.pt() * track.pt()); + + histos.fill(HIST("hPyPion_rec"), track.p(), track.rapidity(massPi)); + histos.fill(HIST("hPtyPion_rec"), track.pt(), track.rapidity(massPi)); + } - if ((track.hasTPC() && std::abs(track.tpcNSigmaKa()) < cNSigCut3) && (track.hasTOF() && std::abs(track.tofNSigmaKa()) < cNSigCut3)) { - histos.fill(HIST("Rec/NSigamaTPCTOFkaon"), track.tpcNSigmaKa(), track.tofNSigmaKa()); - histos.fill(HIST("Rec/hdEdx_afterselection"), track.p(), track.tpcSignal()); - histos.fill(HIST("Rec/hTOFbeta_afterselection"), track.p(), track.beta()); - } + //===========================kaon=============================================================== - if (selKaon(track)) { - if (std::fabs(track.y()) > cRapidityCut05) - continue; - if (track.beta() > 1) - continue; - histos.fill(HIST("ptHistogramKaonrec"), track.pt()); - histos.fill(HIST("hPtEta_ka_rec"), track.pt(), track.eta()); - histos.fill(HIST("Rec/hPtKaon"), track.pt()); - histos.fill(HIST("Rec/hEtaKaon"), track.eta()); - histos.fill(HIST("Rec/hyKaon"), track.rapidity(massKa)); - histos.fill(HIST("Rec/hPtyKaon"), track.pt(), track.rapidity(massKa)); - histos.fill(HIST("NSigamaTPCkaon_rec"), track.p(), track.tpcNSigmaKa()); - histos.fill(HIST("NSigamaTOFkaon_rec"), track.p(), track.tofNSigmaKa()); - histos.fill(HIST("NSigamaTPCTOFkaon_rec"), track.tpcNSigmaKa(), track.tofNSigmaKa()); - histos.fill(HIST("Rec/hdEdx_afterselection1"), track.p(), track.tpcSignal()); - histos.fill(HIST("Rec/hTOFbeta_afterselection1"), track.p(), track.beta()); - if (std::abs(track.mcParticle().pdgCode()) == PDG_t::kKPlus) { - histos.fill(HIST("ptHistogramKaonrec_purity"), track.pt()); + if ((track.hasTPC() && std::abs(track.tpcNSigmaKa()) < cNSigCut3) && (track.hasTOF() && std::abs(track.tofNSigmaKa()) < cNSigCut3)) { + histos.fill(HIST("Rec/NSigamaTPCTOFkaon"), track.tpcNSigmaKa(), track.tofNSigmaKa()); + histos.fill(HIST("Rec/hdEdx_afterselection"), track.p(), track.tpcSignal()); + histos.fill(HIST("Rec/hTOFbeta_afterselection"), track.p(), track.beta()); } - nchKa += 1.; - q1Ka += track.pt(); - q2Ka += (track.pt() * track.pt()); - histos.fill(HIST("hPyKaon_rec"), track.p(), track.rapidity(massKa)); - histos.fill(HIST("hPtyKaon_rec"), track.pt(), track.rapidity(massKa)); - } - - //============================proton=========================================================== + if (selKaon(track)) { + if (std::fabs(track.y()) > cRapidityCut05) + continue; + if (track.beta() > 1) + continue; + histos.fill(HIST("ptHistogramKaonrec"), track.pt()); + histos.fill(HIST("hPtEta_ka_rec"), track.pt(), track.eta()); + histos.fill(HIST("Rec/hPtKaon"), track.pt()); + histos.fill(HIST("Rec/hEtaKaon"), track.eta()); + histos.fill(HIST("Rec/hyKaon"), track.rapidity(massKa)); + histos.fill(HIST("Rec/hPtyKaon"), track.pt(), track.rapidity(massKa)); + histos.fill(HIST("NSigamaTPCkaon_rec"), track.p(), track.tpcNSigmaKa()); + histos.fill(HIST("NSigamaTOFkaon_rec"), track.p(), track.tofNSigmaKa()); + histos.fill(HIST("NSigamaTPCTOFkaon_rec"), track.tpcNSigmaKa(), track.tofNSigmaKa()); + histos.fill(HIST("Rec/hdEdx_afterselection1"), track.p(), track.tpcSignal()); + histos.fill(HIST("Rec/hTOFbeta_afterselection1"), track.p(), track.beta()); + if (std::abs(track.mcParticle().pdgCode()) == PDG_t::kKPlus) { + histos.fill(HIST("ptHistogramKaonrec_purity"), track.pt()); + } + nchKa += 1.; + q1Ka += track.pt(); + q2Ka += (track.pt() * track.pt()); + + histos.fill(HIST("hPyKaon_rec"), track.p(), track.rapidity(massKa)); + histos.fill(HIST("hPtyKaon_rec"), track.pt(), track.rapidity(massKa)); + } - if ((track.hasTPC() && std::abs(track.tpcNSigmaPr()) < cNSigCut3) && (track.hasTOF() && std::abs(track.tofNSigmaPr()) < cNSigCut3)) { - histos.fill(HIST("Rec/NSigamaTPCTOFproton"), track.tpcNSigmaPr(), track.tofNSigmaPr()); - histos.fill(HIST("Rec/hdEdx_afterselection"), track.p(), track.tpcSignal()); - histos.fill(HIST("Rec/hTOFbeta_afterselection"), track.p(), track.beta()); - } + //============================proton=========================================================== - if (selProton(track)) { - if (std::fabs(track.y()) > cRapidityCut05) - continue; - if (track.beta() > 1) - continue; - histos.fill(HIST("ptHistogramProtonrec"), track.pt()); - histos.fill(HIST("hPtEta_pr_rec"), track.pt(), track.eta()); - histos.fill(HIST("Rec/hPtProton"), track.pt()); - histos.fill(HIST("Rec/hEtaProton"), track.eta()); - histos.fill(HIST("Rec/hyProton"), track.rapidity(massPr)); - histos.fill(HIST("Rec/hPtyProton"), track.pt(), track.rapidity(massPr)); - histos.fill(HIST("NSigamaTPCproton_rec"), track.p(), track.tpcNSigmaPr()); - histos.fill(HIST("NSigamaTOFproton_rec"), track.p(), track.tofNSigmaPr()); - histos.fill(HIST("NSigamaTPCTOFproton_rec"), track.tpcNSigmaPr(), track.tofNSigmaPr()); - histos.fill(HIST("Rec/hdEdx_afterselection1"), track.p(), track.tpcSignal()); - histos.fill(HIST("Rec/hTOFbeta_afterselection1"), track.p(), track.beta()); - if (std::abs(track.mcParticle().pdgCode()) == PDG_t::kProton) { - histos.fill(HIST("ptHistogramProtonrec_purity"), track.pt()); + if ((track.hasTPC() && std::abs(track.tpcNSigmaPr()) < cNSigCut3) && (track.hasTOF() && std::abs(track.tofNSigmaPr()) < cNSigCut3)) { + histos.fill(HIST("Rec/NSigamaTPCTOFproton"), track.tpcNSigmaPr(), track.tofNSigmaPr()); + histos.fill(HIST("Rec/hdEdx_afterselection"), track.p(), track.tpcSignal()); + histos.fill(HIST("Rec/hTOFbeta_afterselection"), track.p(), track.beta()); } - nchPr += 1.; - q1Pr += track.pt(); - q2Pr += (track.pt() * track.pt()); - histos.fill(HIST("hPyProton_rec"), track.p(), track.rapidity(massPr)); - histos.fill(HIST("hPtyProton_rec"), track.pt(), track.rapidity(massPr)); + if (selProton(track)) { + if (std::fabs(track.y()) > cRapidityCut05) + continue; + if (track.beta() > 1) + continue; + histos.fill(HIST("ptHistogramProtonrec"), track.pt()); + histos.fill(HIST("hPtEta_pr_rec"), track.pt(), track.eta()); + histos.fill(HIST("Rec/hPtProton"), track.pt()); + histos.fill(HIST("Rec/hEtaProton"), track.eta()); + histos.fill(HIST("Rec/hyProton"), track.rapidity(massPr)); + histos.fill(HIST("Rec/hPtyProton"), track.pt(), track.rapidity(massPr)); + histos.fill(HIST("NSigamaTPCproton_rec"), track.p(), track.tpcNSigmaPr()); + histos.fill(HIST("NSigamaTOFproton_rec"), track.p(), track.tofNSigmaPr()); + histos.fill(HIST("NSigamaTPCTOFproton_rec"), track.tpcNSigmaPr(), track.tofNSigmaPr()); + histos.fill(HIST("Rec/hdEdx_afterselection1"), track.p(), track.tpcSignal()); + histos.fill(HIST("Rec/hTOFbeta_afterselection1"), track.p(), track.beta()); + if (std::abs(track.mcParticle().pdgCode()) == PDG_t::kProton) { + histos.fill(HIST("ptHistogramProtonrec_purity"), track.pt()); + } + nchPr += 1.; + q1Pr += track.pt(); + q2Pr += (track.pt() * track.pt()); + + histos.fill(HIST("hPyProton_rec"), track.p(), track.rapidity(massPr)); + histos.fill(HIST("hPtyProton_rec"), track.pt(), track.rapidity(massPr)); + } } } // loop over tracks histos.fill(HIST("Rec/hcent_nacc"), cent, nchAll); - histos.fill(HIST("hcent_nacc_corr"), cent, sumWeight); - histos.fill(HIST("hNch_vs_corr"), sample, nchAll, sumWeight); histos.fill(HIST("hNch_vs_Nch"), sample, nchAll, nchAll); if (nchAll < cTwoPtlCut2) @@ -1306,13 +1303,9 @@ struct EventMeanPtId { var1 = (q1 * q1 - q2) / (nchAll * (nchAll - 1)); var2 = (q1 / nchAll); - //------------------ Efficiency corrected histograms --------------- histos.fill(HIST("hterm1"), nchAll, var1); histos.fill(HIST("hterm2"), nchAll, var2); - var1Eff = (sumPtWeight * sumPtWeight - sumPtPtWeight) / (sumWeight * (sumWeight - 1)); - var2Eff = (sumPtWeight / sumWeight); - histos.fill(HIST("Rec/hVar1"), sample, cent, var1); histos.fill(HIST("Rec/hVar2"), sample, cent, var2); histos.fill(HIST("Rec/hVarc"), sample, cent); @@ -1333,17 +1326,6 @@ struct EventMeanPtId { var1Pr = (q1Pr * q1Pr - q2Pr) / (nchPr * (nchPr - 1)); var2Pr = (q1Pr / nchPr); } - //========================centrality========================================== - - histos.fill(HIST("Rec/hVar1pi"), sample, cent, var1Pi); - histos.fill(HIST("Rec/hVar2pi"), sample, cent, var2Pi); - histos.fill(HIST("Rec/hVar2meanptpi"), cent, var2Pi); - histos.fill(HIST("Rec/hVar1k"), sample, cent, var1Ka); - histos.fill(HIST("Rec/hVar2k"), sample, cent, var2Ka); - histos.fill(HIST("Rec/hVar2meanptk"), cent, var2Ka); - histos.fill(HIST("Rec/hVar1p"), sample, cent, var1Pr); - histos.fill(HIST("Rec/hVar2p"), sample, cent, var2Pr); - histos.fill(HIST("Rec/hVar2meanptp"), cent, var2Pr); //-----------------------nch------------------------------------- histos.fill(HIST("Rec/hVar1x"), sample, nchAll, var1); @@ -1352,32 +1334,49 @@ struct EventMeanPtId { histos.fill(HIST("Rec/hdiffVar1x"), sample, nch, var1); histos.fill(HIST("Rec/hdiffVar2x"), sample, nch, var2); histos.fill(HIST("Rec/hdiffVarx"), sample, nch); - histos.fill(HIST("Rec/hVar2meanptx"), nchAll, var2); - histos.fill(HIST("Rec/hVar1pix"), sample, nchAll, var1Pi); - histos.fill(HIST("Rec/hVar2pix"), sample, nchAll, var2Pi); - histos.fill(HIST("Rec/hVarpix"), sample, nchPi); - histos.fill(HIST("Rec/hVar2meanptpix"), nchAll, var2Pi); - histos.fill(HIST("Rec/hVar1kx"), sample, nchAll, var1Ka); - histos.fill(HIST("Rec/hVar2kx"), sample, nchAll, var2Ka); - histos.fill(HIST("Rec/hVarkx"), sample, nchKa); - histos.fill(HIST("Rec/hVar2meanptkx"), nchAll, var2Ka); - histos.fill(HIST("Rec/hVar1px"), sample, nchAll, var1Pr); - histos.fill(HIST("Rec/hVar2px"), sample, nchAll, var2Pr); - histos.fill(HIST("Rec/hVarpx"), sample, nchPr); - histos.fill(HIST("Rec/hVar2meanptpx"), nchAll, var2Pr); - - histos.fill(HIST("hEffVar1x_rec"), sample, nchAll, var1Eff); - histos.fill(HIST("hEffVar2x_rec"), sample, nchAll, var2Eff); - histos.fill(HIST("hEffVarx_rec"), sample, nchAll); - histos.fill(HIST("hEffVar2Meanptx_rec"), nchAll, var2Eff); - histos.fill(HIST("hEffVar1x_Naccorr_rec"), sample, sumWeight, var1Eff); - histos.fill(HIST("hEffVar2x_Naccorr_rec"), sample, sumWeight, var2Eff); - histos.fill(HIST("hEffVarx_Naccorr_rec"), sample, sumWeight); - histos.fill(HIST("hEffVar1x_Naccorr_xaxis_rec"), sample, sumWeight, var1); - histos.fill(HIST("hEffVar2x_Naccorr_xaxis_rec"), sample, sumWeight, var2); - histos.fill(HIST("hEffVarx_Naccorr_xaxis_rec"), sample, sumWeight); + if (pidSwitchHistoFill) { + histos.fill(HIST("Rec/hVar1pi"), sample, cent, var1Pi); + histos.fill(HIST("Rec/hVar2pi"), sample, cent, var2Pi); + histos.fill(HIST("Rec/hVar2meanptpi"), cent, var2Pi); + histos.fill(HIST("Rec/hVar1k"), sample, cent, var1Ka); + histos.fill(HIST("Rec/hVar2k"), sample, cent, var2Ka); + histos.fill(HIST("Rec/hVar2meanptk"), cent, var2Ka); + histos.fill(HIST("Rec/hVar1p"), sample, cent, var1Pr); + histos.fill(HIST("Rec/hVar2p"), sample, cent, var2Pr); + histos.fill(HIST("Rec/hVar2meanptp"), cent, var2Pr); + histos.fill(HIST("Rec/hVar1pix"), sample, nchAll, var1Pi); + histos.fill(HIST("Rec/hVar2pix"), sample, nchAll, var2Pi); + histos.fill(HIST("Rec/hVarpix"), sample, nchPi); + histos.fill(HIST("Rec/hVar2meanptpix"), nchAll, var2Pi); + histos.fill(HIST("Rec/hVar1kx"), sample, nchAll, var1Ka); + histos.fill(HIST("Rec/hVar2kx"), sample, nchAll, var2Ka); + histos.fill(HIST("Rec/hVarkx"), sample, nchKa); + histos.fill(HIST("Rec/hVar2meanptkx"), nchAll, var2Ka); + histos.fill(HIST("Rec/hVar1px"), sample, nchAll, var1Pr); + histos.fill(HIST("Rec/hVar2px"), sample, nchAll, var2Pr); + histos.fill(HIST("Rec/hVarpx"), sample, nchPr); + histos.fill(HIST("Rec/hVar2meanptpx"), nchAll, var2Pr); + } + + if (effSwitchHistoFill) { + var1Eff = (sumPtWeight * sumPtWeight - sumPtPtWeight) / (sumWeight * (sumWeight - 1)); + var2Eff = (sumPtWeight / sumWeight); + + histos.fill(HIST("hEffVar1x_rec"), sample, nchAll, var1Eff); + histos.fill(HIST("hEffVar2x_rec"), sample, nchAll, var2Eff); + histos.fill(HIST("hEffVarx_rec"), sample, nchAll); + histos.fill(HIST("hEffVar2Meanptx_rec"), nchAll, var2Eff); + histos.fill(HIST("hEffVar1x_Naccorr_rec"), sample, sumWeight, var1Eff); + histos.fill(HIST("hEffVar2x_Naccorr_rec"), sample, sumWeight, var2Eff); + histos.fill(HIST("hEffVarx_Naccorr_rec"), sample, sumWeight); + histos.fill(HIST("hEffVar1x_Naccorr_xaxis_rec"), sample, sumWeight, var1); + histos.fill(HIST("hEffVar2x_Naccorr_xaxis_rec"), sample, sumWeight, var2); + histos.fill(HIST("hEffVarx_Naccorr_xaxis_rec"), sample, sumWeight); + histos.fill(HIST("hcent_nacc_corr"), cent, sumWeight); + histos.fill(HIST("hNch_vs_corr"), sample, nchAll, sumWeight); + } //================= generated level============================== const auto& mccolgen = coll.mcCollision_as(); @@ -1437,40 +1436,41 @@ struct EventMeanPtId { histos.fill(HIST("hnch_gen_all"), nchGenAll); histos.fill(HIST("hPtEta_gen"), mcpart.pt(), mcpart.eta()); - if (std::fabs(mcpart.y()) < cRapidityCut05) { - - if (mcpart.pdgCode() == PDG_t::kPiPlus || mcpart.pdgCode() == PDG_t::kPiMinus) { - histos.fill(HIST("ptHistogramPion"), mcpart.pt()); - histos.fill(HIST("hPtEta_pi_gen"), mcpart.pt(), mcpart.eta()); - histos.fill(HIST("hPty_pi_gen"), mcpart.pt(), mcpart.y()); - nchPiGen += 1.; - q1PiGen += mcpart.pt(); - q2PiGen += (mcpart.pt() * mcpart.pt()); - histos.fill(HIST("hnch_pi"), nchPiGen); - } - - if (mcpart.pdgCode() == PDG_t::kKPlus || mcpart.pdgCode() == PDG_t::kKMinus) { - histos.fill(HIST("ptHistogramKaon"), mcpart.pt()); - histos.fill(HIST("hPtEta_ka_gen"), mcpart.pt(), mcpart.eta()); - histos.fill(HIST("hPty_ka_gen"), mcpart.pt(), mcpart.y()); - nchKaGen += 1.; - q1KaGen += mcpart.pt(); - q2KaGen += (mcpart.pt() * mcpart.pt()); - histos.fill(HIST("hnch_ka"), nchKaGen); - } - - if (mcpart.pdgCode() == PDG_t::kProton || mcpart.pdgCode() == PDG_t::kProtonBar) { - histos.fill(HIST("ptHistogramProton"), mcpart.pt()); - histos.fill(HIST("hPtEta_pr_gen"), mcpart.pt(), mcpart.eta()); - histos.fill(HIST("hPty_pr_gen"), mcpart.pt(), mcpart.y()); - nchPrGen += 1.; - q1PrGen += mcpart.pt(); - q2PrGen += (mcpart.pt() * mcpart.pt()); - histos.fill(HIST("hnch_pr"), nchPrGen); - } - - } //|y| < 0.5 cut ends! - + if (pidSwitch) { + if (std::fabs(mcpart.y()) < cRapidityCut05) { + + if (mcpart.pdgCode() == PDG_t::kPiPlus || mcpart.pdgCode() == PDG_t::kPiMinus) { + histos.fill(HIST("ptHistogramPion"), mcpart.pt()); + histos.fill(HIST("hPtEta_pi_gen"), mcpart.pt(), mcpart.eta()); + histos.fill(HIST("hPty_pi_gen"), mcpart.pt(), mcpart.y()); + nchPiGen += 1.; + q1PiGen += mcpart.pt(); + q2PiGen += (mcpart.pt() * mcpart.pt()); + histos.fill(HIST("hnch_pi"), nchPiGen); + } + + if (mcpart.pdgCode() == PDG_t::kKPlus || mcpart.pdgCode() == PDG_t::kKMinus) { + histos.fill(HIST("ptHistogramKaon"), mcpart.pt()); + histos.fill(HIST("hPtEta_ka_gen"), mcpart.pt(), mcpart.eta()); + histos.fill(HIST("hPty_ka_gen"), mcpart.pt(), mcpart.y()); + nchKaGen += 1.; + q1KaGen += mcpart.pt(); + q2KaGen += (mcpart.pt() * mcpart.pt()); + histos.fill(HIST("hnch_ka"), nchKaGen); + } + + if (mcpart.pdgCode() == PDG_t::kProton || mcpart.pdgCode() == PDG_t::kProtonBar) { + histos.fill(HIST("ptHistogramProton"), mcpart.pt()); + histos.fill(HIST("hPtEta_pr_gen"), mcpart.pt(), mcpart.eta()); + histos.fill(HIST("hPty_pr_gen"), mcpart.pt(), mcpart.y()); + nchPrGen += 1.; + q1PrGen += mcpart.pt(); + q2PrGen += (mcpart.pt() * mcpart.pt()); + histos.fill(HIST("hnch_pr"), nchPrGen); + } + + } //|y| < 0.5 cut ends! + } // pid flag } // track loop ends! histos.fill(HIST("hcent_nacc_gen"), cent, nchGenAll); @@ -1507,20 +1507,22 @@ struct EventMeanPtId { histos.fill(HIST("hdiffVar1x_gen"), sampleGen, nchgen, var1AllGen); histos.fill(HIST("hdiffVar2x_gen"), sampleGen, nchgen, var2AllGen); histos.fill(HIST("hdiffVarx_gen"), sampleGen, nchgen); - histos.fill(HIST("hVar2meanptx_gen"), nchGenAll, var2AllGen); - histos.fill(HIST("hVar1pix_gen"), sampleGen, nchGenAll, var1PiGen); - histos.fill(HIST("hVar2pix_gen"), sampleGen, nchGenAll, var2PiGen); - histos.fill(HIST("hVarpix_gen"), sampleGen, nchPiGen); - histos.fill(HIST("hVar2meanptpix_gen"), nchGenAll, var2PiGen); - histos.fill(HIST("hVar1kx_gen"), sampleGen, nchGenAll, var1KaGen); - histos.fill(HIST("hVar2kx_gen"), sampleGen, nchGenAll, var2KaGen); - histos.fill(HIST("hVarkx_gen"), sampleGen, nchKaGen); - histos.fill(HIST("hVar2meanptkx_gen"), nchGenAll, var2KaGen); - histos.fill(HIST("hVar1px_gen"), sampleGen, nchGenAll, var1PrGen); - histos.fill(HIST("hVar2px_gen"), sampleGen, nchGenAll, var2PrGen); - histos.fill(HIST("hVarpx_gen"), sampleGen, nchPrGen); - histos.fill(HIST("hVar2meanptpx_gen"), nchGenAll, var2PrGen); + + if (pidSwitchHistoFill) { + histos.fill(HIST("hVar1pix_gen"), sampleGen, nchGenAll, var1PiGen); + histos.fill(HIST("hVar2pix_gen"), sampleGen, nchGenAll, var2PiGen); + histos.fill(HIST("hVarpix_gen"), sampleGen, nchPiGen); + histos.fill(HIST("hVar2meanptpix_gen"), nchGenAll, var2PiGen); + histos.fill(HIST("hVar1kx_gen"), sampleGen, nchGenAll, var1KaGen); + histos.fill(HIST("hVar2kx_gen"), sampleGen, nchGenAll, var2KaGen); + histos.fill(HIST("hVarkx_gen"), sampleGen, nchKaGen); + histos.fill(HIST("hVar2meanptkx_gen"), nchGenAll, var2KaGen); + histos.fill(HIST("hVar1px_gen"), sampleGen, nchGenAll, var1PrGen); + histos.fill(HIST("hVar2px_gen"), sampleGen, nchGenAll, var2PrGen); + histos.fill(HIST("hVarpx_gen"), sampleGen, nchPrGen); + histos.fill(HIST("hVar2meanptpx_gen"), nchGenAll, var2PrGen); + } } // void process PROCESS_SWITCH(EventMeanPtId, processMcReco, "Process reconstructed", false); From 836903a35bc56fc874277040b4f9452ce00518df Mon Sep 17 00:00:00 2001 From: Preet-Bhanjan Date: Sun, 19 Oct 2025 21:46:23 +0200 Subject: [PATCH 814/986] [PWGCF] Addition of named constants in PID function (#13433) Co-authored-by: Preet Pati Co-authored-by: ALICE Action Bot --- .../Tasks/pidDiHadron.cxx | 978 ++++++++++++++---- 1 file changed, 782 insertions(+), 196 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/pidDiHadron.cxx b/PWGCF/TwoParticleCorrelations/Tasks/pidDiHadron.cxx index ac08c333121..ab33d507df4 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/pidDiHadron.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/pidDiHadron.cxx @@ -17,6 +17,8 @@ #include "PWGCF/Core/CorrelationContainer.h" #include "PWGCF/Core/PairCuts.h" #include "PWGCF/DataModel/CorrelationsDerived.h" +#include "PWGLF/DataModel/EPCalibrationTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" #include "Common/Core/RecoDecay.h" #include "Common/DataModel/Centrality.h" @@ -55,17 +57,109 @@ using namespace o2::framework::expressions; // define the filtered collisions and tracks #define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; +template +auto readMatrix(Array2D const& mat, P& array, int rowStart, int rowEnd, int colStart, int colEnd) +{ + for (auto i = rowStart; i < rowEnd; ++i) { + for (auto j = colStart; j < colEnd; ++j) { + array[i][j] = mat(i, j); + } + } + + return; +} + +static constexpr float LongArrayFloat[3][20] = {{1.1, 1.2, 1.3, -1.1, -1.2, -1.3, 1.1, 1.2, 1.3, -1.1, -1.2, -1.3, 1.1, 1.2, 1.3, -1.1, -1.2, -1.3, 1.1, 1.2}, {2.1, 2.2, 2.3, -2.1, -2.2, -2.3, 1.1, 1.2, 1.3, -1.1, -1.2, -1.3, 1.1, 1.2, 1.3, -1.1, -1.2, -1.3, 1.1, 1.2}, {3.1, 3.2, 3.3, -3.1, -3.2, -3.3, 1.1, 1.2, 1.3, -1.1, -1.2, -1.3, 1.1, 1.2, 1.3, -1.1, -1.2, -1.3, 1.1, 1.2}}; +static constexpr int LongArrayInt[3][20] = {{1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1}, {2, 2, 2, -2, -2, -2, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1}, {3, 3, 3, -3, -3, -3, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1}}; + struct PidDiHadron { + o2::aod::ITSResponse itsResponse; Service ccdb; - O2_DEFINE_CONFIGURABLE(cfgCutVtxZ, float, 10.0f, "Accepted z-vertex range") - O2_DEFINE_CONFIGURABLE(cfgCutPtMin, float, 0.2f, "minimum accepted track pT") - O2_DEFINE_CONFIGURABLE(cfgCutPtMax, float, 10.0f, "maximum accepted track pT") + enum ResoParticles { + K0 = 0, + LAMBDA = 1, + PHI = 2, + NResoParticles = 3 + }; + enum ParticleCuts { + kCosPA = 0, + kMassMin, + kMassMax, + kPosTrackPt, + kNegTrackPt, + kDCAPosToPVMin, + kDCANegToPVMin, + kLifeTime, + kRadiusMin, + kRadiusMax, + kRapidity, + kNParticleCuts + }; + enum ParticleSwitches { + kUseCosPA = 0, + kMassBins, + kDCABetDaug, + kUseProperLifetime, + kUseV0Radius, + kNParticleSwitches + }; + enum Particles { + PIONS = 0, + KAONS, + PROTONS + }; + enum ParticleNsigma { + kPionUpCut = 0, + kKaonUpCut, + kProtonUpCut, + kPionLowCut, + kKaonLowCut, + kProtonLowCut + }; + enum EventCutTypes { + kFilteredEvents = 0, + kAfterSel8, + kUseNoTimeFrameBorder, + kUseNoITSROFrameBorder, + kUseNoSameBunchPileup, + kUseGoodZvtxFT0vsPV, + kUseNoCollInTimeRangeStandard, + kUseGoodITSLayersAll, + kUseNoCollInRofStandard, + kUseNoHighMultCollInPrevRof, + kUseOccupancy, + kUseMultCorrCut, + kUseT0AV0ACut, + kUseVertexITSTPC, + kUseTVXinTRD, + kNEventCuts + }; + enum { + kCharged = 0, + kPions, + kKaons, + kProtons, + kK0, + kLambda, + kPhi + }; + + O2_DEFINE_CONFIGURABLE(cfgCutVertex, float, 10.0f, "Accepted z-vertex range") + O2_DEFINE_CONFIGURABLE(cfgCutPtPOIMin, float, 0.2f, "minimum accepted track pT") + O2_DEFINE_CONFIGURABLE(cfgCutPtPOIMax, float, 10.0f, "maximum accepted track pT") + O2_DEFINE_CONFIGURABLE(cfgCutPtMin, float, 0.2f, "Minimal pT for ref tracks") + O2_DEFINE_CONFIGURABLE(cfgCutPtMax, float, 3.0f, "Maximal pT for ref tracks") O2_DEFINE_CONFIGURABLE(cfgCutEta, float, 0.8f, "Eta cut") O2_DEFINE_CONFIGURABLE(cfgCutChi2prTPCcls, float, 2.5f, "max chi2 per TPC clusters") - O2_DEFINE_CONFIGURABLE(cfgCutTPCclu, float, 50.0f, "minimum TPC clusters") - O2_DEFINE_CONFIGURABLE(cfgCutTPCCrossedRows, float, 70.0f, "minimum TPC crossed rows") - O2_DEFINE_CONFIGURABLE(cfgCutITSclu, float, 5.0f, "minimum ITS clusters") + O2_DEFINE_CONFIGURABLE(cfgTpcCluster, float, 50.0f, "minimum TPC clusters") + O2_DEFINE_CONFIGURABLE(cfgTpcCrossRows, float, 70.0f, "minimum TPC crossed rows") + O2_DEFINE_CONFIGURABLE(cfgTofPtCut, float, 0.5f, "Minimum pt to use TOF N-sigma") + O2_DEFINE_CONFIGURABLE(cfgTpcCut, float, 3.0f, "TPC N-sigma cut for pions, kaons, protons") + O2_DEFINE_CONFIGURABLE(cfgITScluster, float, 5.0f, "minimum ITS clusters") + O2_DEFINE_CONFIGURABLE(cfgCutOccupancyMax, int, 2000, "Minimum occupancy cut") + O2_DEFINE_CONFIGURABLE(cfgCutOccupancyMin, int, 0, "Maximum occupancy cut") + O2_DEFINE_CONFIGURABLE(cfgFakeKaonCut, float, 0.1f, "Maximum difference in measured momentum and TPC inner ring momentum of particle") O2_DEFINE_CONFIGURABLE(cfgCutDCAz, float, 2.0f, "max DCA to vertex z") O2_DEFINE_CONFIGURABLE(cfgCutMerging, float, 0.0, "Merging cut on track merge") O2_DEFINE_CONFIGURABLE(cfgSelCollByNch, bool, true, "Select collisions by Nch or centrality") @@ -80,28 +174,16 @@ struct PidDiHadron { O2_DEFINE_CONFIGURABLE(cfgCentEstimator, int, 0, "0:FT0C; 1:FT0CVariant1; 2:FT0M; 3:FT0A") O2_DEFINE_CONFIGURABLE(cfgCentTableUnavailable, bool, false, "if a dataset does not provide centrality information") O2_DEFINE_CONFIGURABLE(cfgUseAdditionalEventCut, bool, false, "Use additional event cut on mult correlations") - O2_DEFINE_CONFIGURABLE(cfgEvSelkNoSameBunchPileup, bool, false, "rejects collisions which are associated with the same found-by-T0 bunch crossing") - O2_DEFINE_CONFIGURABLE(cfgEvSelkNoITSROFrameBorder, bool, false, "reject events at ITS ROF border") - O2_DEFINE_CONFIGURABLE(cfgEvSelkNoTimeFrameBorder, bool, false, "reject events at TF border") - O2_DEFINE_CONFIGURABLE(cfgEvSelkIsGoodZvtxFT0vsPV, bool, false, "removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference, use this cut at low multiplicities with caution") - O2_DEFINE_CONFIGURABLE(cfgEvSelkNoCollInTimeRangeStandard, bool, false, "no collisions in specified time range") - O2_DEFINE_CONFIGURABLE(cfgEvSelkIsGoodITSLayersAll, bool, true, "cut time intervals with dead ITS staves") - O2_DEFINE_CONFIGURABLE(cfgEvSelkNoCollInRofStandard, bool, false, "no other collisions in this Readout Frame with per-collision multiplicity above threshold") - O2_DEFINE_CONFIGURABLE(cfgEvSelkNoHighMultCollInPrevRof, bool, false, "veto an event if FT0C amplitude in previous ITS ROF is above threshold") - O2_DEFINE_CONFIGURABLE(cfgEvSelMultCorrelation, bool, true, "Multiplicity correlation cut") - O2_DEFINE_CONFIGURABLE(cfgEvSelV0AT0ACut, bool, true, "V0A T0A 5 sigma cut") - O2_DEFINE_CONFIGURABLE(cfgEvSelOccupancy, bool, true, "Occupancy cut") - O2_DEFINE_CONFIGURABLE(cfgCutOccupancyHigh, int, 2000, "High cut on TPC occupancy") - O2_DEFINE_CONFIGURABLE(cfgCutOccupancyLow, int, 0, "Low cut on TPC occupancy") + O2_DEFINE_CONFIGURABLE(cfgV0AT0Acut, int, 5, "V0AT0A cut") O2_DEFINE_CONFIGURABLE(cfgEfficiency, std::string, "", "CCDB path to efficiency object") O2_DEFINE_CONFIGURABLE(cfgLocalEfficiency, bool, false, "Use local efficiency object") O2_DEFINE_CONFIGURABLE(cfgVerbosity, bool, false, "Verbose output") O2_DEFINE_CONFIGURABLE(cfgUseEventWeights, bool, false, "Use event weights for mixed event") O2_DEFINE_CONFIGURABLE(cfgUsePtOrder, bool, false, "enable trigger pT < associated pT cut") O2_DEFINE_CONFIGURABLE(cfgUsePtOrderInMixEvent, bool, false, "enable trigger pT < associated pT cut in mixed event") - O2_DEFINE_CONFIGURABLE(cfgPIDUseITSPID, bool, true, "Use ITS PID for particle identification") - O2_DEFINE_CONFIGURABLE(cfgPIDTofPtCut, float, 0.5f, "Minimum pt to use TOF N-sigma") - O2_DEFINE_CONFIGURABLE(cfgPIDParticle, int, 0, "1 = pion, 2 = kaon, 3 = proton, 0 for no PID") + O2_DEFINE_CONFIGURABLE(cfgUseItsPID, bool, true, "Use ITS PID for particle identification") + O2_DEFINE_CONFIGURABLE(cfgUseOnlyTPC, bool, true, "Use only TPC PID for daughter selection") + O2_DEFINE_CONFIGURABLE(cfgPIDParticle, int, 0, "1 = pion, 2 = kaon, 3 = proton, 4 = kshort, 5 = lambda, 6 = phi, 0 for no PID") SliceCache cache; @@ -116,21 +198,27 @@ struct PidDiHadron { ConfigurableAxis axisVtxMix{"axisVtxMix", {VARIABLE_WIDTH, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, "vertex axis for mixed event histograms"}; ConfigurableAxis axisMultMix{"axisMultMix", {VARIABLE_WIDTH, 0, 10, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260}, "multiplicity / centrality axis for mixed event histograms"}; ConfigurableAxis axisSample{"axisSample", {cfgSampleSize, 0, cfgSampleSize}, "sample axis for histograms"}; - Configurable> pidTofNsigmaCut{"pidTofNsigmaCut", std::vector{1.5, 1.5, 1.5, -1.5, -1.5, -1.5}, "TOF n-sigma cut for pions_posNsigma, kaons_posNsigma, protons_posNsigma, pions_negNsigma, kaons_negNsigma, protons_negNsigma"}; - Configurable> pidItsNsigmaCut{"pidItsNsigmaCut", std::vector{3, 3, 3, -3, -3, -3}, "ITS n-sigma cut for pions_posNsigma, kaons_posNsigma, protons_posNsigma, pions_negNsigma, kaons_negNsigma, protons_negNsigma"}; - Configurable> pidTpcNsigmaCut{"pidTpcNsigmaCut", std::vector{10, 10, 10, -10, -10, -10}, "TOF n-sigma cut for pions_posNsigma, kaons_posNsigma, protons_posNsigma, pions_negNsigma, kaons_negNsigma, protons_negNsigma"}; + ConfigurableAxis axisNsigmaTPC{"axisNsigmaTPC", {80, -5, 5}, "nsigmaTPC axis"}; + ConfigurableAxis axisNsigmaTOF{"axisNsigmaTOF", {80, -5, 5}, "nsigmaTOF axis"}; - ConfigurableAxis axisVertexEfficiency{"axisVertexEfficiency", {10, -10, 10}, "vertex axis for efficiency histograms"}; - ConfigurableAxis axisEtaEfficiency{"axisEtaEfficiency", {20, -1.0, 1.0}, "eta axis for efficiency histograms"}; - ConfigurableAxis axisPtEfficiency{"axisPtEfficiency", {VARIABLE_WIDTH, 0.2, 0.5, 1, 1.5, 2, 3, 4, 6, 10}, "pt axis for efficiency histograms"}; + Configurable> cfgUseEventCuts{"cfgUseEventCuts", {LongArrayInt[0], 1, 15, {"EvCuts"}, {"Filtered Events", "Sel8", "kNoTimeFrameBorder", "kNoITSROFrameBorder", "kNoSameBunchPileup", "kIsGoodZvtxFT0vsPV", "kNoCollInTimeRangeStandard", "kIsGoodITSLayersAll", "kNoCollInRofStandard", "kNoHighMultCollInPrevRof", "Occupancy", "Multcorrelation", "T0AV0ACut", "kIsVertexITSTPC", "kTVXinTRD"}}, "Labeled array (int) for various cuts on resonances"}; + Configurable> nSigmas{"nSigmas", {LongArrayFloat[0], 3, 6, {"TPC", "TOF", "ITS"}, {"pos_pi", "pos_ka", "pos_pr", "neg_pi", "neg_ka", "neg_pr"}}, "Labeled array for n-sigma values for TPC, TOF, ITS for pions, kaons, protons (positive and negative)"}; + Configurable> resonanceCuts{"resonanceCuts", {LongArrayFloat[0], 3, 11, {"K0", "Lambda", "Phi"}, {"cos_PAs", "massMin", "massMax", "PosTrackPt", "NegTrackPt", "DCAPosToPVMin", "DCANegToPVMin", "Lifetime", "RadiusMin", "RadiusMax", "Rapidity"}}, "Labeled array (float) for various cuts on resonances"}; + Configurable> resonanceSwitches{"resonanceSwitches", {LongArrayInt[0], 3, 5, {"K0", "Lambda", "Phi"}, {"UseCosPA", "NMassBins", "DCABetDaug", "UseProperLifetime", "UseV0Radius"}}, "Labeled array (int) for various cuts on resonances"}; + + ConfigurableAxis axisVertexEfficiency{"axisVertexEfficiency", {1, 0, 1}, "vertex axis for efficiency histograms"}; + ConfigurableAxis axisEtaEfficiency{"axisEtaEfficiency", {1, 0, 1}, "eta axis for efficiency histograms"}; + ConfigurableAxis axisPtEfficiency{"axisPtEfficiency", {1, 0, 1}, "pt axis for efficiency histograms"}; // make the filters and cuts. - Filter collisionFilter = (nabs(aod::collision::posZ) < cfgCutVtxZ); - Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls) && (nabs(aod::track::dcaZ) < cfgCutDCAz); + Filter collisionFilter = (nabs(aod::collision::posZ) < cfgCutVertex); + Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtPOIMin) && (aod::track::pt < cfgCutPtPOIMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls) && (nabs(aod::track::dcaZ) < cfgCutDCAz); using FilteredCollisions = soa::Filtered>; using FilteredTracks = soa::Filtered>; + using V0TrackCandidate = aod::V0Datas; Preslice perCollision = aod::track::collisionId; + Preslice perCollisionV0 = aod::v0::collisionId; // Corrections TH3D* mEfficiency = nullptr; @@ -139,7 +227,9 @@ struct PidDiHadron { // Define the outputs OutputObj same{"sameEvent"}; OutputObj mixed{"mixedEvent"}; - HistogramRegistry registry{"registry"}; + OutputObj sameReso{"sameEventReso"}; + OutputObj mixedReso{"mixedEventReso"}; + HistogramRegistry histos{"histos"}; // define global variables TRandom3* gRandom = new TRandom3(); @@ -155,15 +245,22 @@ struct PidDiHadron { SameEvent = 1, MixedEvent = 3 }; - std::vector tofNsigmaCut; - std::vector itsNsigmaCut; - std::vector tpcNsigmaCut; - o2::aod::ITSResponse itsResponse; - enum Particles { - PIONS, - KAONS, - PROTONS + enum DetectorType { + kTPC = 0, + kTOF, + kITS }; + enum EventCutType { + kEvCut1 = 0, + kNEvCutTypes = 1 + }; + + std::array, 1> eventCuts; + std::array, 3> resoCutVals; + std::array, 3> resoSwitchVals; + std::array tofNsigmaCut; + std::array itsNsigmaCut; + std::array tpcNsigmaCut; // persistent caches std::vector efficiencyAssociatedCache; @@ -178,6 +275,36 @@ struct PidDiHadron { void init(InitContext&) { + // projectMatrix(nSigmas->getData(), tpcNsigmaCut, tofNsigmaCut, itsNsigmaCut); + readMatrix(resonanceCuts->getData(), resoCutVals, K0, NResoParticles, kCosPA, kNParticleCuts); + readMatrix(resonanceSwitches->getData(), resoSwitchVals, K0, NResoParticles, kUseCosPA, kNParticleSwitches); + readMatrix(cfgUseEventCuts->getData(), eventCuts, kEvCut1, kNEvCutTypes, kFilteredEvents, kNEventCuts); + + tpcNsigmaCut[kPionUpCut] = nSigmas->getData()[kTPC][kPionUpCut]; + tpcNsigmaCut[kKaonUpCut] = nSigmas->getData()[kTPC][kKaonUpCut]; + tpcNsigmaCut[kProtonUpCut] = nSigmas->getData()[kTPC][kProtonUpCut]; + tpcNsigmaCut[kPionLowCut] = nSigmas->getData()[kTPC][kPionLowCut]; + tpcNsigmaCut[kKaonLowCut] = nSigmas->getData()[kTPC][kKaonLowCut]; + tpcNsigmaCut[kProtonLowCut] = nSigmas->getData()[kTPC][kProtonLowCut]; + + tofNsigmaCut[kPionUpCut] = nSigmas->getData()[kTOF][kPionUpCut]; + tofNsigmaCut[kKaonUpCut] = nSigmas->getData()[kTOF][kKaonUpCut]; + tofNsigmaCut[kProtonUpCut] = nSigmas->getData()[kTOF][kProtonUpCut]; + tofNsigmaCut[kPionLowCut] = nSigmas->getData()[kTOF][kPionLowCut]; + tofNsigmaCut[kKaonLowCut] = nSigmas->getData()[kTOF][kKaonLowCut]; + tofNsigmaCut[kProtonLowCut] = nSigmas->getData()[kTOF][kProtonLowCut]; + + itsNsigmaCut[kPionUpCut] = nSigmas->getData()[kITS][kPionUpCut]; + itsNsigmaCut[kKaonUpCut] = nSigmas->getData()[kITS][kKaonUpCut]; + itsNsigmaCut[kProtonUpCut] = nSigmas->getData()[kITS][kProtonUpCut]; + itsNsigmaCut[kPionLowCut] = nSigmas->getData()[kITS][kPionLowCut]; + itsNsigmaCut[kKaonLowCut] = nSigmas->getData()[kITS][kKaonLowCut]; + itsNsigmaCut[kProtonLowCut] = nSigmas->getData()[kITS][kProtonLowCut]; + + AxisSpec axisK0Mass = {resoSwitchVals[K0][kMassBins], resoCutVals[K0][kMassMin], resoCutVals[K0][kMassMax]}; + AxisSpec axisLambdaMass = {resoSwitchVals[LAMBDA][kMassBins], resoCutVals[LAMBDA][kMassMin], resoCutVals[LAMBDA][kMassMax]}; + AxisSpec axisPhiMass = {resoSwitchVals[PHI][kMassBins], resoCutVals[PHI][kMassMin], resoCutVals[PHI][kMassMax]}; + if (cfgCentTableUnavailable && !cfgSelCollByNch) { LOGF(fatal, "Centrality table is unavailable, cannot select collisions by centrality"); } @@ -191,24 +318,94 @@ struct PidDiHadron { LOGF(info, "Starting init"); + // Creating mass axis depending on particle - 4 = kshort, 5 = lambda, 6 = phi + AxisSpec massAxisReso = {10, 0, 1, "mass"}; + if (cfgPIDParticle == kK0) + massAxisReso = {resoSwitchVals[K0][kMassBins], resoCutVals[K0][kMassMin], resoCutVals[K0][kMassMax], "M_{#pi^{+}#pi^{-}} (GeV/c^{2})"}; + if (cfgPIDParticle == kLambda) + massAxisReso = {resoSwitchVals[LAMBDA][kMassBins], resoCutVals[LAMBDA][kMassMin], resoCutVals[LAMBDA][kMassMax], "M_{p#pi^{-}} (GeV/c^{2})"}; + if (cfgPIDParticle == kPhi) + massAxisReso = {resoSwitchVals[PHI][kMassBins], resoCutVals[PHI][kMassMin], resoCutVals[PHI][kMassMax], "M_{K^{+}K^{-}} (GeV/c^{2})"}; + // Event Counter - if (doprocessSame && cfgUseAdditionalEventCut) { - registry.add("hEventCount", "Number of Event;; Count", {HistType::kTH1D, {{12, 0, 12}}}); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(1, "after sel8"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(2, "kNoSameBunchPileup"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(3, "kNoITSROFrameBorder"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(4, "kNoTimeFrameBorder"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(5, "kIsGoodZvtxFT0vsPV"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(6, "kNoCollInTimeRangeStandard"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(7, "kIsGoodITSLayersAll"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(8, "kNoCollInRofStandard"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(9, "kNoHighMultCollInPrevRof"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(10, "occupancy"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(11, "MultCorrelation"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(12, "cfgEvSelV0AT0ACut"); - } - - if (cfgUseAdditionalEventCut) { + if ((doprocessSame || doprocessSameReso) && cfgUseAdditionalEventCut) { + histos.add("hEventCount", "Number of Events;; Count", {HistType::kTH1D, {{15, -0.5, 14.5}}}); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kFilteredEvents + 1, "Filtered event"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kAfterSel8 + 1, "After sel8"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kUseNoTimeFrameBorder + 1, "kNoTimeFrameBorder"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kUseNoITSROFrameBorder + 1, "kNoITSROFrameBorder"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kUseNoSameBunchPileup + 1, "kNoSameBunchPileup"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kUseGoodZvtxFT0vsPV + 1, "kIsGoodZvtxFT0vsPV"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kUseNoCollInTimeRangeStandard + 1, "kNoCollInTimeRangeStandard"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kUseGoodITSLayersAll + 1, "kIsGoodITSLayersAll"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kUseNoCollInRofStandard + 1, "kNoCollInRofStandard"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kUseNoHighMultCollInPrevRof + 1, "kNoHighMultCollInPrevRof"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kUseOccupancy + 1, "Occupancy Cut"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kUseMultCorrCut + 1, "Multiplicity correlation Cut"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kUseT0AV0ACut + 1, "T0AV0A cut"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kUseVertexITSTPC + 1, "kIsVertexITSTPC"); + histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kUseTVXinTRD + 1, "kTVXinTRD"); + } + + if (cfgPIDParticle == kK0) { // For K0 + histos.add("PiPlusTPC_K0", "", {HistType::kTH2D, {{axisPt, axisNsigmaTPC}}}); + histos.add("PiMinusTPC_K0", "", {HistType::kTH2D, {{axisPt, axisNsigmaTPC}}}); + histos.add("PiPlusTOF_K0", "", {HistType::kTH2D, {{axisPt, axisNsigmaTOF}}}); + histos.add("PiMinusTOF_K0", "", {HistType::kTH2D, {{axisPt, axisNsigmaTOF}}}); + histos.add("hK0Phi", "", {HistType::kTH1D, {axisPhi}}); + histos.add("hK0Eta", "", {HistType::kTH1D, {axisEta}}); + + histos.add("hK0Count", "Number of K0;; Count", {HistType::kTH1D, {{10, 0, 10}}}); + histos.get(HIST("hK0Count"))->GetXaxis()->SetBinLabel(1, "K0 candidates"); + histos.get(HIST("hK0Count"))->GetXaxis()->SetBinLabel(2, "Daughter pt"); + histos.get(HIST("hK0Count"))->GetXaxis()->SetBinLabel(3, "Mass cut"); + histos.get(HIST("hK0Count"))->GetXaxis()->SetBinLabel(4, "Rapidity cut"); + histos.get(HIST("hK0Count"))->GetXaxis()->SetBinLabel(5, "DCA to PV"); + histos.get(HIST("hK0Count"))->GetXaxis()->SetBinLabel(6, "DCA between daughters"); + histos.get(HIST("hK0Count"))->GetXaxis()->SetBinLabel(7, "V0radius"); + histos.get(HIST("hK0Count"))->GetXaxis()->SetBinLabel(8, "CosPA"); + histos.get(HIST("hK0Count"))->GetXaxis()->SetBinLabel(9, "Proper lifetime"); + histos.get(HIST("hK0Count"))->GetXaxis()->SetBinLabel(10, "Daughter track selection"); + } + if (cfgPIDParticle == kLambda) { // For Lambda + histos.add("PrPlusTPC_L", "", {HistType::kTH2D, {{axisPt, axisNsigmaTPC}}}); + histos.add("PiMinusTPC_L", "", {HistType::kTH2D, {{axisPt, axisNsigmaTPC}}}); + histos.add("PrPlusTOF_L", "", {HistType::kTH2D, {{axisPt, axisNsigmaTOF}}}); + histos.add("PiMinusTOF_L", "", {HistType::kTH2D, {{axisPt, axisNsigmaTOF}}}); + histos.add("hLambdaPhi", "", {HistType::kTH1D, {axisPhi}}); + histos.add("hLambdaEta", "", {HistType::kTH1D, {axisEta}}); + + histos.add("hLambdaCount", "Number of Lambda;; Count", {HistType::kTH1D, {{10, 0, 10}}}); + histos.get(HIST("hLambdaCount"))->GetXaxis()->SetBinLabel(1, "Lambda candidates"); + histos.get(HIST("hLambdaCount"))->GetXaxis()->SetBinLabel(2, "Daughter pt"); + histos.get(HIST("hLambdaCount"))->GetXaxis()->SetBinLabel(3, "Mass cut"); + histos.get(HIST("hLambdaCount"))->GetXaxis()->SetBinLabel(4, "Rapidity cut"); + histos.get(HIST("hLambdaCount"))->GetXaxis()->SetBinLabel(5, "DCA to PV"); + histos.get(HIST("hLambdaCount"))->GetXaxis()->SetBinLabel(6, "DCA between daughters"); + histos.get(HIST("hLambdaCount"))->GetXaxis()->SetBinLabel(7, "V0radius"); + histos.get(HIST("hLambdaCount"))->GetXaxis()->SetBinLabel(8, "CosPA"); + histos.get(HIST("hLambdaCount"))->GetXaxis()->SetBinLabel(9, "Proper lifetime"); + histos.get(HIST("hLambdaCount"))->GetXaxis()->SetBinLabel(10, "Daughter track selection"); + } + if (cfgPIDParticle == kPhi) { // For Phi + histos.add("KaPlusTPC", "", {HistType::kTH2D, {{axisPt, axisNsigmaTPC}}}); + histos.add("KaMinusTPC", "", {HistType::kTH2D, {{axisPt, axisNsigmaTPC}}}); + histos.add("KaPlusTOF", "", {HistType::kTH2D, {{axisPt, axisNsigmaTOF}}}); + histos.add("KaMinusTOF", "", {HistType::kTH2D, {{axisPt, axisNsigmaTOF}}}); + histos.add("hPhiPhi", "", {HistType::kTH1D, {axisPhi}}); + histos.add("hPhiEta", "", {HistType::kTH1D, {axisEta}}); + histos.add("hPhiMass_sparse", "", {HistType::kTHnSparseD, {{axisPhiMass, axisPt, axisMultiplicity}}}); + + histos.add("hPhiCount", "Number of Phi;; Count", {HistType::kTH1D, {{5, 0, 5}}}); + histos.get(HIST("hPhiCount"))->GetXaxis()->SetBinLabel(1, "Phi candidates"); + histos.get(HIST("hPhiCount"))->GetXaxis()->SetBinLabel(2, "Daughter track selection"); + histos.get(HIST("hPhiCount"))->GetXaxis()->SetBinLabel(3, "Fake Kaon"); + histos.get(HIST("hPhiCount"))->GetXaxis()->SetBinLabel(4, "CosPA"); + histos.get(HIST("hPhiCount"))->GetXaxis()->SetBinLabel(5, "Rapidity cut"); + } + + // Multiplicity correlation cuts + if (eventCuts[kEvCut1][kUseMultCorrCut]) { fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); fMultPVCutLow->SetParameters(3257.29, -121.848, 1.98492, -0.0172128, 6.47528e-05, 154.756, -1.86072, -0.0274713, 0.000633499, -3.37757e-06); fMultPVCutHigh = new TF1("fMultPVCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); @@ -218,7 +415,8 @@ struct PidDiHadron { fMultCutLow->SetParameters(1654.46, -47.2379, 0.449833, -0.0014125, 150.773, -3.67334, 0.0530503, -0.000614061, 3.15956e-06); fMultCutHigh = new TF1("fMultCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x + 3.*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); fMultCutHigh->SetParameters(1654.46, -47.2379, 0.449833, -0.0014125, 150.773, -3.67334, 0.0530503, -0.000614061, 3.15956e-06); - + } + if (eventCuts[kEvCut1][kUseT0AV0ACut]) { fT0AV0AMean = new TF1("fT0AV0AMean", "[0]+[1]*x", 0, 200000); fT0AV0AMean->SetParameters(-1601.0581, 9.417652e-01); fT0AV0ASigma = new TF1("fT0AV0ASigma", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 200000); @@ -227,24 +425,33 @@ struct PidDiHadron { std::string hCentTitle = "Centrality distribution, Estimator " + std::to_string(cfgCentEstimator); // Make histograms to check the distributions after cuts - if (doprocessSame) { - registry.add("deltaEta_deltaPhi_same", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEta}}); // check to see the delta eta and delta phi distribution - registry.add("deltaEta_deltaPhi_mixed", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEta}}); - registry.add("Phi", "Phi", {HistType::kTH1D, {axisPhi}}); - registry.add("Eta", "Eta", {HistType::kTH1D, {axisEta}}); - registry.add("EtaCorrected", "EtaCorrected", {HistType::kTH1D, {axisEta}}); - registry.add("pT", "pT", {HistType::kTH1D, {axisPtTrigger}}); - registry.add("pTCorrected", "pTCorrected", {HistType::kTH1D, {axisPtTrigger}}); - registry.add("Nch", "N_{ch}", {HistType::kTH1D, {axisMultiplicity}}); - registry.add("Nch_used", "N_{ch}", {HistType::kTH1D, {axisMultiplicity}}); // histogram to see how many events are in the same and mixed event - registry.add("Centrality", hCentTitle.c_str(), {HistType::kTH1D, {axisCentrality}}); - registry.add("Centrality_used", hCentTitle.c_str(), {HistType::kTH1D, {axisCentrality}}); // histogram to see how many events are in the same and mixed event - registry.add("zVtx", "zVtx", {HistType::kTH1D, {axisVertex}}); - registry.add("zVtx_used", "zVtx_used", {HistType::kTH1D, {axisVertex}}); - registry.add("Trig_hist", "", {HistType::kTHnSparseF, {{axisSample, axisVertex, axisPtTrigger}}}); - } - - registry.add("eventcount", "bin", {HistType::kTH1F, {{4, 0, 4, "bin"}}}); // histogram to see how many events are in the same and mixed event + if (doprocessSame || doprocessSameReso) { + histos.add("deltaEta_deltaPhi_same", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEta}}); // check to see the delta eta and delta phi distribution + histos.add("Nch", "N_{ch}", {HistType::kTH1D, {axisMultiplicity}}); + histos.add("Nch_used", "N_{ch}", {HistType::kTH1D, {axisMultiplicity}}); // histogram to see how many events are in the same and mixed event + histos.add("Centrality", hCentTitle.c_str(), {HistType::kTH1D, {axisCentrality}}); + histos.add("Centrality_used", hCentTitle.c_str(), {HistType::kTH1D, {axisCentrality}}); // histogram to see how many events are in the same and mixed event + histos.add("zVtx", "zVtx", {HistType::kTH1D, {axisVertex}}); + histos.add("zVtx_used", "zVtx_used", {HistType::kTH1D, {axisVertex}}); + + if (cfgPIDParticle == kCharged || cfgPIDParticle == kPions || cfgPIDParticle == kKaons || cfgPIDParticle == kProtons) { + histos.add("Phi", "Phi", {HistType::kTH1D, {axisPhi}}); + histos.add("Eta", "Eta", {HistType::kTH1D, {axisEta}}); + histos.add("EtaCorrected", "EtaCorrected", {HistType::kTH1D, {axisEta}}); + histos.add("pT", "pT", {HistType::kTH1D, {axisPtTrigger}}); + histos.add("pTCorrected", "pTCorrected", {HistType::kTH1D, {axisPtTrigger}}); + histos.add("Trig_hist", "", {HistType::kTHnSparseF, {{axisSample, axisVertex, axisPtTrigger}}}); + } + + if (cfgPIDParticle == kK0 || cfgPIDParticle == kLambda || cfgPIDParticle == kPhi) { + histos.add("Trig_histReso", "", {HistType::kTHnSparseF, {{axisSample, axisVertex, axisPtTrigger, massAxisReso}}}); + } + } + if (doprocessMixed || doprocessMixedReso) { + histos.add("deltaEta_deltaPhi_mixed", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEta}}); + } + + histos.add("eventcount", "bin", {HistType::kTH1F, {{4, 0, 4, "bin"}}}); // histogram to see how many events are in the same and mixed event LOGF(info, "Initializing correlation container"); std::vector corrAxis = {{axisSample, "Sample"}, @@ -253,6 +460,13 @@ struct PidDiHadron { {axisPtAssoc, "p_{T} (GeV/c)"}, {axisDeltaPhi, "#Delta#varphi (rad)"}, {axisDeltaEta, "#Delta#eta"}}; + + std::vector corrAxisReso = {{axisSample, "Sample"}, + {axisVertex, "z-vtx (cm)"}, + {axisPtTrigger, "p_{T} (GeV/c)"}, + {massAxisReso}, + {axisDeltaPhi, "#Delta#varphi (rad)"}, + {axisDeltaEta, "#Delta#eta"}}; std::vector effAxis = { {axisEtaEfficiency, "#eta"}, {axisPtEfficiency, "p_{T} (GeV/c)"}, @@ -260,13 +474,15 @@ struct PidDiHadron { }; std::vector userAxis; - same.setObject(new CorrelationContainer("sameEvent", "sameEvent", corrAxis, effAxis, userAxis)); - mixed.setObject(new CorrelationContainer("mixedEvent", "mixedEvent", corrAxis, effAxis, userAxis)); - - tofNsigmaCut = pidTofNsigmaCut; - itsNsigmaCut = pidItsNsigmaCut; - tpcNsigmaCut = pidTpcNsigmaCut; + if (cfgPIDParticle == kCharged || cfgPIDParticle == kPions || cfgPIDParticle == kKaons || cfgPIDParticle == kProtons) { + same.setObject(new CorrelationContainer("sameEvent", "sameEvent", corrAxis, effAxis, userAxis)); + mixed.setObject(new CorrelationContainer("mixedEvent", "mixedEvent", corrAxis, effAxis, userAxis)); + } + if (cfgPIDParticle == kK0 || cfgPIDParticle == kLambda || cfgPIDParticle == kPhi) { + sameReso.setObject(new CorrelationContainer("sameEvent", "sameEvent", corrAxisReso, effAxis, userAxis)); + mixedReso.setObject(new CorrelationContainer("mixedEvent", "mixedEvent", corrAxisReso, effAxis, userAxis)); + } LOGF(info, "End of init"); } @@ -311,7 +527,86 @@ struct PidDiHadron { template bool trackSelected(TTrack track) { - return ((track.tpcNClsFound() >= cfgCutTPCclu) && (track.tpcNClsCrossedRows() >= cfgCutTPCCrossedRows) && (track.itsNCls() >= cfgCutITSclu)); + return ((track.tpcNClsFound() >= cfgTpcCluster) && (track.tpcNClsCrossedRows() >= cfgTpcCrossRows) && (track.itsNCls() >= cfgITScluster)); + } + + template + bool selectionV0Daughter(TTrack const& track, int pid) + { + if (!(track.itsNCls() > cfgITScluster)) + return 0; + if (!track.hasTPC()) + return false; + if (track.tpcNClsFound() < cfgTpcCluster) + return false; + if (!(track.tpcNClsCrossedRows() > cfgTpcCrossRows)) + return 0; + + if (cfgUseOnlyTPC) { + if (pid == PIONS && std::abs(track.tpcNSigmaPi()) > cfgTpcCut) + return false; + if (pid == KAONS && std::abs(track.tpcNSigmaKa()) > cfgTpcCut) + return false; + if (pid == PROTONS && std::abs(track.tpcNSigmaPr()) > cfgTpcCut) + return false; + } else { + int partIndex = getNsigmaPID(track); + int pidIndex = partIndex - 1; // 0 = pion, 1 = kaon, 2 = proton + if (pidIndex != pid) + return false; + } + + return true; + } + + template + int getNsigmaPID(TTrack track) + { + // Computing Nsigma arrays for pion, kaon, and protons + std::array nSigmaTPC = {track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()}; + std::array nSigmaTOF = {track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr()}; + std::array nSigmaITS = {itsResponse.nSigmaITS(track), itsResponse.nSigmaITS(track), itsResponse.nSigmaITS(track)}; + int pid = 0; // 0 = not identified, 1 = pion, 2 = kaon, 3 = proton + + std::array nSigmaToUse = cfgUseItsPID ? nSigmaITS : nSigmaTPC; // Choose which nSigma to use: TPC or ITS + std::array detectorNsigmaCut = cfgUseItsPID ? itsNsigmaCut : tpcNsigmaCut; // Choose which nSigma to use: TPC or ITS + + bool isPion, isKaon, isProton; + bool isDetectedPion = nSigmaToUse[PIONS] < detectorNsigmaCut[kPionUpCut] && nSigmaToUse[PIONS] > detectorNsigmaCut[kPionLowCut]; + bool isDetectedKaon = nSigmaToUse[KAONS] < detectorNsigmaCut[kKaonUpCut] && nSigmaToUse[KAONS] > detectorNsigmaCut[kKaonLowCut]; + bool isDetectedProton = nSigmaToUse[PROTONS] < detectorNsigmaCut[kProtonUpCut] && nSigmaToUse[PROTONS] > detectorNsigmaCut[kProtonLowCut]; + + bool isTofPion = nSigmaTOF[PIONS] < tofNsigmaCut[kPionUpCut] && nSigmaTOF[PIONS] > tofNsigmaCut[kPionLowCut]; + bool isTofKaon = nSigmaTOF[KAONS] < tofNsigmaCut[kKaonUpCut] && nSigmaTOF[KAONS] > tofNsigmaCut[kKaonLowCut]; + bool isTofProton = nSigmaTOF[PROTONS] < tofNsigmaCut[kProtonUpCut] && nSigmaTOF[PROTONS] > tofNsigmaCut[kProtonLowCut]; + + if (track.pt() > cfgTofPtCut && !track.hasTOF()) { + return 0; + } else if (track.pt() > cfgTofPtCut && track.hasTOF()) { + isPion = isTofPion && isDetectedPion; + isKaon = isTofKaon && isDetectedKaon; + isProton = isTofProton && isDetectedProton; + } else { + isPion = isDetectedPion; + isKaon = isDetectedKaon; + isProton = isDetectedProton; + } + + if ((isPion && isKaon) || (isPion && isProton) || (isKaon && isProton)) { + return 0; // more than one particle satisfy the criteria + } + + if (isPion) { + pid = PIONS + 1; + } else if (isKaon) { + pid = KAONS + 1; + } else if (isProton) { + pid = PROTONS + 1; + } else { + return 0; // no particle satisfies the criteria + } + + return pid; // 0 = not identified, 1 = pion, 2 = kaon, 3 = proton } void loadEfficiency(uint64_t timestamp) @@ -364,26 +659,16 @@ struct PidDiHadron { continue; // if PID is selected, check if the track has the right PID if (!getEfficiencyCorrection(weff1, track1.eta(), track1.pt(), vtxz)) continue; - registry.fill(HIST("Phi"), RecoDecay::constrainAngle(track1.phi(), 0.0)); - registry.fill(HIST("Eta"), track1.eta()); - registry.fill(HIST("EtaCorrected"), track1.eta(), weff1); - registry.fill(HIST("pT"), track1.pt()); - registry.fill(HIST("pTCorrected"), track1.pt(), weff1); + histos.fill(HIST("Phi"), RecoDecay::constrainAngle(track1.phi(), 0.0)); + histos.fill(HIST("Eta"), track1.eta()); + histos.fill(HIST("EtaCorrected"), track1.eta(), weff1); + histos.fill(HIST("pT"), track1.pt()); + histos.fill(HIST("pTCorrected"), track1.pt(), weff1); } } - template - float getDPhiStar(TTrack const& track1, TTrackAssoc const& track2, float radius, int magField) + float getDPhiStar(float charge1, float charge2, float phi1, float phi2, float pt1, float pt2, float radius, int magField) { - float charge1 = track1.sign(); - float charge2 = track2.sign(); - - float phi1 = track1.phi(); - float phi2 = track2.phi(); - - float pt1 = track1.pt(); - float pt2 = track2.pt(); - int fbSign = (magField > 0) ? 1 : -1; float dPhiStar = phi1 - phi2 - charge1 * fbSign * std::asin(0.075 * radius / pt1) + charge2 * fbSign * std::asin(0.075 * radius / pt2); @@ -412,8 +697,8 @@ struct PidDiHadron { if (system == SameEvent) { if (!cfgCentTableUnavailable) - registry.fill(HIST("Centrality_used"), cent); - registry.fill(HIST("Nch_used"), tracks1.size()); + histos.fill(HIST("Centrality_used"), cent); + histos.fill(HIST("Nch_used"), tracks1.size()); } int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); @@ -430,7 +715,7 @@ struct PidDiHadron { if (!getEfficiencyCorrection(triggerWeight, track1.eta(), track1.pt(), posZ)) continue; if (system == SameEvent) { - registry.fill(HIST("Trig_hist"), fSampleIndex, posZ, track1.pt(), eventWeight * triggerWeight); + histos.fill(HIST("Trig_hist"), fSampleIndex, posZ, track1.pt(), eventWeight * triggerWeight); } for (auto const& track2 : tracks2) { @@ -453,8 +738,8 @@ struct PidDiHadron { if (std::abs(deltaEta) < cfgCutMerging) { - double dPhiStarHigh = getDPhiStar(track1, track2, cfgRadiusHigh, magneticField); - double dPhiStarLow = getDPhiStar(track1, track2, cfgRadiusLow, magneticField); + double dPhiStarHigh = getDPhiStar(track1.sign(), track2.sign(), track1.phi(), track2.phi(), track1.pt(), track2.pt(), cfgRadiusHigh, magneticField); + double dPhiStarLow = getDPhiStar(track1.sign(), track2.sign(), track1.phi(), track2.phi(), track1.pt(), track2.pt(), cfgRadiusLow, magneticField); const double kLimit = 3.0 * cfgCutMerging; @@ -462,7 +747,7 @@ struct PidDiHadron { if (std::abs(dPhiStarLow) < kLimit || std::abs(dPhiStarHigh) < kLimit || dPhiStarLow * dPhiStarHigh < 0) { for (double rad(cfgRadiusLow); rad < cfgRadiusHigh; rad += 0.01) { - double dPhiStar = getDPhiStar(track1, track2, rad, magneticField); + double dPhiStar = getDPhiStar(track1.sign(), track2.sign(), track1.phi(), track2.phi(), track1.pt(), track2.pt(), rad, magneticField); if (std::abs(dPhiStar) < kLimit) { bIsBelow = true; break; @@ -477,114 +762,240 @@ struct PidDiHadron { if (system == SameEvent) { same->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track2.pt(), deltaPhi, deltaEta, eventWeight * triggerWeight * associatedWeight); - registry.fill(HIST("deltaEta_deltaPhi_same"), deltaPhi, deltaEta, eventWeight * triggerWeight * associatedWeight); + histos.fill(HIST("deltaEta_deltaPhi_same"), deltaPhi, deltaEta, eventWeight * triggerWeight * associatedWeight); } else if (system == MixedEvent) { mixed->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track2.pt(), deltaPhi, deltaEta, eventWeight * triggerWeight * associatedWeight); - registry.fill(HIST("deltaEta_deltaPhi_mixed"), deltaPhi, deltaEta, eventWeight * triggerWeight * associatedWeight); + histos.fill(HIST("deltaEta_deltaPhi_mixed"), deltaPhi, deltaEta, eventWeight * triggerWeight * associatedWeight); + } + } + } + } + + template + void fillCorrelationsReso(TV0Tracks tracks1, TTracksAssoc tracks2, float posZ, float posY, float posX, int system, int magneticField, float cent, float eventWeight) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms + { + // Cache efficiency for particles (too many FindBin lookups) + if (mEfficiency) { + efficiencyAssociatedCache.clear(); + efficiencyAssociatedCache.reserve(tracks2.size()); + for (const auto& track2 : tracks2) { + float weff = 1.; + getEfficiencyCorrection(weff, track2.eta(), track2.pt(), posZ); + efficiencyAssociatedCache.push_back(weff); + } + } + + if (system == SameEvent) { + if (!cfgCentTableUnavailable) + histos.fill(HIST("Centrality_used"), cent); + histos.fill(HIST("Nch_used"), tracks2.size()); // Taking Nch from tracks2 since tracks1 are V0s + } + + int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); + + float triggerWeight = 1.0f; + float associatedWeight = 1.0f; + // loop over all tracks + for (auto const& track1 : tracks1) { + + double resoMass = -1; + + // 4 = kshort, 5 = lambda, 6 = phi + if (cfgPIDParticle == kK0) { + if (!selectionK0(track1, posZ, posY, posX)) + continue; // Reject if called for K0 but V0 is not K0 + + resoMass = track1.mK0Short(); + } + + if (cfgPIDParticle == kLambda) { + if (!selectionLambda(track1, posZ, posY, posX)) + continue; // Reject if called for Lambda but V0 is not lambda + + resoMass = track1.mLambda(); + } + + if (system == SameEvent) { + histos.fill(HIST("Trig_histReso"), fSampleIndex, posZ, track1.pt(), resoMass, eventWeight * triggerWeight); + } + + for (auto const& track2 : tracks2) { + + if (!trackSelected(track2)) + continue; + if (track2.pt() < cfgCutPtMin || track2.pt() > cfgCutPtMax) // Select associated particles in the pt range 0.2 - 3.0 GeV/c + continue; + if (mEfficiency) { + associatedWeight = efficiencyAssociatedCache[track2.filteredIndex()]; + } + + if (cfgUsePtOrder && system == SameEvent && track1.pt() <= track2.pt()) + continue; // Without pt-differential correlations, skip if the trigger pt is less than the associate pt + if (cfgUsePtOrder && system == MixedEvent && cfgUsePtOrderInMixEvent && track1.pt() <= track2.pt()) + continue; // For pt-differential correlations in mixed events, skip if the trigger pt is less than the associate pt + + float deltaPhi = RecoDecay::constrainAngle(track1.phi() - track2.phi(), -PIHalf); + float deltaEta = track1.eta() - track2.eta(); + + if (std::abs(deltaEta) < cfgCutMerging) { + + double dPhiStarHigh = getDPhiStar(0, track2.sign(), track1.phi(), track2.phi(), track1.pt(), track2.pt(), cfgRadiusHigh, magneticField); + double dPhiStarLow = getDPhiStar(0, track2.sign(), track1.phi(), track2.phi(), track1.pt(), track2.pt(), cfgRadiusLow, magneticField); + + const double kLimit = 3.0 * cfgCutMerging; + + bool bIsBelow = false; + + if (std::abs(dPhiStarLow) < kLimit || std::abs(dPhiStarHigh) < kLimit || dPhiStarLow * dPhiStarHigh < 0) { + for (double rad(cfgRadiusLow); rad < cfgRadiusHigh; rad += 0.01) { + double dPhiStar = getDPhiStar(0, track2.sign(), track1.phi(), track2.phi(), track1.pt(), track2.pt(), rad, magneticField); + if (std::abs(dPhiStar) < kLimit) { + bIsBelow = true; + break; + } + } + if (bIsBelow) + continue; + } + } + + // fill the right sparse and histograms + if (system == SameEvent) { + sameReso->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), resoMass, deltaPhi, deltaEta, eventWeight * triggerWeight * associatedWeight); + histos.fill(HIST("deltaEta_deltaPhi_same"), deltaPhi, deltaEta, eventWeight * triggerWeight * associatedWeight); + } else if (system == MixedEvent) { + mixedReso->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), resoMass, deltaPhi, deltaEta, eventWeight * triggerWeight * associatedWeight); + histos.fill(HIST("deltaEta_deltaPhi_mixed"), deltaPhi, deltaEta, eventWeight * triggerWeight * associatedWeight); } } } } template - bool eventSelected(TCollision collision, const int multTrk, const float centrality, const bool fillCounter) + bool selectionEvent(TCollision collision, const int mult, const float cent, const bool fillCounter) { - registry.fill(HIST("hEventCount"), 0.5); - if (cfgEvSelkNoSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - // rejects collisions which are associated with the same "found-by-T0" bunch crossing - // https://indico.cern.ch/event/1396220/#1-event-selection-with-its-rof + if (fillCounter) + histos.fill(HIST("hEventCount"), kFilteredEvents); + if (!collision.sel8()) { return 0; } - if (fillCounter && cfgEvSelkNoSameBunchPileup) - registry.fill(HIST("hEventCount"), 1.5); - if (cfgEvSelkNoITSROFrameBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + if (fillCounter) + histos.fill(HIST("hEventCount"), kAfterSel8); + + if (eventCuts[kEvCut1][kUseNoTimeFrameBorder] && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { return 0; } - if (fillCounter && cfgEvSelkNoITSROFrameBorder) - registry.fill(HIST("hEventCount"), 2.5); - if (cfgEvSelkNoTimeFrameBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + if (fillCounter && eventCuts[kEvCut1][kUseNoTimeFrameBorder]) + histos.fill(HIST("hEventCount"), kUseNoTimeFrameBorder); + + if (eventCuts[kEvCut1][kUseNoITSROFrameBorder] && !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + return 0; + } + if (fillCounter && eventCuts[kEvCut1][kUseNoITSROFrameBorder]) + histos.fill(HIST("hEventCount"), kUseNoITSROFrameBorder); + + if (eventCuts[kEvCut1][kUseNoSameBunchPileup] && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { + // rejects collisions which are associated with the same "found-by-T0" bunch crossing + // https://indico.cern.ch/event/1396220/#1-event-selection-with-its-rof return 0; } - if (fillCounter && cfgEvSelkNoTimeFrameBorder) - registry.fill(HIST("hEventCount"), 3.5); - if (cfgEvSelkIsGoodZvtxFT0vsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + if (fillCounter && eventCuts[kEvCut1][kUseNoSameBunchPileup]) + histos.fill(HIST("hEventCount"), kUseNoSameBunchPileup); + + if (eventCuts[kEvCut1][kUseGoodZvtxFT0vsPV] && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { // removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference // use this cut at low multiplicities with caution return 0; } - if (fillCounter && cfgEvSelkIsGoodZvtxFT0vsPV) - registry.fill(HIST("hEventCount"), 4.5); - if (cfgEvSelkNoCollInTimeRangeStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + if (fillCounter && eventCuts[kEvCut1][kUseGoodZvtxFT0vsPV]) + histos.fill(HIST("hEventCount"), kUseGoodZvtxFT0vsPV); + + if (eventCuts[kEvCut1][kUseNoCollInTimeRangeStandard] && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { // no collisions in specified time range return 0; } - if (fillCounter && cfgEvSelkNoCollInTimeRangeStandard) - registry.fill(HIST("hEventCount"), 5.5); - if (cfgEvSelkIsGoodITSLayersAll && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + if (fillCounter && eventCuts[kEvCut1][kUseNoCollInTimeRangeStandard]) + histos.fill(HIST("hEventCount"), kUseNoCollInTimeRangeStandard); + + if (eventCuts[kEvCut1][kUseGoodITSLayersAll] && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { // from Jan 9 2025 AOT meeting // cut time intervals with dead ITS staves return 0; } - if (fillCounter && cfgEvSelkIsGoodITSLayersAll) - registry.fill(HIST("hEventCount"), 6.5); - if (cfgEvSelkNoCollInRofStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { + if (fillCounter && eventCuts[kEvCut1][kUseGoodITSLayersAll]) + histos.fill(HIST("hEventCount"), kUseGoodITSLayersAll); + + if (eventCuts[kEvCut1][kUseNoCollInRofStandard] && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { // no other collisions in this Readout Frame with per-collision multiplicity above threshold return 0; } - if (fillCounter && cfgEvSelkNoCollInRofStandard) - registry.fill(HIST("hEventCount"), 7.5); - if (cfgEvSelkNoHighMultCollInPrevRof && !collision.selection_bit(o2::aod::evsel::kNoHighMultCollInPrevRof)) { + if (fillCounter && eventCuts[kEvCut1][kUseNoCollInRofStandard]) + histos.fill(HIST("hEventCount"), kUseNoCollInRofStandard); + + if (eventCuts[kEvCut1][kUseNoHighMultCollInPrevRof] && !collision.selection_bit(o2::aod::evsel::kNoHighMultCollInPrevRof)) { // veto an event if FT0C amplitude in previous ITS ROF is above threshold return 0; } - if (fillCounter && cfgEvSelkNoHighMultCollInPrevRof) - registry.fill(HIST("hEventCount"), 8.5); + if (fillCounter && eventCuts[kEvCut1][kUseNoHighMultCollInPrevRof]) + histos.fill(HIST("hEventCount"), kUseNoHighMultCollInPrevRof); + + auto multNTracksPV = collision.multNTracksPV(); auto occupancy = collision.trackOccupancyInTimeRange(); - if (cfgEvSelOccupancy && (occupancy < cfgCutOccupancyLow || occupancy > cfgCutOccupancyHigh)) + + if (eventCuts[kEvCut1][kUseOccupancy] && (occupancy < cfgCutOccupancyMin || occupancy > cfgCutOccupancyMax)) { return 0; - if (fillCounter && cfgEvSelOccupancy) - registry.fill(HIST("hEventCount"), 9.5); + } + if (fillCounter && eventCuts[kEvCut1][kUseOccupancy]) + histos.fill(HIST("hEventCount"), kUseOccupancy); - auto multNTracksPV = collision.multNTracksPV(); - if (cfgEvSelMultCorrelation) { - if (multNTracksPV < fMultPVCutLow->Eval(centrality)) + if (eventCuts[kEvCut1][kUseMultCorrCut]) { + if (multNTracksPV < fMultPVCutLow->Eval(cent)) return 0; - if (multNTracksPV > fMultPVCutHigh->Eval(centrality)) + if (multNTracksPV > fMultPVCutHigh->Eval(cent)) return 0; - if (multTrk < fMultCutLow->Eval(centrality)) + if (mult < fMultCutLow->Eval(cent)) return 0; - if (multTrk > fMultCutHigh->Eval(centrality)) + if (mult > fMultCutHigh->Eval(cent)) return 0; } - if (fillCounter && cfgEvSelMultCorrelation) - registry.fill(HIST("hEventCount"), 10.5); + + if (fillCounter && eventCuts[kEvCut1][kUseMultCorrCut]) + histos.fill(HIST("hEventCount"), kUseMultCorrCut); // V0A T0A 5 sigma cut - float sigma = 5.0; - if (cfgEvSelV0AT0ACut && (std::fabs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > sigma * fT0AV0ASigma->Eval(collision.multFT0A()))) + if (eventCuts[kEvCut1][kUseT0AV0ACut] && (std::fabs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > cfgV0AT0Acut * fT0AV0ASigma->Eval(collision.multFT0A()))) + return 0; + if (fillCounter && eventCuts[kEvCut1][kUseT0AV0ACut]) + histos.fill(HIST("hEventCount"), kUseT0AV0ACut); + + if (eventCuts[kEvCut1][kUseVertexITSTPC] && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) return 0; - if (fillCounter && cfgEvSelV0AT0ACut) - registry.fill(HIST("hEventCount"), 11.5); + if (fillCounter && eventCuts[kEvCut1][kUseVertexITSTPC]) + histos.fill(HIST("hEventCount"), kUseVertexITSTPC); + + if (eventCuts[kEvCut1][kUseTVXinTRD] && collision.alias_bit(kTVXinTRD)) { + return 0; + } + if (fillCounter && eventCuts[kEvCut1][kUseTVXinTRD]) + histos.fill(HIST("hEventCount"), kUseTVXinTRD); return 1; } void processSame(FilteredCollisions::iterator const& collision, FilteredTracks const& tracks, aod::BCsWithTimestamps const&) { - if (!collision.sel8()) - return; auto bc = collision.bc_as(); float cent = -1.; if (!cfgCentTableUnavailable) cent = getCentrality(collision); - if (cfgUseAdditionalEventCut && !eventSelected(collision, tracks.size(), cent, true)) + if (cfgUseAdditionalEventCut && !selectionEvent(collision, tracks.size(), cent, true)) return; if (!cfgCentTableUnavailable) - registry.fill(HIST("Centrality"), cent); - registry.fill(HIST("Nch"), tracks.size()); - registry.fill(HIST("zVtx"), collision.posZ()); + histos.fill(HIST("Centrality"), cent); + histos.fill(HIST("Nch"), tracks.size()); + histos.fill(HIST("zVtx"), collision.posZ()); if (cfgSelCollByNch && (tracks.size() < cfgCutMultMin || tracks.size() >= cfgCutMultMax)) { return; @@ -594,7 +1005,7 @@ struct PidDiHadron { } loadEfficiency(bc.timestamp()); - registry.fill(HIST("eventcount"), SameEvent); // because its same event i put it in the 1 bin + histos.fill(HIST("eventcount"), SameEvent); // because its same event i put it in the 1 bin fillYield(collision, tracks); same->fillEvent(tracks.size(), CorrelationContainer::kCFStepReconstructed); @@ -635,9 +1046,9 @@ struct PidDiHadron { cent1 = getCentrality(collision1); cent2 = getCentrality(collision2); } - if (cfgUseAdditionalEventCut && !eventSelected(collision1, tracks1.size(), cent1, false)) + if (cfgUseAdditionalEventCut && !selectionEvent(collision1, tracks1.size(), cent1, false)) continue; - if (cfgUseAdditionalEventCut && !eventSelected(collision2, tracks2.size(), cent2, false)) + if (cfgUseAdditionalEventCut && !selectionEvent(collision2, tracks2.size(), cent2, false)) continue; if (!cfgSelCollByNch && !cfgCentTableUnavailable && (cent1 < cfgCutCentMin || cent1 >= cfgCutCentMax)) @@ -646,7 +1057,7 @@ struct PidDiHadron { if (!cfgSelCollByNch && !cfgCentTableUnavailable && (cent2 < cfgCutCentMin || cent2 >= cfgCutCentMax)) continue; - registry.fill(HIST("eventcount"), MixedEvent); // fill the mixed event in the 3 bin + histos.fill(HIST("eventcount"), MixedEvent); // fill the mixed event in the 3 bin auto bc = collision1.bc_as(); loadEfficiency(bc.timestamp()); float eventWeight = 1.0f; @@ -659,55 +1070,230 @@ struct PidDiHadron { } PROCESS_SWITCH(PidDiHadron, processMixed, "Process mixed events", true); - template - int getNsigmaPID(TTrack track) + template + bool selectionK0(V0 const& candidate, float posZ, float posY, float posX) { - // Computing Nsigma arrays for pion, kaon, and protons - std::array nSigmaTPC = {track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()}; - std::array nSigmaTOF = {track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr()}; - std::array nSigmaITS = {itsResponse.nSigmaITS(track), itsResponse.nSigmaITS(track), itsResponse.nSigmaITS(track)}; - int pid = -1; + double mk0 = candidate.mK0Short(); - std::array nSigmaToUse = cfgPIDUseITSPID ? nSigmaITS : nSigmaTPC; // Choose which nSigma to use: TPC or ITS - std::vector detectorNsigmaCut = cfgPIDUseITSPID ? itsNsigmaCut : tpcNsigmaCut; // Choose which nSigma to use: TPC or ITS + // separate the positive and negative V0 daughters + auto postrack = candidate.template posTrack_as(); + auto negtrack = candidate.template negTrack_as(); - bool isPion, isKaon, isProton; - bool isDetectedPion = nSigmaToUse[0] < detectorNsigmaCut[0] && nSigmaToUse[0] > detectorNsigmaCut[0 + 3]; - bool isDetectedKaon = nSigmaToUse[1] < detectorNsigmaCut[1] && nSigmaToUse[1] > detectorNsigmaCut[1 + 3]; - bool isDetectedProton = nSigmaToUse[2] < detectorNsigmaCut[2] && nSigmaToUse[2] > detectorNsigmaCut[2 + 3]; + histos.fill(HIST("hK0Count"), 0.5); + if (postrack.pt() < resoCutVals[K0][kPosTrackPt] || negtrack.pt() < resoCutVals[K0][kNegTrackPt]) + return false; + histos.fill(HIST("hK0Count"), 1.5); + if (mk0 < resoCutVals[K0][kMassMin] && mk0 > resoCutVals[K0][kMassMax]) + return false; + histos.fill(HIST("hK0Count"), 2.5); + // Rapidity correction + if (candidate.yK0Short() > resoCutVals[K0][kRapidity]) + return false; + histos.fill(HIST("hK0Count"), 3.5); + // DCA cuts for K0short + if (std::abs(candidate.dcapostopv()) < resoCutVals[K0][kDCAPosToPVMin] || std::abs(candidate.dcanegtopv()) < resoCutVals[K0][kDCANegToPVMin]) + return false; + histos.fill(HIST("hK0Count"), 4.5); + if (std::abs(candidate.dcaV0daughters()) > resoSwitchVals[K0][kDCABetDaug]) + return false; + histos.fill(HIST("hK0Count"), 5.5); + // v0 radius cuts + if (resoSwitchVals[K0][kUseV0Radius] && (candidate.v0radius() < resoCutVals[K0][kRadiusMin] || candidate.v0radius() > resoCutVals[K0][kRadiusMax])) + return false; + histos.fill(HIST("hK0Count"), 6.5); + // cosine pointing angle cuts + if (candidate.v0cosPA() < resoCutVals[K0][kCosPA]) + return false; + histos.fill(HIST("hK0Count"), 7.5); + // Proper lifetime + if (resoSwitchVals[K0][kUseProperLifetime] && candidate.distovertotmom(posX, posY, posZ) * massK0Short > resoCutVals[K0][kLifeTime]) + return false; + histos.fill(HIST("hK0Count"), 8.5); + if (!selectionV0Daughter(postrack, PIONS) || !selectionV0Daughter(negtrack, PIONS)) + return false; + histos.fill(HIST("hK0Count"), 9.5); - bool isTofPion = nSigmaTOF[0] < tofNsigmaCut[0] && nSigmaTOF[0] > tofNsigmaCut[0 + 3]; - bool isTofKaon = nSigmaTOF[1] < tofNsigmaCut[1] && nSigmaTOF[1] > tofNsigmaCut[1 + 3]; - bool isTofProton = nSigmaTOF[2] < tofNsigmaCut[2] && nSigmaTOF[2] > tofNsigmaCut[2 + 3]; + histos.fill(HIST("hK0Phi"), candidate.phi()); + histos.fill(HIST("hK0Eta"), candidate.eta()); + histos.fill(HIST("PiPlusTPC_K0"), postrack.pt(), postrack.tpcNSigmaPi()); + histos.fill(HIST("PiPlusTOF_K0"), postrack.pt(), postrack.tofNSigmaPi()); + histos.fill(HIST("PiMinusTPC_K0"), negtrack.pt(), negtrack.tpcNSigmaPi()); + histos.fill(HIST("PiMinusTOF_K0"), negtrack.pt(), negtrack.tofNSigmaPi()); - if (track.pt() > cfgPIDTofPtCut && !track.hasTOF()) { - return 0; - } else if (track.pt() > cfgPIDTofPtCut && track.hasTOF()) { - isPion = isTofPion && isDetectedPion; - isKaon = isTofKaon && isDetectedKaon; - isProton = isTofProton && isDetectedProton; - } else { - isPion = isDetectedPion; - isKaon = isDetectedKaon; - isProton = isDetectedProton; + return true; + } + + template + bool selectionLambda(V0 const& candidate, float posZ, float posY, float posX) + { + bool isL = false; // Is lambda candidate + bool isAL = false; // Is anti-lambda candidate + + double mlambda = candidate.mLambda(); + double mantilambda = candidate.mAntiLambda(); + + // separate the positive and negative V0 daughters + auto postrack = candidate.template posTrack_as(); + auto negtrack = candidate.template negTrack_as(); + + histos.fill(HIST("hLambdaCount"), 0.5); + if (postrack.pt() < resoCutVals[LAMBDA][kPosTrackPt] || negtrack.pt() < resoCutVals[LAMBDA][kNegTrackPt]) + return false; + + histos.fill(HIST("hLambdaCount"), 1.5); + if (mlambda > resoCutVals[LAMBDA][kMassMin] && mlambda < resoCutVals[LAMBDA][kMassMax]) + isL = true; + if (mantilambda > resoCutVals[LAMBDA][kMassMin] && mantilambda < resoCutVals[LAMBDA][kMassMax]) + isAL = true; + + if (!isL && !isAL) { + return false; } + histos.fill(HIST("hLambdaCount"), 2.5); - if ((isPion && isKaon) || (isPion && isProton) || (isKaon && isProton)) { - return 0; // more than one particle satisfy the criteria + // Rapidity correction + if (candidate.yLambda() > resoCutVals[LAMBDA][kRapidity]) + return false; + histos.fill(HIST("hLambdaCount"), 3.5); + // DCA cuts for lambda and antilambda + if (isL) { + if (std::abs(candidate.dcapostopv()) < resoCutVals[LAMBDA][kDCAPosToPVMin] || std::abs(candidate.dcanegtopv()) < resoCutVals[LAMBDA][kDCANegToPVMin]) + return false; + } + if (isAL) { + if (std::abs(candidate.dcapostopv()) < resoCutVals[LAMBDA][kDCANegToPVMin] || std::abs(candidate.dcanegtopv()) < resoCutVals[LAMBDA][kDCAPosToPVMin]) + return false; + } + histos.fill(HIST("hLambdaCount"), 4.5); + if (std::abs(candidate.dcaV0daughters()) > resoSwitchVals[LAMBDA][kDCABetDaug]) + return false; + histos.fill(HIST("hLambdaCount"), 5.5); + // v0 radius cuts + if (resoSwitchVals[LAMBDA][kUseV0Radius] && (candidate.v0radius() < resoCutVals[LAMBDA][kRadiusMin] || candidate.v0radius() > resoCutVals[LAMBDA][kRadiusMax])) + return false; + histos.fill(HIST("hLambdaCount"), 6.5); + // cosine pointing angle cuts + if (candidate.v0cosPA() < resoCutVals[LAMBDA][kCosPA]) + return false; + histos.fill(HIST("hLambdaCount"), 7.5); + // Proper lifetime + if (resoSwitchVals[LAMBDA][kUseProperLifetime] && candidate.distovertotmom(posX, posY, posZ) * massLambda > resoCutVals[LAMBDA][kLifeTime]) + return false; + histos.fill(HIST("hLambdaCount"), 8.5); + if (isL) { + if (!selectionV0Daughter(postrack, PROTONS) || !selectionV0Daughter(negtrack, PIONS)) + return false; } + if (isAL) { + if (!selectionV0Daughter(postrack, PIONS) || !selectionV0Daughter(negtrack, PROTONS)) + return false; + } + histos.fill(HIST("hLambdaCount"), 9.5); - if (isPion) { - pid = PIONS; - } else if (isKaon) { - pid = KAONS; - } else if (isProton) { - pid = PROTONS; - } else { - return 0; // no particle satisfies the criteria + if (isAL) { // Reject the track if it is antilambda + return false; + } + + if (isL) { + histos.fill(HIST("hLambdaPhi"), candidate.phi()); + histos.fill(HIST("hLambdaEta"), candidate.eta()); + histos.fill(HIST("PrPlusTPC_L"), postrack.pt(), postrack.tpcNSigmaPr()); + histos.fill(HIST("PrPlusTOF_L"), postrack.pt(), postrack.tofNSigmaPr()); + histos.fill(HIST("PiMinusTPC_L"), negtrack.pt(), negtrack.tpcNSigmaPi()); + histos.fill(HIST("PiMinusTOF_L"), negtrack.pt(), negtrack.tofNSigmaPi()); + } + + return true; + } + + double massKaPlus = o2::constants::physics::MassKPlus; + double massLambda = o2::constants::physics::MassLambda; + double massK0Short = o2::constants::physics::MassK0Short; + + void processSameReso(FilteredCollisions::iterator const& collision, FilteredTracks const& tracks, aod::BCsWithTimestamps const&, aod::V0Datas const& V0s) + { + auto bc = collision.bc_as(); + float cent = -1.; + if (!cfgCentTableUnavailable) + cent = getCentrality(collision); + if (cfgUseAdditionalEventCut && !selectionEvent(collision, tracks.size(), cent, true)) + return; + + if (!cfgCentTableUnavailable) + histos.fill(HIST("Centrality"), cent); + histos.fill(HIST("Nch"), tracks.size()); + histos.fill(HIST("zVtx"), collision.posZ()); + + if (cfgSelCollByNch && (tracks.size() < cfgCutMultMin || tracks.size() >= cfgCutMultMax)) { + return; + } + if (!cfgSelCollByNch && !cfgCentTableUnavailable && (cent < cfgCutCentMin || cent >= cfgCutCentMax)) { + return; } - return pid + 1; // shift the pid by 1, 1 = pion, 2 = kaon, 3 = proton + loadEfficiency(bc.timestamp()); + histos.fill(HIST("eventcount"), SameEvent); // because its same event i put it in the 1 bin + + sameReso->fillEvent(tracks.size(), CorrelationContainer::kCFStepReconstructed); + fillCorrelationsReso(V0s, tracks, collision.posZ(), collision.posY(), collision.posX(), SameEvent, getMagneticField(bc.timestamp()), cent, 1.0f); + } + PROCESS_SWITCH(PidDiHadron, processSameReso, "Process same event for resonances", true); + + void processMixedReso(FilteredCollisions const& collisions, FilteredTracks const& tracks, aod::BCsWithTimestamps const&, aod::V0Datas const& V0s) + { + auto getTracksSize = [&tracks, this](FilteredCollisions::iterator const& collision) { + auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), this->cache); + auto mult = associatedTracks.size(); + return mult; + }; + + using MixedBinning = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getTracksSize)>; + + MixedBinning binningOnVtxAndMult{{getTracksSize}, {axisVtxMix, axisMultMix}, true}; + + auto tracksTuple = std::make_tuple(V0s, tracks); + Pair pairs{binningOnVtxAndMult, cfgMixEventNumMin, -1, collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip + for (auto it = pairs.begin(); it != pairs.end(); it++) { + auto& [collision1, v0s1, collision2, tracks2] = *it; + if (!collision1.sel8() || !collision2.sel8()) + continue; + + auto tracks1 = tracks.sliceByCached(o2::aod::track::collisionId, collision1.globalIndex(), this->cache); + if (cfgSelCollByNch && (tracks1.size() < cfgCutMultMin || tracks1.size() >= cfgCutMultMax)) + continue; + + if (cfgSelCollByNch && (tracks2.size() < cfgCutMultMin || tracks2.size() >= cfgCutMultMax)) + continue; + + float cent1 = -1; + float cent2 = -1; + if (!cfgCentTableUnavailable) { + cent1 = getCentrality(collision1); + cent2 = getCentrality(collision2); + } + if (cfgUseAdditionalEventCut && !selectionEvent(collision1, tracks1.size(), cent1, false)) + continue; + if (cfgUseAdditionalEventCut && !selectionEvent(collision2, tracks2.size(), cent2, false)) + continue; + + if (!cfgSelCollByNch && !cfgCentTableUnavailable && (cent1 < cfgCutCentMin || cent1 >= cfgCutCentMax)) + continue; + + if (!cfgSelCollByNch && !cfgCentTableUnavailable && (cent2 < cfgCutCentMin || cent2 >= cfgCutCentMax)) + continue; + + histos.fill(HIST("eventcount"), MixedEvent); // fill the mixed event in the 3 bin + auto bc = collision1.bc_as(); + loadEfficiency(bc.timestamp()); + float eventWeight = 1.0f; + if (cfgUseEventWeights) { + eventWeight = 1.0f / it.currentWindowNeighbours(); + } + + fillCorrelationsReso(v0s1, tracks2, collision1.posZ(), collision1.posY(), collision1.posX(), MixedEvent, getMagneticField(bc.timestamp()), cent1, eventWeight); + } } + PROCESS_SWITCH(PidDiHadron, processMixedReso, "Process mixed events", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From c4cea03aa908a7b815e36d70df30782602eccf30 Mon Sep 17 00:00:00 2001 From: altsybee Date: Sun, 19 Oct 2025 21:48:39 +0200 Subject: [PATCH 815/986] [DPG] Update lightIonsEvSelQa.cxx (#13447) --- DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx | 146 +++++++++++++++++++++++- 1 file changed, 142 insertions(+), 4 deletions(-) diff --git a/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx b/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx index a98bf5b1300..fc447f86935 100644 --- a/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx +++ b/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx @@ -56,7 +56,7 @@ struct LightIonsEvSelQa { Configurable nBinsTracks{"nBinsTracks", 450, "N bins in n tracks histo"}; // o2-linter: disable=name/configurable (temporary fix) Configurable nMaxTracks{"nMaxTracks", 450, "N max in n tracks histo"}; // o2-linter: disable=name/configurable (temporary fix) Configurable nMaxGlobalTracks{"nMaxGlobalTracks", 450, "N max in n tracks histo"}; // o2-linter: disable=name/configurable (temporary fix) - Configurable nBinsMultFwd{"nBinsMultFwd", 1000, "N bins in mult fwd histo"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable nBinsMultFwd{"nBinsMultFwd", 800, "N bins in mult fwd histo"}; // o2-linter: disable=name/configurable (temporary fix) Configurable nMaxMultFwd{"nMaxMultFwd", 100000, "N max in mult fwd histo"}; // o2-linter: disable=name/configurable (temporary fix) Configurable timeBinWidthInSec{"TimeBinWidthInSec", 10, "Width of time bins in seconds"}; // o2-linter: disable=name/configurable (temporary fix) @@ -65,6 +65,8 @@ struct LightIonsEvSelQa { Configurable confUseDiffVzCutFromEvSel{"UseDiffVzCutFromEvSel", 0, "0 - custom diffVz cut from this task, 1 - cut from event selection"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable isMC{"isMC", false, "Run MC"}; + uint64_t minGlobalBC = 0; Service ccdb; HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -137,12 +139,16 @@ struct LightIonsEvSelQa { const AxisSpec axisVtxZ{800, -20., 20., ""}; const AxisSpec axisBcDiff{600, -300., 300., "bc difference"}; - const AxisSpec axisNcontrib{801, -0.5, 800.5, "n contributors"}; + const AxisSpec axisNcontrib{601, -0.5, 600.5, "n contributors"}; const AxisSpec axisColTimeRes{1500, 0., 1500., "collision time resolution (ns)"}; AxisSpec axisVertexChi2{100, 0, 500, "Chi2 of vertex fit"}; AxisSpec axisVertexChi2perContrib{100, 0, 10, "Chi2 of vertex fit"}; + const AxisSpec axisTimeDiff{100, -10., 10., ""}; + const AxisSpec axisTimeSum{100, -10., 10., ""}; + const AxisSpec axisZNampl{200, 0, 3000, ""}; + histos.add("noSpecSelections/hBcColNoSel8", "", kTH1F, {axisBCs}); histos.add("noSpecSelections/hBcOrigNoSel8", "", kTH1F, {axisBCs}); // histos.add("noSpecSelections/hBcColNoSel8TOF", "", kTH1F, {axisBCs}); @@ -165,6 +171,7 @@ struct LightIonsEvSelQa { histos.add("noSpecSelections/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); histos.add("noSpecSelections/hVertexChi2VsNcontrib", "", kTH2F, {axisNcontrib, axisVertexChi2perContrib}); histos.add("noSpecSelections/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); + histos.add("noSpecSelections/hTimeZAC", "ZNC-ZNA time (ns); ZNC+ZNA time (ns)", kTH2F, {axisTimeDiff, axisTimeSum}); histos.add("noPU/hBcColNoSel8", "", kTH1F, {axisBCs}); histos.add("noPU/hBcOrigNoSel8", "", kTH1F, {axisBCs}); @@ -187,6 +194,8 @@ struct LightIonsEvSelQa { histos.add("noPU/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); histos.add("noPU/hVertexChi2VsNcontrib", "", kTH2F, {axisNcontrib, axisVertexChi2perContrib}); histos.add("noPU/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); + histos.add("noPU/hTimeZAC", "ZNC-ZNA time (ns); ZNC+ZNA time (ns)", kTH2F, {axisTimeDiff, axisTimeSum}); + histos.add("noPU/hAmplZAC", "ZNC vs ZNA", kTH2F, {axisZNampl, axisZNampl}); histos.add("noPU_pvTOFmatched/hBcColNoSel8", "", kTH1F, {axisBCs}); histos.add("noPU_pvTOFmatched/hBcTVX", "", kTH1F, {axisBCs}); @@ -394,6 +403,7 @@ struct LightIonsEvSelQa { histos.add("noPU_lowMultCut/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); histos.add("noPU_lowMultCut/hVertexChi2VsNcontrib", "", kTH2F, {axisNcontrib, axisVertexChi2perContrib}); histos.add("noPU_lowMultCut/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); + histos.add("noPU_lowMultCut/hTimeZAC", "ZNC-ZNA time (ns); ZNC+ZNA time (ns)", kTH2F, {axisTimeDiff, axisTimeSum}); histos.add("highMultCloudCut/hBcColNoSel8", "", kTH1F, {axisBCs}); histos.add("highMultCloudCut/hBcOrigNoSel8", "", kTH1F, {axisBCs}); @@ -420,6 +430,7 @@ struct LightIonsEvSelQa { histos.add("noPU_highMultCloudCut/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); histos.add("noPU_highMultCloudCut/hVertexChi2VsNcontrib", "", kTH2F, {axisNcontrib, axisVertexChi2perContrib}); histos.add("noPU_highMultCloudCut/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); + histos.add("noPU_highMultCloudCut/hTimeZAC", "ZNC-ZNA time (ns); ZNC+ZNA time (ns)", kTH2F, {axisTimeDiff, axisTimeSum}); histos.add("noPU_badVzDiff/hBcColNoSel8", "", kTH1F, {axisBCs}); histos.add("noPU_badVzDiff/hBcTVX", "", kTH1F, {axisBCs}); @@ -559,6 +570,7 @@ struct LightIonsEvSelQa { histos.add("noPU_cutByVzDiff_pvTOF/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); histos.add("noPU_cutByVzDiff_pvTOF/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); histos.add("noPU_cutByVzDiff_pvTOF/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); + histos.add("noPU_cutByVzDiff_pvTOF/hTimeZAC", "ZNC-ZNA time (ns); ZNC+ZNA time (ns)", kTH2F, {axisTimeDiff, axisTimeSum}); histos.add("noPU_cutByVzDiff_noFT0activityNearby/hBcColNoSel8", "", kTH1F, {axisBCs}); histos.add("noPU_cutByVzDiff_noFT0activityNearby/hBcTVX", "", kTH1F, {axisBCs}); @@ -579,8 +591,46 @@ struct LightIonsEvSelQa { histos.add("noPU_cutByVzDiff_noFT0activityNearby/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); histos.add("noPU_cutByVzDiff_noFT0activityNearby/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); + histos.add("noPU_CutOnZNACtime/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noPU_CutOnZNACtime/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPU_CutOnZNACtime/hBcOrig", "", kTH1F, {axisBCs}); + histos.add("noPU_CutOnZNACtime/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noPU_CutOnZNACtime/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("noPU_CutOnZNACtime/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noPU_CutOnZNACtime/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noPU_CutOnZNACtime/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noPU_CutOnZNACtime/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPU_CutOnZNACtime/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noPU_CutOnZNACtime/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("noPU_CutOnZNACtime/hTVXvsBcDiffwrtOrigBc", "", kTH1F, {axisBcDiff}); + histos.add("noPU_CutOnZNACtime/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noPU_CutOnZNACtime/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("noPU_CutOnZNACtime/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); + histos.add("noPU_CutOnZNACtime/hTimeZAC", "ZNC-ZNA time (ns); ZNC+ZNA time (ns)", kTH2F, {axisTimeDiff, axisTimeSum}); + histos.add("noPU_CutOnZNACtime/hAmplZAC", "ZNC vs ZNA", kTH2F, {axisZNampl, axisZNampl}); + + histos.add("noPU_AntiCutOnZNACtime/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("noPU_AntiCutOnZNACtime/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPU_AntiCutOnZNACtime/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noPU_AntiCutOnZNACtime/hAmplZAC", "ZNC vs ZNA", kTH2F, {axisZNampl, axisZNampl}); + + histos.add("noPU_AntiCutOnZNAampl/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("noPU_AntiCutOnZNAampl/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noPU_AntiCutOnZNAampl/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPU_AntiCutOnZNAampl/hAmplZAC", "ZNC vs ZNA", kTH2F, {axisZNampl, axisZNampl}); + + // histos.add("hNcontribColFromData", "", kTH1F, {axisNcontrib}); histos.add("hNcontribAccFromData", "", kTH1F, {axisNcontrib}); + + // MC QA + const AxisSpec axisVtxZdiff{400, -10., 10., ""}; + histos.add("MC/hMCdataVzDiff", "", kTH2F, {axisNcontrib, axisVtxZdiff}); + histos.add("MC/hMCdataBcDiffVsMult", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("MC/hMCdataFoundBcDiffVsMult", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("MCsel8/hMCdataVzDiff", "", kTH2F, {axisNcontrib, axisVtxZdiff}); + histos.add("MCsel8/hMCdataBcDiffVsMult", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("MCsel8/hMCdataFoundBcDiffVsMult", "", kTH2F, {axisNcontrib, axisBcDiff}); } Preslice perCollision = aod::track::collisionId; @@ -604,6 +654,7 @@ struct LightIonsEvSelQa { ColEvSels const& cols, FullTracksIU const& tracks, BCsRun3 const& bcs, + aod::Zdcs const&, aod::FT0s const&) { int runNumber = bcs.iteratorAt(0).runNumber(); @@ -904,6 +955,17 @@ struct LightIonsEvSelQa { histos.fill(HIST("multT0M_vs_multSumFT0"), multT0M, multT0M_uncorr); } + float timeZNA = foundBC.has_zdc() ? foundBC.zdc().timeZNA() : -999.f; + float timeZNC = foundBC.has_zdc() ? foundBC.zdc().timeZNC() : -999.f; + float znSum = timeZNA + timeZNC; + float znDiff = timeZNA - timeZNC; + // bool goodZNACtime = fabs(znSum) < 2 && fabs(znDiff) < 2; + bool goodZNACtime = (timeZNA > -6 && timeZNA < 4) && (timeZNC > -6 && timeZNC < 4); + + float multZNA = foundBC.has_zdc() ? foundBC.zdc().energyCommonZNA() : -999; + float multZNC = foundBC.has_zdc() ? foundBC.zdc().energyCommonZNC() : -999; + bool cutZNACampl = multZNA < 400 && multZNC < 400; + // vZ diff (FT0 vs by tracks) bool badVzDiff = 0; if (confUseDiffVzCutFromEvSel) @@ -968,11 +1030,14 @@ struct LightIonsEvSelQa { histos.fill(HIST("noSpecSelections/hBcColNoSel8"), localBC); histos.fill(HIST("noSpecSelections/hBcOrigNoSel8"), bcOriginal); histos.fill(HIST("noSpecSelections/Vz"), vZ); + histos.fill(HIST("noSpecSelections/hTimeZAC"), znDiff, znSum); if (noPU) { histos.fill(HIST("noPU/hBcColNoSel8"), localBC); histos.fill(HIST("noPU/hBcOrigNoSel8"), bcOriginal); histos.fill(HIST("noPU/Vz"), vZ); + histos.fill(HIST("noPU/hTimeZAC"), znDiff, znSum); + histos.fill(HIST("noPU/hAmplZAC"), multZNA, multZNC); } if (noPU && pvTOFmatched) { histos.fill(HIST("noPU_pvTOFmatched/hBcColNoSel8"), localBC); @@ -1028,6 +1093,7 @@ struct LightIonsEvSelQa { if (noPU && underLine) { histos.fill(HIST("noPU_lowMultCut/hBcColNoSel8"), localBC); histos.fill(HIST("noPU_lowMultCut/hBcOrigNoSel8"), bcOriginal); + histos.fill(HIST("noPU_lowMultCut/hTimeZAC"), znDiff, znSum); } if (grassOnTheRight) { histos.fill(HIST("highMultCloudCut/hBcColNoSel8"), localBC); @@ -1036,9 +1102,11 @@ struct LightIonsEvSelQa { if (noPU && grassOnTheRight) { histos.fill(HIST("noPU_highMultCloudCut/hBcColNoSel8"), localBC); histos.fill(HIST("noPU_highMultCloudCut/hBcOrigNoSel8"), bcOriginal); + histos.fill(HIST("noPU_highMultCloudCut/hTimeZAC"), znDiff, znSum); } if (noPU && !badVzDiff && pvTOFmatched) { // noPileup_cutByVzDiff_pvTOF_noFT0act histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hBcColNoSel8"), localBC); + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hTimeZAC"), znDiff, znSum); } // only here cut on sel8: @@ -1224,6 +1292,14 @@ struct LightIonsEvSelQa { histos.fill(HIST("noPU_cutByVzDiff_noFT0activityNearby/hColTimeResVsNcontrib"), nContributors, timeRes); histos.fill(HIST("noPU_cutByVzDiff_noFT0activityNearby/hNPVvsNch"), nPVtracks, nGlobalTracksAll); } + if (noPU && goodZNACtime) { + histos.fill(HIST("noPU_CutOnZNACtime/hBcTVX"), localBC); + histos.fill(HIST("noPU_CutOnZNACtime/hBcOrig"), bcOriginal); + histos.fill(HIST("noPU_CutOnZNACtime/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noPU_CutOnZNACtime/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("noPU_CutOnZNACtime/hNPVvsNch"), nPVtracks, nGlobalTracksAll); + histos.fill(HIST("noPU_CutOnZNACtime/hTimeZAC"), znDiff, znSum); + } if (foundBC.has_ft0()) { // float multT0A = foundBC.has_ft0() ? foundBC.ft0().sumAmpA() : -999.f; @@ -1417,6 +1493,14 @@ struct LightIonsEvSelQa { histos.fill(HIST("noPU_cutByVzDiff_noFT0activityNearby/nTracksPV_vs_T0C"), multT0C, nPVtracks); // histos.fill(HIST("noPU_cutByVzDiff_noFT0activityNearby/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracksPV); } + if (noPU && goodZNACtime) { + histos.fill(HIST("noPU_CutOnZNACtime/hBcFT0"), localBC); + histos.fill(HIST("noPU_CutOnZNACtime/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noPU_CutOnZNACtime/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noPU_CutOnZNACtime/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("noPU_CutOnZNACtime/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("noPU_CutOnZNACtime/hAmplZAC"), multZNA, multZNC); + } } if (foundBC.has_fv0a()) { @@ -1534,6 +1618,23 @@ struct LightIonsEvSelQa { histos.fill(HIST("noPU_cutByVzDiff_noFT0activityNearby/nTracksPV_vs_V0A"), multV0A, nPVtracks); // histos.fill(HIST("noPU_cutByVzDiff_noFT0activityNearby/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracksPV); } + + if (noPU && goodZNACtime) { + histos.fill(HIST("noPU_CutOnZNACtime/hBcFV0"), localBC); + histos.fill(HIST("noPU_CutOnZNACtime/nTracksPV_vs_V0A"), multV0A, nPVtracks); + } + if (noPU && !goodZNACtime) { + histos.fill(HIST("noPU_AntiCutOnZNACtime/hBcFV0"), localBC); + histos.fill(HIST("noPU_AntiCutOnZNACtime/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("noPU_AntiCutOnZNACtime/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noPU_AntiCutOnZNACtime/hAmplZAC"), multZNA, multZNC); + } + if (noPU && !cutZNACampl) { + histos.fill(HIST("noPU_AntiCutOnZNAampl/hBcFV0"), localBC); + histos.fill(HIST("noPU_AntiCutOnZNAampl/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("noPU_AntiCutOnZNAampl/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noPU_AntiCutOnZNAampl/hAmplZAC"), multZNA, multZNC); + } } if (foundBC.has_zdc()) { histos.fill(HIST("noSpecSelections/hBcZDC"), localBC); @@ -1661,13 +1762,50 @@ struct LightIonsEvSelQa { if (noPU && !badVzDiff && noFT0activityNearby) { histos.fill(HIST("noPU_cutByVzDiff_noFT0activityNearby/hTVXvsBcDiffwrtOrigBc"), bcDiffWrtOriginal); } - + if (noPU && goodZNACtime) { + histos.fill(HIST("noPU_CutOnZNACtime/hTVXvsBcDiffwrtOrigBc"), bcDiffWrtOriginal); + } } // end of collisions loop } PROCESS_SWITCH(LightIonsEvSelQa, processRun3, "Process Run3 tracking vs detector occupancy QA", true); + + // ### MC QA + using ColEvSelsWithMCLabels = soa::Join; //, aod::CentFT0Cs>; + using BCsInfo = soa::Join; + + void processMC(ColEvSelsWithMCLabels const& collisions, + BCsInfo const&, + aod::McCollisions const&) + { + for (const auto& col : collisions) { + bool isSel8 = col.sel8(); + if (col.has_mcCollision()) { + const auto mcCollision = col.mcCollision(); + LOGP(debug, "col.posZ() = {}, mcCollision.posZ() = {}", col.posZ(), mcCollision.posZ()); + histos.fill(HIST("MC/hMCdataVzDiff"), col.numContrib(), col.posZ() - mcCollision.posZ()); + + auto bc = col.bc_as(); + auto mcBc = mcCollision.bc_as(); + auto foundBC = col.foundBC_as(); + + LOGP(debug, "col.bc().globalBC() = {}, mcCollision.bc().globalBC() = {}", col.bc().globalBC(), mcCollision.bc().globalBC()); + histos.fill(HIST("MC/hMCdataBcDiffVsMult"), col.numContrib(), bc.globalBC() - mcBc.globalBC()); + histos.fill(HIST("MC/hMCdataFoundBcDiffVsMult"), col.numContrib(), foundBC.globalBC() - mcBc.globalBC()); + + if (isSel8) { + histos.fill(HIST("MCsel8/hMCdataVzDiff"), col.numContrib(), col.posZ() - mcCollision.posZ()); + histos.fill(HIST("MCsel8/hMCdataBcDiffVsMult"), col.numContrib(), bc.globalBC() - mcBc.globalBC()); + histos.fill(HIST("MCsel8/hMCdataFoundBcDiffVsMult"), col.numContrib(), foundBC.globalBC() - mcBc.globalBC()); + } + } + } + } + + PROCESS_SWITCH(LightIonsEvSelQa, processMC, "Process MC", false); }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +WorkflowSpec + defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ adaptAnalysisTask(cfgc)}; From 04c3e0818f9a788811b9478a524162df0d613735 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sun, 19 Oct 2025 21:57:32 +0200 Subject: [PATCH 816/986] [PWGEM/Dilepton] fix trigger counters (#13451) --- PWGEM/Dilepton/Core/Dilepton.h | 6 ++-- PWGEM/Dilepton/Core/DileptonHadronMPC.h | 6 ++-- PWGEM/Dilepton/Core/PhotonHBT.h | 6 ++-- PWGEM/Dilepton/Core/SingleTrackQC.h | 6 ++-- PWGEM/Dilepton/DataModel/dileptonTables.h | 14 ++++++--- .../TableProducer/createEMEventDilepton.cxx | 30 ++++++++++++------- PWGEM/Dilepton/TableProducer/skimmerOTS.cxx | 29 ++++++++---------- 7 files changed, 59 insertions(+), 38 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 37e16c5ff25..4b8c4658b2d 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -1545,7 +1545,7 @@ struct Dilepton { PROCESS_SWITCH(Dilepton, processAnalysis, "run dilepton analysis", true); using FilteredMyCollisionsWithSWT = soa::Filtered; - void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, aod::EMSWTriggerInfos const& cefpinfos, aod::EMSWTriggerCounters const& counters, Types const&... args) + void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, aod::EMSWTriggerInfos const& cefpinfos, aod::EMSWTriggerATCounters const& countersAT, aod::EMSWTriggerTOICounters const& countersTOI, Types const&... args) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { auto electrons = std::get<0>(std::tie(args...)); @@ -1565,10 +1565,12 @@ struct Dilepton { // for nomalization int emswtId = o2::aod::pwgem::dilepton::swt::aliasLabels.at(cfg_swt_name.value); - for (const auto& counter : counters) { + for (const auto& counter : countersAT) { if (counter.isAnalyzed_bit(emswtId)) { fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 0); } + } + for (const auto& counter : countersTOI) { if (counter.isAnalyzedToI_bit(emswtId)) { fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 1); } diff --git a/PWGEM/Dilepton/Core/DileptonHadronMPC.h b/PWGEM/Dilepton/Core/DileptonHadronMPC.h index 2f44a679930..ef3b65e5230 100644 --- a/PWGEM/Dilepton/Core/DileptonHadronMPC.h +++ b/PWGEM/Dilepton/Core/DileptonHadronMPC.h @@ -1442,7 +1442,7 @@ struct DileptonHadronMPC { PROCESS_SWITCH(DileptonHadronMPC, processAnalysis, "run dilepton analysis", true); using FilteredMyCollisionsWithSWT = soa::Filtered; - void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, FilteredRefTracks const& refTracks, aod::EMSWTriggerInfos const& cefpinfos, aod::EMSWTriggerCounters const& counters, Types const&... args) + void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, FilteredRefTracks const& refTracks, aod::EMSWTriggerInfos const& cefpinfos, aod::EMSWTriggerATCounters const& countersAT, aod::EMSWTriggerTOICounters const& countersTOI, Types const&... args) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { auto electrons = std::get<0>(std::tie(args...)); @@ -1462,10 +1462,12 @@ struct DileptonHadronMPC { // for nomalization int emswtId = o2::aod::pwgem::dilepton::swt::aliasLabels.at(cfg_swt_name.value); - for (const auto& counter : counters) { + for (const auto& counter : countersAT) { if (counter.isAnalyzed_bit(emswtId)) { fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 0); } + } + for (const auto& counter : countersTOI) { if (counter.isAnalyzedToI_bit(emswtId)) { fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 1); } diff --git a/PWGEM/Dilepton/Core/PhotonHBT.h b/PWGEM/Dilepton/Core/PhotonHBT.h index fdb9755a299..46d5e1852ab 100644 --- a/PWGEM/Dilepton/Core/PhotonHBT.h +++ b/PWGEM/Dilepton/Core/PhotonHBT.h @@ -1459,7 +1459,7 @@ struct PhotonHBT { PROCESS_SWITCH(PhotonHBT, processAnalysis, "pairing for analysis", false); using FilteredMyCollisionsWithSWT = soa::Filtered; - void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, aod::EMSWTriggerInfos const& cefpinfos, aod::EMSWTriggerCounters const& counters, Types const&... args) + void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, aod::EMSWTriggerInfos const& cefpinfos, aod::EMSWTriggerATCounters const& countersAT, aod::EMSWTriggerTOICounters const& countersTOI, Types const&... args) { if constexpr (pairtype == ggHBTPairType::kPCMPCM) { auto v0photons = std::get<0>(std::tie(args...)); @@ -1484,10 +1484,12 @@ struct PhotonHBT { // for nomalization int emswtId = o2::aod::pwgem::dilepton::swt::aliasLabels.at(cfg_swt_name.value); - for (const auto& counter : counters) { + for (const auto& counter : countersAT) { if (counter.isAnalyzed_bit(emswtId)) { fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 0); } + } + for (const auto& counter : countersTOI) { if (counter.isAnalyzedToI_bit(emswtId)) { fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 1); } diff --git a/PWGEM/Dilepton/Core/SingleTrackQC.h b/PWGEM/Dilepton/Core/SingleTrackQC.h index 0b8e67435fc..6653e9b54e7 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQC.h @@ -829,7 +829,7 @@ struct SingleTrackQC { PROCESS_SWITCH(SingleTrackQC, processQC, "run single track QC", true); using FilteredMyCollisionsWithSWT = soa::Filtered; - void processQC_TriggeredData(FilteredMyCollisionsWithSWT const& collisions, aod::EMSWTriggerInfos const& cefpinfos, aod::EMSWTriggerCounters const& counters, Types const&... args) + void processQC_TriggeredData(FilteredMyCollisionsWithSWT const& collisions, aod::EMSWTriggerInfos const& cefpinfos, aod::EMSWTriggerATCounters const& countersAT, aod::EMSWTriggerTOICounters const& countersTOI, Types const&... args) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { auto electrons = std::get<0>(std::tie(args...)); @@ -848,10 +848,12 @@ struct SingleTrackQC { // for nomalization int emswtId = o2::aod::pwgem::dilepton::swt::aliasLabels.at(cfg_swt_name.value); - for (const auto& counter : counters) { + for (const auto& counter : countersAT) { if (counter.isAnalyzed_bit(emswtId)) { fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 0); } + } + for (const auto& counter : countersTOI) { if (counter.isAnalyzedToI_bit(emswtId)) { fRegistry.fill(HIST("NormTrigger/hTriggerCounter"), mRunNumber, 1); } diff --git a/PWGEM/Dilepton/DataModel/dileptonTables.h b/PWGEM/Dilepton/DataModel/dileptonTables.h index ce9a36977b3..a3bff9027b1 100644 --- a/PWGEM/Dilepton/DataModel/dileptonTables.h +++ b/PWGEM/Dilepton/DataModel/dileptonTables.h @@ -214,8 +214,11 @@ using EMSWTriggerBit = EMSWTriggerBits::iterator; DECLARE_SOA_TABLE(EMSWTriggerInfos, "AOD", "EMSWTINFO", bc::RunNumber, emevent::NInspectedTVX, emevent::NScalars, emevent::NSelections, o2::soa::Marker<1>); //! independent table. Don't join anything. using EMSWTriggerInfo = EMSWTriggerInfos::iterator; -DECLARE_SOA_TABLE(EMSWTriggerCounters, "AOD", "EMSWTCOUNTER", emevent::IsAnalyzed, emevent::IsAnalyzedToI, o2::soa::Marker<1>); //! independent table. Don't join anything. -using EMSWTriggerCounter = EMSWTriggerCounters::iterator; +DECLARE_SOA_TABLE(EMSWTriggerATCounters, "AOD", "EMSWTAT", emevent::IsAnalyzed, o2::soa::Marker<1>); //! independent table. Don't join anything. +using EMSWTriggerATCounter = EMSWTriggerATCounters::iterator; + +DECLARE_SOA_TABLE(EMSWTriggerTOICounters, "AOD", "EMSWTTOI", emevent::IsAnalyzedToI, o2::soa::Marker<1>); //! independent table. Don't join anything. +using EMSWTriggerTOICounter = EMSWTriggerTOICounters::iterator; DECLARE_SOA_TABLE(EMSWTriggerBitsTMP, "AOD", "EMSWTBITTMP", emevent::SWTAliasTmp, o2::soa::Marker<2>); //! joinable to aod::Collisions using EMSWTriggerBitTMP = EMSWTriggerBitsTMP::iterator; @@ -223,8 +226,11 @@ using EMSWTriggerBitTMP = EMSWTriggerBitsTMP::iterator; DECLARE_SOA_TABLE(EMSWTriggerInfosTMP, "AOD", "EMSWTINFOTMP", bc::RunNumber, emevent::NInspectedTVX, emevent::NScalars, emevent::NSelections, o2::soa::Marker<2>); using EMSWTriggerInfoTMP = EMSWTriggerInfosTMP::iterator; -DECLARE_SOA_TABLE(EMSWTriggerCountersTMP, "AOD", "EMSWTCOUNTERTMP", emevent::IsAnalyzed, emevent::IsAnalyzedToI, o2::soa::Marker<2>); //! independent table. Don't join anything. -using EMSWTriggerCounterTMP = EMSWTriggerCountersTMP::iterator; +DECLARE_SOA_TABLE(EMSWTriggerATCountersTMP, "AOD", "EMSWTATTMP", emevent::IsAnalyzed, o2::soa::Marker<2>); //! independent table. Don't join anything. +using EMSWTriggerATCounterTMP = EMSWTriggerATCountersTMP::iterator; + +DECLARE_SOA_TABLE(EMSWTriggerTOICountersTMP, "AOD", "EMSWTTOITMP", emevent::IsAnalyzedToI, o2::soa::Marker<2>); //! independent table. Don't join anything. +using EMSWTriggerTOICounterTMP = EMSWTriggerTOICountersTMP::iterator; DECLARE_SOA_TABLE(EMEventsProperty, "AOD", "EMEVENTPROP", //! joinable to EMEvents emevent::SpherocityPtWeighted, emevent::SpherocityPtUnWeighted, emevent::NtrackSpherocity); diff --git a/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx b/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx index 88de61009d3..f81e559c3dc 100644 --- a/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx +++ b/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx @@ -64,7 +64,8 @@ struct CreateEMEventDilepton { Produces event_qvec; Produces emswtbit; Produces emswtinfo; - Produces emswtcounter; + Produces emswtATcounter; + Produces emswtTOIcounter; Produces event_norm_info; enum class EMEventType : int { @@ -211,7 +212,7 @@ struct CreateEMEventDilepton { //---------- for data with swt ---------- - void processEvent_SWT(MyCollisionsWithSWT const& collisions, MyBCs const& bcs, aod::EMSWTriggerInfosTMP const& emswtinfostmp, aod::EMSWTriggerCountersTMP const& emswtcounterstmp) + void processEvent_SWT(MyCollisionsWithSWT const& collisions, MyBCs const& bcs, aod::EMSWTriggerInfosTMP const& emswtinfostmp, aod::EMSWTriggerATCountersTMP const& emswtATcounterstmp, aod::EMSWTriggerTOICountersTMP const& emswtTOIcounterstmp) { skimEvent(collisions, bcs); @@ -225,13 +226,16 @@ struct CreateEMEventDilepton { mRunNumber = info.runNumber(); } } - for (const auto& counter : emswtcounterstmp) { - emswtcounter(counter.isAnalyzed_raw(), counter.isAnalyzedToI_raw()); + for (const auto& counter : emswtATcounterstmp) { + emswtATcounter(counter.isAnalyzed_raw()); + } + for (const auto& counter : emswtTOIcounterstmp) { + emswtTOIcounter(counter.isAnalyzedToI_raw()); } } PROCESS_SWITCH(CreateEMEventDilepton, processEvent_SWT, "process event info", false); - void processEvent_SWT_Cent(MyCollisionsWithSWT_Cent const& collisions, MyBCs const& bcs, aod::EMSWTriggerInfosTMP const& emswtinfostmp, aod::EMSWTriggerCountersTMP const& emswtcounterstmp) + void processEvent_SWT_Cent(MyCollisionsWithSWT_Cent const& collisions, MyBCs const& bcs, aod::EMSWTriggerInfosTMP const& emswtinfostmp, aod::EMSWTriggerATCountersTMP const& emswtATcounterstmp, aod::EMSWTriggerTOICountersTMP const& emswtTOIcounterstmp) { skimEvent(collisions, bcs); @@ -245,13 +249,16 @@ struct CreateEMEventDilepton { mRunNumber = info.runNumber(); } } - for (const auto& counter : emswtcounterstmp) { - emswtcounter(counter.isAnalyzed_raw(), counter.isAnalyzedToI_raw()); + for (const auto& counter : emswtATcounterstmp) { + emswtATcounter(counter.isAnalyzed_raw()); + } + for (const auto& counter : emswtTOIcounterstmp) { + emswtTOIcounter(counter.isAnalyzedToI_raw()); } } PROCESS_SWITCH(CreateEMEventDilepton, processEvent_SWT_Cent, "process event info", false); - void processEvent_SWT_Cent_Qvec(MyCollisionsWithSWT_Cent_Qvec const& collisions, MyBCs const& bcs, aod::EMSWTriggerInfosTMP const& emswtinfostmp, aod::EMSWTriggerCountersTMP const& emswtcounterstmp) + void processEvent_SWT_Cent_Qvec(MyCollisionsWithSWT_Cent_Qvec const& collisions, MyBCs const& bcs, aod::EMSWTriggerInfosTMP const& emswtinfostmp, aod::EMSWTriggerATCountersTMP const& emswtATcounterstmp, aod::EMSWTriggerTOICountersTMP const& emswtTOIcounterstmp) { skimEvent(collisions, bcs); @@ -265,8 +272,11 @@ struct CreateEMEventDilepton { mRunNumber = info.runNumber(); } } - for (const auto& counter : emswtcounterstmp) { - emswtcounter(counter.isAnalyzed_raw(), counter.isAnalyzedToI_raw()); + for (const auto& counter : emswtATcounterstmp) { + emswtATcounter(counter.isAnalyzed_raw()); + } + for (const auto& counter : emswtTOIcounterstmp) { + emswtTOIcounter(counter.isAnalyzedToI_raw()); } } PROCESS_SWITCH(CreateEMEventDilepton, processEvent_SWT_Cent_Qvec, "process event info", false); diff --git a/PWGEM/Dilepton/TableProducer/skimmerOTS.cxx b/PWGEM/Dilepton/TableProducer/skimmerOTS.cxx index 37a3af0215b..194ed79c3dd 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerOTS.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerOTS.cxx @@ -36,11 +36,12 @@ using namespace o2::soa; struct skimmerOTS { Produces swtinfo_tmp; // Join aod::Collision later. Produces swtbit_tmp; - Produces swtcounter_tmp; + Produces swtcounterAT_tmp; + Produces swtcounterTOI_tmp; // CCDB options Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable cfg_swt_names{"cfg_swt_names", "fHighTrackMult,fHighFt0Mult", "comma-separated software trigger names"}; // !trigger names have to be pre-registered in dileptonTable.h for bit operation! + Configurable cfg_swt_names{"cfg_swt_names", "fLMeeIMR,fLMeeHMR", "comma-separated software trigger names"}; // !trigger names have to be pre-registered in dileptonTable.h for bit operation! o2::framework::Configurable ccdbPathSoftwareTrigger{"ccdbPathSoftwareTrigger", "EventFiltering/Zorro/", "ccdb path for ZORRO objects"}; Configurable bcMarginForSoftwareTrigger{"bcMarginForSoftwareTrigger", 100, "Number of BCs of margin for software triggers"}; @@ -56,6 +57,7 @@ struct skimmerOTS { std::vector mATCounters; HistogramRegistry registry{"registry"}; + void init(o2::framework::InitContext&) { ccdb->setURL(ccdburl); @@ -130,14 +132,13 @@ struct skimmerOTS { void process(aod::Collisions const& collisions, aod::BCsWithTimestamps const&) { - for (const auto& collision : collisions) { auto bc = collision.template bc_as(); // don't use foundBC. initCCDB(bc); uint16_t trigger_bitmap = 0; - uint16_t analyzed_bitmap = 0; - uint16_t analyzedToI_bitmap = 0; + // uint16_t analyzed_bitmap = 0; + // uint16_t analyzedToI_bitmap = 0; registry.fill(HIST("hCollisionCounter"), 1); // all if (zorro.isSelected(bc.globalBC(), bcMarginForSoftwareTrigger)) { // triggered event @@ -154,15 +155,16 @@ struct skimmerOTS { // LOGF(info, "swtname = %s is fired. swt index in original swt table = %d, swt index for EM table = %d", swtname.data(), mTOIidx[idx], o2::aod::pwgem::dilepton::swt::aliasLabels.at(swtname)); registry.fill(HIST("hCollisionCounter"), idx + 2); // fired trigger - if (ATcounters[mTOIidx[idx]] > mATCounters[emswtId]) { - analyzed_bitmap |= BIT(emswtId); + // LOGF(info, "ATcounters[mTOIidx[idx]] = %d, TOIcounters[idx] = %d", ATcounters[mTOIidx[idx]], TOIcounters[idx]); + + while (ATcounters[mTOIidx[idx]] > mATCounters[emswtId]) { mATCounters[emswtId]++; - // mATCounters[emswtId] = ATcounters[mTOIidx[idx]]; // Dont' use this line. NOT always incremented by 1 in zorro!! + swtcounterAT_tmp(BIT(emswtId)); } - if (TOIcounters[idx] > mTOICounters[emswtId]) { - analyzedToI_bitmap |= BIT(emswtId); - mTOICounters[emswtId] = TOIcounters[idx]; // always incremented by 1 in zorro!! + while (TOIcounters[idx] > mTOICounters[emswtId]) { + mTOICounters[emswtId]++; // always incremented by 1 in zorro!! + swtcounterTOI_tmp(BIT(emswtId)); } // LOGF(info, "collision.globalIndex() = %d, bc.globalBC() = %llu, mTOICounters[%d] = %d, mATcounters[%d] = %d", collision.globalIndex(), bc.globalBC(), emswtId, mTOICounters[emswtId], emswtId, mATCounters[emswtId]); @@ -170,12 +172,7 @@ struct skimmerOTS { } // end of TOI loop } swtbit_tmp(trigger_bitmap); - if (analyzed_bitmap > 0 || analyzedToI_bitmap > 0) { // storing 0 is useless. - swtcounter_tmp(analyzed_bitmap, analyzedToI_bitmap); - } - } // end of collision loop - } // end of process }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From fe3347d83af64f82bc5ce134aad3298e0d261f54 Mon Sep 17 00:00:00 2001 From: Gyula Bencedi Date: Sun, 19 Oct 2025 22:24:24 +0200 Subject: [PATCH 817/986] [PWGLF] Fix histo filling for secondaries (#13452) --- PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx | 51 ++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx b/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx index 0abdc236183..436f24e66f5 100644 --- a/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx +++ b/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx @@ -932,6 +932,12 @@ struct DndetaMFTPbPb { hNevt->GetXaxis()->SetBinLabel(1, "Reconstructed collisions"); hNevt->GetXaxis()->SetBinLabel(2, "Generated collisions"); if (doprocessSecondariesMCInlcusive) { + registry.add({"Events/EvtGenRec", ";status", {HistType::kTH1F, {{3, 0.5, 3.5}}}}); + auto heff = registry.get(HIST("Events/EvtGenRec")); + auto* h = heff->GetXaxis(); + h->SetBinLabel(1, "All generated"); + h->SetBinLabel(2, "All reconstructed"); + h->SetBinLabel(3, "Selected reconstructed"); registry.add({"Tracks/THnRecAmb", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis}}}); registry.add({"Tracks/THnRec", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis}}}); registry.add({"Tracks/THnRecNonAmb", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis}}}); @@ -944,6 +950,12 @@ struct DndetaMFTPbPb { registry.add({"Tracks/THnGenSecMatAmb", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm)", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis}}}); } if (doprocessSecondariesMCCentFT0C) { + registry.add({"Events/Centrality/EvtGenRec", ";status;centrality", {HistType::kTH2F, {{3, 0.5, 3.5}, centralityAxis}}}); + auto heff = registry.get(HIST("Events/Centrality/EvtGenRec")); + auto* h = heff->GetXaxis(); + h->SetBinLabel(1, "All generated"); + h->SetBinLabel(2, "All reconstructed"); + h->SetBinLabel(3, "Selected reconstructed"); registry.add({"Tracks/Centrality/THnRecAmb", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, centralityAxis}}}); registry.add({"Tracks/Centrality/THnRec", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, centralityAxis}}}); registry.add({"Tracks/Centrality/THnRecNonAmb", "; p_{T} (GeV/c); #eta; Z_{vtx} (cm); centrality", {HistType::kTHnSparseF, {ptAxis, etaAxis, zAxis, centralityAxis}}}); @@ -2883,11 +2895,46 @@ struct DndetaMFTPbPb { registry.fill(HIST("Events/hNGenRecColls"), 1.f, collisions.size()); registry.fill(HIST("Events/hNGenRecColls"), 2.f, mcCollisions.size()); + float cGen = -1; + if constexpr (has_reco_cent) { + float crecMin = 105.f; + for (const auto& collision : collisions) { + if (isGoodEvent(collision)) { + float c = getRecoCent(collision); + if (c < crecMin) { + crecMin = c; + } + } + } + if (cGen < 0) + cGen = crecMin; + } + + if constexpr (has_reco_cent) { + registry.fill(HIST("Events/Centrality/EvtGenRec"), 1., cGen); + } else { + registry.fill(HIST("Events/EvtGenRec"), 1.); + } + for (const auto& collision : collisions) { float crec = getRecoCent(collision); + + if constexpr (has_reco_cent) { + registry.fill(HIST("Events/Centrality/EvtGenRec"), 2., crec); + } else { + registry.fill(HIST("Events/EvtGenRec"), 2.); + } + if (!isGoodEvent(collision)) { continue; } + + if constexpr (has_reco_cent) { + registry.fill(HIST("Events/Centrality/EvtGenRec"), 3., crec); + } else { + registry.fill(HIST("Events/EvtGenRec"), 3.); + } + if (!collision.has_mcCollision()) { continue; } @@ -3111,9 +3158,9 @@ struct DndetaMFTPbPb { if (!particle.isPhysicalPrimary()) { // Secondaries (weak decays and material) if (particle.getProcess() == kNumDecay) { // Particles from decay if constexpr (has_reco_cent) { - registry.fill(HIST("Tracks/Centrality/THnDCAxyBestGenPrim"), itrack.pt(), itrack.eta(), mcCollision.posZ(), atrack.bestDCAXY(), atrack.bestDCAZ(), crec); + registry.fill(HIST("Tracks/Centrality/THnDCAxyBestGenSecWeak"), itrack.pt(), itrack.eta(), mcCollision.posZ(), atrack.bestDCAXY(), atrack.bestDCAZ(), crec); } else { - registry.fill(HIST("Tracks/THnDCAxyBestGenPrim"), itrack.pt(), itrack.eta(), mcCollision.posZ(), atrack.bestDCAXY(), atrack.bestDCAZ()); + registry.fill(HIST("Tracks/THnDCAxyBestGenSecWeak"), itrack.pt(), itrack.eta(), mcCollision.posZ(), atrack.bestDCAXY(), atrack.bestDCAZ()); } } else { // Particles from the material if constexpr (has_reco_cent) { From d1e7d6a3f8cdede2b6ae1ca4c14a2616c4947ddd Mon Sep 17 00:00:00 2001 From: alcaliva <32872606+alcaliva@users.noreply.github.com> Date: Mon, 20 Oct 2025 09:08:29 +0200 Subject: [PATCH 818/986] [PWGLF] Select primary and from HF for jet clustering,improved perp cone calculation (#13448) --- PWGLF/Tasks/Nuspex/antinucleiInJets.cxx | 223 +++++++++++++++++++----- 1 file changed, 183 insertions(+), 40 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx index 1258c5cf330..3103595c4de 100644 --- a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx +++ b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx @@ -12,7 +12,7 @@ /// \file antinucleiInJets.cxx /// /// \brief task for analysis of antinuclei in jets using Fastjet -/// \author Alberto Caliva (alberto.caliva@cern.ch), Chiara Pinto (chiara.pinto@cern.ch) +/// \author Alberto Caliva (alberto.caliva@cern.ch), Chiara Pinto (chiara.pinto@cern.ch), Francesca Casillo (francesca.casillo@cern.ch) /// \since February 13, 2025 #include "PWGJE/Core/JetBkgSubUtils.h" @@ -111,14 +111,14 @@ struct AntinucleiInJets { Configurable ptLeadingMin{"ptLeadingMin", 5.0, "pt Leading Min"}; Configurable rJet{"rJet", 0.3, "Jet resolution parameter R"}; Configurable zVtx{"zVtx", 10.0, "Maximum zVertex"}; - Configurable applyAreaCut{"applyAreaCut", false, "apply area cut"}; - Configurable maxNormalizedJetArea{"maxNormalizedJetArea", 0.6, "area cut"}; + Configurable applyAreaCut{"applyAreaCut", true, "apply area cut"}; + Configurable maxNormalizedJetArea{"maxNormalizedJetArea", 1.0, "area cut"}; Configurable deltaEtaEdge{"deltaEtaEdge", 0.05, "eta gap from the edge"}; Configurable nSyst{"nSyst", 50, "number of systematic variations"}; // Track quality, kinematic, and PID selection parameters Configurable requirePvContributor{"requirePvContributor", false, "require that the track is a PV contributor"}; - Configurable applyItsPid{"applyItsPid", true, "apply ITS PID"}; + Configurable applyItsPid{"applyItsPid", false, "apply ITS PID"}; Configurable minItsNclusters{"minItsNclusters", 5, "minimum number of ITS clusters"}; Configurable minTpcNcrossedRows{"minTpcNcrossedRows", 100, "minimum number of TPC crossed pad rows"}; Configurable minChiSquareTpc{"minChiSquareTpc", 0.0, "minimum TPC chi^2/Ncls"}; @@ -138,18 +138,21 @@ struct AntinucleiInJets { Configurable ptMaxItsPidHel{"ptMaxItsPidHel", 1.0, "maximum pt for ITS PID for helium"}; Configurable nSigmaItsMin{"nSigmaItsMin", -3.0, "nSigmaITS min"}; Configurable nSigmaItsMax{"nSigmaItsMax", +3.0, "nSigmaITS max"}; - Configurable setMCDefaultItsParams{"setMCDefaultItsParams", false, "set MC default parameters"}; + Configurable setMCDefaultItsParams{"setMCDefaultItsParams", true, "set MC default parameters"}; Configurable cfgCompensatePIDinTracking{"cfgCompensatePIDinTracking", false, "If true, divide tpcInnerParam by the electric charge"}; Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {0.6539, 1.591, 0.8225, 2.363, 0.09}, "TPC Bethe-Bloch parameterisation for He3"}; // Configuration parameters for CCDB access and reweighting input files + Configurable applyReweighting{"applyReweighting", true, "enable reweighting for efficiency"}; Configurable urlToCcdb{"urlToCcdb", "http://alice-ccdb.cern.ch", "url of the personal ccdb"}; - Configurable pathToFile{"pathToFile", "Users/a/alcaliva/PrimaryFractionAntip", "path to file with reweighting"}; + Configurable pathToFile{"pathToFile", "Users/a/alcaliva/reweightingHistogramsAntipInJet", "path to file"}; Configurable weightsProton{"weightsProton", "", "weightsProton"}; Configurable weightsLambda{"weightsLambda", "", "weightsLambda"}; Configurable weightsSigma{"weightsSigma", "", "weightsSigma"}; Configurable weightsXi{"weightsXi", "", "weightsXi"}; Configurable weightsOmega{"weightsOmega", "", "weightsOmega"}; + Configurable weightsJet{"weightsJet", "", "weightsJet"}; + Configurable weightsUe{"weightsUe", "", "weightsUe"}; // Number of events Configurable shrinkInterval{"shrinkInterval", 1000, "variable that controls how often shrinking happens"}; @@ -160,6 +163,8 @@ struct AntinucleiInJets { TH1F* primaryAntiSigma; TH1F* primaryAntiXi; TH1F* primaryAntiOmega; + TH1F* antiprotonsInsideJets; + TH1F* antiprotonsPerpCone; // CCDB manager service for accessing condition data Service ccdb; @@ -205,7 +210,7 @@ struct AntinucleiInJets { ccdb->setLocalObjectValidityChecking(); ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); ccdb->setFatalWhenNull(false); - getReweightingHistograms(ccdb, TString(pathToFile), TString(weightsProton), TString(weightsLambda), TString(weightsSigma), TString(weightsXi), TString(weightsOmega)); + getReweightingHistograms(ccdb, TString(pathToFile), TString(weightsProton), TString(weightsLambda), TString(weightsSigma), TString(weightsXi), TString(weightsOmega), TString(weightsJet), TString(weightsUe)); } // Binning @@ -295,6 +300,9 @@ struct AntinucleiInJets { registryMC.add("genEvents", "number of generated events in mc", HistType::kTH1F, {{10, 0, 10, "counter"}}); registryMC.add("genJets", "number of generated jets", HistType::kTH1F, {{10, 0, 10, "counter"}}); + // Size of particle array + registryMC.add("sizeParticleArray", "number of particles", HistType::kTH1F, {{1000, 0, 1000, "#it{N}_{part}"}}); + // Generated spectra of antiprotons registryMC.add("antiproton_gen_jet", "antiproton_gen_jet", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); registryMC.add("antiproton_gen_ue", "antiproton_gen_ue", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); @@ -485,7 +493,7 @@ struct AntinucleiInJets { } } - void getReweightingHistograms(o2::framework::Service const& ccdbObj, TString filepath, TString antip, TString antilambda, TString antisigma, TString antixi, TString antiomega) + void getReweightingHistograms(o2::framework::Service const& ccdbObj, TString filepath, TString antip, TString antilambda, TString antisigma, TString antixi, TString antiomega, TString jet, TString ue) { TList* list = ccdbObj->get(filepath.Data()); if (!list) { @@ -493,6 +501,7 @@ struct AntinucleiInJets { return; } + // Get reweighting histograms for primary fraction primaryAntiprotons = static_cast(list->FindObject(antip)); primaryAntiLambda = static_cast(list->FindObject(antilambda)); primaryAntiSigma = static_cast(list->FindObject(antisigma)); @@ -500,7 +509,14 @@ struct AntinucleiInJets { primaryAntiOmega = static_cast(list->FindObject(antiomega)); if (!primaryAntiprotons || !primaryAntiSigma || !primaryAntiLambda || !primaryAntiXi || !primaryAntiOmega) { - LOGP(error, "Missing one or more reweighting histograms in CCDB list"); + LOGP(error, "Missing one or more reweighting histograms for primary fraction in CCDB list"); + } + + // Get reweighting histograms for efficiency + antiprotonsInsideJets = static_cast(list->FindObject(jet)); + antiprotonsPerpCone = static_cast(list->FindObject(ue)); + if (!antiprotonsInsideJets || !antiprotonsPerpCone) { + LOGP(error, "Missing one or more reweighting histograms for efficiency in CCDB list"); } LOGP(info, "Successfully loaded reweighting histograms from CCDB path"); @@ -533,6 +549,33 @@ struct AntinucleiInJets { return current; } + // Check if particle is a physical primary or a decay product of a heavy-flavor hadron + bool isPhysicalPrimaryOrFromHF(aod::McParticle const& particle, aod::McParticles const& mcParticles) + { + // Keep only pi, K, p, e, mu + int pdg = std::abs(particle.pdgCode()); + if (!(pdg == PDG_t::kPiPlus || pdg == PDG_t::kKPlus || pdg == PDG_t::kProton || pdg == PDG_t::kElectron || pdg == PDG_t::kMuonMinus)) + return false; + + // Constants for identifying heavy-flavor (charm and bottom) content from PDG codes + static constexpr int kCharmQuark = 4; + static constexpr int kBottomQuark = 5; + static constexpr int hundreds = 100; + static constexpr int thousands = 1000; + + // Check if particle is from heavy-flavor decay + bool fromHF = false; + if (particle.has_mothers()) { + auto mother = mcParticles.iteratorAt(particle.mothersIds()[0]); + int motherPdg = std::abs(mother.pdgCode()); + fromHF = (motherPdg / hundreds == kCharmQuark || motherPdg / hundreds == kBottomQuark || motherPdg / thousands == kCharmQuark || motherPdg / thousands == kBottomQuark); + } + + // Select only physical primary particles or from heavy-flavor + return (particle.isPhysicalPrimary() || fromHF); + } + + /* // Compute two unit vectors perpendicular to p void getPerpendicularAxis(const TVector3& p, TVector3& u, double sign) { @@ -584,6 +627,70 @@ struct AntinucleiInJets { double uy = (-pz2 - px * ux) / py; u.SetXYZ(ux, uy, pz); } + */ + + // Compute two transverse directions orthogonal to vector p + void getPerpendicularDirections(const TVector3& p, TVector3& u1, TVector3& u2) + { + // Get momentum components + double px = p.X(); + double py = p.Y(); + double pz = p.Z(); + + // Precompute squared terms + double px2 = px * px; + double py2 = py * py; + double pz2 = pz * pz; + double pz4 = pz2 * pz2; + + // Case 1: vector along z-axis -> undefined perpendiculars + if (px == 0 && py == 0) { + u1.SetXYZ(0, 0, 0); + u2.SetXYZ(0, 0, 0); + return; + } + + // Case 2: px = 0 -> avoid division by zero + if (px == 0 && py != 0) { + double ux = std::sqrt(py2 - pz4 / py2); + double uy = -pz2 / py; + u1.SetXYZ(ux, uy, pz); + u2.SetXYZ(-ux, uy, pz); + return; + } + + // Case 3: py = 0 -> avoid division by zero + if (py == 0 && px != 0) { + double ux = -pz2 / px; + double uy = std::sqrt(px2 - pz4 / px2); + u1.SetXYZ(ux, uy, pz); + u2.SetXYZ(ux, -uy, pz); + return; + } + + // General case: solve quadratic for perpendicular vectors + double a = px2 + py2; + double b = 2.0 * px * pz2; + double c = pz4 - py2 * py2 - px2 * py2; + double delta = b * b - 4.0 * a * c; + + // Invalid or degenerate solutions + if (delta < 0 || a == 0) { + u1.SetXYZ(0, 0, 0); + u2.SetXYZ(0, 0, 0); + return; + } + + // Solution 1 + double u1x = (-b + std::sqrt(delta)) / (2.0 * a); + double u1y = (-pz2 - px * u1x) / py; + u1.SetXYZ(u1x, u1y, pz); + + // Solution 2 + double u2x = (-b - std::sqrt(delta)) / (2.0 * a); + double u2y = (-pz2 - px * u2x) / py; + u2.SetXYZ(u2x, u2y, pz); + } // Compute delta phi double getDeltaPhi(double a1, double a2) @@ -917,10 +1024,11 @@ struct AntinucleiInJets { // Perpendicular cones double coneRadius = std::sqrt(jet.area() / PI); TVector3 jetAxis(jet.px(), jet.py(), jet.pz()); - TVector3 ueAxis1(0, 0, 0); - TVector3 ueAxis2(0, 0, 0); - getPerpendicularAxis(jetAxis, ueAxis1, +1); - getPerpendicularAxis(jetAxis, ueAxis2, -1); + TVector3 ueAxis1(0, 0, 0), ueAxis2(0, 0, 0); + getPerpendicularDirections(jetAxis, ueAxis1, ueAxis2); + if (ueAxis1.Mag() == 0 || ueAxis2.Mag() == 0) { + continue; + } // Fill histogram with jet effective area / piR^2 registryData.fill(HIST("jetEffectiveAreaOverPiR2"), jet.area() / (PI * rJet * rJet)); @@ -1274,10 +1382,11 @@ struct AntinucleiInJets { std::vector jetConstituents = jet.constituents(); TVector3 jetAxis(jet.px(), jet.py(), jet.pz()); double coneRadius = std::sqrt(jet.area() / PI); - TVector3 ueAxis1(0, 0, 0); - TVector3 ueAxis2(0, 0, 0); - getPerpendicularAxis(jetAxis, ueAxis1, +1); - getPerpendicularAxis(jetAxis, ueAxis2, -1); + TVector3 ueAxis1(0, 0, 0), ueAxis2(0, 0, 0); + getPerpendicularDirections(jetAxis, ueAxis1, ueAxis2); + if (ueAxis1.Mag() == 0 || ueAxis2.Mag() == 0) { + continue; + } registryQC.fill(HIST("NchJetCone"), static_cast(jetConstituents.size())); @@ -1656,9 +1765,11 @@ struct AntinucleiInJets { // Loop over MC particles for (const auto& particle : mcParticles) { - // Select physical primaries within acceptance - if (!particle.isPhysicalPrimary()) + // Select physical primary particles or HF decay products + if (!isPhysicalPrimaryOrFromHF(particle, mcParticles)) continue; + + // Select particles within acceptance static constexpr double MinPtParticle = 0.1; if (particle.eta() < minEta || particle.eta() > maxEta || particle.pt() < MinPtParticle) continue; @@ -1681,6 +1792,9 @@ struct AntinucleiInJets { continue; registryMC.fill(HIST("genEvents"), 2.5); + // Size of particle array + registryMC.fill(HIST("sizeParticleArray"), fjParticles.size()); + // Cluster MC particles into jets using anti-kt algorithm fastjet::ClusterSequenceArea cs(fjParticles, jetDef, areaDef); std::vector jets = fastjet::sorted_by_pt(cs.inclusive_jets()); @@ -1721,19 +1835,28 @@ struct AntinucleiInJets { // Fill normalization histogram registryMC.fill(HIST("antiproton_deltay_deltaphi_jet"), particle.eta() - jet.eta(), getDeltaPhi(particle.phi(), jet.phi())); + // Calculate weight + double weightJet(1.0); + if (applyReweighting && particle.pt() < antiprotonsInsideJets->GetXaxis()->GetXmax()) { + int ipt = antiprotonsInsideJets->FindBin(particle.pt()); + weightJet = antiprotonsInsideJets->GetBinContent(ipt); + } + // Fill histogram for generated antiprotons - registryMC.fill(HIST("antiproton_gen_jet"), particle.pt()); + registryMC.fill(HIST("antiproton_gen_jet"), particle.pt(), weightJet); // Fill 2d (pt,eta) distribution of antiprotons - registryMC.fill(HIST("antiproton_eta_pt_jet"), particle.pt(), particle.eta()); + registryMC.fill(HIST("antiproton_eta_pt_jet"), particle.pt(), particle.eta(), weightJet); } // Set up two perpendicular cone axes for underlying event estimation TVector3 jetAxis(jet.px(), jet.py(), jet.pz()); double coneRadius = std::sqrt(jet.area() / PI); TVector3 ueAxis1(0, 0, 0), ueAxis2(0, 0, 0); - getPerpendicularAxis(jetAxis, ueAxis1, +1); - getPerpendicularAxis(jetAxis, ueAxis2, -1); + getPerpendicularDirections(jetAxis, ueAxis1, ueAxis2); + if (ueAxis1.Mag() == 0 || ueAxis2.Mag() == 0) { + continue; + } // Loop over MC particles to analyze underlying event region for (const auto& protonVec : protonMomentum) { @@ -1757,18 +1880,21 @@ struct AntinucleiInJets { continue; // Fill normalization histogram - if (deltaRUe1 < maxConeRadius) { - registryMC.fill(HIST("antiproton_deltay_deltaphi_ue"), protonVec.Eta() - ueAxis1.Eta(), getDeltaPhi(protonVec.Phi(), ueAxis1.Phi())); - } - if (deltaRUe2 < maxConeRadius) { - registryMC.fill(HIST("antiproton_deltay_deltaphi_ue"), protonVec.Eta() - ueAxis2.Eta(), getDeltaPhi(protonVec.Phi(), ueAxis2.Phi())); + registryMC.fill(HIST("antiproton_deltay_deltaphi_ue"), protonVec.Eta() - ueAxis1.Eta(), getDeltaPhi(protonVec.Phi(), ueAxis1.Phi())); + registryMC.fill(HIST("antiproton_deltay_deltaphi_ue"), protonVec.Eta() - ueAxis2.Eta(), getDeltaPhi(protonVec.Phi(), ueAxis2.Phi())); + + // Calculate weight + double weightUe(1.0); + if (applyReweighting && protonVec.Pt() < antiprotonsPerpCone->GetXaxis()->GetXmax()) { + int ipt = antiprotonsPerpCone->FindBin(protonVec.Pt()); + weightUe = antiprotonsPerpCone->GetBinContent(ipt); } // Fill histogram for antiprotons in the UE - registryMC.fill(HIST("antiproton_gen_ue"), protonVec.Pt()); + registryMC.fill(HIST("antiproton_gen_ue"), protonVec.Pt(), weightUe); // Fill 2d (pt,eta) distribution of antiprotons - registryMC.fill(HIST("antiproton_eta_pt_ue"), protonVec.Pt(), protonVec.Eta()); + registryMC.fill(HIST("antiproton_eta_pt_ue"), protonVec.Pt(), protonVec.Eta(), weightUe); } } if (isAtLeastOneJetSelected) { @@ -1910,8 +2036,10 @@ struct AntinucleiInJets { double coneRadius = std::sqrt(jet.area() / PI); TVector3 jetAxis(jet.px(), jet.py(), jet.pz()); TVector3 ueAxis1(0, 0, 0), ueAxis2(0, 0, 0); - getPerpendicularAxis(jetAxis, ueAxis1, +1); - getPerpendicularAxis(jetAxis, ueAxis2, -1); + getPerpendicularDirections(jetAxis, ueAxis1, ueAxis2); + if (ueAxis1.Mag() == 0 || ueAxis2.Mag() == 0) { + continue; + } // Get jet constituents std::vector jetConstituents = jet.constituents(); @@ -1981,11 +2109,18 @@ struct AntinucleiInJets { // Fill antiproton spectrum for physical primaries registryMC.fill(HIST("antiproton_prim_jet"), pt); + // Calculate weight + double weightJet(1.0); + if (applyReweighting && mcparticle.pt() < antiprotonsInsideJets->GetXaxis()->GetXmax()) { + int ipt = antiprotonsInsideJets->FindBin(mcparticle.pt()); + weightJet = antiprotonsInsideJets->GetBinContent(ipt); + } + // Fill histograms (TPC and TOF) only for selected candidates if (passedItsPidProt && nsigmaTPCPr > minNsigmaTpc && nsigmaTPCPr < maxNsigmaTpc) { - registryMC.fill(HIST("antiproton_rec_tpc_jet"), pt); + registryMC.fill(HIST("antiproton_rec_tpc_jet"), pt, weightJet); if (track.hasTOF() && nsigmaTOFPr > minNsigmaTof && nsigmaTOFPr < maxNsigmaTof) { - registryMC.fill(HIST("antiproton_rec_tof_jet"), pt); + registryMC.fill(HIST("antiproton_rec_tof_jet"), pt, weightJet); } } } @@ -2056,11 +2191,18 @@ struct AntinucleiInJets { // Fill antiproton spectrum for physical primaries registryMC.fill(HIST("antiproton_prim_ue"), pt); + // Calculate weight + double weightUe(1.0); + if (applyReweighting && mcparticle.pt() < antiprotonsPerpCone->GetXaxis()->GetXmax()) { + int ipt = antiprotonsPerpCone->FindBin(mcparticle.pt()); + weightUe = antiprotonsPerpCone->GetBinContent(ipt); + } + // Fill histograms (TPC and TOF) only for selected candidates if (passedItsPidProt && nsigmaTPCPr > minNsigmaTpc && nsigmaTPCPr < maxNsigmaTpc) { - registryMC.fill(HIST("antiproton_rec_tpc_ue"), pt); + registryMC.fill(HIST("antiproton_rec_tpc_ue"), pt, weightUe); if (track.hasTOF() && nsigmaTOFPr > minNsigmaTof && nsigmaTOFPr < maxNsigmaTof) { - registryMC.fill(HIST("antiproton_rec_tof_ue"), pt); + registryMC.fill(HIST("antiproton_rec_tof_ue"), pt, weightUe); } } } @@ -2624,10 +2766,11 @@ struct AntinucleiInJets { // Perpendicular cones double coneRadius = std::sqrt(jet.area() / PI); TVector3 jetAxis(jet.px(), jet.py(), jet.pz()); - TVector3 ueAxis1(0, 0, 0); - TVector3 ueAxis2(0, 0, 0); - getPerpendicularAxis(jetAxis, ueAxis1, +1); - getPerpendicularAxis(jetAxis, ueAxis2, -1); + TVector3 ueAxis1(0, 0, 0), ueAxis2(0, 0, 0); + getPerpendicularDirections(jetAxis, ueAxis1, ueAxis2); + if (ueAxis1.Mag() == 0 || ueAxis2.Mag() == 0) { + continue; + } // Get jet constituents std::vector jetConstituents = jet.constituents(); From 46972859a9089acc30d6915a36ad5ecf87da2769 Mon Sep 17 00:00:00 2001 From: Fabio Catalano Date: Mon, 20 Oct 2025 11:03:29 +0200 Subject: [PATCH 819/986] [PWGHF] Add centrality information to OmegaC tree creator (#13423) --- PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx | 15 +- .../treeCreatorOmegac0ToOmegaPi.cxx | 236 ++++++++++++++---- 2 files changed, 193 insertions(+), 58 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx b/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx index f3941a83889..8a92286c42c 100644 --- a/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx +++ b/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx @@ -168,15 +168,6 @@ struct HfTaskOmegac0ToOmegapi { registry.get(HIST("hReco"))->Sumw2(); } - /// Evaluate centrality/multiplicity percentile (centrality estimator is automatically selected based on the used table) - /// \param candidate is candidate - /// \return centrality/multiplicity percentile of the collision - template - float evaluateCentralityColl(const Coll& collision) - { - return o2::hf_centrality::getCentralityColl(collision); - } - template void processData(const CandType& candidates) { @@ -214,7 +205,7 @@ struct HfTaskOmegac0ToOmegapi { continue; } - float const cent = evaluateCentralityColl(collision); + float const cent = o2::hf_centrality::getCentralityColl(collision); if constexpr (ApplyMl) { registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), @@ -283,7 +274,7 @@ struct HfTaskOmegac0ToOmegapi { auto collision = candidate.template collision_as(); uint16_t const numPvContributors = collision.numContrib(); - float const mcCent = evaluateCentralityColl(collision.template mcCollision_as()); + float const mcCent = o2::hf_centrality::getCentralityColl(collision.template mcCollision_as()); if constexpr (ApplyMl) { registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), mcCent, numPvContributors, candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec(), candidate.mlProbOmegac()[0]); @@ -309,7 +300,7 @@ struct HfTaskOmegac0ToOmegapi { maxNumContrib = recCol.numContrib() > maxNumContrib ? recCol.numContrib() : maxNumContrib; } - float const mcCent = evaluateCentralityColl(mcCollision); + float const mcCent = o2::hf_centrality::getCentralityColl(mcCollision); if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { registry.fill(HIST("hMcGen"), ptGen, -1., yGen, RecoDecay::OriginType::Prompt, mcCent, maxNumContrib); diff --git a/PWGHF/TableProducer/treeCreatorOmegac0ToOmegaPi.cxx b/PWGHF/TableProducer/treeCreatorOmegac0ToOmegaPi.cxx index f102151596c..2bb41833fc0 100644 --- a/PWGHF/TableProducer/treeCreatorOmegac0ToOmegaPi.cxx +++ b/PWGHF/TableProducer/treeCreatorOmegac0ToOmegaPi.cxx @@ -18,10 +18,13 @@ /// \author Fabio Catalano , University of Houston /// \author Ruiqi Yin , Fudan University +#include "PWGHF/Core/CentralityEstimation.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGLF/DataModel/mcCentrality.h" #include "Common/Core/RecoDecay.h" +#include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/TrackSelectionTables.h" @@ -169,7 +172,7 @@ DECLARE_SOA_TABLE(HfToOmegaPiEvs, "AOD", "HFTOOMEPIEV", full::IsEventSel8, full::IsEventSelZ); DECLARE_SOA_TABLE(HfOmegac0ToOmegaPiLites, "AOD", "HFTOOMEPILITE", - full::XPv, full::YPv, full::ZPv, collision::NumContrib, collision::Chi2, + full::XPv, full::YPv, full::ZPv, collision::NumContrib, collision::Chi2, cent::CentFT0M, full::XDecayVtxCharmBaryon, full::YDecayVtxCharmBaryon, full::ZDecayVtxCharmBaryon, full::XDecayVtxCascade, full::YDecayVtxCascade, full::ZDecayVtxCascade, full::XDecayVtxV0, full::YDecayVtxV0, full::ZDecayVtxV0, @@ -211,7 +214,7 @@ DECLARE_SOA_TABLE(HfKfOmegacFulls, "AOD", "HFKFOMEGACFULL", full::MassV0Ndf, full::MassCascNdf, full::V0Chi2OverNdf, full::CascChi2OverNdf, full::OmegacChi2OverNdf, full::MassV0Chi2OverNdf, full::MassCascChi2OverNdf, full::CascRejectInvmass, - full::FlagMcMatchRec, full::OriginMcRec, full::CollisionMatched, hf_track_index::HFflag, collision::NumContrib); + full::FlagMcMatchRec, full::OriginMcRec, full::CollisionMatched, hf_track_index::HFflag, collision::NumContrib, cent::CentFT0M); DECLARE_SOA_TABLE(HfKfOmegacLites, "AOD", "HFKFOMEGACLITE", full::NSigmaTPCPiFromOmegac, full::NSigmaTOFPiFromOmegac, full::NSigmaTPCKaFromCasc, full::NSigmaTOFKaFromCasc, @@ -225,7 +228,7 @@ DECLARE_SOA_TABLE(HfKfOmegacLites, "AOD", "HFKFOMEGACLITE", full::CosThetaStarPiFromOmegac, full::CtOmegac, full::EtaOmegac, full::V0Chi2OverNdf, full::CascChi2OverNdf, full::OmegacChi2OverNdf, full::CascRejectInvmass, - full::FlagMcMatchRec, full::OriginMcRec, full::CollisionMatched, hf_track_index::HFflag, collision::NumContrib); + full::FlagMcMatchRec, full::OriginMcRec, full::CollisionMatched, hf_track_index::HFflag, collision::NumContrib, cent::CentFT0M); } // namespace o2::aod /// Writes the full information in an output TTree @@ -240,9 +243,16 @@ struct HfTreeCreatorOmegac0ToOmegaPi { Configurable keepOnlyMcSignal{"keepOnlyMcSignal", true, "Fill MC tree only with signal candidates"}; using Tracks = soa::Join; - using Colls = soa::Join; + + using CandSel = soa::Filtered>; using CandKfSel = soa::Filtered>; - using CascKfMcSel = soa::Filtered>; + using CandMcSel = soa::Filtered>; + using CandKfMcSel = soa::Filtered>; + + using Colls = soa::Join; + using CollsWithFT0M = soa::Join; + using CollsWithMcLabels = soa::Join; + using McCollsWithFT0M = soa::Join; Filter filterOmegaCToOmegaPiFlag = (o2::aod::hf_track_index::hfflag & static_cast(BIT(aod::hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi))) != static_cast(0); @@ -250,14 +260,14 @@ struct HfTreeCreatorOmegac0ToOmegaPi { { } - template - void fillEvent(const T& collision, float cutZPv) + template + void fillEvent(const C& collision, float cutZPv) { rowEv(collision.sel8(), std::abs(collision.posZ()) < cutZPv); } - template - void fillCandidateLite(const T& candidate, int8_t flagMc, int8_t originMc, bool collisionMatched) + template + void fillCandidateLite(const P& candidate, const C&, int8_t flagMc, int8_t originMc, bool collisionMatched, float centFt0m) { if (candidate.resultSelections() && candidate.statusPidCharmBaryon() && candidate.statusInvMassLambda() && candidate.statusInvMassCascade() && candidate.statusInvMassCharmBaryon()) { @@ -265,8 +275,9 @@ struct HfTreeCreatorOmegac0ToOmegaPi { candidate.xPv(), candidate.yPv(), candidate.zPv(), - candidate.template collision_as().numContrib(), - candidate.template collision_as().chi2(), + candidate.template collision_as().numContrib(), + candidate.template collision_as().chi2(), + centFt0m, candidate.xDecayVtxCharmBaryon(), candidate.yDecayVtxCharmBaryon(), candidate.zDecayVtxCharmBaryon(), @@ -331,8 +342,8 @@ struct HfTreeCreatorOmegac0ToOmegaPi { } } - template - void fillKfCandidate(const T& candidate, int8_t flagMc, int8_t originMc, bool collisionMatched) + template + void fillKfCandidate(const P& candidate, const C&, int8_t flagMc, int8_t originMc, bool collisionMatched, float centFt0m) { if (candidate.resultSelections() && candidate.statusPidCharmBaryon() && candidate.statusInvMassLambda() && candidate.statusInvMassCascade() && candidate.statusInvMassCharmBaryon()) { @@ -397,12 +408,13 @@ struct HfTreeCreatorOmegac0ToOmegaPi { originMc, collisionMatched, candidate.hfflag(), - candidate.template collision_as().numContrib()); + candidate.template collision_as().numContrib(), + centFt0m); } } - template - void fillKfCandidateLite(const T& candidate, int8_t flagMc, int8_t originMc, bool collisionMatched) + template + void fillKfCandidateLite(const P& candidate, const C&, int8_t flagMc, int8_t originMc, bool collisionMatched, float centFt0m) { if (candidate.resultSelections() && candidate.statusPidCharmBaryon() && candidate.statusInvMassLambda() && candidate.statusInvMassCascade() && candidate.statusInvMassCharmBaryon()) { @@ -441,12 +453,66 @@ struct HfTreeCreatorOmegac0ToOmegaPi { originMc, collisionMatched, candidate.hfflag(), - candidate.template collision_as().numContrib()); + candidate.template collision_as().numContrib(), + centFt0m); } } // fillKfCandidateLite end - void processDataLite(Colls const& collisions, Tracks const&, - soa::Filtered> const& candidates) + void processData(Colls const& collisions, + CandSel const& candidates, + Tracks const&) + { + // Filling event properties + rowEv.reserve(collisions.size()); + for (const auto& collision : collisions) { + fillEvent(collision, zPvCut); + } + + // Filling candidate properties + rowCandidateLite.reserve(candidates.size()); + for (const auto& candidate : candidates) { + fillCandidateLite(candidate, collisions, -7, RecoDecay::OriginType::None, false, -1.); + } + } + PROCESS_SWITCH(HfTreeCreatorOmegac0ToOmegaPi, processData, "Process data", false); + + void processKfData(Colls const& collisions, + CandKfSel const& candidates) + { + // Filling event properties + rowEv.reserve(collisions.size()); + for (const auto& collision : collisions) { + fillEvent(collision, zPvCut); + } + + // Filling candidate properties + rowKfCandidateFull.reserve(candidates.size()); + for (const auto& candidate : candidates) { + fillKfCandidate(candidate, collisions, -7, RecoDecay::OriginType::None, false, -1.); + } + } + PROCESS_SWITCH(HfTreeCreatorOmegac0ToOmegaPi, processKfData, "Process KF data", false); + + void processKfDataLite(Colls const& collisions, + CandKfSel const& candidates) + { + // Filling event properties + rowEv.reserve(collisions.size()); + for (const auto& collision : collisions) { + fillEvent(collision, zPvCut); + } + + // Filling candidate properties + rowKfCandidateFull.reserve(candidates.size()); + for (const auto& candidate : candidates) { + fillKfCandidateLite(candidate, collisions, -7, RecoDecay::OriginType::None, false, -1.); + } + } + PROCESS_SWITCH(HfTreeCreatorOmegac0ToOmegaPi, processKfDataLite, "Process KF data lite", false); + + void processDataCent(CollsWithFT0M const& collisions, + CandSel const& candidates, + Tracks const&) { // Filling event properties rowEv.reserve(collisions.size()); @@ -457,12 +523,15 @@ struct HfTreeCreatorOmegac0ToOmegaPi { // Filling candidate properties rowCandidateLite.reserve(candidates.size()); for (const auto& candidate : candidates) { - fillCandidateLite(candidate, -7, RecoDecay::OriginType::None, false); + auto collision = candidate.collision_as(); + float centFt0m = o2::hf_centrality::getCentralityColl(collision); + fillCandidateLite(candidate, collisions, -7, RecoDecay::OriginType::None, false, centFt0m); } } - PROCESS_SWITCH(HfTreeCreatorOmegac0ToOmegaPi, processDataLite, "Process data", false); + PROCESS_SWITCH(HfTreeCreatorOmegac0ToOmegaPi, processDataCent, "Process data with FT0M info", false); - void processKfDataFull(Colls const& collisions, Tracks const&, CandKfSel const& candidates) + void processKfDataCent(CollsWithFT0M const& collisions, + CandKfSel const& candidates) { // Filling event properties rowEv.reserve(collisions.size()); @@ -473,12 +542,15 @@ struct HfTreeCreatorOmegac0ToOmegaPi { // Filling candidate properties rowKfCandidateFull.reserve(candidates.size()); for (const auto& candidate : candidates) { - fillKfCandidate(candidate, -7, RecoDecay::OriginType::None, false); + auto collision = candidate.collision_as(); + float centFt0m = o2::hf_centrality::getCentralityColl(collision); + fillKfCandidate(candidate, collisions, -7, RecoDecay::OriginType::None, false, centFt0m); } } - PROCESS_SWITCH(HfTreeCreatorOmegac0ToOmegaPi, processKfDataFull, "Process KF data", false); + PROCESS_SWITCH(HfTreeCreatorOmegac0ToOmegaPi, processKfDataCent, "Process KF data with FT0M info", false); - void processKfDataLite(Colls const& collisions, Tracks const&, CandKfSel const& candidates) + void processKfDataCentLite(CollsWithFT0M const& collisions, + CandKfSel const& candidates) { // Filling event properties rowEv.reserve(collisions.size()); @@ -489,13 +561,16 @@ struct HfTreeCreatorOmegac0ToOmegaPi { // Filling candidate properties rowKfCandidateFull.reserve(candidates.size()); for (const auto& candidate : candidates) { - fillKfCandidateLite(candidate, -7, RecoDecay::OriginType::None, false); + auto collision = candidate.collision_as(); + float centFt0m = o2::hf_centrality::getCentralityColl(collision); + fillKfCandidateLite(candidate, collisions, -7, RecoDecay::OriginType::None, false, centFt0m); } } - PROCESS_SWITCH(HfTreeCreatorOmegac0ToOmegaPi, processKfDataLite, "Process KF data Lite", false); + PROCESS_SWITCH(HfTreeCreatorOmegac0ToOmegaPi, processKfDataCentLite, "Process KF data lite with FT0M info", false); - void processMcLite(Colls const& collisions, Tracks const&, - soa::Filtered> const& candidates) + void processMc(Colls const& collisions, + CandMcSel const& candidates, + Tracks const&) { // Filling event properties rowEv.reserve(collisions.size()); @@ -506,12 +581,16 @@ struct HfTreeCreatorOmegac0ToOmegaPi { // Filling candidate properties rowCandidateLite.reserve(candidates.size()); for (const auto& candidate : candidates) { - fillCandidateLite(candidate, candidate.flagMcMatchRec(), candidate.originMcRec(), candidate.collisionMatched()); + if (keepOnlyMcSignal && candidate.originMcRec() == RecoDecay::OriginType::None) { + continue; + } + fillCandidateLite(candidate, collisions, candidate.flagMcMatchRec(), candidate.originMcRec(), candidate.collisionMatched(), -1.); } } - PROCESS_SWITCH(HfTreeCreatorOmegac0ToOmegaPi, processMcLite, "Process MC", false); + PROCESS_SWITCH(HfTreeCreatorOmegac0ToOmegaPi, processMc, "Process MC", false); - void processKFMcFull(Colls const& collisions, Tracks const&, CascKfMcSel const& candidates) + void processKFMc(Colls const& collisions, + CandKfMcSel const& candidates) { // Filling event properties rowEv.reserve(collisions.size()); @@ -522,18 +601,16 @@ struct HfTreeCreatorOmegac0ToOmegaPi { // Filling candidate properties rowCandidateLite.reserve(candidates.size()); for (const auto& candidate : candidates) { - if (keepOnlyMcSignal) { - if (candidate.originMcRec() != 0) { - fillKfCandidate(candidate, candidate.flagMcMatchRec(), candidate.originMcRec(), candidate.collisionMatched()); - } - } else { - fillKfCandidate(candidate, candidate.flagMcMatchRec(), candidate.originMcRec(), candidate.collisionMatched()); + if (keepOnlyMcSignal && candidate.originMcRec() == RecoDecay::OriginType::None) { + continue; } + fillKfCandidate(candidate, collisions, candidate.flagMcMatchRec(), candidate.originMcRec(), candidate.collisionMatched(), -1.); } } - PROCESS_SWITCH(HfTreeCreatorOmegac0ToOmegaPi, processKFMcFull, "Process KF MC", false); + PROCESS_SWITCH(HfTreeCreatorOmegac0ToOmegaPi, processKFMc, "Process KF MC", false); - void processKFMcLite(Colls const& collisions, Tracks const&, CascKfMcSel const& candidates) + void processKFMcLite(Colls const& collisions, + CandKfMcSel const& candidates) { // Filling event properties rowEv.reserve(collisions.size()); @@ -544,17 +621,84 @@ struct HfTreeCreatorOmegac0ToOmegaPi { // Filling candidate properties rowCandidateLite.reserve(candidates.size()); for (const auto& candidate : candidates) { - if (keepOnlyMcSignal) { - if (candidate.originMcRec() != 0) { - fillKfCandidateLite(candidate, candidate.flagMcMatchRec(), candidate.originMcRec(), candidate.collisionMatched()); - } - } else { - fillKfCandidateLite(candidate, candidate.flagMcMatchRec(), candidate.originMcRec(), candidate.collisionMatched()); + if (keepOnlyMcSignal && candidate.originMcRec() == RecoDecay::OriginType::None) { + continue; } + fillKfCandidateLite(candidate, collisions, candidate.flagMcMatchRec(), candidate.originMcRec(), candidate.collisionMatched(), -1.); } } PROCESS_SWITCH(HfTreeCreatorOmegac0ToOmegaPi, processKFMcLite, "Process KF MC Lite", false); + void processMcCent(CollsWithMcLabels const& collisions, + CandMcSel const& candidates, + Tracks const&, + McCollsWithFT0M const&) + { + // Filling event properties + rowEv.reserve(collisions.size()); + for (const auto& collision : collisions) { + fillEvent(collision, zPvCut); + } + + // Filling candidate properties + rowCandidateLite.reserve(candidates.size()); + for (const auto& candidate : candidates) { + if (keepOnlyMcSignal && candidate.originMcRec() == RecoDecay::OriginType::None) { + continue; + } + auto mcCollision = candidate.collision_as().mcCollision_as(); + float centFt0m = o2::hf_centrality::getCentralityColl(mcCollision); + fillCandidateLite(candidate, collisions, candidate.flagMcMatchRec(), candidate.originMcRec(), candidate.collisionMatched(), centFt0m); + } + } + PROCESS_SWITCH(HfTreeCreatorOmegac0ToOmegaPi, processMcCent, "Process MC with FT0M info", false); + + void processKFMcCent(CollsWithMcLabels const& collisions, + CandKfMcSel const& candidates, + McCollsWithFT0M const&) + { + // Filling event properties + rowEv.reserve(collisions.size()); + for (const auto& collision : collisions) { + fillEvent(collision, zPvCut); + } + + // Filling candidate properties + rowCandidateLite.reserve(candidates.size()); + for (const auto& candidate : candidates) { + if (keepOnlyMcSignal && candidate.originMcRec() == RecoDecay::OriginType::None) { + continue; + } + auto mcCollision = candidate.collision_as().mcCollision_as(); + float centFt0m = o2::hf_centrality::getCentralityColl(mcCollision); + fillKfCandidate(candidate, collisions, candidate.flagMcMatchRec(), candidate.originMcRec(), candidate.collisionMatched(), centFt0m); + } + } + PROCESS_SWITCH(HfTreeCreatorOmegac0ToOmegaPi, processKFMcCent, "Process KF MC with FT0M info", false); + + void processKFMcCentLite(CollsWithMcLabels const& collisions, + CandKfMcSel const& candidates, + McCollsWithFT0M const&) + { + // Filling event properties + rowEv.reserve(collisions.size()); + for (const auto& collision : collisions) { + fillEvent(collision, zPvCut); + } + + // Filling candidate properties + rowCandidateLite.reserve(candidates.size()); + for (const auto& candidate : candidates) { + if (keepOnlyMcSignal && candidate.originMcRec() == RecoDecay::OriginType::None) { + continue; + } + auto mcCollision = candidate.collision_as().mcCollision_as(); + float centFt0m = o2::hf_centrality::getCentralityColl(mcCollision); + fillKfCandidateLite(candidate, collisions, candidate.flagMcMatchRec(), candidate.originMcRec(), candidate.collisionMatched(), centFt0m); + } + } + PROCESS_SWITCH(HfTreeCreatorOmegac0ToOmegaPi, processKFMcCentLite, "Process KF MC Lite with FT0M info", false); + }; // end of struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From dcdfe2ce63b50beb13e5d6e18ca64ef835b7e8c0 Mon Sep 17 00:00:00 2001 From: jaimenorman Date: Mon, 20 Oct 2025 10:27:58 +0100 Subject: [PATCH 820/986] [PWGJE] checks on outlier origin (#13435) --- PWGJE/Tasks/jetOutlierQA.cxx | 142 ++++++++++++++++++++++++++++++++--- 1 file changed, 133 insertions(+), 9 deletions(-) diff --git a/PWGJE/Tasks/jetOutlierQA.cxx b/PWGJE/Tasks/jetOutlierQA.cxx index 9cc8ead45ee..a4329b2d9aa 100644 --- a/PWGJE/Tasks/jetOutlierQA.cxx +++ b/PWGJE/Tasks/jetOutlierQA.cxx @@ -50,7 +50,10 @@ struct JetOutlierQATask { HistogramRegistry registry; - Preslice perCol = aod::jtrack::collisionId; + using JetParticlesWithOriginal = soa::Join; + + Preslice perColTrack = aod::jtrack::collisionId; + Preslice> perColParticle = aod::jmccollision::mcCollisionId; Preslice> perColJets = aod::jet::collisionId; Preslice> perColJetsMatched = aod::jet::collisionId; @@ -185,19 +188,43 @@ struct JetOutlierQATask { registry.add("h_track_phi_accepted", "track phi accepted;#varphi_{track} (rad);entries", {HistType::kTH1F, {{160, -1.0, 7.0}}}); registry.add("h_track_pt_eta_accepted", "track pt vs eta accepted;p_{T,track} (GeV/#it{c});#eta_{track};entries", {HistType::kTH2F, {{300, 0, 300}, {100, -5, 5}}}); registry.add("h_track_pt_phi_accepted", "track pt vs phi accepted;p_{T,track} (GeV/#it{c});#varphi_{track} (rad);entries", {HistType::kTH2F, {{300, 0, 300}, {160, -1.0, 7.0}}}); - // track checks based on collisions/particle association + registry.add("h_track_pt_accepted_no_JJ_outlier", "track pT with no JJ outlier", {HistType::kTH1F, {{300, 0, 300}}}); + registry.add("h_track_pt_eta_accepted_no_JJ_outlier", "track pT vs eta with no JJ outlier;p_{T,track} (GeV/#it{c});#eta_{track};entries", {HistType::kTH2F, {{300, 0, 300}, {100, -5, 5}}}); + registry.add("h_track_pt_phi_accepted_no_JJ_outlier", "track pT vs phi with no JJ outlier;p_{T,track} (GeV/#it{c});#varphi_{track} (rad);entries", {HistType::kTH2F, {{300, 0, 300}, {160, -1.0, 7.0}}}); + registry.add("h_track_pt_with_JJ_outlier", "track pT with JJ outlier", {HistType::kTH1F, {{300, 0, 300}}}); + registry.add("h_track_pt_eta_with_JJ_outlier", "track pT vs eta with JJ outlier;p_{T,track} (GeV/#it{c});#eta_{track};entries", {HistType::kTH2F, {{300, 0, 300}, {100, -5, 5}}}); + registry.add("h_track_pt_phi_with_JJ_outlier", "track pT vs phi with JJ outlier;p_{T,track} (GeV/#it{c});#varphi_{track} (rad);entries", {HistType::kTH2F, {{300, 0, 300}, {160, -1.0, 7.0}}}); + registry.add("h_track_pt_with_MB_outlier", "track pT with MB outlier", {HistType::kTH1F, {{300, 0, 300}}}); + registry.add("h_track_pt_eta_with_MB_outlier", "track pT vs eta with MB outlier;p_{T,track} (GeV/#it{c});#eta_{track};entries", {HistType::kTH2F, {{300, 0, 300}, {100, -5, 5}}}); + registry.add("h_track_pt_phi_with_MB_outlier", "track pT vs phi with MB outlier;p_{T,track} (GeV/#it{c});#varphi_{track} (rad);entries", {HistType::kTH2F, {{300, 0, 300}, {160, -1.0, 7.0}}}); + registry.add("h_track_pt_no_collision", "track pt no collision;p_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{300, 0, 300}}}); registry.add("h_track_pt_collision", "track pt collision;p_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{300, 0, 300}}}); registry.add("h2_track_pt_pt_hat_no_particle", "track pt vs pt hat no particle;p_{T,track} (GeV/#it{c});#hat{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{300, 0, 300}, {600, 0, 600}}}); registry.add("h2_track_pt_pt_hat_particle", "track pt vs pt hat particle;p_{T,track} (GeV/#it{c});#hat{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{300, 0, 300}, {600, 0, 600}}}); - registry.add("h_track_pt_outlier", "weight track pt", {HistType::kTH1F, {{200, 0., 200.}}}); - registry.add("h2_pt_hat_track_pt", "track; #hat{#it{p}_{T}} (GeV/#it{c});#it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{600, 0, 600}, {150, 0, 300}}}); - registry.add("h2_pt_hat_track_pt_outlier", "track; #hat{#it{p}_{T}} (GeV/#it{c});#it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{600, 0, 600}, {150, 0, 300}}}); + registry.add("h_track_pt_outlier", "weight track pt", {HistType::kTH1F, {{300, 0, 300}}}); + registry.add("h2_pt_hat_track_pt", "track; #hat{#it{p}_{T}} (GeV/#it{c});#it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{600, 0, 600}, {300, 0, 300}}}); + registry.add("h2_pt_hat_track_pt_outlier", "track; #hat{#it{p}_{T}} (GeV/#it{c});#it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{600, 0, 600}, {300, 0, 300}}}); registry.add("h2_neighbour_pt_hat_outlier", "neighbour; distance from collision; #hat{#it{p}_{T}} (GeV/#it{c})", {HistType::kTH2F, {{15, -7.5, 7.5}, {600, 0, 600}}}); registry.add("h2_neighbour_track_pt_outlier", "neighbour; distance from collision; #it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{15, -7.5, 7.5}, {200, 0, 100}}}); registry.add("h2_neighbour_pt_hat_all", "neighbour; distance from collision; #hat{#it{p}_{T}} (GeV/#it{c})", {HistType::kTH2F, {{15, -7.5, 7.5}, {600, 0, 600}}}); registry.add("h2_neighbour_track_pt_all", "neighbour; distance from collision; #it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{15, -7.5, 7.5}, {200, 0, 100}}}); + + registry.add("h_track_pt_outlier_same_collision", "weight track pt same collision", {HistType::kTH1F, {{300, 0, 300}}}); + registry.add("h_track_pt_outlier_different_collision_JJ", "weight track pt different jet-jet collision", {HistType::kTH1F, {{300, 0, 300}}}); + registry.add("h_track_pt_outlier_different_collision_MB", "weight track pt different MB collision", {HistType::kTH1F, {{300, 0, 300}}}); + + registry.add("h2_outlier_event_Ntracks_different_selected_JJ", "number of selected tracks from different jet-jet events", {HistType::kTH2F, {{600, 0, 600}, {200, 0, 200}}}); + registry.add("h2_outlier_event_Ntracks_different_selected_MB", "number of selected tracks from different MB events", {HistType::kTH2F, {{600, 0, 600}, {200, 0, 200}}}); + registry.add("h2_outlier_event_Ntracks_same_selected_JJ", "number of selected tracks from same jet-jet events", {HistType::kTH2F, {{600, 0, 600}, {200, 0, 200}}}); + registry.add("h2_outlier_event_tracks_frac_different_JJ", "fraction of tracks from different jet-jet events", {HistType::kTH2F, {{600, 0, 600}, {100, 0, 1}}}); + registry.add("h2_outlier_event_tracks_frac_different_MB", "fraction of tracks from different MB events", {HistType::kTH2F, {{600, 0, 600}, {100, 0, 1}}}); + registry.add("h2_outlier_event_tracks_frac_different_selected_JJ", "fraction of selected tracks from different jet-jet events", {HistType::kTH2F, {{600, 0, 600}, {100, 0, 1}}}); + registry.add("h2_outlier_event_tracks_frac_different_selected_MB", "fraction of selected tracks from different MB events", {HistType::kTH2F, {{600, 0, 600}, {100, 0, 1}}}); + registry.add("h2_outlier_collision_ID_difference", "difference in collision ID between outlier collision and analysed collision", {HistType::kTH2F, {{600, 0, 600}, {200, -100, 100}}}); + registry.add("h_DeltaZ_Outlier", "Delta Z between outlier collision and analysed collision", {HistType::kTH1F, {{1200, -30, 30}}}); + registry.add("h2_DeltaZ_Outlier_difference", "Delta Z between outlier collision and analysed collision vs difference in collision ID", {HistType::kTH2F, {{1200, -30, 30}, {200, -100, 100}}}); } } @@ -458,8 +485,10 @@ struct JetOutlierQATask { PROCESS_SWITCH(JetOutlierQATask, processCollisionsBC, "jet finder QA outliers", false); void processTracksBC(soa::Filtered> const& collisions, + soa::Join const&, aod::JetMcCollisions const& collisionsMC, - aod::JetTracksMCD const& tracks) + aod::JetTracksMCD const& tracks, + JetParticlesWithOriginal const&) { // // track-based outlier checks @@ -501,8 +530,10 @@ struct JetOutlierQATask { } float weight = collision.weight(); float pTHat = collision.mcCollision().ptHard(); - const auto tracksColl = tracks.sliceBy(perCol, collision.globalIndex()); + bool isOutlierEventDifferentJJCollision = false; + bool isOutlierEventDifferentMBCollision = false; + const auto tracksColl = tracks.sliceBy(perColTrack, collision.globalIndex()); // fill track histograms for all collisions for (auto const& track : tracksColl) { if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { @@ -525,10 +556,9 @@ struct JetOutlierQATask { } else { registry.fill(HIST("h2_track_pt_pt_hat_particle"), track.pt(), collision.mcCollision().ptHard(), weight); } - // check outlier tracks and neighbouring collisions registry.fill(HIST("h2_pt_hat_track_pt"), pTHat, track.pt()); - if (track.pt() > 1.5 * pTHat) { // high weight outlier track + if (track.pt() > pTHatMaxMCDOutlier * pTHat) { // high weight outlier track registry.fill(HIST("h_track_pt_outlier"), track.pt()); registry.fill(HIST("h2_pt_hat_track_pt_outlier"), pTHat, track.pt()); for (auto const& collisionOutlier : collisions) { // find collisions closeby @@ -540,6 +570,86 @@ struct JetOutlierQATask { registry.fill(HIST("h2_neighbour_track_pt_outlier"), float(diffColl + 0.1), track.pt(), eventWeightOutlier); } } + // now match tracks to their MC particle, check the MC collision ID of this particle, and + // check what fraction of tracks in this event are associated to this MC collision + int nMBdifferent = 0; + int nMBdifferentSelected = 0; + int nJJdifferent = 0; + int nJJdifferentSelected = 0; + int nJJsame = 0; + int nJJsameSelected = 0; + int mcCollisionIDcoll = collision.mcCollisionId(); // Get the corresponding MC collision ID from the reco collision + // LOG(info) << "--- Loop over tracks in outlier event with pT/pThat = " << track.pt() / pTHat << "---"; + // LOG(info) << "N tracks in outlier event = " << tracksColl.size() << " pTHat = " << pTHat << " collisionID = " << collision.globalIndex() << " mcCollisionID = " << collision.mcCollisionId(); + for (auto const& trackOutlier : tracksColl) { + if (!trackOutlier.has_mcParticle()) { + continue; + } + bool isTrackSelected = false; + if (jetderiveddatautilities::selectTrack(trackOutlier, trackSelection)) { + isTrackSelected = true; + } + auto mcParticle = trackOutlier.mcParticle_as(); + auto collisionMC = collisionsMC.sliceBy(perColParticle, mcParticle.mcCollisionId()); + if (collisionMC.size() == 0) { + LOG(info) << "no collision found for mcCollisionID = " << mcParticle.mcCollisionId(); + continue; + } + int mcCollisionIDtrack = mcParticle.mcCollisionId(); // Get the corresponding MC collision ID + int subGenID = collisionMC.begin().subGeneratorId(); + if (mcCollisionIDtrack == mcCollisionIDcoll) { + nJJsame++; + if (isTrackSelected) { + registry.fill(HIST("h_track_pt_outlier_same_collision"), trackOutlier.pt()); + nJJsameSelected++; + } + } else { + if (subGenID == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) { // MB-gap + nMBdifferent++; + if (isTrackSelected) { + registry.fill(HIST("h_track_pt_outlier_different_collision_MB"), trackOutlier.pt()); + nMBdifferentSelected++; + } + } else { // jet-jet + nJJdifferent++; + if (isTrackSelected) { + registry.fill(HIST("h_track_pt_outlier_different_collision_JJ"), trackOutlier.pt()); + nJJdifferentSelected++; + } + } + } + } + // LOG(info) << "nJJsame = " << nJJsame << " nJJdifferent = " << nJJdifferent << " nMBdifferent = " << nMBdifferent; + // LOG(info) << "nJJsameSelected = " << nJJsameSelected << " nJJdifferentSelected = " << nJJdifferentSelected << " nMBdifferentSelected = " << nMBdifferentSelected; + registry.fill(HIST("h2_outlier_event_Ntracks_different_selected_JJ"), pTHat, nJJdifferentSelected); + registry.fill(HIST("h2_outlier_event_Ntracks_different_selected_MB"), pTHat, nMBdifferentSelected); + registry.fill(HIST("h2_outlier_event_Ntracks_same_selected_JJ"), pTHat, nJJsameSelected); + registry.fill(HIST("h2_outlier_event_tracks_frac_different_selected_MB"), pTHat, float(nMBdifferentSelected) / float(nJJdifferentSelected + nJJsameSelected + nMBdifferentSelected)); + registry.fill(HIST("h2_outlier_event_tracks_frac_different_JJ"), pTHat, float(nJJdifferent) / float(nJJdifferent + nJJsame + nMBdifferent)); + registry.fill(HIST("h2_outlier_event_tracks_frac_different_MB"), pTHat, float(nMBdifferent) / float(nJJdifferent + nJJsame + nMBdifferent)); + registry.fill(HIST("h2_outlier_event_tracks_frac_different_selected_JJ"), pTHat, float(nJJdifferentSelected) / float(nJJdifferentSelected + nJJsameSelected + nMBdifferentSelected)); + registry.fill(HIST("h2_outlier_event_tracks_frac_different_selected_MB"), pTHat, float(nMBdifferentSelected) / float(nJJdifferentSelected + nJJsameSelected + nMBdifferentSelected)); + // now check where outlier comes from + auto mcParticleOutlier = track.mcParticle_as(); + auto collisionMCOutlier = collisionsMC.sliceBy(perColParticle, mcParticleOutlier.mcCollisionId()); + if (collisionMCOutlier.size() != 1) { + LOG(info) << "size of collision outlier not expected"; + return; + } + int mcCollisionIDOutlier = mcParticleOutlier.mcCollisionId(); + int subGenIDOutlier = collisionMCOutlier.begin().subGeneratorId(); + int outlierCollisionIDDifference = mcCollisionIDOutlier - mcCollisionIDcoll; + // LOG(info) <<"outlier comes from " << (mcCollisionIDOutlier == mcCollisionIDcoll ? "same" : "different") << " event which is a " << (subGenIDOutlier == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap ? " MB-gap" : " jet-jet") << " collision with mcCollisionID = " << mcCollisionIDOutlier; + registry.fill(HIST("h2_outlier_collision_ID_difference"), pTHat, float(outlierCollisionIDDifference)); + // if outlier comes from different collision, check which type and set flags + if (mcCollisionIDOutlier != mcCollisionIDcoll && subGenIDOutlier != jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) { + isOutlierEventDifferentJJCollision = true; + float deltaZ = collisionMCOutlier.begin().posZ() - collision.mcCollision().posZ(); + registry.fill(HIST("h_DeltaZ_Outlier"), deltaZ); + registry.fill(HIST("h2_DeltaZ_Outlier_difference"), deltaZ, float(outlierCollisionIDDifference)); + } else if (mcCollisionIDOutlier != mcCollisionIDcoll && subGenIDOutlier == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) { + isOutlierEventDifferentMBCollision = true; + } } // all for (auto const& collisionOutlier : collisions) { // find collisions closeby @@ -579,6 +689,20 @@ struct JetOutlierQATask { registry.fill(HIST("h_track_phi_accepted"), track.phi(), weight); registry.fill(HIST("h_track_pt_eta_accepted"), track.pt(), track.eta(), weight); registry.fill(HIST("h_track_pt_phi_accepted"), track.pt(), track.phi(), weight); + if (!isOutlierEventDifferentJJCollision) { + registry.fill(HIST("h_track_pt_accepted_no_JJ_outlier"), track.pt(), weight); + registry.fill(HIST("h_track_pt_eta_accepted_no_JJ_outlier"), track.pt(), track.eta(), weight); + registry.fill(HIST("h_track_pt_phi_accepted_no_JJ_outlier"), track.pt(), track.phi(), weight); + } else { + registry.fill(HIST("h_track_pt_with_JJ_outlier"), track.pt(), weight); + registry.fill(HIST("h_track_pt_eta_with_JJ_outlier"), track.pt(), track.eta(), weight); + registry.fill(HIST("h_track_pt_phi_with_JJ_outlier"), track.pt(), track.phi(), weight); + } + if (isOutlierEventDifferentMBCollision) { + registry.fill(HIST("h_track_pt_with_MB_outlier"), track.pt(), weight); + registry.fill(HIST("h_track_pt_eta_with_MB_outlier"), track.pt(), track.eta(), weight); + registry.fill(HIST("h_track_pt_phi_with_MB_outlier"), track.pt(), track.phi(), weight); + } } } } From 5465f4fb3dfa5e4faeb081c906554a20459c6b0f Mon Sep 17 00:00:00 2001 From: amikals <111276362+amikals@users.noreply.github.com> Date: Mon, 20 Oct 2025 11:52:02 +0200 Subject: [PATCH 821/986] [PWGDQ,PWGJE] DielectronAlltableJE (#13278) Co-authored-by: Andreas Mikalsen Co-authored-by: ALICE Action Bot --- PWGDQ/DataModel/ReducedInfoTables.h | 30 ++++++++-------- PWGJE/Core/JetCandidateUtilities.h | 2 +- PWGJE/Core/JetDQUtilities.h | 35 +++++++++++++++++-- PWGJE/DataModel/Jet.h | 4 +-- PWGJE/DataModel/JetReducedDataDQ.h | 8 ----- PWGJE/TableProducer/derivedDataWriter.cxx | 3 +- .../Tasks/jetSubstructureDielectronOutput.cxx | 2 +- 7 files changed, 54 insertions(+), 30 deletions(-) diff --git a/PWGDQ/DataModel/ReducedInfoTables.h b/PWGDQ/DataModel/ReducedInfoTables.h index dd92f5a9c76..40449639d1f 100644 --- a/PWGDQ/DataModel/ReducedInfoTables.h +++ b/PWGDQ/DataModel/ReducedInfoTables.h @@ -821,21 +821,21 @@ DECLARE_SOA_TABLE(DileptonsFlow, "AOD", "RTDILEPTONFLOW", //! DECLARE_SOA_TABLE(DileptonsInfo, "AOD", "RTDILEPTONINFO", reducedpair::CollisionId, collision::PosX, collision::PosY, collision::PosZ); -DECLARE_SOA_TABLE(DielectronsAll, "AOD", "RTDIELECTRONALL", //! - reducedpair::Mass, - reducedpair::Pt, reducedpair::Eta, reducedpair::Phi, reducedpair::Sign, - reducedpair::FilterMap, - reducedpair::McDecision, - dilepton_track_index::Pt1, dilepton_track_index::Eta1, dilepton_track_index::Phi1, dilepton_track_index::ITSClusterMap1, dilepton_track_index::ITSChi2NCl1, dilepton_track_index::TPCNClsCR1, dilepton_track_index::TPCNClsFound1, dilepton_track_index::TPCChi2NCl1, dilepton_track_index::DcaXY1, dilepton_track_index::DcaZ1, dilepton_track_index::TPCSignal1, dilepton_track_index::TPCNSigmaEl1, dilepton_track_index::TPCNSigmaPi1, dilepton_track_index::TPCNSigmaPr1, dilepton_track_index::TOFBeta1, dilepton_track_index::TOFNSigmaEl1, dilepton_track_index::TOFNSigmaPi1, dilepton_track_index::TOFNSigmaPr1, - dilepton_track_index::Pt2, dilepton_track_index::Eta2, dilepton_track_index::Phi2, dilepton_track_index::ITSClusterMap2, dilepton_track_index::ITSChi2NCl2, dilepton_track_index::TPCNClsCR2, dilepton_track_index::TPCNClsFound2, dilepton_track_index::TPCChi2NCl2, dilepton_track_index::DcaXY2, dilepton_track_index::DcaZ2, dilepton_track_index::TPCSignal2, dilepton_track_index::TPCNSigmaEl2, dilepton_track_index::TPCNSigmaPi2, dilepton_track_index::TPCNSigmaPr2, dilepton_track_index::TOFBeta2, dilepton_track_index::TOFNSigmaEl2, dilepton_track_index::TOFNSigmaPi2, dilepton_track_index::TOFNSigmaPr2, - dilepton_track_index::DCAxyzTrk0KF, dilepton_track_index::DCAxyzTrk1KF, reducedpair::DCAxyzBetweenTrksKF, dilepton_track_index::DCAxyTrk0KF, dilepton_track_index::DCAxyTrk1KF, reducedpair::DCAxyBetweenTrksKF, - dilepton_track_index::DeviationTrk0KF, dilepton_track_index::DeviationTrk1KF, dilepton_track_index::DeviationxyTrk0KF, dilepton_track_index::DeviationxyTrk1KF, - reducedpair::MassKFGeo, reducedpair::Chi2OverNDFKFGeo, reducedpair::DecayLengthKFGeo, reducedpair::DecayLengthOverErrKFGeo, reducedpair::DecayLengthXYKFGeo, reducedpair::DecayLengthXYOverErrKFGeo, reducedpair::PseudoproperDecayTimeKFGeo, reducedpair::PseudoproperDecayTimeErrKFGeo, reducedpair::CosPAKFGeo, reducedpair::PairDCAxyz, reducedpair::PairDCAxy, - reducedpair::DeviationPairKF, reducedpair::DeviationxyPairKF, - reducedpair::MassKFGeoTop, reducedpair::Chi2OverNDFKFGeoTop, - reducedpair::Tauz, reducedpair::Tauxy, - reducedpair::Lz, - reducedpair::Lxy); +DECLARE_SOA_TABLE_STAGED(DielectronsAll, "RTDIELECTRONALL", //! + reducedpair::Mass, + reducedpair::Pt, reducedpair::Eta, reducedpair::Phi, reducedpair::Sign, + reducedpair::FilterMap, + reducedpair::McDecision, + dilepton_track_index::Pt1, dilepton_track_index::Eta1, dilepton_track_index::Phi1, dilepton_track_index::ITSClusterMap1, dilepton_track_index::ITSChi2NCl1, dilepton_track_index::TPCNClsCR1, dilepton_track_index::TPCNClsFound1, dilepton_track_index::TPCChi2NCl1, dilepton_track_index::DcaXY1, dilepton_track_index::DcaZ1, dilepton_track_index::TPCSignal1, dilepton_track_index::TPCNSigmaEl1, dilepton_track_index::TPCNSigmaPi1, dilepton_track_index::TPCNSigmaPr1, dilepton_track_index::TOFBeta1, dilepton_track_index::TOFNSigmaEl1, dilepton_track_index::TOFNSigmaPi1, dilepton_track_index::TOFNSigmaPr1, + dilepton_track_index::Pt2, dilepton_track_index::Eta2, dilepton_track_index::Phi2, dilepton_track_index::ITSClusterMap2, dilepton_track_index::ITSChi2NCl2, dilepton_track_index::TPCNClsCR2, dilepton_track_index::TPCNClsFound2, dilepton_track_index::TPCChi2NCl2, dilepton_track_index::DcaXY2, dilepton_track_index::DcaZ2, dilepton_track_index::TPCSignal2, dilepton_track_index::TPCNSigmaEl2, dilepton_track_index::TPCNSigmaPi2, dilepton_track_index::TPCNSigmaPr2, dilepton_track_index::TOFBeta2, dilepton_track_index::TOFNSigmaEl2, dilepton_track_index::TOFNSigmaPi2, dilepton_track_index::TOFNSigmaPr2, + dilepton_track_index::DCAxyzTrk0KF, dilepton_track_index::DCAxyzTrk1KF, reducedpair::DCAxyzBetweenTrksKF, dilepton_track_index::DCAxyTrk0KF, dilepton_track_index::DCAxyTrk1KF, reducedpair::DCAxyBetweenTrksKF, + dilepton_track_index::DeviationTrk0KF, dilepton_track_index::DeviationTrk1KF, dilepton_track_index::DeviationxyTrk0KF, dilepton_track_index::DeviationxyTrk1KF, + reducedpair::MassKFGeo, reducedpair::Chi2OverNDFKFGeo, reducedpair::DecayLengthKFGeo, reducedpair::DecayLengthOverErrKFGeo, reducedpair::DecayLengthXYKFGeo, reducedpair::DecayLengthXYOverErrKFGeo, reducedpair::PseudoproperDecayTimeKFGeo, reducedpair::PseudoproperDecayTimeErrKFGeo, reducedpair::CosPAKFGeo, reducedpair::PairDCAxyz, reducedpair::PairDCAxy, + reducedpair::DeviationPairKF, reducedpair::DeviationxyPairKF, + reducedpair::MassKFGeoTop, reducedpair::Chi2OverNDFKFGeoTop, + reducedpair::Tauz, reducedpair::Tauxy, + reducedpair::Lz, + reducedpair::Lxy); DECLARE_SOA_TABLE(DimuonsAll, "AOD", "RTDIMUONALL", //! collision::PosX, collision::PosY, collision::PosZ, collision::NumContrib, diff --git a/PWGJE/Core/JetCandidateUtilities.h b/PWGJE/Core/JetCandidateUtilities.h index cf745964359..fd637ca169a 100644 --- a/PWGJE/Core/JetCandidateUtilities.h +++ b/PWGJE/Core/JetCandidateUtilities.h @@ -378,7 +378,7 @@ void fillCandidateTable(T const& candidate, int32_t collisionIndex, U& BaseTable if constexpr (jethfutilities::isHFCandidate()) { jethfutilities::fillHFCandidateTable(candidate, collisionIndex, BaseTable, HFParTable, HFParETable, HFParDaughterTable, HFSelectionFlagTable, HFMlTable, HFMlDaughterTable, HFMCDTable); } else if constexpr (jetdqutilities::isDielectronCandidate()) { - jetdqutilities::fillDielectronCandidateTable(candidate, collisionIndex, BaseTable); + jetdqutilities::fillDielectronCandidateTable(candidate, collisionIndex, BaseTable, HFParTable); } } diff --git a/PWGJE/Core/JetDQUtilities.h b/PWGJE/Core/JetDQUtilities.h index 6f33ae0749d..fbca70b178d 100644 --- a/PWGJE/Core/JetDQUtilities.h +++ b/PWGJE/Core/JetDQUtilities.h @@ -313,10 +313,41 @@ void fillDielectronMcCollisionTable(T const& mcCollision, U& DielectronMcCollisi DielectronMcCollisionTable(mcCollision.posX(), mcCollision.posY(), mcCollision.posZ()); } -template -void fillDielectronCandidateTable(T const& candidate, int32_t collisionIndex, U& DielectronTable) +template +void fillDielectronCandidateTable(T const& candidate, int32_t collisionIndex, U& DielectronTable, V& DielectronAllTable) { DielectronTable(collisionIndex, candidate.mass(), candidate.pt(), candidate.eta(), candidate.phi(), candidate.sign(), candidate.filterMap_raw(), candidate.mcDecision()); + + DielectronAllTable( + candidate.mass(), candidate.pt(), candidate.eta(), candidate.phi(), candidate.sign(), + candidate.filterMap_raw(), candidate.mcDecision(), + + candidate.pt1(), candidate.eta1(), candidate.phi1(), + candidate.itsClusterMap1(), candidate.itsChi2NCl1(), + candidate.tpcNClsCR1(), candidate.tpcNClsFound1(), candidate.tpcChi2NCl1(), + candidate.dcaXY1(), candidate.dcaZ1(), + candidate.tpcSignal1(), candidate.tpcNSigmaEl1(), candidate.tpcNSigmaPi1(), candidate.tpcNSigmaPr1(), + candidate.tofBeta1(), candidate.tofNSigmaEl1(), candidate.tofNSigmaPi1(), candidate.tofNSigmaPr1(), + + candidate.pt2(), candidate.eta2(), candidate.phi2(), + candidate.itsClusterMap2(), candidate.itsChi2NCl2(), + candidate.tpcNClsCR2(), candidate.tpcNClsFound2(), candidate.tpcChi2NCl2(), + candidate.dcaXY2(), candidate.dcaZ2(), + candidate.tpcSignal2(), candidate.tpcNSigmaEl2(), candidate.tpcNSigmaPi2(), candidate.tpcNSigmaPr2(), + candidate.tofBeta2(), candidate.tofNSigmaEl2(), candidate.tofNSigmaPi2(), candidate.tofNSigmaPr2(), + + candidate.dcaxyztrk0KF(), candidate.dcaxyztrk1KF(), candidate.dcaxyzbetweentrksKF(), + candidate.dcaxytrk0KF(), candidate.dcaxytrk1KF(), candidate.dcaxybetweentrksKF(), + candidate.deviationTrk0KF(), candidate.deviationTrk1KF(), + candidate.deviationxyTrk0KF(), candidate.deviationxyTrk1KF(), + candidate.massKFGeo(), candidate.chi2overndfKFGeo(), + candidate.decaylengthKFGeo(), candidate.decaylengthovererrKFGeo(), + candidate.decaylengthxyKFGeo(), candidate.decaylengthxyovererrKFGeo(), + candidate.pseudoproperdecaytimeKFGeo(), candidate.pseudoproperdecaytimeErrKFGeo(), candidate.cosPAKFGeo(), + candidate.pairDCAxyz(), candidate.pairDCAxy(), + candidate.deviationPairKF(), candidate.deviationxyPairKF(), + candidate.massKFGeoTop(), candidate.chi2overndfKFGeoTop(), + candidate.tauz(), candidate.tauxy(), candidate.lz(), candidate.lxy()); } template diff --git a/PWGJE/DataModel/Jet.h b/PWGJE/DataModel/Jet.h index 9ff72f65448..f4afdc17d1f 100644 --- a/PWGJE/DataModel/Jet.h +++ b/PWGJE/DataModel/Jet.h @@ -288,8 +288,8 @@ using McCollisionsV0 = o2::soa::Join; using CandidatesV0MCP = o2::soa::Join; using CollisionsDielectron = o2::soa::Join; -using CandidatesDielectronData = o2::soa::Join; -using CandidatesDielectronMCD = o2::soa::Join; +using CandidatesDielectronData = o2::soa::Join; +using CandidatesDielectronMCD = o2::soa::Join; using JetTracksSubDielectron = JTrackDielectronSubs; using JetParticlesSubDielectron = JMcParticleDielectronSubs; using McCollisionsDielectron = o2::soa::Join; diff --git a/PWGJE/DataModel/JetReducedDataDQ.h b/PWGJE/DataModel/JetReducedDataDQ.h index f86754d3a84..5bc14c333f3 100644 --- a/PWGJE/DataModel/JetReducedDataDQ.h +++ b/PWGJE/DataModel/JetReducedDataDQ.h @@ -148,14 +148,6 @@ DECLARE_SOA_TABLE(JDielectron6Dummys, "AOD", "JDIEL6DUMMY", jdummydq::DummyDQ, o2::soa::Marker<6>); -DECLARE_SOA_TABLE(JDielectron7Dummys, "AOD", "JDIEL7DUMMY", - jdummydq::DummyDQ, - o2::soa::Marker<7>); - -DECLARE_SOA_TABLE(JDielectron8Dummys, "AOD", "JDIEL8DUMMY", - jdummydq::DummyDQ, - o2::soa::Marker<8>); - } // namespace o2::aod #endif // PWGJE_DATAMODEL_JETREDUCEDDATADQ_H_ diff --git a/PWGJE/TableProducer/derivedDataWriter.cxx b/PWGJE/TableProducer/derivedDataWriter.cxx index 0ee9242ebac..3453874c25f 100644 --- a/PWGJE/TableProducer/derivedDataWriter.cxx +++ b/PWGJE/TableProducer/derivedDataWriter.cxx @@ -239,6 +239,7 @@ struct JetDerivedDataWriter { Produces storedDielectronCollisionIdsTable; Produces storedDielectronsTable; Produces storedDielectronIdsTable; + Produces storedDielectronsAllTable; Produces storedDielectronMcCollisionsTable; Produces storedDielectronMcCollisionIdsTable; Produces storedDielectronMcRCollDummysTable; @@ -626,7 +627,7 @@ struct JetDerivedDataWriter { products.productsDielectron.storedDielectronCollisionIdsTable(collisionMapping[collision.globalIndex()]); } for (const auto& DielectronCandidate : DielectronCandidates) { - jetdqutilities::fillDielectronCandidateTable(DielectronCandidate, products.productsDielectron.storedDielectronCollisionsTable.lastIndex(), products.productsDielectron.storedDielectronsTable); + jetdqutilities::fillDielectronCandidateTable(DielectronCandidate, products.productsDielectron.storedDielectronCollisionsTable.lastIndex(), products.productsDielectron.storedDielectronsTable, products.productsDielectron.storedDielectronsAllTable); products.productsDielectron.storedDielectronIdsTable(collisionMapping[collision.globalIndex()], trackMapping[DielectronCandidate.prong0Id()], trackMapping[DielectronCandidate.prong1Id()]); } } diff --git a/PWGJE/Tasks/jetSubstructureDielectronOutput.cxx b/PWGJE/Tasks/jetSubstructureDielectronOutput.cxx index 84ef77afc4e..3ad3afad83e 100644 --- a/PWGJE/Tasks/jetSubstructureDielectronOutput.cxx +++ b/PWGJE/Tasks/jetSubstructureDielectronOutput.cxx @@ -29,7 +29,7 @@ #include -using JetSubstructureOutputDielectron = JetSubstructureHFOutputTask, aod::McCollisionsDielectron, aod::CandidatesDielectronData, aod::CandidatesDielectronMCD, aod::CandidatesDielectronMCP, aod::BkgDielectronRhos, aod::BkgDielectronMcRhos, aod::JTrackDielectronSubs, soa::Join, soa::Join, soa::Join, soa::Join, aod::DielectronCJetCOs, aod::DielectronCJetOs, aod::DielectronCJetSSOs, aod::DielectronCJetMOs, soa::Join, soa::Join, soa::Join, aod::DielectronCMCDJetCOs, aod::DielectronCMCDJetOs, aod::DielectronCMCDJetSSOs, aod::DielectronCMCDJetMOs, soa::Join, soa::Join, soa::Join, soa::Join, aod::DielectronCMCPJetCOs, aod::DielectronCMCPJetMCCOs, aod::DielectronCMCPJetOs, aod::DielectronCMCPJetSSOs, aod::DielectronCMCPJetMOs, soa::Join, soa::Join, soa::Join, aod::DielectronCEWSJetCOs, aod::DielectronCEWSJetOs, aod::DielectronCEWSJetSSOs, aod::DielectronCEWSJetMOs, aod::StoredReducedEvents, aod::StoredDielectrons, aod::JDielectron1Dummys, aod::JDielectron2Dummys, aod::JDielectron3Dummys, aod::JDielectron4Dummys, aod::JDielectron5Dummys, aod::JDielectron6Dummys, aod::JDielectron7Dummys, aod::StoredJDielectronMcCollisions, aod::JDielectronMcRCollDummys, aod::StoredJDielectronMcs>; +using JetSubstructureOutputDielectron = JetSubstructureHFOutputTask, aod::McCollisionsDielectron, aod::CandidatesDielectronData, aod::CandidatesDielectronMCD, aod::CandidatesDielectronMCP, aod::BkgDielectronRhos, aod::BkgDielectronMcRhos, aod::JTrackDielectronSubs, soa::Join, soa::Join, soa::Join, soa::Join, aod::DielectronCJetCOs, aod::DielectronCJetOs, aod::DielectronCJetSSOs, aod::DielectronCJetMOs, soa::Join, soa::Join, soa::Join, aod::DielectronCMCDJetCOs, aod::DielectronCMCDJetOs, aod::DielectronCMCDJetSSOs, aod::DielectronCMCDJetMOs, soa::Join, soa::Join, soa::Join, soa::Join, aod::DielectronCMCPJetCOs, aod::DielectronCMCPJetMCCOs, aod::DielectronCMCPJetOs, aod::DielectronCMCPJetSSOs, aod::DielectronCMCPJetMOs, soa::Join, soa::Join, soa::Join, aod::DielectronCEWSJetCOs, aod::DielectronCEWSJetOs, aod::DielectronCEWSJetSSOs, aod::DielectronCEWSJetMOs, aod::StoredReducedEvents, aod::StoredDielectrons, aod::StoredDielectronsAll, aod::JDielectron1Dummys, aod::JDielectron2Dummys, aod::JDielectron3Dummys, aod::JDielectron4Dummys, aod::JDielectron5Dummys, aod::JDielectron6Dummys, aod::StoredJDielectronMcCollisions, aod::JDielectronMcRCollDummys, aod::StoredJDielectronMcs>; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { From 630fed0a24a1e46011448ffee9f85977a041afcc Mon Sep 17 00:00:00 2001 From: suyoupeng <109774812+15071832337@users.noreply.github.com> Date: Mon, 20 Oct 2025 20:37:09 +0800 Subject: [PATCH 822/986] [PWGLF] Local polarization of Lambda induced by jets in Run3 pp collisions at 13.6 TeV (#13456) --- PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx b/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx index 16af3ee5bcc..1429e12fcc2 100644 --- a/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx @@ -282,6 +282,7 @@ struct LfMyV0s { registryData.add("V0LambdaprotonPhi", "V0LambdaprotonPhi", {HistType::kTH1F, {{200, -TMath::Pi() / 2, TMath::Pi() / 2}}}); registryData.add("profileAntiLambda", "Invariant Mass vs sin(phi)", {HistType::kTProfile, {{200, 0.9, 1.2}}}); + registryData.add("TProfile1DLambdasinphiInJet", "#Delta #theta vs sin(phi)", {HistType::kTProfile, {{200, 0.0, TMath::Pi()}}}); registryData.add("hAntiLambdamassandSinPhi", "hAntiLambdaPhiandSinPhi", kTH2F, {{200, -TMath::Pi() / 2, TMath::Pi() / 2}, {200, -1, 1}}); registryData.add("TProfile2DLambdaPtMassSinPhi", "", kTProfile2D, {TProfile2DaxisMass, TProfile2DaxisPt}); @@ -292,6 +293,7 @@ struct LfMyV0s { registryData.add("TProfile2DLambdaPtMassCosSquareTheta", "", kTProfile2D, {TProfile2DaxisMass, TProfile2DaxisPt}); registryData.add("TProfile2DAntiLambdaPtMassCosSquareTheta", "", kTProfile2D, {TProfile2DaxisMass, TProfile2DaxisPt}); registryData.add("TProfile2DLambdaMassDeltaPhi", "", kTProfile2D, {{200, -TMath::Pi(), TMath::Pi(), "#Delta#varphi"}, TProfile2DaxisMass}); + registryData.add("TProfile2DLambdaMassDeltaTheta", "", kTProfile2D, {{200, 0, TMath::Pi(), "#Delta#theta"}, TProfile2DaxisMass}); registryData.add("TProfile2DAntiLambdaMassDeltaPhi", "", kTProfile2D, {{200, -TMath::Pi(), TMath::Pi(), "#Delta#varphi"}, TProfile2DaxisMass}); registryData.add("hprotonThetaInLab", "hprotonThetaInLab", kTH1F, {axisTheta}); registryData.add("hprotonThetaInV0", "hprotonThetaInV0", kTH1F, {axisTheta}); @@ -1279,6 +1281,10 @@ struct LfMyV0s { TMatrixD lambdaInJet(4, 1); lambdaInJet = MyTMatrixTranslationToJet(maxJetpx, maxJetpy, maxJetpz, candidate.px(), candidate.py(), candidate.pz()) * pLabV0; + double cosThetaLambdaInJet = lambdaInJet(3, 0) / sqrt(lambdaInJet(1, 0) * lambdaInJet(1, 0) + lambdaInJet(2, 0) * lambdaInJet(2, 0) + lambdaInJet(3, 0) * lambdaInJet(3, 0)); + double lambdasinphiInJet = lambdaInJet(2, 0) / sqrt(lambdaInJet(1, 0) * lambdaInJet(1, 0) + lambdaInJet(2, 0) * lambdaInJet(2, 0)); + registryData.fill(HIST("TProfile2DLambdaMassDeltaTheta"), TMath::ACos(cosThetaLambdaInJet), candidate.mLambda(), lambdasinphiInJet); + registryData.fill(HIST("TProfile1DLambdasinphiInJet"), TMath::ACos(cosThetaLambdaInJet), lambdasinphiInJet); TMatrixD lambdaInJetV0(4, 1); lambdaInJetV0 = LorentzTransInV0frame(ELambda, lambdaInJet(1, 0), lambdaInJet(2, 0), lambdaInJet(3, 0)) * MyTMatrixTranslationToJet(maxJetpx, maxJetpy, maxJetpz, candidate.px(), candidate.py(), candidate.pz()) * pLabV0; From 44044287a8f9836debf8d508ce0ffac62dab83c8 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Mon, 20 Oct 2025 18:07:45 +0200 Subject: [PATCH 823/986] [PWGEM/Dilepton] fix mc label of muon (#13458) --- .../TableProducer/associateMCinfoDilepton.cxx | 4 +- .../TableProducer/skimmerPrimaryMuon.cxx | 61 +++++++++++-------- 2 files changed, 36 insertions(+), 29 deletions(-) diff --git a/PWGEM/Dilepton/TableProducer/associateMCinfoDilepton.cxx b/PWGEM/Dilepton/TableProducer/associateMCinfoDilepton.cxx index 6bd004a0e40..0d62389cdfc 100644 --- a/PWGEM/Dilepton/TableProducer/associateMCinfoDilepton.cxx +++ b/PWGEM/Dilepton/TableProducer/associateMCinfoDilepton.cxx @@ -531,13 +531,13 @@ struct AssociateMCInfoDilepton { // mc label for tracks registered in MFT in global muons if (o2track.matchMFTTrackId() > -1) { - const auto& o2mfttrack = o2track.template matchMFTTrack_as(); + auto o2mfttrack = o2track.template matchMFTTrack_as(); if (!o2mfttrack.has_mcParticle()) { emmftmclabels(-1, 0); break; } - const auto& mco2mfttrack = o2mfttrack.template mcParticle_as(); + auto mco2mfttrack = o2mfttrack.template mcParticle_as(); if (!(fNewLabels.find(mco2mfttrack.globalIndex()) != fNewLabels.end())) { fNewLabels[mco2mfttrack.globalIndex()] = fCounters[0]; fNewLabelsReversed[fCounters[0]] = mco2mfttrack.globalIndex(); diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx index 0c97c573394..353fbc37fdd 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx @@ -132,7 +132,7 @@ struct skimmerPrimaryMuon { const double centerMFT[3] = {0, 0, -61.4}; o2::field::MagneticField* field = static_cast(TGeoGlobalMagField::Instance()->GetField()); mBz = field->getBz(centerMFT); // Get field at centre of MFT - LOGF(info, "Bz at center of MFT = %f kZG", mBz); // this is dummy comment. // dummy2 + LOGF(info, "Bz at center of MFT = %f kZG", mBz); } void addHistograms() @@ -213,7 +213,7 @@ struct skimmerPrimaryMuon { return true; } - template + template void fillFwdTrackTable(TCollision const& collision, TFwdTrack fwdtrack, TMFTTracksCov const& mftCovs, const bool isAmbiguous) { if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && fwdtrack.chi2MatchMCHMFT() > maxMatchingChi2MCHMFT) { @@ -284,8 +284,15 @@ struct skimmerPrimaryMuon { return; } - const auto& mchtrack = fwdtrack.template matchMCHTrack_as(); // MCH-MID - const auto& mfttrack = fwdtrack.template matchMFTTrack_as(); // MFTsa + auto mchtrack = fwdtrack.template matchMCHTrack_as(); // MCH-MID + auto mfttrack = fwdtrack.template matchMFTTrack_as(); // MFTsa + + if constexpr (isMC) { + if (!mfttrack.has_mcParticle()) { + return; + } + } + nClustersMFT = mfttrack.nClusters(); mftClusterSizesAndTrackFlags = mfttrack.mftClusterSizesAndTrackFlags(); ndf_mchmft = 2.f * (mchtrack.nClusters() + nClustersMFT) - 5.f; @@ -510,7 +517,7 @@ struct skimmerPrimaryMuon { continue; } - fillFwdTrackTable(collision, fwdtrack, nullptr, false); + fillFwdTrackTable(collision, fwdtrack, nullptr, false); } // end of fwdtrack loop } // end of collision loop @@ -549,7 +556,7 @@ struct skimmerPrimaryMuon { continue; } - fillFwdTrackTable(collision, fwdtrack, nullptr, mapAmb[fwdtrack.globalIndex()]); + fillFwdTrackTable(collision, fwdtrack, nullptr, mapAmb[fwdtrack.globalIndex()]); } // end of fwdtrack loop } // end of collision loop @@ -592,7 +599,7 @@ struct skimmerPrimaryMuon { continue; } - fillFwdTrackTable(collision, fwdtrack, mftCovs, mapAmb[fwdtrack.globalIndex()]); + fillFwdTrackTable(collision, fwdtrack, mftCovs, mapAmb[fwdtrack.globalIndex()]); } // end of fwdtrack loop } // end of collision loop mapAmb.clear(); @@ -627,7 +634,7 @@ struct skimmerPrimaryMuon { continue; } - fillFwdTrackTable(collision, fwdtrack, nullptr, false); + fillFwdTrackTable(collision, fwdtrack, nullptr, false); } // end of fwdtrack loop } // end of collision loop map_mfttrackcovs.clear(); @@ -667,7 +674,7 @@ struct skimmerPrimaryMuon { continue; } - fillFwdTrackTable(collision, fwdtrack, nullptr, mapAmb[fwdtrack.globalIndex()]); + fillFwdTrackTable(collision, fwdtrack, nullptr, mapAmb[fwdtrack.globalIndex()]); } // end of fwdtrack loop } // end of collision loop mapAmb.clear(); @@ -686,13 +693,13 @@ struct skimmerPrimaryMuon { std::unordered_map mapAmb; // fwdtrack.globalIndex() -> bool isAmb; for (const auto& fwdtrack : fwdtracks) { - const auto& fwdtrackIdsPerFwdTrack = fwdtrackIndices.sliceBy(fwdtrackIndicesPerFwdTrack, fwdtrack.globalIndex()); + auto fwdtrackIdsPerFwdTrack = fwdtrackIndices.sliceBy(fwdtrackIndicesPerFwdTrack, fwdtrack.globalIndex()); mapAmb[fwdtrack.globalIndex()] = fwdtrackIdsPerFwdTrack.size() > 1; // LOGF(info, "fwdtrack.globalIndex() = %d, ntimes = %d, isAmbiguous = %d", fwdtrack.globalIndex(), fwdtrackIdsPerFwdTrack.size(), mapAmb[fwdtrack.globalIndex()]); } // end of fwdtrack loop for (const auto& collision : collisions) { - const auto& bc = collision.template bc_as(); + auto bc = collision.template bc_as(); initCCDB(bc); if (!collision.isSelected()) { continue; @@ -701,9 +708,9 @@ struct skimmerPrimaryMuon { continue; } - const auto& fwdtrackIdsThisCollision = fwdtrackIndices.sliceBy(fwdtrackIndicesPerCollision, collision.globalIndex()); + auto fwdtrackIdsThisCollision = fwdtrackIndices.sliceBy(fwdtrackIndicesPerCollision, collision.globalIndex()); for (const auto& fwdtrackId : fwdtrackIdsThisCollision) { - const auto& fwdtrack = fwdtrackId.template fwdtrack_as(); + auto fwdtrack = fwdtrackId.template fwdtrack_as(); if (fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) { continue; } @@ -711,7 +718,7 @@ struct skimmerPrimaryMuon { continue; } - fillFwdTrackTable(collision, fwdtrack, mftCovs, mapAmb[fwdtrack.globalIndex()]); + fillFwdTrackTable(collision, fwdtrack, mftCovs, mapAmb[fwdtrack.globalIndex()]); } // end of fwdtrack loop } // end of collision loop mapAmb.clear(); @@ -726,7 +733,7 @@ struct skimmerPrimaryMuon { findBestMatchPerMCHMID(fwdtracks); for (const auto& collision : collisions) { - const auto& bc = collision.template bc_as(); + auto bc = collision.template bc_as(); initCCDB(bc); if (!collision.isSelected()) { continue; @@ -735,7 +742,7 @@ struct skimmerPrimaryMuon { continue; } - const auto& fwdtracks_per_coll = fwdtracks.sliceBy(perCollision, collision.globalIndex()); + auto fwdtracks_per_coll = fwdtracks.sliceBy(perCollision, collision.globalIndex()); for (const auto& fwdtrack : fwdtracks_per_coll) { if (!fwdtrack.has_mcParticle()) { continue; @@ -747,7 +754,7 @@ struct skimmerPrimaryMuon { continue; } - fillFwdTrackTable(collision, fwdtrack, nullptr, false); + fillFwdTrackTable(collision, fwdtrack, nullptr, false); } // end of fwdtrack loop } // end of collision loop map_mfttrackcovs.clear(); @@ -762,13 +769,13 @@ struct skimmerPrimaryMuon { std::unordered_map mapAmb; // fwdtrack.globalIndex() -> bool isAmb; for (const auto& fwdtrack : fwdtracks) { - const auto& fwdtrackIdsPerFwdTrack = fwdtrackIndices.sliceBy(fwdtrackIndicesPerFwdTrack, fwdtrack.globalIndex()); + auto fwdtrackIdsPerFwdTrack = fwdtrackIndices.sliceBy(fwdtrackIndicesPerFwdTrack, fwdtrack.globalIndex()); mapAmb[fwdtrack.globalIndex()] = fwdtrackIdsPerFwdTrack.size() > 1; // LOGF(info, "fwdtrack.globalIndex() = %d, ntimes = %d, isAmbiguous = %d", fwdtrack.globalIndex(), fwdtrackIdsPerFwdTrack.size(), mapAmb[fwdtrack.globalIndex()]); } // end of fwdtrack loop for (const auto& collision : collisions) { - const auto& bc = collision.template bc_as(); + auto bc = collision.template bc_as(); initCCDB(bc); if (!collision.isSelected()) { continue; @@ -777,9 +784,9 @@ struct skimmerPrimaryMuon { continue; } - const auto& fwdtrackIdsThisCollision = fwdtrackIndices.sliceBy(fwdtrackIndicesPerCollision, collision.globalIndex()); + auto fwdtrackIdsThisCollision = fwdtrackIndices.sliceBy(fwdtrackIndicesPerCollision, collision.globalIndex()); for (const auto& fwdtrackId : fwdtrackIdsThisCollision) { - const auto& fwdtrack = fwdtrackId.template fwdtrack_as(); + auto fwdtrack = fwdtrackId.template fwdtrack_as(); if (!fwdtrack.has_mcParticle()) { continue; } @@ -790,7 +797,7 @@ struct skimmerPrimaryMuon { continue; } - fillFwdTrackTable(collision, fwdtrack, nullptr, mapAmb[fwdtrack.globalIndex()]); + fillFwdTrackTable(collision, fwdtrack, nullptr, mapAmb[fwdtrack.globalIndex()]); } // end of fwdtrack loop } // end of collision loop mapAmb.clear(); @@ -809,13 +816,13 @@ struct skimmerPrimaryMuon { std::unordered_map mapAmb; // fwdtrack.globalIndex() -> bool isAmb; for (const auto& fwdtrack : fwdtracks) { - const auto& fwdtrackIdsPerFwdTrack = fwdtrackIndices.sliceBy(fwdtrackIndicesPerFwdTrack, fwdtrack.globalIndex()); + auto fwdtrackIdsPerFwdTrack = fwdtrackIndices.sliceBy(fwdtrackIndicesPerFwdTrack, fwdtrack.globalIndex()); mapAmb[fwdtrack.globalIndex()] = fwdtrackIdsPerFwdTrack.size() > 1; // LOGF(info, "fwdtrack.globalIndex() = %d, ntimes = %d, isAmbiguous = %d", fwdtrack.globalIndex(), fwdtrackIdsPerFwdTrack.size(), mapAmb[fwdtrack.globalIndex()]); } // end of fwdtrack loop for (const auto& collision : collisions) { - const auto& bc = collision.template bc_as(); + auto bc = collision.template bc_as(); initCCDB(bc); if (!collision.isSelected()) { continue; @@ -824,9 +831,9 @@ struct skimmerPrimaryMuon { continue; } - const auto& fwdtrackIdsThisCollision = fwdtrackIndices.sliceBy(fwdtrackIndicesPerCollision, collision.globalIndex()); + auto fwdtrackIdsThisCollision = fwdtrackIndices.sliceBy(fwdtrackIndicesPerCollision, collision.globalIndex()); for (const auto& fwdtrackId : fwdtrackIdsThisCollision) { - const auto& fwdtrack = fwdtrackId.template fwdtrack_as(); + auto fwdtrack = fwdtrackId.template fwdtrack_as(); if (!fwdtrack.has_mcParticle()) { continue; } @@ -837,7 +844,7 @@ struct skimmerPrimaryMuon { continue; } - fillFwdTrackTable(collision, fwdtrack, mftCovs, mapAmb[fwdtrack.globalIndex()]); + fillFwdTrackTable(collision, fwdtrack, mftCovs, mapAmb[fwdtrack.globalIndex()]); } // end of fwdtrack loop } // end of collision loop mapAmb.clear(); From 67f45b168e501f7080be211d3fc5e7bbb64220b6 Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Mon, 20 Oct 2025 18:11:19 +0200 Subject: [PATCH 824/986] [PWGCF] FemtoUniverse: Add eta, pT cuts on MCTruth tracks (#13457) --- .../TableProducer/femtoUniverseProducerTask.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx index 78234e1ea41..19fb3fc50d0 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx @@ -240,6 +240,7 @@ struct FemtoUniverseProducerTask { Configurable confDcaXYCustom1Cut{"confDcaXYCustom1Cut", true, "Enable Custom |DCAxy| < [1] + [2]/pt cut."}; Configurable confDcaXYCustom11FilterCut{"confDcaXYCustom11FilterCut", 0.004, "Value for [1] custom DCAxy cut -> |DCAxy| < [1] + [2]/pT"}; Configurable confDcaXYCustom12FilterCut{"confDcaXYCustom12FilterCut", 0.013, "Value for [2] custom DCAxy cut -> |DCAxy| < [1] + [2]/pT"}; + Configurable confIsApplyTrkCutMCTruth{"confIsApplyTrkCutMCTruth", false, "Apply eta, pT selection cut on MCTruth tracks "}; } ConfFilterCuts; Filter globalCutFilter = requireGlobalTrackInFilter(); @@ -1361,7 +1362,11 @@ struct FemtoUniverseProducerTask { void fillTracksMCTruth(MCParticlesType const& mcParticles) { for (const auto& mc : mcParticles) { // Loop over all MC Truth particles - + if (ConfFilterCuts.confIsApplyTrkCutMCTruth) { + if (std::abs(mc.eta()) > ConfFilterCuts.confEtaFilterCut || mc.pt() < ConfFilterCuts.confPtLowFilterCut || mc.pt() > ConfFilterCuts.confPtHighFilterCut) { + continue; + } + } std::vector childIDs = {0, 0}; outputParts(outputCollision.lastIndex(), mc.pt(), From dbac26bbcc8f5b03a035ad119e8573a625c663b7 Mon Sep 17 00:00:00 2001 From: Maximiliano Puccio Date: Mon, 20 Oct 2025 19:16:27 +0200 Subject: [PATCH 825/986] [PWGLF] feat(hypernuclei): Add process code for MC analysis (#13459) --- PWGLF/DataModel/LFHypernucleiTables.h | 2 +- PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx | 46 ++++++++++---------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/PWGLF/DataModel/LFHypernucleiTables.h b/PWGLF/DataModel/LFHypernucleiTables.h index 2ec1e718df5..35a1f7ba51c 100644 --- a/PWGLF/DataModel/LFHypernucleiTables.h +++ b/PWGLF/DataModel/LFHypernucleiTables.h @@ -150,7 +150,7 @@ DECLARE_SOA_TABLE(MCHypCands, "AOD", "MCHYPCANDS", hyperrec::IsSignal, hyperrec::IsRecoMCCollision, hyperrec::IsSurvEvSel, - hyperrec::IsTwoBodyDecay); + hyperrec::IsTwoBodyDecay, aod::mcparticle::StatusCode); DECLARE_SOA_TABLE(DataHypCandsWColl, "AOD", "HYPCANDSWCOLL", o2::soa::Index<>, diff --git a/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx b/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx index de6d3e599bf..b94111287bf 100644 --- a/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx @@ -48,7 +48,6 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -using std::array; using CollBracket = o2::math_utils::Bracket; using TracksFull = soa::Join; using CollisionsFull = soa::Join; @@ -166,7 +165,7 @@ struct hyperRecoTask { // Define o2 fitter, 2-prong, active memory (no need to redefine per event) o2::vertexing::DCAFitterN<2> fitter; - svPoolCreator svCreator{heDauPdg, 211}; + svPoolCreator svCreator{heDauPdg, PDG_t::kPiPlus}; // daughter masses float he3Mass = o2::constants::physics::MassHelium3; @@ -552,7 +551,7 @@ struct hyperRecoTask { if (mBBparamsHe[5] < 0) { LOG(fatal) << "Bethe-Bloch parameters for He3 not set, please check your CCDB and configuration"; } - for (auto& v0 : V0s) { + for (const auto& v0 : V0s) { // if(v0.isStandardV0()) // continue; auto posTrack = tracks.rawIteratorAt(v0.posTrackId()); @@ -593,7 +592,7 @@ struct hyperRecoTask { svCreator.clearPools(); svCreator.fillBC2Coll(collisions, bcs); - for (auto& track : tracks) { + for (const auto& track : tracks) { if (std::abs(track.eta()) > etaMax) continue; @@ -603,7 +602,7 @@ struct hyperRecoTask { auto nSigmaHe = computeNSigmaHe3(track); bool isHe = nSigmaHe > -1 * nSigmaMaxHe; - int pdgHypo = isHe ? heDauPdg : 211; + int pdgHypo = isHe ? heDauPdg : PDG_t::kPiPlus; // LOG(info) << "ncls found: " << track.tpcNClsFound(); if (isHe && track.tpcNClsFound() < nTPCClusMinHe) continue; @@ -615,7 +614,7 @@ struct hyperRecoTask { auto& svPool = svCreator.getSVCandPool(collisions); LOG(debug) << "SV pool size: " << svPool.size(); - for (auto& svCand : svPool) { + for (const auto& svCand : svPool) { auto heTrack = tracks.rawIteratorAt(svCand.tr0Idx); auto piTrack = tracks.rawIteratorAt(svCand.tr1Idx); auto collIdxs = svCand.collBracket; @@ -634,19 +633,19 @@ struct hyperRecoTask { auto mcTrackHe = mcLabHe.mcParticle_as(); auto mcTrackPi = mcLabPi.mcParticle_as(); if (mcTrackHe.has_mothers() && mcTrackPi.has_mothers()) { - for (auto& heMother : mcTrackHe.mothers_as()) { - for (auto& piMother : mcTrackPi.mothers_as()) { + for (const auto& heMother : mcTrackHe.mothers_as()) { + for (const auto& piMother : mcTrackPi.mothers_as()) { if (heMother.globalIndex() != piMother.globalIndex()) continue; - if (std::abs(mcTrackHe.pdgCode()) != heDauPdg || std::abs(mcTrackPi.pdgCode()) != 211) + if (std::abs(mcTrackHe.pdgCode()) != heDauPdg || std::abs(mcTrackPi.pdgCode()) != PDG_t::kPiPlus) continue; if (std::abs(heMother.pdgCode()) != hyperPdg) continue; - auto primVtx = array{heMother.vx(), heMother.vy(), heMother.vz()}; - auto secVtx = array{mcTrackHe.vx(), mcTrackHe.vy(), mcTrackHe.vz()}; - hypCand.gMom = array{heMother.px(), heMother.py(), heMother.pz()}; - hypCand.gMomHe3 = array{mcTrackHe.px(), mcTrackHe.py(), mcTrackHe.pz()}; + auto primVtx = std::array{heMother.vx(), heMother.vy(), heMother.vz()}; + auto secVtx = std::array{mcTrackHe.vx(), mcTrackHe.vy(), mcTrackHe.vz()}; + hypCand.gMom = std::array{heMother.px(), heMother.py(), heMother.pz()}; + hypCand.gMomHe3 = std::array{mcTrackHe.px(), mcTrackHe.py(), mcTrackHe.pz()}; for (int i = 0; i < 3; i++) { hypCand.gDecVtx[i] = secVtx[i] - primVtx[i]; } @@ -683,7 +682,7 @@ struct hyperRecoTask { selectGoodCollisions(collisions); useCustomVertexer ? fillCustomV0s(collisions, tracks, ambiTracks, bcs) : fillV0s(collisions, tracks, V0s); - for (auto& hypCand : hyperCandidates) { + for (const auto& hypCand : hyperCandidates) { auto collision = collisions.rawIteratorAt(hypCand.collisionID); float trackedHypClSize = !trackedClSize.empty() ? trackedClSize[hypCand.v0ID] : 0; outputDataTable(collision.centFT0A(), collision.centFT0C(), collision.centFT0M(), @@ -712,7 +711,7 @@ struct hyperRecoTask { selectGoodCollisions(collisions); useCustomVertexer ? fillCustomV0s(collisions, tracks, ambiTracks, bcs) : fillV0s(collisions, tracks, V0s); - for (auto& hypCand : hyperCandidates) { + for (const auto& hypCand : hyperCandidates) { auto collision = collisions.rawIteratorAt(hypCand.collisionID); if (isEventUsedForEPCalibration && !collision.triggereventep()) { return; @@ -746,7 +745,7 @@ struct hyperRecoTask { selectGoodCollisions(collisions); useCustomVertexer ? fillCustomV0s(collisions, tracks, ambiTracks, bcs) : fillV0s(collisions, tracks, V0s); - for (auto& hypCand : hyperCandidates) { + for (const auto& hypCand : hyperCandidates) { auto collision = collisions.rawIteratorAt(hypCand.collisionID); float trackedHypClSize = !trackedClSize.empty() ? trackedClSize[hypCand.v0ID] : 0; outputDataTableWithCollID(hypCand.collisionID, collision.centFT0A(), collision.centFT0C(), collision.centFT0M(), @@ -779,7 +778,7 @@ struct hyperRecoTask { selectGoodCollisionsMC(collisions); useCustomVertexer ? fillCustomV0s(collisions, tracks, ambiTracks, bcs) : fillV0s(collisions, tracks, V0s); fillMCinfo(trackLabelsMC, particlesMC); - for (auto& hypCand : hyperCandidates) { + for (const auto& hypCand : hyperCandidates) { auto collision = collisions.rawIteratorAt(hypCand.collisionID); if (!hypCand.isSignal && mcSignalOnly) continue; @@ -798,11 +797,11 @@ struct hyperRecoTask { hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags, trackedHypClSize, chargeFactor * hypCand.genPt(), hypCand.genPhi(), hypCand.genEta(), hypCand.genPtHe3(), hypCand.gDecVtx[0], hypCand.gDecVtx[1], hypCand.gDecVtx[2], - hypCand.isReco, hypCand.isFakeHeOnITSLayer, hypCand.isSignal, hypCand.isRecoMCCollision, hypCand.isSurvEvSelection, 1); + hypCand.isReco, hypCand.isFakeHeOnITSLayer, hypCand.isSignal, hypCand.isRecoMCCollision, hypCand.isSurvEvSelection, 1, 0); } // now we fill only the signal candidates that were not reconstructed - for (auto& mcPart : particlesMC) { + for (const auto& mcPart : particlesMC) { if (std::abs(mcPart.pdgCode()) != hyperPdg) continue; @@ -811,12 +810,15 @@ struct hyperRecoTask { std::array momMother = {mcPart.px(), mcPart.py(), mcPart.pz()}; std::array momHe3; bool isHeFound = false; - for (auto& mcDaught : mcPart.daughters_as()) { + int mcProcess = {0}; + for (const auto& mcDaught : mcPart.daughters_as()) { if (std::abs(mcDaught.pdgCode()) == heDauPdg) { secVtx = {mcDaught.vx(), mcDaught.vy(), mcDaught.vz()}; momHe3 = {mcDaught.px(), mcDaught.py(), mcDaught.pz()}; isHeFound = true; - break; + } + if (mcDaught.pdgCode() != PDG_t::kElectron) { // we do not care about delta electrons + mcProcess = mcDaught.getProcess(); } } if (mcPart.pdgCode() > 0) { @@ -870,7 +872,7 @@ struct hyperRecoTask { -1, -1, -1, false, chargeFactor * hypCand.genPt(), hypCand.genPhi(), hypCand.genEta(), hypCand.genPtHe3(), hypCand.gDecVtx[0], hypCand.gDecVtx[1], hypCand.gDecVtx[2], - hypCand.isReco, -1, hypCand.isSignal, hypCand.isRecoMCCollision, hypCand.isSurvEvSelection, isHeFound); + hypCand.isReco, -1, hypCand.isSignal, hypCand.isRecoMCCollision, hypCand.isSurvEvSelection, isHeFound, mcProcess); } } PROCESS_SWITCH(hyperRecoTask, processMC, "MC analysis", false); From 9961dc34ef95aa01b8d8b9e4562b53f5ae001db9 Mon Sep 17 00:00:00 2001 From: Nicolas Strangmann <77485327+nstrangm@users.noreply.github.com> Date: Mon, 20 Oct 2025 21:40:03 +0200 Subject: [PATCH 826/986] [PWGLF] [PWGMM] Add lumi-stability task for light ions (#13461) Co-authored-by: Nicolas Strangmann --- PWGMM/Lumi/Tasks/CMakeLists.txt | 5 + PWGMM/Lumi/Tasks/lumiStabilityLightIons.cxx | 310 ++++++++++++++++++++ 2 files changed, 315 insertions(+) create mode 100644 PWGMM/Lumi/Tasks/lumiStabilityLightIons.cxx diff --git a/PWGMM/Lumi/Tasks/CMakeLists.txt b/PWGMM/Lumi/Tasks/CMakeLists.txt index 87b7e7fe919..4003fa5c2d9 100644 --- a/PWGMM/Lumi/Tasks/CMakeLists.txt +++ b/PWGMM/Lumi/Tasks/CMakeLists.txt @@ -39,4 +39,9 @@ o2physics_add_dpl_workflow(lumistab SOURCES lumiStability.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::ReconstructionDataFormats + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(lumi-stability-light-ions + SOURCES lumiStabilityLightIons.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCCDB O2Physics::AnalysisCore COMPONENT_NAME Analysis) \ No newline at end of file diff --git a/PWGMM/Lumi/Tasks/lumiStabilityLightIons.cxx b/PWGMM/Lumi/Tasks/lumiStabilityLightIons.cxx new file mode 100644 index 00000000000..6bff87598a7 --- /dev/null +++ b/PWGMM/Lumi/Tasks/lumiStabilityLightIons.cxx @@ -0,0 +1,310 @@ +// 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 lumiStabilityLightIons.cxx +/// \brief Analysis over BCs to study the luminosity stability along time +/// +/// \author Nicolas Strangmann (nicolas.strangmann@cern.ch) - Goethe University Frankfurt, Stefanie Mrozinski (stefanie.mrozinski@cern.ch) - Goethe University Frankfurt + +#include "Common/CCDB/ctpRateFetcher.h" +#include "Common/Core/MetadataHelper.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" + +#include "CCDB/BasicCCDBManager.h" +#include "DataFormatsParameters/AggregatedRunInfo.h" +#include "DataFormatsParameters/GRPLHCIFData.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +o2::common::core::MetadataHelper metadataInfo; // Metadata helper + +using MyBCs = soa::Join; + +struct LumiStabilityLightIons { + Configurable cfgRequireGoodRCTQuality{"cfgRequireGoodRCTQuality", false, "Only store BCs with good quality of FT0 in RCT"}; + Configurable cfgDoFT0Vtx{"cfgDoFT0Vtx", true, "Create and fill histograms for the FT0 vertex trigger"}; + Configurable cfgDoFT0CE{"cfgDoFT0CE", true, "Create and fill histograms for the FT0 centrality trigger"}; + Configurable cfgDoFDD{"cfgDoFDD", true, "Create and fill histograms for the FDD trigger"}; + Configurable cfgDo1ZNC{"cfgDo1ZNC", true, "Create and fill histograms for the 1ZNC trigger"}; + + Configurable cfgDoBCA{"cfgDoBCA", false, "Create and fill histograms for the BCs of type A"}; + Configurable cfgDoBCB{"cfgDoBCB", true, "Create and fill histograms for the BCs of type B"}; + Configurable cfgDoBCC{"cfgDoBCC", false, "Create and fill histograms for the BCs of type C"}; + Configurable cfgDoBCE{"cfgDoBCE", false, "Create and fill histograms for the BCs of type E"}; + Configurable cfgDoBCL{"cfgDoBCL", false, "Create and fill histograms for leading BCs of type B"}; + + Configurable cfgEmptyBCsBeforeLeadingBC{"cfgEmptyBCsBeforeLeadingBC", 5, "Minimum number of empty BCs before a leading BC to identify it as such"}; + + std::bitset beamPatternA, beamPatternC; + std::bitset bcPatternA, bcPatternC, bcPatternB, bcPatternE; + + std::string strLPMProductionTag = ""; // MC production tag to be retrieved from AO2D metadata + + const int nBCsPerOrbit = 3564; + + aod::rctsel::RCTFlagsChecker isFT0GoodRCTChecker{aod::rctsel::kFT0Bad}; + parameters::GRPLHCIFData* mLHCIFdata = nullptr; + int mRunNumber = -1; + ctpRateFetcher mRateFetcher; + bool isLeadingBC = false; + + HistogramRegistry mHistManager{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; + + const int nTriggers = 5; + enum TriggerAliases { kAllBCs = 0, + kFT0Vtx = 1, + kFT0CE = 2, + kFDD = 3, + k1ZNC = 4 }; + const int nBCCategories = 5; + enum BCCategories { kBCA = 0, + kBCB = 1, + kBCC = 2, + kBCE = 3, + kBCL = 4 }; + + static constexpr std::string_view NBCsVsTimeHistNames[5][5] = + {{"AllBCs/BC_A/nBCsVsTime", "AllBCs/BC_B/nBCsVsTime", "AllBCs/BC_C/nBCsVsTime", "AllBCs/BC_E/nBCsVsTime", "AllBCs/BC_L/nBCsVsTime"}, + {"FT0VTx/BC_A/nBCsVsTime", "FT0VTx/BC_B/nBCsVsTime", "FT0VTx/BC_C/nBCsVsTime", "FT0VTx/BC_E/nBCsVsTime", "FT0VTx/BC_L/nBCsVsTime"}, + {"FT0CE/BC_A/nBCsVsTime", "FT0CE/BC_B/nBCsVsTime", "FT0CE/BC_C/nBCsVsTime", "FT0CE/BC_E/nBCsVsTime", "FT0CE/BC_L/nBCsVsTime"}, + {"FDD/BC_A/nBCsVsTime", "FDD/BC_B/nBCsVsTime", "FDD/BC_C/nBCsVsTime", "FDD/BC_E/nBCsVsTime", "FDD/BC_L/nBCsVsTime"}, + {"1ZNC/BC_A/nBCsVsTime", "1ZNC/BC_B/nBCsVsTime", "1ZNC/BC_C/nBCsVsTime", "1ZNC/BC_E/nBCsVsTime", "1ZNC/BC_L/nBCsVsTime"}}; + + static constexpr std::string_view NBCsVsBCIDHistNames[5][5] = + {{"AllBCs/BC_A/nBCsVsBCID", "AllBCs/BC_B/nBCsVsBCID", "AllBCs/BC_C/nBCsVsBCID", "AllBCs/BC_E/nBCsVsBCID", "AllBCs/BC_L/nBCsVsBCID"}, + {"FT0VTx/BC_A/nBCsVsBCID", "FT0VTx/BC_B/nBCsVsBCID", "FT0VTx/BC_C/nBCsVsBCID", "FT0VTx/BC_E/nBCsVsBCID", "FT0VTx/BC_L/nBCsVsBCID"}, + {"FT0CE/BC_A/nBCsVsBCID", "FT0CE/BC_B/nBCsVsBCID", "FT0CE/BC_C/nBCsVsBCID", "FT0CE/BC_E/nBCsVsBCID", "FT0CE/BC_L/nBCsVsBCID"}, + {"FDD/BC_A/nBCsVsBCID", "FDD/BC_B/nBCsVsBCID", "FDD/BC_C/nBCsVsBCID", "FDD/BC_E/nBCsVsBCID", "FDD/BC_L/nBCsVsBCID"}, + {"1ZNC/BC_A/nBCsVsBCID", "1ZNC/BC_B/nBCsVsBCID", "1ZNC/BC_C/nBCsVsBCID", "1ZNC/BC_E/nBCsVsBCID", "1ZNC/BC_L/nBCsVsBCID"}}; + + int64_t bcSOR; + int nBCsPerTF; + int64_t currentTFid = -1; + + void init(InitContext&) + { + mHistManager.add("hMu", "hMu", HistType::kTH1F, {{2000, 0., 0.2}}); + + strLPMProductionTag = metadataInfo.get("LPMProductionTag"); // to extract info from ccdb by the tag + + LOG(info) << "strLPMProductionTag: " << strLPMProductionTag; + + AxisSpec timeAxis{1200, 0., 1200., "#bf{t-t_{SOF} (min)}"}, bcIDAxis{3600, 0., 3600., "#bf{BC ID in orbit}"}; + + for (int iTrigger = 0; iTrigger < nTriggers; iTrigger++) { + if ((iTrigger == kAllBCs) || (iTrigger == kFT0Vtx && cfgDoFT0Vtx) || (iTrigger == kFT0CE && cfgDoFT0CE) || (iTrigger == kFDD && cfgDoFDD) || (iTrigger == k1ZNC && cfgDo1ZNC)) { + for (int iBCCategory = 0; iBCCategory < nBCCategories; iBCCategory++) { + if ((iBCCategory == kBCA && cfgDoBCA) || (iBCCategory == kBCB && cfgDoBCB) || (iBCCategory == kBCC && cfgDoBCC) || (iBCCategory == kBCE && cfgDoBCE) || (iBCCategory == kBCL && cfgDoBCL)) { + mHistManager.add(Form("%s", std::string(NBCsVsTimeHistNames[iTrigger][iBCCategory]).c_str()), "Time of triggered BCs since the start of fill;#bf{t-t_{SOF} (min)};#bf{#it{N}_{BC}}", HistType::kTH1F, {timeAxis}); + mHistManager.add(Form("%s", std::string(NBCsVsBCIDHistNames[iTrigger][iBCCategory]).c_str()), "BC ID of triggered BCs;#bf{BC ID in orbit};#bf{#it{N}_{BC}}", HistType::kTH1F, {bcIDAxis}); + } + } + } + } + + mHistManager.add("FT0Vtx_EvSel/nBCsVsTime", "Time of TVX triggered BCs since the start of fill;;#bf{#it{N}_{BC}}", HistType::kTH1F, {timeAxis}); + mHistManager.add("nBCsVsBCID", "Time of TVX triggered BCs since the start of fill;#bf{t-t_{SOF} (min)};#bf{#it{N}_{BC}}", HistType::kTH1F, {bcIDAxis}); + mHistManager.add("InteractionRateVsTime", "IR from CTP vs time since SOF;#bf{t-t_{SOF} (min)};#bf{#it{N}_{BC}}", HistType::kTH1F, {timeAxis}); + mHistManager.add("TFsPerMinute", "TFs seen in this minute (to account for failed jobs);#bf{t-t_{SOF} (min)};#bf{#it{N}_{TFs}}", HistType::kTH1F, {timeAxis}); + + if (cfgRequireGoodRCTQuality) + isFT0GoodRCTChecker.init({aod::rctsel::kFT0Bad}); + } + + void setLHCIFData(const auto& bc) + { + if (mRunNumber == bc.runNumber()) + return; + + auto& ccdbMgr = o2::ccdb::BasicCCDBManager::instance(); + uint64_t timeStamp = bc.timestamp(); + + std::map metadata; + mLHCIFdata = ccdbMgr.getSpecific("GLO/Config/GRPLHCIF", timeStamp, metadata); + if (mLHCIFdata == nullptr) + LOG(fatal) << "GRPLHCIFData not in database, timestamp:" << timeStamp; + mRunNumber = bc.runNumber(); + LOG(info) << "LHCIF data fetched for run " << mRunNumber << " and timestamp " << timeStamp; + + beamPatternA = mLHCIFdata->getBunchFilling().getBeamPattern(0); + beamPatternC = mLHCIFdata->getBunchFilling().getBeamPattern(1); + bcPatternA = beamPatternA & ~beamPatternC; + bcPatternC = ~beamPatternA & beamPatternC; + bcPatternB = beamPatternA & beamPatternC; + bcPatternE = ~beamPatternA & ~beamPatternC; + + auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), mRunNumber, strLPMProductionTag); + bcSOR = runInfo.orbitSOR * nBCsPerOrbit; // first bc of the first orbit + LOG(info) << "BC SOR: " << bcSOR << " (orbit SOR: " << runInfo.orbitSOR << ") NBCs per orbit: " << nBCsPerOrbit; + nBCsPerTF = runInfo.orbitsPerTF * nBCsPerOrbit; // duration of TF in bcs + + return; + } + + double getTVXRate(const auto& bc) + { + auto& ccdbMgr = o2::ccdb::BasicCCDBManager::instance(); + double tvxRate = mRateFetcher.fetch(&ccdbMgr, bc.timestamp(), bc.runNumber(), "T0VTX"); + + return tvxRate; + } + + double calculateMu(const auto& bc) + { + + auto bfilling = mLHCIFdata->getBunchFilling(); + double nbc = bfilling.getFilledBCs().size(); + double nTriggersPerFilledBC = getTVXRate(bc) / nbc / o2::constants::lhc::LHCRevFreq; + double mu = -std::log(1 - nTriggersPerFilledBC); + + return mu; + } + + float getTimeSinceSOF(const auto& bc) + { + return (bc.timestamp() - mLHCIFdata->getFillNumberTime()) / 1e3 / 60; // Convert to minutes + } + + template + void fillHistograms(float timeSinceSOF, int64_t localBC) + { + mHistManager.fill(HIST(NBCsVsTimeHistNames[iTrigger][iBCCategory]), timeSinceSOF); + mHistManager.fill(HIST(NBCsVsBCIDHistNames[iTrigger][iBCCategory]), localBC); + } + + void process(MyBCs const& bcs, aod::FT0s const&) + { + int nEmptyBCs = 0; + for (const auto& bc : bcs) { + + if (bc.timestamp() == 0) + continue; + + setLHCIFData(bc); + + mHistManager.fill(HIST("hMu"), calculateMu(bc)); + + float timeSinceSOF = getTimeSinceSOF(bc); + + auto hRateHist = mHistManager.get(HIST("InteractionRateVsTime")); + hRateHist->SetBinContent(hRateHist->FindBin(timeSinceSOF), getTVXRate(bc)); + + if (bc.selection_bit(aod::evsel::kIsTriggerTVX)) + mHistManager.fill(HIST("FT0Vtx_EvSel/nBCsVsTime"), timeSinceSOF); + + int64_t globalBC = bc.globalBC(); + int localBC = globalBC % nBCsPerOrbit; + + int64_t thisTFid = (globalBC - bcSOR) / nBCsPerTF; + + if (thisTFid != currentTFid) { + currentTFid = thisTFid; + mHistManager.fill(HIST("TFsPerMinute"), timeSinceSOF); + } + + if (bcPatternB[localBC] && nEmptyBCs >= cfgEmptyBCsBeforeLeadingBC) { + isLeadingBC = true; + nEmptyBCs = 0; + } else { + isLeadingBC = false; + nEmptyBCs++; + } + + std::bitset<64> ctpInputMask(bc.inputMask()); + + for (int iTrigger = 0; iTrigger < nTriggers; iTrigger++) { + if ((iTrigger == kAllBCs) || (iTrigger == kFT0Vtx && cfgDoFT0Vtx) || (iTrigger == kFT0CE && cfgDoFT0CE) || (iTrigger == kFDD && cfgDoFDD) || (iTrigger == k1ZNC && cfgDo1ZNC)) { + for (int iBCCategory = 0; iBCCategory < nBCCategories; iBCCategory++) { + if ((iBCCategory == kBCA && cfgDoBCA) || (iBCCategory == kBCB && cfgDoBCB) || (iBCCategory == kBCC && cfgDoBCC) || (iBCCategory == kBCE && cfgDoBCE) || (iBCCategory == kBCL && cfgDoBCL)) { + if (iTrigger == kAllBCs) { + if (iBCCategory == kBCA && bcPatternA[localBC]) + fillHistograms(timeSinceSOF, localBC); + if (iBCCategory == kBCB && bcPatternB[localBC]) + fillHistograms(timeSinceSOF, localBC); + if (iBCCategory == kBCC && bcPatternC[localBC]) + fillHistograms(timeSinceSOF, localBC); + if (iBCCategory == kBCE && bcPatternE[localBC]) + fillHistograms(timeSinceSOF, localBC); + if (iBCCategory == kBCL && isLeadingBC) + fillHistograms(timeSinceSOF, localBC); + } + if (iTrigger == kFT0Vtx && ctpInputMask.test(2)) { + if (iBCCategory == kBCA && bcPatternA[localBC]) + fillHistograms(timeSinceSOF, localBC); + if (iBCCategory == kBCB && bcPatternB[localBC]) + fillHistograms(timeSinceSOF, localBC); + if (iBCCategory == kBCC && bcPatternC[localBC]) + fillHistograms(timeSinceSOF, localBC); + if (iBCCategory == kBCE && bcPatternE[localBC]) + fillHistograms(timeSinceSOF, localBC); + if (iBCCategory == kBCL && isLeadingBC) + fillHistograms(timeSinceSOF, localBC); + } + if (iTrigger == kFT0CE && ctpInputMask.test(4)) { + if (iBCCategory == kBCA && bcPatternA[localBC]) + fillHistograms(timeSinceSOF, localBC); + if (iBCCategory == kBCB && bcPatternB[localBC]) + fillHistograms(timeSinceSOF, localBC); + if (iBCCategory == kBCC && bcPatternC[localBC]) + fillHistograms(timeSinceSOF, localBC); + if (iBCCategory == kBCE && bcPatternE[localBC]) + fillHistograms(timeSinceSOF, localBC); + if (iBCCategory == kBCL && isLeadingBC) + fillHistograms(timeSinceSOF, localBC); + } + if (iTrigger == kFDD && ctpInputMask.test(15)) { + if (iBCCategory == kBCA && bcPatternA[localBC]) + fillHistograms(timeSinceSOF, localBC); + if (iBCCategory == kBCB && bcPatternB[localBC]) + fillHistograms(timeSinceSOF, localBC); + if (iBCCategory == kBCC && bcPatternC[localBC]) + fillHistograms(timeSinceSOF, localBC); + if (iBCCategory == kBCE && bcPatternE[localBC]) + fillHistograms(timeSinceSOF, localBC); + if (iBCCategory == kBCL && isLeadingBC) + fillHistograms(timeSinceSOF, localBC); + } + if (iTrigger == k1ZNC && ctpInputMask.test(25)) { + if (iBCCategory == kBCA && bcPatternA[localBC]) + fillHistograms(timeSinceSOF, localBC); + if (iBCCategory == kBCB && bcPatternB[localBC]) + fillHistograms(timeSinceSOF, localBC); + if (iBCCategory == kBCC && bcPatternC[localBC]) + fillHistograms(timeSinceSOF, localBC); + if (iBCCategory == kBCE && bcPatternE[localBC]) + fillHistograms(timeSinceSOF, localBC); + if (iBCCategory == kBCL && isLeadingBC) + fillHistograms(timeSinceSOF, localBC); + } + } + } + } + } + mHistManager.fill(HIST("nBCsVsBCID"), localBC); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + metadataInfo.initMetadata(cfgc); + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From a8d347681f69fba54462d69623f22fdbcb0dc298 Mon Sep 17 00:00:00 2001 From: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Date: Mon, 20 Oct 2025 23:33:01 +0200 Subject: [PATCH 827/986] [PWGCF] fix mixed event for FT0A-C, add eta-phi for QA (#13462) --- .../Tasks/longRangeDihadronCor.cxx | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx b/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx index e2ed5a4cfe0..1e2536baa0f 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx @@ -99,6 +99,7 @@ struct LongRangeDihadronCor { O2_DEFINE_CONFIGURABLE(cfgCentralityWeight, std::string, "", "CCDB path to centrality weight object") O2_DEFINE_CONFIGURABLE(cfgLocalEfficiency, bool, false, "Use local efficiency object") O2_DEFINE_CONFIGURABLE(cfgUseEventWeights, bool, false, "Use event weights for mixed event") + O2_DEFINE_CONFIGURABLE(cfgDrawEtaPhiDis, bool, false, "draw eta-phi distribution for detectors in used") struct : ConfigurableGroup { O2_DEFINE_CONFIGURABLE(cfgMultCentHighCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x + 10.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); O2_DEFINE_CONFIGURABLE(cfgMultCentLowCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x - 3.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); @@ -208,6 +209,7 @@ struct LongRangeDihadronCor { } const AxisSpec axisPhi{72, 0.0, constants::math::TwoPI, "#varphi"}; const AxisSpec axisEta{40, -1., 1., "#eta"}; + const AxisSpec axisEtaFull{90, -4., 5., "#eta"}; ccdb->setURL("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); @@ -281,6 +283,9 @@ struct LongRangeDihadronCor { registry.add("zVtx_used", "zVtx_used", {HistType::kTH1D, {axisVertex}}); registry.add("FT0Amp", "", {HistType::kTH2F, {axisChID, axisFit}}); registry.add("FT0AmpCorrect", "", {HistType::kTH2F, {axisChID, axisFit}}); + if (cfgDrawEtaPhiDis) { + registry.add("EtaPhi", "", {HistType::kTH2F, {axisEtaFull, axisPhi}}); + } } if (doprocessSameTpcFt0a) { registry.add("deltaEta_deltaPhi_same_TPC_FT0A", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEtaTpcFt0a}}); // check to see the delta eta and delta phi distribution @@ -561,6 +566,9 @@ struct LongRangeDihadronCor { } else if (corType == kFT0A) { registry.fill(HIST("Trig_hist_TPC_FT0A"), fSampleIndex, posZ, track1.pt(), eventWeight * triggerWeight); } + if (cfgDrawEtaPhiDis && corType == kFT0A) { + registry.fill(HIST("EtaPhi"), track1.eta(), track1.phi(), eventWeight * triggerWeight); + } } std::size_t channelSize = 0; @@ -577,6 +585,9 @@ struct LongRangeDihadronCor { getChannel(ft0, iCh, chanelid, ampl, corType); auto phi = getPhiFT0(chanelid, corType); auto eta = getEtaFT0(chanelid, corType); + if (cfgDrawEtaPhiDis && system == SameEvent) { + registry.fill(HIST("EtaPhi"), eta, phi, ampl * eventWeight); + } float deltaPhi = RecoDecay::constrainAngle(track1.phi() - phi, -PIHalf); float deltaEta = track1.eta() - eta; // fill the right sparse and histograms @@ -606,19 +617,19 @@ struct LongRangeDihadronCor { } template - void fillCorrelationsFT0AFT0C(TFT0s const& ft0, float posZ, int system, float eventWeight) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms + void fillCorrelationsFT0AFT0C(TFT0s const& ft0Col1, TFT0s const& ft0Col2, float posZ, int system, float eventWeight) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms { int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); float triggerWeight = 1.0f; - std::size_t channelASize = ft0.channelA().size(); - std::size_t channelCSize = ft0.channelC().size(); + std::size_t channelASize = ft0Col1.channelA().size(); + std::size_t channelCSize = ft0Col2.channelC().size(); // loop over all tracks for (std::size_t iChA = 0; iChA < channelASize; iChA++) { int chanelAid = 0; float amplA = 0.; - getChannel(ft0, iChA, chanelAid, amplA, kFT0A); + getChannel(ft0Col1, iChA, chanelAid, amplA, kFT0A); auto phiA = getPhiFT0(chanelAid, kFT0A); auto etaA = getEtaFT0(chanelAid, kFT0A); @@ -629,7 +640,7 @@ struct LongRangeDihadronCor { for (std::size_t iChC = 0; iChC < channelCSize; iChC++) { int chanelCid = 0; float amplC = 0.; - getChannel(ft0, iChC, chanelCid, amplC, kFT0C); + getChannel(ft0Col2, iChC, chanelCid, amplC, kFT0C); auto phiC = getPhiFT0(chanelCid, kFT0C); auto etaC = getEtaFT0(chanelCid, kFT0C); float deltaPhi = RecoDecay::constrainAngle(phiA - phiC, -PIHalf); @@ -983,7 +994,7 @@ struct LongRangeDihadronCor { sameFt0aFt0c->fillEvent(tracks.size(), CorrelationContainer::kCFStepReconstructed); const auto& ft0 = collision.foundFT0(); - fillCorrelationsFT0AFT0C(ft0, collision.posZ(), SameEvent, weightCent); + fillCorrelationsFT0AFT0C(ft0, ft0, collision.posZ(), SameEvent, weightCent); } PROCESS_SWITCH(LongRangeDihadronCor, processSameFt0aFt0c, "Process same event for FT0A-FT0C correlation", false); @@ -1041,8 +1052,9 @@ struct LongRangeDihadronCor { float weightCent = 1.0f; if (!cfgCentTableUnavailable) getCentralityWeight(weightCent, cent1); - const auto& ft0 = collision2.foundFT0(); - fillCorrelationsFT0AFT0C(ft0, collision1.posZ(), MixedEvent, eventWeight * weightCent); + const auto& ft0Col1 = collision1.foundFT0(); + const auto& ft0Col2 = collision2.foundFT0(); + fillCorrelationsFT0AFT0C(ft0Col1, ft0Col2, collision1.posZ(), MixedEvent, eventWeight * weightCent); } } PROCESS_SWITCH(LongRangeDihadronCor, processMixedFt0aFt0c, "Process mixed events for FT0A-FT0C correlation", false); From 8170a19fe7d49af8311bbffb7ece8100509f526f Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Tue, 21 Oct 2025 00:08:03 +0200 Subject: [PATCH 828/986] [PWGCF] FemtoUniverse: Add flag and condition to select only primaries (#13466) --- .../TableProducer/femtoUniverseProducerTask.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx index 19fb3fc50d0..e45c4e0084d 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx @@ -241,6 +241,7 @@ struct FemtoUniverseProducerTask { Configurable confDcaXYCustom11FilterCut{"confDcaXYCustom11FilterCut", 0.004, "Value for [1] custom DCAxy cut -> |DCAxy| < [1] + [2]/pT"}; Configurable confDcaXYCustom12FilterCut{"confDcaXYCustom12FilterCut", 0.013, "Value for [2] custom DCAxy cut -> |DCAxy| < [1] + [2]/pT"}; Configurable confIsApplyTrkCutMCTruth{"confIsApplyTrkCutMCTruth", false, "Apply eta, pT selection cut on MCTruth tracks "}; + Configurable confIsOnlyPrimary{"confIsOnlyPrimary", false, "Select only primaries"}; } ConfFilterCuts; Filter globalCutFilter = requireGlobalTrackInFilter(); @@ -1367,6 +1368,13 @@ struct FemtoUniverseProducerTask { continue; } } + + if (ConfFilterCuts.confIsOnlyPrimary) { + if (!mc.isPhysicalPrimary()) { + return; + } + } + std::vector childIDs = {0, 0}; outputParts(outputCollision.lastIndex(), mc.pt(), From e4b9b79eeb0cd7f83b971748985467611431d1b0 Mon Sep 17 00:00:00 2001 From: "Paul Veen (paveen)" <80593165+ppoava@users.noreply.github.com> Date: Tue, 21 Oct 2025 09:05:38 +0200 Subject: [PATCH 829/986] [Common] Improved background characterisation methods for dimuon DCA (#13432) --- Common/Tasks/qaMuon.cxx | 280 ++++++++++++++++++++++++++++++++-------- 1 file changed, 226 insertions(+), 54 deletions(-) diff --git a/Common/Tasks/qaMuon.cxx b/Common/Tasks/qaMuon.cxx index ce694a2d24d..8c9fdc6c839 100644 --- a/Common/Tasks/qaMuon.cxx +++ b/Common/Tasks/qaMuon.cxx @@ -180,6 +180,7 @@ struct muonQa { Configurable fEnableQAResidual{"cfgEnableQAResidual", false, "Enable residual QA checks"}; Configurable fEnableQADCA{"cfgEnableQADCA", false, "Enable DCA QA checks"}; Configurable fEnableQADimuon{"cfgEnableQADimuon", false, "Enable dimuon QA checks"}; + Configurable fEnableQADimuonSameSignDCA{"cfgEnableQADimuonSameSignDCA", false, "Enable same sign dimuon DCA QA checks"}; Configurable fEnableSingleMuonDiMuonCorrelations{"cfgEnableMuonDiMuonCorrelations", false, "Enable muon-dimuon QA checks"}; } configQAs; @@ -207,6 +208,10 @@ struct muonQa { //// Variables for selecting global tracks Configurable fMatchingChi2MftMchUp{"cfgMatchingChi2MftMchUp", 50.f, ""}; + //// Variables for selecting dimuon DCA candidates + Configurable fDimuonDCAMassLow{"cfgDimuonDCAMassLow", 2.8f, ""}; + Configurable fDimuonDCAMassHigh{"cfgDimuonDCAMassHigh", 3.4f, ""}; + //// Variables for alignment corrections Configurable fEnableMFTAlignmentCorrections{"cfgEnableMFTAlignmentCorrections", false, ""}; @@ -607,17 +612,40 @@ struct muonQa { AxisSpec invMassAxis2D = {750, 0, 15, "M_{#mu^{+}#mu^{-}} (GeV/c^{2})"}; AxisSpec pTAxis2D = {120, 0, 30, "p_{T} (GeV/c)"}; // Jpsi candidate DCA histograms - registryDimuon.add("dimuon/same-event/DCA/pT_MuPosDCAx_minus_MuNegDCAx_MuonKine_MuonCuts", "DCA_x #mu^{+} minus DCA_x #mu^{-} and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); - registryDimuon.add("dimuon/same-event/DCA/pT_MuPosTDCAx_minus_MuNegTDCAx_MuonKine_MuonCuts", "DCA_x #mu^{+} top minus DCA_x #mu^{-} top and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); - registryDimuon.add("dimuon/same-event/DCA/pT_MuPosTDCAx_minus_MuNegBDCAx_MuonKine_MuonCuts", "DCA_x #mu^{+} top minus DCA_x #mu^{-} bottom and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); - registryDimuon.add("dimuon/same-event/DCA/pT_MuPosBDCAx_minus_MuNegBDCAx_MuonKine_MuonCuts", "DCA_x #mu^{+} bottom minus DCA_x #mu^{-} bottom and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); - registryDimuon.add("dimuon/same-event/DCA/pT_MuPosBDCAx_minus_MuNegTDCAx_MuonKine_MuonCuts", "DCA_x #mu^{+} bottom minus DCA_x #mu^{-} top and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); - registryDimuon.add("dimuon/same-event/DCA/pT_MuPosDCAy_minus_MuNegDCAy_MuonKine_MuonCuts", "DCA_y #mu^{+} minus DCA_y #mu^{-} and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); - registryDimuon.add("dimuon/same-event/DCA/pT_MuPosTDCAy_minus_MuNegTDCAy_MuonKine_MuonCuts", "DCA_y #mu^{+} top minus DCA_y #mu^{-} top and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); - registryDimuon.add("dimuon/same-event/DCA/pT_MuPosTDCAy_minus_MuNegBDCAy_MuonKine_MuonCuts", "DCA_y #mu^{+} top minus DCA_y #mu^{-} bottom and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); - registryDimuon.add("dimuon/same-event/DCA/pT_MuPosBDCAy_minus_MuNegBDCAy_MuonKine_MuonCuts", "DCA_y #mu^{+} bottom minus DCA_y #mu^{-} bottom and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); - registryDimuon.add("dimuon/same-event/DCA/pT_MuPosBDCAy_minus_MuNegTDCAy_MuonKine_MuonCuts", "DCA_y #mu^{+} bottom minus DCA_y #mu^{-} top and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); - // + registryDimuon.add("dimuon/same-event/opposite-sign/DCA/pT_MuPosDCAx_minus_MuNegDCAx_MuonKine_MuonCuts", "DCA_x #mu^{+} minus DCA_x #mu^{-} and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/opposite-sign/DCA/pT_MuPosTDCAx_minus_MuNegTDCAx_MuonKine_MuonCuts", "DCA_x #mu^{+} top minus DCA_x #mu^{-} top and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/opposite-sign/DCA/pT_MuPosTDCAx_minus_MuNegBDCAx_MuonKine_MuonCuts", "DCA_x #mu^{+} top minus DCA_x #mu^{-} bottom and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/opposite-sign/DCA/pT_MuPosBDCAx_minus_MuNegBDCAx_MuonKine_MuonCuts", "DCA_x #mu^{+} bottom minus DCA_x #mu^{-} bottom and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/opposite-sign/DCA/pT_MuPosBDCAx_minus_MuNegTDCAx_MuonKine_MuonCuts", "DCA_x #mu^{+} bottom minus DCA_x #mu^{-} top and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/opposite-sign/DCA/pT_MuPosDCAy_minus_MuNegDCAy_MuonKine_MuonCuts", "DCA_y #mu^{+} minus DCA_y #mu^{-} and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/opposite-sign/DCA/pT_MuPosTDCAy_minus_MuNegTDCAy_MuonKine_MuonCuts", "DCA_y #mu^{+} top minus DCA_y #mu^{-} top and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/opposite-sign/DCA/pT_MuPosTDCAy_minus_MuNegBDCAy_MuonKine_MuonCuts", "DCA_y #mu^{+} top minus DCA_y #mu^{-} bottom and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/opposite-sign/DCA/pT_MuPosBDCAy_minus_MuNegBDCAy_MuonKine_MuonCuts", "DCA_y #mu^{+} bottom minus DCA_y #mu^{-} bottom and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/opposite-sign/DCA/pT_MuPosBDCAy_minus_MuNegTDCAy_MuonKine_MuonCuts", "DCA_y #mu^{+} bottom minus DCA_y #mu^{-} top and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + if (configQAs.fEnableQADimuonSameSignDCA) { + // mu+mu+ + registryDimuon.add("dimuon/same-event/same-sign-PP/DCA/pT_Mu1DCAx_minus_Mu2DCAx_MuonKine_MuonCuts", "DCA_x #mu_{1} minus DCA_x #mu_{2} and #mu^{+}#mu^{+} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/same-sign-PP/DCA/pT_Mu1TDCAx_minus_Mu2TDCAx_MuonKine_MuonCuts", "DCA_x #mu_{1} top minus DCA_x #mu_{2} top and #mu^{+}#mu^{+} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/same-sign-PP/DCA/pT_Mu1TDCAx_minus_Mu2BDCAx_MuonKine_MuonCuts", "DCA_x #mu_{1} top minus DCA_x #mu_{2} bottom and #mu^{+}#mu^{+} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/same-sign-PP/DCA/pT_Mu1BDCAx_minus_Mu2BDCAx_MuonKine_MuonCuts", "DCA_x #mu_{1} bottom minus DCA_x #mu_{2} bottom and #mu^{+}#mu^{+} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/same-sign-PP/DCA/pT_Mu1BDCAx_minus_Mu2TDCAx_MuonKine_MuonCuts", "DCA_x #mu_{1} bottom minus DCA_x #mu_{2} top and #mu^{+}#mu^{+} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/same-sign-PP/DCA/pT_Mu1DCAy_minus_Mu2DCAy_MuonKine_MuonCuts", "DCA_y #mu_{1} minus DCA_y #mu_{2} and #mu^{+}#mu^{+} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/same-sign-PP/DCA/pT_Mu1TDCAy_minus_Mu2TDCAy_MuonKine_MuonCuts", "DCA_y #mu_{1} top minus DCA_y #mu_{2} top and #mu^{+}#mu^{+} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/same-sign-PP/DCA/pT_Mu1TDCAy_minus_Mu2BDCAy_MuonKine_MuonCuts", "DCA_y #mu_{1} top minus DCA_y #mu_{2} bottom and #mu^{+}#mu^{+} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/same-sign-PP/DCA/pT_Mu1BDCAy_minus_Mu2BDCAy_MuonKine_MuonCuts", "DCA_y #mu_{1} bottom minus DCA_y #mu_{2} bottom and #mu^{+}#mu^{+} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/same-sign-PP/DCA/pT_Mu1BDCAy_minus_Mu2TDCAy_MuonKine_MuonCuts", "DCA_y #mu_{1} bottom minus DCA_y #mu_{2} top and #mu^{+}#mu^{+} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + // mu-mu- + registryDimuon.add("dimuon/same-event/same-sign-MM/DCA/pT_Mu1DCAx_minus_Mu2DCAx_MuonKine_MuonCuts", "DCA_x #mu_{1} minus DCA_x #mu_{2} and #mu^{-}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/same-sign-MM/DCA/pT_Mu1TDCAx_minus_Mu2TDCAx_MuonKine_MuonCuts", "DCA_x #mu_{1} top minus DCA_x #mu_{2} top and #mu^{-}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/same-sign-MM/DCA/pT_Mu1TDCAx_minus_Mu2BDCAx_MuonKine_MuonCuts", "DCA_x #mu_{1} top minus DCA_x #mu_{2} bottom and #mu^{-}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/same-sign-MM/DCA/pT_Mu1BDCAx_minus_Mu2BDCAx_MuonKine_MuonCuts", "DCA_x #mu_{1} bottom minus DCA_x #mu_{2} bottom and #mu^{-}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/same-sign-MM/DCA/pT_Mu1BDCAx_minus_Mu2TDCAx_MuonKine_MuonCuts", "DCA_x #mu_{1} bottom minus DCA_x #mu_{2} top and #mu^{-}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/same-sign-MM/DCA/pT_Mu1DCAy_minus_Mu2DCAy_MuonKine_MuonCuts", "DCA_y #mu_{1} minus DCA_y #mu_{-} and #mu^{-}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/same-sign-MM/DCA/pT_Mu1TDCAy_minus_Mu2TDCAy_MuonKine_MuonCuts", "DCA_y #mu_{1} top minus DCA_y #mu_{2} top and #mu^{-}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/same-sign-MM/DCA/pT_Mu1TDCAy_minus_Mu2BDCAy_MuonKine_MuonCuts", "DCA_y #mu_{1} top minus DCA_y #mu_{2} bottom and #mu^{-}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/same-sign-MM/DCA/pT_Mu1BDCAy_minus_Mu2BDCAy_MuonKine_MuonCuts", "DCA_y #mu_{1} bottom minus DCA_y #mu_{2} bottom and #mu^{-}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/same-sign-MM/DCA/pT_Mu1BDCAy_minus_Mu2TDCAy_MuonKine_MuonCuts", "DCA_y #mu_{1} bottom minus DCA_y #mu_{2} top and #mu^{-}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + } registryDimuon.add("dimuon/mixed-event/DCA/pT_MuPosDCAx_minus_MuNegDCAx_MuonKine_MuonCuts", "DCA_x #mu^{+} minus DCA_x #mu^{-} and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); registryDimuon.add("dimuon/mixed-event/DCA/pT_MuPosTDCAx_minus_MuNegTDCAx_MuonKine_MuonCuts", "DCA_x #mu^{+} top minus DCA_x #mu^{-} top and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); registryDimuon.add("dimuon/mixed-event/DCA/pT_MuPosTDCAx_minus_MuNegBDCAx_MuonKine_MuonCuts", "DCA_x #mu^{+} top minus DCA_x #mu^{-} bottom and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); @@ -1231,11 +1259,11 @@ struct muonQa { std::vector& globalMuonPairs) { // muon tracks - outer loop over collisions - for (auto& [collisionIndex1, collisionInfo1] : collisionInfos) { + for (const auto& [collisionIndex1, collisionInfo1] : collisionInfos) { // outer loop over muon tracks auto muonCollision1 = muons.sliceBy(fwdtracksPerCollision, collisionInfo1.globalIndex); - for (auto muon1 : muonCollision1) { + for (const auto& muon1 : muonCollision1) { if (muon1.trackType() <= 2) { continue; @@ -1243,7 +1271,7 @@ struct muonQa { auto mchIndex1 = muon1.globalIndex(); // inner loop over collisions - for (auto& [collisionIndex2, collisionInfo2] : collisionInfos) { + for (const auto& [collisionIndex2, collisionInfo2] : collisionInfos) { // avoid double-counting of collisions if (collisionIndex2 < collisionIndex1) continue; @@ -1256,7 +1284,7 @@ struct muonQa { // inner loop over muon tracks auto muonCollision2 = muons.sliceBy(fwdtracksPerCollision, collisionInfo2.globalIndex); - for (auto muon2 : muonCollision2) { + for (const auto& muon2 : muonCollision2) { if (muon2.trackType() <= 2) { continue; } @@ -1274,11 +1302,11 @@ struct muonQa { } // global muon tracks - outer loop over collisions - for (auto& [collisionIndex1, collisionInfo1] : collisionInfos) { + for (const auto& [collisionIndex1, collisionInfo1] : collisionInfos) { // outer loop over global muon tracks auto muonCollision1 = muons.sliceBy(fwdtracksPerCollision, collisionInfo1.globalIndex); - for (auto muon1 : muonCollision1) { + for (const auto& muon1 : muonCollision1) { if (muon1.trackType() <= 2) { continue; @@ -1290,7 +1318,7 @@ struct muonQa { } // inner loop over collisions - for (auto& [collisionIndex2, collisionInfo2] : collisionInfos) { + for (const auto& [collisionIndex2, collisionInfo2] : collisionInfos) { // avoid double-counting of collisions if (collisionIndex2 < collisionIndex1) continue; @@ -1303,7 +1331,7 @@ struct muonQa { // outer loop over global muon tracks auto muonCollision2 = muons.sliceBy(fwdtracksPerCollision, collisionInfo2.globalIndex); - for (auto muon2 : muonCollision2) { + for (const auto& muon2 : muonCollision2) { if (muon2.trackType() <= 2) { continue; @@ -2188,7 +2216,7 @@ struct muonQa { // Do extrapolation for muons to all reference planes std::vector mchTrackExtrap; - for (double z : zRefPlane) { + for (const double z : zRefPlane) { VarTrack fgValues; if (configRealign.fDoRealign) { FillPropagation(mchrealigned, VarColl{}, fgValues, kToZ, z); @@ -2224,7 +2252,7 @@ struct muonQa { // Do extrapolation for MFTs to all reference planes std::vector mftTrackExtrap; - for (double z : zRefPlane) { + for (const double z : zRefPlane) { VarTrack fgValues; FillPropagation<0, 1>(mft, fgValuesCollMFT, mchTrackExtrap[1], fgValues, kToZ, z); mftTrackExtrap.emplace_back(fgValues); @@ -2505,7 +2533,7 @@ struct muonQa { GetMuonPairs(muonTracks, matchingCandidates, collisions, muonPairs, globalMuonPairs); - for (auto& [muon1, muon2] : muonPairs) { + for (const auto& [muon1, muon2] : muonPairs) { auto collisionIndex1 = muon1.first; auto const& collision1 = collisions.at(collisionIndex1); auto collisionIndex2 = muon2.first; @@ -2600,9 +2628,6 @@ struct muonQa { dcaXPair = muonPosPV.dcaX - muonNegPV.dcaX; dcaYPair = muonPosPV.dcaY - muonNegPV.dcaY; } - // mass cuts only used for DCA of Jpsi candidates - double minJpsiMass = 2.8; - double maxJpsiMass = 3.4; if (goodMuonTracks) { if (sameEvent) { // same-event case @@ -2632,9 +2657,9 @@ struct muonQa { } // dimuon DCA - if (mass >= minJpsiMass && mass <= maxJpsiMass) { - registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosDCAx_minus_MuNegDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); - registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosDCAy_minus_MuNegDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + if (mass >= fDimuonDCAMassLow && mass <= fDimuonDCAMassHigh) { + registryDimuon.get(HIST("dimuon/same-event/opposite-sign/DCA/pT_MuPosDCAx_minus_MuNegDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/opposite-sign/DCA/pT_MuPosDCAy_minus_MuNegDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); } // dimuon top-bottom and left-right separation @@ -2645,9 +2670,9 @@ struct muonQa { registryDimuon.get(HIST("dimuon/same-event/rapPair_MuonKine_MuonCuts_TT"))->Fill(yPair); registryDimuon.get(HIST("dimuon/same-event/invariantMass_rapPair_MuonKine_MuonCuts_TT"))->Fill(mass, yPair); registryDimuon.get(HIST("dimuon/same-event/pT_rapPair_MuonKine_MuonCuts_TT"))->Fill(pT, yPair); - if (mass >= minJpsiMass && mass <= maxJpsiMass) { - registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosTDCAx_minus_MuNegTDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); - registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosTDCAy_minus_MuNegTDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + if (mass >= fDimuonDCAMassLow && mass <= fDimuonDCAMassHigh) { + registryDimuon.get(HIST("dimuon/same-event/opposite-sign/DCA/pT_MuPosTDCAx_minus_MuNegTDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/opposite-sign/DCA/pT_MuPosTDCAy_minus_MuNegTDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); } } else if ((TopBottom1 == 0 && TopBottom2 == 1) || (TopBottom1 == 1 && TopBottom2 == 0)) { registryDimuon.get(HIST("dimuon/same-event/invariantMass_MuonKine_MuonCuts_TB"))->Fill(mass); @@ -2661,17 +2686,17 @@ struct muonQa { registryDimuon.get(HIST("dimuon/same-event/invariantMass_MuonKine_MuonCuts_TPBN"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMassFull_MuonKine_MuonCuts_TPBN"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_MuonKine_MuonCuts_TPBN"))->Fill(mass, pT); - if (mass >= minJpsiMass && mass <= maxJpsiMass) { - registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosTDCAx_minus_MuNegBDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); - registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosTDCAy_minus_MuNegBDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + if (mass >= fDimuonDCAMassLow && mass <= fDimuonDCAMassHigh) { + registryDimuon.get(HIST("dimuon/same-event/opposite-sign/DCA/pT_MuPosTDCAx_minus_MuNegBDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/opposite-sign/DCA/pT_MuPosTDCAy_minus_MuNegBDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); } } else { registryDimuon.get(HIST("dimuon/same-event/invariantMass_MuonKine_MuonCuts_TNBP"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMassFull_MuonKine_MuonCuts_TNBP"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_MuonKine_MuonCuts_TNBP"))->Fill(mass, pT); - if (mass >= minJpsiMass && mass <= maxJpsiMass) { - registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosBDCAx_minus_MuNegTDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); - registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosBDCAy_minus_MuNegTDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + if (mass >= fDimuonDCAMassLow && mass <= fDimuonDCAMassHigh) { + registryDimuon.get(HIST("dimuon/same-event/opposite-sign/DCA/pT_MuPosBDCAx_minus_MuNegTDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/opposite-sign/DCA/pT_MuPosBDCAy_minus_MuNegTDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); } } } else if (TopBottom1 == 1 && TopBottom2 == 0) { @@ -2679,17 +2704,17 @@ struct muonQa { registryDimuon.get(HIST("dimuon/same-event/invariantMass_MuonKine_MuonCuts_TPBN"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMassFull_MuonKine_MuonCuts_TPBN"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_MuonKine_MuonCuts_TPBN"))->Fill(mass, pT); - if (mass >= minJpsiMass && mass <= maxJpsiMass) { - registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosTDCAx_minus_MuNegBDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); - registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosTDCAy_minus_MuNegBDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + if (mass >= fDimuonDCAMassLow && mass <= fDimuonDCAMassHigh) { + registryDimuon.get(HIST("dimuon/same-event/opposite-sign/DCA/pT_MuPosTDCAx_minus_MuNegBDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/opposite-sign/DCA/pT_MuPosTDCAy_minus_MuNegBDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); } } else { registryDimuon.get(HIST("dimuon/same-event/invariantMass_MuonKine_MuonCuts_TNBP"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMassFull_MuonKine_MuonCuts_TNBP"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_MuonKine_MuonCuts_TNBP"))->Fill(mass, pT); - if (mass >= minJpsiMass && mass <= maxJpsiMass) { - registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosBDCAx_minus_MuNegTDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); - registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosBDCAy_minus_MuNegTDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + if (mass >= fDimuonDCAMassLow && mass <= fDimuonDCAMassHigh) { + registryDimuon.get(HIST("dimuon/same-event/opposite-sign/DCA/pT_MuPosBDCAx_minus_MuNegTDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/opposite-sign/DCA/pT_MuPosBDCAy_minus_MuNegTDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); } } } @@ -2700,9 +2725,9 @@ struct muonQa { registryDimuon.get(HIST("dimuon/same-event/rapPair_MuonKine_MuonCuts_BB"))->Fill(yPair); registryDimuon.get(HIST("dimuon/same-event/invariantMass_rapPair_MuonKine_MuonCuts_BB"))->Fill(mass, yPair); registryDimuon.get(HIST("dimuon/same-event/pT_rapPair_MuonKine_MuonCuts_BB"))->Fill(pT, yPair); - if (mass >= minJpsiMass && mass <= maxJpsiMass) { - registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosBDCAx_minus_MuNegBDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); - registryDimuon.get(HIST("dimuon/same-event/DCA/pT_MuPosBDCAy_minus_MuNegBDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + if (mass >= fDimuonDCAMassLow && mass <= fDimuonDCAMassHigh) { + registryDimuon.get(HIST("dimuon/same-event/opposite-sign/DCA/pT_MuPosBDCAx_minus_MuNegBDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/opposite-sign/DCA/pT_MuPosBDCAy_minus_MuNegBDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); } } @@ -2753,7 +2778,7 @@ struct muonQa { registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_MuonKine_MuonCuts"))->Fill(mass, pT); // dimuon DCA - if (mass >= minJpsiMass && mass <= maxJpsiMass) { + if (mass >= fDimuonDCAMassLow && mass <= fDimuonDCAMassHigh) { registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosDCAx_minus_MuNegDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosDCAy_minus_MuNegDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); } @@ -2763,7 +2788,7 @@ struct muonQa { registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_MuonKine_MuonCuts_TT"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMassFull_MuonKine_MuonCuts_TT"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_MuonKine_MuonCuts_TT"))->Fill(mass, pT); - if (mass >= minJpsiMass && mass <= maxJpsiMass) { + if (mass >= fDimuonDCAMassLow && mass <= fDimuonDCAMassHigh) { registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosTDCAx_minus_MuNegTDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosTDCAy_minus_MuNegTDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); } @@ -2776,7 +2801,7 @@ struct muonQa { registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_MuonKine_MuonCuts_TPBN"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMassFull_MuonKine_MuonCuts_TPBN"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_MuonKine_MuonCuts_TPBN"))->Fill(mass, pT); - if (mass >= minJpsiMass && mass <= maxJpsiMass) { + if (mass >= fDimuonDCAMassLow && mass <= fDimuonDCAMassHigh) { registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosTDCAx_minus_MuNegBDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosTDCAy_minus_MuNegBDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); } @@ -2784,7 +2809,7 @@ struct muonQa { registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_MuonKine_MuonCuts_TNBP"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMassFull_MuonKine_MuonCuts_TNBP"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_MuonKine_MuonCuts_TNBP"))->Fill(mass, pT); - if (mass >= minJpsiMass && mass <= maxJpsiMass) { + if (mass >= fDimuonDCAMassLow && mass <= fDimuonDCAMassHigh) { registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosBDCAx_minus_MuNegTDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosBDCAy_minus_MuNegTDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); } @@ -2794,7 +2819,7 @@ struct muonQa { registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_MuonKine_MuonCuts_TPBN"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMassFull_MuonKine_MuonCuts_TPBN"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_MuonKine_MuonCuts_TPBN"))->Fill(mass, pT); - if (mass >= minJpsiMass && mass <= maxJpsiMass) { + if (mass >= fDimuonDCAMassLow && mass <= fDimuonDCAMassHigh) { registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosTDCAx_minus_MuNegBDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosTDCAy_minus_MuNegBDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); } @@ -2802,7 +2827,7 @@ struct muonQa { registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_MuonKine_MuonCuts_TNBP"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMassFull_MuonKine_MuonCuts_TNBP"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_MuonKine_MuonCuts_TNBP"))->Fill(mass, pT); - if (mass >= minJpsiMass && mass <= maxJpsiMass) { + if (mass >= fDimuonDCAMassLow && mass <= fDimuonDCAMassHigh) { registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosBDCAx_minus_MuNegTDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosBDCAy_minus_MuNegTDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); } @@ -2812,7 +2837,7 @@ struct muonQa { registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_MuonKine_MuonCuts_BB"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMassFull_MuonKine_MuonCuts_BB"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_MuonKine_MuonCuts_BB"))->Fill(mass, pT); - if (mass >= minJpsiMass && mass <= maxJpsiMass) { + if (mass >= fDimuonDCAMassLow && mass <= fDimuonDCAMassHigh) { registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosBDCAx_minus_MuNegBDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); registryDimuon.get(HIST("dimuon/mixed-event/DCA/pT_MuPosBDCAy_minus_MuNegBDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); } @@ -3010,7 +3035,154 @@ struct muonQa { } } - for (auto& [muon1, muon2] : globalMuonPairs) { + if (configQAs.fEnableQADimuonSameSignDCA) { + for (const auto& [muon1, muon2] : muonPairs) { + auto collisionIndex1 = muon1.first; + auto const& collision1 = collisions.at(collisionIndex1); + auto collisionIndex2 = muon2.first; + auto const& collision2 = collisions.at(collisionIndex2); + + auto mchIndex1 = muon1.second; + auto mchIndex2 = muon2.second; + auto const& muonTrack1 = muonTracks.rawIteratorAt(mchIndex1); + auto const& muonTrack2 = muonTracks.rawIteratorAt(mchIndex2); + + VarTrack fgValuesMuon1, fgValuesMuonPV1; + VarTrack fgValuesMuon2, fgValuesMuonPV2; + mch::Track mchrealigned1, mchrealigned2; + VarClusters fgValuesCls1, fgValuesCls2; + if (!FillClusters(muonTrack1, clusters, fgValuesCls1, mchrealigned1) || !FillClusters(muonTrack2, clusters, fgValuesCls2, mchrealigned2)) { + continue; // Refit is not valid + } + + if (configRealign.fDoRealign) { + + FillTrack(mchrealigned1, fgValuesMuon1); + FillTrack(mchrealigned2, fgValuesMuon2); + + // Propagate MCH to PV + FillPropagation(mchrealigned1, collision1, fgValuesMuonPV1); + FillPropagation(mchrealigned2, collision2, fgValuesMuonPV2); + + // Recalculate pDCA and Rabs values + FillPropagation(mchrealigned1, collision1, fgValuesMuon1, kToAbsEnd); + FillPropagation(mchrealigned1, collision1, fgValuesMuon1, kToDCA); + FillPropagation(mchrealigned2, collision2, fgValuesMuon2, kToAbsEnd); + FillPropagation(mchrealigned2, collision2, fgValuesMuon2, kToDCA); + } else { + FillTrack<1>(muonTrack1, fgValuesMuon1); + FillTrack<1>(muonTrack2, fgValuesMuon2); + + // Propagate MCH to PV + FillPropagation<1>(muonTrack1, collision1, fgValuesMuon1, fgValuesMuonPV1); + FillPropagation<1>(muonTrack2, collision2, fgValuesMuon2, fgValuesMuonPV2); + // Calculate DCA + FillPropagation<1>(muonTrack1, collision1, fgValuesMuon1, fgValuesMuonPV1, kToDCA); + FillPropagation<1>(muonTrack2, collision2, fgValuesMuon2, fgValuesMuonPV2, kToDCA); + } + + int sign1 = muonTrack1.sign(); + int sign2 = muonTrack2.sign(); + + // only consider same-sign pairs + if ((sign1 * sign2) <= 0) + continue; + + bool isPP = false; + bool isMM = false; + if (sign1 > 0 && sign2 > 0) + isPP = true; + else + isMM = true; + + int Quadrant1 = GetQuadrantPhi(muonTrack1.phi() * 180.0 / TMath::Pi()); + int Quadrant2 = GetQuadrantPhi(muonTrack2.phi() * 180.0 / TMath::Pi()); + int TopBottom1 = (Quadrant1 == 0 || Quadrant1 == 1) ? 0 : 1; + int TopBottom2 = (Quadrant2 == 0 || Quadrant2 == 1) ? 0 : 1; + + bool goodMuonTracks = (IsGoodMuon(fgValuesMuon1, fgValuesMuonPV1) && IsGoodMuon(fgValuesMuon2, fgValuesMuonPV2)); + + // dimuon variables + double mass = GetMuMuInvariantMass(fgValuesMuonPV1, fgValuesMuonPV2); + double pT = GetMuMuPt(fgValuesMuonPV1, fgValuesMuonPV2); + double dcaXPair; + double dcaYPair; + if (configRealign.fDoRealign) { + dcaXPair = fgValuesMuon1.dcaX - fgValuesMuon2.dcaX; + dcaYPair = fgValuesMuon1.dcaY - fgValuesMuon2.dcaY; + } else { + dcaXPair = fgValuesMuonPV1.dcaX - fgValuesMuonPV2.dcaX; + dcaYPair = fgValuesMuonPV1.dcaY - fgValuesMuonPV2.dcaY; + } + if (mass < fDimuonDCAMassLow || mass > fDimuonDCAMassHigh) + continue; + + if (goodMuonTracks) { + // dimuon DCA + if (isPP) { + registryDimuon.get(HIST("dimuon/same-event/same-sign-PP/DCA/pT_Mu1DCAx_minus_Mu2DCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/same-sign-PP/DCA/pT_Mu1DCAy_minus_Mu2DCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } else if (isMM) { + registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_Mu1DCAx_minus_Mu2DCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_Mu1DCAy_minus_Mu2DCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } + // dimuon top-bottom and left-right separation + if (TopBottom1 == 0 && TopBottom2 == 0) { + if (isPP) { + registryDimuon.get(HIST("dimuon/same-event/same-sign-PP/DCA/pT_Mu1TDCAx_minus_Mu2TDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/same-sign-PP/DCA/pT_Mu1TDCAy_minus_Mu2TDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } else if (isMM) { + registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_Mu1TDCAx_minus_Mu2TDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_Mu1TDCAy_minus_Mu2TDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } + } else if ((TopBottom1 == 0 && TopBottom2 == 1) || (TopBottom1 == 1 && TopBottom2 == 0)) { + if (TopBottom1 == 0 && TopBottom2 == 1) { + if (isPP) { + registryDimuon.get(HIST("dimuon/same-event/same-sign-PP/DCA/pT_Mu1TDCAx_minus_Mu2BDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/same-sign-PP/DCA/pT_Mu1TDCAy_minus_Mu2BDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } else if (isMM) { + registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_Mu1TDCAx_minus_Mu2BDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_Mu1TDCAy_minus_Mu2BDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } else { + if (isPP) { + registryDimuon.get(HIST("dimuon/same-event/same-sign-PP/DCA/pT_Mu1BDCAx_minus_Mu2TDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/same-sign-PP/DCA/pT_Mu1BDCAy_minus_Mu2TDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } else if (isMM) { + registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_Mu1BDCAx_minus_Mu2TDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_Mu1BDCAy_minus_Mu2TDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } + } + } else if (TopBottom1 == 1 && TopBottom2 == 0) { + if (isPP) { + registryDimuon.get(HIST("dimuon/same-event/same-sign-PP/DCA/pT_Mu1TDCAx_minus_Mu2BDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/same-sign-PP/DCA/pT_Mu1TDCAy_minus_Mu2BDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } else if (isMM) { + registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_Mu1TDCAx_minus_Mu2BDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_Mu1TDCAy_minus_Mu2BDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } else { + if (isPP) { + registryDimuon.get(HIST("dimuon/same-event/same-sign-PP/DCA/pT_Mu1BDCAx_minus_Mu2TDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/same-sign-PP/DCA/pT_Mu1BDCAy_minus_Mu2TDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } else if (isMM) { + registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_Mu1BDCAx_minus_Mu2TDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_Mu1BDCAy_minus_Mu2TDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } + } + } + } else if (TopBottom1 == 1 && TopBottom2 == 1) { + if (isPP) { + registryDimuon.get(HIST("dimuon/same-event/same-sign-PP/DCA/pT_Mu1BDCAx_minus_Mu2BDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/same-sign-PP/DCA/pT_Mu1BDCAy_minus_Mu2BDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } else if (isMM) { + registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_Mu1BDCAx_minus_Mu2BDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_Mu1BDCAy_minus_Mu2BDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } + } + } + } + } + + for (const auto& [muon1, muon2] : globalMuonPairs) { auto collisionIndex1 = muon1.first; auto collisionIndex2 = muon2.first; auto& globalTracksVector1 = muon1.second; From 6f4e9acb8baaa2b6897f369bfb48f1770f7efd8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Tue, 21 Oct 2025 09:09:14 +0200 Subject: [PATCH 830/986] [Common] Extend TOF Response parameters as a service (#11872) --- Common/Core/CMakeLists.txt | 4 +- Common/Core/PID/PIDTOFParamService.cxx | 293 +++++++++++++++++++++++++ Common/Core/PID/PIDTOFParamService.h | 205 +++++++++++++++++ Common/DataModel/CMakeLists.txt | 1 + 4 files changed, 502 insertions(+), 1 deletion(-) create mode 100644 Common/Core/PID/PIDTOFParamService.cxx create mode 100644 Common/Core/PID/PIDTOFParamService.h diff --git a/Common/Core/CMakeLists.txt b/Common/Core/CMakeLists.txt index a5a771a2ca3..75695b37c8f 100644 --- a/Common/Core/CMakeLists.txt +++ b/Common/Core/CMakeLists.txt @@ -14,6 +14,7 @@ o2physics_add_library(AnalysisCore OrbitRange.cxx PID/ParamBase.cxx PID/PIDTOF.cxx + PID/PIDTOFParamService.cxx CollisionAssociation.cxx TrackSelectionDefaults.cxx EventPlaneHelper.cxx @@ -21,7 +22,7 @@ o2physics_add_library(AnalysisCore MetadataHelper.cxx CollisionTypeHelper.cxx FFitWeights.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2::DataFormatsParameters ROOT::EG O2::CCDB ROOT::Physics O2::FT0Base O2::FV0Base) + PUBLIC_LINK_LIBRARIES O2::Framework O2::DataFormatsParameters ROOT::EG O2::CCDB ROOT::Physics O2::FT0Base O2::FV0Base O2::DataFormatsParamTOF) o2physics_target_root_dictionary(AnalysisCore HEADERS TrackSelection.h @@ -34,6 +35,7 @@ o2physics_target_root_dictionary(AnalysisCore PID/DetectorResponse.h PID/PIDTOF.h PID/TPCPIDResponse.h + PID/PIDTOFParamService.h CollisionTypeHelper.h FFitWeights.h LINKDEF AnalysisCoreLinkDef.h) diff --git a/Common/Core/PID/PIDTOFParamService.cxx b/Common/Core/PID/PIDTOFParamService.cxx new file mode 100644 index 00000000000..29fe01360fe --- /dev/null +++ b/Common/Core/PID/PIDTOFParamService.cxx @@ -0,0 +1,293 @@ +// 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 PIDTOFParamService.cxx +/// \author Nicolò Jacazio nicolo.jacazio@cern.ch +/// \since 30/06/2025 +/// \brief Implementation of the TOF PID service for the detector response +/// + +#include "PIDTOFParamService.h" + +#include +#include +#include +#include + +#include +#include + +using namespace o2::framework; + +o2::pid::tof::TOFResoParamsV3 o2::pid::tof::TOFResponseImpl::parameters; +o2::common::core::MetadataHelper o2::pid::tof::TOFResponseImpl::metadataInfo; +bool o2::pid::tof::TOFResponseImpl::mIsInit = false; +int o2::pid::tof::TOFResponseImpl::mLastRunNumber = -1; + +void o2::pid::tof::TOFResponseImpl::inheritFromBaseTask(o2::framework::InitContext& initContext, const std::string task) +{ + if (mIsInit) { + LOG(fatal) << "TOFResponseImpl already initialized, cannot re-initialize"; + } + getCfg(initContext, "ccdb-url", mUrl, task); + getCfg(initContext, "ccdb-path-grplhcif", mPathGrpLhcIf, task); + getCfg(initContext, "ccdb-timestamp", mTimestamp, task); + getCfg(initContext, "timeShiftCCDBPathPos", mTimeShiftCCDBPathPos, task); + getCfg(initContext, "timeShiftCCDBPathNeg", mTimeShiftCCDBPathNeg, task); + getCfg(initContext, "timeShiftCCDBPathPosMC", mTimeShiftCCDBPathPosMC, task); + getCfg(initContext, "timeShiftCCDBPathNegMC", mTimeShiftCCDBPathNegMC, task); + getCfg(initContext, "paramFileName", mParamFileName, task); + getCfg(initContext, "parametrizationPath", mParametrizationPath, task); + getCfg(initContext, "reconstructionPass", mReconstructionPass, task); + getCfg(initContext, "reconstructionPassDefault", mReconstructionPassDefault, task); + getCfg(initContext, "fatalOnPassNotAvailable", mFatalOnPassNotAvailable, task); + getCfg(initContext, "enableTimeDependentResponse", mEnableTimeDependentResponse, task); + getCfg(initContext, "collisionSystem", mCollisionSystem, task); + getCfg(initContext, "autoSetProcessFunctions", mAutoSetProcessFunctions, task); +} + +void o2::pid::tof::TOFResponseImpl::initSetup(o2::ccdb::BasicCCDBManager* ccdb, + o2::framework::InitContext& initContext) +{ + if (mIsInit) { + LOG(fatal) << "TOFResponseImpl already initialized, cannot re-initialize"; + } + + if (!ccdb) { + LOG(fatal) << "CCDB manager is not set, cannot initialize TOFResponseImpl"; + } + inheritFromBaseTask(initContext); // Gets the configuration parameters from the base task (tof-signal) + mCcdb = ccdb; // Set the CCDB manager + mCcdb->setURL(mUrl); + mCcdb->setTimestamp(mTimestamp); + mCcdb->setCaching(true); + mCcdb->setLocalObjectValidityChecking(); + // Not later than now objects + mCcdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + + mIsInit = true; // Set the initialization flag + + // Then the information about the metadata + if (mReconstructionPass == "metadata") { + LOG(info) << "Getting pass from metadata"; + if (metadataInfo.isMC()) { + mReconstructionPass = metadataInfo.get("AnchorPassName"); + } else { + mReconstructionPass = metadataInfo.get("RecoPassName"); + } + LOG(info) << "Passed autodetect mode for pass. Taking '" << mReconstructionPass << "'"; + } + LOG(info) << "Using parameter collection, starting from pass '" << mReconstructionPass << "'"; + + if (!mParamFileName.empty()) { // Loading the parametrization from file + LOG(info) << "Loading exp. sigma parametrization from file " << mParamFileName << ", using param: " << mParametrizationPath << " and pass " << mReconstructionPass; + o2::tof::ParameterCollection paramCollection; + paramCollection.loadParamFromFile(mParamFileName, mParametrizationPath); + LOG(info) << "+++ Loaded parameter collection from file +++"; + if (!paramCollection.retrieveParameters(parameters, mReconstructionPass)) { + if (mFatalOnPassNotAvailable) { + LOG(fatal) << "Pass '" << mReconstructionPass << "' not available in the retrieved object from file"; + } else { + LOG(warning) << "Pass '" << mReconstructionPass << "' not available in the retrieved object from file, fetching '" << mReconstructionPassDefault << "'"; + if (!paramCollection.retrieveParameters(parameters, mReconstructionPassDefault)) { + paramCollection.print(); + LOG(fatal) << "Cannot get default pass for calibration " << mReconstructionPassDefault; + } else { + if (metadataInfo.isRun3()) { + parameters.setResolutionParametrization(paramCollection.getPars(mReconstructionPassDefault)); + } else { + parameters.setResolutionParametrizationRun2(paramCollection.getPars(mReconstructionPassDefault)); + } + parameters.setMomentumChargeShiftParameters(paramCollection.getPars(mReconstructionPassDefault)); + } + } + } else { // Pass is available, load non standard parameters + if (metadataInfo.isRun3()) { + parameters.setResolutionParametrization(paramCollection.getPars(mReconstructionPass)); + } else { + parameters.setResolutionParametrizationRun2(paramCollection.getPars(mReconstructionPass)); + } + parameters.setMomentumChargeShiftParameters(paramCollection.getPars(mReconstructionPass)); + } + } else if (!mEnableTimeDependentResponse) { // Loading it from CCDB + LOG(info) << "Loading initial exp. sigma parametrization from CCDB, using path: " << mParametrizationPath << " for timestamp " << mTimestamp; + o2::tof::ParameterCollection* paramCollection = mCcdb->getSpecific(mParametrizationPath, mTimestamp); + if (!paramCollection->retrieveParameters(parameters, mReconstructionPass)) { // Attempt at loading the parameters with the pass defined + if (mFatalOnPassNotAvailable) { + LOG(fatal) << "Pass '" << mReconstructionPass << "' not available in the retrieved CCDB object"; + } else { + LOG(warning) << "Pass '" << mReconstructionPass << "' not available in the retrieved CCDB object, fetching '" << mReconstructionPassDefault << "'"; + if (!paramCollection->retrieveParameters(parameters, mReconstructionPassDefault)) { + paramCollection->print(); + LOG(fatal) << "Cannot get default pass for calibration " << mReconstructionPassDefault; + } else { + if (metadataInfo.isRun3()) { + parameters.setResolutionParametrization(paramCollection->getPars(mReconstructionPassDefault)); + } else { + parameters.setResolutionParametrizationRun2(paramCollection->getPars(mReconstructionPassDefault)); + } + parameters.setMomentumChargeShiftParameters(paramCollection->getPars(mReconstructionPassDefault)); + } + } + } else { // Pass is available, load non standard parameters + if (metadataInfo.isRun3()) { + parameters.setResolutionParametrization(paramCollection->getPars(mReconstructionPass)); + } else { + parameters.setResolutionParametrizationRun2(paramCollection->getPars(mReconstructionPass)); + } + parameters.setMomentumChargeShiftParameters(paramCollection->getPars(mReconstructionPass)); + } + } + + // Loading additional calibration objects + std::map metadata; + if (!mReconstructionPass.empty()) { + metadata["RecoPassName"] = mReconstructionPass; + } + + auto updateTimeShift = [&](const std::string& nameShift, bool isPositive) { + if (nameShift.empty()) { + return; + } + const bool isFromFile = nameShift.find(".root") != std::string::npos; + if (isFromFile) { + LOG(info) << "Initializing the time shift for " << (isPositive ? "positive" : "negative") << " from file '" << nameShift << "'"; + parameters.setTimeShiftParameters(nameShift, "ccdb_object", isPositive); + } else if (!mEnableTimeDependentResponse) { // If the response is fixed fetch it at the init time + LOG(info) << "Initializing the time shift for " << (isPositive ? "positive" : "negative") + << " from ccdb '" << nameShift << "' and timestamp " << mTimestamp + << " and pass '" << mReconstructionPass << "'"; + mCcdb->setFatalWhenNull(false); + parameters.setTimeShiftParameters(mCcdb->getSpecific(nameShift, mTimestamp, metadata), isPositive); + mCcdb->setFatalWhenNull(true); + } + LOG(info) << " test getTimeShift at 0 " << (isPositive ? "pos" : "neg") << ": " + << parameters.getTimeShift(0, isPositive); + }; + + const std::string nameShiftPos = metadataInfo.isMC() ? mTimeShiftCCDBPathPosMC : mTimeShiftCCDBPathPos; + updateTimeShift(nameShiftPos, true); + const std::string nameShiftNeg = metadataInfo.isMC() ? mTimeShiftCCDBPathNegMC : mTimeShiftCCDBPathNeg; + updateTimeShift(nameShiftNeg, false); + + // Calibration object is defined + LOG(info) << "Parametrization at init time:"; + parameters.printFullConfig(); +} + +void o2::pid::tof::TOFResponseImpl::processSetup(const int runNumber, const int64_t timeStamp) +{ + LOG(debug) << "Processing setup for run number " << runNumber << " from run " << mLastRunNumber; + // First we check if this run number was already processed + if (mLastRunNumber == runNumber) { + return; + } + LOG(info) << "Updating the parametrization from last run " << mLastRunNumber << " to " << runNumber << " and timestamp from " << mTimestamp << " " << timeStamp; + mLastRunNumber = runNumber; + mTimestamp = timeStamp; + + // Check the beam type + if (mCollisionSystem == o2::common::core::CollisionSystemType::kCollSysUndef) { + o2::parameters::GRPLHCIFData* grpo = mCcdb->getSpecific(mPathGrpLhcIf, + mTimestamp); + mCollisionSystem = CollisionSystemType::getCollisionTypeFromGrp(grpo); + } else { + LOG(debug) << "Not setting collisions system as already set to " << mCollisionSystem << " " << CollisionSystemType::getCollisionSystemName(mCollisionSystem); + } + + if (!mEnableTimeDependentResponse) { + return; + } + LOG(info) << "Updating parametrization from path '" << mParametrizationPath << "' and timestamp " << mTimestamp << " and reconstruction pass '" << mReconstructionPass << "' for run number " << runNumber; + if (mParamFileName.empty()) { // Not loading if parametrization was taken from file + LOG(info) << "Updating parametrization from ccdb"; + const o2::tof::ParameterCollection* paramCollection = mCcdb->getSpecific(mParametrizationPath, mTimestamp); + if (!paramCollection->retrieveParameters(parameters, mReconstructionPass)) { + if (mFatalOnPassNotAvailable) { + LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", mReconstructionPass.data()); + } else { + LOGF(warning, "Pass '%s' not available in the retrieved CCDB object, fetching '%s'", mReconstructionPass.data(), mReconstructionPassDefault.data()); + if (!paramCollection->retrieveParameters(parameters, mReconstructionPassDefault)) { + paramCollection->print(); + LOG(fatal) << "Cannot get default pass for calibration " << mReconstructionPassDefault; + } else { // Found the default case + if (metadataInfo.isRun3()) { + parameters.setResolutionParametrization(paramCollection->getPars(mReconstructionPassDefault)); + } else { + parameters.setResolutionParametrizationRun2(paramCollection->getPars(mReconstructionPassDefault)); + } + parameters.setMomentumChargeShiftParameters(paramCollection->getPars(mReconstructionPassDefault)); + } + } + } else { // Found the non default case + if (metadataInfo.isRun3()) { + parameters.setResolutionParametrization(paramCollection->getPars(mReconstructionPass)); + } else { + parameters.setResolutionParametrizationRun2(paramCollection->getPars(mReconstructionPass)); + } + parameters.setMomentumChargeShiftParameters(paramCollection->getPars(mReconstructionPass)); + } + } + + // Loading additional calibration objects + std::map metadata; + if (!mReconstructionPass.empty()) { + metadata["RecoPassName"] = mReconstructionPass; + } + + auto updateTimeShift = [&](const std::string& nameShift, bool isPositive) { + if (nameShift.empty()) { + return; + } + const bool isFromFile = nameShift.find(".root") != std::string::npos; + if (isFromFile) { + return; + } + LOG(info) << "Updating the time shift for " << (isPositive ? "positive" : "negative") + << " from ccdb '" << nameShift << "' and timestamp " << mTimestamp + << " and pass '" << mReconstructionPass << "'"; + mCcdb->setFatalWhenNull(false); + parameters.setTimeShiftParameters(mCcdb->getSpecific(nameShift, mTimestamp, metadata), isPositive); + mCcdb->setFatalWhenNull(true); + LOG(info) << " test getTimeShift at 0 " << (isPositive ? "pos" : "neg") << ": " + << parameters.getTimeShift(0, isPositive); + }; + + updateTimeShift(metadataInfo.isMC() ? mTimeShiftCCDBPathPosMC : mTimeShiftCCDBPathPos, true); + updateTimeShift(metadataInfo.isMC() ? mTimeShiftCCDBPathNegMC : mTimeShiftCCDBPathNeg, false); + + LOG(info) << "Parametrization at setup time:"; + parameters.printFullConfig(); +} + +struct TOFSupport : o2::framework::ServicePlugin { + o2::framework::ServiceSpec* create() final + { + return new ServiceSpec{ + .name = "tof-response", + .init = [](ServiceRegistryRef, DeviceState&, fair::mq::ProgOptions&) -> ServiceHandle { + auto* wrapper = new o2::pid::tof::TOFResponse(); + auto* ptr = new o2::pid::tof::TOFResponseImpl(); + wrapper->setInstance(ptr); + return ServiceHandle{TypeIdHelpers::uniqueId(), wrapper, ServiceKind::Serial, "database-pdg"}; + }, + .configure = CommonServices::noConfiguration(), + .exit = [](ServiceRegistryRef, void* service) { + auto* resp = reinterpret_cast(service); + delete resp; }, + .kind = ServiceKind::Serial}; + } +}; + +DEFINE_DPL_PLUGINS_BEGIN +DEFINE_DPL_PLUGIN_INSTANCE(TOFSupport, CustomService); +DEFINE_DPL_PLUGINS_END diff --git a/Common/Core/PID/PIDTOFParamService.h b/Common/Core/PID/PIDTOFParamService.h new file mode 100644 index 00000000000..73b6a4e0c93 --- /dev/null +++ b/Common/Core/PID/PIDTOFParamService.h @@ -0,0 +1,205 @@ +// 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 PIDTOFParamService.h +/// \author Nicolò Jacazio nicolo.jacazio@cern.ch +/// \since 30/06/2025 +/// \brief Implementation of the TOF PID service for the detector response +/// + +#ifndef COMMON_CORE_PID_PIDTOFPARAMSERVICE_H_ +#define COMMON_CORE_PID_PIDTOFPARAMSERVICE_H_ + +#include "Common/Core/CollisionTypeHelper.h" +#include "Common/Core/MetadataHelper.h" +#include "Common/Core/PID/PIDTOF.h" +#include "Common/Core/TableHelper.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/PhysicsConstants.h" +#include "DataFormatsTOF/ParameterContainers.h" +#include "Framework/DataTypes.h" +#include "Framework/PID.h" +#include "Framework/Plugins.h" +#include "ReconstructionDataFormats/PID.h" + +#include + +namespace o2::pid::tof +{ + +struct TOFResponseImpl { + static o2::pid::tof::TOFResoParamsV3 parameters; // TOF response parameters for the expected resolution + static o2::common::core::MetadataHelper metadataInfo; // Metadata information used for the TOF response + + /// Initialize the TOF response parameters in the init function of each task + /// \param ccdb Pointer to the CCDB manager + /// \param initContext Initialization context + /// \note This function should be called in the init function of each task that uses the TOF response + /// \note The parameters are loaded from the CCDB and stored in the static variable `parameters` + /// \note The metadata information is also initialized in this function + void initSetup(o2::ccdb::BasicCCDBManager* ccdb, o2::framework::InitContext& initContext); + + /// Initialize the TOF response parameters in the init function of each task + /// \param ccdb Service pointer to the CCDB manager + template + void initSetup(T ccdb, o2::framework::InitContext& initContext) + { + initSetup(ccdb.operator->(), initContext); + } + + /// Initialize the TOF response parameters in the process function of each task, should be called only at least once per run + /// \param runNumber Run number for which the calibration is loaded + /// \param timeStamp Timestamp for which the calibration is loaded + /// \note This function should be called in the process function of each task that uses the TOF response + /// \note The parameters are loaded from the CCDB and stored in the static variable `parameters` + /// \note The metadata information is also initialized in this function + void processSetup(const int runNumber, const int64_t timeStamp); + + /// Initialize the TOF response parameters in the process function of each task, should be called only at least once per run + /// \param bc Bunch crossing containing the run number and timestamp for which the calibration is loaded + template + void processSetup(const T& bc) + { + processSetup(bc.runNumber(), bc.timestamp()); + } + + template + static float expectedSigma(const float tofSignal, + const float tofExpMom, + const float momentum, + const float eta, + const float tofEvTimeErr, + const o2::pid::tof::TOFResoParamsV3& params = parameters) + { + if (!mIsInit) { + LOG(fatal) << "TOF response parameters not initialized, call initSetup() first"; + } + if (mLastRunNumber < 0) { + LOG(fatal) << "TOF response parameters not initialized, call processSetup() first"; + } + if (tofSignal <= 0.f) { + // return o2::pid::tof::defaultReturnValue; + } + if (tofExpMom <= 0.f) { + return o2::pid::tof::defaultReturnValue; + } + if (momentum <= 0) { + return o2::pid::tof::defaultReturnValue; + } + const float trackingReso = params.getResolution(momentum, eta); + const float tofReso = params.getParameter(4); + if (trackingReso > 0) { + return std::sqrt(trackingReso * trackingReso + + tofReso * tofReso + + tofEvTimeErr * tofEvTimeErr); + } + constexpr float MassSquared = o2::track::pid_constants::sMasses2[id]; + const float dpp = params.getParameter(0) + + params.getParameter(1) * momentum + + params.getParameter(2) * o2::constants::physics::MassElectron / momentum; + const float sigma = dpp * tofSignal / (1. + momentum * momentum / (MassSquared)); + return std::sqrt(sigma * sigma + + params.getParameter(3) * params.getParameter(3) / momentum / momentum + + tofReso * tofReso + + tofEvTimeErr * tofEvTimeErr); + } + + template + static float expectedSigma(const TrackType& track, const o2::pid::tof::TOFResoParamsV3& params = parameters) + { + return expectedSigma(track.tofSignal(), track.tofExpMom(), track.p(), track.eta(), track.tofEvTimeErr(), params); + } + + template + static float nSigma(const float tofSignal, + const float tofExpMom, + const float length, + const float momentum, + const float eta, + const float tofEvTime, + const float tofEvTimeErr, + const o2::pid::tof::TOFResoParamsV3& params = parameters) + { + if (tofSignal <= 0.f) { + return o2::pid::tof::defaultReturnValue; + } + if (tofExpMom <= 0.f) { + return o2::pid::tof::defaultReturnValue; + } + if (momentum <= 0) { + return o2::pid::tof::defaultReturnValue; + } + + const float resolution = expectedSigma(tofSignal, tofExpMom, momentum, eta, tofEvTimeErr, params); + const float expTime = o2::framework::pid::tof::MassToExpTime(tofExpMom, + length, + o2::track::pid_constants::sMasses2[id]); + const float delta = tofSignal - tofEvTime - expTime; + return delta / resolution; + } + + template + static float nSigma(const TrackType& track, const o2::pid::tof::TOFResoParamsV3& params = parameters) + { + return nSigma(track.tofSignal(), track.tofExpMom(), track.length(), track.p(), track.eta(), track.tofEvTime(), track.tofEvTimeErr(), params); + } + + static bool isInit() { return mIsInit; } //! Get the initialization flag + + // Getters for the configurable options + bool cfgAutoSetProcessFunctions() const { return mAutoSetProcessFunctions; } + o2::common::core::CollisionSystemType::collType cfgCollisionType() const { return mCollisionSystem; } + + private: + void inheritFromBaseTask(o2::framework::InitContext& initContext, const std::string task = "tof-signal"); + + static bool mIsInit; //! Flag to check if the parameters are initialized + static int mLastRunNumber; //! Last run number for which the calibration was loaded + + o2::ccdb::BasicCCDBManager* mCcdb = nullptr; // Pointer to the CCDB manager + + // Configurable options + std::string mUrl = "undefined"; + std::string mPathGrpLhcIf = "undefined"; + int64_t mTimestamp = -1; + std::string mTimeShiftCCDBPathPos = "undefined"; + std::string mTimeShiftCCDBPathNeg = "undefined"; + std::string mTimeShiftCCDBPathPosMC = "undefined"; + std::string mTimeShiftCCDBPathNegMC = "undefined"; + std::string mParamFileName = "undefined"; + std::string mParametrizationPath = "undefined"; + std::string mReconstructionPass = "undefined"; + std::string mReconstructionPassDefault = "undefined"; + bool mFatalOnPassNotAvailable = false; + bool mEnableTimeDependentResponse = false; + o2::common::core::CollisionSystemType::collType mCollisionSystem = o2::common::core::CollisionSystemType::kCollSysUndef; + bool mAutoSetProcessFunctions = false; + + template + void getCfg(o2::framework::InitContext& initContext, const std::string name, VType& v, const std::string task) + { + if (!getTaskOptionValue(initContext, task, name, v, false)) { + LOG(fatal) << "Could not get " << name << " from " << task << " task"; + } + } +}; + +struct TOFResponse : o2::framework::LoadableServicePlugin { + TOFResponse() : LoadableServicePlugin{"O2PhysicsAnalysisCore:TOFSupport"} + { + } +}; + +} // namespace o2::pid::tof + +#endif // COMMON_CORE_PID_PIDTOFPARAMSERVICE_H_ diff --git a/Common/DataModel/CMakeLists.txt b/Common/DataModel/CMakeLists.txt index 084222c9648..608f57a2b53 100644 --- a/Common/DataModel/CMakeLists.txt +++ b/Common/DataModel/CMakeLists.txt @@ -19,6 +19,7 @@ o2physics_add_header_only_library(DataModel PIDResponseITS.h PIDResponseTOF.h PIDResponseTPC.h + PIDResponseCombined.h CollisionAssociationTables.h TrackSelectionTables.h McCollisionExtra.h From bd4f08521e45b96fc1fbd1602bb39f7f3e5dc983 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Tue, 21 Oct 2025 09:21:47 +0200 Subject: [PATCH 831/986] [Common] Add possibility to verify commit hash from metadata (#13343) --- Common/Core/MetadataHelper.cxx | 30 +++++++ Common/Core/MetadataHelper.h | 15 ++++ Common/Core/macros/testMetadataHelper.C | 112 ++++++++++++++++++++++++ 3 files changed, 157 insertions(+) diff --git a/Common/Core/MetadataHelper.cxx b/Common/Core/MetadataHelper.cxx index b025c5df7a1..70af2dbec2b 100644 --- a/Common/Core/MetadataHelper.cxx +++ b/Common/Core/MetadataHelper.cxx @@ -21,6 +21,8 @@ #include #include +#include + #include #include @@ -140,3 +142,31 @@ std::string MetadataHelper::makeMetadataLabel() const } return label; } + +std::string MetadataHelper::getO2Version() const +{ + if (!mIsInitialized) { + LOG(warning) << "Metadata not initialized"; + return "undefined"; + } + return get("O2Version"); +} + +bool MetadataHelper::isCommitInSoftwareTag(const std::string& commitHash, const std::string& ccdbUrl) const +{ + const std::string softwareTag = getO2Version(); + std::string command = "curl -i -L "; + command += ccdbUrl; + command += "O2Version/CommitHash/"; + command += commitHash; + command += "/-1/"; + command += "O2Version=" + softwareTag; + command += " 2>&1 | grep --text O2Version:"; + // LOG(info) << "Command to check if commit " << commitHash << " is in software tag " << softwareTag << ": " << command; + TString res = gSystem->GetFromPipe(command.c_str()); + if (res.Contains(Form("O2Version: %s", softwareTag.c_str()))) { + LOG(debug) << "Commit " << commitHash << " is contained in software tag " << softwareTag; + return true; + } + return false; +} diff --git a/Common/Core/MetadataHelper.h b/Common/Core/MetadataHelper.h index 3854820bd84..7b871084f9a 100644 --- a/Common/Core/MetadataHelper.h +++ b/Common/Core/MetadataHelper.h @@ -51,11 +51,21 @@ struct MetadataHelper { /// @return true if the data has been initialized, false otherwise bool isInitialized() const; + /// @brief Function to get the O2 version from the metadata in the monalisa format + /// @return the O2 version from the metadata + std::string getO2Version() const; + /// @brief Function to get the metadata value for a given key /// @param key the key of the metadata /// @return the value of the metadata. Throws an exception if the key is not found std::string get(const std::string& key) const; + /// @brief Function to set a metadata key to a given value + /// @param key the key of the metadata + /// @param value the value to set + /// Note: this function does not check if the key is valid + void set(const std::string& key, const std::string& value) { mMetadata[key] = value; } + /// @brief Function to check if a key is defined in the metadata /// @param key the key to check /// @return true if the key is defined, false otherwise. Throws an exception if the key is not found @@ -64,6 +74,11 @@ struct MetadataHelper { /// @brief Function to create a label with the metadata information, useful e.g. for histogram naming std::string makeMetadataLabel() const; + /// Function to check if a commit is included in the software tag + /// @param commitHash the commit hash to check + /// @return true if the commit is included in the software tag, false otherwise + bool isCommitInSoftwareTag(const std::string& commitHash, const std::string& ccdbUrl = "http://ccdb-test.cern.ch:8080/") const; + private: std::map mMetadata; /// < The metadata map bool mIsInitialized = false; /// < Flag to check if the metadata has been initialized diff --git a/Common/Core/macros/testMetadataHelper.C b/Common/Core/macros/testMetadataHelper.C index 30c109f7840..27371aaf0e3 100644 --- a/Common/Core/macros/testMetadataHelper.C +++ b/Common/Core/macros/testMetadataHelper.C @@ -15,6 +15,7 @@ #include "Common/Core/MetadataHelper.h" +#include #include #include #include @@ -24,7 +25,9 @@ #include #include #include +#include +#include #include #include #include @@ -57,8 +60,100 @@ auto readMetadata(std::unique_ptr& currentFile) -> std::vectorHostName() ? gSystem->HostName() : ""; + if (host.find("lxplus") == std::string::npos) { + LOG(warn) << "Not on lxplus (" << host << "); skipping creation of /tmp/o2version.txt"; + return; + } + // If file exists, do nothing + std::ifstream infile("/tmp/o2version.txt"); + if (infile.is_open()) { + return; + } + gSystem->Exec("alienv q | grep VO_ALICE@O2:: > /tmp/o2version.txt"); +} + +std::map buildMapForCommitHash(const std::string& hash) +{ + // Change directory to /tmp + std::map results; + std::ifstream infileO2Versions("/tmp/o2version.txt"); + std::string lineOfO2Version; + const std::string fileContainingCommit = "/tmp/branches_" + hash + ".txt"; + std::ifstream infileO2VersionsWithHash(fileContainingCommit); + if (!infileO2VersionsWithHash.is_open()) { + gSystem->cd("/tmp/"); + gSystem->Exec("git clone git@github.com:AliceO2Group/AliceO2.git"); + gSystem->cd("AliceO2"); + std::string cmd = Form("git branch -r --contains %s > %s 2>&1", hash.c_str(), fileContainingCommit.c_str()); + LOG(info) << "Executing command " << cmd; + gSystem->Exec(cmd.c_str()); + } + std::string lineOfO2VersionsWithHash; + while (std::getline(infileO2Versions, lineOfO2Version)) { + // Extract the tag + int stripSize = 4; + std::string tag = lineOfO2Version.substr(lineOfO2Version.find("O2::") + stripSize); + // Strip a trailing "-1" (some alienv entries append this) + stripSize = 2; + if (tag.size() >= stripSize && tag.compare(tag.size() - stripSize, stripSize, "-1") == 0) { + tag.resize(tag.size() - stripSize); + } + LOG(debug) << "Checking tag '" << lineOfO2Version << "' tag (" << tag << ")"; + bool found = false; + infileO2VersionsWithHash.open(fileContainingCommit); + while (std::getline(infileO2VersionsWithHash, lineOfO2VersionsWithHash)) { + // LOG(info) << "Comparing " << lineOfO2Version << " with " << lineOfO2VersionsWithHash; + if (lineOfO2VersionsWithHash.find(tag) != std::string::npos) { + LOG(info) << "Tag " << tag << " contains hash " << hash; + found = true; + break; + } + } + infileO2VersionsWithHash.close(); + results[tag] = found; + } + return results; +} + +void populateCCDBWithCommitAvailability(std::map hasHashMap, + const std::string commitHash const std::string ccdbUrl = "http://ccdb-test.cern.ch:8080/") +{ + // First, init the CCDB manager to test if the ccdb is already populated + o2::ccdb::CcdbApi api; + api.init(ccdbUrl); + if (!api.isHostReachable()) { + LOG(fatal) << "CCDB host " << ccdbUrl << " is not reacheable, cannot go forward"; + } + for (const auto& entry : hasHashMap) { + if (!entry.second) { // Version of the code does not have the hash + continue; + } + LOG(info) << "Populating CCDB with information that commit hash " << commitHash << " is contained in software tag " << entry.first; + std::map metadata; + metadata["O2Version"] = entry.first; + const std::string ccdbPath = "O2Version/CommitHash/" + commitHash; + auto headers = api.retrieveHeaders(ccdbPath, metadata, -1); + if (headers.size() != 0) { + LOG(info) << "Entry in CCDB already present for commit hash " << commitHash << ", skipping creation"; + continue; + } + LOG(info) << "No entry in CCDB for commit hash " << commitHash << ", creating it"; + std::string s = "available"; + api.storeAsTFileAny(&s, ccdbPath, metadata); + } +} + void testMetadataHelper(std::string aod = "/tmp/AO2D.root") { + createO2VersionFile(); + const std::string commitHash = "63bc2e3893851ef0f849bb4c98c65eae1ba21e47"; + const std::map hasHashMap = buildMapForCommitHash(commitHash); + populateCCDBWithCommitAvailability(hasHashMap, commitHash); TFile* file = TFile::Open(aod.c_str()); if (!file || file->IsZombie()) { @@ -79,6 +174,23 @@ void testMetadataHelper(std::string aod = "/tmp/AO2D.root") aodCfg.options().get("aod-metadata-DataType"); o2::common::core::MetadataHelper metadataInfo; metadataInfo.initMetadata(aodCfg); + metadataInfo.set("O2Version", "epn-20250715"); // Override the O2 version to a known one metadataInfo.print(); LOG(info) << "Metadata label: " << metadataInfo.makeMetadataLabel(); + + // Check if the hash is in the software tag + const std::string v = metadataInfo.getO2Version(); + if (hasHashMap.find(v) == hasHashMap.end()) { + LOG(fatal) << "Software tag " << v << " not found in available O2 versions"; + } + if (hasHashMap.at(v)) { + LOG(info) << "Hash " << commitHash << " is contained in software tag " << v; + } else { + LOG(warn) << "Hash " << commitHash << " is NOT contained in software tag " << v; + } + if (metadataInfo.isCommitInSoftwareTag(commitHash)) { + LOG(info) << "MetadataHelper confirms that hash " << commitHash << " is contained in software tag " << v; + } else { + LOG(warn) << "MetadataHelper confirms that hash " << commitHash << " is NOT contained in software tag " << v; + } } From a2f03fdc4dc101249e569cd07bf169bd8309eb59 Mon Sep 17 00:00:00 2001 From: Giovanni Malfattore <89481844+giovannimalfattore@users.noreply.github.com> Date: Tue, 21 Oct 2025 09:47:02 +0200 Subject: [PATCH 832/986] [PWGLF] NucleiTask - Add multipl dependent histos (#13464) --- PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx | 170 ++++++++++++++++++++++---- 1 file changed, 144 insertions(+), 26 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx b/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx index 8966c65e23b..ea70aa8a468 100644 --- a/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx +++ b/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx @@ -386,20 +386,42 @@ struct LFNucleiBATask { hSkim->GetXaxis()->SetBinLabel(1, "Total"); hSkim->GetXaxis()->SetBinLabel(2, "Skimmed events"); - histos.add("event/eventSelection", "eventSelection", HistType::kTH1D, {{8, -0.5, 7.5}}); - auto h = histos.get(HIST("event/eventSelection")); - if (skimmingOptions.applySkimming) - h->GetXaxis()->SetBinLabel(1, "Skimmed events"); + if (enableCentrality) { + histos.add("event/eventSelection", "eventSelection", HistType::kTH2D, {{8, -0.5, 7.5}, {binsPercentile, "Centrality FT0M"}}); + auto h2d = histos.get(HIST("event/eventSelection")); + if (skimmingOptions.applySkimming) + h2d->GetXaxis()->SetBinLabel(1, "Skimmed events"); + else + h2d->GetXaxis()->SetBinLabel(1, "Total"); + + h2d->GetXaxis()->SetBinLabel(2, "TVX trigger cut"); + h2d->GetXaxis()->SetBinLabel(3, "TF border cut"); + h2d->GetXaxis()->SetBinLabel(4, "ITS ROF cut"); + h2d->GetXaxis()->SetBinLabel(5, "TVX + TF + ITS ROF"); + h2d->GetXaxis()->SetBinLabel(6, "Sel8 cut"); + h2d->GetXaxis()->SetBinLabel(7, "Z-vert Cut"); + h2d->GetXaxis()->SetBinLabel(8, "Multiplicity cut"); + } else { + histos.add("event/eventSelection", "eventSelection", HistType::kTH1D, {{8, -0.5, 7.5}}); + auto h1d = histos.get(HIST("event/eventSelection")); + if (skimmingOptions.applySkimming) + h1d->GetXaxis()->SetBinLabel(1, "Skimmed events"); + else + h1d->GetXaxis()->SetBinLabel(1, "Total"); + + h1d->GetXaxis()->SetBinLabel(2, "TVX trigger cut"); + h1d->GetXaxis()->SetBinLabel(3, "TF border cut"); + h1d->GetXaxis()->SetBinLabel(4, "ITS ROF cut"); + h1d->GetXaxis()->SetBinLabel(5, "TVX + TF + ITS ROF"); + h1d->GetXaxis()->SetBinLabel(6, "Sel8 cut"); + h1d->GetXaxis()->SetBinLabel(7, "Z-vert Cut"); + h1d->GetXaxis()->SetBinLabel(8, "Multiplicity cut"); + } + + if (enableCentrality) + histos.add("event/h1VtxZ", "V_{z};V_{z} (in cm); counts", HistType::kTH1F, {{1500, -15, 15}, {binsPercentile, "Centrality FT0M"}}); else - h->GetXaxis()->SetBinLabel(1, "Total"); - h->GetXaxis()->SetBinLabel(2, "TVX trigger cut"); - h->GetXaxis()->SetBinLabel(3, "TF border cut"); - h->GetXaxis()->SetBinLabel(4, "ITS ROF cut"); - h->GetXaxis()->SetBinLabel(5, "TVX + TF + ITS ROF"); - h->GetXaxis()->SetBinLabel(6, "Sel8 cut"); - h->GetXaxis()->SetBinLabel(7, "Z-vert Cut"); - h->GetXaxis()->SetBinLabel(8, "Multiplicity cut"); - histos.add("event/h1VtxZ", "V_{z};V_{z} (in cm); counts", HistType::kTH1F, {{1500, -15, 15}}); + histos.add("event/h1VtxZ", "V_{z};V_{z} (in cm); counts", HistType::kTH1F, {{1500, -15, 15}}); if (outFlagOptions.enablePIDplot) { histos.add("tracks/h1pT", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{500, 0., 10.}}); @@ -871,15 +893,33 @@ struct LFNucleiBATask { histos.add("tracks/helium/h1HeliumSpectraTrueSec_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); histos.add("tracks/helium/h1HeliumSpectraTrueTransport_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); + if (enableCentrality) { + histos.add("tracks/helium/h2HeliumSpectraTrueVsMult_Z2", "#it{p}_{T} (He)", HistType::kTH2F, {{ptHeAxis}, {binsPercentile}}); + histos.add("tracks/helium/h2HeliumSpectraTrueWPIDVsMult_Z2", "#it{p}_{T} (He)", HistType::kTH2F, {{ptHeAxis}, {binsPercentile}}); + histos.add("tracks/helium/h2HeliumSpectraTruePrimVsMult_Z2", "#it{p}_{T} (He)", HistType::kTH2F, {{ptHeAxis}, {binsPercentile}}); + histos.add("tracks/helium/h2HeliumSpectraTrueSecVsMult_Z2", "#it{p}_{T} (He)", HistType::kTH2F, {{ptHeAxis}, {binsPercentile}}); + } + histos.add("tracks/helium/h1antiHeliumSpectraTrue_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); histos.add("tracks/helium/h1antiHeliumSpectraTrueWPID_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); histos.add("tracks/helium/h1antiHeliumSpectraTruePrim_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); histos.add("tracks/helium/h1antiHeliumSpectraTrueSec_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); histos.add("tracks/helium/h1antiHeliumSpectraTrueTransport_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); + if (enableCentrality) { + histos.add("tracks/helium/h2antiHeliumSpectraTrueVsMult_Z2", "#it{p}_{T} (He)", HistType::kTH2F, {{ptHeAxis}, {binsPercentile}}); + histos.add("tracks/helium/h2antiHeliumSpectraTrueWPIDVsMult_Z2", "#it{p}_{T} (He)", HistType::kTH2F, {{ptHeAxis}, {binsPercentile}}); + histos.add("tracks/helium/h2antiHeliumSpectraTruePrimVsMult_Z2", "#it{p}_{T} (He)", HistType::kTH2F, {{ptHeAxis}, {binsPercentile}}); + histos.add("tracks/helium/h2antiHeliumSpectraTrueSecVsMult_Z2", "#it{p}_{T} (He)", HistType::kTH2F, {{ptHeAxis}, {binsPercentile}}); + } + if (outFlagOptions.doTOFplots) { histos.add("tracks/helium/TOF/h1HeliumSpectraTruePrim_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); histos.add("tracks/helium/TOF/h1antiHeliumSpectraTruePrim_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); + if (enableCentrality) { + histos.add("tracks/helium/TOF/h2HeliumSpectraTruePrimVsMult_Z2", "#it{p}_{T} (He)", HistType::kTH2F, {{ptHeAxis}, {binsPercentile}}); + histos.add("tracks/helium/TOF/h2antiHeliumSpectraTruePrimVsMult_Z2", "#it{p}_{T} (He)", HistType::kTH2F, {{ptHeAxis}, {binsPercentile}}); + } } if (outFlagOptions.enableEffPlots) { histos.add("tracks/eff/helium/hPtHeTrue_Z2", "Track #it{p}_{T} (He); #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{400, 0., 8.}}); @@ -1671,6 +1711,11 @@ struct LFNucleiBATask { histos.add("tracks/helium/h2HeliumVspTNSigmaITSHe_wTPCpid", "NSigmaITS(He) vs p/z; #it{p}/z (GeV/#it{c}); NSigmaITS(He)", HistType::kTH2F, {{pZAxis}, {sigmaITSAxis}}); histos.add("tracks/helium/h2antiHeliumVspTNSigmaITSHe_wTPCpid", "NSigmaITS(#bar{He}) vs p/z; #it{p}/z (GeV/#it{c}); NSigmaITS(#bar{He})", HistType::kTH2F, {{pZAxis}, {sigmaITSAxis}}); + if (enableCentrality) { + histos.add("tracks/helium/h3HeliumVspTNSigmaTPCVsMult", "NSigmaTPC(He) vs pT; #it{p}_{T} (GeV/#it{c}) vs mult; NSigmaTPC", HistType::kTH3F, {{ptZHeAxis}, {sigmaTPCAxis}, {binsPercentile}}); + histos.add("tracks/helium/h3antiHeliumVspTNSigmaTPCVsMult", "NSigmaTPC(#bar{He}) vs pT; #it{p}_{T} (GeV/#it{c}) vs mult; NSigmaTPC", HistType::kTH3F, {{ptZHeAxis}, {sigmaTPCAxis}, {binsPercentile}}); + } + histos.add("tracks/helium/h2HeliumVspTNSigmaTPC", "NSigmaTPC(He) vs pT/z; #it{p}_{T}/z (GeV/#it{c}); NSigmaTPC", HistType::kTH2F, {{ptZHeAxis}, {sigmaTPCAxis}}); histos.add("tracks/helium/h2antiHeliumVspTNSigmaTPC", "NSigmaTPC(#bar{He}) vs pT/z; #it{p}_{T}/z (GeV/#it{c}); NSigmaTPC", HistType::kTH2F, {{ptZHeAxis}, {sigmaTPCAxis}}); } @@ -1803,6 +1848,10 @@ struct LFNucleiBATask { } } if (enableHe) { + if (enableCentrality) { + histos.add("tracks/helium/h3TOFmass2antiHeliumVsPtVsMult", "#Delta M^{2} (#bar{He}) vs #it{p}_{T}/z; #Delta M^{2} (#bar{He}); #it{p}_{T}/z (GeV/#it{c})", HistType::kTH3F, {{massHeAxis}, {ptZHeAxis}, {binsPercentile}}); + histos.add("tracks/helium/h3TOFmass2HeliumVsPtVsMult", "#Delta M^{2} (He) vs #it{p}_{T}/z; #Delta M^{2} (He); #it{p}_{T}/z (GeV/#it{c})", HistType::kTH3F, {{massHeAxis}, {ptZHeAxis}, {binsPercentile}}); + } histos.add("tracks/helium/h2TOFmass2antiHeliumVsPt", "#Delta M^{2} (#bar{He}) vs #it{p}_{T}/z; #Delta M^{2} (#bar{He}); #it{p}_{T}/z (GeV/#it{c})", HistType::kTH2F, {{massHeAxis}, {ptZHeAxis}}); histos.add("tracks/helium/h2TOFmass2HeliumVsPt", "#Delta M^{2} (He) vs #it{p}_{T}/z; #Delta M^{2} (He); #it{p}_{T}/z (GeV/#it{c})", HistType::kTH2F, {{massHeAxis}, {ptZHeAxis}}); histos.add("tracks/helium/h2TOFmassDeltaHeliumVsPt", "#Delta M (He) vs #it{p}_{T}/z; #Delta M (He); #it{p}_{T}/z (GeV/#it{c})", HistType::kTH2F, {{massHeAxis}, {ptZHeAxis}}); @@ -2017,7 +2066,10 @@ struct LFNucleiBATask { return; } // MC histograms - all, primary, sec. from weak decay, sec. from material - spectraGen.add("histGenVetxZ", "PosZ generated events", HistType::kTH1F, {{1500, -15.f, 15.f, "Vertex Z (cm)"}}); + if (enableCentrality) + spectraGen.add("histGenVetxZ", "PosZ generated events", HistType::kTH2F, {{1500, -15.f, 15.f, "Vertex Z (cm)"}, {binsPercentile, "Centrality FT0M"}}); + else + spectraGen.add("histGenVetxZ", "PosZ generated events", HistType::kTH1F, {{1500, -15.f, 15.f, "Vertex Z (cm)"}}); spectraGen.add("helium/histPtGenHe", "PtGenHe", HistType::kTH1F, {{800, 0.f, 8.f}}); spectraGen.add("helium/histPtRecHe", "PtRecHe", HistType::kTH1F, {{800, 0.f, 8.f}}); @@ -2109,11 +2161,15 @@ struct LFNucleiBATask { if (enableHe) { spectraGen.add("helium/histGenPtHe", "generated particles", HistType::kTH1F, {ptHeAxis}); spectraGen.add("helium/histGenPtHePrim", "generated particles", HistType::kTH1F, {ptHeAxis}); + if (enableCentrality) + spectraGen.add("helium/histGenPtHePrim", "generated particles", HistType::kTH2F, {{ptHeAxis}, {binsPercentile}}); spectraGen.add("helium/histGenPtHeSec", "generated particles", HistType::kTH1F, {ptHeAxis}); spectraGen.add("helium/histSecTransportPtHe", "generated particles", HistType::kTH1F, {ptHeAxis}); spectraGen.add("helium/histGenPtantiHe", "generated particles", HistType::kTH1F, {ptHeAxis}); spectraGen.add("helium/histGenPtantiHePrim", "generated particles", HistType::kTH1F, {ptHeAxis}); + if (enableCentrality) + spectraGen.add("helium/histGenPtantiHePrim", "generated particles", HistType::kTH2F, {{ptHeAxis}, {binsPercentile}}); spectraGen.add("helium/histGenPtantiHeSec", "generated particles", HistType::kTH1F, {ptHeAxis}); spectraGen.add("helium/histSecTransportPtantiHe", "generated particles", HistType::kTH1F, {ptHeAxis}); } @@ -2153,7 +2209,10 @@ struct LFNucleiBATask { } // Event histos fill - histos.fill(HIST("event/eventSelection"), 0); + if (enableCentrality) + histos.fill(HIST("event/eventSelection"), 0, event.centFT0M()); + else + histos.fill(HIST("event/eventSelection"), 0); if (enableDebug) debugHistos.fill(HIST("qa/h1VtxZ_nocut"), event.posZ()); @@ -2162,7 +2221,10 @@ struct LFNucleiBATask { if (evselOptions.useTVXtrigger) return; } else { - histos.fill(HIST("event/eventSelection"), 1); + if (enableCentrality) + histos.fill(HIST("event/eventSelection"), 1, event.centFT0M()); + else + histos.fill(HIST("event/eventSelection"), 1); if (enableDebug) debugHistos.fill(HIST("qa/h1VtxZ_TVXtrigger"), event.posZ()); } @@ -2171,7 +2233,10 @@ struct LFNucleiBATask { if (evselOptions.removeTFBorder) return; } else { - histos.fill(HIST("event/eventSelection"), 2); + if (enableCentrality) + histos.fill(HIST("event/eventSelection"), 2, event.centFT0M()); + else + histos.fill(HIST("event/eventSelection"), 2); if (enableDebug) debugHistos.fill(HIST("qa/h1VtxZ_TFrameBorder"), event.posZ()); } @@ -2180,7 +2245,10 @@ struct LFNucleiBATask { if (evselOptions.removeITSROFBorder) return; } else { - histos.fill(HIST("event/eventSelection"), 3); + if (enableCentrality) + histos.fill(HIST("event/eventSelection"), 3, event.centFT0M()); + else + histos.fill(HIST("event/eventSelection"), 3); if (enableDebug) debugHistos.fill(HIST("qa/h1VtxZ_ITSROFBorder"), event.posZ()); } @@ -2188,18 +2256,27 @@ struct LFNucleiBATask { if ((event.selection_bit(aod::evsel::kNoITSROFrameBorder)) && (event.selection_bit(aod::evsel::kNoTimeFrameBorder)) && (event.selection_bit(aod::evsel::kIsTriggerTVX))) { - histos.fill(HIST("event/eventSelection"), 4); + if (enableCentrality) + histos.fill(HIST("event/eventSelection"), 4, event.centFT0M()); + else + histos.fill(HIST("event/eventSelection"), 4); } if (evselOptions.useSel8 && !event.sel8()) return; - histos.fill(HIST("event/eventSelection"), 5); + if (enableCentrality) + histos.fill(HIST("event/eventSelection"), 5, event.centFT0M()); + else + histos.fill(HIST("event/eventSelection"), 5); if (enableDebug) debugHistos.fill(HIST("qa/h1VtxZ_sel8"), event.posZ()); if (event.posZ() < cfgVzCutLow || event.posZ() > cfgVzCutHigh) return; - histos.fill(HIST("event/eventSelection"), 6); + if (enableCentrality) + histos.fill(HIST("event/eventSelection"), 6, event.centFT0M()); + else + histos.fill(HIST("event/eventSelection"), 6); } else { if (event.posZ() < cfgVzCutLow || event.posZ() > cfgVzCutHigh) @@ -2210,7 +2287,10 @@ struct LFNucleiBATask { if (event.centFT0M() <= cfgMultCutLow || event.centFT0M() > cfgMultCutHigh) { return; } - histos.fill(HIST("event/eventSelection"), 7); + if (enableCentrality) + histos.fill(HIST("event/eventSelection"), 7, event.centFT0M()); + else + histos.fill(HIST("event/eventSelection"), 7); if (enableCentrality && enableDebug) { debugHistos.fill(HIST("event/h1VtxZ_Centrality"), event.posZ()); @@ -2225,7 +2305,10 @@ struct LFNucleiBATask { bool alRapCut = false; // Event histos fill - histos.fill(HIST("event/h1VtxZ"), event.posZ()); + if (enableCentrality) + histos.fill(HIST("event/h1VtxZ"), event.posZ(), event.centFT0M()); + else + histos.fill(HIST("event/h1VtxZ"), event.posZ()); if (enableDebug && enableCentrality) debugHistos.fill(HIST("event/hFT0M"), event.centFT0M()); @@ -4379,12 +4462,16 @@ struct LFNucleiBATask { histos.fill(HIST("tracks/helium/h2HeliumTPCExpSignalDiffVsPt"), hePt, track.tpcExpSignalDiffHe()); histos.fill(HIST("tracks/helium/h2HeliumVspTNSigmaITSHe"), track.p(), nITSHe); histos.fill(HIST("tracks/helium/h2HeliumVspTNSigmaTPC"), hePt, track.tpcNSigmaHe()); + if (enableCentrality) + histos.fill(HIST("tracks/helium/h3HeliumVspTNSigmaTPCVsMult"), hePt, track.tpcNSigmaHe(), event.centFT0M()); } if (isAntiHeWoTPCpid) { if (outFlagOptions.enableExpSignalTPC) histos.fill(HIST("tracks/helium/h2antiHeliumTPCExpSignalDiffVsPt"), antihePt, track.tpcExpSignalDiffHe()); histos.fill(HIST("tracks/helium/h2antiHeliumVspTNSigmaITSHe"), track.p(), nITSHe); histos.fill(HIST("tracks/helium/h2antiHeliumVspTNSigmaTPC"), antihePt, track.tpcNSigmaHe()); + if (enableCentrality) + histos.fill(HIST("tracks/helium/h3antiHeliumVspTNSigmaTPCVsMult"), antihePt, track.tpcNSigmaHe(), event.centFT0M()); } if (isHeWTPCpid) { histos.fill(HIST("tracks/helium/h2HeliumVspTNSigmaITSHe_wTPCpid"), track.p(), nITSHe); @@ -5606,6 +5693,8 @@ struct LFNucleiBATask { case PDGHelium: if (isHelium && passDCAzCutHe && passDCAxyCutHe) { histos.fill(HIST("tracks/helium/h1HeliumSpectraTrue_Z2"), 2 * hePt); + if (enableCentrality) + histos.fill(HIST("tracks/helium/h2HeliumSpectraTrueVsMult_Z2"), 2 * hePt, event.centFT0M()); if (outFlagOptions.makeDCAAfterCutPlots) { histos.fill(HIST("tracks/helium/dca/after/hDCAxyVsPtHeliumTrue"), hePt, track.dcaXY()); @@ -5618,6 +5707,8 @@ struct LFNucleiBATask { } if (std::abs(track.tpcNSigmaHe()) < nsigmaTPCvar.nsigmaTPCHe) { histos.fill(HIST("tracks/helium/h1HeliumSpectraTrueWPID_Z2"), 2 * hePt); + if (enableCentrality) + histos.fill(HIST("tracks/helium/h2HeliumSpectraTrueWPIDVsMult_Z2"), 2 * hePt, event.centFT0M()); if (outFlagOptions.enableEffPlots) { histos.fill(HIST("tracks/eff/helium/hPtHeTrue_Z2"), 2 * hePt); if (track.hasTOF() && outFlagOptions.doTOFplots) { @@ -5627,10 +5718,14 @@ struct LFNucleiBATask { } if (isPhysPrim) { histos.fill(HIST("tracks/helium/h1HeliumSpectraTruePrim_Z2"), 2 * hePt); + if (enableCentrality) + histos.fill(HIST("tracks/helium/h2HeliumSpectraTruePrimVsMult_Z2"), 2 * hePt, event.centFT0M()); if (std::abs(track.tpcNSigmaHe()) < nsigmaTPCvar.nsigmaTPCHe) { if (track.hasTOF() && outFlagOptions.doTOFplots) { histos.fill(HIST("tracks/helium/TOF/h1HeliumSpectraTruePrim_Z2"), 2 * hePt); + if (enableCentrality) + histos.fill(HIST("tracks/helium/TOF/h2HeliumSpectraTruePrimVsMult_Z2"), 2 * hePt, event.centFT0M()); } } @@ -5656,6 +5751,8 @@ struct LFNucleiBATask { } if (isWeakDecay) { histos.fill(HIST("tracks/helium/h1HeliumSpectraTrueSec_Z2"), 2 * hePt); + if (enableCentrality) + histos.fill(HIST("tracks/helium/h1HeliumSpectraTrueSecVsMult_Z2"), 2 * hePt); if (outFlagOptions.makeDCAAfterCutPlots) { histos.fill(HIST("tracks/helium/dca/after/hDCAxyVsPtHeliumTrueSec"), hePt, track.dcaXY()); histos.fill(HIST("tracks/helium/dca/after/hDCAzVsPtHeliumTrueSec"), hePt, track.dcaZ()); @@ -5671,6 +5768,9 @@ struct LFNucleiBATask { case -PDGHelium: if (isHelium && passDCAzCutAntiHe && passDCAxyCutAntiHe) { histos.fill(HIST("tracks/helium/h1antiHeliumSpectraTrue_Z2"), 2 * antihePt); + if (enableCentrality) + histos.fill(HIST("tracks/helium/h2antiHeliumSpectraTrueVsMult_Z2"), 2 * antihePt, event.centFT0M()); + if (outFlagOptions.makeDCAAfterCutPlots) { histos.fill(HIST("tracks/helium/dca/after/hDCAxyVsPtantiHeliumTrue"), antihePt, track.dcaXY()); histos.fill(HIST("tracks/helium/dca/after/hDCAzVsPtantiHeliumTrue"), antihePt, track.dcaZ()); @@ -5681,6 +5781,8 @@ struct LFNucleiBATask { } if (std::abs(track.tpcNSigmaHe()) < nsigmaTPCvar.nsigmaTPCHe) { histos.fill(HIST("tracks/helium/h1antiHeliumSpectraTrueWPID_Z2"), 2 * antihePt); + if (enableCentrality) + histos.fill(HIST("tracks/helium/h2antiHeliumSpectraTrueWPIDVsMult_Z2"), 2 * antihePt, event.centFT0M()); if (outFlagOptions.enableEffPlots) { histos.fill(HIST("tracks/eff/helium/hPtantiHeTrue_Z2"), 2 * antihePt); if (track.hasTOF() && outFlagOptions.doTOFplots) { @@ -5690,10 +5792,14 @@ struct LFNucleiBATask { } if (isPhysPrim) { histos.fill(HIST("tracks/helium/h1antiHeliumSpectraTruePrim_Z2"), 2 * antihePt); + if (enableCentrality) + histos.fill(HIST("tracks/helium/h2antiHeliumSpectraTruePrimVsMult_Z2"), 2 * antihePt, event.centFT0M()); if (std::abs(track.tpcNSigmaHe()) < nsigmaTPCvar.nsigmaTPCHe) { if (track.hasTOF() && outFlagOptions.doTOFplots) { histos.fill(HIST("tracks/helium/TOF/h1antiHeliumSpectraTruePrim_Z2"), 2 * antihePt); + if (enableCentrality) + histos.fill(HIST("tracks/helium/TOF/h2antiHeliumSpectraTruePrimVsMult_Z2"), 2 * antihePt, event.centFT0M()); } } @@ -5719,6 +5825,8 @@ struct LFNucleiBATask { if (isWeakDecay) { histos.fill(HIST("tracks/helium/h1antiHeliumSpectraTrueSec_Z2"), 2 * antihePt); + if (enableCentrality) + histos.fill(HIST("tracks/helium/h2antiHeliumSpectraTrueSecVsMult_Z2"), 2 * antihePt, event.centFT0M()); if (outFlagOptions.makeDCAAfterCutPlots) { histos.fill(HIST("tracks/helium/dca/after/hDCAxyVsPtantiHeliumTrueSec"), antihePt, track.dcaXY()); histos.fill(HIST("tracks/helium/dca/after/hDCAzVsPtantiHeliumTrueSec"), antihePt, track.dcaZ()); @@ -6025,7 +6133,11 @@ struct LFNucleiBATask { if (mcCollision.centFT0M() < cfgMultCutLow || mcCollision.centFT0M() > cfgMultCutHigh) return; - spectraGen.fill(HIST("histGenVetxZ"), mcCollision.posZ()); + + if (enableCentrality) + spectraGen.fill(HIST("histGenVetxZ"), mcCollision.posZ(), mcCollision.centFT0M()); + else + spectraGen.fill(HIST("histGenVetxZ"), mcCollision.posZ()); for (auto const& mcParticleGen : mcParticles) { if (mcParticleGen.y() > kinemOptions.cfgRapidityCutHigh || mcParticleGen.y() < kinemOptions.cfgRapidityCutLow) @@ -6192,7 +6304,10 @@ struct LFNucleiBATask { if (pdgCode == PDGHelium) { spectraGen.fill(HIST("helium/histGenPtHe"), ptMC); if (isPhysPrim) { - spectraGen.fill(HIST("helium/histGenPtHePrim"), ptMC); + if (enableCentrality) + spectraGen.fill(HIST("helium/histGenPtHePrim"), ptMC, mcCollision.centFT0M()); + else + spectraGen.fill(HIST("helium/histGenPtHePrim"), ptMC); } if (!isPhysPrim && isProdByGen) { { @@ -6209,7 +6324,10 @@ struct LFNucleiBATask { if (pdgCode == -PDGHelium) { spectraGen.fill(HIST("helium/histGenPtantiHe"), ptMC); if (isPhysPrim) { - spectraGen.fill(HIST("helium/histGenPtantiHePrim"), ptMC); + if (enableCentrality) + spectraGen.fill(HIST("helium/histGenPtantiHePrim"), ptMC, mcCollision.centFT0M()); + else + spectraGen.fill(HIST("helium/histGenPtantiHePrim"), ptMC); } if (!isPhysPrim && isProdByGen) { { From bd9fae8edf979de74734412857223bdf58a3a567 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Kr=C3=BCger?= <26876110+mario-krueger@users.noreply.github.com> Date: Tue, 21 Oct 2025 09:48:01 +0200 Subject: [PATCH 833/986] [PWGLF] improve PCC performance (#13468) --- .../Nuspex/particleCompositionCorrection.cxx | 204 +++++++++--------- 1 file changed, 107 insertions(+), 97 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/particleCompositionCorrection.cxx b/PWGLF/TableProducer/Nuspex/particleCompositionCorrection.cxx index 457cee3120a..8e09bd645c2 100644 --- a/PWGLF/TableProducer/Nuspex/particleCompositionCorrection.cxx +++ b/PWGLF/TableProducer/Nuspex/particleCompositionCorrection.cxx @@ -28,6 +28,7 @@ #include #include +#include #include using namespace o2; @@ -49,8 +50,6 @@ struct ParticleCompositionCorrection { - support collision systems beyond pp - add QA task illustrating improved mc/data matching of DCA distributions after scaling of secondaries - extend PCC weight table by columns with systematic variations (up/down) - - investigate why particles can be their own mothers - - investigate why histogram registry writing does not respect subfolder structure */ Service pdg; @@ -58,6 +57,7 @@ struct ParticleCompositionCorrection { Configurable skipAll{"skipAll", false, "run table producer in dummy mode, i.e. skip all computations and fill with 1"}; Configurable skipSec{"skipSec", false, "dont calculate weights for secondaries"}; + Configurable skipNonPhysicalPrim{"skipNonPhysicalPrim", true, "dont calculate weights for particles that are not (originating from) physical primaries; i.e. reject (decays of) pi0 etc."}; Configurable etaCut{"etaCut", 0.8f, "eta cut"}; Configurable ptMinCut{"ptMinCut", 0.15f, "pt min cut"}; Configurable ptMaxCut{"ptMaxCut", 10.f, "pt max cut"}; @@ -74,6 +74,8 @@ struct ParticleCompositionCorrection { void init(InitContext const& cfgc); void process(aod::McCollisions::iterator const& mcCollision, aod::McParticles const& particles); + std::tuple getWeights(aod::McParticles const& particles, aod::McParticles::iterator const& particle, std::map>& storedWeights, float dNdEta); + HistogramRegistry histos; }; @@ -108,7 +110,7 @@ void ParticleCompositionCorrection::init(InitContext const&) histos.add("frac/data/kaon", "", kTProfile, {ptAxis}); histos.add("frac/data/proton", "", kTProfile, {ptAxis}); histos.add("frac/data/sigma", "", kTProfile, {ptAxis}); - histos.addClone("frac/data/", "frac/mc/"); // FIXME: bug in writer/registry moves one histogram out of subfolder... + histos.addClone("frac/data/", "frac/mc/"); histos.add("weight/pion", "", kTProfile, {ptAxis}); histos.add("weight/kaon", "", kTProfile, {ptAxis}); @@ -120,6 +122,105 @@ void ParticleCompositionCorrection::init(InitContext const&) } } +std::tuple ParticleCompositionCorrection::getWeights(aod::McParticles const& particles, aod::McParticles::iterator const& particle, std::map>& storedWeights, float dNdEta) +{ + static const std::tuple noWeights = {1.f, 1.f, 1.f}; + + if (skipAll || std::abs(particle.eta()) > etaCut || particle.pt() < ptMinCut || particle.pt() > ptMaxCut) { + return noWeights; + } + + if (particle.producedByGenerator()) { + if (skipNonPhysicalPrim && !particle.isPhysicalPrimary()) { + return noWeights; + } + auto absPDGCode = std::abs(particle.pdgCode()); + // translate abs PDG code to PID variable of neural networks (0: pion, 1: kaon, 2: proton, 3: sigma) + static const std::map mapPID = { + {PDG_t::kPiPlus, 0.f}, + {PDG_t::kPi0, 0.f}, + {PDG_t::kKPlus, 1.f}, + {PDG_t::kK0Short, 1.f}, + {PDG_t::kK0Long, 1.f}, + {PDG_t::kProton, 2.f}, + {PDG_t::kNeutron, 2.f}, + {PDG_t::kSigmaPlus, 3.f}, + {PDG_t::kSigmaMinus, 3.f}, + {PDG_t::kLambda0, 3.f}, + {PDG_t::kSigma0, 3.f}, + {PDG_t::kXiMinus, 3.f}, + // TODO: potentially extend by xi0/eta/omega/rho/phi/Delta... + // pdg codes defined in AliceO2/Common/Constants/include/CommonConstants/PhysicsConstants.h + // e.g. o2::constants::physics::Pdg::kEta + }; + + if (auto iterMapPID = mapPID.find(absPDGCode); iterMapPID != mapPID.end()) { + // LOGP(info, "scaling a {} with status code {} from process {}", particle.pdgCode(), particle.getGenStatusCode(), particle.getProcess()); + float pt = particle.pt(); + + // calculate particle fractions and corresponding weight for given reference particle + std::vector> input = {{dNdEta}, {pt}, {iterMapPID->second}}; + float fracData = particleFractionsData.evalModel(input)[0]; + float fracMC = particleFractionsMC.evalModel(input)[0]; + float weight = (fracMC) ? fracData / fracMC : 1.f; + std::tuple weights = {weight, weight, weight}; + if (!skipSec && particle.has_daughters()) { + storedWeights[particle.index()] = weights; + } + if (enableQAHistos && particle.isPhysicalPrimary() && std::abs(particle.eta()) < 0.8) { // o2-linter: disable=magic-number (usual range of charged-partilce measurements) + if (iterMapPID->first == PDG_t::kPiPlus) { + histos.fill(HIST("frac/data/pion"), pt, fracData); + histos.fill(HIST("frac/mc/pion"), pt, fracMC); + histos.fill(HIST("weight/pion"), pt, weight); + } + if (iterMapPID->first == PDG_t::kKPlus) { + histos.fill(HIST("frac/data/kaon"), pt, fracData); + histos.fill(HIST("frac/mc/kaon"), pt, fracMC); + histos.fill(HIST("weight/kaon"), pt, weight); + } + if (iterMapPID->first == PDG_t::kProton) { + histos.fill(HIST("frac/data/proton"), pt, fracData); + histos.fill(HIST("frac/mc/proton"), pt, fracMC); + histos.fill(HIST("weight/proton"), pt, weight); + } + if (iterMapPID->first == PDG_t::kSigmaPlus || iterMapPID->first == PDG_t::kSigmaMinus) { + histos.fill(HIST("frac/data/sigma"), pt, fracData); + histos.fill(HIST("frac/mc/sigma"), pt, fracMC); + histos.fill(HIST("weight/sigma"), pt, weight); + } + } + return weights; + } + } else if (!skipSec) { + auto refParticleID = particle.index(); + // LOGP(error, "Particle [{}] {} from process {}", refParticleID, particle.pdgCode(), particle.getProcess()); + while (!particles.iteratorAt(refParticleID).producedByGenerator() && particles.iteratorAt(refParticleID).has_mothers()) { + auto motherID = particles.iteratorAt(refParticleID).mothersIds()[0] - particles.offset(); + // LOGP(error, "-> mom [{}] {} from process {}", motherID, particles.iteratorAt(motherID).pdgCode(), particles.iteratorAt(motherID).getProcess()); + refParticleID = motherID; + } + + if (storedWeights.find(refParticleID) == storedWeights.end()) { + // LOGP(error, " no ref particle stored for particle {} from process {}!!", particle.pdgCode(), particle.getProcess()); + return noWeights; + } + + if (enableQAHistos) { + float weight = get<0>(storedWeights.at(refParticleID)); + auto pdgParticle = pdg->GetParticle(particle.pdgCode()); + if (pdgParticle && pdgParticle->Charge() != 0.) { + if (particle.getProcess() == TMCProcess::kPDecay) { + histos.fill(HIST("weight/secDec"), particle.pt(), weight); + } else if (particle.getProcess() == TMCProcess::kPHInhelastic || particle.getProcess() == TMCProcess::kPHadronic || particle.getProcess() == TMCProcess::kPHElastic) { + histos.fill(HIST("weight/secMat"), particle.pt(), weight); + } + } + } + return storedWeights.at(refParticleID); + } + return noWeights; +} + void ParticleCompositionCorrection::process(aod::McCollisions::iterator const&, aod::McParticles const& particles) { // determine dNdEta of the collision @@ -138,100 +239,9 @@ void ParticleCompositionCorrection::process(aod::McCollisions::iterator const&, ++dNdEta; } - // fill particle composition table with corresponding weights + std::map> storedWeights; for (const auto& particle : particles) { - float weight = 1.f; - - // calculate weights only inside the configured kinematic range - if (!skipAll && std::abs(particle.eta()) < etaCut && particle.pt() > ptMinCut && particle.pt() < ptMaxCut) { - auto refParticleID = particle.index(); - - // find initial particle of secondaries from decays or interactions with material - while (!particles.iteratorAt(refParticleID).producedByGenerator() && particles.iteratorAt(refParticleID).has_mothers()) { - if (skipSec) { - break; - } - const auto& mother = particle.mothers_first_as(); - auto motherID = mother.globalIndex() - particles.offset(); - if (motherID == static_cast(refParticleID)) { - // FIXME: this needs to be investigated! - // LOGP(error, " - !!! particle is its own mother: {} (pdg: {}) status: {} ; process: {}", motherID, mother.pdgCode(), mother.getGenStatusCode(), mother.getProcess()); - break; - } - refParticleID = motherID; - } - - if (const auto& refParticle = particles.iteratorAt(refParticleID); refParticle.producedByGenerator()) { - - auto absPDGCode = std::abs(refParticle.pdgCode()); - // translate abs PDG code to PID variable of neural networks (0: pion, 1: kaon, 2: proton, 3: sigma) - static const std::map mapPID = { - {PDG_t::kPiPlus, 0.f}, - {PDG_t::kPi0, 0.f}, - {PDG_t::kKPlus, 1.f}, - {PDG_t::kK0Short, 1.f}, - {PDG_t::kK0Long, 1.f}, - {PDG_t::kProton, 2.f}, - {PDG_t::kNeutron, 2.f}, - {PDG_t::kSigmaPlus, 3.f}, - {PDG_t::kSigmaMinus, 3.f}, - {PDG_t::kLambda0, 3.f}, - {PDG_t::kSigma0, 3.f}, - {PDG_t::kXiMinus, 3.f}, - // TODO: potentially extend by xi0/eta/omega/rho/phi/Delta... - // pdg codes defined in AliceO2/Common/Constants/include/CommonConstants/PhysicsConstants.h - // e.g. o2::constants::physics::Pdg::kEta - }; - - if (auto iterMapPID = mapPID.find(absPDGCode); iterMapPID != mapPID.end()) { - // LOGP(info, "scaling a {} with status code {} from process {}", particle.pdgCode(), particle.getGenStatusCode(), particle.getProcess()); - float pt = refParticle.pt(); - - // calculate particle fractions and corresponding weight for given reference particle - std::vector> input = {{dNdEta}, {pt}, {iterMapPID->second}}; - float fracData = particleFractionsData.evalModel(input)[0]; - float fracMC = particleFractionsMC.evalModel(input)[0]; - if (fracMC) { - weight = fracData / fracMC; - } - - if (enableQAHistos && std::abs(particle.eta()) < 0.8) { // o2-linter: disable=magic-number (usual range of charged-partilce measurements) - if (particle.isPhysicalPrimary()) { - if (iterMapPID->first == PDG_t::kPiPlus) { - histos.fill(HIST("frac/data/pion"), pt, fracData); - histos.fill(HIST("frac/mc/pion"), pt, fracMC); - histos.fill(HIST("weight/pion"), pt, weight); - } - if (iterMapPID->first == PDG_t::kKPlus) { - histos.fill(HIST("frac/data/kaon"), pt, fracData); - histos.fill(HIST("frac/mc/kaon"), pt, fracMC); - histos.fill(HIST("weight/kaon"), pt, weight); - } - if (iterMapPID->first == PDG_t::kProton) { - histos.fill(HIST("frac/data/proton"), pt, fracData); - histos.fill(HIST("frac/mc/proton"), pt, fracMC); - histos.fill(HIST("weight/proton"), pt, weight); - } - if (iterMapPID->first == PDG_t::kSigmaPlus || iterMapPID->first == PDG_t::kSigmaMinus) { - histos.fill(HIST("frac/data/sigma"), pt, fracData); - histos.fill(HIST("frac/mc/sigma"), pt, fracMC); - histos.fill(HIST("weight/sigma"), pt, weight); - } - } else { - auto pdgParticle = pdg->GetParticle(particle.pdgCode()); - if (pdgParticle && pdgParticle->Charge() != 0.) { - // fill the decay daughter info only (usually there is max. one parent generation so no relevant double counting here) - if (particle.getProcess() == TMCProcess::kPDecay) { - histos.fill(HIST("weight/secDec"), pt, weight); - } else if (particle.getProcess() == TMCProcess::kPHInhelastic) { - histos.fill(HIST("weight/secMat"), pt, weight); - } - } - } - } - } - } - } - pccTable(weight, weight, weight); // TODO: put here systematic variations of the weights + auto [weight, weightSysUp, weightSysDown] = getWeights(particles, particle, storedWeights, dNdEta); + pccTable(weight, weightSysUp, weightSysDown); } } From 9636af2bf3120c8e06a0a46c42758e74e16b9313 Mon Sep 17 00:00:00 2001 From: hfribert Date: Tue, 21 Oct 2025 10:01:15 +0200 Subject: [PATCH 834/986] [PWGCF] Fix collision histograms in the kink qa task (#13467) Co-authored-by: Henrik Fribert --- PWGCF/Femto/Core/trackHistManager.h | 1 - PWGCF/Femto/Tasks/femtoKinkQa.cxx | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGCF/Femto/Core/trackHistManager.h b/PWGCF/Femto/Core/trackHistManager.h index 73016325cb4..751ee660e9c 100644 --- a/PWGCF/Femto/Core/trackHistManager.h +++ b/PWGCF/Femto/Core/trackHistManager.h @@ -142,7 +142,6 @@ using ConfResonancePosDauBinning = ConfTrackBinning; using ConfV0PosDauBinning = ConfTrackBinning; using ConfV0NegDauBinning = ConfTrackBinning; -using ConfKinkChaDauBinning = ConfTrackBinning; using ConfCascadePosDauBinning = ConfTrackBinning; using ConfCascadeNegDauBinning = ConfTrackBinning; using ConfCascadeBachelorBinning = ConfTrackBinning; diff --git a/PWGCF/Femto/Tasks/femtoKinkQa.cxx b/PWGCF/Femto/Tasks/femtoKinkQa.cxx index 2b4316159f8..4d797d0be01 100644 --- a/PWGCF/Femto/Tasks/femtoKinkQa.cxx +++ b/PWGCF/Femto/Tasks/femtoKinkQa.cxx @@ -53,6 +53,7 @@ struct FemtoKinkQa { colhistmanager::CollisionHistManager colHistManager; colhistmanager::ConfCollisionBinning confCollisionBinning; + colhistmanager::ConfCollisionQaBinning confCollisionQaBinning; // using Collisions = o2::soa::Join; using Collisions = Join; @@ -95,7 +96,7 @@ struct FemtoKinkQa { sigmaHistManager.init(&hRegistry, sigmaHistSpec, chaDauHistSpec); - auto collisionHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); + auto collisionHistSpec = colhistmanager::makeColQaHistSpecMap(confCollisionBinning, confCollisionQaBinning); colHistManager.init(&hRegistry, collisionHistSpec); }; From c90db70c0ae8fc34ad100e497ee0fe3b48552242 Mon Sep 17 00:00:00 2001 From: Uliana Dmitrieva Date: Tue, 21 Oct 2025 10:20:10 +0200 Subject: [PATCH 835/986] [Common] Rename ZDCInterCalibTask and update it (#13417) Co-authored-by: ALICE Action Bot --- Common/DataModel/CMakeLists.txt | 2 +- Common/DataModel/ZDCExtra.h | 77 ++++++++++++ Common/DataModel/ZDCInterCalib.h | 62 ---------- Common/TableProducer/CMakeLists.txt | 4 +- ...terCalib.cxx => zdcExtraTableProducer.cxx} | 116 ++++++++++++++---- 5 files changed, 172 insertions(+), 89 deletions(-) create mode 100644 Common/DataModel/ZDCExtra.h delete mode 100644 Common/DataModel/ZDCInterCalib.h rename Common/TableProducer/{zdcTaskInterCalib.cxx => zdcExtraTableProducer.cxx} (71%) diff --git a/Common/DataModel/CMakeLists.txt b/Common/DataModel/CMakeLists.txt index 608f57a2b53..f3a9d1d2259 100644 --- a/Common/DataModel/CMakeLists.txt +++ b/Common/DataModel/CMakeLists.txt @@ -26,6 +26,6 @@ o2physics_add_header_only_library(DataModel Qvectors.h MatchMFTFT0.h MftmchMatchingML.h - ZDCInterCalib.h + ZDCExtra.h EseTable.h FwdTrackReAlignTables.h) diff --git a/Common/DataModel/ZDCExtra.h b/Common/DataModel/ZDCExtra.h new file mode 100644 index 00000000000..5b5c0b7a42e --- /dev/null +++ b/Common/DataModel/ZDCExtra.h @@ -0,0 +1,77 @@ +// 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 ZDCExtra.h +/// \brief ZDC extra table producer +/// \author Chiara Oppedisano , INFN Torino +/// \author Uliana Dmitrieva , INFN Torino + +#ifndef COMMON_DATAMODEL_ZDCEXTRA_H_ +#define COMMON_DATAMODEL_ZDCEXTRA_H_ + +#include + +#include + +namespace o2::aod +{ +namespace zdcextra +{ +DECLARE_SOA_COLUMN(ZnaTowC, znaTowC, float); //! Common tower ZNA +DECLARE_SOA_COLUMN(ZnaTow1, znaTow1, float); //! Tower 1 ZNA +DECLARE_SOA_COLUMN(ZnaTow2, znaTow2, float); //! Tower 2 ZNA +DECLARE_SOA_COLUMN(ZnaTow3, znaTow3, float); //! Tower 3 ZNA +DECLARE_SOA_COLUMN(ZnaTow4, znaTow4, float); //! Tower 4 ZNA +DECLARE_SOA_COLUMN(ZnaTdc, znaTdc, float); //! TDC ZNA +DECLARE_SOA_COLUMN(ZnaQx, znaQx, float); //! Q-vector X ZNA +DECLARE_SOA_COLUMN(ZnaQy, znaQy, float); //! Q-vector Y ZNA +DECLARE_SOA_COLUMN(ZncTowC, zncTowC, float); //! Common tower ZNC +DECLARE_SOA_COLUMN(ZncTow1, zncTow1, float); //! Tower 1 ZNC +DECLARE_SOA_COLUMN(ZncTow2, zncTow2, float); //! Tower 2 ZNC +DECLARE_SOA_COLUMN(ZncTow3, zncTow3, float); //! Tower 3 ZNC +DECLARE_SOA_COLUMN(ZncTow4, zncTow4, float); //! Tower 4 ZNC +DECLARE_SOA_COLUMN(ZncTdc, zncTdc, float); //! TDC ZNC +DECLARE_SOA_COLUMN(ZncQx, zncQx, float); //! Q-vector X ZNC +DECLARE_SOA_COLUMN(ZncQy, zncQy, float); //! Q-vector Y ZNC +DECLARE_SOA_COLUMN(Centrality, centrality, float); //! Centrality +DECLARE_SOA_COLUMN(Vx, vx, float); //! Vertex X +DECLARE_SOA_COLUMN(Vy, vy, float); //! Vertex Y +DECLARE_SOA_COLUMN(Vz, vz, float); //! Vertex Z +DECLARE_SOA_COLUMN(Timestamp, timestamp, uint64_t); //! Timestamp +DECLARE_SOA_COLUMN(SelectionBits, selectionBits, uint8_t); //! Selection Flags +} // namespace zdcextra + +DECLARE_SOA_TABLE(ZdcExtras, "AOD", "ZDCEXTRA", o2::soa::Index<>, + zdcextra::ZnaTowC, + zdcextra::ZnaTow1, + zdcextra::ZnaTow2, + zdcextra::ZnaTow3, + zdcextra::ZnaTow4, + zdcextra::ZnaTdc, + zdcextra::ZnaQx, + zdcextra::ZnaQy, + zdcextra::ZncTowC, + zdcextra::ZncTow1, + zdcextra::ZncTow2, + zdcextra::ZncTow3, + zdcextra::ZncTow4, + zdcextra::ZncTdc, + zdcextra::ZncQx, + zdcextra::ZncQy, + zdcextra::Centrality, + zdcextra::Vx, + zdcextra::Vy, + zdcextra::Vz, + zdcextra::Timestamp, + zdcextra::SelectionBits); +} // namespace o2::aod + +#endif // COMMON_DATAMODEL_ZDCEXTRA_H_ diff --git a/Common/DataModel/ZDCInterCalib.h b/Common/DataModel/ZDCInterCalib.h deleted file mode 100644 index 08f9961884f..00000000000 --- a/Common/DataModel/ZDCInterCalib.h +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file ZDCInterCalib.h -/// \brief ZDC tower intercalibration task -/// \author Chiara Oppedisano , INFN Torino - -#ifndef COMMON_DATAMODEL_ZDCINTERCALIB_H_ -#define COMMON_DATAMODEL_ZDCINTERCALIB_H_ - -#include - -#include - -namespace o2::aod -{ -namespace znoutput // o2-linter: disable=name/workflow-file -{ -DECLARE_SOA_COLUMN(ZNApmc, commonPMZNA, float); //! PMC ZNA // o2-linter: disable=name/o2-column -DECLARE_SOA_COLUMN(ZNApm1, ZNAPM1, float); //! PM1 ZNA // o2-linter: disable=name/o2-column -DECLARE_SOA_COLUMN(ZNApm2, ZNAPM2, float); //! PM2 ZNA // o2-linter: disable=name/o2-column -DECLARE_SOA_COLUMN(ZNApm3, ZNAPM3, float); //! PM3 ZNA // o2-linter: disable=name/o2-column -DECLARE_SOA_COLUMN(ZNApm4, ZNAPM4, float); //! PM4 ZNA // o2-linter: disable=name/o2-column -DECLARE_SOA_COLUMN(ZNAtdc, ZNATDC, float); //! TDC ZNA // o2-linter: disable=name/o2-column -DECLARE_SOA_COLUMN(ZNCpmc, commonPMZNC, float); //! PMC ZNC // o2-linter: disable=name/o2-column -DECLARE_SOA_COLUMN(ZNCpm1, ZNCPM1, float); //! PM1 ZNC // o2-linter: disable=name/o2-column -DECLARE_SOA_COLUMN(ZNCpm2, ZNCPM2, float); //! PM2 ZNC // o2-linter: disable=name/o2-column -DECLARE_SOA_COLUMN(ZNCpm3, ZNCPM3, float); //! PM3 ZNC // o2-linter: disable=name/o2-column -DECLARE_SOA_COLUMN(ZNCpm4, ZNCPM4, float); //! PM4 ZNC // o2-linter: disable=name/o2-column -DECLARE_SOA_COLUMN(ZNCtdc, ZNCTDC, float); //! TDC ZNC // o2-linter: disable=name/o2-column -DECLARE_SOA_COLUMN(Centrality, centrality, float); //! Centrality -DECLARE_SOA_COLUMN(Timestamp, timestamp, uint64_t); //! Timestamp -DECLARE_SOA_COLUMN(SelectionBits, selectionBits, uint8_t); //! Selection Flags -} // namespace znoutput - -DECLARE_SOA_TABLE(ZDCInterCalib, "AOD", "ZDCIC", o2::soa::Index<>, - znoutput::ZNApmc, - znoutput::ZNApm1, - znoutput::ZNApm2, - znoutput::ZNApm3, - znoutput::ZNApm4, - znoutput::ZNAtdc, - znoutput::ZNCpmc, - znoutput::ZNCpm1, - znoutput::ZNCpm2, - znoutput::ZNCpm3, - znoutput::ZNCpm4, - znoutput::ZNCtdc, - znoutput::Centrality, - znoutput::Timestamp, - znoutput::SelectionBits); -} // namespace o2::aod - -#endif // COMMON_DATAMODEL_ZDCINTERCALIB_H_ diff --git a/Common/TableProducer/CMakeLists.txt b/Common/TableProducer/CMakeLists.txt index d6980ea729f..5f0d91132a0 100644 --- a/Common/TableProducer/CMakeLists.txt +++ b/Common/TableProducer/CMakeLists.txt @@ -148,8 +148,8 @@ o2physics_add_dpl_workflow(match-mft-ft0 O2::DetectorsBase O2::DetectorsCommonDataFormats COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(zdc-task-inter-calib - SOURCES zdcTaskInterCalib.cxx +o2physics_add_dpl_workflow(zdc-extra-table-producer + SOURCES zdcExtraTableProducer.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) diff --git a/Common/TableProducer/zdcTaskInterCalib.cxx b/Common/TableProducer/zdcExtraTableProducer.cxx similarity index 71% rename from Common/TableProducer/zdcTaskInterCalib.cxx rename to Common/TableProducer/zdcExtraTableProducer.cxx index 5cf5b83725f..fda1948a893 100644 --- a/Common/TableProducer/zdcTaskInterCalib.cxx +++ b/Common/TableProducer/zdcExtraTableProducer.cxx @@ -9,14 +9,15 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file zdcTaskInterCalib.cxx -/// \brief Task for ZDC tower inter-calibration -/// \author chiara.oppedisano@cern.ch +/// \file zdcExtraTableProducer.cxx +/// \brief Task creating table with ZDC PMTs energies and calculated centroid (Q-vector) to be used for spectator plane measurement +/// \author Chiara Oppedisano , INFN Torino +/// \author Uliana Dmitrieva , INFN Torino #include "Common/CCDB/EventSelectionParams.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/ZDCInterCalib.h" +#include "Common/DataModel/ZDCExtra.h" #include #include @@ -29,6 +30,7 @@ #include #include +#include #include @@ -40,9 +42,9 @@ using namespace o2::aod::evsel; using BCsRun3 = soa::Join; using ColEvSels = soa::Join; -struct ZdcTaskInterCalib { +struct ZdcExtraTableProducer { - Produces zTab; + Produces zdcextras; // Configurable parameters // @@ -50,7 +52,8 @@ struct ZdcTaskInterCalib { Configurable maxZN{"maxZN", 399.5, "Max ZN signal"}; Configurable tdcCut{"tdcCut", false, "Flag for TDC cut"}; Configurable tdcZNmincut{"tdcZNmincut", -2.5, "Min ZN TDC cut"}; - Configurable tdcZNmaxcut{"tdcZNmaxcut", -2.5, "Max ZN TDC cut"}; + Configurable tdcZNmaxcut{"tdcZNmaxcut", 2.5, "Max ZN TDC cut"}; + Configurable cfgUsePMC{"cfgUsePMC", true, "Use common PM (true) or sum of PMs (false) "}; // Event selections Configurable cfgEvSelSel8{"cfgEvSelSel8", true, "Event selection: sel8"}; Configurable cfgEvSelVtxZ{"cfgEvSelVtxZ", 10, "Event selection: zVtx"}; @@ -92,6 +95,9 @@ struct ZdcTaskInterCalib { registry.add("ZNAsumq", "ZNAsumq; ZNA uncalib. sum PMQ; Entries", {HistType::kTH1F, {{nBins, -0.5, maxZN}}}); registry.add("ZNCsumq", "ZNCsumq; ZNC uncalib. sum PMQ; Entries", {HistType::kTH1F, {{nBins, -0.5, maxZN}}}); + registry.add("ZNACentroid", "ZNACentroid; ZNA Centroid; X; Y", {HistType::kTH2F, {{50, -1.5, 1.5}, {50, -1.5, 1.5}}}); + registry.add("ZNCCentroid", "ZNCCentroid; ZNC Centroid; X; Y", {HistType::kTH2F, {{50, -1.5, 1.5}, {50, -1.5, 1.5}}}); + registry.add("hEventCount", "Number of Event; Cut; #Events Passed Cut", {HistType::kTH1D, {{nEventSelections, 0, nEventSelections}}}); registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_allEvents + 1, "All events"); registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_zvtx + 1, "vtxZ"); @@ -101,7 +107,7 @@ struct ZdcTaskInterCalib { registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodZvtxFT0vsPV + 1, "kIsGoodZvtxFT0vsPV"); registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kNoCollInTimeRangeStandard + 1, "kNoCollInTimeRangeStandard"); registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsVertexITSTPC + 1, "kIsVertexITSTPC"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodITSLayersAll + 1, "kkIsGoodITSLayersAll"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodITSLayersAll + 1, "kIsGoodITSLayersAll"); } template @@ -206,18 +212,8 @@ struct ZdcTaskInterCalib { // double sumZNC = 0; double sumZNA = 0; - double pmqZNC[4] = { - 0, - 0, - 0, - 0, - }; - double pmqZNA[4] = { - 0, - 0, - 0, - 0, - }; + double pmqZNC[4] = {}; + double pmqZNA[4] = {}; // if (isZNChit) { for (int it = 0; it < nTowers; it++) { @@ -244,15 +240,87 @@ struct ZdcTaskInterCalib { registry.get(HIST("ZNApm4"))->Fill(pmqZNA[3]); registry.get(HIST("ZNAsumq"))->Fill(sumZNA); } - if (isZNAhit || isZNChit) - zTab(pmcZNA, pmqZNA[0], pmqZNA[1], pmqZNA[2], pmqZNA[3], tdcZNC, pmcZNC, pmqZNC[0], pmqZNC[1], pmqZNC[2], pmqZNC[3], tdcZNA, centrality, foundBC.timestamp(), evSelection); + + // Q-vectors (centroid) calculation + // kBeamEne -- LHC Run 3 Pb-Pb collision energy (5.36 TeV per nucleon pair) + constexpr float kBeamEne = 5.36 * 0.5; + + // Provide coordinates of centroid over ZN (side C) front face + constexpr float X[4] = {-1.75, 1.75, -1.75, 1.75}; + constexpr float Y[4] = {-1.75, -1.75, 1.75, 1.75}; + constexpr float kAlpha = 0.395; // saturation correction + + float numXZNC = 0., numYZNC = 0., denZNC = 0.; + float numXZNA = 0., numYZNA = 0., denZNA = 0.; + + // Calculate weighted sums of the x and y coordinates + constexpr int kNTowers = 4; // number of ZDC towers + for (int i = 0; i < kNTowers; i++) { + if (pmqZNC[i] > 0.) { + float wZNC = std::pow(pmqZNC[i], kAlpha); + numXZNC -= X[i] * wZNC; // numerator x (minus sign due to opposite orientation of ZNC) + numYZNC += Y[i] * wZNC; // numerator y + denZNC += wZNC; // denominator + } + if (pmqZNA[i] > 0.) { + float wZNA = std::pow(pmqZNA[i], kAlpha); + numXZNA += X[i] * wZNA; // numerator x + numYZNA += Y[i] * wZNA; // numerator y + denZNA += wZNA; // denominator + } + } + // Calculate centroid coordinates (in cm) with correction factor c depending on the number of spectator nucleons (nSpec) + + float zncCommon = 0; + float znaCommon = 0; + + // Use sum of PMTs (cfgUsePMC == false) when common PMT is saturated + if (cfgUsePMC) { + zncCommon = pmcZNC; + znaCommon = pmcZNA; + } else { + zncCommon = sumZNC; + znaCommon = sumZNA; + } + + float centroidZNC[2], centroidZNA[2]; + + if (denZNC != 0.) { + float nSpecnC = zncCommon / kBeamEne; + float cZNC = 1.89358 - 0.71262 / (nSpecnC + 0.71789); + centroidZNC[0] = cZNC * numXZNC / denZNC; + centroidZNC[1] = cZNC * numYZNC / denZNC; + } else { + centroidZNC[0] = 999.; + centroidZNC[1] = 999.; + } + // + if (denZNA != 0.) { + float nSpecnA = znaCommon / kBeamEne; + float cZNA = 1.89358 - 0.71262 / (nSpecnA + 0.71789); + centroidZNA[0] = cZNA * numXZNA / denZNA; + centroidZNA[1] = cZNA * numYZNA / denZNA; + } else { + centroidZNA[0] = 999.; + centroidZNA[1] = 999.; + } + registry.get(HIST("ZNCCentroid"))->Fill(centroidZNC[0], centroidZNC[1]); + registry.get(HIST("ZNACentroid"))->Fill(centroidZNA[0], centroidZNA[1]); + + auto vz = collision.posZ(); + auto vx = collision.posX(); + auto vy = collision.posY(); + + if (isZNAhit || isZNChit) { + zdcextras(pmcZNA, pmqZNA[0], pmqZNA[1], pmqZNA[2], pmqZNA[3], tdcZNA, centroidZNA[0], centroidZNA[1], pmcZNC, pmqZNC[0], pmqZNC[1], pmqZNC[2], pmqZNC[3], tdcZNC, centroidZNC[0], centroidZNC[1], centrality, vx, vy, vz, foundBC.timestamp(), evSelection); + } } } } }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) // o2-linter: disable=name/file-cpp +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(cfgc)}; } From 4e284820d3b2f94327f0b71088c127decd74e8f9 Mon Sep 17 00:00:00 2001 From: Stefanie Mrozinski <63045530+Steffimro@users.noreply.github.com> Date: Tue, 21 Oct 2025 10:20:17 +0200 Subject: [PATCH 836/986] [PWGEM] update MB task (#13454) --- PWGEM/PhotonMeson/Tasks/MaterialBudget.cxx | 1461 ++++++++++++++++---- 1 file changed, 1178 insertions(+), 283 deletions(-) diff --git a/PWGEM/PhotonMeson/Tasks/MaterialBudget.cxx b/PWGEM/PhotonMeson/Tasks/MaterialBudget.cxx index b5c1a5d8fde..fefac20d019 100644 --- a/PWGEM/PhotonMeson/Tasks/MaterialBudget.cxx +++ b/PWGEM/PhotonMeson/Tasks/MaterialBudget.cxx @@ -8,33 +8,61 @@ // 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. -// -// ======================== -// -// This code loops over v0 photons for studying material budget. -// Please write to: daiki.sekihata@cern.ch -#include -#include +/// \file MaterialBudget.cxx +/// \brief Task to analyse and calculate the material budget weights +/// \author S. Mrozinski, smrozins@cern.ch -#include "TString.h" -#include "Math/Vector4D.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "ReconstructionDataFormats/Track.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/PIDResponse.h" -#include "Common/Core/RecoDecay.h" -#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" -#include "PWGEM/PhotonMeson/Utils/PairUtilities.h" -#include "PWGEM/PhotonMeson/Core/V0PhotonCut.h" -#include "PWGEM/PhotonMeson/Core/PairCut.h" +#include "PWGEM/Dilepton/Utils/MCUtilities.h" #include "PWGEM/PhotonMeson/Core/CutsLibrary.h" +#include "PWGEM/PhotonMeson/Core/EMPhotonEventCut.h" #include "PWGEM/PhotonMeson/Core/HistogramsLibrary.h" +#include "PWGEM/PhotonMeson/Core/PairCut.h" +#include "PWGEM/PhotonMeson/Core/V0PhotonCut.h" +#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" +#include "PWGEM/PhotonMeson/Utils/MCUtilities.h" +#include "PWGEM/PhotonMeson/Utils/PairUtilities.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TPCVDriftManager.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/McCollisionExtra.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CCDB/BasicCCDBManager.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::aod; @@ -43,366 +71,1233 @@ using namespace o2::framework::expressions; using namespace o2::soa; using namespace o2::aod::pwgem::photonmeson::photonpair; using namespace o2::aod::pwgem::photon; +using namespace o2::aod::pwgem::dilepton::utils::emtrackutil; +using namespace o2::aod::pwgem::dilepton::utils::mcutil; +using namespace o2::aod::pwgem::dilepton::utils; +using o2::constants::math::TwoPI; using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; +using MyCollisionsMC = soa::Join; +using MyCollisionMC = MyCollisionsMC::iterator; + +using MyMCCollisions = soa::Join; +using MyMCCollision = MyMCCollisions::iterator; + using MyV0Photons = soa::Join; using MyV0Photon = MyV0Photons::iterator; +using MyPrimaryElectrons = soa::Filtered>; +using MyPrimaryElectron = MyPrimaryElectrons::iterator; + +using MyMCV0Legs = soa::Join; +using MyMCV0Leg = MyMCV0Legs::iterator; + +using MyTracks = soa::Join; struct MaterialBudget { Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; Configurable cfgCentMin{"cfgCentMin", 0, "min. centrality"}; - Configurable cfgCentMax{"cfgCentMax", 999, "max. centrality"}; + Configurable cfgCentMax{"cfgCentMax", 999.f, "max. centrality"}; + + struct SimplePhoton { + float pt; + float eta; + float phi; + float vz; + float r; + }; + + static constexpr int MaxMixEvents = 5; + std::map, std::deque>> mixingPools; - Configurable fConfigTagCuts{"cfgTagCuts", "qc", "Comma separated list of V0 photon cuts for tag"}; - Configurable fConfigProbeCuts{"cfgProbeCuts", "qc,wwire_ib", "Comma separated list of V0 photon cuts for probe"}; - Configurable fConfigPairCuts{"cfgPairCuts", "nocut", "Comma separated list of pair cuts"}; - Configurable fDoMixing{"DoMixing", false, "do event mixing"}; + std::vector centBinEdges = {0, 10, 30, 50, 90, 200}; + std::vector zvtxBinEdges = {-10, -5, 0, 5, 10}; + + std::tuple getPoolBin(float cent, float zvtx) + { + int centbin = std::lower_bound(centBinEdges.begin(), centBinEdges.end(), cent) - centBinEdges.begin() - 1; + centbin = std::max(0, std::min(centbin, static_cast(centBinEdges.size()) - 2)); + + int zbin = std::lower_bound(zvtxBinEdges.begin(), zvtxBinEdges.end(), zvtx) - zvtxBinEdges.begin() - 1; + zbin = std::max(0, std::min(zbin, static_cast(zvtxBinEdges.size()) - 2)); + return {centbin, zbin}; + } + + HistogramRegistry registry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; + + static constexpr std::string_view ItsClsNames[] = { + "ITSCls0", "ITSCls1", "ITSCls2", "ITSCls3", + "ITSCls4", "ITSCls5", "ITSCls6", "ITSCls7"}; + + static constexpr std::string_view EventTypes[2] = {"before/", "after/"}; + + Configurable cfgPlotBremsstrahlung{"cfgPlotBremsstrahlung", false, "produce plots to study Bremsstrahlung"}; + Configurable cfgPlotResolution{"cfgPlotResolution", false, "produce plots to study resolution"}; + Configurable cfgPlotPurity{"cfgPlotPurity", false, "produce plots to study purity"}; + Configurable cfgPlotMBDetailed{"cfgPlotMBDetailed", false, "produce plots to study material distribution distribution"}; + Configurable cfgPlotMBGeneral{"cfgPlotMBGeneral", true, "produce plots to study material distribution"}; + Configurable cfgPlotMBCollisions{"cfgPlotMBCollisions", false, "produce plots to study material distribution if collision association is wrong"}; + + ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 2.0}, ""}; + const AxisSpec axisPt{binsPt, "#it{p}_{T} [GeV/c]"}; - Configurable fConfigEMEventCut{"cfgEMEventCut", "minbias", "em event cut"}; // only 1 event cut per wagon EMPhotonEventCut fEMEventCut; - static constexpr std::string_view event_types[2] = {"before", "after"}; + struct : ConfigurableGroup { + std::string prefix = "eventcut_group"; + Configurable cfgZvtxMax{"cfgZvtxMax", 10.f, "max. Zvtx"}; + Configurable cfgRequireSel8{"cfgRequireSel8", true, "require sel8 in event cut"}; + Configurable cfgRequireFT0AND{"cfgRequireFT0AND", true, "require FT0AND in event cut"}; + Configurable cfgRequireNoTFB{"cfgRequireNoTFB", true, "require No time frame border in event cut"}; + Configurable cfgRequireNoITSROFB{"cfgRequireNoITSROFB", true, "require no ITS readout frame border in event cut"}; + Configurable cfgRequireNoSameBunchPileup{"cfgRequireNoSameBunchPileup", false, "require no same bunch pileup in event cut"}; + Configurable cfgRequireVertexITSTPC{"cfgRequireVertexITSTPC", false, "require Vertex ITSTPC in event cut"}; // ITS-TPC matched track contributes PV. + Configurable cfgRequireGoodZvtxFT0vsPV{"cfgRequireGoodZvtxFT0vsPV", false, "require good Zvtx between FT0 vs. PV in event cut"}; + Configurable cfgTrackOccupancyMin{"cfgTrackOccupancyMin", -2, "min. occupancy"}; + Configurable cfgTrackOccupancyMax{"cfgTrackOccupancyMax", 1000000000, "max. occupancy"}; + Configurable cfgFT0COccupancyMin{"cfgFT0COccupancyMin", -2, "min. FT0C occupancy"}; + Configurable cfgFT0COccupancyMax{"cfgFT0COccupancyMax", 1000000000, "max. FT0C occupancy"}; + Configurable cfgRequireNoCollInTimeRangeStandard{"cfgRequireNoCollInTimeRangeStandard", false, "require no collision in time range standard"}; + Configurable cfgRequireNoCollInTimeRangeStrict{"cfgRequireNoCollInTimeRangeStrict", false, "require no collision in time range strict"}; + Configurable cfgRequireNoCollInITSROFStandard{"cfgRequireNoCollInITSROFStandard", false, "require no collision in time range standard"}; + Configurable cfgRequireNoCollInITSROFStrict{"cfgRequireNoCollInITSROFStrict", false, "require no collision in time range strict"}; + Configurable cfgRequireNoHighMultCollInPrevRof{"cfgRequireNoHighMultCollInPrevRof", false, "require no HM collision in previous ITS ROF"}; + } eventcuts; + + DalitzEECut fDileptonCut; + struct : ConfigurableGroup { + std::string prefix = "dileptoncut_group"; + Configurable cfgMinMass{"cfgMinMass", 0.0, "min mass"}; + Configurable cfgMaxMass{"cfgMaxMass", 0.1, "max mass"}; + Configurable cfgApplyPhiv{"cfgApplyPhiv", true, "flag to apply phiv cut"}; + Configurable cfgRequireItsibAny{"cfgRequireItsibAny", false, "flag to require ITS ib any hits"}; + Configurable cfgRequireItsib1st{"cfgRequireItsib1st", true, "flag to require ITS ib 1st hit"}; + Configurable cfgPhivSlope{"cfgPhivSlope", 0.0185, "slope for m vs. phiv"}; + Configurable cfgPhivIntercept{"cfgPhivIntercept", -0.0280, "intercept for m vs. phiv"}; - OutputObj fOutputEvent{"Event"}; - OutputObj fOutputV0{"V0"}; - OutputObj fOutputPair{"Pair"}; // 2-photon pair - THashList* fMainList = new THashList(); + Configurable cfgMinPtTrack{"cfgMinPtTrack", 0.1, "min pT for single track"}; + Configurable cfgMaxEtaTrack{"cfgMaxEtaTrack", 0.8, "max eta for single track"}; + Configurable cfgMinnclusterTPC{"cfgMinnclusterTPC", 0, "min ncluster tpc"}; + Configurable cfgMinnclusterITS{"cfgMinnclusterITS", 5, "min ncluster its"}; + Configurable cfgMinncrossedrows{"cfgMinncrossedrows", 70, "min ncrossed rows"}; + Configurable cfgMaxchi2TPC{"cfgMaxchi2TPC", 4.0, "max chi2/NclsTPC"}; + Configurable cfgMaxchi2ITS{"cfgMaxchi2ITS", 36.0, "max chi2/NclsITS"}; + Configurable cfgMaxDCAxy{"cfgMaxDCAxy", 0.05, "max dca XY for single track in cm"}; + Configurable cfgMaxDCAz{"cfgMaxDCAz", 0.05, "max dca Z for single track in cm"}; + Configurable cfgMaxDCA3dsigmaTrack{"cfgMaxDCA3dsigmaTrack", 1.5, "max DCA 3D in sigma"}; + Configurable cfgMaxFracSharedClustersTPC{"cfgMaxFracSharedClustersTPC", 999.f, "max fraction of shared clusters in TPC"}; + Configurable cfgApplyCutsFromPrefilterDerived{"cfgApplyCutsFromPrefilterDerived", false, "flag to apply prefilter to electron"}; + Configurable includeITSsa{"includeITSsa", false, "Flag to enable ITSsa tracks"}; + Configurable cfgMaxpttrackITSsa{"cfgMaxpttrackITSsa", 0.15, "max pt for ITSsa tracks"}; - std::vector fTagCuts; - std::vector fProbeCuts; - std::vector fPairCuts; + Configurable cfgPIDscheme{"cfgPIDscheme", static_cast(DalitzEECut::PIDSchemes::kTOFif), "pid scheme [kTOFif : 0, kTPConly : 1]"}; + Configurable cfgMinTPCNsigmaEl{"cfgMinTPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; + Configurable cfgMaxTPCNsigmaEl{"cfgMaxTPCNsigmaEl", +3.0, "max. TPC n sigma for electron inclusion"}; + Configurable cfgMinTPCNsigmaPi{"cfgMinTPCNsigmaPi", -0.0, "min. TPC n sigma for pion exclusion"}; + Configurable cfgMaxTPCNsigmaPi{"cfgMaxTPCNsigmaPi", +0.0, "max. TPC n sigma for pion exclusion"}; + Configurable cfgMinTOFNsigmaEl{"cfgMinTOFNsigmaEl", -3.0, "min. TOF n sigma for electron inclusion"}; + Configurable cfgMaxTOFNsigmaEl{"cfgMaxTOFNsigmaEl", +3.0, "max. TOF n sigma for electron inclusion"}; + } dileptoncuts; - std::vector fPairNames; - void init(InitContext& context) + V0PhotonCut fV0PhotonCut; + struct : ConfigurableGroup { + std::string prefix = "pcmcut_group"; + Configurable cfgRequireV0WithITSTPC{"cfgRequireV0WithITSTPC", false, "flag to select V0s with ITS-TPC matched tracks"}; + Configurable cfgRequireV0WithITSOnly{"cfgRequireV0WithITSOnly", false, "flag to select V0s with ITSonly tracks"}; + Configurable cfgRequireV0WithTPCOnly{"cfgRequireV0WithTPCOnly", false, "flag to select V0s with TPConly tracks"}; + Configurable cfgMinPtV0{"cfgMinPtV0", 0.1, "min pT for v0 photons at PV"}; + Configurable cfgMaxPtV0{"cfgMaxPtV0", 1e+10, "max pT for v0 photons at PV"}; + Configurable cfgMinEtaV0{"cfgMinEtaV0", -0.8, "min eta for v0 photons at PV"}; + Configurable cfgMaxEtaV0{"cfgMaxEtaV0", +0.8, "max eta for v0 photons at PV"}; + Configurable cfgMinV0Radius{"cfgMinV0Radius", 4.0, "min v0 radius"}; + Configurable cfgMaxV0Radius{"cfgMaxV0Radius", 90.0, "max v0 radius"}; + Configurable cfgMaxAlphaAp{"cfgMaxAlphaAp", 0.95, "max alpha for AP cut"}; + Configurable cfgMaxQtAp{"cfgMaxQtAp", 0.01, "max qT for AP cut"}; + Configurable cfgMinCospa{"cfgMinCospa", 0.999, "min V0 CosPA"}; + Configurable cfgMaxPca{"cfgMaxPca", 1.5, "max distance btween 2 legs"}; + Configurable cfgMaxChi2kf{"cfgMaxChi2kf", 1e+10, "max chi2/ndf with KF"}; + Configurable cfgRejectV0OnITSib{"cfgRejectV0OnITSib", true, "flag to reject V0s on ITSib"}; + Configurable cfgMinNclusterTPC{"cfgMinNclusterTPC", 0, "min ncluster tpc"}; + Configurable cfgMinNcrossedrows{"cfgMinNcrossedrows", 40, "min ncrossed rows"}; + Configurable cfgMaxFracSharedClustersTPC{"cfgMaxFracSharedClustersTPC", 999.f, "max fraction of shared clusters in TPC"}; + Configurable cfgMaxChi2TPC{"cfgMaxChi2TPC", 4.0, "max chi2/NclsTPC"}; + Configurable cfgMaxChi2ITS{"cfgMaxChi2ITS", 36.0, "max chi2/NclsITS"}; + Configurable cfgMinTPCNsigmaEl{"cfgMinTPCNsigmaEl", -3.0, "min. TPC n sigma for electron"}; + Configurable cfgMaxTPCNsigmaEl{"cfgMaxTPCNsigmaEl", +3.0, "max. TPC n sigma for electron"}; + Configurable cfgDisableITSonlytrack{"cfgDisableITSonlytrack", false, "flag to disable ITSonly tracks"}; + Configurable cfgDisableTPCOnlytrack{"cfgDisableTPCOnlytrack", false, "flag to disable TPConly tracks"}; + } pcmcuts; + + void init(InitContext&) { - if (context.mOptions.get("processMB")) { - fPairNames.push_back("PCMPCM"); - } - DefineTagCuts(); - DefineProbeCuts(); - DefinePairCuts(); + defineEMEventCut(); + defineDileptonCut(); + definePCMCut(); addhistograms(); - TString ev_cut_name = fConfigEMEventCut.value; - fEMEventCut = *eventcuts::GetCut(ev_cut_name.Data()); + } - fOutputEvent.setObject(reinterpret_cast(fMainList->FindObject("Event"))); - fOutputV0.setObject(reinterpret_cast(fMainList->FindObject("V0"))); - fOutputPair.setObject(reinterpret_cast(fMainList->FindObject("Pair"))); + void defineEMEventCut() + { + fEMEventCut = EMPhotonEventCut("fEMEventCut", "fEMEventCut"); + fEMEventCut.SetRequireSel8(eventcuts.cfgRequireSel8); + fEMEventCut.SetRequireFT0AND(eventcuts.cfgRequireFT0AND); + fEMEventCut.SetZvtxRange(-eventcuts.cfgZvtxMax, +eventcuts.cfgZvtxMax); + fEMEventCut.SetRequireNoTFB(eventcuts.cfgRequireNoTFB); + fEMEventCut.SetRequireNoITSROFB(eventcuts.cfgRequireNoITSROFB); + fEMEventCut.SetRequireNoSameBunchPileup(eventcuts.cfgRequireNoSameBunchPileup); + fEMEventCut.SetRequireVertexITSTPC(eventcuts.cfgRequireVertexITSTPC); + fEMEventCut.SetRequireGoodZvtxFT0vsPV(eventcuts.cfgRequireGoodZvtxFT0vsPV); + fEMEventCut.SetRequireNoCollInTimeRangeStandard(eventcuts.cfgRequireNoCollInTimeRangeStandard); + fEMEventCut.SetRequireNoCollInTimeRangeStrict(eventcuts.cfgRequireNoCollInTimeRangeStrict); + fEMEventCut.SetRequireNoCollInITSROFStandard(eventcuts.cfgRequireNoCollInITSROFStandard); + fEMEventCut.SetRequireNoCollInITSROFStrict(eventcuts.cfgRequireNoCollInITSROFStrict); + fEMEventCut.SetRequireNoHighMultCollInPrevRof(eventcuts.cfgRequireNoHighMultCollInPrevRof); } - template - void add_pair_histograms(THashList* list_pair, const std::string pairname, TCuts1 const& tagcuts, TCuts2 const& probecuts, TCuts3 const& cuts3) + void defineDileptonCut() { - for (auto& cut1 : tagcuts) { - for (auto& cut2 : probecuts) { - std::string cutname1 = cut1.GetName(); - std::string cutname2 = cut2.GetName(); - - THashList* list_pair_subsys = reinterpret_cast(list_pair->FindObject(pairname.data())); - std::string photon_cut_name = cutname1 + "_" + cutname2; - o2::aod::pwgem::photon::histogram::AddHistClass(list_pair_subsys, photon_cut_name.data()); - THashList* list_pair_subsys_photoncut = reinterpret_cast(list_pair_subsys->FindObject(photon_cut_name.data())); - - for (auto& cut3 : cuts3) { - std::string pair_cut_name = cut3.GetName(); - o2::aod::pwgem::photon::histogram::AddHistClass(list_pair_subsys_photoncut, pair_cut_name.data()); - THashList* list_pair_subsys_paircut = reinterpret_cast(list_pair_subsys_photoncut->FindObject(pair_cut_name.data())); - o2::aod::pwgem::photon::histogram::DefineHistograms(list_pair_subsys_paircut, "material_budget_study", "Pair"); - } // end of cut3 loop pair cut - } // end of cut2 loop - } // end of cut1 loop + fDileptonCut = DalitzEECut("fDileptonCut", "fDileptonCut"); + + // for pair + fDileptonCut.SetMeeRange(dileptoncuts.cfgMinMass, dileptoncuts.cfgMaxMass); + fDileptonCut.SetMaxPhivPairMeeDep([&](float mll) { return (mll - dileptoncuts.cfgPhivIntercept) / dileptoncuts.cfgPhivSlope; }); + fDileptonCut.ApplyPhiV(dileptoncuts.cfgApplyPhiv); + fDileptonCut.RequireITSibAny(dileptoncuts.cfgRequireItsibAny); + fDileptonCut.RequireITSib1st(dileptoncuts.cfgRequireItsib1st); + + // for tracks + fDileptonCut.SetTrackPtRange(dileptoncuts.cfgMinPtTrack, 1e+10f); + fDileptonCut.SetTrackEtaRange(-dileptoncuts.cfgMaxEtaTrack, +dileptoncuts.cfgMaxEtaTrack); + fDileptonCut.SetMinNClustersTPC(dileptoncuts.cfgMinnclusterTPC); + fDileptonCut.SetMinNCrossedRowsTPC(dileptoncuts.cfgMinncrossedrows); + fDileptonCut.SetMinNCrossedRowsOverFindableClustersTPC(0.8); + fDileptonCut.SetMaxFracSharedClustersTPC(dileptoncuts.cfgMaxFracSharedClustersTPC); + fDileptonCut.SetChi2PerClusterTPC(0.0, dileptoncuts.cfgMaxchi2TPC); + fDileptonCut.SetChi2PerClusterITS(0.0, dileptoncuts.cfgMaxchi2ITS); + fDileptonCut.SetNClustersITS(dileptoncuts.cfgMinnclusterITS, 7); + fDileptonCut.SetMaxDcaXY(dileptoncuts.cfgMaxDCAxy); + fDileptonCut.SetMaxDcaZ(dileptoncuts.cfgMaxDCAz); + fDileptonCut.SetTrackDca3DRange(0.f, dileptoncuts.cfgMaxDCA3dsigmaTrack); // in sigma + fDileptonCut.IncludeITSsa(dileptoncuts.includeITSsa, dileptoncuts.cfgMaxpttrackITSsa); + + // for eID + fDileptonCut.SetPIDScheme(dileptoncuts.cfgPIDscheme); + fDileptonCut.SetTPCNsigmaElRange(dileptoncuts.cfgMinTPCNsigmaEl, dileptoncuts.cfgMaxTPCNsigmaEl); + fDileptonCut.SetTPCNsigmaPiRange(dileptoncuts.cfgMinTPCNsigmaPi, dileptoncuts.cfgMaxTPCNsigmaPi); + fDileptonCut.SetTOFNsigmaElRange(dileptoncuts.cfgMinTOFNsigmaEl, dileptoncuts.cfgMaxTOFNsigmaEl); + } + + void definePCMCut() + { + fV0PhotonCut = V0PhotonCut("fV0PhotonCut", "fV0PhotonCut"); + + // for v0 + fV0PhotonCut.SetV0PtRange(pcmcuts.cfgMinPtV0, pcmcuts.cfgMaxPtV0); + fV0PhotonCut.SetV0EtaRange(pcmcuts.cfgMinEtaV0, pcmcuts.cfgMaxEtaV0); + fV0PhotonCut.SetMinCosPA(pcmcuts.cfgMinCospa); + fV0PhotonCut.SetMaxPCA(pcmcuts.cfgMaxPca); + fV0PhotonCut.SetMaxChi2KF(pcmcuts.cfgMaxChi2kf); + fV0PhotonCut.SetRxyRange(pcmcuts.cfgMinV0Radius, pcmcuts.cfgMaxV0Radius); + fV0PhotonCut.SetAPRange(pcmcuts.cfgMaxAlphaAp, pcmcuts.cfgMaxQtAp); + fV0PhotonCut.RejectITSib(pcmcuts.cfgRejectV0OnITSib); + + // for track + fV0PhotonCut.SetMinNClustersTPC(pcmcuts.cfgMinNclusterTPC); + fV0PhotonCut.SetMinNCrossedRowsTPC(pcmcuts.cfgMinNcrossedrows); + fV0PhotonCut.SetMinNCrossedRowsOverFindableClustersTPC(0.8); + fV0PhotonCut.SetMaxFracSharedClustersTPC(pcmcuts.cfgMaxFracSharedClustersTPC); + fV0PhotonCut.SetChi2PerClusterTPC(0.0, pcmcuts.cfgMaxChi2TPC); + fV0PhotonCut.SetTPCNsigmaElRange(pcmcuts.cfgMinTPCNsigmaEl, pcmcuts.cfgMaxTPCNsigmaEl); + fV0PhotonCut.SetChi2PerClusterITS(-1e+10, pcmcuts.cfgMaxChi2ITS); + fV0PhotonCut.SetNClustersITS(0, 7); + fV0PhotonCut.SetMeanClusterSizeITSob(0.0, 16.0); + fV0PhotonCut.SetDisableITSonly(pcmcuts.cfgDisableITSonlytrack); + fV0PhotonCut.SetDisableTPConly(pcmcuts.cfgDisableTPCOnlytrack); + fV0PhotonCut.SetRequireITSTPC(pcmcuts.cfgRequireV0WithITSTPC); + fV0PhotonCut.SetRequireITSonly(pcmcuts.cfgRequireV0WithITSOnly); + fV0PhotonCut.SetRequireTPConly(pcmcuts.cfgRequireV0WithTPCOnly); } - static constexpr std::string_view pairnames[9] = {"PCMPCM", "PHOSPHOS", "EMCEMC", "PCMPHOS", "PCMEMC", "PCMDalitzEE", "PCMDalitzMuMu", "PHOSEMC", "DalitzEEDalitzEE"}; void addhistograms() { - fMainList->SetOwner(true); - fMainList->SetName("fMainList"); - // create sub lists first. - o2::aod::pwgem::photon::histogram::AddHistClass(fMainList, "Event"); - THashList* list_ev = reinterpret_cast(fMainList->FindObject("Event")); + auto hCollisionCounter = registry.add("Event/before/hCollisionCounter", "collision counter;;Number of events", kTH1F, {{10, 0.5, 10.5}}, false); + hCollisionCounter->GetXaxis()->SetBinLabel(1, "all"); + hCollisionCounter->GetXaxis()->SetBinLabel(2, "No TF border"); + hCollisionCounter->GetXaxis()->SetBinLabel(3, "No ITS ROF border"); + hCollisionCounter->GetXaxis()->SetBinLabel(4, "No Same Bunch Pileup"); + hCollisionCounter->GetXaxis()->SetBinLabel(5, "Is Vertex ITSTPC"); + hCollisionCounter->GetXaxis()->SetBinLabel(6, "Is Good Zvtx FT0vsPV"); + hCollisionCounter->GetXaxis()->SetBinLabel(7, "FT0AND"); + hCollisionCounter->GetXaxis()->SetBinLabel(8, "sel8"); + hCollisionCounter->GetXaxis()->SetBinLabel(9, "|Z_{vtx}| < 10 cm"); + hCollisionCounter->GetXaxis()->SetBinLabel(10, "accepted"); + + registry.add("Event/before/hZvtx", "vertex z; Z_{vtx} (cm)", kTH1F, {{100, -50, +50}}, false); + registry.add("Event/before/hMultNTracksPV", "hMultNTracksPV; N_{track} to PV", kTH1F, {{6001, -0.5, 6000.5}}, false); + registry.add("Event/before/hMultNTracksPVeta1", "hMultNTracksPVeta1; N_{track} to PV", kTH1F, {{6001, -0.5, 6000.5}}, false); + registry.add("Event/before/hMultFT0", "hMultFT0;mult. FT0A;mult. FT0C", kTH2F, {{300, 0, 6000}, {300, 0, 6000}}, false); + registry.add("Event/before/hCentFT0A", "hCentFT0A;centrality FT0A (%)", kTH1F, {{110, 0, 110}}, false); + registry.add("Event/before/hCentFT0C", "hCentFT0C;centrality FT0C (%)", kTH1F, {{110, 0, 110}}, false); + registry.add("Event/before/hCentFT0M", "hCentFT0M;centrality FT0M (%)", kTH1F, {{110, 0, 110}}, false); + registry.add("Event/before/hCentFT0MvsMultNTracksPV", "hCentFT0MvsMultNTracksPV;centrality FT0M (%);N_{track} to PV", kTH2F, {{110, 0, 110}, {600, 0, 6000}}, false); + registry.add("Event/before/hMultFT0MvsMultNTracksPV", "hMultFT0MvsMultNTracksPV;mult. FT0M;N_{track} to PV", kTH2F, {{600, 0, 6000}, {600, 0, 6000}}, false); + registry.addClone("Event/before/", "Event/after/"); + + if (cfgPlotMBGeneral) { + + registry.add("MBGeneral", ";z_{conv} (cm); R_{conv} (cm); #eta; #varphi (rad); p_{T}", kTHnSparseF, + {{200, -100.f, 100.f}, + {100, 0.f, 100.f}, + {80, -2, +2}, + {90, 0, o2::constants::math::TwoPI}, + {1000, 0, 10}}, // pT 5 + true); - o2::aod::pwgem::photon::histogram::AddHistClass(fMainList, "Pair"); - THashList* list_pair = reinterpret_cast(fMainList->FindObject("Pair")); + registry.add("Pi0/Same", + "Pi0; m_{#gamma#gamma}; #it{p}_{T}; R_{conv} (cm); R_{conv} (cm)", + kTHnSparseF, + {{400, 0.f, 0.3}, // x 0 + {500, 0, 10}, // pT 1 + {100, 0.f, 100.f}, // R of photon 1 + {100, 0.f, 100.f}}, + true); - o2::aod::pwgem::photon::histogram::AddHistClass(fMainList, "V0"); - THashList* list_v0 = reinterpret_cast(fMainList->FindObject("V0")); + registry.add("Dalitz/Same", + "Dalitz; m_{eeγ}; p_{T}; R_{γ} (cm); R_{e+}; R_{e-}", + kTHnSparseF, + {{400, 0.f, 0.5f}, + {500, 0.f, 10.f}, + {100, 0.f, 100.f}}, + true); - // for V0s - for (const auto& cut : fProbeCuts) { - const char* cutname = cut.GetName(); - THashList* list_v0_cut = o2::aod::pwgem::photon::histogram::AddHistClass(list_v0, cutname); - o2::aod::pwgem::photon::histogram::DefineHistograms(list_v0_cut, "material_budget_study", "V0"); + registry.add("Pi0/Mix", "Pi0 mixed-event;m_{#gamma#gamma};p_{T}", kTHnSparseF, + {{400, 0, 0.3}, {500, 0, 10}, {100, 0, 100}, {100, 0, 100}}, true); } - for (auto& pairname : fPairNames) { - LOGF(info, "Enabled pairs = %s", pairname.data()); + if (cfgPlotMBDetailed) { - THashList* list_ev_pair = reinterpret_cast(o2::aod::pwgem::photon::histogram::AddHistClass(list_ev, pairname.data())); - for (const auto& evtype : event_types) { - THashList* list_ev_type = reinterpret_cast(o2::aod::pwgem::photon::histogram::AddHistClass(list_ev_pair, evtype.data())); - o2::aod::pwgem::photon::histogram::DefineHistograms(list_ev_type, "Event", evtype.data()); - } + registry.add("MBStudiesWireLeft", + "photon characteristics for MB studies; x (cm); y (cm); z (cm); #varphi (rad.); R_{conv} (cm)", + kTHnSparseF, + { + {200, -20.f, 20.f}, // x 0 + {200, -20.f, 20.f}, // y 1 + {80, -20.f, 20.f}, // z 2 + {40, 3.15, 3.4}, // phi 3 + {80, 0.f, 20.f}, // conversion radius 4 + {1000, 0, 10} // pT 5 + }, + true); + + registry.add("MBStudiesWireRight", + "photon characteristics for MB studies; x (cm); y (cm); z (cm); #varphi (rad.); R_{conv} (cm)", + kTHnSparseF, + { + {200, -20.f, 20.f}, // x 0 + {200, -20.f, 20.f}, // y 1 + {80, -20.f, 20.f}, // z 2 + {40, 6.00, 6.15}, // phi 3 + {80, 0.f, 20.f}, // conversion radius 4 + {1000, 0, 10} // pT 5 + }, + true); + + registry.add("MBStudiesWireITS", + "photon characteristics for MB studies; x (cm); y (cm); z (cm); #varphi (rad.); R_{conv} (cm)", + kTHnSparseF, + { + {160, -40.f, 40.f}, // x 0 + {160, -40.f, 40.f}, // y 1 + {80, -40.f, 40.f}, // z 2 + {90, 0, TwoPI}, // phi 3 + {150, 0.f, 60.f}, // conversion radius 4 + {1000, 0, 10} // pT 5 + }, + true); + + registry.add("MBStudiesMFT", + "photon characteristics for MB studies; x (cm); y (cm); z (cm); #varphi (rad.); R_{conv} (cm)", + kTHnSparseF, + { + {160, -80.f, 80.f}, // x 0 + {160, -80.f, 80.f}, // y 1 + {40, -40.f, 40.f}, // z 2 + {90, 0, TwoPI}, // phi 3 + {40, 40.f, 60.f}, // conversion radius 4 + {500, 0, 10} // pT 5 + }, + true); - o2::aod::pwgem::photon::histogram::AddHistClass(list_pair, pairname.data()); + registry.add("MBStudiesTPC", + "photon characteristics for MB studies; x (cm); y (cm); z (cm); #varphi (rad.); R_{conv} (cm)", + kTHnSparseF, + { + {160, -90.f, 90.f}, // x 0 + {160, -90.f, 90.f}, // y 1 + {80, -40.f, 40.f}, // z 2 + {90, 0, TwoPI}, // phi 3 + {80, 60.f, 80.f}, // conversion radius 4 + {1000, 0, 10} // pT 5 + }, + true); - if (pairname == "PCMPCM") { - add_pair_histograms(list_pair, pairname, fTagCuts, fProbeCuts, fPairCuts); + for (int nCls = 0; nCls <= 7; nCls++) { // o2-linter: disable=magic-number (just numbers for ITS cluster) + registry.add(Form("ITSHits/Neg/ITSCls%d", nCls), + Form("Conversion radius NEG legs with %d ITS clusters;R_{conv} (cm);Entries", nCls), + HistType::kTH1F, + {AxisSpec{100, 0.f, 100.f}}); + + registry.add(Form("ITSHits/Pos/ITSCls%d", nCls), + Form("Conversion radius POS legs with %d ITS clusters;R_{conv} (cm);Entries", nCls), + HistType::kTH1F, + {AxisSpec{100, 0.f, 100.f}}); } + } + + if (cfgPlotResolution) { + + registry.add("ResolutionGen/Z_res", + "Z resolution (gen ref);z_gen (cm);R_gen (cm);phi_gen;eta_gen;pT_gen;Δz (cm)", + kTHnSparseF, + {{200, -100, 100}, {200, 0, 100}, {90, 0, TwoPI}, {200, -1.0f, 1.0f}, {500, 0, 10}, {120, -30, 30}}, false); + + registry.add("ResolutionGen/R_res", + "R resolution (gen ref);z_gen (cm);R_gen (cm);phi_gen;eta_gen;pT_gen;ΔR (cm)", + kTHnSparseF, + {{200, -100, 100}, {200, 0, 100}, {90, 0, TwoPI}, {200, -1.0f, 1.0f}, {500, 0, 10}, {120, -30, 30}}, false); + + registry.add("ResolutionGen/Phi_res", + "Phi resolution (gen ref);z_gen (cm);R_gen (cm);phi_gen;eta_gen;pT_gen;Δφ", + kTHnSparseF, + {{200, -100, 100}, {200, 0, 100}, {90, 0, TwoPI}, {200, -1.0f, 1.0f}, {500, 0, 10}, {100, -0.2f, 0.2f}}, false); + + registry.add("ResolutionGen/Pt_res", + "pT resolution (gen ref);z_gen (cm);R_gen (cm);phi_gen;eta_gen;pT_gen;ΔpT/pT_gen", + kTHnSparseF, + {{200, -100, 100}, {200, 0, 100}, {90, 0, TwoPI}, {200, -1.0f, 1.0f}, {500, 0, 10}, {200, -1.0f, 1.0f}}, false); + + registry.add("ResolutionGen/Eta_res", + "Eta resolution (gen ref);z_gen (cm);R_gen (cm);phi_gen;eta_gen;pT_gen;Δη", + kTHnSparseF, + {{200, -100, 100}, {200, 0, 100}, {90, 0, TwoPI}, {200, -1.0f, 1.0f}, {500, 0, 10}, {100, -0.5f, 0.5f}}, false); + + registry.add("ResolutionRec/Z_res", + "Z resolution (rec ref);z_rec (cm);R_rec (cm);phi_rec;eta_rec;pT_rec;Δz (cm)", + kTHnSparseF, + {{200, -100, 100}, {200, 0, 100}, {90, 0, TwoPI}, {200, -1.0f, 1.0f}, {500, 0, 10}, {120, -30, 30}}, false); + + registry.add("ResolutionRec/R_res", + "R resolution (rec ref);z_rec (cm);R_rec (cm);phi_rec;eta_rec;pT_rec;ΔR (cm)", + kTHnSparseF, + {{200, -100, 100}, {200, 0, 100}, {90, 0, TwoPI}, {200, -1.0f, 1.0f}, {500, 0, 10}, {120, -30, 30}}, false); + + registry.add("ResolutionRec/Phi_res", + "Phi resolution (rec ref);z_rec (cm);R_rec (cm);phi_rec;eta_rec;pT_rec;Δφ", + kTHnSparseF, + {{200, -100, 100}, {200, 0, 100}, {90, 0, TwoPI}, {200, -1.0f, 1.0f}, {500, 0, 10}, {100, -0.2f, 0.2f}}, false); + + registry.add("ResolutionRec/Pt_res", + "pT resolution (rec ref);z_rec (cm);R_rec (cm);phi_rec;eta_rec;pT_rec;ΔpT/pT_gen", + kTHnSparseF, + {{200, -100, 100}, {200, 0, 100}, {90, 0, TwoPI}, {200, -1.0f, 1.0f}, {500, 0, 10}, {200, -1.0f, 1.0f}}, false); + + registry.add("ResolutionRec/Eta_res", + "Eta resolution (rec ref);z_rec (cm);R_rec (cm);phi_rec;eta_rec;pT_rec;Δη", + kTHnSparseF, + {{200, -100, 100}, {200, 0, 100}, {90, 0, TwoPI}, {200, -1.0f, 1.0f}, {500, 0, 10}, {100, -0.5f, 0.5f}}, false); + } + + if (cfgPlotPurity) { + + registry.add("PhotonPurity", + "Photon purity classification;p_{T} (GeV/c);R_{conv} (cm);#eta;#varphi;category", + kTHnSparseF, + { + {500, 0, 10}, // pT + {200, 0, 100}, // R + {100, -1.0, 1.0}, // eta + {90, 0, o2::constants::math::TwoPI}, // phi + {12, 0.5, 12.5} // purity categories + }, + true); + + auto hPurity = registry.get(HIST("PhotonPurity")); - } // end of pair name loop + auto axis = hPurity->GetAxis(4); + + axis->SetBinLabel(1, "e^{+}e^{-}"); + axis->SetBinLabel(2, "e^{-} + #pi^{+}"); + axis->SetBinLabel(3, "#pi^{-} + e^{+}"); + axis->SetBinLabel(4, "K^{-} + e^{+}"); + axis->SetBinLabel(5, "e^{-} + K^{+}"); + axis->SetBinLabel(6, "#bar{p} + p"); + axis->SetBinLabel(7, "K^{-} + K^{+}"); + axis->SetBinLabel(8, "#pi^{-} + p"); + axis->SetBinLabel(9, "#bar{p} + #pi^{+}"); + axis->SetBinLabel(10, "#mu^{-} + #mu^{+}"); + } + + if (cfgPlotBremsstrahlung) { + + registry.add("Bremsstrahlung/EnergyLossVsR", ";R (cm);E_{loss} (GeV)", + kTH2F, {{50, 0, 100}, {100, 0, 5}}); + registry.add("Bremsstrahlung/EnergyLossXY", ";X (cm);Y (cm)", + kTH2F, {{100, -100, 100}, {100, -100, 100}}); + registry.add("Bremsstrahlung/EnergyLossXYWeigh", ";X (cm);Y (cm)", + kTH2F, {{100, -100, 100}, {100, -100, 100}}); + registry.add("Bremsstrahlung/EnergyLossVsZ", ";Z (cm);E_{loss} (GeV)", + kTH2F, {{100, -100, 100}, {200, 0, 5}}); + + registry.add("Bremsstrahlung/NBrem", ";N_{Brem} per e^{-};Counts", + kTH1I, {{10, 0, 10}}); + + registry.add("Bremsstrahlung/DeltaPoverPvsR", ";R (cm);(p_{Reco}-p_{MC})/p_{MC}", + kTH2F, {{50, 0, 100}, {200, -1, 1}}); + registry.add("Bremsstrahlung/DeltaPtvsR", ";R (cm);(p_{T,Reco}-p_{T,MC})/p_{T,MC}", + kTH2F, {{50, 0, 100}, {300, -2, 2}}); + registry.add("Bremsstrahlung/DeltaPhivsR", ";R (cm);#Delta#varphi (rad)", + kTH2F, {{50, 0, 100}, {200, -0.1, 0.1}}); + registry.add("Bremsstrahlung/DeltaEtavsR", ";R (cm);#Delta#eta", + kTH2F, {{50, 0, 100}, {200, -0.1, 0.1}}); + + registry.add("Bremsstrahlung/Sigma1PtVsR", ";R (cm);#sigma(1/p_{T}) [c/GeV]", + kTH2F, {{50, 0, 100}, {100, 0, 0.1}}); + + registry.add("Bremsstrahlung/SigmaYVsR", ";R (cm);#sigma(y) [cm]", + kTH2F, {{50, 0, 100}, {100, 0, 0.5}}); + registry.add("Bremsstrahlung/SigmaZVsR", ";R (cm);#sigma(z) [cm]", + kTH2F, {{50, 0, 100}, {100, 0, 1.0}}); + + registry.add("Bremsstrahlung/relativeResoPtWBrems", + "relative #it{p}_{T} resolution; #it{p}_{T}; #sigma(#it{p}_{T})/#it{p}_{T}", + kTProfile, + {axisPt}); + + registry.add("Bremsstrahlung/relativeResoPtWOBrems", + "relative #it{p}_{T} resolution; #it{p}_{T}; #sigma(#it{p}_{T})/#it{p}_{T}", + kTProfile, + {axisPt}); + } + + if (cfgPlotMBCollisions) { + + registry.add("RightCollisions/SparseDeltaCol", + "RightCollisions;R_{rec} (cm);#it{p}_{T} (GeV/c);#Delta #it{p}_{T}/#it{p}_{T,gen};#Delta z (cm);#Delta R (cm);#Delta col ID", + kTHnSparseF, + { + {100, 0.f, 100.f}, // R_rec + {200, 0.f, 10.f}, // pT + {200, -1.f, 1.f}, // ΔpT/pT + {200, -20.f, 20.f}, // Δz + {200, -8.f, 8.f}, // ΔR + {21, -10.5, 10.5} // ΔCollisionID + }, + true); + + registry.add("WrongCollisions/SparseDeltaCol", + "WrongCollisions;R_{rec} (cm);#it{p}_{T} (GeV/c);#Delta #it{p}_{T}/#it{p}_{T,gen};#Delta z (cm);#Delta R (cm);#Delta col ID", + kTHnSparseF, + {{100, 0.f, 100.f}, + {200, 0.f, 10.f}, + {200, -1.f, 1.f}, + {200, -20.f, 20.f}, + {200, -8.f, 8.f}, + {21, -10.5, 10.5}}, + true); + } } - void DefineTagCuts() + template + void fillITSClsNeg(HistogramRegistry& reg, float value) { - TString cutNamesStr = fConfigTagCuts.value; - if (!cutNamesStr.IsNull()) { - std::unique_ptr objArray(cutNamesStr.Tokenize(",")); - for (int icut = 0; icut < objArray->GetEntries(); ++icut) { - const char* cutname = objArray->At(icut)->GetName(); - LOGF(info, "add cut : %s", cutname); - fTagCuts.push_back(*pcmcuts::GetCut(cutname)); + if constexpr (N == 0) // o2-linter: disable=magic-number (just numbers for ITS cluster) + reg.fill(HIST("ITSHits/Neg/ITSCls0"), value); + if constexpr (N == 1) // o2-linter: disable=magic-number (just numbers for ITS cluster) + reg.fill(HIST("ITSHits/Neg/ITSCls1"), value); + if constexpr (N == 2) // o2-linter: disable=magic-number (just numbers for ITS cluster) + reg.fill(HIST("ITSHits/Neg/ITSCls2"), value); + if constexpr (N == 3) // o2-linter: disable=magic-number (just numbers for ITS cluster) + reg.fill(HIST("ITSHits/Neg/ITSCls3"), value); + if constexpr (N == 4) // o2-linter: disable=magic-number (just numbers for ITS cluster) + reg.fill(HIST("ITSHits/Neg/ITSCls4"), value); + if constexpr (N == 5) // o2-linter: disable=magic-number (just numbers for ITS cluster) + reg.fill(HIST("ITSHits/Neg/ITSCls5"), value); + if constexpr (N == 6) // o2-linter: disable=magic-number (just numbers for ITS cluster) + reg.fill(HIST("ITSHits/Neg/ITSCls6"), value); + if constexpr (N == 7) // o2-linter: disable=magic-number (just numbers for ITS cluster) + reg.fill(HIST("ITSHits/Neg/ITSCls7"), value); + } + + template + void fillITSClsPos(HistogramRegistry& reg, float value) + { + if constexpr (N == 0) // o2-linter: disable=magic-number (just numbers for ITS cluster) + reg.fill(HIST("ITSHits/Pos/ITSCls0"), value); + if constexpr (N == 1) // o2-linter: disable=magic-number (just numbers for ITS cluster) + reg.fill(HIST("ITSHits/Pos/ITSCls1"), value); + if constexpr (N == 2) // o2-linter: disable=magic-number (just numbers for ITS cluster) + reg.fill(HIST("ITSHits/Pos/ITSCls2"), value); + if constexpr (N == 3) // o2-linter: disable=magic-number (just numbers for ITS cluster) + reg.fill(HIST("ITSHits/Pos/ITSCls3"), value); + if constexpr (N == 4) // o2-linter: disable=magic-number (just numbers for ITS cluster) + reg.fill(HIST("ITSHits/Pos/ITSCls4"), value); + if constexpr (N == 5) // o2-linter: disable=magic-number (just numbers for ITS cluster) + reg.fill(HIST("ITSHits/Pos/ITSCls5"), value); + if constexpr (N == 6) // o2-linter: disable=magic-number (just numbers for ITS cluster) + reg.fill(HIST("ITSHits/Pos/ITSCls6"), value); + if constexpr (N == 7) // o2-linter: disable=magic-number (just numbers for ITS cluster) + reg.fill(HIST("ITSHits/Pos/ITSCls7"), value); + } + + template + void reconstructMesons(const TV0s& v0s) + { + for (auto i = 0; i < v0s.size(); i++) { + auto g1 = v0s.iteratorAt(i); + + for (auto j = i + 1; j < v0s.size(); j++) { + auto g2 = v0s.iteratorAt(j); + + ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); + ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + + registry.fill(HIST("Pi0/Same"), v12.M(), v12.Pt(), + g1.v0radius(), g2.v0radius()); } } - LOGF(info, "Number of Tag cuts = %d", fTagCuts.size()); } - void DefineProbeCuts() + void fillClusterNeg(HistogramRegistry& reg, int nCls, float value) { - TString cutNamesStr = fConfigProbeCuts.value; - if (!cutNamesStr.IsNull()) { - std::unique_ptr objArray(cutNamesStr.Tokenize(",")); - for (int icut = 0; icut < objArray->GetEntries(); ++icut) { - const char* cutname = objArray->At(icut)->GetName(); - LOGF(info, "add cut : %s", cutname); - fProbeCuts.push_back(*pcmcuts::GetCut(cutname)); - } + switch (nCls) { + case 0: // o2-linter: disable=magic-number (just numbers for ITS cluster) + fillITSClsNeg<0>(reg, value); + break; + case 1: // o2-linter: disable=magic-number (just numbers for ITS cluster) + fillITSClsNeg<1>(reg, value); + break; + case 2: // o2-linter: disable=magic-number (just numbers for ITS cluster) + fillITSClsNeg<2>(reg, value); + break; + case 3: // o2-linter: disable=magic-number (just numbers for ITS cluster) + fillITSClsNeg<3>(reg, value); + break; + case 4: // o2-linter: disable=magic-number (just numbers for ITS cluster) + fillITSClsNeg<4>(reg, value); + break; + case 5: // o2-linter: disable=magic-number (just numbers for ITS cluster) + fillITSClsNeg<5>(reg, value); + break; + case 6: // o2-linter: disable=magic-number (just numbers for ITS cluster) + fillITSClsNeg<6>(reg, value); + break; + case 7: // o2-linter: disable=magic-number (just numbers for ITS cluster) + fillITSClsNeg<7>(reg, value); + break; + default: + break; } - LOGF(info, "Number of Probe cuts = %d", fProbeCuts.size()); } - void DefinePairCuts() + void fillClusterPos(HistogramRegistry& reg, int nCls, float value) { - TString cutNamesStr = fConfigPairCuts.value; - if (!cutNamesStr.IsNull()) { - std::unique_ptr objArray(cutNamesStr.Tokenize(",")); - for (int icut = 0; icut < objArray->GetEntries(); ++icut) { - const char* cutname = objArray->At(icut)->GetName(); - LOGF(info, "add cut : %s", cutname); - fPairCuts.push_back(*paircuts::GetCut(cutname)); - } + switch (nCls) { + case 0: + fillITSClsPos<0>(reg, value); + break; + case 1: + fillITSClsPos<1>(reg, value); + break; + case 2: + fillITSClsPos<2>(reg, value); + break; + case 3: + fillITSClsPos<3>(reg, value); + break; + case 4: + fillITSClsPos<4>(reg, value); + break; + case 5: + fillITSClsPos<5>(reg, value); + break; + case 6: + fillITSClsPos<6>(reg, value); + break; + case 7: + fillITSClsPos<7>(reg, value); + break; + default: + break; + } + } + template + void fillEventInfo(TCollision const& collision, const float /*weight*/ = 1.f) + { + registry.fill(HIST("Event/") + HIST(EventTypes[evID]) + HIST("hCollisionCounter"), 1.0); + if (collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + registry.fill(HIST("Event/") + HIST(EventTypes[evID]) + HIST("hCollisionCounter"), 2.0); } - LOGF(info, "Number of Pair cuts = %d", fPairCuts.size()); + if (collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + registry.fill(HIST("Event/") + HIST(EventTypes[evID]) + HIST("hCollisionCounter"), 3.0); + } + if (collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + registry.fill(HIST("Event/") + HIST(EventTypes[evID]) + HIST("hCollisionCounter"), 4.0); + } + if (collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + registry.fill(HIST("Event/") + HIST(EventTypes[evID]) + HIST("hCollisionCounter"), 5.0); + } + if (collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + registry.fill(HIST("Event/") + HIST(EventTypes[evID]) + HIST("hCollisionCounter"), 6.0); + } + if (collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { + registry.fill(HIST("Event/") + HIST(EventTypes[evID]) + HIST("hCollisionCounter"), 7.0); + } + if (collision.sel8()) { + registry.fill(HIST("Event/") + HIST(EventTypes[evID]) + HIST("hCollisionCounter"), 8.0); + } + if (std::fabs(collision.posZ()) < 10.0) { // o2-linter: disable=magic-number (vertex position) + registry.fill(HIST("Event/") + HIST(EventTypes[evID]) + HIST("hCollisionCounter"), 9.0); + } + + registry.fill(HIST("Event/") + HIST(EventTypes[evID]) + HIST("hZvtx"), collision.posZ()); + + registry.fill(HIST("Event/") + HIST(EventTypes[evID]) + HIST("hMultNTracksPV"), collision.multNTracksPV()); + registry.fill(HIST("Event/") + HIST(EventTypes[evID]) + HIST("hMultNTracksPVeta1"), collision.multNTracksPVeta1()); + registry.fill(HIST("Event/") + HIST(EventTypes[evID]) + HIST("hMultFT0"), collision.multFT0A(), collision.multFT0C()); + registry.fill(HIST("Event/") + HIST(EventTypes[evID]) + HIST("hCentFT0A"), collision.centFT0A()); + registry.fill(HIST("Event/") + HIST(EventTypes[evID]) + HIST("hCentFT0C"), collision.centFT0C()); + registry.fill(HIST("Event/") + HIST(EventTypes[evID]) + HIST("hCentFT0M"), collision.centFT0M()); + registry.fill(HIST("Event/") + HIST(EventTypes[evID]) + HIST("hCentFT0MvsMultNTracksPV"), collision.centFT0M(), collision.multNTracksPV()); + registry.fill(HIST("Event/") + HIST(EventTypes[evID]) + HIST("hMultFT0MvsMultNTracksPV"), collision.multFT0A() + collision.multFT0C(), collision.multNTracksPV()); } + template + void reconstructMesonsMixed(const TV0s& current, + const std::deque>& pool) + { + for (const auto& prev : pool) { + for (const auto& g1 : current) { + if (!fV0PhotonCut.IsSelected(g1)) { + continue; + } + for (const auto& g2 : prev) { + ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); + ROOT::Math::PtEtaPhiMVector v2(g2.pt, g2.eta, g2.phi, 0.); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - Preslice perCollision_pcm = aod::v0photonkf::emeventId; + registry.fill(HIST("Pi0/Mix"), v12.M(), v12.Pt(), + g1.v0radius(), g2.r); + } + } + } + } - template - bool IsSelectedPair(TG1 const& g1, TG2 const& g2, TCut1 const& cut1, TCut2 const& cut2) + template + void reconstructDalitz(const TV0s& v0s, + const TPositrons& positronsPerCollision, + const TElectrons& electronsPerCollision, + MyCollision const& collision) { - return o2::aod::pwgem::photonmeson::photonpair::IsSelectedPair(g1, g2, cut1, cut2); + + for (const auto& g1 : v0s) { + if (!fV0PhotonCut.IsSelected(g1)) { + continue; + } + ROOT::Math::PtEtaPhiMVector vGamma(g1.pt(), g1.eta(), g1.phi(), 0.); + + for (const auto& [pos, ele] : + combinations(CombinationsFullIndexPolicy(positronsPerCollision, + electronsPerCollision))) { + + if (pos.trackId() == ele.trackId()) { + continue; + } + + if (!fDileptonCut.template IsSelectedTrack(pos, collision) || + !fDileptonCut.template IsSelectedTrack(ele, collision)) { + continue; // Track-Cuts + } + + ROOT::Math::PtEtaPhiMVector vPos(pos.pt(), pos.eta(), pos.phi(), + o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector vEle(ele.pt(), ele.eta(), ele.phi(), + o2::constants::physics::MassElectron); + + auto vee = vPos + vEle; + auto veGamma = vGamma + vee; + + registry.fill(HIST("Dalitz/Same"), + veGamma.M(), vee.Pt(), + g1.v0radius()); + } + } } - template - void fillsinglephoton(TEvents const& collisions, TPhotons const& photons, TPreslice const& perCollision, TCuts const& cuts, TLegs const& /*legs*/) + SliceCache cache; + Preslice perCollision = aod::v0photonkf::emeventId; + Preslice perCollisionElectron = aod::emprimaryelectron::emeventId; + + Partition positrons = o2::aod::emprimaryelectron::sign > int8_t(0) && dileptoncuts.cfgMinPtTrack < o2::aod::track::pt&& nabs(o2::aod::track::eta) < dileptoncuts.cfgMaxEtaTrack; + Partition electrons = o2::aod::emprimaryelectron::sign < int8_t(0) && dileptoncuts.cfgMinPtTrack < o2::aod::track::pt && nabs(o2::aod::track::eta) < dileptoncuts.cfgMaxEtaTrack; + + Filter prefilterPrimaryelectron = ifnode(dileptoncuts.cfgApplyCutsFromPrefilterDerived.node(), o2::aod::emprimaryelectron::pfbderived == static_cast(0), true); + + void processRec(MyCollisions const& collisions, + MyV0Photons const& v0photons, + aod::V0Legs const&, + MyPrimaryElectrons const& electrons) { - THashList* list_ev_pair_before = static_cast(fMainList->FindObject("Event")->FindObject(pairnames[pairtype].data())->FindObject(event_types[0].data())); - THashList* list_ev_pair_after = static_cast(fMainList->FindObject("Event")->FindObject(pairnames[pairtype].data())->FindObject(event_types[1].data())); - THashList* list_v0 = static_cast(fMainList->FindObject("V0")); - double value[4] = {0.f}; - for (auto& collision : collisions) { + for (const auto& collision : collisions) { const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; } - o2::aod::pwgem::photon::histogram::FillHistClass(list_ev_pair_before, "", collision); + fillEventInfo<0>(collision); if (!fEMEventCut.IsSelected(collision)) { continue; } - o2::aod::pwgem::photon::histogram::FillHistClass(list_ev_pair_after, "", collision); - reinterpret_cast(list_ev_pair_before->FindObject("hCollisionCounter"))->Fill("accepted", 1.f); - reinterpret_cast(list_ev_pair_after->FindObject("hCollisionCounter"))->Fill("accepted", 1.f); - - auto photons_coll = photons.sliceBy(perCollision, collision.globalIndex()); - for (auto& cut : cuts) { - for (auto& photon : photons_coll) { - if (!cut.template IsSelected(photon)) { - continue; - } - - float phi_cp = atan2(photon.vy(), photon.vx()); - float eta_cp = std::atanh(photon.vz() / sqrt(pow(photon.vx(), 2) + pow(photon.vy(), 2) + pow(photon.vz(), 2))); - value[0] = photon.pt(); - value[1] = photon.v0radius(); - value[2] = phi_cp > 0 ? phi_cp : phi_cp + TMath::TwoPi(); - value[3] = eta_cp; - reinterpret_cast(list_v0->FindObject(cut.GetName())->FindObject("hs_conv_point"))->Fill(value); - - } // end of photon loop - } // end of cut loop - - } // end of collision loop + fillEventInfo<1>(collision); + registry.fill(HIST("Event/before/hCollisionCounter"), 10.0); // accepted + registry.fill(HIST("Event/after/hCollisionCounter"), 10.0); // accepted + + auto v0sThisCollision = v0photons.sliceBy(perCollision, collision.globalIndex()); + + for (const auto& v0 : v0sThisCollision) { + + if (!fV0PhotonCut.IsSelected(v0)) { + continue; + } + + auto negLeg = v0.template negTrack_as(); + auto posLeg = v0.template posTrack_as(); + + int nClsNeg = 0; + int nClsPos = 0; + + if constexpr (requires { negLeg.itsNCls(); }) { + nClsNeg = negLeg.itsNCls(); + nClsPos = posLeg.itsNCls(); + } else if constexpr (requires { negLeg.itsClusterMap(); }) { + auto countBits = [](uint8_t map) { + return std::bitset<8>(map).count(); + }; + nClsNeg = countBits(negLeg.itsClusterMap()); + nClsPos = countBits(posLeg.itsClusterMap()); + } + if (nClsNeg >= 0 && nClsNeg <= 7) { // o2-linter: disable=magic-number (just numbers for ITS cluster) + fillClusterNeg(registry, nClsNeg, v0.v0radius()); + } + if (nClsPos >= 0 && nClsPos <= 7) { // o2-linter: disable=magic-number (just numbers for ITS cluster) + fillClusterPos(registry, nClsPos, v0.v0radius()); + } + + if (cfgPlotMBGeneral) { + + registry.fill( + HIST("MBGeneral"), + v0.vz(), // 0 + v0.v0radius(), // 1 + v0.eta(), // 2 + v0.phi(), // 3 + v0.pt()); // 4 + } + + if (cfgPlotMBDetailed) { + + registry.fill( + HIST("MBStudiesWireLeft"), + v0.vx(), // 0 + v0.vy(), // 1 + v0.vz(), // 2 + v0.phi(), // 3 + v0.v0radius(), // 4 + v0.pt()); // 5 + + registry.fill( + HIST("MBStudiesWireRight"), + v0.vx(), // 0 + v0.vy(), // 1 + v0.vz(), // 2 + v0.phi(), // 3 + v0.v0radius(), // 4 + v0.pt()); // 5 + + registry.fill( + HIST("MBStudiesWireITS"), + v0.vx(), // 0 + v0.vy(), // 1 + v0.vz(), // 2 + v0.phi(), // 3 + v0.v0radius(), // 4 + v0.pt()); // 5 + + registry.fill( + HIST("MBStudiesMFT"), + v0.vx(), // 0 + v0.vy(), // 1 + v0.vz(), // 2 + v0.phi(), // 3 + v0.v0radius(), // 4 + v0.pt()); // 5 + + registry.fill( + HIST("MBStudiesTPC"), + v0.vx(), // 0 + v0.vy(), // 1 + v0.vz(), // 2 + v0.phi(), // 3 + v0.v0radius(), // 4 + v0.pt()); // 5 + } + } + + reconstructMesons(v0sThisCollision); + + auto electronsPerCollision = electrons.sliceBy(perCollisionElectron, collision.globalIndex()); + auto positronsPerCollision = positrons.sliceBy(perCollisionElectron, collision.globalIndex()); + + reconstructDalitz(v0sThisCollision, positronsPerCollision, electronsPerCollision, collision); + + auto key = getPoolBin(centralities[cfgCentEstimator], collision.posZ()); + auto& pool = mixingPools[key]; + reconstructMesonsMixed(v0sThisCollision, pool); + + std::vector eventCopy; + eventCopy.reserve(v0sThisCollision.size()); + for (const auto& v0 : v0sThisCollision) { + if (!fV0PhotonCut.IsSelected(v0)) { + continue; + } + eventCopy.push_back({v0.pt(), v0.eta(), v0.phi(), v0.vz(), v0.v0radius()}); + } + pool.emplace_back(std::move(eventCopy)); + + if (pool.size() > MaxMixEvents) { + pool.pop_front(); + } + } + } + + int classifyPurity(int pdgNeg, int pdgPos) + { + if (pdgNeg == kElectron && pdgPos == kPositron) { + return 1; + } + if (pdgNeg == kElectron && pdgPos == kPiPlus) + return 2; + if (pdgNeg == kPiMinus && pdgPos == kPositron) + return 3; + if (pdgNeg == kKMinus && pdgPos == kPositron) + return 4; + if (pdgNeg == kElectron && pdgPos == kKPlus) + return 5; + if (pdgNeg == kProtonBar && pdgPos == kProton) + return 6; + if (pdgNeg == kKMinus && pdgPos == kKPlus) + return 7; + if (pdgNeg == kPiMinus && pdgPos == kProton) + return 8; + if (pdgNeg == kProtonBar && pdgPos == kPiPlus) + return 9; + if (pdgNeg == kMuonMinus && pdgPos == kMuonPlus) + return 10; + return 11; } - template - void SameEventPairing(TEvents const& collisions, TPhotons1 const& photons1, TPhotons2 const& photons2, TPreslice1 const& perCollision1, TPreslice2 const& perCollision2, TCuts1 const& tagcuts, TCuts2 const& probecuts, TPairCuts const& paircuts, TLegs const& /*legs*/) + Partition groupedCollisions = cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax; // this goes to same event. + Filter collisionFilterCommon = nabs(o2::aod::collision::posZ) < 10.f && o2::aod::collision::numContrib > static_cast(0) && o2::aod::evsel::sel8 == true; // o2-linter: disable=magic-number (vertex position) + Filter collisionFilterCentrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); + using MyFilteredCollisions = soa::Filtered; // this goes to same event pairing. + + void processTrue(MyCollisions const&, MyFilteredCollisions const& filteredCollisions, + MyV0Photons const& v0photons, + MyMCV0Legs const&, + aod::EMMCParticles const& mcparticles, + aod::EMMCEvents const&) { - THashList* list_pair_ss = static_cast(fMainList->FindObject("Pair")->FindObject(pairnames[pairtype].data())); + for (const auto& collision : filteredCollisions) { - for (auto& collision : collisions) { - const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; - if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { + const float centralities[3] = { + collision.centFT0M(), + collision.centFT0A(), + collision.centFT0C()}; + + if (centralities[cfgCentEstimator] < cfgCentMin || + cfgCentMax < centralities[cfgCentEstimator]) { continue; } + fillEventInfo<0>(collision); if (!fEMEventCut.IsSelected(collision)) { continue; } - auto photons1_coll = photons1.sliceBy(perCollision1, collision.globalIndex()); - auto photons2_coll = photons2.sliceBy(perCollision2, collision.globalIndex()); - - double value[6] = {0.f}; - float phi_cp2 = 0.f, eta_cp2 = 0.f; - for (auto& tagcut : tagcuts) { - for (auto& probecut : probecuts) { - for (auto& g1 : photons1_coll) { - for (auto& g2 : photons2_coll) { - if (g1.globalIndex() == g2.globalIndex()) { - continue; - } - if (!IsSelectedPair(g1, g2, tagcut, probecut)) { - continue; - } - for (auto& paircut : paircuts) { - if (!paircut.IsSelected(g1, g2)) { - continue; - } - - ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); // tag - ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); // probe - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - phi_cp2 = atan2(g2.vy(), g2.vx()); - eta_cp2 = std::atanh(g2.vz() / sqrt(pow(g2.vx(), 2) + pow(g2.vy(), 2) + pow(g2.vz(), 2))); - value[0] = v12.M(); - value[1] = g1.pt(); - value[2] = g2.pt(); - value[3] = g2.v0radius(); - value[4] = phi_cp2 > 0.f ? phi_cp2 : phi_cp2 + TMath::TwoPi(); - value[5] = eta_cp2; - reinterpret_cast(list_pair_ss->FindObject(Form("%s_%s", tagcut.GetName(), probecut.GetName()))->FindObject(paircut.GetName())->FindObject("hs_conv_point_same"))->Fill(value); - } // end of pair cut loop - } // end of g2 loop - } // end of g1 loop - } // end of probecut loop - } // end of tagcut loop - } // end of collision loop + fillEventInfo<1>(collision); + + registry.fill(HIST("Event/before/hCollisionCounter"), 10.0); + registry.fill(HIST("Event/after/hCollisionCounter"), 10.0); + + auto v0PhotonsColl = v0photons.sliceBy(perCollision, collision.globalIndex()); + + for (const auto& v0 : v0PhotonsColl) { + + auto pos = v0.posTrack_as(); + auto ele = v0.negTrack_as(); + + auto posmc = pos.template emmcparticle_as(); + auto elemc = ele.template emmcparticle_as(); + + if (!fV0PhotonCut.IsSelected(v0)) { + continue; + } + + int purityCat = 12; // default: unmatched + + purityCat = classifyPurity(elemc.pdgCode(), posmc.pdgCode()); + + float rConv = v0.v0radius(); + registry.fill(HIST("PhotonPurity"), + v0.pt(), rConv, v0.eta(), v0.phi(), purityCat); + + LOGP(info, "order: {}", posmc.pdgCode()); + + int photonid = FindCommonMotherFrom2Prongs(posmc, elemc, -11, 11, 22, mcparticles); + if (photonid < 0) { + continue; + } + + auto mcphoton = mcparticles.iteratorAt(photonid); + + float rRec = v0.v0radius(); + float rGen = std::sqrt(mcphoton.vx() * mcphoton.vx() + + mcphoton.vy() * mcphoton.vy()); + float deltaR = rRec - rGen; + float deltaZ = v0.vz() - mcphoton.vz(); + float deltaPhi = v0.phi() - mcphoton.phi(); + float deltaEta = v0.eta() - mcphoton.eta(); + float deltaPt = v0.pt() - mcphoton.pt(); + + registry.fill(HIST("ResolutionGen/Z_res"), + mcphoton.vz(), rGen, mcphoton.phi(), + mcphoton.eta(), mcphoton.pt(), deltaZ); + + registry.fill(HIST("ResolutionGen/R_res"), + mcphoton.vz(), rGen, mcphoton.phi(), + mcphoton.eta(), mcphoton.pt(), deltaR); + + registry.fill(HIST("ResolutionGen/Phi_res"), + mcphoton.vz(), rGen, mcphoton.phi(), + mcphoton.eta(), mcphoton.pt(), deltaPhi); + + registry.fill(HIST("ResolutionGen/Eta_res"), + mcphoton.vz(), rGen, mcphoton.phi(), + mcphoton.eta(), mcphoton.pt(), deltaEta); + + registry.fill(HIST("ResolutionGen/Pt_res"), + mcphoton.vz(), rGen, mcphoton.phi(), + mcphoton.eta(), mcphoton.pt(), + deltaPt / mcphoton.pt()); + + registry.fill(HIST("ResolutionRec/Z_res"), + v0.vz(), rRec, v0.phi(), v0.eta(), + v0.pt(), deltaZ); + + registry.fill(HIST("ResolutionRec/R_res"), + v0.vz(), rRec, v0.phi(), v0.eta(), + v0.pt(), deltaR); + + registry.fill(HIST("ResolutionRec/Phi_res"), + v0.vz(), rRec, v0.phi(), v0.eta(), + v0.pt(), deltaPhi); + + registry.fill(HIST("ResolutionRec/Eta_res"), + v0.vz(), rRec, v0.phi(), v0.eta(), + v0.pt(), deltaEta); + + registry.fill(HIST("ResolutionRec/Pt_res"), + v0.vz(), rRec, v0.phi(), v0.eta(), + v0.pt(), deltaPt / mcphoton.pt()); + } + } } - Configurable ndepth{"ndepth", 10, "depth for event mixing"}; - ConfigurableAxis ConfVtxBins{"ConfVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; - ConfigurableAxis ConfCentBins{"ConfCentBins", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.0f, 999.f}, "Mixing bins - centrality"}; - using BinningType_M = ColumnBinningPolicy; - using BinningType_A = ColumnBinningPolicy; - using BinningType_C = ColumnBinningPolicy; - BinningType_M colBinning_M{{ConfVtxBins, ConfCentBins}, true}; - BinningType_A colBinning_A{{ConfVtxBins, ConfCentBins}, true}; - BinningType_C colBinning_C{{ConfVtxBins, ConfCentBins}, true}; - - template - void MixedEventPairing(TEvents const& collisions, TPhotons1 const& photons1, TPhotons2 const& photons2, TPreslice1 const& perCollision1, TPreslice2 const& perCollision2, TCuts1 const& tagcuts, TCuts2 const& probecuts, TPairCuts const& paircuts, TLegs const& /*legs*/, TMixedBinning const& colBinning) + void processCollAssoc(MyCollisionsMC const& collisions, + MyMCCollisions const&, + aod::EMMCParticles const& mcparticles, + MyV0Photons const& v0photons, + MyMCV0Legs const&) { - THashList* list_pair_ss = static_cast(fMainList->FindObject("Pair")->FindObject(pairnames[pairtype].data())); - for (auto& [collision1, collision2] : soa::selfCombinations(colBinning, ndepth, -1, collisions, collisions)) { // internally, CombinationsStrictlyUpperIndexPolicy(collisions, collisions) is called. + for (auto const& col : collisions) { + + auto mccollision = col.emmcevent_as(); + + auto v0s = v0photons.sliceBy(perCollision, col.globalIndex()); + + int mcColIdDerived = mccollision.globalIndex(); // MC event (derived) global index + + for (auto const& v0 : v0s) { - const float centralities1[3] = {collision1.centFT0M(), collision1.centFT0A(), collision1.centFT0C()}; - const float centralities2[3] = {collision2.centFT0M(), collision2.centFT0A(), collision2.centFT0C()}; + if (!fV0PhotonCut.IsSelected(v0)) { + continue; + } - if (centralities1[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities1[cfgCentEstimator]) { + auto negLeg = v0.negTrack_as(); + auto posLeg = v0.posTrack_as(); + + auto negMC = negLeg.template emmcparticle_as(); + auto posMC = posLeg.template emmcparticle_as(); + + // find the photon mother in MC + int photonId = FindCommonMotherFrom2Prongs(posMC, negMC, -11, 11, 22, mcparticles); + if (photonId < 0) { + continue; + } + + auto mcPhoton = mcparticles.iteratorAt(photonId); + auto trueMcCol = mcPhoton.emmcevent_as(); // MC event where the photon was generated + int trueMcColIndex = trueMcCol.globalIndex(); + + int deltaCol = mcColIdDerived - trueMcColIndex; + + float rRec = v0.v0radius(); + float rGen = std::sqrt(mcPhoton.vx() * mcPhoton.vx() + mcPhoton.vy() * mcPhoton.vy()); + float deltaR = rRec - rGen; + float deltaZ = v0.vz() - mcPhoton.vz(); + float deltaPt = v0.pt() - mcPhoton.pt(); + float relPtRes = (mcPhoton.pt() > 0.f) ? deltaPt / mcPhoton.pt() : 0.f; + + // Fill base debug + registry.fill(HIST("DeltaRecDerived"), deltaCol); + registry.fill(HIST("AllR"), rRec); + + if (deltaCol == 0) { + registry.fill(HIST("RightCollisions/SparseDeltaCol"), + rRec, + v0.pt(), + relPtRes, + deltaZ, + deltaR, + deltaCol); + } else { + registry.fill(HIST("WrongCollisions/SparseDeltaCol"), + rRec, + v0.pt(), + relPtRes, + deltaZ, + deltaR, + deltaCol); + } + + if (deltaCol == 0) { + registry.fill(HIST("RightCollisions/DeltaColvsZ"), v0.vz()); + registry.fill(HIST("RightCollisions/DeltaColvsR"), rRec); + registry.fill(HIST("RightCollisions/DeltaColvspT"), v0.pt()); + registry.fill(HIST("RightCollisions/DeltaColvsZRes"), deltaZ); + registry.fill(HIST("RightCollisions/DeltaColvsRRes"), deltaR); + registry.fill(HIST("RightCollisions/DeltaColvspTRes"), relPtRes); + } else { + registry.fill(HIST("WrongCollisions/DeltaColvsZ"), v0.vz()); + registry.fill(HIST("WrongCollisions/DeltaColvsR"), rRec); + registry.fill(HIST("WrongCollisions/DeltaColvspT"), v0.pt()); + registry.fill(HIST("WrongCollisions/DeltaColvsZRes"), deltaZ); + registry.fill(HIST("WrongCollisions/DeltaColvsRRes"), deltaR); + registry.fill(HIST("WrongCollisions/DeltaColvspTRes"), relPtRes); + } + } + } + } + + void processBremsstrahlung(MyTracks const& tracks, aod::McParticles const& mcparticles) + { + + for (const auto& trk : tracks) { + if (!trk.has_mcParticle()) { continue; } - if (centralities2[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities2[cfgCentEstimator]) { + auto mc = trk.mcParticle(); + if (std::abs(mc.pdgCode()) != kElectron) { continue; } - if (!fEMEventCut.IsSelected(collision1) || !fEMEventCut.IsSelected(collision2)) { + + if (trk.pt() < dileptoncuts.cfgMinPtTrack) { continue; } - auto photons_coll1 = photons1.sliceBy(perCollision1, collision1.globalIndex()); - auto photons_coll2 = photons2.sliceBy(perCollision2, collision2.globalIndex()); - // LOGF(info, "collision1: posZ = %f, numContrib = %d , sel8 = %d | collision2: posZ = %f, numContrib = %d , sel8 = %d", collision1.posZ(), collision1.numContrib(), collision1.sel8(), collision2.posZ(), collision2.numContrib(), collision2.sel8()); - - double value[6] = {0.f}; - float phi_cp2 = 0.f, eta_cp2 = 0.f; - for (auto& tagcut : tagcuts) { - for (auto& probecut : probecuts) { - for (auto& g1 : photons_coll1) { - for (auto& g2 : photons_coll2) { - if (!IsSelectedPair(g1, g2, tagcut, probecut)) { - continue; - } - // LOGF(info, "Mixed event photon pair: (%d, %d) from events (%d, %d), photon event: (%d, %d)", g1.index(), g2.index(), collision1.index(), collision2.index(), g1.globalIndex(), g2.globalIndex()); - - for (auto& paircut : paircuts) { - if (!paircut.IsSelected(g1, g2)) { - continue; - } - - ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); // tag - ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); // probe - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - phi_cp2 = atan2(g2.vy(), g2.vx()); - eta_cp2 = std::atanh(g2.vz() / sqrt(pow(g2.vx(), 2) + pow(g2.vy(), 2) + pow(g2.vz(), 2))); - value[0] = v12.M(); - value[1] = g1.pt(); - value[2] = g2.pt(); - value[3] = g2.v0radius(); - value[4] = phi_cp2 > 0.f ? phi_cp2 : phi_cp2 + TMath::TwoPi(); - value[5] = eta_cp2; - reinterpret_cast(list_pair_ss->FindObject(Form("%s_%s", tagcut.GetName(), probecut.GetName()))->FindObject(paircut.GetName())->FindObject("hs_conv_point_mix"))->Fill(value); - - } // end of pair cut loop - } // end of g2 loop - } // end of g1 loop - } // end of probecut loop - } // end of tagcut loop - } // end of different collision combinations - } + double pMC = mc.p(); + double ptMC = mc.pt(); + double phiMC = mc.phi(); + double etaMC = mc.eta(); - Partition grouped_collisions = cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax; // this goes to same event. - Filter collisionFilter_common = nabs(o2::aod::collision::posZ) < 10.f && o2::aod::collision::numContrib > (uint16_t)0 && o2::aod::evsel::sel8 == true; - Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); - using MyFilteredCollisions = soa::Filtered; // this goes to mixed event. + double pReco = trk.p(); + double ptReco = trk.pt(); + double phiReco = trk.phi(); + double etaReco = trk.eta(); - void processMB(MyCollisions const&, MyFilteredCollisions const& filtered_collisions, MyV0Photons const& v0photons, aod::V0Legs const& legs) - { - fillsinglephoton(grouped_collisions, v0photons, perCollision_pcm, fProbeCuts, legs); - SameEventPairing(filtered_collisions, v0photons, v0photons, perCollision_pcm, perCollision_pcm, fTagCuts, fProbeCuts, fPairCuts, legs); - if (fDoMixing) { - if (cfgCentEstimator == 0) { - MixedEventPairing(filtered_collisions, v0photons, v0photons, perCollision_pcm, perCollision_pcm, fTagCuts, fProbeCuts, fPairCuts, legs, colBinning_M); - } else if (cfgCentEstimator == 1) { - MixedEventPairing(filtered_collisions, v0photons, v0photons, perCollision_pcm, perCollision_pcm, fTagCuts, fProbeCuts, fPairCuts, legs, colBinning_A); - } else if (cfgCentEstimator == 2) { - MixedEventPairing(filtered_collisions, v0photons, v0photons, perCollision_pcm, perCollision_pcm, fTagCuts, fProbeCuts, fPairCuts, legs, colBinning_C); + int nBrem = 0; // o2-linter: disable=magic-number + + registry.fill(HIST("Bremsstrahlung/relativeResoPtWOBrems"), trk.pt(), trk.pt() * std::sqrt(trk.c1Pt21Pt2())); + + bool isFirst = true; + for (const auto& dId : mc.daughtersIds()) { + if (dId < 0 || dId >= mcparticles.size()) { + continue; + } + auto daughter = mcparticles.iteratorAt(dId); + if (daughter.getProcess() != kPBrem) { + continue; + } + + if (std::abs(daughter.eta()) > pcmcuts.cfgMaxEtaV0) { + continue; + } + + double r = std::hypot(daughter.vx(), daughter.vy()); + double z = daughter.vz(); + + nBrem++; + + registry.fill(HIST("Bremsstrahlung/EnergyLossVsR"), r, daughter.e()); + registry.fill(HIST("Bremsstrahlung/EnergyLossVsZ"), z, daughter.e()); + registry.fill(HIST("Bremsstrahlung/EnergyLossXY"), daughter.vx(), daughter.vy()); + registry.fill(HIST("Bremsstrahlung/EnergyLossXYWeigh"), daughter.vx(), daughter.vy(), daughter.e()); + + if (isFirst) { + registry.fill(HIST("Bremsstrahlung/relativeResoPtWBrems"), trk.pt(), trk.pt() * std::sqrt(trk.c1Pt21Pt2())); + } + + registry.fill(HIST("Bremsstrahlung/Sigma1PtVsR"), r, trk.sigma1Pt()); + + registry.fill(HIST("Bremsstrahlung/SigmaYVsR"), r, trk.sigmaY()); + registry.fill(HIST("Bremsstrahlung/SigmaZVsR"), r, trk.sigmaZ()); + + if (pMC > 0) { + registry.fill(HIST("Bremsstrahlung/DeltaPoverPvsR"), r, (pReco - pMC) / pMC); + } + if (ptMC > 0) { + registry.fill(HIST("Bremsstrahlung/DeltaPtvsR"), r, (ptReco - ptMC) / ptMC); + } + registry.fill(HIST("Bremsstrahlung/DeltaPhivsR"), r, phiReco - phiMC); + registry.fill(HIST("Bremsstrahlung/DeltaEtavsR"), r, etaReco - etaMC); } + + registry.fill(HIST("Bremsstrahlung/NBrem"), nBrem); + isFirst = false; } } - void processDummy(MyCollisions::iterator const&) {} - - PROCESS_SWITCH(MaterialBudget, processMB, "process material budget", false); - PROCESS_SWITCH(MaterialBudget, processDummy, "Dummy function", true); + PROCESS_SWITCH(MaterialBudget, processRec, "process material budget", true); + PROCESS_SWITCH(MaterialBudget, processTrue, "process material budget", false); + PROCESS_SWITCH(MaterialBudget, processCollAssoc, "process material budget", false); + PROCESS_SWITCH(MaterialBudget, processBremsstrahlung, "process material budget", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc, TaskName{"material-budget"})}; + adaptAnalysisTask(cfgc)}; } From cbc6e1f2eda0de5c8b00f64818e76eaa7e914232 Mon Sep 17 00:00:00 2001 From: creetz16 <79141119+creetz16@users.noreply.github.com> Date: Tue, 21 Oct 2025 11:02:08 +0200 Subject: [PATCH 837/986] [PWGLF] Fix isGoodCollision flag in decay3bodybuilder and add config for application of SVertexer cuts for mixing (#13460) --- PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx | 15 ++++++++++++--- PWGLF/Utils/decay3bodyBuilderHelper.h | 5 +++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx b/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx index eec46c963e2..a87b90715fa 100644 --- a/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx +++ b/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx @@ -195,6 +195,7 @@ struct decay3bodyBuilder { Configurable selectPVPosZ3bodyMixing{"selectPVPosZ3bodyMixing", true, "Select same pvPosZ events in case of 3body mixing"}; Configurable maxDeltaPVPosZ3bodyMixing{"maxDeltaPVPosZ3bodyMixing", 1., "max difference between PV z position in case of 3body mixing"}; // SVertexer selections + Configurable doApplySVertexerCuts{"doApplySVertexerCuts", false, "Apply SVertexer selections during event mixing"}; Configurable minPt2V0{"minPt2V0", 0.5, "Min Pt squared of V0"}; Configurable maxTgl2V0{"maxTgl2V0", 4, "Max tgl squared of V0"}; Configurable maxDCAXY2ToMeanVertex3bodyV0{"maxDCAXY2ToMeanVertex3bodyV0", 4, "Max DCA XY squared of V0 to mean vertex"}; @@ -737,7 +738,8 @@ struct decay3bodyBuilder { decay3bodyBuilderOpts.acceptTPCOnly, decay3bodyBuilderOpts.askOnlyITSMatch, decay3bodyBuilderOpts.calculateCovariance, - false /*isEventMixing*/)) { + false /*isEventMixing*/, + false /*applySVertexerCuts*/)) { continue; } @@ -772,6 +774,13 @@ struct decay3bodyBuilder { resetMCInfo(this3BodyMCInfo); this3BodyMCInfo.isReco = true; + // set flag if selected reco collision has matched gen collision + if (collision.mcCollisionId() >= 0) { // reco collision is matched to gen collision + this3BodyMCInfo.survivedEventSel = isGoodCollision[collision.mcCollisionId()]; + } else { + this3BodyMCInfo.survivedEventSel = false; // false if reco collision not matched to gen collision + } + // check if daughters have MC particle if (!trackProton.has_mcParticle() || !trackPion.has_mcParticle() || !trackDeuteron.has_mcParticle()) { continue; @@ -1146,7 +1155,8 @@ struct decay3bodyBuilder { decay3bodyBuilderOpts.acceptTPCOnly, decay3bodyBuilderOpts.askOnlyITSMatch, decay3bodyBuilderOpts.calculateCovariance, - true /*isEventMixing*/)) { + true, /*isEventMixing*/ + mixingOpts.doApplySVertexerCuts /*applySVertexerCuts*/)) { // fill analysis tables with built candidate fillAnalysisTables(); return; @@ -1215,7 +1225,6 @@ struct decay3bodyBuilder { mcInfo.motherPdgCode = -1; mcInfo.daughterPrPdgCode = -1, mcInfo.daughterPiPdgCode = -1, mcInfo.daughterDePdgCode = -1; mcInfo.isDeuteronPrimary = false; - mcInfo.survivedEventSel = false; return; } diff --git a/PWGLF/Utils/decay3bodyBuilderHelper.h b/PWGLF/Utils/decay3bodyBuilderHelper.h index 285085b8c80..80d7995684f 100644 --- a/PWGLF/Utils/decay3bodyBuilderHelper.h +++ b/PWGLF/Utils/decay3bodyBuilderHelper.h @@ -194,7 +194,8 @@ class decay3bodyBuilderHelper bool acceptTPCOnly = false, bool askOnlyITSMatch = true, bool calculateCovariance = true, - bool isEventMixing = false) + bool isEventMixing = false, + bool doApplySVertexerCuts = false) { int collisionIndex = collision.globalIndex(); float pvX = collision.posX(); @@ -479,7 +480,7 @@ class decay3bodyBuilderHelper //_______________________________________________________________________ // SVertexer selections in case of event mixing - if (isEventMixing) { + if (isEventMixing && doApplySVertexerCuts) { applySVertexerCuts(collision, trackProton, trackPion, trackDeuteron, /*applyV0Cut = */ true); } From be06bae85f3194209800b68605fed92f7901b87a Mon Sep 17 00:00:00 2001 From: Samuele Cattaruzzi <124249902+scattaru@users.noreply.github.com> Date: Tue, 21 Oct 2025 12:01:00 +0200 Subject: [PATCH 838/986] [PWGHF] Fixing code for azimuthal correlations with identified kaons (#13463) --- .../HFC/TableProducer/correlatorDsHadrons.cxx | 29 ++++- PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx | 110 ++++++++---------- 2 files changed, 73 insertions(+), 66 deletions(-) diff --git a/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx index b2368e55f04..315036c2fd7 100644 --- a/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx @@ -257,6 +257,7 @@ struct HfCorrelatorDsHadrons { AxisSpec const axisPosZ = {binsPosZ, "PosZ"}; AxisSpec const axisPoolBin = {binsPoolBin, "PoolBin"}; AxisSpec const axisStatus = {15, 0.5, 15.5, "Selection status"}; + const AxisSpec axisPid{20, -10.f, 10.f, "n #sigma"}; // Histograms for data analysis registry.add("hCollisionPoolBin", "Ds candidates collision pool bin", {HistType::kTH1F, {axisPoolBin}}); @@ -278,6 +279,14 @@ struct HfCorrelatorDsHadrons { registry.add("hMassDsData", "Ds candidates mass", {HistType::kTH1F, {axisMassD}}); registry.add("hDsPoolBin", "Ds candidates pool bin", {HistType::kTH1F, {axisPoolBin}}); registry.add("hTracksPoolBin", "Particles associated pool bin", {HistType::kTH1F, {axisPoolBin}}); + if (pidTrkApplied) { + registry.add("hTpcNSigmaPIDpion", "n sigma tpc for pion hypothesis", {HistType::kTH2F, {{axisPid}, {axisPtHadron}}}); + registry.add("hTpcNSigmaPIDkaon", "n sigma tpc for kaon hypothesis", {HistType::kTH2F, {{axisPid}, {axisPtHadron}}}); + registry.add("hTpcNSigmaPIDproton", "n sigma tpc for proton hypothesis", {HistType::kTH2F, {{axisPid}, {axisPtHadron}}}); + registry.add("hTofNSigmaPIDpion", "n sigma tof for pion hypothesis", {HistType::kTH2F, {{axisPid}, {axisPtHadron}}}); + registry.add("hTofNSigmaPIDkaon", "n sigma tof for kaon hypothesis", {HistType::kTH2F, {{axisPid}, {axisPtHadron}}}); + registry.add("hTofNSigmaPIDproton", "n sigma tof for proton hypothesis", {HistType::kTH2F, {{axisPid}, {axisPtHadron}}}); + } } // Histograms for MC Reco analysis if (fillHistoMcRec) { @@ -321,6 +330,7 @@ struct HfCorrelatorDsHadrons { if (pidTrkApplied) { registry.add("hCorrKaonsLSPairs", "Ds-kaon correlations LS MC Gen", {HistType::kTH3F, {{axisPhi}, {axisPtD}, {axisPtHadron}}}); registry.add("hCorrKaonsULSPairs", "Ds-kaon correlations ULS MC Gen", {HistType::kTH3F, {{axisPhi}, {axisPtD}, {axisPtHadron}}}); + registry.add("hDsWoKaons", "Collisions with Ds mesons without kaons", {HistType::kTH1F, {{1, -0.5, 0.5, "n coll w/o kaons"}}}); } } } @@ -724,6 +734,9 @@ struct HfCorrelatorDsHadrons { prongsId[counterDaughters - 1] = daughI.globalIndex(); } } + + int numberOfCorrKaons = 0; + // Ds Hadron correlation dedicated section for (const auto& particleAssoc : groupedMcParticles) { if (std::abs(particleAssoc.eta()) > etaTrackMax || particleAssoc.pt() < ptTrackMin || particleAssoc.pt() > ptTrackMax) { @@ -754,8 +767,11 @@ struct HfCorrelatorDsHadrons { if (pidTrkApplied) { if (((chargeDs == 1) && (particleAssoc.pdgCode() == kKPlus)) || ((chargeDs == -1) && (particleAssoc.pdgCode() == kKMinus))) { // LS pairs registry.fill(HIST("hCorrKaonsLSPairs"), getDeltaPhi(particleAssoc.phi(), particle.phi()), particle.pt(), particleAssoc.pt()); - } else { // ULS pairs + numberOfCorrKaons++; + } + if (((chargeDs == 1) && (particleAssoc.pdgCode() == kKMinus)) || ((chargeDs == -1) && (particleAssoc.pdgCode() == kKPlus))) { // ULS pairs registry.fill(HIST("hCorrKaonsULSPairs"), getDeltaPhi(particleAssoc.phi(), particle.phi()), particle.pt(), particleAssoc.pt()); + numberOfCorrKaons++; } } } @@ -771,8 +787,11 @@ struct HfCorrelatorDsHadrons { 0); entryDsHadronRecoInfo(MassDS, true, isDecayChan); entryDsHadronGenInfo(isDsPrompt, particleAssoc.isPhysicalPrimary(), trackOrigin); + } // end loop generated particles + if (numberOfCorrKaons == 0) { + registry.fill(HIST("hDsWoKaons"), numberOfCorrKaons); } - } // end loop generated particles + } // if statement for Ds selection } // end loop generated Ds } // end loop reconstructed collision } // end loop generated collision @@ -821,6 +840,12 @@ struct HfCorrelatorDsHadrons { if (!passPIDSelection(track, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) { continue; } + registry.fill(HIST("hTpcNSigmaPIDpion"), track.tpcNSigmaPi(), track.pt()); + registry.fill(HIST("hTpcNSigmaPIDkaon"), track.tpcNSigmaKa(), track.pt()); + registry.fill(HIST("hTpcNSigmaPIDproton"), track.tpcNSigmaPr(), track.pt()); + registry.fill(HIST("hTofNSigmaPIDpion"), track.tofNSigmaPi(), track.pt()); + registry.fill(HIST("hTofNSigmaPIDkaon"), track.tofNSigmaKa(), track.pt()); + registry.fill(HIST("hTofNSigmaPIDproton"), track.tofNSigmaPr(), track.pt()); } assocTrackReduced(indexHfcReducedCollision, track.globalIndex(), track.phi(), track.eta(), track.pt() * track.sign()); assocTrackSelInfo(indexHfcReducedCollision, track.tpcNClsCrossedRows(), track.itsClusterMap(), track.itsNCls(), track.dcaXY(), track.dcaZ()); diff --git a/PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx b/PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx index 450258ab02b..e80fadbbbc9 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx @@ -188,8 +188,26 @@ struct HfTaskCorrelationDsHadrons { // Histograms for data analysis registry.add("hBdtScorePrompt", "Ds BDT prompt score", {HistType::kTH1F, {axisBdtScore}}); registry.add("hBdtScoreBkg", "Ds BDT bkg score", {HistType::kTH1F, {axisBdtScore}}); + registry.add("hMassDsVsPt", "Ds candidates massVsPt", {HistType::kTH2F, {{axisMassD}, {axisPtD}}}); + if (doLSpair) { + registry.add("hCorrel2DVsPtSignalRegionLS", "Ds-h correlations signal region - LS pairs", {HistType::kTHnSparseD, {{axisDetlaPhi}, {axisDetlaEta}, {axisPtD}, {axisPtHadron}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtSidebandLeftLS", "Ds-h correlations sideband left region - LS pairs", {HistType::kTHnSparseD, {{axisDetlaPhi}, {axisDetlaEta}, {axisPtD}, {axisPtHadron}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtSidebandRightLS", "Ds-h correlations sideband right region - LS pairs", {HistType::kTHnSparseD, {{axisDetlaPhi}, {axisDetlaEta}, {axisPtD}, {axisPtHadron}, {axisPoolBin}}}); + + registry.get(HIST("hCorrel2DVsPtSignalRegionLS"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtSidebandLeftLS"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtSidebandRightLS"))->Sumw2(); + } + if (doULSpair) { + registry.add("hCorrel2DVsPtSignalRegionULS", "Ds-h correlations signal region - ULS pairs", {HistType::kTHnSparseD, {{axisDetlaPhi}, {axisDetlaEta}, {axisPtD}, {axisPtHadron}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtSidebandLeftULS", "Ds-h correlations sideband left region - ULS pairs", {HistType::kTHnSparseD, {{axisDetlaPhi}, {axisDetlaEta}, {axisPtD}, {axisPtHadron}, {axisPoolBin}}}); + registry.add("hCorrel2DVsPtSidebandRightULS", "Ds-h correlations sideband right region - ULS pairs", {HistType::kTHnSparseD, {{axisDetlaPhi}, {axisDetlaEta}, {axisPtD}, {axisPtHadron}, {axisPoolBin}}}); + + registry.get(HIST("hCorrel2DVsPtSignalRegionULS"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtSidebandLeftULS"))->Sumw2(); + registry.get(HIST("hCorrel2DVsPtSidebandRightULS"))->Sumw2(); + } if (fillHistoData) { - registry.add("hMassDsVsPt", "Ds candidates massVsPt", {HistType::kTH2F, {{axisMassD}, {axisPtD}}}); registry.add("hDeltaEtaPtIntSignalRegion", "Ds-h deltaEta signal region", {HistType::kTH1F, {axisDetlaEta}}); registry.add("hDeltaPhiPtIntSignalRegion", "Ds-h deltaPhi signal region", {HistType::kTH1F, {axisDetlaPhi}}); registry.add("hCorrel2DVsPtSignalRegion", "Ds-h correlations signal region", {HistType::kTHnSparseD, {{axisDetlaPhi}, {axisDetlaEta}, {axisPtD}, {axisPtHadron}, {axisPoolBin}}}); @@ -473,14 +491,10 @@ struct HfTaskCorrelationDsHadrons { // in signal region if (massD > signalRegionInner->at(ptBinD) && massD < signalRegionOuter->at(ptBinD)) { if (doLSpair && ((ptD > 0. && ptHadron > 0.) || (ptD < 0. && ptHadron < 0.))) { // like-sign pairs - registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSignalRegion"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSignalRegion"), deltaPhi, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSignalRegionLS"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); } else if (doULSpair && ((ptD > 0. && ptHadron < 0.) || (ptD < 0. && ptHadron > 0.))) { // unlike-sign pairs - registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSignalRegion"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSignalRegion"), deltaPhi, efficiencyWeight); - } else { // default case + registry.fill(HIST("hCorrel2DVsPtSignalRegionULS"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + } else if (fillHistoData) { // default case registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); registry.fill(HIST("hDeltaEtaPtIntSignalRegion"), deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaPhiPtIntSignalRegion"), deltaPhi, efficiencyWeight); @@ -489,14 +503,10 @@ struct HfTaskCorrelationDsHadrons { // in sideband left region if (massD > sidebandLeftOuter->at(ptBinD) && massD < sidebandLeftInner->at(ptBinD)) { if (doLSpair && ((ptD > 0. && ptHadron > 0.) || (ptD < 0. && ptHadron < 0.))) { // like-sign pairs - registry.fill(HIST("hCorrel2DVsPtSidebandLeft"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSidebandLeft"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSidebandLeft"), deltaPhi, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSidebandLeftLS"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); } else if (doULSpair && ((ptD > 0. && ptHadron < 0.) || (ptD < 0. && ptHadron > 0.))) { // unlike-sign pairs - registry.fill(HIST("hCorrel2DVsPtSidebandLeft"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSidebandLeft"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSidebandLeft"), deltaPhi, efficiencyWeight); - } else { // default case + registry.fill(HIST("hCorrel2DVsPtSidebandLeftULS"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + } else if (fillHistoData) { // default case registry.fill(HIST("hCorrel2DVsPtSidebandLeft"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); registry.fill(HIST("hDeltaEtaPtIntSidebandLeft"), deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaPhiPtIntSidebandLeft"), deltaPhi, efficiencyWeight); @@ -505,14 +515,10 @@ struct HfTaskCorrelationDsHadrons { // in sideband right region if (massD > sidebandRightInner->at(ptBinD) && massD < sidebandRightOuter->at(ptBinD)) { if (doLSpair && ((ptD > 0. && ptHadron > 0.) || (ptD < 0. && ptHadron < 0.))) { // like-sign pairs - registry.fill(HIST("hCorrel2DVsPtSidebandRight"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSidebandRight"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSidebandRight"), deltaPhi, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSidebandRightLS"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); } else if (doULSpair && ((ptD > 0. && ptHadron < 0.) || (ptD < 0. && ptHadron > 0.))) { // unlike-sign pairs - registry.fill(HIST("hCorrel2DVsPtSidebandRight"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSidebandRight"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSidebandRight"), deltaPhi, efficiencyWeight); - } else { // default case + registry.fill(HIST("hCorrel2DVsPtSidebandRightULS"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + } else if (fillHistoData) { // default case registry.fill(HIST("hCorrel2DVsPtSidebandRight"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); registry.fill(HIST("hDeltaEtaPtIntSidebandRight"), deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaPhiPtIntSidebandRight"), deltaPhi, efficiencyWeight); @@ -691,14 +697,10 @@ struct HfTaskCorrelationDsHadrons { // in signal region if (massD > signalRegionInner->at(ptBinD) && massD < signalRegionOuter->at(ptBinD)) { if (doLSpair && ((ptD > 0. && ptHadron > 0.) || (ptD < 0. && ptHadron < 0.))) { // like-sign pairs - registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSignalRegion"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSignalRegion"), deltaPhi, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSignalRegionLS"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); } else if (doULSpair && ((ptD > 0. && ptHadron < 0.) || (ptD < 0. && ptHadron > 0.))) { // unlike-sign pairs - registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSignalRegion"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSignalRegion"), deltaPhi, efficiencyWeight); - } else { // default case + registry.fill(HIST("hCorrel2DVsPtSignalRegionULS"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + } else if (fillHistoData) { // default case registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); registry.fill(HIST("hDeltaEtaPtIntSignalRegion"), deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaPhiPtIntSignalRegion"), deltaPhi, efficiencyWeight); @@ -707,14 +709,10 @@ struct HfTaskCorrelationDsHadrons { // in sideband left region if (massD > sidebandLeftOuter->at(ptBinD) && massD < sidebandLeftInner->at(ptBinD)) { if (doLSpair && ((ptD > 0. && ptHadron > 0.) || (ptD < 0. && ptHadron < 0.))) { // like-sign pairs - registry.fill(HIST("hCorrel2DVsPtSidebandLeft"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSidebandLeft"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSidebandLeft"), deltaPhi, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSidebandLeftLS"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); } else if (doULSpair && ((ptD > 0. && ptHadron < 0.) || (ptD < 0. && ptHadron > 0.))) { // unlike-sign pairs - registry.fill(HIST("hCorrel2DVsPtSidebandLeft"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSidebandLeft"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSidebandLeft"), deltaPhi, efficiencyWeight); - } else { // default case + registry.fill(HIST("hCorrel2DVsPtSidebandLeftULS"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + } else if (fillHistoData) { // default case registry.fill(HIST("hCorrel2DVsPtSidebandLeft"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); registry.fill(HIST("hDeltaEtaPtIntSidebandLeft"), deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaPhiPtIntSidebandLeft"), deltaPhi, efficiencyWeight); @@ -723,14 +721,10 @@ struct HfTaskCorrelationDsHadrons { // in sideband right region if (massD > sidebandRightInner->at(ptBinD) && massD < sidebandRightOuter->at(ptBinD)) { if (doLSpair && ((ptD > 0. && ptHadron > 0.) || (ptD < 0. && ptHadron < 0.))) { // like-sign pairs - registry.fill(HIST("hCorrel2DVsPtSidebandRight"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSidebandRight"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSidebandRight"), deltaPhi, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSidebandRightLS"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); } else if (doULSpair && ((ptD > 0. && ptHadron < 0.) || (ptD < 0. && ptHadron > 0.))) { // unlike-sign pairs - registry.fill(HIST("hCorrel2DVsPtSidebandRight"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSidebandRight"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSidebandRight"), deltaPhi, efficiencyWeight); - } else { // default case + registry.fill(HIST("hCorrel2DVsPtSidebandRightULS"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + } else if (fillHistoData) { // default case registry.fill(HIST("hCorrel2DVsPtSidebandRight"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); registry.fill(HIST("hDeltaEtaPtIntSidebandRight"), deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaPhiPtIntSidebandRight"), deltaPhi, efficiencyWeight); @@ -763,14 +757,10 @@ struct HfTaskCorrelationDsHadrons { // in signal region if (massD > signalRegionInner->at(ptBinD) && massD < signalRegionOuter->at(ptBinD)) { if (doLSpair && ((ptD > 0. && ptHadron > 0.) || (ptD < 0. && ptHadron < 0.))) { // like-sign pairs - registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSignalRegion"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSignalRegion"), deltaPhi, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSignalRegionLS"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); } else if (doULSpair && ((ptD > 0. && ptHadron < 0.) || (ptD < 0. && ptHadron > 0.))) { // unlike-sign pairs - registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSignalRegion"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSignalRegion"), deltaPhi, efficiencyWeight); - } else { // default case + registry.fill(HIST("hCorrel2DVsPtSignalRegionULS"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + } else if (fillHistoData) { // default case registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); registry.fill(HIST("hDeltaEtaPtIntSignalRegion"), deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaPhiPtIntSignalRegion"), deltaPhi, efficiencyWeight); @@ -779,14 +769,10 @@ struct HfTaskCorrelationDsHadrons { // in sideband left region if (massD > sidebandLeftOuter->at(ptBinD) && massD < sidebandLeftInner->at(ptBinD)) { if (doLSpair && ((ptD > 0. && ptHadron > 0.) || (ptD < 0. && ptHadron < 0.))) { // like-sign pairs - registry.fill(HIST("hCorrel2DVsPtSidebandLeft"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSidebandLeft"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSidebandLeft"), deltaPhi, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSidebandLeftLS"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); } else if (doULSpair && ((ptD > 0. && ptHadron < 0.) || (ptD < 0. && ptHadron > 0.))) { // unlike-sign pairs - registry.fill(HIST("hCorrel2DVsPtSidebandLeft"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSidebandLeft"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSidebandLeft"), deltaPhi, efficiencyWeight); - } else { // default case + registry.fill(HIST("hCorrel2DVsPtSidebandLeftULS"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + } else if (fillHistoData) { // default case registry.fill(HIST("hCorrel2DVsPtSidebandLeft"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); registry.fill(HIST("hDeltaEtaPtIntSidebandLeft"), deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaPhiPtIntSidebandLeft"), deltaPhi, efficiencyWeight); @@ -795,14 +781,10 @@ struct HfTaskCorrelationDsHadrons { // in sideband right region if (massD > sidebandRightInner->at(ptBinD) && massD < sidebandRightOuter->at(ptBinD)) { if (doLSpair && ((ptD > 0. && ptHadron > 0.) || (ptD < 0. && ptHadron < 0.))) { // like-sign pairs - registry.fill(HIST("hCorrel2DVsPtSidebandRight"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSidebandRight"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSidebandRight"), deltaPhi, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSidebandRightLS"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); } else if (doULSpair && ((ptD > 0. && ptHadron < 0.) || (ptD < 0. && ptHadron > 0.))) { // unlike-sign pairs - registry.fill(HIST("hCorrel2DVsPtSidebandRight"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); - registry.fill(HIST("hDeltaEtaPtIntSidebandRight"), deltaEta, efficiencyWeight); - registry.fill(HIST("hDeltaPhiPtIntSidebandRight"), deltaPhi, efficiencyWeight); - } else { // default case + registry.fill(HIST("hCorrel2DVsPtSidebandRightULS"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); + } else if (fillHistoData) { // default case registry.fill(HIST("hCorrel2DVsPtSidebandRight"), deltaPhi, deltaEta, std::abs(ptD), std::abs(ptHadron), poolBin, efficiencyWeight); registry.fill(HIST("hDeltaEtaPtIntSidebandRight"), deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaPhiPtIntSidebandRight"), deltaPhi, efficiencyWeight); From 5f48d1565ed58d05f8073446dd02415a520d1c3b Mon Sep 17 00:00:00 2001 From: JimunLee Date: Tue, 21 Oct 2025 21:50:34 +0900 Subject: [PATCH 839/986] [PWGLF] Fixed the data reconstruction part of KstarInOO.cxx (#13475) Co-authored-by: jimun_lee --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 54 +++++++++++++++------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index c924acc15f4..d8c512c11ae 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -172,10 +172,12 @@ struct kstarInOO { if (cfgDataHistos) { histos.add("nEvents", "nEvents", kTH1F, {{4, 0.0, 4.0}}); - histos.add("hUSS", "hUSS", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hLSS", "hLSS", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hUSS_Mix", "hUSS_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hLSS_Mix", "hLSS_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hUSS_KPi", "hUSS_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hUSS_PiK", "hUSS_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hLSS_KPi", "hLSS_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hLSS_PiK", "hLSS_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hUSS_Mix_KPi", "hUSS_Mix_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hUSS_Mix_PiK", "hUSS_Mix_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); } if (cfgMcHistos) { @@ -385,26 +387,29 @@ struct kstarInOO { for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - auto [KstarPt, Minv] = minvReconstruction(trk1, trk2, QA, false); + auto [KstarPt_Kpi, Minv_Kpi] = minvReconstruction(trk1, trk2, QA, false); + auto [KstarPt_piK, Minv_piK] = minvReconstruction(trk1, trk2, QA, true); + + if (Minv_Kpi < 0) + continue; double conjugate = trk1.sign() * trk2.sign(); if (cfgDataHistos) { - if (Minv > 0) { - if (!IsMix) { - if (conjugate < 0) { - histos.fill(HIST("hUSS"), centrality, KstarPt, Minv); - } else if (conjugate > 0) { - histos.fill(HIST("hLSS"), centrality, KstarPt, Minv); - } - } else { - if (conjugate < 0) { - histos.fill(HIST("hUSS_Mix"), centrality, KstarPt, Minv); - } else if (conjugate > 0) { - histos.fill(HIST("hLSS_Mix"), centrality, KstarPt, Minv); - } + if (!IsMix) { + if (conjugate < 0) { + histos.fill(HIST("hUSS_KPi"), centrality, KstarPt_Kpi, Minv_Kpi); + histos.fill(HIST("hUSS_PiK"), centrality, KstarPt_piK, Minv_piK); + } else if (conjugate > 0) { + histos.fill(HIST("hLSS_KPi"), centrality, KstarPt_Kpi, Minv_Kpi); + histos.fill(HIST("hLSS_PiK"), centrality, KstarPt_piK, Minv_piK); + } + } else { + if (conjugate < 0) { + histos.fill(HIST("hUSS_KPi_Mix"), centrality, KstarPt_Kpi, Minv_Kpi); + histos.fill(HIST("hUSS_PiK_Mix"), centrality, KstarPt_piK, Minv_piK); } } - } // cfgDataHistos + } } // for } // TrackSlicing @@ -419,8 +424,6 @@ struct kstarInOO { std::vector PIDPurityKey_Kaon; std::vector PIDPurityKey_Pion; - // double KstarPt_Kpi, Minv_Kpi; - for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) continue; @@ -428,9 +431,6 @@ struct kstarInOO { auto [KstarPt_Kpi, Minv_Kpi] = minvReconstruction(trk1, trk2, QA, false); auto [KstarPt_piK, Minv_piK] = minvReconstruction(trk1, trk2, QA, true); - // std::tie(KstarPt_Kpi, Minv_Kpi) = minvReconstruction(trk1, trk2, QA, false); - // std::tie(KstarPt_Kpi, Minv_Kpi) = minvReconstruction(trk1, trk2, QA, true); - if (Minv_Kpi < 0) continue; @@ -704,7 +704,7 @@ struct kstarInOO { } TrackSlicingMC(collision, tracks, collision, tracks, false, true); } // processSameEvents_MC - PROCESS_SWITCH(kstarInOO, processSameEventMC, "process Same Event MC", true); + PROCESS_SWITCH(kstarInOO, processSameEventMC, "process Same Event MC", false); //======================================================= //| @@ -776,6 +776,10 @@ struct kstarInOO { if (cfgMcHistos) { histos.fill(HIST("hMC_kstar_True"), centrality, particle.pt()); } + if (cfgMcHistos) { + histos.fill(HIST("nEvents_MC_True"), 1.5); + } + } // loop over particles } // processMCTrue PROCESS_SWITCH(kstarInOO, processMCTrue, "process MC True", false); From 937021c97bf818e90a72b899f1184d56129b4af3 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Tue, 21 Oct 2025 21:32:13 +0200 Subject: [PATCH 840/986] [PWGLF] Strangeness tof: implement BC start time shift (#13472) Co-authored-by: ALICE Builder --- .../Strangeness/strangederivedbuilder.cxx | 2 + .../Strangeness/strangenesstofpid.cxx | 420 +++++++++++++----- 2 files changed, 301 insertions(+), 121 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx index 5a563a10a3d..4c7129dd583 100644 --- a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx @@ -389,6 +389,7 @@ struct strangederivedbuilder { } histos.add("h2dNVerticesVsCentrality", "h2dNVerticesVsCentrality", kTH2D, {axisCentrality, axisNVertices}); + histos.add("h2dCollisionTimesVsNTracks", "h2dCollisionTimesVsNTracks", kTH2D, {{100, -0.5f, 99.5}, {2000, -1000.0f, 1000.0f}}); // for QA and test purposes auto hRawCentrality = histos.add("hRawCentrality", "hRawCentrality", kTH1F, {axisRawCentrality}); @@ -602,6 +603,7 @@ struct strangederivedbuilder { } else { collisionEventTime[collision.globalIndex()] = -1e+6; // undefined } + histos.fill(HIST("h2dCollisionTimesVsNTracks"), collisionNtracks[collision.globalIndex()], collisionEventTime[collision.globalIndex()]); products.straEvTimes(collisionEventTime[collision.globalIndex()]); } } diff --git a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx index 15e2b439344..dd49afb136c 100644 --- a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx @@ -102,6 +102,8 @@ struct strangenesstofpid { Configurable calculateV0s{"calculateV0s", -1, "calculate V0-related TOF PID (0: no, 1: yes, -1: auto)"}; Configurable calculateCascades{"calculateCascades", -1, "calculate cascade-related TOF PID (0: no, 1: yes, -1: auto)"}; Configurable reassociateTracks{"reassociateTracks", true, "if true, reassociate tracks to the collision the V0 or cascade belongs to. Relevant especially at high IR"}; + Configurable doBCshift{"doBCshift", true, "if true, perform time shift for collisions in different BCs when reassigning"}; + Configurable rejectUndefinedTof{"rejectUndefinedTof", true, "if true, reject tracks with TOF signal 0.000f for safety"}; // auxiliary / debug tables as desired Configurable calculateV0TOFPIDs{"calculateV0TOFPIDs", -1, "calculate V0TOFPIDs table (0: no, 1: yes, -1: auto)"}; @@ -139,7 +141,6 @@ struct strangenesstofpid { Configurable qaTPCNSigma{"qaTPCNSigma", 5, "TPC N-sigma to apply for qa plots"}; } cascadeGroup; - // CCDB options // CCDB options struct : ConfigurableGroup { std::string prefix = "ccdb"; @@ -155,20 +156,30 @@ struct strangenesstofpid { Configurable useCustomRunNumber{"useCustomRunNumber", false, "Use custom timestamp"}; Configurable manualRunNumber{"manualRunNumber", 544122, "manual run number if no collisions saved"}; - ConfigurableAxis axisPosition{"axisPosition", {400, -400.f, +400.f}, "position (cm)"}; - ConfigurableAxis axisEta{"axisEta", {20, -1.0f, +1.0f}, "#eta"}; - ConfigurableAxis axisDeltaTime{"axisDeltaTime", {2000, -1000.0f, +1000.0f}, "delta-time (ps)"}; - ConfigurableAxis axisDeltaTimeVsPrimaryCalculation{"axisDeltaTimeVsPrimaryCalculation", {500, -500.0f, +500.0f}, "delta-time (ps)"}; - ConfigurableAxis axisTime{"axisTime", {400, 10000.0f, +50000.0f}, "T (ps)"}; - ConfigurableAxis axisNSigma{"axisNSigma", {200, -10.0f, +10.0f}, "N(#sigma)"}; - ConfigurableAxis axisRatioMethods{"axisRatioMethods", {400, 0.9f, 1.9f}, "T_{method 1}/T_{method 0}"}; - ConfigurableAxis axisSnp{"axisSnp", {220, -1.1f, 1.1f}, "snp"}; - - // master p axis - ConfigurableAxis axisP{"axisP", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "p_{T} (GeV/c)"}; - - // for zooming in at low values only (e-loss studies and effective correction) - ConfigurableAxis axisSmallP{"axisSmallP", {250, 0.0f, 2.5f}, "p_{T} (GeV/c)"}; + struct : ConfigurableGroup { + ConfigurableAxis axisPosition{"axisPosition", {400, -400.f, +400.f}, "position (cm)"}; + ConfigurableAxis axisEta{"axisEta", {20, -1.0f, +1.0f}, "#eta"}; + ConfigurableAxis axisDeltaTime{"axisDeltaTime", {2000, -1000.0f, +1000.0f}, "delta-time (ps)"}; + ConfigurableAxis axisDeltaTimeVsPrimaryCalculation{"axisDeltaTimeVsPrimaryCalculation", {500, -500.0f, +500.0f}, "delta-time (ps)"}; + ConfigurableAxis axisTime{"axisTime", {400, 10000.0f, +50000.0f}, "T (ps)"}; + ConfigurableAxis axisNSigma{"axisNSigma", {200, -10.0f, +10.0f}, "N(#sigma)"}; + ConfigurableAxis axisRatioMethods{"axisRatioMethods", {400, 0.9f, 1.9f}, "T_{method 1}/T_{method 0}"}; + ConfigurableAxis axisSnp{"axisSnp", {220, -1.1f, 1.1f}, "snp"}; + + // master p axis + ConfigurableAxis axisP{"axisP", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "p_{T} (GeV/c)"}; + + // for zooming in at low values only (e-loss studies and effective correction) + ConfigurableAxis axisSmallP{"axisSmallP", {250, 0.0f, 2.5f}, "p_{T} (GeV/c)"}; + + // for BC shift QA plots + // binning to actually match BC shifts but show in picoseconds + const double bcShiftValuePS = o2::constants::lhc::LHCBunchSpacingNS * 1000.0f; + ConfigurableAxis axisBCshift{"axisBCshift", {130, -120.5f * bcShiftValuePS, 9.5f * bcShiftValuePS}, "time shift (ps)"}; + + // very broad time axis + ConfigurableAxis axisTimeLong{"axisTimeLong", {3000, -1500000.0f, 1500000.0f}, "time (ps)"}; + } axes; // aggregate axes fo simplicity of navigation in HY // for n-sigma calibration bool nSigmaCalibLoaded; @@ -412,6 +423,20 @@ struct strangenesstofpid { // per event histos.add("hCandidateCounter", "hCandidateCounter", kTH1F, {{500, -0.5f, 499.5f}}); + histos.add("hV0PositiveBCShift", "hV0PositiveBCShift", kTH1F, {axes.axisBCshift}); + histos.add("hV0NegativeBCShift", "hV0NegativeBCShift", kTH1F, {axes.axisBCshift}); + histos.add("hCascadePositiveBCShift", "hCascadePositiveBCShift", kTH1F, {axes.axisBCshift}); + histos.add("hCascadeNegativeBCShift", "hCascadeNegativeBCShift", kTH1F, {axes.axisBCshift}); + histos.add("hCascadeBachelorBCShift", "hCascadeBachelorBCShift", kTH1F, {axes.axisBCshift}); + + histos.add("hTOFSignalPositive", "hTOFSignalPositive", kTH1F, {axes.axisTimeLong}); + histos.add("hTOFSignalNegative", "hTOFSignalNegative", kTH1F, {axes.axisTimeLong}); + + histos.add("h2dTOFSignalPositive", "h2dTOFSignalPositive", kTH2F, {axes.axisTimeLong, axes.axisBCshift}); + histos.add("h2dTOFSignalNegative", "h2dTOFSignalNegative", kTH2F, {axes.axisTimeLong, axes.axisBCshift}); + + histos.add("hCollisionTimes", "hCollisionTimes", kTH1F, {{2000, -1000.0f, 1000.0f}}); + // measured vs expected total time QA if (doQA) { // if in mode 1, bookkeep the failures of propagation @@ -421,95 +446,95 @@ struct strangenesstofpid { // standard deltaTime values if (calculateV0s.value > 0) { - histos.add("h2dDeltaTimePositiveLambdaPi", "h2dDeltaTimePositiveLambdaPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - histos.add("h2dDeltaTimeNegativeLambdaPi", "h2dDeltaTimeNegativeLambdaPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - histos.add("h2dDeltaTimePositiveLambdaPr", "h2dDeltaTimePositiveLambdaPr", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - histos.add("h2dDeltaTimeNegativeLambdaPr", "h2dDeltaTimeNegativeLambdaPr", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - histos.add("h2dDeltaTimePositiveK0ShortPi", "h2dDeltaTimePositiveK0ShortPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - histos.add("h2dDeltaTimeNegativeK0ShortPi", "h2dDeltaTimeNegativeK0ShortPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); + histos.add("h2dDeltaTimePositiveLambdaPi", "h2dDeltaTimePositiveLambdaPi", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + histos.add("h2dDeltaTimeNegativeLambdaPi", "h2dDeltaTimeNegativeLambdaPi", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + histos.add("h2dDeltaTimePositiveLambdaPr", "h2dDeltaTimePositiveLambdaPr", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + histos.add("h2dDeltaTimeNegativeLambdaPr", "h2dDeltaTimeNegativeLambdaPr", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + histos.add("h2dDeltaTimePositiveK0ShortPi", "h2dDeltaTimePositiveK0ShortPi", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + histos.add("h2dDeltaTimeNegativeK0ShortPi", "h2dDeltaTimeNegativeK0ShortPi", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); // delta time with respect to primary-like calculation - histos.add("h2dDiffFromPrimCalcPositiveLambdaPi", "h2dDiffFromPrimCalcPositiveLambdaPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - histos.add("h2dDiffFromPrimCalcNegativeLambdaPi", "h2dDiffFromPrimCalcNegativeLambdaPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - histos.add("h2dDiffFromPrimCalcPositiveLambdaPr", "h2dDiffFromPrimCalcPositiveLambdaPr", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - histos.add("h2dDiffFromPrimCalcNegativeLambdaPr", "h2dDiffFromPrimCalcNegativeLambdaPr", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - histos.add("h2dDiffFromPrimCalcPositiveK0ShortPi", "h2dDiffFromPrimCalcPositiveK0ShortPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - histos.add("h2dDiffFromPrimCalcNegativeK0ShortPi", "h2dDiffFromPrimCalcNegativeK0ShortPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dDiffFromPrimCalcPositiveLambdaPi", "h2dDiffFromPrimCalcPositiveLambdaPi", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dDiffFromPrimCalcNegativeLambdaPi", "h2dDiffFromPrimCalcNegativeLambdaPi", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dDiffFromPrimCalcPositiveLambdaPr", "h2dDiffFromPrimCalcPositiveLambdaPr", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dDiffFromPrimCalcNegativeLambdaPr", "h2dDiffFromPrimCalcNegativeLambdaPr", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dDiffFromPrimCalcPositiveK0ShortPi", "h2dDiffFromPrimCalcPositiveK0ShortPi", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dDiffFromPrimCalcNegativeK0ShortPi", "h2dDiffFromPrimCalcNegativeK0ShortPi", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); // QA collision reassociation fraction (from track -> V0/cascade coll index) - histos.add("h2dCorrectAssocPositiveLambdaPi", "h2dCorrectAssocPositiveLambdaPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - histos.add("h2dCorrectAssocNegativeLambdaPi", "h2dCorrectAssocNegativeLambdaPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - histos.add("h2dCorrectAssocPositiveLambdaPr", "h2dCorrectAssocPositiveLambdaPr", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - histos.add("h2dCorrectAssocNegativeLambdaPr", "h2dCorrectAssocNegativeLambdaPr", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - histos.add("h2dCorrectAssocPositiveK0ShortPi", "h2dCorrectAssocPositiveK0ShortPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - histos.add("h2dCorrectAssocNegativeK0ShortPi", "h2dCorrectAssocNegativeK0ShortPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dCorrectAssocPositiveLambdaPi", "h2dCorrectAssocPositiveLambdaPi", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dCorrectAssocNegativeLambdaPi", "h2dCorrectAssocNegativeLambdaPi", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dCorrectAssocPositiveLambdaPr", "h2dCorrectAssocPositiveLambdaPr", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dCorrectAssocNegativeLambdaPr", "h2dCorrectAssocNegativeLambdaPr", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dCorrectAssocPositiveK0ShortPi", "h2dCorrectAssocPositiveK0ShortPi", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dCorrectAssocNegativeK0ShortPi", "h2dCorrectAssocNegativeK0ShortPi", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); } if (calculateCascades.value > 0) { - histos.add("h2dposDeltaTimeAsXiPi", "h2dposDeltaTimeAsXiPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - histos.add("h2dposDeltaTimeAsXiPr", "h2dposDeltaTimeAsXiPr", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - histos.add("h2dnegDeltaTimeAsXiPi", "h2dnegDeltaTimeAsXiPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - histos.add("h2dnegDeltaTimeAsXiPr", "h2dnegDeltaTimeAsXiPr", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - histos.add("h2dbachDeltaTimeAsXiPi", "h2dbachDeltaTimeAsXiPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - - histos.add("h2dposDeltaTimeAsOmPi", "h2dposDeltaTimeAsOmPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - histos.add("h2dposDeltaTimeAsOmPr", "h2dposDeltaTimeAsOmPr", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - histos.add("h2dnegDeltaTimeAsOmPi", "h2dnegDeltaTimeAsOmPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - histos.add("h2dnegDeltaTimeAsOmPr", "h2dnegDeltaTimeAsOmPr", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - histos.add("h2dbachDeltaTimeAsOmKa", "h2dbachDeltaTimeAsOmKa", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); + histos.add("h2dposDeltaTimeAsXiPi", "h2dposDeltaTimeAsXiPi", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + histos.add("h2dposDeltaTimeAsXiPr", "h2dposDeltaTimeAsXiPr", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + histos.add("h2dnegDeltaTimeAsXiPi", "h2dnegDeltaTimeAsXiPi", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + histos.add("h2dnegDeltaTimeAsXiPr", "h2dnegDeltaTimeAsXiPr", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + histos.add("h2dbachDeltaTimeAsXiPi", "h2dbachDeltaTimeAsXiPi", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + + histos.add("h2dposDeltaTimeAsOmPi", "h2dposDeltaTimeAsOmPi", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + histos.add("h2dposDeltaTimeAsOmPr", "h2dposDeltaTimeAsOmPr", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + histos.add("h2dnegDeltaTimeAsOmPi", "h2dnegDeltaTimeAsOmPi", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + histos.add("h2dnegDeltaTimeAsOmPr", "h2dnegDeltaTimeAsOmPr", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + histos.add("h2dbachDeltaTimeAsOmKa", "h2dbachDeltaTimeAsOmKa", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); // delta time with respect to primary-like calculation - histos.add("h2dposDiffFromPrimCalcAsXiPi", "h2dposDiffFromPrimCalcAsXiPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - histos.add("h2dposDiffFromPrimCalcAsXiPr", "h2dposDiffFromPrimCalcAsXiPr", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - histos.add("h2dnegDiffFromPrimCalcAsXiPi", "h2dnegDiffFromPrimCalcAsXiPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - histos.add("h2dnegDiffFromPrimCalcAsXiPr", "h2dnegDiffFromPrimCalcAsXiPr", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - histos.add("h2dbachDiffFromPrimCalcAsXiPi", "h2dbachDiffFromPrimCalcAsXiPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - - histos.add("h2dposDiffFromPrimCalcAsOmPi", "h2dposDiffFromPrimCalcAsOmPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - histos.add("h2dposDiffFromPrimCalcAsOmPr", "h2dposDiffFromPrimCalcAsOmPr", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - histos.add("h2dnegDiffFromPrimCalcAsOmPi", "h2dnegDiffFromPrimCalcAsOmPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - histos.add("h2dnegDiffFromPrimCalcAsOmPr", "h2dnegDiffFromPrimCalcAsOmPr", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - histos.add("h2dbachDiffFromPrimCalcAsOmKa", "h2dbachDiffFromPrimCalcAsOmKa", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dposDiffFromPrimCalcAsXiPi", "h2dposDiffFromPrimCalcAsXiPi", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dposDiffFromPrimCalcAsXiPr", "h2dposDiffFromPrimCalcAsXiPr", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dnegDiffFromPrimCalcAsXiPi", "h2dnegDiffFromPrimCalcAsXiPi", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dnegDiffFromPrimCalcAsXiPr", "h2dnegDiffFromPrimCalcAsXiPr", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dbachDiffFromPrimCalcAsXiPi", "h2dbachDiffFromPrimCalcAsXiPi", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + + histos.add("h2dposDiffFromPrimCalcAsOmPi", "h2dposDiffFromPrimCalcAsOmPi", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dposDiffFromPrimCalcAsOmPr", "h2dposDiffFromPrimCalcAsOmPr", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dnegDiffFromPrimCalcAsOmPi", "h2dnegDiffFromPrimCalcAsOmPi", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dnegDiffFromPrimCalcAsOmPr", "h2dnegDiffFromPrimCalcAsOmPr", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dbachDiffFromPrimCalcAsOmKa", "h2dbachDiffFromPrimCalcAsOmKa", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); // QA collision reassociation fraction (from track -> V0/cascade coll index) - histos.add("h2dposCorrectAssocAsXiPi", "h2dposCorrectAssocAsXiPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - histos.add("h2dposCorrectAssocAsXiPr", "h2dposCorrectAssocAsXiPr", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - histos.add("h2dnegCorrectAssocAsXiPi", "h2dnegCorrectAssocAsXiPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - histos.add("h2dnegCorrectAssocAsXiPr", "h2dnegCorrectAssocAsXiPr", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - histos.add("h2dbachCorrectAssocAsXiPi", "h2dbachCorrectAssocAsXiPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - - histos.add("h2dposCorrectAssocAsOmPi", "h2dposCorrectAssocAsOmPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - histos.add("h2dposCorrectAssocAsOmPr", "h2dposCorrectAssocAsOmPr", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - histos.add("h2dnegCorrectAssocAsOmPi", "h2dnegCorrectAssocAsOmPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - histos.add("h2dnegCorrectAssocAsOmPr", "h2dnegCorrectAssocAsOmPr", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - histos.add("h2dbachCorrectAssocAsOmKa", "h2dbachCorrectAssocAsOmKa", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dposCorrectAssocAsXiPi", "h2dposCorrectAssocAsXiPi", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dposCorrectAssocAsXiPr", "h2dposCorrectAssocAsXiPr", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dnegCorrectAssocAsXiPi", "h2dnegCorrectAssocAsXiPi", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dnegCorrectAssocAsXiPr", "h2dnegCorrectAssocAsXiPr", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dbachCorrectAssocAsXiPi", "h2dbachCorrectAssocAsXiPi", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + + histos.add("h2dposCorrectAssocAsOmPi", "h2dposCorrectAssocAsOmPi", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dposCorrectAssocAsOmPr", "h2dposCorrectAssocAsOmPr", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dnegCorrectAssocAsOmPi", "h2dnegCorrectAssocAsOmPi", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dnegCorrectAssocAsOmPr", "h2dnegCorrectAssocAsOmPr", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dbachCorrectAssocAsOmKa", "h2dbachCorrectAssocAsOmKa", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); } - histos.add("h2dPositiveTOFProperties", "h2dPositiveTOFProperties", {HistType::kTH2F, {axisP, {4, -0.5, 3.5f}}}); - histos.add("h2dNegativeTOFProperties", "h2dNegativeTOFProperties", {HistType::kTH2F, {axisP, {4, -0.5, 3.5f}}}); + histos.add("h2dPositiveTOFProperties", "h2dPositiveTOFProperties", {HistType::kTH2F, {axes.axisP, {4, -0.5, 3.5f}}}); + histos.add("h2dNegativeTOFProperties", "h2dNegativeTOFProperties", {HistType::kTH2F, {axes.axisP, {4, -0.5, 3.5f}}}); if (doQANSigma) { if (calculateV0s.value > 0) { - histos.add("h2dNSigmaPositiveLambdaPi", "h2dNSigmaPositiveLambdaPi", {HistType::kTH2F, {axisP, axisNSigma}}); - histos.add("h2dNSigmaNegativeLambdaPi", "h2dNSigmaNegativeLambdaPi", {HistType::kTH2F, {axisP, axisNSigma}}); - histos.add("h2dNSigmaPositiveLambdaPr", "h2dNSigmaPositiveLambdaPr", {HistType::kTH2F, {axisP, axisNSigma}}); - histos.add("h2dNSigmaNegativeLambdaPr", "h2dNSigmaNegativeLambdaPr", {HistType::kTH2F, {axisP, axisNSigma}}); - histos.add("h2dNSigmaPositiveK0ShortPi", "h2dNSigmaPositiveK0ShortPi", {HistType::kTH2F, {axisP, axisNSigma}}); - histos.add("h2dNSigmaNegativeK0ShortPi", "h2dNSigmaNegativeK0ShortPi", {HistType::kTH2F, {axisP, axisNSigma}}); + histos.add("h2dNSigmaPositiveLambdaPi", "h2dNSigmaPositiveLambdaPi", {HistType::kTH2F, {axes.axisP, axes.axisNSigma}}); + histos.add("h2dNSigmaNegativeLambdaPi", "h2dNSigmaNegativeLambdaPi", {HistType::kTH2F, {axes.axisP, axes.axisNSigma}}); + histos.add("h2dNSigmaPositiveLambdaPr", "h2dNSigmaPositiveLambdaPr", {HistType::kTH2F, {axes.axisP, axes.axisNSigma}}); + histos.add("h2dNSigmaNegativeLambdaPr", "h2dNSigmaNegativeLambdaPr", {HistType::kTH2F, {axes.axisP, axes.axisNSigma}}); + histos.add("h2dNSigmaPositiveK0ShortPi", "h2dNSigmaPositiveK0ShortPi", {HistType::kTH2F, {axes.axisP, axes.axisNSigma}}); + histos.add("h2dNSigmaNegativeK0ShortPi", "h2dNSigmaNegativeK0ShortPi", {HistType::kTH2F, {axes.axisP, axes.axisNSigma}}); } if (calculateCascades.value > 0) { - histos.add("h2dNSigmaXiLaPi", "h2dNSigmaXiLaPi", {HistType::kTH2F, {axisP, axisNSigma}}); - histos.add("h2dNSigmaXiLaPr", "h2dNSigmaXiLaPr", {HistType::kTH2F, {axisP, axisNSigma}}); - histos.add("h2dNSigmaXiPi", "h2dNSigmaXiPi", {HistType::kTH2F, {axisP, axisNSigma}}); - histos.add("h2dNSigmaOmLaPi", "h2dNSigmaOmLaPi", {HistType::kTH2F, {axisP, axisNSigma}}); - histos.add("h2dNSigmaOmLaPr", "h2dNSigmaOmLaPr", {HistType::kTH2F, {axisP, axisNSigma}}); - histos.add("h2dNSigmaOmKa", "h2dNSigmaOmKa", {HistType::kTH2F, {axisP, axisNSigma}}); + histos.add("h2dNSigmaXiLaPi", "h2dNSigmaXiLaPi", {HistType::kTH2F, {axes.axisP, axes.axisNSigma}}); + histos.add("h2dNSigmaXiLaPr", "h2dNSigmaXiLaPr", {HistType::kTH2F, {axes.axisP, axes.axisNSigma}}); + histos.add("h2dNSigmaXiPi", "h2dNSigmaXiPi", {HistType::kTH2F, {axes.axisP, axes.axisNSigma}}); + histos.add("h2dNSigmaOmLaPi", "h2dNSigmaOmLaPi", {HistType::kTH2F, {axes.axisP, axes.axisNSigma}}); + histos.add("h2dNSigmaOmLaPr", "h2dNSigmaOmLaPr", {HistType::kTH2F, {axes.axisP, axes.axisNSigma}}); + histos.add("h2dNSigmaOmKa", "h2dNSigmaOmKa", {HistType::kTH2F, {axes.axisP, axes.axisNSigma}}); } } // delta lambda decay time - histos.add("h2dLambdaDeltaDecayTime", "h2dLambdaDeltaDecayTime", {HistType::kTH2F, {axisP, axisDeltaTime}}); + histos.add("h2dLambdaDeltaDecayTime", "h2dLambdaDeltaDecayTime", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTime}}); } } @@ -767,11 +792,15 @@ struct strangenesstofpid { std::abs(pTof.tpcNSigmaPi) < v0Group.qaTPCNSigma && std::abs(nTof.tpcNSigmaPi) < v0Group.qaTPCNSigma; + bool pValidTOF = rejectUndefinedTof.value ? static_cast(std::fabs(pTof.tofSignal) > o2::aod::v0data::kEpsilon) : true; + bool nValidTOF = rejectUndefinedTof.value ? static_cast(std::fabs(nTof.tofSignal) > o2::aod::v0data::kEpsilon) : true; + //_____________________________________________________________________________________________ // Actual calculation - if (pTof.hasTOF && pTof.hasITS) { - float velocityPositivePr, velocityPositivePi, lengthPositive; - velocityPositivePr = velocityPositivePi = lengthPositive = o2::aod::v0data::kNoTOFValue; + float velocityPositivePr, velocityPositivePi, lengthPositive; + velocityPositivePr = velocityPositivePi = lengthPositive = o2::aod::v0data::kNoTOFValue; + + if (pTof.hasTOF && pTof.hasITS && pTof.tofEvTime > -1e+5 && pValidTOF) { // method 0: legacy standalone without use of primary particle TOF if (calculationMethod.value == 0) { velocityPositivePr = velocity(posTrack.getP(), o2::constants::physics::MassProton); @@ -845,9 +874,9 @@ struct strangenesstofpid { } } } - if (nTof.hasTOF && nTof.hasITS) { - float velocityNegativePr, velocityNegativePi, lengthNegative; - velocityNegativePr = velocityNegativePi = lengthNegative = o2::aod::v0data::kNoTOFValue; + float velocityNegativePr, velocityNegativePi, lengthNegative; + velocityNegativePr = velocityNegativePi = lengthNegative = o2::aod::v0data::kNoTOFValue; + if (nTof.hasTOF && nTof.hasITS && nTof.tofEvTime > -1e+5 && nValidTOF) { // method 0: legacy standalone without use of primary particle TOF if (calculationMethod.value == 0) { velocityNegativePr = velocity(negTrack.getP(), o2::constants::physics::MassProton); @@ -921,6 +950,23 @@ struct strangenesstofpid { } } + // temporarily commented out + // bool compatibleK0Short = true; + // int incompatibilityReason = 0; + // if (std::abs(v0tof.nSigmaPositiveK0ShortPi - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon && std::abs(v0tof.nSigmaPositiveK0ShortPi) > 4) { + // compatibleK0Short = false; // reject only if info present and incompatible + // incompatibilityReason += 1; + // } + // if (std::abs(v0tof.nSigmaNegativeK0ShortPi - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon && std::abs(v0tof.nSigmaNegativeK0ShortPi) > 4) { + // compatibleK0Short = false; // reject only if info present and incompatible + // incompatibilityReason += 2; + // } + + // if(!compatibleK0Short && passesQAcuts && k0ShortCandidate){ + // histos.fill(HIST("hIncompatibilityReason"), incompatibilityReason); + // // LOGF(info, "Incompatible K0, sigmas = (%.2f %.2f), lengths = (%.2f %.2f) tofSignals = (%.2f %.2f) evtimes = (%.2f %.2f)", v0tof.nSigmaPositiveK0ShortPi, v0tof.nSigmaNegativeK0ShortPi, lengthPositive, lengthNegative, pTof.tofSignal, nTof.tofSignal, pTof.tofEvTime, nTof.tofEvTime); + // } + // calculation of delta-decay-time (no reliance on event time) if (nTof.hasTOF && pTof.hasTOF > 0) { // does not depend on event time v0tof.deltaDecayTimeLambda = (pTof.tofSignal - v0tof.timePositivePr) - (nTof.tofSignal - v0tof.timeNegativePi); @@ -1016,9 +1062,13 @@ struct strangenesstofpid { std::abs(nTof.tpcNSigmaPr) < cascadeGroup.qaTPCNSigma && std::abs(bTof.tpcNSigmaKa) < cascadeGroup.qaTPCNSigma; + bool pValidTOF = rejectUndefinedTof.value ? static_cast(std::fabs(pTof.tofSignal) > o2::aod::v0data::kEpsilon) : true; + bool nValidTOF = rejectUndefinedTof.value ? static_cast(std::fabs(nTof.tofSignal) > o2::aod::v0data::kEpsilon) : true; + bool bValidTOF = rejectUndefinedTof.value ? static_cast(std::fabs(bTof.tofSignal) > o2::aod::v0data::kEpsilon) : true; + //_____________________________________________________________________________________________ // Actual calculation - if (pTof.hasTOF && pTof.hasITS) { + if (pTof.hasTOF && pTof.hasITS && pTof.tofEvTime > -1e+5 && pValidTOF) { float velocityPositivePr, velocityPositivePi, lengthPositive; velocityPositivePr = velocityPositivePi = lengthPositive = o2::aod::v0data::kNoTOFValue; if (calculationMethod.value == 0) { @@ -1107,7 +1157,7 @@ struct strangenesstofpid { } } // end positive - if (nTof.hasTOF && nTof.hasITS) { + if (nTof.hasTOF && nTof.hasITS && nTof.tofEvTime > -1e+5 && nValidTOF) { float velocityNegativePr, velocityNegativePi, lengthNegative; velocityNegativePr = velocityNegativePi = lengthNegative = o2::aod::v0data::kNoTOFValue; // method 0: legacy standalone without use of primary particle TOF @@ -1197,7 +1247,7 @@ struct strangenesstofpid { } } // end negative - if (bTof.hasTOF && bTof.hasITS) { + if (bTof.hasTOF && bTof.hasITS && bTof.tofEvTime > -1e+5 && bValidTOF) { float velocityBachelorKa, velocityBachelorPi, lengthBachelor; velocityBachelorKa = velocityBachelorPi = lengthBachelor = o2::aod::v0data::kNoTOFValue; // method 0: legacy standalone without use of primary particle TOF @@ -1289,7 +1339,7 @@ struct strangenesstofpid { return casctof; } - void processStandardData(aod::Collisions const& collisions, V0OriginalDatas const& V0s, CascOriginalDatas const& cascades, TracksWithAllExtras const& tracks, aod::BCsWithTimestamps const& /*bcs*/) + void processStandardData(aod::BCs const& bcs, aod::Collisions const& collisions, V0OriginalDatas const& V0s, CascOriginalDatas const& cascades, TracksWithAllExtras const& tracks, aod::BCsWithTimestamps const& /*bcs*/) { // Fire up CCDB with first collision in record. If no collisions, bypass if (useCustomRunNumber || collisions.size() < 1) { @@ -1316,6 +1366,7 @@ struct strangenesstofpid { } else { collisionEventTime[collision.globalIndex()] = -1e+6; // undefined } + histos.fill(HIST("hCollisionTimes"), collisionEventTime[collision.globalIndex()]); } if (calculateV0s.value) { @@ -1324,6 +1375,37 @@ struct strangenesstofpid { auto pTra = V0.posTrack_as(); auto nTra = V0.negTrack_as(); + double deltaTimePos = 0.0f; + double deltaTimeNeg = 0.0f; + + auto collisionV0 = collisions.rawIteratorAt(V0.collisionId()); + auto bcV0 = bcs.rawIteratorAt(collisionV0.bcId()); + + if (pTra.collisionId() >= 0) { + auto collisionPos = collisions.rawIteratorAt(pTra.collisionId()); + auto bcPos = bcs.rawIteratorAt(collisionPos.bcId()); + const int64_t deltaBcPos = bcPos.globalBC() - bcV0.globalBC(); + deltaTimePos = o2::constants::lhc::LHCBunchSpacingNS * deltaBcPos * 1000.0f; + histos.fill(HIST("hV0PositiveBCShift"), deltaTimePos); + } + + if (nTra.collisionId() >= 0) { + auto collisionNeg = collisions.rawIteratorAt(nTra.collisionId()); + auto bcNeg = bcs.rawIteratorAt(collisionNeg.bcId()); + const int64_t deltaBcNeg = bcNeg.globalBC() - bcV0.globalBC(); + deltaTimeNeg = o2::constants::lhc::LHCBunchSpacingNS * deltaBcNeg * 1000.0f; + histos.fill(HIST("hV0NegativeBCShift"), deltaTimeNeg); + } + + if (pTof.hasTOF) { + histos.fill(HIST("hTOFSignalPositive"), pTof.tofSignal); + histos.fill(HIST("h2dTOFSignalPositive"), pTof.tofSignal, deltaTimePos); + } + + if (nTof.hasTOF) { + histos.fill(HIST("hTOFSignalNegative"), nTof.tofSignal); + histos.fill(HIST("h2dTOFSignalNegative"), nTof.tofSignal, deltaTimeNeg); + } pTof.collisionId = pTra.collisionId(); pTof.hasITS = pTra.hasITS(); @@ -1331,7 +1413,7 @@ struct strangenesstofpid { pTof.hasTOF = pTra.hasTOF(); pTof.tofExpMom = pTra.tofExpMom(); pTof.tofEvTime = reassociateTracks ? collisionEventTime[V0.collisionId()] : pTra.tofEvTime(); - pTof.tofSignal = pTra.tofSignal(); + pTof.tofSignal = pTra.tofSignal() + (doBCshift ? deltaTimePos : 0.0f); pTof.length = pTra.length(); pTof.tpcNSigmaPi = pTra.tpcNSigmaPi(); pTof.tpcNSigmaPr = pTra.tpcNSigmaPr(); @@ -1342,7 +1424,7 @@ struct strangenesstofpid { nTof.hasTOF = nTra.hasTOF(); nTof.tofExpMom = nTra.tofExpMom(); nTof.tofEvTime = reassociateTracks ? collisionEventTime[V0.collisionId()] : nTra.tofEvTime(); - nTof.tofSignal = nTra.tofSignal(); + nTof.tofSignal = nTra.tofSignal() + (doBCshift ? deltaTimeNeg : 0.0f); nTof.length = nTra.length(); nTof.tpcNSigmaPi = nTra.tpcNSigmaPi(); nTof.tpcNSigmaPr = nTra.tpcNSigmaPr(); @@ -1380,13 +1462,44 @@ struct strangenesstofpid { auto nTra = cascade.negTrack_as(); auto bTra = cascade.bachelor_as(); + double deltaTimePos = 0.0f; + double deltaTimeNeg = 0.0f; + double deltaTimeBach = 0.0f; + + auto collisionCascade = collisions.rawIteratorAt(cascade.collisionId()); + auto bcV0 = bcs.rawIteratorAt(collisionCascade.bcId()); + + if (pTra.collisionId() >= 0) { + auto collisionPos = collisions.rawIteratorAt(pTra.collisionId()); + auto bcPos = bcs.rawIteratorAt(collisionPos.bcId()); + const int64_t deltaBcPos = bcPos.globalBC() - bcV0.globalBC(); + deltaTimePos = o2::constants::lhc::LHCBunchSpacingNS * deltaBcPos * 1000.0f; + histos.fill(HIST("hCascadePositiveBCShift"), deltaTimePos); + } + + if (nTra.collisionId() >= 0) { + auto collisionNeg = collisions.rawIteratorAt(nTra.collisionId()); + auto bcNeg = bcs.rawIteratorAt(collisionNeg.bcId()); + const int64_t deltaBcNeg = bcNeg.globalBC() - bcV0.globalBC(); + deltaTimeNeg = o2::constants::lhc::LHCBunchSpacingNS * deltaBcNeg * 1000.0f; + histos.fill(HIST("hCascadeNegativeBCShift"), deltaTimeNeg); + } + + if (bTra.collisionId() >= 0) { + auto collisionBach = collisions.rawIteratorAt(bTra.collisionId()); + auto bcBach = bcs.rawIteratorAt(collisionBach.bcId()); + const int64_t deltaBcBach = bcBach.globalBC() - bcV0.globalBC(); + deltaTimeBach = o2::constants::lhc::LHCBunchSpacingNS * deltaBcBach * 1000.0f; + histos.fill(HIST("hCascadeNegativeBCShift"), deltaTimeBach); + } + pTof.collisionId = pTra.collisionId(); pTof.hasITS = pTra.hasITS(); pTof.hasTPC = pTra.hasTPC(); pTof.hasTOF = pTra.hasTOF(); pTof.tofExpMom = pTra.tofExpMom(); pTof.tofEvTime = reassociateTracks ? collisionEventTime[cascade.collisionId()] : pTra.tofEvTime(); - pTof.tofSignal = pTra.tofSignal(); + pTof.tofSignal = pTra.tofSignal() + (doBCshift ? deltaTimePos : 0.0f); pTof.length = pTra.length(); pTof.tpcNSigmaPi = pTra.tpcNSigmaPi(); pTof.tpcNSigmaPr = pTra.tpcNSigmaPr(); @@ -1397,7 +1510,7 @@ struct strangenesstofpid { nTof.hasTOF = nTra.hasTOF(); nTof.tofExpMom = nTra.tofExpMom(); nTof.tofEvTime = reassociateTracks ? collisionEventTime[cascade.collisionId()] : nTra.tofEvTime(); - nTof.tofSignal = nTra.tofSignal(); + nTof.tofSignal = nTra.tofSignal() + (doBCshift ? deltaTimeNeg : 0.0f); nTof.length = nTra.length(); nTof.tpcNSigmaPi = nTra.tpcNSigmaPi(); nTof.tpcNSigmaPr = nTra.tpcNSigmaPr(); @@ -1408,7 +1521,7 @@ struct strangenesstofpid { bTof.hasTOF = bTra.hasTOF(); bTof.tofExpMom = bTra.tofExpMom(); bTof.tofEvTime = reassociateTracks ? collisionEventTime[cascade.collisionId()] : bTra.tofEvTime(); - bTof.tofSignal = bTra.tofSignal(); + bTof.tofSignal = bTra.tofSignal() + (doBCshift ? deltaTimeBach : 0.0f); bTof.length = bTra.length(); bTof.tpcNSigmaPi = bTra.tpcNSigmaPi(); bTof.tpcNSigmaKa = bTra.tpcNSigmaKa(); @@ -1435,6 +1548,10 @@ struct strangenesstofpid { { bool isNewTOFFormat = true; // can only happen for new format + for (const auto& collision : collisions) { + histos.fill(HIST("hCollisionTimes"), collision.eventTime()); + } + // auto-determine if using old format if (dauTrackTOFPIDs.size() != 0) { auto firstTOFPID = dauTrackTOFPIDs.rawIteratorAt(0); @@ -1474,6 +1591,9 @@ struct strangenesstofpid { auto pTra = V0.posTrackExtra_as(); auto nTra = V0.negTrackExtra_as(); + double deltaTimeBcPos = 1e+6; + double deltaTimeBcNeg = 1e+6; + pTof.hasITS = pTra.hasITS(); pTof.hasTPC = pTra.hasTPC(); pTof.hasTOF = pTra.hasTOF(); @@ -1481,11 +1601,22 @@ struct strangenesstofpid { pTof.tpcNSigmaPr = pTra.tpcNSigmaPr(); if (tofIndices[V0.posTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { auto pTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[V0.posTrackExtraId()]); - pTof.collisionId = pTofExt.straCollisionId(); - pTof.tofExpMom = pTofExt.tofExpMom(); - pTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : pTofExt.tofEvTime(); - pTof.tofSignal = pTofExt.tofSignal(); - pTof.length = pTofExt.length(); + + if (pTofExt.straCollisionId() >= 0) { + // extract BC for BC time shift + auto collisionTrack = collisions.rawIteratorAt(pTofExt.straCollisionId()); + const int64_t deltaBc = collisionTrack.globalBC() - collision.globalBC(); + const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; + histos.fill(HIST("hV0PositiveBCShift"), deltaTimeBc); + deltaTimeBcPos = deltaTimeBc; + + // assign variables + pTof.collisionId = pTofExt.straCollisionId(); + pTof.tofExpMom = pTofExt.tofExpMom(); + pTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : pTofExt.tofEvTime(); + pTof.tofSignal = pTofExt.tofSignal() + (doBCshift.value ? deltaTimeBc : 0.0f); + pTof.length = pTofExt.length(); + } } nTof.hasITS = nTra.hasITS(); @@ -1495,11 +1626,31 @@ struct strangenesstofpid { nTof.tpcNSigmaPr = nTra.tpcNSigmaPr(); if (tofIndices[V0.negTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { auto nTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[V0.negTrackExtraId()]); - nTof.collisionId = nTofExt.straCollisionId(); - nTof.tofExpMom = nTofExt.tofExpMom(); - nTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : nTofExt.tofEvTime(); - nTof.tofSignal = nTofExt.tofSignal(); - nTof.length = nTofExt.length(); + + if (nTofExt.straCollisionId() >= 0) { + // extract BC for BC time shift + auto collisionTrack = collisions.rawIteratorAt(nTofExt.straCollisionId()); + const int64_t deltaBc = collisionTrack.globalBC() - collision.globalBC(); + const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; + histos.fill(HIST("hV0NegativeBCShift"), deltaTimeBc); + deltaTimeBcNeg = deltaTimeBc; + + // assign variables + nTof.collisionId = nTofExt.straCollisionId(); + nTof.tofExpMom = nTofExt.tofExpMom(); + nTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : nTofExt.tofEvTime(); + nTof.tofSignal = nTofExt.tofSignal() + (doBCshift.value ? deltaTimeBc : 0.0f); + nTof.length = nTofExt.length(); + } + } + if (pTof.hasTOF) { + histos.fill(HIST("hTOFSignalPositive"), pTof.tofSignal); + histos.fill(HIST("h2dTOFSignalPositive"), pTof.tofSignal, deltaTimeBcPos); + } + + if (nTof.hasTOF) { + histos.fill(HIST("hTOFSignalNegative"), nTof.tofSignal); + histos.fill(HIST("h2dTOFSignalNegative"), nTof.tofSignal, deltaTimeBcNeg); } v0TofInfo v0tof = calculateTofInfoV0(collisions, V0.straCollisionId(), V0, pTof, nTof); @@ -1543,11 +1694,20 @@ struct strangenesstofpid { pTof.tpcNSigmaPr = pTra.tpcNSigmaPr(); if (tofIndices[cascade.posTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { auto pTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[cascade.posTrackExtraId()]); - pTof.collisionId = pTofExt.straCollisionId(); - pTof.tofExpMom = pTofExt.tofExpMom(); - pTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : pTofExt.tofEvTime(); - pTof.tofSignal = pTofExt.tofSignal(); - pTof.length = pTofExt.length(); + + if (pTofExt.straCollisionId() >= 0) { + // extract BC for BC time shift + auto collisionTrack = collisions.rawIteratorAt(pTofExt.straCollisionId()); + const int64_t deltaBc = collisionTrack.globalBC() - collision.globalBC(); + const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; + histos.fill(HIST("hCascadePositiveBCShift"), deltaTimeBc); + + pTof.collisionId = pTofExt.straCollisionId(); + pTof.tofExpMom = pTofExt.tofExpMom(); + pTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : pTofExt.tofEvTime(); + pTof.tofSignal = pTofExt.tofSignal() + (doBCshift.value ? deltaTimeBc : 0.0f); + pTof.length = pTofExt.length(); + } } nTof.hasITS = nTra.hasITS(); @@ -1557,11 +1717,20 @@ struct strangenesstofpid { nTof.tpcNSigmaPr = nTra.tpcNSigmaPr(); if (tofIndices[cascade.negTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { auto nTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[cascade.negTrackExtraId()]); - nTof.collisionId = nTofExt.straCollisionId(); - nTof.tofExpMom = nTofExt.tofExpMom(); - nTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : nTofExt.tofEvTime(); - nTof.tofSignal = nTofExt.tofSignal(); - nTof.length = nTofExt.length(); + + if (nTofExt.straCollisionId() >= 0) { + // extract BC for BC time shift + auto collisionTrack = collisions.rawIteratorAt(nTofExt.straCollisionId()); + const int64_t deltaBc = collisionTrack.globalBC() - collision.globalBC(); + const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; + histos.fill(HIST("hCascadeNegativeBCShift"), deltaTimeBc); + + nTof.collisionId = nTofExt.straCollisionId(); + nTof.tofExpMom = nTofExt.tofExpMom(); + nTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : nTofExt.tofEvTime(); + nTof.tofSignal = nTofExt.tofSignal() + (doBCshift.value ? deltaTimeBc : 0.0f); + nTof.length = nTofExt.length(); + } } bTof.hasITS = bTra.hasITS(); @@ -1571,11 +1740,20 @@ struct strangenesstofpid { bTof.tpcNSigmaKa = bTra.tpcNSigmaKa(); if (tofIndices[cascade.bachTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { auto bTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[cascade.bachTrackExtraId()]); - bTof.collisionId = bTofExt.straCollisionId(); - bTof.tofExpMom = bTofExt.tofExpMom(); - bTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : bTofExt.tofEvTime(); - bTof.tofSignal = bTofExt.tofSignal(); - bTof.length = bTofExt.length(); + + if (bTofExt.straCollisionId() >= 0) { + // extract BC for BC time shift + auto collisionTrack = collisions.rawIteratorAt(bTofExt.straCollisionId()); + const int64_t deltaBc = collisionTrack.globalBC() - collision.globalBC(); + const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; + histos.fill(HIST("hCascadeBachelorBCShift"), deltaTimeBc); + + bTof.collisionId = bTofExt.straCollisionId(); + bTof.tofExpMom = bTofExt.tofExpMom(); + bTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : bTofExt.tofEvTime(); + bTof.tofSignal = bTofExt.tofSignal() + (doBCshift.value ? deltaTimeBc : 0.0f); + bTof.length = bTofExt.length(); + } } cascTofInfo casctof = calculateTofInfoCascade(collisions, cascade.straCollisionId(), cascade, pTof, nTof, bTof); From 7170abeb9bac3e0dddd38d0eed5bfbab8c1148b4 Mon Sep 17 00:00:00 2001 From: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Date: Wed, 22 Oct 2025 04:31:40 +0800 Subject: [PATCH 841/986] [PWGHF] Add ML to Xic0ToXiPi DCA Filter analysis (#12758) Co-authored-by: ALICE Action Bot --- PWGHF/Core/HfMlResponseXic0ToXiPi.h | 131 ++++++++ PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx | 2 +- PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx | 297 +++++++++++++----- .../DataModel/CandidateReconstructionTables.h | 4 +- PWGHF/DataModel/CandidateSelectionTables.h | 2 +- PWGHF/TableProducer/CMakeLists.txt | 2 +- .../TableProducer/candidateSelectorToXiPi.cxx | 49 +++ .../candidateSelectorXic0ToXiPiKf.cxx | 2 +- PWGHF/TableProducer/treeCreatorToXiPi.cxx | 22 +- 9 files changed, 411 insertions(+), 100 deletions(-) create mode 100644 PWGHF/Core/HfMlResponseXic0ToXiPi.h diff --git a/PWGHF/Core/HfMlResponseXic0ToXiPi.h b/PWGHF/Core/HfMlResponseXic0ToXiPi.h new file mode 100644 index 00000000000..88c402617f8 --- /dev/null +++ b/PWGHF/Core/HfMlResponseXic0ToXiPi.h @@ -0,0 +1,131 @@ +// 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 HfMlResponseXic0ToXiPi.h +/// \brief Class to compute the ML response for Ξc^0 → Ξ∓ π± analysis selections +/// \author Tao Fang , Central China Normal University + +#ifndef PWGHF_CORE_HFMLRESPONSEXIC0TOXIPI_H_ +#define PWGHF_CORE_HFMLRESPONSEXIC0TOXIPI_H_ + +#include "PWGHF/Core/HfMlResponse.h" + +#include "Tools/ML/MlResponse.h" + +#include +#include + +// Fill the map of available input features +// the key is the feature's name (std::string) +// the value is the corresponding value in EnumInputFeatures +#define FILL_MAP_XIC0TOXIPI(FEATURE) \ + { \ + #FEATURE, static_cast(InputFeaturesXic0ToXiPi::FEATURE) \ + } + +// Check if the index of mCachedIndices (index associated to a FEATURE) +// matches the entry in EnumInputFeatures associated to this FEATURE +// if so, the inputFeatures vector is filled with the FEATURE's value +// by calling the corresponding GETTER from OBJECT +#define CHECK_AND_FILL_VEC_XIC0TOXIPI_FULL(OBJECT, FEATURE, GETTER) \ + case static_cast(InputFeaturesXic0ToXiPi::FEATURE): { \ + inputFeatures.emplace_back(OBJECT.GETTER()); \ + break; \ + } + +// where OBJECT is named candidate and FEATURE = GETTER +#define CHECK_AND_FILL_VEC_XIC0TOXIPI(GETTER) \ + case static_cast(InputFeaturesXic0ToXiPi::GETTER): { \ + inputFeatures.emplace_back(candidate.GETTER()); \ + break; \ + } + +namespace o2::analysis +{ + +enum class InputFeaturesXic0ToXiPi : uint8_t { + tpcNSigmaPiFromLambda, + tpcNSigmaPiFromCasc, + tpcNSigmaPiFromCharmBaryon, + dcaCascDau, + dcaCharmBaryonDau, + cosPACharmBaryon, + cosPACasc, + cosPAV0, + impactParBachFromCharmBaryonXY, + impactParCascXY +}; + +template +class HfMlResponseXic0ToXiPi : public HfMlResponse +{ + public: + /// Default constructor + HfMlResponseXic0ToXiPi() = default; + /// Default destructor + virtual ~HfMlResponseXic0ToXiPi() = default; + + /// Method to get the input features vector needed for ML inference + /// \param candidate is the Xic0 candidate + /// \return inputFeatures vector + template + // std::vector getInputFeatures(T1 const& candidate) + std::vector getInputFeatures(T1 const& candidate, T2 const& lamProngPi, T2 const& cascProngPi, T3 const& charmBaryonProngPi) + { + std::vector inputFeatures; + + for (const auto& idx : MlResponse::mCachedIndices) { + switch (idx) { + // PID variables + CHECK_AND_FILL_VEC_XIC0TOXIPI_FULL(lamProngPi, tpcNSigmaPiFromLambda, tpcNSigmaPi); + CHECK_AND_FILL_VEC_XIC0TOXIPI_FULL(cascProngPi, tpcNSigmaPiFromCasc, tpcNSigmaPi); + CHECK_AND_FILL_VEC_XIC0TOXIPI_FULL(charmBaryonProngPi, tpcNSigmaPiFromCharmBaryon, tpcNSigmaPi); + // DCA + CHECK_AND_FILL_VEC_XIC0TOXIPI(dcaCascDau); + CHECK_AND_FILL_VEC_XIC0TOXIPI(dcaCharmBaryonDau); + // CosPA + CHECK_AND_FILL_VEC_XIC0TOXIPI(cosPACharmBaryon); + CHECK_AND_FILL_VEC_XIC0TOXIPI(cosPACasc); + CHECK_AND_FILL_VEC_XIC0TOXIPI(cosPAV0); + // ImpactPar + CHECK_AND_FILL_VEC_XIC0TOXIPI(impactParBachFromCharmBaryonXY); + CHECK_AND_FILL_VEC_XIC0TOXIPI(impactParCascXY); + } + } + + return inputFeatures; + } + + protected: + /// Method to fill the map of available input features + void setAvailableInputFeatures() + { + MlResponse::mAvailableInputFeatures = { + FILL_MAP_XIC0TOXIPI(tpcNSigmaPiFromLambda), + FILL_MAP_XIC0TOXIPI(tpcNSigmaPiFromCasc), + FILL_MAP_XIC0TOXIPI(tpcNSigmaPiFromCharmBaryon), + FILL_MAP_XIC0TOXIPI(dcaCascDau), + FILL_MAP_XIC0TOXIPI(dcaCharmBaryonDau), + FILL_MAP_XIC0TOXIPI(cosPACharmBaryon), + FILL_MAP_XIC0TOXIPI(cosPACasc), + FILL_MAP_XIC0TOXIPI(cosPAV0), + FILL_MAP_XIC0TOXIPI(impactParBachFromCharmBaryonXY), + FILL_MAP_XIC0TOXIPI(impactParCascXY)}; + } +}; + +} // namespace o2::analysis + +#undef FILL_MAP_XIC0TOXIPI +#undef CHECK_AND_FILL_VEC_XIC0TOXIPI_FULL +#undef CHECK_AND_FILL_VEC_XIC0TOXIPI + +#endif // PWGHF_CORE_HFMLRESPONSEXIC0TOXIPI_H_ diff --git a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx index a7c954f9720..4aa872b7e4e 100644 --- a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx +++ b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx @@ -133,7 +133,7 @@ struct HfTaskFlowCharmHadrons { using CandXicData = soa::Filtered>; using CandXicDataWMl = soa::Filtered>; using CandXic0Data = soa::Filtered>; - using CandXic0DataWMl = soa::Filtered>; + using CandXic0DataWMl = soa::Filtered>; using CandD0DataWMl = soa::Filtered>; using CandD0Data = soa::Filtered>; using CollsWithQvecs = soa::Join; diff --git a/PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx b/PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx index 55bfe924842..5c923dc4309 100644 --- a/PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx +++ b/PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx @@ -10,7 +10,7 @@ // or submit itself to any jurisdiction. /// \file taskXic0ToXiPi.cxx -/// \brief Task for Ξc^0 → Ξ∓ π± Kf analysis +/// \brief Task for Ξc^0 → Ξ∓ π± analysis /// \author Tao Fang , Central China Normal University /// \author Ran Tu , Fudan University @@ -62,11 +62,15 @@ struct HfTaskXic0ToXiPi { using TracksMc = soa::Join; + using Xic0Cands = soa::Filtered>; using Xic0CandsKF = soa::Filtered>; + using Xic0CandsMc = soa::Filtered>; using Xic0CandsMcKF = soa::Filtered>; - using Xic0CandsMlKF = soa::Filtered>; - using Xic0CandsMlMcKF = soa::Filtered>; + using Xic0CandsMl = soa::Filtered>; + using Xic0CandsMlKF = soa::Filtered>; + using Xic0CandsMlMc = soa::Filtered>; + using Xic0CandsMlMcKF = soa::Filtered>; using Xic0Gen = soa::Filtered>; @@ -78,7 +82,9 @@ struct HfTaskXic0ToXiPi { Filter filterSelectXic0Candidates = aod::hf_sel_toxipi::resultSelections == true; Filter filterXicMatchedRec = nabs(aod::hf_cand_xic0_omegac0::flagMcMatchRec) == static_cast(BIT(aod::hf_cand_xic0_omegac0::DecayType::XiczeroToXiPi)); Filter filterXicMatchedGen = nabs(aod::hf_cand_xic0_omegac0::flagMcMatchGen) == static_cast(BIT(aod::hf_cand_xic0_omegac0::DecayType::XiczeroToXiPi)); + Preslice candXicPerCollision = aod::hf_cand_xic0_omegac0::collisionId; Preslice candXicKFPerCollision = aod::hf_cand_xic0_omegac0::collisionId; + Preslice candXicMlPerCollision = aod::hf_cand_xic0_omegac0::collisionId; Preslice candXicKFMlPerCollision = aod::hf_cand_xic0_omegac0::collisionId; PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; @@ -100,7 +106,9 @@ struct HfTaskXic0ToXiPi { void init(InitContext&) { - std::array doprocess{doprocessDataWithKFParticle, doprocessMcWithKFParticle, doprocessDataWithKFParticleMl, doprocessMcWithKFParticleMl, doprocessDataWithKFParticleFT0C, doprocessDataWithKFParticleMlFT0C, doprocessDataWithKFParticleFT0M, doprocessDataWithKFParticleMlFT0M}; + std::array doprocess{doprocessDataWithDCAFitter, doprocessDataWithDCAFitterMl, doprocessDataWithDCAFitterFT0C, doprocessDataWithDCAFitterFT0M, doprocessDataWithDCAFitterMlFT0C, doprocessDataWithDCAFitterMlFT0M, + doprocessDataWithKFParticle, doprocessDataWithKFParticleMl, doprocessDataWithKFParticleFT0C, doprocessDataWithKFParticleFT0M, doprocessDataWithKFParticleMlFT0C, doprocessDataWithKFParticleMlFT0M, + doprocessMcWithKFParticle, doprocessMcWithKFParticleMl, doprocessMcWithDCAFitter, doprocessMcWithDCAFitterMl}; if ((std::accumulate(doprocess.begin(), doprocess.end(), 0)) != 1) { LOGP(fatal, "One and only one process function should be enabled at a time."); } @@ -150,75 +158,50 @@ struct HfTaskXic0ToXiPi { } } - template - void processData(const CandType& candidates, CollType const&) + template + void processDataCent(const CandType& candidate, CollType const& collision) { - for (const auto& candidate : candidates) { - if (candidate.resultSelections() != true) { - continue; - } - if (yCandRecMax >= 0. && std::abs(candidate.kfRapXic()) > yCandRecMax) { - continue; - } - - if constexpr (ApplyMl) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsXic0Type"), candidate.mlProbToXiPi()[0], candidate.invMassCharmBaryon(), candidate.kfptXic(), candidate.kfRapXic()); - } else { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsXic0Type"), candidate.invMassCharmBaryon(), candidate.kfptXic(), candidate.kfRapXic()); - } + if (candidate.resultSelections() != true) { + return; + } + double yCharmBaryon; + if constexpr (UseKfParticle) { + yCharmBaryon = candidate.kfRapXic(); + } else { + yCharmBaryon = candidate.y(o2::constants::physics::MassXiC0); + } + if (yCandRecMax >= 0. && std::abs(yCharmBaryon) > yCandRecMax) { + return; } - } - - template - void processDataCent(const CandType& candidates, CollType const& collisions) - { - for (const auto& collision : collisions) { - - auto thisCollId = collision.globalIndex(); - auto groupedXicCandidates = ApplyMl - ? candidates.sliceBy(candXicKFMlPerCollision, thisCollId) - : candidates.sliceBy(candXicKFPerCollision, thisCollId); - // auto numPvContributors = collision.numContrib(); - for (const auto& candidate : groupedXicCandidates) { - if (candidate.resultSelections() != true) { - continue; - } - if (yCandRecMax >= 0. && std::abs(candidate.kfRapXic()) > yCandRecMax) { - continue; - } - - auto numPvContributors = candidate.template collision_as().numContrib(); - float centrality = -999.f; - if constexpr (UseCentrality) { - auto const& collision = candidate.template collision_as(); - centrality = o2::hf_centrality::getCentralityColl(collision); - } - double const kfptXic = RecoDecay::sqrtSumOfSquares(candidate.pxCharmBaryon(), candidate.pyCharmBaryon()); - double const kfptPiFromXic = RecoDecay::sqrtSumOfSquares(candidate.pxBachFromCharmBaryon(), candidate.pyBachFromCharmBaryon()); - if constexpr (ApplyMl) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsYVsCentVsPtPion"), - candidate.mlProbToXiPi()[0], - candidate.invMassCharmBaryon(), - kfptXic, - candidate.kfRapXic(), - centrality, - kfptPiFromXic, - numPvContributors); - } else { - registry.fill(HIST("hMassVsPtVsYVsCentVsPtPion"), - candidate.invMassCharmBaryon(), - kfptXic, - candidate.kfRapXic(), - centrality, - kfptPiFromXic, - numPvContributors); - } - } + auto numPvContributors = collision.numContrib(); + float centrality = -999.f; + if constexpr (UseCentrality) { + centrality = o2::hf_centrality::getCentralityColl(collision); + } + double const ptXic = RecoDecay::pt(candidate.pxCharmBaryon(), candidate.pyCharmBaryon()); + double const ptPiFromXic = RecoDecay::pt(candidate.pxBachFromCharmBaryon(), candidate.pyBachFromCharmBaryon()); + if constexpr (ApplyMl) { + registry.fill(HIST("hBdtScoreVsMassVsPtVsYVsCentVsPtPion"), + candidate.mlProbToXiPi()[0], + candidate.invMassCharmBaryon(), + ptXic, + yCharmBaryon, + centrality, + ptPiFromXic, + numPvContributors); + } else { + registry.fill(HIST("hMassVsPtVsYVsCentVsPtPion"), + candidate.invMassCharmBaryon(), + ptXic, + yCharmBaryon, + centrality, + ptPiFromXic, + numPvContributors); } } - template + template void processMc(const CandType& candidates, Xic0Gen const& mcParticles, TracksMc const&, @@ -230,18 +213,24 @@ struct HfTaskXic0ToXiPi { if (candidate.resultSelections() != true) { continue; } - if (yCandRecMax >= 0. && std::abs(candidate.kfRapXic()) > yCandRecMax) { + double yCharmBaryon; + if constexpr (UseKfParticle) { + yCharmBaryon = candidate.kfRapXic(); + } else { + yCharmBaryon = candidate.y(o2::constants::physics::MassXiC0); + } + if (yCandRecMax >= 0. && std::abs(yCharmBaryon) > yCandRecMax) { continue; } auto numPvContributors = candidate.template collision_as().numContrib(); - double const kfptXic = RecoDecay::sqrtSumOfSquares(candidate.pxCharmBaryon(), candidate.pyCharmBaryon()); + double const ptXic = RecoDecay::pt(candidate.pxCharmBaryon(), candidate.pyCharmBaryon()); if constexpr (ApplyMl) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsXic0Type"), candidate.mlProbToXiPi()[0], candidate.invMassCharmBaryon(), - kfptXic, - candidate.kfRapXic(), + ptXic, + yCharmBaryon, candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec(), @@ -249,8 +238,8 @@ struct HfTaskXic0ToXiPi { } else { registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsXic0Type"), candidate.invMassCharmBaryon(), - kfptXic, - candidate.kfRapXic(), + ptXic, + yCharmBaryon, candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec(), @@ -292,47 +281,171 @@ struct HfTaskXic0ToXiPi { } } + void processDataWithDCAFitter(Xic0Cands const& candidates, + CollisionsWithEvSels const& collisions) + { + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto groupedXicCandidates = candidates.sliceBy(candXicPerCollision, thisCollId); + for (const auto& candidate : groupedXicCandidates) { + processDataCent(candidate, collision); + } + } + } + PROCESS_SWITCH(HfTaskXic0ToXiPi, processDataWithDCAFitter, "process HfTaskXic0ToXiPi with DCAFitter", true); + void processDataWithKFParticle(Xic0CandsKF const& candidates, CollisionsWithEvSels const& collisions) { - processDataCent(candidates, collisions); + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto groupedXicCandidates = candidates.sliceBy(candXicKFPerCollision, thisCollId); + for (const auto& candidate : groupedXicCandidates) { + processDataCent(candidate, collision); + } + } } - PROCESS_SWITCH(HfTaskXic0ToXiPi, processDataWithKFParticle, "process HfTaskXic0ToXiPi with KFParticle", true); + PROCESS_SWITCH(HfTaskXic0ToXiPi, processDataWithKFParticle, "process HfTaskXic0ToXiPi with KFParticle", true); + + void processDataWithDCAFitterMl(Xic0CandsMl const& candidates, + CollisionsWithEvSels const& collisions) + { + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto groupedXicCandidates = candidates.sliceBy(candXicMlPerCollision, thisCollId); + for (const auto& candidate : groupedXicCandidates) { + processDataCent(candidate, collision); + } + } + } + PROCESS_SWITCH(HfTaskXic0ToXiPi, processDataWithDCAFitterMl, "process HfTaskXic0ToXiPi with DCAFitter and ML selections", false); void processDataWithKFParticleMl(Xic0CandsMlKF const& candidates, CollisionsWithEvSels const& collisions) { - processDataCent(candidates, collisions); + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto groupedXicCandidates = candidates.sliceBy(candXicKFMlPerCollision, thisCollId); + for (const auto& candidate : groupedXicCandidates) { + processDataCent(candidate, collision); + } + } } - PROCESS_SWITCH(HfTaskXic0ToXiPi, processDataWithKFParticleMl, "process HfTaskXic0ToXiPi with KFParticle and ML selections", false); + PROCESS_SWITCH(HfTaskXic0ToXiPi, processDataWithKFParticleMl, "process HfTaskXic0ToXiPi with KFParticle and ML selections", false); + + void processDataWithDCAFitterFT0C(Xic0Cands const& candidates, + CollisionsWithFT0C const& collisions) + { + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto groupedXicCandidates = candidates.sliceBy(candXicPerCollision, thisCollId); + for (const auto& candidate : groupedXicCandidates) { + processDataCent(candidate, collision); + } + } + } + PROCESS_SWITCH(HfTaskXic0ToXiPi, processDataWithDCAFitterFT0C, "process HfTaskXic0ToXiPi with DCAFitter and with FT0C centrality", false); void processDataWithKFParticleFT0C(Xic0CandsKF const& candidates, CollisionsWithFT0C const& collisions) { - processDataCent(candidates, collisions); + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto groupedXicCandidates = candidates.sliceBy(candXicKFPerCollision, thisCollId); + for (const auto& candidate : groupedXicCandidates) { + processDataCent(candidate, collision); + } + } } - PROCESS_SWITCH(HfTaskXic0ToXiPi, processDataWithKFParticleFT0C, "process HfTaskXic0ToXiPi with KFParticle and with FT0C centrality", false); + PROCESS_SWITCH(HfTaskXic0ToXiPi, processDataWithKFParticleFT0C, "process HfTaskXic0ToXiPi with KFParticle and with FT0C centrality", false); + + void processDataWithDCAFitterFT0M(Xic0Cands const& candidates, + CollisionsWithFT0M const& collisions) + { + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto groupedXicCandidates = candidates.sliceBy(candXicPerCollision, thisCollId); + for (const auto& candidate : groupedXicCandidates) { + processDataCent(candidate, collision); + } + } + } + PROCESS_SWITCH(HfTaskXic0ToXiPi, processDataWithDCAFitterFT0M, "process HfTaskXic0ToXiPi with DCAFitter and with FT0M centrality", false); void processDataWithKFParticleFT0M(Xic0CandsKF const& candidates, CollisionsWithFT0M const& collisions) { - processDataCent(candidates, collisions); + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto groupedXicCandidates = candidates.sliceBy(candXicKFPerCollision, thisCollId); + for (const auto& candidate : groupedXicCandidates) { + processDataCent(candidate, collision); + } + } + } + PROCESS_SWITCH(HfTaskXic0ToXiPi, processDataWithKFParticleFT0M, "process HfTaskXic0ToXiPi with KFParticle and with FT0M centrality", false); + + void processDataWithDCAFitterMlFT0C(Xic0CandsMl const& candidates, + CollisionsWithFT0C const& collisions) + { + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto groupedXicCandidates = candidates.sliceBy(candXicMlPerCollision, thisCollId); + for (const auto& candidate : groupedXicCandidates) { + processDataCent(candidate, collision); + } + } } - PROCESS_SWITCH(HfTaskXic0ToXiPi, processDataWithKFParticleFT0M, "process HfTaskXic0ToXiPi with KFParticle and with FT0M centrality", false); + PROCESS_SWITCH(HfTaskXic0ToXiPi, processDataWithDCAFitterMlFT0C, "process HfTaskXic0ToXiPi with DCAFitter and ML selections and with FT0C centrality", false); void processDataWithKFParticleMlFT0C(Xic0CandsMlKF const& candidates, CollisionsWithFT0C const& collisions) { - processDataCent(candidates, collisions); + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto groupedXicCandidates = candidates.sliceBy(candXicKFMlPerCollision, thisCollId); + for (const auto& candidate : groupedXicCandidates) { + processDataCent(candidate, collision); + } + } } - PROCESS_SWITCH(HfTaskXic0ToXiPi, processDataWithKFParticleMlFT0C, "process HfTaskXic0ToXiPi with KFParticle and ML selections and with FT0C centrality", false); + PROCESS_SWITCH(HfTaskXic0ToXiPi, processDataWithKFParticleMlFT0C, "process HfTaskXic0ToXiPi with KFParticle and ML selections and with FT0C centrality", false); + + void processDataWithDCAFitterMlFT0M(Xic0CandsMl const& candidates, + CollisionsWithFT0M const& collisions) + { + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto groupedXicCandidates = candidates.sliceBy(candXicMlPerCollision, thisCollId); + for (const auto& candidate : groupedXicCandidates) { + processDataCent(candidate, collision); + } + } + } + PROCESS_SWITCH(HfTaskXic0ToXiPi, processDataWithDCAFitterMlFT0M, "process HfTaskXic0ToXiPi with DCAFitter and ML selections and with FT0M centrality", false); void processDataWithKFParticleMlFT0M(Xic0CandsMlKF const& candidates, CollisionsWithFT0M const& collisions) { - processDataCent(candidates, collisions); + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto groupedXicCandidates = candidates.sliceBy(candXicKFMlPerCollision, thisCollId); + for (const auto& candidate : groupedXicCandidates) { + processDataCent(candidate, collision); + } + } } - PROCESS_SWITCH(HfTaskXic0ToXiPi, processDataWithKFParticleMlFT0M, "process HfTaskXic0ToXiPi with KFParticle and ML selections and with FT0M centrality", false); + PROCESS_SWITCH(HfTaskXic0ToXiPi, processDataWithKFParticleMlFT0M, "process HfTaskXic0ToXiPi with KFParticle and ML selections and with FT0M centrality", false); + + void processMcWithDCAFitter(Xic0CandsMc const& xic0CandidatesMc, + Xic0Gen const& mcParticles, + TracksMc const& tracks, + CollisionsWithMcLabels const& collisions, + aod::McCollisions const& mcCollisions) + { + processMc(xic0CandidatesMc, mcParticles, tracks, collisions, mcCollisions); + } + PROCESS_SWITCH(HfTaskXic0ToXiPi, processMcWithDCAFitter, "Process MC with KFParticle", false); void processMcWithKFParticle(Xic0CandsMcKF const& xic0CandidatesMcKf, Xic0Gen const& mcParticles, @@ -340,17 +453,27 @@ struct HfTaskXic0ToXiPi { CollisionsWithMcLabels const& collisions, aod::McCollisions const& mcCollisions) { - processMc(xic0CandidatesMcKf, mcParticles, tracks, collisions, mcCollisions); + processMc(xic0CandidatesMcKf, mcParticles, tracks, collisions, mcCollisions); } PROCESS_SWITCH(HfTaskXic0ToXiPi, processMcWithKFParticle, "Process MC with KFParticle", false); + void processMcWithDCAFitterMl(Xic0CandsMlMc const& xic0CandidatesMlMc, + Xic0Gen const& mcParticles, + TracksMc const& tracks, + CollisionsWithMcLabels const& collisions, + aod::McCollisions const& mcCollisions) + { + processMc(xic0CandidatesMlMc, mcParticles, tracks, collisions, mcCollisions); + } + PROCESS_SWITCH(HfTaskXic0ToXiPi, processMcWithDCAFitterMl, "Process MC with KFParticle and ML selections", false); + void processMcWithKFParticleMl(Xic0CandsMlMcKF const& xic0CandidatesMlMcKf, Xic0Gen const& mcParticles, TracksMc const& tracks, CollisionsWithMcLabels const& collisions, aod::McCollisions const& mcCollisions) { - processMc(xic0CandidatesMlMcKf, mcParticles, tracks, collisions, mcCollisions); + processMc(xic0CandidatesMlMcKf, mcParticles, tracks, collisions, mcCollisions); } PROCESS_SWITCH(HfTaskXic0ToXiPi, processMcWithKFParticleMl, "Process MC with KFParticle and ML selections", false); }; diff --git a/PWGHF/DataModel/CandidateReconstructionTables.h b/PWGHF/DataModel/CandidateReconstructionTables.h index 37c96d5627a..addd26ab716 100644 --- a/PWGHF/DataModel/CandidateReconstructionTables.h +++ b/PWGHF/DataModel/CandidateReconstructionTables.h @@ -1633,7 +1633,9 @@ DECLARE_SOA_TABLE(HfCandToXiPi, "AOD", "HFCANDTOXIPI", hf_cand_xic0_omegac0::DcaXYToPvV0Dau0, hf_cand_xic0_omegac0::DcaXYToPvV0Dau1, hf_cand_xic0_omegac0::DcaXYToPvCascDau, hf_cand_xic0_omegac0::DcaZToPvV0Dau0, hf_cand_xic0_omegac0::DcaZToPvV0Dau1, hf_cand_xic0_omegac0::DcaZToPvCascDau, hf_cand_xic0_omegac0::DcaCascDau, hf_cand_xic0_omegac0::DcaV0Dau, hf_cand_xic0_omegac0::DcaCharmBaryonDau, - hf_cand_xic0_omegac0::DecLenCharmBaryon, hf_cand_xic0_omegac0::DecLenCascade, hf_cand_xic0_omegac0::DecLenV0, hf_cand_xic0_omegac0::ErrorDecayLengthCharmBaryon, hf_cand_xic0_omegac0::ErrorDecayLengthXYCharmBaryon); + hf_cand_xic0_omegac0::DecLenCharmBaryon, hf_cand_xic0_omegac0::DecLenCascade, hf_cand_xic0_omegac0::DecLenV0, hf_cand_xic0_omegac0::ErrorDecayLengthCharmBaryon, hf_cand_xic0_omegac0::ErrorDecayLengthXYCharmBaryon, + // dynamic + hf_cand::Y); DECLARE_SOA_TABLE(HfCandToOmegaPi, "AOD", "HFCANDTOOMEGAPI", o2::soa::Index<>, diff --git a/PWGHF/DataModel/CandidateSelectionTables.h b/PWGHF/DataModel/CandidateSelectionTables.h index 125b0fb7286..1f7956aadd4 100644 --- a/PWGHF/DataModel/CandidateSelectionTables.h +++ b/PWGHF/DataModel/CandidateSelectionTables.h @@ -381,7 +381,7 @@ DECLARE_SOA_TABLE(HfSelToXiPiKf, "AOD", "HFSELTOXIPIKF", hf_sel_toxipi::TpcNSigmaPiFromCharmBaryon, hf_sel_toxipi::TpcNSigmaPiFromCasc, hf_sel_toxipi::TpcNSigmaPiFromLambda, hf_sel_toxipi::TpcNSigmaPrFromLambda, hf_sel_toxipi::TofNSigmaPiFromCharmBaryon, hf_sel_toxipi::TofNSigmaPiFromCasc, hf_sel_toxipi::TofNSigmaPiFromLambda, hf_sel_toxipi::TofNSigmaPrFromLambda); -DECLARE_SOA_TABLE(HfMlToXiPiKf, "AOD", "HFMLSELTOXIPIKF", +DECLARE_SOA_TABLE(HfMlToXiPi, "AOD", "HFMLSELTOXIPI", hf_sel_toxipi::MlProbToXiPi); namespace hf_sel_toomegapi diff --git a/PWGHF/TableProducer/CMakeLists.txt b/PWGHF/TableProducer/CMakeLists.txt index 9b28ce9e88d..46364eaf9aa 100644 --- a/PWGHF/TableProducer/CMakeLists.txt +++ b/PWGHF/TableProducer/CMakeLists.txt @@ -184,7 +184,7 @@ o2physics_add_dpl_workflow(candidate-selector-xic0-to-xi-pi-kf o2physics_add_dpl_workflow(candidate-selector-to-xi-pi SOURCES candidateSelectorToXiPi.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(candidate-selector-xic-to-p-k-pi diff --git a/PWGHF/TableProducer/candidateSelectorToXiPi.cxx b/PWGHF/TableProducer/candidateSelectorToXiPi.cxx index 3a53c0532f9..ab13519f62e 100644 --- a/PWGHF/TableProducer/candidateSelectorToXiPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorToXiPi.cxx @@ -12,7 +12,10 @@ /// \file candidateSelectorToXiPi.cxx /// \brief Xic0 and Omegac0 → Xi Pi selection task /// \author Federica Zanone , Heidelberg University +/// \author Tao Fang , Central China Normal University +#include "PWGHF/Core/HfMlResponseXic0ToXiPi.h" +#include "PWGHF/Core/SelectorCuts.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/Utils/utilsAnalysis.h" @@ -38,6 +41,8 @@ #include #include +#include +#include using namespace o2; using namespace o2::aod; @@ -54,6 +59,7 @@ enum PidInfoStored { /// Struct for applying Omegac0/Xic0 selection cuts struct HfCandidateSelectorToXiPi { Produces hfSelToXiPi; + Produces hfMlToXiPi; // LF analysis selections Configurable radiusCascMin{"radiusCascMin", 0.6, "Min cascade radius"}; @@ -129,6 +135,25 @@ struct HfCandidateSelectorToXiPi { Configurable nClustersItsInnBarrMin{"nClustersItsInnBarrMin", 1, "Minimum number of ITS clusters in inner barrel requirement for pi <- charm baryon"}; Configurable itsChi2PerClusterMax{"itsChi2PerClusterMax", 36, "Maximum value of chi2 fit over ITS clusters for pi <- charm baryon"}; + // ML inference + Configurable applyMl{"applyMl", true, "Flag to apply ML selections"}; + Configurable> binsPtMl{"binsPtMl", std::vector{hf_cuts_ml::vecBinsPt}, "pT bin limits for ML application"}; + Configurable> cutDirMl{"cutDirMl", std::vector{hf_cuts_ml::vecCutDir}, "Whether to reject score values greater or smaller than the threshold"}; + Configurable> cutsMl{"cutsMl", {hf_cuts_ml::Cuts[0], hf_cuts_ml::NBinsPt, hf_cuts_ml::NCutScores, hf_cuts_ml::labelsPt, hf_cuts_ml::labelsCutScore}, "ML selections per pT bin"}; + Configurable nClassesMl{"nClassesMl", static_cast(hf_cuts_ml::NCutScores), "Number of classes in ML model"}; + Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature1", "feature2"}, "Names of ML model input features"}; + + // CCDB configuration + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable> modelPathsCCDB{"modelPathsCCDB", std::vector{"EventFiltering/PWGHF/BDTXic0ToXipiKf"}, "Paths of models on CCDB"}; + Configurable> onnxFileNames{"onnxFileNames", std::vector{"ModelHandler_onnx_Xic0ToXipiKf.onnx"}, "ONNX file names for each pT bin (if not from CCDB full path)"}; + Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"}; + Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; + + o2::analysis::HfMlResponseXic0ToXiPi hfMlResponse; + std::vector outputMlXic0ToXiPi = {}; + o2::ccdb::CcdbApi ccdbApi; + TrackSelectorPi selectorPion; TrackSelectorPr selectorProton; @@ -189,6 +214,18 @@ struct HfCandidateSelectorToXiPi { registry.add("hSelMassCharmBaryon", "hSelMassCharmBaryon;status;entries", {HistType::kTH1F, {axisSel}}); registry.add("hSelDcaXYToPvV0Daughters", "hSelDcaXYToPvV0Daughters;status;entries", {HistType::kTH1F, {axisSel}}); registry.add("hSelDcaXYToPvPiFromCasc", "hSelDcaXYToPvPiFromCasc;status;entries", {HistType::kTH1F, {axisSel}}); + + if (applyMl) { + hfMlResponse.configure(binsPtMl, cutsMl, cutDirMl, nClassesMl); + if (loadModelsFromCCDB) { + ccdbApi.init(ccdbUrl); + hfMlResponse.setModelPathsCCDB(onnxFileNames, ccdbApi, modelPathsCCDB, timestampCCDB); + } else { + hfMlResponse.setModelPathsLocal(onnxFileNames); + } + hfMlResponse.cacheInputFeaturesIndices(namesInputFeatures); + hfMlResponse.init(); + } } void process(aod::HfCandToXiPi const& candidates, @@ -204,6 +241,7 @@ struct HfCandidateSelectorToXiPi { bool resultSelections = true; // True if the candidate passes all the selections, False otherwise + auto ptCand = RecoDecay::pt(candidate.pxCharmBaryon(), candidate.pyCharmBaryon()); auto trackV0PosDauId = candidate.posTrackId(); // positive V0 daughter auto trackV0NegDauId = candidate.negTrackId(); // negative V0 daughter auto trackPiFromCascId = candidate.bachelorId(); // pion <- cascade @@ -519,6 +557,17 @@ struct HfCandidateSelectorToXiPi { registry.fill(HIST("hSelMassCharmBaryon"), 0); } + // ML selections + if (applyMl) { + bool isSelectedMlXic0 = false; + std::vector inputFeaturesXic0 = hfMlResponse.getInputFeatures(candidate, trackPiFromLam, trackPiFromCasc, trackPiFromCharm); + isSelectedMlXic0 = hfMlResponse.isSelectedMl(inputFeaturesXic0, ptCand, outputMlXic0ToXiPi); + if (!isSelectedMlXic0) { + continue; + } + hfMlToXiPi(outputMlXic0ToXiPi); + } + hfSelToXiPi(statusPidLambda, statusPidCascade, statusPidCharmBaryon, statusInvMassLambda, statusInvMassCascade, statusInvMassCharmBaryon, resultSelections, infoTpcStored, infoTofStored, trackPiFromCharm.tpcNSigmaPi(), trackPiFromCasc.tpcNSigmaPi(), trackPiFromLam.tpcNSigmaPi(), trackPrFromLam.tpcNSigmaPr(), trackPiFromCharm.tofNSigmaPi(), trackPiFromCasc.tofNSigmaPi(), trackPiFromLam.tofNSigmaPi(), trackPrFromLam.tofNSigmaPr()); diff --git a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx index f40b2c030e5..13e131bbcfb 100644 --- a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx +++ b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx @@ -61,7 +61,7 @@ enum PidInfoStored { /// Struct for applying Xic0 -> Xi pi selection cuts struct HfCandidateSelectorXic0ToXiPiKf { Produces hfSelToXiPi; - Produces hfMlToXiPi; + Produces hfMlToXiPi; // kinematic selections Configurable etaTrackCharmBachMax{"etaTrackCharmBachMax", 0.8, "Max absolute value of eta for charm baryon bachelor"}; diff --git a/PWGHF/TableProducer/treeCreatorToXiPi.cxx b/PWGHF/TableProducer/treeCreatorToXiPi.cxx index ed265daa74a..173856ed7e9 100644 --- a/PWGHF/TableProducer/treeCreatorToXiPi.cxx +++ b/PWGHF/TableProducer/treeCreatorToXiPi.cxx @@ -75,6 +75,8 @@ DECLARE_SOA_COLUMN(PzPiFromCharmBaryon, pzPiFromCharmBaryon, float); DECLARE_SOA_COLUMN(PxLambda, pxLambda, float); DECLARE_SOA_COLUMN(PyLambda, pyLambda, float); DECLARE_SOA_COLUMN(PzLambda, pzLambda, float); +DECLARE_SOA_COLUMN(PtCharmBaryon, ptCharmBaryon, float); +DECLARE_SOA_COLUMN(PtPiFromCharmBaryon, ptPiFromCharmBaryon, float); DECLARE_SOA_COLUMN(PxPiFromCasc, pxPiFromCasc, float); DECLARE_SOA_COLUMN(PyPiFromCasc, pyPiFromCasc, float); DECLARE_SOA_COLUMN(PzPiFromCasc, pzPiFromCasc, float); @@ -169,6 +171,7 @@ DECLARE_SOA_TABLE(HfToXiPiFulls, "AOD", "HFTOXIPIFULL", full::XDecayVtxV0, full::YDecayVtxV0, full::ZDecayVtxV0, full::SignDecay, full::CovVtxCharmBaryonXX, full::CovVtxCharmBaryonYY, full::CovVtxCharmBaryonZZ, + full::PtCharmBaryon, full::PtPiFromCharmBaryon, full::PxCharmBaryon, full::PyCharmBaryon, full::PzCharmBaryon, full::PxCasc, full::PyCasc, full::PzCasc, full::PxPiFromCharmBaryon, full::PyPiFromCharmBaryon, full::PzPiFromCharmBaryon, @@ -202,15 +205,16 @@ DECLARE_SOA_TABLE(HfToXiPiLites, "AOD", "HFTOXIPILITE", full::XDecayVtxCascade, full::YDecayVtxCascade, full::ZDecayVtxCascade, full::XDecayVtxV0, full::YDecayVtxV0, full::ZDecayVtxV0, full::SignDecay, - full::PxCharmBaryon, full::PyCharmBaryon, full::PzCharmBaryon, - full::PxPiFromCharmBaryon, full::PyPiFromCharmBaryon, full::PzPiFromCharmBaryon, + full::PtCharmBaryon, full::PtPiFromCharmBaryon, full::PxPiFromCasc, full::PyPiFromCasc, full::PzPiFromCasc, full::PxPosV0Dau, full::PyPosV0Dau, full::PzPosV0Dau, full::PxNegV0Dau, full::PyNegV0Dau, full::PzNegV0Dau, full::ImpactParCascXY, full::ImpactParPiFromCharmBaryonXY, full::ErrImpactParCascXY, full::ErrImpactParPiFromCharmBaryonXY, full::InvMassLambda, full::InvMassCascade, full::InvMassCharmBaryon, + full::CosPAV0, full::CosPACharmBaryon, full::CosPACasc, full::EtaV0PosDau, full::EtaV0NegDau, full::EtaPiFromCasc, full::EtaPiFromCharmBaryon, + full::EtaCharmBaryon, full::DcaXYToPvV0Dau0, full::DcaXYToPvV0Dau1, full::DcaXYToPvCascDau, full::DcaCascDau, full::DcaV0Dau, full::DcaCharmBaryonDau, full::ErrorDecayLengthCharmBaryon, full::NormImpParCascade, full::NormImpParPiFromCharmBar, @@ -283,6 +287,8 @@ struct HfTreeCreatorToXiPi { candidate.covVtxCharmBaryon0(), candidate.covVtxCharmBaryon3(), candidate.covVtxCharmBaryon5(), + RecoDecay::pt(candidate.pxCharmBaryon(), candidate.pyCharmBaryon()), + RecoDecay::pt(candidate.pxBachFromCharmBaryon(), candidate.pyBachFromCharmBaryon()), candidate.pxCharmBaryon(), candidate.pyCharmBaryon(), candidate.pzCharmBaryon(), @@ -404,15 +410,11 @@ struct HfTreeCreatorToXiPi { candidate.yDecayVtxV0(), candidate.zDecayVtxV0(), candidate.signDecay(), + RecoDecay::pt(candidate.pxCharmBaryon(), candidate.pyCharmBaryon()), + RecoDecay::pt(candidate.pxBachFromCharmBaryon(), candidate.pyBachFromCharmBaryon()), candidate.pxCharmBaryon(), candidate.pyCharmBaryon(), candidate.pzCharmBaryon(), - candidate.pxBachFromCharmBaryon(), - candidate.pyBachFromCharmBaryon(), - candidate.pzBachFromCharmBaryon(), - candidate.pxBachFromCasc(), - candidate.pyBachFromCasc(), - candidate.pzBachFromCasc(), candidate.pxPosV0Dau(), candidate.pyPosV0Dau(), candidate.pzPosV0Dau(), @@ -426,10 +428,14 @@ struct HfTreeCreatorToXiPi { candidate.invMassLambda(), candidate.invMassCascade(), candidate.invMassCharmBaryon(), + candidate.cosPAV0(), + candidate.cosPACharmBaryon(), + candidate.cosPACasc(), candidate.etaV0PosDau(), candidate.etaV0NegDau(), candidate.etaBachFromCasc(), candidate.etaBachFromCharmBaryon(), + candidate.etaCharmBaryon(), candidate.dcaXYToPvV0Dau0(), candidate.dcaXYToPvV0Dau1(), candidate.dcaXYToPvCascDau(), From 38fe989a8f9962b110fcb5dacc92b7b9d8ba70bf Mon Sep 17 00:00:00 2001 From: Katarzyna <116073883+kgwizdzi@users.noreply.github.com> Date: Wed, 22 Oct 2025 02:10:27 +0200 Subject: [PATCH 842/986] [PWGCF] FemtoUniverse: adding histos in D0 task (#13478) --- .../Tasks/femtoUniversePairTaskTrackD0.cxx | 42 +++++++++++++++++-- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx index 6b6dab1c67d..57abc100ee4 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx @@ -56,6 +56,12 @@ using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::soa; +namespace +{ +static const int8_t genPromptD0 = 1; +static const int8_t genNonPromptD0 = 2; +} // namespace + /// Returns deltaPhi value within the range [-pi/2, 3/2*pi] /// double getDeltaPhi(double phiD, double phiDbar) @@ -437,12 +443,20 @@ struct FemtoUniversePairTaskTrackD0 { } // MC Reco mcRecoRegistry.add("hMcRecD0", "MC Reco all D0s;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecD0Pt", "MC Reco all D0s;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {vbins}}); mcRecoRegistry.add("hMcRecD0Prompt", "MC Reco prompt D0s;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecD0PromptPt", "MC Reco prompt D0s;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {vbins}}); mcRecoRegistry.add("hMcRecD0NonPrompt", "MC Reco non-prompt D0s;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecD0NonPromptPt", "MC Reco non-prompt D0s;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {vbins}}); mcRecoRegistry.add("hMcRecD0Phi", "MC Reco all D0s;#varphi (rad); counts", {HistType::kTH1F, {{80, 0., o2::constants::math::TwoPI}}}); + mcRecoRegistry.add("hMcRecD0PromptPhi", "MC Reco prompt D0s;#varphi (rad); counts", {HistType::kTH1F, {{80, 0., o2::constants::math::TwoPI}}}); + mcRecoRegistry.add("hMcRecD0NonPromptPhi", "MC Reco non-prompt D0s;#varphi (rad); counts", {HistType::kTH1F, {{80, 0., o2::constants::math::TwoPI}}}); mcRecoRegistry.add("hMcRecD0bar", "MC Reco all D0bars;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecD0barPt", "MC Reco all D0bars;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {vbins}}); mcRecoRegistry.add("hMcRecD0barPrompt", "MC Reco prompt D0bars;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecD0barPromptPt", "MC Reco prompt D0bars;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {vbins}}); mcRecoRegistry.add("hMcRecD0barNonPrompt", "MC Reco non-prompt D0bars;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecD0barNonPromptPt", "MC Reco non-prompt D0bars;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {vbins}}); mcRecoRegistry.add("hMcRecD0barPhi", "MC Reco all D0bars;#varphi (rad); counts", {HistType::kTH1F, {{80, 0., o2::constants::math::TwoPI}}}); // Inv. mass histograms mcRecoRegistry.add("hMassVsPtD0Sig", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); @@ -471,11 +485,17 @@ struct FemtoUniversePairTaskTrackD0 { // MC truth mcTruthRegistry.add("hMcGenD0", "MC Truth all D0s;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenD0Pt", "MC Truth all D0s;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {vbins}}); mcTruthRegistry.add("hMcGenD0Prompt", "MC Truth prompt D0s;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenD0PromptPt", "MC Truth prompt D0s;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {vbins}}); mcTruthRegistry.add("hMcGenD0NonPrompt", "MC Truth non-prompt D0s;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenD0NonPromptPt", "MC Truth non-prompt D0s;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {vbins}}); mcTruthRegistry.add("hMcGenD0bar", "MC Truth all D0bars;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenD0barPt", "MC Truth all D0bars;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {vbins}}); mcTruthRegistry.add("hMcGenD0barPrompt", "MC Truth prompt D0bars;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenD0barPromptPt", "MC Truth prompt D0s;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {vbins}}); mcTruthRegistry.add("hMcGenD0barNonPrompt", "MC Truth non-prompt D0bars;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenD0barNonPromptPt", "MC Truth non-prompt D0s;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {vbins}}); mcTruthRegistry.add("hMcGenAllPositivePt", "MC Truth all positive;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{360, 0, 36}}}); mcTruthRegistry.add("hMcGenAllNegativePt", "MC Truth all negative;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{360, 0, 36}}}); mcTruthRegistry.add("hMcGenKpPtVsEta", "MC Truth K+;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); @@ -1318,19 +1338,27 @@ struct FemtoUniversePairTaskTrackD0 { } else if ((part.partType() == aod::femtouniverseparticle::ParticleType::kD0) && (part.pt() > ConfDmesons.confMinPtD0D0barReco) && (part.pt() < ConfDmesons.confMaxPtD0D0barReco)) { if (mcpart.pdgMCTruth() == ConfDmesons.confPDGCodeD0) { mcRecoRegistry.fill(HIST("hMcRecD0"), part.pt(), part.eta()); + mcRecoRegistry.fill(HIST("hMcRecD0Pt"), part.pt()); mcRecoRegistry.fill(HIST("hMcRecD0Phi"), part.phi()); if (part.tpcNClsFound() == 0) { // prompt candidates mcRecoRegistry.fill(HIST("hMcRecD0Prompt"), part.pt(), part.eta()); + mcRecoRegistry.fill(HIST("hMcRecD0PromptPt"), part.pt()); + mcRecoRegistry.fill(HIST("hMcRecD0PromptPhi"), part.phi()); } else if (part.tpcNClsFound() == 1) { // non-prompt candidates mcRecoRegistry.fill(HIST("hMcRecD0NonPrompt"), part.pt(), part.eta()); + mcRecoRegistry.fill(HIST("hMcRecD0PromptPt"), part.pt()); + mcRecoRegistry.fill(HIST("hMcRecD0PromptPhi"), part.phi()); } } else if (mcpart.pdgMCTruth() == ConfDmesons.confPDGCodeD0bar) { mcRecoRegistry.fill(HIST("hMcRecD0bar"), part.pt(), part.eta()); + mcRecoRegistry.fill(HIST("hMcRecD0barPt"), part.pt()); mcRecoRegistry.fill(HIST("hMcRecD0barPhi"), part.phi()); if (part.tpcNClsFound() == 0) { // prompt candidates mcRecoRegistry.fill(HIST("hMcRecD0barPrompt"), part.pt(), part.eta()); + mcRecoRegistry.fill(HIST("hMcRecD0barPromptPt"), part.pt()); } else if (part.tpcNClsFound() == 1) { // non-prompt candidates mcRecoRegistry.fill(HIST("hMcRecD0barNonPrompt"), part.pt(), part.eta()); + mcRecoRegistry.fill(HIST("hMcRecD0barNonPromptPt"), part.pt()); } } } @@ -1413,10 +1441,13 @@ struct FemtoUniversePairTaskTrackD0 { if (pdgCode == o2::constants::physics::Pdg::kD0) { if (std::abs(hfFlagMcGen) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { mcTruthRegistry.fill(HIST("hMcGenD0"), part.pt(), part.eta()); - if (part.mAntiLambda() == 1) { + mcTruthRegistry.fill(HIST("hMcGenD0Pt"), part.pt()); + if (static_cast(part.mAntiLambda()) == genPromptD0) { mcTruthRegistry.fill(HIST("hMcGenD0Prompt"), part.pt(), part.eta()); - } else if (part.mAntiLambda() == 2) { + mcTruthRegistry.fill(HIST("hMcGenD0PromptPt"), part.pt()); + } else if (static_cast(part.mAntiLambda()) == genNonPromptD0) { mcTruthRegistry.fill(HIST("hMcGenD0NonPrompt"), part.pt(), part.eta()); + mcTruthRegistry.fill(HIST("hMcGenD0NonPromptPt"), part.pt()); } } } @@ -1439,10 +1470,13 @@ struct FemtoUniversePairTaskTrackD0 { if (pdgCode == o2::constants::physics::Pdg::kD0Bar) { if (std::abs(hfFlagMcGen) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { mcTruthRegistry.fill(HIST("hMcGenD0bar"), part.pt(), part.eta()); - if (part.mAntiLambda() == 1) { + mcTruthRegistry.fill(HIST("hMcGenD0barPt"), part.pt()); + if (static_cast(part.mAntiLambda()) == genPromptD0) { mcTruthRegistry.fill(HIST("hMcGenD0barPrompt"), part.pt(), part.eta()); - } else if (part.mAntiLambda() == 2) { + mcTruthRegistry.fill(HIST("hMcGenD0barPromptPt"), part.pt()); + } else if (static_cast(part.mAntiLambda()) == genNonPromptD0) { mcTruthRegistry.fill(HIST("hMcGenD0barNonPrompt"), part.pt(), part.eta()); + mcTruthRegistry.fill(HIST("hMcGenD0barNonPromptPt"), part.pt()); } } } From 7a8411b1bb5f5642e1e88d740136bbf0d00282e5 Mon Sep 17 00:00:00 2001 From: Sahil Upadhyaya <36447687+sahilupadhyaya92@users.noreply.github.com> Date: Wed, 22 Oct 2025 03:19:22 +0200 Subject: [PATCH 843/986] [PWGDQ] Turning off the PR #13393 to verify large memory consumption for dqEfficiency_withassoc (#13479) Co-authored-by: Sahil Upadhyaya --- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index 5fe815bb08b..552dd2b4e93 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -1721,10 +1721,10 @@ struct AnalysisSameEventPairing { template void runSameEventPairing(TEvents const& events, Preslice& preslice, TTrackAssocs const& assocs, TTracks const& /*tracks*/, ReducedMCEvents const& /*mcEvents*/, ReducedMCTracks const& /*mcTracks*/) { - if (events.size() == 0) { - LOG(warning) << "No events in this TF, going to the next one ..."; - return; - } + // if (events.size() == 0) { + // LOG(warning) << "No events in this TF, going to the next one ..."; + // return; + // } if (fCurrentRun != events.begin().runNumber()) { initParamsFromCCDB(events.begin().timestamp(), TTwoProngFitter); fCurrentRun = events.begin().runNumber(); From 1bc012e13a4ec18a3d8f8e0dbbeb9473f50abf3c Mon Sep 17 00:00:00 2001 From: Stefanie Mrozinski <63045530+Steffimro@users.noreply.github.com> Date: Wed, 22 Oct 2025 03:24:08 +0200 Subject: [PATCH 844/986] [PWGEM] Fix includes (#13476) --- PWGEM/PhotonMeson/Tasks/MaterialBudget.cxx | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/PWGEM/PhotonMeson/Tasks/MaterialBudget.cxx b/PWGEM/PhotonMeson/Tasks/MaterialBudget.cxx index fefac20d019..b4a6c8e065a 100644 --- a/PWGEM/PhotonMeson/Tasks/MaterialBudget.cxx +++ b/PWGEM/PhotonMeson/Tasks/MaterialBudget.cxx @@ -33,20 +33,14 @@ #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DetectorsBase/GeometryManager.h" -#include "DetectorsBase/Propagator.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisHelpers.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/Track.h" #include +#include +#include +#include +#include +#include #include +#include #include #include @@ -1064,8 +1058,6 @@ struct MaterialBudget { registry.fill(HIST("PhotonPurity"), v0.pt(), rConv, v0.eta(), v0.phi(), purityCat); - LOGP(info, "order: {}", posmc.pdgCode()); - int photonid = FindCommonMotherFrom2Prongs(posmc, elemc, -11, 11, 22, mcparticles); if (photonid < 0) { continue; From bf13110d0e1704a7fc7f6741bf79e889ac6df8f4 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Wed, 22 Oct 2025 05:49:49 +0200 Subject: [PATCH 845/986] [PWGEM/Dilepton] add a task to evaluate pair acc. in MC (#13477) --- PWGEM/Dilepton/Core/Dilepton.h | 6 +- PWGEM/Dilepton/Core/DileptonMC.h | 69 ++- .../TableProducer/associateMCinfoDilepton.cxx | 8 +- PWGEM/Dilepton/Tasks/CMakeLists.txt | 4 + PWGEM/Dilepton/Tasks/evaluateAcceptance.cxx | 407 ++++++++++++++++++ PWGEM/Dilepton/Utils/MCUtilities.h | 36 +- 6 files changed, 486 insertions(+), 44 deletions(-) create mode 100644 PWGEM/Dilepton/Tasks/evaluateAcceptance.cxx diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 4b8c4658b2d..ac355b6c698 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -131,8 +131,8 @@ struct Dilepton { // ConfigurableAxis ConfMmumuBins{"ConfMmumuBins", {VARIABLE_WIDTH, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.50, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.70, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.80, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.00, 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.10, 1.11,1.12,1.13,1.14,1.15,1.16,1.17,1.18,1.19, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.10, 2.20, 2.30, 2.40, 2.50, 2.60, 2.70, 2.75, 2.80, 2.85, 2.90, 2.95, 3.00, 3.05, 3.10, 3.15, 3.20, 3.25, 3.30, 3.35, 3.40, 3.45, 3.50, 3.55, 3.60, 3.65, 3.70, 3.75, 3.80, 3.85, 3.90, 3.95, 4.00, 4.10, 4.20, 4.30, 4.40, 4.50, 4.60, 4.70, 4.80, 4.90, 5.00, 5.10, 5.20, 5.30, 5.40, 5.50, 5.60, 5.70, 5.80, 5.90, 6.00, 6.10, 6.20, 6.30, 6.40, 6.50, 6.60, 6.70, 6.80, 6.90, 7.00, 7.10, 7.20, 7.30, 7.40, 7.50, 7.60, 7.70, 7.80, 7.90, 8.00, 8.10, 8.20, 8.30, 8.40, 8.50, 8.60, 8.70, 8.80, 8.90, 9.00, 9.10, 9.20, 9.30, 9.40, 9.50, 9.60, 9.70, 9.80, 9.90, 10.00, 10.10, 10.20, 10.30, 10.40, 10.50, 10.60, 10.70, 10.80, 10.90, 11.00, 11.50, 12.00}, "mmumu bins for output histograms"}; // for dimuon. one can copy bins here to hyperloop page. ConfigurableAxis ConfSPBins{"ConfSPBins", {200, -5, 5}, "SP bins for flow analysis"}; - ConfigurableAxis ConfPolarizationPhiBins{"ConfPolarizationPhiBins", {1, 0.f, 2 * M_PI}, "phi bins for polarization analysis"}; ConfigurableAxis ConfPolarizationCosThetaBins{"ConfPolarizationCosThetaBins", {20, -1.f, 1.f}, "cos(theta) bins for polarization analysis"}; + ConfigurableAxis ConfPolarizationPhiBins{"ConfPolarizationPhiBins", {1, -M_PI, M_PI}, "phi bins for polarization analysis"}; ConfigurableAxis ConfPolarizationQuadMomBins{"ConfPolarizationQuadMomBins", {15, -0.5, 1}, "quadrupole moment bins for polarization analysis"}; // quardrupole moment <(3 x cos^2(theta) -1)/2> EMEventCut fEMEventCut; @@ -973,7 +973,7 @@ struct Dilepton { } else if (cfgPolarizationFrame == 1) { o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(std::array{t1.px(), t1.py(), t1.pz(), leptonM1}, std::array{t2.px(), t2.py(), t2.pz(), leptonM2}, beamE1, beamE2, beamP1, beamP2, t1.sign(), cos_thetaPol, phiPol); } - o2::math_utils::bringTo02Pi(phiPol); + o2::math_utils::bringToPMPi(phiPol); if (t1.sign() * t2.sign() < 0) { // ULS fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), aco, asym, std::fabs(dphi_e_ee), cos_thetaPol, weight); @@ -1030,7 +1030,7 @@ struct Dilepton { } else if (cfgPolarizationFrame == 1) { o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(std::array{t1.px(), t1.py(), t1.pz(), leptonM1}, std::array{t2.px(), t2.py(), t2.pz(), leptonM2}, beamE1, beamE2, beamP1, beamP2, t1.sign(), cos_thetaPol, phiPol); } - o2::math_utils::bringTo02Pi(phiPol); + o2::math_utils::bringToPMPi(phiPol); float quadmom = (3.f * std::pow(cos_thetaPol, 2) - 1.f) / 2.f; if (t1.sign() * t2.sign() < 0) { // ULS diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index 51de312162f..bbbdaaca444 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -47,6 +47,7 @@ #include "Math/Vector4D.h" #include "TString.h" +#include #include #include #include @@ -127,8 +128,8 @@ struct DileptonMC { Configurable cfg_nbin_aco{"cfg_nbin_aco", 1, "number of bins for acoplanarity"}; // 10 Configurable cfg_nbin_asym_pt{"cfg_nbin_asym_pt", 1, "number of bins for pt asymmetry"}; // 10 Configurable cfg_nbin_dphi_e_ee{"cfg_nbin_dphi_e_ee", 1, "number of bins for dphi_ee_e"}; // 18 - ConfigurableAxis ConfPolarizationPhiBins{"ConfPolarizationPhiBins", {1, 0.f, 2 * M_PI}, "phi bins for polarization analysis"}; ConfigurableAxis ConfPolarizationCosThetaBins{"ConfPolarizationCosThetaBins", {1, -1.f, 1.f}, "cos(theta) bins for polarization analysis"}; + ConfigurableAxis ConfPolarizationPhiBins{"ConfPolarizationPhiBins", {1, -M_PI, M_PI}, "phi bins for polarization analysis"}; Configurable cfgPolarizationFrame{"cfgPolarizationFrame", 0, "frame of polarization. 0:CS, 1:HX, else:FATAL"}; ConfigurableAxis ConfPolarizationQuadMomBins{"ConfPolarizationQuadMomBins", {1, -0.5, 1}, "quadrupole moment bins for polarization analysis"}; // quardrupole moment <(3 x cos^2(theta) -1)/2> @@ -803,27 +804,57 @@ struct DileptonMC { } template - int FindLF(TTrack const& posmc, TTrack const& negmc, TMCParticles const& mcparticles) + int FindSMULS(TTrack const& t1mc, TTrack const& t2mc, TMCParticles const& mcparticles) { int arr[] = { - FindCommonMotherFrom2Prongs(posmc, negmc, -pdg_lepton, pdg_lepton, 22, mcparticles), - FindCommonMotherFrom2Prongs(posmc, negmc, -pdg_lepton, pdg_lepton, 111, mcparticles), - FindCommonMotherFrom2Prongs(posmc, negmc, -pdg_lepton, pdg_lepton, 221, mcparticles), - FindCommonMotherFrom2Prongs(posmc, negmc, -pdg_lepton, pdg_lepton, 331, mcparticles), - FindCommonMotherFrom2Prongs(posmc, negmc, -pdg_lepton, pdg_lepton, 113, mcparticles), - FindCommonMotherFrom2Prongs(posmc, negmc, -pdg_lepton, pdg_lepton, 223, mcparticles), - FindCommonMotherFrom2Prongs(posmc, negmc, -pdg_lepton, pdg_lepton, 333, mcparticles), - FindCommonMotherFrom2Prongs(posmc, negmc, -pdg_lepton, pdg_lepton, 443, mcparticles), - FindCommonMotherFrom2Prongs(posmc, negmc, -pdg_lepton, pdg_lepton, 100443, mcparticles) - // FindCommonMotherFrom2Prongs(posmc, negmc, -pdg_lepton, pdg_lepton, 553, mcparticles), - // FindCommonMotherFrom2Prongs(posmc, negmc, -pdg_lepton, pdg_lepton, 100553, mcparticles), - // FindCommonMotherFrom2Prongs(posmc, negmc, -pdg_lepton, pdg_lepton, 200553, mcparticles) + FindCommonMotherFrom2Prongs(t1mc, t2mc, -pdg_lepton, pdg_lepton, 22, mcparticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -pdg_lepton, pdg_lepton, 111, mcparticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -pdg_lepton, pdg_lepton, 221, mcparticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -pdg_lepton, pdg_lepton, 331, mcparticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -pdg_lepton, pdg_lepton, 113, mcparticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -pdg_lepton, pdg_lepton, 223, mcparticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -pdg_lepton, pdg_lepton, 333, mcparticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -pdg_lepton, pdg_lepton, 443, mcparticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -pdg_lepton, pdg_lepton, 100443, mcparticles) + // FindCommonMotherFrom2Prongs(t1mc, t2mc, -pdg_lepton, pdg_lepton, 553, mcparticles), + // FindCommonMotherFrom2Prongs(t1mc, t2mc, -pdg_lepton, pdg_lepton, 100553, mcparticles), + // FindCommonMotherFrom2Prongs(t1mc, t2mc, -pdg_lepton, pdg_lepton, 200553, mcparticles) }; int size = sizeof(arr) / sizeof(*arr); int max = *std::max_element(arr, arr + size); return max; } + template + int FindSMLSPP(TTrack const& t1mc, TTrack const& t2mc, TMCParticles const& mcparticles) + { + int arr[] = { + FindCommonMotherFrom2Prongs(t1mc, t2mc, -pdg_lepton, -pdg_lepton, 111, mcparticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -pdg_lepton, -pdg_lepton, 221, mcparticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -pdg_lepton, -pdg_lepton, 331, mcparticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -pdg_lepton, -pdg_lepton, 113, mcparticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -pdg_lepton, -pdg_lepton, 223, mcparticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -pdg_lepton, -pdg_lepton, 333, mcparticles)}; + int size = sizeof(arr) / sizeof(*arr); + int max = *std::max_element(arr, arr + size); + return max; + } + + template + int FindSMLSMM(TTrack const& t1mc, TTrack const& t2mc, TMCParticles const& mcparticles) + { + int arr[] = { + FindCommonMotherFrom2Prongs(t1mc, t2mc, pdg_lepton, pdg_lepton, 111, mcparticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, pdg_lepton, pdg_lepton, 221, mcparticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, pdg_lepton, pdg_lepton, 331, mcparticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, pdg_lepton, pdg_lepton, 113, mcparticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, pdg_lepton, pdg_lepton, 223, mcparticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, pdg_lepton, pdg_lepton, 333, mcparticles)}; + int size = sizeof(arr) / sizeof(*arr); + int max = *std::max_element(arr, arr + size); + return max; + } + template bool isInAcceptance(T const& lepton) { @@ -1490,7 +1521,7 @@ struct DileptonMC { } else if (cfgPolarizationFrame == 1) { o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, t1.sign(), cos_thetaPol, phiPol); } - o2::math_utils::bringTo02Pi(phiPol); + o2::math_utils::bringToPMPi(phiPol); float quadmom = (3.f * std::pow(cos_thetaPol, 2) - 1.f) / 2.f; if ((FindCommonMotherFrom2ProngsWithoutPDG(t1mc, t2mc) > 0 || IsHF(t1mc, t2mc, mcparticles) > 0) && is_pair_from_same_mcevent) { // for bkg study @@ -1533,7 +1564,7 @@ struct DileptonMC { if (cfgRequireTrueAssociation && (t1mc.emmceventId() != collision.emmceventId() || t2mc.emmceventId() != collision.emmceventId())) { return false; } - int mother_id = FindLF(t1mc, t2mc, mcparticles); + int mother_id = std::max({FindSMULS(t1mc, t2mc, mcparticles), FindSMULS(t2mc, t1mc, mcparticles), FindSMLSPP(t1mc, t2mc, mcparticles), FindSMLSMM(t1mc, t2mc, mcparticles)}); int hfee_type = IsHF(t1mc, t2mc, mcparticles); if (mother_id < 0 && hfee_type < 0) { return false; @@ -1708,7 +1739,7 @@ struct DileptonMC { return false; } - int mother_id = FindLF(t1, t2, mcparticles); + int mother_id = std::max({FindSMULS(t1, t2, mcparticles), FindSMULS(t2, t1, mcparticles), FindSMLSPP(t1, t2, mcparticles), FindSMLSMM(t1, t2, mcparticles)}); int hfee_type = IsHF(t1, t2, mcparticles); if (mother_id < 0 && hfee_type < 0) { return false; @@ -1797,7 +1828,7 @@ struct DileptonMC { } else if (cfgPolarizationFrame == 1) { o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, -t1.pdgCode() / pdg_lepton, cos_thetaPol, phiPol); } - o2::math_utils::bringTo02Pi(phiPol); + o2::math_utils::bringToPMPi(phiPol); float quadmom = (3.f * std::pow(cos_thetaPol, 2) - 1.f) / 2.f; // bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); @@ -2226,7 +2257,7 @@ struct DileptonMC { if (!((t1mc.isPhysicalPrimary() || t1mc.producedByGenerator()) && (t2mc.isPhysicalPrimary() || t2mc.producedByGenerator()))) { return false; } - int mother_id = FindLF(t1mc, t2mc, mcparticles); + int mother_id = std::max({FindSMULS(t1mc, t2mc, mcparticles), FindSMULS(t2mc, t1mc, mcparticles), FindSMLSPP(t1mc, t2mc, mcparticles), FindSMLSMM(t1mc, t2mc, mcparticles)}); int hfee_type = IsHF(t1mc, t2mc, mcparticles); if (mother_id < 0 && hfee_type < 0) { return false; diff --git a/PWGEM/Dilepton/TableProducer/associateMCinfoDilepton.cxx b/PWGEM/Dilepton/TableProducer/associateMCinfoDilepton.cxx index 0d62389cdfc..92078356fd6 100644 --- a/PWGEM/Dilepton/TableProducer/associateMCinfoDilepton.cxx +++ b/PWGEM/Dilepton/TableProducer/associateMCinfoDilepton.cxx @@ -60,10 +60,10 @@ struct AssociateMCInfoDilepton { Configurable n_dummy_loop{"n_dummy_loop", 0, "for loop runs over n times"}; Configurable down_scaling_omega{"down_scaling_omega", 1.1, "down scaling factor to store omega"}; Configurable down_scaling_phi{"down_scaling_phi", 1.1, "down scaling factor to store phi"}; - Configurable min_eta_gen_primary{"min_eta_gen_primary", -1.5, "min rapidity Y to store generated information"}; // smearing is applied at analysis stage. set wider value. - Configurable max_eta_gen_primary{"max_eta_gen_primary", +1.5, "max rapidity Y to store generated information"}; // smearing is applied at analysis stage. set wider value. - Configurable min_eta_gen_primary_fwd{"min_eta_gen_primary_fwd", -5.0, "min eta to store generated information"}; // smearing is applied at analysis stage. set wider value. - Configurable max_eta_gen_primary_fwd{"max_eta_gen_primary_fwd", -1.5, "max eta to store generated information"}; // smearing is applied at analysis stage. set wider value. + Configurable min_eta_gen_primary{"min_eta_gen_primary", -1.5, "min eta to store generated information"}; // smearing is applied at analysis stage. set wider value. + Configurable max_eta_gen_primary{"max_eta_gen_primary", +1.5, "max eta to store generated information"}; // smearing is applied at analysis stage. set wider value. + Configurable min_eta_gen_primary_fwd{"min_eta_gen_primary_fwd", -6.0, "min eta to store generated information"}; // smearing is applied at analysis stage. set wider value. + Configurable max_eta_gen_primary_fwd{"max_eta_gen_primary_fwd", -1.0, "max eta to store generated information"}; // smearing is applied at analysis stage. set wider value. HistogramRegistry registry{"EMMCEvent"}; std::mt19937 engine; diff --git a/PWGEM/Dilepton/Tasks/CMakeLists.txt b/PWGEM/Dilepton/Tasks/CMakeLists.txt index 4e75843e48d..24cf04752b3 100644 --- a/PWGEM/Dilepton/Tasks/CMakeLists.txt +++ b/PWGEM/Dilepton/Tasks/CMakeLists.txt @@ -171,3 +171,7 @@ o2physics_add_dpl_workflow(study-dcafitter PUBLIC_LINK_LIBRARIES O2::Framework O2::DCAFitter O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(evaluate-acceptance + SOURCES evaluateAcceptance.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGEM/Dilepton/Tasks/evaluateAcceptance.cxx b/PWGEM/Dilepton/Tasks/evaluateAcceptance.cxx new file mode 100644 index 00000000000..b11b73ec5c9 --- /dev/null +++ b/PWGEM/Dilepton/Tasks/evaluateAcceptance.cxx @@ -0,0 +1,407 @@ +// 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 evaluateAcceptance.cxx +/// \brief a task to evaluate pair acceptance in MC +/// \author daiki.sekihata@cern.ch + +#include "PWGEM/Dilepton/Utils/MCUtilities.h" +#include "PWGEM/Dilepton/Utils/PairUtilities.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TableHelper.h" + +// #include "Common/Core/trackUtilities.h" +// #include "Common/DataModel/Centrality.h" +// #include "Common/DataModel/CollisionAssociationTables.h" +// #include "Common/DataModel/EventSelection.h" +// #include "Common/DataModel/Multiplicity.h" +// #include "Common/DataModel/PIDResponse.h" +// #include "Common/DataModel/TrackSelectionTables.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/LHCConstants.h" +#include "CommonConstants/PhysicsConstants.h" +#include "DataFormatsParameters/GRPLHCIFData.h" + +// #include "DataFormatsCalibration/MeanVertexObject.h" +// #include "DataFormatsParameters/GRPMagField.h" +// #include "DataFormatsParameters/GRPObject.h" +// #include "DetectorsBase/GeometryManager.h" +// #include "DetectorsBase/Propagator.h" + +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +#include "Math/Vector4D.h" + +#include +#include +#include +#include +#include +#include + +using namespace o2; +using namespace o2::soa; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::constants::physics; +using namespace o2::aod::pwgem::dilepton::utils::mcutil; +using namespace o2::aod::pwgem::dilepton::utils::pairutil; + +struct evaluateAcceptance { + // Configurables + Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + + Configurable cfgEventGeneratorType{"cfgEventGeneratorType", -1, "if positive, select event generator type. i.e. gap or signal"}; + Configurable cfgPdgLepton{"cfgPdgLepton", 11, "pdg code 11 or 13"}; + ConfigurableAxis ConfMllBins{"ConfMllBins", {400, 0, 4}, "mll bins"}; + ConfigurableAxis ConfPtllBins{"ConfPtllBins", {100, 0, 10}, "pTll bins"}; + ConfigurableAxis ConfYllBins{"ConfYllBins", {400, -10, +10}, "yll bins"}; + ConfigurableAxis ConfCosThetaBins{"ConfCosThetaBins", {40, -1, +1}, "cos theta bins for polarization"}; + ConfigurableAxis ConfPhiBins{"ConfPhiBins", {72, -M_PI, M_PI}, "phi bins for polarization"}; + ConfigurableAxis ConfQuadMomBins{"ConfQuadMomBins", {150, -0.5, 1}, "quadrupole moment bins for polarization"}; + ConfigurableAxis ConfPtlBins{"ConfPtlBins", {200, 0, 10}, "pTl bins"}; + ConfigurableAxis ConfEtalBins{"ConfEtalBins", {200, -10, 10}, "etal bins"}; + + HistogramRegistry fRegistry{"fRegistry"}; + Service ccdb; + int mRunNumber = 0; + + float beamM1 = o2::constants::physics::MassProton; // mass of beam + float beamM2 = o2::constants::physics::MassProton; // mass of beam + float beamE1 = 0.f; // beam energy + float beamE2 = 0.f; // beam energy + float beamP1 = 0.f; // beam momentum + float beamP2 = 0.f; // beam momentum + + float leptonM1 = 0.f; + float leptonM2 = 0.f; + void init(o2::framework::InitContext&) + { + ccdb->setURL(ccdburl); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setFatalWhenNull(false); + + if (cfgPdgLepton.value == 11) { + leptonM1 = o2::constants::physics::MassElectron; + leptonM2 = o2::constants::physics::MassElectron; + } else if (cfgPdgLepton.value == 13) { + leptonM1 = o2::constants::physics::MassMuon; + leptonM2 = o2::constants::physics::MassMuon; + } else { + LOGF(fatal, "pdg code must be 11 or 13."); + } + + addHistograms(); + } + + template + void initCCDB(TBC const& bc) + { + if (mRunNumber == bc.runNumber()) { + return; + } + + auto grplhcif = ccdb->getForTimeStamp("GLO/Config/GRPLHCIF", bc.timestamp()); + int beamZ1 = grplhcif->getBeamZ(o2::constants::lhc::BeamC); + int beamZ2 = grplhcif->getBeamZ(o2::constants::lhc::BeamA); + int beamA1 = grplhcif->getBeamA(o2::constants::lhc::BeamC); + int beamA2 = grplhcif->getBeamA(o2::constants::lhc::BeamA); + beamE1 = grplhcif->getBeamEnergyPerNucleonInGeV(o2::constants::lhc::BeamC); + beamE2 = grplhcif->getBeamEnergyPerNucleonInGeV(o2::constants::lhc::BeamA); + beamM1 = o2::constants::physics::MassProton * beamA1; + beamM2 = o2::constants::physics::MassProton * beamA2; + beamP1 = std::sqrt(std::pow(beamE1, 2) - std::pow(beamM1, 2)); + beamP2 = std::sqrt(std::pow(beamE2, 2) - std::pow(beamM2, 2)); + LOGF(info, "beamZ1 = %d, beamZ2 = %d, beamA1 = %d, beamA2 = %d, beamE1 = %f (GeV), beamE2 = %f (GeV), beamM1 = %f (GeV), beamM2 = %f (GeV), beamP1 = %f (GeV), beamP2 = %f (GeV)", beamZ1, beamZ2, beamA1, beamA2, beamE1, beamE2, beamM1, beamM2, beamP1, beamP2); + mRunNumber = bc.runNumber(); + } + + static constexpr std::string_view pair_sign_types[3] = {"uls/", "lspp/", "lsmm/"}; + static constexpr std::string_view dilepton_source_types[20] = { + "sm/Pi0/", // 0 + "sm/Eta/", // 1 + "sm/EtaPrime/", // 2 + "sm/Rho/", // 3 + "sm/Omega/", // 4 + "sm/Omega2ll/", // 5 + "sm/Phi/", // 6 + "sm/Phi2ll/", // 7 + "sm/PromptJPsi/", // 8 + "sm/NonPromptJPsi/", // 9 + "sm/PromptPsi2S/", // 10 + "sm/NonPromptPsi2S/", // 11 + "sm/Upsilon1S/", // 12 + "sm/Upsilon2S/", // 13 + "sm/Upsilon3S/", // 14 + "ccbar/c2l_c2l/", // 15 + "bbbar/b2l_b2l/", // 16 + "bbbar/b2c2l_b2c2l/", // 17 + "bbbar/b2c2l_b2l_sameb/", // 18 + "bbbar/b2c2l_b2l_diffb/" // 19 + }; // unordered_map is better, but cannot be constexpr. + + void addHistograms() + { + auto hCollisionCounter = fRegistry.add("Event/hCollisionCounter", "collision counter", kTH1D, {{2, -0.5f, 1.5f}}, false); + hCollisionCounter->GetXaxis()->SetBinLabel(1, "all"); + hCollisionCounter->GetXaxis()->SetBinLabel(2, "accepted"); + + const AxisSpec axisMll{ConfMllBins, "m_{ll} (GeV/c^{2})"}; + const AxisSpec axisPtll{ConfPtllBins, "p_{T,ll} (GeV/c)"}; + const AxisSpec axisYll{ConfYllBins, "y_{ll}"}; + const AxisSpec axisCosThetaCS{ConfCosThetaBins, "cos(#theta^{CS})"}; + const AxisSpec axisPhiCS{ConfPhiBins, "#varphi^{CS} (rad.)"}; + const AxisSpec axisQuadMomCS{ConfQuadMomBins, "#frac{3 cos^{2}(#theta^{CS}) #minus 1}{2}"}; + const AxisSpec axisCosThetaHX{ConfCosThetaBins, "cos(#theta^{HX})"}; + const AxisSpec axisPhiHX{ConfPhiBins, "#varphi^{HX} (rad.)"}; + const AxisSpec axisQuadMomHX{ConfQuadMomBins, "#frac{3 cos^{2}(#theta^{HX}) #minus 1}{2}"}; + + const AxisSpec axisPtl1{ConfPtlBins, "p_{T,l1} (GeV/c)"}; + const AxisSpec axisPtl2{ConfPtlBins, "p_{T,l2} (GeV/c)"}; + const AxisSpec axisEtal1{ConfEtalBins, "#eta_{l1}"}; + const AxisSpec axisEtal2{ConfEtalBins, "#eta_{l2}"}; + + // for pairs + fRegistry.add("Generated/sm/Pi0/uls/hs", "gen. dilepton", kTHnSparseD, {axisMll, axisPtll, axisYll, axisCosThetaCS, axisPhiCS, axisQuadMomCS, axisCosThetaHX, axisPhiHX, axisQuadMomHX, axisPtl1, axisPtl2, axisEtal1, axisEtal2}, true); + fRegistry.addClone("Generated/sm/Pi0/uls/", "Generated/sm/Pi0/lspp/"); + fRegistry.addClone("Generated/sm/Pi0/uls/", "Generated/sm/Pi0/lsmm/"); + fRegistry.addClone("Generated/sm/Pi0/", "Generated/sm/Eta/"); + fRegistry.addClone("Generated/sm/Pi0/", "Generated/sm/EtaPrime/"); + fRegistry.addClone("Generated/sm/Pi0/", "Generated/sm/Rho/"); + fRegistry.addClone("Generated/sm/Pi0/", "Generated/sm/Omega/"); + fRegistry.addClone("Generated/sm/Pi0/", "Generated/sm/Omega2ll/"); + fRegistry.addClone("Generated/sm/Pi0/", "Generated/sm/Phi/"); + fRegistry.addClone("Generated/sm/Pi0/", "Generated/sm/Phi2ll/"); + fRegistry.addClone("Generated/sm/Pi0/", "Generated/sm/PromptJPsi/"); + fRegistry.addClone("Generated/sm/Pi0/", "Generated/sm/NonPromptJPsi/"); + fRegistry.addClone("Generated/sm/Pi0/", "Generated/sm/PromptPsi2S/"); + fRegistry.addClone("Generated/sm/Pi0/", "Generated/sm/NonPromptPsi2S/"); + fRegistry.addClone("Generated/sm/Pi0/", "Generated/sm/Upsilon1S/"); + fRegistry.addClone("Generated/sm/Pi0/", "Generated/sm/Upsilon2S/"); + fRegistry.addClone("Generated/sm/Pi0/", "Generated/sm/Upsilon3S/"); + fRegistry.addClone("Generated/sm/Pi0/", "Generated/ccbar/c2l_c2l/"); + fRegistry.addClone("Generated/sm/Pi0/", "Generated/bbbar/b2l_b2l/"); + fRegistry.addClone("Generated/sm/Pi0/", "Generated/bbbar/b2c2l_b2c2l/"); + fRegistry.addClone("Generated/sm/Pi0/", "Generated/bbbar/b2c2l_b2l_sameb/"); // ULS + fRegistry.addClone("Generated/sm/Pi0/", "Generated/bbbar/b2c2l_b2l_diffb/"); // LS + } + + template + void fillGenPairInfo(TLepton const& t1, TLepton const& t2, TMCParticles const& mcParticles) + { + if (!t1.isPhysicalPrimary() && !t1.producedByGenerator()) { + return; + } + if (!t2.isPhysicalPrimary() && !t2.producedByGenerator()) { + return; + } + + int mother_id = std::max({FindSMULS(t1, t2, mcParticles), FindSMULS(t2, t1, mcParticles), FindSMLSPP(t1, t2, mcParticles), FindSMLSMM(t1, t2, mcParticles)}); + int hfee_type = IsHF(t1, t2, mcParticles); + if (mother_id < 0 && hfee_type < 0) { + return; + } + + ROOT::Math::PtEtaPhiMVector v1(t1.pt(), t1.eta(), t1.phi(), leptonM1); + ROOT::Math::PtEtaPhiMVector v2(t2.pt(), t2.eta(), t2.phi(), leptonM2); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + + int sign1 = t1.pdgCode() > 0 ? -1 : 1; + std::array arrP1 = {t1.px(), t1.py(), t1.pz(), leptonM1}; + std::array arrP2 = {t2.px(), t2.py(), t2.pz(), leptonM2}; + float cosThetaCS = 999, phiCS = 999.f; + float cosThetaHX = 999, phiHX = 999.f; + o2::aod::pwgem::dilepton::utils::pairutil::getAngleCS(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, sign1, cosThetaCS, phiCS); + o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, sign1, cosThetaHX, phiHX); + o2::math_utils::bringToPMPi(phiCS); + o2::math_utils::bringToPMPi(phiHX); + float quadmomCS = (3.f * std::pow(cosThetaCS, 2) - 1.f) / 2.f; + float quadmomHX = (3.f * std::pow(cosThetaHX, 2) - 1.f) / 2.f; + + if (mother_id > -1) { + auto mcmother = mcParticles.iteratorAt(mother_id); + int nd = mcmother.daughtersIds()[1] - mcmother.daughtersIds()[0] + 1; // number of daughters + switch (std::abs(mcmother.pdgCode())) { + case 111: + fRegistry.fill(HIST("Generated/sm/Pi0/") + HIST(pair_sign_types[pairSignId]) + HIST("hs"), v12.M(), v12.Pt(), v12.Rapidity(), cosThetaCS, phiCS, quadmomCS, cosThetaHX, phiHX, quadmomHX, t1.pt(), t2.pt(), t1.eta(), t2.eta()); + break; + case 221: + fRegistry.fill(HIST("Generated/sm/Eta/") + HIST(pair_sign_types[pairSignId]) + HIST("hs"), v12.M(), v12.Pt(), v12.Rapidity(), cosThetaCS, phiCS, quadmomCS, cosThetaHX, phiHX, quadmomHX, t1.pt(), t2.pt(), t1.eta(), t2.eta()); + break; + case 331: + fRegistry.fill(HIST("Generated/sm/EtaPrime/") + HIST(pair_sign_types[pairSignId]) + HIST("hs"), v12.M(), v12.Pt(), v12.Rapidity(), cosThetaCS, phiCS, quadmomCS, cosThetaHX, phiHX, quadmomHX, t1.pt(), t2.pt(), t1.eta(), t2.eta()); + break; + case 113: + fRegistry.fill(HIST("Generated/sm/Rho/") + HIST(pair_sign_types[pairSignId]) + HIST("hs"), v12.M(), v12.Pt(), v12.Rapidity(), cosThetaCS, phiCS, quadmomCS, cosThetaHX, phiHX, quadmomHX, t1.pt(), t2.pt(), t1.eta(), t2.eta()); + break; + case 223: + fRegistry.fill(HIST("Generated/sm/Omega/") + HIST(pair_sign_types[pairSignId]) + HIST("hs"), v12.M(), v12.Pt(), v12.Rapidity(), cosThetaCS, phiCS, quadmomCS, cosThetaHX, phiHX, quadmomHX, t1.pt(), t2.pt(), t1.eta(), t2.eta()); + if (nd == 2) { + fRegistry.fill(HIST("Generated/sm/Omega2ll/") + HIST(pair_sign_types[pairSignId]) + HIST("hs"), v12.M(), v12.Pt(), v12.Rapidity(), cosThetaCS, phiCS, quadmomCS, cosThetaHX, phiHX, quadmomHX, t1.pt(), t2.pt(), t1.eta(), t2.eta()); + } + break; + case 333: + fRegistry.fill(HIST("Generated/sm/Phi/") + HIST(pair_sign_types[pairSignId]) + HIST("hs"), v12.M(), v12.Pt(), v12.Rapidity(), cosThetaCS, phiCS, quadmomCS, cosThetaHX, phiHX, quadmomHX, t1.pt(), t2.pt(), t1.eta(), t2.eta()); + if (nd == 2) { + fRegistry.fill(HIST("Generated/sm/Phi2ll/") + HIST(pair_sign_types[pairSignId]) + HIST("hs"), v12.M(), v12.Pt(), v12.Rapidity(), cosThetaCS, phiCS, quadmomCS, cosThetaHX, phiHX, quadmomHX, t1.pt(), t2.pt(), t1.eta(), t2.eta()); + } + break; + case 443: + if (IsFromBeauty(mcmother, mcParticles) > 0) { + fRegistry.fill(HIST("Generated/sm/NonPromptJPsi/") + HIST(pair_sign_types[pairSignId]) + HIST("hs"), v12.M(), v12.Pt(), v12.Rapidity(), cosThetaCS, phiCS, quadmomCS, cosThetaHX, phiHX, quadmomHX, t1.pt(), t2.pt(), t1.eta(), t2.eta()); + } else { + fRegistry.fill(HIST("Generated/sm/PromptJPsi/") + HIST(pair_sign_types[pairSignId]) + HIST("hs"), v12.M(), v12.Pt(), v12.Rapidity(), cosThetaCS, phiCS, quadmomCS, cosThetaHX, phiHX, quadmomHX, t1.pt(), t2.pt(), t1.eta(), t2.eta()); + } + break; + case 100443: + if (IsFromBeauty(mcmother, mcParticles) > 0) { + fRegistry.fill(HIST("Generated/sm/NonPromptPsi2S/") + HIST(pair_sign_types[pairSignId]) + HIST("hs"), v12.M(), v12.Pt(), v12.Rapidity(), cosThetaCS, phiCS, quadmomCS, cosThetaHX, phiHX, quadmomHX, t1.pt(), t2.pt(), t1.eta(), t2.eta()); + } else { + fRegistry.fill(HIST("Generated/sm/PromptPsi2S/") + HIST(pair_sign_types[pairSignId]) + HIST("hs"), v12.M(), v12.Pt(), v12.Rapidity(), cosThetaCS, phiCS, quadmomCS, cosThetaHX, phiHX, quadmomHX, t1.pt(), t2.pt(), t1.eta(), t2.eta()); + } + break; + case 553: + fRegistry.fill(HIST("Generated/sm/Upsilon1S/") + HIST(pair_sign_types[pairSignId]) + HIST("hs"), v12.M(), v12.Pt(), v12.Rapidity(), cosThetaCS, phiCS, quadmomCS, cosThetaHX, phiHX, quadmomHX, t1.pt(), t2.pt(), t1.eta(), t2.eta()); + break; + case 100553: + fRegistry.fill(HIST("Generated/sm/Upsilon2S/") + HIST(pair_sign_types[pairSignId]) + HIST("hs"), v12.M(), v12.Pt(), v12.Rapidity(), cosThetaCS, phiCS, quadmomCS, cosThetaHX, phiHX, quadmomHX, t1.pt(), t2.pt(), t1.eta(), t2.eta()); + break; + case 200553: + fRegistry.fill(HIST("Generated/sm/Upsilon3S/") + HIST(pair_sign_types[pairSignId]) + HIST("hs"), v12.M(), v12.Pt(), v12.Rapidity(), cosThetaCS, phiCS, quadmomCS, cosThetaHX, phiHX, quadmomHX, t1.pt(), t2.pt(), t1.eta(), t2.eta()); + break; + default: + break; + } + } else if (hfee_type > -1) { + switch (hfee_type) { + case static_cast(EM_HFeeType::kCe_Ce): + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/") + HIST(pair_sign_types[pairSignId]) + HIST("hs"), v12.M(), v12.Pt(), v12.Rapidity(), cosThetaCS, phiCS, quadmomCS, cosThetaHX, phiHX, quadmomHX, t1.pt(), t2.pt(), t1.eta(), t2.eta()); + break; + case static_cast(EM_HFeeType::kBe_Be): + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/") + HIST(pair_sign_types[pairSignId]) + HIST("hs"), v12.M(), v12.Pt(), v12.Rapidity(), cosThetaCS, phiCS, quadmomCS, cosThetaHX, phiHX, quadmomHX, t1.pt(), t2.pt(), t1.eta(), t2.eta()); + break; + case static_cast(EM_HFeeType::kBCe_BCe): + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2c2l/") + HIST(pair_sign_types[pairSignId]) + HIST("hs"), v12.M(), v12.Pt(), v12.Rapidity(), cosThetaCS, phiCS, quadmomCS, cosThetaHX, phiHX, quadmomHX, t1.pt(), t2.pt(), t1.eta(), t2.eta()); + break; + case static_cast(EM_HFeeType::kBCe_Be_SameB): + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/") + HIST(pair_sign_types[pairSignId]) + HIST("hs"), v12.M(), v12.Pt(), v12.Rapidity(), cosThetaCS, phiCS, quadmomCS, cosThetaHX, phiHX, quadmomHX, t1.pt(), t2.pt(), t1.eta(), t2.eta()); + break; + case static_cast(EM_HFeeType::kBCe_Be_DiffB): + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/") + HIST(pair_sign_types[pairSignId]) + HIST("hs"), v12.M(), v12.Pt(), v12.Rapidity(), cosThetaCS, phiCS, quadmomCS, cosThetaHX, phiHX, quadmomHX, t1.pt(), t2.pt(), t1.eta(), t2.eta()); + break; + default: + break; + } + } + } + + template + int FindSMULS(TTrack const& t1mc, TTrack const& t2mc, TMCParticles const& mcParticles) + { + int arr[] = { + FindCommonMotherFrom2Prongs(t1mc, t2mc, -cfgPdgLepton, cfgPdgLepton, 111, mcParticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -cfgPdgLepton, cfgPdgLepton, 221, mcParticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -cfgPdgLepton, cfgPdgLepton, 331, mcParticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -cfgPdgLepton, cfgPdgLepton, 113, mcParticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -cfgPdgLepton, cfgPdgLepton, 223, mcParticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -cfgPdgLepton, cfgPdgLepton, 333, mcParticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -cfgPdgLepton, cfgPdgLepton, 443, mcParticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -cfgPdgLepton, cfgPdgLepton, 100443, mcParticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -cfgPdgLepton, cfgPdgLepton, 553, mcParticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -cfgPdgLepton, cfgPdgLepton, 100553, mcParticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -cfgPdgLepton, cfgPdgLepton, 200553, mcParticles)}; + int size = sizeof(arr) / sizeof(*arr); + int max = *std::max_element(arr, arr + size); + return max; + } + + template + int FindSMLSPP(TTrack const& t1mc, TTrack const& t2mc, TMCParticles const& mcParticles) + { + int arr[] = { + FindCommonMotherFrom2Prongs(t1mc, t2mc, -cfgPdgLepton, -cfgPdgLepton, 221, mcParticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -cfgPdgLepton, -cfgPdgLepton, 331, mcParticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -cfgPdgLepton, -cfgPdgLepton, 113, mcParticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -cfgPdgLepton, -cfgPdgLepton, 223, mcParticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, -cfgPdgLepton, -cfgPdgLepton, 333, mcParticles)}; + int size = sizeof(arr) / sizeof(*arr); + int max = *std::max_element(arr, arr + size); + return max; + } + + template + int FindSMLSMM(TTrack const& t1mc, TTrack const& t2mc, TMCParticles const& mcParticles) + { + int arr[] = { + FindCommonMotherFrom2Prongs(t1mc, t2mc, cfgPdgLepton, cfgPdgLepton, 221, mcParticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, cfgPdgLepton, cfgPdgLepton, 331, mcParticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, cfgPdgLepton, cfgPdgLepton, 113, mcParticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, cfgPdgLepton, cfgPdgLepton, 223, mcParticles), + FindCommonMotherFrom2Prongs(t1mc, t2mc, cfgPdgLepton, cfgPdgLepton, 333, mcParticles)}; + int size = sizeof(arr) / sizeof(*arr); + int max = *std::max_element(arr, arr + size); + return max; + } + + SliceCache cache; + Preslice perMCCollision = o2::aod::mcparticle::mcCollisionId; + Partition posLeptons = o2::aod::mcparticle::pdgCode == -cfgPdgLepton; // l+ + Partition negLeptons = o2::aod::mcparticle::pdgCode == cfgPdgLepton; // l- + + void process(aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles, aod::BCsWithTimestamps const&) + { + for (const auto& mcCollision : mcCollisions) { + auto bc = mcCollision.template bc_as(); + initCCDB(bc); + + fRegistry.fill(HIST("Event/hCollisionCounter"), 0); + if (cfgEventGeneratorType >= 0 && mcCollision.getSubGeneratorId() != cfgEventGeneratorType) { + continue; + } + fRegistry.fill(HIST("Event/hCollisionCounter"), 1); + + auto posLeptons_per_coll = posLeptons->sliceByCached(o2::aod::mcparticle::mcCollisionId, mcCollision.globalIndex(), cache); + auto negLeptons_per_coll = negLeptons->sliceByCached(o2::aod::mcparticle::mcCollisionId, mcCollision.globalIndex(), cache); + // LOGF(info, "mcCollision.globalIndex() = %d, posLeptons_per_coll.size() = %d, negLeptons_per_coll.size() = %d", mcCollision.globalIndex(), posLeptons_per_coll.size(), negLeptons_per_coll.size()); + + for (const auto& [t1, t2] : combinations(CombinationsFullIndexPolicy(posLeptons_per_coll, negLeptons_per_coll))) { // ULS + if (!(t1.isPhysicalPrimary() || t1.producedByGenerator()) || !(t2.isPhysicalPrimary() || t2.producedByGenerator())) { + continue; + } + fillGenPairInfo<0>(t1, t2, mcParticles); + } // end of ULS pairing + + for (const auto& [t1, t2] : combinations(CombinationsStrictlyUpperIndexPolicy(posLeptons_per_coll, posLeptons_per_coll))) { // LS++ + if (!(t1.isPhysicalPrimary() || t1.producedByGenerator()) || !(t2.isPhysicalPrimary() || t2.producedByGenerator())) { + continue; + } + fillGenPairInfo<1>(t1, t2, mcParticles); + } // end of LS++ pairing + + for (const auto& [t1, t2] : combinations(CombinationsStrictlyUpperIndexPolicy(negLeptons_per_coll, negLeptons_per_coll))) { // LS-- + if (!(t1.isPhysicalPrimary() || t1.producedByGenerator()) || !(t2.isPhysicalPrimary() || t2.producedByGenerator())) { + continue; + } + fillGenPairInfo<2>(t1, t2, mcParticles); + } // end of LS++ pairing + + } // end of mc collision loop + } +}; +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"evaluate-acceptance"})}; +} diff --git a/PWGEM/Dilepton/Utils/MCUtilities.h b/PWGEM/Dilepton/Utils/MCUtilities.h index dd12d2576f2..27ee530e4f1 100644 --- a/PWGEM/Dilepton/Utils/MCUtilities.h +++ b/PWGEM/Dilepton/Utils/MCUtilities.h @@ -241,14 +241,14 @@ int IsFromBeauty(TMCParticle const& p, TMCParticles const& mcparticles) int motherid = p.mothersIds()[0]; // first mother index auto mp_tmp = mcparticles.iteratorAt(motherid); - if (abs(mp_tmp.pdgCode()) < 1e+9 && (std::to_string(abs(mp_tmp.pdgCode()))[std::to_string(abs(mp_tmp.pdgCode())).length() - 2] == '5' && std::to_string(abs(mp_tmp.pdgCode()))[std::to_string(abs(mp_tmp.pdgCode())).length() - 3] == '5') && abs(mp_tmp.pdgCode()) % 2 == 1) { + if (std::abs(mp_tmp.pdgCode()) < 1e+9 && (std::to_string(std::abs(mp_tmp.pdgCode()))[std::to_string(std::abs(mp_tmp.pdgCode())).length() - 2] == '5' && std::to_string(std::abs(mp_tmp.pdgCode()))[std::to_string(std::abs(mp_tmp.pdgCode())).length() - 3] == '5') && std::abs(mp_tmp.pdgCode()) % 2 == 1) { return -999; // reject bottomonia } while (motherid > -1) { if (motherid < mcparticles.size()) { // protect against bad mother indices. why is this needed? auto mp = mcparticles.iteratorAt(motherid); - if (abs(mp.pdgCode()) < 1e+9 && (std::to_string(abs(mp.pdgCode()))[std::to_string(abs(mp.pdgCode())).length() - 3] == '5' || std::to_string(abs(mp.pdgCode()))[std::to_string(abs(mp.pdgCode())).length() - 4] == '5')) { + if (std::abs(mp.pdgCode()) < 1e+9 && (std::to_string(std::abs(mp.pdgCode()))[std::to_string(std::abs(mp.pdgCode())).length() - 3] == '5' || std::to_string(std::abs(mp.pdgCode()))[std::to_string(std::abs(mp.pdgCode())).length() - 4] == '5')) { return motherid; } if (mp.has_mothers()) { @@ -274,13 +274,13 @@ int IsFromCharm(TMCParticle const& p, TMCParticles const& mcparticles) int motherid = p.mothersIds()[0]; // first mother index auto mp_tmp = mcparticles.iteratorAt(motherid); - if (abs(mp_tmp.pdgCode()) < 1e+9 && (std::to_string(abs(mp_tmp.pdgCode()))[std::to_string(abs(mp_tmp.pdgCode())).length() - 2] == '4' && std::to_string(abs(mp_tmp.pdgCode()))[std::to_string(abs(mp_tmp.pdgCode())).length() - 3] == '4') && abs(mp_tmp.pdgCode()) % 2 == 1) { + if (std::abs(mp_tmp.pdgCode()) < 1e+9 && (std::to_string(std::abs(mp_tmp.pdgCode()))[std::to_string(std::abs(mp_tmp.pdgCode())).length() - 2] == '4' && std::to_string(std::abs(mp_tmp.pdgCode()))[std::to_string(std::abs(mp_tmp.pdgCode())).length() - 3] == '4') && std::abs(mp_tmp.pdgCode()) % 2 == 1) { return -999; // reject bottomonia } while (motherid > -1) { if (motherid < mcparticles.size()) { // protect against bad mother indices. why is this needed? auto mp = mcparticles.iteratorAt(motherid); - if (abs(mp.pdgCode()) < 1e+9 && (std::to_string(abs(mp.pdgCode()))[std::to_string(abs(mp.pdgCode())).length() - 3] == '4' || std::to_string(abs(mp.pdgCode()))[std::to_string(abs(mp.pdgCode())).length() - 4] == '4')) { + if (std::abs(mp.pdgCode()) < 1e+9 && (std::to_string(std::abs(mp.pdgCode()))[std::to_string(std::abs(mp.pdgCode())).length() - 3] == '4' || std::to_string(std::abs(mp.pdgCode()))[std::to_string(std::abs(mp.pdgCode())).length() - 4] == '4')) { return motherid; } if (mp.has_mothers()) { @@ -395,8 +395,8 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp if (mid1 == mid2) { auto common_mp = mcparticles.iteratorAt(mid1); int mp_pdg = common_mp.pdgCode(); - bool is_mp_diquark = (1100 < abs(mp_pdg) && abs(mp_pdg) < 5600) && std::to_string(mp_pdg)[std::to_string(mp_pdg).length() - 2] == '0'; - if (!is_mp_diquark && abs(mp_pdg) < 1e+9 && (std::to_string(abs(mp_pdg))[std::to_string(abs(mp_pdg)).length() - 3] == '5' || std::to_string(abs(mp_pdg))[std::to_string(abs(mp_pdg)).length() - 4] == '5')) { + bool is_mp_diquark = (1100 < std::abs(mp_pdg) && std::abs(mp_pdg) < 5600) && std::to_string(mp_pdg)[std::to_string(mp_pdg).length() - 2] == '0'; + if (!is_mp_diquark && std::abs(mp_pdg) < 1e+9 && (std::to_string(std::abs(mp_pdg))[std::to_string(std::abs(mp_pdg)).length() - 3] == '5' || std::to_string(std::abs(mp_pdg))[std::to_string(std::abs(mp_pdg)).length() - 4] == '5')) { mothers_id1.clear(); mothers_pdg1.clear(); mothers_id2.clear(); @@ -417,8 +417,8 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp if (mid1 == mid2) { auto common_mp = mcparticles.iteratorAt(mid1); int mp_pdg = common_mp.pdgCode(); - bool is_mp_diquark = (1100 < abs(mp_pdg) && abs(mp_pdg) < 5600) && std::to_string(mp_pdg)[std::to_string(mp_pdg).length() - 2] == '0'; - if (!is_mp_diquark && abs(mp_pdg) < 1e+9 && (std::to_string(abs(mp_pdg))[std::to_string(abs(mp_pdg)).length() - 3] == '5' || std::to_string(abs(mp_pdg))[std::to_string(abs(mp_pdg)).length() - 4] == '5')) { + bool is_mp_diquark = (1100 < std::abs(mp_pdg) && std::abs(mp_pdg) < 5600) && std::to_string(mp_pdg)[std::to_string(mp_pdg).length() - 2] == '0'; + if (!is_mp_diquark && std::abs(mp_pdg) < 1e+9 && (std::to_string(std::abs(mp_pdg))[std::to_string(std::abs(mp_pdg)).length() - 3] == '5' || std::to_string(std::abs(mp_pdg))[std::to_string(std::abs(mp_pdg)).length() - 4] == '5')) { is_same_mother_found = true; } } @@ -466,7 +466,7 @@ int searchMothers(T& p, U& mcParticles, int pdg, bool equal) } else if (mothersids[1] < mothersids[0]) { allmothersids.push_back(mothersids[0]); allmothersids.push_back(mothersids[1]); - } else if ((80 < abs(o2::mcgenstatus::getGenStatusCode(p.statusCode())) && abs(o2::mcgenstatus::getGenStatusCode(p.statusCode())) < 90) || (100 < abs(o2::mcgenstatus::getGenStatusCode(p.statusCode())) && abs(o2::mcgenstatus::getGenStatusCode(p.statusCode())) < 110)) { // NOTE: THIS IS GENERATOR DEPENDENT AND WORKS ONLY FOR PYTHIA! + } else if ((80 < std::abs(o2::mcgenstatus::getGenStatusCode(p.statusCode())) && std::abs(o2::mcgenstatus::getGenStatusCode(p.statusCode())) < 90) || (100 < std::abs(o2::mcgenstatus::getGenStatusCode(p.statusCode())) && std::abs(o2::mcgenstatus::getGenStatusCode(p.statusCode())) < 110)) { // NOTE: THIS IS GENERATOR DEPENDENT AND WORKS ONLY FOR PYTHIA! for (int i = mothersids[0]; i <= mothersids[1]; i++) { allmothersids.push_back(i); } @@ -484,16 +484,16 @@ int searchMothers(T& p, U& mcParticles, int pdg, bool equal) for (int i : allmothersids) { auto mother = mcParticles.iteratorAt(i); int mpdg = mother.pdgCode(); - // if (abs(mpdg) == pdg && mpdg * p.pdgCode() > 0) { // check for quark - if (abs(mpdg) == pdg) { // check for quark to allow for beauty and charm + oscillation + // if (std::abs(mpdg) == pdg && mpdg * p.pdgCode() > 0) { // check for quark + if (std::abs(mpdg) == pdg) { // check for quark to allow for beauty and charm + oscillation if (quark_id > -1 || next_mother_id > -1) { // we already found a possible candidate in the list of mothers, so now we have (at least) two // LOG(warning) << "Flavour tracking is ambiguous. Stopping here."; return -1; } quark_id = i; - //} else if ((static_cast(abs(mpdg) / 100) == pdg || static_cast(abs(mpdg) / 1000) == pdg) && mpdg * p.pdgCode() > 0) { // check for other mothers with flavour content - } else if ((static_cast(abs(mpdg) / 100) == pdg || static_cast(abs(mpdg) / 1000) == pdg)) { // check for other mothers with flavour content to allow for beauty and charm - if (quark_id > -1 || next_mother_id > -1) { // we already found a possible candidate in the list of mothers, so now we have (at least) two + //} else if ((static_cast(std::abs(mpdg) / 100) == pdg || static_cast(std::abs(mpdg) / 1000) == pdg) && mpdg * p.pdgCode() > 0) { // check for other mothers with flavour content + } else if ((static_cast(std::abs(mpdg) / 100) == pdg || static_cast(std::abs(mpdg) / 1000) == pdg)) { // check for other mothers with flavour content to allow for beauty and charm + if (quark_id > -1 || next_mother_id > -1) { // we already found a possible candidate in the list of mothers, so now we have (at least) two // LOG(warning) << "Flavour tracking is ambiguous. Stopping here."; return -1; } @@ -555,7 +555,7 @@ bool checkFromSameQuarkPair(T& p1, T& p2, U& mcParticles, int pdg) template bool isCharmMeson(T const& track) { - if (400 < abs(track.pdgCode()) && abs(track.pdgCode()) < 500) { + if (400 < std::abs(track.pdgCode()) && std::abs(track.pdgCode()) < 500) { return true; } else { return false; @@ -565,7 +565,7 @@ bool isCharmMeson(T const& track) template bool isCharmBaryon(T const& track) { - if (4000 < abs(track.pdgCode()) && abs(track.pdgCode()) < 5000) { + if (4000 < std::abs(track.pdgCode()) && std::abs(track.pdgCode()) < 5000) { return true; } else { return false; @@ -575,7 +575,7 @@ bool isCharmBaryon(T const& track) template bool isBeautyMeson(T const& track) { - if (500 < abs(track.pdgCode()) && abs(track.pdgCode()) < 600) { + if (500 < std::abs(track.pdgCode()) && std::abs(track.pdgCode()) < 600) { return true; } else { return false; @@ -585,7 +585,7 @@ bool isBeautyMeson(T const& track) template bool isBeautyBaryon(T const& track) { - if (5000 < abs(track.pdgCode()) && abs(track.pdgCode()) < 6000) { + if (5000 < std::abs(track.pdgCode()) && std::abs(track.pdgCode()) < 6000) { return true; } else { return false; From c3c09d51ad48068d88bdc09e55c1fb092c53a239 Mon Sep 17 00:00:00 2001 From: Giovanni Malfattore <89481844+giovannimalfattore@users.noreply.github.com> Date: Wed, 22 Oct 2025 07:16:07 +0200 Subject: [PATCH 846/986] [PWGLF] NucleiTask - Fix bugged hosts (#13474) --- PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx | 131 +++++++++++++++++++++----- 1 file changed, 106 insertions(+), 25 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx b/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx index ea70aa8a468..5ae66462a96 100644 --- a/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx +++ b/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx @@ -330,17 +330,29 @@ struct LFNucleiBATask { LOG(fatal) << "Can't enable processData and processMCReco in the same time, pick one!"; } if (doprocessEvSgLossMC) { - evLossHistos.add("evLoss/hEvent", "Event loss histograms; ; counts", HistType::kTH1F, {{3, 0., 3.}}); + evLossHistos.add("evLoss/hEvent", "Event loss histograms; ; counts", HistType::kTH1F, {{4, 0., 4.}}); evLossHistos.get(HIST("evLoss/hEvent"))->GetXaxis()->SetBinLabel(1, "All Gen."); evLossHistos.get(HIST("evLoss/hEvent"))->GetXaxis()->SetBinLabel(2, "TVX (reco.)"); - evLossHistos.get(HIST("evLoss/hEvent"))->GetXaxis()->SetBinLabel(3, "Sel8 (reco.)"); + evLossHistos.get(HIST("evLoss/hEvent"))->GetXaxis()->SetBinLabel(3, "MC Sel8 (TVX + NoTFB) (reco.)"); + evLossHistos.get(HIST("evLoss/hEvent"))->GetXaxis()->SetBinLabel(4, "Sel8 (reco.)"); evLossHistos.add("evLoss/pt/hDeuteronTriggeredTVX", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{100, 0., 5.}}); evLossHistos.add("evLoss/pt/hDeuteronTriggeredSel8", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{100, 0., 5.}}); + evLossHistos.add("evLoss/pt/hDeuteronTriggeredMCSel8", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{100, 0., 5.}}); evLossHistos.add("evLoss/pt/hDeuteronGen", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{100, 0., 5.}}); evLossHistos.add("evLoss/pt/hAntiDeuteronTriggeredTVX", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{100, 0., 5.}}); + evLossHistos.add("evLoss/pt/hAntiDeuteronTriggeredMCSel8", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{100, 0., 5.}}); evLossHistos.add("evLoss/pt/hAntiDeuteronTriggeredSel8", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{100, 0., 5.}}); evLossHistos.add("evLoss/pt/hAntiDeuteronGen", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{100, 0., 5.}}); + + evLossHistos.add("evLoss/pt/hHeliumTriggeredTVX", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{100, 0., 5.}}); + evLossHistos.add("evLoss/pt/hHeliumTriggeredSel8", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{100, 0., 5.}}); + evLossHistos.add("evLoss/pt/hHeliumTriggeredMCSel8", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{100, 0., 5.}}); + evLossHistos.add("evLoss/pt/hHeliumGen", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{100, 0., 5.}}); + evLossHistos.add("evLoss/pt/hAntiHeliumTriggeredTVX", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{100, 0., 5.}}); + evLossHistos.add("evLoss/pt/hAntiHeliumTriggeredSel8", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{100, 0., 5.}}); + evLossHistos.add("evLoss/pt/hAntiHeliumTriggeredMCSel8", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{100, 0., 5.}}); + evLossHistos.add("evLoss/pt/hAntiHeliumGen", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{100, 0., 5.}}); } if (doprocessMCRecoLfPidEv) { spectraGen.add("LfEv/pT_nocut", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); @@ -356,7 +368,13 @@ struct LFNucleiBATask { spectraGen.add("LfEv/helium/pT_ITSROFBorder_He", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); spectraGen.add("LfEv/helium/pT_sel8_He", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); spectraGen.add("LfEv/helium/pT_MCsel8_He", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); - spectraGen.add("LfEv/helium/pT_MCsel8_HePrim", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + + spectraGen.add("LfEv/helium/prim/pT_nocut_He", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/helium/prim/pT_TVXtrigger_He", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/helium/prim/pT_TFrameBorder_He", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/helium/prim/pT_ITSROFBorder_He", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/helium/prim/pT_sel8_He", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/helium/prim/pT_MCsel8_He", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); spectraGen.add("LfEv/helium/pT_nocut_antiHe", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); spectraGen.add("LfEv/helium/pT_TVXtrigger_antiHe", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); @@ -364,7 +382,13 @@ struct LFNucleiBATask { spectraGen.add("LfEv/helium/pT_ITSROFBorder_antiHe", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); spectraGen.add("LfEv/helium/pT_sel8_antiHe", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); spectraGen.add("LfEv/helium/pT_MCsel8_antiHe", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); - spectraGen.add("LfEv/helium/pT_MCsel8_antiHePrim", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + + spectraGen.add("LfEv/helium/prim/pT_nocut_antiHe", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/helium/prim/pT_TVXtrigger_antiHe", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/helium/prim/pT_TFrameBorder_antiHe", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/helium/prim/pT_ITSROFBorder_antiHe", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/helium/prim/pT_sel8_antiHe", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); + spectraGen.add("LfEv/helium/prim/pT_MCsel8_antiHe", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{ptHeAxis}}); } if (enableDebug) { @@ -419,7 +443,7 @@ struct LFNucleiBATask { } if (enableCentrality) - histos.add("event/h1VtxZ", "V_{z};V_{z} (in cm); counts", HistType::kTH1F, {{1500, -15, 15}, {binsPercentile, "Centrality FT0M"}}); + histos.add("event/h1VtxZ", "V_{z};V_{z} (in cm); counts", HistType::kTH2F, {{1500, -15, 15}, {binsPercentile, "Centrality FT0M"}}); else histos.add("event/h1VtxZ", "V_{z};V_{z} (in cm); counts", HistType::kTH1F, {{1500, -15, 15}}); @@ -2162,14 +2186,14 @@ struct LFNucleiBATask { spectraGen.add("helium/histGenPtHe", "generated particles", HistType::kTH1F, {ptHeAxis}); spectraGen.add("helium/histGenPtHePrim", "generated particles", HistType::kTH1F, {ptHeAxis}); if (enableCentrality) - spectraGen.add("helium/histGenPtHePrim", "generated particles", HistType::kTH2F, {{ptHeAxis}, {binsPercentile}}); + spectraGen.add("helium/histGenPtHePrimVsMult", "generated particles", HistType::kTH2F, {{ptHeAxis}, {binsPercentile}}); spectraGen.add("helium/histGenPtHeSec", "generated particles", HistType::kTH1F, {ptHeAxis}); spectraGen.add("helium/histSecTransportPtHe", "generated particles", HistType::kTH1F, {ptHeAxis}); spectraGen.add("helium/histGenPtantiHe", "generated particles", HistType::kTH1F, {ptHeAxis}); spectraGen.add("helium/histGenPtantiHePrim", "generated particles", HistType::kTH1F, {ptHeAxis}); if (enableCentrality) - spectraGen.add("helium/histGenPtantiHePrim", "generated particles", HistType::kTH2F, {{ptHeAxis}, {binsPercentile}}); + spectraGen.add("helium/histGenPtantiHePrimVsMult", "generated particles", HistType::kTH2F, {{ptHeAxis}, {binsPercentile}}); spectraGen.add("helium/histGenPtantiHeSec", "generated particles", HistType::kTH1F, {ptHeAxis}); spectraGen.add("helium/histSecTransportPtantiHe", "generated particles", HistType::kTH1F, {ptHeAxis}); } @@ -5752,7 +5776,7 @@ struct LFNucleiBATask { if (isWeakDecay) { histos.fill(HIST("tracks/helium/h1HeliumSpectraTrueSec_Z2"), 2 * hePt); if (enableCentrality) - histos.fill(HIST("tracks/helium/h1HeliumSpectraTrueSecVsMult_Z2"), 2 * hePt); + histos.fill(HIST("tracks/helium/h2HeliumSpectraTrueSecVsMult_Z2"), 2 * hePt, event.centFT0M()); if (outFlagOptions.makeDCAAfterCutPlots) { histos.fill(HIST("tracks/helium/dca/after/hDCAxyVsPtHeliumTrueSec"), hePt, track.dcaXY()); histos.fill(HIST("tracks/helium/dca/after/hDCAzVsPtHeliumTrueSec"), hePt, track.dcaZ()); @@ -6042,33 +6066,57 @@ struct LFNucleiBATask { // No cut spectraGen.fill(HIST("LfEv/pT_nocut"), pt); - if (pdg == PDGHelium) + if (pdg == PDGHelium) { spectraGen.fill(HIST("LfEv/helium/pT_nocut_He"), pt); - if (pdg == -PDGHelium) + if (isPhysPrim) + spectraGen.fill(HIST("LfEv/helium/prim/pT_nocut_He"), pt); + } + if (pdg == -PDGHelium) { spectraGen.fill(HIST("LfEv/helium/pT_nocut_antiHe"), pt); + if (isPhysPrim) + spectraGen.fill(HIST("LfEv/helium/prim/pT_nocut_antiHe"), pt); + } // Trigger TVX if (hasTVX) { spectraGen.fill(HIST("LfEv/pT_TVXtrigger"), pt); - if (pdg == PDGHelium) + if (pdg == PDGHelium) { spectraGen.fill(HIST("LfEv/helium/pT_TVXtrigger_He"), pt); - if (pdg == -PDGHelium) + if (isPhysPrim) + spectraGen.fill(HIST("LfEv/helium/prim/pT_TVXtrigger_He"), pt); + } + if (pdg == -PDGHelium) { spectraGen.fill(HIST("LfEv/helium/pT_TVXtrigger_antiHe"), pt); + if (isPhysPrim) + spectraGen.fill(HIST("LfEv/helium/prim/pT_TVXtrigger_antiHe"), pt); + } } // No Time Frame Border if (hasNoTFB) { spectraGen.fill(HIST("LfEv/pT_TFrameBorder"), pt); - if (pdg == PDGHelium) + if (pdg == PDGHelium) { spectraGen.fill(HIST("LfEv/helium/pT_TFrameBorder_He"), pt); - if (pdg == -PDGHelium) + if (isPhysPrim) + spectraGen.fill(HIST("LfEv/helium/prim/pT_TFrameBorder_He"), pt); + } + if (pdg == -PDGHelium) { spectraGen.fill(HIST("LfEv/helium/pT_TFrameBorder_antiHe"), pt); + if (isPhysPrim) + spectraGen.fill(HIST("LfEv/helium/prim/pT_TFrameBorder_antiHe"), pt); + } } // No ITS ROF Frame Border if (hasNoItsRofFB) { spectraGen.fill(HIST("LfEv/pT_ITSROFBorder"), pt); - if (pdg == PDGHelium) + if (pdg == PDGHelium) { spectraGen.fill(HIST("LfEv/helium/pT_ITSROFBorder_He"), pt); - if (pdg == -PDGHelium) + if (isPhysPrim) + spectraGen.fill(HIST("LfEv/helium/prim/pT_ITSROFBorder_He"), pt); + } + if (pdg == -PDGHelium) { spectraGen.fill(HIST("LfEv/helium/pT_ITSROFBorder_antiHe"), pt); + if (isPhysPrim) + spectraGen.fill(HIST("LfEv/helium/prim/pT_ITSROFBorder_antiHe"), pt); + } } // Sel8 MC if (hasTVX && hasNoTFB) { @@ -6076,12 +6124,12 @@ struct LFNucleiBATask { if (pdg == PDGHelium) { spectraGen.fill(HIST("LfEv/helium/pT_MCsel8_He"), pt); if (isPhysPrim) - spectraGen.fill(HIST("LfEv/helium/pT_MCsel8_HePrim"), pt); + spectraGen.fill(HIST("LfEv/helium/prim/pT_MCsel8_He"), pt); } if (pdg == -PDGHelium) { spectraGen.fill(HIST("LfEv/helium/pT_MCsel8_antiHe"), pt); if (isPhysPrim) - spectraGen.fill(HIST("LfEv/helium/pT_MCsel8_antiHePrim"), pt); + spectraGen.fill(HIST("LfEv/helium/prim/pT_MCsel8_antiHe"), pt); } } // Sel8 tag @@ -6089,8 +6137,12 @@ struct LFNucleiBATask { spectraGen.fill(HIST("LfEv/pT_sel8"), pt); if (pdg == PDGHelium) spectraGen.fill(HIST("LfEv/helium/pT_sel8_He"), pt); + if (isPhysPrim) + spectraGen.fill(HIST("LfEv/helium/prim/pT_sel8_He"), pt); if (pdg == -PDGHelium) spectraGen.fill(HIST("LfEv/helium/pT_sel8_antiHe"), pt); + if (isPhysPrim) + spectraGen.fill(HIST("LfEv/helium/prim/pT_sel8_antiHe"), pt); } } } @@ -6304,10 +6356,9 @@ struct LFNucleiBATask { if (pdgCode == PDGHelium) { spectraGen.fill(HIST("helium/histGenPtHe"), ptMC); if (isPhysPrim) { + spectraGen.fill(HIST("helium/histGenPtHePrim"), ptMC); if (enableCentrality) - spectraGen.fill(HIST("helium/histGenPtHePrim"), ptMC, mcCollision.centFT0M()); - else - spectraGen.fill(HIST("helium/histGenPtHePrim"), ptMC); + spectraGen.fill(HIST("helium/histGenPtHePrimVsMult"), ptMC, mcCollision.centFT0M()); } if (!isPhysPrim && isProdByGen) { { @@ -6324,10 +6375,9 @@ struct LFNucleiBATask { if (pdgCode == -PDGHelium) { spectraGen.fill(HIST("helium/histGenPtantiHe"), ptMC); if (isPhysPrim) { + spectraGen.fill(HIST("helium/histGenPtantiHePrim"), ptMC); if (enableCentrality) - spectraGen.fill(HIST("helium/histGenPtantiHePrim"), ptMC, mcCollision.centFT0M()); - else - spectraGen.fill(HIST("helium/histGenPtantiHePrim"), ptMC); + spectraGen.fill(HIST("helium/histGenPtantiHePrimVsMult"), ptMC, mcCollision.centFT0M()); } if (!isPhysPrim && isProdByGen) { { @@ -6385,6 +6435,8 @@ struct LFNucleiBATask { bool isSel8Event = false; bool isTvxEvent = false; + bool isNoTFBEvent = false; + bool isMCSel8Event = false; // Check if there is an event reconstructed for a generated event for (const auto& recoColl : recoColls) { @@ -6394,14 +6446,21 @@ struct LFNucleiBATask { isTvxEvent = true; if (recoColl.sel8()) isSel8Event = true; - if (isTvxEvent && isSel8Event) + if (recoColl.selection_bit(aod::evsel::kNoTimeFrameBorder)) + isNoTFBEvent = true; + if (isTvxEvent && isSel8Event && isNoTFBEvent) break; // Optimize loop } + if (isTvxEvent && isNoTFBEvent) + isMCSel8Event = true; + if (isTvxEvent) evLossHistos.fill(HIST("evLoss/hEvent"), 1.5); if (isSel8Event) evLossHistos.fill(HIST("evLoss/hEvent"), 2.5); + if (isMCSel8Event) + evLossHistos.fill(HIST("evLoss/hEvent"), 3.5); // Loop over all the Generated level particles for (const auto& mcPart : mcParticles) { @@ -6419,6 +6478,8 @@ struct LFNucleiBATask { evLossHistos.fill(HIST("evLoss/pt/hDeuteronTriggeredTVX"), pt); if (isSel8Event) evLossHistos.fill(HIST("evLoss/pt/hDeuteronTriggeredSel8"), pt); + if (isMCSel8Event) + evLossHistos.fill(HIST("evLoss/pt/hDeuteronTriggeredMCSel8"), pt); } if (pdg == -PDGDeuteron) { evLossHistos.fill(HIST("evLoss/pt/hAntiDeuteronGen"), pt); @@ -6426,6 +6487,26 @@ struct LFNucleiBATask { evLossHistos.fill(HIST("evLoss/pt/hAntiDeuteronTriggeredTVX"), pt); if (isSel8Event) evLossHistos.fill(HIST("evLoss/pt/hAntiDeuteronTriggeredSel8"), pt); + if (isMCSel8Event) + evLossHistos.fill(HIST("evLoss/pt/hAntiDeuteronTriggeredMCSel8"), pt); + } + if (pdg == PDGHelium) { + evLossHistos.fill(HIST("evLoss/pt/hHeliumGen"), pt); + if (isTvxEvent) + evLossHistos.fill(HIST("evLoss/pt/hHeliumTriggeredTVX"), pt); + if (isSel8Event) + evLossHistos.fill(HIST("evLoss/pt/hHeliumTriggeredSel8"), pt); + if (isMCSel8Event) + evLossHistos.fill(HIST("evLoss/pt/hHeliumTriggeredMCSel8"), pt); + } + if (pdg == -PDGHelium) { + evLossHistos.fill(HIST("evLoss/pt/hAntiHeliumGen"), pt); + if (isTvxEvent) + evLossHistos.fill(HIST("evLoss/pt/hAntiHeliumTriggeredTVX"), pt); + if (isSel8Event) + evLossHistos.fill(HIST("evLoss/pt/hAntiHeliumTriggeredSel8"), pt); + if (isMCSel8Event) + evLossHistos.fill(HIST("evLoss/pt/hAntiHeliumTriggeredMCSel8"), pt); } } } From 188fee8667da9188887829b7a2d42e48c067680f Mon Sep 17 00:00:00 2001 From: blacwovie Date: Wed, 22 Oct 2025 14:59:26 +0800 Subject: [PATCH 847/986] [PWGCF] add mT axis configurable (#13480) --- PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx b/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx index c4edea3721e..3c8e49e671f 100644 --- a/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx +++ b/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx @@ -222,6 +222,7 @@ struct PiNucleiFemto { // binning for EM background ConfigurableAxis axisVertex{"axisVertex", {30, -10, 10}, "Binning for vtxz"}; ConfigurableAxis axisCentrality{"axisCentrality", {40, 0, 100}, "Binning for centrality"}; + ConfigurableAxis axisTransMass{"axisTransMass", {1000, 0.2, 3.2}, "Binning for mT"}; using BinningType = ColumnBinningPolicy; BinningType binningPolicy{{axisVertex, axisCentrality}, true}; SliceCache cache; @@ -282,10 +283,10 @@ struct PiNucleiFemto { {"h2NsigmaPiTOF", "NsigmaPi TOF distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}(p)", {HistType::kTH2F, {{200, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}}}, {"h2NsigmaNuTOF", "NsigmaNu TOF distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}(Nu)", {HistType::kTH2F, {{200, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}}}, {"h2NsigmaPiTOF_preselection", "NsigmaPi TOF distribution; #iit{p}_{T} (GeV/#it{c}); n#sigma_{TOF}(p)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {400, -10.0f, 10.0f}}}}, - {"hkStaVsmTVsCent_LS_M", ";kStar (GeV/c);mT (GeV/#it{c}^{2});Centrality", {HistType::kTH3F, {{300, 0.0f, 3.0f}, {100, 0.2f, 3.2f}, {100, 0.0f, 100.0f}}}}, - {"hkStaVsmTVsCent_LS_A", ";kStar (GeV/c);mT (GeV/#it{c}^{2});Centrality", {HistType::kTH3F, {{300, 0.0f, 3.0f}, {100, 0.2f, 3.2f}, {100, 0.0f, 100.0f}}}}, - {"hkStaVsmTVsCent_US_M", ";kStar (GeV/c);mT (GeV/#it{c}^{2});Centrality", {HistType::kTH3F, {{300, 0.0f, 3.0f}, {100, 0.2f, 3.2f}, {100, 0.0f, 100.0f}}}}, - {"hkStaVsmTVsCent_US_A", ";kStar (GeV/c);mT (GeV/#it{c}^{2});Centrality", {HistType::kTH3F, {{300, 0.0f, 3.0f}, {100, 0.2f, 3.2f}, {100, 0.0f, 100.0f}}}}, + {"hkStaVsmTVsCent_LS_M", ";kStar (GeV/c);mT (GeV/#it{c}^{2});Centrality", {HistType::kTH3F, {{300, 0.0f, 3.0f}, {axisTransMass}, {100, 0.0f, 100.0f}}}}, + {"hkStaVsmTVsCent_LS_A", ";kStar (GeV/c);mT (GeV/#it{c}^{2});Centrality", {HistType::kTH3F, {{300, 0.0f, 3.0f}, {axisTransMass}, {100, 0.0f, 100.0f}}}}, + {"hkStaVsmTVsCent_US_M", ";kStar (GeV/c);mT (GeV/#it{c}^{2});Centrality", {HistType::kTH3F, {{300, 0.0f, 3.0f}, {axisTransMass}, {100, 0.0f, 100.0f}}}}, + {"hkStaVsmTVsCent_US_A", ";kStar (GeV/c);mT (GeV/#it{c}^{2});Centrality", {HistType::kTH3F, {{300, 0.0f, 3.0f}, {axisTransMass}, {100, 0.0f, 100.0f}}}}, {"hCollIDVsCentEachPion", ";CollisionID;Centrality", {HistType::kTH2F, {{4000, 0.0f, 4000.0f}, {100, 0.0f, 100.0f}}}}, {"hCollIDVsCentEachDe", ";CollisionID;Centrality", {HistType::kTH2F, {{4000, 0.0f, 4000.0f}, {100, 0.0f, 100.0f}}}}, {"hNHypsPerPrevColl", "Number of V0Hypers in previous collision used for mixing;N_{V0Hypers};Entries", {HistType::kTH2F, {{4000, 0.0f, 4000.0f}, {50, -0.5, 49.5}}}}, From 32f204fd19d63235f6259760dfb7cbfffed8309a Mon Sep 17 00:00:00 2001 From: Giorgio Alberto Lucia <87222843+GiorgioAlbertoLucia@users.noreply.github.com> Date: Wed, 22 Oct 2025 09:26:55 +0200 Subject: [PATCH 848/986] [PWGLF] added configurable to select physical primaries, tracks are now required to have an associated mc particle (#13465) Co-authored-by: ALICE Action Bot --- PWGLF/TableProducer/QC/nucleiQC.cxx | 88 +++++++++++++++-------------- 1 file changed, 45 insertions(+), 43 deletions(-) diff --git a/PWGLF/TableProducer/QC/nucleiQC.cxx b/PWGLF/TableProducer/QC/nucleiQC.cxx index 398d57de0ec..acb0ef32834 100644 --- a/PWGLF/TableProducer/QC/nucleiQC.cxx +++ b/PWGLF/TableProducer/QC/nucleiQC.cxx @@ -76,6 +76,7 @@ struct nucleiQC { Configurable cfgFillTable{"cfgFillTable", true, "Fill output tree"}; Configurable cfgDoCheckPdgCode{"cfgDoCheckPdgCode", true, "Should you only select tracks associated to a mc particle with the correct PDG code?"}; + Configurable cfgFillOnlyPhysicalPrimaries{"cfgFillOnlyPhysicalPrimaries", true, "Should you only select physical primary particles?"}; Configurable> cfgSpeciesToProcess{"cfgSpeciesToProcess", {nuclei::speciesToProcessDefault[0], nuclei::Species::kNspecies, 1, nuclei::names, {"processNucleus"}}, "Nuclei to process"}; Configurable> cfgEventSelections{"cfgEventSelections", {nuclei::EvSelDefault[0], 8, 1, nuclei::eventSelectionLabels, nuclei::eventSelectionTitle}, "Event selections"}; Configurable cfgCentralityEstimator{"cfgCentralityEstimator", 0, "Centrality estimator (FV0A: 0, FT0M: 1, FT0A: 2, FT0C: 3)"}; @@ -136,18 +137,16 @@ struct nucleiQC { } for (int iSpecies = 0; iSpecies < static_cast(nuclei::Species::kNspecies); iSpecies++) { - if (cfgSpeciesToProcess->get(iSpecies) == 1) { + if (cfgSpeciesToProcess->get(iSpecies) == 1) mSpeciesToProcess.emplace_back(iSpecies); - } } static_for<0, nuclei::kNspecies - 1>([&](auto iSpecies) { constexpr int kSpeciesCt = decltype(iSpecies)::value; const int kSpeciesRt = kSpeciesCt; - if (std::find(mSpeciesToProcess.begin(), mSpeciesToProcess.end(), kSpeciesCt) == mSpeciesToProcess.end()) { + if (std::find(mSpeciesToProcess.begin(), mSpeciesToProcess.end(), kSpeciesCt) == mSpeciesToProcess.end()) return; - } float tpcBetheBlochParams[6]; for (int iParam = 0; iParam < 6; iParam++) { @@ -166,9 +165,9 @@ struct nucleiQC { void initCCDB(const aod::BCsWithTimestamps::iterator& bc) { - if (mRunNumber == bc.runNumber()) { + if (mRunNumber == bc.runNumber()) return; - } + auto timestamp = bc.timestamp(); mRunNumber = bc.runNumber(); @@ -199,9 +198,8 @@ struct nucleiQC { bool pidSelection(const Ttrack& track, const Tcollision& collision) { constexpr int kIndex = iSpecies; - if (!nuclei::checkSpeciesValidity(kIndex)) { + if (!nuclei::checkSpeciesValidity(kIndex)) std::runtime_error("species contains invalid nucleus kIndex"); - } float centrality = nuclei::getCentrality(collision, cfgCentralityEstimator); float nsigmaTPC = mPidManagers[kIndex].getNSigmaTPC(track); @@ -266,15 +264,14 @@ struct nucleiQC { : iSpecies == nuclei::Species::kAl ? nuclei::Flags::kHe4 : 0; - if (track.hasTOF()) { + if (track.hasTOF()) candidate.flags |= nuclei::Flags::kHasTOF; - } - if (track.hasTRD()) { + + if (track.hasTRD()) candidate.flags |= nuclei::Flags::kHasTRD; - } - if (!collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + + if (!collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) candidate.flags |= nuclei::Flags::kITSrof; - } } template @@ -304,9 +301,9 @@ struct nucleiQC { template nuclei::SlimCandidate fillCandidate(const int iSpecies, Tcollision const& collision, Ttrack const& track) { - if (!nuclei::checkSpeciesValidity(iSpecies)) { + if (!nuclei::checkSpeciesValidity(iSpecies)) std::runtime_error("species contains invalid nucleus index"); - } + nuclei::SlimCandidate candidate = {.pt = track.pt() * track.sign(), .eta = track.eta(), .phi = track.phi(), @@ -336,7 +333,6 @@ struct nucleiQC { } } - mNucleiCandidates.emplace_back(candidate); return candidate; } @@ -363,9 +359,8 @@ struct nucleiQC { void fillHistograms(const nuclei::SlimCandidate& candidate) { constexpr int kIndex = iSpecies; - if (!nuclei::checkSpeciesValidity(kIndex)) { + if (!nuclei::checkSpeciesValidity(kIndex)) std::runtime_error("species contains invalid nucleus kIndex"); - } if (isGenerated) { const float ptGenerated = (kIndex == nuclei::Species::kPr || kIndex == nuclei::Species::kDe || kIndex == nuclei::Species::kTr) ? candidate.ptGenerated : candidate.ptGenerated / 2.f; @@ -392,9 +387,8 @@ struct nucleiQC { auto bc = collision.template bc_as(); initCCDB(bc); - if (!nuclei::eventSelection(collision, mHistograms, cfgEventSelections, cfgCutVertex)) { + if (!nuclei::eventSelection(collision, mHistograms, cfgEventSelections, cfgCutVertex)) return; - } for (const auto& track : tracks) { @@ -402,21 +396,29 @@ struct nucleiQC { constexpr int kSpeciesCt = decltype(iSpecies)::value; const int kSpeciesRt = kSpeciesCt; - if (std::find(mSpeciesToProcess.begin(), mSpeciesToProcess.end(), kSpeciesRt) == mSpeciesToProcess.end()) { + if (std::find(mSpeciesToProcess.begin(), mSpeciesToProcess.end(), kSpeciesRt) == mSpeciesToProcess.end()) + return; + + if (!track.has_mcParticle()) return; - } - if (track.has_mcParticle()) { - const auto& particle = track.mcParticle(); - if (cfgDoCheckPdgCode) { - if (std::abs(particle.pdgCode()) != nuclei::pdgCodes[kSpeciesRt]) - return; - } - if ((particle.y() - cfgRapidityCenterMass) < cfgRapidityMin || (particle.y() - cfgRapidityCenterMass) > cfgRapidityMax) { + const auto& particle = track.mcParticle(); + if (cfgDoCheckPdgCode) { + if (std::abs(particle.pdgCode()) != nuclei::pdgCodes[kSpeciesRt]) return; - } } + if ((particle.y() - cfgRapidityCenterMass) < cfgRapidityMin || (particle.y() - cfgRapidityCenterMass) > cfgRapidityMax) + return; + + if (cfgFillOnlyPhysicalPrimaries && !particle.isPhysicalPrimary()) + return; + + nuclei::SlimCandidate candidate; + candidate = fillCandidate(kSpeciesCt, collision, track); + if ((candidate.flags >> 10) & 0b1) + LOG(info) << "track from material before track selection"; + mHistograms.fill(HIST(nuclei::cNames[kSpeciesCt]) + HIST("/hTrackSelections"), nuclei::trackSelection::kNoCuts); if (!trackSelection(track)) return; @@ -426,14 +428,11 @@ struct nucleiQC { return; mHistograms.fill(HIST(nuclei::cNames[kSpeciesCt]) + HIST("/hTrackSelections"), nuclei::trackSelection::kPidCuts); - nuclei::SlimCandidate candidate; - if (track.has_mcParticle()) { - candidate = fillCandidate(kSpeciesCt, collision, track); - dispatchFillHistograms(kSpeciesRt, candidate); - } else { - candidate = fillCandidate(kSpeciesCt, collision, track); - } + // nuclei::SlimCandidate candidate; + // candidate = fillCandidate(kSpeciesCt, collision, track); + mNucleiCandidates.emplace_back(candidate); + dispatchFillHistograms(kSpeciesRt, candidate); dispatchFillHistograms(kSpeciesRt, candidate); }); } @@ -441,20 +440,23 @@ struct nucleiQC { const int mcCollisionId = collision.mcCollisionId(); auto mcParticlesThisCollision = mcParticles.sliceBy(mMcParticlesPerCollision, mcCollisionId); mcParticlesThisCollision.bindExternalIndices(&mcParticles); + for (const auto& particle : mcParticlesThisCollision) { - if (std::find(mFilledMcParticleIds.begin(), mFilledMcParticleIds.end(), particle.globalIndex()) != mFilledMcParticleIds.end()) { + if (std::find(mFilledMcParticleIds.begin(), mFilledMcParticleIds.end(), particle.globalIndex()) != mFilledMcParticleIds.end()) continue; - } + + if (cfgFillOnlyPhysicalPrimaries && !particle.isPhysicalPrimary()) + continue; + int iSpecies = nuclei::getSpeciesFromPdg(particle.pdgCode()); - if (std::find(mSpeciesToProcess.begin(), mSpeciesToProcess.end(), iSpecies) == mSpeciesToProcess.end()) { + if (std::find(mSpeciesToProcess.begin(), mSpeciesToProcess.end(), iSpecies) == mSpeciesToProcess.end()) continue; - } nuclei::SlimCandidate candidate; fillNucleusFlagsPdgsMc(particle, candidate); fillNucleusGeneratedVariables(particle, candidate); - mNucleiCandidates.emplace_back(candidate); + mNucleiCandidates.emplace_back(candidate); dispatchFillHistograms(iSpecies, candidate); } From ef7cc047ccc7a18ee948084b41dc01f6537aeed4 Mon Sep 17 00:00:00 2001 From: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Date: Wed, 22 Oct 2025 10:07:05 +0200 Subject: [PATCH 849/986] [PWGCF] add PID selection (#13481) --- .../Tasks/longRangeDihadronCor.cxx | 115 +++++++++++++++++- 1 file changed, 114 insertions(+), 1 deletion(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx b/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx index 1e2536baa0f..0ae9435b40c 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx @@ -29,6 +29,7 @@ #include "Common/DataModel/FT0Corrected.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseITS.h" #include "Common/DataModel/TrackSelectionTables.h" #include "CommonConstants/MathConstants.h" @@ -44,6 +45,8 @@ #include "Framework/RunningWorkflowInfo.h" #include "Framework/StepTHn.h" #include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/PID.h" +#include "ReconstructionDataFormats/Track.h" #include #include "TF1.h" @@ -59,9 +62,12 @@ using namespace o2::framework::expressions; // define the filtered collisions and tracks #define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; +// template for labelled array +static constexpr float LongArrayFloat[3][20] = {{1.1, 1.2, 1.3, -1.1, -1.2, -1.3, 1.1, 1.2, 1.3, -1.1, -1.2, -1.3, 1.1, 1.2, 1.3, -1.1, -1.2, -1.3, 1.1, 1.2}, {2.1, 2.2, 2.3, -2.1, -2.2, -2.3, 1.1, 1.2, 1.3, -1.1, -1.2, -1.3, 1.1, 1.2, 1.3, -1.1, -1.2, -1.3, 1.1, 1.2}, {3.1, 3.2, 3.3, -3.1, -3.2, -3.3, 1.1, 1.2, 1.3, -1.1, -1.2, -1.3, 1.1, 1.2, 1.3, -1.1, -1.2, -1.3, 1.1, 1.2}}; struct LongRangeDihadronCor { Service ccdb; + o2::aod::ITSResponse itsResponse; O2_DEFINE_CONFIGURABLE(cfgCutVtxZ, float, 10.0f, "Accepted z-vertex range") O2_DEFINE_CONFIGURABLE(cfgCutPtMin, float, 0.2f, "minimum accepted track pT") @@ -130,6 +136,12 @@ struct LongRangeDihadronCor { TF1* fT0AV0AMean = nullptr; TF1* fT0AV0ASigma = nullptr; } cfgFuncParas; + struct : ConfigurableGroup { + O2_DEFINE_CONFIGURABLE(cfgUseItsPID, bool, true, "Use ITS PID for particle identification") + O2_DEFINE_CONFIGURABLE(cfgPIDParticle, int, 0, "1 = pion, 2 = kaon, 3 = proton, 4 = kshort, 5 = lambda, 6 = phi, 0 for no PID") + O2_DEFINE_CONFIGURABLE(cfgTofPtCut, float, 0.5f, "Minimum pt to use TOF N-sigma") + Configurable> nSigmas{"nSigmas", {LongArrayFloat[0], 3, 6, {"TPC", "TOF", "ITS"}, {"pos_pi", "pos_ka", "pos_pr", "neg_pi", "neg_ka", "neg_pr"}}, "Labeled array for n-sigma values for TPC, TOF, ITS for pions, kaons, protons (positive and negative)"}; + } cfgPIDConfig; SliceCache cache; @@ -161,7 +173,7 @@ struct LongRangeDihadronCor { Filter collisionFilter = (nabs(aod::collision::posZ) < cfgCutVtxZ); Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == static_cast(true))) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls) && (nabs(aod::track::dcaZ) < cfgCutDCAz); using FilteredCollisions = soa::Filtered>; - using FilteredTracks = soa::Filtered>; + using FilteredTracks = soa::Filtered>; // FT0 geometry o2::ft0::Geometry ft0Det; @@ -201,6 +213,31 @@ struct LongRangeDihadronCor { kFT0A = 0, kFT0C = 1 }; + enum ParticleNsigma { + kPionUp = 0, + kKaonUp, + kProtonUp, + kPionLow, + kKaonLow, + kProtonLow + }; + enum PIDIndex { + kCharged = 0, + kPions, + kKaons, + kProtons, + kK0, + kLambda, + kPhi + }; + enum DetectorType { + kTPC = 0, + kTOF, + kITS + }; + std::array tofNsigmaCut; + std::array itsNsigmaCut; + std::array tpcNsigmaCut; void init(InitContext&) { @@ -218,6 +255,28 @@ struct LongRangeDihadronCor { LOGF(info, "Starting init"); + // filling tpc nSigmas array + tpcNsigmaCut[kPionUp] = cfgPIDConfig.nSigmas->getData()[kTPC][kPionUp]; + tpcNsigmaCut[kKaonUp] = cfgPIDConfig.nSigmas->getData()[kTPC][kKaonUp]; + tpcNsigmaCut[kProtonUp] = cfgPIDConfig.nSigmas->getData()[kTPC][kProtonUp]; + tpcNsigmaCut[kPionLow] = cfgPIDConfig.nSigmas->getData()[kTPC][kPionLow]; + tpcNsigmaCut[kKaonLow] = cfgPIDConfig.nSigmas->getData()[kTPC][kKaonLow]; + tpcNsigmaCut[kProtonLow] = cfgPIDConfig.nSigmas->getData()[kTPC][kProtonLow]; + // filling tof nSigmas array + tofNsigmaCut[kPionUp] = cfgPIDConfig.nSigmas->getData()[kTOF][kPionUp]; + tofNsigmaCut[kKaonUp] = cfgPIDConfig.nSigmas->getData()[kTOF][kKaonUp]; + tofNsigmaCut[kProtonUp] = cfgPIDConfig.nSigmas->getData()[kTOF][kProtonUp]; + tofNsigmaCut[kPionLow] = cfgPIDConfig.nSigmas->getData()[kTOF][kPionLow]; + tofNsigmaCut[kKaonLow] = cfgPIDConfig.nSigmas->getData()[kTOF][kKaonLow]; + tofNsigmaCut[kProtonLow] = cfgPIDConfig.nSigmas->getData()[kTOF][kProtonLow]; + // filling its nSigmas array + itsNsigmaCut[kPionUp] = cfgPIDConfig.nSigmas->getData()[kITS][kPionUp]; + itsNsigmaCut[kKaonUp] = cfgPIDConfig.nSigmas->getData()[kITS][kKaonUp]; + itsNsigmaCut[kProtonUp] = cfgPIDConfig.nSigmas->getData()[kITS][kProtonUp]; + itsNsigmaCut[kPionLow] = cfgPIDConfig.nSigmas->getData()[kITS][kPionLow]; + itsNsigmaCut[kKaonLow] = cfgPIDConfig.nSigmas->getData()[kITS][kKaonLow]; + itsNsigmaCut[kProtonLow] = cfgPIDConfig.nSigmas->getData()[kITS][kProtonLow]; + // Event Counter if ((doprocessSameTpcFt0a || doprocessSameTpcFt0c || doprocessSameFt0aFt0c) && cfgUseAdditionalEventCut) { registry.add("hEventCountSpecific", "Number of Event;; Count", {HistType::kTH1D, {{12, 0, 12}}}); @@ -410,6 +469,58 @@ struct LongRangeDihadronCor { return ((track.tpcNClsFound() >= cfgCutTPCclu) && (track.tpcNClsCrossedRows() >= cfgCutTPCCrossedRows) && (track.itsNCls() >= cfgCutITSclu)); } + template + int getNsigmaPID(TTrack track) + { + // Computing Nsigma arrays for pion, kaon, and protons + std::array nSigmaTPC = {track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()}; + std::array nSigmaTOF = {track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr()}; + std::array nSigmaITS = {itsResponse.nSigmaITS(track), itsResponse.nSigmaITS(track), itsResponse.nSigmaITS(track)}; + int pid = -1; // -1 = not identified, 1 = pion, 2 = kaon, 3 = proton + + std::array nSigmaToUse = cfgPIDConfig.cfgUseItsPID ? nSigmaITS : nSigmaTPC; // Choose which nSigma to use: TPC or ITS + std::array detectorNsigmaCut = cfgPIDConfig.cfgUseItsPID ? itsNsigmaCut : tpcNsigmaCut; // Choose which nSigma to use: TPC or ITS + + bool isPion = false; + bool isKaon = false; + bool isProton = false; + bool isDetectedPion = nSigmaToUse[kPionUp] < detectorNsigmaCut[kPionUp] && nSigmaToUse[kPionUp] > detectorNsigmaCut[kPionLow]; + bool isDetectedKaon = nSigmaToUse[kKaonUp] < detectorNsigmaCut[kKaonUp] && nSigmaToUse[kKaonUp] > detectorNsigmaCut[kKaonLow]; + bool isDetectedProton = nSigmaToUse[kProtonUp] < detectorNsigmaCut[kProtonUp] && nSigmaToUse[kProtonUp] > detectorNsigmaCut[kProtonLow]; + + bool isTofPion = nSigmaTOF[kPionUp] < tofNsigmaCut[kPionUp] && nSigmaTOF[kPionUp] > tofNsigmaCut[kPionLow]; + bool isTofKaon = nSigmaTOF[kKaonUp] < tofNsigmaCut[kKaonUp] && nSigmaTOF[kKaonUp] > tofNsigmaCut[kKaonLow]; + bool isTofProton = nSigmaTOF[kProtonUp] < tofNsigmaCut[kProtonUp] && nSigmaTOF[kProtonUp] > tofNsigmaCut[kProtonLow]; + + if (track.pt() > cfgPIDConfig.cfgTofPtCut && !track.hasTOF()) { + return -1; + } else if (track.pt() > cfgPIDConfig.cfgTofPtCut && track.hasTOF()) { + isPion = isTofPion && isDetectedPion; + isKaon = isTofKaon && isDetectedKaon; + isProton = isTofProton && isDetectedProton; + } else { + isPion = isDetectedPion; + isKaon = isDetectedKaon; + isProton = isDetectedProton; + } + + if ((isPion && isKaon) || (isPion && isProton) || (isKaon && isProton)) { + return -1; // more than one particle satisfy the criteria + } + + if (isPion) { + pid = kPions; + } else if (isKaon) { + pid = kKaons; + } else if (isProton) { + pid = kProtons; + } else { + return -1; // no particle satisfies the criteria + } + + return pid; // -1 = not identified, 1 = pion, 2 = kaon, 3 = proton + } + void loadAlignParam(uint64_t timestamp) { offsetFT0 = ccdb->getForTimeStamp>("FT0/Calib/Align", timestamp); @@ -558,6 +669,8 @@ struct LongRangeDihadronCor { if (!trackSelected(track1)) continue; + if (cfgPIDConfig.cfgPIDParticle && getNsigmaPID(track1) != cfgPIDConfig.cfgPIDParticle) + continue; // if PID is selected, check if the track has the right PID if (!getEfficiencyCorrection(triggerWeight, track1.eta(), track1.pt(), posZ)) continue; if (system == SameEvent) { From f148a4c3ffd1bf7c834e8d7bb8c23bae830dbbe0 Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Wed, 22 Oct 2025 12:26:39 +0200 Subject: [PATCH 850/986] [PWGHF,Trigger] Fix vertexer configuration in HF filters (#13489) --- EventFiltering/PWGHF/HFFilterHelpers.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EventFiltering/PWGHF/HFFilterHelpers.h b/EventFiltering/PWGHF/HFFilterHelpers.h index e6202c5a000..65fa3132135 100644 --- a/EventFiltering/PWGHF/HFFilterHelpers.h +++ b/EventFiltering/PWGHF/HFFilterHelpers.h @@ -681,7 +681,7 @@ class HfFilterHelper template int computeNumberOfCandidates(std::vector> indices); template - int setVtxConfiguration(T1 vertexer, bool useAbsDCA); + int setVtxConfiguration(T1& vertexer, bool useAbsDCA); template bool buildV0(V const& v0Indices, T const& tracks, C const& collision, o2::vertexing::DCAFitterN<2>& dcaFitter, const std::vector& vetoedTrackIds, V0Cand& v0Cand); template @@ -2605,7 +2605,7 @@ inline int HfFilterHelper::findBin(T1 const& binsPt, T2 value) /// Set vertxing configuration /// \param vertexer o2::vertexing::DCAFitterN object template -inline int HfFilterHelper::setVtxConfiguration(T1 vertexer, bool useAbsDCA) +inline int HfFilterHelper::setVtxConfiguration(T1& vertexer, bool useAbsDCA) { // Fitter initialisation vertexer.setPropagateToPCA(true); From 705026e78ccf8126a6f35b47a2fde447c4f4e43f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?BiaoZhang=20=28=E5=BC=A0=E5=BD=AA=29?= <52267892+zhangbiao-phy@users.noreply.github.com> Date: Wed, 22 Oct 2025 14:31:41 +0200 Subject: [PATCH 851/986] [PWGHF] Fix a bug in the charm femto producer (#13486) Co-authored-by: ALICE Action Bot --- PWGHF/HFC/TableProducer/femtoDreamProducer.cxx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx index 4aacaba7ec3..3dfb0ad918f 100644 --- a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx +++ b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx @@ -576,11 +576,7 @@ struct HfFemtoDreamProducer { fillTable(1, candidate.isSelLcToPiKP(), outputMlPiKP.at(0), outputMlPiKP.at(1), outputMlPiKP.at(2)); } } - - if (!isTrackFilled) { // FIXME: isTrackFilled is always false here - isTrackFilled = fillTracksForCharmHadron(col, tracks); - // If track filling was successful, fill the collision table - } + isTrackFilled = fillTracksForCharmHadron(col, tracks); aod::femtodreamcollision::BitMaskType bitTrack = 0; if (isTrackFilled) { From b11008fe78d47d0296bcc731a53ab3ac6e1dc556 Mon Sep 17 00:00:00 2001 From: spucillo <93769017+spucillo@users.noreply.github.com> Date: Wed, 22 Oct 2025 14:59:33 +0200 Subject: [PATCH 852/986] [PWGLF] Fixing MC functions in cascadeAnalysisLightIonsDerivedData.cxx task (#13490) Co-authored-by: ALICE Action Bot --- .../cascadeAnalysisLightIonsDerivedData.cxx | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx b/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx index 1a536b79547..f8eefa65f22 100644 --- a/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx +++ b/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx @@ -214,7 +214,10 @@ struct CascadeAnalysisLightIonsDerivedData { // Multiplicity Histograms registryData.add("hCentEstimator", "hCentEstimator", HistType::kTH1D, {{101, 0.0f, 101.0f}}); registryData.add("hCentralityVsNch", "hCentralityVsNch", HistType::kTH2D, {{101, 0.0f, 101.0f}, axisNch}); - registryData.add("hCentralityVsMultiplicity", "hCentralityVsMultiplicity", HistType::kTH2D, {{101, 0.0f, 101.0f}, axisMult}); + if (centralityEstimator == Option::kNGlobal) + registryData.add("hCentralityVsMultiplicity", "hCentralityVsMultiplicity", HistType::kTH2D, {{101, 0.0f, 101.0f}, axisNch}); + else + registryData.add("hCentralityVsMultiplicity", "hCentralityVsMultiplicity", HistType::kTH2D, {{101, 0.0f, 101.0f}, axisMult}); // Histograms for xi (data) registryData.add("hMassXipos", "hMassXipos", HistType::kTH3D, {centAxis, ptAxis, invMassXiAxis}); @@ -272,7 +275,10 @@ struct CascadeAnalysisLightIonsDerivedData { // Multiplicity Histograms registryMC.add("hCentEstimator_truerec", "hCentEstimator_truerec", HistType::kTH1D, {{101, 0.0f, 101.0f}}); registryMC.add("hCentralityVsNch_truerec", "hCentralityVsNch_truerec", HistType::kTH2D, {{101, 0.0f, 101.0f}, axisNch}); - registryMC.add("hCentralityVsMultiplicity_truerec", "hCentralityVsMultiplicity_truerec", HistType::kTH2D, {{101, 0.0f, 101.0f}, axisMult}); + if (centralityEstimator == Option::kNGlobal) + registryMC.add("hCentralityVsMultiplicity_truerec", "hCentralityVsMultiplicity_truerec", HistType::kTH2D, {{101, 0.0f, 101.0f}, axisNch}); + else + registryMC.add("hCentralityVsMultiplicity_truerec", "hCentralityVsMultiplicity_truerec", HistType::kTH2D, {{101, 0.0f, 101.0f}, axisMult}); // Histograms for xi (mc) registryMC.add("hMassXipos_truerec", "hMassXipos_truerec", HistType::kTH3D, {centAxis, ptAxis, invMassXiAxis}); @@ -643,14 +649,14 @@ struct CascadeAnalysisLightIonsDerivedData { void fillGeneratedEventProperties(TMCCollisions const& mcCollisions, TCollisions const& collisions) { std::vector listBestCollisionIdx(mcCollisions.size()); - for (auto const& mcCollisions : mcCollisions) { + for (auto const& mcCollision : mcCollisions) { // event selections - if (applyVtxZ && std::fabs(mcCollisions.posZ()) > zVtx) - return; + if (applyVtxZ && std::fabs(mcCollision.posZ()) > zVtx) + continue; - registryMC.fill(HIST("hGenEvents"), mcCollisions.multMCNParticlesEta05(), 0 /* all gen. events*/); + registryMC.fill(HIST("hGenEvents"), mcCollision.multMCNParticlesEta05(), 0 /* all gen. events*/); - auto groupedCollisions = getGroupedCollisions(collisions, mcCollisions.globalIndex()); + auto groupedCollisions = getGroupedCollisions(collisions, mcCollision.globalIndex()); // Check if there is at least one of the reconstructed collisions associated to this MC collision // If so, we consider it bool atLeastOne = false; @@ -711,12 +717,12 @@ struct CascadeAnalysisLightIonsDerivedData { registryMC.fill(HIST("hCentralityVsNcoll_beforeEvSel"), centralitydata, groupedCollisions.size()); registryMC.fill(HIST("hCentralityVsNcoll_afterEvSel"), centralitydata, nCollisions); - registryMC.fill(HIST("hCentralityVsMultMC"), centralitydata, mcCollisions.multMCNParticlesEta05()); + registryMC.fill(HIST("hCentralityVsMultMC"), centralitydata, mcCollision.multMCNParticlesEta05()); - registryQC.fill(HIST("hVertexZGen"), mcCollisions.posZ()); + registryQC.fill(HIST("hVertexZGen"), mcCollision.posZ()); if (atLeastOne) { - registryMC.fill(HIST("hGenEvents"), mcCollisions.multMCNParticlesEta05(), 1 /* at least 1 rec. event*/); + registryMC.fill(HIST("hGenEvents"), mcCollision.multMCNParticlesEta05(), 1 /* at least 1 rec. event*/); registryMC.fill(HIST("hGenEventCentrality"), centralitydata); } @@ -1056,7 +1062,7 @@ struct CascadeAnalysisLightIonsDerivedData { // event selections if (applyVtxZ && std::abs(mcCollision.posZ()) > zVtx) - return; + continue; // Store the Zvtx registryQC.fill(HIST("hVertexZGen"), mcCollision.posZ()); From 3aff0662d704772e52c2216e034b3033792df6c3 Mon Sep 17 00:00:00 2001 From: jaimenorman Date: Wed, 22 Oct 2025 14:00:06 +0100 Subject: [PATCH 853/986] [PWGJE] add relative pThat track histograms (#13469) --- PWGJE/Tasks/jetOutlierQA.cxx | 68 ++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 27 deletions(-) diff --git a/PWGJE/Tasks/jetOutlierQA.cxx b/PWGJE/Tasks/jetOutlierQA.cxx index a4329b2d9aa..9b6992386dc 100644 --- a/PWGJE/Tasks/jetOutlierQA.cxx +++ b/PWGJE/Tasks/jetOutlierQA.cxx @@ -112,8 +112,11 @@ struct JetOutlierQATask { jetPtBins.push_back(jetPtTemp); } } + std::vector pThatBinning = {0.0, 0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 2.75, 3.0, + 3.25, 3.5, 3.75, 4.0, 4.25, 4.5, 4.75, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 20.0, 30.0}; AxisSpec jetPtAxis = {jetPtBins, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec pThatAxis = {pThatBinning, "p_{T} / #hat{p_{T}}"}; if (doprocessJetsAmbiguous) { // outliers @@ -177,43 +180,48 @@ struct JetOutlierQATask { registry.add("h_Z_reco_accepted", "Z position reconstructed accepted", {HistType::kTH1F, {{400, -12, 12}}}); registry.add("h_Z_true_accepted", "Z position particle accepted", {HistType::kTH1F, {{400, -12, 12}}}); - registry.add("h_track_pt", "track pt;p_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{300, 0, 300}}}); + registry.add("h_track_pt", "track pt;p_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0, 200}}}); registry.add("h_track_eta", "track eta;#eta_{track};entries", {HistType::kTH1F, {{100, -5, 5}}}); registry.add("h_track_phi", "track phi;#varphi_{track} (rad);entries", {HistType::kTH1F, {{160, -1.0, 7.0}}}); - registry.add("h_track_pt_eta", "track pt vs eta;p_{T,track} (GeV/#it{c});#eta_{track};entries", {HistType::kTH2F, {{300, 0, 300}, {100, -5, 5}}}); - registry.add("h_track_pt_phi", "track pt vs phi;p_{T,track} (GeV/#it{c});#varphi_{track} (rad);entries", {HistType::kTH2F, {{300, 0, 300}, {160, -1.0, 7.0}}}); + registry.add("h_track_pt_eta", "track pt vs eta;p_{T,track} (GeV/#it{c});#eta_{track};entries", {HistType::kTH2F, {{200, 0, 200}, {100, -5, 5}}}); + registry.add("h_track_pt_phi", "track pt vs phi;p_{T,track} (GeV/#it{c});#varphi_{track} (rad);entries", {HistType::kTH2F, {{200, 0, 200}, {160, -1.0, 7.0}}}); + registry.add("h_pt_hard_track_pt", "Tracks vs pThard;#frac{p_{T}}{#hat{p}};p_{T}", {HistType::kTH2F, {pThatAxis, {200, 0, 200}}}); - registry.add("h_track_pt_accepted", "track pt accepted;p_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{300, 0, 300}}}); + registry.add("h_track_pt_accepted", "track pt accepted;p_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0, 200}}}); registry.add("h_track_eta_accepted", "track eta accepted;#eta_{track};entries", {HistType::kTH1F, {{100, -5, 5}}}); registry.add("h_track_phi_accepted", "track phi accepted;#varphi_{track} (rad);entries", {HistType::kTH1F, {{160, -1.0, 7.0}}}); - registry.add("h_track_pt_eta_accepted", "track pt vs eta accepted;p_{T,track} (GeV/#it{c});#eta_{track};entries", {HistType::kTH2F, {{300, 0, 300}, {100, -5, 5}}}); - registry.add("h_track_pt_phi_accepted", "track pt vs phi accepted;p_{T,track} (GeV/#it{c});#varphi_{track} (rad);entries", {HistType::kTH2F, {{300, 0, 300}, {160, -1.0, 7.0}}}); - registry.add("h_track_pt_accepted_no_JJ_outlier", "track pT with no JJ outlier", {HistType::kTH1F, {{300, 0, 300}}}); - registry.add("h_track_pt_eta_accepted_no_JJ_outlier", "track pT vs eta with no JJ outlier;p_{T,track} (GeV/#it{c});#eta_{track};entries", {HistType::kTH2F, {{300, 0, 300}, {100, -5, 5}}}); - registry.add("h_track_pt_phi_accepted_no_JJ_outlier", "track pT vs phi with no JJ outlier;p_{T,track} (GeV/#it{c});#varphi_{track} (rad);entries", {HistType::kTH2F, {{300, 0, 300}, {160, -1.0, 7.0}}}); - registry.add("h_track_pt_with_JJ_outlier", "track pT with JJ outlier", {HistType::kTH1F, {{300, 0, 300}}}); - registry.add("h_track_pt_eta_with_JJ_outlier", "track pT vs eta with JJ outlier;p_{T,track} (GeV/#it{c});#eta_{track};entries", {HistType::kTH2F, {{300, 0, 300}, {100, -5, 5}}}); - registry.add("h_track_pt_phi_with_JJ_outlier", "track pT vs phi with JJ outlier;p_{T,track} (GeV/#it{c});#varphi_{track} (rad);entries", {HistType::kTH2F, {{300, 0, 300}, {160, -1.0, 7.0}}}); - registry.add("h_track_pt_with_MB_outlier", "track pT with MB outlier", {HistType::kTH1F, {{300, 0, 300}}}); - registry.add("h_track_pt_eta_with_MB_outlier", "track pT vs eta with MB outlier;p_{T,track} (GeV/#it{c});#eta_{track};entries", {HistType::kTH2F, {{300, 0, 300}, {100, -5, 5}}}); - registry.add("h_track_pt_phi_with_MB_outlier", "track pT vs phi with MB outlier;p_{T,track} (GeV/#it{c});#varphi_{track} (rad);entries", {HistType::kTH2F, {{300, 0, 300}, {160, -1.0, 7.0}}}); - - registry.add("h_track_pt_no_collision", "track pt no collision;p_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{300, 0, 300}}}); - registry.add("h_track_pt_collision", "track pt collision;p_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{300, 0, 300}}}); - registry.add("h2_track_pt_pt_hat_no_particle", "track pt vs pt hat no particle;p_{T,track} (GeV/#it{c});#hat{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{300, 0, 300}, {600, 0, 600}}}); - registry.add("h2_track_pt_pt_hat_particle", "track pt vs pt hat particle;p_{T,track} (GeV/#it{c});#hat{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{300, 0, 300}, {600, 0, 600}}}); - - registry.add("h_track_pt_outlier", "weight track pt", {HistType::kTH1F, {{300, 0, 300}}}); - registry.add("h2_pt_hat_track_pt", "track; #hat{#it{p}_{T}} (GeV/#it{c});#it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{600, 0, 600}, {300, 0, 300}}}); - registry.add("h2_pt_hat_track_pt_outlier", "track; #hat{#it{p}_{T}} (GeV/#it{c});#it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{600, 0, 600}, {300, 0, 300}}}); + registry.add("h_track_pt_eta_accepted", "track pt vs eta accepted;p_{T,track} (GeV/#it{c});#eta_{track};entries", {HistType::kTH2F, {{200, 0, 200}, {100, -5, 5}}}); + registry.add("h_track_pt_phi_accepted", "track pt vs phi accepted;p_{T,track} (GeV/#it{c});#varphi_{track} (rad);entries", {HistType::kTH2F, {{200, 0, 200}, {160, -1.0, 7.0}}}); + registry.add("h_pt_hard_track_pt_accepted", "Tracks vs pThard;#frac{p_{T}}{#hat{p}};p_{T}", {HistType::kTH2F, {pThatAxis, {200, 0, 200}}}); + registry.add("h_track_pt_accepted_no_JJ_outlier", "track pT with no JJ outlier", {HistType::kTH1F, {{200, 0, 200}}}); + registry.add("h_track_pt_eta_accepted_no_JJ_outlier", "track pT vs eta with no JJ outlier;p_{T,track} (GeV/#it{c});#eta_{track};entries", {HistType::kTH2F, {{200, 0, 200}, {100, -5, 5}}}); + registry.add("h_track_pt_phi_accepted_no_JJ_outlier", "track pT vs phi with no JJ outlier;p_{T,track} (GeV/#it{c});#varphi_{track} (rad);entries", {HistType::kTH2F, {{200, 0, 200}, {160, -1.0, 7.0}}}); + registry.add("h_pt_hard_track_pt_accepted_no_JJ_outlier", "Tracks vs pThard;#frac{p_{T}}{#hat{p}};p_{T}", {HistType::kTH2F, {pThatAxis, {200, 0, 200}}}); + registry.add("h_track_pt_with_JJ_outlier", "track pT with JJ outlier", {HistType::kTH1F, {{200, 0, 200}}}); + registry.add("h_track_pt_eta_with_JJ_outlier", "track pT vs eta with JJ outlier;p_{T,track} (GeV/#it{c});#eta_{track};entries", {HistType::kTH2F, {{200, 0, 200}, {100, -5, 5}}}); + registry.add("h_track_pt_phi_with_JJ_outlier", "track pT vs phi with JJ outlier;p_{T,track} (GeV/#it{c});#varphi_{track} (rad);entries", {HistType::kTH2F, {{200, 0, 200}, {160, -1.0, 7.0}}}); + registry.add("h_pt_hard_track_pt_with_JJ_outlier", "Tracks vs pThard;#frac{p_{T}}{#hat{p}};p_{T}", {HistType::kTH2F, {pThatAxis, {200, 0, 200}}}); + registry.add("h_track_pt_with_MB_outlier", "track pT with MB outlier", {HistType::kTH1F, {{200, 0, 200}}}); + registry.add("h_track_pt_eta_with_MB_outlier", "track pT vs eta with MB outlier;p_{T,track} (GeV/#it{c});#eta_{track};entries", {HistType::kTH2F, {{200, 0, 200}, {100, -5, 5}}}); + registry.add("h_track_pt_phi_with_MB_outlier", "track pT vs phi with MB outlier;p_{T,track} (GeV/#it{c});#varphi_{track} (rad);entries", {HistType::kTH2F, {{200, 0, 200}, {160, -1.0, 7.0}}}); + registry.add("h_pt_hard_track_pt_with_MB_outlier", "Tracks vs pThard;#frac{p_{T}}{#hat{p}};p_{T}", {HistType::kTH2F, {pThatAxis, {200, 0, 200}}}); + + registry.add("h_track_pt_no_collision", "track pt no collision;p_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0, 200}}}); + registry.add("h_track_pt_collision", "track pt collision;p_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0, 200}}}); + registry.add("h2_track_pt_pt_hat_no_particle", "track pt vs pt hat no particle;p_{T,track} (GeV/#it{c});#hat{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{200, 0, 200}, {600, 0, 600}}}); + registry.add("h2_track_pt_pt_hat_particle", "track pt vs pt hat particle;p_{T,track} (GeV/#it{c});#hat{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{200, 0, 200}, {600, 0, 600}}}); + + registry.add("h_track_pt_outlier", "weight track pt", {HistType::kTH1F, {{200, 0, 200}}}); + registry.add("h2_pt_hat_track_pt", "track; #hat{#it{p}_{T}} (GeV/#it{c});#it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{600, 0, 600}, {200, 0, 200}}}); + registry.add("h2_pt_hat_track_pt_outlier", "track; #hat{#it{p}_{T}} (GeV/#it{c});#it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{600, 0, 600}, {200, 0, 200}}}); registry.add("h2_neighbour_pt_hat_outlier", "neighbour; distance from collision; #hat{#it{p}_{T}} (GeV/#it{c})", {HistType::kTH2F, {{15, -7.5, 7.5}, {600, 0, 600}}}); registry.add("h2_neighbour_track_pt_outlier", "neighbour; distance from collision; #it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{15, -7.5, 7.5}, {200, 0, 100}}}); registry.add("h2_neighbour_pt_hat_all", "neighbour; distance from collision; #hat{#it{p}_{T}} (GeV/#it{c})", {HistType::kTH2F, {{15, -7.5, 7.5}, {600, 0, 600}}}); registry.add("h2_neighbour_track_pt_all", "neighbour; distance from collision; #it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{15, -7.5, 7.5}, {200, 0, 100}}}); - registry.add("h_track_pt_outlier_same_collision", "weight track pt same collision", {HistType::kTH1F, {{300, 0, 300}}}); - registry.add("h_track_pt_outlier_different_collision_JJ", "weight track pt different jet-jet collision", {HistType::kTH1F, {{300, 0, 300}}}); - registry.add("h_track_pt_outlier_different_collision_MB", "weight track pt different MB collision", {HistType::kTH1F, {{300, 0, 300}}}); + registry.add("h_track_pt_outlier_same_collision", "weight track pt same collision", {HistType::kTH1F, {{200, 0, 200}}}); + registry.add("h_track_pt_outlier_different_collision_JJ", "weight track pt different jet-jet collision", {HistType::kTH1F, {{200, 0, 200}}}); + registry.add("h_track_pt_outlier_different_collision_MB", "weight track pt different MB collision", {HistType::kTH1F, {{200, 0, 200}}}); registry.add("h2_outlier_event_Ntracks_different_selected_JJ", "number of selected tracks from different jet-jet events", {HistType::kTH2F, {{600, 0, 600}, {200, 0, 200}}}); registry.add("h2_outlier_event_Ntracks_different_selected_MB", "number of selected tracks from different MB events", {HistType::kTH2F, {{600, 0, 600}, {200, 0, 200}}}); @@ -544,6 +552,7 @@ struct JetOutlierQATask { registry.fill(HIST("h_track_phi"), track.phi(), weight); registry.fill(HIST("h_track_pt_eta"), track.pt(), track.eta(), weight); registry.fill(HIST("h_track_pt_phi"), track.pt(), track.phi(), weight); + registry.fill(HIST("h_pt_hard_track_pt"), pTHat != 0.0 ? track.pt() / pTHat : 0.0, track.pt(), weight); // checks on track distributions with/without collision and with/without MC particle if (!track.has_collision() || track.collisionId() != collision.globalIndex()) { registry.fill(HIST("h_track_pt_no_collision"), track.pt(), weight); @@ -689,19 +698,24 @@ struct JetOutlierQATask { registry.fill(HIST("h_track_phi_accepted"), track.phi(), weight); registry.fill(HIST("h_track_pt_eta_accepted"), track.pt(), track.eta(), weight); registry.fill(HIST("h_track_pt_phi_accepted"), track.pt(), track.phi(), weight); + registry.fill(HIST("h_pt_hard_track_pt_accepted"), pTHat != 0.0 ? track.pt() / pTHat : 0.0, track.pt(), weight); + if (!isOutlierEventDifferentJJCollision) { registry.fill(HIST("h_track_pt_accepted_no_JJ_outlier"), track.pt(), weight); registry.fill(HIST("h_track_pt_eta_accepted_no_JJ_outlier"), track.pt(), track.eta(), weight); registry.fill(HIST("h_track_pt_phi_accepted_no_JJ_outlier"), track.pt(), track.phi(), weight); + registry.fill(HIST("h_pt_hard_track_pt_accepted_no_JJ_outlier"), pTHat != 0.0 ? track.pt() / pTHat : 0.0, track.pt(), weight); } else { registry.fill(HIST("h_track_pt_with_JJ_outlier"), track.pt(), weight); registry.fill(HIST("h_track_pt_eta_with_JJ_outlier"), track.pt(), track.eta(), weight); registry.fill(HIST("h_track_pt_phi_with_JJ_outlier"), track.pt(), track.phi(), weight); + registry.fill(HIST("h_pt_hard_track_pt_with_JJ_outlier"), pTHat != 0.0 ? track.pt() / pTHat : 0.0, track.pt(), weight); } if (isOutlierEventDifferentMBCollision) { registry.fill(HIST("h_track_pt_with_MB_outlier"), track.pt(), weight); registry.fill(HIST("h_track_pt_eta_with_MB_outlier"), track.pt(), track.eta(), weight); registry.fill(HIST("h_track_pt_phi_with_MB_outlier"), track.pt(), track.phi(), weight); + registry.fill(HIST("h_pt_hard_track_pt_with_MB_outlier"), pTHat != 0.0 ? track.pt() / pTHat : 0.0, track.pt(), weight); } } } From 899561cee2b9dddab53977239f295675ff9de40d Mon Sep 17 00:00:00 2001 From: Peter Stratmann <80676312+pestratm@users.noreply.github.com> Date: Wed, 22 Oct 2025 15:16:06 +0200 Subject: [PATCH 854/986] [PWGJE] HadronPhotonCorrelation Task: Small bug fixes (#13471) --- PWGJE/Tasks/hadronPhotonCorrelation.cxx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/PWGJE/Tasks/hadronPhotonCorrelation.cxx b/PWGJE/Tasks/hadronPhotonCorrelation.cxx index b50953eaa17..a1592a587c6 100644 --- a/PWGJE/Tasks/hadronPhotonCorrelation.cxx +++ b/PWGJE/Tasks/hadronPhotonCorrelation.cxx @@ -120,12 +120,12 @@ struct HadronPhotonCorrelation { // Particle ids for storing neutral hadrons std::map pidCodes = { - {"pi0", 1}, // pi0 - {"eta", 2}, // eta - {"eta'", 3}, // eta' - {"phi", 4}, // phi - {"omega", 5}, // omega - //{"Sigma0", 6}, // Sigma + {"pi0", 1}, // pi0 + {"eta", 2}, // eta + {"eta'", 3}, // eta' + {"phi", 4}, // phi + {"omega", 5}, // omega + {"Sigma0", 6}, // Sigma {"Sigma0_bar", 6}}; std::map pidToPdg = { @@ -1018,6 +1018,9 @@ struct HadronPhotonCorrelation { if (!initTrigParticle(track_trig)) { continue; } + if (track_trig == track_assoc) { + continue; + } float dphi = RecoDecay::constrainAngle(daughter->Phi() - track_trig.phi(), -PIHalf); registry.fill(HIST("generated/charged/hCocktailPhotonCorrelGen"), track_trig.pt(), track_assoc.pt(), daughter->Pt(), daughter->Eta() - track_trig.eta(), dphi, pidCodes[pdgParticle->GetName()], collision.weight()); } From fcd0067b2d1abc3d47c9750ad55f5afc26c888cf Mon Sep 17 00:00:00 2001 From: Junlee Kim Date: Wed, 22 Oct 2025 22:33:29 +0900 Subject: [PATCH 855/986] [Common] adding shift correction inputs (#13413) Co-authored-by: ALICE Action Bot --- Common/Tasks/qVectorsCorrection.cxx | 60 ++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/Common/Tasks/qVectorsCorrection.cxx b/Common/Tasks/qVectorsCorrection.cxx index e41eceaaefe..b3f8dcbb3d9 100644 --- a/Common/Tasks/qVectorsCorrection.cxx +++ b/Common/Tasks/qVectorsCorrection.cxx @@ -78,7 +78,7 @@ struct qVectorsCorrection { Configurable cfgQAFlowStudy{"cfgQAFlowStudy", false, "configurable for flow study"}; Configurable cfgQAOccupancyStudy{"cfgQAOccupancyStudy", false, "configurable for occupancy study"}; Configurable cfgAddEvtSelPileup{"cfgAddEvtSelPileup", false, "configurable for pileup selection"}; - Configurable cfgShiftCor{"cfgShiftCor", false, "configurable for shift correction"}; + Configurable cfgShiftCorPrep{"cfgShiftCorPrep", false, "configurable for shift correction"}; Configurable cfgMinPt{"cfgMinPt", 0.15, "Minimum transverse momentum for charged track"}; Configurable cfgMaxEta{"cfgMaxEta", 0.8, "Maximum pseudorapidiy for charged track"}; @@ -178,6 +178,9 @@ struct qVectorsCorrection { AxisSpec axisAzimuth{cfgaxisAzimuth, "relative azimuthal angle"}; AxisSpec axisOccupancy{cfgaxisOccupancy, "Occupancy"}; + AxisSpec axisShift = {10, 0, 10, "shift"}; + AxisSpec axisBasis = {20, 0, 20, "basis"}; + histosQA.add("histCentFull", "Centrality distribution for valid events", HistType::kTH1F, {axisCent}); @@ -201,6 +204,10 @@ struct qVectorsCorrection { histosQA.add(Form("histQvecRefAFinalV%d", cfgnMods->at(i)), "", {HistType::kTH3F, {axisQvec, axisQvec, axisCent}}); histosQA.add(Form("histQvecRefBFinalV%d", cfgnMods->at(i)), "", {HistType::kTH3F, {axisQvec, axisQvec, axisCent}}); + if (cfgShiftCorPrep) { + histosQA.add(Form("histShiftV%d", cfgnMods->at(i)), "", {HistType::kTProfile3D, {axisCent, axisBasis, axisShift}}); + } + if (cfgQAOccupancyStudy) { histosQA.add(Form("histQvecOccFinalV%d", cfgnMods->at(i)), "", {HistType::kTHnSparseF, {axisQvecF, axisQvecF, axisCent, axisOccupancy}}); histosQA.add(Form("histQvecRefAOccFinalV%d", cfgnMods->at(i)), "", {HistType::kTHnSparseF, {axisQvecF, axisQvecF, axisCent, axisOccupancy}}); @@ -254,6 +261,49 @@ struct qVectorsCorrection { } } // End void init(InitContext const&) + template + void fillHistosShiftCor(const T& vec, int nmode) + { + int DetInd = DetId * 4 + cfgnTotalSystem * 4 * (nmode - 2) + 3; + int RefAInd = RefAId * 4 + cfgnTotalSystem * 4 * (nmode - 2) + 3; + int RefBInd = RefBId * 4 + cfgnTotalSystem * 4 * (nmode - 2) + 3; + + if (nmode == 2) { + for (int ishift = 1; ishift <= 10; ishift++) { + histosQA.fill(HIST("histShiftV2"), vec.cent(), 2.0 * DetId + 0.5, ishift - 0.5, TMath::Sin(ishift * static_cast(nmode) * TMath::ATan2(vec.qvecIm()[DetInd], vec.qvecRe()[DetInd]) / static_cast(nmode))); + histosQA.fill(HIST("histShiftV2"), vec.cent(), 2.0 * DetId + 1.5, ishift - 0.5, TMath::Cos(ishift * static_cast(nmode) * TMath::ATan2(vec.qvecIm()[DetInd], vec.qvecRe()[DetInd]) / static_cast(nmode))); + + histosQA.fill(HIST("histShiftV2"), vec.cent(), 2.0 * RefAId + 0.5, ishift - 0.5, TMath::Sin(ishift * static_cast(nmode) * TMath::ATan2(vec.qvecIm()[RefAInd], vec.qvecRe()[RefAInd]) / static_cast(nmode))); + histosQA.fill(HIST("histShiftV2"), vec.cent(), 2.0 * RefAId + 1.5, ishift - 0.5, TMath::Cos(ishift * static_cast(nmode) * TMath::ATan2(vec.qvecIm()[RefAInd], vec.qvecRe()[RefAInd]) / static_cast(nmode))); + + histosQA.fill(HIST("histShiftV2"), vec.cent(), 2.0 * RefBId + 0.5, ishift - 0.5, TMath::Sin(ishift * static_cast(nmode) * TMath::ATan2(vec.qvecIm()[RefBInd], vec.qvecRe()[RefBInd]) / static_cast(nmode))); + histosQA.fill(HIST("histShiftV2"), vec.cent(), 2.0 * RefBId + 1.5, ishift - 0.5, TMath::Cos(ishift * static_cast(nmode) * TMath::ATan2(vec.qvecIm()[RefBInd], vec.qvecRe()[RefBInd]) / static_cast(nmode))); + } + } else if (nmode == 3) { + for (int ishift = 1; ishift <= 10; ishift++) { + histosQA.fill(HIST("histShiftV3"), vec.cent(), 2.0 * DetId + 0.5, ishift - 0.5, TMath::Sin(ishift * static_cast(nmode) * TMath::ATan2(vec.qvecIm()[DetInd], vec.qvecRe()[DetInd]) / static_cast(nmode))); + histosQA.fill(HIST("histShiftV3"), vec.cent(), 2.0 * DetId + 1.5, ishift - 0.5, TMath::Cos(ishift * static_cast(nmode) * TMath::ATan2(vec.qvecIm()[DetInd], vec.qvecRe()[DetInd]) / static_cast(nmode))); + + histosQA.fill(HIST("histShiftV3"), vec.cent(), 2.0 * RefAId + 0.5, ishift - 0.5, TMath::Sin(ishift * static_cast(nmode) * TMath::ATan2(vec.qvecIm()[RefAInd], vec.qvecRe()[RefAInd]) / static_cast(nmode))); + histosQA.fill(HIST("histShiftV3"), vec.cent(), 2.0 * RefAId + 1.5, ishift - 0.5, TMath::Cos(ishift * static_cast(nmode) * TMath::ATan2(vec.qvecIm()[RefAInd], vec.qvecRe()[RefAInd]) / static_cast(nmode))); + + histosQA.fill(HIST("histShiftV3"), vec.cent(), 2.0 * RefBId + 0.5, ishift - 0.5, TMath::Sin(ishift * static_cast(nmode) * TMath::ATan2(vec.qvecIm()[RefBInd], vec.qvecRe()[RefBInd]) / static_cast(nmode))); + histosQA.fill(HIST("histShiftV3"), vec.cent(), 2.0 * RefBId + 1.5, ishift - 0.5, TMath::Cos(ishift * static_cast(nmode) * TMath::ATan2(vec.qvecIm()[RefBInd], vec.qvecRe()[RefBInd]) / static_cast(nmode))); + } + } else if (nmode == 4) { + for (int ishift = 1; ishift <= 10; ishift++) { + histosQA.fill(HIST("histShiftV4"), vec.cent(), 2.0 * DetId + 0.5, ishift - 0.5, TMath::Sin(ishift * static_cast(nmode) * TMath::ATan2(vec.qvecIm()[DetInd], vec.qvecRe()[DetInd]) / static_cast(nmode))); + histosQA.fill(HIST("histShiftV4"), vec.cent(), 2.0 * DetId + 1.5, ishift - 0.5, TMath::Cos(ishift * static_cast(nmode) * TMath::ATan2(vec.qvecIm()[DetInd], vec.qvecRe()[DetInd]) / static_cast(nmode))); + + histosQA.fill(HIST("histShiftV4"), vec.cent(), 2.0 * RefAId + 0.5, ishift - 0.5, TMath::Sin(ishift * static_cast(nmode) * TMath::ATan2(vec.qvecIm()[RefAInd], vec.qvecRe()[RefAInd]) / static_cast(nmode))); + histosQA.fill(HIST("histShiftV4"), vec.cent(), 2.0 * RefAId + 1.5, ishift - 0.5, TMath::Cos(ishift * static_cast(nmode) * TMath::ATan2(vec.qvecIm()[RefAInd], vec.qvecRe()[RefAInd]) / static_cast(nmode))); + + histosQA.fill(HIST("histShiftV4"), vec.cent(), 2.0 * RefBId + 0.5, ishift - 0.5, TMath::Sin(ishift * static_cast(nmode) * TMath::ATan2(vec.qvecIm()[RefBInd], vec.qvecRe()[RefBInd]) / static_cast(nmode))); + histosQA.fill(HIST("histShiftV4"), vec.cent(), 2.0 * RefBId + 1.5, ishift - 0.5, TMath::Cos(ishift * static_cast(nmode) * TMath::ATan2(vec.qvecIm()[RefBInd], vec.qvecRe()[RefBInd]) / static_cast(nmode))); + } + } + } + template void fillHistosFlowWithSC(const CollType& coll, const TrackType& track, int nmode) { @@ -674,6 +724,12 @@ struct qVectorsCorrection { return; } + if (cfgShiftCorPrep) { + for (uint i = 0; i < cfgnMods->size(); i++) { + fillHistosShiftCor(qVec, cfgnMods->at(i)); + } + } + for (uint i = 0; i < cfgnMods->size(); i++) { fillHistosQvec(qVec, cfgnMods->at(i)); if (cfgQAFinal && cfgQAFlowStudy) { @@ -715,7 +771,7 @@ struct qVectorsCorrection { for (uint i = 0; i < cfgnMods->size(); i++) { fillHistosQvecWithSC(qVec, cfgnMods->at(i)); - if (cfgQAFlowStudy) { + if (cfgQAFinal && cfgQAFlowStudy) { fillHistosFlowWithSC(qVec, tracks, cfgnMods->at(i)); } } From d985c30e7375c187b588a1df5d66da2e2fc6d6fa Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Wed, 22 Oct 2025 16:41:16 +0200 Subject: [PATCH 856/986] [PWGEM/Dilepton] remove sign check of HFll in MC (#13494) Co-authored-by: ALICE Action Bot --- PWGEM/Dilepton/Core/DileptonMC.h | 38 +++++------- PWGEM/Dilepton/Utils/MCUtilities.h | 92 +++++++++++++++--------------- 2 files changed, 58 insertions(+), 72 deletions(-) diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index bbbdaaca444..5e27d02e4ba 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -1639,7 +1639,7 @@ struct DileptonMC { } } break; - case 443: { + case 443: if (IsFromBeauty(mcmother, mcparticles) > 0) { fillRecHistograms<9>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // non-prompt J/psi if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { @@ -1670,15 +1670,13 @@ struct DileptonMC { } } break; - } - case 100443: { + case 100443: if (IsFromBeauty(mcmother, mcparticles) > 0) { fillRecHistograms<11>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // non-prompt psi2S } else { fillRecHistograms<10>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // prompt psi2S } break; - } default: break; } @@ -1702,23 +1700,19 @@ struct DileptonMC { auto mp1 = mcparticles.iteratorAt(t1mc.mothersIds()[0]); auto mp2 = mcparticles.iteratorAt(t2mc.mothersIds()[0]); switch (hfee_type) { - case static_cast(EM_HFeeType::kCe_Ce): { // ULS + case static_cast(EM_HFeeType::kCe_Ce): fillRecHistograms<15>(t1.sign(), t2.sign(), mp1.pdgCode(), mp2.pdgCode(), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // c2l_c2l break; - } - case static_cast(EM_HFeeType::kBe_Be): { // ULS + case static_cast(EM_HFeeType::kBe_Be): fillRecHistograms<16>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // b2l_b2l break; - } - case static_cast(EM_HFeeType::kBCe_BCe): { // ULS + case static_cast(EM_HFeeType::kBCe_BCe): fillRecHistograms<17>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // b2c2l_b2c2l break; - } - case static_cast(EM_HFeeType::kBCe_Be_SameB): { // ULS + case static_cast(EM_HFeeType::kBCe_Be_SameB): fillRecHistograms<18>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // b2c2l_b2l_sameb break; - } - case static_cast(EM_HFeeType::kBCe_Be_DiffB): // LS + case static_cast(EM_HFeeType::kBCe_Be_DiffB): fillRecHistograms<19>(t1.sign(), t2.sign(), 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); // b2c2l_b2l_diffb break; default: @@ -1869,22 +1863,20 @@ struct DileptonMC { fRegistry.fill(HIST("Generated/sm/Phi2ll/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee)); // phi->ee } break; - case 443: { + case 443: if (IsFromBeauty(mcmother, mcparticles) > 0) { fillGenHistograms<9>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // non-prompt J/psi } else { fillGenHistograms<8>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // prompt J/psi } break; - } - case 100443: { + case 100443: if (IsFromBeauty(mcmother, mcparticles) > 0) { fillGenHistograms<11>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // non-prompt psi2S } else { fillGenHistograms<10>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // prompt psi2S } break; - } default: break; } @@ -1893,22 +1885,18 @@ struct DileptonMC { auto mp1 = mcparticles.iteratorAt(t1.mothersIds()[0]); auto mp2 = mcparticles.iteratorAt(t2.mothersIds()[0]); switch (hfee_type) { - case static_cast(EM_HFeeType::kCe_Ce): { + case static_cast(EM_HFeeType::kCe_Ce): fillGenHistograms<15>(sign1, sign2, mp1.pdgCode(), mp2.pdgCode(), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // c2l_c2l break; - } - case static_cast(EM_HFeeType::kBe_Be): { + case static_cast(EM_HFeeType::kBe_Be): fillGenHistograms<16>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // b2l_b2l break; - } - case static_cast(EM_HFeeType::kBCe_BCe): { + case static_cast(EM_HFeeType::kBCe_BCe): fillGenHistograms<17>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // b2c2l_b2c2l break; - } - case static_cast(EM_HFeeType::kBCe_Be_SameB): { // ULS + case static_cast(EM_HFeeType::kBCe_Be_SameB): fillGenHistograms<18>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // b2c2l_b2l_sameb break; - } case static_cast(EM_HFeeType::kBCe_Be_DiffB): // LS fillGenHistograms<19>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // b2c2l_b2l_diffb break; diff --git a/PWGEM/Dilepton/Utils/MCUtilities.h b/PWGEM/Dilepton/Utils/MCUtilities.h index 27ee530e4f1..ca4c095a628 100644 --- a/PWGEM/Dilepton/Utils/MCUtilities.h +++ b/PWGEM/Dilepton/Utils/MCUtilities.h @@ -355,7 +355,7 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp bool is_c_from_b1 = IsFromBeauty(p1, mcparticles) > 0 && IsFromCharm(p1, mcparticles) > 0; bool is_c_from_b2 = IsFromBeauty(p2, mcparticles) > 0 && IsFromCharm(p2, mcparticles) > 0; - if (is_direct_from_b1 && is_direct_from_b2 && p1.pdgCode() * p2.pdgCode() < 0) { + if (is_direct_from_b1 && is_direct_from_b2) { mothers_id1.clear(); mothers_pdg1.clear(); mothers_id2.clear(); @@ -366,7 +366,7 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp mothers_pdg2.shrink_to_fit(); return static_cast(EM_HFeeType::kBe_Be); // bb->ee, decay type = 2 } - if (is_prompt_c1 && is_prompt_c2 && p1.pdgCode() * p2.pdgCode() < 0) { + if (is_prompt_c1 && is_prompt_c2) { mothers_id1.clear(); mothers_pdg1.clear(); mothers_id2.clear(); @@ -377,7 +377,7 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp mothers_pdg2.shrink_to_fit(); return static_cast(EM_HFeeType::kCe_Ce); // cc->ee, decay type = 0 } - if (is_c_from_b1 && is_c_from_b2 && p1.pdgCode() * p2.pdgCode() < 0) { + if (is_c_from_b1 && is_c_from_b2) { mothers_id1.clear(); mothers_pdg1.clear(); mothers_id2.clear(); @@ -389,52 +389,50 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp return static_cast(EM_HFeeType::kBCe_BCe); // b->c->e and b->c->e, decay type = 1 } if ((is_direct_from_b1 && is_c_from_b2) || (is_direct_from_b2 && is_c_from_b1)) { - if (p1.pdgCode() * p2.pdgCode() < 0) { // ULS - for (auto& mid1 : mothers_id1) { - for (auto& mid2 : mothers_id2) { - if (mid1 == mid2) { - auto common_mp = mcparticles.iteratorAt(mid1); - int mp_pdg = common_mp.pdgCode(); - bool is_mp_diquark = (1100 < std::abs(mp_pdg) && std::abs(mp_pdg) < 5600) && std::to_string(mp_pdg)[std::to_string(mp_pdg).length() - 2] == '0'; - if (!is_mp_diquark && std::abs(mp_pdg) < 1e+9 && (std::to_string(std::abs(mp_pdg))[std::to_string(std::abs(mp_pdg)).length() - 3] == '5' || std::to_string(std::abs(mp_pdg))[std::to_string(std::abs(mp_pdg)).length() - 4] == '5')) { - mothers_id1.clear(); - mothers_pdg1.clear(); - mothers_id2.clear(); - mothers_pdg2.clear(); - mothers_id1.shrink_to_fit(); - mothers_pdg1.shrink_to_fit(); - mothers_id2.shrink_to_fit(); - mothers_pdg2.shrink_to_fit(); - return static_cast(EM_HFeeType::kBCe_Be_SameB); // b->c->e and b->e, decay type = 3. this should happen only in ULS. - } + for (const auto& mid1 : mothers_id1) { + for (const auto& mid2 : mothers_id2) { + if (mid1 == mid2) { + auto common_mp = mcparticles.iteratorAt(mid1); + int mp_pdg = common_mp.pdgCode(); + bool is_mp_diquark = (1100 < std::abs(mp_pdg) && std::abs(mp_pdg) < 5600) && std::to_string(mp_pdg)[std::to_string(mp_pdg).length() - 2] == '0'; + if (!is_mp_diquark && std::abs(mp_pdg) < 1e+9 && (std::to_string(std::abs(mp_pdg))[std::to_string(std::abs(mp_pdg)).length() - 3] == '5' || std::to_string(std::abs(mp_pdg))[std::to_string(std::abs(mp_pdg)).length() - 4] == '5')) { + mothers_id1.clear(); + mothers_pdg1.clear(); + mothers_id2.clear(); + mothers_pdg2.clear(); + mothers_id1.shrink_to_fit(); + mothers_pdg1.shrink_to_fit(); + mothers_id2.shrink_to_fit(); + mothers_pdg2.shrink_to_fit(); + return static_cast(EM_HFeeType::kBCe_Be_SameB); // b->c->e and b->e, decay type = 3. this should happen only in ULS. } - } // end of motherid2 - } // end of motherid1 - } else { // LS - bool is_same_mother_found = false; - for (auto& mid1 : mothers_id1) { - for (auto& mid2 : mothers_id2) { - if (mid1 == mid2) { - auto common_mp = mcparticles.iteratorAt(mid1); - int mp_pdg = common_mp.pdgCode(); - bool is_mp_diquark = (1100 < std::abs(mp_pdg) && std::abs(mp_pdg) < 5600) && std::to_string(mp_pdg)[std::to_string(mp_pdg).length() - 2] == '0'; - if (!is_mp_diquark && std::abs(mp_pdg) < 1e+9 && (std::to_string(std::abs(mp_pdg))[std::to_string(std::abs(mp_pdg)).length() - 3] == '5' || std::to_string(std::abs(mp_pdg))[std::to_string(std::abs(mp_pdg)).length() - 4] == '5')) { - is_same_mother_found = true; - } + } + } // end of motherid2 + } // end of motherid1 + + bool is_same_mother_found = false; + for (const auto& mid1 : mothers_id1) { + for (const auto& mid2 : mothers_id2) { + if (mid1 == mid2) { + auto common_mp = mcparticles.iteratorAt(mid1); + int mp_pdg = common_mp.pdgCode(); + bool is_mp_diquark = (1100 < std::abs(mp_pdg) && std::abs(mp_pdg) < 5600) && std::to_string(mp_pdg)[std::to_string(mp_pdg).length() - 2] == '0'; + if (!is_mp_diquark && std::abs(mp_pdg) < 1e+9 && (std::to_string(std::abs(mp_pdg))[std::to_string(std::abs(mp_pdg)).length() - 3] == '5' || std::to_string(std::abs(mp_pdg))[std::to_string(std::abs(mp_pdg)).length() - 4] == '5')) { + is_same_mother_found = true; } - } // end of motherid2 - } // end of motherid1 - if (!is_same_mother_found) { - mothers_id1.clear(); - mothers_pdg1.clear(); - mothers_id2.clear(); - mothers_pdg2.clear(); - mothers_id1.shrink_to_fit(); - mothers_pdg1.shrink_to_fit(); - mothers_id2.shrink_to_fit(); - mothers_pdg2.shrink_to_fit(); - return static_cast(EM_HFeeType::kBCe_Be_DiffB); // b->c->e and b->e, decay type = 4. this should happen only in LS. But, this may happen, when ele/pos is reconstructed as pos/ele wrongly. and create LS pair - } + } + } // end of motherid2 + } // end of motherid1 + if (!is_same_mother_found) { + mothers_id1.clear(); + mothers_pdg1.clear(); + mothers_id2.clear(); + mothers_pdg2.clear(); + mothers_id1.shrink_to_fit(); + mothers_pdg1.shrink_to_fit(); + mothers_id2.shrink_to_fit(); + mothers_pdg2.shrink_to_fit(); + return static_cast(EM_HFeeType::kBCe_Be_DiffB); // b->c->e and b->e, decay type = 4. this should happen only in LS. But, this may happen, when ele/pos is reconstructed as pos/ele wrongly. and create LS pair } } From 5a81ac0717de9b910d0b3e91dacbe2ab491bd8cc Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Wed, 22 Oct 2025 19:12:02 +0200 Subject: [PATCH 857/986] [PWGLF] Stratof / fix minor typos in QA histogram filling (#13495) Co-authored-by: ALICE Builder --- .../Strangeness/strangenesstofpid.cxx | 39 +++++++++++++------ 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx index dd49afb136c..b02ef7b584a 100644 --- a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx @@ -435,6 +435,10 @@ struct strangenesstofpid { histos.add("h2dTOFSignalPositive", "h2dTOFSignalPositive", kTH2F, {axes.axisTimeLong, axes.axisBCshift}); histos.add("h2dTOFSignalNegative", "h2dTOFSignalNegative", kTH2F, {axes.axisTimeLong, axes.axisBCshift}); + histos.add("h2dTOFSignalCascadePositive", "h2dTOFSignalCascadePositive", kTH2F, {axes.axisTimeLong, axes.axisBCshift}); + histos.add("h2dTOFSignalCascadeNegative", "h2dTOFSignalCascadeNegative", kTH2F, {axes.axisTimeLong, axes.axisBCshift}); + histos.add("h2dTOFSignalCascadeBachelor", "h2dTOFSignalCascadeBachelor", kTH2F, {axes.axisTimeLong, axes.axisBCshift}); + histos.add("hCollisionTimes", "hCollisionTimes", kTH1F, {{2000, -1000.0f, 1000.0f}}); // measured vs expected total time QA @@ -1397,16 +1401,6 @@ struct strangenesstofpid { histos.fill(HIST("hV0NegativeBCShift"), deltaTimeNeg); } - if (pTof.hasTOF) { - histos.fill(HIST("hTOFSignalPositive"), pTof.tofSignal); - histos.fill(HIST("h2dTOFSignalPositive"), pTof.tofSignal, deltaTimePos); - } - - if (nTof.hasTOF) { - histos.fill(HIST("hTOFSignalNegative"), nTof.tofSignal); - histos.fill(HIST("h2dTOFSignalNegative"), nTof.tofSignal, deltaTimeNeg); - } - pTof.collisionId = pTra.collisionId(); pTof.hasITS = pTra.hasITS(); pTof.hasTPC = pTra.hasTPC(); @@ -1429,6 +1423,16 @@ struct strangenesstofpid { nTof.tpcNSigmaPi = nTra.tpcNSigmaPi(); nTof.tpcNSigmaPr = nTra.tpcNSigmaPr(); + if (pTof.hasTOF) { + histos.fill(HIST("hTOFSignalPositive"), pTof.tofSignal); + histos.fill(HIST("h2dTOFSignalPositive"), pTof.tofSignal, deltaTimePos); + } + + if (nTof.hasTOF) { + histos.fill(HIST("hTOFSignalNegative"), nTof.tofSignal); + histos.fill(HIST("h2dTOFSignalNegative"), nTof.tofSignal, deltaTimeNeg); + } + v0TofInfo v0tof = calculateTofInfoV0(collisions, V0.collisionId(), V0, pTof, nTof); if (doNSigmas) { @@ -1490,7 +1494,7 @@ struct strangenesstofpid { auto bcBach = bcs.rawIteratorAt(collisionBach.bcId()); const int64_t deltaBcBach = bcBach.globalBC() - bcV0.globalBC(); deltaTimeBach = o2::constants::lhc::LHCBunchSpacingNS * deltaBcBach * 1000.0f; - histos.fill(HIST("hCascadeNegativeBCShift"), deltaTimeBach); + histos.fill(HIST("hCascadeBachelorBCShift"), deltaTimeBach); } pTof.collisionId = pTra.collisionId(); @@ -1526,6 +1530,16 @@ struct strangenesstofpid { bTof.tpcNSigmaPi = bTra.tpcNSigmaPi(); bTof.tpcNSigmaKa = bTra.tpcNSigmaKa(); + if (pTof.hasTOF) { + histos.fill(HIST("h2dTOFSignalCascadePositive"), pTof.tofSignal, deltaTimePos); + } + if (nTof.hasTOF) { + histos.fill(HIST("h2dTOFSignalCascadeNegative"), nTof.tofSignal, deltaTimeNeg); + } + if (bTof.hasTOF) { + histos.fill(HIST("h2dTOFSignalCascadeBachelor"), bTof.tofSignal, deltaTimeBach); + } + cascTofInfo casctof = calculateTofInfoCascade(collisions, cascade.collisionId(), cascade, pTof, nTof, bTof); if (doNSigmas) { @@ -1701,6 +1715,7 @@ struct strangenesstofpid { const int64_t deltaBc = collisionTrack.globalBC() - collision.globalBC(); const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; histos.fill(HIST("hCascadePositiveBCShift"), deltaTimeBc); + histos.fill(HIST("h2dTOFSignalCascadePositive"), pTof.tofSignal, deltaTimeBc); pTof.collisionId = pTofExt.straCollisionId(); pTof.tofExpMom = pTofExt.tofExpMom(); @@ -1724,6 +1739,7 @@ struct strangenesstofpid { const int64_t deltaBc = collisionTrack.globalBC() - collision.globalBC(); const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; histos.fill(HIST("hCascadeNegativeBCShift"), deltaTimeBc); + histos.fill(HIST("h2dTOFSignalCascadeNegative"), nTof.tofSignal, deltaTimeBc); nTof.collisionId = nTofExt.straCollisionId(); nTof.tofExpMom = nTofExt.tofExpMom(); @@ -1747,6 +1763,7 @@ struct strangenesstofpid { const int64_t deltaBc = collisionTrack.globalBC() - collision.globalBC(); const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; histos.fill(HIST("hCascadeBachelorBCShift"), deltaTimeBc); + histos.fill(HIST("h2dTOFSignalCascadeBachelor"), bTof.tofSignal, deltaTimeBc); bTof.collisionId = bTofExt.straCollisionId(); bTof.tofExpMom = bTofExt.tofExpMom(); From 992ab80388c89eea4f475dd86e32e71b4f4b1281 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?BiaoZhang=20=28=E5=BC=A0=E5=BD=AA=29?= <52267892+zhangbiao-phy@users.noreply.github.com> Date: Wed, 22 Oct 2025 19:35:16 +0200 Subject: [PATCH 858/986] [PWGHF,Common] Add Cd to deKpi candidates reconstruction workflow into the HF framework (#13453) 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> --- Common/Core/TrackSelectorPID.h | 69 ++-- PWGHF/Core/HfHelper.h | 14 + PWGHF/Core/SelectorCuts.h | 42 +- PWGHF/D2H/Tasks/CMakeLists.txt | 5 + PWGHF/D2H/Tasks/taskCd.cxx | 277 +++++++++++++ .../DataModel/CandidateReconstructionTables.h | 32 ++ PWGHF/DataModel/CandidateSelectionTables.h | 8 + PWGHF/TableProducer/CMakeLists.txt | 5 + .../TableProducer/candidateCreator3Prong.cxx | 71 ++-- PWGHF/TableProducer/candidateSelectorCd.cxx | 384 ++++++++++++++++++ PWGHF/TableProducer/pidCreator.cxx | 5 + PWGHF/TableProducer/trackIndexSkimCreator.cxx | 78 ++-- PWGHF/Utils/utilsPid.h | 11 +- 13 files changed, 922 insertions(+), 79 deletions(-) create mode 100644 PWGHF/D2H/Tasks/taskCd.cxx create mode 100644 PWGHF/TableProducer/candidateSelectorCd.cxx diff --git a/Common/Core/TrackSelectorPID.h b/Common/Core/TrackSelectorPID.h index f0a0e0619e2..da5ed2f6732 100644 --- a/Common/Core/TrackSelectorPID.h +++ b/Common/Core/TrackSelectorPID.h @@ -17,6 +17,7 @@ #ifndef COMMON_CORE_TRACKSELECTORPID_H_ #define COMMON_CORE_TRACKSELECTORPID_H_ +#include #include #include @@ -43,6 +44,9 @@ class TrackSelectorPidBase /// Default constructor TrackSelectorPidBase() = default; + static constexpr float NSigmaMinDefault{-999.f}; + static constexpr float NSigmaMaxDefault{999.f}; + /// Conversion operator template operator TrackSelectorPidBase() const @@ -108,10 +112,10 @@ class TrackSelectorPidBase /// \param tpcNSigmaCustom custom TPC nσ value to be used for the selection, in case the desired value cannot be taken from the track table /// \return true if track satisfies TPC PID hypothesis for given TPC nσ range template - bool isSelectedByTpc(const T& track, bool& conditionalTof, float tpcNSigmaCustom = -999.f) + bool isSelectedByTpc(const T& track, bool& conditionalTof, float tpcNSigmaCustom = NSigmaMinDefault) { // Accept if selection is disabled via large values. - if (mNSigmaTpcMin < -999. && mNSigmaTpcMax > 999.) { + if (mNSigmaTpcMin < NSigmaMinDefault && mNSigmaTpcMax > NSigmaMaxDefault) { return true; } @@ -127,16 +131,18 @@ class TrackSelectorPidBase nSigma = track.tpcNSigmaKa(); } else if constexpr (pdg == kProton) { nSigma = track.tpcNSigmaPr(); + } else if constexpr (pdg == o2::constants::physics::Pdg::kDeuteron) { + nSigma = track.tpcNSigmaDe(); } else { errorPdg(); } /// use custom TPC nσ, if a valid value is provided - if (tpcNSigmaCustom > -999.f) { + if (tpcNSigmaCustom > NSigmaMinDefault) { nSigma = tpcNSigmaCustom; } - if (mNSigmaTpcMinCondTof < -999. && mNSigmaTpcMaxCondTof > 999.) { + if (mNSigmaTpcMinCondTof < NSigmaMinDefault && mNSigmaTpcMaxCondTof > NSigmaMaxDefault) { conditionalTof = true; } else { conditionalTof = mNSigmaTpcMinCondTof <= nSigma && nSigma <= mNSigmaTpcMaxCondTof; @@ -148,7 +154,7 @@ class TrackSelectorPidBase /// \param track track /// \return TPC selection status (see TrackSelectorPID::Status) template - TrackSelectorPID::Status statusTpc(const T& track, float tpcNSigmaCustom = -999.f) + TrackSelectorPID::Status statusTpc(const T& track, float tpcNSigmaCustom = NSigmaMinDefault) { if (!isValidForTpc(track)) { return TrackSelectorPID::NotApplicable; @@ -202,10 +208,10 @@ class TrackSelectorPidBase /// \param tofNSigmaCustom custom TOF nσ value to be used for the selection, in case the desired value cannot be taken from the track table /// \return true if track satisfies TOF PID hypothesis for given TOF nσ range template - bool isSelectedByTof(const T& track, bool& conditionalTpc, float tofNSigmaCustom = -999.f) + bool isSelectedByTof(const T& track, bool& conditionalTpc, float tofNSigmaCustom = NSigmaMinDefault) { // Accept if selection is disabled via large values. - if (mNSigmaTofMin < -999. && mNSigmaTofMax > 999.) { + if (mNSigmaTofMin < NSigmaMinDefault && mNSigmaTofMax > NSigmaMaxDefault) { return true; } @@ -221,16 +227,18 @@ class TrackSelectorPidBase nSigma = track.tofNSigmaKa(); } else if constexpr (pdg == kProton) { nSigma = track.tofNSigmaPr(); + } else if constexpr (pdg == o2::constants::physics::Pdg::kDeuteron) { + nSigma = track.tofNSigmaDe(); } else { errorPdg(); } /// use custom TOF nσ, if a valid value is provided - if (tofNSigmaCustom > -999.f) { + if (tofNSigmaCustom > NSigmaMinDefault) { nSigma = tofNSigmaCustom; } - if (mNSigmaTofMinCondTpc < -999. && mNSigmaTofMaxCondTpc > 999.) { + if (mNSigmaTofMinCondTpc < NSigmaMinDefault && mNSigmaTofMaxCondTpc > NSigmaMaxDefault) { conditionalTpc = true; } else { conditionalTpc = mNSigmaTofMinCondTpc <= nSigma && nSigma <= mNSigmaTofMaxCondTpc; @@ -242,7 +250,7 @@ class TrackSelectorPidBase /// \param track track /// \return TOF selection status (see TrackSelectorPID::Status) template - TrackSelectorPID::Status statusTof(const T& track, float tofNSigmaCustom = -999.f) + TrackSelectorPID::Status statusTof(const T& track, float tofNSigmaCustom = NSigmaMinDefault) { if (!isValidForTof(track)) { return TrackSelectorPID::NotApplicable; @@ -301,7 +309,7 @@ class TrackSelectorPidBase bool isSelectedByRich(const T& track, bool& conditionalTof) { // Accept if selection is disabled via large values. - if (mNSigmaRichMin < -999. && mNSigmaRichMax > 999.) { + if (mNSigmaRichMin < NSigmaMinDefault && mNSigmaRichMax > NSigmaMaxDefault) { return true; } @@ -321,7 +329,7 @@ class TrackSelectorPidBase errorPdg(); } - if (mNSigmaRichMinCondTof < -999. && mNSigmaRichMaxCondTof > 999.) { + if (mNSigmaRichMinCondTof < NSigmaMinDefault && mNSigmaRichMaxCondTof > NSigmaMaxDefault) { conditionalTof = true; } else { conditionalTof = mNSigmaRichMinCondTof <= nSigma && nSigma <= mNSigmaRichMaxCondTof; @@ -405,7 +413,7 @@ class TrackSelectorPidBase /// \param track track /// \return status of combined PID (TPC or TOF) (see TrackSelectorPID::Status) template - TrackSelectorPID::Status statusTpcOrTof(const T& track, float tpcNSigmaCustom = -999.f, float tofNSigmaCustom = -999.f) + TrackSelectorPID::Status statusTpcOrTof(const T& track, float tpcNSigmaCustom = NSigmaMinDefault, float tofNSigmaCustom = NSigmaMinDefault) { int pidTpc = statusTpc(track, tpcNSigmaCustom); int pidTof = statusTof(track, tofNSigmaCustom); @@ -426,7 +434,7 @@ class TrackSelectorPidBase /// \param track track /// \return status of combined PID (TPC and TOF) (see TrackSelectorPID::Status) template - TrackSelectorPID::Status statusTpcAndTof(const T& track, float tpcNSigmaCustom = -999.f, float tofNSigmaCustom = -999.f) + TrackSelectorPID::Status statusTpcAndTof(const T& track, float tpcNSigmaCustom = NSigmaMinDefault, float tofNSigmaCustom = NSigmaMinDefault) { int pidTpc = TrackSelectorPID::NotApplicable; if (track.hasTPC()) { @@ -464,23 +472,29 @@ class TrackSelectorPidBase template bool isElectronAndNotPion(const T& track, bool useTof = true, bool useRich = true) { + constexpr float NSigmaInvalid{-1000.f}; + constexpr float PTofRichTElectronMin{0.4f}; + constexpr float PTofRichTElectronMax{0.6f}; + constexpr float PRichPionBandMin{1.0f}; + constexpr float PRichPionBandMax{2.0f}; + bool isSelTof = false; bool isSelRich = false; bool hasRich = track.richId() > -1; bool hasTof = isValidForTof(track); auto nSigmaTofEl = track.tofNSigmaEl(); auto nSigmaTofPi = track.tofNSigmaPi(); - auto nSigmaRichEl = hasRich ? track.rich().richNsigmaEl() : -1000.; - auto nSigmaRichPi = hasRich ? track.rich().richNsigmaPi() : -1000.; + auto nSigmaRichEl = hasRich ? track.rich().richNsigmaEl() : NSigmaInvalid; + auto nSigmaRichPi = hasRich ? track.rich().richNsigmaPi() : NSigmaInvalid; auto p = track.p(); // TOF - if (useTof && hasTof && (p < 0.6)) { - if (p > 0.4 && hasRich) { + if (useTof && hasTof && (p < PTofRichTElectronMax)) { + if (p > PTofRichTElectronMin && hasRich) { if ((std::abs(nSigmaTofEl) < mNSigmaTofMax) && (std::abs(nSigmaRichEl) < mNSigmaRichMax)) { isSelTof = true; // is selected as electron by TOF and RICH } - } else if (p <= 0.4) { + } else if (p <= PTofRichTElectronMin) { if (std::abs(nSigmaTofEl) < mNSigmaTofMax) { isSelTof = true; // is selected as electron by TOF } @@ -499,7 +513,7 @@ class TrackSelectorPidBase if (std::abs(nSigmaRichEl) < mNSigmaRichMax) { isSelRich = true; // is selected as electron by RICH } - if ((std::abs(nSigmaRichPi) < mNSigmaRichMax) && (p > 1.0) && (p < 2.0)) { + if ((std::abs(nSigmaRichPi) < mNSigmaRichMax) && (p > PRichPionBandMin) && (p < PRichPionBandMax)) { isSelRich = false; // is selected as pion by RICH } } else { @@ -551,6 +565,8 @@ class TrackSelectorPidBase return track.bayesID() == o2::track::PID::Kaon; } else if constexpr (pdg == kProton) { return track.bayesID() == o2::track::PID::Proton; + } else if constexpr (pdg == o2::constants::physics::Pdg::kDeuteron) { + return track.bayesID() == o2::track::PID::Deuteron; } else { errorPdg(); return false; @@ -579,6 +595,8 @@ class TrackSelectorPidBase prob = track.bayesKa(); } else if constexpr (pdg == kProton) { prob = track.bayesPr(); + } else if constexpr (pdg == o2::constants::physics::Pdg::kDeuteron) { + prob = track.bayesDe(); } else { errorPdg(); } @@ -656,10 +674,11 @@ class TrackSelectorPidBase }; // Predefined types -using TrackSelectorEl = TrackSelectorPidBase; // El -using TrackSelectorMu = TrackSelectorPidBase; // Mu -using TrackSelectorPi = TrackSelectorPidBase; // Pi -using TrackSelectorKa = TrackSelectorPidBase; // Ka -using TrackSelectorPr = TrackSelectorPidBase; // Pr +using TrackSelectorEl = TrackSelectorPidBase; // El +using TrackSelectorMu = TrackSelectorPidBase; // Mu +using TrackSelectorPi = TrackSelectorPidBase; // Pi +using TrackSelectorKa = TrackSelectorPidBase; // Ka +using TrackSelectorPr = TrackSelectorPidBase; // Pr +using TrackSelectorDe = TrackSelectorPidBase; // De #endif // COMMON_CORE_TRACKSELECTORPID_H_ diff --git a/PWGHF/Core/HfHelper.h b/PWGHF/Core/HfHelper.h index 85190c4e245..9bbae7b2617 100644 --- a/PWGHF/Core/HfHelper.h +++ b/PWGHF/Core/HfHelper.h @@ -410,6 +410,20 @@ class HfHelper return RecoDecay::m(std::array{candidate.pVectorProng2(), candidate.pVectorProng0()}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPiPlus}); } + // Cd± → De± K∓ π± + + template + auto invMassCdToDeKPi(const T& candidate) + { + return candidate.m(std::array{o2::constants::physics::MassDeuteron, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}); + } + + template + auto invMassCdToPiKDe(const T& candidate) + { + return candidate.m(std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassDeuteron}); + } + // Ξc± → p± K∓ π± template diff --git a/PWGHF/Core/SelectorCuts.h b/PWGHF/Core/SelectorCuts.h index 2feeb313af6..2a0917cdf97 100644 --- a/PWGHF/Core/SelectorCuts.h +++ b/PWGHF/Core/SelectorCuts.h @@ -68,12 +68,13 @@ static const std::vector labelsCutVarTrack = {"min_dcaxytoprimary", namespace hf_presel_pid { // default values for the PID cuts for protons in the track-index-skim-creator -constexpr float CutsPid[4][6] = {{0.f, 1000.f, 5.f, 0.f, 1000.f, 5.f}, +constexpr float CutsPid[5][6] = {{0.f, 1000.f, 5.f, 0.f, 1000.f, 5.f}, + {0.f, 1000.f, 5.f, 0.f, 1000.f, 5.f}, {0.f, 1000.f, 5.f, 0.f, 1000.f, 5.f}, {0.f, 1000.f, 5.f, 0.f, 1000.f, 5.f}, {0.f, 1000.f, 5.f, 0.f, 1000.f, 5.f}}; static const std::vector labelsCutsPid = {"minPtTpc", "maxPtTpc", "nSigmaMaxTpc", "minPtTof", "maxPtTof", "nSigmaMaxTof"}; -static const std::vector labelsRowsPid = {"ProtonInLcToPKPi", "ProtonInXicToPKPi", "ProtonInLcToPK0S", "KaonIn3Prongs"}; +static const std::vector labelsRowsPid = {"ProtonInLcToPKPi", "ProtonInXicToPKPi", "ProtonInLcToPK0S", "KaonIn3Prongs", "DeuteronInCdToDeKPi"}; } // namespace hf_presel_pid namespace hf_cuts_bdt_multiclass @@ -1516,6 +1517,43 @@ static const std::vector labelsPt = { static const std::vector labelsCutVar = {"max pKpi mass Lc", "max piKp mass Lc"}; } // namespace hf_cuts_sigmac_to_p_k_pi +namespace hf_cuts_cd_to_de_k_pi +{ +static constexpr int NBinsPt = 6; +static constexpr int NCutVars = 10; +// default values for the pT bin edges (can be used to configure histogram axis) +// offset by 1 from the bin numbers in cuts array +constexpr double BinsPt[NBinsPt + 1] = { + 0., + 2., + 4., + 6., + 8., + 12., + 24.}; +const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; + +// default values for the cuts m, ptP, ptK, ptPi, chi2PCA, dL, cosp, dLXY, NdLXY, ImpParXY, mass(Kpi) +constexpr double Cuts[NBinsPt][NCutVars] = {{0.4, 0.4, 0.4, 0.4, 0., 0.005, 0., 0., 0., 1e+10}, /* 0 < pT < 2 */ + {0.4, 0.4, 0.4, 0.4, 0., 0.005, 0., 0., 0., 1e+10}, /* 2 < pT < 4 */ + {0.4, 0.4, 0.4, 0.4, 0., 0.005, 0., 0., 0., 1e+10}, /* 4 < pT < 6 */ + {0.4, 0.4, 0.4, 0.4, 0., 0.005, 0., 0., 0., 1e+10}, /* 6 < pT < 8 */ + {0.4, 0.4, 0.4, 0.4, 0., 0.005, 0., 0., 0., 1e+10}, /* 8 < pT < 12 */ + {0.4, 0.4, 0.4, 0.4, 0., 0.005, 0., 0., 0., 1e+10}}; /* 12 < pT < 24 */ + +// row labels +static const std::vector labelsPt = { + "pT bin 0", + "pT bin 1", + "pT bin 2", + "pT bin 3", + "pT bin 4", + "pT bin 5"}; + +// column labels +static const std::vector labelsCutVar = {"m", "pT De", "pT K", "pT Pi", "Chi2PCA", "decay length", "cos pointing angle", "decLengthXY", "normDecLXY", "impParXY"}; +} // namespace hf_cuts_cd_to_de_k_pi + } // namespace o2::analysis #endif // PWGHF_CORE_SELECTORCUTS_H_ diff --git a/PWGHF/D2H/Tasks/CMakeLists.txt b/PWGHF/D2H/Tasks/CMakeLists.txt index 3fb53720168..83119df1245 100644 --- a/PWGHF/D2H/Tasks/CMakeLists.txt +++ b/PWGHF/D2H/Tasks/CMakeLists.txt @@ -49,6 +49,11 @@ o2physics_add_dpl_workflow(task-bs PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(task-cd + SOURCES taskCd.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(task-charm-polarisation SOURCES taskCharmPolarisation.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore diff --git a/PWGHF/D2H/Tasks/taskCd.cxx b/PWGHF/D2H/Tasks/taskCd.cxx new file mode 100644 index 00000000000..5bcd8a328a8 --- /dev/null +++ b/PWGHF/D2H/Tasks/taskCd.cxx @@ -0,0 +1,277 @@ +// 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 taskCd.cxx +/// \brief Cd± → d± K∓ π± analysis task +/// \author Biao Zhang , Heidelberg Universiity + +#include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/Core/DecayChannels.h" +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/Utils/utilsEvSelHf.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/Centrality.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include // std::vector + +using namespace o2; +using namespace o2::analysis; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::hf_centrality; +using namespace o2::hf_occupancy; +using namespace o2::hf_evsel; + +struct HfTaskCd { + Configurable selectionFlagCd{"selectionFlagCd", 1, "Selection Flag for Cd"}; + Configurable> binsPt{"binsPt", std::vector{hf_cuts_cd_to_de_k_pi::vecBinsPt}, "pT bin limits"}; + Configurable fillTHn{"fillTHn", false, "fill THn"}; + + HfHelper hfHelper; + SliceCache cache; + + using CollisionsWEvSel = soa::Join; + using CollisionsWithEvSelFT0C = soa::Join; + using CollisionsWithEvSelFT0M = soa::Join; + + using CdCandidates = soa::Filtered>; + + Filter filterSelectCandidates = aod::hf_sel_candidate_cd::isSelCdToDeKPi >= selectionFlagCd; + Preslice candCdPerCollision = aod::hf_cand::collisionId; + + ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {72, 0, 36}, ""}; + ConfigurableAxis thnConfigAxisMass{"thnConfigAxisMass", {400, 2.4, 4.4}, ""}; + ConfigurableAxis thnConfigAxisPtProng{"thnConfigAxisPtProng", {100, 0, 20}, ""}; + ConfigurableAxis thnConfigAxisChi2PCA{"thnConfigAxisChi2PCA", {100, 0, 20}, ""}; + ConfigurableAxis thnConfigAxisDecLength{"thnConfigAxisDecLength", {10, 0, 0.05}, ""}; + ConfigurableAxis thnConfigAxisCPA{"thnConfigAxisCPA", {20, 0.8, 1}, ""}; + ConfigurableAxis thnConfigAxisCentrality{"thnConfigAxisCentrality", {100, 0, 100}, ""}; + + HistogramRegistry registry{ + "registry", + {/// mass candidate + {"Data/hMass", "3-prong candidates;inv. mass (de K #pi) (GeV/#it{c}^{2})", {HistType::kTH1F, {{400, 2.4, 4.4}}}}, + /// pT + {"Data/hPt", "3-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, + {"Data/hPtProng0", "3-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, + {"Data/hPtProng1", "3-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, + {"Data/hPtProng2", "3-prong candidates;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, + /// DCAxy to prim. vertex prongs + {"Data/hd0Prong0", "3-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{600, -0.4, 0.4}}}}, + {"Data/hd0Prong1", "3-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{600, -0.4, 0.4}}}}, + {"Data/hd0Prong2", "3-prong candidates;prong 2 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{600, -0.4, 0.4}}}}, + /// decay length candidate + {"Data/hDecLength", "3-prong candidates;decay length (cm);entries", {HistType::kTH1F, {{400, 0., 1.}}}}, + /// decay length xy candidate + {"Data/hDecLengthxy", "3-prong candidates;decay length xy (cm);entries", {HistType::kTH1F, {{400, 0., 1.}}}}, + /// cosine of pointing angle + {"Data/hCPA", "3-prong candidates;cosine of pointing angle;entries", {HistType::kTH1F, {{110, -1.1, 1.1}}}}, + /// cosine of pointing angle xy + {"Data/hCPAxy", "3-prong candidates;cosine of pointing angle xy;entries", {HistType::kTH1F, {{110, -1.1, 1.1}}}}, + /// Chi 2 PCA to sec. vertex + {"Data/hDca2", "3-prong candidates;prong Chi2PCA to sec. vertex (cm);entries", {HistType::kTH1F, {{400, 0., 20.}}}}, + /// eta + {"Data/hEta", "3-prong candidates;#it{#eta};entries", {HistType::kTH1F, {{100, -2., 2.}}}}, + /// phi + {"Data/hPhi", "3-prong candidates;#it{#Phi};entries", {HistType::kTH1F, {{100, 0., 6.3}}}}}}; + + HistogramRegistry qaRegistry{"QAHistos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + void init(InitContext&) + { + std::array doprocess{doprocessDataStd, doprocessDataStdWithFT0C, doprocessDataStdWithFT0M}; + if ((std::accumulate(doprocess.begin(), doprocess.end(), 0)) != 1) { + LOGP(fatal, "no or more than one process function enabled! Please check your configuration!"); + } + /// mass candidate + registry.add("Data/hMassVsPtVsNPvContributors", "3-prong candidates;inv. mass (de K #pi) (GeV/#it{c}^{2}); p_{T}; Number of PV contributors", {HistType::kTH3F, {{400, 2.4, 4.4}, {binsPt, "#it{p}_{T} (GeV/#it{c})"}, {500, 0., 5000.}}}); + registry.add("Data/hMassVsPt", "3-prong candidates;inv. mass (de K #pi) (GeV/#it{c}^{2}); p_{T}", {HistType::kTH2F, {{400, 2.4, 4.4}, {binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + /// DCAxy to prim. vertex prongs + registry.add("Data/hd0VsPtProng0", "3-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{600, -0.4, 0.4}, {binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/hd0VsPtProng1", "3-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{600, -0.4, 0.4}, {binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/hd0VsPtProng2", "3-prong candidates;prong 2 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{600, -0.4, 0.4}, {binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + /// decay length candidate + registry.add("Data/hDecLengthVsPt", "3-prong candidates;decay length (cm);entries", {HistType::kTH2F, {{400, 0., 1.}, {binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + /// decay length xy candidate + registry.add("Data/hDecLengthxyVsPt", "3-prong candidates;decay length xy(cm);entries", {HistType::kTH2F, {{400, 0., 1.}, {binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + /// cosine of pointing angle + registry.add("Data/hCPAVsPt", "3-prong candidates;cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + /// cosine of pointing angle xy + registry.add("Data/hCPAxyVsPt", "3-prong candidates;cosine of pointing angle xy;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + /// Chi 2 PCA to sec. vertex + registry.add("Data/hDca2VsPt", "3-prong candidates;prong Chi2PCA to sec. vertex (cm);entries", {HistType::kTH2F, {{400, 0., 20.}, {binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + /// eta + registry.add("Data/hEtaVsPt", "3-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + /// phi + registry.add("Data/hPhiVsPt", "3-prong candidates;candidate #it{#Phi};entries", {HistType::kTH2F, {{100, 0., 6.3}, {binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + /// selection status + registry.add("hSelectionStatus", "3-prong candidates;selection status;entries", {HistType::kTH2F, {{5, -0.5, 4.5}, {binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + /// impact parameter error + registry.add("Data/hImpParErrProng0", "3-prong candidates;prong 0 impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/hImpParErrProng1", "3-prong candidates;prong 1 impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/hImpParErrProng2", "3-prong candidates;prong 2 impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + + if (fillTHn) { + const AxisSpec thnAxisMass{thnConfigAxisMass, "inv. mass (de K #pi) (GeV/#it{c}^{2})"}; + const AxisSpec thnAxisPt{thnConfigAxisPt, "#it{p}_{T}(C_{d}^{+}) (GeV/#it{c})"}; + const AxisSpec thnAxisPtProng0{thnConfigAxisPtProng, "#it{p}_{T}(prong0) (GeV/#it{c})"}; + const AxisSpec thnAxisPtProng1{thnConfigAxisPtProng, "#it{p}_{T}(prong1) (GeV/#it{c})"}; + const AxisSpec thnAxisPtProng2{thnConfigAxisPtProng, "#it{p}_{T}(prong2) (GeV/#it{c})"}; + const AxisSpec thnAxisChi2PCA{thnConfigAxisChi2PCA, "Chi2PCA to sec. vertex (cm)"}; + const AxisSpec thnAxisDecLength{thnConfigAxisDecLength, "decay length (cm)"}; + const AxisSpec thnAxisCPA{thnConfigAxisCPA, "cosine of pointing angle"}; + const AxisSpec thnAxisCentrality{thnConfigAxisCentrality, "centrality (FT0C)"}; + + std::vector axesStd{thnAxisMass, thnAxisPt, thnAxisPtProng0, thnAxisPtProng1, thnAxisPtProng2, thnAxisChi2PCA, thnAxisDecLength, thnAxisCPA, thnAxisCentrality}; + registry.add("hnCdVars", "THn for Reconstructed Cd candidates for data", HistType::kTHnSparseF, axesStd); + } + } + + /// Fill histograms for real data + template + void fillHistosData(CollType const& collision, CandType const& candidates) + { + auto thisCollId = collision.globalIndex(); + auto groupedCdCandidates = candidates.sliceBy(candCdPerCollision, thisCollId); + auto numPvContributors = collision.numContrib(); + + for (const auto& candidate : groupedCdCandidates) { + if (!TESTBIT(candidate.hfflag(), aod::hf_cand_3prong::DecayType::CdToDeKPi)) { + continue; + } + + const auto pt = candidate.pt(); + const auto ptProng0 = candidate.ptProng0(); + const auto ptProng1 = candidate.ptProng1(); + const auto ptProng2 = candidate.ptProng2(); + const auto decayLength = candidate.decayLength(); + const auto decayLengthXY = candidate.decayLengthXY(); + const auto chi2PCA = candidate.chi2PCA(); + const auto cpa = candidate.cpa(); + const auto cpaXY = candidate.cpaXY(); + + if (candidate.isSelCdToDeKPi() >= selectionFlagCd) { + registry.fill(HIST("Data/hMass"), hfHelper.invMassCdToDeKPi(candidate)); + registry.fill(HIST("Data/hMassVsPtVsNPvContributors"), hfHelper.invMassCdToDeKPi(candidate), pt, numPvContributors); + registry.fill(HIST("Data/hMassVsPt"), hfHelper.invMassCdToDeKPi(candidate), pt); + } + if (candidate.isSelCdToPiKDe() >= selectionFlagCd) { + registry.fill(HIST("Data/hMass"), hfHelper.invMassCdToPiKDe(candidate)); + registry.fill(HIST("Data/hMassVsPtVsNPvContributors"), hfHelper.invMassCdToPiKDe(candidate), pt, numPvContributors); + registry.fill(HIST("Data/hMassVsPt"), hfHelper.invMassCdToPiKDe(candidate), pt); + } + registry.fill(HIST("Data/hPt"), pt); + registry.fill(HIST("Data/hPtProng0"), ptProng0); + registry.fill(HIST("Data/hPtProng1"), ptProng1); + registry.fill(HIST("Data/hPtProng2"), ptProng2); + registry.fill(HIST("Data/hd0Prong0"), candidate.impactParameter0()); + registry.fill(HIST("Data/hd0Prong1"), candidate.impactParameter1()); + registry.fill(HIST("Data/hd0Prong2"), candidate.impactParameter2()); + registry.fill(HIST("Data/hd0VsPtProng0"), candidate.impactParameter0(), pt); + registry.fill(HIST("Data/hd0VsPtProng1"), candidate.impactParameter1(), pt); + registry.fill(HIST("Data/hd0VsPtProng2"), candidate.impactParameter2(), pt); + registry.fill(HIST("Data/hDecLength"), decayLength); + registry.fill(HIST("Data/hDecLengthVsPt"), decayLength, pt); + registry.fill(HIST("Data/hDecLengthxy"), decayLengthXY); + registry.fill(HIST("Data/hDecLengthxyVsPt"), decayLengthXY, pt); + registry.fill(HIST("Data/hCPA"), cpa); + registry.fill(HIST("Data/hCPAVsPt"), cpa, pt); + registry.fill(HIST("Data/hCPAxy"), cpaXY); + registry.fill(HIST("Data/hCPAxyVsPt"), cpaXY, pt); + registry.fill(HIST("Data/hDca2"), chi2PCA); + registry.fill(HIST("Data/hDca2VsPt"), chi2PCA, pt); + registry.fill(HIST("Data/hEta"), candidate.eta()); + registry.fill(HIST("Data/hEtaVsPt"), candidate.eta(), pt); + registry.fill(HIST("Data/hPhi"), candidate.phi()); + registry.fill(HIST("Data/hPhiVsPt"), candidate.phi(), pt); + registry.fill(HIST("hSelectionStatus"), candidate.isSelCdToDeKPi(), pt); + registry.fill(HIST("hSelectionStatus"), candidate.isSelCdToPiKDe(), pt); + registry.fill(HIST("Data/hImpParErrProng0"), candidate.errorImpactParameter0(), pt); + registry.fill(HIST("Data/hImpParErrProng1"), candidate.errorImpactParameter1(), pt); + registry.fill(HIST("Data/hImpParErrProng2"), candidate.errorImpactParameter2(), pt); + + if (fillTHn) { + float const cent = o2::hf_centrality::getCentralityColl(collision); + double massCd(-1); + if (candidate.isSelCdToDeKPi() >= selectionFlagCd) { + massCd = hfHelper.invMassCdToDeKPi(candidate); + std::vector valuesToFill{massCd, pt, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, cent}; + registry.get(HIST("hnCdVars"))->Fill(valuesToFill.data()); + } + if (candidate.isSelCdToPiKDe() >= selectionFlagCd) { + massCd = hfHelper.invMassCdToPiKDe(candidate); + std::vector valuesToFill{massCd, pt, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, cent}; + registry.get(HIST("hnCdVars"))->Fill(valuesToFill.data()); + } + } + } + } + /// Run the analysis on real data + template + void runAnalysisPerCollisionData(CollType const& collisions, + CandType const& candidates) + { + + for (const auto& collision : collisions) { + fillHistosData(collision, candidates); + } + } + + void processDataStd(CollisionsWEvSel const& collisions, + CdCandidates const& selectedCdCandidates, + aod::Tracks const&) + { + runAnalysisPerCollisionData(collisions, selectedCdCandidates); + } + PROCESS_SWITCH(HfTaskCd, processDataStd, "Process Data with the standard method", true); + + void processDataStdWithFT0C(CollisionsWithEvSelFT0C const& collisions, + CdCandidates const& selectedCdCandidates, + aod::Tracks const&) + { + runAnalysisPerCollisionData(collisions, selectedCdCandidates); + } + PROCESS_SWITCH(HfTaskCd, processDataStdWithFT0C, "Process real data with the standard method and with FT0C centrality", false); + + void processDataStdWithFT0M(CollisionsWithEvSelFT0M const& collisions, + CdCandidates const& selectedCdCandidates, + aod::Tracks const&) + { + runAnalysisPerCollisionData(collisions, selectedCdCandidates); + } + PROCESS_SWITCH(HfTaskCd, processDataStdWithFT0M, "Process real data with the standard method and with FT0M centrality", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGHF/DataModel/CandidateReconstructionTables.h b/PWGHF/DataModel/CandidateReconstructionTables.h index addd26ab716..deb6644cf25 100644 --- a/PWGHF/DataModel/CandidateReconstructionTables.h +++ b/PWGHF/DataModel/CandidateReconstructionTables.h @@ -58,12 +58,14 @@ using TracksPidMu = soa::Join; using TracksPidPi = soa::Join; using TracksPidKa = soa::Join; using TracksPidPr = soa::Join; +using TracksPidDe = soa::Join; using TracksPidTinyEl = soa::Join; using TracksPidTinyMu = soa::Join; using TracksPidTinyPi = soa::Join; using TracksPidTinyKa = soa::Join; using TracksPidTinyPr = soa::Join; +using TracksPidTinyDe = soa::Join; // namespace pid_tpc_tof_utils // { @@ -156,6 +158,7 @@ DECLARE_SOA_COLUMN(TpcTofNSigmaMu, tpcTofNSigmaMu, float); //! Combined NSigma s DECLARE_SOA_COLUMN(TpcTofNSigmaPi, tpcTofNSigmaPi, float); //! Combined NSigma separation with the TPC & TOF detectors for pion DECLARE_SOA_COLUMN(TpcTofNSigmaKa, tpcTofNSigmaKa, float); //! Combined NSigma separation with the TPC & TOF detectors for kaon DECLARE_SOA_COLUMN(TpcTofNSigmaPr, tpcTofNSigmaPr, float); //! Combined NSigma separation with the TPC & TOF detectors for proton +DECLARE_SOA_COLUMN(TpcTofNSigmaDe, tpcTofNSigmaDe, float); //! Combined NSigma separation with the TPC & TOF detectors for deuteron } // namespace pid_tpc_tof_static_full namespace pid_tpc_tof_static_tiny @@ -166,6 +169,7 @@ DECLARE_SOA_COLUMN(TpcTofNSigmaMu, tpcTofNSigmaMu, float); //! Combined NSigma s DECLARE_SOA_COLUMN(TpcTofNSigmaPi, tpcTofNSigmaPi, float); //! Combined NSigma separation with the TPC & TOF detectors for pion DECLARE_SOA_COLUMN(TpcTofNSigmaKa, tpcTofNSigmaKa, float); //! Combined NSigma separation with the TPC & TOF detectors for kaon DECLARE_SOA_COLUMN(TpcTofNSigmaPr, tpcTofNSigmaPr, float); //! Combined NSigma separation with the TPC & TOF detectors for proton +DECLARE_SOA_COLUMN(TpcTofNSigmaDe, tpcTofNSigmaDe, float); //! Combined NSigma separation with the TPC & TOF detectors for deuteron } // namespace pid_tpc_tof_static_tiny // Extension of per particle tables @@ -179,6 +183,8 @@ DECLARE_SOA_TABLE(PidTpcTofFullKa, "AOD", "PIDTPCTOFFULLKA", //! Table of the TP pid_tpc_tof_static_full::TpcTofNSigmaKa); DECLARE_SOA_TABLE(PidTpcTofFullPr, "AOD", "PIDTPCTOFFULLPR", //! Table of the TPC & TOF Combined NSigma for proton pid_tpc_tof_static_full::TpcTofNSigmaPr); +DECLARE_SOA_TABLE(PidTpcTofFullDe, "AOD", "PIDTPCTOFFULLDe", //! Table of the TPC & TOF Combined NSigma for deuteron + pid_tpc_tof_static_full::TpcTofNSigmaDe); // Extension of per particle tables DECLARE_SOA_TABLE(PidTpcTofTinyEl, "AOD", "PIDTPCTOFTINYEL", //! Table of the TPC & TOF Combined NSigma for electron @@ -191,6 +197,8 @@ DECLARE_SOA_TABLE(PidTpcTofTinyKa, "AOD", "PIDTPCTOFTINYKA", //! Table of the TP pid_tpc_tof_static_tiny::TpcTofNSigmaKa); DECLARE_SOA_TABLE(PidTpcTofTinyPr, "AOD", "PIDTPCTOFTINYPR", //! Table of the TPC & TOF Combined NSigma for proton pid_tpc_tof_static_tiny::TpcTofNSigmaPr); +DECLARE_SOA_TABLE(PidTpcTofTinyDe, "AOD", "PIDTPCTOFTINYDE", //! Table of the TPC & TOF Combined NSigma for deuteron + pid_tpc_tof_static_tiny::TpcTofNSigmaDe); namespace hf_sel_collision { @@ -517,6 +525,9 @@ DECLARE_SOA_COLUMN(NSigTpcKa2, nSigTpcKa2, float); //! TPC nSigma for DECLARE_SOA_COLUMN(NSigTpcPr0, nSigTpcPr0, float); //! TPC nSigma for proton hypothesis - prong 0 DECLARE_SOA_COLUMN(NSigTpcPr1, nSigTpcPr1, float); //! TPC nSigma for proton hypothesis - prong 1 DECLARE_SOA_COLUMN(NSigTpcPr2, nSigTpcPr2, float); //! TPC nSigma for proton hypothesis - prong 2 +DECLARE_SOA_COLUMN(NSigTpcDe0, nSigTpcDe0, float); //! TPC nSigma for deuteron hypothesis - prong 0 +DECLARE_SOA_COLUMN(NSigTpcDe1, nSigTpcDe1, float); //! TPC nSigma for deuteron hypothesis - prong 1 +DECLARE_SOA_COLUMN(NSigTpcDe2, nSigTpcDe2, float); //! TPC nSigma for deuteron hypothesis - prong 2 DECLARE_SOA_COLUMN(NSigTofPi0, nSigTofPi0, float); //! TOF nSigma for pion hypothesis - prong 0 DECLARE_SOA_COLUMN(NSigTofPi1, nSigTofPi1, float); //! TOF nSigma for pion hypothesis - prong 1 DECLARE_SOA_COLUMN(NSigTofPi2, nSigTofPi2, float); //! TOF nSigma for pion hypothesis - prong 2 @@ -526,6 +537,9 @@ DECLARE_SOA_COLUMN(NSigTofKa2, nSigTofKa2, float); //! TOF nSigma for DECLARE_SOA_COLUMN(NSigTofPr0, nSigTofPr0, float); //! TOF nSigma for proton hypothesis - prong 0 DECLARE_SOA_COLUMN(NSigTofPr1, nSigTofPr1, float); //! TOF nSigma for proton hypothesis - prong 1 DECLARE_SOA_COLUMN(NSigTofPr2, nSigTofPr2, float); //! TOF nSigma for proton hypothesis - prong 2 +DECLARE_SOA_COLUMN(NSigTofDe0, nSigTofDe0, float); //! TOF nSigma for deuteron hypothesis - prong 0 +DECLARE_SOA_COLUMN(NSigTofDe1, nSigTofDe1, float); //! TOF nSigma for deuteron hypothesis - prong 1 +DECLARE_SOA_COLUMN(NSigTofDe2, nSigTofDe2, float); //! TOF nSigma for deuteron hypothesis - prong 2 DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaPi0, tpcTofNSigmaPi0, //! Combined NSigma separation with the TPC & TOF detectors for pion - prong 0 [](float tpcNSigmaPi0, float tofNSigmaPi0) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPi0, tofNSigmaPi0); }); DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaPi1, tpcTofNSigmaPi1, //! Combined NSigma separation with the TPC & TOF detectors for pion - prong 1 @@ -544,6 +558,13 @@ DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaPr1, tpcTofNSigmaPr1, //! Combined NSigma [](float tpcNSigmaPr1, float tofNSigmaPr1) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPr1, tofNSigmaPr1); }); DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaPr2, tpcTofNSigmaPr2, //! Combined NSigma separation with the TPC & TOF detectors for proton - prong 2 [](float tpcNSigmaPr2, float tofNSigmaPr2) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPr2, tofNSigmaPr2); }); +DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaDe0, tpcTofNSigmaDe0, //! Combined NSigma separation with the TPC & TOF detectors for deuteron - prong 0 + [](float tpcNSigmaDe0, float tofNSigmaDe0) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaDe0, tofNSigmaDe0); }); +DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaDe1, tpcTofNSigmaDe1, //! Combined NSigma separation with the TPC & TOF detectors for deuteron - prong 1 + [](float tpcNSigmaDe1, float tofNSigmaDe1) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaDe1, tofNSigmaDe1); }); +DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaDe2, tpcTofNSigmaDe2, //! Combined NSigma separation with the TPC & TOF detectors for deuteron - prong 2 + [](float tpcNSigmaDe2, float tofNSigmaDe2) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaDe2, tofNSigmaDe2); }); + // tiny (binned) option DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaTinyPi0, tpcTofNSigmaTinyPi0, //! Combined NSigma separation with the TPC & TOF detectors for pion - prong 0 [](float tpcNSigmaPi0, float tofNSigmaPi0) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPi0, tofNSigmaPi0); }); @@ -980,6 +1001,7 @@ enum DecayType { DplusToPiKPi = 0, LcToPKPi, DsToKKPi, XicToPKPi, + CdToDeKPi, N3ProngDecays }; // always keep N3ProngDecays at the end // Ds± → K± K∓ π± or D± → K± K∓ π± @@ -1099,10 +1121,20 @@ DECLARE_SOA_TABLE(HfCand3Prong1PidPr, "AOD", "HFCAND3P1PIDPR", //! DECLARE_SOA_TABLE(HfCand3Prong2PidPr, "AOD", "HFCAND3P2PIDPR", //! hf_cand::NSigTpcPr2, hf_cand::NSigTofPr2, hf_cand::TpcTofNSigmaPr2); +DECLARE_SOA_TABLE(HfCand3Prong0PidDe, "AOD", "HFCAND3P0PIDDE", //! + hf_cand::NSigTpcDe0, hf_cand::NSigTofDe0, + hf_cand::TpcTofNSigmaDe0); +DECLARE_SOA_TABLE(HfCand3Prong1PidDe, "AOD", "HFCAND3P1PIDDE", //! + hf_cand::NSigTpcDe1, hf_cand::NSigTofDe1, + hf_cand::TpcTofNSigmaDe1); +DECLARE_SOA_TABLE(HfCand3Prong2PidDe, "AOD", "HFCAND3P2PIDDE", //! + hf_cand::NSigTpcDe2, hf_cand::NSigTofDe2, + hf_cand::TpcTofNSigmaDe2); using HfCand3Prong = HfCand3ProngExt; using HfCand3ProngWPidPiKaPr = soa::Join; using HfCand3ProngWPidPiKa = soa::Join; +using HfCand3ProngWPidPiKaDe = soa::Join; DECLARE_SOA_TABLE(HfCand3ProngKF, "AOD", "HFCAND3PKF", hf_cand_3prong::KfXError, hf_cand_3prong::KfYError, hf_cand_3prong::KfZError, diff --git a/PWGHF/DataModel/CandidateSelectionTables.h b/PWGHF/DataModel/CandidateSelectionTables.h index 1f7956aadd4..839c289d6f5 100644 --- a/PWGHF/DataModel/CandidateSelectionTables.h +++ b/PWGHF/DataModel/CandidateSelectionTables.h @@ -164,6 +164,14 @@ DECLARE_SOA_TABLE(HfSelLc, "AOD", "HFSELLC", //! DECLARE_SOA_TABLE(HfMlLcToPKPi, "AOD", "HFMLLc", //! hf_sel_candidate_lc::MlProbLcToPKPi, hf_sel_candidate_lc::MlProbLcToPiKP); +namespace hf_sel_candidate_cd +{ +DECLARE_SOA_COLUMN(IsSelCdToDeKPi, isSelCdToDeKPi, int); //! +DECLARE_SOA_COLUMN(IsSelCdToPiKDe, isSelCdToPiKDe, int); //! +} // namespace hf_sel_candidate_cd +DECLARE_SOA_TABLE(HfSelCd, "AOD", "HFSELCD", //! + hf_sel_candidate_cd::IsSelCdToDeKPi, hf_sel_candidate_cd::IsSelCdToPiKDe); + namespace hf_sel_candidate_lc_alice3 { DECLARE_SOA_COLUMN(IsSelLcToPKPiNoPid, isSelLcToPKPiNoPid, int); //! diff --git a/PWGHF/TableProducer/CMakeLists.txt b/PWGHF/TableProducer/CMakeLists.txt index 46364eaf9aa..25900bb9393 100644 --- a/PWGHF/TableProducer/CMakeLists.txt +++ b/PWGHF/TableProducer/CMakeLists.txt @@ -202,6 +202,11 @@ o2physics_add_dpl_workflow(candidate-selector-xicc-to-p-k-pi-pi PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(candidate-selector-cd + SOURCES candidateSelectorCd.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + # Tree creators o2physics_add_dpl_workflow(tree-creator-b0-to-d-pi diff --git a/PWGHF/TableProducer/candidateCreator3Prong.cxx b/PWGHF/TableProducer/candidateCreator3Prong.cxx index 0bf6c47fc91..ca1363ba0c8 100644 --- a/PWGHF/TableProducer/candidateCreator3Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator3Prong.cxx @@ -94,12 +94,15 @@ struct HfCandidateCreator3Prong { Produces rowProng0PidPi; Produces rowProng0PidKa; Produces rowProng0PidPr; + Produces rowProng0PidDe; Produces rowProng1PidPi; Produces rowProng1PidKa; Produces rowProng1PidPr; + Produces rowProng1PidDe; Produces rowProng2PidPi; Produces rowProng2PidKa; Produces rowProng2PidPr; + Produces rowProng2PidDe; // vertexing Configurable propagateToPCA{"propagateToPCA", true, "create tracks version propagated to PCA"}; @@ -120,6 +123,7 @@ struct HfCandidateCreator3Prong { Configurable createDs{"createDs", false, "enable Ds+/- candidate creation"}; Configurable createLc{"createLc", false, "enable Lc+/- candidate creation"}; Configurable createXic{"createXic", false, "enable Xic+/- candidate creation"}; + Configurable createCd{"createCd", false, "enable Cd candidate creation"}; // KF Configurable applyTopoConstraint{"applyTopoConstraint", false, "apply origin from PV hypothesis for created candidate, works only in KF mode"}; Configurable applyInvMassConstraint{"applyInvMassConstraint", false, "apply particle type hypothesis to recalculate created candidate's momentum, works only in KF mode"}; @@ -136,10 +140,10 @@ struct HfCandidateCreator3Prong { using FilteredHf3Prongs = soa::Filtered; using FilteredPvRefitHf3Prongs = soa::Filtered>; - using TracksWCovExtraPidPiKaPr = soa::Join; + using TracksWCovExtraPidPiKaPrDe = soa::Join; // filter candidates - Filter filterSelected3Prongs = (createDplus && (o2::aod::hf_track_index::hfflag & static_cast(BIT(DecayType::DplusToPiKPi))) != static_cast(0)) || (createDs && (o2::aod::hf_track_index::hfflag & static_cast(BIT(DecayType::DsToKKPi))) != static_cast(0)) || (createLc && (o2::aod::hf_track_index::hfflag & static_cast(BIT(DecayType::LcToPKPi))) != static_cast(0)) || (createXic && (o2::aod::hf_track_index::hfflag & static_cast(BIT(DecayType::XicToPKPi))) != static_cast(0)); + Filter filterSelected3Prongs = (createDplus && (o2::aod::hf_track_index::hfflag & static_cast(BIT(DecayType::DplusToPiKPi))) != static_cast(0)) || (createDs && (o2::aod::hf_track_index::hfflag & static_cast(BIT(DecayType::DsToKKPi))) != static_cast(0)) || (createLc && (o2::aod::hf_track_index::hfflag & static_cast(BIT(DecayType::LcToPKPi))) != static_cast(0)) || (createXic && (o2::aod::hf_track_index::hfflag & static_cast(BIT(DecayType::XicToPKPi))) != static_cast(0)) || (createCd && (o2::aod::hf_track_index::hfflag & static_cast(BIT(DecayType::CdToDeKPi))) != static_cast(0)); std::shared_ptr hCandidates; HistogramRegistry registry{"registry"}; @@ -181,13 +185,13 @@ struct HfCandidateCreator3Prong { if (nProcessesUpc > 0 && isRun2) { LOGP(fatal, "Process function for UPC is only available in Run 3!"); } - std::array creationFlags = {createDplus, createDs, createLc, createXic}; + std::array creationFlags = {createDplus, createDs, createLc, createXic, createCd}; if (std::accumulate(creationFlags.begin(), creationFlags.end(), 0) == 0) { LOGP(fatal, "At least one particle specie should be enabled for the creation."); } if (createLc && createXic && applyInvMassConstraint) { - LOGP(fatal, "Unable to apply invariant mass constraint due to ambiguity of mass hypothesis: only one of Lc and Xic can be reconstructed."); + LOGP(fatal, "Unable to apply invariant mass constraint due to ambiguity of mass hypothesis: only one of Lc and Xic and Cd can be reconstructed."); } // histograms @@ -196,6 +200,8 @@ struct HfCandidateCreator3Prong { registry.add("hMass3PiKPi", "3-prong candidates;inv. mass (#pi K#pi) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{600, 1.6, 2.2}}}); registry.add("hMass3KKPi", "3-prong candidates;inv. mass (KK #pi) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{600, 1.7, 2.3}}}); registry.add("hMass3PiKK", "3-prong candidates;inv. mass (#pi KK) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{600, 1.7, 2.3}}}); + registry.add("hMass3DeKPi", "3-prong candidates;inv. mass (deK#pi) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{2000, 2.5, 4.5}}}); + registry.add("hMass3PiKDe", "3-prong candidates;inv. mass (#pi Kde) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{2000, 2.5, 4.5}}}); registry.add("hMass2KPi", "2-prong pairs;inv. mass (K#pi) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{1200, 0.8, 2.0}}}); registry.add("hMass2PiK", "2-prong pairs;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{1200, 0.8, 2.0}}}); registry.add("hCovPVXX", "3-prong candidates;XX element of cov. matrix of prim. vtx. position (cm^{2});entries", {HistType::kTH1F, {{100, 0., 1.e-4}}}); @@ -248,12 +254,17 @@ struct HfCandidateCreator3Prong { fillProngPid(track1, rowProng1PidPr); fillProngPid(track2, rowProng2PidPr); } + if (createCd) { + fillProngPid(track0, rowProng0PidDe); + fillProngPid(track1, rowProng1PidDe); + fillProngPid(track2, rowProng2PidDe); + } } template void runCreator3ProngWithDCAFitterN(Coll const&, Cand const& rowsTrackIndexProng3, - TracksWCovExtraPidPiKaPr const&, + TracksWCovExtraPidPiKaPrDe const&, BCsType const& bcs) { // loop over triplets of track indices @@ -273,9 +284,9 @@ struct HfCandidateCreator3Prong { continue; } - auto track0 = rowTrackIndexProng3.template prong0_as(); - auto track1 = rowTrackIndexProng3.template prong1_as(); - auto track2 = rowTrackIndexProng3.template prong2_as(); + auto track0 = rowTrackIndexProng3.template prong0_as(); + auto track1 = rowTrackIndexProng3.template prong1_as(); + auto track2 = rowTrackIndexProng3.template prong2_as(); auto trackParVar0 = getTrackParCov(track0); auto trackParVar1 = getTrackParCov(track1); auto trackParVar2 = getTrackParCov(track2); @@ -410,6 +421,8 @@ struct HfCandidateCreator3Prong { const auto massPiKPi = RecoDecay::m(arrayMomenta, std::array{MassPiPlus, MassKPlus, MassPiPlus}); const auto massKKPi = RecoDecay::m(arrayMomenta, std::array{MassKPlus, MassKPlus, MassPiPlus}); const auto massPiKK = RecoDecay::m(arrayMomenta, std::array{MassPiPlus, MassKPlus, MassKPlus}); + const auto massDeKPi = RecoDecay::m(arrayMomenta, std::array{MassDeuteron, MassKPlus, MassPiPlus}); + const auto massPiKDe = RecoDecay::m(arrayMomenta, std::array{MassPiPlus, MassKPlus, MassDeuteron}); const auto massKPi = RecoDecay::m(std::array{arrayMomenta.at(1), arrayMomenta.at(2)}, std::array{MassKPlus, MassPiPlus}); const auto massPiK = RecoDecay::m(std::array{arrayMomenta.at(0), arrayMomenta.at(1)}, std::array{MassPiPlus, MassKPlus}); registry.fill(HIST("hMass3PiKPi"), massPiKPi); @@ -417,6 +430,8 @@ struct HfCandidateCreator3Prong { registry.fill(HIST("hMass3PiKP"), massPiKP); registry.fill(HIST("hMass3KKPi"), massKKPi); registry.fill(HIST("hMass3PiKK"), massPiKK); + registry.fill(HIST("hMass3DeKPi"), massDeKPi); + registry.fill(HIST("hMass3PiKDe"), massPiKDe); registry.fill(HIST("hMass2KPi"), massKPi); registry.fill(HIST("hMass2PiK"), massPiK); } @@ -426,7 +441,7 @@ struct HfCandidateCreator3Prong { template void runCreator3ProngWithKFParticle(Coll const&, Cand const& rowsTrackIndexProng3, - TracksWCovExtraPidPiKaPr const&, + TracksWCovExtraPidPiKaPrDe const&, BCsType const& bcs) { for (const auto& rowTrackIndexProng3 : rowsTrackIndexProng3) { @@ -444,9 +459,9 @@ struct HfCandidateCreator3Prong { continue; } - auto track0 = rowTrackIndexProng3.template prong0_as(); - auto track1 = rowTrackIndexProng3.template prong1_as(); - auto track2 = rowTrackIndexProng3.template prong2_as(); + auto track0 = rowTrackIndexProng3.template prong0_as(); + auto track1 = rowTrackIndexProng3.template prong1_as(); + auto track2 = rowTrackIndexProng3.template prong2_as(); /// Set the magnetic field from ccdb. /// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, @@ -675,7 +690,7 @@ struct HfCandidateCreator3Prong { /// @brief process function using DCA fitter w/ PV refit and w/o centrality selections void processPvRefitWithDCAFitterN(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, - TracksWCovExtraPidPiKaPr const& tracks, + TracksWCovExtraPidPiKaPrDe const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); @@ -685,7 +700,7 @@ struct HfCandidateCreator3Prong { /// @brief process function using DCA fitter w/o PV refit and w/o centrality selections void processNoPvRefitWithDCAFitterN(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, - TracksWCovExtraPidPiKaPr const& tracks, + TracksWCovExtraPidPiKaPrDe const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); @@ -695,7 +710,7 @@ struct HfCandidateCreator3Prong { /// @brief process function using KFParticle package w/ PV refit and w/o centrality selections void processPvRefitWithKFParticle(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, - TracksWCovExtraPidPiKaPr const& tracks, + TracksWCovExtraPidPiKaPrDe const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); @@ -705,7 +720,7 @@ struct HfCandidateCreator3Prong { /// @brief process function using KFParticle package w/o PV refit and w/o centrality selections void processNoPvRefitWithKFParticle(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, - TracksWCovExtraPidPiKaPr const& tracks, + TracksWCovExtraPidPiKaPrDe const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); @@ -721,7 +736,7 @@ struct HfCandidateCreator3Prong { /// @brief process function using DCA fitter w/ PV refit and w/ centrality selection on FT0C void processPvRefitWithDCAFitterNCentFT0C(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, - TracksWCovExtraPidPiKaPr const& tracks, + TracksWCovExtraPidPiKaPrDe const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); @@ -731,7 +746,7 @@ struct HfCandidateCreator3Prong { /// @brief process function using DCA fitter w/o PV refit and w/ centrality selection on FT0C void processNoPvRefitWithDCAFitterNCentFT0C(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, - TracksWCovExtraPidPiKaPr const& tracks, + TracksWCovExtraPidPiKaPrDe const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); @@ -741,7 +756,7 @@ struct HfCandidateCreator3Prong { /// @brief process function using KFParticle package w/ PV refit and w/ centrality selection on FT0C void processPvRefitWithKFParticleCentFT0C(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, - TracksWCovExtraPidPiKaPr const& tracks, + TracksWCovExtraPidPiKaPrDe const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); @@ -751,7 +766,7 @@ struct HfCandidateCreator3Prong { /// @brief process function using KFParticle package w/o PV refit and w/ centrality selection on FT0C void processNoPvRefitWithKFParticleCentFT0C(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, - TracksWCovExtraPidPiKaPr const& tracks, + TracksWCovExtraPidPiKaPrDe const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); @@ -767,7 +782,7 @@ struct HfCandidateCreator3Prong { /// @brief process function using DCA fitter w/ PV refit and w/ centrality selection on FT0M void processPvRefitWithDCAFitterNCentFT0M(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, - TracksWCovExtraPidPiKaPr const& tracks, + TracksWCovExtraPidPiKaPrDe const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); @@ -777,7 +792,7 @@ struct HfCandidateCreator3Prong { /// @brief process function using DCA fitter w/o PV refit and w/ centrality selection on FT0M void processNoPvRefitWithDCAFitterNCentFT0M(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, - TracksWCovExtraPidPiKaPr const& tracks, + TracksWCovExtraPidPiKaPrDe const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); @@ -787,7 +802,7 @@ struct HfCandidateCreator3Prong { /// @brief process function using KFParticle package w/ PV refit and w/ centrality selection on FT0M void processPvRefitWithKFParticleCentFT0M(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, - TracksWCovExtraPidPiKaPr const& tracks, + TracksWCovExtraPidPiKaPrDe const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); @@ -797,7 +812,7 @@ struct HfCandidateCreator3Prong { /// @brief process function using KFParticle package w/o PV refit and w/ centrality selection on FT0M void processNoPvRefitWithKFParticleCentFT0M(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, - TracksWCovExtraPidPiKaPr const& tracks, + TracksWCovExtraPidPiKaPrDe const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); @@ -813,7 +828,7 @@ struct HfCandidateCreator3Prong { /// @brief process function using DCA fitter w/ PV refit and w/ centrality selection on UPC void processPvRefitWithDCAFitterNUpc(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, - TracksWCovExtraPidPiKaPr const& tracks, + TracksWCovExtraPidPiKaPrDe const& tracks, aod::BcFullInfos const& bcWithTimeStamps, aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0as*/, @@ -827,7 +842,7 @@ struct HfCandidateCreator3Prong { /// @brief process function using DCA fitter w/o PV refit and w/ centrality selection on UPC void processNoPvRefitWithDCAFitterNUpc(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, - TracksWCovExtraPidPiKaPr const& tracks, + TracksWCovExtraPidPiKaPrDe const& tracks, aod::BcFullInfos const& bcWithTimeStamps, aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0as*/, @@ -841,7 +856,7 @@ struct HfCandidateCreator3Prong { /// @brief process function using KFParticle package w/ PV refit and w/ centrality selection on UPC void processPvRefitWithKFParticleUpc(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, - TracksWCovExtraPidPiKaPr const& tracks, + TracksWCovExtraPidPiKaPrDe const& tracks, aod::BcFullInfos const& bcWithTimeStamps, aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0as*/, @@ -855,7 +870,7 @@ struct HfCandidateCreator3Prong { /// @brief process function using KFParticle package w/o PV refit and w/ centrality selection on UPC void processNoPvRefitWithKFParticleUpc(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, - TracksWCovExtraPidPiKaPr const& tracks, + TracksWCovExtraPidPiKaPrDe const& tracks, aod::BcFullInfos const& bcWithTimeStamps, aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0as*/, diff --git a/PWGHF/TableProducer/candidateSelectorCd.cxx b/PWGHF/TableProducer/candidateSelectorCd.cxx new file mode 100644 index 00000000000..4eb1c0e2e95 --- /dev/null +++ b/PWGHF/TableProducer/candidateSelectorCd.cxx @@ -0,0 +1,384 @@ +// 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 candidateSelectorCd.cxx +/// \brief Cd± → d± K∓ π± selection task +/// +/// \author Biao Zhang , Heidelberg Universiity + +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" + +#include "Common/Core/TrackSelectorPID.h" +#include "Common/DataModel/PIDResponseCombined.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +using namespace o2; +using namespace o2::analysis; +using namespace o2::framework; + +/// Struct for applying Cd selection cuts +struct HfCandidateSelectorCd { + Produces hfSelCdCandidate; + + Configurable ptCandMin{"ptCandMin", 0., "Lower bound of candidate pT"}; + Configurable ptCandMax{"ptCandMax", 36., "Upper bound of candidate pT"}; + Configurable usePid{"usePid", true, "Bool to use or not the PID based on nSigma cut at filtering level"}; + // TPC PID + Configurable ptPidTpcMin{"ptPidTpcMin", 0.1, "Lower bound of track pT for TPC PID"}; + Configurable ptPidTpcMax{"ptPidTpcMax", 1., "Upper bound of track pT for TPC PID"}; + Configurable nSigmaTpcMax{"nSigmaTpcMax", 3., "Nsigma cut on TPC only"}; + Configurable nSigmaTpcCombinedMax{"nSigmaTpcCombinedMax", 5., "Nsigma cut on TPC combined with TOF"}; + // TOF PID + Configurable ptPidTofMin{"ptPidTofMin", 0.5, "Lower bound of track pT for TOF PID"}; + Configurable ptPidTofMax{"ptPidTofMax", 2.5, "Upper bound of track pT for TOF PID"}; + Configurable nSigmaTofMax{"nSigmaTofMax", 3., "Nsigma cut on TOF only"}; + Configurable nSigmaTofCombinedMax{"nSigmaTofCombinedMax", 5., "Nsigma cut on TOF combined with TPC"}; + // Combined PID options + Configurable usePidTpcAndTof{"usePidTpcAndTof", false, "Bool to decide how to combine TPC and TOF PID: true = both (if present, only one otherwise); false = one is enough"}; + // TPC quality track cuts + Configurable tpcNClustersFoundMin{"tpcNClustersFoundMin", 0, "min number of found TPC clusters"}; + Configurable tpcNCrossedRowsMin{"tpcNCrossedRowsMin", 0, "min number of crossed rows in TPC"}; + Configurable tpcNCrossedRowsOverFindableClustersMin{"tpcNCrossedRowsOverFindableClustersMin", 0., "min ratio crossed rows / findable clusters"}; + Configurable tpcChi2PerClusterMax{"tpcChi2PerClusterMax", 1e10f, "max tpc fit chi2 per TPC cluster"}; + // ITS quality track cuts + Configurable itsNClustersFoundMin{"itsNClustersFoundMin", 0, "min. number of found ITS clusters"}; + Configurable itsChi2PerClusterMax{"itsChi2PerClusterMax", 1e10f, "max its fit chi2 per ITS cluster"}; + // DCA track cuts + Configurable> binsPtTrack{"binsPtTrack", std::vector{hf_cuts_single_track::vecBinsPtTrack}, "track pT bin limits for DCA XY/Z pT-dependent cut"}; + Configurable> cutsSingleTrack{"cutsSingleTrack", {hf_cuts_single_track::CutsTrack[0], hf_cuts_single_track::NBinsPtTrack, hf_cuts_single_track::NCutVarsTrack, hf_cuts_single_track::labelsPtTrack, hf_cuts_single_track::labelsCutVarTrack}, "Single-track selections"}; + // topological cuts + Configurable> binsPt{"binsPt", std::vector{hf_cuts_cd_to_de_k_pi::vecBinsPt}, "pT bin limits"}; + Configurable> cuts{"cuts", {hf_cuts_cd_to_de_k_pi::Cuts[0], hf_cuts_cd_to_de_k_pi::NBinsPt, hf_cuts_cd_to_de_k_pi::NCutVars, hf_cuts_cd_to_de_k_pi::labelsPt, hf_cuts_cd_to_de_k_pi::labelsCutVar}, "Cd candidate selection per pT bin"}; + // QA switch + Configurable activateQA{"activateQA", false, "Flag to enable QA histogram"}; + + HfHelper hfHelper; + + TrackSelectorPi selectorPion; + TrackSelectorKa selectorKaon; + TrackSelectorDe selectorDeuteron; + + const float massCharmDeuteron = 3.23; // possible mass + + using TracksSel = soa::Join; + + HistogramRegistry registry{"registry"}; + + void init(InitContext const&) + { + + selectorPion.setRangePtTpc(ptPidTpcMin, ptPidTpcMax); + selectorPion.setRangeNSigmaTpc(-nSigmaTpcMax, nSigmaTpcMax); + selectorPion.setRangeNSigmaTpcCondTof(-nSigmaTpcCombinedMax, nSigmaTpcCombinedMax); + selectorPion.setRangePtTof(ptPidTofMin, ptPidTofMax); + selectorPion.setRangeNSigmaTof(-nSigmaTofMax, nSigmaTofMax); + selectorPion.setRangeNSigmaTofCondTpc(-nSigmaTofCombinedMax, nSigmaTofCombinedMax); + selectorKaon = selectorPion; + selectorDeuteron = selectorPion; + + if (activateQA) { + constexpr int kNBinsSelections = aod::SelectionStep::NSelectionSteps; + std::string labels[kNBinsSelections]; + labels[0] = "No selection"; + labels[1 + aod::SelectionStep::RecoSkims] = "Skims selection"; + labels[1 + aod::SelectionStep::RecoTopol] = "Skims & Topological selections"; + labels[1 + aod::SelectionStep::RecoPID] = "Skims & Topological & PID selections"; + static const AxisSpec axisSelections = {kNBinsSelections, 0.5, kNBinsSelections + 0.5, ""}; + registry.add("hSelections", "Selections;;#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {axisSelections, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + for (int iBin = 0; iBin < kNBinsSelections; ++iBin) { + registry.get(HIST("hSelections"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data()); + } + } + } + + /// Single track quality cuts + /// \param track is track + /// \return true if track passes all cuts + template + bool isSelectedCandidateProngQuality(const T& trackPos1, const T& trackNeg, const T& trackPos2) + { + if (!isSelectedTrackTpcQuality(trackPos1, tpcNClustersFoundMin.value, tpcNCrossedRowsMin.value, tpcNCrossedRowsOverFindableClustersMin.value, tpcChi2PerClusterMax.value) || + !isSelectedTrackTpcQuality(trackNeg, tpcNClustersFoundMin.value, tpcNCrossedRowsMin.value, tpcNCrossedRowsOverFindableClustersMin.value, tpcChi2PerClusterMax.value) || + !isSelectedTrackTpcQuality(trackPos2, tpcNClustersFoundMin.value, tpcNCrossedRowsMin.value, tpcNCrossedRowsOverFindableClustersMin.value, tpcChi2PerClusterMax.value)) { + return false; + } + if (!isSelectedTrackItsQuality(trackPos1, itsNClustersFoundMin.value, itsChi2PerClusterMax.value) || + !isSelectedTrackItsQuality(trackNeg, itsNClustersFoundMin.value, itsChi2PerClusterMax.value) || + !isSelectedTrackItsQuality(trackPos2, itsNClustersFoundMin.value, itsChi2PerClusterMax.value)) { + return false; + } + return true; + } + + /// Conjugate-independent topological cuts + /// \param candidate is candidate + /// \return true if candidate passes all cuts + template + bool selectionTopol(const T& candidate) + { + auto ptCand = candidate.pt(); + + int const binPt = findBin(binsPt, ptCand); + if (binPt == -1) { + return false; + } + + // check that the candidate pT is within the analysis range + if (ptCand < ptCandMin || ptCand >= ptCandMax) { + return false; + } + + // cosine of pointing angle + if (candidate.cpa() <= cuts->get(binPt, "cos pointing angle")) { + return false; + } + + // candidate chi2PCA + if (candidate.chi2PCA() > cuts->get(binPt, "Chi2PCA")) { + return false; + } + + if (candidate.decayLength() <= cuts->get(binPt, "decay length")) { + return false; + } + + // candidate decay length XY + if (candidate.decayLengthXY() <= cuts->get(binPt, "decLengthXY")) { + return false; + } + + // candidate normalized decay length XY + if (candidate.decayLengthXYNormalised() < cuts->get(binPt, "normDecLXY")) { + return false; + } + + // candidate impact parameter XY + if (std::abs(candidate.impactParameterXY()) > cuts->get(binPt, "impParXY")) { + return false; + } + + if (!isSelectedCandidateProngDca(candidate)) { + return false; + } + + return true; + } + + /// Conjugate-dependent topological cuts + /// \param candidate is candidate + /// \param trackDeuteron is the track with the deuteron hypothesis + /// \param trackPion is the track with the pion hypothesis + /// \param trackKaon is the track with the kaon hypothesis + /// \return true if candidate passes all cuts for the given Conjugate + template + bool selectionTopolConjugate(const T1& candidate, const T2& trackDeuteron, const T2& trackKaon, const T2& trackPion) + { + + auto ptCand = candidate.pt(); + int const binPt = findBin(binsPt, ptCand); + if (binPt == -1) { + return false; + } + + // cut on daughter pT + if (trackDeuteron.pt() < cuts->get(binPt, "pT De") || trackKaon.pt() < cuts->get(binPt, "pT K") || trackPion.pt() < cuts->get(binPt, "pT Pi")) { + return false; + } + + float massCd{0.f}; + if (trackDeuteron.globalIndex() == candidate.prong0Id()) { + massCd = hfHelper.invMassCdToDeKPi(candidate); + } else { + massCd = hfHelper.invMassCdToPiKDe(candidate); + } + + // cut on Cd->deKpi, piKde mass values + if (std::abs(massCd - massCharmDeuteron) > cuts->get(binPt, "m")) { + return false; + } + + return true; + } + + /// Single-track dca_xy and dca_z cuts + /// \param candidate is the Cd candidate + /// \return true if all the prongs pass the selections + template + bool isSelectedCandidateProngDca(const T1& candidate) + { + return (isSelectedTrackDca(binsPtTrack, cutsSingleTrack, candidate.ptProng0(), candidate.impactParameter0(), candidate.impactParameterZ0()) && + isSelectedTrackDca(binsPtTrack, cutsSingleTrack, candidate.ptProng1(), candidate.impactParameter1(), candidate.impactParameterZ1()) && + isSelectedTrackDca(binsPtTrack, cutsSingleTrack, candidate.ptProng2(), candidate.impactParameter2(), candidate.impactParameterZ2())); + } + + /// Apply PID selection + /// \param pidTrackDeuteron is the PID status of deuteron candidate track + /// \param pidTrackKaon is the PID status of kaon candidate track + /// \param pidTrackPion is the PID status of pion candidate track + /// \return true if prongs pass all selections + bool isSelectedPID(const TrackSelectorPID::Status pidTrackDeuteron, const TrackSelectorPID::Status pidTrackKaon, const TrackSelectorPID::Status pidTrackPion) + { + return pidTrackDeuteron != TrackSelectorPID::Rejected && + pidTrackKaon != TrackSelectorPID::Rejected && + pidTrackPion != TrackSelectorPID::Rejected; + } + + /// \brief function to apply Cd selections + /// \param reconstructionType is the reconstruction type (DCAFitterN ) + /// \param candidates Cd candidate table + /// \param tracks track table + template + void runSelectCd(CandType const& candidates, TTracks const&) + { + // looping over 3-prong candidates + for (const auto& candidate : candidates) { + + // final selection flag + auto statusCdToDeKPi = 0; + auto statusCdToPiKDe = 0; + + auto ptCand = candidate.pt(); + + if (!(candidate.hfflag() & 1 << aod::hf_cand_3prong::DecayType::CdToDeKPi)) { + hfSelCdCandidate(statusCdToDeKPi, statusCdToPiKDe); + if (activateQA) { + registry.fill(HIST("hSelections"), 1, ptCand); + } + continue; + } + + if (activateQA) { + registry.fill(HIST("hSelections"), 2 + aod::SelectionStep::RecoSkims, ptCand); + } + + auto trackPos1 = candidate.template prong0_as(); // positive daughter (negative for the antiparticles) + auto trackNeg = candidate.template prong1_as(); // negative daughter (positive for the antiparticles) + auto trackPos2 = candidate.template prong2_as(); // positive daughter (negative for the antiparticles) + + // implement filter bit 4 cut - should be done before this task at the track selection level + + // track quality selection + bool const trackQualitySel = isSelectedCandidateProngQuality(trackPos1, trackNeg, trackPos2); + if (!trackQualitySel) { + hfSelCdCandidate(statusCdToDeKPi, statusCdToPiKDe); + continue; + } + + // conjugate-independent topological selection + if (!selectionTopol(candidate)) { + hfSelCdCandidate(statusCdToDeKPi, statusCdToPiKDe); + continue; + } + + // conjugate-dependent topological selection for Cd + bool const topolCdToDeKPi = selectionTopolConjugate(candidate, trackPos1, trackNeg, trackPos2); + bool const topolCdToPiKDe = selectionTopolConjugate(candidate, trackPos2, trackNeg, trackPos1); + + if (!topolCdToDeKPi && !topolCdToPiKDe) { + hfSelCdCandidate(statusCdToDeKPi, statusCdToPiKDe); + continue; + } + + if (activateQA) { + registry.fill(HIST("hSelections"), 2 + aod::SelectionStep::RecoTopol, candidate.pt()); + } + + // PID not applied, accepted by default + auto pidCdToDeKPi = 1; + auto pidCdToPiKDe = 1; + + if (usePid) { + // track-level PID selection + TrackSelectorPID::Status pidTrackPos1Deuteron; + TrackSelectorPID::Status pidTrackPos2Deuteron; + TrackSelectorPID::Status pidTrackPos1Pion; + TrackSelectorPID::Status pidTrackPos2Pion; + TrackSelectorPID::Status pidTrackNegKaon; + if (usePidTpcAndTof) { + pidTrackPos1Deuteron = selectorDeuteron.statusTpcAndTof(trackPos1, candidate.nSigTpcDe0(), candidate.nSigTofDe0()); + pidTrackPos2Deuteron = selectorDeuteron.statusTpcAndTof(trackPos2, candidate.nSigTpcDe2(), candidate.nSigTofDe2()); + pidTrackPos1Pion = selectorPion.statusTpcAndTof(trackPos1, candidate.nSigTpcPi0(), candidate.nSigTofPi0()); + pidTrackPos2Pion = selectorPion.statusTpcAndTof(trackPos2, candidate.nSigTpcPi2(), candidate.nSigTofPi2()); + pidTrackNegKaon = selectorKaon.statusTpcAndTof(trackNeg, candidate.nSigTpcKa1(), candidate.nSigTofKa1()); + } else { + pidTrackPos1Deuteron = selectorDeuteron.statusTpcOrTof(trackPos1, candidate.nSigTpcDe0(), candidate.nSigTofDe0()); + pidTrackPos2Deuteron = selectorDeuteron.statusTpcOrTof(trackPos2, candidate.nSigTpcDe2(), candidate.nSigTofDe2()); + pidTrackPos1Pion = selectorPion.statusTpcOrTof(trackPos1, candidate.nSigTpcPi0(), candidate.nSigTofPi0()); + pidTrackPos2Pion = selectorPion.statusTpcOrTof(trackPos2, candidate.nSigTpcPi2(), candidate.nSigTofPi2()); + pidTrackNegKaon = selectorKaon.statusTpcOrTof(trackNeg, candidate.nSigTpcKa1(), candidate.nSigTofKa1()); + } + + if (!isSelectedPID(pidTrackPos1Deuteron, pidTrackNegKaon, pidTrackPos2Pion)) { + pidCdToDeKPi = 0; // reject CdToDeKPi + } + if (!isSelectedPID(pidTrackPos2Deuteron, pidTrackNegKaon, pidTrackPos1Pion)) { + pidCdToPiKDe = 0; // accept CdToPiKDe + } + } + + if (pidCdToDeKPi == 0 && pidCdToPiKDe == 0) { + hfSelCdCandidate(statusCdToDeKPi, statusCdToPiKDe); + continue; + } + + if (activateQA) { + registry.fill(HIST("hSelections"), 2 + aod::SelectionStep::RecoPID, candidate.pt()); + } + + if (pidCdToDeKPi == 1 && topolCdToDeKPi && trackQualitySel) { + statusCdToDeKPi = 1; // identified as CdToDeKPi + } + if (pidCdToPiKDe == 1 && topolCdToPiKDe && trackQualitySel) { + statusCdToPiKDe = 1; // identified as CdToPiKDe + } + + hfSelCdCandidate(statusCdToDeKPi, statusCdToPiKDe); + } + } + + /// \brief process function with DCAFitterN + /// \param candidates Cd candidate table + /// \param tracks track table + void processCdWithDCAFitterN(aod::HfCand3ProngWPidPiKaDe const& candidates, + TracksSel const& tracks) + { + runSelectCd(candidates, tracks); + } + PROCESS_SWITCH(HfCandidateSelectorCd, processCdWithDCAFitterN, "Process Cd selection with DCAFitterN", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGHF/TableProducer/pidCreator.cxx b/PWGHF/TableProducer/pidCreator.cxx index e011b18cf9b..e914c4f1c38 100644 --- a/PWGHF/TableProducer/pidCreator.cxx +++ b/PWGHF/TableProducer/pidCreator.cxx @@ -44,6 +44,8 @@ struct HfPidCreator { Produces trackPidTinyKa; Produces trackPidFullPr; Produces trackPidTinyPr; + Produces trackPidFullDe; + Produces trackPidTinyDe; static constexpr float NSigmaToleranceDefault = .1f; static constexpr float NSigmaDefault = -999.f + NSigmaToleranceDefault; // -999.f is the default value set in TPCPIDResponse.h and PIDTOF.h @@ -79,6 +81,8 @@ struct HfPidCreator { checkTableSwitch(initContext, "PidTpcTofTinyKa", doprocessTinyKa); checkTableSwitch(initContext, "PidTpcTofFullPr", doprocessFullPr); checkTableSwitch(initContext, "PidTpcTofTinyPr", doprocessTinyPr); + checkTableSwitch(initContext, "PidTpcTofFullDe", doprocessFullDe); + checkTableSwitch(initContext, "PidTpcTofTinyDe", doprocessTinyDe); } /// Function to combine TPC and TOF NSigma @@ -132,6 +136,7 @@ struct HfPidCreator { PROCESS_PID(Pi) PROCESS_PID(Ka) PROCESS_PID(Pr) + PROCESS_PID(De) #undef PROCESS_PID }; diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index f95eb86a58a..f556be3170e 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -120,6 +120,7 @@ enum ChannelsProtonPid { }; // kaon PID (opposite-sign track in 3-prong decays) constexpr int ChannelKaonPid = ChannelsProtonPid::NChannelsProtonPid; +constexpr int ChannelsDeuteronPid = ChannelsProtonPid::NChannelsProtonPid + 1; /// Event selection struct HfTrackIndexSkimCreatorTagSelCollisions { @@ -307,7 +308,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { Configurable useIsGlobalTrackWoDCAForSoftPion{"useIsGlobalTrackWoDCAForSoftPion", false, "check isGlobalTrackWoDCA status for soft pion tracks"}; Configurable useIsQualityTrackITSForSoftPion{"useIsQualityTrackITSForSoftPion", true, "check qualityTracksITS status for soft pion tracks"}; // proton PID, applied only if corresponding process function enabled - Configurable> selectionsPid{"selectionsPid", {hf_presel_pid::CutsPid[0], 4, 6, hf_presel_pid::labelsRowsPid, hf_presel_pid::labelsCutsPid}, "PID selections for proton / kaon applied if proper process function enabled"}; + Configurable> selectionsPid{"selectionsPid", {hf_presel_pid::CutsPid[0], 5, 6, hf_presel_pid::labelsRowsPid, hf_presel_pid::labelsCutsPid}, "PID selections for proton / kaon / deuteron applied if proper process function enabled"}; // CCDB Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable ccdbPathLut{"ccdbPathLut", "GLO/Param/MatLUT", "Path for LUT parametrization"}; @@ -324,9 +325,9 @@ struct HfTrackIndexSkimCreatorTagSelTracks { int runNumber{}; using TracksWithSelAndDca = soa::Join; - using TracksWithSelAndDcaAndPidTpc = soa::Join; - using TracksWithSelAndDcaAndPidTof = soa::Join; - using TracksWithSelAndDcaAndPidTpcTof = soa::Join; + using TracksWithSelAndDcaAndPidTpc = soa::Join; + using TracksWithSelAndDcaAndPidTof = soa::Join; + using TracksWithSelAndDcaAndPidTpcTof = soa::Join; Preslice perCol = aod::track::collisionId; Preslice trackIndicesPerCollision = aod::track_association::collisionId; @@ -338,6 +339,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { // proton PID, if enabled std::array selectorProton{}; TrackSelectorKa selectorKaon; + TrackSelectorDe selectorDeuteron; Partition pvContributors = ((aod::track::flags & static_cast(aod::track::PVContributor)) == static_cast(aod::track::PVContributor)); Partition pvContributorsWithPidTpc = ((aod::track::flags & static_cast(aod::track::PVContributor)) == static_cast(aod::track::PVContributor)); @@ -460,6 +462,11 @@ struct HfTrackIndexSkimCreatorTagSelTracks { selectorKaon.setRangePtTof(config.selectionsPid->get(ChannelKaonPid, 3u), config.selectionsPid->get(ChannelKaonPid, 4u)); // 3u == "minPtTof, 4u == "maxPtTof" selectorKaon.setRangeNSigmaTpc(-config.selectionsPid->get(ChannelKaonPid, 2u), config.selectionsPid->get(ChannelKaonPid, 2u)); // 2u == "nSigmaMaxTpc" selectorKaon.setRangeNSigmaTof(-config.selectionsPid->get(ChannelKaonPid, 5u), config.selectionsPid->get(ChannelKaonPid, 5u)); // 5u == "nSigmaMaxTof" + + selectorDeuteron.setRangePtTpc(config.selectionsPid->get(ChannelsDeuteronPid, 0u), config.selectionsPid->get(ChannelsDeuteronPid, 1u)); // 0u == "minPtTpc", 1u == "maxPtTpc" + selectorDeuteron.setRangePtTof(config.selectionsPid->get(ChannelsDeuteronPid, 3u), config.selectionsPid->get(ChannelsDeuteronPid, 4u)); // 3u == "minPtTof, 4u == "maxPtTof" + selectorDeuteron.setRangeNSigmaTpc(-config.selectionsPid->get(ChannelsDeuteronPid, 2u), config.selectionsPid->get(ChannelsDeuteronPid, 2u)); // 2u == "nSigmaMaxTpc" + selectorDeuteron.setRangeNSigmaTof(-config.selectionsPid->get(ChannelsDeuteronPid, 5u), config.selectionsPid->get(ChannelsDeuteronPid, 5u)); // 5u == "nSigmaMaxTof" } /// PID track cuts (for proton only) @@ -468,13 +475,14 @@ struct HfTrackIndexSkimCreatorTagSelTracks { template uint8_t isSelectedPid(const T& hfTrack) { - std::array statusPid{TrackSelectorPID::Accepted, TrackSelectorPID::Accepted, TrackSelectorPID::Accepted, TrackSelectorPID::Accepted}; + std::array statusPid{TrackSelectorPID::Accepted, TrackSelectorPID::Accepted, TrackSelectorPID::Accepted, TrackSelectorPID::Accepted, TrackSelectorPID::Accepted}; if constexpr (PidStrategy == ProtonPidStrategy::PidTofOnly) { if (hfTrack.hasTOF()) { for (auto iChannel{0u}; iChannel < ChannelsProtonPid::NChannelsProtonPid; ++iChannel) { statusPid[iChannel] = selectorProton[iChannel].statusTof(hfTrack); } statusPid[ChannelKaonPid] = selectorKaon.statusTof(hfTrack); + statusPid[ChannelsDeuteronPid] = selectorDeuteron.statusTof(hfTrack); } } if constexpr (PidStrategy == ProtonPidStrategy::PidTpcOnly) { @@ -483,6 +491,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { statusPid[iChannel] = selectorProton[iChannel].statusTpc(hfTrack); } statusPid[ChannelKaonPid] = selectorKaon.statusTpc(hfTrack); + statusPid[ChannelsDeuteronPid] = selectorDeuteron.statusTpc(hfTrack); } } if constexpr (PidStrategy == ProtonPidStrategy::PidTpcOrTof) { @@ -490,16 +499,18 @@ struct HfTrackIndexSkimCreatorTagSelTracks { statusPid[iChannel] = selectorProton[iChannel].statusTpcOrTof(hfTrack); } statusPid[ChannelKaonPid] = selectorKaon.statusTpcOrTof(hfTrack); + statusPid[ChannelsDeuteronPid] = selectorDeuteron.statusTpcOrTof(hfTrack); } if constexpr (PidStrategy == ProtonPidStrategy::PidTpcAndTof) { for (auto iChannel{0u}; iChannel < ChannelsProtonPid::NChannelsProtonPid; ++iChannel) { statusPid[iChannel] = selectorProton[iChannel].statusTpcAndTof(hfTrack); } statusPid[ChannelKaonPid] = selectorKaon.statusTpcAndTof(hfTrack); + statusPid[ChannelsDeuteronPid] = selectorDeuteron.statusTpcAndTof(hfTrack); } - int8_t flag = BIT(ChannelsProtonPid::NChannelsProtonPid + 1) - 1; // all bits on (including the kaon one) - for (auto iChannel{0u}; iChannel < ChannelsProtonPid::NChannelsProtonPid + 1; ++iChannel) { + int8_t flag = BIT(ChannelsProtonPid::NChannelsProtonPid + 2) - 1; // all bits on (including the kaon one) + for (auto iChannel{0u}; iChannel < ChannelsProtonPid::NChannelsProtonPid + 2; ++iChannel) { if (statusPid[iChannel] == TrackSelectorPID::Rejected) { CLRBIT(flag, iChannel); } @@ -1232,6 +1243,10 @@ struct HfTrackIndexSkimCreator { // Xic+ cuts Configurable> binsPtXicToPKPi{"binsPtXicToPKPi", std::vector{hf_cuts_presel_3prong::vecBinsPt}, "pT bin limits for Xic->pKpi pT-dependent cuts"}; Configurable> cutsXicToPKPi{"cutsXicToPKPi", {hf_cuts_presel_3prong::Cuts[0], hf_cuts_presel_3prong::NBinsPt, hf_cuts_presel_3prong::NCutVars, hf_cuts_presel_3prong::labelsPt, hf_cuts_presel_3prong::labelsCutVar}, "Xic->pKpi selections per pT bin"}; + // Cd cuts + Configurable> binsPtCdToDeKPi{"binsPtCdToDeKPi", std::vector{hf_cuts_presel_3prong::vecBinsPt}, "pT bin limits for Cd->DeKpi pT-dependent cuts"}; + Configurable> cutsCdToDeKPi{"cutsCdToDeKPi", {hf_cuts_presel_3prong::Cuts[0], hf_cuts_presel_3prong::NBinsPt, hf_cuts_presel_3prong::NCutVars, hf_cuts_presel_3prong::labelsPt, hf_cuts_presel_3prong::labelsCutVar}, "Cd->deKpi selections per pT bin"}; + // D*+ cuts Configurable> binsPtDstarToD0Pi{"binsPtDstarToD0Pi", std::vector{hf_cuts_presel_dstar::vecBinsPt}, "pT bin limits for D*+->D0pi pT-dependent cuts"}; Configurable> cutsDstarToD0Pi{"cutsDstarToD0Pi", {hf_cuts_presel_dstar::Cuts[0], hf_cuts_presel_dstar::NBinsPt, hf_cuts_presel_dstar::NCutVars, hf_cuts_presel_dstar::labelsPt, hf_cuts_presel_dstar::labelsCutVar}, "D*+->D0pi selections per pT bin"}; @@ -1240,7 +1255,7 @@ struct HfTrackIndexSkimCreator { Configurable applyProtonPidForLcToPKPi{"applyProtonPidForLcToPKPi", false, "Apply proton PID for Lc->pKpi"}; Configurable applyProtonPidForXicToPKPi{"applyProtonPidForXicToPKPi", false, "Apply proton PID for Xic->pKpi"}; Configurable applyKaonPidIn3Prongs{"applyKaonPidIn3Prongs", false, "Apply kaon PID for opposite-sign track in 3-prong and D* decays"}; - + Configurable applyDeuteronPidForCdToDeKPi{"applyDeuteronPidForCdToDeKPi", false, "Require deuteron PID for Cd->deKpi"}; // ML models for triggers Configurable applyMlForHfFilters{"applyMlForHfFilters", false, "Flag to enable ML application for HF Filters"}; Configurable mlModelPathCCDB{"mlModelPathCCDB", "EventFiltering/PWGHF/BDTSmeared", "Path on CCDB of ML models for HF Filters"}; @@ -1267,11 +1282,11 @@ struct HfTrackIndexSkimCreator { // int nColls{0}; //can be added to run over limited collisions per file - for tesing purposes - static constexpr int kN2ProngDecays = hf_cand_2prong::DecayType::N2ProngDecays; // number of 2-prong hadron types - static constexpr int kN3ProngDecays = hf_cand_3prong::DecayType::N3ProngDecays; // number of 3-prong hadron types - static constexpr int kNCuts2Prong[kN2ProngDecays] = {hf_cuts_presel_2prong::NCutVars, hf_cuts_presel_2prong::NCutVars, hf_cuts_presel_2prong::NCutVars}; // how many different selections are made on 2-prongs - static constexpr int kNCuts3Prong[kN3ProngDecays] = {hf_cuts_presel_3prong::NCutVars, hf_cuts_presel_3prong::NCutVars + 1, hf_cuts_presel_ds::NCutVars, hf_cuts_presel_3prong::NCutVars + 1}; // how many different selections are made on 3-prongs (Lc and Xic have also PID potentially) - static constexpr int kNCutsDstar = 3; // how many different selections are made on Dstars + static constexpr int kN2ProngDecays = hf_cand_2prong::DecayType::N2ProngDecays; // number of 2-prong hadron types + static constexpr int kN3ProngDecays = hf_cand_3prong::DecayType::N3ProngDecays; // number of 3-prong hadron types + static constexpr int kNCuts2Prong[kN2ProngDecays] = {hf_cuts_presel_2prong::NCutVars, hf_cuts_presel_2prong::NCutVars, hf_cuts_presel_2prong::NCutVars}; // how many different selections are made on 2-prongs + static constexpr int kNCuts3Prong[kN3ProngDecays] = {hf_cuts_presel_3prong::NCutVars, hf_cuts_presel_3prong::NCutVars + 1, hf_cuts_presel_ds::NCutVars, hf_cuts_presel_3prong::NCutVars + 1, hf_cuts_presel_3prong::NCutVars + 1}; // how many different selections are made on 3-prongs (Lc and Xic have also PID potentially) + static constexpr int kNCutsDstar = 3; // how many different selections are made on Dstars std::array, 2>, kN2ProngDecays> arrMass2Prong{}; std::array, 2>, kN3ProngDecays> arrMass3Prong{}; // arrays of 2-prong and 3-prong cuts @@ -1339,12 +1354,15 @@ struct HfTrackIndexSkimCreator { arrMass3Prong[hf_cand_3prong::DecayType::XicToPKPi] = std::array{std::array{MassProton, MassKPlus, MassPiPlus}, std::array{MassPiPlus, MassKPlus, MassProton}}; + arrMass3Prong[hf_cand_3prong::DecayType::CdToDeKPi] = std::array{std::array{MassDeuteron, MassKPlus, MassPiPlus}, + std::array{MassPiPlus, MassKPlus, MassDeuteron}}; + // cuts for 2-prong decays retrieved by json. the order must be then one in hf_cand_2prong::DecayType cut2Prong = {config.cutsD0ToPiK, config.cutsJpsiToEE, config.cutsJpsiToMuMu}; binsPt2Prong = {config.binsPtD0ToPiK, config.binsPtJpsiToEE, config.binsPtJpsiToMuMu}; // cuts for 3-prong decays retrieved by json. the order must be then one in hf_cand_3prong::DecayType - cut3Prong = {config.cutsDplusToPiKPi, config.cutsLcToPKPi, config.cutsDsToKKPi, config.cutsXicToPKPi}; - binsPt3Prong = {config.binsPtDplusToPiKPi, config.binsPtLcToPKPi, config.binsPtDsToKKPi, config.binsPtXicToPKPi}; + cut3Prong = {config.cutsDplusToPiKPi, config.cutsLcToPKPi, config.cutsDsToKKPi, config.cutsXicToPKPi, config.cutsCdToDeKPi}; + binsPt3Prong = {config.binsPtDplusToPiKPi, config.binsPtLcToPKPi, config.binsPtDsToKKPi, config.binsPtXicToPKPi, config.binsPtCdToDeKPi}; df2.setPropagateToPCA(config.propagateToPCA); df2.setMaxR(config.maxR); @@ -1392,6 +1410,7 @@ struct HfTrackIndexSkimCreator { registry.add("hMassDsToKKPi", "D_{s}^{#plus} candidates;inv. mass (K K #pi) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{500, 0., 5.}}}); registry.add("hMassXicToPKPi", "#Xi_{c}^{#plus} candidates;inv. mass (p K #pi) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{500, 0., 5.}}}); registry.add("hMassDstarToD0Pi", "D^{*#plus} candidates;inv. mass (K #pi #pi) - mass (K #pi) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{500, 0.135, 0.185}}}); + registry.add("hMassCdToDeKPi", "C Deuteron candidates;inv. mass (De K #pi) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{500, 0., 5.}}}); // needed for PV refitting if (doprocess2And3ProngsWithPvRefit || doprocess2And3ProngsWithPvRefitWithPidForHfFiltersBdt) { @@ -1617,11 +1636,13 @@ struct HfTrackIndexSkimCreator { // check proton PID for Lc and Xic whichHypo[iDecay3P] = 3; // 2 bits on - if ((iDecay3P == hf_cand_3prong::DecayType::LcToPKPi && config.applyProtonPidForLcToPKPi) || (iDecay3P == hf_cand_3prong::DecayType::XicToPKPi && config.applyProtonPidForXicToPKPi)) { - if ((iDecay3P == hf_cand_3prong::DecayType::LcToPKPi && !TESTBIT(isIdentifiedPidTrack0, ChannelsProtonPid::LcToPKPi)) || (iDecay3P == hf_cand_3prong::DecayType::XicToPKPi && !TESTBIT(isIdentifiedPidTrack0, ChannelsProtonPid::XicToPKPi))) { + + if ((iDecay3P == hf_cand_3prong::DecayType::LcToPKPi && config.applyProtonPidForLcToPKPi) || (iDecay3P == hf_cand_3prong::DecayType::XicToPKPi && config.applyProtonPidForXicToPKPi) || (iDecay3P == hf_cand_3prong::DecayType::CdToDeKPi && config.applyDeuteronPidForCdToDeKPi)) { + + if ((iDecay3P == hf_cand_3prong::DecayType::LcToPKPi && !TESTBIT(isIdentifiedPidTrack0, ChannelsProtonPid::LcToPKPi)) || (iDecay3P == hf_cand_3prong::DecayType::XicToPKPi && !TESTBIT(isIdentifiedPidTrack0, ChannelsProtonPid::XicToPKPi)) || (iDecay3P == hf_cand_3prong::DecayType::CdToDeKPi && !TESTBIT(isIdentifiedPidTrack0, ChannelsDeuteronPid))) { CLRBIT(whichHypo[iDecay3P], 0); } - if ((iDecay3P == hf_cand_3prong::DecayType::LcToPKPi && !TESTBIT(isIdentifiedPidTrack2, ChannelsProtonPid::LcToPKPi)) || (iDecay3P == hf_cand_3prong::DecayType::XicToPKPi && !TESTBIT(isIdentifiedPidTrack2, ChannelsProtonPid::XicToPKPi))) { + if ((iDecay3P == hf_cand_3prong::DecayType::LcToPKPi && !TESTBIT(isIdentifiedPidTrack2, ChannelsProtonPid::LcToPKPi)) || (iDecay3P == hf_cand_3prong::DecayType::XicToPKPi && !TESTBIT(isIdentifiedPidTrack2, ChannelsProtonPid::XicToPKPi)) || (iDecay3P == hf_cand_3prong::DecayType::CdToDeKPi && !TESTBIT(isIdentifiedPidTrack2, ChannelsDeuteronPid))) { CLRBIT(whichHypo[iDecay3P], 1); } if (whichHypo[iDecay3P] == 0) { @@ -1632,7 +1653,6 @@ struct HfTrackIndexSkimCreator { continue; // no need to check further for this particle hypothesis } } - // pT const auto binPt = findBin(&binsPt3Prong[iDecay3P], pt); // return immediately if it is outside the defined pT bins @@ -1806,14 +1826,14 @@ struct HfTrackIndexSkimCreator { /// \param outputScores is the array of vectors with the output scores to be filled /// \param isSelected ia s bitmap with selection outcome template - void applyMlSelectionForHfFilters3Prong(std::vector featuresCand, std::vector featuresCandPid, std::array, kN3ProngDecays>& outputScores, auto& isSelected) + void applyMlSelectionForHfFilters3Prong(std::vector featuresCand, std::vector featuresCandPid, std::array, kN3ProngDecays - 1>& outputScores, auto& isSelected) { if (isSelected == 0) { return; } const float ptDummy = 1.f; // dummy pT value (only one pT bin) - for (int iDecay3P{0}; iDecay3P < kN3ProngDecays; ++iDecay3P) { + for (int iDecay3P{0}; iDecay3P < kN3ProngDecays - 1; ++iDecay3P) { if (TESTBIT(isSelected, iDecay3P) && hasMlModel3Prong[iDecay3P]) { bool isMlSel = false; if constexpr (UsePidForHfFiltersBdt) { @@ -2542,7 +2562,7 @@ struct HfTrackIndexSkimCreator { // 3-prong selections after secondary vertex applySelection3Prong(pVecCandProng3Pos, secondaryVertex3, pvRefitCoord3Prong2Pos1Neg, cutStatus3Prong, isSelected3ProngCand); - std::array, kN3ProngDecays> mlScores3Prongs; + std::array, kN3ProngDecays - 1> mlScores3Prongs; if (config.applyMlForHfFilters) { const std::vector inputFeatures{trackParVarPcaPos1.getPt(), dcaInfoPos1[0], dcaInfoPos1[1], trackParVarPcaNeg1.getPt(), dcaInfoNeg1[0], dcaInfoNeg1[1], trackParVarPcaPos2.getPt(), dcaInfoPos2[0], dcaInfoPos2[1]}; std::vector inputFeaturesLcPid{}; @@ -2607,6 +2627,9 @@ struct HfTrackIndexSkimCreator { case hf_cand_3prong::DecayType::XicToPKPi: registry.fill(HIST("hMassXicToPKPi"), mass3Prong); break; + case hf_cand_3prong::DecayType::CdToDeKPi: + registry.fill(HIST("hMassCdToDeKPi"), mass3Prong); + break; } } if (TESTBIT(whichHypo3Prong[iDecay3P], 1)) { @@ -2621,6 +2644,9 @@ struct HfTrackIndexSkimCreator { case hf_cand_3prong::DecayType::XicToPKPi: registry.fill(HIST("hMassXicToPKPi"), mass3Prong); break; + case hf_cand_3prong::DecayType::CdToDeKPi: + registry.fill(HIST("hMassCdToDeKPi"), mass3Prong); + break; } } } @@ -2793,7 +2819,7 @@ struct HfTrackIndexSkimCreator { // 3-prong selections after secondary vertex applySelection3Prong(pVecCandProng3Neg, secondaryVertex3, pvRefitCoord3Prong1Pos2Neg, cutStatus3Prong, isSelected3ProngCand); - std::array, kN3ProngDecays> mlScores3Prongs{}; + std::array, kN3ProngDecays - 1> mlScores3Prongs{}; if (config.applyMlForHfFilters) { const std::vector inputFeatures{trackParVarPcaNeg1.getPt(), dcaInfoNeg1[0], dcaInfoNeg1[1], trackParVarPcaPos1.getPt(), dcaInfoPos1[0], dcaInfoPos1[1], trackParVarPcaNeg2.getPt(), dcaInfoNeg2[0], dcaInfoNeg2[1]}; std::vector inputFeaturesLcPid{}; @@ -2858,6 +2884,9 @@ struct HfTrackIndexSkimCreator { case hf_cand_3prong::DecayType::XicToPKPi: registry.fill(HIST("hMassXicToPKPi"), mass3Prong); break; + case hf_cand_3prong::DecayType::CdToDeKPi: + registry.fill(HIST("hMassCdToDeKPi"), mass3Prong); + break; } } if (TESTBIT(whichHypo3Prong[iDecay3P], 1)) { @@ -2872,6 +2901,9 @@ struct HfTrackIndexSkimCreator { case hf_cand_3prong::DecayType::XicToPKPi: registry.fill(HIST("hMassXicToPKPi"), mass3Prong); break; + case hf_cand_3prong::DecayType::CdToDeKPi: + registry.fill(HIST("hMassCdToDeKPi"), mass3Prong); + break; } } } diff --git a/PWGHF/Utils/utilsPid.h b/PWGHF/Utils/utilsPid.h index 83307bc43d8..629db2a0325 100644 --- a/PWGHF/Utils/utilsPid.h +++ b/PWGHF/Utils/utilsPid.h @@ -31,6 +31,7 @@ enum HfProngSpecies : uint8_t { Pion = 0, Kaon, Proton, + Deuteron, NHfProngSpecies }; @@ -108,8 +109,16 @@ void fillProngPid(TTrack const& track, TCursor& rowPid) if (track.hasTOF()) { nSigTof = track.tofNSigmaPr(); } + } else if constexpr (SpecPid == HfProngSpecies::Deuteron) { + // deuteron PID + if (track.hasTPC()) { + nSigTpc = track.tpcNSigmaDe(); + } + if (track.hasTOF()) { + nSigTof = track.tofNSigmaDe(); + } } else { - LOG(fatal) << "Unsupported PID. Supported species in HF framework: HfProngSpecies::Pion, HfProngSpecies::Kaon, HfProngSpecies::Proton"; + LOG(fatal) << "Unsupported PID. Supported species in HF framework: HfProngSpecies::Pion, HfProngSpecies::Kaon, HfProngSpecies::Proton, HfProngSpecies::Deuteron"; } // fill candidate prong PID rows From 79ee119dbed4ed79a598ea36ce748137f2bb913b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= <26327373+vkucera@users.noreply.github.com> Date: Wed, 22 Oct 2025 22:56:31 +0200 Subject: [PATCH 859/986] [PWGHF] IWYU (#13500) --- PWGHF/D2H/Tasks/taskCd.cxx | 8 ++++---- PWGHF/D2H/Tasks/taskD0.cxx | 1 + PWGHF/D2H/Tasks/taskLc.cxx | 5 +++++ PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx | 2 ++ PWGHF/HFC/Macros/DhCorrelationExtraction.cxx | 1 + PWGHF/HFC/Macros/DhCorrelationFitter.cxx | 1 - .../TableProducer/correlatorFlowCharmHadronsReduced.cxx | 1 - PWGHF/HFC/Tasks/taskFlow.cxx | 4 +--- PWGHF/TableProducer/candidateSelectorCd.cxx | 6 ------ PWGHF/TableProducer/candidateSelectorToXiPi.cxx | 2 ++ 10 files changed, 16 insertions(+), 15 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskCd.cxx b/PWGHF/D2H/Tasks/taskCd.cxx index 5bcd8a328a8..7684e03ed0e 100644 --- a/PWGHF/D2H/Tasks/taskCd.cxx +++ b/PWGHF/D2H/Tasks/taskCd.cxx @@ -14,17 +14,14 @@ /// \author Biao Zhang , Heidelberg Universiity #include "PWGHF/Core/CentralityEstimation.h" -#include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" -#include "PWGHF/Utils/utilsEvSelHf.h" -#include "Common/Core/RecoDecay.h" #include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" -#include #include #include #include @@ -33,10 +30,13 @@ #include #include #include +#include #include #include +#include + #include #include #include diff --git a/PWGHF/D2H/Tasks/taskD0.cxx b/PWGHF/D2H/Tasks/taskD0.cxx index c6b495d5fd7..a64369339ea 100644 --- a/PWGHF/D2H/Tasks/taskD0.cxx +++ b/PWGHF/D2H/Tasks/taskD0.cxx @@ -28,6 +28,7 @@ #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" +#include #include #include #include diff --git a/PWGHF/D2H/Tasks/taskLc.cxx b/PWGHF/D2H/Tasks/taskLc.cxx index 12463440087..4b5713bce36 100644 --- a/PWGHF/D2H/Tasks/taskLc.cxx +++ b/PWGHF/D2H/Tasks/taskLc.cxx @@ -27,6 +27,7 @@ #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/Utils/utilsEvSelHf.h" +#include "PWGUD/Core/UPCHelpers.h" #include "Common/Core/RecoDecay.h" #include "Common/DataModel/Centrality.h" @@ -36,14 +37,17 @@ #include #include #include +#include #include #include #include #include #include #include +#include #include +#include #include #include @@ -51,6 +55,7 @@ #include #include #include +#include #include // std::vector using namespace o2; diff --git a/PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx b/PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx index 5c923dc4309..cccd82fce67 100644 --- a/PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx +++ b/PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx @@ -23,6 +23,7 @@ #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" +#include #include #include #include @@ -40,6 +41,7 @@ #include #include +#include #include #include diff --git a/PWGHF/HFC/Macros/DhCorrelationExtraction.cxx b/PWGHF/HFC/Macros/DhCorrelationExtraction.cxx index 6459c54c437..f2566f4f9a6 100644 --- a/PWGHF/HFC/Macros/DhCorrelationExtraction.cxx +++ b/PWGHF/HFC/Macros/DhCorrelationExtraction.cxx @@ -35,6 +35,7 @@ #include #include #include +#include DhCorrelationExtraction::DhCorrelationExtraction() : // default constructor fFileMass(nullptr), diff --git a/PWGHF/HFC/Macros/DhCorrelationFitter.cxx b/PWGHF/HFC/Macros/DhCorrelationFitter.cxx index 35e023153d3..594f58f8843 100644 --- a/PWGHF/HFC/Macros/DhCorrelationFitter.cxx +++ b/PWGHF/HFC/Macros/DhCorrelationFitter.cxx @@ -27,7 +27,6 @@ #include #include #include -#include #include #include diff --git a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx index 77281b0ad40..63a34e84fc3 100644 --- a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx +++ b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/PWGHF/HFC/Tasks/taskFlow.cxx b/PWGHF/HFC/Tasks/taskFlow.cxx index 0c7fa65cee4..448d4c5769c 100644 --- a/PWGHF/HFC/Tasks/taskFlow.cxx +++ b/PWGHF/HFC/Tasks/taskFlow.cxx @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -41,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -50,13 +50,11 @@ #include #include #include -#include #include #include #include #include -#include #include #include diff --git a/PWGHF/TableProducer/candidateSelectorCd.cxx b/PWGHF/TableProducer/candidateSelectorCd.cxx index 4eb1c0e2e95..b220bc130b8 100644 --- a/PWGHF/TableProducer/candidateSelectorCd.cxx +++ b/PWGHF/TableProducer/candidateSelectorCd.cxx @@ -20,9 +20,7 @@ #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "Common/Core/TrackSelectorPID.h" -#include "Common/DataModel/PIDResponseCombined.h" -#include #include #include #include @@ -31,14 +29,10 @@ #include #include #include -#include #include #include -#include -#include -#include #include #include diff --git a/PWGHF/TableProducer/candidateSelectorToXiPi.cxx b/PWGHF/TableProducer/candidateSelectorToXiPi.cxx index ab13519f62e..d9064b61a29 100644 --- a/PWGHF/TableProducer/candidateSelectorToXiPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorToXiPi.cxx @@ -23,11 +23,13 @@ #include "Common/Core/RecoDecay.h" #include "Common/Core/TrackSelectorPID.h" +#include #include #include #include #include #include +#include #include #include #include From e7d5623d97f79b4a7b37086616cb3ed020204e53 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Thu, 23 Oct 2025 00:07:34 +0200 Subject: [PATCH 860/986] [PWGLF] Fix Tracked cascade datalink filling (#13498) --- PWGLF/Utils/strangenessBuilderModule.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/PWGLF/Utils/strangenessBuilderModule.h b/PWGLF/Utils/strangenessBuilderModule.h index 0220453a238..61371ff59ec 100644 --- a/PWGLF/Utils/strangenessBuilderModule.h +++ b/PWGLF/Utils/strangenessBuilderModule.h @@ -2403,12 +2403,14 @@ class BuilderModule return; // don't do if no request for cascades in place or findable mode used } int nCascades = 0; + std::vector traCascIndices(cascadeList.size(), -1); // Loops over all V0s in the time frame histos.fill(HIST("hInputStatistics"), kStoredTraCascCores, cascadeTracks.size()); for (const auto& cascadeTrack : cascadeTracks) { // Get tracks and generate candidate - if (!cascadeTrack.has_track()) + if (!cascadeTrack.has_track()) { continue; // safety (should be fine but depends on future stratrack dev) + } auto const& strangeTrack = cascadeTrack.template track_as(); @@ -2433,8 +2435,6 @@ class BuilderModule baseOpts.mEnabledTables[kCascBBs], cascadeBuilderOpts.useCascadeMomentumAtPrimVtx, baseOpts.mEnabledTables[kCascCovs])) { - products.tracascdataLink(-1); - interlinks.cascadeToTraCascCores.push_back(-1); continue; // didn't work out, skip } @@ -2474,9 +2474,7 @@ class BuilderModule histos.fill(HIST("hTableBuildingStatistics"), kStoredTraCascCores); // interlink always produced if base core table generated - products.tracascdataLink(products.tracascdata.lastIndex()); - interlinks.traCascCoreToCascades.push_back(cascade.globalIndex()); - interlinks.cascadeToTraCascCores.push_back(products.tracascdata.lastIndex()); + traCascIndices[cascade.globalIndex()] = products.tracascdata.lastIndex(); } if (baseOpts.mEnabledTables[kCascCovs]) { std::array traCovMat = {0.}; @@ -2502,6 +2500,10 @@ class BuilderModule } // enabled tables check } // constexpr requires mcParticles check } // end loop over cascades + + for (std::size_t icascade = 0; icascade < cascadeList.size(); icascade++) { + products.tracascdataLink(traCascIndices[icascade]); + } LOGF(debug, "Tracked cascades in DF: %i, tracked cascades built: %i", cascadeTracks.size(), nCascades); } From d489d4d5206d6efa9a9657e08bd1b67bad9f20d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?BiaoZhang=20=28=E5=BC=A0=E5=BD=AA=29?= <52267892+zhangbiao-phy@users.noreply.github.com> Date: Thu, 23 Oct 2025 08:25:25 +0200 Subject: [PATCH 861/986] [PWGHF] [PWGHF]adjust the bining of the QA plot for FIT signal amplitude (#13507) --- PWGHF/D2H/Tasks/taskLc.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/D2H/Tasks/taskLc.cxx b/PWGHF/D2H/Tasks/taskLc.cxx index 4b5713bce36..5e9b3f5f973 100644 --- a/PWGHF/D2H/Tasks/taskLc.cxx +++ b/PWGHF/D2H/Tasks/taskLc.cxx @@ -262,7 +262,7 @@ struct HfTaskLc { addHistogramsRec("hDecLenErrVsPt", "decay length error (cm)", "#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{100, 0., 1.}, {vbins}}}); if (isUpc) { - qaRegistry.add("Data/fitInfo/ampFT0A_vs_ampFT0C", "FT0-A vs FT0-C amplitude;FT0-A amplitude (a.u.);FT0-C amplitude (a.u.)", {HistType::kTH2F, {{2500, 0., 250}, {2500, 0., 250}}}); + qaRegistry.add("Data/fitInfo/ampFT0A_vs_ampFT0C", "FT0-A vs FT0-C amplitude;FT0-A amplitude (a.u.);FT0-C amplitude (a.u.)", {HistType::kTH2F, {{1500, 0., 1500}, {1500, 0., 1500}}}); qaRegistry.add("Data/zdc/energyZNA_vs_energyZNC", "ZNA vs ZNC common energy;E_{ZNA}^{common} (a.u.);E_{ZNC}^{common} (a.u.)", {HistType::kTH2F, {{200, 0., 20}, {200, 0., 20}}}); qaRegistry.add("Data/hUpcGapAfterSelection", "UPC gap type after selection;Gap side;Counts", {HistType::kTH1F, {{3, -0.5, 2.5}}}); qaRegistry.get(HIST("Data/hUpcGapAfterSelection"))->GetXaxis()->SetBinLabel(static_cast(GapType::GapA) + 1, "A"); From 6c0a9ba501e0252aba842dd28df7f0f172c2598b Mon Sep 17 00:00:00 2001 From: altsybee Date: Thu, 23 Oct 2025 08:30:17 +0200 Subject: [PATCH 862/986] [DPG] tune histograms, fixing issues (#13483) --- DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx | 154 +++++++++++++++++------- 1 file changed, 112 insertions(+), 42 deletions(-) diff --git a/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx b/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx index fc447f86935..03ef02d3722 100644 --- a/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx +++ b/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx @@ -133,11 +133,8 @@ struct LightIonsEvSelQa { const AxisSpec axisMultFT0C{nBinsMultFwd, 0., static_cast(nMaxMultFwd * 0.15), "mult FT0C"}; const AxisSpec axisMultT0M{nBinsMultFwd * 2, 0., static_cast(nMaxMultFwd * 0.4), "mult FT0M"}; - const AxisSpec axisMultT0MlargeBins{nBinsMultFwd, 0., static_cast(nMaxMultFwd * 0.75), "mult FT0M"}; - histos.add("multT0M_vs_multSumFT0", ";multT0M;multT0M_uncorrected", kTH2F, {axisMultT0MlargeBins, axisMultT0MlargeBins}); - const AxisSpec axisVtxZ{800, -20., 20., ""}; - const AxisSpec axisBcDiff{600, -300., 300., "bc difference"}; + const AxisSpec axisBcDiff{601, -300.5, 300.5, "bc difference"}; const AxisSpec axisNcontrib{601, -0.5, 600.5, "n contributors"}; const AxisSpec axisColTimeRes{1500, 0., 1500., "collision time resolution (ns)"}; @@ -145,9 +142,10 @@ struct LightIonsEvSelQa { AxisSpec axisVertexChi2{100, 0, 500, "Chi2 of vertex fit"}; AxisSpec axisVertexChi2perContrib{100, 0, 10, "Chi2 of vertex fit"}; - const AxisSpec axisTimeDiff{100, -10., 10., ""}; - const AxisSpec axisTimeSum{100, -10., 10., ""}; - const AxisSpec axisZNampl{200, 0, 3000, ""}; + const AxisSpec axisTimeZN{800, -20., 20., ""}; + const AxisSpec axisTimeDiff{150, -10., 10., ""}; + const AxisSpec axisTimeSum{150, -10., 10., ""}; + const AxisSpec axisZNampl{200, 0, 10000, ""}; histos.add("noSpecSelections/hBcColNoSel8", "", kTH1F, {axisBCs}); histos.add("noSpecSelections/hBcOrigNoSel8", "", kTH1F, {axisBCs}); @@ -171,7 +169,10 @@ struct LightIonsEvSelQa { histos.add("noSpecSelections/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); histos.add("noSpecSelections/hVertexChi2VsNcontrib", "", kTH2F, {axisNcontrib, axisVertexChi2perContrib}); histos.add("noSpecSelections/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); - histos.add("noSpecSelections/hTimeZAC", "ZNC-ZNA time (ns); ZNC+ZNA time (ns)", kTH2F, {axisTimeDiff, axisTimeSum}); + histos.add("noSpecSelections/hTimeZN_AC_sum_vs_diff", ";ZNC-ZNA time (ns); ZNC+ZNA time (ns)", kTH2F, {axisTimeDiff, axisTimeSum}); + histos.add("noSpecSelections/hTimeZN_A_vs_C", ";ZNA time (ns); ZNC time (ns)", kTH2F, {axisTimeZN, axisTimeZN}); + histos.add("noSpecSelections/hTimeZNA", ";ZNA time (ns)", kTH1F, {axisTimeZN}); + histos.add("noSpecSelections/hTimeZNC", ";ZNC time (ns)", kTH1F, {axisTimeZN}); histos.add("noPU/hBcColNoSel8", "", kTH1F, {axisBCs}); histos.add("noPU/hBcOrigNoSel8", "", kTH1F, {axisBCs}); @@ -194,8 +195,11 @@ struct LightIonsEvSelQa { histos.add("noPU/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); histos.add("noPU/hVertexChi2VsNcontrib", "", kTH2F, {axisNcontrib, axisVertexChi2perContrib}); histos.add("noPU/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); - histos.add("noPU/hTimeZAC", "ZNC-ZNA time (ns); ZNC+ZNA time (ns)", kTH2F, {axisTimeDiff, axisTimeSum}); - histos.add("noPU/hAmplZAC", "ZNC vs ZNA", kTH2F, {axisZNampl, axisZNampl}); + histos.add("noPU/hTimeZN_AC_sum_vs_diff", ";ZNC-ZNA time (ns); ZNC+ZNA time (ns)", kTH2F, {axisTimeDiff, axisTimeSum}); + histos.add("noPU/hTimeZN_A_vs_C", ";ZNA time (ns); ZNC time (ns)", kTH2F, {axisTimeZN, axisTimeZN}); + histos.add("noPU/hTimeZNA", ";ZNA time (ns)", kTH1F, {axisTimeZN}); + histos.add("noPU/hTimeZNC", ";ZNC time (ns)", kTH1F, {axisTimeZN}); + histos.add("noPU/hAmplZNAC", "ZNC vs ZNA", kTH2F, {axisZNampl, axisZNampl}); histos.add("noPU_pvTOFmatched/hBcColNoSel8", "", kTH1F, {axisBCs}); histos.add("noPU_pvTOFmatched/hBcTVX", "", kTH1F, {axisBCs}); @@ -403,7 +407,10 @@ struct LightIonsEvSelQa { histos.add("noPU_lowMultCut/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); histos.add("noPU_lowMultCut/hVertexChi2VsNcontrib", "", kTH2F, {axisNcontrib, axisVertexChi2perContrib}); histos.add("noPU_lowMultCut/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); - histos.add("noPU_lowMultCut/hTimeZAC", "ZNC-ZNA time (ns); ZNC+ZNA time (ns)", kTH2F, {axisTimeDiff, axisTimeSum}); + histos.add("noPU_lowMultCut/hTimeZN_AC_sum_vs_diff", ";ZNC-ZNA time (ns); ZNC+ZNA time (ns)", kTH2F, {axisTimeDiff, axisTimeSum}); + histos.add("noPU_lowMultCut/hTimeZN_A_vs_C", ";ZNA time (ns); ZNC time (ns)", kTH2F, {axisTimeZN, axisTimeZN}); + histos.add("noPU_lowMultCut/hTimeZNA", ";ZNA time (ns)", kTH1F, {axisTimeZN}); + histos.add("noPU_lowMultCut/hTimeZNC", ";ZNC time (ns)", kTH1F, {axisTimeZN}); histos.add("highMultCloudCut/hBcColNoSel8", "", kTH1F, {axisBCs}); histos.add("highMultCloudCut/hBcOrigNoSel8", "", kTH1F, {axisBCs}); @@ -430,7 +437,10 @@ struct LightIonsEvSelQa { histos.add("noPU_highMultCloudCut/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); histos.add("noPU_highMultCloudCut/hVertexChi2VsNcontrib", "", kTH2F, {axisNcontrib, axisVertexChi2perContrib}); histos.add("noPU_highMultCloudCut/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); - histos.add("noPU_highMultCloudCut/hTimeZAC", "ZNC-ZNA time (ns); ZNC+ZNA time (ns)", kTH2F, {axisTimeDiff, axisTimeSum}); + histos.add("noPU_highMultCloudCut/hTimeZN_AC_sum_vs_diff", ";ZNC-ZNA time (ns); ZNC+ZNA time (ns)", kTH2F, {axisTimeDiff, axisTimeSum}); + histos.add("noPU_highMultCloudCut/hTimeZN_A_vs_C", ";ZNA time (ns); ZNC time (ns)", kTH2F, {axisTimeZN, axisTimeZN}); + histos.add("noPU_highMultCloudCut/hTimeZNA", ";ZNA time (ns)", kTH1F, {axisTimeZN}); + histos.add("noPU_highMultCloudCut/hTimeZNC", ";ZNC time (ns)", kTH1F, {axisTimeZN}); histos.add("noPU_badVzDiff/hBcColNoSel8", "", kTH1F, {axisBCs}); histos.add("noPU_badVzDiff/hBcTVX", "", kTH1F, {axisBCs}); @@ -570,7 +580,10 @@ struct LightIonsEvSelQa { histos.add("noPU_cutByVzDiff_pvTOF/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); histos.add("noPU_cutByVzDiff_pvTOF/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); histos.add("noPU_cutByVzDiff_pvTOF/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); - histos.add("noPU_cutByVzDiff_pvTOF/hTimeZAC", "ZNC-ZNA time (ns); ZNC+ZNA time (ns)", kTH2F, {axisTimeDiff, axisTimeSum}); + histos.add("noPU_cutByVzDiff_pvTOF/hTimeZN_AC_sum_vs_diff", ";ZNC-ZNA time (ns); ZNC+ZNA time (ns)", kTH2F, {axisTimeDiff, axisTimeSum}); + histos.add("noPU_cutByVzDiff_pvTOF/hTimeZN_A_vs_C", ";ZNA time (ns); ZNC time (ns)", kTH2F, {axisTimeZN, axisTimeZN}); + histos.add("noPU_cutByVzDiff_pvTOF/hTimeZNA", ";ZNA time (ns)", kTH1F, {axisTimeZN}); + histos.add("noPU_cutByVzDiff_pvTOF/hTimeZNC", ";ZNC time (ns)", kTH1F, {axisTimeZN}); histos.add("noPU_cutByVzDiff_noFT0activityNearby/hBcColNoSel8", "", kTH1F, {axisBCs}); histos.add("noPU_cutByVzDiff_noFT0activityNearby/hBcTVX", "", kTH1F, {axisBCs}); @@ -606,18 +619,21 @@ struct LightIonsEvSelQa { histos.add("noPU_CutOnZNACtime/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); histos.add("noPU_CutOnZNACtime/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); histos.add("noPU_CutOnZNACtime/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); - histos.add("noPU_CutOnZNACtime/hTimeZAC", "ZNC-ZNA time (ns); ZNC+ZNA time (ns)", kTH2F, {axisTimeDiff, axisTimeSum}); - histos.add("noPU_CutOnZNACtime/hAmplZAC", "ZNC vs ZNA", kTH2F, {axisZNampl, axisZNampl}); + histos.add("noPU_CutOnZNACtime/hTimeZN_AC_sum_vs_diff", ";ZNC-ZNA time (ns); ZNC+ZNA time (ns)", kTH2F, {axisTimeDiff, axisTimeSum}); + histos.add("noPU_CutOnZNACtime/hAmplZNAC", "ZNC vs ZNA", kTH2F, {axisZNampl, axisZNampl}); + histos.add("noPU_CutOnZNACtime/hTimeZN_A_vs_C", ";ZNA time (ns); ZNC time (ns)", kTH2F, {axisTimeZN, axisTimeZN}); + histos.add("noPU_CutOnZNACtime/hTimeZNA", ";ZNA time (ns)", kTH1F, {axisTimeZN}); + histos.add("noPU_CutOnZNACtime/hTimeZNC", ";ZNC time (ns)", kTH1F, {axisTimeZN}); histos.add("noPU_AntiCutOnZNACtime/hBcFV0", "", kTH1F, {axisBCs}); histos.add("noPU_AntiCutOnZNACtime/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); histos.add("noPU_AntiCutOnZNACtime/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); - histos.add("noPU_AntiCutOnZNACtime/hAmplZAC", "ZNC vs ZNA", kTH2F, {axisZNampl, axisZNampl}); + histos.add("noPU_AntiCutOnZNACtime/hAmplZNAC", "ZNC vs ZNA", kTH2F, {axisZNampl, axisZNampl}); histos.add("noPU_AntiCutOnZNAampl/hBcFV0", "", kTH1F, {axisBCs}); histos.add("noPU_AntiCutOnZNAampl/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); histos.add("noPU_AntiCutOnZNAampl/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); - histos.add("noPU_AntiCutOnZNAampl/hAmplZAC", "ZNC vs ZNA", kTH2F, {axisZNampl, axisZNampl}); + histos.add("noPU_AntiCutOnZNAampl/hAmplZNAC", "ZNC vs ZNA", kTH2F, {axisZNampl, axisZNampl}); // histos.add("hNcontribColFromData", "", kTH1F, {axisNcontrib}); @@ -629,8 +645,16 @@ struct LightIonsEvSelQa { histos.add("MC/hMCdataBcDiffVsMult", "", kTH2F, {axisNcontrib, axisBcDiff}); histos.add("MC/hMCdataFoundBcDiffVsMult", "", kTH2F, {axisNcontrib, axisBcDiff}); histos.add("MCsel8/hMCdataVzDiff", "", kTH2F, {axisNcontrib, axisVtxZdiff}); + histos.add("MCsel8/hMCdataVzDiff_vertTRDmatched", "", kTH2F, {axisNcontrib, axisVtxZdiff}); + histos.add("MCsel8/hMCdataVzDiff_vertTOFmatched", "", kTH2F, {axisNcontrib, axisVtxZdiff}); histos.add("MCsel8/hMCdataBcDiffVsMult", "", kTH2F, {axisNcontrib, axisBcDiff}); histos.add("MCsel8/hMCdataFoundBcDiffVsMult", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("MCsel8/hMCdataFoundBcDiffVsMult_vertTRDmatched", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("MCsel8/hMCdataFoundBcDiffVsMult_vertTOFmatched", "", kTH2F, {axisNcontrib, axisBcDiff}); + + histos.add("MCnonTVX/hMCdataVzDiff", "", kTH2F, {axisNcontrib, axisVtxZdiff}); + histos.add("MCnonTVX/hMCdataBcDiffVsMult", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("MCnonTVX/hMCdataFoundBcDiffVsMult", "", kTH2F, {axisNcontrib, axisBcDiff}); } Preslice perCollision = aod::track::collisionId; @@ -947,20 +971,13 @@ struct LightIonsEvSelQa { float multT0A = hasFT0 ? col.multFT0A() : 0; float multT0C = hasFT0 ? col.multFT0C() : 0; float multT0M = multT0A + multT0C; - if (hasFT0) { - float multT0A_uncorr = foundBC.ft0().sumAmpA(); - float multT0C_uncorr = foundBC.ft0().sumAmpC(); - float multT0M_uncorr = multT0A_uncorr + multT0C_uncorr; - - histos.fill(HIST("multT0M_vs_multSumFT0"), multT0M, multT0M_uncorr); - } float timeZNA = foundBC.has_zdc() ? foundBC.zdc().timeZNA() : -999.f; float timeZNC = foundBC.has_zdc() ? foundBC.zdc().timeZNC() : -999.f; float znSum = timeZNA + timeZNC; float znDiff = timeZNA - timeZNC; // bool goodZNACtime = fabs(znSum) < 2 && fabs(znDiff) < 2; - bool goodZNACtime = (timeZNA > -6 && timeZNA < 4) && (timeZNC > -6 && timeZNC < 4); + bool goodZNACtime = (timeZNA > -5 && timeZNA < 2) && (timeZNC > -5 && timeZNC < 2); float multZNA = foundBC.has_zdc() ? foundBC.zdc().energyCommonZNA() : -999; float multZNC = foundBC.has_zdc() ? foundBC.zdc().energyCommonZNC() : -999; @@ -1030,14 +1047,20 @@ struct LightIonsEvSelQa { histos.fill(HIST("noSpecSelections/hBcColNoSel8"), localBC); histos.fill(HIST("noSpecSelections/hBcOrigNoSel8"), bcOriginal); histos.fill(HIST("noSpecSelections/Vz"), vZ); - histos.fill(HIST("noSpecSelections/hTimeZAC"), znDiff, znSum); + histos.fill(HIST("noSpecSelections/hTimeZN_AC_sum_vs_diff"), znDiff, znSum); + histos.fill(HIST("noSpecSelections/hTimeZN_A_vs_C"), timeZNA, timeZNC); + histos.fill(HIST("noSpecSelections/hTimeZNA"), timeZNA); + histos.fill(HIST("noSpecSelections/hTimeZNC"), timeZNC); if (noPU) { histos.fill(HIST("noPU/hBcColNoSel8"), localBC); histos.fill(HIST("noPU/hBcOrigNoSel8"), bcOriginal); histos.fill(HIST("noPU/Vz"), vZ); - histos.fill(HIST("noPU/hTimeZAC"), znDiff, znSum); - histos.fill(HIST("noPU/hAmplZAC"), multZNA, multZNC); + histos.fill(HIST("noPU/hTimeZN_AC_sum_vs_diff"), znDiff, znSum); + histos.fill(HIST("noPU/hTimeZN_A_vs_C"), timeZNA, timeZNC); + histos.fill(HIST("noPU/hAmplZNAC"), multZNA, multZNC); + histos.fill(HIST("noPU/hTimeZNA"), timeZNA); + histos.fill(HIST("noPU/hTimeZNC"), timeZNC); } if (noPU && pvTOFmatched) { histos.fill(HIST("noPU_pvTOFmatched/hBcColNoSel8"), localBC); @@ -1093,7 +1116,10 @@ struct LightIonsEvSelQa { if (noPU && underLine) { histos.fill(HIST("noPU_lowMultCut/hBcColNoSel8"), localBC); histos.fill(HIST("noPU_lowMultCut/hBcOrigNoSel8"), bcOriginal); - histos.fill(HIST("noPU_lowMultCut/hTimeZAC"), znDiff, znSum); + histos.fill(HIST("noPU_lowMultCut/hTimeZN_AC_sum_vs_diff"), znDiff, znSum); + histos.fill(HIST("noPU_lowMultCut/hTimeZN_A_vs_C"), timeZNA, timeZNC); + histos.fill(HIST("noPU_lowMultCut/hTimeZNA"), timeZNA); + histos.fill(HIST("noPU_lowMultCut/hTimeZNC"), timeZNC); } if (grassOnTheRight) { histos.fill(HIST("highMultCloudCut/hBcColNoSel8"), localBC); @@ -1102,11 +1128,17 @@ struct LightIonsEvSelQa { if (noPU && grassOnTheRight) { histos.fill(HIST("noPU_highMultCloudCut/hBcColNoSel8"), localBC); histos.fill(HIST("noPU_highMultCloudCut/hBcOrigNoSel8"), bcOriginal); - histos.fill(HIST("noPU_highMultCloudCut/hTimeZAC"), znDiff, znSum); + histos.fill(HIST("noPU_highMultCloudCut/hTimeZN_AC_sum_vs_diff"), znDiff, znSum); + histos.fill(HIST("noPU_highMultCloudCut/hTimeZN_A_vs_C"), timeZNA, timeZNC); + histos.fill(HIST("noPU_highMultCloudCut/hTimeZNA"), timeZNA); + histos.fill(HIST("noPU_highMultCloudCut/hTimeZNC"), timeZNC); } if (noPU && !badVzDiff && pvTOFmatched) { // noPileup_cutByVzDiff_pvTOF_noFT0act histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hBcColNoSel8"), localBC); - histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hTimeZAC"), znDiff, znSum); + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hTimeZN_AC_sum_vs_diff"), znDiff, znSum); + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hTimeZN_A_vs_C"), timeZNA, timeZNC); + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hTimeZNA"), timeZNA); + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hTimeZNC"), timeZNC); } // only here cut on sel8: @@ -1298,7 +1330,10 @@ struct LightIonsEvSelQa { histos.fill(HIST("noPU_CutOnZNACtime/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); histos.fill(HIST("noPU_CutOnZNACtime/hColTimeResVsNcontrib"), nContributors, timeRes); histos.fill(HIST("noPU_CutOnZNACtime/hNPVvsNch"), nPVtracks, nGlobalTracksAll); - histos.fill(HIST("noPU_CutOnZNACtime/hTimeZAC"), znDiff, znSum); + histos.fill(HIST("noPU_CutOnZNACtime/hTimeZN_AC_sum_vs_diff"), znDiff, znSum); + histos.fill(HIST("noPU_CutOnZNACtime/hTimeZN_A_vs_C"), timeZNA, timeZNC); + histos.fill(HIST("noPU_CutOnZNACtime/hTimeZNA"), timeZNA); + histos.fill(HIST("noPU_CutOnZNACtime/hTimeZNC"), timeZNC); } if (foundBC.has_ft0()) { @@ -1499,7 +1534,7 @@ struct LightIonsEvSelQa { histos.fill(HIST("noPU_CutOnZNACtime/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); histos.fill(HIST("noPU_CutOnZNACtime/nTracksPV_vs_T0A"), multT0A, nPVtracks); histos.fill(HIST("noPU_CutOnZNACtime/nTracksPV_vs_T0C"), multT0C, nPVtracks); - histos.fill(HIST("noPU_CutOnZNACtime/hAmplZAC"), multZNA, multZNC); + histos.fill(HIST("noPU_CutOnZNACtime/hAmplZNAC"), multZNA, multZNC); } } @@ -1627,13 +1662,13 @@ struct LightIonsEvSelQa { histos.fill(HIST("noPU_AntiCutOnZNACtime/hBcFV0"), localBC); histos.fill(HIST("noPU_AntiCutOnZNACtime/nTracksPV_vs_V0A"), multV0A, nPVtracks); histos.fill(HIST("noPU_AntiCutOnZNACtime/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); - histos.fill(HIST("noPU_AntiCutOnZNACtime/hAmplZAC"), multZNA, multZNC); + histos.fill(HIST("noPU_AntiCutOnZNACtime/hAmplZNAC"), multZNA, multZNC); } if (noPU && !cutZNACampl) { histos.fill(HIST("noPU_AntiCutOnZNAampl/hBcFV0"), localBC); histos.fill(HIST("noPU_AntiCutOnZNAampl/nTracksPV_vs_V0A"), multV0A, nPVtracks); histos.fill(HIST("noPU_AntiCutOnZNAampl/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); - histos.fill(HIST("noPU_AntiCutOnZNAampl/hAmplZAC"), multZNA, multZNC); + histos.fill(HIST("noPU_AntiCutOnZNAampl/hAmplZNAC"), multZNA, multZNC); } } if (foundBC.has_zdc()) { @@ -1778,24 +1813,59 @@ struct LightIonsEvSelQa { aod::McCollisions const&) { for (const auto& col : collisions) { + if (fabs(col.posZ()) > 10) + continue; bool isSel8 = col.sel8(); if (col.has_mcCollision()) { const auto mcCollision = col.mcCollision(); LOGP(debug, "col.posZ() = {}, mcCollision.posZ() = {}", col.posZ(), mcCollision.posZ()); - histos.fill(HIST("MC/hMCdataVzDiff"), col.numContrib(), col.posZ() - mcCollision.posZ()); + + float diffVz = col.posZ() - mcCollision.posZ(); + histos.fill(HIST("MC/hMCdataVzDiff"), col.numContrib(), diffVz); auto bc = col.bc_as(); auto mcBc = mcCollision.bc_as(); auto foundBC = col.foundBC_as(); - LOGP(debug, "col.bc().globalBC() = {}, mcCollision.bc().globalBC() = {}", col.bc().globalBC(), mcCollision.bc().globalBC()); - histos.fill(HIST("MC/hMCdataBcDiffVsMult"), col.numContrib(), bc.globalBC() - mcBc.globalBC()); - histos.fill(HIST("MC/hMCdataFoundBcDiffVsMult"), col.numContrib(), foundBC.globalBC() - mcBc.globalBC()); + uint64_t globalBC = bc.globalBC(); + uint64_t foundGlobalBC = foundBC.globalBC(); + uint64_t mcGlobalBC = mcBc.globalBC(); + + int bcDiff = static_cast(globalBC - mcGlobalBC); + int foundBcDiff = static_cast(foundGlobalBC - mcGlobalBC); + + // restrict bc diff range - to see values in the diff histograms + if (bcDiff > 300) + bcDiff = 300; + if (bcDiff < -300) + bcDiff = -300; + if (foundBcDiff > 300) + foundBcDiff = 300; + if (foundBcDiff < -300) + foundBcDiff = -300; + + LOGP(debug, "globalBC = {}, mcGlobalBC = {}", globalBC, mcGlobalBC); + histos.fill(HIST("MC/hMCdataBcDiffVsMult"), col.numContrib(), bcDiff); + histos.fill(HIST("MC/hMCdataFoundBcDiffVsMult"), col.numContrib(), foundBcDiff); if (isSel8) { - histos.fill(HIST("MCsel8/hMCdataVzDiff"), col.numContrib(), col.posZ() - mcCollision.posZ()); - histos.fill(HIST("MCsel8/hMCdataBcDiffVsMult"), col.numContrib(), bc.globalBC() - mcBc.globalBC()); - histos.fill(HIST("MCsel8/hMCdataFoundBcDiffVsMult"), col.numContrib(), foundBC.globalBC() - mcBc.globalBC()); + histos.fill(HIST("MCsel8/hMCdataVzDiff"), col.numContrib(), diffVz); + histos.fill(HIST("MCsel8/hMCdataBcDiffVsMult"), col.numContrib(), bcDiff); + histos.fill(HIST("MCsel8/hMCdataFoundBcDiffVsMult"), col.numContrib(), foundBcDiff); + + if (col.selection_bit(kIsVertexTRDmatched)) { + histos.fill(HIST("MCsel8/hMCdataVzDiff_vertTRDmatched"), col.numContrib(), diffVz); + histos.fill(HIST("MCsel8/hMCdataFoundBcDiffVsMult_vertTRDmatched"), col.numContrib(), foundBcDiff); + } + if (col.selection_bit(kIsVertexTOFmatched)) { + histos.fill(HIST("MCsel8/hMCdataVzDiff_vertTOFmatched"), col.numContrib(), diffVz); + histos.fill(HIST("MCsel8/hMCdataFoundBcDiffVsMult_vertTOFmatched"), col.numContrib(), foundBcDiff); + } + } + if (col.selection_bit(kNoTimeFrameBorder) && col.selection_bit(kNoITSROFrameBorder) && !col.selection_bit(kIsTriggerTVX)) { + histos.fill(HIST("MCnonTVX/hMCdataVzDiff"), col.numContrib(), diffVz); + histos.fill(HIST("MCnonTVX/hMCdataBcDiffVsMult"), col.numContrib(), bcDiff); + histos.fill(HIST("MCnonTVX/hMCdataFoundBcDiffVsMult"), col.numContrib(), foundBcDiff); } } } From efb1a4945c2a0260027d9eb58d84bec6a91f9431 Mon Sep 17 00:00:00 2001 From: yhambard <127940767+yhambard@users.noreply.github.com> Date: Thu, 23 Oct 2025 12:06:32 +0400 Subject: [PATCH 863/986] [PWGEM] phosElId.cxx fixed DCA calls (#13491) --- PWGEM/Tasks/phosElId.cxx | 49 +++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/PWGEM/Tasks/phosElId.cxx b/PWGEM/Tasks/phosElId.cxx index 23e09da288f..6597582f526 100644 --- a/PWGEM/Tasks/phosElId.cxx +++ b/PWGEM/Tasks/phosElId.cxx @@ -16,37 +16,40 @@ /// \author Yeghishe Hambardzumyan, MIPT /// \since Apr, 2024 -#include -#include -#include -#include -#include -#include "Common/Core/trackUtilities.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectionDefaults.h" +#include "Common/Core/trackUtilities.h" #include "Common/DataModel/CaloClusters.h" +#include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/FT0Corrected.h" #include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "ReconstructionDataFormats/TrackParametrization.h" -#include "Framework/ConfigParamSpec.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CommonDataFormat/InteractionRecord.h" +#include "DataFormatsParameters/GRPLHCIFData.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DetectorsBase/Propagator.h" #include "Framework/ASoA.h" #include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/ConfigParamSpec.h" #include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" #include "PHOSBase/Geometry.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "CommonDataFormat/InteractionRecord.h" -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPLHCIFData.h" -#include "DetectorsBase/Propagator.h" +#include "ReconstructionDataFormats/TrackParametrization.h" + #include "TF1.h" +#include +#include +#include +#include +#include + using namespace o2; using namespace o2::soa; using namespace o2::aod::evsel; @@ -111,8 +114,8 @@ struct PhosElId { using SelCollisions = soa::Join; using MyTracks = soa::Join; + aod::pidTOFFullEl, aod::pidTPCFullEl, aod::pidTPCFullPi, + aod::pidTPCFullKa, aod::pidTPCFullPr>; Configurable isSel8{"isSel8", 1, "check if event is Single Event Latch-up 8"}, mSwapM20M02ForTestLambda{"mSwapM20M02ForTestLambda", false, "Swap m20 and m02 arguments for testLambda (false for note's correct order, true for swapped/original incorrect order)"}, mUseNegativeCrossTerm{"mUseNegativeCrossTerm", true, "Use negative sign for the cross-term in testLambda (true for analysis note version, false for old version)"}; @@ -639,8 +642,8 @@ struct MassSpectra { aod::CentFT0As, aod::CentFT0Cs, aod::CentFV0As, aod::CentFDDMs, aod::CentNTPVs>; using MyTracks = soa::Join; + aod::pidTOFFullEl, aod::pidTPCFullEl, aod::pidTPCFullPi, + aod::pidTPCFullKa, aod::pidTPCFullPr>; Configurable isSel8{"isSel8", 1, "check if event is Single Event Latch-up 8"}; Configurable mEvSelTrig{"mEvSelTrig", kTVXinPHOS, "Select events with this trigger"}, MassBinning{"MassBinning", 1000, "Binning for mass"}, @@ -883,8 +886,8 @@ struct TpcElIdMassSpectrum { aod::CentFT0As, aod::CentFT0Cs, aod::CentFV0As, aod::CentFDDMs, aod::CentNTPVs>; using MyTracks = soa::Join; + aod::pidTOFFullEl, aod::pidTPCFullEl, aod::pidTPCFullPi, + aod::pidTPCFullKa, aod::pidTPCFullPr>; Configurable isSel8{"isSel8", 1, "check if event is Single Event Latch-up 8"}, mSwapM20M02ForTestLambda{"mSwapM20M02ForTestLambda", false, "Swap m20 and m02 arguments for testLambda (false for note's correct order, true for swapped/original incorrect order)"}, mUseNegativeCrossTerm{"mUseNegativeCrossTerm", true, "Use negative sign for the cross-term in testLambda (true for analysis note version, false for old version)"}; From df3b7c1e9e59239a99e95fd28b373f047c5565cc Mon Sep 17 00:00:00 2001 From: blacwovie Date: Thu, 23 Oct 2025 19:29:59 +0800 Subject: [PATCH 864/986] [PWGCF] Update PiNucleiFemto.cxx (#13510) --- .../FemtoNuclei/TableProducer/PiNucleiFemto.cxx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx b/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx index 3c8e49e671f..02b806f1e86 100644 --- a/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx +++ b/PWGCF/Femto/FemtoNuclei/TableProducer/PiNucleiFemto.cxx @@ -222,7 +222,6 @@ struct PiNucleiFemto { // binning for EM background ConfigurableAxis axisVertex{"axisVertex", {30, -10, 10}, "Binning for vtxz"}; ConfigurableAxis axisCentrality{"axisCentrality", {40, 0, 100}, "Binning for centrality"}; - ConfigurableAxis axisTransMass{"axisTransMass", {1000, 0.2, 3.2}, "Binning for mT"}; using BinningType = ColumnBinningPolicy; BinningType binningPolicy{{axisVertex, axisCentrality}, true}; SliceCache cache; @@ -283,10 +282,14 @@ struct PiNucleiFemto { {"h2NsigmaPiTOF", "NsigmaPi TOF distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}(p)", {HistType::kTH2F, {{200, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}}}, {"h2NsigmaNuTOF", "NsigmaNu TOF distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}(Nu)", {HistType::kTH2F, {{200, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}}}, {"h2NsigmaPiTOF_preselection", "NsigmaPi TOF distribution; #iit{p}_{T} (GeV/#it{c}); n#sigma_{TOF}(p)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {400, -10.0f, 10.0f}}}}, - {"hkStaVsmTVsCent_LS_M", ";kStar (GeV/c);mT (GeV/#it{c}^{2});Centrality", {HistType::kTH3F, {{300, 0.0f, 3.0f}, {axisTransMass}, {100, 0.0f, 100.0f}}}}, - {"hkStaVsmTVsCent_LS_A", ";kStar (GeV/c);mT (GeV/#it{c}^{2});Centrality", {HistType::kTH3F, {{300, 0.0f, 3.0f}, {axisTransMass}, {100, 0.0f, 100.0f}}}}, - {"hkStaVsmTVsCent_US_M", ";kStar (GeV/c);mT (GeV/#it{c}^{2});Centrality", {HistType::kTH3F, {{300, 0.0f, 3.0f}, {axisTransMass}, {100, 0.0f, 100.0f}}}}, - {"hkStaVsmTVsCent_US_A", ";kStar (GeV/c);mT (GeV/#it{c}^{2});Centrality", {HistType::kTH3F, {{300, 0.0f, 3.0f}, {axisTransMass}, {100, 0.0f, 100.0f}}}}, + {"hkStaVsmTVsCent_LS_M", ";kStar (GeV/c);mT (GeV/#it{c}^{2});Centrality", {HistType::kTH3F, {{300, 0.0f, 3.0f}, {100, 0.2, 3.2}, {100, 0.0f, 100.0f}}}}, + {"hkStaVsmTVsCent_LS_A", ";kStar (GeV/c);mT (GeV/#it{c}^{2});Centrality", {HistType::kTH3F, {{300, 0.0f, 3.0f}, {100, 0.2, 3.2}, {100, 0.0f, 100.0f}}}}, + {"hkStaVsmTVsCent_US_M", ";kStar (GeV/c);mT (GeV/#it{c}^{2});Centrality", {HistType::kTH3F, {{300, 0.0f, 3.0f}, {100, 0.2, 3.2}, {100, 0.0f, 100.0f}}}}, + {"hkStaVsmTVsCent_US_A", ";kStar (GeV/c);mT (GeV/#it{c}^{2});Centrality", {HistType::kTH3F, {{300, 0.0f, 3.0f}, {100, 0.2, 3.2}, {100, 0.0f, 100.0f}}}}, + {"hkStaVsmT_LS_M", ";kStar (GeV/c);mT (GeV/#it{c}^{2})", {HistType::kTH2F, {{300, 0.0f, 3.0f}, {2000, 0.8, 2.0}}}}, + {"hkStaVsmT_LS_A", ";kStar (GeV/c);mT (GeV/#it{c}^{2})", {HistType::kTH2F, {{300, 0.0f, 3.0f}, {2000, 0.8, 2.0}}}}, + {"hkStaVsmT_US_M", ";kStar (GeV/c);mT (GeV/#it{c}^{2})", {HistType::kTH2F, {{300, 0.0f, 3.0f}, {2000, 0.8, 2.0}}}}, + {"hkStaVsmT_US_A", ";kStar (GeV/c);mT (GeV/#it{c}^{2})", {HistType::kTH2F, {{300, 0.0f, 3.0f}, {2000, 0.8, 2.0}}}}, {"hCollIDVsCentEachPion", ";CollisionID;Centrality", {HistType::kTH2F, {{4000, 0.0f, 4000.0f}, {100, 0.0f, 100.0f}}}}, {"hCollIDVsCentEachDe", ";CollisionID;Centrality", {HistType::kTH2F, {{4000, 0.0f, 4000.0f}, {100, 0.0f, 100.0f}}}}, {"hNHypsPerPrevColl", "Number of V0Hypers in previous collision used for mixing;N_{V0Hypers};Entries", {HistType::kTH2F, {{4000, 0.0f, 4000.0f}, {50, -0.5, 49.5}}}}, @@ -1023,17 +1026,21 @@ struct PiNucleiFemto { if (piNucand.recoPtNu() > 0) { mQaRegistry.fill(HIST("hkStar_LS_M"), piNucand.kstar); mQaRegistry.fill(HIST("hkStaVsmTVsCent_LS_M"), piNucand.kstar, piNucand.mT, collision.centFT0C()); + mQaRegistry.fill(HIST("hkStaVsmT_LS_M"), piNucand.kstar, piNucand.mT); } else { mQaRegistry.fill(HIST("hkStar_LS_A"), piNucand.kstar); mQaRegistry.fill(HIST("hkStaVsmTVsCent_LS_A"), piNucand.kstar, piNucand.mT, collision.centFT0C()); + mQaRegistry.fill(HIST("hkStaVsmT_LS_A"), piNucand.kstar, piNucand.mT); } } else { if (piNucand.recoPtNu() > 0) { mQaRegistry.fill(HIST("hkStar_US_M"), piNucand.kstar); mQaRegistry.fill(HIST("hkStaVsmTVsCent_US_M"), piNucand.kstar, piNucand.mT, collision.centFT0C()); + mQaRegistry.fill(HIST("hkStaVsmT_US_M"), piNucand.kstar, piNucand.mT); } else { mQaRegistry.fill(HIST("hkStar_US_A"), piNucand.kstar); mQaRegistry.fill(HIST("hkStaVsmTVsCent_US_A"), piNucand.kstar, piNucand.mT, collision.centFT0C()); + mQaRegistry.fill(HIST("hkStaVsmT_US_A"), piNucand.kstar, piNucand.mT); } } } From 2aefa1f8b1c9b8b5d22e3a988b508aa188f57336 Mon Sep 17 00:00:00 2001 From: aferrero2707 Date: Thu, 23 Oct 2025 13:37:48 +0200 Subject: [PATCH 865/986] [PWGDQ] initial version of global muon matching QA task (#13245) --- PWGDQ/Tasks/CMakeLists.txt | 5 + PWGDQ/Tasks/qaMatching.cxx | 1834 ++++++++++++++++++++++++++++++++++++ 2 files changed, 1839 insertions(+) create mode 100644 PWGDQ/Tasks/qaMatching.cxx diff --git a/PWGDQ/Tasks/CMakeLists.txt b/PWGDQ/Tasks/CMakeLists.txt index c3bb38bf955..ba4a3e14870 100644 --- a/PWGDQ/Tasks/CMakeLists.txt +++ b/PWGDQ/Tasks/CMakeLists.txt @@ -128,3 +128,8 @@ o2physics_add_dpl_workflow(tag-and-probe SOURCES TagAndProbe.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2Physics::PWGDQCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(qa-matching + SOURCES qaMatching.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGDQCore + COMPONENT_NAME Analysis) diff --git a/PWGDQ/Tasks/qaMatching.cxx b/PWGDQ/Tasks/qaMatching.cxx new file mode 100644 index 00000000000..885aa65b646 --- /dev/null +++ b/PWGDQ/Tasks/qaMatching.cxx @@ -0,0 +1,1834 @@ +// 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 qaMatching.cxx +/// \brief Task to compute and evaluate DCA quantities +/// \author Nicolas Bizé , SUBATECH +// +#include "PWGDQ/Core/MuonMatchingMlResponse.h" +#include "PWGDQ/Core/VarManager.h" +#include "PWGDQ/DataModel/ReducedInfoTables.h" + +#include "Common/DataModel/EventSelection.h" + +#include "CCDB/BasicCCDBManager.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "GlobalTracking/MatchGlobalFwd.h" +#include "MFTTracking/Constants.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::aod; + +using MyEvents = soa::Join; +using MyMuonsWithCov = soa::Join; +using MyMuonsMC = soa::Join; +using MyMFTs = aod::MFTTracks; +using MyMFTCovariances = aod::MFTTracksCov; +using MyMFTsMC = soa::Join; + +using MyMuon = MyMuonsWithCov::iterator; +using MyMuonMC = MyMuonsMC::iterator; +using MyMFT = MyMFTs::iterator; +using MyMFTCovariance = MyMFTCovariances::iterator; + +using SMatrix55 = ROOT::Math::SMatrix>; +using SMatrix5 = ROOT::Math::SVector; + +static float chi2ToScore(float chi2) +{ + return (1.f / (chi2 / 100.f + 1.f)); +} + +struct qaMatching { + //// Variables for selecting muon tracks + Configurable fPMchLow{"cfgPMchLow", 0.0f, ""}; + Configurable fPtMchLow{"cfgPtMchLow", 0.7f, ""}; + Configurable fEtaMchLow{"cfgEtaMchLow", -4.0f, ""}; + Configurable fEtaMchUp{"cfgEtaMchUp", -2.5f, ""}; + Configurable fRabsLow{"cfgRabsLow", 17.6f, ""}; + Configurable fRabsUp{"cfgRabsUp", 89.5f, ""}; + Configurable fSigmaPdcaUp{"cfgPdcaUp", 6.f, ""}; + Configurable fTrackChi2MchUp{"cfgTrackChi2MchUp", 5.f, ""}; + Configurable fMatchingChi2MchMidUp{"cfgMatchingChi2MchMidUp", 999.f, ""}; + + //// Variables for selecting mft tracks + Configurable fEtaMftLow{"cfgEtaMftlow", -3.6f, ""}; + Configurable fEtaMftUp{"cfgEtaMftup", -2.5f, ""}; + Configurable fTrackNClustMftLow{"cfgTrackNClustMftLow", 7, ""}; + Configurable fTrackChi2MftUp{"cfgTrackChi2MftUp", 999.f, ""}; + + //// Variables for selecting global tracks + Configurable fMatchingChi2ScoreMftMchLow{"cfgMatchingChi2ScoreMftMchLow", chi2ToScore(50.f), ""}; + + //// Variables for selecting tagged muons + Configurable fMuonTaggingNCrossedMftPlanesLow{"cfgMuonTaggingNCrossedMftPlanesLow", 5, ""}; + Configurable fMuonTaggingTrackChi2MchUp{"cfgMuonTaggingTrackChi2MchUp", 5.f, ""}; + Configurable fMuonTaggingPMchLow{"cfgMuonTaggingPMchLow", 0.0f, ""}; + Configurable fMuonTaggingPtMchLow{"cfgMuonTaggingPtMchLow", 0.7f, ""}; + Configurable fMuonTaggingEtaMchLow{"cfgMuonTaggingEtaMchLow", -3.6f, ""}; + Configurable fMuonTaggingEtaMchUp{"cfgMuonTaggingEtaMchUp", -2.5f, ""}; + Configurable fMuonTaggingRabsLow{"cfgMuonTaggingRabsLow", 17.6f, ""}; + Configurable fMuonTaggingRabsUp{"cfgMuonTaggingRabsUp", 89.5f, ""}; + Configurable fMuonTaggingSigmaPdcaUp{"cfgMuonTaggingPdcaUp", 4.f, ""}; + Configurable fMuonTaggingChi2DiffLow{"cfgMuonTaggingChi2DiffLow", 100.f, ""}; + + /// Variables to event mixing criteria + Configurable fSaveMixedMatchingParamsRate{"cfgSaveMixedMatchingParamsRate", 0.002f, ""}; + Configurable fEventMaxDeltaNMFT{"cfgEventMaxDeltaNMFT", 1, ""}; + Configurable fEventMaxDeltaVtxZ{"cfgEventMaxDeltaVtxZ", 1.f, ""}; + Configurable fEventMinDeltaBc{"cfgEventMinDeltaBc", 500, ""}; + + //// Variables for ccdb + Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; + Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; + + // CCDB connection configurables + struct : ConfigurableGroup { + Configurable fConfigCcdbUrl{"ccdb-url-", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable fConfigNoLaterThan{"ccdb-no-later-than-", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; + Configurable fConfigGrpPath{"grpPath-", "GLO/GRP/GRP", "Path of the grp file"}; + Configurable fConfigGeoPath{"geoPath-", "GLO/Config/GeometryAligned", "Path of the geometry file"}; + Configurable fConfigGrpMagPath{"grpmagPath-", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + } fConfigCCDB; + + /// Variables for histograms configuration + Configurable fNCandidatesMax{"nCandidatesMax", 5, ""}; + + double mBzAtMftCenter{0}; + + o2::globaltracking::MatchGlobalFwd mExtrap; + + using MatchingFunc_t = std::function; + std::map mMatchingFunctionMap; ///< MFT-MCH Matching function + + // Chi2 matching interface + static constexpr int sChi2FunctionsNum = 3; + struct : ConfigurableGroup { + std::array, sChi2FunctionsNum> fFunctionLabel{{ + {"cfgChi2FunctionLabel_0", std::string{"ProdAll"}, "Text label identifying this chi2 matching method"}, + {"cfgChi2FunctionLabel_1", std::string{"MatchXYPhiTanlMom"}, "Text label identifying this chi2 matching method"}, + {"cfgChi2FunctionLabel_2", std::string{"MatchXYPhiTanl"}, "Text label identifying this chi2 matching method"}, + }}; + std::array, sChi2FunctionsNum> fFunctionName{{{"cfgChi2FunctionNames_0", std::string{"prod"}, "Name of the chi2 matching function"}, + {"cfgChi2FunctionNames_1", std::string{"matchALL"}, "Name of the chi2 matching function"}, + {"cfgChi2FunctionNames_2", std::string{"matchXYPhiTanl"}, "Name of the chi2 matching function"}}}; + std::array, sChi2FunctionsNum> fMatchingScoreCut{{ + {"cfgChi2FunctionMatchingScoreCut_0", 0.f, "Minimum score value for selecting good matches"}, + {"cfgChi2FunctionMatchingScoreCut_1", chi2ToScore(50.f), "Minimum score value for selecting good matches"}, + {"cfgChi2FunctionMatchingScoreCut_2", chi2ToScore(50.f), "Minimum score value for selecting good matches"}, + }}; + std::array, sChi2FunctionsNum> fMatchingPlaneZ{{ + {"cfgChi2FunctionMatchingPlaneZ_0", static_cast(o2::mft::constants::mft::LayerZCoordinate()[9]), "Z position of the matching plane"}, + {"cfgChi2FunctionMatchingPlaneZ_1", static_cast(o2::mft::constants::mft::LayerZCoordinate()[9]), "Z position of the matching plane"}, + {"cfgChi2FunctionMatchingPlaneZ_2", static_cast(o2::mft::constants::mft::LayerZCoordinate()[9]), "Z position of the matching plane"}, + }}; + } fConfigChi2MatchingOptions; + + // ML interface + static constexpr int sMLModelsNum = 2; + struct : ConfigurableGroup { + std::array, sMLModelsNum> fModelLabel{{ + {"cfgMLModelLabel_0", std::string{"TestModel"}, "Text label identifying this group of ML models"}, + {"cfgMLModelLabel_1", std::string{""}, "Text label identifying this group of ML models"}, + }}; + std::array>, sMLModelsNum> fModelPathsCCDB{{{"cfgMLModelPathsCCDB_0", std::vector{"Users/m/mcoquet/MLTest"}, "Paths of models on CCDB"}, + {"cfgMLModelPathsCCDB_1", std::vector{}, "Paths of models on CCDB"}}}; + std::array>, sMLModelsNum> fInputFeatures{{{"cfgMLInputFeatures_0", std::vector{"chi2MCHMFT"}, "Names of ML model input features"}, + {"cfgMLInputFeatures_1", std::vector{}, "Names of ML model input features"}}}; + std::array>, sMLModelsNum> fModelNames{{{"cfgMLModelNames_0", std::vector{"model.onnx"}, "ONNX file names for each pT bin (if not from CCDB full path)"}, + {"cfgMLModelNames_1", std::vector{}, "ONNX file names for each pT bin (if not from CCDB full path)"}}}; + std::array, sMLModelsNum> fMatchingScoreCut{{ + {"cfgMLModelMatchingScoreCut_0", 0.f, "Minimum score value for selecting good matches"}, + {"cfgMLModelMatchingScoreCut_1", 0.f, "Minimum score value for selecting good matches"}, + }}; + std::array, sMLModelsNum> fMatchingPlaneZ{{ + {"cfgMLModelMatchingPlaneZ_0", static_cast(o2::mft::constants::mft::LayerZCoordinate()[9]), "Z position of the matching plane"}, + {"cfgMLModelMatchingPlaneZ_1", 0.f, "Z position of the matching plane"}, + }}; + } fConfigMlOptions; + + std::vector binsPtMl; + std::array cutValues; + std::vector cutDirMl; + std::map> matchingMlResponses; + std::map matchingChi2Functions; + std::map matchingPlanesZ; + std::map matchingScoreCuts; + + int mRunNumber{0}; // needed to detect if the run changed and trigger update of magnetic field + + Service ccdbManager; + o2::ccdb::CcdbApi fCCDBApi; + + o2::aod::rctsel::RCTFlagsChecker rctChecker{"CBT_muon_glo", false, false, true}; + + // vector of all MFT-MCH(-MID) matching candidates associated to the same MCH(-MID) track, + // to be sorted in descending order with respect to the matching score + // the map key is the MCH(-MID) track global index + // the elements are pairs og global muon track indexes and associated matching scores + // for matching candidates computed with the chi2 method, the score is defined as 1/(1+chi2) + using MatchingCandidates = std::map>>; + + struct CollisionInfo { + int64_t index{0}; + uint64_t bc{0}; + // z position of the collision + double zVertex{0}; + // number of MFT tracks associated to the collision + int mftTracksMultiplicity{0}; + // vector of MFT track indexes + std::vector mftTracks; + // vector of MCH(-MID) track indexes + std::vector mchTracks; + // matching candidates + MatchingCandidates matchingCandidates; + // vector of MFT-MCH track index pairs belonging to the same MC particle + std::vector> matchablePairs; + // vector of MCH track indexes that are expected to have an associated MFT track + std::vector taggedMuons; + }; + + using CollisionInfos = std::map; + + std::unordered_map mftTrackCovs; + + std::vector> fMatchablePairs; + MatchingCandidates fMatchingCandidates; + std::vector fTaggedMuons; + + HistogramRegistry registry{"registry", {}}; + HistogramRegistry registryMatching{"registryMatching", {}}; + HistogramRegistry registryAlignment{"registryAlignment", {}}; + + std::unordered_map matchingHistos; + + struct EfficiencyPlotter { + o2::framework::HistPtr p_num; + o2::framework::HistPtr p_den; + o2::framework::HistPtr pt_num; + o2::framework::HistPtr pt_den; + o2::framework::HistPtr phi_num; + o2::framework::HistPtr phi_den; + o2::framework::HistPtr eta_num; + o2::framework::HistPtr eta_den; + + EfficiencyPlotter(std::string path, std::string title, + HistogramRegistry& registry) + { + AxisSpec pAxis = {100, 0, 100, "p (GeV/c)"}; + AxisSpec pTAxis = {100, 0, 10, "p_{T} (GeV/c)"}; + AxisSpec etaAxis = {100, -4, -2, "#eta"}; + AxisSpec phiAxis = {90, -180, 180, "#phi (degrees)"}; + + std::string histName; + std::string histTitle; + + // momentum dependence + histName = path + "p_num"; + histTitle = title + " vs. p - num"; + p_num = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH1F, {pAxis}}); + + histName = path + "p_den"; + histTitle = title + " vs. p - den"; + p_den = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH1F, {pAxis}}); + + // pT dependence + histName = path + "pt_num"; + histTitle = title + " vs. p_{T} - num"; + pt_num = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH1F, {pTAxis}}); + + histName = path + "pt_den"; + histTitle = title + " vs. p_{T} - den"; + pt_den = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH1F, {pTAxis}}); + + // eta dependence + histName = path + "eta_num"; + histTitle = title + " vs. #eta - num"; + eta_num = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH1F, {etaAxis}}); + + histName = path + "eta_den"; + histTitle = title + " vs. #eta - den"; + eta_den = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH1F, {etaAxis}}); + + // phi dependence + histName = path + "phi_num"; + histTitle = title + " vs. #phi - num"; + phi_num = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH1F, {phiAxis}}); + + histName = path + "phi_den"; + histTitle = title + " vs. #phi - den"; + phi_den = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH1F, {phiAxis}}); + } + + template + void Fill(const T& track, bool passed) + { + double phi = track.phi() * 180 / TMath::Pi(); + std::get>(p_den)->Fill(track.p()); + std::get>(pt_den)->Fill(track.pt()); + std::get>(eta_den)->Fill(track.eta()); + std::get>(phi_den)->Fill(phi); + + if (passed) { + std::get>(p_num)->Fill(track.p()); + std::get>(pt_num)->Fill(track.pt()); + std::get>(eta_num)->Fill(track.eta()); + std::get>(phi_num)->Fill(phi); + } + } + }; + + struct MatchingPlotter { + o2::framework::HistPtr fTrueMatchRanking; + o2::framework::HistPtr fTrueMatchRankingVsP; + o2::framework::HistPtr fTrueMatchRankingVsPt; + //- + o2::framework::HistPtr fTrueMatchRankingGoodMCH; + o2::framework::HistPtr fTrueMatchRankingGoodMCHVsP; + o2::framework::HistPtr fTrueMatchRankingGoodMCHVsPt; + //- + o2::framework::HistPtr fTrueMatchRankingPairedMCH; + o2::framework::HistPtr fTrueMatchRankingPairedMCHVsP; + o2::framework::HistPtr fTrueMatchRankingPairedMCHVsPt; + //- + o2::framework::HistPtr fTrueMatchRankingGoodPairedMCH; + o2::framework::HistPtr fTrueMatchRankingGoodPairedMCHVsP; + o2::framework::HistPtr fTrueMatchRankingGoodPairedMCHVsPt; + //- + o2::framework::HistPtr fTrueMatchRankingGoodPairedMCHMFT; + o2::framework::HistPtr fTrueMatchRankingGoodPairedMCHMFTVsP; + o2::framework::HistPtr fTrueMatchRankingGoodPairedMCHMFTVsPt; + //- + o2::framework::HistPtr fMissedMatches; + o2::framework::HistPtr fMissedMatchesGoodMCH; + o2::framework::HistPtr fMissedMatchesGoodMCHMFT; + //- + o2::framework::HistPtr fMatchRankingWrtProd; + o2::framework::HistPtr fMatchRankingWrtProdVsP; + o2::framework::HistPtr fMatchRankingWrtProdVsPt; + //- + o2::framework::HistPtr fTrueMatchScore; + o2::framework::HistPtr fTrueMatchScoreVsP; + o2::framework::HistPtr fTrueMatchScoreVsPt; + o2::framework::HistPtr fFakeMatchScore; + o2::framework::HistPtr fFakeMatchScoreVsP; + o2::framework::HistPtr fFakeMatchScoreVsPt; + EfficiencyPlotter fMatchingPurityPlotter; + EfficiencyPlotter fPairingEfficiencyPlotter; + EfficiencyPlotter fMatchingEfficiencyPlotter; + EfficiencyPlotter fFakeMatchingEfficiencyPlotter; + + MatchingPlotter(std::string path, + HistogramRegistry& registry) + : fMatchingPurityPlotter(path + "matching-purity/", "Matching purity", registry), + fPairingEfficiencyPlotter(path + "pairing-efficiency/", "Pairing efficiency", registry), + fMatchingEfficiencyPlotter(path + "matching-efficiency/", "Matching efficiency", registry), + fFakeMatchingEfficiencyPlotter(path + "fake-matching-efficiency/", "Fake matching efficiency", registry) + { + AxisSpec pAxis = {100, 0, 100, "p (GeV/c)"}; + AxisSpec ptAxis = {100, 0, 10, "p_{T} (GeV/c)"}; + + AxisSpec indexAxis = {6, 0, 6, "ranking index"}; + std::string histName = path + "trueMatchRanking"; + std::string histTitle = "True match ranking"; + fTrueMatchRanking = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH1F, {indexAxis}}); + histName = path + "trueMatchRankingVsP"; + histTitle = "True match ranking vs. p"; + fTrueMatchRankingVsP = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {pAxis, indexAxis}}); + histName = path + "trueMatchRankingVsPt"; + histTitle = "True match ranking vs. p_{T}"; + fTrueMatchRankingVsPt = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {ptAxis, indexAxis}}); + //- + histName = path + "trueMatchRankingGoodMCH"; + histTitle = "True match ranking - good MCH tracks"; + fTrueMatchRankingGoodMCH = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH1F, {indexAxis}}); + histName = path + "trueMatchRankingGoodMCHVsP"; + histTitle = "True match ranking vs. p - good MCH tracks"; + fTrueMatchRankingGoodMCHVsP = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {pAxis, indexAxis}}); + histName = path + "trueMatchRankingGoodMCHVsPt"; + histTitle = "True match ranking vs. p_{T} - good MCH tracks"; + fTrueMatchRankingGoodMCHVsPt = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {ptAxis, indexAxis}}); + //- + histName = path + "trueMatchRankingPairedMCH"; + histTitle = "True match ranking - paired MCH tracks"; + fTrueMatchRankingPairedMCH = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH1F, {indexAxis}}); + histName = path + "trueMatchRankingPairedMCHVsP"; + histTitle = "True match ranking vs. p - paired MCH tracks"; + fTrueMatchRankingPairedMCHVsP = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {pAxis, indexAxis}}); + histName = path + "trueMatchRankingPairedMCHVsPt"; + histTitle = "True match ranking vs. p_{T} - paired MCH tracks"; + fTrueMatchRankingPairedMCHVsPt = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {ptAxis, indexAxis}}); + //- + histName = path + "trueMatchRankingGoodPairedMCH"; + histTitle = "True match ranking - good paired MCH tracks"; + fTrueMatchRankingGoodPairedMCH = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH1F, {indexAxis}}); + histName = path + "trueMatchRankingGoodPairedMCHVsP"; + histTitle = "True match ranking vs. p - good paired MCH tracks"; + fTrueMatchRankingGoodPairedMCHVsP = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {pAxis, indexAxis}}); + histName = path + "trueMatchRankingGoodPairedMCHVsPt"; + histTitle = "True match ranking vs. p_{T} - good paired MCH tracks"; + fTrueMatchRankingGoodPairedMCHVsPt = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {ptAxis, indexAxis}}); + //- + histName = path + "trueMatchRankingGoodPairedMCHMFT"; + histTitle = "True match ranking - good paired MFT and MCH tracks"; + fTrueMatchRankingGoodPairedMCHMFT = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH1F, {indexAxis}}); + histName = path + "trueMatchRankingGoodPairedMCHMFTVsP"; + histTitle = "True match ranking vs. p - good paired MFT and MCH tracks"; + fTrueMatchRankingGoodPairedMCHMFTVsP = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {pAxis, indexAxis}}); + histName = path + "trueMatchRankingGoodPairedMCHMFTVsPt"; + histTitle = "True match ranking vs. p_{T} - good paired MFT and MCH tracks"; + fTrueMatchRankingGoodPairedMCHMFTVsPt = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {ptAxis, indexAxis}}); + + AxisSpec missedMatchAxis = {5, 0, 5, ""}; + histName = path + "missedMatches"; + histTitle = "Missed matches"; + fMissedMatches = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH1F, {missedMatchAxis}}); + std::get>(fMissedMatches)->GetXaxis()->SetBinLabel(1, "not paired"); + std::get>(fMissedMatches)->GetXaxis()->SetBinLabel(2, "not matched"); + std::get>(fMissedMatches)->GetXaxis()->SetBinLabel(3, "match missing"); + histName = path + "missedMatchesGoodMCH"; + histTitle = "Missed matches - good MCH tracks"; + fMissedMatchesGoodMCH = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH1F, {missedMatchAxis}}); + std::get>(fMissedMatchesGoodMCH)->GetXaxis()->SetBinLabel(1, "not paired"); + std::get>(fMissedMatchesGoodMCH)->GetXaxis()->SetBinLabel(2, "not matched"); + std::get>(fMissedMatchesGoodMCH)->GetXaxis()->SetBinLabel(3, "match missing"); + histName = path + "missedMatchesGoodMCHMFT"; + histTitle = "Missed matches - good MFT and MCH tracks"; + fMissedMatchesGoodMCHMFT = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH1F, {missedMatchAxis}}); + std::get>(fMissedMatchesGoodMCHMFT)->GetXaxis()->SetBinLabel(1, "not paired"); + std::get>(fMissedMatchesGoodMCHMFT)->GetXaxis()->SetBinLabel(2, "not matched"); + std::get>(fMissedMatchesGoodMCHMFT)->GetXaxis()->SetBinLabel(3, "match missing"); + + AxisSpec scoreAxis = {100, 0, 1, "matching score"}; + histName = path + "trueMatchScore"; + histTitle = "True match score"; + fTrueMatchScore = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH1F, {scoreAxis}}); + histName = path + "trueMatchScoreVsP"; + histTitle = "True match score vs. p"; + fTrueMatchScoreVsP = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {pAxis, scoreAxis}}); + histName = path + "trueMatchScoreVsPt"; + histTitle = "True match score vs. p_{T}"; + fTrueMatchScoreVsPt = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {ptAxis, scoreAxis}}); + + histName = path + "fakeMatchScore"; + histTitle = "Fake match score"; + fFakeMatchScore = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH1F, {scoreAxis}}); + histName = path + "fakeMatchScoreVsP"; + histTitle = "Fake match score vs. p"; + fFakeMatchScoreVsP = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {pAxis, scoreAxis}}); + histName = path + "fakeMatchScoreVsPt"; + histTitle = "Fake match score vs. p_{T}"; + fFakeMatchScoreVsPt = registry.add(histName.c_str(), histTitle.c_str(), {HistType::kTH2F, {ptAxis, scoreAxis}}); + } + }; + + std::unique_ptr fChi2MatchingPlotter; + std::map> fMatchingPlotters; + std::unique_ptr fTaggedMuonsMatchingPlotter; + std::unique_ptr fSelectedMuonsMatchingPlotter; + + CollisionInfos fCollisionInfos; + + template + void initCCDB(BC const& bc) + { + if (mRunNumber == bc.runNumber()) + return; + + mRunNumber = bc.runNumber(); + std::map metadata; + auto soreor = o2::ccdb::BasicCCDBManager::getRunDuration(fCCDBApi, mRunNumber); + auto ts = soreor.first; + auto grpmag = fCCDBApi.retrieveFromTFileAny(grpmagPath, metadata, ts); + o2::base::Propagator::initFieldFromGRP(grpmag); + LOGF(info, "Set field for muons"); + VarManager::SetupMuonMagField(); + if (!o2::base::GeometryManager::isGeometryLoaded()) { + ccdbManager->get(geoPath); + } + o2::mch::TrackExtrap::setField(); + auto* fieldB = static_cast(TGeoGlobalMagField::Instance()->GetField()); + if (fieldB) { + double centerMFT[3] = {0, 0, -61.4}; // Field at center of MFT + mBzAtMftCenter = fieldB->getBz(centerMFT); + // std::cout << "fieldB: " << (void*)fieldB << std::endl; + } + } + + void createMatchingHistosMC() + { + AxisSpec chi2Axis = {1000, 0, 1000, "chi^{2}"}; + AxisSpec pAxis = {1000, 0, 100, "p (GeV/c)"}; + AxisSpec pTAxis = {100, 0, 10, "p_{T} (GeV/c)"}; + AxisSpec etaAxis = {100, -4, -2, "#eta"}; + AxisSpec phiAxis = {90, -180, 180, "#phi (degrees)"}; + std::string histPath = "matching/MC/"; + + AxisSpec trackPositionXAtMFTAxis = {100, -15, 15, "MFT x (cm)"}; + AxisSpec trackPositionYAtMFTAxis = {100, -15, 15, "MFT y (cm)"}; + registry.add((histPath + "pairedMCHTracksAtMFT").c_str(), "Paired MCH tracks position at MFT end", {HistType::kTH2F, {trackPositionXAtMFTAxis, trackPositionYAtMFTAxis}}); + registry.add((histPath + "pairedMFTTracksAtMFT").c_str(), "Paired MFT tracks position at MFT end", {HistType::kTH2F, {trackPositionXAtMFTAxis, trackPositionYAtMFTAxis}}); + registry.add((histPath + "selectedMCHTracksAtMFT").c_str(), "Selected MCH tracks position at MFT end", {HistType::kTH2F, {trackPositionXAtMFTAxis, trackPositionYAtMFTAxis}}); + registry.add((histPath + "selectedMCHTracksAtMFTTrue").c_str(), "Selected MCH tracks position at MFT end - true", {HistType::kTH2F, {trackPositionXAtMFTAxis, trackPositionYAtMFTAxis}}); + registry.add((histPath + "selectedMCHTracksAtMFTFake").c_str(), "Selected MCH tracks position at MFT end - fake", {HistType::kTH2F, {trackPositionXAtMFTAxis, trackPositionYAtMFTAxis}}); + + AxisSpec pairableType = {2, 0, 2, ""}; + auto pairableTypeHist = registry.add((histPath + "pairableType").c_str(), "Pairable MCH tracks type", {HistType::kTH1F, {pairableType}}); + std::get>(pairableTypeHist)->GetXaxis()->SetBinLabel(1, "direct"); + std::get>(pairableTypeHist)->GetXaxis()->SetBinLabel(2, "decay"); + + fChi2MatchingPlotter = std::make_unique(histPath + "Prod/", registryMatching); + for (const auto& [label, func] : matchingChi2Functions) { + fMatchingPlotters[label] = std::make_unique(histPath + label + "/", registryMatching); + } + for (const auto& [label, response] : matchingMlResponses) { + fMatchingPlotters[label] = std::make_unique(histPath + label + "/", registryMatching); + } + + fTaggedMuonsMatchingPlotter = std::make_unique(histPath + "Tagged/", registryMatching); + fSelectedMuonsMatchingPlotter = std::make_unique(histPath + "Selected/", registryMatching); + } + + void createAlignmentHistos() + { + AxisSpec dxAxis = {200, -10, 10, "#Delta x (cm)"}; + AxisSpec dyAxis = {200, -10, 10, "#Delta y (cm)"}; + AxisSpec pAxis = {100, 0, 100, "p (GeV/c)"}; + std::string histPath = "alignment/"; + + registryAlignment.add((histPath + "trackDxAtMFTVsP").c_str(), "Track #Delta x vs. p", {HistType::kTH2F, {pAxis, dxAxis}}); + registryAlignment.add((histPath + "trackDyAtMFTVsP").c_str(), "Track #Delta y vs. p", {HistType::kTH2F, {pAxis, dyAxis}}); + registryAlignment.add((histPath + "trackDxAtMFTVsP_alt").c_str(), "Track #Delta x vs. p (alt method)", {HistType::kTH2F, {pAxis, dxAxis}}); + registryAlignment.add((histPath + "trackDyAtMFTVsP_alt").c_str(), "Track #Delta y vs. p (alt method)", {HistType::kTH2F, {pAxis, dyAxis}}); + + registryAlignment.add((histPath + "trackDxAtMFTVsP_fake").c_str(), "Track #Delta x vs. p (fake pairs)", {HistType::kTH2F, {pAxis, dxAxis}}); + registryAlignment.add((histPath + "trackDyAtMFTVsP_fake").c_str(), "Track #Delta y vs. p (fake pairs)", {HistType::kTH2F, {pAxis, dyAxis}}); + registryAlignment.add((histPath + "trackDxAtMFTVsP_alt_fake").c_str(), "Track #Delta x vs. p (alt method, fake pairs)", {HistType::kTH2F, {pAxis, dxAxis}}); + registryAlignment.add((histPath + "trackDyAtMFTVsP_alt_fake").c_str(), "Track #Delta y vs. p (alt method, fake pairs)", {HistType::kTH2F, {pAxis, dyAxis}}); + } + + void InitMatchingFunctions() + { + using SMatrix55Std = ROOT::Math::SMatrix; + using SMatrix55Sym = ROOT::Math::SMatrix>; + + using SVector2 = ROOT::Math::SVector; + using SVector4 = ROOT::Math::SVector; + using SVector5 = ROOT::Math::SVector; + + using SMatrix44 = ROOT::Math::SMatrix; + using SMatrix45 = ROOT::Math::SMatrix; + using SMatrix22 = ROOT::Math::SMatrix; + using SMatrix25 = ROOT::Math::SMatrix; + + // Define built-in matching functions + //________________________________________________________________________________ + mMatchingFunctionMap["matchALL"] = [](const o2::dataformats::GlobalFwdTrack& mchTrack, const o2::track::TrackParCovFwd& mftTrack) -> double { + // Match two tracks evaluating all parameters: X,Y, phi, tanl & q/pt + + SMatrix55Sym H_k, V_k; + SVector5 m_k(mftTrack.getX(), mftTrack.getY(), mftTrack.getPhi(), + mftTrack.getTanl(), mftTrack.getInvQPt()), + r_k_kminus1; + SVector5 GlobalMuonTrackParameters = mchTrack.getParameters(); + SMatrix55Sym GlobalMuonTrackCovariances = mchTrack.getCovariances(); + V_k(0, 0) = mftTrack.getCovariances()(0, 0); + V_k(1, 1) = mftTrack.getCovariances()(1, 1); + V_k(2, 2) = mftTrack.getCovariances()(2, 2); + V_k(3, 3) = mftTrack.getCovariances()(3, 3); + V_k(4, 4) = mftTrack.getCovariances()(4, 4); + H_k(0, 0) = 1.0; + H_k(1, 1) = 1.0; + H_k(2, 2) = 1.0; + H_k(3, 3) = 1.0; + H_k(4, 4) = 1.0; + + // Covariance of residuals + SMatrix55Std invResCov = (V_k + ROOT::Math::Similarity(H_k, GlobalMuonTrackCovariances)); + invResCov.Invert(); + + // Update Parameters + r_k_kminus1 = m_k - H_k * GlobalMuonTrackParameters; // Residuals of prediction + + auto matchChi2Track = ROOT::Math::Similarity(r_k_kminus1, invResCov); + + return matchChi2Track; + }; + + //________________________________________________________________________________ + mMatchingFunctionMap["matchXYPhiTanl"] = [](const o2::dataformats::GlobalFwdTrack& mchTrack, const o2::track::TrackParCovFwd& mftTrack) -> double { + + // Match two tracks evaluating positions & angles + + SMatrix45 H_k; + SMatrix44 V_k; + SVector4 m_k(mftTrack.getX(), mftTrack.getY(), mftTrack.getPhi(), + mftTrack.getTanl()), + r_k_kminus1; + SVector5 GlobalMuonTrackParameters = mchTrack.getParameters(); + SMatrix55Sym GlobalMuonTrackCovariances = mchTrack.getCovariances(); + V_k(0, 0) = mftTrack.getCovariances()(0, 0); + V_k(1, 1) = mftTrack.getCovariances()(1, 1); + V_k(2, 2) = mftTrack.getCovariances()(2, 2); + V_k(3, 3) = mftTrack.getCovariances()(3, 3); + H_k(0, 0) = 1.0; + H_k(1, 1) = 1.0; + H_k(2, 2) = 1.0; + H_k(3, 3) = 1.0; + + // Covariance of residuals + SMatrix44 invResCov = (V_k + ROOT::Math::Similarity(H_k, GlobalMuonTrackCovariances)); + invResCov.Invert(); + + // Residuals of prediction + r_k_kminus1 = m_k - H_k * GlobalMuonTrackParameters; + + auto matchChi2Track = ROOT::Math::Similarity(r_k_kminus1, invResCov); + + return matchChi2Track; }; + + //________________________________________________________________________________ + mMatchingFunctionMap["matchXY"] = [](const o2::dataformats::GlobalFwdTrack& mchTrack, const o2::track::TrackParCovFwd& mftTrack) -> double { + + // Calculate Matching Chi2 - X and Y positions + + SMatrix25 H_k; + SMatrix22 V_k; + SVector2 m_k(mftTrack.getX(), mftTrack.getY()), r_k_kminus1; + SVector5 GlobalMuonTrackParameters = mchTrack.getParameters(); + SMatrix55Sym GlobalMuonTrackCovariances = mchTrack.getCovariances(); + V_k(0, 0) = mftTrack.getCovariances()(0, 0); + V_k(1, 1) = mftTrack.getCovariances()(1, 1); + H_k(0, 0) = 1.0; + H_k(1, 1) = 1.0; + + // Covariance of residuals + SMatrix22 invResCov = (V_k + ROOT::Math::Similarity(H_k, GlobalMuonTrackCovariances)); + invResCov.Invert(); + + // Residuals of prediction + r_k_kminus1 = m_k - H_k * GlobalMuonTrackParameters; + auto matchChi2Track = ROOT::Math::Similarity(r_k_kminus1, invResCov); + + return matchChi2Track; }; + } + + void init(o2::framework::InitContext&) + { + // Load geometry + ccdbManager->setURL(ccdburl); + ccdbManager->setCaching(true); + ccdbManager->setLocalObjectValidityChecking(); + fCCDBApi.init(ccdburl); + mRunNumber = 0; + + if (!o2::base::GeometryManager::isGeometryLoaded()) { + LOGF(info, "Load geometry from CCDB"); + ccdbManager->get(geoPath); + } + + // Matching functions + InitMatchingFunctions(); + for (size_t funcId = 0; funcId < sChi2FunctionsNum; funcId++) { + auto label = fConfigChi2MatchingOptions.fFunctionLabel[funcId].value; + auto funcName = fConfigChi2MatchingOptions.fFunctionName[funcId].value; + auto scoreMin = fConfigChi2MatchingOptions.fMatchingScoreCut[funcId].value; + auto matchingPlaneZ = fConfigChi2MatchingOptions.fMatchingPlaneZ[funcId].value; + + if (label == "" || funcName == "") + break; + + matchingChi2Functions[label] = funcName; + + matchingScoreCuts[label] = scoreMin; + matchingPlanesZ[label] = matchingPlaneZ; + } + + // Matching ML models + // TODO : for now we use hard coded values since the current models use 1 pT bin + binsPtMl = {-1e-6, 1000.0}; + cutValues = {0.0}; + cutDirMl = {cuts_ml::CutNot}; + o2::framework::LabeledArray mycutsMl(cutValues.data(), 1, 1, std::vector{"pT bin 0"}, std::vector{"score"}); + + for (size_t modelId = 0; modelId < sMLModelsNum; modelId++) { + auto label = fConfigMlOptions.fModelLabel[modelId].value; + auto modelPaths = fConfigMlOptions.fModelPathsCCDB[modelId].value; + auto inputFeatures = fConfigMlOptions.fInputFeatures[modelId].value; + auto modelNames = fConfigMlOptions.fModelNames[modelId].value; + auto scoreMin = fConfigMlOptions.fMatchingScoreCut[modelId].value; + auto matchingPlaneZ = fConfigMlOptions.fMatchingPlaneZ[modelId].value; + + if (label == "" || modelPaths.empty() || inputFeatures.empty() || modelNames.empty()) + break; + + matchingMlResponses[label].configure(binsPtMl, mycutsMl, cutDirMl, 1); + matchingMlResponses[label].setModelPathsCCDB(modelNames, fCCDBApi, modelPaths, fConfigCCDB.fConfigNoLaterThan.value); + matchingMlResponses[label].cacheInputFeaturesIndices(inputFeatures); + matchingMlResponses[label].init(); + + matchingScoreCuts[label] = scoreMin; + matchingPlanesZ[label] = matchingPlaneZ; + } + + int nTrackTypes = static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::MCHStandaloneTrack) + 1; + AxisSpec trackTypeAxis = {static_cast(nTrackTypes), 0.0, static_cast(nTrackTypes), "track type"}; + registry.add("nTracksPerType", "Number of tracks per type", {HistType::kTH1F, {trackTypeAxis}}); + + AxisSpec tracksMultiplicityAxis = {10000, 0, 10000, "tracks multiplicity"}; + registry.add("tracksMultiplicityMFT", "MFT tracks multiplicity", {HistType::kTH1F, {tracksMultiplicityAxis}}); + + createMatchingHistosMC(); + createAlignmentHistos(); + } + + template + bool pDCACut(const T& mchTrack, const C& collision, double nSigmaPDCA) + { + static const double sigmaPDCA23 = 80.; + static const double sigmaPDCA310 = 54.; + static const double relPRes = 0.0004; + static const double slopeRes = 0.0005; + + double thetaAbs = TMath::ATan(mchTrack.rAtAbsorberEnd() / 505.) * TMath::RadToDeg(); + + // propagate muon track to vertex + auto mchTrackAtVertex = VarManager::PropagateMuon(mchTrack, collision, VarManager::kToVertex); + + // double pUncorr = mchTrack.p(); + double p = mchTrackAtVertex.getP(); + + double pDCA = mchTrack.pDca(); + double sigmaPDCA = (thetaAbs < 3) ? sigmaPDCA23 : sigmaPDCA310; + double nrp = nSigmaPDCA * relPRes * p; + double pResEffect = sigmaPDCA / (1. - nrp / (1. + nrp)); + double slopeResEffect = 535. * slopeRes * p; + double sigmaPDCAWithRes = TMath::Sqrt(pResEffect * pResEffect + slopeResEffect * slopeResEffect); + if (pDCA > nSigmaPDCA * sigmaPDCAWithRes) { + return false; + } + + return true; + } + + template + bool IsGoodMuon(const T& mchTrack, const C& collision, + double chi2Cut, + double pCut, + double pTCut, + std::array etaCut, + std::array rAbsCut, + double nSigmaPdcaCut) + { + // chi2 cut + if (mchTrack.chi2() > chi2Cut) + return false; + + // momentum cut + if (mchTrack.p() < pCut) { + return false; // skip low-momentum tracks + } + + // transverse momentum cut + if (mchTrack.pt() < pTCut) { + return false; // skip low-momentum tracks + } + + // Eta cut + double eta = mchTrack.eta(); + if ((eta < etaCut[0] || eta > etaCut[1])) { + return false; + } + + // RAbs cut + double rAbs = mchTrack.rAtAbsorberEnd(); + if ((rAbs < rAbsCut[0] || rAbs > rAbsCut[1])) { + return false; + } + + // pDCA cut + if (!pDCACut(mchTrack, collision, nSigmaPdcaCut)) { + return false; + } + + return true; + } + + template + bool IsGoodMuon(const T& muonTrack, const C& collision) + { + return IsGoodMuon(muonTrack, collision, fTrackChi2MchUp, fPMchLow, fPtMchLow, {fEtaMchLow, fEtaMchUp}, {fRabsLow, fRabsUp}, fSigmaPdcaUp); + } + + template + bool IsGoodGlobalMuon(const T& muonTrack, const C& collision) + { + return IsGoodMuon(muonTrack, collision, fTrackChi2MchUp, fPMchLow, fPtMchLow, {fEtaMftLow, fEtaMftUp}, {fRabsLow, fRabsUp}, fSigmaPdcaUp); + } + + template + bool IsGoodMFT(const T& mftTrack, + double chi2Cut, + int nClustersCut) + { + // std::cout << std::format("Checking MFT track") << std::endl; + // std::cout << std::format(" chi2={}", mftTrack.chi2()) << std::endl; + // std::cout << std::format(" nClusters={}", mftTrack.nClusters()) << std::endl; + // chi2 cut + if (mftTrack.chi2() > chi2Cut) + return false; + + // number of clusters cut + if (mftTrack.nClusters() < nClustersCut) + return false; + + return true; + } + + template + bool IsGoodMFT(const T& mftTrack) + { + return IsGoodMFT(mftTrack, fTrackChi2MftUp, fTrackNClustMftLow); + } + + template + bool IsGoodGlobalMatching(const TMUON& muonTrack, + double matchingScore, + double matchingScoreCut) + { + if (static_cast(muonTrack.trackType()) > 2) + return false; + + // MFT-MCH matching score cut + if (matchingScore < matchingScoreCut) + return false; + + return true; + } + + template + bool IsGoodGlobalMatching(const TMUON& muonTrack, double matchingScore) + { + return IsGoodGlobalMatching(muonTrack, matchingScore, fMatchingChi2ScoreMftMchLow); + } + + template + bool IsTrueGlobalMatching(const TMUON& muonTrack, const std::vector>& matchablePairs) + { + if (static_cast(muonTrack.trackType()) > 2) + return false; + + int64_t mchTrackId = static_cast(muonTrack.matchMCHTrackId()); + int64_t mftTrackId = static_cast(muonTrack.matchMFTTrackId()); + + std::pair trackIndexes = std::make_pair(mchTrackId, mftTrackId); + + return (std::find(matchablePairs.begin(), matchablePairs.end(), trackIndexes) != matchablePairs.end()); + } + + bool IsMatchableMCH(int64_t mchTrackId, const std::vector>& matchablePairs) + { + for (auto [id1, id2] : matchablePairs) { + if (mchTrackId == id1) + return true; + } + return false; + } + + std::optional> GetMatchablePairForMCH(int64_t mchTrackId, const std::vector>& matchablePairs) + { + for (auto pair : matchablePairs) { + if (mchTrackId == pair.first) + return pair; + } + return {}; + } + + template + o2::dataformats::GlobalFwdTrack FwdToTrackPar(const T& track) + { + double chi2 = track.chi2(); + SMatrix5 tpars(track.x(), track.y(), track.phi(), track.tgl(), track.signed1Pt()); + std::vector v1{0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0}; + SMatrix55 tcovs(v1.begin(), v1.end()); + o2::track::TrackParCovFwd trackparCov{track.z(), tpars, tcovs, chi2}; + o2::dataformats::GlobalFwdTrack fwdtrack; + fwdtrack.setParameters(trackparCov.getParameters()); + fwdtrack.setZ(trackparCov.getZ()); + fwdtrack.setCovariances(trackparCov.getCovariances()); + return fwdtrack; + } + + template + o2::dataformats::GlobalFwdTrack FwdToTrackPar(const T& track, const C& cov) + { + double chi2 = track.chi2(); + SMatrix5 tpars(track.x(), track.y(), track.phi(), track.tgl(), track.signed1Pt()); + std::vector v1{cov.cXX(), cov.cXY(), cov.cYY(), cov.cPhiX(), cov.cPhiY(), + cov.cPhiPhi(), cov.cTglX(), cov.cTglY(), cov.cTglPhi(), cov.cTglTgl(), + cov.c1PtX(), cov.c1PtY(), cov.c1PtPhi(), cov.c1PtTgl(), cov.c1Pt21Pt2()}; + SMatrix55 tcovs(v1.begin(), v1.end()); + o2::track::TrackParCovFwd trackparCov{track.z(), tpars, tcovs, chi2}; + o2::dataformats::GlobalFwdTrack fwdtrack; + fwdtrack.setParameters(trackparCov.getParameters()); + fwdtrack.setZ(trackparCov.getZ()); + fwdtrack.setCovariances(trackparCov.getCovariances()); + return fwdtrack; + } + + o2::dataformats::GlobalFwdTrack PropagateToZMCH(const o2::dataformats::GlobalFwdTrack& muon, const double z) + { + auto mchTrack = mExtrap.FwdtoMCH(muon); + + float absFront = -90.f; + float absBack = -505.f; + + if (muon.getZ() < absBack && z > absFront) { + // extrapolation through the absorber in the upstream direction + // std::cout << " extrapToVertexWithoutBranson()" << std::endl; + o2::mch::TrackExtrap::extrapToVertexWithoutBranson(mchTrack, z); + } else { + // all other cases + // std::cout << " extrapToZ()" << std::endl; + o2::mch::TrackExtrap::extrapToZ(mchTrack, z); + } + + auto proptrack = mExtrap.MCHtoFwd(mchTrack); + o2::dataformats::GlobalFwdTrack propmuon; + propmuon.setParameters(proptrack.getParameters()); + propmuon.setZ(proptrack.getZ()); + propmuon.setCovariances(proptrack.getCovariances()); + + return propmuon; + } + + template + o2::dataformats::GlobalFwdTrack PropagateToZMCH(const T& muon, const double z) + { + double chi2 = muon.chi2(); + SMatrix5 tpars(muon.x(), muon.y(), muon.phi(), muon.tgl(), muon.signed1Pt()); + std::vector v1{muon.cXX(), muon.cXY(), muon.cYY(), muon.cPhiX(), muon.cPhiY(), + muon.cPhiPhi(), muon.cTglX(), muon.cTglY(), muon.cTglPhi(), muon.cTglTgl(), + muon.c1PtX(), muon.c1PtY(), muon.c1PtPhi(), muon.c1PtTgl(), muon.c1Pt21Pt2()}; + SMatrix55 tcovs(v1.begin(), v1.end()); + o2::track::TrackParCovFwd fwdtrack{muon.z(), tpars, tcovs, chi2}; + o2::dataformats::GlobalFwdTrack track; + track.setParameters(fwdtrack.getParameters()); + track.setZ(fwdtrack.getZ()); + track.setCovariances(fwdtrack.getCovariances()); + auto mchTrack = mExtrap.FwdtoMCH(track); + + float absFront = -90.f; + float absBack = -505.f; + + if (fwdtrack.getZ() < absBack && z > absFront) { + // extrapolation through the absorber in the upstream direction + o2::mch::TrackExtrap::extrapToVertexWithoutBranson(mchTrack, z); + } else { + // all other cases + o2::mch::TrackExtrap::extrapToZ(mchTrack, z); + } + + auto proptrack = mExtrap.MCHtoFwd(mchTrack); + o2::dataformats::GlobalFwdTrack propmuon; + propmuon.setParameters(proptrack.getParameters()); + propmuon.setZ(proptrack.getZ()); + propmuon.setCovariances(proptrack.getCovariances()); + + return propmuon; + } + + o2::dataformats::GlobalFwdTrack PropagateToZMFT(const o2::dataformats::GlobalFwdTrack& mftTrack, const double z) + { + o2::dataformats::GlobalFwdTrack fwdtrack{mftTrack}; + fwdtrack.propagateToZhelix(z, mBzAtMftCenter); + return fwdtrack; + } + + template + o2::dataformats::GlobalFwdTrack PropagateToZMFT(const TMFT& mftTrack, const CMFT& mftCov, const double z) + { + o2::dataformats::GlobalFwdTrack fwdtrack = FwdToTrackPar(mftTrack, mftCov); + return PropagateToZMFT(fwdtrack, z); + } + + template + void InitCollisions(EVT const& collisions, + BC const& bcs, + TMUON const& muonTracks, + TMFT const& mftTracks, + CollisionInfos& collisionInfos) + { + collisionInfos.clear(); + + // fill collision information for global muon tracks (MFT-MCH-MID matches) + for (auto muonTrack : muonTracks) { + if (!muonTrack.has_collision()) + continue; + + auto collision = collisions.rawIteratorAt(muonTrack.collisionId()); + int64_t collisionIndex = collision.globalIndex(); + + // std::cout << std::format("Collision indexes: {} / {}", collisionIndex, muonTrack.collisionId()) << std::endl; + + auto bc = bcs.rawIteratorAt(collision.bcId()); + + auto& collisionInfo = collisionInfos[collisionIndex]; + collisionInfo.index = collisionIndex; + collisionInfo.bc = bc.globalBC(); + collisionInfo.zVertex = collision.posZ(); + + if (static_cast(muonTrack.trackType()) > 2) { + // standalone MCH or MCH-MID tracks + int64_t mchTrackIndex = muonTrack.globalIndex(); + // if (!IsGoodMuon(muonTrack, collision)) continue; + collisionInfo.mchTracks.push_back(mchTrackIndex); + } else { + // global muon tracks (MFT-MCH or MFT-MCH-MID) + int64_t muonTrackIndex = muonTrack.globalIndex(); + double matchingScore = chi2ToScore(muonTrack.chi2MatchMCHMFT()); + auto const& mchTrack = muonTrack.template matchMCHTrack_as(); + int64_t mchTrackIndex = mchTrack.globalIndex(); + + // check if a vector of global muon candidates is already available for the current MCH index + // if not, initialize a new one and add the current global muon track + // bool globalMuonTrackFound = false; + auto matchingCandidateIterator = collisionInfo.matchingCandidates.find(mchTrackIndex); + if (matchingCandidateIterator != collisionInfo.matchingCandidates.end()) { + matchingCandidateIterator->second.push_back(std::make_pair(muonTrackIndex, matchingScore)); + // globalMuonTrackFound = true; + } else { + collisionInfo.matchingCandidates[mchTrackIndex].push_back(std::make_pair(muonTrackIndex, matchingScore)); + } + } + } + + // fill collision information for MFT standalone tracks + for (auto mftTrack : mftTracks) { + if (!mftTrack.has_collision()) + continue; + + auto collision = collisions.rawIteratorAt(mftTrack.collisionId()); + int64_t collisionIndex = collision.globalIndex(); + + auto bc = bcs.rawIteratorAt(collision.bcId()); + + int64_t mftTrackIndex = mftTrack.globalIndex(); + + auto& collisionInfo = collisionInfos[collisionIndex]; + collisionInfo.index = collisionIndex; + collisionInfo.bc = bc.globalBC(); + collisionInfo.zVertex = collision.posZ(); + + collisionInfo.mftTracks.push_back(mftTrackIndex); + } + + // sort the vectors of matching candidates in ascending order based on the matching score value + auto compareMatchingScore = [](std::pair track1, std::pair track2) -> bool { + return (track1.second > track2.second); + }; + + for (auto& [collisionIndex, collisionInfo] : collisionInfos) { + for (auto& [mchIndex, globalTracksVector] : collisionInfo.matchingCandidates) { + std::sort(globalTracksVector.begin(), globalTracksVector.end(), compareMatchingScore); + } + } + } + + template + void GetMatchablePairs(const CollisionInfo& collisionInfo, + TMUON const& muonTracks, + TMFT const& mftTracks, + std::vector>& matchablePairs) + { + matchablePairs.clear(); + for (const auto& muonTrack : muonTracks) { + // only consider MCH standalone or MCH-MID matches + if (static_cast(muonTrack.trackType()) <= 2) + continue; + + // only consider tracks associated to the current collision + if (!muonTrack.has_collision()) + continue; + if (muonTrack.collisionId() != collisionInfo.index) + continue; + + // skip tracks that do not have an associated MC particle + if (!muonTrack.has_mcParticle()) + continue; + // get the index associated to the MC particle + auto muonMcParticle = muonTrack.mcParticle(); + int64_t muonMcTrackIndex = muonMcParticle.globalIndex(); + + for (const auto& mftTrack : mftTracks) { + // skip tracks that do not have an associated MC particle + if (!mftTrack.has_mcParticle()) + continue; + // get the index associated to the MC particle + auto mftMcParticle = mftTrack.mcParticle(); + int64_t mftMcTrackIndex = mftMcParticle.globalIndex(); + + if (muonMcTrackIndex == mftMcTrackIndex) { + matchablePairs.emplace_back(std::make_pair(static_cast(muonTrack.globalIndex()), + static_cast(mftTrack.globalIndex()))); + } else { + // check if the muon particle is a decay product of the MFT particle + for (auto& motherParticle : muonMcParticle.template mothers_as()) { + if (motherParticle.globalIndex() == mftMcTrackIndex) { + matchablePairs.emplace_back(std::make_pair(static_cast(muonTrack.globalIndex()), + static_cast(mftTrack.globalIndex()))); + break; + } + } + } + } + } + } + + template + int GetTrueMatchIndex(TMUON const& muonTracks, + const std::vector>& matchCandidatesVector, + const std::vector>& matchablePairs) + { + // find the index of the matching candidate that corresponds to the true match + // index=1 corresponds to the leading candidate + // index=0 means no candidate was found that corresponds to the true match + int trueMatchIndex = 0; + for (size_t i = 0; i < matchCandidatesVector.size(); i++) { + auto const& muonTrack = muonTracks.rawIteratorAt(matchCandidatesVector[i].first); + + if (IsTrueGlobalMatching(muonTrack, matchablePairs)) { + trueMatchIndex = i + 1; + break; + } + } + return trueMatchIndex; + } + + // for each MCH standalone track, collect the associated matching candidates + template + void GetSelectedMuons(const CollisionInfo& collisionInfo, + C const& collisions, + TMUON const& muonTracks, + std::vector& selectedMuons) + { + selectedMuons.clear(); + for (auto muonTrack : muonTracks) { + + // only consider MCH-MID matches + if (static_cast(muonTrack.trackType()) != 3) { + continue; + } + + // only select MCH-MID tracks from the current collision + if (!muonTrack.has_collision()) + continue; + if (static_cast(muonTrack.collisionId()) != collisionInfo.index) + continue; + + const auto& collision = collisions.rawIteratorAt(muonTrack.collisionId()); + + // select MCH tracks with strict quality cuts + if (!IsGoodMuon(muonTrack, collision, + fMuonTaggingTrackChi2MchUp, + fMuonTaggingPMchLow, + fMuonTaggingPtMchLow, + {fMuonTaggingEtaMchLow, fMuonTaggingEtaMchUp}, + {fMuonTaggingRabsLow, fMuonTaggingRabsUp}, + fMuonTaggingSigmaPdcaUp)) { + continue; + } + + // propagate MCH track to the vertex + auto mchTrackAtVertex = VarManager::PropagateMuon(muonTrack, collision, VarManager::kToVertex); + + // propagate the track from the vertex to the first MFT plane + const auto& extrapToMFTfirst = PropagateToZMCH(mchTrackAtVertex, o2::mft::constants::mft::LayerZCoordinate()[0]); + double rFront = std::sqrt(extrapToMFTfirst.getX() * extrapToMFTfirst.getX() + extrapToMFTfirst.getY() * extrapToMFTfirst.getY()); + double rMinFront = 3.f; + double rMaxFront = 9.f; + if (rFront < rMinFront || rFront > rMaxFront) + continue; + + // propagate the track from the vertex to the last MFT plane + const auto& extrapToMFTlast = PropagateToZMCH(mchTrackAtVertex, o2::mft::constants::mft::LayerZCoordinate()[9]); + double rBack = std::sqrt(extrapToMFTlast.getX() * extrapToMFTlast.getX() + extrapToMFTlast.getY() * extrapToMFTlast.getY()); + double rMinBack = 5.f; + double rMaxBack = 12.f; + if (rBack < rMinBack || rBack > rMaxBack) + continue; + + int64_t muonTrackIndex = muonTrack.globalIndex(); + selectedMuons.emplace_back(muonTrackIndex); + } + } + + // for each MCH standalone track, collect the associated matching candidates + template + void GetTaggedMuons(const CollisionInfo& collisionInfo, + TMUON const& muonTracks, + const std::vector& selectedMuons, + std::vector& taggedMuons) + { + taggedMuons.clear(); + for (auto [mchIndex, globalTracksVector] : collisionInfo.matchingCandidates) { + + // check if the current muon is selected + if (std::find(selectedMuons.begin(), selectedMuons.end(), mchIndex) == selectedMuons.end()) + continue; + + // if there is only one candidate, mark the muon as select + if (globalTracksVector.size() == 1) { + taggedMuons.emplace_back(mchIndex); + continue; + } + + auto const& muonTrack0 = muonTracks.rawIteratorAt(globalTracksVector[0].first); + auto const& muonTrack1 = muonTracks.rawIteratorAt(globalTracksVector[1].first); + + double chi2diff = muonTrack1.chi2MatchMCHMFT() - muonTrack0.chi2MatchMCHMFT(); + if (chi2diff < fMuonTaggingChi2DiffLow) + continue; + + taggedMuons.emplace_back(mchIndex); + } + } + + template + void FillMatchingPlotsMC(C const& collision, + TMUON const& muonTracks, + TMFT const& mftTracks, + const MatchingCandidates& matchingCandidates, + const std::vector>& matchablePairs, + double matchingScoreCut, + MatchingPlotter* plotter) + { + // ==================================== + // Matching candidates hierarchy + + for (const auto& [mchIndex, globalTracksVector] : matchingCandidates) { + // check if the MCH track belongs to a matchable pair + bool isPairedMCH = IsMatchableMCH(static_cast(mchIndex), matchablePairs); + + // get the standalone MCH track + auto const& mchTrack = muonTracks.rawIteratorAt(mchIndex); + double mchMom = mchTrack.p(); + double mchPt = mchTrack.pt(); + + // MCH track quality flag + bool isGoodMCH = IsGoodGlobalMuon(mchTrack, collision); + + auto matchablePair = GetMatchablePairForMCH(static_cast(mchIndex), matchablePairs); + bool hasMatchablePair = matchablePair.has_value(); + bool isGoodPair = false; + if (hasMatchablePair) { + auto const& pairedMftTrack = mftTracks.rawIteratorAt(matchablePair.value().second); + isGoodPair = isGoodMCH && IsGoodMFT(pairedMftTrack); + } + + // std::cout << std::format("Checking matchable MCH track #{}", mchIndex) << std::endl; + + // find the index of the matching candidate that corresponds to the true match + // index=1 corresponds to the leading candidate + // index=0 means no candidate was found that corresponds to the true match + int trueMatchIndex = GetTrueMatchIndex(muonTracks, globalTracksVector, matchablePairs); + + std::get>(plotter->fTrueMatchRanking)->Fill(trueMatchIndex); + std::get>(plotter->fTrueMatchRankingVsP)->Fill(mchMom, trueMatchIndex); + std::get>(plotter->fTrueMatchRankingVsPt)->Fill(mchPt, trueMatchIndex); + + if (isGoodMCH) { + std::get>(plotter->fTrueMatchRankingGoodMCH)->Fill(trueMatchIndex); + std::get>(plotter->fTrueMatchRankingGoodMCHVsP)->Fill(mchMom, trueMatchIndex); + std::get>(plotter->fTrueMatchRankingGoodMCHVsPt)->Fill(mchPt, trueMatchIndex); + } + + if (isPairedMCH) { + std::get>(plotter->fTrueMatchRankingPairedMCH)->Fill(trueMatchIndex); + std::get>(plotter->fTrueMatchRankingPairedMCHVsP)->Fill(mchMom, trueMatchIndex); + std::get>(plotter->fTrueMatchRankingPairedMCHVsPt)->Fill(mchPt, trueMatchIndex); + } + + if (isGoodMCH && isPairedMCH) { + std::get>(plotter->fTrueMatchRankingGoodPairedMCH)->Fill(trueMatchIndex); + std::get>(plotter->fTrueMatchRankingGoodPairedMCHVsP)->Fill(mchMom, trueMatchIndex); + std::get>(plotter->fTrueMatchRankingGoodPairedMCHVsPt)->Fill(mchPt, trueMatchIndex); + } + + if (isGoodPair) { + std::get>(plotter->fTrueMatchRankingGoodPairedMCHMFT)->Fill(trueMatchIndex); + std::get>(plotter->fTrueMatchRankingGoodPairedMCHMFTVsP)->Fill(mchMom, trueMatchIndex); + std::get>(plotter->fTrueMatchRankingGoodPairedMCHMFTVsP)->Fill(mchPt, trueMatchIndex); + } + + if (trueMatchIndex == 0) { + // missed matches + if (!isPairedMCH) { + // the MCH track does not have a corresponding MFT track for matching + std::get>(plotter->fMissedMatches)->Fill(0); + if (isGoodMCH) { + std::get>(plotter->fMissedMatchesGoodMCH)->Fill(0); + } + } else { + if (globalTracksVector.empty()) { + // the MCH track was not matched to any MFT track + std::get>(plotter->fMissedMatches)->Fill(1); + if (isGoodMCH) { + std::get>(plotter->fMissedMatchesGoodMCH)->Fill(1); + } + if (isGoodPair) { + std::get>(plotter->fMissedMatchesGoodMCHMFT)->Fill(1); + } + } else { + // the correct match is not among the stored candidates + std::get>(plotter->fMissedMatches)->Fill(2); + if (isGoodMCH) { + std::get>(plotter->fMissedMatchesGoodMCH)->Fill(2); + } + if (isGoodPair) { + std::get>(plotter->fMissedMatchesGoodMCHMFT)->Fill(2); + } + } + } + } + } + + // ==================================== + // Matching properties + + for (auto [mchIndex, globalTracksVector] : matchingCandidates) { + if (globalTracksVector.size() < 1) + continue; + + // get the standalone MCH track + auto const& mchTrack = muonTracks.rawIteratorAt(mchIndex); + + // get leading matching candidate + auto const& muonTrack = muonTracks.rawIteratorAt(globalTracksVector[0].first); + + auto const& mftTrack = muonTrack.template matchMFTTrack_as(); + + // skip global muon tracks that do not pass the MCH and MFT quality cuts + if (!IsGoodGlobalMuon(mchTrack, collision)) + continue; + if (!IsGoodMFT(mftTrack)) + continue; + + double matchingScore = globalTracksVector[0].second; + double mchMom = mchTrack.p(); + double mchPt = mchTrack.pt(); + + // check the matching quality, but set the minimum matching score to zero + bool isGoodMatchNoScore = IsGoodGlobalMatching(muonTrack, matchingScore, 0); + // bool isGoodMatch = IsGoodGlobalMatching(muonTrack, matchingScore, matchingScoreCut); + + bool isTrueMatch = IsTrueGlobalMatching(muonTrack, matchablePairs); + + // matching score analysis + if (isGoodMatchNoScore) { + if (isTrueMatch) { + std::get>(plotter->fTrueMatchScore)->Fill(matchingScore); + std::get>(plotter->fTrueMatchScoreVsP)->Fill(mchMom, matchingScore); + std::get>(plotter->fTrueMatchScoreVsPt)->Fill(mchPt, matchingScore); + } else { + std::get>(plotter->fFakeMatchScore)->Fill(matchingScore); + std::get>(plotter->fFakeMatchScoreVsP)->Fill(mchMom, matchingScore); + std::get>(plotter->fFakeMatchScoreVsPt)->Fill(mchPt, matchingScore); + } + } + } + + // ==================================== + // Matching purity + + for (auto [mchIndex, globalTracksVector] : matchingCandidates) { + if (globalTracksVector.size() < 1) + continue; + + // get the leading matching candidate + auto const& muonTrack = muonTracks.rawIteratorAt(globalTracksVector[0].first); + double matchingScore = globalTracksVector[0].second; + + // get the standalone MCH and MFT tracks + auto const& mchTrack = muonTracks.rawIteratorAt(mchIndex); + auto const& mftTrack = muonTrack.template matchMFTTrack_as(); + + // skip global muon tracks that do not pass the MCH and MFT quality cuts + if (!IsGoodGlobalMuon(mchTrack, collision)) + continue; + if (!IsGoodMFT(mftTrack)) + continue; + + // skip candidates that do not pass the matching quality cuts + if (!IsGoodGlobalMatching(muonTrack, matchingScore, matchingScoreCut)) + continue; + + // check if the matching candidate is a true one + bool isTrueMatch = IsTrueGlobalMatching(muonTrack, matchablePairs); + + // fill matching purity plots + plotter->fMatchingPurityPlotter.Fill(mchTrack, isTrueMatch); + } + + // ==================================== + // Matching efficiencies + + // outer loop on matchable pairs + for (auto [matchableMchIndex, matchableMftIndex] : matchablePairs) { + // get the standalone MCH track + // std::cout << std::format("Retrieving paired tracks: {} / {}", matchableMchIndex, matchableMftIndex) << std::endl; + auto const& mchTrack = muonTracks.rawIteratorAt(matchableMchIndex); + auto const& pairedMftTrack = mftTracks.rawIteratorAt(matchableMftIndex); + // std::cout << std::format("... done.") << std::endl; + + // skip track pairs that do not pass the MCH and MFT quality cuts + // we only consider matchable pairs that fulfill the track quality requirements + // std::cout << std::format("Checking tracks...") << std::endl; + if (!IsGoodGlobalMuon(mchTrack, collision)) + continue; + // std::cout << std::format("... MCH ok.") << std::endl; + if (!IsGoodMFT(pairedMftTrack)) + continue; + // std::cout << std::format("... MFT ok.") << std::endl; + + bool goodMatchFound = false; + bool isTrueMatch = false; + + // check if we have some matching candidates for the current matchable MCH track + if (matchingCandidates.count(matchableMchIndex) > 0) { + // std::cout << std::format("Getting matching candidates for MCH track {}", matchableMchIndex) << std::endl; + const auto& globalTracksVector = matchingCandidates.at(static_cast(matchableMchIndex)); + // std::cout << std::format("Number of matching candidates: {}", globalTracksVector.size()) << std::endl; + if (!globalTracksVector.empty()) { + // get the leading matching candidate + // std::cout << std::format("Getting leading matching candidate: {}", globalTracksVector[0].first) << std::endl; + auto const& muonTrack = muonTracks.rawIteratorAt(globalTracksVector[0].first); + double matchingScore = globalTracksVector[0].second; + // std::cout << std::format("... done.") << std::endl; + + // get the standalone MFT track + // std::cout << std::format("Getting MFT track") << std::endl; + auto const& mftTrack = muonTrack.template matchMFTTrack_as(); + auto mftIndex = mftTrack.globalIndex(); + // std::cout << std::format("... done.") << std::endl; + + // a good match must pass the MFT and matching quality cuts + // the MCH track quality is already checked in the outer loop + // std::cout << std::format("Checking matched track quality") << std::endl; + goodMatchFound = IsGoodMFT(mftTrack) && IsGoodGlobalMatching(muonTrack, matchingScore, matchingScoreCut); + isTrueMatch = (mftIndex == matchableMftIndex); + // std::cout << std::format("... done: {}", goodMatchFound) << std::endl; + } + } + + // fill matching efficiency plots + plotter->fPairingEfficiencyPlotter.Fill(mchTrack, goodMatchFound); + plotter->fMatchingEfficiencyPlotter.Fill(mchTrack, (goodMatchFound && isTrueMatch)); + plotter->fFakeMatchingEfficiencyPlotter.Fill(mchTrack, (goodMatchFound && !isTrueMatch)); + } + } + + template + void RunChi2Matching(C const& collisions, + TMUON const& muonTracks, + TMFT const& /*mftTracks*/, + CMFT const& mftCovs, + std::string label, + const MatchingCandidates& matchingCandidates, + MatchingCandidates& newMatchingCandidates) + { + newMatchingCandidates.clear(); + + auto funcIter = matchingChi2Functions.find(label); + if (funcIter == matchingChi2Functions.end()) + return; + + auto funcName = funcIter->second; + + if (funcName == "prod") { + newMatchingCandidates = matchingCandidates; + return; + } + + if (mMatchingFunctionMap.count(funcName) < 1) + return; + + // std::cout << std::format("Processing {} matches with chi2 function {}", matchingCandidates.size(), funcName) << std::endl; + + auto matchingFunc = mMatchingFunctionMap.at(funcName); + for (auto& [mchIndex, globalTracksVector] : matchingCandidates) { + auto const& mchTrack = muonTracks.rawIteratorAt(mchIndex); + + for (auto& [muonIndex, score] : globalTracksVector) { + auto const& muonTrack = muonTracks.rawIteratorAt(muonIndex); + if (!muonTrack.has_collision()) + continue; + + auto collision = collisions.rawIteratorAt(muonTrack.collisionId()); + + // get MCH and MFT standalone tracks + // auto mchTrack = muonTrack.template matchMCHTrack_as(); + auto const& mftTrack = muonTrack.template matchMFTTrack_as(); + if (mftTrackCovs.count(mftTrack.globalIndex()) < 1) { + // std::cout << std::format("Covariance matrix for MFT track #{} not found", mftTrack.globalIndex()) << std::endl; + continue; + } + auto const& mftTrackCov = mftCovs.rawIteratorAt(mftTrackCovs[mftTrack.globalIndex()]); + + // get tracks parameters in O2 format + auto mftTrackProp = FwdToTrackPar(mftTrack, mftTrackCov); + auto mchTrackProp = FwdToTrackPar(mchTrack, mchTrack); + auto mchTrackPropAlt = FwdToTrackPar(mchTrack, mchTrack); + + // extrapolate to the matching plane + auto matchingPlaneZ = matchingPlanesZ[label]; + // std::cout << std::format("Extrapolating tracks to z={}", matchingPlaneZ) << std::endl; + if (matchingPlaneZ < 0.) { + mftTrackProp = PropagateToZMFT(mftTrackProp, matchingPlaneZ); + mchTrackProp = PropagateToZMCH(mchTrackProp, matchingPlaneZ); + auto mchTrackAtVertex = VarManager::PropagateMuon(mchTrack, collision, VarManager::kToVertex); + mchTrackPropAlt = PropagateToZMCH(mchTrackAtVertex, matchingPlaneZ); + } + + // run the chi2 matching function + float matchingChi2 = matchingFunc(mchTrackProp, mftTrackProp); + float matchingScore = chi2ToScore(matchingChi2); + // std::cout << std::format("Matching chi2: {}, original chi2: {}", matchingChi2, muonTrack.chi2MatchMCHMFT()) << std::endl; + + // check if a vector of global muon candidates is already available for the current MCH index + // if not, initialize a new one and add the current global muon track + auto matchingCandidateIterator = newMatchingCandidates.find(mchIndex); + if (matchingCandidateIterator != newMatchingCandidates.end()) { + matchingCandidateIterator->second.push_back(std::make_pair(muonIndex, matchingScore)); + } else { + newMatchingCandidates[mchIndex].push_back(std::make_pair(muonIndex, matchingScore)); + } + } + } + } + + template + void RunMLMatching(C const& collisions, + TMUON const& muonTracks, + TMFT const& /*mftTracks*/, + CMFT const& mftCovs, + std::string label, + const MatchingCandidates& matchingCandidates, + MatchingCandidates& newMatchingCandidates) + { + newMatchingCandidates.clear(); + auto mlIter = matchingMlResponses.find(label); + if (mlIter == matchingMlResponses.end()) + return; + + auto& mlResponse = mlIter->second; + for (auto& [mchIndex, globalTracksVector] : matchingCandidates) { + auto const& mchTrack = muonTracks.rawIteratorAt(mchIndex); + for (auto& [muonIndex, score] : globalTracksVector) { + auto const& muonTrack = muonTracks.rawIteratorAt(muonIndex); + if (!muonTrack.has_collision()) + continue; + + auto collision = collisions.rawIteratorAt(muonTrack.collisionId()); + + // get MFT standalone track + auto const& mftTrack = muonTrack.template matchMFTTrack_as(); + if (mftTrackCovs.count(mftTrack.globalIndex()) < 1) { + // std::cout << std::format("Covariance matrix for MFT track #{} not found", mftTrack.globalIndex()) << std::endl; + continue; + } + // std::cout << fmt::format("Getting covariance matrix for MFT track #{} -> {}", mftTrack.globalIndex(), mftTrackCovs[mftTrack.globalIndex()]) << std::endl; + auto const& mftTrackCov = mftCovs.rawIteratorAt(mftTrackCovs[mftTrack.globalIndex()]); + // std::cout << fmt::format("Covariance matrix for MFT track #{} retrieved", mftTrack.globalIndex()) << std::endl; + + // get tracks parameters in O2 format + auto mftTrackProp = FwdToTrackPar(mftTrack, mftTrackCov); + auto mchTrackProp = FwdToTrackPar(mchTrack, mchTrack); + + // extrapolate to the matching plane + auto matchingPlaneZ = matchingPlanesZ[label]; + if (matchingPlaneZ < 0.) { + mftTrackProp = PropagateToZMFT(mftTrackProp, matchingPlaneZ); + mchTrackProp = PropagateToZMCH(mchTrackProp, matchingPlaneZ); + } + + // run the ML model + std::vector output; + std::vector inputML = mlResponse.getInputFeaturesGlob(muonTrack, mchTrackProp, mftTrackProp, collision); + mlResponse.isSelectedMl(inputML, 0, output); + float matchingScore = output[0]; + // std::cout << std::format("Matching score: {}, Chi2: {}", matchingScore, muonTrack.chi2MatchMCHMFT()) << std::endl; + + // check if a vector of global muon candidates is already available for the current MCH index + // if not, initialize a new one and add the current global muon track + auto matchingCandidateIterator = newMatchingCandidates.find(mchIndex); + if (matchingCandidateIterator != newMatchingCandidates.end()) { + matchingCandidateIterator->second.push_back(std::make_pair(muonIndex, matchingScore)); + } else { + newMatchingCandidates[mchIndex].push_back(std::make_pair(muonIndex, matchingScore)); + } + } + } + } + + template + void ProcessCollisionMC(const CollisionInfo& collisionInfo, + C const& collisions, + TMUON const& muonTracks, + TMFT const& mftTracks, + CMFT const& mftCovs) + { + // std::cout << std::endl << std::format("ProcessMatching() collision #{}", collisionInfo.index) << std::endl; + auto collision = collisions.rawIteratorAt(collisionInfo.index); + + std::vector> matchablePairs; + GetMatchablePairs(collisionInfo, muonTracks, mftTracks, matchablePairs); + for (auto [mchIndex, mftIndex] : matchablePairs) { + auto const& muonTrack = muonTracks.rawIteratorAt(mchIndex); + auto muonMcParticle = muonTrack.mcParticle(); + int64_t muonMcTrackIndex = muonMcParticle.globalIndex(); + double mchMom = muonTrack.p(); + + // std::cout << std::format("TOTO1 MCH track #{} type={} p={:0.3} - MFT track #{} - collision #{} - has_collision={}", + // mchIndex, muonTrack.trackType(), mchMom, mftIndex, muonTrack.collisionId(), muonTrack.has_collision()) << std::endl; + + auto const& mftTrack = mftTracks.rawIteratorAt(mftIndex); + auto mftMcParticle = mftTrack.mcParticle(); + int64_t mftMcTrackIndex = mftMcParticle.globalIndex(); + + if (muonMcTrackIndex == mftMcTrackIndex) { + registry.get(HIST("matching/MC/pairableType"))->Fill(0); + } else { + registry.get(HIST("matching/MC/pairableType"))->Fill(1); + } + + if (mftTrackCovs.count(mftTrack.globalIndex()) < 1) { + // std::cout << std::format("Covariance matrix for MFT track #{} not found", mftTrack.globalIndex()) << std::endl; + continue; + } + auto const& mftTrackCov = mftCovs.rawIteratorAt(mftTrackCovs[mftTrack.globalIndex()]); + + // propagate tracks at the last MFT plane + auto mftTrackProp = FwdToTrackPar(mftTrack, mftTrackCov); + auto mchTrackProp = FwdToTrackPar(muonTrack, muonTrack); + auto mchTrackPropAlt = FwdToTrackPar(muonTrack, muonTrack); + + auto z = o2::mft::constants::mft::LayerZCoordinate()[9]; + // std::cout << std::format("Extrapolating tracks to z={}", matchingPlaneZ) << std::endl; + mftTrackProp = PropagateToZMFT(mftTrackProp, z); + mchTrackProp = PropagateToZMCH(mchTrackProp, z); + auto mchTrackAtVertex = VarManager::PropagateMuon(muonTrack, collision, VarManager::kToVertex); + mchTrackPropAlt = PropagateToZMCH(mchTrackAtVertex, z); + + float dx = mchTrackProp.getX() - mftTrackProp.getX(); + float dy = mchTrackProp.getY() - mftTrackProp.getY(); + registryAlignment.get(HIST("alignment/trackDxAtMFTVsP"))->Fill(mchMom, dx); + registryAlignment.get(HIST("alignment/trackDyAtMFTVsP"))->Fill(mchMom, dy); + + float dxAlt = mchTrackPropAlt.getX() - mftTrackProp.getX(); + float dyAlt = mchTrackPropAlt.getY() - mftTrackProp.getY(); + registryAlignment.get(HIST("alignment/trackDxAtMFTVsP_alt"))->Fill(mchMom, dxAlt); + registryAlignment.get(HIST("alignment/trackDyAtMFTVsP_alt"))->Fill(mchMom, dyAlt); + + // std::cout << std::format("MCH track position: x={} y={}", mchTrackProp.getX(), mchTrackProp.getY()) << std::endl; + // std::cout << std::format("MCH track pos. alt: x={} y={}", mchTrackPropAlt.getX(), mchTrackPropAlt.getY()) << std::endl; + // std::cout << std::format("MFT track position: x={} y={}", mftTrackProp.getX(), mftTrackProp.getY()) << std::endl; + } + + // plot MFT-MCH tracks difference at matching plane for wrong pairs + // outer loop on MCH tracks associated to the current collision + for (auto const& mchTrackIndex : collisionInfo.mchTracks) { + auto matchablePair = GetMatchablePairForMCH(mchTrackIndex, matchablePairs); + if (!matchablePair.has_value()) + continue; + + auto const& mchTrack = muonTracks.rawIteratorAt(mchTrackIndex); + double mchMom = mchTrack.p(); + + // std::cout << std::format("TOTO2 MCH track #{} type={} p={:0.3} - MFT track #{} - collision #{}", + // mchTrackIndex, mchTrack.trackType(), mchMom, matchablePair.value().second, mchTrack.collisionId()) << std::endl; + + // extrapolate the MCH track to the last MFT plane + auto z = o2::mft::constants::mft::LayerZCoordinate()[9]; + auto mchTrackProp = PropagateToZMCH(FwdToTrackPar(mchTrack, mchTrack), z); + auto mchTrackAtVertex = VarManager::PropagateMuon(mchTrack, collision, VarManager::kToVertex); + auto mchTrackPropAlt = PropagateToZMCH(mchTrackAtVertex, z); + + // inner loop on MFT tracks associated to the current collision + for (auto const& mftTrackIndex : collisionInfo.mftTracks) { + // skip true matches + if (mftTrackIndex == matchablePair.value().second) + continue; + auto const& mftTrack = mftTracks.rawIteratorAt(mftTrackIndex); + + // get the corresponding covariance matrix + if (mftTrackCovs.count(mftTrackIndex) < 1) { + continue; + } + auto const& mftTrackCov = mftCovs.rawIteratorAt(mftTrackCovs[mftTrackIndex]); + + auto mftTrackProp = PropagateToZMFT(FwdToTrackPar(mftTrack, mftTrackCov), z); + + float dx = mchTrackProp.getX() - mftTrackProp.getX(); + float dy = mchTrackProp.getY() - mftTrackProp.getY(); + registryAlignment.get(HIST("alignment/trackDxAtMFTVsP_fake"))->Fill(mchMom, dx); + registryAlignment.get(HIST("alignment/trackDyAtMFTVsP_fake"))->Fill(mchMom, dy); + + float dxAlt = mchTrackPropAlt.getX() - mftTrackProp.getX(); + float dyAlt = mchTrackPropAlt.getY() - mftTrackProp.getY(); + registryAlignment.get(HIST("alignment/trackDxAtMFTVsP_alt_fake"))->Fill(mchMom, dxAlt); + registryAlignment.get(HIST("alignment/trackDyAtMFTVsP_alt_fake"))->Fill(mchMom, dyAlt); + } + } + + // Chi2-based matching analysis + FillMatchingPlotsMC(collision, muonTracks, mftTracks, collisionInfo.matchingCandidates, matchablePairs, fMatchingChi2ScoreMftMchLow, fChi2MatchingPlotter.get()); + for (auto& [label, func] : matchingChi2Functions) { + MatchingCandidates matchingCandidates; + RunChi2Matching(collisions, muonTracks, mftTracks, mftCovs, label, collisionInfo.matchingCandidates, matchingCandidates); + + auto* plotter = fMatchingPlotters.at(label).get(); + double matchingScoreCut = matchingScoreCuts.at(label); + + // std::cout << std::format("Calling FillMatchingPlotsMC() for label \"{}\" and score cut {}", label, matchingScoreCut) << std::endl; + FillMatchingPlotsMC(collision, muonTracks, mftTracks, matchingCandidates, matchablePairs, matchingScoreCut, plotter); + } + + // ML-based matching analysis + for (auto& [label, mlResponse] : matchingMlResponses) { + MatchingCandidates matchingCandidates; + RunMLMatching(collisions, muonTracks, mftTracks, mftCovs, label, collisionInfo.matchingCandidates, matchingCandidates); + + auto* plotter = fMatchingPlotters.at(label).get(); + double matchingScoreCut = matchingScoreCuts.at(label); + + FillMatchingPlotsMC(collision, muonTracks, mftTracks, matchingCandidates, matchablePairs, matchingScoreCut, plotter); + } + + // Muons tagging + for (auto [mchIndex, mftIndex] : matchablePairs) { + auto const& mchTrack = muonTracks.rawIteratorAt(mchIndex); + if (!mchTrack.has_collision()) + continue; + auto collision = collisions.rawIteratorAt(mchTrack.collisionId()); + + auto const& mftTrack = mftTracks.rawIteratorAt(mftIndex); + if (mftTrackCovs.count(mftTrack.globalIndex()) < 1) { + continue; + } + auto const& mftTrackCov = mftCovs.rawIteratorAt(mftTrackCovs[mftTrack.globalIndex()]); + + auto mchTrackAtVertex = VarManager::PropagateMuon(mchTrack, collision, VarManager::kToVertex); + + // extrapolate to the matching plane + auto z = o2::mft::constants::mft::LayerZCoordinate()[9]; + auto mchTrackProp = PropagateToZMCH(mchTrackAtVertex, z); + auto mftTrackProp = PropagateToZMFT(FwdToTrackPar(mftTrack, mftTrackCov), z); + + registry.get(HIST("matching/MC/pairedMCHTracksAtMFT"))->Fill(mchTrackProp.getX(), mchTrackProp.getY()); + registry.get(HIST("matching/MC/pairedMFTTracksAtMFT"))->Fill(mftTrackProp.getX(), mftTrackProp.getY()); + } + + std::vector selectedMuons; + GetSelectedMuons(collisionInfo, collisions, muonTracks, selectedMuons); + for (auto mchIndex : selectedMuons) { + auto const& mchTrack = muonTracks.rawIteratorAt(mchIndex); + if (!mchTrack.has_collision()) + continue; + auto collision = collisions.rawIteratorAt(mchTrack.collisionId()); + + auto mchTrackAtVertex = VarManager::PropagateMuon(mchTrack, collision, VarManager::kToVertex); + + // extrapolate to the matching plane + auto z = o2::mft::constants::mft::LayerZCoordinate()[9]; + auto mchTrackProp = PropagateToZMCH(mchTrackAtVertex, z); + + registry.get(HIST("matching/MC/selectedMCHTracksAtMFT"))->Fill(mchTrackProp.getX(), mchTrackProp.getY()); + + bool isPairedMCH = IsMatchableMCH(static_cast(mchIndex), matchablePairs); + if (isPairedMCH) { + registry.get(HIST("matching/MC/selectedMCHTracksAtMFTTrue"))->Fill(mchTrackProp.getX(), mchTrackProp.getY()); + } else { + registry.get(HIST("matching/MC/selectedMCHTracksAtMFTFake"))->Fill(mchTrackProp.getX(), mchTrackProp.getY()); + } + } + + MatchingCandidates selectedMatchingCandidates; + for (auto [mchIndex, globalTracksVector] : collisionInfo.matchingCandidates) { + if (std::find(selectedMuons.begin(), selectedMuons.end(), mchIndex) != selectedMuons.end()) { + selectedMatchingCandidates[mchIndex] = globalTracksVector; + } + } + FillMatchingPlotsMC(collision, muonTracks, mftTracks, selectedMatchingCandidates, matchablePairs, fMatchingChi2ScoreMftMchLow, fSelectedMuonsMatchingPlotter.get()); + + std::vector taggedMuons; + GetTaggedMuons(collisionInfo, muonTracks, selectedMuons, taggedMuons); + + MatchingCandidates taggedMatchingCandidates; + for (auto [mchIndex, globalTracksVector] : collisionInfo.matchingCandidates) { + if (std::find(taggedMuons.begin(), taggedMuons.end(), mchIndex) != taggedMuons.end()) { + taggedMatchingCandidates[mchIndex] = globalTracksVector; + } + } + FillMatchingPlotsMC(collision, muonTracks, mftTracks, taggedMatchingCandidates, matchablePairs, fMatchingChi2ScoreMftMchLow, fTaggedMuonsMatchingPlotter.get()); + } + + void processQAMC(MyEvents const& collisions, + aod::BCsWithTimestamps const& bcs, + MyMuonsMC const& muonTracks, + MyMFTsMC const& mftTracks, + MyMFTCovariances const& mftCovs, + aod::McParticles const& /*mcParticles*/) + { + auto bc = bcs.begin(); + initCCDB(bc); + + for (auto& muon : muonTracks) { + registry.get(HIST("nTracksPerType"))->Fill(static_cast(muon.trackType())); + } + + InitCollisions(collisions, bcs, muonTracks, mftTracks, fCollisionInfos); + + mftTrackCovs.clear(); + for (auto& mftTrackCov : mftCovs) { + mftTrackCovs[mftTrackCov.matchMFTTrackId()] = mftTrackCov.globalIndex(); + } + + for (auto const& [collisionIndex, collisionInfo] : fCollisionInfos) { + ProcessCollisionMC(collisionInfo, collisions, muonTracks, mftTracks, mftCovs); + } + } + + PROCESS_SWITCH(qaMatching, processQAMC, "process qa MC", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +}; From 45a13c2fa79d92336070f0d46868cf071c94cf6e Mon Sep 17 00:00:00 2001 From: Marvin Hemmer <53471402+mhemmer-cern@users.noreply.github.com> Date: Thu, 23 Oct 2025 14:37:07 +0200 Subject: [PATCH 866/986] [PWGJE,EMCAL] Add TM for secondary tracks from V0s (#13499) --- PWGJE/DataModel/EMCALClusters.h | 6 + PWGJE/TableProducer/emcalCorrectionTask.cxx | 437 ++++++++++++++++++-- 2 files changed, 404 insertions(+), 39 deletions(-) diff --git a/PWGJE/DataModel/EMCALClusters.h b/PWGJE/DataModel/EMCALClusters.h index 56edf634628..e28931982b5 100644 --- a/PWGJE/DataModel/EMCALClusters.h +++ b/PWGJE/DataModel/EMCALClusters.h @@ -170,5 +170,11 @@ DECLARE_SOA_TABLE(EMCALMatchedTracks, "AOD", "EMCMATCHTRACKS", //! o2::soa::Index<>, emcalclustercell::EMCALClusterId, emcalmatchedtrack::TrackId, emcalmatchedtrack::DeltaPhi, emcalmatchedtrack::DeltaEta); //! using EMCALMatchedTrack = EMCALMatchedTracks::iterator; + +// table for matched secondary tracks +DECLARE_SOA_TABLE(EMCMatchSecs, "AOD", "EMCMATCHSEC", //! + o2::soa::Index<>, emcalclustercell::EMCALClusterId, emcalmatchedtrack::TrackId, + emcalmatchedtrack::DeltaPhi, emcalmatchedtrack::DeltaEta); //! +using EMCMatchSec = EMCMatchSecs::iterator; } // namespace o2::aod #endif // PWGJE_DATAMODEL_EMCALCLUSTERS_H_ diff --git a/PWGJE/TableProducer/emcalCorrectionTask.cxx b/PWGJE/TableProducer/emcalCorrectionTask.cxx index 1935748a4a0..9a274427955 100644 --- a/PWGJE/TableProducer/emcalCorrectionTask.cxx +++ b/PWGJE/TableProducer/emcalCorrectionTask.cxx @@ -10,19 +10,17 @@ // or submit itself to any jurisdiction. /// /// EMCAL Correction Task -/// /// \file emcalCorrectionTask.cxx -/// /// \brief Task that provides EMCal clusters and applies necessary corrections -/// -/// \author Raymond Ehlers (raymond.ehlers@cern.ch) ORNL, Florian Jonas (florian.jonas@cern.ch) -/// +/// \author Raymond Ehlers (raymond.ehlers@cern.ch) ORNL, Florian Jonas (florian.jonas@cern.ch), Marvin Hemmer (marvin.hemmer@cern.ch) #include "PWGJE/Core/emcalCrossTalkEmulation.h" #include "PWGJE/Core/utilsTrackMatchingEMC.h" #include "PWGJE/DataModel/EMCALClusterDefinition.h" #include "PWGJE/DataModel/EMCALClusters.h" #include "PWGJE/DataModel/EMCALMatchedCollisions.h" +// +#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" // for EM V0 legs #include "Common/Core/RecoDecay.h" #include "Common/DataModel/EventSelection.h" @@ -54,7 +52,6 @@ #include #include -#include #include @@ -85,6 +82,7 @@ using CollEventSels = o2::soa::Join; using FilteredCells = o2::soa::Filtered; using McCells = o2::soa::Join; using FilteredMcCells = o2::soa::Filtered; +using EMV0Legs = aod::V0Legs; enum CellScaleMode { ModeNone = 0, @@ -101,6 +99,7 @@ struct EmcalCorrectionTask { Produces clustercells; // cells belonging to given cluster Produces clustercellsambiguous; Produces matchedTracks; + Produces matchedSecondaries; Produces emcalcollisionmatch; // Preslices @@ -109,6 +108,7 @@ struct EmcalCorrectionTask { Preslice collisionsPerBC = aod::collision::bcId; Preslice cellsPerFoundBC = aod::calo::bcId; Preslice mcCellsPerFoundBC = aod::calo::bcId; + PresliceUnsorted perCollisionEMV0Legs = aod::v0leg::collisionId; // Options for the clusterization // 1 corresponds to EMCAL cells based on the Run2 definition. @@ -160,6 +160,10 @@ struct EmcalCorrectionTask { std::vector mAnalysisClusters; std::vector mClusterLabels; + // Cluster Eta and Phi used for track matching later + std::vector mClusterPhi; + std::vector mClusterEta; + std::vector mClusterDefinitions; // QA o2::framework::HistogramRegistry mHistManager{"EMCALCorrectionTaskQAHistograms"}; @@ -185,6 +189,7 @@ struct EmcalCorrectionTask { int runNumber{0}; static constexpr float TrackNotOnEMCal = -900.f; + static constexpr int kMaxMatchesPerCluster = 20; // Maximum number of tracks to match per cluster void init(InitContext const&) { @@ -255,6 +260,10 @@ struct EmcalCorrectionTask { LOG(error) << "No cluster definitions specified!"; } + // 500 clusters per event is a good upper limit + mClusterPhi.reserve(500 * mClusterizers.size()); + mClusterEta.reserve(500 * mClusterizers.size()); + mNonlinearityHandler = o2::emcal::NonlinearityFactory::getInstance().getNonlinearity(static_cast(nonlinearityFunction)); LOG(info) << "Using nonlinearity parameterisation: " << nonlinearityFunction.value; LOG(info) << "Apply shaper saturation correction: " << (hasShaperCorrection.value ? "yes" : "no"); @@ -286,6 +295,9 @@ struct EmcalCorrectionTask { sigmaShortAxis{100, 0., 1.0, "#sigma^{2}_{short}"}, nCellAxis{60, -0.5, 59.5, "#it{n}_{cells}"}, energyDenseAxis = {7000, 0.f, 70.f, "#it{E}_{cell} (GeV)"}; + o2::framework::AxisSpec axisDeltaEta{400, -0.2, 0.2, "#Delta#eta"}; + o2::framework::AxisSpec axisDeltaPhi{400, -0.2, 0.2, "#Delta#varphi (rad)"}; + o2::framework::AxisSpec axisNCluster{1000, 0, 1000, "#it{N}_{clus.}"}; mHistManager.add("hCellE", "hCellE", O2HistType::kTH1D, {energyAxis}); mHistManager.add("hCellTowerID", "hCellTowerID", O2HistType::kTH1D, {{20000, 0, 20000}}); mHistManager.add("hCellEtaPhi", "hCellEtaPhi", O2HistType::kTH2F, {etaAxis, phiAxis}); @@ -295,12 +307,13 @@ struct EmcalCorrectionTask { // NOTE: Reversed column and row because it's more natural for presentation. mHistManager.add("hCellRowCol", "hCellRowCol;Column;Row", O2HistType::kTH2D, {{96, -0.5, 95.5}, {208, -0.5, 207.5}}); mHistManager.add("hClusterE", "hClusterE", O2HistType::kTH1D, {energyAxis}); + mHistManager.add("hNCluster", "hNCluster", O2HistType::kTH1D, {axisNCluster}); mHistManager.add("hClusterNLM", "hClusterNLM", O2HistType::kTH1D, {nlmAxis}); mHistManager.add("hClusterEtaPhi", "hClusterEtaPhi", O2HistType::kTH2F, {etaAxis, phiAxis}); mHistManager.add("hClusterTime", "hClusterTime", O2HistType::kTH1D, {timeAxis}); - mHistManager.add("hGlobalTrackEtaPhi", "hGlobalTrackEtaPhi", O2HistType::kTH2F, {etaAxis, phiAxis}); - mHistManager.add("hGlobalTrackMult", "hGlobalTrackMult", O2HistType::kTH1D, {{200, -0.5, 199.5, "N_{trk}"}}); mHistManager.add("hCollisionType", "hCollisionType;;#it{count}", O2HistType::kTH1D, {{3, -0.5, 2.5}}); + mHistManager.add("hMatchedPrimaryTracks", "hMatchedPrimaryTracks", O2HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}); + mHistManager.add("hMatchedSecondaries", "hMatchedSecondaries", O2HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}); auto hCollisionType = mHistManager.get(HIST("hCollisionType")); hCollisionType->GetXaxis()->SetBinLabel(1, "no collision"); hCollisionType->GetXaxis()->SetBinLabel(2, "normal collision"); @@ -450,8 +463,6 @@ struct EmcalCorrectionTask { mHistManager.fill(HIST("hCollisionType"), 1); math_utils::Point3D vertexPos = {col.posX(), col.posY(), col.posZ()}; - std::vector> clusterToTrackIndexMap; - std::vector> trackToClusterIndexMap; MatchResult indexMapPair; std::vector trackGlobalIndex; doTrackMatching(col, tracks, indexMapPair, trackGlobalIndex); @@ -476,6 +487,8 @@ struct EmcalCorrectionTask { fillAmbigousClusterTable(bc, iClusterizer, cellIndicesBC, hasCollision); } + mClusterPhi.clear(); + mClusterEta.clear(); LOG(debug) << "Cluster loop done for clusterizer " << iClusterizer; } // end of clusterizer loop LOG(debug) << "Done with process BC."; @@ -498,10 +511,150 @@ struct EmcalCorrectionTask { } PROCESS_SWITCH(EmcalCorrectionTask, processFull, "run full analysis", true); - void processMCFull(BcEvSels const& bcs, CollEventSels const& collisions, MyGlobTracks const& tracks, FilteredMcCells const& cells, aod::StoredMcParticles_001 const&) + void processWithSecondaries(BcEvSels const& bcs, CollEventSels const& collisions, MyGlobTracks const& tracks, FilteredCells const& cells, EMV0Legs const& v0legs) { LOG(debug) << "Starting process full."; + int previousCollisionId = 0; // Collision ID of the last unique BC. Needed to skip unordered collisions to ensure ordered collisionIds in the cluster table + int nBCsProcessed = 0; + int nCellsProcessed = 0; + std::unordered_map numberCollsInBC; // Number of collisions mapped to the global BC index of all BCs + std::unordered_map numberCellsInBC; // Number of cells mapped to the global BC index of all BCs to check whether EMCal was readout + for (const auto& bc : bcs) { + LOG(debug) << "Next BC"; + + // get run number + runNumber = bc.runNumber(); + + if (applyTempCalib && !mIsTempCalibInitialized) { // needs to be called once + mTempCalibExtractor->InitializeFromCCDB(pathTempCalibCCDB, static_cast(runNumber)); + mIsTempCalibInitialized = true; + } + + // Convert aod::Calo to o2::emcal::Cell which can be used with the clusterizer. + // In particular, we need to filter only EMCAL cells. + + // Get the collisions matched to the BC using foundBCId of the collision + auto collisionsInFoundBC = collisions.sliceBy(collisionsPerFoundBC, bc.globalIndex()); + auto cellsInBC = cells.sliceBy(cellsPerFoundBC, bc.globalIndex()); + + numberCollsInBC.insert(std::pair(bc.globalIndex(), collisionsInFoundBC.size())); + numberCellsInBC.insert(std::pair(bc.globalIndex(), cellsInBC.size())); + + if (!cellsInBC.size()) { + LOG(debug) << "No cells found for BC"; + countBC(collisionsInFoundBC.size(), false); + continue; + } + // Counters for BCs with matched collisions + countBC(collisionsInFoundBC.size(), true); + std::vector cellsBC; + std::vector cellIndicesBC; + for (const auto& cell : cellsInBC) { + auto amplitude = cell.amplitude(); + if (static_cast(hasShaperCorrection) && emcal::intToChannelType(cell.cellType()) == emcal::ChannelType_t::LOW_GAIN) { // Apply shaper correction to LG cells + amplitude = o2::emcal::NonlinearityHandler::evaluateShaperCorrectionCellEnergy(amplitude); + } + if (applyCellAbsScale) { + amplitude *= getAbsCellScale(cell.cellNumber()); + } + if (applyGainCalibShift) { + amplitude *= mArrGainCalibDiff[cell.cellNumber()]; + } + if (applyTempCalib) { + float tempCalibFactor = mTempCalibExtractor->getGainCalibFactor(static_cast(cell.cellNumber())); + amplitude /= tempCalibFactor; + mHistManager.fill(HIST("hTempCalibCorrection"), tempCalibFactor); + } + cellsBC.emplace_back(cell.cellNumber(), + amplitude, + cell.time() + getCellTimeShift(cell.cellNumber(), amplitude, o2::emcal::intToChannelType(cell.cellType()), runNumber), + o2::emcal::intToChannelType(cell.cellType())); + cellIndicesBC.emplace_back(cell.globalIndex()); + } + LOG(detail) << "Number of cells for BC (CF): " << cellsBC.size(); + nCellsProcessed += cellsBC.size(); + + fillQAHistogram(cellsBC); + + LOG(debug) << "Converted cells. Contains: " << cellsBC.size() << ". Originally " << cellsInBC.size() << ". About to run clusterizer."; + // this is a test + // Run the clusterizers + LOG(debug) << "Running clusterizers"; + for (size_t iClusterizer = 0; iClusterizer < mClusterizers.size(); iClusterizer++) { + cellsToCluster(iClusterizer, cellsBC); + + if (collisionsInFoundBC.size() == 1) { + // dummy loop to get the first collision + for (const auto& col : collisionsInFoundBC) { + if (previousCollisionId > col.globalIndex()) { + mHistManager.fill(HIST("hBCMatchErrors"), 1); + continue; + } + previousCollisionId = col.globalIndex(); + if (col.foundBCId() == bc.globalIndex()) { + mHistManager.fill(HIST("hBCMatchErrors"), 0); // CollisionID ordered and foundBC matches -> Fill as healthy + mHistManager.fill(HIST("hCollisionTimeReso"), col.collisionTimeRes()); + mHistManager.fill(HIST("hCollPerBC"), 1); + mHistManager.fill(HIST("hCollisionType"), 1); + math_utils::Point3D vertexPos = {col.posX(), col.posY(), col.posZ()}; + + MatchResult indexMapPair; + std::vector trackGlobalIndex; + doTrackMatching(col, tracks, indexMapPair, trackGlobalIndex); + + MatchResult indexMapPairSecondary; + std::vector secondaryGlobalIndex; + doSecondaryTrackMatching(col, v0legs, indexMapPairSecondary, secondaryGlobalIndex, tracks); + + // Store the clusters in the table where a matching collision could + // be identified. + fillClusterTable(col, vertexPos, iClusterizer, cellIndicesBC, &indexMapPair, &trackGlobalIndex, &indexMapPairSecondary, &secondaryGlobalIndex); + } else { + mHistManager.fill(HIST("hBCMatchErrors"), 2); + } + } + } else { // ambiguous + // LOG(warning) << "No vertex found for event. Assuming (0,0,0)."; + bool hasCollision = false; + mHistManager.fill(HIST("hCollPerBC"), collisionsInFoundBC.size()); + if (collisionsInFoundBC.size() == 0) { + mHistManager.fill(HIST("hCollisionType"), 0); + } else { + hasCollision = true; + mHistManager.fill(HIST("hCollisionType"), 2); + } + fillAmbigousClusterTable(bc, iClusterizer, cellIndicesBC, hasCollision); + } + + mClusterPhi.clear(); + mClusterEta.clear(); + LOG(debug) << "Cluster loop done for clusterizer " << iClusterizer; + } // end of clusterizer loop + LOG(debug) << "Done with process BC."; + nBCsProcessed++; + } // end of bc loop + + // Loop through all collisions and fill emcalcollisionmatch with a boolean stating, whether the collision was ambiguous (not the only collision in its BC) + for (const auto& collision : collisions) { + auto globalbcid = collision.foundBC_as().globalIndex(); + auto foundColls = numberCollsInBC.find(globalbcid); + auto foundCells = numberCellsInBC.find(globalbcid); + if (foundColls != numberCollsInBC.end() && foundCells != numberCellsInBC.end()) { + emcalcollisionmatch(collision.globalIndex(), foundColls->second != 1, foundCells->second > 0); + } else { + LOG(warning) << "BC not found in map of number of collisions."; + } + } // end of collision loop + + LOG(detail) << "Processed " << nBCsProcessed << " BCs with " << nCellsProcessed << " cells"; + } + PROCESS_SWITCH(EmcalCorrectionTask, processWithSecondaries, "run full analysis with secondary track matching", false); + + void processMCFull(BcEvSels const& bcs, CollEventSels const& collisions, MyGlobTracks const& tracks, FilteredMcCells const& cells, aod::StoredMcParticles_001 const&) + { + LOG(debug) << "Starting processMCFull."; + int previousCollisionId = 0; // Collision ID of the last unique BC. Needed to skip unordered collisions to ensure ordered collisionIds in the cluster table int nBCsProcessed = 0; int nCellsProcessed = 0; @@ -619,8 +772,6 @@ struct EmcalCorrectionTask { mHistManager.fill(HIST("hCollisionType"), 1); math_utils::Point3D vertexPos = {col.posX(), col.posY(), col.posZ()}; - std::vector> clusterToTrackIndexMap; - std::vector> trackToClusterIndexMap; MatchResult indexMapPair; std::vector trackGlobalIndex; doTrackMatching(col, tracks, indexMapPair, trackGlobalIndex); @@ -644,6 +795,8 @@ struct EmcalCorrectionTask { } fillAmbigousClusterTable(bc, iClusterizer, cellIndicesBC, hasCollision); } + mClusterPhi.clear(); + mClusterEta.clear(); LOG(debug) << "Cluster loop done for clusterizer " << iClusterizer; } // end of clusterizer loop LOG(debug) << "Done with process BC."; @@ -665,6 +818,179 @@ struct EmcalCorrectionTask { LOG(detail) << "Processed " << nBCsProcessed << " BCs with " << nCellsProcessed << " cells"; } PROCESS_SWITCH(EmcalCorrectionTask, processMCFull, "run full analysis with MC info", false); + + void processMCWithSecondaries(BcEvSels const& bcs, CollEventSels const& collisions, MyGlobTracks const& tracks, FilteredMcCells const& cells, aod::StoredMcParticles_001 const&, EMV0Legs const& v0legs) + { + LOG(debug) << "Starting processMCWithSecondaries."; + + int previousCollisionId = 0; // Collision ID of the last unique BC. Needed to skip unordered collisions to ensure ordered collisionIds in the cluster table + int nBCsProcessed = 0; + int nCellsProcessed = 0; + std::unordered_map numberCollsInBC; // Number of collisions mapped to the global BC index of all BCs + std::unordered_map numberCellsInBC; // Number of cells mapped to the global BC index of all BCs to check whether EMCal was readout + for (const auto& bc : bcs) { + LOG(debug) << "Next BC"; + // Convert aod::Calo to o2::emcal::Cell which can be used with the clusterizer. + // In particular, we need to filter only EMCAL cells. + + // get run number + runNumber = bc.runNumber(); + + // Get the collisions matched to the BC using foundBCId of the collision + auto collisionsInFoundBC = collisions.sliceBy(collisionsPerFoundBC, bc.globalIndex()); + auto cellsInBC = cells.sliceBy(mcCellsPerFoundBC, bc.globalIndex()); + + numberCollsInBC.insert(std::pair(bc.globalIndex(), collisionsInFoundBC.size())); + numberCellsInBC.insert(std::pair(bc.globalIndex(), cellsInBC.size())); + + if (!cellsInBC.size()) { + LOG(debug) << "No cells found for BC"; + countBC(collisionsInFoundBC.size(), false); + continue; + } + // Counters for BCs with matched collisions + countBC(collisionsInFoundBC.size(), true); + std::vector cellsBC; + std::vector cellIndicesBC; + std::vector cellLabels; + for (const auto& cell : cellsInBC) { + mHistManager.fill(HIST("hContributors"), cell.mcParticle_as().size()); + auto cellParticles = cell.mcParticle_as(); + for (const auto& cellparticle : cellParticles) { + const auto& ids = cell.mcParticleIds(); + const auto& amps = cell.amplitudeA(); + + if (ids.empty() || amps.empty()) { + LOGF(warning, "Skipping cell with empty MC info: absId=%d", cell.cellNumber()); + continue; + } + mHistManager.fill(HIST("hMCParticleEnergy"), cellparticle.e()); + } + auto amplitude = cell.amplitude(); + if (static_cast(hasShaperCorrection) && emcal::intToChannelType(cell.cellType()) == emcal::ChannelType_t::LOW_GAIN) { // Apply shaper correction to LG cells + amplitude = o2::emcal::NonlinearityHandler::evaluateShaperCorrectionCellEnergy(amplitude); + } + if (mcCellEnergyShift != 1.) { + amplitude *= mcCellEnergyShift; // Fine tune the MC cell energy + } + if (mcCellEnergyResolutionBroadening != 0.) { + amplitude *= (1. + normalgaus(rdgen) * mcCellEnergyResolutionBroadening); // Fine tune the MC cell energy resolution + } + cellsBC.emplace_back(cell.cellNumber(), + amplitude, + cell.time() + getCellTimeShift(cell.cellNumber(), amplitude, o2::emcal::intToChannelType(cell.cellType()), runNumber), + o2::emcal::intToChannelType(cell.cellType())); + cellIndicesBC.emplace_back(cell.globalIndex()); + cellLabels.emplace_back(std::vector{cell.mcParticleIds().begin(), cell.mcParticleIds().end()}, std::vector{cell.amplitudeA().begin(), cell.amplitudeA().end()}); + } + if (isMC.value && emcCrossTalkConf.enableCrossTalk.value) { + if (emcCrossTalkConf.createHistograms.value) { + for (const auto& cell : cellsBC) { + mHistManager.fill(HIST("hCellEnergyDistBefore"), cell.getAmplitude()); + } + } + emcCrossTalk.setCells(cellsBC, cellLabels); + bool isOkCrossTalk = emcCrossTalk.run(); + if (!isOkCrossTalk) { + LOG(info) << "Cross talk emulation failed!"; + } else { + // When we get new cells we also need to add additional entries into cellIndicesBC. + // Adding -1 and later when filling the clusterID<->cellID table skip all cases where this is -1 + if (cellIndicesBC.size() < cellsBC.size()) { + cellIndicesBC.reserve(cellsBC.size()); + size_t nMissing = cellsBC.size() - cellIndicesBC.size(); + cellIndicesBC.insert(cellIndicesBC.end(), nMissing, -1); + } + if (emcCrossTalkConf.createHistograms.value) { + for (const auto& cell : cellsBC) { + mHistManager.fill(HIST("hCellEnergyDistAfter"), cell.getAmplitude()); + } + } + } // cross talk emulation was okay + } // if (isMC.value && emcCrossTalkConf.enableCrossTalk.value) + // shaper correction has to come AFTER cross talk + for (auto& cell : cellsBC) { // o2-linter: disable=const-ref-in-for-loop (we are changing a value here) + if (cell.getLowGain()) { + cell.setAmplitude(o2::emcal::NonlinearityHandler::evaluateShaperCorrectionCellEnergy(cell.getAmplitude())); + } + } + LOG(detail) << "Number of cells for BC (CF): " << cellsBC.size(); + nCellsProcessed += cellsBC.size(); + + fillQAHistogram(cellsBC); + + LOG(debug) << "Converted cells. Contains: " << cellsBC.size() << ". Originally " << cellsInBC.size() << ". About to run clusterizer."; + // this is a test + // Run the clusterizers + LOG(debug) << "Running clusterizers"; + for (size_t iClusterizer = 0; iClusterizer < mClusterizers.size(); iClusterizer++) { + cellsToCluster(iClusterizer, cellsBC, cellLabels); + + if (collisionsInFoundBC.size() == 1) { + // dummy loop to get the first collision + for (const auto& col : collisionsInFoundBC) { + if (previousCollisionId > col.globalIndex()) { + mHistManager.fill(HIST("hBCMatchErrors"), 1); + continue; + } + previousCollisionId = col.globalIndex(); + if (col.foundBCId() == bc.globalIndex()) { + mHistManager.fill(HIST("hBCMatchErrors"), 0); // CollisionID ordered and foundBC matches -> Fill as healthy + mHistManager.fill(HIST("hCollPerBC"), 1); + mHistManager.fill(HIST("hCollisionType"), 1); + math_utils::Point3D vertexPos = {col.posX(), col.posY(), col.posZ()}; + + MatchResult indexMapPair; + std::vector trackGlobalIndex; + doTrackMatching(col, tracks, indexMapPair, trackGlobalIndex); + + MatchResult indexMapPairSecondary; + std::vector secondaryGlobalIndex; + doSecondaryTrackMatching(col, v0legs, indexMapPairSecondary, secondaryGlobalIndex, tracks); + + // Store the clusters in the table where a matching collision could + // be identified. + fillClusterTable(col, vertexPos, iClusterizer, cellIndicesBC, &indexMapPair, &trackGlobalIndex, &indexMapPairSecondary, &secondaryGlobalIndex); + } else { + mHistManager.fill(HIST("hBCMatchErrors"), 2); + } + } + } else { // ambiguous + // LOG(warning) << "No vertex found for event. Assuming (0,0,0)."; + bool hasCollision = false; + mHistManager.fill(HIST("hCollPerBC"), collisionsInFoundBC.size()); + if (collisionsInFoundBC.size() == 0) { + mHistManager.fill(HIST("hCollisionType"), 0); + } else { + hasCollision = true; + mHistManager.fill(HIST("hCollisionType"), 2); + } + fillAmbigousClusterTable(bc, iClusterizer, cellIndicesBC, hasCollision); + } + mClusterPhi.clear(); + mClusterEta.clear(); + LOG(debug) << "Cluster loop done for clusterizer " << iClusterizer; + } // end of clusterizer loop + LOG(debug) << "Done with process BC."; + nBCsProcessed++; + } // end of bc loop + + // Loop through all collisions and fill emcalcollisionmatch with a boolean stating, whether the collision was ambiguous (not the only collision in its BC) + for (const auto& collision : collisions) { + auto globalbcid = collision.foundBC_as().globalIndex(); + auto foundColls = numberCollsInBC.find(globalbcid); + auto foundCells = numberCellsInBC.find(globalbcid); + if (foundColls != numberCollsInBC.end() && foundCells != numberCellsInBC.end()) { + emcalcollisionmatch(collision.globalIndex(), foundColls->second != 1, foundCells->second > 0); + } else { + LOG(warning) << "BC not found in map of number of collisions."; + } + } // end of collision loop + + LOG(detail) << "Processed " << nBCsProcessed << " BCs with " << nCellsProcessed << " cells"; + } + PROCESS_SWITCH(EmcalCorrectionTask, processMCWithSecondaries, "run full analysis with MC info", false); + void processStandalone(aod::BCs const& bcs, aod::Collisions const& collisions, FilteredCells const& cells) { LOG(debug) << "Starting process standalone."; @@ -762,6 +1088,8 @@ struct EmcalCorrectionTask { fillAmbigousClusterTable(bc, iClusterizer, cellIndicesBC, hasCollision); } + mClusterPhi.clear(); + mClusterEta.clear(); LOG(debug) << "Cluster loop done for clusterizer " << iClusterizer; } // end of clusterizer loop LOG(detail) << "Processed " << nBCsProcessed << " BCs with " << nCellsProcessed << " cells"; @@ -800,14 +1128,17 @@ struct EmcalCorrectionTask { auto analysisCluster = mClusterFactories.buildCluster(icl, &clusterLabel); mAnalysisClusters.emplace_back(analysisCluster); mClusterLabels.push_back(clusterLabel); - LOG(debug) << "Cluster " << icl << ": E: " << analysisCluster.E() - << ", NCells " << analysisCluster.getNCells(); + auto pos = analysisCluster.getGlobalPosition(); + mClusterPhi.emplace_back(RecoDecay::constrainAngle(pos.Phi())); + mClusterEta.emplace_back(pos.Eta()); + LOG(debug) << "Cluster " << icl << ": E: " << analysisCluster.E() << ", NCells " << analysisCluster.getNCells(); } + mHistManager.fill(HIST("hNCluster"), mAnalysisClusters.size()); LOG(debug) << "Converted to analysis clusters."; } template - void fillClusterTable(Collision const& col, math_utils::Point3D const& vertexPos, size_t iClusterizer, const gsl::span cellIndicesBC, MatchResult* indexMapPair = nullptr, const std::vector* trackGlobalIndex = nullptr) + void fillClusterTable(Collision const& col, math_utils::Point3D const& vertexPos, size_t iClusterizer, const gsl::span cellIndicesBC, MatchResult* indexMapPair = nullptr, const std::vector* trackGlobalIndex = nullptr, MatchResult* indexMapPairSecondaries = nullptr, const std::vector* secondariesGlobalIndex = nullptr) { // average number of cells per cluster, only used the reseve a reasonable amount for the clustercells table const size_t nAvgNcells = 3; @@ -848,7 +1179,7 @@ struct EmcalCorrectionTask { << " to table."; mHistManager.fill(HIST("hClusterType"), 1); clusters(col, cluster.getID(), nonlinCorrEnergy, cluster.getCoreEnergy(), energy, - pos.Eta(), TVector2::Phi_0_2pi(pos.Phi()), cluster.getM02(), + pos.Eta(), RecoDecay::constrainAngle(pos.Phi()), cluster.getM02(), cluster.getM20(), cluster.getNCells(), cluster.getClusterTime(), cluster.getIsExotic(), cluster.getDistanceToBadChannel(), cluster.getNExMax(), @@ -868,7 +1199,7 @@ struct EmcalCorrectionTask { mHistManager.fill(HIST("hClusterE"), energy); mHistManager.fill(HIST("hClusterNLM"), cluster.getNExMax()); mHistManager.fill(HIST("hClusterTime"), cluster.getClusterTime()); - mHistManager.fill(HIST("hClusterEtaPhi"), pos.Eta(), TVector2::Phi_0_2pi(pos.Phi())); + mHistManager.fill(HIST("hClusterEtaPhi"), pos.Eta(), RecoDecay::constrainAngle(pos.Phi())); if (fillQA.value) { mHistManager.fill(HIST("hClusterNCellE"), cluster.E(), cluster.getNCells()); mHistManager.fill(HIST("hClusterFCrossE"), cluster.E(), cluster.getFCross()); @@ -881,6 +1212,18 @@ struct EmcalCorrectionTask { if (indexMapPair->matchIndexTrack[iCluster][iTrack] >= 0) { LOG(debug) << "Found track " << (*trackGlobalIndex)[indexMapPair->matchIndexTrack[iCluster][iTrack]] << " in cluster " << cluster.getID(); matchedTracks(clusters.lastIndex(), (*trackGlobalIndex)[indexMapPair->matchIndexTrack[iCluster][iTrack]], indexMapPair->matchDeltaPhi[iCluster][iTrack], indexMapPair->matchDeltaEta[iCluster][iTrack]); + mHistManager.fill(HIST("hMatchedPrimaryTracks"), indexMapPair->matchDeltaEta[iCluster][iTrack], indexMapPair->matchDeltaPhi[iCluster][iTrack]); + } + } + } + } + if (indexMapPairSecondaries && secondariesGlobalIndex) { + if (iCluster < indexMapPairSecondaries->matchIndexTrack.size() && indexMapPairSecondaries->matchIndexTrack.size() > 0) { + for (unsigned int iTrack = 0; iTrack < indexMapPairSecondaries->matchIndexTrack[iCluster].size(); iTrack++) { + if (indexMapPairSecondaries->matchIndexTrack[iCluster][iTrack] >= 0) { + LOG(debug) << "Found secondary track " << (*secondariesGlobalIndex)[indexMapPairSecondaries->matchIndexTrack[iCluster][iTrack]] << " in cluster " << cluster.getID(); + matchedSecondaries(clusters.lastIndex(), (*secondariesGlobalIndex)[indexMapPairSecondaries->matchIndexTrack[iCluster][iTrack]], indexMapPairSecondaries->matchDeltaPhi[iCluster][iTrack], indexMapPairSecondaries->matchDeltaEta[iCluster][iTrack]); + mHistManager.fill(HIST("hMatchedSecondaries"), indexMapPairSecondaries->matchDeltaEta[iCluster][iTrack], indexMapPairSecondaries->matchDeltaPhi[iCluster][iTrack]); } } } @@ -927,7 +1270,7 @@ struct EmcalCorrectionTask { } clustersAmbiguous( bc, cluster.getID(), nonlinCorrEnergy, cluster.getCoreEnergy(), energy, - pos.Eta(), TVector2::Phi_0_2pi(pos.Phi()), cluster.getM02(), + pos.Eta(), RecoDecay::constrainAngle(pos.Phi()), cluster.getM02(), cluster.getM20(), cluster.getNCells(), cluster.getClusterTime(), cluster.getIsExotic(), cluster.getDistanceToBadChannel(), cluster.getNExMax(), static_cast(mClusterDefinitions.at(iClusterizer))); @@ -956,28 +1299,48 @@ struct EmcalCorrectionTask { trackGlobalIndex.reserve(nTracksInCol); fillTrackInfo(groupedTracks, trackPhi, trackEta, trackGlobalIndex); - int nClusterInCol = mAnalysisClusters.size(); - std::vector clusterPhi; - std::vector clusterEta; - clusterPhi.reserve(nClusterInCol); - clusterEta.reserve(nClusterInCol); + indexMapPair = matchTracksToCluster(mClusterPhi, mClusterEta, trackPhi, trackEta, maxMatchingDistance, kMaxMatchesPerCluster); + } - // TODO one loop that could in principle be combined with the other - // loop to improve performance - for (const auto& cluster : mAnalysisClusters) { - // Determine the cluster eta, phi, correcting for the vertex - // position. - auto pos = cluster.getGlobalPosition(); - clusterPhi.emplace_back(TVector2::Phi_0_2pi(pos.Phi())); - clusterEta.emplace_back(pos.Eta()); + template + void doSecondaryTrackMatching(Collision const& col, EMV0Legs const& v0legs, MatchResult& indexMapPair, std::vector& trackGlobalIndex, MyGlobTracks const& tracks) + { + auto groupedV0Legs = v0legs.sliceBy(perCollisionEMV0Legs, col.globalIndex()); + int nLegsInCol = groupedV0Legs.size(); + std::vector trackPhi; + std::vector trackEta; + // reserve memory to reduce on the fly memory allocation + trackPhi.reserve(nLegsInCol); + trackEta.reserve(nLegsInCol); + trackGlobalIndex.reserve(nLegsInCol); + + float trackEtaEmcal = 0.f; + float trackPhiEmcal = 0.f; + for (const auto& leg : groupedV0Legs) { + if (leg.trackId() < 0 || leg.trackId() > tracks.size()) { + continue; + } + auto track = tracks.iteratorAt(leg.trackId()); + trackEtaEmcal = track.trackEtaEmcal(); + trackPhiEmcal = track.trackPhiEmcal(); + // Tracks that do not point to the EMCal/DCal/PHOS get default values of -999 + // This way we can cut out tracks that do not point to the EMCal+DCal + if (trackEtaEmcal < TrackNotOnEMCal || trackPhiEmcal < TrackNotOnEMCal) { + continue; + } + if (trackMinPt > 0 && track.pt() < trackMinPt) { + continue; + } + trackPhi.emplace_back(RecoDecay::constrainAngle(trackPhiEmcal)); + trackEta.emplace_back(trackEtaEmcal); + trackGlobalIndex.emplace_back(track.globalIndex()); } - indexMapPair = matchTracksToCluster(clusterPhi, clusterEta, trackPhi, trackEta, maxMatchingDistance, 20); + indexMapPair = matchTracksToCluster(mClusterPhi, mClusterEta, trackPhi, trackEta, maxMatchingDistance, kMaxMatchesPerCluster); } template void fillTrackInfo(Tracks const& tracks, std::vector& trackPhi, std::vector& trackEta, std::vector& trackGlobalIndex) { - int nTrack = 0; for (const auto& track : tracks) { if (!track.isGlobalTrack()) { // only global tracks continue; @@ -990,14 +1353,10 @@ struct EmcalCorrectionTask { if (trackMinPt > 0 && track.pt() < trackMinPt) { continue; } - nTrack++; trackPhi.emplace_back(RecoDecay::constrainAngle(track.trackPhiEmcal())); trackEta.emplace_back(track.trackEtaEmcal()); - mHistManager.fill(HIST("hGlobalTrackEtaPhi"), track.trackEtaEmcal(), - RecoDecay::constrainAngle(track.trackPhiEmcal())); trackGlobalIndex.emplace_back(track.globalIndex()); } - mHistManager.fill(HIST("hGlobalTrackMult"), nTrack); } void countBC(int numberOfCollisions, bool hasEMCCells) @@ -1034,7 +1393,7 @@ struct EmcalCorrectionTask { mHistManager.fill(HIST("hHGCellTimeEnergy"), cell.getTimeStamp(), cell.getEnergy()); mHistManager.fill(HIST("hCellTowerID"), cell.getTower()); auto res = mClusterizers.at(0)->getGeometry()->EtaPhiFromIndex(cell.getTower()); - mHistManager.fill(HIST("hCellEtaPhi"), std::get<0>(res), TVector2::Phi_0_2pi(std::get<1>(res))); + mHistManager.fill(HIST("hCellEtaPhi"), std::get<0>(res), RecoDecay::constrainAngle(std::get<1>(res))); res = mClusterizers.at(0)->getGeometry()->GlobalRowColFromIndex(cell.getTower()); // NOTE: Reversed column and row because it's more natural for presentation. mHistManager.fill(HIST("hCellRowCol"), std::get<1>(res), std::get<0>(res)); From 75fb172e36dff99e0b5371846f0e236a6b60159e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?BiaoZhang=20=28=E5=BC=A0=E5=BD=AA=29?= <52267892+zhangbiao-phy@users.noreply.github.com> Date: Thu, 23 Oct 2025 15:46:49 +0200 Subject: [PATCH 867/986] [PWGHF] fix a small bug for the BDT model initialisation of HF filter in the trackIndexSkimCreator.cxx (#13511) --- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index f556be3170e..4f19865e40e 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -1464,12 +1464,13 @@ struct HfTrackIndexSkimCreator { if (config.applyMlForHfFilters) { const std::vector onnxFileNames2Prongs{config.onnxFileNames->get(0u, 0u)}; - const std::array, kN3ProngDecays> onnxFileNames3Prongs{std::vector{config.onnxFileNames->get(1u, 0u)}, std::vector{config.onnxFileNames->get(2u, 0u)}, std::vector{config.onnxFileNames->get(3u, 0u)}, std::vector{config.onnxFileNames->get(4u, 0u)}}; + // Exclude Cd from the 3-prong list, as it is not included in the pp trigger program + const std::array, kN3ProngDecays - 1> onnxFileNames3Prongs{std::vector{config.onnxFileNames->get(1u, 0u)}, std::vector{config.onnxFileNames->get(2u, 0u)}, std::vector{config.onnxFileNames->get(3u, 0u)}, std::vector{config.onnxFileNames->get(4u, 0u)}}; const std::vector mlModelPathCcdb2Prongs{config.mlModelPathCCDB.value + "D0"}; - const std::array, kN3ProngDecays> mlModelPathCcdb3Prongs{std::vector{config.mlModelPathCCDB.value + "Dplus"}, std::vector{config.mlModelPathCCDB.value + "Lc"}, std::vector{config.mlModelPathCCDB.value + "Ds"}, std::vector{config.mlModelPathCCDB.value + "Xic"}}; + const std::array, kN3ProngDecays - 1> mlModelPathCcdb3Prongs{std::vector{config.mlModelPathCCDB.value + "Dplus"}, std::vector{config.mlModelPathCCDB.value + "Lc"}, std::vector{config.mlModelPathCCDB.value + "Ds"}, std::vector{config.mlModelPathCCDB.value + "Xic"}}; const std::vector ptBinsMl{0., 1.e10}; const std::vector cutDirMl{o2::cuts_ml::CutDirection::CutGreater, o2::cuts_ml::CutDirection::CutSmaller, o2::cuts_ml::CutDirection::CutSmaller}; - const std::array, kN3ProngDecays> thresholdMlScore3Prongs{config.thresholdMlScoreDplusToPiKPi, config.thresholdMlScoreLcToPiKP, config.thresholdMlScoreDsToPiKK, config.thresholdMlScoreXicToPiKP}; + const std::array, kN3ProngDecays - 1> thresholdMlScore3Prongs{config.thresholdMlScoreDplusToPiKPi, config.thresholdMlScoreLcToPiKP, config.thresholdMlScoreDsToPiKK, config.thresholdMlScoreXicToPiKP}; // initialise 2-prong ML response hfMlResponse2Prongs.configure(ptBinsMl, config.thresholdMlScoreD0ToKPi, cutDirMl, 3); @@ -1482,7 +1483,7 @@ struct HfTrackIndexSkimCreator { hfMlResponse2Prongs.init(); // initialise 3-prong ML responses - for (int iDecay3P{0}; iDecay3P < kN3ProngDecays; ++iDecay3P) { + for (int iDecay3P{0}; iDecay3P < kN3ProngDecays - 1; ++iDecay3P) { if (onnxFileNames3Prongs[iDecay3P][0].empty()) { // 3-prong species to be skipped continue; } From 15ed2367519a73c26d99ba69fa468b6969cbd7c2 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Thu, 23 Oct 2025 16:55:55 +0200 Subject: [PATCH 868/986] [PWGEM/Dilepton] update DileptonMC for acc (#13504) --- PWGEM/Dilepton/Core/DileptonMC.h | 159 +++++++++++++++++++++++++++++-- 1 file changed, 149 insertions(+), 10 deletions(-) diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index 5e27d02e4ba..0fd8d2c7e6d 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -369,7 +369,8 @@ struct DileptonMC { const AxisSpec axis_pt{ConfPtllBins, pair_pt_axis_title}; const AxisSpec axis_y{ConfYllBins, pair_y_axis_title}; const AxisSpec axis_dca{ConfDCAllBins, pair_dca_axis_title}; - const AxisSpec axis_pt_meson{ConfPtllBins, "p_{T} (GeV/c)"}; // for omega, phi meson pT spectra + const AxisSpec axis_pt_meson{ConfPtllBins, "p_{T}^{VM} (GeV/c)"}; // for omega, phi meson pT spectra + const AxisSpec axis_y_meson{ConfYllBins, "y^{VM}"}; // for omega, phi meson pT spectra const AxisSpec axis_dca_narrow{ConfDCAllNarrowBins, pair_dca_axis_title}; const AxisSpec axis_dpt{ConfDPtBins, "#Delta p_{T,1}^{gen-rec} + #Delta p_{T,2}^{gen-rec} (GeV/c)"}; @@ -415,9 +416,6 @@ struct DileptonMC { // fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/Upsilon2S/"); // fRegistry.addClone("Generated/sm/PromptPi0/", "Generated/sm/Upsilon3S/"); - fRegistry.add("Generated/sm/Omega2ll/uls/hPtY", "pT of #omega meson", kTH2D, {axis_y, axis_pt_meson}, true); - fRegistry.add("Generated/sm/Phi2ll/uls/hPtY", "pT of #phi meson", kTH2D, {axis_y, axis_pt_meson}, true); - fRegistry.add("Generated/ccbar/c2l_c2l/uls/hs", "generated dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_quadmom, axis_aco, axis_asym_pt, axis_dphi_e_ee}, true); fRegistry.addClone("Generated/ccbar/c2l_c2l/uls/", "Generated/ccbar/c2l_c2l/lspp/"); fRegistry.addClone("Generated/ccbar/c2l_c2l/uls/", "Generated/ccbar/c2l_c2l/lsmm/"); @@ -461,6 +459,14 @@ struct DileptonMC { } } + // evaluate acceptance for polarization + fRegistry.add("Generated/VM/All/Phi/hs", "gen. VM #rightarrow ll", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_cos_theta_pol, axis_phi_pol, axis_quadmom}, true); + fRegistry.addClone("Generated/VM/All/Phi/", "Generated/VM/All/Rho/"); + fRegistry.addClone("Generated/VM/All/Phi/", "Generated/VM/All/Omega/"); + fRegistry.addClone("Generated/VM/All/Phi/", "Generated/VM/All/PromptJPsi/"); + fRegistry.addClone("Generated/VM/All/Phi/", "Generated/VM/All/NonPromptJPsi/"); + fRegistry.addClone("Generated/VM/All/", "Generated/VM/Acc/"); + // reconstructed pair info fRegistry.add("Pair/sm/Photon/uls/hs", "rec. dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_pol, axis_phi_pol, axis_quadmom, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_dca}, true); @@ -542,6 +548,11 @@ struct DileptonMC { fRegistry.addClone("Pair/corr_bkg_lh/", "Pair/corr_bkg_hh/"); fRegistry.addClone("Pair/corr_bkg_lh/", "Pair/comb_bkg/"); + if (doprocessGen_VM) { + fRegistry.add("Generated/VM/Omega/hPtY", "pT vs. y of #omega", kTH2D, {axis_y_meson, axis_pt_meson}, true); // for pT spectrum + fRegistry.add("Generated/VM/Phi/hPtY", "pT vs. y of #phi", kTH2D, {axis_y_meson, axis_pt_meson}, true); // for pT spectrum + } + if (cfgFillUnfolding) { // for 2D unfolding const AxisSpec axis_mass_gen{ConfMllBins, "m_{ll}^{gen} (GeV/c^{2})"}; @@ -880,6 +891,17 @@ struct DileptonMC { eta = lepton.eta(); } + return isInAcceptance(pt, eta); + + // if ((mctrackcuts.min_mcPt < pt && pt < mctrackcuts.max_mcPt) && (mctrackcuts.min_mcEta < eta && eta < mctrackcuts.max_mcEta)) { + // return true; + // } else { + // return false; + // } + } + + bool isInAcceptance(const float pt, const float eta) + { if ((mctrackcuts.min_mcPt < pt && pt < mctrackcuts.max_mcPt) && (mctrackcuts.min_mcEta < eta && eta < mctrackcuts.max_mcEta)) { return true; } else { @@ -1825,7 +1847,6 @@ struct DileptonMC { o2::math_utils::bringToPMPi(phiPol); float quadmom = (3.f * std::pow(cos_thetaPol, 2) - 1.f) / 2.f; - // bool isInAcc = isInAcceptance(t1) && isInAcceptance(t2); if (!isInAcceptance(t1) || !isInAcceptance(t2)) { return false; } @@ -1897,7 +1918,7 @@ struct DileptonMC { case static_cast(EM_HFeeType::kBCe_Be_SameB): fillGenHistograms<18>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // b2c2l_b2l_sameb break; - case static_cast(EM_HFeeType::kBCe_Be_DiffB): // LS + case static_cast(EM_HFeeType::kBCe_Be_DiffB): fillGenHistograms<19>(sign1, sign2, 0, 0, v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, cos_thetaPol, phiPol, quadmom, aco, asym, std::fabs(dphi_e_ee), weight); // b2c2l_b2l_diffb break; default: @@ -1907,6 +1928,113 @@ struct DileptonMC { return false; } + template + bool fillGenParticleAcc(TMCParticle const& mcParticle, TMCParticles const& mcParticles) + { + if (!mcParticle.isPhysicalPrimary() && !mcParticle.producedByGenerator()) { + return false; + } + if (mcParticle.daughtersIds().size() < 2) { + return false; + } + + if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { + if (mcParticle.y() < dielectroncuts.cfg_min_pair_y || dielectroncuts.cfg_max_pair_y < mcParticle.y()) { + return false; + } + } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { + if (mcParticle.y() < dimuoncuts.cfg_min_pair_y || dimuoncuts.cfg_max_pair_y < mcParticle.y()) { + return false; + } + } + + int pdg = mcParticle.pdgCode(); + if (std::abs(pdg) == 113 && mcParticle.daughtersIds().size() != 2) { // reject dalitz decay + return false; + } + if (std::abs(pdg) == 223 && mcParticle.daughtersIds().size() != 2) { // reject dalitz decay + return false; + } + if (std::abs(pdg) == 333 && mcParticle.daughtersIds().size() != 2) { // reject dalitz decay + return false; + } + // accept radiative decay of charmonia (ee + multiple gamma). + + // float pt1 = 0.f, eta1 = 0.f, phi1 = 0.f, sign1 = 0.f; + // float pt2 = 0.f, eta2 = 0.f, phi2 = 0.f, sign2 = 0.f; + std::vector> vDau; + vDau.reserve(mcParticle.daughtersIds().size()); + for (const auto& daughterId : mcParticle.daughtersIds()) { + auto dau = mcParticles.rawIteratorAt(daughterId); + if (std::abs(dau.pdgCode()) == pdg_lepton) { + vDau.emplace_back(std::array{dau.pt(), dau.eta(), dau.phi(), dau.pdgCode() > 0 ? -1.f : +1.f}); + } + } + if (vDau.size() != 2 || vDau[0][3] * vDau[1][3] > 0.f) { // decay objects must be ULS 2 leptons. + vDau.clear(); + vDau.shrink_to_fit(); + return false; + } + + // LOGF(info, "mcParticle.globalIndex() = %d, mcParticle.pdgCode() = %d, mcParticle.daughtersIds().size() = %d", mcParticle.globalIndex(), mcParticle.pdgCode(), mcParticle.daughtersIds().size()); + + ROOT::Math::PtEtaPhiMVector v1(vDau[0][0], vDau[0][1], vDau[0][2], leptonM1); + ROOT::Math::PtEtaPhiMVector v2(vDau[1][0], vDau[1][1], vDau[1][2], leptonM2); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + + std::array arrP1 = {static_cast(v1.Px()), static_cast(v1.Py()), static_cast(v1.Pz()), leptonM1}; + std::array arrP2 = {static_cast(v2.Px()), static_cast(v2.Py()), static_cast(v2.Pz()), leptonM2}; + float cos_thetaPol = 999, phiPol = 999.f; + if (cfgPolarizationFrame == 0) { + o2::aod::pwgem::dilepton::utils::pairutil::getAngleCS(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, vDau[0][3] > 0 ? 1 : -1, cos_thetaPol, phiPol); + } else if (cfgPolarizationFrame == 1) { + o2::aod::pwgem::dilepton::utils::pairutil::getAngleHX(arrP1, arrP2, beamE1, beamE2, beamP1, beamP2, vDau[0][3] > 0 ? 1 : -1, cos_thetaPol, phiPol); + } + o2::math_utils::bringToPMPi(phiPol); + float quadmom = (3.f * std::pow(cos_thetaPol, 2) - 1.f) / 2.f; + + float weight = 1.f; + switch (std::abs(mcParticle.pdgCode())) { + case 113: + fRegistry.fill(HIST("Generated/VM/All/Rho/hs"), v12.M(), mcParticle.pt(), mcParticle.y(), cos_thetaPol, phiPol, quadmom, weight); + if (isInAcceptance(v1.Pt(), v1.Eta()) && isInAcceptance(v2.Pt(), v2.Eta())) { + fRegistry.fill(HIST("Generated/VM/Acc/Rho/hs"), v12.M(), mcParticle.pt(), mcParticle.y(), cos_thetaPol, phiPol, quadmom, weight); + } + break; + case 223: + fRegistry.fill(HIST("Generated/VM/All/Omega/hs"), v12.M(), mcParticle.pt(), mcParticle.y(), cos_thetaPol, phiPol, quadmom, weight); + if (isInAcceptance(v1.Pt(), v1.Eta()) && isInAcceptance(v2.Pt(), v2.Eta())) { + fRegistry.fill(HIST("Generated/VM/Acc/Omega/hs"), v12.M(), mcParticle.pt(), mcParticle.y(), cos_thetaPol, phiPol, quadmom, weight); + } + break; + case 333: + fRegistry.fill(HIST("Generated/VM/All/Phi/hs"), v12.M(), mcParticle.pt(), mcParticle.y(), cos_thetaPol, phiPol, quadmom, weight); + if (isInAcceptance(v1.Pt(), v1.Eta()) && isInAcceptance(v2.Pt(), v2.Eta())) { + fRegistry.fill(HIST("Generated/VM/Acc/Phi/hs"), v12.M(), mcParticle.pt(), mcParticle.y(), cos_thetaPol, phiPol, quadmom, weight); + } + break; + case 443: + if (IsFromBeauty(mcParticle, mcParticles) > 0) { + fRegistry.fill(HIST("Generated/VM/All/NonPromptJPsi/hs"), v12.M(), mcParticle.pt(), mcParticle.y(), cos_thetaPol, phiPol, quadmom, weight); + if (isInAcceptance(v1.Pt(), v1.Eta()) && isInAcceptance(v2.Pt(), v2.Eta())) { + fRegistry.fill(HIST("Generated/VM/Acc/NonPromptJPsi/hs"), v12.M(), mcParticle.pt(), mcParticle.y(), cos_thetaPol, phiPol, quadmom, weight); + } + } else { + fRegistry.fill(HIST("Generated/VM/All/PromptJPsi/hs"), v12.M(), mcParticle.pt(), mcParticle.y(), cos_thetaPol, phiPol, quadmom, weight); + if (isInAcceptance(v1.Pt(), v1.Eta()) && isInAcceptance(v2.Pt(), v2.Eta())) { + fRegistry.fill(HIST("Generated/VM/Acc/PromptJPsi/hs"), v12.M(), mcParticle.pt(), mcParticle.y(), cos_thetaPol, phiPol, quadmom, weight); + } + } + break; + default: + break; + } + + vDau.clear(); + vDau.shrink_to_fit(); + return false; + } + template void runTruePairing(TCollisions const& collisions, TMCLeptons const& posTracks, TMCLeptons const& negTracks, TPreslice const& perCollision, TCut const& cut, TAllTracks const& tracks, TMCCollisions const& mccollisions, TMCParticles const& mcparticles) { @@ -1986,7 +2114,19 @@ struct DileptonMC { for (const auto& [t1, t2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { // LS-- fillGenPairInfo(t1, t2, mcparticles); - } // end of true LS++ pair loop + } // end of true LS-- pair loop + + // acceptance for polarization of vector mesons + auto mcParticles_per_coll = mcparticles.sliceBy(perMcCollision, mccollision.globalIndex()); + for (const auto& mcParticle : mcParticles_per_coll) { + if (!mcParticle.isPhysicalPrimary() && !mcParticle.producedByGenerator()) { + continue; + } + int pdg = std::abs(mcParticle.pdgCode()); + if (pdg == 113 || pdg == 223 || pdg == 333 || pdg == 443) { // select only VMs + fillGenParticleAcc(mcParticle, mcparticles); // VMs that decay into dilepton are stored in derived data. This is sufficient for polarization. + } + } // end of mc particle loop } // end of collision loop } @@ -2462,7 +2602,6 @@ struct DileptonMC { auto mctracks_per_coll = mcparticles.sliceBy(perMcCollision_vm, mccollision.globalIndex()); for (const auto& mctrack : mctracks_per_coll) { - if (!(mctrack.isPhysicalPrimary() || mctrack.producedByGenerator())) { continue; } @@ -2479,10 +2618,10 @@ struct DileptonMC { switch (std::abs(mctrack.pdgCode())) { case 223: - fRegistry.fill(HIST("Generated/sm/Omega2ll/uls/hPtY"), mctrack.y(), mctrack.pt(), 1.f / mctrack.dsf()); + fRegistry.fill(HIST("Generated/VM/Omega/hPtY"), mctrack.y(), mctrack.pt(), 1.f / mctrack.dsf()); break; case 333: - fRegistry.fill(HIST("Generated/sm/Phi2ll/uls/hPtY"), mctrack.y(), mctrack.pt(), 1.f / mctrack.dsf()); + fRegistry.fill(HIST("Generated/VM/Phi/hPtY"), mctrack.y(), mctrack.pt(), 1.f / mctrack.dsf()); break; default: break; From 3223c9c8621530162b2c70c3e4a722f9044beada Mon Sep 17 00:00:00 2001 From: Kai Cui <129373281+kcui1@users.noreply.github.com> Date: Thu, 23 Oct 2025 18:09:57 +0200 Subject: [PATCH 869/986] [PWGLF] Updata the filter of HS correlation (#13512) Co-authored-by: ALICE Action Bot --- .../Strangeness/hStrangeCorrelationFilter.cxx | 136 ++++++++++++------ 1 file changed, 89 insertions(+), 47 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/hStrangeCorrelationFilter.cxx b/PWGLF/TableProducer/Strangeness/hStrangeCorrelationFilter.cxx index 61f9e2f5086..2f39a7c0fe7 100644 --- a/PWGLF/TableProducer/Strangeness/hStrangeCorrelationFilter.cxx +++ b/PWGLF/TableProducer/Strangeness/hStrangeCorrelationFilter.cxx @@ -150,18 +150,9 @@ struct HStrangeCorrelationFilter { Configurable rejcomp{"rejcomp", 0.008, "Competing Cascade rejection"}; Configurable rapCut{"rapCut", 0.8, "Rapidity acceptance"}; } MorePbPbsystCuts; - // invariant mass parametrizations - Configurable> massParsK0Mean{"massParsK0Mean", {0.495, 0.000250, 0.0, 0.0}, "pars in [0]+[1]*x+[2]*std::exp(-[3]*x)"}; - Configurable> massParsK0Width{"massParsK0Width", {0.00354, 0.000609, 0.0, 0.0}, "pars in [0]+[1]*x+[2]*std::exp(-[3]*x)"}; - Configurable> massParsLambdaMean{"massParsLambdaMean", {1.114, 0.000314, 0.140, 11.9}, "pars in [0]+[1]*x+[2]*std::exp(-[3]*x)"}; - Configurable> massParsLambdaWidth{"massParsLambdaWidth", {0.00127, 0.000172, 0.00261, 2.02}, "pars in [0]+[1]*x+[2]*std::exp(-[3]*x)"}; - - Configurable> massParsCascadeMean{"massParsCascadeMean", {1.32, 0.000278, 0.0, 0.0}, "pars in [0]+[1]*x+[2]*std::exp(-[3]*x)"}; - Configurable> massParsCascadeWidth{"massParsCascadeWidth", {0.00189, 0.000227, 0.00370, 1.635}, "pars in [0]+[1]*x+[2]*std::exp(-[3]*x)"}; - - Configurable> massParsOmegaMean{"massParsOmegaMean", {1.67, 0.000298, 0.0, 0.0}, "pars in [0]+[1]*x+[2]*std::exp(-[3]*x)"}; - Configurable> massParsOmegaWidth{"massParsOmegaWidth", {0.00189, 0.000325, 0.00606, 1.77}, "pars in [0]+[1]*x+[2]*std::exp(-[3]*x)"}; + Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository to use"}; + Configurable parameterCCDBPath{"parameterCCDBPath", "Users/k/kcui/LHC25b4a/parameter", "Path of the mean and sigma"}; // must include windows for background and peak Configurable maxMassNSigma{"maxMassNSigma", 12.0f, "max mass region to be considered for further analysis"}; @@ -203,14 +194,14 @@ struct HStrangeCorrelationFilter { Produces assocHadrons; Produces assocPID; - TF1* fK0Mean = new TF1("fK0Mean", "[0]+[1]*x+[2]*std::exp(-[3]*x)"); - TF1* fK0Width = new TF1("fK0Width", "[0]+[1]*x+[2]*std::exp(-[3]*x)"); - TF1* fLambdaMean = new TF1("fLambdaMean", "[0]+[1]*x+[2]*std::exp(-[3]*x)"); - TF1* fLambdaWidth = new TF1("fLambdaWidth", "[0]+[1]*x+[2]*std::exp(-[3]*x)"); - TF1* fXiMean = new TF1("fXiMean", "[0]+[1]*x+[2]*std::exp(-[3]*x)"); - TF1* fXiWidth = new TF1("fXiWidth", "[0]+[1]*x+[2]*std::exp(-[3]*x)"); - TF1* fOmegaMean = new TF1("fomegaMean", "[0]+[1]*x+[2]*std::exp(-[3]*x)"); - TF1* fOmegaWidth = new TF1("fomegaWidth", "[0]+[1]*x+[2]*std::exp(-[3]*x)"); + TH1F* hK0ShortMean; + TH1F* hK0ShortWidth; + TH1F* hLambdaMean; + TH1F* hLambdaWidth; + TH1F* hXiMean; + TH1F* hXiWidth; + TH1F* hOmegaMean; + TH1F* hOmegaWidth; Zorro zorro; OutputObj zorroSummary{"zorroSummary"}; @@ -221,14 +212,14 @@ struct HStrangeCorrelationFilter { zorroSummary.setObject(zorro.getZorroSummary()); mRunNumber = -1; - fK0Mean->SetParameters(massParsK0Mean->at(0), massParsK0Mean->at(1), massParsK0Mean->at(2), massParsK0Mean->at(3)); - fK0Width->SetParameters(massParsK0Width->at(0), massParsK0Width->at(1), massParsK0Width->at(2), massParsK0Width->at(3)); - fLambdaMean->SetParameters(massParsLambdaMean->at(0), massParsLambdaMean->at(1), massParsLambdaMean->at(2), massParsLambdaMean->at(3)); - fLambdaWidth->SetParameters(massParsLambdaWidth->at(0), massParsLambdaWidth->at(1), massParsLambdaWidth->at(2), massParsLambdaWidth->at(3)); - fXiMean->SetParameters(massParsCascadeMean->at(0), massParsCascadeMean->at(1), massParsCascadeMean->at(2), massParsCascadeMean->at(3)); - fXiWidth->SetParameters(massParsCascadeWidth->at(0), massParsCascadeWidth->at(1), massParsCascadeWidth->at(2), massParsCascadeWidth->at(3)); - fOmegaMean->SetParameters(massParsOmegaMean->at(0), massParsOmegaMean->at(1), massParsOmegaMean->at(2), massParsOmegaMean->at(3)); - fOmegaWidth->SetParameters(massParsOmegaWidth->at(0), massParsOmegaWidth->at(1), massParsOmegaWidth->at(2), massParsOmegaWidth->at(3)); + hK0ShortMean = 0x0; + hK0ShortWidth = 0x0; + hLambdaMean = 0x0; + hLambdaWidth = 0x0; + hXiMean = 0x0; + hXiWidth = 0x0; + hOmegaMean = 0x0; + hOmegaWidth = 0x0; if (doprocessV0s || doprocessV0sMC) { histos.add("h3dMassK0Short", "h3dMassK0Short", kTH3F, {axisPtQA, axisK0ShortMass, axisMult}); @@ -255,6 +246,35 @@ struct HStrangeCorrelationFilter { mRunNumber = bc.runNumber(); } + void initParametersFromCCDB(aod::BCsWithTimestamps::iterator const& bc) + { + if (mRunNumber == bc.runNumber()) { + return; + } + mRunNumber = bc.runNumber(); + LOG(info) << "Loading mean and sigma from CCDB for run " << mRunNumber << " now..."; + auto timeStamp = bc.timestamp(); + + TList* listParameters = ccdb->getForTimeStamp(parameterCCDBPath, timeStamp); + + if (!listParameters) { + LOG(fatal) << "Problem getting TList object with parameters!"; + } + if (doprocessV0s || doprocessV0sMC) { + hK0ShortMean = static_cast(listParameters->FindObject("hK0ShortMean")); + hK0ShortWidth = static_cast(listParameters->FindObject("hK0ShortWidth")); + hLambdaMean = static_cast(listParameters->FindObject("hLambdaMean")); + hLambdaWidth = static_cast(listParameters->FindObject("hLambdaWidth")); + } + if (doprocessCascades || doprocessCascadesMC) { + hXiMean = static_cast(listParameters->FindObject("hXiMean")); + hXiWidth = static_cast(listParameters->FindObject("hXiWidth")); + hOmegaMean = static_cast(listParameters->FindObject("hOmegaMean")); + hOmegaWidth = static_cast(listParameters->FindObject("hOmegaWidth")); + } + LOG(info) << "parameters now loaded for " << mRunNumber; + } + // more event selections in Pb-Pb template bool isCollisionSelectedPbPb(TCollision collision) @@ -422,6 +442,9 @@ struct HStrangeCorrelationFilter { // for real data processing void processTriggers(soa::Join::iterator const& collision, soa::Filtered const& tracks, aod::BCsWithTimestamps const&) { + // Load parameters for sideband subtraction + auto bc = collision.bc_as(); + initParametersFromCCDB(bc); // Perform basic event selection if (!collision.sel8()) { return; @@ -431,7 +454,6 @@ struct HStrangeCorrelationFilter { return; } if (zorroMask.value != "") { - auto bc = collision.bc_as(); initCCDB(bc); bool zorroSelected = zorro.isSelected(collision.bc_as().globalBC()); /// Just let Zorro do the accounting if (!zorroSelected) { @@ -456,6 +478,9 @@ struct HStrangeCorrelationFilter { // for MC processing void processTriggersMC(soa::Join::iterator const& collision, soa::Filtered const& tracks, aod::McParticles const&, aod::BCsWithTimestamps const&) { + // Load parameters for sideband subtraction + auto bc = collision.bc_as(); + initParametersFromCCDB(bc); // Perform basic event selection if (!collision.sel8()) { return; @@ -465,7 +490,6 @@ struct HStrangeCorrelationFilter { return; } if (zorroMask.value != "") { - auto bc = collision.bc_as(); initCCDB(bc); bool zorroSelected = zorro.isSelected(collision.bc_as().globalBC()); /// Just let Zorro do the accounting if (!zorroSelected) { @@ -496,6 +520,9 @@ struct HStrangeCorrelationFilter { void processAssocPions(soa::Join::iterator const& collision, soa::Filtered const& tracks, aod::BCsWithTimestamps const&) { + // Load parameters for sideband subtraction + auto bc = collision.bc_as(); + initParametersFromCCDB(bc); // Perform basic event selection if (!collision.sel8()) { return; @@ -505,7 +532,6 @@ struct HStrangeCorrelationFilter { return; } if (zorroMask.value != "") { - auto bc = collision.bc_as(); initCCDB(bc); bool zorroSelected = zorro.isSelected(collision.bc_as().globalBC()); /// Just let Zorro do the accounting if (!zorroSelected) { @@ -523,6 +549,9 @@ struct HStrangeCorrelationFilter { void processAssocPionsMC(soa::Join::iterator const& collision, soa::Filtered const& tracks, aod::BCsWithTimestamps const&) { + // Load parameters for sideband subtraction + auto bc = collision.bc_as(); + initParametersFromCCDB(bc); // Perform basic event selection if (!collision.sel8()) { return; @@ -532,7 +561,6 @@ struct HStrangeCorrelationFilter { return; } if (zorroMask.value != "") { - auto bc = collision.bc_as(); initCCDB(bc); bool zorroSelected = zorro.isSelected(collision.bc_as().globalBC()); /// Just let Zorro do the accounting if (!zorroSelected) { @@ -550,6 +578,9 @@ struct HStrangeCorrelationFilter { void processAssocHadrons(soa::Join::iterator const& collision, soa::Filtered const& tracks, aod::BCsWithTimestamps const&) { + // Load parameters for sideband subtraction + auto bc = collision.bc_as(); + initParametersFromCCDB(bc); // Perform basic event selection if (!collision.sel8()) { return; @@ -559,7 +590,6 @@ struct HStrangeCorrelationFilter { return; } if (zorroMask.value != "") { - auto bc = collision.bc_as(); initCCDB(bc); bool zorroSelected = zorro.isSelected(collision.bc_as().globalBC()); /// Just let Zorro do the accounting if (!zorroSelected) { @@ -576,6 +606,9 @@ struct HStrangeCorrelationFilter { } void processAssocHadronsMC(soa::Join::iterator const& collision, soa::Filtered const& tracks, aod::McParticles const&, aod::BCsWithTimestamps const&) { + // Load parameters for sideband subtraction + auto bc = collision.bc_as(); + initParametersFromCCDB(bc); // Perform basic event selection if (!collision.sel8()) { return; @@ -585,7 +618,6 @@ struct HStrangeCorrelationFilter { return; } if (zorroMask.value != "") { - auto bc = collision.bc_as(); initCCDB(bc); bool zorroSelected = zorro.isSelected(collision.bc_as().globalBC()); /// Just let Zorro do the accounting if (!zorroSelected) { @@ -603,6 +635,9 @@ struct HStrangeCorrelationFilter { void processV0s(soa::Join::iterator const& collision, DauTracks const&, soa::Filtered const& V0s, aod::BCsWithTimestamps const&) { + // Load parameters for sideband subtraction + auto bc = collision.bc_as(); + initParametersFromCCDB(bc); double cent = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); // Perform basic event selection if (!collision.sel8()) { @@ -613,7 +648,6 @@ struct HStrangeCorrelationFilter { return; } if (zorroMask.value != "") { - auto bc = collision.bc_as(); initCCDB(bc); bool zorroSelected = zorro.isSelected(collision.bc_as().globalBC()); /// Just let Zorro do the accounting if (!zorroSelected) { @@ -716,9 +750,9 @@ struct HStrangeCorrelationFilter { } // simplified handling: calculate NSigma in mass here - float massNSigmaK0Short = (v0.mK0Short() - fK0Mean->Eval(v0.pt())) / (fK0Width->Eval(v0.pt()) + 1e-6); - float massNSigmaLambda = (v0.mLambda() - fLambdaMean->Eval(v0.pt())) / (fLambdaWidth->Eval(v0.pt()) + 1e-6); - float massNSigmaAntiLambda = (v0.mAntiLambda() - fLambdaMean->Eval(v0.pt())) / (fLambdaWidth->Eval(v0.pt()) + 1e-6); + float massNSigmaK0Short = (v0.mK0Short() - hK0ShortMean->Interpolate(v0.pt())) / (hK0ShortWidth->Interpolate(v0.pt()) + 1e-6); + float massNSigmaLambda = (v0.mLambda() - hLambdaMean->Interpolate(v0.pt())) / (hLambdaWidth->Interpolate(v0.pt()) + 1e-6); + float massNSigmaAntiLambda = (v0.mAntiLambda() - hLambdaMean->Interpolate(v0.pt())) / (hLambdaWidth->Interpolate(v0.pt()) + 1e-6); if (compatibleK0Short) histos.fill(HIST("h3dMassK0Short"), v0.pt(), v0.mK0Short(), cent); @@ -744,6 +778,9 @@ struct HStrangeCorrelationFilter { void processV0sMC(soa::Join::iterator const& collision, DauTracksMC const&, soa::Filtered const& V0s, aod::McParticles const&, aod::BCsWithTimestamps const&) { double cent = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); + // Load parameters for sideband subtraction + auto bc = collision.bc_as(); + initParametersFromCCDB(bc); // Perform basic event selection if (!collision.sel8()) { return; @@ -753,7 +790,6 @@ struct HStrangeCorrelationFilter { return; } if (zorroMask.value != "") { - auto bc = collision.bc_as(); initCCDB(bc); bool zorroSelected = zorro.isSelected(collision.bc_as().globalBC()); /// Just let Zorro do the accounting if (!zorroSelected) { @@ -764,6 +800,7 @@ struct HStrangeCorrelationFilter { return; /// _________________________________________________ /// Populate table with associated V0s + for (auto const& v0 : V0s) { if (v0.v0radius() < v0RadiusMin || v0.v0radius() > v0RadiusMax || v0.eta() > assocEtaMax || v0.eta() < assocEtaMin || v0.v0cosPA() < v0Cospa) { continue; @@ -855,9 +892,9 @@ struct HStrangeCorrelationFilter { } // simplified handling: calculate NSigma in mass here - float massNSigmaK0Short = (v0.mK0Short() - fK0Mean->Eval(v0.pt())) / (fK0Width->Eval(v0.pt()) + 1e-6); - float massNSigmaLambda = (v0.mLambda() - fLambdaMean->Eval(v0.pt())) / (fLambdaWidth->Eval(v0.pt()) + 1e-6); - float massNSigmaAntiLambda = (v0.mAntiLambda() - fLambdaMean->Eval(v0.pt())) / (fLambdaWidth->Eval(v0.pt()) + 1e-6); + float massNSigmaK0Short = (v0.mK0Short() - hK0ShortMean->Interpolate(v0.pt())) / (hK0ShortWidth->Interpolate(v0.pt()) + 1e-6); + float massNSigmaLambda = (v0.mLambda() - hLambdaMean->Interpolate(v0.pt())) / (hLambdaWidth->Interpolate(v0.pt()) + 1e-6); + float massNSigmaAntiLambda = (v0.mAntiLambda() - hLambdaMean->Interpolate(v0.pt())) / (hLambdaWidth->Interpolate(v0.pt()) + 1e-6); bool v0PhysicalPrimary = false; bool trueK0Short = false; bool trueLambda = false; @@ -893,6 +930,9 @@ struct HStrangeCorrelationFilter { void processCascades(soa::Join::iterator const& collision, DauTracks const&, soa::Filtered const& /*V0s*/, soa::Filtered const& Cascades, aod::BCsWithTimestamps const&) { double cent = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); + // Load parameters for sideband subtraction + auto bc = collision.bc_as(); + initParametersFromCCDB(bc); // Perform basic event selection if (!collision.sel8()) { return; @@ -902,7 +942,6 @@ struct HStrangeCorrelationFilter { return; } if (zorroMask.value != "") { - auto bc = collision.bc_as(); initCCDB(bc); bool zorroSelected = zorro.isSelected(collision.bc_as().globalBC()); /// Just let Zorro do the accounting if (!zorroSelected) { @@ -1031,8 +1070,8 @@ struct HStrangeCorrelationFilter { } } - float massNSigmaXi = (casc.mXi() - fXiMean->Eval(casc.pt())) / (fXiWidth->Eval(casc.pt()) + 1e-6); - float massNSigmaOmega = (casc.mOmega() - fOmegaMean->Eval(casc.pt())) / (fOmegaWidth->Eval(casc.pt()) + 1e-6); + float massNSigmaXi = (casc.mXi() - -hXiMean->Interpolate(casc.pt())) / (hXiWidth->Interpolate(casc.pt()) + 1e-6); + float massNSigmaOmega = (casc.mOmega() - hOmegaMean->Interpolate(casc.pt())) / (hOmegaWidth->Interpolate(casc.pt()) + 1e-6); if (compatibleXiMinus) histos.fill(HIST("h3dMassXiMinus"), casc.pt(), casc.mXi(), cent); @@ -1059,6 +1098,9 @@ struct HStrangeCorrelationFilter { void processCascadesMC(soa::Join::iterator const& collision, DauTracks const&, soa::Filtered const& /*V0s*/, soa::Filtered const& Cascades, aod::McParticles const&, aod::BCsWithTimestamps const&) { double cent = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); + // Load parameters for sideband subtraction + auto bc = collision.bc_as(); + initParametersFromCCDB(bc); // Perform basic event selection if (!collision.sel8()) { return; @@ -1068,7 +1110,6 @@ struct HStrangeCorrelationFilter { return; } if (zorroMask.value != "") { - auto bc = collision.bc_as(); initCCDB(bc); bool zorroSelected = zorro.isSelected(collision.bc_as().globalBC()); /// Just let Zorro do the accounting if (!zorroSelected) { @@ -1198,8 +1239,9 @@ struct HStrangeCorrelationFilter { } } - float massNSigmaXi = (casc.mXi() - fXiMean->Eval(casc.pt())) / (fXiWidth->Eval(casc.pt()) + 1e-6); - float massNSigmaOmega = (casc.mOmega() - fOmegaMean->Eval(casc.pt())) / (fOmegaWidth->Eval(casc.pt()) + 1e-6); + float massNSigmaXi = (casc.mXi() - -hXiMean->Interpolate(casc.pt())) / (hXiWidth->Interpolate(casc.pt()) + 1e-6); + float massNSigmaOmega = (casc.mOmega() - hOmegaMean->Interpolate(casc.pt())) / (hOmegaWidth->Interpolate(casc.pt()) + 1e-6); + bool cascPhysicalPrimary = false; bool trueXiMinus = false; bool trueXiPlus = false; From 13cb0d1bd3e95ed0efba8809a1b50c86ef7307b9 Mon Sep 17 00:00:00 2001 From: SahaArka-uniba Date: Thu, 23 Oct 2025 18:44:03 +0200 Subject: [PATCH 870/986] [PWGLF] removed the mass of deuteron from the dE/dx calculation (#13509) Co-authored-by: Arkaprabha Saha --- .../Nuspex/{antiNucleiTask.cxx => AntiNucleiTask.cxx} | 10 +++++----- PWGLF/Tasks/Nuspex/CMakeLists.txt | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) rename PWGLF/Tasks/Nuspex/{antiNucleiTask.cxx => AntiNucleiTask.cxx} (95%) diff --git a/PWGLF/Tasks/Nuspex/antiNucleiTask.cxx b/PWGLF/Tasks/Nuspex/AntiNucleiTask.cxx similarity index 95% rename from PWGLF/Tasks/Nuspex/antiNucleiTask.cxx rename to PWGLF/Tasks/Nuspex/AntiNucleiTask.cxx index 6f4070219f5..3cf9fcb8758 100644 --- a/PWGLF/Tasks/Nuspex/antiNucleiTask.cxx +++ b/PWGLF/Tasks/Nuspex/AntiNucleiTask.cxx @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file antiNucleiTask.cxx +/// \file AntiNucleiTask.cxx /// \brief A task to analyse Anti-nuclei /// \author Arkaprabha Saha @@ -48,7 +48,7 @@ static const int minTpcCrossedRowsCut = 70; static const float maxVertexZCut = 10.f; } // namespace -struct antiNucleiTask { +struct AntiNucleiTask { // Histogram registry: for holding histograms HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -138,7 +138,7 @@ struct antiNucleiTask { // Track Selection for (const auto& track : tracks) { - double expBethe{tpc::BetheBlochAleph(static_cast(track.tpcInnerParam() / o2::constants::physics::MassDeuteron), cfgBetheBlochParams->get("p0"), cfgBetheBlochParams->get("p1"), cfgBetheBlochParams->get("p2"), cfgBetheBlochParams->get("p3"), cfgBetheBlochParams->get("p4"))}; + double expBethe{tpc::BetheBlochAleph(static_cast(track.tpcInnerParam()), cfgBetheBlochParams->get("p0"), cfgBetheBlochParams->get("p1"), cfgBetheBlochParams->get("p2"), cfgBetheBlochParams->get("p3"), cfgBetheBlochParams->get("p4"))}; double expSigma{expBethe * cfgBetheBlochParams->get("resolution")}; float tpcNSigmaDeuteron = static_cast((track.tpcSignal() - expBethe) / expSigma); @@ -165,11 +165,11 @@ struct antiNucleiTask { } } - PROCESS_SWITCH(antiNucleiTask, process, "process", true); + PROCESS_SWITCH(AntiNucleiTask, process, "process", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(cfgc)}; } diff --git a/PWGLF/Tasks/Nuspex/CMakeLists.txt b/PWGLF/Tasks/Nuspex/CMakeLists.txt index 0ce50257c6f..3242c18130c 100644 --- a/PWGLF/Tasks/Nuspex/CMakeLists.txt +++ b/PWGLF/Tasks/Nuspex/CMakeLists.txt @@ -120,7 +120,7 @@ o2physics_add_dpl_workflow(nuclei-ebye COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(anti-nuclei-hist - SOURCES antiNucleiTask.cxx + SOURCES AntiNucleiTask.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) From a65d6312d2aa706678b624c831dd3daec8e850bf Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Thu, 23 Oct 2025 19:20:42 +0200 Subject: [PATCH 871/986] [PWGLF] Fix bug in histogram access from ccdb (#13513) --- PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx index bb3e564bc82..59d73923ac6 100644 --- a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx @@ -387,7 +387,7 @@ struct lambdaspincorrderived { if (useweight && datatype == 1) { if (tag1 == 0 && tag2 == 0) { epsWeight1 = hweight1->GetBinContent(hweight1->FindBin(dphi1, deta1, pt1)); - epsWeight2 = hweight2->GetBinContent(hweight12->FindBin(dphi2, deta2, pt2)); + epsWeight2 = hweight12->GetBinContent(hweight12->FindBin(dphi2, deta2, pt2)); } else if (tag1 == 0 && tag2 == 1) { epsWeight1 = hweight2->GetBinContent(hweight2->FindBin(dphi1, deta1, pt1)); epsWeight2 = hweight22->GetBinContent(hweight22->FindBin(dphi2, deta2, pt2)); From cdb7919aab3baccc92363ef099a46e66b6c71a6d Mon Sep 17 00:00:00 2001 From: Yash Patley <52608802+yashpatley@users.noreply.github.com> Date: Thu, 23 Oct 2025 23:37:31 +0530 Subject: [PATCH 872/986] [PWGCF] Charge Particle Flow (#13485) --- PWGCF/Flow/Tasks/CMakeLists.txt | 5 + PWGCF/Flow/Tasks/flowEventPlane.cxx | 532 ++++++++++++++++++++++++++++ 2 files changed, 537 insertions(+) create mode 100644 PWGCF/Flow/Tasks/flowEventPlane.cxx diff --git a/PWGCF/Flow/Tasks/CMakeLists.txt b/PWGCF/Flow/Tasks/CMakeLists.txt index f9805ac1ff0..cf7a5221b3a 100644 --- a/PWGCF/Flow/Tasks/CMakeLists.txt +++ b/PWGCF/Flow/Tasks/CMakeLists.txt @@ -93,3 +93,8 @@ o2physics_add_dpl_workflow(flow-gfw-ese SOURCES flowGfwEse.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::GFWCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(flow-event-plane + SOURCES flowEventPlane.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGCF/Flow/Tasks/flowEventPlane.cxx b/PWGCF/Flow/Tasks/flowEventPlane.cxx new file mode 100644 index 00000000000..32c75e7a1ad --- /dev/null +++ b/PWGCF/Flow/Tasks/flowEventPlane.cxx @@ -0,0 +1,532 @@ +// 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 flowEventPlane.cxx +/// \brief Flow calculation using event plane. +/// \author Yash Patley + +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::constants::physics; +using namespace o2::constants::math; + +enum CorrectionType { + kFineCorr = 0, + kCoarseCorr, + kNCorr +}; + +enum CollisionParameterType { + kCent = 0, + kVx, + kVy, + kVz +}; + +enum ZDCXYType { + kXa = 0, + kYa, + kXc, + kYc, + kXYAC +}; + +struct FlowEventPlane { + // Configurables + // Collisions + Configurable cMinZVtx{"cMinZVtx", -10.0, "Min VtxZ cut"}; + Configurable cMaxZVtx{"cMaxZVtx", 10.0, "Max VtxZ cut"}; + Configurable cMinCent{"cMinCent", 0., "Minumum Centrality"}; + Configurable cMaxCent{"cMaxCent", 100.0, "Maximum Centrality"}; + Configurable cSel8Trig{"cSel8Trig", true, "Sel8 (T0A + T0C) Selection Run3"}; + Configurable cTriggerTvxSel{"cTriggerTvxSel", false, "Trigger Time and Vertex Selection"}; + Configurable cTFBorder{"cTFBorder", false, "Timeframe Border Selection"}; + Configurable cNoItsROBorder{"cNoItsROBorder", false, "No ITSRO Border Cut"}; + Configurable cItsTpcVtx{"cItsTpcVtx", false, "ITS+TPC Vertex Selection"}; + Configurable cPileupReject{"cPileupReject", true, "Pileup rejection"}; + Configurable cZVtxTimeDiff{"cZVtxTimeDiff", false, "z-vtx time diff selection"}; + Configurable cIsGoodITSLayers{"cIsGoodITSLayers", true, "Good ITS Layers All"}; + Configurable cMinOccupancy{"cMinOccupancy", 0, "Minimum FT0C Occupancy"}; + Configurable cMaxOccupancy{"cMaxOccupancy", 1e6, "Maximum FT0C Occupancy"}; + + // Tracks + Configurable cTrackMinPt{"cTrackMinPt", 0.15, "p_{T} minimum"}; + Configurable cTrackMaxPt{"cTrackMaxPt", 2.0, "p_{T} maximum"}; + Configurable cTrackEtaCut{"cTrackEtaCut", 0.8, "Pseudorapidity cut"}; + Configurable cTrackGlobal{"cTrackGlobal", true, "Global Track"}; + Configurable cTrackDcaXYCut{"cTrackDcaXYCut", 0.1, "DcaXY Cut"}; + Configurable cTrackDcaZCut{"cTrackDcaZCut", 1., "DcaXY Cut"}; + + // Coarse binning factor + Configurable cAxisCBF{"cAxisCBF", 1, "Coarse Bin Factor"}; + + // Cent Vx Vy Vz Bins + Configurable cAxisCentBins{"cAxisCentBins", 20, "NBins Centrality"}; + Configurable cAxisVxyBins{"cAxisVxyBins", 20, "NBins Vx Vy"}; + Configurable cAxisVzBins{"cAxisVzBins", 20, "NBins Vz"}; + Configurable cAxisVxMin{"cAxisVxMin", -0.06, "Vx Min"}; + Configurable cAxisVxMax{"cAxisVxMax", -0.02, "Vx Max"}; + Configurable cAxisVyMin{"cAxisVyMin", -0.01, "Vy Min"}; + Configurable cAxisVyMax{"cAxisVyMax", 0.006, "Vy Max"}; + + // Corrections + Configurable> cCorrFlagVector{"cCorrFlagVector", {0, 0, 0, 0, 0, 0}, "Correction Flag"}; + + // CCDB + Configurable cCcdbUrl{"cCcdbUrl", "http://ccdb-test.cern.ch:8080", "url of ccdb"}; + Configurable cCcdbPath{"cCcdbPath", "Users/y/ypatley/DFOO", "Path for ccdb-object"}; + + // Initialize CCDB Service + Service ccdbService; + + // Histogram registry: an object to hold your histograms + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // Global objects + float cent = 0., mult = 0.; + float posX = 0., posY = 0., posZ = 0.; + std::array znaXWeigthEnergy = {1., 1., 1., 1.}; + std::array znaYWeigthEnergy = {1., 1., 1., 1.}; + std::array zncXWeigthEnergy = {1., 1., 1., 1.}; + std::array zncYWeigthEnergy = {1., 1., 1., 1.}; + std::vector> vCoarseCorrHistNames = { + {"hXZNAVsCentVxVyVz"}, + {"hYZNAVsCentVxVyVz"}, + {"hXZNCVsCentVxVyVz"}, + {"hYZNCVsCentVxVyVz"}}; + std::vector> vFineCorrHistNames = { + {"hXZNAVsCent", "hXZNAVsVx", "hXZNAVsVy", "hXZNAVsVz"}, + {"hYZNAVsCent", "hYZNAVsVx", "hYZNAVsVy", "hYZNAVsVz"}, + {"hXZNCVsCent", "hXZNCVsVx", "hXZNCVsVy", "hXZNCVsVz"}, + {"hYZNCVsCent", "hYZNCVsVx", "hYZNCVsVy", "hYZNCVsVz"}}; + std::map>> corrTypeHistNameMap = {{kFineCorr, vFineCorrHistNames}, {kCoarseCorr, vCoarseCorrHistNames}}; + + void init(InitContext const&) + { + // Set CCDB url + ccdbService->setURL(cCcdbUrl.value); + ccdbService->setCaching(true); + + // Define axes + const AxisSpec axisZDCEnergy{1000, 0, 5000, "ZD[AC] Signal"}; + + const AxisSpec axisCent{100, 0., 100, "FT0C%"}; + const AxisSpec axisVx{cAxisVxyBins, cAxisVxMin, cAxisVxMax, "V_{X}(cm)"}; + const AxisSpec axisVy{cAxisVxyBins, cAxisVyMin, cAxisVyMax, "V_{Y}(cm)"}; + const AxisSpec axisVz{cAxisVzBins, cMinZVtx, cMaxZVtx, "V_{Z}(cm)"}; + + const AxisSpec axisCoarseCent{cAxisCentBins / cAxisCBF, cMinCent, cMaxCent, "FT0C%"}; + const AxisSpec axisCoarseVx{cAxisVxyBins / cAxisCBF, cAxisVxMin, cAxisVxMax, "V_{x}"}; + const AxisSpec axisCoarseVy{cAxisVxyBins / cAxisCBF, cAxisVyMin, cAxisVyMax, "V_{y}"}; + const AxisSpec axisCoarseVz{cAxisVzBins / cAxisCBF, cMinZVtx, cMaxZVtx, "V_{z}"}; + + const AxisSpec axisFineCent{cAxisCentBins, cMinCent, cMaxCent, "FT0C%"}; + const AxisSpec axisFineVx{cAxisVxyBins, cAxisVxMin, cAxisVxMax, "V_{x}"}; + const AxisSpec axisFineVy{cAxisVxyBins, cAxisVyMin, cAxisVyMax, "V_{x}"}; + const AxisSpec axisFineVz{cAxisVzBins, cMinZVtx, cMaxZVtx, "V_{z}"}; + + const AxisSpec axisXa{40, -1, 1, "X^{ZNA}_{1}"}; + const AxisSpec axisYa{40, -1, 1, "Y^{ZNA}_{1}"}; + const AxisSpec axisXc{40, -1, 1, "X^{ZNC}_{1}"}; + const AxisSpec axisYc{40, -1, 1, "Y^{ZNC}_{1}"}; + + const AxisSpec axisPsi{18, -PIHalf, PIHalf, "#Psi_{SP}"}; + + const AxisSpec axisXYac{600, -6, 6, "Q^{t}Q^{p}"}; + const AxisSpec axisV1{400, -4, 4, "v_{1}"}; + + const AxisSpec axisTrackPt{100, 0., 10., "p_{T} (GeV/#it{c})"}; + const AxisSpec axisTrackEta{16, -0.8, 0.8, "#eta"}; + + const AxisSpec axisTrackDcaXY{60, -0.15, 0.15, "DCA_{XY}"}; + const AxisSpec axisTrackDcaZ{230, -1.15, 1.15, "DCA_{XY}"}; + + // Create histograms + histos.add("Event/hCent", "FT0C%", kTH1F, {axisCent}); + histos.add("Event/hVx", "V_{x}", kTH1F, {axisVx}); + histos.add("Event/hVy", "V_{y}", kTH1F, {axisVy}); + histos.add("Event/hVz", "V_{z}", kTH1F, {axisVz}); + histos.add("QA/hZNASignalSector1", "ZNA Signal Sector 1", kTH1F, {axisZDCEnergy}); + histos.add("QA/hZNASignalSector2", "ZNA Signal Sector 2", kTH1F, {axisZDCEnergy}); + histos.add("QA/hZNASignalSector3", "ZNA Signal Sector 3", kTH1F, {axisZDCEnergy}); + histos.add("QA/hZNASignalSector4", "ZNA Signal Sector 4", kTH1F, {axisZDCEnergy}); + histos.add("QA/hZNCSignalSector1", "ZNC Signal Sector 1", kTH1F, {axisZDCEnergy}); + histos.add("QA/hZNCSignalSector2", "ZNC Signal Sector 2", kTH1F, {axisZDCEnergy}); + histos.add("QA/hZNCSignalSector3", "ZNC Signal Sector 3", kTH1F, {axisZDCEnergy}); + histos.add("QA/hZNCSignalSector4", "ZNC Signal Sector 4", kTH1F, {axisZDCEnergy}); + histos.add("CorrHist/hWtXZNA", "X^{ZNA}_{1}", kTHnF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); + histos.add("CorrHist/hWtYZNA", "Y^{ZNA}_{1}", kTHnF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); + histos.add("CorrHist/hWtXZNC", "X^{ZNC}_{1}", kTHnF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); + histos.add("CorrHist/hWtYZNC", "Y^{ZNC}_{1}", kTHnF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); + histos.add("CorrHist/hUWtXZNA", "X^{ZNA}_{1}", kTHnF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); + histos.add("CorrHist/hUWtYZNA", "Y^{ZNA}_{1}", kTHnF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); + histos.add("CorrHist/hUWtXZNC", "X^{ZNC}_{1}", kTHnF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); + histos.add("CorrHist/hUWtYZNC", "Y^{ZNC}_{1}", kTHnF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); + histos.add("CorrHist/hXZNAVsCent", "X^{ZNA}_{1} Vs Cent", kTProfile, {axisFineCent}); + histos.add("CorrHist/hXZNAVsVx", "X^{ZNA}_{1} Vs V_{x}", kTProfile, {axisFineVx}); + histos.add("CorrHist/hXZNAVsVy", "X^{ZNA}_{1} Vs V_{y}", kTProfile, {axisFineVy}); + histos.add("CorrHist/hXZNAVsVz", "X^{ZNA}_{1} Vs V_{z}", kTProfile, {axisFineVz}); + histos.add("CorrHist/hYZNAVsCent", "Y^{ZNA}_{1} Vs Cent", kTProfile, {axisFineCent}); + histos.add("CorrHist/hYZNAVsVx", "Y^{ZNA}_{1} Vs V_{x}", kTProfile, {axisFineVx}); + histos.add("CorrHist/hYZNAVsVy", "Y^{ZNA}_{1} Vs V_{y}", kTProfile, {axisFineVy}); + histos.add("CorrHist/hYZNAVsVz", "Y^{ZNA}_{1} Vs V_{z}", kTProfile, {axisFineVz}); + histos.add("CorrHist/hXZNCVsCent", "X^{ZNC}_{1} Vs Cent", kTProfile, {axisFineCent}); + histos.add("CorrHist/hXZNCVsVx", "X^{ZNC}_{1} Vs V_{x}", kTProfile, {axisFineVx}); + histos.add("CorrHist/hXZNCVsVy", "X^{ZNC}_{1} Vs V_{y}", kTProfile, {axisFineVy}); + histos.add("CorrHist/hXZNCVsVz", "X^{ZNC}_{1} Vs V_{z}", kTProfile, {axisFineVz}); + histos.add("CorrHist/hYZNCVsCent", "Y^{ZNC}_{1} Vs Cent", kTProfile, {axisFineCent}); + histos.add("CorrHist/hYZNCVsVx", "Y^{ZNC}_{1} Vs V_{x}", kTProfile, {axisFineVx}); + histos.add("CorrHist/hYZNCVsVy", "Y^{ZNC}_{1} Vs V_{y}", kTProfile, {axisFineVy}); + histos.add("CorrHist/hYZNCVsVz", "Y^{ZNC}_{1} Vs V_{z}", kTProfile, {axisFineVz}); + histos.add("Checks/hPsiSPA", "#Psi_{SP}^{A} distribution", kTH2F, {axisCent, axisPsi}); + histos.add("Checks/hPsiSPC", "#Psi_{SP}^{C} distribution", kTH2F, {axisCent, axisPsi}); + histos.add("Checks/hCosPsiSPAC", "Cos(#Psi_{SP}^{A} #minus #Psi_{SP}^{C}) distribution", kTProfile, {axisCent}); + histos.add("Checks/hSinPsiSPAC", "Sin(#Psi_{SP}^{A} #minus #Psi_{SP}^{C}) distribution", kTProfile, {axisCent}); + histos.add("Checks/hXaXc", "X^{ZNC}_{1} Vs X^{ZNA}_{1}", kTProfile, {axisCent}); + histos.add("Checks/hYaYc", "Y^{ZNC}_{1} Vs Y^{ZNA}_{1}", kTProfile, {axisCent}); + histos.add("TrackQA/hPtDcaXY", "DCA_{XY} vs p_{T}", kTH2F, {axisTrackPt, axisTrackDcaXY}); + histos.add("TrackQA/hPtDcaZ", "DCA_{Z} vs p_{T}", kTH2F, {axisTrackPt, axisTrackDcaZ}); + histos.add("DF/hQaQc", "X^{A}_{1}X^{C}_{1} + Y^{A}_{1}Y^{C}_{1}", kTProfile, {axisCent}); + histos.add("DF/hAQuPos", "u_{x}X^{A}_{1} + u_{y}Y^{A}_{1}", kTH3F, {axisCent, axisV1, axisTrackEta}); + histos.add("DF/hCQuPos", "u_{x}X^{C}_{1} + u_{y}Y^{C}_{1}", kTH3F, {axisCent, axisV1, axisTrackEta}); + histos.add("DF/hAQuNeg", "u_{x}X^{A}_{1} + u_{y}Y^{A}_{1}", kTH3F, {axisCent, axisV1, axisTrackEta}); + histos.add("DF/hCQuNeg", "u_{x}X^{C}_{1} + u_{y}Y^{C}_{1}", kTH3F, {axisCent, axisV1, axisTrackEta}); + } + + template + bool selCollision(C const& col) + { + if (col.posZ() <= cMinZVtx || col.posZ() >= cMaxZVtx) { // VtxZ selection + return false; + } + + if (cSel8Trig && !col.sel8()) { // Sel8 selection + return false; + } + + cent = col.centFT0C(); + if (cent <= cMinCent || cent >= cMaxCent) { // Centrality selection + return false; + } + + if (col.ft0cOccupancyInTimeRange() < cMinOccupancy || col.ft0cOccupancyInTimeRange() > cMaxOccupancy) { // Occupancy cut + return false; + } + + if (cTriggerTvxSel && !col.selection_bit(aod::evsel::kIsTriggerTVX)) { // Time and Vertex trigger + return false; + } + + if (cTFBorder && !col.selection_bit(aod::evsel::kNoTimeFrameBorder)) { // Time frame border + return false; + } + + if (cNoItsROBorder && !col.selection_bit(aod::evsel::kNoITSROFrameBorder)) { // ITS Readout frame border + return false; + } + + if (cItsTpcVtx && !col.selection_bit(aod::evsel::kIsVertexITSTPC)) { // ITS+TPC Vertex + return false; + } + + if (cPileupReject && !col.selection_bit(aod::evsel::kNoSameBunchPileup)) { // Pile-up rejection + return false; + } + + if (cZVtxTimeDiff && !col.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { // ZvtxFT0 vs PV + return false; + } + + if (cIsGoodITSLayers && !col.selection_bit(aod::evsel::kIsGoodITSLayersAll)) { // All ITS layer active + return false; + } + + // Set Multiplicity + mult = col.multNTracksHasTPC(); + + return true; + } + + // Track Selection + template + bool selectTrack(T const& track) + { + if (track.pt() <= cTrackMinPt || track.pt() >= cTrackMaxPt || std::abs(track.eta()) >= cTrackEtaCut) { + return false; + } + + if (cTrackGlobal && !track.isGlobalTrackWoDCA()) { + return false; + } + + if (std::abs(track.dcaXY()) > cTrackDcaXYCut || std::abs(track.dcaZ()) > cTrackDcaZCut) { + return false; + } + + return true; + } + + template + std::vector getAvgCorrFactors(const C& ccdbObject, const F& corrType, const std::vector& vCollParam) + { + std::vector vAvgOutput = {0., 0., 0., 0.}; + std::vector> vHistNames = corrTypeHistNameMap.at(corrType); + int binarray[4]; + int cntrx = 0; + for (auto const& x : vHistNames) { + int cntry = 0; + for (auto const& y : x) { + TObject* obj = reinterpret_cast(ccdbObject->FindObject(y.c_str())); + if (corrType == kFineCorr) { + TProfile* hp = reinterpret_cast(obj->Clone()); + vAvgOutput[cntrx] += hp->GetBinContent(hp->GetXaxis()->FindBin(vCollParam[cntry])); + } else { + THnF* hn = reinterpret_cast(obj->Clone()); + for (int i = 0; i < static_cast(vHistNames.size()); ++i) { + binarray[i] = hn->GetAxis(i)->FindBin(vCollParam[i]); + } + vAvgOutput[cntrx] += hn->GetBinContent(hn->GetBin(binarray)); + } + ++cntry; + } + ++cntrx; + } + return vAvgOutput; + } + + void applyCorrection(const std::vector inputParam, const int& runNumber, std::vector& outputParam) + { + std::vector vCorrFlags = static_cast>(cCorrFlagVector); + int nitr = vCorrFlags.size(); + CorrectionType corrType = kFineCorr; + std::string ccdbPath; + + for (int i = 0; i < nitr; ++i) { + // Don't correct if corrFlag != 1 + if (vCorrFlags[i] != 1) { + continue; + } + + // Set correction type + if (i % kNCorr == 0) { + corrType = kCoarseCorr; + } else { + corrType = kFineCorr; + } + + // Set ccdb path + ccdbPath = static_cast(cCcdbPath) + "/CorrItr_" + std::to_string(i + 1) + "/Run" + std::to_string(runNumber); + + // Get object from CCDB + auto ccdbObj = ccdbService->getForTimeStamp(ccdbPath, -1); + + // Check CCDB Object + if (!ccdbObj) { + LOGF(warning, "CCDB OBJECT NOT FOUND"); + return; + } + + // Get averages + std::vector vAvg = getAvgCorrFactors(ccdbObj, corrType, inputParam); + + // Apply correction + outputParam[kXa] -= vAvg[kXa]; + outputParam[kYa] -= vAvg[kYa]; + outputParam[kXc] -= vAvg[kXc]; + outputParam[kYc] -= vAvg[kYc]; + } + } + + void fillCorrHist(const std::vector& vCollParam, const std::vector& vSP) + { + histos.fill(HIST("CorrHist/hWtXZNA"), vCollParam[kCent], vCollParam[kVx], vCollParam[kVy], vCollParam[kVz], vSP[kXa]); + histos.fill(HIST("CorrHist/hWtYZNA"), vCollParam[kCent], vCollParam[kVx], vCollParam[kVy], vCollParam[kVz], vSP[kYa]); + histos.fill(HIST("CorrHist/hWtXZNC"), vCollParam[kCent], vCollParam[kVx], vCollParam[kVy], vCollParam[kVz], vSP[kXc]); + histos.fill(HIST("CorrHist/hWtYZNC"), vCollParam[kCent], vCollParam[kVx], vCollParam[kVy], vCollParam[kVz], vSP[kYc]); + histos.fill(HIST("CorrHist/hUWtXZNA"), vCollParam[kCent], vCollParam[kVx], vCollParam[kVy], vCollParam[kVz]); + histos.fill(HIST("CorrHist/hUWtYZNA"), vCollParam[kCent], vCollParam[kVx], vCollParam[kVy], vCollParam[kVz]); + histos.fill(HIST("CorrHist/hUWtXZNC"), vCollParam[kCent], vCollParam[kVx], vCollParam[kVy], vCollParam[kVz]); + histos.fill(HIST("CorrHist/hUWtYZNC"), vCollParam[kCent], vCollParam[kVx], vCollParam[kVy], vCollParam[kVz]); + histos.fill(HIST("CorrHist/hXZNAVsCent"), vCollParam[kCent], vSP[kXa]); + histos.fill(HIST("CorrHist/hXZNAVsVx"), vCollParam[kVx], vSP[kXa]); + histos.fill(HIST("CorrHist/hXZNAVsVy"), vCollParam[kVy], vSP[kXa]); + histos.fill(HIST("CorrHist/hXZNAVsVz"), vCollParam[kVz], vSP[kXa]); + histos.fill(HIST("CorrHist/hYZNAVsCent"), vCollParam[kCent], vSP[kYa]); + histos.fill(HIST("CorrHist/hYZNAVsVx"), vCollParam[kVx], vSP[kYa]); + histos.fill(HIST("CorrHist/hYZNAVsVy"), vCollParam[kVy], vSP[kYa]); + histos.fill(HIST("CorrHist/hYZNAVsVz"), vCollParam[kVz], vSP[kYa]); + histos.fill(HIST("CorrHist/hXZNCVsCent"), vCollParam[kCent], vSP[kXc]); + histos.fill(HIST("CorrHist/hXZNCVsVx"), vCollParam[kVx], vSP[kXc]); + histos.fill(HIST("CorrHist/hXZNCVsVy"), vCollParam[kVy], vSP[kXc]); + histos.fill(HIST("CorrHist/hXZNCVsVz"), vCollParam[kVz], vSP[kXc]); + histos.fill(HIST("CorrHist/hYZNCVsCent"), vCollParam[kCent], vSP[kYc]); + histos.fill(HIST("CorrHist/hYZNCVsVx"), vCollParam[kVx], vSP[kYc]); + histos.fill(HIST("CorrHist/hYZNCVsVy"), vCollParam[kVy], vSP[kYc]); + histos.fill(HIST("CorrHist/hYZNCVsVz"), vCollParam[kVz], vSP[kYc]); + } + + template + void fillTrackHist(const T& track) + { + histos.fill(HIST("TrackQA/hPtDcaZ"), track.pt(), track.dcaZ()); + histos.fill(HIST("TrackQA/hPtDcaXY"), track.pt(), track.dcaXY()); + } + + using BCsRun3 = soa::Join; + using CollisionsRun3 = soa::Join; + using Tracks = soa::Join; + + void process(CollisionsRun3::iterator const& collision, BCsRun3 const& /* bcs*/, aod::Zdcs const&, Tracks const& tracks) + { + // Event selection + if (!selCollision(collision)) { + return; + } + posX = collision.posX(); + posY = collision.posY(); + posZ = collision.posZ(); + std::vector vCollParam = {cent, posX, posY, posZ}; + + histos.fill(HIST("Event/hCent"), cent); + histos.fill(HIST("Event/hVx"), posX); + histos.fill(HIST("Event/hVy"), posY); + histos.fill(HIST("Event/hVz"), posZ); + + // Get bunch crossing + auto bc = collision.foundBC_as(); + + // check zdc + if (!bc.has_zdc()) { + return; + } + + auto zdc = bc.zdc(); + auto znaEnergy = zdc.energySectorZNA(); + auto zncEnergy = zdc.energySectorZNC(); + auto znaEnergyCommon = zdc.energyCommonZNA(); + auto zncEnergyCommon = zdc.energyCommonZNC(); + + // check energy deposits + if (znaEnergyCommon <= 0 || zncEnergyCommon <= 0 || znaEnergy[0] <= 0 || znaEnergy[1] <= 0 || znaEnergy[2] <= 0 || znaEnergy[3] <= 0 || zncEnergy[0] <= 0 || zncEnergy[1] <= 0 || zncEnergy[2] <= 0 || zncEnergy[3] <= 0) { + return; + } + + // Fill QA histograms + histos.fill(HIST("QA/hZNASignalSector1"), znaEnergy[0]); + histos.fill(HIST("QA/hZNASignalSector2"), znaEnergy[1]); + histos.fill(HIST("QA/hZNASignalSector3"), znaEnergy[2]); + histos.fill(HIST("QA/hZNASignalSector4"), znaEnergy[3]); + histos.fill(HIST("QA/hZNCSignalSector1"), zncEnergy[0]); + histos.fill(HIST("QA/hZNCSignalSector2"), zncEnergy[1]); + histos.fill(HIST("QA/hZNCSignalSector3"), zncEnergy[2]); + histos.fill(HIST("QA/hZNCSignalSector4"), zncEnergy[3]); + + /*auto alphaZDC = 0.395;*/ + const double x[4] = {-1.75, 1.75, -1.75, 1.75}; + const double y[4] = {-1.75, -1.75, 1.75, 1.75}; + + // Calculate X and Y + float znaXSumNum = 0., znaXSumDnm = 0.; + float znaYSumNum = 0., znaYSumDnm = 0.; + float zncXSumNum = 0., zncXSumDnm = 0.; + float zncYSumNum = 0., zncYSumDnm = 0.; + + // Loop over zdc sectors + for (int i = 0; i < kXYAC; ++i) { + znaXSumNum += znaXWeigthEnergy[i] * znaEnergy[i] * x[i]; + znaYSumNum += znaYWeigthEnergy[i] * znaEnergy[i] * y[i]; + znaXSumDnm += znaXWeigthEnergy[i] * znaEnergy[i]; + znaYSumDnm += znaYWeigthEnergy[i] * znaEnergy[i]; + zncXSumNum += zncXWeigthEnergy[i] * zncEnergy[i] * x[i]; + zncYSumNum += zncYWeigthEnergy[i] * zncEnergy[i] * y[i]; + zncXSumDnm += zncXWeigthEnergy[i] * zncEnergy[i]; + zncYSumDnm += zncYWeigthEnergy[i] * zncEnergy[i]; + } + + // Get X and Y for A and C side ZNA + std::vector vSP = {0, 0, 0, 0}; + vSP[kXa] = znaXSumNum / znaXSumDnm; + vSP[kYa] = znaYSumNum / znaYSumDnm; + vSP[kXc] = zncXSumNum / zncXSumDnm; + vSP[kYc] = zncYSumNum / zncYSumDnm; + + // Do corrections + int runNumber = collision.foundBC_as().runNumber(); + applyCorrection(vCollParam, runNumber, vSP); + + // Fill X and Y histograms + fillCorrHist(vCollParam, vSP); + float psiA = std::atan2(vSP[kYa], vSP[kXa]); + float psiC = std::atan2(vSP[kYa], vSP[kXa]); + histos.fill(HIST("Checks/hXaXc"), cent, (vSP[kXa] * vSP[kXc])); + histos.fill(HIST("Checks/hYaYc"), cent, (vSP[kYa] * vSP[kYc])); + histos.fill(HIST("Checks/hPsiSPA"), cent, psiA); + histos.fill(HIST("Checks/hPsiSPC"), cent, psiC); + histos.fill(HIST("Checks/hCosPsiSPAC"), cent, std::cos(psiA - psiC)); + histos.fill(HIST("Checks/hSinPsiSPAC"), cent, std::sin(psiA - psiC)); + + // Directed flow + float qac = (vSP[kXa] * vSP[kXc]) + (vSP[kYa] * vSP[kYc]); + histos.fill(HIST("DF/hQaQc"), cent, qac); + + // Loop over tracks + float ux = 0., uy = 0., v1a = 0., v1c = 0.; + for (auto const& track : tracks) { + // Select track + if (!selectTrack(track)) { + continue; + } + + // Fill track QA + fillTrackHist(track); + + // Get directed flow + ux = std::cos(track.phi()); + uy = std::sin(track.phi()); + v1a = ux * vSP[kXa] + uy * vSP[kYa]; + v1c = ux * vSP[kXc] + uy * vSP[kYc]; + + // Fill histogram + if (track.sign() > 0) { + histos.fill(HIST("DF/hAQuPos"), cent, v1a, track.eta()); + histos.fill(HIST("DF/hCQuPos"), cent, v1c, track.eta()); + } else { + histos.fill(HIST("DF/hAQuNeg"), cent, v1a, track.eta()); + histos.fill(HIST("DF/hCQuNeg"), cent, v1c, track.eta()); + } + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} From f8da77fce263291691b539cded7c288082699c9c Mon Sep 17 00:00:00 2001 From: EmilGorm <50658075+EmilGorm@users.noreply.github.com> Date: Thu, 23 Oct 2025 20:34:03 +0200 Subject: [PATCH 873/986] [PWGCF] fix possible deref of nullptr error message (#13502) --- PWGCF/GenericFramework/Core/FlowContainer.cxx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/PWGCF/GenericFramework/Core/FlowContainer.cxx b/PWGCF/GenericFramework/Core/FlowContainer.cxx index 8a906ba2321..d938e0d81b9 100644 --- a/PWGCF/GenericFramework/Core/FlowContainer.cxx +++ b/PWGCF/GenericFramework/Core/FlowContainer.cxx @@ -11,6 +11,9 @@ #include "FlowContainer.h" +#include +#include + ClassImp(FlowContainer); FlowContainer::FlowContainer() : TNamed("", ""), @@ -462,9 +465,11 @@ TH1D* FlowContainer::GetHistCorrXXVsPt(const char* order, double lminmulti, doub TProfile* tpf = GetCorrXXVsPt(order, lminmulti, lmaxmulti); TH1D* rethist = ProfToHist(tpf); TProfile* refflow = GetRefFlowProfile(order, lminmulti, lmaxmulti); - refflow->RebinX(refflow->GetNbinsX()); - rethist->SetBinContent(0, refflow->GetBinContent(1)); - rethist->SetBinError(0, refflow->GetBinError(1)); + if (refflow) { + refflow->RebinX(refflow->GetNbinsX()); + rethist->SetBinContent(0, refflow->GetBinContent(1)); + rethist->SetBinError(0, refflow->GetBinError(1)); + } delete refflow; delete tpf; return rethist; @@ -916,7 +921,12 @@ TProfile* FlowContainer::GetRefFlowProfile(const char* order, double m1, double delete tempprof; } delete rhSubset; - retpf->RebinX(nBins); + if (!retpf) { + LOGF(error, "Reference flow profile is null"); + return nullptr; + } else { + retpf->RebinX(nBins); + } return retpf; }; From cbde812442b29df516e3e074ce0c99441c22f955 Mon Sep 17 00:00:00 2001 From: spucillo <93769017+spucillo@users.noreply.github.com> Date: Thu, 23 Oct 2025 23:00:17 +0200 Subject: [PATCH 874/986] [PWGLF] Fixing some configurables and variables in cascadeAnalysisLightIonsDerivedData.cxx task (#13516) Co-authored-by: ALICE Action Bot --- .../cascadeAnalysisLightIonsDerivedData.cxx | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx b/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx index f8eefa65f22..eebff2725ae 100644 --- a/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx +++ b/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx @@ -132,7 +132,7 @@ struct CascadeAnalysisLightIonsDerivedData { Configurable competingmassrej{"competingmassrej", 0.008, "Competing mass rejection"}; // Axes parameters ConfigurableAxis centEstimatorHistBin{"centEstimatorHistBin", {101, 0.0f, 101.0f}, ""}; - ConfigurableAxis centralityBinning{"centralityBinning", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, ""}; + ConfigurableAxis centralityBinning{"centralityBinning", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f}, ""}; ConfigurableAxis axisNch{"axisNch", {500, 0.0f, +5000.0f}, "Number of charged particles"}; ConfigurableAxis axisMult{"axisMult", {500, 0.0f, +100000.0f}, "Multiplicity"}; @@ -302,16 +302,16 @@ struct CascadeAnalysisLightIonsDerivedData { registryMC.add("h2dGenXiPlusVsMultMC_RecoedEvt", "h2dGenXiPlusVsMultMC_RecoedEvt", HistType::kTH2D, {axisNch, ptAxis}); registryMC.add("h2dGenXiMinusVsMultMC", "h2dGenXiMinusVsMultMC", HistType::kTH2D, {axisNch, ptAxis}); registryMC.add("h2dGenXiPlusVsMultMC", "h2dGenXiPlusVsMultMC", HistType::kTH2D, {axisNch, ptAxis}); - registryMC.add("h2dGenXiMinus", "h2dGenXiMinus", HistType::kTH2D, {{101, 0.0f, 101.0f}, ptAxis}); - registryMC.add("h2dGenXiPlus", "h2dGenXiPlus", HistType::kTH2D, {{101, 0.0f, 101.0f}, ptAxis}); + registryMC.add("h2dGenXiMinus", "h2dGenXiMinus", HistType::kTH2D, {centAxis, ptAxis}); + registryMC.add("h2dGenXiPlus", "h2dGenXiPlus", HistType::kTH2D, {centAxis, ptAxis}); // Histograms for omega (mc) registryMC.add("h2dGenOmegaMinusVsMultMC_RecoedEvt", "h2dGenOmegaMinusVsMultMC_RecoedEvt", HistType::kTH2D, {axisNch, ptAxis}); registryMC.add("h2dGenOmegaPlusVsMultMC_RecoedEvt", "h2dGenOmegaPlusVsMultMC_RecoedEvt", HistType::kTH2D, {axisNch, ptAxis}); registryMC.add("h2dGenOmegaMinusVsMultMC", "h2dGenOmegaMinusVsMultMC", HistType::kTH2D, {axisNch, ptAxis}); registryMC.add("h2dGenOmegaPlusVsMultMC", "h2dGenOmegaPlusVsMultMC", HistType::kTH2D, {axisNch, ptAxis}); - registryMC.add("h2dGenOmegaMinus", "h2dGenOmegaMinus", HistType::kTH2D, {{101, 0.0f, 101.0f}, ptAxis}); - registryMC.add("h2dGenOmegaPlus", "h2dGenOmegaPlus", HistType::kTH2D, {{101, 0.0f, 101.0f}, ptAxis}); + registryMC.add("h2dGenOmegaMinus", "h2dGenOmegaMinus", HistType::kTH2D, {centAxis, ptAxis}); + registryMC.add("h2dGenOmegaPlus", "h2dGenOmegaPlus", HistType::kTH2D, {centAxis, ptAxis}); // Histograms for event loss/splitting registryMC.add("hGenEvents", "hGenEvents", HistType::kTH2D, {{axisNch}, {2, -0.5f, +1.5f}}); @@ -662,7 +662,7 @@ struct CascadeAnalysisLightIonsDerivedData { bool atLeastOne = false; int biggestNContribs = -1; int nCollisions = 0; - float centralitydata = -1.0f; + float centralitydata = 100.5f; for (auto const& collision : groupedCollisions) { // event selections if (applySel8 && !collision.sel8()) @@ -741,8 +741,8 @@ struct CascadeAnalysisLightIonsDerivedData { initCCDB(collision); // Define the event centrality using different estimators - float centrality = -1.0f; - float multiplicity = -1.0f; + float centrality = -1; + float multiplicity = -1; if (centralityEstimator == Option::kFT0C) { centrality = collision.centFT0C(); @@ -885,8 +885,8 @@ struct CascadeAnalysisLightIonsDerivedData { initCCDB(RecCol); // Define the event centrality using different estimators - float centralityMcRec = -1.0f; - float multiplicityMcRec = -1.0f; + float centralityMcRec = -1; + float multiplicityMcRec = -1; if (centralityEstimator == Option::kFT0C) { centralityMcRec = RecCol.centFT0C(); From 2bfef6989ff59f0eb588051f78b53ce3265532cd Mon Sep 17 00:00:00 2001 From: alcaliva <32872606+alcaliva@users.noreply.github.com> Date: Fri, 24 Oct 2025 04:36:22 +0200 Subject: [PATCH 875/986] [PWGLF] Fix: use PreSlice for mcParticles instead of looping over all entries (#13517) --- PWGLF/Tasks/Nuspex/antinucleiInJets.cxx | 126 +++++++++++++++--------- 1 file changed, 78 insertions(+), 48 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx index 3103595c4de..2c7885f1292 100644 --- a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx +++ b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx @@ -85,6 +85,10 @@ using GenCollisionsMc = aod::McCollisions; using AntiNucleiTracks = soa::Join; using AntiNucleiTracksMc = soa::Join; +// Define preslices to group MC tracks and MC particles by their associated MC collision +Preslice mcTracksPerMcCollision = o2::aod::track::collisionId; +Preslice mcParticlesPerMcCollision = o2::aod::mcparticle::mcCollisionId; + struct AntinucleiInJets { // Histogram registries for data, MC, quality control, multiplicity and correlations @@ -1433,53 +1437,20 @@ struct AntinucleiInJets { PROCESS_SWITCH(AntinucleiInJets, processQC, "Process QC", false); // Antinuclei reconstruction efficiency - void processAntinucleiEfficiency(RecCollisionsMc const& collisions, AntiNucleiTracksMc const& mcTracks, aod::McParticles const& mcParticles) + void processAntinucleiEfficiency(GenCollisionsMc const& genCollisions, RecCollisionsMc const& recCollisions, AntiNucleiTracksMc const& mcTracks, aod::McParticles const& mcParticles) { - // Loop over all simulated collision events - for (const auto& collision : collisions) { - - // Count all generated events before applying any event selection criteria - registryMC.fill(HIST("number_of_events_mc_nuclei_efficiency"), 0.5); - - // Apply event selection: require sel8 and vertex position within the allowed z range - if (!collision.sel8() || std::fabs(collision.posZ()) > zVtx) - continue; - - // Count events that pass the selection criteria - registryMC.fill(HIST("number_of_events_mc_nuclei_efficiency"), 1.5); - - // Reject events near the ITS Read-Out Frame border - if (rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) - continue; - registryMC.fill(HIST("number_of_events_mc_nuclei_efficiency"), 2.5); - - // Reject events at the Time Frame border - if (rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) - continue; - registryMC.fill(HIST("number_of_events_mc_nuclei_efficiency"), 3.5); - - // Require at least one ITS-TPC matched track - if (requireVtxITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) - continue; - registryMC.fill(HIST("number_of_events_mc_nuclei_efficiency"), 4.5); - - // Reject events with same-bunch pileup - if (rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) - continue; - registryMC.fill(HIST("number_of_events_mc_nuclei_efficiency"), 5.5); + // Loop over generated collisions + for (const auto& collision : genCollisions) { - // Require consistent FT0 vs PV z-vertex - if (requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) + // Apply event selection: require vertex position to be within the allowed z range + if (std::fabs(collision.posZ()) > zVtx) continue; - registryMC.fill(HIST("number_of_events_mc_nuclei_efficiency"), 6.5); - // Require TOF match for at least one vertex track - if (requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) - continue; - registryMC.fill(HIST("number_of_events_mc_nuclei_efficiency"), 7.5); + // Get particles in this MC collision + const auto mcParticlesThisMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, collision.globalIndex()); // Loop over all generated Monte Carlo particles for the selected event - for (const auto& particle : mcParticles) { + for (const auto& particle : mcParticlesThisMcColl) { // Select primary particles if (!particle.isPhysicalPrimary()) @@ -1527,9 +1498,56 @@ struct AntinucleiInJets { break; } } + } + + // Loop over all reconstructed collisions + for (const auto& collision : recCollisions) { + + // Count all generated events before applying any event selection criteria + registryMC.fill(HIST("number_of_events_mc_nuclei_efficiency"), 0.5); + + // Apply event selection: require sel8 and vertex position within the allowed z range + if (!collision.sel8() || std::fabs(collision.posZ()) > zVtx) + continue; + + // Count events that pass the selection criteria + registryMC.fill(HIST("number_of_events_mc_nuclei_efficiency"), 1.5); + + // Reject events near the ITS Read-Out Frame border + if (rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) + continue; + registryMC.fill(HIST("number_of_events_mc_nuclei_efficiency"), 2.5); + + // Reject events at the Time Frame border + if (rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) + continue; + registryMC.fill(HIST("number_of_events_mc_nuclei_efficiency"), 3.5); + + // Require at least one ITS-TPC matched track + if (requireVtxITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) + continue; + registryMC.fill(HIST("number_of_events_mc_nuclei_efficiency"), 4.5); + + // Reject events with same-bunch pileup + if (rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) + continue; + registryMC.fill(HIST("number_of_events_mc_nuclei_efficiency"), 5.5); + + // Require consistent FT0 vs PV z-vertex + if (requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) + continue; + registryMC.fill(HIST("number_of_events_mc_nuclei_efficiency"), 6.5); + + // Require TOF match for at least one vertex track + if (requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) + continue; + registryMC.fill(HIST("number_of_events_mc_nuclei_efficiency"), 7.5); + + // Get tracks in this MC collision + const auto mcTracksThisMcColl = mcTracks.sliceBy(mcTracksPerMcCollision, collision.globalIndex()); // Loop over all reconstructed MC tracks - for (auto const& track : mcTracks) { + for (auto const& track : mcTracksThisMcColl) { // Apply standard track selection criteria if (!passedTrackSelection(track)) @@ -1762,8 +1780,11 @@ struct AntinucleiInJets { // Event counter: after event selection registryMC.fill(HIST("genEvents"), 1.5); + // Get particles in this MC collision + const auto mcParticlesThisMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, collision.globalIndex()); + // Loop over MC particles - for (const auto& particle : mcParticles) { + for (const auto& particle : mcParticlesThisMcColl) { // Select physical primary particles or HF decay products if (!isPhysicalPrimaryOrFromHF(particle, mcParticles)) @@ -1974,9 +1995,12 @@ struct AntinucleiInJets { continue; registryMC.fill(HIST("recEvents"), 7.5); + // Get tracks in this MC collision + const auto mcTracksThisMcColl = mcTracks.sliceBy(mcTracksPerMcCollision, collision.globalIndex()); + // Loop over reconstructed tracks int id(-1); - for (auto const& track : mcTracks) { + for (auto const& track : mcTracksThisMcColl) { id++; // Get corresponding MC particle @@ -2048,7 +2072,7 @@ struct AntinucleiInJets { for (const auto& particle : jetConstituents) { // Get corresponding track and apply track selection criteria - auto const& track = mcTracks.iteratorAt(particle.user_index()); + auto const& track = mcTracksThisMcColl.iteratorAt(particle.user_index()); if (!passedTrackSelection(track)) continue; @@ -2129,7 +2153,7 @@ struct AntinucleiInJets { for (auto const& index : antiprotonTrackIndex) { // retrieve track associated to index - auto const& track = mcTracks.iteratorAt(index); + auto const& track = mcTracksThisMcColl.iteratorAt(index); // Get corresponding MC particle if (!track.has_mcParticle()) @@ -2436,8 +2460,11 @@ struct AntinucleiInJets { if (std::fabs(collision.posZ()) > zVtx) continue; + // Get particles in this MC collision + const auto mcParticlesThisMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, collision.globalIndex()); + // Loop over all generated Monte Carlo particles for the selected event - for (const auto& particle : mcParticles) { + for (const auto& particle : mcParticlesThisMcColl) { // Select primary particles if (!particle.isPhysicalPrimary()) @@ -2493,8 +2520,11 @@ struct AntinucleiInJets { if (requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) continue; + // Get tracks in this MC collision + const auto mcTracksThisMcColl = mcTracks.sliceBy(mcTracksPerMcCollision, collision.globalIndex()); + // Loop over reconstructed tracks - for (auto const& track : mcTracks) { + for (auto const& track : mcTracksThisMcColl) { // Select only antimatter if (track.sign() > 0) From 7c3d72f98455d47d204769c7ed8def07344454f8 Mon Sep 17 00:00:00 2001 From: yakparo Date: Fri, 24 Oct 2025 09:43:49 +0200 Subject: [PATCH 876/986] [PWGLF] Expand strangeness tracking task for MC (#13520) Co-authored-by: Yakiv <5348341@upjs.sk> --- PWGLF/Tasks/Strangeness/strangecasctrack.cxx | 569 ++++++++++++++++--- 1 file changed, 475 insertions(+), 94 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/strangecasctrack.cxx b/PWGLF/Tasks/Strangeness/strangecasctrack.cxx index acce86c5847..609537fcf36 100644 --- a/PWGLF/Tasks/Strangeness/strangecasctrack.cxx +++ b/PWGLF/Tasks/Strangeness/strangecasctrack.cxx @@ -13,112 +13,147 @@ /// \brief Analysis of strangeness tracking efficiency via primary production of Omega and Xi in Run 3 /// \author Yakiv Paroviak (yakiv.paroviak@cern.ch) +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" #include "PWGLF/DataModel/LFStrangenessTables.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "CCDB/BasicCCDBManager.h" #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/StaticFor.h" #include "Framework/runDataProcessing.h" +#include + +#include "TF1.h" +#include "TF2.h" +#include + +#include +#include using namespace o2; +using namespace o2::constants::math; using namespace o2::framework; using namespace o2::framework::expressions; -using namespace o2::constants::math; + +// tables for derived data +using DerCollisionWMult = soa::Join::iterator; +using DerCascDatas = soa::Join; +using DerTraCascDatas = soa::Join; + +// tables for derived MC +using DerMCGenCascades = soa::Join; +using DerMCRecCollision = soa::Join::iterator; +using DerMCRecCascDatas = soa::Join; +using DerMCRecTraCascDatas = soa::Join; + +// tables for PID selection +using DauTracks = soa::Join; struct StrangeCascTrack { - using TraCascDatas = soa::Join; - using CascDatas = soa::Join; + Service ccdb; + Service pdgDB; + + PresliceUnsorted> perMcCollision = aod::v0data::straMCCollisionId; HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + // subprocess switches: Configurable doProcessPP{"doProcessPP", true, "true for pp, false for PbPb and OO"}; - Configurable doProcessPbPb{"doProcessPbPb", false, "true for PbPb, false for pp and OO"}; - Configurable doProcessOO{"doProcessOO", false, "true for OO, false for pp and PbPb"}; - - Configurable doProcessMC{"doProcessMC", false, "true for MC, false for data"}; + // selections + Configurable doApplyCuts{"doApplyCuts", true, "apply cuts"}; // dca for filtering data primaries + Configurable doApplyTPCPID{"doApplyTPCPID", true, "apply tpc pid to dau tracks"}; + Configurable doApplyTOFPID{"doApplyTOFPID", true, "apply tof pid to dau tracks"}; + Configurable doCompetingMassRej{"doCompetingMassRej", true, "competing mass rejection for omegas"}; + // corrections + Configurable doApplyEfficiency{"doApplyEfficiency", false, "apply efficiency correction"}; + Configurable doPropagateEfficiency{"doPropagateEfficiency", false, "apply efficiency propagation"}; + Configurable doApplyPurity{"doApplyPurity", false, "apply purity correction"}; + Configurable doPropagatePurity{"doPropagatePurity", false, "apply purity propagation"}; + Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository to use"}; + Configurable efficiencyCCDBPath{"efficiencyCCDBPath", "GLO/Config/GeometryAligned", "Path of the efficiency corrections"}; + // mc settings + Configurable doFillTruth{"doFillTruth", false, "require MC truth for reco"}; - Configurable doRequireFT0{"doRequireFT0", false, "true for offline trigger for Run 3"}; - Configurable doApplyPID{"doApplyPID", false, "true for offline trigger for Run 3"}; - Configurable doApplyCuts{"doApplyCuts", true, "true for offline trigger for Run 3"}; + // event and dau track selection + struct : ConfigurableGroup { + Configurable cutDCAtoPVxy{"cutDCAtoPVxy", 0.02f, "max cascade dca to PV in xy"}; + Configurable cutDCAtoPVz{"cutDCAtoPVz", 0.02f, "max cascade dca to PV in z"}; + Configurable compMassRej{"compMassRej", 0.008, "Competing mass rejection"}; + // TPC PID selection + Configurable NSigmaTPCPion{"NSigmaTPCPion", 4, "NSigmaTPCPion"}; + Configurable NSigmaTPCKaon{"NSigmaTPCKaon", 4, "NSigmaTPCKaon"}; + Configurable NSigmaTPCProton{"NSigmaTPCProton", 4, "NSigmaTPCProton"}; + // TOF PID selection + Configurable NSigmaTOFPion{"NSigmaTOFPion", 3, "NSigmaTOFPion"}; + Configurable NSigmaTOFKaon{"NSigmaTOFKaon", 3, "NSigmaTOFKaon"}; + Configurable NSigmaTOFProton{"NSigmaTOFProton", 3, "NSigmaTOFProton"}; + } selCuts; - ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 10.0}, "p_{T} (GeV/c)"}; - ConfigurableAxis axisMult{"axisMult", {VARIABLE_WIDTH, 0.0f, 0.01f, 1.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 70.0f, 100.0f}, "Multiplicity"}; - ConfigurableAxis axisOmegaMass{"axisOmegaMass", {2000, 1.6, 1.8}, "#Omega M_{inv} (GeV/c^{2})"}; - ConfigurableAxis axisXiMass{"axisXiMass", {2000, 1.2, 1.4}, "#Xi M_{inv} (GeV/c^{2})"}; + // axes + struct : ConfigurableGroup { + ConfigurableAxis axisPhi{"Phi", {72, 0, TwoPI}, "#phi"}; + ConfigurableAxis axisEta{"Eta", {102, -2.01, 2.01}, "#eta"}; + ConfigurableAxis axisDCAxy{"DCA to xy plane", {500, 0., 0.5}, "cm"}; + ConfigurableAxis axisDCAz{"DCA to z plane", {500, 0., 0.5}, "cm"}; + ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 10.0}, "p_{T} (GeV/c)"}; + ConfigurableAxis axisMult{"axisMult", {VARIABLE_WIDTH, 0.0f, 0.01f, 1.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 70.0f, 100.0f}, "FT0 mult %"}; + ConfigurableAxis axisOmegaMass{"axisOmegaMass", {2000, 1.6, 1.8}, "#Omega M_{inv} (GeV/c^{2})"}; + ConfigurableAxis axisXiMass{"axisXiMass", {2000, 1.2, 1.4}, "#Xi M_{inv} (GeV/c^{2})"}; + } axesConfig; - Configurable CutDCAtoPVxy{"CutDCAtoPVxy", 0.02f, "max cascade dca to PV in xy"}; - Configurable CutDCAtoPVz{"CutDCAtoPVz", 0.02f, "max cascade dca to PV in z"}; + // // Filters events + // if (doFilterEvents) { + // Filter eventFilter = (o2::aod::evsel::sel8 == true); + // Filter posZFilter = (nabs(o2::aod::collision::posZ) < cutzvertex); + // Filter posZFilterMC = (nabs(o2::aod::mccollision::posZ) < cutzvertex); + // } - void init(InitContext const&) - { - histos.add("Events/EvCounter", "Event Counter", kTH1F, {{1, 0, 1}}); - histos.add("Events/PVx", "PV x position", kTH1F, {{200, -0.1, 0.1}}); - histos.add("Events/PVy", "PV y position", kTH1F, {{200, -0.1, 0.1}}); - histos.add("Events/PVz", "PV z position", kTH1F, {{100, -20, 20}}); - histos.add("Events/Mult", "Multiplicity", kTH1F, {axisMult}); - - histos.add("Tracked/Phi", "Phi", kTH1F, {{100, 0., 2 * M_PI}}); - histos.add("Tracked/Eta", "Eta", kTH1F, {{102, -2.01, 2.01}}); - histos.add("Tracked/DCAxy", "DCA to xy", kTH1F, {{500, 0., 0.5}}); - histos.add("Tracked/DCAz", "DCA to z", kTH1F, {{500, 0., 0.5}}); - histos.add("Tracked/EvMult", "Multiplicity of events with >=1 cascade", kTH1F, {axisMult}); - histos.add("Tracked/MassOmega", "Invariant mass hypothesis", kTH1F, {axisOmegaMass}); - histos.add("Tracked/MassXi", "Invariant mass hypothesis", kTH1F, {axisXiMass}); - histos.add("Tracked/Omega", "", kTHnD, {axisOmegaMass, axisPt, axisMult}); - histos.add("Tracked/Xi", "", kTHnD, {axisXiMass, axisPt, axisMult}); - - histos.add("All/Phi", "Phi", kTH1F, {{100, 0., 2 * M_PI}}); - histos.add("All/Eta", "Eta", kTH1F, {{102, -2.01, 2.01}}); - histos.add("All/DCAxy", "DCA to xy", kTH1F, {{1000, 0, 1.}}); - histos.add("All/DCAz", "DCA to z", kTH1F, {{1000, 0, 1.}}); - histos.add("All/EvMult", "Multiplicity of events with >=1 cascade", kTH1F, {axisMult}); - histos.add("All/MassOmega", "Invariant mass hypothesis", kTH1F, {axisOmegaMass}); - histos.add("All/MassXi", "Invariant mass hypothesis", kTH1F, {axisXiMass}); - histos.add("All/Omega", "", kTHnD, {axisOmegaMass, axisPt, axisMult}); - histos.add("All/Xi", "", kTHnD, {axisXiMass, axisPt, axisMult}); - } + // cascade reconstruction types + static constexpr std::string_view kTypeNames[] = {"Standard", "Tracked"}; - void processTracked(soa::Join::iterator const& collision, - aod::TraCascDatas const& tracascades) + // for efficiency and purity corrections + TH2F* hEfficiency; + TH2F* hEfficiencyUncertainty; + TH2F* hPurity; + TH2F* hPurityUncertainty; + int mRunNumber; + // loads efficiencies and purities + void initEfficiencyFromCCDB(int64_t runNumber, int64_t timestamp) { - double mult = doProcessPP ? collision.centFT0M() : collision.centFT0C(); - int64_t casccollid = 0; - for (auto const& cascade : tracascades) { - - double dcaxy = cascade.dcaXYCascToPV(); - double dcaz = cascade.dcaZCascToPV(); - if (doApplyCuts && ((dcaxy > CutDCAtoPVxy) || (dcaz > CutDCAtoPVz))) - continue; // DCA check - - if (collision.index() != casccollid) { - histos.fill(HIST("Tracked/EvMult"), mult); // count and list mult of events with at least one cascade - casccollid = collision.index(); - } + if (mRunNumber == runNumber) { + return; + } + mRunNumber = runNumber; + LOG(info) << "Loading efficiencies and purities from CCDB for run " << mRunNumber << " now..."; + auto timeStamp = timestamp; - double pt = cascade.pt(); - double phi = cascade.phi(); - double eta = cascade.eta(); - double massXi = cascade.mXi(); - double massOmega = cascade.mOmega(); + TList* listEfficiencies = ccdb->getForTimeStamp(efficiencyCCDBPath, timeStamp); - histos.fill(HIST("Tracked/DCAxy"), dcaxy); - histos.fill(HIST("Tracked/DCAz"), dcaz); - histos.fill(HIST("Tracked/Phi"), phi); - histos.fill(HIST("Tracked/Eta"), eta); - histos.fill(HIST("Tracked/MassXi"), massXi); - histos.fill(HIST("Tracked/MassOmega"), massOmega); - histos.fill(HIST("Tracked/Xi"), massXi, pt, mult); - histos.fill(HIST("Tracked/Omega"), massOmega, pt, mult); + if (!listEfficiencies) { + LOG(fatal) << "Problem getting TList object with efficiencies and purities!"; } - } - void processAll(soa::Join::iterator const& collision, - aod::CascDatas const& cascades) + hEfficiency = static_cast(listEfficiencies->FindObject("hEfficiency")); + hPurity = static_cast(listEfficiencies->FindObject("hPurity")); + hEfficiencyUncertainty = static_cast(listEfficiencies->FindObject("hEfficiencyUncertainty")); + hPurityUncertainty = static_cast(listEfficiencies->FindObject("hPurityUncertainty")); + if (doPropagateEfficiency && !hEfficiencyUncertainty) + LOG(fatal) << "Problem getting hEfficiencyUncertainty!"; + if (doPropagatePurity && !hPurityUncertainty) + LOG(fatal) << "Problem getting hPurityUncertainty!"; + LOG(info) << "Efficiencies and purities now loaded for " << mRunNumber; + } + // general info about processed events + template + void fillEvents(TEvent const& collision) { histos.fill(HIST("Events/EvCounter"), 0.5); double mult = doProcessPP ? collision.centFT0M() : collision.centFT0C(); @@ -129,38 +164,384 @@ struct StrangeCascTrack { histos.fill(HIST("Events/PVx"), pvx); histos.fill(HIST("Events/PVy"), pvy); histos.fill(HIST("Events/PVz"), pvz); - + } + // checks general selection criteria + template + bool isValidCasc(TCascade cascade) + { + if (cascade.dcaXYCascToPV() > selCuts.cutDCAtoPVxy) + return false; + if (cascade.dcaZCascToPV() > selCuts.cutDCAtoPVz) + return false; + return true; + } + // checks TPC PID of dau tracks + template + bool passesTPC(TCascade cascade) + { + const auto& posDaughterTrackCasc = cascade.template posTrackExtra_as(); + const auto& negDaughterTrackCasc = cascade.template negTrackExtra_as(); + if (cascade.sign() < 0) { + if (std::abs(posDaughterTrackCasc.tpcNSigmaPr()) > selCuts.NSigmaTPCProton) { + return false; + } + if (std::abs(negDaughterTrackCasc.tpcNSigmaPi()) > selCuts.NSigmaTPCPion) { + return false; + } + } else { + if (std::abs(negDaughterTrackCasc.tpcNSigmaPr()) > selCuts.NSigmaTPCProton) { + return false; + } + if (std::abs(posDaughterTrackCasc.tpcNSigmaPi()) > selCuts.NSigmaTPCPion) { + return false; + } + } + return true; + } + // checks TOF PID of dau tracks + // template + // bool passesTOF(TCascade cascade, TString particle) + // { + // return true; + // // const auto& bachDaughterTrackCasc = cascade.bachTrackExtra_as(); + // // const auto& posDaughterTrackCasc = cascade.posTrackExtra_as(); + // // const auto& negDaughterTrackCasc = cascade.negTrackExtra_as(); + // // bool xiPassTOFSelection = true; + // // bool omegaPassTOFSelection = true; + // // if (cascade.sign() < 0) { + // // if (posDaughterTrackCasc.hasTOF()) { + // // if (std::abs(cascade.tofNSigmaXiLaPr()) > selCuts.NSigmaTOFProton) { + // // xiPassTOFSelection &= false; + // // } + // // if (std::abs(cascade.tofNSigmaOmLaPr()) > selCuts.NSigmaTOFProton) { + // // omegaPassTOFSelection &= false; + // // } + // // } + // // if (negDaughterTrackCasc.hasTOF()) { + // // if (std::abs(cascade.tofNSigmaXiLaPi()) > selCuts.NSigmaTOFPion) { + // // xiPassTOFSelection &= false; + // // } + // // if (std::abs(cascade.tofNSigmaOmLaPi()) > selCuts.NSigmaTOFPion) { + // // omegaPassTOFSelection &= false; + // // } + // // } + // // } else { + // // if (posDaughterTrackCasc.hasTOF()) { + // // if (std::abs(cascade.tofNSigmaXiLaPi()) > selCuts.NSigmaTOFPion) { + // // xiPassTOFSelection &= false; + // // } + // // if (std::abs(cascade.tofNSigmaOmLaPi()) > selCuts.NSigmaTOFPion) { + // // omegaPassTOFSelection &= false; + // // } + // // } + // // if (negDaughterTrackCasc.hasTOF()) { + // // if (std::abs(cascade.tofNSigmaXiLaPr()) > selCuts.NSigmaTOFProton) { + // // xiPassTOFSelection &= false; + // // } + // // if (std::abs(cascade.tofNSigmaOmLaPr()) > selCuts.NSigmaTOFProton) { + // // omegaPassTOFSelection &= false; + // // } + // // } + // // } + // + // // if (bachDaughterTrackCasc.hasTOF()) { + // // if (std::abs(cascade.tofNSigmaXiPi()) > selCuts.NSigmaTOFPion) { + // // xiPassTOFSelection &= false; + // // } + // // if (std::abs(cascade.tofNSigmaOmKa()) > selCuts.NSigmaTOFKaon) { + // // omegaPassTOFSelection &= false; + // // } + // // } + // + // // if (bachDaughterTrackCasc.hasTOF()) { + // // if (std::abs(cascade.tofNSigmaXiPi()) > selCuts.NSigmaTOFPion) { + // // xiPassTOFSelection &= false; + // // } + // // if (std::abs(cascade.tofNSigmaOmKa()) > selCuts.NSigmaTOFKaon) { + // // omegaPassTOFSelection &= false; + // // } + // // } + // + // // if (particle == "xi") {return xiPassTOFSelection;} else {return omegaPassTOFSelection;} + // } + // checks whether gen cascade corresponds to PDG code + template + bool isValidPDG(TCascade cascade, TString particle) + { + static constexpr int kPdgCodes[] = {3312, 3334}; // "XiMinus", "OmegaMinus" + if (particle == "xi" && std::abs(cascade.pdgCode()) == kPdgCodes[0]) + return true; + if (particle == "omega" && std::abs(cascade.pdgCode()) == kPdgCodes[1]) + return true; + return false; + } + // checks whether rec cascade is a truth primary xi or omega + template + bool isMCTruth(const TCascade& cascade, TString particle) + { + if constexpr (requires { cascade.has_cascMCCore(); }) { // safety check: discard rec cascade without gen reference + auto cascmccore = cascade.template cascMCCore_as(); + if (!cascmccore.isPhysicalPrimary()) + return false; + int pdg = std::abs(cascmccore.pdgCode()); + if (particle == "xi") + return (pdg == 3312); + if (particle == "omega") + return (pdg == 3334); + } + return false; + } + // applies purities and efficiencies + void fillHist(std::shared_ptr hist, double binFillThn[], float efficiency, float effUncert, float purity, float purityUncert) + { + float previousContent, previousError2, currentContent, currentError2; + int bin = hist->GetBin(binFillThn); + previousContent = hist->GetBinContent(bin); + previousError2 = hist->GetBinError2(bin); + currentContent = previousContent + purity / (efficiency); + currentError2 = previousError2 + std::pow(purity / (efficiency), 2) + std::pow(purityUncert / (efficiency), 2) + std::pow(effUncert * purity, 2) / std::pow(efficiency, 4); + hist->SetBinContent(bin, currentContent); + hist->SetBinError2(bin, currentError2); + } + // applies selections and fills histograms + template + void analyseCascs(TEvent collision, TCascs cascades) + { int64_t casccollid = 0; for (auto const& cascade : cascades) { - double dcaxy = cascade.dcaXYCascToPV(); - double dcaz = cascade.dcaZCascToPV(); - if (doApplyCuts && ((dcaxy > CutDCAtoPVxy) || (dcaz > CutDCAtoPVz))) - continue; // DCA check + if constexpr (requires { cascade.topologyChi2(); }) { + if (!cascade.has_standardCascade()) + continue; // safety check: dismisses tracked cascades without proper reference + } + + // for tracked cascades, make a reference to standard table + auto stdCasc = [&]() { + if constexpr (requires { cascade.topologyChi2(); }) { + if constexpr (requires { collision.straMCCollisionId(); }) { + return cascade.template standardCascade_as(); + } else { + return cascade.template standardCascade_as(); + } + } else { + return cascade; + } + }(); + + // fill cascade statistics without any selections + static constexpr int type = [&]() { + if constexpr (requires { cascade.topologyChi2(); }) { + return 1; + } else { + return 0; + } + }(); + + double mult = doProcessPP ? collision.centFT0M() : collision.centFT0C(); // ion collisions use FT0C for multiplicity, pp uses both + + float efficiency = 1.0f; + float efficiencyError = 0.0f; + float purity = 1.0f; + float purityError = 0.0f; + if (doApplyEfficiency) { + efficiency = hEfficiency->Interpolate(cascade.pt(), mult); + if (doPropagateEfficiency) { + efficiencyError = hEfficiencyUncertainty->Interpolate(cascade.pt(), mult); + } + if (efficiency == 0) { // check for zero efficiency, do not apply if the case + efficiency = 1.; + efficiencyError = 0.; + } + } + if (doApplyPurity) { + purity = hPurity->Interpolate(cascade.pt(), mult); + if (doPropagatePurity) { + purityError = hPurityUncertainty->Interpolate(cascade.pt(), mult); + } + if (purity == 0) { // check for zero purity, do not apply if the case + purity = 1.; + purityError = 0.; + } + } if (collision.index() != casccollid) { - histos.fill(HIST("All/EvMult"), mult); // count and list mult of events with at least one cascade + histos.fill(HIST(kTypeNames[type]) + HIST("/EvMult"), mult); casccollid = collision.index(); } - double pt = cascade.pt(); - double phi = cascade.phi(); - double eta = cascade.eta(); double massXi = cascade.mXi(); double massOmega = cascade.mOmega(); + double pt = cascade.pt(); - histos.fill(HIST("All/DCAxy"), dcaxy); - histos.fill(HIST("All/DCAz"), dcaz); - histos.fill(HIST("All/Phi"), phi); - histos.fill(HIST("All/Eta"), eta); - histos.fill(HIST("All/MassXi"), massXi); - histos.fill(HIST("All/MassOmega"), massOmega); - histos.fill(HIST("All/Xi"), massXi, pt, mult); - histos.fill(HIST("All/Omega"), massOmega, pt, mult); + histos.fill(HIST(kTypeNames[type]) + HIST("/DCAxy"), cascade.dcaXYCascToPV()); + histos.fill(HIST(kTypeNames[type]) + HIST("/DCAz"), cascade.dcaZCascToPV()); + histos.fill(HIST(kTypeNames[type]) + HIST("/Phi"), cascade.phi()); + histos.fill(HIST(kTypeNames[type]) + HIST("/Eta"), cascade.eta()); + histos.fill(HIST(kTypeNames[type]) + HIST("/MassXiNoSel"), massXi); + histos.fill(HIST(kTypeNames[type]) + HIST("/MassOmegaNoSel"), massOmega); + + // start checking selections + bool passedAllSels = true; + // apply general selection criteria + if (doApplyCuts) { + if (isValidCasc(cascade)) { + histos.fill(HIST(kTypeNames[type]) + HIST("/MassXiGenSel"), massXi); + histos.fill(HIST(kTypeNames[type]) + HIST("/MassOmegaGenSel"), massOmega); + } else { + passedAllSels = false; + } + } + // apply tpc pid + if (doApplyTPCPID) { + if (passesTPC(stdCasc)) { + histos.fill(HIST(kTypeNames[type]) + HIST("/MassXiTPCPID"), massXi); + histos.fill(HIST(kTypeNames[type]) + HIST("/MassOmegaTPCPID"), massOmega); + } else { + passedAllSels = false; + } + } + // apply tof pid + bool passedAllSelsXi = passedAllSels; + bool passedAllSelsOmega = passedAllSels; + // if (doApplyTOFPID) { + // if (passesTOF(cascade, "xi")) { + // histos.fill(HIST(kTypeNames[type]) + HIST("/MassXiTOFPID"), massXi); + // } else { + // passedAllSelsXi = false; + // } + // if (passesTOF(cascade, "omega")) { + // histos.fill(HIST(kTypeNames[type]) + HIST("/MassOmegaTOFPID"), massOmega); + // } else { + // passedAllSelsOmega = false; + // } + // } + // apply competing mass rej + if (doCompetingMassRej) { + if (std::abs(massXi - pdgDB->Mass(3312)) > selCuts.compMassRej) { + histos.fill(HIST(kTypeNames[type]) + HIST("/MassOmegaMassSel"), massOmega); + } else { + passedAllSelsOmega = false; + } + } + + // fill w/ cascs that passed all applied sels + double binFillXi[3] = {massXi, pt, mult}; + if (passedAllSelsXi) { + histos.fill(HIST(kTypeNames[type]) + HIST("/MassXi"), massXi); + fillHist(histos.get(HIST(kTypeNames[type]) + HIST("/Xi")), binFillXi, efficiency, efficiencyError, purity, purityError); + if constexpr (requires { collision.straMCCollisionId(); }) { + if (doFillTruth && isMCTruth(stdCasc, "xi")) + histos.fill(HIST("MC/RecTruth/") + HIST(kTypeNames[type]) + HIST("/Xi"), massXi, pt, mult); + } + } + double binFillOmega[3] = {massOmega, pt, mult}; + if (passedAllSelsOmega) { + histos.fill(HIST(kTypeNames[type]) + HIST("/MassOmega"), massOmega); + fillHist(histos.get(HIST(kTypeNames[type]) + HIST("/Omega")), binFillOmega, efficiency, efficiencyError, purity, purityError); + if constexpr (requires { collision.straMCCollisionId(); }) { + if (doFillTruth && isMCTruth(stdCasc, "omega")) + histos.fill(HIST("MC/RecTruth/") + HIST(kTypeNames[type]) + HIST("/Omega"), massOmega, pt, mult); + } + } } } - PROCESS_SWITCH(StrangeCascTrack, processTracked, "process tracked cascades", true); - PROCESS_SWITCH(StrangeCascTrack, processAll, "process all cascades", true); + + void init(InitContext const&) + { + // for all events processing + histos.add("Events/EvCounter", "Event Counter", kTH1F, {{1, 0, 1}}); + histos.add("Events/PVx", "PV x position", kTH1F, {{200, -0.1, 0.1}}); + histos.add("Events/PVy", "PV y position", kTH1F, {{200, -0.1, 0.1}}); + histos.add("Events/PVz", "PV z position", kTH1F, {{100, -20, 20}}); + histos.add("Events/Mult", "Multiplicity", kTH1F, {axesConfig.axisMult}); + // for cascade processing + static_for<0, 1>([&](auto type) { + histos.add(Form("%s/Phi", kTypeNames[type].data()), "Phi", kTH1F, {axesConfig.axisPhi}); + histos.add(Form("%s/Eta", kTypeNames[type].data()), "Eta", kTH1F, {axesConfig.axisEta}); + histos.add(Form("%s/DCAxy", kTypeNames[type].data()), "DCA to xy", kTH1F, {axesConfig.axisDCAxy}); + histos.add(Form("%s/DCAz", kTypeNames[type].data()), "DCA to z", kTH1F, {axesConfig.axisDCAz}); + histos.add(Form("%s/EvMult", kTypeNames[type].data()), "Multiplicity of events with >=1 cascade", kTH1F, {axesConfig.axisMult}); + // no selection applied + histos.add(Form("%s/MassOmegaNoSel", kTypeNames[type].data()), "Invariant mass hypothesis", kTH1F, {axesConfig.axisOmegaMass}); + histos.add(Form("%s/MassXiNoSel", kTypeNames[type].data()), "Invariant mass hypothesis", kTH1F, {axesConfig.axisXiMass}); + // only gen selection applied + histos.add(Form("%s/MassOmegaGenSel", kTypeNames[type].data()), "Invariant mass hypothesis", kTH1F, {axesConfig.axisOmegaMass}); + histos.add(Form("%s/MassXiGenSel", kTypeNames[type].data()), "Invariant mass hypothesis", kTH1F, {axesConfig.axisXiMass}); + // only tpc pid selection applied + histos.add(Form("%s/MassOmegaTPCPID", kTypeNames[type].data()), "Invariant mass hypothesis", kTH1F, {axesConfig.axisOmegaMass}); + histos.add(Form("%s/MassXiTPCPID", kTypeNames[type].data()), "Invariant mass hypothesis", kTH1F, {axesConfig.axisXiMass}); + // only tof pid selection applied + histos.add(Form("%s/MassOmegaTOFPID", kTypeNames[type].data()), "Invariant mass hypothesis", kTH1F, {axesConfig.axisOmegaMass}); + histos.add(Form("%s/MassXiTOFPID", kTypeNames[type].data()), "Invariant mass hypothesis", kTH1F, {axesConfig.axisXiMass}); + // only competing mass rejection selection applied + histos.add(Form("%s/MassOmegaMassSel", kTypeNames[type].data()), "Invariant mass hypothesis", kTH1F, {axesConfig.axisOmegaMass}); + // passed all applied sels + histos.add(Form("%s/MassOmega", kTypeNames[type].data()), "Invariant mass hypothesis", kTH1F, {axesConfig.axisOmegaMass}); + histos.add(Form("%s/MassXi", kTypeNames[type].data()), "Invariant mass hypothesis", kTH1F, {axesConfig.axisXiMass}); + histos.add(Form("%s/Omega", kTypeNames[type].data()), "", kTHnD, {axesConfig.axisOmegaMass, axesConfig.axisPt, axesConfig.axisMult}); + histos.add(Form("%s/Xi", kTypeNames[type].data()), "", kTHnD, {axesConfig.axisXiMass, axesConfig.axisPt, axesConfig.axisMult}); + }); + // for MC-specific processing + histos.add("MC/Gen/EvCounter", "Event Counter", kTH1F, {{1, 0, 1}}); + histos.add("MC/Gen/Xi", "Xi", kTH2F, {axesConfig.axisPt, axesConfig.axisMult}); // generated primary Xis + histos.add("MC/Gen/Omega", "Omega", kTH2F, {axesConfig.axisPt, axesConfig.axisMult}); // generated primary Omegas + histos.add("MC/Rec/EvCounter", "Event Counter", kTH1F, {{1, 0, 1}}); + histos.add("MC/Rec/EvMult", "Multiplicity", kTH1F, {axesConfig.axisMult}); + histos.add("MC/RecTruth/Standard/Omega", "", kTHnD, {axesConfig.axisOmegaMass, axesConfig.axisPt, axesConfig.axisMult}); + histos.add("MC/RecTruth/Standard/Xi", "", kTHnD, {axesConfig.axisXiMass, axesConfig.axisPt, axesConfig.axisMult}); + histos.add("MC/RecTruth/Tracked/Omega", "", kTHnD, {axesConfig.axisOmegaMass, axesConfig.axisPt, axesConfig.axisMult}); + histos.add("MC/RecTruth/Tracked/Xi", "", kTHnD, {axesConfig.axisXiMass, axesConfig.axisPt, axesConfig.axisMult}); + } + + void processDerivedData(DerCollisionWMult const& collision, DerCascDatas const& allCascs, DerTraCascDatas const& traCascs, DauTracks const&) + { + fillEvents(collision); // save info about all processed events + if (doApplyEfficiency) { + initEfficiencyFromCCDB(collision.runNumber(), collision.timestamp()); + } + analyseCascs(collision, allCascs); // process all cascades + analyseCascs(collision, traCascs); // process tracked cascades + } + + void processDerivedMCGen(aod::StraMCCollisions const& genColls, DerMCGenCascades const& genCascs, soa::Join const& recColls) + { + for (auto const& genColl : genColls) { + histos.fill(HIST("MC/Gen/EvCounter"), 0.5); // generated events statistics + // (for efficiency calculation) only take reconstructed events + auto slicedRecColls = recColls.sliceBy(perMcCollision, genColl.globalIndex()); + for (auto const& recColl : slicedRecColls) { + histos.fill(HIST("MC/Rec/EvCounter"), 0.5); + double casc_mult = doProcessPP ? recColl.centFT0M() : recColl.centFT0C(); + histos.fill(HIST("MC/Rec/EvMult"), casc_mult); + int64_t genCollId = recColl.straMCCollisionId(); + for (auto const& casc : genCascs) { + if (casc.straMCCollisionId() != genCollId) + continue; // safety check + if (!casc.isPhysicalPrimary()) + continue; // skip non-primary particles + double casc_pt = std::sqrt(std::pow(casc.pxMC(), 2) + std::pow(casc.pyMC(), 2)); + if (isValidPDG(casc, "xi")) + histos.fill(HIST("MC/Gen/Xi"), casc_pt, casc_mult); + if (isValidPDG(casc, "omega")) + histos.fill(HIST("MC/Gen/Omega"), casc_pt, casc_mult); + } + } + } + } + + void processDerivedMCRec(DerMCRecCollision const& collision, DerMCRecCascDatas const& allCascs, DerMCRecTraCascDatas const& traCascs, DauTracks const&, DerMCGenCascades const&) + { + fillEvents(collision); // save info about all processed events + if (doApplyEfficiency) { + initEfficiencyFromCCDB(collision.runNumber(), collision.timestamp()); + } + analyseCascs(collision, allCascs); // process all cascades + analyseCascs(collision, traCascs); // process tracked cascades + } + + PROCESS_SWITCH(StrangeCascTrack, processDerivedData, "process derived data", true); + PROCESS_SWITCH(StrangeCascTrack, processDerivedMCGen, "process derived generated mc data", false); + PROCESS_SWITCH(StrangeCascTrack, processDerivedMCRec, "process derived reconstructed mc data", false); // mc and data are mutually exclusive! }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From f9bb85e6aa952ebfd4a02f36e6320d6c213172c9 Mon Sep 17 00:00:00 2001 From: alcaliva <32872606+alcaliva@users.noreply.github.com> Date: Fri, 24 Oct 2025 15:38:25 +0200 Subject: [PATCH 877/986] [PWGLF] Refine jet definition for generated particles and code optimization (#13522) --- PWGLF/Tasks/Strangeness/strangenessInJets.cxx | 162 +++++++++++++++--- 1 file changed, 140 insertions(+), 22 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/strangenessInJets.cxx b/PWGLF/Tasks/Strangeness/strangenessInJets.cxx index 9402ce67b7f..4ae80aa2d8f 100644 --- a/PWGLF/Tasks/Strangeness/strangenessInJets.cxx +++ b/PWGLF/Tasks/Strangeness/strangenessInJets.cxx @@ -307,6 +307,7 @@ struct StrangenessInJets { } } + /* // Calculation of perpendicular axes void getPerpendicularAxis(TVector3 p, TVector3& u, double sign) { @@ -354,6 +355,7 @@ struct StrangenessInJets { u.SetXYZ(ux, uy, uz); return; } + */ // Delta phi calculation double getDeltaPhi(double a1, double a2) @@ -371,6 +373,95 @@ struct StrangenessInJets { return deltaPhi; } + // Check if particle is a physical primary or a decay product of a heavy-flavor hadron + bool isPhysicalPrimaryOrFromHF(aod::McParticle const& particle, aod::McParticles const& mcParticles) + { + // Keep only pi, K, p, e, mu + int pdg = std::abs(particle.pdgCode()); + if (!(pdg == PDG_t::kPiPlus || pdg == PDG_t::kKPlus || pdg == PDG_t::kProton || pdg == PDG_t::kElectron || pdg == PDG_t::kMuonMinus)) + return false; + + // Constants for identifying heavy-flavor (charm and bottom) content from PDG codes + static constexpr int kCharmQuark = 4; + static constexpr int kBottomQuark = 5; + static constexpr int hundreds = 100; + static constexpr int thousands = 1000; + + // Check if particle is from heavy-flavor decay + bool fromHF = false; + if (particle.has_mothers()) { + auto mother = mcParticles.iteratorAt(particle.mothersIds()[0]); + int motherPdg = std::abs(mother.pdgCode()); + fromHF = (motherPdg / hundreds == kCharmQuark || motherPdg / hundreds == kBottomQuark || motherPdg / thousands == kCharmQuark || motherPdg / thousands == kBottomQuark); + } + + // Select only physical primary particles or from heavy-flavor + return (particle.isPhysicalPrimary() || fromHF); + } + + // Compute two transverse directions orthogonal to vector p + void getPerpendicularDirections(const TVector3& p, TVector3& u1, TVector3& u2) + { + // Get momentum components + double px = p.X(); + double py = p.Y(); + double pz = p.Z(); + + // Precompute squared terms + double px2 = px * px; + double py2 = py * py; + double pz2 = pz * pz; + double pz4 = pz2 * pz2; + + // Case 1: vector along z-axis -> undefined perpendiculars + if (px == 0 && py == 0) { + u1.SetXYZ(0, 0, 0); + u2.SetXYZ(0, 0, 0); + return; + } + + // Case 2: px = 0 -> avoid division by zero + if (px == 0 && py != 0) { + double ux = std::sqrt(py2 - pz4 / py2); + double uy = -pz2 / py; + u1.SetXYZ(ux, uy, pz); + u2.SetXYZ(-ux, uy, pz); + return; + } + + // Case 3: py = 0 -> avoid division by zero + if (py == 0 && px != 0) { + double ux = -pz2 / px; + double uy = std::sqrt(px2 - pz4 / px2); + u1.SetXYZ(ux, uy, pz); + u2.SetXYZ(ux, -uy, pz); + return; + } + + // General case: solve quadratic for perpendicular vectors + double a = px2 + py2; + double b = 2.0 * px * pz2; + double c = pz4 - py2 * py2 - px2 * py2; + double delta = b * b - 4.0 * a * c; + + // Invalid or degenerate solutions + if (delta < 0 || a == 0) { + u1.SetXYZ(0, 0, 0); + u2.SetXYZ(0, 0, 0); + return; + } + + // Solution 1 + double u1x = (-b + std::sqrt(delta)) / (2.0 * a); + double u1y = (-pz2 - px * u1x) / py; + u1.SetXYZ(u1x, u1y, pz); + + // Solution 2 + double u2x = (-b - std::sqrt(delta)) / (2.0 * a); + double u2y = (-pz2 - px * u2x) / py; + u2.SetXYZ(u2x, u2y, pz); + } + // Find ITS hit template bool hasITSHitOnLayer(const TrackIts& track, int layer) @@ -879,10 +970,11 @@ struct StrangenessInJets { // Calculation of perpendicular cones TVector3 jetAxis(jet.px(), jet.py(), jet.pz()); - TVector3 ueAxis1(0, 0, 0); - TVector3 ueAxis2(0, 0, 0); - getPerpendicularAxis(jetAxis, ueAxis1, +1); - getPerpendicularAxis(jetAxis, ueAxis2, -1); + TVector3 ueAxis1(0, 0, 0), ueAxis2(0, 0, 0); + getPerpendicularDirections(jetAxis, ueAxis1, ueAxis2); + if (ueAxis1.Mag() == 0 || ueAxis2.Mag() == 0) { + continue; + } // Store jet and UE axes selectedJet.emplace_back(jetAxis); @@ -1058,6 +1150,7 @@ struct StrangenessInJets { } PROCESS_SWITCH(StrangenessInJets, processData, "Process data", true); + // Define per-collision preslices for V0s, cascades, MC particles, and daughter tracks Preslice perCollisionV0 = o2::aod::v0data::collisionId; Preslice perCollisionCasc = o2::aod::cascade::collisionId; Preslice perMCCollision = o2::aod::mcparticle::mcCollisionId; @@ -1066,9 +1159,23 @@ struct StrangenessInJets { // Generated MC events void processMCgenerated(aod::McCollisions const& collisions, aod::McParticles const& mcParticles) { + // Define per-event particle containers + std::vector fjParticles; + std::vector strHadronMomentum; + std::vector pdg; + + // Jet and area definitions + fastjet::JetDefinition jetDef(fastjet::antikt_algorithm, rJet); + fastjet::AreaDefinition areaDef(fastjet::active_area, fastjet::GhostedAreaSpec(1.0)); + // Loop over all simulated collision events for (const auto& collision : collisions) { + // Clear containers at the start of the event loop + fjParticles.clear(); + strHadronMomentum.clear(); + pdg.clear(); + // Fill event counter before any selection registryMC.fill(HIST("number_of_events_mc_gen"), 0.5); @@ -1088,15 +1195,13 @@ struct StrangenessInJets { // MC particles per collision auto mcParticlesPerColl = mcParticles.sliceBy(perMCCollision, collision.globalIndex()); - // Store strange hadron pdg code and momentum - std::vector pdg; - std::vector strHadronMomentum; - // Loop over all MC particles and select physical primaries within acceptance - std::vector fjParticles; for (const auto& particle : mcParticlesPerColl) { - if (!particle.isPhysicalPrimary()) + + // Select physical primary particles or HF decay products + if (!isPhysicalPrimaryOrFromHF(particle, mcParticles)) continue; + double minPtParticle = 0.1; if (particle.eta() < etaMin || particle.eta() > etaMax || particle.pt() < minPtParticle) continue; @@ -1122,8 +1227,6 @@ struct StrangenessInJets { registryMC.fill(HIST("number_of_events_mc_gen"), 3.5); // Cluster MC particles into jets using anti-kt algorithm - fastjet::JetDefinition jetDef(fastjet::antikt_algorithm, rJet); - fastjet::AreaDefinition areaDef(fastjet::active_area, fastjet::GhostedAreaSpec(1.0)); fastjet::ClusterSequenceArea cs(fjParticles, jetDef, areaDef); std::vector jets = fastjet::sorted_by_pt(cs.inclusive_jets()); @@ -1150,8 +1253,10 @@ struct StrangenessInJets { TVector3 jetAxis(jet.px(), jet.py(), jet.pz()); double coneRadius = std::sqrt(jet.area() / PI); TVector3 ueAxis1(0, 0, 0), ueAxis2(0, 0, 0); - getPerpendicularAxis(jetAxis, ueAxis1, +1); - getPerpendicularAxis(jetAxis, ueAxis2, -1); + getPerpendicularDirections(jetAxis, ueAxis1, ueAxis2); + if (ueAxis1.Mag() == 0 || ueAxis2.Mag() == 0) { + continue; + } // Loop over strange hadrons int index = -1; @@ -1327,8 +1432,25 @@ struct StrangenessInJets { aod::V0Datas const& fullV0s, aod::CascDataExt const& Cascades, const aod::McParticles&) { + // Define per-event containers + std::vector fjParticles; + std::vector selectedJet; + std::vector ue1; + std::vector ue2; + + // Jet and area definitions + fastjet::JetDefinition jetDef(fastjet::antikt_algorithm, rJet); + fastjet::AreaDefinition areaDef(fastjet::active_area, fastjet::GhostedAreaSpec(1.0)); + + // Loop over reconstructed collisions for (const auto& collision : collisions) { + // Clear containers at the start of the event loop + fjParticles.clear(); + selectedJet.clear(); + ue1.clear(); + ue2.clear(); + // Fill event counter before any selection registryMC.fill(HIST("number_of_events_mc_rec"), 0.5); if (!collision.sel8()) @@ -1351,7 +1473,6 @@ struct StrangenessInJets { auto tracksPerColl = mcTracks.sliceBy(perCollisionTrk, collision.globalIndex()); // Loop over reconstructed tracks - std::vector fjParticles; for (auto const& track : tracksPerColl) { if (!passedTrackSelectionForJetReconstruction(track)) continue; @@ -1367,17 +1488,12 @@ struct StrangenessInJets { registryMC.fill(HIST("number_of_events_mc_rec"), 3.5); // Cluster particles using the anti-kt algorithm - fastjet::JetDefinition jetDef(fastjet::antikt_algorithm, rJet); - fastjet::AreaDefinition areaDef(fastjet::active_area, fastjet::GhostedAreaSpec(1.0)); fastjet::ClusterSequenceArea cs(fjParticles, jetDef, areaDef); std::vector jets = fastjet::sorted_by_pt(cs.inclusive_jets()); auto [rhoPerp, rhoMPerp] = backgroundSub.estimateRhoPerpCone(fjParticles, jets); // Jet selection bool isAtLeastOneJetSelected = false; - std::vector selectedJet; - std::vector ue1; - std::vector ue2; // Loop over clustered jets for (const auto& jet : jets) { @@ -1396,8 +1512,10 @@ struct StrangenessInJets { // Perpendicular cones TVector3 jetAxis(jet.px(), jet.py(), jet.pz()); TVector3 ueAxis1(0, 0, 0), ueAxis2(0, 0, 0); - getPerpendicularAxis(jetAxis, ueAxis1, +1); - getPerpendicularAxis(jetAxis, ueAxis2, -1); + getPerpendicularDirections(jetAxis, ueAxis1, ueAxis2); + if (ueAxis1.Mag() == 0 || ueAxis2.Mag() == 0) { + continue; + } // Store selected jet and UE cone axes selectedJet.emplace_back(jetAxis); From ab79e71063073e405bb7bf57a128454a18d2d113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= <26327373+vkucera@users.noreply.github.com> Date: Fri, 24 Oct 2025 15:46:47 +0200 Subject: [PATCH 878/986] [PWGHF,Trigger] Fix redundant copies, useless conditions, variable scope (#13492) --- EventFiltering/PWGHF/HFFilter.cxx | 14 +++++------ EventFiltering/PWGHF/HFFilterHelpers.h | 32 +++++++++++++------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/EventFiltering/PWGHF/HFFilter.cxx b/EventFiltering/PWGHF/HFFilter.cxx index ed03e983d04..2de23e8f314 100644 --- a/EventFiltering/PWGHF/HFFilter.cxx +++ b/EventFiltering/PWGHF/HFFilter.cxx @@ -994,14 +994,14 @@ struct HfFilter { // Main struct for HF triggers if (isGoodXicStar) { if (isRightSignXicStar) { hMassVsPtC[kNCharmParticles + 7]->Fill(ptCand, massDiffXicStarCand); - } else if (!isRightSignXicStar && keepAlsoWrongDmesLambdaPairs) { + } else if (keepAlsoWrongDmesLambdaPairs) { hMassVsPtC[kNCharmParticles + 8]->Fill(ptCand, massDiffXicStarBarCand); } } if (isGoodXicStarBar) { if (isRightSignXicStarBar) { hMassVsPtC[kNCharmParticles + 7]->Fill(ptCand, massDiffXicStarCand); - } else if (!isRightSignXicStarBar && keepAlsoWrongDmesLambdaPairs) { + } else if (keepAlsoWrongDmesLambdaPairs) { hMassVsPtC[kNCharmParticles + 8]->Fill(ptCand, massDiffXicStarBarCand); } } @@ -1093,14 +1093,14 @@ struct HfFilter { // Main struct for HF triggers if (isGoodThetac) { if (isRightSignThetaC) { hMassVsPtC[kNCharmParticles + 21]->Fill(ptCand, massDiffThetacCand); - } else if (!isRightSignThetaC && keepAlsoWrongDmesProtonPairs) { + } else if (keepAlsoWrongDmesProtonPairs) { hMassVsPtC[kNCharmParticles + 22]->Fill(ptCand, massDiffThetacBarCand); } } if (isGoodThetacBar) { if (isRightSignThetaCBar) { hMassVsPtC[kNCharmParticles + 21]->Fill(ptCand, massDiffThetacCand); - } else if (!isRightSignThetaCBar && keepAlsoWrongDmesProtonPairs) { + } else if (keepAlsoWrongDmesProtonPairs) { hMassVsPtC[kNCharmParticles + 22]->Fill(ptCand, massDiffThetacBarCand); } } @@ -1144,14 +1144,14 @@ struct HfFilter { // Main struct for HF triggers if (isGoodLcStar) { if (isRightSignLcStar) { hMassVsPtC[kNCharmParticles + 19]->Fill(ptCand, massDiffLcStarCand); - } else if (!isRightSignLcStar && keepAlsoWrongDmesProtonPairs) { + } else if (keepAlsoWrongDmesProtonPairs) { hMassVsPtC[kNCharmParticles + 20]->Fill(ptCand, massDiffLcStarBarCand); } } if (isGoodLcStarBar) { if (isRightSignLcStarBar) { hMassVsPtC[kNCharmParticles + 19]->Fill(ptCand, massDiffLcStarCand); - } else if (!isRightSignLcStarBar && keepAlsoWrongDmesProtonPairs) { + } else if (keepAlsoWrongDmesProtonPairs) { hMassVsPtC[kNCharmParticles + 20]->Fill(ptCand, massDiffLcStarBarCand); } } @@ -1640,7 +1640,7 @@ struct HfFilter { // Main struct for HF triggers if (activateQA) { if (isRightSign) { hMassVsPtC[kNCharmParticles + 5]->Fill(ptCand, massDiffXicStar); - } else if (!isRightSign && keepAlsoWrongDmesLambdaPairs) { + } else if (keepAlsoWrongDmesLambdaPairs) { hMassVsPtC[kNCharmParticles + 6]->Fill(ptCand, massDiffXicStar); } } diff --git a/EventFiltering/PWGHF/HFFilterHelpers.h b/EventFiltering/PWGHF/HFFilterHelpers.h index 65fa3132135..715321c38c8 100644 --- a/EventFiltering/PWGHF/HFFilterHelpers.h +++ b/EventFiltering/PWGHF/HFFilterHelpers.h @@ -415,15 +415,15 @@ class HfFilterHelper mForceTofProtonForFemto = forceTofProtons; mForceTofDeuteronForFemto = forceTofDeuterons; } - void setPtBinsSingleTracks(std::vector ptBins) { mPtBinsTracks = ptBins; } - void setPtBinsBeautyHadrons(std::vector ptBins) { mPtBinsBeautyHadrons = ptBins; } - void setCutsSingleTrackBeauty(o2::framework::LabeledArray cutsSingleTrack3P, o2::framework::LabeledArray cutsSingleTrack4P, o2::framework::LabeledArray cutsSingleToJPsi) + void setPtBinsSingleTracks(const std::vector& ptBins) { mPtBinsTracks = ptBins; } + void setPtBinsBeautyHadrons(const std::vector& ptBins) { mPtBinsBeautyHadrons = ptBins; } + void setCutsSingleTrackBeauty(const o2::framework::LabeledArray& cutsSingleTrack3P, const o2::framework::LabeledArray& cutsSingleTrack4P, const o2::framework::LabeledArray& cutsSingleToJPsi) { mCutsSingleTrackBeauty3Prong = cutsSingleTrack3P; mCutsSingleTrackBeauty4Prong = cutsSingleTrack4P; mCutsSingleTrackBeautyToJPsi = cutsSingleToJPsi; } - void setCutsBhadrons(o2::framework::LabeledArray cutsBplus, o2::framework::LabeledArray cutsB0toDstar, o2::framework::LabeledArray cutsBc, o2::framework::LabeledArray cutsB0, o2::framework::LabeledArray cutsBs, o2::framework::LabeledArray cutsLb, o2::framework::LabeledArray cutsXib) + void setCutsBhadrons(const o2::framework::LabeledArray& cutsBplus, const o2::framework::LabeledArray& cutsB0toDstar, const o2::framework::LabeledArray& cutsBc, const o2::framework::LabeledArray& cutsB0, const o2::framework::LabeledArray& cutsBs, const o2::framework::LabeledArray& cutsLb, const o2::framework::LabeledArray& cutsXib) { mCutsBhad[kBplus] = cutsBplus; mCutsBhad[kB0toDStar] = cutsB0toDstar; @@ -433,7 +433,7 @@ class HfFilterHelper mCutsBhad[kLb] = cutsLb; mCutsBhad[kXib] = cutsXib; } - void setCutsBtoJPsi(o2::framework::LabeledArray cuts) + void setCutsBtoJPsi(const o2::framework::LabeledArray& cuts) { mCutsBhadToJPsi = cuts; } @@ -554,7 +554,7 @@ class HfFilterHelper mMaxDcaXyXi = maxDcaxyXi; mMaxNsigmaXiDau = nSigma; } - void setCutsSingleTrackCharmBaryonBachelor(o2::framework::LabeledArray cutsSingleTrack) { mCutsSingleTrackCharmBaryonBachelor = cutsSingleTrack; } + void setCutsSingleTrackCharmBaryonBachelor(const o2::framework::LabeledArray& cutsSingleTrack) { mCutsSingleTrackCharmBaryonBachelor = cutsSingleTrack; } void setNsigmaPiCutsForCharmBaryonBachelor(float nSigmaTpc, float nSigmaTof) { mNSigmaTpcPiCharmBaryonBachelor = nSigmaTpc; @@ -583,7 +583,7 @@ class HfFilterHelper void setTpcPidCalibrationOption(int opt) { mTpcPidCalibrationOption = opt; } - void setMassResolParametrisation(std::string recoPass) + void setMassResolParametrisation(const std::string& recoPass) { if (recoPass == "2023_pass3") { mSigmaPars2Prongs[0] = 0.01424f; @@ -610,7 +610,7 @@ class HfFilterHelper void setNumSigmaForDeltaMassCharmHadCut(float nSigma) { mNumSigmaDeltaMassCharmHad = nSigma; } - void setPreselDsToKKPi(std::vector ptBins, o2::framework::LabeledArray preselections) + void setPreselDsToKKPi(const std::vector& ptBins, const o2::framework::LabeledArray& preselections) { mPtBinsPreselDsToKKPi = ptBins; mPreselDsToKKPi = preselections; @@ -679,7 +679,7 @@ class HfFilterHelper template T computeRelativeMomentum(const std::array& pTrack, const std::array& CharmCandMomentum, const T& CharmMass); template - int computeNumberOfCandidates(std::vector> indices); + int computeNumberOfCandidates(const std::vector>& indices); template int setVtxConfiguration(T1& vertexer, bool useAbsDCA); template @@ -1504,14 +1504,14 @@ inline int8_t HfFilterHelper::isSelectedV0(const V0& v0, const int& activateQA, float nSigmaPrTpc[2] = {v0.nSigmaPrTpcPos, v0.nSigmaPrTpcNeg}; float nSigmaPrTof[2] = {v0.nSigmaPrTofPos, v0.nSigmaPrTofNeg}; float pInTpc[2] = {v0.pinTpcPos, v0.pinTpcNeg}; - float nClsTpc[2] = {v0.nClsFoundTpcPos, v0.nClsFoundTpcNeg}; - float etaDaus[2] = {v0.etaPos, v0.etaNeg}; - float signalTpc[2] = {v0.signalTpcPos, v0.signalTpcNeg}; if (mTpcPidCalibrationOption == 1) { + float nClsTpc[2] = {v0.nClsFoundTpcPos, v0.nClsFoundTpcNeg}; + float etaDaus[2] = {v0.etaPos, v0.etaNeg}; for (int iDau{0}; iDau < 2; ++iDau) { nSigmaPrTpc[iDau] = getTPCPostCalib(pInTpc[iDau], nClsTpc[iDau], etaDaus[iDau], nSigmaPrTpc[iDau], kPr); } } else if (mTpcPidCalibrationOption == 2) { + float signalTpc[2] = {v0.signalTpcPos, v0.signalTpcNeg}; for (int iDau{0}; iDau < 2; ++iDau) { nSigmaPrTpc[iDau] = getTPCSplineCalib(pInTpc[iDau], signalTpc[iDau], (iDau == 0) ? kPr : kAntiPr); } @@ -1664,9 +1664,8 @@ inline bool HfFilterHelper::isSelectedCascade(const Casc& casc) float nClsTpc[3] = {casc.nClsFoundTpcBach, casc.v0.nClsFoundTpcPos, casc.v0.nClsFoundTpcNeg}; float nCrossedRowsTpc[3] = {casc.nClsCrossedRowsTpcBach, casc.v0.nClsCrossedRowsTpcPos, casc.v0.nClsCrossedRowsTpcNeg}; float crossedRowsOverFindableClsTpc[3] = {casc.crossedRowsOverFindableClsTpcBach, casc.v0.crossedRowsOverFindableClsTpcPos, casc.v0.crossedRowsOverFindableClsTpcNeg}; - float etaDaus[3] = {casc.etaBach, casc.v0.etaPos, casc.v0.etaNeg}; - float signalTpc[3] = {casc.signalTpcBach, casc.v0.signalTpcPos, casc.v0.signalTpcNeg}; if (mTpcPidCalibrationOption == 1) { + float etaDaus[3] = {casc.etaBach, casc.v0.etaPos, casc.v0.etaNeg}; for (int iDau{0}; iDau < 3; ++iDau) { nSigmaPiTpc[iDau] = getTPCPostCalib(pInTpc[iDau], nClsTpc[iDau], etaDaus[iDau], nSigmaPrTpc[iDau], kPi); if (iDau == 0) { @@ -1675,12 +1674,13 @@ inline bool HfFilterHelper::isSelectedCascade(const Casc& casc) nSigmaPrTpc[iDau] = getTPCPostCalib(pInTpc[iDau], nClsTpc[iDau], etaDaus[iDau], nSigmaPrTpc[iDau], kPr); } } else if (mTpcPidCalibrationOption == 2) { + float signalTpc[3] = {casc.signalTpcBach, casc.v0.signalTpcPos, casc.v0.signalTpcNeg}; for (int iDau{0}; iDau < 3; ++iDau) { nSigmaPiTpc[iDau] = getTPCSplineCalib(pInTpc[iDau], signalTpc[iDau], (iDau == 0) ? kPi : kAntiPi); if (iDau == 0) { continue; } - nSigmaPrTpc[iDau] = getTPCSplineCalib(pInTpc[iDau], signalTpc[iDau], (iDau == 0) ? kPr : kAntiPr); + nSigmaPrTpc[iDau] = getTPCSplineCalib(pInTpc[iDau], signalTpc[iDau], kAntiPr); } } @@ -1838,7 +1838,7 @@ inline T HfFilterHelper::computeRelativeMomentum(const std::array& pTrack, /// Computation of the number of candidates in an event that do not share daughter tracks /// \return 0 or 1 in case of less than 2 independent candidates in a single event, 2 otherwise template -inline int HfFilterHelper::computeNumberOfCandidates(std::vector> indices) +inline int HfFilterHelper::computeNumberOfCandidates(const std::vector>& indices) { if (indices.size() < 2) { return indices.size(); From 764ec409846bf30a5ffc99cdef150632c789c95f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= <26327373+vkucera@users.noreply.github.com> Date: Fri, 24 Oct 2025 17:26:44 +0200 Subject: [PATCH 879/986] [PWGHF,Trigger] Remove unused ONNX dependency (#13515) --- EventFiltering/CMakeLists.txt | 6 +++--- EventFiltering/PWGHF/HFFilterPrepareMLSamples.cxx | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/EventFiltering/CMakeLists.txt b/EventFiltering/CMakeLists.txt index 8805e893fea..8c65d4f8f1a 100644 --- a/EventFiltering/CMakeLists.txt +++ b/EventFiltering/CMakeLists.txt @@ -39,17 +39,17 @@ o2physics_add_header_only_library(HFFilterHelpers o2physics_add_dpl_workflow(hf-filter SOURCES PWGHF/HFFilter.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore ONNXRuntime::ONNXRuntime O2Physics::HFFilterHelpers O2::DetectorsBase + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::HFFilterHelpers O2::DetectorsBase COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(hf-filter-charm-hadron-signals SOURCES PWGHF/HFFilterCharmHadronSignals.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore ONNXRuntime::ONNXRuntime O2Physics::HFFilterHelpers + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::HFFilterHelpers COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(hf-filter-prepare-ml-samples SOURCES PWGHF/HFFilterPrepareMLSamples.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore ONNXRuntime::ONNXRuntime O2Physics::HFFilterHelpers O2::DetectorsBase + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::HFFilterHelpers O2::DetectorsBase COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(cf-filter diff --git a/EventFiltering/PWGHF/HFFilterPrepareMLSamples.cxx b/EventFiltering/PWGHF/HFFilterPrepareMLSamples.cxx index b7a9637ba10..8e4dc89d43f 100644 --- a/EventFiltering/PWGHF/HFFilterPrepareMLSamples.cxx +++ b/EventFiltering/PWGHF/HFFilterPrepareMLSamples.cxx @@ -28,8 +28,6 @@ #include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/TrackSelectionTables.h" -#include - #include #include #include From 072bffc397f534fa66f662d4013f72ecb19a4e14 Mon Sep 17 00:00:00 2001 From: Chiara De Martin <39315597+ChiaraDeMartin95@users.noreply.github.com> Date: Fri, 24 Oct 2025 20:50:10 +0200 Subject: [PATCH 880/986] fix bug in external function (#13530) Co-authored-by: Chiara De Martin --- PWGLF/TableProducer/Strangeness/cascadeflow.cxx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx index 1ef86aa7901..587012a6f85 100644 --- a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx @@ -528,15 +528,14 @@ struct cascadeFlow { auto deltapsiTPCA = 0.0; auto deltapsiTPCC = 0.0; for (int ishift = 1; ishift <= 10; ishift++) { - auto coeffshiftxFT0C = shiftprofileA->GetBinContent(shiftprofileFT0C->FindBin(coll.centFT0C(), 0.5, ishift - 0.5)); - auto coeffshiftyFT0C = shiftprofileA->GetBinContent(shiftprofileFT0C->FindBin(coll.centFT0C(), 1.5, ishift - 0.5)); - auto coeffshiftxTPCA = shiftprofileB->GetBinContent(shiftprofileTPCL->FindBin(coll.centFT0C(), 2.5, ishift - 0.5)); - auto coeffshiftyTPCA = shiftprofileB->GetBinContent(shiftprofileTPCL->FindBin(coll.centFT0C(), 3.5, ishift - 0.5)); - auto coeffshiftxTPCC = shiftprofileC->GetBinContent(shiftprofileTPCR->FindBin(coll.centFT0C(), 4.5, ishift - 0.5)); - auto coeffshiftyTPCC = shiftprofileC->GetBinContent(shiftprofileTPCR->FindBin(coll.centFT0C(), 5.5, ishift - 0.5)); - auto coeffshiftxFV0A = shiftprofileD->GetBinContent(shiftprofileFV0A->FindBin(coll.centFT0C(), 0.5, ishift - 0.5)); - auto coeffshiftyFV0A = shiftprofileD->GetBinContent(shiftprofileFV0A->FindBin(coll.centFT0C(), 1.5, ishift - 0.5)); - + auto coeffshiftxFT0C = shiftprofileA->GetBinContent(shiftprofileA->FindBin(coll.centFT0C(), 0.5, ishift - 0.5)); + auto coeffshiftyFT0C = shiftprofileA->GetBinContent(shiftprofileA->FindBin(coll.centFT0C(), 1.5, ishift - 0.5)); + auto coeffshiftxTPCA = shiftprofileB->GetBinContent(shiftprofileB->FindBin(coll.centFT0C(), 2.5, ishift - 0.5)); + auto coeffshiftyTPCA = shiftprofileB->GetBinContent(shiftprofileB->FindBin(coll.centFT0C(), 3.5, ishift - 0.5)); + auto coeffshiftxTPCC = shiftprofileC->GetBinContent(shiftprofileC->FindBin(coll.centFT0C(), 4.5, ishift - 0.5)); + auto coeffshiftyTPCC = shiftprofileC->GetBinContent(shiftprofileC->FindBin(coll.centFT0C(), 5.5, ishift - 0.5)); + auto coeffshiftxFV0A = shiftprofileD->GetBinContent(shiftprofileA->FindBin(coll.centFT0C(), 0.5, ishift - 0.5)); + auto coeffshiftyFV0A = shiftprofileD->GetBinContent(shiftprofileA->FindBin(coll.centFT0C(), 1.5, ishift - 0.5)); deltapsiFT0C += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0C * TMath::Cos(ishift * static_cast(nmode) * psiT0C) + coeffshiftyFT0C * TMath::Sin(ishift * static_cast(nmode) * psiT0C))); deltapsiFV0A += ((1 / (1.0 * ishift)) * (-coeffshiftxFV0A * TMath::Cos(ishift * static_cast(nmode) * psiV0A) + coeffshiftyFV0A * TMath::Sin(ishift * static_cast(nmode) * psiV0A))); deltapsiTPCA += ((1 / (1.0 * ishift)) * (-coeffshiftxTPCA * TMath::Cos(ishift * static_cast(nmode) * psiTPCA) + coeffshiftyTPCA * TMath::Sin(ishift * static_cast(nmode) * psiTPCA))); From 6ab3502cce62694370f3f881434e919039ff0a29 Mon Sep 17 00:00:00 2001 From: Marvin Hemmer <53471402+mhemmer-cern@users.noreply.github.com> Date: Fri, 24 Oct 2025 23:57:54 +0200 Subject: [PATCH 881/986] [PWGEM,PWGEM-36] Update EMCal flow task to use TProfile3D (#13528) --- PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx | 57 ++++++++++++---------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx b/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx index cf5084a852b..7a0defc749a 100644 --- a/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx @@ -125,14 +125,13 @@ struct TaskPi0FlowEMC { Configurable cfgMaxAsymmetry{"cfgMaxAsymmetry", 0.1f, "Maximum allowed asymmetry for photon pairs used in calibration."}; // configurable axis - ConfigurableAxis thnConfigAxisInvMass{"thnConfigAxisInvMass", {400, 0.0, 0.8}, ""}; - ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {100, 0., 20.}, ""}; - ConfigurableAxis thnConfigAxisCent{"thnConfigAxisCent", {20, 0., 100.}, ""}; - ConfigurableAxis thnConfigAxisCosNPhi{"thnConfigAxisCosNPhi", {100, -1., 1.}, ""}; - ConfigurableAxis thnConfigAxisCosDeltaPhi{"thnConfigAxisCosDeltaPhi", {8, -1., 1.}, ""}; - ConfigurableAxis thnConfigAxisScalarProd{"thnConfigAxisScalarProd", {100, -5., 5.}, ""}; - ConfigurableAxis thnConfigAxisM02{"thnConfigAxisM02", {200, 0., 5.}, ""}; - ConfigurableAxis thnConfigAxisEnergyCalib{"thnConfigAxisEnergyCalib", {200, 0., 20.}, ""}; + ConfigurableAxis thnConfigAxisInvMass{"thnConfigAxisInvMass", {400, 0.0, 0.8}, "invariant mass axis for the neutral meson"}; + ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {100, 0., 20.}, "pT axis for the neutral meson"}; + ConfigurableAxis thnConfigAxisCent{"thnConfigAxisCent", {20, 0., 100.}, "centrality axis for the current event"}; + ConfigurableAxis thnConfigAxisCosNPhi{"thnConfigAxisCosNPhi", {100, -1., 1.}, "cos(n*phi) axis for the current event"}; + ConfigurableAxis thnConfigAxisCosDeltaPhi{"thnConfigAxisCosDeltaPhi", {8, -1., 1.}, "cos(delta phi) axis for the current event"}; + ConfigurableAxis thnConfigAxisM02{"thnConfigAxisM02", {200, 0., 5.}, "M02 axis for the EMCal cluster"}; + ConfigurableAxis thnConfigAxisEnergyCalib{"thnConfigAxisEnergyCalib", {200, 0., 20.}, "energy axis for the emcal clusters for the calibration process"}; EMPhotonEventCut fEMEventCut; struct : ConfigurableGroup { @@ -313,7 +312,6 @@ struct TaskPi0FlowEMC { const AxisSpec thnAxisCent{thnConfigAxisCent, "Centrality (%)"}; const AxisSpec thnAxisCosNPhi{thnConfigAxisCosNPhi, Form("cos(%d#varphi)", harmonic.value)}; const AxisSpec thnAxisCosDeltaPhi{thnConfigAxisCosDeltaPhi, Form("cos(%d(#varphi - #Psi_{sub}))", harmonic.value)}; - const AxisSpec thnAxisScalarProd{thnConfigAxisScalarProd, "SP"}; const AxisSpec thnAxisM02{thnConfigAxisM02, "M_{02}"}; const AxisSpec thAxisTanThetaPhi{mesonConfig.thConfigAxisTanThetaPhi, "atan(#Delta#theta/#Delta#varphi)"}; const AxisSpec thAxisClusterEnergy{thnConfigAxisPt, "#it{E} (GeV)"}; @@ -335,9 +333,14 @@ struct TaskPi0FlowEMC { const AxisSpec thnAxisMixingCent{mixingConfig.cfgCentBins, "Centrality (%)"}; const AxisSpec thnAxisMixingEP{mixingConfig.cfgEPBins, Form("cos(%d#varphi)", harmonic.value)}; - registry.add("hSparsePi0Flow", "THn for SP", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCent, thnAxisScalarProd}); - registry.add("hSparseBkgRotFlow", "THn for SP", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCent, thnAxisScalarProd}); - registry.add("hSparseBkgMixFlow", "THn for SP", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCent, thnAxisScalarProd}); + registry.add("hSparsePi0Flow", " vs m_{inv} vs p_T vs cent for same event", HistType::kTProfile3D, {thnAxisInvMass, thnAxisPt, thnAxisCent}); + registry.add("hSparseBkgRotFlow", " vs m_{inv} vs p_T vs cent for rotation background", HistType::kTProfile3D, {thnAxisInvMass, thnAxisPt, thnAxisCent}); + registry.add("hSparseBkgMixFlow", " vs m_{inv} vs p_T vs cent for mixed event", HistType::kTProfile3D, {thnAxisInvMass, thnAxisPt, thnAxisCent}); + + registry.add("hSparsePi0", "m_{inv} vs p_T vs cent for same event", HistType::kTH3D, {thnAxisInvMass, thnAxisPt, thnAxisCent}); + registry.add("hSparseBkgRot", "m_{inv} vs p_T vs cent for rotation background", HistType::kTH3D, {thnAxisInvMass, thnAxisPt, thnAxisCent}); + registry.add("hSparseBkgMix", "m_{inv} vs p_T vs cent for mixed event", HistType::kTH3D, {thnAxisInvMass, thnAxisPt, thnAxisCent}); + registry.add("h3DMixingCount", "THn Event Mixing QA", HistType::kTH3D, {thnAxisMixingVtx, thnAxisMixingCent, thnAxisMixingEP}); if (cfgDoPlaneQA.value) { registry.add("hSparsePi0FlowPlane", "THn for SP", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCent, thnAxisCosDeltaPhi}); @@ -359,17 +362,17 @@ struct TaskPi0FlowEMC { hClusterCutsMixed->GetXaxis()->SetBinLabel(6, "out"); if (saveSPResoHist) { - registry.add("spReso/hSpResoFT0cFT0a", "hSpResoFT0cFT0a; centrality; Q_{FT0c} #bullet Q_{FT0a}", HistType::kTH2D, {thnAxisCent, thnConfigAxisScalarProd}); - registry.add("spReso/hSpResoFT0cTPCpos", "hSpResoFT0cTPCpos; centrality; Q_{FT0c} #bullet Q_{TPCpos}", HistType::kTH2D, {thnAxisCent, thnConfigAxisScalarProd}); - registry.add("spReso/hSpResoFT0cTPCneg", "hSpResoFT0cTPCneg; centrality; Q_{FT0c} #bullet Q_{TPCneg}", HistType::kTH2D, {thnAxisCent, thnConfigAxisScalarProd}); - registry.add("spReso/hSpResoFT0cTPCtot", "hSpResoFT0cTPCtot; centrality; Q_{FT0c} #bullet Q_{TPCtot}", HistType::kTH2D, {thnAxisCent, thnConfigAxisScalarProd}); - registry.add("spReso/hSpResoFT0aTPCpos", "hSpResoFT0aTPCpos; centrality; Q_{FT0a} #bullet Q_{TPCpos}", HistType::kTH2D, {thnAxisCent, thnConfigAxisScalarProd}); - registry.add("spReso/hSpResoFT0aTPCneg", "hSpResoFT0aTPCneg; centrality; Q_{FT0a} #bullet Q_{TPCneg}", HistType::kTH2D, {thnAxisCent, thnConfigAxisScalarProd}); - registry.add("spReso/hSpResoFT0aTPCtot", "hSpResoFT0aTPCtot; centrality; Q_{FT0m} #bullet Q_{TPCtot}", HistType::kTH2D, {thnAxisCent, thnConfigAxisScalarProd}); - registry.add("spReso/hSpResoFT0mTPCpos", "hSpResoFT0mTPCpos; centrality; Q_{FT0m} #bullet Q_{TPCpos}", HistType::kTH2D, {thnAxisCent, thnConfigAxisScalarProd}); - registry.add("spReso/hSpResoFT0mTPCneg", "hSpResoFT0mTPCneg; centrality; Q_{FT0m} #bullet Q_{TPCneg}", HistType::kTH2D, {thnAxisCent, thnConfigAxisScalarProd}); - registry.add("spReso/hSpResoFT0mTPCtot", "hSpResoFT0mTPCtot; centrality; Q_{FT0m} #bullet Q_{TPCtot}", HistType::kTH2D, {thnAxisCent, thnConfigAxisScalarProd}); - registry.add("spReso/hSpResoTPCposTPCneg", "hSpResoTPCposTPCneg; centrality; Q_{TPCpos} #bullet Q_{TPCneg}", HistType::kTH2D, {thnAxisCent, thnConfigAxisScalarProd}); + registry.add("spReso/hSpResoFT0cFT0a", "hSpResoFT0cFT0a; centrality; Q_{FT0c} #bullet Q_{FT0a}", HistType::kTProfile, {thnAxisCent}); + registry.add("spReso/hSpResoFT0cTPCpos", "hSpResoFT0cTPCpos; centrality; Q_{FT0c} #bullet Q_{TPCpos}", HistType::kTProfile, {thnAxisCent}); + registry.add("spReso/hSpResoFT0cTPCneg", "hSpResoFT0cTPCneg; centrality; Q_{FT0c} #bullet Q_{TPCneg}", HistType::kTProfile, {thnAxisCent}); + registry.add("spReso/hSpResoFT0cTPCtot", "hSpResoFT0cTPCtot; centrality; Q_{FT0c} #bullet Q_{TPCtot}", HistType::kTProfile, {thnAxisCent}); + registry.add("spReso/hSpResoFT0aTPCpos", "hSpResoFT0aTPCpos; centrality; Q_{FT0a} #bullet Q_{TPCpos}", HistType::kTProfile, {thnAxisCent}); + registry.add("spReso/hSpResoFT0aTPCneg", "hSpResoFT0aTPCneg; centrality; Q_{FT0a} #bullet Q_{TPCneg}", HistType::kTProfile, {thnAxisCent}); + registry.add("spReso/hSpResoFT0aTPCtot", "hSpResoFT0aTPCtot; centrality; Q_{FT0m} #bullet Q_{TPCtot}", HistType::kTProfile, {thnAxisCent}); + registry.add("spReso/hSpResoFT0mTPCpos", "hSpResoFT0mTPCpos; centrality; Q_{FT0m} #bullet Q_{TPCpos}", HistType::kTProfile, {thnAxisCent}); + registry.add("spReso/hSpResoFT0mTPCneg", "hSpResoFT0mTPCneg; centrality; Q_{FT0m} #bullet Q_{TPCneg}", HistType::kTProfile, {thnAxisCent}); + registry.add("spReso/hSpResoFT0mTPCtot", "hSpResoFT0mTPCtot; centrality; Q_{FT0m} #bullet Q_{TPCtot}", HistType::kTProfile, {thnAxisCent}); + registry.add("spReso/hSpResoTPCposTPCneg", "hSpResoTPCposTPCneg; centrality; Q_{TPCpos} #bullet Q_{TPCneg}", HistType::kTProfile, {thnAxisCent}); } if (saveEpResoHisto) { @@ -445,7 +448,7 @@ struct TaskPi0FlowEMC { } if (cfgDoM02.value) { - registry.add("hSparseFlow", "THn for SP", HistType::kTHnSparseF, {thnAxisM02, thnAxisPt, thnAxisCent, thnAxisScalarProd}); + registry.add("hSparseFlow", "THn for SP", HistType::kTHnSparseF, {thnAxisM02, thnAxisPt, thnAxisCent}); } ccdb->setURL(ccdbUrl); @@ -488,8 +491,10 @@ struct TaskPi0FlowEMC { float& cent, float& sp) { - static constexpr std::string_view HistTypes[3] = {"hSparsePi0Flow", "hSparseBkgRotFlow", "hSparseBkgMixFlow"}; - registry.fill(HIST(HistTypes[histType]), mass, pt, cent, sp); + static constexpr std::string_view FlowHistTypes[3] = {"hSparsePi0Flow", "hSparseBkgRotFlow", "hSparseBkgMixFlow"}; + static constexpr std::string_view HistTypes[3] = {"hSparsePi0", "hSparseBkgRot", "hSparseBkgMix"}; + registry.fill(HIST(FlowHistTypes[histType]), mass, pt, cent, sp); + registry.fill(HIST(HistTypes[histType]), mass, pt, cent); } /// Get the centrality From 398dd258fca0d8817168f2eadf6bdc1fbabfddbe Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Sat, 25 Oct 2025 01:07:56 +0200 Subject: [PATCH 882/986] [PWGHF,Trigger] Switch to absDca for vertices with tracked cascades (#13535) --- EventFiltering/PWGHF/HFFilter.cxx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/EventFiltering/PWGHF/HFFilter.cxx b/EventFiltering/PWGHF/HFFilter.cxx index 2de23e8f314..23109f0b29c 100644 --- a/EventFiltering/PWGHF/HFFilter.cxx +++ b/EventFiltering/PWGHF/HFFilter.cxx @@ -200,12 +200,13 @@ struct HfFilter { // Main struct for HF triggers // array of BDT thresholds std::array, kNCharmParticles> thresholdBDTScores; - o2::vertexing::DCAFitterN<2> df2; // fitter for Charm Hadron vertex (2-prong vertex fitter) - o2::vertexing::DCAFitterN<3> df3; // fitter for Charm/Beauty Hadron vertex (3-prong vertex fitter) - o2::vertexing::DCAFitterN<4> df4; // fitter for Beauty Hadron vertex (4-prong vertex fitter) - o2::vertexing::DCAFitterN<2> dfB; // fitter for Beauty Hadron vertex (2-prong vertex fitter) - o2::vertexing::DCAFitterN<3> dfBtoDstar; // fitter for Beauty Hadron to D* vertex (3-prong vertex fitter) - o2::vertexing::DCAFitterN<2> dfStrangeness; // fitter for V0s and cascades (2-prong vertex fitter) + o2::vertexing::DCAFitterN<2> df2; // fitter for Charm Hadron vertex (2-prong vertex fitter) + o2::vertexing::DCAFitterN<3> df3; // fitter for Charm/Beauty Hadron vertex (3-prong vertex fitter) + o2::vertexing::DCAFitterN<4> df4; // fitter for Beauty Hadron vertex (4-prong vertex fitter) + o2::vertexing::DCAFitterN<2> dfB; // fitter for Beauty Hadron vertex (2-prong vertex fitter) + o2::vertexing::DCAFitterN<3> dfBtoDstar; // fitter for Beauty Hadron to D* vertex (3-prong vertex fitter) + o2::vertexing::DCAFitterN<2> dfStrangeness; // fitter for V0s and cascades (2-prong vertex fitter) + o2::vertexing::DCAFitterN<3> dfStrangeness3; // fitter for Xic+ -> XiPiPi std::shared_ptr hProcessedEvents; @@ -273,6 +274,7 @@ struct HfFilter { // Main struct for HF triggers helper.setPtDeltaMassRangeSigmaC(cutsPtDeltaMassCharmReso->get(0u, 6u), cutsPtDeltaMassCharmReso->get(1u, 6u), cutsPtDeltaMassCharmReso->get(0u, 7u), cutsPtDeltaMassCharmReso->get(1u, 7u), cutsPtDeltaMassCharmReso->get(0u, 8u), cutsPtDeltaMassCharmReso->get(1u, 8u), cutsPtDeltaMassCharmReso->get(0u, 9u), cutsPtDeltaMassCharmReso->get(1u, 9u), cutsPtDeltaMassCharmReso->get(2u, 6u), cutsPtDeltaMassCharmReso->get(2u, 7u), cutsPtDeltaMassCharmReso->get(2u, 8u), cutsPtDeltaMassCharmReso->get(2u, 9u)); helper.setPtRangeSoftKaonXicResoToSigmaC(ptCuts->get(0u, 5u), ptCuts->get(1u, 5u)); helper.setVtxConfiguration(dfStrangeness, true); // (DCAFitterN, useAbsDCA) + helper.setVtxConfiguration(dfStrangeness3, true); // (DCAFitterN, useAbsDCA) dfStrangeness.setMatCorrType(matCorr); helper.setVtxConfiguration(df2, false); // (DCAFitterN, useAbsDCA) helper.setVtxConfiguration(df3, false); @@ -1823,7 +1825,7 @@ struct HfFilter { // Main struct for HF triggers bool isSelXiBach{false}; if (requireStrangenessTracking->get(0u, 0u) > 0) { if (hasStrangeTrack) { - isSelXiBach = helper.isSelectedXiBach(trackParCascTrack, trackParBachelor, isSelBachelor, collision, df2, activateQA, hMassVsPtC[kNCharmParticles + 15], hMassVsPtC[kNCharmParticles + 16]); + isSelXiBach = helper.isSelectedXiBach(trackParCascTrack, trackParBachelor, isSelBachelor, collision, dfStrangeness, activateQA, hMassVsPtC[kNCharmParticles + 15], hMassVsPtC[kNCharmParticles + 16]); } } else { isSelXiBach = helper.isSelectedXiBach(trackParCasc, trackParBachelor, isSelBachelor, collision, dfStrangeness, activateQA, hMassVsPtC[kNCharmParticles + 15], hMassVsPtC[kNCharmParticles + 16]); @@ -1866,7 +1868,7 @@ struct HfFilter { // Main struct for HF triggers bool isSelXiBachBach{false}; if (requireStrangenessTracking->get(0u, 1u) > 0) { if (hasStrangeTrack) { - isSelXiBachBach = helper.isSelectedXiBachBach<3>(trackParCascTrack, {trackParBachelor, trackParBachelorSecond}, collision, df3, activateQA, hMassVsPtC[kNCharmParticles + 17]); + isSelXiBachBach = helper.isSelectedXiBachBach<3>(trackParCascTrack, {trackParBachelor, trackParBachelorSecond}, collision, dfStrangeness3, activateQA, hMassVsPtC[kNCharmParticles + 17]); } } else { // vertex with only the two bachelors isSelXiBachBach = helper.isSelectedXiBachBach<2>(trackParCasc, {trackParBachelor, trackParBachelorSecond}, collision, df2, activateQA, hMassVsPtC[kNCharmParticles + 17]); From 14517ed49a0b83eeb081e9465e743f9229e25deb Mon Sep 17 00:00:00 2001 From: Kai Cui <129373281+kcui1@users.noreply.github.com> Date: Sat, 25 Oct 2025 01:09:35 +0200 Subject: [PATCH 883/986] [PWGLF] Update hStrangeCorrelationFilter.cxx (#13531) --- .../Strangeness/hStrangeCorrelationFilter.cxx | 518 ++++++++++-------- 1 file changed, 301 insertions(+), 217 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/hStrangeCorrelationFilter.cxx b/PWGLF/TableProducer/Strangeness/hStrangeCorrelationFilter.cxx index 2f39a7c0fe7..d29696cc2a0 100644 --- a/PWGLF/TableProducer/Strangeness/hStrangeCorrelationFilter.cxx +++ b/PWGLF/TableProducer/Strangeness/hStrangeCorrelationFilter.cxx @@ -18,23 +18,26 @@ /// \author David Dobrigkeit Chinellato (david.dobrigkeit.chinellato@cern.ch) /// \author Zhongbao Yin (Zhong-Bao.Yin@cern.ch) -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" #include "PWGLF/DataModel/LFHStrangeCorrelationTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" + +#include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/PIDResponse.h" -#include "Framework/ASoAHelpers.h" #include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "EventFiltering/Zorro.h" +#include "EventFiltering/ZorroSummary.h" + #include "CCDB/BasicCCDBManager.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + #include "TF1.h" -#include #include -#include "EventFiltering/Zorro.h" -#include "EventFiltering/ZorroSummary.h" +#include using namespace o2; using namespace o2::constants::math; @@ -54,6 +57,7 @@ struct HStrangeCorrelationFilter { // master analysis switches Configurable doPPAnalysis{"doPPAnalysis", true, "if in pp, set to true"}; + Configurable useParameterization{"useParameterization", true, "ture for parameterization method, false for hist method"}; // Operational Configurable fillTableOnlyWithCompatible{"fillTableOnlyWithCompatible", true, "pre-apply dE/dx, broad mass window in table filling"}; Configurable strangedEdxNSigmaLoose{"strangedEdxNSigmaLoose", 5, "Nsigmas for strange decay daughters"}; @@ -66,68 +70,69 @@ struct HStrangeCorrelationFilter { // event filtering Configurable zorroMask{"zorroMask", "", "zorro trigger class to select on (empty: none)"}; - - // Trigger particle selections in phase space - Configurable triggerEtaMin{"triggerEtaMin", -0.8, "triggeretamin"}; - Configurable triggerEtaMax{"triggerEtaMax", 0.8, "triggeretamax"}; - Configurable triggerPtCutMin{"triggerPtCutMin", 3, "triggerptmin"}; - Configurable triggerPtCutMax{"triggerPtCutMax", 20, "triggerptmax"}; - - // Track quality - Configurable minTPCNCrossedRows{"minTPCNCrossedRows", 70, "Minimum TPC crossed rows"}; - Configurable triggerRequireITS{"triggerRequireITS", true, "require ITS signal in trigger tracks"}; - Configurable assocRequireITS{"assocRequireITS", true, "require ITS signal in assoc tracks"}; - Configurable triggerMaxTPCSharedClusters{"triggerMaxTPCSharedClusters", 200, "maximum number of shared TPC clusters (inclusive)"}; - Configurable triggerRequireL0{"triggerRequireL0", false, "require ITS L0 cluster for trigger"}; - - // Associated particle selections in phase space - Configurable assocEtaMin{"assocEtaMin", -0.8, "triggeretamin"}; - Configurable assocEtaMax{"assocEtaMax", 0.8, "triggeretamax"}; - Configurable assocPtCutMin{"assocPtCutMin", 0.2, "assocptmin"}; - Configurable assocPtCutMax{"assocPtCutMax", 10, "assocptmax"}; - - // Associated pion identification - Configurable pionMinBayesProb{"pionMinBayesProb", 0.95, "minimal Bayesian probability for pion ID"}; - Configurable assocPionNSigmaTPCFOF{"assocPionNSigmaTPCFOF", 3, "minimal n sigma in TOF and TPC for Pion ID"}; - Configurable rejectSigma{"rejectSigma", 1, "n sigma for rejecting pion candidates"}; - - // V0 selections - Configurable v0Cospa{"v0Cospa", 0.97, "V0 CosPA"}; // double -> N.B. dcos(x)/dx = 0 at x=0) - Configurable dcaV0dau{"dcaV0dau", 1.0, "DCA V0 Daughters"}; - Configurable dcaNegtopv{"dcaNegtopv", 0.06, "DCA Neg To PV"}; - Configurable dcaPostopv{"dcaPostopv", 0.06, "DCA Pos To PV"}; - Configurable v0RadiusMin{"v0RadiusMin", 0.5, "v0radius"}; - Configurable v0RadiusMax{"v0RadiusMax", 200, "v0radius"}; - // more V0 selections in PbPb - Configurable lifetimecutK0S{"lifetimecutK0S", 20, "lifetimecutK0S"}; - Configurable lifetimecutLambda{"lifetimecutLambda", 30, "lifetimecutLambda"}; - Configurable dcanegtopvK0S{"dcanegtopvK0S", 0.1, "DCA Neg To PV"}; - Configurable dcapostopvK0S{"dcapostopvK0S", 0.1, "DCA Pos To PV"}; - Configurable dcanegtopvLambda{"dcanegtopvLambda", 0.05, "DCA Neg To PV"}; - Configurable dcapostopvLambda{"dcapostopvLambda", 0.2, "DCA Pos To PV"}; - Configurable dcanegtopvAntiLambda{"dcanegtopvAntiLambda", 0.2, "DCA Neg To PV"}; - Configurable dcapostopvAntiLambda{"dcapostopvAntiLambda", 0.05, "DCA Pos To PV"}; - // original equation: lArmPt*2>TMath::Abs(lArmAlpha) only for K0S - Configurable armPodCut{"armPodCut", 5.0f, "pT * (cut) > |alpha|, AP cut. Negative: no cut"}; - - // specific selections - Configurable lambdaCospa{"lambdaCospa", 0.995, "CosPA for lambda"}; // allows for tighter selection for Lambda - - // primary particle DCAxy selections - // formula: |DCAxy| < 0.004f + (0.013f / pt) - Configurable dcaXYconstant{"dcaXYconstant", 0.004, "[0] in |DCAxy| < [0]+[1]/pT"}; - Configurable dcaXYpTdep{"dcaXYpTdep", 0.013, "[1] in |DCAxy| < [0]+[1]/pT"}; - - // cascade selections - Configurable cascadeSettingCospa{"cascadeSettingCospa", 0.95, "cascadeSettingCospa"}; - Configurable cascadeSettingDcacascdau{"cascadeSettingDcacascdau", 1.0, "cascadeSettingDcacascdau"}; - Configurable cascadeSettingDcabachtopv{"cascadeSettingDcabachtopv", 0.1, "cascadeSettingDcabachtopv"}; - Configurable cascadeSettingCascradius{"cascadeSettingCascradius", 0.5, "cascadeSettingCascradius"}; - Configurable cascadeSettingV0masswindow{"cascadeSettingV0masswindow", 0.01, "cascadeSettingV0masswindow"}; - Configurable cascadeSettingMindcav0topv{"cascadeSettingMindcav0topv", 0.01, "cascadeSettingMindcav0topv"}; + struct : ConfigurableGroup { + // Trigger particle selections in phase space + Configurable triggerEtaMin{"triggerEtaMin", -0.8, "triggeretamin"}; + Configurable triggerEtaMax{"triggerEtaMax", 0.8, "triggeretamax"}; + Configurable triggerPtCutMin{"triggerPtCutMin", 3, "triggerptmin"}; + Configurable triggerPtCutMax{"triggerPtCutMax", 20, "triggerptmax"}; + + // Track quality + Configurable minTPCNCrossedRows{"minTPCNCrossedRows", 70, "Minimum TPC crossed rows"}; + Configurable triggerRequireITS{"triggerRequireITS", true, "require ITS signal in trigger tracks"}; + Configurable assocRequireITS{"assocRequireITS", true, "require ITS signal in assoc tracks"}; + Configurable triggerMaxTPCSharedClusters{"triggerMaxTPCSharedClusters", 200, "maximum number of shared TPC clusters (inclusive)"}; + Configurable triggerRequireL0{"triggerRequireL0", false, "require ITS L0 cluster for trigger"}; + + // Associated particle selections in phase space + Configurable assocEtaMin{"assocEtaMin", -0.8, "triggeretamin"}; + Configurable assocEtaMax{"assocEtaMax", 0.8, "triggeretamax"}; + Configurable assocPtCutMin{"assocPtCutMin", 0.2, "assocptmin"}; + Configurable assocPtCutMax{"assocPtCutMax", 10, "assocptmax"}; + + // Associated pion identification + Configurable pionMinBayesProb{"pionMinBayesProb", 0.95, "minimal Bayesian probability for pion ID"}; + Configurable assocPionNSigmaTPCFOF{"assocPionNSigmaTPCFOF", 3, "minimal n sigma in TOF and TPC for Pion ID"}; + Configurable rejectSigma{"rejectSigma", 1, "n sigma for rejecting pion candidates"}; + + // V0 selections + Configurable v0Cospa{"v0Cospa", 0.97, "V0 CosPA"}; // double -> N.B. dcos(x)/dx = 0 at x=0) + Configurable dcaV0dau{"dcaV0dau", 1.0, "DCA V0 Daughters"}; + Configurable dcaNegtopv{"dcaNegtopv", 0.06, "DCA Neg To PV"}; + Configurable dcaPostopv{"dcaPostopv", 0.06, "DCA Pos To PV"}; + Configurable v0RadiusMin{"v0RadiusMin", 0.5, "v0radius"}; + Configurable v0RadiusMax{"v0RadiusMax", 200, "v0radius"}; + // more V0 selections in PbPb + Configurable lifetimecutK0S{"lifetimecutK0S", 20, "lifetimecutK0S"}; + Configurable lifetimecutLambda{"lifetimecutLambda", 30, "lifetimecutLambda"}; + Configurable dcanegtopvK0S{"dcanegtopvK0S", 0.1, "DCA Neg To PV"}; + Configurable dcapostopvK0S{"dcapostopvK0S", 0.1, "DCA Pos To PV"}; + Configurable dcanegtopvLambda{"dcanegtopvLambda", 0.05, "DCA Neg To PV"}; + Configurable dcapostopvLambda{"dcapostopvLambda", 0.2, "DCA Pos To PV"}; + Configurable dcanegtopvAntiLambda{"dcanegtopvAntiLambda", 0.2, "DCA Neg To PV"}; + Configurable dcapostopvAntiLambda{"dcapostopvAntiLambda", 0.05, "DCA Pos To PV"}; + // original equation: lArmPt*2>TMath::Abs(lArmAlpha) only for K0S + Configurable armPodCut{"armPodCut", 5.0f, "pT * (cut) > |alpha|, AP cut. Negative: no cut"}; + + // specific selections + Configurable lambdaCospa{"lambdaCospa", 0.995, "CosPA for lambda"}; // allows for tighter selection for Lambda + + // primary particle DCAxy selections + // formula: |DCAxy| < 0.004f + (0.013f / pt) + Configurable dcaXYconstant{"dcaXYconstant", 0.004, "[0] in |DCAxy| < [0]+[1]/pT"}; + Configurable dcaXYpTdep{"dcaXYpTdep", 0.013, "[1] in |DCAxy| < [0]+[1]/pT"}; + + // cascade selections + Configurable cascadeSettingCospa{"cascadeSettingCospa", 0.95, "cascadeSettingCospa"}; + Configurable cascadeSettingDcacascdau{"cascadeSettingDcacascdau", 1.0, "cascadeSettingDcacascdau"}; + Configurable cascadeSettingDcabachtopv{"cascadeSettingDcabachtopv", 0.1, "cascadeSettingDcabachtopv"}; + Configurable cascadeSettingCascradius{"cascadeSettingCascradius", 0.5, "cascadeSettingCascradius"}; + Configurable cascadeSettingV0masswindow{"cascadeSettingV0masswindow", 0.01, "cascadeSettingV0masswindow"}; + Configurable cascadeSettingMindcav0topv{"cascadeSettingMindcav0topv", 0.01, "cascadeSettingMindcav0topv"}; + } systCuts; struct : ConfigurableGroup { // cascade selections in PbPb - Configurable cascCospa{"cascCospa", 0.95, "cascCospa"}; + Configurable cascCospa{"cascCospa", 0.95, "cascCospa"}; Configurable cascDcacascdau{"cascDcacascdau", 1.0, "cascDcacascdau"}; Configurable cascDcabachtopv{"cascDcabachtopv", 0.1, "cascDcabachtopv"}; Configurable cascRadius{"cascRadius", 0.5, "cascRadius"}; @@ -143,14 +148,13 @@ struct HStrangeCorrelationFilter { Configurable dcaCacsDauPar1{"dcaCacsDauPar1", 0.5, " par for pt dep DCA cascade daughter cut, 1< p_T < 4 GeV/c"}; Configurable dcaCacsDauPar2{"dcaCacsDauPar2", 0.2, " par for pt dep DCA cascade daughter cut, p_T > 4 GeV/c"}; Configurable cascdcaV0ToPV{"cascdcaV0ToPV", 0.06, "DCA V0 To PV"}; - Configurable cascv0cospa{"cascv0cospa", 0.98, "V0 CosPA"}; + Configurable cascv0cospa{"cascv0cospa", 0.98, "V0 CosPA"}; Configurable cascv0RadiusMin{"cascv0RadiusMin", 2.5, "v0radius"}; Configurable proplifetime{"proplifetime", 3, "ctau/"}; Configurable lambdaMassWin{"lambdaMassWin", 0.005, "V0 Mass window limit"}; Configurable rejcomp{"rejcomp", 0.008, "Competing Cascade rejection"}; Configurable rapCut{"rapCut", 0.8, "Rapidity acceptance"}; } MorePbPbsystCuts; - Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository to use"}; Configurable parameterCCDBPath{"parameterCCDBPath", "Users/k/kcui/LHC25b4a/parameter", "Path of the mean and sigma"}; @@ -158,21 +162,23 @@ struct HStrangeCorrelationFilter { Configurable maxMassNSigma{"maxMassNSigma", 12.0f, "max mass region to be considered for further analysis"}; // For extracting strangeness mass QA plots - ConfigurableAxis axisPtQA{"axisPtQA", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "pt axis for QA histograms"}; - ConfigurableAxis axisK0ShortMass{"axisK0ShortMass", {200, 0.400f, 0.600f}, "Inv. Mass (GeV/c^{2})"}; - ConfigurableAxis axisLambdaMass{"axisLambdaMass", {200, 1.01f, 1.21f}, "Inv. Mass (GeV/c^{2})"}; - ConfigurableAxis axisXiMass{"axisXiMass", {200, 1.22f, 1.42f}, "Inv. Mass (GeV/c^{2})"}; - ConfigurableAxis axisOmegaMass{"axisOmegaMass", {200, 1.57f, 1.77f}, "Inv. Mass (GeV/c^{2})"}; - ConfigurableAxis axisMult{"axisMult", {VARIABLE_WIDTH, 0.0f, 0.01f, 1.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 70.0f, 100.0f}, "Centrality percentile bins"}; + struct : ConfigurableGroup { + ConfigurableAxis axisPtQA{"axisPtQA", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "pt axis for QA histograms"}; + ConfigurableAxis axisK0ShortMass{"axisK0ShortMass", {200, 0.400f, 0.600f}, "Inv. Mass (GeV/c^{2})"}; + ConfigurableAxis axisLambdaMass{"axisLambdaMass", {200, 1.01f, 1.21f}, "Inv. Mass (GeV/c^{2})"}; + ConfigurableAxis axisXiMass{"axisXiMass", {200, 1.22f, 1.42f}, "Inv. Mass (GeV/c^{2})"}; + ConfigurableAxis axisOmegaMass{"axisOmegaMass", {200, 1.57f, 1.77f}, "Inv. Mass (GeV/c^{2})"}; + ConfigurableAxis axisMult{"axisMult", {VARIABLE_WIDTH, 0.0f, 0.01f, 1.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 70.0f, 100.0f}, "Centrality percentile bins"}; + } axesConfigurations; // QA Configurable doTrueSelectionInMass{"doTrueSelectionInMass", false, "Fill mass histograms only with true primary Particles for MC"}; // Do declarative selections for DCAs, if possible - Filter preFilterTracks = nabs(aod::track::dcaXY) < dcaXYconstant + dcaXYpTdep * nabs(aod::track::signed1Pt); - Filter preFilterV0 = nabs(aod::v0data::dcapostopv) > dcaPostopv&& - nabs(aod::v0data::dcanegtopv) > dcaNegtopv&& aod::v0data::dcaV0daughters < dcaV0dau; + Filter preFilterTracks = nabs(aod::track::dcaXY) < systCuts.dcaXYconstant + systCuts.dcaXYpTdep * nabs(aod::track::signed1Pt); + Filter preFilterV0 = nabs(aod::v0data::dcapostopv) > systCuts.dcaPostopv&& + nabs(aod::v0data::dcanegtopv) > systCuts.dcaNegtopv&& aod::v0data::dcaV0daughters < systCuts.dcaV0dau; Filter preFilterCascade = - nabs(aod::cascdata::dcapostopv) > dcaPostopv&& nabs(aod::cascdata::dcanegtopv) > dcaNegtopv&& nabs(aod::cascdata::dcabachtopv) > cascadeSettingDcabachtopv&& aod::cascdata::dcaV0daughters < dcaV0dau&& aod::cascdata::dcacascdaughters < cascadeSettingDcacascdau; + nabs(aod::cascdata::dcapostopv) > systCuts.dcaPostopv&& nabs(aod::cascdata::dcanegtopv) > systCuts.dcaNegtopv&& nabs(aod::cascdata::dcabachtopv) > systCuts.cascadeSettingDcabachtopv&& aod::cascdata::dcaV0daughters < systCuts.dcaV0dau&& aod::cascdata::dcacascdaughters < systCuts.cascadeSettingCospa; // using V0LinkedTagged = soa::Join; // using CascadesLinkedTagged = soa::Join; @@ -193,7 +199,28 @@ struct HStrangeCorrelationFilter { Produces assocCascades; Produces assocHadrons; Produces assocPID; - + struct : ConfigurableGroup { + // invariant mass parametrizations + Configurable> massParsK0Mean{"massParsK0Mean", {0.495967, 0.000095, 0.001120, 0.800000}, "pars in [0]+[1]*x+[2]*std::exp(-[3]*x)"}; + Configurable> massParsK0Width{"massParsK0Width", {0.002324, 0.000600, 0.005076, 1.644687}, "pars in [0]+[1]*x+[2]*std::exp(-[3]*x)"}; + + Configurable> massParsLambdaMean{"massParsLambdaMean", {1.115554, 0.000002, -0.000311, 1.303969}, "pars in [0]+[1]*x+[2]*std::exp(-[3]*x)"}; + Configurable> massParsLambdaWidth{"massParsLambdaWidth", {0.001066, 0.000168, 0.001893, 1.407199}, "pars in [0]+[1]*x+[2]*std::exp(-[3]*x)"}; + + Configurable> massParsCascadeMean{"massParsCascadeMean", {1.322150, -0.000087, -0.000761, 0.316391}, "pars in [0]+[1]*x+[2]*std::exp(-[3]*x)"}; + Configurable> massParsCascadeWidth{"massParsCascadeWidth", {0.001269, 0.000249, 0.002790, 1.128544}, "pars in [0]+[1]*x+[2]*std::exp(-[3]*x)"}; + + Configurable> massParsOmegaMean{"massParsOmegaMean", {1.671908, -0.000000, 0.001027, 2.263832}, "pars in [0]+[1]*x+[2]*std::exp(-[3]*x)"}; + Configurable> massParsOmegaWidth{"massParsOmegaWidth", {0.001223, 0.000300, 0.040718, 2.826750}, "pars in [0]+[1]*x+[2]*std::exp(-[3]*x)"}; + } parameters; + TF1* fK0Mean = new TF1("fK0Mean", "[0]+[1]*x+[2]*std::exp(-[3]*x)"); + TF1* fK0Width = new TF1("fK0Width", "[0]+[1]*x+[2]*std::exp(-[3]*x)"); + TF1* fLambdaMean = new TF1("fLambdaMean", "[0]+[1]*x+[2]*std::exp(-[3]*x)"); + TF1* fLambdaWidth = new TF1("fLambdaWidth", "[0]+[1]*x+[2]*std::exp(-[3]*x)"); + TF1* fXiMean = new TF1("fXiMean", "[0]+[1]*x+[2]*std::exp(-[3]*x)"); + TF1* fXiWidth = new TF1("fXiWidth", "[0]+[1]*x+[2]*std::exp(-[3]*x)"); + TF1* fOmegaMean = new TF1("fomegaMean", "[0]+[1]*x+[2]*std::exp(-[3]*x)"); + TF1* fOmegaWidth = new TF1("fomegaWidth", "[0]+[1]*x+[2]*std::exp(-[3]*x)"); TH1F* hK0ShortMean; TH1F* hK0ShortWidth; TH1F* hLambdaMean; @@ -202,7 +229,6 @@ struct HStrangeCorrelationFilter { TH1F* hXiWidth; TH1F* hOmegaMean; TH1F* hOmegaWidth; - Zorro zorro; OutputObj zorroSummary{"zorroSummary"}; int mRunNumber; @@ -211,26 +237,35 @@ struct HStrangeCorrelationFilter { { zorroSummary.setObject(zorro.getZorroSummary()); mRunNumber = -1; - - hK0ShortMean = 0x0; - hK0ShortWidth = 0x0; - hLambdaMean = 0x0; - hLambdaWidth = 0x0; - hXiMean = 0x0; - hXiWidth = 0x0; - hOmegaMean = 0x0; - hOmegaWidth = 0x0; - + if (useParameterization) { + fK0Mean->SetParameters(parameters.massParsK0Mean->at(0), parameters.massParsK0Mean->at(1), parameters.massParsK0Mean->at(2), parameters.massParsK0Mean->at(3)); + fK0Width->SetParameters(parameters.massParsK0Width->at(0), parameters.massParsK0Width->at(1), parameters.massParsK0Width->at(2), parameters.massParsK0Width->at(3)); + fLambdaMean->SetParameters(parameters.massParsLambdaMean->at(0), parameters.massParsLambdaMean->at(1), parameters.massParsLambdaMean->at(2), parameters.massParsLambdaMean->at(3)); + fLambdaWidth->SetParameters(parameters.massParsLambdaWidth->at(0), parameters.massParsLambdaWidth->at(1), parameters.massParsLambdaWidth->at(2), parameters.massParsLambdaWidth->at(3)); + fXiMean->SetParameters(parameters.massParsCascadeMean->at(0), parameters.massParsCascadeMean->at(1), parameters.massParsCascadeMean->at(2), parameters.massParsCascadeMean->at(3)); + fXiWidth->SetParameters(parameters.massParsCascadeWidth->at(0), parameters.massParsCascadeWidth->at(1), parameters.massParsCascadeWidth->at(2), parameters.massParsCascadeWidth->at(3)); + fOmegaMean->SetParameters(parameters.massParsOmegaMean->at(0), parameters.massParsOmegaMean->at(1), parameters.massParsOmegaMean->at(2), parameters.massParsOmegaMean->at(3)); + fOmegaWidth->SetParameters(parameters.massParsOmegaWidth->at(0), parameters.massParsOmegaWidth->at(1), parameters.massParsOmegaWidth->at(2), parameters.massParsOmegaWidth->at(3)); + } else { + hK0ShortMean = 0x0; + hK0ShortWidth = 0x0; + hLambdaMean = 0x0; + hLambdaWidth = 0x0; + hXiMean = 0x0; + hXiWidth = 0x0; + hOmegaMean = 0x0; + hOmegaWidth = 0x0; + } if (doprocessV0s || doprocessV0sMC) { - histos.add("h3dMassK0Short", "h3dMassK0Short", kTH3F, {axisPtQA, axisK0ShortMass, axisMult}); - histos.add("h3dMassLambda", "h3dMassLambda", kTH3F, {axisPtQA, axisLambdaMass, axisMult}); - histos.add("h3dMassAntiLambda", "h3dMassAntiLambda", kTH3F, {axisPtQA, axisLambdaMass, axisMult}); + histos.add("h3dMassK0Short", "h3dMassK0Short", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisK0ShortMass, axesConfigurations.axisMult}); + histos.add("h3dMassLambda", "h3dMassLambda", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisLambdaMass, axesConfigurations.axisMult}); + histos.add("h3dMassAntiLambda", "h3dMassAntiLambda", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisLambdaMass, axesConfigurations.axisMult}); } if (doprocessCascades || doprocessCascadesMC) { - histos.add("h3dMassXiMinus", "h3dMassXiMinus", kTH3F, {axisPtQA, axisXiMass, axisMult}); - histos.add("h3dMassXiPlus", "h3dMassXiPlus", kTH3F, {axisPtQA, axisXiMass, axisMult}); - histos.add("h3dMassOmegaMinus", "h3dMassOmegaMinus", kTH3F, {axisPtQA, axisOmegaMass, axisMult}); - histos.add("h3dMassOmegaPlus", "h3dMassOmegaPlus", kTH3F, {axisPtQA, axisOmegaMass, axisMult}); + histos.add("h3dMassXiMinus", "h3dMassXiMinus", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisXiMass, axesConfigurations.axisMult}); + histos.add("h3dMassXiPlus", "h3dMassXiPlus", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisXiMass, axesConfigurations.axisMult}); + histos.add("h3dMassOmegaMinus", "h3dMassOmegaMinus", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisOmegaMass, axesConfigurations.axisMult}); + histos.add("h3dMassOmegaPlus", "h3dMassOmegaPlus", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisOmegaMass, axesConfigurations.axisMult}); } } @@ -301,23 +336,23 @@ struct HStrangeCorrelationFilter { template bool isValidTrigger(TTrack track) { - if (track.eta() > triggerEtaMax || track.eta() < triggerEtaMin) { + if (track.eta() > systCuts.triggerEtaMax || track.eta() < systCuts.triggerEtaMin) { return false; } // if (track.sign()= 1 ) {continue;} - if (track.pt() > triggerPtCutMax || track.pt() < triggerPtCutMin) { + if (track.pt() > systCuts.triggerPtCutMax || track.pt() < systCuts.triggerPtCutMin) { return false; } - if (track.tpcNClsCrossedRows() < minTPCNCrossedRows) { + if (track.tpcNClsCrossedRows() < systCuts.minTPCNCrossedRows) { return false; // crossed rows } - if (!track.hasITS() && triggerRequireITS) { + if (!track.hasITS() && systCuts.triggerRequireITS) { return false; // skip, doesn't have ITS signal (skips lots of TPC-only!) } - if (track.tpcNClsShared() > triggerMaxTPCSharedClusters) { + if (track.tpcNClsShared() > systCuts.triggerMaxTPCSharedClusters) { return false; // skip, has shared clusters } - if (!(BIT_CHECK(track.itsClusterMap(), 0)) && triggerRequireL0) { + if (!(BIT_CHECK(track.itsClusterMap(), 0)) && systCuts.triggerRequireL0) { return false; // skip, doesn't have cluster in ITS L0 } return true; @@ -325,16 +360,16 @@ struct HStrangeCorrelationFilter { template bool isValidAssocTrack(TTrack assoc) { - if (assoc.eta() > assocEtaMax || assoc.eta() < assocEtaMin) { + if (assoc.eta() > systCuts.assocEtaMax || assoc.eta() < systCuts.assocEtaMin) { return false; } - if (assoc.pt() > assocPtCutMax || assoc.pt() < assocPtCutMin) { + if (assoc.pt() > systCuts.assocPtCutMax || assoc.pt() < systCuts.assocPtCutMin) { return false; } - if (assoc.tpcNClsCrossedRows() < minTPCNCrossedRows) { + if (assoc.tpcNClsCrossedRows() < systCuts.minTPCNCrossedRows) { return false; // crossed rows } - if (!assoc.hasITS() && assocRequireITS) { + if (!assoc.hasITS() && systCuts.assocRequireITS) { return false; // skip, doesn't have ITS signal (skips lots of TPC-only!) } @@ -342,26 +377,26 @@ struct HStrangeCorrelationFilter { float nSigmaTPCTOF[8] = {-10, -10, -10, -10, -10, -10, -10, -10}; if constexpr (requires { assoc.tofSignal(); }) { if (assoc.tofSignal() > 0) { - if (std::sqrt(assoc.tofNSigmaPi() * assoc.tofNSigmaPi() + assoc.tpcNSigmaPi() * assoc.tpcNSigmaPi()) > assocPionNSigmaTPCFOF) + if (std::sqrt(assoc.tofNSigmaPi() * assoc.tofNSigmaPi() + assoc.tpcNSigmaPi() * assoc.tpcNSigmaPi()) > systCuts.assocPionNSigmaTPCFOF) return false; - if (assoc.tofNSigmaPr() < rejectSigma) + if (assoc.tofNSigmaPr() < systCuts.rejectSigma) return false; - if (assoc.tpcNSigmaPr() < rejectSigma) + if (assoc.tpcNSigmaPr() < systCuts.rejectSigma) return false; - if (assoc.tofNSigmaKa() < rejectSigma) + if (assoc.tofNSigmaKa() < systCuts.rejectSigma) return false; - if (assoc.tpcNSigmaKa() < rejectSigma) + if (assoc.tpcNSigmaKa() < systCuts.rejectSigma) return false; nSigmaTPCTOF[4] = assoc.tofNSigmaPi(); nSigmaTPCTOF[5] = assoc.tofNSigmaKa(); nSigmaTPCTOF[6] = assoc.tofNSigmaPr(); nSigmaTPCTOF[7] = assoc.tofNSigmaEl(); } else { - if (assoc.tpcNSigmaPi() > assocPionNSigmaTPCFOF) + if (assoc.tpcNSigmaPi() > systCuts.assocPionNSigmaTPCFOF) return false; - if (assoc.tpcNSigmaPr() < rejectSigma) + if (assoc.tpcNSigmaPr() < systCuts.rejectSigma) return false; - if (assoc.tpcNSigmaKa() < rejectSigma) + if (assoc.tpcNSigmaKa() < systCuts.rejectSigma) return false; } nSigmaTPCTOF[0] = assoc.tpcNSigmaPi(); @@ -419,7 +454,7 @@ struct HStrangeCorrelationFilter { if (casc.dcacascdaughters() > ptDepCut) return false; // dcaV0daughters - if (casc.dcaV0daughters() > dcaV0dau) + if (casc.dcaV0daughters() > systCuts.dcaV0dau) return false; // dcav0topv if (std::abs(casc.dcav0topv(pvx, pvy, pvz)) < MorePbPbsystCuts.cascdcaV0ToPV) @@ -635,9 +670,7 @@ struct HStrangeCorrelationFilter { void processV0s(soa::Join::iterator const& collision, DauTracks const&, soa::Filtered const& V0s, aod::BCsWithTimestamps const&) { - // Load parameters for sideband subtraction auto bc = collision.bc_as(); - initParametersFromCCDB(bc); double cent = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); // Perform basic event selection if (!collision.sel8()) { @@ -660,10 +693,10 @@ struct HStrangeCorrelationFilter { /// _________________________________________________ /// Populate table with associated V0s for (auto const& v0 : V0s) { - if (v0.v0radius() < v0RadiusMin || v0.v0radius() > v0RadiusMax || v0.eta() > assocEtaMax || v0.eta() < assocEtaMin || v0.v0cosPA() < v0Cospa) { + if (v0.v0radius() < systCuts.v0RadiusMin || v0.v0radius() > systCuts.v0RadiusMax || v0.eta() > systCuts.assocEtaMax || v0.eta() < systCuts.assocEtaMin || v0.v0cosPA() < systCuts.v0Cospa) { continue; } - if (v0.pt() > assocPtCutMax || v0.pt() < assocPtCutMin) { + if (v0.pt() > systCuts.assocPtCutMax || v0.pt() < systCuts.assocPtCutMin) { continue; } // check dE/dx compatibility @@ -674,86 +707,101 @@ struct HStrangeCorrelationFilter { auto posdau = v0.posTrack_as(); auto negdau = v0.negTrack_as(); - if (negdau.tpcNClsCrossedRows() < minTPCNCrossedRows) + if (negdau.tpcNClsCrossedRows() < systCuts.minTPCNCrossedRows) continue; - if (posdau.tpcNClsCrossedRows() < minTPCNCrossedRows) + if (posdau.tpcNClsCrossedRows() < systCuts.minTPCNCrossedRows) continue; if (std::abs(posdau.tpcNSigmaPi()) < strangedEdxNSigmaLoose && std::abs(negdau.tpcNSigmaPi()) < strangedEdxNSigmaLoose) { - if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecutK0S && - std::abs(v0.dcapostopv()) > dcapostopvK0S && std::abs(v0.dcanegtopv()) > dcanegtopvK0S && - v0.qtarm() * armPodCut > std::abs(v0.alpha()))) { + if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < systCuts.lifetimecutK0S && + std::abs(v0.dcapostopv()) > systCuts.dcapostopvK0S && std::abs(v0.dcanegtopv()) > systCuts.dcanegtopvK0S && + v0.qtarm() * systCuts.armPodCut > std::abs(v0.alpha()))) { BIT_SET(compatibleK0Short, 0); } } if (std::abs(posdau.tpcNSigmaPi()) < strangedEdxNSigma && std::abs(negdau.tpcNSigmaPi()) < strangedEdxNSigma) { - if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecutK0S && - std::abs(v0.dcapostopv()) > dcapostopvK0S && std::abs(v0.dcanegtopv()) > dcanegtopvK0S && - v0.qtarm() * armPodCut > std::abs(v0.alpha()))) { + if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < systCuts.lifetimecutK0S && + std::abs(v0.dcapostopv()) > systCuts.dcapostopvK0S && std::abs(v0.dcanegtopv()) > systCuts.dcanegtopvK0S && + v0.qtarm() * systCuts.armPodCut > std::abs(v0.alpha()))) { BIT_SET(compatibleK0Short, 1); } } if (std::abs(posdau.tpcNSigmaPi()) < strangedEdxNSigmaTight && std::abs(negdau.tpcNSigmaPi()) < strangedEdxNSigmaTight) { - if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecutK0S && - std::abs(v0.dcapostopv()) > dcapostopvK0S && std::abs(v0.dcanegtopv()) > dcanegtopvK0S && - v0.qtarm() * armPodCut > std::abs(v0.alpha()))) { + if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < systCuts.lifetimecutK0S && + std::abs(v0.dcapostopv()) > systCuts.dcapostopvK0S && std::abs(v0.dcanegtopv()) > systCuts.dcanegtopvK0S && + v0.qtarm() * systCuts.armPodCut > std::abs(v0.alpha()))) { BIT_SET(compatibleK0Short, 2); } } if (std::abs(posdau.tpcNSigmaPr()) < strangedEdxNSigmaLoose && std::abs(negdau.tpcNSigmaPi()) < strangedEdxNSigmaLoose) { - if (v0.v0cosPA() > lambdaCospa) { - if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecutLambda && - std::abs(v0.dcapostopv()) > dcapostopvLambda && std::abs(v0.dcanegtopv()) > dcanegtopvLambda)) { + if (v0.v0cosPA() > systCuts.lambdaCospa) { + if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < systCuts.lifetimecutLambda && + std::abs(v0.dcapostopv()) > systCuts.dcapostopvLambda && std::abs(v0.dcanegtopv()) > systCuts.dcanegtopvLambda)) { BIT_SET(compatibleLambda, 0); } } } if (std::abs(posdau.tpcNSigmaPr()) < strangedEdxNSigma && std::abs(negdau.tpcNSigmaPi()) < strangedEdxNSigma) { - if (v0.v0cosPA() > lambdaCospa) { - if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecutLambda && - std::abs(v0.dcapostopv()) > dcapostopvLambda && std::abs(v0.dcanegtopv()) > dcanegtopvLambda)) { + if (v0.v0cosPA() > systCuts.lambdaCospa) { + if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < systCuts.lifetimecutLambda && + std::abs(v0.dcapostopv()) > systCuts.dcapostopvLambda && std::abs(v0.dcanegtopv()) > systCuts.dcanegtopvLambda)) { BIT_SET(compatibleLambda, 1); } } } if (std::abs(posdau.tpcNSigmaPr()) < strangedEdxNSigmaTight && std::abs(negdau.tpcNSigmaPi()) < strangedEdxNSigmaTight) { - if (v0.v0cosPA() > lambdaCospa) { - if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecutLambda && - std::abs(v0.dcapostopv()) > dcapostopvLambda && std::abs(v0.dcanegtopv()) > dcanegtopvLambda)) { + if (v0.v0cosPA() > systCuts.lambdaCospa) { + if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < systCuts.lifetimecutLambda && + std::abs(v0.dcapostopv()) > systCuts.dcapostopvLambda && std::abs(v0.dcanegtopv()) > systCuts.dcanegtopvLambda)) { BIT_SET(compatibleLambda, 2); } } } if (std::abs(posdau.tpcNSigmaPi()) < strangedEdxNSigmaLoose && std::abs(negdau.tpcNSigmaPr()) < strangedEdxNSigmaLoose) { - if (v0.v0cosPA() > lambdaCospa) { - if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecutLambda && - std::abs(v0.dcapostopv()) > dcapostopvAntiLambda && std::abs(v0.dcanegtopv()) > dcanegtopvAntiLambda)) { + if (v0.v0cosPA() > systCuts.lambdaCospa) { + if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < systCuts.lifetimecutLambda && + std::abs(v0.dcapostopv()) > systCuts.dcapostopvAntiLambda && std::abs(v0.dcanegtopv()) > systCuts.dcanegtopvAntiLambda)) { BIT_SET(compatibleAntiLambda, 0); } } } if (std::abs(posdau.tpcNSigmaPi()) < strangedEdxNSigma && std::abs(negdau.tpcNSigmaPr()) < strangedEdxNSigma) { - if (v0.v0cosPA() > lambdaCospa) { - if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecutLambda && - std::abs(v0.dcapostopv()) > dcapostopvAntiLambda && std::abs(v0.dcanegtopv()) > dcanegtopvAntiLambda)) { + if (v0.v0cosPA() > systCuts.lambdaCospa) { + if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < systCuts.lifetimecutLambda && + std::abs(v0.dcapostopv()) > systCuts.dcapostopvAntiLambda && std::abs(v0.dcanegtopv()) > systCuts.dcanegtopvAntiLambda)) { BIT_SET(compatibleAntiLambda, 1); } } } if (std::abs(posdau.tpcNSigmaPi()) < strangedEdxNSigmaTight && std::abs(negdau.tpcNSigmaPr()) < strangedEdxNSigmaTight) { - if (v0.v0cosPA() > lambdaCospa) { - if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecutLambda && - std::abs(v0.dcapostopv()) > dcapostopvAntiLambda && std::abs(v0.dcanegtopv()) > dcanegtopvAntiLambda)) { + if (v0.v0cosPA() > systCuts.lambdaCospa) { + if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < systCuts.lifetimecutLambda && + std::abs(v0.dcapostopv()) > systCuts.dcapostopvAntiLambda && std::abs(v0.dcanegtopv()) > systCuts.dcanegtopvAntiLambda)) { BIT_SET(compatibleAntiLambda, 2); } } } - - // simplified handling: calculate NSigma in mass here - float massNSigmaK0Short = (v0.mK0Short() - hK0ShortMean->Interpolate(v0.pt())) / (hK0ShortWidth->Interpolate(v0.pt()) + 1e-6); - float massNSigmaLambda = (v0.mLambda() - hLambdaMean->Interpolate(v0.pt())) / (hLambdaWidth->Interpolate(v0.pt()) + 1e-6); - float massNSigmaAntiLambda = (v0.mAntiLambda() - hLambdaMean->Interpolate(v0.pt())) / (hLambdaWidth->Interpolate(v0.pt()) + 1e-6); - + float massNSigmaK0Short = -20.0f; + float massNSigmaLambda = -20.0f; + float massNSigmaAntiLambda = -20.0f; + if (useParameterization) { + massNSigmaK0Short = (v0.mK0Short() - fK0Mean->Eval(v0.pt())) / (fK0Width->Eval(v0.pt()) + 1e-6); + massNSigmaLambda = (v0.mLambda() - fLambdaMean->Eval(v0.pt())) / (fLambdaWidth->Eval(v0.pt()) + 1e-6); + massNSigmaAntiLambda = (v0.mAntiLambda() - fLambdaMean->Eval(v0.pt())) / (fLambdaWidth->Eval(v0.pt()) + 1e-6); + } else { + // Load parameters for sideband subtraction + initParametersFromCCDB(bc); + // simplified handling: calculate NSigma in mass here + if (v0.pt() < 0.2f || v0.pt() > 14.5f) { + massNSigmaK0Short = (v0.mK0Short() - hK0ShortMean->GetBinContent(hK0ShortMean->FindBin(v0.pt()))) / (hK0ShortWidth->GetBinContent(hK0ShortWidth->FindBin(v0.pt())) + 1e-6); + massNSigmaLambda = (v0.mLambda() - hLambdaMean->GetBinContent(hLambdaMean->FindBin(v0.pt()))) / (hLambdaWidth->GetBinContent(hLambdaMean->FindBin(v0.pt())) + 1e-6); + massNSigmaAntiLambda = (v0.mAntiLambda() - hLambdaMean->GetBinContent(hLambdaMean->FindBin(v0.pt()))) / (hLambdaWidth->GetBinContent(hLambdaMean->FindBin(v0.pt())) + 1e-6); + } else { + massNSigmaK0Short = (v0.mK0Short() - hK0ShortMean->Interpolate(v0.pt())) / (hK0ShortWidth->Interpolate(v0.pt()) + 1e-6); + massNSigmaLambda = (v0.mLambda() - hLambdaMean->Interpolate(v0.pt())) / (hLambdaWidth->Interpolate(v0.pt()) + 1e-6); + massNSigmaAntiLambda = (v0.mAntiLambda() - hLambdaMean->Interpolate(v0.pt())) / (hLambdaWidth->Interpolate(v0.pt()) + 1e-6); + } + } if (compatibleK0Short) histos.fill(HIST("h3dMassK0Short"), v0.pt(), v0.mK0Short(), cent); if (compatibleLambda) @@ -778,9 +826,7 @@ struct HStrangeCorrelationFilter { void processV0sMC(soa::Join::iterator const& collision, DauTracksMC const&, soa::Filtered const& V0s, aod::McParticles const&, aod::BCsWithTimestamps const&) { double cent = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); - // Load parameters for sideband subtraction auto bc = collision.bc_as(); - initParametersFromCCDB(bc); // Perform basic event selection if (!collision.sel8()) { return; @@ -802,10 +848,10 @@ struct HStrangeCorrelationFilter { /// Populate table with associated V0s for (auto const& v0 : V0s) { - if (v0.v0radius() < v0RadiusMin || v0.v0radius() > v0RadiusMax || v0.eta() > assocEtaMax || v0.eta() < assocEtaMin || v0.v0cosPA() < v0Cospa) { + if (v0.v0radius() < systCuts.v0RadiusMin || v0.v0radius() > systCuts.v0RadiusMax || v0.eta() > systCuts.assocEtaMax || v0.eta() < systCuts.assocEtaMin || v0.v0cosPA() < systCuts.v0Cospa) { continue; } - if (v0.pt() > assocPtCutMax || v0.pt() < assocPtCutMin) { + if (v0.pt() > systCuts.assocPtCutMax || v0.pt() < systCuts.assocPtCutMin) { continue; } // check dE/dx compatibility @@ -816,85 +862,102 @@ struct HStrangeCorrelationFilter { auto posdau = v0.posTrack_as(); auto negdau = v0.negTrack_as(); - if (negdau.tpcNClsCrossedRows() < minTPCNCrossedRows) + if (negdau.tpcNClsCrossedRows() < systCuts.minTPCNCrossedRows) continue; - if (posdau.tpcNClsCrossedRows() < minTPCNCrossedRows) + if (posdau.tpcNClsCrossedRows() < systCuts.minTPCNCrossedRows) continue; if (std::abs(posdau.tpcNSigmaPi()) < strangedEdxNSigmaLoose && std::abs(negdau.tpcNSigmaPi()) < strangedEdxNSigmaLoose) { - if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecutK0S && - std::abs(v0.dcapostopv()) > dcapostopvK0S && std::abs(v0.dcanegtopv()) > dcanegtopvK0S && - v0.qtarm() * armPodCut > std::abs(v0.alpha()))) { + if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < systCuts.lifetimecutK0S && + std::abs(v0.dcapostopv()) > systCuts.dcapostopvK0S && std::abs(v0.dcanegtopv()) > systCuts.dcanegtopvK0S && + v0.qtarm() * systCuts.armPodCut > std::abs(v0.alpha()))) { BIT_SET(compatibleK0Short, 0); } } if (std::abs(posdau.tpcNSigmaPi()) < strangedEdxNSigma && std::abs(negdau.tpcNSigmaPi()) < strangedEdxNSigma) { - if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecutK0S && - std::abs(v0.dcapostopv()) > dcapostopvK0S && std::abs(v0.dcanegtopv()) > dcanegtopvK0S && - v0.qtarm() * armPodCut > std::abs(v0.alpha()))) { + if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < systCuts.lifetimecutK0S && + std::abs(v0.dcapostopv()) > systCuts.dcapostopvK0S && std::abs(v0.dcanegtopv()) > systCuts.dcanegtopvK0S && + v0.qtarm() * systCuts.armPodCut > std::abs(v0.alpha()))) { BIT_SET(compatibleK0Short, 1); } } if (std::abs(posdau.tpcNSigmaPi()) < strangedEdxNSigmaTight && std::abs(negdau.tpcNSigmaPi()) < strangedEdxNSigmaTight) { - if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecutK0S && - std::abs(v0.dcapostopv()) > dcapostopvK0S && std::abs(v0.dcanegtopv()) > dcanegtopvK0S && - v0.qtarm() * armPodCut > std::abs(v0.alpha()))) { + if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < systCuts.lifetimecutK0S && + std::abs(v0.dcapostopv()) > systCuts.dcapostopvK0S && std::abs(v0.dcanegtopv()) > systCuts.dcanegtopvK0S && + v0.qtarm() * systCuts.armPodCut > std::abs(v0.alpha()))) { BIT_SET(compatibleK0Short, 2); } } if (std::abs(posdau.tpcNSigmaPr()) < strangedEdxNSigmaLoose && std::abs(negdau.tpcNSigmaPi()) < strangedEdxNSigmaLoose) { - if (v0.v0cosPA() > lambdaCospa) { - if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecutLambda && - std::abs(v0.dcapostopv()) > dcapostopvLambda && std::abs(v0.dcanegtopv()) > dcanegtopvLambda)) { + if (v0.v0cosPA() > systCuts.lambdaCospa) { + if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < systCuts.lifetimecutLambda && + std::abs(v0.dcapostopv()) > systCuts.dcapostopvLambda && std::abs(v0.dcanegtopv()) > systCuts.dcanegtopvLambda)) { BIT_SET(compatibleLambda, 0); } } } if (std::abs(posdau.tpcNSigmaPr()) < strangedEdxNSigma && std::abs(negdau.tpcNSigmaPi()) < strangedEdxNSigma) { - if (v0.v0cosPA() > lambdaCospa) { - if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecutLambda && - std::abs(v0.dcapostopv()) > dcapostopvLambda && std::abs(v0.dcanegtopv()) > dcanegtopvLambda)) { + if (v0.v0cosPA() > systCuts.lambdaCospa) { + if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < systCuts.lifetimecutLambda && + std::abs(v0.dcapostopv()) > systCuts.dcapostopvLambda && std::abs(v0.dcanegtopv()) > systCuts.dcanegtopvLambda)) { BIT_SET(compatibleLambda, 1); } } } if (std::abs(posdau.tpcNSigmaPr()) < strangedEdxNSigmaTight && std::abs(negdau.tpcNSigmaPi()) < strangedEdxNSigmaTight) { - if (v0.v0cosPA() > lambdaCospa) { - if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecutLambda && - std::abs(v0.dcapostopv()) > dcapostopvLambda && std::abs(v0.dcanegtopv()) > dcanegtopvLambda)) { + if (v0.v0cosPA() > systCuts.lambdaCospa) { + if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < systCuts.lifetimecutLambda && + std::abs(v0.dcapostopv()) > systCuts.dcapostopvLambda && std::abs(v0.dcanegtopv()) > systCuts.dcanegtopvLambda)) { BIT_SET(compatibleLambda, 2); } } } if (std::abs(posdau.tpcNSigmaPi()) < strangedEdxNSigmaLoose && std::abs(negdau.tpcNSigmaPr()) < strangedEdxNSigmaLoose) { - if (v0.v0cosPA() > lambdaCospa) { - if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecutLambda && - std::abs(v0.dcapostopv()) > dcapostopvAntiLambda && std::abs(v0.dcanegtopv()) > dcanegtopvAntiLambda)) { + if (v0.v0cosPA() > systCuts.lambdaCospa) { + if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < systCuts.lifetimecutLambda && + std::abs(v0.dcapostopv()) > systCuts.dcapostopvAntiLambda && std::abs(v0.dcanegtopv()) > systCuts.dcanegtopvAntiLambda)) { BIT_SET(compatibleAntiLambda, 0); } } } if (std::abs(posdau.tpcNSigmaPi()) < strangedEdxNSigma && std::abs(negdau.tpcNSigmaPr()) < strangedEdxNSigma) { - if (v0.v0cosPA() > lambdaCospa) { - if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecutLambda && - std::abs(v0.dcapostopv()) > dcapostopvAntiLambda && std::abs(v0.dcanegtopv()) > dcanegtopvAntiLambda)) { + if (v0.v0cosPA() > systCuts.lambdaCospa) { + if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < systCuts.lifetimecutLambda && + std::abs(v0.dcapostopv()) > systCuts.dcapostopvAntiLambda && std::abs(v0.dcanegtopv()) > systCuts.dcanegtopvAntiLambda)) { BIT_SET(compatibleAntiLambda, 1); } } } if (std::abs(posdau.tpcNSigmaPi()) < strangedEdxNSigmaTight && std::abs(negdau.tpcNSigmaPr()) < strangedEdxNSigmaTight) { - if (v0.v0cosPA() > lambdaCospa) { - if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecutLambda && - std::abs(v0.dcapostopv()) > dcapostopvAntiLambda && std::abs(v0.dcanegtopv()) > dcanegtopvAntiLambda)) { + if (v0.v0cosPA() > systCuts.lambdaCospa) { + if (doPPAnalysis || (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < systCuts.lifetimecutLambda && + std::abs(v0.dcapostopv()) > systCuts.dcapostopvAntiLambda && std::abs(v0.dcanegtopv()) > systCuts.dcanegtopvAntiLambda)) { BIT_SET(compatibleAntiLambda, 2); } } } - // simplified handling: calculate NSigma in mass here - float massNSigmaK0Short = (v0.mK0Short() - hK0ShortMean->Interpolate(v0.pt())) / (hK0ShortWidth->Interpolate(v0.pt()) + 1e-6); - float massNSigmaLambda = (v0.mLambda() - hLambdaMean->Interpolate(v0.pt())) / (hLambdaWidth->Interpolate(v0.pt()) + 1e-6); - float massNSigmaAntiLambda = (v0.mAntiLambda() - hLambdaMean->Interpolate(v0.pt())) / (hLambdaWidth->Interpolate(v0.pt()) + 1e-6); + float massNSigmaK0Short = -20.0f; + float massNSigmaLambda = -20.0f; + float massNSigmaAntiLambda = -20.0f; + if (useParameterization) { + massNSigmaK0Short = (v0.mK0Short() - fK0Mean->Eval(v0.pt())) / (fK0Width->Eval(v0.pt()) + 1e-6); + massNSigmaLambda = (v0.mLambda() - fLambdaMean->Eval(v0.pt())) / (fLambdaWidth->Eval(v0.pt()) + 1e-6); + massNSigmaAntiLambda = (v0.mAntiLambda() - fLambdaMean->Eval(v0.pt())) / (fLambdaWidth->Eval(v0.pt()) + 1e-6); + } else { + // Load parameters for sideband subtraction + initParametersFromCCDB(bc); + // simplified handling: calculate NSigma in mass here + if (v0.pt() < 0.2f || v0.pt() > 14.5f) { + massNSigmaK0Short = (v0.mK0Short() - hK0ShortMean->GetBinContent(hK0ShortMean->FindBin(v0.pt()))) / (hK0ShortWidth->GetBinContent(hK0ShortWidth->FindBin(v0.pt())) + 1e-6); + massNSigmaLambda = (v0.mLambda() - hLambdaMean->GetBinContent(hLambdaMean->FindBin(v0.pt()))) / (hLambdaWidth->GetBinContent(hLambdaMean->FindBin(v0.pt())) + 1e-6); + massNSigmaAntiLambda = (v0.mAntiLambda() - hLambdaMean->GetBinContent(hLambdaMean->FindBin(v0.pt()))) / (hLambdaWidth->GetBinContent(hLambdaMean->FindBin(v0.pt())) + 1e-6); + } else { + massNSigmaK0Short = (v0.mK0Short() - hK0ShortMean->Interpolate(v0.pt())) / (hK0ShortWidth->Interpolate(v0.pt()) + 1e-6); + massNSigmaLambda = (v0.mLambda() - hLambdaMean->Interpolate(v0.pt())) / (hLambdaWidth->Interpolate(v0.pt()) + 1e-6); + massNSigmaAntiLambda = (v0.mAntiLambda() - hLambdaMean->Interpolate(v0.pt())) / (hLambdaWidth->Interpolate(v0.pt()) + 1e-6); + } + } bool v0PhysicalPrimary = false; bool trueK0Short = false; bool trueLambda = false; @@ -930,9 +993,7 @@ struct HStrangeCorrelationFilter { void processCascades(soa::Join::iterator const& collision, DauTracks const&, soa::Filtered const& /*V0s*/, soa::Filtered const& Cascades, aod::BCsWithTimestamps const&) { double cent = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); - // Load parameters for sideband subtraction auto bc = collision.bc_as(); - initParametersFromCCDB(bc); // Perform basic event selection if (!collision.sel8()) { return; @@ -953,10 +1014,10 @@ struct HStrangeCorrelationFilter { /// _________________________________________________ /// Step 3: Populate table with associated Cascades for (auto const& casc : Cascades) { - if (casc.eta() > assocEtaMax || casc.eta() < assocEtaMin) { + if (casc.eta() > systCuts.assocEtaMax || casc.eta() < systCuts.assocEtaMin) { continue; } - if (casc.pt() > assocPtCutMax || casc.pt() < assocPtCutMin) { + if (casc.pt() > systCuts.assocPtCutMax || casc.pt() < systCuts.assocPtCutMin) { continue; } auto bachTrackCast = casc.bachelor_as(); @@ -964,11 +1025,11 @@ struct HStrangeCorrelationFilter { auto negTrackCast = casc.negTrack_as(); // minimum TPC crossed rows - if (bachTrackCast.tpcNClsCrossedRows() < minTPCNCrossedRows) + if (bachTrackCast.tpcNClsCrossedRows() < systCuts.minTPCNCrossedRows) continue; - if (posTrackCast.tpcNClsCrossedRows() < minTPCNCrossedRows) + if (posTrackCast.tpcNClsCrossedRows() < systCuts.minTPCNCrossedRows) continue; - if (negTrackCast.tpcNClsCrossedRows() < minTPCNCrossedRows) + if (negTrackCast.tpcNClsCrossedRows() < systCuts.minTPCNCrossedRows) continue; if (!doPPAnalysis && !CascadeSelectedPbPb(casc, collision.posX(), collision.posY(), collision.posZ())) continue; @@ -1069,10 +1130,22 @@ struct HStrangeCorrelationFilter { BIT_SET(compatibleOmegaPlus, 2); } } - - float massNSigmaXi = (casc.mXi() - -hXiMean->Interpolate(casc.pt())) / (hXiWidth->Interpolate(casc.pt()) + 1e-6); - float massNSigmaOmega = (casc.mOmega() - hOmegaMean->Interpolate(casc.pt())) / (hOmegaWidth->Interpolate(casc.pt()) + 1e-6); - + float massNSigmaXi = -20.0f; + float massNSigmaOmega = -20.0f; + if (useParameterization) { + massNSigmaXi = (casc.mXi() - fXiMean->Eval(casc.pt())) / (fXiWidth->Eval(casc.pt()) + 1e-6); + massNSigmaOmega = (casc.mOmega() - fOmegaMean->Eval(casc.pt())) / (fOmegaWidth->Eval(casc.pt()) + 1e-6); + } else { + // Load parameters for sideband subtraction + initParametersFromCCDB(bc); + if (casc.pt() < 0.2f || casc.pt() > 14.5f) { + massNSigmaXi = (casc.mXi() - hXiMean->GetBinContent(hXiMean->FindBin(casc.pt()))) / (hXiWidth->GetBinContent(hXiWidth->FindBin(casc.pt())) + 1e-6); + massNSigmaOmega = (casc.mOmega() - hOmegaMean->GetBinContent(hOmegaMean->FindBin(casc.pt()))) / (hOmegaWidth->GetBinContent(hOmegaWidth->FindBin(casc.pt())) + 1e-6); + } else { + massNSigmaXi = (casc.mXi() - hXiMean->Interpolate(casc.pt())) / (hXiWidth->Interpolate(casc.pt()) + 1e-6); + massNSigmaOmega = (casc.mOmega() - hOmegaMean->Interpolate(casc.pt())) / (hOmegaWidth->Interpolate(casc.pt()) + 1e-6); + } + } if (compatibleXiMinus) histos.fill(HIST("h3dMassXiMinus"), casc.pt(), casc.mXi(), cent); if (compatibleXiPlus) @@ -1098,9 +1171,7 @@ struct HStrangeCorrelationFilter { void processCascadesMC(soa::Join::iterator const& collision, DauTracks const&, soa::Filtered const& /*V0s*/, soa::Filtered const& Cascades, aod::McParticles const&, aod::BCsWithTimestamps const&) { double cent = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); - // Load parameters for sideband subtraction auto bc = collision.bc_as(); - initParametersFromCCDB(bc); // Perform basic event selection if (!collision.sel8()) { return; @@ -1121,10 +1192,10 @@ struct HStrangeCorrelationFilter { /// _________________________________________________ /// Step 3: Populate table with associated Cascades for (auto const& casc : Cascades) { - if (casc.eta() > assocEtaMax || casc.eta() < assocEtaMin) { + if (casc.eta() > systCuts.assocEtaMax || casc.eta() < systCuts.assocEtaMin) { continue; } - if (casc.pt() > assocPtCutMax || casc.pt() < assocPtCutMin) { + if (casc.pt() > systCuts.assocPtCutMax || casc.pt() < systCuts.assocPtCutMin) { continue; } auto bachTrackCast = casc.bachelor_as(); @@ -1132,11 +1203,11 @@ struct HStrangeCorrelationFilter { auto negTrackCast = casc.negTrack_as(); // minimum TPC crossed rows - if (bachTrackCast.tpcNClsCrossedRows() < minTPCNCrossedRows) + if (bachTrackCast.tpcNClsCrossedRows() < systCuts.minTPCNCrossedRows) continue; - if (posTrackCast.tpcNClsCrossedRows() < minTPCNCrossedRows) + if (posTrackCast.tpcNClsCrossedRows() < systCuts.minTPCNCrossedRows) continue; - if (negTrackCast.tpcNClsCrossedRows() < minTPCNCrossedRows) + if (negTrackCast.tpcNClsCrossedRows() < systCuts.minTPCNCrossedRows) continue; if (!doPPAnalysis && !CascadeSelectedPbPb(casc, collision.posX(), collision.posY(), collision.posZ())) continue; @@ -1238,9 +1309,22 @@ struct HStrangeCorrelationFilter { BIT_SET(compatibleOmegaPlus, 2); } } - - float massNSigmaXi = (casc.mXi() - -hXiMean->Interpolate(casc.pt())) / (hXiWidth->Interpolate(casc.pt()) + 1e-6); - float massNSigmaOmega = (casc.mOmega() - hOmegaMean->Interpolate(casc.pt())) / (hOmegaWidth->Interpolate(casc.pt()) + 1e-6); + float massNSigmaXi = 20.0f; + float massNSigmaOmega = 20.0f; + if (useParameterization) { + massNSigmaXi = (casc.mXi() - fXiMean->Eval(casc.pt())) / (fXiWidth->Eval(casc.pt()) + 1e-6); + massNSigmaOmega = (casc.mOmega() - fOmegaMean->Eval(casc.pt())) / (fOmegaWidth->Eval(casc.pt()) + 1e-6); + } else { + // Load parameters for sideband subtraction + initParametersFromCCDB(bc); + if (casc.pt() < 0.2f || casc.pt() > 14.5f) { + massNSigmaXi = (casc.mXi() - hXiMean->GetBinContent(hXiMean->FindBin(casc.pt()))) / (hXiWidth->GetBinContent(hXiWidth->FindBin(casc.pt())) + 1e-6); + massNSigmaOmega = (casc.mOmega() - hOmegaMean->GetBinContent(hOmegaMean->FindBin(casc.pt()))) / (hOmegaWidth->GetBinContent(hOmegaWidth->FindBin(casc.pt())) + 1e-6); + } else { + massNSigmaXi = (casc.mXi() - hXiMean->Interpolate(casc.pt())) / (hXiWidth->Interpolate(casc.pt()) + 1e-6); + massNSigmaOmega = (casc.mOmega() - hOmegaMean->Interpolate(casc.pt())) / (hOmegaWidth->Interpolate(casc.pt()) + 1e-6); + } + } bool cascPhysicalPrimary = false; bool trueXiMinus = false; From 6ffa8f23d406cabcc528e871fb01b022e457cb29 Mon Sep 17 00:00:00 2001 From: ariedel-cern <85537041+ariedel-cern@users.noreply.github.com> Date: Sat, 25 Oct 2025 09:05:32 +0200 Subject: [PATCH 884/986] [PWGCF] Update femto framework (#13536) --- PWGCF/Femto/Core/baseSelection.h | 18 --- PWGCF/Femto/Core/cascadeHistManager.h | 12 +- PWGCF/Femto/Core/closePairRejection.h | 32 ++++-- PWGCF/Femto/Core/collisionBuilder.h | 2 +- PWGCF/Femto/Core/kinkHistManager.h | 4 +- PWGCF/Femto/Core/pairBuilder.h | 36 +++--- PWGCF/Femto/Core/pairHistManager.h | 6 +- PWGCF/Femto/Core/pairProcessHelpers.h | 104 +----------------- PWGCF/Femto/Core/partitions.h | 6 +- PWGCF/Femto/Core/trackBuilder.h | 10 +- PWGCF/Femto/Core/twoTrackResonanceBuilder.h | 4 +- .../Femto/Core/twoTrackResonanceHistManager.h | 7 +- PWGCF/Femto/Core/v0Builder.h | 8 +- PWGCF/Femto/Core/v0HistManager.h | 7 +- PWGCF/Femto/DataModel/FemtoTables.h | 43 ++++---- PWGCF/Femto/TableProducer/femtoProducer.cxx | 6 +- .../femtoProducerDerivedToDerived.cxx | 6 +- PWGCF/Femto/Tasks/femtoCascadeQa.cxx | 32 +++--- PWGCF/Femto/Tasks/femtoKinkQa.cxx | 23 ++-- PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx | 6 +- PWGCF/Femto/Tasks/femtoPairTrackKink.cxx | 4 +- PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx | 2 +- .../Tasks/femtoPairTrackTwoTrackResonance.cxx | 8 +- PWGCF/Femto/Tasks/femtoPairTrackV0.cxx | 6 +- PWGCF/Femto/Tasks/femtoPairV0V0.cxx | 4 +- PWGCF/Femto/Tasks/femtoTrackQa.cxx | 20 ++-- .../Femto/Tasks/femtoTwotrackresonanceQa.cxx | 42 ++++--- PWGCF/Femto/Tasks/femtoV0Qa.cxx | 30 +++-- 28 files changed, 191 insertions(+), 297 deletions(-) diff --git a/PWGCF/Femto/Core/baseSelection.h b/PWGCF/Femto/Core/baseSelection.h index d85829beb7a..f5487262912 100644 --- a/PWGCF/Femto/Core/baseSelection.h +++ b/PWGCF/Femto/Core/baseSelection.h @@ -259,25 +259,7 @@ class BaseSelection template void setBitmask(int observableIndex, R bitmask) { - // if there are no selections configured, bail out - if (mSelectionContainers.at(observableIndex).isEmpty()) { - return; - } - // if any previous observable did not pass minimal selections, there is no point in setting bitmask for other observables - // minimal selection for each observable is computed after adding it - if (mPassesMinimalSelections == false) { - return; - } - // set bitmask for given observable mSelectionContainers.at(observableIndex).setBitmask(bitmask); - // check if minimal selction for this observable holds - if (mSelectionContainers.at(observableIndex).passesAsMinimalCut() == false) { - mPassesMinimalSelections = false; - } - // check if any optional selection holds - if (mSelectionContainers.at(observableIndex).passesAsOptionalCut() == true) { - mPassesOptionalSelections = true; - } } /// \brief Print detailed information about all configured selections. diff --git a/PWGCF/Femto/Core/cascadeHistManager.h b/PWGCF/Femto/Core/cascadeHistManager.h index 3429a9de3c2..4619b30ae26 100644 --- a/PWGCF/Femto/Core/cascadeHistManager.h +++ b/PWGCF/Femto/Core/cascadeHistManager.h @@ -216,13 +216,17 @@ class CascadeHistManager template void fill(T1 const& cascadeCandidate, T2 const& tracks) { + // this used to work, still under investigation + // auto bachelor = cascadeCandidate.template bachelor_as(); + // auto posDaughter = cascadeCandidate.template posDau_as(); + // auto negDaughter = cascadeCandidate.template negDau_as(); - auto bachelor = cascadeCandidate.template bachelor_as(); - mBachelorManager.fill(bachelor, tracks); - auto posDaughter = cascadeCandidate.template posDau_as(); + auto posDaughter = tracks.rawIteratorAt(cascadeCandidate.posDauId() - tracks.offset()); mPosDauManager.fill(posDaughter, tracks); - auto negDaughter = cascadeCandidate.template negDau_as(); + auto negDaughter = tracks.rawIteratorAt(cascadeCandidate.negDauId() - tracks.offset()); mNegDauManager.fill(negDaughter, tracks); + auto bachelor = tracks.rawIteratorAt(cascadeCandidate.bachelorId() - tracks.offset()); + mBachelorManager.fill(bachelor, tracks); if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kPt, HistTable)), cascadeCandidate.pt()); diff --git a/PWGCF/Femto/Core/closePairRejection.h b/PWGCF/Femto/Core/closePairRejection.h index 3cf20930ef4..0ea82363337 100644 --- a/PWGCF/Femto/Core/closePairRejection.h +++ b/PWGCF/Femto/Core/closePairRejection.h @@ -243,13 +243,17 @@ class ClosePairRejectionV0V0 mCtrNeg.setMagField(magField); } template - void setPair(T1 const& v01, T2 const& v02, T3 const& /*tracks*/) + void setPair(T1 const& v01, T2 const& v02, T3 const& tracks) { - auto posDau1 = v01.template posDau_as(); - auto negDau1 = v01.template posDau_as(); + // auto posDau1 = v01.template posDau_as(); + // auto negDau1 = v01.template posDau_as(); + auto posDau1 = tracks.rawIteratorAt(v01.posDauId() - tracks.offset()); + auto negDau1 = tracks.rawIteratorAt(v01.negDauId() - tracks.offset()); - auto posDau2 = v02.template posDau_as(); - auto negDau2 = v02.template posDau_as(); + // auto posDau2 = v02.template posDau_as(); + // auto negDau2 = v02.template posDau_as(); + auto posDau2 = tracks.rawIteratorAt(v02.posDauId() - tracks.offset()); + auto negDau2 = tracks.rawIteratorAt(v02.negDauId() - tracks.offset()); mCtrPos.compute(posDau1, posDau2); mCtrNeg.compute(negDau1, negDau2); @@ -287,13 +291,15 @@ class ClosePairRejectionTrackV0 // can also be used for any particle type that h mCtr.setMagField(magField); } template - void setPair(const T1& track, const T2& v0, const T3 /*trackTable*/) + void setPair(const T1& track, const T2& v0, const T3 trackTable) { if (track.signedPt() > 0) { - auto daughter = v0.template posDau_as(); + // auto daughter = v0.template posDau_as(); + auto daughter = trackTable.rawIteratorAt(v0.posDauId() - trackTable.offset()); mCtr.compute(track, daughter); } else { - auto daughter = v0.template negDau_as(); + // auto daughter = v0.template negDau_as(); + auto daughter = trackTable.rawIteratorAt(v0.negDauId() - trackTable.offset()); mCtr.compute(track, daughter); } } @@ -328,9 +334,10 @@ class ClosePairRejectionTrackCascade mCtr.setMagField(magField); } template - void setPair(const T1& track, const T2& cascade, const T3 /*trackTable*/) + void setPair(const T1& track, const T2& cascade, const T3 trackTable) { - auto bachelor = cascade.template posDau_as(); + // auto bachelor = cascade.template posDau_as(); + auto bachelor = trackTable.rawIteratorAt(cascade.bachelorId() - trackTable.offset()); mCtr.compute(track, bachelor); } @@ -365,9 +372,10 @@ class ClosePairRejectionTrackKink } template - void setPair(const T1& track, const T2& kink, const T3 /*trackTable*/) + void setPair(const T1& track, const T2& kink, const T3 trackTable) { - auto daughter = kink.template chaDau_as(); + // auto daughter = kink.template chaDau_as(); + auto daughter = trackTable.rawIteratorAt(kink.chaDauId() - trackTable.offset()); mCtr.compute(track, daughter); } diff --git a/PWGCF/Femto/Core/collisionBuilder.h b/PWGCF/Femto/Core/collisionBuilder.h index cd6fc90fc05..80791b52ebc 100644 --- a/PWGCF/Femto/Core/collisionBuilder.h +++ b/PWGCF/Femto/Core/collisionBuilder.h @@ -514,7 +514,7 @@ class CollisionBuilderDerivedToDerived col.mult(), col.cent(), col.magField()); - newCollisionTable.producedCollisionMask(col.collisionMask()); + newCollisionTable.producedCollisionMask(col.mask()); } }; diff --git a/PWGCF/Femto/Core/kinkHistManager.h b/PWGCF/Femto/Core/kinkHistManager.h index 879edf32e43..bd82a5027d8 100644 --- a/PWGCF/Femto/Core/kinkHistManager.h +++ b/PWGCF/Femto/Core/kinkHistManager.h @@ -274,7 +274,9 @@ class KinkHistManager template void fill(T1 const& kinkcandidate, T2 const& tracks) { - auto chaDaughter = kinkcandidate.template chaDau_as(); + // this used to work, still under investigation + // auto chaDaughter = kinkcandidate.template chaDau_as(); + auto chaDaughter = tracks.rawIteratorAt(kinkcandidate.chaDauId() - tracks.offset()); mChaDauManager.fill(chaDaughter, tracks); fill(kinkcandidate); } diff --git a/PWGCF/Femto/Core/pairBuilder.h b/PWGCF/Femto/Core/pairBuilder.h index 51a361a75ec..9ffd0f91465 100644 --- a/PWGCF/Femto/Core/pairBuilder.h +++ b/PWGCF/Femto/Core/pairBuilder.h @@ -131,7 +131,7 @@ class PairTrackTrackBuilder void processSameEvent(T1 const& col, T2& trackTable, T3& partition1, T4& partition2, T5& cache) { if (mSameSpecies) { - auto trackSlice1 = partition1->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto trackSlice1 = partition1->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); if (trackSlice1.size() == 0) { return; } @@ -139,8 +139,8 @@ class PairTrackTrackBuilder mCprSe.setMagField(col.magField()); pairprocesshelpers::processSameEvent(trackSlice1, trackTable, mTrackHistManager1, mPairHistManagerSe, mCprSe, mRng, mMixIdenticalParticles); } else { - auto trackSlice1 = partition1->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); - auto trackSlice2 = partition2->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto trackSlice1 = partition1->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto trackSlice2 = partition2->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); if (trackSlice1.size() == 0 || trackSlice2.size() == 0) { return; } @@ -299,7 +299,7 @@ class PairV0V0Builder void processSameEvent(T1 const& col, T2& trackTable, T3& /*lambdaTable*/, T4& partition1, T5& partition2, T6& cache) { if (mSameSpecies) { - auto v0Slice1 = partition1->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto v0Slice1 = partition1->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); if (v0Slice1.size() == 0) { return; } @@ -307,8 +307,8 @@ class PairV0V0Builder mCprSe.setMagField(col.magField()); pairprocesshelpers::processSameEvent(v0Slice1, trackTable, mV0HistManager1, mPairHistManagerSe, mCprSe, mRng, mMixIdenticalParticles); } else { - auto v0Slice1 = partition1->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); - auto v0Slice2 = partition2->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto v0Slice1 = partition1->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto v0Slice2 = partition2->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); if (v0Slice1.size() == 0 || v0Slice2.size() == 0) { return; } @@ -433,8 +433,8 @@ class PairTrackV0Builder template void processSameEvent(T1 const& col, T2& trackTable, T3& trackPartition, T4& /*v0table*/, T5& v0Partition, T6& cache) { - auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); - auto v0Slice = v0Partition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto v0Slice = v0Partition->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); if (trackSlice.size() == 0 || v0Slice.size() == 0) { return; } @@ -538,8 +538,8 @@ class PairTrackTwoTrackResonanceBuilder template void processSameEvent(T1 const& col, T2& trackTable, T3& trackPartition, T4& /*resonanceTable*/, T5& resonancePartition, T6& cache) { - auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); - auto v0Slice = resonancePartition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto v0Slice = resonancePartition->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); if (trackSlice.size() == 0 || v0Slice.size() == 0) { return; } @@ -624,12 +624,12 @@ class PairTrackKinkBuilder mPairHistManagerSe.init(registry, pairHistSpec); mPairHistManagerSe.setMass(confTrackSelection.pdgCode.value, confKinkSelection.pdgCode.value); - mPairHistManagerSe.setCharge(confTrackSelection.chargeAbs.value, confKinkSelection.sign.value); + mPairHistManagerSe.setCharge(confTrackSelection.chargeAbs.value, 1); // abs charge of kink daughter is always 1 mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); mPairHistManagerMe.init(registry, pairHistSpec); mPairHistManagerMe.setMass(confTrackSelection.pdgCode.value, confKinkSelection.pdgCode.value); - mPairHistManagerMe.setCharge(confTrackSelection.chargeAbs.value, confKinkSelection.sign.value); + mPairHistManagerMe.setCharge(confTrackSelection.chargeAbs.value, 1); // abs charge of kink daughter is always 1 mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); // setup mixing @@ -640,8 +640,8 @@ class PairTrackKinkBuilder template void processSameEvent(T1 const& col, T2& trackTable, T3& trackPartition, T4& /*kinktable*/, T5& kinkPartition, T6& cache) { - auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); - auto kinkSlice = kinkPartition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto kinkSlice = kinkPartition->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); if (trackSlice.size() == 0 || kinkSlice.size() == 0) { return; } @@ -732,12 +732,12 @@ class PairTrackCascadeBuilder mPairHistManagerSe.init(registry, pairHistSpec); mPairHistManagerSe.setMass(confTrackSelection.pdgCode.value, confCascadeSelection.pdgCode.value); - mPairHistManagerSe.setCharge(confTrackSelection.chargeAbs.value, confCascadeSelection.sign.value); + mPairHistManagerSe.setCharge(confTrackSelection.chargeAbs.value, 1); mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); mPairHistManagerMe.init(registry, pairHistSpec); mPairHistManagerMe.setMass(confTrackSelection.pdgCode.value, confCascadeSelection.pdgCode.value); - mPairHistManagerMe.setCharge(confTrackSelection.chargeAbs.value, confCascadeSelection.sign.value); + mPairHistManagerMe.setCharge(confTrackSelection.chargeAbs.value, 1); mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); // setup mixing @@ -748,8 +748,8 @@ class PairTrackCascadeBuilder template void processSameEvent(T1 const& col, T2& trackTable, T3& trackPartition, T4& /*cascadeTable*/, T5& v0Partition, T6& cache) { - auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); - auto v0Slice = v0Partition->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto trackSlice = trackPartition->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto v0Slice = v0Partition->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); if (trackSlice.size() == 0 || v0Slice.size() == 0) { return; } diff --git a/PWGCF/Femto/Core/pairHistManager.h b/PWGCF/Femto/Core/pairHistManager.h index 8a4f58b44b1..6b296d0af9e 100644 --- a/PWGCF/Femto/Core/pairHistManager.h +++ b/PWGCF/Femto/Core/pairHistManager.h @@ -171,10 +171,10 @@ class PairHistManager } void setCharge(int chargeAbsParticle1, int chargeAbsParticle2) { - // the pt stored is actually pt/z, so in case of particles with z > 1, we have to rescale the pt (this is so far only for He3 the case) + // the pt stored is actually as pt/z for tracks, so in case of particles with z > 1, we have to rescale the pt (this is so far only for He3 the case) // similarly, for neutral particles, no reason to rescale so we just set absolute charge to 1 - mAbsCharge1 = chargeAbsParticle1; - mAbsCharge2 = chargeAbsParticle2; + mAbsCharge1 = std::abs(chargeAbsParticle1); + mAbsCharge2 = std::abs(chargeAbsParticle2); } template diff --git a/PWGCF/Femto/Core/pairProcessHelpers.h b/PWGCF/Femto/Core/pairProcessHelpers.h index 2d4a6f38bdd..ebcc6ec969d 100644 --- a/PWGCF/Femto/Core/pairProcessHelpers.h +++ b/PWGCF/Femto/Core/pairProcessHelpers.h @@ -112,51 +112,6 @@ void processSameEvent(T1 const& SliceParticle1, } } -// process same event for tracks and particles decaying into tracks -// template -// void processSameEvent(T1& SliceParticle1, -// T2& SliceParticle2, -// T3& TrackTable, -// T4& ParticleHistManager1, -// T5& ParticleHistManager2, -// T6& PairHistManager, -// T7& CprManager, -// T8& PcManager) -// { -// // Fill single particle histograms -// for (auto const& part : SliceParticle1) { -// ParticleHistManager1.fill(part); -// } -// -// for (auto const& part : SliceParticle2) { -// ParticleHistManager2.fill(part, TrackTable); -// } -// -// for (auto const& [p1, p2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(SliceParticle1, SliceParticle2))) { -// // pair cleaning -// if (!PcManager.isCleanPair(p1, p2, TrackTable)) { -// continue; -// } -// // Close pair rejection -// if (CprManager.isActivated()) { -// CprManager.setPair(p1, p2, TrackTable); -// if (CprManager.isClosePair()) { -// continue; -// } -// } -// CprManager.fill(); -// PairHistManager.setPair(p1, p2); -// PairHistManager.fill(); -// } -// } - // process mixed event for identical particles template sliceByCached(o2::aod::femtobase::stored::collisionId, collision1.globalIndex(), cache); - auto sliceParticle2 = Partition->sliceByCached(o2::aod::femtobase::stored::collisionId, collision2.globalIndex(), cache); + auto sliceParticle1 = Partition->sliceByCached(o2::aod::femtobase::stored::fColId, collision1.globalIndex(), cache); + auto sliceParticle2 = Partition->sliceByCached(o2::aod::femtobase::stored::fColId, collision2.globalIndex(), cache); if (sliceParticle1.size() == 0 || sliceParticle2.size() == 0) { continue; } @@ -233,8 +188,8 @@ void processMixedEvent(T1& Collisions, continue; } CprManager.setMagField(collision1.magField()); - auto sliceParticle1 = Partition1->sliceByCached(o2::aod::femtobase::stored::collisionId, collision1.globalIndex(), cache); - auto sliceParticle2 = Partition2->sliceByCached(o2::aod::femtobase::stored::collisionId, collision2.globalIndex(), cache); + auto sliceParticle1 = Partition1->sliceByCached(o2::aod::femtobase::stored::fColId, collision1.globalIndex(), cache); + auto sliceParticle2 = Partition2->sliceByCached(o2::aod::femtobase::stored::fColId, collision2.globalIndex(), cache); if (sliceParticle1.size() == 0 || sliceParticle2.size() == 0) { continue; } @@ -256,57 +211,6 @@ void processMixedEvent(T1& Collisions, } } } - -// // process mixed event for track and particles decaying into tracks -// template -// void processMixedEvent(T1& Collisions, -// T2& Partition1, -// T3& Partition2, -// T4& TrackTable, -// T5& cache, -// T6& policy, -// T7& depth, -// T8& PairHistManager, -// T9& CprManager, -// T10& PcManager) -// { -// for (auto const& [collision1, collision2] : o2::soa::selfCombinations(policy, depth, -1, Collisions, Collisions)) { -// if (!(std::fabs(collision1.magField() - collision2.magField()) < o2::constants::math::Epsilon)) { -// continue; -// } -// CprManager.setMagField(collision1.magField()); -// auto sliceParticle1 = Partition1->sliceByCached(o2::aod::femtobase::stored::collisionId, collision1.globalIndex(), cache); -// auto sliceParticle2 = Partition2->sliceByCached(o2::aod::femtobase::stored::collisionId, collision2.globalIndex(), cache); -// if (sliceParticle1.size() == 0 || sliceParticle2.size() == 0) { -// continue; -// } -// for (auto const& [p1, p2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(sliceParticle1, sliceParticle2))) { -// // pair cleaning -// if (!PcManager.isCleanPair(p1, p2, TrackTable)) { -// continue; -// } -// // Close pair rejection -// if (CprManager.isActivated()) { -// CprManager.setPair(p1, p2, TrackTable); -// if (CprManager.isClosePair()) { -// continue; -// } -// } -// CprManager.fill(); -// PairHistManager.setPair(p1, p2); -// PairHistManager.fill(); -// } -// } -// } } // namespace pairprocesshelpers } // namespace o2::analysis::femto diff --git a/PWGCF/Femto/Core/partitions.h b/PWGCF/Femto/Core/partitions.h index f1d3775cfd0..6d5cf0dac81 100644 --- a/PWGCF/Femto/Core/partitions.h +++ b/PWGCF/Femto/Core/partitions.h @@ -22,7 +22,7 @@ (femtocollisions::mult >= selection.multMin && femtocollisions::mult <= selection.multMax) && \ (femtocollisions::cent >= selection.centMin && femtocollisions::cent <= selection.centMax) && \ (femtocollisions::magField >= static_cast(selection.magFieldMin) && femtocollisions::magField <= static_cast(selection.magFieldMax)) && \ - ncheckbit(femtocollisions::collisionMask, selection.collisionMask) + ncheckbit(femtocollisions::mask, selection.collisionMask) // standard track partition #define MAKE_TRACK_PARTITION(selection) \ @@ -34,8 +34,8 @@ (femtobase::stored::phi > selection.phiMin) && \ (femtobase::stored::phi < selection.phiMax) && \ ifnode(nabs(selection.chargeAbs.node() * femtobase::stored::signedPt) * (nexp(femtobase::stored::eta) + nexp(-1.f * femtobase::stored::eta)) / (2.f) <= selection.pidThres, \ - ncheckbit(femtotracks::trackMask, selection.maskLowMomentum), \ - ncheckbit(femtotracks::trackMask, selection.maskHighMomentum)) + ncheckbit(femtotracks::mask, selection.maskLowMomentum), \ + ncheckbit(femtotracks::mask, selection.maskHighMomentum)) // partition for phis and rhos, i.e. resonance that are their own antiparticle #define MAKE_RESONANCE_0_PARTITON(selection) \ diff --git a/PWGCF/Femto/Core/trackBuilder.h b/PWGCF/Femto/Core/trackBuilder.h index dbf670459eb..6a343d2ebbb 100644 --- a/PWGCF/Femto/Core/trackBuilder.h +++ b/PWGCF/Femto/Core/trackBuilder.h @@ -640,8 +640,8 @@ class TrackBuilderDerivedToDerived template bool collisionHasTooFewTracks(T1& col, T2& /*trackTable*/, T3& partitionTrack1, T4& partitionTrack2, T5& cache) { - auto trackSlice1 = partitionTrack1->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); - auto trackSlice2 = partitionTrack2->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto trackSlice1 = partitionTrack1->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto trackSlice2 = partitionTrack2->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); if (trackSlice1.size() >= mLimitTrack1 && trackSlice2.size() >= mLimitTrack2) { return false; } @@ -651,8 +651,8 @@ class TrackBuilderDerivedToDerived template void processTracks(T1& col, T2& /*trackTable*/, T3& partitionTrack1, T4& partitionTrack2, T5& indexMap, T6& cache, T7& newTrackTable, T8& newCollisionTable) { - auto trackSlice1 = partitionTrack1->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); - auto trackSlice2 = partitionTrack2->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto trackSlice1 = partitionTrack1->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); + auto trackSlice2 = partitionTrack2->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); for (auto const& track : trackSlice1) { this->fillTrack(track, newTrackTable, newCollisionTable, indexMap); @@ -669,7 +669,7 @@ class TrackBuilderDerivedToDerived track.signedPt(), track.eta(), track.phi()); - trackProducts.producedTrackMasks(track.trackMask()); + trackProducts.producedTrackMasks(track.mask()); indexMap.emplace(track.globalIndex(), trackProducts.producedTracks.lastIndex()); } diff --git a/PWGCF/Femto/Core/twoTrackResonanceBuilder.h b/PWGCF/Femto/Core/twoTrackResonanceBuilder.h index 185611e12f1..28d62a7c932 100644 --- a/PWGCF/Femto/Core/twoTrackResonanceBuilder.h +++ b/PWGCF/Femto/Core/twoTrackResonanceBuilder.h @@ -464,8 +464,8 @@ template class TwoTrackResonanceBuilder { public: - TwoTrackResonanceBuilder() {} - virtual ~TwoTrackResonanceBuilder() = default; + TwoTrackResonanceBuilder() = default; + ~TwoTrackResonanceBuilder() = default; template void init(T1& config, T2& filter, T3& daughterFilter, T4& table, T5 initContext) diff --git a/PWGCF/Femto/Core/twoTrackResonanceHistManager.h b/PWGCF/Femto/Core/twoTrackResonanceHistManager.h index 38e4c6e3460..895a3ba83c4 100644 --- a/PWGCF/Femto/Core/twoTrackResonanceHistManager.h +++ b/PWGCF/Femto/Core/twoTrackResonanceHistManager.h @@ -162,9 +162,12 @@ class TwoTrackResonanceHistManager template void fill(T1 const& resonance, T2 const& tracks) { - auto posDaughter = resonance.template posDau_as(); + // this used to work, still under investigation + // auto posDaughter = resonance.template posDau_as(); + // auto negDaughter = resonance.template negDau_as(); + auto posDaughter = tracks.rawIteratorAt(resonance.posDauId() - tracks.offset()); mPosDauManager.fill(posDaughter, tracks); - auto negDaughter = resonance.template negDau_as(); + auto negDaughter = tracks.rawIteratorAt(resonance.negDauId() - tracks.offset()); mNegDauManager.fill(negDaughter, tracks); if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { diff --git a/PWGCF/Femto/Core/v0Builder.h b/PWGCF/Femto/Core/v0Builder.h index 0364c3c5a0a..7013e2c5722 100644 --- a/PWGCF/Femto/Core/v0Builder.h +++ b/PWGCF/Femto/Core/v0Builder.h @@ -500,7 +500,7 @@ class V0BuilderDerivedToDerived template bool collisionHasTooFewLambdas(T1& col, T2& /*lambdaTable*/, T3& partitionLambda, T4& cache) { - auto lambdaSlice = partitionLambda->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto lambdaSlice = partitionLambda->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); if (lambdaSlice.size() >= mLimitLambda) { return false; } @@ -510,7 +510,7 @@ class V0BuilderDerivedToDerived template bool collisionHasTooFewK0shorts(T1& col, T2& /*k0shortTable*/, T3& partitionK0short, T4& cache) { - auto k0shortSlice = partitionK0short->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto k0shortSlice = partitionK0short->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); if (k0shortSlice.size() >= mLimitK0short) { return false; } @@ -520,7 +520,7 @@ class V0BuilderDerivedToDerived template void processLambdas(T1& col, T2& /*lambdaTable*/, T3& /*oldTrackTable*/, T4& partitionLambda, T5& trackBuilder, T6& indexMap, T7& cache, T8& newLambdaTable, T9& newTrackTable, T10& newCollisionTable) { - auto lambdaSlice = partitionLambda->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto lambdaSlice = partitionLambda->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); for (auto const& lambda : lambdaSlice) { @@ -544,7 +544,7 @@ class V0BuilderDerivedToDerived template void processK0shorts(T1& col, T2& /*k0shortTable*/, T3& /*oldTrackTable*/, T4& partitionK0short, T5& trackBuilder, T6& indexMap, T7& cache, T8& newK0shortTable, T9& newTrackTable, T10& newCollisionTable) { - auto k0shortSlice = partitionK0short->sliceByCached(o2::aod::femtobase::stored::collisionId, col.globalIndex(), cache); + auto k0shortSlice = partitionK0short->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); for (auto const& k0short : k0shortSlice) { diff --git a/PWGCF/Femto/Core/v0HistManager.h b/PWGCF/Femto/Core/v0HistManager.h index f402b8e0fab..fe0cb31b04e 100644 --- a/PWGCF/Femto/Core/v0HistManager.h +++ b/PWGCF/Femto/Core/v0HistManager.h @@ -259,9 +259,12 @@ class V0HistManager template void fill(T1 const& v0candidate, T2 const& tracks) { - auto posDaughter = v0candidate.template posDau_as(); + // this used to work, still under investigation + // auto posDaughter = v0candidate.template posDau_as(); + // auto negDaughter = v0candidate.template negDau_as(); + auto posDaughter = tracks.rawIteratorAt(v0candidate.posDauId() - tracks.offset()); mPosDauManager.fill(posDaughter, tracks); - auto negDaughter = v0candidate.template negDau_as(); + auto negDaughter = tracks.rawIteratorAt(v0candidate.negDauId() - tracks.offset()); mNegDauManager.fill(negDaughter, tracks); if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { diff --git a/PWGCF/Femto/DataModel/FemtoTables.h b/PWGCF/Femto/DataModel/FemtoTables.h index fb0d7d85a47..f17d7c3d1ae 100644 --- a/PWGCF/Femto/DataModel/FemtoTables.h +++ b/PWGCF/Femto/DataModel/FemtoTables.h @@ -33,8 +33,8 @@ namespace o2::aod { namespace femtocollisions { -DECLARE_SOA_COLUMN(CollisionMask, collisionMask, femtodatatypes::CollisionMaskType); //! Bitmask for collision selections -DECLARE_SOA_COLUMN(CollisionTag, collisionTag, femtodatatypes::CollisionTagType); //! Bitmask for collision selections +DECLARE_SOA_COLUMN(Mask, mask, femtodatatypes::CollisionMaskType); //! Bitmask for collision selections +DECLARE_SOA_COLUMN(CollisionTag, collisionTag, femtodatatypes::CollisionTagType); //! Bitmask for collision selections DECLARE_SOA_COLUMN(PosX, posX, float); //! x coordinate of vertex DECLARE_SOA_COLUMN(PosY, posY, float); //! y coordinate of vertex @@ -59,7 +59,7 @@ using StoredFCols = StoredFCols_001; // table for collisions selections DECLARE_SOA_TABLE_STAGED_VERSIONED(FColMasks_001, "FCOLMASK", 1, //! track masks - femtocollisions::CollisionMask); + femtocollisions::Mask); using FColMasks = FColMasks_001; using StoredFColMasks = StoredFColMasks_001; @@ -100,14 +100,13 @@ namespace femtobase namespace stored { // static columns -// -DECLARE_SOA_INDEX_COLUMN(Collision, collision); //! collision index of femto collision table -DECLARE_SOA_COLUMN(SignedPt, signedPt, float); //! signed pt -DECLARE_SOA_COLUMN(Pt, pt, float); //! pt -DECLARE_SOA_COLUMN(Eta, eta, float); //! eta -DECLARE_SOA_COLUMN(Phi, phi, float); //! phi -DECLARE_SOA_COLUMN(Mass, mass, float); //! mass of particle -DECLARE_SOA_COLUMN(MassAnti, massAnti, float); //! mass of antiparticle +DECLARE_SOA_INDEX_COLUMN(FCol, fCol); //! collision index of femto collision table +DECLARE_SOA_COLUMN(SignedPt, signedPt, float); //! signed pt +DECLARE_SOA_COLUMN(Pt, pt, float); //! pt +DECLARE_SOA_COLUMN(Eta, eta, float); //! eta +DECLARE_SOA_COLUMN(Phi, phi, float); //! phi +DECLARE_SOA_COLUMN(Mass, mass, float); //! mass of particle +DECLARE_SOA_COLUMN(MassAnti, massAnti, float); //! mass of antiparticle } // namespace stored namespace dynamic @@ -148,7 +147,7 @@ DECLARE_SOA_DYNAMIC_COLUMN(Theta, theta, //! theta namespace femtotracks { // columns for track selections -DECLARE_SOA_COLUMN(TrackMask, trackMask, femtodatatypes::TrackMaskType); //! Bitmask for track selections +DECLARE_SOA_COLUMN(Mask, mask, femtodatatypes::TrackMaskType); //! Bitmask for track selections // columns for DCA DECLARE_SOA_COLUMN(DcaXY, dcaXY, float); //! Dca in XY plane @@ -227,7 +226,7 @@ DECLARE_SOA_DYNAMIC_COLUMN(TpctofNSigmaHe, tpctofNSigmaHe, [](float tpc, float t // table for basic track information DECLARE_SOA_TABLE_STAGED_VERSIONED(FTracks_001, "FTRACK", 1, //! femto tracks o2::soa::Index<>, - femtobase::stored::CollisionId, + femtobase::stored::FColId, femtobase::stored::SignedPt, femtobase::stored::Eta, femtobase::stored::Phi, @@ -244,7 +243,7 @@ using StoredFTracks = StoredFTracks_001; // table for track selections and PID selections DECLARE_SOA_TABLE_STAGED_VERSIONED(FTrackMasks_001, "FTRACKMASK", 1, //! track masks - femtotracks::TrackMask); + femtotracks::Mask); using FTrackMasks = FTrackMasks_001; using StoredFTrackMasks = StoredFTrackMasks_001; @@ -338,7 +337,7 @@ DECLARE_SOA_INDEX_COLUMN_FULL(NegDau, negDau, int32_t, FTracks, "_NegDau"); //! // table for phis DECLARE_SOA_TABLE_STAGED_VERSIONED(FPhis_001, "FPHI", 1, //! femto phis o2::soa::Index<>, - femtobase::stored::CollisionId, + femtobase::stored::FColId, femtobase::stored::Pt, femtobase::stored::Eta, femtobase::stored::Phi, @@ -358,7 +357,7 @@ using FPhiMasks = FPhiMasks_001; // table for kstars DECLARE_SOA_TABLE_STAGED_VERSIONED(FKstar0s_001, "FKSTAR0", 1, //! femto k0star o2::soa::Index<>, - femtobase::stored::CollisionId, + femtobase::stored::FColId, femtobase::stored::SignedPt, //! +1 for k0star and -1 for k0starbar femtobase::stored::Eta, femtobase::stored::Phi, @@ -379,7 +378,7 @@ using FKstar0Masks = FKstar0Masks_001; DECLARE_SOA_TABLE_STAGED_VERSIONED(FRho0s_001, "FRHO0", 1, //! femto rho0s o2::soa::Index<>, - femtobase::stored::CollisionId, + femtobase::stored::FColId, femtobase::stored::Pt, femtobase::stored::Eta, femtobase::stored::Phi, @@ -425,7 +424,7 @@ DECLARE_SOA_INDEX_COLUMN_FULL(NegDau, negDau, int32_t, FTracks, "_NegDau"); //! // table for basic lambda information DECLARE_SOA_TABLE_STAGED_VERSIONED(FLambdas_001, "FLAMBDA", 1, //! femto lambdas o2::soa::Index<>, - femtobase::stored::CollisionId, + femtobase::stored::FColId, femtobase::stored::SignedPt, // use sign to differentiate between lambda (+1) and antilambda (-1) femtobase::stored::Eta, femtobase::stored::Phi, @@ -463,7 +462,7 @@ using FLambdaExtras = FLambdaExtras_001; // table for basic k0short information DECLARE_SOA_TABLE_STAGED_VERSIONED(FK0shorts_001, "FK0SHORT", 1, //! femto k0shorts o2::soa::Index<>, - femtobase::stored::CollisionId, + femtobase::stored::FColId, femtobase::stored::Pt, femtobase::stored::Eta, femtobase::stored::Phi, @@ -517,7 +516,7 @@ DECLARE_SOA_INDEX_COLUMN_FULL(ChaDau, chaDau, int32_t, FTracks, "_ChaDau"); //! // table for basic sigma minus information DECLARE_SOA_TABLE_STAGED_VERSIONED(FSigmas_001, "FSIGMA", 1, o2::soa::Index<>, - femtobase::stored::CollisionId, // use sign to differentiate between sigma minus (-1) and anti sigma minus (+1) + femtobase::stored::FColId, // use sign to differentiate between sigma minus (-1) and anti sigma minus (+1) femtobase::stored::SignedPt, femtobase::stored::Eta, femtobase::stored::Phi, @@ -571,7 +570,7 @@ DECLARE_SOA_INDEX_COLUMN_FULL(Bachelor, bachelor, int32_t, FTracks, "_Bachelor") DECLARE_SOA_TABLE_STAGED_VERSIONED(FXis_001, "FXI", 1, //! femto xis o2::soa::Index<>, - femtobase::stored::CollisionId, + femtobase::stored::FColId, femtobase::stored::SignedPt, femtobase::stored::Eta, femtobase::stored::Phi, @@ -605,7 +604,7 @@ using FXiExtras = FXiExtras_001; DECLARE_SOA_TABLE_STAGED_VERSIONED(FOmegas_001, "FOMEGA", 1, //! femto omegas o2::soa::Index<>, - femtobase::stored::CollisionId, + femtobase::stored::FColId, femtobase::stored::SignedPt, femtobase::stored::Eta, femtobase::stored::Phi, diff --git a/PWGCF/Femto/TableProducer/femtoProducer.cxx b/PWGCF/Femto/TableProducer/femtoProducer.cxx index 457706ac058..561963ce797 100644 --- a/PWGCF/Femto/TableProducer/femtoProducer.cxx +++ b/PWGCF/Femto/TableProducer/femtoProducer.cxx @@ -126,7 +126,7 @@ struct FemtoProducer { twotrackresonancebuilder::ConfTwoTrackResonanceDaughterFilters confResonanceDaughterFilters; // caching and preslicing SliceCache cache; - Preslice perColTracks = o2::aod::track::collisionId; + Preslice perColTracks = track::collisionId; Partition partitionPositiveDaughters = (track::signed1Pt > 0.f) && (track::pt > confResonanceDaughterFilters.ptMin && track::pt < confResonanceDaughterFilters.ptMax) && @@ -226,8 +226,8 @@ struct FemtoProducer { template void processResonances(T1 const& col, T2 const& /*tracks*/) { - auto groupPositiveTracks = partitionPositiveDaughters->sliceByCached(o2::aod::track::collisionId, col.globalIndex(), cache); - auto groupNegativeTracks = partitionNegativeDaughters->sliceByCached(o2::aod::track::collisionId, col.globalIndex(), cache); + auto groupPositiveTracks = partitionPositiveDaughters->sliceByCached(track::collisionId, col.globalIndex(), cache); + auto groupNegativeTracks = partitionNegativeDaughters->sliceByCached(track::collisionId, col.globalIndex(), cache); rho0Builder.fillResonances(collisionBuilderProducts, trackBuilderProducts, twoTrackResonanceBuilderProducts, groupPositiveTracks, groupNegativeTracks, trackBuilder, indexMapTracks); phiBuilder.fillResonances(collisionBuilderProducts, trackBuilderProducts, twoTrackResonanceBuilderProducts, groupPositiveTracks, groupNegativeTracks, trackBuilder, indexMapTracks); kstar0Builder.fillResonances(collisionBuilderProducts, trackBuilderProducts, twoTrackResonanceBuilderProducts, groupPositiveTracks, groupNegativeTracks, trackBuilder, indexMapTracks); diff --git a/PWGCF/Femto/TableProducer/femtoProducerDerivedToDerived.cxx b/PWGCF/Femto/TableProducer/femtoProducerDerivedToDerived.cxx index bbeac637531..d3806ae5f78 100644 --- a/PWGCF/Femto/TableProducer/femtoProducerDerivedToDerived.cxx +++ b/PWGCF/Femto/TableProducer/femtoProducerDerivedToDerived.cxx @@ -67,7 +67,7 @@ struct FemtoProducerDerivedToDerived { Partition trackPartition1 = MAKE_TRACK_PARTITION(trackSelections1); Partition trackPartition2 = MAKE_TRACK_PARTITION(trackSelections2); - Preslice perColTracks = femtobase::stored::collisionId; + Preslice perColTracks = femtobase::stored::fColId; // v0 builder v0builder::V0BuilderDerivedToDerived v0Builder; @@ -76,11 +76,11 @@ struct FemtoProducerDerivedToDerived { v0builder::ConfLambdaSelection1 lambdaSelection1; Partition lambdaPartition = MAKE_LAMBDA_PARTITION(lambdaSelection1); - Preslice perColLambdas = femtobase::stored::collisionId; + Preslice perColLambdas = femtobase::stored::fColId; v0builder::ConfK0shortSelection1 k0shortSelection1; Partition k0shortPartition = MAKE_K0SHORT_PARTITION(k0shortSelection1); - Preslice perColK0shorts = femtobase::stored::collisionId; + Preslice perColK0shorts = femtobase::stored::fColId; std::unordered_map indexMapTracks; // for mapping tracks to lambdas, cascades and resonances diff --git a/PWGCF/Femto/Tasks/femtoCascadeQa.cxx b/PWGCF/Femto/Tasks/femtoCascadeQa.cxx index a9cfcc78b9d..4b953363dae 100644 --- a/PWGCF/Femto/Tasks/femtoCascadeQa.cxx +++ b/PWGCF/Femto/Tasks/femtoCascadeQa.cxx @@ -36,9 +36,7 @@ #include #include -using namespace o2; using namespace o2::aod; -using namespace o2::soa; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::analysis::femto; @@ -46,15 +44,15 @@ using namespace o2::analysis::femto; struct FemtoCascadeQa { // setup tables - using Collisions = Join; - using Collision = Collisions::iterator; + using FemtoCollisions = o2::soa::Join; + using FemtoCollision = FemtoCollisions::iterator; - using FilteredCollisions = o2::soa::Filtered; - using FilteredCollision = FilteredCollisions::iterator; + using FilteredFemtoCollisions = o2::soa::Filtered; + using FilteredFemtoCollision = FilteredFemtoCollisions::iterator; - using Xis = o2::soa::Join; - using Omegas = o2::soa::Join; - using Tracks = o2::soa::Join; + using FemtoXis = o2::soa::Join; + using FemtoOmegas = o2::soa::Join; + using FemtoTracks = o2::soa::Join; SliceCache cache; @@ -67,8 +65,8 @@ struct FemtoCascadeQa { // setup for xis cascadebuilder::ConfXiSelection confXiSelection; - Partition xiPartition = MAKE_CASCADE_PARTITION(confXiSelection); - Preslice preColXis = aod::femtobase::stored::collisionId; + Partition xiPartition = MAKE_CASCADE_PARTITION(confXiSelection); + Preslice preColXis = femtobase::stored::fColId; cascadehistmanager::ConfXiBinning confXiBinning; cascadehistmanager::ConfXiQaBinning confXiQaBinning; @@ -83,8 +81,8 @@ struct FemtoCascadeQa { // setup for omegas cascadebuilder::ConfOmegaSelection confOmegaSelection; - Partition omegaPartition = MAKE_CASCADE_PARTITION(confOmegaSelection); - Preslice preColOmegas = aod::femtobase::stored::collisionId; + Partition omegaPartition = MAKE_CASCADE_PARTITION(confOmegaSelection); + Preslice preColOmegas = femtobase::stored::fColId; cascadehistmanager::ConfOmegaBinning confOmegaBinning; cascadehistmanager::ConfOmegaQaBinning confOmegaQaBinning; @@ -132,20 +130,20 @@ struct FemtoCascadeQa { } }; - void processXis(FilteredCollision const& col, Xis const& /*xis*/, Tracks const& tracks) + void processXis(FilteredFemtoCollision const& col, FemtoXis const& /*xis*/, FemtoTracks const& tracks) { colHistManager.fill(col); - auto xiSlice = xiPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + auto xiSlice = xiPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); for (auto const& xi : xiSlice) { xiHistManager.fill(xi, tracks); } } PROCESS_SWITCH(FemtoCascadeQa, processXis, "Process Xis", true); - void processOmegas(FilteredCollision const& col, Omegas const& /*omegas*/, Tracks const& tracks) + void processOmegas(FilteredFemtoCollision const& col, FemtoOmegas const& /*omegas*/, FemtoTracks const& tracks) { colHistManager.fill(col); - auto omegaSlice = omegaPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + auto omegaSlice = omegaPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); for (auto const& omega : omegaSlice) { omegaHistManager.fill(omega, tracks); } diff --git a/PWGCF/Femto/Tasks/femtoKinkQa.cxx b/PWGCF/Femto/Tasks/femtoKinkQa.cxx index 4d797d0be01..2b900fa417d 100644 --- a/PWGCF/Femto/Tasks/femtoKinkQa.cxx +++ b/PWGCF/Femto/Tasks/femtoKinkQa.cxx @@ -38,9 +38,7 @@ #include #include -using namespace o2; using namespace o2::aod; -using namespace o2::soa; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::analysis::femto; @@ -55,24 +53,23 @@ struct FemtoKinkQa { colhistmanager::ConfCollisionBinning confCollisionBinning; colhistmanager::ConfCollisionQaBinning confCollisionQaBinning; - // using Collisions = o2::soa::Join; - using Collisions = Join; - using Collision = Collisions::iterator; + using FemtoCollisions = o2::soa::Join; + using FemtoCollision = FemtoCollisions::iterator; - using FilteredCollisions = o2::soa::Filtered; - using FilteredCollision = FilteredCollisions::iterator; + using FilteredFemtoCollisions = o2::soa::Filtered; + using FilteredFemtoCollision = FilteredFemtoCollisions::iterator; // Define kink/sigma tables (joining tables for comprehensive information) - using Sigmas = o2::soa::Join; - using Tracks = o2::soa::Join; + using FemtoSigmas = o2::soa::Join; + using FemtoTracks = o2::soa::Join; SliceCache cache; // setup for sigmas kinkbuilder::ConfSigmaSelection1 confSigmaSelection; - Partition sigmaPartition = MAKE_SIGMA_PARTITION(confSigmaSelection); - Preslice perColSigmas = aod::femtobase::stored::collisionId; + Partition sigmaPartition = MAKE_SIGMA_PARTITION(confSigmaSelection); + Preslice perColSigmas = femtobase::stored::fColId; kinkhistmanager::ConfSigmaBinning1 confSigmaBinning; kinkhistmanager::ConfSigmaQaBinning1 confSigmaQaBinning; @@ -101,10 +98,10 @@ struct FemtoKinkQa { }; // Process function for sigma particles from femto tables - void processSigma(FilteredCollision const& col, Sigmas const& /*sigmas*/, Tracks const& tracks) + void processSigma(FilteredFemtoCollision const& col, FemtoSigmas const& /*sigmas*/, FemtoTracks const& tracks) { colHistManager.fill(col); - auto sigmaSlice = sigmaPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + auto sigmaSlice = sigmaPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); for (auto const& sigma : sigmaSlice) { sigmaHistManager.fill(sigma, tracks); } diff --git a/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx b/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx index f033eca7dc8..ee7d9d5e409 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx @@ -71,7 +71,7 @@ struct FemtoPairTrackCascade { trackbuilder::ConfTrackSelection1 trackSelection; trackhistmanager::ConfTrackBinning1 confTrackBinning; Partition trackPartition = MAKE_TRACK_PARTITION(trackSelection); - Preslice perColTracks = aod::femtobase::stored::collisionId; + Preslice perColTracks = aod::femtobase::stored::fColId; // setup for daughters/bachelor trackhistmanager::ConfCascadePosDauBinning confPosDauBinning; @@ -82,13 +82,13 @@ struct FemtoPairTrackCascade { cascadebuilder::ConfXiSelection xiSelection; cascadehistmanager::ConfXiBinning confXiBinning; Partition xiPartition = MAKE_CASCADE_PARTITION(xiSelection); - Preslice perColXis = aod::femtobase::stored::collisionId; + Preslice perColXis = aod::femtobase::stored::fColId; // setup omegas cascadebuilder::ConfOmegaSelection omegaSelection; cascadehistmanager::ConfOmegaBinning confOmegaBinning; Partition omegaPartition = MAKE_CASCADE_PARTITION(omegaSelection); - Preslice perColOmegas = aod::femtobase::stored::collisionId; + Preslice perColOmegas = aod::femtobase::stored::fColId; // setup pairs pairhistmanager::ConfPairBinning confPairBinning; diff --git a/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx b/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx index e5a049824d6..d0fd689fe21 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx @@ -71,7 +71,7 @@ struct FemtoPairTrackKink { trackbuilder::ConfTrackSelection1 trackSelection; trackhistmanager::ConfTrackBinning1 confTrackBinning; Partition trackPartition = MAKE_TRACK_PARTITION(trackSelection); - Preslice perColTracks = aod::femtobase::stored::collisionId; + Preslice perColTracks = aod::femtobase::stored::fColId; // setup for daughters trackhistmanager::ConfKinkChaDauBinning confChaDauBinning; @@ -80,7 +80,7 @@ struct FemtoPairTrackKink { kinkbuilder::ConfSigmaSelection1 sigmaSelection; kinkhistmanager::ConfSigmaBinning1 confSigmaBinning; Partition sigmaPartition = MAKE_SIGMA_PARTITION(sigmaSelection); - Preslice perColSigmas = aod::femtobase::stored::collisionId; + Preslice perColSigmas = aod::femtobase::stored::fColId; // setup pairs pairhistmanager::ConfPairBinning confPairBinning; diff --git a/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx b/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx index 1e96f2617d5..517478ed117 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx @@ -72,7 +72,7 @@ struct FemtoPairTrackTrack { Partition trackPartition1 = MAKE_TRACK_PARTITION(trackSelections1); Partition trackPartition2 = MAKE_TRACK_PARTITION(trackSelections2); - Preslice perColReco = aod::femtobase::stored::collisionId; + Preslice perColReco = aod::femtobase::stored::fColId; // setup pairs pairhistmanager::ConfPairBinning confPairBinning; diff --git a/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx b/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx index 516499cd801..73a340cde8a 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx @@ -72,7 +72,7 @@ struct FemtoPairTrackTwoTrackResonance { trackbuilder::ConfTrackSelection1 trackSelection; trackhistmanager::ConfTrackBinning1 confTrackBinning; Partition trackPartition = MAKE_TRACK_PARTITION(trackSelection); - Preslice perColTracks = aod::femtobase::stored::collisionId; + Preslice perColTracks = aod::femtobase::stored::fColId; // setup for daughters trackhistmanager::ConfResonancePosDauBinning confPosDauBinning; @@ -82,19 +82,19 @@ struct FemtoPairTrackTwoTrackResonance { twotrackresonancebuilder::ConfPhiSelection phiSelection; twotrackresonancehistmanager::ConfPhiBinning confPhiBinning; Partition phiPartition = MAKE_RESONANCE_0_PARTITON(phiSelection); - Preslice perColPhis = aod::femtobase::stored::collisionId; + Preslice perColPhis = aod::femtobase::stored::fColId; // setup kstar0 twotrackresonancebuilder::ConfKstar0Selection kstar0Selection; twotrackresonancehistmanager::ConfKstar0Binning confKstar0Binning; Partition kstar0Partition = MAKE_RESONANCE_1_PARTITON(kstar0Selection); - Preslice perColKstar0s = aod::femtobase::stored::collisionId; + Preslice perColKstar0s = aod::femtobase::stored::fColId; // rho0s twotrackresonancebuilder::ConfRho0Selection rho0Selection; twotrackresonancehistmanager::ConfRho0Binning confRho0Binning; Partition rho0Partition = MAKE_RESONANCE_0_PARTITON(rho0Selection); - Preslice perColRho0s = aod::femtobase::stored::collisionId; + Preslice perColRho0s = aod::femtobase::stored::fColId; // setup pairs pairhistmanager::ConfPairBinning confPairBinning; diff --git a/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx b/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx index b792421c058..64fcb671314 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx @@ -71,7 +71,7 @@ struct FemtoPairTrackV0 { trackbuilder::ConfTrackSelection1 trackSelection; trackhistmanager::ConfTrackBinning1 confTrackBinning; Partition trackPartition = MAKE_TRACK_PARTITION(trackSelection); - Preslice perColTracks = aod::femtobase::stored::collisionId; + Preslice perColTracks = aod::femtobase::stored::fColId; // setup for daughters trackhistmanager::ConfV0PosDauBinning confPosDauBinning; @@ -81,13 +81,13 @@ struct FemtoPairTrackV0 { v0builder::ConfLambdaSelection1 lambdaSelection; v0histmanager::ConfLambdaBinning1 confLambdaBinning; Partition lambdaPartition = MAKE_LAMBDA_PARTITION(lambdaSelection); - Preslice perColLambdas = aod::femtobase::stored::collisionId; + Preslice perColLambdas = aod::femtobase::stored::fColId; // setup k0shorts v0builder::ConfK0shortSelection1 k0shortSelection; v0histmanager::ConfK0shortBinning1 confK0shortBinning; Partition k0shortPartition = MAKE_K0SHORT_PARTITION(k0shortSelection); - Preslice perColk0shorts = aod::femtobase::stored::collisionId; + Preslice perColk0shorts = aod::femtobase::stored::fColId; // setup pairs pairhistmanager::ConfPairBinning confPairBinning; diff --git a/PWGCF/Femto/Tasks/femtoPairV0V0.cxx b/PWGCF/Femto/Tasks/femtoPairV0V0.cxx index 0f2da302f7e..bda347ad110 100644 --- a/PWGCF/Femto/Tasks/femtoPairV0V0.cxx +++ b/PWGCF/Femto/Tasks/femtoPairV0V0.cxx @@ -75,13 +75,13 @@ struct FemtoPairV0V0 { v0builder::ConfLambdaSelection1 lambdaSelection; v0histmanager::ConfLambdaBinning1 confLambdaBinning; Partition lambdaPartition = MAKE_LAMBDA_PARTITION(lambdaSelection); - Preslice perColLambdas = aod::femtobase::stored::collisionId; + Preslice perColLambdas = aod::femtobase::stored::fColId; // setup k0shorts v0builder::ConfK0shortSelection1 k0shortSelection; v0histmanager::ConfK0shortBinning1 confK0shortBinning; Partition k0shortPartition = MAKE_K0SHORT_PARTITION(k0shortSelection); - Preslice perColk0shorts = aod::femtobase::stored::collisionId; + Preslice perColk0shorts = aod::femtobase::stored::fColId; // setup pairs pairhistmanager::ConfPairBinning confPairBinning; diff --git a/PWGCF/Femto/Tasks/femtoTrackQa.cxx b/PWGCF/Femto/Tasks/femtoTrackQa.cxx index 4ae2deb4cc9..d78679ccf1b 100644 --- a/PWGCF/Femto/Tasks/femtoTrackQa.cxx +++ b/PWGCF/Femto/Tasks/femtoTrackQa.cxx @@ -33,9 +33,7 @@ #include #include -using namespace o2; using namespace o2::aod; -using namespace o2::soa; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::analysis::femto; @@ -43,13 +41,13 @@ using namespace o2::analysis::femto; struct FemtoTrackQa { // setup tables - using Collisions = o2::soa::Join; - using Collision = Collisions::iterator; + using FemtoCollisions = o2::soa::Join; + using FemtoCollision = FemtoCollisions::iterator; - using FilteredCollisions = o2::soa::Filtered; - using FilteredCollision = FilteredCollisions::iterator; + using FilteredFemtoCollisions = o2::soa::Filtered; + using FilteredFemtoCollision = FilteredFemtoCollisions::iterator; - using Tracks = o2::soa::Join; + using FemtoTracks = o2::soa::Join; SliceCache cache; @@ -66,8 +64,8 @@ struct FemtoTrackQa { trackhistmanager::ConfTrackQaBinning1 confTrackQaBinning; trackhistmanager::TrackHistManager trackHistManager; - Partition trackPartition = MAKE_TRACK_PARTITION(trackSelections); - Preslice perColReco = aod::femtobase::stored::collisionId; + Partition trackPartition = MAKE_TRACK_PARTITION(trackSelections); + Preslice perColReco = femtobase::stored::fColId; HistogramRegistry hRegistry{"FemtoTrackQA", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -80,10 +78,10 @@ struct FemtoTrackQa { trackHistManager.init(&hRegistry, trackHistSpec, trackSelections.chargeAbs.value, confTrackQaBinning.momentumType.value); }; - void process(FilteredCollision const& col, Tracks const& tracks) + void process(FilteredFemtoCollision const& col, FemtoTracks const& tracks) { colHistManager.fill(col); - auto trackSlice = trackPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + auto trackSlice = trackPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); for (auto const& track : trackSlice) { trackHistManager.fill(track, tracks); } diff --git a/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx b/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx index fdc2d45accc..c92d6537170 100644 --- a/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx +++ b/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx @@ -36,9 +36,7 @@ #include #include -using namespace o2; using namespace o2::aod; -using namespace o2::soa; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::analysis::femto; @@ -46,16 +44,16 @@ using namespace o2::analysis::femto; struct FemtoTwotrackresonanceQa { // setup tables - using Collisions = Join; - using Collision = Collisions::iterator; + using FemtoCollisions = o2::soa::Join; + using FemtoCollision = FemtoCollisions::iterator; - using FilteredCollisions = o2::soa::Filtered; - using FilteredCollision = FilteredCollisions::iterator; + using FilteredFemtoCollisions = o2::soa::Filtered; + using FilteredFemtoCollision = FilteredFemtoCollisions::iterator; - using Phis = o2::soa::Join; - using Rho0s = o2::soa::Join; - using Kstar0s = o2::soa::Join; - using Tracks = o2::soa::Join; + using FemtoPhis = o2::soa::Join; + using FemtoRho0s = o2::soa::Join; + using FemtoKstar0s = o2::soa::Join; + using FemtoTracks = o2::soa::Join; SliceCache cache; @@ -68,8 +66,8 @@ struct FemtoTwotrackresonanceQa { // setup for phis twotrackresonancebuilder::ConfPhiSelection confPhiSelection; - Partition phiPartition = MAKE_RESONANCE_0_PARTITON(confPhiSelection); - Preslice perColPhis = aod::femtobase::stored::collisionId; + Partition phiPartition = MAKE_RESONANCE_0_PARTITON(confPhiSelection); + Preslice perColPhis = femtobase::stored::fColId; twotrackresonancehistmanager::ConfPhiBinning confPhiBinning; twotrackresonancehistmanager::TwoTrackResonanceHistManager< @@ -82,8 +80,8 @@ struct FemtoTwotrackresonanceQa { // setup for rho0s twotrackresonancebuilder::ConfRho0Selection confRho0Selection; - Partition rho0Partition = MAKE_RESONANCE_0_PARTITON(confRho0Selection); - Preslice perColRhos = aod::femtobase::stored::collisionId; + Partition rho0Partition = MAKE_RESONANCE_0_PARTITON(confRho0Selection); + Preslice perColRhos = femtobase::stored::fColId; twotrackresonancehistmanager::ConfRho0Binning confRho0Binning; twotrackresonancehistmanager::TwoTrackResonanceHistManager< @@ -96,8 +94,8 @@ struct FemtoTwotrackresonanceQa { // setup for kstar0s twotrackresonancebuilder::ConfKstar0Selection confKstar0Selection; - Partition kstar0Partition = MAKE_RESONANCE_1_PARTITON(confKstar0Selection); - Preslice perColKstars = aod::femtobase::stored::collisionId; + Partition kstar0Partition = MAKE_RESONANCE_1_PARTITON(confKstar0Selection); + Preslice perColKstars = femtobase::stored::fColId; twotrackresonancehistmanager::ConfKstar0Binning confKstar0Binning; twotrackresonancehistmanager::TwoTrackResonanceHistManager< @@ -144,30 +142,30 @@ struct FemtoTwotrackresonanceQa { } }; - void processPhis(FilteredCollision const& col, Phis const& /*phis*/, Tracks const& tracks) + void processPhis(FilteredFemtoCollision const& col, FemtoPhis const& /*phis*/, FemtoTracks const& tracks) { colHistManager.fill(col); - auto phiSlice = phiPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + auto phiSlice = phiPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); for (auto const& phi : phiSlice) { phiHistManager.fill(phi, tracks); } }; PROCESS_SWITCH(FemtoTwotrackresonanceQa, processPhis, "Process Phis", true); - void processRho0s(FilteredCollision const& col, Rho0s const& /*rho0s*/, Tracks const& tracks) + void processRho0s(FilteredFemtoCollision const& col, FemtoRho0s const& /*rho0s*/, FemtoTracks const& tracks) { colHistManager.fill(col); - auto rho0Slice = rho0Partition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + auto rho0Slice = rho0Partition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); for (auto const& rho0 : rho0Slice) { rho0HistManager.fill(rho0, tracks); } }; PROCESS_SWITCH(FemtoTwotrackresonanceQa, processRho0s, "Process Rho0s", false); - void processKstar0s(FilteredCollision const& col, Kstar0s const& /*kstar0s*/, Tracks const& tracks) + void processKstar0s(FilteredFemtoCollision const& col, FemtoKstar0s const& /*kstar0s*/, FemtoTracks const& tracks) { colHistManager.fill(col); - auto kstar0Slice = kstar0Partition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + auto kstar0Slice = kstar0Partition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); for (auto const& kstar0 : kstar0Slice) { kstar0HistManager.fill(kstar0, tracks); } diff --git a/PWGCF/Femto/Tasks/femtoV0Qa.cxx b/PWGCF/Femto/Tasks/femtoV0Qa.cxx index 27cafaa761c..1249664fa4c 100644 --- a/PWGCF/Femto/Tasks/femtoV0Qa.cxx +++ b/PWGCF/Femto/Tasks/femtoV0Qa.cxx @@ -36,23 +36,21 @@ #include #include -using namespace o2; using namespace o2::aod; -using namespace o2::soa; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::analysis::femto; struct FemtoV0Qa { - using Collisions = o2::soa::Join; + using FemtoCollisions = o2::soa::Join; - using FilteredCollisions = o2::soa::Filtered; - using FilteredCollision = FilteredCollisions::iterator; + using FilteredFemtoCollisions = o2::soa::Filtered; + using FilteredFemtoCollision = FilteredFemtoCollisions::iterator; - using Lambdas = o2::soa::Join; - using K0shorts = o2::soa::Join; - using Tracks = o2::soa::Join; + using FemtoLambdas = o2::soa::Join; + using FemtoK0shorts = o2::soa::Join; + using FemtoTracks = o2::soa::Join; SliceCache cache; @@ -66,8 +64,8 @@ struct FemtoV0Qa { // setup for lambdas v0builder::ConfLambdaSelection1 confLambdaSelection; - Partition lambdaPartition = MAKE_LAMBDA_PARTITION(confLambdaSelection); - Preslice perColLambdas = aod::femtobase::stored::collisionId; + Partition lambdaPartition = MAKE_LAMBDA_PARTITION(confLambdaSelection); + Preslice perColLambdas = femtobase::stored::fColId; v0histmanager::ConfLambdaBinning1 confLambdaBinning; v0histmanager::ConfLambdaQaBinning1 confLambdaQaBinning; @@ -82,8 +80,8 @@ struct FemtoV0Qa { // setup for k0shorts v0builder::ConfK0shortSelection1 confK0shortSelection; - Partition k0shortPartition = MAKE_K0SHORT_PARTITION(confK0shortSelection); - Preslice perColK0shorts = aod::femtobase::stored::collisionId; + Partition k0shortPartition = MAKE_K0SHORT_PARTITION(confK0shortSelection); + Preslice perColK0shorts = femtobase::stored::fColId; v0histmanager::ConfK0shortBinning1 confK0shortBinning; v0histmanager::ConfK0shortQaBinning1 confK0shortQaBinning; @@ -128,20 +126,20 @@ struct FemtoV0Qa { } }; - void processK0short(FilteredCollision const& col, Tracks const& tracks, K0shorts const& /*k0shorts*/) + void processK0short(FilteredFemtoCollision const& col, FemtoTracks const& tracks, FemtoK0shorts const& /*k0shorts*/) { colHistManager.fill(col); - auto k0shortSlice = k0shortPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + auto k0shortSlice = k0shortPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); for (auto const& k0short : k0shortSlice) { k0shortHistManager.fill(k0short, tracks); } } PROCESS_SWITCH(FemtoV0Qa, processK0short, "Process k0shorts", false); - void processLambda(FilteredCollision const& col, Tracks const& tracks, Lambdas const& /*lambdas*/) + void processLambda(FilteredFemtoCollision const& col, FemtoTracks const& tracks, FemtoLambdas const& /*lambdas*/) { colHistManager.fill(col); - auto lambdaSlice = lambdaPartition->sliceByCached(femtobase::stored::collisionId, col.globalIndex(), cache); + auto lambdaSlice = lambdaPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); for (auto const& lambda : lambdaSlice) { lambdaHistManager.fill(lambda, tracks); } From 1ab97c8840d1a81ec47a9a53a10d2dd7d5c3e28b Mon Sep 17 00:00:00 2001 From: abmodak <67369858+abmodak@users.noreply.github.com> Date: Sat, 25 Oct 2025 10:36:51 +0200 Subject: [PATCH 885/986] [PWGCF] Reorganise histograms to reduce memory consumption (#13534) --- .../Tasks/longrangeCorrelation.cxx | 268 ++++++------------ 1 file changed, 90 insertions(+), 178 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx index e17a88c1cab..fbf3bf419b7 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx @@ -98,7 +98,12 @@ enum KindOfParticles { PROTONS }; -static constexpr std::string_view kCorrType[] = {"Ft0aGlobal/", "Ft0cGlobal/", "MftGlobal/", "Ft0aMft/", "Ft0aFt0c/"}; +static constexpr std::string_view kCorrType[] = { + "Ft0aGlobal/", + "Ft0cGlobal/", + "MftGlobal/", + "Ft0aMft/", + "Ft0aFt0c/"}; static constexpr std::string_view kEvntType[] = {"SE/", "ME/"}; auto static constexpr kMinFt0cCell = 96; auto static constexpr kMinCharge = 3.f; @@ -124,8 +129,6 @@ struct LongrangeCorrelation { Configurable cfgPtCutMin{"cfgPtCutMin", 0.2f, "minimum accepted track pT"}; Configurable cfgPtCutMax{"cfgPtCutMax", 10.0f, "maximum accepted track pT"}; Configurable mixingParameter{"mixingParameter", 5, "how many events are mixed"}; - Configurable cfgMinMult{"cfgMinMult", 0, "Minimum multiplicity for collision"}; - Configurable cfgMaxMult{"cfgMaxMult", 10, "Maximum multiplicity for collision"}; Configurable cfigMftEtaMax{"cfigMftEtaMax", -2.5f, "Maximum MFT eta cut"}; Configurable cfigMftEtaMin{"cfigMftEtaMin", -3.6f, "Minimum MFT eta cut"}; Configurable cfigMftDcaxy{"cfigMftDcaxy", 2.0f, "cut on DCA xy for MFT tracks"}; @@ -177,16 +180,16 @@ struct LongrangeCorrelation { Preslice perColMC = aod::track::collisionId; Preslice perColMft = aod::fwdtrack::collisionId; - OutputObj sameFt0aGlobal{Form("sameEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; - OutputObj mixedFt0aGlobal{Form("mixedEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; - OutputObj sameFt0cGlobal{Form("sameEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; - OutputObj mixedFt0cGlobal{Form("mixedEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; - OutputObj sameMftGlobal{Form("sameEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; - OutputObj mixedMftGlobal{Form("mixedEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; - OutputObj sameFt0aMft{Form("sameEventFt0aMft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; - OutputObj mixedFt0aMft{Form("mixedEventFt0aMft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; - OutputObj sameFt0aFt0c{Form("sameEventFt0aFt0c_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; - OutputObj mixedFt0aFt0c{Form("mixedEventFt0aFt0c_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; + OutputObj sameFt0aGlobal{"sameEventFt0aGlobal"}; + OutputObj mixedFt0aGlobal{"mixedEventFt0aGlobal"}; + OutputObj sameFt0cGlobal{"sameEventFt0cGlobal"}; + OutputObj mixedFt0cGlobal{"mixedEventFt0cGlobal"}; + OutputObj sameMftGlobal{"sameEventMftGlobal"}; + OutputObj mixedMftGlobal{"mixedEventMftGlobal"}; + OutputObj sameFt0aMft{"sameEventFt0aMft"}; + OutputObj mixedFt0aMft{"mixedEventFt0aMft"}; + OutputObj sameFt0aFt0c{"sameEventFt0aFt0c"}; + OutputObj mixedFt0aFt0c{"mixedEventFt0aFt0c"}; // corrections TH3D* hTrkEff = nullptr; @@ -200,15 +203,14 @@ struct LongrangeCorrelation { o2::aod::ITSResponse itsResponse; template - void addHistos() + void addhistosQA() { histos.add(Form("%s%shMult", kCorrType[corrType].data(), kEvntType[evntType].data()), "", kTH1D, {axisMultiplicity}); histos.add(Form("%s%sTrig_etavsphi", kCorrType[corrType].data(), kEvntType[evntType].data()), "", kTH2D, {axisPhi, axisEtaTrig}); histos.add(Form("%s%sTrig_eta", kCorrType[corrType].data(), kEvntType[evntType].data()), "", kTH1D, {axisEtaTrig}); histos.add(Form("%s%sTrig_phi", kCorrType[corrType].data(), kEvntType[evntType].data()), "", kTH1D, {axisPhi}); histos.add(Form("%s%sTrig_pt", kCorrType[corrType].data(), kEvntType[evntType].data()), "", kTH1D, {axisPtTrigger}); - histos.add(Form("%s%shMult_used", kCorrType[corrType].data(), kEvntType[evntType].data()), "", kTH1F, {axisMultiplicity}); - histos.add(Form("%s%sTrig_hist", kCorrType[corrType].data(), kEvntType[evntType].data()), "", kTHnSparseF, {axisSample, axisVtxZ, axisPtTrigger}); + histos.add(Form("%s%sTrig_hist", kCorrType[corrType].data(), kEvntType[evntType].data()), "", kTHnSparseF, {axisSample, axisVtxZ, axisPtTrigger, axisMultiplicity}); histos.add(Form("%s%sAssoc_amp", kCorrType[corrType].data(), kEvntType[evntType].data()), "", kTH2D, {channelFt0aAxis, amplitudeFt0a}); histos.add(Form("%s%sAssoc_eta", kCorrType[corrType].data(), kEvntType[evntType].data()), "", kTH1D, {axisEtaAssoc}); histos.add(Form("%s%sAssoc_phi", kCorrType[corrType].data(), kEvntType[evntType].data()), "", kTH1D, {axisPhi}); @@ -239,6 +241,7 @@ struct LongrangeCorrelation { {axisEtaEfficiency, "#eta"}}; std::vector userAxis; + userAxis.emplace_back(axisMultiplicity, "multiplicity"); tofNsigmaCut = tofNsigmaPidCut; itsNsigmaCut = itsNsigmaPidCut; @@ -258,38 +261,38 @@ struct LongrangeCorrelation { } if (doprocessFt0aGlobalSE || doprocessFt0aGlobalME) { - addHistos(); - addHistos(); - sameFt0aGlobal.setObject(new CorrelationContainer(Form("sameEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); - mixedFt0aGlobal.setObject(new CorrelationContainer(Form("mixedEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); + addhistosQA(); + histos.add("Ft0aGlobal/ME/deltaEta_deltaPhi", "", kTH2D, {axisDeltaPhi, axisDeltaEta}); + sameFt0aGlobal.setObject(new CorrelationContainer("sameEventFt0aGlobal", "sameEventFt0aGlobal", corrAxis, effAxis, userAxis)); + mixedFt0aGlobal.setObject(new CorrelationContainer("mixedEventFt0aGlobal", "mixedEventFt0aGlobal", corrAxis, effAxis, userAxis)); } if (doprocessFt0cGlobalSE || doprocessFt0cGlobalME) { - addHistos(); - addHistos(); - sameFt0cGlobal.setObject(new CorrelationContainer(Form("sameEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); - mixedFt0cGlobal.setObject(new CorrelationContainer(Form("mixedEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); + addhistosQA(); + histos.add("Ft0cGlobal/ME/deltaEta_deltaPhi", "", kTH2D, {axisDeltaPhi, axisDeltaEta}); + sameFt0cGlobal.setObject(new CorrelationContainer("sameEventFt0cGlobal", "sameEventFt0cGlobal", corrAxis, effAxis, userAxis)); + mixedFt0cGlobal.setObject(new CorrelationContainer("mixedEventFt0cGlobal", "mixedEventFt0cGlobal", corrAxis, effAxis, userAxis)); } if (doprocessMftGlobalSE || doprocessMftGlobalME) { - addHistos(); - addHistos(); - sameMftGlobal.setObject(new CorrelationContainer(Form("sameEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); - mixedMftGlobal.setObject(new CorrelationContainer(Form("mixedEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); + addhistosQA(); + histos.add("MftGlobal/ME/deltaEta_deltaPhi", "", kTH2D, {axisDeltaPhi, axisDeltaEta}); + sameMftGlobal.setObject(new CorrelationContainer("sameEventMftGlobal", "sameEventMftGlobal", corrAxis, effAxis, userAxis)); + mixedMftGlobal.setObject(new CorrelationContainer("mixedEventMftGlobal", "mixedEventMftGlobal", corrAxis, effAxis, userAxis)); } if (doprocessFt0aMftSE || doprocessFt0aMftME) { - addHistos(); - addHistos(); - sameFt0aMft.setObject(new CorrelationContainer(Form("sameEventFt0aMft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFt0aMft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); - mixedFt0aMft.setObject(new CorrelationContainer(Form("mixedEventFt0aMft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFt0aMft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); + addhistosQA(); + histos.add("Ft0aMft/ME/deltaEta_deltaPhi", "", kTH2D, {axisDeltaPhi, axisDeltaEta}); + sameFt0aMft.setObject(new CorrelationContainer("sameEventFt0aMft", "sameEventFt0aMft", corrAxis, effAxis, userAxis)); + mixedFt0aMft.setObject(new CorrelationContainer("mixedEventFt0aMft", "mixedEventFt0aMft", corrAxis, effAxis, userAxis)); } if (doprocessFt0aFt0cSE || doprocessFt0aFt0cME) { - addHistos(); - addHistos(); - sameFt0aFt0c.setObject(new CorrelationContainer(Form("sameEventFt0aFt0c_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFt0aFt0c_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); - mixedFt0aFt0c.setObject(new CorrelationContainer(Form("mixedEventFt0aFt0c_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFt0aFt0c_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); + addhistosQA(); + histos.add("Ft0aFt0c/ME/deltaEta_deltaPhi", "", kTH2D, {axisDeltaPhi, axisDeltaEta}); + sameFt0aFt0c.setObject(new CorrelationContainer("sameEventFt0aFt0c", "sameEventFt0aFt0c", corrAxis, effAxis, userAxis)); + mixedFt0aFt0c.setObject(new CorrelationContainer("mixedEventFt0aFt0c", "mixedEventFt0aFt0c", corrAxis, effAxis, userAxis)); } if (doprocessEff) { @@ -361,32 +364,13 @@ struct LongrangeCorrelation { return true; } - template - void fillYieldTpc(TTracks tracks) + template + void fillTrackQA(TTrack const& track) { - histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("hMult"), tracks.size()); - for (auto const& iTrk : tracks) { - if (cfgTrackPid && getTrackPID(iTrk) != cfgTrackPid) - continue; // if PID is selected, check if the track has the right PID - histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_etavsphi"), iTrk.phi(), iTrk.eta()); - histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_eta"), iTrk.eta()); - histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_phi"), iTrk.phi()); - histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_pt"), iTrk.pt()); - } - } - - template - void fillYieldMft(TTracks tracks) - { - histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("hMult"), tracks.size()); - for (auto const& iTrk : tracks) { - auto phi = iTrk.phi(); - o2::math_utils::bringTo02Pi(phi); - histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_etavsphi"), phi, iTrk.eta()); - histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_eta"), iTrk.eta()); - histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_phi"), phi); - histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_pt"), iTrk.pt()); - } + histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_etavsphi"), track.phi(), track.eta()); + histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_eta"), track.eta()); + histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_phi"), track.phi()); + histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_pt"), track.pt()); } template @@ -533,37 +517,30 @@ struct LongrangeCorrelation { template void fillCorrFt0aGlobal(TTarget target, TTriggers const& triggers, TFT0s const& ft0, bool mixing, float vz, float multiplicity) { + histos.fill(HIST("Ft0aGlobal/SE/hMult"), multiplicity); int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); - if (!mixing) - histos.fill(HIST("Ft0aGlobal/SE/hMult_used"), multiplicity); - for (auto const& triggerTrack : triggers) { if (cfgTrackPid && getTrackPID(triggerTrack) != cfgTrackPid) continue; // if PID is selected, check if the track has the right PID + float trkeffw = 1.0f; if (isUseEffCorr) trkeffw = getTrkEffCorr(triggerTrack.eta(), triggerTrack.pt(), vz); - if (!mixing) - histos.fill(HIST("Ft0aGlobal/SE/Trig_hist"), fSampleIndex, vz, triggerTrack.pt(), trkeffw); + if (!mixing) { + fillTrackQA(triggerTrack); + histos.fill(HIST("Ft0aGlobal/SE/Trig_hist"), fSampleIndex, vz, triggerTrack.pt(), multiplicity, trkeffw); + } for (std::size_t iCh = 0; iCh < ft0.channelA().size(); iCh++) { auto chanelid = ft0.channelA()[iCh]; float ampl = ft0.amplitudeA()[iCh]; - if (mixing) - histos.fill(HIST("Ft0aGlobal/ME/Assoc_amp"), chanelid, ampl); - else - histos.fill(HIST("Ft0aGlobal/SE/Assoc_amp"), chanelid, ampl); - auto phi = getPhiFT0(chanelid, 0); auto eta = getEtaFT0(chanelid, 0); - if (mixing) { - histos.fill(HIST("Ft0aGlobal/ME/Assoc_eta"), eta); - histos.fill(HIST("Ft0aGlobal/ME/Assoc_phi"), phi); - histos.fill(HIST("Ft0aGlobal/ME/Assoc_etavsphi"), phi, eta); - } else { + if (!mixing) { + histos.fill(HIST("Ft0aGlobal/SE/Assoc_amp"), chanelid, ampl); histos.fill(HIST("Ft0aGlobal/SE/Assoc_eta"), eta); histos.fill(HIST("Ft0aGlobal/SE/Assoc_phi"), phi); histos.fill(HIST("Ft0aGlobal/SE/Assoc_etavsphi"), phi, eta); @@ -574,7 +551,7 @@ struct LongrangeCorrelation { histos.fill(HIST("Ft0aGlobal/ME/deltaEta_deltaPhi"), deltaPhi, deltaEta, trkeffw); else histos.fill(HIST("Ft0aGlobal/SE/deltaEta_deltaPhi"), deltaPhi, deltaEta, trkeffw); - target->getPairHist()->Fill(step, fSampleIndex, vz, triggerTrack.pt(), triggerTrack.pt(), deltaPhi, deltaEta, trkeffw); + target->getPairHist()->Fill(step, fSampleIndex, vz, triggerTrack.pt(), triggerTrack.pt(), deltaPhi, deltaEta, multiplicity, trkeffw); } // associated ft0 tracks } // trigger tracks } // fillCorrFt0aGlobal @@ -582,47 +559,42 @@ struct LongrangeCorrelation { template void fillCorrFt0cGlobal(TTarget target, TTriggers const& triggers, TFT0s const& ft0, bool mixing, float vz, float multiplicity) { + histos.fill(HIST("Ft0cGlobal/SE/hMult"), multiplicity); int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); - if (!mixing) - histos.fill(HIST("Ft0cGlobal/SE/hMult_used"), multiplicity); for (auto const& triggerTrack : triggers) { if (cfgTrackPid && getTrackPID(triggerTrack) != cfgTrackPid) continue; // if PID is selected, check if the track has the right PID + float trkeffw = 1.0f; if (isUseEffCorr) trkeffw = getTrkEffCorr(triggerTrack.eta(), triggerTrack.pt(), vz); - if (!mixing) - histos.fill(HIST("Ft0cGlobal/SE/Trig_hist"), fSampleIndex, vz, triggerTrack.pt(), trkeffw); + if (!mixing) { + fillTrackQA(triggerTrack); + histos.fill(HIST("Ft0cGlobal/SE/Trig_hist"), fSampleIndex, vz, triggerTrack.pt(), multiplicity, trkeffw); + } for (std::size_t iCh = 0; iCh < ft0.channelC().size(); iCh++) { auto chanelid = ft0.channelC()[iCh] + 96; float ampl = ft0.amplitudeC()[iCh]; - if (mixing) - histos.fill(HIST("Ft0cGlobal/ME/Assoc_amp"), chanelid, ampl); - else - histos.fill(HIST("Ft0cGlobal/SE/Assoc_amp"), chanelid, ampl); - auto phi = getPhiFT0(chanelid, 1); auto eta = getEtaFT0(chanelid, 1); - if (mixing) { - histos.fill(HIST("Ft0cGlobal/ME/Assoc_eta"), eta); - histos.fill(HIST("Ft0cGlobal/ME/Assoc_phi"), phi); - histos.fill(HIST("Ft0cGlobal/ME/Assoc_etavsphi"), phi, eta); - } else { + if (!mixing) { + histos.fill(HIST("Ft0cGlobal/SE/Assoc_amp"), chanelid, ampl); histos.fill(HIST("Ft0cGlobal/SE/Assoc_eta"), eta); histos.fill(HIST("Ft0cGlobal/SE/Assoc_phi"), phi); histos.fill(HIST("Ft0cGlobal/SE/Assoc_etavsphi"), phi, eta); } + float deltaPhi = RecoDecay::constrainAngle(triggerTrack.phi() - phi, -PIHalf); float deltaEta = triggerTrack.eta() - eta; if (mixing) histos.fill(HIST("Ft0cGlobal/ME/deltaEta_deltaPhi"), deltaPhi, deltaEta, trkeffw); else histos.fill(HIST("Ft0cGlobal/SE/deltaEta_deltaPhi"), deltaPhi, deltaEta, trkeffw); - target->getPairHist()->Fill(step, fSampleIndex, vz, triggerTrack.pt(), triggerTrack.pt(), deltaPhi, deltaEta, trkeffw); + target->getPairHist()->Fill(step, fSampleIndex, vz, triggerTrack.pt(), triggerTrack.pt(), deltaPhi, deltaEta, multiplicity, trkeffw); } // associated ft0 tracks } // trigger tracks } // fillCorrFt0cGlobal @@ -630,18 +602,20 @@ struct LongrangeCorrelation { template void fillCorrMftGlobal(TTarget target, TTriggers const& triggers, TMFTs const& mft, bool mixing, float vz, float multiplicity) { + histos.fill(HIST("MftGlobal/SE/hMult"), multiplicity); int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); - if (!mixing) - histos.fill(HIST("MftGlobal/SE/hMult_used"), multiplicity); for (auto const& triggerTrack : triggers) { if (cfgTrackPid && getTrackPID(triggerTrack) != cfgTrackPid) continue; // if PID is selected, check if the track has the right PID + float trkeffw = 1.0f; if (isUseEffCorr) trkeffw = getTrkEffCorr(triggerTrack.eta(), triggerTrack.pt(), vz); - if (!mixing) - histos.fill(HIST("MftGlobal/SE/Trig_hist"), fSampleIndex, vz, triggerTrack.pt(), trkeffw); + if (!mixing) { + fillTrackQA(triggerTrack); + histos.fill(HIST("MftGlobal/SE/Trig_hist"), fSampleIndex, vz, triggerTrack.pt(), multiplicity, trkeffw); + } for (auto const& assoTrack : mft) { if (!isMftTrackSelected(assoTrack)) { @@ -649,22 +623,20 @@ struct LongrangeCorrelation { } auto phi = assoTrack.phi(); o2::math_utils::bringTo02Pi(phi); - if (mixing) { - histos.fill(HIST("MftGlobal/ME/Assoc_eta"), assoTrack.eta()); - histos.fill(HIST("MftGlobal/ME/Assoc_phi"), phi); - histos.fill(HIST("MftGlobal/ME/Assoc_etavsphi"), phi, assoTrack.eta()); - } else { + + if (!mixing) { histos.fill(HIST("MftGlobal/SE/Assoc_eta"), assoTrack.eta()); histos.fill(HIST("MftGlobal/SE/Assoc_phi"), phi); histos.fill(HIST("MftGlobal/SE/Assoc_etavsphi"), phi, assoTrack.eta()); } + float deltaPhi = RecoDecay::constrainAngle(triggerTrack.phi() - phi, -PIHalf); float deltaEta = triggerTrack.eta() - assoTrack.eta(); if (mixing) histos.fill(HIST("MftGlobal/ME/deltaEta_deltaPhi"), deltaPhi, deltaEta, trkeffw); else histos.fill(HIST("MftGlobal/SE/deltaEta_deltaPhi"), deltaPhi, deltaEta, trkeffw); - target->getPairHist()->Fill(step, fSampleIndex, vz, triggerTrack.pt(), assoTrack.pt(), deltaPhi, deltaEta, trkeffw); + target->getPairHist()->Fill(step, fSampleIndex, vz, triggerTrack.pt(), assoTrack.pt(), deltaPhi, deltaEta, multiplicity, trkeffw); } // associated mft tracks } // trigger tracks } // fillCorrMftGlobal @@ -672,36 +644,30 @@ struct LongrangeCorrelation { template void fillCorrFt0aMft(TTarget target, TTriggers const& triggers, TFT0s const& ft0, bool mixing, float vz, float multiplicity) { + histos.fill(HIST("Ft0aMft/SE/hMult"), multiplicity); int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); - if (!mixing) - histos.fill(HIST("Ft0aMft/SE/hMult_used"), multiplicity); for (auto const& triggerTrack : triggers) { if (!isMftTrackSelected(triggerTrack)) { continue; } - if (!mixing) - histos.fill(HIST("Ft0aMft/SE/Trig_hist"), fSampleIndex, vz, triggerTrack.pt()); auto trigphi = triggerTrack.phi(); o2::math_utils::bringTo02Pi(trigphi); + if (!mixing) { + fillTrackQA(triggerTrack); + histos.fill(HIST("Ft0aMft/SE/Trig_hist"), fSampleIndex, vz, triggerTrack.pt(), multiplicity); + } + for (std::size_t iCh = 0; iCh < ft0.channelA().size(); iCh++) { auto chanelid = ft0.channelA()[iCh]; float ampl = ft0.amplitudeA()[iCh]; - if (mixing) - histos.fill(HIST("Ft0aMft/ME/Assoc_amp"), chanelid, ampl); - else - histos.fill(HIST("Ft0aMft/SE/Assoc_amp"), chanelid, ampl); - auto phi = getPhiFT0(chanelid, 0); auto eta = getEtaFT0(chanelid, 0); - if (mixing) { - histos.fill(HIST("Ft0aMft/ME/Assoc_eta"), eta); - histos.fill(HIST("Ft0aMft/ME/Assoc_phi"), phi); - histos.fill(HIST("Ft0aMft/ME/Assoc_etavsphi"), phi, eta); - } else { + if (!mixing) { + histos.fill(HIST("Ft0aMft/SE/Assoc_amp"), chanelid, ampl); histos.fill(HIST("Ft0aMft/SE/Assoc_eta"), eta); histos.fill(HIST("Ft0aMft/SE/Assoc_phi"), phi); histos.fill(HIST("Ft0aMft/SE/Assoc_etavsphi"), phi, eta); @@ -713,7 +679,7 @@ struct LongrangeCorrelation { histos.fill(HIST("Ft0aMft/ME/deltaEta_deltaPhi"), deltaPhi, deltaEta); else histos.fill(HIST("Ft0aMft/SE/deltaEta_deltaPhi"), deltaPhi, deltaEta); - target->getPairHist()->Fill(step, fSampleIndex, vz, triggerTrack.pt(), triggerTrack.pt(), deltaPhi, deltaEta); + target->getPairHist()->Fill(step, fSampleIndex, vz, triggerTrack.pt(), triggerTrack.pt(), deltaPhi, deltaEta, multiplicity); } // associated ft0 tracks } // trigger tracks } // fillCorrFt0aMft @@ -721,26 +687,19 @@ struct LongrangeCorrelation { template void fillCorrFt0aFt0c(TTarget target, TFT0As const& ft0a, TFT0Cs const& ft0c, bool mixing, float vz, float multiplicity) { + histos.fill(HIST("Ft0aFt0c/SE/hMult"), multiplicity); int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); - if (!mixing) - histos.fill(HIST("Ft0aFt0c/SE/hMult_used"), multiplicity); - for (std::size_t iChA = 0; iChA < ft0a.channelA().size(); iChA++) { - if (!mixing) - histos.fill(HIST("Ft0aFt0c/SE/Trig_hist"), fSampleIndex, vz, 1.0); auto chanelidA = ft0a.channelA()[iChA]; auto phiA = getPhiFT0(chanelidA, 0); auto etaA = getEtaFT0(chanelidA, 0); - if (mixing) { - histos.fill(HIST("Ft0aFt0c/ME/Trig_eta"), etaA); - histos.fill(HIST("Ft0aFt0c/ME/Trig_phi"), phiA); - histos.fill(HIST("Ft0aFt0c/ME/Trig_etavsphi"), phiA, etaA); - } else { + if (!mixing) { histos.fill(HIST("Ft0aFt0c/SE/Trig_eta"), etaA); histos.fill(HIST("Ft0aFt0c/SE/Trig_phi"), phiA); histos.fill(HIST("Ft0aFt0c/SE/Trig_etavsphi"), phiA, etaA); + histos.fill(HIST("Ft0aFt0c/SE/Trig_hist"), fSampleIndex, vz, 1.0, multiplicity); } for (std::size_t iChC = 0; iChC < ft0c.channelC().size(); iChC++) { @@ -750,16 +709,8 @@ struct LongrangeCorrelation { auto phiC = getPhiFT0(chanelidC, 1); auto etaC = getEtaFT0(chanelidC, 1); - if (mixing) - histos.fill(HIST("Ft0aFt0c/ME/Assoc_amp"), chanelidC, ampl); - else - histos.fill(HIST("Ft0aFt0c/SE/Assoc_amp"), chanelidC, ampl); - if (mixing) { - histos.fill(HIST("Ft0aFt0c/ME/Assoc_eta"), etaC); - histos.fill(HIST("Ft0aFt0c/ME/Assoc_phi"), phiC); - histos.fill(HIST("Ft0aFt0c/ME/Assoc_etavsphi"), phiC, etaC); - } else { + histos.fill(HIST("Ft0aFt0c/SE/Assoc_amp"), chanelidC, ampl); histos.fill(HIST("Ft0aFt0c/SE/Assoc_eta"), etaC); histos.fill(HIST("Ft0aFt0c/SE/Assoc_phi"), phiC); histos.fill(HIST("Ft0aFt0c/SE/Assoc_etavsphi"), phiC, etaC); @@ -771,7 +722,7 @@ struct LongrangeCorrelation { histos.fill(HIST("Ft0aFt0c/ME/deltaEta_deltaPhi"), deltaPhi, deltaEta); else histos.fill(HIST("Ft0aFt0c/SE/deltaEta_deltaPhi"), deltaPhi, deltaEta); - target->getPairHist()->Fill(step, fSampleIndex, vz, 1.0, 1.0, deltaPhi, deltaEta); + target->getPairHist()->Fill(step, fSampleIndex, vz, 1.0, 1.0, deltaPhi, deltaEta, multiplicity); } // associated ft0 tracks } // trigger tracks } // fillCorrFt0aFt0c @@ -807,7 +758,6 @@ struct LongrangeCorrelation { auto bc = col.bc_as(); loadEffCorrection(bc.timestamp()); loadMultCorrection(bc.timestamp()); - fillYieldTpc(tracks); const auto& ft0 = col.foundFT0(); auto multiplicity = 1.0f; if (isUseCentEst) @@ -817,9 +767,6 @@ struct LongrangeCorrelation { float multw = getMultEffCorr(multiplicity); if (isUseEffCorr) multiplicity = multiplicity * multw; - if (multiplicity < cfgMinMult || multiplicity >= cfgMaxMult) { - return; - } fillCorrFt0aGlobal(sameFt0aGlobal, tracks, ft0, false, col.posZ(), multiplicity); } } // same event @@ -833,7 +780,6 @@ struct LongrangeCorrelation { auto bc = col.bc_as(); loadEffCorrection(bc.timestamp()); loadMultCorrection(bc.timestamp()); - fillYieldTpc(tracks); const auto& ft0 = col.foundFT0(); auto multiplicity = 1.0f; if (isUseCentEst) @@ -843,9 +789,6 @@ struct LongrangeCorrelation { float multw = getMultEffCorr(multiplicity); if (isUseEffCorr) multiplicity = multiplicity * multw; - if (multiplicity < cfgMinMult || multiplicity >= cfgMaxMult) { - return; - } fillCorrFt0cGlobal(sameFt0cGlobal, tracks, ft0, false, col.posZ(), multiplicity); } } // same event @@ -858,7 +801,6 @@ struct LongrangeCorrelation { auto bc = col.bc_as(); loadEffCorrection(bc.timestamp()); loadMultCorrection(bc.timestamp()); - fillYieldTpc(tracks); auto multiplicity = 1.0f; if (isUseCentEst) multiplicity = selColCent(col); @@ -867,9 +809,6 @@ struct LongrangeCorrelation { float multw = getMultEffCorr(multiplicity); if (isUseEffCorr) multiplicity = multiplicity * multw; - if (multiplicity < cfgMinMult || multiplicity >= cfgMaxMult) { - return; - } fillCorrMftGlobal(sameMftGlobal, tracks, mfttracks, false, col.posZ(), multiplicity); } // same event @@ -879,7 +818,6 @@ struct LongrangeCorrelation { return; } if (col.has_foundFT0()) { - fillYieldMft(mfttracks); auto bc = col.bc_as(); loadMultCorrection(bc.timestamp()); const auto& ft0 = col.foundFT0(); @@ -891,9 +829,6 @@ struct LongrangeCorrelation { float multw = getMultEffCorr(multiplicity); if (isUseEffCorr) multiplicity = multiplicity * multw; - if (multiplicity < cfgMinMult || multiplicity >= cfgMaxMult) { - return; - } fillCorrFt0aMft(sameFt0aMft, mfttracks, ft0, false, col.posZ(), multiplicity); } } // same event @@ -912,13 +847,9 @@ struct LongrangeCorrelation { multiplicity = selColCent(col); else multiplicity = countNTracks(tracks); - histos.fill(HIST("Ft0aFt0c/SE/hMult"), multiplicity); float multw = getMultEffCorr(multiplicity); if (isUseEffCorr) multiplicity = multiplicity * multw; - if (multiplicity < cfgMinMult || multiplicity >= cfgMaxMult) { - return; - } fillCorrFt0aFt0c(sameFt0aFt0c, ft0, ft0, false, col.posZ(), multiplicity); } } // same event @@ -944,7 +875,6 @@ struct LongrangeCorrelation { loadEffCorrection(bc.timestamp()); loadMultCorrection(bc.timestamp()); auto slicedTriggerTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); - fillYieldTpc(slicedTriggerTracks); const auto& ft0 = col2.foundFT0(); auto multiplicity = 1.0f; if (isUseCentEst) @@ -954,9 +884,6 @@ struct LongrangeCorrelation { float multw = getMultEffCorr(multiplicity); if (isUseEffCorr) multiplicity = multiplicity * multw; - if (multiplicity < cfgMinMult || multiplicity >= cfgMaxMult) { - continue; - } fillCorrFt0aGlobal(mixedFt0aGlobal, slicedTriggerTracks, ft0, true, col1.posZ(), multiplicity); } } @@ -983,7 +910,6 @@ struct LongrangeCorrelation { loadEffCorrection(bc.timestamp()); loadMultCorrection(bc.timestamp()); auto slicedTriggerTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); - fillYieldTpc(slicedTriggerTracks); const auto& ft0 = col2.foundFT0(); auto multiplicity = 1.0f; if (isUseCentEst) @@ -993,9 +919,6 @@ struct LongrangeCorrelation { float multw = getMultEffCorr(multiplicity); if (isUseEffCorr) multiplicity = multiplicity * multw; - if (multiplicity < cfgMinMult || multiplicity >= cfgMaxMult) { - continue; - } fillCorrFt0cGlobal(mixedFt0cGlobal, slicedTriggerTracks, ft0, true, col1.posZ(), multiplicity); } } @@ -1027,9 +950,6 @@ struct LongrangeCorrelation { float multw = getMultEffCorr(multiplicity); if (isUseEffCorr) multiplicity = multiplicity * multw; - if (multiplicity < cfgMinMult || multiplicity >= cfgMaxMult) { - continue; - } fillCorrMftGlobal(mixedMftGlobal, tracks1, tracks2, true, col1.posZ(), multiplicity); } } // mixed event @@ -1055,7 +975,6 @@ struct LongrangeCorrelation { loadMultCorrection(bc.timestamp()); auto slicedTriggerMftTracks = mfttracks.sliceBy(perColMft, col1.globalIndex()); auto slicedTriggerTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); - fillYieldMft(slicedTriggerMftTracks); const auto& ft0 = col2.foundFT0(); auto multiplicity = 1.0f; if (isUseCentEst) @@ -1065,9 +984,6 @@ struct LongrangeCorrelation { float multw = getMultEffCorr(multiplicity); if (isUseEffCorr) multiplicity = multiplicity * multw; - if (multiplicity < cfgMinMult || multiplicity >= cfgMaxMult) { - continue; - } fillCorrFt0aMft(mixedFt0aMft, slicedTriggerMftTracks, ft0, true, col1.posZ(), multiplicity); } } @@ -1098,15 +1014,11 @@ struct LongrangeCorrelation { multiplicity = selColCent(col1); else multiplicity = countNTracks(slicedTriggerTracks); - histos.fill(HIST("Ft0aFt0c/ME/hMult"), multiplicity); const auto& ft0a = col1.foundFT0(); const auto& ft0c = col2.foundFT0(); float multw = getMultEffCorr(multiplicity); if (isUseEffCorr) multiplicity = multiplicity * multw; - if (multiplicity < cfgMinMult || multiplicity >= cfgMaxMult) { - continue; - } fillCorrFt0aFt0c(mixedFt0aFt0c, ft0a, ft0c, true, col1.posZ(), multiplicity); } } @@ -1151,9 +1063,9 @@ struct LongrangeCorrelation { } else { numcontributors = RecCol.numContrib(); } - if (isUseCentEst) + if (isUseCentEst) { multiplicity = selColCent(RecCol); - else { + } else { auto recTracksPart = RecTracks.sliceBy(perColMC, RecCol.globalIndex()); multiplicity = countNTracks(recTracksPart); } From 4a5f3984b59c54b94136b9c67eea6ecb81d5056b Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Sat, 25 Oct 2025 10:41:30 +0200 Subject: [PATCH 886/986] [PWGCF] FemtoUniverse: Add flags for event selection cuts with centrality (#13532) --- .../TableProducer/femtoUniverseProducerTask.cxx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx index e45c4e0084d..6f4ee10f054 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx @@ -158,6 +158,10 @@ struct FemtoUniverseProducerTask { Configurable confEvNoSameBunchPileup{"confEvNoSameBunchPileup", true, "Require kNoSameBunchPileup selection on Events."}; Configurable confIsUsePileUp{"confIsUsePileUp", true, "Required for choosing whether to run the pile-up cuts"}; Configurable confEvIsVertexITSTPC{"confEvIsVertexITSTPC", true, "Require kIsVertexITSTPC selection on Events"}; + Configurable confIsGoodITSLayersAll{"confIsGoodITSLayersAll", true, "Require IsGoodITSLayersAll selection on Events."}; + Configurable confNoCollInRofStandard{"confNoCollInRofStandard", true, "Require NoCollInRofStandard selection on Events."}; + Configurable confNoHighMultCollInPrevRof{"confNoHighMultCollInPrevRof", true, "Require NoHighMultCollInPrevRof selection on Events."}; + Configurable confNoCollInTimeRangeStandard{"confNoCollInTimeRangeStandard", true, "Require NoCollInTimeRangeStandard selection on Events."}; Configurable confTPCOccupancyMin{"confTPCOccupancyMin", 0, "Minimum value for TPC Occupancy selection"}; Configurable confTPCOccupancyMax{"confTPCOccupancyMax", 500, "Maximum value for TPC Occupancy selection"}; Configurable confIsCent{"confIsCent", true, "Centrality or multiplicity selection"}; @@ -1117,12 +1121,13 @@ struct FemtoUniverseProducerTask { if (!colCuts.isSelectedRun3(col) || (occupancy < ConfGeneral.confTPCOccupancyMin || occupancy > ConfGeneral.confTPCOccupancyMax)) { return false; } else { - if (col.selection_bit(aod::evsel::kNoSameBunchPileup) && - col.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) && - col.selection_bit(aod::evsel::kIsGoodITSLayersAll) && - col.selection_bit(aod::evsel::kNoCollInRofStandard) && - col.selection_bit(aod::evsel::kNoHighMultCollInPrevRof) && - col.selection_bit(aod::evsel::kNoCollInTimeRangeStandard)) { + if ((!ConfGeneral.confEvNoSameBunchPileup || col.selection_bit(aod::evsel::kNoSameBunchPileup)) && + (!ConfGeneral.confEvIsGoodZvtxFT0vsPV || col.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) && + (!ConfGeneral.confIsGoodITSLayersAll || col.selection_bit(aod::evsel::kIsGoodITSLayersAll)) && + (!ConfGeneral.confNoCollInRofStandard || col.selection_bit(aod::evsel::kNoCollInRofStandard)) && + (!ConfGeneral.confNoHighMultCollInPrevRof || col.selection_bit(aod::evsel::kNoHighMultCollInPrevRof)) && + (!ConfGeneral.confEvIsVertexITSTPC || col.selection_bit(aod::evsel::kIsVertexITSTPC)) && + (!ConfGeneral.confNoCollInTimeRangeStandard || col.selection_bit(aod::evsel::kNoCollInTimeRangeStandard))) { outputCollision(vtxZ, cent, multNtr, 2, mMagField); return true; } else { From 9ef33d1a5e638dafb69dbe5b58087d0c4a465127 Mon Sep 17 00:00:00 2001 From: Francesca Ercolessi Date: Sat, 25 Oct 2025 12:57:51 +0200 Subject: [PATCH 887/986] PWGLF: change binning of histogram for MC calibration (#13545) --- PWGLF/Tasks/QC/mcParticlePrediction.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Tasks/QC/mcParticlePrediction.cxx b/PWGLF/Tasks/QC/mcParticlePrediction.cxx index 0c1fca899f3..821d98de975 100644 --- a/PWGLF/Tasks/QC/mcParticlePrediction.cxx +++ b/PWGLF/Tasks/QC/mcParticlePrediction.cxx @@ -191,7 +191,7 @@ struct mcParticlePrediction { const AxisSpec axisImpactParameter{binsImpactParameter, "Impact parameter (fm)"}; const AxisSpec axisMultiplicity{binsMultiplicity, "Multiplicity (undefined)"}; const AxisSpec axisMultiplicityReco{binsMultiplicityReco, "Multiplicity Reco. (undefined)"}; - const AxisSpec axisMultiplicityRecoITS{100, 0, 100, "Multiplicity Reco. ITSIB"}; + const AxisSpec axisMultiplicityRecoITS{binsMultiplicityReco, "Multiplicity Reco. ITSIB"}; const AxisSpec axisMultiplicityGenV0s{100, 0, 100, "K0s gen"}; const AxisSpec axisMultiplicityRecoV0s{20, 0, 20, "K0s reco"}; const AxisSpec axisBCID{o2::constants::lhc::LHCMaxBunches, -0.5, -0.5 + o2::constants::lhc::LHCMaxBunches, "BC ID in orbit"}; From 633ed49ddf7455e4527aeac3a82042b0113a7b3a Mon Sep 17 00:00:00 2001 From: Sweta Singh <122526337+sweta29singh@users.noreply.github.com> Date: Sat, 25 Oct 2025 13:04:17 +0200 Subject: [PATCH 888/986] [PWGCF] Resolved memory consumption issue while testing on hyperloop (#13524) --- .../EbyEFluctuations/Tasks/eventMeanPtId.cxx | 570 ++++++++---------- 1 file changed, 255 insertions(+), 315 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/eventMeanPtId.cxx b/PWGCF/EbyEFluctuations/Tasks/eventMeanPtId.cxx index 717a5a46cae..a8f7a7b691a 100644 --- a/PWGCF/EbyEFluctuations/Tasks/eventMeanPtId.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/eventMeanPtId.cxx @@ -60,7 +60,6 @@ using o2::constants::physics::Pdg; struct EventMeanPtId { #define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; - // Configurables Configurable cVtxZcut{"cVtxZcut", 10.0f, "Vertex Z"}; Configurable cEtacut{"cEtacut", 0.8f, "Eta cut"}; @@ -81,7 +80,6 @@ struct EventMeanPtId { Configurable ptMax{"ptMax", 2.0, "maximum pT"}; Configurable ptMin{"ptMin", 0.15, "minimum pT"}; Configurable> ptBins{"ptBins", {0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.90, 0.95, 1.00, 1.05, 1.10, 1.15, 1.20, 1.25, 1.30, 1.35, 1.40, 1.45, 1.50, 1.55, 1.60, 1.65, 1.70, 1.75, 1.80, 1.85, 1.90, 1.95, 2.00}, "p_{T} bins"}; - // Event selections Configurable cSel8Trig{"cSel8Trig", true, "Sel8 (T0A + T0C) Selection Run3"}; Configurable cpileupTFBorder{"cpileupTFBorder", true, "Timeframe Border Selection"}; @@ -105,7 +103,6 @@ struct EventMeanPtId { Configurable pidSwitchHistoFill{"pidSwitchHistoFill", false, "pid histogram filling"}; Configurable effSwitch{"effSwitch", false, "efficiency calculations"}; Configurable effSwitchHistoFill{"effSwitchHistoFill", false, "efficiency histogram filling"}; - // PID selection configurables Configurable cpidPionPmincut{"cpidPionPmincut", 0.15, "pion min cut of pion"}; Configurable cpidKaonPmincut{"cpidKaonPmincut", 0.15, "kaon min cut of kaon"}; @@ -126,37 +123,29 @@ struct EventMeanPtId { Configurable nchMin{"nchMin", 0.0, "Minimum value for nch axis"}; Configurable nchMax{"nchMax", 4000.0, "Maximum value for nch axis"}; Configurable cSigmaLowHighcut{"cSigmaLowHighcut", 3.0f, "lower and upper sigma cut"}; - O2_DEFINE_CONFIGURABLE(cfgEvSelMultCorrelation, bool, true, "Multiplicity correlation cut") struct : ConfigurableGroup { - O2_DEFINE_CONFIGURABLE(cfgMultPVFT0CCutEnabled, bool, true, "Enable PV multiplicity vs FT0C centrality cut") O2_DEFINE_CONFIGURABLE(cfgMultGlobalFT0CCutEnabled, bool, true, "Enable globalTracks vs FT0C centrality cut") O2_DEFINE_CONFIGURABLE(cfgMultGlobalPVCutEnabled, bool, true, "Enable globalTracks vs PV multiplicity cut") - Configurable> cfgMultPVFT0CCutPars{"cfgMultPVFT0CCutPars", std::vector{3303.11, -121.316, 1.90207, -0.0152644, 5.10121e-05, 190.633, -4.32972, 0.0340001, -5.83261e-05, -3.19566e-07}, "PV multiplicity vs T0C centrality cut parameter values"}; - Configurable> cfgMultGlobalFT0CCutPars{"cfgMultGlobalFT0CCutPars", std::vector{1893.97, -61.3423, 0.790664, -0.00507208, 1.41683e-05, 167.997, -5.29125, 0.0840145, -0.000748102, 2.75743e-06}, "globalTracks vs FT0C cut parameter values"}; - Configurable> cfgMultGlobalPVCutPars{"cfgMultGlobalPVCutPars", std::vector{65.0322, 0.557725, -0.772828, 0.059224, -1.96379e-05, 4.46295e-09}, "globalTracks vs PV cut parameter values"}; - std::vector multPVFT0CCutPars; std::vector multGlobalFT0CPars; std::vector multGlobalPVCutPars; - TF1* fMultPVFT0CCutLow = nullptr; TF1* fMultPVFT0CCutHigh = nullptr; TF1* fMultGlobalFT0CCutLow = nullptr; TF1* fMultGlobalFT0CCutHigh = nullptr; TF1* fMultGlobalPVCutLow = nullptr; TF1* fMultGlobalPVCutHigh = nullptr; - } cfgFunCoeff; Service ccdb; @@ -167,31 +156,26 @@ struct EventMeanPtId { using MyCollisions = soa::Filtered>; using MyCollision = MyCollisions::iterator; - using MyTracks = soa::Filtered>; using MyTrack = MyTracks::iterator; - using MyMCRecoCollisions = soa::Filtered>; using MyMCRecoCollision = MyMCRecoCollisions::iterator; - using MyMCRecoTracks = soa::Filtered>; using MyMCRecoTrack = MyMCRecoTracks::iterator; - using EventCandidatesMC = soa::Join; Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable cfgUrlCCDB{"cfgUrlCCDB", "http://alice-ccdb.cern.ch", "url of ccdb"}; Configurable cfgPathCCDB{"cfgPathCCDB", "Users/s/swsingh/My/Object/GlobalRun3DCAcuts", "Path for ccdb-object"}; Configurable cfgLoadEff{"cfgLoadEff", true, "Load efficiency"}; - HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; TH2D* ptHistogramAllchargeRec = nullptr; @@ -207,7 +191,6 @@ struct EventMeanPtId { TList* lst = ccdb->getForTimeStamp(cfgPathCCDB.value, -1); ptHistogramAllchargeRec = reinterpret_cast(lst->FindObject("hPtEta_rec")); } - std::vector ptBinning = {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0}; AxisSpec vtxZAxis = {100, -20.0, 20.0, "Z (cm)"}; AxisSpec dcaAxis = {1002, -5.01, 5.01, "DCA_{xy} (cm)"}; @@ -230,7 +213,6 @@ struct EventMeanPtId { AxisSpec itschi2Axis = {400, 0., 40., "its Chi2"}; AxisSpec crossedRowTpcAxis = {1600, 0., 160., "TPC Crossed rows"}; AxisSpec counter = {10, 0., 10., "events"}; - // QA Plots histos.add("hEventcounter", "event counts", kTH1D, {counter}); auto h = histos.add("tracksel", "tracksel", HistType::kTH1D, {{15, 0.5, 15.5}}); @@ -245,7 +227,6 @@ struct EventMeanPtId { h->GetXaxis()->SetBinLabel(9, "ITS Chai2cluster passed"); h->GetXaxis()->SetBinLabel(10, "No. of ITS cluster 5 passed"); h->GetXaxis()->SetBinLabel(11, "No. of TPC cluster 80 passed"); - auto hRec = histos.add("trackSelRec", "trackSelRec", HistType::kTH1D, {{10, 0.5, 10.5}}); hRec->GetXaxis()->SetBinLabel(1, "has_mcCollision() read"); hRec->GetXaxis()->SetBinLabel(2, "Vertex Z > 10cm passed"); @@ -254,7 +235,6 @@ struct EventMeanPtId { hRec->GetXaxis()->SetBinLabel(5, "kNoITSROFrameBorder passed"); hRec->GetXaxis()->SetBinLabel(6, "klsGoodZvtxFT0vsPV passed"); hRec->GetXaxis()->SetBinLabel(7, "klsVertexITSTPC passed"); - histos.add("Data/hZvtx_before_sel", "hZvtx_before_sel", kTH1D, {vtxZAxis}); histos.add("Data/hZvtx_after_sel8", "hZvtx_after_sel8", kTH1D, {vtxZAxis}); histos.add("Data/hP", "hP", kTH1D, {pAxis}); @@ -265,46 +245,15 @@ struct EventMeanPtId { histos.add("Data/hDCAz", "hDCAz", kTH1D, {dcazAxis}); histos.add("Data/hPtDCAxy", "hPtDCAxy", kTH2D, {ptAxis, dcaAxis}); histos.add("Data/hPtDCAz", "hPtDCAz", kTH2D, {ptAxis, dcazAxis}); - histos.add("Data/NSigamaTPCpion", "NSigamaTPCpion", kTH2D, {ptAxis, nSigmaTPCAxispid}); - histos.add("Data/NSigamaTPCkaon", "NSigamaTPCkaon", kTH2D, {ptAxis, nSigmaTPCAxispid}); - histos.add("Data/NSigamaTPCproton", "NSigamaTPCproton", kTH2D, {ptAxis, nSigmaTPCAxispid}); - histos.add("Data/NSigamaTOFpion", "NSigamaTOFpion", kTH2D, {ptAxis, nSigmaTOFAxispid}); - histos.add("Data/NSigamaTOFkaon", "NSigamaTOFkaon", kTH2D, {ptAxis, nSigmaTOFAxispid}); - histos.add("Data/NSigamaTOFproton", "NSigamaTOFproton", kTH2D, {ptAxis, nSigmaTOFAxispid}); - histos.add("Data/NSigamaTPCTOFpion", "NSigamaTPCTOFpion", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); - histos.add("Data/NSigamaTPCTOFkaon", "NSigamaTPCTOFkaon", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); - histos.add("Data/NSigamaTPCTOFproton", "NSigamaTPCTOFproton", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); - histos.add("Data/hPtPion", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); - histos.add("Data/hPtKaon", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); - histos.add("Data/hPtProton", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); - histos.add("Data/hEtaPion", ";hEta", kTH1D, {etaAxis}); - histos.add("Data/hEtaKaon", ";hEta", kTH1D, {etaAxis}); - histos.add("Data/hEtaProton", ";hEta", kTH1D, {etaAxis}); - histos.add("Data/hyPion", ";hyPion", kTH1D, {etaAxis}); - histos.add("Data/hyKaon", ";hyKaon", kTH1D, {etaAxis}); - histos.add("Data/hyProton", ";hyProton", kTH1D, {etaAxis}); - histos.add("Data/hVar1", "hVar1", kTH2D, {subAxis, centAxis}); histos.add("Data/hVar2", "hVar2", kTH2D, {subAxis, centAxis}); histos.add("Data/hVar2meanpt", "hVar2meanpt", kTH2D, {centAxis, varAxis2}); histos.add("Data/hVarc", "hVarc", kTH2D, {subAxis, centAxis}); - histos.add("Data/hVar1pi", "hVar1pi", kTH2D, {subAxis, centAxis}); - histos.add("Data/hVar2pi", "hVar2pi", kTH2D, {subAxis, centAxis}); - histos.add("Data/hVar2meanptpi", "hVar2meanptpi", kTH2D, {centAxis, varAxis2}); - histos.add("Data/hVar1k", "hVar1k", kTH2D, {subAxis, centAxis}); - histos.add("Data/hVar2k", "hVar2k", kTH2D, {subAxis, centAxis}); - histos.add("Data/hVar2meanptk", "hVar2meanptk", kTH2D, {centAxis, varAxis2}); - histos.add("Data/hVar1p", "hVar1p", kTH2D, {subAxis, centAxis}); - histos.add("Data/hVar2p", "hVar2p", kTH2D, {subAxis, centAxis}); - histos.add("Data/hVarp", "hVarp", kTH2D, {subAxis, centAxis}); - histos.add("Data/hVar2meanptp", "hVar2meanptp", kTH2D, {centAxis, varAxis2}); - histos.add("Data/hnchAll", ";hnchAll", kTH1D, {nchAxis}); histos.add("Data/hnchAll_bf_cut", ";hnchAll_bf_cut", kTH1D, {nchAxis}); histos.add("Data/hnch", ";hnch", kTH1D, {nchAxis}); histos.add("Data/hnchTrue", ";hnchTrue", kTH1D, {nchAxis}); histos.add("Data/hnchTrue_pt", ";hnchTrue_pt", kTH1D, {nchAxis}); - histos.add("Data/hVar1x", "hVar1x", kTH2D, {subAxis, nchAxis}); histos.add("Data/hVar2x", "hVar2x", kTH2D, {subAxis, nchAxis}); histos.add("Data/hVarx", "hVarx", kTH2D, {subAxis, nchAxis}); @@ -312,30 +261,9 @@ struct EventMeanPtId { histos.add("Data/hdiffVar2x", "hdiffVar2x", kTH2D, {subAxis, nchAxis}); histos.add("Data/hdiffVarx", "hdiffVarx", kTH2D, {subAxis, nchAxis}); histos.add("Data/hVar2meanptx", "hVar2meanptx", kTH2D, {nchAxis, varAxis2}); - histos.add("Data/hVar1pix", "hVar1pix", kTH2D, {subAxis, nchAxis}); - histos.add("Data/hVar2pix", "hVar2pix", kTH2D, {subAxis, nchAxis}); - histos.add("Data/hVarpix", "hVarpix", kTH2D, {subAxis, nchAxis}); - histos.add("Data/hVar2meanptpix", "hVar2meanptpix", kTH2D, {nchAxis, varAxis2}); - histos.add("Data/hVar1kx", "hVar1kx", kTH2D, {subAxis, nchAxis}); - histos.add("Data/hVar2kx", "hVar2kx", kTH2D, {subAxis, nchAxis}); - histos.add("Data/hVarkx", "hVarkx", kTH2D, {subAxis, nchAxis}); - histos.add("Data/hVar2meanptkx", "hVar2meanptkx", kTH2D, {nchAxis, varAxis2}); - histos.add("Data/hVar1px", "hVar1px", kTH2D, {subAxis, nchAxis}); - histos.add("Data/hVar2px", "hVar2px", kTH2D, {subAxis, nchAxis}); - histos.add("Data/hVarpx", "hVarpx", kTH2D, {subAxis, nchAxis}); - histos.add("Data/hVar2meanptpx", "hVar2meanptpx", kTH2D, {nchAxis, varAxis2}); histos.add("Data/hCentrality", "hCentrality", kTH1D, {centAxis}); histos.add("Data/hPEta", "hPEta", kTH2D, {pAxis, etaAxis}); histos.add("Data/hPtEta", "hPtEta", kTH2D, {ptAxis, etaAxis}); - histos.add("Data/hPtyPion", "hPtyPion", kTH2D, {ptAxis, etaAxis}); - histos.add("Data/hPtyKaon", "hPtyKaon", kTH2D, {ptAxis, etaAxis}); - histos.add("Data/hPtyProton", "hPtyProton", kTH2D, {ptAxis, etaAxis}); - histos.add("Data/hTOFbeta", "hTOFbeta", kTH2D, {pAxis, betaAxis}); - histos.add("Data/hdEdx", "hdEdx", kTH2D, {pAxis, dEdxAxis}); - histos.add("Data/hTOFbeta_afterselection", "hTOFbeta_afterselection", kTH2D, {pAxis, betaAxis}); - histos.add("Data/hdEdx_afterselection", "hdEdx_afterselection", kTH2D, {pAxis, dEdxAxis}); - histos.add("Data/hTOFbeta_afterselection1", "hTOFbeta_afterselection1", kTH2D, {pAxis, betaAxis}); - histos.add("Data/hdEdx_afterselection1", "hdEdx_afterselection1", kTH2D, {pAxis, dEdxAxis}); histos.add("Data/hTPCchi2perCluster_before", "TPC #Chi^{2}/Cluster", kTH1D, {tpcchi2Axis}); histos.add("Data/hITSchi2perCluster_before", "ITS #Chi^{2}/Cluster", kTH1D, {itschi2Axis}); histos.add("Data/hTPCCrossedrows_before", "Crossed TPC rows", kTH1D, {crossedRowTpcAxis}); @@ -352,177 +280,196 @@ struct EventMeanPtId { histos.add("Data/hNchPV_NchGlobal_after", "hNchPV_NchGlobal_after", kTH2D, {nchAxis, nchAxis}); histos.add("Data/hcentFT0C_GlobalNch_after", "hcentFT0C_GlobalNch_after", kTH2D, {centAxis, nchAxis}); histos.add("Data/hcentFT0C_NchPV_after", "hcentFT0C_NchPV_after", kTH2D, {centAxis, nchAxis}); - histos.add("Data/hNchPV_NchGlobal_after3", "hNchPV_NchGlobal_after3", kTH2D, {nchAxis, nchAxis}); - histos.add("Data/hNchPV_NchGlobal_after4", "hNchPV_NchGlobal_after4", kTH2D, {nchAxis, nchAxis}); - histos.add("Data/hNchPV_NchGlobal_after5", "hNchPV_NchGlobal_after5", kTH2D, {nchAxis, nchAxis}); - - histos.addClone("Data/", "Rec/"); - histos.add("hcent_nacc_corr", "hcent_nacc_corr", kTH2D, {centAxis, nchAxis}); - histos.add("NSigamaTPCpion_rec", "NSigamaTPCpion_rec", kTH2D, {pAxis, nSigmaTPCAxispid}); - histos.add("NSigamaTPCkaon_rec", "NSigamaTPCkaon_rec", kTH2D, {pAxis, nSigmaTPCAxispid}); - histos.add("NSigamaTPCproton_rec", "NSigamaTPCproton_rec", kTH2D, {pAxis, nSigmaTPCAxispid}); - histos.add("NSigamaTOFpion_rec", "NSigamaTOFpion_rec", kTH2D, {pAxis, nSigmaTOFAxispid}); - histos.add("NSigamaTOFkaon_rec", "NSigamaTOFkaon_rec", kTH2D, {pAxis, nSigmaTOFAxispid}); - histos.add("NSigamaTOFproton_rec", "NSigamaTOFproton_rec", kTH2D, {pAxis, nSigmaTOFAxispid}); - histos.add("NSigamaTPCTOFpion_rec", "NSigamaTPCTOFpion_rec", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); - histos.add("NSigamaTPCTOFkaon_rec", "NSigamaTPCTOFkaon_rec", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); - histos.add("NSigamaTPCTOFproton_rec", "NSigamaTPCTOFproton_rec", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); - histos.add("hPtyPion_rec", "hPtyPion_rec", kTH2D, {ptAxis, etaAxis}); - histos.add("hPtyKaon_rec", "hPtyKaon_rec", kTH2D, {ptAxis, etaAxis}); - histos.add("hPtyProton_rec", "hPtyProton_rec", kTH2D, {ptAxis, etaAxis}); - histos.add("hPyPion_rec", "hPyPion_rec", kTH2D, {pAxis, etaAxis}); - histos.add("hPyKaon_rec", "hPyKaon_rec", kTH2D, {pAxis, etaAxis}); - histos.add("hPyProton_rec", "hPyProton_rec", kTH2D, {pAxis, etaAxis}); - histos.add("hTOFbeta_afterselection_rec_beforepidcut", "hTOFbeta_afterselection_rec_beforepidcut", kTH2D, {pAxis, betaAxis}); - histos.add("hdEdx_afterselection_rec_beforepidcut", "hdEdx_afterselection_rec_beforepidcut", kTH2D, {pAxis, dEdxAxis}); - histos.add("ptHistogramAllchargeRec", "ptHistogramAllchargeRec", kTH1D, {ptAxis}); - histos.add("ptHistogramPionrec", "ptHistogramPionrec", kTH1D, {ptAxis}); - histos.add("ptHistogramKaonrec", "ptHistogramKaonrec", kTH1D, {ptAxis}); - histos.add("ptHistogramProtonrec", "ptHistogramProtonrec", kTH1D, {ptAxis}); - histos.add("ptHistogramPionrec_purity", "ptHistogramPionrec_purity", kTH1D, {ptAxis}); - histos.add("ptHistogramKaonrec_purity", "ptHistogramKaonrec_purity", kTH1D, {ptAxis}); - histos.add("ptHistogramProtonrec_purity", "ptHistogramProtonrec_purity", kTH1D, {ptAxis}); - histos.add("ptHistogramPionrec_pdg", "ptHistogramPionrec_pdg", kTH1D, {ptAxis}); - histos.add("ptHistogramKaonrec_pdg", "ptHistogramKaonrec_pdg", kTH1D, {ptAxis}); - histos.add("ptHistogramProtonrec_pdg", "ptHistogramProtonrec_pdg", kTH1D, {ptAxis}); - histos.add("hEffVar1x_rec", "hEffVar1x_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVar2x_rec", "hEffVar2x_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVarx_rec", "hEffVarx_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVar1pix", "hEffVar1pix", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVar2pix", "hEffVar2pix", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVarpix", "hEffVarpix", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVar1kx", "hEffVar1kx", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVar2kx", "hEffVar2kx", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVarkx", "hEffVarkx", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVar1px", "hEffVar1px", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVar2px", "hEffVar2px", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVarpx", "hEffVarpx", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVar2Meanptx_rec", "hEffVar2Meanptx_rec", kTH2D, {nchAxis, varAxis2}); - histos.add("hEffVar2Meanptpix", "hEffVar2Meanptpix", kTH2D, {nchAxis, varAxis2}); - histos.add("hEffVar2Meanptkx", "hEffVar2Meanptkx", kTH2D, {nchAxis, varAxis2}); - histos.add("hEffVar2Meanptpx", "hEffVar2Meanptpx", kTH2D, {nchAxis, varAxis2}); - //=======================MC histograms Generated ================================================ + histos.add("hEta_rec", "", kTH1F, {etaAxis}); + histos.add("hPt_rec", "", kTH1F, {ptAxis}); + histos.add("hPtEta_rec", "hPtEta_rec", kTH2D, {ptAxis, etaAxis}); + histos.add("hNch_vs_Nch", "hNch_vs_Nch", kTH2D, {subAxis, nchAxis}); + histos.add("hterm1", "hterm1", kTProfile, {tnchAxis}); + histos.add("hterm2", "hterm2", kTProfile, {tnchAxis}); + histos.add("hCentrality_rec_before", "hCentrality_rec_before", kTH1D, {centAxis}); + histos.add("hEta1", ";hEta1", kTH1D, {etaAxis}); + if (effSwitchHistoFill) { + histos.add("hEffVar1x_data", "hEffVar1x_data", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar2x_data", "hEffVar2x_data", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVarx_data", "hEffVarx_data", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar2Meanptx_data", "hEffVar2Meanptx_data", kTH2D, {nchAxis, varAxis2}); + histos.add("hEffVar1x_Naccorr_data", "hEffVar1x_Naccorr_data", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar2x_Naccorr_data", "hEffVar2x_Naccorr_data", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVarx_Naccorr_data", "hEffVarx_Naccorr_data", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar1x_Naccorr_xaxis_data", "hEffVar1x_Naccorr_xaxis_data", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar2x_Naccorr_xaxis_data", "hEffVar2x_Naccorr_xaxis_data", kTH2D, {subAxis, nchAxis}); + histos.add("hEta_rec_corr", "", kTH1F, {etaAxis}); + histos.add("hPt_rec_corr", "", kTH1F, {ptAxis}); + histos.add("hcent_nacc_corr", "hcent_nacc_corr", kTH2D, {centAxis, nchAxis}); + histos.add("hNch_vs_corr", "hNch_vs_corr", kTH2D, {subAxis, nchAxis}); + } + if (pidSwitchHistoFill) { + histos.add("Data/NSigamaTPCpion", "NSigamaTPCpion", kTH2D, {ptAxis, nSigmaTPCAxispid}); + histos.add("Data/NSigamaTPCkaon", "NSigamaTPCkaon", kTH2D, {ptAxis, nSigmaTPCAxispid}); + histos.add("Data/NSigamaTPCproton", "NSigamaTPCproton", kTH2D, {ptAxis, nSigmaTPCAxispid}); + histos.add("Data/NSigamaTOFpion", "NSigamaTOFpion", kTH2D, {ptAxis, nSigmaTOFAxispid}); + histos.add("Data/NSigamaTOFkaon", "NSigamaTOFkaon", kTH2D, {ptAxis, nSigmaTOFAxispid}); + histos.add("Data/NSigamaTOFproton", "NSigamaTOFproton", kTH2D, {ptAxis, nSigmaTOFAxispid}); + histos.add("Data/NSigamaTPCTOFpion", "NSigamaTPCTOFpion", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); + histos.add("Data/NSigamaTPCTOFkaon", "NSigamaTPCTOFkaon", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); + histos.add("Data/NSigamaTPCTOFproton", "NSigamaTPCTOFproton", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); + histos.add("Data/hPtPion", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); + histos.add("Data/hPtKaon", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); + histos.add("Data/hPtProton", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); + histos.add("Data/hEtaPion", ";hEta", kTH1D, {etaAxis}); + histos.add("Data/hEtaKaon", ";hEta", kTH1D, {etaAxis}); + histos.add("Data/hEtaProton", ";hEta", kTH1D, {etaAxis}); + histos.add("Data/hyPion", ";hyPion", kTH1D, {etaAxis}); + histos.add("Data/hyKaon", ";hyKaon", kTH1D, {etaAxis}); + histos.add("Data/hyProton", ";hyProton", kTH1D, {etaAxis}); + histos.add("Data/hVar1pix", "hVar1pix", kTH2D, {subAxis, nchAxis}); + histos.add("Data/hVar2pix", "hVar2pix", kTH2D, {subAxis, nchAxis}); + histos.add("Data/hVarpix", "hVarpix", kTH2D, {subAxis, nchAxis}); + histos.add("Data/hVar2meanptpix", "hVar2meanptpix", kTH2D, {nchAxis, varAxis2}); + histos.add("Data/hVar1kx", "hVar1kx", kTH2D, {subAxis, nchAxis}); + histos.add("Data/hVar2kx", "hVar2kx", kTH2D, {subAxis, nchAxis}); + histos.add("Data/hVarkx", "hVarkx", kTH2D, {subAxis, nchAxis}); + histos.add("Data/hVar2meanptkx", "hVar2meanptkx", kTH2D, {nchAxis, varAxis2}); + histos.add("Data/hVar1px", "hVar1px", kTH2D, {subAxis, nchAxis}); + histos.add("Data/hVar2px", "hVar2px", kTH2D, {subAxis, nchAxis}); + histos.add("Data/hVarpx", "hVarpx", kTH2D, {subAxis, nchAxis}); + histos.add("Data/hVar2meanptpx", "hVar2meanptpx", kTH2D, {nchAxis, varAxis2}); + histos.add("Data/hPtyPion", "hPtyPion", kTH2D, {ptAxis, etaAxis}); + histos.add("Data/hPtyKaon", "hPtyKaon", kTH2D, {ptAxis, etaAxis}); + histos.add("Data/hPtyProton", "hPtyProton", kTH2D, {ptAxis, etaAxis}); + histos.add("Data/hTOFbeta", "hTOFbeta", kTH2D, {pAxis, betaAxis}); + histos.add("Data/hdEdx", "hdEdx", kTH2D, {pAxis, dEdxAxis}); + histos.add("Data/hTOFbeta_afterselection", "hTOFbeta_afterselection", kTH2D, {pAxis, betaAxis}); + histos.add("Data/hdEdx_afterselection", "hdEdx_afterselection", kTH2D, {pAxis, dEdxAxis}); + histos.add("Data/hTOFbeta_afterselection1", "hTOFbeta_afterselection1", kTH2D, {pAxis, betaAxis}); + histos.add("Data/hdEdx_afterselection1", "hdEdx_afterselection1", kTH2D, {pAxis, dEdxAxis}); + histos.add("Data/hVar1pi", "hVar1pi", kTH2D, {subAxis, centAxis}); + histos.add("Data/hVar2pi", "hVar2pi", kTH2D, {subAxis, centAxis}); + histos.add("Data/hVar2meanptpi", "hVar2meanptpi", kTH2D, {centAxis, varAxis2}); + histos.add("Data/hVar1k", "hVar1k", kTH2D, {subAxis, centAxis}); + histos.add("Data/hVar2k", "hVar2k", kTH2D, {subAxis, centAxis}); + histos.add("Data/hVar2meanptk", "hVar2meanptk", kTH2D, {centAxis, varAxis2}); + histos.add("Data/hVar1p", "hVar1p", kTH2D, {subAxis, centAxis}); + histos.add("Data/hVar2p", "hVar2p", kTH2D, {subAxis, centAxis}); + histos.add("Data/hVarp", "hVarp", kTH2D, {subAxis, centAxis}); + histos.add("Data/hVar2meanptp", "hVar2meanptp", kTH2D, {centAxis, varAxis2}); + //===============reco level pid histograms==============================// + histos.add("NSigamaTPCpion_rec", "NSigamaTPCpion_rec", kTH2D, {pAxis, nSigmaTPCAxispid}); + histos.add("NSigamaTPCkaon_rec", "NSigamaTPCkaon_rec", kTH2D, {pAxis, nSigmaTPCAxispid}); + histos.add("NSigamaTPCproton_rec", "NSigamaTPCproton_rec", kTH2D, {pAxis, nSigmaTPCAxispid}); + histos.add("NSigamaTOFpion_rec", "NSigamaTOFpion_rec", kTH2D, {pAxis, nSigmaTOFAxispid}); + histos.add("NSigamaTOFkaon_rec", "NSigamaTOFkaon_rec", kTH2D, {pAxis, nSigmaTOFAxispid}); + histos.add("NSigamaTOFproton_rec", "NSigamaTOFproton_rec", kTH2D, {pAxis, nSigmaTOFAxispid}); + histos.add("NSigamaTPCTOFpion_rec", "NSigamaTPCTOFpion_rec", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); + histos.add("NSigamaTPCTOFkaon_rec", "NSigamaTPCTOFkaon_rec", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); + histos.add("NSigamaTPCTOFproton_rec", "NSigamaTPCTOFproton_rec", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); + histos.add("hPtyPion_rec", "hPtyPion_rec", kTH2D, {ptAxis, etaAxis}); + histos.add("hPtyKaon_rec", "hPtyKaon_rec", kTH2D, {ptAxis, etaAxis}); + histos.add("hPtyProton_rec", "hPtyProton_rec", kTH2D, {ptAxis, etaAxis}); + histos.add("hPyPion_rec", "hPyPion_rec", kTH2D, {pAxis, etaAxis}); + histos.add("hPyKaon_rec", "hPyKaon_rec", kTH2D, {pAxis, etaAxis}); + histos.add("hPyProton_rec", "hPyProton_rec", kTH2D, {pAxis, etaAxis}); + histos.add("hTOFbeta_afterselection_rec_beforepidcut", "hTOFbeta_afterselection_rec_beforepidcut", kTH2D, {pAxis, betaAxis}); + histos.add("hdEdx_afterselection_rec_beforepidcut", "hdEdx_afterselection_rec_beforepidcut", kTH2D, {pAxis, dEdxAxis}); + histos.add("ptHistogramPionrec", "ptHistogramPionrec", kTH1D, {ptAxis}); + histos.add("ptHistogramKaonrec", "ptHistogramKaonrec", kTH1D, {ptAxis}); + histos.add("ptHistogramProtonrec", "ptHistogramProtonrec", kTH1D, {ptAxis}); + histos.add("ptHistogramPionrec_purity", "ptHistogramPionrec_purity", kTH1D, {ptAxis}); + histos.add("ptHistogramKaonrec_purity", "ptHistogramKaonrec_purity", kTH1D, {ptAxis}); + histos.add("ptHistogramProtonrec_purity", "ptHistogramProtonrec_purity", kTH1D, {ptAxis}); + histos.add("ptHistogramPionrec_pdg", "ptHistogramPionrec_pdg", kTH1D, {ptAxis}); + histos.add("ptHistogramKaonrec_pdg", "ptHistogramKaonrec_pdg", kTH1D, {ptAxis}); + histos.add("ptHistogramProtonrec_pdg", "ptHistogramProtonrec_pdg", kTH1D, {ptAxis}); + histos.add("hPtEta_pi_rec", "hPtEta_pi_rec", kTH2D, {ptAxis, etaAxis}); + histos.add("hPtEta_ka_rec", "hPtEta_ka_rec", kTH2D, {ptAxis, etaAxis}); + histos.add("hPtEta_pr_rec", "hPtEta_pr_rec", kTH2D, {ptAxis, etaAxis}); + //===============generated level pid histograms==============================// + histos.add("hVar1pix_gen", "hVar1pix_gen", kTH2D, {subAxis, nchAxis}); + histos.add("hVar2pix_gen", "hVar2pix_gen", kTH2D, {subAxis, nchAxis}); + histos.add("hVarpix_gen", "hVarpix_gen", kTH2D, {subAxis, nchAxis}); + histos.add("hVar2meanptpix_gen", "hVar2meanptpix_gen", kTH2D, {nchAxis, varAxis2}); + histos.add("hVar1kx_gen", "hVar1kx_gen", kTH2D, {subAxis, nchAxis}); + histos.add("hVar2kx_gen", "hVar2kx_gen", kTH2D, {subAxis, nchAxis}); + histos.add("hVarkx_gen", "hVarkx_gen", kTH2D, {subAxis, nchAxis}); + histos.add("hVar2meanptkx_gen", "hVar2meanptkx_gen", kTH2D, {nchAxis, varAxis2}); + histos.add("hVar1px_gen", "hVar1px_gen", kTH2D, {subAxis, nchAxis}); + histos.add("hVar2px_gen", "hVar2px_gen", kTH2D, {subAxis, nchAxis}); + histos.add("hVarpx_gen", "hVarpx_gen", kTH2D, {subAxis, nchAxis}); + histos.add("hVar2meanptpx_gen", "hVar2meanptpx_gen", kTH2D, {nchAxis, varAxis2}); + histos.add("hPty_pi_gen", "hPty_pi_gen", kTH2D, {ptAxis, etaAxis}); + histos.add("hPty_ka_gen", "hPty_ka_gen", kTH2D, {ptAxis, etaAxis}); + histos.add("hPty_pr_gen", "hPty_pr_gen", kTH2D, {ptAxis, etaAxis}); + histos.add("hPtEta_pi_gen", "hPtEta_pi_gen", kTH2D, {ptAxis, etaAxis}); + histos.add("hPtEta_ka_gen", "hPtEta_ka_gen", kTH2D, {ptAxis, etaAxis}); + histos.add("hPtEta_pr_gen", "hPtEta_pr_gen", kTH2D, {ptAxis, etaAxis}); + histos.add("ptHistogramPion", "ptHistogramPion", kTH1D, {ptAxis}); + histos.add("ptHistogramKaon", "ptHistogramKaon", kTH1D, {ptAxis}); + histos.add("ptHistogramProton", "ptHistogramProton", kTH1D, {ptAxis}); + histos.add("hnch_pi", ";hnch_pi", kTH1D, {nchAxis}); + histos.add("hnch_ka", ";hnch_ka", kTH1D, {nchAxis}); + histos.add("hnch_pr", ";hnch_pr", kTH1D, {nchAxis}); + } + //===============generated level allharons histograms==============================// histos.add("ptHistogram_allcharge_gen", "ptHistogram_allcharge_gen", kTH1D, {ptAxis}); - histos.add("ptHistogramPion", "ptHistogramPion", kTH1D, {ptAxis}); - histos.add("ptHistogramKaon", "ptHistogramKaon", kTH1D, {ptAxis}); - histos.add("ptHistogramProton", "ptHistogramProton", kTH1D, {ptAxis}); histos.add("hnch_gen_all", ";hnch_gen_all", kTH1D, {nchAxis}); histos.add("hnch_gen_after_etacut", ";hnch_gen_after_etacut", kTH1D, {nchAxis}); histos.add("hnch_afterPhysPrimary", ";hnch_afterPhysPrimary", kTH1D, {nchAxis}); - histos.add("hnch_pi", ";hnch_pi", kTH1D, {nchAxis}); - histos.add("hnch_ka", ";hnch_ka", kTH1D, {nchAxis}); - histos.add("hnch_pr", ";hnch_pr", kTH1D, {nchAxis}); histos.add("hnch_gen", ";hnch_gen", kTH1D, {nchAxis}); histos.add("hPtvar_gen", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); - histos.add("hVar1x_gen", "hVar1x_gen", kTH2D, {subAxis, nchAxis}); histos.add("hVar2x_gen", "hVar2x_gen", kTH2D, {subAxis, nchAxis}); histos.add("hVarx_gen", "hVarx_gen", kTH2D, {subAxis, nchAxis}); histos.add("hdiffVar1x_gen", "hdiffVar1x_gen", kTH2D, {subAxis, nchAxis}); histos.add("hdiffVar2x_gen", "hdiffVar2x_gen", kTH2D, {subAxis, nchAxis}); histos.add("hdiffVarx_gen", "hdiffVarx_gen", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2meanptx_gen", "hVar2meanptx_gen", kTH2D, {nchAxis, varAxis2}); - histos.add("hVar1pix_gen", "hVar1pix_gen", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2pix_gen", "hVar2pix_gen", kTH2D, {subAxis, nchAxis}); - histos.add("hVarpix_gen", "hVarpix_gen", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2meanptpix_gen", "hVar2meanptpix_gen", kTH2D, {nchAxis, varAxis2}); - histos.add("hVar1kx_gen", "hVar1kx_gen", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2kx_gen", "hVar2kx_gen", kTH2D, {subAxis, nchAxis}); - histos.add("hVarkx_gen", "hVarkx_gen", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2meanptkx_gen", "hVar2meanptkx_gen", kTH2D, {nchAxis, varAxis2}); - histos.add("hVar1px_gen", "hVar1px_gen", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2px_gen", "hVar2px_gen", kTH2D, {subAxis, nchAxis}); - histos.add("hVarpx_gen", "hVarpx_gen", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2meanptpx_gen", "hVar2meanptpx_gen", kTH2D, {nchAxis, varAxis2}); histos.add("hcent_nacc_gen", "hcent_nacc_gen", kTH2D, {centAxis, nchAxis}); histos.add("hVtxZ_before_gen", "", kTH1F, {vtxZAxis}); histos.add("hVtxZ_after_gensim", "", kTH1F, {vtxZAxis}); histos.add("hEta_gen", "", kTH1F, {etaAxis}); - histos.add("hEta_rec", "", kTH1F, {etaAxis}); histos.add("hPt_gen", "", kTH1F, {ptAxis}); - histos.add("hPt_rec", "", kTH1F, {ptAxis}); - histos.add("hEta_rec_corr", "", kTH1F, {etaAxis}); - histos.add("hPt_rec_corr", "", kTH1F, {ptAxis}); - histos.add("hPtEta_rec", "hPtEta_rec", kTH2D, {ptAxis, etaAxis}); - histos.add("hPtEta_pi_rec", "hPtEta_pi_rec", kTH2D, {ptAxis, etaAxis}); - histos.add("hPtEta_ka_rec", "hPtEta_ka_rec", kTH2D, {ptAxis, etaAxis}); - histos.add("hPtEta_pr_rec", "hPtEta_pr_rec", kTH2D, {ptAxis, etaAxis}); histos.add("hPtEta_gen", "hPtEta_gen", kTH2D, {ptAxis, etaAxis}); - histos.add("hPtEta_pi_gen", "hPtEta_pi_gen", kTH2D, {ptAxis, etaAxis}); - histos.add("hPtEta_ka_gen", "hPtEta_ka_gen", kTH2D, {ptAxis, etaAxis}); - histos.add("hPtEta_pr_gen", "hPtEta_pr_gen", kTH2D, {ptAxis, etaAxis}); - histos.add("hPty_pi_gen", "hPty_pi_gen", kTH2D, {ptAxis, etaAxis}); - histos.add("hPty_ka_gen", "hPty_ka_gen", kTH2D, {ptAxis, etaAxis}); - histos.add("hPty_pr_gen", "hPty_pr_gen", kTH2D, {ptAxis, etaAxis}); - histos.add("hNch_vs_corr", "hNch_vs_corr", kTH2D, {subAxis, nchAxis}); - histos.add("hNch_vs_Nch", "hNch_vs_Nch", kTH2D, {subAxis, nchAxis}); histos.add("hVar1_gen", "hVar1_gen", kTH2D, {subAxis, centAxis}); histos.add("hVar2_gen", "hVar2_gen", kTH2D, {subAxis, centAxis}); histos.add("hVarc_gen", "hVarc_gen", kTH2D, {subAxis, centAxis}); - histos.add("hEffVar1x_Naccorr_rec", "hEffVar1x_Naccorr_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVar2x_Naccorr_rec", "hEffVar2x_Naccorr_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVarx_Naccorr_rec", "hEffVarx_Naccorr_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVar1x_Naccorr_xaxis_rec", "hEffVar1x_Naccorr_xaxis_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVar2x_Naccorr_xaxis_rec", "hEffVar2x_Naccorr_xaxis_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVarx_Naccorr_xaxis_rec", "hEffVarx_Naccorr_xaxis_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVar1x_Naccorr_data", "hEffVar1x_Naccorr_data", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVar2x_Naccorr_data", "hEffVar2x_Naccorr_data", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVarx_Naccorr_data", "hEffVarx_Naccorr_data", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVar1x_Naccorr_xaxis_data", "hEffVar1x_Naccorr_xaxis_data", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVar2x_Naccorr_xaxis_data", "hEffVar2x_Naccorr_xaxis_data", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVarx_Naccorr_xaxis_data", "hEffVarx_Naccorr_xaxis_data", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVar1x_data", "hEffVar1x_data", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVar2x_data", "hEffVar2x_data", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVarx_data", "hEffVarx_data", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVar2Meanptx_data", "hEffVar2Meanptx_data", kTH2D, {nchAxis, varAxis2}); - histos.add("hterm1", "hterm1", kTProfile, {tnchAxis}); - histos.add("hterm2", "hterm2", kTProfile, {tnchAxis}); histos.add("hterm1_gen", "hterm1_gen", kTProfile, {tnchAxis}); histos.add("hterm2_gen", "hterm2_gen", kTProfile, {tnchAxis}); - histos.add("hCentrality_rec_before", "hCentrality_rec_before", kTH1D, {centAxis}); - histos.add("hEta1", ";hEta1", kTH1D, {etaAxis}); - cfgFunCoeff.multPVFT0CCutPars = cfgFunCoeff.cfgMultPVFT0CCutPars; cfgFunCoeff.multGlobalFT0CPars = cfgFunCoeff.cfgMultGlobalFT0CCutPars; cfgFunCoeff.multGlobalPVCutPars = cfgFunCoeff.cfgMultGlobalPVCutPars; - cfgFunCoeff.fMultPVFT0CCutLow = new TF1("fMultPVFT0CCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 3.0*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); cfgFunCoeff.fMultPVFT0CCutLow->SetParameters(&(cfgFunCoeff.multPVFT0CCutPars[0])); - cfgFunCoeff.fMultPVFT0CCutHigh = new TF1("fMultPVFT0CCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 3.0*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); cfgFunCoeff.fMultPVFT0CCutHigh->SetParameters(&(cfgFunCoeff.multPVFT0CCutPars[0])); - cfgFunCoeff.fMultGlobalFT0CCutLow = new TF1("fMultGlobalFT0CCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 3.0*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); cfgFunCoeff.fMultGlobalFT0CCutLow->SetParameters(&(cfgFunCoeff.multGlobalFT0CPars[0])); - cfgFunCoeff.fMultGlobalFT0CCutHigh = new TF1("fMultGlobalFT0CCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 3.0*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); cfgFunCoeff.fMultGlobalFT0CCutHigh->SetParameters(&(cfgFunCoeff.multGlobalFT0CPars[0])); - cfgFunCoeff.fMultGlobalPVCutLow = new TF1("fMultGlobalPVCutLow", "[0] + [1]*x - 3.0*([2] + [3]*x + [4]*x*x + [5]*x*x*x)", 0, 100); cfgFunCoeff.fMultGlobalPVCutLow->SetParameters(&(cfgFunCoeff.multGlobalPVCutPars[0])); - cfgFunCoeff.fMultGlobalPVCutHigh = new TF1("fMultGlobalPVCutHigh", "[0] + [1]*x + 3.0*([2] + [3]*x + [4]*x*x + [5]*x*x*x)", 0, 100); cfgFunCoeff.fMultGlobalPVCutHigh->SetParameters(&(cfgFunCoeff.multGlobalPVCutPars[0])); + LOG(info) << "Printing Stored Registry Information"; + histos.print(); } bool eventSelected(const float& globalNch, const float& pvTrack, const float& centrality) @@ -533,14 +480,12 @@ struct EventMeanPtId { if (pvTrack > cfgFunCoeff.fMultPVFT0CCutHigh->Eval(centrality)) return false; } - if (cfgFunCoeff.cfgMultGlobalFT0CCutEnabled) { if (globalNch < cfgFunCoeff.fMultGlobalFT0CCutLow->Eval(centrality)) return false; if (globalNch > cfgFunCoeff.fMultGlobalFT0CCutHigh->Eval(centrality)) return false; } - if (cfgFunCoeff.cfgMultGlobalPVCutEnabled) { if (globalNch < cfgFunCoeff.fMultGlobalPVCutLow->Eval(pvTrack)) return false; @@ -1008,12 +953,8 @@ struct EventMeanPtId { histos.fill(HIST("hEffVar1x_Naccorr_data"), sample, sumWeight, var1Eff); histos.fill(HIST("hEffVar2x_Naccorr_data"), sample, sumWeight, var2Eff); histos.fill(HIST("hEffVarx_Naccorr_data"), sample, sumWeight); - histos.fill(HIST("hEffVar1x_Naccorr_data"), sample, nchAll, var1Eff); - histos.fill(HIST("hEffVar2x_Naccorr_data"), sample, nchAll, var2Eff); - histos.fill(HIST("hEffVarx_Naccorr_data"), sample, nchAll, sumWeight); histos.fill(HIST("hEffVar1x_Naccorr_xaxis_data"), sample, sumWeight, var1); histos.fill(HIST("hEffVar2x_Naccorr_xaxis_data"), sample, sumWeight, var2); - histos.fill(HIST("hEffVarx_Naccorr_xaxis_data"), sample, sumWeight); } if (pidSwitchHistoFill) { @@ -1055,30 +996,30 @@ struct EventMeanPtId { return; } - histos.fill(HIST("Rec/hZvtx_before_sel"), coll.posZ()); + histos.fill(HIST("Data/hZvtx_before_sel"), coll.posZ()); histos.fill(HIST("hVtxZ_before_gen"), coll.mcCollision().posZ()); histos.fill(HIST("hCentrality_rec_before"), cent); if (!selCollision(coll, cent)) return; - histos.fill(HIST("Rec/hZvtx_after_sel8"), coll.posZ()); - histos.fill(HIST("Rec/hCentrality"), cent); + histos.fill(HIST("Data/hZvtx_after_sel8"), coll.posZ()); + histos.fill(HIST("Data/hCentrality"), cent); float globalNch = inputTracks.size(); float pvTrack = coll.multNTracksPV(); - histos.fill(HIST("Rec/hNchPV_NchGlobal_before"), pvTrack, globalNch); - histos.fill(HIST("Rec/hcentFT0C_GlobalNch_before"), coll.centFT0C(), globalNch); - histos.fill(HIST("Rec/hcentFT0C_NchPV_before"), coll.centFT0C(), pvTrack); + histos.fill(HIST("Data/hNchPV_NchGlobal_before"), pvTrack, globalNch); + histos.fill(HIST("Data/hcentFT0C_GlobalNch_before"), coll.centFT0C(), globalNch); + histos.fill(HIST("Data/hcentFT0C_NchPV_before"), coll.centFT0C(), pvTrack); if (cfgEvSelMultCorrelation && !eventSelected(globalNch, pvTrack, cent)) { return; } - histos.fill(HIST("Rec/hNchPV_NchGlobal_after"), pvTrack, globalNch); - histos.fill(HIST("Rec/hcentFT0C_GlobalNch_after"), coll.centFT0C(), globalNch); - histos.fill(HIST("Rec/hcentFT0C_NchPV_after"), coll.centFT0C(), pvTrack); + histos.fill(HIST("Data/hNchPV_NchGlobal_after"), pvTrack, globalNch); + histos.fill(HIST("Data/hcentFT0C_GlobalNch_after"), coll.centFT0C(), globalNch); + histos.fill(HIST("Data/hcentFT0C_NchPV_after"), coll.centFT0C(), pvTrack); double nch = 0., nchPi = 0., nchKa = 0., nchPr = 0., nchAll = 0., nchAllBfCut = 0., nchEta = 0., nchPt = 0.; double q1 = 0., q2 = 0.; @@ -1087,23 +1028,23 @@ struct EventMeanPtId { double var1Pi = 0., var2Pi = 0., var1Ka = 0., var2Ka = 0., var1Pr = 0., var2Pr = 0.; double sumPtWeight = 0., sumWeight = 0., sumPtPtWeight = 0., var1Eff = 0., var2Eff = 0.; - int sample = histos.get(HIST("Rec/hZvtx_after_sel8"))->GetEntries(); + int sample = histos.get(HIST("Data/hZvtx_after_sel8"))->GetEntries(); sample = sample % 30; for (const auto& track : inputTracks) { nchAllBfCut += 1.; - histos.fill(HIST("Rec/hnchAll_bf_cut"), nchAllBfCut); - histos.fill(HIST("Rec/hTPCchi2perCluster_before"), track.tpcChi2NCl()); - histos.fill(HIST("Rec/hITSchi2perCluster_before"), track.itsChi2NCl()); - histos.fill(HIST("Rec/hTPCCrossedrows_before"), track.tpcNClsCrossedRows()); + histos.fill(HIST("Data/hnchAll_bf_cut"), nchAllBfCut); + histos.fill(HIST("Data/hTPCchi2perCluster_before"), track.tpcChi2NCl()); + histos.fill(HIST("Data/hITSchi2perCluster_before"), track.itsChi2NCl()); + histos.fill(HIST("Data/hTPCCrossedrows_before"), track.tpcNClsCrossedRows()); if (std::fabs(track.eta()) <= cEtacut) { nchEta++; - histos.fill(HIST("Rec/hnchTrue"), nchEta); + histos.fill(HIST("Data/hnchTrue"), nchEta); } if (track.pt() >= cPtmincut && track.pt() <= cPtmaxcut) { nchPt += 1.; - histos.fill(HIST("Rec/hnchTrue_pt"), nchPt); + histos.fill(HIST("Data/hnchTrue_pt"), nchPt); } if (!selTrack(track)) @@ -1111,8 +1052,8 @@ struct EventMeanPtId { if (track.pt() >= cPtmincut1 && track.pt() <= cPtmaxcut1) { nch += 1.; - histos.fill(HIST("Rec/hnch"), nch); - histos.fill(HIST("Rec/hPtvar"), track.pt()); + histos.fill(HIST("Data/hnch"), nch); + histos.fill(HIST("Data/hPtvar"), track.pt()); } if (track.pt() < cPtmincut || track.pt() > cPtmaxcut) continue; @@ -1139,20 +1080,20 @@ struct EventMeanPtId { q1 += track.pt(); q2 += (track.pt() * track.pt()); - histos.fill(HIST("Rec/hnchAll"), nchAll); + histos.fill(HIST("Data/hnchAll"), nchAll); histos.fill(HIST("ptHistogramAllchargeRec"), track.pt()); - histos.fill(HIST("Rec/hDCAxy"), track.dcaXY()); - histos.fill(HIST("Rec/hDCAz"), track.dcaZ()); - histos.fill(HIST("Rec/hTPCCrossedrows_after"), track.tpcNClsCrossedRows()); - histos.fill(HIST("Rec/hTPCchi2perCluster_after"), track.tpcChi2NCl()); - histos.fill(HIST("Rec/hITSchi2perCluster_after"), track.itsChi2NCl()); - histos.fill(HIST("Rec/hP"), track.p()); - histos.fill(HIST("Rec/hPt"), track.pt()); - histos.fill(HIST("Rec/hEta"), track.eta()); - histos.fill(HIST("Rec/hPtDCAxy"), track.pt(), track.dcaXY()); - histos.fill(HIST("Rec/hPtDCAz"), track.pt(), track.dcaZ()); - histos.fill(HIST("Rec/hPtEta"), track.pt(), track.eta()); - histos.fill(HIST("Rec/hPEta"), track.p(), track.eta()); + histos.fill(HIST("Data/hDCAxy"), track.dcaXY()); + histos.fill(HIST("Data/hDCAz"), track.dcaZ()); + histos.fill(HIST("Data/hTPCCrossedrows_after"), track.tpcNClsCrossedRows()); + histos.fill(HIST("Data/hTPCchi2perCluster_after"), track.tpcChi2NCl()); + histos.fill(HIST("Data/hITSchi2perCluster_after"), track.itsChi2NCl()); + histos.fill(HIST("Data/hP"), track.p()); + histos.fill(HIST("Data/hPt"), track.pt()); + histos.fill(HIST("Data/hEta"), track.eta()); + histos.fill(HIST("Data/hPtDCAxy"), track.pt(), track.dcaXY()); + histos.fill(HIST("Data/hPtDCAz"), track.pt(), track.dcaZ()); + histos.fill(HIST("Data/hPtEta"), track.pt(), track.eta()); + histos.fill(HIST("Data/hPEta"), track.p(), track.eta()); histos.fill(HIST("hPtEta_rec"), track.pt(), track.eta()); if (pidSwitch) { @@ -1165,24 +1106,24 @@ struct EventMeanPtId { // only TPC tracks: Pion, Kaon, Proton if (track.hasTPC() && std::abs(track.tpcNSigmaPi()) < cNSigCut3) - histos.fill(HIST("Rec/NSigamaTPCpion"), track.pt(), track.tpcNSigmaPi()); + histos.fill(HIST("Data/NSigamaTPCpion"), track.pt(), track.tpcNSigmaPi()); if (track.hasTPC() && std::abs(track.tpcNSigmaKa()) < cNSigCut3) - histos.fill(HIST("Rec/NSigamaTPCkaon"), track.pt(), track.tpcNSigmaKa()); + histos.fill(HIST("Data/NSigamaTPCkaon"), track.pt(), track.tpcNSigmaKa()); if (track.hasTPC() && std::abs(track.tpcNSigmaPr()) < cNSigCut3) - histos.fill(HIST("Rec/NSigamaTPCproton"), track.pt(), track.tpcNSigmaPr()); + histos.fill(HIST("Data/NSigamaTPCproton"), track.pt(), track.tpcNSigmaPr()); // only TOF tracks: Pion, Kaon, Proton if (track.hasTOF() && std::abs(track.tofNSigmaPi()) < cNSigCut3) - histos.fill(HIST("Rec/NSigamaTOFpion"), track.pt(), track.tofNSigmaPi()); + histos.fill(HIST("Data/NSigamaTOFpion"), track.pt(), track.tofNSigmaPi()); if (track.hasTOF() && std::abs(track.tofNSigmaKa()) < cNSigCut3) - histos.fill(HIST("Rec/NSigamaTOFkaon"), track.pt(), track.tofNSigmaKa()); + histos.fill(HIST("Data/NSigamaTOFkaon"), track.pt(), track.tofNSigmaKa()); if (track.hasTOF() && std::abs(track.tofNSigmaPr()) < cNSigCut3) - histos.fill(HIST("Rec/NSigamaTOFproton"), track.pt(), track.tofNSigmaPr()); + histos.fill(HIST("Data/NSigamaTOFproton"), track.pt(), track.tofNSigmaPr()); if (track.hasTPC()) - histos.fill(HIST("Rec/hdEdx"), track.p(), track.tpcSignal()); + histos.fill(HIST("Data/hdEdx"), track.p(), track.tpcSignal()); if (track.hasTOF()) - histos.fill(HIST("Rec/hTOFbeta"), track.p(), track.beta()); + histos.fill(HIST("Data/hTOFbeta"), track.p(), track.beta()); if (track.hasTPC()) histos.fill(HIST("hdEdx_afterselection_rec_beforepidcut"), track.p(), track.tpcSignal()); if (track.hasTOF()) @@ -1190,10 +1131,10 @@ struct EventMeanPtId { //===================================pion============================================================== if ((track.hasTPC() && std::abs(track.tpcNSigmaPi()) < cNSigCut3) && (track.hasTOF() && std::abs(track.tofNSigmaPi()) < cNSigCut3)) { - histos.fill(HIST("Rec/NSigamaTPCTOFpion"), track.tpcNSigmaPi(), track.tofNSigmaPi()); + histos.fill(HIST("Data/NSigamaTPCTOFpion"), track.tpcNSigmaPi(), track.tofNSigmaPi()); - histos.fill(HIST("Rec/hdEdx_afterselection"), track.p(), track.tpcSignal()); - histos.fill(HIST("Rec/hTOFbeta_afterselection"), track.p(), track.beta()); + histos.fill(HIST("Data/hdEdx_afterselection"), track.p(), track.tpcSignal()); + histos.fill(HIST("Data/hTOFbeta_afterselection"), track.p(), track.beta()); } if (selPion(track)) { @@ -1203,15 +1144,15 @@ struct EventMeanPtId { continue; histos.fill(HIST("ptHistogramPionrec"), track.pt()); histos.fill(HIST("hPtEta_pi_rec"), track.pt(), track.eta()); - histos.fill(HIST("Rec/hPtPion"), track.pt()); - histos.fill(HIST("Rec/hEtaPion"), track.eta()); - histos.fill(HIST("Rec/hyPion"), track.rapidity(massPi)); - histos.fill(HIST("Rec/hPtyPion"), track.pt(), track.rapidity(massPi)); + histos.fill(HIST("Data/hPtPion"), track.pt()); + histos.fill(HIST("Data/hEtaPion"), track.eta()); + histos.fill(HIST("Data/hyPion"), track.rapidity(massPi)); + histos.fill(HIST("Data/hPtyPion"), track.pt(), track.rapidity(massPi)); histos.fill(HIST("NSigamaTPCpion_rec"), track.p(), track.tpcNSigmaPi()); histos.fill(HIST("NSigamaTOFpion_rec"), track.p(), track.tofNSigmaPi()); histos.fill(HIST("NSigamaTPCTOFpion_rec"), track.tpcNSigmaPi(), track.tofNSigmaPi()); - histos.fill(HIST("Rec/hdEdx_afterselection1"), track.p(), track.tpcSignal()); - histos.fill(HIST("Rec/hTOFbeta_afterselection1"), track.p(), track.beta()); + histos.fill(HIST("Data/hdEdx_afterselection1"), track.p(), track.tpcSignal()); + histos.fill(HIST("Data/hTOFbeta_afterselection1"), track.p(), track.beta()); if (std::abs(track.mcParticle().pdgCode()) == PDG_t::kPiPlus) { histos.fill(HIST("ptHistogramPionrec_purity"), track.pt()); } @@ -1226,9 +1167,9 @@ struct EventMeanPtId { //===========================kaon=============================================================== if ((track.hasTPC() && std::abs(track.tpcNSigmaKa()) < cNSigCut3) && (track.hasTOF() && std::abs(track.tofNSigmaKa()) < cNSigCut3)) { - histos.fill(HIST("Rec/NSigamaTPCTOFkaon"), track.tpcNSigmaKa(), track.tofNSigmaKa()); - histos.fill(HIST("Rec/hdEdx_afterselection"), track.p(), track.tpcSignal()); - histos.fill(HIST("Rec/hTOFbeta_afterselection"), track.p(), track.beta()); + histos.fill(HIST("Data/NSigamaTPCTOFkaon"), track.tpcNSigmaKa(), track.tofNSigmaKa()); + histos.fill(HIST("Data/hdEdx_afterselection"), track.p(), track.tpcSignal()); + histos.fill(HIST("Data/hTOFbeta_afterselection"), track.p(), track.beta()); } if (selKaon(track)) { @@ -1238,15 +1179,15 @@ struct EventMeanPtId { continue; histos.fill(HIST("ptHistogramKaonrec"), track.pt()); histos.fill(HIST("hPtEta_ka_rec"), track.pt(), track.eta()); - histos.fill(HIST("Rec/hPtKaon"), track.pt()); - histos.fill(HIST("Rec/hEtaKaon"), track.eta()); - histos.fill(HIST("Rec/hyKaon"), track.rapidity(massKa)); - histos.fill(HIST("Rec/hPtyKaon"), track.pt(), track.rapidity(massKa)); + histos.fill(HIST("Data/hPtKaon"), track.pt()); + histos.fill(HIST("Data/hEtaKaon"), track.eta()); + histos.fill(HIST("Data/hyKaon"), track.rapidity(massKa)); + histos.fill(HIST("Data/hPtyKaon"), track.pt(), track.rapidity(massKa)); histos.fill(HIST("NSigamaTPCkaon_rec"), track.p(), track.tpcNSigmaKa()); histos.fill(HIST("NSigamaTOFkaon_rec"), track.p(), track.tofNSigmaKa()); histos.fill(HIST("NSigamaTPCTOFkaon_rec"), track.tpcNSigmaKa(), track.tofNSigmaKa()); - histos.fill(HIST("Rec/hdEdx_afterselection1"), track.p(), track.tpcSignal()); - histos.fill(HIST("Rec/hTOFbeta_afterselection1"), track.p(), track.beta()); + histos.fill(HIST("Data/hdEdx_afterselection1"), track.p(), track.tpcSignal()); + histos.fill(HIST("Data/hTOFbeta_afterselection1"), track.p(), track.beta()); if (std::abs(track.mcParticle().pdgCode()) == PDG_t::kKPlus) { histos.fill(HIST("ptHistogramKaonrec_purity"), track.pt()); } @@ -1261,9 +1202,9 @@ struct EventMeanPtId { //============================proton=========================================================== if ((track.hasTPC() && std::abs(track.tpcNSigmaPr()) < cNSigCut3) && (track.hasTOF() && std::abs(track.tofNSigmaPr()) < cNSigCut3)) { - histos.fill(HIST("Rec/NSigamaTPCTOFproton"), track.tpcNSigmaPr(), track.tofNSigmaPr()); - histos.fill(HIST("Rec/hdEdx_afterselection"), track.p(), track.tpcSignal()); - histos.fill(HIST("Rec/hTOFbeta_afterselection"), track.p(), track.beta()); + histos.fill(HIST("Data/NSigamaTPCTOFproton"), track.tpcNSigmaPr(), track.tofNSigmaPr()); + histos.fill(HIST("Data/hdEdx_afterselection"), track.p(), track.tpcSignal()); + histos.fill(HIST("Data/hTOFbeta_afterselection"), track.p(), track.beta()); } if (selProton(track)) { @@ -1273,15 +1214,15 @@ struct EventMeanPtId { continue; histos.fill(HIST("ptHistogramProtonrec"), track.pt()); histos.fill(HIST("hPtEta_pr_rec"), track.pt(), track.eta()); - histos.fill(HIST("Rec/hPtProton"), track.pt()); - histos.fill(HIST("Rec/hEtaProton"), track.eta()); - histos.fill(HIST("Rec/hyProton"), track.rapidity(massPr)); - histos.fill(HIST("Rec/hPtyProton"), track.pt(), track.rapidity(massPr)); + histos.fill(HIST("Data/hPtProton"), track.pt()); + histos.fill(HIST("Data/hEtaProton"), track.eta()); + histos.fill(HIST("Data/hyProton"), track.rapidity(massPr)); + histos.fill(HIST("Data/hPtyProton"), track.pt(), track.rapidity(massPr)); histos.fill(HIST("NSigamaTPCproton_rec"), track.p(), track.tpcNSigmaPr()); histos.fill(HIST("NSigamaTOFproton_rec"), track.p(), track.tofNSigmaPr()); histos.fill(HIST("NSigamaTPCTOFproton_rec"), track.tpcNSigmaPr(), track.tofNSigmaPr()); - histos.fill(HIST("Rec/hdEdx_afterselection1"), track.p(), track.tpcSignal()); - histos.fill(HIST("Rec/hTOFbeta_afterselection1"), track.p(), track.beta()); + histos.fill(HIST("Data/hdEdx_afterselection1"), track.p(), track.tpcSignal()); + histos.fill(HIST("Data/hTOFbeta_afterselection1"), track.p(), track.beta()); if (std::abs(track.mcParticle().pdgCode()) == PDG_t::kProton) { histos.fill(HIST("ptHistogramProtonrec_purity"), track.pt()); } @@ -1295,7 +1236,7 @@ struct EventMeanPtId { } } // loop over tracks - histos.fill(HIST("Rec/hcent_nacc"), cent, nchAll); + histos.fill(HIST("Data/hcent_nacc"), cent, nchAll); histos.fill(HIST("hNch_vs_Nch"), sample, nchAll, nchAll); if (nchAll < cTwoPtlCut2) @@ -1306,10 +1247,10 @@ struct EventMeanPtId { histos.fill(HIST("hterm1"), nchAll, var1); histos.fill(HIST("hterm2"), nchAll, var2); - histos.fill(HIST("Rec/hVar1"), sample, cent, var1); - histos.fill(HIST("Rec/hVar2"), sample, cent, var2); - histos.fill(HIST("Rec/hVarc"), sample, cent); - histos.fill(HIST("Rec/hVar2meanpt"), cent, var2); + histos.fill(HIST("Data/hVar1"), sample, cent, var1); + histos.fill(HIST("Data/hVar2"), sample, cent, var2); + histos.fill(HIST("Data/hVarc"), sample, cent); + histos.fill(HIST("Data/hVar2meanpt"), cent, var2); //---------------------- pions ---------------------------------------- if (nchPi >= cTwoPtlCut2) { @@ -1328,52 +1269,51 @@ struct EventMeanPtId { } //-----------------------nch------------------------------------- - histos.fill(HIST("Rec/hVar1x"), sample, nchAll, var1); - histos.fill(HIST("Rec/hVar2x"), sample, nchAll, var2); - histos.fill(HIST("Rec/hVarx"), sample, nchAll); - histos.fill(HIST("Rec/hdiffVar1x"), sample, nch, var1); - histos.fill(HIST("Rec/hdiffVar2x"), sample, nch, var2); - histos.fill(HIST("Rec/hdiffVarx"), sample, nch); - histos.fill(HIST("Rec/hVar2meanptx"), nchAll, var2); + histos.fill(HIST("Data/hVar1x"), sample, nchAll, var1); + histos.fill(HIST("Data/hVar2x"), sample, nchAll, var2); + histos.fill(HIST("Data/hVarx"), sample, nchAll); + histos.fill(HIST("Data/hdiffVar1x"), sample, nch, var1); + histos.fill(HIST("Data/hdiffVar2x"), sample, nch, var2); + histos.fill(HIST("Data/hdiffVarx"), sample, nch); + histos.fill(HIST("Data/hVar2meanptx"), nchAll, var2); if (pidSwitchHistoFill) { - histos.fill(HIST("Rec/hVar1pi"), sample, cent, var1Pi); - histos.fill(HIST("Rec/hVar2pi"), sample, cent, var2Pi); - histos.fill(HIST("Rec/hVar2meanptpi"), cent, var2Pi); - histos.fill(HIST("Rec/hVar1k"), sample, cent, var1Ka); - histos.fill(HIST("Rec/hVar2k"), sample, cent, var2Ka); - histos.fill(HIST("Rec/hVar2meanptk"), cent, var2Ka); - histos.fill(HIST("Rec/hVar1p"), sample, cent, var1Pr); - histos.fill(HIST("Rec/hVar2p"), sample, cent, var2Pr); - histos.fill(HIST("Rec/hVar2meanptp"), cent, var2Pr); - histos.fill(HIST("Rec/hVar1pix"), sample, nchAll, var1Pi); - histos.fill(HIST("Rec/hVar2pix"), sample, nchAll, var2Pi); - histos.fill(HIST("Rec/hVarpix"), sample, nchPi); - histos.fill(HIST("Rec/hVar2meanptpix"), nchAll, var2Pi); - histos.fill(HIST("Rec/hVar1kx"), sample, nchAll, var1Ka); - histos.fill(HIST("Rec/hVar2kx"), sample, nchAll, var2Ka); - histos.fill(HIST("Rec/hVarkx"), sample, nchKa); - histos.fill(HIST("Rec/hVar2meanptkx"), nchAll, var2Ka); - histos.fill(HIST("Rec/hVar1px"), sample, nchAll, var1Pr); - histos.fill(HIST("Rec/hVar2px"), sample, nchAll, var2Pr); - histos.fill(HIST("Rec/hVarpx"), sample, nchPr); - histos.fill(HIST("Rec/hVar2meanptpx"), nchAll, var2Pr); + histos.fill(HIST("Data/hVar1pi"), sample, cent, var1Pi); + histos.fill(HIST("Data/hVar2pi"), sample, cent, var2Pi); + histos.fill(HIST("Data/hVar2meanptpi"), cent, var2Pi); + histos.fill(HIST("Data/hVar1k"), sample, cent, var1Ka); + histos.fill(HIST("Data/hVar2k"), sample, cent, var2Ka); + histos.fill(HIST("Data/hVar2meanptk"), cent, var2Ka); + histos.fill(HIST("Data/hVar1p"), sample, cent, var1Pr); + histos.fill(HIST("Data/hVar2p"), sample, cent, var2Pr); + histos.fill(HIST("Data/hVar2meanptp"), cent, var2Pr); + histos.fill(HIST("Data/hVar1pix"), sample, nchAll, var1Pi); + histos.fill(HIST("Data/hVar2pix"), sample, nchAll, var2Pi); + histos.fill(HIST("Data/hVarpix"), sample, nchPi); + histos.fill(HIST("Data/hVar2meanptpix"), nchAll, var2Pi); + histos.fill(HIST("Data/hVar1kx"), sample, nchAll, var1Ka); + histos.fill(HIST("Data/hVar2kx"), sample, nchAll, var2Ka); + histos.fill(HIST("Data/hVarkx"), sample, nchKa); + histos.fill(HIST("Data/hVar2meanptkx"), nchAll, var2Ka); + histos.fill(HIST("Data/hVar1px"), sample, nchAll, var1Pr); + histos.fill(HIST("Data/hVar2px"), sample, nchAll, var2Pr); + histos.fill(HIST("Data/hVarpx"), sample, nchPr); + histos.fill(HIST("Data/hVar2meanptpx"), nchAll, var2Pr); } if (effSwitchHistoFill) { var1Eff = (sumPtWeight * sumPtWeight - sumPtPtWeight) / (sumWeight * (sumWeight - 1)); var2Eff = (sumPtWeight / sumWeight); - histos.fill(HIST("hEffVar1x_rec"), sample, nchAll, var1Eff); - histos.fill(HIST("hEffVar2x_rec"), sample, nchAll, var2Eff); - histos.fill(HIST("hEffVarx_rec"), sample, nchAll); - histos.fill(HIST("hEffVar2Meanptx_rec"), nchAll, var2Eff); - histos.fill(HIST("hEffVar1x_Naccorr_rec"), sample, sumWeight, var1Eff); - histos.fill(HIST("hEffVar2x_Naccorr_rec"), sample, sumWeight, var2Eff); - histos.fill(HIST("hEffVarx_Naccorr_rec"), sample, sumWeight); - histos.fill(HIST("hEffVar1x_Naccorr_xaxis_rec"), sample, sumWeight, var1); - histos.fill(HIST("hEffVar2x_Naccorr_xaxis_rec"), sample, sumWeight, var2); - histos.fill(HIST("hEffVarx_Naccorr_xaxis_rec"), sample, sumWeight); + histos.fill(HIST("hEffVar1x_data"), sample, nchAll, var1Eff); + histos.fill(HIST("hEffVar2x_data"), sample, nchAll, var2Eff); + histos.fill(HIST("hEffVarx_data"), sample, nchAll); + histos.fill(HIST("hEffVar2Meanptx_data"), nchAll, var2Eff); + histos.fill(HIST("hEffVar1x_Naccorr_data"), sample, sumWeight, var1Eff); + histos.fill(HIST("hEffVar2x_Naccorr_data"), sample, sumWeight, var2Eff); + histos.fill(HIST("hEffVarx_Naccorr_data"), sample, sumWeight); + histos.fill(HIST("hEffVar1x_Naccorr_xaxis_data"), sample, sumWeight, var1); + histos.fill(HIST("hEffVar2x_Naccorr_xaxis_data"), sample, sumWeight, var2); histos.fill(HIST("hcent_nacc_corr"), cent, sumWeight); histos.fill(HIST("hNch_vs_corr"), sample, nchAll, sumWeight); } @@ -1485,21 +1425,6 @@ struct EventMeanPtId { histos.fill(HIST("hterm1_gen"), nchGenAll, var1AllGen); histos.fill(HIST("hterm2_gen"), nchGenAll, var2AllGen); - //--------------------------Pions------------------------------------------- - if (nchPiGen >= cTwoPtlCut2) { - var1PiGen = (q1PiGen * q1PiGen - q2PiGen) / (nchPiGen * (nchPiGen - 1)); - var2PiGen = (q1PiGen / nchPiGen); - } - //----------------------- kaons --------------------------------------- - if (nchKaGen >= cTwoPtlCut2) { - var1KaGen = (q1KaGen * q1KaGen - q2KaGen) / (nchKaGen * (nchKaGen - 1)); - var2KaGen = (q1KaGen / nchKaGen); - } - //---------------------------- protons ---------------------------------- - if (nchPrGen >= cTwoPtlCut2) { - var1PrGen = (q1PrGen * q1PrGen - q2PrGen) / (nchPrGen * (nchPrGen - 1)); - var2PrGen = (q1PrGen / nchPrGen); - } //-----------------------nch------------------------------------- histos.fill(HIST("hVar1x_gen"), sampleGen, nchGenAll, var1AllGen); histos.fill(HIST("hVar2x_gen"), sampleGen, nchGenAll, var2AllGen); @@ -1510,6 +1435,21 @@ struct EventMeanPtId { histos.fill(HIST("hVar2meanptx_gen"), nchGenAll, var2AllGen); if (pidSwitchHistoFill) { + //--------------------------Pions------------------------------------------- + if (nchPiGen >= cTwoPtlCut2) { + var1PiGen = (q1PiGen * q1PiGen - q2PiGen) / (nchPiGen * (nchPiGen - 1)); + var2PiGen = (q1PiGen / nchPiGen); + } + //----------------------- kaons --------------------------------------- + if (nchKaGen >= cTwoPtlCut2) { + var1KaGen = (q1KaGen * q1KaGen - q2KaGen) / (nchKaGen * (nchKaGen - 1)); + var2KaGen = (q1KaGen / nchKaGen); + } + //---------------------------- protons ---------------------------------- + if (nchPrGen >= cTwoPtlCut2) { + var1PrGen = (q1PrGen * q1PrGen - q2PrGen) / (nchPrGen * (nchPrGen - 1)); + var2PrGen = (q1PrGen / nchPrGen); + } histos.fill(HIST("hVar1pix_gen"), sampleGen, nchGenAll, var1PiGen); histos.fill(HIST("hVar2pix_gen"), sampleGen, nchGenAll, var2PiGen); histos.fill(HIST("hVarpix_gen"), sampleGen, nchPiGen); From 3ea6038002589a3719324b6b83c542ae12e81210 Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Sat, 25 Oct 2025 13:57:27 +0200 Subject: [PATCH 889/986] [PWGHF,Trigger] Remove useless and unprotected calls to propagateTracksToVertex (#13539) --- EventFiltering/PWGHF/HFFilter.cxx | 8 -------- EventFiltering/PWGHF/HFFilterHelpers.h | 4 ---- 2 files changed, 12 deletions(-) diff --git a/EventFiltering/PWGHF/HFFilter.cxx b/EventFiltering/PWGHF/HFFilter.cxx index 23109f0b29c..e0d75fa8ebd 100644 --- a/EventFiltering/PWGHF/HFFilter.cxx +++ b/EventFiltering/PWGHF/HFFilter.cxx @@ -636,7 +636,6 @@ struct HfFilter { // Main struct for HF triggers } } else { df2.process(trackParPos, trackParNeg); - df2.propagateTracksToVertex(); std::array pVecPosVtx{}, pVecNegVtx{}; df2.getTrack(0).getPxPyPzGlo(pVecPosVtx); df2.getTrack(1).getPxPyPzGlo(pVecNegVtx); @@ -647,7 +646,6 @@ struct HfFilter { // Main struct for HF triggers if (activateQA) { registry.fill(HIST("fHfVtxStages"), 1 + HfVtxStage::BeautyVertex, kBplus); } - dfB.propagateTracksToVertex(); const auto& secondaryVertexBtoD0h = dfB.getPCACandidate(); std::array pVecThirdVtx{}; dfB.getTrack(0).getPxPyPzGlo(pVec2ProngVtx); @@ -733,7 +731,6 @@ struct HfFilter { // Main struct for HF triggers } } else { df2.process(trackParPos, trackParNeg); - df2.propagateTracksToVertex(); std::array pVecPosVtx{}, pVecNegVtx{}; df2.getTrack(0).getPxPyPzGlo(pVecPosVtx); df2.getTrack(1).getPxPyPzGlo(pVecNegVtx); @@ -744,7 +741,6 @@ struct HfFilter { // Main struct for HF triggers if (activateQA) { registry.fill(HIST("fHfVtxStages"), 1 + HfVtxStage::BeautyVertex, kB0toDStar); } - dfBtoDstar.propagateTracksToVertex(); const auto& secondaryVertexBzero = dfBtoDstar.getPCACandidate(); std::array pVecThirdVtx{}, pVecFourthVtx{}; dfBtoDstar.getTrack(0).getPxPyPzGlo(pVec2ProngVtx); @@ -799,7 +795,6 @@ struct HfFilter { // Main struct for HF triggers // 3-prong vertices if (!keepEvent[kBtoJPsiKa] || !keepEvent[kBtoJPsiPi]) { if (df3.process(trackParPos, trackParNeg, trackParThird) != 0) { - df3.propagateTracksToVertex(); const auto& secondaryVertexBto3tracks = df3.getPCACandidate(); df3.getTrack(0).getPxPyPzGlo(pVecPosVtx); df3.getTrack(1).getPxPyPzGlo(pVecNegVtx); @@ -834,7 +829,6 @@ struct HfFilter { // Main struct for HF triggers continue; } if (df4.process(trackParPos, trackParNeg, trackParThird, trackParFourth) != 0) { - df4.propagateTracksToVertex(); const auto& secondaryVertexBto4tracks = df4.getPCACandidate(); df4.getTrack(0).getPxPyPzGlo(pVecPosVtx); df4.getTrack(1).getPxPyPzGlo(pVecNegVtx); @@ -1363,7 +1357,6 @@ struct HfFilter { // Main struct for HF triggers } } else { df3.process(trackParFirst, trackParSecond, trackParThird); - df3.propagateTracksToVertex(); std::array pVecFirstVtx{}, pVecSecondVtx{}, pVecThirdVtx{}; df3.getTrack(0).getPxPyPzGlo(pVecFirstVtx); df3.getTrack(1).getPxPyPzGlo(pVecSecondVtx); @@ -1375,7 +1368,6 @@ struct HfFilter { // Main struct for HF triggers if (activateQA) { registry.fill(HIST("fHfVtxStages"), 1 + HfVtxStage::BeautyVertex, iHypo + 3); } - dfB.propagateTracksToVertex(); const auto& secondaryVertexB = dfB.getPCACandidate(); std::array pVecFourtVtx{}; dfB.getTrack(0).getPxPyPzGlo(pVec3ProngVtx); diff --git a/EventFiltering/PWGHF/HFFilterHelpers.h b/EventFiltering/PWGHF/HFFilterHelpers.h index 715321c38c8..b000ad228d6 100644 --- a/EventFiltering/PWGHF/HFFilterHelpers.h +++ b/EventFiltering/PWGHF/HFFilterHelpers.h @@ -2377,7 +2377,6 @@ inline bool HfFilterHelper::isSelectedXiBach(T const& trackParCasc, T const& tra } const auto& vtx = dcaFitter.getPCACandidate(); - dcaFitter.propagateTracksToVertex(); const auto& trackCascProp = dcaFitter.getTrack(0); const auto& trackBachProp = dcaFitter.getTrack(1); std::array momCasc{}, momBach{}; @@ -2456,7 +2455,6 @@ inline bool HfFilterHelper::isSelectedXiBachBach(T const& trackParCasc, std::arr const auto& vtx = dcaFitter.getPCACandidate(); std::array momCasc{pVecCascade}, momBachFirst{}, momBachSecond{}; - dcaFitter.propagateTracksToVertex(); const auto& trackBachFirstProp = dcaFitter.getTrack(0); const auto& trackBachSecondProp = dcaFitter.getTrack(1); trackBachFirstProp.getPxPyPzGlo(momBachFirst); @@ -2681,7 +2679,6 @@ inline bool HfFilterHelper::buildV0(V const& v0Indices, T const& tracks, C const } // compute candidate momentum from tracks propagated to decay vertex - dcaFitter.propagateTracksToVertex(); auto& trackPosProp = dcaFitter.getTrack(0); auto& trackNegProp = dcaFitter.getTrack(1); std::array momPos{}, momNeg{}; @@ -2813,7 +2810,6 @@ inline bool HfFilterHelper::buildCascade(Casc const& cascIndices, V const& v0Ind } // compute candidate momentum from tracks propagated to decay vertex - dcaFitter.propagateTracksToVertex(); auto& trackV0Prop = dcaFitter.getTrack(0); auto& trackBachProp = dcaFitter.getTrack(1); std::array momV0{}, momBach{}; From e066dde1e9af85e383037fabe52574fa5c6f1a77 Mon Sep 17 00:00:00 2001 From: SahaArka-uniba Date: Sat, 25 Oct 2025 14:18:03 +0200 Subject: [PATCH 890/986] [PWGLF] refined the pT axis ranges and its binning (#13538) Co-authored-by: Arkaprabha Saha --- PWGLF/Tasks/Nuspex/AntiNucleiTask.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Nuspex/AntiNucleiTask.cxx b/PWGLF/Tasks/Nuspex/AntiNucleiTask.cxx index 3cf9fcb8758..3601b513f5b 100644 --- a/PWGLF/Tasks/Nuspex/AntiNucleiTask.cxx +++ b/PWGLF/Tasks/Nuspex/AntiNucleiTask.cxx @@ -69,7 +69,7 @@ struct AntiNucleiTask { ConfigurableAxis phiAxis{"phiAxis", {70, 0.f, 7.f}, "#phi"}; ConfigurableAxis zVtxAxis{"zVtxAxis", {100, -20.f, 20.f}, "Primary Vertex z (cm)"}; ConfigurableAxis nSigmaAxis{"nSigmaAxis", {50, -5.f, 5.f}, "N_{#sigma}"}; - ConfigurableAxis ptAxis{"ptAxis", {100, -5.0f, 5.0f}, "p_{T} (GeV/c)"}; + ConfigurableAxis ptAxis{"ptAxis", {200, -10.0f, 10.0f}, "p_{T} (GeV/c)"}; ConfigurableAxis centAxis{"centAxis", {100, 0, 100.0f}, "Centrality"}; ConfigurableAxis momAxis{"momAxis", {5.e2, 0.f, 5.f}, "momentum axis binning"}; ConfigurableAxis tpcAxis{"tpcAxis", {4.e2, 0.f, 4.e3f}, "tpc signal axis binning"}; From bf91e794f5ea52bb2c487cbf656c361c44909cae Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Sat, 25 Oct 2025 20:44:27 +0200 Subject: [PATCH 891/986] [PWGCF] FemtoUniverse: Add flag to select circular or square deta-dphi cut (#13549) Co-authored-by: ALICE Action Bot --- PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h | 6 ++++-- ...mtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h index 4689373ec61..56af8090a79 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h @@ -562,7 +562,7 @@ class FemtoUniverseDetaDphiStar /// Check if pair is close or not template - bool isClosePairFrac(Part const& part1, Part const& part2, float lmagfield, uint8_t ChosenEventType, bool IsDphiAvgOrDist, float DistMax, float FracMax) + bool isClosePairFrac(Part const& part1, Part const& part2, float lmagfield, uint8_t ChosenEventType, bool IsDphiAvgOrDist, float DistMax, float FracMax, bool CircCut) { magfield = lmagfield; @@ -585,7 +585,9 @@ class FemtoUniverseDetaDphiStar } if (IsDphiAvgOrDist) { - if ((dphiAvg > cutDeltaPhiStarMin) && (dphiAvg < cutDeltaPhiStarMax) && (deta > cutDeltaEtaMin) && (deta < cutDeltaEtaMax)) { + if (CircCut && (std::pow(dphiAvg, 2) / std::pow(cutDeltaPhiStarMax, 2) + std::pow(deta, 2) / std::pow(cutDeltaEtaMax, 2) < 1.)) { + return true; + } else if (!CircCut && (dphiAvg > cutDeltaPhiStarMin) && (dphiAvg < cutDeltaPhiStarMax) && (deta > cutDeltaEtaMin) && (deta < cutDeltaEtaMax)) { return true; } else { if (ChosenEventType == femto_universe_container::EventType::same) { diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx index ccbc8c01882..6a5d2db2490 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx @@ -201,6 +201,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { Configurable confCPRFracMax{"confCPRFracMax", 0.0, "Max. allowed fraction bad to all TPC points of radial seperation between two closed-pairs"}; Configurable confCPRIsAtITS{"confCPRIsAtITS", false, "Close Pair Rejection at ITS or TPC"}; Configurable confCPRDphiAvgOrDist{"confCPRDphiAvgOrDist", true, "Close Pair Rejection by radial or angular seperation"}; + Configurable confIsCircularCut{"confIsCircularCut", true, "Close Pair Rejection by circular cut"}; FemtoUniverseSHContainer sameEventCont; FemtoUniverseSHContainer mixedEventCont; @@ -521,7 +522,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { continue; } } else { - if (pairCloseRejection.isClosePairFrac(p1, p2, magFieldTesla, femto_universe_container::EventType::same, confCPRDphiAvgOrDist, confCPRDistMax, confCPRFracMax)) { + if (pairCloseRejection.isClosePairFrac(p1, p2, magFieldTesla, femto_universe_container::EventType::same, confCPRDphiAvgOrDist, confCPRDistMax, confCPRFracMax, confIsCircularCut)) { continue; } } @@ -551,7 +552,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { continue; } } else { - if (pairCloseRejection.isClosePairFrac(p1, p2, magFieldTesla, femto_universe_container::EventType::same, confCPRDphiAvgOrDist, confCPRDistMax, confCPRFracMax)) { + if (pairCloseRejection.isClosePairFrac(p1, p2, magFieldTesla, femto_universe_container::EventType::same, confCPRDphiAvgOrDist, confCPRDistMax, confCPRFracMax, confIsCircularCut)) { continue; } } @@ -872,7 +873,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { continue; } } else { - if (pairCloseRejection.isClosePairFrac(p1, p2, magFieldTesla, femto_universe_container::EventType::mixed, confCPRDphiAvgOrDist, confCPRDistMax, confCPRFracMax)) { + if (pairCloseRejection.isClosePairFrac(p1, p2, magFieldTesla, femto_universe_container::EventType::mixed, confCPRDphiAvgOrDist, confCPRDistMax, confCPRFracMax, confIsCircularCut)) { continue; } } From aad3bfc1d1acf5a5344757f436372d384d277e69 Mon Sep 17 00:00:00 2001 From: Yash Patley <52608802+yashpatley@users.noreply.github.com> Date: Sun, 26 Oct 2025 02:24:31 +0530 Subject: [PATCH 892/986] [PWGCF] : Flow Event Plane (#13550) --- PWGCF/Flow/Tasks/flowEventPlane.cxx | 52 +++++++++++++++++++---------- 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowEventPlane.cxx b/PWGCF/Flow/Tasks/flowEventPlane.cxx index 32c75e7a1ad..4ecf63f0022 100644 --- a/PWGCF/Flow/Tasks/flowEventPlane.cxx +++ b/PWGCF/Flow/Tasks/flowEventPlane.cxx @@ -112,10 +112,12 @@ struct FlowEventPlane { // Global objects float cent = 0., mult = 0.; float posX = 0., posY = 0., posZ = 0.; + std::array znaXWeigthEnergy = {1., 1., 1., 1.}; std::array znaYWeigthEnergy = {1., 1., 1., 1.}; std::array zncXWeigthEnergy = {1., 1., 1., 1.}; std::array zncYWeigthEnergy = {1., 1., 1., 1.}; + std::vector> vCoarseCorrHistNames = { {"hXZNAVsCentVxVyVz"}, {"hYZNAVsCentVxVyVz"}, @@ -126,8 +128,18 @@ struct FlowEventPlane { {"hYZNAVsCent", "hYZNAVsVx", "hYZNAVsVy", "hYZNAVsVz"}, {"hXZNCVsCent", "hXZNCVsVx", "hXZNCVsVy", "hXZNCVsVz"}, {"hYZNCVsCent", "hYZNCVsVx", "hYZNCVsVy", "hYZNCVsVz"}}; + + // Map for Correction Type and Histogram Names std::map>> corrTypeHistNameMap = {{kFineCorr, vFineCorrHistNames}, {kCoarseCorr, vCoarseCorrHistNames}}; + // Structure to hold CCDB objects + struct CcdbObjects { + TList* ccdbList; + TObject* obj; + TProfile* hp; + THnSparseF* hn; + } ccdbObjects; + void init(InitContext const&) { // Set CCDB url @@ -181,14 +193,14 @@ struct FlowEventPlane { histos.add("QA/hZNCSignalSector2", "ZNC Signal Sector 2", kTH1F, {axisZDCEnergy}); histos.add("QA/hZNCSignalSector3", "ZNC Signal Sector 3", kTH1F, {axisZDCEnergy}); histos.add("QA/hZNCSignalSector4", "ZNC Signal Sector 4", kTH1F, {axisZDCEnergy}); - histos.add("CorrHist/hWtXZNA", "X^{ZNA}_{1}", kTHnF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); - histos.add("CorrHist/hWtYZNA", "Y^{ZNA}_{1}", kTHnF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); - histos.add("CorrHist/hWtXZNC", "X^{ZNC}_{1}", kTHnF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); - histos.add("CorrHist/hWtYZNC", "Y^{ZNC}_{1}", kTHnF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); - histos.add("CorrHist/hUWtXZNA", "X^{ZNA}_{1}", kTHnF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); - histos.add("CorrHist/hUWtYZNA", "Y^{ZNA}_{1}", kTHnF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); - histos.add("CorrHist/hUWtXZNC", "X^{ZNC}_{1}", kTHnF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); - histos.add("CorrHist/hUWtYZNC", "Y^{ZNC}_{1}", kTHnF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); + histos.add("CorrHist/hWtXZNA", "X^{ZNA}_{1}", kTHnSparseF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); + histos.add("CorrHist/hWtYZNA", "Y^{ZNA}_{1}", kTHnSparseF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); + histos.add("CorrHist/hWtXZNC", "X^{ZNC}_{1}", kTHnSparseF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); + histos.add("CorrHist/hWtYZNC", "Y^{ZNC}_{1}", kTHnSparseF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); + histos.add("CorrHist/hUWtXZNA", "X^{ZNA}_{1}", kTHnSparseF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); + histos.add("CorrHist/hUWtYZNA", "Y^{ZNA}_{1}", kTHnSparseF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); + histos.add("CorrHist/hUWtXZNC", "X^{ZNC}_{1}", kTHnSparseF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); + histos.add("CorrHist/hUWtYZNC", "Y^{ZNC}_{1}", kTHnSparseF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); histos.add("CorrHist/hXZNAVsCent", "X^{ZNA}_{1} Vs Cent", kTProfile, {axisFineCent}); histos.add("CorrHist/hXZNAVsVx", "X^{ZNA}_{1} Vs V_{x}", kTProfile, {axisFineVx}); histos.add("CorrHist/hXZNAVsVy", "X^{ZNA}_{1} Vs V_{y}", kTProfile, {axisFineVy}); @@ -214,6 +226,8 @@ struct FlowEventPlane { histos.add("TrackQA/hPtDcaXY", "DCA_{XY} vs p_{T}", kTH2F, {axisTrackPt, axisTrackDcaXY}); histos.add("TrackQA/hPtDcaZ", "DCA_{Z} vs p_{T}", kTH2F, {axisTrackPt, axisTrackDcaZ}); histos.add("DF/hQaQc", "X^{A}_{1}X^{C}_{1} + Y^{A}_{1}Y^{C}_{1}", kTProfile, {axisCent}); + histos.add("DF/hAQu", "u_{x}X^{A}_{1} + u_{y}Y^{A}_{1}", kTH3F, {axisCent, axisV1, axisTrackEta}); + histos.add("DF/hCQu", "u_{x}X^{C}_{1} + u_{y}Y^{C}_{1}", kTH3F, {axisCent, axisV1, axisTrackEta}); histos.add("DF/hAQuPos", "u_{x}X^{A}_{1} + u_{y}Y^{A}_{1}", kTH3F, {axisCent, axisV1, axisTrackEta}); histos.add("DF/hCQuPos", "u_{x}X^{C}_{1} + u_{y}Y^{C}_{1}", kTH3F, {axisCent, axisV1, axisTrackEta}); histos.add("DF/hAQuNeg", "u_{x}X^{A}_{1} + u_{y}Y^{A}_{1}", kTH3F, {axisCent, axisV1, axisTrackEta}); @@ -303,16 +317,18 @@ struct FlowEventPlane { for (auto const& x : vHistNames) { int cntry = 0; for (auto const& y : x) { - TObject* obj = reinterpret_cast(ccdbObject->FindObject(y.c_str())); + ccdbObjects.obj = reinterpret_cast(ccdbObject->FindObject(y.c_str())); if (corrType == kFineCorr) { - TProfile* hp = reinterpret_cast(obj->Clone()); - vAvgOutput[cntrx] += hp->GetBinContent(hp->GetXaxis()->FindBin(vCollParam[cntry])); + ccdbObjects.hp = reinterpret_cast(ccdbObjects.obj->Clone()); + vAvgOutput[cntrx] += ccdbObjects.hp->GetBinContent(ccdbObjects.hp->GetXaxis()->FindBin(vCollParam[cntry])); + delete ccdbObjects.hp; } else { - THnF* hn = reinterpret_cast(obj->Clone()); + ccdbObjects.hn = reinterpret_cast(ccdbObjects.obj->Clone()); for (int i = 0; i < static_cast(vHistNames.size()); ++i) { - binarray[i] = hn->GetAxis(i)->FindBin(vCollParam[i]); + binarray[i] = ccdbObjects.hn->GetAxis(i)->FindBin(vCollParam[i]); } - vAvgOutput[cntrx] += hn->GetBinContent(hn->GetBin(binarray)); + vAvgOutput[cntrx] += ccdbObjects.hn->GetBinContent(ccdbObjects.hn->GetBin(binarray)); + delete ccdbObjects.hn; } ++cntry; } @@ -345,16 +361,16 @@ struct FlowEventPlane { ccdbPath = static_cast(cCcdbPath) + "/CorrItr_" + std::to_string(i + 1) + "/Run" + std::to_string(runNumber); // Get object from CCDB - auto ccdbObj = ccdbService->getForTimeStamp(ccdbPath, -1); + ccdbObjects.ccdbList = ccdbService->getForTimeStamp(ccdbPath, -1); // Check CCDB Object - if (!ccdbObj) { + if (!ccdbObjects.ccdbList) { LOGF(warning, "CCDB OBJECT NOT FOUND"); return; } // Get averages - std::vector vAvg = getAvgCorrFactors(ccdbObj, corrType, inputParam); + std::vector vAvg = getAvgCorrFactors(ccdbObjects.ccdbList, corrType, inputParam); // Apply correction outputParam[kXa] -= vAvg[kXa]; @@ -514,6 +530,8 @@ struct FlowEventPlane { v1c = ux * vSP[kXc] + uy * vSP[kYc]; // Fill histogram + histos.fill(HIST("DF/hAQu"), cent, v1a, track.eta()); + histos.fill(HIST("DF/hCQu"), cent, v1c, track.eta()); if (track.sign() > 0) { histos.fill(HIST("DF/hAQuPos"), cent, v1a, track.eta()); histos.fill(HIST("DF/hCQuPos"), cent, v1c, track.eta()); From aacbe991c6d27c502731e58185404fdbf77f2d23 Mon Sep 17 00:00:00 2001 From: prottayCMT <61418725+prottayCMT@users.noreply.github.com> Date: Sat, 25 Oct 2025 23:03:27 +0200 Subject: [PATCH 893/986] [PWGLF] corrected the definition of SP calculation (#13546) Co-authored-by: Prottay Das --- PWGLF/Tasks/Strangeness/lambdapolsp.cxx | 161 ++++++++++++++---------- 1 file changed, 94 insertions(+), 67 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/lambdapolsp.cxx b/PWGLF/Tasks/Strangeness/lambdapolsp.cxx index 90ff34ad553..6dbf2f4d7aa 100644 --- a/PWGLF/Tasks/Strangeness/lambdapolsp.cxx +++ b/PWGLF/Tasks/Strangeness/lambdapolsp.cxx @@ -89,15 +89,17 @@ struct lambdapolsp { o2::ccdb::CcdbApi ccdbApi; TH1D* hwgtAL; // fill output - Configurable additionalEvSel{"additionalEvSel", false, "additionalEvSel"}; - Configurable additionalEvSel2{"additionalEvSel2", false, "additionalEvSel2"}; - Configurable additionalEvSel3{"additionalEvSel3", false, "additionalEvSel3"}; - Configurable additionalEvSel4{"additionalEvSel4", false, "additionalEvSel4"}; + struct : ConfigurableGroup { + Configurable additionalEvSel{"additionalEvSel", false, "additionalEvSel"}; + Configurable additionalEvSel2{"additionalEvSel2", false, "additionalEvSel2"}; + Configurable additionalEvSel3{"additionalEvSel3", false, "additionalEvSel3"}; + Configurable additionalEvSel4{"additionalEvSel4", false, "additionalEvSel4"}; + Configurable cfgMaxOccupancy{"cfgMaxOccupancy", 1000, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; + Configurable cfgMinOccupancy{"cfgMinOccupancy", 0, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; + } evselGrp; Configurable globalpt{"globalpt", true, "select tracks based on pt global vs tpc"}; Configurable cqvas{"cqvas", false, "change q vectors after shift correction"}; Configurable useprofile{"useprofile", 3, "flag to select profile vs Sparse"}; - Configurable cfgMaxOccupancy{"cfgMaxOccupancy", 1000, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; - Configurable cfgMinOccupancy{"cfgMinOccupancy", 0, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; Configurable sys{"sys", 1, "flag to select systematic source"}; Configurable centestim{"centestim", 0, "flag to select centrality estimator"}; Configurable dosystematic{"dosystematic", false, "flag to perform systematic study"}; @@ -353,11 +355,12 @@ struct lambdapolsp { histos.add("hpCosPsiC", "hpCosPsiC", HistType::kTHnSparseF, {axisGrp.configcentAxis, thnAxisres}); histos.add("hpSinPsiA", "hpSinPsiA", HistType::kTHnSparseF, {axisGrp.configcentAxis, thnAxisres}); histos.add("hpSinPsiC", "hpSinPsiC", HistType::kTHnSparseF, {axisGrp.configcentAxis, thnAxisres});*/ - /*histos.add("hcentQxZDCA", "hcentQxZDCA", kTH2F, {{centAxis}, {qxZDCAxis}}); - histos.add("hcentQyZDCA", "hcentQyZDCA", kTH2F, {{centAxis}, {qxZDCAxis}}); - histos.add("hcentQxZDCC", "hcentQxZDCC", kTH2F, {{centAxis}, {qxZDCAxis}}); - histos.add("hcentQyZDCC", "hcentQyZDCC", kTH2F, {{centAxis}, {qxZDCAxis}});*/ - + if (randGrp.useSP) { + histos.add("hcentQxZDCA", "hcentQxZDCA", kTH2F, {axisGrp.configcentAxis, spAxis}); + histos.add("hcentQyZDCA", "hcentQyZDCA", kTH2F, {axisGrp.configcentAxis, spAxis}); + histos.add("hcentQxZDCC", "hcentQxZDCC", kTH2F, {axisGrp.configcentAxis, spAxis}); + histos.add("hcentQyZDCC", "hcentQyZDCC", kTH2F, {axisGrp.configcentAxis, spAxis}); + } if (usesubdet) { histos.add("hSparseLambdaCosPsiA", "hSparseLambdaCosPsiA", HistType::kTHnSparseF, runaxes, true); histos.add("hSparseLambdaSinPsiA", "hSparseLambdaSinPsiA", HistType::kTHnSparseF, runaxes, true); @@ -402,6 +405,12 @@ struct lambdapolsp { // histos.add("hSparseLambda_corr2b", "hSparseLambda_corr2b", HistType::kTHnSparseF, runaxes, true); histos.add("hSparseAntiLambda_corr2a", "hSparseAntiLambda_corr2a", HistType::kTHnSparseF, runaxes, true); // histos.add("hSparseAntiLambda_corr2b", "hSparseAntiLambda_corr2b", HistType::kTHnSparseF, runaxes, true); + if (randGrp.useSP) { + histos.add("hSparseAntiLambda_avgux", "hSparseAntiLambda_avgux", HistType::kTHnSparseF, {thnAxisInvMass, axisGrp.configthnAxispT, axisGrp.configthnAxisPol, axisGrp.configcentAxis}, true); + histos.add("hSparseAntiLambda_avguy", "hSparseAntiLambda_avguy", HistType::kTHnSparseF, {thnAxisInvMass, axisGrp.configthnAxispT, axisGrp.configthnAxisPol, axisGrp.configcentAxis}, true); + histos.add("hSparseLambda_avgux", "hSparseLambda_avgux", HistType::kTHnSparseF, {thnAxisInvMass, axisGrp.configthnAxispT, axisGrp.configthnAxisPol, axisGrp.configcentAxis}, true); + histos.add("hSparseLambda_avguy", "hSparseLambda_avguy", HistType::kTHnSparseF, {thnAxisInvMass, axisGrp.configthnAxispT, axisGrp.configthnAxisPol, axisGrp.configcentAxis}, true); + } } if (distGrp.filldist) { @@ -666,6 +675,11 @@ struct lambdapolsp { (AntiLambdadummy.M() > minMass && AntiLambdadummy.M() < maxMass)); } + double modqxZDCA; + double modqyZDCA; + double modqxZDCC; + double modqyZDCC; + void fillHistograms(bool tag1, bool tag2, const ROOT::Math::PxPyPzMVector& particle, const ROOT::Math::PxPyPzMVector& daughter, double psiZDCC, double psiZDCA, double psiZDC, double centrality, @@ -691,8 +705,8 @@ struct lambdapolsp { auto PolC = TMath::Sin(phiminuspsiC); auto PolA = TMath::Sin(phiminuspsiA); auto Pol = TMath::Sin(phiminuspsi); - auto PolSP = uy * TMath::Cos(psiZDC) - ux * TMath::Sin(psiZDC); - + // auto PolSP = uy * TMath::Cos(psiZDC) - ux * TMath::Sin(psiZDC); + auto PolSP = uy * (modqxZDCC - modqxZDCA) - ux * (modqyZDCC - modqyZDCA); auto sinPhiStar = TMath::Sin(GetPhiInRange(phiangle)); auto cosPhiStar = TMath::Cos(GetPhiInRange(phiangle)); // auto sinThetaStarcosphiphiStar = sinThetaStar * TMath::Cos(2 * GetPhiInRange(particle.Phi() - phiangle)); @@ -733,6 +747,10 @@ struct lambdapolsp { // histos.fill(HIST("hSparseAntiLambda_corr1c"), candmass, candpt, phiphiStar, centrality, desbinvalue, wgtfactor); histos.fill(HIST("hSparseAntiLambda_corr2a"), candmass, candpt, sinThetaStar, centrality, desbinvalue, wgtfactor); // histos.fill(HIST("hSparseAntiLambda_corr2b"), candmass, candpt, sinThetaStarcosphiphiStar, centrality, desbinvalue, wgtfactor); + if (randGrp.useSP) { + histos.fill(HIST("hSparseAntiLambda_avgux"), candmass, candpt, ux, centrality); + histos.fill(HIST("hSparseAntiLambda_avguy"), candmass, candpt, uy, centrality); + } } else { if (usesubdet) { histos.fill(HIST("hSparseAntiLambdaCosPsiA"), candmass, candpt, (TMath::Cos(GetPhiInRange(psiZDCA))), centrality, wgtfactor); @@ -780,6 +798,10 @@ struct lambdapolsp { // histos.fill(HIST("hSparseLambda_corr1c"), candmass, candpt, phiphiStar, centrality, desbinvalue, wgtfactor); histos.fill(HIST("hSparseLambda_corr2a"), candmass, candpt, sinThetaStar, centrality, desbinvalue, wgtfactor); // histos.fill(HIST("hSparseLambda_corr2b"), candmass, candpt, sinThetaStarcosphiphiStar, centrality, desbinvalue, wgtfactor); + if (randGrp.useSP) { + histos.fill(HIST("hSparseLambda_avgux"), candmass, candpt, ux, centrality); + histos.fill(HIST("hSparseLambda_avguy"), candmass, candpt, uy, centrality); + } } else { if (usesubdet) { histos.fill(HIST("hSparseLambdaCosPsiA"), candmass, candpt, (TMath::Cos(GetPhiInRange(psiZDCA))), centrality, wgtfactor); @@ -855,20 +877,20 @@ struct lambdapolsp { } // histos.fill(HIST("hCentrality1"), centrality); - if (additionalEvSel && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { + if (evselGrp.additionalEvSel && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { return; } // histos.fill(HIST("hCentrality2"), centrality); - // if (additionalEvSel2 && (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { - if (additionalEvSel2 && (collision.trackOccupancyInTimeRange() > cfgMaxOccupancy || collision.trackOccupancyInTimeRange() < cfgMinOccupancy)) { + // if (evselGrp.additionalEvSel2 && (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { + if (evselGrp.additionalEvSel2 && (collision.trackOccupancyInTimeRange() > evselGrp.cfgMaxOccupancy || collision.trackOccupancyInTimeRange() < evselGrp.cfgMinOccupancy)) { return; } // histos.fill(HIST("hCentrality3"), centrality); - if (additionalEvSel3 && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { + if (evselGrp.additionalEvSel3 && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { return; } - if (additionalEvSel4 && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + if (evselGrp.additionalEvSel4 && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { return; } @@ -886,11 +908,6 @@ struct lambdapolsp { auto psiZDCC = collision.psiZDCC(); auto psiZDCA = collision.psiZDCA(); - double modqxZDCA; - double modqyZDCA; - double modqxZDCC; - double modqyZDCC; - if (cqvas) { modqxZDCA = TMath::Sqrt((qxZDCA * qxZDCA) + (qyZDCA * qyZDCA)) * TMath::Cos(psiZDCA); modqyZDCA = TMath::Sqrt((qxZDCA * qxZDCA) + (qyZDCA * qyZDCA)) * TMath::Sin(psiZDCA); @@ -911,18 +928,20 @@ struct lambdapolsp { histos.fill(HIST("hCentrality"), centrality); if (!checkwithpub) { // histos.fill(HIST("hVtxZ"), collision.posZ()); - histos.fill(HIST("hpRes"), centrality, (TMath::Cos(GetPhiInRange(psiZDCA - psiZDCC)))); - if (randGrp.useSP) + if (randGrp.useSP) { histos.fill(HIST("hpRes"), centrality, ((modqxZDCA * modqxZDCC) + (modqyZDCA * modqyZDCC))); - // histos.fill(HIST("hpResSin"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA - psiZDCC)))); - /*histos.fill(HIST("hpCosPsiA"), centrality, (TMath::Cos(GetPhiInRange(psiZDCA)))); - histos.fill(HIST("hpCosPsiC"), centrality, (TMath::Cos(GetPhiInRange(psiZDCC)))); - histos.fill(HIST("hpSinPsiA"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA)))); - histos.fill(HIST("hpSinPsiC"), centrality, (TMath::Sin(GetPhiInRange(psiZDCC))));*/ - /*histos.fill(HIST("hcentQxZDCA"), centrality, qxZDCA); - histos.fill(HIST("hcentQyZDCA"), centrality, qyZDCA); - histos.fill(HIST("hcentQxZDCC"), centrality, qxZDCC); - histos.fill(HIST("hcentQyZDCC"), centrality, qyZDCC);*/ + // histos.fill(HIST("hpResSin"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA - psiZDCC)))); + /*histos.fill(HIST("hpCosPsiA"), centrality, (TMath::Cos(GetPhiInRange(psiZDCA)))); + histos.fill(HIST("hpCosPsiC"), centrality, (TMath::Cos(GetPhiInRange(psiZDCC)))); + histos.fill(HIST("hpSinPsiA"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA)))); + histos.fill(HIST("hpSinPsiC"), centrality, (TMath::Sin(GetPhiInRange(psiZDCC))));*/ + histos.fill(HIST("hcentQxZDCA"), centrality, modqxZDCA); + histos.fill(HIST("hcentQyZDCA"), centrality, modqyZDCA); + histos.fill(HIST("hcentQxZDCC"), centrality, modqxZDCC); + histos.fill(HIST("hcentQyZDCC"), centrality, modqyZDCC); + } else { + histos.fill(HIST("hpRes"), centrality, (TMath::Cos(GetPhiInRange(psiZDCA - psiZDCC)))); + } } ///////////checking v1//////////////////////////////// @@ -1301,20 +1320,20 @@ struct lambdapolsp { return; } - if (additionalEvSel && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { + if (evselGrp.additionalEvSel && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { return; } // histos.fill(HIST("hCentrality2"), centrality); - // if (additionalEvSel2 && (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { - if (additionalEvSel2 && (collision.trackOccupancyInTimeRange() > cfgMaxOccupancy || collision.trackOccupancyInTimeRange() < cfgMinOccupancy)) { + // if (evselGrp.additionalEvSel2 && (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { + if (evselGrp.additionalEvSel2 && (collision.trackOccupancyInTimeRange() > evselGrp.cfgMaxOccupancy || collision.trackOccupancyInTimeRange() < evselGrp.cfgMinOccupancy)) { return; } // histos.fill(HIST("hCentrality3"), centrality); - if (additionalEvSel3 && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { + if (evselGrp.additionalEvSel3 && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { return; } - if (additionalEvSel4 && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + if (evselGrp.additionalEvSel4 && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { return; } @@ -1344,10 +1363,10 @@ struct lambdapolsp { auto qyZDCC = collision.qyZDCC(); auto psiZDCC = collision.psiZDCC(); auto psiZDCA = collision.psiZDCA(); - double modqxZDCA; + /*double modqxZDCA; double modqyZDCA; double modqxZDCC; - double modqyZDCC; + double modqyZDCC;*/ if (cqvas) { modqxZDCA = TMath::Sqrt((qxZDCA * qxZDCA) + (qyZDCA * qyZDCA)) * TMath::Cos(psiZDCA); @@ -1367,12 +1386,20 @@ struct lambdapolsp { histos.fill(HIST("hCentrality"), centrality); if (!checkwithpub) { // histos.fill(HIST("hVtxZ"), collision.posZ()); - histos.fill(HIST("hpRes"), centrality, (TMath::Cos(GetPhiInRange(psiZDCA - psiZDCC)))); - // histos.fill(HIST("hpResSin"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA - psiZDCC)))); - /*histos.fill(HIST("hpCosPsiA"), centrality, (TMath::Cos(GetPhiInRange(psiZDCA)))); - histos.fill(HIST("hpCosPsiC"), centrality, (TMath::Cos(GetPhiInRange(psiZDCC)))); - histos.fill(HIST("hpSinPsiA"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA)))); - histos.fill(HIST("hpSinPsiC"), centrality, (TMath::Sin(GetPhiInRange(psiZDCC))));*/ + if (randGrp.useSP) { + histos.fill(HIST("hpRes"), centrality, ((modqxZDCA * modqxZDCC) + (modqyZDCA * modqyZDCC))); + // histos.fill(HIST("hpResSin"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA - psiZDCC)))); + /*histos.fill(HIST("hpCosPsiA"), centrality, (TMath::Cos(GetPhiInRange(psiZDCA)))); + histos.fill(HIST("hpCosPsiC"), centrality, (TMath::Cos(GetPhiInRange(psiZDCC)))); + histos.fill(HIST("hpSinPsiA"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA)))); + histos.fill(HIST("hpSinPsiC"), centrality, (TMath::Sin(GetPhiInRange(psiZDCC))));*/ + histos.fill(HIST("hcentQxZDCA"), centrality, modqxZDCA); + histos.fill(HIST("hcentQyZDCA"), centrality, modqyZDCA); + histos.fill(HIST("hcentQxZDCC"), centrality, modqxZDCC); + histos.fill(HIST("hcentQyZDCC"), centrality, modqyZDCC); + } else { + histos.fill(HIST("hpRes"), centrality, (TMath::Cos(GetPhiInRange(psiZDCA - psiZDCC)))); + } } //___________________________________________________________________________________________________ @@ -1562,18 +1589,18 @@ struct lambdapolsp { double centrality = -999.; centrality = collision.centFT0C(); - if (additionalEvSel && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { + if (evselGrp.additionalEvSel && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { return; } - if (additionalEvSel2 && (collision.trackOccupancyInTimeRange() > cfgMaxOccupancy || collision.trackOccupancyInTimeRange() < cfgMinOccupancy)) { + if (evselGrp.additionalEvSel2 && (collision.trackOccupancyInTimeRange() > evselGrp.cfgMaxOccupancy || collision.trackOccupancyInTimeRange() < evselGrp.cfgMinOccupancy)) { return; } - if (additionalEvSel3 && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { + if (evselGrp.additionalEvSel3 && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { return; } - if (additionalEvSel4 && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + if (evselGrp.additionalEvSel4 && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { return; } @@ -1722,28 +1749,28 @@ struct lambdapolsp { continue; } - if (additionalEvSel && (!collision1.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { + if (evselGrp.additionalEvSel && (!collision1.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { continue; } - if (additionalEvSel && (!collision2.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { + if (evselGrp.additionalEvSel && (!collision2.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { continue; } - if (additionalEvSel2 && (collision1.trackOccupancyInTimeRange() > cfgMaxOccupancy || collision1.trackOccupancyInTimeRange() < cfgMinOccupancy)) { + if (evselGrp.additionalEvSel2 && (collision1.trackOccupancyInTimeRange() > evselGrp.cfgMaxOccupancy || collision1.trackOccupancyInTimeRange() < evselGrp.cfgMinOccupancy)) { continue; } - if (additionalEvSel2 && (collision2.trackOccupancyInTimeRange() > cfgMaxOccupancy || collision2.trackOccupancyInTimeRange() < cfgMinOccupancy)) { + if (evselGrp.additionalEvSel2 && (collision2.trackOccupancyInTimeRange() > evselGrp.cfgMaxOccupancy || collision2.trackOccupancyInTimeRange() < evselGrp.cfgMinOccupancy)) { continue; } - if (additionalEvSel3 && (!collision1.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision1.selection_bit(aod::evsel::kNoITSROFrameBorder))) { + if (evselGrp.additionalEvSel3 && (!collision1.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision1.selection_bit(aod::evsel::kNoITSROFrameBorder))) { continue; } - if (additionalEvSel3 && (!collision2.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision2.selection_bit(aod::evsel::kNoITSROFrameBorder))) { + if (evselGrp.additionalEvSel3 && (!collision2.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision2.selection_bit(aod::evsel::kNoITSROFrameBorder))) { continue; } - if (additionalEvSel4 && !collision1.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + if (evselGrp.additionalEvSel4 && !collision1.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { continue; } - if (additionalEvSel4 && !collision2.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + if (evselGrp.additionalEvSel4 && !collision2.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { continue; } @@ -1857,28 +1884,28 @@ struct lambdapolsp { continue; } - if (additionalEvSel && (!collision1.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { + if (evselGrp.additionalEvSel && (!collision1.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { continue; } - if (additionalEvSel && (!collision2.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { + if (evselGrp.additionalEvSel && (!collision2.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { continue; } - if (additionalEvSel2 && (collision1.trackOccupancyInTimeRange() > cfgMaxOccupancy || collision1.trackOccupancyInTimeRange() < cfgMinOccupancy)) { + if (evselGrp.additionalEvSel2 && (collision1.trackOccupancyInTimeRange() > evselGrp.cfgMaxOccupancy || collision1.trackOccupancyInTimeRange() < evselGrp.cfgMinOccupancy)) { continue; } - if (additionalEvSel2 && (collision2.trackOccupancyInTimeRange() > cfgMaxOccupancy || collision2.trackOccupancyInTimeRange() < cfgMinOccupancy)) { + if (evselGrp.additionalEvSel2 && (collision2.trackOccupancyInTimeRange() > evselGrp.cfgMaxOccupancy || collision2.trackOccupancyInTimeRange() < evselGrp.cfgMinOccupancy)) { continue; } - if (additionalEvSel3 && (!collision1.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision1.selection_bit(aod::evsel::kNoITSROFrameBorder))) { + if (evselGrp.additionalEvSel3 && (!collision1.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision1.selection_bit(aod::evsel::kNoITSROFrameBorder))) { continue; } - if (additionalEvSel3 && (!collision2.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision2.selection_bit(aod::evsel::kNoITSROFrameBorder))) { + if (evselGrp.additionalEvSel3 && (!collision2.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision2.selection_bit(aod::evsel::kNoITSROFrameBorder))) { continue; } - if (additionalEvSel4 && !collision1.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + if (evselGrp.additionalEvSel4 && !collision1.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { continue; } - if (additionalEvSel4 && !collision2.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + if (evselGrp.additionalEvSel4 && !collision2.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { continue; } auto centrality = collision1.centFT0C(); From 403fe6c0034fa73cbcf4f49b4aa6c6b1345df7f0 Mon Sep 17 00:00:00 2001 From: nkaratze Date: Sat, 25 Oct 2025 23:07:59 +0200 Subject: [PATCH 894/986] [PWGLF] Signal Split Correction and Small Changes (#13551) Co-authored-by: nkaratze --- PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx | 92 ++++++++++++++------ 1 file changed, 63 insertions(+), 29 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx b/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx index c5494975dd2..fb8fe6a7f21 100644 --- a/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx +++ b/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx @@ -48,6 +48,9 @@ std::vector> lambdaPt; static std::vector lambdaPtBins; std::vector> antilambdaPt; static std::vector antilambdaPtBins; +std::vector> kaonSplit; +std::vector> lambdaSplit; +std::vector> antilambdaSplit; } // namespace pthistos using namespace o2; using namespace o2::framework; @@ -60,6 +63,9 @@ struct V0PtInvMassPlots { HistogramRegistry rKaonshMassPlotsPerPtBin{"KaonshMassPlotsPerPtBin", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry rLambdaMassPlotsPerPtBin{"LambdaMassPlotsPerPtBin", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry rAntilambdaMassPlotsPerPtBin{"AntilambdaMassPlotsPerPtBin", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry rKaonshSplitMassPlotsPerPtBin{"KaonshSplitMassPlotsPerPtBin", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry rLambdaSplitMassPlotsPerPtBin{"LambdaSplitMassPlotsPerPtBin", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry rAntilambdaSplitMassPlotsPerPtBin{"AntilambdaSplitMassPlotsPerPtBin", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry rFeeddownMatrices{"FeeddownMatrices", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry rMCCorrections{"MCCorrections", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; @@ -169,9 +175,12 @@ struct V0PtInvMassPlots { void init(InitContext const&) { - pthistos::kaonPt.resize(nmaxHistograms); // number of Kaon Pt histograms to expect - pthistos::lambdaPt.resize(nmaxHistograms); // number of Lambda histograms to expect - pthistos::antilambdaPt.resize(nmaxHistograms); // number of Antilambda histograms to expect + pthistos::kaonPt.resize(nmaxHistograms); // number of Kaon Pt histograms to expect + pthistos::lambdaPt.resize(nmaxHistograms); // number of Lambda histograms to expect + pthistos::antilambdaPt.resize(nmaxHistograms); // number of Antilambda histograms to expect + pthistos::kaonSplit.resize(nmaxHistograms); // number of Kaon Split Pt histograms to expect + pthistos::lambdaSplit.resize(nmaxHistograms); // number of Lambda Split Pt histograms to expect + pthistos::antilambdaSplit.resize(nmaxHistograms); // number of Antilambda Split Pt histograms to expect // tokenise strings into individual values pthistos::kaonPtBins = o2::utils::Str::tokenize(kzeroSettingPtBinsString, ','); pthistos::lambdaPtBins = o2::utils::Str::tokenize(lambdaSettingPtBinsString, ','); @@ -202,7 +211,7 @@ struct V0PtInvMassPlots { std::vector kaonhistvalue(nmaxHistograms + 1); std::vector lambdahistvalue(nmaxHistograms + 1); std::vector antilambdahistvalue(nmaxHistograms + 1); - // K0short Histogram Pt Bin Edges + // K0short Histogram Pt Bin Edges (and Split) for (int i = 0; i < nmaxHistograms + 1; i++) { // Histos won't accept "." character so converting it to "_" std::string kaonptbin = pthistos::kaonPtBins[i]; // getting the value of the bin edge size_t pos = kaonptbin.find("."); // finding the "." character @@ -249,6 +258,7 @@ struct V0PtInvMassPlots { rPtAnalysis.add("hK0shDCANegDaughter", "hK0shDCANegDaughter", {HistType::kTH1F, {{nBins, 0.0f, 2.2f}}}); for (int i = 0; i < nmaxHistograms; i++) { pthistos::kaonPt[i] = rKaonshMassPlotsPerPtBin.add(fmt::format("hPt_from_{0}_to_{1}", kaonhistvalue[i], kaonhistvalue[i + 1]).c_str(), fmt::format("hPt_from_{0}_to_{1}", kaonhistvalue[i], kaonhistvalue[i + 1]).c_str(), {HistType::kTH1D, {{k0ShortMassAxis}}}); + pthistos::kaonSplit[i] = rKaonshSplitMassPlotsPerPtBin.add(fmt::format("hPt_from_{0}_to_{1}", kaonhistvalue[i], kaonhistvalue[i + 1]).c_str(), fmt::format("hPt_from_{0}_to_{1}", kaonhistvalue[i], kaonhistvalue[i + 1]).c_str(), {HistType::kTH1D, {{k0ShortMassAxis}}}); } rFeeddownMatrices.add("hK0shFeeddownMatrix", "hK0shFeeddownMatrix", {HistType::kTH2F, {{k0ShortPtAxis}, {k0ShortPtAxis}}}); rFeeddownMatrices.add("hK0shPhiFeeddownMatrix", "hK0shPhiFeeddownMatrix", {HistType::kTH2F, {{k0ShortPtAxis}, {k0ShortPtAxis}}}); @@ -268,6 +278,7 @@ struct V0PtInvMassPlots { rPtAnalysis.add("hLambdaDCANegDaughter", "hLambdaDCANegDaughter", {HistType::kTH1F, {{nBins, 0.0f, 2.2f}}}); for (int i = 0; i < nmaxHistograms; i++) { pthistos::lambdaPt[i] = rLambdaMassPlotsPerPtBin.add(fmt::format("hPt_from_{0}_to_{1}", lambdahistvalue[i], lambdahistvalue[i + 1]).c_str(), fmt::format("hPt_from_{0}_to_{1}", lambdahistvalue[i], lambdahistvalue[i + 1]).c_str(), {HistType::kTH1D, {{lambdaMassAxis}}}); + pthistos::lambdaSplit[i] = rLambdaSplitMassPlotsPerPtBin.add(fmt::format("hPt_from_{0}_to_{1}", lambdahistvalue[i], lambdahistvalue[i + 1]).c_str(), fmt::format("hPt_from_{0}_to_{1}", lambdahistvalue[i], lambdahistvalue[i + 1]).c_str(), {HistType::kTH1D, {{lambdaMassAxis}}}); } // lambdafeeddown matrices rFeeddownMatrices.add("hLambdaFeeddownMatrix", "hLambdaFeeddownMatrix", {HistType::kTH2F, {{lambdaPtAxis}, {lambdaPtAxis}}}); @@ -290,6 +301,7 @@ struct V0PtInvMassPlots { rPtAnalysis.add("hAntilambdaDCANegDaughter", "hAntilambdaDCANegDaughter", {HistType::kTH1F, {{nBins, 0.0f, 2.2f}}}); for (int i = 0; i < nmaxHistograms; i++) { pthistos::antilambdaPt[i] = rAntilambdaMassPlotsPerPtBin.add(fmt::format("hPt_from_{0}_to_{1}", antilambdahistvalue[i], antilambdahistvalue[i + 1]).c_str(), fmt::format("hPt_from_{0}_to_{1}", antilambdahistvalue[i], antilambdahistvalue[i + 1]).c_str(), {HistType::kTH1D, {{antiLambdaMassAxis}}}); + pthistos::antilambdaSplit[i] = rAntilambdaSplitMassPlotsPerPtBin.add(fmt::format("hPt_from_{0}_to_{1}", antilambdahistvalue[i], antilambdahistvalue[i + 1]).c_str(), fmt::format("hPt_from_{0}_to_{1}", antilambdahistvalue[i], antilambdahistvalue[i + 1]).c_str(), {HistType::kTH1D, {{antiLambdaMassAxis}}}); } // antilambdafeeddown matrices rFeeddownMatrices.add("hAntiLambdaFeeddownMatrix", "hAntiLambdaFeeddownMatrix", {HistType::kTH2F, {{antilambdaPtAxis}, {antilambdaPtAxis}}}); @@ -299,12 +311,7 @@ struct V0PtInvMassPlots { } // Particle Level Corrections - rMCCorrections.add("hK0ShSplitDenominatorPtSpectrum", "hK0ShSplitDenominatorPtSpectrum", {HistType::kTH1D, {k0ShortPtAxis}}); - rMCCorrections.add("hLambdaSplitDenominatorPtSpectrum", "hLambdaSplitDenominatorPtSpectrum", {HistType::kTH1D, {lambdaPtAxis}}); - rMCCorrections.add("hAntilambdaSplitDenominatorPtSpectrum", "hAntilambdaSplitDenominatorPtSpectrum", {HistType::kTH1F, {{antilambdaPtAxis}}}); - rMCCorrections.add("hK0ShSplitNumenatorPtSpectrum", "hK0ShSplitNumenatorPtSpectrum", {HistType::kTH1D, {k0ShortPtAxis}}); - rMCCorrections.add("hLambdaSplitNumenatorPtSpectrum", "hLambdaSplitNumenatorPtSpectrum", {HistType::kTH1D, {lambdaPtAxis}}); - rMCCorrections.add("hAntilambdaSplitNumenatorPtSpectrum", "hAntilambdaSplitNumenatorPtSpectrum", {HistType::kTH1F, {{antilambdaPtAxis}}}); + rMCCorrections.add("hK0ShNoMCParticle", "hK0ShNoMCParticle", {HistType::kTH1D, {k0ShortPtAxis}}); rMCCorrections.add("hK0ShBeforeEventSelectionPtSpectrum", "hK0ShBeforeEventSelectionPtSpectrum", {HistType::kTH1D, {k0ShortPtAxis}}); rMCCorrections.add("hLambdaBeforeEventSelectionPtSpectrum", "hLambdaBeforeEventSelectionPtSpectrum", {HistType::kTH1D, {lambdaPtAxis}}); rMCCorrections.add("hAntilambdaBeforeEventSelectionPtSpectrum", "hAntilambdaBeforeEventSelectionPtSpectrum", {HistType::kTH1F, {{antilambdaPtAxis}}}); @@ -771,6 +778,7 @@ struct V0PtInvMassPlots { pthistos::kaonPtBins = o2::utils::Str::tokenize(kzeroSettingPtBinsString, ','); pthistos::lambdaPtBins = o2::utils::Str::tokenize(lambdaSettingPtBinsString, ','); pthistos::antilambdaPtBins = o2::utils::Str::tokenize(antilambdaSettingPtBinsString, ','); + pthistos::kaonPtBins = o2::utils::Str::tokenize(kzeroSettingPtBinsString, ','); // initialize and convert tokenized strings into vector of doubles for Pt Bin Edges std::vector kaonptedgevalues(nmaxHistograms + 1); @@ -789,16 +797,22 @@ struct V0PtInvMassPlots { for (const auto& v0 : V0s) { // Checking that the V0 is a true K0s/Lambdas/Antilambdas and then filling the parameter histograms and the invariant mass plots for different cuts (which are taken from namespace) - if (v0.has_mcParticle()) { - auto v0mcParticle = v0.mcParticle(); - - if (!acceptV0(v0)) { // V0 Selections - continue; - } - // kzero analysis - if (kzeroAnalysis == true) { - if (dotruthk0sh && (v0mcParticle.pdgCode() == kK0Short)) { // kzero matched - if (acceptK0sh(v0)) { // K0sh Selection + if (!acceptV0(v0)) { // V0 Selections + continue; + } + // kzero analysis + if (kzeroAnalysis == true) { + if (acceptK0sh(v0)) { // K0sh Selection + // K0sh Signal Split Numerator Start + for (int i = 0; i < nmaxHistograms; i++) { + if (kaonptedgevalues[i] <= v0.pt() && v0.pt() < kaonptedgevalues[i + 1]) { // finding v0s with pt within the range of our bin edges for K0sh Splitting Numerator + pthistos::kaonSplit[i]->Fill(v0.mK0Short()); // filling the k0s namespace histograms for K0sh Splitting Numerator + } + } + // K0sh Signla Split Numerator End + if (v0.has_mcParticle()) { + auto v0mcParticle = v0.mcParticle(); + if (dotruthk0sh && (v0mcParticle.pdgCode() == kK0Short)) { // kzero matched if (v0mcParticle.isPhysicalPrimary()) { for (int i = 0; i < nmaxHistograms; i++) { if (kaonptedgevalues[i] <= v0.pt() && v0.pt() < kaonptedgevalues[i + 1]) { // finding v0s with pt within the range of our bin edges @@ -819,10 +833,20 @@ struct V0PtInvMassPlots { } } } - // lambda analysis - if (lambdaAnalysis == true) { - if (dotruthLambda && (v0mcParticle.pdgCode() == kLambda0)) { // lambda matched - if (acceptLambda(v0)) { // Lambda Selections + } + // lambda analysis + if (lambdaAnalysis == true) { + if (acceptLambda(v0)) { // Lambda Selections + // Lambda Signal Split Numerator Start + for (int i = 0; i < nmaxHistograms; i++) { + if (lambdaptedgevalues[i] <= v0.pt() && v0.pt() < lambdaptedgevalues[i + 1]) { + pthistos::lambdaSplit[i]->Fill(v0.mLambda()); + } + } + // Lambda Signal Split Numerator End + if (v0.has_mcParticle()) { + auto v0mcParticle = v0.mcParticle(); + if (dotruthLambda && (v0mcParticle.pdgCode() == kLambda0)) { // lambda matched if (v0mcParticle.isPhysicalPrimary()) { for (int i = 0; i < nmaxHistograms; i++) { if (lambdaptedgevalues[i] <= v0.pt() && v0.pt() < lambdaptedgevalues[i + 1]) { @@ -849,10 +873,20 @@ struct V0PtInvMassPlots { } } } - // antilambda analysis - if (antiLambdaAnalysis == true) { - if (dotruthAntilambda && (v0mcParticle.pdgCode() == kLambda0Bar)) { // antilambda matched - if (acceptAntilambda(v0)) { // Antilambda Selections + } + // antilambda analysis + if (antiLambdaAnalysis == true) { + if (acceptAntilambda(v0)) { // Antilambda Selections + // Antilambda Signal Split Numerator End + for (int i = 0; i < nmaxHistograms; i++) { + if (antilambdaPtedgevalues[i] <= v0.pt() && v0.pt() < antilambdaPtedgevalues[i + 1]) { + pthistos::antilambdaSplit[i]->Fill(v0.mAntiLambda()); + } + } + // Antilambda Signal Split Numerator End + if (v0.has_mcParticle()) { + auto v0mcParticle = v0.mcParticle(); + if (dotruthAntilambda && (v0mcParticle.pdgCode() == kLambda0Bar)) { // antilambda matched if (v0mcParticle.isPhysicalPrimary()) { for (int i = 0; i < nmaxHistograms; i++) { if (antilambdaPtedgevalues[i] <= v0.pt() && v0.pt() < antilambdaPtedgevalues[i + 1]) { @@ -904,7 +938,7 @@ struct V0PtInvMassPlots { if (!acceptEvent(collision)) { // Event Selection return; } - rPtAnalysis.fill(HIST("hNRecEvents_Data"), 1.0); // Number of Reconstructed Events + rPtAnalysis.fill(HIST("hNRecEvents_Data"), 0.5); // Number of Reconstructed Events for (const auto& v0 : V0s) { // Checking that the V0 is a true K0s/Lambdas/Antilambdas and then filling the parameter histograms and the invariant mass plots for different cuts (which are taken from namespace) From aa898352bbb2742804c0d04a519e68564ea267f0 Mon Sep 17 00:00:00 2001 From: Shirajum Monira <38348689+Eloviyo@users.noreply.github.com> Date: Sun, 26 Oct 2025 00:19:01 +0200 Subject: [PATCH 895/986] [PWGCF] FemtoUniverse v0 task -- implemented strangenessTOF for V0 analysis (#13552) Co-authored-by: Shirajum Monira --- .../femtoUniverseProducerTask.cxx | 79 ++++++++++++++----- 1 file changed, 60 insertions(+), 19 deletions(-) diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx index 6f4ee10f054..c2f12957f0e 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx @@ -479,14 +479,39 @@ struct FemtoUniverseProducerTask { } template - using hasStrangeTOF = decltype(std::declval().tofNSigmaXiLaPi()); + using hasStrangeTOFinV0 = decltype(std::declval().tofNSigmaLaPr()); + + /// bitmask to save strangeness TOF for V0 analysis + template + aod::femtouniverseparticle::CutContainerType PIDStrangeTOFBitmaskV0(const V0Type& v0) + { + aod::femtouniverseparticle::CutContainerType mask = 0u; + if constexpr (std::experimental::is_detected::value) { + if (v0.tofNSigmaLaPr() < ConfPIDBitmask.confNsigmaTOFParticleChild) + mask |= (1u); + if (v0.tofNSigmaLaPi() < ConfPIDBitmask.confNsigmaTOFParticleChild) + mask |= (2u); + if (v0.tofNSigmaALaPr() < ConfPIDBitmask.confNsigmaTOFParticleChild) + mask |= (4u); + if (v0.tofNSigmaALaPi() < ConfPIDBitmask.confNsigmaTOFParticleChild) + mask |= (8u); + if (v0.tofNSigmaK0PiPlus() < ConfPIDBitmask.confNsigmaTOFParticleChild) + mask |= (16u); + if (v0.tofNSigmaK0PiMinus() < ConfPIDBitmask.confNsigmaTOFParticleChild) + mask |= (32u); + } + return mask; + } + + template + using hasStrangeTOFinCasc = decltype(std::declval().tofNSigmaXiLaPi()); /// bitmask to save strangeness TOF for cascade analysis template - aod::femtouniverseparticle::CutContainerType PIDStrangeTOFBitmask(const CascType& casc) + aod::femtouniverseparticle::CutContainerType PIDStrangeTOFBitmaskCasc(const CascType& casc) { aod::femtouniverseparticle::CutContainerType mask = 0u; - if constexpr (std::experimental::is_detected::value) { + if constexpr (std::experimental::is_detected::value) { if (casc.tofNSigmaXiLaPi() < ConfPIDBitmask.confNsigmaTOFParticleChild) mask |= (1u); if (casc.tofNSigmaXiLaPr() < ConfPIDBitmask.confNsigmaTOFParticleChild) @@ -718,18 +743,34 @@ struct FemtoUniverseProducerTask { void fillDebugParticle(ParticleType const& particle) { if constexpr (isTrackOrV0) { - outputDebugParts(particle.sign(), (uint8_t)particle.tpcNClsFound(), - particle.tpcNClsFindable(), - (uint8_t)particle.tpcNClsCrossedRows(), - particle.tpcNClsShared(), particle.tpcFractionSharedCls(), particle.tpcInnerParam(), - particle.itsNCls(), particle.itsNClsInnerBarrel(), - particle.dcaXY(), particle.dcaZ(), particle.tpcSignal(), - particle.tpcNSigmaStoreEl(), particle.tpcNSigmaStorePi(), - particle.tpcNSigmaStoreKa(), particle.tpcNSigmaStorePr(), - particle.tpcNSigmaStoreDe(), particle.tofNSigmaStoreEl(), - particle.tofNSigmaStorePi(), particle.tofNSigmaStoreKa(), - particle.tofNSigmaStorePr(), particle.tofNSigmaStoreDe(), - -999., -999., -999., -999., -999., -999.); + if constexpr (std::experimental::is_detected::value) { + outputDebugParts(particle.sign(), (uint8_t)particle.tpcNClsFound(), + particle.tpcNClsFindable(), + (uint8_t)particle.tpcNClsCrossedRows(), + particle.tpcNClsShared(), particle.tpcFractionSharedCls(), particle.tpcInnerParam(), + particle.itsNCls(), particle.itsNClsInnerBarrel(), + particle.dcaXY(), particle.dcaZ(), particle.tpcSignal(), + particle.tpcNSigmaStoreEl(), particle.tpcNSigmaStorePi(), + particle.tpcNSigmaStoreKa(), particle.tpcNSigmaStorePr(), + particle.tpcNSigmaStoreDe(), particle.tofNSigmaStoreEl(), + particle.tofNSigmaStorePi(), particle.tofNSigmaStoreKa(), + particle.tofNSigmaStorePr(), particle.tofNSigmaStoreDe(), + particle.tofNSigmaLaPr(), particle.tofNSigmaLaPi(), particle.tofNSigmaALaPr(), + particle.tofNSigmaALaPi(), particle.tofNSigmaK0PiPlus(), particle.tofNSigmaK0PiMinus()); + } else { + outputDebugParts(particle.sign(), (uint8_t)particle.tpcNClsFound(), + particle.tpcNClsFindable(), + (uint8_t)particle.tpcNClsCrossedRows(), + particle.tpcNClsShared(), particle.tpcFractionSharedCls(), particle.tpcInnerParam(), + particle.itsNCls(), particle.itsNClsInnerBarrel(), + particle.dcaXY(), particle.dcaZ(), particle.tpcSignal(), + particle.tpcNSigmaStoreEl(), particle.tpcNSigmaStorePi(), + particle.tpcNSigmaStoreKa(), particle.tpcNSigmaStorePr(), + particle.tpcNSigmaStoreDe(), particle.tofNSigmaStoreEl(), + particle.tofNSigmaStorePi(), particle.tofNSigmaStoreKa(), + particle.tofNSigmaStorePr(), particle.tofNSigmaStoreDe(), + -999., -999., -999., -999., -999., -999.); + } } else if constexpr (isPhiOrD0) { outputDebugParts(-999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., @@ -738,7 +779,7 @@ struct FemtoUniverseProducerTask { -999., -999., -999., -999.); // QA for phi or D0/D0bar children } else if constexpr (isCasc) { - if constexpr (std::experimental::is_detected::value) { + if constexpr (std::experimental::is_detected::value) { outputDebugParts(-999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., particle.tofNSigmaXiLaPi(), particle.tofNSigmaXiLaPr(), particle.tofNSigmaXiPi(), particle.tofNSigmaOmLaPi(), @@ -1277,7 +1318,7 @@ struct FemtoUniverseProducerTask { v0.phi(), aod::femtouniverseparticle::ParticleType::kV0, cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kV0), - 0, + PIDStrangeTOFBitmaskV0(v0), v0.v0cosPA(), indexChildID, v0.mLambda(), @@ -1489,7 +1530,7 @@ struct FemtoUniverseProducerTask { casc.phi(), aod::femtouniverseparticle::ParticleType::kCascade, 0, - PIDStrangeTOFBitmask(casc), + PIDStrangeTOFBitmaskCasc(casc), 0, indexCascChildID, casc.mXi(), @@ -2311,7 +2352,7 @@ struct FemtoUniverseProducerTask { void processTrackV0Cascade(aod::FemtoFullCollision const& col, aod::BCsWithTimestamps const&, soa::Filtered const& tracks, - o2::aod::V0Datas const& fullV0s, + soa::Join const& fullV0s, soa::Join const& fullCascades) { getMagneticFieldTesla(col.bc_as()); From fe637c499828efddc05aab1add1db225b5b2fb58 Mon Sep 17 00:00:00 2001 From: JStaa <39123272+JStaa@users.noreply.github.com> Date: Sun, 26 Oct 2025 01:28:59 +0200 Subject: [PATCH 896/986] [PWGCF] Changed the Zvtx-cut parameter to a configurable (#13547) Co-authored-by: ALICE Action Bot --- .../Tasks/threeParticleCorrelations.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx b/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx index dabfe3205af..590aa8adcf9 100644 --- a/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx +++ b/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx @@ -41,12 +41,13 @@ struct ThreeParticleCorrelations { // Analysis parameters float centMin = 0.0, centMax = 90.0; - float zvtxMax = 10.0; float v0PtMin = 0.6, v0PtMax = 12.0; float v0EtaMax = 0.72; float trackPtMin = 0.2, trackPtMax = 3.0; float trackEtaMax = 0.8; + Configurable zvtxMax{"zvtxMax", 10.0, "Maximum collision Z-vertex position (cm)"}; + // Track PID parameters double pionID = 0.0, kaonID = 1.0, protonID = 2.0; float nSigma0 = 0.0, nSigma1 = 1.0, nSigma2 = 2.0, nSigma4 = 4.0, nSigma5 = 5.0; @@ -126,7 +127,7 @@ struct ThreeParticleCorrelations { PresliceUnsorted perMCCol = aod::mccollisionlabel::mcCollisionId; ConfigurableAxis confCentBins{"confCentBins", {VARIABLE_WIDTH, 0.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f}, "ME Centrality binning"}; - ConfigurableAxis confZvtxBins{"confZvtxBins", {VARIABLE_WIDTH, -10.0f, -8.0f, -6.0f, -4.0f, -2.0, 0.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f}, "ME Zvtx binning"}; + ConfigurableAxis confZvtxBins{"confZvtxBins", {VARIABLE_WIDTH, -10.0f, -8.0f, -6.0f, -4.0f, -2.0f, 0.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f}, "ME Zvtx binning"}; using BinningType = ColumnBinningPolicy; using BinningTypeMC = ColumnBinningPolicy; From a86c71839a476bbe2b83a5822972eab4992eac72 Mon Sep 17 00:00:00 2001 From: alcaliva <32872606+alcaliva@users.noreply.github.com> Date: Sun, 26 Oct 2025 01:30:07 +0200 Subject: [PATCH 897/986] [PWGLF] Move Preslice definitions inside analysis struct (#13553) --- PWGLF/Tasks/Nuspex/antinucleiInJets.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx index 2c7885f1292..4e3d108d84a 100644 --- a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx +++ b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx @@ -85,10 +85,6 @@ using GenCollisionsMc = aod::McCollisions; using AntiNucleiTracks = soa::Join; using AntiNucleiTracksMc = soa::Join; -// Define preslices to group MC tracks and MC particles by their associated MC collision -Preslice mcTracksPerMcCollision = o2::aod::track::collisionId; -Preslice mcParticlesPerMcCollision = o2::aod::mcparticle::mcCollisionId; - struct AntinucleiInJets { // Histogram registries for data, MC, quality control, multiplicity and correlations @@ -1436,6 +1432,10 @@ struct AntinucleiInJets { } PROCESS_SWITCH(AntinucleiInJets, processQC, "Process QC", false); + // Define preslices to group MC tracks and MC particles by their associated MC collision + Preslice mcTracksPerMcCollision = o2::aod::track::collisionId; + Preslice mcParticlesPerMcCollision = o2::aod::mcparticle::mcCollisionId; + // Antinuclei reconstruction efficiency void processAntinucleiEfficiency(GenCollisionsMc const& genCollisions, RecCollisionsMc const& recCollisions, AntiNucleiTracksMc const& mcTracks, aod::McParticles const& mcParticles) { From 470a8612a7180772847e91f1464887860a875e65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Kr=C3=BCger?= <26876110+mario-krueger@users.noreply.github.com> Date: Sun, 26 Oct 2025 08:49:36 +0100 Subject: [PATCH 898/986] [PWGLF] use PCC in charged particle analysis (#13529) --- PWGLF/Tasks/Nuspex/chargedParticles.cxx | 105 ++++++++++++++++++------ 1 file changed, 80 insertions(+), 25 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/chargedParticles.cxx b/PWGLF/Tasks/Nuspex/chargedParticles.cxx index 42bbb437a89..9da546afd57 100644 --- a/PWGLF/Tasks/Nuspex/chargedParticles.cxx +++ b/PWGLF/Tasks/Nuspex/chargedParticles.cxx @@ -13,6 +13,8 @@ /// \brief Task for analysis of charged particle pt spectra vs multiplicity with 2d unfolding. /// \author Mario Krüger +#include "PWGLF/DataModel/particleCompositionCorrectionTable.h" + #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectionDefaults.h" #include "Common/DataModel/Centrality.h" @@ -25,6 +27,7 @@ #include #include +#include #include #include @@ -38,6 +41,19 @@ using aod::track::TrackSelectionFlags; //-------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------- struct ChargedParticles { + std::random_device rnd; + std::mt19937 gen{rnd()}; + std::uniform_real_distribution dist{0.f, 1.f}; + uint32_t getNRepetitons(float scalingFactor) + { + uint32_t nRepetitions = static_cast(scalingFactor); + float rest = scalingFactor - nRepetitions; + if (rest) { + nRepetitions += (dist(gen) <= rest) ? 1u : 0u; + // LOGP(info, "scalingFactor: {} -> {}", scalingFactor, nRepetitions); + } + return nRepetitions; + }; HistogramRegistry histos; Service pdg; @@ -62,9 +78,11 @@ struct ChargedParticles { kSystUpDCAxy, kSystDownDCAz, kSystUpDCAz, - kSystITSHits, + kSystITSHits, // only relevant for converted data kSystDownTPCCrossedRows, - kSystUpTPCCrossedRows + kSystUpTPCCrossedRows, + kSystDownPCC = 120, + kSystUpPCC }; Configurable systMode{"systMode", kSystNominal, "variation for systematic uncertainties"}; uint16_t trackSelMask{TrackSelectionFlags::kGlobalTrackWoPtEta}; // track selection bitmask (without cut that is being varied) @@ -80,6 +98,7 @@ struct ChargedParticles { bool isAcceptedEventMC{false}; bool isINELGT0EventMC{false}; bool isChargedPrimary{false}; + uint32_t nRepetitions{1u}; }; VarContainer vars; static constexpr float kMaxVtxZ = 10.f; @@ -92,7 +111,7 @@ struct ChargedParticles { template bool initTrack(const T& track); - template + template void initEvent(const C& collision, const T& tracks); template @@ -112,9 +131,9 @@ struct ChargedParticles { using CollisionTableMCTrue = aod::McCollisions; using CollisionTableMC = soa::SmallGroups>; using TrackTableMC = soa::Join; - using ParticleTableMC = aod::McParticles; + using ParticleTableMC = soa::Join; Preslice perCollision = aod::track::collisionId; - void processMC(CollisionTableMCTrue::iterator const& mcCollision, CollisionTableMC const& collisions, TrackTableMC const& tracks, ParticleTableMC const& particles); + void processMC(CollisionTableMCTrue::iterator const& mcCollision, TrackTableMC const& tracks, CollisionTableMC const& collisions, ParticleTableMC const& particles); PROCESS_SWITCH(ChargedParticles, processMC, "process mc", true); }; @@ -241,7 +260,7 @@ void ChargedParticles::init(InitContext const&) //************************************************************************************************** void ChargedParticles::processData(CollisionTableData::iterator const& collision, TrackTableData const& tracks) { - initEvent(collision, tracks); + initEvent(collision, tracks); processMeas(tracks); } @@ -250,7 +269,7 @@ void ChargedParticles::processData(CollisionTableData::iterator const& collision * Entrypoint to processes mc. */ //************************************************************************************************** -void ChargedParticles::processMC(CollisionTableMCTrue::iterator const& mcCollision, CollisionTableMC const& collisions, TrackTableMC const& tracks, ParticleTableMC const& particles) +void ChargedParticles::processMC(CollisionTableMCTrue::iterator const& mcCollision, TrackTableMC const& tracks, CollisionTableMC const& collisions, ParticleTableMC const& particles) { histos.fill(HIST("collision_ambiguity"), collisions.size()); @@ -270,7 +289,7 @@ void ChargedParticles::processMC(CollisionTableMCTrue::iterator const& mcCollisi } else { for (const auto& collision : collisions) { auto curTracks = tracks.sliceBy(perCollision, collision.globalIndex()); - initEvent(collision, curTracks); + initEvent(collision, curTracks); processMeas(curTracks); break; // for now look only at first collision... } @@ -302,6 +321,15 @@ bool ChargedParticles::initParticle(const P& particle) if (particle.pt() <= ptMinCut || particle.pt() >= ptMaxCut) { return false; } + + float pccWeight = particle.pccWeight(); + if (systMode == kSystDownPCC) { + pccWeight = particle.pccWeightSysDown(); + } else if (systMode == kSystUpPCC) { + pccWeight = particle.pccWeightSysUp(); + } + vars.nRepetitions = getNRepetitons(pccWeight); + // FIXME: in case of nRepetitions = 0 INELGT0 can be wrong return true; } @@ -334,20 +362,43 @@ bool ChargedParticles::initTrack(const T& track) * Check if event is good. */ //************************************************************************************************** -template +template void ChargedParticles::initEvent(const C& collision, const T& tracks) { vars.multMeas = 0; for (const auto& track : tracks) { if (initTrack(track)) { - ++vars.multMeas; + if constexpr (IS_MC) { + if (!track.has_mcParticle()) { + continue; + } + const auto& particle = track.template mcParticle_as(); + if (!initParticle(particle)) { + continue; + } + vars.multMeas += vars.nRepetitions; + } else { + ++vars.multMeas; + } } } vars.isAcceptedEvent = false; if (std::abs(collision.posZ()) < kMaxVtxZ) { - if (isRun3 ? collision.sel8() : collision.sel7()) { - if ((isRun3 || doprocessMC) ? true : collision.alias_bit(kINT7)) { + if (isRun3) { + if (collision.sel8() && + collision.selection_bit(aod::evsel::kNoSameBunchPileup) && + collision.selection_bit(aod::evsel::kIsVertexITSTPC) && + collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) + // !collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched) && + // collision.selection_bit(aod::evsel::kNoCollInTimeRangeStandard) && + // collision.selection_bit(aod::evsel::kNoCollInRofStandard) && + // collision.selection_bit(aod::evsel::kIsVertexTOFmatched) + { + vars.isAcceptedEvent = true; + } + } else { + if (collision.sel7() && ((doprocessMC) ? true : collision.alias_bit(kINT7))) { vars.isAcceptedEvent = true; } } @@ -368,7 +419,7 @@ void ChargedParticles::initEventMC(const C& collision, const P& particles) if (!initParticle(particle) || !vars.isChargedPrimary) { continue; } - ++vars.multTrue; + vars.multTrue += vars.nRepetitions; } bool isGoodEventClass = (normINELGT0) ? vars.isINELGT0EventMC : (vars.multTrue > 0); vars.isAcceptedEventMC = isGoodEventClass && (std::abs(collision.posZ()) < kMaxVtxZ); @@ -390,9 +441,11 @@ void ChargedParticles::processTrue(const P& particles) for (const auto& particle : particles) { if (initParticle(particle) && vars.isChargedPrimary) { - histos.fill(HIST("multPtSpec_prim_gen"), vars.multTrue, particle.pt()); - if (!vars.isAcceptedEvent) { - histos.fill(HIST("multPtSpec_prim_gen_evtloss"), vars.multTrue, particle.pt()); + for (auto i = 0u; i < vars.nRepetitions; ++i) { + histos.fill(HIST("multPtSpec_prim_gen"), vars.multTrue, particle.pt()); + if (!vars.isAcceptedEvent) { + histos.fill(HIST("multPtSpec_prim_gen_evtloss"), vars.multTrue, particle.pt()); + } } } } @@ -441,7 +494,7 @@ void ChargedParticles::processMeas(const T& tracks) foundParticles.push_back(track.mcParticleId()); - const auto& particle = track.template mcParticle_as(); + const auto& particle = track.template mcParticle_as(); if (!vars.isAcceptedEventMC) { histos.fill(HIST("multPtSpec_trk_meas_evtcont"), vars.multMeas, track.pt()); @@ -450,19 +503,21 @@ void ChargedParticles::processMeas(const T& tracks) histos.fill(HIST("multPtSpec_trk_inter"), vars.multTrue, track.pt()); if (initParticle(particle)) { - if (!vars.isChargedPrimary) { - histos.fill(HIST("multPtSpec_trk_sec_meas"), vars.multMeas, track.pt()); - } else { - histos.fill(HIST("multCorrel_prim"), vars.multMeas, vars.multTrue); - histos.fill(HIST("ptCorrel_prim"), track.pt(), particle.pt()); - histos.fill(HIST("multPtSpec_prim_meas"), vars.multTrue, particle.pt()); - histos.fill(HIST("multPtSpec_trk_prim_meas"), vars.multMeas, track.pt()); + for (auto i = 0u; i < vars.nRepetitions; ++i) { + if (!vars.isChargedPrimary) { + histos.fill(HIST("multPtSpec_trk_sec_meas"), vars.multMeas, track.pt()); + } else { + histos.fill(HIST("multCorrel_prim"), vars.multMeas, vars.multTrue); + histos.fill(HIST("ptCorrel_prim"), track.pt(), particle.pt()); + histos.fill(HIST("multPtSpec_prim_meas"), vars.multTrue, particle.pt()); + histos.fill(HIST("multPtSpec_trk_prim_meas"), vars.multMeas, track.pt()); + } } } } } - std::unordered_set uniqueIndices(foundParticles.begin(), foundParticles.end()); + std::unordered_set uniqueIndices(foundParticles.begin(), foundParticles.end()); for (const auto& mcParticleID : uniqueIndices) { histos.fill(HIST("track_ambiguity"), std::count(foundParticles.begin(), foundParticles.end(), mcParticleID)); } From b016df6170de1f43ec7e71ecbcf4ff329c4f405b Mon Sep 17 00:00:00 2001 From: JimunLee Date: Sun, 26 Oct 2025 18:41:36 +0900 Subject: [PATCH 899/986] [PWGLF] Fixed the name of histogram of kstarInOO.cxx (#13521) Co-authored-by: jimun_lee --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index d8c512c11ae..17ba713c086 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -176,8 +176,8 @@ struct kstarInOO { histos.add("hUSS_PiK", "hUSS_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); histos.add("hLSS_KPi", "hLSS_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); histos.add("hLSS_PiK", "hLSS_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hUSS_Mix_KPi", "hUSS_Mix_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hUSS_Mix_PiK", "hUSS_Mix_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hUSS_KPi_Mix", "hUSS_KPi_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hUSS_PiK_Mix", "hUSS_PiK_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); } if (cfgMcHistos) { From eb666e320c3d51aba8826d42571bd35f74fb603b Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Sun, 26 Oct 2025 11:55:29 +0100 Subject: [PATCH 900/986] [PWGHF,Trigger] Add protection for DCAFitter runtime error (#13555) --- EventFiltering/PWGHF/HFFilter.cxx | 250 +++++++++++++++++++----------- 1 file changed, 156 insertions(+), 94 deletions(-) diff --git a/EventFiltering/PWGHF/HFFilter.cxx b/EventFiltering/PWGHF/HFFilter.cxx index e0d75fa8ebd..9777d2ee18c 100644 --- a/EventFiltering/PWGHF/HFFilter.cxx +++ b/EventFiltering/PWGHF/HFFilter.cxx @@ -276,6 +276,7 @@ struct HfFilter { // Main struct for HF triggers helper.setVtxConfiguration(dfStrangeness, true); // (DCAFitterN, useAbsDCA) helper.setVtxConfiguration(dfStrangeness3, true); // (DCAFitterN, useAbsDCA) dfStrangeness.setMatCorrType(matCorr); + dfStrangeness3.setMatCorrType(matCorr); helper.setVtxConfiguration(df2, false); // (DCAFitterN, useAbsDCA) helper.setVtxConfiguration(df3, false); helper.setVtxConfiguration(df4, false); @@ -470,8 +471,10 @@ struct HfFilter { // Main struct for HF triggers auto bz = o2::base::Propagator::Instance()->getNominalBz(); dfStrangeness.setBz(bz); + dfStrangeness3.setBz(bz); df2.setBz(bz); df3.setBz(bz); + df4.setBz(bz); if (activateSecVtxForB) { dfB.setBz(bz); dfBtoDstar.setBz(bz); @@ -635,46 +638,61 @@ struct HfFilter { // Main struct for HF triggers hMassVsPtB[kBc]->Fill(ptCand, massCandD0K); } } else { - df2.process(trackParPos, trackParNeg); - std::array pVecPosVtx{}, pVecNegVtx{}; - df2.getTrack(0).getPxPyPzGlo(pVecPosVtx); - df2.getTrack(1).getPxPyPzGlo(pVecNegVtx); - auto trackParD = df2.createParentTrackParCov(); - trackParD.setAbsCharge(0); // to be sure - auto pVec2ProngVtx = RecoDecay::pVec(pVecPosVtx, pVecNegVtx); - if (dfB.process(trackParD, trackParThird) != 0) { - if (activateQA) { - registry.fill(HIST("fHfVtxStages"), 1 + HfVtxStage::BeautyVertex, kBplus); + int nVtxD{0}; + try { + nVtxD = df2.process(trackParPos, trackParNeg); + } catch (...) { + LOG(error) << "Exception caught in DCA fitter process call for charm 2-prong!"; + nVtxD = 0; + } + if (nVtxD != 0) { + std::array pVecPosVtx{}, pVecNegVtx{}; + df2.getTrack(0).getPxPyPzGlo(pVecPosVtx); + df2.getTrack(1).getPxPyPzGlo(pVecNegVtx); + auto trackParD = df2.createParentTrackParCov(); + trackParD.setAbsCharge(0); // to be sure + auto pVec2ProngVtx = RecoDecay::pVec(pVecPosVtx, pVecNegVtx); + int nVtxB{0}; + try { + nVtxB = dfB.process(trackParD, trackParThird); + } catch (...) { + LOG(error) << "Exception caught in DCA fitter process call for beauty 3-prong!"; + nVtxB = 0; } - const auto& secondaryVertexBtoD0h = dfB.getPCACandidate(); - std::array pVecThirdVtx{}; - dfB.getTrack(0).getPxPyPzGlo(pVec2ProngVtx); - dfB.getTrack(1).getPxPyPzGlo(pVecThirdVtx); - std::array dca2Prong; //{trackParD.dcaXY(), trackParD.dcaZ()}; - o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParD, 2.f, noMatCorr, &dca2Prong); - bool isBplus = helper.isSelectedBhadron(pVec2ProngVtx, pVecThirdVtx, dca2Prong, dcaThird, std::array{static_cast(collision.posX()), static_cast(collision.posY()), static_cast(collision.posZ())}, std::array{secondaryVertexBtoD0h[0], secondaryVertexBtoD0h[1], secondaryVertexBtoD0h[2]}, kBplus); - bool isBc = helper.isSelectedBhadron(pVec2ProngVtx, pVecThirdVtx, dca2Prong, dcaThird, std::array{static_cast(collision.posX()), static_cast(collision.posY()), static_cast(collision.posZ())}, std::array{secondaryVertexBtoD0h[0], secondaryVertexBtoD0h[1], secondaryVertexBtoD0h[2]}, kBc); - - if (isBplus || isBc) { - keepEvent[kBeauty3P] = true; - // fill optimisation tree for D0 - if (applyOptimisation) { - optimisationTreeBeauty(thisCollId, o2::constants::physics::Pdg::kD0, pt2Prong, scores[0], scores[1], scores[2], dcaThird[0]); - } + if (nVtxB != 0) { if (activateQA) { - if (isBplus) { - registry.fill(HIST("fHfVtxStages"), 1 + HfVtxStage::CharmHadPiSelected, kBplus); - hCpaVsPtB[kBplus]->Fill(ptCand, RecoDecay::cpa(std::array{static_cast(collision.posX()), static_cast(collision.posY()), static_cast(collision.posZ())}, std::array{secondaryVertexBtoD0h[0], secondaryVertexBtoD0h[1], secondaryVertexBtoD0h[2]}, RecoDecay::pVec(pVec2ProngVtx, pVecThirdVtx))); - hDecayLengthVsPtB[kBplus]->Fill(ptCand, RecoDecay::distance(std::array{static_cast(collision.posX()), static_cast(collision.posY()), static_cast(collision.posZ())}, std::array{secondaryVertexBtoD0h[0], secondaryVertexBtoD0h[1], secondaryVertexBtoD0h[2]})); - hImpactParamProductVsPtB[kBplus]->Fill(ptCand, dca2Prong[0] * dcaThird[0]); - hMassVsPtB[kBplus]->Fill(ptCand, massCandD0Pi); + registry.fill(HIST("fHfVtxStages"), 1 + HfVtxStage::BeautyVertex, kBplus); + } + const auto& secondaryVertexBtoD0h = dfB.getPCACandidate(); + std::array pVecThirdVtx{}; + dfB.getTrack(0).getPxPyPzGlo(pVec2ProngVtx); + dfB.getTrack(1).getPxPyPzGlo(pVecThirdVtx); + std::array dca2Prong; //{trackParD.dcaXY(), trackParD.dcaZ()}; + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParD, 2.f, noMatCorr, &dca2Prong); + bool isBplus = helper.isSelectedBhadron(pVec2ProngVtx, pVecThirdVtx, dca2Prong, dcaThird, std::array{static_cast(collision.posX()), static_cast(collision.posY()), static_cast(collision.posZ())}, std::array{secondaryVertexBtoD0h[0], secondaryVertexBtoD0h[1], secondaryVertexBtoD0h[2]}, kBplus); + bool isBc = helper.isSelectedBhadron(pVec2ProngVtx, pVecThirdVtx, dca2Prong, dcaThird, std::array{static_cast(collision.posX()), static_cast(collision.posY()), static_cast(collision.posZ())}, std::array{secondaryVertexBtoD0h[0], secondaryVertexBtoD0h[1], secondaryVertexBtoD0h[2]}, kBc); + + if (isBplus || isBc) { + keepEvent[kBeauty3P] = true; + // fill optimisation tree for D0 + if (applyOptimisation) { + optimisationTreeBeauty(thisCollId, o2::constants::physics::Pdg::kD0, pt2Prong, scores[0], scores[1], scores[2], dcaThird[0]); } - if (isBc) { - registry.fill(HIST("fHfVtxStages"), 1 + HfVtxStage::CharmHadPiSelected, kBc); - hCpaVsPtB[kBc]->Fill(ptCand, RecoDecay::cpa(std::array{static_cast(collision.posX()), static_cast(collision.posY()), static_cast(collision.posZ())}, std::array{secondaryVertexBtoD0h[0], secondaryVertexBtoD0h[1], secondaryVertexBtoD0h[2]}, RecoDecay::pVec(pVec2ProngVtx, pVecThirdVtx))); - hDecayLengthVsPtB[kBc]->Fill(ptCand, RecoDecay::distance(std::array{static_cast(collision.posX()), static_cast(collision.posY()), static_cast(collision.posZ())}, std::array{secondaryVertexBtoD0h[0], secondaryVertexBtoD0h[1], secondaryVertexBtoD0h[2]})); - hImpactParamProductVsPtB[kBc]->Fill(ptCand, dca2Prong[0] * dcaThird[0]); - hMassVsPtB[kBc]->Fill(ptCand, massCandD0K); + if (activateQA) { + if (isBplus) { + registry.fill(HIST("fHfVtxStages"), 1 + HfVtxStage::CharmHadPiSelected, kBplus); + hCpaVsPtB[kBplus]->Fill(ptCand, RecoDecay::cpa(std::array{static_cast(collision.posX()), static_cast(collision.posY()), static_cast(collision.posZ())}, std::array{secondaryVertexBtoD0h[0], secondaryVertexBtoD0h[1], secondaryVertexBtoD0h[2]}, RecoDecay::pVec(pVec2ProngVtx, pVecThirdVtx))); + hDecayLengthVsPtB[kBplus]->Fill(ptCand, RecoDecay::distance(std::array{static_cast(collision.posX()), static_cast(collision.posY()), static_cast(collision.posZ())}, std::array{secondaryVertexBtoD0h[0], secondaryVertexBtoD0h[1], secondaryVertexBtoD0h[2]})); + hImpactParamProductVsPtB[kBplus]->Fill(ptCand, dca2Prong[0] * dcaThird[0]); + hMassVsPtB[kBplus]->Fill(ptCand, massCandD0Pi); + } + if (isBc) { + registry.fill(HIST("fHfVtxStages"), 1 + HfVtxStage::CharmHadPiSelected, kBc); + hCpaVsPtB[kBc]->Fill(ptCand, RecoDecay::cpa(std::array{static_cast(collision.posX()), static_cast(collision.posY()), static_cast(collision.posZ())}, std::array{secondaryVertexBtoD0h[0], secondaryVertexBtoD0h[1], secondaryVertexBtoD0h[2]}, RecoDecay::pVec(pVec2ProngVtx, pVecThirdVtx))); + hDecayLengthVsPtB[kBc]->Fill(ptCand, RecoDecay::distance(std::array{static_cast(collision.posX()), static_cast(collision.posY()), static_cast(collision.posZ())}, std::array{secondaryVertexBtoD0h[0], secondaryVertexBtoD0h[1], secondaryVertexBtoD0h[2]})); + hImpactParamProductVsPtB[kBc]->Fill(ptCand, dca2Prong[0] * dcaThird[0]); + hMassVsPtB[kBc]->Fill(ptCand, massCandD0K); + } } } } @@ -730,34 +748,49 @@ struct HfFilter { // Main struct for HF triggers hMassVsPtB[kB0toDStar]->Fill(ptCandBeauty4Prong, massCandB0); } } else { - df2.process(trackParPos, trackParNeg); - std::array pVecPosVtx{}, pVecNegVtx{}; - df2.getTrack(0).getPxPyPzGlo(pVecPosVtx); - df2.getTrack(1).getPxPyPzGlo(pVecNegVtx); - auto trackParD = df2.createParentTrackParCov(); - trackParD.setAbsCharge(0); // to be sure - auto pVec2ProngVtx = RecoDecay::pVec(pVecPosVtx, pVecNegVtx); - if (dfBtoDstar.process(trackParD, trackParThird, trackParFourth) != 0) { - if (activateQA) { - registry.fill(HIST("fHfVtxStages"), 1 + HfVtxStage::BeautyVertex, kB0toDStar); + int nVtxD{0}; + try { + nVtxD = df2.process(trackParPos, trackParNeg); + } catch (...) { + LOG(error) << "Exception caught in DCA fitter process call for charm 2-prong!"; + nVtxD = 0; + } + if (nVtxD > 0) { + std::array pVecPosVtx{}, pVecNegVtx{}; + df2.getTrack(0).getPxPyPzGlo(pVecPosVtx); + df2.getTrack(1).getPxPyPzGlo(pVecNegVtx); + auto trackParD = df2.createParentTrackParCov(); + trackParD.setAbsCharge(0); // to be sure + auto pVec2ProngVtx = RecoDecay::pVec(pVecPosVtx, pVecNegVtx); + int nVtxB{0}; + try { + nVtxB = dfBtoDstar.process(trackParD, trackParThird, trackParFourth); + } catch (...) { + LOG(error) << "Exception caught in DCA fitter process call for beauty to D*!"; + nVtxB = 0; } - const auto& secondaryVertexBzero = dfBtoDstar.getPCACandidate(); - std::array pVecThirdVtx{}, pVecFourthVtx{}; - dfBtoDstar.getTrack(0).getPxPyPzGlo(pVec2ProngVtx); - dfBtoDstar.getTrack(1).getPxPyPzGlo(pVecThirdVtx); - dfBtoDstar.getTrack(2).getPxPyPzGlo(pVecFourthVtx); - bool isBzero = helper.isSelectedBzeroToDstar(pVec2ProngVtx, pVecThirdVtx, pVecFourthVtx, std::array{static_cast(collision.posX()), static_cast(collision.posY()), static_cast(collision.posZ())}, std::array{secondaryVertexBzero[0], secondaryVertexBzero[1], secondaryVertexBzero[2]}); - if (isBzero) { - keepEvent[kBeauty3P] = true; - // fill optimisation tree for D0 - if (applyOptimisation) { - optimisationTreeBeauty(thisCollId, 413, pt2Prong, scores[0], scores[1], scores[2], dcaFourth[0]); // pdgCode of D*(2010)+: 413 - } + if (nVtxB != 0) { if (activateQA) { - registry.fill(HIST("fHfVtxStages"), 1 + HfVtxStage::CharmHadPiSelected, kB0toDStar); - hCpaVsPtB[kB0toDStar]->Fill(ptCandBeauty4Prong, RecoDecay::cpa(std::array{static_cast(collision.posX()), static_cast(collision.posY()), static_cast(collision.posZ())}, std::array{secondaryVertexBzero[0], secondaryVertexBzero[1], secondaryVertexBzero[2]}, RecoDecay::pVec(pVec2ProngVtx, pVecThirdVtx, pVecFourthVtx))); - hDecayLengthVsPtB[kB0toDStar]->Fill(ptCandBeauty4Prong, RecoDecay::distance(std::array{static_cast(collision.posX()), static_cast(collision.posY()), static_cast(collision.posZ())}, std::array{secondaryVertexBzero[0], secondaryVertexBzero[1], secondaryVertexBzero[2]})); - hMassVsPtB[kB0toDStar]->Fill(ptCandBeauty4Prong, massCandB0); + registry.fill(HIST("fHfVtxStages"), 1 + HfVtxStage::BeautyVertex, kB0toDStar); + } + const auto& secondaryVertexBzero = dfBtoDstar.getPCACandidate(); + std::array pVecThirdVtx{}, pVecFourthVtx{}; + dfBtoDstar.getTrack(0).getPxPyPzGlo(pVec2ProngVtx); + dfBtoDstar.getTrack(1).getPxPyPzGlo(pVecThirdVtx); + dfBtoDstar.getTrack(2).getPxPyPzGlo(pVecFourthVtx); + bool isBzero = helper.isSelectedBzeroToDstar(pVec2ProngVtx, pVecThirdVtx, pVecFourthVtx, std::array{static_cast(collision.posX()), static_cast(collision.posY()), static_cast(collision.posZ())}, std::array{secondaryVertexBzero[0], secondaryVertexBzero[1], secondaryVertexBzero[2]}); + if (isBzero) { + keepEvent[kBeauty3P] = true; + // fill optimisation tree for D0 + if (applyOptimisation) { + optimisationTreeBeauty(thisCollId, 413, pt2Prong, scores[0], scores[1], scores[2], dcaFourth[0]); // pdgCode of D*(2010)+: 413 + } + if (activateQA) { + registry.fill(HIST("fHfVtxStages"), 1 + HfVtxStage::CharmHadPiSelected, kB0toDStar); + hCpaVsPtB[kB0toDStar]->Fill(ptCandBeauty4Prong, RecoDecay::cpa(std::array{static_cast(collision.posX()), static_cast(collision.posY()), static_cast(collision.posZ())}, std::array{secondaryVertexBzero[0], secondaryVertexBzero[1], secondaryVertexBzero[2]}, RecoDecay::pVec(pVec2ProngVtx, pVecThirdVtx, pVecFourthVtx))); + hDecayLengthVsPtB[kB0toDStar]->Fill(ptCandBeauty4Prong, RecoDecay::distance(std::array{static_cast(collision.posX()), static_cast(collision.posY()), static_cast(collision.posZ())}, std::array{secondaryVertexBzero[0], secondaryVertexBzero[1], secondaryVertexBzero[2]})); + hMassVsPtB[kB0toDStar]->Fill(ptCandBeauty4Prong, massCandB0); + } } } } @@ -794,7 +827,14 @@ struct HfFilter { // Main struct for HF triggers std::array pVecPosVtx{}, pVecNegVtx{}, pVecThirdVtx{}, pVecFourthVtx{}; // 3-prong vertices if (!keepEvent[kBtoJPsiKa] || !keepEvent[kBtoJPsiPi]) { - if (df3.process(trackParPos, trackParNeg, trackParThird) != 0) { + int nVtxB{0}; + try { + nVtxB = df3.process(trackParPos, trackParNeg, trackParThird); + } catch (...) { + LOG(error) << "Exception caught in DCA fitter process call for beauty to JPsi 3-prong!"; + nVtxB = 0; + } + if (nVtxB != 0) { const auto& secondaryVertexBto3tracks = df3.getPCACandidate(); df3.getTrack(0).getPxPyPzGlo(pVecPosVtx); df3.getTrack(1).getPxPyPzGlo(pVecNegVtx); @@ -828,7 +868,14 @@ struct HfFilter { // Main struct for HF triggers if (!TESTBIT(helper.isSelectedTrackForSoftPionOrBeauty(trackFourth, trackParFourth, dcaFourth), kForBeauty)) { // same for all channels continue; } - if (df4.process(trackParPos, trackParNeg, trackParThird, trackParFourth) != 0) { + int nVtxB{0}; + try { + nVtxB = df4.process(trackParPos, trackParNeg, trackParThird, trackParFourth); + } catch (...) { + LOG(error) << "Exception caught in DCA fitter process call for beauty to JPsi 4-prong!"; + nVtxB = 0; + } + if (nVtxB != 0) { const auto& secondaryVertexBto4tracks = df4.getPCACandidate(); df4.getTrack(0).getPxPyPzGlo(pVecPosVtx); df4.getTrack(1).getPxPyPzGlo(pVecNegVtx); @@ -1356,37 +1403,52 @@ struct HfFilter { // Main struct for HF triggers hMassVsPtB[iHypo + 3]->Fill(ptCandBeauty4Prong, massCandB); } } else { - df3.process(trackParFirst, trackParSecond, trackParThird); - std::array pVecFirstVtx{}, pVecSecondVtx{}, pVecThirdVtx{}; - df3.getTrack(0).getPxPyPzGlo(pVecFirstVtx); - df3.getTrack(1).getPxPyPzGlo(pVecSecondVtx); - df3.getTrack(1).getPxPyPzGlo(pVecThirdVtx); - auto trackParD = df3.createParentTrackParCov(); - trackParD.setAbsCharge(sign3Prong); // to be sure - auto pVec3ProngVtx = RecoDecay::pVec(pVecFirstVtx, pVecSecondVtx, pVecThirdVtx); - if (dfB.process(trackParD, trackParFourth) != 0) { - if (activateQA) { - registry.fill(HIST("fHfVtxStages"), 1 + HfVtxStage::BeautyVertex, iHypo + 3); + int nVtxD{0}; + try { + nVtxD = df3.process(trackParFirst, trackParSecond, trackParThird); + } catch (...) { + LOG(error) << "Exception caught in DCA fitter process call for charm 3-prong!"; + nVtxD = 0; + } + if (nVtxD != 0) { + std::array pVecFirstVtx{}, pVecSecondVtx{}, pVecThirdVtx{}; + df3.getTrack(0).getPxPyPzGlo(pVecFirstVtx); + df3.getTrack(1).getPxPyPzGlo(pVecSecondVtx); + df3.getTrack(1).getPxPyPzGlo(pVecThirdVtx); + auto trackParD = df3.createParentTrackParCov(); + trackParD.setAbsCharge(sign3Prong); // to be sure + auto pVec3ProngVtx = RecoDecay::pVec(pVecFirstVtx, pVecSecondVtx, pVecThirdVtx); + int nVtxB{0}; + try { + nVtxB = dfB.process(trackParD, trackParFourth); + } catch (...) { + LOG(error) << "Exception caught in DCA fitter process call for B 4-prong!"; + nVtxB = 0; } - const auto& secondaryVertexB = dfB.getPCACandidate(); - std::array pVecFourtVtx{}; - dfB.getTrack(0).getPxPyPzGlo(pVec3ProngVtx); - dfB.getTrack(1).getPxPyPzGlo(pVecFourtVtx); - std::array dca3Prong; //{trackParD.dcaXY(), trackParD.dcaZ()}; - o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParD, 2.f, noMatCorr, &dca3Prong); - bool isBhad = helper.isSelectedBhadron(pVec3ProngVtx, pVecFourtVtx, dca3Prong, dcaFourth, std::array{static_cast(collision.posX()), static_cast(collision.posY()), static_cast(collision.posZ())}, std::array{secondaryVertexB[0], secondaryVertexB[1], secondaryVertexB[2]}, iHypo + 3); - if (isBhad) { - keepEvent[kBeauty4P] = true; - // fill optimisation tree - if (applyOptimisation) { - optimisationTreeBeauty(thisCollId, charmParticleID[iHypo], pt3Prong, scores[iHypo][0], scores[iHypo][1], scores[iHypo][2], dcaFourth[0]); - } + if (nVtxB != 0) { if (activateQA) { - registry.fill(HIST("fHfVtxStages"), 1 + HfVtxStage::CharmHadPiSelected, iHypo + 3); - hCpaVsPtB[iHypo + 3]->Fill(ptCandBeauty4Prong, RecoDecay::cpa(std::array{static_cast(collision.posX()), static_cast(collision.posY()), static_cast(collision.posZ())}, std::array{secondaryVertexB[0], secondaryVertexB[1], secondaryVertexB[2]}, RecoDecay::pVec(pVec3ProngVtx, pVecFourtVtx))); - hDecayLengthVsPtB[iHypo + 3]->Fill(ptCandBeauty4Prong, RecoDecay::distance(std::array{static_cast(collision.posX()), static_cast(collision.posY()), static_cast(collision.posZ())}, std::array{secondaryVertexB[0], secondaryVertexB[1], secondaryVertexB[2]})); - hImpactParamProductVsPtB[iHypo + 3]->Fill(ptCandBeauty4Prong, dca3Prong[0] * dcaFourth[0]); - hMassVsPtB[iHypo + 3]->Fill(ptCandBeauty4Prong, massCandB); + registry.fill(HIST("fHfVtxStages"), 1 + HfVtxStage::BeautyVertex, iHypo + 3); + } + const auto& secondaryVertexB = dfB.getPCACandidate(); + std::array pVecFourtVtx{}; + dfB.getTrack(0).getPxPyPzGlo(pVec3ProngVtx); + dfB.getTrack(1).getPxPyPzGlo(pVecFourtVtx); + std::array dca3Prong; //{trackParD.dcaXY(), trackParD.dcaZ()}; + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParD, 2.f, noMatCorr, &dca3Prong); + bool isBhad = helper.isSelectedBhadron(pVec3ProngVtx, pVecFourtVtx, dca3Prong, dcaFourth, std::array{static_cast(collision.posX()), static_cast(collision.posY()), static_cast(collision.posZ())}, std::array{secondaryVertexB[0], secondaryVertexB[1], secondaryVertexB[2]}, iHypo + 3); + if (isBhad) { + keepEvent[kBeauty4P] = true; + // fill optimisation tree + if (applyOptimisation) { + optimisationTreeBeauty(thisCollId, charmParticleID[iHypo], pt3Prong, scores[iHypo][0], scores[iHypo][1], scores[iHypo][2], dcaFourth[0]); + } + if (activateQA) { + registry.fill(HIST("fHfVtxStages"), 1 + HfVtxStage::CharmHadPiSelected, iHypo + 3); + hCpaVsPtB[iHypo + 3]->Fill(ptCandBeauty4Prong, RecoDecay::cpa(std::array{static_cast(collision.posX()), static_cast(collision.posY()), static_cast(collision.posZ())}, std::array{secondaryVertexB[0], secondaryVertexB[1], secondaryVertexB[2]}, RecoDecay::pVec(pVec3ProngVtx, pVecFourtVtx))); + hDecayLengthVsPtB[iHypo + 3]->Fill(ptCandBeauty4Prong, RecoDecay::distance(std::array{static_cast(collision.posX()), static_cast(collision.posY()), static_cast(collision.posZ())}, std::array{secondaryVertexB[0], secondaryVertexB[1], secondaryVertexB[2]})); + hImpactParamProductVsPtB[iHypo + 3]->Fill(ptCandBeauty4Prong, dca3Prong[0] * dcaFourth[0]); + hMassVsPtB[iHypo + 3]->Fill(ptCandBeauty4Prong, massCandB); + } } } } From 1cbe0ef7245fa40361e0994d6e7f4ee06f1e1277 Mon Sep 17 00:00:00 2001 From: SahaArka-uniba Date: Sun, 26 Oct 2025 13:48:50 +0100 Subject: [PATCH 901/986] [PWGLF] changed some variable naming and updated pT calculation for He3 (#13554) Co-authored-by: Arkaprabha Saha --- PWGLF/Tasks/Nuspex/AntiNucleiTask.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/AntiNucleiTask.cxx b/PWGLF/Tasks/Nuspex/AntiNucleiTask.cxx index 3601b513f5b..96a16bd79e9 100644 --- a/PWGLF/Tasks/Nuspex/AntiNucleiTask.cxx +++ b/PWGLF/Tasks/Nuspex/AntiNucleiTask.cxx @@ -140,14 +140,14 @@ struct AntiNucleiTask { double expBethe{tpc::BetheBlochAleph(static_cast(track.tpcInnerParam()), cfgBetheBlochParams->get("p0"), cfgBetheBlochParams->get("p1"), cfgBetheBlochParams->get("p2"), cfgBetheBlochParams->get("p3"), cfgBetheBlochParams->get("p4"))}; double expSigma{expBethe * cfgBetheBlochParams->get("resolution")}; - float tpcNSigmaDeuteron = static_cast((track.tpcSignal() - expBethe) / expSigma); + float tpcNSigma = static_cast((track.tpcSignal() - expBethe) / expSigma); - float pt = track.sign() > 0 ? track.pt() : -track.pt(); + float pt = track.sign() > 0 ? 2 * track.pt() : -2 * track.pt(); // Filling histograms with track data before applying any cuts. histos.fill(HIST("RawEta"), track.eta()); histos.fill(HIST("RawPhi"), track.phi()); histos.fill(HIST("RawPt"), pt); - histos.fill(HIST("RawtpcNSigma"), collision.centFT0C(), pt, tpcNSigmaDeuteron); + histos.fill(HIST("RawtpcNSigma"), collision.centFT0C(), pt, tpcNSigma); histos.fill(HIST("RawtofNSigma"), collision.centFT0C(), pt, track.tofNSigmaDe()); // If the track is good, fill the "after cuts" histograms. @@ -155,10 +155,10 @@ struct AntiNucleiTask { histos.fill(HIST("Eta"), track.eta()); histos.fill(HIST("Phi"), track.phi()); histos.fill(HIST("Pt"), pt); - histos.fill(HIST("tpcNSigma"), collision.centFT0C(), pt, tpcNSigmaDeuteron); + histos.fill(HIST("tpcNSigma"), collision.centFT0C(), pt, tpcNSigma); histos.fill(HIST("TpcSignal"), track.tpcInnerParam(), track.tpcSignal()); - if (std::abs(tpcNSigmaDeuteron) < tpcNSigmaCut) { + if (std::abs(tpcNSigma) < tpcNSigmaCut) { histos.fill(HIST("tofNSigma"), collision.centFT0C(), pt, track.tofNSigmaDe()); } } From 745f5b4d25532f43ccba6f226bc4bb89ef826043 Mon Sep 17 00:00:00 2001 From: prottayCMT <61418725+prottayCMT@users.noreply.github.com> Date: Sun, 26 Oct 2025 15:27:29 +0100 Subject: [PATCH 902/986] [PWGLF] corrected a conditional bug and added few configurables for event selection (#13556) Co-authored-by: Prottay Das --- PWGLF/TableProducer/Strangeness/lambdaspincorrelation.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PWGLF/TableProducer/Strangeness/lambdaspincorrelation.cxx b/PWGLF/TableProducer/Strangeness/lambdaspincorrelation.cxx index 8d48b8d991b..b07186162e7 100644 --- a/PWGLF/TableProducer/Strangeness/lambdaspincorrelation.cxx +++ b/PWGLF/TableProducer/Strangeness/lambdaspincorrelation.cxx @@ -71,6 +71,8 @@ struct lambdaspincorrelation { Configurable cfgEvtRCTFlagCheckerZDCCheck{"cfgEvtRCTFlagCheckerZDCCheck", false, "Evt sel: RCT flag checker ZDC check"}; Configurable cfgEvtRCTFlagCheckerLimitAcceptAsBad{"cfgEvtRCTFlagCheckerLimitAcceptAsBad", true, "Evt sel: RCT flag checker treat Limited Acceptance As Bad"}; } rctCut; + Configurable useNoCollInTimeRangeStandard{"useNoCollInTimeRangeStandard", false, "Apply kNoCollInTimeRangeStandard selection bit"}; + Configurable useGoodITSLayersAll{"useGoodITSLayersAll", true, "Apply kIsGoodITSLayersAll selection bit"}; // mixing // Produce derived tables Configurable cfgCutOccupancy{"cfgCutOccupancy", 2000, "Occupancy cut"}; @@ -267,7 +269,8 @@ struct lambdaspincorrelation { auto vz = collision.posZ(); int occupancy = collision.trackOccupancyInTimeRange(); histos.fill(HIST("hEvtSelInfo"), 0.5); - if ((rctCut.requireRCTFlagChecker && rctChecker(collision)) && collision.selection_bit(aod::evsel::kNoSameBunchPileup) && collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) && collision.selection_bit(aod::evsel::kNoTimeFrameBorder) && collision.selection_bit(aod::evsel::kNoITSROFrameBorder) && collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) && collision.sel8() && collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll) && occupancy < cfgCutOccupancy) { + // if ((!rctCut.requireRCTFlagChecker || rctChecker(collision)) && collision.selection_bit(aod::evsel::kNoSameBunchPileup) && collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) && collision.selection_bit(aod::evsel::kNoTimeFrameBorder) && collision.selection_bit(aod::evsel::kNoITSROFrameBorder) && collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) && collision.sel8() && collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll) && occupancy < cfgCutOccupancy) { + if ((!rctCut.requireRCTFlagChecker || rctChecker(collision)) && collision.selection_bit(aod::evsel::kNoSameBunchPileup) && collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) && collision.selection_bit(aod::evsel::kNoTimeFrameBorder) && collision.selection_bit(aod::evsel::kNoITSROFrameBorder) && (!useNoCollInTimeRangeStandard || collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) && collision.sel8() && (!useGoodITSLayersAll || collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) && occupancy < cfgCutOccupancy) { histos.fill(HIST("hEvtSelInfo"), 1.5); for (const auto& v0 : V0s) { // LOGF(info, "v0 index 0 : (%d)", v0.index()); From ab304ff73bc33590c62afb48d8c4af9d3ba0653a Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Sun, 26 Oct 2025 15:47:26 +0100 Subject: [PATCH 903/986] [PWGLF] Fold deltaphi distribution (#13558) --- PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx index 59d73923ac6..caacb8c0ed6 100644 --- a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx @@ -96,7 +96,8 @@ struct lambdaspincorrderived { Configurable rngSeed{"rngSeed", 12345, "Seed for random mixing (reproducible)"}; std::mt19937 rng{12345}; // Lambda selection //////////// - Configurable harmonic{"harmonic", 1, "Harmonic delta phi"}; + Configurable harmonic{"harmonic", 1, "Harmonic phi"}; + Configurable harmonicDphi{"harmonicDphi", 2, "Harmonic delta phi"}; Configurable useweight{"useweight", 0, "Use weight"}; Configurable usebothweight{"usebothweight", 1, "Use both weight"}; // Configurable useNUA{"useNUA", 0, "Use NUA weight"}; @@ -376,7 +377,7 @@ struct lambdaspincorrderived { double deta2 = particle2.Eta(); double deta_pair = std::abs(deta1 - deta2); - double dphi_pair = std::abs(dphi1 - dphi2); + double dphi_pair = RecoDecay::constrainAngle(particle1.Phi() - particle2.Phi(), 0.0F, harmonicDphi); double deltaR = TMath::Sqrt(deta_pair * deta_pair + dphi_pair * dphi_pair); double deltaRap = std::abs(particle1.Rapidity() - particle2.Rapidity()); @@ -535,7 +536,7 @@ struct lambdaspincorrderived { } proton2 = ROOT::Math::PtEtaPhiMVector(v02.protonPt(), v02.protonEta(), v02.protonPhi(), o2::constants::physics::MassProton); lambda2 = ROOT::Math::PtEtaPhiMVector(v02.lambdaPt(), v02.lambdaEta(), v02.lambdaPhi(), v02.lambdaMass()); - histos.fill(HIST("deltaPhiSame"), std::abs(RecoDecay::constrainAngle(v0.lambdaPhi(), 0.0F, harmonic) - RecoDecay::constrainAngle(v02.lambdaPhi(), 0.0F, harmonic))); + histos.fill(HIST("deltaPhiSame"), RecoDecay::constrainAngle(v0.lambdaPhi() - v02.lambdaPhi(), 0.0F, harmonicDphi)); if (v0.v0Status() == 0 && v02.v0Status() == 0) { fillHistograms(0, 0, lambda, lambda2, proton, proton2, 0, 1.0); } @@ -607,7 +608,7 @@ struct lambdaspincorrderived { lambda = ROOT::Math::PtEtaPhiMVector(t3.lambdaPt(), t3.lambdaEta(), t3.lambdaPhi(), t3.lambdaMass()); proton2 = ROOT::Math::PtEtaPhiMVector(t2.protonPt(), t2.protonEta(), t2.protonPhi(), o2::constants::physics::MassProton); lambda2 = ROOT::Math::PtEtaPhiMVector(t2.lambdaPt(), t2.lambdaEta(), t2.lambdaPhi(), t2.lambdaMass()); - histos.fill(HIST("deltaPhiMix"), std::abs(RecoDecay::constrainAngle(t3.lambdaPhi(), 0.0F, harmonic) - RecoDecay::constrainAngle(t2.lambdaPhi(), 0.0F, harmonic))); + histos.fill(HIST("deltaPhiMix"), RecoDecay::constrainAngle(t3.lambdaPhi() - t2.lambdaPhi(), 0.0F, harmonicDphi)); if (t3.v0Status() == 0 && t2.v0Status() == 0) { fillHistograms(0, 0, lambda, lambda2, proton, proton2, 1, 1.0); } @@ -1029,9 +1030,7 @@ struct lambdaspincorrderived { auto proton2 = ROOT::Math::PtEtaPhiMVector(t2.protonPt(), t2.protonEta(), t2.protonPhi(), o2::constants::physics::MassProton); auto lambda2 = ROOT::Math::PtEtaPhiMVector(t2.lambdaPt(), t2.lambdaEta(), t2.lambdaPhi(), t2.lambdaMass()); - const float dPhi = std::fabs( - RecoDecay::constrainAngle(lambda.Phi(), 0.0F, harmonic) - - RecoDecay::constrainAngle(lambda2.Phi(), 0.0F, harmonic)); + const float dPhi = std::fabs(RecoDecay::constrainAngle(lambda.Phi() - lambda2.Phi(), 0.0F, harmonicDphi)); histos.fill(HIST("deltaPhiMix"), dPhi, wBase); fillHistograms(tX.v0Status(), t2.v0Status(), lambda, lambda2, proton, proton2, 1, wBase); } From 84acccc91f42841f7aab804453f38883890b8aa8 Mon Sep 17 00:00:00 2001 From: SuJeong Ji <120470463+SuJeong-Ji@users.noreply.github.com> Date: Mon, 27 Oct 2025 00:45:37 +0900 Subject: [PATCH 904/986] [PWGLF] Add histograms and functions for calculating correction factors in chk892pp.cxx (#13541) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Resonances/chk892pp.cxx | 312 +++++++++++++++++++++------- 1 file changed, 237 insertions(+), 75 deletions(-) diff --git a/PWGLF/Tasks/Resonances/chk892pp.cxx b/PWGLF/Tasks/Resonances/chk892pp.cxx index e888723a6b3..e0986eb7cbe 100644 --- a/PWGLF/Tasks/Resonances/chk892pp.cxx +++ b/PWGLF/Tasks/Resonances/chk892pp.cxx @@ -25,6 +25,7 @@ #include // #include // FIXME #include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/mcCentrality.h" #include "PWGLF/Utils/collisionCuts.h" #include "PWGLF/Utils/inelGt.h" @@ -59,6 +60,7 @@ #include "Math/Vector3D.h" #include "Math/Vector4D.h" #include "TF1.h" +#include "TParticlePDG.h" #include "TRandom3.h" #include "TVector2.h" #include @@ -107,9 +109,20 @@ struct Chk892pp { kTYEnd }; + enum EvtStep { + kAll = 0, + kZvtx, + kINELgt0, + kAssocReco, + kNSteps + }; + + const int nSteps = static_cast(EvtStep::kNSteps); + SliceCache cache; Preslice perCollision = aod::track::collisionId; Preslice perCollisionV0 = aod::v0data::collisionId; + Preslice perMCCollision = o2::aod::mcparticle::mcCollisionId; using EventCandidates = soa::Join; using TrackCandidates = soa::Join; @@ -164,7 +177,7 @@ struct Chk892pp { Configurable cfgincludeCentralityMC{"cfgincludeCentralityMC", false, "Include centrality in MC"}; Configurable cfgEvtCollInTimeRangeStandard{"cfgEvtCollInTimeRangeStandard", false, "Evt sel: apply NoCollInTimeRangeStandard"}; Configurable cfgEventCentralityMin{"cfgEventCentralityMin", 0.0f, "Event sel: minimum centrality"}; - Configurable cfgEventCentralityMax{"cfgEventCentralityMax", 80.0f, "Event sel: maximum centrality"}; + Configurable cfgEventCentralityMax{"cfgEventCentralityMax", 100.0f, "Event sel: maximum centrality"}; Configurable cfgEvtUseRCTFlagChecker{"cfgEvtUseRCTFlagChecker", false, "Evt sel: use RCT flag checker"}; Configurable cfgEvtRCTFlagCheckerLabel{"cfgEvtRCTFlagCheckerLabel", "CBT_hadronPID", "Evt sel: RCT flag checker label"}; Configurable cfgEvtRCTFlagCheckerZDCCheck{"cfgEvtRCTFlagCheckerZDCCheck", false, "Evt sel: RCT flag checker ZDC check"}; @@ -250,6 +263,9 @@ struct Chk892pp { Configurable cfgNrotBkg{"cfgNrotBkg", 4, "Number of rotated copies (background) per each original candidate"}; } BkgEstimationConfig; + Configurable cfgTruthUseInelGt0{"cfgTruthUseInelGt0", true, "Truth denominator: require INEL>0"}; + Configurable cfgTruthIncludeZvtx{"cfgTruthIncludeZvtx", true, "Truth denominator: also require |vtxz|(HIST("Correction/setSizes")); + hset->GetXaxis()->SetBinLabel(1, "refClassIds"); + hset->GetXaxis()->SetBinLabel(2, "allowedMcIds"); + hset->GetXaxis()->SetBinLabel(3, "intersection"); + hset->GetXaxis()->SetBinLabel(4, "allowed-only"); + + histos.add("Correction/hNEventsMCTruth", "hNEventsMCTruth", HistType::kTH1F, {AxisSpec{nSteps, 0.5, nSteps + 0.5, ""}}); + auto hstep = histos.get(HIST("Correction/hNEventsMCTruth")); + hstep->GetXaxis()->SetBinLabel(1, "All"); + hstep->GetXaxis()->SetBinLabel(2, "zvtx"); + hstep->GetXaxis()->SetBinLabel(3, "INEL>0"); + hstep->GetXaxis()->SetBinLabel(4, "Assoc with reco coll"); } ccdb->setURL(CCDBConfig.cfgURL); @@ -453,27 +491,6 @@ struct Chk892pp { } } - template - int getlDetId(DetNameType const& name) - { - LOGF(info, "GetDetID running"); - if (name.value == "FT0C") { - return 0; - } else if (name.value == "FT0A") { - return 1; - } else if (name.value == "FT0M") { - return 2; - } else if (name.value == "FV0A") { - return 3; - } else if (name.value == "TPCpos") { - return 4; - } else if (name.value == "TPCneg") { - return 5; - } else { - return false; - } - } - // Track selection template bool trackCut(TrackType const& track) @@ -689,62 +706,105 @@ struct Chk892pp { } std::unordered_set allowedMcIds; - std::unordered_map centByMcIds; + std::unordered_map centTruthByAllowed; + std::unordered_set refClassIds; + std::unordered_map refCentByMcId; - void buildAllowedMcIds(MCEventCandidates const& events) + template + void buildAllowedMcIds(RecoEventsT const& events) { allowedMcIds.clear(); - centByMcIds.clear(); + centTruthByAllowed.clear(); for (const auto& coll : events) { - lCentrality = getCentrality(coll); - histos.fill(HIST("QACent_woCut"), lCentrality); - histos.fill(HIST("QAvtxz_woCut"), coll.posZ()); + // lCentrality = getCentrality(coll); + + if (!coll.has_mcCollision()) + continue; + + const auto mcid = coll.mcCollisionId(); + const auto mccoll = coll.template mcCollision_as>(); + + const float lCentrality = mccoll.centFT0M(); + + if (doprocessMC) { + histos.fill(HIST("QACent_woCut"), lCentrality); + histos.fill(HIST("QAvtxz_woCut"), coll.posZ()); + } if (!colCuts.isSelected(coll)) continue; + if (EventCuts.cfgEvtUseRCTFlagChecker && !rctChecker(coll)) + continue; if (!coll.isInelGt0()) continue; - histos.fill(HIST("QACent_woCentCut"), lCentrality); - histos.fill(HIST("QAvtxz_wVtxzCut"), coll.posZ()); + if (doprocessMC) { + histos.fill(HIST("QACent_woCentCut"), lCentrality); + histos.fill(HIST("QAvtxz_wVtxzCut"), coll.posZ()); + } if (lCentrality < EventCuts.cfgEventCentralityMin || lCentrality > EventCuts.cfgEventCentralityMax) continue; - histos.fill(HIST("QACent_wCentCut"), lCentrality); - if (!coll.has_mcCollision()) - continue; - const auto mcid = coll.mcCollisionId(); - if (mcid < 0) - continue; + + if (doprocessMC) { + histos.fill(HIST("QACent_wCentCut"), lCentrality); + } allowedMcIds.insert(mcid); - centByMcIds[mcid] = lCentrality; + centTruthByAllowed.emplace(mcid, lCentrality); + } + } + + template + void buildReferenceMcIds(McCollsT const& mccolls, McPartsT const& mcparts) + { + refClassIds.clear(); + refCentByMcId.clear(); + + for (const auto& coll : mccolls) { + bool pass = true; + + if (cfgTruthIncludeZvtx && std::abs(coll.posZ()) >= EventCuts.cfgEvtZvtx) + pass = false; + + if (pass && cfgTruthUseInelGt0) { + auto partsThisMc = mcparts.sliceBy(perMCCollision, coll.globalIndex()); + if (!pwglf::isINELgtNmc(partsThisMc, 0, pdg)) + pass = false; + } + + if (!pass) + continue; + + const auto mcid = coll.globalIndex(); + refClassIds.insert(mcid); + const float lCentrality = coll.centFT0M(); + refCentByMcId.emplace(mcid, lCentrality); } } void effK0sProcessGen(MCTrueTrackCandidates const& mcparts) { for (const auto& part : mcparts) { - const auto mcid = part.mcCollisionId(); - if (!part.has_mcCollision()) continue; if (part.pdgCode() != kPDGK0s) continue; if (!part.isPhysicalPrimary()) continue; - if (allowedMcIds.find(mcid) == allowedMcIds.end()) + if (std::abs(part.y()) > SecondaryCuts.cfgSecondaryRapidityMax) continue; - auto iter = centByMcIds.find(mcid); - if (iter == centByMcIds.end()) + const auto mcid = part.mcCollisionId(); + if (allowedMcIds.count(mcid) == 0) continue; - const float lCentrality = iter->second; - - if (std::abs(part.y()) > SecondaryCuts.cfgSecondaryRapidityMax) + auto iter = centTruthByAllowed.find(mcid); + if (iter == centTruthByAllowed.end()) continue; + const float lCentrality = iter->second; + histos.fill(HIST("EffK0s/genK0s"), part.pt(), lCentrality); } } @@ -759,14 +819,11 @@ struct Chk892pp { const auto mcid = coll.mcCollisionId(); - if (allowedMcIds.find(mcid) == allowedMcIds.end()) - continue; - - auto iter = centByMcIds.find(mcid); - if (iter == centByMcIds.end()) + if (allowedMcIds.count(mcid) == 0) continue; - const float lCentrality = iter->second; + const auto mccoll = coll.template mcCollision_as>(); + const float lCentrality = mccoll.centFT0M(); const double ptreco = v0.pt(); const double yreco = v0.yK0Short(); @@ -845,23 +902,23 @@ struct Chk892pp { void effKstarProcessGen(MCTrueTrackCandidates const& mcparts) { for (const auto& part : mcparts) { - const auto mcid = part.mcCollisionId(); if (!part.has_mcCollision()) continue; if (std::abs(part.pdgCode()) != kKstarPlus) continue; - if (allowedMcIds.find(mcid) == allowedMcIds.end()) + if (std::abs(part.y()) > KstarCuts.cfgKstarMaxRap) continue; - auto iter = centByMcIds.find(mcid); - if (iter == centByMcIds.end()) + const auto mcid = part.mcCollisionId(); + if (allowedMcIds.count(mcid) == 0) continue; - const float lCentrality = iter->second; - - if (std::abs(part.y()) > KstarCuts.cfgKstarMaxRap) + auto iter = centTruthByAllowed.find(mcid); + if (iter == centTruthByAllowed.end()) continue; + const float lCentrality = iter->second; + histos.fill(HIST("EffKstar/genKstar"), part.pt(), lCentrality); } } // effKstarProcessGen @@ -877,14 +934,11 @@ struct Chk892pp { const auto mcid = coll.mcCollisionId(); - if (allowedMcIds.find(mcid) == allowedMcIds.end()) + if (allowedMcIds.count(mcid) == 0) continue; - auto iter = centByMcIds.find(mcid); - if (iter == centByMcIds.end()) - continue; - - const float lCentrality = iter->second; + const auto mccoll = coll.template mcCollision_as>(); + const float lCentrality = mccoll.centFT0M(); if (!SecondaryCuts.cfgByPassDauPIDSelection) { auto posDauTrack = v0.template posTrack_as(); @@ -901,7 +955,6 @@ struct Chk892pp { for (const auto& bTrack : trks) { if (bTrack.collisionId() != v0.collisionId()) continue; - if (!trackCut(bTrack)) continue; if (!selectionPIDPion(bTrack)) @@ -927,6 +980,54 @@ struct Chk892pp { } } // effKstarProcessReco + void fillSigLossNum(MCTrueTrackCandidates const& mcparts) + { + for (auto const& part : mcparts) { + if (!part.has_mcCollision()) + continue; + if (std::abs(part.pdgCode()) != kKstarPlus) + continue; + if (std::abs(part.y()) > KstarCuts.cfgKstarMaxRap) + continue; + + const auto mcid = part.mcCollisionId(); + if (allowedMcIds.count(mcid) == 0) + continue; + + auto iter = centTruthByAllowed.find(mcid); + if (iter == centTruthByAllowed.end()) + continue; + + const float lCentrality = iter->second; + + histos.fill(HIST("Correction/sigLoss_num"), part.pt(), lCentrality); + } + } // fillSigLossNum + + void fillSigLossDen(MCTrueTrackCandidates const& mcparts) + { + for (auto const& part : mcparts) { + if (!part.has_mcCollision()) + continue; + if (std::abs(part.pdgCode()) != kKstarPlus) + continue; + if (std::abs(part.y()) > KstarCuts.cfgKstarMaxRap) + continue; + + const auto mcid = part.mcCollisionId(); + if (refClassIds.count(mcid) == 0) + continue; + + auto iter = refCentByMcId.find(mcid); + if (iter == refCentByMcId.end()) + continue; + + const float lCentrality = iter->second; + + histos.fill(HIST("Correction/sigLoss_den"), part.pt(), lCentrality); + } + } // fillSigLossDen + int count = 0; template @@ -1157,7 +1258,6 @@ struct Chk892pp { } // fillHistograms - // process data void processData(EventCandidates::iterator const& collision, TrackCandidates const& tracks, V0Candidates const& v0s, @@ -1179,19 +1279,77 @@ struct Chk892pp { } PROCESS_SWITCH(Chk892pp, processData, "Process Event for data without Partitioning", false); - // process MC reconstructed level void processMC(MCTrueTrackCandidates const& mcpart, MCTrackCandidates const& tracks, MCV0Candidates const& v0s, - MCEventCandidates const& events) + MCEventCandidates const& events, + soa::Join const& mccolls) { buildAllowedMcIds(events); + buildReferenceMcIds(mccolls, mcpart); effK0sProcessGen(mcpart); effK0sProcessReco(v0s); effKstarProcessGen(mcpart); effKstarProcessReco(v0s, tracks); + fillSigLossNum(mcpart); + fillSigLossDen(mcpart); + + for (const auto& mcid : refClassIds) { + histos.fill(HIST("Correction/EF_den"), refCentByMcId[mcid]); + } + for (const auto& mcid : allowedMcIds) { + auto iter = centTruthByAllowed.find(mcid); + if (iter == centTruthByAllowed.end()) + continue; + + const float lCentrality = iter->second; + histos.fill(HIST("Correction/EF_num"), lCentrality); + } + + size_t nIntersect = 0; + for (const auto& mcid : allowedMcIds) + if (refClassIds.count(mcid)) + nIntersect++; + histos.fill(HIST("Correction/setSizes"), 0.0, refClassIds.size()); + histos.fill(HIST("Correction/setSizes"), 1.0, allowedMcIds.size()); + histos.fill(HIST("Correction/setSizes"), 2.0, nIntersect); + histos.fill(HIST("Correction/setSizes"), 3.0, allowedMcIds.size() - nIntersect); + + for (const auto& mcc : mccolls) { + histos.fill(HIST("Correction/MCTruthCent_all"), mcc.centFT0M()); + } + + for (const auto& mcid : refClassIds) { + auto iter = refCentByMcId.find(mcid); + if (iter == refCentByMcId.end()) + continue; + lCentrality = iter->second; + histos.fill(HIST("Correction/MCTruthCent_cut"), lCentrality); + } + + for (auto const& mcc : mccolls) { + const auto mcid = mcc.globalIndex(); + + histos.fill(HIST("Correction/hNEventsMCTruth"), 1.0); + + bool passZvtx = true; + if (cfgTruthIncludeZvtx && std::abs(mcc.posZ()) > EventCuts.cfgEvtZvtx) { + passZvtx = false; + } + if (passZvtx) { + histos.fill(HIST("Correction/hNEventsMCTruth"), 2.0); + + auto partsThisMc = mcpart.sliceBy(perMCCollision, mcid); + if (pwglf::isINELgtNmc(partsThisMc, 0, pdg)) { + histos.fill(HIST("Correction/hNEventsMCTruth"), 3.0); + } + } + if (allowedMcIds.count(mcid)) { + histos.fill(HIST("Correction/hNEventsMCTruth"), 4.0); + } + } } - PROCESS_SWITCH(Chk892pp, processMC, "Process Event for MC", false); + PROCESS_SWITCH(Chk892pp, processMC, "Process Event for MC", true); void processMCQA(MCEventCandidates::iterator const& collision, MCTrackCandidates const& tracks, @@ -1202,17 +1360,21 @@ struct Chk892pp { return; if (EventCuts.cfgEvtUseRCTFlagChecker && !rctChecker(collision)) return; + if (!collision.isInelGt0()) + return; - lCentrality = getCentrality(collision); - if (lCentrality < EventCuts.cfgEventCentralityMin || lCentrality > EventCuts.cfgEventCentralityMax) + if (!collision.has_mcCollision()) return; - if (!collision.isInelGt0()) + auto mccoll = collision.template mcCollision_as>(); + const float lCentrality = mccoll.centFT0M(); + + if (lCentrality < EventCuts.cfgEventCentralityMin || lCentrality > EventCuts.cfgEventCentralityMax) return; colCuts.fillQA(collision); fillHistograms(collision, tracks, v0s); } - PROCESS_SWITCH(Chk892pp, processMCQA, "Process Event for MC and fill QA plots", true); + PROCESS_SWITCH(Chk892pp, processMCQA, "Process Event for MC and fill QA plots", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 090fcb6c137008b48d1575a094c31bbde14e0ebb Mon Sep 17 00:00:00 2001 From: arvindkhuntia <31609955+arvindkhuntia@users.noreply.github.com> Date: Sun, 26 Oct 2025 19:51:44 +0100 Subject: [PATCH 905/986] [PWGJE] New histograms for MC and additional ev. sel. (#13542) Co-authored-by: Arvind Khuntia --- PWGJE/Tasks/nucleiInJets.cxx | 116 +++++++++++++++++++++++++++++++---- 1 file changed, 104 insertions(+), 12 deletions(-) diff --git a/PWGJE/Tasks/nucleiInJets.cxx b/PWGJE/Tasks/nucleiInJets.cxx index e60839c00f0..4afacbe3919 100644 --- a/PWGJE/Tasks/nucleiInJets.cxx +++ b/PWGJE/Tasks/nucleiInJets.cxx @@ -115,6 +115,8 @@ struct nucleiInJets { Configurable isWithLeadingJet{"isWithLeadingJet", true, "Events with leading jet"}; Configurable useLfTpcPid{"useLfTpcPid", true, "Events with custom TPC parameters"}; Configurable centralityType{"centralityType", 0, "0: FT0M, 1: FT0C, 2: FV0A"}; + Configurable> cfgOccupancyRange{"cfgOccupancyRange", {0, 1000}, "Occupancy selection"}; + Configurable useOccupancy{"useOccupancy", true, "Events with custom occupancy selection"}; Configurable cfgtrkMinPt{"cfgtrkMinPt", 0.15, "set track min pT"}; Configurable cfgtrkMaxEta{"cfgtrkMaxEta", 0.8, "set track max Eta"}; @@ -171,6 +173,9 @@ struct nucleiInJets { Configurable applySkim{"applySkim", false, "Apply skimming"}; Configurable cfgSkim{"cfgSkim", "fHighFt0Mult", "Configurable for skimming"}; + Configurable sel8Coll{"sel8Coll", true, "sel8Coll for collisions"}; + Configurable selNoSameBunchPileup{"selNoSameBunchPileup", false, "selNoSameBunchPileup for collisions"}; + Configurable selIsGoodZvtxFT0vsPV{"selIsGoodZvtxFT0vsPV", false, "selIsGoodZvtxFT0vsPV for collisions"}; // using EventTable = soa::Join; using EventTable = aod::JetCollisions; @@ -235,10 +240,13 @@ struct nucleiInJets { jetHist.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(4, "Sel8+|Vz|<10"); jetHist.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(5, "nJets>0"); - jetHist.add("hNEventsInc", "hNEventsInc", {HistType::kTH1D, {{4, 0.f, 4.f}}}); + jetHist.add("hNEventsInc", "hNEventsInc", {HistType::kTH1D, {{6, 0.f, 6.f}}}); jetHist.get(HIST("hNEventsInc"))->GetXaxis()->SetBinLabel(1, "All"); jetHist.get(HIST("hNEventsInc"))->GetXaxis()->SetBinLabel(2, "Sel8"); jetHist.get(HIST("hNEventsInc"))->GetXaxis()->SetBinLabel(3, "|Vz|<10"); + jetHist.get(HIST("hNEventsInc"))->GetXaxis()->SetBinLabel(4, "noSameBunchPileup"); + jetHist.get(HIST("hNEventsInc"))->GetXaxis()->SetBinLabel(5, "isGoodZvtxFT0vsPV"); + jetHist.get(HIST("hNEventsInc"))->GetXaxis()->SetBinLabel(6, "OccupancySel"); jetHist.add("hNEventsIncVsCent", "hNEventsIncVsCent", {HistType::kTH2D, {{vzAxis}, {CentAxis}}}); @@ -490,6 +498,9 @@ struct nucleiInJets { jetHist.get(HIST("recInc/eventStat"))->GetXaxis()->SetBinLabel(1, "All"); jetHist.get(HIST("recInc/eventStat"))->GetXaxis()->SetBinLabel(2, "Sel8"); jetHist.get(HIST("recInc/eventStat"))->GetXaxis()->SetBinLabel(3, "|Vz|<10"); + jetHist.get(HIST("recInc/eventStat"))->GetXaxis()->SetBinLabel(4, "noSameBunchPileup"); + jetHist.get(HIST("recInc/eventStat"))->GetXaxis()->SetBinLabel(5, "isGoodZvtxFT0vsPV"); + jetHist.get(HIST("recInc/eventStat"))->GetXaxis()->SetBinLabel(6, "OccupancySel"); jetHist.add("recInc/vertexZ", "vertexZ (inclusive)", HistType::kTH2F, {{vzAxis}, {CentAxis}}); jetHist.add("recInc/pt/PtParticleTypeTPC", "Pt vs ParticleType vs Centrality (TPC)", HistType::kTH3F, {{100, 0.f, 10.f}, {14, -7, 7}, {100, 0, 100}}); @@ -499,6 +510,10 @@ struct nucleiInJets { jetHist.add("recInc/eff/tpcTrack3D", "Pt vs ParticleType vs Centrality (tpc)", HistType::kTH3F, {{100, 0.f, 10.f}, {14, -7, 7}, {100, 0, 100}}); jetHist.add("recInc/eff/tpcTofTrack3D", "Pt vs ParticleType vs Centrality (tpc-tof)", HistType::kTH3F, {{100, 0.f, 10.f}, {14, -7, 7}, {100, 0, 100}}); + + jetHist.add("recInc/dcaxy/rec/tpcPtVsDcaxy3D", "pT(p) vs ParticleType (p) vs Dcaxy", HistType::kTHnSparseF, {{100, 0.f, 10.f}, {14, -7, 7}, {100, 0, 100}, dcaxyAxis, {4, 0, 4}}); // pt, parttype, cent, dcaxy, partOrigin + jetHist.add("recInc/dcaxy/rec/tpcPtVsDcaxy3DPIDselected", "pT(p) vs ParticleType (p) vs Dcaxy", HistType::kTHnSparseF, {{100, 0.f, 10.f}, {14, -7, 7}, {100, 0, 100}, dcaxyAxis, {4, 0, 4}}); // pt, parttype, cent, dcaxy, partOrigin + // inside jet jetHist.add("tracks/mc/proton/h3PtVsProtonNSigmaTPCVsPtJet_jet", "pT(p) vs NSigmaTPC (p) vs jet pT; #it{p}_{T} (GeV/#it{c}; NSigmaTPC; p^{jet}_{T}", HistType::kTH3F, {{PtAxis}, {200, -10, 10}, {PtJetAxis}}); jetHist.add("tracks/mc/antiProton/h3PtVsantiProtonNSigmaTPCVsPtJet_jet", "pT(#bar{p}) vs NSigmaTPC (#bar{p}) vs jet pT; #it{p}_{T} (GeV/#it{c}; NSigmaTPC; p^{jet}_{T}", HistType::kTH3F, {{PtAxis}, {200, -10, 10}, {PtJetAxis}}); @@ -660,7 +675,7 @@ struct nucleiInJets { } template - bool isTrackSelected(const TrackType track) + bool isTrackSelectedWithoutDcaxy(const TrackType track) { // standard track selection if (track.pt() < cfgtrkMinPt) @@ -675,10 +690,6 @@ struct nucleiInJets { } if (std::fabs(track.eta()) > cfgtrkMaxEta) return false; - if (std::fabs(track.dcaXY()) > cfgMaxDCArToPVcut && !useDcaxyPtDepCut) - return false; - if (std::fabs(track.dcaXY()) > dcaXYPtDepCut(track.pt()) && useDcaxyPtDepCut) - return false; if (std::fabs(track.dcaZ()) > cfgMaxDCAzToPVcut) return false; if (track.tpcNClsFindable() < cfgnFindableTPCClusters) @@ -694,6 +705,29 @@ struct nucleiInJets { return true; } + template + bool isTrackSelected(const TrackType track) + { + if (!isTrackSelectedWithoutDcaxy(track)) + return false; + if (std::fabs(track.dcaXY()) > cfgMaxDCArToPVcut && !useDcaxyPtDepCut) + return false; + if (std::fabs(track.dcaXY()) > dcaXYPtDepCut(track.pt()) && useDcaxyPtDepCut) + return false; + + return true; + } + + template + bool isOccupancyAccepted(const coll& collision) + { + auto occupancy{collision.trackOccupancyInTimeRange()}; + if (occupancy < cfgOccupancyRange->at(0) || occupancy > cfgOccupancyRange->at(1)) + return false; + else + return true; + } + int nEvents = 0; template void fillTrackInfo(const TracksType& trk, const JetType& jets, std::vector& leadingJetPtEtaPhi) @@ -1345,13 +1379,28 @@ struct nucleiInJets { { jetHist.fill(HIST("hNEventsInc"), 0.5); - if (!jetderiveddatautilities::selectCollision(coll, jetderiveddatautilities::initialiseEventSelectionBits("sel8"))) - return; + bool isSel8 = jetderiveddatautilities::selectCollision(coll, jetderiveddatautilities::initialiseEventSelectionBits("sel8")); + bool isSelNoSameBunchPileup = jetderiveddatautilities::selectCollision(coll, jetderiveddatautilities::initialiseEventSelectionBits("selNoSameBunchPileup")); + bool isSelIsGoodZvtxFT0vsPV = jetderiveddatautilities::selectCollision(coll, jetderiveddatautilities::initialiseEventSelectionBits("selIsGoodZvtxFT0vsPV")); + if (sel8Coll && !isSel8) + return; jetHist.fill(HIST("hNEventsInc"), 1.5); + if (std::abs(coll.posZ()) > 10) // bad vertex return; jetHist.fill(HIST("hNEventsInc"), 2.5); + if (selNoSameBunchPileup && !isSelNoSameBunchPileup) + return; + jetHist.fill(HIST("hNEventsInc"), 3.5); + if (selIsGoodZvtxFT0vsPV && !isSelIsGoodZvtxFT0vsPV) + return; + jetHist.fill(HIST("hNEventsInc"), 4.5); + + if (useOccupancy && !isOccupancyAccepted(coll)) + return; + jetHist.fill(HIST("hNEventsInc"), 5.5); + float centrality = -999; switch (centralityType) { case 0: // FT0M @@ -1963,12 +2012,31 @@ struct nucleiInJets { void processRecInc(EventTableMC::iterator const& coll, TrackCandidatesIncMC const& tracks, aod::JetParticles const& particleTracks, aod::JMcCollisions const&) { jetHist.fill(HIST("recInc/eventStat"), 0.5); - if (!jetderiveddatautilities::selectCollision(coll, jetderiveddatautilities::initialiseEventSelectionBits("sel8"))) + + bool isSel8 = jetderiveddatautilities::selectCollision(coll, jetderiveddatautilities::initialiseEventSelectionBits("sel8")); + bool isSelNoSameBunchPileup = jetderiveddatautilities::selectCollision(coll, jetderiveddatautilities::initialiseEventSelectionBits("selNoSameBunchPileup")); + bool isSelIsGoodZvtxFT0vsPV = jetderiveddatautilities::selectCollision(coll, jetderiveddatautilities::initialiseEventSelectionBits("selIsGoodZvtxFT0vsPV")); + + if (sel8Coll && !isSel8) return; jetHist.fill(HIST("recInc/eventStat"), 1.5); + if (std::abs(coll.posZ()) > 10) // bad vertex return; jetHist.fill(HIST("recInc/eventStat"), 2.5); + if (selNoSameBunchPileup && !isSelNoSameBunchPileup) + return; + jetHist.fill(HIST("recInc/eventStat"), 3.5); + if (selIsGoodZvtxFT0vsPV && !isSelIsGoodZvtxFT0vsPV) + return; + jetHist.fill(HIST("recInc/eventStat"), 4.5); + + if (useOccupancy && !isOccupancyAccepted(coll)) + return; + jetHist.fill(HIST("recInc/eventStat"), 5.5); + + // if (!jetderiveddatautilities::selectCollision(coll, jetderiveddatautilities::initialiseEventSelectionBits("sel8"))) + // return; float centrality = -999; switch (centralityType) { @@ -1987,7 +2055,7 @@ struct nucleiInJets { jetHist.fill(HIST("recInc/vertexZ"), coll.posZ(), centrality); for (const auto& track : tracks) { - if (!isTrackSelected(track)) { + if (!isTrackSelectedWithoutDcaxy(track)) { continue; } if (!track.has_mcParticle()) @@ -1996,13 +2064,37 @@ struct nucleiInJets { continue; auto mcTrack = track.mcParticle_as(); - if (!mcTrack.isPhysicalPrimary()) + + // require mc getProcess to get Decay and Material secondaries + int particleOriginType = 0; + auto isMcPrimary = false; + // auto isMcTransport = false; // auto isMcSecondaryFromMaterial = false; auto isMcSecondaryFromWeakDecay = false; + if (mcTrack.isPhysicalPrimary()) { + isMcPrimary = true; + particleOriginType = 1; + } else if (mcTrack.getGenStatusCode() == -1) { + // isMcTransport = true; + particleOriginType = 2; + } + + // Fill DCAxy histograms + jetHist.fill(HIST("recInc/dcaxy/rec/tpcPtVsDcaxy3D"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality, track.dcaXY(), particleOriginType); + if (std::abs(track.tpcNSigmaPr()) < cfgnTPCPIDPr) + jetHist.fill(HIST("recInc/dcaxy/rec/tpcPtVsDcaxy3DPIDselected"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality, track.dcaXY(), particleOriginType); + + if (!isMcPrimary) + continue; + + // DCAxy selection for rest of the analysis + if (std::fabs(track.dcaXY()) > cfgMaxDCArToPVcut && !useDcaxyPtDepCut) + continue; + if (std::fabs(track.dcaXY()) > dcaXYPtDepCut(track.pt()) && useDcaxyPtDepCut) continue; auto mass = TDatabasePDG::Instance()->GetParticle(abs(mcTrack.pdgCode()))->Mass(); auto rapidity = RecoDecay::y(std::array{track.px(), track.py(), track.pz()}, mass); - if (rapidity > cfgtrkMaxRap) + if (std::abs(rapidity) > cfgtrkMaxRap) continue; // Proton if (std::abs(mcTrack.pdgCode()) == 2212) { // Proton From be2972b13e7d7ec2ec28d9d99edd15e4baf8fc70 Mon Sep 17 00:00:00 2001 From: YubiaoWang Date: Sun, 26 Oct 2025 19:52:06 +0100 Subject: [PATCH 906/986] [PWGJE] Update RM to support median rho and local rho, and add non-eventplane RMs for check and compare (#13523) --- PWGJE/Tasks/jetChargedV2.cxx | 127 +++++++++++++++++++++++++++++------ 1 file changed, 108 insertions(+), 19 deletions(-) diff --git a/PWGJE/Tasks/jetChargedV2.cxx b/PWGJE/Tasks/jetChargedV2.cxx index 008cd65ca02..938275ca5ce 100644 --- a/PWGJE/Tasks/jetChargedV2.cxx +++ b/PWGJE/Tasks/jetChargedV2.cxx @@ -127,6 +127,8 @@ struct JetChargedV2 { Configurable checkLeadConstituentPtForMcpJets{"checkLeadConstituentPtForMcpJets", false, "flag to choose whether particle level jets should have their lead track pt above leadingConstituentPtMin to be accepted; off by default, as leadingConstituentPtMin cut is only applied on MCD jets for the Pb-Pb analysis using pp MC anchored to Pb-Pb for the response matrix"}; Configurable cfgChkFitQuality{"cfgChkFitQuality", false, "check fit quality"}; Configurable subtractMCPBackground{"subtractMCPBackground", true, "subtract MCP Background with General Purpose anchored MC"}; + Configurable useMedianRho{"useMedianRho", false, "use median rho for subtract MCP Background"}; + Configurable useLocalRho{"useLocalRho", false, "use local rho for subtract MCP Background"}; template int getDetId(const T& name) @@ -371,23 +373,51 @@ struct JetChargedV2 { registry.add("h_mc_zvertex", "position of collision ;#it{Z} (cm)", {HistType::kTH1F, {{300, -15.0, 15.0}}}); } - if (doprocessJetsMatched) { + if (doprocessJetsMatchedSubtracted) { registry.add("h_mc_collisions_matched", "mc collisions status;event status;entries", {HistType::kTH1F, {{5, 0.0, 5.0}}}); registry.add("h_mcd_events_matched", "mcd event status;event status;entries", {HistType::kTH1F, {{6, 0.0, 6.0}}}); registry.add("h_mc_rho_matched", "mc collision rho;#rho (GeV/#it{c}); counts", {HistType::kTH1F, {{500, -100.0, 500.0}}}); registry.add("h_accept_Track_Match", "all and accept track;Track;entries", {HistType::kTH1F, {{10, 0.0, 10.0}}}); - registry.add("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_in_rhoareasubtracted_mcdetaconstraint", "corr pT mcd vs. corr cpT mcp in-plane;#it{p}_{T,jet}^{mcd} (GeV/#it{c});#it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, jetPtAxisRhoAreaSub}}); - registry.add("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_in_rhoareasubtracted_mcpetaconstraint", "corr pT mcd vs. corr cpT mcp in-plane;#it{p}_{T,jet}^{mcd} (GeV/#it{c});#it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, jetPtAxisRhoAreaSub}}); - registry.add("h2_jet_pt_mcp_jet_pt_diff_matchedgeo_in_rhoareasubtracted", "jet mcp corr pT vs. corr delta pT / jet mcp corr pt in-plane;#it{p}_{T,jet}^{mcp} (GeV/#it{c}); (#it{p}_{T,jet}^{mcp} (GeV/#it{c}) - #it{p}_{T,jet}^{mcd} (GeV/#it{c})) / #it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, {1000, -5.0, 5.0}}}); - registry.add("h2_jet_pt_mcd_jet_pt_diff_matchedgeo_in_rhoareasubtracted", "jet mcd corr pT vs. corr delta pT / jet mcd corr pt in-plane;#it{p}_{T,jet}^{mcd} (GeV/#it{c}); (#it{p}_{T,jet}^{mcd} (GeV/#it{c}) - #it{p}_{T,jet}^{mcp} (GeV/#it{c})) / #it{p}_{T,jet}^{mcd} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, {1000, -5.0, 5.0}}}); - registry.add("h2_jet_pt_mcp_jet_pt_ratio_matchedgeo_in_rhoareasubtracted", "jet mcp corr pT vs. jet mcd corr pT / jet mcp corr pt in-plane;#it{p}_{T,jet}^{mcp} (GeV/#it{c}); #it{p}_{T,jet}^{mcd} (GeV/#it{c}) / #it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, {1000, -5.0, 5.0}}}); + if (useMedianRho) { + registry.add("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_mcdetaconstraint", "pT mcd vs. pT mcp;#it{p}_{T,jet}^{mcd} (GeV/#it{c});#it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, jetPtAxisRhoAreaSub}}); + registry.add("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_mcpetaconstraint", "pT mcd vs. pT mcp;#it{p}_{T,jet}^{mcd} (GeV/#it{c});#it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, jetPtAxisRhoAreaSub}}); + registry.add("h2_jet_pt_mcp_jet_pt_diff_matchedgeo", "jet mcp pT vs. delta pT / jet mcp pt;#it{p}_{T,jet}^{mcp} (GeV/#it{c}); (#it{p}_{T,jet}^{mcp} (GeV/#it{c}) - #it{p}_{T,jet}^{mcd} (GeV/#it{c})) / #it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxis, {1000, -5.0, 2.0}}}); + registry.add("h2_jet_pt_mcd_jet_pt_diff_matchedgeo", "jet mcd pT vs. delta pT / jet mcd pt;#it{p}_{T,jet}^{mcd} (GeV/#it{c}); (#it{p}_{T,jet}^{mcd} (GeV/#it{c}) - #it{p}_{T,jet}^{mcp} (GeV/#it{c})) / #it{p}_{T,jet}^{mcd} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxis, {1000, -5.0, 2.0}}}); + registry.add("h2_jet_pt_mcp_jet_pt_ratio_matchedgeo", "jet mcp pT vs. jet mcd pT / jet mcp pt;#it{p}_{T,jet}^{mcp} (GeV/#it{c}); #it{p}_{T,jet}^{mcd} (GeV/#it{c}) / #it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxis, {1000, -5.0, 5.0}}}); + + registry.add("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_in_mcdetaconstraint", "corr pT mcd vs. corr cpT mcp in-plane;#it{p}_{T,jet}^{mcd} (GeV/#it{c});#it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, jetPtAxisRhoAreaSub}}); + registry.add("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_in_mcpetaconstraint", "corr pT mcd vs. corr cpT mcp in-plane;#it{p}_{T,jet}^{mcd} (GeV/#it{c});#it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, jetPtAxisRhoAreaSub}}); + registry.add("h2_jet_pt_mcp_jet_pt_diff_matchedgeo_in", "jet mcp corr pT vs. corr delta pT / jet mcp corr pt in-plane;#it{p}_{T,jet}^{mcp} (GeV/#it{c}); (#it{p}_{T,jet}^{mcp} (GeV/#it{c}) - #it{p}_{T,jet}^{mcd} (GeV/#it{c})) / #it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, {1000, -5.0, 5.0}}}); + registry.add("h2_jet_pt_mcd_jet_pt_diff_matchedgeo_in", "jet mcd corr pT vs. corr delta pT / jet mcd corr pt in-plane;#it{p}_{T,jet}^{mcd} (GeV/#it{c}); (#it{p}_{T,jet}^{mcd} (GeV/#it{c}) - #it{p}_{T,jet}^{mcp} (GeV/#it{c})) / #it{p}_{T,jet}^{mcd} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, {1000, -5.0, 5.0}}}); + registry.add("h2_jet_pt_mcp_jet_pt_ratio_matchedgeo_in", "jet mcp corr pT vs. jet mcd corr pT / jet mcp corr pt in-plane;#it{p}_{T,jet}^{mcp} (GeV/#it{c}); #it{p}_{T,jet}^{mcd} (GeV/#it{c}) / #it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, {1000, -5.0, 5.0}}}); + + registry.add("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_out_mcdetaconstraint", "corr pT mcd vs. corr cpT mcp out-of-plane;#it{p}_{T,jet}^{mcd} (GeV/#it{c});#it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, jetPtAxisRhoAreaSub}}); + registry.add("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_out_mcpetaconstraint", "corr pT mcd vs. corr cpT mcp out-of-plane;#it{p}_{T,jet}^{mcd} (GeV/#it{c});#it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, jetPtAxisRhoAreaSub}}); + registry.add("h2_jet_pt_mcp_jet_pt_diff_matchedgeo_out", "jet mcp corr pT vs. corr delta pT / jet mcp corr pt out-of-plane;#it{p}_{T,jet}^{mcp} (GeV/#it{c}); (#it{p}_{T,jet}^{mcp} (GeV/#it{c}) - #it{p}_{T,jet}^{mcd} (GeV/#it{c})) / #it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, {1000, -5.0, 5.0}}}); + registry.add("h2_jet_pt_mcd_jet_pt_diff_matchedgeo_out", "jet mcd corr pT vs. corr delta pT / jet mcd corr pt out-of-plane;#it{p}_{T,jet}^{mcd} (GeV/#it{c}); (#it{p}_{T,jet}^{mcd} (GeV/#it{c}) - #it{p}_{T,jet}^{mcp} (GeV/#it{c})) / #it{p}_{T,jet}^{mcd} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, {1000, -5.0, 5.0}}}); + registry.add("h2_jet_pt_mcp_jet_pt_ratio_matchedgeo_out", "jet mcp corr pT vs. jet mcd corr pT / jet mcp corr pt out-of-plane;#it{p}_{T,jet}^{mcp} (GeV/#it{c}); #it{p}_{T,jet}^{mcd} (GeV/#it{c}) / #it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, {1000, -5.0, 5.0}}}); + } - registry.add("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_out_rhoareasubtracted_mcdetaconstraint", "corr pT mcd vs. corr cpT mcp out-of-plane;#it{p}_{T,jet}^{mcd} (GeV/#it{c});#it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, jetPtAxisRhoAreaSub}}); - registry.add("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_out_rhoareasubtracted_mcpetaconstraint", "corr pT mcd vs. corr cpT mcp out-of-plane;#it{p}_{T,jet}^{mcd} (GeV/#it{c});#it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, jetPtAxisRhoAreaSub}}); - registry.add("h2_jet_pt_mcp_jet_pt_diff_matchedgeo_out_rhoareasubtracted", "jet mcp corr pT vs. corr delta pT / jet mcp corr pt out-of-plane;#it{p}_{T,jet}^{mcp} (GeV/#it{c}); (#it{p}_{T,jet}^{mcp} (GeV/#it{c}) - #it{p}_{T,jet}^{mcd} (GeV/#it{c})) / #it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, {1000, -5.0, 5.0}}}); - registry.add("h2_jet_pt_mcd_jet_pt_diff_matchedgeo_out_rhoareasubtracted", "jet mcd corr pT vs. corr delta pT / jet mcd corr pt out-of-plane;#it{p}_{T,jet}^{mcd} (GeV/#it{c}); (#it{p}_{T,jet}^{mcd} (GeV/#it{c}) - #it{p}_{T,jet}^{mcp} (GeV/#it{c})) / #it{p}_{T,jet}^{mcd} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, {1000, -5.0, 5.0}}}); - registry.add("h2_jet_pt_mcp_jet_pt_ratio_matchedgeo_out_rhoareasubtracted", "jet mcp corr pT vs. jet mcd corr pT / jet mcp corr pt out-of-plane;#it{p}_{T,jet}^{mcp} (GeV/#it{c}); #it{p}_{T,jet}^{mcd} (GeV/#it{c}) / #it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, {1000, -5.0, 5.0}}}); + if (useLocalRho) { + registry.add("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_incl_rhoareasubtracted_mcdetaconstraint", "corr pT mcd vs. corr cpT mcp in-plane;#it{p}_{T,jet}^{mcd} (GeV/#it{c});#it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, jetPtAxisRhoAreaSub}}); + registry.add("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_incl_rhoareasubtracted_mcpetaconstraint", "corr pT mcd vs. corr cpT mcp in-plane;#it{p}_{T,jet}^{mcd} (GeV/#it{c});#it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, jetPtAxisRhoAreaSub}}); + registry.add("h2_jet_pt_mcp_jet_pt_diff_matchedgeo_incl_rhoareasubtracted", "jet mcp corr pT vs. corr delta pT / jet mcp corr pt in-plane;#it{p}_{T,jet}^{mcp} (GeV/#it{c}); (#it{p}_{T,jet}^{mcp} (GeV/#it{c}) - #it{p}_{T,jet}^{mcd} (GeV/#it{c})) / #it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, {1000, -5.0, 5.0}}}); + registry.add("h2_jet_pt_mcd_jet_pt_diff_matchedgeo_incl_rhoareasubtracted", "jet mcd corr pT vs. corr delta pT / jet mcd corr pt in-plane;#it{p}_{T,jet}^{mcd} (GeV/#it{c}); (#it{p}_{T,jet}^{mcd} (GeV/#it{c}) - #it{p}_{T,jet}^{mcp} (GeV/#it{c})) / #it{p}_{T,jet}^{mcd} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, {1000, -5.0, 5.0}}}); + registry.add("h2_jet_pt_mcp_jet_pt_ratio_matchedgeo_incl_rhoareasubtracted", "jet mcp corr pT vs. jet mcd corr pT / jet mcp corr pt in-plane;#it{p}_{T,jet}^{mcp} (GeV/#it{c}); #it{p}_{T,jet}^{mcd} (GeV/#it{c}) / #it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, {1000, -5.0, 5.0}}}); + + registry.add("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_in_rhoareasubtracted_mcdetaconstraint", "corr pT mcd vs. corr cpT mcp in-plane;#it{p}_{T,jet}^{mcd} (GeV/#it{c});#it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, jetPtAxisRhoAreaSub}}); + registry.add("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_in_rhoareasubtracted_mcpetaconstraint", "corr pT mcd vs. corr cpT mcp in-plane;#it{p}_{T,jet}^{mcd} (GeV/#it{c});#it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, jetPtAxisRhoAreaSub}}); + registry.add("h2_jet_pt_mcp_jet_pt_diff_matchedgeo_in_rhoareasubtracted", "jet mcp corr pT vs. corr delta pT / jet mcp corr pt in-plane;#it{p}_{T,jet}^{mcp} (GeV/#it{c}); (#it{p}_{T,jet}^{mcp} (GeV/#it{c}) - #it{p}_{T,jet}^{mcd} (GeV/#it{c})) / #it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, {1000, -5.0, 5.0}}}); + registry.add("h2_jet_pt_mcd_jet_pt_diff_matchedgeo_in_rhoareasubtracted", "jet mcd corr pT vs. corr delta pT / jet mcd corr pt in-plane;#it{p}_{T,jet}^{mcd} (GeV/#it{c}); (#it{p}_{T,jet}^{mcd} (GeV/#it{c}) - #it{p}_{T,jet}^{mcp} (GeV/#it{c})) / #it{p}_{T,jet}^{mcd} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, {1000, -5.0, 5.0}}}); + registry.add("h2_jet_pt_mcp_jet_pt_ratio_matchedgeo_in_rhoareasubtracted", "jet mcp corr pT vs. jet mcd corr pT / jet mcp corr pt in-plane;#it{p}_{T,jet}^{mcp} (GeV/#it{c}); #it{p}_{T,jet}^{mcd} (GeV/#it{c}) / #it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, {1000, -5.0, 5.0}}}); + + registry.add("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_out_rhoareasubtracted_mcdetaconstraint", "corr pT mcd vs. corr cpT mcp out-of-plane;#it{p}_{T,jet}^{mcd} (GeV/#it{c});#it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, jetPtAxisRhoAreaSub}}); + registry.add("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_out_rhoareasubtracted_mcpetaconstraint", "corr pT mcd vs. corr cpT mcp out-of-plane;#it{p}_{T,jet}^{mcd} (GeV/#it{c});#it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, jetPtAxisRhoAreaSub}}); + registry.add("h2_jet_pt_mcp_jet_pt_diff_matchedgeo_out_rhoareasubtracted", "jet mcp corr pT vs. corr delta pT / jet mcp corr pt out-of-plane;#it{p}_{T,jet}^{mcp} (GeV/#it{c}); (#it{p}_{T,jet}^{mcp} (GeV/#it{c}) - #it{p}_{T,jet}^{mcd} (GeV/#it{c})) / #it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, {1000, -5.0, 5.0}}}); + registry.add("h2_jet_pt_mcd_jet_pt_diff_matchedgeo_out_rhoareasubtracted", "jet mcd corr pT vs. corr delta pT / jet mcd corr pt out-of-plane;#it{p}_{T,jet}^{mcd} (GeV/#it{c}); (#it{p}_{T,jet}^{mcd} (GeV/#it{c}) - #it{p}_{T,jet}^{mcp} (GeV/#it{c})) / #it{p}_{T,jet}^{mcd} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, {1000, -5.0, 5.0}}}); + registry.add("h2_jet_pt_mcp_jet_pt_ratio_matchedgeo_out_rhoareasubtracted", "jet mcp corr pT vs. jet mcd corr pT / jet mcp corr pt out-of-plane;#it{p}_{T,jet}^{mcp} (GeV/#it{c}); #it{p}_{T,jet}^{mcd} (GeV/#it{c}) / #it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, {1000, -5.0, 5.0}}}); + } } registry.add("h_accept_Track", "all and accept track;Track;entries", {HistType::kTH1F, {{10, 0.0, 10.0}}}); @@ -762,6 +792,56 @@ struct JetChargedV2 { registry.fill(HIST("h2_track_eta_track_phi"), track.eta(), track.phi(), weight); } + template + void fillGeoMatchedHistograms(TBase const& jetMCD, double ep2, float rho, float mcrho = 0.0, float weight = 1.0) + { + float pTHat = 10. / (std::pow(weight, 1.0 / pTHatExponent)); + if (jetMCD.pt() > pTHatMaxMCD * pTHat) { + return; + } + if (jetMCD.has_matchedJetGeo()) { + for (const auto& jetMCP : jetMCD.template matchedJetGeo_as>()) { + if (jetMCP.pt() > pTHatMaxMCD * pTHat) { + continue; + } + if (jetMCD.r() == round(selectedJetsRadius * 100.0f)) { + int evtPlnAngleA = 7; + int evtPlnAngleB = 3; + int evtPlnAngleC = 5; + double phiMinusPsi2 = jetMCD.phi() - ep2; + double corrTagjetpt = jetMCP.pt() - (mcrho * jetMCP.area()); + double corrBasejetpt = jetMCD.pt() - (rho * jetMCD.area()); + double dcorrpt = corrTagjetpt - corrBasejetpt; + if (jetfindingutilities::isInEtaAcceptance(jetMCD, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + registry.fill(HIST("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_mcdetaconstraint"), corrBasejetpt, corrTagjetpt, weight); + registry.fill(HIST("h2_jet_pt_mcd_jet_pt_diff_matchedgeo"), corrBasejetpt, dcorrpt / corrBasejetpt, weight); + if ((phiMinusPsi2 < o2::constants::math::PIQuarter) || (phiMinusPsi2 >= evtPlnAngleA * o2::constants::math::PIQuarter) || (phiMinusPsi2 >= evtPlnAngleB * o2::constants::math::PIQuarter && phiMinusPsi2 < evtPlnAngleC * o2::constants::math::PIQuarter)) { + registry.fill(HIST("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_in_mcdetaconstraint"), corrBasejetpt, corrTagjetpt, weight); + registry.fill(HIST("h2_jet_pt_mcd_jet_pt_diff_matchedgeo_in"), corrBasejetpt, dcorrpt / corrBasejetpt, weight); + } else { + registry.fill(HIST("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_out_mcdetaconstraint"), corrBasejetpt, corrTagjetpt, weight); + registry.fill(HIST("h2_jet_pt_mcd_jet_pt_diff_matchedgeo_out"), corrBasejetpt, dcorrpt / corrBasejetpt, weight); + } + } + if (jetfindingutilities::isInEtaAcceptance(jetMCP, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + registry.fill(HIST("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_mcpetaconstraint"), corrBasejetpt, corrTagjetpt, weight); + registry.fill(HIST("h2_jet_pt_mcp_jet_pt_diff_matchedgeo"), corrTagjetpt, dcorrpt / corrTagjetpt, weight); + registry.fill(HIST("h2_jet_pt_mcp_jet_pt_ratio_matchedgeo"), corrTagjetpt, corrBasejetpt / corrTagjetpt, weight); + if ((phiMinusPsi2 < o2::constants::math::PIQuarter) || (phiMinusPsi2 >= evtPlnAngleA * o2::constants::math::PIQuarter) || (phiMinusPsi2 >= evtPlnAngleB * o2::constants::math::PIQuarter && phiMinusPsi2 < evtPlnAngleC * o2::constants::math::PIQuarter)) { + registry.fill(HIST("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_in_mcpetaconstraint"), corrBasejetpt, corrTagjetpt, weight); + registry.fill(HIST("h2_jet_pt_mcp_jet_pt_diff_matchedgeo_in"), corrTagjetpt, dcorrpt / corrTagjetpt, weight); + registry.fill(HIST("h2_jet_pt_mcp_jet_pt_ratio_matchedgeo_in"), corrTagjetpt, corrBasejetpt / corrTagjetpt, weight); + } else { + registry.fill(HIST("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_out_mcpetaconstraint"), corrBasejetpt, corrTagjetpt, weight); + registry.fill(HIST("h2_jet_pt_mcp_jet_pt_diff_matchedgeo_out"), corrTagjetpt, dcorrpt / corrTagjetpt, weight); + registry.fill(HIST("h2_jet_pt_mcp_jet_pt_ratio_matchedgeo_out"), corrTagjetpt, corrBasejetpt / corrTagjetpt, weight); + } + } + } + } + } + } + template void fillGeoMatchedCorrHistograms(TBase const& jetMCD, TF1* fFitModulationRM, float tempparaA, double ep2, float rho, bool subtractMCPBackground, float mcrho, float weight = 1.0) { @@ -792,6 +872,8 @@ struct JetChargedV2 { double dcorrpt = corrTagjetpt - corrBasejetpt; double phiMinusPsi2 = jetMCD.phi() - ep2; if (jetfindingutilities::isInEtaAcceptance(jetMCD, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + registry.fill(HIST("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_incl_rhoareasubtracted_mcdetaconstraint"), corrBasejetpt, corrTagjetpt, weight); + registry.fill(HIST("h2_jet_pt_mcd_jet_pt_diff_matchedgeo_incl_rhoareasubtracted"), corrBasejetpt, dcorrpt / corrBasejetpt, weight); if ((phiMinusPsi2 < o2::constants::math::PIQuarter) || (phiMinusPsi2 >= evtPlnAngleA * o2::constants::math::PIQuarter) || (phiMinusPsi2 >= evtPlnAngleB * o2::constants::math::PIQuarter && phiMinusPsi2 < evtPlnAngleC * o2::constants::math::PIQuarter)) { registry.fill(HIST("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_in_rhoareasubtracted_mcdetaconstraint"), corrBasejetpt, corrTagjetpt, weight); registry.fill(HIST("h2_jet_pt_mcd_jet_pt_diff_matchedgeo_in_rhoareasubtracted"), corrBasejetpt, dcorrpt / corrBasejetpt, weight); @@ -801,6 +883,9 @@ struct JetChargedV2 { } } if (jetfindingutilities::isInEtaAcceptance(jetMCP, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + registry.fill(HIST("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_incl_rhoareasubtracted_mcpetaconstraint"), corrBasejetpt, corrTagjetpt, weight); + registry.fill(HIST("h2_jet_pt_mcp_jet_pt_diff_matchedgeo_incl_rhoareasubtracted"), corrTagjetpt, dcorrpt / corrTagjetpt, weight); + registry.fill(HIST("h2_jet_pt_mcp_jet_pt_ratio_matchedgeo_incl_rhoareasubtracted"), corrTagjetpt, corrBasejetpt / corrTagjetpt, weight); if ((phiMinusPsi2 < o2::constants::math::PIQuarter) || (phiMinusPsi2 >= evtPlnAngleA * o2::constants::math::PIQuarter) || (phiMinusPsi2 >= evtPlnAngleB * o2::constants::math::PIQuarter && phiMinusPsi2 < evtPlnAngleC * o2::constants::math::PIQuarter)) { registry.fill(HIST("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_in_rhoareasubtracted_mcpetaconstraint"), corrBasejetpt, corrTagjetpt, weight); registry.fill(HIST("h2_jet_pt_mcp_jet_pt_diff_matchedgeo_in_rhoareasubtracted"), corrTagjetpt, dcorrpt / corrTagjetpt, weight); @@ -1736,11 +1821,11 @@ struct JetChargedV2 { } PROCESS_SWITCH(JetChargedV2, processSigmaPtMCP, "jet spectra with area-based subtraction for MC particle level", false); - void processJetsMatched(McParticleCollision::iterator const& mccollision, - soa::SmallGroups> const& collisions, - ChargedMCDMatchedJets const& mcdjets, - ChargedMCPMatchedJets const&, - aod::JetTracks const& tracks, aod::JetParticles const&) + void processJetsMatchedSubtracted(McParticleCollision::iterator const& mccollision, + soa::SmallGroups> const& collisions, + ChargedMCDMatchedJets const& mcdjets, + ChargedMCPMatchedJets const&, + aod::JetTracks const& tracks, aod::JetParticles const&) { registry.fill(HIST("h_mc_collisions_matched"), 0.5); if (mccollision.size() < 1) { @@ -1851,15 +1936,19 @@ struct JetChargedV2 { if (tempparaA == 0) { return; } - - fillGeoMatchedCorrHistograms(mcdjet, fFitModulationRM, tempparaA, ep2, collision.rho(), subtractMCPBackground, collision.rho()); + if (useMedianRho) { + fillGeoMatchedHistograms(mcdjet, ep2, collision.rho(), mcrho); + } + if (useLocalRho) { + fillGeoMatchedCorrHistograms(mcdjet, fFitModulationRM, tempparaA, ep2, collision.rho(), subtractMCPBackground, collision.rho()); + } delete hPtsumSumptFitRM; delete fFitModulationRM; evtnum += 1; } } } - PROCESS_SWITCH(JetChargedV2, processJetsMatched, "matched mcp and mcd jets", false); + PROCESS_SWITCH(JetChargedV2, processJetsMatchedSubtracted, "matched mcp and mcd jets", false); void processTracksQA(soa::Filtered>::iterator const& collision, soa::Filtered> const& tracks) From e0c6e5c8bed5180bb1990070aca979f09634131b Mon Sep 17 00:00:00 2001 From: HANSEO PARK <53218370+hanseopark@users.noreply.github.com> Date: Mon, 27 Oct 2025 03:52:20 +0900 Subject: [PATCH 907/986] [PWGJE] Add multiplicity classes for b-jet tagging (#13505) --- PWGJE/Tasks/jetTaggerHFQA.cxx | 150 +++++++++++++++++++++++++--------- 1 file changed, 111 insertions(+), 39 deletions(-) diff --git a/PWGJE/Tasks/jetTaggerHFQA.cxx b/PWGJE/Tasks/jetTaggerHFQA.cxx index 55d6c338b5a..37ac50220e9 100644 --- a/PWGJE/Tasks/jetTaggerHFQA.cxx +++ b/PWGJE/Tasks/jetTaggerHFQA.cxx @@ -77,6 +77,8 @@ struct JetTaggerHFQA { Configurable checkMcCollisionIsMatched{"checkMcCollisionIsMatched", false, "0: count whole MCcollisions, 1: select MCcollisions which only have their correspond collisions"}; Configurable trackOccupancyInTimeRangeMax{"trackOccupancyInTimeRangeMax", 999999, "maximum occupancy of tracks in neighbouring collisions in a given time range; only applied to reconstructed collisions (data and mcd jets), not mc collisions (mcp jets)"}; Configurable trackOccupancyInTimeRangeMin{"trackOccupancyInTimeRangeMin", -999999, "minimum occupancy of tracks in neighbouring collisions in a given time range; only applied to reconstructed collisions (data and mcd jets), not mc collisions (mcp jets)"}; + Configurable meanFT0A{"meanFT0A", -1., "Mean value of FT0A signal"}; + Configurable meanFT0C{"meanFT0C", -1., "Mean value of FT0C signal"}; Configurable eventSelections{"eventSelections", "sel8", "choose event selection"}; Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; @@ -106,6 +108,7 @@ struct JetTaggerHFQA { ConfigurableAxis binMass{"binMass", {50, 0, 10.f}, ""}; ConfigurableAxis binSigmaLxy{"binSigmaLxy", {100, 0., 0.1}, ""}; ConfigurableAxis binSigmaLxyz{"binSigmaLxyz", {100, 0., 0.1}, ""}; + ConfigurableAxis binMultScaledFT0M{"binMultScaledFT0M", {VARIABLE_WIDTH, 0, 0.2, 0.3, 0.4, 0.6, 0.8, 1., 1.4, 1.8, 2.4, 3.6, 5., 20.}, "Percentiles of scaled FT0M: 100-90%, 90-80%, 80-70%, 70-60%, 60-50%, 50-40%, 40-30%, 30-20%, 20-10%, 10-1%, 1-0.1%"}; int numberOfJetFlavourSpecies = 6; std::vector eventSelectionBits; @@ -147,7 +150,7 @@ struct JetTaggerHFQA { AxisSpec axisSigmaLxy = {binSigmaLxy, "#sigma_{L_{XY}} [cm]"}; AxisSpec axisSigmaLxyz = {binSigmaLxyz, "#sigma_{L_{XYZ}} [cm]"}; AxisSpec axisFracSecPt = {100, 0, 1, "#frac{#Sigma#it{p}_{T}^{secondary track}}{#it{p}_{T, jet}}"}; - AxisSpec axisMult = {3500, 0, 3500, "Multiplicity"}; + AxisSpec axisMultScaledFT0M = {binMultScaledFT0M, "Multiplicity classes"}; if (doprocessTracksDca) { if (fillIPxy) { @@ -183,6 +186,18 @@ struct JetTaggerHFQA { registry.add("h3_part_jet_pt_flavour_const_hadron_part_flavour_dist_hadron", "", {HistType::kTH3F, {{axisJetPt}, {axisJetFlavour}, {axisJetFlavour}}}); registry.add("h3_part_jet_pt_flavour_const_quark_part_flavour_dist_quark", "", {HistType::kTH3F, {{axisJetPt}, {axisJetFlavour}, {axisJetFlavour}}}); } + if (doprocessValFlavourDefMCD) { + registry.add("h2_flavour_dist_quark_flavour_dist_hadron", "", {HistType::kTH2F, {{axisJetFlavour}, {axisJetFlavour}}}); + registry.add("h2_flavour_const_quark_flavour_const_hadron", "", {HistType::kTH2F, {{axisJetFlavour}, {axisJetFlavour}}}); + registry.add("h2_flavour_const_hadron_flavour_dist_hadron", "", {HistType::kTH2F, {{axisJetFlavour}, {axisJetFlavour}}}); + registry.add("h2_flavour_const_quark_flavour_dist_quark", "", {HistType::kTH2F, {{axisJetFlavour}, {axisJetFlavour}}}); + } + if (doprocessValFlavourDefMCP) { + registry.add("h3_part_jet_pt_flavour_dist_quark_part_flavour_dist_hadron", "", {HistType::kTH3F, {{axisJetPt}, {axisJetFlavour}, {axisJetFlavour}}}); + registry.add("h3_part_jet_pt_flavour_const_quark_part_flavour_const_hadron", "", {HistType::kTH3F, {{axisJetPt}, {axisJetFlavour}, {axisJetFlavour}}}); + registry.add("h3_part_jet_pt_flavour_const_hadron_part_flavour_dist_hadron", "", {HistType::kTH3F, {{axisJetPt}, {axisJetFlavour}, {axisJetFlavour}}}); + registry.add("h3_part_jet_pt_flavour_const_quark_part_flavour_dist_quark", "", {HistType::kTH3F, {{axisJetPt}, {axisJetFlavour}, {axisJetFlavour}}}); + } if (doprocessIPsData) { registry.add("h_jet_pt", "", {HistType::kTH1F, {{axisJetPt}}}); registry.add("h_jet_eta", "", {HistType::kTH1F, {{axisEta}}}); @@ -377,17 +392,23 @@ struct JetTaggerHFQA { registry.add("h2_taggedjet_pt_3prong_mass_xyz_N1", "", {HistType::kTH2F, {{axisJetPt}, {axisMass}}}); } if (doprocessSV3ProngDataMult) { - registry.add("h2_jet_pt_mult", "", {HistType::kTH2F, {{axisJetPt}, {axisMult}}}); - registry.add("h2_jet_eta_mult", "", {HistType::kTH2F, {{axisEta}, {axisMult}}}); - registry.add("h2_jet_phi_mult", "", {HistType::kTH2F, {{axisPhi}, {axisMult}}}); + registry.add("h_event_mult", "", {HistType::kTH1F, {{axisMultScaledFT0M}}}); + registry.add("h2_jet_pt_mult", "", {HistType::kTH2F, {{axisJetPt}, {axisMultScaledFT0M}}}); + registry.add("h2_jet_eta_mult", "", {HistType::kTH2F, {{axisEta}, {axisMultScaledFT0M}}}); + registry.add("h2_jet_phi_mult", "", {HistType::kTH2F, {{axisPhi}, {axisMultScaledFT0M}}}); if (fillGeneralSVQA) { - registry.add("h2_3prong_nprongs_mult", "", {HistType::kTH2F, {{axisNprongs}, {axisMult}}}); - registry.add("hn_jet_3prong_mult", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisLxy}, {axisSigmaLxy}, {axisSxy}, {axisLxyz}, {axisSigmaLxyz}, {axisSxyz}, {axisMult}}}); + registry.add("h2_3prong_nprongs_mult", "", {HistType::kTH2F, {{axisNprongs}, {axisMultScaledFT0M}}}); + registry.add("hn_jet_3prong_Sxy_mult", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisLxy}, {axisSigmaLxy}, {axisSxy}, {axisMultScaledFT0M}}}); + if (fillSVxyz) { + registry.add("hn_jet_3prong_Sxyz_mult", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisLxyz}, {axisSigmaLxyz}, {axisSxyz}, {axisMultScaledFT0M}}}); + } + } + registry.add("hn_jet_3prong_Sxy_N1_mult", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisSxy}, {axisMass}, {axisMultScaledFT0M}}}); + registry.add("hn_taggedjet_3prong_Sxy_N1_mult", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisSxy}, {axisMass}, {axisMultScaledFT0M}}}); + if (fillSVxyz) { + registry.add("hn_jet_3prong_Sxyz_N1_mult", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisSxyz}, {axisMass}, {axisMultScaledFT0M}}}); + registry.add("hn_taggedjet_3prong_Sxyz_N1_mult", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisSxyz}, {axisMass}, {axisMultScaledFT0M}}}); } - registry.add("hn_jet_3prong_Sxy_N1_mult", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisSxy}, {axisMass}, {axisMult}}}); - registry.add("hn_jet_3prong_Sxyz_N1_mult", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisSxyz}, {axisMass}, {axisMult}}}); - registry.add("hn_taggedjet_3prong_Sxy_N1_mult", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisSxy}, {axisMass}, {axisMult}}}); - registry.add("hn_taggedjet_3prong_Sxyz_N1_mult", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisSxyz}, {axisMass}, {axisMult}}}); } if (doprocessSV2ProngMCD || doprocessSV2ProngMCDWeighted || doprocessSV2ProngMCPMCDMatched || doprocessSV2ProngMCPMCDMatchedWeighted) { if (!(doprocessIPsMCD || doprocessIPsMCDWeighted || doprocessIPsMCPMCDMatched || doprocessIPsMCPMCDMatchedWeighted) && !(doprocessJPMCD || doprocessJPMCDWeighted || doprocessJPMCPMCDMatched || doprocessJPMCPMCDMatchedWeighted) && !(doprocessSV3ProngMCD || doprocessSV3ProngMCDWeighted || doprocessSV3ProngMCPMCDMatched || doprocessSV3ProngMCPMCDMatchedWeighted)) { @@ -438,17 +459,23 @@ struct JetTaggerHFQA { registry.add("h3_taggedjet_pt_3prong_mass_xyz_N1_flavour", "", {HistType::kTH3F, {{axisJetPt}, {axisMass}, {axisJetFlavour}}}); } if (doprocessSV3ProngMCDMult || doprocessSV3ProngMCDMultWeighted || doprocessSV3ProngMCPMCDMatchedMult || doprocessSV3ProngMCPMCDMatchedMultWeighted) { - registry.add("h3_jet_pt_mult_flavour", "", {HistType::kTH3F, {{axisJetPt}, {axisMult}, {axisJetFlavour}}}); - registry.add("h3_jet_eta_mult_flavour", "", {HistType::kTH3F, {{axisEta}, {axisMult}, {axisJetFlavour}}}); - registry.add("h3_jet_phi_mult_flavour", "", {HistType::kTH3F, {{axisPhi}, {axisMult}, {axisJetFlavour}}}); + registry.add("h_event_mult", "", {HistType::kTH1F, {{axisMultScaledFT0M}}}); + registry.add("h3_jet_pt_mult_flavour", "", {HistType::kTH3F, {{axisJetPt}, {axisMultScaledFT0M}, {axisJetFlavour}}}); + registry.add("h3_jet_eta_mult_flavour", "", {HistType::kTH3F, {{axisEta}, {axisMultScaledFT0M}, {axisJetFlavour}}}); + registry.add("h3_jet_phi_mult_flavour", "", {HistType::kTH3F, {{axisPhi}, {axisMultScaledFT0M}, {axisJetFlavour}}}); if (fillGeneralSVQA) { - registry.add("h3_3prong_nprongs_mult_flavour", "", {HistType::kTH3F, {{axisNprongs}, {axisMult}, {axisJetFlavour}}}); - registry.add("hn_jet_3prong_mult_flavour", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisLxy}, {axisSigmaLxy}, {axisSxy}, {axisLxyz}, {axisSigmaLxyz}, {axisSxyz}, {axisMult}, {axisJetFlavour}}}); + registry.add("h3_3prong_nprongs_mult_flavour", "", {HistType::kTH3F, {{axisNprongs}, {axisMultScaledFT0M}, {axisJetFlavour}}}); + registry.add("hn_jet_3prong_Sxy_mult_flavour", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisLxy}, {axisSigmaLxy}, {axisSxy}, {axisMultScaledFT0M}, {axisJetFlavour}}}); + if (fillSVxyz) { + registry.add("hn_jet_3prong_Sxyz_mult_flavour", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisLxyz}, {axisSigmaLxyz}, {axisSxyz}, {axisMultScaledFT0M}, {axisJetFlavour}}}); + } + } + registry.add("hn_jet_3prong_Sxy_N1_mult_flavour", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisSxy}, {axisMass}, {axisMultScaledFT0M}, {axisJetFlavour}}}); + registry.add("hn_taggedjet_3prong_Sxy_N1_mult_flavour", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisSxy}, {axisSxyz}, {axisMass}, {axisMultScaledFT0M}, {axisJetFlavour}}}); + if (fillSVxyz) { + registry.add("hn_jet_3prong_Sxyz_N1_mult_flavour", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisSxyz}, {axisMass}, {axisMultScaledFT0M}, {axisJetFlavour}}}); + registry.add("hn_taggedjet_3prong_Sxyz_N1_mult_flavour", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisSxy}, {axisSxyz}, {axisMass}, {axisMultScaledFT0M}, {axisJetFlavour}}}); } - registry.add("hn_jet_3prong_Sxy_N1_mult_flavour", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisSxy}, {axisMass}, {axisMult}, {axisJetFlavour}}}); - registry.add("hn_jet_3prong_Sxyz_N1_mult_flavour", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisSxyz}, {axisMass}, {axisMult}, {axisJetFlavour}}}); - registry.add("hn_taggedjet_3prong_Sxy_N1_mult_flavour", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisSxy}, {axisSxyz}, {axisMass}, {axisMult}, {axisJetFlavour}}}); - registry.add("hn_taggedjet_3prong_Sxyz_N1_mult_flavour", "", {HistType::kTHnSparseF, {{axisJetPt}, {axisSxy}, {axisSxyz}, {axisMass}, {axisMult}, {axisJetFlavour}}}); } } @@ -512,6 +539,21 @@ struct JetTaggerHFQA { return true; } + float getScaledFT0A(const float multFT0A) + { + return multFT0A / meanFT0A; + } + + float getScaledFT0C(const float multFT0C) + { + return multFT0C / meanFT0C; + } + + float getScaledFT0M(const float multFT0A, const float multFT0C) + { + return 0.5 * (getScaledFT0A(multFT0A) + getScaledFT0C(multFT0C)); + } + template void fillValidationFlavourDefMCD(T const& mcdjet, V const& tracks, W const& particles, X const& particlesPerColl, float eventWeight = 1.0) { @@ -1009,14 +1051,19 @@ struct JetTaggerHFQA { { if (jet.template secondaryVertices_as().size() < 1) return; - auto mult = 0.5 * (collision.multFT0A() + collision.multFT0C()); - registry.fill(HIST("h2_jet_pt_mult"), jet.pt(), mult); - registry.fill(HIST("h2_jet_eta_mult"), jet.eta(), mult); - registry.fill(HIST("h2_jet_phi_mult"), jet.phi(), mult); + float multFT0A = collision.multFT0A(); + float multFT0C = collision.multFT0C(); + float scaledFT0M = getScaledFT0M(multFT0A, multFT0C); + registry.fill(HIST("h2_jet_pt_mult"), jet.pt(), scaledFT0M); + registry.fill(HIST("h2_jet_eta_mult"), jet.eta(), scaledFT0M); + registry.fill(HIST("h2_jet_phi_mult"), jet.phi(), scaledFT0M); if (fillGeneralSVQA) { - registry.fill(HIST("h2_3prong_nprongs_mult"), jet.template secondaryVertices_as().size(), mult); + registry.fill(HIST("h2_3prong_nprongs_mult"), jet.template secondaryVertices_as().size(), scaledFT0M); for (const auto& prong : jet.template secondaryVertices_as()) { - registry.fill(HIST("hn_jet_3prong_mult"), jet.pt(), prong.decayLengthXY(), prong.errorDecayLengthXY(), prong.decayLengthXY() / prong.errorDecayLengthXY(), prong.decayLength(), prong.errorDecayLength(), prong.decayLength() / prong.errorDecayLengthXY(), mult); + registry.fill(HIST("hn_jet_3prong_Sxy_mult"), jet.pt(), prong.decayLengthXY(), prong.errorDecayLengthXY(), prong.decayLengthXY() / prong.errorDecayLengthXY(), scaledFT0M); + if (fillSVxyz) { + registry.fill(HIST("hn_jet_3prong_Sxyz_mult"), jet.pt(), prong.decayLength(), prong.errorDecayLength(), prong.decayLength() / prong.errorDecayLength(), scaledFT0M); + } } } bool checkSv = false; @@ -1024,9 +1071,9 @@ struct JetTaggerHFQA { if (checkSv && jettaggingutilities::svAcceptance(bjetCand, svDispersionMax)) { auto maxSxy = bjetCand.decayLengthXY() / bjetCand.errorDecayLengthXY(); auto massSV = bjetCand.m(); - registry.fill(HIST("hn_jet_3prong_Sxy_N1_mult"), jet.pt(), maxSxy, massSV, mult); + registry.fill(HIST("hn_jet_3prong_Sxy_N1_mult"), jet.pt(), maxSxy, massSV, scaledFT0M); if (jet.isTagged(BJetTaggingMethod::SV)) { - registry.fill(HIST("hn_taggedjet_3prong_Sxy_N1_mult"), jet.pt(), maxSxy, massSV, mult); + registry.fill(HIST("hn_taggedjet_3prong_Sxy_N1_mult"), jet.pt(), maxSxy, massSV, scaledFT0M); } } if (fillSVxyz) { @@ -1035,9 +1082,9 @@ struct JetTaggerHFQA { if (checkSv && jettaggingutilities::svAcceptance(bjetCandXYZ, svDispersionMax)) { auto maxSxyz = bjetCandXYZ.decayLength() / bjetCandXYZ.errorDecayLength(); auto massSV = bjetCandXYZ.m(); - registry.fill(HIST("hn_jet_3prong_Sxyz_N1_mult"), jet.pt(), maxSxyz, massSV, mult); + registry.fill(HIST("hn_jet_3prong_Sxyz_N1_mult"), jet.pt(), maxSxyz, massSV, scaledFT0M); if (jet.isTagged(BJetTaggingMethod::SV3D)) { - registry.fill(HIST("hn_taggedjet_3prong_Sxyz_N1_mult"), jet.pt(), maxSxyz, massSV, mult); + registry.fill(HIST("hn_taggedjet_3prong_Sxyz_N1_mult"), jet.pt(), maxSxyz, massSV, scaledFT0M); } } } @@ -1163,16 +1210,21 @@ struct JetTaggerHFQA { return; } auto origin = mcdjet.origin(); - auto mult = 0.5 * (collision.multFT0A() + collision.multFT0C()); + float multFT0A = collision.multFT0A(); + float multFT0C = collision.multFT0C(); + float scaledFT0M = getScaledFT0M(multFT0A, multFT0C); if (mcdjet.template secondaryVertices_as().size() < 1) return; - registry.fill(HIST("h3_jet_pt_mult_flavour"), mcdjet.pt(), mult, origin, eventWeight); - registry.fill(HIST("h3_jet_eta_mult_flavour"), mcdjet.eta(), mult, origin, eventWeight); - registry.fill(HIST("h3_jet_phi_mult_flavour"), mcdjet.phi(), mult, origin, eventWeight); + registry.fill(HIST("h3_jet_pt_mult_flavour"), mcdjet.pt(), scaledFT0M, origin, eventWeight); + registry.fill(HIST("h3_jet_eta_mult_flavour"), mcdjet.eta(), scaledFT0M, origin, eventWeight); + registry.fill(HIST("h3_jet_phi_mult_flavour"), mcdjet.phi(), scaledFT0M, origin, eventWeight); if (fillGeneralSVQA) { - registry.fill(HIST("h3_3prong_nprongs_mult_flavour"), mcdjet.template secondaryVertices_as().size(), mult, origin, eventWeight); + registry.fill(HIST("h3_3prong_nprongs_mult_flavour"), mcdjet.template secondaryVertices_as().size(), scaledFT0M, origin, eventWeight); for (const auto& prong : mcdjet.template secondaryVertices_as()) { - registry.fill(HIST("hn_jet_3prong_mult_flavour"), mcdjet.pt(), prong.decayLengthXY(), prong.errorDecayLengthXY(), prong.decayLengthXY() / prong.errorDecayLengthXY(), prong.decayLength(), prong.errorDecayLengthXY(), prong.decayLength() / prong.errorDecayLengthXY(), origin, eventWeight); + registry.fill(HIST("hn_jet_3prong_Sxy_mult_flavour"), mcdjet.pt(), prong.decayLengthXY(), prong.errorDecayLengthXY(), prong.decayLengthXY() / prong.errorDecayLengthXY(), scaledFT0M, origin, eventWeight); + if (fillSVxyz) { + registry.fill(HIST("hn_jet_3prong_Sxyz_mult_flavour"), mcdjet.pt(), prong.decayLength(), prong.errorDecayLength(), prong.decayLength() / prong.errorDecayLength(), scaledFT0M, origin, eventWeight); + } } } bool checkSv = false; @@ -1180,9 +1232,9 @@ struct JetTaggerHFQA { if (checkSv && jettaggingutilities::svAcceptance(bjetCand, svDispersionMax)) { auto maxSxy = bjetCand.decayLengthXY() / bjetCand.errorDecayLengthXY(); auto massSV = bjetCand.m(); - registry.fill(HIST("hn_jet_3prong_Sxy_N1_mult_flavour"), mcdjet.pt(), maxSxy, massSV, mult, origin, eventWeight); + registry.fill(HIST("hn_jet_3prong_Sxy_N1_mult_flavour"), mcdjet.pt(), maxSxy, massSV, scaledFT0M, origin, eventWeight); if (mcdjet.isTagged(BJetTaggingMethod::SV)) { - registry.fill(HIST("hn_taggedjet_3prong_Sxy_N1_mult_flavour"), mcdjet.pt(), maxSxy, massSV, mult, origin, eventWeight); + registry.fill(HIST("hn_taggedjet_3prong_Sxy_N1_mult_flavour"), mcdjet.pt(), maxSxy, massSV, scaledFT0M, origin, eventWeight); } } if (fillSVxyz) { @@ -1190,9 +1242,9 @@ struct JetTaggerHFQA { if (checkSv && jettaggingutilities::svAcceptance(bjetCandXYZ, svDispersionMax)) { auto maxSxyz = bjetCandXYZ.decayLength() / bjetCandXYZ.errorDecayLength(); auto massSV = bjetCandXYZ.m(); - registry.fill(HIST("hn_jet_3prong_Sxyz_N1_mult_flavour"), mcdjet.pt(), maxSxyz, massSV, mult, origin, eventWeight); + registry.fill(HIST("hn_jet_3prong_Sxyz_N1_mult_flavour"), mcdjet.pt(), maxSxyz, massSV, scaledFT0M, origin, eventWeight); if (mcdjet.isTagged(BJetTaggingMethod::SV3D)) { - registry.fill(HIST("hn_taggedjet_3prong_Sxyz_N1_mult_flavour"), mcdjet.pt(), maxSxyz, massSV, mult, origin, eventWeight); + registry.fill(HIST("hn_taggedjet_3prong_Sxyz_N1_mult_flavour"), mcdjet.pt(), maxSxyz, massSV, scaledFT0M, origin, eventWeight); } } } @@ -1608,6 +1660,10 @@ struct JetTaggerHFQA { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; } + float multFT0A = collision.multFT0A(); + float multFT0C = collision.multFT0C(); + float scaledFT0M = getScaledFT0M(multFT0A, multFT0C); + registry.fill(HIST("h_event_mult"), scaledFT0M); for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; @@ -1777,6 +1833,10 @@ struct JetTaggerHFQA { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; } + float multFT0A = collision.multFT0A(); + float multFT0C = collision.multFT0C(); + float scaledFT0M = getScaledFT0M(multFT0A, multFT0C); + registry.fill(HIST("h_event_mult"), scaledFT0M); for (auto const& mcdjet : mcdjets) { if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; @@ -1794,6 +1854,10 @@ struct JetTaggerHFQA { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; } + float multFT0A = collision.multFT0A(); + float multFT0C = collision.multFT0C(); + float scaledFT0M = getScaledFT0M(multFT0A, multFT0C); + registry.fill(HIST("h_event_mult"), scaledFT0M); for (auto const& mcdjet : mcdjets) { if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; @@ -1811,6 +1875,10 @@ struct JetTaggerHFQA { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; } + float multFT0A = collision.multFT0A(); + float multFT0C = collision.multFT0C(); + float scaledFT0M = getScaledFT0M(multFT0A, multFT0C); + registry.fill(HIST("h_event_mult"), scaledFT0M); for (auto const& mcdjet : mcdjets) { if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; @@ -1832,6 +1900,10 @@ struct JetTaggerHFQA { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; } + float multFT0A = collision.multFT0A(); + float multFT0C = collision.multFT0C(); + float scaledFT0M = getScaledFT0M(multFT0A, multFT0C); + registry.fill(HIST("h_event_mult"), scaledFT0M); for (auto const& mcdjet : mcdjets) { if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaCuts->at(0), jetEtaCuts->at(1), trackCuts->at(2), trackCuts->at(3))) { continue; From 82bb6b359f43fc2988e57ccb38becb65beb7b366 Mon Sep 17 00:00:00 2001 From: Giovanni Malfattore <89481844+giovannimalfattore@users.noreply.github.com> Date: Mon, 27 Oct 2025 12:28:28 +0100 Subject: [PATCH 908/986] [PWGLF] NucleiTask - Fix missing histogram filling (#13559) --- PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx b/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx index 5ae66462a96..43a5ef56f55 100644 --- a/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx +++ b/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx @@ -1873,8 +1873,8 @@ struct LFNucleiBATask { } if (enableHe) { if (enableCentrality) { - histos.add("tracks/helium/h3TOFmass2antiHeliumVsPtVsMult", "#Delta M^{2} (#bar{He}) vs #it{p}_{T}/z; #Delta M^{2} (#bar{He}); #it{p}_{T}/z (GeV/#it{c})", HistType::kTH3F, {{massHeAxis}, {ptZHeAxis}, {binsPercentile}}); histos.add("tracks/helium/h3TOFmass2HeliumVsPtVsMult", "#Delta M^{2} (He) vs #it{p}_{T}/z; #Delta M^{2} (He); #it{p}_{T}/z (GeV/#it{c})", HistType::kTH3F, {{massHeAxis}, {ptZHeAxis}, {binsPercentile}}); + histos.add("tracks/helium/h3TOFmass2antiHeliumVsPtVsMult", "#Delta M^{2} (#bar{He}) vs #it{p}_{T}/z; #Delta M^{2} (#bar{He}); #it{p}_{T}/z (GeV/#it{c})", HistType::kTH3F, {{massHeAxis}, {ptZHeAxis}, {binsPercentile}}); } histos.add("tracks/helium/h2TOFmass2antiHeliumVsPt", "#Delta M^{2} (#bar{He}) vs #it{p}_{T}/z; #Delta M^{2} (#bar{He}); #it{p}_{T}/z (GeV/#it{c})", HistType::kTH2F, {{massHeAxis}, {ptZHeAxis}}); histos.add("tracks/helium/h2TOFmass2HeliumVsPt", "#Delta M^{2} (He) vs #it{p}_{T}/z; #Delta M^{2} (He); #it{p}_{T}/z (GeV/#it{c})", HistType::kTH2F, {{massHeAxis}, {ptZHeAxis}}); @@ -4975,6 +4975,8 @@ struct LFNucleiBATask { histos.fill(HIST("tracks/helium/h2TOFmassHeliumVsPt"), 2.f * massTOFhe, hePt); histos.fill(HIST("tracks/helium/h2TOFmassDeltaHeliumVsPt"), 2.f * massTOFhe - MassHeliumVal, hePt); histos.fill(HIST("tracks/helium/h2TOFmass2HeliumVsPt"), 2.f * massTOFhe * 2.f * massTOFhe - MassHeliumVal * MassHeliumVal, hePt); + if (enableCentrality) + histos.fill(HIST("tracks/helium/h3TOFmass2HeliumVsPtVsMult"), 2.f * massTOFantihe * 2.f * massTOFantihe - MassHeliumVal * MassHeliumVal, hePt, event.centFT0M()); if (outFlagOptions.enableBetaCut && (track.beta() > cfgBetaCut)) { histos.fill(HIST("tracks/helium/h2TOFmassHeliumVsPt_BetaCut"), 2.f * massTOFhe, hePt); histos.fill(HIST("tracks/helium/h2TOFmass2HeliumVsPt_BetaCut"), 2.f * massTOFhe * 2.f * massTOFhe - MassHeliumVal * MassHeliumVal, hePt); @@ -4988,6 +4990,8 @@ struct LFNucleiBATask { histos.fill(HIST("tracks/helium/h2TOFmassantiHeliumVsPt"), 2.f * massTOFantihe, antihePt); histos.fill(HIST("tracks/helium/h2TOFmassDeltaantiHeliumVsPt"), 2.f * massTOFantihe - MassHeliumVal, antihePt); histos.fill(HIST("tracks/helium/h2TOFmass2antiHeliumVsPt"), 2.f * massTOFantihe * 2.f * massTOFantihe - MassHeliumVal * MassHeliumVal, antihePt); + if (enableCentrality) + histos.fill(HIST("tracks/helium/h3TOFmass2antiHeliumVsPtVsMult"), 2.f * massTOFantihe * 2.f * massTOFantihe - MassHeliumVal * MassHeliumVal, antihePt, event.centFT0M()); if (outFlagOptions.enableBetaCut && (track.beta() > cfgBetaCut)) { histos.fill(HIST("tracks/helium/h2TOFmassantiHeliumVsPt_BetaCut"), 2.f * massTOFantihe, antihePt); histos.fill(HIST("tracks/helium/h2TOFmass2antiHeliumVsPt_BetaCut"), 2.f * massTOFantihe * 2.f * massTOFantihe - MassHeliumVal * MassHeliumVal, antihePt); From ef810148f5531be9da23ddfdddb1c1a949dcdea7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Oct 2025 13:01:47 +0100 Subject: [PATCH 909/986] [Infrastructure] Bump actions/upload-artifact from 4 to 5 (#13560) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/mega-linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mega-linter.yml b/.github/workflows/mega-linter.yml index de747122fff..5f597e243cb 100644 --- a/.github/workflows/mega-linter.yml +++ b/.github/workflows/mega-linter.yml @@ -49,7 +49,7 @@ jobs: # Upload MegaLinter artifacts - name: Archive production artifacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v5 if: success() || failure() with: name: MegaLinter reports From db9c11ca69f64515def65d0aadc08da3f6ebfe5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= <26327373+vkucera@users.noreply.github.com> Date: Mon, 27 Oct 2025 13:02:33 +0100 Subject: [PATCH 910/986] [Infrastructure] O2 linter: Remove prefix exception for constexpr constants (#13518) --- .clang-tidy | 3 +-- Scripts/o2_linter.py | 16 +++++++--------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 9519cb1cef6..1d933b5937e 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -4,10 +4,9 @@ CheckOptions: - { key: readability-identifier-naming.ClassMemberPrefix, value: m } - { key: readability-identifier-naming.ConceptCase, value: CamelCase } - { key: readability-identifier-naming.ConstexprVariableCase, value: CamelCase } - - { key: readability-identifier-naming.ConstexprVariableIgnoredRegexp, value: "^k[A-Z][a-zA-Z0-9]*$" } # Allow "k" prefix. - { key: readability-identifier-naming.EnumCase, value: CamelCase } - { key: readability-identifier-naming.EnumConstantCase, value: CamelCase } - - { key: readability-identifier-naming.EnumConstantIgnoredRegexp, value: "^k?[A-Z][a-zA-Z0-9_]*$" } # Allow "k" prefix and underscores. + - { key: readability-identifier-naming.EnumConstantIgnoredRegexp, value: "^k?[A-Z][a-zA-Z0-9_]*$" } # Allow "k" prefix and non-trailing underscores in PDG names. - { key: readability-identifier-naming.FunctionCase, value: camelBack } - { key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE } - { key: readability-identifier-naming.MacroDefinitionIgnoredRegexp, value: "^[A-Z][A-Z0-9_]*_$" } # Allow the trailing underscore in header guards. diff --git a/Scripts/o2_linter.py b/Scripts/o2_linter.py index 2aa8fefb24f..b334a694c1d 100644 --- a/Scripts/o2_linter.py +++ b/Scripts/o2_linter.py @@ -988,9 +988,7 @@ class TestNameConstant(TestSpec): """Test constexpr constant names.""" name = "name/constexpr-constant" - message = ( - 'Use UpperCamelCase for names of constexpr constants. Names of special constants may be prefixed with "k".' - ) + message = "Use UpperCamelCase for names of constexpr constants." rationale = rationale_names references = references_names suffixes = [".h", ".cxx", ".C"] @@ -998,11 +996,11 @@ class TestNameConstant(TestSpec): def __init__(self) -> None: super().__init__() keyword = r"(.+ )" # e.g. "static " - type_val = r"([\w:<>+\-*\/, ]+ )" # value type e.g. "std::array " + type_val = r"([\w:<>+\-*\/, ]+ )" # value type e.g. "std::array " prefix = r"(\w+::)" # prefix with namespace or class, e.g. "MyClass::" name_val = r"(\w+)" # name of the constant - array = r"(\[.*\])" # array declaration: "[...]" - assignment = r"( =|\(\d|{)" # value assignment, e.g. " = 2", " = expression", "(2)", "{2}", "{{...}}" + array = r"(\[.*\])" # array declaration: "[...]" + assignment = r"( =|\(\d|{)" # value assignment, e.g. " = 2", " = expression", "(2)", "{2}", "{{...}}" self.pattern = re.compile(rf"{keyword}?constexpr {type_val}?{prefix}*{name_val}{array}?{assignment}") def test_line(self, line: str) -> bool: @@ -1013,8 +1011,6 @@ def test_line(self, line: str) -> bool: return True constant_name = match.group(4) # The actual test comes here. - if constant_name.startswith("k") and len(constant_name) > 1: # exception for special constants - constant_name = constant_name[1:] # test the name without "k" return is_upper_camel_case(constant_name) @@ -1785,7 +1781,9 @@ def main(): print("Skipping writing in GITHUB_OUTPUT.") # Print tips. - print("\nTip: You can run the O2 linter locally from the O2Physics directory with: python3 Scripts/o2_linter.py ") + print( + "\nTip: You can run the O2 linter locally from the O2Physics directory with: python3 Scripts/o2_linter.py " + ) if not passed: sys.exit(1) From f25f9e9ef55769aacf18864824b661b2f369799e Mon Sep 17 00:00:00 2001 From: Christian Sonnabend Date: Mon, 27 Oct 2025 13:03:52 +0100 Subject: [PATCH 911/986] [Common] Adding overflow short-circuit (#13336) --- Common/TableProducer/occupancyTableProducer.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Common/TableProducer/occupancyTableProducer.cxx b/Common/TableProducer/occupancyTableProducer.cxx index bfa41fcd87b..c3075e01d54 100644 --- a/Common/TableProducer/occupancyTableProducer.cxx +++ b/Common/TableProducer/occupancyTableProducer.cxx @@ -2708,15 +2708,17 @@ struct CreatePointerTables { // create pointer table int currentIDXforCheck = 0; int listSize = trackGIForTrackQAIndexList.size(); + bool breakOnOverflow = false; for (const auto& track : tracks) { - while (track.globalIndex() > trackGIForTrackQAIndexList[currentIDXforCheck][0]) { + while (!breakOnOverflow && track.globalIndex() > trackGIForTrackQAIndexList[currentIDXforCheck][0]) { currentIDXforCheck++; // increment the currentIDXforCheck for missing or invalid cases e.g. value = -1; if (currentIDXforCheck >= listSize) { + breakOnOverflow = true; break; } } - if (track.globalIndex() == trackGIForTrackQAIndexList[currentIDXforCheck][0]) { + if (!breakOnOverflow && track.globalIndex() == trackGIForTrackQAIndexList[currentIDXforCheck][0]) { genTrackToTracksQA(trackGIForTrackQAIndexList[currentIDXforCheck][1]); } else { genTrackToTracksQA(-1); // put a dummy index when track is not found in trackQA @@ -2741,15 +2743,17 @@ struct CreatePointerTables { // create pointer table int currentIDXforCheck = 0; int listSize = trackGIForTMOIndexList.size(); + bool breakOnOverflow = false; for (const auto& track : tracks) { - while (track.globalIndex() > trackGIForTMOIndexList[currentIDXforCheck][0]) { + while (!breakOnOverflow && track.globalIndex() > trackGIForTMOIndexList[currentIDXforCheck][0]) { currentIDXforCheck++; // increment the currentIDXforCheck for missing or invalid cases e.g. value = -1; if (currentIDXforCheck >= listSize) { + breakOnOverflow = true; break; } } - if (track.globalIndex() == trackGIForTMOIndexList[currentIDXforCheck][0]) { + if (!breakOnOverflow && track.globalIndex() == trackGIForTMOIndexList[currentIDXforCheck][0]) { genTrackToTmo(trackGIForTMOIndexList[currentIDXforCheck][1]); } else { genTrackToTmo(-1); // put a dummy index when track is not found in trackQA From 1eb2a996c144d7ed4b34e02c2eae545be9d96c56 Mon Sep 17 00:00:00 2001 From: Georgios Mantzaridis <62671855+gmantzar@users.noreply.github.com> Date: Mon, 27 Oct 2025 14:08:52 +0100 Subject: [PATCH 912/986] [PWGCF] Adding support for cascade triggers in the FemtoDream producer (#13533) --- PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx index 900e33127df..5694f1efef9 100644 --- a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx +++ b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx @@ -77,10 +77,10 @@ using FemtoFullTracks = namespace softwareTriggers { -static const int nTriggers = 6; -static const std::vector triggerNames{"fPPP", "fPPL", "fPLL", "fLLL", "fPD", "fLD"}; +static const int nTriggers = 11; +static const std::vector triggerNames{"fPPP", "fPPL", "fPLL", "fLLL", "fPD", "fLD", "fDoubleXi", "fDoubleOmega", "fOmegaHighMult", "fTrackedXi", "fTrackedOmega"}; static const float triggerSwitches[1][nTriggers]{ - {0, 0, 0, 0, 0, 0}}; + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; } // namespace softwareTriggers template From f62af44611a9502ef160a7b425011cf159431502 Mon Sep 17 00:00:00 2001 From: lucamicheletti93 <38209984+lucamicheletti93@users.noreply.github.com> Date: Mon, 27 Oct 2025 18:58:49 +0100 Subject: [PATCH 913/986] [PWGDQ] Removing useless template for table-maker-mc-with-assoc (#13527) Co-authored-by: Lucamicheletti93 --- PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx b/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx index 39fc41ec2ce..262be9de78b 100644 --- a/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx +++ b/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx @@ -454,8 +454,7 @@ struct TableMakerMC { Preslice fwdtrackIndicesPerCollision = aod::track_association::collisionId; Preslice mfttrackIndicesPerCollision = aod::track_association::collisionId; - template - void skimMCCollisions(TEventsMC const& mcCollisions) + void skimMCCollisions(MyEventsMcWithMults const& mcCollisions) { // skim MC collisions // NOTE: So far, all MC collisions are skimmed. In case there will be filtering based on MC collisions, @@ -465,7 +464,7 @@ struct TableMakerMC { // Loop over MC collisions for (auto& mcCollision : mcCollisions) { // Get MC collision information into the VarManager - VarManager::FillEvent(mcCollision); + VarManager::FillEvent(mcCollision); // Fill histograms fHistMan->FillHistClass("Event_MCTruth", VarManager::fgValues); // Create the skimmed table entry for this collision @@ -474,8 +473,7 @@ struct TableMakerMC { } } - template - void skimMCParticles(aod::McParticles const& mcTracks, TEventsMC const&) + void skimMCParticles(aod::McParticles const& mcTracks, MyEventsMcWithMults const&) { // Select MC particles which fulfill at least one of the user specified MC signals // In this function we just fill a map with the labels of selected particles, not creating the tables themselves. @@ -553,7 +551,7 @@ struct TableMakerMC { if (fConfigHistOutput.fConfigQA) { VarManager::FillTrackMC(mcTracks, mctrack); auto mcCollision = mctrack.template mcCollision_as(); - VarManager::FillEvent(mcCollision); + VarManager::FillEvent(mcCollision); int j = 0; for (auto signal = fMCSignals.begin(); signal != fMCSignals.end(); signal++, j++) { if (mcflags & (static_cast(1) << j)) { @@ -1214,11 +1212,11 @@ struct TableMakerMC { // skim MC Collisions eventMC.reserve(mcCollisions.size()); - skimMCCollisions(mcCollisions); + skimMCCollisions(mcCollisions); // select MC particles to be written using the specified MC signals // NOTE: tables are not written at this point, only label maps are being created - skimMCParticles(mcParticles, mcCollisions); + skimMCParticles(mcParticles, mcCollisions); // skim collisions event.reserve(collisions.size()); From 0aeff40fa26d83f637eda6595949bcd71f958454 Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Mon, 27 Oct 2025 19:24:19 +0100 Subject: [PATCH 914/986] [PWGCF] FemtoUniverse: Fill SH in quadrants of qout-qside (#13563) --- ...irTaskTrackTrackSpherHarMultKtExtended.cxx | 117 ++++++++++++++++-- 1 file changed, 109 insertions(+), 8 deletions(-) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx index 6a5d2db2490..0f44093e466 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx @@ -88,6 +88,9 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { Configurable ConfCPRdeltaEtaCutMax{"ConfCPRdeltaEtaCutMax", 0.0, "Delta Eta max cut for Close Pair Rejection"}; Configurable ConfCPRdeltaEtaCutMin{"ConfCPRdeltaEtaCutMin", 0.0, "Delta Eta min cut for Close Pair Rejection"}; Configurable ConfCPRChosenRadii{"ConfCPRChosenRadii", 0.80, "Delta Eta cut for Close Pair Rejection"}; + Configurable confUseCCImCut{"confUseCCImCut", false, "Fill SH within specific quadrants of qout-qside"}; + Configurable confUse1stand3rd{"confUse1stand3rd", false, "Use first and third quadrants of qout-qside"}; + Configurable confUse2ndand4th{"confUse2ndand4th", false, "Use second and fourth quadrants of qout-qside"}; } twotracksconfigs; using FemtoFullParticles = soa::Join; @@ -569,19 +572,44 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { std::vector f3d; double kv; + float outsideref = 0.0; switch (ContType) { case 2: { if (rand > 0.5) { - sameEventMultContPP.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); f3d = FemtoUniverseMath::newpairfunc(p1, mass1, p2, mass2, ConfIsIden); + if (!twotracksconfigs.confUseCCImCut) { + sameEventMultContPP.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); + } else { + if (twotracksconfigs.confUse1stand3rd) { + if ((f3d[1] >= outsideref && f3d[2] >= outsideref) || (f3d[1] < outsideref && f3d[2] < outsideref)) { + sameEventMultContPP.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); + } + } else if (twotracksconfigs.confUse2ndand4th) { + if ((f3d[1] < outsideref && f3d[2] >= outsideref) || (f3d[1] >= outsideref && f3d[2] < outsideref)) { + sameEventMultContPP.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); + } + } + } if (twotracksconfigs.ConfIsMC) { float weight = 1.0f; sameEventCont1D.setPair(p1, p2, multCol, twotracksconfigs.ConfUse3D, weight, ConfIsIden); } } else if (rand <= 0.5) { - sameEventMultContPP.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); f3d = FemtoUniverseMath::newpairfunc(p2, mass2, p1, mass1, ConfIsIden); + if (!twotracksconfigs.confUseCCImCut) { + sameEventMultContPP.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); + } else { + if (twotracksconfigs.confUse1stand3rd) { + if ((f3d[1] >= outsideref && f3d[2] >= outsideref) || (f3d[1] < outsideref && f3d[2] < outsideref)) { + sameEventMultContPP.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); + } + } else if (twotracksconfigs.confUse2ndand4th) { + if ((f3d[1] < outsideref && f3d[2] >= outsideref) || (f3d[1] >= outsideref && f3d[2] < outsideref)) { + sameEventMultContPP.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); + } + } + } if (twotracksconfigs.ConfIsMC) { float weight = 1.0f; sameEventCont1D.setPair(p2, p1, multCol, twotracksconfigs.ConfUse3D, weight, ConfIsIden); @@ -596,15 +624,39 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { case 3: { if (rand > 0.5) { - sameEventMultContMM.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); f3d = FemtoUniverseMath::newpairfunc(p1, mass1, p2, mass2, ConfIsIden); + if (!twotracksconfigs.confUseCCImCut) { + sameEventMultContMM.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); + } else { + if (twotracksconfigs.confUse1stand3rd) { + if ((f3d[1] >= outsideref && f3d[2] >= outsideref) || (f3d[1] < outsideref && f3d[2] < outsideref)) { + sameEventMultContMM.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); + } + } else if (twotracksconfigs.confUse2ndand4th) { + if ((f3d[1] < outsideref && f3d[2] >= outsideref) || (f3d[1] >= outsideref && f3d[2] < outsideref)) { + sameEventMultContMM.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); + } + } + } if (twotracksconfigs.ConfIsMC) { float weight = 1.0f; sameEventCont1D.setPair(p1, p2, multCol, twotracksconfigs.ConfUse3D, weight, ConfIsIden); } } else if (rand <= 0.5) { - sameEventMultContMM.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); f3d = FemtoUniverseMath::newpairfunc(p2, mass2, p1, mass1, ConfIsIden); + if (!twotracksconfigs.confUseCCImCut) { + sameEventMultContMM.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); + } else { + if (twotracksconfigs.confUse1stand3rd) { + if ((f3d[1] >= outsideref && f3d[2] >= outsideref) || (f3d[1] < outsideref && f3d[2] < outsideref)) { + sameEventMultContMM.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); + } + } else if (twotracksconfigs.confUse2ndand4th) { + if ((f3d[1] < outsideref && f3d[2] >= outsideref) || (f3d[1] >= outsideref && f3d[2] < outsideref)) { + sameEventMultContMM.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); + } + } + } if (twotracksconfigs.ConfIsMC) { float weight = 1.0f; sameEventCont1D.setPair(p2, p1, multCol, twotracksconfigs.ConfUse3D, weight, ConfIsIden); @@ -885,6 +937,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { std::vector f3d; double kv; + float outsideref = 0.0; switch (ContType) { case 1: { @@ -898,11 +951,35 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { case 2: { if (rand > 0.5) { - mixedEventMultContPP.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); f3d = FemtoUniverseMath::newpairfunc(p1, mass1, p2, mass2, ConfIsIden); + if (!twotracksconfigs.confUseCCImCut) { + mixedEventMultContPP.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); + } else { + if (twotracksconfigs.confUse1stand3rd) { + if ((f3d[1] >= outsideref && f3d[2] >= outsideref) || (f3d[1] < outsideref && f3d[2] < outsideref)) { + mixedEventMultContPP.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); + } + } else if (twotracksconfigs.confUse2ndand4th) { + if ((f3d[1] < outsideref && f3d[2] >= outsideref) || (f3d[1] >= outsideref && f3d[2] < outsideref)) { + mixedEventMultContPP.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); + } + } + } } else { - mixedEventMultContPP.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); f3d = FemtoUniverseMath::newpairfunc(p2, mass2, p1, mass1, ConfIsIden); + if (!twotracksconfigs.confUseCCImCut) { + mixedEventMultContPP.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); + } else { + if (twotracksconfigs.confUse1stand3rd) { + if ((f3d[1] >= outsideref && f3d[2] >= outsideref) || (f3d[1] < outsideref && f3d[2] < outsideref)) { + mixedEventMultContPP.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); + } + } else if (twotracksconfigs.confUse2ndand4th) { + if ((f3d[1] < outsideref && f3d[2] >= outsideref) || (f3d[1] >= outsideref && f3d[2] < outsideref)) { + mixedEventMultContPP.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); + } + } + } } if (ConfIsFillAngqLCMS) { kv = std::sqrt(f3d[1] * f3d[1] + f3d[2] * f3d[2] + f3d[3] * f3d[3]); @@ -913,11 +990,35 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { case 3: { if (rand > 0.5) { - mixedEventMultContMM.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); f3d = FemtoUniverseMath::newpairfunc(p1, mass1, p2, mass2, ConfIsIden); + if (!twotracksconfigs.confUseCCImCut) { + mixedEventMultContMM.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); + } else { + if (twotracksconfigs.confUse1stand3rd) { + if ((f3d[1] >= outsideref && f3d[2] >= outsideref) || (f3d[1] < outsideref && f3d[2] < outsideref)) { + mixedEventMultContMM.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); + } + } else if (twotracksconfigs.confUse2ndand4th) { + if ((f3d[1] < outsideref && f3d[2] >= outsideref) || (f3d[1] >= outsideref && f3d[2] < outsideref)) { + mixedEventMultContMM.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); + } + } + } } else { - mixedEventMultContMM.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); f3d = FemtoUniverseMath::newpairfunc(p2, mass2, p1, mass1, ConfIsIden); + if (!twotracksconfigs.confUseCCImCut) { + mixedEventMultContMM.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); + } else { + if (twotracksconfigs.confUse1stand3rd) { + if ((f3d[1] >= outsideref && f3d[2] >= outsideref) || (f3d[1] < outsideref && f3d[2] < outsideref)) { + mixedEventMultContMM.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); + } + } else if (twotracksconfigs.confUse2ndand4th) { + if ((f3d[1] < outsideref && f3d[2] >= outsideref) || (f3d[1] >= outsideref && f3d[2] < outsideref)) { + mixedEventMultContMM.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); + } + } + } } if (ConfIsFillAngqLCMS) { kv = std::sqrt(f3d[1] * f3d[1] + f3d[2] * f3d[2] + f3d[3] * f3d[3]); From 5bcb710204c2dfadadeb097fe941359380a9436c Mon Sep 17 00:00:00 2001 From: Francesca Ercolessi Date: Mon, 27 Oct 2025 21:24:37 +0100 Subject: [PATCH 915/986] [Common] Centrality task: add PV mult. binning to histogram configurations (#13543) Co-authored-by: ALICE Builder --- Common/TableProducer/centralityTable.cxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Common/TableProducer/centralityTable.cxx b/Common/TableProducer/centralityTable.cxx index d73c83f0ecf..94fcf14ff2a 100644 --- a/Common/TableProducer/centralityTable.cxx +++ b/Common/TableProducer/centralityTable.cxx @@ -116,6 +116,7 @@ struct CentralityTable { Configurable embedINELgtZEROselection{"embedINELgtZEROselection", false, {"Option to do percentile 100.5 if not INELgtZERO"}}; Configurable produceHistograms{"produceHistograms", false, {"Option to produce debug histograms"}}; ConfigurableAxis binsPercentile{"binsPercentile", {VARIABLE_WIDTH, 0, 0.001, 0.002, 0.003, 0.004, 0.005, 0.006, 0.007, 0.008, 0.009, 0.01, 0.011, 0.012, 0.013, 0.014, 0.015, 0.016, 0.017, 0.018, 0.019, 0.02, 0.021, 0.022, 0.023, 0.024, 0.025, 0.026, 0.027, 0.028, 0.029, 0.03, 0.031, 0.032, 0.033, 0.034, 0.035, 0.036, 0.037, 0.038, 0.039, 0.04, 0.041, 0.042, 0.043, 0.044, 0.045, 0.046, 0.047, 0.048, 0.049, 0.05, 0.051, 0.052, 0.053, 0.054, 0.055, 0.056, 0.057, 0.058, 0.059, 0.06, 0.061, 0.062, 0.063, 0.064, 0.065, 0.066, 0.067, 0.068, 0.069, 0.07, 0.071, 0.072, 0.073, 0.074, 0.075, 0.076, 0.077, 0.078, 0.079, 0.08, 0.081, 0.082, 0.083, 0.084, 0.085, 0.086, 0.087, 0.088, 0.089, 0.09, 0.091, 0.092, 0.093, 0.094, 0.095, 0.096, 0.097, 0.098, 0.099, 0.1, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.2, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.3, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.4, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.5, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.6, 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.7, 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.8, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.9, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5.0, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 6.0, 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9, 9.0, 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7, 9.8, 9.9, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0, 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0, 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0, 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0, 59.0, 60.0, 61.0, 62.0, 63.0, 64.0, 65.0, 66.0, 67.0, 68.0, 69.0, 70.0, 71.0, 72.0, 73.0, 74.0, 75.0, 76.0, 77.0, 78.0, 79.0, 80.0, 81.0, 82.0, 83.0, 84.0, 85.0, 86.0, 87.0, 88.0, 89.0, 90.0, 91.0, 92.0, 93.0, 94.0, 95.0, 96.0, 97.0, 98.0, 99.0, 100.0}, "Binning of the percentile axis"}; + ConfigurableAxis binsPVcontr{"binsPVcontr", {100, 0.f, 100.f}, "PV mult."}; int mRunNumber; struct TagRun2V0MCalibration { @@ -254,16 +255,16 @@ struct CentralityTable { } histos.add("FT0M/percentile", "FT0M percentile.", HistType::kTH1D, {{binsPercentile, "FT0M percentile"}}); - histos.add("FT0M/percentilevsPV", "percentile vs PV mult.", HistType::kTH2D, {{binsPercentile, "FT0M percentile"}, {100, 0, 100, "PV mult."}}); - histos.add("FT0M/MultvsPV", "FT0M mult. vs PV mult.", HistType::kTH2D, {{1000, 0, 5000, "FT0M mult."}, {100, 0, 100, "PV mult."}}); + histos.add("FT0M/percentilevsPV", "percentile vs PV mult.", HistType::kTH2D, {{binsPercentile, "FT0M percentile"}, {binsPVcontr, "PV mult."}}); + histos.add("FT0M/MultvsPV", "FT0M mult. vs PV mult.", HistType::kTH2D, {{1000, 0, 5000, "FT0M mult."}, {binsPVcontr, "PV mult."}}); histos.add("FT0A/percentile", "FT0A percentile.", HistType::kTH1D, {{binsPercentile, "FT0A percentile"}}); - histos.add("FT0A/percentilevsPV", "percentile vs PV mult.", HistType::kTH2D, {{binsPercentile, "FT0A percentile"}, {100, 0, 100, "PV mult."}}); - histos.add("FT0A/MultvsPV", "FT0A mult. vs PV mult.", HistType::kTH2D, {{1000, 0, 5000, "FT0A mult."}, {100, 0, 100, "PV mult."}}); + histos.add("FT0A/percentilevsPV", "percentile vs PV mult.", HistType::kTH2D, {{binsPercentile, "FT0A percentile"}, {binsPVcontr, "PV mult."}}); + histos.add("FT0A/MultvsPV", "FT0A mult. vs PV mult.", HistType::kTH2D, {{1000, 0, 5000, "FT0A mult."}, {binsPVcontr, "PV mult."}}); histos.add("FT0C/percentile", "FT0C percentile.", HistType::kTH1D, {{binsPercentile, "FT0C percentile"}}); - histos.add("FT0C/percentilevsPV", "percentile vs PV mult.", HistType::kTH2D, {{binsPercentile, "FT0C percentile"}, {100, 0, 100, "PV mult."}}); - histos.add("FT0C/MultvsPV", "FT0C mult. vs PV mult.", HistType::kTH2D, {{1000, 0, 5000, "FT0C mult."}, {100, 0, 100, "PV mult."}}); + histos.add("FT0C/percentilevsPV", "percentile vs PV mult.", HistType::kTH2D, {{binsPercentile, "FT0C percentile"}, {binsPVcontr, "PV mult."}}); + histos.add("FT0C/MultvsPV", "FT0C mult. vs PV mult.", HistType::kTH2D, {{1000, 0, 5000, "FT0C mult."}, {binsPVcontr, "PV mult."}}); histos.addClone("FT0M/", "sel8FT0M/"); histos.addClone("FT0C/", "sel8FT0C/"); From d9d115f6a21ebcaf356200e87bd8418ae86f5bd7 Mon Sep 17 00:00:00 2001 From: spolitan <59452587+stefanopolitano@users.noreply.github.com> Date: Mon, 27 Oct 2025 21:49:17 +0100 Subject: [PATCH 916/986] [PWGCF] Add systematic variations on topological selections of V0s in flow analyses (#13548) --- PWGCF/DataModel/CorrelationsDerived.h | 8 +- PWGCF/TableProducer/filter2Prong.cxx | 176 +++++++++++++++++++------- 2 files changed, 137 insertions(+), 47 deletions(-) diff --git a/PWGCF/DataModel/CorrelationsDerived.h b/PWGCF/DataModel/CorrelationsDerived.h index 9fd636f9924..95fcc296597 100644 --- a/PWGCF/DataModel/CorrelationsDerived.h +++ b/PWGCF/DataModel/CorrelationsDerived.h @@ -145,7 +145,13 @@ enum ParticleDecay { PhiToKKPID3, K0stoPiPi, LambdatoPPi, - AntiLambdatoPiP + AntiLambdatoPiP, + K0stoPiPiLoose, + K0stoPiPiTight, + LambdaToPPiLoose, + LambdaToPPiTight, + AntiLambdaToPiPLoose, + AntiLambdaToPiPTight }; } // namespace cf2prongtrack DECLARE_SOA_TABLE(CF2ProngTracks, "AOD", "CF2PRONGTRACK", //! Reduced track table diff --git a/PWGCF/TableProducer/filter2Prong.cxx b/PWGCF/TableProducer/filter2Prong.cxx index 3dc4937b74a..80f947348a4 100644 --- a/PWGCF/TableProducer/filter2Prong.cxx +++ b/PWGCF/TableProducer/filter2Prong.cxx @@ -58,28 +58,68 @@ struct Filter2Prong { O2_DEFINE_CONFIGURABLE(cfgImSigmaFormula, std::string, "(([p] < 0.5 || [hasTOF] <= 0.0) && abs([sTPC]) < 3.0) || ([p] >= 0.5 && abs([sTPC]) < 2.5 && abs([sTOF]) < 3.0)", "pT dependent daughter track sigma pass condition. Parameters: [p] momentum, [sTPC] sigma TPC, [sTOF] sigma TOF, [hasTOF] has TOF.") struct : ConfigurableGroup { + O2_DEFINE_CONFIGURABLE(storeLooseTight, bool, false, "Store also loose and tight V0 candidates for systematics"); O2_DEFINE_CONFIGURABLE(tpcNClsCrossedRowsTrackMin, float, 70, "Minimum number of crossed rows in TPC"); O2_DEFINE_CONFIGURABLE(etaTrackMax, float, 0.8, "Maximum pseudorapidity"); - O2_DEFINE_CONFIGURABLE(ptTrackMin, float, 0.1, "Minimum transverse momentum"); - O2_DEFINE_CONFIGURABLE(minV0DCAPr, float, 0.1, "Min V0 proton DCA"); - O2_DEFINE_CONFIGURABLE(minV0DCAPiLambda, float, 0.1, "Min V0 pion DCA for lambda"); - O2_DEFINE_CONFIGURABLE(minV0DCAPiK0s, float, 0.1, "Min V0 pion DCA for K0s"); - O2_DEFINE_CONFIGURABLE(daughPIDCuts, float, 4.0, "PID nsigma for V0s"); - O2_DEFINE_CONFIGURABLE(massK0Min, float, 0.4, "Minimum mass for K0"); - O2_DEFINE_CONFIGURABLE(massK0Max, float, 0.6, "Maximum mass for K0"); - O2_DEFINE_CONFIGURABLE(massLambdaMin, float, 1.0, "Minimum mass for lambda"); - O2_DEFINE_CONFIGURABLE(massLambdaMax, float, 1.3, "Maximum mass for lambda"); - O2_DEFINE_CONFIGURABLE(radiusMaxLambda, float, 2.3, "Maximum decay radius (cm) for lambda"); - O2_DEFINE_CONFIGURABLE(radiusMinLambda, float, 0.0, "Minimum decay radius (cm) for lambda"); - O2_DEFINE_CONFIGURABLE(radiusMaxK0s, float, 2.3, "Maximum decay radius (cm) for K0s"); - O2_DEFINE_CONFIGURABLE(radiusMinK0s, float, 0.0, "Minimum decay radius (cm) for K0s"); - O2_DEFINE_CONFIGURABLE(cosPaMinLambda, float, 0.98, "Minimum cosine of pointing angle for lambda"); - O2_DEFINE_CONFIGURABLE(cosPaMinK0s, float, 0.98, "Minimum cosine of pointing angle for K0s"); - O2_DEFINE_CONFIGURABLE(dcaV0DaughtersMaxLambda, float, 0.2, "Maximum DCA among the V0 daughters (cm) for lambda"); - O2_DEFINE_CONFIGURABLE(dcaV0DaughtersMaxK0s, float, 0.2, "Maximum DCA among the V0 daughters (cm) for K0s"); - O2_DEFINE_CONFIGURABLE(qtArmenterosMinForK0s, float, 0.12, "Minimum Armenteros' qt for K0s"); - O2_DEFINE_CONFIGURABLE(maxLambdaLifeTime, float, 30, "Maximum lambda lifetime (in cm)"); - O2_DEFINE_CONFIGURABLE(maxK0sLifeTime, float, 30, "Maximum K0s lifetime (in cm)"); + O2_DEFINE_CONFIGURABLE(ptTrackMin, float, 0.15, "Minimum transverse momentum"); + O2_DEFINE_CONFIGURABLE(minV0DCAPr, std::vector, + (std::vector{0.06f, 0.07f, 0.08f}), + "Maximum DCAxy for daughter tracks (Loose, Default, Tight)"); + O2_DEFINE_CONFIGURABLE(minV0DCAPiLambda, std::vector, + (std::vector{0.1f, 0.2f, 0.3f}), + "Min V0 pion DCA for lambda (Loose, Default, Tight)"); + O2_DEFINE_CONFIGURABLE(minV0DCAPiK0s, std::vector, + (std::vector{0.05f, 0.1f, 0.2f}), + "Min V0 pion DCA for K0s (Loose, Default, Tight)"); + O2_DEFINE_CONFIGURABLE(daughPIDCuts, std::vector, + (std::vector{3.0f, 4.0f, 5.0f}), + "PID nsigma for V0s (Loose, Default, Tight)"); + O2_DEFINE_CONFIGURABLE(massK0Min, std::vector, + (std::vector{0.4f, 0.4f, 0.4f}), + "Minimum mass for K0 (Loose, Default, Tight)"); + O2_DEFINE_CONFIGURABLE(massK0Max, std::vector, + (std::vector{0.6f, 0.6f, 0.6f}), + "Maximum mass for K0 (Loose, Default, Tight)"); + O2_DEFINE_CONFIGURABLE(massLambdaMin, std::vector, + (std::vector{1.07f, 1.07f, 1.07f}), + "Minimum mass for lambda (Loose, Default, Tight)"); + O2_DEFINE_CONFIGURABLE(massLambdaMax, std::vector, + (std::vector{1.17f, 1.17f, 1.17f}), + "Maximum mass for lambda (Loose, Default, Tight)"); + O2_DEFINE_CONFIGURABLE(radiusMaxLambda, std::vector, + (std::vector{20.f, 30.f, 40.f}), + "Maximum decay radius (cm) for lambda (Loose, Default, Tight)"); + O2_DEFINE_CONFIGURABLE(radiusMinLambda, std::vector, + (std::vector{1.0f, 1.2f, 1.4f}), + "Minimum decay radius (cm) for lambda (Loose, Default, Tight)"); + O2_DEFINE_CONFIGURABLE(radiusMaxK0s, std::vector, + (std::vector{1.0f, 1.2f, 1.4f}), + "Maximum decay radius (cm) for K0s (Loose, Default, Tight)"); + O2_DEFINE_CONFIGURABLE(radiusMinK0s, std::vector, + (std::vector{0.0f, 0.0f, 0.1f}), + "Minimum decay radius (cm) for K0s (Loose, Default, Tight)"); + O2_DEFINE_CONFIGURABLE(cosPaMinLambda, std::vector, + (std::vector{0.990f, 0.993f, 0.995f}), + "Minimum cosine of pointing angle for lambda (Loose, Default, Tight)"); + O2_DEFINE_CONFIGURABLE(cosPaMinK0s, std::vector, + (std::vector{0.990f, 0.993f, 0.995f}), + "Minimum cosine of pointing angle for K0s (Loose, Default, Tight)"); + O2_DEFINE_CONFIGURABLE(dcaV0DaughtersMaxLambda, std::vector, + (std::vector{0.7f, 0.8f, 0.9f}), + "Maximum DCA among the V0 daughters (cm) for lambda (Loose, Default, Tight)"); + O2_DEFINE_CONFIGURABLE(dcaV0DaughtersMaxK0s, std::vector, + (std::vector{0.7f, 0.8f, 0.9f}), + "Maximum DCA among the V0 daughters (cm) for K0s (Loose, Default, Tight)"); + O2_DEFINE_CONFIGURABLE(qtArmenterosMinForK0s, std::vector, + (std::vector{0.2f, 0.2f, 0.2f}), + "Minimum Armenteros' qt for K0s (Loose, Default, Tight)"); + O2_DEFINE_CONFIGURABLE(maxLambdaLifeTime, std::vector, + (std::vector{40.f, 30.f, 25.f}), + "Maximum lambda lifetime (in cm) (Loose, Default, Tight)"); + O2_DEFINE_CONFIGURABLE(maxK0sLifeTime, std::vector, + (std::vector{40.f, 30.f, 25.f}), + "Maximum K0s lifetime (in cm) (Loose, Default, Tight)"); + } grpV0; struct : ConfigurableGroup { @@ -313,74 +353,78 @@ struct Filter2Prong { } template - bool isSelectedV0AsK0s(Collision const& collision, const V0Cand& v0) + bool isSelectedV0AsK0s(Collision const& collision, const V0Cand& v0, bool isLoose, bool isTight) { const auto& posTrack = v0.template posTrack_as(); const auto& negTrack = v0.template negTrack_as(); + const int indexCut = isLoose ? 0 : (isTight ? 2 : 1); + float CtauK0s = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0; - if (v0.mK0Short() < grpV0.massK0Min || v0.mK0Short() > grpV0.massK0Max) { + if (v0.mK0Short() < grpV0.massK0Min.value[indexCut] || v0.mK0Short() > grpV0.massK0Max.value[indexCut]) { return false; } - if ((v0.qtarm() / std::abs(v0.alpha())) < grpV0.qtArmenterosMinForK0s) { + if ((v0.qtarm() / std::abs(v0.alpha())) < grpV0.qtArmenterosMinForK0s.value[indexCut]) { return false; } - if (v0.v0radius() > grpV0.radiusMaxK0s || v0.v0radius() < grpV0.radiusMinK0s) { + if (v0.v0radius() > grpV0.radiusMaxK0s.value[indexCut] || v0.v0radius() < grpV0.radiusMinK0s.value[indexCut]) { return false; } - if (v0.v0cosPA() < grpV0.cosPaMinK0s) { + if (v0.v0cosPA() < grpV0.cosPaMinK0s.value[indexCut]) { return false; } - if (v0.dcaV0daughters() > grpV0.dcaV0DaughtersMaxK0s) { + if (v0.dcaV0daughters() > grpV0.dcaV0DaughtersMaxK0s.value[indexCut]) { return false; } - if (std::abs(CtauK0s) > grpV0.maxK0sLifeTime) { + if (std::abs(CtauK0s) > grpV0.maxK0sLifeTime.value[indexCut]) { return false; } - if (((std::abs(posTrack.tpcNSigmaPi()) > grpV0.daughPIDCuts) || (std::abs(negTrack.tpcNSigmaPi()) > grpV0.daughPIDCuts))) { + if (((std::abs(posTrack.tpcNSigmaPi()) > grpV0.daughPIDCuts.value[indexCut]) || (std::abs(negTrack.tpcNSigmaPi()) > grpV0.daughPIDCuts.value[indexCut]))) { return false; } - if ((TMath::Abs(v0.dcapostopv()) < grpV0.minV0DCAPiK0s || TMath::Abs(v0.dcanegtopv()) < grpV0.minV0DCAPiK0s)) { + if ((TMath::Abs(v0.dcapostopv()) < grpV0.minV0DCAPiK0s.value[indexCut]) || (TMath::Abs(v0.dcanegtopv()) < grpV0.minV0DCAPiK0s.value[indexCut])) { return false; } return true; } template - bool isSelectedV0AsLambda(Collision const& collision, const V0Cand& v0) + bool isSelectedV0AsLambda(Collision const& collision, const V0Cand& v0, bool isLoose, bool isTight) { const auto& posTrack = v0.template posTrack_as(); const auto& negTrack = v0.template negTrack_as(); + const int indexCut = isLoose ? 0 : (isTight ? 2 : 1); + float CtauLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda; - if ((v0.mLambda() < grpV0.massLambdaMin || v0.mLambda() > grpV0.massLambdaMax) && - (v0.mAntiLambda() < grpV0.massLambdaMin || v0.mAntiLambda() > grpV0.massLambdaMax)) { + if ((v0.mLambda() < grpV0.massLambdaMin.value[indexCut] || v0.mLambda() > grpV0.massLambdaMax.value[indexCut]) && + (v0.mAntiLambda() < grpV0.massLambdaMin.value[indexCut] || v0.mAntiLambda() > grpV0.massLambdaMax.value[indexCut])) { return false; } - if (v0.v0radius() > grpV0.radiusMaxLambda || v0.v0radius() < grpV0.radiusMinLambda) { + if (v0.v0radius() > grpV0.radiusMaxLambda.value[indexCut] || v0.v0radius() < grpV0.radiusMinLambda.value[indexCut]) { return false; } - if (v0.v0cosPA() < grpV0.cosPaMinLambda) { + if (v0.v0cosPA() < grpV0.cosPaMinLambda.value[indexCut]) { return false; } - if (v0.dcaV0daughters() > grpV0.dcaV0DaughtersMaxLambda) { + if (v0.dcaV0daughters() > grpV0.dcaV0DaughtersMaxLambda.value[indexCut]) { return false; } - if (pid == LambdaPid::kLambda && (TMath::Abs(v0.dcapostopv()) < grpV0.minV0DCAPr || TMath::Abs(v0.dcanegtopv()) < grpV0.minV0DCAPiLambda)) { + if (pid == LambdaPid::kLambda && (TMath::Abs(v0.dcapostopv()) < grpV0.minV0DCAPr.value[indexCut] || TMath::Abs(v0.dcanegtopv()) < grpV0.minV0DCAPiLambda.value[indexCut])) { return false; } - if (pid == LambdaPid::kAntiLambda && (TMath::Abs(v0.dcapostopv()) < grpV0.minV0DCAPiLambda || TMath::Abs(v0.dcanegtopv()) < grpV0.minV0DCAPr)) { + if (pid == LambdaPid::kAntiLambda && (TMath::Abs(v0.dcapostopv()) < grpV0.minV0DCAPiLambda.value[indexCut] || TMath::Abs(v0.dcanegtopv()) < grpV0.minV0DCAPr.value[indexCut])) { return false; } - if (pid == LambdaPid::kLambda && ((std::abs(posTrack.tpcNSigmaPr()) > grpV0.daughPIDCuts) || (std::abs(negTrack.tpcNSigmaPi()) > grpV0.daughPIDCuts))) { + if (pid == LambdaPid::kLambda && ((std::abs(posTrack.tpcNSigmaPr()) > grpV0.daughPIDCuts.value[indexCut]) || (std::abs(negTrack.tpcNSigmaPi()) > grpV0.daughPIDCuts.value[indexCut]))) { return false; } - if (pid == LambdaPid::kAntiLambda && ((std::abs(posTrack.tpcNSigmaPi()) > grpV0.daughPIDCuts) || (std::abs(negTrack.tpcNSigmaPr()) > grpV0.daughPIDCuts))) { + if (pid == LambdaPid::kAntiLambda && ((std::abs(posTrack.tpcNSigmaPi()) > grpV0.daughPIDCuts.value[indexCut]) || (std::abs(negTrack.tpcNSigmaPr()) > grpV0.daughPIDCuts.value[indexCut]))) { return false; } - if (std::abs(CtauLambda) > grpV0.maxLambdaLifeTime) { + if (std::abs(CtauLambda) > grpV0.maxLambdaLifeTime.value[indexCut]) { return false; } return true; @@ -564,15 +608,28 @@ struct Filter2Prong { double massV0 = 0.0; // K0s - if (isSelectedV0AsK0s(collision, v0)) { // candidate is K0s + if (isSelectedV0AsK0s(collision, v0, false, false)) { // candidate is K0s output2ProngTracks(cfcollisions.begin().globalIndex(), posTrack.globalIndex(), negTrack.globalIndex(), v0.pt(), v0.eta(), v0.phi(), v0.mK0Short(), aod::cf2prongtrack::K0stoPiPi); } + if (grpV0.storeLooseTight) // store also loose and tight K0s + { + if (isSelectedV0AsK0s(collision, v0, true, false)) { // candidate is loose K0s + output2ProngTracks(cfcollisions.begin().globalIndex(), + posTrack.globalIndex(), negTrack.globalIndex(), + v0.pt(), v0.eta(), v0.phi(), v0.mK0Short(), aod::cf2prongtrack::K0stoPiPiLoose); + } + if (isSelectedV0AsK0s(collision, v0, false, true)) { // candidate is tight K0s + output2ProngTracks(cfcollisions.begin().globalIndex(), + posTrack.globalIndex(), negTrack.globalIndex(), + v0.pt(), v0.eta(), v0.phi(), v0.mK0Short(), aod::cf2prongtrack::K0stoPiPiTight); + } + } // Lambda and Anti-Lambda - bool LambdaTag = isSelectedV0AsLambda(collision, v0); - bool aLambdaTag = isSelectedV0AsLambda(collision, v0); + bool LambdaTag = isSelectedV0AsLambda(collision, v0, false, false); + bool aLambdaTag = isSelectedV0AsLambda(collision, v0, false, false); // Note: candidate compatible with Lambda and Anti-Lambda hypothesis are counted twice (once for each hypothesis) if (LambdaTag) { // candidate is Lambda @@ -584,6 +641,33 @@ struct Filter2Prong { massV0 = v0.mAntiLambda(); output2ProngTracks(cfcollisions.begin().globalIndex(), posTrack.globalIndex(), negTrack.globalIndex(), v0.pt(), v0.eta(), v0.phi(), massV0, aod::cf2prongtrack::AntiLambdatoPiP); + } + if (grpV0.storeLooseTight) { // store also loose and tight Lambdas + bool LambdaLooseTag = isSelectedV0AsLambda(collision, v0, true, false); + bool aLambdaLooseTag = isSelectedV0AsLambda(collision, v0, true, false); + bool LambdaTightTag = isSelectedV0AsLambda(collision, v0, false, true); + bool aLambdaTightTag = isSelectedV0AsLambda(collision, v0, false, true); + + if (LambdaLooseTag) { // candidate is loose Lambda + massV0 = v0.mLambda(); + output2ProngTracks(cfcollisions.begin().globalIndex(), posTrack.globalIndex(), negTrack.globalIndex(), + v0.pt(), v0.eta(), v0.phi(), massV0, aod::cf2prongtrack::LambdaToPPiLoose); + } + if (LambdaTightTag) { // candidate is tight Lambda + massV0 = v0.mLambda(); + output2ProngTracks(cfcollisions.begin().globalIndex(), posTrack.globalIndex(), negTrack.globalIndex(), + v0.pt(), v0.eta(), v0.phi(), massV0, aod::cf2prongtrack::LambdaToPPiTight); + } + if (aLambdaLooseTag) { // candidate is loose Anti-lambda + massV0 = v0.mAntiLambda(); + output2ProngTracks(cfcollisions.begin().globalIndex(), posTrack.globalIndex(), negTrack.globalIndex(), + v0.pt(), v0.eta(), v0.phi(), massV0, aod::cf2prongtrack::AntiLambdaToPiPLoose); + } + if (aLambdaTightTag) { // candidate is tight Anti-lambda + massV0 = v0.mAntiLambda(); + output2ProngTracks(cfcollisions.begin().globalIndex(), posTrack.globalIndex(), negTrack.globalIndex(), + v0.pt(), v0.eta(), v0.phi(), massV0, aod::cf2prongtrack::AntiLambdaToPiPTight); + } } // end of Lambda and Anti-Lambda processing } // end of loop over V0 candidates @@ -675,15 +759,15 @@ struct Filter2Prong { double massV0 = 0.0; // K0s - if (isSelectedV0AsK0s(collision, v0)) { // candidate is K0s + if (isSelectedV0AsK0s(collision, v0, false, false)) { // candidate is K0s output2ProngTracks(cfcollisions.begin().globalIndex(), posTrack.globalIndex(), negTrack.globalIndex(), v0.pt(), v0.eta(), v0.phi(), v0.mK0Short(), aod::cf2prongtrack::K0stoPiPi); } // Lambda and Anti-Lambda - bool LambdaTag = isSelectedV0AsLambda(collision, v0); - bool aLambdaTag = isSelectedV0AsLambda(collision, v0); + bool LambdaTag = isSelectedV0AsLambda(collision, v0, false, false); + bool aLambdaTag = isSelectedV0AsLambda(collision, v0, false, false); // Note: candidate compatible with Lambda and Anti-Lambda hypothesis are counted twice (once for each hypothesis) if (LambdaTag) { // candidate is Lambda From 22c28ea2c5886a566a8b25347df91cc0fc4ad1fe Mon Sep 17 00:00:00 2001 From: altsybee Date: Mon, 27 Oct 2025 21:55:46 +0100 Subject: [PATCH 917/986] [Common] alternative matching as default for OO, NeNe, occupancy update (#13537) --- Common/Tools/EventSelectionModule.h | 233 +++++++++++++++++----------- 1 file changed, 139 insertions(+), 94 deletions(-) diff --git a/Common/Tools/EventSelectionModule.h b/Common/Tools/EventSelectionModule.h index 5a7c46d3cc7..972849f579a 100644 --- a/Common/Tools/EventSelectionModule.h +++ b/Common/Tools/EventSelectionModule.h @@ -111,22 +111,19 @@ struct evselConfigurables : o2::framework::ConfigurableGroup { o2::framework::Configurable confSigmaBCforHighPtTracks{"confSigmaBCforHighPtTracks", 4, "Custom sigma (in bcs) for collisions with high-pt tracks"}; // configurables for occupancy-based event selection - o2::framework::Configurable confTimeIntervalForOccupancyCalculationMin{"TimeIntervalForOccupancyCalculationMin", -40, "Min time diff window for TPC occupancy calculation, us"}; // o2-linter: disable=name/configurable (temporary fix) - o2::framework::Configurable confTimeIntervalForOccupancyCalculationMax{"TimeIntervalForOccupancyCalculationMax", 100, "Max time diff window for TPC occupancy calculation, us"}; // o2-linter: disable=name/configurable (temporary fix) - o2::framework::Configurable confTimeRangeVetoOnCollStandard{"TimeRangeVetoOnCollStandard", 10.0, "Exclusion of a collision if there are other collisions nearby, +/- us"}; // o2-linter: disable=name/configurable (temporary fix) - o2::framework::Configurable confTimeRangeVetoOnCollNarrow{"TimeRangeVetoOnCollNarrow", 2.0, "Exclusion of a collision if there are other collisions nearby, +/- us"}; // o2-linter: disable=name/configurable (temporary fix) - o2::framework::Configurable confFT0CamplCutVetoOnCollInTimeRange{"FT0CamplPerCollCutVetoOnCollInTimeRange", 8000, "Max allowed FT0C amplitude for each nearby collision in +/- time range"}; // o2-linter: disable=name/configurable (temporary fix) - o2::framework::Configurable confFT0CamplCutVetoOnCollInROF{"FT0CamplPerCollCutVetoOnCollInROF", 5000, "Max allowed FT0C amplitude for each nearby collision inside this ITS ROF"}; // o2-linter: disable=name/configurable (temporary fix) - o2::framework::Configurable confEpsilonVzDiffVetoInROF{"EpsilonVzDiffVetoInROF", 0.3, "Minumum distance to nearby collisions along z inside this ITS ROF, cm"}; // o2-linter: disable=name/configurable (temporary fix) - o2::framework::Configurable confUseWeightsForOccupancyVariable{"UseWeightsForOccupancyEstimator", 1, "Use or not the delta-time weights for the occupancy estimator"}; // o2-linter: disable=name/configurable (temporary fix) - o2::framework::Configurable confNumberOfOrbitsPerTF{"NumberOfOrbitsPerTF", -1, "Number of orbits per Time Frame. Take from CCDB if -1"}; // o2-linter: disable=name/configurable (temporary fix) - - // configurables for light-ion event selection (testing mode) - o2::framework::Configurable confLightIonsAlternativeBcMatching{"TestAlternativeBcMatching", 0, "0 - use standard matching, 1 - try alternative for light ions"}; // o2-linter: disable=name/configurable (temporary fix) - o2::framework::Configurable confLightIonsModifyTimeVetoOnNearbyColl{"TestModifyTimeVetoOnNearbyColl", 0, "0 - use standard time veto, 1 - modify time range"}; // o2-linter: disable=name/configurable (temporary fix) - o2::framework::Configurable confLightIonsVetoOnTRDinPast{"TestVetoOnTRDinPast", 0, "0 - use standard time veto, 1 - use veto on TRD in the past events"}; // o2-linter: disable=name/configurable (temporary fix) - o2::framework::Configurable confLightIonsNsigmaOnVzDiff{"TestVzDiffNsigma", 3.0, "+/- nSigma on vZ difference by FT0 and by tracks"}; // o2-linter: disable=name/configurable (temporary fix) - o2::framework::Configurable confLightIonsMarginVzDiff{"TestVzDiffMargin", 0.2, "margin for +/- nSigma on vZ difference by FT0 and by tracks"}; // o2-linter: disable=name/configurable (temporary fix) + o2::framework::Configurable confTimeIntervalForOccupancyCalculationMin{"TimeIntervalForOccupancyCalculationMin", -40, "Min time diff window for TPC occupancy calculation, us"}; // o2-linter: disable=name/configurable (temporary fix) + o2::framework::Configurable confTimeIntervalForOccupancyCalculationMax{"TimeIntervalForOccupancyCalculationMax", 100, "Max time diff window for TPC occupancy calculation, us"}; // o2-linter: disable=name/configurable (temporary fix) + o2::framework::Configurable confTimeRangeVetoOnCollStrict{"TimeRangeVetoOnCollStrict", 10.0, "Exclusion of a collision if there are other collisions nearby, +/- us"}; // o2-linter: disable=name/configurable (temporary fix) + o2::framework::Configurable confTimeRangeVetoOnCollNarrow{"TimeRangeVetoOnCollNarrow", 0.25, "Exclusion of a collision if other collisions nearby, to suppress bc-collision mis-associations, +/- us"}; // o2-linter: disable=name/configurable (temporary fix) + o2::framework::Configurable confFT0CamplCutVetoOnCollInTimeRange{"FT0CamplPerCollCutVetoOnCollInTimeRange", 8000, "Max allowed FT0C amplitude for each nearby collision in +/- time range"}; // o2-linter: disable=name/configurable (temporary fix) + o2::framework::Configurable confFT0CamplCutVetoOnCollInROF{"FT0CamplPerCollCutVetoOnCollInROF", 5000, "Max allowed FT0C amplitude for each nearby collision inside this ITS ROF"}; // o2-linter: disable=name/configurable (temporary fix) + o2::framework::Configurable confEpsilonVzDiffVetoInROF{"EpsilonVzDiffVetoInROF", 0.3, "Minumum distance to nearby collisions along z inside this ITS ROF, cm"}; // o2-linter: disable=name/configurable (temporary fix) + o2::framework::Configurable confUseWeightsForOccupancyVariable{"UseWeightsForOccupancyEstimator", 1, "Use or not the delta-time weights for the occupancy estimator"}; // o2-linter: disable=name/configurable (temporary fix) + o2::framework::Configurable confNumberOfOrbitsPerTF{"NumberOfOrbitsPerTF", -1, "Number of orbits per Time Frame. Take from CCDB if -1"}; // o2-linter: disable=name/configurable (temporary fix) + + // configurables for light-ion event selection + o2::framework::Configurable confLightIonsNsigmaOnVzDiff{"VzDiffNsigma", 3.0, "+/- nSigma on vZ difference by FT0 and by tracks"}; // o2-linter: disable=name/configurable (temporary fix) + o2::framework::Configurable confLightIonsMarginVzDiff{"VzDiffMargin", 0.2, "margin for +/- nSigma cut on vZ difference by FT0 and by tracks, cm"}; // o2-linter: disable=name/configurable (temporary fix) }; // luminosity configurables @@ -232,8 +229,6 @@ class BcSelectionModule bcSOR = runInfo.orbitSOR * nBCsPerOrbit; // duration of TF in bcs nBCsPerTF = bcselOpts.confNumberOfOrbitsPerTF < 0 ? runInfo.orbitsPerTF * nBCsPerOrbit : bcselOpts.confNumberOfOrbitsPerTF * nBCsPerOrbit; - if (strLPMProductionTag == "LHC25f3") // temporary workaround for MC production LHC25f3 anchored to Pb-Pb 2023 apass5 (to be removed once the info is in ccdb) - nBCsPerTF = 8 * nBCsPerOrbit; } // timestamp of the middle of the run used to access run-wise CCDB entries @@ -692,6 +687,20 @@ class EventSelectionModule return bestGlobalBC; } + float calcWeightForOccupancy(float dt) + { + float wOccup = 0; + if (dt >= -40 && dt < -5) // collisions in the past // o2-linter: disable=magic-number + wOccup = 1. / 1225 * (dt + 40) * (dt + 40); // o2-linter: disable=magic-number + else if (dt >= -5 && dt < 15) // collisions near a given one // o2-linter: disable=magic-number + wOccup = 1; + else if (dt >= 15 && dt < 40) // collisions from the future // o2-linter: disable=magic-number + wOccup = -0.4 / 25 * dt + 1.24; // o2-linter: disable=magic-number + else if (dt >= 40 && dt < 100) // collisions from the distant future // o2-linter: disable=magic-number + wOccup = -0.4 / 60 * dt + 0.6 + 0.8 / 3; // o2-linter: disable=magic-number + return wOccup; + } + // declaration of structs here // (N.B.: will be invisible to the outside, create your own copies) o2::common::eventselection::evselConfigurables evselOpts; @@ -753,20 +762,20 @@ class EventSelectionModule auto grplhcif = ccdb->template getSpecific("GLO/Config/GRPLHCIF", ts); bcPatternB = grplhcif->getBunchFilling().getBCPattern(); bcsPattern = grplhcif->getBunchFilling().getFilledBCs(); + if (runLightIons >= 0) { + for (uint32_t i = 0; i < bcsPattern.size(); i++) + LOGP(debug, "bcsPattern: i={} bc={}", i, bcsPattern.at(i)); + } // extract ITS ROF parameters auto alppar = ccdb->template getForTimeStamp>("ITS/Config/AlpideParam", ts); rofOffset = alppar->roFrameBiasInBC; rofLength = alppar->roFrameLengthInBC; LOGP(debug, "ITS ROF Offset={} ITS ROF Length={}", rofOffset, rofLength); - if (evselOpts.confLightIonsAlternativeBcMatching) { - for (unsigned long i = 0; i < bcsPattern.size(); i++) - LOGP(info, "bcsPattern: i={} bc={}", i, bcsPattern.at(i)); - } // special treatment of light ion runs if (lastRun >= 564356 && lastRun <= 564472) { - for (unsigned long i = 0; i < sizeof(runListLightIons) / sizeof(*runListLightIons); i++) { + for (uint32_t i = 0; i < sizeof(runListLightIons) / sizeof(*runListLightIons); i++) { if (runListLightIons[i] == lastRun) { runLightIons = lastRun; // extract parameterization for diff of vZ by FT0 vs by tracks @@ -919,15 +928,12 @@ class EventSelectionModule } return; } - std::vector vTracksITS567perColl(cols.size(), 0); // counter of tracks per collision for occupancy studies - std::vector vAmpFT0CperColl(cols.size(), 0); // amplitude FT0C per collision - std::vector vCollVz(cols.size(), 0); // vector with vZ positions for each collision - std::vector vIsFullInfoForOccupancy(cols.size(), 0); // info for occupancy in +/- windows is available (i.e. a given coll is not too close to the TF borders) - const float timeWinOccupancyCalcMinNS = evselOpts.confTimeIntervalForOccupancyCalculationMin * 1e3; // ns - const float timeWinOccupancyCalcMaxNS = evselOpts.confTimeIntervalForOccupancyCalculationMax * 1e3; // ns - std::vector vIsVertexITSTPC(cols.size(), 0); // at least one of vertex contributors is ITS-TPC track - std::vector vIsVertexTOFmatched(cols.size(), 0); // at least one of vertex contributors is matched to TOF - std::vector vIsVertexTRDmatched(cols.size(), 0); // at least one of vertex contributors is matched to TRD + std::vector vTracksITS567perColl(cols.size(), 0); // counter of tracks per collision for occupancy studies + std::vector vAmpFT0CperColl(cols.size(), 0); // amplitude FT0C per collision + std::vector vCollVz(cols.size(), 0); // vector with vZ positions for each collision + std::vector vIsVertexITSTPC(cols.size(), 0); // at least one of vertex contributors is ITS-TPC track + std::vector vIsVertexTOFmatched(cols.size(), 0); // at least one of vertex contributors is matched to TOF + std::vector vIsVertexTRDmatched(cols.size(), 0); // at least one of vertex contributors is matched to TRD std::vector vCollisionsPerBc(bcs.size(), 0); // counter of collisions per found bc for pileup checks std::vector vCollisionsPileupPerColl(cols.size(), 0); // counter of pileup in the same bc as a given collision @@ -950,19 +956,13 @@ class EventSelectionModule // first loop to match collisions to TVX, also extract other per-collision information for further use for (const auto& col : cols) { int32_t colIndex = col.globalIndex(); - auto bc = col.template bc_as>(); - vCollVz[colIndex] = col.posZ(); - int64_t globalBC = bc.globalBC(); - int bcInTF = (bc.globalBC() - bcSOR) % nBCsPerTF; - vIsFullInfoForOccupancy[colIndex] = ((bcInTF - 300) * bcNS > -timeWinOccupancyCalcMinNS) && ((nBCsPerTF - 4000 - bcInTF) * bcNS > timeWinOccupancyCalcMaxNS) ? true : false; - - const auto& colPvTracks = pvTracks.sliceByCached(aod::track::collisionId, col.globalIndex(), cache); vTrackTimesTOF.clear(); vTrackTimesTRDnoTOF.clear(); int nPvTracksTPCnoTOFnoTRD = 0; int nPvTracksHighPtTPCnoTOFnoTRD = 0; + const auto& colPvTracks = pvTracks.sliceByCached(aod::track::collisionId, col.globalIndex(), cache); float sumTime = 0, sumW = 0, sumHighPtTime = 0, sumHighPtW = 0; for (const auto& track : colPvTracks) { float trackTime = track.trackTime(); @@ -1002,14 +1002,17 @@ class EventSelectionModule vIsVertexTPC[colIndex] = nPvTracksTPCnoTOFnoTRD > 0; vIsVertexHighPtTPC[colIndex] = nPvTracksHighPtTPCnoTOFnoTRD > 0; + // collision-bc association, other bc-related routine + auto bc = col.template bc_as>(); + int64_t globalBC = bc.globalBC(); int64_t foundGlobalBC = 0; int32_t foundBCindex = -1; // alternative collision-BC matching (currently: test mode, the aim is to improve pileup rejection) - if (evselOpts.confLightIonsAlternativeBcMatching) { + if (runLightIons >= 0) { foundGlobalBC = globalBC; // find closest nominal bc in pattern - for (unsigned long i = 0; i < bcsPattern.size(); i++) { + for (uint32_t i = 0; i < bcsPattern.size(); i++) { int32_t localBC = globalBC % nBCsPerOrbit; int32_t bcFromPattern = bcsPattern.at(i); int64_t bcDiff = bcFromPattern - localBC; @@ -1046,7 +1049,7 @@ class EventSelectionModule if (bestGlobalBC > 0) { foundGlobalBC = bestGlobalBC; // find closest nominal bc in pattern - for (unsigned long j = 0; j < bcsPattern.size(); j++) { + for (uint32_t j = 0; j < bcsPattern.size(); j++) { int32_t bcFromPatternBest = bcsPattern.at(j); int64_t bcDiff = bcFromPatternBest - (bestGlobalBC % nBCsPerOrbit); if (std::abs(bcDiff) <= 20) { @@ -1104,10 +1107,10 @@ class EventSelectionModule mapGlobalBcVtxZ.erase(foundGlobalBC); } // alternative matching: looking for collisions with the same nominal BC - if (evselOpts.confLightIonsAlternativeBcMatching) { - for (unsigned long iCol = 0; iCol < vBCinPatternPerColl.size(); iCol++) { + if (runLightIons >= 0) { + for (uint32_t iCol = 0; iCol < vBCinPatternPerColl.size(); iCol++) { int64_t foundNominalBC = vBCinPatternPerColl[iCol]; - for (unsigned long jCol = 0; jCol < vBCinPatternPerColl.size(); jCol++) { + for (uint32_t jCol = 0; jCol < vBCinPatternPerColl.size(); jCol++) { int64_t foundNominalBC2 = vBCinPatternPerColl[jCol]; if (foundNominalBC2 == foundNominalBC) { vCollisionsPileupPerColl[iCol]++; @@ -1133,6 +1136,36 @@ class EventSelectionModule } } + // pre-loop for occupancy calculation + std::vector vIsFullInfoForOccupancy(cols.size(), 0); // info for occupancy in +/- windows is available (i.e. a given coll is not too close to the TF borders) + std::vector vIsCollAtROFborder(cols.size(), 0); // collision is close to ITS ROF border + std::vector vIsCollRejectedByTFborderCut(cols.size(), 0); // helper vector with + std::vector vCanHaveAssocCollsWithinLastDriftTime(cols.size(), 0); // to see if for some collisions in the occupancy calc (that are close to TF border) we will switch to FT0C based occupancy estimation + + const float timeWinOccupancyCalcMinNS = evselOpts.confTimeIntervalForOccupancyCalculationMin * 1e3; // ns + const float timeWinOccupancyCalcMaxNS = evselOpts.confTimeIntervalForOccupancyCalculationMax * 1e3; // ns + + for (const auto& col : cols) { + int32_t colIndex = col.globalIndex(); + int64_t foundGlobalBC = vFoundGlobalBC[colIndex]; + int bcInTF = (foundGlobalBC - bcSOR) % nBCsPerTF; + vIsFullInfoForOccupancy[colIndex] = ((bcInTF - 10) * bcNS > -timeWinOccupancyCalcMinNS) && ((nBCsPerTF - 10 - bcInTF) * bcNS > timeWinOccupancyCalcMaxNS) ? true : false; // 10 BCs is margin + + int32_t foundBC = vFoundBCindex[colIndex]; + auto bcselEntry = bcselbuffer[foundBC]; + // check if we are close to ROF or TF borders => N tracks are not reliable, but FT0 can be used for occupancy estimation + if (!bitcheck64(bcselEntry.selection, aod::evsel::kNoITSROFrameBorder)) { + vIsCollAtROFborder[colIndex] = true; + } + + if (!bitcheck64(bcselEntry.selection, aod::evsel::kNoTimeFrameBorder)) { + vIsCollRejectedByTFborderCut[colIndex] = true; + } + if (nBCsPerTF - bcInTF < 4000 * 2) { + vCanHaveAssocCollsWithinLastDriftTime[colIndex] = true; + } + } + // save indices of collisions for occupancy calculation (both in ROF and in time range) std::vector> vCollsInSameITSROF; std::vector> vCollsInPrevITSROF; @@ -1302,73 +1335,85 @@ class EventSelectionModule std::vector vCollsTimeDeltaWrtGivenColl = vTimeDeltaForColls[colIndex]; int nITS567tracksInFullTimeWindow = 0; float sumAmpFT0CInFullTimeWindow = 0; - int nITS567tracksForVetoNarrow = 0; // to veto events with nearby collisions (narrower range) + int nITS567tracksForVetoNarrow = 0; // to veto events with nearby collisions (narrow range) with per-collision multiplicity above threshold int nITS567tracksForVetoStrict = 0; // to veto events with nearby collisions - int nCollsWithFT0CAboveVetoStandard = 0; // to veto events with per-collision multiplicity above threshold + int nCollsWithFT0CAboveVetoStandard = 0; // to veto events with nearby collisions that have per-collision multiplicity above threshold + int colIndexFirstRejectedByTFborderCut = -1; for (uint32_t iCol = 0; iCol < vAssocToThisCol.size(); iCol++) { int thisColIndex = vAssocToThisCol[iCol]; + // check if we are close to TF borders => N ITS tracks is not reliable, and FT0C ampl will be used for occupancy estimation (a loop below) + if (vIsCollRejectedByTFborderCut[thisColIndex]) { + if (colIndexFirstRejectedByTFborderCut == -1) + colIndexFirstRejectedByTFborderCut = thisColIndex; + continue; + } float dt = vCollsTimeDeltaWrtGivenColl[iCol] / 1e3; // ns -> us float wOccup = 1.; if (evselOpts.confUseWeightsForOccupancyVariable) { // weighted occupancy - wOccup = 0; - if (dt >= -40 && dt < -5) // collisions in the past // o2-linter: disable=magic-number (to be checked by Igor) - wOccup = 1. / 1225 * (dt + 40) * (dt + 40); // o2-linter: disable=magic-number (to be checked by Igor) - else if (dt >= -5 && dt < 15) // collisions near a given one // o2-linter: disable=magic-number (to be checked by Igor) - wOccup = 1; - // else if (dt >= 15 && dt < 100) // collisions from the future - // wOccup = -1. / 85 * dt + 20. / 17; - else if (dt >= 15 && dt < 40) // collisions from the future // o2-linter: disable=magic-number (to be checked by Igor) - wOccup = -0.4 / 25 * dt + 1.24; // o2-linter: disable=magic-number (to be checked by Igor) - else if (dt >= 40 && dt < 100) // collisions from the distant future // o2-linter: disable=magic-number (to be checked by Igor) - wOccup = -0.4 / 60 * dt + 0.6 + 0.8 / 3; // o2-linter: disable=magic-number (to be checked by Igor) + wOccup = calcWeightForOccupancy(dt); } - nITS567tracksInFullTimeWindow += wOccup * vTracksITS567perColl[thisColIndex]; + + // check if we are close to ITS ROF borders => N ITS tracks is not reliable, and FT0C ampl can be used for occupancy estimation + // denominator for vAmpFT0CperColl is the approximate conversion factor b/n FT0C ampl and number of PV tracks after cuts + int nItsTracksAssocColl = !vIsCollAtROFborder[thisColIndex] ? vTracksITS567perColl[thisColIndex] : vAmpFT0CperColl[thisColIndex] / 10.; + + nITS567tracksInFullTimeWindow += wOccup * nItsTracksAssocColl; sumAmpFT0CInFullTimeWindow += wOccup * vAmpFT0CperColl[thisColIndex]; // counting tracks from other collisions in fixed time windows - if (!evselOpts.confLightIonsModifyTimeVetoOnNearbyColl) { - if (std::fabs(dt) < evselOpts.confTimeRangeVetoOnCollNarrow) - nITS567tracksForVetoNarrow += vTracksITS567perColl[thisColIndex]; - if (std::fabs(dt) < evselOpts.confTimeRangeVetoOnCollStandard) - nITS567tracksForVetoStrict += vTracksITS567perColl[thisColIndex]; - } else { // special veto ranges (tests for light ion runs) - if (dt > -4.5 && dt < 2.5) // avoid TOF- and TRD-related structures, with 0.5 us margin - nITS567tracksForVetoNarrow += vTracksITS567perColl[thisColIndex]; - - if (!evselOpts.confLightIonsVetoOnTRDinPast) { - if (dt > -25.5 && dt < 2.5) // test effect from TRD triggers in the past - nITS567tracksForVetoStrict += vTracksITS567perColl[thisColIndex]; - } else { - // counting TRD-matched vertices in a long time interval in the past - if (dt > -25.5 && dt < 2.5) - nITS567tracksForVetoStrict += vIsVertexTRDmatched[thisColIndex]; - } + if (std::fabs(dt) < evselOpts.confTimeRangeVetoOnCollNarrow) + nITS567tracksForVetoNarrow += nItsTracksAssocColl; + if (std::fabs(dt) < evselOpts.confTimeRangeVetoOnCollStrict) + nITS567tracksForVetoStrict += nItsTracksAssocColl; + + // standard cut on other collisions vs delta-times: + // veto on high-mult collisions nearby, where artificial structures in the dt-occupancy plots are observed + if (dt > -4.0 && dt < 2.0 && vAmpFT0CperColl[thisColIndex] > evselOpts.confFT0CamplCutVetoOnCollInTimeRange) { // dt in us // o2-linter: disable=magic-number + nCollsWithFT0CAboveVetoStandard++; } + } - // standard cut on other collisions vs delta-times - const float driftV = 2.5; // drift velocity in cm/us, TPC drift_length / drift_time = 250 cm / 100 us - if (std::fabs(dt) < 2.0) { // us, complete veto on other collisions // o2-linter: disable=magic-number (to be checked by Igor) - nCollsWithFT0CAboveVetoStandard++; - } else if (dt > -4.0 && dt <= -2.0) { // us, strict veto to suppress fake ITS-TPC matches more // o2-linter: disable=magic-number (to be checked by Igor) - if (vAmpFT0CperColl[thisColIndex] > evselOpts.confFT0CamplCutVetoOnCollInTimeRange / 5) - nCollsWithFT0CAboveVetoStandard++; - } else if (std::fabs(dt) < 8 + std::fabs(vZ) / driftV) { // loose veto, 8 us corresponds to maximum possible |vZ|, which is ~20 cm // o2-linter: disable=magic-number (to be checked by Igor) - // counting number of other collisions with multiplicity above threshold - if (vAmpFT0CperColl[thisColIndex] > evselOpts.confFT0CamplCutVetoOnCollInTimeRange) - nCollsWithFT0CAboveVetoStandard++; + // if some associated collisions are close to TF border - take FT0C amplitude instead of nTracks + if (vCanHaveAssocCollsWithinLastDriftTime[colIndex] && colIndexFirstRejectedByTFborderCut >= 0) { + int64_t foundGlobalBC = vFoundGlobalBC[colIndex]; + int64_t tfId = (foundGlobalBC - bcSOR) / nBCsPerTF; + std::map::iterator it = mapGlobalBcWithTVX.find(vFoundGlobalBC[colIndexFirstRejectedByTFborderCut]); + while (it != mapGlobalBcWithTVX.end()) { + int64_t thisFoundGlobalBC = it->first; + int32_t thisFoundBCindex = it->second; + auto bc = bcs.iteratorAt(thisFoundBCindex); + int64_t thisTFid = (bc.globalBC() - bcSOR) / nBCsPerTF; + if (thisTFid != tfId) + break; + + float dt = (thisFoundGlobalBC - foundGlobalBC) * bcNS; // ns + if (dt > timeWinOccupancyCalcMaxNS) + break; + + float multT0C = -1; + if (bc.has_ft0()) { + multT0C = bc.ft0().sumAmpC(); + float wOccup = 1.; + if (evselOpts.confUseWeightsForOccupancyVariable) { + wOccup = calcWeightForOccupancy(dt / 1e3); // ns -> us + } + if (multT0C > 50.) // multiplicity in TVX is non-negligible, take it into occupancy calc + { + nITS567tracksInFullTimeWindow += wOccup * multT0C / 10.; + sumAmpFT0CInFullTimeWindow += wOccup * multT0C; + } + } + it++; } } + vNumTracksITS567inFullTimeWin[colIndex] = nITS567tracksInFullTimeWindow; // occupancy by a sum of number of ITS tracks (without a current collision) vSumAmpFT0CinFullTimeWin[colIndex] = sumAmpFT0CInFullTimeWindow; // occupancy by a sum of FT0C amplitudes (without a current collision) // occupancy flags based on nearby collisions vNoCollInTimeRangeNarrow[colIndex] = (nITS567tracksForVetoNarrow == 0); - if (!evselOpts.confLightIonsVetoOnTRDinPast) - vNoCollInTimeRangeStrict[colIndex] = (nITS567tracksForVetoStrict == 0); - else - vNoCollInTimeRangeStrict[colIndex] = (nITS567tracksForVetoStrict == 0 && nITS567tracksForVetoNarrow == 0); - - vNoHighMultCollInTimeRange[colIndex] = (nCollsWithFT0CAboveVetoStandard == 0); + vNoCollInTimeRangeStrict[colIndex] = (nITS567tracksForVetoStrict == 0); + vNoHighMultCollInTimeRange[colIndex] = (nCollsWithFT0CAboveVetoStandard == 0 && nITS567tracksForVetoNarrow == 0); } for (const auto& col : cols) { @@ -1409,7 +1454,7 @@ class EventSelectionModule // copy selection decisions from bcsel table uint64_t selection = bcselbuffer[bc.globalIndex()].selection; - if (evselOpts.confLightIonsAlternativeBcMatching) + if (runLightIons >= 0) // for light ions, apply different condition to assign pileup flags selection |= vCollisionsPileupPerColl[colIndex] <= 1 ? BIT(aod::evsel::kNoSameBunchPileup) : 0; else selection |= vCollisionsPerBc[foundBC] <= 1 ? BIT(aod::evsel::kNoSameBunchPileup) : 0; From 0945b40a8993db694008537fe55cbbabb73c54ff Mon Sep 17 00:00:00 2001 From: Marvin Hemmer <53471402+mhemmer-cern@users.noreply.github.com> Date: Mon, 27 Oct 2025 23:51:19 +0100 Subject: [PATCH 918/986] [PWGEM,PWGEM-36] Pi0FlowEMC: Fix wrong collision type (#13561) --- PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx b/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx index 7a0defc749a..c7f46123f86 100644 --- a/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx @@ -486,10 +486,7 @@ struct TaskPi0FlowEMC { /// \param cent is the centrality of the collision /// \param sp is the scalar product template - void fillThn(float& mass, - float& pt, - float& cent, - float& sp) + void fillThn(const float mass, const float pt, const float cent, const float sp) { static constexpr std::string_view FlowHistTypes[3] = {"hSparsePi0Flow", "hSparseBkgRotFlow", "hSparseBkgMixFlow"}; static constexpr std::string_view HistTypes[3] = {"hSparsePi0", "hSparseBkgRot", "hSparseBkgMix"}; @@ -523,7 +520,8 @@ struct TaskPi0FlowEMC { /// Get all used Q vector /// \param collision is the collision with the Q vector information - std::vector getAllQvec(CollsWithQvecs::iterator const& collision) + template + std::vector getAllQvec(TCollision const& collision) { // Retrieve the Q vectors using the helper function for each detector auto [xQVecMain, yQVecMain] = getQvec(collision, qvecDetector); @@ -535,7 +533,8 @@ struct TaskPi0FlowEMC { /// Get the Q vector /// \param collision is the collision with the Q vector information - std::pair getQvec(CollsWithQvecs::iterator const& collision, int detector) + template + std::pair getQvec(TCollision const& collision, int detector) { float xQVec = -999.f; float yQVec = -999.f; @@ -706,8 +705,8 @@ struct TaskPi0FlowEMC { } /// \brief Calculate background using rotation background method - template - void rotationBackground(const ROOT::Math::PtEtaPhiMVector& meson, ROOT::Math::PtEtaPhiMVector photon1, ROOT::Math::PtEtaPhiMVector photon2, TPhotons const& photons_coll, unsigned int ig1, unsigned int ig2, CollsWithQvecs::iterator const& collision) + template + void rotationBackground(const ROOT::Math::PtEtaPhiMVector& meson, ROOT::Math::PtEtaPhiMVector photon1, ROOT::Math::PtEtaPhiMVector photon2, TPhotons const& photons_coll, unsigned int ig1, unsigned int ig2, TCollision const& collision) { // if less than 3 clusters are present skip event since we need at least 3 clusters if (photons_coll.size() < NMinPhotonRotBkg) { @@ -894,8 +893,8 @@ struct TaskPi0FlowEMC { /// Compute the scalar product /// \param collision is the collision with the Q vector information and event plane /// \param meson are the selected candidates - template - void runFlowAnalysis(CollsWithQvecs::iterator const& collision, ROOT::Math::PtEtaPhiMVector const& meson) + template + void runFlowAnalysis(TCollision const& collision, ROOT::Math::PtEtaPhiMVector const& meson) { auto [xQVec, yQVec] = getQvec(collision, qvecDetector); float cent = getCentrality(collision); From 0fb1d553fac3d06ad3b07d8b2a2f3c19f0a6329c Mon Sep 17 00:00:00 2001 From: arvindkhuntia <31609955+arvindkhuntia@users.noreply.github.com> Date: Tue, 28 Oct 2025 00:22:52 +0100 Subject: [PATCH 919/986] [PWGLF] [PWGMM] Only add non-zero ctp mask (#13566) Co-authored-by: Arvind Khuntia --- PWGMM/Lumi/Tasks/LumiFDDFT0.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PWGMM/Lumi/Tasks/LumiFDDFT0.cxx b/PWGMM/Lumi/Tasks/LumiFDDFT0.cxx index 50bef7a255b..36af7fb2e0e 100644 --- a/PWGMM/Lumi/Tasks/LumiFDDFT0.cxx +++ b/PWGMM/Lumi/Tasks/LumiFDDFT0.cxx @@ -352,6 +352,9 @@ struct LumiFDDFT0 { for (const auto& bc : bcs) { if (!bc.timestamp()) continue; + if (bc.inputMask() == 0) // No trigger inputs active + continue; + if (useRelTimeStamp) { Long64_t relTS = bc.timestamp() - fttimestamp; rowEventInfoCTP(relTS, bc.globalBC(), bc.inputMask()); From 248931fc7ea77ac8d55df1f5caba0d8b72d417ea Mon Sep 17 00:00:00 2001 From: ariedel-cern <85537041+ariedel-cern@users.noreply.github.com> Date: Tue, 28 Oct 2025 01:07:55 +0100 Subject: [PATCH 920/986] [PWGCF] Update femto framework (#13568) --- PWGCF/Femto/Core/baseSelection.h | 2 +- PWGCF/Femto/Core/cascadeBuilder.h | 8 +- PWGCF/Femto/Core/cascadeHistManager.h | 153 ++++--- PWGCF/Femto/Core/closePairRejection.h | 365 +++++++++++++---- PWGCF/Femto/Core/collisionBuilder.h | 8 +- PWGCF/Femto/Core/collisionHistManager.h | 102 +++-- PWGCF/Femto/Core/dataTypes.h | 2 +- PWGCF/Femto/Core/kinkBuilder.h | 8 +- PWGCF/Femto/Core/kinkHistManager.h | 178 ++++---- PWGCF/Femto/Core/modes.h | 3 +- PWGCF/Femto/Core/pairBuilder.h | 270 ++++++------ PWGCF/Femto/Core/pairHistManager.h | 196 +++++++-- PWGCF/Femto/Core/pairProcessHelpers.h | 36 +- PWGCF/Femto/Core/trackBuilder.h | 6 +- PWGCF/Femto/Core/trackHistManager.h | 387 +++++++++++------- PWGCF/Femto/Core/twoTrackResonanceBuilder.h | 4 +- .../Femto/Core/twoTrackResonanceHistManager.h | 115 ++++-- PWGCF/Femto/Core/v0Builder.h | 4 +- PWGCF/Femto/Core/v0HistManager.h | 164 +++++--- PWGCF/Femto/Tasks/femtoCascadeQa.cxx | 6 +- PWGCF/Femto/Tasks/femtoKinkQa.cxx | 4 +- PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx | 22 +- PWGCF/Femto/Tasks/femtoPairTrackKink.cxx | 2 +- PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx | 2 +- .../Tasks/femtoPairTrackTwoTrackResonance.cxx | 26 +- PWGCF/Femto/Tasks/femtoPairTrackV0.cxx | 18 +- PWGCF/Femto/Tasks/femtoPairV0V0.cxx | 6 +- PWGCF/Femto/Tasks/femtoTrackQa.cxx | 4 +- .../Femto/Tasks/femtoTwotrackresonanceQa.cxx | 8 +- PWGCF/Femto/Tasks/femtoV0Qa.cxx | 6 +- 30 files changed, 1364 insertions(+), 751 deletions(-) diff --git a/PWGCF/Femto/Core/baseSelection.h b/PWGCF/Femto/Core/baseSelection.h index f5487262912..8ada2f09ed1 100644 --- a/PWGCF/Femto/Core/baseSelection.h +++ b/PWGCF/Femto/Core/baseSelection.h @@ -47,7 +47,7 @@ class BaseSelection { public: /// \brief Default constructor. - BaseSelection() {} + BaseSelection() = default; /// \brief Destructor virtual ~BaseSelection() = default; diff --git a/PWGCF/Femto/Core/cascadeBuilder.h b/PWGCF/Femto/Core/cascadeBuilder.h index c65611da008..5c73652b055 100644 --- a/PWGCF/Femto/Core/cascadeBuilder.h +++ b/PWGCF/Femto/Core/cascadeBuilder.h @@ -171,8 +171,8 @@ template class CascadeSelection : public BaseSelection { public: - CascadeSelection() {} - virtual ~CascadeSelection() = default; + CascadeSelection() = default; + ~CascadeSelection() = default; template void configure(T1 const& config, T2 const& filter) @@ -331,8 +331,8 @@ template class CascadeBuilder { public: - CascadeBuilder() {} - virtual ~CascadeBuilder() = default; + CascadeBuilder() = default; + ~CascadeBuilder() = default; template void init(T1& config, T2& filter, T3& table, T4& initContext) diff --git a/PWGCF/Femto/Core/cascadeHistManager.h b/PWGCF/Femto/Core/cascadeHistManager.h index 4619b30ae26..358c72292ff 100644 --- a/PWGCF/Femto/Core/cascadeHistManager.h +++ b/PWGCF/Femto/Core/cascadeHistManager.h @@ -78,6 +78,7 @@ using ConfOmegaBinning = ConfCascadeBinning; template struct ConfCascadeQaBinning : o2::framework::ConfigurableGroup { std::string prefix = Prefix; + o2::framework::Configurable plot2d{"plot2d", true, "Enable 2d Qa histograms"}; o2::framework::ConfigurableAxis cosPa{"cosPa", {{100, 0.9, 1}}, "Cosine of poiting angle"}; o2::framework::ConfigurableAxis dauDcaAtDecay{"dauDcaAtDecay", {{150, 0, 1.5}}, "Daughter DCA at decay vertex"}; o2::framework::ConfigurableAxis transRadius{"transRadius", {{100, 0, 100}}, "Transverse radius"}; @@ -169,48 +170,48 @@ class CascadeHistManager { public: CascadeHistManager() = default; - virtual ~CascadeHistManager() = default; - /// Initializes histograms for the task - /// \param registry Histogram registry to be passed - /// + ~CascadeHistManager() = default; + void init(o2::framework::HistogramRegistry* registry, - std::map> cascadeSpecs, - std::map> BachelorSpecs, - std::map> PosDauSpecs, - std::map> NegDauSpecs) + std::map> const& cascadeSpecs, + std::map> const& BachelorSpecs, + std::map> const& PosDauSpecs, + std::map> const& NegDauSpecs) { mHistogramRegistry = registry; mBachelorManager.init(registry, BachelorSpecs); mPosDauManager.init(registry, PosDauSpecs); mNegDauManager.init(registry, NegDauSpecs); if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { - std::string analysisDir = std::string(cascadePrefix) + std::string(AnalysisDir); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {cascadeSpecs[kPt]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {cascadeSpecs[kEta]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {cascadeSpecs[kPhi]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kMass, HistTable), getHistDesc(kMass, HistTable), getHistType(kMass, HistTable), {cascadeSpecs[kMass]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {cascadeSpecs[kSign]}); + initAnalysis(cascadeSpecs); } - if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { - std::string qaDir = std::string(cascadePrefix) + std::string(QaDir); - - mHistogramRegistry->add(qaDir + getHistNameV2(kCosPa, HistTable), getHistDesc(kCosPa, HistTable), getHistType(kCosPa, HistTable), {cascadeSpecs[kCosPa]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kDecayDauDca, HistTable), getHistDesc(kDecayDauDca, HistTable), getHistType(kDecayDauDca, HistTable), {cascadeSpecs[kDecayDauDca]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kTransRadius, HistTable), getHistDesc(kTransRadius, HistTable), getHistType(kTransRadius, HistTable), {cascadeSpecs[kTransRadius]}); + initQa(cascadeSpecs); + } + } - // qa 2d - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsEta, HistTable), getHistDesc(kPtVsEta, HistTable), getHistType(kPtVsEta, HistTable), {cascadeSpecs[kPtVsEta]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPhi, HistTable), getHistDesc(kPtVsPhi, HistTable), getHistType(kPtVsPhi, HistTable), {cascadeSpecs[kPtVsPhi]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPhiVsEta, HistTable), getHistDesc(kPhiVsEta, HistTable), getHistType(kPhiVsEta, HistTable), {cascadeSpecs[kPhiVsEta]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsCosPa, HistTable), getHistDesc(kPtVsCosPa, HistTable), getHistType(kPtVsCosPa, HistTable), {cascadeSpecs[kPtVsCosPa]}); + template + void enableOptionalHistograms(T1 const& CascadeConfBinningQa, T2 const& BachelorConfBinningQa, T3 const& PosDauConfBinningQa, T4 const& NegDauConfBinningQa) + { + mBachelorManager.enableOptionalHistograms(BachelorConfBinningQa); + mPosDauManager.enableOptionalHistograms(PosDauConfBinningQa); + mNegDauManager.enableOptionalHistograms(NegDauConfBinningQa); + mPlot2d = CascadeConfBinningQa.plot2d.value; + } - mHistogramRegistry->add(qaDir + getHistNameV2(kMassXi, HistTable), getHistDesc(kMassXi, HistTable), getHistType(kMassXi, HistTable), {cascadeSpecs[kMassXi]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kMassOmega, HistTable), getHistDesc(kMassOmega, HistTable), getHistType(kMassOmega, HistTable), {cascadeSpecs[kMassOmega]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsMassXi, HistTable), getHistDesc(kPtVsMassXi, HistTable), getHistType(kPtVsMassXi, HistTable), {cascadeSpecs[kPtVsMassXi]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsMassOmega, HistTable), getHistDesc(kPtVsMassOmega, HistTable), getHistType(kPtVsMassOmega, HistTable), {cascadeSpecs[kPtVsMassOmega]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kMassXiVsMassOmega, HistTable), getHistDesc(kMassXiVsMassOmega, HistTable), getHistType(kMassXiVsMassOmega, HistTable), {cascadeSpecs[kMassXiVsMassOmega]}); - } + template + void init(o2::framework::HistogramRegistry* registry, + std::map> const& cascadeSpecs, + T1 const& CascadeConfBinningQa, + std::map> const& BachelorSpecs, + T2 const& BachelorConfBinningQa, + std::map> const& PosDauSpecs, + T3 const& PosDauConfBinningQa, + std::map> const& NegDauSpecs, + T4 const& NegDauConfBinningQa) + { + enableOptionalHistograms(CascadeConfBinningQa, BachelorConfBinningQa, PosDauConfBinningQa, NegDauConfBinningQa); + init(registry, cascadeSpecs, BachelorSpecs, PosDauSpecs, NegDauSpecs); } template @@ -220,7 +221,6 @@ class CascadeHistManager // auto bachelor = cascadeCandidate.template bachelor_as(); // auto posDaughter = cascadeCandidate.template posDau_as(); // auto negDaughter = cascadeCandidate.template negDau_as(); - auto posDaughter = tracks.rawIteratorAt(cascadeCandidate.posDauId() - tracks.offset()); mPosDauManager.fill(posDaughter, tracks); auto negDaughter = tracks.rawIteratorAt(cascadeCandidate.negDauId() - tracks.offset()); @@ -229,40 +229,87 @@ class CascadeHistManager mBachelorManager.fill(bachelor, tracks); if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kPt, HistTable)), cascadeCandidate.pt()); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kEta, HistTable)), cascadeCandidate.eta()); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kPhi, HistTable)), cascadeCandidate.phi()); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kMass, HistTable)), cascadeCandidate.mass()); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), cascadeCandidate.sign()); + fillAnalysis(cascadeCandidate); } if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { - float massXi, massOmega; - if constexpr (modes::isEqual(cascade, modes::Cascade::kXi)) { - massXi = cascadeCandidate.mass(); - massOmega = cascadeCandidate.massOmega(); - } - if constexpr (modes::isEqual(cascade, modes::Cascade::kOmega)) { - massXi = cascadeCandidate.massXi(); - massOmega = cascadeCandidate.mass(); - } - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kCosPa, HistTable)), cascadeCandidate.cascadeCosPa()); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kDecayDauDca, HistTable)), cascadeCandidate.cascadeDauDca()); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kTransRadius, HistTable)), cascadeCandidate.cascadeTransRadius()); + fillQa(cascadeCandidate); + } + } + + private: + void initAnalysis(std::map> const& cascadeSpecs) + { + std::string analysisDir = std::string(cascadePrefix) + std::string(AnalysisDir); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {cascadeSpecs.at(kPt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {cascadeSpecs.at(kEta)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {cascadeSpecs.at(kPhi)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kMass, HistTable), getHistDesc(kMass, HistTable), getHistType(kMass, HistTable), {cascadeSpecs.at(kMass)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {cascadeSpecs.at(kSign)}); + } + + void initQa(std::map> const& cascadeSpecs) + { + std::string qaDir = std::string(cascadePrefix) + std::string(QaDir); + mHistogramRegistry->add(qaDir + getHistNameV2(kCosPa, HistTable), getHistDesc(kCosPa, HistTable), getHistType(kCosPa, HistTable), {cascadeSpecs.at(kCosPa)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayDauDca, HistTable), getHistDesc(kDecayDauDca, HistTable), getHistType(kDecayDauDca, HistTable), {cascadeSpecs.at(kDecayDauDca)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTransRadius, HistTable), getHistDesc(kTransRadius, HistTable), getHistType(kTransRadius, HistTable), {cascadeSpecs.at(kTransRadius)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kMassXi, HistTable), getHistDesc(kMassXi, HistTable), getHistType(kMassXi, HistTable), {cascadeSpecs.at(kMassXi)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kMassOmega, HistTable), getHistDesc(kMassOmega, HistTable), getHistType(kMassOmega, HistTable), {cascadeSpecs.at(kMassOmega)}); + + if (mPlot2d) { + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsEta, HistTable), getHistDesc(kPtVsEta, HistTable), getHistType(kPtVsEta, HistTable), {cascadeSpecs.at(kPtVsEta)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPhi, HistTable), getHistDesc(kPtVsPhi, HistTable), getHistType(kPtVsPhi, HistTable), {cascadeSpecs.at(kPtVsPhi)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPhiVsEta, HistTable), getHistDesc(kPhiVsEta, HistTable), getHistType(kPhiVsEta, HistTable), {cascadeSpecs.at(kPhiVsEta)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsCosPa, HistTable), getHistDesc(kPtVsCosPa, HistTable), getHistType(kPtVsCosPa, HistTable), {cascadeSpecs.at(kPtVsCosPa)}); + + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsMassXi, HistTable), getHistDesc(kPtVsMassXi, HistTable), getHistType(kPtVsMassXi, HistTable), {cascadeSpecs.at(kPtVsMassXi)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsMassOmega, HistTable), getHistDesc(kPtVsMassOmega, HistTable), getHistType(kPtVsMassOmega, HistTable), {cascadeSpecs.at(kPtVsMassOmega)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kMassXiVsMassOmega, HistTable), getHistDesc(kMassXiVsMassOmega, HistTable), getHistType(kMassXiVsMassOmega, HistTable), {cascadeSpecs.at(kMassXiVsMassOmega)}); + } + } + + template + void fillAnalysis(T const& cascadeCandidate) + { + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kPt, HistTable)), cascadeCandidate.pt()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kEta, HistTable)), cascadeCandidate.eta()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kPhi, HistTable)), cascadeCandidate.phi()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kMass, HistTable)), cascadeCandidate.mass()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), cascadeCandidate.sign()); + } + + template + void fillQa(T const& cascadeCandidate) + { + float massXi = 0.f; + float massOmega = 0.f; + if constexpr (modes::isEqual(cascade, modes::Cascade::kXi)) { + massXi = cascadeCandidate.mass(); + massOmega = cascadeCandidate.massOmega(); + } + if constexpr (modes::isEqual(cascade, modes::Cascade::kOmega)) { + massXi = cascadeCandidate.massXi(); + massOmega = cascadeCandidate.mass(); + } + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kCosPa, HistTable)), cascadeCandidate.cascadeCosPa()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kDecayDauDca, HistTable)), cascadeCandidate.cascadeDauDca()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kTransRadius, HistTable)), cascadeCandidate.cascadeTransRadius()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kMassXi, HistTable)), massXi); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kMassOmega, HistTable)), massOmega); + + if (mPlot2d) { mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kPtVsEta, HistTable)), cascadeCandidate.pt(), cascadeCandidate.eta()); mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kPtVsPhi, HistTable)), cascadeCandidate.pt(), cascadeCandidate.phi()); mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kPhiVsEta, HistTable)), cascadeCandidate.phi(), cascadeCandidate.eta()); mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kPtVsCosPa, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadeCosPa()); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kMassXi, HistTable)), massXi); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kMassOmega, HistTable)), massOmega); mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kPtVsMassXi, HistTable)), cascadeCandidate.pt(), massXi); mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kPtVsMassOmega, HistTable)), cascadeCandidate.pt(), massOmega); mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kMassXiVsMassOmega, HistTable)), massXi, massOmega); } } - private: o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; - + bool mPlot2d = true; trackhistmanager::TrackHistManager mBachelorManager; trackhistmanager::TrackHistManager mPosDauManager; trackhistmanager::TrackHistManager mNegDauManager; diff --git a/PWGCF/Femto/Core/closePairRejection.h b/PWGCF/Femto/Core/closePairRejection.h index 0ea82363337..c574398c432 100644 --- a/PWGCF/Femto/Core/closePairRejection.h +++ b/PWGCF/Femto/Core/closePairRejection.h @@ -51,32 +51,82 @@ enum CprHist { kCprHistogramLast }; +// default config, cpr between two charged tracks (or track vs particle which decays into one charged track, like sigma) struct ConfCpr : o2::framework::ConfigurableGroup { std::string prefix = std::string("ClosePairRejection"); o2::framework::Configurable on{"on", true, "Turn on CPR"}; + o2::framework::Configurable plotAllRadii{"plotAllRadii", false, "Plot deta-dphi distribution at all radii"}; + o2::framework::Configurable plotAverage{"plotAverage", true, "Plot average deta dphi distribution"}; o2::framework::Configurable detaMax{"detaMax", 0.01f, "Maximium deta"}; o2::framework::Configurable dphistarMax{"dphistarMax", 0.01f, "Maximum dphistar"}; o2::framework::ConfigurableAxis binningDeta{"binningDeta", {{500, -0.5, 0.5}}, "deta"}; o2::framework::ConfigurableAxis binningDphistar{"binningDphistar", {{500, -0.5, 0.5}}, "dphi"}; }; +struct ConfCprTrackV0 : o2::framework::ConfigurableGroup { + std::string prefix = std::string("ClosePairRejectionTrackV0"); + o2::framework::Configurable onSameCharge{"onSameCharge", true, "Turn on CPR for track and same charge daughter"}; + o2::framework::Configurable onOppositeCharge{"onOppositeCharge", false, "Turn on CPR for track and opposite charge daughter"}; + o2::framework::Configurable plotAllRadii{"plotAllRadii", false, "Plot deta-dphi distribution at all radii"}; + o2::framework::Configurable plotAverage{"plotAverage", true, "Plot average deta dphi distribution"}; + o2::framework::Configurable detaMaxSameCharge{"detaMaxSameCharge", 0.01f, "Maximium deta between track and same charge daughter"}; + o2::framework::Configurable dphistarMaxSameCharge{"dphistarMaxSameCharge", 0.01f, "Maximium dphistar between track and same charge daughter"}; + o2::framework::Configurable detaMaxOppositeCharge{"detaMaxOppositeCharge", 0.01f, "Maximum deta between track and opposite charge daughter"}; + o2::framework::Configurable dphistarMaxOppositeCharge{"dphistarMaxOppositeCharge", 0.01f, "Maximum dphistar between track and opposite charge daughter"}; + o2::framework::ConfigurableAxis binningDeta{"binningDeta", {{500, -0.5, 0.5}}, "deta"}; + o2::framework::ConfigurableAxis binningDphistar{"binningDphistar", {{500, -0.5, 0.5}}, "dphi"}; +}; + +struct ConfCprV0V0 : o2::framework::ConfigurableGroup { + std::string prefix = std::string("ClosePairRejectionV0V0"); + o2::framework::Configurable on{"on", true, "Turn on CPR"}; + o2::framework::Configurable plotAllRadii{"plotAllRadii", false, "Plot deta-dphi distribution at all radii"}; + o2::framework::Configurable plotAverage{"plotAverage", true, "Plot average deta dphi distribution"}; + o2::framework::Configurable detaMaxPosDau{"detaMaxPosDau", 0.01f, "Maximium deta between positive daughters"}; + o2::framework::Configurable dphistarMaxPosDau{"dphistarMaxPosDau", 0.01f, "Maximium dphistar between positive daughters"}; + o2::framework::Configurable detaMaxNegDau{"detaMaxNegDau", 0.01f, "Maximum deta between negative daughters"}; + o2::framework::Configurable dphistarMaxNegDau{"dphistarMaxNegDau", 0.01f, "Maximum dphistar between negative daughters"}; + o2::framework::ConfigurableAxis binningDeta{"binningDeta", {{500, -0.5, 0.5}}, "deta"}; + o2::framework::ConfigurableAxis binningDphistar{"binningDphistar", {{500, -0.5, 0.5}}, "dphi"}; +}; + +struct ConfCprTrrackCascade : o2::framework::ConfigurableGroup { + std::string prefix = std::string("ClosePairRejectionTrackCascade"); + o2::framework::Configurable onBachelor{"onBachelor", true, "Turn on CPR for track and bachelor"}; + o2::framework::Configurable onSameCharge{"onSameCharge", false, "Turn on CPR for track and same charge V0 daughter"}; + o2::framework::Configurable onOppositeCharge{"onOppositeCharge", false, "Turn on CPR for track and opposite charge V0 daughter"}; + o2::framework::Configurable plotAllRadii{"plotAllRadii", false, "Plot deta-dphi distribution at all radii"}; + o2::framework::Configurable plotAverage{"plotAverage", true, "Plot average deta dphi distribution"}; + o2::framework::Configurable detaMaxBachelor{"detaMaxBachelor", 0.01f, "Maximium deta between track and bachelor"}; + o2::framework::Configurable dphistarMaxBachelor{"dphistarMaxBachelor", 0.01f, "Maximium dphistar between track and bachelor"}; + o2::framework::Configurable detaMaxSameCharge{"detaMaxSameCharge", 0.01f, "Maximium deta between track and same charge daughter"}; + o2::framework::Configurable dphistarMaxSameCharge{"dphistarMaxSameCharge", 0.01f, "Maximium dphistar between track and same charge daughter"}; + o2::framework::Configurable detaMaxOppositeCharge{"detaMaxOppositeCharge", 0.01f, "Maximum deta between track and opposite charge daughter"}; + o2::framework::Configurable dphistarMaxOppositeCharge{"dphistarMaxOppositeCharge", 0.01f, "Maximum dphistar between track and opposite charge daughter"}; + o2::framework::ConfigurableAxis binningDeta{"binningDeta", {{500, -0.5, 0.5}}, "deta"}; + o2::framework::ConfigurableAxis binningDphistar{"binningDphistar", {{500, -0.5, 0.5}}, "dphi"}; + o2::framework::Configurable on{"on", true, "Turn on CPR"}; +}; + // tpc radii for computing phistar -constexpr int kNradii = 9; -constexpr std::array kTpcRadius = {85., 105., 125., 145., 165., 185., 205., 225., 245.}; // in cm +constexpr int Nradii = 9; +constexpr std::array TpcRadii = {85., 105., 125., 145., 165., 185., 205., 225., 245.}; // in cm // directory names constexpr char PrefixTrackTrackSe[] = "CPR_TrackTrack/SE/"; constexpr char PrefixTrackTrackMe[] = "CPR_TrackTrack/ME/"; -constexpr char PrefixTrackV0Se[] = "CPR_TrackV0Daughter/SE/"; -constexpr char PrefixTrackV0Me[] = "CPR_TrackV0Daughter/ME/"; +constexpr char PrefixTrackV0SameChargeSe[] = "CPR_TrackV0DauSameCharge/SE/"; +constexpr char PrefixTrackV0SameChargeMe[] = "CPR_TrackV0DauSameCharge/ME/"; +constexpr char PrefixTrackV0OppositeChargeSe[] = "CPR_TrackV0DauOppositeCharge/SE/"; +constexpr char PrefixTrackV0OppositeChargeMe[] = "CPR_TrackV0DauOppositeCharge/ME/"; constexpr char PrefixV0V0PosSe[] = "CPR_V0V0_PosDau/SE/"; constexpr char PrefixV0V0NegSe[] = "CPR_V0V0_NegDau/SE/"; constexpr char PrefixV0V0PosMe[] = "CPR_V0V0_PosDau/ME/"; constexpr char PrefixV0V0NegMe[] = "CPR_V0V0_NegDau/ME/"; constexpr char PrefixTrackTwoTrackResonanceSe[] = "CPR_TrackResonanceDaughter/SE/"; constexpr char PrefixTrackTwoTrackResonnaceMe[] = "CPR_TrackResonanceDaughter/ME/"; -constexpr char PrefixTrackCascadeSe[] = "CPR_TrackCascadeBachelor/SE/"; -constexpr char PrefixTrackCascadeMe[] = "CPR_TrackCascadeBachelor/ME/"; +constexpr char PrefixTrackCascadeBachelorSe[] = "CPR_TrackCascadeBachelor/SE/"; +constexpr char PrefixTrackCascadeBachelorMe[] = "CPR_TrackCascadeBachelor/ME/"; constexpr char PrefixTrackKinkSe[] = "CPR_TrackKink/SE/"; constexpr char PrefixTrackKinkMe[] = "CPR_TrackKink/ME/"; @@ -115,34 +165,56 @@ class CloseTrackRejection { public: CloseTrackRejection() = default; - virtual ~CloseTrackRejection() = default; - - void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int chargeAbsTrack1, int chargeAbsTrack2) + ~CloseTrackRejection() = default; + + void init(o2::framework::HistogramRegistry* registry, + std::map> const& specs, + bool plotAverage, + bool plotAllRadii, + float detaMax, + float dphistarMax, + int chargeAbsTrack1, + int chargeAbsTrack2) { mDetaMax = detaMax; mDphistarMax = dphistarMax; + // check the limits + if (mDetaMax <= 0 || mDphistarMax <= 0) { + LOG(warn) << "Close Pair Rejection configured with 0 or negative limits. Histograms will be filled, but no CPR cut will be applied!"; + mPlotOnly = true; + } else { + mPlotOnly = false; + } + mChargeAbsTrack1 = chargeAbsTrack1; mChargeAbsTrack2 = chargeAbsTrack2; mHistogramRegistry = registry; - mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kAverage, HistTable), getHistDesc(kAverage, HistTable), getHistType(kAverage, HistTable), {specs.at(kAverage)}); - mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius0, HistTable), getHistDesc(kRadius0, HistTable), getHistType(kRadius0, HistTable), {specs.at(kRadius0)}); - mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius1, HistTable), getHistDesc(kRadius1, HistTable), getHistType(kRadius1, HistTable), {specs.at(kRadius1)}); - mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius2, HistTable), getHistDesc(kRadius2, HistTable), getHistType(kRadius2, HistTable), {specs.at(kRadius2)}); - mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius3, HistTable), getHistDesc(kRadius3, HistTable), getHistType(kRadius3, HistTable), {specs.at(kRadius3)}); - mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius4, HistTable), getHistDesc(kRadius4, HistTable), getHistType(kRadius4, HistTable), {specs.at(kRadius4)}); - mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius5, HistTable), getHistDesc(kRadius5, HistTable), getHistType(kRadius5, HistTable), {specs.at(kRadius5)}); - mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius6, HistTable), getHistDesc(kRadius6, HistTable), getHistType(kRadius6, HistTable), {specs.at(kRadius6)}); - mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius7, HistTable), getHistDesc(kRadius7, HistTable), getHistType(kRadius7, HistTable), {specs.at(kRadius7)}); - mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius8, HistTable), getHistDesc(kRadius8, HistTable), getHistType(kRadius8, HistTable), {specs.at(kRadius8)}); + mPlotAverage = plotAverage; + mPlotAllRadii = plotAllRadii; + + if (mPlotAverage) { + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kAverage, HistTable), getHistDesc(kAverage, HistTable), getHistType(kAverage, HistTable), {specs.at(kAverage)}); + } + if (mPlotAllRadii) { + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius0, HistTable), getHistDesc(kRadius0, HistTable), getHistType(kRadius0, HistTable), {specs.at(kRadius0)}); + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius1, HistTable), getHistDesc(kRadius1, HistTable), getHistType(kRadius1, HistTable), {specs.at(kRadius1)}); + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius2, HistTable), getHistDesc(kRadius2, HistTable), getHistType(kRadius2, HistTable), {specs.at(kRadius2)}); + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius3, HistTable), getHistDesc(kRadius3, HistTable), getHistType(kRadius3, HistTable), {specs.at(kRadius3)}); + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius4, HistTable), getHistDesc(kRadius4, HistTable), getHistType(kRadius4, HistTable), {specs.at(kRadius4)}); + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius5, HistTable), getHistDesc(kRadius5, HistTable), getHistType(kRadius5, HistTable), {specs.at(kRadius5)}); + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius6, HistTable), getHistDesc(kRadius6, HistTable), getHistType(kRadius6, HistTable), {specs.at(kRadius6)}); + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius7, HistTable), getHistDesc(kRadius7, HistTable), getHistType(kRadius7, HistTable), {specs.at(kRadius7)}); + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius8, HistTable), getHistDesc(kRadius8, HistTable), getHistType(kRadius8, HistTable), {specs.at(kRadius8)}); + } } void setMagField(float magField) { mMagField = magField; } template - void compute(const T1& track1, const T2& track2) + void compute(T1 const& track1, T2 const& track2) { // reset values mAverageDphistar = 0.f; @@ -150,9 +222,9 @@ class CloseTrackRejection mDphistar.fill(0.f); mDeta = track1.eta() - track2.eta(); - for (size_t i = 0; i < kTpcRadius.size(); i++) { - auto phistar1 = utils::dphistar(mMagField, kTpcRadius[i], mChargeAbsTrack1 * track1.signedPt(), track1.phi()); - auto phistar2 = utils::dphistar(mMagField, kTpcRadius[i], mChargeAbsTrack2 * track2.signedPt(), track2.phi()); + for (size_t i = 0; i < TpcRadii.size(); i++) { + auto phistar1 = utils::dphistar(mMagField, TpcRadii[i], mChargeAbsTrack1 * track1.signedPt(), track1.phi()); + auto phistar2 = utils::dphistar(mMagField, TpcRadii[i], mChargeAbsTrack2 * track2.signedPt(), track2.phi()); if (phistar1 && phistar2) { // if the calculation for one phistar fails, keep the default value, which is 0 // this makes it more likelier for the pair to be rejected sind the averave will be biased towards lower values @@ -165,47 +237,61 @@ class CloseTrackRejection void fill() { // fill average hist - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kAverage, HistTable)), mDeta, mAverageDphistar); + if (mPlotAverage) { + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kAverage, HistTable)), mDeta, mAverageDphistar); + } // fill radii hists - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius0, HistTable)), mDeta, mDphistar.at(0)); - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius1, HistTable)), mDeta, mDphistar.at(1)); - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius2, HistTable)), mDeta, mDphistar.at(2)); - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius3, HistTable)), mDeta, mDphistar.at(3)); - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius4, HistTable)), mDeta, mDphistar.at(4)); - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius5, HistTable)), mDeta, mDphistar.at(5)); - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius6, HistTable)), mDeta, mDphistar.at(6)); - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius7, HistTable)), mDeta, mDphistar.at(7)); - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius8, HistTable)), mDeta, mDphistar.at(8)); + if (mPlotAllRadii) { + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius0, HistTable)), mDeta, mDphistar.at(0)); + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius1, HistTable)), mDeta, mDphistar.at(1)); + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius2, HistTable)), mDeta, mDphistar.at(2)); + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius3, HistTable)), mDeta, mDphistar.at(3)); + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius4, HistTable)), mDeta, mDphistar.at(4)); + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius5, HistTable)), mDeta, mDphistar.at(5)); + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius6, HistTable)), mDeta, mDphistar.at(6)); + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius7, HistTable)), mDeta, mDphistar.at(7)); + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius8, HistTable)), mDeta, mDphistar.at(8)); + } } bool isClosePair() const { - return std::hypot(mAverageDphistar / mDphistarMax, mDeta / mDetaMax) < 1.f; + return !mPlotOnly && std::hypot(mAverageDphistar / mDphistarMax, mDeta / mDetaMax) < 1.f; } private: + o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; + bool mPlotAllRadii = false; + bool mPlotAverage = true; + int mChargeAbsTrack1 = 0; int mChargeAbsTrack2 = 0; float mMagField = 0.f; - float mAverageDphistar = 0.f; - float mDeta = 0.f; float mDetaMax = 0.f; float mDphistarMax = 0.f; - std::array mDphistar = {0.f}; - o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; + float mAverageDphistar = 0.f; + float mDeta = 0.f; + std::array mDphistar = {0.f}; + + bool mPlotOnly = true; }; template class ClosePairRejectionTrackTrack { public: - void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int absChargeTrack1, int absChargeTrack2, bool isActivated) + template + void init(o2::framework::HistogramRegistry* registry, + std::map> const& specs, + T const& confCpr, + int absChargeTrack1, + int absChargeTrack2) { - mIsActivated = isActivated; + mIsActivated = confCpr.on.value; if (mIsActivated) { - mCtr.init(registry, specs, detaMax, dphistarMax, absChargeTrack1, absChargeTrack2); + mCtr.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMax.value, confCpr.dphistarMax.value, absChargeTrack1, absChargeTrack2); } } @@ -228,12 +314,15 @@ template class ClosePairRejectionV0V0 { public: - void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, bool isActivated) + template + void init(o2::framework::HistogramRegistry* registry, + std::map> const& specs, + T const& confCpr) { - mIsActivated = isActivated; + mIsActivated = confCpr.on.value; if (mIsActivated) { - mCtrPos.init(registry, specs, detaMax, dphistarMax, 1, 1); - mCtrNeg.init(registry, specs, detaMax, dphistarMax, 1, 1); + mCtrPos.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMaxPosDau.value, confCpr.dphistarMaxPosDau.value, 1, 1); + mCtrNeg.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMaxNegDau.value, confCpr.dphistarMaxNegDau.value, 1, 1); } } @@ -245,25 +334,24 @@ class ClosePairRejectionV0V0 template void setPair(T1 const& v01, T2 const& v02, T3 const& tracks) { - // auto posDau1 = v01.template posDau_as(); - // auto negDau1 = v01.template posDau_as(); auto posDau1 = tracks.rawIteratorAt(v01.posDauId() - tracks.offset()); auto negDau1 = tracks.rawIteratorAt(v01.negDauId() - tracks.offset()); - // auto posDau2 = v02.template posDau_as(); - // auto negDau2 = v02.template posDau_as(); auto posDau2 = tracks.rawIteratorAt(v02.posDauId() - tracks.offset()); auto negDau2 = tracks.rawIteratorAt(v02.negDauId() - tracks.offset()); mCtrPos.compute(posDau1, posDau2); mCtrNeg.compute(negDau1, negDau2); } + bool isClosePair() const { return mCtrPos.isClosePair() && mCtrNeg.isClosePair(); } + void fill() { mCtrPos.fill(); mCtrNeg.fill(); } + bool isActivated() const { return mIsActivated; } private: @@ -272,97 +360,201 @@ class ClosePairRejectionV0V0 bool mIsActivated = true; }; -template +template class ClosePairRejectionTrackV0 // can also be used for any particle type that has pos/neg daughters, like resonances { public: - void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int absChargeTrack, bool isActivated) + template + void init(o2::framework::HistogramRegistry* registry, + std::map> const& specs, + T const& confCpr, + int absChargeTrack) { - mIsActivated = isActivated; - // initialize CPR with charge of the track and the same charge for the daughter particle - // absolute charge of the daughter track will be 1, so we just pass 1 - if (mIsActivated) { - mCtr.init(registry, specs, detaMax, dphistarMax, absChargeTrack, 1); + mIsActivatedSameCharge = confCpr.onSameCharge.value; + if (mIsActivatedSameCharge) { + mCtrSameCharge.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMaxSameCharge.value, confCpr.dphistarMaxSameCharge.value, absChargeTrack, 1); } + + mIsActivatedOppositeCharge = confCpr.onOppositeCharge.value; + if (mIsActivatedOppositeCharge) { + mCtrOppositeCharge.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMaxOppositeCharge.value, confCpr.dphistarMaxOppositeCharge.value, absChargeTrack, 1); + } + + mIsActivated = mIsActivatedSameCharge || mIsActivatedOppositeCharge; } void setMagField(float magField) { - mCtr.setMagField(magField); + if (mIsActivatedSameCharge) { + mCtrSameCharge.setMagField(magField); + } + if (mIsActivatedOppositeCharge) { + mCtrOppositeCharge.setMagField(magField); + } } + template - void setPair(const T1& track, const T2& v0, const T3 trackTable) + void setPair(T1 const& track, T2 const& v0, T3 const& trackTable) { - if (track.signedPt() > 0) { - // auto daughter = v0.template posDau_as(); - auto daughter = trackTable.rawIteratorAt(v0.posDauId() - trackTable.offset()); - mCtr.compute(track, daughter); + auto posDau = trackTable.rawIteratorAt(v0.posDauId() - trackTable.offset()); + auto negDau = trackTable.rawIteratorAt(v0.negDauId() - trackTable.offset()); + if (track.sign() > 0) { + if (mIsActivatedSameCharge) { + mCtrSameCharge.compute(track, posDau); + } + if (mIsActivatedOppositeCharge) { + mCtrOppositeCharge.compute(track, negDau); + } } else { - // auto daughter = v0.template negDau_as(); - auto daughter = trackTable.rawIteratorAt(v0.negDauId() - trackTable.offset()); - mCtr.compute(track, daughter); + if (mIsActivatedSameCharge) { + mCtrSameCharge.compute(track, negDau); + } + if (mIsActivatedOppositeCharge) { + mCtrOppositeCharge.compute(track, posDau); + } } } - bool isClosePair() const { return mCtr.isClosePair(); } + bool isClosePair() const + { + bool cprSameCharge = mIsActivatedSameCharge && mCtrSameCharge.isClosePair(); + bool cprOppositeCharrge = mIsActivatedOppositeCharge && mCtrOppositeCharge.isClosePair(); + return cprSameCharge || cprOppositeCharrge; + } + void fill() { - mCtr.fill(); + if (mIsActivatedSameCharge) { + mCtrSameCharge.fill(); + } + if (mIsActivatedOppositeCharge) { + mCtrOppositeCharge.fill(); + } } bool isActivated() const { return mIsActivated; } private: - CloseTrackRejection mCtr; + CloseTrackRejection mCtrSameCharge; + CloseTrackRejection mCtrOppositeCharge; bool mIsActivated = true; + bool mIsActivatedSameCharge = true; + bool mIsActivatedOppositeCharge = false; }; -template +template class ClosePairRejectionTrackCascade { public: - void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int absChargeTrack, bool isActivated) + template + void init(o2::framework::HistogramRegistry* registry, + std::map> const& specs, + T const& confCpr, + int absChargeTrack) { - mIsActivated = isActivated; - if (mIsActivated) { - // charge of cascade is always 1 - mCtr.init(registry, specs, detaMax, dphistarMax, absChargeTrack, 1); + mIsActivatedBachelor = confCpr.onBachelor.value; + if (mIsActivatedBachelor) { + mCtrBachelor.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMaxBachelor.value, confCpr.dphistarMaxBachelor.value, absChargeTrack, 1); } + + mIsActivatedSameChargeV0Daughter = confCpr.onSameCharge.value; + if (mIsActivatedSameChargeV0Daughter) { + mCtrSameChargeV0Daughter.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMaxSameCharge.value, confCpr.dphistarMaxSameCharge.value, absChargeTrack, 1); + } + + mIsActivatedOppositeChargeV0Daughter = confCpr.onOppositeCharge.value; + if (mIsActivatedOppositeChargeV0Daughter) { + mCtrOppositeChargeV0Daughter.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMaxOppositeCharge.value, confCpr.dphistarMaxOppositeCharge.value, absChargeTrack, 1); + } + + mIsActivated = mIsActivatedBachelor || mIsActivatedSameChargeV0Daughter || mIsActivatedOppositeChargeV0Daughter; } void setMagField(float magField) { - mCtr.setMagField(magField); + if (mIsActivatedBachelor) { + mCtrBachelor.setMagField(magField); + } + if (mIsActivatedSameChargeV0Daughter) { + mCtrSameChargeV0Daughter.setMagField(magField); + } + if (mIsActivatedOppositeChargeV0Daughter) { + mCtrOppositeChargeV0Daughter.setMagField(magField); + } } template - void setPair(const T1& track, const T2& cascade, const T3 trackTable) + void setPair(T1 const& track, T2 const& cascade, T3 const& trackTable) { - // auto bachelor = cascade.template posDau_as(); auto bachelor = trackTable.rawIteratorAt(cascade.bachelorId() - trackTable.offset()); - mCtr.compute(track, bachelor); + auto posDau = trackTable.rawIteratorAt(cascade.posDauId() - trackTable.offset()); + auto negDau = trackTable.rawIteratorAt(cascade.negDauId() - trackTable.offset()); + + if (mIsActivatedBachelor) { + mCtrBachelor.compute(track, bachelor); + } + + if (track.sign() > 0) { + if (mIsActivatedSameChargeV0Daughter) { + mCtrSameChargeV0Daughter.compute(track, posDau); + } + if (mIsActivatedOppositeChargeV0Daughter) { + mCtrOppositeChargeV0Daughter.compute(track, negDau); + } + } else { + if (mIsActivatedSameChargeV0Daughter) { + mCtrSameChargeV0Daughter.compute(track, negDau); + } + if (mIsActivatedOppositeChargeV0Daughter) { + mCtrOppositeChargeV0Daughter.compute(track, posDau); + } + } + } + + bool isClosePair() const + { + bool cprBachelor = mIsActivatedBachelor && mCtrBachelor.isClosePair(); + bool cprSameCharge = mIsActivatedSameChargeV0Daughter && mCtrSameChargeV0Daughter.isClosePair(); + bool cprOppositeCharrge = mIsActivatedOppositeChargeV0Daughter && mCtrOppositeChargeV0Daughter.isClosePair(); + return cprBachelor || cprSameCharge || cprOppositeCharrge; } - bool isClosePair() const { return mCtr.isClosePair(); } void fill() { - mCtr.fill(); + if (mIsActivatedBachelor) { + mCtrBachelor.fill(); + } + if (mIsActivatedSameChargeV0Daughter) { + mCtrSameChargeV0Daughter.fill(); + } + if (mIsActivatedOppositeChargeV0Daughter) { + mCtrOppositeChargeV0Daughter.fill(); + } } + bool isActivated() const { return mIsActivated; } private: - CloseTrackRejection mCtr; + CloseTrackRejection mCtrBachelor; + CloseTrackRejection mCtrSameChargeV0Daughter; + CloseTrackRejection mCtrOppositeChargeV0Daughter; bool mIsActivated = true; + bool mIsActivatedBachelor = false; + bool mIsActivatedSameChargeV0Daughter = false; + bool mIsActivatedOppositeChargeV0Daughter = false; }; template class ClosePairRejectionTrackKink { public: - void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int absChargeTrack, bool isActivated) + template + void init(o2::framework::HistogramRegistry* registry, + std::map> const& specs, + T const& confCpr, + int absChargeTrack) { - mIsActivated = isActivated; - // The charged daughter has absolute charge of 1, so we can pass 1 directly + mIsActivated = confCpr.on.value; if (mIsActivated) { - mCtr.init(registry, specs, detaMax, dphistarMax, absChargeTrack, 1); + mCtr.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMax.value, confCpr.dphistarMax.value, absChargeTrack, 1); } } @@ -372,9 +564,8 @@ class ClosePairRejectionTrackKink } template - void setPair(const T1& track, const T2& kink, const T3 trackTable) + void setPair(T1 const& track, T2 const& kink, T3 const& trackTable) { - // auto daughter = kink.template chaDau_as(); auto daughter = trackTable.rawIteratorAt(kink.chaDauId() - trackTable.offset()); mCtr.compute(track, daughter); } diff --git a/PWGCF/Femto/Core/collisionBuilder.h b/PWGCF/Femto/Core/collisionBuilder.h index 80791b52ebc..31bbcd10f68 100644 --- a/PWGCF/Femto/Core/collisionBuilder.h +++ b/PWGCF/Femto/Core/collisionBuilder.h @@ -166,7 +166,7 @@ class CollisionSelection : public BaseSelection void configure(T1 const& filter, T2 const& config) @@ -348,8 +348,8 @@ struct ConfCollisionTables : o2::framework::ConfigurableGroup { class CollisionBuilder { public: - CollisionBuilder() {} - virtual ~CollisionBuilder() = default; + CollisionBuilder() = default; + ~CollisionBuilder() = default; template void init(T1& confFilter, T2& confBits, T3& confRct, T4& confCcdb, T5& confTable, T6& initContext) @@ -505,7 +505,7 @@ class CollisionBuilderDerivedToDerived { public: CollisionBuilderDerivedToDerived() = default; - virtual ~CollisionBuilderDerivedToDerived() = default; + ~CollisionBuilderDerivedToDerived() = default; template void processCollision(T1& col, T2& newCollisionTable) diff --git a/PWGCF/Femto/Core/collisionHistManager.h b/PWGCF/Femto/Core/collisionHistManager.h index 38e261069fd..0cadaa6e380 100644 --- a/PWGCF/Femto/Core/collisionHistManager.h +++ b/PWGCF/Femto/Core/collisionHistManager.h @@ -115,6 +115,7 @@ struct ConfCollisionBinning : o2::framework::ConfigurableGroup { struct ConfCollisionQaBinning : o2::framework::ConfigurableGroup { std::string prefix = std::string("CollisionQaBinning"); + o2::framework::Configurable plot2d{"plot2d", true, "Enable 2d QA histograms"}; o2::framework::ConfigurableAxis vtx{"vtx", {120, 0.f, 12.f}, "Vertex position binning"}; o2::framework::ConfigurableAxis vtxXY{"vtxXY", {100, -1.f, 1.f}, "Vertex X/Y binning"}; o2::framework::ConfigurableAxis sphericity{"sphericity", {100, 0.f, 1.f}, "Spericity Binning"}; @@ -126,52 +127,89 @@ class CollisionHistManager { public: CollisionHistManager() = default; - virtual ~CollisionHistManager() = default; + ~CollisionHistManager() = default; /// Initializes histograms for the task /// \param registry Histogram registry to be passed - void init(o2::framework::HistogramRegistry* registry, std::map> Specs) + void init(o2::framework::HistogramRegistry* registry, std::map> const& Specs) { mHistogramRegistry = registry; if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { - std::string analysisDir = std::string(ColAnalysisDir); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPosZ, HistTable), getHistDesc(kPosZ, HistTable), getHistType(kPosZ, HistTable), {Specs[kPosZ]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kMult, HistTable), getHistDesc(kMult, HistTable), getHistType(kMult, HistTable), {Specs[kMult]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kCent, HistTable), getHistDesc(kCent, HistTable), getHistType(kCent, HistTable), {Specs[kCent]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kMagField, HistTable), getHistDesc(kMagField, HistTable), getHistType(kMagField, HistTable), {Specs[kMagField]}); + initAnalysis(Specs); } - if constexpr (isFlagSet(mode, modes::Mode::kQa)) { - std::string qaDir = std::string(ColQaDir); - - mHistogramRegistry->add(qaDir + getHistNameV2(kPosX, HistTable), getHistDesc(kPosX, HistTable), getHistType(kPosX, HistTable), {Specs[kPosX]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPosY, HistTable), getHistDesc(kPosY, HistTable), getHistType(kPosY, HistTable), {Specs[kPosY]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPos, HistTable), getHistDesc(kPos, HistTable), getHistType(kPos, HistTable), {Specs[kPos]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kSphericity, HistTable), getHistDesc(kSphericity, HistTable), getHistType(kSphericity, HistTable), {Specs[kSphericity]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kOccupancy, HistTable), getHistDesc(kOccupancy, HistTable), getHistType(kOccupancy, HistTable), {Specs[kOccupancy]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPoszVsMult, HistTable), getHistDesc(kPoszVsMult, HistTable), getHistType(kPoszVsMult, HistTable), {Specs[kPoszVsMult]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPoszVsCent, HistTable), getHistDesc(kPoszVsCent, HistTable), getHistType(kPoszVsCent, HistTable), {Specs[kPoszVsCent]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kCentVsMult, HistTable), getHistDesc(kCentVsMult, HistTable), getHistType(kCentVsMult, HistTable), {Specs[kCentVsMult]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kMultVsSphericity, HistTable), getHistDesc(kMultVsSphericity, HistTable), getHistType(kMultVsSphericity, HistTable), {Specs[kMultVsSphericity]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kCentVsSphericity, HistTable), getHistDesc(kCentVsSphericity, HistTable), getHistType(kCentVsSphericity, HistTable), {Specs[kCentVsSphericity]}); + initQa(Specs); } - } // namespace o2::analysis::femtounited + } + + template + void enableOptionalHistograms(T const& ConfBinningQa) + { + mPlot2d = ConfBinningQa.plot2d.value; + } + + template + void init(o2::framework::HistogramRegistry* registry, std::map> const& Specs, T const& ConfBinningQa) + { + enableOptionalHistograms(ConfBinningQa); + init(registry, Specs); + } template void fill(T const& col) { if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { - mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(getHistName(kPosZ, HistTable)), col.posZ()); - mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(getHistName(kMult, HistTable)), col.mult()); - mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(getHistName(kCent, HistTable)), col.cent()); - mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(getHistName(kMagField, HistTable)), col.magField()); + fillAnalysis(col); } - if constexpr (isFlagSet(mode, modes::Mode::kQa)) { - mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kPosX, HistTable)), col.posX()); - mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kPosY, HistTable)), col.posY()); - mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kPos, HistTable)), std::hypot(col.posX(), col.posY(), col.posZ())); - mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kSphericity, HistTable)), col.sphericity()); - mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kOccupancy, HistTable)), col.trackOccupancyInTimeRange()); + fillQa(col); + } + } + + private: + void initAnalysis(std::map> const& Specs) + { + std::string analysisDir = std::string(ColAnalysisDir); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPosZ, HistTable), getHistDesc(kPosZ, HistTable), getHistType(kPosZ, HistTable), {Specs.at(kPosZ)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kMult, HistTable), getHistDesc(kMult, HistTable), getHistType(kMult, HistTable), {Specs.at(kMult)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kCent, HistTable), getHistDesc(kCent, HistTable), getHistType(kCent, HistTable), {Specs.at(kCent)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kMagField, HistTable), getHistDesc(kMagField, HistTable), getHistType(kMagField, HistTable), {Specs.at(kMagField)}); + } + + void initQa(std::map> const& Specs) + { + std::string qaDir = std::string(ColQaDir); + mHistogramRegistry->add(qaDir + getHistNameV2(kPosX, HistTable), getHistDesc(kPosX, HistTable), getHistType(kPosX, HistTable), {Specs.at(kPosX)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPosY, HistTable), getHistDesc(kPosY, HistTable), getHistType(kPosY, HistTable), {Specs.at(kPosY)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPos, HistTable), getHistDesc(kPos, HistTable), getHistType(kPos, HistTable), {Specs.at(kPos)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kSphericity, HistTable), getHistDesc(kSphericity, HistTable), getHistType(kSphericity, HistTable), {Specs.at(kSphericity)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kOccupancy, HistTable), getHistDesc(kOccupancy, HistTable), getHistType(kOccupancy, HistTable), {Specs.at(kOccupancy)}); + if (mPlot2d) { + mHistogramRegistry->add(qaDir + getHistNameV2(kPoszVsMult, HistTable), getHistDesc(kPoszVsMult, HistTable), getHistType(kPoszVsMult, HistTable), {Specs.at(kPoszVsMult)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPoszVsCent, HistTable), getHistDesc(kPoszVsCent, HistTable), getHistType(kPoszVsCent, HistTable), {Specs.at(kPoszVsCent)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kCentVsMult, HistTable), getHistDesc(kCentVsMult, HistTable), getHistType(kCentVsMult, HistTable), {Specs.at(kCentVsMult)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kMultVsSphericity, HistTable), getHistDesc(kMultVsSphericity, HistTable), getHistType(kMultVsSphericity, HistTable), {Specs.at(kMultVsSphericity)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kCentVsSphericity, HistTable), getHistDesc(kCentVsSphericity, HistTable), getHistType(kCentVsSphericity, HistTable), {Specs.at(kCentVsSphericity)}); + } + } + + template + void fillAnalysis(T const& col) + { + mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(getHistName(kPosZ, HistTable)), col.posZ()); + mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(getHistName(kMult, HistTable)), col.mult()); + mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(getHistName(kCent, HistTable)), col.cent()); + mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(getHistName(kMagField, HistTable)), col.magField()); + } + + template + void fillQa(T const& col) + { + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kPosX, HistTable)), col.posX()); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kPosY, HistTable)), col.posY()); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kPos, HistTable)), std::hypot(col.posX(), col.posY(), col.posZ())); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kSphericity, HistTable)), col.sphericity()); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kOccupancy, HistTable)), col.trackOccupancyInTimeRange()); + if (mPlot2d) { mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kPoszVsMult, HistTable)), col.posZ(), col.mult()); mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kPoszVsCent, HistTable)), col.posZ(), col.cent()); mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kCentVsMult, HistTable)), col.cent(), col.mult()); @@ -180,8 +218,8 @@ class CollisionHistManager } } - private: o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; + bool mPlot2d = true; }; // namespace femtounitedcolhistmanager }; // namespace colhistmanager }; // namespace o2::analysis::femto diff --git a/PWGCF/Femto/Core/dataTypes.h b/PWGCF/Femto/Core/dataTypes.h index 39ae9fc9ae8..0cb8c8758a5 100644 --- a/PWGCF/Femto/Core/dataTypes.h +++ b/PWGCF/Femto/Core/dataTypes.h @@ -29,7 +29,7 @@ using CollisionTagType = uint64_t; using CollisionMaskType = uint16_t; // datatypes for tracks -using MomentumType = uint16_t; +using MomentumType = uint8_t; using TrackMaskType = uint64_t; using TrackType = uint16_t; diff --git a/PWGCF/Femto/Core/kinkBuilder.h b/PWGCF/Femto/Core/kinkBuilder.h index 22514f77f20..c17d94ec89e 100644 --- a/PWGCF/Femto/Core/kinkBuilder.h +++ b/PWGCF/Femto/Core/kinkBuilder.h @@ -148,8 +148,8 @@ template class KinkSelection : public BaseSelection { public: - KinkSelection() {} - virtual ~KinkSelection() = default; + KinkSelection() = default; + ~KinkSelection() = default; template void configure(T1& config, T2& filter) @@ -304,8 +304,8 @@ template class KinkBuilder { public: - KinkBuilder() {} - virtual ~KinkBuilder() = default; + KinkBuilder() = default; + ~KinkBuilder() = default; template void init(T1& config, T2& filter, T3& table, T4& initContext) diff --git a/PWGCF/Femto/Core/kinkHistManager.h b/PWGCF/Femto/Core/kinkHistManager.h index bd82a5027d8..78b92b3b0d9 100644 --- a/PWGCF/Femto/Core/kinkHistManager.h +++ b/PWGCF/Femto/Core/kinkHistManager.h @@ -82,6 +82,7 @@ using ConfSigmaBinning1 = ConfSigmaBinning; template struct ConfKinkQaBinning : o2::framework::ConfigurableGroup { std::string prefix = Prefix; + o2::framework::Configurable plot2d{"plot2d", true, "Enable 2d QA h histograms"}; o2::framework::ConfigurableAxis kinkAngle{"kinkAngle", {{100, 0, 3.15}}, "Kink Angle (rad)"}; o2::framework::ConfigurableAxis dcaMothToPV{"dcaMothToPV", {{150, 0, 1.5}}, "Mother DCA to PV (cm)"}; o2::framework::ConfigurableAxis dcaDaugToPV{"dcaDaugToPV", {{1000, 0, 100}}, "Daughter DCA to PV (cm)"}; @@ -167,99 +168,117 @@ class KinkHistManager { public: KinkHistManager() = default; - virtual ~KinkHistManager() = default; + ~KinkHistManager() = default; - /// Initializes histograms for the task - /// \param registry Histogram registry to be passed - /// void init(o2::framework::HistogramRegistry* registry, - std::map> KinkSpecs, - std::map> ChaDauSpecs) + std::map> const& KinkSpecs, + std::map> const& ChaDauSpecs) { mHistogramRegistry = registry; mChaDauManager.init(registry, ChaDauSpecs); - if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { - std::string analysisDir = std::string(kinkPrefix) + std::string(AnalysisDir); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {KinkSpecs[kPt]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {KinkSpecs[kEta]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {KinkSpecs[kPhi]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kMass, HistTable), getHistDesc(kMass, HistTable), getHistType(kMass, HistTable), {KinkSpecs[kMass]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {KinkSpecs[kSign]}); + initAnalysis(KinkSpecs); } - if constexpr (isFlagSet(mode, modes::Mode::kQa)) { - std::string qaDir = std::string(kinkPrefix) + std::string(QaDir); + initQa(KinkSpecs); + } + } - // Basic kinematic histograms - mHistogramRegistry->add(qaDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {KinkSpecs[kPt]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {KinkSpecs[kEta]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {KinkSpecs[kPhi]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kMass, HistTable), getHistDesc(kMass, HistTable), getHistType(kMass, HistTable), {KinkSpecs[kMass]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {KinkSpecs[kSign]}); + template + void enableOptionalHistograms(T1 const& KinkConfBinningQa, T2 const& ChaDauConfBinningQa) + { + mChaDauManager.enableOptionalHistograms(ChaDauConfBinningQa); + mPlot2d = KinkConfBinningQa.plot2d.value; + } - // Kink-specific QA histograms - mHistogramRegistry->add(qaDir + getHistNameV2(kKinkAngle, HistTable), getHistDesc(kKinkAngle, HistTable), getHistType(kKinkAngle, HistTable), {KinkSpecs[kKinkAngle]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kDcaMothToPV, HistTable), getHistDesc(kDcaMothToPV, HistTable), getHistType(kDcaMothToPV, HistTable), {KinkSpecs[kDcaMothToPV]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kDcaDaugToPV, HistTable), getHistDesc(kDcaDaugToPV, HistTable), getHistType(kDcaDaugToPV, HistTable), {KinkSpecs[kDcaDaugToPV]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxX, HistTable), getHistDesc(kDecayVtxX, HistTable), getHistType(kDecayVtxX, HistTable), {KinkSpecs[kDecayVtxX]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxY, HistTable), getHistDesc(kDecayVtxY, HistTable), getHistType(kDecayVtxY, HistTable), {KinkSpecs[kDecayVtxY]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxZ, HistTable), getHistDesc(kDecayVtxZ, HistTable), getHistType(kDecayVtxZ, HistTable), {KinkSpecs[kDecayVtxZ]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtx, HistTable), getHistDesc(kDecayVtx, HistTable), getHistType(kDecayVtx, HistTable), {KinkSpecs[kDecayVtx]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kTransRadius, HistTable), getHistDesc(kTransRadius, HistTable), getHistType(kTransRadius, HistTable), {KinkSpecs[kTransRadius]}); + template + void init(o2::framework::HistogramRegistry* registry, + std::map> const& KinkSpecs, + T1 const& KinkConfBinningQa, + std::map> const& ChaDauSpecs, + T2 const& ChaDauConfBinningQa) + { + enableOptionalHistograms(KinkConfBinningQa, ChaDauConfBinningQa); + init(registry, KinkSpecs, ChaDauSpecs); + } - // 2D QA histograms - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsEta, HistTable), getHistDesc(kPtVsEta, HistTable), getHistType(kPtVsEta, HistTable), {KinkSpecs[kPtVsEta]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPhi, HistTable), getHistDesc(kPtVsPhi, HistTable), getHistType(kPtVsPhi, HistTable), {KinkSpecs[kPtVsPhi]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPhiVsEta, HistTable), getHistDesc(kPhiVsEta, HistTable), getHistType(kPhiVsEta, HistTable), {KinkSpecs[kPhiVsEta]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsKinkAngle, HistTable), getHistDesc(kPtVsKinkAngle, HistTable), getHistType(kPtVsKinkAngle, HistTable), {KinkSpecs[kPtVsKinkAngle]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsDecayRadius, HistTable), getHistDesc(kPtVsDecayRadius, HistTable), getHistType(kPtVsDecayRadius, HistTable), {KinkSpecs[kPtVsDecayRadius]}); + template + void fill(T1 const& kinkcandidate, T2 const& tracks) + { + // this used to work, still under investigation + // auto chaDaughter = kinkcandidate.template chaDau_as(); + auto chaDaughter = tracks.rawIteratorAt(kinkcandidate.chaDauId() - tracks.offset()); + mChaDauManager.fill(chaDaughter, tracks); + if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { + fillAnalysis(kinkcandidate); + } + if constexpr (isFlagSet(mode, modes::Mode::kQa)) { + fillQa(kinkcandidate); + } + } + + private: + void initAnalysis(std::map> const& KinkSpecs) + { + std::string analysisDir = std::string(kinkPrefix) + std::string(AnalysisDir); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {KinkSpecs.at(kPt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {KinkSpecs.at(kEta)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {KinkSpecs.at(kPhi)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kMass, HistTable), getHistDesc(kMass, HistTable), getHistType(kMass, HistTable), {KinkSpecs.at(kMass)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {KinkSpecs.at(kSign)}); + } + + void initQa(std::map> const& KinkSpecs) + { + std::string qaDir = std::string(kinkPrefix) + std::string(QaDir); + // Kink-specific QA histograms + mHistogramRegistry->add(qaDir + getHistNameV2(kKinkAngle, HistTable), getHistDesc(kKinkAngle, HistTable), getHistType(kKinkAngle, HistTable), {KinkSpecs.at(kKinkAngle)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDcaMothToPV, HistTable), getHistDesc(kDcaMothToPV, HistTable), getHistType(kDcaMothToPV, HistTable), {KinkSpecs.at(kDcaMothToPV)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDcaDaugToPV, HistTable), getHistDesc(kDcaDaugToPV, HistTable), getHistType(kDcaDaugToPV, HistTable), {KinkSpecs.at(kDcaDaugToPV)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxX, HistTable), getHistDesc(kDecayVtxX, HistTable), getHistType(kDecayVtxX, HistTable), {KinkSpecs.at(kDecayVtxX)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxY, HistTable), getHistDesc(kDecayVtxY, HistTable), getHistType(kDecayVtxY, HistTable), {KinkSpecs.at(kDecayVtxY)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxZ, HistTable), getHistDesc(kDecayVtxZ, HistTable), getHistType(kDecayVtxZ, HistTable), {KinkSpecs.at(kDecayVtxZ)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtx, HistTable), getHistDesc(kDecayVtx, HistTable), getHistType(kDecayVtx, HistTable), {KinkSpecs.at(kDecayVtx)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTransRadius, HistTable), getHistDesc(kTransRadius, HistTable), getHistType(kTransRadius, HistTable), {KinkSpecs.at(kTransRadius)}); + if (mPlot2d) { + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsEta, HistTable), getHistDesc(kPtVsEta, HistTable), getHistType(kPtVsEta, HistTable), {KinkSpecs.at(kPtVsEta)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPhi, HistTable), getHistDesc(kPtVsPhi, HistTable), getHistType(kPtVsPhi, HistTable), {KinkSpecs.at(kPtVsPhi)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPhiVsEta, HistTable), getHistDesc(kPhiVsEta, HistTable), getHistType(kPhiVsEta, HistTable), {KinkSpecs.at(kPhiVsEta)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsKinkAngle, HistTable), getHistDesc(kPtVsKinkAngle, HistTable), getHistType(kPtVsKinkAngle, HistTable), {KinkSpecs.at(kPtVsKinkAngle)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsDecayRadius, HistTable), getHistDesc(kPtVsDecayRadius, HistTable), getHistType(kPtVsDecayRadius, HistTable), {KinkSpecs.at(kPtVsDecayRadius)}); } } /// Fill histograms for kink candidates /// \param kinkcandidate Kink candidate to fill histograms for template - void fill(T const& kinkcandidate) + void fillAnalysis(T const& kinkcandidate) { - if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(getHistName(kPt, HistTable)), kinkcandidate.pt()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(getHistName(kEta, HistTable)), kinkcandidate.eta()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(getHistName(kPhi, HistTable)), kinkcandidate.phi()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(getHistName(kMass, HistTable)), kinkcandidate.mass()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(getHistName(kPt, HistTable)), kinkcandidate.pt()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(getHistName(kEta, HistTable)), kinkcandidate.eta()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(getHistName(kPhi, HistTable)), kinkcandidate.phi()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(getHistName(kMass, HistTable)), kinkcandidate.mass()); - if constexpr (isEqual(kink, modes::Kink::kSigma)) { - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), kinkcandidate.sign()); - } + if constexpr (isEqual(kink, modes::Kink::kSigma)) { + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), kinkcandidate.sign()); } + } - if constexpr (isFlagSet(mode, modes::Mode::kQa)) { - // Basic kinematic histograms - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kPt, HistTable)), kinkcandidate.pt()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kEta, HistTable)), kinkcandidate.eta()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kPhi, HistTable)), kinkcandidate.phi()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kMass, HistTable)), kinkcandidate.mass()); - - if constexpr (isEqual(kink, modes::Kink::kSigma)) { - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kSign, HistTable)), kinkcandidate.sign()); - } - - // Kink-specific QA histograms - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kKinkAngle, HistTable)), kinkcandidate.kinkAngle()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDcaMothToPV, HistTable)), kinkcandidate.dcaMothToPV()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDcaDaugToPV, HistTable)), kinkcandidate.dcaDaugToPV()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxX, HistTable)), kinkcandidate.decayVtxX()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxY, HistTable)), kinkcandidate.decayVtxY()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxZ, HistTable)), kinkcandidate.decayVtxZ()); - - // Calculate decay distance from PV - float decayDistance = std::sqrt(kinkcandidate.decayVtxX() * kinkcandidate.decayVtxX() + - kinkcandidate.decayVtxY() * kinkcandidate.decayVtxY() + - kinkcandidate.decayVtxZ() * kinkcandidate.decayVtxZ()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDecayVtx, HistTable)), decayDistance); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kTransRadius, HistTable)), kinkcandidate.transRadius()); - - // 2D QA histograms + template + void fillQa(T const& kinkcandidate) + { + // Kink-specific QA histograms + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kKinkAngle, HistTable)), kinkcandidate.kinkAngle()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDcaMothToPV, HistTable)), kinkcandidate.dcaMothToPV()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDcaDaugToPV, HistTable)), kinkcandidate.dcaDaugToPV()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxX, HistTable)), kinkcandidate.decayVtxX()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxY, HistTable)), kinkcandidate.decayVtxY()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxZ, HistTable)), kinkcandidate.decayVtxZ()); + // Calculate decay distance from PV + float decayDistance = std::hypot(kinkcandidate.decayVtxX(), kinkcandidate.decayVtxY(), kinkcandidate.decayVtxZ()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDecayVtx, HistTable)), decayDistance); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kTransRadius, HistTable)), kinkcandidate.transRadius()); + if (mPlot2d) { mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kPtVsEta, HistTable)), kinkcandidate.pt(), kinkcandidate.eta()); mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kPtVsPhi, HistTable)), kinkcandidate.pt(), kinkcandidate.phi()); mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kPhiVsEta, HistTable)), kinkcandidate.phi(), kinkcandidate.eta()); @@ -268,22 +287,9 @@ class KinkHistManager } } - /// Fill histograms for kink candidates - overload with track table argument - /// \param kinkcandidate Kink candidate to fill histograms for - /// \param tracks Track table for daughter access - template - void fill(T1 const& kinkcandidate, T2 const& tracks) - { - // this used to work, still under investigation - // auto chaDaughter = kinkcandidate.template chaDau_as(); - auto chaDaughter = tracks.rawIteratorAt(kinkcandidate.chaDauId() - tracks.offset()); - mChaDauManager.fill(chaDaughter, tracks); - fill(kinkcandidate); - } - - private: o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; trackhistmanager::TrackHistManager mChaDauManager; + bool mPlot2d = true; }; }; // namespace kinkhistmanager }; // namespace o2::analysis::femto diff --git a/PWGCF/Femto/Core/modes.h b/PWGCF/Femto/Core/modes.h index 752df384b7a..672ada08ba3 100644 --- a/PWGCF/Femto/Core/modes.h +++ b/PWGCF/Femto/Core/modes.h @@ -66,8 +66,9 @@ enum class System : uint32_t { }; enum class MomentumType : o2::aod::femtodatatypes::MomentumType { - kPAtPv, // momentum at primary vertex kPt, // transverse momentum + kPAtPv, // momentum at primary vertex + kPTpc, // momentum at inner wall of tpc }; enum class Track : o2::aod::femtodatatypes::TrackType { diff --git a/PWGCF/Femto/Core/pairBuilder.h b/PWGCF/Femto/Core/pairBuilder.h index 9ffd0f91465..1d788b5badd 100644 --- a/PWGCF/Femto/Core/pairBuilder.h +++ b/PWGCF/Femto/Core/pairBuilder.h @@ -67,47 +67,49 @@ class PairTrackTrackBuilder typename T6, typename T7, typename T8, - typename T9> + typename T9, + typename T10> void init(o2::framework::HistogramRegistry* registry, - T1& confTrackSelection1, - T2& confTrackSelection2, - T3& confCpr, - T4& confMixing, - std::map>& colHistSpec, - std::map>& trackHistSpec1, - std::map>& trackHistSpec2, - std::map>& pairHistSpec, - std::map>& cprHistSpec) + T1 const& confTrackSelection1, + T2 const& confTrackSelection2, + T3 const& confCpr, + T4 const& confMixing, + T5 const& confPairBinning, + std::map> const& colHistSpec, + std::map> const& trackHistSpec1, + std::map> const& trackHistSpec2, + std::map> const& pairHistSpec, + std::map> const& cprHistSpec) { // check if correlate the same tracks or not mSameSpecies = confMixing.sameSpecies.value; mColHistManager.init(registry, colHistSpec); - mPairHistManagerSe.init(registry, pairHistSpec); - mPairHistManagerMe.init(registry, pairHistSpec); + mPairHistManagerSe.init(registry, pairHistSpec, confPairBinning); + mPairHistManagerMe.init(registry, pairHistSpec, confPairBinning); if (mSameSpecies) { - mTrackHistManager1.init(registry, trackHistSpec1); + mTrackHistManager1.init(registry, trackHistSpec1, confTrackSelection1.chargeAbs.value); mPairHistManagerSe.setMass(confTrackSelection1.pdgCode.value, confTrackSelection1.pdgCode.value); mPairHistManagerSe.setCharge(confTrackSelection1.chargeAbs.value, confTrackSelection1.chargeAbs.value); - mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.chargeAbs.value, confTrackSelection1.chargeAbs.value, confCpr.on.value); + mCprSe.init(registry, cprHistSpec, confCpr, confTrackSelection1.chargeAbs.value, confTrackSelection1.chargeAbs.value); mPairHistManagerMe.setMass(confTrackSelection1.pdgCode.value, confTrackSelection1.pdgCode.value); mPairHistManagerMe.setCharge(confTrackSelection1.chargeAbs.value, confTrackSelection1.chargeAbs.value); - mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.chargeAbs.value, confTrackSelection1.chargeAbs.value, confCpr.on.value); + mCprMe.init(registry, cprHistSpec, confCpr, confTrackSelection1.chargeAbs.value, confTrackSelection1.chargeAbs.value); } else { - mTrackHistManager1.init(registry, trackHistSpec1); - mTrackHistManager2.init(registry, trackHistSpec2); + mTrackHistManager1.init(registry, trackHistSpec1, confTrackSelection1.chargeAbs.value); + mTrackHistManager2.init(registry, trackHistSpec2, confTrackSelection2.chargeAbs.value); mPairHistManagerSe.setMass(confTrackSelection1.pdgCode.value, confTrackSelection2.pdgCode.value); mPairHistManagerSe.setCharge(confTrackSelection1.chargeAbs.value, confTrackSelection2.chargeAbs.value); - mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.chargeAbs.value, confTrackSelection2.chargeAbs.value, confCpr.on.value); + mCprSe.init(registry, cprHistSpec, confCpr, confTrackSelection1.chargeAbs.value, confTrackSelection2.chargeAbs.value); mPairHistManagerMe.setMass(confTrackSelection1.pdgCode.value, confTrackSelection2.pdgCode.value); mPairHistManagerMe.setCharge(confTrackSelection1.chargeAbs.value, confTrackSelection2.chargeAbs.value); - mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.chargeAbs.value, confTrackSelection2.chargeAbs.value, confCpr.on.value); + mCprMe.init(registry, cprHistSpec, confCpr, confTrackSelection1.chargeAbs.value, confTrackSelection2.chargeAbs.value); } // setup mixing @@ -137,7 +139,7 @@ class PairTrackTrackBuilder } mColHistManager.fill(col); mCprSe.setMagField(col.magField()); - pairprocesshelpers::processSameEvent(trackSlice1, trackTable, mTrackHistManager1, mPairHistManagerSe, mCprSe, mRng, mMixIdenticalParticles); + pairprocesshelpers::processSameEvent(trackSlice1, trackTable, col, mTrackHistManager1, mPairHistManagerSe, mCprSe, mRng, mMixIdenticalParticles); } else { auto trackSlice1 = partition1->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); auto trackSlice2 = partition2->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); @@ -146,7 +148,7 @@ class PairTrackTrackBuilder } mColHistManager.fill(col); mCprSe.setMagField(col.magField()); - pairprocesshelpers::processSameEvent(trackSlice1, trackSlice2, trackTable, mTrackHistManager1, mTrackHistManager2, mPairHistManagerSe, mCprSe, mPc); + pairprocesshelpers::processSameEvent(trackSlice1, trackSlice2, trackTable, col, mTrackHistManager1, mTrackHistManager2, mPairHistManagerSe, mCprSe, mPc); } } @@ -233,49 +235,51 @@ class PairV0V0Builder typename T8, typename T9, typename T10, + typename T12, typename T11> void init(o2::framework::HistogramRegistry* registry, - T1& confV0Selection1, - T2& confV0Selection2, - T3& confCpr, - T4& confMixing, - std::map>& colHistSpec, - std::map>& V0HistSpec1, - std::map>& V0HistSpec2, - std::map>& PosDauHistSpec, - std::map>& NegDauHistSpec, - std::map>& pairHistSpec, - std::map>& cprHistSpec) + T1 const& confV0Selection1, + T2 const& confV0Selection2, + T3 const& confCpr, + T4 const& confMixing, + T5 const& confPairBinning, + std::map>& colHistSpec, + std::map>& V0HistSpec1, + std::map>& V0HistSpec2, + std::map>& PosDauHistSpec, + std::map>& NegDauHistSpec, + std::map>& pairHistSpec, + std::map>& cprHistSpec) { // check if correlate the same tracks or not mSameSpecies = confMixing.sameSpecies.value; mColHistManager.init(registry, colHistSpec); - mPairHistManagerSe.init(registry, pairHistSpec); - mPairHistManagerMe.init(registry, pairHistSpec); + mPairHistManagerSe.init(registry, pairHistSpec, confPairBinning); + mPairHistManagerMe.init(registry, pairHistSpec, confPairBinning); if (mSameSpecies) { mV0HistManager1.init(registry, V0HistSpec1, PosDauHistSpec, NegDauHistSpec); mPairHistManagerSe.setMass(confV0Selection1.pdgCode.value, confV0Selection1.pdgCode.value); mPairHistManagerSe.setCharge(1, 1); - mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confCpr.on.value); + mCprSe.init(registry, cprHistSpec, confCpr); mPairHistManagerMe.setMass(confV0Selection1.pdgCode.value, confV0Selection1.pdgCode.value); mPairHistManagerMe.setCharge(1, 1); - mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confCpr.on.value); + mCprMe.init(registry, cprHistSpec, confCpr); } else { mV0HistManager1.init(registry, V0HistSpec1, PosDauHistSpec, NegDauHistSpec); mV0HistManager2.init(registry, V0HistSpec2, PosDauHistSpec, NegDauHistSpec); mPairHistManagerSe.setMass(confV0Selection1.pdgCode.value, confV0Selection2.pdgCode.value); mPairHistManagerSe.setCharge(1, 1); - mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confCpr.on.value); + mCprSe.init(registry, cprHistSpec, confCpr); mPairHistManagerMe.setMass(confV0Selection1.pdgCode.value, confV0Selection2.pdgCode.value); mPairHistManagerMe.setCharge(1, 1); - mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confCpr.on.value); + mCprMe.init(registry, cprHistSpec, confCpr); } // setup mixing @@ -305,7 +309,7 @@ class PairV0V0Builder } mColHistManager.fill(col); mCprSe.setMagField(col.magField()); - pairprocesshelpers::processSameEvent(v0Slice1, trackTable, mV0HistManager1, mPairHistManagerSe, mCprSe, mRng, mMixIdenticalParticles); + pairprocesshelpers::processSameEvent(v0Slice1, trackTable, col, mV0HistManager1, mPairHistManagerSe, mCprSe, mRng, mMixIdenticalParticles); } else { auto v0Slice1 = partition1->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); auto v0Slice2 = partition2->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); @@ -314,7 +318,7 @@ class PairV0V0Builder } mColHistManager.fill(col); mCprSe.setMagField(col.magField()); - pairprocesshelpers::processSameEvent(v0Slice1, v0Slice2, trackTable, mV0HistManager1, mV0HistManager2, mPairHistManagerSe, mCprSe, mPc); + pairprocesshelpers::processSameEvent(v0Slice1, v0Slice2, trackTable, col, mV0HistManager1, mV0HistManager2, mPairHistManagerSe, mCprSe, mPc); } } @@ -376,8 +380,10 @@ template < const char* prefixNegDau, const char* prefixSe, const char* prefixMe, - const char* prefixCprSe, - const char* prefixCprMe, + const char* prefixCprSameChargeSe, + const char* prefixCprSameChargeMe, + const char* prefixCprOppositeChargeSe, + const char* prefixCprOppositeChargeMe, modes::Mode mode, modes::V0 v0Type> class PairTrackV0Builder @@ -396,34 +402,36 @@ class PairTrackV0Builder typename T8, typename T9, typename T10, - typename T11> + typename T11, + typename T12> void init(o2::framework::HistogramRegistry* registry, - T1& confTrackSelection, - T2& confV0Selection, - T3& confCpr, - T4& confMixing, - std::map>& colHistSpec, - std::map>& trackHistSpec, - std::map>& v0HistSpec, - std::map>& posDauHistSpec, - std::map>& negDauHistSpec, - std::map>& pairHistSpec, - std::map>& cprHistSpec) + T1 const& confTrackSelection, + T2 const& confV0Selection, + T3 const& confCpr, + T4 const& confMixing, + T5 const& confPairBinning, + std::map>& colHistSpec, + std::map>& trackHistSpec, + std::map>& v0HistSpec, + std::map>& posDauHistSpec, + std::map>& negDauHistSpec, + std::map>& pairHistSpec, + std::map>& cprHistSpec) { mColHistManager.init(registry, colHistSpec); - mTrackHistManager.init(registry, trackHistSpec); + mTrackHistManager.init(registry, trackHistSpec, confTrackSelection.chargeAbs.value); mV0HistManager.init(registry, v0HistSpec, posDauHistSpec, negDauHistSpec); - mPairHistManagerSe.init(registry, pairHistSpec); + mPairHistManagerSe.init(registry, pairHistSpec, confPairBinning); mPairHistManagerSe.setMass(confTrackSelection.pdgCode.value, confV0Selection.pdgCode.value); mPairHistManagerSe.setCharge(confTrackSelection.chargeAbs.value, 1); - mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); + mCprSe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value); - mPairHistManagerMe.init(registry, pairHistSpec); + mPairHistManagerMe.init(registry, pairHistSpec, confPairBinning); mPairHistManagerMe.setMass(confTrackSelection.pdgCode.value, confV0Selection.pdgCode.value); mPairHistManagerMe.setCharge(confTrackSelection.chargeAbs.value, 1); - mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); + mCprMe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value); // setup mixing mMixingPolicy = static_cast(confMixing.policy.value); @@ -440,7 +448,7 @@ class PairTrackV0Builder } mColHistManager.fill(col); mCprSe.setMagField(col.magField()); - pairprocesshelpers::processSameEvent(trackSlice, v0Slice, trackTable, mTrackHistManager, mV0HistManager, mPairHistManagerSe, mCprSe, mPc); + pairprocesshelpers::processSameEvent(trackSlice, v0Slice, trackTable, col, mTrackHistManager, mV0HistManager, mPairHistManagerSe, mCprSe, mPc); } template @@ -467,8 +475,8 @@ class PairTrackV0Builder v0histmanager::V0HistManager mV0HistManager; pairhistmanager::PairHistManager mPairHistManagerSe; pairhistmanager::PairHistManager mPairHistManagerMe; - closepairrejection::ClosePairRejectionTrackV0 mCprSe; - closepairrejection::ClosePairRejectionTrackV0 mCprMe; + closepairrejection::ClosePairRejectionTrackV0 mCprSe; + closepairrejection::ClosePairRejectionTrackV0 mCprMe; paircleaner::TrackV0PairCleaner mPc; pairhistmanager::MixingPoliciy mMixingPolicy = pairhistmanager::MixingPoliciy::kVtxMult; int mMixingDepth = 5; @@ -481,8 +489,10 @@ template < const char* prefixNegDau, const char* prefixSe, const char* prefixMe, - const char* prefixCprSe, - const char* prefixCprMe, + const char* prefixCprSameChargeSe, + const char* prefixCprSameChargeMe, + const char* prefixCprOppositeChargeSe, + const char* prefixCprOppositeChargeMe, modes::Mode mode, modes::TwoTrackResonance resonanceType> class PairTrackTwoTrackResonanceBuilder @@ -501,34 +511,36 @@ class PairTrackTwoTrackResonanceBuilder typename T8, typename T9, typename T10, - typename T11> + typename T11, + typename T12> void init(o2::framework::HistogramRegistry* registry, - T1& confTrackSelection, - T2& confResonanceSelection, - T3& confCpr, - T4& confMixing, - std::map>& colHistSpec, - std::map>& trackHistSpec, - std::map>& resonanceHistSpec, - std::map>& posDauHistSpec, - std::map>& negDauHistSpec, - std::map>& pairHistSpec, - std::map>& cprHistSpec) + T1 const& confTrackSelection, + T2 const& confResonanceSelection, + T3 const& confCpr, + T4 const& confMixing, + T5 const& confPairBinning, + std::map> const& colHistSpec, + std::map> const& trackHistSpec, + std::map> const& resonanceHistSpec, + std::map> const& posDauHistSpec, + std::map> const& negDauHistSpec, + std::map> const& pairHistSpec, + std::map> const& cprHistSpec) { mColHistManager.init(registry, colHistSpec); - mTrackHistManager.init(registry, trackHistSpec); + mTrackHistManager.init(registry, trackHistSpec, confTrackSelection.chargeAbs.value); mResonanceHistManager.init(registry, resonanceHistSpec, posDauHistSpec, negDauHistSpec); - mPairHistManagerSe.init(registry, pairHistSpec); + mPairHistManagerSe.init(registry, pairHistSpec, confPairBinning); mPairHistManagerSe.setMass(confTrackSelection.pdgCode.value, confResonanceSelection.pdgCode.value); mPairHistManagerSe.setCharge(confTrackSelection.chargeAbs.value, 1); - mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); + mCprSe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value); - mPairHistManagerMe.init(registry, pairHistSpec); + mPairHistManagerMe.init(registry, pairHistSpec, confPairBinning); mPairHistManagerMe.setMass(confTrackSelection.pdgCode.value, confResonanceSelection.pdgCode.value); mPairHistManagerMe.setCharge(confTrackSelection.chargeAbs.value, 1); - mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); + mCprMe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value); // setup mixing mMixingPolicy = static_cast(confMixing.policy.value); @@ -545,7 +557,7 @@ class PairTrackTwoTrackResonanceBuilder } mColHistManager.fill(col); mCprSe.setMagField(col.magField()); - pairprocesshelpers::processSameEvent(trackSlice, v0Slice, trackTable, mTrackHistManager, mResonanceHistManager, mPairHistManagerSe, mCprSe, mPc); + pairprocesshelpers::processSameEvent(trackSlice, v0Slice, trackTable, col, mTrackHistManager, mResonanceHistManager, mPairHistManagerSe, mCprSe, mPc); } template @@ -572,9 +584,9 @@ class PairTrackTwoTrackResonanceBuilder twotrackresonancehistmanager::TwoTrackResonanceHistManager mResonanceHistManager; pairhistmanager::PairHistManager mPairHistManagerSe; pairhistmanager::PairHistManager mPairHistManagerMe; - closepairrejection::ClosePairRejectionTrackV0 mCprSe; // cpr for twotrackresonances and v0 work the same way - closepairrejection::ClosePairRejectionTrackV0 mCprMe; // cpr for twotrackresonances and v0 work the same way - paircleaner::TrackV0PairCleaner mPc; // pc for twotrackresonances and v0 work the same way + closepairrejection::ClosePairRejectionTrackV0 mCprSe; // cpr for twotrackresonances and v0 work the same way + closepairrejection::ClosePairRejectionTrackV0 mCprMe; // cpr for twotrackresonances and v0 work the same way + paircleaner::TrackV0PairCleaner mPc; // pc for twotrackresonances and v0 work the same way pairhistmanager::MixingPoliciy mMixingPolicy = pairhistmanager::MixingPoliciy::kVtxMult; int mMixingDepth = 5; }; @@ -604,33 +616,35 @@ class PairTrackKinkBuilder typename T7, typename T8, typename T9, - typename T10> + typename T10, + typename T11> void init(o2::framework::HistogramRegistry* registry, - T1& confTrackSelection, - T2& confKinkSelection, - T3& confCpr, - T4& confMixing, - std::map>& colHistSpec, - std::map>& trackHistSpec, - std::map>& kinkHistSpec, - std::map>& chaDauHistSpec, - std::map>& pairHistSpec, - std::map>& cprHistSpec) + T1 const& confTrackSelection, + T2 const& confKinkSelection, + T3 const& confCpr, + T4 const& confMixing, + T5 const& confPairBinning, + std::map> const& colHistSpec, + std::map> const& trackHistSpec, + std::map> const& kinkHistSpec, + std::map> const& chaDauHistSpec, + std::map> const& pairHistSpec, + std::map> const& cprHistSpec) { mColHistManager.init(registry, colHistSpec); - mTrackHistManager.init(registry, trackHistSpec); + mTrackHistManager.init(registry, trackHistSpec, confTrackSelection.chargeAbs.value); mKinkHistManager.init(registry, kinkHistSpec, chaDauHistSpec); - mPairHistManagerSe.init(registry, pairHistSpec); + mPairHistManagerSe.init(registry, pairHistSpec, confPairBinning); mPairHistManagerSe.setMass(confTrackSelection.pdgCode.value, confKinkSelection.pdgCode.value); mPairHistManagerSe.setCharge(confTrackSelection.chargeAbs.value, 1); // abs charge of kink daughter is always 1 - mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); + mCprSe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value); - mPairHistManagerMe.init(registry, pairHistSpec); + mPairHistManagerMe.init(registry, pairHistSpec, confPairBinning); mPairHistManagerMe.setMass(confTrackSelection.pdgCode.value, confKinkSelection.pdgCode.value); mPairHistManagerMe.setCharge(confTrackSelection.chargeAbs.value, 1); // abs charge of kink daughter is always 1 - mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); + mCprMe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value); // setup mixing mMixingPolicy = static_cast(confMixing.policy.value); @@ -647,7 +661,7 @@ class PairTrackKinkBuilder } mColHistManager.fill(col); mCprSe.setMagField(col.magField()); - pairprocesshelpers::processSameEvent(trackSlice, kinkSlice, trackTable, mTrackHistManager, mKinkHistManager, mPairHistManagerSe, mCprSe, mPc); + pairprocesshelpers::processSameEvent(trackSlice, kinkSlice, trackTable, col, mTrackHistManager, mKinkHistManager, mPairHistManagerSe, mCprSe, mPc); } template @@ -689,8 +703,12 @@ template < const char* prefixNegDau, const char* prefixSe, const char* prefixMe, - const char* prefixCprSe, - const char* prefixCprMe, + const char* prefixCprBachelorSe, + const char* prefixCprSameChargeSe, + const char* prefixCprOppositeChargeSe, + const char* prefixCprBachelorMe, + const char* prefixCprSameChargeMe, + const char* prefixCprOppositeChargeMe, modes::Mode mode, modes::Cascade cascadeType> class PairTrackCascadeBuilder @@ -710,35 +728,37 @@ class PairTrackCascadeBuilder typename T9, typename T10, typename T11, - typename T12> + typename T12, + typename T13> void init(o2::framework::HistogramRegistry* registry, - T1& confTrackSelection, - T2& confCascadeSelection, - T3& confCpr, - T4& confMixing, - std::map>& colHistSpec, - std::map>& trackHistSpec, - std::map>& cascadeHistSpec, - std::map>& bachelorHistSpec, - std::map>& posDauHistSpec, - std::map>& negDauHistSpec, - std::map>& pairHistSpec, - std::map>& cprHistSpec) + T1 const& confTrackSelection, + T2 const& confCascadeSelection, + T3 const& confCpr, + T4 const& confMixing, + T5 const& confPairBinning, + std::map> const& colHistSpec, + std::map> const& trackHistSpec, + std::map> const& cascadeHistSpec, + std::map> const& bachelorHistSpec, + std::map> const& posDauHistSpec, + std::map> const& negDauHistSpec, + std::map> const& pairHistSpec, + std::map> const& cprHistSpec) { mColHistManager.init(registry, colHistSpec); - mTrackHistManager.init(registry, trackHistSpec); + mTrackHistManager.init(registry, trackHistSpec, confTrackSelection.chargeAbs.value); mCascadeHistManager.init(registry, cascadeHistSpec, bachelorHistSpec, posDauHistSpec, negDauHistSpec); - mPairHistManagerSe.init(registry, pairHistSpec); + mPairHistManagerSe.init(registry, pairHistSpec, confPairBinning); mPairHistManagerSe.setMass(confTrackSelection.pdgCode.value, confCascadeSelection.pdgCode.value); mPairHistManagerSe.setCharge(confTrackSelection.chargeAbs.value, 1); - mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); + mCprSe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value); - mPairHistManagerMe.init(registry, pairHistSpec); + mPairHistManagerMe.init(registry, pairHistSpec, confPairBinning); mPairHistManagerMe.setMass(confTrackSelection.pdgCode.value, confCascadeSelection.pdgCode.value); mPairHistManagerMe.setCharge(confTrackSelection.chargeAbs.value, 1); - mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); + mCprMe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value); // setup mixing mMixingPolicy = static_cast(confMixing.policy.value); @@ -755,7 +775,7 @@ class PairTrackCascadeBuilder } mColHistManager.fill(col); mCprSe.setMagField(col.magField()); - pairprocesshelpers::processSameEvent(trackSlice, v0Slice, trackTable, mTrackHistManager, mCascadeHistManager, mPairHistManagerSe, mCprSe, mPc); + pairprocesshelpers::processSameEvent(trackSlice, v0Slice, trackTable, col, mTrackHistManager, mCascadeHistManager, mPairHistManagerSe, mCprSe, mPc); } template @@ -782,8 +802,8 @@ class PairTrackCascadeBuilder cascadehistmanager::CascadeHistManager mCascadeHistManager; pairhistmanager::PairHistManager mPairHistManagerSe; pairhistmanager::PairHistManager mPairHistManagerMe; - closepairrejection::ClosePairRejectionTrackCascade mCprSe; - closepairrejection::ClosePairRejectionTrackCascade mCprMe; + closepairrejection::ClosePairRejectionTrackCascade mCprSe; + closepairrejection::ClosePairRejectionTrackCascade mCprMe; paircleaner::TrackCascadePairCleaner mPc; pairhistmanager::MixingPoliciy mMixingPolicy = pairhistmanager::MixingPoliciy::kVtxMult; int mMixingDepth = 5; diff --git a/PWGCF/Femto/Core/pairHistManager.h b/PWGCF/Femto/Core/pairHistManager.h index 6b296d0af9e..16077c7a2ea 100644 --- a/PWGCF/Femto/Core/pairHistManager.h +++ b/PWGCF/Femto/Core/pairHistManager.h @@ -52,8 +52,18 @@ enum PairHist { kPt2VsKt, kPt1VsMt, kPt2VsMt, + kKstarVsKt, + kKstarVsMt, + kKstarVsMult, + kKstarVsCent, + + // higher dimensions + kKstarVsMtVsMult, + kKstarVsMtVsMultVsCent, + kKstarVsMtVsPt1VsP2VsMult, + kKstarVsMtVsPt1VsP2VsMultVsCent, + kPairHistogramLast - // more dimensions }; enum MixingPoliciy { @@ -77,23 +87,46 @@ struct ConfMixing : o2::framework::ConfigurableGroup { struct ConfPairBinning : o2::framework::ConfigurableGroup { std::string prefix = std::string("PairBinning"); + o2::framework::Configurable plot1D{"plot1D", true, "Enable 1D histograms"}; + o2::framework::Configurable plot2D{"plot2D", true, "Enable 2D histograms"}; + o2::framework::Configurable plotKstarVsMtVsMult{"plotKstarVsMtVsMult", false, "Enable 3D histogram (Kstar Vs Mt Vs Mult)"}; + o2::framework::Configurable plotKstarVsMtVsMultVsCent{"plotKstarVsMtVsMultVsCent", false, "Enable 4D histogram (Kstar Vs Mt Vs Mult Vs Cent)"}; + o2::framework::Configurable plotKstarVsMtVsPt1VsP2VsMult{"plotKstarVsMtVsPt1VsP2VsMult", false, "Enable 5D histogram (Kstar Vs Mt Vs Pt1 Vs Pt2 Vs Mult)"}; + o2::framework::Configurable plotKstarVsMtVsPt1VsP2VsMultVsCent{"plotKstarVsMtVsPt1VsP2VsMultVsCent", false, "Enable 6D histogram (Kstar Vs Mt Vs Pt1 Vs Pt2 Vs Mult Vs Cent)"}; o2::framework::ConfigurableAxis kstar{"kstar", {{600, 0, 6}}, "kstar"}; o2::framework::ConfigurableAxis kt{"kt", {{600, 0, 6}}, "kt"}; o2::framework::ConfigurableAxis mt{"mt", {{500, 0.8, 5.8}}, "mt"}; + o2::framework::ConfigurableAxis multiplicity{"multiplicity", {{50, 0, 200}}, "multiplicity"}; + o2::framework::ConfigurableAxis centrality{"centrality", {{10, 0, 100}}, "centrality (mult. percentile)"}; }; // the enum gives the correct index in the array constexpr std::array, kPairHistogramLast> HistTable = { - {{kKstar, o2::framework::kTH1F, "hKstar", "k*; k* (GeV/#it{c}); Entries"}, - {kKt, o2::framework::kTH1F, "hKt", "transverse momentum; k_{T} (GeV/#it{c}); Entries"}, - {kMt, o2::framework::kTH1F, "hMt", "transverse mass; m_{T} (GeV/#it{c}^{2}); Entries"}, - {kPt1VsPt2, o2::framework::kTH2F, "hPt1VsPt2", "track1 p_{T} vs track2 p_{T}; track1 p_T (GeV/#it{c}); track2 p_{T} (GeV/#it{c})"}, - {kPt1VsKstar, o2::framework::kTH2F, "hPt1VsKstar", "p_{T,1} vs k*; p_{T,2} (GeV/#it{c}); k* (GeV/#it{c})"}, - {kPt2VsKstar, o2::framework::kTH2F, "hPt2VsKstar", "p_{T,2} vs k*; p_{T,2} (GeV/#it{c}); k* (GeV/#it{c})"}, - {kPt1VsKt, o2::framework::kTH2F, "hPt1VsKt", "p_{T,1} vs k_{T}; p_{T,1} (GeV/#it{c}); k_{T} (GeV/#it{c})"}, - {kPt2VsKt, o2::framework::kTH2F, "hPt2VsKt", "p_{T,2} vs k_{T}; p_{T,2} (GeV/#it{c}); k_{T} (GeV/#it{c})"}, - {kPt1VsMt, o2::framework::kTH2F, "hPt1VsMt", "p_{T,1} vs m_{T}; p_{T,1} (GeV/#it{c}); m_{T} (GeV/#it{c})"}, - {kPt2VsMt, o2::framework::kTH2F, "hPt2VsMt", "p_{T,2} vs m_{T}; p_{T,2} (GeV/#it{c}); m_{T} (GeV/#it{c})"}}}; + { + // 1D + {kKstar, o2::framework::kTH1F, "hKstar", "k*; k* (GeV/#it{c}); Entries"}, + {kKt, o2::framework::kTH1F, "hKt", "transverse momentum; k_{T} (GeV/#it{c}); Entries"}, + {kMt, o2::framework::kTH1F, "hMt", "transverse mass; m_{T} (GeV/#it{c}^{2}); Entries"}, + // 2D + {kPt1VsPt2, o2::framework::kTH2F, "hPt1VsPt2", "track1 p_{T} vs track2 p_{T}; track1 p_T (GeV/#it{c}); track2 p_{T} (GeV/#it{c})"}, + {kPt1VsKstar, o2::framework::kTH2F, "hPt1VsKstar", "p_{T,1} vs k*; p_{T,2} (GeV/#it{c}); k* (GeV/#it{c})"}, + {kPt2VsKstar, o2::framework::kTH2F, "hPt2VsKstar", "p_{T,2} vs k*; p_{T,2} (GeV/#it{c}); k* (GeV/#it{c})"}, + {kPt1VsKt, o2::framework::kTH2F, "hPt1VsKt", "p_{T,1} vs k_{T}; p_{T,1} (GeV/#it{c}); k_{T} (GeV/#it{c})"}, + {kPt2VsKt, o2::framework::kTH2F, "hPt2VsKt", "p_{T,2} vs k_{T}; p_{T,2} (GeV/#it{c}); k_{T} (GeV/#it{c})"}, + {kPt1VsMt, o2::framework::kTH2F, "hPt1VsMt", "p_{T,1} vs m_{T}; p_{T,1} (GeV/#it{c}); m_{T} (GeV/#it{c}^{2})"}, + {kPt2VsMt, o2::framework::kTH2F, "hPt2VsMt", "p_{T,2} vs m_{T}; p_{T,2} (GeV/#it{c}); m_{T} (GeV/#it{c}^{2})"}, + {kKstarVsKt, o2::framework::kTH2F, "hKstarVsKt", "k* vs k_{T}; k* (GeV/#it{c}); k_{T} (GeV/#it{c})"}, + {kKstarVsMt, o2::framework::kTH2F, "hKstarVsMt", "k* vs m_{T}; k* (GeV/#it{c}); m_{T} (GeV/#it{c}^{2})"}, + {kKstarVsCent, o2::framework::kTH2F, "hKstarVsCent", "k* vs Centrality (Mult. Percentile); k* (GeV/#it{c}); Centrality (%)"}, + {kKstarVsMult, o2::framework::kTH2F, "hKstarVsMult", "k* vs Multiplicity; k* (GeV/#it{c}); Multiplicity"}, + + // n-D + {kKstarVsMtVsMult, o2::framework::kTHnSparseF, "hKstarVsMtVsMult", "k* vs m_{T} vs multiplicity; k* (GeV/#it{c}); m_{T} (GeV/#it{c}^{2}); Multiplicity"}, + {kKstarVsMtVsMultVsCent, o2::framework::kTHnSparseF, "hKstarVsMtVsMultVsCent", "k* vs m_{T} vs multiplicity vs centrality; k* (GeV/#it{c}); m_{T} (GeV/#it{c}^{2}); Multiplicity; Centrality (%)"}, + {kKstarVsMtVsPt1VsP2VsMult, o2::framework::kTHnSparseF, "hKstarVsMtVsPt1VsPt2VsMult", "k* vs m_{T} vs p_{T,1} vs p_{T,2} vs multiplicity; k* (GeV/#it{c}); m_{T} (GeV/#it{c}^{2}); p_{T,1} (GeV/#it{c}); p_{T,2} (GeV/#it{c}); Multiplicity"}, + {kKstarVsMtVsPt1VsP2VsMultVsCent, o2::framework::kTHnSparseF, "hKstarVsMtVsPt1VsPt2VsMultVsCent", "k* vs m_{T} vs p_{T,1} vs p_{T,2} vs multiplicity vs centrality; k* (GeV/#it{c}); m_{T} (GeV/#it{c}^{2}); p_{T,1} (GeV/#it{c}); p_{T,2} (GeV/#it{c}); Multiplicity; Centrality"}, + + }}; template auto makePairHistSpecMap(const T1& confPairBinning, const T2& confObject1Binning, const T3& confObject2Binning) @@ -108,7 +141,17 @@ auto makePairHistSpecMap(const T1& confPairBinning, const T2& confObject1Binning {kPt1VsKt, {confObject1Binning.pt, confPairBinning.kt}}, {kPt2VsKt, {confObject2Binning.pt, confPairBinning.kt}}, {kPt1VsMt, {confObject1Binning.pt, confPairBinning.mt}}, - {kPt2VsMt, {confObject2Binning.pt, confPairBinning.mt}}}; + {kPt2VsMt, {confObject2Binning.pt, confPairBinning.mt}}, + {kKstarVsKt, {confPairBinning.kstar, confPairBinning.kt}}, + {kKstarVsMt, {confPairBinning.kstar, confPairBinning.mt}}, + {kKstarVsMult, {confPairBinning.kstar, confPairBinning.multiplicity}}, + {kKstarVsCent, {confPairBinning.kstar, confPairBinning.centrality}}, + + {kKstarVsMtVsMult, {confPairBinning.kstar, confPairBinning.mt, confPairBinning.multiplicity}}, + {kKstarVsMtVsMultVsCent, {confPairBinning.kstar, confPairBinning.mt, confPairBinning.multiplicity, confPairBinning.centrality}}, + {kKstarVsMtVsPt1VsP2VsMult, {confPairBinning.kstar, confPairBinning.mt, confObject1Binning.pt, confObject2Binning.pt, confPairBinning.multiplicity}}, + {kKstarVsMtVsPt1VsP2VsMultVsCent, {confPairBinning.kstar, confPairBinning.mt, confObject1Binning.pt, confObject2Binning.pt, confPairBinning.multiplicity, confPairBinning.centrality}}, + }; }; constexpr char PrefixTrackTrackSe[] = "TrackTrack/SE/"; @@ -139,24 +182,55 @@ template class PairHistManager { public: - /// Destructor - virtual ~PairHistManager() = default; - void init(o2::framework::HistogramRegistry* registry, std::map> Specs) + PairHistManager() = default; + ~PairHistManager() = default; + + template + void init(o2::framework::HistogramRegistry* registry, std::map> const& Specs, T const& ConfPairBinning) { mHistogramRegistry = registry; + mPlot1d = ConfPairBinning.plot1D.value; + mPlot2d = ConfPairBinning.plot2D.value; + mPlotKstarVsMtVsMult = ConfPairBinning.plotKstarVsMtVsMult.value; + mPlotKstarVsMtVsMultVsCent = ConfPairBinning.plotKstarVsMtVsMultVsCent.value; + mPlotKstarVsMtVsPt1VsP2VsMult = ConfPairBinning.plotKstarVsMtVsPt1VsP2VsMult.value; + mPlotKstarVsMtVsPt1VsP2VsMultVsCent = ConfPairBinning.plotKstarVsMtVsPt1VsP2VsMultVsCent.value; + if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { std::string analysisDir = std::string(prefix) + std::string(AnalysisDir); - - mHistogramRegistry->add(analysisDir + getHistNameV2(kKstar, HistTable), getHistDesc(kKstar, HistTable), getHistType(kKstar, HistTable), {Specs[kKstar]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kMt, HistTable), getHistDesc(kMt, HistTable), getHistType(kMt, HistTable), {Specs[kMt]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsPt2, HistTable), getHistDesc(kPt1VsPt2, HistTable), getHistType(kPt1VsPt2, HistTable), {Specs[kPt1VsPt2]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsKstar, HistTable), getHistDesc(kPt1VsKstar, HistTable), getHistType(kPt1VsKstar, HistTable), {Specs[kPt1VsKstar]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt2VsKstar, HistTable), getHistDesc(kPt2VsKstar, HistTable), getHistType(kPt2VsKstar, HistTable), {Specs[kPt2VsKstar]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsKt, HistTable), getHistDesc(kPt1VsKt, HistTable), getHistType(kPt1VsKt, HistTable), {Specs[kPt1VsKt]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt2VsKt, HistTable), getHistDesc(kPt2VsKt, HistTable), getHistType(kPt2VsKt, HistTable), {Specs[kPt2VsKt]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsMt, HistTable), getHistDesc(kPt1VsMt, HistTable), getHistType(kPt1VsMt, HistTable), {Specs[kPt1VsMt]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt2VsMt, HistTable), getHistDesc(kPt2VsMt, HistTable), getHistType(kPt2VsMt, HistTable), {Specs[kPt2VsMt]}); + if (mPlot1d) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstar, HistTable), getHistDesc(kKstar, HistTable), getHistType(kKstar, HistTable), {Specs.at(kKstar)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kKt, HistTable), getHistDesc(kKt, HistTable), getHistType(kKt, HistTable), {Specs.at(kKt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kMt, HistTable), getHistDesc(kMt, HistTable), getHistType(kMt, HistTable), {Specs.at(kMt)}); + } + if (mPlot2d) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsPt2, HistTable), getHistDesc(kPt1VsPt2, HistTable), getHistType(kPt1VsPt2, HistTable), {Specs.at(kPt1VsPt2)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsKstar, HistTable), getHistDesc(kPt1VsKstar, HistTable), getHistType(kPt1VsKstar, HistTable), {Specs.at(kPt1VsKstar)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt2VsKstar, HistTable), getHistDesc(kPt2VsKstar, HistTable), getHistType(kPt2VsKstar, HistTable), {Specs.at(kPt2VsKstar)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsKt, HistTable), getHistDesc(kPt1VsKt, HistTable), getHistType(kPt1VsKt, HistTable), {Specs.at(kPt1VsKt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt2VsKt, HistTable), getHistDesc(kPt2VsKt, HistTable), getHistType(kPt2VsKt, HistTable), {Specs.at(kPt2VsKt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsMt, HistTable), getHistDesc(kPt1VsMt, HistTable), getHistType(kPt1VsMt, HistTable), {Specs.at(kPt1VsMt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt2VsMt, HistTable), getHistDesc(kPt2VsMt, HistTable), getHistType(kPt2VsMt, HistTable), {Specs.at(kPt2VsMt)}); + + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsKt, HistTable), getHistDesc(kKstarVsKt, HistTable), getHistType(kKstarVsKt, HistTable), {Specs.at(kKstarVsKt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMt, HistTable), getHistDesc(kKstarVsMt, HistTable), getHistType(kKstarVsMt, HistTable), {Specs.at(kKstarVsMt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMult, HistTable), getHistDesc(kKstarVsMult, HistTable), getHistType(kKstarVsMult, HistTable), {Specs.at(kKstarVsMult)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsCent, HistTable), getHistDesc(kKstarVsCent, HistTable), getHistType(kKstarVsCent, HistTable), {Specs.at(kKstarVsCent)}); + } + + if (mPlotKstarVsMtVsMult) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMtVsMult, HistTable), getHistDesc(kKstarVsMtVsMult, HistTable), getHistType(kKstarVsMtVsMult, HistTable), {Specs.at(kKstarVsMtVsMult)}); + } + if (mPlotKstarVsMtVsMultVsCent) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMtVsMultVsCent, HistTable), getHistDesc(kKstarVsMtVsMultVsCent, HistTable), getHistType(kKstarVsMtVsMultVsCent, HistTable), {Specs.at(kKstarVsMtVsMultVsCent)}); + } + if (mPlotKstarVsMtVsPt1VsP2VsMult) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMtVsPt1VsP2VsMult, HistTable), getHistDesc(kKstarVsMtVsPt1VsP2VsMult, HistTable), getHistType(kKstarVsMtVsPt1VsP2VsMult, HistTable), {Specs.at(kKstarVsMtVsPt1VsP2VsMult)}); + } + if (mPlotKstarVsMtVsPt1VsP2VsMultVsCent) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMtVsPt1VsP2VsMultVsCent, HistTable), getHistDesc(kKstarVsMtVsPt1VsP2VsMultVsCent, HistTable), getHistType(kKstarVsMtVsPt1VsP2VsMultVsCent, HistTable), {Specs.at(kKstarVsMtVsPt1VsP2VsMultVsCent)}); + } } // if constexpr (isFlagSet(mode, modes::Mode::kQA)) { @@ -177,10 +251,14 @@ class PairHistManager mAbsCharge2 = std::abs(chargeAbsParticle2); } - template - void setPair(const T1& particle1, const T2& particle2) + template + void setPair(const T1& particle1, const T2& particle2, const T3& col) { - // pt in track stable is stored from 1/signedPt from the original track table + // set collision properties + mMult = col.mult(); + mCent = col.cent(); + + // pt in track table is calculated from 1/signedPt from the original track table // in case of He with Z=2, we have to rescale the pt with the absolute charge mParticle1 = ROOT::Math::PtEtaPhiMVector{mAbsCharge1 * particle1.pt(), particle1.eta(), particle1.phi(), mMass1}; mParticle2 = ROOT::Math::PtEtaPhiMVector{mAbsCharge2 * particle2.pt(), particle2.eta(), particle2.phi(), mMass2}; @@ -193,24 +271,48 @@ class PairHistManager float averageMass = (mMass1 + mMass2) / 2.f; mMt = std::hypot(mKt, averageMass); - // Boost Track1 to the pair rest frame and calculate k* - auto track1 = ROOT::Math::PxPyPzEVector(mParticle1); + // Boost particle to the pair rest frame (Prf) and calculate k* (would be equivalent using particle 2) + // make a copy of particle 1 + auto particle1Prf = ROOT::Math::PtEtaPhiMVector(mParticle1); + // get lorentz boost into pair rest frame ROOT::Math::Boost boostPrf(partSum.BoostToCM()); - mKstar = boostPrf(track1).P(); + // boost particle 1 into pair rest frame and calculate its momentum, which has the same value as k* + mKstar = boostPrf(particle1Prf).P(); } void fill() { if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstar, HistTable)), mKstar); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kMt, HistTable)), mMt); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsPt2, HistTable)), mParticle1.Pt(), mParticle2.Pt()); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsKstar, HistTable)), mParticle1.Pt(), mKstar); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsMt, HistTable)), mParticle1.Pt(), mMt); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsKt, HistTable)), mParticle1.Pt(), mKt); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt2VsKstar, HistTable)), mParticle2.Pt(), mKstar); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt2VsMt, HistTable)), mParticle2.Pt(), mMt); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt2VsKt, HistTable)), mParticle2.Pt(), mKt); + if (mPlot1d) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstar, HistTable)), mKstar); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kMt, HistTable)), mMt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKt, HistTable)), mKt); + } + if (mPlot2d) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsPt2, HistTable)), mParticle1.Pt(), mParticle2.Pt()); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsKstar, HistTable)), mParticle1.Pt(), mKstar); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsMt, HistTable)), mParticle1.Pt(), mMt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsKt, HistTable)), mParticle1.Pt(), mKt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt2VsKstar, HistTable)), mParticle2.Pt(), mKstar); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt2VsMt, HistTable)), mParticle2.Pt(), mMt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt2VsKt, HistTable)), mParticle2.Pt(), mKt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsKt, HistTable)), mKstar, mKt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMt, HistTable)), mKstar, mMt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMult, HistTable)), mKstar, mMult); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsCent, HistTable)), mKstar, mCent); + } + if (mPlotKstarVsMtVsMult) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMtVsMult, HistTable)), mKstar, mMt, mMult); + } + if (mPlotKstarVsMtVsMultVsCent) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMtVsMultVsCent, HistTable)), mKstar, mMt, mMult, mCent); + } + if (mPlotKstarVsMtVsPt1VsP2VsMult) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMtVsPt1VsP2VsMult, HistTable)), mKstar, mMt, mParticle1.Pt(), mParticle2.pt(), mMult); + } + if (mPlotKstarVsMtVsPt1VsP2VsMultVsCent) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMtVsPt1VsP2VsMultVsCent, HistTable)), mKstar, mMt, mParticle1.Pt(), mParticle2.pt(), mMult, mCent); + } } // if constexpr (isFlagSet(mode, modes::Mode::kQA)) { @@ -222,13 +324,23 @@ class PairHistManager o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; float mMass1 = 0.f; float mMass2 = 0.f; - float mAbsCharge1 = 1.f; - float mAbsCharge2 = 1.f; + int mAbsCharge1 = 1; + int mAbsCharge2 = 1; ROOT::Math::PtEtaPhiMVector mParticle1{}; ROOT::Math::PtEtaPhiMVector mParticle2{}; float mKstar = 0.f; float mKt = 0.f; float mMt = 0.f; + float mMult = 0.f; + float mCent = 0.f; + + // flags + bool mPlot1d = true; + bool mPlot2d = true; + bool mPlotKstarVsMtVsMult = false; + bool mPlotKstarVsMtVsMultVsCent = false; + bool mPlotKstarVsMtVsPt1VsP2VsMult = false; + bool mPlotKstarVsMtVsPt1VsP2VsMultVsCent = false; }; }; // namespace pairhistmanager diff --git a/PWGCF/Femto/Core/pairProcessHelpers.h b/PWGCF/Femto/Core/pairProcessHelpers.h index ebcc6ec969d..dbede67648d 100644 --- a/PWGCF/Femto/Core/pairProcessHelpers.h +++ b/PWGCF/Femto/Core/pairProcessHelpers.h @@ -34,13 +34,15 @@ template + typename T6, + typename T7> void processSameEvent(T1 const& SliceParticle, T2 const& TrackTable, - T3& ParticleHistManager, - T4& PairHistManager, - T5& CprManager, - T6& rng, + T3 const& Collision, + T4& ParticleHistManager, + T5& PairHistManager, + T6& CprManager, + T7& rng, bool randomize) { // Fill single particle histograms @@ -61,9 +63,9 @@ void processSameEvent(T1 const& SliceParticle, float threshold = 0.5f; bool swapPair = randomize ? (dist(rng) > threshold) : false; if (swapPair) { - PairHistManager.setPair(p2, p1); + PairHistManager.setPair(p2, p1, Collision); } else { - PairHistManager.setPair(p1, p2); + PairHistManager.setPair(p1, p2, Collision); } PairHistManager.fill(); } @@ -77,15 +79,17 @@ template + typename T8, + typename T9> void processSameEvent(T1 const& SliceParticle1, T2 const& SliceParticle2, T3 const& TrackTable, - T4& ParticleHistManager1, - T5& ParticleHistManager2, - T6& PairHistManager, - T7& CprManager, - T8& PcManager) + T4 const& Collision, + T5& ParticleHistManager1, + T6& ParticleHistManager2, + T7& PairHistManager, + T8& CprManager, + T9& PcManager) { // Fill single particle histograms for (auto const& part : SliceParticle1) { @@ -107,7 +111,7 @@ void processSameEvent(T1 const& SliceParticle1, } } CprManager.fill(); - PairHistManager.setPair(p1, p2); + PairHistManager.setPair(p1, p2, Collision); PairHistManager.fill(); } } @@ -155,7 +159,7 @@ void processMixedEvent(T1& Collisions, } } CprManager.fill(); - PairHistManager.setPair(p1, p2); + PairHistManager.setPair(p1, p2, collision1); PairHistManager.fill(); } } @@ -206,7 +210,7 @@ void processMixedEvent(T1& Collisions, } } CprManager.fill(); - PairHistManager.setPair(p1, p2); + PairHistManager.setPair(p1, p2, collision1); PairHistManager.fill(); } } diff --git a/PWGCF/Femto/Core/trackBuilder.h b/PWGCF/Femto/Core/trackBuilder.h index 6a343d2ebbb..7bcb977473e 100644 --- a/PWGCF/Femto/Core/trackBuilder.h +++ b/PWGCF/Femto/Core/trackBuilder.h @@ -259,8 +259,8 @@ const std::unordered_map trackSelsToString = { class TrackSelection : public BaseSelection { public: - TrackSelection() {} - virtual ~TrackSelection() = default; + TrackSelection() = default; + ~TrackSelection() = default; template void configure(T1& config, T2& filter) @@ -451,7 +451,7 @@ class TrackBuilder { public: TrackBuilder() = default; - virtual ~TrackBuilder() = default; + ~TrackBuilder() = default; template void init(T1& config, T2& filter, T3& table, T4& initContext) diff --git a/PWGCF/Femto/Core/trackHistManager.h b/PWGCF/Femto/Core/trackHistManager.h index 751ee660e9c..b5cf3dae112 100644 --- a/PWGCF/Femto/Core/trackHistManager.h +++ b/PWGCF/Femto/Core/trackHistManager.h @@ -44,6 +44,8 @@ enum TrackHist { kPhi, kSign, // qa variables + kPAtPv, + kPTpc, kItsCluster, kItsClusterIb, kTpcCrossedRows, @@ -150,7 +152,15 @@ using ConfKinkChaDauBinning = ConfTrackBinning; template struct ConfTrackQaBinning : o2::framework::ConfigurableGroup { std::string prefix = Prefix; - o2::framework::Configurable momentumType{"momentumType", 0, "Momentum on x-axis (0->Pt, 1->P at PV"}; + o2::framework::Configurable momentumType{"momentumType", static_cast(modes::MomentumType::kPAtPv), "Momentum on x-axis (0->Pt, 1->P at PV, 2->P at TPC inner wall)"}; + o2::framework::Configurable plot2d{"plot2d", true, "Generate various 2D QA plots"}; + o2::framework::Configurable plotElectronPid{"plotElectronPid", true, "Generate plots for Electron PID"}; + o2::framework::Configurable plotPionPid{"plotPionPid", true, "Generate plots for Pion PID"}; + o2::framework::Configurable plotKaonPid{"plotKaonPid", true, "Generate plots for Kaon PID"}; + o2::framework::Configurable plotProtonPid{"plotProtonPid", true, "Generate plots for Proton PID"}; + o2::framework::Configurable plotDeuteronPid{"plotDeuteronPid", true, "Generate plots for Deuteron PID"}; + o2::framework::Configurable plotTritonPid{"plotTritonPid", true, "Generate plots for Triton PID"}; + o2::framework::Configurable plotHeliumPid{"plotHeliumPid", true, "Generate plots for Helium PID"}; o2::framework::ConfigurableAxis itsCluster{"itsCluster", {{8, -0.5, 7.5}}, "ITS cluster"}; o2::framework::ConfigurableAxis itsClusterIb{"itsClusterIb", {{4, -0.5, 3.5}}, "ITS cluster in inner barrel"}; o2::framework::ConfigurableAxis tpcCrossedRows{"tpcCrossedRows", {{161, -0.5, 160.5}}, "TPC cluster"}; @@ -232,6 +242,8 @@ constexpr std::array, kTrackHistLast> HistTable {kEta, o2::framework::kTH1F, "hEta", "Pseudorapdity; #eta; Entries"}, {kPhi, o2::framework::kTH1F, "hPhi", "Azimuthal angle; #varphi; Entries"}, {kSign, o2::framework::kTH1F, "hSign", "Sign of charge ; Sign; Entries"}, + {kPAtPv, o2::framework::kTH1F, "hPAtPv", "Momentum at Primary vertex; p_{vertex}; Entries"}, + {kPTpc, o2::framework::kTH1F, "hPTpc", "Momentum at inner wall of TPC; p_{TPC}; Entries"}, {kItsCluster, o2::framework::kTH1F, "hItsCluster", "ITS cluster; ITS cluster; Entries"}, {kItsClusterIb, o2::framework::kTH1F, "hItsClusterIb", "ITS cluster in inner barrel; ITS IB cluster; Entries"}, {kTpcCrossedRows, o2::framework::kTH1F, "hTpcCrossedRows", "TPC crossed rows; TPC crossed rows; Entries"}, @@ -311,6 +323,8 @@ auto makeTrackQaHistSpecMap(const T1& confBinningAnalysis, const T2 confiBinning {kEta, {confBinningAnalysis.eta}}, {kPhi, {confBinningAnalysis.phi}}, {kSign, {confBinningAnalysis.sign}}, + {kPAtPv, {confiBinningQa.p}}, + {kPTpc, {confiBinningQa.p}}, {kItsCluster, {confiBinningQa.itsCluster}}, {kItsClusterIb, {confiBinningQa.itsClusterIb}}, {kPtVsEta, {confBinningAnalysis.pt, confBinningAnalysis.eta}}, @@ -411,122 +425,185 @@ template class TrackHistManager { public: - /// Destructor - virtual ~TrackHistManager() = default; + TrackHistManager() = default; + ~TrackHistManager() = default; - void init(o2::framework::HistogramRegistry* registry, std::map> Specs, int absCharge = 1, int momentumTypeForPid = 0) + void init(o2::framework::HistogramRegistry* registry, std::map> const& Specs, int AbsCharge = 1) { mHistogramRegistry = registry; - mAbsCharge = absCharge; // stored absolute charge of the track to scale the momentum in case of Z!=1 (case only for He3) - + mAbsCharge = std::abs(AbsCharge); if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { - std::string analysisDir = std::string(prefix) + std::string(AnalysisDir); - - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {Specs[kPt]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {Specs[kEta]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {Specs[kPhi]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {Specs[kSign]}); + initAnalysis(Specs); } - if constexpr (isFlagSet(mode, modes::Mode::kQa)) { + initQa(Specs); + } + } - std::string qaDir = std::string(prefix) + std::string(QaDir); - - mHistogramRegistry->add(qaDir + getHistNameV2(kItsCluster, HistTable), getHistDesc(kItsCluster, HistTable), getHistType(kItsCluster, HistTable), {Specs[kItsCluster]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kItsClusterIb, HistTable), getHistDesc(kItsClusterIb, HistTable), getHistType(kItsClusterIb, HistTable), {Specs[kItsClusterIb]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kTpcCrossedRows, HistTable), getHistDesc(kTpcCrossedRows, HistTable), getHistType(kTpcCrossedRows, HistTable), {Specs[kTpcCrossedRows]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kTpcCluster, HistTable), getHistDesc(kTpcCluster, HistTable), getHistType(kTpcCluster, HistTable), {Specs[kTpcCluster]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kTpcClusterOverCrossedRows, HistTable), getHistDesc(kTpcClusterOverCrossedRows, HistTable), getHistType(kTpcClusterOverCrossedRows, HistTable), {Specs[kTpcClusterOverCrossedRows]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kTpcClusterShared, HistTable), getHistDesc(kTpcClusterShared, HistTable), getHistType(kTpcClusterShared, HistTable), {Specs[kTpcClusterShared]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kTpcClusterFractionShared, HistTable), getHistDesc(kTpcClusterFractionShared, HistTable), getHistType(kTpcClusterFractionShared, HistTable), {Specs[kTpcClusterFractionShared]}); - - // qa 2d - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsEta, HistTable), getHistDesc(kPtVsEta, HistTable), getHistType(kPtVsEta, HistTable), {Specs[kPtVsEta]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPhi, HistTable), getHistDesc(kPtVsPhi, HistTable), getHistType(kPtVsPhi, HistTable), {Specs[kPtVsPhi]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPhiVsEta, HistTable), getHistDesc(kPhiVsEta, HistTable), getHistType(kPhiVsEta, HistTable), {Specs[kPhiVsEta]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsItsCluster, HistTable), getHistDesc(kPtVsItsCluster, HistTable), getHistType(kPtVsItsCluster, HistTable), {Specs[kPtVsItsCluster]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsTpcCluster, HistTable), getHistDesc(kPtVsTpcCluster, HistTable), getHistType(kPtVsTpcCluster, HistTable), {Specs[kPtVsTpcCluster]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsTpcCrossedRows, HistTable), getHistDesc(kPtVsTpcCrossedRows, HistTable), getHistType(kPtVsTpcCrossedRows, HistTable), {Specs[kPtVsTpcCrossedRows]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsTpcClusterOverCrossedRows, HistTable), getHistDesc(kPtVsTpcClusterOverCrossedRows, HistTable), getHistType(kPtVsTpcClusterOverCrossedRows, HistTable), {Specs[kPtVsTpcClusterOverCrossedRows]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsTpcClusterShared, HistTable), getHistDesc(kPtVsTpcClusterShared, HistTable), getHistType(kPtVsTpcClusterShared, HistTable), {Specs[kPtVsTpcClusterShared]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsTpcClusterFractionShared, HistTable), getHistDesc(kPtVsTpcClusterFractionShared, HistTable), getHistType(kPtVsTpcClusterFractionShared, HistTable), {Specs[kPtVsTpcClusterFractionShared]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kTpcClusterVsTpcCrossedRows, HistTable), getHistDesc(kTpcClusterVsTpcCrossedRows, HistTable), getHistType(kTpcClusterVsTpcCrossedRows, HistTable), {Specs[kTpcClusterVsTpcCrossedRows]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kTpcClusterVsTpcClusterShared, HistTable), getHistDesc(kTpcClusterVsTpcClusterShared, HistTable), getHistType(kTpcClusterVsTpcClusterShared, HistTable), {Specs[kTpcClusterVsTpcClusterShared]}); + template + void enableOptionalHistograms(T const& ConfBinningQa) + { + mPlot2d = ConfBinningQa.plot2d.value; + mPlotElectronPid = ConfBinningQa.plotElectronPid.value; + mPlotPionPid = ConfBinningQa.plotPionPid.value; + mPlotKaonPid = ConfBinningQa.plotKaonPid.value; + mPlotProtonPid = ConfBinningQa.plotProtonPid.value; + mPlotDeuteronPid = ConfBinningQa.plotDeuteronPid.value; + mPlotTritonPid = ConfBinningQa.plotTritonPid.value; + mPlotHeliumPid = ConfBinningQa.plotHeliumPid.value; + mMomentumType = static_cast(ConfBinningQa.momentumType.value); + } - // dca - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsDcaxy, HistTable), getHistDesc(kPtVsDcaxy, HistTable), getHistType(kPtVsDcaxy, HistTable), {Specs[kPtVsDcaxy]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsDcaz, HistTable), getHistDesc(kPtVsDcaz, HistTable), getHistType(kPtVsDcaz, HistTable), {Specs[kPtVsDcaz]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsDca, HistTable), getHistDesc(kPtVsDca, HistTable), getHistType(kPtVsDca, HistTable), {Specs[kPtVsDca]}); - - std::string pidDir = std::string(prefix) + std::string(PidDir); - - mMomentumType = static_cast(momentumTypeForPid); - - mHistogramRegistry->add(pidDir + getHistNameV2(kItsSignal, HistTable), getHistDesc(kItsSignal, HistTable), getHistType(kItsSignal, HistTable), {Specs[kItsSignal]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kItsElectron, HistTable), getHistDesc(kItsElectron, HistTable), getHistType(kItsElectron, HistTable), {Specs[kItsElectron]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kItsPion, HistTable), getHistDesc(kItsPion, HistTable), getHistType(kItsPion, HistTable), {Specs[kItsPion]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kItsKaon, HistTable), getHistDesc(kItsKaon, HistTable), getHistType(kItsKaon, HistTable), {Specs[kItsKaon]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kItsProton, HistTable), getHistDesc(kItsProton, HistTable), getHistType(kItsProton, HistTable), {Specs[kItsProton]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kItsDeuteron, HistTable), getHistDesc(kItsDeuteron, HistTable), getHistType(kItsDeuteron, HistTable), {Specs[kItsDeuteron]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kItsTriton, HistTable), getHistDesc(kItsTriton, HistTable), getHistType(kItsTriton, HistTable), {Specs[kItsTriton]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kItsHelium, HistTable), getHistDesc(kItsHelium, HistTable), getHistType(kItsHelium, HistTable), {Specs[kItsHelium]}); - - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcSignal, HistTable), getHistDesc(kTpcSignal, HistTable), getHistType(kTpcSignal, HistTable), {Specs[kTpcSignal]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcElectron, HistTable), getHistDesc(kTpcElectron, HistTable), getHistType(kTpcElectron, HistTable), {Specs[kTpcElectron]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcPion, HistTable), getHistDesc(kTpcPion, HistTable), getHistType(kTpcPion, HistTable), {Specs[kTpcPion]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcKaon, HistTable), getHistDesc(kTpcKaon, HistTable), getHistType(kTpcKaon, HistTable), {Specs[kTpcKaon]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcProton, HistTable), getHistDesc(kTpcProton, HistTable), getHistType(kTpcProton, HistTable), {Specs[kTpcProton]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcDeuteron, HistTable), getHistDesc(kTpcDeuteron, HistTable), getHistType(kTpcDeuteron, HistTable), {Specs[kTpcDeuteron]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcTriton, HistTable), getHistDesc(kTpcTriton, HistTable), getHistType(kTpcTriton, HistTable), {Specs[kTpcTriton]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcHelium, HistTable), getHistDesc(kTpcHelium, HistTable), getHistType(kTpcHelium, HistTable), {Specs[kTpcHelium]}); - - mHistogramRegistry->add(pidDir + getHistNameV2(kTofBeta, HistTable), getHistDesc(kTofBeta, HistTable), getHistType(kTofBeta, HistTable), {Specs[kTofBeta]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTofMass, HistTable), getHistDesc(kTofMass, HistTable), getHistType(kTofMass, HistTable), {Specs[kTofMass]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTofElectron, HistTable), getHistDesc(kTofElectron, HistTable), getHistType(kTofElectron, HistTable), {Specs[kTofElectron]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTofPion, HistTable), getHistDesc(kTofPion, HistTable), getHistType(kTofPion, HistTable), {Specs[kTofPion]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTofKaon, HistTable), getHistDesc(kTofKaon, HistTable), getHistType(kTofKaon, HistTable), {Specs[kTofKaon]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTofProton, HistTable), getHistDesc(kTofProton, HistTable), getHistType(kTofProton, HistTable), {Specs[kTofProton]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTofDeuteron, HistTable), getHistDesc(kTofDeuteron, HistTable), getHistType(kTofDeuteron, HistTable), {Specs[kTofDeuteron]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTofTriton, HistTable), getHistDesc(kTofTriton, HistTable), getHistType(kTofTriton, HistTable), {Specs[kTofTriton]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTofHelium, HistTable), getHistDesc(kTofHelium, HistTable), getHistType(kTofHelium, HistTable), {Specs[kTofHelium]}); - - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsElectron, HistTable), getHistDesc(kTpcitsElectron, HistTable), getHistType(kTpcitsElectron, HistTable), {Specs[kTpcitsElectron]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsPion, HistTable), getHistDesc(kTpcitsPion, HistTable), getHistType(kTpcitsPion, HistTable), {Specs[kTpcitsPion]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsKaon, HistTable), getHistDesc(kTpcitsKaon, HistTable), getHistType(kTpcitsKaon, HistTable), {Specs[kTpcitsKaon]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsProton, HistTable), getHistDesc(kTpcitsProton, HistTable), getHistType(kTpcitsProton, HistTable), {Specs[kTpcitsProton]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsDeuteron, HistTable), getHistDesc(kTpcitsDeuteron, HistTable), getHistType(kTpcitsDeuteron, HistTable), {Specs[kTpcitsDeuteron]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsTriton, HistTable), getHistDesc(kTpcitsTriton, HistTable), getHistType(kTpcitsTriton, HistTable), {Specs[kTpcitsTriton]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsHelium, HistTable), getHistDesc(kTpcitsHelium, HistTable), getHistType(kTpcitsHelium, HistTable), {Specs[kTpcitsHelium]}); - - mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofElectron, HistTable), getHistDesc(kTpctofElectron, HistTable), getHistType(kTpctofElectron, HistTable), {Specs[kTpctofElectron]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofPion, HistTable), getHistDesc(kTpctofPion, HistTable), getHistType(kTpctofPion, HistTable), {Specs[kTpctofPion]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofKaon, HistTable), getHistDesc(kTpctofKaon, HistTable), getHistType(kTpctofKaon, HistTable), {Specs[kTpctofKaon]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofProton, HistTable), getHistDesc(kTpctofProton, HistTable), getHistType(kTpctofProton, HistTable), {Specs[kTpctofProton]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofDeuteron, HistTable), getHistDesc(kTpctofDeuteron, HistTable), getHistType(kTpctofDeuteron, HistTable), {Specs[kTpctofDeuteron]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofTriton, HistTable), getHistDesc(kTpctofTriton, HistTable), getHistType(kTpctofTriton, HistTable), {Specs[kTpctofTriton]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofHelium, HistTable), getHistDesc(kTpctofHelium, HistTable), getHistType(kTpctofHelium, HistTable), {Specs[kTpctofHelium]}); - } + // special init function for Qa + // passing config group for qa so we can optionally enable histograms via falgsc + template + void init(o2::framework::HistogramRegistry* registry, std::map> const& Specs, T const& ConfBinningQa, int AbsCharge) + { + enableOptionalHistograms(ConfBinningQa); + init(registry, Specs, AbsCharge); } template void fill(T1 const& track, T2 const& /*trackTable*/) { if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt, HistTable)), mAbsCharge * track.pt()); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kEta, HistTable)), track.eta()); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPhi, HistTable)), track.phi()); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), track.sign()); + fillAnalysis(track); } - if constexpr (isFlagSet(mode, modes::Mode::kQa)) { - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kItsCluster, HistTable)), static_cast(track.itsNCls())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kItsClusterIb, HistTable)), static_cast(track.itsNClsInnerBarrel())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcCrossedRows, HistTable)), static_cast(track.tpcNClsCrossedRows())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcCluster, HistTable)), static_cast(track.tpcNClsFound())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcClusterOverCrossedRows, HistTable)), static_cast(track.tpcNClsFound()) / static_cast(track.tpcNClsCrossedRows())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcClusterShared, HistTable)), static_cast(track.tpcNClsShared())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcClusterFractionShared, HistTable)), track.tpcSharedOverFound()); + fillQa(track); + } + } + + private: + void initAnalysis(std::map> const& Specs) + { + std::string analysisDir = std::string(prefix) + std::string(AnalysisDir); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {Specs.at(kPt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {Specs.at(kEta)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {Specs.at(kPhi)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {Specs.at(kSign)}); + } + + void initQa(std::map> const& Specs) + { + std::string qaDir = std::string(prefix) + std::string(QaDir); + + mHistogramRegistry->add(qaDir + getHistNameV2(kPAtPv, HistTable), getHistDesc(kPAtPv, HistTable), getHistType(kPAtPv, HistTable), {Specs.at(kPAtPv)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPTpc, HistTable), getHistDesc(kPTpc, HistTable), getHistType(kPTpc, HistTable), {Specs.at(kPTpc)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kItsCluster, HistTable), getHistDesc(kItsCluster, HistTable), getHistType(kItsCluster, HistTable), {Specs.at(kItsCluster)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kItsClusterIb, HistTable), getHistDesc(kItsClusterIb, HistTable), getHistType(kItsClusterIb, HistTable), {Specs.at(kItsClusterIb)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTpcCrossedRows, HistTable), getHistDesc(kTpcCrossedRows, HistTable), getHistType(kTpcCrossedRows, HistTable), {Specs.at(kTpcCrossedRows)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTpcCluster, HistTable), getHistDesc(kTpcCluster, HistTable), getHistType(kTpcCluster, HistTable), {Specs.at(kTpcCluster)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTpcClusterOverCrossedRows, HistTable), getHistDesc(kTpcClusterOverCrossedRows, HistTable), getHistType(kTpcClusterOverCrossedRows, HistTable), {Specs.at(kTpcClusterOverCrossedRows)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTpcClusterShared, HistTable), getHistDesc(kTpcClusterShared, HistTable), getHistType(kTpcClusterShared, HistTable), {Specs.at(kTpcClusterShared)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTpcClusterFractionShared, HistTable), getHistDesc(kTpcClusterFractionShared, HistTable), getHistType(kTpcClusterFractionShared, HistTable), {Specs.at(kTpcClusterFractionShared)}); + + // qa 2d + if (mPlot2d) { + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsEta, HistTable), getHistDesc(kPtVsEta, HistTable), getHistType(kPtVsEta, HistTable), {Specs.at(kPtVsEta)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPhi, HistTable), getHistDesc(kPtVsPhi, HistTable), getHistType(kPtVsPhi, HistTable), {Specs.at(kPtVsPhi)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPhiVsEta, HistTable), getHistDesc(kPhiVsEta, HistTable), getHistType(kPhiVsEta, HistTable), {Specs.at(kPhiVsEta)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsItsCluster, HistTable), getHistDesc(kPtVsItsCluster, HistTable), getHistType(kPtVsItsCluster, HistTable), {Specs.at(kPtVsItsCluster)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsTpcCluster, HistTable), getHistDesc(kPtVsTpcCluster, HistTable), getHistType(kPtVsTpcCluster, HistTable), {Specs.at(kPtVsTpcCluster)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsTpcCrossedRows, HistTable), getHistDesc(kPtVsTpcCrossedRows, HistTable), getHistType(kPtVsTpcCrossedRows, HistTable), {Specs.at(kPtVsTpcCrossedRows)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsTpcClusterOverCrossedRows, HistTable), getHistDesc(kPtVsTpcClusterOverCrossedRows, HistTable), getHistType(kPtVsTpcClusterOverCrossedRows, HistTable), {Specs.at(kPtVsTpcClusterOverCrossedRows)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsTpcClusterShared, HistTable), getHistDesc(kPtVsTpcClusterShared, HistTable), getHistType(kPtVsTpcClusterShared, HistTable), {Specs.at(kPtVsTpcClusterShared)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsTpcClusterFractionShared, HistTable), getHistDesc(kPtVsTpcClusterFractionShared, HistTable), getHistType(kPtVsTpcClusterFractionShared, HistTable), {Specs.at(kPtVsTpcClusterFractionShared)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTpcClusterVsTpcCrossedRows, HistTable), getHistDesc(kTpcClusterVsTpcCrossedRows, HistTable), getHistType(kTpcClusterVsTpcCrossedRows, HistTable), {Specs.at(kTpcClusterVsTpcCrossedRows)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTpcClusterVsTpcClusterShared, HistTable), getHistDesc(kTpcClusterVsTpcClusterShared, HistTable), getHistType(kTpcClusterVsTpcClusterShared, HistTable), {Specs.at(kTpcClusterVsTpcClusterShared)}); + // dca + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsDcaxy, HistTable), getHistDesc(kPtVsDcaxy, HistTable), getHistType(kPtVsDcaxy, HistTable), {Specs.at(kPtVsDcaxy)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsDcaz, HistTable), getHistDesc(kPtVsDcaz, HistTable), getHistType(kPtVsDcaz, HistTable), {Specs.at(kPtVsDcaz)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsDca, HistTable), getHistDesc(kPtVsDca, HistTable), getHistType(kPtVsDca, HistTable), {Specs.at(kPtVsDca)}); + } + + std::string pidDir = std::string(prefix) + std::string(PidDir); + + mHistogramRegistry->add(pidDir + getHistNameV2(kItsSignal, HistTable), getHistDesc(kItsSignal, HistTable), getHistType(kItsSignal, HistTable), {Specs.at(kItsSignal)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcSignal, HistTable), getHistDesc(kTpcSignal, HistTable), getHistType(kTpcSignal, HistTable), {Specs.at(kTpcSignal)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTofBeta, HistTable), getHistDesc(kTofBeta, HistTable), getHistType(kTofBeta, HistTable), {Specs.at(kTofBeta)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTofMass, HistTable), getHistDesc(kTofMass, HistTable), getHistType(kTofMass, HistTable), {Specs.at(kTofMass)}); + + if (mPlotElectronPid) { + mHistogramRegistry->add(pidDir + getHistNameV2(kItsElectron, HistTable), getHistDesc(kItsElectron, HistTable), getHistType(kItsElectron, HistTable), {Specs.at(kItsElectron)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcElectron, HistTable), getHistDesc(kTpcElectron, HistTable), getHistType(kTpcElectron, HistTable), {Specs.at(kTpcElectron)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTofElectron, HistTable), getHistDesc(kTofElectron, HistTable), getHistType(kTofElectron, HistTable), {Specs.at(kTofElectron)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsElectron, HistTable), getHistDesc(kTpcitsElectron, HistTable), getHistType(kTpcitsElectron, HistTable), {Specs.at(kTpcitsElectron)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofElectron, HistTable), getHistDesc(kTpctofElectron, HistTable), getHistType(kTpctofElectron, HistTable), {Specs.at(kTpctofElectron)}); + } + + if (mPlotPionPid) { + mHistogramRegistry->add(pidDir + getHistNameV2(kItsPion, HistTable), getHistDesc(kItsPion, HistTable), getHistType(kItsPion, HistTable), {Specs.at(kItsPion)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcPion, HistTable), getHistDesc(kTpcPion, HistTable), getHistType(kTpcPion, HistTable), {Specs.at(kTpcPion)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTofPion, HistTable), getHistDesc(kTofPion, HistTable), getHistType(kTofPion, HistTable), {Specs.at(kTofPion)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsPion, HistTable), getHistDesc(kTpcitsPion, HistTable), getHistType(kTpcitsPion, HistTable), {Specs.at(kTpcitsPion)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofPion, HistTable), getHistDesc(kTpctofPion, HistTable), getHistType(kTpctofPion, HistTable), {Specs.at(kTpctofPion)}); + } + + if (mPlotKaonPid) { + mHistogramRegistry->add(pidDir + getHistNameV2(kItsKaon, HistTable), getHistDesc(kItsKaon, HistTable), getHistType(kItsKaon, HistTable), {Specs.at(kItsKaon)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcKaon, HistTable), getHistDesc(kTpcKaon, HistTable), getHistType(kTpcKaon, HistTable), {Specs.at(kTpcKaon)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTofKaon, HistTable), getHistDesc(kTofKaon, HistTable), getHistType(kTofKaon, HistTable), {Specs.at(kTofKaon)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsKaon, HistTable), getHistDesc(kTpcitsKaon, HistTable), getHistType(kTpcitsKaon, HistTable), {Specs.at(kTpcitsKaon)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofKaon, HistTable), getHistDesc(kTpctofKaon, HistTable), getHistType(kTpctofKaon, HistTable), {Specs.at(kTpctofKaon)}); + } + + if (mPlotProtonPid) { + mHistogramRegistry->add(pidDir + getHistNameV2(kItsProton, HistTable), getHistDesc(kItsProton, HistTable), getHistType(kItsProton, HistTable), {Specs.at(kItsProton)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcProton, HistTable), getHistDesc(kTpcProton, HistTable), getHistType(kTpcProton, HistTable), {Specs.at(kTpcProton)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTofProton, HistTable), getHistDesc(kTofProton, HistTable), getHistType(kTofProton, HistTable), {Specs.at(kTofProton)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsProton, HistTable), getHistDesc(kTpcitsProton, HistTable), getHistType(kTpcitsProton, HistTable), {Specs.at(kTpcitsProton)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofProton, HistTable), getHistDesc(kTpctofProton, HistTable), getHistType(kTpctofProton, HistTable), {Specs.at(kTpctofProton)}); + } + + if (mPlotDeuteronPid) { + mHistogramRegistry->add(pidDir + getHistNameV2(kItsDeuteron, HistTable), getHistDesc(kItsDeuteron, HistTable), getHistType(kItsDeuteron, HistTable), {Specs.at(kItsDeuteron)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcDeuteron, HistTable), getHistDesc(kTpcDeuteron, HistTable), getHistType(kTpcDeuteron, HistTable), {Specs.at(kTpcDeuteron)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTofDeuteron, HistTable), getHistDesc(kTofDeuteron, HistTable), getHistType(kTofDeuteron, HistTable), {Specs.at(kTofDeuteron)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsDeuteron, HistTable), getHistDesc(kTpcitsDeuteron, HistTable), getHistType(kTpcitsDeuteron, HistTable), {Specs.at(kTpcitsDeuteron)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofDeuteron, HistTable), getHistDesc(kTpctofDeuteron, HistTable), getHistType(kTpctofDeuteron, HistTable), {Specs.at(kTpctofDeuteron)}); + } + + if (mPlotTritonPid) { + mHistogramRegistry->add(pidDir + getHistNameV2(kItsTriton, HistTable), getHistDesc(kItsTriton, HistTable), getHistType(kItsTriton, HistTable), {Specs.at(kItsTriton)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcTriton, HistTable), getHistDesc(kTpcTriton, HistTable), getHistType(kTpcTriton, HistTable), {Specs.at(kTpcTriton)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTofTriton, HistTable), getHistDesc(kTofTriton, HistTable), getHistType(kTofTriton, HistTable), {Specs.at(kTofTriton)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsTriton, HistTable), getHistDesc(kTpcitsTriton, HistTable), getHistType(kTpcitsTriton, HistTable), {Specs.at(kTpcitsTriton)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofTriton, HistTable), getHistDesc(kTpctofTriton, HistTable), getHistType(kTpctofTriton, HistTable), {Specs.at(kTpctofTriton)}); + } + if (mPlotHeliumPid) { + mHistogramRegistry->add(pidDir + getHistNameV2(kItsHelium, HistTable), getHistDesc(kItsHelium, HistTable), getHistType(kItsHelium, HistTable), {Specs.at(kItsHelium)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcHelium, HistTable), getHistDesc(kTpcHelium, HistTable), getHistType(kTpcHelium, HistTable), {Specs.at(kTpcHelium)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTofHelium, HistTable), getHistDesc(kTofHelium, HistTable), getHistType(kTofHelium, HistTable), {Specs.at(kTofHelium)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsHelium, HistTable), getHistDesc(kTpcitsHelium, HistTable), getHistType(kTpcitsHelium, HistTable), {Specs.at(kTpcitsHelium)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofHelium, HistTable), getHistDesc(kTpctofHelium, HistTable), getHistType(kTpctofHelium, HistTable), {Specs.at(kTpctofHelium)}); + } + } + + template + void fillAnalysis(T const& track) + { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt, HistTable)), mAbsCharge * track.pt()); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kEta, HistTable)), track.eta()); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPhi, HistTable)), track.phi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), track.sign()); + } + + template + void fillQa(T const& track) + { + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPAtPv, HistTable)), track.p()); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPTpc, HistTable)), track.tpcInnerParam()); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kItsCluster, HistTable)), static_cast(track.itsNCls())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kItsClusterIb, HistTable)), static_cast(track.itsNClsInnerBarrel())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcCrossedRows, HistTable)), static_cast(track.tpcNClsCrossedRows())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcCluster, HistTable)), static_cast(track.tpcNClsFound())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcClusterOverCrossedRows, HistTable)), static_cast(track.tpcNClsFound()) / static_cast(track.tpcNClsCrossedRows())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcClusterShared, HistTable)), static_cast(track.tpcNClsShared())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcClusterFractionShared, HistTable)), track.tpcSharedOverFound()); + + if (mPlot2d) { mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsEta, HistTable)), mAbsCharge * track.pt(), track.eta()); mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsPhi, HistTable)), mAbsCharge * track.pt(), track.phi()); mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPhiVsEta, HistTable)), track.phi(), track.eta()); @@ -538,67 +615,95 @@ class TrackHistManager mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsTpcClusterFractionShared, HistTable)), mAbsCharge * track.pt(), static_cast(track.tpcNClsShared()) / static_cast(track.tpcNClsFound())); mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcClusterVsTpcCrossedRows, HistTable)), static_cast(track.tpcNClsFound()), static_cast(track.tpcNClsCrossedRows())); mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcClusterVsTpcClusterShared, HistTable)), static_cast(track.tpcNClsFound()), static_cast(track.tpcNClsShared())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsDcaxy, HistTable)), mAbsCharge * track.pt(), track.dcaXY()); mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsDcaz, HistTable)), mAbsCharge * track.pt(), track.dcaZ()); mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsDca, HistTable)), mAbsCharge * track.pt(), track.dca()); + } - float momentum = 0.f; - if (mMomentumType == modes::MomentumType::kPAtPv) { - momentum = mAbsCharge * track.p(); - } else if (mMomentumType == modes::MomentumType::kPt) { - momentum = mAbsCharge * track.pt(); - } + float momentum = 0.f; + if (mMomentumType == modes::MomentumType::kPt) { + momentum = mAbsCharge * track.p(); + } else if (mMomentumType == modes::MomentumType::kPAtPv) { + momentum = mAbsCharge * track.pt(); + } else if (mMomentumType == modes::MomentumType::kPTpc) { + momentum = track.tpcInnerParam(); + } else { + LOG(warn) << "Invalid momentum type for PID plots"; + momentum = 0; + } - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsSignal, HistTable)), momentum, o2::analysis::femto::utils::itsSignal(track)); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsElectron, HistTable)), momentum, track.itsNSigmaEl()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsPion, HistTable)), momentum, track.itsNSigmaPi()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsKaon, HistTable)), momentum, track.itsNSigmaKa()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsProton, HistTable)), momentum, track.itsNSigmaPr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsDeuteron, HistTable)), momentum, track.itsNSigmaDe()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsTriton, HistTable)), momentum, track.itsNSigmaTr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsHelium, HistTable)), momentum, track.itsNSigmaHe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsSignal, HistTable)), momentum, o2::analysis::femto::utils::itsSignal(track)); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcSignal, HistTable)), momentum, track.tpcSignal()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofBeta, HistTable)), momentum, track.tofBeta()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofMass, HistTable)), momentum, track.tofMass()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcSignal, HistTable)), momentum, track.tpcSignal()); + if (mPlotElectronPid) { + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsElectron, HistTable)), momentum, track.itsNSigmaEl()); mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcElectron, HistTable)), momentum, track.tpcNSigmaEl()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcPion, HistTable)), momentum, track.tpcNSigmaPi()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcKaon, HistTable)), momentum, track.tpcNSigmaKa()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcProton, HistTable)), momentum, track.tpcNSigmaPr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcDeuteron, HistTable)), momentum, track.tpcNSigmaDe()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcTriton, HistTable)), momentum, track.tpcNSigmaTr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcHelium, HistTable)), momentum, track.tpcNSigmaHe()); - - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofBeta, HistTable)), momentum, track.tofBeta()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofMass, HistTable)), momentum, track.tofMass()); mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofElectron, HistTable)), momentum, track.tofNSigmaEl()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofPion, HistTable)), momentum, track.tofNSigmaPi()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofKaon, HistTable)), momentum, track.tofNSigmaKa()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofProton, HistTable)), momentum, track.tofNSigmaPr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofDeuteron, HistTable)), momentum, track.tofNSigmaDe()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofTriton, HistTable)), momentum, track.tofNSigmaTr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofHelium, HistTable)), momentum, track.tofNSigmaHe()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsElectron, HistTable)), momentum, track.tpcitsNSigmaEl()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsPion, HistTable)), momentum, track.tpcitsNSigmaPi()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsKaon, HistTable)), momentum, track.tpcitsNSigmaKa()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsProton, HistTable)), momentum, track.tpcitsNSigmaPr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsDeuteron, HistTable)), momentum, track.tpcitsNSigmaDe()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsTriton, HistTable)), momentum, track.tpcitsNSigmaTr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsHelium, HistTable)), momentum, track.tpcitsNSigmaHe()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpctofElectron, HistTable)), momentum, track.tpctofNSigmaEl()); + } + + if (mPlotPionPid) { + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsPion, HistTable)), momentum, track.itsNSigmaPi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcPion, HistTable)), momentum, track.tpcNSigmaPi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofPion, HistTable)), momentum, track.tofNSigmaPi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsPion, HistTable)), momentum, track.tpcitsNSigmaPi()); mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpctofPion, HistTable)), momentum, track.tpctofNSigmaPi()); + } + + if (mPlotKaonPid) { + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsKaon, HistTable)), momentum, track.itsNSigmaKa()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcKaon, HistTable)), momentum, track.tpcNSigmaKa()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofKaon, HistTable)), momentum, track.tofNSigmaKa()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsKaon, HistTable)), momentum, track.tpcitsNSigmaKa()); mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpctofKaon, HistTable)), momentum, track.tpctofNSigmaKa()); + } + + if (mPlotProtonPid) { + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsProton, HistTable)), momentum, track.itsNSigmaPr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcProton, HistTable)), momentum, track.tpcNSigmaPr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofProton, HistTable)), momentum, track.tofNSigmaPr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsProton, HistTable)), momentum, track.tpcitsNSigmaPr()); mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpctofProton, HistTable)), momentum, track.tpctofNSigmaPr()); + } + + if (mPlotDeuteronPid) { + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsDeuteron, HistTable)), momentum, track.itsNSigmaDe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcDeuteron, HistTable)), momentum, track.tpcNSigmaDe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofDeuteron, HistTable)), momentum, track.tofNSigmaDe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsDeuteron, HistTable)), momentum, track.tpcitsNSigmaDe()); mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpctofDeuteron, HistTable)), momentum, track.tpctofNSigmaDe()); + } + + if (mPlotTritonPid) { + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsTriton, HistTable)), momentum, track.itsNSigmaTr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcTriton, HistTable)), momentum, track.tpcNSigmaTr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofTriton, HistTable)), momentum, track.tofNSigmaTr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsTriton, HistTable)), momentum, track.tpcitsNSigmaTr()); mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpctofTriton, HistTable)), momentum, track.tpctofNSigmaTr()); + } + + if (mPlotHeliumPid) { + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsHelium, HistTable)), momentum, track.itsNSigmaHe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcHelium, HistTable)), momentum, track.tpcNSigmaHe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofHelium, HistTable)), momentum, track.tofNSigmaHe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsHelium, HistTable)), momentum, track.tpcitsNSigmaHe()); mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpctofHelium, HistTable)), momentum, track.tpctofNSigmaHe()); } } - private: o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; - float mAbsCharge = 1; + int mAbsCharge = 1; + bool mPlot2d = false; + bool mPlotElectronPid = false; + bool mPlotPionPid = false; + bool mPlotKaonPid = false; + bool mPlotProtonPid = false; + bool mPlotDeuteronPid = false; + bool mPlotTritonPid = false; + bool mPlotHeliumPid = false; modes::MomentumType mMomentumType = modes::MomentumType::kPAtPv; }; }; // namespace trackhistmanager diff --git a/PWGCF/Femto/Core/twoTrackResonanceBuilder.h b/PWGCF/Femto/Core/twoTrackResonanceBuilder.h index 28d62a7c932..8086df4516e 100644 --- a/PWGCF/Femto/Core/twoTrackResonanceBuilder.h +++ b/PWGCF/Femto/Core/twoTrackResonanceBuilder.h @@ -229,8 +229,8 @@ template class TwoTrackResonanceSelection : public BaseSelection { public: - TwoTrackResonanceSelection() {} - virtual ~TwoTrackResonanceSelection() = default; + TwoTrackResonanceSelection() = default; + ~TwoTrackResonanceSelection() = default; template void configure(T1& config, T2& filter, T3& daughterFilter) diff --git a/PWGCF/Femto/Core/twoTrackResonanceHistManager.h b/PWGCF/Femto/Core/twoTrackResonanceHistManager.h index 895a3ba83c4..4852a0357a5 100644 --- a/PWGCF/Femto/Core/twoTrackResonanceHistManager.h +++ b/PWGCF/Femto/Core/twoTrackResonanceHistManager.h @@ -118,47 +118,48 @@ constexpr char PrefixKstar[] = "Kstar0/"; constexpr std::string_view AnalysisDir = "Kinematics/"; constexpr std::string_view QaDir = "QA/"; -/// \class FemtoDreamEventHisto -/// \brief Class for histogramming event properties -// template template class TwoTrackResonanceHistManager { public: - /// Destructor - virtual ~TwoTrackResonanceHistManager() = default; - /// Initializes histograms for the task - /// \param registry Histogram registry to be passed - /// + TwoTrackResonanceHistManager() = default; + ~TwoTrackResonanceHistManager() = default; + void init(o2::framework::HistogramRegistry* registry, - std::map> ResoSpecs, - std::map> PosDauSpecs, - std::map> NegDauSpecs) + std::map> const& ResoSpecs, + std::map> const& PosDauSpecs, + std::map> const& NegDauSpecs) { mHistogramRegistry = registry; mPosDauManager.init(registry, PosDauSpecs); mNegDauManager.init(registry, NegDauSpecs); - if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { - std::string analysisDir = std::string(resoPrefix) + std::string(AnalysisDir); - - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {ResoSpecs[kPt]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {ResoSpecs[kEta]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {ResoSpecs[kPhi]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kMass, HistTable), getHistDesc(kMass, HistTable), getHistType(kMass, HistTable), {ResoSpecs[kMass]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {ResoSpecs[kSign]}); + initAnalysis(ResoSpecs); } - if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { - std::string qaDir = std::string(resoPrefix) + std::string(QaDir); - - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsEta, HistTable), getHistDesc(kPtVsEta, HistTable), getHistType(kPtVsEta, HistTable), {ResoSpecs[kPtVsEta]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPhi, HistTable), getHistDesc(kPtVsPhi, HistTable), getHistType(kPtVsPhi, HistTable), {ResoSpecs[kPtVsPhi]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPhiVsEta, HistTable), getHistDesc(kPhiVsEta, HistTable), getHistType(kPhiVsEta, HistTable), {ResoSpecs[kPhiVsEta]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsMass, HistTable), getHistDesc(kPtVsMass, HistTable), getHistType(kPtVsMass, HistTable), {ResoSpecs[kPtVsMass]}); + initQa(ResoSpecs); } } + template + void enableOptionalHistograms(T1 const& PosDauConfBinningQa, T2 const& NegDauConfBinningQa) + { + mPosDauManager.enableOptionalHistograms(PosDauConfBinningQa); + mNegDauManager.enableOptionalHistograms(NegDauConfBinningQa); + } + + template + void init(o2::framework::HistogramRegistry* registry, + std::map> ResoSpecs, + std::map> PosDauSpecs, + T1 const& PosDauConfBinningQa, + std::map> NegDauSpecs, + T2 const& NegDauConfBinningQa) + { + enableOptionalHistograms(PosDauConfBinningQa, NegDauConfBinningQa); + init(registry, ResoSpecs, PosDauSpecs, NegDauSpecs); + } + template void fill(T1 const& resonance, T2 const& tracks) { @@ -169,32 +170,58 @@ class TwoTrackResonanceHistManager mPosDauManager.fill(posDaughter, tracks); auto negDaughter = tracks.rawIteratorAt(resonance.negDauId() - tracks.offset()); mNegDauManager.fill(negDaughter, tracks); - if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kPt, HistTable)), resonance.pt()); - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kEta, HistTable)), resonance.eta()); - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kPhi, HistTable)), resonance.phi()); - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kMass, HistTable)), resonance.mass()); - - if constexpr (modes::isEqual(reso, modes::TwoTrackResonance::kPhi) || modes::isEqual(reso, modes::TwoTrackResonance::kRho0)) { - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), 0); - } - if constexpr (modes::isEqual(reso, modes::TwoTrackResonance::kKstar0) || modes::isEqual(reso, modes::TwoTrackResonance::kKstar0Bar)) { - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), resonance.sign()); - } + fillAnalysis(resonance); } - if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(getHistName(kPtVsEta, HistTable)), resonance.pt(), resonance.eta()); - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(getHistName(kPtVsPhi, HistTable)), resonance.pt(), resonance.phi()); - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(getHistName(kPhiVsEta, HistTable)), resonance.phi(), resonance.eta()); - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(getHistName(kPtVsMass, HistTable)), resonance.pt(), resonance.mass()); + fillQa(resonance); } } private: - o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; + void initAnalysis(std::map> const& ResoSpecs) + { + std::string analysisDir = std::string(resoPrefix) + std::string(AnalysisDir); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {ResoSpecs.at(kPt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {ResoSpecs.at(kEta)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {ResoSpecs.at(kPhi)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kMass, HistTable), getHistDesc(kMass, HistTable), getHistType(kMass, HistTable), {ResoSpecs.at(kMass)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {ResoSpecs.at(kSign)}); + } + void initQa(std::map> const& ResoSpecs) + { + std::string qaDir = std::string(resoPrefix) + std::string(QaDir); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsEta, HistTable), getHistDesc(kPtVsEta, HistTable), getHistType(kPtVsEta, HistTable), {ResoSpecs.at(kPtVsEta)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPhi, HistTable), getHistDesc(kPtVsPhi, HistTable), getHistType(kPtVsPhi, HistTable), {ResoSpecs.at(kPtVsPhi)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPhiVsEta, HistTable), getHistDesc(kPhiVsEta, HistTable), getHistType(kPhiVsEta, HistTable), {ResoSpecs.at(kPhiVsEta)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsMass, HistTable), getHistDesc(kPtVsMass, HistTable), getHistType(kPtVsMass, HistTable), {ResoSpecs.at(kPtVsMass)}); + } + template + void fillAnalysis(T const& resonance) + { + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kPt, HistTable)), resonance.pt()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kEta, HistTable)), resonance.eta()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kPhi, HistTable)), resonance.phi()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kMass, HistTable)), resonance.mass()); + if constexpr (modes::isEqual(reso, modes::TwoTrackResonance::kPhi) || modes::isEqual(reso, modes::TwoTrackResonance::kRho0)) { + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), 0); + } + if constexpr (modes::isEqual(reso, modes::TwoTrackResonance::kKstar0) || modes::isEqual(reso, modes::TwoTrackResonance::kKstar0Bar)) { + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), resonance.sign()); + } + } + + template + void fillQa(T const& resonance) + { + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(getHistName(kPtVsEta, HistTable)), resonance.pt(), resonance.eta()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(getHistName(kPtVsPhi, HistTable)), resonance.pt(), resonance.phi()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(getHistName(kPhiVsEta, HistTable)), resonance.phi(), resonance.eta()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(getHistName(kPtVsMass, HistTable)), resonance.pt(), resonance.mass()); + } + + o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; trackhistmanager::TrackHistManager mPosDauManager; trackhistmanager::TrackHistManager mNegDauManager; }; diff --git a/PWGCF/Femto/Core/v0Builder.h b/PWGCF/Femto/Core/v0Builder.h index 7013e2c5722..b0a567643b9 100644 --- a/PWGCF/Femto/Core/v0Builder.h +++ b/PWGCF/Femto/Core/v0Builder.h @@ -177,8 +177,8 @@ template class V0Selection : public BaseSelection { public: - V0Selection() {} - virtual ~V0Selection() = default; + V0Selection() = default; + ~V0Selection() = default; template void configure(T1& config, T2& filter) diff --git a/PWGCF/Femto/Core/v0HistManager.h b/PWGCF/Femto/Core/v0HistManager.h index fe0cb31b04e..769210aa9b2 100644 --- a/PWGCF/Femto/Core/v0HistManager.h +++ b/PWGCF/Femto/Core/v0HistManager.h @@ -95,6 +95,7 @@ using ConfK0shortBinning1 = ConfK0shortBinning; template struct ConfV0QaBinning : o2::framework::ConfigurableGroup { std::string prefix = Prefix; + o2::framework::Configurable plot2d{"plot2d", true, "Generate various 2D QA plots"}; o2::framework::ConfigurableAxis cosPa{"cosPa", {{100, 0.9, 1}}, "Cosine of poiting angle"}; o2::framework::ConfigurableAxis dauDcaAtDecay{"dauDcaAtDecay", {{150, 0, 1.5}}, "Daughter DCA at decay vertex"}; o2::framework::ConfigurableAxis decayVertex{"decayVertex", {{100, 0, 100}}, "Decay vertex"}; @@ -204,58 +205,47 @@ template > V0Specs, - std::map> PosDauSpecs, - std::map> NegDauSpecs) + std::map> const& V0Specs, + std::map> const& PosDauSpecs, + std::map> const& NegDauSpecs) { mHistogramRegistry = registry; mPosDauManager.init(registry, PosDauSpecs); mNegDauManager.init(registry, NegDauSpecs); if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { - std::string analysisDir = std::string(v0Prefix) + std::string(AnalysisDir); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {V0Specs[kPt]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {V0Specs[kEta]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {V0Specs[kPhi]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kMass, HistTable), getHistDesc(kMass, HistTable), getHistType(kMass, HistTable), {V0Specs[kMass]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {V0Specs[kSign]}); + initAnalysis(V0Specs); } - if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { - std::string qaDir = std::string(v0Prefix) + std::string(QaDir); - - mHistogramRegistry->add(qaDir + getHistNameV2(kCosPa, HistTable), getHistDesc(kCosPa, HistTable), getHistType(kCosPa, HistTable), {V0Specs[kCosPa]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kDecayDauDca, HistTable), getHistDesc(kDecayDauDca, HistTable), getHistType(kDecayDauDca, HistTable), {V0Specs[kDecayDauDca]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxX, HistTable), getHistDesc(kDecayVtxX, HistTable), getHistType(kDecayVtxX, HistTable), {V0Specs[kDecayVtxX]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxY, HistTable), getHistDesc(kDecayVtxY, HistTable), getHistType(kDecayVtxY, HistTable), {V0Specs[kDecayVtxY]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxZ, HistTable), getHistDesc(kDecayVtxZ, HistTable), getHistType(kDecayVtxZ, HistTable), {V0Specs[kDecayVtxZ]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtx, HistTable), getHistDesc(kDecayVtx, HistTable), getHistType(kDecayVtx, HistTable), {V0Specs[kDecayVtx]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kTransRadius, HistTable), getHistDesc(kTransRadius, HistTable), getHistType(kTransRadius, HistTable), {V0Specs[kTransRadius]}); - - // qa 2d - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsEta, HistTable), getHistDesc(kPtVsEta, HistTable), getHistType(kPtVsEta, HistTable), {V0Specs[kPtVsEta]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPhi, HistTable), getHistDesc(kPtVsPhi, HistTable), getHistType(kPtVsPhi, HistTable), {V0Specs[kPtVsPhi]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPhiVsEta, HistTable), getHistDesc(kPhiVsEta, HistTable), getHistType(kPhiVsEta, HistTable), {V0Specs[kPhiVsEta]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsCosPa, HistTable), getHistDesc(kPtVsCosPa, HistTable), getHistType(kPtVsCosPa, HistTable), {V0Specs[kPtVsCosPa]}); - - mHistogramRegistry->add(qaDir + getHistNameV2(kMassLambda, HistTable), getHistDesc(kMassLambda, HistTable), getHistType(kMassLambda, HistTable), {V0Specs[kMassLambda]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kMassAntiLambda, HistTable), getHistDesc(kMassAntiLambda, HistTable), getHistType(kMassAntiLambda, HistTable), {V0Specs[kMassAntiLambda]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kMassK0short, HistTable), getHistDesc(kMassK0short, HistTable), getHistType(kMassK0short, HistTable), {V0Specs[kMassK0short]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsLambdaMass, HistTable), getHistDesc(kPtVsLambdaMass, HistTable), getHistType(kPtVsLambdaMass, HistTable), {V0Specs[kPtVsLambdaMass]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsAntiLambdaMass, HistTable), getHistDesc(kPtVsAntiLambdaMass, HistTable), getHistType(kPtVsAntiLambdaMass, HistTable), {V0Specs[kPtVsAntiLambdaMass]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsK0shortMass, HistTable), getHistDesc(kPtVsK0shortMass, HistTable), getHistType(kPtVsK0shortMass, HistTable), {V0Specs[kPtVsK0shortMass]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kLambdaMassVsAntiLambdaMass, HistTable), getHistDesc(kLambdaMassVsAntiLambdaMass, HistTable), getHistType(kLambdaMassVsAntiLambdaMass, HistTable), {V0Specs[kLambdaMassVsAntiLambdaMass]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kK0shortMassVsLambdaMass, HistTable), getHistDesc(kK0shortMassVsLambdaMass, HistTable), getHistType(kK0shortMassVsLambdaMass, HistTable), {V0Specs[kK0shortMassVsLambdaMass]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kK0shortMassVsAntiLambdaMass, HistTable), getHistDesc(kK0shortMassVsAntiLambdaMass, HistTable), getHistType(kK0shortMassVsAntiLambdaMass, HistTable), {V0Specs[kK0shortMassVsAntiLambdaMass]}); + initQa(V0Specs); } } + template + void enableOptionalHistograms(T1 const& V0ConfBinningQa, T2 const& PosDauConfBinningQa, T3 const& NegDauConfBinningQa) + { + mPosDauManager.enableOptionalHistograms(PosDauConfBinningQa); + mNegDauManager.enableOptionalHistograms(NegDauConfBinningQa); + mPlot2d = V0ConfBinningQa.plot2d.value; + } + + template + void init(o2::framework::HistogramRegistry* registry, + std::map> const& V0Specs, + T1 const& V0ConfBinningQa, + std::map> const& PosDauSpecs, + T2 const& PosDauConfBinningQa, + std::map> const& NegDauSpecs, + T3 const& NegDauConfBinningQa) + { + enableOptionalHistograms(V0ConfBinningQa, PosDauConfBinningQa, NegDauConfBinningQa); + init(registry, V0Specs, PosDauSpecs, NegDauSpecs); + } + template void fill(T1 const& v0candidate, T2 const& tracks) { @@ -268,27 +258,82 @@ class V0HistManager mNegDauManager.fill(negDaughter, tracks); if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt, HistTable)), v0candidate.pt()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kEta, HistTable)), v0candidate.eta()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kPhi, HistTable)), v0candidate.phi()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kMass, HistTable)), v0candidate.mass()); + fillAnalysis(v0candidate); + } + if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { + fillQa(v0candidate); + } + } - if constexpr (modes::isEqual(v0, modes::V0::kLambda) || modes::isEqual(v0, modes::V0::kAntiLambda)) { - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), v0candidate.sign()); - } - if constexpr (modes::isEqual(v0, modes::V0::kK0short)) { - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), 0); - } + private: + void initAnalysis(std::map> const& V0Specs) + { + std::string analysisDir = std::string(v0Prefix) + std::string(AnalysisDir); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {V0Specs.at(kPt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {V0Specs.at(kEta)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {V0Specs.at(kPhi)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kMass, HistTable), getHistDesc(kMass, HistTable), getHistType(kMass, HistTable), {V0Specs.at(kMass)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {V0Specs.at(kSign)}); + } + + void initQa(std::map> const& V0Specs) + { + std::string qaDir = std::string(v0Prefix) + std::string(QaDir); + + mHistogramRegistry->add(qaDir + getHistNameV2(kCosPa, HistTable), getHistDesc(kCosPa, HistTable), getHistType(kCosPa, HistTable), {V0Specs.at(kCosPa)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayDauDca, HistTable), getHistDesc(kDecayDauDca, HistTable), getHistType(kDecayDauDca, HistTable), {V0Specs.at(kDecayDauDca)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxX, HistTable), getHistDesc(kDecayVtxX, HistTable), getHistType(kDecayVtxX, HistTable), {V0Specs.at(kDecayVtxX)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxY, HistTable), getHistDesc(kDecayVtxY, HistTable), getHistType(kDecayVtxY, HistTable), {V0Specs.at(kDecayVtxY)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxZ, HistTable), getHistDesc(kDecayVtxZ, HistTable), getHistType(kDecayVtxZ, HistTable), {V0Specs.at(kDecayVtxZ)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtx, HistTable), getHistDesc(kDecayVtx, HistTable), getHistType(kDecayVtx, HistTable), {V0Specs.at(kDecayVtx)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTransRadius, HistTable), getHistDesc(kTransRadius, HistTable), getHistType(kTransRadius, HistTable), {V0Specs.at(kTransRadius)}); + + if (mPlot2d) { + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsEta, HistTable), getHistDesc(kPtVsEta, HistTable), getHistType(kPtVsEta, HistTable), {V0Specs.at(kPtVsEta)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPhi, HistTable), getHistDesc(kPtVsPhi, HistTable), getHistType(kPtVsPhi, HistTable), {V0Specs.at(kPtVsPhi)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPhiVsEta, HistTable), getHistDesc(kPhiVsEta, HistTable), getHistType(kPhiVsEta, HistTable), {V0Specs.at(kPhiVsEta)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsCosPa, HistTable), getHistDesc(kPtVsCosPa, HistTable), getHistType(kPtVsCosPa, HistTable), {V0Specs.at(kPtVsCosPa)}); + + mHistogramRegistry->add(qaDir + getHistNameV2(kMassLambda, HistTable), getHistDesc(kMassLambda, HistTable), getHistType(kMassLambda, HistTable), {V0Specs.at(kMassLambda)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kMassAntiLambda, HistTable), getHistDesc(kMassAntiLambda, HistTable), getHistType(kMassAntiLambda, HistTable), {V0Specs.at(kMassAntiLambda)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kMassK0short, HistTable), getHistDesc(kMassK0short, HistTable), getHistType(kMassK0short, HistTable), {V0Specs.at(kMassK0short)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsLambdaMass, HistTable), getHistDesc(kPtVsLambdaMass, HistTable), getHistType(kPtVsLambdaMass, HistTable), {V0Specs.at(kPtVsLambdaMass)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsAntiLambdaMass, HistTable), getHistDesc(kPtVsAntiLambdaMass, HistTable), getHistType(kPtVsAntiLambdaMass, HistTable), {V0Specs.at(kPtVsAntiLambdaMass)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsK0shortMass, HistTable), getHistDesc(kPtVsK0shortMass, HistTable), getHistType(kPtVsK0shortMass, HistTable), {V0Specs.at(kPtVsK0shortMass)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kLambdaMassVsAntiLambdaMass, HistTable), getHistDesc(kLambdaMassVsAntiLambdaMass, HistTable), getHistType(kLambdaMassVsAntiLambdaMass, HistTable), {V0Specs.at(kLambdaMassVsAntiLambdaMass)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kK0shortMassVsLambdaMass, HistTable), getHistDesc(kK0shortMassVsLambdaMass, HistTable), getHistType(kK0shortMassVsLambdaMass, HistTable), {V0Specs.at(kK0shortMassVsLambdaMass)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kK0shortMassVsAntiLambdaMass, HistTable), getHistDesc(kK0shortMassVsAntiLambdaMass, HistTable), getHistType(kK0shortMassVsAntiLambdaMass, HistTable), {V0Specs.at(kK0shortMassVsAntiLambdaMass)}); } + } - if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kCosPa, HistTable)), v0candidate.cosPa()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kDecayDauDca, HistTable)), v0candidate.dauDca()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxX, HistTable)), v0candidate.decayVtxX()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxY, HistTable)), v0candidate.decayVtxY()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxZ, HistTable)), v0candidate.decayVtxZ()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kDecayVtx, HistTable)), v0candidate.decayVtx()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kTransRadius, HistTable)), v0candidate.transRadius()); + template + void fillAnalysis(T const& v0candidate) + { + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt, HistTable)), v0candidate.pt()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kEta, HistTable)), v0candidate.eta()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kPhi, HistTable)), v0candidate.phi()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kMass, HistTable)), v0candidate.mass()); + + if constexpr (modes::isEqual(v0, modes::V0::kLambda) || modes::isEqual(v0, modes::V0::kAntiLambda)) { + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), v0candidate.sign()); + } + if constexpr (modes::isEqual(v0, modes::V0::kK0short)) { + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), 0); + } + } + + template + void fillQa(T const& v0candidate) + { + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kCosPa, HistTable)), v0candidate.cosPa()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kDecayDauDca, HistTable)), v0candidate.dauDca()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxX, HistTable)), v0candidate.decayVtxX()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxY, HistTable)), v0candidate.decayVtxY()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxZ, HistTable)), v0candidate.decayVtxZ()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kDecayVtx, HistTable)), v0candidate.decayVtx()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kTransRadius, HistTable)), v0candidate.transRadius()); + + if (mPlot2d) { mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kPtVsEta, HistTable)), v0candidate.pt(), v0candidate.eta()); mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kPtVsPhi, HistTable)), v0candidate.pt(), v0candidate.phi()); mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kPhiVsEta, HistTable)), v0candidate.phi(), v0candidate.eta()); @@ -328,9 +373,8 @@ class V0HistManager } } - private: o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; - + bool mPlot2d = true; trackhistmanager::TrackHistManager mPosDauManager; trackhistmanager::TrackHistManager mNegDauManager; }; diff --git a/PWGCF/Femto/Tasks/femtoCascadeQa.cxx b/PWGCF/Femto/Tasks/femtoCascadeQa.cxx index 4b953363dae..274e572c5bc 100644 --- a/PWGCF/Femto/Tasks/femtoCascadeQa.cxx +++ b/PWGCF/Femto/Tasks/femtoCascadeQa.cxx @@ -109,7 +109,7 @@ struct FemtoCascadeQa { { // create a map for histogram specs auto colHistSpec = colhistmanager::makeColQaHistSpecMap(confCollisionBinning, confCollisionQaBinning); - colHistManager.init(&hRegistry, colHistSpec); + colHistManager.init(&hRegistry, colHistSpec, confCollisionQaBinning); auto bachelorHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confBachelorBinning, confBachelorQaBinning); auto posDaughterHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confPosDaughterBinning, confPosDaughterQaBinning); @@ -121,12 +121,12 @@ struct FemtoCascadeQa { if (doprocessXis) { auto xiHistSpec = cascadehistmanager::makeCascadeQaHistSpecMap(confXiBinning, confXiQaBinning); - xiHistManager.init(&hRegistry, xiHistSpec, bachelorHistSpec, posDaughterHistSpec, negDaughterHistSpec); + xiHistManager.init(&hRegistry, xiHistSpec, confXiQaBinning, bachelorHistSpec, confBachelorQaBinning, posDaughterHistSpec, confPosDaughterQaBinning, negDaughterHistSpec, confNegDaughterQaBinning); } if (doprocessOmegas) { auto omegaHistSpec = cascadehistmanager::makeCascadeQaHistSpecMap(confOmegaBinning, confOmegaQaBinning); - omegaHistManager.init(&hRegistry, omegaHistSpec, bachelorHistSpec, posDaughterHistSpec, negDaughterHistSpec); + omegaHistManager.init(&hRegistry, omegaHistSpec, confOmegaQaBinning, bachelorHistSpec, confBachelorQaBinning, posDaughterHistSpec, confPosDaughterQaBinning, negDaughterHistSpec, confNegDaughterQaBinning); } }; diff --git a/PWGCF/Femto/Tasks/femtoKinkQa.cxx b/PWGCF/Femto/Tasks/femtoKinkQa.cxx index 2b900fa417d..6f19b159984 100644 --- a/PWGCF/Femto/Tasks/femtoKinkQa.cxx +++ b/PWGCF/Femto/Tasks/femtoKinkQa.cxx @@ -91,10 +91,10 @@ struct FemtoKinkQa { auto sigmaHistSpec = kinkhistmanager::makeKinkQaHistSpecMap(confSigmaBinning, confSigmaQaBinning); auto chaDauHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confKinkChaDaughterBinning, confKinkChaDaughterQaBinning); - sigmaHistManager.init(&hRegistry, sigmaHistSpec, chaDauHistSpec); + sigmaHistManager.init(&hRegistry, sigmaHistSpec, confSigmaQaBinning, chaDauHistSpec, confKinkChaDaughterQaBinning); auto collisionHistSpec = colhistmanager::makeColQaHistSpecMap(confCollisionBinning, confCollisionQaBinning); - colHistManager.init(&hRegistry, collisionHistSpec); + colHistManager.init(&hRegistry, collisionHistSpec, confCollisionQaBinning); }; // Process function for sigma particles from femto tables diff --git a/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx b/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx index ee7d9d5e409..a6b976bcb75 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx @@ -101,8 +101,12 @@ struct FemtoPairTrackCascade { trackhistmanager::PrefixCascadeNegDaughter, pairhistmanager::PrefixTrackCascadeSe, pairhistmanager::PrefixTrackCascadeMe, - closepairrejection::PrefixTrackCascadeSe, - closepairrejection::PrefixTrackCascadeMe, + closepairrejection::PrefixTrackCascadeBachelorSe, + closepairrejection::PrefixTrackV0SameChargeSe, + closepairrejection::PrefixTrackV0OppositeChargeSe, + closepairrejection::PrefixTrackCascadeBachelorMe, + closepairrejection::PrefixTrackV0SameChargeMe, + closepairrejection::PrefixTrackV0OppositeChargeMe, modes::Mode::kAnalysis, modes::Cascade::kXi> pairTrackXiBuilder; @@ -115,8 +119,12 @@ struct FemtoPairTrackCascade { trackhistmanager::PrefixCascadeNegDaughter, pairhistmanager::PrefixTrackCascadeSe, pairhistmanager::PrefixTrackCascadeMe, - closepairrejection::PrefixTrackCascadeSe, - closepairrejection::PrefixTrackCascadeMe, + closepairrejection::PrefixTrackCascadeBachelorSe, + closepairrejection::PrefixTrackV0SameChargeSe, + closepairrejection::PrefixTrackV0OppositeChargeSe, + closepairrejection::PrefixTrackCascadeBachelorMe, + closepairrejection::PrefixTrackV0SameChargeMe, + closepairrejection::PrefixTrackV0OppositeChargeMe, modes::Mode::kAnalysis, modes::Cascade::kOmega> pairTrackOmegaBuilder; @@ -133,7 +141,7 @@ struct FemtoPairTrackCascade { HistogramRegistry hRegistry{"FemtoTrackCascade", {}, OutputObjHandlingPolicy::AnalysisObject}; // setup cpr - closepairrejection::ConfCpr confCpr; + closepairrejection::ConfCprTrrackCascade confCpr; void init(InitContext&) { @@ -157,14 +165,14 @@ struct FemtoPairTrackCascade { if (doprocessXiSameEvent || doprocessXiMixedEvent) { auto xiHistSpec = cascadehistmanager::makeCascadeHistSpecMap(confXiBinning); auto pairTrackXiHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confXiBinning); - pairTrackXiBuilder.init(&hRegistry, trackSelection, xiSelection, confCpr, confMixing, colHistSpec, trackHistSpec, xiHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackXiHistSpec, cprHistSpec); + pairTrackXiBuilder.init(&hRegistry, trackSelection, xiSelection, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec, xiHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackXiHistSpec, cprHistSpec); } // setup for omegas if (doprocessOmegaSameEvent || doprocessOmegaMixedEvent) { auto omegaHistSpec = cascadehistmanager::makeCascadeHistSpecMap(confOmegaBinning); auto pairTrackOmegaHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confOmegaBinning); - pairTrackOmegaBuilder.init(&hRegistry, trackSelection, omegaSelection, confCpr, confMixing, colHistSpec, trackHistSpec, omegaHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackOmegaHistSpec, cprHistSpec); + pairTrackOmegaBuilder.init(&hRegistry, trackSelection, omegaSelection, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec, omegaHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackOmegaHistSpec, cprHistSpec); } if (((doprocessXiSameEvent || doprocessXiMixedEvent) + (doprocessOmegaSameEvent || doprocessOmegaMixedEvent)) > 1) { diff --git a/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx b/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx index d0fd689fe21..6c8af2f5bff 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx @@ -131,7 +131,7 @@ struct FemtoPairTrackKink { // if (doprocessSigmaSameEvent || doprocessSigmaMixedEvent) { if (doprocessSigmaSameEvent) { auto sigmaHistSpec = kinkhistmanager::makeKinkHistSpecMap(confSigmaBinning); - pairTrackSigmaBuilder.init(&hRegistry, trackSelection, sigmaSelection, confCpr, confMixing, colHistSpec, trackHistSpec, sigmaHistSpec, chaDauSpec, pairHistSpec, cprHistSpec); + pairTrackSigmaBuilder.init(&hRegistry, trackSelection, sigmaSelection, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec, sigmaHistSpec, chaDauSpec, pairHistSpec, cprHistSpec); } }; diff --git a/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx b/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx index 517478ed117..e905757ef85 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx @@ -114,7 +114,7 @@ struct FemtoPairTrackTrack { auto pairHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning1, confTrackBinning2); auto cprHistSpec = closepairrejection::makeCprHistSpecMap(confCpr); - pairTrackTrackBuilder.init(&hRegistry, trackSelections1, trackSelections2, confCpr, confMixing, colHistSpec, trackHistSpec1, trackHistSpec2, pairHistSpec, cprHistSpec); + pairTrackTrackBuilder.init(&hRegistry, trackSelections1, trackSelections2, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec1, trackHistSpec2, pairHistSpec, cprHistSpec); }; void processSameEvent(FilteredCollision const& col, Tracks const& tracks) diff --git a/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx b/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx index 73a340cde8a..16e773da509 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx @@ -107,8 +107,10 @@ struct FemtoPairTrackTwoTrackResonance { trackhistmanager::PrefixResonanceNegDaughter, pairhistmanager::PrefixTrackResonanceSe, pairhistmanager::PrefixTrackResonanceMe, - closepairrejection::PrefixTrackV0Se, - closepairrejection::PrefixTrackV0Me, + closepairrejection::PrefixTrackV0SameChargeSe, + closepairrejection::PrefixTrackV0SameChargeMe, + closepairrejection::PrefixTrackV0OppositeChargeSe, + closepairrejection::PrefixTrackV0OppositeChargeMe, modes::Mode::kAnalysis, modes::TwoTrackResonance::kPhi> pairTrackPhiBuilder; @@ -121,8 +123,10 @@ struct FemtoPairTrackTwoTrackResonance { trackhistmanager::PrefixResonanceNegDaughter, pairhistmanager::PrefixTrackResonanceSe, pairhistmanager::PrefixTrackResonanceMe, - closepairrejection::PrefixTrackV0Se, - closepairrejection::PrefixTrackV0Me, + closepairrejection::PrefixTrackV0SameChargeSe, + closepairrejection::PrefixTrackV0SameChargeMe, + closepairrejection::PrefixTrackV0OppositeChargeSe, + closepairrejection::PrefixTrackV0OppositeChargeMe, modes::Mode::kAnalysis, modes::TwoTrackResonance::kKstar0> pairTrackKstar0Builder; @@ -135,8 +139,10 @@ struct FemtoPairTrackTwoTrackResonance { trackhistmanager::PrefixResonanceNegDaughter, pairhistmanager::PrefixTrackResonanceSe, pairhistmanager::PrefixTrackResonanceMe, - closepairrejection::PrefixTrackV0Se, - closepairrejection::PrefixTrackV0Me, + closepairrejection::PrefixTrackV0SameChargeSe, + closepairrejection::PrefixTrackV0SameChargeMe, + closepairrejection::PrefixTrackV0OppositeChargeSe, + closepairrejection::PrefixTrackV0OppositeChargeMe, modes::Mode::kAnalysis, modes::TwoTrackResonance::kRho0> pairTrackRho0Builder; @@ -153,7 +159,7 @@ struct FemtoPairTrackTwoTrackResonance { HistogramRegistry hRegistry{"FemtoTrackTwoTrackResonance", {}, OutputObjHandlingPolicy::AnalysisObject}; // setup cpr - closepairrejection::ConfCpr confCpr; + closepairrejection::ConfCprTrackV0 confCpr; void init(InitContext&) { @@ -179,21 +185,21 @@ struct FemtoPairTrackTwoTrackResonance { if (doprocessPhiSameEvent || doprocessPhiMixedEvent) { auto phiHistSpec = twotrackresonancehistmanager::makeTwoTrackResonanceHistSpecMap(confPhiBinning); auto pairTrackPhiHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confPhiBinning); - pairTrackPhiBuilder.init(&hRegistry, trackSelection, phiSelection, confCpr, confMixing, colHistSpec, trackHistSpec, phiHistSpec, posDauSpec, negDauSpec, pairTrackPhiHistSpec, cprHistSpec); + pairTrackPhiBuilder.init(&hRegistry, trackSelection, phiSelection, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec, phiHistSpec, posDauSpec, negDauSpec, pairTrackPhiHistSpec, cprHistSpec); } // setup for kstar0 if (doprocessKstar0SameEvent || doprocessKstar0MixedEvent) { auto kstar0HistSpec = twotrackresonancehistmanager::makeTwoTrackResonanceHistSpecMap(confKstar0Binning); auto pairTrackKstar0HistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confKstar0Binning); - pairTrackKstar0Builder.init(&hRegistry, trackSelection, kstar0Selection, confCpr, confMixing, colHistSpec, trackHistSpec, kstar0HistSpec, posDauSpec, negDauSpec, pairTrackKstar0HistSpec, cprHistSpec); + pairTrackKstar0Builder.init(&hRegistry, trackSelection, kstar0Selection, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec, kstar0HistSpec, posDauSpec, negDauSpec, pairTrackKstar0HistSpec, cprHistSpec); } // setup for kstar0 if (doprocessRho0SameEvent || doprocessRho0MixedEvent) { auto rho0HistSpec = twotrackresonancehistmanager::makeTwoTrackResonanceHistSpecMap(confRho0Binning); auto pairTrackRho0HistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confRho0Binning); - pairTrackRho0Builder.init(&hRegistry, trackSelection, rho0Selection, confCpr, confMixing, colHistSpec, trackHistSpec, rho0HistSpec, posDauSpec, negDauSpec, pairTrackRho0HistSpec, cprHistSpec); + pairTrackRho0Builder.init(&hRegistry, trackSelection, rho0Selection, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec, rho0HistSpec, posDauSpec, negDauSpec, pairTrackRho0HistSpec, cprHistSpec); } }; diff --git a/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx b/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx index 64fcb671314..9b92a7959e4 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx @@ -99,8 +99,10 @@ struct FemtoPairTrackV0 { trackhistmanager::PrefixV0NegDaughter1, pairhistmanager::PrefixTrackV0Se, pairhistmanager::PrefixTrackV0Me, - closepairrejection::PrefixTrackV0Se, - closepairrejection::PrefixTrackV0Me, + closepairrejection::PrefixTrackV0SameChargeSe, + closepairrejection::PrefixTrackV0SameChargeMe, + closepairrejection::PrefixTrackV0OppositeChargeSe, + closepairrejection::PrefixTrackV0OppositeChargeMe, modes::Mode::kAnalysis, modes::V0::kLambda> pairTrackLambdaBuilder; @@ -112,8 +114,10 @@ struct FemtoPairTrackV0 { trackhistmanager::PrefixV0NegDaughter1, pairhistmanager::PrefixTrackV0Se, pairhistmanager::PrefixTrackV0Me, - closepairrejection::PrefixTrackV0Se, - closepairrejection::PrefixTrackV0Me, + closepairrejection::PrefixTrackV0SameChargeSe, + closepairrejection::PrefixTrackV0SameChargeMe, + closepairrejection::PrefixTrackV0OppositeChargeSe, + closepairrejection::PrefixTrackV0OppositeChargeMe, modes::Mode::kAnalysis, modes::V0::kK0short> pairTrackK0shortBuilder; @@ -130,7 +134,7 @@ struct FemtoPairTrackV0 { HistogramRegistry hRegistry{"FemtoTrackV0", {}, OutputObjHandlingPolicy::AnalysisObject}; // setup cpr - closepairrejection::ConfCpr confCpr; + closepairrejection::ConfCprTrackV0 confCpr; void init(InitContext&) { @@ -152,14 +156,14 @@ struct FemtoPairTrackV0 { if (doprocessLambdaSameEvent || doprocessLambdaMixedEvent) { auto lambdaHistSpec = v0histmanager::makeV0HistSpecMap(confLambdaBinning); auto pairTrackLambdaHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confLambdaBinning); - pairTrackLambdaBuilder.init(&hRegistry, trackSelection, lambdaSelection, confCpr, confMixing, colHistSpec, trackHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairTrackLambdaHistSpec, cprHistSpec); + pairTrackLambdaBuilder.init(&hRegistry, trackSelection, lambdaSelection, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairTrackLambdaHistSpec, cprHistSpec); } // setup for k0short if (doprocessK0shortSameEvent || doprocessK0shortMixedEvent) { auto k0shortHistSpec = v0histmanager::makeV0HistSpecMap(confK0shortBinning); auto pairTrackK0shortHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confLambdaBinning); - pairTrackK0shortBuilder.init(&hRegistry, trackSelection, lambdaSelection, confCpr, confMixing, colHistSpec, trackHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairTrackK0shortHistSpec, cprHistSpec); + pairTrackK0shortBuilder.init(&hRegistry, trackSelection, lambdaSelection, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairTrackK0shortHistSpec, cprHistSpec); } if (((doprocessLambdaSameEvent || doprocessLambdaMixedEvent) + (doprocessK0shortSameEvent || doprocessK0shortMixedEvent)) > 1) { diff --git a/PWGCF/Femto/Tasks/femtoPairV0V0.cxx b/PWGCF/Femto/Tasks/femtoPairV0V0.cxx index bda347ad110..61356c41aa7 100644 --- a/PWGCF/Femto/Tasks/femtoPairV0V0.cxx +++ b/PWGCF/Femto/Tasks/femtoPairV0V0.cxx @@ -134,7 +134,7 @@ struct FemtoPairV0V0 { HistogramRegistry hRegistry{"FemtoTrackV0", {}, OutputObjHandlingPolicy::AnalysisObject}; // setup cpr - closepairrejection::ConfCpr confCpr; + closepairrejection::ConfCprV0V0 confCpr; void init(InitContext&) { @@ -155,14 +155,14 @@ struct FemtoPairV0V0 { if (doprocessLambdaLambdaSameEvent || doprocessLambdaLambdaMixedEvent) { auto lambdaHistSpec = v0histmanager::makeV0HistSpecMap(confLambdaBinning); auto pairLambdaLambdaHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confLambdaBinning, confLambdaBinning); - pairLambdaLambdaBuilder.init(&hRegistry, lambdaSelection, lambdaSelection, confCpr, confMixing, colHistSpec, lambdaHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairLambdaLambdaHistSpec, cprHistSpec); + pairLambdaLambdaBuilder.init(&hRegistry, lambdaSelection, lambdaSelection, confCpr, confMixing, confPairBinning, colHistSpec, lambdaHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairLambdaLambdaHistSpec, cprHistSpec); } // setup for k0short if (doprocessK0shortK0shortSameEvent || doprocessK0shortK0shortMixedEvent) { auto k0shortHistSpec = v0histmanager::makeV0HistSpecMap(confK0shortBinning); auto pairLambdaLambdaHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confLambdaBinning, confLambdaBinning); - pairLambdaLambdaBuilder.init(&hRegistry, k0shortSelection, k0shortSelection, confCpr, confMixing, colHistSpec, k0shortHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairLambdaLambdaHistSpec, cprHistSpec); + pairLambdaLambdaBuilder.init(&hRegistry, k0shortSelection, k0shortSelection, confCpr, confMixing, confPairBinning, colHistSpec, k0shortHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairLambdaLambdaHistSpec, cprHistSpec); } if (((doprocessLambdaLambdaSameEvent || doprocessLambdaLambdaMixedEvent) + (doprocessK0shortK0shortSameEvent || doprocessK0shortK0shortMixedEvent)) > 1) { diff --git a/PWGCF/Femto/Tasks/femtoTrackQa.cxx b/PWGCF/Femto/Tasks/femtoTrackQa.cxx index d78679ccf1b..ddc9aeb4806 100644 --- a/PWGCF/Femto/Tasks/femtoTrackQa.cxx +++ b/PWGCF/Femto/Tasks/femtoTrackQa.cxx @@ -73,9 +73,9 @@ struct FemtoTrackQa { { // create a map for histogram specs auto colHistSpec = colhistmanager::makeColQaHistSpecMap(confCollisionBinning, confCollisionQaBinning); - colHistManager.init(&hRegistry, colHistSpec); + colHistManager.init(&hRegistry, colHistSpec, confCollisionQaBinning); auto trackHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confTrackBinning, confTrackQaBinning); - trackHistManager.init(&hRegistry, trackHistSpec, trackSelections.chargeAbs.value, confTrackQaBinning.momentumType.value); + trackHistManager.init(&hRegistry, trackHistSpec, confTrackQaBinning, trackSelections.chargeAbs.value); }; void process(FilteredFemtoCollision const& col, FemtoTracks const& tracks) diff --git a/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx b/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx index c92d6537170..501312fb3f0 100644 --- a/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx +++ b/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx @@ -118,7 +118,7 @@ struct FemtoTwotrackresonanceQa { { // create a map for histogram specs auto colHistSpec = colhistmanager::makeColQaHistSpecMap(confCollisionBinning, confCollisionQaBinning); - colHistManager.init(&hRegistry, colHistSpec); + colHistManager.init(&hRegistry, colHistSpec, confCollisionQaBinning); auto posDaughterHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confPosDaughterBinning, confPosDaughterQaBinning); auto negDaughterHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confNegDaughterBinning, confNegDaughterQaBinning); @@ -129,16 +129,16 @@ struct FemtoTwotrackresonanceQa { if (doprocessPhis) { auto phiHistSpec = twotrackresonancehistmanager::makeTwoTrackResonanceQaHistSpecMap(confPhiBinning); - phiHistManager.init(&hRegistry, phiHistSpec, posDaughterHistSpec, negDaughterHistSpec); + phiHistManager.init(&hRegistry, phiHistSpec, posDaughterHistSpec, confPosDaughterQaBinning, negDaughterHistSpec, confNegDaughterQaBinning); } if (doprocessRho0s) { auto rho0HistSpec = twotrackresonancehistmanager::makeTwoTrackResonanceQaHistSpecMap(confRho0Binning); - rho0HistManager.init(&hRegistry, rho0HistSpec, posDaughterHistSpec, negDaughterHistSpec); + rho0HistManager.init(&hRegistry, rho0HistSpec, posDaughterHistSpec, confPosDaughterQaBinning, negDaughterHistSpec, confNegDaughterQaBinning); } if (doprocessKstar0s) { auto kstar0HistSpec = twotrackresonancehistmanager::makeTwoTrackResonanceQaHistSpecMap(confKstar0Binning); - kstar0HistManager.init(&hRegistry, kstar0HistSpec, posDaughterHistSpec, negDaughterHistSpec); + kstar0HistManager.init(&hRegistry, kstar0HistSpec, posDaughterHistSpec, confPosDaughterQaBinning, negDaughterHistSpec, confNegDaughterQaBinning); } }; diff --git a/PWGCF/Femto/Tasks/femtoV0Qa.cxx b/PWGCF/Femto/Tasks/femtoV0Qa.cxx index 1249664fa4c..20f6f1d0d0e 100644 --- a/PWGCF/Femto/Tasks/femtoV0Qa.cxx +++ b/PWGCF/Femto/Tasks/femtoV0Qa.cxx @@ -106,7 +106,7 @@ struct FemtoV0Qa { { // create a map for histogram specs auto colHistSpec = colhistmanager::makeColQaHistSpecMap(confCollisionBinning, confCollisionQaBinning); - colHistManager.init(&hRegistry, colHistSpec); + colHistManager.init(&hRegistry, colHistSpec, confCollisionQaBinning); auto posDaughterHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confV0PosDaughterBinning, confV0PosDaughterQaBinning); auto negDaughterHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confV0NegDaughterBinning, confV0NegDaughterQaBinning); @@ -117,12 +117,12 @@ struct FemtoV0Qa { if (doprocessLambda) { auto lambdaHistSpec = v0histmanager::makeV0QaHistSpecMap(confLambdaBinning, confLambdaQaBinning); - lambdaHistManager.init(&hRegistry, lambdaHistSpec, posDaughterHistSpec, negDaughterHistSpec); + lambdaHistManager.init(&hRegistry, lambdaHistSpec, confLambdaQaBinning, posDaughterHistSpec, confV0PosDaughterQaBinning, negDaughterHistSpec, confV0NegDaughterQaBinning); } if (doprocessK0short) { auto k0shortHistSpec = v0histmanager::makeV0QaHistSpecMap(confK0shortBinning, confK0shortQaBinning); - k0shortHistManager.init(&hRegistry, k0shortHistSpec, posDaughterHistSpec, negDaughterHistSpec); + k0shortHistManager.init(&hRegistry, k0shortHistSpec, confK0shortQaBinning, posDaughterHistSpec, confV0PosDaughterQaBinning, negDaughterHistSpec, confV0NegDaughterQaBinning); } }; From 48e1f2107d4436c42b30bfb52547811c27c6ae3b Mon Sep 17 00:00:00 2001 From: alcaliva <32872606+alcaliva@users.noreply.github.com> Date: Tue, 28 Oct 2025 08:23:04 +0100 Subject: [PATCH 921/986] [PWGLF] enable reweighting for analysis in jet (#13565) --- PWGLF/Tasks/Nuspex/antinucleiInJets.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx index 4e3d108d84a..4e7c54bd2b7 100644 --- a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx +++ b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx @@ -204,7 +204,7 @@ struct AntinucleiInJets { } // Load reweighting histograms from CCDB if antinuclei efficiency processing is enabled - if (doprocessAntinucleiEfficiency) { + if (doprocessAntinucleiEfficiency || doprocessJetsMCgen || doprocessJetsMCrec) { ccdb->setURL(urlToCcdb.value); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); From 68dc3e4f1918f5374c9ccb444178093386e2e2e6 Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Tue, 28 Oct 2025 10:59:36 +0100 Subject: [PATCH 922/986] [PWGLF] Improved pairing of phi meson and optimized PID (#13567) --- PWGLF/Tasks/Resonances/doublephimeson.cxx | 326 ++++++++++++---------- 1 file changed, 181 insertions(+), 145 deletions(-) diff --git a/PWGLF/Tasks/Resonances/doublephimeson.cxx b/PWGLF/Tasks/Resonances/doublephimeson.cxx index c9108099e5b..64b3d5a9b54 100644 --- a/PWGLF/Tasks/Resonances/doublephimeson.cxx +++ b/PWGLF/Tasks/Resonances/doublephimeson.cxx @@ -77,6 +77,8 @@ struct doublephimeson { ConfigurableAxis configThnAxisDeltaR{"configThnAxisDeltaR", {200, 0.0, 2.0}, "#it{k}^{*} (GeV/#it{c})"}; ConfigurableAxis configThnAxisCosTheta{"configThnAxisCosTheta", {160, 0.0, 3.2}, "cos #theta{*}"}; ConfigurableAxis configThnAxisNumPhi{"configThnAxisNumPhi", {101, -0.5, 100.5}, "cos #theta{*}"}; + ConfigurableAxis configThnAxisDeltaPt{"configThnAxisDeltaPt", {100, 0.0, 1.0}, "delta pt"}; + Configurable maxDeltaMPhi{"maxDeltaMPhi", 0.01f, "Delta-m cut on the two phi masses: sqrt((m1-mPDG)^2 + (m2-mPDG)^2) < maxDeltaMPhi (GeV/c^2)"}; // Initialize the ananlysis task void init(o2::framework::InitContext&) @@ -95,15 +97,16 @@ struct doublephimeson { histos.add("hDeltaRkaonplus", "hDeltaRkaonplus", kTH1F, {{800, 0.0, 8.0}}); histos.add("hDeltaRkaonminus", "hDeltaRkaonminus", kTH1F, {{800, 0.0, 8.0}}); + const AxisSpec thnAxisdeltapt{configThnAxisDeltaPt, "Delta pt"}; const AxisSpec thnAxisInvMass{configThnAxisInvMass, "#it{M} (GeV/#it{c}^{2})"}; + const AxisSpec thnAxisPt{configThnAxisPt, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec thnAxisInvMassPhi{configThnAxisInvMassPhi, "#it{M} (GeV/#it{c}^{2})"}; const AxisSpec thnAxisInvMassDeltaPhi{configThnAxisInvMassDeltaPhi, "#it{M} (GeV/#it{c}^{2})"}; - const AxisSpec thnAxisPt{configThnAxisPt, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec thnAxisDeltaR{configThnAxisDeltaR, "#Delta R)"}; const AxisSpec thnAxisCosTheta{configThnAxisCosTheta, "cos #theta"}; const AxisSpec thnAxisNumPhi{configThnAxisNumPhi, "Number of phi meson"}; - histos.add("SEMassUnlike", "SEMassUnlike", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisDeltaR, thnAxisInvMassDeltaPhi, thnAxisNumPhi}); + histos.add("SEMassUnlike", "SEMassUnlike", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisdeltapt, thnAxisPt, thnAxisDeltaR, thnAxisInvMassDeltaPhi, thnAxisNumPhi}); // histos.add("SEMassLike", "SEMassLike", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisDeltaR, thnAxisInvMassPhi, thnAxisInvMassPhi, thnAxisNumPhi}); histos.add("MEMassUnlike", "MEMassUnlike", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisDeltaR, thnAxisInvMassDeltaPhi}); } @@ -179,6 +182,92 @@ struct doublephimeson { bool selectionPID(float nsigmaTPC, float nsigmaTOF, int TOFHit, int PIDStrategy, float ptcand) { + + if (PIDStrategy == 100) { + if (ptcand < 1.2) { + if (TOFHit == 1 && std::sqrt(nsigmaTOF * nsigmaTOF + nsigmaTPC * nsigmaTPC) < 2.5) { + return true; + } else if (TOFHit != 1) { + if (ptcand < 0.5 && nsigmaTPC > -2.0 && nsigmaTPC < 2.5) { + return true; + } + if (ptcand >= 0.5 && ptcand < 0.6 && nsigmaTPC > -1.5 && nsigmaTPC < 2.5) { + return true; + } + if (ptcand >= 0.6 && ptcand < 0.7 && nsigmaTPC > -1.0 && nsigmaTPC < 2.0) { + return true; + } + if (ptcand >= 0.7 && ptcand < 0.8 && nsigmaTPC > -0.4 && nsigmaTPC < 2.0) { + return true; + } + if (ptcand >= 0.8 && ptcand < 1.0 && nsigmaTPC > 0.0 && nsigmaTPC < 2.0) { + return true; + } + if (ptcand >= 1.0 && ptcand < 1.2 && nsigmaTPC > -2.5 && nsigmaTPC < 0.5) { + return true; + } + } + } else { + if (TOFHit == 1 && std::sqrt(nsigmaTOF * nsigmaTOF + nsigmaTPC * nsigmaTPC) < 2.0) { + return true; + } else if (TOFHit != 1 && nsigmaTPC > -2.5 && nsigmaTPC < 1.0) { + return true; + } + } + } + + if (PIDStrategy == 101) { + if (ptcand < 1.0) { + if (TOFHit == 1 && std::sqrt(nsigmaTOF * nsigmaTOF + nsigmaTPC * nsigmaTPC) < 2.5) { + return true; + } else if (TOFHit != 1) { + if (ptcand < 0.5 && nsigmaTPC > -2.0 && nsigmaTPC < 2.5) { + return true; + } + if (ptcand >= 0.5 && ptcand < 0.6 && nsigmaTPC > -1.5 && nsigmaTPC < 2.5) { + return true; + } + if (ptcand >= 0.6 && ptcand < 0.7 && nsigmaTPC > -1.0 && nsigmaTPC < 2.0) { + return true; + } + if (ptcand >= 0.7 && ptcand < 0.8 && nsigmaTPC > -0.4 && nsigmaTPC < 2.0) { + return true; + } + if (ptcand >= 0.8 && ptcand < 1.0 && nsigmaTPC > 0.0 && nsigmaTPC < 2.0) { + return true; + } + } + } else if (ptcand >= 1.0 && ptcand < 2.0 && TOFHit == 1 && std::sqrt(nsigmaTOF * nsigmaTOF + nsigmaTPC * nsigmaTPC) < 2.5) { + return true; + } else if (ptcand > 2.0) { + if (TOFHit == 1 && std::sqrt(nsigmaTOF * nsigmaTOF + nsigmaTPC * nsigmaTPC) < 2.0) { + return true; + } else if (TOFHit != 1 && nsigmaTPC > -2.5 && nsigmaTPC < 1.0) { + return true; + } + } + } + + if (PIDStrategy == 102) { + if (TOFHit != 1) { + if (ptcand < 0.5 && nsigmaTPC > -2.0 && nsigmaTPC < 2.5) { + return true; + } + if (ptcand >= 0.5 && ptcand < 0.6 && nsigmaTPC > -1.5 && nsigmaTPC < 2.5) { + return true; + } + if (ptcand >= 0.6 && ptcand < 0.7 && nsigmaTPC > -1.0 && nsigmaTPC < 2.0) { + return true; + } + if (ptcand >= 2.2 && nsigmaTPC > -2.5 && nsigmaTPC < 1.0) { + return true; + } + } + if (TOFHit == 1 && ptcand > 0.4 && std::sqrt(nsigmaTOF * nsigmaTOF + nsigmaTPC * nsigmaTPC) < 2.0) { + return true; + } + } + // optimized TPC TOF if (PIDStrategy == 0) { if (ptcand < 0.4) { @@ -428,10 +517,10 @@ struct doublephimeson { continue; } if (!isDeep) { - histos.fill(HIST("SEMassUnlike"), exotic.M(), exotic.Pt(), deltaR, deltam, phimult); + histos.fill(HIST("SEMassUnlike"), exotic.M(), std::abs(Phid1.Pt() - Phid2.Pt()) / exotic.Pt(), exotic.Pt(), deltaR, deltam, phimult); } if (isDeep) { - histos.fill(HIST("SEMassUnlike"), exotic.M(), exotic.Pt(), deltaR, deltam, phimult); + histos.fill(HIST("SEMassUnlike"), exotic.M(), std::abs(Phid1.Pt() - Phid2.Pt()) / exotic.Pt(), exotic.Pt(), deltaR, deltam, phimult); } } } @@ -609,13 +698,13 @@ struct doublephimeson { (d4trackid.at(i5) == d3trackid.at(i6) || d4trackid.at(i5) == d4trackid.at(i6))) { if (deltam2 < deltam1 && deltaRkaonplus2 > daughterDeltaR && deltaRkaonminus2 > daughterDeltaR) { - histos.fill(HIST("SEMassUnlike"), exotic2.M(), exotic2.Pt(), deltaR2, deltam2, phimult); + histos.fill(HIST("SEMassUnlike"), exotic2.M(), std::abs(exotic2phi1.Pt() - exotic2phi2.Pt()) / exotic2.Pt(), exotic2.Pt(), deltaR2, deltam2, phimult); // LOGF(info, "Fill exotic Id %d which is pair of Id %d", i6, i5); } else { - histos.fill(HIST("SEMassUnlike"), exotic1.M(), exotic1.Pt(), deltaR1, deltam1, phimult); + histos.fill(HIST("SEMassUnlike"), exotic1.M(), std::abs(exotic2phi1.Pt() - exotic2phi2.Pt()) / exotic1.Pt(), exotic1.Pt(), deltaR1, deltam1, phimult); } } else { - histos.fill(HIST("SEMassUnlike"), exotic1.M(), exotic1.Pt(), deltaR1, deltam1, phimult); + histos.fill(HIST("SEMassUnlike"), exotic1.M(), std::abs(exotic2phi1.Pt() - exotic2phi2.Pt()) / exotic1.Pt(), exotic1.Pt(), deltaR1, deltam1, phimult); } } } @@ -645,219 +734,166 @@ struct doublephimeson { continue; } - histos.fill(HIST("SEMassUnlike"), exotic1.M(), exotic1.Pt(), deltaR1, deltam1, phimult); + histos.fill(HIST("SEMassUnlike"), exotic1.M(), std::abs(exotic1phi1.Pt() - exotic1phi2.Pt()) / exotic1.Pt(), exotic1.Pt(), deltaR1, deltam1, phimult); } } } PROCESS_SWITCH(doublephimeson, processopti, "Process Optimized same event", false); - void processopti2(aod::RedPhiEvents::iterator const& collision, aod::PhiTracks const& phitracks) + void processopti3(aod::RedPhiEvents::iterator const& collision, aod::PhiTracks const& phitracks) { - if (additionalEvsel && (collision.numPos() < 2 || collision.numNeg() < 2)) { + if (additionalEvsel && (collision.numPos() < 2 || collision.numNeg() < 2)) return; - } - // === Helpers === - // PDG phi mass (centralized constant, easy to vary for systematics) + // --- φ multiplicity with PID --- + int phimult = 0; + for (auto const& t : phitracks) { + if (t.phiMass() < minPhiMass1 || t.phiMass() > maxPhiMass1) + continue; + const double kpluspt = std::hypot(t.phid1Px(), t.phid1Py()); + const double kminuspt = std::hypot(t.phid2Px(), t.phid2Py()); + if (kpluspt > maxKaonPt || kminuspt > maxKaonPt) + continue; + if (!selectionPID(t.phid1TPC(), t.phid1TOF(), t.phid1TOFHit(), strategyPID1, kpluspt)) + continue; + if (!selectionPID(t.phid2TPC(), t.phid2TOF(), t.phid2TOFHit(), strategyPID2, kminuspt)) + continue; + ++phimult; + } + if (phimult < 2) + return; + // --- helpers --- constexpr double mPhiPDG = 1.019461; // GeV/c^2 - // ΔR with proper Δφ wrapping (−π, π] + const auto deltaMPhi = [=](double m1, double m2) { + const double d1 = m1 - mPhiPDG, d2 = m2 - mPhiPDG; + return std::sqrt(d1 * d1 + d2 * d2); + }; + const auto deltaR = [](double phi1, double eta1, double phi2, double eta2) { const double dphi = TVector2::Phi_mpi_pi(phi1 - phi2); const double deta = eta1 - eta2; return std::sqrt(dphi * dphi + deta * deta); }; - // Combined mass offset from PDG (tie-breaker metric) - const auto deltam = [=](double m1, double m2) { - return std::sqrt((m1 - mPhiPDG) * (m1 - mPhiPDG) + (m2 - mPhiPDG) * (m2 - mPhiPDG)); - }; - - // Anti-merging/duplication veto: - // Require same-sign kaons from the two φ's to be separated in (η,φ). - // This protects against split/merged tracks and near-duplicate topologies. + // anti-merging: same-sign kaons must be separated const auto passDaughterDR = [&](const ROOT::Math::PtEtaPhiMVector& kplusA, const ROOT::Math::PtEtaPhiMVector& kplusB, const ROOT::Math::PtEtaPhiMVector& kminusA, - const ROOT::Math::PtEtaPhiMVector& kminusB) { + const ROOT::Math::PtEtaPhiMVector& kminusB, + double thr) { const double dRkplus = deltaR(kplusA.Phi(), kplusA.Eta(), kplusB.Phi(), kplusB.Eta()); const double dRkminus = deltaR(kminusA.Phi(), kminusA.Eta(), kminusB.Phi(), kminusB.Eta()); histos.fill(HIST("hDeltaRkaonplus"), dRkplus); histos.fill(HIST("hDeltaRkaonminus"), dRkminus); - return (dRkplus > daughterDeltaR) && (dRkminus > daughterDeltaR); - // If later needed, make pT-aware: - // const double thr = std::max(0.01, daughterDeltaR - 0.002 * std::min(10.0, exoticPt)); - // return (dRkplus > thr) && (dRkminus > thr); + return (dRkplus > thr) && (dRkminus > thr); }; - - // === Phi multiplicity (uses PID1 for d1, PID2 for d2) === - int phimult = 0; - for (auto const& t : phitracks) { - if (t.phiMass() < minPhiMass1 || t.phiMass() > maxPhiMass1) - continue; - const double kpluspt = std::hypot(t.phid1Px(), t.phid1Py()); - const double kminuspt = std::hypot(t.phid2Px(), t.phid2Py()); - if (kpluspt > maxKaonPt) - continue; - if (kminuspt > maxKaonPt) - continue; - if (!selectionPID(t.phid1TPC(), t.phid1TOF(), t.phid1TOFHit(), strategyPID1, kpluspt)) - continue; // d1 → PID1 - if (!selectionPID(t.phid2TPC(), t.phid2TOF(), t.phid2TOFHit(), strategyPID2, kminuspt)) - continue; // d2 → PID2 - ++phimult; - } - - // === Collect candidates first === - std::vector exoticres, phi1v, phi2v, kplus1, kplus2, kminus1, kminus2; - std::vector d1id, d2id, d3id, d4id; - - const auto n = phitracks.size(); - exoticres.reserve(n); - phi1v.reserve(n); - phi2v.reserve(n); - kplus1.reserve(n); - kplus2.reserve(n); - kminus1.reserve(n); - kminus2.reserve(n); - d1id.reserve(n); - d2id.reserve(n); - d3id.reserve(n); - d4id.reserve(n); + // --- collect candidates once --- + std::vector pairV, phi1V, phi2V, kplus1V, kplus2V, kminus1V, kminus2V; for (auto const& t1 : phitracks) { - // Per-φ selection for the first φ const double kplus1pt = std::hypot(t1.phid1Px(), t1.phid1Py()); const double kminus1pt = std::hypot(t1.phid2Px(), t1.phid2Py()); + // PID QA before histos.fill(HIST("hnsigmaTPCTOFKaonBefore"), t1.phid1TPC(), t1.phid1TOF(), kplus1pt); histos.fill(HIST("hnsigmaTPCKaonPlusBefore"), t1.phid1TPC(), kplus1pt); histos.fill(HIST("hnsigmaTPCKaonMinusBefore"), t1.phid2TPC(), kminus1pt); - if (kplus1pt > maxKaonPt) - continue; - if (kminus1pt > maxKaonPt) + if (kplus1pt > maxKaonPt || kminus1pt > maxKaonPt) continue; if (!selectionPID(t1.phid1TPC(), t1.phid1TOF(), t1.phid1TOFHit(), strategyPID1, kplus1pt)) continue; if (!selectionPID(t1.phid2TPC(), t1.phid2TOF(), t1.phid2TOFHit(), strategyPID2, kminus1pt)) continue; - // Set vectors BEFORE QA fills - Phid1.SetXYZM(t1.phiPx(), t1.phiPy(), t1.phiPz(), t1.phiMass()); - Phi1kaonplus.SetXYZM(t1.phid1Px(), t1.phid1Py(), t1.phid1Pz(), 0.493); - Phi1kaonminus.SetXYZM(t1.phid2Px(), t1.phid2Py(), t1.phid2Pz(), 0.493); + TLorentzVector phi1, k1p, k1m; + phi1.SetXYZM(t1.phiPx(), t1.phiPy(), t1.phiPz(), t1.phiMass()); + k1p.SetXYZM(t1.phid1Px(), t1.phid1Py(), t1.phid1Pz(), 0.493); + k1m.SetXYZM(t1.phid2Px(), t1.phid2Py(), t1.phid2Pz(), 0.493); + + // φ mass windows + if (t1.phiMass() < minPhiMass1 || t1.phiMass() > maxPhiMass1) + continue; - // PID QA + // PID QA after histos.fill(HIST("hnsigmaTPCTOFKaon"), t1.phid1TPC(), t1.phid1TOF(), kplus1pt); histos.fill(HIST("hnsigmaTPCKaonPlus"), t1.phid1TPC(), kplus1pt); histos.fill(HIST("hnsigmaTPCKaonMinus"), t1.phid2TPC(), kminus1pt); - histos.fill(HIST("hPhiMass"), Phid1.M(), Phid1.Pt()); + histos.fill(HIST("hPhiMass"), phi1.M(), phi1.Pt()); const auto id1 = t1.index(); for (auto const& t2 : phitracks) { const auto id2 = t2.index(); if (id2 <= id1) - continue; // unique unordered pairs + continue; - // Per-φ selection for the second φ const double kplus2pt = std::hypot(t2.phid1Px(), t2.phid1Py()); const double kminus2pt = std::hypot(t2.phid2Px(), t2.phid2Py()); - if (kplus2pt > maxKaonPt) - continue; - if (kminus2pt > maxKaonPt) + if (kplus2pt > maxKaonPt || kminus2pt > maxKaonPt) continue; if (!selectionPID(t2.phid1TPC(), t2.phid1TOF(), t2.phid1TOFHit(), strategyPID1, kplus2pt)) continue; if (!selectionPID(t2.phid2TPC(), t2.phid2TOF(), t2.phid2TOFHit(), strategyPID2, kminus2pt)) continue; - // Disallow shared same-sign daughters between the two φ's + // block shared same-sign daughters if ((t1.phid1Index() == t2.phid1Index()) || (t1.phid2Index() == t2.phid2Index())) continue; - Phid2.SetXYZM(t2.phiPx(), t2.phiPy(), t2.phiPz(), t2.phiMass()); - Phi2kaonplus.SetXYZM(t2.phid1Px(), t2.phid1Py(), t2.phid1Pz(), 0.493); - Phi2kaonminus.SetXYZM(t2.phid2Px(), t2.phid2Py(), t2.phid2Pz(), 0.493); - - // Mass windows - if (t1.phiMass() < minPhiMass1 || t1.phiMass() > maxPhiMass1) - continue; + TLorentzVector phi2, k2p, k2m; + phi2.SetXYZM(t2.phiPx(), t2.phiPy(), t2.phiPz(), t2.phiMass()); + k2p.SetXYZM(t2.phid1Px(), t2.phid1Py(), t2.phid1Pz(), 0.493); + k2m.SetXYZM(t2.phid2Px(), t2.phid2Py(), t2.phid2Pz(), 0.493); if (t2.phiMass() < minPhiMass2 || t2.phiMass() > maxPhiMass2) continue; - exotic = Phid1 + Phid2; - if (exotic.M() < minExoticMass || exotic.M() > maxExoticMass) + // Δm cut (configurable) + const double dM = deltaMPhi(phi1.M(), phi2.M()); + if (dM > maxDeltaMPhi) continue; - // Store candidate and bookkeeping - exoticres.emplace_back(exotic.Pt(), exotic.Eta(), exotic.Phi(), exotic.M()); - phi1v.emplace_back(Phid1.Pt(), Phid1.Eta(), Phid1.Phi(), Phid1.M()); - phi2v.emplace_back(Phid2.Pt(), Phid2.Eta(), Phid2.Phi(), Phid2.M()); + TLorentzVector pair = phi1 + phi2; + if (pair.M() < minExoticMass || pair.M() > maxExoticMass) + continue; - kplus1.emplace_back(Phi1kaonplus.Pt(), Phi1kaonplus.Eta(), Phi1kaonplus.Phi(), 0.493); - kminus1.emplace_back(Phi1kaonminus.Pt(), Phi1kaonminus.Eta(), Phi1kaonminus.Phi(), 0.493); - kplus2.emplace_back(Phi2kaonplus.Pt(), Phi2kaonplus.Eta(), Phi2kaonplus.Phi(), 0.493); - kminus2.emplace_back(Phi2kaonminus.Pt(), Phi2kaonminus.Eta(), Phi2kaonminus.Phi(), 0.493); + // daughter anti-merging + ROOT::Math::PtEtaPhiMVector k1pV(k1p.Pt(), k1p.Eta(), k1p.Phi(), 0.493); + ROOT::Math::PtEtaPhiMVector k1mV(k1m.Pt(), k1m.Eta(), k1m.Phi(), 0.493); + ROOT::Math::PtEtaPhiMVector k2pV(k2p.Pt(), k2p.Eta(), k2p.Phi(), 0.493); + ROOT::Math::PtEtaPhiMVector k2mV(k2m.Pt(), k2m.Eta(), k2m.Phi(), 0.493); + if (!passDaughterDR(k1pV, k2pV, k1mV, k2mV, daughterDeltaR)) + continue; - d1id.push_back(t1.phid1Index()); - d2id.push_back(t2.phid1Index()); - d3id.push_back(t1.phid2Index()); - d4id.push_back(t2.phid2Index()); + // store for one-pass fill + pairV.emplace_back(pair.Pt(), pair.Eta(), pair.Phi(), pair.M()); + phi1V.emplace_back(phi1.Pt(), phi1.Eta(), phi1.Phi(), phi1.M()); + phi2V.emplace_back(phi2.Pt(), phi2.Eta(), phi2.Phi(), phi2.M()); + kplus1V.emplace_back(k1p.Pt(), k1p.Eta(), k1p.Phi(), 0.493); + kminus1V.emplace_back(k1m.Pt(), k1m.Eta(), k1m.Phi(), 0.493); + kplus2V.emplace_back(k2p.Pt(), k2p.Eta(), k2p.Phi(), 0.493); + kminus2V.emplace_back(k2m.Pt(), k2m.Eta(), k2m.Phi(), 0.493); } } - if (exoticres.empty()) + if (pairV.empty()) return; - // === Special handling if exactly two candidates were built === - if (exoticres.size() == 2) { - const int i0 = 0, i1 = 1; - - const bool sameFour = - ((d1id[i0] == d1id[i1] || d1id[i0] == d2id[i1]) && - (d2id[i0] == d1id[i1] || d2id[i0] == d2id[i1]) && - (d3id[i0] == d3id[i1] || d3id[i0] == d4id[i1]) && - (d4id[i0] == d3id[i1] || d4id[i0] == d4id[i1])); - - const double deltam0 = deltam(phi1v[i0].M(), phi2v[i0].M()); - const double deltam1 = deltam(phi1v[i1].M(), phi2v[i1].M()); - const bool dr0 = passDaughterDR(kplus1[i0], kplus2[i0], kminus1[i0], kminus2[i0]); - const bool dr1 = passDaughterDR(kplus1[i1], kplus2[i1], kminus1[i1], kminus2[i1]); - - if (sameFour) { - // Choose the candidate closer to mφ (if it passes ΔR) - int keep = (deltam1 < deltam0 && dr1) ? i1 : (dr0 ? i0 : -1); - if (keep >= 0) { - const double dR = deltaR(phi1v[keep].Phi(), phi1v[keep].Eta(), phi2v[keep].Phi(), phi2v[keep].Eta()); - const double dm = (keep == i0) ? deltam0 : deltam1; - histos.fill(HIST("SEMassUnlike"), exoticres[keep].M(), exoticres[keep].Pt(), dR, dm, phimult); - } - } else { - // Independent candidates → fill both (respect ΔR) - if (dr0) { - const double dR0 = deltaR(phi1v[i0].Phi(), phi1v[i0].Eta(), phi2v[i0].Phi(), phi2v[i0].Eta()); - histos.fill(HIST("SEMassUnlike"), exoticres[i0].M(), exoticres[i0].Pt(), dR0, deltam0, phimult); - } - if (dr1) { - const double dR1 = deltaR(phi1v[i1].Phi(), phi1v[i1].Eta(), phi2v[i1].Phi(), phi2v[i1].Eta()); - histos.fill(HIST("SEMassUnlike"), exoticres[i1].M(), exoticres[i1].Pt(), dR1, deltam1, phimult); - } - } - return; - } - - // === General case: fill each candidate once (respect ΔR) === - for (size_t i = 0; i < exoticres.size(); ++i) { - if (!passDaughterDR(kplus1[i], kplus2[i], kminus1[i], kminus2[i])) - continue; - const double dR = deltaR(phi1v[i].Phi(), phi1v[i].Eta(), phi2v[i].Phi(), phi2v[i].Eta()); - const double dm = deltam(phi1v[i].M(), phi2v[i].M()); - histos.fill(HIST("SEMassUnlike"), exoticres[i].M(), exoticres[i].Pt(), dR, dm, phimult); + // --- fill the single THnSparse --- + for (size_t i = 0; i < pairV.size(); ++i) { + TLorentzVector p1, p2, pair; + p1.SetPtEtaPhiM(phi1V[i].Pt(), phi1V[i].Eta(), phi1V[i].Phi(), phi1V[i].M()); + p2.SetPtEtaPhiM(phi2V[i].Pt(), phi2V[i].Eta(), phi2V[i].Phi(), phi2V[i].M()); + pair.SetPtEtaPhiM(pairV[i].Pt(), pairV[i].Eta(), pairV[i].Phi(), pairV[i].M()); + const double dM = deltaMPhi(p1.M(), p2.M()); + const double M = pair.M(); + // const double pT = pair.Pt(); + const double dR = deltaR(p1.Phi(), p1.Eta(), p2.Phi(), p2.Eta()); + histos.fill(HIST("SEMassUnlike"), M, std::abs(p1.Pt() - p2.Pt()) / pair.Pt(), pair.Pt(), dR, dM, pairV.size()); } } - PROCESS_SWITCH(doublephimeson, processopti2, "Process Optimized same event", false); + PROCESS_SWITCH(doublephimeson, processopti3, "Process Optimized same event", false); SliceCache cache; using BinningTypeVertexContributor = ColumnBinningPolicy; From 47c97e860ce318f89d8497b5ba771e66d16d10eb Mon Sep 17 00:00:00 2001 From: amaringarcia Date: Tue, 28 Oct 2025 11:42:07 +0100 Subject: [PATCH 923/986] [Common] setting up irSource automatically using the CollisionHelper (#13282) Co-authored-by: Ana Marin Co-authored-by: Ana Marin --- Common/Tools/PID/pidTPCModule.h | 166 ++++++++++++++++++++++---------- 1 file changed, 116 insertions(+), 50 deletions(-) diff --git a/Common/Tools/PID/pidTPCModule.h b/Common/Tools/PID/pidTPCModule.h index 3c7e555c940..1c6a35048f7 100644 --- a/Common/Tools/PID/pidTPCModule.h +++ b/Common/Tools/PID/pidTPCModule.h @@ -22,12 +22,14 @@ #define COMMON_TOOLS_PID_PIDTPCMODULE_H_ #include "Common/CCDB/ctpRateFetcher.h" +#include "Common/Core/CollisionTypeHelper.h" #include "Common/Core/PID/TPCPIDResponse.h" #include "Common/Core/TableHelper.h" #include "Common/DataModel/PIDResponseTPC.h" #include "Common/TableProducer/PID/pidTPCBase.h" #include "Tools/ML/model.h" +#include #include #include #include @@ -127,13 +129,13 @@ struct pidTPCConfigurables : o2::framework::ConfigurableGroup { o2::framework::Configurable useNetworkHe{"useNetworkHe", 1, {"Switch for applying neural network on the helium3 mass hypothesis (if network enabled) (set to 0 to disable)"}}; o2::framework::Configurable useNetworkAl{"useNetworkAl", 1, {"Switch for applying neural network on the alpha mass hypothesis (if network enabled) (set to 0 to disable)"}}; o2::framework::Configurable networkBetaGammaCutoff{"networkBetaGammaCutoff", 0.45, {"Lower value of beta-gamma to override the NN application"}}; - o2::framework::Configurable irSource{"irSource", "ZNC hadronic", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"}; + o2::framework::Configurable cfgPathGrpLhcIf{"ccdb-path-grplhcif", "GLO/Config/GRPLHCIF", "Path on the CCDB for the GRPLHCIF object"}; }; // helper getter - FIXME should be separate int getPIDIndex(const int pdgCode) // Get O2 PID index corresponding to MC PDG code { - switch (abs(pdgCode)) { + switch (std::abs(pdgCode)) { case 11: return o2::track::PID::Electron; case 13: @@ -214,6 +216,10 @@ class pidTPCModule std::vector speciesNetworkFlags = std::vector(9); std::string networkVersion; + // To get automatically the proper Hadronic Rate + std::string irSource = ""; + o2::common::core::CollisionSystemType::collType collsys = o2::common::core::CollisionSystemType::kCollSysUndef; + // Parametrization configuration bool useCCDBParam = false; @@ -323,6 +329,14 @@ class pidTPCModule } LOG(info) << "Successfully retrieved TPC PID object from CCDB for timestamp " << time << ", period " << headers["LPMProductionTag"] << ", recoPass " << headers["RecoPassName"]; metadata["RecoPassName"] = headers["RecoPassName"]; // Force pass number for NN request to match retrieved BB + o2::parameters::GRPLHCIFData* grpo = ccdb->template getForTimeStamp(pidTPCopts.cfgPathGrpLhcIf.value, time); + LOG(info) << " collision type::" << CollisionSystemType::getCollisionTypeFromGrp(grpo); + collsys = CollisionSystemType::getCollisionTypeFromGrp(grpo); + if (collsys == CollisionSystemType::kCollSyspp) { + irSource = std::string("T0VTX"); + } else { + irSource = std::string("ZNC hadronic"); + } response->PrintAll(); } } @@ -368,8 +382,8 @@ class pidTPCModule } // end init //__________________________________________________ - template - std::vector createNetworkPrediction(TCCDB& ccdb, TCCDBApi& ccdbApi, C const& collisions, M const& mults, T const& tracks, B const& bcs, const size_t size) + template + std::vector createNetworkPrediction(TCCDB& ccdb, TCCDBApi& ccdbApi, soa::Join const& collisions, M const& mults, T const& tracks, B const& bcs, const size_t size) { std::vector network_prediction; @@ -397,6 +411,14 @@ class pidTPCModule } LOG(info) << "Successfully retrieved TPC PID object from CCDB for timestamp " << bc.timestamp() << ", period " << headers["LPMProductionTag"] << ", recoPass " << headers["RecoPassName"]; metadata["RecoPassName"] = headers["RecoPassName"]; // Force pass number for NN request to match retrieved BB + o2::parameters::GRPLHCIFData* grpo = ccdb->template getForTimeStamp(pidTPCopts.cfgPathGrpLhcIf.value, bc.timestamp()); + LOG(info) << "Collision type::" << CollisionSystemType::getCollisionTypeFromGrp(grpo); + collsys = CollisionSystemType::getCollisionTypeFromGrp(grpo); + if (collsys == CollisionSystemType::kCollSyspp) { + irSource = std::string("T0VTX"); + } else { + irSource = std::string("ZNC hadronic"); + } response->PrintAll(); } @@ -430,11 +452,26 @@ class pidTPCModule uint64_t counter_track_props = 0; int loop_counter = 0; + // To load the Hadronic rate once for each collision + float hadronicRateBegin = 0.; + std::vector hadronicRateForCollision(collisions.size(), 0.0f); + size_t i = 0; + for (const auto& collision : collisions) { + const auto& bc = collision.template bc_as(); + hadronicRateForCollision[i] = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), irSource) * 1.e-3; + i++; + } + auto bc = bcs.begin(); + hadronicRateBegin = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), irSource) * 1.e-3; // kHz + // Filling a std::vector to be evaluated by the network // Evaluation on single tracks brings huge overhead: Thus evaluation is done on one large vector - for (int i = 0; i < 9; i++) { // Loop over particle number for which network correction is used - float hadronicRate = 0.; - uint64_t timeStamp_bcOld = 0; + static constexpr int NParticleTypes = 9; + constexpr int ExpectedInputDimensionsNNV2 = 7; + constexpr int ExpectedInputDimensionsNNV3 = 8; + constexpr auto NetworkVersionV2 = "2"; + constexpr auto NetworkVersionV3 = "3"; + for (int i = 0; i < NParticleTypes; i++) { // Loop over particle number for which network correction is used for (auto const& trk : tracks) { if (!trk.hasTPC()) { continue; @@ -450,20 +487,24 @@ class pidTPCModule track_properties[counter_track_props + 3] = o2::track::pid_constants::sMasses[i]; track_properties[counter_track_props + 4] = trk.has_collision() ? mults[trk.collisionId()] / 11000. : 1.; track_properties[counter_track_props + 5] = std::sqrt(nNclNormalization / trk.tpcNClsFound()); - if (input_dimensions == 7 && networkVersion == "2") { + if (input_dimensions == ExpectedInputDimensionsNNV2 && networkVersion == NetworkVersionV2) { track_properties[counter_track_props + 6] = trk.has_collision() ? collisions.iteratorAt(trk.collisionId()).ft0cOccupancyInTimeRange() / 60000. : 1.; } - if (input_dimensions == 8 && networkVersion == "3") { + if (input_dimensions == ExpectedInputDimensionsNNV3 && networkVersion == NetworkVersionV3) { track_properties[counter_track_props + 6] = trk.has_collision() ? collisions.iteratorAt(trk.collisionId()).ft0cOccupancyInTimeRange() / 60000. : 1.; if (trk.has_collision()) { - auto trk_bc = (collisions.iteratorAt(trk.collisionId())).template bc_as(); - if (trk_bc.timestamp() != timeStamp_bcOld) { - hadronicRate = mRateFetcher.fetch(ccdb.service, trk_bc.timestamp(), trk_bc.runNumber(), pidTPCopts.irSource.value) * 1.e-3; + if (collsys == CollisionSystemType::kCollSyspp) { + track_properties[counter_track_props + 7] = hadronicRateForCollision[trk.collisionId()] / 1500.; + } else { + track_properties[counter_track_props + 7] = hadronicRateForCollision[trk.collisionId()] / 50.; } - timeStamp_bcOld = trk_bc.timestamp(); - track_properties[counter_track_props + 7] = hadronicRate / 50.; } else { - track_properties[counter_track_props + 7] = 1; + // asign Hadronic Rate at beginning of run if track does not belong to a collision + if (collsys == CollisionSystemType::kCollSyspp) { + track_properties[counter_track_props + 7] = hadronicRateBegin / 1500.; + } else { + track_properties[counter_track_props + 7] = hadronicRateBegin / 50.; + } } } counter_track_props += input_dimensions; @@ -493,7 +534,7 @@ class pidTPCModule //__________________________________________________ template - void makePidTables(const int flagFull, NSF& tableFull, const int flagTiny, NST& tableTiny, const o2::track::PID::ID pid, const float tpcSignal, const T& trk, const long multTPC, const std::vector& network_prediction, const int& count_tracks, const int& tracksForNet_size) + void makePidTables(const int flagFull, NSF& tableFull, const int flagTiny, NST& tableTiny, const o2::track::PID::ID pid, const float tpcSignal, const T& trk, const int64_t multTPC, const std::vector& network_prediction, const int& count_tracks, const int& tracksForNet_size) { if (flagFull != 1 && flagTiny != 1) { return; @@ -526,22 +567,24 @@ class pidTPCModule float nSigma = -999.f; float bg = trk.tpcInnerParam() / o2::track::pid_constants::sMasses[pid]; // estimated beta-gamma for network cutoff + constexpr int NumOutputNodesSymmetricSigma = 2; + constexpr int NumOutputNodesAsymmetricSigma = 3; if (pidTPCopts.useNetworkCorrection && speciesNetworkFlags[pid] && trk.has_collision() && bg > pidTPCopts.networkBetaGammaCutoff) { // Here comes the application of the network. The output--dimensions of the network determine the application: 1: mean, 2: sigma, 3: sigma asymmetric // For now only the option 2: sigma will be used. The other options are kept if there would be demand later on if (network.getNumOutputNodes() == 1) { // Expected mean correction; no sigma correction nSigma = (tpcSignal - network_prediction[count_tracks + tracksForNet_size * pid] * expSignal) / expSigma; - } else if (network.getNumOutputNodes() == 2) { // Symmetric sigma correction - expSigma = (network_prediction[2 * (count_tracks + tracksForNet_size * pid) + 1] - network_prediction[2 * (count_tracks + tracksForNet_size * pid)]) * expSignal; - nSigma = (tpcSignal / expSignal - network_prediction[2 * (count_tracks + tracksForNet_size * pid)]) / (network_prediction[2 * (count_tracks + tracksForNet_size * pid) + 1] - network_prediction[2 * (count_tracks + tracksForNet_size * pid)]); - } else if (network.getNumOutputNodes() == 3) { // Asymmetric sigma corection - if (tpcSignal / expSignal >= network_prediction[3 * (count_tracks + tracksForNet_size * pid)]) { - expSigma = (network_prediction[3 * (count_tracks + tracksForNet_size * pid) + 1] - network_prediction[3 * (count_tracks + tracksForNet_size * pid)]) * expSignal; - nSigma = (tpcSignal / expSignal - network_prediction[3 * (count_tracks + tracksForNet_size * pid)]) / (network_prediction[3 * (count_tracks + tracksForNet_size * pid) + 1] - network_prediction[3 * (count_tracks + tracksForNet_size * pid)]); + } else if (network.getNumOutputNodes() == NumOutputNodesSymmetricSigma) { // Symmetric sigma correction + expSigma = (network_prediction[NumOutputNodesSymmetricSigma * (count_tracks + tracksForNet_size * pid) + 1] - network_prediction[NumOutputNodesSymmetricSigma * (count_tracks + tracksForNet_size * pid)]) * expSignal; + nSigma = (tpcSignal / expSignal - network_prediction[NumOutputNodesSymmetricSigma * (count_tracks + tracksForNet_size * pid)]) / (network_prediction[NumOutputNodesSymmetricSigma * (count_tracks + tracksForNet_size * pid) + 1] - network_prediction[NumOutputNodesSymmetricSigma * (count_tracks + tracksForNet_size * pid)]); + } else if (network.getNumOutputNodes() == NumOutputNodesAsymmetricSigma) { // Asymmetric sigma corection + if (tpcSignal / expSignal >= network_prediction[NumOutputNodesAsymmetricSigma * (count_tracks + tracksForNet_size * pid)]) { + expSigma = (network_prediction[NumOutputNodesAsymmetricSigma * (count_tracks + tracksForNet_size * pid) + 1] - network_prediction[NumOutputNodesAsymmetricSigma * (count_tracks + tracksForNet_size * pid)]) * expSignal; + nSigma = (tpcSignal / expSignal - network_prediction[NumOutputNodesAsymmetricSigma * (count_tracks + tracksForNet_size * pid)]) / (network_prediction[NumOutputNodesAsymmetricSigma * (count_tracks + tracksForNet_size * pid) + 1] - network_prediction[NumOutputNodesAsymmetricSigma * (count_tracks + tracksForNet_size * pid)]); } else { - expSigma = (network_prediction[3 * (count_tracks + tracksForNet_size * pid)] - network_prediction[3 * (count_tracks + tracksForNet_size * pid) + 2]) * expSignal; - nSigma = (tpcSignal / expSignal - network_prediction[3 * (count_tracks + tracksForNet_size * pid)]) / (network_prediction[3 * (count_tracks + tracksForNet_size * pid)] - network_prediction[3 * (count_tracks + tracksForNet_size * pid) + 2]); + expSigma = (network_prediction[NumOutputNodesAsymmetricSigma * (count_tracks + tracksForNet_size * pid)] - network_prediction[NumOutputNodesAsymmetricSigma * (count_tracks + tracksForNet_size * pid) + 2]) * expSignal; + nSigma = (tpcSignal / expSignal - network_prediction[NumOutputNodesAsymmetricSigma * (count_tracks + tracksForNet_size * pid)]) / (network_prediction[NumOutputNodesAsymmetricSigma * (count_tracks + tracksForNet_size * pid)] - network_prediction[NumOutputNodesAsymmetricSigma * (count_tracks + tracksForNet_size * pid) + 2]); } } else { LOGF(fatal, "Network output-dimensions incompatible!"); @@ -556,8 +599,8 @@ class pidTPCModule }; //__________________________________________________ - template - void process(TCCDB& ccdb, TCCDBApi& ccdbApi, TBCs const& bcs, TCollisions const& cols, TTracks const& tracks, TTracksQA const& tracksQA, TProducts& products) + template + void process(TCCDB& ccdb, TCCDBApi& ccdbApi, TBCs const& bcs, soa::Join const& cols, TTracks const& tracks, TTracksQA const& tracksQA, TProducts& products) { if (tracks.size() == 0) { return; // empty protection @@ -568,9 +611,9 @@ class pidTPCModule } // preparatory step: we need the multiplicities for each collision - std::vector pidmults; - long totalTPCtracks = 0; - long totalTPCnotStandalone = 0; + std::vector pidmults; + int64_t totalTPCtracks = 0; + int64_t totalTPCnotStandalone = 0; pidmults.resize(cols.size(), 0); // faster counting @@ -627,7 +670,7 @@ class pidTPCModule //_______________________________________ // process tracksQA in case present - std::vector indexTrack2TrackQA; + std::vector indexTrack2TrackQA(outTable_size, -1); if constexpr (soa::is_table) { for (const auto& trackQA : tracksQA) { indexTrack2TrackQA[trackQA.trackId()] = trackQA.globalIndex(); @@ -635,11 +678,25 @@ class pidTPCModule } //_______________________________________ + // Fill Hadronic rate per collision in case CorrectedDEdx is requested + std::vector hadronicRateForCollision(cols.size(), 0.0f); + float hadronicRateBegin = 0.0f; + if (pidTPCopts.useCorrecteddEdx) { + size_t i = 0; + for (const auto& collision : cols) { + const auto& bc = collision.template bc_as(); + hadronicRateForCollision[i] = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), irSource) * 1.e-3; + i++; + } + auto bc = bcs.begin(); + hadronicRateBegin = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), irSource) * 1.e-3; // kHz + } + for (auto const& trk : tracks) { // get the TPC signal to be used in the PID float tpcSignalToEvaluatePID = trk.tpcSignal(); - int multTPC = 0; + int64_t multTPC = 0; if (trk.has_collision()) { multTPC = pidmults[trk.collisionId()]; } @@ -662,24 +719,25 @@ class pidTPCModule int occupancy; if (trk.has_collision()) { auto collision = cols.iteratorAt(trk.collisionId()); - auto bc = collision.template bc_as(); - const int runnumber = bc.runNumber(); - hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, "ZNC hadronic") * 1.e-3; // kHz + hadronicRate = hadronicRateForCollision[trk.collisionId()]; occupancy = collision.trackOccupancyInTimeRange(); } else { - auto bc = bcs.begin(); - const int runnumber = bc.runNumber(); - hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, "ZNC hadronic") * 1.e-3; // kHz + hadronicRate = hadronicRateBegin; occupancy = 0; } + constexpr float kExpectedTPCSignalMIP = 50.0f; + constexpr float kMaxAllowedRatio = 1.05f; + constexpr float kMinAllowedRatio = 0.05f; + constexpr float kMaxAllowedOcc = 12.0f; + float fTPCSignal = tpcSignalToEvaluatePID; float fNormMultTPC = multTPC / 11000.; float fTrackOccN = occupancy / 1000.; float fOccTPCN = fNormMultTPC * 10; //(fNormMultTPC*10).clip(0,12) - if (fOccTPCN > 12) - fOccTPCN = 12; + if (fOccTPCN > kMaxAllowedOcc) + fOccTPCN = kMaxAllowedOcc; else if (fOccTPCN < 0) fOccTPCN = 0; @@ -688,11 +746,11 @@ class pidTPCModule float a1pt = std::abs(trk.signed1Pt()); float a1pt2 = a1pt * a1pt; float atgl = std::abs(trk.tgl()); - float mbb0R = 50 / fTPCSignal; - if (mbb0R > 1.05) - mbb0R = 1.05; - else if (mbb0R < 0.05) - mbb0R = 0.05; + float mbb0R = kExpectedTPCSignalMIP / fTPCSignal; + if (mbb0R > kMaxAllowedRatio) + mbb0R = kMaxAllowedRatio; + else if (mbb0R < kMinAllowedRatio) + mbb0R = kMinAllowedRatio; // float mbb0R = max(0.05, min(50 / fTPCSignal, 1.05)); float a1ptmbb0R = a1pt * mbb0R; float atglmbb0R = atgl * mbb0R; @@ -702,11 +760,11 @@ class pidTPCModule float fTPCSignalN_CR0 = str_dedx_correction.fReal_fTPCSignalN(vec_occu, vec_track); - float mbb0R1 = 50 / (fTPCSignal / fTPCSignalN_CR0); - if (mbb0R1 > 1.05) - mbb0R1 = 1.05; - else if (mbb0R1 < 0.05) - mbb0R1 = 0.05; + float mbb0R1 = kExpectedTPCSignalMIP / (fTPCSignal / fTPCSignalN_CR0); + if (mbb0R1 > kMaxAllowedRatio) + mbb0R1 = kMaxAllowedRatio; + else if (mbb0R1 < kMinAllowedRatio) + mbb0R1 = kMinAllowedRatio; std::vector vec_track1 = {mbb0R1, a1pt, atgl, atgl * mbb0R1, a1pt * mbb0R1, side, a1pt2}; float fTPCSignalN_CR1 = str_dedx_correction.fReal_fTPCSignalN(vec_occu, vec_track1); @@ -738,6 +796,14 @@ class pidTPCModule } } LOG(info) << "Successfully retrieved TPC PID object from CCDB for timestamp " << bc.timestamp() << ", period " << headers["LPMProductionTag"] << ", recoPass " << headers["RecoPassName"]; + o2::parameters::GRPLHCIFData* grpo = ccdb->template getForTimeStamp(pidTPCopts.cfgPathGrpLhcIf.value, bc.timestamp()); + LOG(info) << "Collisions type::" << CollisionSystemType::getCollisionTypeFromGrp(grpo); + collsys = CollisionSystemType::getCollisionTypeFromGrp(grpo); + if (collsys == CollisionSystemType::kCollSyspp) { + irSource = std::string("T0VTX"); + } else { + irSource = std::string("ZNC hadronic"); + } response->PrintAll(); } From c603d0263e875b8195785f085ef354ebbfe8c291 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Tue, 28 Oct 2025 16:07:54 +0100 Subject: [PATCH 924/986] [PWGEM/Dilepton] speed up pairing (#13571) --- PWGEM/Dilepton/Core/Dilepton.h | 35 +++++++++++++------------ PWGEM/Dilepton/Core/DileptonHadronMPC.h | 29 ++++++++++---------- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index ac355b6c698..02893baf071 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -510,8 +510,8 @@ struct Dilepton { delete emh_neg; emh_neg = 0x0; - used_trackIds.clear(); - used_trackIds.shrink_to_fit(); + used_trackIds_per_col.clear(); + used_trackIds_per_col.shrink_to_fit(); delete h2sp_resolution; } @@ -819,8 +819,8 @@ struct Dilepton { { if constexpr (ev_id == 1) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - // bool is_found1 = std::find(t2.ambiguousElectronsIds.begin(), t2.ambiguousElectronsIds.end(), t1.globalIndex()) != t2.ambiguousElectronsIds.end(); //this does not work. - // bool is_found2 = std::find(t1.ambiguousElectronsIds.begin(), t1.ambiguousElectronsIds.end(), t2.globalIndex()) != t1.ambiguousElectronsIds.end(); //this does not work. + // bool is_found1 = std::find(t2.ambiguousElectronsIds.begin(), t2.ambiguousElectronsIds.end(), t1.globalIndex()) != t2.ambiguousElectronsIds.end(); // this does not work. + // bool is_found2 = std::find(t1.ambiguousElectronsIds.begin(), t1.ambiguousElectronsIds.end(), t2.globalIndex()) != t1.ambiguousElectronsIds.end(); // this does not work. auto v1ambIds = t1.ambiguousElectronsIds(); auto v2ambIds = t2.ambiguousElectronsIds(); @@ -829,8 +829,8 @@ struct Dilepton { return false; // this is protection against pairing 2 identical tracks. This happens, when TTCA is used. TTCA can assign a track to several possible collisions. } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - // bool is_found1 = std::find(t2.ambiguousMuonsIds.begin(), t2.ambiguousMuonsIds.end(), t1.globalIndex()) != t2.ambiguousMuonsIds.end(); //this does not work. - // bool is_found2 = std::find(t1.ambiguousMuonsIds.begin(), t1.ambiguousMuonsIds.end(), t2.globalIndex()) != t1.ambiguousMuonsIds.end(); //this does not work. + // bool is_found1 = std::find(t2.ambiguousMuonsIds.begin(), t2.ambiguousMuonsIds.end(), t1.globalIndex()) != t2.ambiguousMuonsIds.end(); // this does not work. + // bool is_found2 = std::find(t1.ambiguousMuonsIds.begin(), t1.ambiguousMuonsIds.end(), t2.globalIndex()) != t1.ambiguousMuonsIds.end(); // this does not work. auto v1ambIds = t1.ambiguousMuonsIds(); auto v2ambIds = t2.ambiguousMuonsIds(); @@ -1066,8 +1066,6 @@ struct Dilepton { // store tracks for event mixing without double counting if constexpr (ev_id == 0) { std::pair key_df_collision = std::make_pair(ndf, collision.globalIndex()); - std::pair pair_tmp_id1 = std::make_pair(ndf, t1.globalIndex()); - std::pair pair_tmp_id2 = std::make_pair(ndf, t2.globalIndex()); std::vector possibleIds1; std::vector possibleIds2; @@ -1076,8 +1074,8 @@ struct Dilepton { std::copy(t1.ambiguousElectronsIds().begin(), t1.ambiguousElectronsIds().end(), std::back_inserter(possibleIds1)); std::copy(t2.ambiguousElectronsIds().begin(), t2.ambiguousElectronsIds().end(), std::back_inserter(possibleIds2)); - if (std::find(used_trackIds.begin(), used_trackIds.end(), pair_tmp_id1) == used_trackIds.end()) { - used_trackIds.emplace_back(pair_tmp_id1); + if (std::find(used_trackIds_per_col.begin(), used_trackIds_per_col.end(), t1.globalIndex()) == used_trackIds_per_col.end()) { + used_trackIds_per_col.emplace_back(t1.globalIndex()); if (cfgDoMix) { if (t1.sign() > 0) { emh_pos->AddTrackToEventPool(key_df_collision, EMTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.trackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.dcaXY(), t1.dcaZ(), possibleIds1, t1.cYY(), t1.cZY(), t1.cZZ())); @@ -1086,8 +1084,8 @@ struct Dilepton { } } } - if (std::find(used_trackIds.begin(), used_trackIds.end(), pair_tmp_id2) == used_trackIds.end()) { - used_trackIds.emplace_back(pair_tmp_id2); + if (std::find(used_trackIds_per_col.begin(), used_trackIds_per_col.end(), t2.globalIndex()) == used_trackIds_per_col.end()) { + used_trackIds_per_col.emplace_back(t2.globalIndex()); if (cfgDoMix) { if (t2.sign() > 0) { emh_pos->AddTrackToEventPool(key_df_collision, EMTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.trackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.dcaXY(), t2.dcaZ(), possibleIds2, t2.cYY(), t2.cZY(), t2.cZZ())); @@ -1100,8 +1098,8 @@ struct Dilepton { std::copy(t1.ambiguousMuonsIds().begin(), t1.ambiguousMuonsIds().end(), std::back_inserter(possibleIds1)); std::copy(t2.ambiguousMuonsIds().begin(), t2.ambiguousMuonsIds().end(), std::back_inserter(possibleIds2)); - if (std::find(used_trackIds.begin(), used_trackIds.end(), pair_tmp_id1) == used_trackIds.end()) { - used_trackIds.emplace_back(pair_tmp_id1); + if (std::find(used_trackIds_per_col.begin(), used_trackIds_per_col.end(), t1.globalIndex()) == used_trackIds_per_col.end()) { + used_trackIds_per_col.emplace_back(t1.globalIndex()); if (cfgDoMix) { if (t1.sign() > 0) { emh_pos->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.fwdtrackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.fwdDcaX(), t1.fwdDcaY(), possibleIds1, @@ -1112,8 +1110,8 @@ struct Dilepton { } } } - if (std::find(used_trackIds.begin(), used_trackIds.end(), pair_tmp_id2) == used_trackIds.end()) { - used_trackIds.emplace_back(pair_tmp_id2); + if (std::find(used_trackIds_per_col.begin(), used_trackIds_per_col.end(), t2.globalIndex()) == used_trackIds_per_col.end()) { + used_trackIds_per_col.emplace_back(t2.globalIndex()); if (cfgDoMix) { if (t2.sign() > 0) { emh_pos->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.fwdtrackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.fwdDcaX(), t2.fwdDcaY(), possibleIds2, @@ -1170,7 +1168,7 @@ struct Dilepton { TEMH* emh_neg = nullptr; std::map, uint64_t> map_mixed_eventId_to_globalBC; - std::vector> used_trackIds; + std::vector used_trackIds_per_col; int ndf = 0; template @@ -1252,6 +1250,7 @@ struct Dilepton { auto negTracks_per_coll = negTracks.sliceByCached(perCollision, collision.globalIndex(), cache); // LOGF(info, "collision.globalIndex() = %d , collision.posZ() = %f , collision.numContrib() = %d, centrality = %f , posTracks_per_coll.size() = %d, negTracks_per_coll.size() = %d", collision.globalIndex(), collision.posZ(), collision.numContrib(), centralities[cfgCentEstimator], posTracks_per_coll.size(), negTracks_per_coll.size()); + used_trackIds_per_col.reserve(posTracks_per_coll.size() + negTracks_per_coll.size()); int nuls = 0, nlspp = 0, nlsmm = 0; for (const auto& [pos, neg] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { // ULS bool is_pair_ok = fillPairInfo<0>(collision, pos, neg, cut, tracks); @@ -1271,6 +1270,8 @@ struct Dilepton { nlsmm++; } } + used_trackIds_per_col.clear(); + used_trackIds_per_col.shrink_to_fit(); if (!cfgDoMix || !(nuls > 0 || nlspp > 0 || nlsmm > 0)) { continue; diff --git a/PWGEM/Dilepton/Core/DileptonHadronMPC.h b/PWGEM/Dilepton/Core/DileptonHadronMPC.h index ef3b65e5230..3aa08563b00 100644 --- a/PWGEM/Dilepton/Core/DileptonHadronMPC.h +++ b/PWGEM/Dilepton/Core/DileptonHadronMPC.h @@ -457,8 +457,8 @@ struct DileptonHadronMPC { delete emh_ref; emh_ref = 0x0; - used_trackIds.clear(); - used_trackIds.shrink_to_fit(); + used_trackIds_per_col.clear(); + used_trackIds_per_col.shrink_to_fit(); } void addhistograms() @@ -786,8 +786,6 @@ struct DileptonHadronMPC { // store tracks for event mixing without double counting if constexpr (ev_id == 0) { std::pair key_df_collision = std::make_pair(ndf, collision.globalIndex()); - std::pair pair_tmp_id1 = std::make_pair(ndf, t1.globalIndex()); - std::pair pair_tmp_id2 = std::make_pair(ndf, t2.globalIndex()); std::vector possibleIds1; std::vector possibleIds2; @@ -796,8 +794,8 @@ struct DileptonHadronMPC { std::copy(t1.ambiguousElectronsIds().begin(), t1.ambiguousElectronsIds().end(), std::back_inserter(possibleIds1)); std::copy(t2.ambiguousElectronsIds().begin(), t2.ambiguousElectronsIds().end(), std::back_inserter(possibleIds2)); - if (std::find(used_trackIds.begin(), used_trackIds.end(), pair_tmp_id1) == used_trackIds.end()) { - used_trackIds.emplace_back(pair_tmp_id1); + if (std::find(used_trackIds_per_col.begin(), used_trackIds_per_col.end(), t1.globalIndex()) == used_trackIds_per_col.end()) { + used_trackIds_per_col.emplace_back(t1.globalIndex()); if (cfgDoMix) { if (t1.sign() > 0) { emh_pos->AddTrackToEventPool(key_df_collision, EMTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.trackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.dcaXY(), t1.dcaZ(), possibleIds1, t1.cYY(), t1.cZY(), t1.cZZ())); @@ -806,8 +804,8 @@ struct DileptonHadronMPC { } } } - if (std::find(used_trackIds.begin(), used_trackIds.end(), pair_tmp_id2) == used_trackIds.end()) { - used_trackIds.emplace_back(pair_tmp_id2); + if (std::find(used_trackIds_per_col.begin(), used_trackIds_per_col.end(), t2.globalIndex()) == used_trackIds_per_col.end()) { + used_trackIds_per_col.emplace_back(t2.globalIndex()); if (cfgDoMix) { if (t2.sign() > 0) { emh_pos->AddTrackToEventPool(key_df_collision, EMTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.trackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.dcaXY(), t2.dcaZ(), possibleIds2, t2.cYY(), t2.cZY(), t2.cZZ())); @@ -820,8 +818,8 @@ struct DileptonHadronMPC { std::copy(t1.ambiguousMuonsIds().begin(), t1.ambiguousMuonsIds().end(), std::back_inserter(possibleIds1)); std::copy(t2.ambiguousMuonsIds().begin(), t2.ambiguousMuonsIds().end(), std::back_inserter(possibleIds2)); - if (std::find(used_trackIds.begin(), used_trackIds.end(), pair_tmp_id1) == used_trackIds.end()) { - used_trackIds.emplace_back(pair_tmp_id1); + if (std::find(used_trackIds_per_col.begin(), used_trackIds_per_col.end(), t1.globalIndex()) == used_trackIds_per_col.end()) { + used_trackIds_per_col.emplace_back(t1.globalIndex()); if (cfgDoMix) { if (t1.sign() > 0) { emh_pos->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.fwdtrackId(), t1.pt(), t1.eta(), t1.phi(), o2::constants::physics::MassMuon, t1.sign(), t1.fwdDcaX(), t1.fwdDcaY(), possibleIds1, @@ -832,8 +830,8 @@ struct DileptonHadronMPC { } } } - if (std::find(used_trackIds.begin(), used_trackIds.end(), pair_tmp_id2) == used_trackIds.end()) { - used_trackIds.emplace_back(pair_tmp_id2); + if (std::find(used_trackIds_per_col.begin(), used_trackIds_per_col.end(), t2.globalIndex()) == used_trackIds_per_col.end()) { + used_trackIds_per_col.emplace_back(t2.globalIndex()); if (cfgDoMix) { if (t2.sign() > 0) { emh_pos->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.fwdtrackId(), t2.pt(), t2.eta(), t2.phi(), o2::constants::physics::MassMuon, t2.sign(), t2.fwdDcaX(), t2.fwdDcaY(), possibleIds2, @@ -1082,7 +1080,7 @@ struct DileptonHadronMPC { MyEMH_track* emh_ref = nullptr; // for reference flow std::map, uint64_t> map_mixed_eventId_to_globalBC; - std::vector> used_trackIds; + std::vector used_trackIds_per_col; int ndf = 0; template @@ -1120,8 +1118,9 @@ struct DileptonHadronMPC { auto posTracks_per_coll = posTracks.sliceByCached(perCollision, collision.globalIndex(), cache); auto negTracks_per_coll = negTracks.sliceByCached(perCollision, collision.globalIndex(), cache); - int nuls = 0, nlspp = 0, nlsmm = 0; + used_trackIds_per_col.reserve(posTracks_per_coll.size() + negTracks_per_coll.size()); + int nuls = 0, nlspp = 0, nlsmm = 0; for (const auto& [pos, neg] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { // ULS bool is_pair_ok = fillDilepton<0>(collision, pos, neg, cut, tracks); if (is_pair_ok) { @@ -1149,6 +1148,8 @@ struct DileptonHadronMPC { } } } + used_trackIds_per_col.clear(); + used_trackIds_per_col.shrink_to_fit(); std::pair key_df_collision = std::make_pair(ndf, collision.globalIndex()); From f5edd903409b4504d77feca25c3c0c2774d4ff02 Mon Sep 17 00:00:00 2001 From: alicja-pp <101565842+alicja-pp@users.noreply.github.com> Date: Tue, 28 Oct 2025 19:41:01 +0100 Subject: [PATCH 925/986] [PWGCF] FemtoUniverse: Create 3D histograms only when needed in FemtoUniversePairWithCentMultKt.h (#13575) --- PWGCF/FemtoUniverse/Core/FemtoUniversePairWithCentMultKt.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniversePairWithCentMultKt.h b/PWGCF/FemtoUniverse/Core/FemtoUniversePairWithCentMultKt.h index 1f2651ad2f6..f83f480347b 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniversePairWithCentMultKt.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniversePairWithCentMultKt.h @@ -54,12 +54,9 @@ class FemtoUniversePairWithCentMultKt std::string histTitle = "mult_" + std::to_string(lowBin) + "-" + std::to_string(highBin); std::string histSuffix1 = static_cast(HistSuffix[i]); std::string histSuffix2 = static_cast(HistSuffix[i + 1]); - LOGF(info, "histSuffix1 %s histSuffix2", histSuffix1, histSuffix2); std::string histFolderMult = "mult_" + histSuffix1 + "_" + histSuffix2; std::string histName = histFolderMult + "/kstar"; - std::string histName3D = histFolderMult + "/q3D"; pairWithCentMultKtRegistry->add(histName.c_str(), histTitle.c_str(), HistType::kTH1F, {kstarAxis}); - pairWithCentMultKtRegistry->add(histName3D.c_str(), histTitle.c_str(), HistType::kTH3F, {kOutAxis, kSideAxis, kLongAxis}); if (useKt) { for (int i = 0; i < static_cast(ktBins.size() - 1); i++) { std::string ktBin1String = std::to_string(ktBins[i]); @@ -77,6 +74,8 @@ class FemtoUniversePairWithCentMultKt } } if (use3D) { + std::string histName3D = histFolderMult + "/q3D"; + pairWithCentMultKtRegistry->add(histName3D.c_str(), histTitle.c_str(), HistType::kTH3F, {kOutAxis, kSideAxis, kLongAxis}); for (int i = 0; i < static_cast(ktBins.size() - 1); i++) { std::string ktBin1String = std::to_string(ktBins[i]); std::replace(ktBin1String.begin(), ktBin1String.end(), '.', '_'); From 75bd9cd50c990b6a26859b2faa17a84515adb742 Mon Sep 17 00:00:00 2001 From: GijsvWeelden <55794847+GijsvWeelden@users.noreply.github.com> Date: Tue, 28 Oct 2025 20:04:47 +0100 Subject: [PATCH 926/986] [PWGJE] Jet Fragmentation & V0 QA: Add missing histograms (#13573) --- PWGJE/Tasks/jetFragmentation.cxx | 10 +++++++--- PWGJE/Tasks/v0QA.cxx | 28 +++++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/PWGJE/Tasks/jetFragmentation.cxx b/PWGJE/Tasks/jetFragmentation.cxx index b623c4d0cda..962f962fc6a 100644 --- a/PWGJE/Tasks/jetFragmentation.cxx +++ b/PWGJE/Tasks/jetFragmentation.cxx @@ -186,7 +186,7 @@ struct JetFragmentation { AxisSpec ptJetRelDiffAxis = {binPtRelDiff, "(#it{p}_{T}^{jet, det} - #it{p}_{T}^{jet, part})/#it{p}_{T, jet}^{part}"}; AxisSpec ptTrackRelDiffAxis = {binPtRelDiff, "(#it{p}_{T}^{track, det} - #it{p}_{T}^{track, part})/#it{p}_{T, track}^{part}"}; - AxisSpec zRelDiffAxis = {binZRelDiff, "(#it{p}_{T}^{jet, det} - #it{p}_{T}^{jet, part})/#it{p}_{T, jet}^{part}"}; + AxisSpec zRelDiffAxis = {binZRelDiff, "(#it{z}^{det} - #it{z}^{part})/#it{z}^{part}"}; AxisSpec v0PtAxis = {binV0Pt, "#it{p}_{T}^{V0}"}; AxisSpec v0PtRatioAxis = {binPtRatio, "#it{p}_{T}^{V0, det}/#it{p}_{T, V0}^{part}"}; @@ -778,7 +778,9 @@ struct JetFragmentation { registry.add("matching/jets/V0/jetPtnV0MatchednK0SnLambdanAntiLambda", "jet Pt, nV0 matched, nK0S nLambdan AntiLambda", HistType::kTHnSparseD, {detJetPtAxis, v0Count, v0Count, v0Count, v0Count}, true); registry.add("matching/jets/V0/partJetPtV0PtDetPt", "V0PartPtDetPt", HistType::kTH3D, {partJetPtAxis, v0partPtAxis, v0detPtAxis}, true); - registry.add("matching/jets/V0/partJetPtDetJetPtPartV0PtRatioPtRelDiffPt", "V0PartPtRatioRelDiffPt", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, v0partPtAxis, v0PtRatioAxis, v0PtRelDiffAxis}, true); + // registry.add("matching/jets/V0/partJetPtDetJetPtPartV0PtRatioPtRelDiffPt", "V0PartPtRatioRelDiffPt", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, v0partPtAxis, v0PtRatioAxis, v0PtRelDiffAxis}, true); + registry.add("matching/jets/V0/partJetPtDetJetPtPartV0PtRelDiffPt", "V0PartPtRelDiffPt", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, v0partPtAxis, v0PtRelDiffAxis}, true); + registry.add("matching/jets/V0/partJetPtDetJetPtPartV0ZRelDiffZ", "V0PartPtRelDiffZ", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, partZAxis, zRelDiffAxis}, true); // Matching - Matched V0s registry.add("matching/jets/V0/matchDetJetPtV0TrackProjPartJetPtV0TrackProj", "Matched", HistType::kTHnSparseD, {detJetPtAxis, detZAxis, partJetPtAxis, partZAxis}, true); @@ -2209,7 +2211,9 @@ struct JetFragmentation { registry.fill(HIST("matching/jets/V0/matchDetJetPtV0TrackProjPartJetPtV0TrackProj"), detJet.pt(), detTrackProj, partJet.pt(), partTrackProj, weight); registry.fill(HIST("matching/jets/V0/partJetPtV0PtDetJetPtV0Pt"), partJet.pt(), particle.pt(), detJet.pt(), v0.pt(), weight); registry.fill(HIST("matching/jets/V0/partJetPtV0PtDetPt"), partJet.pt(), particle.pt(), detJet.pt(), weight); - registry.fill(HIST("matching/jets/V0/partJetPtDetJetPtPartV0PtRatioPtRelDiffPt"), partJet.pt(), detJet.pt(), particle.pt(), v0.pt() / particle.pt(), (v0.pt() - particle.pt()) / particle.pt(), weight); + // registry.fill(HIST("matching/jets/V0/partJetPtDetJetPtPartV0PtRatioPtRelDiffPt"), partJet.pt(), detJet.pt(), particle.pt(), v0.pt() / particle.pt(), (v0.pt() - particle.pt()) / particle.pt(), weight); + registry.fill(HIST("matching/jets/V0/partJetPtDetJetPtPartV0PtRelDiffPt"), partJet.pt(), detJet.pt(), particle.pt(), (v0.pt() - particle.pt()) / particle.pt(), weight); + registry.fill(HIST("matching/jets/V0/partJetPtDetJetPtPartV0ZRelDiffZ"), partJet.pt(), detJet.pt(), partTrackProj, (detTrackProj - partTrackProj) / partTrackProj, weight); registry.fill(HIST("matching/jets/V0/partJetPtV0PtDetJetPtV0PtCtauLambda"), partJet.pt(), particle.pt(), detJet.pt(), v0.pt(), ctauLambda, weight); registry.fill(HIST("matching/jets/V0/partJetPtV0PtDetJetPtV0PtCtauAntiLambda"), partJet.pt(), particle.pt(), detJet.pt(), v0.pt(), ctauAntiLambda, weight); diff --git a/PWGJE/Tasks/v0QA.cxx b/PWGJE/Tasks/v0QA.cxx index fe4cb4f57eb..353869e4644 100644 --- a/PWGJE/Tasks/v0QA.cxx +++ b/PWGJE/Tasks/v0QA.cxx @@ -341,6 +341,14 @@ struct V0QA { registry.add("sharing/JetPtEtaAntiLambdaPt", "JetPtEtaAntiLambdaPt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); registry.add("sharing/JetPtEtaV0PtPt", "JetPtEtaV0PtPt", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisV0Pt}); registry.add("sharing/JetPtEtaV0PtPtDaughterPt", "JetPtEtaV0PtPtDaughterPt", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisV0Pt, axisV0Pt}); + + registry.add("sharing/JetPtEtaV0Z", "JetPtEtaV0Z", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); + registry.add("sharing/JetPtEtaK0SZ", "JetPtEtaK0SZ", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); + registry.add("sharing/JetPtEtaLambdaZ", "JetPtEtaLambdaZ", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); + registry.add("sharing/JetPtEtaAntiLambdaZ", "JetPtEtaAntiLambdaZ", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); + registry.add("sharing/JetPtEtaV0ZZ", "JetPtEtaV0ZZ", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Z, axisV0Z}); + registry.add("sharing/JetPtEtaV0ZZDaughterPt", "JetPtEtaV0ZZDaughterPt", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Z, axisV0Z, axisV0Pt}); + registry.add("sharing/JetK0SK0S", "JetK0SK0S", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisV0Pt}); registry.add("sharing/JetK0SLambda", "JetK0SLambda", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisV0Pt}); registry.add("sharing/JetK0SAntiLambda", "JetK0SAntiLambda", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisV0Pt}); @@ -933,13 +941,21 @@ struct V0QA { template void fillV0DaughterSharingJet(T const& jet, U const& v0) { + double z = v0.pt() / jet.pt(); registry.fill(HIST("sharing/JetPtEtaV0Pt"), jet.pt(), jet.eta(), v0.pt()); - if (v0.isK0SCandidate()) + registry.fill(HIST("sharing/JetPtEtaV0Z"), jet.pt(), jet.eta(), z); + if (v0.isK0SCandidate()) { registry.fill(HIST("sharing/JetPtEtaK0SPt"), jet.pt(), jet.eta(), v0.pt()); - if (v0.isLambdaCandidate()) + registry.fill(HIST("sharing/JetPtEtaK0SZ"), jet.pt(), jet.eta(), z); + } + if (v0.isLambdaCandidate()) { registry.fill(HIST("sharing/JetPtEtaLambdaPt"), jet.pt(), jet.eta(), v0.pt()); - if (v0.isAntiLambdaCandidate()) + registry.fill(HIST("sharing/JetPtEtaLambdaZ"), jet.pt(), jet.eta(), z); + } + if (v0.isAntiLambdaCandidate()) { registry.fill(HIST("sharing/JetPtEtaAntiLambdaPt"), jet.pt(), jet.eta(), v0.pt()); + registry.fill(HIST("sharing/JetPtEtaAntiLambdaZ"), jet.pt(), jet.eta(), z); + } } template @@ -955,7 +971,11 @@ struct V0QA { ptsoft = trigger.pt(); } + double zhard = pthard / jet.pt(); + double zsoft = ptsoft / jet.pt(); + registry.fill(HIST("sharing/JetPtEtaV0PtPt"), jet.pt(), jet.eta(), pthard, ptsoft, weight); + registry.fill(HIST("sharing/JetPtEtaV0ZZ"), jet.pt(), jet.eta(), zhard, zsoft, weight); auto trigNeg = trigger.template negTrack_as().template track_as(); auto trigPos = trigger.template posTrack_as().template track_as(); auto assocNeg = associate.template negTrack_as().template track_as(); @@ -965,7 +985,9 @@ struct V0QA { sharedDaughterPt = trigNeg.pt(); else sharedDaughterPt = trigPos.pt(); + registry.fill(HIST("sharing/JetPtEtaV0PtPtDaughterPt"), jet.pt(), jet.eta(), pthard, ptsoft, sharedDaughterPt, weight); + registry.fill(HIST("sharing/JetPtEtaV0ZZDaughterPt"), jet.pt(), jet.eta(), zhard, zsoft, sharedDaughterPt, weight); if (trigger.isK0SCandidate() && associate.isK0SCandidate()) registry.fill(HIST("sharing/JetK0SK0S"), jet.pt(), jet.eta(), pthard, ptsoft, weight); From 921cb245f8a27688bea3d5d37282c4880737f6d7 Mon Sep 17 00:00:00 2001 From: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Date: Tue, 28 Oct 2025 20:27:25 +0100 Subject: [PATCH 927/986] [PWGCF] add run-by-run NUA output (#13570) --- PWGCF/Flow/Tasks/flowTask.cxx | 36 +++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowTask.cxx b/PWGCF/Flow/Tasks/flowTask.cxx index bf36bfb11de..f24c5a0f9fe 100644 --- a/PWGCF/Flow/Tasks/flowTask.cxx +++ b/PWGCF/Flow/Tasks/flowTask.cxx @@ -45,9 +45,11 @@ #include #include +#include #include #include #include +#include #include using namespace o2; @@ -100,6 +102,7 @@ struct FlowTask { O2_DEFINE_CONFIGURABLE(cfgNbootstrap, int, 30, "Number of subsamples") O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeights, bool, false, "Fill and output NUA weights") O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeightsRefPt, bool, false, "NUA weights are filled in ref pt bins") + O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeightsRunbyRun, bool, false, "NUA weights are filled run-by-run") O2_DEFINE_CONFIGURABLE(cfgEfficiency, std::string, "", "CCDB path to efficiency object") O2_DEFINE_CONFIGURABLE(cfgAcceptance, std::string, "", "CCDB path to acceptance object") O2_DEFINE_CONFIGURABLE(cfgUseSmallMemory, bool, false, "Use small memory mode") @@ -198,6 +201,9 @@ struct FlowTask { std::vector corrconfigsPtVn; TAxis* fPtAxis; TRandom3* fRndm = new TRandom3(0); + int lastRunNumber = -1; + std::vector runNumbers; + std::map> th3sPerRun; // map of TH3 histograms for all runs enum CentEstimators { kCentFT0C = 0, kCentFT0CVariant1, @@ -478,7 +484,7 @@ struct FlowTask { gfwConfigs.SetCorrs(cfgUserPtVnCorrConfig->GetCorrs()); gfwConfigs.SetHeads(cfgUserPtVnCorrConfig->GetHeads()); gfwConfigs.SetpTDifs(cfgUserPtVnCorrConfig->GetpTDifs()); - // Mask 1: vn-[pT], 2: vn-[pT^2], 4: vn-[pT^3] + // Mask 1: vn-[pT], 3: vn-[pT^2], 7: vn-[pT^3], 15: vn-[pT^4] gfwConfigs.SetpTCorrMasks(cfgUserPtVnCorrConfig->GetpTCorrMasks()); gfwConfigs.Print(); fFCpt->setUseCentralMoments(cfgUseCentralMoments); @@ -545,6 +551,13 @@ struct FlowTask { } } + void createOutputObjectsForRun(int runNumber) + { + const AxisSpec axisPhi{60, 0.0, constants::math::TwoPI, "#varphi"}; + std::shared_ptr histPhiEtaVtxz = registry.add(Form("%d/hPhiEtaVtxz", runNumber), ";#varphi;#eta;v_{z}", {HistType::kTH3D, {axisPhi, {64, -1.6, 1.6}, {40, -10, 10}}}); + th3sPerRun.insert(std::make_pair(runNumber, histPhiEtaVtxz)); + } + template void fillProfile(const GFW::CorrConfig& corrconf, const ConstStr& tarName, const double& cent) { @@ -874,6 +887,20 @@ struct FlowTask { return; } } + if (cfgOutputNUAWeightsRunbyRun && currentRunNumber != lastRunNumber) { + lastRunNumber = currentRunNumber; + if (std::find(runNumbers.begin(), runNumbers.end(), currentRunNumber) == runNumbers.end()) { + // if run number is not in the preconfigured list, create new output histograms for this run + createOutputObjectsForRun(currentRunNumber); + runNumbers.push_back(currentRunNumber); + } + + if (th3sPerRun.find(currentRunNumber) == th3sPerRun.end()) { + LOGF(fatal, "RunNumber %d not found in th3sPerRun", currentRunNumber); + return; + } + } + registry.fill(HIST("hEventCount"), 2.5); if (!cfgUseSmallMemory) { registry.fill(HIST("BeforeCut_globalTracks_centT0C"), collision.centFT0C(), tracks.size()); @@ -975,10 +1002,15 @@ struct FlowTask { bool withinEtaGap08 = (std::abs(track.eta()) < cfgEtaPtPt); if (cfgOutputNUAWeights) { if (cfgOutputNUAWeightsRefPt) { - if (withinPtRef) + if (withinPtRef) { fWeights->fill(track.phi(), track.eta(), vtxz, track.pt(), cent, 0); + if (cfgOutputNUAWeightsRunbyRun) + th3sPerRun[currentRunNumber]->Fill(track.phi(), track.eta(), collision.posZ()); + } } else { fWeights->fill(track.phi(), track.eta(), vtxz, track.pt(), cent, 0); + if (cfgOutputNUAWeightsRunbyRun) + th3sPerRun[currentRunNumber]->Fill(track.phi(), track.eta(), collision.posZ()); } } if (!setCurrentParticleWeights(weff, wacc, track.phi(), track.eta(), track.pt(), vtxz)) From 85ac022f2b08f68ab2590afbbb3764ad30ef89aa Mon Sep 17 00:00:00 2001 From: ilikmeta <152337132+ilikmeta@users.noreply.github.com> Date: Tue, 28 Oct 2025 17:11:50 -0500 Subject: [PATCH 928/986] [PWGCF] Add c34 cummulant (#13580) --- PWGCF/Flow/Tasks/flowGfwTask.cxx | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowGfwTask.cxx b/PWGCF/Flow/Tasks/flowGfwTask.cxx index c174711c4ab..868d53197e4 100644 --- a/PWGCF/Flow/Tasks/flowGfwTask.cxx +++ b/PWGCF/Flow/Tasks/flowGfwTask.cxx @@ -91,7 +91,7 @@ struct FlowGfwTask { O2_DEFINE_CONFIGURABLE(cfgEfficiencyNch, std::string, "", "CCDB path to Nch efficiency object") O2_DEFINE_CONFIGURABLE(cfgAcceptance, std::string, "", "CCDB path to acceptance object") O2_DEFINE_CONFIGURABLE(cfgMagnetField, std::string, "GLO/Config/GRPMagField", "CCDB path to Magnet field object") - O2_DEFINE_CONFIGURABLE(cfgDCAzPt, bool, true, "switch for DCAz pt dependent") + O2_DEFINE_CONFIGURABLE(cfgDCAzPt, bool, false, "switch for DCAz pt dependent") O2_DEFINE_CONFIGURABLE(cfgTrackSelRun3ITSMatch, bool, false, "Track selection for ITS matches") O2_DEFINE_CONFIGURABLE(cfgUseAdditionalEventCut, bool, false, "Use additional event cut on mult correlations") O2_DEFINE_CONFIGURABLE(cfgUseAdditionalTrackCut, bool, false, "Use additional track cut on phi") @@ -104,12 +104,12 @@ struct FlowGfwTask { O2_DEFINE_CONFIGURABLE(cfgNoCollInTimeRangeStandard, bool, false, "kNoCollInTimeRangeStandard"); O2_DEFINE_CONFIGURABLE(cfgEvSelkIsGoodITSLayersAll, bool, false, "kIsGoodITSLayersAll") O2_DEFINE_CONFIGURABLE(cfgMultCut, bool, false, "Use additional event cut on mult correlations"); - O2_DEFINE_CONFIGURABLE(cfgV0AT0A5Sigma, bool, false, "V0A T0A 5 sigma cut") + O2_DEFINE_CONFIGURABLE(cfgV0AT0ANSigma, bool, false, "V0A T0A n sigma cut") + O2_DEFINE_CONFIGURABLE(cfgNSigma, float, 5.0f, "N sigma cut") O2_DEFINE_CONFIGURABLE(cfgGlobalTracks, bool, false, "Global tracks") O2_DEFINE_CONFIGURABLE(cfgGlobalplusITS, bool, false, "Global and ITS tracks") O2_DEFINE_CONFIGURABLE(cfgGlobalonly, bool, false, "Global only tracks") O2_DEFINE_CONFIGURABLE(cfgITSonly, bool, false, "ITS only tracks") - O2_DEFINE_CONFIGURABLE(cfgFineBinning, bool, false, "Manually change to fine binning") ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for histograms"}; ConfigurableAxis axisPhi{"axisPhi", {60, 0.0, constants::math::TwoPI}, "phi axis for histograms"}; @@ -190,6 +190,7 @@ struct FlowGfwTask { kc34Nch05, kc22etagapft0c, kc32etagapft0c, + kc34ft0c, // Count the total number of enum kCount_ExtraProfile @@ -407,6 +408,7 @@ struct FlowGfwTask { registry.add("c22etagapft0c", ";FT0C Amplitude ; C_{2}{2} (|#eta| < 0.8) ", {HistType::kTProfile, {axisFT0CAmp}}); registry.add("c32etagapft0c", ";FT0C Amplitude ; C_{3}{2} (|#eta| < 0.8) ", {HistType::kTProfile, {axisFT0CAmp}}); + registry.add("c34etagapft0c", ";FT0C Amplitude ; C_{3}{4} (|#eta| < 0.8) ", {HistType::kTProfile, {axisFT0CAmp}}); } // End doprocessData const AxisSpec axisZpos{48, -12., 12., "Vtx_{z} (cm)"}; @@ -490,6 +492,7 @@ struct FlowGfwTask { bootstrapArray[i][kc22etagapft0c] = registry.add(Form("BootstrapContainer_%d/c22etagapftoc", i), ";FT0C Amplitude ; C_{2}{2} (|#eta| < 0.8)", {HistType::kTProfile, {axisFT0CAmp}}); bootstrapArray[i][kc32etagapft0c] = registry.add(Form("BootstrapContainer_%d/c32etagapftoc", i), ";FT0C Amplitude ; C_{3}{2} (|#eta| < 0.8)", {HistType::kTProfile, {axisFT0CAmp}}); + bootstrapArray[i][kc34ft0c] = registry.add(Form("BootstrapContainer_%d/c34etagapftoc", i), ";FT0C Amplitude ; C_{3}{4} (|#eta| < 0.8)", {HistType::kTProfile, {axisFT0CAmp}}); } o2::framework::AxisSpec axis = axisPt; @@ -753,10 +756,9 @@ struct FlowGfwTask { registry.fill(HIST("hEventCount"), kAFTERMULTCUTS); } - // V0A T0A 5 sigma cut - float five = 5; - if (cfgV0AT0A5Sigma) { - if (std::abs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > five * fT0AV0ASigma->Eval(collision.multFT0A())) + // V0A T0A N sigma cut + if (cfgV0AT0ANSigma) { + if (std::abs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > cfgNSigma * fT0AV0ASigma->Eval(collision.multFT0A())) return false; } @@ -1061,9 +1063,6 @@ struct FlowGfwTask { } } - if (cfgFineBinning) - fGFW->Fill(track.eta(), 1, track.phi(), wacc * weff, 1); - } // End of track loop // Only one type of track will be plotted @@ -1102,9 +1101,10 @@ struct FlowGfwTask { fillProfile(corrconfigs.at(7), HIST("c34Nch05"), nch); } - // C22 and C32 vs FT0C amplitude + // C22, C32 and C34 vs FT0C amplitude fillProfile(corrconfigs.at(4), HIST("c22etagapft0c"), ft0cAmp); fillProfile(corrconfigs.at(6), HIST("c32etagapft0c"), ft0cAmp); + fillProfile(corrconfigs.at(7), HIST("c34etagapft0c"), ft0cAmp); // Filling Bootstrap Samples int sampleIndex = static_cast(cfgNbootstrap * lRandom); @@ -1144,6 +1144,7 @@ struct FlowGfwTask { // Filling Bootstrap Samples for FT0C Amplitudes fillProfile(corrconfigs.at(4), bootstrapArray[sampleIndex][kc22etagapft0c], ft0cAmp); fillProfile(corrconfigs.at(6), bootstrapArray[sampleIndex][kc32etagapft0c], ft0cAmp); + fillProfile(corrconfigs.at(7), bootstrapArray[sampleIndex][kc34ft0c], ft0cAmp); // Filling Flow Container for (uint l_ind = 0; l_ind < corrconfigs.size(); l_ind++) { From 944369ff747465007b937be33eb17d40d914be4a Mon Sep 17 00:00:00 2001 From: Yash Patley <52608802+yashpatley@users.noreply.github.com> Date: Wed, 29 Oct 2025 06:02:55 +0530 Subject: [PATCH 929/986] [PWGCF] : Update flowEventPlane.cxx (#13578) --- PWGCF/Flow/Tasks/flowEventPlane.cxx | 196 ++++++++++++++++------------ 1 file changed, 112 insertions(+), 84 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowEventPlane.cxx b/PWGCF/Flow/Tasks/flowEventPlane.cxx index 4ecf63f0022..c8808264361 100644 --- a/PWGCF/Flow/Tasks/flowEventPlane.cxx +++ b/PWGCF/Flow/Tasks/flowEventPlane.cxx @@ -84,8 +84,12 @@ struct FlowEventPlane { Configurable cTrackDcaXYCut{"cTrackDcaXYCut", 0.1, "DcaXY Cut"}; Configurable cTrackDcaZCut{"cTrackDcaZCut", 1., "DcaXY Cut"}; + // Gain calibration + Configurable cDoGainCalib{"cDoGainCalib", false, "Gain Calib Flag"}; + Configurable cUseAlphaZDC{"cUseAlphaZDC", true, "Use Alpha ZDC"}; + // Coarse binning factor - Configurable cAxisCBF{"cAxisCBF", 1, "Coarse Bin Factor"}; + Configurable cAxisCBF{"cAxisCBF", 5, "Coarse Bin Factor"}; // Cent Vx Vy Vz Bins Configurable cAxisCentBins{"cAxisCentBins", 20, "NBins Centrality"}; @@ -97,6 +101,7 @@ struct FlowEventPlane { Configurable cAxisVyMax{"cAxisVyMax", 0.006, "Vy Max"}; // Corrections + Configurable cApplyRecentCorr{"cApplyRecentCorr", false, "Apply recentering"}; Configurable> cCorrFlagVector{"cCorrFlagVector", {0, 0, 0, 0, 0, 0}, "Correction Flag"}; // CCDB @@ -110,14 +115,9 @@ struct FlowEventPlane { HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; // Global objects + const float zdcDenThrs = 1e-4; float cent = 0., mult = 0.; float posX = 0., posY = 0., posZ = 0.; - - std::array znaXWeigthEnergy = {1., 1., 1., 1.}; - std::array znaYWeigthEnergy = {1., 1., 1., 1.}; - std::array zncXWeigthEnergy = {1., 1., 1., 1.}; - std::array zncYWeigthEnergy = {1., 1., 1., 1.}; - std::vector> vCoarseCorrHistNames = { {"hXZNAVsCentVxVyVz"}, {"hYZNAVsCentVxVyVz"}, @@ -128,18 +128,8 @@ struct FlowEventPlane { {"hYZNAVsCent", "hYZNAVsVx", "hYZNAVsVy", "hYZNAVsVz"}, {"hXZNCVsCent", "hXZNCVsVx", "hXZNCVsVy", "hXZNCVsVz"}, {"hYZNCVsCent", "hYZNCVsVx", "hYZNCVsVy", "hYZNCVsVz"}}; - - // Map for Correction Type and Histogram Names std::map>> corrTypeHistNameMap = {{kFineCorr, vFineCorrHistNames}, {kCoarseCorr, vCoarseCorrHistNames}}; - // Structure to hold CCDB objects - struct CcdbObjects { - TList* ccdbList; - TObject* obj; - TProfile* hp; - THnSparseF* hn; - } ccdbObjects; - void init(InitContext const&) { // Set CCDB url @@ -185,14 +175,12 @@ struct FlowEventPlane { histos.add("Event/hVx", "V_{x}", kTH1F, {axisVx}); histos.add("Event/hVy", "V_{y}", kTH1F, {axisVy}); histos.add("Event/hVz", "V_{z}", kTH1F, {axisVz}); - histos.add("QA/hZNASignalSector1", "ZNA Signal Sector 1", kTH1F, {axisZDCEnergy}); - histos.add("QA/hZNASignalSector2", "ZNA Signal Sector 2", kTH1F, {axisZDCEnergy}); - histos.add("QA/hZNASignalSector3", "ZNA Signal Sector 3", kTH1F, {axisZDCEnergy}); - histos.add("QA/hZNASignalSector4", "ZNA Signal Sector 4", kTH1F, {axisZDCEnergy}); - histos.add("QA/hZNCSignalSector1", "ZNC Signal Sector 1", kTH1F, {axisZDCEnergy}); - histos.add("QA/hZNCSignalSector2", "ZNC Signal Sector 2", kTH1F, {axisZDCEnergy}); - histos.add("QA/hZNCSignalSector3", "ZNC Signal Sector 3", kTH1F, {axisZDCEnergy}); - histos.add("QA/hZNCSignalSector4", "ZNC Signal Sector 4", kTH1F, {axisZDCEnergy}); + histos.add("QA/GainCalib/hZNASignal", "ZNA Signal", kTH2F, {{4, 0, 4}, {axisZDCEnergy}}); + histos.add("QA/GainCalib/hZNCSignal", "ZNC Signal", kTH2F, {{4, 0, 4}, {axisZDCEnergy}}); + histos.add("QA/hZNASignal", "ZNA Signal", kTProfile2D, {{4, 0, 4}, {axisVz}}); + histos.add("QA/hZNCSignal", "ZNC Signal", kTProfile2D, {{4, 0, 4}, {axisVz}}); + histos.add("QA/hZNAEnergyCommon", "ZNA Energy Common", kTProfile, {axisVz}); + histos.add("QA/hZNCEnergyCommon", "ZNC Energy Common", kTProfile, {axisVz}); histos.add("CorrHist/hWtXZNA", "X^{ZNA}_{1}", kTHnSparseF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); histos.add("CorrHist/hWtYZNA", "Y^{ZNA}_{1}", kTHnSparseF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); histos.add("CorrHist/hWtXZNC", "X^{ZNC}_{1}", kTHnSparseF, {axisCoarseCent, axisCoarseVx, axisCoarseVy, axisCoarseVz}); @@ -221,17 +209,19 @@ struct FlowEventPlane { histos.add("Checks/hPsiSPC", "#Psi_{SP}^{C} distribution", kTH2F, {axisCent, axisPsi}); histos.add("Checks/hCosPsiSPAC", "Cos(#Psi_{SP}^{A} #minus #Psi_{SP}^{C}) distribution", kTProfile, {axisCent}); histos.add("Checks/hSinPsiSPAC", "Sin(#Psi_{SP}^{A} #minus #Psi_{SP}^{C}) distribution", kTProfile, {axisCent}); - histos.add("Checks/hXaXc", "X^{ZNC}_{1} Vs X^{ZNA}_{1}", kTProfile, {axisCent}); - histos.add("Checks/hYaYc", "Y^{ZNC}_{1} Vs Y^{ZNA}_{1}", kTProfile, {axisCent}); + histos.add("Checks/hXaXc", "X^{A}_{1}X^{C}_{1}", kTProfile, {axisCent}); + histos.add("Checks/hYaYc", "Y^{A}_{1}Y^{C}_{1}", kTProfile, {axisCent}); + histos.add("Checks/hXaYc", "X^{A}_{1}Y^{C}_{1}", kTProfile, {axisCent}); + histos.add("Checks/hYaXc", "Y^{A}_{1}X^{C}_{1}", kTProfile, {axisCent}); histos.add("TrackQA/hPtDcaXY", "DCA_{XY} vs p_{T}", kTH2F, {axisTrackPt, axisTrackDcaXY}); histos.add("TrackQA/hPtDcaZ", "DCA_{Z} vs p_{T}", kTH2F, {axisTrackPt, axisTrackDcaZ}); histos.add("DF/hQaQc", "X^{A}_{1}X^{C}_{1} + Y^{A}_{1}Y^{C}_{1}", kTProfile, {axisCent}); - histos.add("DF/hAQu", "u_{x}X^{A}_{1} + u_{y}Y^{A}_{1}", kTH3F, {axisCent, axisV1, axisTrackEta}); - histos.add("DF/hCQu", "u_{x}X^{C}_{1} + u_{y}Y^{C}_{1}", kTH3F, {axisCent, axisV1, axisTrackEta}); - histos.add("DF/hAQuPos", "u_{x}X^{A}_{1} + u_{y}Y^{A}_{1}", kTH3F, {axisCent, axisV1, axisTrackEta}); - histos.add("DF/hCQuPos", "u_{x}X^{C}_{1} + u_{y}Y^{C}_{1}", kTH3F, {axisCent, axisV1, axisTrackEta}); - histos.add("DF/hAQuNeg", "u_{x}X^{A}_{1} + u_{y}Y^{A}_{1}", kTH3F, {axisCent, axisV1, axisTrackEta}); - histos.add("DF/hCQuNeg", "u_{x}X^{C}_{1} + u_{y}Y^{C}_{1}", kTH3F, {axisCent, axisV1, axisTrackEta}); + histos.add("DF/hAQu", "u_{x}X^{A}_{1} + u_{y}Y^{A}_{1}", kTProfile2D, {axisCent, axisTrackEta}); + histos.add("DF/hCQu", "u_{x}X^{C}_{1} + u_{y}Y^{C}_{1}", kTProfile2D, {axisCent, axisTrackEta}); + histos.add("DF/hAQuPos", "u_{x}X^{A}_{1} + u_{y}Y^{A}_{1}", kTProfile2D, {axisCent, axisTrackEta}); + histos.add("DF/hCQuPos", "u_{x}X^{C}_{1} + u_{y}Y^{C}_{1}", kTProfile2D, {axisCent, axisTrackEta}); + histos.add("DF/hAQuNeg", "u_{x}X^{A}_{1} + u_{y}Y^{A}_{1}", kTProfile2D, {axisCent, axisTrackEta}); + histos.add("DF/hCQuNeg", "u_{x}X^{C}_{1} + u_{y}Y^{C}_{1}", kTProfile2D, {axisCent, axisTrackEta}); } template @@ -307,6 +297,23 @@ struct FlowEventPlane { return true; } + void gainCalib(float const& vz, int const& runNumber, std::array& energy, const char* histName = "hZNAEnergy") + { + // Set CCDB path + std::string ccdbPath = static_cast(cCcdbPath) + "/GainCalib" + "/Run" + std::to_string(runNumber); + + // Get object from CCDB + auto ccdbObj = ccdbService->getForTimeStamp(ccdbPath, -1); + + // Get gain calibration + TH2F* h = reinterpret_cast(ccdbObj->FindObject(histName)); + float v = 0.; + for (int i = 0; i < static_cast(energy.size()); ++i) { + v = h->GetBinContent(h->FindBin(i + 0.5, vz + 0.00001)); + energy[i] *= v; + } + } + template std::vector getAvgCorrFactors(const C& ccdbObject, const F& corrType, const std::vector& vCollParam) { @@ -317,18 +324,15 @@ struct FlowEventPlane { for (auto const& x : vHistNames) { int cntry = 0; for (auto const& y : x) { - ccdbObjects.obj = reinterpret_cast(ccdbObject->FindObject(y.c_str())); if (corrType == kFineCorr) { - ccdbObjects.hp = reinterpret_cast(ccdbObjects.obj->Clone()); - vAvgOutput[cntrx] += ccdbObjects.hp->GetBinContent(ccdbObjects.hp->GetXaxis()->FindBin(vCollParam[cntry])); - delete ccdbObjects.hp; + TProfile* hp = reinterpret_cast(ccdbObject->FindObject(y.c_str())); + vAvgOutput[cntrx] += hp->GetBinContent(hp->GetXaxis()->FindBin(vCollParam[cntry])); } else { - ccdbObjects.hn = reinterpret_cast(ccdbObjects.obj->Clone()); + THnSparseF* hn = reinterpret_cast(ccdbObject->FindObject(y.c_str())); for (int i = 0; i < static_cast(vHistNames.size()); ++i) { - binarray[i] = ccdbObjects.hn->GetAxis(i)->FindBin(vCollParam[i]); + binarray[i] = hn->GetAxis(i)->FindBin(vCollParam[i]); } - vAvgOutput[cntrx] += ccdbObjects.hn->GetBinContent(ccdbObjects.hn->GetBin(binarray)); - delete ccdbObjects.hn; + vAvgOutput[cntrx] += hn->GetBinContent(hn->GetBin(binarray)); } ++cntry; } @@ -337,7 +341,7 @@ struct FlowEventPlane { return vAvgOutput; } - void applyCorrection(const std::vector inputParam, const int& runNumber, std::vector& outputParam) + void applyCorrection(const std::vector& inputParam, const int& runNumber, std::vector& outputParam) { std::vector vCorrFlags = static_cast>(cCorrFlagVector); int nitr = vCorrFlags.size(); @@ -361,16 +365,16 @@ struct FlowEventPlane { ccdbPath = static_cast(cCcdbPath) + "/CorrItr_" + std::to_string(i + 1) + "/Run" + std::to_string(runNumber); // Get object from CCDB - ccdbObjects.ccdbList = ccdbService->getForTimeStamp(ccdbPath, -1); + auto ccdbObj = ccdbService->getForTimeStamp(ccdbPath, -1); // Check CCDB Object - if (!ccdbObjects.ccdbList) { + if (!ccdbObj) { LOGF(warning, "CCDB OBJECT NOT FOUND"); return; } // Get averages - std::vector vAvg = getAvgCorrFactors(ccdbObjects.ccdbList, corrType, inputParam); + std::vector vAvg = getAvgCorrFactors(ccdbObj, corrType, inputParam); // Apply correction outputParam[kXa] -= vAvg[kXa]; @@ -437,6 +441,7 @@ struct FlowEventPlane { // Get bunch crossing auto bc = collision.foundBC_as(); + int runNumber = collision.foundBC_as().runNumber(); // check zdc if (!bc.has_zdc()) { @@ -454,59 +459,82 @@ struct FlowEventPlane { return; } - // Fill QA histograms - histos.fill(HIST("QA/hZNASignalSector1"), znaEnergy[0]); - histos.fill(HIST("QA/hZNASignalSector2"), znaEnergy[1]); - histos.fill(HIST("QA/hZNASignalSector3"), znaEnergy[2]); - histos.fill(HIST("QA/hZNASignalSector4"), znaEnergy[3]); - histos.fill(HIST("QA/hZNCSignalSector1"), zncEnergy[0]); - histos.fill(HIST("QA/hZNCSignalSector2"), zncEnergy[1]); - histos.fill(HIST("QA/hZNCSignalSector3"), zncEnergy[2]); - histos.fill(HIST("QA/hZNCSignalSector4"), zncEnergy[3]); - - /*auto alphaZDC = 0.395;*/ + // Fill gain calib histograms + for (int iCh = 0; iCh < kXYAC; ++iCh) { + histos.fill(HIST("QA/hZNASignal"), iCh + 0.5, vCollParam[kVz], znaEnergy[iCh]); + histos.fill(HIST("QA/hZNCSignal"), iCh + 0.5, vCollParam[kVz], zncEnergy[iCh]); + histos.fill(HIST("QA/hZNAEnergyCommon"), vCollParam[kVz], znaEnergyCommon); + histos.fill(HIST("QA/hZNCEnergyCommon"), vCollParam[kVz], zncEnergyCommon); + } + + // Do gain calibration + if (cDoGainCalib) { + gainCalib(vCollParam[kVz], runNumber, znaEnergy, "hZNASignal"); + gainCalib(vCollParam[kVz], runNumber, zncEnergy, "hZNCSignal"); + } + + // Fill zdc signal + for (int iCh = 0; iCh < kXYAC; ++iCh) { + histos.fill(HIST("QA/GainCalib/hZNASignal"), iCh + 0.5, znaEnergy[iCh]); + histos.fill(HIST("QA/GainCalib/hZNCSignal"), iCh + 0.5, zncEnergy[iCh]); + } + + auto alphaZDC = 0.395; const double x[4] = {-1.75, 1.75, -1.75, 1.75}; const double y[4] = {-1.75, -1.75, 1.75, 1.75}; // Calculate X and Y - float znaXSumNum = 0., znaXSumDnm = 0.; - float znaYSumNum = 0., znaYSumDnm = 0.; - float zncXSumNum = 0., zncXSumDnm = 0.; - float zncYSumNum = 0., zncYSumDnm = 0.; + float znaXNum = 0., znaYNum = 0., zncXNum = 0., zncYNum = 0.; + float znaDen = 0., zncDen = 0.; + float znaWt = 0., zncWt = 0.; // Loop over zdc sectors for (int i = 0; i < kXYAC; ++i) { - znaXSumNum += znaXWeigthEnergy[i] * znaEnergy[i] * x[i]; - znaYSumNum += znaYWeigthEnergy[i] * znaEnergy[i] * y[i]; - znaXSumDnm += znaXWeigthEnergy[i] * znaEnergy[i]; - znaYSumDnm += znaYWeigthEnergy[i] * znaEnergy[i]; - zncXSumNum += zncXWeigthEnergy[i] * zncEnergy[i] * x[i]; - zncYSumNum += zncYWeigthEnergy[i] * zncEnergy[i] * y[i]; - zncXSumDnm += zncXWeigthEnergy[i] * zncEnergy[i]; - zncYSumDnm += zncYWeigthEnergy[i] * zncEnergy[i]; + if (cUseAlphaZDC) { + znaWt = std::pow(znaEnergy[i], alphaZDC); + zncWt = std::pow(zncEnergy[i], alphaZDC); + } else { + znaWt = znaEnergy[i]; + zncWt = zncEnergy[i]; + } + znaXNum -= znaWt * x[i]; + znaYNum += znaWt * y[i]; + zncXNum += zncWt * x[i]; + zncYNum += zncWt * y[i]; + znaDen += znaWt; + zncDen += zncWt; + } + + if (znaDen < zdcDenThrs || zncDen < zdcDenThrs) { + return; } // Get X and Y for A and C side ZNA std::vector vSP = {0, 0, 0, 0}; - vSP[kXa] = znaXSumNum / znaXSumDnm; - vSP[kYa] = znaYSumNum / znaYSumDnm; - vSP[kXc] = zncXSumNum / zncXSumDnm; - vSP[kYc] = zncYSumNum / zncYSumDnm; + vSP[kXa] = znaXNum / znaDen; + vSP[kYa] = znaYNum / znaDen; + vSP[kXc] = zncXNum / zncDen; + vSP[kYc] = zncYNum / zncDen; // Do corrections - int runNumber = collision.foundBC_as().runNumber(); - applyCorrection(vCollParam, runNumber, vSP); + if (cApplyRecentCorr) { + applyCorrection(vCollParam, runNumber, vSP); + } - // Fill X and Y histograms + // Fill X and Y histograms for corrections after each iteration fillCorrHist(vCollParam, vSP); + + // Evaluate spectator plane angle and [X,Y] correlations float psiA = std::atan2(vSP[kYa], vSP[kXa]); - float psiC = std::atan2(vSP[kYa], vSP[kXa]); - histos.fill(HIST("Checks/hXaXc"), cent, (vSP[kXa] * vSP[kXc])); - histos.fill(HIST("Checks/hYaYc"), cent, (vSP[kYa] * vSP[kYc])); + float psiC = std::atan2(vSP[kYc], vSP[kXc]); histos.fill(HIST("Checks/hPsiSPA"), cent, psiA); histos.fill(HIST("Checks/hPsiSPC"), cent, psiC); histos.fill(HIST("Checks/hCosPsiSPAC"), cent, std::cos(psiA - psiC)); histos.fill(HIST("Checks/hSinPsiSPAC"), cent, std::sin(psiA - psiC)); + histos.fill(HIST("Checks/hXaXc"), cent, (vSP[kXa] * vSP[kXc])); + histos.fill(HIST("Checks/hYaYc"), cent, (vSP[kYa] * vSP[kYc])); + histos.fill(HIST("Checks/hXaYc"), cent, (vSP[kXa] * vSP[kYc])); + histos.fill(HIST("Checks/hYaXc"), cent, (vSP[kYa] * vSP[kXc])); // Directed flow float qac = (vSP[kXa] * vSP[kXc]) + (vSP[kYa] * vSP[kYc]); @@ -530,14 +558,14 @@ struct FlowEventPlane { v1c = ux * vSP[kXc] + uy * vSP[kYc]; // Fill histogram - histos.fill(HIST("DF/hAQu"), cent, v1a, track.eta()); - histos.fill(HIST("DF/hCQu"), cent, v1c, track.eta()); + histos.fill(HIST("DF/hAQu"), cent, track.eta(), v1a); + histos.fill(HIST("DF/hCQu"), cent, track.eta(), v1c); if (track.sign() > 0) { - histos.fill(HIST("DF/hAQuPos"), cent, v1a, track.eta()); - histos.fill(HIST("DF/hCQuPos"), cent, v1c, track.eta()); + histos.fill(HIST("DF/hAQuPos"), cent, track.eta(), v1a); + histos.fill(HIST("DF/hCQuPos"), cent, track.eta(), v1c); } else { - histos.fill(HIST("DF/hAQuNeg"), cent, v1a, track.eta()); - histos.fill(HIST("DF/hCQuNeg"), cent, v1c, track.eta()); + histos.fill(HIST("DF/hAQuNeg"), cent, track.eta(), v1a); + histos.fill(HIST("DF/hCQuNeg"), cent, track.eta(), v1c); } } } From 14ba74c32e10d6d7e1fba856ce4e721bb923d183 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Wed, 29 Oct 2025 01:33:12 +0100 Subject: [PATCH 930/986] [PWGEM/Dilepton] add flexibility of binning (#13582) --- PWGEM/Dilepton/Tasks/createResolutionMap.cxx | 77 ++++++++++---------- 1 file changed, 40 insertions(+), 37 deletions(-) diff --git a/PWGEM/Dilepton/Tasks/createResolutionMap.cxx b/PWGEM/Dilepton/Tasks/createResolutionMap.cxx index 2b59fa8975a..f5fd65d7a74 100644 --- a/PWGEM/Dilepton/Tasks/createResolutionMap.cxx +++ b/PWGEM/Dilepton/Tasks/createResolutionMap.cxx @@ -82,13 +82,15 @@ struct CreateResolutionMap { ConfigurableAxis ConfEtaCBGenBins{"ConfEtaCBGenBins", {30, -1.5, +1.5}, "gen. eta bins at midrapidity for output histograms"}; ConfigurableAxis ConfEtaFWDGenBins{"ConfEtaFWDGenBins", {40, -5.5, -1.5}, "gen. eta bins at forward rapidity for output histograms"}; ConfigurableAxis ConfPhiGenBins{"ConfPhiGenBins", {36, 0, 2.f * M_PI}, "gen. phi bins at forward rapidity for output histograms"}; - ConfigurableAxis ConfPhiPositionCBGenBins{"ConfPhiPositionCBGenBins", {VARIABLE_WIDTH, 2.3 - M_PI, 0.85, 2.3, 0.85 + M_PI, 2.3 + M_PI}, "gen. phi psotion bins at forward rapidity for output histograms"}; // default is adjusted at R = 0.50 m - ConfigurableAxis ConfPhiPositionFWDGenBins{"ConfPhiPositionFWDGenBins", {1, 0, 2 * M_PI}, "gen. phi psotion bins at forward rapidity for output histograms"}; + // ConfigurableAxis ConfPhiPositionCBGenBins{"ConfPhiPositionCBGenBins", {VARIABLE_WIDTH, 2.3 - M_PI, 0.85, 2.3, 0.85 + M_PI, 2.3 + M_PI}, "gen. phi psotion bins at forward rapidity for output histograms"}; // default is adjusted at R = 0.50 m + // ConfigurableAxis ConfPhiPositionFWDGenBins{"ConfPhiPositionFWDGenBins", {1, 0, 2 * M_PI}, "gen. phi psotion bins at forward rapidity for output histograms"}; Configurable cfgRefR{"cfgRefR", 0.50, "ref. radius (m) for calculating phi position"}; // 0.50 +/- 0.06 can be syst. unc. - ConfigurableAxis ConfRelDeltaPtBins{"ConfRelDeltaPtBins", {200, -1.f, +1.f}, "rel. dpt for output histograms"}; - ConfigurableAxis ConfDeltaEtaCBBins{"ConfDeltaEtaCBBins", {200, -0.5f, +0.5f}, "deta bins for output histograms"}; - ConfigurableAxis ConfDeltaEtaFWDBins{"ConfDeltaEtaFWDBins", {200, -0.5f, +0.5f}, "deta bins for output histograms"}; + ConfigurableAxis ConfRelDeltaPtCBBins{"ConfRelDeltaPtCBBins", {200, -1.f, +1.f}, "rel. dpt for output histograms at midrapidity"}; + ConfigurableAxis ConfRelDeltaPtFWDBins{"ConfRelDeltaPtFWDBins", {200, -1.f, +1.f}, "rel. dpt for output histograms at fwd rapidity"}; + + ConfigurableAxis ConfDeltaEtaCBBins{"ConfDeltaEtaCBBins", {200, -0.5f, +0.5f}, "deta bins for output histograms at midrapidity"}; + ConfigurableAxis ConfDeltaEtaFWDBins{"ConfDeltaEtaFWDBins", {200, -0.5f, +0.5f}, "deta bins for output histograms at fwd rapidity"}; ConfigurableAxis ConfDeltaPhiBins{"ConfDeltaPhiBins", {200, -0.5f, +0.5f}, "dphi bins for output histograms"}; Configurable cfgFillTHnSparse{"cfgFillTHnSparse", true, "fill THnSparse for output"}; @@ -193,12 +195,12 @@ struct CreateResolutionMap { o2::dataformats::VertexBase mVtx; const o2::dataformats::MeanVertexObject* mMeanVtx = nullptr; o2::base::MatLayerCylSet* lut = nullptr; - std::vector phiPosition_bin_edges; + // std::vector phiPosition_bin_edges; ~CreateResolutionMap() { - phiPosition_bin_edges.clear(); - phiPosition_bin_edges.shrink_to_fit(); + // phiPosition_bin_edges.clear(); + // phiPosition_bin_edges.shrink_to_fit(); } void init(o2::framework::InitContext&) @@ -224,35 +226,36 @@ struct CreateResolutionMap { d_bz = 0; mBzMFT = 0; - if (ConfPhiPositionCBGenBins.value[0] == VARIABLE_WIDTH) { - phiPosition_bin_edges = std::vector(ConfPhiPositionCBGenBins.value.begin(), ConfPhiPositionCBGenBins.value.end()); - phiPosition_bin_edges.erase(phiPosition_bin_edges.begin()); - // for (const auto& edge : phiPosition_bin_edges) { - // LOGF(info, "VARIABLE_WIDTH: phiPosition_bin_edges = %f", edge); - // } - } else { // FIXED bin width - int nbins = static_cast(ConfPhiPositionCBGenBins.value[0]); - float xmin = static_cast(ConfPhiPositionCBGenBins.value[1]); - float xmax = static_cast(ConfPhiPositionCBGenBins.value[2]); - phiPosition_bin_edges.resize(nbins + 1); - for (int i = 0; i < nbins + 1; i++) { - phiPosition_bin_edges[i] = (xmax - xmin) / (nbins)*i + xmin; - // LOGF(info, "FIXED_WIDTH: phiPosition_bin_edges[%d] = %f", i, phiPosition_bin_edges[i]); - } - } + // if (ConfPhiPositionCBGenBins.value[0] == VARIABLE_WIDTH) { + // phiPosition_bin_edges = std::vector(ConfPhiPositionCBGenBins.value.begin(), ConfPhiPositionCBGenBins.value.end()); + // phiPosition_bin_edges.erase(phiPosition_bin_edges.begin()); + // // for (const auto& edge : phiPosition_bin_edges) { + // // LOGF(info, "VARIABLE_WIDTH: phiPosition_bin_edges = %f", edge); + // // } + // } else { // FIXED bin width + // int nbins = static_cast(ConfPhiPositionCBGenBins.value[0]); + // float xmin = static_cast(ConfPhiPositionCBGenBins.value[1]); + // float xmax = static_cast(ConfPhiPositionCBGenBins.value[2]); + // phiPosition_bin_edges.resize(nbins + 1); + // for (int i = 0; i < nbins + 1; i++) { + // phiPosition_bin_edges[i] = (xmax - xmin) / (nbins)*i + xmin; + // // LOGF(info, "FIXED_WIDTH: phiPosition_bin_edges[%d] = %f", i, phiPosition_bin_edges[i]); + // } + // } const AxisSpec axis_cent{ConfCentBins, "centrality (%)"}; const AxisSpec axis_pt_gen{ConfPtGenBins, "p_{T,l}^{gen} (GeV/c)"}; const AxisSpec axis_eta_cb_gen{ConfEtaCBGenBins, "#eta_{l}^{gen}"}; const AxisSpec axis_eta_fwd_gen{ConfEtaFWDGenBins, "#eta_{l}^{gen}"}; const AxisSpec axis_phi_gen{ConfPhiGenBins, "#varphi_{l}^{gen} (rad.)"}; - const AxisSpec axis_dpt{ConfRelDeltaPtBins, "(p_{T,l}^{gen} - p_{T,l}^{rec})/p_{T,l}^{gen}"}; + const AxisSpec axis_dpt_cb{ConfRelDeltaPtCBBins, "(p_{T,l}^{gen} - p_{T,l}^{rec})/p_{T,l}^{gen}"}; + const AxisSpec axis_dpt_fwd{ConfRelDeltaPtFWDBins, "(p_{T,l}^{gen} - p_{T,l}^{rec})/p_{T,l}^{gen}"}; const AxisSpec axis_deta_cb{ConfDeltaEtaCBBins, "#eta_{l}^{gen} - #eta_{l}^{rec}"}; const AxisSpec axis_deta_fwd{ConfDeltaEtaFWDBins, "#eta_{l}^{gen} - #eta_{l}^{rec}"}; const AxisSpec axis_dphi{ConfDeltaPhiBins, "#varphi_{l}^{gen} - #varphi_{l}^{rec} (rad.)"}; const AxisSpec axis_charge_gen{3, -1.5, +1.5, "true sign"}; - const AxisSpec axis_phiPositionCB_gen{ConfPhiPositionCBGenBins, Form("#varphi^{*, gen} (rad.) at r_{xy} = %3.2f m", cfgRefR.value)}; - const AxisSpec axis_phiPositionFWD_gen{ConfPhiPositionFWDGenBins, "#varphi^{*, gen} (rad.)"}; + // const AxisSpec axis_phiPositionCB_gen{ConfPhiPositionCBGenBins, Form("#varphi^{*, gen} (rad.) at r_{xy} = %3.2f m", cfgRefR.value)}; + // const AxisSpec axis_phiPositionFWD_gen{ConfPhiPositionFWDGenBins, "#varphi^{*, gen} (rad.)"}; // registry.add("Event/Electron/hImpPar_Centrality", "true imapact parameter vs. estimated centrality;impact parameter (fm);centrality (%)", kTH2F, {{200, 0, 20}, {110, 0, 110}}, true); // registry.add("Event/Electron/hImpPar_Centrality", "true imapact parameter vs. estimated centrality;impact parameter (fm);centrality (%)", kTH2F, {{200, 0, 20}, {110, 0, 110}}, true); @@ -262,14 +265,14 @@ struct CreateResolutionMap { if (cfgFillTH2) { registry.add("Electron/hPt", "rec. p_{T,e};p_{T,e} (GeV/c)", kTH1F, {{1000, 0, 10}}, false); registry.add("Electron/hEtaPhi", "rec. #eta vs. #varphi;#varphi_{e} (rad.);#eta_{e}", kTH2F, {{90, 0, 2 * M_PI}, {100, -5, +5}}, false); - registry.add("Electron/Ptgen_RelDeltaPt", "resolution", kTH2F, {{axis_pt_gen}, {axis_dpt}}, true); + registry.add("Electron/Ptgen_RelDeltaPt", "resolution", kTH2F, {{axis_pt_gen}, {axis_dpt_cb}}, true); registry.add("Electron/Ptgen_DeltaEta", "resolution", kTH2F, {{axis_pt_gen}, {axis_deta_cb}}, true); registry.add("Electron/Ptgen_DeltaPhi_Pos", "resolution", kTH2F, {{axis_pt_gen}, {axis_dphi}}, true); registry.add("Electron/Ptgen_DeltaPhi_Neg", "resolution", kTH2F, {{axis_pt_gen}, {axis_dphi}}, true); registry.add("StandaloneMuon/hPt", "rec. p_{T,#mu};p_{T,#mu} (GeV/c)", kTH1F, {{1000, 0, 10}}, false); registry.add("StandaloneMuon/hEtaPhi", "rec. #eta vs. #varphi;#varphi_{#mu} (rad.);#eta_{#mu}", kTH2F, {{90, 0, 2 * M_PI}, {100, -5, +5}}, false); - registry.add("StandaloneMuon/Ptgen_RelDeltaPt", "resolution", kTH2F, {{axis_pt_gen}, {axis_dpt}}, true); + registry.add("StandaloneMuon/Ptgen_RelDeltaPt", "resolution", kTH2F, {{axis_pt_gen}, {axis_dpt_fwd}}, true); registry.add("StandaloneMuon/Ptgen_DeltaEta", "resolution", kTH2F, {{axis_pt_gen}, {axis_deta_fwd}}, true); registry.add("StandaloneMuon/Ptgen_DeltaPhi_Pos", "resolution", kTH2F, {{axis_pt_gen}, {axis_dphi}}, true); registry.add("StandaloneMuon/Ptgen_DeltaPhi_Neg", "resolution", kTH2F, {{axis_pt_gen}, {axis_dphi}}, true); @@ -277,9 +280,9 @@ struct CreateResolutionMap { } if (cfgFillTHnSparse) { - registry.add("Electron/hs_reso", "9D resolution", kTHnSparseF, {axis_cent, axis_pt_gen, axis_eta_cb_gen, axis_phi_gen, axis_phiPositionCB_gen, axis_charge_gen, axis_dpt, axis_deta_cb, axis_dphi}, true); - registry.add("StandaloneMuon/hs_reso", "9D resolution", kTHnSparseF, {axis_cent, axis_pt_gen, axis_eta_fwd_gen, axis_phi_gen, axis_phiPositionFWD_gen, axis_charge_gen, axis_dpt, axis_deta_fwd, axis_dphi}, true); - registry.add("GlobalMuon/hs_reso", "9D resolution", kTHnSparseF, {axis_cent, axis_pt_gen, axis_eta_fwd_gen, axis_phi_gen, axis_phiPositionFWD_gen, axis_charge_gen, axis_dpt, axis_deta_fwd, axis_dphi}, true); + registry.add("Electron/hs_reso", "8D resolution", kTHnSparseF, {axis_cent, axis_pt_gen, axis_eta_cb_gen, axis_phi_gen, axis_charge_gen, axis_dpt_cb, axis_deta_cb, axis_dphi}, true); + registry.add("StandaloneMuon/hs_reso", "8D resolution", kTHnSparseF, {axis_cent, axis_pt_gen, axis_eta_fwd_gen, axis_phi_gen, axis_charge_gen, axis_dpt_fwd, axis_deta_fwd, axis_dphi}, true); + registry.add("GlobalMuon/hs_reso", "8D resolution", kTHnSparseF, {axis_cent, axis_pt_gen, axis_eta_fwd_gen, axis_phi_gen, axis_charge_gen, axis_dpt_fwd, axis_deta_fwd, axis_dphi}, true); } } @@ -697,7 +700,7 @@ struct CreateResolutionMap { return; } if (cfgFillTHnSparse) { - registry.fill(HIST("StandaloneMuon/hs_reso"), centrality, mcparticle.pt(), mcparticle.eta(), mcparticle.phi(), 1.f, -mcparticle.pdgCode() / 13, (mcparticle.pt() - pt) / mcparticle.pt(), mcparticle.eta() - eta, mcparticle.phi() - phi); + registry.fill(HIST("StandaloneMuon/hs_reso"), centrality, mcparticle.pt(), mcparticle.eta(), mcparticle.phi(), -mcparticle.pdgCode() / 13, (mcparticle.pt() - pt) / mcparticle.pt(), mcparticle.eta() - eta, mcparticle.phi() - phi); } if (cfgFillTH2) { @@ -716,7 +719,7 @@ struct CreateResolutionMap { return; } if (cfgFillTHnSparse) { - registry.fill(HIST("GlobalMuon/hs_reso"), centrality, mcparticle.pt(), mcparticle.eta(), mcparticle.phi(), 1.f, -mcparticle.pdgCode() / 13, (mcparticle.pt() - pt) / mcparticle.pt(), mcparticle.eta() - eta, mcparticle.phi() - phi); + registry.fill(HIST("GlobalMuon/hs_reso"), centrality, mcparticle.pt(), mcparticle.eta(), mcparticle.phi(), -mcparticle.pdgCode() / 13, (mcparticle.pt() - pt) / mcparticle.pt(), mcparticle.eta() - eta, mcparticle.phi() - phi); } if (cfgFillTH2) { registry.fill(HIST("GlobalMuon/hPt"), pt); @@ -840,15 +843,15 @@ struct CreateResolutionMap { float phi = trackParCov.getPhi(); o2::math_utils::bringTo02Pi(phi); - float phiPosition = mcparticle.phi() + std::asin(-0.30282 * (-mcparticle.pdgCode() / 11) * (d_bz * 0.1) * cfgRefR / (2.f * mcparticle.pt())); - phiPosition = RecoDecay::constrainAngle(phiPosition, phiPosition_bin_edges[0], 1U); + // float phiPosition = mcparticle.phi() + std::asin(-0.30282 * (-mcparticle.pdgCode() / 11) * (d_bz * 0.1) * cfgRefR / (2.f * mcparticle.pt())); + // phiPosition = RecoDecay::constrainAngle(phiPosition, phiPosition_bin_edges[0], 1U); if (!isSelectedTrackWithKine(track, pt, eta, trackParCov.getTgl(), dcaXY, dcaZ)) { return; } if (cfgFillTHnSparse) { - registry.fill(HIST("Electron/hs_reso"), centrality, mcparticle.pt(), mcparticle.eta(), mcparticle.phi(), phiPosition, -mcparticle.pdgCode() / 11, (mcparticle.pt() - pt) / mcparticle.pt(), mcparticle.eta() - eta, mcparticle.phi() - phi); + registry.fill(HIST("Electron/hs_reso"), centrality, mcparticle.pt(), mcparticle.eta(), mcparticle.phi(), -mcparticle.pdgCode() / 11, (mcparticle.pt() - pt) / mcparticle.pt(), mcparticle.eta() - eta, mcparticle.phi() - phi); } if (cfgFillTH2) { registry.fill(HIST("Electron/hPt"), pt); From b788e245ec8b03c47488dc49e5f6a715c86bfc12 Mon Sep 17 00:00:00 2001 From: nkaratze Date: Wed, 29 Oct 2025 03:58:39 +0100 Subject: [PATCH 931/986] [PWGLF] Fixed same histogram naming bug (#13581) Co-authored-by: nkaratze --- PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx b/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx index fb8fe6a7f21..af5fd131c2a 100644 --- a/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx +++ b/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx @@ -257,8 +257,8 @@ struct V0PtInvMassPlots { rPtAnalysis.add("hK0shDCAPosDaughter", "hK0shDCAPosDaughter", {HistType::kTH1F, {{nBins, 0.0f, 2.2f}}}); rPtAnalysis.add("hK0shDCANegDaughter", "hK0shDCANegDaughter", {HistType::kTH1F, {{nBins, 0.0f, 2.2f}}}); for (int i = 0; i < nmaxHistograms; i++) { - pthistos::kaonPt[i] = rKaonshMassPlotsPerPtBin.add(fmt::format("hPt_from_{0}_to_{1}", kaonhistvalue[i], kaonhistvalue[i + 1]).c_str(), fmt::format("hPt_from_{0}_to_{1}", kaonhistvalue[i], kaonhistvalue[i + 1]).c_str(), {HistType::kTH1D, {{k0ShortMassAxis}}}); - pthistos::kaonSplit[i] = rKaonshSplitMassPlotsPerPtBin.add(fmt::format("hPt_from_{0}_to_{1}", kaonhistvalue[i], kaonhistvalue[i + 1]).c_str(), fmt::format("hPt_from_{0}_to_{1}", kaonhistvalue[i], kaonhistvalue[i + 1]).c_str(), {HistType::kTH1D, {{k0ShortMassAxis}}}); + pthistos::kaonPt[i] = rKaonshMassPlotsPerPtBin.add(fmt::format("hK0shPt_from_{0}_to_{1}", kaonhistvalue[i], kaonhistvalue[i + 1]).c_str(), fmt::format("hK0shPt_from_{0}_to_{1}", kaonhistvalue[i], kaonhistvalue[i + 1]).c_str(), {HistType::kTH1D, {{k0ShortMassAxis}}}); + pthistos::kaonSplit[i] = rKaonshSplitMassPlotsPerPtBin.add(fmt::format("hK0shSplitPt_from_{0}_to_{1}", kaonhistvalue[i], kaonhistvalue[i + 1]).c_str(), fmt::format("hK0shSplitPt_from_{0}_to_{1}", kaonhistvalue[i], kaonhistvalue[i + 1]).c_str(), {HistType::kTH1D, {{k0ShortMassAxis}}}); } rFeeddownMatrices.add("hK0shFeeddownMatrix", "hK0shFeeddownMatrix", {HistType::kTH2F, {{k0ShortPtAxis}, {k0ShortPtAxis}}}); rFeeddownMatrices.add("hK0shPhiFeeddownMatrix", "hK0shPhiFeeddownMatrix", {HistType::kTH2F, {{k0ShortPtAxis}, {k0ShortPtAxis}}}); @@ -268,7 +268,6 @@ struct V0PtInvMassPlots { // same method as in Kzerosh above rPtAnalysis.add("hMassLambdavsCuts", "hMassLambdavsCuts", {HistType::kTH2F, {{partCutsAxis}, {k0ShortMassAxis}}}); rPtAnalysis.add("hArmenterosPodolanskiPlotLambda", "hArmenterosPodolanskiPlotLambda", {HistType::kTH2F, {{armenterosasymAxis}, {armenterosQtAxis}}}); - rPtAnalysis.add("hLambdaAlphaTestPtSpectrum", "hLambdaAlphaTestPtSpectrum", {HistType::kTH1F, {lambdaPtAxis}}); rPtAnalysis.add("hNSigmaPosProtonFromLambdas", "hNSigmaPosProtonFromLambdas", {HistType::kTH2F, {{100, -5.f, 5.f}, {lambdaPtAxis}}}); rPtAnalysis.add("hNSigmaNegPionFromLambdas", "hNSigmaNegPionFromLambdas", {HistType::kTH2F, {{100, -5.f, 5.f}, {lambdaPtAxis}}}); rPtAnalysis.add("hLambdaV0radius", "hLambdaV0radius", {HistType::kTH1F, {{nBins, 0.0f, 50.0f}}}); @@ -277,8 +276,8 @@ struct V0PtInvMassPlots { rPtAnalysis.add("hLambdaDCAPosDaughter", "hLambdaDCAPosDaughter", {HistType::kTH1F, {{nBins, 0.0f, 2.2f}}}); rPtAnalysis.add("hLambdaDCANegDaughter", "hLambdaDCANegDaughter", {HistType::kTH1F, {{nBins, 0.0f, 2.2f}}}); for (int i = 0; i < nmaxHistograms; i++) { - pthistos::lambdaPt[i] = rLambdaMassPlotsPerPtBin.add(fmt::format("hPt_from_{0}_to_{1}", lambdahistvalue[i], lambdahistvalue[i + 1]).c_str(), fmt::format("hPt_from_{0}_to_{1}", lambdahistvalue[i], lambdahistvalue[i + 1]).c_str(), {HistType::kTH1D, {{lambdaMassAxis}}}); - pthistos::lambdaSplit[i] = rLambdaSplitMassPlotsPerPtBin.add(fmt::format("hPt_from_{0}_to_{1}", lambdahistvalue[i], lambdahistvalue[i + 1]).c_str(), fmt::format("hPt_from_{0}_to_{1}", lambdahistvalue[i], lambdahistvalue[i + 1]).c_str(), {HistType::kTH1D, {{lambdaMassAxis}}}); + pthistos::lambdaPt[i] = rLambdaMassPlotsPerPtBin.add(fmt::format("hLambdaPt_from_{0}_to_{1}", lambdahistvalue[i], lambdahistvalue[i + 1]).c_str(), fmt::format("hLambdaPt_from_{0}_to_{1}", lambdahistvalue[i], lambdahistvalue[i + 1]).c_str(), {HistType::kTH1D, {{lambdaMassAxis}}}); + pthistos::lambdaSplit[i] = rLambdaSplitMassPlotsPerPtBin.add(fmt::format("hLambdaSplitPt_from_{0}_to_{1}", lambdahistvalue[i], lambdahistvalue[i + 1]).c_str(), fmt::format("hLambdaSplitPt_from_{0}_to_{1}", lambdahistvalue[i], lambdahistvalue[i + 1]).c_str(), {HistType::kTH1D, {{lambdaMassAxis}}}); } // lambdafeeddown matrices rFeeddownMatrices.add("hLambdaFeeddownMatrix", "hLambdaFeeddownMatrix", {HistType::kTH2F, {{lambdaPtAxis}, {lambdaPtAxis}}}); @@ -291,7 +290,6 @@ struct V0PtInvMassPlots { // same method as in Lambda and Kzerosh above rPtAnalysis.add("hMassAntilambdavsCuts", "hMassAntilambdavsCuts", {HistType::kTH2F, {{partCutsAxis}, {k0ShortMassAxis}}}); rPtAnalysis.add("hArmenterosPodolanskiPlotAntilambda", "hArmenterosPodolanskiPlotAntilambda", {HistType::kTH2F, {{armenterosasymAxis}, {armenterosQtAxis}}}); - rPtAnalysis.add("hAntilambdaAlphaTestPtSpectrum", "hAntilambdaAlphaTestPtSpectrum", {HistType::kTH1F, {antilambdaPtAxis}}); rPtAnalysis.add("hNSigmaPosPionFromAntilambdas", "hNSigmaPosPionFromAntilambdas", {HistType::kTH2F, {{100, -5.f, 5.f}, {antilambdaPtAxis}}}); rPtAnalysis.add("hNSigmaNegProtonFromAntilambdas", "hNSigmaNegProtonFromAntilambdas", {HistType::kTH2F, {{100, -5.f, 5.f}, {antilambdaPtAxis}}}); rPtAnalysis.add("hAntilambdaV0radius", "hAntilambdaV0radius", {HistType::kTH1F, {{nBins, 0.0f, 50.0f}}}); @@ -300,8 +298,8 @@ struct V0PtInvMassPlots { rPtAnalysis.add("hAntilambdaDCAPosDaughter", "hAntilambdaDCAPosDaughter", {HistType::kTH1F, {{nBins, 0.0f, 2.2f}}}); rPtAnalysis.add("hAntilambdaDCANegDaughter", "hAntilambdaDCANegDaughter", {HistType::kTH1F, {{nBins, 0.0f, 2.2f}}}); for (int i = 0; i < nmaxHistograms; i++) { - pthistos::antilambdaPt[i] = rAntilambdaMassPlotsPerPtBin.add(fmt::format("hPt_from_{0}_to_{1}", antilambdahistvalue[i], antilambdahistvalue[i + 1]).c_str(), fmt::format("hPt_from_{0}_to_{1}", antilambdahistvalue[i], antilambdahistvalue[i + 1]).c_str(), {HistType::kTH1D, {{antiLambdaMassAxis}}}); - pthistos::antilambdaSplit[i] = rAntilambdaSplitMassPlotsPerPtBin.add(fmt::format("hPt_from_{0}_to_{1}", antilambdahistvalue[i], antilambdahistvalue[i + 1]).c_str(), fmt::format("hPt_from_{0}_to_{1}", antilambdahistvalue[i], antilambdahistvalue[i + 1]).c_str(), {HistType::kTH1D, {{antiLambdaMassAxis}}}); + pthistos::antilambdaPt[i] = rAntilambdaMassPlotsPerPtBin.add(fmt::format("hAntilambdaPt_from_{0}_to_{1}", antilambdahistvalue[i], antilambdahistvalue[i + 1]).c_str(), fmt::format("hAntilambdaPt_from_{0}_to_{1}", antilambdahistvalue[i], antilambdahistvalue[i + 1]).c_str(), {HistType::kTH1D, {{antiLambdaMassAxis}}}); + pthistos::antilambdaSplit[i] = rAntilambdaSplitMassPlotsPerPtBin.add(fmt::format("hAntilambdaSplitPt_from_{0}_to_{1}", antilambdahistvalue[i], antilambdahistvalue[i + 1]).c_str(), fmt::format("hAntilambdaSplitPt_from_{0}_to_{1}", antilambdahistvalue[i], antilambdahistvalue[i + 1]).c_str(), {HistType::kTH1D, {{antiLambdaMassAxis}}}); } // antilambdafeeddown matrices rFeeddownMatrices.add("hAntiLambdaFeeddownMatrix", "hAntiLambdaFeeddownMatrix", {HistType::kTH2F, {{antilambdaPtAxis}, {antilambdaPtAxis}}}); From 15210ceda8d36afe153013c46502f681948698ad Mon Sep 17 00:00:00 2001 From: ariedel-cern <85537041+ariedel-cern@users.noreply.github.com> Date: Wed, 29 Oct 2025 04:59:29 +0100 Subject: [PATCH 932/986] [PWGCF] Update femto framework (#13586) --- PWGCF/Femto/Core/dataTypes.h | 3 + PWGCF/Femto/Core/femtoUtils.h | 10 +- PWGCF/Femto/Core/modes.h | 21 ++ PWGCF/Femto/Core/pairBuilder.h | 176 ++++----- PWGCF/Femto/Core/pairHistManager.h | 337 +++++++++++++----- PWGCF/Femto/Core/pairProcessHelpers.h | 30 +- PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx | 11 +- PWGCF/Femto/Tasks/femtoPairTrackKink.cxx | 5 +- PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx | 6 +- .../Tasks/femtoPairTrackTwoTrackResonance.cxx | 13 +- PWGCF/Femto/Tasks/femtoPairTrackV0.cxx | 9 +- PWGCF/Femto/Tasks/femtoPairV0V0.cxx | 9 +- 12 files changed, 428 insertions(+), 202 deletions(-) diff --git a/PWGCF/Femto/Core/dataTypes.h b/PWGCF/Femto/Core/dataTypes.h index 0cb8c8758a5..fc1bc15f74d 100644 --- a/PWGCF/Femto/Core/dataTypes.h +++ b/PWGCF/Femto/Core/dataTypes.h @@ -50,6 +50,9 @@ using TwoTrackResonanceType = uint16_t; using CascadeMaskType = uint16_t; using CascadeType = uint16_t; +// datatype for particles +using ParticleType = uint16_t; + } // namespace femtodatatypes } // namespace o2::aod diff --git a/PWGCF/Femto/Core/femtoUtils.h b/PWGCF/Femto/Core/femtoUtils.h index e13bcfdd379..2fe02efcea6 100644 --- a/PWGCF/Femto/Core/femtoUtils.h +++ b/PWGCF/Femto/Core/femtoUtils.h @@ -27,8 +27,10 @@ #include #include +#include #include #include +#include namespace o2::analysis::femto { @@ -194,10 +196,10 @@ inline bool enableTable(const char* tableName, int userSetting, o2::framework::I } template -inline int sign(T value) -{ - return (value > 0) - (value < 0); // Returns 1 for positive, -1 for negative, 0 for zero -} +using HasMass = decltype(std::declval().mass()); + +template +using HasSign = decltype(std::declval().sign()); }; // namespace utils }; // namespace o2::analysis::femto diff --git a/PWGCF/Femto/Core/modes.h b/PWGCF/Femto/Core/modes.h index 672ada08ba3..25d27943ca1 100644 --- a/PWGCF/Femto/Core/modes.h +++ b/PWGCF/Femto/Core/modes.h @@ -71,6 +71,27 @@ enum class MomentumType : o2::aod::femtodatatypes::MomentumType { kPTpc, // momentum at inner wall of tpc }; +enum class Particle : o2::aod::femtodatatypes::ParticleType { + kTrack, + kTwoTrackResonance, + kV0, + kKink, + kCascade, +}; + +constexpr bool hasMass(Particle p) +{ + switch (p) { + case Particle::kV0: + case Particle::kTwoTrackResonance: + case Particle::kKink: + case Particle::kCascade: + return true; + default: + return false; + } +} + enum class Track : o2::aod::femtodatatypes::TrackType { kPrimaryTrack, kV0Daughter, diff --git a/PWGCF/Femto/Core/pairBuilder.h b/PWGCF/Femto/Core/pairBuilder.h index 1d788b5badd..0a98fcbd5a0 100644 --- a/PWGCF/Femto/Core/pairBuilder.h +++ b/PWGCF/Femto/Core/pairBuilder.h @@ -68,26 +68,28 @@ class PairTrackTrackBuilder typename T7, typename T8, typename T9, - typename T10> + typename T10, + typename T11> void init(o2::framework::HistogramRegistry* registry, T1 const& confTrackSelection1, T2 const& confTrackSelection2, T3 const& confCpr, T4 const& confMixing, T5 const& confPairBinning, - std::map> const& colHistSpec, - std::map> const& trackHistSpec1, - std::map> const& trackHistSpec2, - std::map> const& pairHistSpec, - std::map> const& cprHistSpec) + T6 const& confPairCuts, + std::map> const& colHistSpec, + std::map> const& trackHistSpec1, + std::map> const& trackHistSpec2, + std::map> const& pairHistSpec, + std::map> const& cprHistSpec) { // check if correlate the same tracks or not mSameSpecies = confMixing.sameSpecies.value; mColHistManager.init(registry, colHistSpec); - mPairHistManagerSe.init(registry, pairHistSpec, confPairBinning); - mPairHistManagerMe.init(registry, pairHistSpec, confPairBinning); + mPairHistManagerSe.init(registry, pairHistSpec, confPairBinning, confPairCuts); + mPairHistManagerMe.init(registry, pairHistSpec, confPairBinning, confPairCuts); if (mSameSpecies) { mTrackHistManager1.init(registry, trackHistSpec1, confTrackSelection1.chargeAbs.value); @@ -113,7 +115,7 @@ class PairTrackTrackBuilder } // setup mixing - mMixingPolicy = static_cast(confMixing.policy.value); + mMixingPolicy = static_cast(confMixing.policy.value); mMixingDepth = confMixing.depth.value; // setup rng if necessary @@ -191,13 +193,13 @@ class PairTrackTrackBuilder colhistmanager::CollisionHistManager mColHistManager; trackhistmanager::TrackHistManager mTrackHistManager1; trackhistmanager::TrackHistManager mTrackHistManager2; - pairhistmanager::PairHistManager mPairHistManagerSe; - pairhistmanager::PairHistManager mPairHistManagerMe; + pairhistmanager::PairHistManager mPairHistManagerSe; + pairhistmanager::PairHistManager mPairHistManagerMe; closepairrejection::ClosePairRejectionTrackTrack mCprSe; closepairrejection::ClosePairRejectionTrackTrack mCprMe; paircleaner::TrackTrackPairCleaner mPc; std::mt19937 mRng; - pairhistmanager::MixingPoliciy mMixingPolicy = pairhistmanager::MixingPoliciy::kVtxMult; + pairhistmanager::MixingPolicy mMixingPolicy = pairhistmanager::MixingPolicy::kVtxMult; bool mSameSpecies = false; int mMixingDepth = 5; bool mMixIdenticalParticles = false; @@ -235,29 +237,31 @@ class PairV0V0Builder typename T8, typename T9, typename T10, + typename T11, typename T12, - typename T11> + typename T13> void init(o2::framework::HistogramRegistry* registry, T1 const& confV0Selection1, T2 const& confV0Selection2, T3 const& confCpr, T4 const& confMixing, T5 const& confPairBinning, - std::map>& colHistSpec, - std::map>& V0HistSpec1, - std::map>& V0HistSpec2, - std::map>& PosDauHistSpec, - std::map>& NegDauHistSpec, - std::map>& pairHistSpec, - std::map>& cprHistSpec) + T6 const& confPairCuts, + std::map>& colHistSpec, + std::map>& V0HistSpec1, + std::map>& V0HistSpec2, + std::map>& PosDauHistSpec, + std::map>& NegDauHistSpec, + std::map>& pairHistSpec, + std::map>& cprHistSpec) { // check if correlate the same tracks or not mSameSpecies = confMixing.sameSpecies.value; mColHistManager.init(registry, colHistSpec); - mPairHistManagerSe.init(registry, pairHistSpec, confPairBinning); - mPairHistManagerMe.init(registry, pairHistSpec, confPairBinning); + mPairHistManagerSe.init(registry, pairHistSpec, confPairBinning, confPairCuts); + mPairHistManagerMe.init(registry, pairHistSpec, confPairBinning, confPairCuts); if (mSameSpecies) { mV0HistManager1.init(registry, V0HistSpec1, PosDauHistSpec, NegDauHistSpec); @@ -283,7 +287,7 @@ class PairV0V0Builder } // setup mixing - mMixingPolicy = static_cast(confMixing.policy.value); + mMixingPolicy = static_cast(confMixing.policy.value); mMixingDepth = confMixing.depth.value; // setup rng if necessary @@ -361,13 +365,13 @@ class PairV0V0Builder colhistmanager::CollisionHistManager mColHistManager; v0histmanager::V0HistManager mV0HistManager1; v0histmanager::V0HistManager mV0HistManager2; - pairhistmanager::PairHistManager mPairHistManagerSe; - pairhistmanager::PairHistManager mPairHistManagerMe; + pairhistmanager::PairHistManager mPairHistManagerSe; + pairhistmanager::PairHistManager mPairHistManagerMe; closepairrejection::ClosePairRejectionV0V0 mCprSe; closepairrejection::ClosePairRejectionV0V0 mCprMe; paircleaner::V0V0PairCleaner mPc; std::mt19937 mRng; - pairhistmanager::MixingPoliciy mMixingPolicy = pairhistmanager::MixingPoliciy::kVtxMult; + pairhistmanager::MixingPolicy mMixingPolicy = pairhistmanager::MixingPolicy::kVtxMult; bool mSameSpecies = false; int mMixingDepth = 5; bool mMixIdenticalParticles = false; @@ -403,38 +407,40 @@ class PairTrackV0Builder typename T9, typename T10, typename T11, - typename T12> + typename T12, + typename T13> void init(o2::framework::HistogramRegistry* registry, T1 const& confTrackSelection, T2 const& confV0Selection, T3 const& confCpr, T4 const& confMixing, T5 const& confPairBinning, - std::map>& colHistSpec, - std::map>& trackHistSpec, - std::map>& v0HistSpec, - std::map>& posDauHistSpec, - std::map>& negDauHistSpec, - std::map>& pairHistSpec, - std::map>& cprHistSpec) + T6 const& confPairCuts, + std::map>& colHistSpec, + std::map>& trackHistSpec, + std::map>& v0HistSpec, + std::map>& posDauHistSpec, + std::map>& negDauHistSpec, + std::map>& pairHistSpec, + std::map>& cprHistSpec) { mColHistManager.init(registry, colHistSpec); mTrackHistManager.init(registry, trackHistSpec, confTrackSelection.chargeAbs.value); mV0HistManager.init(registry, v0HistSpec, posDauHistSpec, negDauHistSpec); - mPairHistManagerSe.init(registry, pairHistSpec, confPairBinning); + mPairHistManagerSe.init(registry, pairHistSpec, confPairBinning, confPairCuts); mPairHistManagerSe.setMass(confTrackSelection.pdgCode.value, confV0Selection.pdgCode.value); mPairHistManagerSe.setCharge(confTrackSelection.chargeAbs.value, 1); mCprSe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value); - mPairHistManagerMe.init(registry, pairHistSpec, confPairBinning); + mPairHistManagerMe.init(registry, pairHistSpec, confPairBinning, confPairCuts); mPairHistManagerMe.setMass(confTrackSelection.pdgCode.value, confV0Selection.pdgCode.value); mPairHistManagerMe.setCharge(confTrackSelection.chargeAbs.value, 1); mCprMe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value); // setup mixing - mMixingPolicy = static_cast(confMixing.policy.value); + mMixingPolicy = static_cast(confMixing.policy.value); mMixingDepth = confMixing.depth.value; } @@ -473,12 +479,12 @@ class PairTrackV0Builder colhistmanager::CollisionHistManager mColHistManager; trackhistmanager::TrackHistManager mTrackHistManager; v0histmanager::V0HistManager mV0HistManager; - pairhistmanager::PairHistManager mPairHistManagerSe; - pairhistmanager::PairHistManager mPairHistManagerMe; + pairhistmanager::PairHistManager mPairHistManagerSe; + pairhistmanager::PairHistManager mPairHistManagerMe; closepairrejection::ClosePairRejectionTrackV0 mCprSe; closepairrejection::ClosePairRejectionTrackV0 mCprMe; paircleaner::TrackV0PairCleaner mPc; - pairhistmanager::MixingPoliciy mMixingPolicy = pairhistmanager::MixingPoliciy::kVtxMult; + pairhistmanager::MixingPolicy mMixingPolicy = pairhistmanager::MixingPolicy::kVtxMult; int mMixingDepth = 5; }; @@ -512,38 +518,40 @@ class PairTrackTwoTrackResonanceBuilder typename T9, typename T10, typename T11, - typename T12> + typename T12, + typename T13> void init(o2::framework::HistogramRegistry* registry, T1 const& confTrackSelection, T2 const& confResonanceSelection, T3 const& confCpr, T4 const& confMixing, T5 const& confPairBinning, - std::map> const& colHistSpec, - std::map> const& trackHistSpec, - std::map> const& resonanceHistSpec, - std::map> const& posDauHistSpec, - std::map> const& negDauHistSpec, - std::map> const& pairHistSpec, - std::map> const& cprHistSpec) + T6 const& confPairCuts, + std::map> const& colHistSpec, + std::map> const& trackHistSpec, + std::map> const& resonanceHistSpec, + std::map> const& posDauHistSpec, + std::map> const& negDauHistSpec, + std::map> const& pairHistSpec, + std::map> const& cprHistSpec) { mColHistManager.init(registry, colHistSpec); mTrackHistManager.init(registry, trackHistSpec, confTrackSelection.chargeAbs.value); mResonanceHistManager.init(registry, resonanceHistSpec, posDauHistSpec, negDauHistSpec); - mPairHistManagerSe.init(registry, pairHistSpec, confPairBinning); + mPairHistManagerSe.init(registry, pairHistSpec, confPairBinning, confPairCuts); mPairHistManagerSe.setMass(confTrackSelection.pdgCode.value, confResonanceSelection.pdgCode.value); mPairHistManagerSe.setCharge(confTrackSelection.chargeAbs.value, 1); mCprSe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value); - mPairHistManagerMe.init(registry, pairHistSpec, confPairBinning); + mPairHistManagerMe.init(registry, pairHistSpec, confPairBinning, confPairCuts); mPairHistManagerMe.setMass(confTrackSelection.pdgCode.value, confResonanceSelection.pdgCode.value); mPairHistManagerMe.setCharge(confTrackSelection.chargeAbs.value, 1); mCprMe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value); // setup mixing - mMixingPolicy = static_cast(confMixing.policy.value); + mMixingPolicy = static_cast(confMixing.policy.value); mMixingDepth = confMixing.depth.value; } @@ -582,12 +590,12 @@ class PairTrackTwoTrackResonanceBuilder colhistmanager::CollisionHistManager mColHistManager; trackhistmanager::TrackHistManager mTrackHistManager; twotrackresonancehistmanager::TwoTrackResonanceHistManager mResonanceHistManager; - pairhistmanager::PairHistManager mPairHistManagerSe; - pairhistmanager::PairHistManager mPairHistManagerMe; + pairhistmanager::PairHistManager mPairHistManagerSe; + pairhistmanager::PairHistManager mPairHistManagerMe; closepairrejection::ClosePairRejectionTrackV0 mCprSe; // cpr for twotrackresonances and v0 work the same way closepairrejection::ClosePairRejectionTrackV0 mCprMe; // cpr for twotrackresonances and v0 work the same way paircleaner::TrackV0PairCleaner mPc; // pc for twotrackresonances and v0 work the same way - pairhistmanager::MixingPoliciy mMixingPolicy = pairhistmanager::MixingPoliciy::kVtxMult; + pairhistmanager::MixingPolicy mMixingPolicy = pairhistmanager::MixingPolicy::kVtxMult; int mMixingDepth = 5; }; @@ -617,37 +625,39 @@ class PairTrackKinkBuilder typename T8, typename T9, typename T10, - typename T11> + typename T11, + typename T12> void init(o2::framework::HistogramRegistry* registry, T1 const& confTrackSelection, T2 const& confKinkSelection, T3 const& confCpr, T4 const& confMixing, T5 const& confPairBinning, - std::map> const& colHistSpec, - std::map> const& trackHistSpec, - std::map> const& kinkHistSpec, - std::map> const& chaDauHistSpec, - std::map> const& pairHistSpec, - std::map> const& cprHistSpec) + T6 const& confPairCuts, + std::map> const& colHistSpec, + std::map> const& trackHistSpec, + std::map> const& kinkHistSpec, + std::map> const& chaDauHistSpec, + std::map> const& pairHistSpec, + std::map> const& cprHistSpec) { mColHistManager.init(registry, colHistSpec); mTrackHistManager.init(registry, trackHistSpec, confTrackSelection.chargeAbs.value); mKinkHistManager.init(registry, kinkHistSpec, chaDauHistSpec); - mPairHistManagerSe.init(registry, pairHistSpec, confPairBinning); + mPairHistManagerSe.init(registry, pairHistSpec, confPairBinning, confPairCuts); mPairHistManagerSe.setMass(confTrackSelection.pdgCode.value, confKinkSelection.pdgCode.value); mPairHistManagerSe.setCharge(confTrackSelection.chargeAbs.value, 1); // abs charge of kink daughter is always 1 mCprSe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value); - mPairHistManagerMe.init(registry, pairHistSpec, confPairBinning); + mPairHistManagerMe.init(registry, pairHistSpec, confPairBinning, confPairCuts); mPairHistManagerMe.setMass(confTrackSelection.pdgCode.value, confKinkSelection.pdgCode.value); mPairHistManagerMe.setCharge(confTrackSelection.chargeAbs.value, 1); // abs charge of kink daughter is always 1 mCprMe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value); // setup mixing - mMixingPolicy = static_cast(confMixing.policy.value); + mMixingPolicy = static_cast(confMixing.policy.value); mMixingDepth = confMixing.depth.value; } @@ -686,12 +696,12 @@ class PairTrackKinkBuilder colhistmanager::CollisionHistManager mColHistManager; trackhistmanager::TrackHistManager mTrackHistManager; kinkhistmanager::KinkHistManager mKinkHistManager; - pairhistmanager::PairHistManager mPairHistManagerSe; - pairhistmanager::PairHistManager mPairHistManagerMe; + pairhistmanager::PairHistManager mPairHistManagerSe; + pairhistmanager::PairHistManager mPairHistManagerMe; closepairrejection::ClosePairRejectionTrackKink mCprSe; closepairrejection::ClosePairRejectionTrackKink mCprMe; paircleaner::TrackKinkPairCleaner mPc; - pairhistmanager::MixingPoliciy mMixingPolicy = pairhistmanager::MixingPoliciy::kVtxMult; + pairhistmanager::MixingPolicy mMixingPolicy = pairhistmanager::MixingPolicy::kVtxMult; int mMixingDepth = 5; }; @@ -729,39 +739,41 @@ class PairTrackCascadeBuilder typename T10, typename T11, typename T12, - typename T13> + typename T13, + typename T14> void init(o2::framework::HistogramRegistry* registry, T1 const& confTrackSelection, T2 const& confCascadeSelection, T3 const& confCpr, T4 const& confMixing, T5 const& confPairBinning, - std::map> const& colHistSpec, - std::map> const& trackHistSpec, - std::map> const& cascadeHistSpec, - std::map> const& bachelorHistSpec, - std::map> const& posDauHistSpec, - std::map> const& negDauHistSpec, - std::map> const& pairHistSpec, - std::map> const& cprHistSpec) + T6 const& confPairCuts, + std::map> const& colHistSpec, + std::map> const& trackHistSpec, + std::map> const& cascadeHistSpec, + std::map> const& bachelorHistSpec, + std::map> const& posDauHistSpec, + std::map> const& negDauHistSpec, + std::map> const& pairHistSpec, + std::map> const& cprHistSpec) { mColHistManager.init(registry, colHistSpec); mTrackHistManager.init(registry, trackHistSpec, confTrackSelection.chargeAbs.value); mCascadeHistManager.init(registry, cascadeHistSpec, bachelorHistSpec, posDauHistSpec, negDauHistSpec); - mPairHistManagerSe.init(registry, pairHistSpec, confPairBinning); + mPairHistManagerSe.init(registry, pairHistSpec, confPairBinning, confPairCuts); mPairHistManagerSe.setMass(confTrackSelection.pdgCode.value, confCascadeSelection.pdgCode.value); mPairHistManagerSe.setCharge(confTrackSelection.chargeAbs.value, 1); mCprSe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value); - mPairHistManagerMe.init(registry, pairHistSpec, confPairBinning); + mPairHistManagerMe.init(registry, pairHistSpec, confPairBinning, confPairCuts); mPairHistManagerMe.setMass(confTrackSelection.pdgCode.value, confCascadeSelection.pdgCode.value); mPairHistManagerMe.setCharge(confTrackSelection.chargeAbs.value, 1); mCprMe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value); // setup mixing - mMixingPolicy = static_cast(confMixing.policy.value); + mMixingPolicy = static_cast(confMixing.policy.value); mMixingDepth = confMixing.depth.value; } @@ -800,12 +812,12 @@ class PairTrackCascadeBuilder colhistmanager::CollisionHistManager mColHistManager; trackhistmanager::TrackHistManager mTrackHistManager; cascadehistmanager::CascadeHistManager mCascadeHistManager; - pairhistmanager::PairHistManager mPairHistManagerSe; - pairhistmanager::PairHistManager mPairHistManagerMe; + pairhistmanager::PairHistManager mPairHistManagerSe; + pairhistmanager::PairHistManager mPairHistManagerMe; closepairrejection::ClosePairRejectionTrackCascade mCprSe; closepairrejection::ClosePairRejectionTrackCascade mCprMe; paircleaner::TrackCascadePairCleaner mPc; - pairhistmanager::MixingPoliciy mMixingPolicy = pairhistmanager::MixingPoliciy::kVtxMult; + pairhistmanager::MixingPolicy mMixingPolicy = pairhistmanager::MixingPolicy::kVtxMult; int mMixingDepth = 5; }; diff --git a/PWGCF/Femto/Core/pairHistManager.h b/PWGCF/Femto/Core/pairHistManager.h index 16077c7a2ea..1779255816c 100644 --- a/PWGCF/Femto/Core/pairHistManager.h +++ b/PWGCF/Femto/Core/pairHistManager.h @@ -40,11 +40,11 @@ namespace pairhistmanager { // enum for pair histograms enum PairHist { - // kinemtics + // standard 1D kKstar, kKt, kMt, - // 2d + // standard 2D kPt1VsPt2, kPt1VsKstar, kPt2VsKstar, @@ -56,17 +56,25 @@ enum PairHist { kKstarVsMt, kKstarVsMult, kKstarVsCent, - - // higher dimensions + // 2D with mass + kKstarVsMass1, + kKstarVsMass2, + kMass1VsMass2, + // higher dimensions kKstarVsMtVsMult, kKstarVsMtVsMultVsCent, - kKstarVsMtVsPt1VsP2VsMult, - kKstarVsMtVsPt1VsP2VsMultVsCent, + kKstarVsMtVsPt1VsPt2VsMult, + kKstarVsMtVsPt1VsPt2VsMultVsCent, + // higher dimensions with mass + kKstarVsMass1VsMass2, + kKstarVsMass1VsMult, + kKstarVsMass2VsMult, + kKstarVsMass1VsMass2VsMult, kPairHistogramLast }; -enum MixingPoliciy { +enum MixingPolicy { kVtxMult, kVtxCent, kVtxMultCent, @@ -81,7 +89,7 @@ struct ConfMixing : o2::framework::ConfigurableGroup { o2::framework::ConfigurableAxis vtxBins{"vtxBins", {o2::framework::VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; o2::framework::Configurable depth{"depth", 5, "Number of events for mixing"}; o2::framework::Configurable policy{"policy", 0, "Binning policy for mixing (alywas in combination with z-vertex) -> 0: multiplicity, -> 1: centrality, -> 2: both"}; - o2::framework::Configurable sameSpecies{"sameSpecies", false, "Enable if partilce 1 and particle 2 are the same"}; + o2::framework::Configurable sameSpecies{"sameSpecies", false, "Enable if particle 1 and particle 2 are the same"}; o2::framework::Configurable seed{"seed", -1, "Seed to randomize particle 1 and particle 2 (if they are identical). Set to negative value to deactivate. Set to 0 to generate unique seed in time."}; }; @@ -91,66 +99,103 @@ struct ConfPairBinning : o2::framework::ConfigurableGroup { o2::framework::Configurable plot2D{"plot2D", true, "Enable 2D histograms"}; o2::framework::Configurable plotKstarVsMtVsMult{"plotKstarVsMtVsMult", false, "Enable 3D histogram (Kstar Vs Mt Vs Mult)"}; o2::framework::Configurable plotKstarVsMtVsMultVsCent{"plotKstarVsMtVsMultVsCent", false, "Enable 4D histogram (Kstar Vs Mt Vs Mult Vs Cent)"}; - o2::framework::Configurable plotKstarVsMtVsPt1VsP2VsMult{"plotKstarVsMtVsPt1VsP2VsMult", false, "Enable 5D histogram (Kstar Vs Mt Vs Pt1 Vs Pt2 Vs Mult)"}; - o2::framework::Configurable plotKstarVsMtVsPt1VsP2VsMultVsCent{"plotKstarVsMtVsPt1VsP2VsMultVsCent", false, "Enable 6D histogram (Kstar Vs Mt Vs Pt1 Vs Pt2 Vs Mult Vs Cent)"}; + o2::framework::Configurable plotKstarVsMtVsPt1VsPt2VsMult{"plotKstarVsMtVsPt1VsPt2VsMult", false, "Enable 5D histogram (Kstar Vs Mt Vs Pt1 Vs Pt2 Vs Mult)"}; + o2::framework::Configurable plotKstarVsMtVsPt1VsPt2VsMultVsCent{"plotKstarVsMtVsPt1VsPt2VsMultVsCent", false, "Enable 6D histogram (Kstar Vs Mt Vs Pt1 Vs Pt2 Vs Mult Vs Cent)"}; + o2::framework::Configurable plotKstarVsMass1VsMass2{"plotKstarVsMass1VsMass2", false, "Enable 3D histogram (Kstar Vs Mass1 Vs Mass2)"}; + o2::framework::Configurable plotKstarVsMass1VsMult{"plotKstarVsMass1VsMult", false, "Enable 3D histogram (Kstar Vs Mass1 Vs Mult)"}; + o2::framework::Configurable plotKstarVsMass2VsMult{"plotKstarVsMass2VsMult", false, "Enable 3D histogram (Kstar Vs Mass2 Vs Mult)"}; + o2::framework::Configurable plotKstarVsMass1VsMass2VsMult{"plotKstarVsMass1VsMass2VsMult", false, "Enable 4D histogram (Kstar Vs Mass1 Vs Mass2 Vs Mult)"}; o2::framework::ConfigurableAxis kstar{"kstar", {{600, 0, 6}}, "kstar"}; o2::framework::ConfigurableAxis kt{"kt", {{600, 0, 6}}, "kt"}; o2::framework::ConfigurableAxis mt{"mt", {{500, 0.8, 5.8}}, "mt"}; o2::framework::ConfigurableAxis multiplicity{"multiplicity", {{50, 0, 200}}, "multiplicity"}; o2::framework::ConfigurableAxis centrality{"centrality", {{10, 0, 100}}, "centrality (mult. percentile)"}; + o2::framework::ConfigurableAxis pt1{"pt1", {{100, 0, 6}}, "Pt binning for particle 1"}; + o2::framework::ConfigurableAxis pt2{"pt2", {{100, 0, 6}}, "Pt binning for particle 2"}; + o2::framework::ConfigurableAxis mass1{"mass1", {{100, 0, 2}}, "Mass binning for particle 1 (if particle has mass getter)"}; + o2::framework::ConfigurableAxis mass2{"mass2", {{100, 0, 2}}, "Mass binning for particle 2 (if particle has mass getter)"}; +}; + +struct ConfPairCuts : o2::framework::ConfigurableGroup { + std::string prefix = std::string("PairCuts"); + o2::framework::Configurable kstarMax{"kstarMax", -1, "Maximal kstar (set to -1 to deactivate)"}; + o2::framework::Configurable kstarMin{"kstarMin", -1, "Minimal kstar (set to -1 to deactivate)"}; + o2::framework::Configurable ktMax{"ktMax", -1, "Maximal kt (set to -1 to deactivate)"}; + o2::framework::Configurable ktMin{"ktMin", -1, "Minimal kt (set to -1 to deactivate)"}; + o2::framework::Configurable mtMax{"mtMax", -1, "Maximal mt (set to -1 to deactivate)"}; + o2::framework::Configurable mtMin{"mtMin", -1, "Minimal mt (set to -1 to deactivate)"}; }; // the enum gives the correct index in the array -constexpr std::array, kPairHistogramLast> HistTable = { - { - // 1D - {kKstar, o2::framework::kTH1F, "hKstar", "k*; k* (GeV/#it{c}); Entries"}, - {kKt, o2::framework::kTH1F, "hKt", "transverse momentum; k_{T} (GeV/#it{c}); Entries"}, - {kMt, o2::framework::kTH1F, "hMt", "transverse mass; m_{T} (GeV/#it{c}^{2}); Entries"}, - // 2D - {kPt1VsPt2, o2::framework::kTH2F, "hPt1VsPt2", "track1 p_{T} vs track2 p_{T}; track1 p_T (GeV/#it{c}); track2 p_{T} (GeV/#it{c})"}, - {kPt1VsKstar, o2::framework::kTH2F, "hPt1VsKstar", "p_{T,1} vs k*; p_{T,2} (GeV/#it{c}); k* (GeV/#it{c})"}, - {kPt2VsKstar, o2::framework::kTH2F, "hPt2VsKstar", "p_{T,2} vs k*; p_{T,2} (GeV/#it{c}); k* (GeV/#it{c})"}, - {kPt1VsKt, o2::framework::kTH2F, "hPt1VsKt", "p_{T,1} vs k_{T}; p_{T,1} (GeV/#it{c}); k_{T} (GeV/#it{c})"}, - {kPt2VsKt, o2::framework::kTH2F, "hPt2VsKt", "p_{T,2} vs k_{T}; p_{T,2} (GeV/#it{c}); k_{T} (GeV/#it{c})"}, - {kPt1VsMt, o2::framework::kTH2F, "hPt1VsMt", "p_{T,1} vs m_{T}; p_{T,1} (GeV/#it{c}); m_{T} (GeV/#it{c}^{2})"}, - {kPt2VsMt, o2::framework::kTH2F, "hPt2VsMt", "p_{T,2} vs m_{T}; p_{T,2} (GeV/#it{c}); m_{T} (GeV/#it{c}^{2})"}, - {kKstarVsKt, o2::framework::kTH2F, "hKstarVsKt", "k* vs k_{T}; k* (GeV/#it{c}); k_{T} (GeV/#it{c})"}, - {kKstarVsMt, o2::framework::kTH2F, "hKstarVsMt", "k* vs m_{T}; k* (GeV/#it{c}); m_{T} (GeV/#it{c}^{2})"}, - {kKstarVsCent, o2::framework::kTH2F, "hKstarVsCent", "k* vs Centrality (Mult. Percentile); k* (GeV/#it{c}); Centrality (%)"}, - {kKstarVsMult, o2::framework::kTH2F, "hKstarVsMult", "k* vs Multiplicity; k* (GeV/#it{c}); Multiplicity"}, - - // n-D - {kKstarVsMtVsMult, o2::framework::kTHnSparseF, "hKstarVsMtVsMult", "k* vs m_{T} vs multiplicity; k* (GeV/#it{c}); m_{T} (GeV/#it{c}^{2}); Multiplicity"}, - {kKstarVsMtVsMultVsCent, o2::framework::kTHnSparseF, "hKstarVsMtVsMultVsCent", "k* vs m_{T} vs multiplicity vs centrality; k* (GeV/#it{c}); m_{T} (GeV/#it{c}^{2}); Multiplicity; Centrality (%)"}, - {kKstarVsMtVsPt1VsP2VsMult, o2::framework::kTHnSparseF, "hKstarVsMtVsPt1VsPt2VsMult", "k* vs m_{T} vs p_{T,1} vs p_{T,2} vs multiplicity; k* (GeV/#it{c}); m_{T} (GeV/#it{c}^{2}); p_{T,1} (GeV/#it{c}); p_{T,2} (GeV/#it{c}); Multiplicity"}, - {kKstarVsMtVsPt1VsP2VsMultVsCent, o2::framework::kTHnSparseF, "hKstarVsMtVsPt1VsPt2VsMultVsCent", "k* vs m_{T} vs p_{T,1} vs p_{T,2} vs multiplicity vs centrality; k* (GeV/#it{c}); m_{T} (GeV/#it{c}^{2}); p_{T,1} (GeV/#it{c}); p_{T,2} (GeV/#it{c}); Multiplicity; Centrality"}, - - }}; - -template -auto makePairHistSpecMap(const T1& confPairBinning, const T2& confObject1Binning, const T3& confObject2Binning) +constexpr std::array, kPairHistogramLast> + HistTable = { + { + // 1D + {kKstar, o2::framework::kTH1F, "hKstar", "k*; k* (GeV/#it{c}); Entries"}, + {kKt, o2::framework::kTH1F, "hKt", "transverse momentum; k_{T} (GeV/#it{c}); Entries"}, + {kMt, o2::framework::kTH1F, "hMt", "transverse mass; m_{T} (GeV/#it{c}^{2}); Entries"}, + // 2D + {kPt1VsPt2, o2::framework::kTH2F, "hPt1VsPt2", " p_{T,1} vs p_{T,2}; p_{T,1} (GeV/#it{c}); p_{T,2} (GeV/#it{c})"}, + {kPt1VsKstar, o2::framework::kTH2F, "hPt1VsKstar", "p_{T,1} vs k*; p_{T,2} (GeV/#it{c}); k* (GeV/#it{c})"}, + {kPt2VsKstar, o2::framework::kTH2F, "hPt2VsKstar", "p_{T,2} vs k*; p_{T,2} (GeV/#it{c}); k* (GeV/#it{c})"}, + {kPt1VsKt, o2::framework::kTH2F, "hPt1VsKt", "p_{T,1} vs k_{T}; p_{T,1} (GeV/#it{c}); k_{T} (GeV/#it{c})"}, + {kPt2VsKt, o2::framework::kTH2F, "hPt2VsKt", "p_{T,2} vs k_{T}; p_{T,2} (GeV/#it{c}); k_{T} (GeV/#it{c})"}, + {kPt1VsMt, o2::framework::kTH2F, "hPt1VsMt", "p_{T,1} vs m_{T}; p_{T,1} (GeV/#it{c}); m_{T} (GeV/#it{c}^{2})"}, + {kPt2VsMt, o2::framework::kTH2F, "hPt2VsMt", "p_{T,2} vs m_{T}; p_{T,2} (GeV/#it{c}); m_{T} (GeV/#it{c}^{2})"}, + {kKstarVsKt, o2::framework::kTH2F, "hKstarVsKt", "k* vs k_{T}; k* (GeV/#it{c}); k_{T} (GeV/#it{c})"}, + {kKstarVsMt, o2::framework::kTH2F, "hKstarVsMt", "k* vs m_{T}; k* (GeV/#it{c}); m_{T} (GeV/#it{c}^{2})"}, + {kKstarVsCent, o2::framework::kTH2F, "hKstarVsCent", "k* vs Centrality (Mult. Percentile); k* (GeV/#it{c}); Centrality (%)"}, + {kKstarVsMult, o2::framework::kTH2F, "hKstarVsMult", "k* vs Multiplicity; k* (GeV/#it{c}); Multiplicity"}, + // 2D with mass + {kKstarVsMass1, o2::framework::kTH2F, "hKstarVsMass1", "k* vs m_{1}; k* (GeV/#it{c}); m_{1} (GeV/#it{c}^{2})"}, + {kKstarVsMass2, o2::framework::kTH2F, "hKstarVsMass2", "k* vs m_{2}; k* (GeV/#it{c}); m_{2} (GeV/#it{c}^{2})"}, + {kMass1VsMass2, o2::framework::kTH2F, "hMass1VsMass2", "m_{1} vs m_{2}; m_{1} (GeV/#it{c}^{2}); m_{2} (GeV/#it{c}^{2})"}, + // n-D + {kKstarVsMtVsMult, o2::framework::kTHnSparseF, "hKstarVsMtVsMult", "k* vs m_{T} vs multiplicity; k* (GeV/#it{c}); m_{T} (GeV/#it{c}^{2}); Multiplicity"}, + {kKstarVsMtVsMultVsCent, o2::framework::kTHnSparseF, "hKstarVsMtVsMultVsCent", "k* vs m_{T} vs multiplicity vs centrality; k* (GeV/#it{c}); m_{T} (GeV/#it{c}^{2}); Multiplicity; Centrality (%)"}, + {kKstarVsMtVsPt1VsPt2VsMult, o2::framework::kTHnSparseF, "hKstarVsMtVsPt1VsPt2VsMult", "k* vs m_{T} vs p_{T,1} vs p_{T,2} vs multiplicity; k* (GeV/#it{c}); m_{T} (GeV/#it{c}^{2}); p_{T,1} (GeV/#it{c}); p_{T,2} (GeV/#it{c}); Multiplicity"}, + {kKstarVsMtVsPt1VsPt2VsMultVsCent, o2::framework::kTHnSparseF, "hKstarVsMtVsPt1VsPt2VsMultVsCent", "k* vs m_{T} vs p_{T,1} vs p_{T,2} vs multiplicity vs centrality; k* (GeV/#it{c}); m_{T} (GeV/#it{c}^{2}); p_{T,1} (GeV/#it{c}); p_{T,2} (GeV/#it{c}); Multiplicity; Centrality"}, + // n-D with mass + {kKstarVsMass1VsMass2, o2::framework::kTHnSparseF, "hKstarVsMass1VsMass2", "k* vs m_{1} vs m_{2}; k* (GeV/#it{c}); m_{1} (GeV/#it{c}^{2}); m_{2} (GeV/#it{c}^{2})"}, + {kKstarVsMass1VsMult, o2::framework::kTHnSparseF, "hKstarVsMass1VsMult", "k* vs m_{1} vs multiplicity; k* (GeV/#it{c}); m_{1} (GeV/#it{c}^{2}); Multiplicity"}, + {kKstarVsMass2VsMult, o2::framework::kTHnSparseF, "hKstarVsMass2VsMult", "k* vs m_{2} vs multiplicity; k* (GeV/#it{c}); m_{2} (GeV/#it{c}^{2}); Multiplicity"}, + {kKstarVsMass1VsMass2VsMult, o2::framework::kTHnSparseF, "hKstarVsMass1VsMass2VsMult", "k* vs m_{1} vs m_{2} vs multiplicity; k* (GeV/#it{c}); m_{1} (GeV/#it{c}^{2}); m_{2} (GeV/#it{c}^{2}); Multiplicity"}, + + }}; + +template +auto makePairHistSpecMap(const T& confPairBinning) { return std::map>{ {kKstar, {confPairBinning.kstar}}, {kKt, {confPairBinning.kt}}, {kMt, {confPairBinning.mt}}, - {kPt1VsPt2, {confObject1Binning.pt, confObject2Binning.pt}}, - {kPt1VsKstar, {confObject1Binning.pt, confPairBinning.kstar}}, - {kPt2VsKstar, {confObject2Binning.pt, confPairBinning.kstar}}, - {kPt1VsKt, {confObject1Binning.pt, confPairBinning.kt}}, - {kPt2VsKt, {confObject2Binning.pt, confPairBinning.kt}}, - {kPt1VsMt, {confObject1Binning.pt, confPairBinning.mt}}, - {kPt2VsMt, {confObject2Binning.pt, confPairBinning.mt}}, + {kPt1VsPt2, {confPairBinning.pt1, confPairBinning.pt2}}, + {kPt1VsKstar, {confPairBinning.pt1, confPairBinning.kstar}}, + {kPt2VsKstar, {confPairBinning.pt2, confPairBinning.kstar}}, + {kPt1VsKt, {confPairBinning.pt1, confPairBinning.kt}}, + {kPt2VsKt, {confPairBinning.pt2, confPairBinning.kt}}, + {kPt1VsMt, {confPairBinning.pt1, confPairBinning.mt}}, + {kPt2VsMt, {confPairBinning.pt2, confPairBinning.mt}}, {kKstarVsKt, {confPairBinning.kstar, confPairBinning.kt}}, {kKstarVsMt, {confPairBinning.kstar, confPairBinning.mt}}, {kKstarVsMult, {confPairBinning.kstar, confPairBinning.multiplicity}}, {kKstarVsCent, {confPairBinning.kstar, confPairBinning.centrality}}, + {kKstarVsMass1, {confPairBinning.kstar, confPairBinning.mass1}}, + {kKstarVsMass2, {confPairBinning.kstar, confPairBinning.mass2}}, + {kMass1VsMass2, {confPairBinning.mass1, confPairBinning.mass2}}, + {kKstarVsMtVsMult, {confPairBinning.kstar, confPairBinning.mt, confPairBinning.multiplicity}}, {kKstarVsMtVsMultVsCent, {confPairBinning.kstar, confPairBinning.mt, confPairBinning.multiplicity, confPairBinning.centrality}}, - {kKstarVsMtVsPt1VsP2VsMult, {confPairBinning.kstar, confPairBinning.mt, confObject1Binning.pt, confObject2Binning.pt, confPairBinning.multiplicity}}, - {kKstarVsMtVsPt1VsP2VsMultVsCent, {confPairBinning.kstar, confPairBinning.mt, confObject1Binning.pt, confObject2Binning.pt, confPairBinning.multiplicity, confPairBinning.centrality}}, + {kKstarVsMtVsPt1VsPt2VsMult, {confPairBinning.kstar, confPairBinning.mt, confPairBinning.pt1, confPairBinning.pt2, confPairBinning.multiplicity}}, + {kKstarVsMtVsPt1VsPt2VsMultVsCent, {confPairBinning.kstar, confPairBinning.mt, confPairBinning.pt1, confPairBinning.pt2, confPairBinning.multiplicity, confPairBinning.centrality}}, + + {kKstarVsMass1VsMass2, {confPairBinning.kstar, confPairBinning.mass1, confPairBinning.mass2}}, + {kKstarVsMass1VsMult, {confPairBinning.kstar, confPairBinning.mass1, confPairBinning.multiplicity}}, + {kKstarVsMass2VsMult, {confPairBinning.kstar, confPairBinning.mass2, confPairBinning.multiplicity}}, + {kKstarVsMass1VsMass2VsMult, {confPairBinning.kstar, confPairBinning.mass1, confPairBinning.mass2, confPairBinning.multiplicity}}, + }; }; @@ -178,24 +223,44 @@ constexpr std::string_view QaDir = "QA/"; /// \class FemtoDreamEventHisto /// \brief Class for histogramming event properties // template -template +template class PairHistManager { public: PairHistManager() = default; ~PairHistManager() = default; - template - void init(o2::framework::HistogramRegistry* registry, std::map> const& Specs, T const& ConfPairBinning) + template + void init(o2::framework::HistogramRegistry* registry, + std::map> const& Specs, + T1 const& ConfPairBinning, + T2 const& ConfPairCuts) { mHistogramRegistry = registry; + // flags for histograms mPlot1d = ConfPairBinning.plot1D.value; mPlot2d = ConfPairBinning.plot2D.value; mPlotKstarVsMtVsMult = ConfPairBinning.plotKstarVsMtVsMult.value; mPlotKstarVsMtVsMultVsCent = ConfPairBinning.plotKstarVsMtVsMultVsCent.value; - mPlotKstarVsMtVsPt1VsP2VsMult = ConfPairBinning.plotKstarVsMtVsPt1VsP2VsMult.value; - mPlotKstarVsMtVsPt1VsP2VsMultVsCent = ConfPairBinning.plotKstarVsMtVsPt1VsP2VsMultVsCent.value; + mPlotKstarVsMtVsPt1VsP2VsMult = ConfPairBinning.plotKstarVsMtVsPt1VsPt2VsMult.value; + mPlotKstarVsMtVsPt1VsP2VsMultVsCent = ConfPairBinning.plotKstarVsMtVsPt1VsPt2VsMultVsCent.value; + + mPlotKstarVsMass1VsMass2 = ConfPairBinning.plotKstarVsMass1VsMass2.value; + mPlotKstarVsMass1VsMult = ConfPairBinning.plotKstarVsMass1VsMult.value; + mPlotKstarVsMass2VsMult = ConfPairBinning.plotKstarVsMass2VsMult.value; + mPlotKstarVsMass1VsMass2VsMult = ConfPairBinning.plotKstarVsMass1VsMass2VsMult.value; + + // values for cuts + mKstarMin = ConfPairCuts.kstarMin.value; + mKstarMax = ConfPairCuts.kstarMax.value; + mKtMin = ConfPairCuts.ktMin.value; + mKtMax = ConfPairCuts.ktMax.value; + mMtMin = ConfPairCuts.mtMin.value; + mMtMax = ConfPairCuts.mtMax.value; if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { std::string analysisDir = std::string(prefix) + std::string(AnalysisDir); @@ -217,6 +282,17 @@ class PairHistManager mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMt, HistTable), getHistDesc(kKstarVsMt, HistTable), getHistType(kKstarVsMt, HistTable), {Specs.at(kKstarVsMt)}); mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMult, HistTable), getHistDesc(kKstarVsMult, HistTable), getHistType(kKstarVsMult, HistTable), {Specs.at(kKstarVsMult)}); mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsCent, HistTable), getHistDesc(kKstarVsCent, HistTable), getHistType(kKstarVsCent, HistTable), {Specs.at(kKstarVsCent)}); + + // special care for mass plots since not all particles have "mass" + if constexpr (modes::hasMass(particleType1)) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMass1, HistTable), getHistDesc(kKstarVsMass1, HistTable), getHistType(kKstarVsMass1, HistTable), {Specs.at(kKstarVsMass1)}); + } + if constexpr (modes::hasMass(particleType2)) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMass2, HistTable), getHistDesc(kKstarVsMass2, HistTable), getHistType(kKstarVsMass2, HistTable), {Specs.at(kKstarVsMass2)}); + } + if constexpr (modes::hasMass(particleType1) && modes::hasMass(particleType2)) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kMass1VsMass2, HistTable), getHistDesc(kMass1VsMass2, HistTable), getHistType(kMass1VsMass2, HistTable), {Specs.at(kMass1VsMass2)}); + } } if (mPlotKstarVsMtVsMult) { @@ -226,10 +302,30 @@ class PairHistManager mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMtVsMultVsCent, HistTable), getHistDesc(kKstarVsMtVsMultVsCent, HistTable), getHistType(kKstarVsMtVsMultVsCent, HistTable), {Specs.at(kKstarVsMtVsMultVsCent)}); } if (mPlotKstarVsMtVsPt1VsP2VsMult) { - mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMtVsPt1VsP2VsMult, HistTable), getHistDesc(kKstarVsMtVsPt1VsP2VsMult, HistTable), getHistType(kKstarVsMtVsPt1VsP2VsMult, HistTable), {Specs.at(kKstarVsMtVsPt1VsP2VsMult)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMtVsPt1VsPt2VsMult, HistTable), getHistDesc(kKstarVsMtVsPt1VsPt2VsMult, HistTable), getHistType(kKstarVsMtVsPt1VsPt2VsMult, HistTable), {Specs.at(kKstarVsMtVsPt1VsPt2VsMult)}); } if (mPlotKstarVsMtVsPt1VsP2VsMultVsCent) { - mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMtVsPt1VsP2VsMultVsCent, HistTable), getHistDesc(kKstarVsMtVsPt1VsP2VsMultVsCent, HistTable), getHistType(kKstarVsMtVsPt1VsP2VsMultVsCent, HistTable), {Specs.at(kKstarVsMtVsPt1VsP2VsMultVsCent)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMtVsPt1VsPt2VsMultVsCent, HistTable), getHistDesc(kKstarVsMtVsPt1VsPt2VsMultVsCent, HistTable), getHistType(kKstarVsMtVsPt1VsPt2VsMultVsCent, HistTable), {Specs.at(kKstarVsMtVsPt1VsPt2VsMultVsCent)}); + } + + // again special care for particles with "mass" + if constexpr (modes::hasMass(particleType1)) { + if (mPlotKstarVsMass1VsMult) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMass1VsMult, HistTable), getHistDesc(kKstarVsMass1VsMult, HistTable), getHistType(kKstarVsMass1VsMult, HistTable), {Specs.at(kKstarVsMass1VsMult)}); + } + } + if constexpr (modes::hasMass(particleType2)) { + if (mPlotKstarVsMass2VsMult) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMass2VsMult, HistTable), getHistDesc(kKstarVsMass2VsMult, HistTable), getHistType(kKstarVsMass2VsMult, HistTable), {Specs.at(kKstarVsMass2VsMult)}); + } + } + if constexpr (modes::hasMass(particleType1) && modes::hasMass(particleType2)) { + if (mPlotKstarVsMass1VsMass2) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMass1VsMass2, HistTable), getHistDesc(kKstarVsMass1VsMass2, HistTable), getHistType(kKstarVsMass1VsMass2, HistTable), {Specs.at(kKstarVsMass1VsMass2)}); + } + if (mPlotKstarVsMass1VsMass2VsMult) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMass1VsMass2VsMult, HistTable), getHistDesc(kKstarVsMass1VsMass2VsMult, HistTable), getHistType(kKstarVsMass1VsMass2VsMult, HistTable), {Specs.at(kKstarVsMass1VsMass2VsMult)}); + } } } @@ -240,8 +336,9 @@ class PairHistManager void setMass(int PdgParticle1, int PdgParticle2) { - mMass1 = o2::analysis::femto::utils::getMass(PdgParticle1); - mMass2 = o2::analysis::femto::utils::getMass(PdgParticle2); + mPdgMass1 = o2::analysis::femto::utils::getMass(PdgParticle1); + mPdgMass2 = o2::analysis::femto::utils::getMass(PdgParticle2); + mPdgAverageMass = (mPdgMass1 + mPdgMass2) / 2.f; } void setCharge(int chargeAbsParticle1, int chargeAbsParticle2) { @@ -251,25 +348,20 @@ class PairHistManager mAbsCharge2 = std::abs(chargeAbsParticle2); } - template - void setPair(const T1& particle1, const T2& particle2, const T3& col) + template + void setPair(const T1& particle1, const T2& particle2) { - // set collision properties - mMult = col.mult(); - mCent = col.cent(); - // pt in track table is calculated from 1/signedPt from the original track table // in case of He with Z=2, we have to rescale the pt with the absolute charge - mParticle1 = ROOT::Math::PtEtaPhiMVector{mAbsCharge1 * particle1.pt(), particle1.eta(), particle1.phi(), mMass1}; - mParticle2 = ROOT::Math::PtEtaPhiMVector{mAbsCharge2 * particle2.pt(), particle2.eta(), particle2.phi(), mMass2}; + mParticle1 = ROOT::Math::PtEtaPhiMVector{mAbsCharge1 * particle1.pt(), particle1.eta(), particle1.phi(), mPdgMass1}; + mParticle2 = ROOT::Math::PtEtaPhiMVector{mAbsCharge2 * particle2.pt(), particle2.eta(), particle2.phi(), mPdgMass2}; auto partSum = mParticle1 + mParticle2; // set kT mKt = partSum.Pt() / 2.f; // set mT - float averageMass = (mMass1 + mMass2) / 2.f; - mMt = std::hypot(mKt, averageMass); + mMt = std::hypot(mKt, mPdgAverageMass); // Boost particle to the pair rest frame (Prf) and calculate k* (would be equivalent using particle 2) // make a copy of particle 1 @@ -278,6 +370,40 @@ class PairHistManager ROOT::Math::Boost boostPrf(partSum.BoostToCM()); // boost particle 1 into pair rest frame and calculate its momentum, which has the same value as k* mKstar = boostPrf(particle1Prf).P(); + + // if one of the particles has a mass getter, we cache the value for the filling later + if constexpr (modes::hasMass(particleType1)) { + mMass1 = particle1.mass(); + } + if constexpr (modes::hasMass(particleType2)) { + mMass2 = particle2.mass(); + } + } + + template + void setPair(const T1& particle1, const T2& particle2, const T3& col) + { + mMult = col.mult(); + mCent = col.cent(); + setPair(particle1, particle2); + } + + template + void setPair(const T1& particle1, const T2& particle2, const T3& col1, const T4& col2) + { + mMult = 0.5f * (col1.mult() + col2.mult()); // if mixing with multiplicity, should be in the same mixing bin + mCent = 0.5f * (col1.cent() + col2.cent()); // if mixing with centrality, should be in the same mixing bin + setPair(particle1, particle2); + } + + bool checkPairCuts() const + { + return (!(mKstarMin > 0.f) || mKstar > mKstarMin) && + (!(mKstarMax > 0.f) || mKstar < mKstarMax) && + (!(mKtMin > 0.f) || mKt > mKtMin) && + (!(mKtMax > 0.f) || mKt < mKtMax) && + (!(mMtMin > 0.f) || mMt > mMtMin) && + (!(mMtMax > 0.f) || mMt < mMtMax); } void fill() @@ -300,40 +426,84 @@ class PairHistManager mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMt, HistTable)), mKstar, mMt); mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMult, HistTable)), mKstar, mMult); mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsCent, HistTable)), mKstar, mCent); + + // // special care for mass plots since not all particles have "mass" + if constexpr (modes::hasMass(particleType1)) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMass1, HistTable)), mKstar, mMass1); + } + if constexpr (modes::hasMass(particleType2)) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMass2, HistTable)), mKstar, mMass2); + } + if constexpr (modes::hasMass(particleType1) && modes::hasMass(particleType2)) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kMass1VsMass2, HistTable)), mMass1, mMass2); + } } - if (mPlotKstarVsMtVsMult) { - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMtVsMult, HistTable)), mKstar, mMt, mMult); + } + + // n-D histograms are only filled if enabled + if (mPlotKstarVsMtVsMult) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMtVsMult, HistTable)), mKstar, mMt, mMult); + } + if (mPlotKstarVsMtVsMultVsCent) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMtVsMultVsCent, HistTable)), mKstar, mMt, mMult, mCent); + } + if (mPlotKstarVsMtVsPt1VsP2VsMult) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMtVsPt1VsPt2VsMult, HistTable)), mKstar, mMt, mParticle1.Pt(), mParticle2.pt(), mMult); + } + if (mPlotKstarVsMtVsPt1VsP2VsMultVsCent) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMtVsPt1VsPt2VsMultVsCent, HistTable)), mKstar, mMt, mParticle1.Pt(), mParticle2.pt(), mMult, mCent); + } + + // again special care for particles with "mass" + if constexpr (modes::hasMass(particleType1)) { + if (mPlotKstarVsMass1VsMult) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMass1VsMult, HistTable)), mKstar, mMass1, mMult); } - if (mPlotKstarVsMtVsMultVsCent) { - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMtVsMultVsCent, HistTable)), mKstar, mMt, mMult, mCent); + } + if constexpr (modes::hasMass(particleType2)) { + if (mPlotKstarVsMass2VsMult) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMass2VsMult, HistTable)), mKstar, mMass2, mMult); } - if (mPlotKstarVsMtVsPt1VsP2VsMult) { - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMtVsPt1VsP2VsMult, HistTable)), mKstar, mMt, mParticle1.Pt(), mParticle2.pt(), mMult); + } + if constexpr (modes::hasMass(particleType1) && modes::hasMass(particleType2)) { + if (mPlotKstarVsMass1VsMass2) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMass1VsMass2, HistTable)), mKstar, mMass1, mMass2); } - if (mPlotKstarVsMtVsPt1VsP2VsMultVsCent) { - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMtVsPt1VsP2VsMultVsCent, HistTable)), mKstar, mMt, mParticle1.Pt(), mParticle2.pt(), mMult, mCent); + if (mPlotKstarVsMass1VsMass2VsMult) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMass1VsMass2VsMult, HistTable)), mKstar, mMass1, mMass2, mMult); } } - - // if constexpr (isFlagSet(mode, modes::Mode::kQA)) { - // mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsDcaz, HistTable)), track.pt(), track.dcaZ()); - // } } + // if constexpr (isFlagSet(mode, modes::Mode::kQA)) { + // mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsDcaz, HistTable)), track.pt(), track.dcaZ()); + // } + private: o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; - float mMass1 = 0.f; - float mMass2 = 0.f; + float mPdgMass1 = 0.f; + float mPdgMass2 = 0.f; + float mPdgAverageMass = 0.f; int mAbsCharge1 = 1; int mAbsCharge2 = 1; ROOT::Math::PtEtaPhiMVector mParticle1{}; ROOT::Math::PtEtaPhiMVector mParticle2{}; + float mMass1 = 0.f; + float mMass2 = 0.f; float mKstar = 0.f; float mKt = 0.f; float mMt = 0.f; float mMult = 0.f; float mCent = 0.f; + // cuts + float mKstarMin = -1.f; + float mKstarMax = -1.f; + float mKtMin = -1.f; + float mKtMax = -1.f; + float mMtMin = -1.f; + float mMtMax = -1.f; + // flags bool mPlot1d = true; bool mPlot2d = true; @@ -341,6 +511,11 @@ class PairHistManager bool mPlotKstarVsMtVsMultVsCent = false; bool mPlotKstarVsMtVsPt1VsP2VsMult = false; bool mPlotKstarVsMtVsPt1VsP2VsMultVsCent = false; + + bool mPlotKstarVsMass1VsMass2 = false; + bool mPlotKstarVsMass1VsMult = false; + bool mPlotKstarVsMass2VsMult = false; + bool mPlotKstarVsMass1VsMass2VsMult = false; }; }; // namespace pairhistmanager diff --git a/PWGCF/Femto/Core/pairProcessHelpers.h b/PWGCF/Femto/Core/pairProcessHelpers.h index dbede67648d..39b800be5ce 100644 --- a/PWGCF/Femto/Core/pairProcessHelpers.h +++ b/PWGCF/Femto/Core/pairProcessHelpers.h @@ -45,20 +45,17 @@ void processSameEvent(T1 const& SliceParticle, T7& rng, bool randomize) { - // Fill single particle histograms for (auto const& part : SliceParticle) { ParticleHistManager.fill(part, TrackTable); } std::uniform_real_distribution dist(0.f, 1.f); for (auto const& [p1, p2] : o2::soa::combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(SliceParticle, SliceParticle))) { - // Close pair rejection if (CprManager.isActivated()) { CprManager.setPair(p1, p2, TrackTable); if (CprManager.isClosePair()) { continue; } } - CprManager.fill(); // Randomize pair order if enabled float threshold = 0.5f; bool swapPair = randomize ? (dist(rng) > threshold) : false; @@ -67,7 +64,10 @@ void processSameEvent(T1 const& SliceParticle, } else { PairHistManager.setPair(p1, p2, Collision); } - PairHistManager.fill(); + if (PairHistManager.checkPairCuts()) { + CprManager.fill(); + PairHistManager.fill(); + } } } @@ -110,9 +110,11 @@ void processSameEvent(T1 const& SliceParticle1, continue; } } - CprManager.fill(); PairHistManager.setPair(p1, p2, Collision); - PairHistManager.fill(); + if (PairHistManager.checkPairCuts()) { + CprManager.fill(); + PairHistManager.fill(); + } } } @@ -158,9 +160,11 @@ void processMixedEvent(T1& Collisions, continue; } } - CprManager.fill(); - PairHistManager.setPair(p1, p2, collision1); - PairHistManager.fill(); + PairHistManager.setPair(p1, p2, collision1, collision2); + if (PairHistManager.checkPairCuts()) { + CprManager.fill(); + PairHistManager.fill(); + } } } } @@ -209,9 +213,11 @@ void processMixedEvent(T1& Collisions, continue; } } - CprManager.fill(); - PairHistManager.setPair(p1, p2, collision1); - PairHistManager.fill(); + PairHistManager.setPair(p1, p2, collision1, collision2); + if (PairHistManager.checkPairCuts()) { + CprManager.fill(); + PairHistManager.fill(); + } } } } diff --git a/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx b/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx index a6b976bcb75..0c556d5ee2b 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx @@ -92,6 +92,7 @@ struct FemtoPairTrackCascade { // setup pairs pairhistmanager::ConfPairBinning confPairBinning; + pairhistmanager::ConfPairCuts confPairCuts; pairbuilder::PairTrackCascadeBuilder< trackhistmanager::PrefixTrack1, @@ -158,21 +159,21 @@ struct FemtoPairTrackCascade { auto bachelorHistSpec = trackhistmanager::makeTrackHistSpecMap(confBachelorBinning); auto posDauSpec = trackhistmanager::makeTrackHistSpecMap(confPosDauBinning); auto negDauSpec = trackhistmanager::makeTrackHistSpecMap(confNegDauBinning); - auto pairHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confXiBinning); + auto pairHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning); auto cprHistSpec = closepairrejection::makeCprHistSpecMap(confCpr); // setup for xis if (doprocessXiSameEvent || doprocessXiMixedEvent) { auto xiHistSpec = cascadehistmanager::makeCascadeHistSpecMap(confXiBinning); - auto pairTrackXiHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confXiBinning); - pairTrackXiBuilder.init(&hRegistry, trackSelection, xiSelection, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec, xiHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackXiHistSpec, cprHistSpec); + auto pairTrackXiHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning); + pairTrackXiBuilder.init(&hRegistry, trackSelection, xiSelection, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, xiHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackXiHistSpec, cprHistSpec); } // setup for omegas if (doprocessOmegaSameEvent || doprocessOmegaMixedEvent) { auto omegaHistSpec = cascadehistmanager::makeCascadeHistSpecMap(confOmegaBinning); - auto pairTrackOmegaHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confOmegaBinning); - pairTrackOmegaBuilder.init(&hRegistry, trackSelection, omegaSelection, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec, omegaHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackOmegaHistSpec, cprHistSpec); + auto pairTrackOmegaHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning); + pairTrackOmegaBuilder.init(&hRegistry, trackSelection, omegaSelection, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, omegaHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackOmegaHistSpec, cprHistSpec); } if (((doprocessXiSameEvent || doprocessXiMixedEvent) + (doprocessOmegaSameEvent || doprocessOmegaMixedEvent)) > 1) { diff --git a/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx b/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx index 6c8af2f5bff..758b03f61fd 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx @@ -84,6 +84,7 @@ struct FemtoPairTrackKink { // setup pairs pairhistmanager::ConfPairBinning confPairBinning; + pairhistmanager::ConfPairCuts confPairCuts; pairbuilder::PairTrackKinkBuilder< trackhistmanager::PrefixTrack1, @@ -124,14 +125,14 @@ struct FemtoPairTrackKink { auto colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); auto trackHistSpec = trackhistmanager::makeTrackHistSpecMap(confTrackBinning); auto chaDauSpec = trackhistmanager::makeTrackHistSpecMap(confChaDauBinning); - auto pairHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confSigmaBinning); + auto pairHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning); auto cprHistSpec = closepairrejection::makeCprHistSpecMap(confCpr); // setup for sigma // if (doprocessSigmaSameEvent || doprocessSigmaMixedEvent) { if (doprocessSigmaSameEvent) { auto sigmaHistSpec = kinkhistmanager::makeKinkHistSpecMap(confSigmaBinning); - pairTrackSigmaBuilder.init(&hRegistry, trackSelection, sigmaSelection, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec, sigmaHistSpec, chaDauSpec, pairHistSpec, cprHistSpec); + pairTrackSigmaBuilder.init(&hRegistry, trackSelection, sigmaSelection, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, sigmaHistSpec, chaDauSpec, pairHistSpec, cprHistSpec); } }; diff --git a/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx b/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx index e905757ef85..71f692eefee 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx @@ -76,6 +76,8 @@ struct FemtoPairTrackTrack { // setup pairs pairhistmanager::ConfPairBinning confPairBinning; + pairhistmanager::ConfPairCuts confPairCuts; + closepairrejection::ConfCpr confCpr; pairbuilder::PairTrackTrackBuilder< @@ -111,10 +113,10 @@ struct FemtoPairTrackTrack { auto colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); auto trackHistSpec1 = trackhistmanager::makeTrackHistSpecMap(confTrackBinning1); auto trackHistSpec2 = trackhistmanager::makeTrackHistSpecMap(confTrackBinning2); - auto pairHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning1, confTrackBinning2); + auto pairHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning); auto cprHistSpec = closepairrejection::makeCprHistSpecMap(confCpr); - pairTrackTrackBuilder.init(&hRegistry, trackSelections1, trackSelections2, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec1, trackHistSpec2, pairHistSpec, cprHistSpec); + pairTrackTrackBuilder.init(&hRegistry, trackSelections1, trackSelections2, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec1, trackHistSpec2, pairHistSpec, cprHistSpec); }; void processSameEvent(FilteredCollision const& col, Tracks const& tracks) diff --git a/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx b/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx index 16e773da509..5d04cf56691 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx @@ -98,6 +98,7 @@ struct FemtoPairTrackTwoTrackResonance { // setup pairs pairhistmanager::ConfPairBinning confPairBinning; + pairhistmanager::ConfPairCuts confPairCuts; // setup for track-phi pairs pairbuilder::PairTrackTwoTrackResonanceBuilder< @@ -184,22 +185,22 @@ struct FemtoPairTrackTwoTrackResonance { // setup for phi if (doprocessPhiSameEvent || doprocessPhiMixedEvent) { auto phiHistSpec = twotrackresonancehistmanager::makeTwoTrackResonanceHistSpecMap(confPhiBinning); - auto pairTrackPhiHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confPhiBinning); - pairTrackPhiBuilder.init(&hRegistry, trackSelection, phiSelection, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec, phiHistSpec, posDauSpec, negDauSpec, pairTrackPhiHistSpec, cprHistSpec); + auto pairTrackPhiHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning); + pairTrackPhiBuilder.init(&hRegistry, trackSelection, phiSelection, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, phiHistSpec, posDauSpec, negDauSpec, pairTrackPhiHistSpec, cprHistSpec); } // setup for kstar0 if (doprocessKstar0SameEvent || doprocessKstar0MixedEvent) { auto kstar0HistSpec = twotrackresonancehistmanager::makeTwoTrackResonanceHistSpecMap(confKstar0Binning); - auto pairTrackKstar0HistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confKstar0Binning); - pairTrackKstar0Builder.init(&hRegistry, trackSelection, kstar0Selection, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec, kstar0HistSpec, posDauSpec, negDauSpec, pairTrackKstar0HistSpec, cprHistSpec); + auto pairTrackKstar0HistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning); + pairTrackKstar0Builder.init(&hRegistry, trackSelection, kstar0Selection, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, kstar0HistSpec, posDauSpec, negDauSpec, pairTrackKstar0HistSpec, cprHistSpec); } // setup for kstar0 if (doprocessRho0SameEvent || doprocessRho0MixedEvent) { auto rho0HistSpec = twotrackresonancehistmanager::makeTwoTrackResonanceHistSpecMap(confRho0Binning); - auto pairTrackRho0HistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confRho0Binning); - pairTrackRho0Builder.init(&hRegistry, trackSelection, rho0Selection, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec, rho0HistSpec, posDauSpec, negDauSpec, pairTrackRho0HistSpec, cprHistSpec); + auto pairTrackRho0HistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning); + pairTrackRho0Builder.init(&hRegistry, trackSelection, rho0Selection, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, rho0HistSpec, posDauSpec, negDauSpec, pairTrackRho0HistSpec, cprHistSpec); } }; diff --git a/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx b/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx index 9b92a7959e4..994dbbbd132 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx @@ -91,6 +91,7 @@ struct FemtoPairTrackV0 { // setup pairs pairhistmanager::ConfPairBinning confPairBinning; + pairhistmanager::ConfPairCuts confPairCuts; pairbuilder::PairTrackV0Builder< trackhistmanager::PrefixTrack1, @@ -155,15 +156,15 @@ struct FemtoPairTrackV0 { // setup for lambda if (doprocessLambdaSameEvent || doprocessLambdaMixedEvent) { auto lambdaHistSpec = v0histmanager::makeV0HistSpecMap(confLambdaBinning); - auto pairTrackLambdaHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confLambdaBinning); - pairTrackLambdaBuilder.init(&hRegistry, trackSelection, lambdaSelection, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairTrackLambdaHistSpec, cprHistSpec); + auto pairTrackLambdaHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning); + pairTrackLambdaBuilder.init(&hRegistry, trackSelection, lambdaSelection, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairTrackLambdaHistSpec, cprHistSpec); } // setup for k0short if (doprocessK0shortSameEvent || doprocessK0shortMixedEvent) { auto k0shortHistSpec = v0histmanager::makeV0HistSpecMap(confK0shortBinning); - auto pairTrackK0shortHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confLambdaBinning); - pairTrackK0shortBuilder.init(&hRegistry, trackSelection, lambdaSelection, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairTrackK0shortHistSpec, cprHistSpec); + auto pairTrackK0shortHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning); + pairTrackK0shortBuilder.init(&hRegistry, trackSelection, lambdaSelection, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairTrackK0shortHistSpec, cprHistSpec); } if (((doprocessLambdaSameEvent || doprocessLambdaMixedEvent) + (doprocessK0shortSameEvent || doprocessK0shortMixedEvent)) > 1) { diff --git a/PWGCF/Femto/Tasks/femtoPairV0V0.cxx b/PWGCF/Femto/Tasks/femtoPairV0V0.cxx index 61356c41aa7..ef5fc7e7b61 100644 --- a/PWGCF/Femto/Tasks/femtoPairV0V0.cxx +++ b/PWGCF/Femto/Tasks/femtoPairV0V0.cxx @@ -85,6 +85,7 @@ struct FemtoPairV0V0 { // setup pairs pairhistmanager::ConfPairBinning confPairBinning; + pairhistmanager::ConfPairCuts confPairCuts; pairbuilder::PairV0V0Builder< v0histmanager::PrefixLambda1, @@ -154,15 +155,15 @@ struct FemtoPairV0V0 { // setup for lambda if (doprocessLambdaLambdaSameEvent || doprocessLambdaLambdaMixedEvent) { auto lambdaHistSpec = v0histmanager::makeV0HistSpecMap(confLambdaBinning); - auto pairLambdaLambdaHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confLambdaBinning, confLambdaBinning); - pairLambdaLambdaBuilder.init(&hRegistry, lambdaSelection, lambdaSelection, confCpr, confMixing, confPairBinning, colHistSpec, lambdaHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairLambdaLambdaHistSpec, cprHistSpec); + auto pairLambdaLambdaHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning); + pairLambdaLambdaBuilder.init(&hRegistry, lambdaSelection, lambdaSelection, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, lambdaHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairLambdaLambdaHistSpec, cprHistSpec); } // setup for k0short if (doprocessK0shortK0shortSameEvent || doprocessK0shortK0shortMixedEvent) { auto k0shortHistSpec = v0histmanager::makeV0HistSpecMap(confK0shortBinning); - auto pairLambdaLambdaHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confLambdaBinning, confLambdaBinning); - pairLambdaLambdaBuilder.init(&hRegistry, k0shortSelection, k0shortSelection, confCpr, confMixing, confPairBinning, colHistSpec, k0shortHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairLambdaLambdaHistSpec, cprHistSpec); + auto pairLambdaLambdaHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning); + pairLambdaLambdaBuilder.init(&hRegistry, k0shortSelection, k0shortSelection, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, k0shortHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairLambdaLambdaHistSpec, cprHistSpec); } if (((doprocessLambdaLambdaSameEvent || doprocessLambdaLambdaMixedEvent) + (doprocessK0shortK0shortSameEvent || doprocessK0shortK0shortMixedEvent)) > 1) { From 7445991b71beb4a85a0391b51d27dd5fdbfcd360 Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Wed, 29 Oct 2025 07:03:38 +0100 Subject: [PATCH 933/986] [PWGHF] Add possibility to reject particles from background event (#13583) --- PWGHF/Tasks/taskMcGenPtRapShapes.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PWGHF/Tasks/taskMcGenPtRapShapes.cxx b/PWGHF/Tasks/taskMcGenPtRapShapes.cxx index 849b32b2c66..fef12e8dd14 100644 --- a/PWGHF/Tasks/taskMcGenPtRapShapes.cxx +++ b/PWGHF/Tasks/taskMcGenPtRapShapes.cxx @@ -52,6 +52,8 @@ constexpr std::array PdgCodesBeauty = {Pdg::kB0, Pdg::kBPlu struct HfTaskMcGenPtRapShapes { + Configurable rejectBackground{"rejectBackground", false, "Reject particles from background events"}; + Configurable absRapidityMax{"absRapidityMax", 0.5, "Absolute maximum rapidity"}; ConfigurableAxis axisPtCharm{"axisPtCharm", {1000, 0.f, 100.f}, "Binning for the pT axis of charm hadrons"}; ConfigurableAxis axisPtBeauty{"axisPtBeauty", {3000, 0.f, 300.f}, "Binning for the pT axis of beauty hadrons"}; ConfigurableAxis axisRapCharm{"axisRapCharm", {100, -1.f, 1.f}, "Binning for the y axis of charm hadrons"}; @@ -81,6 +83,9 @@ struct HfTaskMcGenPtRapShapes { void process(aod::McParticles const& mcParticles) { for (auto const& mcParticle : mcParticles) { + if (rejectBackground && mcParticle.fromBackgroundEvent()) { + continue; + } int const absPdgCode = std::abs(mcParticle.pdgCode()); float const pt = mcParticle.pt(); float const rap = mcParticle.y(); @@ -94,7 +99,7 @@ struct HfTaskMcGenPtRapShapes { histRapVsPtCharmPrompt[idxCharm]->Fill(pt, rap); } else if (origin == RecoDecay::OriginType::NonPrompt) { histRapVsPtCharmNonPrompt[idxCharm]->Fill(pt, rap); - if (std::abs(rap) < 0.5) { + if (std::abs(rap) < absRapidityMax) { auto bMother = mcParticles.rawIteratorAt(idxBhadMothers[0]); histPtCharmVsPtBeautyNonPrompt[idxCharm]->Fill(bMother.pt(), pt); } From f4aa72a31a181eaaa547e63afa7172310881bfb3 Mon Sep 17 00:00:00 2001 From: JStaa <39123272+JStaa@users.noreply.github.com> Date: Wed, 29 Oct 2025 07:18:16 +0100 Subject: [PATCH 934/986] [PWGCF] Changed a number of cut parameters to be configurable (#13576) Co-authored-by: ALICE Action Bot --- .../Tasks/threeParticleCorrelations.cxx | 96 ++++++++++--------- 1 file changed, 53 insertions(+), 43 deletions(-) diff --git a/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx b/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx index 590aa8adcf9..ef3c3dbe648 100644 --- a/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx +++ b/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx @@ -29,6 +29,7 @@ #include "TPDGCode.h" #include +#include #include using namespace o2; @@ -53,11 +54,16 @@ struct ThreeParticleCorrelations { float nSigma0 = 0.0, nSigma1 = 1.0, nSigma2 = 2.0, nSigma4 = 4.0, nSigma5 = 5.0; // V0 filter parameters - float tpcNCrossedRowsMin = 70.0; - float decayRMin = 1.2, ctauMax = 30.0; - float cosPAMin = 0.995; - float dcaProtonMin = 0.05, dcaPionMin = 0.2; - int dcaV0DauMax = 1; + struct : ConfigurableGroup { + std::string prefix = "V0Selection"; + Configurable tpcNCrossedRows{"tpcNCrossedRows", 70.0, "Minimum number of TPC crossed rows"}; + Configurable decayR{"decayR", 1.2, "Minimum V0 decay radius (cm)"}; + Configurable ctau{"ctau", 30.0, "Maximum V0 proper lifetime (cm)"}; + Configurable cosPA{"cosPA", 0.995, "Minimum V0 cosine of pointing angle"}; + Configurable dcaProton{"dcaProton", 0.05, "Minimum DCA of proton daughter (cm)"}; + Configurable dcaPion{"dcaPion", 0.2, "Minimum DCA of pion daughter (cm)"}; + Configurable dcaV0Dau{"dcaV0Dau", 1.0, "Maximum DCA between V0 daughters"}; + } v0SelGroup; // Track filter parameters float pionPtMin = 0.3, pionPtMax = 2.3, kaonPtMin = 0.5, kaonPtMax = 2.3, protonPtMin = 0.6; @@ -69,7 +75,8 @@ struct ThreeParticleCorrelations { float rMin = 0.8, rMax = 2.5; // Lambda invariant mass fit - double dGaussSigma = 0.0021; + Configurable invMassNSigma{"invMassNSigma", 4.0, "Number of standard deviations from the mean of the Lambda invariant mass peak"}; + double dGaussSigma = 0.0019; // Histogram registry HistogramRegistry rMECorrRegistry{"MECorrRegistry", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; @@ -137,10 +144,13 @@ struct ThreeParticleCorrelations { SameKindPair pairMC{collBinningMC, 5, -1, &cache}; // Process configurables - Configurable confBfieldSwitch{"confBfieldSwitch", 0, "Switch for the detector magnetic field (1 if Pos, -1 if Neg, 0 if both)"}; - Configurable confRatioCorrectionSwitch{"confRatioCorrectionSwitch", false, "Switch for correcting the negative spectra back to the positive spectra"}; - Configurable confFakeV0Switch{"confFakeV0Switch", false, "Switch for the fakeV0Filter function"}; - Configurable confRDSwitch{"confRDSwitch", true, "Switch for the radialDistanceFilter function"}; + struct : ConfigurableGroup { + std::string prefix = "processSwitchBoard"; + Configurable confBfieldSwitch{"confBfieldSwitch", 0, "Switch for the detector magnetic field (1 if Pos, -1 if Neg, 0 if both)"}; + Configurable confRatioCorrectionSwitch{"confRatioCorrectionSwitch", false, "Switch for correcting the negative spectra back to the positive spectra"}; + Configurable confFakeV0Switch{"confFakeV0Switch", false, "Switch for the fakeV0Filter function"}; + Configurable confRDSwitch{"confRDSwitch", true, "Switch for the radialDistanceFilter function"}; + } switchGroup; // Efficiency histograms TH3D** hEffPions = new TH3D*[2]; @@ -187,8 +197,8 @@ struct ThreeParticleCorrelations { rQARegistry.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(2, "kIsGoodZvtxFT0vsPV"); rQARegistry.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(3, "kNoSameBunchPileup"); - rQARegistry.add("hEventCentrality", "hEventCentrality", {HistType::kTH1D, {{centralityAxis}}}); - rQARegistry.add("hEventCentrality_MC", "hEventCentrality_MC", {HistType::kTH1D, {{centralityAxis}}}); + rQARegistry.add("hEventCentrality", "hEventCentrality", {HistType::kTH1D, {{fineCentralityAxis}}}); + rQARegistry.add("hEventCentrality_MC", "hEventCentrality_MC", {HistType::kTH1D, {{fineCentralityAxis}}}); rQARegistry.add("hEventZvtx", "hEventZvtx", {HistType::kTH1D, {{zvtxAxis}}}); rQARegistry.add("hEventBfield", "hEventBfield", {HistType::kTH1D, {{2, -1, 1}}}); rQARegistry.add("hTrackPt", "hTrackPt", {HistType::kTH1D, {{100, 0, 4}}}); @@ -359,8 +369,8 @@ struct ThreeParticleCorrelations { auto bc = collision.bc_as(); auto bField = getMagneticField(bc.timestamp()); - if (confBfieldSwitch != 0) { - if (std::signbit(static_cast(confBfieldSwitch)) != std::signbit(bField)) { + if (switchGroup.confBfieldSwitch != 0) { + if (std::signbit(static_cast(switchGroup.confBfieldSwitch)) != std::signbit(bField)) { return; } } @@ -433,7 +443,7 @@ struct ThreeParticleCorrelations { deltaPhi = RecoDecay::constrainAngle(trigger.phi() - associate.phi(), -constants::math::PIHalf); deltaEta = trigger.eta() - associate.eta(); - if (candMass >= MassLambda0 - 4 * dGaussSigma && candMass <= MassLambda0 + 4 * dGaussSigma) { + if (candMass >= MassLambda0 - invMassNSigma * dGaussSigma && candMass <= MassLambda0 + invMassNSigma * dGaussSigma) { if (assocPID[0] == pionID) { // Pions rSECorrRegistry.fill(HIST("hSameLambdaPion_SGNL"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionPions, associate, collision.centFT0C()) / (trackEff(hEffPions, associate, collision.centFT0C()) * v0Efficiency)); } else if (assocPID[0] == kaonID) { // Kaons @@ -442,28 +452,28 @@ struct ThreeParticleCorrelations { rSECorrRegistry.fill(HIST("hSameLambdaProton_SGNL"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionProtons, associate, collision.centFT0C()) / (trackEff(hEffProtons, associate, collision.centFT0C()) * v0Efficiency)); } - } else if (candMass >= MassLambda0 - 8 * dGaussSigma && candMass <= MassLambda0 + 8 * dGaussSigma) { + } else if (candMass >= MassLambda0 - 2 * invMassNSigma * dGaussSigma && candMass <= MassLambda0 + 2 * invMassNSigma * dGaussSigma) { if (assocPID[0] == pionID) { // Pions rSECorrRegistry.fill(HIST("hSameLambdaPion_SB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionPions, associate, collision.centFT0C()) / (trackEff(hEffPions, associate, collision.centFT0C()) * v0Efficiency)); - if (candMass >= MassLambda0 - 8 * dGaussSigma && candMass < MassLambda0 - 4 * dGaussSigma) { + if (candMass >= MassLambda0 - 2 * invMassNSigma * dGaussSigma && candMass < MassLambda0 - invMassNSigma * dGaussSigma) { rSECorrRegistry.fill(HIST("hSameLambdaPion_leftSB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionPions, associate, collision.centFT0C()) / (trackEff(hEffPions, associate, collision.centFT0C()) * v0Efficiency)); - } else if (candMass > MassLambda0 + 4 * dGaussSigma && candMass <= MassLambda0 + 8 * dGaussSigma) { + } else if (candMass > MassLambda0 + invMassNSigma * dGaussSigma && candMass <= MassLambda0 + 2 * invMassNSigma * dGaussSigma) { rSECorrRegistry.fill(HIST("hSameLambdaPion_rightSB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionPions, associate, collision.centFT0C()) / (trackEff(hEffPions, associate, collision.centFT0C()) * v0Efficiency)); } } else if (assocPID[0] == kaonID) { // Kaons rSECorrRegistry.fill(HIST("hSameLambdaKaon_SB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionKaons, associate, collision.centFT0C()) / (trackEff(hEffKaons, associate, collision.centFT0C()) * v0Efficiency)); - if (candMass >= MassLambda0 - 8 * dGaussSigma && candMass < MassLambda0 - 4 * dGaussSigma) { + if (candMass >= MassLambda0 - 2 * invMassNSigma * dGaussSigma && candMass < MassLambda0 - invMassNSigma * dGaussSigma) { rSECorrRegistry.fill(HIST("hSameLambdaKaon_leftSB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionKaons, associate, collision.centFT0C()) / (trackEff(hEffKaons, associate, collision.centFT0C()) * v0Efficiency)); - } else if (candMass > MassLambda0 + 4 * dGaussSigma && candMass <= MassLambda0 + 8 * dGaussSigma) { + } else if (candMass > MassLambda0 + invMassNSigma * dGaussSigma && candMass <= MassLambda0 + 2 * invMassNSigma * dGaussSigma) { rSECorrRegistry.fill(HIST("hSameLambdaKaon_rightSB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionKaons, associate, collision.centFT0C()) / (trackEff(hEffKaons, associate, collision.centFT0C()) * v0Efficiency)); } } else if (assocPID[0] == protonID) { // Protons rSECorrRegistry.fill(HIST("hSameLambdaProton_SB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionProtons, associate, collision.centFT0C()) / (trackEff(hEffProtons, associate, collision.centFT0C()) * v0Efficiency)); - if (candMass >= MassLambda0 - 8 * dGaussSigma && candMass < MassLambda0 - 4 * dGaussSigma) { + if (candMass >= MassLambda0 - 2 * invMassNSigma * dGaussSigma && candMass < MassLambda0 - invMassNSigma * dGaussSigma) { rSECorrRegistry.fill(HIST("hSameLambdaProton_leftSB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionProtons, associate, collision.centFT0C()) / (trackEff(hEffProtons, associate, collision.centFT0C()) * v0Efficiency)); - } else if (candMass > MassLambda0 + 4 * dGaussSigma && candMass <= MassLambda0 + 8 * dGaussSigma) { + } else if (candMass > MassLambda0 + invMassNSigma * dGaussSigma && candMass <= MassLambda0 + 2 * invMassNSigma * dGaussSigma) { rSECorrRegistry.fill(HIST("hSameLambdaProton_rightSB"), deltaPhi, deltaEta, collision.centFT0C(), collision.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionProtons, associate, collision.centFT0C()) / (trackEff(hEffProtons, associate, collision.centFT0C()) * v0Efficiency)); } } @@ -487,8 +497,8 @@ struct ThreeParticleCorrelations { auto bc = coll_1.bc_as(); auto bField = getMagneticField(bc.timestamp()); - if (confBfieldSwitch != 0) { - if (std::signbit(static_cast(confBfieldSwitch)) != std::signbit(bField)) { + if (switchGroup.confBfieldSwitch != 0) { + if (std::signbit(static_cast(switchGroup.confBfieldSwitch)) != std::signbit(bField)) { return; } } @@ -510,7 +520,7 @@ struct ThreeParticleCorrelations { deltaPhi = RecoDecay::constrainAngle(trigger.phi() - associate.phi(), -constants::math::PIHalf); deltaEta = trigger.eta() - associate.eta(); - if (candMass >= MassLambda0 - 4 * dGaussSigma && candMass <= MassLambda0 + 4 * dGaussSigma) { + if (candMass >= MassLambda0 - invMassNSigma * dGaussSigma && candMass <= MassLambda0 + invMassNSigma * dGaussSigma) { if (assocPID[0] == pionID) { // Pions rMECorrRegistry.fill(HIST("hMixLambdaPion_SGNL"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionPions, associate, coll_1.centFT0C()) / (trackEff(hEffPions, associate, coll_1.centFT0C()) * v0Efficiency)); } else if (assocPID[0] == kaonID) { // Kaons @@ -519,28 +529,28 @@ struct ThreeParticleCorrelations { rMECorrRegistry.fill(HIST("hMixLambdaProton_SGNL"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionProtons, associate, coll_1.centFT0C()) / (trackEff(hEffProtons, associate, coll_1.centFT0C()) * v0Efficiency)); } - } else if (candMass >= MassLambda0 - 8 * dGaussSigma && candMass <= MassLambda0 + 8 * dGaussSigma) { + } else if (candMass >= MassLambda0 - 2 * invMassNSigma * dGaussSigma && candMass <= MassLambda0 + 2 * invMassNSigma * dGaussSigma) { if (assocPID[0] == pionID) { // Pions rMECorrRegistry.fill(HIST("hMixLambdaPion_SB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionPions, associate, coll_1.centFT0C()) / (trackEff(hEffPions, associate, coll_1.centFT0C()) * v0Efficiency)); - if (candMass >= MassLambda0 - 8 * dGaussSigma && candMass < MassLambda0 - 4 * dGaussSigma) { + if (candMass >= MassLambda0 - 2 * invMassNSigma * dGaussSigma && candMass < MassLambda0 - invMassNSigma * dGaussSigma) { rMECorrRegistry.fill(HIST("hMixLambdaPion_leftSB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionPions, associate, coll_1.centFT0C()) / (trackEff(hEffPions, associate, coll_1.centFT0C()) * v0Efficiency)); - } else if (candMass > MassLambda0 + 4 * dGaussSigma && candMass <= MassLambda0 + 8 * dGaussSigma) { + } else if (candMass > MassLambda0 + invMassNSigma * dGaussSigma && candMass <= MassLambda0 + 2 * invMassNSigma * dGaussSigma) { rMECorrRegistry.fill(HIST("hMixLambdaPion_rightSB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionPions, associate, coll_1.centFT0C()) / (trackEff(hEffPions, associate, coll_1.centFT0C()) * v0Efficiency)); } } else if (assocPID[0] == kaonID) { // Kaons rMECorrRegistry.fill(HIST("hMixLambdaKaon_SB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionKaons, associate, coll_1.centFT0C()) / (trackEff(hEffKaons, associate, coll_1.centFT0C()) * v0Efficiency)); - if (candMass >= MassLambda0 - 8 * dGaussSigma && candMass < MassLambda0 - 4 * dGaussSigma) { + if (candMass >= MassLambda0 - 2 * invMassNSigma * dGaussSigma && candMass < MassLambda0 - invMassNSigma * dGaussSigma) { rMECorrRegistry.fill(HIST("hMixLambdaKaon_leftSB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionKaons, associate, coll_1.centFT0C()) / (trackEff(hEffKaons, associate, coll_1.centFT0C()) * v0Efficiency)); - } else if (candMass > MassLambda0 + 4 * dGaussSigma && candMass <= MassLambda0 + 8 * dGaussSigma) { + } else if (candMass > MassLambda0 + invMassNSigma * dGaussSigma && candMass <= MassLambda0 + 2 * invMassNSigma * dGaussSigma) { rMECorrRegistry.fill(HIST("hMixLambdaKaon_rightSB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionKaons, associate, coll_1.centFT0C()) / (trackEff(hEffKaons, associate, coll_1.centFT0C()) * v0Efficiency)); } } else if (assocPID[0] == protonID) { // Protons rMECorrRegistry.fill(HIST("hMixLambdaProton_SB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionProtons, associate, coll_1.centFT0C()) / (trackEff(hEffProtons, associate, coll_1.centFT0C()) * v0Efficiency)); - if (candMass >= MassLambda0 - 8 * dGaussSigma && candMass < MassLambda0 - 4 * dGaussSigma) { + if (candMass >= MassLambda0 - 2 * invMassNSigma * dGaussSigma && candMass < MassLambda0 - invMassNSigma * dGaussSigma) { rMECorrRegistry.fill(HIST("hMixLambdaProton_leftSB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionProtons, associate, coll_1.centFT0C()) / (trackEff(hEffProtons, associate, coll_1.centFT0C()) * v0Efficiency)); - } else if (candMass > MassLambda0 + 4 * dGaussSigma && candMass <= MassLambda0 + 8 * dGaussSigma) { + } else if (candMass > MassLambda0 + invMassNSigma * dGaussSigma && candMass <= MassLambda0 + 2 * invMassNSigma * dGaussSigma) { rMECorrRegistry.fill(HIST("hMixLambdaProton_rightSB"), deltaPhi, deltaEta, coll_1.centFT0C(), coll_1.posZ(), triggSign, associate.sign(), ratioCorrection(hCorrectionProtons, associate, coll_1.centFT0C()) / (trackEff(hEffProtons, associate, coll_1.centFT0C()) * v0Efficiency)); } } @@ -909,7 +919,7 @@ struct ThreeParticleCorrelations { { double ratioCorrection = 1.0; - if (confRatioCorrectionSwitch) { + if (switchGroup.confRatioCorrectionSwitch) { int index = -999; if (track.sign() > 0) { @@ -1009,37 +1019,37 @@ struct ThreeParticleCorrelations { if (std::abs(posDaughter.eta()) >= trackEtaMax || std::abs(negDaughter.eta()) >= trackEtaMax) { return false; } - if (posDaughter.tpcNClsCrossedRows() <= tpcNCrossedRowsMin || negDaughter.tpcNClsCrossedRows() <= tpcNCrossedRowsMin) { + if (posDaughter.tpcNClsCrossedRows() <= v0SelGroup.tpcNCrossedRows || negDaughter.tpcNClsCrossedRows() <= v0SelGroup.tpcNCrossedRows) { return false; } if (v0Sign(v0) == 1) { if (std::abs(posDaughter.tpcNSigmaPr()) >= nSigma5 || std::abs(negDaughter.tpcNSigmaPi()) >= nSigma5) { return false; } - if (std::abs(v0.dcapostopv()) <= dcaProtonMin || std::abs(v0.dcanegtopv()) <= dcaPionMin) { + if (std::abs(v0.dcapostopv()) <= v0SelGroup.dcaProton || std::abs(v0.dcanegtopv()) <= v0SelGroup.dcaPion) { return false; } } else if (v0Sign(v0) == -1) { if (std::abs(posDaughter.tpcNSigmaPi()) >= nSigma5 || std::abs(negDaughter.tpcNSigmaPr()) >= nSigma5) { return false; } - if (std::abs(v0.dcapostopv()) <= dcaPionMin || std::abs(v0.dcanegtopv()) <= dcaProtonMin) { + if (std::abs(v0.dcapostopv()) <= v0SelGroup.dcaPion || std::abs(v0.dcanegtopv()) <= v0SelGroup.dcaProton) { return false; } } // Topological cuts float ctau = v0.distovertotmom(col.posX(), col.posY(), col.posZ()) * MassLambda0; - if (v0.v0radius() <= decayRMin) { + if (v0.v0radius() <= v0SelGroup.decayR) { return false; } - if (ctau >= ctauMax) { + if (ctau >= v0SelGroup.ctau) { return false; } - if (v0.v0cosPA() <= cosPAMin) { + if (v0.v0cosPA() <= v0SelGroup.cosPA) { return false; } - if (v0.dcaV0daughters() >= dcaV0DauMax) { + if (v0.dcaV0daughters() >= v0SelGroup.dcaV0Dau) { return false; } @@ -1133,7 +1143,7 @@ struct ThreeParticleCorrelations { bool fakeV0Filter(const V0Cand& v0, const TrackCand& track) { - if (confFakeV0Switch) { + if (switchGroup.confFakeV0Switch) { if (trackPID(track)[0] == kaonID) { // Kaons return true; @@ -1165,7 +1175,7 @@ struct ThreeParticleCorrelations { } double invMass = RecoDecay::m(std::array{dMomArray, aMomArray}, massArray); - if (invMass >= MassLambda0 - 4 * dGaussSigma && invMass <= MassLambda0 + 4 * dGaussSigma) { + if (invMass >= MassLambda0 - invMassNSigma * dGaussSigma && invMass <= MassLambda0 + invMassNSigma * dGaussSigma) { return false; } } @@ -1178,7 +1188,7 @@ struct ThreeParticleCorrelations { { bool pass = true; - if (confRDSwitch) { + if (switchGroup.confRDSwitch) { auto proton = v0.template posTrack_as(); if (v0Sign(v0) == -1) { From cef632d96b03ec59be45b42373ca6c1b27243473 Mon Sep 17 00:00:00 2001 From: BiancaMPopa Date: Wed, 29 Oct 2025 09:29:27 +0100 Subject: [PATCH 935/986] [PWGCF] updated the v0-v0 pair task (#13574) Co-authored-by: Bianca-Maria Popa --- PWGCF/FemtoDream/Tasks/femtoDreamPairTaskV0V0.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskV0V0.cxx b/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskV0V0.cxx index 21be57205e3..869a7124191 100644 --- a/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskV0V0.cxx +++ b/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskV0V0.cxx @@ -371,10 +371,10 @@ struct femtoDreamPairTaskV0V0 { continue; } for (auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(SliceV01, SliceV02))) { - const auto& posChild_1 = parts.iteratorAt(p1.index() - 2); - const auto& negChild_1 = parts.iteratorAt(p1.index() - 1); - const auto& posChild_2 = parts.iteratorAt(p2.index() - 2); - const auto& negChild_2 = parts.iteratorAt(p2.index() - 1); + const auto& posChild_1 = parts.iteratorAt(p1.globalIndex() - 2); + const auto& negChild_1 = parts.iteratorAt(p1.globalIndex() - 1); + const auto& posChild_2 = parts.iteratorAt(p2.globalIndex() - 2); + const auto& negChild_2 = parts.iteratorAt(p2.globalIndex() - 1); if (((posChild_1.cut() & V01.ChildPos_CutBit) == V01.ChildPos_CutBit) && ((posChild_1.pidcut() & V01.ChildPos_TPCBit) == V01.ChildPos_TPCBit) && ((negChild_1.cut() & V01.ChildNeg_CutBit) == V01.ChildNeg_CutBit) && From 76880f6e7d0912193546e5ad9e906a8ceaee5b23 Mon Sep 17 00:00:00 2001 From: Debadatta3337 Date: Wed, 29 Oct 2025 15:04:45 +0530 Subject: [PATCH 936/986] [PWGDQ] Central Barrel MC Multiplicity added (#13569) --- PWGDQ/Core/HistogramsLibrary.cxx | 6 ++++++ PWGDQ/Core/VarManager.cxx | 6 ++++++ PWGDQ/Core/VarManager.h | 6 ++++++ PWGDQ/DataModel/ReducedInfoTables.h | 3 ++- PWGDQ/TableProducer/tableMakerMC.cxx | 4 ++-- PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx | 15 ++++++++------- 6 files changed, 30 insertions(+), 10 deletions(-) diff --git a/PWGDQ/Core/HistogramsLibrary.cxx b/PWGDQ/Core/HistogramsLibrary.cxx index c103d576840..f76b92b1b3c 100644 --- a/PWGDQ/Core/HistogramsLibrary.cxx +++ b/PWGDQ/Core/HistogramsLibrary.cxx @@ -120,6 +120,9 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "VtxZ_MultFT0C", "VtxZ vs MultFT0C", false, 20, -10.0, 10.0, VarManager::kVtxZ, 200, 0, 25000.0, VarManager::kMultFT0C); hm->AddHistogram(histClass, "VtxZ_MultFDDA", "VtxZ vs MultFDDA", false, 20, -10.0, 10.0, VarManager::kVtxZ, 200, 0, 25000.0, VarManager::kMultFDDA); hm->AddHistogram(histClass, "VtxZ_MultFDDC", "VtxZ vs MultFDDC", false, 20, -10.0, 10.0, VarManager::kVtxZ, 200, 0, 25000.0, VarManager::kMultFDDC); + hm->AddHistogram(histClass, "MultNTracksPVetaHalf_MultMCNParticlesEta05", "MultNTracksPVetaHalf vs MultMCNParticlesEta05", false, 150, 0, 150.0, VarManager::kMultNTracksPVetaHalf, 150, 0, 150.0, VarManager::kMultMCNParticlesEta05); + hm->AddHistogram(histClass, "VtxNcontribReal_MultMCNParticlesEta08", "VtxNcontribReal vs MultMCNParticlesEta08", false, 150, 0, 150.0, VarManager::kVtxNcontribReal, 150, 0, 150.0, VarManager::kMultMCNParticlesEta08); + hm->AddHistogram(histClass, "MultNTracksPVeta1_MultMCNParticlesEta10", "MultNTracksPVeta1 vs MultMCNParticlesEta10", false, 150, 0, 150.0, VarManager::kMultNTracksPVeta1, 150, 0, 150.0, VarManager::kMultMCNParticlesEta10); } else { hm->AddHistogram(histClass, "MultTPC", "MultTPC", false, 200, 0.0, 50000.0, VarManager::kMultTPC); @@ -223,6 +226,9 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "MCVtxX_VtxY", "Vtx X vs Vtx Y", false, 200, 15.0, 15.0, VarManager::kMCVtxZ, 200, -0.2, 0.2, VarManager::kMCVtxY); hm->AddHistogram(histClass, "MCImpPar", "MC impact param", false, 20, 0.0, 20.0, VarManager::kMCEventImpParam); hm->AddHistogram(histClass, "MCCentrFT0C", "MC Centrality FT0C", false, 100, 0.0, 100.0, VarManager::kMCEventCentrFT0C); + hm->AddHistogram(histClass, "MultMCNParticlesEta05", "MultMCNParticlesEta05", false, 150, 0.0, 150.0, VarManager::kMultMCNParticlesEta05); + hm->AddHistogram(histClass, "MultMCNParticlesEta08", "MultMCNParticlesEta08", false, 150, 0.0, 150.0, VarManager::kMultMCNParticlesEta08); + hm->AddHistogram(histClass, "MultMCNParticlesEta10", "MultMCNParticlesEta10", false, 150, 0.0, 150.0, VarManager::kMultMCNParticlesEta10); } if (subGroupStr.Contains("subgen")) { hm->AddHistogram(histClass, "SubGenID", "SubGenerator ID", false, 11, -0.5, 10.5, VarManager::kMCEventSubGeneratorId); diff --git a/PWGDQ/Core/VarManager.cxx b/PWGDQ/Core/VarManager.cxx index 496a6ca18ae..30f68fdd03e 100644 --- a/PWGDQ/Core/VarManager.cxx +++ b/PWGDQ/Core/VarManager.cxx @@ -446,6 +446,9 @@ void VarManager::SetDefaultVarNames() fgVariableNames[kMCEventWeight] = "MC event weight"; fgVariableNames[kMCEventImpParam] = "MC impact parameter"; fgVariableNames[kMCEventCentrFT0C] = "MC Centrality FT0C"; + fgVariableNames[kMultMCNParticlesEta05] = "MC Multiplicity Central Barrel for |eta| < 0.5"; + fgVariableNames[kMultMCNParticlesEta08] = "MC Multiplicity Central Barrel for |eta| < 0.8"; + fgVariableNames[kMultMCNParticlesEta10] = "MC Multiplicity Central Barrel for |eta| < 1.0"; fgVariableUnits[kMCEventGeneratorId] = ""; fgVariableUnits[kMCEventSubGeneratorId] = ""; fgVariableUnits[kMCVtxX] = "cm"; @@ -455,6 +458,9 @@ void VarManager::SetDefaultVarNames() fgVariableUnits[kMCEventWeight] = ""; fgVariableUnits[kMCEventImpParam] = "b"; fgVariableUnits[kMCEventCentrFT0C] = "%"; + fgVariableUnits[kMultMCNParticlesEta05] = "Multiplicity_eta05"; + fgVariableUnits[kMultMCNParticlesEta08] = "Multiplicity_eta08"; + fgVariableUnits[kMultMCNParticlesEta10] = "Multiplicity_eta10"; fgVariableNames[kTwoEvPosZ1] = "vtx-z_{1}"; fgVariableUnits[kTwoEvPosZ1] = "cm"; fgVariableNames[kTwoEvPosZ2] = "vtx-z_{2}"; diff --git a/PWGDQ/Core/VarManager.h b/PWGDQ/Core/VarManager.h index 42531168bad..2e19c26ad9c 100644 --- a/PWGDQ/Core/VarManager.h +++ b/PWGDQ/Core/VarManager.h @@ -283,6 +283,9 @@ class VarManager : public TObject kMCEventWeight, kMCEventImpParam, kMCEventCentrFT0C, + kMultMCNParticlesEta10, + kMultMCNParticlesEta08, + kMultMCNParticlesEta05, kQ1ZNAX, kQ1ZNAY, kQ1ZNCX, @@ -1989,6 +1992,9 @@ void VarManager::FillEvent(T const& event, float* values) if constexpr ((fillMap & CollisionCent) > 0) { // WARNING: temporary solution, ongoing work to provide proper MC gen. centrality values[kMCEventCentrFT0C] = event.bestCollisionCentFT0C(); + values[kMultMCNParticlesEta05] = event.multMCNParticlesEta05(); + values[kMultMCNParticlesEta08] = event.multMCNParticlesEta08(); + values[kMultMCNParticlesEta10] = event.multMCNParticlesEta10(); } } diff --git a/PWGDQ/DataModel/ReducedInfoTables.h b/PWGDQ/DataModel/ReducedInfoTables.h index 40449639d1f..61074b2215e 100644 --- a/PWGDQ/DataModel/ReducedInfoTables.h +++ b/PWGDQ/DataModel/ReducedInfoTables.h @@ -221,7 +221,8 @@ DECLARE_SOA_TABLE(ReducedEventsInfo, "AOD", "REDUCEVENTINFO", //! Main event i DECLARE_SOA_TABLE(ReducedMCEvents, "AOD", "REDUCEDMCEVENT", //! Event level MC truth information o2::soa::Index<>, mccollision::GeneratorsID, reducedevent::MCPosX, reducedevent::MCPosY, reducedevent::MCPosZ, - mccollision::T, mccollision::Weight, mccollision::ImpactParameter); + mccollision::T, mccollision::Weight, mccollision::ImpactParameter, + mult::MultMCNParticlesEta05, mult::MultMCNParticlesEta08, mult::MultMCNParticlesEta10); using ReducedEvent = ReducedEvents::iterator; using StoredReducedEvent = StoredReducedEvents::iterator; diff --git a/PWGDQ/TableProducer/tableMakerMC.cxx b/PWGDQ/TableProducer/tableMakerMC.cxx index 1d43d196f9d..f7f4f0939e4 100644 --- a/PWGDQ/TableProducer/tableMakerMC.cxx +++ b/PWGDQ/TableProducer/tableMakerMC.cxx @@ -461,7 +461,7 @@ struct TableMakerMC { // make an entry for this MC event only if it was not already added to the table if (!(fEventLabels.find(mcCollision.globalIndex()) != fEventLabels.end())) { eventMC(mcCollision.generatorsID(), mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(), - mcCollision.t(), mcCollision.weight(), mcCollision.impactParameter()); + mcCollision.t(), mcCollision.weight(), mcCollision.impactParameter(), 1, 1, 1); fEventLabels[mcCollision.globalIndex()] = fCounters[1]; fCounters[1]++; } @@ -1096,7 +1096,7 @@ struct TableMakerMC { // make an entry for this MC event only if it was not already added to the table if (!(fEventLabels.find(mcCollision.globalIndex()) != fEventLabels.end())) { eventMC(mcCollision.generatorsID(), mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(), - mcCollision.t(), mcCollision.weight(), mcCollision.impactParameter()); + mcCollision.t(), mcCollision.weight(), mcCollision.impactParameter(), 1, 1, 1); fEventLabels[mcCollision.globalIndex()] = fCounters[1]; fCounters[1]++; } diff --git a/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx b/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx index 262be9de78b..e0d27b6a099 100644 --- a/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx +++ b/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx @@ -99,7 +99,7 @@ using MyEventsWithMultsAndRapidityGapFilter = soa::Join; using MyEventsWithCentAndMults = soa::Join; using MFTTrackLabeled = soa::Join; -using MyEventsMcWithMults = soa::Join; +using MyEventsMcWithMults = soa::Join; // Declare bit maps containing information on the table joins content (used as argument in templated functions) constexpr static uint32_t gkEventFillMap = VarManager::ObjTypes::BC | VarManager::ObjTypes::Collision; @@ -469,7 +469,8 @@ struct TableMakerMC { fHistMan->FillHistClass("Event_MCTruth", VarManager::fgValues); // Create the skimmed table entry for this collision eventMC(mcCollision.generatorsID(), mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(), - mcCollision.t(), mcCollision.weight(), mcCollision.impactParameter()); + mcCollision.t(), mcCollision.weight(), mcCollision.impactParameter(), + mcCollision.multMCNParticlesEta05(), mcCollision.multMCNParticlesEta08(), mcCollision.multMCNParticlesEta10()); } } @@ -563,7 +564,7 @@ struct TableMakerMC { } // end loop over mc stack } - template + template void skimCollisions(TEvents const& collisions, BCsWithTimestamps const& /*bcs*/) { // Skim reconstructed collisions which are selected by the user specified cuts @@ -623,7 +624,7 @@ struct TableMakerMC { VarManager::FillEvent(collision); // extract event information and place it in the fValues array if (collision.has_mcCollision()) { auto mcCollision = collision.template mcCollision_as(); - VarManager::FillEvent(mcCollision); + VarManager::FillEvent(mcCollision); } if (fDoDetailedQA) { fHistMan->FillHistClass("Event_BeforeCuts", VarManager::fgValues); @@ -1178,11 +1179,11 @@ struct TableMakerMC { } // end skimMuons template + typename TMuons, typename TMFTTracks, typename TTrackAssoc, typename TFwdTrackAssoc, typename TMFTTrackAssoc, typename TMFTCov, typename MyEventsMcWithMults> void fullSkimming(TEvents const& collisions, BCsWithTimestamps const& bcs, TTracks const& tracksBarrel, TMuons const& muons, TMFTTracks const& mftTracks, TTrackAssoc const& trackAssocs, TFwdTrackAssoc const& fwdTrackAssocs, TMFTTrackAssoc const& mftAssocs, - TEventsMC const& mcCollisions, aod::McParticles const& mcParticles, TMFTCov const& mftCovs) + MyEventsMcWithMults const& mcCollisions, aod::McParticles const& mcParticles, TMFTCov const& mftCovs) { // Check whether the run changed and update CCDB if it did if (bcs.size() > 0 && fCurrentRun != bcs.begin().runNumber()) { @@ -1224,7 +1225,7 @@ struct TableMakerMC { eventVtxCov.reserve(collisions.size()); eventMClabels.reserve(collisions.size()); eventInfo.reserve(collisions.size()); - skimCollisions(collisions, bcs); + skimCollisions(collisions, bcs); if (fCollIndexMap.size() == 0) { return; } From 4b843982db6944759d48195e210ce5add4856e78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= <26327373+vkucera@users.noreply.github.com> Date: Wed, 29 Oct 2025 10:59:32 +0100 Subject: [PATCH 937/986] [PWGHF] pidCreator: Use combineNSigma from utilsPid.h (#13519) --- PWGHF/TableProducer/pidCreator.cxx | 31 ++---------------------------- PWGHF/Utils/utilsPid.h | 20 +++++++++---------- 2 files changed, 12 insertions(+), 39 deletions(-) diff --git a/PWGHF/TableProducer/pidCreator.cxx b/PWGHF/TableProducer/pidCreator.cxx index e914c4f1c38..0f1e455313b 100644 --- a/PWGHF/TableProducer/pidCreator.cxx +++ b/PWGHF/TableProducer/pidCreator.cxx @@ -15,10 +15,9 @@ /// \author Vít Kučera , Inha University #include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/Utils/utilsPid.h" #include "Common/Core/TableHelper.h" -#include "Common/DataModel/PIDResponseTOF.h" -#include "Common/DataModel/PIDResponseTPC.h" #include #include @@ -32,6 +31,7 @@ using namespace o2; using namespace o2::framework; +using namespace o2::aod::pid_tpc_tof_utils; struct HfPidCreator { Produces trackPidFullEl; @@ -47,9 +47,6 @@ struct HfPidCreator { Produces trackPidFullDe; Produces trackPidTinyDe; - static constexpr float NSigmaToleranceDefault = .1f; - static constexpr float NSigmaDefault = -999.f + NSigmaToleranceDefault; // -999.f is the default value set in TPCPIDResponse.h and PIDTOF.h - /// Function to check whether the process function flag matches the need for filling the table /// \param initContext workflow context (argument of the init function) /// \param table name of the table @@ -85,30 +82,6 @@ struct HfPidCreator { checkTableSwitch(initContext, "PidTpcTofTinyDe", doprocessTinyDe); } - /// Function to combine TPC and TOF NSigma - /// \param tiny switch between full and tiny (binned) PID tables - /// \param tpcNSigma is the (binned) NSigma separation in TPC (if tiny = true) - /// \param tofNSigma is the (binned) NSigma separation in TOF (if tiny = true) - /// \return combined NSigma of TPC and TOF - template - T1 combineNSigma(T1 tpcNSigma, T1 tofNSigma) - { - if constexpr (Tiny) { - tpcNSigma *= aod::pidtpc_tiny::binning::bin_width; - tofNSigma *= aod::pidtof_tiny::binning::bin_width; - } - if ((tpcNSigma > NSigmaDefault) && (tofNSigma > NSigmaDefault)) { // TPC and TOF - return std::sqrt(.5f * (tpcNSigma * tpcNSigma + tofNSigma * tofNSigma)); - } - if (tpcNSigma > NSigmaDefault) { // only TPC - return std::abs(tpcNSigma); - } - if (tofNSigma > NSigmaDefault) { // only TOF - return std::abs(tofNSigma); - } - return tofNSigma; // no TPC nor TOF - } - void processDummy(aod::Collisions const&) {} PROCESS_SWITCH(HfPidCreator, processDummy, "Process nothing", true); diff --git a/PWGHF/Utils/utilsPid.h b/PWGHF/Utils/utilsPid.h index 629db2a0325..fc1d0d18940 100644 --- a/PWGHF/Utils/utilsPid.h +++ b/PWGHF/Utils/utilsPid.h @@ -43,29 +43,29 @@ enum PidMethod { NPidMethods }; -/// Function to combine TPC and TOF NSigma -/// \param tiny switch between full and tiny (binned) PID tables -/// \param nSigmaTpc is the (binned) NSigma separation in TPC (if tiny = true) -/// \param nSigmaTof is the (binned) NSigma separation in TOF (if tiny = true) -/// \return combined NSigma of TPC and TOF +/// Function to combine TPC and TOF nSigma +/// \tparam Tiny switch between full and tiny (binned) PID tables +/// \param nSigmaTpc is the (binned) nSigma separation in TPC (if Tiny = true) +/// \param nSigmaTof is the (binned) nSigma separation in TOF (if Tiny = true) +/// \return combined nSigma of TPC and TOF template TNumber combineNSigma(TNumber nSigmaTpc, TNumber nSigmaTof) { - static constexpr float DefaultNSigmaTolerance = .1f; - static constexpr float DefaultNSigma = -999.f + DefaultNSigmaTolerance; // -999.f is the default value set in TPCPIDResponse.h and PIDTOF.h + static constexpr float NSigmaToleranceDefault = .1f; + static constexpr float NSigmaDefault = -999.f + NSigmaToleranceDefault; // -999.f is the default value set in TPCPIDResponse.h and PIDTOF.h if constexpr (Tiny) { nSigmaTpc *= aod::pidtpc_tiny::binning::bin_width; nSigmaTof *= aod::pidtof_tiny::binning::bin_width; } - if ((nSigmaTpc > DefaultNSigma) && (nSigmaTof > DefaultNSigma)) { // TPC and TOF + if ((nSigmaTpc > NSigmaDefault) && (nSigmaTof > NSigmaDefault)) { // TPC and TOF return std::sqrt(.5f * (nSigmaTpc * nSigmaTpc + nSigmaTof * nSigmaTof)); } - if (nSigmaTpc > DefaultNSigma) { // only TPC + if (nSigmaTpc > NSigmaDefault) { // only TPC return std::abs(nSigmaTpc); } - if (nSigmaTof > DefaultNSigma) { // only TOF + if (nSigmaTof > NSigmaDefault) { // only TOF return std::abs(nSigmaTof); } return nSigmaTof; // no TPC nor TOF From 788b71b5b9418ae4ae79a28f2e3aade2b256b92c Mon Sep 17 00:00:00 2001 From: Anantha Padmanabhan M Nair <82643666+ananthapadmanabhan18@users.noreply.github.com> Date: Wed, 29 Oct 2025 06:09:46 -0400 Subject: [PATCH 938/986] [PWGUD] Modified Combinatorial BG estimation (#13470) --- PWGUD/Tasks/exclusiveRhoTo4Pi.cxx | 128 +++++++++++++++++++++++------- 1 file changed, 100 insertions(+), 28 deletions(-) diff --git a/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx b/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx index b19fc4c2d30..3c570a4efa3 100644 --- a/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx +++ b/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx @@ -57,6 +57,12 @@ struct ExclusiveRhoTo4Pi { int numFourPionTracks = 4; int numPiPlus = 2; int numPiMinus = 2; + // Numbers for background estimation + int zero = 0; + int one = 1; + int three = 3; + int four = 4; + // PDG Codes and rho mass double mRho0 = 0.77526; // GeV/c^2 int rhoPrime = 30113; // Pb-Pb at 5.36 TeV @@ -112,7 +118,8 @@ struct ExclusiveRhoTo4Pi { { // QA plots: Event and Track Counter histosDataCounter.add("EventsCounts_vs_runNo", "Event Counter Run by Run; Run Number; Number of Events", kTH2F, {{113, 0, 113}, {14, 0, 14}}); - histosDataCounter.add("TracksCounts_vs_runNo", "Track Counter Run by Run; Run Number; Number of Tracks", kTH2F, {{113, 0, 113}, {14, 0, 14}}); + histosDataCounter.add("TracksCounts_vs_runNo", "Track Counter Run by Run; Run Number; Number of Track", kTH2F, {{113, 0, 113}, {14, 0, 14}}); + histosDataCounter.add("LostInTrackCut_vs_runNo", "Track Counter Run by Run; Run Number; Number of Tracks", kTH2F, {{113, 0, 113}, {14, 0, 14}}); // QA plots: event selection-selected events histosQA.add("Events/selected/UPCmode", "UPC mode; Events", kTH1F, {{5, 0, 5}}); histosQA.add("Events/selected/GapSide", "Gap Side;Gap Side; Events", kTH1F, {{4, 0, 4}}); @@ -235,19 +242,19 @@ struct ExclusiveRhoTo4Pi { histosKin.add("all", ";pT [GeV/c]; #eta;#varphi", kTH3F, {pTAxis, etaAxis, phiAxis}); histosKin.add("selected", ";pT [GeV/c]; #eta;#varphi", kTH3F, {pTAxis, etaAxis, phiAxis}); histosKin.add("pions", ";pT [GeV/c]; #eta;#varphi", kTH3F, {pTAxis, etaAxis, phiAxis}); - histosKin.add("pions-from-4pi", ";pT [GeV/c]; #eta;#varphi;y ", kTHnSparseF, {pTAxis, etaAxis, phiAxis, rapidityAxis}); + histosKin.add("pions-from-4pion", ";pT [GeV/c]; #eta;#varphi;y ", kTHnSparseF, {pTAxis, etaAxis, phiAxis, rapidityAxis}); // Rho Prime Kinematics - histos4piKin.add("two-pion-mass", ";m_{#pi^{+}#pi^{-}} [GeV/c^2];m_{#pi^{+}#pi^{-}} [GeV/c^2];m_{#pi^{+}#pi^{-}} [GeV/c^2];m_{#pi^{+}#pi^{-}} [GeV/c^2];m_{4#pi} [GeV/c^{2}]", kTHnSparseF, {{100, 0, 2}, {100, 0, 2}, {100, 0, 2}, {100, 0, 2}, invMassAxis}); - histos4piKin.add("2PiPlusPiMinusMass", ";m_{#pi^{+}#pi^{+}#pi^{-}} [GeV/c^2];m_{#pi^{+}#pi^{+}#pi^{-}} [GeV/c^2];m_{#pi^{+}#pi^{-}#pi^{+}}#pi^{-}} [GeV/c^2]", kTHnSparseF, {{200, 0, 2.5}, {200, 0, 2.5}, invMassAxis}); - histos4piKin.add("2PiMinusPiPlusMass", ";m_{#pi^{-}#pi^{-}#pi^{+}} [GeV/c^2];m_{#pi^{-}#pi^{-}#pi^{+}} [GeV/c^2];m_{#pi^{+}#pi^{-}#pi^{+}}#pi^{-}} [GeV/c^2]", kTHnSparseF, {{200, 0, 2.5}, {200, 0, 2.5}, invMassAxis}); + histos4piKin.add("two-pion", ";p_{T}^{4#pi} [GeV/c] ;m_{#pi^{+}#pi^{-}} [GeV/c^2];m_{#pi^{+}#pi^{-}} [GeV/c^2];m_{#pi^{+}#pi^{-}} [GeV/c^2];m_{#pi^{+}#pi^{-}} [GeV/c^2];m_{4#pi} [GeV/c^{2}]", kTHnSparseF, {{100, 0, 2}, {100, 0, 2}, {100, 0, 2}, {100, 0, 2}, invMassAxis}); histos4piKin.add("zero-charge", ";pT [GeV/c]; #eta; #varphi [rad];y; m_{4#pi} [GeV/c^{2}]; Collin-Soper cos(#theta); Collin-Soper #varphi [rad];Run Number", kTHnSparseF, {pTAxis, etaAxis, phiAxis, rapidityAxis, invMassAxis, cosThetaAxis, phiAxis, {113, 0, 113}}); histos4piKin.add("non-zero-charge", ";pT [GeV/c]; #eta; #varphi [rad];y; m_{4#pi} [GeV/c^{2}];Run Number", kTHnSparseF, {pTAxis, etaAxis, phiAxis, rapidityAxis, invMassAxis, {113, 0, 113}}); + histos4piKin.add("3piMinus-1piPlus", ";pT [GeV/c]; #eta; #varphi [rad];y; m_{4#pi} [GeV/c^{2}]; Run Number", kTHnSparseF, {pTAxis, etaAxis, phiAxis, rapidityAxis, invMassAxis, {113, 0, 113}}); + histos4piKin.add("3piPlus-1piMinus", ";pT [GeV/c]; #eta; #varphi [rad];y; m_{4#pi} [GeV/c^{2}]; Run Number", kTHnSparseF, {pTAxis, etaAxis, phiAxis, rapidityAxis, invMassAxis, {113, 0, 113}}); + histos4piKin.add("4piPlus", ";pT [GeV/c]; #eta; #varphi [rad];y; m_{4#pi} [GeV/c^{2}]; Run Number", kTHnSparseF, {pTAxis, etaAxis, phiAxis, rapidityAxis, invMassAxis, {113, 0, 113}}); + histos4piKin.add("4piMinus", ";pT [GeV/c]; #eta; #varphi [rad];y; m_{4#pi} [GeV/c^{2}]; Run Number", kTHnSparseF, {pTAxis, etaAxis, phiAxis, rapidityAxis, invMassAxis, {113, 0, 113}}); // MC truth - histosMCtruth.add("pions-from-4pi", ";pT [GeV/c]; #eta;#varphi;y ", kTHnSparseF, {pTAxis, etaAxis, phiAxis, rapidityAxis, {113, 0, 113}}); + histosMCtruth.add("4-pi-pions", ";pT [GeV/c]; #eta;#varphi;y ", kTHnSparseF, {pTAxis, etaAxis, phiAxis, rapidityAxis, {113, 0, 113}}); histosMCtruth.add("Four-pion", ";pT [GeV/c]; #eta; #varphi [rad];y; m_{4#pi} [GeV/c^{2}];Run Number", kTHnSparseF, {pTAxis, etaAxis, phiAxis, rapidityAxis, invMassAxis, {113, 0, 113}}); - - //___________________________________________________________________________________________________________________________ - + //_______________________________________________________________________________________________________________________________________________ setHistBinLabels(); } // End of init function @@ -460,25 +467,19 @@ struct ExclusiveRhoTo4Pi { PxPyPzMVector p4(selectedPionMinusTracks[1].px(), selectedPionMinusTracks[1].py(), selectedPionMinusTracks[1].pz(), o2::constants::physics::MassPionCharged); // Kinematics for pions from 4 pion events - histosKin.fill(HIST("pions-from-4pi"), p1.Pt(), p1.Eta(), p1.Phi(), p1.Rapidity()); - histosKin.fill(HIST("pions-from-4pi"), p2.Pt(), p2.Eta(), p2.Phi(), p2.Rapidity()); - histosKin.fill(HIST("pions-from-4pi"), p3.Pt(), p3.Eta(), p3.Phi(), p3.Rapidity()); - histosKin.fill(HIST("pions-from-4pi"), p4.Pt(), p4.Eta(), p4.Phi(), p4.Rapidity()); + histosKin.fill(HIST("pions-from-4pion"), p1.Pt(), p1.Eta(), p1.Phi(), p1.Rapidity()); + histosKin.fill(HIST("pions-from-4pion"), p2.Pt(), p2.Eta(), p2.Phi(), p2.Rapidity()); + histosKin.fill(HIST("pions-from-4pion"), p3.Pt(), p3.Eta(), p3.Phi(), p3.Rapidity()); + histosKin.fill(HIST("pions-from-4pion"), p4.Pt(), p4.Eta(), p4.Phi(), p4.Rapidity()); PxPyPzMVector p1234 = p1 + p2 + p3 + p4; PxPyPzMVector p13 = p1 + p3; PxPyPzMVector p14 = p1 + p4; PxPyPzMVector p23 = p2 + p3; PxPyPzMVector p24 = p2 + p4; - PxPyPzMVector p123 = p1 + p2 + p3; - PxPyPzMVector p124 = p1 + p2 + p4; - PxPyPzMVector p134 = p1 + p3 + p4; - PxPyPzMVector p234 = p2 + p3 + p4; // Two Pion Mass combinations - histos4piKin.fill(HIST("two-pion-mass"), p13.M(), p14.M(), p23.M(), p24.M(), p1234.M()); - histos4piKin.fill(HIST("2PiPlusPiMinusMass"), p123.M(), p124.M(), p1234.M()); - histos4piKin.fill(HIST("2PiMinusPiPlusMass"), p134.M(), p234.M(), p1234.M()); + histos4piKin.fill(HIST("two-pion"), p1234.Pt(), p13.M(), p14.M(), p23.M(), p24.M(), p1234.M()); double fourPiPhiPair1 = collinSoperPhi(p13, p1234); double fourPiPhiPair2 = collinSoperPhi(p14, p1234); @@ -513,6 +514,15 @@ struct ExclusiveRhoTo4Pi { PxPyPzMVector p4(selectedPionTracks[3].px(), selectedPionTracks[3].py(), selectedPionTracks[3].pz(), o2::constants::physics::MassPionCharged); PxPyPzMVector p1234 = p1 + p2 + p3 + p4; // Kinematics for 4 pion system from non 0 charge events + if (numPionMinusTracks == three && numPiPlusTracks == one) { + histos4piKin.fill(HIST("3piMinus-1piPlus"), p1234.Pt(), p1234.Eta(), p1234.Phi(), p1234.Rapidity(), p1234.M(), runIndex); + } else if (numPionMinusTracks == one && numPiPlusTracks == three) { + histos4piKin.fill(HIST("3piPlus-1piMinus"), p1234.Pt(), p1234.Eta(), p1234.Phi(), p1234.Rapidity(), p1234.M(), runIndex); + } else if (numPionMinusTracks == four && numPiPlusTracks == zero) { + histos4piKin.fill(HIST("4piMinus"), p1234.Pt(), p1234.Eta(), p1234.Phi(), p1234.Rapidity(), p1234.M(), runIndex); + } else if (numPionMinusTracks == zero && numPiPlusTracks == four) { + histos4piKin.fill(HIST("4piPlus"), p1234.Pt(), p1234.Eta(), p1234.Phi(), p1234.Rapidity(), p1234.M(), runIndex); + } histos4piKin.fill(HIST("non-zero-charge"), p1234.Pt(), p1234.Eta(), p1234.Phi(), p1234.Rapidity(), p1234.M(), runIndex); } // End of Analysis for non 0 charge events } // End of 4 Pion Analysis Process function for Pass5 Data @@ -586,74 +596,121 @@ struct ExclusiveRhoTo4Pi { { int runIndex = getRunNumberIndex(collision.runNumber()); // Check if the Event is reconstructed in UPC mode - if (collision.flags() != ifUPC) { + if ((collision.flags() != ifUPC) || (!sgSelector.isCBTHadronZdcOk(collision))) { return; } + + bool ifRejectedEvent = false; + for (const auto& track : tracks) { + + if (ifRejectedEvent) { + break; + } + histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 0); PxPyPzMVector trackVector(track.px(), track.py(), track.pz(), o2::constants::physics::MassPionCharged); // is PV contributor if (track.isPVContributor() != useOnlyPVtracks) { + histosDataCounter.fill(HIST("LostInTrackCut_vs_runNo"), runIndex, 1); + ifRejectedEvent = true; continue; } histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 1); + // pt cut if (trackVector.Pt() < pTcut) { + histosDataCounter.fill(HIST("LostInTrackCut_vs_runNo"), runIndex, 2); + ifRejectedEvent = true; continue; } histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 2); + // eta cut if (std::abs(trackVector.Eta()) > etaCut) { + histosDataCounter.fill(HIST("LostInTrackCut_vs_runNo"), runIndex, 3); + ifRejectedEvent = true; continue; } histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 3); + // DCA Z cut if (std::abs(track.dcaZ()) > dcaZcut) { + histosDataCounter.fill(HIST("LostInTrackCut_vs_runNo"), runIndex, 4); + ifRejectedEvent = true; continue; } histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 4); + // DCA XY cut float maxDCAxy = 0.0105 + 0.035 / std::pow(trackVector.Pt(), 1.1); if (dcaXYcut == 0 && (std::fabs(track.dcaXY()) > maxDCAxy)) { + histosDataCounter.fill(HIST("LostInTrackCut_vs_runNo"), runIndex, 5); + ifRejectedEvent = true; continue; } else if (dcaXYcut != 0 && (std::fabs(track.dcaXY()) > dcaXYcut)) { + histosDataCounter.fill(HIST("LostInTrackCut_vs_runNo"), runIndex, 5); + ifRejectedEvent = true; continue; } histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 5); + // ITS Track only if (useITStracksOnly && !track.hasITS()) { + histosDataCounter.fill(HIST("LostInTrackCut_vs_runNo"), runIndex, 6); + ifRejectedEvent = true; continue; } histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 6); + // TPC Track only if (useTPCtracksOnly && !track.hasTPC()) { + histosDataCounter.fill(HIST("LostInTrackCut_vs_runNo"), runIndex, 7); + ifRejectedEvent = true; continue; } histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 7); + // ITS Chi2 N Clusters cut if (track.hasITS() && track.itsChi2NCl() > itsChi2NClsCut) { + histosDataCounter.fill(HIST("LostInTrackCut_vs_runNo"), runIndex, 8); + ifRejectedEvent = true; continue; } histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 8); + // TPC Chi2 N Clusters cut if (track.hasTPC() && track.tpcChi2NCl() > tpcChi2NClsCut) { + histosDataCounter.fill(HIST("LostInTrackCut_vs_runNo"), runIndex, 9); + ifRejectedEvent = true; continue; } histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 9); + // TPC N Clusters Findable cut if (track.hasTPC() && track.tpcNClsFindable() < tpcNClsFindableCut) { + histosDataCounter.fill(HIST("LostInTrackCut_vs_runNo"), runIndex, 10); + ifRejectedEvent = true; continue; } histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 10); + // Selection PID Pion if (ifPion(track, useTOF, nSigmaTPCcut, nSigmaTOFcut)) { histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 11); if (track.sign() == 1) { histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 12); + } else { + histosDataCounter.fill(HIST("LostInTrackCut_vs_runNo"), runIndex, 12); } if (track.sign() == -1) { histosDataCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 13); + } else { + histosDataCounter.fill(HIST("LostInTrackCut_vs_runNo"), runIndex, 13); } + } else { + histosDataCounter.fill(HIST("LostInTrackCut_vs_runNo"), runIndex, 11); + ifRejectedEvent = true; } // End of Selection PID Pion } // End of loop over tracks } // End of processCounter function @@ -856,10 +913,10 @@ struct ExclusiveRhoTo4Pi { PxPyPzMVector p4(selectedPionMinusTracks[1].px(), selectedPionMinusTracks[1].py(), selectedPionMinusTracks[1].pz(), o2::constants::physics::MassPionCharged); // Kinematics for pions from 4 pion events - histosKin.fill(HIST("pions-from-4pi"), p1.Pt(), p1.Eta(), p1.Phi(), p1.Rapidity()); - histosKin.fill(HIST("pions-from-4pi"), p2.Pt(), p2.Eta(), p2.Phi(), p2.Rapidity()); - histosKin.fill(HIST("pions-from-4pi"), p3.Pt(), p3.Eta(), p3.Phi(), p3.Rapidity()); - histosKin.fill(HIST("pions-from-4pi"), p4.Pt(), p4.Eta(), p4.Phi(), p4.Rapidity()); + histosKin.fill(HIST("pions-from-4pion"), p1.Pt(), p1.Eta(), p1.Phi(), p1.Rapidity()); + histosKin.fill(HIST("pions-from-4pion"), p2.Pt(), p2.Eta(), p2.Phi(), p2.Rapidity()); + histosKin.fill(HIST("pions-from-4pion"), p3.Pt(), p3.Eta(), p3.Phi(), p3.Rapidity()); + histosKin.fill(HIST("pions-from-4pion"), p4.Pt(), p4.Eta(), p4.Phi(), p4.Rapidity()); PxPyPzMVector p1234 = p1 + p2 + p3 + p4; PxPyPzMVector p13 = p1 + p3; @@ -868,7 +925,7 @@ struct ExclusiveRhoTo4Pi { PxPyPzMVector p24 = p2 + p4; // Two Pion Mass combinations - histos4piKin.fill(HIST("two-pion-mass"), p13.M(), p14.M(), p23.M(), p24.M(), p1234.M()); + histos4piKin.fill(HIST("two-pion"), p13.M(), p14.M(), p23.M(), p24.M(), p1234.M()); double fourPiPhiPair1 = collinSoperPhi(p13, p1234); double fourPiPhiPair2 = collinSoperPhi(p14, p1234); @@ -884,6 +941,7 @@ struct ExclusiveRhoTo4Pi { double mDiff14 = std::abs((p14.M() - mRho0)); double mDiff23 = std::abs((p23.M() - mRho0)); double mDiff24 = std::abs((p24.M() - mRho0)); + if ((mDiff13 < mDiff14) && (mDiff13 < mDiff23) && (mDiff13 < mDiff24)) { histos4piKin.fill(HIST("zero-charge"), p1234.Pt(), p1234.Eta(), p1234.Phi(), p1234.Rapidity(), p1234.M(), fourPiCosThetaPair1, fourPiPhiPair1, runIndex); } else if ((mDiff14 < mDiff13) && (mDiff14 < mDiff23) && (mDiff14 < mDiff24)) { @@ -903,6 +961,15 @@ struct ExclusiveRhoTo4Pi { PxPyPzMVector p4(selectedPionTracks[3].px(), selectedPionTracks[3].py(), selectedPionTracks[3].pz(), o2::constants::physics::MassPionCharged); PxPyPzMVector p1234 = p1 + p2 + p3 + p4; // Kinematics for 4 pion system from non 0 charge events + if (numPionMinusTracks == three && numPiPlusTracks == one) { + histos4piKin.fill(HIST("3piMinus-1piPlus"), p1234.Pt(), p1234.Eta(), p1234.Phi(), p1234.Rapidity(), p1234.M(), runIndex); + } else if (numPionMinusTracks == one && numPiPlusTracks == three) { + histos4piKin.fill(HIST("3piPlus-1piMinus"), p1234.Pt(), p1234.Eta(), p1234.Phi(), p1234.Rapidity(), p1234.M(), runIndex); + } else if (numPionMinusTracks == four && numPiPlusTracks == zero) { + histos4piKin.fill(HIST("4piMinus"), p1234.Pt(), p1234.Eta(), p1234.Phi(), p1234.Rapidity(), p1234.M(), runIndex); + } else if (numPionMinusTracks == zero && numPiPlusTracks == four) { + histos4piKin.fill(HIST("4piPlus"), p1234.Pt(), p1234.Eta(), p1234.Phi(), p1234.Rapidity(), p1234.M(), runIndex); + } histos4piKin.fill(HIST("non-zero-charge"), p1234.Pt(), p1234.Eta(), p1234.Phi(), p1234.Rapidity(), p1234.M(), runIndex); } // End of Analysis for non 0 charge events } // End of 4 Pion Analysis Process function for Pass5 MC @@ -924,11 +991,11 @@ struct ExclusiveRhoTo4Pi { for (const auto& daughter : particle.daughters_as()) { PxPyPzMVector dVector(daughter.px(), daughter.py(), daughter.pz(), o2::constants::physics::MassPionCharged); if (daughter.pdgCode() == PDG_t::kPiPlus) { - histosMCtruth.fill(HIST("pions-from-4pi"), dVector.Pt(), dVector.Eta(), dVector.Phi(), dVector.Rapidity(), runIndex); + histosMCtruth.fill(HIST("4-pi-pions"), dVector.Pt(), dVector.Eta(), dVector.Phi(), dVector.Rapidity(), runIndex); p1234 = p1234 + dVector; } if (daughter.pdgCode() == PDG_t::kPiMinus) { - histosMCtruth.fill(HIST("pions-from-4pi"), dVector.Pt(), dVector.Eta(), dVector.Phi(), dVector.Rapidity(), runIndex); + histosMCtruth.fill(HIST("4-pi-pions"), dVector.Pt(), dVector.Eta(), dVector.Phi(), dVector.Rapidity(), runIndex); p1234 = p1234 + dVector; } } // End of loop over daughters @@ -1105,6 +1172,7 @@ struct ExclusiveRhoTo4Pi { auto h1 = histosDataCounter.get(HIST("EventsCounts_vs_runNo")); auto h2 = histosDataCounter.get(HIST("TracksCounts_vs_runNo")); + auto h21 = histosDataCounter.get(HIST("LostInTrackCut_vs_runNo")); auto h3 = histos4piKin.get(HIST("zero-charge")); auto h4 = histos4piKin.get(HIST("non-zero-charge")); @@ -1115,9 +1183,13 @@ struct ExclusiveRhoTo4Pi { } for (int i = 0; i < numTrackCuts; ++i) { h2->GetYaxis()->SetBinLabel(i + 1, trackLabels[i].c_str()); + h21->GetYaxis()->SetBinLabel(i + 1, trackLabels[i].c_str()); } for (int i = 0; i < numRunNums; ++i) { std::string runLabel = std::to_string(runNos[i]); + h1->GetXaxis()->SetBinLabel(i + 1, runLabel.c_str()); + h2->GetXaxis()->SetBinLabel(i + 1, runLabel.c_str()); + h21->GetXaxis()->SetBinLabel(i + 1, runLabel.c_str()); h3->GetAxis(7)->SetBinLabel(i + 1, runLabel.c_str()); h4->GetAxis(5)->SetBinLabel(i + 1, runLabel.c_str()); h5->GetAxis(5)->SetBinLabel(i + 1, runLabel.c_str()); From 8aeef94c65724a3afd975495b383f9f491dbfda5 Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Wed, 29 Oct 2025 11:55:07 +0100 Subject: [PATCH 939/986] [PWGCF] FemtoUniverse: Add deta-dphi* distributions in kT ranges (#13584) Co-authored-by: ALICE Action Bot --- .../Core/FemtoUniverseDetaDphiStar.h | 83 +++++++++++++++++++ ...irTaskTrackTrackSpherHarMultKtExtended.cxx | 7 +- 2 files changed, 88 insertions(+), 2 deletions(-) diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h index 56af8090a79..57c7a22d4de 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h @@ -187,6 +187,27 @@ class FemtoUniverseDetaDphiStar } } + template + void init_kT(HistogramRegistry* registry, t1& ktbins) + { + mHistogramRegistry = registry; + ktBins = ktbins; + + if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kTrack) { + std::string dirName = static_cast(DirNames[0]); + for (int j = 0; j < static_cast(ktBins.size() - 1); j++) { + std::string histSuffixkT1 = std::to_string(static_cast(ktBins[j] * 100.0)); + std::string histSuffixkT2 = std::to_string(static_cast(ktBins[j + 1] * 100.0)); + std::string histFolderkT = "kT_" + histSuffixkT1 + "_" + histSuffixkT2 + "/"; + + histdetadphisamebeforekT[j] = mHistogramRegistry->add((dirName + histFolderkT + "detadphidetadphiBeforeSame").c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadphimixedbeforekT[j] = mHistogramRegistry->add((dirName + histFolderkT + "detadphidetadphiBeforeMixed").c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadphisameafterkT[j] = mHistogramRegistry->add((dirName + histFolderkT + "detadphidetadphiAfterSame").c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadphimixedafterkT[j] = mHistogramRegistry->add((dirName + histFolderkT + "detadphidetadphiAfterMixed").c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + } + } + } + /// Check if pair is close or not template bool isClosePair(Part const& part1, Part const& part2, Parts const& particles, float lmagfield, uint8_t ChosenEventType) @@ -620,6 +641,62 @@ class FemtoUniverseDetaDphiStar } } + /// Templated function to access different kT directory and call addEventPair + /// \param part1 particle 1 + /// \param part2 particle 2 + /// \param ChosenEventType Same or Mixed evet type + /// \param maxl Maximum valie of L component of the spherical harmonics + /// \param multval Multiplicity value + /// \param ktval kT value + template + void kTdetadphi(Part const& part1, Part const& part2, uint8_t ChosenEventType, float ktval) + { + int ktbinval = -1; + if (ktval >= ktBins[0] && ktval < ktBins[1]) { + ktbinval = 0; + } else if (ktval >= ktBins[1] && ktval < ktBins[2]) { + ktbinval = 1; + } else if (ktval >= ktBins[2] && ktval < ktBins[3]) { + ktbinval = 2; + } else if (ktval >= ktBins[3] && ktval < ktBins[4]) { + ktbinval = 3; + } else { + return; + } + isClosePairkT(part1, part2, ChosenEventType, ktbinval); + } + + /// Check if pair is close or not + template + void isClosePairkT(Part const& part1, Part const& part2, uint8_t ChosenEventType, int ktbinval) + { + /// Track-Track combination + // check if provided particles are in agreement with the class instantiation + if (part1.partType() != o2::aod::femtouniverseparticle::ParticleType::kTrack || part2.partType() != o2::aod::femtouniverseparticle::ParticleType::kTrack) { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar instantiation! Please provide kTrack,kTrack candidates."; + return; + } + auto deta = part1.eta() - part2.eta(); + auto dphiAvg = averagePhiStar(part1, part2, 0); + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadphisamebeforekT[ktbinval]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadphimixedbeforekT[ktbinval]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; + } + + if (std::pow(dphiAvg, 2) / std::pow(cutDeltaPhiStarMax, 2) + std::pow(deta, 2) / std::pow(cutDeltaEtaMax, 2) > 1.) { + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadphisameafterkT[ktbinval]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadphimixedafterkT[ktbinval]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; + } + } + } + /// Check if pair is close or not template void ClosePairqLCMS(Part const& part1, Part const& part2, float lmagfield, uint8_t ChosenEventType, double qlcms) // add typename Parts and variable parts for adding MClabels @@ -698,9 +775,15 @@ class FemtoUniverseDetaDphiStar float cutPhiInvMassLow; float cutPhiInvMassHigh; bool isSameSignCPR = false; + std::vector ktBins; std::array, 2>, 7> histdetadpisame{}; std::array, 2>, 7> histdetadpimixed{}; + std::array, 4> histdetadphisamebeforekT{}; + std::array, 4> histdetadphimixedbeforekT{}; + std::array, 4> histdetadphisameafterkT{}; + std::array, 4> histdetadphimixedafterkT{}; + std::array, 9>, 7> histdetadpiRadii{}; std::shared_ptr histdetadpiqlcmssame{}; diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx index 0f44093e466..35b8c394693 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx @@ -454,6 +454,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { pairCleaner.init(&qaRegistry); if (twotracksconfigs.ConfIsCPR.value) { pairCloseRejection.init(&resultRegistry, &qaRegistry, twotracksconfigs.ConfCPRdeltaPhiCutMin.value, twotracksconfigs.ConfCPRdeltaPhiCutMax.value, twotracksconfigs.ConfCPRdeltaEtaCutMin.value, twotracksconfigs.ConfCPRdeltaEtaCutMax.value, twotracksconfigs.ConfCPRChosenRadii.value, twotracksconfigs.ConfCPRPlotPerRadii.value); + pairCloseRejection.init_kT(&resultRegistry, ConfKtKstarBins); } vPIDPartOne = trackonefilter.ConfPIDPartOne.value; @@ -549,7 +550,9 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { continue; } + float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); if (twotracksconfigs.ConfIsCPR.value) { + pairCloseRejection.kTdetadphi(p1, p2, femto_universe_container::EventType::same, kT); if (confCPRIsAtITS.value) { if (pairCloseRejection.isClosePairAtITS(p1, p2, magFieldTesla, femto_universe_container::EventType::same)) { continue; @@ -566,7 +569,6 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { continue; } - float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); double rand; rand = randgen->Rndm(); @@ -919,7 +921,9 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { continue; } + float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); if (twotracksconfigs.ConfIsCPR.value) { + pairCloseRejection.kTdetadphi(p1, p2, femto_universe_container::EventType::mixed, kT); if (confCPRIsAtITS.value) { if (pairCloseRejection.isClosePairAtITS(p1, p2, magFieldTesla, femto_universe_container::EventType::mixed)) { continue; @@ -931,7 +935,6 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { } } - float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); double rand; rand = randgen->Rndm(); From e0cdec4d5513a97ccf43c216c932dba5057019a9 Mon Sep 17 00:00:00 2001 From: Swati <69241911+SwatiSaha-1997@users.noreply.github.com> Date: Wed, 29 Oct 2025 20:25:06 +0530 Subject: [PATCH 940/986] [PWGCF] Added event selection cut of IsGoodZVtxFT0vsPV (#13587) --- .../Tasks/MeanptFluctuations.cxx | 4 + .../Tasks/v0ptHadPiKaProt.cxx | 154 ++++++++++++++++-- 2 files changed, 145 insertions(+), 13 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/MeanptFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/MeanptFluctuations.cxx index dd212faf22d..77706f1bfd6 100644 --- a/PWGCF/EbyEFluctuations/Tasks/MeanptFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/MeanptFluctuations.cxx @@ -85,6 +85,7 @@ struct MeanptFluctuationsQAQnTable { Configurable cfgUseGoodITSLayerAllCut{"cfgUseGoodITSLayerAllCut", true, "Remove time interval with dead ITS zone"}; Configurable cfgEvSelkNoITSROFrameBorder{"cfgEvSelkNoITSROFrameBorder", true, "ITSROFrame border event selection cut"}; Configurable cfgEvSelkNoTimeFrameBorder{"cfgEvSelkNoTimeFrameBorder", true, "TimeFrame border event selection cut"}; + Configurable cfgEvSelUseGoodZvtxFT0vsPV{"cfgEvSelUseGoodZvtxFT0vsPV", true, "GoodZvertex and FT0 vs PV cut"}; Configurable cfgCentralityEstimator{"cfgCentralityEstimator", 1, "Centrlaity estimatore choice: 1-->FT0C, 2-->FT0A; 3-->FT0M, 4-->FV0A"}; O2_DEFINE_CONFIGURABLE(cfgEvSelMultCorrelation, bool, true, "Multiplicity correlation cut") @@ -329,6 +330,9 @@ struct MeanptFluctuationsQAQnTable { if (cfgEvSelkNoTimeFrameBorder && !(coll.selection_bit(o2::aod::evsel::kNoTimeFrameBorder))) { return; } + if (cfgEvSelUseGoodZvtxFT0vsPV && !(coll.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV))) { + return; + } histos.fill(HIST("MultCorrelationPlots/BeforeSelection/His2D_globalTracks_PVTracks_beforeSel"), coll.multNTracksPV(), inputTracks.size()); histos.fill(HIST("MultCorrelationPlots/BeforeSelection/His2D_globalTracks_centFT0C_beforeSel"), coll.centFT0C(), inputTracks.size()); diff --git a/PWGCF/EbyEFluctuations/Tasks/v0ptHadPiKaProt.cxx b/PWGCF/EbyEFluctuations/Tasks/v0ptHadPiKaProt.cxx index f0ec5f81685..f2f940ffad8 100644 --- a/PWGCF/EbyEFluctuations/Tasks/v0ptHadPiKaProt.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/v0ptHadPiKaProt.cxx @@ -34,6 +34,7 @@ #include "Framework/RunningWorkflowInfo.h" #include "Framework/StepTHn.h" #include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/PID.h" #include "ReconstructionDataFormats/Track.h" #include @@ -63,8 +64,42 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +static constexpr float LongArrayFloat[3][20] = {{1.1, 1.2, 1.3, -1.1, -1.2, -1.3, 1.1, 1.2, 1.3, -1.1, -1.2, -1.3, 1.1, 1.2, 1.3, -1.1, -1.2, -1.3, 1.1, 1.2}, {2.1, 2.2, 2.3, -2.1, -2.2, -2.3, 1.1, 1.2, 1.3, -1.1, -1.2, -1.3, 1.1, 1.2, 1.3, -1.1, -1.2, -1.3, 1.1, 1.2}, {3.1, 3.2, 3.3, -3.1, -3.2, -3.3, 1.1, 1.2, 1.3, -1.1, -1.2, -1.3, 1.1, 1.2, 1.3, -1.1, -1.2, -1.3, 1.1, 1.2}}; + struct V0ptHadPiKaProt { + // ITS response + o2::aod::ITSResponse itsResponse; + // Connect to ccdb + Service ccdb; + Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; + Configurable ccdbUrl{"ccdbUrl", "http://ccdb-test.cern.ch:8080", "url of the ccdb repository"}; + + enum Particles { + PIONS = 0, + KAONS, + PROTONS + }; + enum ParticleNsigma { + kPionUpCut = 0, + kKaonUpCut, + kProtonUpCut, + kPionLowCut, + kKaonLowCut, + kProtonLowCut + }; + enum DetectorType { + kTPC = 0, + kTOF, + kITS + }; + enum CentralityEstimator { + kFT0C = 0, + kFT0A, + kFT0M, + kFV0A + }; + Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; Configurable cfgCutTpcChi2NCl{"cfgCutTpcChi2NCl", 2.5f, "Maximum TPCchi2NCl"}; Configurable cfgCutItsChi2NCl{"cfgCutItsChi2NCl", 36.0f, "Maximum ITSchi2NCl"}; @@ -87,16 +122,16 @@ struct V0ptHadPiKaProt { Configurable cfgCutEtaLeft{"cfgCutEtaLeft", 0.8f, "Left end of eta gap"}; Configurable cfgCutEtaRight{"cfgCutEtaRight", 0.8f, "Right end of eta gap"}; Configurable cfgNSubsample{"cfgNSubsample", 10, "Number of subsamples"}; - Configurable cfgCentralityChoice{"cfgCentralityChoice", 1, "Which centrality estimator? 1-->FT0C, 2-->FT0A, 3-->FT0M, 4-->FV0A"}; + Configurable cfgCentralityChoice{"cfgCentralityChoice", 0, "Which centrality estimator? 0-->FT0C, 1-->FT0A, 2-->FT0M, 3-->FV0A"}; Configurable cfgEvSelkNoSameBunchPileup{"cfgEvSelkNoSameBunchPileup", true, "Pileup removal"}; Configurable cfgUseGoodITSLayerAllCut{"cfgUseGoodITSLayerAllCut", true, "Remove time interval with dead ITS zone"}; Configurable cfgEvSelkNoITSROFrameBorder{"cfgEvSelkNoITSROFrameBorder", true, "ITSROFrame border event selection cut"}; Configurable cfgEvSelkNoTimeFrameBorder{"cfgEvSelkNoTimeFrameBorder", true, "TimeFrame border event selection cut"}; - - // Connect to ccdb - Service ccdb; - Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; - Configurable ccdbUrl{"ccdbUrl", "http://ccdb-test.cern.ch:8080", "url of the ccdb repository"}; + Configurable cfgEvSelUseGoodZvtxFT0vsPV{"cfgEvSelUseGoodZvtxFT0vsPV", true, "GoodZvertex and FT0 vs PV cut"}; + Configurable cfgUseItsPID{"cfgUseItsPID", false, "Use ITS PID for particle identification"}; + Configurable cfgPtCutTOF{"cfgPtCutTOF", 0.3f, "Minimum pt to use TOF N-sigma"}; + Configurable> nSigmas{"nSigmas", {LongArrayFloat[0], 3, 6, {"TPC", "TOF", "ITS"}, {"pos_pi", "pos_ka", "pos_pr", "neg_pi", "neg_ka", "neg_pr"}}, "Labeled array for n-sigma values for TPC, TOF, ITS for pions, kaons, protons (positive and negative)"}; + Configurable cfgUseRun3V2PID{"cfgUseRun3V2PID", true, "True if PID cuts to be used are similar to Run3 v2 PID analysis"}; HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; std::vector>> subSample; @@ -110,9 +145,35 @@ struct V0ptHadPiKaProt { using AodCollisions = soa::Filtered>; using AodTracks = soa::Filtered>; + std::array tofNsigmaCut; + std::array itsNsigmaCut; + std::array tpcNsigmaCut; + // Equivalent of the AliRoot task UserCreateOutputObjects void init(o2::framework::InitContext&) { + // Get nSigma values of TPC, TOF, ITS for various particles from the matrix "nSigmas" + tpcNsigmaCut[kPionUpCut] = nSigmas->getData()[kTPC][kPionUpCut]; + tpcNsigmaCut[kKaonUpCut] = nSigmas->getData()[kTPC][kKaonUpCut]; + tpcNsigmaCut[kProtonUpCut] = nSigmas->getData()[kTPC][kProtonUpCut]; + tpcNsigmaCut[kPionLowCut] = nSigmas->getData()[kTPC][kPionLowCut]; + tpcNsigmaCut[kKaonLowCut] = nSigmas->getData()[kTPC][kKaonLowCut]; + tpcNsigmaCut[kProtonLowCut] = nSigmas->getData()[kTPC][kProtonLowCut]; + + tofNsigmaCut[kPionUpCut] = nSigmas->getData()[kTOF][kPionUpCut]; + tofNsigmaCut[kKaonUpCut] = nSigmas->getData()[kTOF][kKaonUpCut]; + tofNsigmaCut[kProtonUpCut] = nSigmas->getData()[kTOF][kProtonUpCut]; + tofNsigmaCut[kPionLowCut] = nSigmas->getData()[kTOF][kPionLowCut]; + tofNsigmaCut[kKaonLowCut] = nSigmas->getData()[kTOF][kKaonLowCut]; + tofNsigmaCut[kProtonLowCut] = nSigmas->getData()[kTOF][kProtonLowCut]; + + itsNsigmaCut[kPionUpCut] = nSigmas->getData()[kITS][kPionUpCut]; + itsNsigmaCut[kKaonUpCut] = nSigmas->getData()[kITS][kKaonUpCut]; + itsNsigmaCut[kProtonUpCut] = nSigmas->getData()[kITS][kProtonUpCut]; + itsNsigmaCut[kPionLowCut] = nSigmas->getData()[kITS][kPionLowCut]; + itsNsigmaCut[kKaonLowCut] = nSigmas->getData()[kITS][kKaonLowCut]; + itsNsigmaCut[kProtonLowCut] = nSigmas->getData()[kITS][kProtonLowCut]; + // Define axes std::vector ptBin = {0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.5, 4.0, 5.0, 6.0, 8.0, 10.0}; AxisSpec ptAxis = {ptBin, "#it{p}_{T} (GeV/#it{c})"}; @@ -332,6 +393,56 @@ struct V0ptHadPiKaProt { return false; } + template + int getNsigmaPID(TTrack track) + { + // Computing Nsigma arrays for pion, kaon, and protons + std::array nSigmaTPC = {track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()}; + std::array nSigmaTOF = {track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr()}; + std::array nSigmaITS = {itsResponse.nSigmaITS(track), itsResponse.nSigmaITS(track), itsResponse.nSigmaITS(track)}; + int pid = 0; // 0 = not identified, 1 = pion, 2 = kaon, 3 = proton + + std::array nSigmaToUse = cfgUseItsPID ? nSigmaITS : nSigmaTPC; // Choose which nSigma to use: TPC or ITS + std::array detectorNsigmaCut = cfgUseItsPID ? itsNsigmaCut : tpcNsigmaCut; // Choose which nSigma to use: TPC or ITS + + bool isPion, isKaon, isProton; + bool isDetectedPion = nSigmaToUse[PIONS] < detectorNsigmaCut[kPionUpCut] && nSigmaToUse[PIONS] > detectorNsigmaCut[kPionLowCut]; + bool isDetectedKaon = nSigmaToUse[KAONS] < detectorNsigmaCut[kKaonUpCut] && nSigmaToUse[KAONS] > detectorNsigmaCut[kKaonLowCut]; + bool isDetectedProton = nSigmaToUse[PROTONS] < detectorNsigmaCut[kProtonUpCut] && nSigmaToUse[PROTONS] > detectorNsigmaCut[kProtonLowCut]; + + bool isTofPion = nSigmaTOF[PIONS] < tofNsigmaCut[kPionUpCut] && nSigmaTOF[PIONS] > tofNsigmaCut[kPionLowCut]; + bool isTofKaon = nSigmaTOF[KAONS] < tofNsigmaCut[kKaonUpCut] && nSigmaTOF[KAONS] > tofNsigmaCut[kKaonLowCut]; + bool isTofProton = nSigmaTOF[PROTONS] < tofNsigmaCut[kProtonUpCut] && nSigmaTOF[PROTONS] > tofNsigmaCut[kProtonLowCut]; + + if (track.pt() > cfgPtCutTOF && !track.hasTOF()) { + return 0; + } else if (track.pt() > cfgPtCutTOF && track.hasTOF()) { + isPion = isTofPion && isDetectedPion; + isKaon = isTofKaon && isDetectedKaon; + isProton = isTofProton && isDetectedProton; + } else { + isPion = isDetectedPion; + isKaon = isDetectedKaon; + isProton = isDetectedProton; + } + + if ((isPion && isKaon) || (isPion && isProton) || (isKaon && isProton)) { + return 0; // more than one particle satisfy the criteria + } + + if (isPion) { + pid = PIONS + 1; + } else if (isKaon) { + pid = KAONS + 1; + } else if (isProton) { + pid = PROTONS + 1; + } else { + return 0; // no particle satisfies the criteria + } + + return pid; // 0 = not identified, 1 = pion, 2 = kaon, 3 = proton + } + // process Data void process(AodCollisions::iterator const& coll, aod::BCsWithTimestamps const&, AodTracks const& inputTracks) { @@ -350,16 +461,19 @@ struct V0ptHadPiKaProt { if (cfgEvSelkNoTimeFrameBorder && !(coll.selection_bit(o2::aod::evsel::kNoTimeFrameBorder))) { return; } + if (cfgEvSelUseGoodZvtxFT0vsPV && !(coll.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV))) { + return; + } // Centrality double cent = 0.0; - if (cfgCentralityChoice == 1) + if (cfgCentralityChoice == kFT0C) cent = coll.centFT0C(); - else if (cfgCentralityChoice == 2) + else if (cfgCentralityChoice == kFT0A) cent = coll.centFT0A(); - else if (cfgCentralityChoice == 3) + else if (cfgCentralityChoice == kFT0M) cent = coll.centFT0M(); - else if (cfgCentralityChoice == 4) + else if (cfgCentralityChoice == kFV0A) cent = coll.centFV0A(); histos.fill(HIST("hZvtx_after_sel"), coll.posZ()); @@ -438,9 +552,23 @@ struct V0ptHadPiKaProt { histos.fill(HIST("h2DnsigmaProtonTpcVsTofBeforeCut"), nSigmaTpcProt, nSigmaTofProt); // identified particles selection - bool isPion = selectionPion(track); - bool isKaon = selectionKaon(track); - bool isProton = selectionProton(track); + bool isPion = false; + bool isKaon = false; + bool isProton = false; + + if (cfgUseRun3V2PID) { + int pidVal = getNsigmaPID(track); + if (pidVal == PIONS + 1) + isPion = true; + if (pidVal == KAONS + 1) + isKaon = true; + if (pidVal == PROTONS + 1) + isProton = true; + } else { + isPion = selectionPion(track); + isKaon = selectionKaon(track); + isProton = selectionProton(track); + } // PID QAs after selection if (isPion) { From 91ca0efc9337c266330c7fcf1e866dc4dc00e5c6 Mon Sep 17 00:00:00 2001 From: Subhadeep Mandal <147193283+5ub-Man@users.noreply.github.com> Date: Wed, 29 Oct 2025 21:16:48 +0530 Subject: [PATCH 941/986] [PWGUD] Code optimizations in sginclusivePhiKstarSD.cxx (#13557) --- PWGUD/Tasks/sginclusivePhiKstarSD.cxx | 400 ++++++++++++++++---------- 1 file changed, 242 insertions(+), 158 deletions(-) diff --git a/PWGUD/Tasks/sginclusivePhiKstarSD.cxx b/PWGUD/Tasks/sginclusivePhiKstarSD.cxx index 626b5d832bd..278a97b2d71 100644 --- a/PWGUD/Tasks/sginclusivePhiKstarSD.cxx +++ b/PWGUD/Tasks/sginclusivePhiKstarSD.cxx @@ -11,7 +11,7 @@ // /// \file sginclusivePhiKstarSD.cxx /// \brief Single Gap Event Analyzer for phi and Kstar -/// \author Sandeep Dudi, sandeep.dudi3@gmail.com +/// \author Sandeep Dudi , Subhadeep Mandal /// \since May 2024 #include "PWGUD/Core/SGSelector.h" @@ -38,6 +38,8 @@ #include #include +#include +#include #include using namespace std; @@ -59,7 +61,6 @@ struct SginclusivePhiKstarSD { HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry rQA{"QA", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - Configurable cutRCTflag{"cutRCTflag", 0, {"0 = off, 1 = CBT, 2 = CBT+ZDC, 3 = CBThadron, 4 = CBThadron+ZDC"}}; Configurable fv0Cut{"fv0Cut", 50., "FV0A threshold"}; Configurable ft0aCut{"ft0aCut", 100., "FT0A threshold"}; Configurable ft0cCut{"ft0cCut", 50., "FT0C threshold"}; @@ -67,17 +68,22 @@ struct SginclusivePhiKstarSD { Configurable fddcCut{"fddcCut", 10000., "FDDC threshold"}; Configurable zdcCut{"zdcCut", 0., "ZDC threshold"}; Configurable vzCut{"vzCut", 10., "Vz position"}; - Configurable occCut{"occCut", 1000., "Occupancy cut"}; - Configurable hadronicRate{"hadronicRate", 1000., "hadronicRate cut"}; - Configurable useTrs{"useTrs", -1, "kNoCollInTimeRangeStandard cut"}; - Configurable useTrofs{"useTrofs", -1, "kNoCollInRofStandard cut"}; - Configurable useHmpr{"useHmpr", -1, "kNoHighMultCollInPrevRof cut"}; - Configurable useTfb{"useTfb", -1, "kNoTimeFrameBorder cut"}; - Configurable useItsrofb{"useItsrofb", -1, "kNoITSROFrameBorder cut"}; - Configurable useSbp{"useSbp", -1, "kNoSameBunchPileup cut"}; - Configurable useZvtxftovpv{"useZvtxftovpv", -1, "kIsGoodZvtxFT0vsPV cut"}; - Configurable useVtxItsTpc{"useVtxItsTpc", -1, "kIsVertexITSTPC cut"}; - Configurable upcflag{"upcflag", -1, "upc run selection, 0 = std, 1= upc"}; + Configurable useOccCut{"useOccCut", false, "Turn on/off Occupancy cut"}; + Configurable confgOccCut{"confgOccCut", 1000., "Occupancy cut"}; + Configurable useHadronicRateCut{"useHadronicRateCut", false, "Turn on/off hadronicRate cut"}; + Configurable confgHadronicRateMax{"confgHadronicRateMax", 1000., "Maximum hadronicRate cut"}; + Configurable confgHadronicRateMin{"confgHadronicRateMin", 0., "Minimum hadronicRate cut"}; + Configurable useTrs{"useTrs", false, "kNoCollInTimeRangeStandard cut"}; + Configurable useTrofs{"useTrofs", false, "kNoCollInRofStandard cut"}; + Configurable useHmpr{"useHmpr", false, "kNoHighMultCollInPrevRof cut"}; + Configurable useTfb{"useTfb", false, "kNoTimeFrameBorder cut"}; + Configurable useItsrofb{"useItsrofb", false, "kNoITSROFrameBorder cut"}; + Configurable useSbp{"useSbp", false, "kNoSameBunchPileup cut"}; + Configurable useZvtxftovpv{"useZvtxftovpv", false, "kIsGoodZvtxFT0vsPV cut"}; + Configurable useVtxItsTpc{"useVtxItsTpc", false, "kIsVertexITSTPC cut"}; + Configurable usenumContrib{"usenumContrib", false, "numContrib cut for event selection"}; + Configurable upcflag{"upcflag", -1, "upc run selection, -1 = off, 0 = std, 1 = upc"}; + Configurable cutRCTflag{"cutRCTflag", 0, {"0 = off, 1 = CBT, 2 = CBT+ZDC, 3 = CBThadron, 4 = CBThadron+ZDC"}}; // Track Selections Configurable pvCut{"pvCut", 1.0, "Use Only PV tracks"}; @@ -92,8 +98,10 @@ struct SginclusivePhiKstarSD { Configurable pt2{"pt2", 0.4, "pid selection pt2"}; Configurable pt3{"pt3", 0.5, "pid selection pt3"}; - Configurable rapiditycut{"rapiditycut", 1, "Rapidity Cut"}; - Configurable rapiditycutvalue{"rapiditycutvalue", 1, "Rapidity Cut value"}; + Configurable useMultCut{"useMultCut", false, "Multipicity cut on good tracks"}; + + Configurable rapiditycut{"rapiditycut", true, "Rapidity Cut"}; + Configurable rapiditycutvalue{"rapiditycutvalue", 0.5, "Rapidity Cut value"}; Configurable nsigmaTpcCut1{"nsigmaTpcCut1", 3.0, "nsigma tpc cut1"}; Configurable nsigmaTpcCut2{"nsigmaTpcCut2", 3.0, "nsigma tpc cut2"}; @@ -127,7 +135,7 @@ struct SginclusivePhiKstarSD { Configurable confMaxRot{"confMaxRot", 7.0 * o2::constants::math::PI / 6.0, "Maximum of rotation"}; // Configurable reconstruction{"reconstruction", true, ""}; - Configurable generatedId{"generatedId", 31, ""}; + Configurable generatedId{"generatedId", 40, "40 = PhiA, 44 PhiC, 41 = K*0A, 45 = K*0C"}; ConfigurableAxis axisphimass{"axisphimass", {220, 0.98, 1.2}, ""}; ConfigurableAxis axiskstarmass{"axiskstarmass", {400, 0.0, 2.0}, ""}; @@ -142,43 +150,56 @@ struct SginclusivePhiKstarSD { { registry.add("hEventCutFlow", "No. of events after event cuts", kTH1F, {{20, 0, 20}}); std::shared_ptr hCutFlow = registry.get(HIST("hEventCutFlow")); - hCutFlow->GetXaxis()->SetBinLabel(1, "All Events"); - hCutFlow->GetXaxis()->SetBinLabel(2, "Gapside (0 to 2)"); - hCutFlow->GetXaxis()->SetBinLabel(3, "|Vz| < cut"); - hCutFlow->GetXaxis()->SetBinLabel(4, "Occupancy"); - hCutFlow->GetXaxis()->SetBinLabel(5, "Hadronic Rate"); - hCutFlow->GetXaxis()->SetBinLabel(6, "kNoCollInTimeRangeStandard"); - hCutFlow->GetXaxis()->SetBinLabel(7, "kNoCollInRofStandard"); - hCutFlow->GetXaxis()->SetBinLabel(8, "kNoHighMultCollInPrevRof"); - hCutFlow->GetXaxis()->SetBinLabel(9, "kNoTimeFrameBorder"); - hCutFlow->GetXaxis()->SetBinLabel(10, "kNoITSROFrameBorder"); - hCutFlow->GetXaxis()->SetBinLabel(11, "kNoSameBunchPileup"); - hCutFlow->GetXaxis()->SetBinLabel(12, "kIsGoodZvtxFT0vsPV"); - hCutFlow->GetXaxis()->SetBinLabel(13, "kIsVertexITSTPC"); - hCutFlow->GetXaxis()->SetBinLabel(14, "RCTFlag"); - hCutFlow->GetXaxis()->SetBinLabel(15, "upcFlag"); - hCutFlow->GetXaxis()->SetBinLabel(16, "numContrib (min track < mult < max track)"); + + auto check = [](bool enabled) { return enabled ? "" : " #otimes"; }; // check if a cut is enabled and put #otimes if not enabled beside that label + + std::vector eveCutLabels = { + "All Events", + "Gapside (0 to 2)", + Form("|Vz| < %.1f", vzCut.value), + Form("Occupancy < %.0f%s", confgOccCut.value, check(useOccCut.value)), + Form("%.1e < Hadronic Rate < %.1e%s", confgHadronicRateMin.value, confgHadronicRateMax.value, check(useHadronicRateCut.value)), + std::string("kNoCollInTimeRangeStandard") + check(useTrs.value), + std::string("kNoCollInRofStandard") + check(useTrofs.value), + std::string("kNoHighMultCollInPrevRof") + check(useHmpr.value), + std::string("kNoTimeFrameBorder") + check(useTfb.value), + std::string("kNoITSROFrameBorder") + check(useItsrofb.value), + std::string("kNoSameBunchPileup") + check(useSbp.value), + std::string("kIsGoodZvtxFT0vsPV") + check(useZvtxftovpv.value), + std::string("kIsVertexITSTPC") + check(useVtxItsTpc.value), + Form("RCTFlag = %d%s", cutRCTflag.value, check(cutRCTflag.value > 0)), + Form("upcFlag = %d%s", upcflag.value, check(upcflag.value != -1)), + Form("%d < numContrib < %d%s", mintrack.value, maxtrack.value, check(usenumContrib.value))}; + + for (size_t i = 0; i < eveCutLabels.size(); ++i) { + hCutFlow->GetXaxis()->SetBinLabel(i + 1, eveCutLabels[i].c_str()); + } registry.add("GapSide", "Gap Side; Entries", kTH1F, {{4, -1.5, 2.5}}); registry.add("TrueGapSide", "Gap Side; Entries", kTH1F, {{4, -1.5, 2.5}}); registry.add("nPVContributors_data", "Multiplicity_dist_before track cut gap A", kTH1F, {{110, 0, 110}}); registry.add("nPVContributors_data_1", "Multiplicity_dist_before track cut gap C", kTH1F, {{110, 0, 110}}); + registry.add("hRotation", "hRotation", kTH1F, {{360, 0.0, o2::constants::math::TwoPI}}); + if (phi) { registry.add("os_KK_pT_0", "pt kaon pair", kTH3F, {axisphimass, axisrapdity, axispt}); registry.add("os_KK_pT_1", "pt kaon pair", kTH3F, {axisphimass, axisrapdity, axispt}); registry.add("os_KK_pT_2", "pt kaon pair", kTH3F, {axisphimass, axisrapdity, axispt}); - registry.add("os_KK_ls_pT_0", "kaon pair like sign", kTH3F, {axisphimass, axisrapdity, axispt}); - registry.add("os_KK_ls_pT_1", "kaon pair like sign", kTH3F, {axisphimass, axisrapdity, axispt}); + + registry.add("os_KK_lsMM_pT_0", "kaon pair Negative like sign", kTH3F, {axisphimass, axisrapdity, axispt}); + registry.add("os_KK_lsPP_pT_0", "kaon pair Positive like sign", kTH3F, {axisphimass, axisrapdity, axispt}); + registry.add("os_KK_lsMM_pT_1", "kaon pair Negative like sign", kTH3F, {axisphimass, axisrapdity, axispt}); + registry.add("os_KK_lsPP_pT_1", "kaon pair Positive like sign", kTH3F, {axisphimass, axisrapdity, axispt}); registry.add("os_KK_ls_pT_2", "kaon pair like sign", kTH3F, {axisphimass, axisrapdity, axispt}); registry.add("os_KK_mix_pT_0", "kaon pair mix event", kTH3F, {axisphimass, axisrapdity, axispt}); registry.add("os_KK_mix_pT_1", "kaon pair mix event", kTH3F, {axisphimass, axisrapdity, axispt}); registry.add("os_KK_mix_pT_2", "kaon pair mix event", kTH3F, {axisphimass, axisrapdity, axispt}); - registry.add("os_KK_rot_pT_0", "kaon pair mix event", kTH3F, {axisphimass, axisrapdity, axispt}); - registry.add("os_KK_rot_pT_1", "kaon pair mix event", kTH3F, {axisphimass, axisrapdity, axispt}); - registry.add("os_KK_rot_pT_2", "kaon pair mix event", kTH3F, {axisphimass, axisrapdity, axispt}); + registry.add("os_KK_rot_pT_0", "kaon pair rotional event", kTH3F, {axisphimass, axisrapdity, axispt}); + registry.add("os_KK_rot_pT_1", "kaon pair rotional event", kTH3F, {axisphimass, axisrapdity, axispt}); + registry.add("os_KK_rot_pT_2", "kaon pair rotional event", kTH3F, {axisphimass, axisrapdity, axispt}); } if (rho) { registry.add("os_pp_pT_0", "pt pion pair", kTH3F, {axisrhomass, axisrapdity, axispt}); @@ -201,17 +222,17 @@ struct SginclusivePhiKstarSD { registry.add("os_pk_rot_pT_1", "pion-kaon rotional pair", kTH3F, {axiskstarmass, axisrapdity, axispt}); registry.add("os_pk_rot_pT_2", "pion-kaon rotional pair", kTH3F, {axiskstarmass, axisrapdity, axispt}); - registry.add("os_pk_ls_pT_0", "pion-kaon pair like sign", kTH3F, {axiskstarmass, axisrapdity, axispt}); - registry.add("os_pk_ls_pT_1", "pion-kaon like sign", kTH3F, {axiskstarmass, axisrapdity, axispt}); + registry.add("os_pk_lsMM_pT_0", "pion-kaon pair Negative like sign", kTH3F, {axisphimass, axisrapdity, axispt}); + registry.add("os_pk_lsPP_pT_0", "pion-kaon pair Positive like sign", kTH3F, {axisphimass, axisrapdity, axispt}); + registry.add("os_pk_lsMM_pT_1", "pion-kaon pair Negative like sign", kTH3F, {axisphimass, axisrapdity, axispt}); + registry.add("os_pk_lsPP_pT_1", "pion-kaon pair Positive like sign", kTH3F, {axisphimass, axisrapdity, axispt}); registry.add("os_pk_ls_pT_2", "pion-kaon like sign", kTH3F, {axiskstarmass, axisrapdity, axispt}); - - registry.add("hRotation", "hRotation", kTH1F, {{360, 0.0, o2::constants::math::TwoPI}}); } // qa plots if (qa) { // Occupancy - rQA.add("hOcc_before", "Occupancy distribution before event cuts", kTH1F, {{1000, 0, 15000}}); - rQA.add("hOcc_after", "Occupancy distribution after all event cuts", kTH1F, {{1000, 0, 15000}}); + rQA.add("hOcc_before", "Occupancy distribution before event cuts", kTH1F, {{1000, 0, 50000}}); + rQA.add("hOcc_after", "Occupancy distribution after all event cuts", kTH1F, {{1000, 0, 10000}}); // DCA rQA.add("hDcaxy_all_before", "DCAxy Distribution of all tracks before track selection; DCAxy (cm); Counts", kTH1F, {{400, -0.2, 0.2}}); @@ -338,25 +359,33 @@ struct SginclusivePhiKstarSD { registry.add("MC/accM_k", "Generated events in acceptance; Mass (GeV/#it{c}^2)", {HistType::kTH1F, {{400, 0., 2.0}}}); } if (context.mOptions.get("processReco")) { + registry.add("Reco/hEventCutFlowMC", "No. of events after event cuts in MC", kTH1F, {{20, 0, 20}}); std::shared_ptr hCutFlowMC = registry.get(HIST("Reco/hEventCutFlowMC")); - hCutFlowMC->GetXaxis()->SetBinLabel(1, "All Events"); - hCutFlowMC->GetXaxis()->SetBinLabel(2, "has_udMcCollision"); - hCutFlowMC->GetXaxis()->SetBinLabel(3, "generatorsID"); - hCutFlowMC->GetXaxis()->SetBinLabel(4, "GapsideMC"); - hCutFlowMC->GetXaxis()->SetBinLabel(5, "|Vz| < cut"); - hCutFlowMC->GetXaxis()->SetBinLabel(6, "Occupancy"); - hCutFlowMC->GetXaxis()->SetBinLabel(7, "Hadronic Rate"); - hCutFlowMC->GetXaxis()->SetBinLabel(8, "kNoCollInTimeRangeStandard"); - hCutFlowMC->GetXaxis()->SetBinLabel(9, "kNoCollInRofStandard"); - hCutFlowMC->GetXaxis()->SetBinLabel(10, "kNoHighMultCollInPrevRof"); - hCutFlowMC->GetXaxis()->SetBinLabel(11, "kNoTimeFrameBorder"); - hCutFlowMC->GetXaxis()->SetBinLabel(12, "kNoITSROFrameBorder"); - hCutFlowMC->GetXaxis()->SetBinLabel(13, "kNoSameBunchPileup"); - hCutFlowMC->GetXaxis()->SetBinLabel(14, "kIsGoodZvtxFT0vsPV"); - hCutFlowMC->GetXaxis()->SetBinLabel(15, "kIsVertexITSTPC"); - hCutFlowMC->GetXaxis()->SetBinLabel(16, "RCTFlag"); - hCutFlowMC->GetXaxis()->SetBinLabel(17, "upcFlag"); + + std::vector eveCutLabelsMC = { + "All Events", + "has_udMcCollision", + Form("generatorsID = %d", generatedId.value), + Form("GapsideMC = %d", gapsideMC.value), + Form("|Vz| < %.1f", vzCut.value), + Form("Occupancy < %.0f%s", confgOccCut.value, check(useOccCut.value)), + Form("%.1e < Hadronic Rate < %.1e%s", confgHadronicRateMin.value, confgHadronicRateMax.value, check(useHadronicRateCut.value)), + std::string("kNoCollInTimeRangeStandard") + check(useTrs.value), + std::string("kNoCollInRofStandard") + check(useTrofs.value), + std::string("kNoHighMultCollInPrevRof") + check(useHmpr.value), + std::string("kNoTimeFrameBorder") + check(useTfb.value), + std::string("kNoITSROFrameBorder") + check(useItsrofb.value), + std::string("kNoSameBunchPileup") + check(useSbp.value), + std::string("kIsGoodZvtxFT0vsPV") + check(useZvtxftovpv.value), + std::string("kIsVertexITSTPC") + check(useVtxItsTpc.value), + Form("RCTFlag = %d%s", cutRCTflag.value, check(cutRCTflag.value > 0)), + Form("upcFlag = %d%s", upcflag.value, check(upcflag.value != -1)), + Form("%d < numContrib < %d%s", mintrack.value, maxtrack.value, check(usenumContrib.value))}; + + for (size_t i = 0; i < eveCutLabelsMC.size(); ++i) { + hCutFlowMC->GetXaxis()->SetBinLabel(i + 1, eveCutLabelsMC[i].c_str()); + } registry.add("Reco/Stat", "Count reconstruted events; ; Entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}); registry.add("Reco/nPVContributors", "Number of PV contributors per collision; Number of PV contributors; Entries", {HistType::kTH1F, {{51, -0.5, 50.5}}}); @@ -403,8 +432,8 @@ struct SginclusivePhiKstarSD { // QA plots if (qaMC) { // Occupancy - rQA.add("hOcc_before_mc", "Occupancy distribution before event cuts", kTH1F, {{1000, 0, 15000}}); - rQA.add("hOcc_after_mc", "Occupancy distribution after all event cuts", kTH1F, {{1000, 0, 15000}}); + rQA.add("hOcc_before_mc", "Occupancy distribution before event cuts", kTH1F, {{1000, 0, 50000}}); + rQA.add("hOcc_after_mc", "Occupancy distribution after all event cuts", kTH1F, {{1000, 0, 10000}}); // DCA rQA.add("hDcaxy_all_before_mc", "DCAxy Distribution of all tracks before track selection; DCAxy (cm); Counts", kTH1F, {{400, -0.2, 0.2}}); @@ -529,7 +558,7 @@ struct SginclusivePhiKstarSD { } template - bool isGoodRCTflag(C const& coll) + bool isGoodRCTflag(const C& coll) { switch (cutRCTflag) { case 1: @@ -545,6 +574,102 @@ struct SginclusivePhiKstarSD { } } + template + std::pair selectionEvent(const C& collision, bool fillHist = false) + { + if (fillHist) + registry.fill(HIST("hEventCutFlow"), 0); + + // Gapside logic + int gapSide = collision.gapSide(); + float fitCut[5] = {fv0Cut, ft0aCut, ft0cCut, fddaCut, fddcCut}; + int truegapSide = sgSelector.trueGap(collision, fitCut[0], fitCut[1], fitCut[2], zdcCut); + + if (fillHist) { + registry.fill(HIST("GapSide"), gapSide); + registry.fill(HIST("TrueGapSide"), truegapSide); + } + + gapSide = truegapSide; + + if (gapSide < SingleGapA || gapSide > DoubleGap) + return {false, gapSide}; + if (fillHist) + registry.fill(HIST("hEventCutFlow"), 1); + + if (std::abs(collision.posZ()) > vzCut) + return {false, gapSide}; + if (fillHist) + registry.fill(HIST("hEventCutFlow"), 2); + + if (useOccCut && (std::abs(collision.occupancyInTime()) > confgOccCut)) + return {false, gapSide}; + if (fillHist) + registry.fill(HIST("hEventCutFlow"), 3); + + if (useHadronicRateCut && (std::abs(collision.hadronicRate()) > confgHadronicRateMax || std::abs(collision.hadronicRate()) < confgHadronicRateMin)) + return {false, gapSide}; + if (fillHist) + registry.fill(HIST("hEventCutFlow"), 4); + + if (useTrs && collision.trs() != 1) + return {false, gapSide}; + if (fillHist) + registry.fill(HIST("hEventCutFlow"), 5); + + if (useTrofs && collision.trofs() != 1) + return {false, gapSide}; + if (fillHist) + registry.fill(HIST("hEventCutFlow"), 6); + + if (useHmpr && collision.hmpr() != 1) + return {false, gapSide}; + if (fillHist) + registry.fill(HIST("hEventCutFlow"), 7); + + if (useTfb && collision.tfb() != 1) + return {false, gapSide}; + if (fillHist) + registry.fill(HIST("hEventCutFlow"), 8); + + if (useItsrofb && collision.itsROFb() != 1) + return {false, gapSide}; + if (fillHist) + registry.fill(HIST("hEventCutFlow"), 9); + + if (useSbp && collision.sbp() != 1) + return {false, gapSide}; + if (fillHist) + registry.fill(HIST("hEventCutFlow"), 10); + + if (useZvtxftovpv && collision.zVtxFT0vPV() != 1) + return {false, gapSide}; + if (fillHist) + registry.fill(HIST("hEventCutFlow"), 11); + + if (useVtxItsTpc && collision.vtxITSTPC() != 1) + return {false, gapSide}; + if (fillHist) + registry.fill(HIST("hEventCutFlow"), 12); + + if (!isGoodRCTflag(collision)) + return {false, gapSide}; + if (fillHist) + registry.fill(HIST("hEventCutFlow"), 13); + + if (upcflag != -1 && collision.flags() != upcflag) + return {false, gapSide}; + if (fillHist) + registry.fill(HIST("hEventCutFlow"), 14); + + if (usenumContrib && (collision.numContrib() < mintrack || collision.numContrib() > maxtrack)) + return {false, gapSide}; + if (fillHist) + registry.fill(HIST("hEventCutFlow"), 15); + + return {true, gapSide}; + } + template bool selectionPIDKaon1(const T& candidate) { @@ -612,26 +737,12 @@ struct SginclusivePhiKstarSD { void process(UDCollisionFull const& collision, UDtracksfull const& tracks) { - registry.fill(HIST("hEventCutFlow"), 0); - if (qa) rQA.fill(HIST("hOcc_before"), collision.occupancyInTime()); ROOT::Math::PxPyPzMVector v0; ROOT::Math::PxPyPzMVector v1; ROOT::Math::PxPyPzMVector v01; - int gapSide = collision.gapSide(); - float fitCut[5] = {fv0Cut, ft0aCut, ft0cCut, fddaCut, fddcCut}; - std::vector parameters = {pvCut, dcazCut, dcaxyCut, tpcChi2Cut, tpcNClsFindableCut, itsChi2Cut, etaCut, ptCut}; - int truegapSide = sgSelector.trueGap(collision, fitCut[0], fitCut[1], fitCut[2], zdcCut); - - registry.fill(HIST("GapSide"), gapSide); - registry.fill(HIST("TrueGapSide"), truegapSide); - gapSide = truegapSide; - - if (gapSide < SingleGapA || gapSide > DoubleGap) - return; - registry.fill(HIST("hEventCutFlow"), 1); ROOT::Math::PxPyPzMVector phiv; ROOT::Math::PxPyPzMVector phiv1; @@ -645,59 +756,14 @@ struct SginclusivePhiKstarSD { std::vector onlyPionTracksn; std::vector rawPionTracksn; - if (std::abs(collision.posZ()) > vzCut) - return; - registry.fill(HIST("hEventCutFlow"), 2); - - if (std::abs(collision.occupancyInTime()) > occCut) - return; - registry.fill(HIST("hEventCutFlow"), 3); - - if (std::abs(collision.hadronicRate()) > hadronicRate) - return; - registry.fill(HIST("hEventCutFlow"), 4); - - if (useTrs != -1 && collision.trs() != useTrs) - return; - registry.fill(HIST("hEventCutFlow"), 5); - - if (useTrofs != -1 && collision.trofs() != useTrofs) - return; - registry.fill(HIST("hEventCutFlow"), 6); - - if (useHmpr != -1 && collision.hmpr() != useHmpr) - return; - registry.fill(HIST("hEventCutFlow"), 7); - - if (useTfb != -1 && collision.tfb() != useTfb) - return; - registry.fill(HIST("hEventCutFlow"), 8); - - if (useItsrofb != -1 && collision.itsROFb() != useItsrofb) - return; - registry.fill(HIST("hEventCutFlow"), 9); - - if (useSbp != -1 && collision.sbp() != useSbp) - return; - registry.fill(HIST("hEventCutFlow"), 10); - - if (useZvtxftovpv != -1 && collision.zVtxFT0vPV() != useZvtxftovpv) - return; - registry.fill(HIST("hEventCutFlow"), 11); - - if (useVtxItsTpc != -1 && collision.vtxITSTPC() != useVtxItsTpc) - return; - registry.fill(HIST("hEventCutFlow"), 12); - - if (!isGoodRCTflag(collision)) - return; - registry.fill(HIST("hEventCutFlow"), 13); + std::vector parameters = {pvCut, dcazCut, dcaxyCut, tpcChi2Cut, tpcNClsFindableCut, itsChi2Cut, etaCut, ptCut}; - if (upcflag != -1 && collision.flags() != upcflag) + auto [eventSelected, gapSide] = selectionEvent(collision, true); + if (!eventSelected) return; - registry.fill(HIST("hEventCutFlow"), 14); int mult = collision.numContrib(); + if (gapSide == SingleGapA) { registry.fill(HIST("gap_mult0"), mult); } @@ -707,9 +773,6 @@ struct SginclusivePhiKstarSD { if (gapSide == DoubleGap) { registry.fill(HIST("gap_mult2"), mult); } - if (mult < mintrack || mult > maxtrack) - return; - registry.fill(HIST("hEventCutFlow"), 15); if (qa) rQA.fill(HIST("hOcc_after"), collision.occupancyInTime()); @@ -796,9 +859,13 @@ struct SginclusivePhiKstarSD { } } if (gapSide == SingleGapA) { + if (useMultCut && (mult0 < mintrack || mult0 > maxtrack)) + return; registry.fill(HIST("mult_0"), mult0); } if (gapSide == SingleGapC) { + if (useMultCut && (mult1 < mintrack || mult1 > maxtrack)) + return; registry.fill(HIST("mult_1"), mult1); } if (qa) { @@ -844,10 +911,16 @@ struct SginclusivePhiKstarSD { // samesignpair if (t0.sign() == t1.sign()) { if (gapSide == SingleGapA) { - registry.fill(HIST("os_KK_ls_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); + if (t0.sign() < 0) + registry.fill(HIST("os_KK_lsMM_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); + else + registry.fill(HIST("os_KK_lsPP_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); } if (gapSide == SingleGapC) { - registry.fill(HIST("os_KK_ls_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); + if (t0.sign() < 0) + registry.fill(HIST("os_KK_lsMM_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); + else + registry.fill(HIST("os_KK_lsPP_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } if (exclusive && gapSide == DoubleGap && mult2 == numTwoTracks) { registry.fill(HIST("os_KK_ls_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); @@ -945,10 +1018,16 @@ struct SginclusivePhiKstarSD { } // same sign pair if (t0.sign() == t1.sign()) { if (gapSide == SingleGapA) { - registry.fill(HIST("os_pk_ls_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); + if (t0.sign() < 0) + registry.fill(HIST("os_pk_lsMM_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); + else + registry.fill(HIST("os_pk_lsPP_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); } if (gapSide == SingleGapC) { - registry.fill(HIST("os_pk_ls_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); + if (t0.sign() < 0) + registry.fill(HIST("os_pk_lsMM_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); + else + registry.fill(HIST("os_pk_lsPP_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } if (exclusive && gapSide == DoubleGap && mult2 == numTwoTracks) { registry.fill(HIST("os_pk_ls_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); @@ -1043,20 +1122,21 @@ struct SginclusivePhiKstarSD { ROOT::Math::PxPyPzMVector v0; ROOT::Math::PxPyPzMVector v1; ROOT::Math::PxPyPzMVector v01; - float fitCut[5] = {fv0Cut, ft0aCut, ft0cCut, fddaCut, fddcCut}; + std::vector parameters = {pvCut, dcazCut, dcaxyCut, tpcChi2Cut, tpcNClsFindableCut, itsChi2Cut, etaCut, ptCut}; + BinningTypeVertexContributor binningOnPositions{{axisVertex, axisMultiplicityClass}, true}; + for (auto const& [collision1, collision2] : o2::soa::selfCombinations(binningOnPositions, cfgNoMixedEvents, -1, collisions, collisions)) { - int truegapSide1 = sgSelector.trueGap(collision1, fitCut[0], fitCut[1], fitCut[2], zdcCut); - int truegapSide2 = sgSelector.trueGap(collision2, fitCut[0], fitCut[1], fitCut[2], zdcCut); - if (truegapSide1 != truegapSide2) - continue; - if (truegapSide1 == -1) - continue; - if (std::abs(collision1.posZ()) > vzCut || std::abs(collision2.posZ()) > vzCut) + + auto [eventSelected1, gapSide1] = selectionEvent(collision1, false); + auto [eventSelected2, gapSide2] = selectionEvent(collision2, false); + if (!eventSelected1 || !eventSelected2) continue; - if (std::abs(collision1.occupancyInTime()) > occCut || std::abs(collision2.occupancyInTime()) > occCut) + + if (gapSide1 != gapSide2) continue; + auto posThisColl = posTracks->sliceByCached(aod::udtrack::udCollisionId, collision1.globalIndex(), cache); auto negThisColl = negTracks->sliceByCached(aod::udtrack::udCollisionId, collision2.globalIndex(), cache); // for (auto& [track1, track2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(posThisColl, negThisColl))) { @@ -1071,10 +1151,10 @@ struct SginclusivePhiKstarSD { continue; // Opposite sign pairs if (track1.sign() != track2.sign()) { - if (truegapSide1 == SingleGapA) { + if (gapSide1 == SingleGapA) { registry.fill(HIST("os_KK_mix_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (truegapSide1 == SingleGapC) { + if (gapSide1 == SingleGapC) { registry.fill(HIST("os_KK_mix_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } } @@ -1093,10 +1173,10 @@ struct SginclusivePhiKstarSD { continue; // Opposite sign pairs if (track1.sign() != track2.sign()) { - if (truegapSide1 == SingleGapA) { + if (gapSide1 == SingleGapA) { registry.fill(HIST("os_pk_mix_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (truegapSide1 == SingleGapC) { + if (gapSide1 == SingleGapC) { registry.fill(HIST("os_pk_mix_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } } @@ -1273,43 +1353,43 @@ struct SginclusivePhiKstarSD { return; registry.fill(HIST("Reco/hEventCutFlowMC"), 4); - if (std::abs(collision.occupancyInTime()) > occCut) + if (useOccCut && (std::abs(collision.occupancyInTime()) > confgOccCut)) return; registry.fill(HIST("Reco/hEventCutFlowMC"), 5); - if (std::abs(collision.hadronicRate()) > hadronicRate) + if (useHadronicRateCut && (std::abs(collision.hadronicRate()) > confgHadronicRateMax || std::abs(collision.hadronicRate()) < confgHadronicRateMin)) return; registry.fill(HIST("Reco/hEventCutFlowMC"), 6); - if (useTrs != -1 && collision.trs() != useTrs) + if (useTrs && collision.trs() != 1) return; registry.fill(HIST("Reco/hEventCutFlowMC"), 7); - if (useTrofs != -1 && collision.trofs() != useTrofs) + if (useTrofs && collision.trofs() != 1) return; registry.fill(HIST("Reco/hEventCutFlowMC"), 8); - if (useHmpr != -1 && collision.hmpr() != useHmpr) + if (useHmpr && collision.hmpr() != 1) return; registry.fill(HIST("Reco/hEventCutFlowMC"), 9); - if (useTfb != -1 && collision.tfb() != useTfb) + if (useTfb && collision.tfb() != 1) return; registry.fill(HIST("Reco/hEventCutFlowMC"), 10); - if (useItsrofb != -1 && collision.itsROFb() != useItsrofb) + if (useItsrofb && collision.itsROFb() != 1) return; registry.fill(HIST("Reco/hEventCutFlowMC"), 11); - if (useSbp != -1 && collision.sbp() != useSbp) + if (useSbp && collision.sbp() != 1) return; registry.fill(HIST("Reco/hEventCutFlowMC"), 12); - if (useZvtxftovpv != -1 && collision.zVtxFT0vPV() != useZvtxftovpv) + if (useZvtxftovpv && collision.zVtxFT0vPV() != 1) return; registry.fill(HIST("Reco/hEventCutFlowMC"), 13); - if (useVtxItsTpc != -1 && collision.vtxITSTPC() != useVtxItsTpc) + if (useVtxItsTpc && collision.vtxITSTPC() != 1) return; registry.fill(HIST("Reco/hEventCutFlowMC"), 14); @@ -1321,6 +1401,10 @@ struct SginclusivePhiKstarSD { return; registry.fill(HIST("Reco/hEventCutFlowMC"), 16); + if (usenumContrib && (collision.numContrib() < mintrack || collision.numContrib() > maxtrack)) + return; + registry.fill(HIST("Reco/hEventCutFlowMC"), 17); + if (qaMC) rQA.fill(HIST("hOcc_after_mc"), collision.occupancyInTime()); @@ -1335,7 +1419,7 @@ struct SginclusivePhiKstarSD { ROOT::Math::PxPyPzMVector vr1g; ROOT::Math::PxPyPzMVector vr01g; int t1 = 0; - if (truegapSide == 0) { + if (truegapSide == SingleGapA) { if (qaMC) { rQA.fill(HIST("V0A_0_mc"), collision.totalFV0AmplitudeA()); rQA.fill(HIST("FT0A_0_mc"), collision.totalFT0AmplitudeA()); @@ -1344,7 +1428,7 @@ struct SginclusivePhiKstarSD { rQA.fill(HIST("ZDC_C_0_mc"), collision.energyCommonZNC()); } } - if (truegapSide == 1) { + if (truegapSide == SingleGapC) { if (qaMC) { rQA.fill(HIST("V0A_1_mc"), collision.totalFV0AmplitudeA()); rQA.fill(HIST("FT0A_1_mc"), collision.totalFT0AmplitudeA()); From 97ffd292453a21b41c2d71340e5d727ed6f4806d Mon Sep 17 00:00:00 2001 From: Marvin Hemmer <53471402+mhemmer-cern@users.noreply.github.com> Date: Wed, 29 Oct 2025 18:16:32 +0100 Subject: [PATCH 942/986] [PWGEM,PWGEM-36] Pi0 Flow: Sort histograms (#13590) --- PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx | 172 ++++++++------------- 1 file changed, 63 insertions(+), 109 deletions(-) diff --git a/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx b/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx index c7f46123f86..321bbf007d7 100644 --- a/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx @@ -18,7 +18,6 @@ #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" #include "PWGEM/PhotonMeson/Utils/EventHistograms.h" -#include "Common/CCDB/TriggerAliases.h" #include "Common/Core/EventPlaneHelper.h" #include "Common/Core/RecoDecay.h" #include "Common/DataModel/Centrality.h" @@ -153,7 +152,6 @@ struct TaskPi0FlowEMC { Configurable cfgMinCent{"cfgMinCent", 0, "min. centrality (%)"}; Configurable cfgMaxCent{"cfgMaxCent", 90, "max. centrality (%)"}; Configurable onlyKeepWeightedEvents{"onlyKeepWeightedEvents", false, "flag to keep only weighted events (for JJ MCs) and remove all MB events (with weight = 1)"}; - Configurable cfgEnableQA{"cfgEnableQA", false, "flag to turn QA plots on/off"}; } eventcuts; EMCPhotonCut fEMCCut; @@ -334,13 +332,16 @@ struct TaskPi0FlowEMC { const AxisSpec thnAxisMixingEP{mixingConfig.cfgEPBins, Form("cos(%d#varphi)", harmonic.value)}; registry.add("hSparsePi0Flow", " vs m_{inv} vs p_T vs cent for same event", HistType::kTProfile3D, {thnAxisInvMass, thnAxisPt, thnAxisCent}); - registry.add("hSparseBkgRotFlow", " vs m_{inv} vs p_T vs cent for rotation background", HistType::kTProfile3D, {thnAxisInvMass, thnAxisPt, thnAxisCent}); - registry.add("hSparseBkgMixFlow", " vs m_{inv} vs p_T vs cent for mixed event", HistType::kTProfile3D, {thnAxisInvMass, thnAxisPt, thnAxisCent}); - registry.add("hSparsePi0", "m_{inv} vs p_T vs cent for same event", HistType::kTH3D, {thnAxisInvMass, thnAxisPt, thnAxisCent}); - registry.add("hSparseBkgRot", "m_{inv} vs p_T vs cent for rotation background", HistType::kTH3D, {thnAxisInvMass, thnAxisPt, thnAxisCent}); + + registry.add("hSparseBkgMixFlow", " vs m_{inv} vs p_T vs cent for mixed event", HistType::kTProfile3D, {thnAxisInvMass, thnAxisPt, thnAxisCent}); registry.add("hSparseBkgMix", "m_{inv} vs p_T vs cent for mixed event", HistType::kTH3D, {thnAxisInvMass, thnAxisPt, thnAxisCent}); + if (cfgDoRotation.value) { + registry.add("hSparseBkgRotFlow", " vs m_{inv} vs p_T vs cent for rotation background", HistType::kTProfile3D, {thnAxisInvMass, thnAxisPt, thnAxisCent}); + registry.add("hSparseBkgRot", "m_{inv} vs p_T vs cent for rotation background", HistType::kTH3D, {thnAxisInvMass, thnAxisPt, thnAxisCent}); + } + registry.add("h3DMixingCount", "THn Event Mixing QA", HistType::kTH3D, {thnAxisMixingVtx, thnAxisMixingCent, thnAxisMixingEP}); if (cfgDoPlaneQA.value) { registry.add("hSparsePi0FlowPlane", "THn for SP", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisCent, thnAxisCosDeltaPhi}); @@ -361,7 +362,7 @@ struct TaskPi0FlowEMC { hClusterCutsMixed->GetXaxis()->SetBinLabel(5, "conversion cut"); hClusterCutsMixed->GetXaxis()->SetBinLabel(6, "out"); - if (saveSPResoHist) { + if (saveSPResoHist.value) { registry.add("spReso/hSpResoFT0cFT0a", "hSpResoFT0cFT0a; centrality; Q_{FT0c} #bullet Q_{FT0a}", HistType::kTProfile, {thnAxisCent}); registry.add("spReso/hSpResoFT0cTPCpos", "hSpResoFT0cTPCpos; centrality; Q_{FT0c} #bullet Q_{TPCpos}", HistType::kTProfile, {thnAxisCent}); registry.add("spReso/hSpResoFT0cTPCneg", "hSpResoFT0cTPCneg; centrality; Q_{FT0c} #bullet Q_{TPCneg}", HistType::kTProfile, {thnAxisCent}); @@ -375,7 +376,7 @@ struct TaskPi0FlowEMC { registry.add("spReso/hSpResoTPCposTPCneg", "hSpResoTPCposTPCneg; centrality; Q_{TPCpos} #bullet Q_{TPCneg}", HistType::kTProfile, {thnAxisCent}); } - if (saveEpResoHisto) { + if (saveEpResoHisto.value) { registry.add("hEventPlaneAngleFT0M", "hEventPlaneAngleFT0M", HistType::kTH2D, {thnAxisCent, thAxisPsi}); registry.add("hEventPlaneAngleTPCpos", "hEventPlaneAngleTPCpos", HistType::kTH2D, {thnAxisCent, thAxisPsi}); registry.add("hEventPlaneAngleTPCneg", "hEventPlaneAngleTPCneg", HistType::kTH2D, {thnAxisCent, thAxisPsi}); @@ -409,40 +410,28 @@ struct TaskPi0FlowEMC { registry.add("QVector/hQVecMeanRVsPhiTPCneg", "hQVecMeanRVsPhiTPCneg; centrality; #it{#varphi} (rad), <#it{r}> (a.u.)", HistType::kTProfile2D, {thnAxisCent, thAxisAzimuth}); registry.add("QVector/hQVecMeanRVsPhiTPCTot", "hQVecMeanRVsPhiTPCTot; centrality; #it{#varphi} (rad), <#it{r}> (a.u.)", HistType::kTProfile2D, {thnAxisCent, thAxisAzimuth}); } - if (eventcuts.cfgEnableQA) { - auto hCollisionEMCCheck = registry.add("hCollisionEMCCheck", "collision counter;;Counts", kTH1D, {{7, 0.5, 7.5}}, false); - hCollisionEMCCheck->GetXaxis()->SetBinLabel(1, "all"); - hCollisionEMCCheck->GetXaxis()->SetBinLabel(2, "EMC MB Readout"); - hCollisionEMCCheck->GetXaxis()->SetBinLabel(3, "has clusters"); - hCollisionEMCCheck->GetXaxis()->SetBinLabel(4, "EMC MB Readout & has clusters"); - hCollisionEMCCheck->GetXaxis()->SetBinLabel(5, "EMC MB Readout but no clusters"); - hCollisionEMCCheck->GetXaxis()->SetBinLabel(6, "No EMC MB Readout but has clusters"); - hCollisionEMCCheck->GetXaxis()->SetBinLabel(7, "No EMC MB Readout and no clusters"); - } - if (emccuts.cfgEnableQA) { - registry.add("hEClusterBefore", "Histo for cluster energy before cuts", HistType::kTH1D, {thAxisClusterEnergy}); - registry.add("hEClusterAfter", "Histo for cluster energy after cuts", HistType::kTH1D, {thAxisClusterEnergy}); + if (emccuts.cfgEnableQA.value) { + registry.add("clusterQA/hEClusterBefore", "Histo for cluster energy before cuts", HistType::kTH1D, {thAxisClusterEnergy}); + registry.add("clusterQA/hEClusterAfter", "Histo for cluster energy after cuts", HistType::kTH1D, {thAxisClusterEnergy}); + registry.add("clusterQA/hClusterEtaPhiBefore", "hClusterEtaPhiBefore", HistType::kTH2D, {thAxisPhi, thAxisEta}); + registry.add("clusterQA/hClusterEtaPhiAfter", "hClusterEtaPhiAfter", HistType::kTH2D, {thAxisPhi, thAxisEta}); + if (cfgDoRotation.value) { + registry.add("clusterQA/hClusterBackEtaPhiBefore", "hClusterBackEtaPhiBefore", HistType::kTH2D, {thAxisPhi, thAxisEta}); + registry.add("clusterQA/hClusterBackEtaPhiAfter", "hClusterBackEtaPhiAfter", HistType::kTH2D, {thAxisPhi, thAxisEta}); + } } - if (mesonConfig.cfgEnableQA) { - registry.add("hInvMassPt", "Histo for inv pair mass vs pt", HistType::kTH2D, {thnAxisInvMass, thnAxisPt}); - registry.add("hTanThetaPhi", "Histo for identification of conversion cluster", HistType::kTH2D, {thnAxisInvMass, thAxisTanThetaPhi}); - registry.add("hAlphaPt", "Histo of meson asymmetry vs pT", HistType::kTH2D, {thAxisAlpha, thnAxisPt}); - registry.add("mesonQA/hClusterEtaPhiBefore", "hClusterEtaPhiBefore", HistType::kTH2D, {thAxisPhi, thAxisEta}); - registry.add("mesonQA/hClusterEtaPhiAfter", "hClusterEtaPhiAfter", HistType::kTH2D, {thAxisPhi, thAxisEta}); - registry.add("hInvMassPtMixed", "Histo for inv pair mass vs pt for mixed event", HistType::kTH2D, {thnAxisInvMass, thnAxisPt}); - registry.add("hTanThetaPhiMixed", "Histo for identification of conversion cluster for mixed event", HistType::kTH2D, {thnAxisInvMass, thAxisTanThetaPhi}); - registry.add("hAlphaPtMixed", "Histo of meson asymmetry vs pT for mixed event", HistType::kTH2D, {thAxisAlpha, thnAxisPt}); - registry.add("mesonQA/hClusterEtaPhiBeforeMixed", "hClusterEtaPhiBefore for mixed event", HistType::kTH2D, {thAxisPhi, thAxisEta}); - registry.add("mesonQA/hClusterEtaPhiAfterMixed", "hClusterEtaPhiAfter for mixed event", HistType::kTH2D, {thAxisPhi, thAxisEta}); - if (cfgDoRotation) { - registry.add("mesonQA/hClusterBackEtaPhiBefore", "hClusterBackEtaPhiBefore", HistType::kTH2D, {thAxisPhi, thAxisEta}); - registry.add("mesonQA/hClusterBackEtaPhiAfter", "hClusterBackEtaPhiAfter", HistType::kTH2D, {thAxisPhi, thAxisEta}); - } + if (mesonConfig.cfgEnableQA.value) { + registry.add("mesonQA/hInvMassPt", "Histo for inv pair mass vs pt", HistType::kTH2D, {thnAxisInvMass, thnAxisPt}); + registry.add("mesonQA/hTanThetaPhi", "Histo for identification of conversion cluster", HistType::kTH2D, {thnAxisInvMass, thAxisTanThetaPhi}); + registry.add("mesonQA/hAlphaPt", "Histo of meson asymmetry vs pT", HistType::kTH2D, {thAxisAlpha, thnAxisPt}); + registry.add("mesonQA/hInvMassPtMixed", "Histo for inv pair mass vs pt for mixed event", HistType::kTH2D, {thnAxisInvMass, thnAxisPt}); + registry.add("mesonQA/hTanThetaPhiMixed", "Histo for identification of conversion cluster for mixed event", HistType::kTH2D, {thnAxisInvMass, thAxisTanThetaPhi}); + registry.add("mesonQA/hAlphaPtMixed", "Histo of meson asymmetry vs pT for mixed event", HistType::kTH2D, {thAxisAlpha, thnAxisPt}); } - if (correctionConfig.doEMCalCalib) { + if (correctionConfig.doEMCalCalib.value) { registry.add("hSparseCalibSE", "THn for Calib same event", HistType::kTHnSparseF, {thnAxisInvMass, thAxisEnergyCalib, thnAxisCent}); registry.add("hSparseCalibBack", "THn for Calib background", HistType::kTHnSparseF, {thnAxisInvMass, thAxisEnergyCalib, thnAxisCent}); } @@ -723,20 +712,20 @@ struct TaskPi0FlowEMC { photon1 = rotationMatrix * photon1; photon2 = rotationMatrix * photon2; - if (emccuts.cfgEnableQA) { - registry.fill(HIST("mesonQA/hClusterBackEtaPhiBefore"), RecoDecay::constrainAngle(photon1.Phi()), photon1.Eta()); // before check but after rotation - registry.fill(HIST("mesonQA/hClusterBackEtaPhiBefore"), RecoDecay::constrainAngle(photon2.Phi()), photon2.Eta()); // before check but after rotation + if (emccuts.cfgEnableQA.value) { + registry.fill(HIST("clusterQA/hClusterBackEtaPhiBefore"), RecoDecay::constrainAngle(photon1.Phi()), photon1.Eta()); // before check but after rotation + registry.fill(HIST("clusterQA/hClusterBackEtaPhiBefore"), RecoDecay::constrainAngle(photon2.Phi()), photon2.Eta()); // before check but after rotation } if (checkEtaPhi1D(photon1.Eta(), RecoDecay::constrainAngle(photon1.Phi())) >= cfgEMCalMapLevelBackground.value) { iCellIDPhoton1 = -1; - } else if (emccuts.cfgEnableQA) { - registry.fill(HIST("mesonQA/hClusterBackEtaPhiAfter"), RecoDecay::constrainAngle(photon1.Phi()), photon1.Eta()); // after check + } else if (emccuts.cfgEnableQA.value) { + registry.fill(HIST("clusterQA/hClusterBackEtaPhiAfter"), RecoDecay::constrainAngle(photon1.Phi()), photon1.Eta()); // after check } if (checkEtaPhi1D(photon2.Eta(), RecoDecay::constrainAngle(photon2.Phi())) >= cfgEMCalMapLevelBackground.value) { iCellIDPhoton2 = -1; - } else if (emccuts.cfgEnableQA) { - registry.fill(HIST("mesonQA/hClusterBackEtaPhiAfter"), RecoDecay::constrainAngle(photon2.Phi()), photon2.Eta()); // after check + } else if (emccuts.cfgEnableQA.value) { + registry.fill(HIST("clusterQA/hClusterBackEtaPhiAfter"), RecoDecay::constrainAngle(photon2.Phi()), photon2.Eta()); // after check } if (iCellIDPhoton1 == -1 && iCellIDPhoton2 == -1) { return; @@ -774,9 +763,11 @@ struct TaskPi0FlowEMC { float dPhi = photon1.Phi() - photon3.Phi(); if (mesonConfig.enableTanThetadPhi && mesonConfig.minTanThetadPhi > std::fabs(getAngleDegree(std::atan(dTheta / dPhi)))) { registry.fill(HIST("hSparseBkgRotFlow"), mother1.M(), mother1.Pt(), cent, scalprodCand1); + registry.fill(HIST("hSparseBkgRot"), mother1.M(), mother1.Pt(), cent); } } else { registry.fill(HIST("hSparseBkgRotFlow"), mother1.M(), mother1.Pt(), cent, scalprodCand1); + registry.fill(HIST("hSparseBkgRot"), mother1.M(), mother1.Pt(), cent); } } } @@ -797,9 +788,11 @@ struct TaskPi0FlowEMC { float dPhi = photon2.Phi() - photon3.Phi(); if (mesonConfig.enableTanThetadPhi && mesonConfig.minTanThetadPhi > std::fabs(getAngleDegree(std::atan(dTheta / dPhi)))) { registry.fill(HIST("hSparseBkgRotFlow"), mother2.M(), mother2.Pt(), cent, scalprodCand2); + registry.fill(HIST("hSparseBkgRot"), mother2.M(), mother2.Pt(), cent); } } else { registry.fill(HIST("hSparseBkgRotFlow"), mother2.M(), mother2.Pt(), cent, scalprodCand2); + registry.fill(HIST("hSparseBkgRot"), mother2.M(), mother2.Pt(), cent); } } } @@ -932,26 +925,6 @@ struct TaskPi0FlowEMC { for (const auto& collision : collisions) { auto photonsPerCollision = clusters.sliceBy(perCollisionEMC, collision.globalIndex()); - if (eventcuts.cfgEnableQA) { - // TODO: check EMCal NCells in collisions without EMC Readout - registry.fill(HIST("hCollisionEMCCheck"), 1.); // all - if (collision.alias_bit(kTVXinEMC) == true) { - registry.fill(HIST("hCollisionEMCCheck"), 2.); // has EMC read out - if (photonsPerCollision.size() > 0) { - registry.fill(HIST("hCollisionEMCCheck"), 3.); // has EMC cluster - registry.fill(HIST("hCollisionEMCCheck"), 4.); // has EMC read out and clusters - } else { - registry.fill(HIST("hCollisionEMCCheck"), 5.); // has EMC read out but no clusters - } - } else { - if (photonsPerCollision.size() > 0) { - registry.fill(HIST("hCollisionEMCCheck"), 3.); // has EMC cluster - registry.fill(HIST("hCollisionEMCCheck"), 6.); // has no EMC read out and clusters - } else { - registry.fill(HIST("hCollisionEMCCheck"), 7.); // has no EMC read out and no clusters - } - } - } o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<0>(®istry, collision); if (!(fEMEventCut.IsSelected(collision))) { // general event selection @@ -979,18 +952,18 @@ struct TaskPi0FlowEMC { registry.fill(HIST("Event/before/hCollisionCounter"), 12.0); // accepted registry.fill(HIST("Event/after/hCollisionCounter"), 12.0); // accepted - if (emccuts.cfgEnableQA) { + if (emccuts.cfgEnableQA.value) { for (const auto& photon : photonsPerCollision) { - registry.fill(HIST("hEClusterBefore"), photon.e()); // before cuts - registry.fill(HIST("mesonQA/hClusterEtaPhiBefore"), photon.phi(), photon.eta()); // before cuts + registry.fill(HIST("clusterQA/hEClusterBefore"), photon.e()); // before cuts + registry.fill(HIST("clusterQA/hClusterEtaPhiBefore"), photon.phi(), photon.eta()); // before cuts if (!(fEMCCut.IsSelected(photon))) { continue; } if (cfgDistanceToEdge.value && (checkEtaPhi1D(photon.eta(), RecoDecay::constrainAngle(photon.phi())) >= cfgEMCalMapLevelSameEvent.value)) { continue; } - registry.fill(HIST("hEClusterAfter"), photon.e()); // accepted after cuts - registry.fill(HIST("mesonQA/hClusterEtaPhiAfter"), photon.phi(), photon.eta()); // before cuts + registry.fill(HIST("clusterQA/hEClusterAfter"), photon.e()); // accepted after cuts + registry.fill(HIST("clusterQA/hClusterEtaPhiAfter"), photon.phi(), photon.eta()); // after cuts } } for (const auto& [g1, g2] : combinations(CombinationsStrictlyUpperIndexPolicy(photonsPerCollision, photonsPerCollision))) { @@ -1037,10 +1010,10 @@ struct TaskPi0FlowEMC { registry.fill(HIST("hClusterCuts"), 4); continue; } - if (mesonConfig.cfgEnableQA) { - registry.fill(HIST("hInvMassPt"), vMeson.M(), vMeson.Pt()); - registry.fill(HIST("hTanThetaPhi"), vMeson.M(), getAngleDegree(std::atan(dTheta / dPhi))); - registry.fill(HIST("hAlphaPt"), (v1.E() - v2.E()) / (v1.E() + v2.E()), vMeson.Pt()); + if (mesonConfig.cfgEnableQA.value) { + registry.fill(HIST("mesonQA/hInvMassPt"), vMeson.M(), vMeson.Pt()); + registry.fill(HIST("mesonQA/hTanThetaPhi"), vMeson.M(), getAngleDegree(std::atan(dTheta / dPhi))); + registry.fill(HIST("mesonQA/hAlphaPt"), (v1.E() - v2.E()) / (v1.E() + v2.E()), vMeson.Pt()); } if (mesonConfig.enableTanThetadPhi && mesonConfig.minTanThetadPhi > std::fabs(getAngleDegree(std::atan(dTheta / dPhi)))) { registry.fill(HIST("hClusterCuts"), 5); @@ -1142,10 +1115,10 @@ struct TaskPi0FlowEMC { registry.fill(HIST("hClusterCutsMixed"), 4); continue; } - if (mesonConfig.cfgEnableQA) { - registry.fill(HIST("hInvMassPtMixed"), vMeson.M(), vMeson.Pt()); - registry.fill(HIST("hTanThetaPhiMixed"), vMeson.M(), getAngleDegree(std::atan(dTheta / dPhi))); - registry.fill(HIST("hAlphaPtMixed"), (v1.E() - v2.E()) / (v1.E() + v2.E()), vMeson.Pt()); + if (mesonConfig.cfgEnableQA.value) { + registry.fill(HIST("mesonQA/hInvMassPtMixed"), vMeson.M(), vMeson.Pt()); + registry.fill(HIST("mesonQA/hTanThetaPhiMixed"), vMeson.M(), getAngleDegree(std::atan(dTheta / dPhi))); + registry.fill(HIST("mesonQA/hAlphaPtMixed"), (v1.E() - v2.E()) / (v1.E() + v2.E()), vMeson.Pt()); } if (mesonConfig.enableTanThetadPhi && mesonConfig.minTanThetadPhi > std::fabs(getAngleDegree(std::atan(dTheta / dPhi)))) { registry.fill(HIST("hClusterCutsMixed"), 5); @@ -1318,13 +1291,13 @@ struct TaskPi0FlowEMC { registry.fill(HIST("Event/before/hCollisionCounter"), 12.0); // accepted registry.fill(HIST("Event/after/hCollisionCounter"), 12.0); // accepted - if (emccuts.cfgEnableQA) { + if (emccuts.cfgEnableQA.value) { for (const auto& photon : photonsPerCollision) { - registry.fill(HIST("hEClusterBefore"), photon.e()); // before cuts + registry.fill(HIST("clusterQA/hEClusterBefore"), photon.e()); // before cuts if (!(fEMCCut.IsSelected(photon))) { continue; } - registry.fill(HIST("hEClusterAfter"), photon.e()); // accepted after cuts + registry.fill(HIST("clusterQA/hEClusterAfter"), photon.e()); // accepted after cuts } } for (const auto& [g1, g2] : combinations(CombinationsStrictlyUpperIndexPolicy(photonsPerCollision, photonsPerCollision))) { @@ -1373,10 +1346,10 @@ struct TaskPi0FlowEMC { registry.fill(HIST("hClusterCuts"), 4); continue; } - if (mesonConfig.cfgEnableQA) { - registry.fill(HIST("hInvMassPt"), vMeson.M(), vMeson.Pt()); - registry.fill(HIST("hTanThetaPhi"), vMeson.M(), getAngleDegree(std::atan(dTheta / dPhi))); - registry.fill(HIST("hAlphaPt"), (v1.E() - v2.E()) / (v1.E() + v2.E()), vMeson.Pt()); + if (mesonConfig.cfgEnableQA.value) { + registry.fill(HIST("mesonQA/hInvMassPt"), vMeson.M(), vMeson.Pt()); + registry.fill(HIST("mesonQA/hTanThetaPhi"), vMeson.M(), getAngleDegree(std::atan(dTheta / dPhi))); + registry.fill(HIST("mesonQA/hAlphaPt"), (v1.E() - v2.E()) / (v1.E() + v2.E()), vMeson.Pt()); } if (mesonConfig.enableTanThetadPhi && mesonConfig.minTanThetadPhi > std::fabs(getAngleDegree(std::atan(dTheta / dPhi)))) { registry.fill(HIST("hClusterCuts"), 5); @@ -1404,25 +1377,6 @@ struct TaskPi0FlowEMC { for (const auto& collision : collisions) { auto photonsPerCollision = clusters.sliceBy(perCollisionEMC, collision.globalIndex()); - if (eventcuts.cfgEnableQA) { - registry.fill(HIST("hCollisionEMCCheck"), 1.); // all - if (collision.alias_bit(kTVXinEMC) == true) { - registry.fill(HIST("hCollisionEMCCheck"), 2.); // has EMC read out - if (photonsPerCollision.size() > 0) { - registry.fill(HIST("hCollisionEMCCheck"), 3.); // has EMC cluster - registry.fill(HIST("hCollisionEMCCheck"), 4.); // has EMC read out and clusters - } else { - registry.fill(HIST("hCollisionEMCCheck"), 5.); // has EMC read out but no clusters - } - } else { - if (photonsPerCollision.size() > 0) { - registry.fill(HIST("hCollisionEMCCheck"), 3.); // has EMC cluster - registry.fill(HIST("hCollisionEMCCheck"), 6.); // has no EMC read out and clusters - } else { - registry.fill(HIST("hCollisionEMCCheck"), 7.); // has no EMC read out and no clusters - } - } - } o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<0>(®istry, collision); if (!(fEMEventCut.IsSelected(collision))) { // general event selection @@ -1451,9 +1405,9 @@ struct TaskPi0FlowEMC { registry.fill(HIST("Event/after/hCollisionCounter"), 12.0); // accepted for (const auto& photon : photonsPerCollision) { - if (mesonConfig.cfgEnableQA) { - registry.fill(HIST("hEClusterBefore"), photon.e()); // before cuts - registry.fill(HIST("mesonQA/hClusterEtaPhiBefore"), photon.phi(), photon.eta()); // before cuts + if (emccuts.cfgEnableQA.value) { + registry.fill(HIST("clusterQA/hEClusterBefore"), photon.e()); // before cuts + registry.fill(HIST("clusterQA/hClusterEtaPhiBefore"), photon.phi(), photon.eta()); // before cuts } if (!(fEMCCut.IsSelected(photon))) { continue; @@ -1461,9 +1415,9 @@ struct TaskPi0FlowEMC { if (cfgDistanceToEdge.value && (checkEtaPhi1D(photon.eta(), RecoDecay::constrainAngle(photon.phi())) >= cfgEMCalMapLevelSameEvent.value)) { continue; } - if (mesonConfig.cfgEnableQA) { - registry.fill(HIST("hEClusterAfter"), photon.e()); // accepted after cuts - registry.fill(HIST("mesonQA/hClusterEtaPhiAfter"), photon.phi(), photon.eta()); // before cuts + if (emccuts.cfgEnableQA.value) { + registry.fill(HIST("clusterQA/hEClusterAfter"), photon.e()); // accepted after cuts + registry.fill(HIST("clusterQA/hClusterEtaPhiAfter"), photon.phi(), photon.eta()); // after cuts } auto [xQVec, yQVec] = getQvec(collision, qvecDetector); From 4eaa4e9916c58348af64f7f2d52f1bb7ceddea47 Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Wed, 29 Oct 2025 19:12:38 +0100 Subject: [PATCH 943/986] Fix HF MC PID TOF task for deuteron addition (#13588) --- PWGHF/TableProducer/mcPidTof.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/PWGHF/TableProducer/mcPidTof.cxx b/PWGHF/TableProducer/mcPidTof.cxx index f3b6aac8bbf..2fbfa5db98a 100644 --- a/PWGHF/TableProducer/mcPidTof.cxx +++ b/PWGHF/TableProducer/mcPidTof.cxx @@ -848,6 +848,14 @@ struct McPidTof { } break; } + case IdxDe: { + if (fullTable) { + tablePIDFullDe.reserve(size); + } else { + tablePIDDe.reserve(size); + } + break; + } default: LOG(fatal) << "Wrong particle ID in reserveTable() for " << (fullTable ? "full" : "tiny") << " tables"; break; From 2bf6a277e224571651341c03a31b5befb2bf2c5e Mon Sep 17 00:00:00 2001 From: altsybee Date: Wed, 29 Oct 2025 21:38:44 +0100 Subject: [PATCH 944/986] [DPG] add more QA histos for MC (#13589) --- DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx | 26 ++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx b/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx index 03ef02d3722..e87ca9c73f3 100644 --- a/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx +++ b/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx @@ -655,6 +655,12 @@ struct LightIonsEvSelQa { histos.add("MCnonTVX/hMCdataVzDiff", "", kTH2F, {axisNcontrib, axisVtxZdiff}); histos.add("MCnonTVX/hMCdataBcDiffVsMult", "", kTH2F, {axisNcontrib, axisBcDiff}); histos.add("MCnonTVX/hMCdataFoundBcDiffVsMult", "", kTH2F, {axisNcontrib, axisBcDiff}); + + // + histos.add("MC_not_TF_ROF_borders/hNcontribColFromData", "", kTH1F, {axisNcontrib}); + histos.add("MC_not_TF_ROF_borders/hNcontribAccFromData", "", kTH1F, {axisNcontrib}); + histos.add("MC_not_TF_ROF_borders/hNcontribColFromData_foundBcDiff0", "", kTH1F, {axisNcontrib}); + histos.add("MC_not_TF_ROF_borders/hNcontribAccFromData_foundBcDiff0", "", kTH1F, {axisNcontrib}); } Preslice perCollision = aod::track::collisionId; @@ -946,9 +952,11 @@ struct LightIonsEvSelQa { nGlobalTracksPV++; } // end of track loop - histos.fill(HIST("hNcontribColFromData"), nPVtracks); - if (col.selection_bit(kIsTriggerTVX)) - histos.fill(HIST("hNcontribAccFromData"), nPVtracks); + if (col.selection_bit(kNoTimeFrameBorder) && col.selection_bit(kNoITSROFrameBorder)) { + histos.fill(HIST("hNcontribColFromData"), nPVtracks); + if (col.selection_bit(kIsTriggerTVX)) + histos.fill(HIST("hNcontribAccFromData"), nPVtracks); + } bool hasFT0 = foundBC.has_ft0(); bool hasFV0A = foundBC.has_fv0a(); @@ -1867,6 +1875,18 @@ struct LightIonsEvSelQa { histos.fill(HIST("MCnonTVX/hMCdataBcDiffVsMult"), col.numContrib(), bcDiff); histos.fill(HIST("MCnonTVX/hMCdataFoundBcDiffVsMult"), col.numContrib(), foundBcDiff); } + + if (col.selection_bit(kNoTimeFrameBorder) && col.selection_bit(kNoITSROFrameBorder)) { + histos.fill(HIST("MC_not_TF_ROF_borders/hNcontribColFromData"), col.numContrib()); + if (col.selection_bit(kIsTriggerTVX)) + histos.fill(HIST("MC_not_TF_ROF_borders/hNcontribAccFromData"), col.numContrib()); + + if (foundBcDiff == 0) { + histos.fill(HIST("MC_not_TF_ROF_borders/hNcontribColFromData_foundBcDiff0"), col.numContrib()); + if (col.selection_bit(kIsTriggerTVX)) + histos.fill(HIST("MC_not_TF_ROF_borders/hNcontribAccFromData_foundBcDiff0"), col.numContrib()); + } + } } } } From e972a6738172823b4e401ba97221a09cea8e758e Mon Sep 17 00:00:00 2001 From: Fan Si <147278151+fsii@users.noreply.github.com> Date: Wed, 29 Oct 2025 23:49:51 +0100 Subject: [PATCH 945/986] [PWGCF] Update the task for particle number fluctuation analysis (#13591) --- PWGCF/EbyEFluctuations/Tasks/partNumFluc.cxx | 1630 +++++++++++------- 1 file changed, 959 insertions(+), 671 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/partNumFluc.cxx b/PWGCF/EbyEFluctuations/Tasks/partNumFluc.cxx index 7230fcbd76d..0b7d217f230 100644 --- a/PWGCF/EbyEFluctuations/Tasks/partNumFluc.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/partNumFluc.cxx @@ -29,6 +29,7 @@ #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" +#include #include #include #include @@ -64,352 +65,352 @@ using JoinedMcCollisions = soa::Join; namespace fluctuation_calculator_base { -inline constexpr std::int8_t kMaxOrder = 8; -inline constexpr std::uint8_t kNExponentPairs = 36; -inline constexpr std::uint16_t kNOrderVectors = 342; -inline constexpr std::array, kNExponentPairs> kExponentPairs = {{{1, 1}, {2, 1}, {2, 2}, {3, 1}, {3, 2}, {3, 3}, {4, 1}, {4, 2}, {4, 3}, {4, 4}, {5, 1}, {5, 2}, {5, 3}, {5, 4}, {5, 5}, {6, 1}, {6, 2}, {6, 3}, {6, 4}, {6, 5}, {6, 6}, {7, 1}, {7, 2}, {7, 3}, {7, 4}, {7, 5}, {7, 6}, {7, 7}, {8, 1}, {8, 2}, {8, 3}, {8, 4}, {8, 5}, {8, 6}, {8, 7}, {8, 8}}}; -inline constexpr std::array, kNOrderVectors> kOrderVectors = {{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {3, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {3, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {3, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {3, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {3, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {3, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {3, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {3, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {3, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {3, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {3, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {4, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {4, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {4, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {4, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {4, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {4, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {4, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {4, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {5, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {5, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {5, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {5, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {5, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {6, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {6, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}}; +inline constexpr std::int8_t MaxOrder = 8; +inline constexpr std::uint8_t NExponentPairs = 36; +inline constexpr std::uint16_t NOrderVectors = 342; +inline constexpr std::array, NExponentPairs> ExponentPairs = {{{1, 1}, {2, 1}, {2, 2}, {3, 1}, {3, 2}, {3, 3}, {4, 1}, {4, 2}, {4, 3}, {4, 4}, {5, 1}, {5, 2}, {5, 3}, {5, 4}, {5, 5}, {6, 1}, {6, 2}, {6, 3}, {6, 4}, {6, 5}, {6, 6}, {7, 1}, {7, 2}, {7, 3}, {7, 4}, {7, 5}, {7, 6}, {7, 7}, {8, 1}, {8, 2}, {8, 3}, {8, 4}, {8, 5}, {8, 6}, {8, 7}, {8, 8}}}; +inline constexpr std::array, NOrderVectors> OrderVectors = {{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}}; } // namespace fluctuation_calculator_base class FluctuationCalculatorTrack @@ -421,9 +422,9 @@ class FluctuationCalculatorTrack double getProductFast(const std::int32_t orderVectorIndex, const double weight = 1.) const { double product = 1.; - for (std::int32_t const& iExponentPair : std::views::iota(0, static_cast(fluctuation_calculator_base::kNExponentPairs))) { - if (fluctuation_calculator_base::kOrderVectors[orderVectorIndex][iExponentPair]) { - product *= std::pow(mQs[iExponentPair], fluctuation_calculator_base::kOrderVectors[orderVectorIndex][iExponentPair]); + for (std::int32_t const& iExponentPair : std::views::iota(0, static_cast(fluctuation_calculator_base::NExponentPairs))) { + if (fluctuation_calculator_base::OrderVectors[orderVectorIndex][iExponentPair]) { + product *= std::pow(mQs[iExponentPair], fluctuation_calculator_base::OrderVectors[orderVectorIndex][iExponentPair]); } } return product * weight; @@ -431,13 +432,13 @@ class FluctuationCalculatorTrack void init() { mQs.fill(0.); } void fill(const double charge, const double efficiency, const double weight = 1.) { - for (std::int32_t const& iExponentPair : std::views::iota(0, static_cast(fluctuation_calculator_base::kNExponentPairs))) { - mQs[iExponentPair] += std::pow(charge, fluctuation_calculator_base::kExponentPairs[iExponentPair].first) / std::pow(efficiency, fluctuation_calculator_base::kExponentPairs[iExponentPair].second) * weight; + for (std::int32_t const& iExponentPair : std::views::iota(0, static_cast(fluctuation_calculator_base::NExponentPairs))) { + mQs[iExponentPair] += std::pow(charge, fluctuation_calculator_base::ExponentPairs[iExponentPair].first) / std::pow(efficiency, fluctuation_calculator_base::ExponentPairs[iExponentPair].second) * weight; } } protected: - std::array mQs; + std::array mQs; }; struct QuantityHolderEvent { @@ -476,7 +477,7 @@ struct QuantityHolderEvent { { runNumber = runIndex = nGlobalTracks = nPvContributors = nTofBeta = 0; meanDcaXy = meanSquareDcaXy = meanDcaZ = meanSquareDcaZ = vz = centrality = 0.; - nChP = nChM = nKaP = nKaM = nPrP = nPrM = 0; + subgroupIndex = nChP = nChM = nKaP = nKaM = nPrP = nPrM = 0; mcParticleIndicesMatchedTpcPiP.clear(); mcParticleIndicesMatchedTpcPiM.clear(); mcParticleIndicesMatchedTpcKaP.clear(); @@ -493,6 +494,9 @@ struct QuantityHolderEvent { }; struct QuantityHolderTrack { + static constexpr double TruncationAbsNSigmaPid = 999.; + static constexpr double truncateNSigmaPid(const double value) { return (!(std::abs(value) < TruncationAbsNSigmaPid) ? -TruncationAbsNSigmaPid : value); } + std::int32_t sign = 0; double pt = 0.; double eta = 0.; @@ -541,23 +545,25 @@ struct QuantityHolderMcParticle { }; struct PartNumFluc { - Service ccdb; + Configurable cfgCcdbPath{"cfgCcdbPath", "Users/f/fasi/test", "Path in CCDB"}; Configurable cfgFlagQaRun{"cfgFlagQaRun", false, "Run QA flag"}; Configurable cfgFlagQaEvent{"cfgFlagQaEvent", false, "Event QA flag"}; Configurable cfgFlagQaCentrality{"cfgFlagQaCentrality", false, "Centrality QA flag"}; Configurable cfgFlagQaTrack{"cfgFlagQaTrack", false, "Track QA flag"}; - Configurable cfgFlagQaPid{"cfgFlagQaPid", false, "PID QA flag"}; Configurable cfgFlagQaAcceptance{"cfgFlagQaAcceptance", false, "Acceptance QA flag"}; + Configurable cfgFlagQaPid{"cfgFlagQaPid", false, "PID QA flag"}; Configurable cfgFlagAnalysisFluctuationCh{"cfgFlagAnalysisFluctuationCh", false, "Charge number fLuctuation analysis flag"}; Configurable cfgFlagAnalysisFluctuationKa{"cfgFlagAnalysisFluctuationKa", false, "Kaon number fLuctuation analysis flag"}; Configurable cfgFlagAnalysisFluctuationPr{"cfgFlagAnalysisFluctuationPr", false, "(Anti)proton number fLuctuation analysis flag"}; - Configurable cfgFlagCalculationEfficiency{"cfgFlagCalculationEfficiency", true, "Efficiency calculation flag"}; - - Configurable> cfgListRun{"cfgListRun", {551759, 551760, 551761, 551780, 551843, 551856, 551874, 551875, 551877, 551889, 551890, 551894, 551921, 551922, 551923, 551924, 551925, 551926, 551931, 551943, 551958, 551977, 551979, 551982, 551983, 551989, 551992, 551993, 551997, 552005, 552029, 552080, 552102, 552103, 552138, 552139, 552140, 552141, 552142, 552156, 552176, 552177, 552178, 552179, 552197, 552198, 552200, 552201, 552203, 552204, 552205, 552206, 552283, 552285, 552304, 552340, 552341, 552353, 552369, 552381, 552382, 552383, 552384, 552400, 552401, 552402, 552403}, "List of run numbers"}; - Configurable> cfgListRunBad{"cfgListRunBad", {}, "List of bad run numbers"}; - - Configurable cfgFlagEventSel{"cfgFlagEventSel", 0b00000000001111110100000000000000000000000000000000ULL, "Event selection flag"}; + Configurable cfgFlagCalculationPurityPi{"cfgFlagCalculationPurityPi", false, "Pion purity calculation flag"}; + Configurable cfgFlagCalculationPurityKa{"cfgFlagCalculationPurityKa", false, "Kaon purity calculation flag"}; + Configurable cfgFlagCalculationPurityPr{"cfgFlagCalculationPurityPr", false, "(Anti)proton purity calculation flag"}; + Configurable cfgFlagCalculationEfficiencyPi{"cfgFlagCalculationEfficiencyPi", false, "Pion efficiency calculation flag"}; + Configurable cfgFlagCalculationEfficiencyKa{"cfgFlagCalculationEfficiencyKa", false, "Kaon efficiency calculation flag"}; + Configurable cfgFlagCalculationEfficiencyPr{"cfgFlagCalculationEfficiencyPr", false, "(Anti)proton efficiency calculation flag"}; + + Configurable cfgFlagSelectionEvent{"cfgFlagSelectionEvent", 0b00000000001111110100000000000000000000000000000000ULL, "Event selection flag"}; Configurable cfgCutMaxAbsVertexZ{"cfgCutMaxAbsVertexZ", 6., "Maximum absolute vertex z position (cm)"}; Configurable cfgCutMinNPvContributorsDeviation{"cfgCutMinNPvContributorsDeviation", -4, "Minimum nPvContributors deviation from nGlobalTracks"}; @@ -583,7 +589,10 @@ struct PartNumFluc { Configurable cfgNCentralityBins{"cfgNCentralityBins", 20, "Number of centrality bins in fluctuation analysis"}; Configurable cfgNSubgroups{"cfgNSubgroups", 20, "Number of subgroups in fluctuation analysis"}; - Configurable cfgCcdbPathEfficiencyFile{"cfgCcdbPathEfficiencyFile", "Users/f/fasi/test", "Path of the efficiency file in CCDB"}; + Service ccdb; + + std::vector runNumbers; + std::vector runNumbersBad; const TProfile3D* pVzPtEtaEfficiencyTpcPiP = nullptr; const TProfile3D* pVzPtEtaEfficiencyTpcPiM = nullptr; @@ -598,6 +607,10 @@ struct PartNumFluc { const TProfile3D* pVzPtEtaEfficiencyTpcTofPrP = nullptr; const TProfile3D* pVzPtEtaEfficiencyTpcTofPrM = nullptr; + QuantityHolderEvent quantityHolderEvent; + QuantityHolderTrack quantityHolderTrack; + QuantityHolderMcParticle quantityHolderMcParticle; + std::unique_ptr fluctuationCalculatorTrackChP; std::unique_ptr fluctuationCalculatorTrackChM; std::unique_ptr fluctuationCalculatorTrackChT; @@ -611,11 +624,8 @@ struct PartNumFluc { std::unique_ptr fluctuationCalculatorTrackPrT; std::unique_ptr fluctuationCalculatorTrackPrN; - QuantityHolderEvent quantityHolderEvent; - QuantityHolderTrack quantityHolderTrack; - QuantityHolderMcParticle quantityHolderMcParticle; - HistogramRegistry hrCalculationEfficiency{"hrCalculationEfficiency", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry hrCalculationPurity{"hrCalculationPurity", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry hrAnalysisFluctuation{"hrAnalysisFluctuation", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry hrQaAcceptance{"hrQaAcceptance", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry hrQaPid{"hrQaPid", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -629,6 +639,8 @@ struct PartNumFluc { Filter filterfTrack = requireGlobalTrackWoPtEtaInFilter(); Filter filterfMcCollision = (aod::mccollisionprop::numRecoCollision > 0); + Preslice presliceTracksPerCollision = aod::track::collisionId; + void init(InitContext&) { assert(doprocessRaw ^ doprocessMc); @@ -636,15 +648,29 @@ struct PartNumFluc { ccdb->setURL("https://alice-ccdb.cern.ch"); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); - ccdb->setFatalWhenNull(false); + ccdb->setFatalWhenNull(true); + + const TList* const ccdbObject = ccdb->getForTimeStamp(cfgCcdbPath.value, -1); + assert(ccdbObject && ccdbObject->IsA() == TList::Class()); + + const TGraph* const gRunNumberIsBad = static_cast(ccdbObject->FindObject("gRunNumberIsBad")); + assert(gRunNumberIsBad && gRunNumberIsBad->IsA() == TGraph::Class()); + runNumbers.reserve(gRunNumberIsBad->GetN()); + runNumbersBad.reserve(gRunNumberIsBad->GetN()); + for (std::int32_t const& iRun : std::views::iota(0, gRunNumberIsBad->GetN())) { + runNumbers.push_back(static_cast(std::llrint(gRunNumberIsBad->GetX()[iRun]))); + if (gRunNumberIsBad->GetY()[iRun]) { + runNumbersBad.push_back(static_cast(std::llrint(gRunNumberIsBad->GetX()[iRun]))); + } + } hrCounter.add("hNEvents", ";;No. of Events", {HistType::kTH1D, {{10 + aod::evsel::kNsel, -0.5, 9.5 + static_cast(aod::evsel::kNsel), "Selection"}}}); if (doprocessRaw) { if (cfgFlagQaRun.value) { - LOG(info) << "Enabling run QA"; + LOG(info) << "Enabling run QA."; - HistogramConfigSpec hcsQaRun(HistType::kTProfile, {{static_cast(cfgListRun.value.size()), -0.5, cfgListRun.value.size() - 0.5, "Run Index"}}); + HistogramConfigSpec hcsQaRun(HistType::kTProfile, {{static_cast(runNumbers.size()), -0.5, runNumbers.size() - 0.5, "Run Index"}}); hrQaRun.add("QaRun/pRunIndexVx", ";;#LT#it{V}_{#it{x}}#GT (cm)", hcsQaRun); hrQaRun.add("QaRun/pRunIndexVy", ";;#LT#it{V}_{#it{y}}#GT (cm)", hcsQaRun); hrQaRun.add("QaRun/pRunIndexVz", ";;#LT#it{V}_{#it{z}}#GT (cm)", hcsQaRun); @@ -681,26 +707,22 @@ struct PartNumFluc { } if (cfgFlagQaEvent.value) { - LOG(info) << "Enabling event QA"; + LOG(info) << "Enabling event QA."; - AxisSpec asRunIndex(static_cast(cfgListRun.value.size()), -0.5, cfgListRun.value.size() - 0.5, "Run Index"); - AxisSpec asNGlobalTracks(160, -0.5, 159.5, "nGlobalTracks"); + AxisSpec asRunIndex(static_cast(runNumbers.size()), -0.5, runNumbers.size() - 0.5, "Run Index"); + AxisSpec asNGlobalTracks(180, -0.5, 179.5, "nGlobalTracks"); hrQaEvent.add("QaEvent/hRunIndexVxVy", "", {HistType::kTHnSparseF, {asRunIndex, {150, -0.15, 0.15, "#it{V}_{#it{x}} (cm)"}, {150, -0.15, 0.15, "#it{V}_{#it{y}} (cm)"}}}); hrQaEvent.add("QaEvent/hRunIndexVz", "", {HistType::kTH2F, {asRunIndex, {300, -15., 15., "#it{V}_{#it{z}} (cm)"}}}); - hrQaEvent.add("QaEvent/hRunIndexNTofBetaNGlobalTracks", "", {HistType::kTHnSparseF, {asRunIndex, {40, -0.5, 39.5, "nTofBeta"}, asNGlobalTracks}}); - hrQaEvent.add("QaEvent/hRunIndexNPvContributorsNGlobalTracks", "", {HistType::kTHnSparseF, {asRunIndex, {160, -0.5, 159.5, "nPvContributors"}, asNGlobalTracks}}); + hrQaEvent.add("QaEvent/hRunIndexNTofBetaNGlobalTracks", "", {HistType::kTHnSparseF, {asRunIndex, {60, -0.5, 59.5, "nTofBeta"}, asNGlobalTracks}}); + hrQaEvent.add("QaEvent/hRunIndexNPvContributorsNGlobalTracks", "", {HistType::kTHnSparseF, {asRunIndex, {180, -0.5, 179.5, "nPvContributors"}, asNGlobalTracks}}); hrQaEvent.add("QaEvent/hRunIndexNGlobalTracksMeanDcaXy", "", {HistType::kTHnSparseF, {asRunIndex, asNGlobalTracks, {200, -0.5, 0.5, "#LTDCA_{#it{xy}}#GT_{event} (cm)"}}}); - hrQaEvent.add("QaEvent/pRunIndexNGlobalTracksMeanDcaXy", ";;#LT#LTDCA_{#it{xy}}#GT_{event}#GT (cm)", {HistType::kTProfile2D, {asRunIndex, asNGlobalTracks}}); hrQaEvent.add("QaEvent/hRunIndexNGlobalTracksMeanDcaXy_nPvContributorsCut", "", {HistType::kTHnSparseF, {asRunIndex, asNGlobalTracks, {200, -2., 2., "#LTDCA_{#it{z}}#GT_{event} (cm)"}}}); - hrQaEvent.add("QaEvent/pRunIndexNGlobalTracksMeanDcaXy_nPvContributorsCut", ";;#LT#LTDCA_{#it{xy}}#GT_{event}#GT (cm)", {HistType::kTProfile2D, {asRunIndex, asNGlobalTracks}}); hrQaEvent.add("QaEvent/hRunIndexNGlobalTracksMeanDcaZ", "", {HistType::kTHnSparseF, {asRunIndex, asNGlobalTracks, {200, -2., 2., "#LTDCA_{#it{z}}#GT_{event} (cm)"}}}); - hrQaEvent.add("QaEvent/pRunIndexNGlobalTracksMeanDcaZ", ";;#LT#LTDCA_{#it{z}}#GT_{event}#GT (cm)", {HistType::kTProfile2D, {asRunIndex, asNGlobalTracks}}); hrQaEvent.add("QaEvent/hRunIndexNGlobalTracksMeanDcaZ_nPvContributorsCut", "", {HistType::kTHnSparseF, {asRunIndex, asNGlobalTracks, {200, -2., 2., "#LTDCA_{#it{z}}#GT_{event} (cm)"}}}); - hrQaEvent.add("QaEvent/pRunIndexNGlobalTracksMeanDcaZ_nPvContributorsCut", ";;#LT#LTDCA_{#it{z}}#GT_{event}#GT (cm)", {HistType::kTProfile2D, {asRunIndex, asNGlobalTracks}}); } if (cfgFlagQaCentrality.value) { - LOG(info) << "Enabling centrality QA"; + LOG(info) << "Enabling centrality QA."; AxisSpec asQaCentrality(20, 0., 100., "Centrality (%)"); hrQaCentrality.add("QaCentrality/hCentralityFv0a", "", {HistType::kTHnSparseF, {asQaCentrality, {2400, 0., 24000., "FV0A Multiplicity"}}}); @@ -710,9 +732,9 @@ struct PartNumFluc { } if (cfgFlagQaTrack.value) { - LOG(info) << "Enabling track QA"; + LOG(info) << "Enabling track QA."; - AxisSpec asPt(250, 0., 2.5, "#it{p}_{T} (GeV/#it{c})"); + AxisSpec asPt(200, 0., 2., "#it{p}_{T} (GeV/#it{c})"); hrQaTrack.add("QaTrack/hItsNCls", "", {HistType::kTH1D, {{10, -0.5, 9.5, "ITS nClusters"}}}); hrQaTrack.add("QaTrack/hItsChi2NCls", "", {HistType::kTH1D, {{80, 0., 40., "ITS #it{#chi}^{2}/nClusters"}}}); hrQaTrack.add("QaTrack/hTpcNClsNClsSharedNClsFindableNClsCrossedRows", "", {HistType::kTHnSparseF, {{180, -0.5, 179.5, "TPC nClusters"}, {180, -0.5, 179.5, "TPC nSharedClusters"}, {180, -0.5, 179.5, "TPC nFindableClusters"}, {180, -0.5, 179.5, "TPC nCrossedRows"}}}); @@ -723,12 +745,31 @@ struct PartNumFluc { hrQaTrack.add("QaTrack/hPtDcaZ_pvContributor", "", {HistType::kTH2D, {asPt, {200, -0.5, 0.5, "DCA_{#it{xy}} (cm)"}}}); } + if (cfgFlagQaAcceptance.value) { + LOG(info) << "Enabling acceptance QA."; + + AxisSpec asPt(250, 0., 2.5, "#it{p}_{T} (GeV/#it{c})"); + HistogramConfigSpec hcsQaAcceptanceEta(HistType::kTH2D, {{300, -1.5, 1.5, "#it{#eta}"}, asPt}); + HistogramConfigSpec hcsQaAcceptancePhi(HistType::kTH1D, {{360, 0., constants::math::TwoPI, "#it{#varphi} (rad)"}}); + HistogramConfigSpec hcsQaAcceptanceY(HistType::kTH2D, {{300, -1.5, 1.5, "#it{y}"}, asPt}); + hrQaAcceptance.add("QaAcceptance/hEtaPt_tpc", "", hcsQaAcceptanceEta); + hrQaAcceptance.add("QaAcceptance/hPhi_tpc", "", hcsQaAcceptancePhi); + hrQaAcceptance.add("QaAcceptance/hYPt_tpcPi", "", hcsQaAcceptanceY); + hrQaAcceptance.add("QaAcceptance/hYPt_tpcKa", "", hcsQaAcceptanceY); + hrQaAcceptance.add("QaAcceptance/hYPt_tpcPr", "", hcsQaAcceptanceY); + hrQaAcceptance.add("QaAcceptance/hEtaPt_tpcTof", "", hcsQaAcceptanceEta); + hrQaAcceptance.add("QaAcceptance/hPhi_tpcTof", "", hcsQaAcceptancePhi); + hrQaAcceptance.add("QaAcceptance/hYPt_tpcTofPi", "", hcsQaAcceptanceY); + hrQaAcceptance.add("QaAcceptance/hYPt_tpcTofKa", "", hcsQaAcceptanceY); + hrQaAcceptance.add("QaAcceptance/hYPt_tpcTofPr", "", hcsQaAcceptanceY); + } + if (cfgFlagQaPid.value) { - LOG(info) << "Enabling PID QA"; + LOG(info) << "Enabling PID QA."; AxisSpec asPOverQ(140, -3.5, 3.5, "#it{p}/#it{q} (GeV/#it{c})"); AxisSpec asPtOverQ(80, -2., 2., "#it{p}_{T}/#it{q} (GeV/#it{c})"); - AxisSpec asEta(60, -1.5, 1.5, "#it{#eta}"); + AxisSpec asEta(48, -1.2, 1.2, "#it{#eta}"); HistogramConfigSpec hcsQaPid(HistType::kTH3F, {asPtOverQ, asEta, {200, -10., 10.}}); hrQaPid.add("QaPid/hPOverQEtaTpcLnDeDx", "", {HistType::kTH3F, {asPOverQ, asEta, {240, 3., 9., "TPC ln(d#it{E}/d#it{x} (a.u.))"}}}); hrQaPid.add("QaPid/hPtOverQEtaTpcNSigmaPi", ";;;TPC #it{n}#it{#sigma}_{#pi}", hcsQaPid); @@ -746,66 +787,47 @@ struct PartNumFluc { hrQaPid.add("QaPid/hPtOverQEtaTpcTofNSigmaPr", ";;;TPC-TOF #it{n}#it{#sigma}_{p}", hcsQaPid); } - if (cfgFlagQaAcceptance.value) { - LOG(info) << "Enabling acceptance QA"; - - AxisSpec asPt(250, 0., 2.5, "#it{p}_{T} (GeV/#it{c})"); - HistogramConfigSpec hcsQaAcceptanceEta(HistType::kTH2D, {{300, -1.5, 1.5, "#it{#eta}"}, asPt}); - HistogramConfigSpec hcsQaAcceptancePhi(HistType::kTH1D, {{360, 0., constants::math::TwoPI, "#it{#varphi} (rad)"}}); - HistogramConfigSpec hcsQaAcceptanceY(HistType::kTH2D, {{300, -1.5, 1.5, "#it{y}"}, asPt}); - hrQaAcceptance.add("QaAcceptance/hEtaPt_tpc", "", hcsQaAcceptanceEta); - hrQaAcceptance.add("QaAcceptance/hPhi_tpc", "", hcsQaAcceptancePhi); - hrQaAcceptance.add("QaAcceptance/hYPt_tpc_pi", "", hcsQaAcceptanceY); - hrQaAcceptance.add("QaAcceptance/hYPt_tpc_ka", "", hcsQaAcceptanceY); - hrQaAcceptance.add("QaAcceptance/hYPt_tpc_pr", "", hcsQaAcceptanceY); - hrQaAcceptance.add("QaAcceptance/hYPt_tpc_pr_tighter", "", hcsQaAcceptanceY); - hrQaAcceptance.add("QaAcceptance/hEtaPt_tpcTof", "", hcsQaAcceptanceEta); - hrQaAcceptance.add("QaAcceptance/hPhi_tpcTof", "", hcsQaAcceptancePhi); - hrQaAcceptance.add("QaAcceptance/hYPt_tpcTof_pi", "", hcsQaAcceptanceY); - hrQaAcceptance.add("QaAcceptance/hYPt_tpcTof_ka", "", hcsQaAcceptanceY); - hrQaAcceptance.add("QaAcceptance/hYPt_tpcTof_pr", "", hcsQaAcceptanceY); - } - if (cfgFlagAnalysisFluctuationCh.value || cfgFlagAnalysisFluctuationKa.value || cfgFlagAnalysisFluctuationPr.value) { gRandom->SetSeed(0); HistogramConfigSpec hcsAnalysisFluctuation(HistType::kTH3F, {{cfgNCentralityBins.value, 0., 100., "Centrality (%)"}, {60, -0.5, 59.5}, {60, -0.5, 59.5}}); - HistogramConfigSpec hcsFluctuationCalculator(HistType::kTH3D, {{cfgNCentralityBins.value, 0., 100., "Centrality (%)"}, {cfgNSubgroups.value, -0.5, cfgNSubgroups.value - 0.5, "Subgroup Index"}, {fluctuation_calculator_base::kNOrderVectors, -0.5, fluctuation_calculator_base::kNOrderVectors - 0.5, "Order Vector Index"}}); + HistogramConfigSpec hcsFluctuationCalculator(HistType::kTH3D, {{cfgNCentralityBins.value, 0., 100., "Centrality (%)"}, {cfgNSubgroups.value, -0.5, cfgNSubgroups.value - 0.5, "Subgroup Index"}, {fluctuation_calculator_base::NOrderVectors, -0.5, fluctuation_calculator_base::NOrderVectors - 0.5, "Order Vector Index"}}); - const TList* const efficiencyList(ccdb->getForTimeStamp(cfgCcdbPathEfficiencyFile.value, -1)); if (cfgFlagAnalysisFluctuationCh.value) { - pVzPtEtaEfficiencyTpcPiP = static_cast(efficiencyList->FindObject("pVzPtEtaEfficiencyTpcPiP")); + pVzPtEtaEfficiencyTpcPiP = static_cast(ccdbObject->FindObject("pVzPtEtaEfficiencyTpcPiP")); assert(pVzPtEtaEfficiencyTpcPiP && pVzPtEtaEfficiencyTpcPiP->IsA() == TProfile3D::Class()); - pVzPtEtaEfficiencyTpcPiM = static_cast(efficiencyList->FindObject("pVzPtEtaEfficiencyTpcPiM")); + pVzPtEtaEfficiencyTpcPiM = static_cast(ccdbObject->FindObject("pVzPtEtaEfficiencyTpcPiM")); assert(pVzPtEtaEfficiencyTpcPiM && pVzPtEtaEfficiencyTpcPiM->IsA() == TProfile3D::Class()); - pVzPtEtaEfficiencyTpcTofPiP = static_cast(efficiencyList->FindObject("pVzPtEtaEfficiencyTpcTofPiP")); + pVzPtEtaEfficiencyTpcTofPiP = static_cast(ccdbObject->FindObject("pVzPtEtaEfficiencyTpcTofPiP")); assert(pVzPtEtaEfficiencyTpcTofPiP && pVzPtEtaEfficiencyTpcTofPiP->IsA() == TProfile3D::Class()); - pVzPtEtaEfficiencyTpcTofPiM = static_cast(efficiencyList->FindObject("pVzPtEtaEfficiencyTpcTofPiM")); + pVzPtEtaEfficiencyTpcTofPiM = static_cast(ccdbObject->FindObject("pVzPtEtaEfficiencyTpcTofPiM")); assert(pVzPtEtaEfficiencyTpcTofPiM && pVzPtEtaEfficiencyTpcTofPiM->IsA() == TProfile3D::Class()); } + if (cfgFlagAnalysisFluctuationCh.value || cfgFlagAnalysisFluctuationKa.value) { - pVzPtEtaEfficiencyTpcKaP = static_cast(efficiencyList->FindObject("pVzPtEtaEfficiencyTpcKaP")); + pVzPtEtaEfficiencyTpcKaP = static_cast(ccdbObject->FindObject("pVzPtEtaEfficiencyTpcKaP")); assert(pVzPtEtaEfficiencyTpcKaP && pVzPtEtaEfficiencyTpcKaP->IsA() == TProfile3D::Class()); - pVzPtEtaEfficiencyTpcKaM = static_cast(efficiencyList->FindObject("pVzPtEtaEfficiencyTpcKaM")); + pVzPtEtaEfficiencyTpcKaM = static_cast(ccdbObject->FindObject("pVzPtEtaEfficiencyTpcKaM")); assert(pVzPtEtaEfficiencyTpcKaM && pVzPtEtaEfficiencyTpcKaM->IsA() == TProfile3D::Class()); - pVzPtEtaEfficiencyTpcTofKaP = static_cast(efficiencyList->FindObject("pVzPtEtaEfficiencyTpcTofKaP")); + pVzPtEtaEfficiencyTpcTofKaP = static_cast(ccdbObject->FindObject("pVzPtEtaEfficiencyTpcTofKaP")); assert(pVzPtEtaEfficiencyTpcTofKaP && pVzPtEtaEfficiencyTpcTofKaP->IsA() == TProfile3D::Class()); - pVzPtEtaEfficiencyTpcTofKaM = static_cast(efficiencyList->FindObject("pVzPtEtaEfficiencyTpcTofKaM")); + pVzPtEtaEfficiencyTpcTofKaM = static_cast(ccdbObject->FindObject("pVzPtEtaEfficiencyTpcTofKaM")); assert(pVzPtEtaEfficiencyTpcTofKaM && pVzPtEtaEfficiencyTpcTofKaM->IsA() == TProfile3D::Class()); } + if (cfgFlagAnalysisFluctuationCh.value || cfgFlagAnalysisFluctuationPr.value) { - pVzPtEtaEfficiencyTpcPrP = static_cast(efficiencyList->FindObject("pVzPtEtaEfficiencyTpcPrP")); + pVzPtEtaEfficiencyTpcPrP = static_cast(ccdbObject->FindObject("pVzPtEtaEfficiencyTpcPrP")); assert(pVzPtEtaEfficiencyTpcPrP && pVzPtEtaEfficiencyTpcPrP->IsA() == TProfile3D::Class()); - pVzPtEtaEfficiencyTpcPrM = static_cast(efficiencyList->FindObject("pVzPtEtaEfficiencyTpcPrM")); + pVzPtEtaEfficiencyTpcPrM = static_cast(ccdbObject->FindObject("pVzPtEtaEfficiencyTpcPrM")); assert(pVzPtEtaEfficiencyTpcPrM && pVzPtEtaEfficiencyTpcPrM->IsA() == TProfile3D::Class()); - pVzPtEtaEfficiencyTpcTofPrP = static_cast(efficiencyList->FindObject("pVzPtEtaEfficiencyTpcTofPrP")); + pVzPtEtaEfficiencyTpcTofPrP = static_cast(ccdbObject->FindObject("pVzPtEtaEfficiencyTpcTofPrP")); assert(pVzPtEtaEfficiencyTpcTofPrP && pVzPtEtaEfficiencyTpcTofPrP->IsA() == TProfile3D::Class()); - pVzPtEtaEfficiencyTpcTofPrM = static_cast(efficiencyList->FindObject("pVzPtEtaEfficiencyTpcTofPrM")); + pVzPtEtaEfficiencyTpcTofPrM = static_cast(ccdbObject->FindObject("pVzPtEtaEfficiencyTpcTofPrM")); assert(pVzPtEtaEfficiencyTpcTofPrM && pVzPtEtaEfficiencyTpcTofPrM->IsA() == TProfile3D::Class()); } if (cfgFlagAnalysisFluctuationCh.value) { - LOG(info) << "Enabling charge number fluctuation analysis"; + LOG(info) << "Enabling charge number fluctuation analysis."; fluctuationCalculatorTrackChP = std::make_unique(); fluctuationCalculatorTrackChM = std::make_unique(); @@ -820,7 +842,7 @@ struct PartNumFluc { } if (cfgFlagAnalysisFluctuationKa.value) { - LOG(info) << "Enabling kaon number fluctuation analysis"; + LOG(info) << "Enabling kaon number fluctuation analysis."; fluctuationCalculatorTrackKaP = std::make_unique(); fluctuationCalculatorTrackKaM = std::make_unique(); @@ -835,7 +857,7 @@ struct PartNumFluc { } if (cfgFlagAnalysisFluctuationPr.value) { - LOG(info) << "Enabling (anti)proton number fluctuation analysis"; + LOG(info) << "Enabling (anti)proton number fluctuation analysis."; fluctuationCalculatorTrackPrP = std::make_unique(); fluctuationCalculatorTrackPrM = std::make_unique(); @@ -850,59 +872,105 @@ struct PartNumFluc { } } } else if (doprocessMc) { - if (cfgFlagCalculationEfficiency.value) { - LOG(info) << "Enabling efficiency calculation"; - - quantityHolderEvent.mcParticleIndicesMatchedTpcPiP.reserve(60); - quantityHolderEvent.mcParticleIndicesMatchedTpcPiM.reserve(60); - quantityHolderEvent.mcParticleIndicesMatchedTpcKaP.reserve(30); - quantityHolderEvent.mcParticleIndicesMatchedTpcKaM.reserve(30); - quantityHolderEvent.mcParticleIndicesMatchedTpcPrP.reserve(30); - quantityHolderEvent.mcParticleIndicesMatchedTpcPrM.reserve(30); - quantityHolderEvent.mcParticleIndicesMatchedTpcTofPiP.reserve(40); - quantityHolderEvent.mcParticleIndicesMatchedTpcTofPiM.reserve(40); - quantityHolderEvent.mcParticleIndicesMatchedTpcTofKaP.reserve(20); - quantityHolderEvent.mcParticleIndicesMatchedTpcTofKaM.reserve(20); - quantityHolderEvent.mcParticleIndicesMatchedTpcTofPrP.reserve(20); - quantityHolderEvent.mcParticleIndicesMatchedTpcTofPrM.reserve(20); - - HistogramConfigSpec hcsCalculationEfficiency(HistType::kTProfile3D, {{4, -cfgCutMaxAbsVertexZ.value, cfgCutMaxAbsVertexZ.value, "#it{V}_{#it{z}} (cm)"}, {25, 0., 2.5, "#it{p}_{T} (GeV/#it{c})"}, {30, -1.5, 1.5, "#it{#eta}"}}); - hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcPiP", "", hcsCalculationEfficiency); - hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcPiM", "", hcsCalculationEfficiency); - hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcKaP", "", hcsCalculationEfficiency); - hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcKaM", "", hcsCalculationEfficiency); - hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcPrP", "", hcsCalculationEfficiency); - hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcPrM", "", hcsCalculationEfficiency); - hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofPiP", "", hcsCalculationEfficiency); - hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofPiM", "", hcsCalculationEfficiency); - hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofKaP", "", hcsCalculationEfficiency); - hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofKaM", "", hcsCalculationEfficiency); - hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofPrP", "", hcsCalculationEfficiency); - hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofPrM", "", hcsCalculationEfficiency); + if (cfgFlagCalculationPurityPi.value || cfgFlagCalculationPurityKa.value || cfgFlagCalculationPurityPr.value) { + HistogramConfigSpec hcsCalculationPurity(HistType::kTProfile2D, {{20, 0., 2., "#it{p}_{T} (GeV/#it{c})"}, {24, -1.2, 1.2, "#it{#eta}"}}); + + if (cfgFlagCalculationPurityPi.value) { + LOG(info) << "Enabling pion purity calculation."; + + hrCalculationPurity.add("CalculationPurity/pPtEtaPurityTpcPiP", "", hcsCalculationPurity); + hrCalculationPurity.add("CalculationPurity/pPtEtaPurityTpcPiM", "", hcsCalculationPurity); + hrCalculationPurity.add("CalculationPurity/pPtEtaPurityTpcTofPiP", "", hcsCalculationPurity); + hrCalculationPurity.add("CalculationPurity/pPtEtaPurityTpcTofPiM", "", hcsCalculationPurity); + } + + if (cfgFlagCalculationPurityKa.value) { + LOG(info) << "Enabling kaon purity calculation."; + + hrCalculationPurity.add("CalculationPurity/pPtEtaPurityTpcKaP", "", hcsCalculationPurity); + hrCalculationPurity.add("CalculationPurity/pPtEtaPurityTpcKaM", "", hcsCalculationPurity); + hrCalculationPurity.add("CalculationPurity/pPtEtaPurityTpcTofKaP", "", hcsCalculationPurity); + hrCalculationPurity.add("CalculationPurity/pPtEtaPurityTpcTofKaM", "", hcsCalculationPurity); + } + + if (cfgFlagCalculationPurityPr.value) { + LOG(info) << "Enabling (anti)proton purity calculation."; + + hrCalculationPurity.add("CalculationPurity/pPtEtaPurityTpcPrP", "", hcsCalculationPurity); + hrCalculationPurity.add("CalculationPurity/pPtEtaPurityTpcPrM", "", hcsCalculationPurity); + hrCalculationPurity.add("CalculationPurity/pPtEtaPurityTpcTofPrP", "", hcsCalculationPurity); + hrCalculationPurity.add("CalculationPurity/pPtEtaPurityTpcTofPrM", "", hcsCalculationPurity); + } + } + + if (cfgFlagCalculationEfficiencyPi.value || cfgFlagCalculationEfficiencyKa.value || cfgFlagCalculationEfficiencyPr.value) { + HistogramConfigSpec hcsCalculationEfficiency(HistType::kTProfile3D, {{static_cast(std::llrint(cfgCutMaxAbsVertexZ.value * 2.)), -cfgCutMaxAbsVertexZ.value, cfgCutMaxAbsVertexZ.value, "#it{V}_{#it{z}} (cm)"}, {20, 0., 2., "#it{p}_{T} (GeV/#it{c})"}, {24, -1.2, 1.2, "#it{#eta}"}}); + + if (cfgFlagCalculationEfficiencyPi.value) { + LOG(info) << "Enabling pion efficiency calculation."; + + quantityHolderEvent.mcParticleIndicesMatchedTpcPiP.reserve(60); + quantityHolderEvent.mcParticleIndicesMatchedTpcPiM.reserve(60); + quantityHolderEvent.mcParticleIndicesMatchedTpcTofPiP.reserve(40); + quantityHolderEvent.mcParticleIndicesMatchedTpcTofPiM.reserve(40); + + hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcPiP", "", hcsCalculationEfficiency); + hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcPiM", "", hcsCalculationEfficiency); + hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofPiP", "", hcsCalculationEfficiency); + hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofPiM", "", hcsCalculationEfficiency); + } + + if (cfgFlagCalculationEfficiencyKa.value) { + LOG(info) << "Enabling kaon efficiency calculation."; + + quantityHolderEvent.mcParticleIndicesMatchedTpcKaP.reserve(30); + quantityHolderEvent.mcParticleIndicesMatchedTpcKaM.reserve(30); + quantityHolderEvent.mcParticleIndicesMatchedTpcTofKaP.reserve(20); + quantityHolderEvent.mcParticleIndicesMatchedTpcTofKaM.reserve(20); + + hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcKaP", "", hcsCalculationEfficiency); + hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcKaM", "", hcsCalculationEfficiency); + hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofKaP", "", hcsCalculationEfficiency); + hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofKaM", "", hcsCalculationEfficiency); + } + + if (cfgFlagCalculationEfficiencyPr.value) { + LOG(info) << "Enabling (anti)proton efficiency calculation."; + + quantityHolderEvent.mcParticleIndicesMatchedTpcPrP.reserve(30); + quantityHolderEvent.mcParticleIndicesMatchedTpcPrM.reserve(30); + quantityHolderEvent.mcParticleIndicesMatchedTpcTofPrP.reserve(20); + quantityHolderEvent.mcParticleIndicesMatchedTpcTofPrM.reserve(20); + + hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcPrP", "", hcsCalculationEfficiency); + hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcPrM", "", hcsCalculationEfficiency); + hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofPrP", "", hcsCalculationEfficiency); + hrCalculationEfficiency.add("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofPrM", "", hcsCalculationEfficiency); + } } } - if (cfgListRun.value.empty()) { + if (runNumbers.empty()) { LOG(info) << "No run process enabled."; } else { - for (std::int32_t const& run : cfgListRun.value) { - LOG(info) << "Enabling processing run: " << run; + for (std::int32_t const& runNumber : runNumbers) { + LOG(info) << "Enabling processing run: " << runNumber; } } - if (cfgListRunBad.value.empty()) { + if (runNumbersBad.empty()) { LOG(info) << "No run rejection enabled."; } else { - for (std::int32_t const& runBad : cfgListRunBad.value) { - LOG(info) << "Enabling rejecting run: " << runBad; + for (std::int32_t const& runNumberBad : runNumbersBad) { + LOG(info) << "Enabling rejecting run: " << runNumberBad; } } - if ((cfgFlagEventSel.value & ((1ULL << aod::evsel::kNsel) - 1)) == 0) { + if ((cfgFlagSelectionEvent.value & ((1ULL << aod::evsel::kNsel) - 1)) == 0) { LOG(info) << "No event selection bit enabled."; } else { for (std::int32_t const& iEvSel : std::views::iota(0, aod::evsel::kNsel)) { - if ((cfgFlagEventSel.value >> iEvSel) & 1) { + if ((cfgFlagSelectionEvent.value >> iEvSel) & 1) { LOG(info) << "Enabling event selection bit: " << aod::evsel::selectionLabels[iEvSel]; } } @@ -910,53 +978,92 @@ struct PartNumFluc { } template - bool isPi() + std::int32_t isPi() { if constexpr (doRequiringTof && doRejectingOthers) { - return (std::fabs(quantityHolderTrack.tpcTofNSigmaPi) < std::min(cfgCutMaxAbsNSigmaPid.value, std::min(std::fabs(quantityHolderTrack.tpcTofNSigmaKa), std::fabs(quantityHolderTrack.tpcTofNSigmaPr)))); + if (!(std::fabs(quantityHolderTrack.tpcTofNSigmaPi) < std::min(cfgCutMaxAbsNSigmaPid.value, std::min(std::fabs(quantityHolderTrack.tpcTofNSigmaKa), std::fabs(quantityHolderTrack.tpcTofNSigmaPr))))) { + return 0; + } } if constexpr (doRequiringTof && !doRejectingOthers) { - return (std::fabs(quantityHolderTrack.tpcTofNSigmaPi) < cfgCutMaxAbsNSigmaPid.value); + if (!(std::fabs(quantityHolderTrack.tpcTofNSigmaPi) < cfgCutMaxAbsNSigmaPid.value)) { + return 0; + } } if constexpr (!doRequiringTof && doRejectingOthers) { - return (std::fabs(quantityHolderTrack.tpcNSigmaPi) < std::min(cfgCutMaxAbsNSigmaPid.value, std::min(std::fabs(quantityHolderTrack.tpcNSigmaKa), std::fabs(quantityHolderTrack.tpcNSigmaPr)))); + if (!(std::fabs(quantityHolderTrack.tpcNSigmaPi) < std::min(cfgCutMaxAbsNSigmaPid.value, std::min(std::fabs(quantityHolderTrack.tpcNSigmaKa), std::fabs(quantityHolderTrack.tpcNSigmaPr))))) { + return 0; + } } - return (std::fabs(quantityHolderTrack.tpcNSigmaPi) < cfgCutMaxAbsNSigmaPid.value); + if constexpr (!doRequiringTof && !doRejectingOthers) { + if (!(std::fabs(quantityHolderTrack.tpcNSigmaPi) < cfgCutMaxAbsNSigmaPid.value)) { + return 0; + } + } + return quantityHolderTrack.sign; } template - bool isKa() + std::int32_t isKa() { if constexpr (doRequiringTof && doRejectingOthers) { - return (std::fabs(quantityHolderTrack.tpcTofNSigmaKa) < std::min(cfgCutMaxAbsNSigmaPid.value, std::min(std::fabs(quantityHolderTrack.tpcTofNSigmaPi), std::fabs(quantityHolderTrack.tpcTofNSigmaPr)))); + if (!(std::fabs(quantityHolderTrack.tpcTofNSigmaKa) < std::min(cfgCutMaxAbsNSigmaPid.value, std::min(std::fabs(quantityHolderTrack.tpcTofNSigmaPi), std::fabs(quantityHolderTrack.tpcTofNSigmaPr))))) { + return 0; + } } if constexpr (doRequiringTof && !doRejectingOthers) { - return (std::fabs(quantityHolderTrack.tpcTofNSigmaKa) < cfgCutMaxAbsNSigmaPid.value); + if (!(std::fabs(quantityHolderTrack.tpcTofNSigmaKa) < cfgCutMaxAbsNSigmaPid.value)) { + return 0; + } } if constexpr (!doRequiringTof && doRejectingOthers) { - return (std::fabs(quantityHolderTrack.tpcNSigmaKa) < std::min(cfgCutMaxAbsNSigmaPid.value, std::min(std::fabs(quantityHolderTrack.tpcNSigmaPi), std::fabs(quantityHolderTrack.tpcNSigmaPr)))); + if (!(std::fabs(quantityHolderTrack.tpcNSigmaKa) < std::min(cfgCutMaxAbsNSigmaPid.value, std::min(std::fabs(quantityHolderTrack.tpcNSigmaPi), std::fabs(quantityHolderTrack.tpcNSigmaPr))))) { + return 0; + } + } + if constexpr (!doRequiringTof && !doRejectingOthers) { + if (!(std::fabs(quantityHolderTrack.tpcNSigmaKa) < cfgCutMaxAbsNSigmaPid.value)) { + return 0; + } } - return (std::fabs(quantityHolderTrack.tpcNSigmaKa) < cfgCutMaxAbsNSigmaPid.value); + return quantityHolderTrack.sign; } template - bool isPr() + std::int32_t isPr() { if constexpr (doRequiringTof && doRejectingOthers) { - return (std::fabs(quantityHolderTrack.tpcTofNSigmaPr) < std::min(cfgCutMaxAbsNSigmaPid.value, std::min(std::fabs(quantityHolderTrack.tpcTofNSigmaPi), std::fabs(quantityHolderTrack.tpcTofNSigmaKa)))); + if (!(std::fabs(quantityHolderTrack.tpcTofNSigmaPr) < std::min(cfgCutMaxAbsNSigmaPid.value, std::min(std::fabs(quantityHolderTrack.tpcTofNSigmaPi), std::fabs(quantityHolderTrack.tpcTofNSigmaKa))))) { + return 0; + } } if constexpr (doRequiringTof && !doRejectingOthers) { - return (std::fabs(quantityHolderTrack.tpcTofNSigmaPr) < cfgCutMaxAbsNSigmaPid.value); + if (!(std::fabs(quantityHolderTrack.tpcTofNSigmaPr) < cfgCutMaxAbsNSigmaPid.value)) { + return 0; + } } if constexpr (!doRequiringTof && doRejectingOthers) { - return (std::fabs(quantityHolderTrack.tpcNSigmaPr) < std::min(cfgCutMaxAbsNSigmaPid.value, std::min(std::fabs(quantityHolderTrack.tpcNSigmaPi), std::fabs(quantityHolderTrack.tpcNSigmaKa)))); + if (!(std::fabs(quantityHolderTrack.tpcNSigmaPr) < std::min(cfgCutMaxAbsNSigmaPid.value, std::min(std::fabs(quantityHolderTrack.tpcNSigmaPi), std::fabs(quantityHolderTrack.tpcNSigmaKa))))) { + return 0; + } } - return (std::fabs(quantityHolderTrack.tpcNSigmaPr) < cfgCutMaxAbsNSigmaPid.value); + if constexpr (!doRequiringTof && !doRejectingOthers) { + if (!(std::fabs(quantityHolderTrack.tpcNSigmaPr) < cfgCutMaxAbsNSigmaPid.value)) { + return 0; + } + } + return quantityHolderTrack.sign; } bool isGoodMomentum() { - return (cfgCutMinPt.value < quantityHolderTrack.pt && quantityHolderTrack.pt < cfgCutMaxPt.value && std::fabs(quantityHolderTrack.eta) < cfgCutMaxAbsEta.value); + if (!(cfgCutMinPt.value < quantityHolderTrack.pt && quantityHolderTrack.pt < cfgCutMaxPt.value)) { + return false; + } + if (!(std::fabs(quantityHolderTrack.eta) < cfgCutMaxAbsEta.value)) { + return false; + } + return true; } template @@ -995,6 +1102,22 @@ struct PartNumFluc { return true; } + template + bool initMcParticle(const MP& mcParticle) + { + quantityHolderMcParticle.clear(); + quantityHolderMcParticle.globalIndex = mcParticle.globalIndex(); + quantityHolderMcParticle.pdgCode = mcParticle.pdgCode(); + quantityHolderMcParticle.pt = mcParticle.pt(); + quantityHolderMcParticle.eta = mcParticle.eta(); + + if (!mcParticle.isPhysicalPrimary()) { + return false; + } + + return true; + } + template bool initTrack(const T& track) { @@ -1009,16 +1132,16 @@ struct PartNumFluc { quantityHolderTrack.rapidityKa = track.rapidity(constants::physics::MassKPlus); quantityHolderTrack.rapidityPr = track.rapidity(constants::physics::MassProton); quantityHolderTrack.hasTpcPid = (track.hasTPC() && track.tpcSignal() > 0.); - quantityHolderTrack.tpcNSigmaPi = track.tpcNSigmaPi(); - quantityHolderTrack.tpcNSigmaKa = track.tpcNSigmaKa(); - quantityHolderTrack.tpcNSigmaPr = track.tpcNSigmaPr(); + quantityHolderTrack.tpcNSigmaPi = QuantityHolderTrack::truncateNSigmaPid(track.tpcNSigmaPi()); + quantityHolderTrack.tpcNSigmaKa = QuantityHolderTrack::truncateNSigmaPid(track.tpcNSigmaKa()); + quantityHolderTrack.tpcNSigmaPr = QuantityHolderTrack::truncateNSigmaPid(track.tpcNSigmaPr()); quantityHolderTrack.hasTofPid = (track.hasTOF() && track.beta() > 0.); - quantityHolderTrack.tofNSigmaPi = track.tofNSigmaPi(); - quantityHolderTrack.tofNSigmaKa = track.tofNSigmaKa(); - quantityHolderTrack.tofNSigmaPr = track.tofNSigmaPr(); - quantityHolderTrack.tpcTofNSigmaPi = std::sqrt(std::pow(quantityHolderTrack.tpcNSigmaPi, 2.) + std::pow(quantityHolderTrack.tofNSigmaPi, 2.)); - quantityHolderTrack.tpcTofNSigmaKa = std::sqrt(std::pow(quantityHolderTrack.tpcNSigmaKa, 2.) + std::pow(quantityHolderTrack.tofNSigmaKa, 2.)); - quantityHolderTrack.tpcTofNSigmaPr = std::sqrt(std::pow(quantityHolderTrack.tpcNSigmaPr, 2.) + std::pow(quantityHolderTrack.tofNSigmaPr, 2.)); + quantityHolderTrack.tofNSigmaPi = QuantityHolderTrack::truncateNSigmaPid(track.tofNSigmaPi()); + quantityHolderTrack.tofNSigmaKa = QuantityHolderTrack::truncateNSigmaPid(track.tofNSigmaKa()); + quantityHolderTrack.tofNSigmaPr = QuantityHolderTrack::truncateNSigmaPid(track.tofNSigmaPr()); + quantityHolderTrack.tpcTofNSigmaPi = QuantityHolderTrack::truncateNSigmaPid(std::sqrt(std::pow(quantityHolderTrack.tpcNSigmaPi, 2.) + std::pow(quantityHolderTrack.tofNSigmaPi, 2.))); + quantityHolderTrack.tpcTofNSigmaKa = QuantityHolderTrack::truncateNSigmaPid(std::sqrt(std::pow(quantityHolderTrack.tpcNSigmaKa, 2.) + std::pow(quantityHolderTrack.tofNSigmaKa, 2.))); + quantityHolderTrack.tpcTofNSigmaPr = QuantityHolderTrack::truncateNSigmaPid(std::sqrt(std::pow(quantityHolderTrack.tpcNSigmaPr, 2.) + std::pow(quantityHolderTrack.tofNSigmaPr, 2.))); if constexpr (doProcessingMc) { quantityHolderTrack.mcParticleId = track.mcParticleId(); } @@ -1053,15 +1176,27 @@ struct PartNumFluc { hrQaRun.fill(HIST("QaRun/pRunIndexPhi"), quantityHolderEvent.runIndex, quantityHolderTrack.phi); if (quantityHolderTrack.hasTpcPid) { hrQaRun.fill(HIST("QaRun/pRunIndexTpcDeDx"), quantityHolderEvent.runIndex, track.tpcSignal()); - hrQaRun.fill(HIST("QaRun/pRunIndexTpcNSigmaPi"), quantityHolderEvent.runIndex, quantityHolderTrack.tpcNSigmaPi); - hrQaRun.fill(HIST("QaRun/pRunIndexTpcNSigmaKa"), quantityHolderEvent.runIndex, quantityHolderTrack.tpcNSigmaKa); - hrQaRun.fill(HIST("QaRun/pRunIndexTpcNSigmaPr"), quantityHolderEvent.runIndex, quantityHolderTrack.tpcNSigmaPr); + if (std::fabs(quantityHolderTrack.tpcNSigmaPi) < QuantityHolderTrack::TruncationAbsNSigmaPid) { + hrQaRun.fill(HIST("QaRun/pRunIndexTpcNSigmaPi"), quantityHolderEvent.runIndex, quantityHolderTrack.tpcNSigmaPi); + } + if (std::fabs(quantityHolderTrack.tpcNSigmaKa) < QuantityHolderTrack::TruncationAbsNSigmaPid) { + hrQaRun.fill(HIST("QaRun/pRunIndexTpcNSigmaKa"), quantityHolderEvent.runIndex, quantityHolderTrack.tpcNSigmaKa); + } + if (std::fabs(quantityHolderTrack.tpcNSigmaPr) < QuantityHolderTrack::TruncationAbsNSigmaPid) { + hrQaRun.fill(HIST("QaRun/pRunIndexTpcNSigmaPr"), quantityHolderEvent.runIndex, quantityHolderTrack.tpcNSigmaPr); + } } if (quantityHolderTrack.hasTofPid) { hrQaRun.fill(HIST("QaRun/pRunIndexTofInverseBeta"), quantityHolderEvent.runIndex, 1. / track.beta()); - hrQaRun.fill(HIST("QaRun/pRunIndexTofNSigmaPi"), quantityHolderEvent.runIndex, quantityHolderTrack.tofNSigmaPi); - hrQaRun.fill(HIST("QaRun/pRunIndexTofNSigmaKa"), quantityHolderEvent.runIndex, quantityHolderTrack.tofNSigmaKa); - hrQaRun.fill(HIST("QaRun/pRunIndexTofNSigmaPr"), quantityHolderEvent.runIndex, quantityHolderTrack.tofNSigmaPr); + if (std::fabs(quantityHolderTrack.tofNSigmaPi) < QuantityHolderTrack::TruncationAbsNSigmaPid) { + hrQaRun.fill(HIST("QaRun/pRunIndexTofNSigmaPi"), quantityHolderEvent.runIndex, quantityHolderTrack.tofNSigmaPi); + } + if (std::fabs(quantityHolderTrack.tofNSigmaKa) < QuantityHolderTrack::TruncationAbsNSigmaPid) { + hrQaRun.fill(HIST("QaRun/pRunIndexTofNSigmaKa"), quantityHolderEvent.runIndex, quantityHolderTrack.tofNSigmaKa); + } + if (std::fabs(quantityHolderTrack.tofNSigmaPr) < QuantityHolderTrack::TruncationAbsNSigmaPid) { + hrQaRun.fill(HIST("QaRun/pRunIndexTofNSigmaPr"), quantityHolderEvent.runIndex, quantityHolderTrack.tofNSigmaPr); + } } } } @@ -1086,50 +1221,83 @@ struct PartNumFluc { } if constexpr (doProcessingMc && doInitingEvent) { - if (cfgFlagCalculationEfficiency.value) { - if (quantityHolderTrack.hasTpcPid) { - if (isPi()) { - if (quantityHolderTrack.sign == 1) { + if ((cfgFlagCalculationEfficiencyPi.value || cfgFlagCalculationEfficiencyKa.value || cfgFlagCalculationEfficiencyPr.value) && quantityHolderTrack.hasTpcPid) { + if (cfgFlagCalculationEfficiencyPi.value) { + switch (isPi()) { + case 1: quantityHolderEvent.mcParticleIndicesMatchedTpcPiP.push_back(quantityHolderTrack.mcParticleId); - } else if (quantityHolderTrack.sign == -1) { + break; + case -1: quantityHolderEvent.mcParticleIndicesMatchedTpcPiM.push_back(quantityHolderTrack.mcParticleId); - } + break; + default: + break; } - if (isKa()) { - if (quantityHolderTrack.sign == 1) { + } + + if (cfgFlagCalculationEfficiencyKa.value) { + switch (isKa()) { + case 1: quantityHolderEvent.mcParticleIndicesMatchedTpcKaP.push_back(quantityHolderTrack.mcParticleId); - } else if (quantityHolderTrack.sign == -1) { + break; + case -1: quantityHolderEvent.mcParticleIndicesMatchedTpcKaM.push_back(quantityHolderTrack.mcParticleId); - } + break; + default: + break; } - if (isPr()) { - if (quantityHolderTrack.sign == 1) { + } + + if (cfgFlagCalculationEfficiencyPr.value) { + switch (isPr()) { + case 1: quantityHolderEvent.mcParticleIndicesMatchedTpcPrP.push_back(quantityHolderTrack.mcParticleId); - } else if (quantityHolderTrack.sign == -1) { + break; + case -1: quantityHolderEvent.mcParticleIndicesMatchedTpcPrM.push_back(quantityHolderTrack.mcParticleId); - } + break; + default: + break; } - if (quantityHolderTrack.hasTofPid) { - if (isPi()) { - if (quantityHolderTrack.sign == 1) { + } + + if (quantityHolderTrack.hasTofPid) { + if (cfgFlagCalculationEfficiencyPi.value) { + switch (isPi()) { + case 1: quantityHolderEvent.mcParticleIndicesMatchedTpcTofPiP.push_back(quantityHolderTrack.mcParticleId); - } else if (quantityHolderTrack.sign == -1) { + break; + case -1: quantityHolderEvent.mcParticleIndicesMatchedTpcTofPiM.push_back(quantityHolderTrack.mcParticleId); - } + break; + default: + break; } - if (isKa()) { - if (quantityHolderTrack.sign == 1) { + } + + if (cfgFlagCalculationEfficiencyKa.value) { + switch (isKa()) { + case 1: quantityHolderEvent.mcParticleIndicesMatchedTpcTofKaP.push_back(quantityHolderTrack.mcParticleId); - } else if (quantityHolderTrack.sign == -1) { + break; + case -1: quantityHolderEvent.mcParticleIndicesMatchedTpcTofKaM.push_back(quantityHolderTrack.mcParticleId); - } + break; + default: + break; } - if (isPr()) { - if (quantityHolderTrack.sign == 1) { + } + + if (cfgFlagCalculationEfficiencyPr.value) { + switch (isPr()) { + case 1: quantityHolderEvent.mcParticleIndicesMatchedTpcTofPrP.push_back(quantityHolderTrack.mcParticleId); - } else if (quantityHolderTrack.sign == -1) { + break; + case -1: quantityHolderEvent.mcParticleIndicesMatchedTpcTofPrM.push_back(quantityHolderTrack.mcParticleId); - } + break; + default: + break; } } } @@ -1137,70 +1305,61 @@ struct PartNumFluc { } if constexpr (!doProcessingMc && !doInitingEvent) { - if (cfgFlagQaPid.value) { - if (quantityHolderTrack.hasTpcPid) { - hrQaPid.fill(HIST("QaPid/hPOverQEtaTpcLnDeDx"), quantityHolderTrack.pOverQ, quantityHolderTrack.eta, std::log(track.tpcSignal())); - hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcNSigmaPi"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcNSigmaPi); - if (std::fabs(quantityHolderTrack.tofNSigmaPi) < cfgCutMaxAbsNSigmaPid.value) { - hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcNSigmaPi_tofPi"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcNSigmaPi); - } - hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcNSigmaKa"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcNSigmaKa); - if (std::fabs(quantityHolderTrack.tofNSigmaKa) < cfgCutMaxAbsNSigmaPid.value) { - hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcNSigmaKa_tofKa"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcNSigmaKa); + if (cfgFlagQaAcceptance.value && ((quantityHolderTrack.eta > 0. && quantityHolderEvent.vz > cfgCutMaxAbsVertexZ.value - 0.5) || (quantityHolderTrack.eta < 0. && quantityHolderEvent.vz < -cfgCutMaxAbsVertexZ.value + 0.5)) && quantityHolderTrack.hasTpcPid) { + hrQaAcceptance.fill(HIST("QaAcceptance/hEtaPt_tpc"), quantityHolderTrack.eta, quantityHolderTrack.pt); + hrQaAcceptance.fill(HIST("QaAcceptance/hPhi_tpc"), quantityHolderTrack.phi); + if (std::abs(isPi()) == 1) { + hrQaAcceptance.fill(HIST("QaAcceptance/hYPt_tpcPi"), quantityHolderTrack.rapidityPi, quantityHolderTrack.pt); + } + if (std::abs(isKa()) == 1) { + hrQaAcceptance.fill(HIST("QaAcceptance/hYPt_tpcKa"), quantityHolderTrack.rapidityKa, quantityHolderTrack.pt); + } + if (std::abs(isPr()) == 1) { + hrQaAcceptance.fill(HIST("QaAcceptance/hYPt_tpcPr"), quantityHolderTrack.rapidityPr, quantityHolderTrack.pt); + } + if (quantityHolderTrack.hasTofPid) { + hrQaAcceptance.fill(HIST("QaAcceptance/hEtaPt_tpcTof"), quantityHolderTrack.eta, quantityHolderTrack.pt); + hrQaAcceptance.fill(HIST("QaAcceptance/hPhi_tpcTof"), quantityHolderTrack.phi); + if (std::abs(isPi()) == 1) { + hrQaAcceptance.fill(HIST("QaAcceptance/hYPt_tpcTofPi"), quantityHolderTrack.rapidityPi, quantityHolderTrack.pt); } - hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcNSigmaPr"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcNSigmaPr); - if (std::fabs(quantityHolderTrack.tofNSigmaPr) < cfgCutMaxAbsNSigmaPid.value) { - hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcNSigmaPr_tofPr"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcNSigmaPr); + if (std::abs(isKa()) == 1) { + hrQaAcceptance.fill(HIST("QaAcceptance/hYPt_tpcTofKa"), quantityHolderTrack.rapidityKa, quantityHolderTrack.pt); } - if (track.beta() > 0.) { - hrQaPid.fill(HIST("QaPid/hPOverQEtaTofInverseBeta"), quantityHolderTrack.pOverQ, quantityHolderTrack.eta, 1. / track.beta()); - if (std::fabs(quantityHolderTrack.tpcNSigmaPi) < cfgCutMaxAbsNSigmaPid.value) { - hrQaPid.fill(HIST("QaPid/hPtOverQEtaTofNSigmaPi_tpcPi"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tofNSigmaPi); - } - if (std::fabs(quantityHolderTrack.tpcNSigmaKa) < cfgCutMaxAbsNSigmaPid.value) { - hrQaPid.fill(HIST("QaPid/hPtOverQEtaTofNSigmaKa_tpcKa"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tofNSigmaKa); - } - if (std::fabs(quantityHolderTrack.tpcNSigmaPr) < cfgCutMaxAbsNSigmaPid.value) { - hrQaPid.fill(HIST("QaPid/hPtOverQEtaTofNSigmaPr_tpcPr"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tofNSigmaPr); - } - hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcTofNSigmaPi"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcTofNSigmaPi); - hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcTofNSigmaKa"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcTofNSigmaKa); - hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcTofNSigmaPr"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcTofNSigmaPr); + if (std::abs(isPr()) == 1) { + hrQaAcceptance.fill(HIST("QaAcceptance/hYPt_tpcTofPr"), quantityHolderTrack.rapidityPr, quantityHolderTrack.pt); } } } - if (cfgFlagQaAcceptance.value) { - if ((quantityHolderTrack.eta > 0. && quantityHolderEvent.vz > cfgCutMaxAbsVertexZ.value - 0.5) || (quantityHolderTrack.eta < 0. && quantityHolderEvent.vz < -cfgCutMaxAbsVertexZ.value + 0.5)) { - if (quantityHolderTrack.hasTpcPid) { - hrQaAcceptance.fill(HIST("QaAcceptance/hEtaPt_tpc"), quantityHolderTrack.eta, quantityHolderTrack.pt); - hrQaAcceptance.fill(HIST("QaAcceptance/hPhi_tpc"), quantityHolderTrack.phi); - if (isPi()) { - hrQaAcceptance.fill(HIST("QaAcceptance/hYPt_tpc_pi"), quantityHolderTrack.rapidityPi, quantityHolderTrack.pt); - } - if (isKa()) { - hrQaAcceptance.fill(HIST("QaAcceptance/hYPt_tpc_ka"), quantityHolderTrack.rapidityKa, quantityHolderTrack.pt); - } - if (isPr()) { - hrQaAcceptance.fill(HIST("QaAcceptance/hYPt_tpc_pr"), quantityHolderTrack.rapidityPr, quantityHolderTrack.pt); - if (track.tpcNClsCrossedRows() > cfgCutMinTpcNClsCrossedRows.value + 10) { - hrQaAcceptance.fill(HIST("QaAcceptance/hYPt_tpc_pr_tighter"), quantityHolderTrack.rapidityPr, quantityHolderTrack.pt); - } - } - if (quantityHolderTrack.hasTofPid) { - hrQaAcceptance.fill(HIST("QaAcceptance/hEtaPt_tpcTof"), quantityHolderTrack.eta, quantityHolderTrack.pt); - hrQaAcceptance.fill(HIST("QaAcceptance/hPhi_tpcTof"), quantityHolderTrack.phi); - if (isPi()) { - hrQaAcceptance.fill(HIST("QaAcceptance/hYPt_tpcTof_pi"), quantityHolderTrack.rapidityPi, quantityHolderTrack.pt); - } - if (isKa()) { - hrQaAcceptance.fill(HIST("QaAcceptance/hYPt_tpcTof_ka"), quantityHolderTrack.rapidityKa, quantityHolderTrack.pt); - } - if (isPr()) { - hrQaAcceptance.fill(HIST("QaAcceptance/hYPt_tpcTof_pr"), quantityHolderTrack.rapidityPr, quantityHolderTrack.pt); - } - } + if (cfgFlagQaPid.value && quantityHolderTrack.hasTpcPid) { + hrQaPid.fill(HIST("QaPid/hPOverQEtaTpcLnDeDx"), quantityHolderTrack.pOverQ, quantityHolderTrack.eta, std::log(track.tpcSignal())); + hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcNSigmaPi"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcNSigmaPi); + if (std::fabs(quantityHolderTrack.tofNSigmaPi) < cfgCutMaxAbsNSigmaPid.value) { + hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcNSigmaPi_tofPi"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcNSigmaPi); + } + hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcNSigmaKa"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcNSigmaKa); + if (std::fabs(quantityHolderTrack.tofNSigmaKa) < cfgCutMaxAbsNSigmaPid.value) { + hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcNSigmaKa_tofKa"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcNSigmaKa); + } + hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcNSigmaPr"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcNSigmaPr); + if (std::fabs(quantityHolderTrack.tofNSigmaPr) < cfgCutMaxAbsNSigmaPid.value) { + hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcNSigmaPr_tofPr"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcNSigmaPr); + } + if (track.beta() > 0.) { + hrQaPid.fill(HIST("QaPid/hPOverQEtaTofInverseBeta"), quantityHolderTrack.pOverQ, quantityHolderTrack.eta, 1. / track.beta()); + if (std::fabs(quantityHolderTrack.tpcNSigmaPi) < cfgCutMaxAbsNSigmaPid.value) { + hrQaPid.fill(HIST("QaPid/hPtOverQEtaTofNSigmaPi_tpcPi"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tofNSigmaPi); + } + if (std::fabs(quantityHolderTrack.tpcNSigmaKa) < cfgCutMaxAbsNSigmaPid.value) { + hrQaPid.fill(HIST("QaPid/hPtOverQEtaTofNSigmaKa_tpcKa"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tofNSigmaKa); + } + if (std::fabs(quantityHolderTrack.tpcNSigmaPr) < cfgCutMaxAbsNSigmaPid.value) { + hrQaPid.fill(HIST("QaPid/hPtOverQEtaTofNSigmaPr_tpcPr"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tofNSigmaPr); } + hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcTofNSigmaPi"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcTofNSigmaPi); + hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcTofNSigmaKa"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcTofNSigmaKa); + hrQaPid.fill(HIST("QaPid/hPtOverQEtaTpcTofNSigmaPr"), quantityHolderTrack.ptOverQ, quantityHolderTrack.eta, quantityHolderTrack.tpcTofNSigmaPr); } } } @@ -1222,15 +1381,15 @@ struct PartNumFluc { const auto& bc = collision.template bc_as(); quantityHolderEvent.runNumber = bc.runNumber(); - quantityHolderEvent.runIndex = std::distance(cfgListRun.value.begin(), std::ranges::find(cfgListRun.value, quantityHolderEvent.runNumber)); + quantityHolderEvent.runIndex = std::distance(runNumbers.begin(), std::ranges::find(runNumbers, quantityHolderEvent.runNumber)); - if (std::ranges::find(cfgListRun.value, quantityHolderEvent.runNumber) == cfgListRun.value.end() || std::ranges::find(cfgListRunBad.value, quantityHolderEvent.runNumber) != cfgListRunBad.value.end()) { + if (std::ranges::find(runNumbers, quantityHolderEvent.runNumber) == runNumbers.end() || std::ranges::find(runNumbersBad, quantityHolderEvent.runNumber) != runNumbersBad.end()) { hrCounter.fill(HIST("hNEvents"), 2.); return false; } for (std::int32_t const& iEvSel : std::views::iota(0, aod::evsel::kNsel)) { - if (((cfgFlagEventSel.value >> iEvSel) & 1) && !collision.selection_bit(iEvSel)) { + if (((cfgFlagSelectionEvent.value >> iEvSel) & 1) && !collision.selection_bit(iEvSel)) { hrCounter.fill(HIST("hNEvents"), 3); hrCounter.fill(HIST("hNEvents"), 10 + iEvSel); return false; @@ -1292,9 +1451,7 @@ struct PartNumFluc { hrQaEvent.fill(HIST("QaEvent/hRunIndexNPvContributorsNGlobalTracks"), quantityHolderEvent.runIndex, quantityHolderEvent.nPvContributors, quantityHolderEvent.nGlobalTracks); if (quantityHolderEvent.nGlobalTracks > 0) { hrQaEvent.fill(HIST("QaEvent/hRunIndexNGlobalTracksMeanDcaXy"), quantityHolderEvent.runIndex, quantityHolderEvent.nGlobalTracks, quantityHolderEvent.meanDcaXy); - hrQaEvent.fill(HIST("QaEvent/pRunIndexNGlobalTracksMeanDcaXy"), quantityHolderEvent.runIndex, quantityHolderEvent.nGlobalTracks, quantityHolderEvent.meanDcaXy); hrQaEvent.fill(HIST("QaEvent/hRunIndexNGlobalTracksMeanDcaZ"), quantityHolderEvent.runIndex, quantityHolderEvent.nGlobalTracks, quantityHolderEvent.meanDcaZ); - hrQaEvent.fill(HIST("QaEvent/pRunIndexNGlobalTracksMeanDcaZ"), quantityHolderEvent.runIndex, quantityHolderEvent.nGlobalTracks, quantityHolderEvent.meanDcaZ); } } } @@ -1310,9 +1467,7 @@ struct PartNumFluc { if (cfgFlagQaEvent.value) { if (quantityHolderEvent.nGlobalTracks > 0) { hrQaEvent.fill(HIST("QaEvent/hRunIndexNGlobalTracksMeanDcaXy_nPvContributorsCut"), quantityHolderEvent.runIndex, quantityHolderEvent.nGlobalTracks, quantityHolderEvent.meanDcaXy); - hrQaEvent.fill(HIST("QaEvent/pRunIndexNGlobalTracksMeanDcaXy_nPvContributorsCut"), quantityHolderEvent.runIndex, quantityHolderEvent.nGlobalTracks, quantityHolderEvent.meanDcaXy); hrQaEvent.fill(HIST("QaEvent/hRunIndexNGlobalTracksMeanDcaZ_nPvContributorsCut"), quantityHolderEvent.runIndex, quantityHolderEvent.nGlobalTracks, quantityHolderEvent.meanDcaZ); - hrQaEvent.fill(HIST("QaEvent/pRunIndexNGlobalTracksMeanDcaZ_nPvContributorsCut"), quantityHolderEvent.runIndex, quantityHolderEvent.nGlobalTracks, quantityHolderEvent.meanDcaZ); } } } @@ -1337,7 +1492,7 @@ struct PartNumFluc { return; } - if (!cfgFlagQaTrack.value && !cfgFlagQaPid.value && !cfgFlagQaAcceptance.value && !cfgFlagAnalysisFluctuationCh.value && !cfgFlagAnalysisFluctuationKa.value && !cfgFlagAnalysisFluctuationPr.value) { + if (!cfgFlagQaTrack.value && !cfgFlagQaAcceptance.value && !cfgFlagQaPid.value && !cfgFlagAnalysisFluctuationCh.value && !cfgFlagAnalysisFluctuationKa.value && !cfgFlagAnalysisFluctuationPr.value) { return; } @@ -1367,11 +1522,11 @@ struct PartNumFluc { continue; } - if (cfgFlagAnalysisFluctuationCh.value) { - if (isGoodMomentum() && quantityHolderTrack.hasTpcPid) { + if ((cfgFlagAnalysisFluctuationCh.value || cfgFlagAnalysisFluctuationKa.value || cfgFlagAnalysisFluctuationPr.value) && isGoodMomentum() && quantityHolderTrack.hasTpcPid) { + if (cfgFlagAnalysisFluctuationCh.value) { if (quantityHolderTrack.pt < cfgThresholdPtTofPi.value) { - if (isPi()) { - if (quantityHolderTrack.sign == 1) { + switch (isPi()) { + case 1: { quantityHolderEvent.nChP++; const double efficiency = pVzPtEtaEfficiencyTpcPiP->GetBinContent(pVzPtEtaEfficiencyTpcPiP->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcPiP->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcPiP->GetZaxis()->FindBin(quantityHolderTrack.eta)); @@ -1379,7 +1534,8 @@ struct PartNumFluc { fluctuationCalculatorTrackChP->fill(1., efficiency); fluctuationCalculatorTrackChT->fill(1., efficiency); fluctuationCalculatorTrackChN->fill(1., efficiency); - } else if (quantityHolderTrack.sign == -1) { + } break; + case -1: { quantityHolderEvent.nChM++; const double efficiency = pVzPtEtaEfficiencyTpcPiM->GetBinContent(pVzPtEtaEfficiencyTpcPiM->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcPiM->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcPiM->GetZaxis()->FindBin(quantityHolderTrack.eta)); @@ -1387,11 +1543,13 @@ struct PartNumFluc { fluctuationCalculatorTrackChM->fill(1., efficiency); fluctuationCalculatorTrackChT->fill(1., efficiency); fluctuationCalculatorTrackChN->fill(-1., efficiency); - } + } break; + default: + break; } } else if (quantityHolderTrack.hasTofPid) { - if (isPi()) { - if (quantityHolderTrack.sign == 1) { + switch (isPi()) { + case 1: { quantityHolderEvent.nChP++; const double efficiency = pVzPtEtaEfficiencyTpcTofPiP->GetBinContent(pVzPtEtaEfficiencyTpcTofPiP->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcTofPiP->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcTofPiP->GetZaxis()->FindBin(quantityHolderTrack.eta)); @@ -1399,7 +1557,8 @@ struct PartNumFluc { fluctuationCalculatorTrackChP->fill(1., efficiency); fluctuationCalculatorTrackChT->fill(1., efficiency); fluctuationCalculatorTrackChN->fill(1., efficiency); - } else if (quantityHolderTrack.sign == -1) { + } break; + case -1: { quantityHolderEvent.nChM++; const double efficiency = pVzPtEtaEfficiencyTpcTofPiM->GetBinContent(pVzPtEtaEfficiencyTpcTofPiM->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcTofPiM->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcTofPiM->GetZaxis()->FindBin(quantityHolderTrack.eta)); @@ -1407,12 +1566,14 @@ struct PartNumFluc { fluctuationCalculatorTrackChM->fill(1., efficiency); fluctuationCalculatorTrackChT->fill(1., efficiency); fluctuationCalculatorTrackChN->fill(-1., efficiency); - } + } break; + default: + break; } } if (quantityHolderTrack.pt < cfgThresholdPtTofKa.value) { - if (isKa()) { - if (quantityHolderTrack.sign == 1) { + switch (isKa()) { + case 1: { quantityHolderEvent.nChP++; const double efficiency = pVzPtEtaEfficiencyTpcKaP->GetBinContent(pVzPtEtaEfficiencyTpcKaP->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcKaP->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcKaP->GetZaxis()->FindBin(quantityHolderTrack.eta)); @@ -1420,7 +1581,8 @@ struct PartNumFluc { fluctuationCalculatorTrackChP->fill(1., efficiency); fluctuationCalculatorTrackChT->fill(1., efficiency); fluctuationCalculatorTrackChN->fill(1., efficiency); - } else if (quantityHolderTrack.sign == -1) { + } break; + case -1: { quantityHolderEvent.nChM++; const double efficiency = pVzPtEtaEfficiencyTpcKaM->GetBinContent(pVzPtEtaEfficiencyTpcKaM->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcKaM->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcKaM->GetZaxis()->FindBin(quantityHolderTrack.eta)); @@ -1428,11 +1590,13 @@ struct PartNumFluc { fluctuationCalculatorTrackChM->fill(1., efficiency); fluctuationCalculatorTrackChT->fill(1., efficiency); fluctuationCalculatorTrackChN->fill(-1., efficiency); - } + } break; + default: + break; } } else if (quantityHolderTrack.hasTofPid) { - if (isKa()) { - if (quantityHolderTrack.sign == 1) { + switch (isKa()) { + case 1: { quantityHolderEvent.nChP++; const double efficiency = pVzPtEtaEfficiencyTpcTofKaP->GetBinContent(pVzPtEtaEfficiencyTpcTofKaP->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcTofKaP->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcTofKaP->GetZaxis()->FindBin(quantityHolderTrack.eta)); @@ -1440,7 +1604,8 @@ struct PartNumFluc { fluctuationCalculatorTrackChP->fill(1., efficiency); fluctuationCalculatorTrackChT->fill(1., efficiency); fluctuationCalculatorTrackChN->fill(1., efficiency); - } else if (quantityHolderTrack.sign == -1) { + } break; + case -1: { quantityHolderEvent.nChM++; const double efficiency = pVzPtEtaEfficiencyTpcTofKaM->GetBinContent(pVzPtEtaEfficiencyTpcTofKaM->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcTofKaM->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcTofKaM->GetZaxis()->FindBin(quantityHolderTrack.eta)); @@ -1448,12 +1613,14 @@ struct PartNumFluc { fluctuationCalculatorTrackChM->fill(1., efficiency); fluctuationCalculatorTrackChT->fill(1., efficiency); fluctuationCalculatorTrackChN->fill(-1., efficiency); - } + } break; + default: + break; } } if (quantityHolderTrack.pt < cfgThresholdPtTofPr.value) { - if (isPr()) { - if (quantityHolderTrack.sign == 1) { + switch (isPr()) { + case 1: { quantityHolderEvent.nChP++; const double efficiency = pVzPtEtaEfficiencyTpcPrP->GetBinContent(pVzPtEtaEfficiencyTpcPrP->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcPrP->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcPrP->GetZaxis()->FindBin(quantityHolderTrack.eta)); @@ -1461,7 +1628,8 @@ struct PartNumFluc { fluctuationCalculatorTrackChP->fill(1., efficiency); fluctuationCalculatorTrackChT->fill(1., efficiency); fluctuationCalculatorTrackChN->fill(1., efficiency); - } else if (quantityHolderTrack.sign == -1) { + } break; + case -1: { quantityHolderEvent.nChM++; const double efficiency = pVzPtEtaEfficiencyTpcPrM->GetBinContent(pVzPtEtaEfficiencyTpcPrM->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcPrM->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcPrM->GetZaxis()->FindBin(quantityHolderTrack.eta)); @@ -1469,11 +1637,13 @@ struct PartNumFluc { fluctuationCalculatorTrackChM->fill(1., efficiency); fluctuationCalculatorTrackChT->fill(1., efficiency); fluctuationCalculatorTrackChN->fill(-1., efficiency); - } + } break; + default: + break; } } else if (quantityHolderTrack.hasTofPid) { - if (isPr()) { - if (quantityHolderTrack.sign == 1) { + switch (isPr()) { + case 1: { quantityHolderEvent.nChP++; const double efficiency = pVzPtEtaEfficiencyTpcTofPrP->GetBinContent(pVzPtEtaEfficiencyTpcTofPrP->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcTofPrP->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcTofPrP->GetZaxis()->FindBin(quantityHolderTrack.eta)); @@ -1481,7 +1651,8 @@ struct PartNumFluc { fluctuationCalculatorTrackChP->fill(1., efficiency); fluctuationCalculatorTrackChT->fill(1., efficiency); fluctuationCalculatorTrackChN->fill(1., efficiency); - } else if (quantityHolderTrack.sign == -1) { + } break; + case -1: { quantityHolderEvent.nChM++; const double efficiency = pVzPtEtaEfficiencyTpcTofPrM->GetBinContent(pVzPtEtaEfficiencyTpcTofPrM->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcTofPrM->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcTofPrM->GetZaxis()->FindBin(quantityHolderTrack.eta)); @@ -1489,17 +1660,17 @@ struct PartNumFluc { fluctuationCalculatorTrackChM->fill(1., efficiency); fluctuationCalculatorTrackChT->fill(1., efficiency); fluctuationCalculatorTrackChN->fill(-1., efficiency); - } + } break; + default: + break; } } } - } - if (cfgFlagAnalysisFluctuationKa.value) { - if (isGoodMomentum() && quantityHolderTrack.hasTpcPid) { + if (cfgFlagAnalysisFluctuationKa.value) { if (quantityHolderTrack.pt < cfgThresholdPtTofKa.value) { - if (isKa()) { - if (quantityHolderTrack.sign == 1) { + switch (isKa()) { + case 1: { quantityHolderEvent.nKaP++; const double efficiency = pVzPtEtaEfficiencyTpcKaP->GetBinContent(pVzPtEtaEfficiencyTpcKaP->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcKaP->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcKaP->GetZaxis()->FindBin(quantityHolderTrack.eta)); @@ -1507,7 +1678,8 @@ struct PartNumFluc { fluctuationCalculatorTrackKaP->fill(1., efficiency); fluctuationCalculatorTrackKaT->fill(1., efficiency); fluctuationCalculatorTrackKaN->fill(1., efficiency); - } else if (quantityHolderTrack.sign == -1) { + } break; + case -1: { quantityHolderEvent.nKaM++; const double efficiency = pVzPtEtaEfficiencyTpcKaM->GetBinContent(pVzPtEtaEfficiencyTpcKaM->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcKaM->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcKaM->GetZaxis()->FindBin(quantityHolderTrack.eta)); @@ -1515,11 +1687,13 @@ struct PartNumFluc { fluctuationCalculatorTrackKaM->fill(1., efficiency); fluctuationCalculatorTrackKaT->fill(1., efficiency); fluctuationCalculatorTrackKaN->fill(-1., efficiency); - } + } break; + default: + break; } } else if (quantityHolderTrack.hasTofPid) { - if (isKa()) { - if (quantityHolderTrack.sign == 1) { + switch (isKa()) { + case 1: { quantityHolderEvent.nKaP++; const double efficiency = pVzPtEtaEfficiencyTpcTofKaP->GetBinContent(pVzPtEtaEfficiencyTpcTofKaP->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcTofKaP->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcTofKaP->GetZaxis()->FindBin(quantityHolderTrack.eta)); @@ -1527,7 +1701,8 @@ struct PartNumFluc { fluctuationCalculatorTrackKaP->fill(1., efficiency); fluctuationCalculatorTrackKaT->fill(1., efficiency); fluctuationCalculatorTrackKaN->fill(1., efficiency); - } else if (quantityHolderTrack.sign == -1) { + } break; + case -1: { quantityHolderEvent.nKaM++; const double efficiency = pVzPtEtaEfficiencyTpcTofKaM->GetBinContent(pVzPtEtaEfficiencyTpcTofKaM->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcTofKaM->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcTofKaM->GetZaxis()->FindBin(quantityHolderTrack.eta)); @@ -1535,17 +1710,17 @@ struct PartNumFluc { fluctuationCalculatorTrackKaM->fill(1., efficiency); fluctuationCalculatorTrackKaT->fill(1., efficiency); fluctuationCalculatorTrackKaN->fill(-1., efficiency); - } + } break; + default: + break; } } } - } - if (cfgFlagAnalysisFluctuationPr.value) { - if (isGoodMomentum() && quantityHolderTrack.hasTpcPid) { + if (cfgFlagAnalysisFluctuationPr.value) { if (quantityHolderTrack.pt < cfgThresholdPtTofPr.value) { - if (isPr()) { - if (quantityHolderTrack.sign == 1) { + switch (isPr()) { + case 1: { quantityHolderEvent.nPrP++; const double efficiency = pVzPtEtaEfficiencyTpcPrP->GetBinContent(pVzPtEtaEfficiencyTpcPrP->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcPrP->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcPrP->GetZaxis()->FindBin(quantityHolderTrack.eta)); @@ -1553,7 +1728,8 @@ struct PartNumFluc { fluctuationCalculatorTrackPrP->fill(1., efficiency); fluctuationCalculatorTrackPrT->fill(1., efficiency); fluctuationCalculatorTrackPrN->fill(1., efficiency); - } else if (quantityHolderTrack.sign == -1) { + } break; + case -1: { quantityHolderEvent.nPrM++; const double efficiency = pVzPtEtaEfficiencyTpcPrM->GetBinContent(pVzPtEtaEfficiencyTpcPrM->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcPrM->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcPrM->GetZaxis()->FindBin(quantityHolderTrack.eta)); @@ -1561,11 +1737,13 @@ struct PartNumFluc { fluctuationCalculatorTrackPrM->fill(1., efficiency); fluctuationCalculatorTrackPrT->fill(1., efficiency); fluctuationCalculatorTrackPrN->fill(-1., efficiency); - } + } break; + default: + break; } } else if (quantityHolderTrack.hasTofPid) { - if (isPr()) { - if (quantityHolderTrack.sign == 1) { + switch (isPr()) { + case 1: { quantityHolderEvent.nPrP++; const double efficiency = pVzPtEtaEfficiencyTpcTofPrP->GetBinContent(pVzPtEtaEfficiencyTpcTofPrP->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcTofPrP->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcTofPrP->GetZaxis()->FindBin(quantityHolderTrack.eta)); @@ -1573,7 +1751,8 @@ struct PartNumFluc { fluctuationCalculatorTrackPrP->fill(1., efficiency); fluctuationCalculatorTrackPrT->fill(1., efficiency); fluctuationCalculatorTrackPrN->fill(1., efficiency); - } else if (quantityHolderTrack.sign == -1) { + } break; + case -1: { quantityHolderEvent.nPrM++; const double efficiency = pVzPtEtaEfficiencyTpcTofPrM->GetBinContent(pVzPtEtaEfficiencyTpcTofPrM->GetXaxis()->FindBin(quantityHolderEvent.vz), pVzPtEtaEfficiencyTpcTofPrM->GetYaxis()->FindBin(quantityHolderTrack.pt), pVzPtEtaEfficiencyTpcTofPrM->GetZaxis()->FindBin(quantityHolderTrack.eta)); @@ -1581,15 +1760,18 @@ struct PartNumFluc { fluctuationCalculatorTrackPrM->fill(1., efficiency); fluctuationCalculatorTrackPrT->fill(1., efficiency); fluctuationCalculatorTrackPrN->fill(-1., efficiency); - } + } break; + default: + break; } } } } } + if (cfgFlagAnalysisFluctuationCh.value) { hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hCentralityNChPNChM"), quantityHolderEvent.centrality, quantityHolderEvent.nChP, quantityHolderEvent.nChM); - for (std::int32_t const& iOrderVector : std::views::iota(0, static_cast(fluctuation_calculator_base::kNOrderVectors))) { + for (std::int32_t const& iOrderVector : std::views::iota(0, static_cast(fluctuation_calculator_base::NOrderVectors))) { hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hFluctuationCalculatorChP"), quantityHolderEvent.centrality, quantityHolderEvent.subgroupIndex, iOrderVector, fluctuationCalculatorTrackChP->getProductFast(iOrderVector)); hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hFluctuationCalculatorChM"), quantityHolderEvent.centrality, quantityHolderEvent.subgroupIndex, iOrderVector, fluctuationCalculatorTrackChM->getProductFast(iOrderVector)); hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hFluctuationCalculatorChT"), quantityHolderEvent.centrality, quantityHolderEvent.subgroupIndex, iOrderVector, fluctuationCalculatorTrackChT->getProductFast(iOrderVector)); @@ -1598,7 +1780,7 @@ struct PartNumFluc { } if (cfgFlagAnalysisFluctuationKa.value) { hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hCentralityNKaPNKaM"), quantityHolderEvent.centrality, quantityHolderEvent.nKaP, quantityHolderEvent.nKaM); - for (std::int32_t const& iOrderVector : std::views::iota(0, static_cast(fluctuation_calculator_base::kNOrderVectors))) { + for (std::int32_t const& iOrderVector : std::views::iota(0, static_cast(fluctuation_calculator_base::NOrderVectors))) { hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hFluctuationCalculatorKaP"), quantityHolderEvent.centrality, quantityHolderEvent.subgroupIndex, iOrderVector, fluctuationCalculatorTrackKaP->getProductFast(iOrderVector)); hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hFluctuationCalculatorKaM"), quantityHolderEvent.centrality, quantityHolderEvent.subgroupIndex, iOrderVector, fluctuationCalculatorTrackKaM->getProductFast(iOrderVector)); hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hFluctuationCalculatorKaT"), quantityHolderEvent.centrality, quantityHolderEvent.subgroupIndex, iOrderVector, fluctuationCalculatorTrackKaT->getProductFast(iOrderVector)); @@ -1607,7 +1789,7 @@ struct PartNumFluc { } if (cfgFlagAnalysisFluctuationPr.value) { hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hCentralityNPrPNPrM"), quantityHolderEvent.centrality, quantityHolderEvent.nPrP, quantityHolderEvent.nPrM); - for (std::int32_t const& iOrderVector : std::views::iota(0, static_cast(fluctuation_calculator_base::kNOrderVectors))) { + for (std::int32_t const& iOrderVector : std::views::iota(0, static_cast(fluctuation_calculator_base::NOrderVectors))) { hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hFluctuationCalculatorPrP"), quantityHolderEvent.centrality, quantityHolderEvent.subgroupIndex, iOrderVector, fluctuationCalculatorTrackPrP->getProductFast(iOrderVector)); hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hFluctuationCalculatorPrM"), quantityHolderEvent.centrality, quantityHolderEvent.subgroupIndex, iOrderVector, fluctuationCalculatorTrackPrM->getProductFast(iOrderVector)); hrAnalysisFluctuation.fill(HIST("AnalysisFluctuation/hFluctuationCalculatorPrT"), quantityHolderEvent.centrality, quantityHolderEvent.subgroupIndex, iOrderVector, fluctuationCalculatorTrackPrT->getProductFast(iOrderVector)); @@ -1615,9 +1797,8 @@ struct PartNumFluc { } } } - PROCESS_SWITCH(PartNumFluc, processRaw, "Process raw data", false); + PROCESS_SWITCH(PartNumFluc, processRaw, "Process raw data", true); - Preslice presliceTracksPerCollision = aod::track::collisionId; void processMc(const soa::Filtered::iterator& mcCollision, const aod::McParticles& mcParticles, const soa::SmallGroups& collisions, const soa::Filtered& tracksUngrouped, const aod::BCsWithTimestamps&) { for (const auto& collision : collisions) { @@ -1628,54 +1809,161 @@ struct PartNumFluc { const auto& tracks = tracksUngrouped.sliceBy(presliceTracksPerCollision, collision.globalIndex()); if (!initEvent(collision, tracks)) { - return; + continue; } - for (const auto& mcParticle : mcParticles) { - quantityHolderMcParticle.clear(); - quantityHolderMcParticle.globalIndex = mcParticle.globalIndex(); - quantityHolderMcParticle.pdgCode = mcParticle.pdgCode(); - quantityHolderMcParticle.pt = mcParticle.pt(); - quantityHolderMcParticle.eta = mcParticle.eta(); + if ((cfgFlagCalculationPurityPi.value || cfgFlagCalculationPurityKa.value || cfgFlagCalculationPurityPr.value)) { + for (const auto& track : tracks) { + if (!track.has_mcParticle()) { + continue; + } + + const auto& mcParticle = track.template mcParticle_as(); + initMcParticle(mcParticle); + + if (!initTrack(track)) { + continue; + } + + if (quantityHolderTrack.hasTpcPid) { + if (cfgFlagCalculationPurityPi.value) { + switch (isPi()) { + case 1: + hrCalculationPurity.fill(HIST("CalculationPurity/pPtEtaPurityTpcPiP"), quantityHolderTrack.pt, quantityHolderTrack.eta, quantityHolderMcParticle.pdgCode == PDG_t::kPiPlus ? 1. : 0.); + break; + case -1: + hrCalculationPurity.fill(HIST("CalculationPurity/pPtEtaPurityTpcPiM"), quantityHolderTrack.pt, quantityHolderTrack.eta, quantityHolderMcParticle.pdgCode == PDG_t::kPiMinus ? 1. : 0.); + break; + default: + break; + } + } + + if (cfgFlagCalculationPurityKa.value) { + switch (isKa()) { + case 1: + hrCalculationPurity.fill(HIST("CalculationPurity/pPtEtaPurityTpcKaP"), quantityHolderTrack.pt, quantityHolderTrack.eta, quantityHolderMcParticle.pdgCode == PDG_t::kKPlus ? 1. : 0.); + break; + case -1: + hrCalculationPurity.fill(HIST("CalculationPurity/pPtEtaPurityTpcKaM"), quantityHolderTrack.pt, quantityHolderTrack.eta, quantityHolderMcParticle.pdgCode == PDG_t::kKMinus ? 1. : 0.); + break; + default: + break; + } + } - if (!mcParticle.isPhysicalPrimary()) { - continue; + if (cfgFlagCalculationPurityPr.value) { + switch (isPr()) { + case 1: + hrCalculationPurity.fill(HIST("CalculationPurity/pPtEtaPurityTpcPrP"), quantityHolderTrack.pt, quantityHolderTrack.eta, quantityHolderMcParticle.pdgCode == PDG_t::kProton ? 1. : 0.); + break; + case -1: + hrCalculationPurity.fill(HIST("CalculationPurity/pPtEtaPurityTpcPrM"), quantityHolderTrack.pt, quantityHolderTrack.eta, quantityHolderMcParticle.pdgCode == PDG_t::kProtonBar ? 1. : 0.); + break; + default: + break; + } + } + + if (quantityHolderTrack.hasTofPid) { + if (cfgFlagCalculationPurityPi.value) { + switch (isPi()) { + case 1: + hrCalculationPurity.fill(HIST("CalculationPurity/pPtEtaPurityTpcTofPiP"), quantityHolderTrack.pt, quantityHolderTrack.eta, quantityHolderMcParticle.pdgCode == PDG_t::kPiPlus ? 1. : 0.); + break; + case -1: + hrCalculationPurity.fill(HIST("CalculationPurity/pPtEtaPurityTpcTofPiM"), quantityHolderTrack.pt, quantityHolderTrack.eta, quantityHolderMcParticle.pdgCode == PDG_t::kPiMinus ? 1. : 0.); + break; + default: + break; + } + } + + if (cfgFlagCalculationPurityKa.value) { + switch (isKa()) { + case 1: + hrCalculationPurity.fill(HIST("CalculationPurity/pPtEtaPurityTpcTofKaP"), quantityHolderTrack.pt, quantityHolderTrack.eta, quantityHolderMcParticle.pdgCode == PDG_t::kKPlus ? 1. : 0.); + break; + case -1: + hrCalculationPurity.fill(HIST("CalculationPurity/pPtEtaPurityTpcTofKaM"), quantityHolderTrack.pt, quantityHolderTrack.eta, quantityHolderMcParticle.pdgCode == PDG_t::kKMinus ? 1. : 0.); + break; + default: + break; + } + } + + if (cfgFlagCalculationPurityPr.value) { + switch (isPr()) { + case 1: + hrCalculationPurity.fill(HIST("CalculationPurity/pPtEtaPurityTpcTofPrP"), quantityHolderTrack.pt, quantityHolderTrack.eta, quantityHolderMcParticle.pdgCode == PDG_t::kProton ? 1. : 0.); + break; + case -1: + hrCalculationPurity.fill(HIST("CalculationPurity/pPtEtaPurityTpcTofPrM"), quantityHolderTrack.pt, quantityHolderTrack.eta, quantityHolderMcParticle.pdgCode == PDG_t::kProtonBar ? 1. : 0.); + break; + default: + break; + } + } + } + } } + } - if (cfgFlagCalculationEfficiency.value) { - switch (quantityHolderMcParticle.pdgCode) { - case PDG_t::kPiPlus: - hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcPiP"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcPiP, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcPiP.end() ? 1. : 0.); - hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofPiP"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcTofPiP, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcTofPiP.end() ? 1. : 0.); - break; - case PDG_t::kPiMinus: - hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcPiM"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcPiM, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcPiM.end() ? 1. : 0.); - hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofPiM"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcTofPiM, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcTofPiM.end() ? 1. : 0.); - break; - case PDG_t::kKPlus: - hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcKaP"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcKaP, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcKaP.end() ? 1. : 0.); - hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofKaP"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcTofKaP, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcTofKaP.end() ? 1. : 0.); - break; - case PDG_t::kKMinus: - hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcKaM"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcKaM, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcKaM.end() ? 1. : 0.); - hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofKaM"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcTofKaM, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcTofKaM.end() ? 1. : 0.); - break; - case PDG_t::kProton: - hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcPrP"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcPrP, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcPrP.end() ? 1. : 0.); - hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofPrP"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcTofPrP, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcTofPrP.end() ? 1. : 0.); - break; - case PDG_t::kProtonBar: - hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcPrM"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcPrM, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcPrM.end() ? 1. : 0.); - hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofPrM"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcTofPrM, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcTofPrM.end() ? 1. : 0.); - break; - default: - break; + if (cfgFlagCalculationEfficiencyPi.value || cfgFlagCalculationEfficiencyKa.value || cfgFlagCalculationEfficiencyPr.value) { + for (const auto& mcParticle : mcParticles) { + if (!initMcParticle(mcParticle)) { + continue; + } + + if (cfgFlagCalculationEfficiencyPi.value) { + switch (quantityHolderMcParticle.pdgCode) { + case PDG_t::kPiPlus: + hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcPiP"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcPiP, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcPiP.end() ? 1. : 0.); + hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofPiP"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcTofPiP, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcTofPiP.end() ? 1. : 0.); + break; + case PDG_t::kPiMinus: + hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcPiM"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcPiM, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcPiM.end() ? 1. : 0.); + hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofPiM"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcTofPiM, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcTofPiM.end() ? 1. : 0.); + break; + default: + break; + } + } + + if (cfgFlagCalculationEfficiencyKa.value) { + switch (quantityHolderMcParticle.pdgCode) { + case PDG_t::kKPlus: + hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcKaP"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcKaP, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcKaP.end() ? 1. : 0.); + hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofKaP"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcTofKaP, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcTofKaP.end() ? 1. : 0.); + break; + case PDG_t::kKMinus: + hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcKaM"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcKaM, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcKaM.end() ? 1. : 0.); + hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofKaM"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcTofKaM, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcTofKaM.end() ? 1. : 0.); + break; + default: + break; + } + } + + if (cfgFlagCalculationEfficiencyPr.value) { + switch (quantityHolderMcParticle.pdgCode) { + case PDG_t::kProton: + hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcPrP"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcPrP, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcPrP.end() ? 1. : 0.); + hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofPrP"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcTofPrP, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcTofPrP.end() ? 1. : 0.); + break; + case PDG_t::kProtonBar: + hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcPrM"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcPrM, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcPrM.end() ? 1. : 0.); + hrCalculationEfficiency.fill(HIST("CalculationEfficiency/pVzPtEtaEfficiencyTpcTofPrM"), quantityHolderEvent.vz, quantityHolderMcParticle.pt, quantityHolderMcParticle.eta, std::ranges::find(quantityHolderEvent.mcParticleIndicesMatchedTpcTofPrM, quantityHolderMcParticle.globalIndex) != quantityHolderEvent.mcParticleIndicesMatchedTpcTofPrM.end() ? 1. : 0.); + break; + default: + break; + } } } } } } - PROCESS_SWITCH(PartNumFluc, processMc, "Process MC data", true); + PROCESS_SWITCH(PartNumFluc, processMc, "Process MC data", false); }; WorkflowSpec defineDataProcessing(const ConfigContext& cfgc) From 534786d6aac73749cf9510c8d4a708755f9391b7 Mon Sep 17 00:00:00 2001 From: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Date: Thu, 30 Oct 2025 02:30:14 +0100 Subject: [PATCH 946/986] [PWGCF] add solution function for fillCounter problem (#13593) --- PWGCF/Flow/Tasks/flowTask.cxx | 2 +- .../GenericFramework/Core/FlowPtContainer.cxx | 50 +++++++++++++++++++ PWGCF/GenericFramework/Core/FlowPtContainer.h | 26 ++++++++++ 3 files changed, 77 insertions(+), 1 deletion(-) diff --git a/PWGCF/Flow/Tasks/flowTask.cxx b/PWGCF/Flow/Tasks/flowTask.cxx index f24c5a0f9fe..6a50a55e362 100644 --- a/PWGCF/Flow/Tasks/flowTask.cxx +++ b/PWGCF/Flow/Tasks/flowTask.cxx @@ -640,7 +640,7 @@ struct FlowTask { continue; auto val = fGFW->Calculate(corrconfigsPtVn.at(l_ind), 0, kFALSE).real() / dnx; if (std::abs(val) < 1) { - (dt == kGen) ? fFCptgen->fillVnPtProfiles(centmult, val, dnx, rndm, gfwConfigs.GetpTCorrMasks()[l_ind]) : fFCpt->fillVnPtProfiles(centmult, val, dnx, rndm, gfwConfigs.GetpTCorrMasks()[l_ind]); + (dt == kGen) ? fFCptgen->fillVnPtProfiles(l_ind, centmult, val, dnx, rndm, gfwConfigs.GetpTCorrMasks()[l_ind]) : fFCpt->fillVnPtProfiles(l_ind, centmult, val, dnx, rndm, gfwConfigs.GetpTCorrMasks()[l_ind]); } continue; } diff --git a/PWGCF/GenericFramework/Core/FlowPtContainer.cxx b/PWGCF/GenericFramework/Core/FlowPtContainer.cxx index 33f2e303711..fd1ebbdebb7 100644 --- a/PWGCF/GenericFramework/Core/FlowPtContainer.cxx +++ b/PWGCF/GenericFramework/Core/FlowPtContainer.cxx @@ -112,16 +112,21 @@ void FlowPtContainer::initialise(const o2::framework::AxisSpec axis, const int& } } if (fUseGap) { + int obsIndex = 0; + fCovFirstIndex.resize(configs.GetSize(), 0); for (int i = 0; i < configs.GetSize(); ++i) { + fCovFirstIndex[i] = obsIndex; for (auto m(1); m <= mpar; ++m) { if (!(configs.GetpTCorrMasks()[i] & (1 << (m - 1)))) continue; if (fUseCentralMoments) { for (auto j = 0; j <= m; ++j) { fCovList->Add(new BootstrapProfile(Form("%spt%i_Mpt%i", configs.GetHeads()[i].c_str(), m, j), Form("%spt%i_Mpt%i", configs.GetHeads()[i].c_str(), m, j), nMultiBins, &multiBins[0])); + obsIndex++; } } else { fCovList->Add(new BootstrapProfile(Form("%spt%i", configs.GetHeads()[i].c_str(), m), Form("%spt%i", configs.GetHeads()[i].c_str(), m), nMultiBins, &multiBins[0])); + obsIndex++; } } } @@ -197,16 +202,21 @@ void FlowPtContainer::initialise(int nbinsx, double* xbins, const int& m, const } } if (fUseGap) { + int obsIndex = 0; + fCovFirstIndex.resize(configs.GetSize(), 0); for (int i = 0; i < configs.GetSize(); ++i) { + fCovFirstIndex[i] = obsIndex; for (auto m(1); m <= mpar; ++m) { if (!(configs.GetpTCorrMasks()[i] & (1 << (m - 1)))) continue; if (fUseCentralMoments) { for (auto j = 0; j <= m; ++j) { fCovList->Add(new BootstrapProfile(Form("%spt%i_Mpt%i", configs.GetHeads()[i].c_str(), m, j), Form("%spt%i_Mpt%i", configs.GetHeads()[i].c_str(), m, j), nbinsx, xbins)); + obsIndex++; } } else { fCovList->Add(new BootstrapProfile(Form("%spt%i", configs.GetHeads()[i].c_str(), m), Form("%spt%i", configs.GetHeads()[i].c_str(), m), nbinsx, xbins)); + obsIndex++; } } } @@ -280,16 +290,21 @@ void FlowPtContainer::initialise(int nbinsx, double xlow, double xhigh, const in } } if (fUseGap) { + int obsIndex = 0; + fCovFirstIndex.resize(configs.GetSize(), 0); for (int i = 0; i < configs.GetSize(); ++i) { + fCovFirstIndex[i] = obsIndex; for (auto m(1); m <= mpar; ++m) { if (!(configs.GetpTCorrMasks()[i] & (1 << (m - 1)))) continue; if (fUseCentralMoments) { for (auto j = 0; j <= m; ++j) { fCovList->Add(new BootstrapProfile(Form("%spt%i_Mpt%i", configs.GetHeads()[i].c_str(), m, j), Form("%spt%i_Mpt%i", configs.GetHeads()[i].c_str(), m, j), nbinsx, xlow, xhigh)); + obsIndex++; } } else { fCovList->Add(new BootstrapProfile(Form("%spt%i", configs.GetHeads()[i].c_str(), m), Form("%spt%i", configs.GetHeads()[i].c_str(), m), nbinsx, xlow, xhigh)); + obsIndex++; } } } @@ -412,6 +427,41 @@ void FlowPtContainer::fillVnDeltaPtProfiles(const double& centmult, const double } return; } +void FlowPtContainer::fillVnPtCorrProfiles(const int configIndex, const double& centmult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask) +{ + if (!mask) { + return; + } + int startIndex = fCovFirstIndex[configIndex]; + for (auto m(1); m <= mpar; ++m) { + if (!(mask & (1 << (m - 1)))) { + continue; + } + if (corrDen[m] != 0) { + dynamic_cast(fCovList->At(startIndex))->FillProfile(centmult, flowval * corrNum[m] / corrDen[m], (fEventWeight == UnityWeight) ? 1.0 : flowtuples * corrDen[m], rn); + } + ++startIndex; + } + return; +} +void FlowPtContainer::fillVnDeltaPtProfiles(const int configIndex, const double& centmult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask) +{ + if (!mask) { + return; + } + int startIndex = fCovFirstIndex[configIndex]; + for (auto m(1); m <= mpar; ++m) { + if (!(mask & (1 << (m - 1)))) + continue; + for (auto i = 0; i <= m; ++i) { + if (cmDen[m] != 0) { + dynamic_cast(fCovList->At(startIndex))->FillProfile(centmult, flowval * ((i == m) ? cmVal[0] : cmVal[m * (m - 1) / 2 + i + 1]), (fEventWeight == UnityWeight) ? 1.0 : flowtuples * cmDen[m], rn); + } + ++startIndex; + } + } + return; +} void FlowPtContainer::fillVnPtCorrStdProfiles(const double& centmult, const double& rn) { double wAABBCC = getStdAABBCC(warr); diff --git a/PWGCF/GenericFramework/Core/FlowPtContainer.h b/PWGCF/GenericFramework/Core/FlowPtContainer.h index 207e1a36fe7..977fd719063 100644 --- a/PWGCF/GenericFramework/Core/FlowPtContainer.h +++ b/PWGCF/GenericFramework/Core/FlowPtContainer.h @@ -59,6 +59,8 @@ class FlowPtContainer : public TNamed void fillPtProfiles(const double& lMult, const double& rn); void fillVnPtCorrProfiles(const double& lMult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask); void fillVnDeltaPtProfiles(const double& centmult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask); + void fillVnPtCorrProfiles(const int configIndex, const double& lMult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask); + void fillVnDeltaPtProfiles(const int configIndex, const double& centmult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask); void fillVnDeltaPtStdProfiles(const double& centmult, const double& rn); void fillVnPtCorrStdProfiles(const double& centmult, const double& rn); void fillVnPtProfiles(const double& centmult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask) @@ -68,6 +70,29 @@ class FlowPtContainer : public TNamed else fillVnPtCorrProfiles(centmult, flowval, flowtuples, rn, mask); } + void fillVnPtProfiles(const int configIndex, const double& centmult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask) + { + if (fUseCentralMoments) + fillVnDeltaPtProfiles(configIndex, centmult, flowval, flowtuples, rn, mask); + else + fillVnPtCorrProfiles(configIndex, centmult, flowval, flowtuples, rn, mask); + } + void skipVnPtProfiles(uint8_t mask) + { + for (auto m(1); m <= mpar; ++m) { + if (!(mask & (1 << (m - 1)))) { + continue; + } + if (fUseCentralMoments) { + for (auto i = 0; i <= m; ++i) { + ++fillCounter; + } + } else { + ++fillCounter; + } + } + return; + } void fillVnPtStdProfiles(const double& centmult, const double& rn) { if (fUseCentralMoments) @@ -129,6 +154,7 @@ class FlowPtContainer : public TNamed std::vector cmDen; //! std::vector> arr; //! std::vector warr; //! + std::vector fCovFirstIndex; //! template double getStdAABBCC(T& inarr); template From 0462f598d715968f949362522a57a3bccde73bba Mon Sep 17 00:00:00 2001 From: Mattia Faggin Date: Thu, 30 Oct 2025 03:32:28 +0100 Subject: [PATCH 947/986] [Common] TrackTuner: dca calib. "autodetection" based on run number. (#13493) Co-authored-by: mattia --- Common/Tools/TrackPropagationModule.h | 49 ++++++++- Common/Tools/TrackTuner.h | 152 +++++++++++++++++++++++--- 2 files changed, 182 insertions(+), 19 deletions(-) diff --git a/Common/Tools/TrackPropagationModule.h b/Common/Tools/TrackPropagationModule.h index a95f70a7ffb..22474641354 100644 --- a/Common/Tools/TrackPropagationModule.h +++ b/Common/Tools/TrackPropagationModule.h @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -104,6 +105,7 @@ class TrackPropagationModule o2::dataformats::VertexBase mVtx; o2::track::TrackParametrization mTrackPar; o2::track::TrackParametrizationWithError mTrackParCov; + bool autoDetectDcaCalib = false; // track tuner setting template void init(TConfigurableGroup const& cGroup, TrackTuner& trackTunerObj, THistoRegistry& registry, TInitContext& initContext) @@ -155,8 +157,8 @@ class TrackPropagationModule } /// TrackTuner initialization + std::string outputStringParams = ""; if (cGroup.useTrackTuner.value) { - std::string outputStringParams = ""; switch (cGroup.trackTunerConfigSource.value) { case o2::aod::track_tuner::InputString: outputStringParams = trackTunerObj.configParams(cGroup.trackTunerParams.value); @@ -170,10 +172,34 @@ class TrackPropagationModule break; } - trackTunerObj.getDcaGraphs(); + /// read the track tuner instance configurations, + /// to understand whether the TrackTuner::getDcaGraphs function can be called here (input path from string/configurables) + /// or inside the process function, to "auto-detect" the input file based on the run number + const auto& workflows = initContext.services().template get(); + for (const o2::framework::DeviceSpec& device : workflows.devices) { /// loop over devices + if (device.name == "propagation-service") { + // loop over the options + // to find the value of TrackTuner::autoDetectDcaCalib + for (const auto& option : device.options) { /// loop over options + if (option.name == "trackTuner.autoDetectDcaCalib") { + // found it! + autoDetectDcaCalib = option.defaultValue.get(); + break; + } + } /// end loop over options + break; + } + } /// end loop over devices + LOG(info) << "[TrackPropagationModule] trackTuner.autoDetectDcaCalib it's equal to " << autoDetectDcaCalib; + if (!autoDetectDcaCalib) { + LOG(info) << "[TrackPropagationModule] retrieve the graphs already (we are in propagationService::Init() function)"; + trackTunerObj.getDcaGraphs(); + } else { + LOG(info) << "[TrackPropagationModule] trackTunerObj.getDcaGraphs() function to be called later, in the process function!"; + } } - trackTunedTracks = registry.template add("trackTunedTracks", "trackTunedTracks", o2::framework::kTH1D, {{1, 0.5f, 1.5f}}); + trackTunedTracks = registry.template add("trackTunedTracks", outputStringParams.c_str(), o2::framework::kTH1D, {{1, 0.5f, 1.5f}}); // Histograms for track tuner o2::framework::AxisSpec axisBinsDCA = {600, -0.15f, 0.15f, "#it{dca}_{xy} (cm)"}; @@ -186,6 +212,23 @@ class TrackPropagationModule template void fillTrackTables(TConfigurableGroup const& cGroup, TrackTuner& trackTunerObj, TCCDBLoader const& ccdbLoader, TCollisions const& collisions, TTracks const& tracks, TOutputGroup& cursors, THistoRegistry& registry) { + + /// retrieve the TrackTuner calibration graphs *if not done yet* + /// i.e. if autodetect is required + if (cGroup.useTrackTuner.value && autoDetectDcaCalib && !trackTunerObj.areGraphsConfigured) { + + /// get the run number from the ccdb loader, already initialized + const int runNumber = ccdbLoader.runNumber; + trackTunerObj.setRunNumber(runNumber); + + /// setup the "auto-detected" path based on the run number + trackTunerObj.getPathInputFileAutomaticFromCCDB(); + trackTunedTracks->SetTitle(trackTunerObj.outputString.c_str()); + + /// now that the path is ok, retrieve the graphs + trackTunerObj.getDcaGraphs(); + } + if (!fillTracks) { return; // suppress everything } diff --git a/Common/Tools/TrackTuner.h b/Common/Tools/TrackTuner.h index 02001ccf196..1c92e522ef5 100644 --- a/Common/Tools/TrackTuner.h +++ b/Common/Tools/TrackTuner.h @@ -77,6 +77,7 @@ struct TrackTuner : o2::framework::ConfigurableGroup { o2::framework::Configurable cfgQOverPtMC{"qOverPtMC", -1., "Scaling factor on q/pt of MC"}; o2::framework::Configurable cfgQOverPtData{"qOverPtData", -1., "Scaling factor on q/pt of data"}; o2::framework::Configurable cfgNPhiBins{"nPhiBins", 0, "Number of phi bins"}; + o2::framework::Configurable cfgAutoDetectDcaCalib{"autoDetectDcaCalib", false, "Flag to enable the dca-calibration file autodetect from CCDB (list of predefined cases)"}; /////////////////////////////// /// parameters to be configured bool debugInfo = false; @@ -93,10 +94,14 @@ struct TrackTuner : o2::framework::ConfigurableGroup { bool usePvRefitCorrections = false; // establish whether to use corrections obtained with or w/o PV refit float qOverPtMC = -1.; // 1/pt MC float qOverPtData = -1.; // 1/pt data + bool autoDetectDcaCalib = false; // enable automatic pick-up of dca calibration files from CCDB (list of predefined cases) /////////////////////////////// bool isConfigFromString = false; bool isConfigFromConfigurables = false; int nPhiBins = 1; + int runNumber = 0; // first run number considered in analysis (useful only if autoDetectDcaCalib = true) + bool areGraphsConfigured = false; + std::string outputString = ""; std::map metadata; @@ -121,6 +126,12 @@ struct TrackTuner : o2::framework::ConfigurableGroup { std::vector> grDcaZPullVsPtPionMC; std::vector> grDcaZPullVsPtPionData; + /// @brief Function to initialize the run number to that of the 1st considered bunch crossing (useful only if autoDetectDcaCalib = true) + void setRunNumber(int n) + { + runNumber = n; + } + /// @brief Function doing a few sanity-checks on the configurations void checkConfig() { @@ -134,6 +145,82 @@ struct TrackTuner : o2::framework::ConfigurableGroup { } } + void getPathInputFileAutomaticFromCCDB() + { + + /// check: no CCDB autodetection if the desired input file is not in CCDB + if (!isInputFileFromCCDB) { + LOG(fatal) << "[TrackTuner::getPathInputFileAutomaticFromCCDB] Trying to auto detect the dca calibration file from CCDB, but you ask the input file to not come from CCDB (isInputFileFromCCDB==" << isInputFileFromCCDB << "). Fix it!"; + } + /// check that the run number has been already properly set + if (runNumber == 0) { + LOG(fatal) << "[TrackTuner::getPathInputFileAutomaticFromCCDB] runNumber==" << runNumber << ", automatic detection of dca calibration file from CCDB not possible. Did you call the function TrackTuner::setrunNumber()?"; + } + /// check than the number of phi bins for the track tuner calibrations is 24 + if (nPhiBins != 24) { + LOG(fatal) << "[TrackTuner::getPathInputFileAutomaticFromCCDB] nPhiBins==" << nPhiBins << ", but the automatic detection of dca calibration file from CCDB is supported only for nPhiBins==24. Either put nPhiBins=24, or disable the auto-detection (autoDetectDcaCalib=false)"; + } + + pathInputFile = "invalid"; + + /////////////////////////////////////////////////////////////////////////// + /// /// + /// establish some pre-defined cases based only on the run numbers /// + /// /// + /////////////////////////////////////////////////////////////////////////// + LOG(info) << ""; + LOG(info) << "[TrackTuner::getPathInputFileAutomaticFromCCDB]: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"; + LOG(info) << "[TrackTuner::getPathInputFileAutomaticFromCCDB]: +++ TrackTuner configuration +++"; + LOG(info) << "[TrackTuner::getPathInputFileAutomaticFromCCDB]: +++ Autodetect mode activated for the DCA calibration files +++"; + LOG(info) << "[TrackTuner::getPathInputFileAutomaticFromCCDB]: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"; + LOG(info) << "[TrackTuner::getPathInputFileAutomaticFromCCDB]: +++ The DCA calibration files are picked-up from CCDB based on the analysed run number +++"; + LOG(info) << "[TrackTuner::getPathInputFileAutomaticFromCCDB]: +++ NB: only the number of the first analysed run is considered to configure the TrackTuner object +++"; + LOG(info) << "[TrackTuner::getPathInputFileAutomaticFromCCDB]: +++ +++"; + LOG(info) << "[TrackTuner::getPathInputFileAutomaticFromCCDB]: +++ Supported cases: +++"; + LOG(info) << "[TrackTuner::getPathInputFileAutomaticFromCCDB]: +++ [CASE 1]: pp, 13.6 TeV 2022, 2023: CCDB path Users/m/mfaggin/test/inputsTrackTuner/pp2023/pass4/vsPhi +++"; + LOG(info) << "[TrackTuner::getPathInputFileAutomaticFromCCDB]: +++ Run list: (520259 (LHC22f) <= runNumber <= 529691 (LHC22t)) || (534998 (LHC23zc) <= runNumber <= 543113 (LHC23zw)) +++"; + LOG(info) << "[TrackTuner::getPathInputFileAutomaticFromCCDB]: +++ +++"; + LOG(info) << "[TrackTuner::getPathInputFileAutomaticFromCCDB]: +++ [CASE 2]: Pb-Pb, 5.34 TeV 2022, 2023, 2024: CCDB path Users/m/mfaggin/test/inputsTrackTuner/PbPb2023/apass4/vsPhi +++"; + LOG(info) << "[TrackTuner::getPathInputFileAutomaticFromCCDB]: +++ Run list: (529397 <= runNumber <= 529418 (LHC22o)) || (543437 (LHC23zx) <= runNumber <= 545367 (LHC23zzo)) +++"; + LOG(info) << "[TrackTuner::getPathInputFileAutomaticFromCCDB]: +++ +++"; + LOG(info) << "[TrackTuner::getPathInputFileAutomaticFromCCDB]: +++ [CASE 3]: pp, 13.6 TeV 2024: CCDB path Users/m/mfaggin/test/inputsTrackTuner/pp2024/pass1_minBias/vsPhi +++"; + LOG(info) << "[TrackTuner::getPathInputFileAutomaticFromCCDB]: +++ Run list: 549559 (LHC24ac) <= runNumber && runNumber <= 558807 (LHC24ao) +++"; + LOG(info) << "[TrackTuner::getPathInputFileAutomaticFromCCDB]: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"; + LOG(info) << ""; + + LOG(info) << "[TrackTuner::getPathInputFileAutomaticFromCCDB]: current run number = " << runNumber; + + if ((520259 <= runNumber && runNumber <= 529691) || (534998 <= runNumber && runNumber <= 543113)) { + /// + /// [CASE 1]: pp, 13.6 TeV 2022, 2023: CCDB path Users/m/mfaggin/test/inputsTrackTuner/pp2023/pass4/vsPhi + /// Run list: (520259 (LHC22f) <= runNumber <= 529691 (LHC22t)) || (534998 (LHC23zc) <= runNumber <= 543113 (LHC23zw)) + /// + pathInputFile = "Users/m/mfaggin/test/inputsTrackTuner/pp2023/pass4/vsPhi"; + LOG(info) << "[TrackTuner::getPathInputFileAutomaticFromCCDB]: >>> pp, 13.6 TeV 2022, 2023: CCDB path " << pathInputFile; + LOG(info) << " >>> Run list: (520259 (LHC22f) <= runNumber <= 529691 (LHC22t)) || (534998 (LHC23zc) <= runNumber <= 543113 (LHC23zw))"; + } else if ((529397 <= runNumber && runNumber <= 529418) || (543437 <= runNumber && runNumber <= 545367)) { + /// + /// [CASE 2]: Pb-Pb, 5.34 TeV 2022, 2023, 2024: CCDB path Users/m/mfaggin/test/inputsTrackTuner/PbPb2023/apass4/vsPhi + /// Run list: (529397 <= runNumber <= 529418 (LHC22o)) || (543437 (LHC23zx) <= runNumber <= 545367 (LHC23zzo)) + /// + pathInputFile = "Users/m/mfaggin/test/inputsTrackTuner/PbPb2023/apass4/vsPhi"; + LOG(info) << "[TrackTuner::getPathInputFileAutomaticFromCCDB]: >>> Pb-Pb, 5.34 TeV 2022, 2023, 2024: CCDB path " << pathInputFile; + LOG(info) << " >>> Run list: (529397 <= runNumber <= 529418 (LHC22o)) || (543437 (LHC23zx) <= runNumber <= 545367 (LHC23zzo))"; + } else if (549559 <= runNumber && runNumber <= 558807) { + /// + /// [CASE 3]: pp, 13.6 TeV 2024: CCDB path Users/m/mfaggin/test/inputsTrackTuner/pp2024/pass1_minBias/vsPhi + /// Run list: 549559 (LHC24ac) <= runNumber && runNumber <= 558807 (LHC24ao) + /// + pathInputFile = "Users/m/mfaggin/test/inputsTrackTuner/pp2024/pass1_minBias/vsPhi"; + LOG(info) << "[TrackTuner::getPathInputFileAutomaticFromCCDB]: >>> pp, 13.6 TeV 2024: CCDB path " << pathInputFile; + LOG(info) << " >>> Run list: 549559 (LHC24ac) <= runNumber && runNumber <= 558807 (LHC24ao)"; + } else { + LOG(fatal) << "runNumber " << runNumber << " not supported for the autodetection. Please switch to manual configuration of the TrackTuner object. Aborting..."; + } + + outputString += ", pathInputFile=" + pathInputFile; + } + /// @brief Function to configure the TrackTuner parameters with an input string /// @param inputString Input string with all parameter configuration. Format: =|= /// @return String with the values of all parameters after configurations are listed, to cross check that everything worked well @@ -191,6 +278,7 @@ struct TrackTuner : o2::framework::ConfigurableGroup { QOverPtMC, QOverPtData, NPhiBins, + AutoDetectDcaCalib, NPars }; std::map mapParNames = { std::make_pair(DebugInfo, "debugInfo"), @@ -207,7 +295,8 @@ struct TrackTuner : o2::framework::ConfigurableGroup { std::make_pair(UsePvRefitCorrections, "usePvRefitCorrections"), std::make_pair(QOverPtMC, "qOverPtMC"), std::make_pair(QOverPtData, "qOverPtData"), - std::make_pair(NPhiBins, "nPhiBins")}; + std::make_pair(NPhiBins, "nPhiBins"), + std::make_pair(AutoDetectDcaCalib, "autoDetectDcaCalib")}; /////////////////////////////////////////////////////////////////////////////////// LOG(info) << "[TrackTuner]"; LOG(info) << "[TrackTuner] >>> Parameters before the custom settings"; @@ -226,6 +315,7 @@ struct TrackTuner : o2::framework::ConfigurableGroup { LOG(info) << "[TrackTuner] qOverPtMC = " << qOverPtMC; LOG(info) << "[TrackTuner] qOverPtData = " << qOverPtData; LOG(info) << "[TrackTuner] nPhiBins = " << nPhiBins; + LOG(info) << "[TrackTuner] autoDetectDcaCalib = " << autoDetectDcaCalib; // ############################################################################################## // ######## split the original string, separating substrings delimited by "|" symbol ######## @@ -280,13 +370,16 @@ struct TrackTuner : o2::framework::ConfigurableGroup { } }; - std::string outputString = ""; LOG(info) << "[TrackTuner] "; LOG(info) << "[TrackTuner] >>> Parameters after the custom settings"; + // Configure autoDetectDcaCalib + setBoolFromString(autoDetectDcaCalib, getValueString(AutoDetectDcaCalib)); + outputString += "autoDetectDcaCalib=" + std::to_string(autoDetectDcaCalib); + LOG(info) << "[TrackTuner] autoDetectDcaCalib = " << autoDetectDcaCalib; // Configure debugInfo setBoolFromString(debugInfo, getValueString(DebugInfo)); LOG(info) << "[TrackTuner] debugInfo = " << debugInfo; - outputString += "debugInfo=" + std::to_string(debugInfo); + outputString += ", debugInfo=" + std::to_string(debugInfo); // Configure updateTrackDCAs setBoolFromString(updateTrackDCAs, getValueString(UpdateTrackDCAs)); LOG(info) << "[TrackTuner] updateTrackDCAs = " << updateTrackDCAs; @@ -312,10 +405,6 @@ struct TrackTuner : o2::framework::ConfigurableGroup { LOG(info) << "[TrackTuner] isInputFileFromCCDB = " << isInputFileFromCCDB; outputString += ", isInputFileFromCCDB=" + std::to_string(isInputFileFromCCDB); // Configure pathInputFile - pathInputFile = getValueString(PathInputFile); - outputString += ", pathInputFile=" + pathInputFile; - LOG(info) << "[TrackTuner] pathInputFile = " << pathInputFile; - // Configure pathInputFile pathFileQoverPt = getValueString(PathFileQoverPt); outputString += ", pathFileQoverPt=" + pathFileQoverPt; LOG(info) << "[TrackTuner] pathFileQoverPt = " << pathFileQoverPt; @@ -345,6 +434,15 @@ struct TrackTuner : o2::framework::ConfigurableGroup { if (nPhiBins < 0) LOG(fatal) << "[TrackTuner] negative nPhiBins!" << nPhiBins; LOG(info) << "[TrackTuner] nPhiBins = " << nPhiBins; + // Configure pathInputFile + if (!autoDetectDcaCalib) { + // path input file from the input string + pathInputFile = getValueString(PathInputFile); + outputString += ", pathInputFile=" + pathInputFile; + LOG(info) << "[TrackTuner] pathInputFile = " << pathInputFile; + } else { + LOG(info) << "[TrackTuner] pathInputFile still invalid for the moment --> it will be updated by the \"auto-detect\""; + } /// declare that the configuration is done via an input string isConfigFromString = true; @@ -365,13 +463,16 @@ struct TrackTuner : o2::framework::ConfigurableGroup { LOG(info) << "[TrackTuner] /=/#/ /=/#/"; LOG(info) << "[TrackTuner] /=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/=/#/"; - std::string outputString = ""; LOG(info) << "[TrackTuner] "; LOG(info) << "[TrackTuner] >>> Parameters after the custom settings"; + // Configure autoDetectDcaCalib + autoDetectDcaCalib = cfgAutoDetectDcaCalib; + outputString += "autoDetectDcaCalib=" + std::to_string(autoDetectDcaCalib); + LOG(info) << "[TrackTuner] autoDetectDcaCalib = " << autoDetectDcaCalib; // Configure debugInfo debugInfo = cfgDebugInfo; LOG(info) << "[TrackTuner] debugInfo = " << debugInfo; - outputString += "debugInfo=" + std::to_string(debugInfo); + outputString += ", debugInfo=" + std::to_string(debugInfo); // Configure updateTrackDCAs updateTrackDCAs = cfgUpdateTrackDCAs; LOG(info) << "[TrackTuner] updateTrackDCAs = " << updateTrackDCAs; @@ -396,11 +497,7 @@ struct TrackTuner : o2::framework::ConfigurableGroup { isInputFileFromCCDB = cfgIsInputFileFromCCDB; LOG(info) << "[TrackTuner] isInputFileFromCCDB = " << isInputFileFromCCDB; outputString += ", isInputFileFromCCDB=" + std::to_string(isInputFileFromCCDB); - // Configure pathInputFile - pathInputFile = cfgPathInputFile; - outputString += ", pathInputFile=" + pathInputFile; - LOG(info) << "[TrackTuner] pathInputFile = " << pathInputFile; - // Configure pathInputFile + // Configure pathQoverPt pathFileQoverPt = cfgPathFileQoverPt; outputString += ", pathFileQoverPt=" + pathFileQoverPt; LOG(info) << "[TrackTuner] pathFileQoverPt = " << pathFileQoverPt; @@ -430,6 +527,15 @@ struct TrackTuner : o2::framework::ConfigurableGroup { if (nPhiBins < 0) LOG(fatal) << "[TrackTuner] negative nPhiBins!" << nPhiBins; LOG(info) << "[TrackTuner] nPhiBins = " << nPhiBins; + // Configure pathInputFile + if (!autoDetectDcaCalib) { + // path input file from configurable + pathInputFile = cfgPathInputFile; + outputString += ", pathInputFile=" + pathInputFile; + LOG(info) << "[TrackTuner] pathInputFile = " << pathInputFile; + } else { + LOG(info) << "[TrackTuner] pathInputFile still invalid for the moment --> it will be updated by the \"auto-detect\""; + } /// declare that the configuration is done via the Configurables isConfigFromConfigurables = true; @@ -442,6 +548,11 @@ struct TrackTuner : o2::framework::ConfigurableGroup { void getDcaGraphs() { + /// abort if the graphs were already loaded + if (areGraphsConfigured) { + LOG(fatal) << "[TrackTuner::getDcaGraphs()] Function already called, i.e. the calibrations are already loaded. This further call should never happen. Aborting..."; + } + std::string fullNameInputFile = pathInputFile + std::string("/") + nameInputFile; std::string fullNameFileQoverPt = pathFileQoverPt + std::string("/") + nameFileQoverPt; TList* ccdb_object_dca = nullptr; @@ -455,12 +566,12 @@ struct TrackTuner : o2::framework::ConfigurableGroup { // get the TList from the DCA correction file present in CCDB ccdb_object_dca = o2::ccdb::BasicCCDBManager::instance().get(pathInputFile); - LOG(info) << " [TrackTuner] ccdb_object_dca " << ccdb_object_dca; + LOG(info) << "[TrackTuner] ccdb_object_dca " << ccdb_object_dca; // get the TList from the Q/Pt correction file from CCDB if (updateCurvature || updateCurvatureIU) { ccdb_object_qoverpt = o2::ccdb::BasicCCDBManager::instance().get(pathFileQoverPt); - LOG(info) << " [TrackTuner] ccdb_object_qoverpt " << ccdb_object_qoverpt; + LOG(info) << "[TrackTuner] ccdb_object_qoverpt " << ccdb_object_qoverpt; } } else { /// use input correction file from local filesystem @@ -562,11 +673,20 @@ struct TrackTuner : o2::framework::ConfigurableGroup { grOneOverPtPionMC.reset(dynamic_cast(ccdb_object_qoverpt->FindObject(grOneOverPtPionNameMC.c_str()))); grOneOverPtPionData.reset(dynamic_cast(ccdb_object_qoverpt->FindObject(grOneOverPtPionNameData.c_str()))); } + + /// if we arrive here, it means that the graphs are all set + areGraphsConfigured = true; + } // getDcaGraphs() ends here template void tuneTrackParams(T1 const& mcparticle, T2& trackParCov, T3 const& matCorr, T4 dcaInfoCov, H hQA) { + /// abort if the calibrations are not loaded + if (!areGraphsConfigured) { + LOG(fatal) << "[TrackTuner::tuneTrackParams()] Function called, but calibration graphs not configured. Have you called the function TrackTuner::getDcaGraphs()? Aborting..."; + } + double ptMC = mcparticle.pt(); double dcaXYResMC = 0.0; // sd0rpo=0.; double dcaZResMC = 0.0; // sd0zo =0.; From fb69ea723085ac35cf72d42ab7d9609d7914a1e8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 30 Oct 2025 04:23:51 +0100 Subject: [PATCH 948/986] [Infrastructure] Bump oxsecurity/megalinter from 9.0.1 to 9.1.0 (#13362) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/mega-linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mega-linter.yml b/.github/workflows/mega-linter.yml index 5f597e243cb..e3859042a61 100644 --- a/.github/workflows/mega-linter.yml +++ b/.github/workflows/mega-linter.yml @@ -38,7 +38,7 @@ jobs: id: ml # You can override MegaLinter flavor used to have faster performances # More info at https://megalinter.io/flavors/ - uses: oxsecurity/megalinter@v9.0.1 + uses: oxsecurity/megalinter@v9.1.0 env: # All available variables are described in documentation: # https://megalinter.io/configuration/ From edd51f0963d9b1676f109bd78468f2948f14ab71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= <26327373+vkucera@users.noreply.github.com> Date: Thu, 30 Oct 2025 04:24:33 +0100 Subject: [PATCH 949/986] [Common] TrackSelectorPID: Add PDG_t prefix (#13526) --- Common/Core/TrackSelectorPID.h | 68 +++++++++++++++++----------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/Common/Core/TrackSelectorPID.h b/Common/Core/TrackSelectorPID.h index da5ed2f6732..e8ceaa4fa07 100644 --- a/Common/Core/TrackSelectorPID.h +++ b/Common/Core/TrackSelectorPID.h @@ -37,7 +37,7 @@ struct TrackSelectorPID { }; }; -template +template class TrackSelectorPidBase { public: @@ -121,15 +121,15 @@ class TrackSelectorPidBase // Get nσ for a given particle hypothesis. double nSigma = 100.; - if constexpr (pdg == kElectron) { + if constexpr (pdg == PDG_t::kElectron) { nSigma = track.tpcNSigmaEl(); - } else if constexpr (pdg == kMuonMinus) { + } else if constexpr (pdg == PDG_t::kMuonMinus) { nSigma = track.tpcNSigmaMu(); - } else if constexpr (pdg == kPiPlus) { + } else if constexpr (pdg == PDG_t::kPiPlus) { nSigma = track.tpcNSigmaPi(); - } else if constexpr (pdg == kKPlus) { + } else if constexpr (pdg == PDG_t::kKPlus) { nSigma = track.tpcNSigmaKa(); - } else if constexpr (pdg == kProton) { + } else if constexpr (pdg == PDG_t::kProton) { nSigma = track.tpcNSigmaPr(); } else if constexpr (pdg == o2::constants::physics::Pdg::kDeuteron) { nSigma = track.tpcNSigmaDe(); @@ -217,15 +217,15 @@ class TrackSelectorPidBase // Get nσ for a given particle hypothesis. double nSigma = 100.; - if constexpr (pdg == kElectron) { + if constexpr (pdg == PDG_t::kElectron) { nSigma = track.tofNSigmaEl(); - } else if constexpr (pdg == kMuonMinus) { + } else if constexpr (pdg == PDG_t::kMuonMinus) { nSigma = track.tofNSigmaMu(); - } else if constexpr (pdg == kPiPlus) { + } else if constexpr (pdg == PDG_t::kPiPlus) { nSigma = track.tofNSigmaPi(); - } else if constexpr (pdg == kKPlus) { + } else if constexpr (pdg == PDG_t::kKPlus) { nSigma = track.tofNSigmaKa(); - } else if constexpr (pdg == kProton) { + } else if constexpr (pdg == PDG_t::kProton) { nSigma = track.tofNSigmaPr(); } else if constexpr (pdg == o2::constants::physics::Pdg::kDeuteron) { nSigma = track.tofNSigmaDe(); @@ -315,15 +315,15 @@ class TrackSelectorPidBase // Get nσ for a given particle hypothesis. double nSigma = 100.; - if constexpr (pdg == kElectron) { + if constexpr (pdg == PDG_t::kElectron) { nSigma = track.rich().richNsigmaEl(); - } else if constexpr (pdg == kMuonMinus) { + } else if constexpr (pdg == PDG_t::kMuonMinus) { nSigma = track.rich().richNsigmaMu(); - } else if constexpr (pdg == kPiPlus) { + } else if constexpr (pdg == PDG_t::kPiPlus) { nSigma = track.rich().richNsigmaPi(); - } else if constexpr (pdg == kKPlus) { + } else if constexpr (pdg == PDG_t::kKPlus) { nSigma = track.rich().richNsigmaKa(); - } else if constexpr (pdg == kProton) { + } else if constexpr (pdg == PDG_t::kProton) { nSigma = track.rich().richNsigmaPr(); } else { errorPdg(); @@ -364,7 +364,7 @@ class TrackSelectorPidBase template bool isValidForMid(const T& track) { - if constexpr (pdg == kMuonMinus) { + if constexpr (pdg == PDG_t::kMuonMinus) { return track.midId() > -1; } else { errorPdg(); @@ -378,7 +378,7 @@ class TrackSelectorPidBase template bool isSelectedByMid(const T& track) { - if constexpr (pdg == kMuonMinus) { + if constexpr (pdg == PDG_t::kMuonMinus) { return track.mid().midIsMuon() == 1; // FIXME: change to return track.midIsMuon() once the column is bool. } else { errorPdg(); @@ -392,7 +392,7 @@ class TrackSelectorPidBase template TrackSelectorPID::Status statusMid(const T& track) { - if constexpr (pdg == kMuonMinus) { + if constexpr (pdg == PDG_t::kMuonMinus) { if (!isValidForMid(track)) { return TrackSelectorPID::NotApplicable; } @@ -555,15 +555,15 @@ class TrackSelectorPidBase bool isSelectedByBayes(const T& track) { // Get index of the most probable species for a given track. - if constexpr (pdg == kElectron) { + if constexpr (pdg == PDG_t::kElectron) { return track.bayesID() == o2::track::PID::Electron; - } else if constexpr (pdg == kMuonMinus) { + } else if constexpr (pdg == PDG_t::kMuonMinus) { return track.bayesID() == o2::track::PID::Muon; - } else if constexpr (pdg == kPiPlus) { + } else if constexpr (pdg == PDG_t::kPiPlus) { return track.bayesID() == o2::track::PID::Pion; - } else if constexpr (pdg == kKPlus) { + } else if constexpr (pdg == PDG_t::kKPlus) { return track.bayesID() == o2::track::PID::Kaon; - } else if constexpr (pdg == kProton) { + } else if constexpr (pdg == PDG_t::kProton) { return track.bayesID() == o2::track::PID::Proton; } else if constexpr (pdg == o2::constants::physics::Pdg::kDeuteron) { return track.bayesID() == o2::track::PID::Deuteron; @@ -585,15 +585,15 @@ class TrackSelectorPidBase // Get probability for a given particle hypothesis. double prob = 0.; - if constexpr (pdg == kElectron) { + if constexpr (pdg == PDG_t::kElectron) { prob = track.bayesEl(); - } else if constexpr (pdg == kMuonMinus) { + } else if constexpr (pdg == PDG_t::kMuonMinus) { prob = track.bayesMu(); - } else if constexpr (pdg == kPiPlus) { + } else if constexpr (pdg == PDG_t::kPiPlus) { prob = track.bayesPi(); - } else if constexpr (pdg == kKPlus) { + } else if constexpr (pdg == PDG_t::kKPlus) { prob = track.bayesKa(); - } else if constexpr (pdg == kProton) { + } else if constexpr (pdg == PDG_t::kProton) { prob = track.bayesPr(); } else if constexpr (pdg == o2::constants::physics::Pdg::kDeuteron) { prob = track.bayesDe(); @@ -674,11 +674,11 @@ class TrackSelectorPidBase }; // Predefined types -using TrackSelectorEl = TrackSelectorPidBase; // El -using TrackSelectorMu = TrackSelectorPidBase; // Mu -using TrackSelectorPi = TrackSelectorPidBase; // Pi -using TrackSelectorKa = TrackSelectorPidBase; // Ka -using TrackSelectorPr = TrackSelectorPidBase; // Pr +using TrackSelectorEl = TrackSelectorPidBase; // El +using TrackSelectorMu = TrackSelectorPidBase; // Mu +using TrackSelectorPi = TrackSelectorPidBase; // Pi +using TrackSelectorKa = TrackSelectorPidBase; // Ka +using TrackSelectorPr = TrackSelectorPidBase; // Pr using TrackSelectorDe = TrackSelectorPidBase; // De #endif // COMMON_CORE_TRACKSELECTORPID_H_ From 28d7509460143e3867a031519c292bd4592579af Mon Sep 17 00:00:00 2001 From: nzardosh Date: Thu, 30 Oct 2025 08:01:06 +0100 Subject: [PATCH 950/986] fixing but in mcp eventwise subtracted jet finding (#13595) --- PWGJE/JetFinders/jetFinder.cxx | 3 ++- PWGJE/JetFinders/jetFinderHF.cxx | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/PWGJE/JetFinders/jetFinder.cxx b/PWGJE/JetFinders/jetFinder.cxx index f30b2f33ff7..43670879a30 100644 --- a/PWGJE/JetFinders/jetFinder.cxx +++ b/PWGJE/JetFinders/jetFinder.cxx @@ -163,6 +163,7 @@ struct JetFinderTask { registry.add("hJet", "sparse for data or mcd jets", {HistType::kTHnD, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); registry.add("hJetEWS", "sparse for data or mcd event-wise subtracted jets", {HistType::kTHnD, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); registry.add("hJetMCP", "sparse for mcp jets", {HistType::kTHnD, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); + registry.add("hJetEWSMCP", "sparse for mcp event-wise subtracted jets", {HistType::kTHnD, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); } if (applyTrackingEfficiency) { @@ -248,7 +249,7 @@ struct JetFinderTask { // TODO: MC event selection? inputParticles.clear(); jetfindingutilities::analyseParticles, soa::Filtered::iterator>(inputParticles, particleSelection, 1, particles, pdgDatabase); - jetfindingutilities::findJets(jetFinder, inputParticles, jetPtMin, jetPtMax, jetRadius, jetAreaFractionMin, collision, jetsTable, constituentsTable, fillTHnSparse ? registry.get(HIST("hJetMCP")) : std::shared_ptr(nullptr), fillTHnSparse); + jetfindingutilities::findJets(jetFinder, inputParticles, jetEWSPtMin, jetEWSPtMax, jetRadius, jetAreaFractionMin, collision, jetsEvtWiseSubTable, constituentsEvtWiseSubTable, fillTHnSparse ? registry.get(HIST("hJetEWSMCP")) : std::shared_ptr(nullptr), fillTHnSparse); } PROCESS_SWITCH(JetFinderTask, processParticleLevelChargedEvtWiseSubJets, "Particle level charged with event-wise constituent subtraction jet finding", false); diff --git a/PWGJE/JetFinders/jetFinderHF.cxx b/PWGJE/JetFinders/jetFinderHF.cxx index 7bf72f2a6ce..2cc269d33cc 100644 --- a/PWGJE/JetFinders/jetFinderHF.cxx +++ b/PWGJE/JetFinders/jetFinderHF.cxx @@ -235,8 +235,8 @@ struct JetFinderHFTask { } // function that generalically processes gen level events - template - void analyseMCP(T const& collision, U const& particles, V const& candidate, int jetTypeParticleLevel, float minJetPt, float maxJetPt) + template + void analyseMCP(T const& collision, U const& particles, V const& candidate, M& jetsTableInput, N& constituentsTableInput, int jetTypeParticleLevel, float minJetPt, float maxJetPt) { if (rejectIncorrectDecaysMCP && !jetcandidateutilities::isMatchedCandidate(candidate)) { // is this even needed in the new derived format? it means any simulations run have to force the decay channel return; @@ -246,12 +246,12 @@ struct JetFinderHFTask { if (!jetfindingutilities::analyseCandidate(inputParticles, candidate, candPtMin, candPtMax, candYMin, candYMax)) { return; } - if constexpr (checkIsDaughter) { + if constexpr (!isEvtWiseSub) { jetfindingutilities::analyseParticles(inputParticles, particleSelection, jetTypeParticleLevel, particles, pdgDatabase, &candidate); } else { jetfindingutilities::analyseParticles(inputParticles, particleSelection, jetTypeParticleLevel, particles, pdgDatabase, &candidate); } - jetfindingutilities::findJets(jetFinder, inputParticles, minJetPt, maxJetPt, jetRadius, jetAreaFractionMin, collision, jetsTable, constituentsTable, registry.get(HIST("hJetMCP")), fillTHnSparse, true); + jetfindingutilities::findJets(jetFinder, inputParticles, minJetPt, maxJetPt, jetRadius, jetAreaFractionMin, collision, jetsTableInput, constituentsTableInput, registry.get(HIST("hJetMCP")), fillTHnSparse, true); } void processDummy(aod::JetCollisions const&) @@ -296,7 +296,7 @@ struct JetFinderHFTask { CandidateTableMCP const& candidates) { for (typename CandidateTableMCP::iterator const& candidate : candidates) { - analyseMCP(collision, particles, candidate, 1, jetPtMin, jetPtMax); + analyseMCP(collision, particles, candidate, jetsTable, constituentsTable, 1, jetPtMin, jetPtMax); } } PROCESS_SWITCH(JetFinderHFTask, processChargedJetsMCP, "hf jet finding on MC particle level", false); @@ -306,7 +306,7 @@ struct JetFinderHFTask { CandidateTableMCP const& candidates) { for (typename CandidateTableMCP::iterator const& candidate : candidates) { - analyseMCP(collision, jetcandidateutilities::slicedPerCandidate(particles, candidate, perD0McCandidate, perDplusMcCandidate, perDsMcCandidate, perDstarMcCandidate, perLcMcCandidate, perB0McCandidate, perBplusMcCandidate, perXicToXiPiPiMcCandidate, perDielectronMcCandidate), candidate, 1, jetPtMin, jetPtMax); + analyseMCP(collision, jetcandidateutilities::slicedPerCandidate(particles, candidate, perD0McCandidate, perDplusMcCandidate, perDsMcCandidate, perDstarMcCandidate, perLcMcCandidate, perB0McCandidate, perBplusMcCandidate, perXicToXiPiPiMcCandidate, perDielectronMcCandidate), candidate, jetsEvtWiseSubTable, constituentsEvtWiseSubTable, 1, jetPtMin, jetPtMax); } } PROCESS_SWITCH(JetFinderHFTask, processChargedEvtWiseSubJetsMCP, "hf jet finding on MC particle level", false); From 3d17d5c98c633669eff406641e842fc3d9d1b77e Mon Sep 17 00:00:00 2001 From: Marcello Di Costanzo <96481191+Marcellocosti@users.noreply.github.com> Date: Thu, 30 Oct 2025 08:33:25 +0100 Subject: [PATCH 951/986] [Common] Add protection to TPC tune on data for filtered MC productions (#13592) --- Common/Tools/PID/pidTPCModule.h | 55 ++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/Common/Tools/PID/pidTPCModule.h b/Common/Tools/PID/pidTPCModule.h index 1c6a35048f7..690e87b079c 100644 --- a/Common/Tools/PID/pidTPCModule.h +++ b/Common/Tools/PID/pidTPCModule.h @@ -810,39 +810,44 @@ class pidTPCModule // if this is a MC process function, go for MC tune on data processing if constexpr (requires { trk.mcParticleId(); }) { // Perform TuneOnData sampling for MC dE/dx - float mcTunedTPCSignal = 0.; - if (!trk.hasTPC()) { - mcTunedTPCSignal = -999.f; + if (!trk.has_mcParticle()) { + products.tableTuneOnData(-999.f); + tpcSignalToEvaluatePID = -999.f; // pass this for further eval } else { - if (pidTPCopts.skipTPCOnly) { - if (!trk.hasITS() && !trk.hasTRD() && !trk.hasTOF()) { - mcTunedTPCSignal = -999.f; - } - } - int pid = getPIDIndex(trk.mcParticle().pdgCode()); - - auto expSignal = response->GetExpectedSignal(trk, pid); - auto expSigma = response->GetExpectedSigmaAtMultiplicity(multTPC, trk, pid); - if (expSignal < 0. || expSigma < 0.) { // if expectation invalid then give undefined signal + float mcTunedTPCSignal = 0.; + if (!trk.hasTPC()) { mcTunedTPCSignal = -999.f; - } - float bg = trk.tpcInnerParam() / o2::track::pid_constants::sMasses[pid]; // estimated beta-gamma for network cutoff + } else { + if (pidTPCopts.skipTPCOnly) { + if (!trk.hasITS() && !trk.hasTRD() && !trk.hasTOF()) { + mcTunedTPCSignal = -999.f; + } + } + int pid = getPIDIndex(trk.mcParticle().pdgCode()); - if (pidTPCopts.useNetworkCorrection && speciesNetworkFlags[pid] && trk.has_collision() && bg > pidTPCopts.networkBetaGammaCutoff) { - auto mean = network_prediction[2 * (count_tracks + tracksForNet_size * pid)] * expSignal; // Absolute mean, i.e. the mean dE/dx value of the data in that slice, not the mean of the NSigma distribution - auto sigma = (network_prediction[2 * (count_tracks + tracksForNet_size * pid) + 1] - network_prediction[2 * (count_tracks + tracksForNet_size * pid)]) * expSignal; - if (mean < 0.f || sigma < 0.f) { + auto expSignal = response->GetExpectedSignal(trk, pid); + auto expSigma = response->GetExpectedSigmaAtMultiplicity(multTPC, trk, pid); + if (expSignal < 0. || expSigma < 0.) { // if expectation invalid then give undefined signal mcTunedTPCSignal = -999.f; + } + float bg = trk.tpcInnerParam() / o2::track::pid_constants::sMasses[pid]; // estimated beta-gamma for network cutoff + + if (pidTPCopts.useNetworkCorrection && speciesNetworkFlags[pid] && trk.has_collision() && bg > pidTPCopts.networkBetaGammaCutoff) { + auto mean = network_prediction[2 * (count_tracks + tracksForNet_size * pid)] * expSignal; // Absolute mean, i.e. the mean dE/dx value of the data in that slice, not the mean of the NSigma distribution + auto sigma = (network_prediction[2 * (count_tracks + tracksForNet_size * pid) + 1] - network_prediction[2 * (count_tracks + tracksForNet_size * pid)]) * expSignal; + if (mean < 0.f || sigma < 0.f) { + mcTunedTPCSignal = -999.f; + } else { + mcTunedTPCSignal = gRandom->Gaus(mean, sigma); + } } else { - mcTunedTPCSignal = gRandom->Gaus(mean, sigma); + mcTunedTPCSignal = gRandom->Gaus(expSignal, expSigma); } - } else { - mcTunedTPCSignal = gRandom->Gaus(expSignal, expSigma); } + tpcSignalToEvaluatePID = mcTunedTPCSignal; // pass this for further eval + if (pidTPCopts.enableTuneOnDataTable) + products.tableTuneOnData(mcTunedTPCSignal); } - tpcSignalToEvaluatePID = mcTunedTPCSignal; // pass this for further eval - if (pidTPCopts.enableTuneOnDataTable) - products.tableTuneOnData(mcTunedTPCSignal); } auto makePidTablesDefault = [&trk, &tpcSignalToEvaluatePID, &multTPC, &network_prediction, &count_tracks, &tracksForNet_size, this](const int flagFull, auto& tableFull, const int flagTiny, auto& tableTiny, const o2::track::PID::ID pid) { From ed5acbd0709043de069bf0d60ef6f4a95273e87c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Mart=C3=ADnez=20Garc=C3=ADa?= Date: Thu, 30 Oct 2025 02:24:35 -0600 Subject: [PATCH 952/986] [PWGUD] Adding new histos for angular correlation studies (#13596) --- PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx | 162 +++++++++------------ 1 file changed, 72 insertions(+), 90 deletions(-) diff --git a/PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx b/PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx index 14852ce36c6..cf170a30465 100644 --- a/PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx +++ b/PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx @@ -104,6 +104,16 @@ struct UpcPhotonuclearAnalysisJMG { HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; // Declare configurables on events/collisions + Configurable minMultiplicity{"minMultiplicity", 2, {"Range on multiplicity"}}; + Configurable range1Max{"range1Max", 10, {"Range on multiplicity"}}; + Configurable range2Min{"range2Min", 11, {"Range on multiplicity"}}; + Configurable range2Max{"range2Max", 20, {"Range on multiplicity"}}; + Configurable range3Min{"range3Min", 21, {"Range on multiplicity"}}; + Configurable range3Max{"range3Max", 30, {"Range on multiplicity"}}; + Configurable range4Min{"range4Min", 31, {"Range on multiplicity"}}; + Configurable range4Max{"range4Max", 40, {"Range on multiplicity"}}; + Configurable range5Min{"range5Min", 41, {"Range on multiplicity"}}; + Configurable range5Max{"range5Max", 50, {"Range on multiplicity"}}; Configurable nEventsMixed{"nEventsMixed", 3, {"Events to be Mixed"}}; Configurable factorEventsMixed{"factorEventsMixed", 100, {"factorEventsMixed to events mixed"}}; Configurable myZVtxCut{"myZVtxCut", 10., {"My collision cut"}}; @@ -149,7 +159,7 @@ struct UpcPhotonuclearAnalysisJMG { "Pair cuts on various particles"}; Configurable cfgTwoTrackCut{"cfgTwoTrackCut", -1, {"Two track cut"}}; ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for histograms"}; - ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -PIHalf, kThreeHalfPi}, "delta phi axis for histograms"}; + ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {32, -PIHalf, kThreeHalfPi}, "delta phi axis for histograms"}; ConfigurableAxis axisDeltaEta{"axisDeltaEta", {32, -1.6, 1.6}, "delta eta axis for histograms"}; ConfigurableAxis axisPtTrigger{"axisPtTrigger", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 10.0}, "pt trigger axis for histograms"}; ConfigurableAxis axisPtAssoc{"axisPtAssoc", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0}, "pt associated axis for histograms"}; @@ -198,7 +208,18 @@ struct UpcPhotonuclearAnalysisJMG { histos.add("yields", "multiplicity vs pT vs eta", {HistType::kTH3F, {{100, 0, 100, "multiplicity"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}}); histos.add("etaphi", "multiplicity vs eta vs phi", {HistType::kTH3F, {{100, 0, 100, "multiplicity"}, {100, -2, 2, "#eta"}, {64, 0., TwoPI, "#varphi"}}}); histos.add("etaphiVtx", "vertex Z vs eta vs phi", {HistType::kTH3F, {{20, -10., 10., "vertex Z"}, {32, -0.8, 0.8, "#eta"}, {64, 0., TwoPI, "#varphi"}}}); - histos.add("weightNUA", "weight per bin", {HistType::kTH3F, {{20, -10., 10., "vertex Z"}, {32, -0.8, 0.8, "#eta"}, {64, 0., TwoPI, "#varphi"}}}); + histos.add("sameEvent2D", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}}); + histos.add("sameEvent_2_10", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}}); + histos.add("sameEvent_11_20", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}}); + histos.add("sameEvent_21_30", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}}); + histos.add("sameEvent_31_40", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}}); + histos.add("sameEvent_41_50", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}}); + histos.add("mixedEvent2D", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}}); + histos.add("mixedEvent_2_10", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}}); + histos.add("mixedEvent_11_20", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}}); + histos.add("mixedEvent_21_30", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}}); + histos.add("mixedEvent_31_40", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}}); + histos.add("mixedEvent_41_50", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}}); const int maxMixBin = axisMultiplicity->size() * axisVertex->size(); histos.add("eventcount", "bin", {HistType::kTH1F, {{maxMixBin + 2, -2.5, -0.5 + maxMixBin, "bin"}}}); @@ -215,8 +236,6 @@ struct UpcPhotonuclearAnalysisJMG { histos.add("Events/hCountCollisions", "0 total - 1 side A - 2 side C - 3 both side; Number of analysed collision; counts", kTH1F, {axisCollision}); histos.add("Events/hCountCollisionsMixed", "0 total - 1 side A - 2 side C - 3 both side; Number of analysed collision; counts", kTH1F, {axisCollision}); histos.add("Tracks/hTracksAfterCuts", " ; ; counts", kTH1F, {axisCountTracks}); - histos.add("Tracks/hTrackPhiBeforeCorr", "#it{#phi} distribution before NUA correction; #it{#phi}; counts", kTH1F, {axisPhi}); - histos.add("Tracks/hTrackPhiAfterCorr", "#it{#phi} distribution after NUA correction; #it{#phi}; counts", kTH1F, {axisPhi}); // histos to selection gap in side A histos.add("Tracks/SGsideA/hTrackPt", "#it{p_{T}} distribution; #it{p_{T}}; counts", kTH1F, {axisPt}); @@ -303,6 +322,11 @@ struct UpcPhotonuclearAnalysisJMG { std::vector vtxBinsEdges{VARIABLE_WIDTH, -10.0f, -7.0f, -5.0f, -2.5f, 0.0f, 2.5f, 5.0f, 7.0f, 10.0f}; std::vector gapSideBinsEdges{VARIABLE_WIDTH, -0.5, 0.5, 1.5}; + struct SameEventTag { + }; + struct MixedEventTag { + }; + SliceCache cache; // int countEvents = 0; // int countGapA = 0; @@ -431,84 +455,16 @@ struct UpcPhotonuclearAnalysisJMG { return true; } - void makeNUAWeights(std::shared_ptr histoRaw3D) - { - const int nPhi = histoRaw3D->GetZaxis()->GetNbins(); - const int nEta = histoRaw3D->GetYaxis()->GetNbins(); - const int nVz = histoRaw3D->GetXaxis()->GetNbins(); - - for (int jEtha = 1; jEtha <= nEta; ++jEtha) { - for (int iVtxZ = 1; iVtxZ <= nVz; ++iVtxZ) { - // average on phi to (eta_jEtha, vz_iVtxZ) - double sum = 0.0; - double nMax = 0.0; - int count = 0; - for (int kPhi = 1; kPhi <= nPhi; ++kPhi) { - double nEntry = histoRaw3D->GetBinContent(iVtxZ, jEtha, kPhi); - sum += nEntry; - count += 1.0; - if (nEntry > nMax) { - nMax = nEntry; - } - } - double nMean; - if (useNMax) { - nMean = nMax; - } else { - nMean = (count > 0) ? sum / count : 0.0; - } - - for (int kPhi = 1; kPhi <= nPhi; ++kPhi) { - double nEntry = histoRaw3D->GetBinContent(iVtxZ, jEtha, kPhi); - double w; - if (useEpsilon) { - if (nMean > 0) { - w = nMean / std::max(nEntry, static_cast(myEpsilonToWeight)); - } else { - w = 1.0; - } - } else { - if (nMean > 0) { - w = nMean / nEntry; - } else { - w = 1.0; - } - } - if (w < myWeightMin) - w = myWeightMin; - if (w > myWeightMax) - w = myWeightMax; - if (auto histoWeightNUA = histos.get(HIST("weightNUA"))) { - histoWeightNUA->SetBinContent(iVtxZ, jEtha, kPhi, w); - } - } - } - } - } - - float getNUAWeight(float vz, float eta, float phi) - { - auto hWeight = histos.get(HIST("weightNUA")); - phi = RecoDecay::constrainAngle(phi, 0.f); - int iPhi = hWeight->GetZaxis()->FindBin(phi); - int iEta = hWeight->GetYaxis()->FindBin(eta); - int iVz = hWeight->GetXaxis()->FindBin(vz); - return hWeight->GetBinContent(iVz, iEta, iPhi); - } - - template - void fillCorrelationsUD(TTarget target, const TTracks tracks1, const TTracks tracks2, float multiplicity, float posZ) + template + void fillCorrelationsUD(TTarget target, const TTracks& tracks1, const TTracks& tracks2, float multiplicity, float posZ, TTag) { - // multiplicity = tracks1.size(); for (const auto& track1 : tracks1) { if (isTrackCut(track1) == false) { return; } - // weight NUA for track1 float phi1 = phi(track1.px(), track1.py()); phi1 = RecoDecay::constrainAngle(phi1, 0.f); float eta1 = eta(track1.px(), track1.py(), track1.pz()); - float w1 = getNUAWeight(posZ, eta1, phi1); target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, track1.pt(), multiplicity, posZ, 1.0); for (const auto& track2 : tracks2) { if (track1 == track2) { @@ -517,13 +473,9 @@ struct UpcPhotonuclearAnalysisJMG { if (isTrackCut(track2) == false) { return; } - // weight NUA for track 2 float phi2 = phi(track2.px(), track2.py()); phi2 = RecoDecay::constrainAngle(phi2, 0.f); float eta2 = eta(track2.px(), track2.py(), track2.pz()); - float w2 = getNUAWeight(posZ, eta2, phi2); - // total weight - float wPair = w1 * w2; /*if (doPairCuts && mPairCuts.conversionCuts(track1, track2)) { continue; }*/ @@ -535,8 +487,46 @@ struct UpcPhotonuclearAnalysisJMG { track2.pt(), track1.pt(), multiplicity, deltaPhi, - posZ, - wPair); + posZ); + if constexpr (std::is_same_v) { + if (minMultiplicity <= multiplicity) { + histos.fill(HIST("sameEvent2D"), deltaEta, deltaPhi); + } + if (minMultiplicity <= multiplicity && multiplicity <= range1Max) { + histos.fill(HIST("sameEvent_2_10"), deltaEta, deltaPhi); + } + if (range2Min <= multiplicity && multiplicity <= range2Max) { + histos.fill(HIST("sameEvent_11_20"), deltaEta, deltaPhi); + } + if (range3Min <= multiplicity && multiplicity <= range3Max) { + histos.fill(HIST("sameEvent_21_30"), deltaEta, deltaPhi); + } + if (range4Min <= multiplicity && multiplicity <= range4Max) { + histos.fill(HIST("sameEvent_31_40"), deltaEta, deltaPhi); + } + if (range5Min <= multiplicity && multiplicity <= range5Max) { + histos.fill(HIST("sameEvent_41_50"), deltaEta, deltaPhi); + } + } else if constexpr (std::is_same_v) { + if (minMultiplicity <= multiplicity) { + histos.fill(HIST("mixedEvent2D"), deltaEta, deltaPhi); + } + if (minMultiplicity <= multiplicity && multiplicity <= range1Max) { + histos.fill(HIST("mixedEvent_2_10"), deltaEta, deltaPhi); + } + if (range2Min <= multiplicity && multiplicity <= range2Max) { + histos.fill(HIST("mixedEvent_11_20"), deltaEta, deltaPhi); + } + if (range3Min <= multiplicity && multiplicity <= range3Max) { + histos.fill(HIST("mixedEvent_21_30"), deltaEta, deltaPhi); + } + if (range4Min <= multiplicity && multiplicity <= range4Max) { + histos.fill(HIST("mixedEvent_31_40"), deltaEta, deltaPhi); + } + if (range5Min <= multiplicity && multiplicity <= range5Max) { + histos.fill(HIST("mixedEvent_41_50"), deltaEta, deltaPhi); + } + } } } } @@ -563,7 +553,6 @@ struct UpcPhotonuclearAnalysisJMG { } float phiVal = RecoDecay::constrainAngle(phi(track.px(), track.py()), 0.f); histos.fill(HIST("etaphiVtx"), reconstructedCollision.posZ(), eta(track.px(), track.py(), track.pz()), phiVal); - histos.fill(HIST("Tracks/hTrackPhiBeforeCorr"), phiVal); } switch (sgSide) { @@ -717,9 +706,6 @@ struct UpcPhotonuclearAnalysisJMG { // maxCountGapC = histEventCount->GetBinContent(binC) * factorEventsMixed; // } - auto histoEthaPhiVtxZ = histos.get(HIST("etaphiVtx")); - makeNUAWeights(histoEthaPhiVtxZ); - BinningType bindingOnVtx{{vtxBinsEdges, gapSideBinsEdges}, true}; // BinningType bindingOnVtx{{vtxBinsEdges}, true}; auto tracksTuple = std::make_tuple(reconstructedTracks); @@ -758,7 +744,7 @@ struct UpcPhotonuclearAnalysisJMG { histos.fill(HIST("Events/hCountCollisionsMixed"), 2); // histos.fill(HIST("eventcount"), bindingOnVtx.getBin({collision1.posZ()})); histos.fill(HIST("eventcount"), bindingOnVtx.getBin({collision1.posZ(), collision1.gapSide()})); - fillCorrelationsUD(mixed, tracks1, tracks2, multiplicity, collision1.posZ()); + fillCorrelationsUD(mixed, tracks1, tracks2, multiplicity, collision1.posZ(), MixedEventTag{}); // LOGF(info, "Filling mixed events"); // if (collision1.gapSide() == 0 && collision2.gapSide() == 0) { gap on side A @@ -909,10 +895,6 @@ struct UpcPhotonuclearAnalysisJMG { continue; } ++multiplicity; - - float weightNUA = getNUAWeight(reconstructedCollision.posZ(), eta(track.px(), track.py(), track.pz()), phi(track.px(), track.py())); - float phiVal = RecoDecay::constrainAngle(phi(track.px(), track.py()), 0.f); - histos.fill(HIST("Tracks/hTrackPhiAfterCorr"), phiVal, weightNUA); } // multiplicity = reconstructedTracks.size(); if (fillCollisionUD(same, multiplicity) == false) { @@ -921,7 +903,7 @@ struct UpcPhotonuclearAnalysisJMG { // LOGF(debug, "Filling same events"); histos.fill(HIST("eventcount"), -2); fillQAUD(reconstructedTracks, multiplicity); - fillCorrelationsUD(same, reconstructedTracks, reconstructedTracks, multiplicity, reconstructedCollision.posZ()); + fillCorrelationsUD(same, reconstructedTracks, reconstructedTracks, multiplicity, reconstructedCollision.posZ(), SameEventTag{}); /*switch (sgSide) { case 0: // gap for side A From 821538528ae3d185e3fac6533198299c2983f39e Mon Sep 17 00:00:00 2001 From: prottayCMT <61418725+prottayCMT@users.noreply.github.com> Date: Thu, 30 Oct 2025 09:44:42 +0100 Subject: [PATCH 953/986] [PWGCF] updated systematic for phi meson (#13579) --- PWGCF/DataModel/CorrelationsDerived.h | 2 ++ PWGCF/TableProducer/filter2Prong.cxx | 40 +++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/PWGCF/DataModel/CorrelationsDerived.h b/PWGCF/DataModel/CorrelationsDerived.h index 95fcc296597..b49818891f3 100644 --- a/PWGCF/DataModel/CorrelationsDerived.h +++ b/PWGCF/DataModel/CorrelationsDerived.h @@ -143,6 +143,8 @@ enum ParticleDecay { PhiToKKPID1, PhiToKKPID2, PhiToKKPID3, + PhiToKKPID3Loose, + PhiToKKPID3Tight, K0stoPiPi, LambdatoPPi, AntiLambdatoPiP, diff --git a/PWGCF/TableProducer/filter2Prong.cxx b/PWGCF/TableProducer/filter2Prong.cxx index 80f947348a4..0197160a5e1 100644 --- a/PWGCF/TableProducer/filter2Prong.cxx +++ b/PWGCF/TableProducer/filter2Prong.cxx @@ -123,6 +123,7 @@ struct Filter2Prong { } grpV0; struct : ConfigurableGroup { + O2_DEFINE_CONFIGURABLE(storeLooseTightforphi, bool, true, "Store also loose and tight phi candidates for systematics"); O2_DEFINE_CONFIGURABLE(ImMinInvMassPhiMeson, float, 0.98f, "Minimum invariant mass Phi meson (GeV)"); O2_DEFINE_CONFIGURABLE(ImMaxInvMassPhiMeson, float, 1.07f, "Maximum invariant mass Phi meson (GeV)"); O2_DEFINE_CONFIGURABLE(ITSPIDSelection, bool, true, "PID ITS"); @@ -130,9 +131,9 @@ struct Filter2Prong { O2_DEFINE_CONFIGURABLE(lowITSPIDNsigma, float, 3.0, "lower cut on PID nsigma for ITS"); O2_DEFINE_CONFIGURABLE(highITSPIDNsigma, float, 3.0, "higher cut on PID nsigma for ITS"); O2_DEFINE_CONFIGURABLE(ITSclusterPhiMeson, int, 5, "Minimum number of ITS cluster for phi meson track"); - O2_DEFINE_CONFIGURABLE(TPCCrossedRowsPhiMeson, int, 80, "Minimum number of TPC Crossed Rows for phi meson track"); - O2_DEFINE_CONFIGURABLE(cutDCAxyPhiMeson, float, 0.1, "Maximum DCAxy for phi meson track"); - O2_DEFINE_CONFIGURABLE(cutDCAzPhiMeson, float, 0.1, "Maximum DCAz for phi meson track"); + O2_DEFINE_CONFIGURABLE(TPCCrossedRowsPhiMeson, std::vector, (std::vector{70, 80, 90}), "Minimum number of TPC Crossed Rows for phi meson track (Loose, Default, Tight)"); + O2_DEFINE_CONFIGURABLE(cutDCAxyPhiMeson, std::vector, (std::vector{0.12, 0.1, 0.08}), "Maximum DCAxy for phi meson tracks (Loose, Default, Tight)"); + O2_DEFINE_CONFIGURABLE(cutDCAzPhiMeson, std::vector, (std::vector{0.12, 0.1, 0.08}), "Maximum DCAz for phi meson tracks (Loose, Default, Tight)"); O2_DEFINE_CONFIGURABLE(cutEtaPhiMeson, float, 0.8, "Maximum eta for phi meson track"); O2_DEFINE_CONFIGURABLE(cutPTPhiMeson, float, 0.15, "Maximum pt for phi meson track"); O2_DEFINE_CONFIGURABLE(isDeepAngle, bool, true, "Flag for applying deep angle"); @@ -318,7 +319,18 @@ struct Filter2Prong { template bool selectionTrack(const T& candidate) { - if (candidate.isGlobalTrack() && candidate.isPVContributor() && candidate.itsNCls() >= grpPhi.ITSclusterPhiMeson && candidate.tpcNClsCrossedRows() > grpPhi.TPCCrossedRowsPhiMeson && std::abs(candidate.dcaXY()) <= grpPhi.cutDCAxyPhiMeson && std::abs(candidate.dcaZ()) <= grpPhi.cutDCAzPhiMeson && std::abs(candidate.eta()) <= grpPhi.cutEtaPhiMeson && candidate.pt() >= grpPhi.cutPTPhiMeson) { + if (candidate.isGlobalTrack() && candidate.isPVContributor() && candidate.itsNCls() >= grpPhi.ITSclusterPhiMeson && std::abs(candidate.eta()) <= grpPhi.cutEtaPhiMeson && candidate.pt() >= grpPhi.cutPTPhiMeson) { + return true; + } + return false; + } + + template + bool selectionSys(const T& candidate, bool isLoose, bool isTight) + { + const int indexCut = isLoose ? 0 : (isTight ? 2 : 1); + + if (std::abs(candidate.dcaXY()) <= grpPhi.cutDCAxyPhiMeson.value[indexCut] && std::abs(candidate.dcaZ()) <= grpPhi.cutDCAzPhiMeson.value[indexCut] && candidate.tpcNClsCrossedRows() > grpPhi.TPCCrossedRowsPhiMeson.value[indexCut]) { return true; } return false; @@ -735,8 +747,24 @@ struct Filter2Prong { cftrack1.globalIndex(), cftrack2.globalIndex(), s.pt(), s.eta(), phi, s.M(), aod::cf2prongtrack::PhiToKKPID2); } if (selectionPID3(p1) && selectionPID3(p2)) { - output2ProngTracks(cfcollisions.begin().globalIndex(), - cftrack1.globalIndex(), cftrack2.globalIndex(), s.pt(), s.eta(), phi, s.M(), aod::cf2prongtrack::PhiToKKPID3); + if (selectionSys(p1, false, false) && selectionSys(p2, false, false)) // default + { + output2ProngTracks(cfcollisions.begin().globalIndex(), + cftrack1.globalIndex(), cftrack2.globalIndex(), s.pt(), s.eta(), phi, s.M(), aod::cf2prongtrack::PhiToKKPID3); + } + if (grpPhi.storeLooseTightforphi) // store also loose and tight K0s + { + if (selectionSys(p1, true, false) && selectionSys(p2, true, false)) // loose + { + output2ProngTracks(cfcollisions.begin().globalIndex(), + cftrack1.globalIndex(), cftrack2.globalIndex(), s.pt(), s.eta(), phi, s.M(), aod::cf2prongtrack::PhiToKKPID3Loose); + } + if (selectionSys(p1, false, true) && selectionSys(p2, false, true)) // tight + { + output2ProngTracks(cfcollisions.begin().globalIndex(), + cftrack1.globalIndex(), cftrack2.globalIndex(), s.pt(), s.eta(), phi, s.M(), aod::cf2prongtrack::PhiToKKPID3Tight); + } + } } } // end of loop over second track } // end of loop over first track From 0ecd613d39309117e3c6ce75ebc517376ec2d611 Mon Sep 17 00:00:00 2001 From: lucamicheletti93 <38209984+lucamicheletti93@users.noreply.github.com> Date: Thu, 30 Oct 2025 14:17:39 +0100 Subject: [PATCH 954/986] [PWGDQ] Adding centrality to the gen distributions (#13594) Co-authored-by: Lucamicheletti93 --- PWGDQ/Core/VarManager.h | 1 + PWGDQ/DataModel/ReducedInfoTables.h | 2 +- PWGDQ/TableProducer/tableMakerMC.cxx | 4 ++-- PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/PWGDQ/Core/VarManager.h b/PWGDQ/Core/VarManager.h index 2e19c26ad9c..896465f0a9d 100644 --- a/PWGDQ/Core/VarManager.h +++ b/PWGDQ/Core/VarManager.h @@ -2007,6 +2007,7 @@ void VarManager::FillEvent(T const& event, float* values) values[kMCEventTime] = event.t(); values[kMCEventWeight] = event.weight(); values[kMCEventImpParam] = event.impactParameter(); + values[kMCEventCentrFT0C] = event.centFT0C(); } if constexpr ((fillMap & EventFilter) > 0 || (fillMap & RapidityGapFilter) > 0) { diff --git a/PWGDQ/DataModel/ReducedInfoTables.h b/PWGDQ/DataModel/ReducedInfoTables.h index 61074b2215e..2ad18c11bfd 100644 --- a/PWGDQ/DataModel/ReducedInfoTables.h +++ b/PWGDQ/DataModel/ReducedInfoTables.h @@ -221,7 +221,7 @@ DECLARE_SOA_TABLE(ReducedEventsInfo, "AOD", "REDUCEVENTINFO", //! Main event i DECLARE_SOA_TABLE(ReducedMCEvents, "AOD", "REDUCEDMCEVENT", //! Event level MC truth information o2::soa::Index<>, mccollision::GeneratorsID, reducedevent::MCPosX, reducedevent::MCPosY, reducedevent::MCPosZ, - mccollision::T, mccollision::Weight, mccollision::ImpactParameter, + mccollision::T, mccollision::Weight, mccollision::ImpactParameter, cent::CentFT0C, mult::MultMCNParticlesEta05, mult::MultMCNParticlesEta08, mult::MultMCNParticlesEta10); using ReducedEvent = ReducedEvents::iterator; diff --git a/PWGDQ/TableProducer/tableMakerMC.cxx b/PWGDQ/TableProducer/tableMakerMC.cxx index f7f4f0939e4..e7219648479 100644 --- a/PWGDQ/TableProducer/tableMakerMC.cxx +++ b/PWGDQ/TableProducer/tableMakerMC.cxx @@ -461,7 +461,7 @@ struct TableMakerMC { // make an entry for this MC event only if it was not already added to the table if (!(fEventLabels.find(mcCollision.globalIndex()) != fEventLabels.end())) { eventMC(mcCollision.generatorsID(), mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(), - mcCollision.t(), mcCollision.weight(), mcCollision.impactParameter(), 1, 1, 1); + mcCollision.t(), mcCollision.weight(), mcCollision.impactParameter(), 1, 1, 1, 1); fEventLabels[mcCollision.globalIndex()] = fCounters[1]; fCounters[1]++; } @@ -1096,7 +1096,7 @@ struct TableMakerMC { // make an entry for this MC event only if it was not already added to the table if (!(fEventLabels.find(mcCollision.globalIndex()) != fEventLabels.end())) { eventMC(mcCollision.generatorsID(), mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(), - mcCollision.t(), mcCollision.weight(), mcCollision.impactParameter(), 1, 1, 1); + mcCollision.t(), mcCollision.weight(), mcCollision.impactParameter(), 1, 1, 1, 1); fEventLabels[mcCollision.globalIndex()] = fCounters[1]; fCounters[1]++; } diff --git a/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx b/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx index e0d27b6a099..3ec7a18524c 100644 --- a/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx +++ b/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx @@ -469,7 +469,7 @@ struct TableMakerMC { fHistMan->FillHistClass("Event_MCTruth", VarManager::fgValues); // Create the skimmed table entry for this collision eventMC(mcCollision.generatorsID(), mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(), - mcCollision.t(), mcCollision.weight(), mcCollision.impactParameter(), + mcCollision.t(), mcCollision.weight(), mcCollision.impactParameter(), mcCollision.bestCollisionCentFT0C(), mcCollision.multMCNParticlesEta05(), mcCollision.multMCNParticlesEta08(), mcCollision.multMCNParticlesEta10()); } } From aa3068bb213102c635e35e970a950a57ab871142 Mon Sep 17 00:00:00 2001 From: lauraser <45659867+lauraser@users.noreply.github.com> Date: Thu, 30 Oct 2025 14:39:28 +0100 Subject: [PATCH 955/986] [PWGCF] Change how triggers of interest are selected to avoid hard-coded flags (#13599) Co-authored-by: Laura Serksnyte --- .../TableProducer/femtoDreamProducerTask.cxx | 25 ++----------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx index 5694f1efef9..c6ac9f16659 100644 --- a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx +++ b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx @@ -75,14 +75,6 @@ using FemtoFullTracks = aod::pidTOFFullPr, aod::pidTOFFullDe, aod::pidTOFFullTr, aod::pidTOFFullHe>; } // namespace o2::aod -namespace softwareTriggers -{ -static const int nTriggers = 11; -static const std::vector triggerNames{"fPPP", "fPPL", "fPLL", "fLLL", "fPD", "fLD", "fDoubleXi", "fDoubleOmega", "fOmegaHighMult", "fTrackedXi", "fTrackedOmega"}; -static const float triggerSwitches[1][nTriggers]{ - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; -} // namespace softwareTriggers - template int getRowDaughters(int daughID, T const& vecID) { @@ -119,10 +111,7 @@ struct femtoDreamProducerTask { FemtoDreamCollisionSelection colCuts; // Event cuts - Triggers Configurable ConfEnableTriggerSelection{"ConfEnableTriggerSelection", false, "Should the trigger selection be enabled for collisions?"}; - Configurable> ConfTriggerSwitches{ - "ConfTriggerSwitches", - {softwareTriggers::triggerSwitches[0], 1, softwareTriggers::nTriggers, std::vector{"Switch"}, softwareTriggers::triggerNames}, - "Turn on which trigger should be checked for recorded events to pass selection"}; + Configurable ConfSoftwareTriggerNames{"ConfSoftwareTriggerNames", "fPPL", "Names of the software triggers, use comma and no space"}; Configurable ConfBaseCCDBPathForTriggers{"ConfBaseCCDBPathForTriggers", "Users/m/mpuccio/EventFiltering/OTS/Chunked/", "Provide ccdb path for trigger table; default - trigger coordination"}; // Event cuts - usual selection criteria @@ -304,7 +293,6 @@ struct femtoDreamProducerTask { int mRunNumber; float mMagField; - std::string zorroTriggerNames = ""; Service ccdb; /// Accessing the CCDB RCTFlagsChecker rctChecker; @@ -340,15 +328,6 @@ struct femtoDreamProducerTask { ResoRegistry.add("AnalysisQA/Reso/PtD1_selected", "Transverse momentum of all processed tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); ResoRegistry.add("AnalysisQA/Reso/PtD2_selected", "Transverse momentum of all processed tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}}); - if (ConfEnableTriggerSelection) { - for (const std::string& triggerName : softwareTriggers::triggerNames) { - if (ConfTriggerSwitches->get("Switch", triggerName.c_str())) { - zorroTriggerNames += triggerName + ","; - } - } - zorroTriggerNames.pop_back(); - } - rctChecker.init(rctCut.cfgEvtRCTFlagCheckerLabel, false, rctCut.cfgEvtRCTFlagCheckerLimitAcceptAsBad); colCuts.setCuts(ConfEvtZvtx.value, ConfEvtTriggerCheck.value, ConfEvtTriggerSel.value, ConfEvtOfflineCheck.value, ConfEvtAddOfflineCheck.value, ConfIsRun3.value, ConfEvtMinSphericity.value, ConfEvtSphericityPtmin.value); @@ -521,7 +500,7 @@ struct femtoDreamProducerTask { // Init for zorro to get trigger flags if (ConfEnableTriggerSelection) { zorro.setCCDBpath(ConfBaseCCDBPathForTriggers); - zorro.initCCDB(ccdb.service, mRunNumber, timestamp, zorroTriggerNames); + zorro.initCCDB(ccdb.service, mRunNumber, timestamp, ConfSoftwareTriggerNames.value); } } From af259ea10b27c6a90e03dd36e295211a7156e4ee Mon Sep 17 00:00:00 2001 From: Marvin Hemmer <53471402+mhemmer-cern@users.noreply.github.com> Date: Thu, 30 Oct 2025 15:48:26 +0100 Subject: [PATCH 956/986] [PWGEM,PWGEM-36] Pi0Flow: Reduce CPU time for LUT (#13600) --- PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx | 80 +++++++++++++--------- 1 file changed, 47 insertions(+), 33 deletions(-) diff --git a/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx b/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx index 321bbf007d7..44b3c616264 100644 --- a/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx @@ -99,6 +99,13 @@ enum Harmonics { kOctagonal = 8 }; +enum class MapLevel { + kGood = 1, + kNoBad = 2, + kInEMC = 3, + kAll = 4 +}; + struct TaskPi0FlowEMC { static constexpr float MinEnergy = 0.7f; @@ -220,14 +227,14 @@ struct TaskPi0FlowEMC { o2::emcal::Geometry* emcalGeom; o2::emcal::BadChannelMap* mBadChannels; TH1D* h1SPResolution = nullptr; - // Constants for eta and phi ranges - double etaMin = -0.75, etaMax = 0.75; - int nBinsEta = 150; // 150 bins for eta + // Constants for eta and phi ranges for the look up table + static constexpr double EtaMin = -0.75, etaMax = 0.75; + static constexpr int NBinsEta = 150; // 150 bins for eta - double phiMin = 1.35, phiMax = 5.75; - int nBinsPhi = 440; // (440 bins = 0.01 step size covering most regions) + static constexpr double PhiMin = 1.35, phiMax = 5.75; + static constexpr int NBinsPhi = 440; // (440 bins = 0.01 step size covering most regions) - std::vector lookupTable1D; + std::array lookupTable1D; float epsilon = 1.e-8; // static constexpr @@ -239,19 +246,19 @@ struct TaskPi0FlowEMC { // To access the 1D array inline int getIndex(int iEta, int iPhi) { - return iEta * nBinsPhi + iPhi; + return iEta * NBinsPhi + iPhi; } // Function to access the lookup table inline int8_t checkEtaPhi1D(double eta, double phi) { - if (eta < etaMin || eta > etaMax || phi < phiMin || phi > phiMax) { + if (eta < EtaMin || eta > etaMax || phi < PhiMin || phi > phiMax) { return 3; // Out of bounds } // Compute indices directly - int iEta = static_cast((eta - etaMin) / ((etaMax - etaMin) / nBinsEta)); - int iPhi = static_cast((phi - phiMin) / ((phiMax - phiMin) / nBinsPhi)); + int iEta = static_cast((eta - EtaMin) / ((etaMax - EtaMin) / NBinsEta)); + int iPhi = static_cast((phi - PhiMin) / ((phiMax - PhiMin) / NBinsPhi)); return lookupTable1D[getIndex(iEta, iPhi)]; } @@ -437,7 +444,8 @@ struct TaskPi0FlowEMC { } if (cfgDoM02.value) { - registry.add("hSparseFlow", "THn for SP", HistType::kTHnSparseF, {thnAxisM02, thnAxisPt, thnAxisCent}); + registry.add("p3DM02Flow", " vs M_{02} vs p_T vs cent", HistType::kTProfile3D, {thnAxisM02, thnAxisPt, thnAxisCent}); + registry.add("h3DSparsePi0", "M_{02} vs p_T vs cent", HistType::kTH3D, {thnAxisM02, thnAxisPt, thnAxisCent}); } ccdb->setURL(ccdbUrl); @@ -663,28 +671,33 @@ struct TaskPi0FlowEMC { emcalGeom = o2::emcal::Geometry::GetInstanceFromRunNumber(collision.runNumber()); // Load Bad Channel map mBadChannels = ccdb->getForTimeStamp("EMC/Calib/BadChannelMap", collision.timestamp()); - lookupTable1D = std::vector(nBinsEta * nBinsPhi, -1); - double binWidthEta = (etaMax - etaMin) / nBinsEta; - double binWidthPhi = (phiMax - phiMin) / nBinsPhi; - - for (int iEta = 0; iEta < nBinsEta; ++iEta) { - double etaCenter = etaMin + (iEta + 0.5) * binWidthEta; - for (int iPhi = 0; iPhi < nBinsPhi; ++iPhi) { - double phiCenter = phiMin + (iPhi + 0.5) * binWidthPhi; - try { - // Get the cell ID - int cellID = emcalGeom->GetAbsCellIdFromEtaPhi(etaCenter, phiCenter); - - // Check conditions for the cell - if (isTooCloseToEdge(cellID, 1)) { - lookupTable1D[getIndex(iEta, iPhi)] = 2; // Edge - } else if (isCellMasked(cellID)) { - lookupTable1D[getIndex(iEta, iPhi)] = 1; // Bad - } else { - lookupTable1D[getIndex(iEta, iPhi)] = 0; // Good + lookupTable1D.fill(-1); + double binWidthEta = (etaMax - EtaMin) / NBinsEta; + double binWidthPhi = (phiMax - PhiMin) / NBinsPhi; + + if (cfgEMCalMapLevelBackground.value >= static_cast(MapLevel::kAll) && cfgEMCalMapLevelSameEvent >= static_cast(MapLevel::kAll)) { + // in this case we do not want to check the clusters, so just say thery are all good. + lookupTable1D.fill(0); // good + } else { + for (int iEta = 0; iEta < NBinsEta; ++iEta) { + double etaCenter = EtaMin + (iEta + 0.5) * binWidthEta; + for (int iPhi = 0; iPhi < NBinsPhi; ++iPhi) { + double phiCenter = PhiMin + (iPhi + 0.5) * binWidthPhi; + try { + // Get the cell ID + int cellID = emcalGeom->GetAbsCellIdFromEtaPhi(etaCenter, phiCenter); + + // Check conditions for the cell + if (isTooCloseToEdge(cellID, 1)) { + lookupTable1D[getIndex(iEta, iPhi)] = 2; // Edge + } else if (isCellMasked(cellID)) { + lookupTable1D[getIndex(iEta, iPhi)] = 1; // Bad + } else { + lookupTable1D[getIndex(iEta, iPhi)] = 0; // Good + } + } catch (o2::emcal::InvalidPositionException& e) { + lookupTable1D[getIndex(iEta, iPhi)] = 3; // Outside geometry } - } catch (o2::emcal::InvalidPositionException& e) { - lookupTable1D[getIndex(iEta, iPhi)] = 3; // Outside geometry } } } @@ -1433,7 +1446,8 @@ struct TaskPi0FlowEMC { scalprodCand = scalprodCand / h1SPResolution->GetBinContent(h1SPResolution->FindBin(cent + epsilon)); } if (cfgDoM02.value) { - registry.fill(HIST("hSparseFlow"), photon.m02(), photon.pt(), cent, scalprodCand); + registry.fill(HIST("p3DM02Flow"), photon.m02(), photon.pt(), cent, scalprodCand); + registry.fill(HIST("h3DSparsePi0"), photon.m02(), photon.pt(), cent); } return; } // end of loop over single cluster From 29c4d0e78afb960afdb063cd13327c95ccabf31a Mon Sep 17 00:00:00 2001 From: Oleksii Lubynets Date: Thu, 30 Oct 2025 16:04:20 +0100 Subject: [PATCH 957/986] [DPG] tpcSkimsTableCreator: algo bugfix; add nSigma TOF cut; code cleaning (#13438) --- DPG/Tasks/TPC/tpcSkimsTableCreator.cxx | 607 ++++++++++------------ DPG/Tasks/TPC/tpcSkimsTableCreator.h | 248 +++------ DPG/Tasks/TPC/utilsTpcSkimsTableCreator.h | 102 ++++ 3 files changed, 442 insertions(+), 515 deletions(-) create mode 100644 DPG/Tasks/TPC/utilsTpcSkimsTableCreator.h diff --git a/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx b/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx index b9e4e963842..3d55f5d3c83 100644 --- a/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx +++ b/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx @@ -15,25 +15,14 @@ /// \author Annalena Kalteyer /// \author Christian Sonnabend /// \author Jeremy Wilkinson +/// \author Oleksii Lubynets #include "tpcSkimsTableCreator.h" -#include +#include "utilsTpcSkimsTableCreator.h" -#include -#include -#include -/// ROOT -#include "TRandom3.h" -/// O2 -#include "CommonConstants/PhysicsConstants.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" -/// O2Physics #include "PWGDQ/DataModel/ReducedInfoTables.h" +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" #include "PWGLF/DataModel/LFStrangenessTables.h" #include "Common/CCDB/ctpRateFetcher.h" @@ -46,12 +35,28 @@ #include "Common/DataModel/TrackSelectionTables.h" #include "Common/TableProducer/PID/pidTPCBase.h" +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + using namespace o2; using namespace o2::constants::physics; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::track; using namespace o2::dataformats; +using namespace o2::dpg_tpcskimstablecreator; struct TreeWriterTpcV0 { @@ -61,8 +66,8 @@ struct TreeWriterTpcV0 { using TrksWithDEdxCorrection = soa::Join; using Colls = soa::Join; using MyBCTable = soa::Join; - using V0sWithID = soa::Join; - using CascsWithID = soa::Join; + using V0sWithID = soa::Join; + using CascsWithID = soa::Join; /// Tables to be produced Produces rowTPCTree; @@ -74,18 +79,30 @@ struct TreeWriterTpcV0 { constexpr static o2::track::PID::ID PidKaon{o2::track::PID::Kaon}; constexpr static o2::track::PID::ID PidProton{o2::track::PID::Proton}; + // an arbitrary value of N sigma TOF assigned by TOF task to tracks which are not matched to TOF hits + constexpr static float NSigmaTofUnmatched{-1e6f}; + constexpr static float NSigmaTofUnmatchedEqualityTolerance{1000.f}; + + // an arbitrary value of "N sigma TOF" assigned to electorns (for uniformity reasons) + constexpr static float NSigmaTofElectorn{1000.f}; + /// Configurables - Configurable nSigmaTOFdautrack{"nSigmaTOFdautrack", 999., "n-sigma TOF cut on the proton daughter tracks. Set 999 to switch it off."}; + Configurable nSigmaTofDauTrackPi{"nSigmaTofDauTrackPi", 999.f, "n-sigma TOF cut on the pion daughter tracks"}; + Configurable nSigmaTofDauTrackPr{"nSigmaTofDauTrackPr", 999.f, "n-sigma TOF cut on the proton daughter tracks"}; + Configurable nSigmaTofDauTrackKa{"nSigmaTofDauTrackKa", 999.f, "n-sigma TOF cut on the kaon daughter tracks"}; + Configurable rejectNoTofDauTrackPi{"rejectNoTofDauTrackPi", false, "reject not matched to TOF pion daughter tracks"}; + Configurable rejectNoTofDauTrackPr{"rejectNoTofDauTrackPr", false, "reject not matched to TOF proton daughter tracks"}; + Configurable rejectNoTofDauTrackKa{"rejectNoTofDauTrackKa", false, "reject not matched to TOF kaon daughter tracks"}; Configurable nClNorm{"nClNorm", 152., "Number of cluster normalization. Run 2: 159, Run 3 152"}; Configurable applyEvSel{"applyEvSel", 2, "Flag to apply rapidity cut: 0 -> no event selection, 1 -> Run 2 event selection, 2 -> Run 3 event selection"}; - Configurable trackSelection{"trackSelection", 1, "Track selection: 0 -> No Cut, 1 -> kGlobalTrack, 2 -> kGlobalTrackWoPtEta, 3 -> kGlobalTrackWoDCA, 4 -> kQualityTracks, 5 -> kInAcceptanceTracks"}; + Configurable trackSelection{"trackSelection", 0, "Track selection: 0 -> No Cut, 1 -> kGlobalTrack, 2 -> kGlobalTrackWoPtEta, 3 -> kGlobalTrackWoDCA, 4 -> kQualityTracks, 5 -> kInAcceptanceTracks"}; Configurable irSource{"irSource", "T0VTX", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"}; /// Configurables downsampling Configurable dwnSmplFactorPi{"dwnSmplFactorPi", 1., "downsampling factor for pions, default fraction to keep is 1."}; Configurable dwnSmplFactorPr{"dwnSmplFactorPr", 1., "downsampling factor for protons, default fraction to keep is 1."}; Configurable dwnSmplFactorEl{"dwnSmplFactorEl", 1., "downsampling factor for electrons, default fraction to keep is 1."}; Configurable dwnSmplFactorKa{"dwnSmplFactorKa", 1., "downsampling factor for kaons, default fraction to keep is 1."}; - Configurable sqrtSNN{"sqrtSNN", 0., "sqrt(s_NN), used for downsampling with the Tsallis distribution"}; + Configurable sqrtSNN{"sqrtSNN", 5360., "sqrt(s_NN), used for downsampling with the Tsallis distribution"}; Configurable downsamplingTsalisPions{"downsamplingTsalisPions", -1., "Downsampling factor to reduce the number of pions"}; Configurable downsamplingTsalisProtons{"downsamplingTsalisProtons", -1., "Downsampling factor to reduce the number of protons"}; Configurable downsamplingTsalisElectrons{"downsamplingTsalisElectrons", -1., "Downsampling factor to reduce the number of electrons"}; @@ -106,48 +123,104 @@ struct TreeWriterTpcV0 { }; enum { - TrackSelectionNoCut = 0, - TrackSelectionGlobalTrack, - TrackSelectionTrackWoPtEta, - TrackSelectionGlobalTrackWoDCA, - TrackSelectionQualityTracks, - TrackSelectionInAcceptanceTracks - }; - - enum { - EventSelectionNo = 0, - EventSelectionRun2, - EventSelectionRun3 + DaughterElectron = 0, + DaughterPion, + DaughterKaon, + DaughterProton }; - Filter trackFilter = (trackSelection.node() == static_cast(TrackSelectionNoCut)) || - ((trackSelection.node() == static_cast(TrackSelectionGlobalTrack)) && requireGlobalTrackInFilter()) || - ((trackSelection.node() == static_cast(TrackSelectionTrackWoPtEta)) && requireGlobalTrackWoPtEtaInFilter()) || - ((trackSelection.node() == static_cast(TrackSelectionGlobalTrackWoDCA)) && requireGlobalTrackWoDCAInFilter()) || - ((trackSelection.node() == static_cast(TrackSelectionQualityTracks)) && requireQualityTracksInFilter()) || - ((trackSelection.node() == static_cast(TrackSelectionInAcceptanceTracks)) && requireTrackCutInFilter(TrackSelectionFlags::kInAcceptanceTracks)); - ctpRateFetcher mRateFetcher; struct V0Daughter { - double downsamplingTsalis; - double mass; - double maxPt4dwnsmplTsalis; - double tpcNSigma; - double tofNSigma; - double tpcExpSignal; - o2::track::PID::ID id; - double dwnSmplFactor; - bool isApplyTofNSigmaCut; + double downsamplingTsalis{-999.}; + double mass{-999.}; + double maxPt4dwnsmplTsalis{-999.}; + double tpcNSigma{-999.}; + double tofNSigma{-999.}; + double tpcExpSignal{-999.}; + o2::track::PID::ID id{0}; + double dwnSmplFactor{-999.}; + double nSigmaTofDauTrack{-999.}; + bool rejectNoTofDauTrack{false}; }; + template + V0Daughter createV0Daughter(const V0Casc& v0Casc, const T& track, const int motherId, const int daughterId, const bool isPositive = true) + { + switch (daughterId) { + case DaughterElectron: + return V0Daughter{downsamplingTsalisElectrons, MassElectron, maxPt4dwnsmplTsalisElectrons, track.tpcNSigmaEl(), getStrangenessTofNSigma(v0Casc, motherId, daughterId, isPositive), track.tpcExpSignalEl(tpcSignalGeneric(track)), PidElectron, dwnSmplFactorEl, NSigmaTofElectorn + 1.f, false}; + case DaughterPion: + return V0Daughter{downsamplingTsalisPions, MassPiPlus, maxPt4dwnsmplTsalisPions, track.tpcNSigmaPi(), getStrangenessTofNSigma(v0Casc, motherId, daughterId, isPositive), track.tpcExpSignalPi(tpcSignalGeneric(track)), PidPion, dwnSmplFactorPi, nSigmaTofDauTrackPi, rejectNoTofDauTrackPi}; + case DaughterProton: + return V0Daughter{downsamplingTsalisProtons, MassProton, maxPt4dwnsmplTsalisProtons, track.tpcNSigmaPr(), getStrangenessTofNSigma(v0Casc, motherId, daughterId, isPositive), track.tpcExpSignalPr(tpcSignalGeneric(track)), PidProton, dwnSmplFactorPr, nSigmaTofDauTrackPr, rejectNoTofDauTrackPr}; + case DaughterKaon: + return V0Daughter{downsamplingTsalisKaons, MassKPlus, maxPt4dwnsmplTsalisKaons, track.tpcNSigmaKa(), getStrangenessTofNSigma(v0Casc, motherId, daughterId, isPositive), track.tpcExpSignalKa(tpcSignalGeneric(track)), PidKaon, dwnSmplFactorKa, nSigmaTofDauTrackKa, rejectNoTofDauTrackKa}; + default: { + LOGP(fatal, "createV0Daughter: unknown daughterId"); + return V0Daughter(); + } + } + } + struct V0Mother { - int id; - V0Daughter posDaughter; - V0Daughter negDaughter; + int posDaughterId{-999}; + int negDaughterId{-999}; }; - /// Funktion to fill skimmed tables + V0Mother createV0Mother(const int motherId) + { + switch (motherId) { + case MotherGamma: + return V0Mother{DaughterElectron, DaughterElectron}; + case MotherK0S: + return V0Mother{DaughterPion, DaughterPion}; + case MotherLambda: + return V0Mother{DaughterProton, DaughterPion}; + case MotherAntiLambda: + return V0Mother{DaughterPion, DaughterProton}; + default: { + LOGP(fatal, "createV0Mother: unknown motherId"); + return V0Mother(); + } + } + } + + float getStrangenessTofNSigma(V0sWithID::iterator const& v0, const int motherId, const int daughterId, const bool isPositive) + { + if (motherId == MotherGamma && daughterId == DaughterElectron) { + return NSigmaTofElectorn; + } else if (motherId == MotherK0S && daughterId == DaughterPion) { + if (isPositive) + return v0.tofNSigmaK0PiPlus(); + else + return v0.tofNSigmaK0PiMinus(); + } else if (motherId == MotherLambda) { + if (daughterId == DaughterProton && isPositive) + return v0.tofNSigmaLaPr(); + else if (daughterId == DaughterPion && !isPositive) + return v0.tofNSigmaLaPi(); + } else if (motherId == MotherAntiLambda) { + if (daughterId == DaughterProton && !isPositive) + return v0.tofNSigmaALaPr(); + else if (daughterId == DaughterPion && isPositive) + return v0.tofNSigmaALaPi(); + } + + LOGP(fatal, "getStrangenessTofNSigma for V0: wrong combination of motherId, daughterId and sign"); + return -999.f; + } + + float getStrangenessTofNSigma(CascsWithID::iterator const& casc, const int motherId, const int daughterId, bool) + { + if ((motherId == MotherOmega || motherId == MotherAntiOmega) && daughterId == DaughterKaon) + return casc.tofNSigmaOmKa(); + + LOGP(fatal, "getStrangenessTofNSigma for cascade: wrong combination of motherId and daughterId"); + return -999.f; + } + + /// Function to fill skimmed tables template void fillSkimmedV0Table(V0Casc const& v0casc, T const& track, C const& collision, const float nSigmaTPC, const float nSigmaTOF, const float dEdxExp, const o2::track::PID::ID id, const int runnumber, const double dwnSmplFactor, const float hadronicRate) { @@ -192,16 +265,16 @@ struct TreeWriterTpcV0 { id, nSigmaTPC, nSigmaTOF, + runnumber, + trackOcc, + ft0Occ, + hadronicRate, alpha, qt, cosPA, pT, v0radius, - gammapsipair, - runnumber, - trackOcc, - ft0Occ, - hadronicRate); + gammapsipair); } }; @@ -249,16 +322,16 @@ struct TreeWriterTpcV0 { id, nSigmaTPC, nSigmaTOF, + runnumber, + trackOcc, + ft0Occ, + hadronicRate, alpha, qt, cosPA, pT, v0radius, gammapsipair, - runnumber, - trackOcc, - ft0Occ, - hadronicRate, existTrkQA ? trackQA.tpcdEdxNorm() : -999); } else { rowTPCTreeWithTrkQA(usedDedx, @@ -277,16 +350,16 @@ struct TreeWriterTpcV0 { id, nSigmaTPC, nSigmaTOF, + runnumber, + trackOcc, + ft0Occ, + hadronicRate, alpha, qt, cosPA, pT, v0radius, gammapsipair, - runnumber, - trackOcc, - ft0Occ, - hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame, @@ -304,56 +377,15 @@ struct TreeWriterTpcV0 { } } - double tsalisCharged(const double pt, const double mass) - { - const double a = 6.81, b = 59.24; - const double c = 0.082, d = 0.151; - const double mt = std::sqrt(mass * mass + pt * pt); - const double n = a + b / sqrtSNN; - const double t = c + d / sqrtSNN; - const double p0 = n * t; - const double result = std::pow((1. + mt / p0), -n); - return result; - }; - - /// Random downsampling trigger function using Tsalis/Hagedorn spectra fit (sqrt(s) = 62.4 GeV to 13 TeV) - /// as in https://iopscience.iop.org/article/10.1088/2399-6528/aab00f/pdf TRandom3* fRndm = new TRandom3(0); - bool downsampleTsalisCharged(const double pt, const double factor1Pt, const double mass, const double maxPt) - { - if (factor1Pt < 0.) { - return true; - } - if (pt > maxPt) { - return true; - } - const double prob = tsalisCharged(pt, mass) * pt; - const double probNorm = tsalisCharged(1., mass); - if ((fRndm->Rndm() * ((prob / probNorm) * pt * pt)) > factor1Pt) { - return false; - } else { - return true; - } - }; - /// Event selection - template - bool isEventSelected(const CollisionType& collision, const TrackType& /*tracks*/) + void init(o2::framework::InitContext&) { - if (applyEvSel == EventSelectionRun2) { - if (!collision.sel7()) { - return false; - } - } else if (applyEvSel == EventSelectionRun3) { - if (!collision.sel8()) { - return false; - } + const std::array doprocess{doprocessStandard, doprocessStandardWithCorrecteddEdx, doprocessWithdEdxTrQA, doprocessWithdEdxTrQAWithCorrecteddEdx, doprocessWithTrQA, doprocessWithTrQAWithCorrecteddEdx, doprocessDummy}; + if (std::accumulate(doprocess.begin(), doprocess.end(), 0) != 1) { + LOGP(fatal, "One and only one process function should be enabled"); } - return true; - }; - void init(o2::framework::InitContext&) - { ccdb->setURL("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); ccdb->setFatalWhenNull(false); @@ -397,103 +429,85 @@ struct TreeWriterTpcV0 { } template - void runStandard(Colls::iterator const& collision, soa::Filtered const& tracks, V0sWithID const& v0s, CascsWithID const& cascs) + void runStandard(Colls::iterator const& collision, V0sWithID const& v0s, CascsWithID const& cascs) { /// Check event slection - if (!isEventSelected(collision, tracks)) { + if (!isEventSelected(collision, applyEvSel)) { return; } const auto& bc = collision.bc_as(); const int runnumber = bc.runNumber(); const float hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, irSource) * 1.e-3; - rowTPCTree.reserve(tracks.size()); + rowTPCTree.reserve(2 * v0s.size() + cascs.size()); + + auto fillDaughterTrack = [&](const auto& mother, const TrksType::iterator& dauTrack, const V0Daughter& daughter) { + const bool passTrackSelection = isTrackSelected(dauTrack, trackSelection); + const bool passDownsamplig = downsampleTsalisCharged(fRndm, dauTrack.pt(), daughter.downsamplingTsalis, daughter.mass, sqrtSNN, daughter.maxPt4dwnsmplTsalis); + const bool passNSigmaTofCut = std::fabs(daughter.tofNSigma) < daughter.nSigmaTofDauTrack || std::fabs(daughter.tofNSigma - NSigmaTofUnmatched) < NSigmaTofUnmatchedEqualityTolerance; + const bool passMatchTofRequirement = !daughter.rejectNoTofDauTrack || std::fabs(daughter.tofNSigma - NSigmaTofUnmatched) > NSigmaTofUnmatchedEqualityTolerance; + if (passTrackSelection && passDownsamplig && passNSigmaTofCut && passMatchTofRequirement) { + fillSkimmedV0Table(mother, dauTrack, collision, daughter.tpcNSigma, daughter.tofNSigma, daughter.tpcExpSignal, daughter.id, runnumber, daughter.dwnSmplFactor, hadronicRate); + } + }; /// Loop over v0 candidates for (const auto& v0 : v0s) { - if (v0.v0addid() == MotherUndef) { + const auto v0Id = v0.v0addid(); + if (v0Id == MotherUndef) { continue; } - const auto& posTrack = v0.posTrack_as>(); - const auto& negTrack = v0.negTrack_as>(); - - V0Daughter elPos{downsamplingTsalisElectrons, MassElectron, maxPt4dwnsmplTsalisElectrons, posTrack.tpcNSigmaEl(), posTrack.tofNSigmaEl(), posTrack.tpcExpSignalEl(tpcSignalGeneric(posTrack)), PidElectron, dwnSmplFactorEl, false}; - V0Daughter elNeg{downsamplingTsalisElectrons, MassElectron, maxPt4dwnsmplTsalisElectrons, negTrack.tpcNSigmaEl(), negTrack.tofNSigmaEl(), negTrack.tpcExpSignalEl(tpcSignalGeneric(negTrack)), PidElectron, dwnSmplFactorEl, false}; - V0Daughter piPos{downsamplingTsalisPions, MassPiPlus, maxPt4dwnsmplTsalisPions, posTrack.tpcNSigmaPi(), posTrack.tofNSigmaPi(), posTrack.tpcExpSignalPi(tpcSignalGeneric(posTrack)), PidPion, dwnSmplFactorPi, false}; - V0Daughter piNeg{downsamplingTsalisPions, MassPiPlus, maxPt4dwnsmplTsalisPions, negTrack.tpcNSigmaPi(), negTrack.tofNSigmaPi(), negTrack.tpcExpSignalPi(tpcSignalGeneric(negTrack)), PidPion, dwnSmplFactorPi, false}; - V0Daughter prPos{downsamplingTsalisProtons, MassProton, maxPt4dwnsmplTsalisProtons, posTrack.tpcNSigmaPr(), posTrack.tofNSigmaPr(), posTrack.tpcExpSignalPr(tpcSignalGeneric(posTrack)), PidProton, dwnSmplFactorPr, true}; - V0Daughter prNeg{downsamplingTsalisProtons, MassProton, maxPt4dwnsmplTsalisProtons, negTrack.tpcNSigmaPr(), negTrack.tofNSigmaPr(), negTrack.tpcExpSignalPr(tpcSignalGeneric(negTrack)), PidProton, dwnSmplFactorPr, true}; - - const std::array v0Mothers{ - V0Mother{MotherGamma, elPos, elNeg}, - V0Mother{MotherK0S, piPos, piNeg}, - V0Mother{MotherLambda, prPos, piNeg}, - V0Mother{MotherAntiLambda, piPos, prNeg}}; - - for (const auto& v0Mother : v0Mothers) { - if (static_cast(posTrack.pidbit() & (1 << v0Mother.id)) && static_cast(negTrack.pidbit() & (1 << v0Mother.id))) { - bool isPosDaughter{true}; - for (const auto& daughter : {v0Mother.posDaughter, v0Mother.negDaughter}) { - const auto& dauTrack = isPosDaughter ? posTrack : negTrack; - if (downsampleTsalisCharged(dauTrack.pt(), daughter.downsamplingTsalis, daughter.mass, daughter.maxPt4dwnsmplTsalis)) { - if (!daughter.isApplyTofNSigmaCut || std::fabs(daughter.tofNSigma) <= nSigmaTOFdautrack) { - fillSkimmedV0Table(v0, dauTrack, collision, daughter.tpcNSigma, daughter.tofNSigma, daughter.tpcExpSignal, daughter.id, runnumber, daughter.dwnSmplFactor, hadronicRate); - } - } - isPosDaughter = false; - } - } - } // v0Mothers + const auto& posTrack = v0.posTrack_as(); + const auto& negTrack = v0.negTrack_as(); + + const V0Mother v0Mother = createV0Mother(v0Id); + const V0Daughter posDaughter = createV0Daughter(v0, posTrack, v0Id, v0Mother.posDaughterId, true); + const V0Daughter negDaughter = createV0Daughter(v0, negTrack, v0Id, v0Mother.negDaughterId, false); + + fillDaughterTrack(v0, posTrack, posDaughter); + fillDaughterTrack(v0, negTrack, negDaughter); } /// Loop over cascade candidates for (const auto& casc : cascs) { - if (casc.cascaddid() == MotherUndef) { + const auto cascId = casc.cascaddid(); + if (cascId == MotherUndef) { continue; } - const auto& bachTrack = casc.bachelor_as>(); + const auto& bachTrack = casc.bachelor_as(); + const V0Daughter bachDaughter = createV0Daughter(casc, bachTrack, cascId, DaughterKaon); // Omega and antiomega - if (static_cast(bachTrack.pidbit() & (1 << MotherOmega)) || static_cast(bachTrack.pidbit() & (1 << MotherAntiOmega))) { - if (downsampleTsalisCharged(bachTrack.pt(), downsamplingTsalisKaons, MassKPlus, maxPt4dwnsmplTsalisKaons)) { - fillSkimmedV0Table(casc, bachTrack, collision, bachTrack.tpcNSigmaKa(), bachTrack.tofNSigmaKa(), bachTrack.tpcExpSignalKa(tpcSignalGeneric(bachTrack)), PidKaon, runnumber, dwnSmplFactorKa, hadronicRate); - } - } + fillDaughterTrack(casc, bachTrack, bachDaughter); } } /// Apply a track quality selection with a filter! - void processStandard(Colls::iterator const& collision, soa::Filtered const& tracks, V0sWithID const& v0s, CascsWithID const& cascs, aod::BCsWithTimestamps const&) + void processStandard(Colls::iterator const& collision, V0sWithID const& v0s, CascsWithID const& cascs, aod::BCsWithTimestamps const&) { - runStandard(collision, tracks, v0s, cascs); + runStandard(collision, v0s, cascs); } /// process Standard PROCESS_SWITCH(TreeWriterTpcV0, processStandard, "Standard V0 Samples for PID", true); - void processStandardWithCorrecteddEdx(Colls::iterator const& collision, soa::Filtered const& tracks, V0sWithID const& v0s, CascsWithID const& cascs, aod::BCsWithTimestamps const&) + void processStandardWithCorrecteddEdx(Colls::iterator const& collision, V0sWithID const& v0s, CascsWithID const& cascs, aod::BCsWithTimestamps const&) { - runStandard(collision, tracks, v0s, cascs); + runStandard(collision, v0s, cascs); } /// process StandardWithCorrecteddEdx PROCESS_SWITCH(TreeWriterTpcV0, processStandardWithCorrecteddEdx, "Standard V0 Samples for PID with corrected dEdx", false); - Preslice perCollisionTracks = aod::track::collisionId; Preslice perCollisionV0s = aod::v0data::collisionId; Preslice perCollisionCascs = aod::cascdata::collisionId; - Preslice perCollisionTracksWithNewDEdx = aod::track::collisionId; template - void runWithTrQAGeneric(Colls const& collisions, TrksType const& myTracks, V0sWithID const& myV0s, CascsWithID const& myCascs, aod::TracksQAVersion const& tracksQA, Preslice const& perCollisionTracksType) + void runWithTrQAGeneric(Colls const& collisions, TrksType const& myTracks, V0sWithID const& myV0s, CascsWithID const& myCascs, aod::TracksQAVersion const& tracksQA) { - std::vector labelTrack2TrackQA; - labelTrack2TrackQA.clear(); - labelTrack2TrackQA.resize(myTracks.size(), -1); + std::vector labelTrack2TrackQA(myTracks.size(), -1); for (const auto& trackQA : tracksQA) { - int64_t trackId = trackQA.trackId(); - int64_t trackQAIndex = trackQA.globalIndex(); - labelTrack2TrackQA[trackId] = trackQAIndex; + const int64_t trackId = trackQA.trackId(); + labelTrack2TrackQA.at(trackId) = trackQA.globalIndex(); } for (const auto& collision : collisions) { /// Check event slection - const auto& tracks = myTracks.sliceBy(perCollisionTracksType, collision.globalIndex()); - if (!isEventSelected(collision, tracks)) { + if (!isEventSelected(collision, applyEvSel)) { continue; } const auto& v0s = myV0s.sliceBy(perCollisionV0s, collision.globalIndex()); @@ -511,114 +525,87 @@ struct TreeWriterTpcV0 { bcBcInTimeFrame = bc.bcInTF(); } if constexpr (IsWithdEdx) { - rowTPCTreeWithdEdxTrkQA.reserve(tracks.size()); + rowTPCTreeWithdEdxTrkQA.reserve(2 * v0s.size() + cascs.size()); } else { - rowTPCTreeWithTrkQA.reserve(tracks.size()); + rowTPCTreeWithTrkQA.reserve(2 * v0s.size() + cascs.size()); } + + auto fillDaughterTrack = [&](const auto& mother, const TrksType::iterator& dauTrack, const V0Daughter& daughter, const aod::TracksQA& trackQAInstance, const bool existTrkQA) { + const bool passTrackSelection = isTrackSelected(dauTrack, trackSelection); + const bool passDownsamplig = downsampleTsalisCharged(fRndm, dauTrack.pt(), daughter.downsamplingTsalis, daughter.mass, sqrtSNN, daughter.maxPt4dwnsmplTsalis); + const bool passNSigmaTofCut = std::fabs(daughter.tofNSigma) < daughter.nSigmaTofDauTrack || std::fabs(daughter.tofNSigma - NSigmaTofUnmatched) < NSigmaTofUnmatchedEqualityTolerance; + const bool passMatchTofRequirement = !daughter.rejectNoTofDauTrack || std::fabs(daughter.tofNSigma - NSigmaTofUnmatched) > NSigmaTofUnmatchedEqualityTolerance; + if (passTrackSelection && passDownsamplig && passNSigmaTofCut && passMatchTofRequirement) { + fillSkimmedV0TableWithTrQAGeneric(mother, dauTrack, trackQAInstance, existTrkQA, collision, daughter.tpcNSigma, daughter.tofNSigma, daughter.tpcExpSignal, daughter.id, runnumber, daughter.dwnSmplFactor, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); + } + }; + + auto getTrackQA = [&](const TrksType::iterator& track) { + const auto trackGlobalIndex = track.globalIndex(); + const auto label = labelTrack2TrackQA.at(trackGlobalIndex); + const bool existTrkQA = (label != -1); + const int64_t trkIndex = existTrkQA ? label : 0; + const aod::TracksQA& trkQA = tracksQA.iteratorAt(trkIndex); + + return std::make_pair(trkQA, existTrkQA); + }; + /// Loop over v0 candidates for (const auto& v0 : v0s) { - if (v0.v0addid() == MotherUndef) { + const auto v0Id = v0.v0addid(); + if (v0Id == MotherUndef) { continue; } const auto& posTrack = v0.posTrack_as(); const auto& negTrack = v0.negTrack_as(); - aod::TracksQA posTrackQA; - aod::TracksQA negTrackQA; - bool existPosTrkQA; - bool existNegTrkQA; - if (labelTrack2TrackQA[posTrack.globalIndex()] != -1) { - posTrackQA = tracksQA.iteratorAt(labelTrack2TrackQA[posTrack.globalIndex()]); - existPosTrkQA = true; - } else { - posTrackQA = tracksQA.iteratorAt(0); - existPosTrkQA = false; - } - if (labelTrack2TrackQA[negTrack.globalIndex()] != -1) { - negTrackQA = tracksQA.iteratorAt(labelTrack2TrackQA[negTrack.globalIndex()]); - existNegTrkQA = true; - } else { - negTrackQA = tracksQA.iteratorAt(0); - existNegTrkQA = false; - } - V0Daughter elPos{downsamplingTsalisElectrons, MassElectron, maxPt4dwnsmplTsalisElectrons, posTrack.tpcNSigmaEl(), posTrack.tofNSigmaEl(), posTrack.tpcExpSignalEl(tpcSignalGeneric(posTrack)), PidElectron, dwnSmplFactorEl, false}; - V0Daughter elNeg{downsamplingTsalisElectrons, MassElectron, maxPt4dwnsmplTsalisElectrons, negTrack.tpcNSigmaEl(), negTrack.tofNSigmaEl(), negTrack.tpcExpSignalEl(tpcSignalGeneric(negTrack)), PidElectron, dwnSmplFactorEl, false}; - V0Daughter piPos{downsamplingTsalisPions, MassPiPlus, maxPt4dwnsmplTsalisPions, posTrack.tpcNSigmaPi(), posTrack.tofNSigmaPi(), posTrack.tpcExpSignalPi(tpcSignalGeneric(posTrack)), PidPion, dwnSmplFactorPi, false}; - V0Daughter piNeg{downsamplingTsalisPions, MassPiPlus, maxPt4dwnsmplTsalisPions, negTrack.tpcNSigmaPi(), negTrack.tofNSigmaPi(), negTrack.tpcExpSignalPi(tpcSignalGeneric(negTrack)), PidPion, dwnSmplFactorPi, false}; - V0Daughter prPos{downsamplingTsalisProtons, MassProton, maxPt4dwnsmplTsalisProtons, posTrack.tpcNSigmaPr(), posTrack.tofNSigmaPr(), posTrack.tpcExpSignalPr(tpcSignalGeneric(posTrack)), PidProton, dwnSmplFactorPr, true}; - V0Daughter prNeg{downsamplingTsalisProtons, MassProton, maxPt4dwnsmplTsalisProtons, negTrack.tpcNSigmaPr(), negTrack.tofNSigmaPr(), negTrack.tpcExpSignalPr(tpcSignalGeneric(negTrack)), PidProton, dwnSmplFactorPr, true}; - - const std::array v0Mothers{ - V0Mother{MotherGamma, elPos, elNeg}, - V0Mother{MotherK0S, piPos, piNeg}, - V0Mother{MotherLambda, prPos, piNeg}, - V0Mother{MotherAntiLambda, piPos, prNeg}}; - - for (const auto& v0Mother : v0Mothers) { - if (static_cast(posTrack.pidbit() & (1 << v0Mother.id)) && static_cast(negTrack.pidbit() & (1 << v0Mother.id))) { - bool isPosDaughter{true}; - for (const auto& daughter : {v0Mother.posDaughter, v0Mother.negDaughter}) { - const auto& dauTrack = isPosDaughter ? posTrack : negTrack; - const auto& trackQA = isPosDaughter ? posTrackQA : negTrackQA; - const auto& existTrkQA = isPosDaughter ? existPosTrkQA : existNegTrkQA; - if (downsampleTsalisCharged(dauTrack.pt(), daughter.downsamplingTsalis, daughter.mass, daughter.maxPt4dwnsmplTsalis)) { - if (!daughter.isApplyTofNSigmaCut || std::fabs(daughter.tofNSigma) <= nSigmaTOFdautrack) { - fillSkimmedV0TableWithTrQAGeneric(v0, dauTrack, trackQA, existTrkQA, collision, daughter.tpcNSigma, daughter.tofNSigma, daughter.tpcExpSignal, daughter.id, runnumber, daughter.dwnSmplFactor, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - } - isPosDaughter = false; - } - } - } // v0Mothers + const auto& [posTrackQA, existPosTrkQA] = getTrackQA(posTrack); + const auto& [negTrackQA, existNegTrkQA] = getTrackQA(negTrack); + + const V0Mother v0Mother = createV0Mother(v0Id); + const V0Daughter posDaughter = createV0Daughter(v0, posTrack, v0Id, v0Mother.posDaughterId, true); + const V0Daughter negDaughter = createV0Daughter(v0, negTrack, v0Id, v0Mother.negDaughterId, false); + + fillDaughterTrack(v0, posTrack, posDaughter, posTrackQA, existPosTrkQA); + fillDaughterTrack(v0, negTrack, negDaughter, negTrackQA, existNegTrkQA); } /// Loop over cascade candidates for (const auto& casc : cascs) { - if (casc.cascaddid() == MotherUndef) { + const auto cascId = casc.cascaddid(); + if (cascId == MotherUndef) { continue; } const auto& bachTrack = casc.bachelor_as(); - aod::TracksQA bachTrackQA; - bool existBachTrkQA; - if (labelTrack2TrackQA[bachTrack.globalIndex()] != -1) { - bachTrackQA = tracksQA.iteratorAt(labelTrack2TrackQA[bachTrack.globalIndex()]); - existBachTrkQA = true; - } else { - bachTrackQA = tracksQA.iteratorAt(0); - existBachTrkQA = false; - } - + const V0Daughter bachDaughter = createV0Daughter(casc, bachTrack, cascId, DaughterKaon); + const auto& [bachTrackQA, existBachTrkQA] = getTrackQA(bachTrack); // Omega and antiomega - if (static_cast(bachTrack.pidbit() & (1 << MotherOmega)) || static_cast(bachTrack.pidbit() & (1 << MotherAntiOmega))) { - if (downsampleTsalisCharged(bachTrack.pt(), downsamplingTsalisKaons, MassKPlus, maxPt4dwnsmplTsalisKaons)) { - fillSkimmedV0TableWithTrQAGeneric(casc, bachTrack, bachTrackQA, existBachTrkQA, collision, bachTrack.tpcNSigmaKa(), bachTrack.tofNSigmaKa(), bachTrack.tpcExpSignalKa(tpcSignalGeneric(bachTrack)), PidKaon, runnumber, dwnSmplFactorKa, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); - } - } + fillDaughterTrack(casc, bachTrack, bachDaughter, bachTrackQA, existBachTrkQA); } } } void processWithdEdxTrQA(Colls const& collisions, Trks const& myTracks, V0sWithID const& myV0s, CascsWithID const& myCascs, aod::BCsWithTimestamps const&, aod::TracksQAVersion const& tracksQA) { - runWithTrQAGeneric(collisions, myTracks, myV0s, myCascs, tracksQA, perCollisionTracks); + runWithTrQAGeneric(collisions, myTracks, myV0s, myCascs, tracksQA); } /// process with dEdx from TrackQA PROCESS_SWITCH(TreeWriterTpcV0, processWithdEdxTrQA, "Standard V0 Samples with dEdx from Track QA for PID", false); void processWithdEdxTrQAWithCorrecteddEdx(Colls const& collisions, TrksWithDEdxCorrection const& myTracks, V0sWithID const& myV0s, CascsWithID const& myCascs, aod::BCsWithTimestamps const&, aod::TracksQAVersion const& tracksQA) { - runWithTrQAGeneric(collisions, myTracks, myV0s, myCascs, tracksQA, perCollisionTracksWithNewDEdx); + runWithTrQAGeneric(collisions, myTracks, myV0s, myCascs, tracksQA); } /// process with dEdx from TrackQA PROCESS_SWITCH(TreeWriterTpcV0, processWithdEdxTrQAWithCorrecteddEdx, "Standard V0 Samples with dEdx from Track QA for PID with corrected dEdx", false); void processWithTrQA(Colls const& collisions, Trks const& myTracks, V0sWithID const& myV0s, CascsWithID const& myCascs, MyBCTable const&, aod::TracksQAVersion const& tracksQA) { - runWithTrQAGeneric(collisions, myTracks, myV0s, myCascs, tracksQA, perCollisionTracks); + runWithTrQAGeneric(collisions, myTracks, myV0s, myCascs, tracksQA); } /// process with TrackQA PROCESS_SWITCH(TreeWriterTpcV0, processWithTrQA, "Standard V0 Samples with Track QA for PID", false); void processWithTrQAWithCorrecteddEdx(Colls const& collisions, TrksWithDEdxCorrection const& myTracks, V0sWithID const& myV0s, CascsWithID const& myCascs, MyBCTable const&, aod::TracksQAVersion const& tracksQA) { - runWithTrQAGeneric(collisions, myTracks, myV0s, myCascs, tracksQA, perCollisionTracksWithNewDEdx); + runWithTrQAGeneric(collisions, myTracks, myV0s, myCascs, tracksQA); } /// process with TrackQA PROCESS_SWITCH(TreeWriterTpcV0, processWithTrQAWithCorrecteddEdx, "Standard V0 Samples with Track QA for PID with corrected dEdx", false); @@ -627,7 +614,7 @@ struct TreeWriterTpcV0 { }; /// struct TreeWriterTpcV0 -struct TreeWriterTPCTOF { +struct TreeWriterTpcTof { Service ccdb; @@ -660,7 +647,6 @@ struct TreeWriterTPCTOF { /// Configurables Configurable nClNorm{"nClNorm", 152., "Number of cluster normalization. Run 2: 159, Run 3 152"}; Configurable applyEvSel{"applyEvSel", 2, "Flag to apply rapidity cut: 0 -> no event selection, 1 -> Run 2 event selection, 2 -> Run 3 event selection"}; - Configurable applyTrkSel{"applyTrkSel", 1, "Flag to apply track selection: 0 -> no track selection, 1 -> track selection"}; Configurable trackSelection{"trackSelection", 1, "Track selection: 0 -> No Cut, 1 -> kGlobalTrack, 2 -> kGlobalTrackWoPtEta, 3 -> kGlobalTrackWoDCA, 4 -> kQualityTracks, 5 -> kInAcceptanceTracks"}; Configurable irSource{"irSource", "T0VTX", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"}; /// Triton @@ -697,28 +683,13 @@ struct TreeWriterTPCTOF { Configurable nSigmaTofTpctofPi{"nSigmaTofTpctofPi", 4., "number of sigma for TOF cut for TPC and TOF combined pion"}; Configurable dwnSmplFactorPi{"dwnSmplFactorPi", 1., "downsampling factor for pions, default fraction to keep is 1."}; /// pT dependent downsampling - Configurable sqrtSNN{"sqrtSNN", 0., "sqrt(s_NN), used for downsampling with the Tsallis distribution"}; + Configurable sqrtSNN{"sqrtSNN", 5360., "sqrt(s_NN), used for downsampling with the Tsallis distribution"}; Configurable downsamplingTsalisTritons{"downsamplingTsalisTritons", -1., "Downsampling factor to reduce the number of tritons"}; Configurable downsamplingTsalisDeuterons{"downsamplingTsalisDeuterons", -1., "Downsampling factor to reduce the number of deuterons"}; Configurable downsamplingTsalisProtons{"downsamplingTsalisProtons", -1., "Downsampling factor to reduce the number of protons"}; Configurable downsamplingTsalisKaons{"downsamplingTsalisKaons", -1., "Downsampling factor to reduce the number of kaons"}; Configurable downsamplingTsalisPions{"downsamplingTsalisPions", -1., "Downsampling factor to reduce the number of pions"}; - enum { - TrackSelectionNoCut = 0, - TrackSelectionGlobalTrack, - TrackSelectionTrackWoPtEta, - TrackSelectionGlobalTrackWoDCA, - TrackSelectionQualityTracks, - TrackSelectionInAcceptanceTracks - }; - - enum { - EventSelectionNo = 0, - EventSelectionRun2, - EventSelectionRun3 - }; - Filter trackFilter = (trackSelection.node() == static_cast(TrackSelectionNoCut)) || ((trackSelection.node() == static_cast(TrackSelectionGlobalTrack)) && requireGlobalTrackInFilter()) || ((trackSelection.node() == static_cast(TrackSelectionTrackWoPtEta)) && requireGlobalTrackWoPtEtaInFilter()) || @@ -745,38 +716,11 @@ struct TreeWriterTPCTOF { double nSigmaTpcTpctof; }; - double tsalisCharged(const double pt, const double mass) - { - const double a = 6.81, b = 59.24; - const double c = 0.082, d = 0.151; - double mt = std::sqrt(mass * mass + pt * pt); - double n = a + b / sqrtSNN; - double t = c + d / sqrtSNN; - double p0 = n * t; - double result = std::pow((1. + mt / p0), -n); - return result; - }; - - /// Random downsampling trigger function using Tsalis/Hagedorn spectra fit (sqrt(s) = 62.4 GeV to 13 TeV) - /// as in https://iopscience.iop.org/article/10.1088/2399-6528/aab00f/pdf TRandom3* fRndm = new TRandom3(0); - bool downsampleTsalisCharged(const double pt, const float factor1Pt, const double mass) - { - if (factor1Pt < 0.) { - return true; - } - const double prob = tsalisCharged(pt, mass) * pt; - const double probNorm = tsalisCharged(1., mass); - if ((fRndm->Rndm() * ((prob / probNorm) * pt * pt)) > factor1Pt) { - return false; - } else { - return true; - } - }; /// Function to fill trees template - void fillSkimmedTPCTOFTable(T const& track, C const& collision, const float nSigmaTPC, const float nSigmaTOF, const float dEdxExp, const o2::track::PID::ID id, const int runnumber, const double dwnSmplFactor, const double hadronicRate) + void fillSkimmedTPCTOFTable(T const& track, C const& collision, const float nSigmaTPC, const float nSigmaTOF, const float nSigmaITS, const float dEdxExp, const o2::track::PID::ID id, const int runnumber, const double dwnSmplFactor, const double hadronicRate) { const double ncl = track.tpcNClsFound(); @@ -815,7 +759,8 @@ struct TreeWriterTPCTOF { runnumber, trackOcc, ft0Occ, - hadronicRate); + hadronicRate, + nSigmaITS); } }; @@ -856,11 +801,11 @@ struct TreeWriterTPCTOF { id, nSigmaTPC, nSigmaTOF, - nSigmaITS, runnumber, trackOcc, ft0Occ, hadronicRate, + nSigmaITS, existTrkQA ? trackQA.tpcdEdxNorm() : -999); } else { rowTPCTOFTreeWithTrkQA(usedEdx, @@ -879,11 +824,11 @@ struct TreeWriterTPCTOF { id, nSigmaTPC, nSigmaTOF, - nSigmaITS, runnumber, trackOcc, ft0Occ, hadronicRate, + nSigmaITS, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame, @@ -901,24 +846,13 @@ struct TreeWriterTPCTOF { } } - /// Event selection - template - bool isEventSelected(const CollisionType& collision, const TrackType& /*tracks*/) + void init(o2::framework::InitContext&) { - if (applyEvSel == EventSelectionRun2) { - if (!collision.sel7()) { - return false; - } - } else if (applyEvSel == EventSelectionRun3) { - if (!collision.sel8()) { - return false; - } + const std::array doprocess{doprocessStandard, doprocessStandardWithCorrecteddEdx, doprocessWithdEdxTrQA, doprocessWithdEdxTrQAWithCorrecteddEdx, doprocessWithTrQA, doprocessWithTrQAWithCorrecteddEdx, doprocessDummy}; + if (std::accumulate(doprocess.begin(), doprocess.end(), 0) != 1) { + LOGP(fatal, "One and only one process function should be enabled"); } - return true; - }; - void init(o2::framework::InitContext&) - { ccdb->setURL("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); ccdb->setFatalWhenNull(false); @@ -939,7 +873,7 @@ struct TreeWriterTPCTOF { void runStandard(Colls::iterator const& collision, soa::Filtered const& tracks) { /// Check event selection - if (!isEventSelected(collision, tracks)) { + if (!isEventSelected(collision, applyEvSel)) { return; } const auto& bc = collision.bc_as(); @@ -959,12 +893,12 @@ struct TreeWriterTPCTOF { TofTrack tofPion(false, -999., maxMomTPCOnlyPi, trk.tpcNSigmaPi(), nSigmaTPCOnlyPi, downsamplingTsalisPions, MassPiPlus, trk.tofNSigmaPi(), -999., trk.tpcExpSignalPi(tpcSignalGeneric(trk)), PidPion, dwnSmplFactorPi, nSigmaTofTpctofPi, nSigmaTpcTpctofPi); - for (const auto& tofTrack : {tofTriton, tofDeuteron, tofProton, tofKaon, tofPion}) { - if ((!tofTrack.isApplyHardCutOnly || trk.tpcInnerParam() < tofTrack.maxMomHardCutOnly) && - ((trk.tpcInnerParam() <= tofTrack.maxMomTPCOnly && std::fabs(tofTrack.tpcNSigma) < tofTrack.nSigmaTPCOnly) || - (trk.tpcInnerParam() > tofTrack.maxMomTPCOnly && std::fabs(tofTrack.tofNSigma) < tofTrack.nSigmaTofTpctof && std::fabs(tofTrack.tpcNSigma) < tofTrack.nSigmaTpcTpctof)) && - downsampleTsalisCharged(trk.pt(), tofTrack.downsamplingTsalis, tofTrack.mass)) { - fillSkimmedTPCTOFTable(trk, collision, tofTrack.tpcNSigma, tofTrack.tofNSigma, tofTrack.tpcExpSignal, tofTrack.pid, runnumber, tofTrack.dwnSmplFactor, hadronicRate); + for (const auto& tofTrack : {&tofTriton, &tofDeuteron, &tofProton, &tofKaon, &tofPion}) { + if ((!tofTrack->isApplyHardCutOnly || trk.tpcInnerParam() < tofTrack->maxMomHardCutOnly) && + ((trk.tpcInnerParam() <= tofTrack->maxMomTPCOnly && std::fabs(tofTrack->tpcNSigma) < tofTrack->nSigmaTPCOnly) || + (trk.tpcInnerParam() > tofTrack->maxMomTPCOnly && std::fabs(tofTrack->tofNSigma) < tofTrack->nSigmaTofTpctof && std::fabs(tofTrack->tpcNSigma) < tofTrack->nSigmaTpcTpctof)) && + downsampleTsalisCharged(fRndm, trk.pt(), tofTrack->downsamplingTsalis, tofTrack->mass, sqrtSNN)) { + fillSkimmedTPCTOFTable(trk, collision, tofTrack->tpcNSigma, tofTrack->tofNSigma, tofTrack->itsNSigma, tofTrack->tpcExpSignal, tofTrack->pid, runnumber, tofTrack->dwnSmplFactor, hadronicRate); } } } /// Loop tracks @@ -974,13 +908,13 @@ struct TreeWriterTPCTOF { { runStandard(collision, tracks); } /// process - PROCESS_SWITCH(TreeWriterTPCTOF, processStandard, "Standard Samples for PID", true); + PROCESS_SWITCH(TreeWriterTpcTof, processStandard, "Standard Samples for PID", true); void processStandardWithCorrecteddEdx(Colls::iterator const& collision, soa::Filtered const& tracks, aod::BCsWithTimestamps const&) { runStandard(collision, tracks); } /// process - PROCESS_SWITCH(TreeWriterTPCTOF, processStandardWithCorrecteddEdx, "Standard Samples for PID with corrected dEdx", false); + PROCESS_SWITCH(TreeWriterTpcTof, processStandardWithCorrecteddEdx, "Standard Samples for PID with corrected dEdx", false); Preslice perCollisionTracks = aod::track::collisionId; Preslice perCollisionTracksWithCorrecteddEdx = aod::track::collisionId; @@ -988,18 +922,15 @@ struct TreeWriterTPCTOF { template void runWithTrQAGeneric(Colls const& collisions, TrksType const& myTracks, aod::TracksQAVersion const& tracksQA, Preslice const& perCollisionTracksType) { - std::vector labelTrack2TrackQA; - labelTrack2TrackQA.clear(); - labelTrack2TrackQA.resize(myTracks.size(), -1); + std::vector labelTrack2TrackQA(myTracks.size(), -1); for (const auto& trackQA : tracksQA) { - int64_t trackId = trackQA.trackId(); - int64_t trackQAIndex = trackQA.globalIndex(); - labelTrack2TrackQA[trackId] = trackQAIndex; + const int64_t trackId = trackQA.trackId(); + labelTrack2TrackQA.at(trackId) = trackQA.globalIndex(); } for (const auto& collision : collisions) { /// Check event selection const auto& tracks = myTracks.sliceBy(perCollisionTracksType, collision.globalIndex()); - if (!isEventSelected(collision, tracks)) { + if (!isEventSelected(collision, applyEvSel)) { continue; } const auto& tracksWithITSPid = soa::Attach(trk)), PidTriton, dwnSmplFactorTr, nSigmaTofTpctofTr, nSigmaTpcTpctofTr); @@ -1051,12 +972,12 @@ struct TreeWriterTPCTOF { TofTrack tofPion(false, -999., maxMomTPCOnlyPi, trk.tpcNSigmaPi(), nSigmaTPCOnlyPi, downsamplingTsalisPions, MassPiPlus, trk.tofNSigmaPi(), trk.itsNSigmaPi(), trk.tpcExpSignalPi(tpcSignalGeneric(trk)), PidPion, dwnSmplFactorPi, nSigmaTofTpctofPi, nSigmaTpcTpctofPi); - for (const auto& tofTrack : {tofTriton, tofDeuteron, tofProton, tofKaon, tofPion}) { - if ((!tofTrack.isApplyHardCutOnly || trk.tpcInnerParam() < tofTrack.maxMomHardCutOnly) && - ((trk.tpcInnerParam() <= tofTrack.maxMomTPCOnly && std::fabs(tofTrack.tpcNSigma) < tofTrack.nSigmaTPCOnly) || - (trk.tpcInnerParam() > tofTrack.maxMomTPCOnly && std::fabs(tofTrack.tofNSigma) < tofTrack.nSigmaTofTpctof && std::fabs(tofTrack.tpcNSigma) < tofTrack.nSigmaTpcTpctof)) && - downsampleTsalisCharged(trk.pt(), tofTrack.downsamplingTsalis, tofTrack.mass)) { - fillSkimmedTPCTOFTableWithTrkQAGeneric(trk, trackQA, existTrkQA, collision, tofTrack.tpcNSigma, tofTrack.tofNSigma, tofTrack.itsNSigma, tofTrack.tpcExpSignal, tofTrack.pid, runnumber, tofTrack.dwnSmplFactor, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); + for (const auto& tofTrack : {&tofTriton, &tofDeuteron, &tofProton, &tofKaon, &tofPion}) { + if ((!tofTrack->isApplyHardCutOnly || trk.tpcInnerParam() < tofTrack->maxMomHardCutOnly) && + ((trk.tpcInnerParam() <= tofTrack->maxMomTPCOnly && std::fabs(tofTrack->tpcNSigma) < tofTrack->nSigmaTPCOnly) || + (trk.tpcInnerParam() > tofTrack->maxMomTPCOnly && std::fabs(tofTrack->tofNSigma) < tofTrack->nSigmaTofTpctof && std::fabs(tofTrack->tpcNSigma) < tofTrack->nSigmaTpcTpctof)) && + downsampleTsalisCharged(fRndm, trk.pt(), tofTrack->downsamplingTsalis, tofTrack->mass, sqrtSNN)) { + fillSkimmedTPCTOFTableWithTrkQAGeneric(trk, trackQA, existTrkQA, collision, tofTrack->tpcNSigma, tofTrack->tofNSigma, tofTrack->itsNSigma, tofTrack->tpcExpSignal, tofTrack->pid, runnumber, tofTrack->dwnSmplFactor, hadronicRate, bcGlobalIndex, bcTimeFrameId, bcBcInTimeFrame); } } } /// Loop tracks @@ -1067,33 +988,33 @@ struct TreeWriterTPCTOF { { runWithTrQAGeneric(collisions, myTracks, tracksQA, perCollisionTracks); } /// process - PROCESS_SWITCH(TreeWriterTPCTOF, processWithdEdxTrQA, "Samples for PID with TrackQA info", false); + PROCESS_SWITCH(TreeWriterTpcTof, processWithdEdxTrQA, "Samples for PID with TrackQA info", false); void processWithdEdxTrQAWithCorrecteddEdx(Colls const& collisions, TrksWithDEdxCorrection const& myTracks, aod::BCsWithTimestamps const&, aod::TracksQAVersion const& tracksQA) { runWithTrQAGeneric(collisions, myTracks, tracksQA, perCollisionTracksWithCorrecteddEdx); } /// process - PROCESS_SWITCH(TreeWriterTPCTOF, processWithdEdxTrQAWithCorrecteddEdx, "Samples for PID with TrackQA info with corrected dEdx", false); + PROCESS_SWITCH(TreeWriterTpcTof, processWithdEdxTrQAWithCorrecteddEdx, "Samples for PID with TrackQA info with corrected dEdx", false); void processWithTrQA(Colls const& collisions, Trks const& myTracks, MyBCTable const&, aod::TracksQAVersion const& tracksQA) { runWithTrQAGeneric(collisions, myTracks, tracksQA, perCollisionTracks); } /// process - PROCESS_SWITCH(TreeWriterTPCTOF, processWithTrQA, "Samples for PID with TrackQA info", false); + PROCESS_SWITCH(TreeWriterTpcTof, processWithTrQA, "Samples for PID with TrackQA info", false); void processWithTrQAWithCorrecteddEdx(Colls const& collisions, TrksWithDEdxCorrection const& myTracks, MyBCTable const&, aod::TracksQAVersion const& tracksQA) { runWithTrQAGeneric(collisions, myTracks, tracksQA, perCollisionTracksWithCorrecteddEdx); } /// process - PROCESS_SWITCH(TreeWriterTPCTOF, processWithTrQAWithCorrecteddEdx, "Samples for PID with TrackQA info with correced dEdx", false); + PROCESS_SWITCH(TreeWriterTpcTof, processWithTrQAWithCorrecteddEdx, "Samples for PID with TrackQA info with correced dEdx", false); void processDummy(Colls const&) {} - PROCESS_SWITCH(TreeWriterTPCTOF, processDummy, "Dummy function", false); + PROCESS_SWITCH(TreeWriterTpcTof, processDummy, "Dummy function", false); -}; /// struct TreeWriterTPCTOF +}; /// struct TreeWriterTpcTof WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - auto workflow = WorkflowSpec{adaptAnalysisTask(cfgc)}; + auto workflow = WorkflowSpec{adaptAnalysisTask(cfgc)}; workflow.push_back(adaptAnalysisTask(cfgc)); return workflow; } diff --git a/DPG/Tasks/TPC/tpcSkimsTableCreator.h b/DPG/Tasks/TPC/tpcSkimsTableCreator.h index decb3a9de60..f47a784dfb5 100644 --- a/DPG/Tasks/TPC/tpcSkimsTableCreator.h +++ b/DPG/Tasks/TPC/tpcSkimsTableCreator.h @@ -14,30 +14,32 @@ /// \author Christian Sonnabend /// \author Jeremy Wilkinson /// \author Ana Marin +/// \author Oleksii Lubynets /// \brief Creates clean samples of particles for PID fits #ifndef DPG_TASKS_TPC_TPCSKIMSTABLECREATOR_H_ #define DPG_TASKS_TPC_TPCSKIMSTABLECREATOR_H_ -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" #include "Common/Core/trackUtilities.h" #include "Common/DataModel/PIDResponse.h" +#include +#include + namespace o2::aod { namespace tpcskims { -DECLARE_SOA_COLUMN(InvDeDxExpTPC, invdEdxExpTPC, float); +DECLARE_SOA_COLUMN(InvDeDxExpTPC, invDeDxExpTPC, float); DECLARE_SOA_COLUMN(Mass, mass, float); -DECLARE_SOA_COLUMN(BetaGamma, bg, float); +DECLARE_SOA_COLUMN(BetaGamma, betaGamma, float); DECLARE_SOA_COLUMN(NormMultTPC, normMultTPC, float); DECLARE_SOA_COLUMN(NormNClustersTPC, normNClustersTPC, float); DECLARE_SOA_COLUMN(NormNClustersTPCPID, normNClustersTPCPID, float); -DECLARE_SOA_COLUMN(PidIndex, pidIndexTPC, uint8_t); -DECLARE_SOA_COLUMN(NSigTPC, nsigTPC, float); -DECLARE_SOA_COLUMN(NSigTOF, nsigTOF, float); -DECLARE_SOA_COLUMN(NSigITS, nsigITS, float); +DECLARE_SOA_COLUMN(PidIndex, pidIndex, uint8_t); +DECLARE_SOA_COLUMN(NSigTPC, nSigTPC, float); +DECLARE_SOA_COLUMN(NSigTOF, nSigTOF, float); +DECLARE_SOA_COLUMN(NSigITS, nSigITS, float); DECLARE_SOA_COLUMN(AlphaV0, alphaV0, float); DECLARE_SOA_COLUMN(QtV0, qtV0, float); DECLARE_SOA_COLUMN(CosPAV0, cosPAV0, float); @@ -52,181 +54,83 @@ DECLARE_SOA_COLUMN(BcGlobalIndex, bcGlobalIndex, int); DECLARE_SOA_COLUMN(BcTimeFrameId, bcTimeFrameId, int); DECLARE_SOA_COLUMN(BcBcInTimeFrame, bcBcInTimeFrame, int); } // namespace tpcskims + +#define TPCSKIMS_COLUMNS_BASE \ + o2::aod::track::TPCSignal, \ + tpcskims::InvDeDxExpTPC, \ + o2::aod::track::TPCInnerParam, \ + o2::aod::track::Tgl, \ + o2::aod::track::Signed1Pt, \ + o2::aod::track::Eta, \ + o2::aod::track::Phi, \ + o2::aod::track::Y, \ + tpcskims::Mass, \ + tpcskims::BetaGamma, \ + tpcskims::NormMultTPC, \ + tpcskims::NormNClustersTPC, \ + tpcskims::NormNClustersTPCPID, \ + tpcskims::PidIndex, \ + tpcskims::NSigTPC, \ + tpcskims::NSigTOF, \ + tpcskims::RunNumber, \ + tpcskims::TrackOcc, \ + tpcskims::Ft0Occ, \ + tpcskims::HadronicRate + +#define TPCSKIMS_COLUMNS_V0 \ + TPCSKIMS_COLUMNS_BASE, \ + tpcskims::AlphaV0, \ + tpcskims::QtV0, \ + tpcskims::CosPAV0, \ + tpcskims::PtV0, \ + tpcskims::RadiusV0, \ + tpcskims::GammaPsiPair + +#define TPCSKIMS_COLUMNS_TOF \ + TPCSKIMS_COLUMNS_BASE, \ + tpcskims::NSigITS + +#define TPCSKIMS_COLUMNS_TRACK_QA \ + tpcskims::BcGlobalIndex, \ + tpcskims::BcTimeFrameId, \ + tpcskims::BcBcInTimeFrame, \ + o2::aod::trackqa::TPCClusterByteMask, \ + o2::aod::trackqa::TPCdEdxMax0R, \ + o2::aod::trackqa::TPCdEdxMax1R, \ + o2::aod::trackqa::TPCdEdxMax2R, \ + o2::aod::trackqa::TPCdEdxMax3R, \ + o2::aod::trackqa::TPCdEdxTot0R, \ + o2::aod::trackqa::TPCdEdxTot1R, \ + o2::aod::trackqa::TPCdEdxTot2R, \ + o2::aod::trackqa::TPCdEdxTot3R + DECLARE_SOA_TABLE(SkimmedTPCV0Tree, "AOD", "TPCSKIMV0TREE", - o2::aod::track::TPCSignal, - tpcskims::InvDeDxExpTPC, - o2::aod::track::TPCInnerParam, - o2::aod::track::Tgl, - o2::aod::track::Signed1Pt, - o2::aod::track::Eta, - o2::aod::track::Phi, - o2::aod::track::Y, - tpcskims::Mass, - tpcskims::BetaGamma, - tpcskims::NormMultTPC, - tpcskims::NormNClustersTPC, - tpcskims::NormNClustersTPCPID, - tpcskims::PidIndex, - tpcskims::NSigTPC, - tpcskims::NSigTOF, - tpcskims::AlphaV0, - tpcskims::QtV0, - tpcskims::CosPAV0, - tpcskims::PtV0, - tpcskims::RadiusV0, - tpcskims::GammaPsiPair, - tpcskims::RunNumber, - tpcskims::TrackOcc, - tpcskims::Ft0Occ, - tpcskims::HadronicRate); + TPCSKIMS_COLUMNS_V0); + DECLARE_SOA_TABLE(SkimmedTPCV0TreeWithdEdxTrkQA, "AOD", "TPCSKIMV0WdE", - o2::aod::track::TPCSignal, - tpcskims::InvDeDxExpTPC, - o2::aod::track::TPCInnerParam, - o2::aod::track::Tgl, - o2::aod::track::Signed1Pt, - o2::aod::track::Eta, - o2::aod::track::Phi, - o2::aod::track::Y, - tpcskims::Mass, - tpcskims::BetaGamma, - tpcskims::NormMultTPC, - tpcskims::NormNClustersTPC, - tpcskims::NormNClustersTPCPID, - tpcskims::PidIndex, - tpcskims::NSigTPC, - tpcskims::NSigTOF, - tpcskims::AlphaV0, - tpcskims::QtV0, - tpcskims::CosPAV0, - tpcskims::PtV0, - tpcskims::RadiusV0, - tpcskims::GammaPsiPair, - tpcskims::RunNumber, - tpcskims::TrackOcc, - tpcskims::Ft0Occ, - tpcskims::HadronicRate, + TPCSKIMS_COLUMNS_V0, o2::aod::trackqa::TPCdEdxNorm); + DECLARE_SOA_TABLE(SkimmedTPCV0TreeWithTrkQA, "AOD", "TPCSKIMV0WQA", - o2::aod::track::TPCSignal, - tpcskims::InvDeDxExpTPC, - o2::aod::track::TPCInnerParam, - o2::aod::track::Tgl, - o2::aod::track::Signed1Pt, - o2::aod::track::Eta, - o2::aod::track::Phi, - o2::aod::track::Y, - tpcskims::Mass, - tpcskims::BetaGamma, - tpcskims::NormMultTPC, - tpcskims::NormNClustersTPC, - tpcskims::NormNClustersTPCPID, - tpcskims::PidIndex, - tpcskims::NSigTPC, - tpcskims::NSigTOF, - tpcskims::AlphaV0, - tpcskims::QtV0, - tpcskims::CosPAV0, - tpcskims::PtV0, - tpcskims::RadiusV0, - tpcskims::GammaPsiPair, - tpcskims::RunNumber, - tpcskims::TrackOcc, - tpcskims::Ft0Occ, - tpcskims::HadronicRate, - tpcskims::BcGlobalIndex, - tpcskims::BcTimeFrameId, - tpcskims::BcBcInTimeFrame, - o2::aod::trackqa::TPCClusterByteMask, - o2::aod::trackqa::TPCdEdxMax0R, - o2::aod::trackqa::TPCdEdxMax1R, - o2::aod::trackqa::TPCdEdxMax2R, - o2::aod::trackqa::TPCdEdxMax3R, - o2::aod::trackqa::TPCdEdxTot0R, - o2::aod::trackqa::TPCdEdxTot1R, - o2::aod::trackqa::TPCdEdxTot2R, - o2::aod::trackqa::TPCdEdxTot3R, + TPCSKIMS_COLUMNS_V0, + TPCSKIMS_COLUMNS_TRACK_QA, o2::aod::trackqa::TPCdEdxNorm); DECLARE_SOA_TABLE(SkimmedTPCTOFTree, "AOD", "TPCTOFSKIMTREE", - o2::aod::track::TPCSignal, - tpcskims::InvDeDxExpTPC, - o2::aod::track::TPCInnerParam, - o2::aod::track::Tgl, - o2::aod::track::Signed1Pt, - o2::aod::track::Eta, - o2::aod::track::Phi, - o2::aod::track::Y, - tpcskims::Mass, - tpcskims::BetaGamma, - tpcskims::NormMultTPC, - tpcskims::NormNClustersTPC, - tpcskims::NormNClustersTPCPID, - tpcskims::PidIndex, - tpcskims::NSigTPC, - tpcskims::NSigTOF, - tpcskims::RunNumber, - tpcskims::TrackOcc, - tpcskims::Ft0Occ, - tpcskims::HadronicRate); + TPCSKIMS_COLUMNS_TOF); DECLARE_SOA_TABLE(SkimmedTPCTOFTreeWithdEdxTrkQA, "AOD", "TPCTOFSKIMWdE", - o2::aod::track::TPCSignal, - tpcskims::InvDeDxExpTPC, - o2::aod::track::TPCInnerParam, - o2::aod::track::Tgl, - o2::aod::track::Signed1Pt, - o2::aod::track::Eta, - o2::aod::track::Phi, - o2::aod::track::Y, - tpcskims::Mass, - tpcskims::BetaGamma, - tpcskims::NormMultTPC, - tpcskims::NormNClustersTPC, - tpcskims::NormNClustersTPCPID, - tpcskims::PidIndex, - tpcskims::NSigTPC, - tpcskims::NSigTOF, - tpcskims::NSigITS, - tpcskims::RunNumber, - tpcskims::TrackOcc, - tpcskims::Ft0Occ, - tpcskims::HadronicRate, + TPCSKIMS_COLUMNS_TOF, o2::aod::trackqa::TPCdEdxNorm); + DECLARE_SOA_TABLE(SkimmedTPCTOFTreeWithTrkQA, "AOD", "TPCTOFSKIMWQA", - o2::aod::track::TPCSignal, - tpcskims::InvDeDxExpTPC, - o2::aod::track::TPCInnerParam, - o2::aod::track::Tgl, - o2::aod::track::Signed1Pt, - o2::aod::track::Eta, - o2::aod::track::Phi, - o2::aod::track::Y, - tpcskims::Mass, - tpcskims::BetaGamma, - tpcskims::NormMultTPC, - tpcskims::NormNClustersTPC, - tpcskims::NormNClustersTPCPID, - tpcskims::PidIndex, - tpcskims::NSigTPC, - tpcskims::NSigTOF, - tpcskims::NSigITS, - tpcskims::RunNumber, - tpcskims::TrackOcc, - tpcskims::Ft0Occ, - tpcskims::HadronicRate, - tpcskims::BcGlobalIndex, - tpcskims::BcTimeFrameId, - tpcskims::BcBcInTimeFrame, - o2::aod::trackqa::TPCClusterByteMask, - o2::aod::trackqa::TPCdEdxMax0R, - o2::aod::trackqa::TPCdEdxMax1R, - o2::aod::trackqa::TPCdEdxMax2R, - o2::aod::trackqa::TPCdEdxMax3R, - o2::aod::trackqa::TPCdEdxTot0R, - o2::aod::trackqa::TPCdEdxTot1R, - o2::aod::trackqa::TPCdEdxTot2R, - o2::aod::trackqa::TPCdEdxTot3R, + TPCSKIMS_COLUMNS_TOF, + TPCSKIMS_COLUMNS_TRACK_QA, o2::aod::trackqa::TPCdEdxNorm); + +#undef TPCSKIMS_COLUMNS_TRACK_QA +#undef TPCSKIMS_COLUMNS_TOF +#undef TPCSKIMS_COLUMNS_V0 +#undef TPCSKIMS_COLUMNS_BASE } // namespace o2::aod #endif // DPG_TASKS_TPC_TPCSKIMSTABLECREATOR_H_ diff --git a/DPG/Tasks/TPC/utilsTpcSkimsTableCreator.h b/DPG/Tasks/TPC/utilsTpcSkimsTableCreator.h new file mode 100644 index 00000000000..99c304959f0 --- /dev/null +++ b/DPG/Tasks/TPC/utilsTpcSkimsTableCreator.h @@ -0,0 +1,102 @@ +// 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 utilsTpcSkimsTableCreator.h +/// \author Annalena Kalteyer +/// \author Christian Sonnabend +/// \author Jeremy Wilkinson +/// \author Ana Marin +/// \author Oleksii Lubynets +/// \brief Helper functions used both in V0 and TOF structs of tpcSkimsTableCreator.cxx + +#ifndef DPG_TASKS_TPC_UTILSTPCSKIMSTABLECREATOR_H_ +#define DPG_TASKS_TPC_UTILSTPCSKIMSTABLECREATOR_H_ + +#include + +namespace o2::dpg_tpcskimstablecreator +{ +enum { + TrackSelectionNoCut = 0, + TrackSelectionGlobalTrack, + TrackSelectionTrackWoPtEta, + TrackSelectionGlobalTrackWoDCA, + TrackSelectionQualityTracks, + TrackSelectionInAcceptanceTracks +}; + +enum { + EventSelectionNo = 0, + EventSelectionRun2, + EventSelectionRun3 +}; + +/// Event selection +template +inline bool isEventSelected(const CollisionType& collision, const int applyEvSel) +{ + if (applyEvSel == EventSelectionRun2) { + if (!collision.sel7()) { + return false; + } + } else if (applyEvSel == EventSelectionRun3) { + if (!collision.sel8()) { + return false; + } + } + return true; +}; + +/// Random downsampling trigger function using Tsalis/Hagedorn spectra fit (sqrt(s) = 62.4 GeV to 13 TeV) +/// as in https://iopscience.iop.org/article/10.1088/2399-6528/aab00f/pdf +inline bool downsampleTsalisCharged(TRandom3* fRndm, const double pt, const double factor1Pt, const double mass, const double sqrtSNN, const double maxPt = 1e9) +{ + if (factor1Pt < 0. || pt > maxPt) { + return true; + } + + auto tsalisCharged = [&](const double pT) { + const double a = 6.81, b = 59.24; + const double c = 0.082, d = 0.151; + const double mt = std::sqrt(mass * mass + pT * pT); + const double n = a + b / sqrtSNN; + const double t = c + d / sqrtSNN; + const double p0 = n * t; + const double result = std::pow((1. + mt / p0), -n); + return result; + }; + + const double prob = tsalisCharged(pt) * pt; + const double probNorm = tsalisCharged(1.); + if ((fRndm->Rndm() * ((prob / probNorm) * pt * pt)) > factor1Pt) { + return false; + } else { + return true; + } +}; + +// Track selection +template +inline bool isTrackSelected(const TrackType& track, const int trackSelection) +{ + bool isSelected{false}; + isSelected |= trackSelection == TrackSelectionNoCut; + isSelected |= (trackSelection == TrackSelectionGlobalTrack) && track.isGlobalTrack(); + isSelected |= (trackSelection == TrackSelectionTrackWoPtEta) && track.isGlobalTrackWoPtEta(); + isSelected |= (trackSelection == TrackSelectionGlobalTrackWoDCA) && track.isGlobalTrackWoDCA(); + isSelected |= (trackSelection == TrackSelectionQualityTracks) && track.isQualityTrack(); + isSelected |= (trackSelection == TrackSelectionInAcceptanceTracks) && track.isInAcceptanceTrack(); + + return isSelected; +} + +} // namespace o2::dpg_tpcskimstablecreator +#endif // DPG_TASKS_TPC_UTILSTPCSKIMSTABLECREATOR_H_ From 65082ef708d387a80c29b56dd346c168703c0f58 Mon Sep 17 00:00:00 2001 From: Junlee Kim Date: Fri, 31 Oct 2025 03:27:57 +0900 Subject: [PATCH 958/986] [Common] [Commom/event plane] removing zero amplitude cases (#13605) --- Common/Tasks/qVectorsCorrection.cxx | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/Common/Tasks/qVectorsCorrection.cxx b/Common/Tasks/qVectorsCorrection.cxx index b3f8dcbb3d9..4ef6490358f 100644 --- a/Common/Tasks/qVectorsCorrection.cxx +++ b/Common/Tasks/qVectorsCorrection.cxx @@ -180,9 +180,11 @@ struct qVectorsCorrection { AxisSpec axisShift = {10, 0, 10, "shift"}; AxisSpec axisBasis = {20, 0, 20, "basis"}; + AxisSpec axisVertex = {220, -11, 11, "vertex"}; - histosQA.add("histCentFull", "Centrality distribution for valid events", - HistType::kTH1F, {axisCent}); + histosQA.add("histCentFull", "Centrality distribution for valid events", HistType::kTH1F, {axisCent}); + histosQA.add("histCentSelected", "Centrality distribution for valid events", HistType::kTH1F, {axisCent}); + histosQA.add("histVtxSelected", "Centrality distribution for valid events", HistType::kTH1F, {axisVertex}); for (uint i = 0; i < cfgnMods->size(); i++) { histosQA.add(Form("histQvecUncorV%d", cfgnMods->at(i)), "", {HistType::kTH3F, {axisQvecF, axisQvecF, axisCent}}); @@ -268,6 +270,10 @@ struct qVectorsCorrection { int RefAInd = RefAId * 4 + cfgnTotalSystem * 4 * (nmode - 2) + 3; int RefBInd = RefBId * 4 + cfgnTotalSystem * 4 * (nmode - 2) + 3; + if (vec.qvecAmp()[DetId] < 1e-8 || vec.qvecAmp()[RefAId] < 1e-8 || vec.qvecAmp()[RefBId] < 1e-8) { + return; + } + if (nmode == 2) { for (int ishift = 1; ishift <= 10; ishift++) { histosQA.fill(HIST("histShiftV2"), vec.cent(), 2.0 * DetId + 0.5, ishift - 0.5, TMath::Sin(ishift * static_cast(nmode) * TMath::ATan2(vec.qvecIm()[DetInd], vec.qvecRe()[DetInd]) / static_cast(nmode))); @@ -311,6 +317,10 @@ struct qVectorsCorrection { int RefAInd = RefAId + cfgnTotalSystem * (nmode - 2); int RefBInd = RefBId + cfgnTotalSystem * (nmode - 2); + if (coll.qvecAmp()[DetId] < 1e-8 || coll.qvecAmp()[RefAId] < 1e-8 || coll.qvecAmp()[RefBId] < 1e-8) { + return; + } + for (auto& trk : track) { if (!SelTrack(trk)) { continue; @@ -424,6 +434,11 @@ struct qVectorsCorrection { int DetInd = DetId + cfgnTotalSystem * (nmode - 2); int RefAInd = RefAId + cfgnTotalSystem * (nmode - 2); int RefBInd = RefBId + cfgnTotalSystem * (nmode - 2); + + if (vec.qvecAmp()[DetId] < 1e-8 || vec.qvecAmp()[RefAId] < 1e-8 || vec.qvecAmp()[RefBId] < 1e-8) { + return; + } + if (nmode == 2) { histosQA.fill(HIST("histQvecFinalV2"), vec.qvecShiftedRe()[DetInd], vec.qvecShiftedIm()[DetInd], vec.cent()); histosQA.fill(HIST("histEvtPlFinalV2"), helperEP.GetEventPlane(vec.qvecShiftedRe()[DetInd], vec.qvecShiftedIm()[DetInd], nmode), vec.cent()); @@ -723,6 +738,8 @@ struct qVectorsCorrection { if (qVec.trackOccupancyInTimeRange() > cfgMaxOccupancy || qVec.trackOccupancyInTimeRange() < cfgMinOccupancy) return; } + histosQA.fill(HIST("histCentSelected"), qVec.cent()); + histosQA.fill(HIST("histVtxSelected"), qVec.posZ()); if (cfgShiftCorPrep) { for (uint i = 0; i < cfgnMods->size(); i++) { @@ -768,6 +785,8 @@ struct qVectorsCorrection { if (qVec.trackOccupancyInTimeRange() > cfgMaxOccupancy || qVec.trackOccupancyInTimeRange() < cfgMinOccupancy) return; } + histosQA.fill(HIST("histCentSelected"), qVec.cent()); + histosQA.fill(HIST("histVtxSelected"), qVec.posZ()); for (uint i = 0; i < cfgnMods->size(); i++) { fillHistosQvecWithSC(qVec, cfgnMods->at(i)); From 22818560317c5b298f570c6ca8196514fb93f88a Mon Sep 17 00:00:00 2001 From: abmodak <67369858+abmodak@users.noreply.github.com> Date: Thu, 30 Oct 2025 21:43:39 +0100 Subject: [PATCH 959/986] [PWGCF] Add derived table producer for longrange correlation (#13608) --- .../DataModel/longrangeDerived.h | 117 ++++ .../TableProducer/CMakeLists.txt | 5 + .../TableProducer/longrangeMaker.cxx | 578 ++++++++++++++++++ 3 files changed, 700 insertions(+) create mode 100644 PWGCF/TwoParticleCorrelations/DataModel/longrangeDerived.h create mode 100644 PWGCF/TwoParticleCorrelations/TableProducer/longrangeMaker.cxx diff --git a/PWGCF/TwoParticleCorrelations/DataModel/longrangeDerived.h b/PWGCF/TwoParticleCorrelations/DataModel/longrangeDerived.h new file mode 100644 index 00000000000..68323b52476 --- /dev/null +++ b/PWGCF/TwoParticleCorrelations/DataModel/longrangeDerived.h @@ -0,0 +1,117 @@ +// 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 longrangeDerived.h +/// +/// \brief task derived table definition for long range correlation +/// \author Abhi Modak (abhi.modak@cern.ch) +/// \since October 28, 2025 + +#ifndef PWGCF_TWOPARTICLECORRELATIONS_DATAMODEL_LONGRANGEDERIVED_H_ +#define PWGCF_TWOPARTICLECORRELATIONS_DATAMODEL_LONGRANGEDERIVED_H_ + +#include "Framework/ASoA.h" +#include "Framework/AnalysisDataModel.h" + +namespace o2::aod +{ +namespace LRCorrCollTable +{ +DECLARE_SOA_COLUMN(Zvtx, zvtx, float); +DECLARE_SOA_COLUMN(Multiplicity, multiplicity, float); +DECLARE_SOA_COLUMN(Centrality, centrality, float); +} // namespace LRCorrCollTable + +DECLARE_SOA_TABLE(CollLRTables, "AOD", "COLLLRTABLE", + o2::soa::Index<>, + bc::RunNumber, + LRCorrCollTable::Zvtx, + LRCorrCollTable::Multiplicity, + LRCorrCollTable::Centrality, + timestamp::Timestamp); +using CollLRTable = CollLRTables::iterator; + +namespace LRCorrTrkTable +{ +DECLARE_SOA_INDEX_COLUMN(CollLRTable, collLRTable); +DECLARE_SOA_COLUMN(Pt, pt, float); +DECLARE_SOA_COLUMN(Eta, eta, float); +DECLARE_SOA_COLUMN(Phi, phi, float); +DECLARE_SOA_COLUMN(ChannelID, channelID, int); +DECLARE_SOA_COLUMN(Amplitude, amplitude, float); +DECLARE_SOA_COLUMN(InvMass, invMass, float); +DECLARE_SOA_COLUMN(IdPos, idPos, int64_t); +DECLARE_SOA_COLUMN(IdNeg, idNeg, int64_t); +DECLARE_SOA_COLUMN(TrackType, trackType, uint8_t); +DECLARE_SOA_COLUMN(V0Type, v0Type, uint8_t); +enum TrackPid { + kSpCharge, + kSpPion, + kSpKaon, + kSpProton +}; +enum V0TrackPid { + kSpK0short, + kSpLambda, + kSpALambda +}; +} // namespace LRCorrTrkTable + +DECLARE_SOA_TABLE(TrkLRTables, "AOD", "TRKLRTABLE", + o2::soa::Index<>, + LRCorrTrkTable::CollLRTableId, + LRCorrTrkTable::Pt, + LRCorrTrkTable::Eta, + LRCorrTrkTable::Phi, + LRCorrTrkTable::TrackType); +using TrkLRTable = TrkLRTables::iterator; + +DECLARE_SOA_TABLE(Ft0aLRTables, "AOD", "FT0ALRTABLE", + o2::soa::Index<>, + LRCorrTrkTable::CollLRTableId, + LRCorrTrkTable::ChannelID, + LRCorrTrkTable::Amplitude, + LRCorrTrkTable::Eta, + LRCorrTrkTable::Phi); +using Ft0aLRTable = Ft0aLRTables::iterator; + +DECLARE_SOA_TABLE(Ft0cLRTables, "AOD", "FT0CLRTABLE", + o2::soa::Index<>, + LRCorrTrkTable::CollLRTableId, + LRCorrTrkTable::ChannelID, + LRCorrTrkTable::Amplitude, + LRCorrTrkTable::Eta, + LRCorrTrkTable::Phi); +using Ft0cLRTable = Ft0cLRTables::iterator; + +DECLARE_SOA_TABLE(V0TrkLRTables, "AOD", "V0TRKLRTABLE", + o2::soa::Index<>, + LRCorrTrkTable::CollLRTableId, + LRCorrTrkTable::IdPos, + LRCorrTrkTable::IdNeg, + LRCorrTrkTable::Pt, + LRCorrTrkTable::Eta, + LRCorrTrkTable::Phi, + LRCorrTrkTable::InvMass, + LRCorrTrkTable::V0Type); +using V0TrkLRTable = V0TrkLRTables::iterator; + +DECLARE_SOA_TABLE(MftTrkLRTables, "AOD", "MFTTRKLRTABLE", + o2::soa::Index<>, + LRCorrTrkTable::CollLRTableId, + LRCorrTrkTable::Pt, + LRCorrTrkTable::Eta, + LRCorrTrkTable::Phi); +using MftTrkLRTable = MftTrkLRTables::iterator; + +} // namespace o2::aod + +#endif // PWGCF_TWOPARTICLECORRELATIONS_DATAMODEL_LONGRANGEDERIVED_H_ diff --git a/PWGCF/TwoParticleCorrelations/TableProducer/CMakeLists.txt b/PWGCF/TwoParticleCorrelations/TableProducer/CMakeLists.txt index c7820c37871..303b864ae53 100644 --- a/PWGCF/TwoParticleCorrelations/TableProducer/CMakeLists.txt +++ b/PWGCF/TwoParticleCorrelations/TableProducer/CMakeLists.txt @@ -28,3 +28,8 @@ o2physics_add_dpl_workflow(two-particle-correlations-filtering SOURCES twoParticleCorrelationsFiltering.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::TwoPartCorrCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(longrange-maker + SOURCES longrangeMaker.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::TwoPartCorrCore + COMPONENT_NAME Analysis) diff --git a/PWGCF/TwoParticleCorrelations/TableProducer/longrangeMaker.cxx b/PWGCF/TwoParticleCorrelations/TableProducer/longrangeMaker.cxx new file mode 100644 index 00000000000..2319b14ae02 --- /dev/null +++ b/PWGCF/TwoParticleCorrelations/TableProducer/longrangeMaker.cxx @@ -0,0 +1,578 @@ +// 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 longrangeMaker.cxx +/// +/// \brief task derived table definition for long range correlation +/// \author Abhi Modak (abhi.modak@cern.ch) +/// \since October 28, 2025 + +#include "PWGCF/Core/CorrelationContainer.h" +#include "PWGCF/Core/PairCuts.h" +#include "PWGCF/TwoParticleCorrelations/DataModel/longrangeDerived.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGMM/Mult/DataModel/bestCollisionTable.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/TrackSelectionDefaults.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/FT0Corrected.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseITS.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CcdbApi.h" +#include "CommonConstants/MathConstants.h" +#include "CommonConstants/PhysicsConstants.h" +#include "DetectorsCommonDataFormats/AlignParam.h" +#include "FT0Base/Geometry.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/PID.h" +#include "ReconstructionDataFormats/Track.h" + +#include +#include +#include +#include + +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::aod::track; +using namespace o2::aod::fwdtrack; +using namespace o2::aod::evsel; +using namespace o2::constants::math; + +auto static constexpr kMinFt0cCell = 96; +AxisSpec axisEvent{15, 0.5, 15.5, "#Event", "EventAxis"}; + +enum KindOfParticles { + PIONS, + KAONS, + PROTONS +}; + +enum KindOfV0 { + kLambda = 0, + kAntiLambda +}; + +struct LongrangeMaker { + + struct : ConfigurableGroup { + Configurable cfgURL{"cfgURL", "http://alice-ccdb.cern.ch", "Address of the CCDB to browse"}; + Configurable noLaterThan{"noLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "Latest acceptable timestamp of creation for the object"}; + } cfgCcdbParam; + + struct : ConfigurableGroup { + Configurable isApplySameBunchPileup{"isApplySameBunchPileup", false, "Enable SameBunchPileup cut"}; + Configurable isApplyGoodZvtxFT0vsPV{"isApplyGoodZvtxFT0vsPV", false, "Enable GoodZvtxFT0vsPV cut"}; + Configurable isApplyGoodITSLayersAll{"isApplyGoodITSLayersAll", false, "Enable GoodITSLayersAll cut"}; + Configurable isApplyExtraCorrCut{"isApplyExtraCorrCut", false, "Enable extra NPVtracks vs FTOC correlation cut"}; + Configurable npvTracksCut{"npvTracksCut", 1.0f, "Apply extra NPVtracks cut"}; + Configurable ft0cCut{"ft0cCut", 1.0f, "Apply extra FT0C cut"}; + Configurable isApplyNoCollInTimeRangeStandard{"isApplyNoCollInTimeRangeStandard", false, "Enable NoCollInTimeRangeStandard cut"}; + Configurable isApplyNoCollInRofStandard{"isApplyNoCollInRofStandard", false, "Enable NoCollInRofStandard cut"}; + Configurable isApplyNoHighMultCollInPrevRof{"isApplyNoHighMultCollInPrevRof", false, "Enable NoHighMultCollInPrevRof cut"}; + Configurable isApplyCentFT0C{"isApplyCentFT0C", false, "Centrality based on FT0C"}; + Configurable isApplyCentFV0A{"isApplyCentFV0A", false, "Centrality based on FV0A"}; + Configurable isApplyCentFT0M{"isApplyCentFT0M", false, "Centrality based on FT0A + FT0C"}; + } cfgevtsel; + + struct : ConfigurableGroup { + Configurable cfgEtaCut{"cfgEtaCut", 0.8f, "Eta range to consider"}; + Configurable cfgPtCutMin{"cfgPtCutMin", 0.2f, "minimum accepted track pT"}; + Configurable cfgPtCutMax{"cfgPtCutMax", 10.0f, "maximum accepted track pT"}; + Configurable cfgPtCutMult{"cfgPtCutMult", 3.0f, "maximum track pT for multiplicity classification"}; + Configurable minNCrossedRowsTPC{"minNCrossedRowsTPC", 70.f, "cut on minimum number of TPC crossed rows"}; + Configurable minTPCNClsFound{"minTPCNClsFound", 50.f, "cut on minimum value of TPC found clusters"}; + Configurable maxDcaZ{"maxDcaZ", 2.f, "cut on maximum abs value of DCA z"}; + Configurable maxChi2PerClusterTPC{"maxChi2PerClusterTPC", 4.f, "cut on maximum value of TPC chi2 per cluster"}; + } cfgtrksel; + + struct : ConfigurableGroup { + Configurable cfigMftEtaMax{"cfigMftEtaMax", -2.5f, "Maximum MFT eta cut"}; + Configurable cfigMftEtaMin{"cfigMftEtaMin", -3.6f, "Minimum MFT eta cut"}; + Configurable cfigMftDcaxy{"cfigMftDcaxy", 2.0f, "cut on DCA xy for MFT tracks"}; + Configurable cfigMftCluster{"cfigMftCluster", 5, "cut on MFT Cluster"}; + Configurable useMftPtCut{"useMftPtCut", true, "Choose to apply MFT track pT cut"}; + Configurable cfgMftPtCutMin{"cfgMftPtCutMin", 0.f, "minimum accepted MFT track pT"}; + Configurable cfgMftPtCutMax{"cfgMftPtCutMax", 10.f, "maximum accepted MFT track pT"}; + } cfgmfttrksel; + + struct : ConfigurableGroup { + Configurable minTPCcrossedrows{"minTPCcrossedrows", 70.f, "cut on minimum number of crossed rows in TPC"}; + Configurable minTPCcrossedrowsoverfindcls{"minTPCcrossedrowsoverfindcls", 0.8f, "cut on minimum value of the ratio between crossed rows and findable clusters in the TPC"}; + Configurable v0etaCut{"v0etaCut", 0.8f, "maximum v0 track pseudorapidity"}; + Configurable v0ptCut{"v0ptCut", 0.15f, "minimum v0 track pT"}; + Configurable minK0sMass{"minK0sMass", 0.4f, "minimum mass for K0s"}; + Configurable maxK0sMass{"maxK0sMass", 0.6f, "maximum mass for K0s"}; + Configurable maxK0sRadius{"maxK0sRadius", 30.0f, "Maximum decay radius (cm) for K0s"}; + Configurable minK0sRadius{"minK0sRadius", 1.2f, "Minimum decay radius (cm) for K0s"}; + Configurable minK0sCosPa{"minK0sCosPa", 0.993f, "Minimum cosine of pointing angle for K0s"}; + Configurable maxDcaV0DauK0s{"maxDcaV0DauK0s", 0.8f, "Maximum DCA among the V0 daughters (cm) for K0s"}; + Configurable minqtArmenterosForK0s{"minqtArmenterosForK0s", 0.2f, "Minimum Armenteros' qt for K0s"}; + Configurable maxK0sLifeTime{"maxK0sLifeTime", 20.0f, "Maximum K0s lifetime (in cm)"}; + Configurable daughPIDCuts{"daughPIDCuts", 4.0f, "PID nsigma for V0s"}; + Configurable minV0DcaPiK0s{"minV0DcaPiK0s", 0.1f, "Min V0 pion DCA for K0s"}; + + Configurable minLambdaMass{"minLambdaMass", 1.07f, "minimum mass for Lambda"}; + Configurable maxLambdaMass{"maxLambdaMass", 1.17f, "maximum mass for Lambda"}; + Configurable maxLambdaRadius{"maxLambdaRadius", 30.0f, "Maximum decay radius (cm) for Lambda"}; + Configurable minLambdaRadius{"minLambdaRadius", 1.2f, "Minimum decay radius (cm) for Lambda"}; + Configurable minLambdaCosPa{"minLambdaCosPa", 0.993f, "Minimum cosine of pointing angle for Lambda"}; + Configurable maxDcaV0DauLambda{"maxDcaV0DauLambda", 0.8f, "Maximum DCA among the V0 daughters (cm) for K0s"}; + Configurable minV0DcaPiLambda{"minV0DcaPiLambda", 0.2f, "Min V0 pion DCA for Lambda"}; + Configurable minV0DcaPr{"minV0DcaPr", 0.07f, "Min V0 proton DCA for Lambda"}; + Configurable maxLambdaLifeTime{"maxLambdaLifeTime", 30.0f, "Maximum Lambda lifetime (in cm)"}; + } cfgv0trksel; + + Configurable> itsNsigmaPidCut{"itsNsigmaPidCut", std::vector{3, 2.5, 2, -3, -2.5, -2}, "ITS n-sigma cut for pions_posNsigma, kaons_posNsigma, protons_posNsigma, pions_negNsigma, kaons_negNsigma, protons_negNsigma"}; + Configurable> tpcNsigmaPidCut{"tpcNsigmaPidCut", std::vector{1.5, 1.5, 1.5, -1.5, -1.5, -1.5}, "TPC n-sigma cut for pions_posNsigma, kaons_posNsigma, protons_posNsigma, pions_negNsigma, kaons_negNsigma, protons_negNsigma"}; + Configurable> tofNsigmaPidCut{"tofNsigmaPidCut", std::vector{1.5, 1.5, 1.5, -1.5, -1.5, -1.5}, "TOF n-sigma cut for pions_posNsigma, kaons_posNsigma, protons_posNsigma, pions_negNsigma, kaons_negNsigma, protons_negNsigma"}; + Configurable cfgTofPidPtCut{"cfgTofPidPtCut", 0.3f, "Minimum pt to use TOF N-sigma"}; + Configurable isUseItsPid{"isUseItsPid", false, "Use ITS PID for particle identification"}; + + SliceCache cache; + Service ccdb; + Service pdg; + o2::ccdb::CcdbApi ccdbApi; + o2::ft0::Geometry ft0Det; + std::vector* offsetFT0; + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + TrackSelection myTrackFilter; + + std::vector tofNsigmaCut; + std::vector itsNsigmaCut; + std::vector tpcNsigmaCut; + o2::aod::ITSResponse itsResponse; + + void init(InitContext&) + { + ccdb->setURL(cfgCcdbParam.cfgURL); + ccdbApi.init("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + LOGF(info, "Getting alignment offsets from the CCDB..."); + offsetFT0 = ccdb->getForTimeStamp>("FT0/Calib/Align", cfgCcdbParam.noLaterThan.value); + LOGF(info, "Offset for FT0A: x = %.3f y = %.3f z = %.3f\n", (*offsetFT0)[0].getX(), (*offsetFT0)[0].getY(), (*offsetFT0)[0].getZ()); + LOGF(info, "Offset for FT0C: x = %.3f y = %.3f z = %.3f\n", (*offsetFT0)[1].getX(), (*offsetFT0)[1].getY(), (*offsetFT0)[1].getZ()); + + histos.add("EventHist", "EventHist", kTH1D, {axisEvent}, false); + auto hstat = histos.get(HIST("EventHist")); + auto* x = hstat->GetXaxis(); + x->SetBinLabel(1, "All events"); + x->SetBinLabel(2, "Sel8"); + x->SetBinLabel(3, "ApplySameBunchPileup"); + x->SetBinLabel(4, "ApplyGoodZvtxFT0vsPV"); + x->SetBinLabel(5, "ApplyGoodITSLayersAll"); + x->SetBinLabel(6, "ApplyExtraCorrCut"); + x->SetBinLabel(7, "ApplyNoCollInTimeRangeStandard"); + x->SetBinLabel(8, "ApplyNoCollInRofStandard"); + x->SetBinLabel(9, "ApplyNoHighMultCollInPrevRof"); + + myTrackFilter = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSibAny, TrackSelection::GlobalTrackRun3DCAxyCut::Default); + myTrackFilter.SetMinNCrossedRowsTPC(cfgtrksel.minNCrossedRowsTPC); + myTrackFilter.SetMinNClustersTPC(cfgtrksel.minTPCNClsFound); + myTrackFilter.SetMaxDcaZ(cfgtrksel.maxDcaZ); + myTrackFilter.SetMaxChi2PerClusterTPC(cfgtrksel.maxChi2PerClusterTPC); + myTrackFilter.print(); + + tofNsigmaCut = tofNsigmaPidCut; + itsNsigmaCut = itsNsigmaPidCut; + tpcNsigmaCut = tpcNsigmaPidCut; + } + + Produces collisionLRTable; + Produces tracksLRTable; + Produces ft0aLRTable; + Produces ft0cLRTable; + Produces mftLRTable; + Produces v0LRTable; + + Filter fTracksEta = nabs(aod::track::eta) < cfgtrksel.cfgEtaCut; + Filter fTracksPt = (aod::track::pt > cfgtrksel.cfgPtCutMin) && (aod::track::pt < cfgtrksel.cfgPtCutMax); + Filter fMftTrackColID = (aod::fwdtrack::bestCollisionId >= 0); + Filter fMftTrackDca = (nabs(aod::fwdtrack::bestDCAXY) < cfgmfttrksel.cfigMftDcaxy); + + using CollTable = soa::Join; + using TrksTable = soa::Filtered>; + using MftTrkTable = soa::Filtered; + + Preslice perColGlobal = aod::track::collisionId; + Preslice perColMft = aod::fwdtrack::collisionId; + Preslice perColV0 = aod::v0data::collisionId; + + void process(CollTable::iterator const& col, TrksTable const& tracks, aod::FT0s const&, MftTrkTable const& mfttracks, aod::V0Datas const& V0s) + { + if (!isEventSelected(col)) { + return; + } + auto tracksInCollision = tracks.sliceBy(perColGlobal, col.globalIndex()); + auto multiplicity = countNTracks(tracksInCollision); + auto centrality = selColCent(col); + auto bc = col.bc_as(); + + collisionLRTable(bc.runNumber(), col.posZ(), multiplicity, centrality, bc.timestamp()); + + // track loop + for (const auto& track : tracksInCollision) { + if (!track.isGlobalTrack()) + continue; + if (!myTrackFilter.IsSelected(track)) + continue; + tracksLRTable(collisionLRTable.lastIndex(), track.pt(), track.eta(), track.phi(), aod::LRCorrTrkTable::kSpCharge); + if (getTrackPID(track) == 1) + tracksLRTable(collisionLRTable.lastIndex(), track.pt(), track.eta(), track.phi(), aod::LRCorrTrkTable::kSpPion); + if (getTrackPID(track) == 2) + tracksLRTable(collisionLRTable.lastIndex(), track.pt(), track.eta(), track.phi(), aod::LRCorrTrkTable::kSpKaon); + if (getTrackPID(track) == 3) + tracksLRTable(collisionLRTable.lastIndex(), track.pt(), track.eta(), track.phi(), aod::LRCorrTrkTable::kSpProton); + } + + // ft0 loop + if (col.has_foundFT0()) { + const auto& ft0 = col.foundFT0(); + for (std::size_t iCh = 0; iCh < ft0.channelA().size(); iCh++) { + auto chanelid = ft0.channelA()[iCh]; + float ampl = ft0.amplitudeA()[iCh]; + auto phi = getPhiFT0(chanelid, 0); + auto eta = getEtaFT0(chanelid, 0); + ft0aLRTable(collisionLRTable.lastIndex(), chanelid, ampl, eta, phi); + } + for (std::size_t iCh = 0; iCh < ft0.channelC().size(); iCh++) { + auto chanelid = ft0.channelC()[iCh]; + float ampl = ft0.amplitudeC()[iCh]; + auto phi = getPhiFT0(chanelid, 1); + auto eta = getEtaFT0(chanelid, 1); + ft0cLRTable(collisionLRTable.lastIndex(), chanelid, ampl, eta, phi); + } + } + + // mft loop + auto mfttracksInCollision = mfttracks.sliceBy(perColMft, col.globalIndex()); + for (const auto& track : mfttracksInCollision) { + if (!isMftTrackSelected(track)) + continue; + auto phi = track.phi(); + o2::math_utils::bringTo02Pi(phi); + mftLRTable(collisionLRTable.lastIndex(), track.pt(), track.eta(), phi); + } + + // v0 loop + auto v0tracksInCollision = V0s.sliceBy(perColV0, col.globalIndex()); + for (const auto& v0 : v0tracksInCollision) { + if (!isSelectV0Track(v0)) { // Quality selection for V0 prongs + continue; + } + const auto& posTrack = v0.template posTrack_as(); + const auto& negTrack = v0.template negTrack_as(); + double massV0 = 0.0; + + // K0short + if (isSelectK0s(col, v0)) { // candidate is K0s + v0LRTable(collisionLRTable.lastIndex(), posTrack.globalIndex(), negTrack.globalIndex(), + v0.pt(), v0.eta(), v0.phi(), v0.mK0Short(), aod::LRCorrTrkTable::kSpK0short); + } + + // Lambda and Anti-Lambda + bool LambdaTag = isSelectLambda(col, v0); + bool ALambdaTag = isSelectLambda(col, v0); + + // Note: candidate compatible with Lambda and Anti-Lambda hypothesis are counted twice (once for each hypothesis) + if (LambdaTag) { // candidate is Lambda + massV0 = v0.mLambda(); + v0LRTable(collisionLRTable.lastIndex(), posTrack.globalIndex(), negTrack.globalIndex(), + v0.pt(), v0.eta(), v0.phi(), massV0, aod::LRCorrTrkTable::kSpLambda); + } + if (ALambdaTag) { // candidate is Anti-lambda + massV0 = v0.mAntiLambda(); + v0LRTable(collisionLRTable.lastIndex(), posTrack.globalIndex(), negTrack.globalIndex(), + v0.pt(), v0.eta(), v0.phi(), massV0, aod::LRCorrTrkTable::kSpALambda); + } // end of Lambda and Anti-Lambda processing + } + } // process function + + template + bool isEventSelected(CheckCol const& col) + { + histos.fill(HIST("EventHist"), 1); + if (!col.sel8()) { + return false; + } + histos.fill(HIST("EventHist"), 2); + if (cfgevtsel.isApplySameBunchPileup && !col.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + return false; + } + histos.fill(HIST("EventHist"), 3); + if (cfgevtsel.isApplyGoodZvtxFT0vsPV && !col.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + return false; + } + histos.fill(HIST("EventHist"), 4); + if (cfgevtsel.isApplyGoodITSLayersAll && !col.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + return false; + } + histos.fill(HIST("EventHist"), 5); + if (cfgevtsel.isApplyExtraCorrCut && col.multNTracksPV() > cfgevtsel.npvTracksCut && col.multFT0C() < (10 * col.multNTracksPV() - cfgevtsel.ft0cCut)) { + return false; + } + histos.fill(HIST("EventHist"), 6); + if (cfgevtsel.isApplyNoCollInTimeRangeStandard && !col.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return false; + } + histos.fill(HIST("EventHist"), 7); + if (cfgevtsel.isApplyNoCollInRofStandard && !col.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { + return false; + } + histos.fill(HIST("EventHist"), 8); + if (cfgevtsel.isApplyNoHighMultCollInPrevRof && !col.selection_bit(o2::aod::evsel::kNoHighMultCollInPrevRof)) { + return false; + } + histos.fill(HIST("EventHist"), 9); + return true; + } + + template + int countNTracks(countTrk const& tracks) + { + auto nTrk = 0; + for (const auto& track : tracks) { + if (!track.isGlobalTrack()) + continue; + if (!myTrackFilter.IsSelected(track)) + continue; + if (track.pt() < cfgtrksel.cfgPtCutMin || track.pt() > cfgtrksel.cfgPtCutMult) { + continue; + } + nTrk++; + } + return nTrk; + } + + template + float selColCent(CheckColCent const& col) + { + auto cent = -1; + if (cfgevtsel.isApplyCentFT0C) { + cent = col.centFT0C(); + } + if (cfgevtsel.isApplyCentFV0A) { + cent = col.centFV0A(); + } + if (cfgevtsel.isApplyCentFT0M) { + cent = col.centFT0M(); + } + return cent; + } + + template + int getTrackPID(TTrack const& track) + { + // Computing Nsigma arrays for pion, kaon, and protons + std::array nSigmaTPC = {track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()}; + std::array nSigmaTOF = {track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr()}; + std::array nSigmaITS = {itsResponse.nSigmaITS(track), itsResponse.nSigmaITS(track), itsResponse.nSigmaITS(track)}; + std::array nSigmaToUse = isUseItsPid ? nSigmaITS : nSigmaTPC; // Choose which nSigma to use: TPC or ITS + std::vector detectorNsigmaCut = isUseItsPid ? itsNsigmaCut : tpcNsigmaCut; // Choose which nSigma to use: TPC or ITS + int pid = -1; + bool isPion, isKaon, isProton; + bool isDetectedPion = nSigmaToUse[0] < detectorNsigmaCut[0] && nSigmaToUse[0] > detectorNsigmaCut[0 + 3]; + bool isDetectedKaon = nSigmaToUse[1] < detectorNsigmaCut[1] && nSigmaToUse[1] > detectorNsigmaCut[1 + 3]; + bool isDetectedProton = nSigmaToUse[2] < detectorNsigmaCut[2] && nSigmaToUse[2] > detectorNsigmaCut[2 + 3]; + + bool isTofPion = nSigmaTOF[0] < tofNsigmaCut[0] && nSigmaTOF[0] > tofNsigmaCut[0 + 3]; + bool isTofKaon = nSigmaTOF[1] < tofNsigmaCut[1] && nSigmaTOF[1] > tofNsigmaCut[1 + 3]; + bool isTofProton = nSigmaTOF[2] < tofNsigmaCut[2] && nSigmaTOF[2] > tofNsigmaCut[2 + 3]; + + if (track.pt() > cfgTofPidPtCut && !track.hasTOF()) { + return 0; + } else if (track.pt() > cfgTofPidPtCut && track.hasTOF()) { + isPion = isTofPion && isDetectedPion; + isKaon = isTofKaon && isDetectedKaon; + isProton = isTofProton && isDetectedProton; + } else { + isPion = isDetectedPion; + isKaon = isDetectedKaon; + isProton = isDetectedProton; + } + + if ((isPion && isKaon) || (isPion && isProton) || (isKaon && isProton)) { + return 0; // more than one particle satisfy the criteria + } + + if (isPion) { + pid = PIONS; + } else if (isKaon) { + pid = KAONS; + } else if (isProton) { + pid = PROTONS; + } else { + return 0; // no particle satisfies the criteria + } + + return pid + 1; // shift the pid by 1, 1 = pion, 2 = kaon, 3 = proton + } + + double getPhiFT0(uint chno, int i) + { + ft0Det.calculateChannelCenter(); + auto chPos = ft0Det.getChannelCenter(chno); + return RecoDecay::phi(chPos.X() + (*offsetFT0)[i].getX(), chPos.Y() + (*offsetFT0)[i].getY()); + } + + double getEtaFT0(uint chno, int i) + { + ft0Det.calculateChannelCenter(); + auto chPos = ft0Det.getChannelCenter(chno); + auto x = chPos.X() + (*offsetFT0)[i].getX(); + auto y = chPos.Y() + (*offsetFT0)[i].getY(); + auto z = chPos.Z() + (*offsetFT0)[i].getZ(); + if (chno >= kMinFt0cCell) + z = -z; + auto r = std::sqrt(x * x + y * y); + auto theta = std::atan2(r, z); + return -std::log(std::tan(0.5 * theta)); + } + + template + bool isMftTrackSelected(CheckMftTrack const& track) + { + if (track.nClusters() < cfgmfttrksel.cfigMftCluster) { + return false; + } + if (track.eta() > cfgmfttrksel.cfigMftEtaMax || track.eta() < cfgmfttrksel.cfigMftEtaMin) { + return false; + } + if (cfgmfttrksel.useMftPtCut && (track.pt() < cfgmfttrksel.cfgMftPtCutMin || track.pt() > cfgmfttrksel.cfgMftPtCutMax)) { + return false; + } + return true; + } + + template + bool isSelectV0Track(const T1& v0) + { + const auto& posTrack = v0.template posTrack_as(); + const auto& negTrack = v0.template negTrack_as(); + + if (!posTrack.hasTPC() || !negTrack.hasTPC()) { + return false; + } + if (posTrack.tpcNClsCrossedRows() < cfgv0trksel.minTPCcrossedrows || negTrack.tpcNClsCrossedRows() < cfgv0trksel.minTPCcrossedrows) { + return false; + } + if (posTrack.tpcCrossedRowsOverFindableCls() < cfgv0trksel.minTPCcrossedrowsoverfindcls || negTrack.tpcCrossedRowsOverFindableCls() < cfgv0trksel.minTPCcrossedrowsoverfindcls) { + return false; + } + if (std::abs(v0.positiveeta()) > cfgv0trksel.v0etaCut || std::abs(v0.negativeeta()) > cfgv0trksel.v0etaCut) { + return false; + } + if (v0.positivept() < cfgv0trksel.v0ptCut || v0.negativept() < cfgv0trksel.v0ptCut) { + return false; + } + return true; + } + + template + bool isSelectK0s(Collision const& col, const V0candidate& v0) + { + const auto& posTrack = v0.template posTrack_as(); + const auto& negTrack = v0.template negTrack_as(); + + float CtauK0s = v0.distovertotmom(col.posX(), col.posY(), col.posZ()) * o2::constants::physics::MassK0; + + if (v0.mK0Short() < cfgv0trksel.minK0sMass || v0.mK0Short() > cfgv0trksel.maxK0sMass) { + return false; + } + if ((v0.qtarm() / std::abs(v0.alpha())) < cfgv0trksel.minqtArmenterosForK0s) { + return false; + } + if (v0.v0radius() > cfgv0trksel.maxK0sRadius || v0.v0radius() < cfgv0trksel.minK0sRadius) { + return false; + } + if (v0.v0cosPA() < cfgv0trksel.minK0sCosPa) { + return false; + } + if (v0.dcaV0daughters() > cfgv0trksel.maxDcaV0DauK0s) { + return false; + } + if (std::abs(CtauK0s) > cfgv0trksel.maxK0sLifeTime) { + return false; + } + if (((std::abs(posTrack.tpcNSigmaPi()) > cfgv0trksel.daughPIDCuts) || (std::abs(negTrack.tpcNSigmaPi()) > cfgv0trksel.daughPIDCuts))) { + return false; + } + if ((TMath::Abs(v0.dcapostopv()) < cfgv0trksel.minV0DcaPiK0s || TMath::Abs(v0.dcanegtopv()) < cfgv0trksel.minV0DcaPiK0s)) { + return false; + } + return true; + } + + template + bool isSelectLambda(Collision const& col, const V0candidate& v0) + { + const auto& posTrack = v0.template posTrack_as(); + const auto& negTrack = v0.template negTrack_as(); + float CtauLambda = v0.distovertotmom(col.posX(), col.posY(), col.posZ()) * o2::constants::physics::MassLambda; + if ((v0.mLambda() < cfgv0trksel.minLambdaMass || v0.mLambda() > cfgv0trksel.maxLambdaMass) && + (v0.mAntiLambda() < cfgv0trksel.minLambdaMass || v0.mAntiLambda() > cfgv0trksel.maxLambdaMass)) { + return false; + } + if (v0.v0radius() > cfgv0trksel.maxLambdaRadius || v0.v0radius() < cfgv0trksel.minLambdaRadius) { + return false; + } + if (v0.v0cosPA() < cfgv0trksel.minLambdaCosPa) { + return false; + } + if (v0.dcaV0daughters() > cfgv0trksel.maxDcaV0DauLambda) { + return false; + } + if (pid == KindOfV0::kLambda && (TMath::Abs(v0.dcapostopv()) < cfgv0trksel.minV0DcaPr || TMath::Abs(v0.dcanegtopv()) < cfgv0trksel.minV0DcaPiLambda)) { + return false; + } + if (pid == KindOfV0::kAntiLambda && (TMath::Abs(v0.dcapostopv()) < cfgv0trksel.minV0DcaPiLambda || TMath::Abs(v0.dcanegtopv()) < cfgv0trksel.minV0DcaPr)) { + return false; + } + if (pid == KindOfV0::kLambda && ((std::abs(posTrack.tpcNSigmaPr()) > cfgv0trksel.daughPIDCuts) || (std::abs(negTrack.tpcNSigmaPi()) > cfgv0trksel.daughPIDCuts))) { + return false; + } + if (pid == KindOfV0::kAntiLambda && ((std::abs(posTrack.tpcNSigmaPi()) > cfgv0trksel.daughPIDCuts) || (std::abs(negTrack.tpcNSigmaPr()) > cfgv0trksel.daughPIDCuts))) { + return false; + } + if (std::abs(CtauLambda) > cfgv0trksel.maxLambdaLifeTime) { + return false; + } + return true; + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} From 94ecc1a5e049b2bed7b6c619150387239850e150 Mon Sep 17 00:00:00 2001 From: Sandeep Dudi <69388148+sdudi123@users.noreply.github.com> Date: Thu, 30 Oct 2025 21:50:52 +0100 Subject: [PATCH 960/986] [PWGLF] Track selection cuts are tuned for MC (#13577) Co-authored-by: sandeep dudi --- PWGLF/Tasks/Nuspex/spectraKinkPiKa.cxx | 425 ++++++++++++++----------- 1 file changed, 236 insertions(+), 189 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/spectraKinkPiKa.cxx b/PWGLF/Tasks/Nuspex/spectraKinkPiKa.cxx index 1a77474882f..8869a06e9e3 100644 --- a/PWGLF/Tasks/Nuspex/spectraKinkPiKa.cxx +++ b/PWGLF/Tasks/Nuspex/spectraKinkPiKa.cxx @@ -68,13 +68,13 @@ using CollisionsFullMC = soa::Join LayerRadii{2.33959f, 3.14076f, 3.91924f, 19.6213f, 24.5597f, 34.388f, 39.3329f}; -constexpr double betheBlochDefault[1][6]{{-1.e32, -1.e32, -1.e32, -1.e32, -1.e32, -1.e32}}; +constexpr double BetheBlochDefault[1][6]{{-1.e32, -1.e32, -1.e32, -1.e32, -1.e32, -1.e32}}; static const std::vector betheBlochParNames{"p0", "p1", "p2", "p3", "p4", "resolution"}; static const std::vector particleNames{"Daughter"}; } // namespace -struct kinkCandidate { +struct KinkCandidate { int mothTrackID; int daugTrackID; int collisionID; @@ -90,7 +90,7 @@ struct kinkCandidate { float dcaXYmoth = -999; float kinkAngle = -999; }; -struct kinkBuilder { +struct KinkBuilder { // kink analysis Produces outputDataTable; Service ccdb; @@ -116,7 +116,7 @@ struct kinkBuilder { svPoolCreator svCreator; // bethe bloch parameters - Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {betheBlochDefault[0], 1, 6, particleNames, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for charged daughter"}; + Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {BetheBlochDefault[0], 1, 6, particleNames, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for charged daughter"}; Configurable cfgMaterialCorrection{"cfgMaterialCorrection", static_cast(o2::base::Propagator::MatCorrType::USEMatCorrNONE), "Type of material correction"}; Configurable customVertexerTimeMargin{"customVertexerTimeMargin", 800, "Time margin for custom vertexer (ns)"}; Configurable skipAmbiTracks{"skipAmbiTracks", false, "Skip ambiguous tracks"}; @@ -128,7 +128,7 @@ struct kinkBuilder { Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; // std vector of candidates - std::vector kinkCandidates; + std::vector kinkCandidates; int mRunNumber; float mBz; std::array mBBparamsDaug; @@ -139,10 +139,8 @@ struct kinkBuilder { { // dummy values, 1 for mother, 0 for daughter svCreator.setPDGs(1, 0); - mRunNumber = 0; mBz = 0; - ccdb->setURL(ccdbPath); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); @@ -158,7 +156,8 @@ struct kinkBuilder { if (skipAmbiTracks) { svCreator.setSkipAmbiTracks(); } - for (int i = 0; i < 5; i++) { + const int blpar = 5; + for (int i = 0; i < blpar; i++) { mBBparamsDaug[i] = cfgBetheBlochParams->get("Daughter", Form("p%i", i)); } mBBparamsDaug[5] = cfgBetheBlochParams->get("Daughter", "resolution"); @@ -167,12 +166,14 @@ struct kinkBuilder { template bool selectMothTrack(const T& candidate) { + const int itscls = 6; + const int itsclsinb = 3; // ITS-standalone (no TPC, no TOF) if (!kaontopologhy) { if (candidate.has_collision() && candidate.hasITS() && !candidate.hasTPC() && !candidate.hasTOF() && - candidate.itsNCls() < 6 && - candidate.itsNClsInnerBarrel() == 3 && - candidate.itsChi2NCl() < 36 && + candidate.itsNCls() < itscls && + candidate.itsNClsInnerBarrel() == itsclsinb && + candidate.itsChi2NCl() < itsChi2cut && candidate.pt() > minPtMoth) { return true; } @@ -188,7 +189,6 @@ struct kinkBuilder { } return false; } - return false; // fallback } @@ -198,11 +198,9 @@ struct kinkBuilder { if (!kaontopologhy && (!candidate.hasTPC() || !candidate.hasITS())) { return false; } - if (kaontopologhy && (!candidate.hasTPC() || candidate.hasITS())) { return false; } - if (askTOFforDaug && !candidate.hasTOF()) { return false; } @@ -214,9 +212,7 @@ struct kinkBuilder { { svCreator.clearPools(); svCreator.fillBC2Coll(collisions, bcs); - for (const auto& track : tracks) { - bool isDaug = selectDaugTrack(track); bool isMoth = selectMothTrack(track); @@ -224,7 +220,6 @@ struct kinkBuilder { continue; if (isDaug && std::abs(track.eta()) > etaMaxDaug) continue; - if (isMoth && std::abs(track.eta()) > etaMaxMoth) continue; @@ -234,7 +229,7 @@ struct kinkBuilder { auto& kinkPool = svCreator.getSVCandPool(collisions, !unlikeSignBkg); for (const auto& svCand : kinkPool) { - kinkCandidate kinkCand; + KinkCandidate kinkCand; auto trackMoth = tracks.rawIteratorAt(svCand.tr0Idx); auto trackDaug = tracks.rawIteratorAt(svCand.tr1Idx); @@ -263,14 +258,12 @@ struct kinkBuilder { if ((std::abs(trackParCovMoth.getPhi() - trackParCovDaug.getPhi()) * radToDeg) > maxPhiDiff) { continue; } - // propagate to PV std::array dcaInfoDaug; o2::base::Propagator::Instance()->propagateToDCABxByBz({primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ()}, trackParCovDaug, 2.f, static_cast(cfgMaterialCorrection.value), &dcaInfoDaug); if (std::abs(dcaInfoDaug[0]) < minDCADaugToPV) { continue; } - int nCand = 0; try { nCand = fitter.process(trackParCovMoth, trackParCovDaug); @@ -281,21 +274,19 @@ struct kinkBuilder { if (nCand == 0) { continue; } - if (!fitter.propagateTracksToVertex()) { continue; } - auto propMothTrack = fitter.getTrack(0); auto propDaugTrack = fitter.getTrack(1); kinkCand.decVtx = fitter.getPCACandidatePos(); - - for (int i = 0; i < 3; i++) { + const int vtxp = 3; + for (int i = 0; i < vtxp; i++) { kinkCand.decVtx[i] -= kinkCand.primVtx[i]; } propMothTrack.getPxPyPzGlo(kinkCand.momMoth); propDaugTrack.getPxPyPzGlo(kinkCand.momDaug); - for (int i = 0; i < 3; i++) { + for (int i = 0; i < vtxp; i++) { kinkCand.momMoth[i] *= charge; kinkCand.momDaug[i] *= charge; } @@ -342,7 +333,7 @@ struct kinkBuilder { kinkCandidates.clear(); fillCandidateData(collisions, tracks, ambiTracks, bcs); // sort kinkCandidates by collisionID to allow joining with collision table - std::sort(kinkCandidates.begin(), kinkCandidates.end(), [](const kinkCandidate& a, const kinkCandidate& b) { return a.collisionID < b.collisionID; }); + std::sort(kinkCandidates.begin(), kinkCandidates.end(), [](const KinkCandidate& a, const KinkCandidate& b) { return a.collisionID < b.collisionID; }); for (const auto& kinkCand : kinkCandidates) { outputDataTable(kinkCand.collisionID, kinkCand.mothTrackID, kinkCand.daugTrackID, @@ -352,10 +343,10 @@ struct kinkBuilder { kinkCand.dcaXYmoth, kinkCand.dcaXYdaug, kinkCand.dcaKinkTopo); } } - PROCESS_SWITCH(kinkBuilder, process, "Produce kink tables", false); + PROCESS_SWITCH(KinkBuilder, process, "Produce kink tables", false); }; -struct spectraKinkPiKa { +struct SpectraKinkPiKa { Service pdg; // Histograms are defined with HistogramRegistry HistogramRegistry rEventSelection{"eventSelection", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; @@ -363,9 +354,8 @@ struct spectraKinkPiKa { // Configurable for event selection Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; - Configurable cutNSigmaPi{"cutNSigmaPi", 4, "NSigmaTPCPion"}; - Configurable cutNSigmaKa{"cutNSigmaKa", 4, "NSigmaTPCKaon"}; - Configurable cutNSigmaMu{"cutNSigmaMu", 4, "cutNSigmaMu"}; + Configurable cutNsigmaKa{"cutNsigmaKa", 4, "NSigmaTPCKaon"}; + Configurable cutNsigmaMu{"cutNsigmaMu", 4, "cutNSigmaMu"}; Configurable etaCut{"etaCut", 0.8, "etaCut"}; Configurable rapCut{"rapCut", 0.8, "rapCut"}; Configurable kinkanglecut{"kinkanglecut", 2.0, "kinkanglecut"}; @@ -379,19 +369,22 @@ struct spectraKinkPiKa { Configurable maxqt{"maxqt", 0.3, "max qt for kaon"}; Configurable centestimator{"centestimator", 0, "Select multiplicity estimator: 0 - FT0C, 1 - FT0A, 2 - FT0M, 3 - FV0A, 4 - PVTracks"}; - Configurable pid{"pidMother", 321, ""}; - Configurable dpid{"pidDaughter", 13, ""}; + Configurable pid{"pid", 321, ""}; + Configurable dpid{"dpid", 13, ""}; + Configurable dpidCut{"dpidCut", 0, ""}; Configurable dptCut{"dptCut", 0, ""}; Configurable qa{"qa", 0, ""}; Configurable maxtpcncle{"maxtpcncle", 0, "max tpc find ncle"}; Configurable mintpcncle{"mintpcncle", 0, "min tpc find ncle"}; Configurable onlykaon{"onlykaon", 0, "kaon"}; - Configurable onlypion{"onlypion", 0, "pion"}; Configurable additionalhist{"additionalhist", 1, "additional histogram"}; + Configurable pvtrack{"pvtrack", 1, "pvtrack"}; + Configurable cfgUseItsRefit{"cfgUseItsRefit", 1, "ITS refit"}; + Configurable cfgUseTpcRefit{"cfgUseTpcRefit", 1, "TPC refit"}; ConfigurableAxis ptAxis{"ptAxis", {150, 0, 15}, ""}; ConfigurableAxis qtAxis{"qtAxis", {2000, 0.0, 2.0}, ""}; - ConfigurableAxis kinkAxis{"kinkAxis", {200, 0.0, 4.0}, ""}; + ConfigurableAxis kinkAxis{"kinkAxis", {300, 0.0, 300.0}, ""}; ConfigurableAxis etaAxis{"etaAxis", {200, -5.0, 5.0}, ""}; ConfigurableAxis vertexAxis{"vertexAxis", {1200, -300.0, 300.0}, ""}; ConfigurableAxis radiusAxis{"radiusAxis", {600, 0.0, 300.0}, ""}; @@ -412,25 +405,12 @@ struct spectraKinkPiKa { rpiKkink.add("h2_moth_pt_vs_eta_rec", "pt_vs_eta_moth", {HistType::kTH3F, {ptAxis, etaAxis, multAxis}}); rpiKkink.add("h2_pt_moth_vs_dau_rec", "pt_moth_vs_dau", {HistType::kTH2F, {ptAxis, ptAxis}}); - rpiKkink.add("h2_qt", "qt", {HistType::kTH1F, {qtAxis}}); rpiKkink.add("h2_qt_vs_pt", "qt_pt", {HistType::kTH2F, {qtAxis, ptAxis}}); - rpiKkink.add("h2_kink_angle", "kink angle", {HistType::kTH2F, {kinkAxis, multAxis}}); - - // pion - rpiKkink.add("h2_dau_pt_vs_eta_rec_pion", "pt_vs_eta_dau", {HistType::kTH3F, {ptAxis, etaAxis, multAxis}}); - rpiKkink.add("h2_moth_pt_vs_eta_rec_pion", "pt_vs_eta_moth", {HistType::kTH3F, {ptAxis, etaAxis, multAxis}}); - rpiKkink.add("h2_pt_moth_vs_dau_rec_pion", "pt_moth_vs_dau", {HistType::kTH2F, {ptAxis, ptAxis}}); - - rpiKkink.add("h2_qt_pion", "qt", {HistType::kTH1F, {qtAxis}}); - rpiKkink.add("h2_qt_vs_ptpion", "qt_pt", {HistType::kTH2F, {qtAxis, ptAxis}}); - rpiKkink.add("h2_kink_angle_pion", "kink angle", {HistType::kTH2F, {kinkAxis, multAxis}}); + rpiKkink.add("h2_kink_angle", "kink angle", {HistType::kTH2F, {ptAxis, kinkAxis}}); // inv mass - rpiKkink.add("h2_invmass_kaon", "Inv mass vs Pt", {HistType::kTH3F, {massAxis, ptAxis, ptAxis}}); - rpiKkink.add("h2_invmass_pion", "Inv mass vs Pt", {HistType::kTH3F, {massAxis, ptAxis, ptAxis}}); - - rpiKkink.add("h2_kaon_data", "h2_kaon_data", HistType::kTHnSparseF, {massAxis, ptAxis, etaAxis, qtAxis, multAxis}, true); - rpiKkink.add("h2_pion_data", "h2_pion_data", HistType::kTHnSparseF, {massAxis, ptAxis, etaAxis, qtAxis, multAxis}, true); + rpiKkink.add("h2_kaon_data", "h2_kaon_data", HistType::kTHnSparseF, {massAxis, ptAxis, qtAxis, multAxis}, true); + rpiKkink.add("h1_tracks_data", "track_cut_data", {HistType::kTH1F, {{17, 0.5, 17.5}}}); // track qa if (qa) { @@ -442,7 +422,6 @@ struct spectraKinkPiKa { rpiKkink.add("tpc_dedx", "p vs dE/dx", {HistType::kTH2F, {{500, 0.0, 10.0}, {5000, 0.0, 5000.0}}}); rpiKkink.add("tpc_nsigma_kaon", "p#k n#sigma", {HistType::kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}}); - rpiKkink.add("tpc_nsigma_pion", "p#pi n#sigma", {HistType::kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}}); rpiKkink.add("tr_dcaxyM", "dcaxym", {HistType::kTH1F, {{1000, -5.0, 5.0}}}); rpiKkink.add("tr_dcaxyD", "dcaxyd", {HistType::kTH1F, {{1000, -5.0, 5.0}}}); @@ -459,7 +438,6 @@ struct spectraKinkPiKa { rpiKkink.add("tpc_dedx_m", "p vs dE/dx", {HistType::kTH2F, {{500, 0.0, 10.0}, {5000, 0.0, 5000.0}}}); rpiKkink.add("tpc_nsigma_kaon_m", "p#k n#sigma", {HistType::kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}}); - rpiKkink.add("tpc_nsigma_pion_m", "p#pi n#sigma", {HistType::kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}}); rpiKkink.add("tr_dcaxyM_m", "dcaxym", {HistType::kTH1F, {{1000, -5.0, 5.0}}}); rpiKkink.add("tr_dcaxyD_m", "dcaxyd", {HistType::kTH1F, {{1000, -5.0, 5.0}}}); @@ -475,45 +453,60 @@ struct spectraKinkPiKa { rpiKkink.add("h2_kinkradius_vs_ncl_m", "kinkradius_vs_ncl", {HistType::kTH2F, {{250, 0.0, 250.0}, {300, 0.0, 300.0}}}); } if (doprocessMC) { + + rpiKkink.add("h2_qt", "qt", {HistType::kTH1F, {qtAxis}}); + rpiKkink.add("h2_kaon_pt_vs_rap_rec_full", "pt_vs_rap_kaon", {HistType::kTH2F, {ptAxis, etaAxis}}); + rpiKkink.add("h2_kaon_pt_vs_rap_rec_full1", "pt_vs_rap_kaon1", {HistType::kTH2F, {ptAxis, etaAxis}}); + + rpiKkink.add("h2_moth_ptrapqt_egen", "pt_vs_rap_qt_egen", {HistType::kTH3F, {ptAxis, etaAxis, qtAxis}}); + rpiKkink.add("h2_moth_ptrapqt_mugen", "pt_vs_rap_qt_mugen", {HistType::kTH3F, {ptAxis, etaAxis, qtAxis}}); + rpiKkink.add("h2_moth_ptrapqt_pigen", "pt_vs_rap_qt_pigen", {HistType::kTH3F, {ptAxis, etaAxis, qtAxis}}); + rpiKkink.add("h2_dau_pt_vs_eta_gen", "pt_vs_eta_dau", {HistType::kTH2F, {ptAxis, etaAxis}}); rpiKkink.add("h2_moth_pt_vs_eta_gen", "pt_vs_eta_moth", {HistType::kTH2F, {ptAxis, etaAxis}}); + rpiKkink.add("h2_moth_pt_vs_rap_genall", "pt_vs_rap_moth", {HistType::kTH2F, {ptAxis, etaAxis}}); rpiKkink.add("h2_pt_moth_vs_dau_gen", "pt_moth_vs_dau", {HistType::kTH2F, {ptAxis, ptAxis}}); - + rpiKkink.add("h1_tracks", "track_cut", {HistType::kTH1F, {{17, 0.5, 17.5}}}); + rpiKkink.add("h1_tracks_gen", "track_cut_gen", {HistType::kTH1F, {{15, 0.5, 15.5}}}); rpiKkink.add("h2_qt_gen", "qt", {HistType::kTH1F, {qtAxis}}); rpiKkink.add("h2_qt_rec", "qt", {HistType::kTH1F, {qtAxis}}); - rpiKkink.add("h2_kink_angle_gen", "kink angle", {HistType::kTH1F, {kinkAxis}}); + rpiKkink.add("h2_kink_angle_gen", "kink angle", {HistType::kTH2F, {ptAxis, kinkAxis}}); - rpiKkink.add("h2_kaon_mc_gen", "h2_kaon_mc_gen", HistType::kTHnSparseF, {massAxis, ptAxis, etaAxis, qtAxis}, true); - rpiKkink.add("h2_kaon_mc_rec", "h2_kaon_mc_rec", HistType::kTHnSparseF, {massAxis, ptAxis, etaAxis, qtAxis, multAxis}, true); + rpiKkink.add("h2_kaon_mc_gen", "h2_kaon_mc_gen", HistType::kTHnSparseF, {massAxis, ptAxis, qtAxis}, true); + rpiKkink.add("h2_kaon_mc_gen1", "h2_kaon_mc_gen1", HistType::kTHnSparseF, {massAxis, ptAxis, qtAxis}, true); + rpiKkink.add("h2_kaon_mc_rec", "h2_kaon_mc_rec", HistType::kTHnSparseF, {massAxis, ptAxis, qtAxis, multAxis}, true); rpiKkink.add("h2_dau_pt_vs_eta_rec_m", "pt_vs_eta_dau", {HistType::kTH3F, {ptAxis, etaAxis, multAxis}}); rpiKkink.add("h2_moth_pt_vs_eta_rec_m", "pt_vs_eta_moth", {HistType::kTH3F, {ptAxis, etaAxis, multAxis}}); rpiKkink.add("h2_pt_moth_vs_dau_rec_m", "pt_moth_vs_dau", {HistType::kTH2F, {ptAxis, ptAxis}}); - rpiKkink.add("h2_kink_angle_m", "kink angle", {HistType::kTH2F, {kinkAxis, multAxis}}); - rpiKkink.add("h2_invmass_kaon_m", "Inv mass vs Pt", {HistType::kTH3F, {massAxis, ptAxis, ptAxis}}); - rpiKkink.add("h2_kaon_mc_rec_m", "h2_kaon_mc_rec_m", HistType::kTHnSparseF, {massAxis, ptAxis, etaAxis, qtAxis, multAxis}, true); + rpiKkink.add("h2_kink_angle_m", "kink angle", {HistType::kTH2F, {ptAxis, kinkAxis}}); + rpiKkink.add("h2_kaon_mc_rec_m", "h2_kaon_mc_rec_m", HistType::kTHnSparseF, {massAxis, ptAxis, qtAxis, multAxis}, true); } } - double computeMotherMass(ROOT::Math::PxPyPzMVector p_moth, ROOT::Math::PxPyPzMVector p_daug) + double computeMotherMass(ROOT::Math::PxPyPzMVector pmoth, ROOT::Math::PxPyPzMVector pdaug) { // Infer neutrino momentum from conservation - ROOT::Math::XYZVector p_nu_vec = p_moth.Vect() - p_daug.Vect(); - + ROOT::Math::XYZVector pnuvec = pmoth.Vect() - pdaug.Vect(); // Neutrino energy (massless): E_nu = |p_nu| - double E_nu = p_nu_vec.R(); - + double enu = pnuvec.R(); // Total energy of the system - double E_total = p_daug.E() + E_nu; - + double etotal = pdaug.E() + enu; // Total momentum = p_nu + p_daug - ROOT::Math::XYZVector p_total_vec = p_nu_vec + p_daug.Vect(); - double p_total_sq = p_total_vec.Mag2(); - + ROOT::Math::XYZVector ptotalvec = pnuvec + pdaug.Vect(); + double ptotalsq = ptotalvec.Mag2(); // Invariant mass from E² - |p|² - double m2 = E_total * E_total - p_total_sq; + double m2 = etotal * etotal - ptotalsq; return (m2 > 0) ? std::sqrt(m2) : -1.0; } + double computeQt(ROOT::Math::PxPyPzMVector pmoth, ROOT::Math::PxPyPzMVector pdaug) + { + TVector3 pdlab(pdaug.Px(), pdaug.Py(), pdaug.Pz()); + // Compute transverse component + TVector3 motherDir(pmoth.Px(), pmoth.Py(), pmoth.Pz()); + double ptd = pdlab.Perp(motherDir); // or p_d_lab.Mag() * sin(theta) + return ptd; + } void processData(CollisionsFull::iterator const& collision, aod::KinkCands const& KinkCands, TracksFull const&) { @@ -548,6 +541,8 @@ struct spectraKinkPiKa { for (const auto& kinkCand : KinkCands) { auto dauTrack = kinkCand.trackDaug_as(); auto mothTrack = kinkCand.trackMoth_as(); + + rpiKkink.fill(HIST("h1_tracks_data"), 1.0); if (mothTrack.collisionId() != collision.globalIndex()) { continue; // not from this event } @@ -557,23 +552,33 @@ struct spectraKinkPiKa { if (mothTrack.collisionId() != dauTrack.collisionId()) { continue; // skip mismatched collision tracks } + rpiKkink.fill(HIST("h1_tracks_data"), 2.0); if (dauTrack.sign() != mothTrack.sign()) { LOG(info) << "Skipping kink candidate with opposite sign daughter and mother: " << kinkCand.globalIndex(); continue; // Skip if the daughter has the opposite sign as the mother } + rpiKkink.fill(HIST("h1_tracks_data"), 3.0); + if (pvtrack && !mothTrack.isPVContributor()) + continue; + + rpiKkink.fill(HIST("h1_tracks_data"), 4.0); + if (cfgUseItsRefit && !(o2::aod::track::ITSrefit)) + continue; + if (cfgUseTpcRefit && !(o2::aod::track::TPCrefit)) + continue; + rpiKkink.fill(HIST("h1_tracks_data"), 5.0); bool kaon = false; - bool pion = false; v0.SetCoordinates(mothTrack.px(), mothTrack.py(), mothTrack.pz(), o2::constants::physics::MassKaonCharged); v1.SetCoordinates(dauTrack.px(), dauTrack.py(), dauTrack.pz(), o2::constants::physics::MassMuon); if (dptCut && v1.Pt() > v0.Pt()) continue; + rpiKkink.fill(HIST("h1_tracks_data"), 6.0); if (qa) { rpiKkink.fill(HIST("tpc_dedx"), v0.P(), mothTrack.tpcSignal()); rpiKkink.fill(HIST("tpc_nsigma_kaon"), v0.Pt(), mothTrack.tpcNSigmaKa()); - rpiKkink.fill(HIST("tpc_nsigma_pion"), v0.Pt(), mothTrack.tpcNSigmaPi()); rpiKkink.fill(HIST("tr_chi2nclM"), mothTrack.tpcChi2NCl()); rpiKkink.fill(HIST("tr_chi2nclD"), dauTrack.tpcChi2NCl()); @@ -583,25 +588,24 @@ struct spectraKinkPiKa { } if (mothTrack.tpcChi2NCl() > tpcChi2Cut) continue; - + rpiKkink.fill(HIST("h1_tracks_data"), 7.0); if (mothTrack.tpcNClsFound() > maxtpcncle || mothTrack.tpcNClsFound() < mintpcncle) continue; - - if (std::abs(mothTrack.tpcNSigmaKa()) < cutNSigmaKa) { + rpiKkink.fill(HIST("h1_tracks_data"), 8.0); + if (std::abs(mothTrack.tpcNSigmaKa()) < cutNsigmaKa) { kaon = true; } - if (std::abs(mothTrack.tpcNSigmaPi()) < cutNSigmaPi) { - pion = true; - } - if (!kaon && !pion) { + if (!kaon) { continue; } - if (cutNSigmaMu != -1 && std::abs(dauTrack.tpcNSigmaMu()) > cutNSigmaMu) { + rpiKkink.fill(HIST("h1_tracks_data"), 9.0); + if (cutNsigmaMu != -1 && std::abs(dauTrack.tpcNSigmaMu()) > cutNsigmaMu) { continue; } double radiusxy = std::sqrt(kinkCand.xDecVtx() * kinkCand.xDecVtx() + kinkCand.yDecVtx() * kinkCand.yDecVtx()); if (radiusxy < minradius || radiusxy > maxradius) continue; + rpiKkink.fill(HIST("h1_tracks_data"), 10.0); // dcaXYmoth kinkCand.decVtx[0], kinkCand.decVtx[1], kinkCand.decVtx[2], if (qa) { rpiKkink.fill(HIST("tr_dcaxyM"), kinkCand.dcaMothPv()); @@ -615,41 +619,42 @@ struct spectraKinkPiKa { } if (std::abs(kinkCand.dcaMothPv()) > dcaXYcut) continue; - + rpiKkink.fill(HIST("h1_tracks_data"), 11.0); if (kinkCand.dcaKinkTopo() > dcaXYcutkink) continue; - + rpiKkink.fill(HIST("h1_tracks_data"), 12.0); float pMoth = v0.P(); float pDaug = v1.P(); float spKink = mothTrack.px() * dauTrack.px() + mothTrack.py() * dauTrack.py() + mothTrack.pz() * dauTrack.pz(); - float kinkangle = std::acos(spKink / (pMoth * pDaug)); + float angle = std::acos(spKink / (pMoth * pDaug)); float radToDeg = o2::constants::math::Rad2Deg; - if (kinkangle * radToDeg < kinkanglecut) + float kinkangle = angle * radToDeg; + if (kinkangle < kinkanglecut) continue; + rpiKkink.fill(HIST("h1_tracks_data"), 13.0); TVector3 pdlab(v1.Px(), v1.Py(), v1.Pz()); // Compute transverse component TVector3 motherDir(v0.Px(), v0.Py(), v0.Pz()); double ptd = pdlab.Perp(motherDir); // or p_d_lab.Mag() * sin(theta) if (kaon && onlykaon && std::abs(v0.Rapidity()) < rapCut) { + rpiKkink.fill(HIST("h1_tracks_data"), 14.0); v0.SetCoordinates(mothTrack.px(), mothTrack.py(), mothTrack.pz(), o2::constants::physics::MassKaonCharged); if (additionalhist) { rpiKkink.fill(HIST("h2_moth_pt_vs_eta_rec"), v0.Pt(), v0.Eta(), multiplicity); rpiKkink.fill(HIST("h2_dau_pt_vs_eta_rec"), v1.Pt(), v1.Eta(), multiplicity); rpiKkink.fill(HIST("h2_pt_moth_vs_dau_rec"), v0.Pt(), v1.Pt()); - rpiKkink.fill(HIST("h2_kink_angle"), kinkangle, multiplicity); rpiKkink.fill(HIST("h2_qt_vs_pt"), ptd, v1.Pt()); } double mass = computeMotherMass(v0, v1); - rpiKkink.fill(HIST("h2_kaon_data"), mass, v0.Pt(), v0.Rapidity(), ptd, multiplicity); - + rpiKkink.fill(HIST("h2_kaon_data"), mass, v0.Pt(), ptd, multiplicity); + rpiKkink.fill(HIST("h2_kink_angle"), v0.Pt(), kinkangle); if (qa && ptd > minqt && ptd < maxqt) { rpiKkink.fill(HIST("h2_kinkradius_vs_vz_m"), kinkCand.zDecVtx(), radiusxy); rpiKkink.fill(HIST("h2_kink_vx_vs_vy_m"), kinkCand.xDecVtx(), kinkCand.yDecVtx()); rpiKkink.fill(HIST("tpc_dedx_m"), v0.P(), mothTrack.tpcSignal()); rpiKkink.fill(HIST("tpc_nsigma_kaon_m"), v0.Pt(), mothTrack.tpcNSigmaKa()); - rpiKkink.fill(HIST("tpc_nsigma_pion_m"), v0.Pt(), mothTrack.tpcNSigmaPi()); rpiKkink.fill(HIST("tr_chi2nclM_m"), mothTrack.tpcChi2NCl()); rpiKkink.fill(HIST("tr_chi2nclD_m"), dauTrack.tpcChi2NCl()); @@ -661,25 +666,13 @@ struct spectraKinkPiKa { rpiKkink.fill(HIST("tr_dcaxyD_m"), kinkCand.dcaDaugPv()); rpiKkink.fill(HIST("tr_dcaxykink_topo_m"), kinkCand.dcaKinkTopo()); - rpiKkink.fill(HIST("h2_kinkradius_vs_pt"), radiusxy, v0.Pt()); - rpiKkink.fill(HIST("h2_kinkradius_vs_ncl"), radiusxy, mothTrack.tpcNClsFound()); - } - } - if (pion && onlypion && std::abs(v0.Rapidity()) < rapCut) { - v0.SetCoordinates(mothTrack.px(), mothTrack.py(), mothTrack.pz(), o2::constants::physics::MassPionCharged); - if (additionalhist) { - rpiKkink.fill(HIST("h2_moth_pt_vs_eta_rec_pion"), v0.Pt(), v0.Eta(), multiplicity); - rpiKkink.fill(HIST("h2_dau_pt_vs_eta_rec_pion"), v1.Pt(), v1.Eta(), multiplicity); - rpiKkink.fill(HIST("h2_pt_moth_vs_dau_rec_pion"), v0.Pt(), v1.Pt()); - rpiKkink.fill(HIST("h2_kink_angle_pion"), kinkangle, multiplicity); - rpiKkink.fill(HIST("h2_qt_vs_ptpion"), ptd, v1.Pt()); + rpiKkink.fill(HIST("h2_kinkradius_vs_pt_m"), radiusxy, v0.Pt()); + rpiKkink.fill(HIST("h2_kinkradius_vs_ncl_m"), radiusxy, mothTrack.tpcNClsFound()); } - double mass = computeMotherMass(v0, v1); - rpiKkink.fill(HIST("h2_pion_data"), mass, v0.Pt(), v0.Rapidity(), ptd, multiplicity); } } } - PROCESS_SWITCH(spectraKinkPiKa, processData, "Data processing", true); + PROCESS_SWITCH(SpectraKinkPiKa, processData, "Data processing", true); void processMC(CollisionsFullMC const& collisions, aod::KinkCands const& KinkCands, aod::McTrackLabels const& trackLabelsMC, aod::McParticles const& particlesMC, TracksFull const&) { @@ -719,13 +712,37 @@ struct spectraKinkPiKa { LOG(info) << "Skipping kink candidate with opposite sign daughter and mother: " << kinkCand.globalIndex(); continue; // Skip if the daughter has the opposite sign as the mother } - + rpiKkink.fill(HIST("h1_tracks"), 1.0); + if (pvtrack && !mothTrack.isPVContributor()) + continue; + rpiKkink.fill(HIST("h1_tracks"), 2.0); v0.SetCoordinates(mothTrack.px(), mothTrack.py(), mothTrack.pz(), o2::constants::physics::MassKaonCharged); + + double radiusxy = std::sqrt(kinkCand.xDecVtx() * kinkCand.xDecVtx() + kinkCand.yDecVtx() * kinkCand.yDecVtx()); + if (radiusxy < minradius || radiusxy > maxradius) + continue; + rpiKkink.fill(HIST("h1_tracks"), 3.0); + // do MC association + auto mcLabMoth1 = trackLabelsMC.rawIteratorAt(mothTrack.globalIndex()); + if (mcLabMoth1.has_mcParticle()) { + auto mcTrackMoth1 = mcLabMoth1.mcParticle_as(); + if (!mcTrackMoth1.isPhysicalPrimary()) + continue; + if (std::abs(mcTrackMoth1.pdgCode()) == pid) { + rpiKkink.fill(HIST("h2_kaon_pt_vs_rap_rec_full"), v0.Pt(), v0.Rapidity()); + } + } + if (cfgUseItsRefit && !(o2::aod::track::ITSrefit)) + continue; + rpiKkink.fill(HIST("h1_tracks"), 4.0); + if (cfgUseTpcRefit && !(o2::aod::track::TPCrefit)) + continue; + rpiKkink.fill(HIST("h1_tracks"), 5.0); + v1.SetCoordinates(dauTrack.px(), dauTrack.py(), dauTrack.pz(), o2::constants::physics::MassMuon); if (qa) { rpiKkink.fill(HIST("tpc_dedx"), v0.P(), mothTrack.tpcSignal()); rpiKkink.fill(HIST("tpc_nsigma_kaon"), v0.Pt(), mothTrack.tpcNSigmaKa()); - rpiKkink.fill(HIST("tpc_nsigma_pion"), v0.Pt(), mothTrack.tpcNSigmaPi()); rpiKkink.fill(HIST("tr_chi2nclM"), mothTrack.tpcChi2NCl()); rpiKkink.fill(HIST("tr_chi2nclD"), dauTrack.tpcChi2NCl()); @@ -735,23 +752,20 @@ struct spectraKinkPiKa { } if (mothTrack.tpcChi2NCl() > tpcChi2Cut) continue; - + rpiKkink.fill(HIST("h1_tracks"), 6.0); if (mothTrack.tpcNClsFound() > maxtpcncle || mothTrack.tpcNClsFound() < mintpcncle) continue; - + rpiKkink.fill(HIST("h1_tracks"), 7.0); bool kaon = false; - if (std::abs(mothTrack.tpcNSigmaKa()) < cutNSigmaKa) { + if (std::abs(mothTrack.tpcNSigmaKa()) < cutNsigmaKa) { kaon = true; } - if (dptCut && v1.Pt() > v0.Pt()) continue; - + rpiKkink.fill(HIST("h1_tracks"), 8.0); if (!kaon) continue; - double radiusxy = std::sqrt(kinkCand.xDecVtx() * kinkCand.xDecVtx() + kinkCand.yDecVtx() * kinkCand.yDecVtx()); - if (radiusxy < minradius || radiusxy > maxradius) - continue; + rpiKkink.fill(HIST("h1_tracks"), 9.0); if (qa) { rpiKkink.fill(HIST("tr_dcaxyM"), kinkCand.dcaMothPv()); rpiKkink.fill(HIST("tr_dcaxyD"), kinkCand.dcaDaugPv()); @@ -765,23 +779,26 @@ struct spectraKinkPiKa { } if (std::abs(kinkCand.dcaMothPv()) > dcaXYcut) continue; - + rpiKkink.fill(HIST("h1_tracks"), 10.0); if (kinkCand.dcaKinkTopo() > dcaXYcutkink) continue; - + rpiKkink.fill(HIST("h1_tracks"), 11.0); float pMoth = v0.P(); float pDaug = v1.P(); float spKink = mothTrack.px() * dauTrack.px() + mothTrack.py() * dauTrack.py() + mothTrack.pz() * dauTrack.pz(); - float kinkangle = std::acos(spKink / (pMoth * pDaug)); + float angle = std::acos(spKink / (pMoth * pDaug)); float radToDeg = o2::constants::math::Rad2Deg; - if (kinkangle * radToDeg < kinkanglecut) + float kinkangle = angle * radToDeg; + if (kinkangle < kinkanglecut) continue; + + rpiKkink.fill(HIST("h1_tracks"), 12.0); if (additionalhist) { rpiKkink.fill(HIST("h2_moth_pt_vs_eta_rec"), v0.Pt(), v0.Eta(), multiplicity); rpiKkink.fill(HIST("h2_dau_pt_vs_eta_rec"), v1.Pt(), v1.Eta(), multiplicity); rpiKkink.fill(HIST("h2_pt_moth_vs_dau_rec"), v0.Pt(), v1.Pt()); - rpiKkink.fill(HIST("h2_kink_angle"), kinkangle, multiplicity); } + rpiKkink.fill(HIST("h2_kink_angle"), v0.Pt(), kinkangle); TVector3 pdlab(v1.Px(), v1.Py(), v1.Pz()); // Compute transverse component TVector3 motherDir(v0.Px(), v0.Py(), v0.Pz()); @@ -790,56 +807,70 @@ struct spectraKinkPiKa { rpiKkink.fill(HIST("h2_qt"), ptd); double mass = computeMotherMass(v0, v1); - rpiKkink.fill(HIST("h2_invmass_kaon"), mass, v0.Pt(), ptd); - rpiKkink.fill(HIST("h2_kaon_mc_rec"), mass, v0.Pt(), v0.Eta(), ptd, multiplicity); + rpiKkink.fill(HIST("h2_kaon_mc_rec"), mass, v0.Pt(), ptd, multiplicity); // do MC association auto mcLabMoth = trackLabelsMC.rawIteratorAt(mothTrack.globalIndex()); auto mcLabDau = trackLabelsMC.rawIteratorAt(dauTrack.globalIndex()); - if (mcLabMoth.has_mcParticle() && mcLabDau.has_mcParticle()) { - + if (mcLabMoth.has_mcParticle()) { auto mcTrackMoth = mcLabMoth.mcParticle_as(); - auto mcTrackDau = mcLabDau.mcParticle_as(); + if (!mcTrackMoth.isPhysicalPrimary()) + continue; + rpiKkink.fill(HIST("h1_tracks"), 13.0); - if (!mcTrackDau.has_mothers()) { + if (std::abs(mcTrackMoth.pdgCode()) != pid) continue; - } - for (const auto& piMother : mcTrackDau.mothers_as()) { - if (piMother.globalIndex() != mcTrackMoth.globalIndex()) { + rpiKkink.fill(HIST("h2_kaon_pt_vs_rap_rec_full1"), v0.Pt(), v0.Rapidity()); + if (mcLabDau.has_mcParticle()) { + auto mcTrackDau = mcLabDau.mcParticle_as(); + if (!mcTrackDau.has_mothers()) continue; - } - if (std::abs(mcTrackMoth.pdgCode()) != pid || std::abs(mcTrackDau.pdgCode()) != dpid) { + rpiKkink.fill(HIST("h1_tracks"), 14.0); + const int process = 4; + if (mcTrackDau.getProcess() != process) continue; - } - if (additionalhist) { - rpiKkink.fill(HIST("h2_moth_pt_vs_eta_rec_m"), v0.Pt(), v0.Eta(), multiplicity); - rpiKkink.fill(HIST("h2_dau_pt_vs_eta_rec_m"), v1.Pt(), v1.Eta(), multiplicity); - rpiKkink.fill(HIST("h2_pt_moth_vs_dau_rec_m"), v0.Pt(), v1.Pt()); - rpiKkink.fill(HIST("h2_kink_angle_m"), kinkangle, multiplicity); - } - rpiKkink.fill(HIST("h2_kaon_mc_rec_m"), mass, v0.Pt(), v0.Rapidity(), ptd, multiplicity); - if (qa && ptd > minqt && ptd < maxqt) { - rpiKkink.fill(HIST("h2_kinkradius_vs_vz_m"), kinkCand.zDecVtx(), radiusxy); - rpiKkink.fill(HIST("h2_kink_vx_vs_vy_m"), kinkCand.xDecVtx(), kinkCand.yDecVtx()); - - rpiKkink.fill(HIST("tpc_dedx_m"), v0.P(), mothTrack.tpcSignal()); - rpiKkink.fill(HIST("tpc_nsigma_kaon_m"), v0.Pt(), mothTrack.tpcNSigmaKa()); - rpiKkink.fill(HIST("tpc_nsigma_pion_m"), v0.Pt(), mothTrack.tpcNSigmaPi()); - - rpiKkink.fill(HIST("tr_chi2nclM_m"), mothTrack.tpcChi2NCl()); - rpiKkink.fill(HIST("tr_chi2nclD_m"), dauTrack.tpcChi2NCl()); - rpiKkink.fill(HIST("tr_tpcnclfindM_m"), mothTrack.tpcNClsFound()); - rpiKkink.fill(HIST("tr_tpcnclfindD_m"), dauTrack.tpcNClsFound()); - rpiKkink.fill(HIST("tr_itsChi2NClM_m"), mothTrack.itsChi2NCl()); - - rpiKkink.fill(HIST("tr_dcaxyM_m"), kinkCand.dcaMothPv()); - rpiKkink.fill(HIST("tr_dcaxyD_m"), kinkCand.dcaDaugPv()); - rpiKkink.fill(HIST("tr_dcaxykink_topo_m"), kinkCand.dcaKinkTopo()); - - rpiKkink.fill(HIST("h2_kinkradius_vs_pt_m"), radiusxy, v0.Pt()); - rpiKkink.fill(HIST("h2_kinkradius_vs_ncl_m"), radiusxy, mothTrack.tpcNClsFound()); + rpiKkink.fill(HIST("h1_tracks"), 15.0); + + for (const auto& piMother : mcTrackDau.mothers_as()) { + if (piMother.globalIndex() != mcTrackMoth.globalIndex()) { + continue; + } + // std::cout< minqt && ptd < maxqt) { + rpiKkink.fill(HIST("h2_kinkradius_vs_vz_m"), kinkCand.zDecVtx(), radiusxy); + rpiKkink.fill(HIST("h2_kink_vx_vs_vy_m"), kinkCand.xDecVtx(), kinkCand.yDecVtx()); + + rpiKkink.fill(HIST("tpc_dedx_m"), v0.P(), mothTrack.tpcSignal()); + rpiKkink.fill(HIST("tpc_nsigma_kaon_m"), v0.Pt(), mothTrack.tpcNSigmaKa()); + + rpiKkink.fill(HIST("tr_chi2nclM_m"), mothTrack.tpcChi2NCl()); + rpiKkink.fill(HIST("tr_chi2nclD_m"), dauTrack.tpcChi2NCl()); + rpiKkink.fill(HIST("tr_tpcnclfindM_m"), mothTrack.tpcNClsFound()); + rpiKkink.fill(HIST("tr_tpcnclfindD_m"), dauTrack.tpcNClsFound()); + rpiKkink.fill(HIST("tr_itsChi2NClM_m"), mothTrack.itsChi2NCl()); + + rpiKkink.fill(HIST("tr_dcaxyM_m"), kinkCand.dcaMothPv()); + rpiKkink.fill(HIST("tr_dcaxyD_m"), kinkCand.dcaDaugPv()); + rpiKkink.fill(HIST("tr_dcaxykink_topo_m"), kinkCand.dcaKinkTopo()); + + rpiKkink.fill(HIST("h2_kinkradius_vs_pt_m"), radiusxy, v0.Pt()); + rpiKkink.fill(HIST("h2_kinkradius_vs_ncl_m"), radiusxy, mothTrack.tpcNClsFound()); + } } } } @@ -849,62 +880,78 @@ struct spectraKinkPiKa { for (const auto& mcPart : particlesMC) { ROOT::Math::PxPyPzMVector v0; ROOT::Math::PxPyPzMVector v1; - if (std::abs(mcPart.pdgCode()) != pid) { continue; } - + rpiKkink.fill(HIST("h1_tracks_gen"), 1.0); + if (!mcPart.isPhysicalPrimary()) { + continue; + } + rpiKkink.fill(HIST("h1_tracks_gen"), 2.0); + v0.SetCoordinates(mcPart.px(), mcPart.py(), mcPart.pz(), o2::constants::physics::MassKaonCharged); + if (std::abs(v0.Rapidity()) > rapCut) { + continue; + } + rpiKkink.fill(HIST("h2_moth_pt_vs_rap_genall"), v0.Pt(), v0.Rapidity()); + rpiKkink.fill(HIST("h1_tracks_gen"), 3.0); if (!mcPart.has_daughters()) { continue; // Skip if no daughters } - bool hasKaonpionDaughter = false; + rpiKkink.fill(HIST("h1_tracks_gen"), 4.0); + int muond = 0; + int piond = 0; + int eld = 0; + double ptd = 0; + const int process = 4; for (const auto& daughter : mcPart.daughters_as()) { - if (std::abs(daughter.pdgCode()) == dpid) { // muon PDG code - hasKaonpionDaughter = true; - v1.SetCoordinates(daughter.px(), daughter.py(), daughter.pz(), o2::constants::physics::MassMuon); - break; // Found a muon daughter, exit loop + if (daughter.getProcess() != process) + continue; + v1.SetCoordinates(daughter.px(), daughter.py(), daughter.pz(), o2::constants::physics::MassMuon); + ptd = computeQt(v0, v1); + if (std::abs(daughter.pdgCode()) == kElectron) { + eld++; + } else if (std::abs(daughter.pdgCode()) == kMuonPlus) { + muond++; + } else if (std::abs(daughter.pdgCode()) == kPiPlus) { + piond++; } } - if (!hasKaonpionDaughter) { - continue; // Skip if no muon daughter found - } - if (pid == kKPlus) { - v0.SetCoordinates(mcPart.px(), mcPart.py(), mcPart.pz(), o2::constants::physics::MassKaonCharged); - } - - if (pid == kPiPlus) { - v0.SetCoordinates(mcPart.px(), mcPart.py(), mcPart.pz(), o2::constants::physics::MassPionCharged); - } - + if (eld >= 1) + rpiKkink.fill(HIST("h2_moth_ptrapqt_egen"), v0.Pt(), v0.Rapidity(), ptd); + if (muond >= 1) + rpiKkink.fill(HIST("h2_moth_ptrapqt_mugen"), v0.Pt(), v0.Rapidity(), ptd); + if (piond >= 1) + rpiKkink.fill(HIST("h2_moth_ptrapqt_pigen"), v0.Pt(), v0.Rapidity(), ptd); + rpiKkink.fill(HIST("h1_tracks_gen"), 5.0); float pMoth = v0.P(); float pDaug = v1.P(); float spKink = v0.Px() * v1.Px() + v0.Py() * v1.Py() + v0.Pz() * v1.Pz(); - float kinkangle = std::acos(spKink / (pMoth * pDaug)); + float angle = std::acos(spKink / (pMoth * pDaug)); float radToDeg = o2::constants::math::Rad2Deg; - if (kinkangle * radToDeg < kinkanglecut) - continue; + float kinkangle = angle * radToDeg; + // if (kinkangle * radToDeg < kinkanglecut) + // continue; if (additionalhist) { rpiKkink.fill(HIST("h2_moth_pt_vs_eta_gen"), v0.Pt(), v0.Eta()); rpiKkink.fill(HIST("h2_dau_pt_vs_eta_gen"), v1.Pt(), v1.Eta()); rpiKkink.fill(HIST("h2_pt_moth_vs_dau_gen"), v0.Pt(), v1.Pt()); - rpiKkink.fill(HIST("h2_kink_angle_gen"), kinkangle); } - TVector3 pdlab(v1.Px(), v1.Py(), v1.Pz()); - // Compute transverse component - TVector3 motherDir(v0.Px(), v0.Py(), v0.Pz()); - double ptd = pdlab.Perp(motherDir); // or p_d_lab.Mag() * sin(theta) + rpiKkink.fill(HIST("h2_kink_angle_gen"), v0.Pt(), kinkangle); rpiKkink.fill(HIST("h2_qt_gen"), ptd); double mass = computeMotherMass(v0, v1); - rpiKkink.fill(HIST("h2_kaon_mc_gen"), mass, v0.Pt(), v0.Rapidity(), ptd); + if (eld >= 1 || muond >= 1 || piond >= 1) { + rpiKkink.fill(HIST("h2_kaon_mc_gen"), mass, v0.Pt(), ptd); + } else { + rpiKkink.fill(HIST("h2_kaon_mc_gen1"), mass, v0.Pt(), ptd); + } } } - PROCESS_SWITCH(spectraKinkPiKa, processMC, "MC processing", false); + PROCESS_SWITCH(SpectraKinkPiKa, processMC, "MC processing", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - auto builderTask = adaptAnalysisTask(cfgc); - auto spectraTask = adaptAnalysisTask(cfgc); - + auto builderTask = adaptAnalysisTask(cfgc); + auto spectraTask = adaptAnalysisTask(cfgc); return {builderTask, spectraTask}; // Just return both tasks } From 49d8ffe1f8ec793f5f699f00ab0bb1445ba862c2 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 31 Oct 2025 02:44:08 +0100 Subject: [PATCH 961/986] [PWGEM/Dilepton] re-structure lepton object (#13610) --- PWGEM/Dilepton/Core/DileptonHadronMPC.h | 8 +- PWGEM/Dilepton/Core/PhotonHBT.h | 139 ++++++++++---------- PWGEM/Dilepton/Utils/EMTrack.h | 162 ++++++++++++------------ 3 files changed, 156 insertions(+), 153 deletions(-) diff --git a/PWGEM/Dilepton/Core/DileptonHadronMPC.h b/PWGEM/Dilepton/Core/DileptonHadronMPC.h index 3aa08563b00..b6be899fa62 100644 --- a/PWGEM/Dilepton/Core/DileptonHadronMPC.h +++ b/PWGEM/Dilepton/Core/DileptonHadronMPC.h @@ -822,10 +822,10 @@ struct DileptonHadronMPC { used_trackIds_per_col.emplace_back(t1.globalIndex()); if (cfgDoMix) { if (t1.sign() > 0) { - emh_pos->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.fwdtrackId(), t1.pt(), t1.eta(), t1.phi(), o2::constants::physics::MassMuon, t1.sign(), t1.fwdDcaX(), t1.fwdDcaY(), possibleIds1, + emh_pos->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.fwdtrackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.fwdDcaX(), t1.fwdDcaY(), possibleIds1, t1.cXXatDCA(), t1.cXYatDCA(), t1.cYYatDCA())); } else { - emh_neg->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.fwdtrackId(), t1.pt(), t1.eta(), t1.phi(), o2::constants::physics::MassMuon, t1.sign(), t1.fwdDcaX(), t1.fwdDcaY(), possibleIds1, + emh_neg->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.fwdtrackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.fwdDcaX(), t1.fwdDcaY(), possibleIds1, t1.cXXatDCA(), t1.cXYatDCA(), t1.cYYatDCA())); } } @@ -834,10 +834,10 @@ struct DileptonHadronMPC { used_trackIds_per_col.emplace_back(t2.globalIndex()); if (cfgDoMix) { if (t2.sign() > 0) { - emh_pos->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.fwdtrackId(), t2.pt(), t2.eta(), t2.phi(), o2::constants::physics::MassMuon, t2.sign(), t2.fwdDcaX(), t2.fwdDcaY(), possibleIds2, + emh_pos->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.fwdtrackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.fwdDcaX(), t2.fwdDcaY(), possibleIds2, t2.cXXatDCA(), t2.cXYatDCA(), t2.cYYatDCA())); } else { - emh_neg->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.fwdtrackId(), t2.pt(), t2.eta(), t2.phi(), o2::constants::physics::MassMuon, t2.sign(), t2.fwdDcaX(), t2.fwdDcaY(), possibleIds2, + emh_neg->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.fwdtrackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.fwdDcaX(), t2.fwdDcaY(), possibleIds2, t2.cXXatDCA(), t2.cXYatDCA(), t2.cYYatDCA())); } } diff --git a/PWGEM/Dilepton/Core/PhotonHBT.h b/PWGEM/Dilepton/Core/PhotonHBT.h index 46d5e1852ab..2646ce7fe7b 100644 --- a/PWGEM/Dilepton/Core/PhotonHBT.h +++ b/PWGEM/Dilepton/Core/PhotonHBT.h @@ -276,10 +276,10 @@ struct PhotonHBT { map_mixed_eventId_to_globalBC.clear(); - used_photonIds.clear(); - used_photonIds.shrink_to_fit(); - used_dileptonIds.clear(); - used_dileptonIds.shrink_to_fit(); + used_photonIds_per_col.clear(); + used_photonIds_per_col.shrink_to_fit(); + used_dileptonIds_per_col.clear(); + used_dileptonIds_per_col.shrink_to_fit(); } HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; @@ -304,7 +304,7 @@ struct PhotonHBT { if (ConfVtxBins.value[0] == VARIABLE_WIDTH) { zvtx_bin_edges = std::vector(ConfVtxBins.value.begin(), ConfVtxBins.value.end()); zvtx_bin_edges.erase(zvtx_bin_edges.begin()); - for (auto& edge : zvtx_bin_edges) { + for (const auto& edge : zvtx_bin_edges) { LOGF(info, "VARIABLE_WIDTH: zvtx_bin_edges = %f", edge); } } else { @@ -321,7 +321,7 @@ struct PhotonHBT { if (ConfCentBins.value[0] == VARIABLE_WIDTH) { cent_bin_edges = std::vector(ConfCentBins.value.begin(), ConfCentBins.value.end()); cent_bin_edges.erase(cent_bin_edges.begin()); - for (auto& edge : cent_bin_edges) { + for (const auto& edge : cent_bin_edges) { LOGF(info, "VARIABLE_WIDTH: cent_bin_edges = %f", edge); } } else { @@ -338,7 +338,7 @@ struct PhotonHBT { if (ConfEPBins.value[0] == VARIABLE_WIDTH) { ep_bin_edges = std::vector(ConfEPBins.value.begin(), ConfEPBins.value.end()); ep_bin_edges.erase(ep_bin_edges.begin()); - for (auto& edge : ep_bin_edges) { + for (const auto& edge : ep_bin_edges) { LOGF(info, "VARIABLE_WIDTH: ep_bin_edges = %f", edge); } } else { @@ -356,7 +356,7 @@ struct PhotonHBT { if (ConfOccupancyBins.value[0] == VARIABLE_WIDTH) { occ_bin_edges = std::vector(ConfOccupancyBins.value.begin(), ConfOccupancyBins.value.end()); occ_bin_edges.erase(occ_bin_edges.begin()); - for (auto& edge : occ_bin_edges) { + for (const auto& edge : occ_bin_edges) { LOGF(info, "VARIABLE_WIDTH: occ_bin_edges = %f", edge); } } else { @@ -703,7 +703,7 @@ struct PhotonHBT { template void runPairing(TCollisions const& collisions, TPhotons1 const& photons1, TPhotons2 const& photons2, TSubInfos1 const&, TSubInfos2 const&, TPreslice1 const& perCollision1, TPreslice2 const& perCollision2, TCut1 const& cut1, TCut2 const& cut2) { - for (auto& collision : collisions) { + for (const auto& collision : collisions) { initCCDB(collision); int ndiphoton = 0; const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; @@ -777,7 +777,7 @@ struct PhotonHBT { if constexpr (pairtype == ggHBTPairType::kPCMPCM) { auto photons1_coll = photons1.sliceBy(perCollision1, collision.globalIndex()); auto photons2_coll = photons2.sliceBy(perCollision2, collision.globalIndex()); - for (auto& [g1, g2] : combinations(CombinationsStrictlyUpperIndexPolicy(photons1_coll, photons2_coll))) { + for (const auto& [g1, g2] : combinations(CombinationsStrictlyUpperIndexPolicy(photons1_coll, photons2_coll))) { if (!cut1.template IsSelected(g1) || !cut2.template IsSelected(g2)) { continue; } @@ -826,23 +826,21 @@ struct PhotonHBT { fillPairHistogram<0>(collision, v1, v2, 1.f); ndiphoton++; - std::pair pair_tmp_id1 = std::make_pair(ndf, g1.globalIndex()); - std::pair pair_tmp_id2 = std::make_pair(ndf, g2.globalIndex()); - if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id1) == used_photonIds.end()) { - EMTrack g1tmp = EMTrack(ndf, g1.globalIndex(), collision.globalIndex(), g1.globalIndex(), g1.pt(), g1.eta(), g1.phi(), 0); + if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g1.globalIndex()) == used_photonIds_per_col.end()) { + EMPair g1tmp = EMPair(ndf, g1.globalIndex(), collision.globalIndex(), g1.globalIndex(), g1.pt(), g1.eta(), g1.phi(), 0); g1tmp.setConversionPointXYZ(g1.vx(), g1.vy(), g1.vz()); g1tmp.setPositiveLegPtEtaPhiM(pos1.pt(), pos1.eta(), pos1.phi(), o2::constants::physics::MassElectron); g1tmp.setNegativeLegPtEtaPhiM(ele1.pt(), ele1.eta(), ele1.phi(), o2::constants::physics::MassElectron); emh1->AddTrackToEventPool(key_df_collision, g1tmp); - used_photonIds.emplace_back(pair_tmp_id1); + used_photonIds_per_col.emplace_back(g1.globalIndex()); } - if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id2) == used_photonIds.end()) { - EMTrack g2tmp = EMTrack(ndf, g2.globalIndex(), collision.globalIndex(), g2.globalIndex(), g2.pt(), g2.eta(), g2.phi(), 0); + if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g2.globalIndex()) == used_photonIds_per_col.end()) { + EMPair g2tmp = EMPair(ndf, g2.globalIndex(), collision.globalIndex(), g2.globalIndex(), g2.pt(), g2.eta(), g2.phi(), 0); g2tmp.setConversionPointXYZ(g2.vx(), g2.vy(), g2.vz()); g2tmp.setPositiveLegPtEtaPhiM(pos2.pt(), pos2.eta(), pos2.phi(), o2::constants::physics::MassElectron); g2tmp.setNegativeLegPtEtaPhiM(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron); emh1->AddTrackToEventPool(key_df_collision, g2tmp); - used_photonIds.emplace_back(pair_tmp_id2); + used_photonIds_per_col.emplace_back(g2.globalIndex()); } } // end of pairing loop } else if constexpr (pairtype == ggHBTPairType::kEEEE) { @@ -852,7 +850,7 @@ struct PhotonHBT { used_pairs_per_collision.reserve(std::pow(positrons_per_collision.size() * electrons_per_collision.size(), 2)); // LOGF(info, "collision.globalIndex() = %d, positrons_per_collision.size() = %d, electrons_per_collision.size() = %d", collision.globalIndex(), positrons_per_collision.size(), electrons_per_collision.size()); - for (auto& [pos1, ele1] : combinations(CombinationsFullIndexPolicy(positrons_per_collision, electrons_per_collision))) { + for (const auto& [pos1, ele1] : combinations(CombinationsFullIndexPolicy(positrons_per_collision, electrons_per_collision))) { if (pos1.trackId() == ele1.trackId()) { // this is protection against pairing identical 2 tracks. // never happens. only for protection. continue; } @@ -872,15 +870,15 @@ struct PhotonHBT { ROOT::Math::PtEtaPhiMVector v_pos1(pos1.pt(), pos1.eta(), pos1.phi(), o2::constants::physics::MassElectron); ROOT::Math::PtEtaPhiMVector v_ele1(ele1.pt(), ele1.eta(), ele1.phi(), o2::constants::physics::MassElectron); ROOT::Math::PtEtaPhiMVector v1_ee = v_pos1 + v_ele1; - float dca_pos1_3d = dca3DinSigma(pos1); - float dca_ele1_3d = dca3DinSigma(ele1); - float dca1_3d = std::sqrt((dca_pos1_3d * dca_pos1_3d + dca_ele1_3d * dca_ele1_3d) / 2.); + // float dca_pos1_3d = dca3DinSigma(pos1); + // float dca_ele1_3d = dca3DinSigma(ele1); + // float dca1_3d = std::sqrt((dca_pos1_3d * dca_pos1_3d + dca_ele1_3d * dca_ele1_3d) / 2.); float weight1 = 1.f; if (cfgApplyWeightTTCA) { weight1 = map_weight[std::make_pair(pos1.globalIndex(), ele1.globalIndex())]; } - for (auto& [pos2, ele2] : combinations(CombinationsFullIndexPolicy(positrons_per_collision, electrons_per_collision))) { + for (const auto& [pos2, ele2] : combinations(CombinationsFullIndexPolicy(positrons_per_collision, electrons_per_collision))) { if (pos2.trackId() == ele2.trackId()) { // this is protection against pairing identical 2 tracks. // never happens. only for protection. continue; } @@ -906,9 +904,9 @@ struct PhotonHBT { weight2 = map_weight[std::make_pair(pos2.globalIndex(), ele2.globalIndex())]; } - float dca_pos2_3d = dca3DinSigma(pos2); - float dca_ele2_3d = dca3DinSigma(ele2); - float dca2_3d = std::sqrt((dca_pos2_3d * dca_pos2_3d + dca_ele2_3d * dca_ele2_3d) / 2.); + // float dca_pos2_3d = dca3DinSigma(pos2); + // float dca_ele2_3d = dca3DinSigma(ele2); + // float dca2_3d = std::sqrt((dca_pos2_3d * dca_pos2_3d + dca_ele2_3d * dca_ele2_3d) / 2.); ROOT::Math::PtEtaPhiMVector v_pos2(pos2.pt(), pos2.eta(), pos2.phi(), o2::constants::physics::MassElectron); ROOT::Math::PtEtaPhiMVector v_ele2(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron); @@ -944,41 +942,39 @@ struct PhotonHBT { used_pairs_per_collision.emplace_back(std::make_pair(pair_tmp.second, pair_tmp.first)); // LOGF(info, "collision.globalIndex() = %d, pos1.trackId() = %d, ele1.trackId() = %d, pos2.trackId() = %d, ele2.trackId() = %d", collision.globalIndex(), pos1.trackId(), ele1.trackId(), pos2.trackId(), ele2.trackId()); - std::tuple tuple_tmp_id1 = std::make_tuple(ndf, collision.globalIndex(), pos1.globalIndex(), ele1.globalIndex()); - std::tuple tuple_tmp_id2 = std::make_tuple(ndf, collision.globalIndex(), pos2.globalIndex(), ele2.globalIndex()); - if (std::find(used_dileptonIds.begin(), used_dileptonIds.end(), tuple_tmp_id1) == used_dileptonIds.end()) { + std::pair tuple_tmp_id1 = std::make_pair(pos1.globalIndex(), ele1.globalIndex()); + std::pair tuple_tmp_id2 = std::make_pair(pos2.globalIndex(), ele2.globalIndex()); + if (std::find(used_dileptonIds_per_col.begin(), used_dileptonIds_per_col.end(), tuple_tmp_id1) == used_dileptonIds_per_col.end()) { std::vector possibleIds_pos1; std::vector possibleIds_ele1; std::copy(pos1.ambiguousElectronsIds().begin(), pos1.ambiguousElectronsIds().end(), std::back_inserter(possibleIds_pos1)); std::copy(ele1.ambiguousElectronsIds().begin(), ele1.ambiguousElectronsIds().end(), std::back_inserter(possibleIds_ele1)); - EMTrack g1pair = EMTrack(ndf, -1, collision.globalIndex(), -1, v1_ee.Pt(), v1_ee.Eta(), v1_ee.Phi(), v1_ee.M()); + EMPair g1pair = EMPair(ndf, -1, collision.globalIndex(), -1, v1_ee.Pt(), v1_ee.Eta(), v1_ee.Phi(), v1_ee.M()); g1pair.setGlobalPosId(pos1.globalIndex()); g1pair.setGlobalNegId(ele1.globalIndex()); - g1pair.setPairDca3DinSigmaOTF(dca1_3d); g1pair.setPositiveLegPtEtaPhiM(pos1.pt(), pos1.eta(), pos1.phi(), o2::constants::physics::MassElectron); g1pair.setNegativeLegPtEtaPhiM(ele1.pt(), ele1.eta(), ele1.phi(), o2::constants::physics::MassElectron); g1pair.setAmbPosLegSelfIds(possibleIds_pos1); g1pair.setAmbNegLegSelfIds(possibleIds_ele1); emh1->AddTrackToEventPool(key_df_collision, g1pair); - used_dileptonIds.emplace_back(tuple_tmp_id1); + used_dileptonIds_per_col.emplace_back(tuple_tmp_id1); } - if (std::find(used_dileptonIds.begin(), used_dileptonIds.end(), tuple_tmp_id2) == used_dileptonIds.end()) { + if (std::find(used_dileptonIds_per_col.begin(), used_dileptonIds_per_col.end(), tuple_tmp_id2) == used_dileptonIds_per_col.end()) { std::vector possibleIds_pos2; std::vector possibleIds_ele2; std::copy(pos2.ambiguousElectronsIds().begin(), pos2.ambiguousElectronsIds().end(), std::back_inserter(possibleIds_pos2)); std::copy(ele2.ambiguousElectronsIds().begin(), ele2.ambiguousElectronsIds().end(), std::back_inserter(possibleIds_ele2)); - EMTrack g2pair = EMTrack(ndf, -1, collision.globalIndex(), -1, v2_ee.Pt(), v2_ee.Eta(), v2_ee.Phi(), v2_ee.M()); + EMPair g2pair = EMPair(ndf, -1, collision.globalIndex(), -1, v2_ee.Pt(), v2_ee.Eta(), v2_ee.Phi(), v2_ee.M()); g2pair.setGlobalPosId(pos2.globalIndex()); g2pair.setGlobalNegId(ele2.globalIndex()); - g2pair.setPairDca3DinSigmaOTF(dca2_3d); g2pair.setPositiveLegPtEtaPhiM(pos2.pt(), pos2.eta(), pos2.phi(), o2::constants::physics::MassElectron); g2pair.setNegativeLegPtEtaPhiM(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron); g2pair.setAmbPosLegSelfIds(possibleIds_pos2); g2pair.setAmbNegLegSelfIds(possibleIds_ele2); emh1->AddTrackToEventPool(key_df_collision, g2pair); - used_dileptonIds.emplace_back(tuple_tmp_id2); + used_dileptonIds_per_col.emplace_back(tuple_tmp_id2); } } } // end of g2 loop @@ -990,7 +986,7 @@ struct PhotonHBT { auto positrons_per_collision = positrons->sliceByCached(o2::aod::emprimaryelectron::emeventId, collision.globalIndex(), cache); auto electrons_per_collision = electrons->sliceByCached(o2::aod::emprimaryelectron::emeventId, collision.globalIndex(), cache); - for (auto& g1 : photons1_per_collision) { + for (const auto& g1 : photons1_per_collision) { if (!cut1.template IsSelected(g1)) { continue; } @@ -998,7 +994,7 @@ struct PhotonHBT { auto ele1 = g1.template negTrack_as(); ROOT::Math::PtEtaPhiMVector v1_gamma(g1.pt(), g1.eta(), g1.phi(), 0.); - for (auto& [pos2, ele2] : combinations(CombinationsFullIndexPolicy(positrons_per_collision, electrons_per_collision))) { + for (const auto& [pos2, ele2] : combinations(CombinationsFullIndexPolicy(positrons_per_collision, electrons_per_collision))) { if (pos2.trackId() == ele2.trackId()) { // this is protection against pairing identical 2 tracks. // never happens. only for protection. continue; } @@ -1025,9 +1021,9 @@ struct PhotonHBT { } // LOGF(info, "g1.globalIndex() = %d, map_weight[std::make_pair(%d, %d)] = %f", g1.globalIndex(), pos2.globalIndex(), ele2.globalIndex(), weight); - float dca_pos2_3d = dca3DinSigma(pos2); - float dca_ele2_3d = dca3DinSigma(ele2); - float dca2_3d = std::sqrt((dca_pos2_3d * dca_pos2_3d + dca_ele2_3d * dca_ele2_3d) / 2.); + // float dca_pos2_3d = dca3DinSigma(pos2); + // float dca_ele2_3d = dca3DinSigma(ele2); + // float dca2_3d = std::sqrt((dca_pos2_3d * dca_pos2_3d + dca_ele2_3d * dca_ele2_3d) / 2.); ROOT::Math::PtEtaPhiMVector v_pos2(pos2.pt(), pos2.eta(), pos2.phi(), o2::constants::physics::MassElectron); ROOT::Math::PtEtaPhiMVector v_ele2(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron); @@ -1058,28 +1054,31 @@ struct PhotonHBT { fillPairHistogram<0>(collision, v1_gamma, v2_ee, weight); ndiphoton++; - std::pair pair_tmp_id1 = std::make_pair(ndf, g1.globalIndex()); - std::tuple tuple_tmp_id2 = std::make_tuple(ndf, collision.globalIndex(), pos2.globalIndex(), ele2.globalIndex()); - if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id1) == used_photonIds.end()) { - EMTrack g1tmp = EMTrack(ndf, g1.globalIndex(), collision.globalIndex(), g1.globalIndex(), g1.pt(), g1.eta(), g1.phi(), 0); + std::pair tuple_tmp_id2 = std::make_pair(pos2.globalIndex(), ele2.globalIndex()); + if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g1.globalIndex()) == used_photonIds_per_col.end()) { + EMPair g1tmp = EMPair(ndf, g1.globalIndex(), collision.globalIndex(), g1.globalIndex(), g1.pt(), g1.eta(), g1.phi(), 0); g1tmp.setConversionPointXYZ(g1.vx(), g1.vy(), g1.vz()); g1tmp.setPositiveLegPtEtaPhiM(pos1.pt(), pos1.eta(), pos1.phi(), o2::constants::physics::MassElectron); g1tmp.setNegativeLegPtEtaPhiM(ele1.pt(), ele1.eta(), ele1.phi(), o2::constants::physics::MassElectron); emh1->AddTrackToEventPool(key_df_collision, g1tmp); - used_photonIds.emplace_back(pair_tmp_id1); + used_photonIds_per_col.emplace_back(g1.globalIndex()); } - if (std::find(used_dileptonIds.begin(), used_dileptonIds.end(), tuple_tmp_id2) == used_dileptonIds.end()) { - EMTrack g2pair = EMTrack(ndf, -1, collision.globalIndex(), -1, v2_ee.Pt(), v2_ee.Eta(), v2_ee.Phi(), v2_ee.M()); - g2pair.setPairDca3DinSigmaOTF(dca2_3d); + if (std::find(used_dileptonIds_per_col.begin(), used_dileptonIds_per_col.end(), tuple_tmp_id2) == used_dileptonIds_per_col.end()) { + EMPair g2pair = EMPair(ndf, -1, collision.globalIndex(), -1, v2_ee.Pt(), v2_ee.Eta(), v2_ee.Phi(), v2_ee.M()); g2pair.setPositiveLegPtEtaPhiM(pos2.pt(), pos2.eta(), pos2.phi(), o2::constants::physics::MassElectron); g2pair.setNegativeLegPtEtaPhiM(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron); emh2->AddTrackToEventPool(key_df_collision, g2pair); - used_dileptonIds.emplace_back(tuple_tmp_id2); + used_dileptonIds_per_col.emplace_back(tuple_tmp_id2); } } // end of g2 loop } // end of g1 loop } + used_photonIds_per_col.clear(); + used_photonIds_per_col.shrink_to_fit(); + used_dileptonIds_per_col.clear(); + used_dileptonIds_per_col.shrink_to_fit(); + // event mixing if (!cfgDoMix || !(ndiphoton > 0)) { continue; @@ -1093,7 +1092,7 @@ struct PhotonHBT { auto collisionIds2_in_mixing_pool = emh2->GetCollisionIdsFromEventPool(key_bin); if constexpr (pairtype == ggHBTPairType::kPCMPCM) { - for (auto& mix_dfId_collisionId : collisionIds1_in_mixing_pool) { + for (const auto& mix_dfId_collisionId : collisionIds1_in_mixing_pool) { int mix_dfId = mix_dfId_collisionId.first; int64_t mix_collisionId = mix_dfId_collisionId.second; @@ -1111,8 +1110,8 @@ struct PhotonHBT { auto photons1_from_event_pool = emh1->GetTracksPerCollision(mix_dfId_collisionId); // LOGF(info, "Do event mixing: current event (%d, %d), ngamma = %d | event pool (%d, %d), ngamma = %d", ndf, collision.globalIndex(), selected_photons1_in_this_event.size(), mix_dfId, mix_collisionId, photons1_from_event_pool.size()); - for (auto& g1 : selected_photons1_in_this_event) { - for (auto& g2 : photons1_from_event_pool) { + for (const auto& g1 : selected_photons1_in_this_event) { + for (const auto& g2 : photons1_from_event_pool) { ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); @@ -1155,7 +1154,7 @@ struct PhotonHBT { } } // end of loop over mixed event pool } else if constexpr (pairtype == ggHBTPairType::kEEEE) { - for (auto& mix_dfId_collisionId : collisionIds1_in_mixing_pool) { + for (const auto& mix_dfId_collisionId : collisionIds1_in_mixing_pool) { int mix_dfId = mix_dfId_collisionId.first; int64_t mix_collisionId = mix_dfId_collisionId.second; @@ -1172,8 +1171,8 @@ struct PhotonHBT { auto photons1_from_event_pool = emh1->GetTracksPerCollision(mix_dfId_collisionId); // LOGF(info, "Do event mixing: current event (%d, %d), ngamma = %d | event pool (%d, %d), ngamma = %d", ndf, collision.globalIndex(), selected_photons1_in_this_event.size(), mix_dfId, mix_collisionId, photons1_from_event_pool.size()); - for (auto& g1 : selected_photons1_in_this_event) { - for (auto& g2 : photons1_from_event_pool) { + for (const auto& g1 : selected_photons1_in_this_event) { + for (const auto& g2 : photons1_from_event_pool) { auto v1amb_pos_Ids = g1.ambiguousPosLegIds(); auto v1amb_neg_Ids = g1.ambiguousNegLegIds(); auto v2amb_pos_Ids = g2.ambiguousPosLegIds(); @@ -1224,7 +1223,7 @@ struct PhotonHBT { } } // end of loop over mixed event pool } else if constexpr (pairtype == ggHBTPairType::kPCMEE) { // [photon1 from event1, photon2 from event2] and [photon1 from event2, photon2 from event1] - for (auto& mix_dfId_collisionId : collisionIds1_in_mixing_pool) { + for (const auto& mix_dfId_collisionId : collisionIds1_in_mixing_pool) { int mix_dfId = mix_dfId_collisionId.first; int64_t mix_collisionId = mix_dfId_collisionId.second; @@ -1241,8 +1240,8 @@ struct PhotonHBT { auto photons2_from_event_pool = emh2->GetTracksPerCollision(mix_dfId_collisionId); // LOGF(info, "Do event mixing: current event (%d, %d), ngamma = %d | event pool (%d, %d), nll = %d", ndf, collision.globalIndex(), selected_photons1_in_this_event.size(), mix_dfId, mix_collisionId, photons2_from_event_pool.size()); - for (auto& g1 : selected_photons1_in_this_event) { // PCM - for (auto& g2 : photons2_from_event_pool) { // dielectron + for (const auto& g1 : selected_photons1_in_this_event) { // PCM + for (const auto& g2 : photons2_from_event_pool) { // dielectron ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.0); // keep v1 for PCM ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), g2.mass()); @@ -1277,7 +1276,7 @@ struct PhotonHBT { } } // end of loop over mixed event pool2 - for (auto& mix_dfId_collisionId : collisionIds1_in_mixing_pool) { + for (const auto& mix_dfId_collisionId : collisionIds1_in_mixing_pool) { int mix_dfId = mix_dfId_collisionId.first; int64_t mix_collisionId = mix_dfId_collisionId.second; @@ -1294,8 +1293,8 @@ struct PhotonHBT { auto photons1_from_event_pool = emh1->GetTracksPerCollision(mix_dfId_collisionId); // LOGF(info, "Do event mixing: current event (%d, %d), nll = %d | event pool (%d, %d), ngamma = %d", ndf, collision.globalIndex(), selected_photons2_in_this_event.size(), mix_dfId, mix_collisionId, photons1_from_event_pool.size()); - for (auto& g1 : selected_photons2_in_this_event) { // dielectron - for (auto& g2 : photons1_from_event_pool) { // PCM + for (const auto& g1 : selected_photons2_in_this_event) { // dielectron + for (const auto& g2 : photons1_from_event_pool) { // PCM ROOT::Math::PtEtaPhiMVector v1(g2.pt(), g2.eta(), g2.phi(), 0.0); // keep v1 for PCM ROOT::Math::PtEtaPhiMVector v2(g1.pt(), g1.eta(), g1.phi(), g1.mass()); @@ -1345,7 +1344,7 @@ struct PhotonHBT { std::vector> passed_pairIds; passed_pairIds.reserve(positrons.size() * electrons.size()); - for (auto& collision : collisions) { + for (const auto& collision : collisions) { initCCDB(collision); const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { @@ -1366,7 +1365,7 @@ struct PhotonHBT { auto positrons_per_collision = positrons->sliceByCached(o2::aod::emprimaryelectron::emeventId, collision.globalIndex(), cache); auto electrons_per_collision = electrons->sliceByCached(o2::aod::emprimaryelectron::emeventId, collision.globalIndex(), cache); - for (auto& [pos, ele] : combinations(CombinationsFullIndexPolicy(positrons_per_collision, electrons_per_collision))) { + for (const auto& [pos, ele] : combinations(CombinationsFullIndexPolicy(positrons_per_collision, electrons_per_collision))) { if (pos.trackId() == ele.trackId()) { // this is protection against pairing identical 2 tracks. // never happens. only for protection. continue; } @@ -1386,14 +1385,14 @@ struct PhotonHBT { } // end of dielectron pairing loop } // end of collision loop - for (auto& pairId : passed_pairIds) { + for (const auto& pairId : passed_pairIds) { auto t1 = tracks.rawIteratorAt(std::get<0>(pairId)); auto t2 = tracks.rawIteratorAt(std::get<1>(pairId)); // LOGF(info, "std::get<0>(pairId) = %d, std::get<1>(pairId) = %d, t1.globalIndex() = %d, t2.globalIndex() = %d", std::get<0>(pairId), std::get<1>(pairId), t1.globalIndex(), t2.globalIndex()); float n = 1.f; // include myself. - for (auto& ambId1 : t1.ambiguousElectronsIds()) { - for (auto& ambId2 : t2.ambiguousElectronsIds()) { + for (const auto& ambId1 : t1.ambiguousElectronsIds()) { + for (const auto& ambId2 : t2.ambiguousElectronsIds()) { if (std::find(passed_pairIds.begin(), passed_pairIds.end(), std::make_pair(ambId1, ambId2)) != passed_pairIds.end()) { // LOGF(info, "repeated pair is found. t1.globalIndex() = %d, t2.globalIndex() = %d, ambId1 = %d, ambId2 = %d", t1.globalIndex(), t2.globalIndex(), ambId1, ambId2); n += 1.f; @@ -1415,11 +1414,11 @@ struct PhotonHBT { Partition positrons = o2::aod::emprimaryelectron::sign > int8_t(0); Partition electrons = o2::aod::emprimaryelectron::sign < int8_t(0); - using MyEMH = o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, EMTrack>; + using MyEMH = o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, EMPair>; MyEMH* emh1 = nullptr; MyEMH* emh2 = nullptr; - std::vector> used_photonIds; // - std::vector> used_dileptonIds; // + std::vector used_photonIds_per_col; // + std::vector> used_dileptonIds_per_col; // std::map, uint64_t> map_mixed_eventId_to_globalBC; SliceCache cache; diff --git a/PWGEM/Dilepton/Utils/EMTrack.h b/PWGEM/Dilepton/Utils/EMTrack.h index d7ddae81476..06bb7bc73f3 100644 --- a/PWGEM/Dilepton/Utils/EMTrack.h +++ b/PWGEM/Dilepton/Utils/EMTrack.h @@ -40,7 +40,6 @@ class EMTrack fCYY = CYY; fCZY = CZY; fCZZ = CZZ; - fPairDCA3DinSigmaOTF = 0; fAmbEleSelfIds = amb_ele_self_ids; if (fAmbEleSelfIds.size() > 0) { @@ -48,27 +47,12 @@ class EMTrack } else { fIsAmbiguous = false; } - fVx = 0.f; - fVy = 0.f; - fVz = 0.f; - fVPos = ROOT::Math::PtEtaPhiMVector(0, 0, 0, 0); - fVNeg = ROOT::Math::PtEtaPhiMVector(0, 0, 0, 0); - fAmbPosLegSelfIds.clear(); - fAmbNegLegSelfIds.clear(); - fAmbPosLegSelfIds.shrink_to_fit(); - fAmbNegLegSelfIds.shrink_to_fit(); - fGlobalPosId = 0; - fGlobalNegId = 0; } ~EMTrack() { fAmbEleSelfIds.clear(); fAmbEleSelfIds.shrink_to_fit(); - fAmbPosLegSelfIds.clear(); - fAmbNegLegSelfIds.clear(); - fAmbPosLegSelfIds.shrink_to_fit(); - fAmbNegLegSelfIds.shrink_to_fit(); } int dfId() const { return fDFId; } @@ -95,54 +79,6 @@ class EMTrack std::vector ambiguousElectronsIds() const { return fAmbEleSelfIds; } float signed1Pt() const { return fCharge * 1.f / fPt; } - float pairDca3DinSigmaOTF() const { return fPairDCA3DinSigmaOTF; } - void setPairDca3DinSigmaOTF(float dca) { fPairDCA3DinSigmaOTF = dca; } - - void setConversionPointXYZ(float x, float y, float z) - { - fVx = x; - fVy = y; - fVz = z; - } - float vx() const { return fVx; } - float vy() const { return fVy; } - float vz() const { return fVz; } - float v0radius() const { return std::sqrt(std::pow(fVx, 2) + std::pow(fVy, 2)); } - float eta_cp() const { return std::atanh(fVz / sqrt(pow(fVx, 2) + pow(fVy, 2) + pow(fVz, 2))); } - float phi_cp() const { return std::atan2(fVy, fVx); } - - void setPositiveLegPtEtaPhiM(float pt, float eta, float phi, float m) - { - fVPos.SetPt(pt); - fVPos.SetEta(eta); - fVPos.SetPhi(phi); - fVPos.SetM(m); - } - void setNegativeLegPtEtaPhiM(float pt, float eta, float phi, float m) - { - fVNeg.SetPt(pt); - fVNeg.SetEta(eta); - fVNeg.SetPhi(phi); - fVNeg.SetM(m); - } - - ROOT::Math::PtEtaPhiMVector getPositiveLeg() const { return fVPos; } - ROOT::Math::PtEtaPhiMVector getNegativeLeg() const { return fVNeg; } - - void setGlobalPosId(int id) { fGlobalPosId = id; } - void setGlobalNegId(int id) { fGlobalNegId = id; } - int globalIndexPos() const { return fGlobalPosId; } - int globalIndexNeg() const { return fGlobalNegId; } - - void setAmbPosLegSelfIds(std::vector selfIds) { fAmbPosLegSelfIds = selfIds; } - void setAmbNegLegSelfIds(std::vector selfIds) { fAmbNegLegSelfIds = selfIds; } - std::vector ambiguousPosLegIds() const { return fAmbPosLegSelfIds; } - std::vector ambiguousNegLegIds() const { return fAmbNegLegSelfIds; } - - void setCYY(float cYY) { fCYY = cYY; } - void setCZY(float cZY) { fCZY = cZY; } - void setCZZ(float cZZ) { fCZZ = cZZ; } - protected: int fDFId; int fGlobalId; @@ -155,26 +91,11 @@ class EMTrack int8_t fCharge; float fDCAxy; float fDCAz; - float fCYY; float fCZY; float fCZZ; - - float fPairDCA3DinSigmaOTF; bool fIsAmbiguous; std::vector fAmbEleSelfIds; - - int fGlobalPosId; - int fGlobalNegId; - ROOT::Math::PtEtaPhiMVector fVPos; - ROOT::Math::PtEtaPhiMVector fVNeg; - std::vector fAmbPosLegSelfIds; // for dileptons - std::vector fAmbNegLegSelfIds; // for dileptons - - // only for photon conversion point - float fVx; - float fVy; - float fVz; }; class EMTrackWithCov : public EMTrack @@ -210,6 +131,8 @@ class EMTrackWithCov : public EMTrack fC1Pt21Pt2 = C1Pt21Pt2; } + ~EMTrackWithCov() {} + float x() const { return fX; } float y() const { return fY; } float z() const { return fZ; } @@ -251,5 +174,86 @@ class EMTrackWithCov : public EMTrack float fC1Pt21Pt2; }; +class EMPair : public EMTrack +{ + public: + EMPair(int dfId, int globalId, int collisionId, int trackId, float pt, float eta, float phi, float mass) : EMTrack(dfId, globalId, collisionId, trackId, pt, eta, phi, mass, 0, 0, 0, std::vector{}, 0, 0, 0) + { + fGlobalPosId = 0; + fGlobalNegId = 0; + fVPos = ROOT::Math::PtEtaPhiMVector(0, 0, 0, 0); + fVNeg = ROOT::Math::PtEtaPhiMVector(0, 0, 0, 0); + fAmbPosLegSelfIds.clear(); + fAmbNegLegSelfIds.clear(); + fAmbPosLegSelfIds.shrink_to_fit(); + fAmbNegLegSelfIds.shrink_to_fit(); + fVx = 0.f; + fVy = 0.f; + fVz = 0.f; + } + + ~EMPair() + { + fAmbPosLegSelfIds.clear(); + fAmbNegLegSelfIds.clear(); + fAmbPosLegSelfIds.shrink_to_fit(); + fAmbNegLegSelfIds.shrink_to_fit(); + } + + void setGlobalPosId(int id) { fGlobalPosId = id; } + void setGlobalNegId(int id) { fGlobalNegId = id; } + int globalIndexPos() const { return fGlobalPosId; } + int globalIndexNeg() const { return fGlobalNegId; } + + void setPositiveLegPtEtaPhiM(float pt, float eta, float phi, float m) + { + fVPos.SetPt(pt); + fVPos.SetEta(eta); + fVPos.SetPhi(phi); + fVPos.SetM(m); + } + void setNegativeLegPtEtaPhiM(float pt, float eta, float phi, float m) + { + fVNeg.SetPt(pt); + fVNeg.SetEta(eta); + fVNeg.SetPhi(phi); + fVNeg.SetM(m); + } + + ROOT::Math::PtEtaPhiMVector getPositiveLeg() const { return fVPos; } + ROOT::Math::PtEtaPhiMVector getNegativeLeg() const { return fVNeg; } + + void setAmbPosLegSelfIds(std::vector selfIds) { fAmbPosLegSelfIds = selfIds; } + void setAmbNegLegSelfIds(std::vector selfIds) { fAmbNegLegSelfIds = selfIds; } + std::vector ambiguousPosLegIds() const { return fAmbPosLegSelfIds; } + std::vector ambiguousNegLegIds() const { return fAmbNegLegSelfIds; } + + void setConversionPointXYZ(float x, float y, float z) + { + fVx = x; + fVy = y; + fVz = z; + } + float vx() const { return fVx; } + float vy() const { return fVy; } + float vz() const { return fVz; } + float v0radius() const { return std::sqrt(std::pow(fVx, 2) + std::pow(fVy, 2)); } + float eta_cp() const { return std::atanh(fVz / sqrt(pow(fVx, 2) + pow(fVy, 2) + pow(fVz, 2))); } + float phi_cp() const { return std::atan2(fVy, fVx); } + + protected: + int fGlobalPosId; + int fGlobalNegId; + ROOT::Math::PtEtaPhiMVector fVPos; + ROOT::Math::PtEtaPhiMVector fVNeg; + std::vector fAmbPosLegSelfIds; // for dileptons + std::vector fAmbNegLegSelfIds; // for dileptons + + // only for photon conversion point + float fVx; + float fVy; + float fVz; +}; + } // namespace o2::aod::pwgem::dilepton::utils #endif // PWGEM_DILEPTON_UTILS_EMTRACK_H_ From 2f72bc4f453f205ec28cb2767291440ffad0bb94 Mon Sep 17 00:00:00 2001 From: ariedel-cern <85537041+ariedel-cern@users.noreply.github.com> Date: Fri, 31 Oct 2025 02:56:56 +0100 Subject: [PATCH 962/986] [PWGCF] Update femto framework (#13615) --- PWGCF/Femto/Core/closePairRejection.h | 396 +++++++----------- PWGCF/Femto/Core/femtoUtils.h | 7 +- PWGCF/Femto/Core/pairBuilder.h | 102 ++--- PWGCF/Femto/Core/pairCleaner.h | 28 +- PWGCF/Femto/Core/pairProcessHelpers.h | 32 +- PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx | 22 +- PWGCF/Femto/Tasks/femtoPairTrackKink.cxx | 2 +- PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx | 2 +- .../Tasks/femtoPairTrackTwoTrackResonance.cxx | 20 +- PWGCF/Femto/Tasks/femtoPairTrackV0.cxx | 14 +- PWGCF/Femto/Tasks/femtoPairV0V0.cxx | 10 +- 11 files changed, 272 insertions(+), 363 deletions(-) diff --git a/PWGCF/Femto/Core/closePairRejection.h b/PWGCF/Femto/Core/closePairRejection.h index c574398c432..214f19f1d8d 100644 --- a/PWGCF/Femto/Core/closePairRejection.h +++ b/PWGCF/Femto/Core/closePairRejection.h @@ -16,6 +16,8 @@ #ifndef PWGCF_FEMTO_CORE_CLOSEPAIRREJECTION_H_ #define PWGCF_FEMTO_CORE_CLOSEPAIRREJECTION_H_ +#include "RecoDecay.h" + #include "PWGCF/Femto/Core/femtoUtils.h" #include "PWGCF/Femto/Core/histManager.h" @@ -51,62 +53,35 @@ enum CprHist { kCprHistogramLast }; -// default config, cpr between two charged tracks (or track vs particle which decays into one charged track, like sigma) +// template configurable group for Cpr +template struct ConfCpr : o2::framework::ConfigurableGroup { - std::string prefix = std::string("ClosePairRejection"); - o2::framework::Configurable on{"on", true, "Turn on CPR"}; - o2::framework::Configurable plotAllRadii{"plotAllRadii", false, "Plot deta-dphi distribution at all radii"}; + std::string prefix = std::string(Prefix); + o2::framework::Configurable cutAverage{"cutAverage", true, "Apply CPR if the average deta-dphistar is below the configured values"}; + o2::framework::Configurable cutAnyRadius{"cutAnyRadius", false, "Apply CPR if the deta-dphistar is below the configured values at any radius"}; + o2::framework::Configurable plotAllRadii{"plotAllRadii", true, "Plot deta-dphi distribution at all radii"}; o2::framework::Configurable plotAverage{"plotAverage", true, "Plot average deta dphi distribution"}; o2::framework::Configurable detaMax{"detaMax", 0.01f, "Maximium deta"}; o2::framework::Configurable dphistarMax{"dphistarMax", 0.01f, "Maximum dphistar"}; - o2::framework::ConfigurableAxis binningDeta{"binningDeta", {{500, -0.5, 0.5}}, "deta"}; - o2::framework::ConfigurableAxis binningDphistar{"binningDphistar", {{500, -0.5, 0.5}}, "dphi"}; -}; - -struct ConfCprTrackV0 : o2::framework::ConfigurableGroup { - std::string prefix = std::string("ClosePairRejectionTrackV0"); - o2::framework::Configurable onSameCharge{"onSameCharge", true, "Turn on CPR for track and same charge daughter"}; - o2::framework::Configurable onOppositeCharge{"onOppositeCharge", false, "Turn on CPR for track and opposite charge daughter"}; - o2::framework::Configurable plotAllRadii{"plotAllRadii", false, "Plot deta-dphi distribution at all radii"}; - o2::framework::Configurable plotAverage{"plotAverage", true, "Plot average deta dphi distribution"}; - o2::framework::Configurable detaMaxSameCharge{"detaMaxSameCharge", 0.01f, "Maximium deta between track and same charge daughter"}; - o2::framework::Configurable dphistarMaxSameCharge{"dphistarMaxSameCharge", 0.01f, "Maximium dphistar between track and same charge daughter"}; - o2::framework::Configurable detaMaxOppositeCharge{"detaMaxOppositeCharge", 0.01f, "Maximum deta between track and opposite charge daughter"}; - o2::framework::Configurable dphistarMaxOppositeCharge{"dphistarMaxOppositeCharge", 0.01f, "Maximum dphistar between track and opposite charge daughter"}; - o2::framework::ConfigurableAxis binningDeta{"binningDeta", {{500, -0.5, 0.5}}, "deta"}; - o2::framework::ConfigurableAxis binningDphistar{"binningDphistar", {{500, -0.5, 0.5}}, "dphi"}; -}; - -struct ConfCprV0V0 : o2::framework::ConfigurableGroup { - std::string prefix = std::string("ClosePairRejectionV0V0"); - o2::framework::Configurable on{"on", true, "Turn on CPR"}; - o2::framework::Configurable plotAllRadii{"plotAllRadii", false, "Plot deta-dphi distribution at all radii"}; - o2::framework::Configurable plotAverage{"plotAverage", true, "Plot average deta dphi distribution"}; - o2::framework::Configurable detaMaxPosDau{"detaMaxPosDau", 0.01f, "Maximium deta between positive daughters"}; - o2::framework::Configurable dphistarMaxPosDau{"dphistarMaxPosDau", 0.01f, "Maximium dphistar between positive daughters"}; - o2::framework::Configurable detaMaxNegDau{"detaMaxNegDau", 0.01f, "Maximum deta between negative daughters"}; - o2::framework::Configurable dphistarMaxNegDau{"dphistarMaxNegDau", 0.01f, "Maximum dphistar between negative daughters"}; - o2::framework::ConfigurableAxis binningDeta{"binningDeta", {{500, -0.5, 0.5}}, "deta"}; - o2::framework::ConfigurableAxis binningDphistar{"binningDphistar", {{500, -0.5, 0.5}}, "dphi"}; + o2::framework::ConfigurableAxis binningDeta{"binningDeta", {{250, -0.5, 0.5}}, "deta"}; + o2::framework::ConfigurableAxis binningDphistar{"binningDphistar", {{250, -0.5, 0.5}}, "dphi"}; }; -struct ConfCprTrrackCascade : o2::framework::ConfigurableGroup { - std::string prefix = std::string("ClosePairRejectionTrackCascade"); - o2::framework::Configurable onBachelor{"onBachelor", true, "Turn on CPR for track and bachelor"}; - o2::framework::Configurable onSameCharge{"onSameCharge", false, "Turn on CPR for track and same charge V0 daughter"}; - o2::framework::Configurable onOppositeCharge{"onOppositeCharge", false, "Turn on CPR for track and opposite charge V0 daughter"}; - o2::framework::Configurable plotAllRadii{"plotAllRadii", false, "Plot deta-dphi distribution at all radii"}; - o2::framework::Configurable plotAverage{"plotAverage", true, "Plot average deta dphi distribution"}; - o2::framework::Configurable detaMaxBachelor{"detaMaxBachelor", 0.01f, "Maximium deta between track and bachelor"}; - o2::framework::Configurable dphistarMaxBachelor{"dphistarMaxBachelor", 0.01f, "Maximium dphistar between track and bachelor"}; - o2::framework::Configurable detaMaxSameCharge{"detaMaxSameCharge", 0.01f, "Maximium deta between track and same charge daughter"}; - o2::framework::Configurable dphistarMaxSameCharge{"dphistarMaxSameCharge", 0.01f, "Maximium dphistar between track and same charge daughter"}; - o2::framework::Configurable detaMaxOppositeCharge{"detaMaxOppositeCharge", 0.01f, "Maximum deta between track and opposite charge daughter"}; - o2::framework::Configurable dphistarMaxOppositeCharge{"dphistarMaxOppositeCharge", 0.01f, "Maximum dphistar between track and opposite charge daughter"}; - o2::framework::ConfigurableAxis binningDeta{"binningDeta", {{500, -0.5, 0.5}}, "deta"}; - o2::framework::ConfigurableAxis binningDphistar{"binningDphistar", {{500, -0.5, 0.5}}, "dphi"}; - o2::framework::Configurable on{"on", true, "Turn on CPR"}; -}; +constexpr const char PrefixCprTrackTrack[] = "CprTrackTrack"; +constexpr const char PrefixCprTrackV0Daughter[] = "CprTrackV0Daughter"; +constexpr const char PrefixCprTrackResonanceDaughter[] = "CprTrackResonanceDaughter"; +constexpr const char PrefixCprTrackKinkDaughter[] = "CprTrackKinkDaughter"; +constexpr const char PrefixCprV0DaughterV0DaughterPos[] = "CprV0DaughterV0DaughterPos"; +constexpr const char PrefixCprV0DaughterV0DaughterNeg[] = "CprV0DaughterV0DaughterNeg"; +constexpr const char PrefixCprTrackCascadeBachelor[] = "CprTrackCascadeBachelor"; + +using ConfCprTrackTrack = ConfCpr; +using ConfCprTrackV0Daughter = ConfCpr; +using ConfCprTrackResonanceDaughter = ConfCpr; +using ConfCprTrackKinkDaughter = ConfCpr; +using ConfCprV0DaugherV0DaughterPos = ConfCpr; +using ConfCprV0DaugherV0DaughterNeg = ConfCpr; +using ConfCprTrackCascadeBachelor = ConfCpr; // tpc radii for computing phistar constexpr int Nradii = 9; @@ -115,16 +90,14 @@ constexpr std::array TpcRadii = {85., 105., 125., 145., 165., 185 // directory names constexpr char PrefixTrackTrackSe[] = "CPR_TrackTrack/SE/"; constexpr char PrefixTrackTrackMe[] = "CPR_TrackTrack/ME/"; -constexpr char PrefixTrackV0SameChargeSe[] = "CPR_TrackV0DauSameCharge/SE/"; -constexpr char PrefixTrackV0SameChargeMe[] = "CPR_TrackV0DauSameCharge/ME/"; -constexpr char PrefixTrackV0OppositeChargeSe[] = "CPR_TrackV0DauOppositeCharge/SE/"; -constexpr char PrefixTrackV0OppositeChargeMe[] = "CPR_TrackV0DauOppositeCharge/ME/"; +constexpr char PrefixTrackV0DaughterSe[] = "CPR_TrackV0Dau/SE/"; +constexpr char PrefixTrackV0DaughterMe[] = "CPR_TrackV0Dau/ME/"; constexpr char PrefixV0V0PosSe[] = "CPR_V0V0_PosDau/SE/"; constexpr char PrefixV0V0NegSe[] = "CPR_V0V0_NegDau/SE/"; constexpr char PrefixV0V0PosMe[] = "CPR_V0V0_PosDau/ME/"; constexpr char PrefixV0V0NegMe[] = "CPR_V0V0_NegDau/ME/"; -constexpr char PrefixTrackTwoTrackResonanceSe[] = "CPR_TrackResonanceDaughter/SE/"; -constexpr char PrefixTrackTwoTrackResonnaceMe[] = "CPR_TrackResonanceDaughter/ME/"; +constexpr char PrefixTrackTwoTrackResonanceSe[] = "CPR_TrackResonanceDau/SE/"; +constexpr char PrefixTrackTwoTrackResonanceMe[] = "CPR_TrackResonanceDau/ME/"; constexpr char PrefixTrackCascadeBachelorSe[] = "CPR_TrackCascadeBachelor/SE/"; constexpr char PrefixTrackCascadeBachelorMe[] = "CPR_TrackCascadeBachelor/ME/"; constexpr char PrefixTrackKinkSe[] = "CPR_TrackKink/SE/"; @@ -171,6 +144,8 @@ class CloseTrackRejection std::map> const& specs, bool plotAverage, bool plotAllRadii, + bool cutOnAverage, + bool cutOnAnyRadius, float detaMax, float dphistarMax, int chargeAbsTrack1, @@ -181,20 +156,23 @@ class CloseTrackRejection // check the limits if (mDetaMax <= 0 || mDphistarMax <= 0) { - LOG(warn) << "Close Pair Rejection configured with 0 or negative limits. Histograms will be filled, but no CPR cut will be applied!"; - mPlotOnly = true; - } else { - mPlotOnly = false; + LOG(fatal) << "Limits for Close Pair Rejection are invalid (0 or negative). Breaking..."; } - mChargeAbsTrack1 = chargeAbsTrack1; - mChargeAbsTrack2 = chargeAbsTrack2; + mChargeAbsTrack1 = std::abs(chargeAbsTrack1); + mChargeAbsTrack2 = std::abs(chargeAbsTrack2); - mHistogramRegistry = registry; + mCutOnAverage = cutOnAverage; + mCutOnAnyRadius = cutOnAnyRadius; mPlotAverage = plotAverage; mPlotAllRadii = plotAllRadii; + // check if we need to apply any cut a plot is requested + mIsActivated = mCutOnAverage || mCutOnAnyRadius || mPlotAverage || mPlotAllRadii; + + mHistogramRegistry = registry; + if (mPlotAverage) { mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kAverage, HistTable), getHistDesc(kAverage, HistTable), getHistType(kAverage, HistTable), {specs.at(kAverage)}); } @@ -216,26 +194,36 @@ class CloseTrackRejection template void compute(T1 const& track1, T2 const& track2) { + if (!mIsActivated) { + return; + } // reset values mAverageDphistar = 0.f; + int count = 0; mDeta = 0.f; mDphistar.fill(0.f); + mDphistarMask.fill(false); mDeta = track1.eta() - track2.eta(); + for (size_t i = 0; i < TpcRadii.size(); i++) { auto phistar1 = utils::dphistar(mMagField, TpcRadii[i], mChargeAbsTrack1 * track1.signedPt(), track1.phi()); auto phistar2 = utils::dphistar(mMagField, TpcRadii[i], mChargeAbsTrack2 * track2.signedPt(), track2.phi()); if (phistar1 && phistar2) { - // if the calculation for one phistar fails, keep the default value, which is 0 - // this makes it more likelier for the pair to be rejected sind the averave will be biased towards lower values - mDphistar.at(i) = phistar1.value() - phistar2.value(); + mDphistar.at(i) = RecoDecay::constrainAngle(phistar1.value() - phistar2.value(), -o2::constants::math::PI); // const angle difference between -pi and pi + mDphistarMask.at(i) = true; + count++; } } - mAverageDphistar = std::accumulate(mDphistar.begin(), mDphistar.end(), 0.f) / mDphistar.size(); + // for small momemeta the calculation of phistar might fail, if the particle did not reach a certain radius + mAverageDphistar = std::accumulate(mDphistar.begin(), mDphistar.end(), 0.f) / count; // only average values if phistar could be computed } void fill() { + if (!mIsActivated) { + return; + } // fill average hist if (mPlotAverage) { mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kAverage, HistTable)), mDeta, mAverageDphistar); @@ -243,27 +231,72 @@ class CloseTrackRejection // fill radii hists if (mPlotAllRadii) { - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius0, HistTable)), mDeta, mDphistar.at(0)); - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius1, HistTable)), mDeta, mDphistar.at(1)); - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius2, HistTable)), mDeta, mDphistar.at(2)); - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius3, HistTable)), mDeta, mDphistar.at(3)); - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius4, HistTable)), mDeta, mDphistar.at(4)); - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius5, HistTable)), mDeta, mDphistar.at(5)); - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius6, HistTable)), mDeta, mDphistar.at(6)); - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius7, HistTable)), mDeta, mDphistar.at(7)); - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius8, HistTable)), mDeta, mDphistar.at(8)); + if (mDphistarMask.at(0)) { + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius0, HistTable)), mDeta, mDphistar.at(0)); + } + if (mDphistarMask.at(1)) { + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius1, HistTable)), mDeta, mDphistar.at(1)); + } + if (mDphistarMask.at(2)) { + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius2, HistTable)), mDeta, mDphistar.at(2)); + } + if (mDphistarMask.at(3)) { + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius3, HistTable)), mDeta, mDphistar.at(3)); + } + if (mDphistarMask.at(4)) { + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius4, HistTable)), mDeta, mDphistar.at(4)); + } + if (mDphistarMask.at(5)) { + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius5, HistTable)), mDeta, mDphistar.at(5)); + } + if (mDphistarMask.at(6)) { + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius6, HistTable)), mDeta, mDphistar.at(6)); + } + if (mDphistarMask.at(7)) { + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius7, HistTable)), mDeta, mDphistar.at(7)); + } + if (mDphistarMask.at(8)) { + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius8, HistTable)), mDeta, mDphistar.at(8)); + } } } bool isClosePair() const { - return !mPlotOnly && std::hypot(mAverageDphistar / mDphistarMax, mDeta / mDetaMax) < 1.f; + if (!mIsActivated) { + return false; + } + bool isCloseAverage = false; + bool isCloseAnyRadius = false; + + if (mCutOnAverage) { + isCloseAverage = std::hypot(mAverageDphistar / mDphistarMax, mDeta / mDetaMax) < 1.f; + } + + if (mCutOnAnyRadius) { + for (size_t i = 0; i < TpcRadii.size(); i++) { + if (isCloseAnyRadius) { + break; + } + if (mDphistarMask.at(i)) { + isCloseAnyRadius = std::hypot(mDphistar.at(i) / mDphistarMax, mDeta / mDetaMax) < 1.f; + } + } + } + return isCloseAverage || isCloseAnyRadius; } + bool isActivated() const { return mIsActivated; } + private: o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; bool mPlotAllRadii = false; - bool mPlotAverage = true; + bool mPlotAverage = false; + + bool mCutOnAverage = false; + bool mCutOnAnyRadius = false; + + bool mIsActivated = false; int mChargeAbsTrack1 = 0; int mChargeAbsTrack2 = 0; @@ -274,8 +307,7 @@ class CloseTrackRejection float mAverageDphistar = 0.f; float mDeta = 0.f; std::array mDphistar = {0.f}; - - bool mPlotOnly = true; + std::array mDphistarMask = {false}; }; template @@ -289,10 +321,7 @@ class ClosePairRejectionTrackTrack int absChargeTrack1, int absChargeTrack2) { - mIsActivated = confCpr.on.value; - if (mIsActivated) { - mCtr.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMax.value, confCpr.dphistarMax.value, absChargeTrack1, absChargeTrack2); - } + mCtr.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.cutAverage.value, confCpr.cutAnyRadius.value, confCpr.detaMax.value, confCpr.dphistarMax.value, absChargeTrack1, absChargeTrack2); } void setMagField(float magField) { mCtr.setMagField(magField); } @@ -303,27 +332,24 @@ class ClosePairRejectionTrackTrack } bool isClosePair() const { return mCtr.isClosePair(); } void fill() { mCtr.fill(); } - bool isActivated() const { return mIsActivated; } private: CloseTrackRejection mCtr; - bool mIsActivated = true; }; template class ClosePairRejectionV0V0 { public: - template + template void init(o2::framework::HistogramRegistry* registry, - std::map> const& specs, - T const& confCpr) + std::map> const& specsPos, + std::map> const& specsNeg, + T1 const& confCprPos, + T2 const& confCprNeg) { - mIsActivated = confCpr.on.value; - if (mIsActivated) { - mCtrPos.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMaxPosDau.value, confCpr.dphistarMaxPosDau.value, 1, 1); - mCtrNeg.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMaxNegDau.value, confCpr.dphistarMaxNegDau.value, 1, 1); - } + mCtrPos.init(registry, specsPos, confCprPos.plotAverage.value, confCprPos.plotAllRadii.value, confCprPos.cutAverage.value, confCprPos.cutAnyRadius.value, confCprPos.detaMax.value, confCprPos.dphistarMax.value, 1, 1); + mCtrNeg.init(registry, specsNeg, confCprNeg.plotAverage.value, confCprNeg.plotAllRadii.value, confCprNeg.cutAverage.value, confCprNeg.cutAnyRadius.value, confCprNeg.detaMax.value, confCprNeg.dphistarMax.value, 1, 1); } void setMagField(float magField) @@ -331,20 +357,20 @@ class ClosePairRejectionV0V0 mCtrPos.setMagField(magField); mCtrNeg.setMagField(magField); } + template void setPair(T1 const& v01, T2 const& v02, T3 const& tracks) { auto posDau1 = tracks.rawIteratorAt(v01.posDauId() - tracks.offset()); - auto negDau1 = tracks.rawIteratorAt(v01.negDauId() - tracks.offset()); - auto posDau2 = tracks.rawIteratorAt(v02.posDauId() - tracks.offset()); - auto negDau2 = tracks.rawIteratorAt(v02.negDauId() - tracks.offset()); - mCtrPos.compute(posDau1, posDau2); + + auto negDau1 = tracks.rawIteratorAt(v01.negDauId() - tracks.offset()); + auto negDau2 = tracks.rawIteratorAt(v02.negDauId() - tracks.offset()); mCtrNeg.compute(negDau1, negDau2); } - bool isClosePair() const { return mCtrPos.isClosePair() && mCtrNeg.isClosePair(); } + bool isClosePair() const { return mCtrPos.isClosePair() || mCtrNeg.isClosePair(); } void fill() { @@ -352,15 +378,12 @@ class ClosePairRejectionV0V0 mCtrNeg.fill(); } - bool isActivated() const { return mIsActivated; } - private: CloseTrackRejection mCtrPos; CloseTrackRejection mCtrNeg; - bool mIsActivated = true; }; -template +template class ClosePairRejectionTrackV0 // can also be used for any particle type that has pos/neg daughters, like resonances { public: @@ -370,176 +393,83 @@ class ClosePairRejectionTrackV0 // can also be used for any particle type that h T const& confCpr, int absChargeTrack) { - mIsActivatedSameCharge = confCpr.onSameCharge.value; - if (mIsActivatedSameCharge) { - mCtrSameCharge.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMaxSameCharge.value, confCpr.dphistarMaxSameCharge.value, absChargeTrack, 1); - } - - mIsActivatedOppositeCharge = confCpr.onOppositeCharge.value; - if (mIsActivatedOppositeCharge) { - mCtrOppositeCharge.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMaxOppositeCharge.value, confCpr.dphistarMaxOppositeCharge.value, absChargeTrack, 1); - } - - mIsActivated = mIsActivatedSameCharge || mIsActivatedOppositeCharge; + mCtr.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.cutAverage.value, confCpr.cutAnyRadius.value, confCpr.detaMax.value, confCpr.dphistarMax.value, absChargeTrack, 1); } - void setMagField(float magField) - { - if (mIsActivatedSameCharge) { - mCtrSameCharge.setMagField(magField); - } - if (mIsActivatedOppositeCharge) { - mCtrOppositeCharge.setMagField(magField); - } - } + void setMagField(float magField) { mCtr.setMagField(magField); } template void setPair(T1 const& track, T2 const& v0, T3 const& trackTable) { - auto posDau = trackTable.rawIteratorAt(v0.posDauId() - trackTable.offset()); - auto negDau = trackTable.rawIteratorAt(v0.negDauId() - trackTable.offset()); if (track.sign() > 0) { - if (mIsActivatedSameCharge) { - mCtrSameCharge.compute(track, posDau); - } - if (mIsActivatedOppositeCharge) { - mCtrOppositeCharge.compute(track, negDau); - } + auto posDau = trackTable.rawIteratorAt(v0.posDauId() - trackTable.offset()); + mCtr.compute(track, posDau); } else { - if (mIsActivatedSameCharge) { - mCtrSameCharge.compute(track, negDau); - } - if (mIsActivatedOppositeCharge) { - mCtrOppositeCharge.compute(track, posDau); - } + auto negDau = trackTable.rawIteratorAt(v0.negDauId() - trackTable.offset()); + mCtr.compute(track, negDau); } } - bool isClosePair() const - { - bool cprSameCharge = mIsActivatedSameCharge && mCtrSameCharge.isClosePair(); - bool cprOppositeCharrge = mIsActivatedOppositeCharge && mCtrOppositeCharge.isClosePair(); - return cprSameCharge || cprOppositeCharrge; - } + bool isClosePair() const { return mCtr.isClosePair(); } - void fill() - { - if (mIsActivatedSameCharge) { - mCtrSameCharge.fill(); - } - if (mIsActivatedOppositeCharge) { - mCtrOppositeCharge.fill(); - } - } - bool isActivated() const { return mIsActivated; } + void fill() { mCtr.fill(); } private: - CloseTrackRejection mCtrSameCharge; - CloseTrackRejection mCtrOppositeCharge; - bool mIsActivated = true; - bool mIsActivatedSameCharge = true; - bool mIsActivatedOppositeCharge = false; + CloseTrackRejection mCtr; }; -template +template class ClosePairRejectionTrackCascade { public: - template + template void init(o2::framework::HistogramRegistry* registry, - std::map> const& specs, - T const& confCpr, + std::map> const& specsBachelor, + std::map> const& specsV0Daughter, + T1 const& confCprBachelor, + T2 const& confCprV0Daughter, int absChargeTrack) { - mIsActivatedBachelor = confCpr.onBachelor.value; - if (mIsActivatedBachelor) { - mCtrBachelor.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMaxBachelor.value, confCpr.dphistarMaxBachelor.value, absChargeTrack, 1); - } - - mIsActivatedSameChargeV0Daughter = confCpr.onSameCharge.value; - if (mIsActivatedSameChargeV0Daughter) { - mCtrSameChargeV0Daughter.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMaxSameCharge.value, confCpr.dphistarMaxSameCharge.value, absChargeTrack, 1); - } - - mIsActivatedOppositeChargeV0Daughter = confCpr.onOppositeCharge.value; - if (mIsActivatedOppositeChargeV0Daughter) { - mCtrOppositeChargeV0Daughter.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMaxOppositeCharge.value, confCpr.dphistarMaxOppositeCharge.value, absChargeTrack, 1); - } - - mIsActivated = mIsActivatedBachelor || mIsActivatedSameChargeV0Daughter || mIsActivatedOppositeChargeV0Daughter; + mCtrBachelor.init(registry, specsBachelor, confCprBachelor.plotAverage.value, confCprBachelor.plotAllRadii.value, confCprBachelor.cutAverage.value, confCprBachelor.cutAnyRadius.value, confCprBachelor.detaMax.value, confCprBachelor.dphistarMax.value, absChargeTrack, 1); + mCtrV0Daughter.init(registry, specsV0Daughter, confCprV0Daughter.plotAverage.value, confCprV0Daughter.plotAllRadii.value, confCprV0Daughter.cutAverage.value, confCprV0Daughter.cutAnyRadius.value, confCprV0Daughter.detaMax.value, confCprV0Daughter.dphistarMax.value, absChargeTrack, 1); } void setMagField(float magField) { - if (mIsActivatedBachelor) { - mCtrBachelor.setMagField(magField); - } - if (mIsActivatedSameChargeV0Daughter) { - mCtrSameChargeV0Daughter.setMagField(magField); - } - if (mIsActivatedOppositeChargeV0Daughter) { - mCtrOppositeChargeV0Daughter.setMagField(magField); - } + mCtrBachelor.setMagField(magField); + mCtrV0Daughter.setMagField(magField); } + template void setPair(T1 const& track, T2 const& cascade, T3 const& trackTable) { auto bachelor = trackTable.rawIteratorAt(cascade.bachelorId() - trackTable.offset()); - auto posDau = trackTable.rawIteratorAt(cascade.posDauId() - trackTable.offset()); - auto negDau = trackTable.rawIteratorAt(cascade.negDauId() - trackTable.offset()); - - if (mIsActivatedBachelor) { - mCtrBachelor.compute(track, bachelor); - } + mCtrBachelor.compute(track, bachelor); if (track.sign() > 0) { - if (mIsActivatedSameChargeV0Daughter) { - mCtrSameChargeV0Daughter.compute(track, posDau); - } - if (mIsActivatedOppositeChargeV0Daughter) { - mCtrOppositeChargeV0Daughter.compute(track, negDau); - } + auto posDau = trackTable.rawIteratorAt(cascade.posDauId() - trackTable.offset()); + mCtrV0Daughter.compute(track, posDau); } else { - if (mIsActivatedSameChargeV0Daughter) { - mCtrSameChargeV0Daughter.compute(track, negDau); - } - if (mIsActivatedOppositeChargeV0Daughter) { - mCtrOppositeChargeV0Daughter.compute(track, posDau); - } + auto negDau = trackTable.rawIteratorAt(cascade.negDauId() - trackTable.offset()); + mCtrV0Daughter.compute(track, negDau); } } - bool isClosePair() const + bool + isClosePair() const { - bool cprBachelor = mIsActivatedBachelor && mCtrBachelor.isClosePair(); - bool cprSameCharge = mIsActivatedSameChargeV0Daughter && mCtrSameChargeV0Daughter.isClosePair(); - bool cprOppositeCharrge = mIsActivatedOppositeChargeV0Daughter && mCtrOppositeChargeV0Daughter.isClosePair(); - return cprBachelor || cprSameCharge || cprOppositeCharrge; + return mCtrBachelor.isClosePair() || mCtrBachelor.isClosePair(); } void fill() { - if (mIsActivatedBachelor) { - mCtrBachelor.fill(); - } - if (mIsActivatedSameChargeV0Daughter) { - mCtrSameChargeV0Daughter.fill(); - } - if (mIsActivatedOppositeChargeV0Daughter) { - mCtrOppositeChargeV0Daughter.fill(); - } + mCtrBachelor.fill(); + mCtrV0Daughter.fill(); } - bool isActivated() const { return mIsActivated; } - private: CloseTrackRejection mCtrBachelor; - CloseTrackRejection mCtrSameChargeV0Daughter; - CloseTrackRejection mCtrOppositeChargeV0Daughter; - bool mIsActivated = true; - bool mIsActivatedBachelor = false; - bool mIsActivatedSameChargeV0Daughter = false; - bool mIsActivatedOppositeChargeV0Daughter = false; + CloseTrackRejection mCtrV0Daughter; }; template @@ -552,10 +482,7 @@ class ClosePairRejectionTrackKink T const& confCpr, int absChargeTrack) { - mIsActivated = confCpr.on.value; - if (mIsActivated) { - mCtr.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMax.value, confCpr.dphistarMax.value, absChargeTrack, 1); - } + mCtr.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.cutAverage.value, confCpr.cutAnyRadius.value, confCpr.detaMax.value, confCpr.dphistarMax.value, absChargeTrack, 1); } void setMagField(float magField) @@ -571,15 +498,10 @@ class ClosePairRejectionTrackKink } bool isClosePair() const { return mCtr.isClosePair(); } - void fill() - { - mCtr.fill(); - } - bool isActivated() const { return mIsActivated; } + void fill() { mCtr.fill(); } private: CloseTrackRejection mCtr; - bool mIsActivated = true; }; }; // namespace closepairrejection diff --git a/PWGCF/Femto/Core/femtoUtils.h b/PWGCF/Femto/Core/femtoUtils.h index 2fe02efcea6..16c8be6bd6c 100644 --- a/PWGCF/Femto/Core/femtoUtils.h +++ b/PWGCF/Femto/Core/femtoUtils.h @@ -16,8 +16,11 @@ #ifndef PWGCF_FEMTO_CORE_FEMTOUTILS_H_ #define PWGCF_FEMTO_CORE_FEMTOUTILS_H_ +#include "RecoDecay.h" + #include "Common/Core/TableHelper.h" +#include "CommonConstants/MathConstants.h" #include "CommonConstants/PhysicsConstants.h" #include "Framework/InitContext.h" @@ -172,8 +175,8 @@ float qn(T const& col) inline std::optional dphistar(float magfield, float radius, float signedPt, float phi) { float arg = 0.3f * (0.1f * magfield) * (0.01 * radius) / (2.f * signedPt); - if (std::fabs(arg) < 1.f) { - return phi - std::asin(arg); + if (std::fabs(arg) <= 1.f) { + return RecoDecay::constrainAngle(phi - std::asin(arg)); } return std::nullopt; } diff --git a/PWGCF/Femto/Core/pairBuilder.h b/PWGCF/Femto/Core/pairBuilder.h index 0a98fcbd5a0..f16fc5a8b4e 100644 --- a/PWGCF/Femto/Core/pairBuilder.h +++ b/PWGCF/Femto/Core/pairBuilder.h @@ -239,21 +239,25 @@ class PairV0V0Builder typename T10, typename T11, typename T12, - typename T13> + typename T13, + typename T14, + typename T15> void init(o2::framework::HistogramRegistry* registry, T1 const& confV0Selection1, T2 const& confV0Selection2, - T3 const& confCpr, - T4 const& confMixing, - T5 const& confPairBinning, - T6 const& confPairCuts, - std::map>& colHistSpec, - std::map>& V0HistSpec1, - std::map>& V0HistSpec2, - std::map>& PosDauHistSpec, - std::map>& NegDauHistSpec, - std::map>& pairHistSpec, - std::map>& cprHistSpec) + T3 const& confCprPos, + T4 const& confCprNeg, + T5 const& confMixing, + T6 const& confPairBinning, + T7 const& confPairCuts, + std::map> const& colHistSpec, + std::map> const& V0HistSpec1, + std::map> const& V0HistSpec2, + std::map> const& PosDauHistSpec, + std::map> const& NegDauHistSpec, + std::map> const& pairHistSpec, + std::map> const& cprHistSpecPos, + std::map> const& cprHistSpecNeg) { // check if correlate the same tracks or not @@ -268,22 +272,22 @@ class PairV0V0Builder mPairHistManagerSe.setMass(confV0Selection1.pdgCode.value, confV0Selection1.pdgCode.value); mPairHistManagerSe.setCharge(1, 1); - mCprSe.init(registry, cprHistSpec, confCpr); + mCprSe.init(registry, cprHistSpecPos, cprHistSpecNeg, confCprPos, confCprPos); mPairHistManagerMe.setMass(confV0Selection1.pdgCode.value, confV0Selection1.pdgCode.value); mPairHistManagerMe.setCharge(1, 1); - mCprMe.init(registry, cprHistSpec, confCpr); + mCprMe.init(registry, cprHistSpecPos, cprHistSpecNeg, confCprPos, confCprNeg); } else { mV0HistManager1.init(registry, V0HistSpec1, PosDauHistSpec, NegDauHistSpec); mV0HistManager2.init(registry, V0HistSpec2, PosDauHistSpec, NegDauHistSpec); mPairHistManagerSe.setMass(confV0Selection1.pdgCode.value, confV0Selection2.pdgCode.value); mPairHistManagerSe.setCharge(1, 1); - mCprSe.init(registry, cprHistSpec, confCpr); + mCprSe.init(registry, cprHistSpecPos, cprHistSpecNeg, confCprPos, confCprNeg); mPairHistManagerMe.setMass(confV0Selection1.pdgCode.value, confV0Selection2.pdgCode.value); mPairHistManagerMe.setCharge(1, 1); - mCprMe.init(registry, cprHistSpec, confCpr); + mCprMe.init(registry, cprHistSpecPos, cprHistSpecNeg, confCprPos, confCprNeg); } // setup mixing @@ -384,10 +388,8 @@ template < const char* prefixNegDau, const char* prefixSe, const char* prefixMe, - const char* prefixCprSameChargeSe, - const char* prefixCprSameChargeMe, - const char* prefixCprOppositeChargeSe, - const char* prefixCprOppositeChargeMe, + const char* prefixCprSe, + const char* prefixCprMe, modes::Mode mode, modes::V0 v0Type> class PairTrackV0Builder @@ -481,8 +483,8 @@ class PairTrackV0Builder v0histmanager::V0HistManager mV0HistManager; pairhistmanager::PairHistManager mPairHistManagerSe; pairhistmanager::PairHistManager mPairHistManagerMe; - closepairrejection::ClosePairRejectionTrackV0 mCprSe; - closepairrejection::ClosePairRejectionTrackV0 mCprMe; + closepairrejection::ClosePairRejectionTrackV0 mCprSe; + closepairrejection::ClosePairRejectionTrackV0 mCprMe; paircleaner::TrackV0PairCleaner mPc; pairhistmanager::MixingPolicy mMixingPolicy = pairhistmanager::MixingPolicy::kVtxMult; int mMixingDepth = 5; @@ -495,10 +497,8 @@ template < const char* prefixNegDau, const char* prefixSe, const char* prefixMe, - const char* prefixCprSameChargeSe, - const char* prefixCprSameChargeMe, - const char* prefixCprOppositeChargeSe, - const char* prefixCprOppositeChargeMe, + const char* prefixCprSe, + const char* prefixCprMe, modes::Mode mode, modes::TwoTrackResonance resonanceType> class PairTrackTwoTrackResonanceBuilder @@ -592,9 +592,9 @@ class PairTrackTwoTrackResonanceBuilder twotrackresonancehistmanager::TwoTrackResonanceHistManager mResonanceHistManager; pairhistmanager::PairHistManager mPairHistManagerSe; pairhistmanager::PairHistManager mPairHistManagerMe; - closepairrejection::ClosePairRejectionTrackV0 mCprSe; // cpr for twotrackresonances and v0 work the same way - closepairrejection::ClosePairRejectionTrackV0 mCprMe; // cpr for twotrackresonances and v0 work the same way - paircleaner::TrackV0PairCleaner mPc; // pc for twotrackresonances and v0 work the same way + closepairrejection::ClosePairRejectionTrackV0 mCprSe; // cpr for twotrackresonances and v0 work the same way + closepairrejection::ClosePairRejectionTrackV0 mCprMe; // cpr for twotrackresonances and v0 work the same way + paircleaner::TrackV0PairCleaner mPc; // pc for twotrackresonances and v0 work the same way pairhistmanager::MixingPolicy mMixingPolicy = pairhistmanager::MixingPolicy::kVtxMult; int mMixingDepth = 5; }; @@ -714,11 +714,9 @@ template < const char* prefixSe, const char* prefixMe, const char* prefixCprBachelorSe, - const char* prefixCprSameChargeSe, - const char* prefixCprOppositeChargeSe, + const char* prefixCprV0DaughterSe, const char* prefixCprBachelorMe, - const char* prefixCprSameChargeMe, - const char* prefixCprOppositeChargeMe, + const char* prefixCprV0DaughterMe, modes::Mode mode, modes::Cascade cascadeType> class PairTrackCascadeBuilder @@ -740,22 +738,26 @@ class PairTrackCascadeBuilder typename T11, typename T12, typename T13, - typename T14> + typename T14, + typename T15, + typename T16> void init(o2::framework::HistogramRegistry* registry, T1 const& confTrackSelection, T2 const& confCascadeSelection, - T3 const& confCpr, - T4 const& confMixing, - T5 const& confPairBinning, - T6 const& confPairCuts, - std::map> const& colHistSpec, - std::map> const& trackHistSpec, - std::map> const& cascadeHistSpec, - std::map> const& bachelorHistSpec, - std::map> const& posDauHistSpec, - std::map> const& negDauHistSpec, - std::map> const& pairHistSpec, - std::map> const& cprHistSpec) + T3 const& confCprBachelor, + T4 const& confCprV0Daughter, + T5 const& confMixing, + T6 const& confPairBinning, + T7 const& confPairCuts, + std::map> const& colHistSpec, + std::map> const& trackHistSpec, + std::map> const& cascadeHistSpec, + std::map> const& bachelorHistSpec, + std::map> const& posDauHistSpec, + std::map> const& negDauHistSpec, + std::map> const& pairHistSpec, + std::map> const& cprHistSpecBachelor, + std::map> const& cprHistSpecV0Daughter) { mColHistManager.init(registry, colHistSpec); @@ -765,12 +767,12 @@ class PairTrackCascadeBuilder mPairHistManagerSe.init(registry, pairHistSpec, confPairBinning, confPairCuts); mPairHistManagerSe.setMass(confTrackSelection.pdgCode.value, confCascadeSelection.pdgCode.value); mPairHistManagerSe.setCharge(confTrackSelection.chargeAbs.value, 1); - mCprSe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value); + mCprSe.init(registry, cprHistSpecBachelor, cprHistSpecV0Daughter, confCprBachelor, confCprV0Daughter, confTrackSelection.chargeAbs.value); mPairHistManagerMe.init(registry, pairHistSpec, confPairBinning, confPairCuts); mPairHistManagerMe.setMass(confTrackSelection.pdgCode.value, confCascadeSelection.pdgCode.value); mPairHistManagerMe.setCharge(confTrackSelection.chargeAbs.value, 1); - mCprMe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value); + mCprMe.init(registry, cprHistSpecBachelor, cprHistSpecV0Daughter, confCprBachelor, confCprV0Daughter, confTrackSelection.chargeAbs.value); // setup mixing mMixingPolicy = static_cast(confMixing.policy.value); @@ -814,8 +816,8 @@ class PairTrackCascadeBuilder cascadehistmanager::CascadeHistManager mCascadeHistManager; pairhistmanager::PairHistManager mPairHistManagerSe; pairhistmanager::PairHistManager mPairHistManagerMe; - closepairrejection::ClosePairRejectionTrackCascade mCprSe; - closepairrejection::ClosePairRejectionTrackCascade mCprMe; + closepairrejection::ClosePairRejectionTrackCascade mCprSe; + closepairrejection::ClosePairRejectionTrackCascade mCprMe; paircleaner::TrackCascadePairCleaner mPc; pairhistmanager::MixingPolicy mMixingPolicy = pairhistmanager::MixingPolicy::kVtxMult; int mMixingDepth = 5; diff --git a/PWGCF/Femto/Core/pairCleaner.h b/PWGCF/Femto/Core/pairCleaner.h index 4079489d93e..d0ff785fcdc 100644 --- a/PWGCF/Femto/Core/pairCleaner.h +++ b/PWGCF/Femto/Core/pairCleaner.h @@ -51,12 +51,12 @@ class V0V0PairCleaner : public BasePairCleaner public: V0V0PairCleaner() = default; template - bool isCleanPair(const T1& v01, const T2& v02, const T3& /*tracks*/) const + bool isCleanPair(const T1& v01, const T2& v02, const T3& trackTable) const { - auto posDaughter1 = v01.template posDau_as(); - auto negDaughter1 = v01.template negDau_as(); - auto posDaughter2 = v02.template posDau_as(); - auto negDaughter2 = v02.template negDau_as(); + auto posDaughter1 = trackTable.rawIteratorAt(v01.posDauId() - trackTable.offset()); + auto negDaughter1 = trackTable.rawIteratorAt(v01.negDauId() - trackTable.offset()); + auto posDaughter2 = trackTable.rawIteratorAt(v02.posDauId() - trackTable.offset()); + auto negDaughter2 = trackTable.rawIteratorAt(v02.negDauId() - trackTable.offset()); return this->isCleanTrackPair(posDaughter1, posDaughter2) && this->isCleanTrackPair(negDaughter1, negDaughter2); } }; @@ -66,10 +66,10 @@ class TrackV0PairCleaner : public BasePairCleaner // also works for particles de public: TrackV0PairCleaner() = default; template - bool isCleanPair(const T1& track, const T2& v0, const T3& /*trackTable*/) const + bool isCleanPair(const T1& track, const T2& v0, const T3& trackTable) const { - auto posDaughter = v0.template posDau_as(); - auto negDaughter = v0.template negDau_as(); + auto posDaughter = trackTable.rawIteratorAt(v0.posDauId() - trackTable.offset()); + auto negDaughter = trackTable.rawIteratorAt(v0.negDauId() - trackTable.offset()); return (this->isCleanTrackPair(posDaughter, track) && this->isCleanTrackPair(negDaughter, track)); } }; @@ -79,9 +79,9 @@ class TrackKinkPairCleaner : public BasePairCleaner public: TrackKinkPairCleaner() = default; template - bool isCleanPair(const T1& track, const T2& kink, const T3& /*trackTable*/) const + bool isCleanPair(const T1& track, const T2& kink, const T3& trackTable) const { - auto chaDaughter = kink.template chaDau_as(); + auto chaDaughter = trackTable.rawIteratorAt(kink.chaDauId() - trackTable.offset()); return this->isCleanTrackPair(chaDaughter, track); } }; @@ -91,11 +91,11 @@ class TrackCascadePairCleaner : public BasePairCleaner public: TrackCascadePairCleaner() = default; template - bool isCleanPair(const T1& track, const T2& cascade, const T3& /*trackTable*/) const + bool isCleanPair(const T1& track, const T2& cascade, const T3& trackTable) const { - auto bachelor = cascade.template bachelor_as(); - auto posDaughter = cascade.template posDau_as(); - auto negDaughter = cascade.template negDau_as(); + auto bachelor = trackTable.rawIteratorAt(cascade.bachelorId() - trackTable.offset()); + auto posDaughter = trackTable.rawIteratorAt(cascade.posDauId() - trackTable.offset()); + auto negDaughter = trackTable.rawIteratorAt(cascade.posDauId() - trackTable.offset()); return (this->isCleanTrackPair(bachelor, track) && this->isCleanTrackPair(posDaughter, track) && this->isCleanTrackPair(negDaughter, track)); } }; diff --git a/PWGCF/Femto/Core/pairProcessHelpers.h b/PWGCF/Femto/Core/pairProcessHelpers.h index 39b800be5ce..6600177257e 100644 --- a/PWGCF/Femto/Core/pairProcessHelpers.h +++ b/PWGCF/Femto/Core/pairProcessHelpers.h @@ -50,11 +50,9 @@ void processSameEvent(T1 const& SliceParticle, } std::uniform_real_distribution dist(0.f, 1.f); for (auto const& [p1, p2] : o2::soa::combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(SliceParticle, SliceParticle))) { - if (CprManager.isActivated()) { - CprManager.setPair(p1, p2, TrackTable); - if (CprManager.isClosePair()) { - continue; - } + CprManager.setPair(p1, p2, TrackTable); + if (CprManager.isClosePair()) { + continue; } // Randomize pair order if enabled float threshold = 0.5f; @@ -104,11 +102,9 @@ void processSameEvent(T1 const& SliceParticle1, continue; } // Close pair rejection - if (CprManager.isActivated()) { - CprManager.setPair(p1, p2, TrackTable); - if (CprManager.isClosePair()) { - continue; - } + CprManager.setPair(p1, p2, TrackTable); + if (CprManager.isClosePair()) { + continue; } PairHistManager.setPair(p1, p2, Collision); if (PairHistManager.checkPairCuts()) { @@ -154,11 +150,9 @@ void processMixedEvent(T1& Collisions, continue; } // Close pair rejection - if (CprManager.isActivated()) { - CprManager.setPair(p1, p2, TrackTable); - if (CprManager.isClosePair()) { - continue; - } + CprManager.setPair(p1, p2, TrackTable); + if (CprManager.isClosePair()) { + continue; } PairHistManager.setPair(p1, p2, collision1, collision2); if (PairHistManager.checkPairCuts()) { @@ -207,11 +201,9 @@ void processMixedEvent(T1& Collisions, continue; } // Close pair rejection - if (CprManager.isActivated()) { - CprManager.setPair(p1, p2, TrackTable); - if (CprManager.isClosePair()) { - continue; - } + CprManager.setPair(p1, p2, TrackTable); + if (CprManager.isClosePair()) { + continue; } PairHistManager.setPair(p1, p2, collision1, collision2); if (PairHistManager.checkPairCuts()) { diff --git a/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx b/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx index 0c556d5ee2b..cfb6b801148 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx @@ -103,11 +103,9 @@ struct FemtoPairTrackCascade { pairhistmanager::PrefixTrackCascadeSe, pairhistmanager::PrefixTrackCascadeMe, closepairrejection::PrefixTrackCascadeBachelorSe, - closepairrejection::PrefixTrackV0SameChargeSe, - closepairrejection::PrefixTrackV0OppositeChargeSe, + closepairrejection::PrefixTrackV0DaughterSe, closepairrejection::PrefixTrackCascadeBachelorMe, - closepairrejection::PrefixTrackV0SameChargeMe, - closepairrejection::PrefixTrackV0OppositeChargeMe, + closepairrejection::PrefixTrackV0DaughterMe, modes::Mode::kAnalysis, modes::Cascade::kXi> pairTrackXiBuilder; @@ -121,11 +119,9 @@ struct FemtoPairTrackCascade { pairhistmanager::PrefixTrackCascadeSe, pairhistmanager::PrefixTrackCascadeMe, closepairrejection::PrefixTrackCascadeBachelorSe, - closepairrejection::PrefixTrackV0SameChargeSe, - closepairrejection::PrefixTrackV0OppositeChargeSe, + closepairrejection::PrefixTrackV0DaughterSe, closepairrejection::PrefixTrackCascadeBachelorMe, - closepairrejection::PrefixTrackV0SameChargeMe, - closepairrejection::PrefixTrackV0OppositeChargeMe, + closepairrejection::PrefixTrackV0DaughterMe, modes::Mode::kAnalysis, modes::Cascade::kOmega> pairTrackOmegaBuilder; @@ -142,7 +138,8 @@ struct FemtoPairTrackCascade { HistogramRegistry hRegistry{"FemtoTrackCascade", {}, OutputObjHandlingPolicy::AnalysisObject}; // setup cpr - closepairrejection::ConfCprTrrackCascade confCpr; + closepairrejection::ConfCprTrackCascadeBachelor confCprBachelor; + closepairrejection::ConfCprTrackV0Daughter confCprV0Daughter; void init(InitContext&) { @@ -160,20 +157,21 @@ struct FemtoPairTrackCascade { auto posDauSpec = trackhistmanager::makeTrackHistSpecMap(confPosDauBinning); auto negDauSpec = trackhistmanager::makeTrackHistSpecMap(confNegDauBinning); auto pairHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning); - auto cprHistSpec = closepairrejection::makeCprHistSpecMap(confCpr); + auto cprHistSpecBachelor = closepairrejection::makeCprHistSpecMap(confCprBachelor); + auto cprHistSpecV0Daughter = closepairrejection::makeCprHistSpecMap(confCprV0Daughter); // setup for xis if (doprocessXiSameEvent || doprocessXiMixedEvent) { auto xiHistSpec = cascadehistmanager::makeCascadeHistSpecMap(confXiBinning); auto pairTrackXiHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning); - pairTrackXiBuilder.init(&hRegistry, trackSelection, xiSelection, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, xiHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackXiHistSpec, cprHistSpec); + pairTrackXiBuilder.init(&hRegistry, trackSelection, xiSelection, confCprBachelor, confCprV0Daughter, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, xiHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackXiHistSpec, cprHistSpecBachelor, cprHistSpecV0Daughter); } // setup for omegas if (doprocessOmegaSameEvent || doprocessOmegaMixedEvent) { auto omegaHistSpec = cascadehistmanager::makeCascadeHistSpecMap(confOmegaBinning); auto pairTrackOmegaHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning); - pairTrackOmegaBuilder.init(&hRegistry, trackSelection, omegaSelection, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, omegaHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackOmegaHistSpec, cprHistSpec); + pairTrackOmegaBuilder.init(&hRegistry, trackSelection, xiSelection, confCprBachelor, confCprV0Daughter, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, omegaHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackOmegaHistSpec, cprHistSpecBachelor, cprHistSpecV0Daughter); } if (((doprocessXiSameEvent || doprocessXiMixedEvent) + (doprocessOmegaSameEvent || doprocessOmegaMixedEvent)) > 1) { diff --git a/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx b/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx index 758b03f61fd..c58364149a7 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx @@ -110,7 +110,7 @@ struct FemtoPairTrackKink { HistogramRegistry hRegistry{"FemtoTrackKink", {}, OutputObjHandlingPolicy::AnalysisObject}; // setup cpr - closepairrejection::ConfCpr confCpr; + closepairrejection::ConfCprTrackKinkDaughter confCpr; void init(InitContext&) { diff --git a/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx b/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx index 71f692eefee..f980f9d5694 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx @@ -78,7 +78,7 @@ struct FemtoPairTrackTrack { pairhistmanager::ConfPairBinning confPairBinning; pairhistmanager::ConfPairCuts confPairCuts; - closepairrejection::ConfCpr confCpr; + closepairrejection::ConfCprTrackTrack confCpr; pairbuilder::PairTrackTrackBuilder< trackhistmanager::PrefixTrack1, diff --git a/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx b/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx index 5d04cf56691..2b23c68ba5c 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx @@ -108,10 +108,8 @@ struct FemtoPairTrackTwoTrackResonance { trackhistmanager::PrefixResonanceNegDaughter, pairhistmanager::PrefixTrackResonanceSe, pairhistmanager::PrefixTrackResonanceMe, - closepairrejection::PrefixTrackV0SameChargeSe, - closepairrejection::PrefixTrackV0SameChargeMe, - closepairrejection::PrefixTrackV0OppositeChargeSe, - closepairrejection::PrefixTrackV0OppositeChargeMe, + closepairrejection::PrefixTrackTwoTrackResonanceSe, + closepairrejection::PrefixTrackTwoTrackResonanceMe, modes::Mode::kAnalysis, modes::TwoTrackResonance::kPhi> pairTrackPhiBuilder; @@ -124,10 +122,8 @@ struct FemtoPairTrackTwoTrackResonance { trackhistmanager::PrefixResonanceNegDaughter, pairhistmanager::PrefixTrackResonanceSe, pairhistmanager::PrefixTrackResonanceMe, - closepairrejection::PrefixTrackV0SameChargeSe, - closepairrejection::PrefixTrackV0SameChargeMe, - closepairrejection::PrefixTrackV0OppositeChargeSe, - closepairrejection::PrefixTrackV0OppositeChargeMe, + closepairrejection::PrefixTrackTwoTrackResonanceSe, + closepairrejection::PrefixTrackTwoTrackResonanceMe, modes::Mode::kAnalysis, modes::TwoTrackResonance::kKstar0> pairTrackKstar0Builder; @@ -140,10 +136,8 @@ struct FemtoPairTrackTwoTrackResonance { trackhistmanager::PrefixResonanceNegDaughter, pairhistmanager::PrefixTrackResonanceSe, pairhistmanager::PrefixTrackResonanceMe, - closepairrejection::PrefixTrackV0SameChargeSe, - closepairrejection::PrefixTrackV0SameChargeMe, - closepairrejection::PrefixTrackV0OppositeChargeSe, - closepairrejection::PrefixTrackV0OppositeChargeMe, + closepairrejection::PrefixTrackTwoTrackResonanceSe, + closepairrejection::PrefixTrackTwoTrackResonanceMe, modes::Mode::kAnalysis, modes::TwoTrackResonance::kRho0> pairTrackRho0Builder; @@ -160,7 +154,7 @@ struct FemtoPairTrackTwoTrackResonance { HistogramRegistry hRegistry{"FemtoTrackTwoTrackResonance", {}, OutputObjHandlingPolicy::AnalysisObject}; // setup cpr - closepairrejection::ConfCprTrackV0 confCpr; + closepairrejection::ConfCprTrackResonanceDaughter confCpr; void init(InitContext&) { diff --git a/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx b/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx index 994dbbbd132..547dfb0aec8 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx @@ -100,10 +100,8 @@ struct FemtoPairTrackV0 { trackhistmanager::PrefixV0NegDaughter1, pairhistmanager::PrefixTrackV0Se, pairhistmanager::PrefixTrackV0Me, - closepairrejection::PrefixTrackV0SameChargeSe, - closepairrejection::PrefixTrackV0SameChargeMe, - closepairrejection::PrefixTrackV0OppositeChargeSe, - closepairrejection::PrefixTrackV0OppositeChargeMe, + closepairrejection::PrefixTrackV0DaughterSe, + closepairrejection::PrefixTrackV0DaughterMe, modes::Mode::kAnalysis, modes::V0::kLambda> pairTrackLambdaBuilder; @@ -115,10 +113,8 @@ struct FemtoPairTrackV0 { trackhistmanager::PrefixV0NegDaughter1, pairhistmanager::PrefixTrackV0Se, pairhistmanager::PrefixTrackV0Me, - closepairrejection::PrefixTrackV0SameChargeSe, - closepairrejection::PrefixTrackV0SameChargeMe, - closepairrejection::PrefixTrackV0OppositeChargeSe, - closepairrejection::PrefixTrackV0OppositeChargeMe, + closepairrejection::PrefixTrackV0DaughterSe, + closepairrejection::PrefixTrackV0DaughterMe, modes::Mode::kAnalysis, modes::V0::kK0short> pairTrackK0shortBuilder; @@ -135,7 +131,7 @@ struct FemtoPairTrackV0 { HistogramRegistry hRegistry{"FemtoTrackV0", {}, OutputObjHandlingPolicy::AnalysisObject}; // setup cpr - closepairrejection::ConfCprTrackV0 confCpr; + closepairrejection::ConfCprTrackV0Daughter confCpr; void init(InitContext&) { diff --git a/PWGCF/Femto/Tasks/femtoPairV0V0.cxx b/PWGCF/Femto/Tasks/femtoPairV0V0.cxx index ef5fc7e7b61..1544b131013 100644 --- a/PWGCF/Femto/Tasks/femtoPairV0V0.cxx +++ b/PWGCF/Femto/Tasks/femtoPairV0V0.cxx @@ -135,7 +135,8 @@ struct FemtoPairV0V0 { HistogramRegistry hRegistry{"FemtoTrackV0", {}, OutputObjHandlingPolicy::AnalysisObject}; // setup cpr - closepairrejection::ConfCprV0V0 confCpr; + closepairrejection::ConfCprV0DaugherV0DaughterPos confCprPos; + closepairrejection::ConfCprV0DaugherV0DaughterNeg confCprNeg; void init(InitContext&) { @@ -150,20 +151,21 @@ struct FemtoPairV0V0 { auto colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); auto posDauSpec = trackhistmanager::makeTrackHistSpecMap(confPosDauBinning); auto negDauSpec = trackhistmanager::makeTrackHistSpecMap(confNegDauBinning); - auto cprHistSpec = closepairrejection::makeCprHistSpecMap(confCpr); + auto cprHistSpecPos = closepairrejection::makeCprHistSpecMap(confCprPos); + auto cprHistSpecNeg = closepairrejection::makeCprHistSpecMap(confCprNeg); // setup for lambda if (doprocessLambdaLambdaSameEvent || doprocessLambdaLambdaMixedEvent) { auto lambdaHistSpec = v0histmanager::makeV0HistSpecMap(confLambdaBinning); auto pairLambdaLambdaHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning); - pairLambdaLambdaBuilder.init(&hRegistry, lambdaSelection, lambdaSelection, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, lambdaHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairLambdaLambdaHistSpec, cprHistSpec); + pairLambdaLambdaBuilder.init(&hRegistry, lambdaSelection, lambdaSelection, confCprPos, confCprNeg, confMixing, confPairBinning, confPairCuts, colHistSpec, lambdaHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairLambdaLambdaHistSpec, cprHistSpecPos, cprHistSpecNeg); } // setup for k0short if (doprocessK0shortK0shortSameEvent || doprocessK0shortK0shortMixedEvent) { auto k0shortHistSpec = v0histmanager::makeV0HistSpecMap(confK0shortBinning); auto pairLambdaLambdaHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning); - pairLambdaLambdaBuilder.init(&hRegistry, k0shortSelection, k0shortSelection, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, k0shortHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairLambdaLambdaHistSpec, cprHistSpec); + pairLambdaLambdaBuilder.init(&hRegistry, k0shortSelection, k0shortSelection, confCprPos, confCprNeg, confMixing, confPairBinning, confPairCuts, colHistSpec, k0shortHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairLambdaLambdaHistSpec, cprHistSpecPos, cprHistSpecNeg); } if (((doprocessLambdaLambdaSameEvent || doprocessLambdaLambdaMixedEvent) + (doprocessK0shortK0shortSameEvent || doprocessK0shortK0shortMixedEvent)) > 1) { From f1b78a38771f0c09404e14b50121b5b5ba0305ed Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 31 Oct 2025 05:10:11 +0100 Subject: [PATCH 963/986] [PWGEM/PhotonMeson] speed up pairing loop (#13613) --- PWGEM/Dilepton/Core/Dilepton.h | 1 + PWGEM/Dilepton/Core/DileptonHadronMPC.h | 1 + PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h | 51 +++++----- PWGEM/PhotonMeson/Core/TaggingPi0.h | 100 ++++++++++---------- 4 files changed, 77 insertions(+), 76 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 02893baf071..4bdbeda0c97 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -512,6 +512,7 @@ struct Dilepton { used_trackIds_per_col.clear(); used_trackIds_per_col.shrink_to_fit(); + map_mixed_eventId_to_globalBC.clear(); delete h2sp_resolution; } diff --git a/PWGEM/Dilepton/Core/DileptonHadronMPC.h b/PWGEM/Dilepton/Core/DileptonHadronMPC.h index b6be899fa62..cc7009f40a6 100644 --- a/PWGEM/Dilepton/Core/DileptonHadronMPC.h +++ b/PWGEM/Dilepton/Core/DileptonHadronMPC.h @@ -459,6 +459,7 @@ struct DileptonHadronMPC { used_trackIds_per_col.clear(); used_trackIds_per_col.shrink_to_fit(); + map_mixed_eventId_to_globalBC.clear(); } void addhistograms() diff --git a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h index 9dd902396b4..023fafc3a73 100644 --- a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h +++ b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h @@ -309,10 +309,10 @@ struct Pi0EtaToGammaGamma { delete emh2; emh2 = 0x0; - used_photonIds.clear(); - used_photonIds.shrink_to_fit(); - used_dileptonIds.clear(); - used_dileptonIds.shrink_to_fit(); + used_photonIds_per_col.clear(); + used_photonIds_per_col.shrink_to_fit(); + used_dileptonIds_per_col.clear(); + used_dileptonIds_per_col.shrink_to_fit(); map_mixed_eventId_to_globalBC.clear(); } @@ -534,11 +534,10 @@ struct Pi0EtaToGammaGamma { o2::framework::Partition>> positrons = o2::aod::emprimaryelectron::sign > int8_t(0) && dileptoncuts.cfg_min_pt_track < o2::aod::track::pt&& nabs(o2::aod::track::eta) < dileptoncuts.cfg_max_eta_track; o2::framework::Partition>> electrons = o2::aod::emprimaryelectron::sign < int8_t(0) && dileptoncuts.cfg_min_pt_track < o2::aod::track::pt && nabs(o2::aod::track::eta) < dileptoncuts.cfg_max_eta_track; - // using MyEMH = o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, o2::aod::pwgem::dilepton::utils::EMTrack>; o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, o2::aod::pwgem::dilepton::utils::EMTrack>* emh1 = nullptr; o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, o2::aod::pwgem::dilepton::utils::EMTrack>* emh2 = nullptr; - std::vector> used_photonIds; // - std::vector> used_dileptonIds; // + std::vector used_photonIds_per_col; // + std::vector> used_dileptonIds_per_col; // std::map, uint64_t> map_mixed_eventId_to_globalBC; template @@ -649,16 +648,13 @@ struct Pi0EtaToGammaGamma { RotationBackground>(v12, v1, v2, photons2_per_collision, g1.globalIndex(), g2.globalIndex(), weight); } - std::pair pair_tmp_id1 = std::make_pair(ndf, g1.globalIndex()); - std::pair pair_tmp_id2 = std::make_pair(ndf, g2.globalIndex()); - - if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id1) == used_photonIds.end()) { + if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g1.globalIndex()) == used_photonIds_per_col.end()) { emh1->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(-1, g1.globalIndex(), collision.globalIndex(), g1.globalIndex(), g1.pt(), g1.eta(), g1.phi(), 0)); - used_photonIds.emplace_back(pair_tmp_id1); + used_photonIds_per_col.emplace_back(g1.globalIndex()); } - if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id2) == used_photonIds.end()) { + if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g2.globalIndex()) == used_photonIds_per_col.end()) { emh1->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(-1, g2.globalIndex(), collision.globalIndex(), g2.globalIndex(), g2.pt(), g2.eta(), g2.phi(), 0)); - used_photonIds.emplace_back(pair_tmp_id2); + used_photonIds_per_col.emplace_back(g2.globalIndex()); } ndiphoton++; } // end of pairing loop @@ -702,15 +698,14 @@ struct Pi0EtaToGammaGamma { fRegistry.fill(HIST("Pair/same/hs"), veeg.M(), veeg.Pt(), weight); - std::pair pair_tmp_id1 = std::make_pair(ndf, g1.globalIndex()); - std::tuple tuple_tmp_id2 = std::make_tuple(ndf, collision.globalIndex(), pos2.trackId(), ele2.trackId()); - if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id1) == used_photonIds.end()) { + std::pair tuple_tmp_id2 = std::make_pair(pos2.trackId(), ele2.trackId()); + if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g1.globalIndex()) == used_photonIds_per_col.end()) { emh1->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(-1, g1.globalIndex(), collision.globalIndex(), -1, g1.pt(), g1.eta(), g1.phi(), 0)); - used_photonIds.emplace_back(pair_tmp_id1); + used_photonIds_per_col.emplace_back(g1.globalIndex()); } - if (std::find(used_dileptonIds.begin(), used_dileptonIds.end(), tuple_tmp_id2) == used_dileptonIds.end()) { + if (std::find(used_dileptonIds_per_col.begin(), used_dileptonIds_per_col.end(), tuple_tmp_id2) == used_dileptonIds_per_col.end()) { emh2->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(-1, -1, collision.globalIndex(), -1, v_ee.Pt(), v_ee.Eta(), v_ee.Phi(), v_ee.M())); - used_dileptonIds.emplace_back(tuple_tmp_id2); + used_dileptonIds_per_col.emplace_back(tuple_tmp_id2); } ndiphoton++; } // end of dielectron loop @@ -732,21 +727,23 @@ struct Pi0EtaToGammaGamma { fRegistry.fill(HIST("Pair/same/hs"), v12.M(), v12.Pt(), weight); - std::pair pair_tmp_id1 = std::make_pair(ndf, g1.globalIndex()); - std::pair pair_tmp_id2 = std::make_pair(ndf, g2.globalIndex()); - - if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id1) == used_photonIds.end()) { + if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g1.globalIndex()) == used_photonIds_per_col.end()) { emh1->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(-1, g1.globalIndex(), collision.globalIndex(), -1, g1.pt(), g1.eta(), g1.phi(), 0)); - used_photonIds.emplace_back(pair_tmp_id1); + used_photonIds_per_col.emplace_back(g1.globalIndex()); } - if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id2) == used_photonIds.end()) { + if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g2.globalIndex()) == used_photonIds_per_col.end()) { emh2->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(-1, g2.globalIndex(), collision.globalIndex(), -1, g2.pt(), g2.eta(), g2.phi(), 0)); - used_photonIds.emplace_back(pair_tmp_id2); + used_photonIds_per_col.emplace_back(g2.globalIndex()); } ndiphoton++; } // end of pairing loop } // end of pairing in same event + used_photonIds_per_col.clear(); + used_photonIds_per_col.shrink_to_fit(); + used_dileptonIds_per_col.clear(); + used_dileptonIds_per_col.shrink_to_fit(); + // event mixing if (!cfgDoMix || !(ndiphoton > 0)) { continue; diff --git a/PWGEM/PhotonMeson/Core/TaggingPi0.h b/PWGEM/PhotonMeson/Core/TaggingPi0.h index 986a79b34bd..855ea2b09bd 100644 --- a/PWGEM/PhotonMeson/Core/TaggingPi0.h +++ b/PWGEM/PhotonMeson/Core/TaggingPi0.h @@ -19,40 +19,41 @@ #ifndef PWGEM_PHOTONMESON_CORE_TAGGINGPI0_H_ #define PWGEM_PHOTONMESON_CORE_TAGGINGPI0_H_ +#include "PWGEM/Dilepton/Utils/EMTrack.h" +#include "PWGEM/Dilepton/Utils/EMTrackUtilities.h" +#include "PWGEM/Dilepton/Utils/EventMixingHandler.h" +#include "PWGEM/PhotonMeson/Core/DalitzEECut.h" +#include "PWGEM/PhotonMeson/Core/EMCPhotonCut.h" +#include "PWGEM/PhotonMeson/Core/EMPhotonEventCut.h" +#include "PWGEM/PhotonMeson/Core/PHOSPhotonCut.h" +#include "PWGEM/PhotonMeson/Core/V0PhotonCut.h" +#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" +#include "PWGEM/PhotonMeson/Utils/EventHistograms.h" +#include "PWGEM/PhotonMeson/Utils/PairUtilities.h" + +#include "Common/Core/RecoDecay.h" + +#include "CCDB/BasicCCDBManager.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +#include "Math/Vector4D.h" +#include "TString.h" + +#include +#include #include #include -#include #include -#include +#include #include #include -#include -#include - -#include "TString.h" -#include "Math/Vector4D.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" - -#include "DetectorsBase/GeometryManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "CCDB/BasicCCDBManager.h" - -#include "Common/Core/RecoDecay.h" -#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" -#include "PWGEM/PhotonMeson/Core/V0PhotonCut.h" -#include "PWGEM/PhotonMeson/Core/DalitzEECut.h" -#include "PWGEM/PhotonMeson/Core/PHOSPhotonCut.h" -#include "PWGEM/PhotonMeson/Core/EMCPhotonCut.h" -#include "PWGEM/PhotonMeson/Core/EMPhotonEventCut.h" -#include "PWGEM/PhotonMeson/Utils/PairUtilities.h" -#include "PWGEM/Dilepton/Utils/EMTrack.h" -#include "PWGEM/Dilepton/Utils/EventMixingHandler.h" -#include "PWGEM/PhotonMeson/Utils/EventHistograms.h" -#include "PWGEM/Dilepton/Utils/EMTrackUtilities.h" +#include using namespace o2; using namespace o2::aod; @@ -306,10 +307,10 @@ struct TaggingPi0 { delete emh2; emh2 = 0x0; - used_photonIds.clear(); - used_photonIds.shrink_to_fit(); - used_dileptonIds.clear(); - used_dileptonIds.shrink_to_fit(); + used_photonIds_per_col.clear(); + used_photonIds_per_col.shrink_to_fit(); + used_dileptonIds_per_col.clear(); + used_dileptonIds_per_col.shrink_to_fit(); map_mixed_eventId_to_globalBC.clear(); } @@ -453,14 +454,14 @@ struct TaggingPi0 { using MyEMH = o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, EMTrack>; MyEMH* emh1 = nullptr; MyEMH* emh2 = nullptr; - std::vector> used_photonIds; // - std::vector> used_dileptonIds; // + std::vector used_photonIds_per_col; // + std::vector> used_dileptonIds_per_col; // std::map, uint64_t> map_mixed_eventId_to_globalBC; template void runPairing(TCollisions const& collisions, TPhotons1 const& photons1, TPhotons2 const& photons2, - TSubInfos1 const& /*subinfos1*/, TSubInfos2 const& /*subinfos2*/, + TSubInfos1 const&, TSubInfos2 const&, TPreslice1 const& perCollision1, TPreslice2 const& perCollision2, TCut1 const& cut1, TCut2 const& cut2) { @@ -571,15 +572,14 @@ struct TaggingPi0 { ROOT::Math::PtEtaPhiMVector veeg = v_gamma + v_pos + v_ele; fRegistry.fill(HIST("Pair/same/hMvsPt"), veeg.M(), v_gamma.Pt(), weight); - std::pair pair_tmp_id1 = std::make_pair(ndf, g1.globalIndex()); - std::tuple tuple_tmp_id2 = std::make_tuple(ndf, collision.globalIndex(), pos2.trackId(), ele2.trackId()); - if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id1) == used_photonIds.end()) { + std::pair tuple_tmp_id2 = std::make_pair(pos2.trackId(), ele2.trackId()); + if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g1.globalIndex()) == used_photonIds_per_col.end()) { emh1->AddTrackToEventPool(key_df_collision, EMTrack(-1, g1.globalIndex(), collision.globalIndex(), -1, g1.pt(), g1.eta(), g1.phi(), 0)); - used_photonIds.emplace_back(pair_tmp_id1); + used_photonIds_per_col.emplace_back(g1.globalIndex()); } - if (std::find(used_dileptonIds.begin(), used_dileptonIds.end(), tuple_tmp_id2) == used_dileptonIds.end()) { + if (std::find(used_dileptonIds_per_col.begin(), used_dileptonIds_per_col.end(), tuple_tmp_id2) == used_dileptonIds_per_col.end()) { emh2->AddTrackToEventPool(key_df_collision, EMTrack(-1, -1, collision.globalIndex(), -1, v_ee.Pt(), v_ee.Eta(), v_ee.Phi(), v_ee.M())); - used_dileptonIds.emplace_back(tuple_tmp_id2); + used_dileptonIds_per_col.emplace_back(tuple_tmp_id2); } ndiphoton++; } // end of dielectron loop @@ -598,21 +598,23 @@ struct TaggingPi0 { fRegistry.fill(HIST("Pair/same/hMvsPt"), v12.M(), v1.Pt(), weight); - std::pair pair_tmp_id1 = std::make_pair(ndf, g1.globalIndex()); - std::pair pair_tmp_id2 = std::make_pair(ndf, g2.globalIndex()); - - if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id1) == used_photonIds.end()) { + if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g1.globalIndex()) == used_photonIds_per_col.end()) { emh1->AddTrackToEventPool(key_df_collision, EMTrack(-1, g1.globalIndex(), collision.globalIndex(), -1, g1.pt(), g1.eta(), g1.phi(), 0)); - used_photonIds.emplace_back(pair_tmp_id1); + used_photonIds_per_col.emplace_back(g1.globalIndex()); } - if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id2) == used_photonIds.end()) { + if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g2.globalIndex()) == used_photonIds_per_col.end()) { emh2->AddTrackToEventPool(key_df_collision, EMTrack(-1, g2.globalIndex(), collision.globalIndex(), -1, g2.pt(), g2.eta(), g2.phi(), 0)); - used_photonIds.emplace_back(pair_tmp_id2); + used_photonIds_per_col.emplace_back(g2.globalIndex()); } ndiphoton++; } // end of pairing loop } // end of pairing in same event + used_photonIds_per_col.clear(); + used_photonIds_per_col.shrink_to_fit(); + used_dileptonIds_per_col.clear(); + used_dileptonIds_per_col.shrink_to_fit(); + // event mixing if (!cfgDoMix || !(ndiphoton > 0)) { continue; From f12c92b517da0b0e399f359fc47eb8726f294306 Mon Sep 17 00:00:00 2001 From: SuJeong Ji <120470463+SuJeong-Ji@users.noreply.github.com> Date: Fri, 31 Oct 2025 16:10:02 +0900 Subject: [PATCH 964/986] [PWGLF] Hotfix: Add MC table for processMCQA (#13602) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Resonances/chk892pp.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Resonances/chk892pp.cxx b/PWGLF/Tasks/Resonances/chk892pp.cxx index e0986eb7cbe..dd6a8721a8f 100644 --- a/PWGLF/Tasks/Resonances/chk892pp.cxx +++ b/PWGLF/Tasks/Resonances/chk892pp.cxx @@ -1354,6 +1354,7 @@ struct Chk892pp { void processMCQA(MCEventCandidates::iterator const& collision, MCTrackCandidates const& tracks, MCV0Candidates const& v0s, + soa::Join const& mccolls, aod::BCsWithTimestamps const&) { if (!colCuts.isSelected(collision)) @@ -1365,7 +1366,10 @@ struct Chk892pp { if (!collision.has_mcCollision()) return; - auto mccoll = collision.template mcCollision_as>(); + + auto id = collision.mcCollisionId(); + + auto mccoll = mccolls.iteratorAt(id); const float lCentrality = mccoll.centFT0M(); if (lCentrality < EventCuts.cfgEventCentralityMin || lCentrality > EventCuts.cfgEventCentralityMax) From 1e141ace3f8db1ae11d331ebf68c39ccb0f1d08c Mon Sep 17 00:00:00 2001 From: Subhadeep Mandal <147193283+5ub-Man@users.noreply.github.com> Date: Fri, 31 Oct 2025 12:45:07 +0530 Subject: [PATCH 965/986] [PWGUD] Histogram bug fix in sginclusivePhiKstarSD.cxx (#13611) --- PWGUD/Tasks/sginclusivePhiKstarSD.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PWGUD/Tasks/sginclusivePhiKstarSD.cxx b/PWGUD/Tasks/sginclusivePhiKstarSD.cxx index 278a97b2d71..b55dffe4ed3 100644 --- a/PWGUD/Tasks/sginclusivePhiKstarSD.cxx +++ b/PWGUD/Tasks/sginclusivePhiKstarSD.cxx @@ -222,10 +222,10 @@ struct SginclusivePhiKstarSD { registry.add("os_pk_rot_pT_1", "pion-kaon rotional pair", kTH3F, {axiskstarmass, axisrapdity, axispt}); registry.add("os_pk_rot_pT_2", "pion-kaon rotional pair", kTH3F, {axiskstarmass, axisrapdity, axispt}); - registry.add("os_pk_lsMM_pT_0", "pion-kaon pair Negative like sign", kTH3F, {axisphimass, axisrapdity, axispt}); - registry.add("os_pk_lsPP_pT_0", "pion-kaon pair Positive like sign", kTH3F, {axisphimass, axisrapdity, axispt}); - registry.add("os_pk_lsMM_pT_1", "pion-kaon pair Negative like sign", kTH3F, {axisphimass, axisrapdity, axispt}); - registry.add("os_pk_lsPP_pT_1", "pion-kaon pair Positive like sign", kTH3F, {axisphimass, axisrapdity, axispt}); + registry.add("os_pk_lsMM_pT_0", "pion-kaon pair Negative like sign", kTH3F, {axiskstarmass, axisrapdity, axispt}); + registry.add("os_pk_lsPP_pT_0", "pion-kaon pair Positive like sign", kTH3F, {axiskstarmass, axisrapdity, axispt}); + registry.add("os_pk_lsMM_pT_1", "pion-kaon pair Negative like sign", kTH3F, {axiskstarmass, axisrapdity, axispt}); + registry.add("os_pk_lsPP_pT_1", "pion-kaon pair Positive like sign", kTH3F, {axiskstarmass, axisrapdity, axispt}); registry.add("os_pk_ls_pT_2", "pion-kaon like sign", kTH3F, {axiskstarmass, axisrapdity, axispt}); } // qa plots From 92833576dbfdac2b7a730597bd085b49ea3d0c97 Mon Sep 17 00:00:00 2001 From: Oleksii Lubynets Date: Fri, 31 Oct 2025 08:44:51 +0100 Subject: [PATCH 966/986] [PWGHF] Bugfixes of correlated background processing in 3-prong decays (#13609) --- PWGHF/TableProducer/candidateCreator3Prong.cxx | 4 ++-- PWGHF/TableProducer/treeCreatorLcToPKPi.cxx | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/PWGHF/TableProducer/candidateCreator3Prong.cxx b/PWGHF/TableProducer/candidateCreator3Prong.cxx index ca1363ba0c8..f60a15895c8 100644 --- a/PWGHF/TableProducer/candidateCreator3Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator3Prong.cxx @@ -1126,8 +1126,8 @@ struct HfCandidateCreator3ProngExpressions { if (indexRec > -1) { flagChannelMain = sign * channelMain; - /// swapping for D+, Ds->Kpipi and Lc->pKpi - if (std::abs(flagChannelMain) == DecayChannelMain::DplusToPiKK || std::abs(flagChannelMain) == DecayChannelMain::DsToPiKK || std::abs(flagChannelMain) == DecayChannelMain::LcToPKPi) { + /// swapping for D+, Ds->Kpipi; Lc, Xic->pKpi + if (std::abs(flagChannelMain) == DecayChannelMain::DplusToPiKK || std::abs(flagChannelMain) == DecayChannelMain::DsToPiKK || std::abs(flagChannelMain) == DecayChannelMain::LcToPKPi || std::abs(flagChannelMain) == DecayChannelMain::XicToPKPi) { if (arrayDaughters[0].has_mcParticle()) { swapping = static_cast(std::abs(arrayDaughters[0].mcParticle().pdgCode()) == kPiPlus); } diff --git a/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx b/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx index 7bc710c8a9e..c7fa8952ef8 100644 --- a/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx @@ -401,8 +401,8 @@ struct HfTreeCreatorLcToPKPi { Configurable fillCollIdTable{"fillCollIdTable", false, "Fill a single-column table with collision index"}; Configurable fillCandidateMcTable{"fillCandidateMcTable", false, "Switch to fill a table with MC particles matched to candidates"}; Configurable applyMl{"applyMl", false, "Whether ML was used in candidateSelectorLc"}; - Configurable keepOnlySignalMc{"keepOnlySignalMc", false, "Fill MC tree only with signal candidates"}; - Configurable keepOnlyBkg{"keepOnlyBkg", false, "Fill MC tree only with background candidates"}; + Configurable keepSignalMc{"keepSignalMc", false, "Fill MC tree with signal candidates"}; + Configurable keepBkgMc{"keepBkgMc", false, "Fill MC tree with background candidates"}; Configurable keepCorrBkgMC{"keepCorrBkgMC", false, "Flag to keep correlated background sources (Λc+ -> p K− π+ π0, p π− π+, p K− K+ and other charm hadrons)"}; Configurable downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of candidates to store in the tree"}; Configurable downSampleBkgPtMax{"downSampleBkgPtMax", 100.f, "Max. pt for background downsampling"}; @@ -940,11 +940,11 @@ struct HfTreeCreatorLcToPKPi { const int sigbgstatus = determineSignalBgStatus(candidate, candFlag); const bool isMcCandidateSignal = (sigbgstatus == Prompt) || (sigbgstatus == NonPrompt); const bool passSelection = functionSelection >= selectionFlagLc; - const bool keepAll = !keepOnlySignalMc && !keepOnlyBkg && !keepCorrBkgMC; + const bool keepAll = !keepSignalMc && !keepBkgMc && !keepCorrBkgMC; const int flag = candidate.flagMcMatchRec(); - const bool isCorrBkg = (std::abs(flag) != 0 && std::abs(flag) != o2::hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi); + const bool isCorrBkg = (std::abs(flag) != 0 && std::abs(flag) != o2::hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi) || sigbgstatus == WrongOrder; const bool notSkippedBkg = isMcCandidateSignal || candidate.pt() > downSampleBkgPtMax || pseudoRndm < downSampleBkgFactor; - if (passSelection && notSkippedBkg && (keepAll || (keepOnlySignalMc && isMcCandidateSignal) || (keepOnlyBkg && !isMcCandidateSignal) || (keepCorrBkgMC && isCorrBkg))) { + if (passSelection && notSkippedBkg && (keepAll || (keepSignalMc && isMcCandidateSignal) || (keepBkgMc && !isMcCandidateSignal) || (keepCorrBkgMC && isCorrBkg))) { if (fillCandidateLiteTable) { fillLiteTable(candidate, candidateMlScore, candFlag); } else { From a4e4e5f97e26236ace01bb666896830a59f34bec Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Fri, 31 Oct 2025 16:24:21 +0800 Subject: [PATCH 967/986] [PWGCF] Super minor fix to comment (#13616) --- PWGCF/FemtoUniverse/DataModel/FemtoDerived.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGCF/FemtoUniverse/DataModel/FemtoDerived.h b/PWGCF/FemtoUniverse/DataModel/FemtoDerived.h index c103b52791e..1475e9a13a8 100644 --- a/PWGCF/FemtoUniverse/DataModel/FemtoDerived.h +++ b/PWGCF/FemtoUniverse/DataModel/FemtoDerived.h @@ -165,7 +165,7 @@ namespace femtouniversecascparticle DECLARE_SOA_INDEX_COLUMN(FDParticle, fdParticle); DECLARE_SOA_COLUMN(DcaV0daughters, dcaV0daughters, float); //! DCA between V0 daughters DECLARE_SOA_COLUMN(Cpav0, cpav0, float); //! V0 cos of pointing angle -DECLARE_SOA_COLUMN(V0radius, v0radius, float); //! V0 transverse radius*/ +DECLARE_SOA_COLUMN(V0radius, v0radius, float); //! V0 transverse radius DECLARE_SOA_COLUMN(CpaCasc, cpaCasc, float); //! cascade cosinus of pointing angle DECLARE_SOA_COLUMN(Dcacascdaughters, dcacascdaughters, float); //! DCA between cascade daughters DECLARE_SOA_COLUMN(Cascradius, cascradius, float); //! cascade transverse radius From 035f7f3e8cb07aa0352295cff18a5b72afdeebe9 Mon Sep 17 00:00:00 2001 From: Chiara De Martin <39315597+ChiaraDeMartin95@users.noreply.github.com> Date: Fri, 31 Oct 2025 10:02:57 +0100 Subject: [PATCH 968/986] [PWGLF] Add FT0 information (#13607) Co-authored-by: Chiara De Martin Co-authored-by: ALICE Action Bot --- .../TableProducer/Strangeness/cascadeflow.cxx | 65 ++++++++++++++----- 1 file changed, 49 insertions(+), 16 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx index 587012a6f85..a6dbbb04bfb 100644 --- a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx @@ -47,7 +47,7 @@ using std::array; using DauTracks = soa::Join; using CollEventPlane = soa::Join::iterator; -using CollEventPlaneCentralFW = soa::Join::iterator; +using CollEventPlaneCentralFW = soa::Join::iterator; using CollEventPlaneCentralFWOnlyFT0C = soa::Join::iterator; using CollEventAndSpecPlane = soa::Join::iterator; using CollEventAndSpecPlaneCentralFW = soa::Join::iterator; @@ -155,6 +155,7 @@ static const std::vector labelsCutScore = {"Background score", "Sig struct cascadeFlow { Configurable isQVecT0C{"isQVecT0C", 1, ""}; + Configurable isQVecT0A{"isQVecT0A", 0, ""}; Configurable isQVecT0M{"isQVecT0M", 0, ""}; Configurable isQVecV0A{"isQVecV0A", 0, ""}; Configurable isCollisionCentrality{"isCollisionCentrality", 0, ""}; // 0: FT0C, 1: FT0M (implemented only for Lambda analysis in OO) @@ -514,7 +515,7 @@ struct cascadeFlow { auto coeffshiftxFT0C = shiftprofile->GetBinContent(shiftprofile->FindBin(coll.centFT0C(), 0.5, ishift - 0.5)); auto coeffshiftyFT0C = shiftprofile->GetBinContent(shiftprofile->FindBin(coll.centFT0C(), 1.5, ishift - 0.5)); - deltapsiFT0C += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0C * TMath::Cos(ishift * static_cast(nmode) * psiT0C) + coeffshiftyFT0C * TMath::Sin(ishift * static_cast(nmode) * psiT0C))); + deltapsiFT0C += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0C * std::cos(ishift * static_cast(nmode) * psiT0C) + coeffshiftyFT0C * TMath::Sin(ishift * static_cast(nmode) * psiT0C))); } return psiT0C + deltapsiFT0C; } @@ -536,20 +537,21 @@ struct cascadeFlow { auto coeffshiftyTPCC = shiftprofileC->GetBinContent(shiftprofileC->FindBin(coll.centFT0C(), 5.5, ishift - 0.5)); auto coeffshiftxFV0A = shiftprofileD->GetBinContent(shiftprofileA->FindBin(coll.centFT0C(), 0.5, ishift - 0.5)); auto coeffshiftyFV0A = shiftprofileD->GetBinContent(shiftprofileA->FindBin(coll.centFT0C(), 1.5, ishift - 0.5)); - deltapsiFT0C += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0C * TMath::Cos(ishift * static_cast(nmode) * psiT0C) + coeffshiftyFT0C * TMath::Sin(ishift * static_cast(nmode) * psiT0C))); - deltapsiFV0A += ((1 / (1.0 * ishift)) * (-coeffshiftxFV0A * TMath::Cos(ishift * static_cast(nmode) * psiV0A) + coeffshiftyFV0A * TMath::Sin(ishift * static_cast(nmode) * psiV0A))); - deltapsiTPCA += ((1 / (1.0 * ishift)) * (-coeffshiftxTPCA * TMath::Cos(ishift * static_cast(nmode) * psiTPCA) + coeffshiftyTPCA * TMath::Sin(ishift * static_cast(nmode) * psiTPCA))); - deltapsiTPCC += ((1 / (1.0 * ishift)) * (-coeffshiftxTPCC * TMath::Cos(ishift * static_cast(nmode) * psiTPCC) + coeffshiftyTPCC * TMath::Sin(ishift * static_cast(nmode) * psiTPCC))); - } - // histos.fill(HIST("psi2/QA/EP_FT0C_shifted"), coll.centFT0C(), psiT0C + deltapsiFT0C); - // histos.fill(HIST("psi2/QA/EP_TPCA_shifted"), coll.centFT0C(), psiTPCA + deltapsiTPCA); - // histos.fill(HIST("psi2/QA/EP_TPCC_shifted"), coll.centFT0C(), psiTPCC + deltapsiTPCC); - resolution.fill(HIST("QVectorsT0CTPCA_Shifted"), coll.centFT0C(), TMath::Cos(static_cast(nmode) * (psiT0C + deltapsiFT0C - psiTPCA - deltapsiTPCA))); - resolution.fill(HIST("QVectorsT0CV0A_Shifted"), coll.centFT0C(), TMath::Cos(static_cast(nmode) * (psiT0C + deltapsiFT0C - psiV0A - deltapsiFV0A))); - resolution.fill(HIST("QVectorsV0ATPCC_Shifted"), coll.centFT0C(), TMath::Cos(static_cast(nmode) * (psiV0A + deltapsiFV0A - psiTPCC - deltapsiTPCC))); - resolution.fill(HIST("QVectorsV0ATPCA_Shifted"), coll.centFT0C(), TMath::Cos(static_cast(nmode) * (psiV0A + deltapsiFV0A - psiTPCA - deltapsiTPCA))); - resolution.fill(HIST("QVectorsT0CTPCC_Shifted"), coll.centFT0C(), TMath::Cos(static_cast(nmode) * (psiT0C + deltapsiFT0C - psiTPCC - deltapsiTPCC))); - resolution.fill(HIST("QVectorsTPCAC_Shifted"), coll.centFT0C(), TMath::Cos(static_cast(nmode) * (psiTPCA + deltapsiTPCA - psiTPCC - deltapsiTPCC))); + deltapsiFT0C += ((1 / (1.0 * ishift)) * (-coeffshiftxFT0C * std::cos(ishift * static_cast(nmode) * psiT0C) + coeffshiftyFT0C * TMath::Sin(ishift * static_cast(nmode) * psiT0C))); + deltapsiFV0A += ((1 / (1.0 * ishift)) * (-coeffshiftxFV0A * std::cos(ishift * static_cast(nmode) * psiV0A) + coeffshiftyFV0A * TMath::Sin(ishift * static_cast(nmode) * psiV0A))); + deltapsiTPCA += ((1 / (1.0 * ishift)) * (-coeffshiftxTPCA * std::cos(ishift * static_cast(nmode) * psiTPCA) + coeffshiftyTPCA * TMath::Sin(ishift * static_cast(nmode) * psiTPCA))); + deltapsiTPCC += ((1 / (1.0 * ishift)) * (-coeffshiftxTPCC * std::cos(ishift * static_cast(nmode) * psiTPCC) + coeffshiftyTPCC * TMath::Sin(ishift * static_cast(nmode) * psiTPCC))); + } + histos.fill(HIST("Psi_EP_FT0C_shifted"), coll.centFT0C(), psiT0C + deltapsiFT0C); + histos.fill(HIST("Psi_EP_FV0A_shifted"), coll.centFT0C(), psiV0A + deltapsiFV0A); + histos.fill(HIST("Psi_EP_TPCA_shifted"), coll.centFT0C(), psiTPCA + deltapsiTPCA); + histos.fill(HIST("Psi_EP_TPCC_shifted"), coll.centFT0C(), psiTPCC + deltapsiTPCC); + resolution.fill(HIST("QVectorsT0CTPCA_Shifted"), std::cos(static_cast(nmode) * (psiT0C + deltapsiFT0C - psiTPCA - deltapsiTPCA)), coll.centFT0C()); + resolution.fill(HIST("QVectorsT0CV0A_Shifted"), std::cos(static_cast(nmode) * (psiT0C + deltapsiFT0C - psiV0A - deltapsiFV0A)), coll.centFT0C()); + resolution.fill(HIST("QVectorsV0ATPCC_Shifted"), std::cos(static_cast(nmode) * (psiV0A + deltapsiFV0A - psiTPCC - deltapsiTPCC)), coll.centFT0C()); + resolution.fill(HIST("QVectorsV0ATPCA_Shifted"), std::cos(static_cast(nmode) * (psiV0A + deltapsiFV0A - psiTPCA - deltapsiTPCA)), coll.centFT0C()); + resolution.fill(HIST("QVectorsT0CTPCC_Shifted"), std::cos(static_cast(nmode) * (psiT0C + deltapsiFT0C - psiTPCC - deltapsiTPCC)), coll.centFT0C()); + resolution.fill(HIST("QVectorsTPCAC_Shifted"), std::cos(static_cast(nmode) * (psiTPCA + deltapsiTPCA - psiTPCC - deltapsiTPCC)), coll.centFT0C()); return true; } @@ -762,6 +764,12 @@ struct cascadeFlow { resolution.add("QVectorsT0CV0A", "QVectorsT0CV0A", HistType::kTH2F, {axisQVs, CentAxisPerCent}); resolution.add("QVectorsV0ATPCC", "QVectorsV0ATPCC", HistType::kTH2F, {axisQVs, CentAxisPerCent}); resolution.add("QVectorsV0ATPCA", "QVectorsV0ATPCA", HistType::kTH2F, {axisQVs, CentAxisPerCent}); + resolution.add("EP_T0CTPCA", "EP_T0CTPCA", HistType::kTH2F, {axisQVs, CentAxisPerCent}); + resolution.add("EP_T0CTPCC", "EP_T0CTPCC", HistType::kTH2F, {axisQVs, CentAxisPerCent}); + resolution.add("EP_TPCAC", "EP_TPCAC", HistType::kTH2F, {axisQVs, CentAxisPerCent}); + resolution.add("EP_T0CV0A", "EP_T0CV0A", HistType::kTH2F, {axisQVs, CentAxisPerCent}); + resolution.add("EP_V0ATPCC", "EP_V0ATPCC", HistType::kTH2F, {axisQVs, CentAxisPerCent}); + resolution.add("EP_V0ATPCA", "EP_V0ATPCA", HistType::kTH2F, {axisQVs, CentAxisPerCent}); resolution.add("QVectorsNormT0CTPCA", "QVectorsNormT0CTPCA", HistType::kTH2F, {axisQVsNorm, CentAxisPerCent}); resolution.add("QVectorsNormT0CTPCC", "QVectorsNormT0CTPCC", HistType::kTH2F, {axisQVsNorm, CentAxisPerCent}); resolution.add("QVectorsNormTPCAC", "QVectorsNormTPCCB", HistType::kTH2F, {axisQVsNorm, CentAxisPerCent}); @@ -794,6 +802,10 @@ struct cascadeFlow { histos.add("hEventCentralityBefEPSelT0M", "hEventCentralityBefEPSelT0M", kTH1F, {{101, 0, 101}}); histos.add("hPsiT0C", "hPsiT0C", HistType::kTH1D, {{100, -o2::constants::math::PI, o2::constants::math::PI}}); histos.add("hPsiT0CvsCentFT0C", "hPsiT0CvsCentFT0C", HistType::kTH2D, {CentAxis, {100, -o2::constants::math::PI, o2::constants::math::PI}}); + histos.add("Psi_EP_FT0C_shifted", "Psi_EP_FT0C_shifted", HistType::kTH2D, {CentAxis, {100, -o2::constants::math::PI, o2::constants::math::PI}}); + histos.add("Psi_EP_FV0A_shifted", "Psi_EP_FT0C_shifted", HistType::kTH2D, {CentAxis, {100, -o2::constants::math::PI, o2::constants::math::PI}}); + histos.add("Psi_EP_TPCA_shifted", "Psi_EP_FT0C_shifted", HistType::kTH2D, {CentAxis, {100, -o2::constants::math::PI, o2::constants::math::PI}}); + histos.add("Psi_EP_TPCC_shifted", "Psi_EP_FT0C_shifted", HistType::kTH2D, {CentAxis, {100, -o2::constants::math::PI, o2::constants::math::PI}}); histos.add("hPsiZDCA_vs_ZDCC", "hPsiZDCA_vs_ZDCC", HistType::kTH2D, {{100, -o2::constants::math::PI, o2::constants::math::PI}, {100, -o2::constants::math::PI, o2::constants::math::PI}}); histos.add("hEventNchCorrelation", "hEventNchCorrelation", kTH2F, {{5000, 0, 5000}, {5000, 0, 2500}}); histos.add("hEventPVcontributorsVsCentrality", "hEventPVcontributorsVsCentrality", kTH2F, {{100, 0, 100}, {5000, 0, 5000}}); @@ -1137,6 +1149,9 @@ struct cascadeFlow { resolution.fill(HIST("QVectorsT0CTPCA"), eventplaneVecT0C.Dot(eventplaneVecTPCA), coll.centFT0C()); resolution.fill(HIST("QVectorsT0CTPCC"), eventplaneVecT0C.Dot(eventplaneVecTPCC), coll.centFT0C()); resolution.fill(HIST("QVectorsTPCAC"), eventplaneVecTPCA.Dot(eventplaneVecTPCC), coll.centFT0C()); + resolution.fill(HIST("EP_T0CTPCA"), cos(2 * (psiT0C - psiTPCA)), coll.centFT0C()); + resolution.fill(HIST("EP_T0CTPCC"), cos(2 * (psiT0C - psiTPCC)), coll.centFT0C()); + resolution.fill(HIST("EP_TPCAC"), cos(2 * (psiTPCA - psiTPCC)), coll.centFT0C()); resolution.fill(HIST("QVectorsNormT0CTPCA"), eventplaneVecT0C.Dot(eventplaneVecTPCA) / (coll.qTPCR() * coll.sumAmplFT0C()), coll.centFT0C()); resolution.fill(HIST("QVectorsNormT0CTPCC"), eventplaneVecT0C.Dot(eventplaneVecTPCC) / (coll.qTPCL() * coll.sumAmplFT0C()), coll.centFT0C()); resolution.fill(HIST("QVectorsNormTPCAC"), eventplaneVecTPCA.Dot(eventplaneVecTPCC) / (coll.qTPCR() * coll.qTPCL()), coll.centFT0C()); @@ -1449,6 +1464,9 @@ struct cascadeFlow { resolution.fill(HIST("QVectorsT0CTPCA"), eventplaneVecT0C.Dot(eventplaneVecTPCA), coll.centFT0C()); resolution.fill(HIST("QVectorsT0CTPCC"), eventplaneVecT0C.Dot(eventplaneVecTPCC), coll.centFT0C()); resolution.fill(HIST("QVectorsTPCAC"), eventplaneVecTPCA.Dot(eventplaneVecTPCC), coll.centFT0C()); + resolution.fill(HIST("EP_T0CTPCA"), cos(2 * (psiT0C - psiTPCA)), coll.centFT0C()); + resolution.fill(HIST("EP_T0CTPCC"), cos(2 * (psiT0C - psiTPCC)), coll.centFT0C()); + resolution.fill(HIST("EP_TPCAC"), cos(2 * (psiTPCA - psiTPCC)), coll.centFT0C()); resolution.fill(HIST("QVectorsNormT0CTPCA"), eventplaneVecT0C.Dot(eventplaneVecTPCA) / (coll.qTPCR() * coll.sumAmplFT0C()), coll.centFT0C()); resolution.fill(HIST("QVectorsNormT0CTPCC"), eventplaneVecT0C.Dot(eventplaneVecTPCC) / (coll.qTPCL() * coll.sumAmplFT0C()), coll.centFT0C()); resolution.fill(HIST("QVectorsNormTPCAC"), eventplaneVecTPCA.Dot(eventplaneVecTPCC) / (coll.qTPCR() * coll.qTPCL()), coll.centFT0C()); @@ -1705,6 +1723,9 @@ struct cascadeFlow { if (isQVecT0C) { qvecRe = coll.qvecFT0CRe(); qvecIm = coll.qvecFT0CIm(); + } else if (isQVecT0A) { + qvecRe = coll.qvecFT0ARe(); + qvecIm = coll.qvecFT0AIm(); } else if (isQVecT0M) { qvecRe = coll.qvecFT0MRe(); qvecIm = coll.qvecFT0MIm(); @@ -1791,6 +1812,13 @@ struct cascadeFlow { resolution.fill(HIST("QVectorsV0ATPCC"), eventplaneVecV0A.Dot(eventplaneVecTPCC), collisionCentrality); resolution.fill(HIST("QVectorsV0ATPCA"), eventplaneVecV0A.Dot(eventplaneVecTPCA), collisionCentrality); + resolution.fill(HIST("EP_T0CTPCA"), cos(2 * (psiT0C - psiTPCA)), coll.centFT0C()); + resolution.fill(HIST("EP_T0CTPCC"), cos(2 * (psiT0C - psiTPCC)), coll.centFT0C()); + resolution.fill(HIST("EP_TPCAC"), cos(2 * (psiTPCA - psiTPCC)), coll.centFT0C()); + resolution.fill(HIST("EP_T0CV0A"), cos(2 * (psiT0C - psiV0A)), coll.centFT0C()); + resolution.fill(HIST("EP_V0ATPCC"), cos(2 * (psiV0A - psiTPCC)), coll.centFT0C()); + resolution.fill(HIST("EP_V0ATPCA"), cos(2 * (psiV0A - psiTPCA)), coll.centFT0C()); + resolution.fill(HIST("QVectorsNormT0CTPCA"), eventplaneVecT0C.Dot(eventplaneVecTPCA) / (coll.qTPCR() * coll.sumAmplFT0C()), collisionCentrality); resolution.fill(HIST("QVectorsNormT0CTPCC"), eventplaneVecT0C.Dot(eventplaneVecTPCC) / (coll.qTPCL() * coll.sumAmplFT0C()), collisionCentrality); resolution.fill(HIST("QVectorsNormTPCAC"), eventplaneVecTPCA.Dot(eventplaneVecTPCC) / (coll.qTPCR() * coll.qTPCL()), collisionCentrality); @@ -2021,6 +2049,11 @@ struct cascadeFlow { resolution.fill(HIST("QVectorsT0CTPCA"), eventplaneVecT0C.Dot(eventplaneVecTPCA), coll.centFT0C()); resolution.fill(HIST("QVectorsT0CTPCC"), eventplaneVecT0C.Dot(eventplaneVecTPCC), coll.centFT0C()); resolution.fill(HIST("QVectorsTPCAC"), eventplaneVecTPCA.Dot(eventplaneVecTPCC), coll.centFT0C()); + + resolution.fill(HIST("EP_T0CTPCA"), cos(2 * (psiT0C - psiTPCA)), coll.centFT0C()); + resolution.fill(HIST("EP_T0CTPCC"), cos(2 * (psiT0C - psiTPCC)), coll.centFT0C()); + resolution.fill(HIST("EP_TPCAC"), cos(2 * (psiTPCA - psiTPCC)), coll.centFT0C()); + resolution.fill(HIST("QVectorsNormT0CTPCA"), eventplaneVecT0C.Dot(eventplaneVecTPCA) / (NormQvT0C * NormQvTPCA), coll.centFT0C()); resolution.fill(HIST("QVectorsNormT0CTPCC"), eventplaneVecT0C.Dot(eventplaneVecTPCC) / (NormQvT0C * NormQvTPCC), coll.centFT0C()); resolution.fill(HIST("QVectorsNormTPCAC"), eventplaneVecTPCA.Dot(eventplaneVecTPCC) / (NormQvTPCA * NormQvTPCC), coll.centFT0C()); From 2f2f907c63668b8cd8d21a982c4f3f19fab80cce Mon Sep 17 00:00:00 2001 From: "Paul Veen (paveen)" <80593165+ppoava@users.noreply.github.com> Date: Fri, 31 Oct 2025 11:10:39 +0100 Subject: [PATCH 969/986] [Common] Bug fixing and adding more histograms (#13564) --- Common/Tasks/qaMuon.cxx | 249 +++++++++++++++++++++++++++------------- 1 file changed, 171 insertions(+), 78 deletions(-) diff --git a/Common/Tasks/qaMuon.cxx b/Common/Tasks/qaMuon.cxx index 8c9fdc6c839..7a0d1497e49 100644 --- a/Common/Tasks/qaMuon.cxx +++ b/Common/Tasks/qaMuon.cxx @@ -626,25 +626,21 @@ struct muonQa { // mu+mu+ registryDimuon.add("dimuon/same-event/same-sign-PP/DCA/pT_Mu1DCAx_minus_Mu2DCAx_MuonKine_MuonCuts", "DCA_x #mu_{1} minus DCA_x #mu_{2} and #mu^{+}#mu^{+} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); registryDimuon.add("dimuon/same-event/same-sign-PP/DCA/pT_Mu1TDCAx_minus_Mu2TDCAx_MuonKine_MuonCuts", "DCA_x #mu_{1} top minus DCA_x #mu_{2} top and #mu^{+}#mu^{+} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); - registryDimuon.add("dimuon/same-event/same-sign-PP/DCA/pT_Mu1TDCAx_minus_Mu2BDCAx_MuonKine_MuonCuts", "DCA_x #mu_{1} top minus DCA_x #mu_{2} bottom and #mu^{+}#mu^{+} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/same-sign-PP/DCA/pT_MuTDCAx_minus_MuBDCAx_MuonKine_MuonCuts", "DCA_x #mu top minus DCA_x #mu bottom and #mu^{+}#mu^{+} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); registryDimuon.add("dimuon/same-event/same-sign-PP/DCA/pT_Mu1BDCAx_minus_Mu2BDCAx_MuonKine_MuonCuts", "DCA_x #mu_{1} bottom minus DCA_x #mu_{2} bottom and #mu^{+}#mu^{+} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); - registryDimuon.add("dimuon/same-event/same-sign-PP/DCA/pT_Mu1BDCAx_minus_Mu2TDCAx_MuonKine_MuonCuts", "DCA_x #mu_{1} bottom minus DCA_x #mu_{2} top and #mu^{+}#mu^{+} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); registryDimuon.add("dimuon/same-event/same-sign-PP/DCA/pT_Mu1DCAy_minus_Mu2DCAy_MuonKine_MuonCuts", "DCA_y #mu_{1} minus DCA_y #mu_{2} and #mu^{+}#mu^{+} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); registryDimuon.add("dimuon/same-event/same-sign-PP/DCA/pT_Mu1TDCAy_minus_Mu2TDCAy_MuonKine_MuonCuts", "DCA_y #mu_{1} top minus DCA_y #mu_{2} top and #mu^{+}#mu^{+} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); - registryDimuon.add("dimuon/same-event/same-sign-PP/DCA/pT_Mu1TDCAy_minus_Mu2BDCAy_MuonKine_MuonCuts", "DCA_y #mu_{1} top minus DCA_y #mu_{2} bottom and #mu^{+}#mu^{+} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/same-sign-PP/DCA/pT_MuTDCAy_minus_MuBDCAy_MuonKine_MuonCuts", "DCA_y #mu top minus DCA_y #mu bottom and #mu^{+}#mu^{+} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); registryDimuon.add("dimuon/same-event/same-sign-PP/DCA/pT_Mu1BDCAy_minus_Mu2BDCAy_MuonKine_MuonCuts", "DCA_y #mu_{1} bottom minus DCA_y #mu_{2} bottom and #mu^{+}#mu^{+} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); - registryDimuon.add("dimuon/same-event/same-sign-PP/DCA/pT_Mu1BDCAy_minus_Mu2TDCAy_MuonKine_MuonCuts", "DCA_y #mu_{1} bottom minus DCA_y #mu_{2} top and #mu^{+}#mu^{+} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); // mu-mu- registryDimuon.add("dimuon/same-event/same-sign-MM/DCA/pT_Mu1DCAx_minus_Mu2DCAx_MuonKine_MuonCuts", "DCA_x #mu_{1} minus DCA_x #mu_{2} and #mu^{-}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); registryDimuon.add("dimuon/same-event/same-sign-MM/DCA/pT_Mu1TDCAx_minus_Mu2TDCAx_MuonKine_MuonCuts", "DCA_x #mu_{1} top minus DCA_x #mu_{2} top and #mu^{-}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); - registryDimuon.add("dimuon/same-event/same-sign-MM/DCA/pT_Mu1TDCAx_minus_Mu2BDCAx_MuonKine_MuonCuts", "DCA_x #mu_{1} top minus DCA_x #mu_{2} bottom and #mu^{-}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/same-sign-MM/DCA/pT_MuTDCAx_minus_MuBDCAx_MuonKine_MuonCuts", "DCA_x #mu top minus DCA_x #mu bottom and #mu^{-}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); registryDimuon.add("dimuon/same-event/same-sign-MM/DCA/pT_Mu1BDCAx_minus_Mu2BDCAx_MuonKine_MuonCuts", "DCA_x #mu_{1} bottom minus DCA_x #mu_{2} bottom and #mu^{-}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); - registryDimuon.add("dimuon/same-event/same-sign-MM/DCA/pT_Mu1BDCAx_minus_Mu2TDCAx_MuonKine_MuonCuts", "DCA_x #mu_{1} bottom minus DCA_x #mu_{2} top and #mu^{-}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); registryDimuon.add("dimuon/same-event/same-sign-MM/DCA/pT_Mu1DCAy_minus_Mu2DCAy_MuonKine_MuonCuts", "DCA_y #mu_{1} minus DCA_y #mu_{-} and #mu^{-}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); registryDimuon.add("dimuon/same-event/same-sign-MM/DCA/pT_Mu1TDCAy_minus_Mu2TDCAy_MuonKine_MuonCuts", "DCA_y #mu_{1} top minus DCA_y #mu_{2} top and #mu^{-}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); - registryDimuon.add("dimuon/same-event/same-sign-MM/DCA/pT_Mu1TDCAy_minus_Mu2BDCAy_MuonKine_MuonCuts", "DCA_y #mu_{1} top minus DCA_y #mu_{2} bottom and #mu^{-}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/same-sign-MM/DCA/pT_MuTDCAy_minus_MuBDCAy_MuonKine_MuonCuts", "DCA_y #mu top minus DCA_y #mu bottom and #mu^{-}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); registryDimuon.add("dimuon/same-event/same-sign-MM/DCA/pT_Mu1BDCAy_minus_Mu2BDCAy_MuonKine_MuonCuts", "DCA_y #mu_{1} bottom minus DCA_y #mu_{2} bottom and #mu^{-}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); - registryDimuon.add("dimuon/same-event/same-sign-MM/DCA/pT_Mu1BDCAy_minus_Mu2TDCAy_MuonKine_MuonCuts", "DCA_y #mu_{1} bottom minus DCA_y #mu_{2} top and #mu^{-}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); } registryDimuon.add("dimuon/mixed-event/DCA/pT_MuPosDCAx_minus_MuNegDCAx_MuonKine_MuonCuts", "DCA_x #mu^{+} minus DCA_x #mu^{-} and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); registryDimuon.add("dimuon/mixed-event/DCA/pT_MuPosTDCAx_minus_MuNegTDCAx_MuonKine_MuonCuts", "DCA_x #mu^{+} top minus DCA_x #mu^{-} top and #mu^{+}#mu^{-} p_{T}", {HistType::kTH2F, {pTAxis2D, dcaAxis}}); @@ -714,6 +710,8 @@ struct muonQa { registryDimuon.add("dimuon/mixed-event/invariantMass_pT_MuonKine_MuonCuts_TNBP", "#mu^{+}#mu^{-} invariant mass, #mu^{-} top and #mu^{+} bottom", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); registryDimuon.add("dimuon/mixed-event/invariantMass_pT_MuonKine_MuonCuts_BB", "#mu^{+}#mu^{-} invariant mass, bottom-bottom", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); // MCH-MID tracks with MFT acceptance cuts and combinations from the top and bottom halfs of MCH + registryDimuon.add("dimuon/same-event/invariantMass_MuonKine_GlobalMuonCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH1F, {invMassAxis}}); + registryDimuon.add("dimuon/same-event/invariantMassFull_MuonKine_GlobalMuonCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH1F, {invMassAxisFull}}); registryDimuon.add("dimuon/same-event/invariantMass_MuonKine_GlobalMuonCuts_TT", "#mu^{+}#mu^{-} invariant mass, top-top", {HistType::kTH1F, {invMassAxis}}); registryDimuon.add("dimuon/same-event/invariantMassFull_MuonKine_GlobalMuonCuts_TT", "#mu^{+}#mu^{-} invariant mass, top-top", {HistType::kTH1F, {invMassAxisFull}}); registryDimuon.add("dimuon/same-event/invariantMass_MuonKine_GlobalMuonCuts_TB", "#mu^{+}#mu^{-} invariant mass, top-bottom or bottom-top", {HistType::kTH1F, {invMassAxis}}); @@ -724,6 +722,8 @@ struct muonQa { registryDimuon.add("dimuon/same-event/invariantMassFull_MuonKine_GlobalMuonCuts_TNBP", "#mu^{+}#mu^{-} invariant mass, #mu^{-} top and #mu^{+} bottom", {HistType::kTH1F, {invMassAxisFull}}); registryDimuon.add("dimuon/same-event/invariantMass_MuonKine_GlobalMuonCuts_BB", "#mu^{+}#mu^{-} invariant mass, bottom-bottom", {HistType::kTH1F, {invMassAxis}}); registryDimuon.add("dimuon/same-event/invariantMassFull_MuonKine_GlobalMuonCuts_BB", "#mu^{+}#mu^{-} invariant mass, bottom-bottom", {HistType::kTH1F, {invMassAxisFull}}); + registryDimuon.add("dimuon/mixed-event/invariantMass_MuonKine_GlobalMuonCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH1F, {invMassAxis}}); + registryDimuon.add("dimuon/mixed-event/invariantMassFull_MuonKine_GlobalMuonCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH1F, {invMassAxisFull}}); registryDimuon.add("dimuon/mixed-event/invariantMass_MuonKine_GlobalMuonCuts_TT", "#mu^{+}#mu^{-} invariant mass, top-top", {HistType::kTH1F, {invMassAxis}}); registryDimuon.add("dimuon/mixed-event/invariantMassFull_MuonKine_GlobalMuonCuts_TT", "#mu^{+}#mu^{-} invariant mass, top-top", {HistType::kTH1F, {invMassAxisFull}}); registryDimuon.add("dimuon/mixed-event/invariantMass_MuonKine_GlobalMuonCuts_TB", "#mu^{+}#mu^{-} invariant mass, top-bottom or bottom-top", {HistType::kTH1F, {invMassAxis}}); @@ -735,11 +735,13 @@ struct muonQa { registryDimuon.add("dimuon/mixed-event/invariantMass_MuonKine_GlobalMuonCuts_BB", "#mu^{+}#mu^{-} invariant mass, bottom-bottom", {HistType::kTH1F, {invMassAxis}}); registryDimuon.add("dimuon/mixed-event/invariantMassFull_MuonKine_GlobalMuonCuts_BB", "#mu^{+}#mu^{-} invariant mass, bottom-bottom", {HistType::kTH1F, {invMassAxisFull}}); // -- Mass and pT + registryDimuon.add("dimuon/same-event/invariantMass_pT_MuonKine_GlobalMuonCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); registryDimuon.add("dimuon/same-event/invariantMass_pT_MuonKine_GlobalMuonCuts_TT", "#mu^{+}#mu^{-} invariant mass, top-top", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); registryDimuon.add("dimuon/same-event/invariantMass_pT_MuonKine_GlobalMuonCuts_TB", "#mu^{+}#mu^{-} invariant mass, top-bottom or bottom-top", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); registryDimuon.add("dimuon/same-event/invariantMass_pT_MuonKine_GlobalMuonCuts_TPBN", "#mu^{+}#mu^{-} invariant mass, #mu^{+} top and #mu^{-} bottom", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); registryDimuon.add("dimuon/same-event/invariantMass_pT_MuonKine_GlobalMuonCuts_TNBP", "#mu^{+}#mu^{-} invariant mass, #mu^{-} top and #mu^{+} bottom", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); registryDimuon.add("dimuon/same-event/invariantMass_pT_MuonKine_GlobalMuonCuts_BB", "#mu^{+}#mu^{-} invariant mass, bottom-bottom", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/mixed-event/invariantMass_pT_MuonKine_GlobalMuonCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); registryDimuon.add("dimuon/mixed-event/invariantMass_pT_MuonKine_GlobalMuonCuts_TT", "#mu^{+}#mu^{-} invariant mass, top-top", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); registryDimuon.add("dimuon/mixed-event/invariantMass_pT_MuonKine_GlobalMuonCuts_TB", "#mu^{+}#mu^{-} invariant mass, top-bottom or bottom-top", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); registryDimuon.add("dimuon/mixed-event/invariantMass_pT_MuonKine_GlobalMuonCuts_TPBN", "#mu^{+}#mu^{-} invariant mass, #mu^{+} top and #mu^{-} bottom", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); @@ -758,7 +760,7 @@ struct muonQa { registryDimuon.add("dimuon/same-event/invariantMassFull_MuonKine_MuonCuts_RR", "#mu^{+}#mu^{-} invariant mass, right-right", {HistType::kTH1F, {invMassAxisFull}}); registryDimuon.add("dimuon/mixed-event/invariantMass_MuonKine_MuonCuts_LL", "#mu^{+}#mu^{-} invariant mass, left-left", {HistType::kTH1F, {invMassAxis}}); registryDimuon.add("dimuon/mixed-event/invariantMassFull_MuonKine_MuonCuts_LL", "#mu^{+}#mu^{-} invariant mass, left-left", {HistType::kTH1F, {invMassAxisFull}}); - registryDimuon.add("dimuon/mixed-event/invariantMass_MuonKine_MuonCuts_LR", "#mu^{+}#mu^{-} invariant mass, left-right or left-right", {HistType::kTH1F, {invMassAxis}}); + registryDimuon.add("dimuon/mixed-event/invariantMass_MuonKine_MuonCuts_LR", "#mu^{+}#mu^{-} invariant mass, left-right or right-left", {HistType::kTH1F, {invMassAxis}}); registryDimuon.add("dimuon/mixed-event/invariantMassFull_MuonKine_MuonCuts_LR", "#mu^{+}#mu^{-} invariant mass, left-right or right-left", {HistType::kTH1F, {invMassAxisFull}}); registryDimuon.add("dimuon/mixed-event/invariantMass_MuonKine_MuonCuts_LPRN", "#mu^{+}#mu^{-} invariant mass, #mu^{+} left and #mu^{-} right", {HistType::kTH1F, {invMassAxis}}); registryDimuon.add("dimuon/mixed-event/invariantMass_MuonKine_MuonCuts_LNRP", "#mu^{+}#mu^{-} invariant mass, #mu^{-} left and #mu^{+} right", {HistType::kTH1F, {invMassAxis}}); @@ -777,14 +779,6 @@ struct muonQa { registryDimuon.add("dimuon/mixed-event/invariantMass_pT_MuonKine_MuonCuts_LPRN", "#mu^{+}#mu^{-} invariant mass, #mu^{+} left and #mu^{-} right", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); registryDimuon.add("dimuon/mixed-event/invariantMass_pT_MuonKine_MuonCuts_LNRP", "#mu^{+}#mu^{-} invariant mass, #mu^{-} left and #mu^{+} right", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); registryDimuon.add("dimuon/mixed-event/invariantMass_pT_MuonKine_MuonCuts_RR", "#mu^{+}#mu^{-} invariant mass, right-right", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); - // MCH-MID tracks with MFT acceptance cuts - registryDimuon.add("dimuon/same-event/invariantMass_MuonKine_GlobalMuonCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH1F, {invMassAxis}}); - registryDimuon.add("dimuon/same-event/invariantMassFull_MuonKine_GlobalMuonCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH1F, {invMassAxisFull}}); - registryDimuon.add("dimuon/mixed-event/invariantMass_MuonKine_GlobalMuonCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH1F, {invMassAxis}}); - registryDimuon.add("dimuon/mixed-event/invariantMassFull_MuonKine_GlobalMuonCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH1F, {invMassAxisFull}}); - // -- Mass and pT - registryDimuon.add("dimuon/same-event/invariantMass_pT_MuonKine_GlobalMuonCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); - registryDimuon.add("dimuon/mixed-event/invariantMass_pT_MuonKine_GlobalMuonCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); // MCH-MID tracks with MFT acceptance cuts and combinations from the left and right halfs of MCH registryDimuon.add("dimuon/same-event/invariantMass_MuonKine_GlobalMuonCuts_LL", "#mu^{+}#mu^{-} invariant mass, left-left", {HistType::kTH1F, {invMassAxis}}); registryDimuon.add("dimuon/same-event/invariantMassFull_MuonKine_GlobalMuonCuts_LL", "#mu^{+}#mu^{-} invariant mass, left-left", {HistType::kTH1F, {invMassAxisFull}}); @@ -820,13 +814,51 @@ struct muonQa { // Good MFT-MCH-MID tracks with MCH parameters and MFT acceptance cuts registryDimuon.add("dimuon/same-event/invariantMass_MuonKine_GlobalMatchesCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH1F, {invMassAxis}}); registryDimuon.add("dimuon/same-event/invariantMassFull_MuonKine_GlobalMatchesCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH1F, {invMassAxisFull}}); + registryDimuon.add("dimuon/same-event/invariantMass_MuonKine_GlobalMatchesCuts_TT", "#mu^{+}#mu^{-} invariant mass, top - top", {HistType::kTH1F, {invMassAxis}}); + registryDimuon.add("dimuon/same-event/invariantMass_MuonKine_GlobalMatchesCuts_TB", "#mu^{+}#mu^{-} invariant mass, top - bottom", {HistType::kTH1F, {invMassAxis}}); + registryDimuon.add("dimuon/same-event/invariantMass_MuonKine_GlobalMatchesCuts_BT", "#mu^{+}#mu^{-} invariant mass, bottom - top", {HistType::kTH1F, {invMassAxis}}); + registryDimuon.add("dimuon/same-event/invariantMass_MuonKine_GlobalMatchesCuts_BB", "#mu^{+}#mu^{-} invariant mass, bottom - bottom", {HistType::kTH1F, {invMassAxis}}); registryDimuon.add("dimuon/mixed-event/invariantMass_MuonKine_GlobalMatchesCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH1F, {invMassAxis}}); registryDimuon.add("dimuon/mixed-event/invariantMassFull_MuonKine_GlobalMatchesCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH1F, {invMassAxisFull}}); + registryDimuon.add("dimuon/mixed-event/invariantMass_MuonKine_GlobalMatchesCuts_TT", "#mu^{+}#mu^{-} invariant mass, top - top", {HistType::kTH1F, {invMassAxis}}); + registryDimuon.add("dimuon/mixed-event/invariantMass_MuonKine_GlobalMatchesCuts_TB", "#mu^{+}#mu^{-} invariant mass, top - bottom", {HistType::kTH1F, {invMassAxis}}); + registryDimuon.add("dimuon/mixed-event/invariantMass_MuonKine_GlobalMatchesCuts_BT", "#mu^{+}#mu^{-} invariant mass, bottom - top", {HistType::kTH1F, {invMassAxis}}); + registryDimuon.add("dimuon/mixed-event/invariantMass_MuonKine_GlobalMatchesCuts_BB", "#mu^{+}#mu^{-} invariant mass, bottom - bottom", {HistType::kTH1F, {invMassAxis}}); + // -- Mass and pT + registryDimuon.add("dimuon/same-event/invariantMass_pT_MuonKine_GlobalMatchesCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/same-event/invariantMass_pT_MuonKine_GlobalMatchesCuts_TT", "#mu^{+}#mu^{-} invariant mass, top - top", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/same-event/invariantMass_pT_MuonKine_GlobalMatchesCuts_TB", "#mu^{+}#mu^{-} invariant mass, top - bottom", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/same-event/invariantMass_pT_MuonKine_GlobalMatchesCuts_BT", "#mu^{+}#mu^{-} invariant mass, bottom - top", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/same-event/invariantMass_pT_MuonKine_GlobalMatchesCuts_BB", "#mu^{+}#mu^{-} invariant mass, bottom - bottom", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/mixed-event/invariantMass_pT_MuonKine_GlobalMatchesCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/mixed-event/invariantMass_pT_MuonKine_GlobalMatchesCuts_TT", "#mu^{+}#mu^{-} invariant mass, top - top", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/mixed-event/invariantMass_pT_MuonKine_GlobalMatchesCuts_TB", "#mu^{+}#mu^{-} invariant mass, top - bottom", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/mixed-event/invariantMass_pT_MuonKine_GlobalMatchesCuts_BT", "#mu^{+}#mu^{-} invariant mass, bottom - top", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/mixed-event/invariantMass_pT_MuonKine_GlobalMatchesCuts_BB", "#mu^{+}#mu^{-} invariant mass, bottom - bottom", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); // Good MFT-MCH-MID tracks with global parameters MFT acceptance cuts registryDimuon.add("dimuon/same-event/invariantMass_GlobalMuonKine_GlobalMatchesCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH1F, {invMassAxis}}); + registryDimuon.add("dimuon/same-event/invariantMass_GlobalMuonKine_GlobalMatchesCuts_TT", "#mu^{+}#mu^{-} invariant mass, top-top", {HistType::kTH1F, {invMassAxis}}); + registryDimuon.add("dimuon/same-event/invariantMass_GlobalMuonKine_GlobalMatchesCuts_TB", "#mu^{+}#mu^{-} invariant mass, top-bottom", {HistType::kTH1F, {invMassAxis}}); + registryDimuon.add("dimuon/same-event/invariantMass_GlobalMuonKine_GlobalMatchesCuts_BT", "#mu^{+}#mu^{-} invariant mass, bottom-top", {HistType::kTH1F, {invMassAxis}}); + registryDimuon.add("dimuon/same-event/invariantMass_GlobalMuonKine_GlobalMatchesCuts_BB", "#mu^{+}#mu^{-} invariant mass, bottom-bottom", {HistType::kTH1F, {invMassAxis}}); registryDimuon.add("dimuon/same-event/invariantMassFull_GlobalMuonKine_GlobalMatchesCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH1F, {invMassAxisFull}}); registryDimuon.add("dimuon/mixed-event/invariantMass_GlobalMuonKine_GlobalMatchesCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH1F, {invMassAxis}}); + registryDimuon.add("dimuon/mixed-event/invariantMass_GlobalMuonKine_GlobalMatchesCuts_TT", "#mu^{+}#mu^{-} invariant mass, top-top", {HistType::kTH1F, {invMassAxis}}); + registryDimuon.add("dimuon/mixed-event/invariantMass_GlobalMuonKine_GlobalMatchesCuts_TB", "#mu^{+}#mu^{-} invariant mass, top-bottom", {HistType::kTH1F, {invMassAxis}}); + registryDimuon.add("dimuon/mixed-event/invariantMass_GlobalMuonKine_GlobalMatchesCuts_BT", "#mu^{+}#mu^{-} invariant mass, bottom-top", {HistType::kTH1F, {invMassAxis}}); + registryDimuon.add("dimuon/mixed-event/invariantMass_GlobalMuonKine_GlobalMatchesCuts_BB", "#mu^{+}#mu^{-} invariant mass, bottom-bottom", {HistType::kTH1F, {invMassAxis}}); registryDimuon.add("dimuon/mixed-event/invariantMassFull_GlobalMuonKine_GlobalMatchesCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH1F, {invMassAxisFull}}); + // -- Mass and pT + registryDimuon.add("dimuon/same-event/invariantMass_pT_GlobalMuonKine_GlobalMatchesCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/same-event/invariantMass_pT_GlobalMuonKine_GlobalMatchesCuts_TT", "#mu^{+}#mu^{-} invariant mass, top-top", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/same-event/invariantMass_pT_GlobalMuonKine_GlobalMatchesCuts_TB", "#mu^{+}#mu^{-} invariant mass, top-bottom", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/same-event/invariantMass_pT_GlobalMuonKine_GlobalMatchesCuts_BT", "#mu^{+}#mu^{-} invariant mass, bottom-top", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/same-event/invariantMass_pT_GlobalMuonKine_GlobalMatchesCuts_BB", "#mu^{+}#mu^{-} invariant mass, bottom-bottom", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/mixed-event/invariantMass_pT_GlobalMuonKine_GlobalMatchesCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/mixed-event/invariantMass_pT_GlobalMuonKine_GlobalMatchesCuts_TT", "#mu^{+}#mu^{-} invariant mass, top-top", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/mixed-event/invariantMass_pT_GlobalMuonKine_GlobalMatchesCuts_TB", "#mu^{+}#mu^{-} invariant mass, top-bottom", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/mixed-event/invariantMass_pT_GlobalMuonKine_GlobalMatchesCuts_BT", "#mu^{+}#mu^{-} invariant mass, bottom-top", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/mixed-event/invariantMass_pT_GlobalMuonKine_GlobalMatchesCuts_BB", "#mu^{+}#mu^{-} invariant mass, bottom-bottom", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); // Good MFT-MCH-MID tracks with re-scaled MFT kinematics and MFT acceptance cuts registryDimuon.add("dimuon/same-event/invariantMass_ScaledMftKine_GlobalMatchesCuts", "M_{#mu^{+}#mu^{-}} - rescaled MFT momentum", {HistType::kTH1F, {invMassAxis}}); registryDimuon.add("dimuon/same-event/invariantMassFull_ScaledMftKine_GlobalMatchesCuts", "M_{#mu^{+}#mu^{-}} - rescaled MFT momentum", {HistType::kTH1F, {invMassAxisFull}}); @@ -841,6 +873,17 @@ struct muonQa { registryDimuon.add("dimuon/mixed-event/invariantMass_ScaledMftKine_GlobalMatchesCuts_TB", "M_{#mu^{+}#mu^{-}} - rescaled MFT momentum, top-bottom", {HistType::kTH1F, {invMassAxis}}); registryDimuon.add("dimuon/mixed-event/invariantMass_ScaledMftKine_GlobalMatchesCuts_BT", "M_{#mu^{+}#mu^{-}} - rescaled MFT momentum, bottom-top", {HistType::kTH1F, {invMassAxis}}); registryDimuon.add("dimuon/mixed-event/invariantMass_ScaledMftKine_GlobalMatchesCuts_BB", "M_{#mu^{+}#mu^{-}} - rescaled MFT momentum, bottom-bottom", {HistType::kTH1F, {invMassAxis}}); + // -- Mass and pT + registryDimuon.add("dimuon/same-event/invariantMass_pT_ScaledMftKine_GlobalMatchesCuts", "M_{#mu^{+}#mu^{-}} - rescaled MFT momentum", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/same-event/invariantMass_pT_ScaledMftKine_GlobalMatchesCuts_TT", "M_{#mu^{+}#mu^{-}} - rescaled MFT momentum, top-top", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/same-event/invariantMass_pT_ScaledMftKine_GlobalMatchesCuts_TB", "M_{#mu^{+}#mu^{-}} - rescaled MFT momentum, top-bottom", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/same-event/invariantMass_pT_ScaledMftKine_GlobalMatchesCuts_BT", "M_{#mu^{+}#mu^{-}} - rescaled MFT momentum, bottom-top", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/same-event/invariantMass_pT_ScaledMftKine_GlobalMatchesCuts_BB", "M_{#mu^{+}#mu^{-}} - rescaled MFT momentum, bottom-bottom", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/mixed-event/invariantMass_pT_ScaledMftKine_GlobalMatchesCuts", "M_{#mu^{+}#mu^{-}} - rescaled MFT momentum", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/mixed-event/invariantMass_pT_ScaledMftKine_GlobalMatchesCuts_TT", "M_{#mu^{+}#mu^{-}} - rescaled MFT momentum, top-top", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/mixed-event/invariantMass_pT_ScaledMftKine_GlobalMatchesCuts_TB", "M_{#mu^{+}#mu^{-}} - rescaled MFT momentum, top-bottom", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/mixed-event/invariantMass_pT_ScaledMftKine_GlobalMatchesCuts_BT", "M_{#mu^{+}#mu^{-}} - rescaled MFT momentum, bottom-top", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/mixed-event/invariantMass_pT_ScaledMftKine_GlobalMatchesCuts_BB", "M_{#mu^{+}#mu^{-}} - rescaled MFT momentum, bottom-bottom", {HistType::kTH2F, {invMassAxis2D, pTAxis2D}}); // combinations with sub-leading matches registryDimuon.add("dimuon/same-event/invariantMass_GlobalMuonKine_GlobalMatchesCuts_leading_subleading", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH1F, {invMassAxis}}); registryDimuon.add("dimuon/same-event/invariantMassFull_GlobalMuonKine_GlobalMatchesCuts_leading_subleading", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH1F, {invMassAxisFull}}); @@ -881,9 +924,9 @@ struct muonQa { registryDimuon.add("dimuon/same-event/invariantMass_rapPair_MuonKine_MuonCuts_LR", "#mu^{+}#mu^{-} invariant mass, left-right or right-left", {HistType::kTH2F, {invMassAxis2D, yPairAxis}}); registryDimuon.add("dimuon/same-event/invariantMass_rapPair_MuonKine_MuonCuts_RR", "#mu^{+}#mu^{-} invariant mass, right-right", {HistType::kTH2F, {invMassAxis2D, yPairAxis}}); // -- pT and eta - registryDimuon.add("dimuon/same-event/pT_rapPair_MuonKine_MuonCuts_LL", "#mu^{+}#mu^{-} p_{T} and #eta, left-left", {HistType::kTH2F, {pTAxis2D, yPairAxis}}); - registryDimuon.add("dimuon/same-event/pT_rapPair_MuonKine_MuonCuts_LR", "#mu^{+}#mu^{-} p_{T} and #eta, left-right or right-left", {HistType::kTH2F, {pTAxis2D, yPairAxis}}); - registryDimuon.add("dimuon/same-event/pT_rapPair_MuonKine_MuonCuts_RR", "#mu^{+}#mu^{-} p_{T} and #eta, right-right", {HistType::kTH2F, {pTAxis2D, yPairAxis}}); + // registryDimuon.add("dimuon/same-event/pT_rapPair_MuonKine_MuonCuts_LL", "#mu^{+}#mu^{-} p_{T} and #eta, left-left", {HistType::kTH2F, {pTAxis2D, yPairAxis}}); + // registryDimuon.add("dimuon/same-event/pT_rapPair_MuonKine_MuonCuts_LR", "#mu^{+}#mu^{-} p_{T} and #eta, left-right or right-left", {HistType::kTH2F, {pTAxis2D, yPairAxis}}); + // registryDimuon.add("dimuon/same-event/pT_rapPair_MuonKine_MuonCuts_RR", "#mu^{+}#mu^{-} p_{T} and #eta, right-right", {HistType::kTH2F, {pTAxis2D, yPairAxis}}); } } @@ -1736,7 +1779,7 @@ struct muonQa { } if (IsGoodMuon(fgValuesMCH, fgValuesMCHpv, configMuons.fTrackChi2MchUp, configMuons.fPMchLow, configMuons.fPtMchLow, configMuons.fEtaMchLow, configMuons.fEtaMchUp, configMuons.fRabsLow, configMuons.fRabsUp, configMuons.fSigmaPdcaUp)) { registry.get(HIST("muons/TrackPhi"))->Fill(fgValuesMCH.phi * 180.0 / TMath::Pi()); - registry.get(HIST("muons/TrackDCA"))->Fill(std::sqrt(fgValuesMCH.dcaX * fgValuesMCH.dcaX + fgValuesMCH.dcaY * fgValuesMCH.dcaY)); + registry.get(HIST("muons/TrackDCA"))->Fill(std::sqrt(fgValuesMCHpv.dcaX * fgValuesMCHpv.dcaX + fgValuesMCHpv.dcaY * fgValuesMCHpv.dcaY)); } // muon origin for MCH top-bottom and left-right parts @@ -1838,7 +1881,7 @@ struct muonQa { } if (IsGoodMuon(fgValuesMCH, fgValuesMCHpv, configMuons.fTrackChi2MchUp, configMuons.fPMchLow, configMuons.fPtMchLow, configMFTs.fEtaMftLow, configMFTs.fEtaMftUp, configMuons.fRabsLow, configMuons.fRabsUp, configMuons.fSigmaPdcaUp)) { registry.get(HIST("global-muons/TrackPhi"))->Fill(fgValuesMCH.phi * 180.0 / TMath::Pi()); - registry.get(HIST("global-muons/TrackDCA"))->Fill(std::sqrt(fgValuesMCH.dcaX * fgValuesMCH.dcaX + fgValuesMCH.dcaY * fgValuesMCH.dcaY)); + registry.get(HIST("global-muons/TrackDCA"))->Fill(std::sqrt(fgValuesMCHpv.dcaX * fgValuesMCHpv.dcaX + fgValuesMCHpv.dcaY * fgValuesMCHpv.dcaY)); } } @@ -1877,7 +1920,7 @@ struct muonQa { if (IsGoodMuon(fgValuesMCH, fgValuesMCHpv, configMuons.fTrackChi2MchUp, configMuons.fPMchLow, configMuons.fPtMchLow, configMFTs.fEtaMftLow, configMFTs.fEtaMftUp, configMuons.fRabsLow, configMuons.fRabsUp, configMuons.fSigmaPdcaUp)) { if (IsGoodGlobalMatching(fgValuesMFT, configMFTs.fTrackChi2MftUp, configMFTs.fTrackNClustMftLow, fMatchingChi2MftMchUp)) { registry.get(HIST("global-matches/TrackPhi"))->Fill(fgValuesMCH.phi * 180.0 / TMath::Pi()); - registry.get(HIST("global-matches/TrackDCA"))->Fill(std::sqrt(fgValuesMCH.dcaX * fgValuesMCH.dcaX + fgValuesMCH.dcaY * fgValuesMCH.dcaY)); + registry.get(HIST("global-matches/TrackDCA"))->Fill(std::sqrt(fgValuesMCHpv.dcaX * fgValuesMCHpv.dcaX + fgValuesMCHpv.dcaY * fgValuesMCHpv.dcaY)); registry.get(HIST("global-matches/TrackP_glo"))->Fill(fgValuesGlobal.p); registry.get(HIST("global-matches/TrackPt_glo"))->Fill(fgValuesGlobal.pT); @@ -2507,7 +2550,7 @@ struct muonQa { FillMuonHistograms<0, 1, 0>(fgValuesMCH, fgValuesMCHpv, fgValuesMFT, fgValuesGlobal, fgValuesCandidates); } - //// Fill residual QA checks if requireds + //// Fill residual QA checks if required if (configQAs.fEnableQAResidual) { runResidual(collisions, muons, mfts, clusters, mchtrack, mchrealigned, mfttrack, fgValuesCollGlo, fgValuesMCH, fgValuesMCHpv, fgValuesMFT); } @@ -3105,14 +3148,32 @@ struct muonQa { // dimuon variables double mass = GetMuMuInvariantMass(fgValuesMuonPV1, fgValuesMuonPV2); double pT = GetMuMuPt(fgValuesMuonPV1, fgValuesMuonPV2); - double dcaXPair; - double dcaYPair; - if (configRealign.fDoRealign) { - dcaXPair = fgValuesMuon1.dcaX - fgValuesMuon2.dcaX; - dcaYPair = fgValuesMuon1.dcaY - fgValuesMuon2.dcaY; - } else { - dcaXPair = fgValuesMuonPV1.dcaX - fgValuesMuonPV2.dcaX; - dcaYPair = fgValuesMuonPV1.dcaY - fgValuesMuonPV2.dcaY; + double dcaXPair = 0.0; + double dcaYPair = 0.0; + if (TopBottom1 != TopBottom2) { // only mixed pairs + if (TopBottom1 == 0 && TopBottom2 == 1) { // muon1 = top, muon2 = bottom + if (configRealign.fDoRealign) { + dcaXPair = fgValuesMuon1.dcaX - fgValuesMuon2.dcaX; + dcaYPair = fgValuesMuon1.dcaY - fgValuesMuon2.dcaY; + } else { + dcaXPair = fgValuesMuonPV1.dcaX - fgValuesMuonPV2.dcaX; + dcaYPair = fgValuesMuonPV1.dcaY - fgValuesMuonPV2.dcaY; + } + } else if (TopBottom1 == 1 && TopBottom2 == 0) { // muon2 = top, muon1 = bottom + if (configRealign.fDoRealign) { + dcaXPair = fgValuesMuon2.dcaX - fgValuesMuon1.dcaX; + dcaYPair = fgValuesMuon2.dcaY - fgValuesMuon1.dcaY; + } else { + dcaXPair = fgValuesMuonPV2.dcaX - fgValuesMuonPV1.dcaX; + dcaYPair = fgValuesMuonPV2.dcaY - fgValuesMuonPV1.dcaY; + } + } else if (configRealign.fDoRealign) { // no redefinition necessary if both on same half + dcaXPair = fgValuesMuon1.dcaX - fgValuesMuon2.dcaX; + dcaYPair = fgValuesMuon1.dcaY - fgValuesMuon2.dcaY; + } else { + dcaXPair = fgValuesMuonPV1.dcaX - fgValuesMuonPV2.dcaX; + dcaYPair = fgValuesMuonPV1.dcaY - fgValuesMuonPV2.dcaY; + } } if (mass < fDimuonDCAMassLow || mass > fDimuonDCAMassHigh) continue; @@ -3126,7 +3187,8 @@ struct muonQa { registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_Mu1DCAx_minus_Mu2DCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_Mu1DCAy_minus_Mu2DCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); } - // dimuon top-bottom and left-right separation + // dimuon top-bottom separation + // TODO: left-right ? if (TopBottom1 == 0 && TopBottom2 == 0) { if (isPP) { registryDimuon.get(HIST("dimuon/same-event/same-sign-PP/DCA/pT_Mu1TDCAx_minus_Mu2TDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); @@ -3136,38 +3198,12 @@ struct muonQa { registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_Mu1TDCAy_minus_Mu2TDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); } } else if ((TopBottom1 == 0 && TopBottom2 == 1) || (TopBottom1 == 1 && TopBottom2 == 0)) { - if (TopBottom1 == 0 && TopBottom2 == 1) { - if (isPP) { - registryDimuon.get(HIST("dimuon/same-event/same-sign-PP/DCA/pT_Mu1TDCAx_minus_Mu2BDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); - registryDimuon.get(HIST("dimuon/same-event/same-sign-PP/DCA/pT_Mu1TDCAy_minus_Mu2BDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); - } else if (isMM) { - registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_Mu1TDCAx_minus_Mu2BDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); - registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_Mu1TDCAy_minus_Mu2BDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); - } else { - if (isPP) { - registryDimuon.get(HIST("dimuon/same-event/same-sign-PP/DCA/pT_Mu1BDCAx_minus_Mu2TDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); - registryDimuon.get(HIST("dimuon/same-event/same-sign-PP/DCA/pT_Mu1BDCAy_minus_Mu2TDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); - } else if (isMM) { - registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_Mu1BDCAx_minus_Mu2TDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); - registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_Mu1BDCAy_minus_Mu2TDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); - } - } - } else if (TopBottom1 == 1 && TopBottom2 == 0) { - if (isPP) { - registryDimuon.get(HIST("dimuon/same-event/same-sign-PP/DCA/pT_Mu1TDCAx_minus_Mu2BDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); - registryDimuon.get(HIST("dimuon/same-event/same-sign-PP/DCA/pT_Mu1TDCAy_minus_Mu2BDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); - } else if (isMM) { - registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_Mu1TDCAx_minus_Mu2BDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); - registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_Mu1TDCAy_minus_Mu2BDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); - } else { - if (isPP) { - registryDimuon.get(HIST("dimuon/same-event/same-sign-PP/DCA/pT_Mu1BDCAx_minus_Mu2TDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); - registryDimuon.get(HIST("dimuon/same-event/same-sign-PP/DCA/pT_Mu1BDCAy_minus_Mu2TDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); - } else if (isMM) { - registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_Mu1BDCAx_minus_Mu2TDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); - registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_Mu1BDCAy_minus_Mu2TDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); - } - } + if (isPP) { + registryDimuon.get(HIST("dimuon/same-event/same-sign-PP/DCA/pT_MuTDCAx_minus_MuBDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/same-sign-PP/DCA/pT_MuTDCAy_minus_MuBDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); + } else if (isMM) { + registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_MuTDCAx_minus_MuBDCAx_MuonKine_MuonCuts"))->Fill(pT, dcaXPair); + registryDimuon.get(HIST("dimuon/same-event/same-sign-MM/DCA/pT_MuTDCAy_minus_MuBDCAy_MuonKine_MuonCuts"))->Fill(pT, dcaYPair); } } else if (TopBottom1 == 1 && TopBottom2 == 1) { if (isPP) { @@ -3248,8 +3284,8 @@ struct muonQa { FillPropagation<0>(muonTrack2, collision2, fgValuesMCH2, fgValuesMuonPV2); // Propagate MFT tracks to PV - FillPropagation<0, 1>(mftTrack1, collision1, fgValuesMCH1, fgValuesMFTpv1); - FillPropagation<0, 1>(mftTrack2, collision2, fgValuesMCH2, fgValuesMFTpv2); + FillPropagation<0, 1>(mftTrack1, collision1, fgValuesMCHpv1, fgValuesMFTpv1); + FillPropagation<0, 1>(mftTrack2, collision2, fgValuesMCHpv2, fgValuesMFTpv2); int sign1 = mchTrack1.sign(); int sign2 = mchTrack2.sign(); @@ -3258,9 +3294,17 @@ struct muonQa { if ((sign1 * sign2) >= 0) continue; - // indexes indicating whether the positive and negative tracks come from the top or bottom halves of MFT - int posTopBottom = (sign1 > 0) ? ((muonTrack1.y() >= 0) ? 0 : 1) : ((muonTrack2.y() >= 0) ? 0 : 1); - int negTopBottom = (sign1 < 0) ? ((muonTrack1.y() >= 0) ? 0 : 1) : ((muonTrack2.y() >= 0) ? 0 : 1); + // OLD definition using MFT halves + // int posTopBottom = (sign1 > 0) ? ((muonTrack1.y() >= 0) ? 0 : 1) : ((muonTrack2.y() >= 0) ? 0 : 1); + // int negTopBottom = (sign1 < 0) ? ((muonTrack1.y() >= 0) ? 0 : 1) : ((muonTrack2.y() >= 0) ? 0 : 1); + + // NEW definition using MCH tracks, as is done for MUON (MCH-MID) tracks above + int Quadrant1 = GetQuadrantPhi(muonTrack1.phi() * 180.0 / TMath::Pi()); + int Quadrant2 = GetQuadrantPhi(muonTrack2.phi() * 180.0 / TMath::Pi()); + int TopBottom1 = (Quadrant1 == 0 || Quadrant1 == 1) ? 0 : 1; + int TopBottom2 = (Quadrant2 == 0 || Quadrant2 == 1) ? 0 : 1; + // int LeftRight1 = (Quadrant1 == 0 || Quadrant1 == 3) ? 0 : 1; + // int LeftRight2 = (Quadrant2 == 0 || Quadrant2 == 3) ? 0 : 1; bool goodGlobalMuonTracks = (IsGoodGlobalMuon(fgValuesMCH1, fgValuesMCHpv1) && IsGoodGlobalMuon(fgValuesMCH2, fgValuesMCHpv2)); bool goodGlobalMuonMatches = (IsGoodGlobalMatching(fgValuesMFT1) && IsGoodGlobalMatching(fgValuesMFT2)); @@ -3270,8 +3314,11 @@ struct muonQa { if (goodGlobalMuonTracks && goodGlobalMuonMatches) { double massMCH = GetMuMuInvariantMass(fgValuesMCHpv1, fgValuesMCHpv2); + double pTmch = GetMuMuPt(fgValuesMCHpv1, fgValuesMCHpv2); double mass = GetMuMuInvariantMass(fgValuesMuonPV1, fgValuesMuonPV2); + // double pT = GetMuMuPt(fgValuesMuonPV1, fgValuesMuonPV2); double massScaled = GetMuMuInvariantMass(fgValuesMFTpv1, fgValuesMFTpv2); + // double pTscaled = GetMuMuPt(fgValuesMFTpv1, fgValuesMFTpv2); if (sameEvent) { // same-event case @@ -3281,15 +3328,38 @@ struct muonQa { registryDimuon.get(HIST("dimuon/same-event/invariantMassFull_GlobalMuonKine_GlobalMatchesCuts"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMass_ScaledMftKine_GlobalMatchesCuts"))->Fill(massScaled); registryDimuon.get(HIST("dimuon/same-event/invariantMassFull_ScaledMftKine_GlobalMatchesCuts"))->Fill(massScaled); + registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_MuonKine_GlobalMatchesCuts"))->Fill(massMCH, pTmch); + registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_GlobalMuonKine_GlobalMatchesCuts"))->Fill(mass, pTmch); + registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_ScaledMftKine_GlobalMatchesCuts"))->Fill(massScaled, pTmch); - if (posTopBottom == 0 && negTopBottom == 0) { + if (TopBottom1 == 0 && TopBottom2 == 0) { + registryDimuon.get(HIST("dimuon/same-event/invariantMass_MuonKine_GlobalMatchesCuts_TT"))->Fill(massMCH); + registryDimuon.get(HIST("dimuon/same-event/invariantMass_GlobalMuonKine_GlobalMatchesCuts_TT"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMass_ScaledMftKine_GlobalMatchesCuts_TT"))->Fill(massScaled); - } else if (posTopBottom == 0 && negTopBottom == 1) { + registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_MuonKine_GlobalMatchesCuts_TT"))->Fill(massMCH, pTmch); + registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_GlobalMuonKine_GlobalMatchesCuts_TT"))->Fill(mass, pTmch); + registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_ScaledMftKine_GlobalMatchesCuts_TT"))->Fill(massScaled, pTmch); + } else if (TopBottom1 == 0 && TopBottom2 == 1) { + registryDimuon.get(HIST("dimuon/same-event/invariantMass_MuonKine_GlobalMatchesCuts_TB"))->Fill(massMCH); + registryDimuon.get(HIST("dimuon/same-event/invariantMass_GlobalMuonKine_GlobalMatchesCuts_TB"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMass_ScaledMftKine_GlobalMatchesCuts_TB"))->Fill(massScaled); - } else if (posTopBottom == 1 && negTopBottom == 0) { + registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_MuonKine_GlobalMatchesCuts_TB"))->Fill(massMCH, pTmch); + registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_GlobalMuonKine_GlobalMatchesCuts_TB"))->Fill(mass, pTmch); + registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_ScaledMftKine_GlobalMatchesCuts_TB"))->Fill(massScaled, pTmch); + } else if (TopBottom1 == 1 && TopBottom2 == 0) { + registryDimuon.get(HIST("dimuon/same-event/invariantMass_MuonKine_GlobalMatchesCuts_BT"))->Fill(massMCH); + registryDimuon.get(HIST("dimuon/same-event/invariantMass_GlobalMuonKine_GlobalMatchesCuts_BT"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMass_ScaledMftKine_GlobalMatchesCuts_BT"))->Fill(massScaled); - } else if (posTopBottom == 1 && negTopBottom == 1) { + registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_MuonKine_GlobalMatchesCuts_BT"))->Fill(massMCH, pTmch); + registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_GlobalMuonKine_GlobalMatchesCuts_BT"))->Fill(mass, pTmch); + registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_ScaledMftKine_GlobalMatchesCuts_BT"))->Fill(massScaled, pTmch); + } else if (TopBottom1 == 1 && TopBottom2 == 1) { + registryDimuon.get(HIST("dimuon/same-event/invariantMass_MuonKine_GlobalMatchesCuts_BB"))->Fill(massMCH); + registryDimuon.get(HIST("dimuon/same-event/invariantMass_GlobalMuonKine_GlobalMatchesCuts_BB"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMass_ScaledMftKine_GlobalMatchesCuts_BB"))->Fill(massScaled); + registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_MuonKine_GlobalMatchesCuts_BB"))->Fill(massMCH, pTmch); + registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_GlobalMuonKine_GlobalMatchesCuts_BB"))->Fill(mass, pTmch); + registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_ScaledMftKine_GlobalMatchesCuts_BB"))->Fill(massScaled, pTmch); } // mass correlation @@ -3303,15 +3373,38 @@ struct muonQa { registryDimuon.get(HIST("dimuon/mixed-event/invariantMassFull_GlobalMuonKine_GlobalMatchesCuts"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_ScaledMftKine_GlobalMatchesCuts"))->Fill(massScaled); registryDimuon.get(HIST("dimuon/mixed-event/invariantMassFull_ScaledMftKine_GlobalMatchesCuts"))->Fill(massScaled); + registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_MuonKine_GlobalMatchesCuts"))->Fill(massMCH, pTmch); + registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_GlobalMuonKine_GlobalMatchesCuts"))->Fill(mass, pTmch); + registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_ScaledMftKine_GlobalMatchesCuts"))->Fill(massScaled, pTmch); - if (posTopBottom == 0 && negTopBottom == 0) { + if (TopBottom1 == 0 && TopBottom2 == 0) { + registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_MuonKine_GlobalMatchesCuts_TT"))->Fill(massMCH); + registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_GlobalMuonKine_GlobalMatchesCuts_TT"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_ScaledMftKine_GlobalMatchesCuts_TT"))->Fill(massScaled); - } else if (posTopBottom == 0 && negTopBottom == 1) { + registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_MuonKine_GlobalMatchesCuts_TT"))->Fill(massMCH, pTmch); + registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_GlobalMuonKine_GlobalMatchesCuts_TT"))->Fill(mass, pTmch); + registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_ScaledMftKine_GlobalMatchesCuts_TT"))->Fill(massScaled, pTmch); + } else if (TopBottom1 == 0 && TopBottom2 == 1) { + registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_MuonKine_GlobalMatchesCuts_TB"))->Fill(massMCH); + registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_GlobalMuonKine_GlobalMatchesCuts_TB"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_ScaledMftKine_GlobalMatchesCuts_TB"))->Fill(massScaled); - } else if (posTopBottom == 1 && negTopBottom == 0) { + registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_MuonKine_GlobalMatchesCuts_TB"))->Fill(massMCH, pTmch); + registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_GlobalMuonKine_GlobalMatchesCuts_TB"))->Fill(mass, pTmch); + registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_ScaledMftKine_GlobalMatchesCuts_TB"))->Fill(massScaled, pTmch); + } else if (TopBottom1 == 1 && TopBottom2 == 0) { + registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_MuonKine_GlobalMatchesCuts_BT"))->Fill(massMCH); + registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_GlobalMuonKine_GlobalMatchesCuts_BT"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_ScaledMftKine_GlobalMatchesCuts_BT"))->Fill(massScaled); - } else if (posTopBottom == 1 && negTopBottom == 1) { + registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_MuonKine_GlobalMatchesCuts_BT"))->Fill(massMCH, pTmch); + registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_GlobalMuonKine_GlobalMatchesCuts_BT"))->Fill(mass, pTmch); + registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_ScaledMftKine_GlobalMatchesCuts_BT"))->Fill(massScaled, pTmch); + } else if (TopBottom1 == 1 && TopBottom2 == 1) { + registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_MuonKine_GlobalMatchesCuts_BB"))->Fill(massMCH); + registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_GlobalMuonKine_GlobalMatchesCuts_BB"))->Fill(mass); registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_ScaledMftKine_GlobalMatchesCuts_BB"))->Fill(massScaled); + registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_MuonKine_GlobalMatchesCuts_BB"))->Fill(massMCH, pTmch); + registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_GlobalMuonKine_GlobalMatchesCuts_BB"))->Fill(mass, pTmch); + registryDimuon.get(HIST("dimuon/mixed-event/invariantMass_pT_ScaledMftKine_GlobalMatchesCuts_BB"))->Fill(massScaled, pTmch); } } } From 80095e099885d84a8ec23c830a65ba3a64c3066e Mon Sep 17 00:00:00 2001 From: Lucia Anna Tarasovicova Date: Fri, 31 Oct 2025 11:33:11 +0100 Subject: [PATCH 970/986] [PWGLF] change in HStrangeCorrelation (#13617) Co-authored-by: Lucia Anna Tarasovicova --- PWGLF/DataModel/LFHStrangeCorrelationTables.h | 3 +- .../Strangeness/hStrangeCorrelationFilter.cxx | 9 +- .../Tasks/Strangeness/hStrangeCorrelation.cxx | 103 ++++++++++++++---- 3 files changed, 87 insertions(+), 28 deletions(-) diff --git a/PWGLF/DataModel/LFHStrangeCorrelationTables.h b/PWGLF/DataModel/LFHStrangeCorrelationTables.h index cbeedbdb66c..3d54170252a 100644 --- a/PWGLF/DataModel/LFHStrangeCorrelationTables.h +++ b/PWGLF/DataModel/LFHStrangeCorrelationTables.h @@ -60,8 +60,9 @@ DECLARE_SOA_INDEX_COLUMN(Collision, collision); //! DECLARE_SOA_COLUMN(MCPhysicalPrimary, mcPhysicalPrimary, bool); // true physical primary flag DECLARE_SOA_INDEX_COLUMN_FULL(Track, track, int, Tracks, "_Assoc"); //! DECLARE_SOA_COLUMN(MCOriginalPt, mcOriginalPt, float); // true generated pt +DECLARE_SOA_COLUMN(PDGCode, pdgCode, float); // pdg code of the MC particle } // namespace assocHadrons -DECLARE_SOA_TABLE(AssocHadrons, "AOD", "ASSOCHADRONS", o2::soa::Index<>, assocHadrons::CollisionId, assocHadrons::MCPhysicalPrimary, assocHadrons::TrackId, assocHadrons::MCOriginalPt); +DECLARE_SOA_TABLE(AssocHadrons, "AOD", "ASSOCHADRONS", o2::soa::Index<>, assocHadrons::CollisionId, assocHadrons::MCPhysicalPrimary, assocHadrons::TrackId, assocHadrons::MCOriginalPt, assocHadrons::PDGCode); /// _________________________________________ /// Table for storing assoc track PID namespace assocPID diff --git a/PWGLF/TableProducer/Strangeness/hStrangeCorrelationFilter.cxx b/PWGLF/TableProducer/Strangeness/hStrangeCorrelationFilter.cxx index d29696cc2a0..f61c99707c4 100644 --- a/PWGLF/TableProducer/Strangeness/hStrangeCorrelationFilter.cxx +++ b/PWGLF/TableProducer/Strangeness/hStrangeCorrelationFilter.cxx @@ -375,7 +375,7 @@ struct HStrangeCorrelationFilter { // do this only if information is available float nSigmaTPCTOF[8] = {-10, -10, -10, -10, -10, -10, -10, -10}; - if constexpr (requires { assoc.tofSignal(); }) { + if constexpr (requires { assoc.tofSignal(); } && !requires { assoc.mcParticle(); }) { if (assoc.tofSignal() > 0) { if (std::sqrt(assoc.tofNSigmaPi() * assoc.tofNSigmaPi() + assoc.tpcNSigmaPi() * assoc.tpcNSigmaPi()) > systCuts.assocPionNSigmaTPCFOF) return false; @@ -407,11 +407,13 @@ struct HStrangeCorrelationFilter { bool physicalPrimary = false; float origPt = -1; + float pdgCode = -9999; if constexpr (requires { assoc.mcParticle(); }) { if (assoc.has_mcParticle()) { auto mcParticle = assoc.mcParticle(); physicalPrimary = mcParticle.isPhysicalPrimary(); origPt = mcParticle.pt(); + pdgCode = mcParticle.pdgCode(); } } @@ -419,7 +421,8 @@ struct HStrangeCorrelationFilter { assoc.collisionId(), physicalPrimary, assoc.globalIndex(), - origPt); + origPt, + pdgCode); assocPID( nSigmaTPCTOF[0], nSigmaTPCTOF[1], @@ -582,7 +585,7 @@ struct HStrangeCorrelationFilter { } } - void processAssocPionsMC(soa::Join::iterator const& collision, soa::Filtered const& tracks, aod::BCsWithTimestamps const&) + void processAssocPionsMC(soa::Join::iterator const& collision, soa::Filtered const& tracks, aod::McParticles const&, aod::BCsWithTimestamps const&) { // Load parameters for sideband subtraction auto bc = collision.bc_as(); diff --git a/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx b/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx index 6adee0c193c..316f265d1d7 100644 --- a/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx +++ b/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx @@ -70,6 +70,7 @@ struct HStrangeCorrelation { // master analysis switches Configurable doPPAnalysis{"doPPAnalysis", true, "if in pp, set to true"}; + Configurable doFullCorrelationStudy{"doFullCorrelationStudy", true, "if true, do full correlation study by creating all THnSparse histograms for the correlation function"}; Configurable doCorrelationHadron{"doCorrelationHadron", false, "do Hadron correlation"}; Configurable doCorrelationK0Short{"doCorrelationK0Short", true, "do K0Short correlation"}; Configurable doCorrelationLambda{"doCorrelationLambda", false, "do Lambda correlation"}; @@ -1382,6 +1383,8 @@ struct HStrangeCorrelation { } if (doprocessSameEventHV0s || doprocessSameEventHCascades || doprocessSameEventHPions || doprocessSameEventHHadrons) { histos.add("hTriggerAllSelectedEtaVsPt", "hTriggerAllSelectedEtaVsPt", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult}); + histos.add("hPositiveTriggerPrimaryEtaVsPt", "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult}); + histos.add("hNegativeTriggerPrimaryEtaVsPt", "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult}); // QA and THn Histograms histos.add("hTriggerPtResolution", ";p_{T}^{reconstructed} (GeV/c); p_{T}^{generated} (GeV/c)", kTH2F, {axesConfigurations.axisPtQA, axesConfigurations.axisPtQA}); histos.add("hTriggerPrimaryEtaVsPt", "hTriggerPrimaryEtaVsPt", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult}); @@ -1417,14 +1420,15 @@ struct HStrangeCorrelation { bool hStrange = false; for (int i = 0; i < 9; i++) { if (TESTBIT(doCorrelation, i)) { - histos.add(fmt::format("h{}EtaVsPtVsPhi", kParticlenames[i]).c_str(), "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisPhi}); - histos.add(fmt::format("h3d{}Spectrum", kParticlenames[i]).c_str(), fmt::format("h3d{}Spectrum", kParticlenames[i]).c_str(), kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisMult, axesConfigurations.axisMassNSigma}); - histos.add(fmt::format("h3d{}SpectrumY", kParticlenames[i]).c_str(), fmt::format("h3d{}SpectrumY", kParticlenames[i]).c_str(), kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisMult, axesConfigurations.axisMassNSigma}); - histos.add(fmt::format("sameEvent/Signal/{}", kParticlenames[i]).c_str(), "", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim}); - if (doDeltaPhiStarCheck) { + if (doFullCorrelationStudy) + histos.add(fmt::format("sameEvent/Signal/{}", kParticlenames[i]).c_str(), "", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim}); + if (doDeltaPhiStarCheck && doFullCorrelationStudy) { histos.add(fmt::format("sameEvent/Signal/{}DeltaPhiStar", kParticlenames[i]).c_str(), "", kTH3F, {{100, -0.3, 0.3}, {50, -0.05, 0.05}, {2, -1, 1}}); // -1 oposite charge, 1 same charge } if (i < 7) { + histos.add(fmt::format("h{}EtaVsPtVsPhi", kParticlenames[i]).c_str(), "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisPhi}); + histos.add(fmt::format("h3d{}Spectrum", kParticlenames[i]).c_str(), fmt::format("h3d{}Spectrum", kParticlenames[i]).c_str(), kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisMult, axesConfigurations.axisMassNSigma}); + histos.add(fmt::format("h3d{}SpectrumY", kParticlenames[i]).c_str(), fmt::format("h3d{}SpectrumY", kParticlenames[i]).c_str(), kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisMult, axesConfigurations.axisMassNSigma}); hStrange = true; histos.add(fmt::format("h{}EtaVsPtVsPhiBg", kParticlenames[i]).c_str(), "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisPhi}); if (doITSClustersQA) { @@ -1436,7 +1440,12 @@ struct HStrangeCorrelation { } } } - + if (TESTBIT(doCorrelation, 7)) { + histos.add("hPionEtaVsPtAllSelected", "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult}); + histos.add("hPionEtaVsPt", "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult}); + histos.add("hPositivePionEtaVsPt", "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult}); + histos.add("hNegativePionEtaVsPt", "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult}); + } if (TESTBIT(doCorrelation, 8)) { histos.add("hAsssocTrackEtaVsPtVsPhi", "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisPhi}); histos.add("hAssocPrimaryEtaVsPt", "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult}); @@ -1444,30 +1453,36 @@ struct HStrangeCorrelation { histos.add("hAssocPtResolution", ";p_{T}^{reconstructed} (GeV/c); p_{T}^{generated} (GeV/c)", kTH2F, {axesConfigurations.axisPtQA, axesConfigurations.axisPtQA}); } - if (hStrange) { + if (hStrange && doFullCorrelationStudy) { histos.addClone("sameEvent/Signal/", "sameEvent/LeftBg/"); histos.addClone("sameEvent/Signal/", "sameEvent/RightBg/"); } LOGF(info, "Init THnFs done"); // mixed-event correlation functions - if (doprocessMixedEventHV0s || doprocessMixedEventHCascades || doprocessMixedEventHPions || doprocessMixedEventHHadrons) { + if ((doprocessMixedEventHV0s || doprocessMixedEventHCascades || doprocessMixedEventHPions || doprocessMixedEventHHadrons) && doFullCorrelationStudy) { histos.addClone("sameEvent/", "mixedEvent/"); } - if (doprocessSameEventHHadrons) + if (doprocessSameEventHHadrons && doFullCorrelationStudy) histos.add("sameEvent/TriggerParticlesHadron", "TriggersHadron", kTH2F, {axesConfigurations.axisPtQA, axesConfigurations.axisMult}); - if (doprocessSameEventHV0s) + if (doprocessSameEventHV0s && doFullCorrelationStudy) histos.add("sameEvent/TriggerParticlesV0", "TriggersV0", kTH2F, {axesConfigurations.axisPtQA, axesConfigurations.axisMult}); - if (doprocessSameEventHCascades) + if (doprocessSameEventHCascades && doFullCorrelationStudy) histos.add("sameEvent/TriggerParticlesCascade", "TriggersCascade", kTH2F, {axesConfigurations.axisPtQA, axesConfigurations.axisMult}); - if (doprocessSameEventHPions) + if (doprocessSameEventHPions && doFullCorrelationStudy) histos.add("sameEvent/TriggerParticlesPion", "TriggersPion", kTH2F, {axesConfigurations.axisPtQA, axesConfigurations.axisMult}); // MC generated plots if (doprocessMCGenerated) { histos.add("Generated/hTrigger", "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult}); + histos.add("Generated/hPositiveTrigger", "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult}); + histos.add("Generated/hNegativeTrigger", "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult}); for (int i = 0; i < 9; i++) { histos.add(fmt::format("Generated/h{}", kParticlenames[i]).c_str(), "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult}); + if (i == 7) { + histos.add(fmt::format("Generated/hPositive{}", kParticlenames[i]).c_str(), "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult}); + histos.add(fmt::format("Generated/hNegative{}", kParticlenames[i]).c_str(), "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult}); + } } histos.addClone("Generated/", "GeneratedWithPV/"); @@ -1757,7 +1772,8 @@ struct HStrangeCorrelation { // ________________________________________________ // Do hadron - hadron correlations - fillCorrelationsHadron(triggerTracks, assocHadrons, false, collision.posZ(), collision.centFT0M(), bField); + if (doFullCorrelationStudy) + fillCorrelationsHadron(triggerTracks, assocHadrons, false, collision.posZ(), collision.centFT0M(), bField); } void processSameEventHV0s(soa::Join::iterator const& collision, @@ -1857,7 +1873,8 @@ struct HStrangeCorrelation { // ________________________________________________ // Do hadron - V0 correlations - fillCorrelationsV0(triggerTracks, associatedV0s, false, collision.posX(), collision.posY(), collision.posZ(), cent, bField); + if (doFullCorrelationStudy) + fillCorrelationsV0(triggerTracks, associatedV0s, false, collision.posX(), collision.posY(), collision.posZ(), cent, bField); } void processSameEventHCascades(soa::Join::iterator const& collision, @@ -1957,12 +1974,17 @@ struct HStrangeCorrelation { if (doTriggPhysicalPrimary && !triggerTrack.mcPhysicalPrimary()) continue; histos.fill(HIST("hTriggerPrimaryEtaVsPt"), track.pt(), track.eta(), cent); + if (track.sign() > 0) + histos.fill(HIST("hPositiveTriggerPrimaryEtaVsPt"), track.pt(), track.eta(), cent); + else + histos.fill(HIST("hNegativeTriggerPrimaryEtaVsPt"), track.pt(), track.eta(), cent); histos.fill(HIST("hTrackEtaVsPtVsPhi"), track.pt(), track.eta(), track.phi()); } // ________________________________________________ // Do hadron - cascade correlations - fillCorrelationsCascade(triggerTracks, associatedCascades, false, collision.posX(), collision.posY(), collision.posZ(), cent, bField); + if (doFullCorrelationStudy) + fillCorrelationsCascade(triggerTracks, associatedCascades, false, collision.posX(), collision.posY(), collision.posZ(), cent, bField); } void processSameEventHPions(soa::Join::iterator const& collision, soa::Join const& associatedPions, soa::Join const& triggerTracks, @@ -1994,7 +2016,19 @@ struct HStrangeCorrelation { // Do basic QA for (auto const& pion : associatedPions) { auto pionTrack = pion.track_as(); - histos.fill(HIST("hPionEtaVsPtVsPhi"), pionTrack.pt(), pionTrack.eta(), pionTrack.phi()); + if (!isValidAssocHadron(pionTrack)) + continue; + + histos.fill(HIST("hPionEtaVsPtAllSelected"), pionTrack.pt(), pionTrack.eta(), collision.centFT0M()); + if (doAssocPhysicalPrimary && !pion.mcPhysicalPrimary()) + continue; + if (doMCassociation && std::abs(pion.pdgCode()) != 211) + continue; + histos.fill(HIST("hPionEtaVsPt"), pionTrack.pt(), pionTrack.eta(), collision.centFT0M()); + if (pionTrack.sign() > 0) + histos.fill(HIST("hPositivePionEtaVsPt"), pionTrack.pt(), pionTrack.eta(), collision.centFT0M()); + else + histos.fill(HIST("hNegativePionEtaVsPt"), pionTrack.pt(), pionTrack.eta(), collision.centFT0M()); } if (!doprocessSameEventHCascades && !doprocessSameEventHV0s) { for (auto const& triggerTrack : triggerTracks) { @@ -2012,7 +2046,8 @@ struct HStrangeCorrelation { // ________________________________________________ // Do hadron - Pion correlations - fillCorrelationsHadron(triggerTracks, associatedPions, false, collision.posZ(), collision.centFT0M(), bField); + if (doFullCorrelationStudy) + fillCorrelationsHadron(triggerTracks, associatedPions, false, collision.posZ(), collision.centFT0M(), bField); } void processMixedEventHHadrons(soa::Join const& collisions, @@ -2055,7 +2090,8 @@ struct HStrangeCorrelation { auto slicedAssocHadrons = assocHadrons.sliceBy(collisionSliceHadrons, collision2.globalIndex()); // ________________________________________________ // Do hadron - hadron correlations - fillCorrelationsHadron(slicedTriggerTracks, slicedAssocHadrons, true, collision1.posZ(), collision1.centFT0M(), bField); + if (doFullCorrelationStudy) + fillCorrelationsHadron(slicedTriggerTracks, slicedAssocHadrons, true, collision1.posZ(), collision1.centFT0M(), bField); } } @@ -2104,7 +2140,8 @@ struct HStrangeCorrelation { auto slicedAssocV0s = associatedV0s.sliceBy(collisionSliceV0s, collision2.globalIndex()); // ________________________________________________ // Do hadron - V0 correlations - fillCorrelationsV0(slicedTriggerTracks, slicedAssocV0s, true, collision1.posX(), collision1.posY(), collision1.posZ(), cent1, bField); + if (doFullCorrelationStudy) + fillCorrelationsV0(slicedTriggerTracks, slicedAssocV0s, true, collision1.posX(), collision1.posY(), collision1.posZ(), cent1, bField); } } void processMixedEventHCascades(soa::Join const& collisions, @@ -2151,7 +2188,8 @@ struct HStrangeCorrelation { auto slicedAssocCascades = associatedCascades.sliceBy(collisionSliceCascades, collision2.globalIndex()); // ________________________________________________ // Do hadron - cascade correlations - fillCorrelationsCascade(slicedTriggerTracks, slicedAssocCascades, true, collision1.posX(), collision1.posY(), collision1.posZ(), cent1, bField); + if (doFullCorrelationStudy) + fillCorrelationsCascade(slicedTriggerTracks, slicedAssocCascades, true, collision1.posX(), collision1.posY(), collision1.posZ(), cent1, bField); } } void processMixedEventHPions(soa::Join const& collisions, @@ -2194,7 +2232,8 @@ struct HStrangeCorrelation { auto slicedAssocPions = assocPions.sliceBy(collisionSliceHadrons, collision2.globalIndex()); // ________________________________________________ // Do hadron - cascade correlations - fillCorrelationsHadron(slicedTriggerTracks, slicedAssocPions, true, collision1.posZ(), collision1.centFT0M(), bField); + if (doFullCorrelationStudy) + fillCorrelationsHadron(slicedTriggerTracks, slicedAssocPions, true, collision1.posZ(), collision1.centFT0M(), bField); } } @@ -2227,8 +2266,13 @@ struct HStrangeCorrelation { static_for<0, 7>([&](auto i) { constexpr int Index = i.value; if (i == 0 || i == 7) { - if (std::abs(mcParticle.pdgCode()) == kPdgCodes[i]) + if (std::abs(mcParticle.pdgCode()) == kPdgCodes[i]) { histos.fill(HIST("Generated/h") + HIST(kParticlenames[Index]), mcParticle.pt(), mcParticle.eta(), 1); + if (i == 7 && mcParticle.pdgCode() > 0) + histos.fill(HIST("Generated/hPositive") + HIST(kParticlenames[Index]), mcParticle.pt(), mcParticle.eta(), 1); + else if (i == 7 && mcParticle.pdgCode() < 0) + histos.fill(HIST("Generated/hNegative") + HIST(kParticlenames[Index]), mcParticle.pt(), mcParticle.eta(), 1); + } } else { if (mcParticle.pdgCode() == kPdgCodes[i]) histos.fill(HIST("Generated/h") + HIST(kParticlenames[Index]), mcParticle.pt(), mcParticle.eta(), 1); @@ -2267,8 +2311,9 @@ struct HStrangeCorrelation { static_for<0, 7>([&](auto i) { constexpr int Index = i.value; if (i == 0 || i == 7) { - if (std::abs(mcParticle.pdgCode()) == kPdgCodes[i]) + if (std::abs(mcParticle.pdgCode()) == kPdgCodes[i]) { histos.fill(HIST("GeneratedWithPV/h") + HIST(kParticlenames[Index]) + HIST("_MidYVsMult_TwoPVsOrMore"), mcParticle.pt(), bestCollisionFT0Mpercentile); + } } else { if (mcParticle.pdgCode() == kPdgCodes[i]) histos.fill(HIST("GeneratedWithPV/h") + HIST(kParticlenames[Index]) + HIST("_MidYVsMult_TwoPVsOrMore"), mcParticle.pt(), bestCollisionFT0Mpercentile); @@ -2320,8 +2365,14 @@ struct HStrangeCorrelation { } double geta = mcParticle.eta(); double gpt = mcParticle.pt(); - if (std::abs(mcParticle.pdgCode()) == PDG_t::kPiPlus || std::abs(mcParticle.pdgCode()) == PDG_t::kKPlus || std::abs(mcParticle.pdgCode()) == PDG_t::kProton || std::abs(mcParticle.pdgCode()) == PDG_t::kElectron || std::abs(mcParticle.pdgCode()) == PDG_t::kMuonMinus) + if (std::abs(mcParticle.pdgCode()) == PDG_t::kPiPlus || std::abs(mcParticle.pdgCode()) == PDG_t::kKPlus || std::abs(mcParticle.pdgCode()) == PDG_t::kProton || std::abs(mcParticle.pdgCode()) == PDG_t::kElectron || std::abs(mcParticle.pdgCode()) == PDG_t::kMuonMinus) { histos.fill(HIST("GeneratedWithPV/hTrigger"), gpt, geta, bestCollisionFT0Mpercentile); + if (mcParticle.pdgCode() > 0) + histos.fill(HIST("GeneratedWithPV/hPositiveTrigger"), gpt, geta, bestCollisionFT0Mpercentile); + else + histos.fill(HIST("GeneratedWithPV/hNegativeTrigger"), gpt, geta, bestCollisionFT0Mpercentile); + } + if (mcParticle.pdgCode() == PDG_t::kLambda0 && !doAssocPhysicalPrimaryInGen && !mcParticle.isPhysicalPrimary()) { if (std::abs(geta) > etaSel) { continue; @@ -2370,6 +2421,10 @@ struct HStrangeCorrelation { histos.fill(HIST("GeneratedWithPV/h") + HIST(kParticlenames[Index]), gpt, geta, bestCollisionFT0Mpercentile); if (std::abs(mcParticle.y()) < ySel) histos.fill(HIST("GeneratedWithPV/h") + HIST(kParticlenames[Index]) + HIST("_MidYVsMult"), gpt, bestCollisionFT0Mpercentile); + if (i == 7 && mcParticle.pdgCode() > 0) + histos.fill(HIST("GeneratedWithPV/hPositive") + HIST(kParticlenames[Index]), mcParticle.pt(), mcParticle.eta(), bestCollisionFT0Mpercentile); + else if (i == 7 && mcParticle.pdgCode() < 0) + histos.fill(HIST("GeneratedWithPV/hNegative") + HIST(kParticlenames[Index]), mcParticle.pt(), mcParticle.eta(), bestCollisionFT0Mpercentile); } } else { From f390c5cf8e2af35d88b9df1da4de2c7833d339b9 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Fri, 31 Oct 2025 20:20:10 +0800 Subject: [PATCH 971/986] [Common] TPC interface: skipTPCOnly auto mode, fix Run 2 bug (#13604) Co-authored-by: David Dobrigkeit Chinellato --- Common/Tools/PID/pidTPCModule.h | 123 ++++++++++++++++++++++++++------ 1 file changed, 103 insertions(+), 20 deletions(-) diff --git a/Common/Tools/PID/pidTPCModule.h b/Common/Tools/PID/pidTPCModule.h index 690e87b079c..3ef5ab8b8e6 100644 --- a/Common/Tools/PID/pidTPCModule.h +++ b/Common/Tools/PID/pidTPCModule.h @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -91,7 +92,8 @@ struct pidTPCConfigurables : o2::framework::ConfigurableGroup { // Parameters for loading network from a file / downloading the file o2::framework::Configurable useNetworkCorrection{"useNetworkCorrection", 0, "(bool) Wether or not to use the network correction for the TPC dE/dx signal"}; o2::framework::Configurable autofetchNetworks{"autofetchNetworks", 1, "(bool) Automatically fetches networks from CCDB for the correct run number"}; - o2::framework::Configurable skipTPCOnly{"skipTPCOnly", false, "Flag to skip TPC only tracks (faster but affects the analyses that use TPC only tracks)"}; + o2::framework::Configurable skipTPCOnly{"skipTPCOnly", -1, "Flag to skip TPC only tracks (faster but affects the analyses that use TPC only tracks). 0: do not skip, 1: skip, -1: check if needed by specific tasks"}; + o2::framework::Configurable> devicesRequiringTPCOnlyPID{"devicesRequiringTPCOnlyPID", std::vector{"photon-conversion-builder"}, "List of device names of tasks requiring TPC-only tracks to have TPC PID calculated"}; o2::framework::Configurable networkPathLocally{"networkPathLocally", "network.onnx", "(std::string) Path to the local .onnx file. If autofetching is enabled, then this is where the files will be downloaded"}; o2::framework::Configurable networkPathCCDB{"networkPathCCDB", "Analysis/PID/TPC/ML", "Path on CCDB"}; o2::framework::Configurable enableNetworkOptimizations{"enableNetworkOptimizations", 1, "(bool) If the neural network correction is used, this enables GraphOptimizationLevel::ORT_ENABLE_EXTENDED in the ONNX session"}; @@ -244,6 +246,59 @@ class pidTPCModule LOGF(info, "***************************************************"); } + if (pidTPCopts.skipTPCOnly.value == -1) { + LOGF(info, "***************************************************"); + LOGF(info, " the skipTPConly flag has a value of -1! "); + LOGF(info, " ---> autodetecting TPC-only track necessity now "); + LOGF(info, "***************************************************"); + // print list of devices that are being checked for + for (std::size_t devIdx{0}; devIdx < pidTPCopts.devicesRequiringTPCOnlyPID->size(); devIdx++) { + LOGF(info, "Will search for #%i device requiring TPC PID for TPC only: %s", devIdx, pidTPCopts.devicesRequiringTPCOnlyPID->at(devIdx)); + } + LOGF(info, "***************************************************"); + + // assume that TPC tracks are not needed, but check if tasks + // requiring them are present in the chain + pidTPCopts.skipTPCOnly.value = 1; + + // loop over devices in this execution + auto& workflows = context.services().template get(); + for (o2::framework::DeviceSpec const& device : workflows.devices) { + // Look for propagation service + if (device.name.compare("propagation-service") == 0) { + LOGF(info, " ---> propagation service detected, checking if photons enabled..."); + for (auto const& option : device.options) { + // check for photon generation enabled or not + if (option.name.compare("v0BuilderOpts.generatePhotonCandidates") == 0) { + if (option.defaultValue.get()) { + LOGF(info, " ---> propagation service: photons enabled, will calculate TPC PID for TPC only tracks."); + pidTPCopts.skipTPCOnly.value = 0; + } else { + LOGF(info, " ---> propagation service: photons disabled, TPC PID not required for TPC-only tracks"); + } + } + } + } + + // Check 2: specific tasks that require TPC PID based on configurable + for (std::size_t devIdx{0}; devIdx < pidTPCopts.devicesRequiringTPCOnlyPID->size(); devIdx++) { + if (device.name.compare(pidTPCopts.devicesRequiringTPCOnlyPID->at(devIdx)) == 0) { + LOGF(info, " ---> %s detected! ", pidTPCopts.devicesRequiringTPCOnlyPID->at(devIdx)); + LOGF(info, " ---> enabling TPC only track TPC PID calculations now."); + pidTPCopts.skipTPCOnly.value = 0; + } + } + } + + if (pidTPCopts.skipTPCOnly.value == 1) { + LOGF(info, "***************************************************"); + LOGF(info, "No need for TPC only information detected. Will not generate Nsigma for TPC only tracks"); + LOGF(info, "If this is unexpected behaviour and a necessity was not identified, please add the"); + LOGF(info, "corresponding task to the list 'devicesRequiringTPCOnlyPID' in pidTPCModule::Init()"); + } + LOGF(info, "***************************************************"); + } + // initialize PID response response = new o2::pid::tpc::Response(); @@ -330,12 +385,16 @@ class pidTPCModule LOG(info) << "Successfully retrieved TPC PID object from CCDB for timestamp " << time << ", period " << headers["LPMProductionTag"] << ", recoPass " << headers["RecoPassName"]; metadata["RecoPassName"] = headers["RecoPassName"]; // Force pass number for NN request to match retrieved BB o2::parameters::GRPLHCIFData* grpo = ccdb->template getForTimeStamp(pidTPCopts.cfgPathGrpLhcIf.value, time); - LOG(info) << " collision type::" << CollisionSystemType::getCollisionTypeFromGrp(grpo); - collsys = CollisionSystemType::getCollisionTypeFromGrp(grpo); - if (collsys == CollisionSystemType::kCollSyspp) { - irSource = std::string("T0VTX"); + if (grpo) { + LOG(info) << " collision type::" << CollisionSystemType::getCollisionTypeFromGrp(grpo); + collsys = CollisionSystemType::getCollisionTypeFromGrp(grpo); + if (collsys == CollisionSystemType::kCollSyspp) { + irSource = std::string("T0VTX"); + } else { + irSource = std::string("ZNC hadronic"); + } } else { - irSource = std::string("ZNC hadronic"); + LOGF(info, "No grpo object found. irSource will remain undefined."); } response->PrintAll(); } @@ -412,12 +471,16 @@ class pidTPCModule LOG(info) << "Successfully retrieved TPC PID object from CCDB for timestamp " << bc.timestamp() << ", period " << headers["LPMProductionTag"] << ", recoPass " << headers["RecoPassName"]; metadata["RecoPassName"] = headers["RecoPassName"]; // Force pass number for NN request to match retrieved BB o2::parameters::GRPLHCIFData* grpo = ccdb->template getForTimeStamp(pidTPCopts.cfgPathGrpLhcIf.value, bc.timestamp()); - LOG(info) << "Collision type::" << CollisionSystemType::getCollisionTypeFromGrp(grpo); - collsys = CollisionSystemType::getCollisionTypeFromGrp(grpo); - if (collsys == CollisionSystemType::kCollSyspp) { - irSource = std::string("T0VTX"); + if (grpo) { + LOG(info) << "Collision type::" << CollisionSystemType::getCollisionTypeFromGrp(grpo); + collsys = CollisionSystemType::getCollisionTypeFromGrp(grpo); + if (collsys == CollisionSystemType::kCollSyspp) { + irSource = std::string("T0VTX"); + } else { + irSource = std::string("ZNC hadronic"); + } } else { - irSource = std::string("ZNC hadronic"); + LOGF(info, "No grpo object found. irSource will remain undefined."); } response->PrintAll(); } @@ -458,11 +521,19 @@ class pidTPCModule size_t i = 0; for (const auto& collision : collisions) { const auto& bc = collision.template bc_as(); - hadronicRateForCollision[i] = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), irSource) * 1.e-3; + if (irSource.compare("") != 0) { + hadronicRateForCollision[i] = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), irSource) * 1.e-3; + } else { + hadronicRateForCollision[i] = 0.0f; + } i++; } auto bc = bcs.begin(); - hadronicRateBegin = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), irSource) * 1.e-3; // kHz + if (irSource.compare("") != 0) { + hadronicRateBegin = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), irSource) * 1.e-3; // kHz + } else { + hadronicRateBegin = 0.0f; + } // Filling a std::vector to be evaluated by the network // Evaluation on single tracks brings huge overhead: Thus evaluation is done on one large vector @@ -685,11 +756,19 @@ class pidTPCModule size_t i = 0; for (const auto& collision : cols) { const auto& bc = collision.template bc_as(); - hadronicRateForCollision[i] = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), irSource) * 1.e-3; + if (irSource.compare("") != 0) { + hadronicRateForCollision[i] = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), irSource) * 1.e-3; + } else { + hadronicRateForCollision[i] = 0.0f; + } i++; } auto bc = bcs.begin(); - hadronicRateBegin = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), irSource) * 1.e-3; // kHz + if (irSource.compare("") != 0) { + hadronicRateBegin = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), irSource) * 1.e-3; // kHz + } else { + hadronicRateBegin = 0.0f; + } } for (auto const& trk : tracks) { @@ -797,12 +876,16 @@ class pidTPCModule } LOG(info) << "Successfully retrieved TPC PID object from CCDB for timestamp " << bc.timestamp() << ", period " << headers["LPMProductionTag"] << ", recoPass " << headers["RecoPassName"]; o2::parameters::GRPLHCIFData* grpo = ccdb->template getForTimeStamp(pidTPCopts.cfgPathGrpLhcIf.value, bc.timestamp()); - LOG(info) << "Collisions type::" << CollisionSystemType::getCollisionTypeFromGrp(grpo); - collsys = CollisionSystemType::getCollisionTypeFromGrp(grpo); - if (collsys == CollisionSystemType::kCollSyspp) { - irSource = std::string("T0VTX"); + if (grpo) { + LOG(info) << "Collisions type::" << CollisionSystemType::getCollisionTypeFromGrp(grpo); + collsys = CollisionSystemType::getCollisionTypeFromGrp(grpo); + if (collsys == CollisionSystemType::kCollSyspp) { + irSource = std::string("T0VTX"); + } else { + irSource = std::string("ZNC hadronic"); + } } else { - irSource = std::string("ZNC hadronic"); + LOGF(info, "No grpo object found. irSource will remain undefined."); } response->PrintAll(); } From 991f617b72eefe0d0a6a8f9c7662fc7e7b4e4e68 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 31 Oct 2025 13:36:13 +0100 Subject: [PATCH 972/986] [PWGEM/PhotonMeson] speed up pairing in DiphotonHadronMPC.h (#13614) --- PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h | 56 ++++++++++++---------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h index e189042abca..8d08a1b6c0c 100644 --- a/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h +++ b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h @@ -321,10 +321,12 @@ struct DiphotonHadronMPC { delete emh_ref; emh_ref = 0x0; - used_photonIds.clear(); - used_photonIds.shrink_to_fit(); - used_dileptonIds.clear(); - used_dileptonIds.shrink_to_fit(); + used_photonIds_per_col.clear(); + used_photonIds_per_col.shrink_to_fit(); + used_dileptonIds_per_col.clear(); + used_dileptonIds_per_col.shrink_to_fit(); + used_diphotonIds_per_col.clear(); + used_diphotonIds_per_col.shrink_to_fit(); map_mixed_eventId_to_globalBC.clear(); } @@ -482,9 +484,9 @@ struct DiphotonHadronMPC { MyEMH_track* emh_diphoton = nullptr; MyEMH_track* emh_ref = nullptr; - std::vector> used_photonIds; // - std::vector> used_dileptonIds; // - std::vector> used_diphotonIds; // + std::vector used_photonIds_per_col; // + std::vector> used_dileptonIds_per_col; // + std::vector> used_diphotonIds_per_col; // std::map, uint64_t> map_mixed_eventId_to_globalBC; template @@ -599,22 +601,20 @@ struct DiphotonHadronMPC { } // end of ref track loop if (npair > 0) { - std::tuple tuple_tmp_diphoton = std::make_tuple(ndf, g1.globalIndex(), g2.globalIndex(), -1); - if (std::find(used_diphotonIds.begin(), used_diphotonIds.end(), tuple_tmp_diphoton) == used_diphotonIds.end()) { + std::tuple tuple_tmp_diphoton = std::make_tuple(g1.globalIndex(), g2.globalIndex(), -1); + if (std::find(used_diphotonIds_per_col.begin(), used_diphotonIds_per_col.end(), tuple_tmp_diphoton) == used_diphotonIds_per_col.end()) { emh_diphoton->AddTrackToEventPool(key_df_collision, EMTrack(ndf, -1, collision.globalIndex(), -1, v12.Pt(), v12.Eta(), v12.Phi(), v12.M())); - used_diphotonIds.emplace_back(tuple_tmp_diphoton); + used_diphotonIds_per_col.emplace_back(tuple_tmp_diphoton); } } - std::pair pair_tmp_id1 = std::make_pair(ndf, g1.globalIndex()); - std::pair pair_tmp_id2 = std::make_pair(ndf, g2.globalIndex()); - if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id1) == used_photonIds.end()) { + if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g1.globalIndex()) == used_photonIds_per_col.end()) { emh1->AddTrackToEventPool(key_df_collision, EMTrack(ndf, g1.globalIndex(), collision.globalIndex(), g1.globalIndex(), g1.pt(), g1.eta(), g1.phi(), 0)); - used_photonIds.emplace_back(pair_tmp_id1); + used_photonIds_per_col.emplace_back(g1.globalIndex()); } - if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id2) == used_photonIds.end()) { + if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g2.globalIndex()) == used_photonIds_per_col.end()) { emh1->AddTrackToEventPool(key_df_collision, EMTrack(ndf, g2.globalIndex(), collision.globalIndex(), g2.globalIndex(), g2.pt(), g2.eta(), g2.phi(), 0)); - used_photonIds.emplace_back(pair_tmp_id2); + used_photonIds_per_col.emplace_back(g2.globalIndex()); } ndiphoton++; } // end of pairing loop @@ -677,28 +677,34 @@ struct DiphotonHadronMPC { } // end of ref track loop if (npair > 0) { - std::tuple tuple_tmp_diphoton = std::make_tuple(ndf, g1.globalIndex(), pos2.trackId(), ele2.trackId()); - if (std::find(used_diphotonIds.begin(), used_diphotonIds.end(), tuple_tmp_diphoton) == used_diphotonIds.end()) { + std::tuple tuple_tmp_diphoton = std::make_tuple(g1.globalIndex(), pos2.trackId(), ele2.trackId()); + if (std::find(used_diphotonIds_per_col.begin(), used_diphotonIds_per_col.end(), tuple_tmp_diphoton) == used_diphotonIds_per_col.end()) { emh_diphoton->AddTrackToEventPool(key_df_collision, EMTrack(ndf, -1, collision.globalIndex(), -1, veeg.Pt(), veeg.Eta(), veeg.Phi(), veeg.M())); - used_diphotonIds.emplace_back(tuple_tmp_diphoton); + used_diphotonIds_per_col.emplace_back(tuple_tmp_diphoton); } } - std::pair pair_tmp_id1 = std::make_pair(ndf, g1.globalIndex()); - std::tuple tuple_tmp_id2 = std::make_tuple(ndf, collision.globalIndex(), pos2.trackId(), ele2.trackId()); - if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id1) == used_photonIds.end()) { + std::pair tuple_tmp_id2 = std::make_pair(pos2.trackId(), ele2.trackId()); + if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g1.globalIndex()) == used_photonIds_per_col.end()) { emh1->AddTrackToEventPool(key_df_collision, EMTrack(ndf, g1.globalIndex(), collision.globalIndex(), -1, g1.pt(), g1.eta(), g1.phi(), 0)); - used_photonIds.emplace_back(pair_tmp_id1); + used_photonIds_per_col.emplace_back(g1.globalIndex()); } - if (std::find(used_dileptonIds.begin(), used_dileptonIds.end(), tuple_tmp_id2) == used_dileptonIds.end()) { + if (std::find(used_dileptonIds_per_col.begin(), used_dileptonIds_per_col.end(), tuple_tmp_id2) == used_dileptonIds_per_col.end()) { emh2->AddTrackToEventPool(key_df_collision, EMTrack(ndf, -1, collision.globalIndex(), -1, v_ee.Pt(), v_ee.Eta(), v_ee.Phi(), v_ee.M())); - used_dileptonIds.emplace_back(tuple_tmp_id2); + used_dileptonIds_per_col.emplace_back(tuple_tmp_id2); } ndiphoton++; } // end of dielectron loop } // end of g1 loop } // end of pairing in same event + used_photonIds_per_col.clear(); + used_photonIds_per_col.shrink_to_fit(); + used_dileptonIds_per_col.clear(); + used_dileptonIds_per_col.shrink_to_fit(); + used_diphotonIds_per_col.clear(); + used_diphotonIds_per_col.shrink_to_fit(); + if (ndiphoton > 0) { emh_ref->ReserveNTracksPerCollision(key_df_collision, refTracks_per_collision.size()); for (const auto& track : refTracks_per_collision) { From 65fc03d5d6a885c9dd6ef63f9797c35da0c89038 Mon Sep 17 00:00:00 2001 From: abmodak <67369858+abmodak@users.noreply.github.com> Date: Fri, 31 Oct 2025 15:11:58 +0100 Subject: [PATCH 973/986] [PWGCF] Fix MFT track filter condition + Add reassociated MFT track table (#13621) --- ...{longrangeDerived.h => LongRangeDerived.h} | 78 +++++++++------- .../TableProducer/longrangeMaker.cxx | 92 +++++++++++-------- 2 files changed, 95 insertions(+), 75 deletions(-) rename PWGCF/TwoParticleCorrelations/DataModel/{longrangeDerived.h => LongRangeDerived.h} (60%) diff --git a/PWGCF/TwoParticleCorrelations/DataModel/longrangeDerived.h b/PWGCF/TwoParticleCorrelations/DataModel/LongRangeDerived.h similarity index 60% rename from PWGCF/TwoParticleCorrelations/DataModel/longrangeDerived.h rename to PWGCF/TwoParticleCorrelations/DataModel/LongRangeDerived.h index 68323b52476..5f98f81c6ab 100644 --- a/PWGCF/TwoParticleCorrelations/DataModel/longrangeDerived.h +++ b/PWGCF/TwoParticleCorrelations/DataModel/LongRangeDerived.h @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. /// -/// \file longrangeDerived.h +/// \file LongRangeDerived.h /// /// \brief task derived table definition for long range correlation /// \author Abhi Modak (abhi.modak@cern.ch) @@ -23,23 +23,23 @@ namespace o2::aod { -namespace LRCorrCollTable +namespace lrcorrcolltable { DECLARE_SOA_COLUMN(Zvtx, zvtx, float); DECLARE_SOA_COLUMN(Multiplicity, multiplicity, float); DECLARE_SOA_COLUMN(Centrality, centrality, float); -} // namespace LRCorrCollTable +} // namespace lrcorrcolltable DECLARE_SOA_TABLE(CollLRTables, "AOD", "COLLLRTABLE", o2::soa::Index<>, bc::RunNumber, - LRCorrCollTable::Zvtx, - LRCorrCollTable::Multiplicity, - LRCorrCollTable::Centrality, + lrcorrcolltable::Zvtx, + lrcorrcolltable::Multiplicity, + lrcorrcolltable::Centrality, timestamp::Timestamp); using CollLRTable = CollLRTables::iterator; -namespace LRCorrTrkTable +namespace lrcorrtrktable { DECLARE_SOA_INDEX_COLUMN(CollLRTable, collLRTable); DECLARE_SOA_COLUMN(Pt, pt, float); @@ -63,55 +63,63 @@ enum V0TrackPid { kSpLambda, kSpALambda }; -} // namespace LRCorrTrkTable +} // namespace lrcorrtrktable DECLARE_SOA_TABLE(TrkLRTables, "AOD", "TRKLRTABLE", o2::soa::Index<>, - LRCorrTrkTable::CollLRTableId, - LRCorrTrkTable::Pt, - LRCorrTrkTable::Eta, - LRCorrTrkTable::Phi, - LRCorrTrkTable::TrackType); + lrcorrtrktable::CollLRTableId, + lrcorrtrktable::Pt, + lrcorrtrktable::Eta, + lrcorrtrktable::Phi, + lrcorrtrktable::TrackType); using TrkLRTable = TrkLRTables::iterator; DECLARE_SOA_TABLE(Ft0aLRTables, "AOD", "FT0ALRTABLE", o2::soa::Index<>, - LRCorrTrkTable::CollLRTableId, - LRCorrTrkTable::ChannelID, - LRCorrTrkTable::Amplitude, - LRCorrTrkTable::Eta, - LRCorrTrkTable::Phi); + lrcorrtrktable::CollLRTableId, + lrcorrtrktable::ChannelID, + lrcorrtrktable::Amplitude, + lrcorrtrktable::Eta, + lrcorrtrktable::Phi); using Ft0aLRTable = Ft0aLRTables::iterator; DECLARE_SOA_TABLE(Ft0cLRTables, "AOD", "FT0CLRTABLE", o2::soa::Index<>, - LRCorrTrkTable::CollLRTableId, - LRCorrTrkTable::ChannelID, - LRCorrTrkTable::Amplitude, - LRCorrTrkTable::Eta, - LRCorrTrkTable::Phi); + lrcorrtrktable::CollLRTableId, + lrcorrtrktable::ChannelID, + lrcorrtrktable::Amplitude, + lrcorrtrktable::Eta, + lrcorrtrktable::Phi); using Ft0cLRTable = Ft0cLRTables::iterator; DECLARE_SOA_TABLE(V0TrkLRTables, "AOD", "V0TRKLRTABLE", o2::soa::Index<>, - LRCorrTrkTable::CollLRTableId, - LRCorrTrkTable::IdPos, - LRCorrTrkTable::IdNeg, - LRCorrTrkTable::Pt, - LRCorrTrkTable::Eta, - LRCorrTrkTable::Phi, - LRCorrTrkTable::InvMass, - LRCorrTrkTable::V0Type); + lrcorrtrktable::CollLRTableId, + lrcorrtrktable::IdPos, + lrcorrtrktable::IdNeg, + lrcorrtrktable::Pt, + lrcorrtrktable::Eta, + lrcorrtrktable::Phi, + lrcorrtrktable::InvMass, + lrcorrtrktable::V0Type); using V0TrkLRTable = V0TrkLRTables::iterator; DECLARE_SOA_TABLE(MftTrkLRTables, "AOD", "MFTTRKLRTABLE", o2::soa::Index<>, - LRCorrTrkTable::CollLRTableId, - LRCorrTrkTable::Pt, - LRCorrTrkTable::Eta, - LRCorrTrkTable::Phi); + lrcorrtrktable::CollLRTableId, + lrcorrtrktable::Pt, + lrcorrtrktable::Eta, + lrcorrtrktable::Phi); using MftTrkLRTable = MftTrkLRTables::iterator; +DECLARE_SOA_TABLE(MftBestTrkLRTables, "AOD", "MFTBESTTRKLRTABLE", + o2::soa::Index<>, + lrcorrtrktable::CollLRTableId, + lrcorrtrktable::Pt, + lrcorrtrktable::Eta, + lrcorrtrktable::Phi); +using MftBestTrkLRTable = MftBestTrkLRTables::iterator; + } // namespace o2::aod #endif // PWGCF_TWOPARTICLECORRELATIONS_DATAMODEL_LONGRANGEDERIVED_H_ diff --git a/PWGCF/TwoParticleCorrelations/TableProducer/longrangeMaker.cxx b/PWGCF/TwoParticleCorrelations/TableProducer/longrangeMaker.cxx index 2319b14ae02..00bbaaf57c5 100644 --- a/PWGCF/TwoParticleCorrelations/TableProducer/longrangeMaker.cxx +++ b/PWGCF/TwoParticleCorrelations/TableProducer/longrangeMaker.cxx @@ -17,7 +17,7 @@ #include "PWGCF/Core/CorrelationContainer.h" #include "PWGCF/Core/PairCuts.h" -#include "PWGCF/TwoParticleCorrelations/DataModel/longrangeDerived.h" +#include "PWGCF/TwoParticleCorrelations/DataModel/LongRangeDerived.h" #include "PWGLF/DataModel/LFStrangenessTables.h" #include "PWGMM/Mult/DataModel/bestCollisionTable.h" @@ -67,7 +67,10 @@ using namespace o2::aod::fwdtrack; using namespace o2::aod::evsel; using namespace o2::constants::math; -auto static constexpr kMinFt0cCell = 96; +auto static constexpr KminFt0cCell = 96; +auto static constexpr PionTrackN = 1; +auto static constexpr KaonTrackN = 2; +auto static constexpr ProtonTrackN = 3; AxisSpec axisEvent{15, 0.5, 15.5, "#Event", "EventAxis"}; enum KindOfParticles { @@ -157,7 +160,6 @@ struct LongrangeMaker { Configurable cfgTofPidPtCut{"cfgTofPidPtCut", 0.3f, "Minimum pt to use TOF N-sigma"}; Configurable isUseItsPid{"isUseItsPid", false, "Use ITS PID for particle identification"}; - SliceCache cache; Service ccdb; Service pdg; o2::ccdb::CcdbApi ccdbApi; @@ -197,6 +199,8 @@ struct LongrangeMaker { x->SetBinLabel(9, "ApplyNoHighMultCollInPrevRof"); myTrackFilter = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSibAny, TrackSelection::GlobalTrackRun3DCAxyCut::Default); + myTrackFilter.SetPtRange(cfgtrksel.cfgPtCutMin, cfgtrksel.cfgPtCutMax); + myTrackFilter.SetEtaRange(-cfgtrksel.cfgEtaCut, cfgtrksel.cfgEtaCut); myTrackFilter.SetMinNCrossedRowsTPC(cfgtrksel.minNCrossedRowsTPC); myTrackFilter.SetMinNClustersTPC(cfgtrksel.minTPCNClsFound); myTrackFilter.SetMaxDcaZ(cfgtrksel.maxDcaZ); @@ -213,46 +217,41 @@ struct LongrangeMaker { Produces ft0aLRTable; Produces ft0cLRTable; Produces mftLRTable; + Produces mftbestLRTable; Produces v0LRTable; Filter fTracksEta = nabs(aod::track::eta) < cfgtrksel.cfgEtaCut; Filter fTracksPt = (aod::track::pt > cfgtrksel.cfgPtCutMin) && (aod::track::pt < cfgtrksel.cfgPtCutMax); - Filter fMftTrackColID = (aod::fwdtrack::bestCollisionId >= 0); - Filter fMftTrackDca = (nabs(aod::fwdtrack::bestDCAXY) < cfgmfttrksel.cfigMftDcaxy); using CollTable = soa::Join; using TrksTable = soa::Filtered>; - using MftTrkTable = soa::Filtered; + using MftTrkTable = aod::MFTTracks; - Preslice perColGlobal = aod::track::collisionId; - Preslice perColMft = aod::fwdtrack::collisionId; - Preslice perColV0 = aod::v0data::collisionId; - - void process(CollTable::iterator const& col, TrksTable const& tracks, aod::FT0s const&, MftTrkTable const& mfttracks, aod::V0Datas const& V0s) + void process(CollTable::iterator const& col, TrksTable const& tracks, aod::FT0s const&, MftTrkTable const& mfttracks, soa::SmallGroups const& retracks, aod::V0Datas const& V0s, aod::BCsWithTimestamps const&) { if (!isEventSelected(col)) { return; } - auto tracksInCollision = tracks.sliceBy(perColGlobal, col.globalIndex()); - auto multiplicity = countNTracks(tracksInCollision); + + auto multiplicity = countNTracks(tracks); auto centrality = selColCent(col); auto bc = col.bc_as(); collisionLRTable(bc.runNumber(), col.posZ(), multiplicity, centrality, bc.timestamp()); // track loop - for (const auto& track : tracksInCollision) { + for (const auto& track : tracks) { if (!track.isGlobalTrack()) continue; if (!myTrackFilter.IsSelected(track)) continue; - tracksLRTable(collisionLRTable.lastIndex(), track.pt(), track.eta(), track.phi(), aod::LRCorrTrkTable::kSpCharge); - if (getTrackPID(track) == 1) - tracksLRTable(collisionLRTable.lastIndex(), track.pt(), track.eta(), track.phi(), aod::LRCorrTrkTable::kSpPion); - if (getTrackPID(track) == 2) - tracksLRTable(collisionLRTable.lastIndex(), track.pt(), track.eta(), track.phi(), aod::LRCorrTrkTable::kSpKaon); - if (getTrackPID(track) == 3) - tracksLRTable(collisionLRTable.lastIndex(), track.pt(), track.eta(), track.phi(), aod::LRCorrTrkTable::kSpProton); + tracksLRTable(collisionLRTable.lastIndex(), track.pt(), track.eta(), track.phi(), aod::lrcorrtrktable::kSpCharge); + if (getTrackPID(track) == PionTrackN) + tracksLRTable(collisionLRTable.lastIndex(), track.pt(), track.eta(), track.phi(), aod::lrcorrtrktable::kSpPion); + if (getTrackPID(track) == KaonTrackN) + tracksLRTable(collisionLRTable.lastIndex(), track.pt(), track.eta(), track.phi(), aod::lrcorrtrktable::kSpKaon); + if (getTrackPID(track) == ProtonTrackN) + tracksLRTable(collisionLRTable.lastIndex(), track.pt(), track.eta(), track.phi(), aod::lrcorrtrktable::kSpProton); } // ft0 loop @@ -275,8 +274,7 @@ struct LongrangeMaker { } // mft loop - auto mfttracksInCollision = mfttracks.sliceBy(perColMft, col.globalIndex()); - for (const auto& track : mfttracksInCollision) { + for (const auto& track : mfttracks) { if (!isMftTrackSelected(track)) continue; auto phi = track.phi(); @@ -284,9 +282,23 @@ struct LongrangeMaker { mftLRTable(collisionLRTable.lastIndex(), track.pt(), track.eta(), phi); } + if (retracks.size() > 0) { + for (const auto& retrack : retracks) { + if (std::abs(retrack.bestDCAXY()) > cfgmfttrksel.cfigMftDcaxy) { + continue; // does not point to PV properly + } + auto track = retrack.mfttrack(); + if (!isMftTrackSelected(track)) { + continue; + } + auto phi = track.phi(); + o2::math_utils::bringTo02Pi(phi); + mftbestLRTable(collisionLRTable.lastIndex(), track.pt(), track.eta(), phi); + } + } + // v0 loop - auto v0tracksInCollision = V0s.sliceBy(perColV0, col.globalIndex()); - for (const auto& v0 : v0tracksInCollision) { + for (const auto& v0 : V0s) { if (!isSelectV0Track(v0)) { // Quality selection for V0 prongs continue; } @@ -297,23 +309,23 @@ struct LongrangeMaker { // K0short if (isSelectK0s(col, v0)) { // candidate is K0s v0LRTable(collisionLRTable.lastIndex(), posTrack.globalIndex(), negTrack.globalIndex(), - v0.pt(), v0.eta(), v0.phi(), v0.mK0Short(), aod::LRCorrTrkTable::kSpK0short); + v0.pt(), v0.eta(), v0.phi(), v0.mK0Short(), aod::lrcorrtrktable::kSpK0short); } // Lambda and Anti-Lambda - bool LambdaTag = isSelectLambda(col, v0); - bool ALambdaTag = isSelectLambda(col, v0); + bool lambdaTag = isSelectLambda(col, v0); + bool antilambdaTag = isSelectLambda(col, v0); // Note: candidate compatible with Lambda and Anti-Lambda hypothesis are counted twice (once for each hypothesis) - if (LambdaTag) { // candidate is Lambda + if (lambdaTag) { // candidate is Lambda massV0 = v0.mLambda(); v0LRTable(collisionLRTable.lastIndex(), posTrack.globalIndex(), negTrack.globalIndex(), - v0.pt(), v0.eta(), v0.phi(), massV0, aod::LRCorrTrkTable::kSpLambda); + v0.pt(), v0.eta(), v0.phi(), massV0, aod::lrcorrtrktable::kSpLambda); } - if (ALambdaTag) { // candidate is Anti-lambda + if (antilambdaTag) { // candidate is Anti-lambda massV0 = v0.mAntiLambda(); v0LRTable(collisionLRTable.lastIndex(), posTrack.globalIndex(), negTrack.globalIndex(), - v0.pt(), v0.eta(), v0.phi(), massV0, aod::LRCorrTrkTable::kSpALambda); + v0.pt(), v0.eta(), v0.phi(), massV0, aod::lrcorrtrktable::kSpALambda); } // end of Lambda and Anti-Lambda processing } } // process function @@ -452,7 +464,7 @@ struct LongrangeMaker { auto x = chPos.X() + (*offsetFT0)[i].getX(); auto y = chPos.Y() + (*offsetFT0)[i].getY(); auto z = chPos.Z() + (*offsetFT0)[i].getZ(); - if (chno >= kMinFt0cCell) + if (chno >= KminFt0cCell) z = -z; auto r = std::sqrt(x * x + y * y); auto theta = std::atan2(r, z); @@ -504,7 +516,7 @@ struct LongrangeMaker { const auto& posTrack = v0.template posTrack_as(); const auto& negTrack = v0.template negTrack_as(); - float CtauK0s = v0.distovertotmom(col.posX(), col.posY(), col.posZ()) * o2::constants::physics::MassK0; + float ctauK0s = v0.distovertotmom(col.posX(), col.posY(), col.posZ()) * o2::constants::physics::MassK0; if (v0.mK0Short() < cfgv0trksel.minK0sMass || v0.mK0Short() > cfgv0trksel.maxK0sMass) { return false; @@ -521,13 +533,13 @@ struct LongrangeMaker { if (v0.dcaV0daughters() > cfgv0trksel.maxDcaV0DauK0s) { return false; } - if (std::abs(CtauK0s) > cfgv0trksel.maxK0sLifeTime) { + if (std::abs(ctauK0s) > cfgv0trksel.maxK0sLifeTime) { return false; } if (((std::abs(posTrack.tpcNSigmaPi()) > cfgv0trksel.daughPIDCuts) || (std::abs(negTrack.tpcNSigmaPi()) > cfgv0trksel.daughPIDCuts))) { return false; } - if ((TMath::Abs(v0.dcapostopv()) < cfgv0trksel.minV0DcaPiK0s || TMath::Abs(v0.dcanegtopv()) < cfgv0trksel.minV0DcaPiK0s)) { + if ((std::abs(v0.dcapostopv()) < cfgv0trksel.minV0DcaPiK0s || std::abs(v0.dcanegtopv()) < cfgv0trksel.minV0DcaPiK0s)) { return false; } return true; @@ -538,7 +550,7 @@ struct LongrangeMaker { { const auto& posTrack = v0.template posTrack_as(); const auto& negTrack = v0.template negTrack_as(); - float CtauLambda = v0.distovertotmom(col.posX(), col.posY(), col.posZ()) * o2::constants::physics::MassLambda; + float ctauLambda = v0.distovertotmom(col.posX(), col.posY(), col.posZ()) * o2::constants::physics::MassLambda; if ((v0.mLambda() < cfgv0trksel.minLambdaMass || v0.mLambda() > cfgv0trksel.maxLambdaMass) && (v0.mAntiLambda() < cfgv0trksel.minLambdaMass || v0.mAntiLambda() > cfgv0trksel.maxLambdaMass)) { return false; @@ -552,10 +564,10 @@ struct LongrangeMaker { if (v0.dcaV0daughters() > cfgv0trksel.maxDcaV0DauLambda) { return false; } - if (pid == KindOfV0::kLambda && (TMath::Abs(v0.dcapostopv()) < cfgv0trksel.minV0DcaPr || TMath::Abs(v0.dcanegtopv()) < cfgv0trksel.minV0DcaPiLambda)) { + if (pid == KindOfV0::kLambda && (std::abs(v0.dcapostopv()) < cfgv0trksel.minV0DcaPr || std::abs(v0.dcanegtopv()) < cfgv0trksel.minV0DcaPiLambda)) { return false; } - if (pid == KindOfV0::kAntiLambda && (TMath::Abs(v0.dcapostopv()) < cfgv0trksel.minV0DcaPiLambda || TMath::Abs(v0.dcanegtopv()) < cfgv0trksel.minV0DcaPr)) { + if (pid == KindOfV0::kAntiLambda && (std::abs(v0.dcapostopv()) < cfgv0trksel.minV0DcaPiLambda || std::abs(v0.dcanegtopv()) < cfgv0trksel.minV0DcaPr)) { return false; } if (pid == KindOfV0::kLambda && ((std::abs(posTrack.tpcNSigmaPr()) > cfgv0trksel.daughPIDCuts) || (std::abs(negTrack.tpcNSigmaPi()) > cfgv0trksel.daughPIDCuts))) { @@ -564,7 +576,7 @@ struct LongrangeMaker { if (pid == KindOfV0::kAntiLambda && ((std::abs(posTrack.tpcNSigmaPi()) > cfgv0trksel.daughPIDCuts) || (std::abs(negTrack.tpcNSigmaPr()) > cfgv0trksel.daughPIDCuts))) { return false; } - if (std::abs(CtauLambda) > cfgv0trksel.maxLambdaLifeTime) { + if (std::abs(ctauLambda) > cfgv0trksel.maxLambdaLifeTime) { return false; } return true; From 138aa096e832fda3ec5df10bf5adfdeb8bbe6867 Mon Sep 17 00:00:00 2001 From: lauraser <45659867+lauraser@users.noreply.github.com> Date: Fri, 31 Oct 2025 15:45:52 +0100 Subject: [PATCH 974/986] [PWGLF] Add axis for multiplicity to do ME multiplicity reweighting (#13618) Co-authored-by: Laura Serksnyte --- PWGLF/Tasks/Resonances/f1protoncorrelation.cxx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/PWGLF/Tasks/Resonances/f1protoncorrelation.cxx b/PWGLF/Tasks/Resonances/f1protoncorrelation.cxx index 035418143bf..e19d2ea0ca7 100644 --- a/PWGLF/Tasks/Resonances/f1protoncorrelation.cxx +++ b/PWGLF/Tasks/Resonances/f1protoncorrelation.cxx @@ -107,6 +107,7 @@ struct f1protoncorrelation { const AxisSpec thnAxisKstar{configThnAxisKstar, "#it{k}^{*} (GeV/#it{c})"}; const AxisSpec thnAxisNsigma{configThnAxisNsigma, "NsigmaCombined"}; const AxisSpec thnAxisCharge{configThnAxisCharge, "Charge"}; + const AxisSpec thnAxisMultiplicity{CfgMultBins, "Multiplicity"}; // register histograms histos.add("hPhaseSpaceProtonKaonSame", "hPhaseSpaceProtonKaonSame", kTH3F, {{40, -2.0f, 2.0f}, {180, -2.0 * TMath::Pi(), 2.0 * TMath::Pi()}, {100, 0.0, 1.0}}); @@ -120,12 +121,12 @@ struct f1protoncorrelation { histos.add("hNsigmaPionKaonTPC", "Nsigma Pion Kaon TPC correlation", kTH2F, {{100, -5.0f, 5.0f}, {100, -5.0f, 5.0f}}); histos.add("h2SameEventPtCorrelation", "Pt correlation of F1 and proton", kTH3F, {{100, 0.0f, 1.0f}, {100, 0.0, 10.0}, {100, 0.0, 10.0}}); - histos.add("h2SameEventInvariantMassUnlike_mass", "Unlike Sign Invariant mass of f1 same event", kTHnSparseF, {thnAxisKstar, thnAxisPt, thnAxisInvMass, thnAxisCharge}); - histos.add("h2SameEventInvariantMassLike_mass", "Like Sign Invariant mass of f1 same event", kTHnSparseF, {thnAxisKstar, thnAxisPt, thnAxisInvMass, thnAxisCharge}); + histos.add("h2SameEventInvariantMassUnlike_mass", "Unlike Sign Invariant mass of f1 same event", kTHnSparseF, {thnAxisKstar, thnAxisPt, thnAxisInvMass, thnAxisCharge, thnAxisMultiplicity}); + histos.add("h2SameEventInvariantMassLike_mass", "Like Sign Invariant mass of f1 same event", kTHnSparseF, {thnAxisKstar, thnAxisPt, thnAxisInvMass, thnAxisCharge, thnAxisMultiplicity}); histos.add("h2SameEventInvariantMassRot_mass", "Rotational Invariant mass of f1 same event", kTHnSparseF, {thnAxisKstar, thnAxisPt, thnAxisInvMass, thnAxisCharge}); - histos.add("h2MixEventInvariantMassUnlike_mass", "Unlike Sign Invariant mass of f1 mix event", kTHnSparseF, {thnAxisKstar, thnAxisPt, thnAxisInvMass, thnAxisCharge}); - histos.add("h2MixEventInvariantMassLike_mass", "Like Sign Invariant mass of f1 mix event", kTHnSparseF, {thnAxisKstar, thnAxisPt, thnAxisInvMass, thnAxisCharge}); + histos.add("h2MixEventInvariantMassUnlike_mass", "Unlike Sign Invariant mass of f1 mix event", kTHnSparseF, {thnAxisKstar, thnAxisPt, thnAxisInvMass, thnAxisCharge, thnAxisMultiplicity}); + histos.add("h2MixEventInvariantMassLike_mass", "Like Sign Invariant mass of f1 mix event", kTHnSparseF, {thnAxisKstar, thnAxisPt, thnAxisInvMass, thnAxisCharge, thnAxisMultiplicity}); histos.add("h2MixEventInvariantMassRot_mass", "Rotational Sign Invariant mass of f1 mix event", kTHnSparseF, {thnAxisKstar, thnAxisPt, thnAxisInvMass, thnAxisCharge}); histos.add("h2MixEventInvariantMassUnlike_mass_SEFP", "Unlike-sign invariant mass of f1 mix event (SE-F1P: π mixed, p same event)", kTHnSparseF, {thnAxisKstar, thnAxisPt, thnAxisInvMass, thnAxisCharge}); @@ -318,7 +319,7 @@ struct f1protoncorrelation { } histos.fill(HIST("hPhaseSpaceProtonKaonSame"), Proton.Eta() - Kaon.Eta(), PhiAtSpecificRadiiTPC(Proton, Kaon, protontrack.protonCharge(), kaonCharge, bz, bz), relative_momentum); // Phase Space Proton kaon histos.fill(HIST("hPhaseSpaceProtonPionSame"), Proton.Eta() - Kaon.Eta(), PhiAtSpecificRadiiTPC(Proton, Pion, protontrack.protonCharge(), pionCharge, bz, bz), relative_momentum); // Phase Space Proton Pion - histos.fill(HIST("h2SameEventInvariantMassUnlike_mass"), relative_momentum, F1.Pt(), F1.M(), pairCharge); // F1 sign = 1 unlike, F1 sign = -1 like + histos.fill(HIST("h2SameEventInvariantMassUnlike_mass"), relative_momentum, F1.Pt(), F1.M(), pairCharge, collision.numContrib()); // F1 sign = 1 unlike, F1 sign = -1 like if (fillSparse) { histos.fill(HIST("SEMassUnlike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC, pairCharge); } @@ -344,7 +345,7 @@ struct f1protoncorrelation { } } if (f1track.f1SignalStat() == -1) { - histos.fill(HIST("h2SameEventInvariantMassLike_mass"), relative_momentum, F1.Pt(), F1.M(), protontrack.protonCharge()); + histos.fill(HIST("h2SameEventInvariantMassLike_mass"), relative_momentum, F1.Pt(), F1.M(), protontrack.protonCharge(), collision.numContrib()); if (fillSparse) { histos.fill(HIST("SEMassLike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC, protontrack.protonCharge()); } @@ -598,7 +599,7 @@ struct f1protoncorrelation { pionCharge = 1; kaonCharge = -1; } - histos.fill(HIST("h2MixEventInvariantMassUnlike_mass"), relative_momentum, F1.Pt(), F1.M(), pairCharge); // F1 sign = 1 unlike, F1 sign = -1 like + histos.fill(HIST("h2MixEventInvariantMassUnlike_mass"), relative_momentum, F1.Pt(), F1.M(), pairCharge, collision1.numContrib()); // F1 sign = 1 unlike, F1 sign = -1 like histos.fill(HIST("hPhaseSpaceProtonKaonMix"), Proton.Eta() - Kaon.Eta(), PhiAtSpecificRadiiTPC(Proton, Kaon, t2.protonCharge(), kaonCharge, bz, bz2), relative_momentum); // Phase Space Proton kaon histos.fill(HIST("hPhaseSpaceProtonPionMix"), Proton.Eta() - Kaon.Eta(), PhiAtSpecificRadiiTPC(Proton, Pion, t2.protonCharge(), pionCharge, bz, bz2), relative_momentum); // Phase Space Proton Pion if (fillSparse) { @@ -629,7 +630,7 @@ struct f1protoncorrelation { } } if (t1.f1SignalStat() == -1) { - histos.fill(HIST("h2MixEventInvariantMassLike_mass"), relative_momentum, F1.Pt(), F1.M(), t2.protonCharge()); + histos.fill(HIST("h2MixEventInvariantMassLike_mass"), relative_momentum, F1.Pt(), F1.M(), t2.protonCharge(), collision1.numContrib()); if (fillSparse) { histos.fill(HIST("MEMassLike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC, t2.protonCharge()); } From c9dfedd573f14574e0c38e909fdb4e9197fced8c Mon Sep 17 00:00:00 2001 From: Ida Storehaug <38440296+torkjellsdatter@users.noreply.github.com> Date: Fri, 31 Oct 2025 16:00:25 +0100 Subject: [PATCH 975/986] [PWGDQ] Add converter for updated REDUCEDMCEVENT table (ReducedInfoTables.h, CMakeList.txt, new task) (#13620) Co-authored-by: Ida Torkjellsdatter Storehaug Co-authored-by: ALICE Action Bot --- PWGDQ/DataModel/ReducedInfoTables.h | 14 +++-- PWGDQ/Tasks/CMakeLists.txt | 5 ++ PWGDQ/Tasks/ModelConverterReducedMCEvents.cxx | 52 +++++++++++++++++++ 3 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 PWGDQ/Tasks/ModelConverterReducedMCEvents.cxx diff --git a/PWGDQ/DataModel/ReducedInfoTables.h b/PWGDQ/DataModel/ReducedInfoTables.h index 2ad18c11bfd..8fc3931d97b 100644 --- a/PWGDQ/DataModel/ReducedInfoTables.h +++ b/PWGDQ/DataModel/ReducedInfoTables.h @@ -218,11 +218,19 @@ DECLARE_SOA_TABLE(ReducedEventsInfo, "AOD", "REDUCEVENTINFO", //! Main event i // There is no explicit accounting for MC events which were not reconstructed!!! // However, for analysis which will require these events, a special skimming process function // can be constructed and the same data model could be used -DECLARE_SOA_TABLE(ReducedMCEvents, "AOD", "REDUCEDMCEVENT", //! Event level MC truth information + +DECLARE_SOA_TABLE(ReducedMCEvents_000, "AOD", "REDUCEDMCEVENT", //! Event level MC truth information o2::soa::Index<>, mccollision::GeneratorsID, reducedevent::MCPosX, reducedevent::MCPosY, reducedevent::MCPosZ, - mccollision::T, mccollision::Weight, mccollision::ImpactParameter, cent::CentFT0C, - mult::MultMCNParticlesEta05, mult::MultMCNParticlesEta08, mult::MultMCNParticlesEta10); + mccollision::T, mccollision::Weight, mccollision::ImpactParameter); + +DECLARE_SOA_TABLE_VERSIONED(ReducedMCEvents_001, "AOD", "REDUCEDMCEVENT", 1, //! Event level MC truth information + o2::soa::Index<>, + mccollision::GeneratorsID, reducedevent::MCPosX, reducedevent::MCPosY, reducedevent::MCPosZ, + mccollision::T, mccollision::Weight, mccollision::ImpactParameter, cent::CentFT0C, + mult::MultMCNParticlesEta05, mult::MultMCNParticlesEta08, mult::MultMCNParticlesEta10); + +using ReducedMCEvents = ReducedMCEvents_001; using ReducedEvent = ReducedEvents::iterator; using StoredReducedEvent = StoredReducedEvents::iterator; diff --git a/PWGDQ/Tasks/CMakeLists.txt b/PWGDQ/Tasks/CMakeLists.txt index ba4a3e14870..0b57b90f48f 100644 --- a/PWGDQ/Tasks/CMakeLists.txt +++ b/PWGDQ/Tasks/CMakeLists.txt @@ -124,6 +124,11 @@ o2physics_add_dpl_workflow(model-converter-event-extended PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::PWGDQCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(model-converter-mc-reduced-event + SOURCES ModelConverterReducedMCEvents.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::PWGDQCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(tag-and-probe SOURCES TagAndProbe.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2Physics::PWGDQCore diff --git a/PWGDQ/Tasks/ModelConverterReducedMCEvents.cxx b/PWGDQ/Tasks/ModelConverterReducedMCEvents.cxx new file mode 100644 index 00000000000..f4e28daee31 --- /dev/null +++ b/PWGDQ/Tasks/ModelConverterReducedMCEvents.cxx @@ -0,0 +1,52 @@ +// 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. +// +// Contact: iarsene@cern.ch, i.c.arsene@fys.uio.no +// +// Task used to convert the data model from the old format to the new format. To avoid +// the conflict with the old data model. + +// other includes +#include "PWGDQ/DataModel/ReducedInfoTables.h" + +#include "DataFormatsParameters/GRPObject.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::aod; + +struct reducedMCeventConverter000_001 { + Produces reducedMCevent_001; + + void process(aod::ReducedMCEvents_000 const& events) + { + for (const auto& event : events) { + reducedMCevent_001(event.generatorsID(), event.mcPosX(), event.mcPosY(), event.mcPosZ(), + event.t(), event.weight(), event.impactParameter(), + -1.0f, -1.0f, -1.0f, -1.0f); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} From 2617ff2f745d292ffcd5fbb9fccc1210b38a1c18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= <26327373+vkucera@users.noreply.github.com> Date: Fri, 31 Oct 2025 19:16:21 +0100 Subject: [PATCH 976/986] [PWGHF,PWGJE,Trigger] Divide candidate data model into skimming, reconstruction, aliases (#13503) --- EventFiltering/PWGHF/HFFilter.cxx | 4 +- .../PWGHF/HFFilterCharmHadronSignals.cxx | 2 +- .../PWGHF/HFFilterPrepareMLSamples.cxx | 2 +- PWGHF/ALICE3/Core/DecayChannelsLegacy.h | 46 ++ PWGHF/Core/DecayChannelsLegacy.h | 94 ++++ .../dataCreatorCharmHadPiReduced.cxx | 3 + .../dataCreatorJpsiHadReduced.cxx | 2 + PWGHF/D2H/Tasks/taskB0.cxx | 1 + PWGHF/D2H/Tasks/taskBplus.cxx | 1 + PWGHF/D2H/Tasks/taskBs.cxx | 1 + PWGHF/D2H/Tasks/taskCd.cxx | 1 + PWGHF/D2H/Tasks/taskD0.cxx | 2 + PWGHF/D2H/Tasks/taskDplus.cxx | 1 + PWGHF/D2H/Tasks/taskDs.cxx | 2 + PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx | 1 + PWGHF/D2H/Tasks/taskLb.cxx | 1 + PWGHF/D2H/Tasks/taskLc.cxx | 2 + PWGHF/D2H/Tasks/taskLcToK0sP.cxx | 1 + PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx | 2 + PWGHF/D2H/Tasks/taskSigmac.cxx | 2 + PWGHF/D2H/Tasks/taskXic.cxx | 2 + PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx | 1 + PWGHF/D2H/Tasks/taskXicToXiPiPi.cxx | 2 + PWGHF/D2H/Tasks/taskXicc.cxx | 2 + PWGHF/DataModel/AliasTables.h | 57 +++ .../DataModel/CandidateReconstructionTables.h | 414 +----------------- PWGHF/DataModel/DerivedTables.h | 1 + PWGHF/DataModel/TrackIndexSkimmingTables.h | 323 ++++++++++++++ PWGHF/HFC/TableProducer/correlatorD0D0bar.cxx | 2 + .../correlatorD0D0barBarrelFullPid.cxx | 4 +- .../HFC/TableProducer/correlatorD0Hadrons.cxx | 2 + .../TableProducer/correlatorDplusDminus.cxx | 4 +- .../TableProducer/correlatorDplusHadrons.cxx | 2 + .../HFC/TableProducer/correlatorDsHadrons.cxx | 2 + .../TableProducer/correlatorDstarHadrons.cxx | 1 + .../HFC/TableProducer/correlatorLcHadrons.cxx | 2 + .../TableProducer/correlatorLcScHadrons.cxx | 3 + .../derivedDataCreatorCorrelationsReduced.cxx | 1 + .../HFC/TableProducer/femtoDreamProducer.cxx | 1 + PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx | 1 + .../HFC/Tasks/taskCorrelationDplusHadrons.cxx | 2 + PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx | 2 + PWGHF/HFC/Tasks/taskCorrelationLcHadrons.cxx | 2 + PWGHF/HFC/Tasks/taskFlow.cxx | 2 + PWGHF/HFC/Utils/utilsCorrelations.h | 2 +- .../TableProducer/treeCreatorElectronDCA.cxx | 2 +- .../TableProducer/candidateCreator2Prong.cxx | 2 + .../TableProducer/candidateCreator3Prong.cxx | 2 + PWGHF/TableProducer/candidateCreatorB0.cxx | 1 + PWGHF/TableProducer/candidateCreatorBplus.cxx | 2 + PWGHF/TableProducer/candidateCreatorBs.cxx | 1 + .../TableProducer/candidateCreatorCascade.cxx | 2 + PWGHF/TableProducer/candidateCreatorDstar.cxx | 2 + PWGHF/TableProducer/candidateCreatorLb.cxx | 2 + .../candidateCreatorSigmac0plusplus.cxx | 3 + ...candidateCreatorSigmac0plusplusCascade.cxx | 1 + .../candidateCreatorXic0Omegac0.cxx | 3 + .../candidateCreatorXicToXiPiPi.cxx | 3 + PWGHF/TableProducer/candidateCreatorXicc.cxx | 3 + .../candidateSelectorB0ToDPi.cxx | 1 + .../candidateSelectorBplusToD0Pi.cxx | 1 + .../candidateSelectorBsToDsPi.cxx | 1 + PWGHF/TableProducer/candidateSelectorCd.cxx | 2 + PWGHF/TableProducer/candidateSelectorD0.cxx | 2 + .../candidateSelectorDplusToPiKPi.cxx | 2 + .../candidateSelectorDsToKKPi.cxx | 2 + .../candidateSelectorDstarToD0Pi.cxx | 2 + .../candidateSelectorLbToLcPi.cxx | 1 + PWGHF/TableProducer/candidateSelectorLc.cxx | 2 + .../candidateSelectorLcPidMl.cxx | 2 + .../candidateSelectorLcToK0sP.cxx | 1 + .../candidateSelectorOmegac0ToOmegaKa.cxx | 1 + .../candidateSelectorOmegac0ToOmegaPi.cxx | 1 + .../candidateSelectorOmegac0Xic0ToOmegaKa.cxx | 1 + .../TableProducer/candidateSelectorToXiPi.cxx | 1 + .../candidateSelectorXic0ToXiPiKf.cxx | 1 + .../candidateSelectorXicToPKPi.cxx | 2 + .../candidateSelectorXicToXiPiPi.cxx | 1 + .../candidateSelectorXiccToPKPiPi.cxx | 2 + PWGHF/TableProducer/converterDstarIndices.cxx | 2 +- .../derivedDataCreatorB0ToDPi.cxx | 1 + .../derivedDataCreatorBplusToD0Pi.cxx | 1 + .../derivedDataCreatorDplusToPiKPi.cxx | 1 + .../derivedDataCreatorDsToKKPi.cxx | 1 + .../derivedDataCreatorDstarToD0Pi.cxx | 1 + .../derivedDataCreatorLcToPKPi.cxx | 1 + .../derivedDataCreatorXicToXiPiPi.cxx | 2 + PWGHF/TableProducer/pidCreator.cxx | 1 + PWGHF/TableProducer/refitPvDummy.cxx | 2 +- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 3 +- PWGHF/TableProducer/treeCreatorB0ToDPi.cxx | 1 + .../TableProducer/treeCreatorBplusToD0Pi.cxx | 1 + PWGHF/TableProducer/treeCreatorBsToDsPi.cxx | 1 + .../TableProducer/treeCreatorDplusToPiKPi.cxx | 1 + PWGHF/TableProducer/treeCreatorDsToKKPi.cxx | 1 + .../TableProducer/treeCreatorDstarToD0Pi.cxx | 1 + PWGHF/TableProducer/treeCreatorLcToK0sP.cxx | 1 + PWGHF/TableProducer/treeCreatorLcToPKPi.cxx | 1 + .../treeCreatorOmegac0ToOmegaPi.cxx | 1 + PWGHF/TableProducer/treeCreatorOmegacSt.cxx | 2 +- .../treeCreatorSigmacCorrBkg.cxx | 2 + .../TableProducer/treeCreatorTccToD0D0Pi.cxx | 1 + .../TableProducer/treeCreatorXicToXiPiPi.cxx | 1 + .../TableProducer/treeCreatorXiccToPKPiPi.cxx | 1 + PWGHF/Tasks/taskLcCentrality.cxx | 2 + PWGHF/Tasks/taskMcEfficiency.cxx | 1 + PWGHF/Tasks/taskMcEfficiencyToXiPi.cxx | 1 + PWGHF/Tasks/taskMcValidation.cxx | 2 + PWGHF/Tasks/taskSelOptimisation.cxx | 2 + PWGJE/Core/JetHFUtilities.h | 1 + 110 files changed, 682 insertions(+), 425 deletions(-) create mode 100644 PWGHF/ALICE3/Core/DecayChannelsLegacy.h create mode 100644 PWGHF/Core/DecayChannelsLegacy.h create mode 100644 PWGHF/DataModel/AliasTables.h create mode 100644 PWGHF/DataModel/TrackIndexSkimmingTables.h diff --git a/EventFiltering/PWGHF/HFFilter.cxx b/EventFiltering/PWGHF/HFFilter.cxx index 9777d2ee18c..beaddd9fd07 100644 --- a/EventFiltering/PWGHF/HFFilter.cxx +++ b/EventFiltering/PWGHF/HFFilter.cxx @@ -23,7 +23,7 @@ #include "EventFiltering/filterTables.h" // #include "PWGHF/Core/SelectorCuts.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" // #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" #include "PWGLF/DataModel/LFStrangenessTables.h" @@ -179,7 +179,7 @@ struct HfFilter { // Main struct for HF triggers Service ccdb; using BigTracksMCPID = soa::Join; - using BigTracksPID = soa::Join; + using BigTracksPID = soa::Join; using TracksIUPID = soa::Join; using CollsWithEvSel = soa::Join; diff --git a/EventFiltering/PWGHF/HFFilterCharmHadronSignals.cxx b/EventFiltering/PWGHF/HFFilterCharmHadronSignals.cxx index 3cd5a047bb9..e136856c33e 100644 --- a/EventFiltering/PWGHF/HFFilterCharmHadronSignals.cxx +++ b/EventFiltering/PWGHF/HFFilterCharmHadronSignals.cxx @@ -17,7 +17,7 @@ #include "EventFiltering/PWGHF/HFFilterHelpers.h" // #include "PWGHF/Core/SelectorCuts.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" // #include "Common/CCDB/EventSelectionParams.h" #include "Common/Core/RecoDecay.h" diff --git a/EventFiltering/PWGHF/HFFilterPrepareMLSamples.cxx b/EventFiltering/PWGHF/HFFilterPrepareMLSamples.cxx index 8e4dc89d43f..1b2db23c907 100644 --- a/EventFiltering/PWGHF/HFFilterPrepareMLSamples.cxx +++ b/EventFiltering/PWGHF/HFFilterPrepareMLSamples.cxx @@ -20,7 +20,7 @@ #include "EventFiltering/PWGHF/HFFilterHelpers.h" // -#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" // #include "Common/Core/RecoDecay.h" #include "Common/Core/trackUtilities.h" diff --git a/PWGHF/ALICE3/Core/DecayChannelsLegacy.h b/PWGHF/ALICE3/Core/DecayChannelsLegacy.h new file mode 100644 index 00000000000..7b95df102f1 --- /dev/null +++ b/PWGHF/ALICE3/Core/DecayChannelsLegacy.h @@ -0,0 +1,46 @@ +// 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 DecayChannelsLegacy.h +/// \brief Legacy definitions of constants for MC flagging of HF decay channels. +/// \author Vít Kučera , Inha University + +#ifndef PWGHF_ALICE3_CORE_DECAYCHANNELSLEGACY_H_ +#define PWGHF_ALICE3_CORE_DECAYCHANNELSLEGACY_H_ + +namespace o2::aod +{ +namespace hf_cand_x +{ +enum DecayType { + XToJpsiToEEPiPi = 0, + XToJpsiToMuMuPiPi +}; +} // namespace hf_cand_x + +namespace hf_cand_xicc +{ +enum DecayType { + XiccToXicPi = 0 +}; +} // namespace hf_cand_xicc + +namespace hf_cand_chic +{ +enum DecayType { + ChicToJpsiToEEGamma = 0, + ChicToJpsiToMuMuGamma +}; +} // namespace hf_cand_chic + +} // namespace o2::aod + +#endif // PWGHF_ALICE3_CORE_DECAYCHANNELSLEGACY_H_ diff --git a/PWGHF/Core/DecayChannelsLegacy.h b/PWGHF/Core/DecayChannelsLegacy.h new file mode 100644 index 00000000000..0dd3c8f0188 --- /dev/null +++ b/PWGHF/Core/DecayChannelsLegacy.h @@ -0,0 +1,94 @@ +// 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 DecayChannelsLegacy.h +/// \brief Legacy definitions of constants for MC flagging of HF decay channels. +/// \author Vít Kučera , Inha University +/// \note Should be replaced with corresponding constants in DecayChannels.h. + +#ifndef PWGHF_CORE_DECAYCHANNELSLEGACY_H_ +#define PWGHF_CORE_DECAYCHANNELSLEGACY_H_ + +namespace o2::aod +{ +namespace hf_cand_xic0_omegac0 +{ +enum DecayType { + XiczeroToXiPi = 0, + OmegaczeroToXiPi, + OmegaczeroToOmegaPi, + OmegaczeroToOmegaK, + OmegaczeroToOmegaPiOneMu +}; +} // namespace hf_cand_xic0_omegac0 + +namespace hf_cand_xic_to_xi_pi_pi +{ +enum DecayType { + XicToXiPiPi = 0, // Ξc± → Ξ∓ π± π± + XicToXiResPiToXiPiPi, // Ξc± → Ξ(1530) π± → Ξ∓ π± π± + NDecayType +}; +} // namespace hf_cand_xic_to_xi_pi_pi + +namespace hf_cand_dstar +{ +enum DecayType { + DstarToD0Pi = 0, + D0ToPiK, + DstarToD0PiPi0, + D0ToPiKPi0, + NDstarDecayType +}; +} // namespace hf_cand_dstar + +namespace hf_cand_sigmac +{ +enum DecayType { + Sc0ToPKPiPi = 0, + ScplusplusToPKPiPi, + ScStar0ToPKPiPi, + ScStarPlusPlusToPKPiPi +}; +} // namespace hf_cand_sigmac + +namespace hf_cand_b0 +{ +enum DecayType { + B0ToDPi = 0, + B0ToDstarPi +}; +} // namespace hf_cand_b0 + +namespace hf_cand_bplus +{ +enum DecayType { + BplusToD0Pi = 0 +}; +} // namespace hf_cand_bplus + +namespace hf_cand_bs +{ +enum DecayType { + BsToDsPi = 0 +}; +} // namespace hf_cand_bs + +namespace hf_cand_lb +{ +enum DecayType { + LbToLcPi +}; +} // namespace hf_cand_lb + +} // namespace o2::aod + +#endif // PWGHF_CORE_DECAYCHANNELSLEGACY_H_ diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx index bc208719ee6..2604d089159 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx @@ -19,12 +19,15 @@ /// \author Biao Zhang , Heidelberg University #include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/Core/DecayChannelsLegacy.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" #include "PWGHF/D2H/DataModel/ReducedDataModel.h" #include "PWGHF/D2H/Utils/utilsRedDataFormat.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/Utils/utilsEvSelHf.h" #include "PWGHF/Utils/utilsTrkCandHf.h" diff --git a/PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx index 4778fcc168e..88ef350c2b2 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx @@ -21,8 +21,10 @@ #include "PWGHF/Core/SelectorCuts.h" #include "PWGHF/D2H/DataModel/ReducedDataModel.h" #include "PWGHF/D2H/Utils/utilsRedDataFormat.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/Utils/utilsEvSelHf.h" #include "PWGHF/Utils/utilsTrkCandHf.h" diff --git a/PWGHF/D2H/Tasks/taskB0.cxx b/PWGHF/D2H/Tasks/taskB0.cxx index 54effeb26ea..02bb5254368 100644 --- a/PWGHF/D2H/Tasks/taskB0.cxx +++ b/PWGHF/D2H/Tasks/taskB0.cxx @@ -17,6 +17,7 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" diff --git a/PWGHF/D2H/Tasks/taskBplus.cxx b/PWGHF/D2H/Tasks/taskBplus.cxx index 9b619329d25..3f9e31f222c 100644 --- a/PWGHF/D2H/Tasks/taskBplus.cxx +++ b/PWGHF/D2H/Tasks/taskBplus.cxx @@ -21,6 +21,7 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" diff --git a/PWGHF/D2H/Tasks/taskBs.cxx b/PWGHF/D2H/Tasks/taskBs.cxx index 6d41a59ba82..ea2047a5342 100644 --- a/PWGHF/D2H/Tasks/taskBs.cxx +++ b/PWGHF/D2H/Tasks/taskBs.cxx @@ -18,6 +18,7 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" diff --git a/PWGHF/D2H/Tasks/taskCd.cxx b/PWGHF/D2H/Tasks/taskCd.cxx index 7684e03ed0e..c9590739f5d 100644 --- a/PWGHF/D2H/Tasks/taskCd.cxx +++ b/PWGHF/D2H/Tasks/taskCd.cxx @@ -18,6 +18,7 @@ #include "PWGHF/Core/SelectorCuts.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" diff --git a/PWGHF/D2H/Tasks/taskD0.cxx b/PWGHF/D2H/Tasks/taskD0.cxx index a64369339ea..c583b302dff 100644 --- a/PWGHF/D2H/Tasks/taskD0.cxx +++ b/PWGHF/D2H/Tasks/taskD0.cxx @@ -19,8 +19,10 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/Utils/utilsEvSelHf.h" #include "Common/CCDB/ctpRateFetcher.h" diff --git a/PWGHF/D2H/Tasks/taskDplus.cxx b/PWGHF/D2H/Tasks/taskDplus.cxx index 7a4851d4766..e3885fdceb2 100644 --- a/PWGHF/D2H/Tasks/taskDplus.cxx +++ b/PWGHF/D2H/Tasks/taskDplus.cxx @@ -23,6 +23,7 @@ #include "PWGHF/Core/SelectorCuts.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/Utils/utilsAnalysis.h" #include "PWGHF/Utils/utilsEvSelHf.h" diff --git a/PWGHF/D2H/Tasks/taskDs.cxx b/PWGHF/D2H/Tasks/taskDs.cxx index eb93b29ba17..7c26c349a58 100644 --- a/PWGHF/D2H/Tasks/taskDs.cxx +++ b/PWGHF/D2H/Tasks/taskDs.cxx @@ -20,8 +20,10 @@ #include "PWGHF/Core/CentralityEstimation.h" #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/Utils/utilsAnalysis.h" #include "PWGHF/Utils/utilsEvSelHf.h" diff --git a/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx b/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx index f5a3884f5fa..7bc69aaaf0f 100644 --- a/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx +++ b/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx @@ -19,6 +19,7 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" diff --git a/PWGHF/D2H/Tasks/taskLb.cxx b/PWGHF/D2H/Tasks/taskLb.cxx index feb4444386d..dda79b2bd46 100644 --- a/PWGHF/D2H/Tasks/taskLb.cxx +++ b/PWGHF/D2H/Tasks/taskLb.cxx @@ -18,6 +18,7 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" diff --git a/PWGHF/D2H/Tasks/taskLc.cxx b/PWGHF/D2H/Tasks/taskLc.cxx index 5e9b3f5f973..5d28e17251b 100644 --- a/PWGHF/D2H/Tasks/taskLc.cxx +++ b/PWGHF/D2H/Tasks/taskLc.cxx @@ -24,8 +24,10 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/Utils/utilsEvSelHf.h" #include "PWGUD/Core/UPCHelpers.h" diff --git a/PWGHF/D2H/Tasks/taskLcToK0sP.cxx b/PWGHF/D2H/Tasks/taskLcToK0sP.cxx index 955331e6d3f..7118cfedb38 100644 --- a/PWGHF/D2H/Tasks/taskLcToK0sP.cxx +++ b/PWGHF/D2H/Tasks/taskLcToK0sP.cxx @@ -19,6 +19,7 @@ #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" diff --git a/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx b/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx index 8a92286c42c..c96372c8b8d 100644 --- a/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx +++ b/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx @@ -15,9 +15,11 @@ /// \author Fabio Catalano , University of Houston #include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/Core/DecayChannelsLegacy.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGLF/DataModel/mcCentrality.h" #include "Common/Core/RecoDecay.h" diff --git a/PWGHF/D2H/Tasks/taskSigmac.cxx b/PWGHF/D2H/Tasks/taskSigmac.cxx index e6e9fbe4e1f..0301ed5662e 100644 --- a/PWGHF/D2H/Tasks/taskSigmac.cxx +++ b/PWGHF/D2H/Tasks/taskSigmac.cxx @@ -16,8 +16,10 @@ /// \author Mattia Faggin , University and INFN PADOVA #include "PWGHF/Core/DecayChannels.h" +#include "PWGHF/Core/DecayChannelsLegacy.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/D2H/Utils/utilsSigmac.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" diff --git a/PWGHF/D2H/Tasks/taskXic.cxx b/PWGHF/D2H/Tasks/taskXic.cxx index 4d517f9fdfb..cfe5c9d4b75 100644 --- a/PWGHF/D2H/Tasks/taskXic.cxx +++ b/PWGHF/D2H/Tasks/taskXic.cxx @@ -22,8 +22,10 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "Common/Core/RecoDecay.h" diff --git a/PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx b/PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx index cccd82fce67..5bf3f321076 100644 --- a/PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx +++ b/PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx @@ -15,6 +15,7 @@ /// \author Ran Tu , Fudan University #include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/Core/DecayChannelsLegacy.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" diff --git a/PWGHF/D2H/Tasks/taskXicToXiPiPi.cxx b/PWGHF/D2H/Tasks/taskXicToXiPiPi.cxx index 79853e9dc46..256fd600a69 100644 --- a/PWGHF/D2H/Tasks/taskXicToXiPiPi.cxx +++ b/PWGHF/D2H/Tasks/taskXicToXiPiPi.cxx @@ -17,7 +17,9 @@ /// \author Carolina Reetz , Heidelberg University /// \author Jaeyoon Cho , Inha University +#include "PWGHF/Core/DecayChannelsLegacy.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" diff --git a/PWGHF/D2H/Tasks/taskXicc.cxx b/PWGHF/D2H/Tasks/taskXicc.cxx index 2c8e6fcd789..35e18de7ba5 100644 --- a/PWGHF/D2H/Tasks/taskXicc.cxx +++ b/PWGHF/D2H/Tasks/taskXicc.cxx @@ -16,8 +16,10 @@ /// \author Gian Michele Innocenti , CERN /// \author Jinjoo Seo , Inha University +#include "PWGHF/ALICE3/Core/DecayChannelsLegacy.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" diff --git a/PWGHF/DataModel/AliasTables.h b/PWGHF/DataModel/AliasTables.h new file mode 100644 index 00000000000..37e396770db --- /dev/null +++ b/PWGHF/DataModel/AliasTables.h @@ -0,0 +1,57 @@ +// 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 AliasTables.h +/// \brief Table aliases +/// +/// \author Gian Michele Innocenti , CERN +/// \author Vít Kučera , CERN + +#ifndef PWGHF_DATAMODEL_ALIASTABLES_H_ +#define PWGHF_DATAMODEL_ALIASTABLES_H_ + +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include + +namespace o2::aod +{ +using BcFullInfos = soa::Join; + +using TracksWCov = soa::Join; +using TracksWDca = soa::Join; +using TracksWExtra = soa::Join; +using TracksWCovDca = soa::Join; +using TracksWCovExtra = soa::Join; +using TracksWDcaExtra = soa::Join; +using TracksWCovDcaExtra = soa::Join; + +using TracksWMc = soa::Join; + +using TracksPidEl = soa::Join; +using TracksPidMu = soa::Join; +using TracksPidPi = soa::Join; +using TracksPidKa = soa::Join; +using TracksPidPr = soa::Join; +using TracksPidDe = soa::Join; + +using TracksPidTinyEl = soa::Join; +using TracksPidTinyMu = soa::Join; +using TracksPidTinyPi = soa::Join; +using TracksPidTinyKa = soa::Join; +using TracksPidTinyPr = soa::Join; +using TracksPidTinyDe = soa::Join; +} // namespace o2::aod + +#endif // PWGHF_DATAMODEL_ALIASTABLES_H_ diff --git a/PWGHF/DataModel/CandidateReconstructionTables.h b/PWGHF/DataModel/CandidateReconstructionTables.h index deb6644cf25..5bc4cc45c1c 100644 --- a/PWGHF/DataModel/CandidateReconstructionTables.h +++ b/PWGHF/DataModel/CandidateReconstructionTables.h @@ -18,17 +18,13 @@ #ifndef PWGHF_DATAMODEL_CANDIDATERECONSTRUCTIONTABLES_H_ #define PWGHF_DATAMODEL_CANDIDATERECONSTRUCTIONTABLES_H_ -#include "PWGHF/Utils/utilsEvSelHf.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/Utils/utilsPid.h" // #include "PWGLF/DataModel/LFStrangenessTables.h" #include "ALICE3/DataModel/ECAL.h" #include "Common/Core/RecoDecay.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/PIDResponseTOF.h" -#include "Common/DataModel/PIDResponseTPC.h" -#include "Common/DataModel/TrackSelectionTables.h" #include #include @@ -36,120 +32,9 @@ #include #include -#include namespace o2::aod { -// Table aliases -using BcFullInfos = soa::Join; - -using TracksWCov = soa::Join; -using TracksWDca = soa::Join; -using TracksWExtra = soa::Join; -using TracksWCovDca = soa::Join; -using TracksWCovExtra = soa::Join; -using TracksWDcaExtra = soa::Join; -using TracksWCovDcaExtra = soa::Join; - -using TracksWMc = soa::Join; - -using TracksPidEl = soa::Join; -using TracksPidMu = soa::Join; -using TracksPidPi = soa::Join; -using TracksPidKa = soa::Join; -using TracksPidPr = soa::Join; -using TracksPidDe = soa::Join; - -using TracksPidTinyEl = soa::Join; -using TracksPidTinyMu = soa::Join; -using TracksPidTinyPi = soa::Join; -using TracksPidTinyKa = soa::Join; -using TracksPidTinyPr = soa::Join; -using TracksPidTinyDe = soa::Join; - -// namespace pid_tpc_tof_utils -// { -// /// Function to combine TPC and TOF NSigma (for ML purposes) -// /// \param tpcNSigma is the (binned) NSigma separation in TPC (if tiny = true) -// /// \param tofNSigma is the (binned) NSigma separation in TOF (if tiny = true) -// /// \return Node containing the combined NSigma of TPC and TOF -// template -// o2::framework::expressions::Node combineNSigma(const T1& tpcNSigma, const T1& tofNSigma) -// { -// float defaultNSigmaTolerance = .1f; -// float defaultNSigma = -999.f + defaultNSigmaTolerance; // -999.f is the default value set in TPCPIDResponse.h and PIDTOF.h - -// if constexpr (tiny) { -// auto tpcBinWidth = 1.f * pidtpc_tiny::binning::bin_width; -// auto tofBinWidth = 1.f * pidtof_tiny::binning::bin_width; - -// return o2::framework::expressions::ifnode((tpcNSigma * tpcBinWidth > defaultNSigma) && (tofNSigma * tofBinWidth > defaultNSigma), o2::framework::expressions::nsqrt(.5f * tpcNSigma * tpcNSigma * tpcBinWidth * tpcBinWidth + .5f * tofNSigma * tofNSigma * tofBinWidth * tofBinWidth), // TPC and TOF -// o2::framework::expressions::ifnode(tpcNSigma * tpcBinWidth > defaultNSigma, o2::framework::expressions::nabs(tpcNSigma * tpcBinWidth), // only TPC -// o2::framework::expressions::ifnode(tofNSigma * tofBinWidth > defaultNSigma, o2::framework::expressions::nabs(tofNSigma * tofBinWidth), // only TOF -// 1.f * tofNSigma * tofBinWidth))); // no TPC nor TOF -// } - -// return o2::framework::expressions::ifnode((tpcNSigma > defaultNSigma) && (tofNSigma > defaultNSigma), o2::framework::expressions::nsqrt(.5f * tpcNSigma * tpcNSigma + .5f * tofNSigma * tofNSigma), // TPC and TOF -// o2::framework::expressions::ifnode(tpcNSigma > defaultNSigma, o2::framework::expressions::nabs(tpcNSigma), // only TPC -// o2::framework::expressions::ifnode(tofNSigma > defaultNSigma, o2::framework::expressions::nabs(tofNSigma), // only TOF -// 1.f * tofNSigma))); // no TPC nor TOF -// } -// } // namespace pid_tpc_tof_utils - -// namespace pid_tpc_tof_full -// { -// // Combined TPC and TOF NSigma -// DECLARE_SOA_EXPRESSION_COLUMN(TpcTofNSigmaEl, tpcTofNSigmaEl, //! Combined NSigma separation with the TPC & TOF detectors for electron -// float, pid_tpc_tof_utils::combineNSigma(o2::aod::pidtpc::tpcNSigmaEl, o2::aod::pidtof::tofNSigmaEl)); -// DECLARE_SOA_EXPRESSION_COLUMN(TpcTofNSigmaMu, tpcTofNSigmaMu, //! Combined NSigma separation with the TPC & TOF detectors for muon -// float, pid_tpc_tof_utils::combineNSigma(o2::aod::pidtpc::tpcNSigmaMu, o2::aod::pidtof::tofNSigmaMu)); -// DECLARE_SOA_EXPRESSION_COLUMN(TpcTofNSigmaPi, tpcTofNSigmaPi, //! Combined NSigma separation with the TPC & TOF detectors for pion -// float, pid_tpc_tof_utils::combineNSigma(o2::aod::pidtpc::tpcNSigmaPi, o2::aod::pidtof::tofNSigmaPi)); -// DECLARE_SOA_EXPRESSION_COLUMN(TpcTofNSigmaKa, tpcTofNSigmaKa, //! Combined NSigma separation with the TPC & TOF detectors for kaon -// float, pid_tpc_tof_utils::combineNSigma(o2::aod::pidtpc::tpcNSigmaKa, o2::aod::pidtof::tofNSigmaKa)); -// DECLARE_SOA_EXPRESSION_COLUMN(TpcTofNSigmaPr, tpcTofNSigmaPr, //! Combined NSigma separation with the TPC & TOF detectors for proton -// float, pid_tpc_tof_utils::combineNSigma(o2::aod::pidtpc::tpcNSigmaPr, o2::aod::pidtof::tofNSigmaPr)); -// } // namespace pid_tpc_tof_full - -// namespace pid_tpc_tof_tiny -// { -// // Combined binned TPC and TOF NSigma -// DECLARE_SOA_EXPRESSION_COLUMN(TpcTofNSigmaEl, tpcTofNSigmaEl, //! Combined binned NSigma separation with the TPC & TOF detectors for electron -// float, pid_tpc_tof_utils::combineNSigma(o2::aod::pidtpc_tiny::tpcNSigmaStoreEl, o2::aod::pidtof_tiny::tofNSigmaStoreEl)); -// DECLARE_SOA_EXPRESSION_COLUMN(TpcTofNSigmaMu, tpcTofNSigmaMu, //! Combined binned NSigma separation with the TPC & TOF detectors for muon -// float, pid_tpc_tof_utils::combineNSigma(o2::aod::pidtpc_tiny::tpcNSigmaStoreMu, o2::aod::pidtof_tiny::tofNSigmaStoreMu)); -// DECLARE_SOA_EXPRESSION_COLUMN(TpcTofNSigmaPi, tpcTofNSigmaPi, //! Combined binned NSigma separation with the TPC & TOF detectors for pion -// float, pid_tpc_tof_utils::combineNSigma(o2::aod::pidtpc_tiny::tpcNSigmaStorePi, o2::aod::pidtof_tiny::tofNSigmaStorePi)); -// DECLARE_SOA_EXPRESSION_COLUMN(TpcTofNSigmaKa, tpcTofNSigmaKa, //! Combined binned NSigma separation with the TPC & TOF detectors for kaon -// float, pid_tpc_tof_utils::combineNSigma(o2::aod::pidtpc_tiny::tpcNSigmaStoreKa, o2::aod::pidtof_tiny::tofNSigmaStoreKa)); -// DECLARE_SOA_EXPRESSION_COLUMN(TpcTofNSigmaPr, tpcTofNSigmaPr, //! Combined binned NSigma separation with the TPC & TOF detectors for proton -// float, pid_tpc_tof_utils::combineNSigma(o2::aod::pidtpc_tiny::tpcNSigmaStorePr, o2::aod::pidtof_tiny::tofNSigmaStorePr)); -// } // namespace pid_tpc_tof_tiny - -// // Extension of per particle tables -// DECLARE_SOA_EXTENDED_TABLE_USER(TracksPidElExt, TracksPidEl, "PIDELEXT", //! Table of the TPC & TOF Combined NSigma for electron -// pid_tpc_tof_full::TpcTofNSigmaEl); -// DECLARE_SOA_EXTENDED_TABLE_USER(TracksPidMuExt, TracksPidMu, "PIDMUEXT", //! Table of the TPC & TOF Combined NSigma for muon -// pid_tpc_tof_full::TpcTofNSigmaMu); -// DECLARE_SOA_EXTENDED_TABLE_USER(TracksPidPiExt, TracksPidPi, "PIDPIEXT", //! Table of the TPC & TOF Combined NSigma for pion -// pid_tpc_tof_full::TpcTofNSigmaPi); -// DECLARE_SOA_EXTENDED_TABLE_USER(TracksPidKaExt, TracksPidKa, "PIDKAEXT", //! Table of the TPC & TOF Combined NSigma for kaon -// pid_tpc_tof_full::TpcTofNSigmaKa); -// DECLARE_SOA_EXTENDED_TABLE_USER(TracksPidPrExt, TracksPidPr, "PIDPREXT", //! Table of the TPC & TOF Combined NSigma for proton -// pid_tpc_tof_full::TpcTofNSigmaPr); - -// // Extension of tiny size tables -// DECLARE_SOA_EXTENDED_TABLE_USER(TracksPidTinyElExt, TracksPidTinyEl, "PIDTINYELEXT", //! Table of the TPC & TOF combined binned NSigma for electron -// pid_tpc_tof_tiny::TpcTofNSigmaEl); -// DECLARE_SOA_EXTENDED_TABLE_USER(TracksPidTinyMuExt, TracksPidTinyMu, "PIDTINYMUEXT", //! Table of the TPC & TOF combined binned NSigma for muon -// pid_tpc_tof_tiny::TpcTofNSigmaMu); -// DECLARE_SOA_EXTENDED_TABLE_USER(TracksPidTinyPiExt, TracksPidTinyPi, "PIDTINYPIEXT", //! Table of the TPC & TOF combined binned NSigma for pion -// pid_tpc_tof_tiny::TpcTofNSigmaPi); -// DECLARE_SOA_EXTENDED_TABLE_USER(TracksPidTinyKaExt, TracksPidTinyKa, "PIDTINYKAEXT", //! Table of the TPC & TOF combined binned NSigma for kaon -// pid_tpc_tof_tiny::TpcTofNSigmaKa); -// DECLARE_SOA_EXTENDED_TABLE_USER(TracksPidTinyPrExt, TracksPidTinyPr, "PIDTINYPREXT", //! Table of the TPC & TOF combined binned NSigma for proton -// pid_tpc_tof_tiny::TpcTofNSigmaPr); - namespace pid_tpc_tof_static_full { // Combined TPC and TOF NSigma @@ -200,238 +85,6 @@ DECLARE_SOA_TABLE(PidTpcTofTinyPr, "AOD", "PIDTPCTOFTINYPR", //! Table of the TP DECLARE_SOA_TABLE(PidTpcTofTinyDe, "AOD", "PIDTPCTOFTINYDE", //! Table of the TPC & TOF Combined NSigma for deuteron pid_tpc_tof_static_tiny::TpcTofNSigmaDe); -namespace hf_sel_collision -{ -DECLARE_SOA_COLUMN(WhyRejectColl, whyRejectColl, o2::hf_evsel::HfCollisionRejectionMask); //! -} // namespace hf_sel_collision - -DECLARE_SOA_TABLE(HfSelCollision, "AOD", "HFSELCOLLISION", //! - hf_sel_collision::WhyRejectColl); - -namespace hf_sel_track -{ -DECLARE_SOA_COLUMN(IsSelProng, isSelProng, uint32_t); //! -DECLARE_SOA_COLUMN(IsIdentifiedPid, isIdentifiedPid, uint32_t); //! -DECLARE_SOA_COLUMN(IsPositive, isPositive, bool); //! -} // namespace hf_sel_track - -DECLARE_SOA_TABLE(HfSelTrack, "AOD", "HFSELTRACK", //! - hf_sel_track::IsSelProng, - hf_sel_track::IsIdentifiedPid, - hf_sel_track::IsPositive); - -namespace hf_pv_refit_track -{ -DECLARE_SOA_COLUMN(PvRefitX, pvRefitX, float); //! -DECLARE_SOA_COLUMN(PvRefitY, pvRefitY, float); //! -DECLARE_SOA_COLUMN(PvRefitZ, pvRefitZ, float); //! -DECLARE_SOA_COLUMN(PvRefitSigmaX2, pvRefitSigmaX2, float); //! -DECLARE_SOA_COLUMN(PvRefitSigmaXY, pvRefitSigmaXY, float); //! -DECLARE_SOA_COLUMN(PvRefitSigmaY2, pvRefitSigmaY2, float); //! -DECLARE_SOA_COLUMN(PvRefitSigmaXZ, pvRefitSigmaXZ, float); //! -DECLARE_SOA_COLUMN(PvRefitSigmaYZ, pvRefitSigmaYZ, float); //! -DECLARE_SOA_COLUMN(PvRefitSigmaZ2, pvRefitSigmaZ2, float); //! -DECLARE_SOA_COLUMN(PvRefitDcaXY, pvRefitDcaXY, float); //! -DECLARE_SOA_COLUMN(PvRefitDcaZ, pvRefitDcaZ, float); //! -} // namespace hf_pv_refit_track - -DECLARE_SOA_TABLE(HfPvRefitTrack, "AOD", "HFPVREFITTRACK", //! - hf_pv_refit_track::PvRefitX, - hf_pv_refit_track::PvRefitY, - hf_pv_refit_track::PvRefitZ, - hf_pv_refit_track::PvRefitSigmaX2, - hf_pv_refit_track::PvRefitSigmaXY, - hf_pv_refit_track::PvRefitSigmaY2, - hf_pv_refit_track::PvRefitSigmaXZ, - hf_pv_refit_track::PvRefitSigmaYZ, - hf_pv_refit_track::PvRefitSigmaZ2, - hf_pv_refit_track::PvRefitDcaXY, - hf_pv_refit_track::PvRefitDcaZ); - -namespace hf_track_index -{ -DECLARE_SOA_INDEX_COLUMN(Collision, collision); //! Collision index -DECLARE_SOA_INDEX_COLUMN_FULL(Prong0, prong0, int, Tracks, "_0"); //! Index to first prong -DECLARE_SOA_INDEX_COLUMN_FULL(Prong1, prong1, int, Tracks, "_1"); //! Index to second prong -DECLARE_SOA_INDEX_COLUMN_FULL(Prong2, prong2, int, Tracks, "_2"); //! Index to third prong -DECLARE_SOA_INDEX_COLUMN_FULL(Prong3, prong3, int, Tracks, "_3"); //! Index to fourth prong -DECLARE_SOA_INDEX_COLUMN_FULL(Prong4, prong4, int, Tracks, "_4"); //! Index to fifth prong -DECLARE_SOA_INDEX_COLUMN(V0, v0); //! Index to V0 prong -DECLARE_SOA_INDEX_COLUMN(Cascade, cascade); //! Index to cascade prong -DECLARE_SOA_COLUMN(HFflag, hfflag, uint8_t); //! Bitmap to store selection results, o2-linter: disable=name/o2-column (written to disk) - -DECLARE_SOA_COLUMN(FlagD0ToKPi, flagD0ToKPi, uint8_t); //! -DECLARE_SOA_COLUMN(FlagJpsiToEE, flagJpsiToEE, uint8_t); //! -DECLARE_SOA_COLUMN(FlagJpsiToMuMu, flagJpsiToMuMu, uint8_t); //! - -DECLARE_SOA_COLUMN(FlagDplusToPiKPi, flagDplusToPiKPi, uint8_t); //! -DECLARE_SOA_COLUMN(FlagLcToPKPi, flagLcToPKPi, uint8_t); //! -DECLARE_SOA_COLUMN(FlagDsToKKPi, flagDsToKKPi, uint8_t); //! -DECLARE_SOA_COLUMN(FlagXicToPKPi, flagXicToPKPi, uint8_t); //! - -DECLARE_SOA_COLUMN(FlagDstarToD0Pi, flagDstarToD0Pi, uint8_t); //! - -DECLARE_SOA_COLUMN(MlProbSkimD0ToKPi, mlProbSkimD0ToKPi, std::vector); //! ML probabilities (background, prompt, non-prompt) for D0->Kpi -DECLARE_SOA_COLUMN(MlProbSkimDplusToPiKPi, mlProbSkimDplusToPiKPi, std::vector); //! ML probabilities (background, prompt, non-prompt) for D+->Kpipi -DECLARE_SOA_COLUMN(MlProbSkimDsToKKPi, mlProbSkimDsToKKPi, std::vector); //! ML probabilities (background, prompt, non-prompt) for Ds->KKpi -DECLARE_SOA_COLUMN(MlProbSkimLcToPKPi, mlProbSkimLcToPKPi, std::vector); //! ML probabilities (background, prompt, non-prompt) for Lc->pKpi -DECLARE_SOA_COLUMN(MlProbSkimXicToPKPi, mlProbSkimXicToPKPi, std::vector); //! ML probabilities (background, prompt, non-prompt) for Xic->pKpi -} // namespace hf_track_index - -DECLARE_SOA_TABLE(Hf2Prongs_000, "AOD", "HF2PRONG", //! Table for HF 2 prong candidates (Run 2 converted format) - o2::soa::Index<>, - hf_track_index::Prong0Id, - hf_track_index::Prong1Id, - hf_track_index::HFflag); - -DECLARE_SOA_TABLE_VERSIONED(Hf2Prongs_001, "AOD", "HF2PRONG", 1, //! Table for HF 2 prong candidates (Run 3 format) - o2::soa::Index<>, - hf_track_index::CollisionId, - hf_track_index::Prong0Id, - hf_track_index::Prong1Id, - hf_track_index::HFflag); - -using Hf2Prongs = Hf2Prongs_001; -using Hf2Prong = Hf2Prongs::iterator; - -DECLARE_SOA_TABLE(HfCascades_000, "AOD", "HFCASCADE", //! Table for HF candidates with a V0 (Run 2 converted format) - o2::soa::Index<>, - hf_track_index::Prong0Id, - hf_track_index::V0Id); - -DECLARE_SOA_TABLE_VERSIONED(HfCascades_001, "AOD", "HFCASCADE", 1, //! Table for HF candidates with a V0 (Run 3 format) - o2::soa::Index<>, - hf_track_index::CollisionId, - hf_track_index::Prong0Id, - hf_track_index::V0Id); - -using HfCascades = HfCascades_001; -using HfCascade = HfCascades::iterator; - -DECLARE_SOA_TABLE(Hf3Prongs_000, "AOD", "HF3PRONG", //! Table for HF 3 prong candidates (Run 2 converted format) - o2::soa::Index<>, - hf_track_index::Prong0Id, - hf_track_index::Prong1Id, - hf_track_index::Prong2Id, - hf_track_index::HFflag); - -DECLARE_SOA_TABLE_VERSIONED(Hf3Prongs_001, "AOD", "HF3PRONG", 1, //! Table for HF 3 prong candidates (Run 3 format) - o2::soa::Index<>, - hf_track_index::CollisionId, - hf_track_index::Prong0Id, - hf_track_index::Prong1Id, - hf_track_index::Prong2Id, - hf_track_index::HFflag); - -using Hf3Prongs = Hf3Prongs_001; -using Hf3Prong = Hf3Prongs::iterator; - -DECLARE_SOA_TABLE(HfCascLf2Prongs, "AOD", "HFCASCLF2PRONG", //! Table for HF 2 prong candidates with a Cascade - o2::soa::Index<>, - hf_track_index::CollisionId, - hf_track_index::CascadeId, - hf_track_index::Prong0Id, - hf_track_index::HFflag); -using HfCascLf2Prong = HfCascLf2Prongs::iterator; - -DECLARE_SOA_TABLE(HfCascLf3Prongs, "AOD", "HFCASCLF3PRONG", //! Table for HF 3 prong candidates with a Cascade - o2::soa::Index<>, - hf_track_index::CollisionId, - hf_track_index::CascadeId, - hf_track_index::Prong0Id, - hf_track_index::Prong1Id); -using HfCascLf3Prong = HfCascLf3Prongs::iterator; - -namespace hf_track_index -{ -DECLARE_SOA_INDEX_COLUMN_FULL(ProngD0, prongD0, int, Hf2Prongs, ""); //! Index to a D0 prong -} // namespace hf_track_index - -DECLARE_SOA_TABLE(HfDstars_000, "AOD", "HFDSTAR", //! D* -> D0pi candidates (Run 2 converted format) - o2::soa::Index<>, - hf_track_index::Prong0Id, - hf_track_index::ProngD0Id); - -DECLARE_SOA_TABLE_VERSIONED(HfDstars_001, "AOD", "HFDSTAR", 1, //! D* -> D0pi candidates (Run 3 format) - o2::soa::Index<>, - hf_track_index::CollisionId, - hf_track_index::Prong0Id, - hf_track_index::ProngD0Id); - -using HfDstars = HfDstars_001; -using HfDstar = HfDstars::iterator; - -DECLARE_SOA_TABLE(HfCutStatus2Prong, "AOD", "HFCUTSTATUS2P", //! - hf_track_index::FlagD0ToKPi, - hf_track_index::FlagJpsiToEE, - hf_track_index::FlagJpsiToMuMu); - -DECLARE_SOA_TABLE(HfCutStatus3Prong, "AOD", "HFCUTSTATUS3P", //! - hf_track_index::FlagDplusToPiKPi, - hf_track_index::FlagLcToPKPi, - hf_track_index::FlagDsToKKPi, - hf_track_index::FlagXicToPKPi); - -DECLARE_SOA_TABLE(HfCutStatusDstar, "AOD", "HFCUTSTATUSDST", //! - hf_track_index::FlagDstarToD0Pi); - -DECLARE_SOA_TABLE(Hf2ProngMlProbs, "AOD", "HF2PRONGMLPROB", //! Table for ML scores of HF 2 prong candidates - hf_track_index::MlProbSkimD0ToKPi); - -DECLARE_SOA_TABLE(Hf3ProngMlProbs, "AOD", "HF3PRONGMLPROB", //! Table for ML scores of HF 3 prong candidates - hf_track_index::MlProbSkimDplusToPiKPi, - hf_track_index::MlProbSkimLcToPKPi, - hf_track_index::MlProbSkimDsToKKPi, - hf_track_index::MlProbSkimXicToPKPi); - -namespace hf_pv_refit -{ -DECLARE_SOA_COLUMN(PvRefitX, pvRefitX, float); //! -DECLARE_SOA_COLUMN(PvRefitY, pvRefitY, float); //! -DECLARE_SOA_COLUMN(PvRefitZ, pvRefitZ, float); //! -DECLARE_SOA_COLUMN(PvRefitSigmaX2, pvRefitSigmaX2, float); //! -DECLARE_SOA_COLUMN(PvRefitSigmaXY, pvRefitSigmaXY, float); //! -DECLARE_SOA_COLUMN(PvRefitSigmaY2, pvRefitSigmaY2, float); //! -DECLARE_SOA_COLUMN(PvRefitSigmaXZ, pvRefitSigmaXZ, float); //! -DECLARE_SOA_COLUMN(PvRefitSigmaYZ, pvRefitSigmaYZ, float); //! -DECLARE_SOA_COLUMN(PvRefitSigmaZ2, pvRefitSigmaZ2, float); //! -} // namespace hf_pv_refit - -DECLARE_SOA_TABLE(HfPvRefit2Prong, "AOD", "HFPVREFIT2PRONG", //! - hf_pv_refit::PvRefitX, - hf_pv_refit::PvRefitY, - hf_pv_refit::PvRefitZ, - hf_pv_refit::PvRefitSigmaX2, - hf_pv_refit::PvRefitSigmaXY, - hf_pv_refit::PvRefitSigmaY2, - hf_pv_refit::PvRefitSigmaXZ, - hf_pv_refit::PvRefitSigmaYZ, - hf_pv_refit::PvRefitSigmaZ2); - -DECLARE_SOA_TABLE(HfPvRefit3Prong, "AOD", "HFPVREFIT3PRONG", //! - hf_pv_refit::PvRefitX, - hf_pv_refit::PvRefitY, - hf_pv_refit::PvRefitZ, - hf_pv_refit::PvRefitSigmaX2, - hf_pv_refit::PvRefitSigmaXY, - hf_pv_refit::PvRefitSigmaY2, - hf_pv_refit::PvRefitSigmaXZ, - hf_pv_refit::PvRefitSigmaYZ, - hf_pv_refit::PvRefitSigmaZ2, - o2::soa::Marker<1>); - -DECLARE_SOA_TABLE(HfPvRefitDstar, "AOD", "HFPVREFITDSTAR", //! - hf_pv_refit::PvRefitX, - hf_pv_refit::PvRefitY, - hf_pv_refit::PvRefitZ, - hf_pv_refit::PvRefitSigmaX2, - hf_pv_refit::PvRefitSigmaXY, - hf_pv_refit::PvRefitSigmaY2, - hf_pv_refit::PvRefitSigmaXZ, - hf_pv_refit::PvRefitSigmaYZ, - hf_pv_refit::PvRefitSigmaZ2, - o2::soa::Marker<2>); - // general decay properties namespace hf_cand { @@ -673,12 +326,6 @@ DECLARE_SOA_COLUMN(FlagMcDecayChanGen, flagMcDecayChanGen, int8_t); //! resonant DECLARE_SOA_COLUMN(KfGeoMassD0, kfGeoMassD0, float); //! mass of the D0 candidate from the KFParticle geometric fit DECLARE_SOA_COLUMN(KfGeoMassD0bar, kfGeoMassD0bar, float); //! mass of the D0bar candidate from the KFParticle geometric fit -// mapping of decay types -enum DecayType { D0ToPiK = 0, - JpsiToEE, - JpsiToMuMu, - N2ProngDecays }; // always keep N2ProngDecays at the end - } // namespace hf_cand_2prong // general columns @@ -897,8 +544,6 @@ DECLARE_SOA_DYNAMIC_COLUMN(ImpactParameterProduct, impactParameterProduct, // Im DECLARE_SOA_DYNAMIC_COLUMN(ImpactParameterProductJpsi, impactParameterProductJpsi, // J/Psi impact parameter for B+ -> J/Psi K [](float dcaDauPos, float dcaDauNeg) -> float { return dcaDauPos * dcaDauNeg; }); -enum DecayType { BplusToD0Pi = 0 }; - enum DecayTypeMc : uint8_t { BplusToD0PiToKPiPi = 0, BplusToD0KToKPiK, PartlyRecoDecay, @@ -996,14 +641,6 @@ DECLARE_SOA_COLUMN(IsCandidateSwapped, isCandidateSwapped, int8_t); //! swapping DECLARE_SOA_COLUMN(FlagMcDecayChanRec, flagMcDecayChanRec, int8_t); //! resonant decay channel flag, reconstruction level DECLARE_SOA_COLUMN(FlagMcDecayChanGen, flagMcDecayChanGen, int8_t); //! resonant decay channel flag, generator level -// mapping of decay types -enum DecayType { DplusToPiKPi = 0, - LcToPKPi, - DsToKKPi, - XicToPKPi, - CdToDeKPi, - N3ProngDecays }; // always keep N3ProngDecays at the end - // Ds± → K± K∓ π± or D± → K± K∓ π± enum DecayChannelDToKKPi { @@ -1216,17 +853,9 @@ using HfCandBplusToJpsi = soa::Join; namespace hf_cand_casc_lf { -// mapping of decay types -enum DecayType2Prong { XiczeroOmegaczeroToXiPi = 0, - OmegaczeroToOmegaPi, - OmegaczeroToOmegaK, - N2ProngDecays }; // always keep N2ProngDecays at the end // mapping of construct method enum ConstructMethod { DcaFitter = 0, KfParticle }; -// mapping of decay types -enum DecayType3Prong { XicplusToXiPiPi = 0, - N3ProngDecays }; // always keep N3ProngDecays at the end } // namespace hf_cand_casc_lf namespace hf_cand_x @@ -1240,9 +869,6 @@ DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); // particle DECLARE_SOA_COLUMN(FlagMcDecayChanRec, flagMcDecayChanRec, int8_t); // resonant decay channel flag, reconstruction level DECLARE_SOA_COLUMN(FlagMcDecayChanGen, flagMcDecayChanGen, int8_t); // resonant decay channel flag, generator level -// mapping of decay types -enum DecayType { XToJpsiToEEPiPi = 0, - XToJpsiToMuMuPiPi }; // move this to a dedicated cascade namespace in the future? } // namespace hf_cand_x // declare dedicated X candidate table @@ -1309,8 +935,6 @@ DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); // generator level DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t); // particle origin, reconstruction level DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); // particle origin, generator level DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, int8_t); // debug flag for mis-association reconstruction level -// mapping of decay types -enum DecayType { XiccToXicPi = 0 }; // move this to a dedicated cascade namespace in the future? } // namespace hf_cand_xicc // declare dedicated Xicc candidate table @@ -1629,13 +1253,6 @@ DECLARE_SOA_DYNAMIC_COLUMN(PtPiFromCharmBaryon, ptPiFromCharmBaryon, DECLARE_SOA_DYNAMIC_COLUMN(PtKaFromCasc, ptKaFromCasc, [](float px, float py) -> float { return RecoDecay::pt(px, py); }); -// mapping of decay types -enum DecayType { XiczeroToXiPi = 0, - OmegaczeroToXiPi, - OmegaczeroToOmegaPi, - OmegaczeroToOmegaK, - OmegaczeroToOmegaPiOneMu }; - } // end of namespace hf_cand_xic0_omegac0 // declare dedicated Omegac and Xic to Xi Pi candidate table @@ -1974,10 +1591,6 @@ DECLARE_SOA_DYNAMIC_COLUMN(PProng1, pProng1, //! DECLARE_SOA_DYNAMIC_COLUMN(PProng2, pProng2, //! [](float px, float py, float pz) -> float { return RecoDecay::p(px, py, pz); }); -// mapping of decay types -enum DecayType { XicToXiPiPi = 0, // Ξc± → Ξ∓ π± π± - XicToXiResPiToXiPiPi, // Ξc± → Ξ(1530) π± → Ξ∓ π± π± - NDecayType }; } // end of namespace hf_cand_xic_to_xi_pi_pi // declare dedicated Xic to Xi Pi Pi candidate table @@ -2092,9 +1705,6 @@ DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); // particle DECLARE_SOA_COLUMN(FlagMcDecayChanRec, flagMcDecayChanRec, int8_t); // resonant decay channel flag, reconstruction level DECLARE_SOA_COLUMN(FlagMcDecayChanGen, flagMcDecayChanGen, int8_t); // resonant decay channel flag, generator level DECLARE_SOA_COLUMN(JpsiToMuMuMass, jpsiToMuMuMass, float); // Jpsi mass -// mapping of decay types -enum DecayType { ChicToJpsiToEEGamma = 0, - ChicToJpsiToMuMuGamma }; // move this to a dedicated cascade namespace in the future? } // namespace hf_cand_chic // declare dedicated chi_c candidate table @@ -2163,8 +1773,6 @@ DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t); // particle DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); // particle origin, generator level DECLARE_SOA_COLUMN(FlagWrongCollision, flagWrongCollision, int8_t); // reconstruction level DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, int8_t); // debug flag for mis-association reconstruction level -// mapping of decay types -enum DecayType { LbToLcPi }; // move this to a dedicated cascade namespace in the future? enum DecayTypeMc : uint8_t { LbToLcPiToPKPiPi = 0, LbToLcKToPKPiK, @@ -2240,10 +1848,6 @@ DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); // particle DECLARE_SOA_COLUMN(FlagWrongCollision, flagWrongCollision, int8_t); // reconstruction level DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, int8_t); // debug flag for mis-association reconstruction level -// mapping of decay types -enum DecayType { B0ToDPi = 0, - B0ToDstarPi }; - enum DecayTypeMc : uint8_t { B0ToDplusPiToPiKPiPi = 0, B0ToDsPiToKKPiPi, BsToDsPiToKKPiPi, @@ -2372,9 +1976,6 @@ DECLARE_SOA_DYNAMIC_COLUMN(ImpactParameterProductJpsi, impactParameterProductJps DECLARE_SOA_DYNAMIC_COLUMN(ImpactParameterProductPhi, impactParameterProductPhi, // J/Psi impact parameter for Bs -> J/Psi phi [](float dcaLfTrack0, float dcaLfTrack1) -> float { return dcaLfTrack0 * dcaLfTrack1; }); -// mapping of decay types -enum DecayType { BsToDsPi = 0 }; - enum DecayTypeMc : uint8_t { BsToDsPiToPhiPiPiToKKPiPi = 0, // Bs(bar) → Ds∓ π± → (Phi π∓) π± → (K- K+ π∓) π± BsToDsPiToK0starKPiToKKPiPi, // Bs(bar) → Ds∓ π± → (K0* K∓) π± → (K- K+ π∓) π± B0ToDsPiToPhiPiPiToKKPiPi, // B0(bar) → Ds± π∓ → (Phi π±) π∓ → (K- K+ π±) π∓ @@ -2538,11 +2139,6 @@ DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t); //! part DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); //! particle origin, generator level DECLARE_SOA_COLUMN(ParticleAntiparticle, particleAntiparticle, int8_t); //! particle or antiparticle -// mapping of decay types -enum DecayType { Sc0ToPKPiPi = 0, - ScplusplusToPKPiPi, - ScStar0ToPKPiPi, - ScStarPlusPlusToPKPiPi }; enum Species : int { Sc2455 = 0, Sc2520, NSpecies }; @@ -2798,14 +2394,6 @@ DECLARE_SOA_COLUMN(FlagMcMatchGenD0, flagMcMatchGenD0, int8_t); //! generator le DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t); //! particle origin, reconstruction level DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); //! particle origin, generator level -enum DecayType { - DstarToD0Pi = 0, - D0ToPiK, - DstarToD0PiPi0, - D0ToPiKPi0, - NDstarDecayType -}; - } // namespace hf_cand_dstar /// D0 (table) from DStar diff --git a/PWGHF/DataModel/DerivedTables.h b/PWGHF/DataModel/DerivedTables.h index e3602a0ba63..3e9b374898a 100644 --- a/PWGHF/DataModel/DerivedTables.h +++ b/PWGHF/DataModel/DerivedTables.h @@ -17,6 +17,7 @@ #define PWGHF_DATAMODEL_DERIVEDTABLES_H_ #include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "Common/Core/RecoDecay.h" #include "Common/DataModel/Centrality.h" diff --git a/PWGHF/DataModel/TrackIndexSkimmingTables.h b/PWGHF/DataModel/TrackIndexSkimmingTables.h new file mode 100644 index 00000000000..6408c636f8e --- /dev/null +++ b/PWGHF/DataModel/TrackIndexSkimmingTables.h @@ -0,0 +1,323 @@ +// 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 TrackIndexSkimmingTables.h +/// \brief Definitions of tables produced by the candidate skimming +/// +/// \author Gian Michele Innocenti , CERN +/// \author Vít Kučera , CERN + +#ifndef PWGHF_DATAMODEL_TRACKINDEXSKIMMINGTABLES_H_ +#define PWGHF_DATAMODEL_TRACKINDEXSKIMMINGTABLES_H_ + +#include "PWGHF/Utils/utilsEvSelHf.h" + +#include +#include + +#include +#include + +namespace o2::aod +{ +namespace hf_sel_collision +{ + +// ================ +// Collision selection table +// ================ + +DECLARE_SOA_COLUMN(WhyRejectColl, whyRejectColl, o2::hf_evsel::HfCollisionRejectionMask); //! +} // namespace hf_sel_collision + +DECLARE_SOA_TABLE(HfSelCollision, "AOD", "HFSELCOLLISION", //! + hf_sel_collision::WhyRejectColl); + +// ================ +// Track selection tables +// ================ + +namespace hf_sel_track +{ +DECLARE_SOA_COLUMN(IsSelProng, isSelProng, uint32_t); //! +DECLARE_SOA_COLUMN(IsIdentifiedPid, isIdentifiedPid, uint32_t); //! +DECLARE_SOA_COLUMN(IsPositive, isPositive, bool); //! +} // namespace hf_sel_track + +DECLARE_SOA_TABLE(HfSelTrack, "AOD", "HFSELTRACK", //! + hf_sel_track::IsSelProng, + hf_sel_track::IsIdentifiedPid, + hf_sel_track::IsPositive); + +namespace hf_pv_refit_track +{ +DECLARE_SOA_COLUMN(PvRefitX, pvRefitX, float); //! +DECLARE_SOA_COLUMN(PvRefitY, pvRefitY, float); //! +DECLARE_SOA_COLUMN(PvRefitZ, pvRefitZ, float); //! +DECLARE_SOA_COLUMN(PvRefitSigmaX2, pvRefitSigmaX2, float); //! +DECLARE_SOA_COLUMN(PvRefitSigmaXY, pvRefitSigmaXY, float); //! +DECLARE_SOA_COLUMN(PvRefitSigmaY2, pvRefitSigmaY2, float); //! +DECLARE_SOA_COLUMN(PvRefitSigmaXZ, pvRefitSigmaXZ, float); //! +DECLARE_SOA_COLUMN(PvRefitSigmaYZ, pvRefitSigmaYZ, float); //! +DECLARE_SOA_COLUMN(PvRefitSigmaZ2, pvRefitSigmaZ2, float); //! +DECLARE_SOA_COLUMN(PvRefitDcaXY, pvRefitDcaXY, float); //! +DECLARE_SOA_COLUMN(PvRefitDcaZ, pvRefitDcaZ, float); //! +} // namespace hf_pv_refit_track + +DECLARE_SOA_TABLE(HfPvRefitTrack, "AOD", "HFPVREFITTRACK", //! + hf_pv_refit_track::PvRefitX, + hf_pv_refit_track::PvRefitY, + hf_pv_refit_track::PvRefitZ, + hf_pv_refit_track::PvRefitSigmaX2, + hf_pv_refit_track::PvRefitSigmaXY, + hf_pv_refit_track::PvRefitSigmaY2, + hf_pv_refit_track::PvRefitSigmaXZ, + hf_pv_refit_track::PvRefitSigmaYZ, + hf_pv_refit_track::PvRefitSigmaZ2, + hf_pv_refit_track::PvRefitDcaXY, + hf_pv_refit_track::PvRefitDcaZ); + +// ================ +// Track index skim tables +// ================ + +namespace hf_track_index +{ +DECLARE_SOA_INDEX_COLUMN(Collision, collision); //! Collision index +DECLARE_SOA_INDEX_COLUMN_FULL(Prong0, prong0, int, Tracks, "_0"); //! Index to first prong +DECLARE_SOA_INDEX_COLUMN_FULL(Prong1, prong1, int, Tracks, "_1"); //! Index to second prong +DECLARE_SOA_INDEX_COLUMN_FULL(Prong2, prong2, int, Tracks, "_2"); //! Index to third prong +DECLARE_SOA_INDEX_COLUMN_FULL(Prong3, prong3, int, Tracks, "_3"); //! Index to fourth prong +DECLARE_SOA_INDEX_COLUMN_FULL(Prong4, prong4, int, Tracks, "_4"); //! Index to fifth prong +DECLARE_SOA_INDEX_COLUMN(V0, v0); //! Index to V0 prong +DECLARE_SOA_INDEX_COLUMN(Cascade, cascade); //! Index to cascade prong +DECLARE_SOA_COLUMN(HFflag, hfflag, uint8_t); //! Bitmap to store selection results, o2-linter: disable=name/o2-column (written to disk) + +DECLARE_SOA_COLUMN(FlagD0ToKPi, flagD0ToKPi, uint8_t); //! +DECLARE_SOA_COLUMN(FlagJpsiToEE, flagJpsiToEE, uint8_t); //! +DECLARE_SOA_COLUMN(FlagJpsiToMuMu, flagJpsiToMuMu, uint8_t); //! +DECLARE_SOA_COLUMN(FlagDplusToPiKPi, flagDplusToPiKPi, uint8_t); //! +DECLARE_SOA_COLUMN(FlagLcToPKPi, flagLcToPKPi, uint8_t); //! +DECLARE_SOA_COLUMN(FlagDsToKKPi, flagDsToKKPi, uint8_t); //! +DECLARE_SOA_COLUMN(FlagXicToPKPi, flagXicToPKPi, uint8_t); //! +DECLARE_SOA_COLUMN(FlagDstarToD0Pi, flagDstarToD0Pi, uint8_t); //! + +DECLARE_SOA_COLUMN(MlProbSkimD0ToKPi, mlProbSkimD0ToKPi, std::vector); //! ML probabilities (background, prompt, non-prompt) for D0->Kpi +DECLARE_SOA_COLUMN(MlProbSkimDplusToPiKPi, mlProbSkimDplusToPiKPi, std::vector); //! ML probabilities (background, prompt, non-prompt) for D+->Kpipi +DECLARE_SOA_COLUMN(MlProbSkimDsToKKPi, mlProbSkimDsToKKPi, std::vector); //! ML probabilities (background, prompt, non-prompt) for Ds->KKpi +DECLARE_SOA_COLUMN(MlProbSkimLcToPKPi, mlProbSkimLcToPKPi, std::vector); //! ML probabilities (background, prompt, non-prompt) for Lc->pKpi +DECLARE_SOA_COLUMN(MlProbSkimXicToPKPi, mlProbSkimXicToPKPi, std::vector); //! ML probabilities (background, prompt, non-prompt) for Xic->pKpi +} // namespace hf_track_index + +DECLARE_SOA_TABLE(Hf2Prongs_000, "AOD", "HF2PRONG", //! Table for HF 2 prong candidates (Run 2 converted format) + o2::soa::Index<>, + hf_track_index::Prong0Id, + hf_track_index::Prong1Id, + hf_track_index::HFflag); + +DECLARE_SOA_TABLE_VERSIONED(Hf2Prongs_001, "AOD", "HF2PRONG", 1, //! Table for HF 2 prong candidates (Run 3 format) + o2::soa::Index<>, + hf_track_index::CollisionId, + hf_track_index::Prong0Id, + hf_track_index::Prong1Id, + hf_track_index::HFflag); + +using Hf2Prongs = Hf2Prongs_001; +using Hf2Prong = Hf2Prongs::iterator; + +DECLARE_SOA_TABLE(HfCascades_000, "AOD", "HFCASCADE", //! Table for HF candidates with a V0 (Run 2 converted format) + o2::soa::Index<>, + hf_track_index::Prong0Id, + hf_track_index::V0Id); + +DECLARE_SOA_TABLE_VERSIONED(HfCascades_001, "AOD", "HFCASCADE", 1, //! Table for HF candidates with a V0 (Run 3 format) + o2::soa::Index<>, + hf_track_index::CollisionId, + hf_track_index::Prong0Id, + hf_track_index::V0Id); + +using HfCascades = HfCascades_001; +using HfCascade = HfCascades::iterator; + +DECLARE_SOA_TABLE(Hf3Prongs_000, "AOD", "HF3PRONG", //! Table for HF 3 prong candidates (Run 2 converted format) + o2::soa::Index<>, + hf_track_index::Prong0Id, + hf_track_index::Prong1Id, + hf_track_index::Prong2Id, + hf_track_index::HFflag); + +DECLARE_SOA_TABLE_VERSIONED(Hf3Prongs_001, "AOD", "HF3PRONG", 1, //! Table for HF 3 prong candidates (Run 3 format) + o2::soa::Index<>, + hf_track_index::CollisionId, + hf_track_index::Prong0Id, + hf_track_index::Prong1Id, + hf_track_index::Prong2Id, + hf_track_index::HFflag); + +using Hf3Prongs = Hf3Prongs_001; +using Hf3Prong = Hf3Prongs::iterator; + +DECLARE_SOA_TABLE(HfCascLf2Prongs, "AOD", "HFCASCLF2PRONG", //! Table for HF 2 prong candidates with a Cascade + o2::soa::Index<>, + hf_track_index::CollisionId, + hf_track_index::CascadeId, + hf_track_index::Prong0Id, + hf_track_index::HFflag); + +using HfCascLf2Prong = HfCascLf2Prongs::iterator; + +DECLARE_SOA_TABLE(HfCascLf3Prongs, "AOD", "HFCASCLF3PRONG", //! Table for HF 3 prong candidates with a Cascade + o2::soa::Index<>, + hf_track_index::CollisionId, + hf_track_index::CascadeId, + hf_track_index::Prong0Id, + hf_track_index::Prong1Id); + +using HfCascLf3Prong = HfCascLf3Prongs::iterator; + +namespace hf_track_index +{ +DECLARE_SOA_INDEX_COLUMN_FULL(ProngD0, prongD0, int, Hf2Prongs, ""); //! Index to a D0 prong +} // namespace hf_track_index + +DECLARE_SOA_TABLE(HfDstars_000, "AOD", "HFDSTAR", //! D* -> D0pi candidates (Run 2 converted format) + o2::soa::Index<>, + hf_track_index::Prong0Id, + hf_track_index::ProngD0Id); + +DECLARE_SOA_TABLE_VERSIONED(HfDstars_001, "AOD", "HFDSTAR", 1, //! D* -> D0pi candidates (Run 3 format) + o2::soa::Index<>, + hf_track_index::CollisionId, + hf_track_index::Prong0Id, + hf_track_index::ProngD0Id); + +using HfDstars = HfDstars_001; +using HfDstar = HfDstars::iterator; + +DECLARE_SOA_TABLE(HfCutStatus2Prong, "AOD", "HFCUTSTATUS2P", //! + hf_track_index::FlagD0ToKPi, + hf_track_index::FlagJpsiToEE, + hf_track_index::FlagJpsiToMuMu); + +DECLARE_SOA_TABLE(HfCutStatus3Prong, "AOD", "HFCUTSTATUS3P", //! + hf_track_index::FlagDplusToPiKPi, + hf_track_index::FlagLcToPKPi, + hf_track_index::FlagDsToKKPi, + hf_track_index::FlagXicToPKPi); + +DECLARE_SOA_TABLE(HfCutStatusDstar, "AOD", "HFCUTSTATUSDST", //! + hf_track_index::FlagDstarToD0Pi); + +DECLARE_SOA_TABLE(Hf2ProngMlProbs, "AOD", "HF2PRONGMLPROB", //! Table for ML scores of HF 2 prong candidates + hf_track_index::MlProbSkimD0ToKPi); + +DECLARE_SOA_TABLE(Hf3ProngMlProbs, "AOD", "HF3PRONGMLPROB", //! Table for ML scores of HF 3 prong candidates + hf_track_index::MlProbSkimDplusToPiKPi, + hf_track_index::MlProbSkimLcToPKPi, + hf_track_index::MlProbSkimDsToKKPi, + hf_track_index::MlProbSkimXicToPKPi); + +// ================ +// Primary-vertex refit tables +// ================ + +namespace hf_pv_refit +{ +DECLARE_SOA_COLUMN(PvRefitX, pvRefitX, float); //! +DECLARE_SOA_COLUMN(PvRefitY, pvRefitY, float); //! +DECLARE_SOA_COLUMN(PvRefitZ, pvRefitZ, float); //! +DECLARE_SOA_COLUMN(PvRefitSigmaX2, pvRefitSigmaX2, float); //! +DECLARE_SOA_COLUMN(PvRefitSigmaXY, pvRefitSigmaXY, float); //! +DECLARE_SOA_COLUMN(PvRefitSigmaY2, pvRefitSigmaY2, float); //! +DECLARE_SOA_COLUMN(PvRefitSigmaXZ, pvRefitSigmaXZ, float); //! +DECLARE_SOA_COLUMN(PvRefitSigmaYZ, pvRefitSigmaYZ, float); //! +DECLARE_SOA_COLUMN(PvRefitSigmaZ2, pvRefitSigmaZ2, float); //! +} // namespace hf_pv_refit + +DECLARE_SOA_TABLE(HfPvRefit2Prong, "AOD", "HFPVREFIT2PRONG", //! + hf_pv_refit::PvRefitX, + hf_pv_refit::PvRefitY, + hf_pv_refit::PvRefitZ, + hf_pv_refit::PvRefitSigmaX2, + hf_pv_refit::PvRefitSigmaXY, + hf_pv_refit::PvRefitSigmaY2, + hf_pv_refit::PvRefitSigmaXZ, + hf_pv_refit::PvRefitSigmaYZ, + hf_pv_refit::PvRefitSigmaZ2); + +DECLARE_SOA_TABLE(HfPvRefit3Prong, "AOD", "HFPVREFIT3PRONG", //! + hf_pv_refit::PvRefitX, + hf_pv_refit::PvRefitY, + hf_pv_refit::PvRefitZ, + hf_pv_refit::PvRefitSigmaX2, + hf_pv_refit::PvRefitSigmaXY, + hf_pv_refit::PvRefitSigmaY2, + hf_pv_refit::PvRefitSigmaXZ, + hf_pv_refit::PvRefitSigmaYZ, + hf_pv_refit::PvRefitSigmaZ2, + o2::soa::Marker<1>); + +DECLARE_SOA_TABLE(HfPvRefitDstar, "AOD", "HFPVREFITDSTAR", //! + hf_pv_refit::PvRefitX, + hf_pv_refit::PvRefitY, + hf_pv_refit::PvRefitZ, + hf_pv_refit::PvRefitSigmaX2, + hf_pv_refit::PvRefitSigmaXY, + hf_pv_refit::PvRefitSigmaY2, + hf_pv_refit::PvRefitSigmaXZ, + hf_pv_refit::PvRefitSigmaYZ, + hf_pv_refit::PvRefitSigmaZ2, + o2::soa::Marker<2>); + +// ================ +// Decay types stored in HFflag +// ================ + +namespace hf_cand_2prong +{ +enum DecayType { + D0ToPiK = 0, + JpsiToEE, + JpsiToMuMu, + N2ProngDecays +}; +} // namespace hf_cand_2prong + +namespace hf_cand_3prong +{ +enum DecayType { + DplusToPiKPi = 0, + LcToPKPi, + DsToKKPi, + XicToPKPi, + CdToDeKPi, + N3ProngDecays +}; +} // namespace hf_cand_3prong + +namespace hf_cand_casc_lf +{ +enum DecayType2Prong { + XiczeroOmegaczeroToXiPi = 0, + OmegaczeroToOmegaPi, + OmegaczeroToOmegaK, + N2ProngDecays +}; + +enum DecayType3Prong { + XicplusToXiPiPi = 0, + N3ProngDecays +}; +} // namespace hf_cand_casc_lf + +} // namespace o2::aod + +#endif // PWGHF_DATAMODEL_TRACKINDEXSKIMMINGTABLES_H_ diff --git a/PWGHF/HFC/TableProducer/correlatorD0D0bar.cxx b/PWGHF/HFC/TableProducer/correlatorD0D0bar.cxx index 62b9f6b08ea..b72ca63a212 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0D0bar.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0D0bar.cxx @@ -17,8 +17,10 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/HFC/DataModel/CorrelationTables.h" #include "PWGHF/Utils/utilsAnalysis.h" diff --git a/PWGHF/HFC/TableProducer/correlatorD0D0barBarrelFullPid.cxx b/PWGHF/HFC/TableProducer/correlatorD0D0barBarrelFullPid.cxx index d43a90b79d2..7211c0152bd 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0D0barBarrelFullPid.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0D0barBarrelFullPid.cxx @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file HFCorrelatorD0D0barBarrelFullPid.cxx +/// \file correlatorD0D0barBarrelFullPid.cxx /// \brief Temporary D0-D0bar correlator task with full barrel PID implementation - data-like, MC-reco and MC-kine analyses. For ULS and LS pairs /// /// \author Fabio Colamaria , INFN Bari @@ -17,8 +17,10 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/HFC/DataModel/CorrelationTables.h" #include "PWGHF/Utils/utilsAnalysis.h" diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index 7408b3f947b..a762603c5ae 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -18,8 +18,10 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/HFC/DataModel/CorrelationTables.h" #include "PWGHF/HFC/Utils/utilsCorrelations.h" #include "PWGHF/Utils/utilsAnalysis.h" diff --git a/PWGHF/HFC/TableProducer/correlatorDplusDminus.cxx b/PWGHF/HFC/TableProducer/correlatorDplusDminus.cxx index 277f07d0eec..bf4c1e2b2a3 100644 --- a/PWGHF/HFC/TableProducer/correlatorDplusDminus.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDplusDminus.cxx @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file HfCorrelatorDplusDminus.cxx +/// \file correlatorDplusDminus.cxx /// \brief Dplus-Dminus correlator task - data-like, MC-reco and MC-kine analyses. For ULS and LS pairs /// /// \author Fabio Colamaria , INFN Bari @@ -17,8 +17,10 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/HFC/DataModel/CorrelationTables.h" #include "PWGHF/Utils/utilsAnalysis.h" diff --git a/PWGHF/HFC/TableProducer/correlatorDplusHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorDplusHadrons.cxx index 2b7908f4dd5..dc655e71a1b 100644 --- a/PWGHF/HFC/TableProducer/correlatorDplusHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDplusHadrons.cxx @@ -16,8 +16,10 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/HFC/DataModel/CorrelationTables.h" #include "PWGHF/Utils/utilsAnalysis.h" diff --git a/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx index 315036c2fd7..7dc4b7ab713 100644 --- a/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx @@ -17,8 +17,10 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/HFC/DataModel/CorrelationTables.h" #include "PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h" #include "PWGHF/HFC/Utils/utilsCorrelations.h" diff --git a/PWGHF/HFC/TableProducer/correlatorDstarHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorDstarHadrons.cxx index b24806c1b5c..ff27fa3f3e9 100644 --- a/PWGHF/HFC/TableProducer/correlatorDstarHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDstarHadrons.cxx @@ -15,6 +15,7 @@ /// \brief Correlator for D* and hadrons. This task is used to produce table for D* and hadron pairs. +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/HFC/DataModel/CorrelationTables.h" diff --git a/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx index 59360564a88..d8fef830ce9 100644 --- a/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx @@ -19,8 +19,10 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/HFC/DataModel/CorrelationTables.h" #include "PWGHF/HFC/Utils/utilsCorrelations.h" #include "PWGHF/Utils/utilsAnalysis.h" diff --git a/PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx index bf1b3b1aa0b..61d5147b0b7 100644 --- a/PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx @@ -17,10 +17,13 @@ /// \author Ravindra Singh #include "PWGHF/Core/DecayChannels.h" +#include "PWGHF/Core/DecayChannelsLegacy.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/HFC/DataModel/CorrelationTables.h" #include "PWGHF/HFC/Utils/utilsCorrelations.h" #include "PWGHF/Utils/utilsAnalysis.h" diff --git a/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx b/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx index df5feed033e..d02f69211d2 100644 --- a/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx +++ b/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx @@ -17,6 +17,7 @@ #include "PWGHF/Core/CentralityEstimation.h" #include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h" diff --git a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx index 3dfb0ad918f..e209a609349 100644 --- a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx +++ b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx @@ -25,6 +25,7 @@ #include "PWGHF/Core/HfMlResponseDplusToPiKPi.h" #include "PWGHF/Core/HfMlResponseLcToPKPi.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/Utils/utilsBfieldCCDB.h" diff --git a/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx b/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx index 78aa10b08b9..611df82cef0 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx @@ -19,6 +19,7 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/HFC/DataModel/CorrelationTables.h" diff --git a/PWGHF/HFC/Tasks/taskCorrelationDplusHadrons.cxx b/PWGHF/HFC/Tasks/taskCorrelationDplusHadrons.cxx index aa8a6ea4d42..3a99678e5e3 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationDplusHadrons.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationDplusHadrons.cxx @@ -16,8 +16,10 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/HFC/DataModel/CorrelationTables.h" #include "PWGHF/Utils/utilsAnalysis.h" diff --git a/PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx b/PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx index e80fadbbbc9..6b74767c2e6 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx @@ -17,8 +17,10 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/HFC/DataModel/CorrelationTables.h" #include "PWGHF/Utils/utilsAnalysis.h" diff --git a/PWGHF/HFC/Tasks/taskCorrelationLcHadrons.cxx b/PWGHF/HFC/Tasks/taskCorrelationLcHadrons.cxx index bd641ddee02..c5b59d9bd39 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationLcHadrons.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationLcHadrons.cxx @@ -17,8 +17,10 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/HFC/DataModel/CorrelationTables.h" #include "PWGHF/HFC/Utils/utilsCorrelations.h" #include "PWGHF/Utils/utilsAnalysis.h" diff --git a/PWGHF/HFC/Tasks/taskFlow.cxx b/PWGHF/HFC/Tasks/taskFlow.cxx index 448d4c5769c..0af4125c446 100644 --- a/PWGHF/HFC/Tasks/taskFlow.cxx +++ b/PWGHF/HFC/Tasks/taskFlow.cxx @@ -18,8 +18,10 @@ #include "PWGCF/Core/CorrelationContainer.h" #include "PWGCF/Core/PairCuts.h" #include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/Utils/utilsPid.h" #include "PWGMM/Mult/DataModel/bestCollisionTable.h" diff --git a/PWGHF/HFC/Utils/utilsCorrelations.h b/PWGHF/HFC/Utils/utilsCorrelations.h index 3cbef6ee2de..acb889e143c 100644 --- a/PWGHF/HFC/Utils/utilsCorrelations.h +++ b/PWGHF/HFC/Utils/utilsCorrelations.h @@ -17,7 +17,7 @@ #define PWGHF_HFC_UTILS_UTILSCORRELATIONS_H_ #include "PWGHF/Core/DecayChannels.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/Core/DecayChannelsLegacy.h" #include "Common/DataModel/PIDResponseTOF.h" #include "Common/DataModel/PIDResponseTPC.h" diff --git a/PWGHF/HFL/TableProducer/treeCreatorElectronDCA.cxx b/PWGHF/HFL/TableProducer/treeCreatorElectronDCA.cxx index acd38174698..cafd10c8003 100644 --- a/PWGHF/HFL/TableProducer/treeCreatorElectronDCA.cxx +++ b/PWGHF/HFL/TableProducer/treeCreatorElectronDCA.cxx @@ -15,7 +15,7 @@ /// \author Martin Voelkl , University of Birmingham #include "PWGHF/Core/HfHelper.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/AliasTables.h" #include "Common/Core/RecoDecay.h" #include "Common/DataModel/TrackSelectionTables.h" diff --git a/PWGHF/TableProducer/candidateCreator2Prong.cxx b/PWGHF/TableProducer/candidateCreator2Prong.cxx index d7805b491ab..cd262ce388b 100644 --- a/PWGHF/TableProducer/candidateCreator2Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator2Prong.cxx @@ -22,7 +22,9 @@ #include "PWGHF/Core/CentralityEstimation.h" #include "PWGHF/Core/DecayChannels.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/Utils/utilsBfieldCCDB.h" #include "PWGHF/Utils/utilsEvSelHf.h" #include "PWGHF/Utils/utilsMcGen.h" diff --git a/PWGHF/TableProducer/candidateCreator3Prong.cxx b/PWGHF/TableProducer/candidateCreator3Prong.cxx index f60a15895c8..e3816128923 100644 --- a/PWGHF/TableProducer/candidateCreator3Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator3Prong.cxx @@ -21,7 +21,9 @@ #include "PWGHF/Core/CentralityEstimation.h" #include "PWGHF/Core/DecayChannels.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/Utils/utilsBfieldCCDB.h" #include "PWGHF/Utils/utilsEvSelHf.h" #include "PWGHF/Utils/utilsMcGen.h" diff --git a/PWGHF/TableProducer/candidateCreatorB0.cxx b/PWGHF/TableProducer/candidateCreatorB0.cxx index 5097623643f..43eb30d0f78 100644 --- a/PWGHF/TableProducer/candidateCreatorB0.cxx +++ b/PWGHF/TableProducer/candidateCreatorB0.cxx @@ -18,6 +18,7 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/Utils/utilsBfieldCCDB.h" diff --git a/PWGHF/TableProducer/candidateCreatorBplus.cxx b/PWGHF/TableProducer/candidateCreatorBplus.cxx index 8dcefe55c9c..e9d238165a3 100644 --- a/PWGHF/TableProducer/candidateCreatorBplus.cxx +++ b/PWGHF/TableProducer/candidateCreatorBplus.cxx @@ -21,8 +21,10 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/Utils/utilsBfieldCCDB.h" #include "PWGHF/Utils/utilsMcGen.h" #include "PWGHF/Utils/utilsTrkCandHf.h" diff --git a/PWGHF/TableProducer/candidateCreatorBs.cxx b/PWGHF/TableProducer/candidateCreatorBs.cxx index 41c41d7dcaa..d311135c367 100644 --- a/PWGHF/TableProducer/candidateCreatorBs.cxx +++ b/PWGHF/TableProducer/candidateCreatorBs.cxx @@ -18,6 +18,7 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/Utils/utilsBfieldCCDB.h" diff --git a/PWGHF/TableProducer/candidateCreatorCascade.cxx b/PWGHF/TableProducer/candidateCreatorCascade.cxx index 781b50c3412..2d3132c1a43 100644 --- a/PWGHF/TableProducer/candidateCreatorCascade.cxx +++ b/PWGHF/TableProducer/candidateCreatorCascade.cxx @@ -16,7 +16,9 @@ /// Paul Buehler, , Vienna #include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/Utils/utilsBfieldCCDB.h" #include "PWGHF/Utils/utilsEvSelHf.h" #include "PWGHF/Utils/utilsTrkCandHf.h" diff --git a/PWGHF/TableProducer/candidateCreatorDstar.cxx b/PWGHF/TableProducer/candidateCreatorDstar.cxx index 47a05c41c37..d426776a293 100644 --- a/PWGHF/TableProducer/candidateCreatorDstar.cxx +++ b/PWGHF/TableProducer/candidateCreatorDstar.cxx @@ -18,7 +18,9 @@ #include "PWGHF/Core/CentralityEstimation.h" #include "PWGHF/Core/DecayChannels.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/Utils/utilsEvSelHf.h" #include "PWGHF/Utils/utilsPid.h" #include "PWGHF/Utils/utilsTrkCandHf.h" diff --git a/PWGHF/TableProducer/candidateCreatorLb.cxx b/PWGHF/TableProducer/candidateCreatorLb.cxx index b3fcad95b9b..997e969d7b5 100644 --- a/PWGHF/TableProducer/candidateCreatorLb.cxx +++ b/PWGHF/TableProducer/candidateCreatorLb.cxx @@ -17,8 +17,10 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/Utils/utilsTrkCandHf.h" #include "Common/Core/RecoDecay.h" diff --git a/PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx b/PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx index b95b69e4937..300d4c6e348 100644 --- a/PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx +++ b/PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx @@ -17,10 +17,13 @@ #include "PWGHF/Core/CentralityEstimation.h" #include "PWGHF/Core/DecayChannels.h" +#include "PWGHF/Core/DecayChannelsLegacy.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/Utils/utilsBfieldCCDB.h" // for dca recalculation #include "PWGHF/Utils/utilsEvSelHf.h" diff --git a/PWGHF/TableProducer/candidateCreatorSigmac0plusplusCascade.cxx b/PWGHF/TableProducer/candidateCreatorSigmac0plusplusCascade.cxx index c63bbf09ce4..fa952bf6b91 100644 --- a/PWGHF/TableProducer/candidateCreatorSigmac0plusplusCascade.cxx +++ b/PWGHF/TableProducer/candidateCreatorSigmac0plusplusCascade.cxx @@ -17,6 +17,7 @@ #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" diff --git a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx index f658e183b10..25cbd949fe9 100644 --- a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx +++ b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx @@ -22,7 +22,10 @@ #endif #include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/Core/DecayChannelsLegacy.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/Utils/utilsBfieldCCDB.h" #include "PWGHF/Utils/utilsEvSelHf.h" #include "PWGLF/DataModel/LFStrangenessTables.h" diff --git a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx index 6a183d21c2f..5984add510e 100644 --- a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx @@ -22,7 +22,10 @@ #endif #include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/Core/DecayChannelsLegacy.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/Utils/utilsBfieldCCDB.h" #include "PWGHF/Utils/utilsEvSelHf.h" #include "PWGLF/DataModel/LFStrangenessTables.h" diff --git a/PWGHF/TableProducer/candidateCreatorXicc.cxx b/PWGHF/TableProducer/candidateCreatorXicc.cxx index 1d8058d09cb..8879dcb3d55 100644 --- a/PWGHF/TableProducer/candidateCreatorXicc.cxx +++ b/PWGHF/TableProducer/candidateCreatorXicc.cxx @@ -17,9 +17,12 @@ /// \author Luigi Dello Stritto , SALERNO /// \author Mattia Faggin , University and INFN PADOVA +#include "PWGHF/ALICE3/Core/DecayChannelsLegacy.h" #include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "Common/Core/RecoDecay.h" #include "Common/Core/trackUtilities.h" diff --git a/PWGHF/TableProducer/candidateSelectorB0ToDPi.cxx b/PWGHF/TableProducer/candidateSelectorB0ToDPi.cxx index dfcd47e3e1a..962e935fc23 100644 --- a/PWGHF/TableProducer/candidateSelectorB0ToDPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorB0ToDPi.cxx @@ -17,6 +17,7 @@ #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/HfMlResponseB0ToDPi.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/Utils/utilsPid.h" diff --git a/PWGHF/TableProducer/candidateSelectorBplusToD0Pi.cxx b/PWGHF/TableProducer/candidateSelectorBplusToD0Pi.cxx index 0a8e6503230..9e2fac80961 100644 --- a/PWGHF/TableProducer/candidateSelectorBplusToD0Pi.cxx +++ b/PWGHF/TableProducer/candidateSelectorBplusToD0Pi.cxx @@ -19,6 +19,7 @@ #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/HfMlResponseBplusToD0Pi.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/Utils/utilsPid.h" diff --git a/PWGHF/TableProducer/candidateSelectorBsToDsPi.cxx b/PWGHF/TableProducer/candidateSelectorBsToDsPi.cxx index 5e66076e670..60cef9d1777 100644 --- a/PWGHF/TableProducer/candidateSelectorBsToDsPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorBsToDsPi.cxx @@ -18,6 +18,7 @@ #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/HfMlResponse.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" diff --git a/PWGHF/TableProducer/candidateSelectorCd.cxx b/PWGHF/TableProducer/candidateSelectorCd.cxx index b220bc130b8..ebf76c0a2af 100644 --- a/PWGHF/TableProducer/candidateSelectorCd.cxx +++ b/PWGHF/TableProducer/candidateSelectorCd.cxx @@ -16,8 +16,10 @@ #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "Common/Core/TrackSelectorPID.h" diff --git a/PWGHF/TableProducer/candidateSelectorD0.cxx b/PWGHF/TableProducer/candidateSelectorD0.cxx index 48344fb7fa1..ac5d54399ab 100644 --- a/PWGHF/TableProducer/candidateSelectorD0.cxx +++ b/PWGHF/TableProducer/candidateSelectorD0.cxx @@ -18,8 +18,10 @@ #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/HfMlResponseD0ToKPi.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/Utils/utilsAnalysis.h" #include "Common/Core/TrackSelectorPID.h" diff --git a/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx b/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx index 1cb7e8d9a59..902e4ccf707 100644 --- a/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx @@ -18,8 +18,10 @@ #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/HfMlResponseDplusToPiKPi.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/Utils/utilsAnalysis.h" #include "Common/Core/TrackSelectorPID.h" diff --git a/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx b/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx index 5f1f534cc27..b11b4d02db4 100644 --- a/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx @@ -18,8 +18,10 @@ #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/HfMlResponseDsToKKPi.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/Utils/utilsAnalysis.h" #include "Common/Core/TrackSelectorPID.h" diff --git a/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx b/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx index ae30c15f231..264f98ec911 100644 --- a/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx @@ -18,8 +18,10 @@ #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/HfMlResponseDstarToD0Pi.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/Utils/utilsAnalysis.h" #include "Common/Core/TrackSelectorPID.h" diff --git a/PWGHF/TableProducer/candidateSelectorLbToLcPi.cxx b/PWGHF/TableProducer/candidateSelectorLbToLcPi.cxx index f698e250b27..ec416564365 100644 --- a/PWGHF/TableProducer/candidateSelectorLbToLcPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorLbToLcPi.cxx @@ -16,6 +16,7 @@ #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" diff --git a/PWGHF/TableProducer/candidateSelectorLc.cxx b/PWGHF/TableProducer/candidateSelectorLc.cxx index 25a4ede94d3..566b38c62ca 100644 --- a/PWGHF/TableProducer/candidateSelectorLc.cxx +++ b/PWGHF/TableProducer/candidateSelectorLc.cxx @@ -20,8 +20,10 @@ #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/HfMlResponseLcToPKPi.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "Common/Core/TrackSelectorPID.h" #include "Common/DataModel/PIDResponseCombined.h" diff --git a/PWGHF/TableProducer/candidateSelectorLcPidMl.cxx b/PWGHF/TableProducer/candidateSelectorLcPidMl.cxx index ce791afe7b1..f27e5edc3cd 100644 --- a/PWGHF/TableProducer/candidateSelectorLcPidMl.cxx +++ b/PWGHF/TableProducer/candidateSelectorLcPidMl.cxx @@ -18,8 +18,10 @@ /// \author Maja Kabus , CERN, Warsaw University of Technology #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "Common/Core/RecoDecay.h" #include "Common/Core/TrackSelectorPID.h" diff --git a/PWGHF/TableProducer/candidateSelectorLcToK0sP.cxx b/PWGHF/TableProducer/candidateSelectorLcToK0sP.cxx index ae017847cf4..c405b68b846 100644 --- a/PWGHF/TableProducer/candidateSelectorLcToK0sP.cxx +++ b/PWGHF/TableProducer/candidateSelectorLcToK0sP.cxx @@ -20,6 +20,7 @@ #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/HfMlResponseLcToK0sP.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" diff --git a/PWGHF/TableProducer/candidateSelectorOmegac0ToOmegaKa.cxx b/PWGHF/TableProducer/candidateSelectorOmegac0ToOmegaKa.cxx index 0f514d9aa05..44cb77e44a3 100644 --- a/PWGHF/TableProducer/candidateSelectorOmegac0ToOmegaKa.cxx +++ b/PWGHF/TableProducer/candidateSelectorOmegac0ToOmegaKa.cxx @@ -13,6 +13,7 @@ /// \brief Omegac0 → Omega Ka selection task /// \author Federica Zanone , Heidelberg University +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/Utils/utilsAnalysis.h" diff --git a/PWGHF/TableProducer/candidateSelectorOmegac0ToOmegaPi.cxx b/PWGHF/TableProducer/candidateSelectorOmegac0ToOmegaPi.cxx index d05c87196be..87856e1554a 100644 --- a/PWGHF/TableProducer/candidateSelectorOmegac0ToOmegaPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorOmegac0ToOmegaPi.cxx @@ -18,6 +18,7 @@ #include "PWGHF/Core/HfMlResponseOmegacToOmegaPi.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/Utils/utilsAnalysis.h" diff --git a/PWGHF/TableProducer/candidateSelectorOmegac0Xic0ToOmegaKa.cxx b/PWGHF/TableProducer/candidateSelectorOmegac0Xic0ToOmegaKa.cxx index 6e716cb1c91..e1e32120543 100644 --- a/PWGHF/TableProducer/candidateSelectorOmegac0Xic0ToOmegaKa.cxx +++ b/PWGHF/TableProducer/candidateSelectorOmegac0Xic0ToOmegaKa.cxx @@ -40,6 +40,7 @@ #include // #include "PWGHF/Core/HfMlResponseOmegaKaToOmegaKa.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/Utils/utilsAnalysis.h" diff --git a/PWGHF/TableProducer/candidateSelectorToXiPi.cxx b/PWGHF/TableProducer/candidateSelectorToXiPi.cxx index d9064b61a29..84a6cfac6b3 100644 --- a/PWGHF/TableProducer/candidateSelectorToXiPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorToXiPi.cxx @@ -16,6 +16,7 @@ #include "PWGHF/Core/HfMlResponseXic0ToXiPi.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/Utils/utilsAnalysis.h" diff --git a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx index 13e131bbcfb..69d2a73339b 100644 --- a/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx +++ b/PWGHF/TableProducer/candidateSelectorXic0ToXiPiKf.cxx @@ -16,6 +16,7 @@ #include "PWGHF/Core/HfMlResponseXic0ToXiPiKf.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/Utils/utilsAnalysis.h" diff --git a/PWGHF/TableProducer/candidateSelectorXicToPKPi.cxx b/PWGHF/TableProducer/candidateSelectorXicToPKPi.cxx index cf6593c7c66..aff5a163b21 100644 --- a/PWGHF/TableProducer/candidateSelectorXicToPKPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorXicToPKPi.cxx @@ -20,8 +20,10 @@ #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/HfMlResponseXicToPKPi.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "Common/Core/TrackSelectorPID.h" diff --git a/PWGHF/TableProducer/candidateSelectorXicToXiPiPi.cxx b/PWGHF/TableProducer/candidateSelectorXicToXiPiPi.cxx index 223d484d0a1..6355024ec2b 100644 --- a/PWGHF/TableProducer/candidateSelectorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorXicToXiPiPi.cxx @@ -17,6 +17,7 @@ #include "PWGHF/Core/HfMlResponseXicToXiPiPi.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/Utils/utilsAnalysis.h" diff --git a/PWGHF/TableProducer/candidateSelectorXiccToPKPiPi.cxx b/PWGHF/TableProducer/candidateSelectorXiccToPKPiPi.cxx index 24057d1e59b..032dd658f95 100644 --- a/PWGHF/TableProducer/candidateSelectorXiccToPKPiPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorXiccToPKPiPi.cxx @@ -14,8 +14,10 @@ /// /// \author Gian Michele Innocenti , CERN +#include "PWGHF/ALICE3/Core/DecayChannelsLegacy.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" diff --git a/PWGHF/TableProducer/converterDstarIndices.cxx b/PWGHF/TableProducer/converterDstarIndices.cxx index 8b26f94610e..18d7fffe6c1 100644 --- a/PWGHF/TableProducer/converterDstarIndices.cxx +++ b/PWGHF/TableProducer/converterDstarIndices.cxx @@ -14,7 +14,7 @@ /// /// \author Fabrizio Grosa , CERN -#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include #include diff --git a/PWGHF/TableProducer/derivedDataCreatorB0ToDPi.cxx b/PWGHF/TableProducer/derivedDataCreatorB0ToDPi.cxx index 862e3da3d38..2c4b186991c 100644 --- a/PWGHF/TableProducer/derivedDataCreatorB0ToDPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorB0ToDPi.cxx @@ -17,6 +17,7 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/DataModel/DerivedTables.h" diff --git a/PWGHF/TableProducer/derivedDataCreatorBplusToD0Pi.cxx b/PWGHF/TableProducer/derivedDataCreatorBplusToD0Pi.cxx index 6e33f7b4f1d..c75265a3161 100644 --- a/PWGHF/TableProducer/derivedDataCreatorBplusToD0Pi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorBplusToD0Pi.cxx @@ -17,6 +17,7 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/DataModel/DerivedTables.h" diff --git a/PWGHF/TableProducer/derivedDataCreatorDplusToPiKPi.cxx b/PWGHF/TableProducer/derivedDataCreatorDplusToPiKPi.cxx index c8bf7a1ee3b..be6b8c11d7c 100644 --- a/PWGHF/TableProducer/derivedDataCreatorDplusToPiKPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorDplusToPiKPi.cxx @@ -17,6 +17,7 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/DataModel/DerivedTables.h" diff --git a/PWGHF/TableProducer/derivedDataCreatorDsToKKPi.cxx b/PWGHF/TableProducer/derivedDataCreatorDsToKKPi.cxx index 5eb404e57ab..a9097f4457c 100644 --- a/PWGHF/TableProducer/derivedDataCreatorDsToKKPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorDsToKKPi.cxx @@ -17,6 +17,7 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/DataModel/DerivedTables.h" diff --git a/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx b/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx index dfbfce30e68..1a15c3b1fb3 100644 --- a/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx @@ -16,6 +16,7 @@ /// \author Mingze Li , CCNU #include "PWGHF/Core/DecayChannels.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/DataModel/DerivedTables.h" diff --git a/PWGHF/TableProducer/derivedDataCreatorLcToPKPi.cxx b/PWGHF/TableProducer/derivedDataCreatorLcToPKPi.cxx index 86688ca2bb5..691f65a3092 100644 --- a/PWGHF/TableProducer/derivedDataCreatorLcToPKPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorLcToPKPi.cxx @@ -17,6 +17,7 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/DataModel/DerivedTables.h" diff --git a/PWGHF/TableProducer/derivedDataCreatorXicToXiPiPi.cxx b/PWGHF/TableProducer/derivedDataCreatorXicToXiPiPi.cxx index 6dc0fac79d3..cd1a5ec4c42 100644 --- a/PWGHF/TableProducer/derivedDataCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorXicToXiPiPi.cxx @@ -15,7 +15,9 @@ /// /// \author Vít Kučera , Inha University +#include "PWGHF/Core/DecayChannelsLegacy.h" #include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/DataModel/DerivedTables.h" diff --git a/PWGHF/TableProducer/pidCreator.cxx b/PWGHF/TableProducer/pidCreator.cxx index 0f1e455313b..a563e8f5d43 100644 --- a/PWGHF/TableProducer/pidCreator.cxx +++ b/PWGHF/TableProducer/pidCreator.cxx @@ -14,6 +14,7 @@ /// /// \author Vít Kučera , Inha University +#include "PWGHF/DataModel/AliasTables.h" // IWYU pragma: keep #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/Utils/utilsPid.h" diff --git a/PWGHF/TableProducer/refitPvDummy.cxx b/PWGHF/TableProducer/refitPvDummy.cxx index 51b7db06236..b8a90739438 100644 --- a/PWGHF/TableProducer/refitPvDummy.cxx +++ b/PWGHF/TableProducer/refitPvDummy.cxx @@ -14,7 +14,7 @@ /// /// \author Mattia Faggin , University and INFN Padova, Italy -#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "Common/Core/trackUtilities.h" diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index 4f19865e40e..83e558c0dca 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -23,7 +23,8 @@ #include "PWGHF/Core/CentralityEstimation.h" #include "PWGHF/Core/SelectorCuts.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/AliasTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/Utils/utilsAnalysis.h" #include "PWGHF/Utils/utilsBfieldCCDB.h" #include "PWGHF/Utils/utilsEvSelHf.h" diff --git a/PWGHF/TableProducer/treeCreatorB0ToDPi.cxx b/PWGHF/TableProducer/treeCreatorB0ToDPi.cxx index b354d7e5595..bfd6b275b3f 100644 --- a/PWGHF/TableProducer/treeCreatorB0ToDPi.cxx +++ b/PWGHF/TableProducer/treeCreatorB0ToDPi.cxx @@ -18,6 +18,7 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" diff --git a/PWGHF/TableProducer/treeCreatorBplusToD0Pi.cxx b/PWGHF/TableProducer/treeCreatorBplusToD0Pi.cxx index a0e7b2a3597..4c5beb985c2 100644 --- a/PWGHF/TableProducer/treeCreatorBplusToD0Pi.cxx +++ b/PWGHF/TableProducer/treeCreatorBplusToD0Pi.cxx @@ -19,6 +19,7 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" diff --git a/PWGHF/TableProducer/treeCreatorBsToDsPi.cxx b/PWGHF/TableProducer/treeCreatorBsToDsPi.cxx index 594aae65cd1..c99fa0752e2 100644 --- a/PWGHF/TableProducer/treeCreatorBsToDsPi.cxx +++ b/PWGHF/TableProducer/treeCreatorBsToDsPi.cxx @@ -18,6 +18,7 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" diff --git a/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx b/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx index dcee30bf93b..f706b1049f1 100644 --- a/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx @@ -19,6 +19,7 @@ #include "PWGHF/Core/CentralityEstimation.h" #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" diff --git a/PWGHF/TableProducer/treeCreatorDsToKKPi.cxx b/PWGHF/TableProducer/treeCreatorDsToKKPi.cxx index a68b673f732..4c8fac390e4 100644 --- a/PWGHF/TableProducer/treeCreatorDsToKKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorDsToKKPi.cxx @@ -20,6 +20,7 @@ #include "PWGHF/Core/CentralityEstimation.h" #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" diff --git a/PWGHF/TableProducer/treeCreatorDstarToD0Pi.cxx b/PWGHF/TableProducer/treeCreatorDstarToD0Pi.cxx index f7055dfa8d0..059c3ed8f11 100644 --- a/PWGHF/TableProducer/treeCreatorDstarToD0Pi.cxx +++ b/PWGHF/TableProducer/treeCreatorDstarToD0Pi.cxx @@ -17,6 +17,7 @@ /// \author Fabrizio Grosa , CERN #include "PWGHF/Core/DecayChannels.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" diff --git a/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx b/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx index d80e3729507..4c63d4c7a78 100644 --- a/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx +++ b/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx @@ -18,6 +18,7 @@ /// \author Daniel Samitz #include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGLF/DataModel/LFStrangenessTables.h" diff --git a/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx b/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx index c7fa8952ef8..0d569697787 100644 --- a/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx @@ -19,6 +19,7 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" diff --git a/PWGHF/TableProducer/treeCreatorOmegac0ToOmegaPi.cxx b/PWGHF/TableProducer/treeCreatorOmegac0ToOmegaPi.cxx index 2bb41833fc0..78dc3546e8b 100644 --- a/PWGHF/TableProducer/treeCreatorOmegac0ToOmegaPi.cxx +++ b/PWGHF/TableProducer/treeCreatorOmegac0ToOmegaPi.cxx @@ -21,6 +21,7 @@ #include "PWGHF/Core/CentralityEstimation.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGLF/DataModel/mcCentrality.h" #include "Common/Core/RecoDecay.h" diff --git a/PWGHF/TableProducer/treeCreatorOmegacSt.cxx b/PWGHF/TableProducer/treeCreatorOmegacSt.cxx index d4b76a1b631..4095eef7dba 100644 --- a/PWGHF/TableProducer/treeCreatorOmegacSt.cxx +++ b/PWGHF/TableProducer/treeCreatorOmegacSt.cxx @@ -15,7 +15,7 @@ /// \author Jochen Klein /// \author Tiantian Cheng -#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/Utils/utilsTrkCandHf.h" #include "PWGLF/DataModel/LFStrangenessTables.h" diff --git a/PWGHF/TableProducer/treeCreatorSigmacCorrBkg.cxx b/PWGHF/TableProducer/treeCreatorSigmacCorrBkg.cxx index 9a4cec7ef9e..6b02cd1ae1c 100644 --- a/PWGHF/TableProducer/treeCreatorSigmacCorrBkg.cxx +++ b/PWGHF/TableProducer/treeCreatorSigmacCorrBkg.cxx @@ -17,8 +17,10 @@ /// \author Mattia Faggin , INFN PADOVA #include "PWGHF/Core/DecayChannels.h" +#include "PWGHF/Core/DecayChannelsLegacy.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/D2H/Utils/utilsSigmac.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" diff --git a/PWGHF/TableProducer/treeCreatorTccToD0D0Pi.cxx b/PWGHF/TableProducer/treeCreatorTccToD0D0Pi.cxx index 2791be74e04..1c63cdae324 100644 --- a/PWGHF/TableProducer/treeCreatorTccToD0D0Pi.cxx +++ b/PWGHF/TableProducer/treeCreatorTccToD0D0Pi.cxx @@ -16,6 +16,7 @@ #include "PWGHF/Core/CentralityEstimation.h" #include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/Utils/utilsBfieldCCDB.h" diff --git a/PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx b/PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx index 8cd92bef0c5..3d0500c3690 100644 --- a/PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx @@ -16,6 +16,7 @@ /// \author Carolina Reetz , Heidelberg University /// \author Jaeyoon Cho , Inha University +#include "PWGHF/Core/DecayChannelsLegacy.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" diff --git a/PWGHF/TableProducer/treeCreatorXiccToPKPiPi.cxx b/PWGHF/TableProducer/treeCreatorXiccToPKPiPi.cxx index 9e4f0e3703c..5307d3bfa7b 100644 --- a/PWGHF/TableProducer/treeCreatorXiccToPKPiPi.cxx +++ b/PWGHF/TableProducer/treeCreatorXiccToPKPiPi.cxx @@ -17,6 +17,7 @@ /// /// \author Jinjoo Seo , Inha University +#include "PWGHF/ALICE3/Core/DecayChannelsLegacy.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" diff --git a/PWGHF/Tasks/taskLcCentrality.cxx b/PWGHF/Tasks/taskLcCentrality.cxx index 96d4c03c2f3..9baf9bd3bcf 100644 --- a/PWGHF/Tasks/taskLcCentrality.cxx +++ b/PWGHF/Tasks/taskLcCentrality.cxx @@ -19,8 +19,10 @@ #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "Common/Core/RecoDecay.h" #include "Common/DataModel/Centrality.h" diff --git a/PWGHF/Tasks/taskMcEfficiency.cxx b/PWGHF/Tasks/taskMcEfficiency.cxx index b4d17250c8f..7f1c09eef47 100644 --- a/PWGHF/Tasks/taskMcEfficiency.cxx +++ b/PWGHF/Tasks/taskMcEfficiency.cxx @@ -17,6 +17,7 @@ #include "PWGHF/Core/HfHelper.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "Common/Core/RecoDecay.h" #include "Common/DataModel/TrackSelectionTables.h" diff --git a/PWGHF/Tasks/taskMcEfficiencyToXiPi.cxx b/PWGHF/Tasks/taskMcEfficiencyToXiPi.cxx index 78398ae2ec0..4ac10b7c538 100644 --- a/PWGHF/Tasks/taskMcEfficiencyToXiPi.cxx +++ b/PWGHF/Tasks/taskMcEfficiencyToXiPi.cxx @@ -14,6 +14,7 @@ /// /// \author Federica Zanone, Heidelberg University +#include "PWGHF/Core/DecayChannelsLegacy.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" diff --git a/PWGHF/Tasks/taskMcValidation.cxx b/PWGHF/Tasks/taskMcValidation.cxx index a2cdaf659eb..928dba464ba 100644 --- a/PWGHF/Tasks/taskMcValidation.cxx +++ b/PWGHF/Tasks/taskMcValidation.cxx @@ -20,7 +20,9 @@ #include "PWGHF/Core/CentralityEstimation.h" #include "PWGHF/Core/DecayChannels.h" +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "PWGHF/Utils/utilsEvSelHf.h" #include "PWGLF/DataModel/mcCentrality.h" diff --git a/PWGHF/Tasks/taskSelOptimisation.cxx b/PWGHF/Tasks/taskSelOptimisation.cxx index 77fae9bf1e0..cd4425ff6b9 100644 --- a/PWGHF/Tasks/taskSelOptimisation.cxx +++ b/PWGHF/Tasks/taskSelOptimisation.cxx @@ -14,7 +14,9 @@ /// /// \author Fabrizio Grosa , CERN +#include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/TrackIndexSkimmingTables.h" #include "Common/Core/RecoDecay.h" diff --git a/PWGJE/Core/JetHFUtilities.h b/PWGJE/Core/JetHFUtilities.h index 6e25d808d37..796285757bf 100644 --- a/PWGJE/Core/JetHFUtilities.h +++ b/PWGJE/Core/JetHFUtilities.h @@ -18,6 +18,7 @@ #define PWGJE_CORE_JETHFUTILITIES_H_ #include "PWGHF/Core/DecayChannels.h" +#include "PWGHF/Core/DecayChannelsLegacy.h" #include "PWGJE/DataModel/Jet.h" #include From ff48628324f122937af4ae14c0bec2793bc990f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= <26327373+vkucera@users.noreply.github.com> Date: Fri, 31 Oct 2025 19:24:08 +0100 Subject: [PATCH 977/986] [PWGHF,Tutorial] HfHelper: Make methods static (#13525) Co-authored-by: ALICE Builder --- .../TableProducer/candidateCreatorChic.cxx | 41 ++-- .../TableProducer/candidateCreatorX.cxx | 37 ++- .../candidateSelectorChicToJpsiGamma.cxx | 14 +- .../candidateSelectorD0Alice3Barrel.cxx | 24 +- .../candidateSelectorD0Alice3Forward.cxx | 24 +- .../candidateSelectorD0ParametrizedPid.cxx | 24 +- .../TableProducer/candidateSelectorJpsi.cxx | 19 +- .../candidateSelectorLcAlice3.cxx | 18 +- .../candidateSelectorLcParametrizedPid.cxx | 18 +- .../candidateSelectorXToJpsiPiPi.cxx | 14 +- .../treeCreatorChicToJpsiGamma.cxx | 14 +- .../TableProducer/treeCreatorXToJpsiPiPi.cxx | 10 +- PWGHF/ALICE3/Tasks/taskChic.cxx | 46 ++-- PWGHF/ALICE3/Tasks/taskD0Alice3Barrel.cxx | 18 +- PWGHF/ALICE3/Tasks/taskD0Alice3Forward.cxx | 18 +- PWGHF/ALICE3/Tasks/taskD0ParametrizedPid.cxx | 18 +- PWGHF/ALICE3/Tasks/taskJpsi.cxx | 36 ++- PWGHF/ALICE3/Tasks/taskLcAlice3.cxx | 18 +- PWGHF/ALICE3/Tasks/taskLcParametrizedPid.cxx | 17 +- PWGHF/ALICE3/Tasks/taskX.cxx | 40 ++- PWGHF/Core/HfHelper.h | 228 +++++++++--------- PWGHF/Core/HfMlResponseD0ToKPi.h | 14 +- PWGHF/Core/HfMlResponseDsToKKPi.h | 12 +- PWGHF/Core/HfMlResponseLcToK0sP.h | 6 +- PWGHF/Core/HfMlResponseLcToPKPi.h | 4 +- PWGHF/Core/HfMlResponseOmegacToOmegaPi.h | 6 +- .../candidateSelectorB0ToDPiReduced.cxx | 7 +- .../candidateSelectorBplusToD0PiReduced.cxx | 7 +- .../candidateSelectorBsToDsPiReduced.cxx | 7 +- .../candidateSelectorLbToLcPiReduced.cxx | 7 +- .../dataCreatorCharmHadPiReduced.cxx | 15 +- .../dataCreatorCharmResoReduced.cxx | 7 +- .../dataCreatorJpsiHadReduced.cxx | 10 +- PWGHF/D2H/Tasks/taskB0.cxx | 21 +- PWGHF/D2H/Tasks/taskB0Reduced.cxx | 56 +++-- PWGHF/D2H/Tasks/taskBplus.cxx | 21 +- PWGHF/D2H/Tasks/taskBplusReduced.cxx | 30 ++- PWGHF/D2H/Tasks/taskBplusToJpsiKReduced.cxx | 17 +- PWGHF/D2H/Tasks/taskBs.cxx | 21 +- PWGHF/D2H/Tasks/taskBsReduced.cxx | 30 ++- PWGHF/D2H/Tasks/taskBsToJpsiPhiReduced.cxx | 19 +- PWGHF/D2H/Tasks/taskCd.cxx | 17 +- PWGHF/D2H/Tasks/taskCharmPolarisation.cxx | 33 ++- PWGHF/D2H/Tasks/taskD0.cxx | 109 +++++---- .../Tasks/taskDirectedFlowCharmHadrons.cxx | 13 +- PWGHF/D2H/Tasks/taskDplus.cxx | 70 +++--- PWGHF/D2H/Tasks/taskDs.cxx | 37 ++- PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx | 19 +- PWGHF/D2H/Tasks/taskLb.cxx | 43 ++-- PWGHF/D2H/Tasks/taskLbReduced.cxx | 34 ++- PWGHF/D2H/Tasks/taskLc.cxx | 41 ++-- PWGHF/D2H/Tasks/taskLcToK0sP.cxx | 22 +- PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx | 1 - PWGHF/D2H/Tasks/taskSigmac.cxx | 37 ++- PWGHF/D2H/Tasks/taskSigmacToCascade.cxx | 9 +- PWGHF/D2H/Tasks/taskXic.cxx | 27 +-- PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx | 1 - PWGHF/D2H/Tasks/taskXicc.cxx | 58 +++-- PWGHF/HFC/TableProducer/correlatorD0D0bar.cxx | 42 ++-- .../correlatorD0D0barBarrelFullPid.cxx | 42 ++-- .../HFC/TableProducer/correlatorD0Hadrons.cxx | 74 +++--- .../TableProducer/correlatorDMesonPairs.cxx | 91 ++++--- .../TableProducer/correlatorDplusDminus.cxx | 37 ++- .../TableProducer/correlatorDplusHadrons.cxx | 46 ++-- .../HFC/TableProducer/correlatorDsHadrons.cxx | 76 +++--- .../HFC/TableProducer/correlatorLcHadrons.cxx | 98 ++++---- .../TableProducer/correlatorLcScHadrons.cxx | 30 ++- .../derivedDataCreatorCorrelationsReduced.cxx | 11 +- .../HFC/TableProducer/femtoDreamProducer.cxx | 1 - PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx | 4 +- .../HFC/Tasks/taskCorrelationDplusHadrons.cxx | 3 +- PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx | 5 +- PWGHF/HFC/Tasks/taskCorrelationLcHadrons.cxx | 3 +- PWGHF/HFC/Tasks/taskFlow.cxx | 17 +- .../TableProducer/treeCreatorElectronDCA.cxx | 1 - PWGHF/TableProducer/candidateCreatorB0.cxx | 3 +- PWGHF/TableProducer/candidateCreatorBplus.cxx | 5 +- PWGHF/TableProducer/candidateCreatorBs.cxx | 3 +- PWGHF/TableProducer/candidateCreatorLb.cxx | 5 +- .../candidateCreatorSigmac0plusplus.cxx | 7 +- ...candidateCreatorSigmac0plusplusCascade.cxx | 10 +- PWGHF/TableProducer/candidateCreatorXicc.cxx | 5 +- .../candidateSelectorB0ToDPi.cxx | 7 +- .../candidateSelectorBplusToD0Pi.cxx | 7 +- .../candidateSelectorBsToDsPi.cxx | 5 +- PWGHF/TableProducer/candidateSelectorCd.cxx | 6 +- PWGHF/TableProducer/candidateSelectorD0.cxx | 17 +- .../candidateSelectorDplusToPiKPi.cxx | 5 +- .../candidateSelectorDsToKKPi.cxx | 19 +- .../candidateSelectorDstarToD0Pi.cxx | 1 - .../candidateSelectorLbToLcPi.cxx | 8 +- PWGHF/TableProducer/candidateSelectorLc.cxx | 9 +- .../candidateSelectorLcToK0sP.cxx | 3 +- .../candidateSelectorXicToPKPi.cxx | 7 +- .../candidateSelectorXiccToPKPiPi.cxx | 3 +- .../derivedDataCreatorB0ToDPi.cxx | 9 +- .../derivedDataCreatorBplusToD0Pi.cxx | 9 +- .../derivedDataCreatorD0ToKPi.cxx | 13 +- .../derivedDataCreatorDplusToPiKPi.cxx | 7 +- .../derivedDataCreatorDsToKKPi.cxx | 7 +- .../derivedDataCreatorLcToPKPi.cxx | 9 +- .../derivedDataCreatorXicToXiPiPi.cxx | 5 +- PWGHF/TableProducer/treeCreatorB0ToDPi.cxx | 14 +- .../TableProducer/treeCreatorBplusToD0Pi.cxx | 20 +- PWGHF/TableProducer/treeCreatorBsToDsPi.cxx | 14 +- PWGHF/TableProducer/treeCreatorD0ToKPi.cxx | 24 +- .../TableProducer/treeCreatorDplusToPiKPi.cxx | 14 +- PWGHF/TableProducer/treeCreatorDsToKKPi.cxx | 22 +- PWGHF/TableProducer/treeCreatorLbToLcPi.cxx | 11 +- PWGHF/TableProducer/treeCreatorLcToK0sP.cxx | 26 +- PWGHF/TableProducer/treeCreatorLcToPKPi.cxx | 16 +- .../treeCreatorSigmacCorrBkg.cxx | 14 +- .../TableProducer/treeCreatorTccToD0D0Pi.cxx | 13 +- PWGHF/TableProducer/treeCreatorXicToPKPi.cxx | 12 +- .../TableProducer/treeCreatorXiccToPKPiPi.cxx | 12 +- PWGHF/Tasks/taskCharmHadImpactPar.cxx | 26 +- PWGHF/Tasks/taskLcCentrality.cxx | 14 +- PWGHF/Tasks/taskMcEfficiency.cxx | 19 +- Tutorials/PWGHF/taskMini.cxx | 11 +- 119 files changed, 1228 insertions(+), 1413 deletions(-) diff --git a/PWGHF/ALICE3/TableProducer/candidateCreatorChic.cxx b/PWGHF/ALICE3/TableProducer/candidateCreatorChic.cxx index e01b4fe0a6a..117fc633098 100644 --- a/PWGHF/ALICE3/TableProducer/candidateCreatorChic.cxx +++ b/PWGHF/ALICE3/TableProducer/candidateCreatorChic.cxx @@ -15,8 +15,12 @@ /// /// \author Alessandro De Falco , Cagliari University -#include -#include +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" + +#include "ALICE3/DataModel/ECAL.h" +#include "Common/Core/trackUtilities.h" #include "CommonConstants/PhysicsConstants.h" #include "DCAFitter/DCAFitterN.h" @@ -24,12 +28,8 @@ #include "ReconstructionDataFormats/DCA.h" #include "ReconstructionDataFormats/V0.h" -#include "ALICE3/DataModel/ECAL.h" -#include "Common/Core/trackUtilities.h" - -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include +#include using namespace o2; using namespace o2::analysis; @@ -67,7 +67,6 @@ struct HfCandidateCreatorChic { Configurable yCandMax{"yCandMax", -1., "max. cand. rapidity"}; o2::vertexing::DCAFitterN<2> df2; // 2-prong vertex fitter (to rebuild Jpsi vertex) - HfHelper hfHelper; double massJpsi{0.}; double massJpsiGamma{0.}; @@ -109,14 +108,14 @@ struct HfCandidateCreatorChic { if (!(jpsiCand.hfflag() & 1 << hf_cand_2prong::DecayType::JpsiToEE) && !(jpsiCand.hfflag() & 1 << hf_cand_2prong::DecayType::JpsiToMuMu)) { continue; } - if (yCandMax >= 0. && std::abs(hfHelper.yJpsi(jpsiCand)) > yCandMax) { + if (yCandMax >= 0. && std::abs(HfHelper::yJpsi(jpsiCand)) > yCandMax) { continue; } if (jpsiCand.isSelJpsiToEE() > 0) { - hMassJpsiToEE->Fill(hfHelper.invMassJpsiToEE(jpsiCand)); + hMassJpsiToEE->Fill(HfHelper::invMassJpsiToEE(jpsiCand)); } if (jpsiCand.isSelJpsiToMuMu() > 0) { - hMassJpsiToMuMu->Fill(hfHelper.invMassJpsiToMuMu(jpsiCand)); + hMassJpsiToMuMu->Fill(HfHelper::invMassJpsiToMuMu(jpsiCand)); } hPtJpsi->Fill(jpsiCand.pt()); hCPAJpsi->Fill(jpsiCand.cpa()); @@ -189,7 +188,7 @@ struct HfCandidateCreatorChic { impactParameter0.getY(), 0.f, // impactParameter1.getY(), std::sqrt(impactParameter0.getSigmaY2()), 0.f, // std::sqrt(impactParameter1.getSigmaY2()), jpsiCand.globalIndex(), ecal.globalIndex(), - hfFlag, hfHelper.invMassJpsiToMuMu(jpsiCand)); + hfFlag, HfHelper::invMassJpsiToMuMu(jpsiCand)); // calculate invariant mass auto arrayMomenta = std::array{pvecJpsi, pvecGamma}; @@ -201,9 +200,9 @@ struct HfCandidateCreatorChic { hMassChicToJpsiToMuMuGamma->Fill(massJpsiGamma); } } // ecal loop - } // Jpsi loop - } // process -}; // struct + } // Jpsi loop + } // process +}; // struct /// Extends the base table with expression columns. struct HfCandidateCreatorChicExpressions { @@ -217,8 +216,6 @@ struct HfCandidateCreatorChicMc { Produces rowMcMatchRec; Produces rowMcMatchGen; - HfHelper hfHelper; - OutputObj hMassJpsiToMuMuMatched{TH1F("hMassChicToJpsiToMuMuMatched", "2-prong candidates;inv. mass (J/#psi (#rightarrow #mu+ #mu-)) (GeV/#it{c}^{2});entries", 500, 0., 5.)}; OutputObj hMassEMatched{TH1F("hMassEMatched", "2-prong candidates;inv. mass (J/#psi (#rightarrow #mu+ #mu-)) (GeV/#it{c}^{2});entries", 500, 0., 5.)}; OutputObj hEphotonMatched{TH1F("hEphotonMatched", "2-prong candidates;inv. mass (J/#psi (#rightarrow #mu+ #mu-)) (GeV/#it{c}^{2});entries", 500, 0., 5.)}; @@ -249,7 +246,7 @@ struct HfCandidateCreatorChicMc { // chi_c → J/ψ gamma indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayJpsiDaughters, Pdg::kJPsi, std::array{+kMuonPlus, -kMuonPlus}, true); if (indexRec > -1) { - hMassJpsiToMuMuMatched->Fill(hfHelper.invMassJpsiToMuMu(candidate.prong0())); + hMassJpsiToMuMuMatched->Fill(HfHelper::invMassJpsiToMuMu(candidate.prong0())); int indexMother = RecoDecay::getMother(mcParticles, mcParticles.rawIteratorAt(indexRec), Pdg::kChiC1); int indexMotherGamma = RecoDecay::getMother(mcParticles, mcParticles.rawIteratorAt(candidate.prong1().mcparticleId()), Pdg::kChiC1); @@ -262,7 +259,7 @@ struct HfCandidateCreatorChicMc { RecoDecay::getDaughters(particleMother, &arrAllDaughtersIndex, std::array{static_cast(kGamma), static_cast(Pdg::kJPsi)}, 1); if (arrAllDaughtersIndex.size() == 2) { flag = 1 << hf_cand_chic::DecayType::ChicToJpsiToMuMuGamma; - hMassChicToJpsiToMuMuGammaMatched->Fill(hfHelper.invMassChicToJpsiGamma(candidate)); + hMassChicToJpsiToMuMuGammaMatched->Fill(HfHelper::invMassChicToJpsiGamma(candidate)); } } } @@ -299,8 +296,8 @@ struct HfCandidateCreatorChicMc { rowMcMatchGen(flag, origin, channel); } // candidate loop - } // process -}; // struct + } // process +}; // struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGHF/ALICE3/TableProducer/candidateCreatorX.cxx b/PWGHF/ALICE3/TableProducer/candidateCreatorX.cxx index 2e3477dab99..ee6317aaa27 100644 --- a/PWGHF/ALICE3/TableProducer/candidateCreatorX.cxx +++ b/PWGHF/ALICE3/TableProducer/candidateCreatorX.cxx @@ -16,8 +16,11 @@ /// \author Rik Spijkers , Utrecht University /// \author Luca Micheletti , INFN -#include -#include +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" + +#include "Common/Core/trackUtilities.h" #include "CommonConstants/PhysicsConstants.h" #include "DCAFitter/DCAFitterN.h" @@ -25,11 +28,8 @@ #include "ReconstructionDataFormats/DCA.h" #include "ReconstructionDataFormats/V0.h" -#include "Common/Core/trackUtilities.h" - -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include +#include using namespace o2; using namespace o2::analysis; @@ -67,7 +67,6 @@ struct HfCandidateCreatorX { o2::vertexing::DCAFitterN<2> df2; // 2-prong vertex fitter (to rebuild Jpsi vertex) o2::vertexing::DCAFitterN<3> df3; // 3-prong vertex fitter - HfHelper hfHelper; double massPi{0.}; double massJpsi{0.}; @@ -119,20 +118,20 @@ struct HfCandidateCreatorX { if (!(jpsiCand.hfflag() & 1 << hf_cand_2prong::DecayType::JpsiToEE) && !(jpsiCand.hfflag() & 1 << hf_cand_2prong::DecayType::JpsiToMuMu)) { continue; } - if (yCandMax >= 0. && std::abs(hfHelper.yJpsi(jpsiCand)) > yCandMax) { + if (yCandMax >= 0. && std::abs(HfHelper::yJpsi(jpsiCand)) > yCandMax) { continue; } if (jpsiCand.isSelJpsiToEE() > 0) { - if (std::abs(hfHelper.invMassJpsiToEE(jpsiCand) - massJpsi) > diffMassJpsiMax) { + if (std::abs(HfHelper::invMassJpsiToEE(jpsiCand) - massJpsi) > diffMassJpsiMax) { continue; } - hMassJpsiToEE->Fill(hfHelper.invMassJpsiToEE(jpsiCand)); + hMassJpsiToEE->Fill(HfHelper::invMassJpsiToEE(jpsiCand)); } if (jpsiCand.isSelJpsiToMuMu() > 0) { - if (std::abs(hfHelper.invMassJpsiToMuMu(jpsiCand) - massJpsi) > diffMassJpsiMax) { + if (std::abs(HfHelper::invMassJpsiToMuMu(jpsiCand) - massJpsi) > diffMassJpsiMax) { continue; } - hMassJpsiToMuMu->Fill(hfHelper.invMassJpsiToMuMu(jpsiCand)); + hMassJpsiToMuMu->Fill(HfHelper::invMassJpsiToMuMu(jpsiCand)); } hPtJpsi->Fill(jpsiCand.pt()); @@ -255,10 +254,10 @@ struct HfCandidateCreatorX { hMassXToJpsiToMuMuPiPi->Fill(massJpsiPiPi); } } // pi- loop - } // pi+ loop - } // Jpsi loop - } // process -}; // struct + } // pi+ loop + } // Jpsi loop + } // process +}; // struct /// Extends the base table with expression columns. struct HfCandidateCreatorXExpressions { @@ -363,8 +362,8 @@ struct HfCandidateCreatorXMc { rowMcMatchGen(flag, origin, channel); } // candidate loop - } // process -}; // struct + } // process +}; // struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGHF/ALICE3/TableProducer/candidateSelectorChicToJpsiGamma.cxx b/PWGHF/ALICE3/TableProducer/candidateSelectorChicToJpsiGamma.cxx index 5160a2ba99c..fab70fd5eb5 100644 --- a/PWGHF/ALICE3/TableProducer/candidateSelectorChicToJpsiGamma.cxx +++ b/PWGHF/ALICE3/TableProducer/candidateSelectorChicToJpsiGamma.cxx @@ -15,16 +15,16 @@ /// /// \author Alessandro De Falco , Università/INFN Cagliari -#include +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/Core/SelectorCuts.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include using namespace o2; using namespace o2::aod; @@ -50,8 +50,6 @@ struct HfCandidateSelectorChicToJpsiGamma { Configurable> binsPt{"binsPt", std::vector{hf_cuts_chic_to_jpsi_gamma::vecBinsPt}, "pT bin limits"}; Configurable> cuts{"cuts", {hf_cuts_chic_to_jpsi_gamma::Cuts[0], hf_cuts_chic_to_jpsi_gamma::NBinsPt, hf_cuts_chic_to_jpsi_gamma::NCutVars, hf_cuts_chic_to_jpsi_gamma::labelsPt, hf_cuts_chic_to_jpsi_gamma::labelsCutVar}, "Jpsi candidate selection per pT bin"}; - HfHelper hfHelper; - /// Selection on goodness of daughter tracks /// \note should be applied at candidate selection /// \param track is daughter track @@ -80,7 +78,7 @@ struct HfCandidateSelectorChicToJpsiGamma { } auto mchic = o2::constants::physics::MassChiC1; // chi_c1(1p) - if (std::abs(hfHelper.invMassChicToJpsiGamma(hfCandChic) - mchic) > cuts->get(pTBin, "m")) { + if (std::abs(HfHelper::invMassChicToJpsiGamma(hfCandChic) - mchic) > cuts->get(pTBin, "m")) { // LOGF(debug, "Chic topol selection failed at mass diff check"); return false; // check that mass difference is within bounds } diff --git a/PWGHF/ALICE3/TableProducer/candidateSelectorD0Alice3Barrel.cxx b/PWGHF/ALICE3/TableProducer/candidateSelectorD0Alice3Barrel.cxx index 705deeeaff2..0de3e010c44 100644 --- a/PWGHF/ALICE3/TableProducer/candidateSelectorD0Alice3Barrel.cxx +++ b/PWGHF/ALICE3/TableProducer/candidateSelectorD0Alice3Barrel.cxx @@ -15,18 +15,18 @@ /// \author Nima Zardoshti , CERN /// \author Vít Kučera , CERN -#include -#include +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" + +#include "ALICE3/DataModel/RICH.h" #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" -#include "ALICE3/DataModel/RICH.h" - -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include +#include using namespace o2; using namespace o2::analysis; @@ -70,8 +70,6 @@ struct HfCandidateSelectorD0Alice3Barrel { Configurable> binsPt{"binsPt", std::vector{hf_cuts_d0_to_pi_k::vecBinsPt}, "pT bin limits"}; Configurable> cuts{"cuts", {hf_cuts_d0_to_pi_k::Cuts[0], hf_cuts_d0_to_pi_k::NBinsPt, hf_cuts_d0_to_pi_k::NCutVars, hf_cuts_d0_to_pi_k::labelsPt, hf_cuts_d0_to_pi_k::labelsCutVar}, "D0 candidate selection per pT bin"}; - HfHelper hfHelper; - using TracksSel = soa::Join; /// Conjugate-independent topological cuts @@ -147,11 +145,11 @@ struct HfCandidateSelectorD0Alice3Barrel { // invariant-mass cut if (trackPion.sign() > 0) { - if (std::abs(hfHelper.invMassD0ToPiK(candidate) - o2::constants::physics::MassD0) > cuts->get(pTBin, "m")) { + if (std::abs(HfHelper::invMassD0ToPiK(candidate) - o2::constants::physics::MassD0) > cuts->get(pTBin, "m")) { return false; } } else { - if (std::abs(hfHelper.invMassD0barToKPi(candidate) - o2::constants::physics::MassD0) > cuts->get(pTBin, "m")) { + if (std::abs(HfHelper::invMassD0barToKPi(candidate) - o2::constants::physics::MassD0) > cuts->get(pTBin, "m")) { return false; } } @@ -168,11 +166,11 @@ struct HfCandidateSelectorD0Alice3Barrel { // cut on cos(theta*) if (trackPion.sign() > 0) { - if (std::abs(hfHelper.cosThetaStarD0(candidate)) > cuts->get(pTBin, "cos theta*")) { + if (std::abs(HfHelper::cosThetaStarD0(candidate)) > cuts->get(pTBin, "cos theta*")) { return false; } } else { - if (std::abs(hfHelper.cosThetaStarD0bar(candidate)) > cuts->get(pTBin, "cos theta*")) { + if (std::abs(HfHelper::cosThetaStarD0bar(candidate)) > cuts->get(pTBin, "cos theta*")) { return false; } } diff --git a/PWGHF/ALICE3/TableProducer/candidateSelectorD0Alice3Forward.cxx b/PWGHF/ALICE3/TableProducer/candidateSelectorD0Alice3Forward.cxx index a213c3edd04..00ef9b7d673 100644 --- a/PWGHF/ALICE3/TableProducer/candidateSelectorD0Alice3Forward.cxx +++ b/PWGHF/ALICE3/TableProducer/candidateSelectorD0Alice3Forward.cxx @@ -15,18 +15,18 @@ /// \author Nima Zardoshti , CERN /// \author Vít Kučera , CERN -#include -#include +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" + +#include "ALICE3/DataModel/RICH.h" #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" -#include "ALICE3/DataModel/RICH.h" - -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include +#include using namespace o2; using namespace o2::analysis; @@ -70,8 +70,6 @@ struct HfCandidateSelectorD0Alice3Forward { Configurable> binsPt{"binsPt", std::vector{hf_cuts_d0_to_pi_k::vecBinsPt}, "pT bin limits"}; Configurable> cuts{"cuts", {hf_cuts_d0_to_pi_k::Cuts[0], hf_cuts_d0_to_pi_k::NBinsPt, hf_cuts_d0_to_pi_k::NCutVars, hf_cuts_d0_to_pi_k::labelsPt, hf_cuts_d0_to_pi_k::labelsCutVar}, "D0 candidate selection per pT bin"}; - HfHelper hfHelper; - using TracksSel = soa::Join; /// Conjugate-independent topological cuts @@ -147,11 +145,11 @@ struct HfCandidateSelectorD0Alice3Forward { // invariant-mass cut if (trackPion.sign() > 0) { - if (std::abs(hfHelper.invMassD0ToPiK(candidate) - o2::constants::physics::MassD0) > cuts->get(pTBin, "m")) { + if (std::abs(HfHelper::invMassD0ToPiK(candidate) - o2::constants::physics::MassD0) > cuts->get(pTBin, "m")) { return false; } } else { - if (std::abs(hfHelper.invMassD0barToKPi(candidate) - o2::constants::physics::MassD0) > cuts->get(pTBin, "m")) { + if (std::abs(HfHelper::invMassD0barToKPi(candidate) - o2::constants::physics::MassD0) > cuts->get(pTBin, "m")) { return false; } } @@ -168,11 +166,11 @@ struct HfCandidateSelectorD0Alice3Forward { // cut on cos(theta*) if (trackPion.sign() > 0) { - if (std::abs(hfHelper.cosThetaStarD0(candidate)) > cuts->get(pTBin, "cos theta*")) { + if (std::abs(HfHelper::cosThetaStarD0(candidate)) > cuts->get(pTBin, "cos theta*")) { return false; } } else { - if (std::abs(hfHelper.cosThetaStarD0bar(candidate)) > cuts->get(pTBin, "cos theta*")) { + if (std::abs(HfHelper::cosThetaStarD0bar(candidate)) > cuts->get(pTBin, "cos theta*")) { return false; } } diff --git a/PWGHF/ALICE3/TableProducer/candidateSelectorD0ParametrizedPid.cxx b/PWGHF/ALICE3/TableProducer/candidateSelectorD0ParametrizedPid.cxx index 6a46231b0c2..7a8d6111ee0 100644 --- a/PWGHF/ALICE3/TableProducer/candidateSelectorD0ParametrizedPid.cxx +++ b/PWGHF/ALICE3/TableProducer/candidateSelectorD0ParametrizedPid.cxx @@ -15,18 +15,18 @@ /// \author Nima Zardoshti , CERN /// \author Vít Kučera , CERN -#include -#include +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" + +#include "ALICE3/DataModel/RICH.h" #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" -#include "ALICE3/DataModel/RICH.h" - -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include +#include using namespace o2; using namespace o2::analysis; @@ -70,8 +70,6 @@ struct HfCandidateSelectorD0ParametrizedPid { Configurable> binsPt{"binsPt", std::vector{hf_cuts_d0_to_pi_k::vecBinsPt}, "pT bin limits"}; Configurable> cuts{"cuts", {hf_cuts_d0_to_pi_k::Cuts[0], hf_cuts_d0_to_pi_k::NBinsPt, hf_cuts_d0_to_pi_k::NCutVars, hf_cuts_d0_to_pi_k::labelsPt, hf_cuts_d0_to_pi_k::labelsCutVar}, "D0 candidate selection per pT bin"}; - HfHelper hfHelper; - using TracksSel = soa::Join; /// Conjugate-independent topological cuts @@ -147,11 +145,11 @@ struct HfCandidateSelectorD0ParametrizedPid { // invariant-mass cut if (trackPion.sign() > 0) { - if (std::abs(hfHelper.invMassD0ToPiK(candidate) - o2::constants::physics::MassD0) > cuts->get(pTBin, "m")) { + if (std::abs(HfHelper::invMassD0ToPiK(candidate) - o2::constants::physics::MassD0) > cuts->get(pTBin, "m")) { return false; } } else { - if (std::abs(hfHelper.invMassD0barToKPi(candidate) - o2::constants::physics::MassD0) > cuts->get(pTBin, "m")) { + if (std::abs(HfHelper::invMassD0barToKPi(candidate) - o2::constants::physics::MassD0) > cuts->get(pTBin, "m")) { return false; } } @@ -168,11 +166,11 @@ struct HfCandidateSelectorD0ParametrizedPid { // cut on cos(theta*) if (trackPion.sign() > 0) { - if (std::abs(hfHelper.cosThetaStarD0(candidate)) > cuts->get(pTBin, "cos theta*")) { + if (std::abs(HfHelper::cosThetaStarD0(candidate)) > cuts->get(pTBin, "cos theta*")) { return false; } } else { - if (std::abs(hfHelper.cosThetaStarD0bar(candidate)) > cuts->get(pTBin, "cos theta*")) { + if (std::abs(HfHelper::cosThetaStarD0bar(candidate)) > cuts->get(pTBin, "cos theta*")) { return false; } } diff --git a/PWGHF/ALICE3/TableProducer/candidateSelectorJpsi.cxx b/PWGHF/ALICE3/TableProducer/candidateSelectorJpsi.cxx index 391aba49da0..5ca50181673 100644 --- a/PWGHF/ALICE3/TableProducer/candidateSelectorJpsi.cxx +++ b/PWGHF/ALICE3/TableProducer/candidateSelectorJpsi.cxx @@ -16,18 +16,18 @@ /// \author Nima Zardoshti , CERN /// \author Vít Kučera , CERN -#include - -#include "CommonConstants/PhysicsConstants.h" -#include "Framework/AnalysisTask.h" +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" #include "ALICE3/DataModel/MID.h" #include "ALICE3/DataModel/RICH.h" #include "Common/Core/TrackSelectorPID.h" -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/AnalysisTask.h" + +#include using namespace o2; using namespace o2::analysis; @@ -86,7 +86,6 @@ struct HfCandidateSelectorJpsi { Configurable> binsPt{"binsPt", std::vector{hf_cuts_jpsi_to_e_e::vecBinsPt}, "pT bin limits"}; Configurable> cuts{"cuts", {hf_cuts_jpsi_to_e_e::Cuts[0], hf_cuts_jpsi_to_e_e::NBinsPt, hf_cuts_jpsi_to_e_e::NCutVars, hf_cuts_jpsi_to_e_e::labelsPt, hf_cuts_jpsi_to_e_e::labelsCutVar}, "Jpsi candidate selection per pT bin"}; - HfHelper hfHelper; TrackSelectorEl selectorElectron; TrackSelectorMu selectorMuon; @@ -126,12 +125,12 @@ struct HfCandidateSelectorJpsi { } // cut on e+ e− invariant mass - if (std::abs(hfHelper.invMassJpsiToEE(candidate) - o2::constants::physics::MassJPsi) > cuts->get(pTBin, "m")) { + if (std::abs(HfHelper::invMassJpsiToEE(candidate) - o2::constants::physics::MassJPsi) > cuts->get(pTBin, "m")) { selEE = 0; } // cut on μ+ μ− invariant mass - if (std::abs(hfHelper.invMassJpsiToMuMu(candidate) - o2::constants::physics::MassJPsi) > cuts->get(pTBin, "m")) { + if (std::abs(HfHelper::invMassJpsiToMuMu(candidate) - o2::constants::physics::MassJPsi) > cuts->get(pTBin, "m")) { selMuMu = 0; } diff --git a/PWGHF/ALICE3/TableProducer/candidateSelectorLcAlice3.cxx b/PWGHF/ALICE3/TableProducer/candidateSelectorLcAlice3.cxx index c9abeedad39..509ba9bb813 100644 --- a/PWGHF/ALICE3/TableProducer/candidateSelectorLcAlice3.cxx +++ b/PWGHF/ALICE3/TableProducer/candidateSelectorLcAlice3.cxx @@ -16,17 +16,17 @@ /// \author Nima Zardoshti , CERN /// \author Vít Kučera , CERN -#include +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" + +#include "ALICE3/DataModel/RICH.h" #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" -#include "ALICE3/DataModel/RICH.h" - -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include using namespace o2; using namespace o2::analysis; @@ -71,8 +71,6 @@ struct HfCandidateSelectorLcAlice3 { Configurable> binsPt{"binsPt", std::vector{hf_cuts_lc_to_p_k_pi::vecBinsPt}, "pT bin limits"}; Configurable> cuts{"cuts", {hf_cuts_lc_to_p_k_pi::Cuts[0], hf_cuts_lc_to_p_k_pi::NBinsPt, hf_cuts_lc_to_p_k_pi::NCutVars, hf_cuts_lc_to_p_k_pi::labelsPt, hf_cuts_lc_to_p_k_pi::labelsCutVar}, "Lc candidate selection per pT bin"}; - HfHelper hfHelper; - using TracksSel = soa::Join; /// Conjugate-independent topological cuts @@ -136,11 +134,11 @@ struct HfCandidateSelectorLcAlice3 { } if (trackProton.globalIndex() == candidate.prong0Id()) { - if (std::abs(hfHelper.invMassLcToPKPi(candidate) - o2::constants::physics::MassLambdaCPlus) > cuts->get(pTBin, "m")) { + if (std::abs(HfHelper::invMassLcToPKPi(candidate) - o2::constants::physics::MassLambdaCPlus) > cuts->get(pTBin, "m")) { return false; } } else { - if (std::abs(hfHelper.invMassLcToPiKP(candidate) - o2::constants::physics::MassLambdaCPlus) > cuts->get(pTBin, "m")) { + if (std::abs(HfHelper::invMassLcToPiKP(candidate) - o2::constants::physics::MassLambdaCPlus) > cuts->get(pTBin, "m")) { return false; } } diff --git a/PWGHF/ALICE3/TableProducer/candidateSelectorLcParametrizedPid.cxx b/PWGHF/ALICE3/TableProducer/candidateSelectorLcParametrizedPid.cxx index 0a3210a63f6..6bcc7fc438c 100644 --- a/PWGHF/ALICE3/TableProducer/candidateSelectorLcParametrizedPid.cxx +++ b/PWGHF/ALICE3/TableProducer/candidateSelectorLcParametrizedPid.cxx @@ -16,17 +16,17 @@ /// \author Nima Zardoshti , CERN /// \author Vít Kučera , CERN -#include +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" + +#include "ALICE3/DataModel/RICH.h" #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" -#include "ALICE3/DataModel/RICH.h" - -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include using namespace o2; using namespace o2::analysis; @@ -72,8 +72,6 @@ struct HfCandidateSelectorLcParametrizedPid { Configurable> binsPt{"binsPt", std::vector{hf_cuts_lc_to_p_k_pi::vecBinsPt}, "pT bin limits"}; Configurable> cuts{"cuts", {hf_cuts_lc_to_p_k_pi::Cuts[0], hf_cuts_lc_to_p_k_pi::NBinsPt, hf_cuts_lc_to_p_k_pi::NCutVars, hf_cuts_lc_to_p_k_pi::labelsPt, hf_cuts_lc_to_p_k_pi::labelsCutVar}, "Lc candidate selection per pT bin"}; - HfHelper hfHelper; - using TracksSel = soa::Join; /// Conjugate-independent topological cuts @@ -137,11 +135,11 @@ struct HfCandidateSelectorLcParametrizedPid { } if (trackProton.globalIndex() == candidate.prong0Id()) { - if (std::abs(hfHelper.invMassLcToPKPi(candidate) - o2::constants::physics::MassLambdaCPlus) > cuts->get(pTBin, "m")) { + if (std::abs(HfHelper::invMassLcToPKPi(candidate) - o2::constants::physics::MassLambdaCPlus) > cuts->get(pTBin, "m")) { return false; } } else { - if (std::abs(hfHelper.invMassLcToPiKP(candidate) - o2::constants::physics::MassLambdaCPlus) > cuts->get(pTBin, "m")) { + if (std::abs(HfHelper::invMassLcToPiKP(candidate) - o2::constants::physics::MassLambdaCPlus) > cuts->get(pTBin, "m")) { return false; } } diff --git a/PWGHF/ALICE3/TableProducer/candidateSelectorXToJpsiPiPi.cxx b/PWGHF/ALICE3/TableProducer/candidateSelectorXToJpsiPiPi.cxx index bff87d84e70..222d8261259 100644 --- a/PWGHF/ALICE3/TableProducer/candidateSelectorXToJpsiPiPi.cxx +++ b/PWGHF/ALICE3/TableProducer/candidateSelectorXToJpsiPiPi.cxx @@ -16,16 +16,16 @@ /// \author Rik Spijkers , Utrecht University /// \author Luca Micheletti , INFN -#include +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/Core/SelectorCuts.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include using namespace o2; using namespace o2::aod; @@ -51,8 +51,6 @@ struct HfCandidateSelectorXToJpsiPiPi { Configurable> binsPt{"binsPt", std::vector{hf_cuts_x_to_jpsi_pi_pi::vecBinsPt}, "pT bin limits"}; Configurable> cuts{"cuts", {hf_cuts_x_to_jpsi_pi_pi::Cuts[0], hf_cuts_x_to_jpsi_pi_pi::NBinsPt, hf_cuts_x_to_jpsi_pi_pi::NCutVars, hf_cuts_x_to_jpsi_pi_pi::labelsPt, hf_cuts_x_to_jpsi_pi_pi::labelsCutVar}, "Jpsi candidate selection per pT bin"}; - HfHelper hfHelper; - using TracksSel = soa::Join; /// Selection on goodness of daughter tracks @@ -86,7 +84,7 @@ struct HfCandidateSelectorXToJpsiPiPi { return false; // check that the candidate pT is within the analysis range } - if (std::abs(hfHelper.invMassXToJpsiPiPi(hfCandX) - o2::constants::physics::MassX3872) > cuts->get(pTBin, "m")) { + if (std::abs(HfHelper::invMassXToJpsiPiPi(hfCandX) - o2::constants::physics::MassX3872) > cuts->get(pTBin, "m")) { // LOGF(debug, "X topol selection failed at mass diff check"); return false; // check that mass difference is within bounds } diff --git a/PWGHF/ALICE3/TableProducer/treeCreatorChicToJpsiGamma.cxx b/PWGHF/ALICE3/TableProducer/treeCreatorChicToJpsiGamma.cxx index 1b164a0fc0e..33af9544284 100644 --- a/PWGHF/ALICE3/TableProducer/treeCreatorChicToJpsiGamma.cxx +++ b/PWGHF/ALICE3/TableProducer/treeCreatorChicToJpsiGamma.cxx @@ -18,14 +18,14 @@ /// \author Alessandro De Falco , Università/INFN Cagliari /// \author Luca Micheletti , INFN -#include "CommonConstants/PhysicsConstants.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" - #include "PWGHF/Core/HfHelper.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + using namespace o2; using namespace o2::aod; using namespace o2::framework; @@ -122,8 +122,6 @@ struct HfTreeCreatorChicToJpsiGamma { Produces rowCandidateFullEvents; Produces rowCandidateFullParticles; - HfHelper hfHelper; - void init(InitContext const&) { } @@ -203,8 +201,8 @@ struct HfTreeCreatorChicToJpsiGamma { candidate.originMcRec()); } }; - fillTable(0, candidate.isSelChicToJpsiToMuMuGamma(), hfHelper.invMassChicToJpsiGamma(candidate), hfHelper.ctChic(candidate), hfHelper.yChic(candidate)); - // fillTable(1, candidate.isSelChicToJpsiToEEGamma(), hfHelper.invMassChicToJpsiGamma(candidate), hfHelper.ctChic(candidate), hfHelper.yChic(candidate)); + fillTable(0, candidate.isSelChicToJpsiToMuMuGamma(), HfHelper::invMassChicToJpsiGamma(candidate), HfHelper::ctChic(candidate), HfHelper::yChic(candidate)); + // fillTable(1, candidate.isSelChicToJpsiToEEGamma(), HfHelper::invMassChicToJpsiGamma(candidate), HfHelper::ctChic(candidate), HfHelper::yChic(candidate)); } // Filling particle properties diff --git a/PWGHF/ALICE3/TableProducer/treeCreatorXToJpsiPiPi.cxx b/PWGHF/ALICE3/TableProducer/treeCreatorXToJpsiPiPi.cxx index 7a981b35798..b4ebf84eac2 100644 --- a/PWGHF/ALICE3/TableProducer/treeCreatorXToJpsiPiPi.cxx +++ b/PWGHF/ALICE3/TableProducer/treeCreatorXToJpsiPiPi.cxx @@ -17,13 +17,13 @@ /// /// \author Luca Micheletti , INFN -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" - #include "PWGHF/Core/HfHelper.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + using namespace o2; using namespace o2::aod; using namespace o2::framework; @@ -144,8 +144,6 @@ struct HfTreeCreatorXToJpsiPiPi { Produces rowCandidateFullEvents; Produces rowCandidateFullParticles; - HfHelper hfHelper; - using TracksWPid = soa::Join; void init(InitContext const&) @@ -236,7 +234,7 @@ struct HfTreeCreatorXToJpsiPiPi { } }; - fillTable(0, candidate.isSelXToJpsiToMuMuPiPi(), hfHelper.invMassXToJpsiPiPi(candidate), hfHelper.ctX(candidate), hfHelper.yX(candidate), hfHelper.qX(candidate), hfHelper.dRX(candidate, 1), hfHelper.dRX(candidate, 2), hfHelper.balancePtPionsX(candidate)); + fillTable(0, candidate.isSelXToJpsiToMuMuPiPi(), HfHelper::invMassXToJpsiPiPi(candidate), HfHelper::ctX(candidate), HfHelper::yX(candidate), HfHelper::qX(candidate), HfHelper::dRX(candidate, 1), HfHelper::dRX(candidate, 2), HfHelper::balancePtPionsX(candidate)); } // Filling particle properties diff --git a/PWGHF/ALICE3/Tasks/taskChic.cxx b/PWGHF/ALICE3/Tasks/taskChic.cxx index f8cb85454a1..f7331b7d417 100644 --- a/PWGHF/ALICE3/Tasks/taskChic.cxx +++ b/PWGHF/ALICE3/Tasks/taskChic.cxx @@ -15,16 +15,16 @@ /// \author Gian Michele Innocenti , CERN /// \author Alessandro De Falco , Cagliari University -#include +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/Core/SelectorCuts.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include using namespace o2; using namespace o2::aod; @@ -47,8 +47,6 @@ struct HfTaskChic { Configurable modeChicToJpsiToMuMuGamma{"modeChicToJpsiToMuMuGamma", true, "Perform Jpsi to mu+mu- analysis"}; Configurable> binsPt{"binsPt", std::vector{hf_cuts_chic_to_jpsi_gamma::vecBinsPt}, "pT bin limits"}; - HfHelper hfHelper; - Filter filterSelectCandidates = (aod::hf_sel_candidate_chic::isSelChicToJpsiToEEGamma >= selectionFlagChic || aod::hf_sel_candidate_chic::isSelChicToJpsiToMuMuGamma >= selectionFlagChic); HistogramRegistry registry{ @@ -80,12 +78,12 @@ struct HfTaskChic { if (!(candidate.hfflag() & 1 << decayMode)) { continue; } - if (yCandMax >= 0. && std::abs(hfHelper.yChic(candidate)) > yCandMax) { + if (yCandMax >= 0. && std::abs(HfHelper::yChic(candidate)) > yCandMax) { continue; } - registry.fill(HIST("hMass"), hfHelper.invMassChicToJpsiGamma(candidate), candidate.pt()); - registry.fill(HIST("hDeltaMass"), hfHelper.invMassChicToJpsiGamma(candidate) - candidate.jpsiToMuMuMass() + o2::constants::physics::MassJPsi, candidate.pt()); + registry.fill(HIST("hMass"), HfHelper::invMassChicToJpsiGamma(candidate), candidate.pt()); + registry.fill(HIST("hDeltaMass"), HfHelper::invMassChicToJpsiGamma(candidate) - candidate.jpsiToMuMuMass() + o2::constants::physics::MassJPsi, candidate.pt()); registry.fill(HIST("hPtCand"), candidate.pt()); registry.fill(HIST("hPtProng0"), candidate.ptProng0()); registry.fill(HIST("hPtProng1"), candidate.ptProng1()); @@ -101,8 +99,8 @@ struct HfTaskChic { registry.fill(HIST("hDecLenXYErr"), candidate.errorDecayLengthXY(), candidate.pt()); // registry.fill(HIST("hEGamma"), candidate.prong1().e()); } // candidate loop - } // process -}; // struct + } // process +}; // struct struct HfTaskChicMc { Configurable selectionFlagChic{"selectionFlagChic", 1, "Selection Flag for Chic"}; @@ -110,8 +108,6 @@ struct HfTaskChicMc { Configurable modeChicToJpsiToMuMuGamma{"modeChicToJpsiToMuMuGamma", true, "Perform Jpsi to mu+mu- analysis"}; Configurable> binsPt{"binsPt", std::vector{hf_cuts_chic_to_jpsi_gamma::vecBinsPt}, "pT bin limits"}; - HfHelper hfHelper; - Filter filterSelectCandidates = (aod::hf_sel_candidate_chic::isSelChicToJpsiToEEGamma >= selectionFlagChic || aod::hf_sel_candidate_chic::isSelChicToJpsiToMuMuGamma >= selectionFlagChic); HistogramRegistry registry{ @@ -165,7 +161,7 @@ struct HfTaskChicMc { if (!(candidate.hfflag() & 1 << decayMode)) { continue; } - if (yCandMax >= 0. && std::abs(hfHelper.yChic(candidate)) > yCandMax) { + if (yCandMax >= 0. && std::abs(HfHelper::yChic(candidate)) > yCandMax) { continue; } if (candidate.flagMcMatchRec() == 1 << decayMode) { @@ -177,29 +173,29 @@ struct HfTaskChicMc { registry.fill(HIST("hCPARecSig"), candidate.cpa(), candidate.pt()); registry.fill(HIST("hEtaRecSig"), candidate.eta(), candidate.pt()); registry.fill(HIST("hDecLengthRecSig"), candidate.decayLength(), candidate.pt()); - registry.fill(HIST("hDeltaMassRecSig"), hfHelper.invMassChicToJpsiGamma(candidate) - candidate.jpsiToMuMuMass() + o2::constants::physics::MassJPsi), candidate.pt(); - registry.fill(HIST("hMassRecSig"), hfHelper.invMassChicToJpsiGamma(candidate), candidate.pt()); + registry.fill(HIST("hDeltaMassRecSig"), HfHelper::invMassChicToJpsiGamma(candidate) - candidate.jpsiToMuMuMass() + o2::constants::physics::MassJPsi), candidate.pt(); + registry.fill(HIST("hMassRecSig"), HfHelper::invMassChicToJpsiGamma(candidate), candidate.pt()); registry.fill(HIST("hd0Prong0RecSig"), candidate.impactParameter0(), candidate.pt()); registry.fill(HIST("hd0Prong1RecSig"), candidate.impactParameter1(), candidate.pt()); registry.fill(HIST("hPtProng0RecSig"), candidate.ptProng0(), candidate.pt()); registry.fill(HIST("hPtProng1RecSig"), candidate.ptProng1(), candidate.pt()); registry.fill(HIST("hChi2PCARecSig"), candidate.chi2PCA(), candidate.pt()); - registry.fill(HIST("hCtRecSig"), hfHelper.ctChic(candidate), candidate.pt()); - registry.fill(HIST("hYRecSig"), hfHelper.yChic(candidate), candidate.pt()); + registry.fill(HIST("hCtRecSig"), HfHelper::ctChic(candidate), candidate.pt()); + registry.fill(HIST("hYRecSig"), HfHelper::yChic(candidate), candidate.pt()); } else { registry.fill(HIST("hPtRecBg"), candidate.pt()); registry.fill(HIST("hCPARecBg"), candidate.cpa(), candidate.pt()); registry.fill(HIST("hEtaRecBg"), candidate.eta(), candidate.pt()); registry.fill(HIST("hDecLengthRecBg"), candidate.decayLength(), candidate.pt()); - registry.fill(HIST("hDeltaMassRecBg"), hfHelper.invMassChicToJpsiGamma(candidate) - candidate.jpsiToMuMuMass() + o2::constants::physics::MassJPsi), candidate.pt(); - registry.fill(HIST("hMassRecBg"), hfHelper.invMassChicToJpsiGamma(candidate), candidate.pt()); + registry.fill(HIST("hDeltaMassRecBg"), HfHelper::invMassChicToJpsiGamma(candidate) - candidate.jpsiToMuMuMass() + o2::constants::physics::MassJPsi), candidate.pt(); + registry.fill(HIST("hMassRecBg"), HfHelper::invMassChicToJpsiGamma(candidate), candidate.pt()); registry.fill(HIST("hd0Prong0RecBg"), candidate.impactParameter0(), candidate.pt()); registry.fill(HIST("hd0Prong1RecBg"), candidate.impactParameter1(), candidate.pt()); registry.fill(HIST("hPtProng0RecBg"), candidate.ptProng0(), candidate.pt()); registry.fill(HIST("hPtProng1RecBg"), candidate.ptProng1(), candidate.pt()); registry.fill(HIST("hChi2PCARecBg"), candidate.chi2PCA(), candidate.pt()); - registry.fill(HIST("hCtRecBg"), hfHelper.ctChic(candidate), candidate.pt()); - registry.fill(HIST("hYRecBg"), hfHelper.yChic(candidate), candidate.pt()); + registry.fill(HIST("hCtRecBg"), HfHelper::ctChic(candidate), candidate.pt()); + registry.fill(HIST("hYRecBg"), HfHelper::yChic(candidate), candidate.pt()); } } // rec // MC gen. @@ -225,8 +221,8 @@ struct HfTaskChicMc { registry.fill(HIST("hPtProng1Gen"), ptProngs[1], particle.pt()); } } // gen - } // process -}; // struct + } // process +}; // struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGHF/ALICE3/Tasks/taskD0Alice3Barrel.cxx b/PWGHF/ALICE3/Tasks/taskD0Alice3Barrel.cxx index da86e77a06b..546d7946394 100644 --- a/PWGHF/ALICE3/Tasks/taskD0Alice3Barrel.cxx +++ b/PWGHF/ALICE3/Tasks/taskD0Alice3Barrel.cxx @@ -15,15 +15,15 @@ /// \author Gian Michele Innocenti , CERN /// \author Vít Kučera , CERN +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" + #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" - using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -33,8 +33,6 @@ struct HfTaskD0Alice3Barrel { // Configurable centralitySelectionMin{"centralitySelectionMin", 0.0, "Lower boundary of centrality selection"}; // Configurable centralitySelectionMax{"centralitySelectionMax", 0.0, "Higher boundary of centrality selection"}; - HfHelper hfHelper; - Filter filterSelectCandidates = (aod::hf_sel_candidate_d0_alice3_barrel::isSelHfFlag >= 1); HistogramRegistry registry{ @@ -73,14 +71,14 @@ struct HfTaskD0Alice3Barrel { if (!(candidate.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { continue; } - if (std::abs(hfHelper.yD0(candidate)) > 4.0) { + if (std::abs(HfHelper::yD0(candidate)) > 4.0) { continue; } - auto massD0 = hfHelper.invMassD0ToPiK(candidate); - auto massD0bar = hfHelper.invMassD0barToKPi(candidate); + auto massD0 = HfHelper::invMassD0ToPiK(candidate); + auto massD0bar = HfHelper::invMassD0barToKPi(candidate); auto ptCandidate = candidate.pt(); - auto rapidityCandidate = std::abs(hfHelper.yD0(candidate)); + auto rapidityCandidate = std::abs(HfHelper::yD0(candidate)); if (candidate.isSelD0NoPid() >= 1) { registry.fill(HIST("hMassSigBkgD0NoPid"), massD0, ptCandidate, rapidityCandidate); diff --git a/PWGHF/ALICE3/Tasks/taskD0Alice3Forward.cxx b/PWGHF/ALICE3/Tasks/taskD0Alice3Forward.cxx index dea53a20d70..a43dc94d436 100644 --- a/PWGHF/ALICE3/Tasks/taskD0Alice3Forward.cxx +++ b/PWGHF/ALICE3/Tasks/taskD0Alice3Forward.cxx @@ -15,15 +15,15 @@ /// \author Gian Michele Innocenti , CERN /// \author Vít Kučera , CERN +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" + #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" - using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -32,8 +32,6 @@ using namespace o2::framework::expressions; struct HfTaskD0Alice3Forward { Filter filterSelectCandidates = (aod::hf_sel_candidate_d0_alice3_forward::isSelHfFlag >= 1); - HfHelper hfHelper; - HistogramRegistry registry{ "registry", {{"hMassGen", "2-prong candidates (generated); #it{p}_{T}; #it{y}", {HistType::kTH2F, {{150, 0., 30.}, {8, 0, 4.0}}}}, @@ -49,14 +47,14 @@ struct HfTaskD0Alice3Forward { if (!(candidate.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { continue; } - if (std::abs(hfHelper.yD0(candidate)) > 4.0) { + if (std::abs(HfHelper::yD0(candidate)) > 4.0) { continue; } - auto massD0 = hfHelper.invMassD0ToPiK(candidate); - // auto massD0bar = hfHelper.invMassD0barToKPi(candidate); + auto massD0 = HfHelper::invMassD0ToPiK(candidate); + // auto massD0bar = HfHelper::invMassD0barToKPi(candidate); auto ptCandidate = candidate.pt(); - auto rapidityCandidate = std::abs(hfHelper.yD0(candidate)); + auto rapidityCandidate = std::abs(HfHelper::yD0(candidate)); if (candidate.isSelD0FRichPid() >= 1) { registry.fill(HIST("hMassSigBkgD0ForwardRICHPID"), massD0, ptCandidate, rapidityCandidate); diff --git a/PWGHF/ALICE3/Tasks/taskD0ParametrizedPid.cxx b/PWGHF/ALICE3/Tasks/taskD0ParametrizedPid.cxx index 3fe2487b2f3..46387f053a6 100644 --- a/PWGHF/ALICE3/Tasks/taskD0ParametrizedPid.cxx +++ b/PWGHF/ALICE3/Tasks/taskD0ParametrizedPid.cxx @@ -15,15 +15,15 @@ /// \author Gian Michele Innocenti , CERN /// \author Vít Kučera , CERN +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" + #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" - using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -33,8 +33,6 @@ struct HfTaskD0ParametrizedPid { // Configurable centralitySelectionMin{"centralitySelectionMin", 0.0, "Lower boundary of centrality selection"}; // Configurable centralitySelectionMax{"centralitySelectionMax", 30000.0, "Higher boundary of centrality selection"}; - HfHelper hfHelper; - using McParticlesHf = soa::Join; Filter filterSelectCandidates = (aod::hf_sel_candidate_d0_parametrized_pid::isSelD0NoPid >= 1 || aod::hf_sel_candidate_d0_parametrized_pid::isSelD0barNoPid >= 1); @@ -71,14 +69,14 @@ struct HfTaskD0ParametrizedPid { if (!(candidate.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { continue; } - if (std::abs(hfHelper.yD0(candidate)) > 4.0) { + if (std::abs(HfHelper::yD0(candidate)) > 4.0) { continue; } - auto massD0 = hfHelper.invMassD0ToPiK(candidate); - // auto massD0bar = hfHelper.invMassD0barToKPi(candidate); + auto massD0 = HfHelper::invMassD0ToPiK(candidate); + // auto massD0bar = HfHelper::invMassD0barToKPi(candidate); auto ptCandidate = candidate.pt(); - auto rapidityCandidate = std::abs(hfHelper.yD0(candidate)); + auto rapidityCandidate = std::abs(HfHelper::yD0(candidate)); if (candidate.isSelD0NoPid() >= 1) { registry.fill(HIST("hMassSigBkgD0NoPid"), massD0, ptCandidate, rapidityCandidate); diff --git a/PWGHF/ALICE3/Tasks/taskJpsi.cxx b/PWGHF/ALICE3/Tasks/taskJpsi.cxx index a9210ccca86..9a20f6f42e9 100644 --- a/PWGHF/ALICE3/Tasks/taskJpsi.cxx +++ b/PWGHF/ALICE3/Tasks/taskJpsi.cxx @@ -16,15 +16,15 @@ /// \author Vít Kučera , CERN /// \author Biao Zhang , CCNU -#include +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include using namespace o2; using namespace o2::analysis; @@ -50,8 +50,6 @@ struct HfTaskJpsi { Configurable selectedMid{"selectedMid", false, "select MID for Jpsi to mu+mu-"}; Configurable> binsPt{"binsPt", std::vector{hf_cuts_jpsi_to_e_e::vecBinsPt}, "pT bin limits"}; - HfHelper hfHelper; - Filter filterSelectCandidates = (aod::hf_sel_candidate_jpsi::isSelJpsiToEETopol >= selectionFlagJpsi || aod::hf_sel_candidate_jpsi::isSelJpsiToMuMuTopol >= selectionFlagJpsi); HistogramRegistry registry{ @@ -111,14 +109,14 @@ struct HfTaskJpsi { } } } - if (yCandMax >= 0. && std::abs(hfHelper.yJpsi(candidate)) > yCandMax) { + if (yCandMax >= 0. && std::abs(HfHelper::yJpsi(candidate)) > yCandMax) { continue; } if (modeJpsiToMuMu) { - registry.fill(HIST("hMass"), hfHelper.invMassJpsiToMuMu(candidate), candidate.pt()); + registry.fill(HIST("hMass"), HfHelper::invMassJpsiToMuMu(candidate), candidate.pt()); } else { - registry.fill(HIST("hMass"), hfHelper.invMassJpsiToEE(candidate), candidate.pt()); + registry.fill(HIST("hMass"), HfHelper::invMassJpsiToEE(candidate), candidate.pt()); } registry.fill(HIST("hPtCand"), candidate.pt()); registry.fill(HIST("hPtProng0"), candidate.ptProng0()); @@ -149,8 +147,6 @@ struct HfTaskJpsiMc { Configurable selectedMid{"selectedMid", false, "select MID for Jpsi to mu+mu-"}; Configurable> binsPt{"binsPt", std::vector{hf_cuts_jpsi_to_e_e::vecBinsPt}, "pT bin limits"}; - HfHelper hfHelper; - using McParticlesHf = soa::Join; Filter filterSelectCandidates = (aod::hf_sel_candidate_jpsi::isSelJpsiToEETopol >= selectionFlagJpsi || aod::hf_sel_candidate_jpsi::isSelJpsiToMuMuTopol >= selectionFlagJpsi); @@ -234,7 +230,7 @@ struct HfTaskJpsiMc { } } - if (yCandMax >= 0. && std::abs(hfHelper.yJpsi(candidate)) > yCandMax) { + if (yCandMax >= 0. && std::abs(HfHelper::yJpsi(candidate)) > yCandMax) { continue; } if (candidate.flagMcMatchRec() == 1 << decayMode) { @@ -246,9 +242,9 @@ struct HfTaskJpsiMc { registry.fill(HIST("hCPARecSig"), candidate.cpa()); registry.fill(HIST("hEtaRecSig"), candidate.eta()); if (modeJpsiToMuMu) { - registry.fill(HIST("hMassSig"), hfHelper.invMassJpsiToMuMu(candidate), candidate.pt()); + registry.fill(HIST("hMassSig"), HfHelper::invMassJpsiToMuMu(candidate), candidate.pt()); } else { - registry.fill(HIST("hMassSig"), hfHelper.invMassJpsiToEE(candidate), candidate.pt()); + registry.fill(HIST("hMassSig"), HfHelper::invMassJpsiToEE(candidate), candidate.pt()); } registry.fill(HIST("hDecLengthSig"), candidate.decayLength(), candidate.pt()); registry.fill(HIST("hDecLengthXYSig"), candidate.decayLengthXY(), candidate.pt()); @@ -256,8 +252,8 @@ struct HfTaskJpsiMc { registry.fill(HIST("hd0Prong1Sig"), candidate.impactParameter1(), candidate.pt()); registry.fill(HIST("hd0d0Sig"), candidate.impactParameterProduct(), candidate.pt()); registry.fill(HIST("hChi2PCASig"), candidate.chi2PCA(), candidate.pt()); - registry.fill(HIST("hCtSig"), hfHelper.ctJpsi(candidate), candidate.pt()); - registry.fill(HIST("hYSig"), hfHelper.yJpsi(candidate), candidate.pt()); + registry.fill(HIST("hCtSig"), HfHelper::ctJpsi(candidate), candidate.pt()); + registry.fill(HIST("hYSig"), HfHelper::yJpsi(candidate), candidate.pt()); registry.fill(HIST("hYGenSig"), RecoDecay::y(particleMother.pVector(), o2::constants::physics::MassJPsi), particleMother.pt()); } else { @@ -265,9 +261,9 @@ struct HfTaskJpsiMc { registry.fill(HIST("hCPARecBg"), candidate.cpa()); registry.fill(HIST("hEtaRecBg"), candidate.eta()); if (modeJpsiToMuMu) { - registry.fill(HIST("hMassBg"), hfHelper.invMassJpsiToMuMu(candidate), candidate.pt()); + registry.fill(HIST("hMassBg"), HfHelper::invMassJpsiToMuMu(candidate), candidate.pt()); } else { - registry.fill(HIST("hMassBg"), hfHelper.invMassJpsiToEE(candidate), candidate.pt()); + registry.fill(HIST("hMassBg"), HfHelper::invMassJpsiToEE(candidate), candidate.pt()); } registry.fill(HIST("hDecLengthBg"), candidate.decayLength(), candidate.pt()); registry.fill(HIST("hDecLengthxyBg"), candidate.decayLengthXY(), candidate.pt()); @@ -275,8 +271,8 @@ struct HfTaskJpsiMc { registry.fill(HIST("hd0Prong1Bg"), candidate.impactParameter1(), candidate.pt()); registry.fill(HIST("hd0d0Bg"), candidate.impactParameterProduct(), candidate.pt()); registry.fill(HIST("hChi2PCABg"), candidate.chi2PCA(), candidate.pt()); - registry.fill(HIST("hCtBg"), hfHelper.ctJpsi(candidate), candidate.pt()); - registry.fill(HIST("hYBg"), hfHelper.yJpsi(candidate), candidate.pt()); + registry.fill(HIST("hCtBg"), HfHelper::ctJpsi(candidate), candidate.pt()); + registry.fill(HIST("hYBg"), HfHelper::yJpsi(candidate), candidate.pt()); } } // MC gen. diff --git a/PWGHF/ALICE3/Tasks/taskLcAlice3.cxx b/PWGHF/ALICE3/Tasks/taskLcAlice3.cxx index 9bbfdaf91e5..ec32c52976c 100644 --- a/PWGHF/ALICE3/Tasks/taskLcAlice3.cxx +++ b/PWGHF/ALICE3/Tasks/taskLcAlice3.cxx @@ -15,15 +15,15 @@ /// \author Gian Michele Innocenti , CERN /// \author Vít Kučera , CERN +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" + #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" - using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -32,8 +32,6 @@ using namespace o2::framework::expressions; struct HfTaskLcAlice3 { Filter filterSelectCandidates = (aod::hf_sel_candidate_lc_alice3::isSelLcToPKPiNoPid == 1 || aod::hf_sel_candidate_lc_alice3::isSelLcToPiKPNoPid == 1); - HfHelper hfHelper; - HistogramRegistry registry{ "registry", {{"hMassGen", "3-prong candidates (generated); #it{p}_{T}; #it{y}", {HistType::kTH2F, {{150, 0., 30.}, {8, 0, 4.0}}}}, @@ -58,14 +56,14 @@ struct HfTaskLcAlice3 { if (!(candidate.hfflag() & 1 << aod::hf_cand_3prong::DecayType::LcToPKPi)) { continue; } - if (std::abs(hfHelper.yLc(candidate)) > 4.0) { + if (std::abs(HfHelper::yLc(candidate)) > 4.0) { continue; } - auto massLc = hfHelper.invMassLcToPKPi(candidate); - auto massLcSwap = hfHelper.invMassLcToPiKP(candidate); + auto massLc = HfHelper::invMassLcToPKPi(candidate); + auto massLcSwap = HfHelper::invMassLcToPiKP(candidate); auto ptCandidate = candidate.pt(); - auto rapidityCandidate = std::abs(hfHelper.yLc(candidate)); + auto rapidityCandidate = std::abs(HfHelper::yLc(candidate)); if (candidate.isSelLcToPKPiNoPid() == 1) { registry.fill(HIST("hMassSigBkgLcNoPid"), massLc, ptCandidate, rapidityCandidate); diff --git a/PWGHF/ALICE3/Tasks/taskLcParametrizedPid.cxx b/PWGHF/ALICE3/Tasks/taskLcParametrizedPid.cxx index 8936c56e2c1..b22c531e621 100644 --- a/PWGHF/ALICE3/Tasks/taskLcParametrizedPid.cxx +++ b/PWGHF/ALICE3/Tasks/taskLcParametrizedPid.cxx @@ -15,22 +15,21 @@ /// \author Gian Michele Innocenti , CERN /// \author Vít Kučera , CERN +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" + #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" - using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; /// Fills MC histograms. struct HfTaskLcParametrizedPid { - HfHelper hfHelper; Filter filterSelectCandidates = (aod::hf_sel_candidate_lc_parametrized_pid::isSelLcToPKPiNoPid == 1 || aod::hf_sel_candidate_lc_parametrized_pid::isSelLcToPiKPNoPid == 1); @@ -55,14 +54,14 @@ struct HfTaskLcParametrizedPid { if (!(candidate.hfflag() & 1 << aod::hf_cand_3prong::DecayType::LcToPKPi)) { continue; } - if (std::abs(hfHelper.yLc(candidate)) > 4.0) { + if (std::abs(HfHelper::yLc(candidate)) > 4.0) { continue; } - auto massLc = hfHelper.invMassLcToPKPi(candidate); - auto massLcSwap = hfHelper.invMassLcToPiKP(candidate); + auto massLc = HfHelper::invMassLcToPKPi(candidate); + auto massLcSwap = HfHelper::invMassLcToPiKP(candidate); auto ptCandidate = candidate.pt(); - auto rapidityCandidate = std::abs(hfHelper.yLc(candidate)); + auto rapidityCandidate = std::abs(HfHelper::yLc(candidate)); if (candidate.isSelLcToPKPiNoPid() == 1) { registry.fill(HIST("hMassSigBkgLcNoPid"), massLc, ptCandidate, rapidityCandidate); diff --git a/PWGHF/ALICE3/Tasks/taskX.cxx b/PWGHF/ALICE3/Tasks/taskX.cxx index f090eb57876..2be307e0f92 100644 --- a/PWGHF/ALICE3/Tasks/taskX.cxx +++ b/PWGHF/ALICE3/Tasks/taskX.cxx @@ -16,16 +16,16 @@ /// \author Rik Spijkers , Utrecht University /// \author Luca Micheletti , INFN -#include +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/Core/SelectorCuts.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include using namespace o2; using namespace o2::aod; @@ -48,8 +48,6 @@ struct HfTaskX { Configurable modeXToJpsiToMuMuPiPi{"modeXToJpsiToMuMuPiPi", false, "Perform Jpsi to mu+mu- analysis"}; Configurable> binsPt{"binsPt", std::vector{hf_cuts_x_to_jpsi_pi_pi::vecBinsPt}, "pT bin limits"}; - HfHelper hfHelper; - Filter filterSelectCandidates = (aod::hf_sel_candidate_x::isSelXToJpsiToEEPiPi >= selectionFlagX || aod::hf_sel_candidate_x::isSelXToJpsiToMuMuPiPi >= selectionFlagX); HistogramRegistry registry{ @@ -81,11 +79,11 @@ struct HfTaskX { if (!(candidate.hfflag() & 1 << decayMode)) { continue; } - if (yCandMax >= 0. && std::abs(hfHelper.yX(candidate)) > yCandMax) { + if (yCandMax >= 0. && std::abs(HfHelper::yX(candidate)) > yCandMax) { continue; } - registry.fill(HIST("hMass"), hfHelper.invMassXToJpsiPiPi(candidate), candidate.pt()); + registry.fill(HIST("hMass"), HfHelper::invMassXToJpsiPiPi(candidate), candidate.pt()); registry.fill(HIST("hPtCand"), candidate.pt()); registry.fill(HIST("hPtProng0"), candidate.ptProng0()); registry.fill(HIST("hPtProng1"), candidate.ptProng1()); @@ -102,8 +100,8 @@ struct HfTaskX { registry.fill(HIST("hDecLenErr"), candidate.errorDecayLength(), candidate.pt()); registry.fill(HIST("hDecLenXYErr"), candidate.errorDecayLengthXY(), candidate.pt()); } // candidate loop - } // process -}; // struct + } // process +}; // struct struct HfTaskXMc { Configurable selectionFlagX{"selectionFlagX", 1, "Selection Flag for X"}; @@ -111,8 +109,6 @@ struct HfTaskXMc { Configurable modeXToJpsiToMuMuPiPi{"modeXToJpsiToMuMuPiPi", false, "Perform Jpsi to mu+mu- analysis"}; Configurable> binsPt{"binsPt", std::vector{hf_cuts_x_to_jpsi_pi_pi::vecBinsPt}, "pT bin limits"}; - HfHelper hfHelper; - Filter filterSelectCandidates = (aod::hf_sel_candidate_x::isSelXToJpsiToEEPiPi >= selectionFlagX || aod::hf_sel_candidate_x::isSelXToJpsiToMuMuPiPi >= selectionFlagX); HistogramRegistry registry{ @@ -169,7 +165,7 @@ struct HfTaskXMc { if (!(candidate.hfflag() & 1 << decayMode)) { continue; } - if (yCandMax >= 0. && std::abs(hfHelper.yX(candidate)) > yCandMax) { + if (yCandMax >= 0. && std::abs(HfHelper::yX(candidate)) > yCandMax) { continue; } if (candidate.flagMcMatchRec() == 1 << decayMode) { @@ -181,7 +177,7 @@ struct HfTaskXMc { registry.fill(HIST("hEtaRecSig"), candidate.eta(), candidate.pt()); registry.fill(HIST("hDeclengthRecSig"), candidate.decayLength(), candidate.pt()); - registry.fill(HIST("hMassRecSig"), hfHelper.invMassXToJpsiPiPi(candidate), candidate.pt()); + registry.fill(HIST("hMassRecSig"), HfHelper::invMassXToJpsiPiPi(candidate), candidate.pt()); registry.fill(HIST("hd0Prong0RecSig"), candidate.impactParameter0(), candidate.pt()); registry.fill(HIST("hd0Prong1RecSig"), candidate.impactParameter1(), candidate.pt()); registry.fill(HIST("hd0Prong2RecSig"), candidate.impactParameter2(), candidate.pt()); @@ -189,15 +185,15 @@ struct HfTaskXMc { registry.fill(HIST("hPtProng1RecSig"), candidate.ptProng1(), candidate.pt()); registry.fill(HIST("hPtProng2RecSig"), candidate.ptProng2(), candidate.pt()); registry.fill(HIST("hChi2PCASig"), candidate.chi2PCA(), candidate.pt()); - registry.fill(HIST("hCtSig"), hfHelper.ctX(candidate), candidate.pt()); - registry.fill(HIST("hYSig"), hfHelper.yX(candidate), candidate.pt()); + registry.fill(HIST("hCtSig"), HfHelper::ctX(candidate), candidate.pt()); + registry.fill(HIST("hYSig"), HfHelper::yX(candidate), candidate.pt()); } else { registry.fill(HIST("hPtRecBg"), candidate.pt()); registry.fill(HIST("hCPARecBg"), candidate.cpa(), candidate.pt()); registry.fill(HIST("hEtaRecBg"), candidate.eta(), candidate.pt()); registry.fill(HIST("hDeclengthRecBg"), candidate.decayLength(), candidate.pt()); - registry.fill(HIST("hMassRecBg"), hfHelper.invMassXToJpsiPiPi(candidate), candidate.pt()); + registry.fill(HIST("hMassRecBg"), HfHelper::invMassXToJpsiPiPi(candidate), candidate.pt()); registry.fill(HIST("hd0Prong0RecBg"), candidate.impactParameter0(), candidate.pt()); registry.fill(HIST("hd0Prong1RecBg"), candidate.impactParameter1(), candidate.pt()); registry.fill(HIST("hd0Prong2RecBg"), candidate.impactParameter2(), candidate.pt()); @@ -205,8 +201,8 @@ struct HfTaskXMc { registry.fill(HIST("hPtProng1RecBg"), candidate.ptProng1(), candidate.pt()); registry.fill(HIST("hPtProng2RecBg"), candidate.ptProng2(), candidate.pt()); registry.fill(HIST("hChi2PCABg"), candidate.chi2PCA(), candidate.pt()); - registry.fill(HIST("hCtBg"), hfHelper.ctX(candidate), candidate.pt()); - registry.fill(HIST("hYBg"), hfHelper.yX(candidate), candidate.pt()); + registry.fill(HIST("hCtBg"), HfHelper::ctX(candidate), candidate.pt()); + registry.fill(HIST("hYBg"), HfHelper::yX(candidate), candidate.pt()); } } // rec // MC gen. @@ -230,8 +226,8 @@ struct HfTaskXMc { registry.fill(HIST("hPtGenProng2"), ptProngs[2], particle.pt()); } } // gen - } // process -}; // struct + } // process +}; // struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGHF/Core/HfHelper.h b/PWGHF/Core/HfHelper.h index 9bbae7b2617..419360c00be 100644 --- a/PWGHF/Core/HfHelper.h +++ b/PWGHF/Core/HfHelper.h @@ -52,43 +52,43 @@ class HfHelper // D0(bar) → π± K∓ template - auto ctD0(const T& candidate) + static auto ctD0(const T& candidate) { return candidate.ct(o2::constants::physics::MassD0); } template - auto yD0(const T& candidate) + static auto yD0(const T& candidate) { return candidate.y(o2::constants::physics::MassD0); } template - auto eD0(const T& candidate) + static auto eD0(const T& candidate) { return candidate.e(o2::constants::physics::MassD0); } template - auto invMassD0ToPiK(const T& candidate) + static auto invMassD0ToPiK(const T& candidate) { return candidate.m(std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus}); } template - auto invMassD0barToKPi(const T& candidate) + static auto invMassD0barToKPi(const T& candidate) { return candidate.m(std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}); } template - auto cosThetaStarD0(const T& candidate) + static auto cosThetaStarD0(const T& candidate) { return candidate.cosThetaStar(std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus}, o2::constants::physics::MassD0, 1); } template - auto cosThetaStarD0bar(const T& candidate) + static auto cosThetaStarD0bar(const T& candidate) { return candidate.cosThetaStar(std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}, o2::constants::physics::MassD0, 0); } @@ -96,33 +96,33 @@ class HfHelper // J/ψ template - auto ctJpsi(const T& candidate) + static auto ctJpsi(const T& candidate) { return candidate.ct(o2::constants::physics::MassJPsi); } template - auto yJpsi(const T& candidate) + static auto yJpsi(const T& candidate) { return candidate.y(o2::constants::physics::MassJPsi); } template - auto eJpsi(const T& candidate) + static auto eJpsi(const T& candidate) { return candidate.e(o2::constants::physics::MassJPsi); } // J/ψ → e+ e− template - auto invMassJpsiToEE(const T& candidate) + static auto invMassJpsiToEE(const T& candidate) { return candidate.m(std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}); } // J/ψ → μ+ μ− template - auto invMassJpsiToMuMu(const T& candidate) + static auto invMassJpsiToMuMu(const T& candidate) { return candidate.m(std::array{o2::constants::physics::MassMuonPlus, o2::constants::physics::MassMuonMinus}); } @@ -130,25 +130,25 @@ class HfHelper // hf_cand_casc template - auto invMassLcToK0sP(const T& candidate) + static auto invMassLcToK0sP(const T& candidate) { return candidate.m(std::array{o2::constants::physics::MassProton, o2::constants::physics::MassK0Short}); // first daughter is bachelor } template - auto invMassGammaToEE(const T& candidate) + static auto invMassGammaToEE(const T& candidate) { return candidate.m(std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}); } template - auto ctV0K0s(const T& candidate) + static auto ctV0K0s(const T& candidate) { return candidate.ctV0(o2::constants::physics::MassK0Short); } template - auto ctV0Lambda(const T& candidate) + static auto ctV0Lambda(const T& candidate) { return candidate.ctV0(o2::constants::physics::MassLambda0); } @@ -156,37 +156,37 @@ class HfHelper // B± → D0bar(D0) π± template - auto ctBplus(const T& candidate) + static auto ctBplus(const T& candidate) { return candidate.ct(o2::constants::physics::MassBPlus); } template - auto yBplus(const T& candidate) + static auto yBplus(const T& candidate) { return candidate.y(o2::constants::physics::MassBPlus); } template - auto eBplus(const T& candidate) + static auto eBplus(const T& candidate) { return candidate.e(o2::constants::physics::MassBPlus); } template - auto invMassBplusToD0Pi(const T& candidate) + static auto invMassBplusToD0Pi(const T& candidate) { return candidate.m(std::array{o2::constants::physics::MassD0, o2::constants::physics::MassPiPlus}); } template - auto invMassBplusToJpsiK(const T& candidate) + static auto invMassBplusToJpsiK(const T& candidate) { return candidate.m(std::array{o2::constants::physics::MassMuon, o2::constants::physics::MassMuon, o2::constants::physics::MassKPlus}); } template - auto cosThetaStarBplus(const T& candidate) + static auto cosThetaStarBplus(const T& candidate) { return candidate.cosThetaStar(std::array{o2::constants::physics::MassD0, o2::constants::physics::MassPiPlus}, o2::constants::physics::MassBPlus, 1); } @@ -196,31 +196,31 @@ class HfHelper // D± → π± K∓ π± template - auto ctDplus(const T& candidate) + static auto ctDplus(const T& candidate) { return candidate.ct(o2::constants::physics::MassDPlus); } template - auto yDplus(const T& candidate) + static auto yDplus(const T& candidate) { return candidate.y(o2::constants::physics::MassDPlus); } template - auto eDplus(const T& candidate) + static auto eDplus(const T& candidate) { return candidate.e(o2::constants::physics::MassDPlus); } template - auto invMassDplusToPiKPi(const T& candidate) + static auto invMassDplusToPiKPi(const T& candidate) { return candidate.m(std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}); } template - auto invMassDplusToPiKPi(const T& pVec0, const T& pVec1, const T& pVec2) + static auto invMassDplusToPiKPi(const T& pVec0, const T& pVec1, const T& pVec2) { return RecoDecay::m(std::array{pVec0, pVec1, pVec2}, std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}); @@ -229,55 +229,55 @@ class HfHelper // Ds± → K± K∓ π± template - auto ctDs(const T& candidate) + static auto ctDs(const T& candidate) { return candidate.ct(o2::constants::physics::MassDS); } template - auto yDs(const T& candidate) + static auto yDs(const T& candidate) { return candidate.y(o2::constants::physics::MassDS); } template - auto eDs(const T& candidate) + static auto eDs(const T& candidate) { return candidate.e(o2::constants::physics::MassDS); } template - auto invMassDsToKKPi(const T& candidate) + static auto invMassDsToKKPi(const T& candidate) { return candidate.m(std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}); } template - auto invMassDsToPiKK(const T& candidate) + static auto invMassDsToPiKK(const T& candidate) { return candidate.m(std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassKPlus}); } template - auto massKKPairDsToKKPi(const T& candidate) + static auto massKKPairDsToKKPi(const T& candidate) { return RecoDecay::m(std::array{candidate.pVectorProng0(), candidate.pVectorProng1()}, std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassKPlus}); } template - auto massKKPairDsToPiKK(const T& candidate) + static auto massKKPairDsToPiKK(const T& candidate) { return RecoDecay::m(std::array{candidate.pVectorProng1(), candidate.pVectorProng2()}, std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassKPlus}); } template - auto deltaMassPhiDsToKKPi(const T& candidate) + static auto deltaMassPhiDsToKKPi(const T& candidate) { return std::abs(massKKPairDsToKKPi(candidate) - o2::constants::physics::MassPhi); } template - auto deltaMassPhiDsToPiKK(const T& candidate) + static auto deltaMassPhiDsToPiKK(const T& candidate) { return std::abs(massKKPairDsToPiKK(candidate) - o2::constants::physics::MassPhi); } @@ -287,7 +287,7 @@ class HfHelper /// \param option mass hypothesis considered: 0 = KKPi, 1 = PiKK /// \return cosine of pion-kaon angle in the phi rest frame template - auto cosPiKPhiRestFrame(const T& candidate, int option) + static auto cosPiKPhiRestFrame(const T& candidate, int option) { // Ported from AliAODRecoDecayHF3Prong::CosPiKPhiRFrame std::array momPi{}; @@ -317,27 +317,27 @@ class HfHelper } template - auto cos3PiKDsToKKPi(const T& candidate) + static auto cos3PiKDsToKKPi(const T& candidate) { auto cosPiK = cosPiKPhiRestFrame(candidate, 0); return cosPiK * cosPiK * cosPiK; } template - auto absCos3PiKDsToKKPi(const T& candidate) + static auto absCos3PiKDsToKKPi(const T& candidate) { return std::abs(cos3PiKDsToKKPi(candidate)); } template - auto cos3PiKDsToPiKK(const T& candidate) + static auto cos3PiKDsToPiKK(const T& candidate) { auto cosPiK = cosPiKPhiRestFrame(candidate, 1); return cosPiK * cosPiK * cosPiK; } template - auto absCos3PiKDsToPiKK(const T& candidate) + static auto absCos3PiKDsToPiKK(const T& candidate) { return std::abs(cos3PiKDsToPiKK(candidate)); } @@ -345,67 +345,67 @@ class HfHelper // Λc± → p± K∓ π± template - auto ctLc(const T& candidate) + static auto ctLc(const T& candidate) { return candidate.ct(o2::constants::physics::MassLambdaCPlus); } template - auto yLc(const T& candidate) + static auto yLc(const T& candidate) { return candidate.y(o2::constants::physics::MassLambdaCPlus); } template - auto eLc(const T& candidate) + static auto eLc(const T& candidate) { return candidate.e(o2::constants::physics::MassLambdaCPlus); } template - auto invMassLcToPKPi(const T& candidate) + static auto invMassLcToPKPi(const T& candidate) { return candidate.m(std::array{o2::constants::physics::MassProton, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}); } template - auto invMassLcToPiKP(const T& candidate) + static auto invMassLcToPiKP(const T& candidate) { return candidate.m(std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassProton}); } template - auto invMassKPiPairLcToPKPi(const T& candidate) + static auto invMassKPiPairLcToPKPi(const T& candidate) { return RecoDecay::m(std::array{candidate.pVectorProng1(), candidate.pVectorProng2()}, std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}); } template - auto invMassKPiPairLcToPiKP(const T& candidate) + static auto invMassKPiPairLcToPiKP(const T& candidate) { return RecoDecay::m(std::array{candidate.pVectorProng1(), candidate.pVectorProng0()}, std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}); } template - auto invMassPKPairLcToPKPi(const T& candidate) + static auto invMassPKPairLcToPKPi(const T& candidate) { return RecoDecay::m(std::array{candidate.pVectorProng0(), candidate.pVectorProng1()}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassKPlus}); } template - auto invMassPKPairLcToPiKP(const T& candidate) + static auto invMassPKPairLcToPiKP(const T& candidate) { return RecoDecay::m(std::array{candidate.pVectorProng2(), candidate.pVectorProng1()}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassKPlus}); } template - auto invMassPPiPairLcToPKPi(const T& candidate) + static auto invMassPPiPairLcToPKPi(const T& candidate) { return RecoDecay::m(std::array{candidate.pVectorProng0(), candidate.pVectorProng2()}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPiPlus}); } template - auto invMassPPiPairLcToPiKP(const T& candidate) + static auto invMassPPiPairLcToPiKP(const T& candidate) { return RecoDecay::m(std::array{candidate.pVectorProng2(), candidate.pVectorProng0()}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPiPlus}); } @@ -413,13 +413,13 @@ class HfHelper // Cd± → De± K∓ π± template - auto invMassCdToDeKPi(const T& candidate) + static auto invMassCdToDeKPi(const T& candidate) { return candidate.m(std::array{o2::constants::physics::MassDeuteron, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}); } template - auto invMassCdToPiKDe(const T& candidate) + static auto invMassCdToPiKDe(const T& candidate) { return candidate.m(std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassDeuteron}); } @@ -427,31 +427,31 @@ class HfHelper // Ξc± → p± K∓ π± template - auto ctXic(const T& candidate) + static auto ctXic(const T& candidate) { return candidate.ct(o2::constants::physics::MassXiCPlus); } template - auto yXic(const T& candidate) + static auto yXic(const T& candidate) { return candidate.y(o2::constants::physics::MassXiCPlus); } template - auto eXic(const T& candidate) + static auto eXic(const T& candidate) { return candidate.e(o2::constants::physics::MassXiCPlus); } template - auto invMassXicToPKPi(const T& candidate) + static auto invMassXicToPKPi(const T& candidate) { return invMassLcToPKPi(candidate); } template - auto invMassXicToPiKP(const T& candidate) + static auto invMassXicToPiKP(const T& candidate) { return invMassLcToPiKP(candidate); } @@ -459,13 +459,13 @@ class HfHelper // hf_cand_casc_lf_2prong template - auto invMassXiczeroToXiPi(const T& candidate) + static auto invMassXiczeroToXiPi(const T& candidate) { return candidate.m(std::array{o2::constants::physics::MassXiMinus, o2::constants::physics::MassPiPlus}); } template - auto invMassOmegaczeroToOmegaPi(const T& candidate) + static auto invMassOmegaczeroToOmegaPi(const T& candidate) { return candidate.m(std::array{o2::constants::physics::MassOmegaMinus, o2::constants::physics::MassPiPlus}); } @@ -473,7 +473,7 @@ class HfHelper // hf_cand_casc_lf_3prong template - auto invMassXicplusToXiPiPi(const T& candidate) + static auto invMassXicplusToXiPiPi(const T& candidate) { return candidate.m(std::array{o2::constants::physics::MassXiMinus, o2::constants::physics::MassPiPlus, o2::constants::physics::MassPiPlus}); } @@ -482,32 +482,32 @@ class HfHelper // X → Jpsi π+ π- template - auto ctX(const T& candidate) + static auto ctX(const T& candidate) { return candidate.ct(o2::constants::physics::MassX3872); } template - auto yX(const T& candidate) + static auto yX(const T& candidate) { return candidate.y(o2::constants::physics::MassX3872); } template - auto eX(const T& candidate) + static auto eX(const T& candidate) { return candidate.e(o2::constants::physics::MassX3872); } template - auto invMassXToJpsiPiPi(const T& candidate) + static auto invMassXToJpsiPiPi(const T& candidate) { return candidate.m(std::array{o2::constants::physics::MassJPsi, o2::constants::physics::MassPiPlus, o2::constants::physics::MassPiPlus}); } /// Difference between the X mass and the sum of the J/psi and di-pion masses template - auto qX(const T& candidate) + static auto qX(const T& candidate) { auto piVec1 = std::array{candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()}; auto piVec2 = std::array{candidate.pxProng2(), candidate.pyProng2(), candidate.pzProng2()}; @@ -521,7 +521,7 @@ class HfHelper /// Angular difference between the J/psi and the pion template - auto dRX(const T& candidate, int numPi) + static auto dRX(const T& candidate, int numPi) { double etaJpsi = RecoDecay::eta(std::array{candidate.pxProng0(), candidate.pyProng0(), candidate.pzProng0()}); double phiJpsi = RecoDecay::phi(candidate.pxProng0(), candidate.pyProng0()); @@ -544,7 +544,7 @@ class HfHelper /// Difference in pT between the two pions template - auto balancePtPionsX(const T& candidate) + static auto balancePtPionsX(const T& candidate) { double ptPi1 = RecoDecay::pt(candidate.pxProng1(), candidate.pyProng1()); double ptPi2 = RecoDecay::pt(candidate.pxProng2(), candidate.pyProng2()); @@ -554,25 +554,25 @@ class HfHelper // Ξcc±± → p± K∓ π± π± template - auto ctXicc(const T& candidate) + static auto ctXicc(const T& candidate) { return candidate.ct(o2::constants::physics::MassXiCCPlusPlus); } template - auto yXicc(const T& candidate) + static auto yXicc(const T& candidate) { return candidate.y(o2::constants::physics::MassXiCCPlusPlus); } template - auto eXicc(const T& candidate) + static auto eXicc(const T& candidate) { return candidate.e(o2::constants::physics::MassXiCCPlusPlus); } template - auto invMassXiccToXicPi(const T& candidate) + static auto invMassXiccToXicPi(const T& candidate) { return candidate.m(std::array{o2::constants::physics::MassXiCPlus, o2::constants::physics::MassPiPlus}); } @@ -580,24 +580,24 @@ class HfHelper // chic → Jpsi gamma template - auto ctChic(const T& candidate) + static auto ctChic(const T& candidate) { return candidate.ct(o2::constants::physics::MassChiC1); } template - auto yChic(const T& candidate) + static auto yChic(const T& candidate) { return candidate.y(o2::constants::physics::MassChiC1); } template - auto eChic(const T& candidate) + static auto eChic(const T& candidate) { return candidate.e(o2::constants::physics::MassChiC1); } template - auto invMassChicToJpsiGamma(const T& candidate) + static auto invMassChicToJpsiGamma(const T& candidate) { return candidate.m(std::array{o2::constants::physics::MassJPsi, 0.}); } @@ -605,24 +605,24 @@ class HfHelper // Λb → Λc+ π- → p K- π+ π- template - auto ctLb(const T& candidate) + static auto ctLb(const T& candidate) { return candidate.ct(o2::constants::physics::MassLambdaB0); } template - auto yLb(const T& candidate) + static auto yLb(const T& candidate) { return candidate.y(o2::constants::physics::MassLambdaB0); } template - auto eLb(const T& candidate) + static auto eLb(const T& candidate) { return candidate.e(o2::constants::physics::MassLambdaB0); } template - auto invMassLbToLcPi(const T& candidate) + static auto invMassLbToLcPi(const T& candidate) { return candidate.m(std::array{o2::constants::physics::MassLambdaCPlus, o2::constants::physics::MassPiPlus}); } @@ -630,37 +630,37 @@ class HfHelper // B0(B0bar) → D∓ π± template - auto ctB0(const T& candidate) + static auto ctB0(const T& candidate) { return candidate.ct(o2::constants::physics::MassB0); } template - auto yB0(const T& candidate) + static auto yB0(const T& candidate) { return candidate.y(o2::constants::physics::MassB0); } template - auto eB0(const T& candidate) + static auto eB0(const T& candidate) { return candidate.e(o2::constants::physics::MassB0); } template - auto invMassB0ToDPi(const T& candidate) + static auto invMassB0ToDPi(const T& candidate) { return candidate.m(std::array{o2::constants::physics::MassDMinus, o2::constants::physics::MassPiPlus}); } template - auto invMassB0ToDPi(const T& candidate) + static auto invMassB0ToDPi(const T& candidate) { return candidate.m(std::array{o2::constants::physics::MassD0, o2::constants::physics::MassPiPlus, o2::constants::physics::MassPiPlus}); } template - auto cosThetaStarB0(const T& candidate) + static auto cosThetaStarB0(const T& candidate) { return candidate.cosThetaStar(std::array{o2::constants::physics::MassDMinus, o2::constants::physics::MassPiPlus}, o2::constants::physics::MassB0, 1); } @@ -668,37 +668,37 @@ class HfHelper // Bs(bar) → Ds∓ π± template - auto ctBs(const T& candidate) + static auto ctBs(const T& candidate) { return candidate.ct(o2::constants::physics::MassBS); } template - auto yBs(const T& candidate) + static auto yBs(const T& candidate) { return candidate.y(o2::constants::physics::MassBS); } template - auto eBs(const T& candidate) + static auto eBs(const T& candidate) { return candidate.e(o2::constants::physics::MassBS); } template - auto invMassBsToDsPi(const T& candidate) + static auto invMassBsToDsPi(const T& candidate) { return candidate.m(std::array{o2::constants::physics::MassDSBar, o2::constants::physics::MassPiPlus}); } template - auto invMassBsToJpsiPhi(const T& candidate) + static auto invMassBsToJpsiPhi(const T& candidate) { return candidate.m(std::array{o2::constants::physics::MassMuon, o2::constants::physics::MassMuon, o2::constants::physics::MassKPlus, o2::constants::physics::MassKPlus}); } template - auto cosThetaStarBs(const T& candidate) + static auto cosThetaStarBs(const T& candidate) { return candidate.cosThetaStar(std::array{o2::constants::physics::MassDSBar, o2::constants::physics::MassPiPlus}, o2::constants::physics::MassBS, 1); } @@ -707,26 +707,26 @@ class HfHelper /// @brief Sc inv. mass using reco mass for Lc in pKpi and PDG mass for pion template - auto invMassScRecoLcToPKPi(const T& candidateSc, const U& candidateLc) + static auto invMassScRecoLcToPKPi(const T& candidateSc, const U& candidateLc) { return candidateSc.m(std::array{static_cast(invMassLcToPKPi(candidateLc)), o2::constants::physics::MassPiPlus}); } /// @brief Sc inv. mass using reco mass for Lc in piKp and PDG mass for pion template - auto invMassScRecoLcToPiKP(const T& candidateSc, const U& candidateLc) + static auto invMassScRecoLcToPiKP(const T& candidateSc, const U& candidateLc) { return candidateSc.m(std::array{static_cast(invMassLcToPiKP(candidateLc)), o2::constants::physics::MassPiPlus}); } template - auto ySc0(const T& candidate) + static auto ySc0(const T& candidate) { return candidate.y(o2::constants::physics::MassSigmaC0); } template - auto yScPlusPlus(const T& candidate) + static auto yScPlusPlus(const T& candidate) { return candidate.y(o2::constants::physics::MassSigmaCPlusPlus); } @@ -734,7 +734,7 @@ class HfHelper /// Σc0,++ → Λc+(→K0sP) π-,+ /// @brief Sc inv. mass using reco mass for Lc in K0sP and PDG mass for pion template - auto invMassScRecoLcToK0sP(const T& candidateSc, const U& candidateLc) + static auto invMassScRecoLcToK0sP(const T& candidateSc, const U& candidateLc) { return candidateSc.m(std::array{static_cast(invMassLcToK0sP(candidateLc)), o2::constants::physics::MassPiMinus}); } @@ -745,7 +745,7 @@ class HfHelper /// \param binsPt pT bin limits /// \return true if candidate passes all selections template - bool selectionB0ToDPiTopol(const T1& candB0, const T2& cuts, const T3& binsPt) + static bool selectionB0ToDPiTopol(const T1& candB0, const T2& cuts, const T3& binsPt) { auto ptCandB0 = candB0.pt(); auto ptD = RecoDecay::pt(candB0.pxProng0(), candB0.pyProng0()); @@ -822,7 +822,7 @@ class HfHelper /// \param pidTrackPi PID status of trackPi (prong1 of B0 candidate) /// \param acceptPIDNotApplicable switch to accept Status::NotApplicable /// \return true if prong1 of B0 candidate passes all selections - bool selectionB0ToDPiPid(const int pidTrackPi, const bool acceptPIDNotApplicable) + static bool selectionB0ToDPiPid(const int pidTrackPi, const bool acceptPIDNotApplicable) { if (!acceptPIDNotApplicable && pidTrackPi != TrackSelectorPID::Accepted) { return false; @@ -840,7 +840,7 @@ class HfHelper /// \param binsPt pT bin limits /// \return true if candidate passes all selections template - bool selectionBplusToD0PiTopol(const T1& candBp, const T2& cuts, const T3& binsPt) + static bool selectionBplusToD0PiTopol(const T1& candBp, const T2& cuts, const T3& binsPt) { auto ptCandBp = candBp.pt(); auto ptPi = RecoDecay::pt(candBp.pxProng1(), candBp.pyProng1()); @@ -897,7 +897,7 @@ class HfHelper /// \param pidTrackPi PID status of trackPi (prong1 of B+ candidate) /// \param acceptPIDNotApplicable switch to accept Status::NotApplicable /// \return true if prong1 of B+ candidate passes all selections - bool selectionBplusToD0PiPid(const int pidTrackPi, const bool acceptPIDNotApplicable) + static bool selectionBplusToD0PiPid(const int pidTrackPi, const bool acceptPIDNotApplicable) { if (!acceptPIDNotApplicable && pidTrackPi != TrackSelectorPID::Accepted) { return false; @@ -915,7 +915,7 @@ class HfHelper /// \param binsPt pT bin limits /// \return true if candidate passes all selections template - bool selectionBplusToJpsiKTopol(const T1& candBp, const T2& cuts, const T3& binsPt) + static bool selectionBplusToJpsiKTopol(const T1& candBp, const T2& cuts, const T3& binsPt) { auto ptCandBp = candBp.pt(); auto mCandBp = invMassBplusToJpsiK(candBp); @@ -996,7 +996,7 @@ class HfHelper /// \param pidTrackKa PID status of trackKa (prong1 of B+ candidate) /// \param acceptPIDNotApplicable switch to accept Status::NotApplicable /// \return true if prong1 of B+ candidate passes all selections - bool selectionBplusToJpsiKPid(const int pidTrackKa, const bool acceptPIDNotApplicable) + static bool selectionBplusToJpsiKPid(const int pidTrackKa, const bool acceptPIDNotApplicable) { if (!acceptPIDNotApplicable && pidTrackKa != TrackSelectorPID::Accepted) { return false; @@ -1014,7 +1014,7 @@ class HfHelper /// \param binsPt pT bin limits /// \return true if candidate passes all selections template - bool selectionBsToDsPiTopol(const T1& candBs, const T2& cuts, const T3& binsPt) + static bool selectionBsToDsPiTopol(const T1& candBs, const T2& cuts, const T3& binsPt) { auto ptCandBs = candBs.pt(); auto ptDs = RecoDecay::pt(candBs.pxProng0(), candBs.pyProng0()); @@ -1082,7 +1082,7 @@ class HfHelper /// \param pidTrackPi PID status of trackPi (prong1 of Bs candidate) /// \param acceptPIDNotApplicable switch to accept Status::NotApplicable /// \return true if prong1 of Bs candidate passes all selections - bool selectionBsToDsPiPid(const int pidTrackPi, const bool acceptPIDNotApplicable) + static bool selectionBsToDsPiPid(const int pidTrackPi, const bool acceptPIDNotApplicable) { if (!acceptPIDNotApplicable && pidTrackPi != TrackSelectorPID::Accepted) { return false; @@ -1102,7 +1102,7 @@ class HfHelper /// \param binsPt pT bin limits /// \return true if candidate passes all selections template - bool selectionBsToJpsiPhiTopol(const T1& candBs, const T2& candKa0, const T3& candKa1, const T4& cuts, const T5& binsPt) + static bool selectionBsToJpsiPhiTopol(const T1& candBs, const T2& candKa0, const T3& candKa1, const T4& cuts, const T5& binsPt) { auto ptCandBs = candBs.pt(); auto mCandBs = invMassBsToJpsiPhi(candBs); @@ -1191,7 +1191,7 @@ class HfHelper /// \param pidTrackKa PID status of trackKa (prong1 of B+ candidate) /// \param acceptPIDNotApplicable switch to accept Status::NotApplicable /// \return true if prong1 of B+ candidate passes all selections - bool selectionBsToJpsiPhiPid(const int pidTrackKa, const bool acceptPIDNotApplicable) + static bool selectionBsToJpsiPhiPid(const int pidTrackKa, const bool acceptPIDNotApplicable) { if (!acceptPIDNotApplicable && pidTrackKa != TrackSelectorPID::Accepted) { return false; @@ -1209,7 +1209,7 @@ class HfHelper /// \param binsPt pT bin limits /// \return true if candidate passes all selections template - bool selectionLbToLcPiTopol(const T1& candLb, const T2& cuts, const T3& binsPt) + static bool selectionLbToLcPiTopol(const T1& candLb, const T2& cuts, const T3& binsPt) { auto ptCandLb = candLb.pt(); auto ptLc = candLb.ptProng0(); @@ -1271,7 +1271,7 @@ class HfHelper /// \param pidTrackPi PID status of trackPi (prong1 of Lb candidate) /// \param acceptPIDNotApplicable switch to accept Status::NotApplicable /// \return true if prong1 of Lb candidate passes all selections - bool selectionLbToLcPiPid(const int pidTrackPi, const bool acceptPIDNotApplicable) + static bool selectionLbToLcPiPid(const int pidTrackPi, const bool acceptPIDNotApplicable) { if (!acceptPIDNotApplicable && pidTrackPi != TrackSelectorPID::Accepted) { return false; @@ -1289,7 +1289,7 @@ class HfHelper /// \param mlScores vector with ml scores of charm hadron (position 0:bkg 1:prompt 2:nonprompt) /// \return true if b-hadron candidate passes all selections template - bool applySelectionDmesMlScoresForB(const T1& cuts, const T2& binsPtC, float ptC, const std::vector& mlScores) + static bool applySelectionDmesMlScoresForB(const T1& cuts, const T2& binsPtC, float ptC, const std::vector& mlScores) { int pTBin = o2::analysis::findBin(binsPtC, ptC); if (pTBin == -1) { @@ -1317,7 +1317,7 @@ class HfHelper /// \param binsPtC pT bin limits of charm hadron /// \return true if b-hadron candidate passes all selections template - bool selectionDmesMlScoresForB(const T1& candD, const T2& cuts, const T3& binsPtC, const std::vector& mlScores) + static bool selectionDmesMlScoresForB(const T1& candD, const T2& cuts, const T3& binsPtC, const std::vector& mlScores) { return applySelectionDmesMlScoresForB(cuts, binsPtC, candD.pt(), mlScores); } @@ -1328,7 +1328,7 @@ class HfHelper /// \param binsPtC pT bin limits of charm hadron /// \return true if b-hadron candidate passes all selections template - bool selectionDmesMlScoresForBReduced(const T1& candB, const T2& cuts, const T3& binsPtC) + static bool selectionDmesMlScoresForBReduced(const T1& candB, const T2& cuts, const T3& binsPtC) { std::vector mlScores; mlScores.push_back(candB.prong0MlScoreBkg()); @@ -1336,8 +1336,6 @@ class HfHelper mlScores.push_back(candB.prong0MlScoreNonprompt()); // we want non-prompt for beauty return applySelectionDmesMlScoresForB(cuts, binsPtC, RecoDecay::pt(candB.pxProng0(), candB.pyProng0()), mlScores); } - - private: }; #endif // PWGHF_CORE_HFHELPER_H_ diff --git a/PWGHF/Core/HfMlResponseD0ToKPi.h b/PWGHF/Core/HfMlResponseD0ToKPi.h index 8a1128bd65f..b0c6eaccdd3 100644 --- a/PWGHF/Core/HfMlResponseD0ToKPi.h +++ b/PWGHF/Core/HfMlResponseD0ToKPi.h @@ -54,28 +54,28 @@ } // Variation of CHECK_AND_FILL_VEC_D0_FULL(OBJECT, FEATURE, GETTER) -// where GETTER is a method of hfHelper +// where GETTER is a method of HfHelper #define CHECK_AND_FILL_VEC_D0_HFHELPER(OBJECT, FEATURE, GETTER) \ case static_cast(InputFeaturesD0ToKPi::FEATURE): { \ - inputFeatures.emplace_back(hfHelper.GETTER(OBJECT)); \ + inputFeatures.emplace_back(HfHelper::GETTER(OBJECT)); \ break; \ } // Variation of CHECK_AND_FILL_VEC_D0_HFHELPER(OBJECT, FEATURE, GETTER) -// where GETTER1 and GETTER2 are methods of hfHelper, and the variable +// where GETTER1 and GETTER2 are methods of HfHelper, and the variable // is filled depending on whether it is a D0 or a D0bar #define CHECK_AND_FILL_VEC_D0_HFHELPER_SIGNED(OBJECT, FEATURE, GETTER1, GETTER2) \ case static_cast(InputFeaturesD0ToKPi::FEATURE): { \ if (pdgCode == o2::constants::physics::kD0) { \ - inputFeatures.emplace_back(hfHelper.GETTER1(OBJECT)); \ + inputFeatures.emplace_back(HfHelper::GETTER1(OBJECT)); \ } else { \ - inputFeatures.emplace_back(hfHelper.GETTER2(OBJECT)); \ + inputFeatures.emplace_back(HfHelper::GETTER2(OBJECT)); \ } \ break; \ } // Variation of CHECK_AND_FILL_VEC_D0_HFHELPER(OBJECT, FEATURE, GETTER) -// where GETTER1 and GETTER2 are methods of hfHelper, and the variable +// where GETTER1 and GETTER2 are methods of HfHelper, and the variable // is filled depending on whether it is a D0 or a D0bar #define CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED(OBJECT1, OBJECT2, FEATURE, GETTER) \ case static_cast(InputFeaturesD0ToKPi::FEATURE): { \ @@ -175,8 +175,6 @@ class HfMlResponseD0ToKPi : public HfMlResponse /// Default destructor virtual ~HfMlResponseD0ToKPi() = default; - HfHelper hfHelper; - /// Method to get the input features vector needed for ML inference /// \param candidate is the D0 candidate /// \return inputFeatures vector diff --git a/PWGHF/Core/HfMlResponseDsToKKPi.h b/PWGHF/Core/HfMlResponseDsToKKPi.h index 0c166e55e51..4d826944378 100644 --- a/PWGHF/Core/HfMlResponseDsToKKPi.h +++ b/PWGHF/Core/HfMlResponseDsToKKPi.h @@ -51,22 +51,22 @@ } // Variation of CHECK_AND_FILL_VEC_DS_FULL(OBJECT, FEATURE, GETTER) -// where GETTER is a method of hfHelper +// where GETTER is a method of HfHelper #define CHECK_AND_FILL_VEC_DS_HFHELPER(OBJECT, FEATURE, GETTER) \ case static_cast(InputFeaturesDsToKKPi::FEATURE): { \ - inputFeatures.emplace_back(hfHelper.GETTER(OBJECT)); \ + inputFeatures.emplace_back(HfHelper::GETTER(OBJECT)); \ break; \ } // Variation of CHECK_AND_FILL_VEC_DS_HFHELPER(OBJECT, FEATURE, GETTER) -// where GETTER1 and GETTER2 are methods of hfHelper, and the variable +// where GETTER1 and GETTER2 are methods of HfHelper, and the variable // is filled depending on whether it is a DsToKKPi or a DsToPiKK #define CHECK_AND_FILL_VEC_DS_HFHELPER_SIGNED(OBJECT, FEATURE, GETTER1, GETTER2) \ case static_cast(InputFeaturesDsToKKPi::FEATURE): { \ if (caseDsToKKPi) { \ - inputFeatures.emplace_back(hfHelper.GETTER1(OBJECT)); \ + inputFeatures.emplace_back(HfHelper::GETTER1(OBJECT)); \ } else { \ - inputFeatures.emplace_back(hfHelper.GETTER2(OBJECT)); \ + inputFeatures.emplace_back(HfHelper::GETTER2(OBJECT)); \ } \ break; \ } @@ -154,8 +154,6 @@ class HfMlResponseDsToKKPi : public HfMlResponse /// Default destructor virtual ~HfMlResponseDsToKKPi() = default; - HfHelper hfHelper; - /// Method to get the input features vector needed for ML inference /// \param candidate is the Ds candidate /// \param prong0 is the candidate's prong0 diff --git a/PWGHF/Core/HfMlResponseLcToK0sP.h b/PWGHF/Core/HfMlResponseLcToK0sP.h index a3484c029cb..4e6899bf3aa 100644 --- a/PWGHF/Core/HfMlResponseLcToK0sP.h +++ b/PWGHF/Core/HfMlResponseLcToK0sP.h @@ -52,10 +52,10 @@ } // Variation of CHECK_AND_FILL_VEC_LC_FULL(OBJECT, FEATURE, GETTER) -// where GETTER is a method of hfHelper +// where GETTER is a method of HfHelper #define CHECK_AND_FILL_VEC_LC_HFHELPER(OBJECT, FEATURE, GETTER) \ case static_cast(InputFeaturesLcToK0sP::FEATURE): { \ - inputFeatures.emplace_back(hfHelper.GETTER(OBJECT)); \ + inputFeatures.emplace_back(HfHelper::GETTER(OBJECT)); \ break; \ } @@ -104,8 +104,6 @@ class HfMlResponseLcToK0sP : public HfMlResponse /// Default destructor virtual ~HfMlResponseLcToK0sP() = default; - HfHelper hfHelper; - /// Method to get the input features vector needed for ML inference /// \param candidate is the Lc candidate /// \param bach is the bachelor candidate (proton) diff --git a/PWGHF/Core/HfMlResponseLcToPKPi.h b/PWGHF/Core/HfMlResponseLcToPKPi.h index 6c09afdbe8f..e9fe8ff2221 100644 --- a/PWGHF/Core/HfMlResponseLcToPKPi.h +++ b/PWGHF/Core/HfMlResponseLcToPKPi.h @@ -53,10 +53,10 @@ } // Variation of CHECK_AND_FILL_VEC_LCTOPKPI_FULL(OBJECT, FEATURE, GETTER) -// where GETTER is a method of hfHelper +// where GETTER is a method of HfHelper #define CHECK_AND_FILL_VEC_LCTOPKPI_HFHELPER(OBJECT, FEATURE, GETTER) \ case static_cast(InputFeaturesLcToPKPi::FEATURE): { \ - inputFeatures.emplace_back(hfHelper.GETTER(OBJECT)); \ + inputFeatures.emplace_back(HfHelper::GETTER(OBJECT)); \ break; \ } diff --git a/PWGHF/Core/HfMlResponseOmegacToOmegaPi.h b/PWGHF/Core/HfMlResponseOmegacToOmegaPi.h index c61616cc9d4..ed78d100b07 100644 --- a/PWGHF/Core/HfMlResponseOmegacToOmegaPi.h +++ b/PWGHF/Core/HfMlResponseOmegacToOmegaPi.h @@ -51,10 +51,10 @@ } // Variation of CHECK_AND_FILL_VEC_OMEGAC0_FULL(OBJECT, FEATURE, GETTER) -// where GETTER is a method of hfHelper +// where GETTER is a method of HfHelper #define CHECK_AND_FILL_VEC_OMEGAC0_HFHELPER(OBJECT, FEATURE, GETTER) \ case static_cast(InputFeaturesOmegacToOmegaPi::FEATURE): { \ - inputFeatures.emplace_back(hfHelper.GETTER(OBJECT)); \ + inputFeatures.emplace_back(HfHelper::GETTER(OBJECT)); \ break; \ } namespace o2::analysis @@ -96,8 +96,6 @@ class HfMlResponseOmegacToOmegaPi : public HfMlResponse /// Default destructor virtual ~HfMlResponseOmegacToOmegaPi() = default; - HfHelper hfHelper; - /// Method to get the input features vector needed for ML inference /// \param candidate is the OMEGAC0 candidate /// \param lamProngPi is the candidate's lamProngPi diff --git a/PWGHF/D2H/TableProducer/candidateSelectorB0ToDPiReduced.cxx b/PWGHF/D2H/TableProducer/candidateSelectorB0ToDPiReduced.cxx index 0ab8c41c82d..3913e7f0fca 100644 --- a/PWGHF/D2H/TableProducer/candidateSelectorB0ToDPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateSelectorB0ToDPiReduced.cxx @@ -101,7 +101,6 @@ struct HfCandidateSelectorB0ToDPiReduced { o2::ccdb::CcdbApi ccdbApi; TrackSelectorPi selectorPion; - HfHelper hfHelper; using TracksBachPion = soa::Join; using TracksSoftPions = soa::Join; @@ -230,7 +229,7 @@ struct HfCandidateSelectorB0ToDPiReduced { } // topological cuts - if (!hfHelper.selectionB0ToDPiTopol(hfCandB0, cuts, binsPt)) { + if (!HfHelper::selectionB0ToDPiTopol(hfCandB0, cuts, binsPt)) { hfSelB0ToDPiCandidate(statusB0ToDPi); if (applyB0Ml) { hfMlB0ToDPiCandidate(outputMlNotPreselected); @@ -240,7 +239,7 @@ struct HfCandidateSelectorB0ToDPiReduced { } if constexpr (WithDmesMl) { // we include it in the topological selections - if (!hfHelper.selectionDmesMlScoresForBReduced(hfCandB0, cutsDmesMl, binsPtDmesMl)) { + if (!HfHelper::selectionDmesMlScoresForBReduced(hfCandB0, cutsDmesMl, binsPtDmesMl)) { hfSelB0ToDPiCandidate(statusB0ToDPi); if (applyB0Ml) { hfMlB0ToDPiCandidate(outputMlNotPreselected); @@ -263,7 +262,7 @@ struct HfCandidateSelectorB0ToDPiReduced { } else if (pionPidMethod == PidMethod::TpcAndTof) { pidTrackBachPi = selectorPion.statusTpcAndTof(trackBachPi); } - if (!hfHelper.selectionB0ToDPiPid(pidTrackBachPi, acceptPIDNotApplicable.value)) { + if (!HfHelper::selectionB0ToDPiPid(pidTrackBachPi, acceptPIDNotApplicable.value)) { // LOGF(info, "B0 candidate selection failed at PID selection"); hfSelB0ToDPiCandidate(statusB0ToDPi); if (applyB0Ml) { diff --git a/PWGHF/D2H/TableProducer/candidateSelectorBplusToD0PiReduced.cxx b/PWGHF/D2H/TableProducer/candidateSelectorBplusToD0PiReduced.cxx index 91d0b934261..e9088c68e93 100644 --- a/PWGHF/D2H/TableProducer/candidateSelectorBplusToD0PiReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateSelectorBplusToD0PiReduced.cxx @@ -100,7 +100,6 @@ struct HfCandidateSelectorBplusToD0PiReduced { std::vector outputMl; o2::ccdb::CcdbApi ccdbApi; - HfHelper hfHelper; TrackSelectorPi selectorPion; using TracksPion = soa::Join; @@ -181,7 +180,7 @@ struct HfCandidateSelectorBplusToD0PiReduced { } // topological cuts - if (!hfHelper.selectionBplusToD0PiTopol(hfCandBp, cuts, binsPt)) { + if (!HfHelper::selectionBplusToD0PiTopol(hfCandBp, cuts, binsPt)) { hfSelBplusToD0PiCandidate(statusBplus); if (applyBplusMl) { hfMlBplusToD0PiCandidate(outputMlNotPreselected); @@ -191,7 +190,7 @@ struct HfCandidateSelectorBplusToD0PiReduced { } if constexpr (WithDmesMl) { // we include it in the topological selections - if (!hfHelper.selectionDmesMlScoresForBReduced(hfCandBp, cutsDmesMl, binsPtDmesMl)) { + if (!HfHelper::selectionDmesMlScoresForBReduced(hfCandBp, cutsDmesMl, binsPtDmesMl)) { hfSelBplusToD0PiCandidate(statusBplus); if (applyBplusMl) { hfMlBplusToD0PiCandidate(outputMlNotPreselected); @@ -215,7 +214,7 @@ struct HfCandidateSelectorBplusToD0PiReduced { } else if (pionPidMethod == PidMethod::TpcAndTof) { pidTrackPi = selectorPion.statusTpcAndTof(trackPi); } - if (!hfHelper.selectionBplusToD0PiPid(pidTrackPi, acceptPIDNotApplicable.value)) { + if (!HfHelper::selectionBplusToD0PiPid(pidTrackPi, acceptPIDNotApplicable.value)) { // LOGF(info, "B+ candidate selection failed at PID selection"); hfSelBplusToD0PiCandidate(statusBplus); if (applyBplusMl) { diff --git a/PWGHF/D2H/TableProducer/candidateSelectorBsToDsPiReduced.cxx b/PWGHF/D2H/TableProducer/candidateSelectorBsToDsPiReduced.cxx index 71c9c54f589..988df046c06 100644 --- a/PWGHF/D2H/TableProducer/candidateSelectorBsToDsPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateSelectorBsToDsPiReduced.cxx @@ -97,7 +97,6 @@ struct HfCandidateSelectorBsToDsPiReduced { o2::ccdb::CcdbApi ccdbApi; TrackSelectorPi selectorPion; - HfHelper hfHelper; using TracksPion = soa::Join; @@ -172,7 +171,7 @@ struct HfCandidateSelectorBsToDsPiReduced { } // topological cuts - if (!hfHelper.selectionBsToDsPiTopol(hfCandBs, cuts, binsPt)) { + if (!HfHelper::selectionBsToDsPiTopol(hfCandBs, cuts, binsPt)) { hfSelBsToDsPiCandidate(statusBsToDsPi); if (applyBsMl) { hfMlBsToDsPiCandidate(outputMl); @@ -181,7 +180,7 @@ struct HfCandidateSelectorBsToDsPiReduced { } if constexpr (WithDmesMl) { // we include it in the topological selections - if (!hfHelper.selectionDmesMlScoresForBReduced(hfCandBs, cutsDmesMl, binsPtDmesMl)) { + if (!HfHelper::selectionDmesMlScoresForBReduced(hfCandBs, cutsDmesMl, binsPtDmesMl)) { hfSelBsToDsPiCandidate(statusBsToDsPi); if (applyBsMl) { hfMlBsToDsPiCandidate(outputMl); @@ -204,7 +203,7 @@ struct HfCandidateSelectorBsToDsPiReduced { } else if (pionPidMethod == PidMethod::TpcAndTof) { pidTrackPi = selectorPion.statusTpcAndTof(trackPi); } - if (!hfHelper.selectionBsToDsPiPid(pidTrackPi, acceptPIDNotApplicable.value)) { + if (!HfHelper::selectionBsToDsPiPid(pidTrackPi, acceptPIDNotApplicable.value)) { hfSelBsToDsPiCandidate(statusBsToDsPi); if (applyBsMl) { hfMlBsToDsPiCandidate(outputMl); diff --git a/PWGHF/D2H/TableProducer/candidateSelectorLbToLcPiReduced.cxx b/PWGHF/D2H/TableProducer/candidateSelectorLbToLcPiReduced.cxx index d3dea0df59f..705f23ae97e 100644 --- a/PWGHF/D2H/TableProducer/candidateSelectorLbToLcPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateSelectorLbToLcPiReduced.cxx @@ -98,7 +98,6 @@ struct HfCandidateSelectorLbToLcPiReduced { o2::ccdb::CcdbApi ccdbApi; TrackSelectorPi selectorPion; - HfHelper hfHelper; using TracksPion = soa::Join; @@ -173,7 +172,7 @@ struct HfCandidateSelectorLbToLcPiReduced { } // topological cuts - if (!hfHelper.selectionLbToLcPiTopol(hfCandLb, cuts, binsPt)) { + if (!HfHelper::selectionLbToLcPiTopol(hfCandLb, cuts, binsPt)) { hfSelLbToLcPiCandidate(statusLbToLcPi); if (applyLbMl) { hfMlLbToLcPiCandidate(outputMlNotPreselected); @@ -182,7 +181,7 @@ struct HfCandidateSelectorLbToLcPiReduced { } if constexpr (WithLcMl) { // we include it in the topological selections - if (!hfHelper.selectionDmesMlScoresForBReduced(hfCandLb, cutsLcMl, binsPtLcMl)) { + if (!HfHelper::selectionDmesMlScoresForBReduced(hfCandLb, cutsLcMl, binsPtLcMl)) { hfSelLbToLcPiCandidate(statusLbToLcPi); if (applyLbMl) { hfMlLbToLcPiCandidate(outputMlNotPreselected); @@ -205,7 +204,7 @@ struct HfCandidateSelectorLbToLcPiReduced { } else if (pionPidMethod == PidMethod::TpcAndTof) { pidTrackPi = selectorPion.statusTpcAndTof(trackPi); } - if (!hfHelper.selectionLbToLcPiPid(pidTrackPi, acceptPIDNotApplicable.value)) { + if (!HfHelper::selectionLbToLcPiPid(pidTrackPi, acceptPIDNotApplicable.value)) { hfSelLbToLcPiCandidate(statusLbToLcPi); if (applyLbMl) { hfMlLbToLcPiCandidate(outputMlNotPreselected); diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx index 2604d089159..eff844858d6 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx @@ -204,7 +204,6 @@ struct HfDataCreatorCharmHadPiReduced { Configurable selectionFlagDstar{"selectionFlagDstar", true, "Selection Flag for D* decay to D0 Pi"}; } hfflagConfigurations; - HfHelper hfHelper; o2::hf_evsel::HfEventSelection hfEvSel; o2::hf_evsel::HfEventSelectionMc hfEvSelMc; @@ -1064,18 +1063,18 @@ struct HfDataCreatorCharmHadPiReduced { float invMassC0{-1.f}, invMassC1{-1.f}; if constexpr (DecChannel == DecayChannel::B0ToDminusPi) { indexHfCandCharm = tables.hfCand3Prong.lastIndex() + 1; - invMassC0 = hfHelper.invMassDplusToPiKPi(candC); + invMassC0 = HfHelper::invMassDplusToPiKPi(candC); registry.fill(HIST("hMassDplus"), invMassC0); registry.fill(HIST("hPtDplus"), candC.pt()); registry.fill(HIST("hCpaDplus"), candC.cpa()); } else if constexpr (DecChannel == DecayChannel::BsToDsminusPi) { indexHfCandCharm = tables.hfCand3Prong.lastIndex() + 1; if (candC.isSelDsToKKPi() >= hfflagConfigurations.selectionFlagDs) { - invMassC0 = hfHelper.invMassDsToKKPi(candC); + invMassC0 = HfHelper::invMassDsToKKPi(candC); registry.fill(HIST("hMassDsToKKPi"), invMassC0); } if (candC.isSelDsToPiKK() >= hfflagConfigurations.selectionFlagDs) { - invMassC1 = hfHelper.invMassDsToPiKK(candC); + invMassC1 = HfHelper::invMassDsToPiKK(candC); registry.fill(HIST("hMassDsToPiKK"), invMassC1); } registry.fill(HIST("hPtDs"), candC.pt()); @@ -1083,11 +1082,11 @@ struct HfDataCreatorCharmHadPiReduced { } else if constexpr (DecChannel == DecayChannel::BplusToD0barPi) { indexHfCandCharm = tables.hfCand2Prong.lastIndex() + 1; if (candC.isSelD0() >= hfflagConfigurations.selectionFlagD0) { - invMassC0 = hfHelper.invMassD0ToPiK(candC); + invMassC0 = HfHelper::invMassD0ToPiK(candC); registry.fill(HIST("hMassD0"), invMassC0); } if (candC.isSelD0bar() >= hfflagConfigurations.selectionFlagD0bar) { - invMassC1 = hfHelper.invMassD0barToKPi(candC); + invMassC1 = HfHelper::invMassD0barToKPi(candC); registry.fill(HIST("hMassD0bar"), invMassC1); } registry.fill(HIST("hPtD0"), candC.pt()); @@ -1095,11 +1094,11 @@ struct HfDataCreatorCharmHadPiReduced { } else if constexpr (DecChannel == DecayChannel::LbToLcplusPi) { indexHfCandCharm = tables.hfCand3Prong.lastIndex() + 1; if (candC.isSelLcToPKPi() >= hfflagConfigurations.selectionFlagLc) { - invMassC0 = hfHelper.invMassLcToPKPi(candC); + invMassC0 = HfHelper::invMassLcToPKPi(candC); registry.fill(HIST("hMassLcToPKPi"), invMassC0); } if (candC.isSelLcToPiKP() >= hfflagConfigurations.selectionFlagLc) { - invMassC1 = hfHelper.invMassLcToPiKP(candC); + invMassC1 = HfHelper::invMassLcToPiKP(candC); registry.fill(HIST("hMassLcToPiKP"), invMassC1); } registry.fill(HIST("hPtLc"), candC.pt()); diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx index 5a0050914af..588150dc44f 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx @@ -193,7 +193,6 @@ struct HfDataCreatorCharmResoReduced { Configurable rejectPairsWithCommonDaughter{"rejectPairsWithCommonDaughter", true, "flag to reject already at this stage the pairs that share a daughter track"}; Configurable rejectCollisionsWithBadEvSel{"rejectCollisionsWithBadEvSel", true, "flag to reject collisions with bad event selection"}; - HfHelper hfHelper; o2::hf_evsel::HfEventSelection hfEvSel; o2::hf_evsel::HfEventSelectionMc hfEvSelMc; @@ -1096,7 +1095,7 @@ struct HfDataCreatorCharmResoReduced { registry.fill(HIST("hMassVsPtDstarAll"), varUtils.ptD, varUtils.invMassD - varUtils.invMassD0); } else if constexpr (DType == DType::Dplus) { auto prong0 = tracksIU.rawIteratorAt(candD.prong0Id()); - varUtils.invMassD = hfHelper.invMassDplusToPiKPi(candD); + varUtils.invMassD = HfHelper::invMassDplusToPiKPi(candD); secondaryVertexD[0] = candD.xSecondaryVertex(); secondaryVertexD[1] = candD.ySecondaryVertex(); secondaryVertexD[2] = candD.zSecondaryVertex(); @@ -1115,8 +1114,8 @@ struct HfDataCreatorCharmResoReduced { } registry.fill(HIST("hMassVsPtDplusAll"), varUtils.ptD, varUtils.invMassD); } else if constexpr (DType == DType::D0) { - varUtils.invMassD0 = hfHelper.invMassD0ToPiK(candD); - varUtils.invMassD0Bar = hfHelper.invMassD0barToKPi(candD); + varUtils.invMassD0 = HfHelper::invMassD0ToPiK(candD); + varUtils.invMassD0Bar = HfHelper::invMassD0barToKPi(candD); secondaryVertexD[0] = candD.xSecondaryVertex(); secondaryVertexD[1] = candD.ySecondaryVertex(); secondaryVertexD[2] = candD.zSecondaryVertex(); diff --git a/PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx index 88ef350c2b2..46e08083e7f 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx @@ -186,8 +186,6 @@ struct HfDataCreatorJpsiHadReduced { Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable ccdbPathGrpMag{"ccdbPathGrpMag", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object (Run 3)"}; - HfHelper hfHelper; - TrackSelectorPi selectorPion; TrackSelectorPr selectorProton; TrackSelectorEl selectorElectron; @@ -359,7 +357,7 @@ struct HfDataCreatorJpsiHadReduced { bool selectionTopol(const T1& candidate, const T2& trackPos, const T2& trackNeg) { auto candpT = candidate.pt(); - auto candInvMass = runJpsiToee ? hfHelper.invMassJpsiToEE(candidate) : hfHelper.invMassJpsiToMuMu(candidate); + auto candInvMass = runJpsiToee ? HfHelper::invMassJpsiToEE(candidate) : HfHelper::invMassJpsiToMuMu(candidate); auto pseudoPropDecLen = candidate.decayLengthXY() * candInvMass / candpT; auto pTBin = findBin(binsPt, candpT); if (pTBin == -1) { @@ -826,7 +824,7 @@ struct HfDataCreatorJpsiHadReduced { registry.fill(HIST("hSelectionsJpsi"), 2 + aod::SelectionStep::RecoPID, candidate.pt()); int const indexHfCandJpsi = hfJpsi.lastIndex() + 1; - float const invMassJpsi = runJpsiToee ? hfHelper.invMassJpsiToEE(candidate) : hfHelper.invMassJpsiToMuMu(candidate); + float const invMassJpsi = runJpsiToee ? HfHelper::invMassJpsiToEE(candidate) : HfHelper::invMassJpsiToMuMu(candidate); registry.fill(HIST("hMassJpsi"), invMassJpsi); registry.fill(HIST("hPtJpsi"), candidate.pt()); registry.fill(HIST("hCpaJpsi"), candidate.cpa()); @@ -1051,9 +1049,9 @@ struct HfDataCreatorJpsiHadReduced { if (fillHfCandJpsi) { // fill Jpsi table only once per Jpsi candidate double invMassJpsi{0.}; if (runJpsiToee) { - invMassJpsi = hfHelper.invMassJpsiToEE(candidate); + invMassJpsi = HfHelper::invMassJpsiToEE(candidate); } else { - invMassJpsi = hfHelper.invMassJpsiToMuMu(candidate); + invMassJpsi = HfHelper::invMassJpsiToMuMu(candidate); } hfJpsi(trackPos.globalIndex(), trackNeg.globalIndex(), indexHfReducedCollision, diff --git a/PWGHF/D2H/Tasks/taskB0.cxx b/PWGHF/D2H/Tasks/taskB0.cxx index 02bb5254368..4fe85452d27 100644 --- a/PWGHF/D2H/Tasks/taskB0.cxx +++ b/PWGHF/D2H/Tasks/taskB0.cxx @@ -65,7 +65,6 @@ struct HfTaskB0 { // O2DatabasePDG service Service pdg; - HfHelper hfHelper; using TracksWithSel = soa::Join; @@ -178,7 +177,7 @@ struct HfTaskB0 { TracksWithSel const&) { for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yB0(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yB0(candidate)) > yCandRecoMax) { continue; } @@ -187,7 +186,7 @@ struct HfTaskB0 { auto ptCandB0 = candidate.pt(); - registry.fill(HIST("hMass"), hfHelper.invMassB0ToDPi(candidate), ptCandB0); + registry.fill(HIST("hMass"), HfHelper::invMassB0ToDPi(candidate), ptCandB0); registry.fill(HIST("hPtCand"), ptCandB0); registry.fill(HIST("hPtProng0"), candidate.ptProng0()); registry.fill(HIST("hPtProng1"), candidate.ptProng1()); @@ -198,12 +197,12 @@ struct HfTaskB0 { registry.fill(HIST("hd0Prong1"), candidate.impactParameter1(), ptCandB0); registry.fill(HIST("hCPA"), candidate.cpa(), ptCandB0); registry.fill(HIST("hEta"), candidate.eta(), ptCandB0); - registry.fill(HIST("hRapidity"), hfHelper.yB0(candidate), ptCandB0); + registry.fill(HIST("hRapidity"), HfHelper::yB0(candidate), ptCandB0); registry.fill(HIST("hImpParErr"), candidate.errorImpactParameter0(), ptCandB0); registry.fill(HIST("hImpParErr"), candidate.errorImpactParameter1(), ptCandB0); registry.fill(HIST("hDecLenErr"), candidate.errorDecayLength(), ptCandB0); registry.fill(HIST("hDecLenXYErr"), candidate.errorDecayLengthXY(), ptCandB0); - registry.fill(HIST("hInvMassD"), hfHelper.invMassDplusToPiKPi(candD), ptCandB0); + registry.fill(HIST("hInvMassD"), HfHelper::invMassDplusToPiKPi(candD), ptCandB0); } // candidate loop } // process @@ -215,13 +214,13 @@ struct HfTaskB0 { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yB0(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yB0(candidate)) > yCandRecoMax) { continue; } auto ptCandB0 = candidate.pt(); auto candD = candidate.prong0_as>(); - auto invMassCandB0 = hfHelper.invMassB0ToDPi(candidate); + auto invMassCandB0 = HfHelper::invMassB0ToDPi(candidate); auto flagMcMatchRecB0 = std::abs(candidate.flagMcMatchRec()); if (flagMcMatchRecB0 == DecayChannelMain::B0ToDminusPi) { @@ -233,10 +232,10 @@ struct HfTaskB0 { registry.fill(HIST("hCPARecSig"), candidate.cpa(), ptCandB0); registry.fill(HIST("hCPAxyRecSig"), candidate.cpaXY(), ptCandB0); registry.fill(HIST("hEtaRecSig"), candidate.eta(), ptCandB0); - registry.fill(HIST("hRapidityRecSig"), hfHelper.yB0(candidate), ptCandB0); + registry.fill(HIST("hRapidityRecSig"), HfHelper::yB0(candidate), ptCandB0); registry.fill(HIST("hDecLengthRecSig"), candidate.decayLength(), ptCandB0); registry.fill(HIST("hDecLengthXYRecSig"), candidate.decayLengthXY(), ptCandB0); - registry.fill(HIST("hMassRecSig"), hfHelper.invMassB0ToDPi(candidate), ptCandB0); + registry.fill(HIST("hMassRecSig"), HfHelper::invMassB0ToDPi(candidate), ptCandB0); registry.fill(HIST("hd0Prong0RecSig"), candidate.impactParameter0(), ptCandB0); registry.fill(HIST("hd0Prong1RecSig"), candidate.impactParameter1(), ptCandB0); registry.fill(HIST("hPtProng0RecSig"), candidate.ptProng0(), ptCandB0); @@ -255,10 +254,10 @@ struct HfTaskB0 { registry.fill(HIST("hCPARecBg"), candidate.cpa(), ptCandB0); registry.fill(HIST("hCPAxyRecBg"), candidate.cpaXY(), ptCandB0); registry.fill(HIST("hEtaRecBg"), candidate.eta(), ptCandB0); - registry.fill(HIST("hRapidityRecBg"), hfHelper.yB0(candidate), ptCandB0); + registry.fill(HIST("hRapidityRecBg"), HfHelper::yB0(candidate), ptCandB0); registry.fill(HIST("hDecLengthRecBg"), candidate.decayLength(), ptCandB0); registry.fill(HIST("hDecLengthXYRecBg"), candidate.decayLengthXY(), ptCandB0); - registry.fill(HIST("hMassRecBg"), hfHelper.invMassB0ToDPi(candidate), ptCandB0); + registry.fill(HIST("hMassRecBg"), HfHelper::invMassB0ToDPi(candidate), ptCandB0); registry.fill(HIST("hd0Prong0RecBg"), candidate.impactParameter0(), ptCandB0); registry.fill(HIST("hd0Prong1RecBg"), candidate.impactParameter1(), ptCandB0); registry.fill(HIST("hPtProng0RecBg"), candidate.ptProng0(), ptCandB0); diff --git a/PWGHF/D2H/Tasks/taskB0Reduced.cxx b/PWGHF/D2H/Tasks/taskB0Reduced.cxx index 8cbd55aa2f4..5e146308c45 100644 --- a/PWGHF/D2H/Tasks/taskB0Reduced.cxx +++ b/PWGHF/D2H/Tasks/taskB0Reduced.cxx @@ -190,8 +190,6 @@ struct HfTaskB0Reduced { Configurable downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of background candidates to keep for ML trainings"}; Configurable ptMaxForDownSample{"ptMaxForDownSample", 10., "Maximum pt for the application of the downsampling factor"}; - HfHelper hfHelper; - using TracksBachPions = soa::Join; using CandsDplus = soa::Join; using CandsDstar = soa::Join; @@ -454,7 +452,7 @@ struct HfTaskB0Reduced { CandsDmes const&) { auto ptCandB0 = candidate.pt(); - auto invMassB0 = hfHelper.invMassB0ToDPi(candidate); + auto invMassB0 = HfHelper::invMassB0ToDPi(candidate); auto candD = candidate.template prongD0_as(); auto ptD = candidate.ptProng0(); auto invMassD = candD.invMassHypo0(); @@ -479,7 +477,7 @@ struct HfTaskB0Reduced { if (fillHistograms) { if constexpr (DoMc) { if (isSignal) { - registry.fill(HIST("hMassRecSig"), ptCandB0, hfHelper.invMassB0ToDPi(candidate)); + registry.fill(HIST("hMassRecSig"), ptCandB0, HfHelper::invMassB0ToDPi(candidate)); registry.fill(HIST("hPtProngD0RecSig"), ptCandB0, candidate.ptProng0()); registry.fill(HIST("hPtProngSoftPiRecSig"), ptCandB0, candidate.ptProng1()); registry.fill(HIST("hPtProngBachPiRecSig"), ptCandB0, candidate.ptProng2()); @@ -493,7 +491,7 @@ struct HfTaskB0Reduced { registry.fill(HIST("hCospRecSig"), ptCandB0, candidate.cpa()); registry.fill(HIST("hCospXyRecSig"), ptCandB0, candidate.cpaXY()); registry.fill(HIST("hEtaRecSig"), ptCandB0, candidate.eta()); - registry.fill(HIST("hRapidityRecSig"), ptCandB0, hfHelper.yB0(candidate)); + registry.fill(HIST("hRapidityRecSig"), ptCandB0, HfHelper::yB0(candidate)); registry.fill(HIST("hInvMassDRecSig"), ptD, invMassD); registry.fill(HIST("hDecLengthDRecSig"), ptD, decLenD); registry.fill(HIST("hDecLengthXyDRecSig"), ptD, decLenXyD); @@ -505,7 +503,7 @@ struct HfTaskB0Reduced { registry.fill(HIST("hMlScoreNonPromptDRecSig"), ptD, candidate.prong0MlScoreNonprompt()); } } else if (fillBackground) { - registry.fill(HIST("hMassRecBg"), ptCandB0, hfHelper.invMassB0ToDPi(candidate)); + registry.fill(HIST("hMassRecBg"), ptCandB0, HfHelper::invMassB0ToDPi(candidate)); registry.fill(HIST("hPtProngD0RecBg"), ptCandB0, candidate.ptProng0()); registry.fill(HIST("hPtProngSoftPiRecBg"), ptCandB0, candidate.ptProng1()); registry.fill(HIST("hPtProngBachPiRecBg"), ptCandB0, candidate.ptProng2()); @@ -519,7 +517,7 @@ struct HfTaskB0Reduced { registry.fill(HIST("hCospRecBg"), ptCandB0, candidate.cpa()); registry.fill(HIST("hCospXyRecBg"), ptCandB0, candidate.cpaXY()); registry.fill(HIST("hEtaRecBg"), ptCandB0, candidate.eta()); - registry.fill(HIST("hRapidityRecBg"), ptCandB0, hfHelper.yB0(candidate)); + registry.fill(HIST("hRapidityRecBg"), ptCandB0, HfHelper::yB0(candidate)); registry.fill(HIST("hInvMassDRecBg"), ptD, invMassD); registry.fill(HIST("hDecLengthDRecBg"), ptD, decLenD); registry.fill(HIST("hDecLengthXyDRecBg"), ptD, decLenXyD); @@ -546,7 +544,7 @@ struct HfTaskB0Reduced { registry.fill(HIST("hCosp"), ptCandB0, candidate.cpa()); registry.fill(HIST("hCospXy"), ptCandB0, candidate.cpaXY()); registry.fill(HIST("hEta"), ptCandB0, candidate.eta()); - registry.fill(HIST("hRapidity"), ptCandB0, hfHelper.yB0(candidate)); + registry.fill(HIST("hRapidity"), ptCandB0, HfHelper::yB0(candidate)); registry.fill(HIST("hInvMassD"), ptD, invMassD); registry.fill(HIST("hDecLengthD"), ptD, decLenD); registry.fill(HIST("hDecLengthXyD"), ptD, decLenXyD); @@ -608,7 +606,7 @@ struct HfTaskB0Reduced { ptCandB0, candidate.eta(), candidate.phi(), - hfHelper.yB0(candidate), + HfHelper::yB0(candidate), candidate.cpa(), candidate.cpaXY(), candidate.chi2PCA(), @@ -691,7 +689,7 @@ struct HfTaskB0Reduced { CandsDmes const&) { auto ptCandB0 = candidate.pt(); - auto invMassB0 = hfHelper.invMassB0ToDPi(candidate); + auto invMassB0 = HfHelper::invMassB0ToDPi(candidate); auto candD = candidate.template prong0_as(); auto ptD = candidate.ptProng0(); auto invMassD = candD.invMassHypo0(); @@ -715,7 +713,7 @@ struct HfTaskB0Reduced { if (fillHistograms) { if constexpr (DoMc) { if (isSignal) { - registry.fill(HIST("hMassRecSig"), ptCandB0, hfHelper.invMassB0ToDPi(candidate)); + registry.fill(HIST("hMassRecSig"), ptCandB0, HfHelper::invMassB0ToDPi(candidate)); registry.fill(HIST("hPtProng0RecSig"), ptCandB0, candidate.ptProng0()); registry.fill(HIST("hPtProng1RecSig"), ptCandB0, candidate.ptProng1()); registry.fill(HIST("hImpParProdRecSig"), ptCandB0, candidate.impactParameterProduct()); @@ -727,7 +725,7 @@ struct HfTaskB0Reduced { registry.fill(HIST("hCospRecSig"), ptCandB0, candidate.cpa()); registry.fill(HIST("hCospXyRecSig"), ptCandB0, candidate.cpaXY()); registry.fill(HIST("hEtaRecSig"), ptCandB0, candidate.eta()); - registry.fill(HIST("hRapidityRecSig"), ptCandB0, hfHelper.yB0(candidate)); + registry.fill(HIST("hRapidityRecSig"), ptCandB0, HfHelper::yB0(candidate)); registry.fill(HIST("hInvMassDRecSig"), ptD, invMassD); registry.fill(HIST("hDecLengthDRecSig"), ptD, decLenD); registry.fill(HIST("hDecLengthXyDRecSig"), ptD, decLenXyD); @@ -745,7 +743,7 @@ struct HfTaskB0Reduced { registry.fill(HIST("hMlScoreSigB0RecSig"), ptCandB0, candidate.mlProbB0ToDPi()); } } else if (fillBackground) { - registry.fill(HIST("hMassRecBg"), ptCandB0, hfHelper.invMassB0ToDPi(candidate)); + registry.fill(HIST("hMassRecBg"), ptCandB0, HfHelper::invMassB0ToDPi(candidate)); registry.fill(HIST("hPtProng0RecBg"), ptCandB0, candidate.ptProng0()); registry.fill(HIST("hPtProng1RecBg"), ptCandB0, candidate.ptProng1()); registry.fill(HIST("hImpParProdRecBg"), ptCandB0, candidate.impactParameterProduct()); @@ -757,7 +755,7 @@ struct HfTaskB0Reduced { registry.fill(HIST("hCospRecBg"), ptCandB0, candidate.cpa()); registry.fill(HIST("hCospXyRecBg"), ptCandB0, candidate.cpaXY()); registry.fill(HIST("hEtaRecBg"), ptCandB0, candidate.eta()); - registry.fill(HIST("hRapidityRecBg"), ptCandB0, hfHelper.yB0(candidate)); + registry.fill(HIST("hRapidityRecBg"), ptCandB0, HfHelper::yB0(candidate)); registry.fill(HIST("hInvMassDRecBg"), ptD, invMassD); registry.fill(HIST("hDecLengthDRecBg"), ptD, decLenD); registry.fill(HIST("hDecLengthXyDRecBg"), ptD, decLenXyD); @@ -797,7 +795,7 @@ struct HfTaskB0Reduced { registry.fill(HIST("hCosp"), ptCandB0, candidate.cpa()); registry.fill(HIST("hCospXy"), ptCandB0, candidate.cpaXY()); registry.fill(HIST("hEta"), ptCandB0, candidate.eta()); - registry.fill(HIST("hRapidity"), ptCandB0, hfHelper.yB0(candidate)); + registry.fill(HIST("hRapidity"), ptCandB0, HfHelper::yB0(candidate)); registry.fill(HIST("hInvMassD"), ptD, invMassD); registry.fill(HIST("hDecLengthD"), ptD, decLenD); registry.fill(HIST("hDecLengthXyD"), ptD, decLenXyD); @@ -865,7 +863,7 @@ struct HfTaskB0Reduced { ptCandB0, candidate.eta(), candidate.phi(), - hfHelper.yB0(candidate), + HfHelper::yB0(candidate), candidate.cpa(), candidate.cpaXY(), candidate.chi2PCA(), @@ -980,7 +978,7 @@ struct HfTaskB0Reduced { TracksBachPions const&) { for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yB0(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yB0(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD); @@ -993,7 +991,7 @@ struct HfTaskB0Reduced { TracksBachPions const&) { for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yB0(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yB0(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD); @@ -1006,7 +1004,7 @@ struct HfTaskB0Reduced { TracksBachPions const&) { for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yB0(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yB0(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD); @@ -1021,7 +1019,7 @@ struct HfTaskB0Reduced { TracksBachPions const&) { for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yB0(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yB0(candidate)) > yCandRecoMax) { continue; } fillCandDStarPi(candidate, softPions, candidatesD); @@ -1035,7 +1033,7 @@ struct HfTaskB0Reduced { TracksBachPions const&) { for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yB0(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yB0(candidate)) > yCandRecoMax) { continue; } fillCandDStarPi(candidate, softPions, candidatesD); @@ -1050,7 +1048,7 @@ struct HfTaskB0Reduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yB0(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yB0(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD); @@ -1070,7 +1068,7 @@ struct HfTaskB0Reduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yB0(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yB0(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD); @@ -1090,7 +1088,7 @@ struct HfTaskB0Reduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yB0(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yB0(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD); @@ -1110,7 +1108,7 @@ struct HfTaskB0Reduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yB0(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yB0(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD); @@ -1130,7 +1128,7 @@ struct HfTaskB0Reduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yB0(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yB0(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD); @@ -1150,7 +1148,7 @@ struct HfTaskB0Reduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yB0(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yB0(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD); @@ -1171,7 +1169,7 @@ struct HfTaskB0Reduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yB0(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yB0(candidate)) > yCandRecoMax) { continue; } fillCandDStarPi(candidate, softPions, candidatesD); @@ -1192,7 +1190,7 @@ struct HfTaskB0Reduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yB0(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yB0(candidate)) > yCandRecoMax) { continue; } fillCandDStarPi(candidate, softPions, candidatesD); diff --git a/PWGHF/D2H/Tasks/taskBplus.cxx b/PWGHF/D2H/Tasks/taskBplus.cxx index 3f9e31f222c..75712e018f0 100644 --- a/PWGHF/D2H/Tasks/taskBplus.cxx +++ b/PWGHF/D2H/Tasks/taskBplus.cxx @@ -71,7 +71,6 @@ struct HfTaskBplus { // O2DatabasePDG service Service pdg; - HfHelper hfHelper; Partition> selectedBPlusCandidates = aod::hf_sel_candidate_bplus::isSelBplusToD0Pi >= selectionFlagBplus; Partition> selectedBPlusCandidatesMC = aod::hf_sel_candidate_bplus::isSelBplusToD0Pi >= selectionFlagBplus; @@ -181,14 +180,14 @@ struct HfTaskBplus { { for (const auto& candidate : selectedBPlusCandidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBplus(candidate)) > yCandRecoMax) { continue; } auto ptCandBplus = candidate.pt(); auto candD0 = candidate.prong0_as>(); auto candPi = candidate.prong1(); - registry.fill(HIST("hMass"), hfHelper.invMassBplusToD0Pi(candidate), ptCandBplus); + registry.fill(HIST("hMass"), HfHelper::invMassBplusToD0Pi(candidate), ptCandBplus); registry.fill(HIST("hPtCand"), ptCandBplus); registry.fill(HIST("hPtProng0"), candidate.ptProng0()); registry.fill(HIST("hPtProng1"), candidate.ptProng1()); @@ -200,15 +199,15 @@ struct HfTaskBplus { registry.fill(HIST("hCPA"), candidate.cpa(), ptCandBplus); registry.fill(HIST("hCPAxy"), candidate.cpaXY(), ptCandBplus); registry.fill(HIST("hEta"), candidate.eta(), ptCandBplus); - registry.fill(HIST("hRapidity"), hfHelper.yBplus(candidate), ptCandBplus); + registry.fill(HIST("hRapidity"), HfHelper::yBplus(candidate), ptCandBplus); registry.fill(HIST("hImpParErr"), candidate.errorImpactParameter0(), ptCandBplus); registry.fill(HIST("hImpParErr"), candidate.errorImpactParameter1(), ptCandBplus); registry.fill(HIST("hDecLenErr"), candidate.errorDecayLength(), ptCandBplus); registry.fill(HIST("hDecLenXYErr"), candidate.errorDecayLengthXY(), ptCandBplus); if (candPi.sign() > 0) { - registry.fill(HIST("hInvMassD0"), hfHelper.invMassD0barToKPi(candD0), ptCandBplus); + registry.fill(HIST("hInvMassD0"), HfHelper::invMassD0barToKPi(candD0), ptCandBplus); } else { - registry.fill(HIST("hInvMassD0"), hfHelper.invMassD0ToPiK(candD0), ptCandBplus); + registry.fill(HIST("hInvMassD0"), HfHelper::invMassD0ToPiK(candD0), ptCandBplus); } registry.fill(HIST("hCPAFinerBinning"), candidate.cpa(), ptCandBplus); registry.fill(HIST("hCPAxyFinerBinning"), candidate.cpaXY(), ptCandBplus); @@ -222,7 +221,7 @@ struct HfTaskBplus { { // MC rec for (const auto& candidate : selectedBPlusCandidatesMC) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBplus(candidate)) > yCandRecoMax) { continue; } auto ptCandBplus = candidate.pt(); @@ -238,10 +237,10 @@ struct HfTaskBplus { registry.fill(HIST("hCPAFinerBinningRecSig"), candidate.cpa(), ptCandBplus); registry.fill(HIST("hCPAxyFinerBinningRecSig"), candidate.cpaXY(), ptCandBplus); registry.fill(HIST("hEtaRecSig"), candidate.eta(), ptCandBplus); - registry.fill(HIST("hRapidityRecSig"), hfHelper.yBplus(candidate), ptCandBplus); + registry.fill(HIST("hRapidityRecSig"), HfHelper::yBplus(candidate), ptCandBplus); registry.fill(HIST("hDecLengthRecSig"), candidate.decayLength(), ptCandBplus); registry.fill(HIST("hDecLengthXYRecSig"), candidate.decayLengthXY(), ptCandBplus); - registry.fill(HIST("hMassRecSig"), hfHelper.invMassBplusToD0Pi(candidate), ptCandBplus); + registry.fill(HIST("hMassRecSig"), HfHelper::invMassBplusToD0Pi(candidate), ptCandBplus); registry.fill(HIST("hd0Prong0RecSig"), candidate.impactParameter0(), ptCandBplus); registry.fill(HIST("hd0Prong1RecSig"), candidate.impactParameter1(), ptCandBplus); registry.fill(HIST("hPtProng0RecSig"), candidate.ptProng0(), ptCandBplus); @@ -255,10 +254,10 @@ struct HfTaskBplus { registry.fill(HIST("hCPAFinerBinningRecBg"), candidate.cpa(), ptCandBplus); registry.fill(HIST("hCPAxyFinerBinningRecBg"), candidate.cpaXY(), ptCandBplus); registry.fill(HIST("hEtaRecBg"), candidate.eta(), ptCandBplus); - registry.fill(HIST("hRapidityRecBg"), hfHelper.yBplus(candidate), ptCandBplus); + registry.fill(HIST("hRapidityRecBg"), HfHelper::yBplus(candidate), ptCandBplus); registry.fill(HIST("hDecLengthRecBg"), candidate.decayLength(), ptCandBplus); registry.fill(HIST("hDecLengthXYRecBg"), candidate.decayLengthXY(), ptCandBplus); - registry.fill(HIST("hMassRecBg"), hfHelper.invMassBplusToD0Pi(candidate), ptCandBplus); + registry.fill(HIST("hMassRecBg"), HfHelper::invMassBplusToD0Pi(candidate), ptCandBplus); registry.fill(HIST("hd0Prong0RecBg"), candidate.impactParameter0(), ptCandBplus); registry.fill(HIST("hd0Prong1RecBg"), candidate.impactParameter1(), ptCandBplus); registry.fill(HIST("hPtProng0RecBg"), candidate.ptProng0(), ptCandBplus); diff --git a/PWGHF/D2H/Tasks/taskBplusReduced.cxx b/PWGHF/D2H/Tasks/taskBplusReduced.cxx index f47cc1c2c4e..bca08dbf154 100644 --- a/PWGHF/D2H/Tasks/taskBplusReduced.cxx +++ b/PWGHF/D2H/Tasks/taskBplusReduced.cxx @@ -196,8 +196,6 @@ struct HfTaskBplusReduced { Configurable ptMaxForDownSample{"ptMaxForDownSample", 10., "Maximum pt for the application of the downsampling factor"}; Configurable> binsPt{"binsPt", std::vector{hf_cuts_bplus_to_d0_pi::vecBinsPt}, "pT bin limits"}; - HfHelper hfHelper; - using TracksPion = soa::Join; using CandsD0 = soa::Join; @@ -408,7 +406,7 @@ struct HfTaskBplusReduced { TracksPion const&) { auto ptCandBplus = candidate.pt(); - auto invMassBplus = hfHelper.invMassBplusToD0Pi(candidate); + auto invMassBplus = HfHelper::invMassBplusToD0Pi(candidate); auto candD0 = candidate.template prong0_as(); auto candPi = candidate.template prong1_as(); auto ptD0 = candidate.ptProng0(); @@ -440,7 +438,7 @@ struct HfTaskBplusReduced { registry.fill(HIST("hCpaRecSig"), candidate.cpa(), ptCandBplus); registry.fill(HIST("hCpaXyRecSig"), candidate.cpaXY(), ptCandBplus); registry.fill(HIST("hEtaRecSig"), candidate.eta(), ptCandBplus); - registry.fill(HIST("hRapidityRecSig"), hfHelper.yBplus(candidate), ptCandBplus); + registry.fill(HIST("hRapidityRecSig"), HfHelper::yBplus(candidate), ptCandBplus); registry.fill(HIST("hDecLengthRecSig"), candidate.decayLength(), ptCandBplus); registry.fill(HIST("hDecLengthXyRecSig"), candidate.decayLengthXY(), ptCandBplus); registry.fill(HIST("hNormDecLengthXyRecSig"), candidate.decayLengthXYNormalised(), ptCandBplus); @@ -472,7 +470,7 @@ struct HfTaskBplusReduced { registry.fill(HIST("hCpaRecBg"), candidate.cpa(), ptCandBplus); registry.fill(HIST("hCpaXyRecBg"), candidate.cpaXY(), ptCandBplus); registry.fill(HIST("hEtaRecBg"), candidate.eta(), ptCandBplus); - registry.fill(HIST("hRapidityRecBg"), hfHelper.yBplus(candidate), ptCandBplus); + registry.fill(HIST("hRapidityRecBg"), HfHelper::yBplus(candidate), ptCandBplus); registry.fill(HIST("hDecLengthRecBg"), candidate.decayLength(), ptCandBplus); registry.fill(HIST("hDecLengthXyRecBg"), candidate.decayLengthXY(), ptCandBplus); registry.fill(HIST("hNormDecLengthXyRecBg"), candidate.decayLengthXYNormalised(), ptCandBplus); @@ -516,7 +514,7 @@ struct HfTaskBplusReduced { registry.fill(HIST("hCpa"), candidate.cpa(), ptCandBplus); registry.fill(HIST("hCpaXy"), candidate.cpaXY(), ptCandBplus); registry.fill(HIST("hEta"), candidate.eta(), ptCandBplus); - registry.fill(HIST("hRapidity"), hfHelper.yBplus(candidate), ptCandBplus); + registry.fill(HIST("hRapidity"), HfHelper::yBplus(candidate), ptCandBplus); registry.fill(HIST("hInvMassD0"), invMassD0, ptCandBplus); registry.fill(HIST("hDecLengthD0"), decLenD0, ptD0); registry.fill(HIST("hDecLengthXyD0"), decLenXyD0, ptD0); @@ -599,7 +597,7 @@ struct HfTaskBplusReduced { ptCandBplus, candidate.eta(), candidate.phi(), - hfHelper.yBplus(candidate), + HfHelper::yBplus(candidate), candidate.cpa(), candidate.cpaXY(), candidate.chi2PCA(), @@ -712,7 +710,7 @@ struct HfTaskBplusReduced { TracksPion const& pionTracks) { for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBplus(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD, pionTracks); @@ -725,7 +723,7 @@ struct HfTaskBplusReduced { TracksPion const& pionTracks) { for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBplus(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD, pionTracks); @@ -738,7 +736,7 @@ struct HfTaskBplusReduced { TracksPion const& pionTracks) { for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBplus(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD, pionTracks); @@ -753,7 +751,7 @@ struct HfTaskBplusReduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBplus(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD, pionTracks); @@ -773,7 +771,7 @@ struct HfTaskBplusReduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBplus(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD, pionTracks); @@ -793,7 +791,7 @@ struct HfTaskBplusReduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBplus(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD, pionTracks); @@ -813,7 +811,7 @@ struct HfTaskBplusReduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBplus(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD, pionTracks); @@ -833,7 +831,7 @@ struct HfTaskBplusReduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBplus(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD, pionTracks); @@ -853,7 +851,7 @@ struct HfTaskBplusReduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBplus(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD, pionTracks); diff --git a/PWGHF/D2H/Tasks/taskBplusToJpsiKReduced.cxx b/PWGHF/D2H/Tasks/taskBplusToJpsiKReduced.cxx index 85e89ec279e..aa0ff931938 100644 --- a/PWGHF/D2H/Tasks/taskBplusToJpsiKReduced.cxx +++ b/PWGHF/D2H/Tasks/taskBplusToJpsiKReduced.cxx @@ -236,7 +236,6 @@ struct HfTaskBplusToJpsiKReduced { Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"}; Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; - HfHelper hfHelper; TrackSelectorKa selectorKaon; o2::analysis::HfMlResponseBplusToJpsiKReduced hfMlResponse; o2::ccdb::CcdbApi ccdbApi; @@ -340,7 +339,7 @@ struct HfTaskBplusToJpsiKReduced { aod::HfRedBach0Tracks const&) { auto ptCandBplus = candidate.pt(); - auto invMassBplus = hfHelper.invMassBplusToJpsiK(candidate); + auto invMassBplus = HfHelper::invMassBplusToJpsiK(candidate); auto candJpsi = candidate.template jpsi_as(); auto candKa = candidate.template bachKa_as(); auto ptJpsi = candidate.ptProng0(); @@ -357,7 +356,7 @@ struct HfTaskBplusToJpsiKReduced { } SETBIT(statusBplus, SelectionStep::RecoSkims); - if (hfHelper.selectionBplusToJpsiKTopol(candidate, cuts, binsPt)) { + if (HfHelper::selectionBplusToJpsiKTopol(candidate, cuts, binsPt)) { SETBIT(statusBplus, SelectionStep::RecoTopol); } else if (selectionFlagBplus >= BIT(SelectionStep::RecoTopol) * 2 - 1) { return; @@ -371,7 +370,7 @@ struct HfTaskBplusToJpsiKReduced { } else if (kaonPidMethod == PidMethod::TpcAndTof) { pidTrackKa = selectorKaon.statusTpcAndTof(candKa); } - if (hfHelper.selectionBplusToJpsiKPid(pidTrackKa, acceptPIDNotApplicable.value)) { + if (HfHelper::selectionBplusToJpsiKPid(pidTrackKa, acceptPIDNotApplicable.value)) { // LOGF(info, "B+ candidate selection failed at PID selection"); SETBIT(statusBplus, SelectionStep::RecoPID); } else if (selectionFlagBplus >= BIT(SelectionStep::RecoPID) * 2 - 1) { @@ -419,7 +418,7 @@ struct HfTaskBplusToJpsiKReduced { ptCandBplus, candidate.eta(), candidate.phi(), - hfHelper.yBplus(candidate), + HfHelper::yBplus(candidate), candidate.cpa(), candidate.cpaXY(), candidate.chi2PCA(), @@ -494,7 +493,7 @@ struct HfTaskBplusToJpsiKReduced { aod::HfRedBach0Tracks const& kaonTracks) { for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBplus(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesJpsi, kaonTracks); @@ -507,7 +506,7 @@ struct HfTaskBplusToJpsiKReduced { aod::HfRedBach0Tracks const& kaonTracks) { for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBplus(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesJpsi, kaonTracks); @@ -522,7 +521,7 @@ struct HfTaskBplusToJpsiKReduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBplus(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesJpsi, kaonTracks); @@ -542,7 +541,7 @@ struct HfTaskBplusToJpsiKReduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBplus(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesJpsi, kaonTracks); diff --git a/PWGHF/D2H/Tasks/taskBs.cxx b/PWGHF/D2H/Tasks/taskBs.cxx index ea2047a5342..b6beb8844ee 100644 --- a/PWGHF/D2H/Tasks/taskBs.cxx +++ b/PWGHF/D2H/Tasks/taskBs.cxx @@ -65,7 +65,6 @@ struct HfTaskBs { Configurable checkDecayTypeMc{"checkDecayTypeMc", false, "Flag to enable DecayType histogram"}; Service pdg; - HfHelper hfHelper; using TracksWithSel = soa::Join; @@ -176,7 +175,7 @@ struct HfTaskBs { TracksWithSel const&) { for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBs(candidate)) > yCandRecoMax) { continue; } @@ -188,9 +187,9 @@ struct HfTaskBs { registry.fill(HIST("hPtProng1"), candidate.ptProng1()); registry.fill(HIST("hPtCand"), ptCandBs); registry.fill(HIST("hEta"), candidate.eta(), ptCandBs); - registry.fill(HIST("hRapidity"), hfHelper.yBs(candidate), ptCandBs); + registry.fill(HIST("hRapidity"), HfHelper::yBs(candidate), ptCandBs); registry.fill(HIST("hCPA"), candidate.cpa(), ptCandBs); - registry.fill(HIST("hMass"), hfHelper.invMassBsToDsPi(candidate), ptCandBs); + registry.fill(HIST("hMass"), HfHelper::invMassBsToDsPi(candidate), ptCandBs); registry.fill(HIST("hDecLength"), candidate.decayLength(), ptCandBs); registry.fill(HIST("hDecLenErr"), candidate.errorDecayLength(), ptCandBs); registry.fill(HIST("hDecLengthXY"), candidate.decayLengthXY(), ptCandBs); @@ -200,7 +199,7 @@ struct HfTaskBs { registry.fill(HIST("hImpParErr"), candidate.errorImpactParameter0(), ptCandBs); registry.fill(HIST("hImpParErr"), candidate.errorImpactParameter1(), ptCandBs); registry.fill(HIST("hIPProd"), candidate.impactParameterProduct(), ptCandBs); - registry.fill(HIST("hInvMassDs"), hfHelper.invMassDsToKKPi(candDs), ptCandBs); + registry.fill(HIST("hInvMassDs"), HfHelper::invMassDsToKKPi(candDs), ptCandBs); } // candidate loop } // process @@ -212,13 +211,13 @@ struct HfTaskBs { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBs(candidate)) > yCandRecoMax) { continue; } auto ptCandBs = candidate.pt(); auto candDs = candidate.prong0_as>(); - auto invMassCandBs = hfHelper.invMassBsToDsPi(candidate); + auto invMassCandBs = HfHelper::invMassBsToDsPi(candidate); auto flagMcMatchRecBs = std::abs(candidate.flagMcMatchRec()); if (flagMcMatchRecBs == DecayChannelMain::BsToDsPi) { @@ -228,10 +227,10 @@ struct HfTaskBs { registry.fill(HIST("hPtGenSig"), particleMother.pt()); registry.fill(HIST("hPtRecSig"), ptCandBs); registry.fill(HIST("hEtaRecSig"), candidate.eta(), ptCandBs); - registry.fill(HIST("hRapidityRecSig"), hfHelper.yBs(candidate), ptCandBs); + registry.fill(HIST("hRapidityRecSig"), HfHelper::yBs(candidate), ptCandBs); registry.fill(HIST("hCPARecSig"), candidate.cpa(), ptCandBs); registry.fill(HIST("hCPAxyRecSig"), candidate.cpaXY(), ptCandBs); - registry.fill(HIST("hMassRecSig"), hfHelper.invMassBsToDsPi(candidate), ptCandBs); + registry.fill(HIST("hMassRecSig"), HfHelper::invMassBsToDsPi(candidate), ptCandBs); registry.fill(HIST("hDecLengthRecSig"), candidate.decayLength(), ptCandBs); registry.fill(HIST("hDecLengthXYRecSig"), candidate.decayLengthXY(), ptCandBs); registry.fill(HIST("hDecLengthNormRecSig"), candidate.decayLengthXYNormalised(), ptCandBs); @@ -250,10 +249,10 @@ struct HfTaskBs { } else { registry.fill(HIST("hPtRecBg"), ptCandBs); registry.fill(HIST("hEtaRecBg"), candidate.eta(), ptCandBs); - registry.fill(HIST("hRapidityRecBg"), hfHelper.yBs(candidate), ptCandBs); + registry.fill(HIST("hRapidityRecBg"), HfHelper::yBs(candidate), ptCandBs); registry.fill(HIST("hCPARecBg"), candidate.cpa(), ptCandBs); registry.fill(HIST("hCPAxyRecBg"), candidate.cpaXY(), ptCandBs); - registry.fill(HIST("hMassRecBg"), hfHelper.invMassBsToDsPi(candidate), ptCandBs); + registry.fill(HIST("hMassRecBg"), HfHelper::invMassBsToDsPi(candidate), ptCandBs); registry.fill(HIST("hDecLengthRecBg"), candidate.decayLength(), ptCandBs); registry.fill(HIST("hDecLengthXYRecBg"), candidate.decayLengthXY(), ptCandBs); registry.fill(HIST("hDecLengthNormRecBg"), candidate.decayLengthXYNormalised(), ptCandBs); diff --git a/PWGHF/D2H/Tasks/taskBsReduced.cxx b/PWGHF/D2H/Tasks/taskBsReduced.cxx index 44e5f5d8f82..93b4485228a 100644 --- a/PWGHF/D2H/Tasks/taskBsReduced.cxx +++ b/PWGHF/D2H/Tasks/taskBsReduced.cxx @@ -193,8 +193,6 @@ struct HfTaskBsReduced { Configurable downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of background_{s} candidates to keep for ML trainings"}; Configurable ptMaxForDownSample{"ptMaxForDownSample", 10., "Maximum pt for the application of the downsampling factor"}; - HfHelper hfHelper; - using TracksPion = soa::Join; using CandsDS = soa::Join; @@ -403,7 +401,7 @@ struct HfTaskBsReduced { CandsDmes const&) { auto ptCandBs = candidate.pt(); - auto invMassBs = hfHelper.invMassBsToDsPi(candidate); + auto invMassBs = HfHelper::invMassBsToDsPi(candidate); auto candDs = candidate.template prong0_as(); auto ptDs = candidate.ptProng0(); auto invMassDs = candDs.invMassHypo0() > 0 ? candDs.invMassHypo0() : candDs.invMassHypo1(); @@ -440,7 +438,7 @@ struct HfTaskBsReduced { registry.fill(HIST("hCospRecSig"), ptCandBs, candidate.cpa()); registry.fill(HIST("hCospXyRecSig"), ptCandBs, candidate.cpaXY()); registry.fill(HIST("hEtaRecSig"), ptCandBs, candidate.eta()); - registry.fill(HIST("hRapidityRecSig"), ptCandBs, hfHelper.yBs(candidate)); + registry.fill(HIST("hRapidityRecSig"), ptCandBs, HfHelper::yBs(candidate)); registry.fill(HIST("hInvMassDRecSig"), ptDs, invMassDs); registry.fill(HIST("hDecLengthDRecSig"), ptDs, decLenDs); registry.fill(HIST("hDecLengthXyDRecSig"), ptDs, decLenXyDs); @@ -470,7 +468,7 @@ struct HfTaskBsReduced { registry.fill(HIST("hCospRecBg"), ptCandBs, candidate.cpa()); registry.fill(HIST("hCospXyRecBg"), ptCandBs, candidate.cpaXY()); registry.fill(HIST("hEtaRecBg"), ptCandBs, candidate.eta()); - registry.fill(HIST("hRapidityRecBg"), ptCandBs, hfHelper.yBs(candidate)); + registry.fill(HIST("hRapidityRecBg"), ptCandBs, HfHelper::yBs(candidate)); registry.fill(HIST("hInvMassDRecBg"), ptDs, invMassDs); registry.fill(HIST("hDecLengthDRecBg"), ptDs, decLenDs); registry.fill(HIST("hDecLengthXyDRecBg"), ptDs, decLenXyDs); @@ -504,7 +502,7 @@ struct HfTaskBsReduced { registry.fill(HIST("hCosp"), ptCandBs, candidate.cpa()); registry.fill(HIST("hCospXy"), ptCandBs, candidate.cpaXY()); registry.fill(HIST("hEta"), ptCandBs, candidate.eta()); - registry.fill(HIST("hRapidity"), ptCandBs, hfHelper.yBs(candidate)); + registry.fill(HIST("hRapidity"), ptCandBs, HfHelper::yBs(candidate)); registry.fill(HIST("hInvMassD"), ptDs, invMassDs); registry.fill(HIST("hDecLengthD"), ptDs, decLenDs); registry.fill(HIST("hDecLengthXyD"), ptDs, decLenXyDs); @@ -572,7 +570,7 @@ struct HfTaskBsReduced { ptCandBs, candidate.eta(), candidate.phi(), - hfHelper.yBs(candidate), + HfHelper::yBs(candidate), candidate.cpa(), candidate.cpaXY(), candidate.chi2PCA(), @@ -695,7 +693,7 @@ struct HfTaskBsReduced { TracksPion const&) { for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBs(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD); @@ -708,7 +706,7 @@ struct HfTaskBsReduced { TracksPion const&) { for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBs(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD); @@ -721,7 +719,7 @@ struct HfTaskBsReduced { TracksPion const&) { for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBs(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD); @@ -736,7 +734,7 @@ struct HfTaskBsReduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBs(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD); @@ -756,7 +754,7 @@ struct HfTaskBsReduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBs(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD); @@ -776,7 +774,7 @@ struct HfTaskBsReduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBs(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD); @@ -796,7 +794,7 @@ struct HfTaskBsReduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBs(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD); @@ -816,7 +814,7 @@ struct HfTaskBsReduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBs(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD); @@ -836,7 +834,7 @@ struct HfTaskBsReduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBs(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesD); diff --git a/PWGHF/D2H/Tasks/taskBsToJpsiPhiReduced.cxx b/PWGHF/D2H/Tasks/taskBsToJpsiPhiReduced.cxx index d8d977a29bf..2ff8dbe84e2 100644 --- a/PWGHF/D2H/Tasks/taskBsToJpsiPhiReduced.cxx +++ b/PWGHF/D2H/Tasks/taskBsToJpsiPhiReduced.cxx @@ -261,7 +261,6 @@ struct HfTaskBsToJpsiPhiReduced { Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"}; Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; - HfHelper hfHelper; TrackSelectorKa selectorKaon; o2::analysis::HfMlResponseBsToJpsiPhiReduced hfMlResponse; o2::ccdb::CcdbApi ccdbApi; @@ -372,7 +371,7 @@ struct HfTaskBsToJpsiPhiReduced { aod::HfRedBach1Tracks const&) { auto ptCandBs = candidate.pt(); - auto invMassBs = hfHelper.invMassBsToJpsiPhi(candidate); + auto invMassBs = HfHelper::invMassBsToJpsiPhi(candidate); auto candJpsi = candidate.template jpsi_as(); auto candKa0 = candidate.template prong0Phi_as(); auto candKa1 = candidate.template prong1Phi_as(); @@ -394,7 +393,7 @@ struct HfTaskBsToJpsiPhiReduced { } SETBIT(statusBs, SelectionStep::RecoSkims); - if (hfHelper.selectionBsToJpsiPhiTopol(candidate, candKa0, candKa1, cuts, binsPt)) { + if (HfHelper::selectionBsToJpsiPhiTopol(candidate, candKa0, candKa1, cuts, binsPt)) { SETBIT(statusBs, SelectionStep::RecoTopol); } else if (selectionFlagBs >= BIT(SelectionStep::RecoTopol) * 2 - 1) { return; @@ -411,8 +410,8 @@ struct HfTaskBsToJpsiPhiReduced { pidTrackKa0 = selectorKaon.statusTpcAndTof(candKa0); pidTrackKa1 = selectorKaon.statusTpcAndTof(candKa1); } - if (hfHelper.selectionBsToJpsiPhiPid(pidTrackKa0, acceptPIDNotApplicable.value) && - hfHelper.selectionBsToJpsiPhiPid(pidTrackKa1, acceptPIDNotApplicable.value)) { + if (HfHelper::selectionBsToJpsiPhiPid(pidTrackKa0, acceptPIDNotApplicable.value) && + HfHelper::selectionBsToJpsiPhiPid(pidTrackKa1, acceptPIDNotApplicable.value)) { // LOGF(info, "Bs candidate selection failed at PID selection"); SETBIT(statusBs, SelectionStep::RecoPID); } else if (selectionFlagBs >= BIT(SelectionStep::RecoPID) * 2 - 1) { @@ -461,7 +460,7 @@ struct HfTaskBsToJpsiPhiReduced { ptCandBs, candidate.eta(), candidate.phi(), - hfHelper.yBs(candidate), + HfHelper::yBs(candidate), candidate.cpa(), candidate.cpaXY(), candidate.chi2PCA(), @@ -550,7 +549,7 @@ struct HfTaskBsToJpsiPhiReduced { aod::HfRedBach1Tracks const& kaon1Tracks) { for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBs(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesJpsi, kaon0Tracks, kaon1Tracks); @@ -564,7 +563,7 @@ struct HfTaskBsToJpsiPhiReduced { aod::HfRedBach1Tracks const& kaon1Tracks) { for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBs(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesJpsi, kaon0Tracks, kaon1Tracks); @@ -580,7 +579,7 @@ struct HfTaskBsToJpsiPhiReduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBs(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesJpsi, kaon0Tracks, kaon1Tracks); @@ -601,7 +600,7 @@ struct HfTaskBsToJpsiPhiReduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yBs(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesJpsi, kaon0Tracks, kaon1Tracks); diff --git a/PWGHF/D2H/Tasks/taskCd.cxx b/PWGHF/D2H/Tasks/taskCd.cxx index c9590739f5d..0e43e6dd990 100644 --- a/PWGHF/D2H/Tasks/taskCd.cxx +++ b/PWGHF/D2H/Tasks/taskCd.cxx @@ -57,7 +57,6 @@ struct HfTaskCd { Configurable> binsPt{"binsPt", std::vector{hf_cuts_cd_to_de_k_pi::vecBinsPt}, "pT bin limits"}; Configurable fillTHn{"fillTHn", false, "fill THn"}; - HfHelper hfHelper; SliceCache cache; using CollisionsWEvSel = soa::Join; @@ -181,14 +180,14 @@ struct HfTaskCd { const auto cpaXY = candidate.cpaXY(); if (candidate.isSelCdToDeKPi() >= selectionFlagCd) { - registry.fill(HIST("Data/hMass"), hfHelper.invMassCdToDeKPi(candidate)); - registry.fill(HIST("Data/hMassVsPtVsNPvContributors"), hfHelper.invMassCdToDeKPi(candidate), pt, numPvContributors); - registry.fill(HIST("Data/hMassVsPt"), hfHelper.invMassCdToDeKPi(candidate), pt); + registry.fill(HIST("Data/hMass"), HfHelper::invMassCdToDeKPi(candidate)); + registry.fill(HIST("Data/hMassVsPtVsNPvContributors"), HfHelper::invMassCdToDeKPi(candidate), pt, numPvContributors); + registry.fill(HIST("Data/hMassVsPt"), HfHelper::invMassCdToDeKPi(candidate), pt); } if (candidate.isSelCdToPiKDe() >= selectionFlagCd) { - registry.fill(HIST("Data/hMass"), hfHelper.invMassCdToPiKDe(candidate)); - registry.fill(HIST("Data/hMassVsPtVsNPvContributors"), hfHelper.invMassCdToPiKDe(candidate), pt, numPvContributors); - registry.fill(HIST("Data/hMassVsPt"), hfHelper.invMassCdToPiKDe(candidate), pt); + registry.fill(HIST("Data/hMass"), HfHelper::invMassCdToPiKDe(candidate)); + registry.fill(HIST("Data/hMassVsPtVsNPvContributors"), HfHelper::invMassCdToPiKDe(candidate), pt, numPvContributors); + registry.fill(HIST("Data/hMassVsPt"), HfHelper::invMassCdToPiKDe(candidate), pt); } registry.fill(HIST("Data/hPt"), pt); registry.fill(HIST("Data/hPtProng0"), ptProng0); @@ -224,12 +223,12 @@ struct HfTaskCd { float const cent = o2::hf_centrality::getCentralityColl(collision); double massCd(-1); if (candidate.isSelCdToDeKPi() >= selectionFlagCd) { - massCd = hfHelper.invMassCdToDeKPi(candidate); + massCd = HfHelper::invMassCdToDeKPi(candidate); std::vector valuesToFill{massCd, pt, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, cent}; registry.get(HIST("hnCdVars"))->Fill(valuesToFill.data()); } if (candidate.isSelCdToPiKDe() >= selectionFlagCd) { - massCd = hfHelper.invMassCdToPiKDe(candidate); + massCd = HfHelper::invMassCdToPiKDe(candidate); std::vector valuesToFill{massCd, pt, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, cent}; registry.get(HIST("hnCdVars"))->Fill(valuesToFill.data()); } diff --git a/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx b/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx index 85168f089b5..0795d6361a2 100644 --- a/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx +++ b/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx @@ -213,7 +213,6 @@ struct HfTaskCharmPolarisation { /// Application of rapidity cut for reconstructed candidates Configurable rapidityCut{"rapidityCut", 999.f, "Max. value of reconstructed candidate rapidity (abs. value)"}; - HfHelper hfHelper; SliceCache cache; EventPlaneHelper epHelper; @@ -1680,8 +1679,8 @@ struct HfTaskCharmPolarisation { invMassCharmHadForSparse = invMassCharmHad; } else { /// original candidate (kaon track not rotated) - invMassCharmHad = hfHelper.invMassLcToPKPi(candidate); - invMassCharmHadForSparse = hfHelper.invMassLcToPKPi(candidate); + invMassCharmHad = HfHelper::invMassLcToPKPi(candidate); + invMassCharmHadForSparse = HfHelper::invMassLcToPKPi(candidate); } if constexpr (WithMl) { if (candidate.mlProbLcToPKPi().size() == NScores) { @@ -1694,14 +1693,14 @@ struct HfTaskCharmPolarisation { } } // invariant mass of the KPi pair - invMassKPiLc = hfHelper.invMassKPiPairLcToPKPi(candidate); - invMassPKLc = hfHelper.invMassPKPairLcToPKPi(candidate); - invMassPPiLc = hfHelper.invMassPPiPairLcToPKPi(candidate); + invMassKPiLc = HfHelper::invMassKPiPairLcToPKPi(candidate); + invMassPKLc = HfHelper::invMassPKPairLcToPKPi(candidate); + invMassPPiLc = HfHelper::invMassPPiPairLcToPKPi(candidate); // D+ and Ds+ invariant mass values, to put a veto on background sources - invMassPiKPi = hfHelper.invMassDplusToPiKPi(candidate); // bkg. from D+ -> K+pi-pi- - invMassKKPi = hfHelper.invMassDsToKKPi(candidate); // bkg. from D+, Ds+ -> K+K-pi+ (1st mass hypothesis) - invMassPiKK = hfHelper.invMassDsToPiKK(candidate); // bkg. from D+, Ds+ -> pi+K-K+ (2nd mass hypothesis) + invMassPiKPi = HfHelper::invMassDplusToPiKPi(candidate); // bkg. from D+ -> K+pi-pi- + invMassKKPi = HfHelper::invMassDsToKKPi(candidate); // bkg. from D+, Ds+ -> K+K-pi+ (1st mass hypothesis) + invMassPiKK = HfHelper::invMassDsToPiKK(candidate); // bkg. from D+, Ds+ -> pi+K-K+ (2nd mass hypothesis) } else if (iMass == charm_polarisation::MassHyposLcToPKPi::PiKP && candidate.isSelLcToPiKP() >= selectionFlagLcToPKPi) { // reconstructed as piKp @@ -1714,8 +1713,8 @@ struct HfTaskCharmPolarisation { invMassCharmHadForSparse = invMassCharmHad; } else { /// original candidate (kaon track not rotated) - invMassCharmHad = hfHelper.invMassLcToPiKP(candidate); - invMassCharmHadForSparse = hfHelper.invMassLcToPiKP(candidate); + invMassCharmHad = HfHelper::invMassLcToPiKP(candidate); + invMassCharmHadForSparse = HfHelper::invMassLcToPiKP(candidate); } if constexpr (WithMl) { if (candidate.mlProbLcToPiKP().size() == NScores) { @@ -1728,14 +1727,14 @@ struct HfTaskCharmPolarisation { } } // invariant mass of the KPi pair - invMassKPiLc = hfHelper.invMassKPiPairLcToPiKP(candidate); - invMassPKLc = hfHelper.invMassPKPairLcToPiKP(candidate); - invMassPPiLc = hfHelper.invMassPPiPairLcToPiKP(candidate); + invMassKPiLc = HfHelper::invMassKPiPairLcToPiKP(candidate); + invMassPKLc = HfHelper::invMassPKPairLcToPiKP(candidate); + invMassPPiLc = HfHelper::invMassPPiPairLcToPiKP(candidate); // D+ and Ds+ invariant mass values, to put a veto on background sources - invMassPiKPi = hfHelper.invMassDplusToPiKPi(candidate); // bkg. from D+ -> K+pi-pi- - invMassKKPi = hfHelper.invMassDsToKKPi(candidate); // bkg. from D+, Ds+ -> K+K-pi+ (1st mass hypothesis) - invMassPiKK = hfHelper.invMassDsToPiKK(candidate); // bkg. from D+, Ds+ -> pi+K-K+ (2nd mass hypothesis) + invMassPiKPi = HfHelper::invMassDplusToPiKPi(candidate); // bkg. from D+ -> K+pi-pi- + invMassKKPi = HfHelper::invMassDsToKKPi(candidate); // bkg. from D+, Ds+ -> K+K-pi+ (1st mass hypothesis) + invMassPiKK = HfHelper::invMassDsToPiKK(candidate); // bkg. from D+, Ds+ -> pi+K-K+ (2nd mass hypothesis) } else { // NB: no need to check cases in which candidate.isSelLcToPKPi() and candidate.isSelLcToPiKP() are both false, because they are rejected already by the Filter diff --git a/PWGHF/D2H/Tasks/taskD0.cxx b/PWGHF/D2H/Tasks/taskD0.cxx index c583b302dff..3f74a0b4efa 100644 --- a/PWGHF/D2H/Tasks/taskD0.cxx +++ b/PWGHF/D2H/Tasks/taskD0.cxx @@ -91,7 +91,6 @@ struct HfTaskD0 { Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable irSource{"irSource", "ZNC hadronic", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"}; - HfHelper hfHelper; ctpRateFetcher mRateFetcher; SliceCache cache; @@ -349,7 +348,7 @@ struct HfTaskD0 { if (!(candidate.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { continue; } - if (yCandRecoMax >= 0. && std::abs(hfHelper.yD0(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yD0(candidate)) > yCandRecoMax) { continue; } @@ -358,8 +357,8 @@ struct HfTaskD0 { massD0 = candidate.kfGeoMassD0(); massD0bar = candidate.kfGeoMassD0bar(); } else { - massD0 = hfHelper.invMassD0ToPiK(candidate); - massD0bar = hfHelper.invMassD0barToKPi(candidate); + massD0 = HfHelper::invMassD0ToPiK(candidate); + massD0bar = HfHelper::invMassD0barToKPi(candidate); } auto ptCandidate = candidate.pt(); @@ -387,8 +386,8 @@ struct HfTaskD0 { registry.fill(HIST("hd0ErrProng0"), candidate.errorImpactParameter0(), ptCandidate); registry.fill(HIST("hd0ErrProng1"), candidate.errorImpactParameter1(), ptCandidate); registry.fill(HIST("hd0d0"), candidate.impactParameterProduct(), ptCandidate); - registry.fill(HIST("hCTS"), hfHelper.cosThetaStarD0(candidate), ptCandidate); - registry.fill(HIST("hCt"), hfHelper.ctD0(candidate), ptCandidate); + registry.fill(HIST("hCTS"), HfHelper::cosThetaStarD0(candidate), ptCandidate); + registry.fill(HIST("hCt"), HfHelper::ctD0(candidate), ptCandidate); registry.fill(HIST("hCPA"), candidate.cpa(), ptCandidate); registry.fill(HIST("hEta"), candidate.eta(), ptCandidate); registry.fill(HIST("hSelectionStatus"), candidate.isSelD0() + (candidate.isSelD0bar() * 2), ptCandidate); @@ -397,8 +396,8 @@ struct HfTaskD0 { registry.fill(HIST("hd0Prong0FinerBinning"), candidate.impactParameter0(), ptCandidate); registry.fill(HIST("hd0Prong1FinerBinning"), candidate.impactParameter1(), ptCandidate); registry.fill(HIST("hd0d0FinerBinning"), candidate.impactParameterProduct(), ptCandidate); - registry.fill(HIST("hCTSFinerBinning"), hfHelper.cosThetaStarD0(candidate), ptCandidate); - registry.fill(HIST("hCtFinerBinning"), hfHelper.ctD0(candidate), ptCandidate); + registry.fill(HIST("hCTSFinerBinning"), HfHelper::cosThetaStarD0(candidate), ptCandidate); + registry.fill(HIST("hCtFinerBinning"), HfHelper::ctD0(candidate), ptCandidate); registry.fill(HIST("hCPAFinerBinning"), candidate.cpa(), ptCandidate); registry.fill(HIST("hCPAXYFinerBinning"), candidate.cpaXY(), ptCandidate); @@ -424,95 +423,95 @@ struct HfTaskD0 { if constexpr (ApplyMl) { if (storeCentrality && storeOccupancyAndIR) { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent, occ, ir); - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent, occ, ir); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, HfHelper::yD0(candidate), SigD0, cent, occ, ir); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, HfHelper::yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent, occ, ir); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent, occ, ir); - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent, occ, ir); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, HfHelper::yD0(candidate), SigD0bar, cent, occ, ir); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, HfHelper::yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent, occ, ir); } } else if (storeCentrality && !storeOccupancyAndIR) { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent); - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, HfHelper::yD0(candidate), SigD0, cent); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, HfHelper::yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent); - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, HfHelper::yD0(candidate), SigD0bar, cent); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, HfHelper::yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent); } } else if (!storeCentrality && storeOccupancyAndIR) { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, occ, ir); - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, occ, ir); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, HfHelper::yD0(candidate), SigD0, occ, ir); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, HfHelper::yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, occ, ir); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, occ, ir); - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, occ, ir); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, HfHelper::yD0(candidate), SigD0bar, occ, ir); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, HfHelper::yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, occ, ir); } } else if (storeTrackQuality) { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, minItsClustersOfProngs, minTpcCrossedRowsOfProngs); - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, minItsClustersOfProngs, minTpcCrossedRowsOfProngs); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, HfHelper::yD0(candidate), SigD0, minItsClustersOfProngs, minTpcCrossedRowsOfProngs); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, HfHelper::yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, minItsClustersOfProngs, minTpcCrossedRowsOfProngs); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, minItsClustersOfProngs, minTpcCrossedRowsOfProngs); - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, minItsClustersOfProngs, minTpcCrossedRowsOfProngs); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, HfHelper::yD0(candidate), SigD0bar, minItsClustersOfProngs, minTpcCrossedRowsOfProngs); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, HfHelper::yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, minItsClustersOfProngs, minTpcCrossedRowsOfProngs); } } else { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0); - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, HfHelper::yD0(candidate), SigD0); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, HfHelper::yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar); - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, HfHelper::yD0(candidate), SigD0bar); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, HfHelper::yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar); } } } else { if (storeCentrality && storeOccupancyAndIR) { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent, occ, ir); - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent, occ, ir); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, HfHelper::yD0(candidate), SigD0, cent, occ, ir); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, HfHelper::yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent, occ, ir); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent, occ, ir); - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent, occ, ir); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, HfHelper::yD0(candidate), SigD0bar, cent, occ, ir); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, HfHelper::yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent, occ, ir); } } else if (storeCentrality && !storeOccupancyAndIR) { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent); - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, HfHelper::yD0(candidate), SigD0, cent); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, HfHelper::yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent); - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, HfHelper::yD0(candidate), SigD0bar, cent); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, HfHelper::yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent); } } else if (!storeCentrality && storeOccupancyAndIR) { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, occ, ir); - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, occ, ir); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, HfHelper::yD0(candidate), SigD0, occ, ir); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, HfHelper::yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, occ, ir); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, occ, ir); - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, occ, ir); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, HfHelper::yD0(candidate), SigD0bar, occ, ir); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, HfHelper::yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, occ, ir); } } else if (storeTrackQuality) { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, minItsClustersOfProngs, minTpcCrossedRowsOfProngs); - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, minItsClustersOfProngs, minTpcCrossedRowsOfProngs); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, HfHelper::yD0(candidate), SigD0, minItsClustersOfProngs, minTpcCrossedRowsOfProngs); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, HfHelper::yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, minItsClustersOfProngs, minTpcCrossedRowsOfProngs); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar); - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, HfHelper::yD0(candidate), SigD0bar); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, HfHelper::yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar); } } else { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0); - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, HfHelper::yD0(candidate), SigD0); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, HfHelper::yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar); - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, HfHelper::yD0(candidate), SigD0bar); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, HfHelper::yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar); } } } @@ -569,7 +568,7 @@ struct HfTaskD0 { if (!(candidate.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { continue; } - if (yCandRecoMax >= 0. && std::abs(hfHelper.yD0(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yD0(candidate)) > yCandRecoMax) { continue; } @@ -591,8 +590,8 @@ struct HfTaskD0 { massD0 = candidate.kfGeoMassD0(); massD0bar = candidate.kfGeoMassD0bar(); } else { - massD0 = hfHelper.invMassD0ToPiK(candidate); - massD0bar = hfHelper.invMassD0barToKPi(candidate); + massD0 = HfHelper::invMassD0ToPiK(candidate); + massD0bar = HfHelper::invMassD0barToKPi(candidate); } auto trackPos = candidate.template prong0_as(); // positive daughter auto trackNeg = candidate.template prong1_as(); // negative daughter @@ -604,7 +603,7 @@ struct HfTaskD0 { auto yGen = RecoDecay::y(particleMother.pVector(), o2::constants::physics::MassD0); // gen. level y registry.fill(HIST("hPtGenSig"), ptGen); // gen. level pT auto ptRec = candidate.pt(); - auto yRec = hfHelper.yD0(candidate); + auto yRec = HfHelper::yD0(candidate); if (candidate.isRecoHfFlag() >= selectionFlagHf) { registry.fill(HIST("hPtVsYRecSigRecoHFFlag"), ptRec, yRec); registry.fill(HIST("hPtGenVsPtRecSig"), ptGen, ptRec); @@ -674,7 +673,7 @@ struct HfTaskD0 { auto ptCandidate = candidate.pt(); auto ptProng0 = candidate.ptProng0(); auto ptProng1 = candidate.ptProng1(); - auto rapidityCandidate = hfHelper.yD0(candidate); + auto rapidityCandidate = HfHelper::yD0(candidate); auto declengthCandidate = candidate.decayLength(); auto declengthxyCandidate = candidate.decayLengthXY(); auto normaliseddeclengthCandidate = candidate.decayLengthNormalised(); @@ -682,8 +681,8 @@ struct HfTaskD0 { auto d0Prong0 = candidate.impactParameter0(); auto d0Prong1 = candidate.impactParameter1(); auto d0d0Candidate = candidate.impactParameterProduct(); - auto ctsCandidate = hfHelper.cosThetaStarD0(candidate); - auto ctCandidate = hfHelper.ctD0(candidate); + auto ctsCandidate = HfHelper::cosThetaStarD0(candidate); + auto ctCandidate = HfHelper::ctD0(candidate); auto cpaCandidate = candidate.cpa(); auto cpaxyCandidate = candidate.cpaXY(); int const minItsClustersOfProngs = std::min(trackPos.itsNCls(), trackNeg.itsNCls()); diff --git a/PWGHF/D2H/Tasks/taskDirectedFlowCharmHadrons.cxx b/PWGHF/D2H/Tasks/taskDirectedFlowCharmHadrons.cxx index 417c03ab8a6..4826a11ded2 100644 --- a/PWGHF/D2H/Tasks/taskDirectedFlowCharmHadrons.cxx +++ b/PWGHF/D2H/Tasks/taskDirectedFlowCharmHadrons.cxx @@ -71,7 +71,6 @@ struct HfTaskDirectedFlowCharmHadrons { Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable> classMl{"classMl", {0, 2}, "Indices of BDT scores to be stored. Two indexes max."}; - HfHelper hfHelper; EventPlaneHelper epHelper; SliceCache cache; HfEventSelection hfEvSel; // event selection and monitoring @@ -253,8 +252,8 @@ struct HfTaskDirectedFlowCharmHadrons { double signDstarCand = 0.0; std::vector outputMl = {-999., -999.}; if constexpr (std::is_same_v || std::is_same_v) { - massCand = hfHelper.invMassDplusToPiKPi(candidate); - rapCand = hfHelper.yDplus(candidate); + massCand = HfHelper::invMassDplusToPiKPi(candidate); + rapCand = HfHelper::yDplus(candidate); auto trackprong0 = candidate.template prong0_as(); sign = trackprong0.sign(); if constexpr (std::is_same_v) { @@ -265,8 +264,8 @@ struct HfTaskDirectedFlowCharmHadrons { } else if constexpr (std::is_same_v || std::is_same_v) { switch (Channel) { case DecayChannel::D0ToPiK: - massCand = hfHelper.invMassD0ToPiK(candidate); - rapCand = hfHelper.yD0(candidate); + massCand = HfHelper::invMassD0ToPiK(candidate); + rapCand = HfHelper::yD0(candidate); sign = candidate.isSelD0bar() ? 3 : 1; // 3: reflected D0bar, 1: pure D0 excluding reflected D0bar if constexpr (std::is_same_v) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { @@ -275,8 +274,8 @@ struct HfTaskDirectedFlowCharmHadrons { } break; case DecayChannel::D0ToKPi: - massCand = hfHelper.invMassD0barToKPi(candidate); - rapCand = hfHelper.yD0(candidate); + massCand = HfHelper::invMassD0barToKPi(candidate); + rapCand = HfHelper::yD0(candidate); sign = candidate.isSelD0() ? 3 : 2; // 3: reflected D0, 2: pure D0bar excluding reflected D0 if constexpr (std::is_same_v) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { diff --git a/PWGHF/D2H/Tasks/taskDplus.cxx b/PWGHF/D2H/Tasks/taskDplus.cxx index e3885fdceb2..5948f00d1f1 100644 --- a/PWGHF/D2H/Tasks/taskDplus.cxx +++ b/PWGHF/D2H/Tasks/taskDplus.cxx @@ -74,8 +74,6 @@ struct HfTaskDplus { Configurable storePvContributors{"storePvContributors", false, "Flag to store number of PV contributors information"}; Configurable fillMcBkgHistos{"fillMcBkgHistos", false, "Flag to fill and store histograms for MC background"}; - HfHelper hfHelper; - using CandDplusData = soa::Filtered>; using CandDplusDataWithMl = soa::Filtered>; using CandDplusMcReco = soa::Filtered>; @@ -249,10 +247,10 @@ struct HfTaskDplus { void fillHisto(const T1& candidate) { float const pt = candidate.pt(); - registry.fill(HIST("hMass"), hfHelper.invMassDplusToPiKPi(candidate), pt); + registry.fill(HIST("hMass"), HfHelper::invMassDplusToPiKPi(candidate), pt); registry.fill(HIST("hPt"), pt); registry.fill(HIST("hEta"), candidate.eta(), pt); - registry.fill(HIST("hCt"), hfHelper.ctDplus(candidate), pt); + registry.fill(HIST("hCt"), HfHelper::ctDplus(candidate), pt); registry.fill(HIST("hDecayLength"), candidate.decayLength(), pt); registry.fill(HIST("hDecayLengthXY"), candidate.decayLengthXY(), pt); registry.fill(HIST("hNormalisedDecayLengthXY"), candidate.decayLengthXYNormalised(), pt); @@ -298,70 +296,70 @@ struct HfTaskDplus { if (candidate.originMcRec() == RecoDecay::OriginType::Prompt) { // Prompt if (storeCentrality && storeOccupancy) { - registry.fill(HIST("hSparseMassPrompt"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality, occupancy); + registry.fill(HIST("hSparseMassPrompt"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality, occupancy); } else if (storeCentrality && !storeOccupancy) { - registry.fill(HIST("hSparseMassPrompt"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality); + registry.fill(HIST("hSparseMassPrompt"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality); } else if (!storeCentrality && storeOccupancy) { - registry.fill(HIST("hSparseMassPrompt"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], occupancy); + registry.fill(HIST("hSparseMassPrompt"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], occupancy); } else if (!storeCentrality && !storeOccupancy && storePvContributors) { - registry.fill(HIST("hSparseMassPrompt"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], numPvContributors); + registry.fill(HIST("hSparseMassPrompt"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], numPvContributors); } else { - registry.fill(HIST("hSparseMassPrompt"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2]); + registry.fill(HIST("hSparseMassPrompt"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2]); } } else if (candidate.originMcRec() == RecoDecay::OriginType::NonPrompt) { // FD if (storeCentrality && storeOccupancy) { - registry.fill(HIST("hSparseMassFD"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality, occupancy, ptbhad, flagBHad); + registry.fill(HIST("hSparseMassFD"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality, occupancy, ptbhad, flagBHad); } else if (storeCentrality && !storeOccupancy) { - registry.fill(HIST("hSparseMassFD"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality, ptbhad, flagBHad); + registry.fill(HIST("hSparseMassFD"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality, ptbhad, flagBHad); } else if (!storeCentrality && storeOccupancy) { - registry.fill(HIST("hSparseMassFD"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], occupancy, ptbhad, flagBHad); + registry.fill(HIST("hSparseMassFD"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], occupancy, ptbhad, flagBHad); } else if (!storeCentrality && !storeOccupancy && storePvContributors) { - registry.fill(HIST("hSparseMassFD"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], numPvContributors, ptbhad, flagBHad); + registry.fill(HIST("hSparseMassFD"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], numPvContributors, ptbhad, flagBHad); } else { - registry.fill(HIST("hSparseMassFD"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], ptbhad, flagBHad); + registry.fill(HIST("hSparseMassFD"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], ptbhad, flagBHad); } } else { // Bkg if (fillMcBkgHistos) { if (storeCentrality && storeOccupancy) { - registry.fill(HIST("hSparseMassBkg"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality, occupancy); + registry.fill(HIST("hSparseMassBkg"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality, occupancy); } else if (storeCentrality && !storeOccupancy) { - registry.fill(HIST("hSparseMassBkg"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality); + registry.fill(HIST("hSparseMassBkg"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality); } else if (!storeCentrality && storeOccupancy) { - registry.fill(HIST("hSparseMassBkg"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], occupancy); + registry.fill(HIST("hSparseMassBkg"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], occupancy); } else if (!storeCentrality && !storeOccupancy && storePvContributors) { - registry.fill(HIST("hSparseMassBkg"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], numPvContributors); + registry.fill(HIST("hSparseMassBkg"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], numPvContributors); } else { - registry.fill(HIST("hSparseMassBkg"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2]); + registry.fill(HIST("hSparseMassBkg"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2]); } } } } else { if (storeCentrality && storeOccupancy) { - registry.fill(HIST("hSparseMassNotMatched"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality, occupancy); + registry.fill(HIST("hSparseMassNotMatched"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality, occupancy); } else if (storeCentrality && !storeOccupancy) { - registry.fill(HIST("hSparseMassNotMatched"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality); + registry.fill(HIST("hSparseMassNotMatched"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality); } else if (!storeCentrality && storeOccupancy) { - registry.fill(HIST("hSparseMassNotMatched"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], occupancy); + registry.fill(HIST("hSparseMassNotMatched"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], occupancy); } else if (!storeCentrality && !storeOccupancy && storePvContributors) { - registry.fill(HIST("hSparseMassNotMatched"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], numPvContributors); + registry.fill(HIST("hSparseMassNotMatched"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], numPvContributors); } else { - registry.fill(HIST("hSparseMassNotMatched"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2]); + registry.fill(HIST("hSparseMassNotMatched"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2]); } } } else { // Data if (storeCentrality && storeOccupancy) { - registry.fill(HIST("hSparseMass"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality, occupancy); + registry.fill(HIST("hSparseMass"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality, occupancy); } else if (storeCentrality && !storeOccupancy) { - registry.fill(HIST("hSparseMass"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality); + registry.fill(HIST("hSparseMass"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality); } else if (!storeCentrality && storeOccupancy) { - registry.fill(HIST("hSparseMass"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], occupancy); + registry.fill(HIST("hSparseMass"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], occupancy); } else if (!storeCentrality && !storeOccupancy && storePvContributors) { - registry.fill(HIST("hSparseMass"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], numPvContributors); + registry.fill(HIST("hSparseMass"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], numPvContributors); } else { - registry.fill(HIST("hSparseMass"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2]); + registry.fill(HIST("hSparseMass"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2]); } } } @@ -373,7 +371,7 @@ struct HfTaskDplus { { if constexpr (IsMatched) { auto ptRec = candidate.pt(); - auto yRec = hfHelper.yDplus(candidate); + auto yRec = HfHelper::yDplus(candidate); registry.fill(HIST("hPtVsYRecSig_RecoSkim"), ptRec, yRec); if (TESTBIT(candidate.isSelDplusToPiKPi(), aod::SelectionStep::RecoTopol)) { registry.fill(HIST("hPtVsYRecSigRecoTopol"), ptRec, yRec); @@ -490,14 +488,14 @@ struct HfTaskDplus { int const flagBHad{-1}; if constexpr (!FillMl) { for (const auto& candidate : selectedDPlusCandidates) { - if ((yCandRecoMax >= 0. && std::abs(hfHelper.yDplus(candidate)) > yCandRecoMax)) { + if ((yCandRecoMax >= 0. && std::abs(HfHelper::yDplus(candidate)) > yCandRecoMax)) { continue; } fillHisto(candidate); } } else { for (const auto& candidate : selectedDPlusCandidatesWithMl) { - if ((yCandRecoMax >= 0. && std::abs(hfHelper.yDplus(candidate)) > yCandRecoMax)) { + if ((yCandRecoMax >= 0. && std::abs(HfHelper::yDplus(candidate)) > yCandRecoMax)) { continue; } @@ -535,7 +533,7 @@ struct HfTaskDplus { // MC rec. w/o Ml if constexpr (!FillMl) { for (const auto& candidate : recoDPlusCandidates) { - if ((yCandRecoMax >= 0. && std::abs(hfHelper.yDplus(candidate)) > yCandRecoMax)) { + if ((yCandRecoMax >= 0. && std::abs(HfHelper::yDplus(candidate)) > yCandRecoMax)) { continue; } fillHisto(candidate); @@ -544,7 +542,7 @@ struct HfTaskDplus { // Bkg if (fillMcBkgHistos) { for (const auto& candidate : recoBkgCandidates) { - if ((yCandRecoMax >= 0. && std::abs(hfHelper.yDplus(candidate)) > yCandRecoMax)) { + if ((yCandRecoMax >= 0. && std::abs(HfHelper::yDplus(candidate)) > yCandRecoMax)) { continue; } fillHistoMCRec(candidate); @@ -552,7 +550,7 @@ struct HfTaskDplus { } } else { for (const auto& candidate : recoDPlusCandidatesWithMl) { - if ((yCandRecoMax >= 0. && std::abs(hfHelper.yDplus(candidate)) > yCandRecoMax)) { + if ((yCandRecoMax >= 0. && std::abs(HfHelper::yDplus(candidate)) > yCandRecoMax)) { continue; } ptBhad = candidate.ptBhadMotherPart(); @@ -578,7 +576,7 @@ struct HfTaskDplus { flagBHad = -1; if (fillMcBkgHistos) { for (const auto& candidate : recoBkgCandidatesWithMl) { - if ((yCandRecoMax >= 0. && std::abs(hfHelper.yDplus(candidate)) > yCandRecoMax)) { + if ((yCandRecoMax >= 0. && std::abs(HfHelper::yDplus(candidate)) > yCandRecoMax)) { continue; } auto collision = candidate.template collision_as(); diff --git a/PWGHF/D2H/Tasks/taskDs.cxx b/PWGHF/D2H/Tasks/taskDs.cxx index 7c26c349a58..1c991fd802f 100644 --- a/PWGHF/D2H/Tasks/taskDs.cxx +++ b/PWGHF/D2H/Tasks/taskDs.cxx @@ -126,7 +126,6 @@ struct HfTaskDs { Configurable reconstructionPass{"reconstructionPass", "", {"Apass to use when fetching the calibration tables. Empty (default) does not check for any pass. Use `metadata` to fetch it from the AO2D metadata. Otherwise it will override the metadata."}}; } ccdbConfig; - HfHelper hfHelper; SliceCache cache; Service ccdb; @@ -355,7 +354,7 @@ struct HfTaskDs { bool isCandInSignalRegion(const CandDs& candidate, bool isDs) { bool const isKKPi = candidate.isSelDsToKKPi() >= selectionFlagDs; - float const invMass = isKKPi ? hfHelper.invMassDsToKKPi(candidate) : hfHelper.invMassDsToPiKK(candidate); + float const invMass = isKKPi ? HfHelper::invMassDsToKKPi(candidate) : HfHelper::invMassDsToPiKK(candidate); if (isDs && (invMass < massDsSignalMin || invMass > massDsSignalMax)) { return false; } @@ -443,7 +442,7 @@ struct HfTaskDs { std::get(histosPtr[dataType]["hPtProng1"])->Fill(candidate.ptProng1()); std::get(histosPtr[dataType]["hPtProng2"])->Fill(candidate.ptProng2()); std::get(histosPtr[dataType]["hEta"])->Fill(candidate.eta(), pt); - std::get(histosPtr[dataType]["hCt"])->Fill(hfHelper.ctDs(candidate), pt); + std::get(histosPtr[dataType]["hCt"])->Fill(HfHelper::ctDs(candidate), pt); std::get(histosPtr[dataType]["hDecayLength"])->Fill(candidate.decayLength(), pt); std::get(histosPtr[dataType]["hDecayLengthXY"])->Fill(candidate.decayLengthXY(), pt); std::get(histosPtr[dataType]["hNormalisedDecayLengthXY"])->Fill(candidate.decayLengthXYNormalised(), pt); @@ -469,7 +468,7 @@ struct HfTaskDs { template void fillSparse(const Cand& candidate, DataType dataType, FinalState finalState) { - auto mass = finalState == FinalState::KKPi ? hfHelper.invMassDsToKKPi(candidate) : hfHelper.invMassDsToPiKK(candidate); + auto mass = finalState == FinalState::KKPi ? HfHelper::invMassDsToKKPi(candidate) : HfHelper::invMassDsToPiKK(candidate); auto pt = candidate.pt(); auto mlScore = finalState == FinalState::KKPi ? candidate.mlProbDsToKKPi() : candidate.mlProbDsToPiKK(); @@ -514,7 +513,7 @@ struct HfTaskDs { template void fillSparse(const Cand& candidate, DataType dataType, FinalState finalState) { - auto mass = finalState == FinalState::KKPi ? hfHelper.invMassDsToKKPi(candidate) : hfHelper.invMassDsToPiKK(candidate); + auto mass = finalState == FinalState::KKPi ? HfHelper::invMassDsToKKPi(candidate) : HfHelper::invMassDsToPiKK(candidate); auto pt = candidate.pt(); if (dataType == DataType::Data) { // If data do not fill PV contributors in sparse @@ -552,10 +551,10 @@ struct HfTaskDs { auto pt = candidate.pt(); fillSparse(candidate, dataType, FinalState::KKPi); - std::get(histosPtr[dataType]["hCos3PiK"])->Fill(hfHelper.cos3PiKDsToKKPi(candidate), pt); - std::get(histosPtr[dataType]["hAbsCos3PiK"])->Fill(hfHelper.absCos3PiKDsToKKPi(candidate), pt); - std::get(histosPtr[dataType]["hDeltaMassPhi"])->Fill(hfHelper.deltaMassPhiDsToKKPi(candidate), pt); - std::get(histosPtr[dataType]["hMassKK"])->Fill(hfHelper.massKKPairDsToKKPi(candidate), pt); + std::get(histosPtr[dataType]["hCos3PiK"])->Fill(HfHelper::cos3PiKDsToKKPi(candidate), pt); + std::get(histosPtr[dataType]["hAbsCos3PiK"])->Fill(HfHelper::absCos3PiKDsToKKPi(candidate), pt); + std::get(histosPtr[dataType]["hDeltaMassPhi"])->Fill(HfHelper::deltaMassPhiDsToKKPi(candidate), pt); + std::get(histosPtr[dataType]["hMassKK"])->Fill(HfHelper::massKKPairDsToKKPi(candidate), pt); } /// Fill histograms of quantities for the PiKK daugther-mass hypothesis @@ -567,10 +566,10 @@ struct HfTaskDs { auto pt = candidate.pt(); fillSparse(candidate, dataType, FinalState::PiKK); - std::get(histosPtr[dataType]["hCos3PiK"])->Fill(hfHelper.cos3PiKDsToPiKK(candidate), pt); - std::get(histosPtr[dataType]["hAbsCos3PiK"])->Fill(hfHelper.absCos3PiKDsToPiKK(candidate), pt); - std::get(histosPtr[dataType]["hDeltaMassPhi"])->Fill(hfHelper.deltaMassPhiDsToPiKK(candidate), pt); - std::get(histosPtr[dataType]["hMassKK"])->Fill(hfHelper.massKKPairDsToPiKK(candidate), pt); + std::get(histosPtr[dataType]["hCos3PiK"])->Fill(HfHelper::cos3PiKDsToPiKK(candidate), pt); + std::get(histosPtr[dataType]["hAbsCos3PiK"])->Fill(HfHelper::absCos3PiKDsToPiKK(candidate), pt); + std::get(histosPtr[dataType]["hDeltaMassPhi"])->Fill(HfHelper::deltaMassPhiDsToPiKK(candidate), pt); + std::get(histosPtr[dataType]["hMassKK"])->Fill(HfHelper::massKKPairDsToPiKK(candidate), pt); } /// Fill MC histograms at reconstruction level @@ -597,7 +596,7 @@ struct HfTaskDs { auto pt = candidate.pt(); // rec. level pT if (candidate.isSelDsToKKPi() >= selectionFlagDs) { // KKPi - auto yCand = candidate.y(hfHelper.invMassDsToKKPi(candidate)); + auto yCand = candidate.y(HfHelper::invMassDsToKKPi(candidate)); if (yCandRecoMax >= 0. && std::abs(yCand) > yCandRecoMax) { return; } @@ -615,7 +614,7 @@ struct HfTaskDs { } } if (candidate.isSelDsToPiKK() >= selectionFlagDs) { // PiKK - auto yCand = candidate.y(hfHelper.invMassDsToPiKK(candidate)); + auto yCand = candidate.y(HfHelper::invMassDsToPiKK(candidate)); if (yCandRecoMax >= 0. && std::abs(yCand) > yCandRecoMax) { return; } @@ -639,14 +638,14 @@ struct HfTaskDs { void runDataAnalysisPerCandidate(CandDs const& candidate) { if (candidate.isSelDsToKKPi() >= selectionFlagDs) { // KKPi - if (yCandRecoMax >= 0. && std::abs(candidate.y(hfHelper.invMassDsToKKPi(candidate))) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(candidate.y(HfHelper::invMassDsToKKPi(candidate))) > yCandRecoMax) { return; } fillHisto(candidate, DataType::Data); fillHistoKKPi(candidate, DataType::Data); } if (candidate.isSelDsToPiKK() >= selectionFlagDs) { // PiKK - if (yCandRecoMax >= 0. && std::abs(candidate.y(hfHelper.invMassDsToPiKK(candidate))) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(candidate.y(HfHelper::invMassDsToPiKK(candidate))) > yCandRecoMax) { return; } fillHisto(candidate, DataType::Data); @@ -679,14 +678,14 @@ struct HfTaskDs { if (candidate.isSelDsToKKPi() >= selectionFlagDs || candidate.isSelDsToPiKK() >= selectionFlagDs) { if (candidate.isSelDsToKKPi() >= selectionFlagDs) { // KKPi - if (yCandRecoMax >= 0. && std::abs(candidate.y(hfHelper.invMassDsToKKPi(candidate))) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(candidate.y(HfHelper::invMassDsToKKPi(candidate))) > yCandRecoMax) { return; } fillHisto(candidate, DataType::McBkg); fillHistoKKPi(candidate, DataType::McBkg); } if (candidate.isSelDsToPiKK() >= selectionFlagDs) { // PiKK - if (yCandRecoMax >= 0. && std::abs(candidate.y(hfHelper.invMassDsToPiKK(candidate))) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(candidate.y(HfHelper::invMassDsToPiKK(candidate))) > yCandRecoMax) { return; } fillHisto(candidate, DataType::McBkg); diff --git a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx index 4aa872b7e4e..615437bb6b6 100644 --- a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx +++ b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx @@ -118,7 +118,6 @@ struct HfTaskFlowCharmHadrons { Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable> classMl{"classMl", {0, 2}, "Indexes of BDT scores to be stored. Two indexes max."}; - HfHelper hfHelper; EventPlaneHelper epHelper; HfEventSelection hfEvSel; // event selection and monitoring o2::framework::Service ccdb; @@ -567,7 +566,7 @@ struct HfTaskFlowCharmHadrons { if constexpr (std::is_same_v || std::is_same_v) { switch (Channel) { case DecayChannel::DsToKKPi: - massCand = hfHelper.invMassDsToKKPi(candidate); + massCand = HfHelper::invMassDsToKKPi(candidate); if constexpr (std::is_same_v) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDsToKKPi()[classMl->at(iclass)]; @@ -575,7 +574,7 @@ struct HfTaskFlowCharmHadrons { } break; case DecayChannel::DsToPiKK: - massCand = hfHelper.invMassDsToPiKK(candidate); + massCand = HfHelper::invMassDsToPiKK(candidate); if constexpr (std::is_same_v) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDsToPiKK()[classMl->at(iclass)]; @@ -586,7 +585,7 @@ struct HfTaskFlowCharmHadrons { break; } } else if constexpr (std::is_same_v || std::is_same_v) { - massCand = hfHelper.invMassDplusToPiKPi(candidate); + massCand = HfHelper::invMassDplusToPiKPi(candidate); if constexpr (std::is_same_v) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDplusToPiKPi()[classMl->at(iclass)]; @@ -596,7 +595,7 @@ struct HfTaskFlowCharmHadrons { nProngs = 2; switch (Channel) { case DecayChannel::D0ToPiK: - massCand = hfHelper.invMassD0ToPiK(candidate); + massCand = HfHelper::invMassD0ToPiK(candidate); if constexpr (std::is_same_v) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbD0()[classMl->at(iclass)]; @@ -604,7 +603,7 @@ struct HfTaskFlowCharmHadrons { } break; case DecayChannel::D0ToKPi: - massCand = hfHelper.invMassD0barToKPi(candidate); + massCand = HfHelper::invMassD0barToKPi(candidate); if constexpr (std::is_same_v) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbD0bar()[classMl->at(iclass)]; @@ -617,7 +616,7 @@ struct HfTaskFlowCharmHadrons { } else if constexpr (std::is_same_v || std::is_same_v) { switch (Channel) { case DecayChannel::LcToPKPi: - massCand = hfHelper.invMassLcToPKPi(candidate); + massCand = HfHelper::invMassLcToPKPi(candidate); if constexpr (std::is_same_v) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbLcToPKPi()[classMl->at(iclass)]; @@ -625,7 +624,7 @@ struct HfTaskFlowCharmHadrons { } break; case DecayChannel::LcToPiKP: - massCand = hfHelper.invMassLcToPiKP(candidate); + massCand = HfHelper::invMassLcToPiKP(candidate); if constexpr (std::is_same_v) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbLcToPiKP()[classMl->at(iclass)]; @@ -638,7 +637,7 @@ struct HfTaskFlowCharmHadrons { } else if constexpr (std::is_same_v || std::is_same_v) { switch (Channel) { case DecayChannel::XicToPKPi: - massCand = hfHelper.invMassXicToPKPi(candidate); + massCand = HfHelper::invMassXicToPKPi(candidate); if constexpr (std::is_same_v) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbXicToPKPi()[classMl->at(iclass)]; @@ -646,7 +645,7 @@ struct HfTaskFlowCharmHadrons { } break; case DecayChannel::XicToPiKP: - massCand = hfHelper.invMassXicToPiKP(candidate); + massCand = HfHelper::invMassXicToPiKP(candidate); if constexpr (std::is_same_v) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbXicToPiKP()[classMl->at(iclass)]; diff --git a/PWGHF/D2H/Tasks/taskLb.cxx b/PWGHF/D2H/Tasks/taskLb.cxx index dda79b2bd46..ecf0e8f6022 100644 --- a/PWGHF/D2H/Tasks/taskLb.cxx +++ b/PWGHF/D2H/Tasks/taskLb.cxx @@ -72,7 +72,6 @@ struct HfTaskLb { Configurable largeLifetimeBG{"largeLifetimeBG", 0.01, "fraction of strange contribution within 2mm"}; Configurable> binsPt{"binsPt", std::vector{hf_cuts_lb_to_lc_pi::vecBinsPt}, "pT bin limits"}; - HfHelper hfHelper; Service pdg; using TracksWExt = soa::Join; @@ -246,7 +245,7 @@ struct HfTaskLb { registry.get(HIST("hIPsAfterCut"))->Fill(candidateLc.pt(), candidateLc.impactParameter1()); registry.get(HIST("hIPsAfterCut"))->Fill(candidateLc.pt(), candidateLc.impactParameter2()); if (candidateLc.isSelLcToPKPi() != 0) { - registry.get(HIST("hPtinvMassLc"))->Fill(candidateLc.pt(), hfHelper.invMassLcToPKPi(candidateLc)); + registry.get(HIST("hPtinvMassLc"))->Fill(candidateLc.pt(), HfHelper::invMassLcToPKPi(candidateLc)); float const mRecoKstar = RecoDecay::m(std::array{track1.pVector(), track2.pVector()}, std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}); float const mRecoDelta1232 = RecoDecay::m(std::array{track0.pVector(), track2.pVector()}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPiPlus}); float const mRecoLambda1520 = RecoDecay::m(std::array{track0.pVector(), track1.pVector()}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassKPlus}); @@ -254,26 +253,26 @@ struct HfTaskLb { float const mDiffDelta1232 = std::abs(mRecoDelta1232 - massDelta1232); float const mDiffLambda1520 = std::abs(mRecoLambda1520 - o2::constants::physics::MassLambda1520); if (mDiffKStar892 < mDiffKStar892Max || mDiffDelta1232 < mDiffDelta1232Max || mDiffLambda1520 < mDiffLambda1520Max) { - registry.get(HIST("hPtinvMassLcReso"))->Fill(candidateLc.pt(), hfHelper.invMassLcToPKPi(candidateLc)); + registry.get(HIST("hPtinvMassLcReso"))->Fill(candidateLc.pt(), HfHelper::invMassLcToPKPi(candidateLc)); } if (mDiffKStar892 < mDiffKStar892Max) { - registry.get(HIST("hPtinvMassLcKStar"))->Fill(candidateLc.pt(), hfHelper.invMassLcToPKPi(candidateLc)); + registry.get(HIST("hPtinvMassLcKStar"))->Fill(candidateLc.pt(), HfHelper::invMassLcToPKPi(candidateLc)); } if (mDiffDelta1232 < mDiffDelta1232Max) { - registry.get(HIST("hPtinvMassLcDelta"))->Fill(candidateLc.pt(), hfHelper.invMassLcToPKPi(candidateLc)); + registry.get(HIST("hPtinvMassLcDelta"))->Fill(candidateLc.pt(), HfHelper::invMassLcToPKPi(candidateLc)); } if (mDiffLambda1520 < mDiffLambda1520Max) { - registry.get(HIST("hPtinvMassLcLambda1520"))->Fill(candidateLc.pt(), hfHelper.invMassLcToPKPi(candidateLc)); + registry.get(HIST("hPtinvMassLcLambda1520"))->Fill(candidateLc.pt(), HfHelper::invMassLcToPKPi(candidateLc)); } - if (std::abs(hfHelper.invMassLcToPKPi(candidateLc) - o2::constants::physics::MassLambdaCPlus) < mDiffLcMax) { + if (std::abs(HfHelper::invMassLcToPKPi(candidateLc) - o2::constants::physics::MassLambdaCPlus) < mDiffLcMax) { registry.get(HIST("hPtinvMassKStar"))->Fill(candidateLc.pt(), mRecoKstar); registry.get(HIST("hPtinvMassDelta"))->Fill(candidateLc.pt(), mRecoDelta1232); registry.get(HIST("hPtinvMassLambda1520"))->Fill(candidateLc.pt(), mRecoLambda1520); } } if (candidateLc.isSelLcToPiKP() != 0) { - registry.get(HIST("hPtinvMassLc"))->Fill(candidateLc.pt(), hfHelper.invMassLcToPiKP(candidateLc)); + registry.get(HIST("hPtinvMassLc"))->Fill(candidateLc.pt(), HfHelper::invMassLcToPiKP(candidateLc)); float const mRecoKstar = RecoDecay::m(std::array{track1.pVector(), track0.pVector()}, std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}); float const mRecoDelta1232 = RecoDecay::m(std::array{track2.pVector(), track0.pVector()}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPiPlus}); float const mRecoLambda1520 = RecoDecay::m(std::array{track2.pVector(), track1.pVector()}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassKPlus}); @@ -281,19 +280,19 @@ struct HfTaskLb { float const mDiffDelta1232 = std::abs(mRecoDelta1232 - massDelta1232); float const mDiffLambda1520 = std::abs(mRecoLambda1520 - o2::constants::physics::MassLambda1520); if (mDiffKStar892 < mDiffKStar892Max || mDiffDelta1232 < mDiffDelta1232Max || mDiffLambda1520 < mDiffLambda1520Max) { - registry.get(HIST("hPtinvMassLcReso"))->Fill(candidateLc.pt(), hfHelper.invMassLcToPiKP(candidateLc)); + registry.get(HIST("hPtinvMassLcReso"))->Fill(candidateLc.pt(), HfHelper::invMassLcToPiKP(candidateLc)); } if (mDiffKStar892 < mDiffKStar892Max) { - registry.get(HIST("hPtinvMassLcKStar"))->Fill(candidateLc.pt(), hfHelper.invMassLcToPiKP(candidateLc)); + registry.get(HIST("hPtinvMassLcKStar"))->Fill(candidateLc.pt(), HfHelper::invMassLcToPiKP(candidateLc)); } if (mDiffDelta1232 < mDiffDelta1232Max) { - registry.get(HIST("hPtinvMassLcDelta"))->Fill(candidateLc.pt(), hfHelper.invMassLcToPiKP(candidateLc)); + registry.get(HIST("hPtinvMassLcDelta"))->Fill(candidateLc.pt(), HfHelper::invMassLcToPiKP(candidateLc)); } if (mDiffLambda1520 < mDiffLambda1520Max) { - registry.get(HIST("hPtinvMassLcLambda1520"))->Fill(candidateLc.pt(), hfHelper.invMassLcToPiKP(candidateLc)); + registry.get(HIST("hPtinvMassLcLambda1520"))->Fill(candidateLc.pt(), HfHelper::invMassLcToPiKP(candidateLc)); } - if (std::abs(hfHelper.invMassLcToPiKP(candidateLc) - o2::constants::physics::MassLambdaCPlus) < mDiffLcMax) { + if (std::abs(HfHelper::invMassLcToPiKP(candidateLc) - o2::constants::physics::MassLambdaCPlus) < mDiffLcMax) { registry.get(HIST("hPtinvMassKStar"))->Fill(candidateLc.pt(), mRecoKstar); registry.get(HIST("hPtinvMassDelta"))->Fill(candidateLc.pt(), mRecoDelta1232); registry.get(HIST("hPtinvMassLambda1520"))->Fill(candidateLc.pt(), mRecoLambda1520); @@ -303,7 +302,7 @@ struct HfTaskLb { for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yLb(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yLb(candidate)) > yCandRecoMax) { continue; } registry.get(HIST("hZVertex"))->Fill(collision.posZ()); @@ -327,10 +326,10 @@ struct HfTaskLb { if (likelihoodRatio < minLikelihoodRatio) { continue; // Larger likelihood means more likely to be signal } - float const lbMass = hfHelper.invMassLbToLcPi(candidate); + float const lbMass = HfHelper::invMassLbToLcPi(candidate); registry.get(HIST("hPtinvMassLb"))->Fill(candidate.pt(), lbMass); - registry.fill(HIST("hMass"), hfHelper.invMassLbToLcPi(candidate), candidate.pt()); + registry.fill(HIST("hMass"), HfHelper::invMassLbToLcPi(candidate), candidate.pt()); registry.fill(HIST("hPtCand"), candidate.pt()); registry.fill(HIST("hPtProng0"), candidate.ptProng0()); registry.fill(HIST("hPtProng1"), candidate.ptProng1()); @@ -341,7 +340,7 @@ struct HfTaskLb { registry.fill(HIST("hd0Prong1"), candidate.impactParameter1(), candidate.pt()); registry.fill(HIST("hCPA"), candidate.cpa(), candidate.pt()); registry.fill(HIST("hEta"), candidate.eta(), candidate.pt()); - registry.fill(HIST("hRapidity"), hfHelper.yLb(candidate), candidate.pt()); + registry.fill(HIST("hRapidity"), HfHelper::yLb(candidate), candidate.pt()); registry.fill(HIST("hImpParErr"), candidate.errorImpactParameter0(), candidate.pt()); registry.fill(HIST("hImpParErr"), candidate.errorImpactParameter1(), candidate.pt()); registry.fill(HIST("hDecLenErr"), candidate.errorDecayLength(), candidate.pt()); @@ -359,7 +358,7 @@ struct HfTaskLb { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yLb(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yLb(candidate)) > yCandRecoMax) { continue; } auto candLc = candidate.prong0_as>(); @@ -374,10 +373,10 @@ struct HfTaskLb { registry.fill(HIST("MC/hCPARecSig"), candidate.cpa(), candidate.pt()); registry.fill(HIST("MC/hCPAxyRecSig"), candidate.cpa(), candidate.pt()); registry.fill(HIST("MC/hEtaRecSig"), candidate.eta(), candidate.pt()); - registry.fill(HIST("MC/hRapidityRecSig"), hfHelper.yLb(candidate), candidate.pt()); + registry.fill(HIST("MC/hRapidityRecSig"), HfHelper::yLb(candidate), candidate.pt()); registry.fill(HIST("MC/hDecLengthRecSig"), candidate.decayLength(), candidate.pt()); registry.fill(HIST("MC/hDecLengthXYRecSig"), candidate.decayLengthXY(), candidate.pt()); - registry.fill(HIST("MC/hMassRecSig"), hfHelper.invMassLbToLcPi(candidate), candidate.pt()); + registry.fill(HIST("MC/hMassRecSig"), HfHelper::invMassLbToLcPi(candidate), candidate.pt()); registry.fill(HIST("MC/hd0Prong0RecSig"), candidate.impactParameter0(), candidate.pt()); registry.fill(HIST("MC/hd0Prong1RecSig"), candidate.impactParameter1(), candidate.pt()); registry.fill(HIST("MC/hPtProng0RecSig"), candidate.ptProng0(), candidate.pt()); @@ -393,10 +392,10 @@ struct HfTaskLb { registry.fill(HIST("MC/hCPARecBg"), candidate.cpa(), candidate.pt()); registry.fill(HIST("MC/hCPAxyRecBg"), candidate.cpa(), candidate.pt()); registry.fill(HIST("MC/hEtaRecBg"), candidate.eta(), candidate.pt()); - registry.fill(HIST("MC/hRapidityRecBg"), hfHelper.yLb(candidate), candidate.pt()); + registry.fill(HIST("MC/hRapidityRecBg"), HfHelper::yLb(candidate), candidate.pt()); registry.fill(HIST("MC/hDecLengthRecBg"), candidate.decayLength(), candidate.pt()); registry.fill(HIST("MC/hDecLengthXYRecBg"), candidate.decayLengthXY(), candidate.pt()); - registry.fill(HIST("MC/hMassRecBg"), hfHelper.invMassLbToLcPi(candidate), candidate.pt()); + registry.fill(HIST("MC/hMassRecBg"), HfHelper::invMassLbToLcPi(candidate), candidate.pt()); registry.fill(HIST("MC/hd0Prong0RecBg"), candidate.impactParameter0(), candidate.pt()); registry.fill(HIST("MC/hd0Prong1RecBg"), candidate.impactParameter1(), candidate.pt()); registry.fill(HIST("MC/hPtProng0RecBg"), candidate.ptProng0(), candidate.pt()); diff --git a/PWGHF/D2H/Tasks/taskLbReduced.cxx b/PWGHF/D2H/Tasks/taskLbReduced.cxx index f47e06d84c5..b8ba64cb42a 100644 --- a/PWGHF/D2H/Tasks/taskLbReduced.cxx +++ b/PWGHF/D2H/Tasks/taskLbReduced.cxx @@ -188,8 +188,6 @@ struct HfTaskLbReduced { Configurable downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of background candidates to keep for ML trainings"}; Configurable ptMaxForDownSample{"ptMaxForDownSample", 10., "Maximum pt for the application of the downsampling factor"}; - HfHelper hfHelper; - using TracksPion = soa::Join; using CandsLc = soa::Join; Filter filterSelectCandidates = (aod::hf_sel_candidate_lb::isSelLbToLcPi >= selectionFlagLb); @@ -393,7 +391,7 @@ struct HfTaskLbReduced { CandsLc const&) { auto ptCandLb = candidate.pt(); - auto invMassLb = hfHelper.invMassLbToLcPi(candidate); + auto invMassLb = HfHelper::invMassLbToLcPi(candidate); auto candLc = candidate.template prong0_as(); auto ptLc = candidate.ptProng0(); auto invMassLc = candLc.invMassHypo0() > 0 ? candLc.invMassHypo0() : candLc.invMassHypo1(); @@ -418,7 +416,7 @@ struct HfTaskLbReduced { if (fillHistograms) { if constexpr (DoMc) { if (isSignal) { - registry.fill(HIST("hMassRecSig"), ptCandLb, hfHelper.invMassLbToLcPi(candidate)); + registry.fill(HIST("hMassRecSig"), ptCandLb, HfHelper::invMassLbToLcPi(candidate)); registry.fill(HIST("hPtProng0RecSig"), ptCandLb, candidate.ptProng0()); registry.fill(HIST("hPtProng1RecSig"), ptCandLb, candidate.ptProng1()); registry.fill(HIST("hImpParProdRecSig"), ptCandLb, candidate.impactParameterProduct()); @@ -430,7 +428,7 @@ struct HfTaskLbReduced { registry.fill(HIST("hCospRecSig"), ptCandLb, candidate.cpa()); registry.fill(HIST("hCospXyRecSig"), ptCandLb, candidate.cpaXY()); registry.fill(HIST("hEtaRecSig"), ptCandLb, candidate.eta()); - registry.fill(HIST("hRapidityRecSig"), ptCandLb, hfHelper.yLb(candidate)); + registry.fill(HIST("hRapidityRecSig"), ptCandLb, HfHelper::yLb(candidate)); registry.fill(HIST("hinvMassLcRecSig"), ptLc, invMassLc); registry.fill(HIST("hDecLengthLcRecSig"), ptLc, decLenLc); registry.fill(HIST("hDecLengthXyLcRecSig"), ptLc, decLenXyLc); @@ -448,7 +446,7 @@ struct HfTaskLbReduced { registry.fill(HIST("hMlScoreSigLbRecSig"), ptCandLb, candidate.mlProbLbToLcPi()); } } else if (fillBackground) { - registry.fill(HIST("hMassRecBg"), ptCandLb, hfHelper.invMassLbToLcPi(candidate)); + registry.fill(HIST("hMassRecBg"), ptCandLb, HfHelper::invMassLbToLcPi(candidate)); registry.fill(HIST("hPtProng0RecBg"), ptCandLb, candidate.ptProng0()); registry.fill(HIST("hPtProng1RecBg"), ptCandLb, candidate.ptProng1()); registry.fill(HIST("hImpParProdRecBg"), ptCandLb, candidate.impactParameterProduct()); @@ -460,7 +458,7 @@ struct HfTaskLbReduced { registry.fill(HIST("hCospRecBg"), ptCandLb, candidate.cpa()); registry.fill(HIST("hCospXyRecBg"), ptCandLb, candidate.cpaXY()); registry.fill(HIST("hEtaRecBg"), ptCandLb, candidate.eta()); - registry.fill(HIST("hRapidityRecBg"), ptCandLb, hfHelper.yLb(candidate)); + registry.fill(HIST("hRapidityRecBg"), ptCandLb, HfHelper::yLb(candidate)); registry.fill(HIST("hinvMassLcRecBg"), ptLc, invMassLc); registry.fill(HIST("hDecLengthLcRecBg"), ptLc, decLenLc); registry.fill(HIST("hDecLengthXyLcRecBg"), ptLc, decLenXyLc); @@ -498,7 +496,7 @@ struct HfTaskLbReduced { registry.fill(HIST("hCosp"), ptCandLb, candidate.cpa()); registry.fill(HIST("hCospXy"), ptCandLb, candidate.cpaXY()); registry.fill(HIST("hEta"), ptCandLb, candidate.eta()); - registry.fill(HIST("hRapidity"), ptCandLb, hfHelper.yLb(candidate)); + registry.fill(HIST("hRapidity"), ptCandLb, HfHelper::yLb(candidate)); registry.fill(HIST("hinvMassLc"), ptLc, invMassLc); registry.fill(HIST("hDecLengthLc"), ptLc, decLenLc); registry.fill(HIST("hDecLengthXyLc"), ptLc, decLenXyLc); @@ -566,7 +564,7 @@ struct HfTaskLbReduced { ptCandLb, candidate.eta(), candidate.phi(), - hfHelper.yLb(candidate), + HfHelper::yLb(candidate), candidate.cpa(), candidate.cpaXY(), candidate.chi2PCA(), @@ -681,7 +679,7 @@ struct HfTaskLbReduced { TracksPion const&) { for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yLb(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yLb(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesLc); @@ -694,7 +692,7 @@ struct HfTaskLbReduced { TracksPion const&) { for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yLb(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yLb(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesLc); @@ -707,7 +705,7 @@ struct HfTaskLbReduced { TracksPion const&) { for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yLb(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yLb(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesLc); @@ -722,7 +720,7 @@ struct HfTaskLbReduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yLb(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yLb(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesLc); @@ -742,7 +740,7 @@ struct HfTaskLbReduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yLb(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yLb(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesLc); @@ -762,7 +760,7 @@ struct HfTaskLbReduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yLb(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yLb(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesLc); @@ -782,7 +780,7 @@ struct HfTaskLbReduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yLb(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yLb(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesLc); @@ -802,7 +800,7 @@ struct HfTaskLbReduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yLb(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yLb(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesLc); @@ -822,7 +820,7 @@ struct HfTaskLbReduced { { // MC rec for (const auto& candidate : candidates) { - if (yCandRecoMax >= 0. && std::abs(hfHelper.yLb(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yLb(candidate)) > yCandRecoMax) { continue; } fillCand(candidate, candidatesLc); diff --git a/PWGHF/D2H/Tasks/taskLc.cxx b/PWGHF/D2H/Tasks/taskLc.cxx index 5d28e17251b..3ed467d6d98 100644 --- a/PWGHF/D2H/Tasks/taskLc.cxx +++ b/PWGHF/D2H/Tasks/taskLc.cxx @@ -84,7 +84,6 @@ struct HfTaskLc { Configurable ccdbPathGrp{"ccdbPathGrp", "GLO/GRP/GRP", "Path of the grp file (Run 2)"}; Configurable ccdbPathGrpMag{"ccdbPathGrpMag", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object (Run 3)"}; - HfHelper hfHelper; HfEventSelection hfEvSel; // event selection and monitoring SliceCache cache; Service ccdb; @@ -369,12 +368,12 @@ struct HfTaskLc { const auto& mcParticleProng0 = candidate.template prong0_as().template mcParticle_as>(); const auto pdgCodeProng0 = std::abs(mcParticleProng0.pdgCode()); if ((candidate.isSelLcToPKPi() >= selectionFlagLc) && pdgCodeProng0 == kProton) { - registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hMassRecSig") + HIST(SignalSuffixes[SignalType]), hfHelper.invMassLcToPKPi(candidate)); - registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hMassVsPtRecSig") + HIST(SignalSuffixes[SignalType]), hfHelper.invMassLcToPKPi(candidate), candidate.pt()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hMassRecSig") + HIST(SignalSuffixes[SignalType]), HfHelper::invMassLcToPKPi(candidate)); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hMassVsPtRecSig") + HIST(SignalSuffixes[SignalType]), HfHelper::invMassLcToPKPi(candidate), candidate.pt()); } if ((candidate.isSelLcToPiKP() >= selectionFlagLc) && pdgCodeProng0 == kPiPlus) { - registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hMassRecSig") + HIST(SignalSuffixes[SignalType]), hfHelper.invMassLcToPiKP(candidate)); - registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hMassVsPtRecSig") + HIST(SignalSuffixes[SignalType]), hfHelper.invMassLcToPiKP(candidate), candidate.pt()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hMassRecSig") + HIST(SignalSuffixes[SignalType]), HfHelper::invMassLcToPiKP(candidate)); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hMassVsPtRecSig") + HIST(SignalSuffixes[SignalType]), HfHelper::invMassLcToPiKP(candidate), candidate.pt()); } registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hPtRecSig") + HIST(SignalSuffixes[SignalType]), candidate.pt()); registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hPtProng0RecSig") + HIST(SignalSuffixes[SignalType]), candidate.ptProng0()); @@ -391,8 +390,8 @@ struct HfTaskLc { registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hDecLengthVsPtRecSig") + HIST(SignalSuffixes[SignalType]), candidate.decayLength(), candidate.pt()); registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hDecLengthxyRecSig") + HIST(SignalSuffixes[SignalType]), candidate.decayLengthXY()); registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hDecLengthxyVsPtRecSig") + HIST(SignalSuffixes[SignalType]), candidate.decayLengthXY(), candidate.pt()); - registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hCtRecSig") + HIST(SignalSuffixes[SignalType]), hfHelper.ctLc(candidate)); - registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hCtVsPtRecSig") + HIST(SignalSuffixes[SignalType]), hfHelper.ctLc(candidate), candidate.pt()); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hCtRecSig") + HIST(SignalSuffixes[SignalType]), HfHelper::ctLc(candidate)); + registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hCtVsPtRecSig") + HIST(SignalSuffixes[SignalType]), HfHelper::ctLc(candidate), candidate.pt()); registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hCPARecSig") + HIST(SignalSuffixes[SignalType]), candidate.cpa()); registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hCPAVsPtRecSig") + HIST(SignalSuffixes[SignalType]), candidate.cpa(), candidate.pt()); registry.fill(HIST("MC/reconstructed/") + HIST(SignalFolders[SignalType]) + HIST("/hCPAxyRecSig") + HIST(SignalSuffixes[SignalType]), candidate.cpaXY()); @@ -423,7 +422,7 @@ struct HfTaskLc { continue; } /// rapidity selection - if (yCandRecoMax >= 0. && std::abs(hfHelper.yLc(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yLc(candidate)) > yCandRecoMax) { continue; } @@ -465,10 +464,10 @@ struct HfTaskLc { } double massLc(-1); double outputBkg(-1), outputPrompt(-1), outputFD(-1); - const float properLifetime = hfHelper.ctLc(candidate) * CtToProperLifetimePs; + const float properLifetime = HfHelper::ctLc(candidate) * CtToProperLifetimePs; auto fillTHnRecSig = [&](bool isPKPi) { - massLc = isPKPi ? hfHelper.invMassLcToPKPi(candidate) : hfHelper.invMassLcToPiKP(candidate); + massLc = isPKPi ? HfHelper::invMassLcToPKPi(candidate) : HfHelper::invMassLcToPiKP(candidate); if constexpr (FillMl) { if (candidate.mlProbLcToPKPi().size() == NumberOfMlClasses) { @@ -594,7 +593,7 @@ struct HfTaskLc { if (!(candidate.hfflag() & 1 << aod::hf_cand_3prong::DecayType::LcToPKPi)) { continue; } - if (yCandRecoMax >= 0. && std::abs(hfHelper.yLc(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yLc(candidate)) > yCandRecoMax) { continue; } const auto pt = candidate.pt(); @@ -608,14 +607,14 @@ struct HfTaskLc { const auto cpaXY = candidate.cpaXY(); if (candidate.isSelLcToPKPi() >= selectionFlagLc) { - registry.fill(HIST("Data/hMass"), hfHelper.invMassLcToPKPi(candidate)); - registry.fill(HIST("Data/hMassVsPtVsNPvContributors"), hfHelper.invMassLcToPKPi(candidate), pt, numPvContributors); - registry.fill(HIST("Data/hMassVsPt"), hfHelper.invMassLcToPKPi(candidate), pt); + registry.fill(HIST("Data/hMass"), HfHelper::invMassLcToPKPi(candidate)); + registry.fill(HIST("Data/hMassVsPtVsNPvContributors"), HfHelper::invMassLcToPKPi(candidate), pt, numPvContributors); + registry.fill(HIST("Data/hMassVsPt"), HfHelper::invMassLcToPKPi(candidate), pt); } if (candidate.isSelLcToPiKP() >= selectionFlagLc) { - registry.fill(HIST("Data/hMass"), hfHelper.invMassLcToPiKP(candidate)); - registry.fill(HIST("Data/hMassVsPtVsNPvContributors"), hfHelper.invMassLcToPiKP(candidate), pt, numPvContributors); - registry.fill(HIST("Data/hMassVsPt"), hfHelper.invMassLcToPiKP(candidate), pt); + registry.fill(HIST("Data/hMass"), HfHelper::invMassLcToPiKP(candidate)); + registry.fill(HIST("Data/hMassVsPtVsNPvContributors"), HfHelper::invMassLcToPiKP(candidate), pt, numPvContributors); + registry.fill(HIST("Data/hMassVsPt"), HfHelper::invMassLcToPiKP(candidate), pt); } registry.fill(HIST("Data/hPt"), pt); registry.fill(HIST("Data/hPtProng0"), ptProng0); @@ -631,8 +630,8 @@ struct HfTaskLc { registry.fill(HIST("Data/hDecLengthVsPt"), decayLength, pt); registry.fill(HIST("Data/hDecLengthxy"), decayLengthXY); registry.fill(HIST("Data/hDecLengthxyVsPt"), decayLengthXY, pt); - registry.fill(HIST("Data/hCt"), hfHelper.ctLc(candidate)); - registry.fill(HIST("Data/hCtVsPt"), hfHelper.ctLc(candidate), pt); + registry.fill(HIST("Data/hCt"), HfHelper::ctLc(candidate)); + registry.fill(HIST("Data/hCtVsPt"), HfHelper::ctLc(candidate), pt); registry.fill(HIST("Data/hCPA"), cpa); registry.fill(HIST("Data/hCPAVsPt"), cpa, pt); registry.fill(HIST("Data/hCPAxy"), cpaXY); @@ -658,10 +657,10 @@ struct HfTaskLc { } double massLc(-1); double outputBkg(-1), outputPrompt(-1), outputFD(-1); - const float properLifetime = hfHelper.ctLc(candidate) * CtToProperLifetimePs; + const float properLifetime = HfHelper::ctLc(candidate) * CtToProperLifetimePs; auto fillTHnData = [&](bool isPKPi) { - massLc = isPKPi ? hfHelper.invMassLcToPKPi(candidate) : hfHelper.invMassLcToPiKP(candidate); + massLc = isPKPi ? HfHelper::invMassLcToPKPi(candidate) : HfHelper::invMassLcToPiKP(candidate); if constexpr (FillMl) { if (candidate.mlProbLcToPKPi().size() == NumberOfMlClasses) { diff --git a/PWGHF/D2H/Tasks/taskLcToK0sP.cxx b/PWGHF/D2H/Tasks/taskLcToK0sP.cxx index 7118cfedb38..78fd2c5174a 100644 --- a/PWGHF/D2H/Tasks/taskLcToK0sP.cxx +++ b/PWGHF/D2H/Tasks/taskLcToK0sP.cxx @@ -52,8 +52,6 @@ struct HfTaskLcToK0sP { Configurable yCandRecoMax{"yCandRecoMax", 0.8, "max. cand. rapidity"}; Configurable> binsPt{"binsPt", std::vector{hf_cuts_lc_to_k0s_p::vecBinsPt}, "pT bin limits"}; - HfHelper hfHelper; - using TracksWPid = soa::Join; Filter filterSelectCandidates = (aod::hf_sel_candidate_lc_to_k0s_p::isSelLcToK0sP >= selectionFlagLcToK0sP || aod::hf_sel_candidate_lc_to_k0s_p::isSelLcToK0sP >= selectionFlagLcbarToK0sP); @@ -270,14 +268,14 @@ struct HfTaskLcToK0sP { if (etaCandMax >= 0. && std::abs(candidate.eta()) > etaCandMax) { continue; } - if (yCandRecoMax >= 0. && std::abs(hfHelper.yLc(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yLc(candidate)) > yCandRecoMax) { continue; } auto ptCand = candidate.pt(); auto eta = candidate.eta(); auto phi = candidate.phi(); - auto invMassLcToK0sP = hfHelper.invMassLcToK0sP(candidate); + auto invMassLcToK0sP = HfHelper::invMassLcToK0sP(candidate); auto ptProng0 = candidate.ptProng0(); auto ptProng1 = candidate.ptProng1(); auto impactParameter0 = candidate.impactParameter0(); @@ -293,13 +291,13 @@ struct HfTaskLcToK0sP { auto mLambda = candidate.mLambda(); auto mAntiLambda = candidate.mAntiLambda(); auto mGamma = candidate.mGamma(); - auto ctV0K0Short = hfHelper.ctV0K0s(candidate); - auto ctV0Lambda = hfHelper.ctV0Lambda(candidate); + auto ctV0K0Short = HfHelper::ctV0K0s(candidate); + auto ctV0Lambda = HfHelper::ctV0Lambda(candidate); auto cpa = candidate.cpa(); auto cpaXY = candidate.cpaXY(); auto decayLength = candidate.decayLength(); auto decayLengthXY = candidate.decayLengthXY(); - auto ctLc = hfHelper.ctLc(candidate); + auto ctLc = HfHelper::ctLc(candidate); registry.fill(HIST("hPtCand"), ptCand); registry.fill(HIST("hEtaCand"), eta); @@ -377,14 +375,14 @@ struct HfTaskLcToK0sP { continue; } - if (yCandRecoMax >= 0. && std::abs(hfHelper.yLc(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yLc(candidate)) > yCandRecoMax) { continue; } auto ptCand = candidate.pt(); auto eta = candidate.eta(); auto phi = candidate.phi(); - auto invMassLcToK0sP = hfHelper.invMassLcToK0sP(candidate); + auto invMassLcToK0sP = HfHelper::invMassLcToK0sP(candidate); auto ptProng0 = candidate.ptProng0(); auto ptProng1 = candidate.ptProng1(); auto impactParameter0 = candidate.impactParameter0(); @@ -400,13 +398,13 @@ struct HfTaskLcToK0sP { auto mLambda = candidate.mLambda(); auto mAntiLambda = candidate.mAntiLambda(); auto mGamma = candidate.mGamma(); - auto ctV0K0Short = hfHelper.ctV0K0s(candidate); - auto ctV0Lambda = hfHelper.ctV0Lambda(candidate); + auto ctV0K0Short = HfHelper::ctV0K0s(candidate); + auto ctV0Lambda = HfHelper::ctV0Lambda(candidate); auto cpa = candidate.cpa(); auto cpaXY = candidate.cpaXY(); auto decayLength = candidate.decayLength(); auto decayLengthXY = candidate.decayLengthXY(); - auto ctLc = hfHelper.ctLc(candidate); + auto ctLc = HfHelper::ctLc(candidate); const auto& bach = candidate.prong0_as(); // bachelor track auto tpcNSigmaPr = bach.tpcNSigmaPr(); diff --git a/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx b/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx index c96372c8b8d..cc5a1381380 100644 --- a/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx +++ b/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx @@ -74,7 +74,6 @@ struct HfTaskOmegac0ToOmegapi { Configurable yCandRecoMax{"yCandRecoMax", 0.8, "Max. cand. rapidity"}; Configurable fillTree{"fillTree", false, "Fill tree for local analysis (enabled only with ML)"}; - HfHelper hfHelper; SliceCache cache; using Omegac0Cands = soa::Filtered>; diff --git a/PWGHF/D2H/Tasks/taskSigmac.cxx b/PWGHF/D2H/Tasks/taskSigmac.cxx index 0301ed5662e..1bca721c338 100644 --- a/PWGHF/D2H/Tasks/taskSigmac.cxx +++ b/PWGHF/D2H/Tasks/taskSigmac.cxx @@ -66,7 +66,6 @@ struct HfTaskSigmac { Configurable enableTHn{"enableTHn", false, "enable the usage of THn for Λc+ and Σc0,++"}; Configurable addSoftPiDcaToSigmacSparse{"addSoftPiDcaToSigmacSparse", false, "enable the filling of sof-pion dcaXY, dcaZ in the Σc0,++ THnSparse"}; - HfHelper hfHelper; bool isMc{}; static constexpr std::size_t NDaughters{2u}; @@ -353,7 +352,7 @@ struct HfTaskSigmac { /// rapidity selection on Σc0,++ /// NB: since in data we cannot tag Sc(2455) and Sc(2520), then we use only Sc(2455) for y selection on reconstructed signal - if (yCandRecoMax >= 0. && std::abs(hfHelper.ySc0(candSc)) > yCandRecoMax && std::abs(hfHelper.yScPlusPlus(candSc)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::ySc0(candSc)) > yCandRecoMax && std::abs(HfHelper::yScPlusPlus(candSc)) > yCandRecoMax) { continue; } @@ -374,8 +373,8 @@ struct HfTaskSigmac { double cpaLc(candidateLc.cpa()), cpaXYLc(candidateLc.cpaXY()); /// candidate Λc+ → pK-π+ (and charge conjugate) within the range of M(pK-π+) chosen in the Σc0,++ builder if (TESTBIT(isCandPKPiPiKP, o2::aod::hf_cand_sigmac::Decays::PKPi)) { - massSc = hfHelper.invMassScRecoLcToPKPi(candSc, candidateLc); - massLc = hfHelper.invMassLcToPKPi(candidateLc); + massSc = HfHelper::invMassScRecoLcToPKPi(candSc, candidateLc); + massLc = HfHelper::invMassLcToPKPi(candidateLc); deltaMass = massSc - massLc; /// fill the histograms if (chargeSc == o2::aod::hf_cand_sigmac::ChargeNull) { @@ -457,8 +456,8 @@ struct HfTaskSigmac { } /// end candidate Λc+ → pK-π+ (and charge conjugate) /// candidate Λc+ → π+K-p (and charge conjugate) within the range of M(π+K-p) chosen in the Σc0,++ builder if (TESTBIT(isCandPKPiPiKP, o2::aod::hf_cand_sigmac::Decays::PiKP)) { - massSc = hfHelper.invMassScRecoLcToPiKP(candSc, candidateLc); - massLc = hfHelper.invMassLcToPiKP(candidateLc); + massSc = HfHelper::invMassScRecoLcToPiKP(candSc, candidateLc); + massLc = HfHelper::invMassLcToPiKP(candidateLc); deltaMass = massSc - massLc; /// fill the histograms if (chargeSc == o2::aod::hf_cand_sigmac::ChargeNull) { @@ -551,7 +550,7 @@ struct HfTaskSigmac { double decLengthLc(candidateLc.decayLength()), decLengthXYLc(candidateLc.decayLengthXY()); double cpaLc(candidateLc.cpa()), cpaXYLc(candidateLc.cpaXY()); if (candidateLc.isSelLcToPKPi() >= 1) { - massLc = hfHelper.invMassLcToPKPi(candidateLc); + massLc = HfHelper::invMassLcToPKPi(candidateLc); if constexpr (UseMl) { /// fill with ML information /// BDT index 0: bkg score; BDT index 2: non-prompt score @@ -567,7 +566,7 @@ struct HfTaskSigmac { } } if (candidateLc.isSelLcToPiKP() >= 1) { - massLc = hfHelper.invMassLcToPiKP(candidateLc); + massLc = HfHelper::invMassLcToPiKP(candidateLc); if constexpr (UseMl) { /// fill with ML information /// BDT index 0: bkg score; BDT index 2: non-prompt score @@ -786,7 +785,7 @@ struct HfTaskSigmac { /// rapidity selection on Σc0,++ /// NB: since in data we cannot tag Sc(2455) and Sc(2520), then we use only Sc(2455) for y selection on reconstructed signal - if (yCandRecoMax >= 0. && std::abs(hfHelper.ySc0(candSc)) > yCandRecoMax && std::abs(hfHelper.yScPlusPlus(candSc)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::ySc0(candSc)) > yCandRecoMax && std::abs(HfHelper::yScPlusPlus(candSc)) > yCandRecoMax) { continue; } @@ -842,8 +841,8 @@ struct HfTaskSigmac { /// candidate Λc+ → pK-π+ (and charge conjugate) within the range of M(pK-π+) chosen in the Σc0,++ builder if ((TESTBIT(isCandPKPiPiKP, o2::aod::hf_cand_sigmac::Decays::PKPi)) && std::abs(candidateLc.template prong0_as().mcParticle().pdgCode()) == kProton) { - massSc = hfHelper.invMassScRecoLcToPKPi(candSc, candidateLc); - massLc = hfHelper.invMassLcToPKPi(candidateLc); + massSc = HfHelper::invMassScRecoLcToPKPi(candSc, candidateLc); + massLc = HfHelper::invMassLcToPKPi(candidateLc); deltaMass = massSc - massLc; /// Fill the histograms for reconstructed Σc0 signal @@ -927,8 +926,8 @@ struct HfTaskSigmac { } /// end candidate Λc+ → pK-π+ (and charge conjugate) /// candidate Λc+ → π+K-p (and charge conjugate) within the range of M(π+K-p) chosen in the Σc0,++ builder if ((TESTBIT(isCandPKPiPiKP, o2::aod::hf_cand_sigmac::Decays::PiKP)) && std::abs(candidateLc.template prong0_as().mcParticle().pdgCode()) == kPiPlus) { - massSc = hfHelper.invMassScRecoLcToPiKP(candSc, candidateLc); - massLc = hfHelper.invMassLcToPiKP(candidateLc); + massSc = HfHelper::invMassScRecoLcToPiKP(candSc, candidateLc); + massLc = HfHelper::invMassLcToPiKP(candidateLc); deltaMass = massSc - massLc; /// Fill the histograms for reconstructed Σc0 signal @@ -1048,8 +1047,8 @@ struct HfTaskSigmac { /// candidate Λc+ → pK-π+ (and charge conjugate) within the range of M(pK-π+) chosen in the Σc0,++ builder if ((TESTBIT(isCandPKPiPiKP, o2::aod::hf_cand_sigmac::Decays::PKPi)) && std::abs(candidateLc.template prong0_as().mcParticle().pdgCode()) == kProton) { - massSc = hfHelper.invMassScRecoLcToPKPi(candSc, candidateLc); - massLc = hfHelper.invMassLcToPKPi(candidateLc); + massSc = HfHelper::invMassScRecoLcToPKPi(candSc, candidateLc); + massLc = HfHelper::invMassLcToPKPi(candidateLc); deltaMass = massSc - massLc; /// Fill the histograms for reconstructed Σc++ signal @@ -1133,8 +1132,8 @@ struct HfTaskSigmac { } /// end candidate Λc+ → pK-π+ (and charge conjugate) /// candidate Λc+ → π+K-p (and charge conjugate) within the range of M(π+K-p) chosen in the Σc0,++ builder if ((TESTBIT(isCandPKPiPiKP, o2::aod::hf_cand_sigmac::Decays::PiKP)) && std::abs(candidateLc.template prong0_as().mcParticle().pdgCode()) == kPiPlus) { - massSc = hfHelper.invMassScRecoLcToPiKP(candSc, candidateLc); - massLc = hfHelper.invMassLcToPiKP(candidateLc); + massSc = HfHelper::invMassScRecoLcToPiKP(candSc, candidateLc); + massLc = HfHelper::invMassLcToPiKP(candidateLc); deltaMass = massSc - massLc; /// Fill the histograms for reconstructed Σc++ signal @@ -1236,7 +1235,7 @@ struct HfTaskSigmac { pdgAbs = std::abs(candidateLc.template prong0_as().mcParticle().pdgCode()); } if (candidateLc.isSelLcToPKPi() >= 1 && pdgAbs == kProton) { - massLc = hfHelper.invMassLcToPKPi(candidateLc); + massLc = HfHelper::invMassLcToPKPi(candidateLc); if constexpr (UseMl) { /// fill with ML information /// BDT index 0: bkg score; BDT index 2: non-prompt score @@ -1252,7 +1251,7 @@ struct HfTaskSigmac { } } if (candidateLc.isSelLcToPiKP() >= 1 && pdgAbs == kPiPlus) { - massLc = hfHelper.invMassLcToPiKP(candidateLc); + massLc = HfHelper::invMassLcToPiKP(candidateLc); if constexpr (UseMl) { /// fill with ML information /// BDT index 0: bkg score; BDT index 2: non-prompt score diff --git a/PWGHF/D2H/Tasks/taskSigmacToCascade.cxx b/PWGHF/D2H/Tasks/taskSigmacToCascade.cxx index 8cb1013323e..79f8d3c7a60 100644 --- a/PWGHF/D2H/Tasks/taskSigmacToCascade.cxx +++ b/PWGHF/D2H/Tasks/taskSigmacToCascade.cxx @@ -62,7 +62,6 @@ struct HfTaskSigmacToCascade { using RecoLc = soa::Filtered>; HistogramRegistry registry{"registry"}; - HfHelper hfHelper; void init(InitContext&) { @@ -148,13 +147,13 @@ struct HfTaskSigmacToCascade { float cpaLc(candidateLc.cpa()), cpaXYLc(candidateLc.cpaXY()); float y(-1.); - auto massLc = hfHelper.invMassLcToK0sP(candidateLc); - auto massSc = hfHelper.invMassScRecoLcToK0sP(candSc, candidateLc); + auto massLc = HfHelper::invMassLcToK0sP(candidateLc); + auto massSc = HfHelper::invMassScRecoLcToK0sP(candSc, candidateLc); auto deltaMass = massSc - massLc; if (candSc.charge() == 0) { - y = hfHelper.ySc0(candSc); + y = HfHelper::ySc0(candSc); } else if (candSc.charge() == 2) { - y = hfHelper.yScPlusPlus(candSc); + y = HfHelper::yScPlusPlus(candSc); } registry.fill(HIST("Data/hDeltaMassSc0PlusPlus"), deltaMass); /// Σc(0,++) for both charges registry.fill(HIST("Data/hDeltaMassSc0PlusPlusVsPt"), deltaMass, ptSc); /// Σc(0,++) for both charges diff --git a/PWGHF/D2H/Tasks/taskXic.cxx b/PWGHF/D2H/Tasks/taskXic.cxx index cfe5c9d4b75..b45ba158bf0 100644 --- a/PWGHF/D2H/Tasks/taskXic.cxx +++ b/PWGHF/D2H/Tasks/taskXic.cxx @@ -67,7 +67,6 @@ struct HfTaskXic { Configurable> binsPt{"binsPt", std::vector{hf_cuts_xic_to_p_k_pi::vecBinsPt}, "pT bin limits"}; Configurable enableTHn{"enableTHn", false, "enable THn for Xic"}; - HfHelper hfHelper; Service pdg; Filter filterSelectCandidates = (aod::hf_sel_candidate_xic::isSelXicToPKPi >= selectionFlagXic || aod::hf_sel_candidate_xic::isSelXicToPiKP >= selectionFlagXic); @@ -293,18 +292,18 @@ struct HfTaskXic { if (!(candidate.hfflag() & 1 << aod::hf_cand_3prong::DecayType::XicToPKPi)) { continue; } - if (yCandRecoMax >= 0. && std::abs(hfHelper.yXic(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yXic(candidate)) > yCandRecoMax) { continue; } auto ptCandidate = candidate.pt(); if (candidate.isSelXicToPKPi() >= selectionFlagXic) { // pKpi - registry.fill(HIST("Data/hMassVsPt"), hfHelper.invMassXicToPKPi(candidate), ptCandidate); - registry.fill(HIST("Data/hMass"), hfHelper.invMassXicToPKPi(candidate)); + registry.fill(HIST("Data/hMassVsPt"), HfHelper::invMassXicToPKPi(candidate), ptCandidate); + registry.fill(HIST("Data/hMass"), HfHelper::invMassXicToPKPi(candidate)); } if (candidate.isSelXicToPiKP() >= selectionFlagXic) { // piKp - registry.fill(HIST("Data/hMassVsPt"), hfHelper.invMassXicToPiKP(candidate), ptCandidate); - registry.fill(HIST("Data/hMass"), hfHelper.invMassXicToPiKP(candidate)); + registry.fill(HIST("Data/hMassVsPt"), HfHelper::invMassXicToPiKP(candidate), ptCandidate); + registry.fill(HIST("Data/hMass"), HfHelper::invMassXicToPiKP(candidate)); } registry.fill(HIST("Data/hPt"), ptCandidate); registry.fill(HIST("Data/hEta"), candidate.eta()); @@ -319,7 +318,7 @@ struct HfTaskXic { registry.fill(HIST("Data/hd0Prong0"), candidate.impactParameter0(), ptCandidate); registry.fill(HIST("Data/hd0Prong1"), candidate.impactParameter1(), ptCandidate); registry.fill(HIST("Data/hd0Prong2"), candidate.impactParameter2(), ptCandidate); - registry.fill(HIST("Data/hCt"), hfHelper.ctXic(candidate), ptCandidate); + registry.fill(HIST("Data/hCt"), HfHelper::ctXic(candidate), ptCandidate); registry.fill(HIST("Data/hCPA"), candidate.cpa(), ptCandidate); registry.fill(HIST("Data/hCPAXY"), candidate.cpaXY(), ptCandidate); registry.fill(HIST("Data/hEtaVsPt"), candidate.eta(), ptCandidate); @@ -371,7 +370,7 @@ struct HfTaskXic { double outputBkg(-1), outputPrompt(-1), outputFD(-1); const int ternaryCl = 3; if (candidate.isSelXicToPKPi() >= selectionFlagXic) { - massXic = hfHelper.invMassXicToPKPi(candidate); + massXic = HfHelper::invMassXicToPKPi(candidate); if constexpr (UseMl) { if (candidate.mlProbXicToPKPi().size() == ternaryCl) { outputBkg = candidate.mlProbXicToPKPi()[0]; /// bkg score @@ -385,7 +384,7 @@ struct HfTaskXic { } } if (candidate.isSelXicToPiKP() >= selectionFlagXic) { - massXic = hfHelper.invMassXicToPiKP(candidate); + massXic = HfHelper::invMassXicToPiKP(candidate); if constexpr (UseMl) { if (candidate.mlProbXicToPiKP().size() == ternaryCl) { outputBkg = candidate.mlProbXicToPiKP()[0]; /// bkg score @@ -430,7 +429,7 @@ struct HfTaskXic { if (!(candidate.hfflag() & 1 << aod::hf_cand_3prong::DecayType::XicToPKPi)) { continue; } - if (yCandRecoMax >= 0. && std::abs(hfHelper.yXic(candidate)) > yCandRecoMax) { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yXic(candidate)) > yCandRecoMax) { continue; } @@ -438,10 +437,10 @@ struct HfTaskXic { auto massXicToPiKP = 0.; if (candidate.isSelXicToPKPi() >= selectionFlagXic) { - massXicToPKPi = hfHelper.invMassXicToPKPi(candidate); + massXicToPKPi = HfHelper::invMassXicToPKPi(candidate); } if (candidate.isSelXicToPiKP() >= selectionFlagXic) { - massXicToPiKP = hfHelper.invMassXicToPiKP(candidate); // mass conjugate + massXicToPiKP = HfHelper::invMassXicToPiKP(candidate); // mass conjugate } if (std::abs(candidate.flagMcMatchRec()) == hf_decay::hf_cand_3prong::DecayChannelMain::XicToPKPi) { @@ -469,7 +468,7 @@ struct HfTaskXic { registry.fill(HIST("MC/reconstructed/signal/hd0Prong0RecSig"), candidate.impactParameter0(), ptCandidate); registry.fill(HIST("MC/reconstructed/signal/hd0Prong1RecSig"), candidate.impactParameter1(), ptCandidate); registry.fill(HIST("MC/reconstructed/signal/hd0Prong2RecSig"), candidate.impactParameter2(), ptCandidate); - registry.fill(HIST("MC/reconstructed/signal/hCtRecSig"), hfHelper.ctXic(candidate), ptCandidate); + registry.fill(HIST("MC/reconstructed/signal/hCtRecSig"), HfHelper::ctXic(candidate), ptCandidate); registry.fill(HIST("MC/reconstructed/signal/hCPARecSig"), candidate.cpa(), ptCandidate); registry.fill(HIST("MC/reconstructed/signal/hCPAXYRecSig"), candidate.cpaXY(), ptCandidate); registry.fill(HIST("MC/reconstructed/signal/hEtaRecSig"), candidate.eta(), ptCandidate); @@ -556,7 +555,7 @@ struct HfTaskXic { registry.fill(HIST("MC/reconstructed/background/hd0Prong0RecBg"), candidate.impactParameter0(), ptCandidate); registry.fill(HIST("MC/reconstructed/background/hd0Prong1RecBg"), candidate.impactParameter1(), ptCandidate); registry.fill(HIST("MC/reconstructed/background/hd0Prong2RecBg"), candidate.impactParameter2(), ptCandidate); - registry.fill(HIST("MC/reconstructed/background/hCtRecBg"), hfHelper.ctXic(candidate), ptCandidate); + registry.fill(HIST("MC/reconstructed/background/hCtRecBg"), HfHelper::ctXic(candidate), ptCandidate); registry.fill(HIST("MC/reconstructed/background/hCPARecBg"), candidate.cpa(), ptCandidate); registry.fill(HIST("MC/reconstructed/background/hCPAXYRecBg"), candidate.cpaXY(), ptCandidate); registry.fill(HIST("MC/reconstructed/background/hEtaRecBg"), candidate.eta(), ptCandidate); diff --git a/PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx b/PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx index 5bf3f321076..7c26b24dddd 100644 --- a/PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx +++ b/PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx @@ -60,7 +60,6 @@ struct HfTaskXic0ToXiPi { Configurable yCandGenMax{"yCandGenMax", 0.8, "max. gen particle rapidity"}; Configurable yCandRecMax{"yCandRecMax", 0.8, "max. cand. rapidity"}; - HfHelper hfHelper; SliceCache cache; using TracksMc = soa::Join; diff --git a/PWGHF/D2H/Tasks/taskXicc.cxx b/PWGHF/D2H/Tasks/taskXicc.cxx index 35e18de7ba5..f75ca850c81 100644 --- a/PWGHF/D2H/Tasks/taskXicc.cxx +++ b/PWGHF/D2H/Tasks/taskXicc.cxx @@ -57,8 +57,6 @@ struct HfTaskXicc { Configurable yCandMax{"yCandMax", -1., "max. cand. rapidity"}; Configurable> binsPt{"binsPt", std::vector{hf_cuts_xicc_to_p_k_pi_pi::vecBinsPt}, "pT bin limits"}; - HfHelper hfHelper; - Filter filterSelectCandidates = (aod::hf_sel_candidate_xicc::isSelXiccToPKPiPi >= selectionFlagXicc); HistogramRegistry registry{ @@ -92,10 +90,10 @@ struct HfTaskXicc { if ((candidate.hfflag() & 1 << aod::hf_cand_xicc::DecayType::XiccToXicPi) == 0) { continue; } - if (yCandMax >= 0. && std::abs(hfHelper.yXicc(candidate)) > yCandMax) { + if (yCandMax >= 0. && std::abs(HfHelper::yXicc(candidate)) > yCandMax) { continue; } - registry.fill(HIST("hMass"), hfHelper.invMassXiccToXicPi(candidate), candidate.pt()); // FIXME need to consider the two mass hp + registry.fill(HIST("hMass"), HfHelper::invMassXiccToXicPi(candidate), candidate.pt()); // FIXME need to consider the two mass hp registry.fill(HIST("hPtCand"), candidate.pt()); registry.fill(HIST("hPtProng0"), candidate.ptProng0()); registry.fill(HIST("hPtProng1"), candidate.ptProng1()); @@ -104,10 +102,10 @@ struct HfTaskXicc { registry.fill(HIST("hChi2PCA"), candidate.chi2PCA(), candidate.pt()); registry.fill(HIST("hd0Prong0"), candidate.impactParameter0(), candidate.pt()); registry.fill(HIST("hd0Prong1"), candidate.impactParameter1(), candidate.pt()); - registry.fill(HIST("hCt"), hfHelper.ctXicc(candidate), candidate.pt()); + registry.fill(HIST("hCt"), HfHelper::ctXicc(candidate), candidate.pt()); registry.fill(HIST("hCPA"), candidate.cpa(), candidate.pt()); registry.fill(HIST("hEta"), candidate.eta(), candidate.pt()); - registry.fill(HIST("hY"), hfHelper.yXicc(candidate), candidate.pt()); + registry.fill(HIST("hY"), HfHelper::yXicc(candidate), candidate.pt()); registry.fill(HIST("hSelectionStatus"), candidate.isSelXiccToPKPiPi(), candidate.pt()); registry.fill(HIST("hImpParErr0"), candidate.errorImpactParameter0(), candidate.pt()); registry.fill(HIST("hImpParErr1"), candidate.errorImpactParameter1(), candidate.pt()); @@ -122,8 +120,6 @@ struct HfTaskXiccMc { Configurable yCandMax{"yCandMax", -1., "max. cand. rapidity"}; Configurable> binsPt{"binsPt", std::vector{hf_cuts_xicc_to_p_k_pi_pi::vecBinsPt}, "pT bin limits"}; - HfHelper hfHelper; - Filter filterSelectCandidates = (aod::hf_sel_candidate_xicc::isSelXiccToPKPiPi >= selectionFlagXicc); HistogramRegistry registry{ @@ -200,7 +196,7 @@ struct HfTaskXiccMc { if ((candidate.hfflag() & 1 << aod::hf_cand_xicc::DecayType::XiccToXicPi) == 0) { continue; } - if (yCandMax >= 0. && std::abs(hfHelper.yXicc(candidate)) > yCandMax) { + if (yCandMax >= 0. && std::abs(HfHelper::yXicc(candidate)) > yCandMax) { continue; } if (std::abs(candidate.flagMcMatchRec()) == 1 << aod::hf_cand_xicc::DecayType::XiccToXicPi) { @@ -223,17 +219,17 @@ struct HfTaskXiccMc { registry.fill(HIST("hPtGenSig"), particleXicc.pt()); // gen. level pT registry.fill(HIST("hPtRecSig"), candidate.pt()); // rec. level pT registry.fill(HIST("hEtaRecSig"), candidate.eta()); - registry.fill(HIST("hYRecSig"), hfHelper.yXicc(candidate)); - registry.fill(HIST("hMassVsPtRecSig"), hfHelper.invMassXiccToXicPi(candidate), candidate.pt()); // FIXME need to consider the two mass hp + registry.fill(HIST("hYRecSig"), HfHelper::yXicc(candidate)); + registry.fill(HIST("hMassVsPtRecSig"), HfHelper::invMassXiccToXicPi(candidate), candidate.pt()); // FIXME need to consider the two mass hp registry.fill(HIST("hDecLengthVsPtRecSig"), candidate.decayLength(), candidate.pt()); registry.fill(HIST("hChi2PCAVsPtRecSig"), candidate.chi2PCA(), candidate.pt()); registry.fill(HIST("hCPAVsPtRecSig"), candidate.cpa(), candidate.pt()); registry.fill(HIST("hd0Prong0VsPtRecSig"), candidate.impactParameter0(), candidate.pt()); registry.fill(HIST("hd0Prong1VsPtRecSig"), candidate.impactParameter1(), candidate.pt()); registry.fill(HIST("hd0d0VsPtRecSig"), candidate.impactParameterProduct(), candidate.pt()); - registry.fill(HIST("hCtVsPtRecSig"), hfHelper.ctXicc(candidate), candidate.pt()); + registry.fill(HIST("hCtVsPtRecSig"), HfHelper::ctXicc(candidate), candidate.pt()); registry.fill(HIST("hEtaVsPtRecSig"), candidate.eta(), candidate.pt()); - registry.fill(HIST("hYVsPtRecSig"), hfHelper.yXicc(candidate), candidate.pt()); + registry.fill(HIST("hYVsPtRecSig"), HfHelper::yXicc(candidate), candidate.pt()); registry.fill(HIST("hImpParErr0VsPtRecSig"), candidate.errorImpactParameter0(), candidate.pt()); registry.fill(HIST("hImpParErr1VsPtRecSig"), candidate.errorImpactParameter1(), candidate.pt()); registry.fill(HIST("hXSecVtxPosRecGenDiffSig"), candidate.xSecondaryVertex() - particleXic.vx(), candidate.pt()); @@ -241,38 +237,38 @@ struct HfTaskXiccMc { registry.fill(HIST("hZSecVtxPosRecGenDiffSig"), candidate.zSecondaryVertex() - particleXic.vz(), candidate.pt()); registry.fill(HIST("hPtRecGenDiffSig"), candidate.pt() - particleXicc.pt(), candidate.pt()); // Check Y dependence (To be removed) - registry.fill(HIST("hMassVsPtVsYRecSig"), hfHelper.invMassXiccToXicPi(candidate), candidate.pt(), hfHelper.yXicc(candidate)); - registry.fill(HIST("hDecLengthVsPtVsYRecSig"), candidate.decayLength(), candidate.pt(), hfHelper.yXicc(candidate)); - registry.fill(HIST("hChi2PCAVsPtVsYRecSig"), candidate.chi2PCA(), candidate.pt(), hfHelper.yXicc(candidate)); - registry.fill(HIST("hCPAVsPtVsYRecSig"), candidate.cpa(), candidate.pt(), hfHelper.yXicc(candidate)); - registry.fill(HIST("hd0Prong0VsPtVsYRecSig"), candidate.impactParameter0(), candidate.pt(), hfHelper.yXicc(candidate)); - registry.fill(HIST("hd0Prong1VsPtVsYRecSig"), candidate.impactParameter1(), candidate.pt(), hfHelper.yXicc(candidate)); - registry.fill(HIST("hCtVsPtVsYRecSig"), hfHelper.ctXicc(candidate), candidate.pt(), hfHelper.yXicc(candidate)); + registry.fill(HIST("hMassVsPtVsYRecSig"), HfHelper::invMassXiccToXicPi(candidate), candidate.pt(), HfHelper::yXicc(candidate)); + registry.fill(HIST("hDecLengthVsPtVsYRecSig"), candidate.decayLength(), candidate.pt(), HfHelper::yXicc(candidate)); + registry.fill(HIST("hChi2PCAVsPtVsYRecSig"), candidate.chi2PCA(), candidate.pt(), HfHelper::yXicc(candidate)); + registry.fill(HIST("hCPAVsPtVsYRecSig"), candidate.cpa(), candidate.pt(), HfHelper::yXicc(candidate)); + registry.fill(HIST("hd0Prong0VsPtVsYRecSig"), candidate.impactParameter0(), candidate.pt(), HfHelper::yXicc(candidate)); + registry.fill(HIST("hd0Prong1VsPtVsYRecSig"), candidate.impactParameter1(), candidate.pt(), HfHelper::yXicc(candidate)); + registry.fill(HIST("hCtVsPtVsYRecSig"), HfHelper::ctXicc(candidate), candidate.pt(), HfHelper::yXicc(candidate)); } else { registry.fill(HIST("hPtRecBg"), candidate.pt()); registry.fill(HIST("hEtaRecBg"), candidate.eta()); - registry.fill(HIST("hYRecBg"), hfHelper.yXicc(candidate)); - registry.fill(HIST("hMassVsPtRecBg"), hfHelper.invMassXiccToXicPi(candidate), candidate.pt()); // FIXME need to consider the two mass hp + registry.fill(HIST("hYRecBg"), HfHelper::yXicc(candidate)); + registry.fill(HIST("hMassVsPtRecBg"), HfHelper::invMassXiccToXicPi(candidate), candidate.pt()); // FIXME need to consider the two mass hp registry.fill(HIST("hDecLengthVsPtRecBg"), candidate.decayLength(), candidate.pt()); registry.fill(HIST("hChi2PCAVsPtRecBg"), candidate.chi2PCA(), candidate.pt()); registry.fill(HIST("hCPAVsPtRecBg"), candidate.cpa(), candidate.pt()); registry.fill(HIST("hd0Prong0VsPtRecBg"), candidate.impactParameter0(), candidate.pt()); registry.fill(HIST("hd0Prong1VsPtRecBg"), candidate.impactParameter1(), candidate.pt()); registry.fill(HIST("hd0d0VsPtRecBg"), candidate.impactParameterProduct(), candidate.pt()); - registry.fill(HIST("hCtVsPtRecBg"), hfHelper.ctXicc(candidate), candidate.pt()); + registry.fill(HIST("hCtVsPtRecBg"), HfHelper::ctXicc(candidate), candidate.pt()); registry.fill(HIST("hEtaVsPtRecBg"), candidate.eta(), candidate.pt()); - registry.fill(HIST("hYVsPtRecBg"), hfHelper.yXicc(candidate), candidate.pt()); + registry.fill(HIST("hYVsPtRecBg"), HfHelper::yXicc(candidate), candidate.pt()); registry.fill(HIST("hImpParErr0VsPtRecBg"), candidate.errorImpactParameter0(), candidate.pt()); registry.fill(HIST("hImpParErr1VsPtRecBg"), candidate.errorImpactParameter1(), candidate.pt()); registry.fill(HIST("hDebugMCmatching"), candidate.debugMcRec(), candidate.pt()); // Check Y dependence (To be removed) - registry.fill(HIST("hMassVsPtVsYRecBg"), hfHelper.invMassXiccToXicPi(candidate), candidate.pt(), hfHelper.yXicc(candidate)); - registry.fill(HIST("hDecLengthVsPtVsYRecBg"), candidate.decayLength(), candidate.pt(), hfHelper.yXicc(candidate)); - registry.fill(HIST("hChi2PCAVsPtVsYRecBg"), candidate.chi2PCA(), candidate.pt(), hfHelper.yXicc(candidate)); - registry.fill(HIST("hCPAVsPtVsYRecBg"), candidate.cpa(), candidate.pt(), hfHelper.yXicc(candidate)); - registry.fill(HIST("hd0Prong0VsPtVsYRecBg"), candidate.impactParameter0(), candidate.pt(), hfHelper.yXicc(candidate)); - registry.fill(HIST("hd0Prong1VsPtVsYRecBg"), candidate.impactParameter1(), candidate.pt(), hfHelper.yXicc(candidate)); - registry.fill(HIST("hCtVsPtVsYRecBg"), hfHelper.ctXicc(candidate), candidate.pt(), hfHelper.yXicc(candidate)); + registry.fill(HIST("hMassVsPtVsYRecBg"), HfHelper::invMassXiccToXicPi(candidate), candidate.pt(), HfHelper::yXicc(candidate)); + registry.fill(HIST("hDecLengthVsPtVsYRecBg"), candidate.decayLength(), candidate.pt(), HfHelper::yXicc(candidate)); + registry.fill(HIST("hChi2PCAVsPtVsYRecBg"), candidate.chi2PCA(), candidate.pt(), HfHelper::yXicc(candidate)); + registry.fill(HIST("hCPAVsPtVsYRecBg"), candidate.cpa(), candidate.pt(), HfHelper::yXicc(candidate)); + registry.fill(HIST("hd0Prong0VsPtVsYRecBg"), candidate.impactParameter0(), candidate.pt(), HfHelper::yXicc(candidate)); + registry.fill(HIST("hd0Prong1VsPtVsYRecBg"), candidate.impactParameter1(), candidate.pt(), HfHelper::yXicc(candidate)); + registry.fill(HIST("hCtVsPtVsYRecBg"), HfHelper::ctXicc(candidate), candidate.pt(), HfHelper::yXicc(candidate)); } } // end of loop over reconstructed candidates // MC gen. diff --git a/PWGHF/HFC/TableProducer/correlatorD0D0bar.cxx b/PWGHF/HFC/TableProducer/correlatorD0D0bar.cxx index b72ca63a212..dbef6c1ee60 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0D0bar.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0D0bar.cxx @@ -100,8 +100,6 @@ struct HfCorrelatorD0D0bar { Configurable> binsPt{"binsPt", std::vector{o2::analysis::hf_cuts_d0_to_pi_k::vecBinsPt}, "pT bin limits for candidate mass plots and efficiency"}; Configurable> efficiencyD{"efficiencyD", std::vector{efficiencyDmesonV}, "Efficiency values for D0 meson"}; - HfHelper hfHelper; - Partition> selectedD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; Partition> selectedD0candidatesMC = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; @@ -177,7 +175,7 @@ struct HfCorrelatorD0D0bar { auto selectedD0CandidatesGrouped = selectedD0Candidates->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); for (const auto& candidate1 : selectedD0CandidatesGrouped) { - if (yCandMax >= 0. && std::abs(hfHelper.yD0(candidate1)) > yCandMax) { + if (yCandMax >= 0. && std::abs(HfHelper::yD0(candidate1)) > yCandMax) { continue; } if (ptCandMin >= 0. && candidate1.pt() < ptCandMin) { @@ -195,19 +193,19 @@ struct HfCorrelatorD0D0bar { // fill invariant mass plots and generic info from all D0/D0bar candidates if (candidate1.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hMass"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); - registry.fill(HIST("hMassD0"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMass"), HfHelper::invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMassD0"), HfHelper::invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); } if (candidate1.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hMass"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); - registry.fill(HIST("hMassD0bar"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMass"), HfHelper::invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMassD0bar"), HfHelper::invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); } registry.fill(HIST("hPtCand"), candidate1.pt()); registry.fill(HIST("hPtProng0"), candidate1.ptProng0()); registry.fill(HIST("hPtProng1"), candidate1.ptProng1()); registry.fill(HIST("hEta"), candidate1.eta()); registry.fill(HIST("hPhi"), candidate1.phi()); - registry.fill(HIST("hY"), hfHelper.yD0(candidate1)); + registry.fill(HIST("hY"), HfHelper::yD0(candidate1)); registry.fill(HIST("hSelectionStatus"), candidate1.isSelD0bar() + (candidate1.isSelD0() * 2)); // D-Dbar correlation dedicated section @@ -223,7 +221,7 @@ struct HfCorrelatorD0D0bar { continue; } // kinematic selection on D0bar candidates - if (yCandMax >= 0. && std::abs(hfHelper.yD0(candidate2)) > yCandMax) { + if (yCandMax >= 0. && std::abs(HfHelper::yD0(candidate2)) > yCandMax) { continue; } if (ptCandMin >= 0. && candidate2.pt() < ptCandMin) { @@ -237,8 +235,8 @@ struct HfCorrelatorD0D0bar { candidate2.eta() - candidate1.eta(), candidate1.pt(), candidate2.pt()); - entryD0D0barRecoInfo(hfHelper.invMassD0ToPiK(candidate1), - hfHelper.invMassD0barToKPi(candidate2), + entryD0D0barRecoInfo(HfHelper::invMassD0ToPiK(candidate1), + HfHelper::invMassD0barToKPi(candidate2), 0); double etaCut = 0.; double ptCut = 0.; @@ -297,7 +295,7 @@ struct HfCorrelatorD0D0bar { if ((candidate1.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) == 0) { continue; } - if (yCandMax >= 0. && std::abs(hfHelper.yD0(candidate1)) > yCandMax) { + if (yCandMax >= 0. && std::abs(HfHelper::yD0(candidate1)) > yCandMax) { continue; } if (ptCandMin >= 0. && candidate1.pt() < ptCandMin) { @@ -316,26 +314,26 @@ struct HfCorrelatorD0D0bar { registry.fill(HIST("hPtProng1MCRec"), candidate1.ptProng1()); registry.fill(HIST("hEtaMCRec"), candidate1.eta()); registry.fill(HIST("hPhiMCRec"), candidate1.phi()); - registry.fill(HIST("hYMCRec"), hfHelper.yD0(candidate1)); + registry.fill(HIST("hYMCRec"), HfHelper::yD0(candidate1)); registry.fill(HIST("hSelectionStatusMCRec"), candidate1.isSelD0bar() + (candidate1.isSelD0() * 2)); } // fill invariant mass plots from D0/D0bar signal and background candidates if (candidate1.isSelD0() >= selectionFlagD0) { // only reco as D0 if (candidate1.flagMcMatchRec() == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { // also matched as D0 - registry.fill(HIST("hMassD0MCRecSig"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMassD0MCRecSig"), HfHelper::invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); } else if (candidate1.flagMcMatchRec() == -o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { - registry.fill(HIST("hMassD0MCRecRefl"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMassD0MCRecRefl"), HfHelper::invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); } else { - registry.fill(HIST("hMassD0MCRecBkg"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMassD0MCRecBkg"), HfHelper::invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); } } if (candidate1.isSelD0bar() >= selectionFlagD0bar) { // only reco as D0bar if (candidate1.flagMcMatchRec() == -o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { // also matched as D0bar - registry.fill(HIST("hMassD0barMCRecSig"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMassD0barMCRecSig"), HfHelper::invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); } else if (candidate1.flagMcMatchRec() == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { - registry.fill(HIST("hMassD0barMCRecRefl"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMassD0barMCRecRefl"), HfHelper::invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); } else { - registry.fill(HIST("hMassD0barMCRecBkg"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMassD0barMCRecBkg"), HfHelper::invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); } } @@ -355,7 +353,7 @@ struct HfCorrelatorD0D0bar { } flagD0barSignal = candidate2.flagMcMatchRec() == -o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK; // flagD0barSignal 'true' if candidate2 matched to D0bar (antiparticle) flagD0barReflection = candidate2.flagMcMatchRec() == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK; // flagD0barReflection 'true' if candidate2, selected as D0bar (antiparticle), is matched to D0 (particle) - if (yCandMax >= 0. && std::abs(hfHelper.yD0(candidate2)) > yCandMax) { + if (yCandMax >= 0. && std::abs(HfHelper::yD0(candidate2)) > yCandMax) { continue; } if (ptCandMin >= 0. && candidate2.pt() < ptCandMin) { @@ -383,8 +381,8 @@ struct HfCorrelatorD0D0bar { candidate2.eta() - candidate1.eta(), candidate1.pt(), candidate2.pt()); - entryD0D0barRecoInfo(hfHelper.invMassD0ToPiK(candidate1), - hfHelper.invMassD0barToKPi(candidate2), + entryD0D0barRecoInfo(HfHelper::invMassD0ToPiK(candidate1), + HfHelper::invMassD0barToKPi(candidate2), pairSignalStatus); double etaCut = 0.; double ptCut = 0.; diff --git a/PWGHF/HFC/TableProducer/correlatorD0D0barBarrelFullPid.cxx b/PWGHF/HFC/TableProducer/correlatorD0D0barBarrelFullPid.cxx index 7211c0152bd..a7efa82e7bd 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0D0barBarrelFullPid.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0D0barBarrelFullPid.cxx @@ -101,8 +101,6 @@ struct HfCorrelatorD0D0barBarrelFullPid { Configurable> binsPt{"binsPt", std::vector{o2::analysis::hf_cuts_d0_to_pi_k::vecBinsPt}, "pT bin limits for candidate mass plots and efficiency"}; Configurable> efficiencyD{"efficiencyD", std::vector{efficiencyDmesonV}, "Efficiency values for D0 meson"}; - HfHelper hfHelper; - Partition> selectedD0candidates = (aod::hf_sel_candidate_d0_alice3_barrel::isSelD0TofPlusRichPid >= selectionFlagD0 || aod::hf_sel_candidate_d0_alice3_barrel::isSelD0barTofPlusRichPid >= selectionFlagD0bar); Partition> selectedD0candidatesMC = (aod::hf_sel_candidate_d0_alice3_barrel::isSelD0TofPlusRichPid >= selectionFlagD0 || aod::hf_sel_candidate_d0_alice3_barrel::isSelD0barTofPlusRichPid >= selectionFlagD0bar); @@ -178,7 +176,7 @@ struct HfCorrelatorD0D0barBarrelFullPid { auto selectedD0candidatesGrouped = selectedD0candidates->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); for (const auto& candidate1 : selectedD0candidatesGrouped) { - if (yCandMax >= 0. && std::abs(hfHelper.yD0(candidate1)) > yCandMax) { + if (yCandMax >= 0. && std::abs(HfHelper::yD0(candidate1)) > yCandMax) { continue; } if (ptCandMin >= 0. && candidate1.pt() < ptCandMin) { @@ -196,19 +194,19 @@ struct HfCorrelatorD0D0barBarrelFullPid { // fill invariant mass plots and generic info from all D0/D0bar candidates if (candidate1.isSelD0TofPlusRichPid() >= selectionFlagD0) { - registry.fill(HIST("hMass"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); - registry.fill(HIST("hMassD0"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMass"), HfHelper::invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMassD0"), HfHelper::invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); } if (candidate1.isSelD0barTofPlusRichPid() >= selectionFlagD0bar) { - registry.fill(HIST("hMass"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); - registry.fill(HIST("hMassD0bar"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMass"), HfHelper::invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMassD0bar"), HfHelper::invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); } registry.fill(HIST("hPtCand"), candidate1.pt()); registry.fill(HIST("hPtProng0"), candidate1.ptProng0()); registry.fill(HIST("hPtProng1"), candidate1.ptProng1()); registry.fill(HIST("hEta"), candidate1.eta()); registry.fill(HIST("hPhi"), candidate1.phi()); - registry.fill(HIST("hY"), hfHelper.yD0(candidate1)); + registry.fill(HIST("hY"), HfHelper::yD0(candidate1)); registry.fill(HIST("hSelectionStatus"), candidate1.isSelD0barTofPlusRichPid() + (candidate1.isSelD0TofPlusRichPid() * 2)); // D-Dbar correlation dedicated section @@ -224,7 +222,7 @@ struct HfCorrelatorD0D0barBarrelFullPid { continue; } // kinematic selection on D0bar candidates - if (yCandMax >= 0. && std::abs(hfHelper.yD0(candidate2)) > yCandMax) { + if (yCandMax >= 0. && std::abs(HfHelper::yD0(candidate2)) > yCandMax) { continue; } if (ptCandMin >= 0. && candidate2.pt() < ptCandMin) { @@ -238,8 +236,8 @@ struct HfCorrelatorD0D0barBarrelFullPid { candidate2.eta() - candidate1.eta(), candidate1.pt(), candidate2.pt()); - entryD0D0barRecoInfo(hfHelper.invMassD0ToPiK(candidate1), - hfHelper.invMassD0barToKPi(candidate2), + entryD0D0barRecoInfo(HfHelper::invMassD0ToPiK(candidate1), + HfHelper::invMassD0barToKPi(candidate2), 0); double etaCut = 0.; double ptCut = 0.; @@ -298,7 +296,7 @@ struct HfCorrelatorD0D0barBarrelFullPid { if ((candidate1.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) == 0) { continue; } - if (yCandMax >= 0. && std::abs(hfHelper.yD0(candidate1)) > yCandMax) { + if (yCandMax >= 0. && std::abs(HfHelper::yD0(candidate1)) > yCandMax) { continue; } if (ptCandMin >= 0. && candidate1.pt() < ptCandMin) { @@ -317,26 +315,26 @@ struct HfCorrelatorD0D0barBarrelFullPid { registry.fill(HIST("hPtProng1MCRec"), candidate1.ptProng1()); registry.fill(HIST("hEtaMCRec"), candidate1.eta()); registry.fill(HIST("hPhiMCRec"), candidate1.phi()); - registry.fill(HIST("hYMCRec"), hfHelper.yD0(candidate1)); + registry.fill(HIST("hYMCRec"), HfHelper::yD0(candidate1)); registry.fill(HIST("hSelectionStatusMCRec"), candidate1.isSelD0barTofPlusRichPid() + (candidate1.isSelD0TofPlusRichPid() * 2)); } // fill invariant mass plots from D0/D0bar signal and background candidates if (candidate1.isSelD0TofPlusRichPid() >= selectionFlagD0) { // only reco as D0 if (candidate1.flagMcMatchRec() == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { // also matched as D0 - registry.fill(HIST("hMassD0MCRecSig"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMassD0MCRecSig"), HfHelper::invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); } else if (candidate1.flagMcMatchRec() == -o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { - registry.fill(HIST("hMassD0MCRecRefl"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMassD0MCRecRefl"), HfHelper::invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); } else { - registry.fill(HIST("hMassD0MCRecBkg"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMassD0MCRecBkg"), HfHelper::invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); } } if (candidate1.isSelD0barTofPlusRichPid() >= selectionFlagD0bar) { // only reco as D0bar if (candidate1.flagMcMatchRec() == -o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { // also matched as D0bar - registry.fill(HIST("hMassD0barMCRecSig"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMassD0barMCRecSig"), HfHelper::invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); } else if (candidate1.flagMcMatchRec() == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { - registry.fill(HIST("hMassD0barMCRecRefl"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMassD0barMCRecRefl"), HfHelper::invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); } else { - registry.fill(HIST("hMassD0barMCRecBkg"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMassD0barMCRecBkg"), HfHelper::invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); } } @@ -356,7 +354,7 @@ struct HfCorrelatorD0D0barBarrelFullPid { } flagD0barSignal = candidate2.flagMcMatchRec() == -o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK; // flagD0barSignal 'true' if candidate2 matched to D0bar (antiparticle) flagD0barReflection = candidate2.flagMcMatchRec() == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK; // flagD0barReflection 'true' if candidate2, selected as D0bar (antiparticle), is matched to D0 (particle) - if (yCandMax >= 0. && std::abs(hfHelper.yD0(candidate2)) > yCandMax) { + if (yCandMax >= 0. && std::abs(HfHelper::yD0(candidate2)) > yCandMax) { continue; } if (ptCandMin >= 0. && candidate2.pt() < ptCandMin) { @@ -384,8 +382,8 @@ struct HfCorrelatorD0D0barBarrelFullPid { candidate2.eta() - candidate1.eta(), candidate1.pt(), candidate2.pt()); - entryD0D0barRecoInfo(hfHelper.invMassD0ToPiK(candidate1), - hfHelper.invMassD0barToKPi(candidate2), + entryD0D0barRecoInfo(HfHelper::invMassD0ToPiK(candidate1), + HfHelper::invMassD0barToKPi(candidate2), pairSignalStatus); double etaCut = 0.; double ptCut = 0.; diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index a762603c5ae..fd52a524c81 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -97,7 +97,6 @@ struct HfCorrelatorD0HadronsSelection { Configurable yCandMax{"yCandMax", 4.0, "max. cand. rapidity"}; Configurable ptCandMin{"ptCandMin", -1., "min. cand. pT"}; - HfHelper hfHelper; SliceCache cache; using SelCollisions = soa::Join; @@ -123,7 +122,7 @@ struct HfCorrelatorD0HadronsSelection { isD0Found = false; continue; } - if (std::abs(hfHelper.yD0(candidate)) > yCandMax || candidate.pt() < ptCandMin) { + if (std::abs(HfHelper::yD0(candidate)) > yCandMax || candidate.pt() < ptCandMin) { isD0Found = false; continue; } @@ -157,7 +156,7 @@ struct HfCorrelatorD0HadronsSelection { isD0Found = false; continue; } - if (std::abs(hfHelper.yD0(candidate)) > yCandMax || candidate.pt() < ptCandMin) { + if (std::abs(HfHelper::yD0(candidate)) > yCandMax || candidate.pt() < ptCandMin) { isD0Found = false; continue; } @@ -234,7 +233,6 @@ struct HfCorrelatorD0Hadrons { double massK{0.}; double softPiMass = 0.14543; // pion mass + Q-value of the D*->D0pi decay - HfHelper hfHelper; SliceCache cache; Filter collisionFilter = aod::hf_selection_dmeson_collision::dmesonSel == true; @@ -384,7 +382,7 @@ struct HfCorrelatorD0Hadrons { std::vector outputMlD0bar = {-1., -1., -1.}; for (const auto& candidate : candidates) { - if (std::abs(hfHelper.yD0(candidate)) >= yCandMax || candidate.pt() <= ptCandMin || candidate.pt() >= ptTrackMax) { + if (std::abs(HfHelper::yD0(candidate)) >= yCandMax || candidate.pt() <= ptCandMin || candidate.pt() >= ptTrackMax) { continue; } // check decay channel flag for candidate @@ -403,24 +401,24 @@ struct HfCorrelatorD0Hadrons { } // ========================== Fill mass histo ================================ if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hMass"), hfHelper.invMassD0ToPiK(candidate), candidate.pt(), efficiencyWeight); - registry.fill(HIST("hMass1D"), hfHelper.invMassD0ToPiK(candidate), efficiencyWeight); - registry.fill(HIST("hMassD01D"), hfHelper.invMassD0ToPiK(candidate), efficiencyWeight); + registry.fill(HIST("hMass"), HfHelper::invMassD0ToPiK(candidate), candidate.pt(), efficiencyWeight); + registry.fill(HIST("hMass1D"), HfHelper::invMassD0ToPiK(candidate), efficiencyWeight); + registry.fill(HIST("hMassD01D"), HfHelper::invMassD0ToPiK(candidate), efficiencyWeight); for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMlD0[iclass] = candidate.mlProbD0()[classMl->at(iclass)]; } - registry.fill(HIST("hMLScoresVsMassVsPtVsOrigin"), outputMlD0[0], outputMlD0[2], hfHelper.invMassD0ToPiK(candidate), candidate.pt(), (candidate.isSelD0bar() != 0) ? o2::aod::hf_correlation_d0_hadron::D0D0barBoth : o2::aod::hf_correlation_d0_hadron::D0Only); + registry.fill(HIST("hMLScoresVsMassVsPtVsOrigin"), outputMlD0[0], outputMlD0[2], HfHelper::invMassD0ToPiK(candidate), candidate.pt(), (candidate.isSelD0bar() != 0) ? o2::aod::hf_correlation_d0_hadron::D0D0barBoth : o2::aod::hf_correlation_d0_hadron::D0Only); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hMass"), hfHelper.invMassD0barToKPi(candidate), candidate.pt(), efficiencyWeight); - registry.fill(HIST("hMass1D"), hfHelper.invMassD0barToKPi(candidate), efficiencyWeight); - registry.fill(HIST("hMassD0bar1D"), hfHelper.invMassD0barToKPi(candidate), efficiencyWeight); + registry.fill(HIST("hMass"), HfHelper::invMassD0barToKPi(candidate), candidate.pt(), efficiencyWeight); + registry.fill(HIST("hMass1D"), HfHelper::invMassD0barToKPi(candidate), efficiencyWeight); + registry.fill(HIST("hMassD0bar1D"), HfHelper::invMassD0barToKPi(candidate), efficiencyWeight); for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMlD0bar[iclass] = candidate.mlProbD0bar()[classMl->at(iclass)]; } - registry.fill(HIST("hMLScoresVsMassVsPtVsOrigin"), outputMlD0bar[0], outputMlD0bar[2], hfHelper.invMassD0barToKPi(candidate), candidate.pt(), (candidate.isSelD0() != 0) ? o2::aod::hf_correlation_d0_hadron::D0D0barBoth : o2::aod::hf_correlation_d0_hadron::D0barOnly); + registry.fill(HIST("hMLScoresVsMassVsPtVsOrigin"), outputMlD0bar[0], outputMlD0bar[2], HfHelper::invMassD0barToKPi(candidate), candidate.pt(), (candidate.isSelD0() != 0) ? o2::aod::hf_correlation_d0_hadron::D0D0barBoth : o2::aod::hf_correlation_d0_hadron::D0barOnly); } - entryD0CandRecoInfo(hfHelper.invMassD0ToPiK(candidate), hfHelper.invMassD0barToKPi(candidate), candidate.pt(), outputMlD0[0], outputMlD0[2], outputMlD0bar[0], outputMlD0bar[2]); + entryD0CandRecoInfo(HfHelper::invMassD0ToPiK(candidate), HfHelper::invMassD0barToKPi(candidate), candidate.pt(), outputMlD0[0], outputMlD0[2], outputMlD0bar[0], outputMlD0bar[2]); // ========================== Fill general histos ================================ registry.fill(HIST("hPtCand"), candidate.pt()); @@ -428,7 +426,7 @@ struct HfCorrelatorD0Hadrons { registry.fill(HIST("hPtProng1"), candidate.ptProng1()); registry.fill(HIST("hEta"), candidate.eta()); registry.fill(HIST("hPhi"), candidate.phi()); - registry.fill(HIST("hY"), hfHelper.yD0(candidate)); + registry.fill(HIST("hY"), HfHelper::yD0(candidate)); registry.fill(HIST("hSelectionStatus"), candidate.isSelD0bar() + (candidate.isSelD0() * 2)); registry.fill(HIST("hD0PoolBin"), poolBin); @@ -455,13 +453,13 @@ struct HfCorrelatorD0Hadrons { invMassDstar2 = std::sqrt((eKPi + ePion) * (eKPi + ePion) - pSum2); if (candidate.isSelD0() >= selectionFlagD0) { - if ((std::abs(invMassDstar1 - hfHelper.invMassD0ToPiK(candidate)) - softPiMass) < ptSoftPionMax) { + if ((std::abs(invMassDstar1 - HfHelper::invMassD0ToPiK(candidate)) - softPiMass) < ptSoftPionMax) { continue; } } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - if ((std::abs(invMassDstar2 - hfHelper.invMassD0barToKPi(candidate)) - softPiMass) < ptSoftPionMax) { + if ((std::abs(invMassDstar2 - HfHelper::invMassD0barToKPi(candidate)) - softPiMass) < ptSoftPionMax) { continue; } } @@ -487,7 +485,7 @@ struct HfCorrelatorD0Hadrons { track.pt(), poolBin, correlationStatus); - entryD0HadronRecoInfo(hfHelper.invMassD0ToPiK(candidate), hfHelper.invMassD0barToKPi(candidate), signalStatus); + entryD0HadronRecoInfo(HfHelper::invMassD0ToPiK(candidate), HfHelper::invMassD0barToKPi(candidate), signalStatus); entryD0HadronGenInfo(false, false, 0); entryD0HadronMlInfo(outputMlD0[0], outputMlD0[1], outputMlD0[2], outputMlD0bar[0], outputMlD0bar[1], outputMlD0bar[2]); entryTrackRecoInfo(track.dcaXY(), track.dcaZ(), track.tpcNClsCrossedRows()); @@ -545,7 +543,7 @@ struct HfCorrelatorD0Hadrons { if (!TESTBIT(candidate.hfflag(), aod::hf_cand_2prong::DecayType::D0ToPiK)) { continue; } - if (std::abs(hfHelper.yD0(candidate)) >= yCandMax || candidate.pt() <= ptCandMin || candidate.pt() >= ptTrackMax) { + if (std::abs(HfHelper::yD0(candidate)) >= yCandMax || candidate.pt() <= ptCandMin || candidate.pt() >= ptTrackMax) { continue; } @@ -563,13 +561,13 @@ struct HfCorrelatorD0Hadrons { registry.fill(HIST("hPtProng1Rec"), candidate.ptProng1()); registry.fill(HIST("hEtaRec"), candidate.eta()); registry.fill(HIST("hPhiRec"), candidate.phi()); - registry.fill(HIST("hYRec"), hfHelper.yD0(candidate)); + registry.fill(HIST("hYRec"), HfHelper::yD0(candidate)); registry.fill(HIST("hSelectionStatusRec"), candidate.isSelD0bar() + (candidate.isSelD0() * 2)); } // fill invariant mass plots from D0/D0bar signal and background candidates if (candidate.isSelD0() >= selectionFlagD0) { // only reco as D0 if (candidate.flagMcMatchRec() == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { // also matched as D0 - registry.fill(HIST("hMassD0RecSig"), hfHelper.invMassD0ToPiK(candidate), candidate.pt(), efficiencyWeight); + registry.fill(HIST("hMassD0RecSig"), HfHelper::invMassD0ToPiK(candidate), candidate.pt(), efficiencyWeight); if (isD0Prompt) { registry.fill(HIST("hPtCandRecSigPrompt"), candidate.pt()); registry.fill(HIST("hPtVsMultiplicityRecPrompt"), candidate.pt(), collision.multFT0M()); @@ -578,9 +576,9 @@ struct HfCorrelatorD0Hadrons { registry.fill(HIST("hPtVsMultiplicityRecNonPrompt"), candidate.pt(), collision.multFT0M()); } } else if (candidate.flagMcMatchRec() == -o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { - registry.fill(HIST("hMassD0RecRef"), hfHelper.invMassD0ToPiK(candidate), candidate.pt(), efficiencyWeight); + registry.fill(HIST("hMassD0RecRef"), HfHelper::invMassD0ToPiK(candidate), candidate.pt(), efficiencyWeight); } else { - registry.fill(HIST("hMassD0RecBg"), hfHelper.invMassD0ToPiK(candidate), candidate.pt(), efficiencyWeight); + registry.fill(HIST("hMassD0RecBg"), HfHelper::invMassD0ToPiK(candidate), candidate.pt(), efficiencyWeight); } for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMlD0[iclass] = candidate.mlProbD0()[classMl->at(iclass)]; @@ -588,7 +586,7 @@ struct HfCorrelatorD0Hadrons { } if (candidate.isSelD0bar() >= selectionFlagD0bar) { // only reco as D0bar if (candidate.flagMcMatchRec() == -o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { // also matched as D0bar - registry.fill(HIST("hMassD0barRecSig"), hfHelper.invMassD0barToKPi(candidate), candidate.pt(), efficiencyWeight); + registry.fill(HIST("hMassD0barRecSig"), HfHelper::invMassD0barToKPi(candidate), candidate.pt(), efficiencyWeight); if (isD0Prompt) { registry.fill(HIST("hPtCandRecSigPrompt"), candidate.pt()); registry.fill(HIST("hPtVsMultiplicityRecPrompt"), candidate.pt(), collision.multFT0M()); @@ -597,15 +595,15 @@ struct HfCorrelatorD0Hadrons { registry.fill(HIST("hPtVsMultiplicityRecNonPrompt"), candidate.pt(), collision.multFT0M()); } } else if (candidate.flagMcMatchRec() == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { - registry.fill(HIST("hMassD0barRecRef"), hfHelper.invMassD0barToKPi(candidate), candidate.pt(), efficiencyWeight); + registry.fill(HIST("hMassD0barRecRef"), HfHelper::invMassD0barToKPi(candidate), candidate.pt(), efficiencyWeight); } else { - registry.fill(HIST("hMassD0barRecBg"), hfHelper.invMassD0barToKPi(candidate), candidate.pt(), efficiencyWeight); + registry.fill(HIST("hMassD0barRecBg"), HfHelper::invMassD0barToKPi(candidate), candidate.pt(), efficiencyWeight); } for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMlD0bar[iclass] = candidate.mlProbD0bar()[classMl->at(iclass)]; } } - entryD0CandRecoInfo(hfHelper.invMassD0ToPiK(candidate), hfHelper.invMassD0barToKPi(candidate), candidate.pt(), outputMlD0[0], outputMlD0[2], outputMlD0bar[0], outputMlD0bar[2]); + entryD0CandRecoInfo(HfHelper::invMassD0ToPiK(candidate), HfHelper::invMassD0barToKPi(candidate), candidate.pt(), outputMlD0[0], outputMlD0[2], outputMlD0bar[0], outputMlD0bar[2]); entryD0CandGenInfo(isD0Prompt); // ===================== Define parameters for soft pion removal ======================== @@ -644,13 +642,13 @@ struct HfCorrelatorD0Hadrons { invMassDstar2 = std::sqrt((eKPi + ePion) * (eKPi + ePion) - pSum2); if (candidate.isSelD0() >= selectionFlagD0) { - if ((std::abs(invMassDstar1 - hfHelper.invMassD0ToPiK(candidate)) - softPiMass) < ptSoftPionMax) { + if ((std::abs(invMassDstar1 - HfHelper::invMassD0ToPiK(candidate)) - softPiMass) < ptSoftPionMax) { continue; } } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - if ((std::abs(invMassDstar2 - hfHelper.invMassD0barToKPi(candidate)) - softPiMass) < ptSoftPionMax) { + if ((std::abs(invMassDstar2 - HfHelper::invMassD0barToKPi(candidate)) - softPiMass) < ptSoftPionMax) { continue; } } @@ -691,7 +689,7 @@ struct HfCorrelatorD0Hadrons { track.pt(), poolBin, correlationStatus); - entryD0HadronRecoInfo(hfHelper.invMassD0ToPiK(candidate), hfHelper.invMassD0barToKPi(candidate), signalStatus); + entryD0HadronRecoInfo(HfHelper::invMassD0ToPiK(candidate), HfHelper::invMassD0barToKPi(candidate), signalStatus); entryD0HadronMlInfo(outputMlD0[0], outputMlD0[1], outputMlD0[2], outputMlD0bar[0], outputMlD0bar[1], outputMlD0bar[2]); if (track.has_mcParticle()) { auto mcParticle = track.template mcParticle_as(); @@ -840,7 +838,7 @@ struct HfCorrelatorD0Hadrons { registry.fill(HIST("hD0PoolBin"), poolBinD0); for (const auto& [candidate, particleAssoc] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - if (std::abs(hfHelper.yD0(candidate)) >= yCandMax || candidate.pt() < ptCandMin) { + if (std::abs(HfHelper::yD0(candidate)) >= yCandMax || candidate.pt() < ptCandMin) { continue; } @@ -857,7 +855,7 @@ struct HfCorrelatorD0Hadrons { std::vector outputMlD0bar = {-1., -1., -1.}; if (candidate.isSelD0() >= selectionFlagD0) { - if ((std::abs(invMassDstar1 - hfHelper.invMassD0ToPiK(candidate)) - softPiMass) < ptSoftPionMax) { + if ((std::abs(invMassDstar1 - HfHelper::invMassD0ToPiK(candidate)) - softPiMass) < ptSoftPionMax) { isSoftPiD0 = true; } for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { @@ -865,7 +863,7 @@ struct HfCorrelatorD0Hadrons { } } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - if ((std::abs(invMassDstar2 - hfHelper.invMassD0barToKPi(candidate)) - softPiMass) < ptSoftPionMax) { + if ((std::abs(invMassDstar2 - HfHelper::invMassD0barToKPi(candidate)) - softPiMass) < ptSoftPionMax) { isSoftPiD0bar = true; } for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { @@ -890,7 +888,7 @@ struct HfCorrelatorD0Hadrons { } bool correlationStatus = false; entryD0HadronPair(getDeltaPhi(candidate.phi(), particleAssoc.phi()), candidate.eta() - particleAssoc.eta(), candidate.pt(), particleAssoc.pt(), poolBin, correlationStatus); - entryD0HadronRecoInfo(hfHelper.invMassD0ToPiK(candidate), hfHelper.invMassD0barToKPi(candidate), signalStatus); + entryD0HadronRecoInfo(HfHelper::invMassD0ToPiK(candidate), HfHelper::invMassD0barToKPi(candidate), signalStatus); entryD0HadronGenInfo(false, false, 0); entryD0HadronMlInfo(outputMlD0[0], outputMlD0[1], outputMlD0[2], outputMlD0bar[0], outputMlD0bar[1], outputMlD0bar[2]); entryTrackRecoInfo(particleAssoc.dcaXY(), particleAssoc.dcaZ(), particleAssoc.tpcNClsCrossedRows()); @@ -923,7 +921,7 @@ struct HfCorrelatorD0Hadrons { for (const auto& [candidate, particleAssoc] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - if (std::abs(hfHelper.yD0(candidate)) >= yCandMax || candidate.pt() < ptCandMin) { + if (std::abs(HfHelper::yD0(candidate)) >= yCandMax || candidate.pt() < ptCandMin) { continue; } if (!particleAssoc.isGlobalTrackWoDCA()) { @@ -957,13 +955,13 @@ struct HfCorrelatorD0Hadrons { invMassDstar2 = std::sqrt((eKPi + ePion) * (eKPi + ePion) - pSum2); if (candidate.isSelD0() >= selectionFlagD0) { - if ((std::abs(invMassDstar1 - hfHelper.invMassD0ToPiK(candidate)) - softPiMass) < ptSoftPionMax) { + if ((std::abs(invMassDstar1 - HfHelper::invMassD0ToPiK(candidate)) - softPiMass) < ptSoftPionMax) { isSoftPiD0 = true; } } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - if ((std::abs(invMassDstar2 - hfHelper.invMassD0barToKPi(candidate)) - softPiMass) < ptSoftPionMax) { + if ((std::abs(invMassDstar2 - HfHelper::invMassD0barToKPi(candidate)) - softPiMass) < ptSoftPionMax) { isSoftPiD0bar = true; } } @@ -1022,7 +1020,7 @@ struct HfCorrelatorD0Hadrons { registry.fill(HIST("hSignalStatusMERec"), signalStatus); bool correlationStatus = false; entryD0HadronPair(getDeltaPhi(candidate.phi(), particleAssoc.phi()), candidate.eta() - particleAssoc.eta(), candidate.pt(), particleAssoc.pt(), poolBin, correlationStatus); - entryD0HadronRecoInfo(hfHelper.invMassD0ToPiK(candidate), hfHelper.invMassD0barToKPi(candidate), signalStatus); + entryD0HadronRecoInfo(HfHelper::invMassD0ToPiK(candidate), HfHelper::invMassD0barToKPi(candidate), signalStatus); entryD0HadronGenInfo(isD0Prompt, isPhysicalPrimary, trackOrigin); entryD0HadronMlInfo(outputMlD0[0], outputMlD0[1], outputMlD0[2], outputMlD0bar[0], outputMlD0bar[1], outputMlD0bar[2]); entryTrackRecoInfo(particleAssoc.dcaXY(), particleAssoc.dcaZ(), particleAssoc.tpcNClsCrossedRows()); diff --git a/PWGHF/HFC/TableProducer/correlatorDMesonPairs.cxx b/PWGHF/HFC/TableProducer/correlatorDMesonPairs.cxx index 5a62565d230..7c14da3fe30 100644 --- a/PWGHF/HFC/TableProducer/correlatorDMesonPairs.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDMesonPairs.cxx @@ -107,7 +107,6 @@ struct HfCorrelatorDMesonPairs { Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"}; Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; - HfHelper hfHelper; SliceCache cache; Preslice perCol2Prong = aod::hf_cand::collisionId; @@ -416,14 +415,14 @@ struct HfCorrelatorDMesonPairs { int nDevent = 0, nDbarevent = 0, nDDbarevent = 0, nDorDbarevent = 0; for (const auto& candidate : selectedD0Candidates) { // Get counters per event - bool const isSignalD0 = std::abs(hfHelper.invMassD0ToPiK(candidate) - MassD0) < massCut; - bool const isSignalD0bar = std::abs(hfHelper.invMassD0barToKPi(candidate) - MassD0Bar) < massCut; + bool const isSignalD0 = std::abs(HfHelper::invMassD0ToPiK(candidate) - MassD0) < massCut; + bool const isSignalD0bar = std::abs(HfHelper::invMassD0barToKPi(candidate) - MassD0Bar) < massCut; if (selectSignalRegionOnly && !(isSignalD0 || isSignalD0bar)) { continue; } auto candidateType1 = assignCandidateTypeD0(candidate); // Candidate type attribution registry.fill(HIST("hPtCand"), candidate.pt()); - if (std::abs(hfHelper.yD0(candidate)) > yCandMax) { + if (std::abs(HfHelper::yD0(candidate)) > yCandMax) { continue; } if (ptCandMin >= 0. && candidate.pt() < ptCandMin) { @@ -589,7 +588,7 @@ struct HfCorrelatorDMesonPairs { outputMlD0Cand1.clear(); outputMlD0barCand1.clear(); - if (std::abs(hfHelper.yD0(candidate1)) > yCandMax) { + if (std::abs(HfHelper::yD0(candidate1)) > yCandMax) { continue; } if (ptCandMin >= 0. && candidate1.pt() < ptCandMin) { @@ -598,8 +597,8 @@ struct HfCorrelatorDMesonPairs { auto prong0Cand1 = candidate1.template prong0_as(); auto prong1Cand1 = candidate1.template prong1_as(); - bool const isSignalD0Cand1 = std::abs(hfHelper.invMassD0ToPiK(candidate1) - MassD0) < massCut; - bool const isSignalD0barCand1 = std::abs(hfHelper.invMassD0barToKPi(candidate1) - MassD0Bar) < massCut; + bool const isSignalD0Cand1 = std::abs(HfHelper::invMassD0ToPiK(candidate1) - MassD0) < massCut; + bool const isSignalD0barCand1 = std::abs(HfHelper::invMassD0barToKPi(candidate1) - MassD0Bar) < massCut; if (selectSignalRegionOnly && !(isSignalD0Cand1 || isSignalD0barCand1)) { continue; } @@ -641,19 +640,19 @@ struct HfCorrelatorDMesonPairs { registry.fill(HIST("hPVContrib"), collision.numContrib()); if (isDCand1) { - registry.fill(HIST("hMass"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt()); + registry.fill(HIST("hMass"), HfHelper::invMassD0ToPiK(candidate1), candidate1.pt()); if (applyMl) { - registry.fill(HIST("hnDMesonMl"), outputMlD0Cand1[0], outputMlD0Cand1[1], hfHelper.invMassD0ToPiK(candidate1), candidate1.pt(), candidate1.y(MassD0), collision.numContrib(), 0, candidateType1); + registry.fill(HIST("hnDMesonMl"), outputMlD0Cand1[0], outputMlD0Cand1[1], HfHelper::invMassD0ToPiK(candidate1), candidate1.pt(), candidate1.y(MassD0), collision.numContrib(), 0, candidateType1); } else { - registry.fill(HIST("hnDMeson"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt(), candidate1.y(MassD0), collision.numContrib(), 0, candidateType1); + registry.fill(HIST("hnDMeson"), HfHelper::invMassD0ToPiK(candidate1), candidate1.pt(), candidate1.y(MassD0), collision.numContrib(), 0, candidateType1); } } if (isDbarCand1) { - registry.fill(HIST("hMass"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt()); + registry.fill(HIST("hMass"), HfHelper::invMassD0barToKPi(candidate1), candidate1.pt()); if (applyMl) { - registry.fill(HIST("hnDMesonMl"), outputMlD0barCand1[0], outputMlD0barCand1[1], hfHelper.invMassD0barToKPi(candidate1), candidate1.pt(), candidate1.y(MassD0), collision.numContrib(), 0, candidateType1); + registry.fill(HIST("hnDMesonMl"), outputMlD0barCand1[0], outputMlD0barCand1[1], HfHelper::invMassD0barToKPi(candidate1), candidate1.pt(), candidate1.y(MassD0), collision.numContrib(), 0, candidateType1); } else { - registry.fill(HIST("hnDMeson"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt(), candidate1.y(MassD0), collision.numContrib(), 0, candidateType1); + registry.fill(HIST("hnDMeson"), HfHelper::invMassD0barToKPi(candidate1), candidate1.pt(), candidate1.y(MassD0), collision.numContrib(), 0, candidateType1); } } @@ -662,7 +661,7 @@ struct HfCorrelatorDMesonPairs { outputMlD0Cand2.clear(); outputMlD0barCand2.clear(); - if (std::abs(hfHelper.yD0(candidate2)) > yCandMax) { + if (std::abs(HfHelper::yD0(candidate2)) > yCandMax) { continue; } if (ptCandMin >= 0. && candidate2.pt() < ptCandMin) { @@ -674,8 +673,8 @@ struct HfCorrelatorDMesonPairs { continue; } - bool const isSignalD0Cand2 = std::abs(hfHelper.invMassD0ToPiK(candidate2) - MassD0) < massCut; - bool const isSignalD0barCand2 = std::abs(hfHelper.invMassD0barToKPi(candidate2) - MassD0Bar) < massCut; + bool const isSignalD0Cand2 = std::abs(HfHelper::invMassD0ToPiK(candidate2) - MassD0) < massCut; + bool const isSignalD0barCand2 = std::abs(HfHelper::invMassD0barToKPi(candidate2) - MassD0Bar) < massCut; if (selectSignalRegionOnly && !(isSignalD0Cand2 || isSignalD0barCand2)) { continue; } @@ -707,16 +706,16 @@ struct HfCorrelatorDMesonPairs { continue; } - fillEntry(isDCand1, isDbarCand1, isDCand2, isDbarCand2, candidateType1, candidateType2, hfHelper.yD0(candidate1), hfHelper.yD0(candidate2), - candidate1.phi(), candidate2.phi(), candidate1.pt(), candidate2.pt(), hfHelper.invMassD0ToPiK(candidate1), hfHelper.invMassD0barToKPi(candidate1), - hfHelper.invMassD0ToPiK(candidate2), hfHelper.invMassD0barToKPi(candidate2)); + fillEntry(isDCand1, isDbarCand1, isDCand2, isDbarCand2, candidateType1, candidateType2, HfHelper::yD0(candidate1), HfHelper::yD0(candidate2), + candidate1.phi(), candidate2.phi(), candidate1.pt(), candidate2.pt(), HfHelper::invMassD0ToPiK(candidate1), HfHelper::invMassD0barToKPi(candidate1), + HfHelper::invMassD0ToPiK(candidate2), HfHelper::invMassD0barToKPi(candidate2)); entryD0PairMl(outputMlD0Cand1, outputMlD0barCand1, outputMlD0Cand2, outputMlD0barCand2); } else { // Fill entries - fillEntry(isDCand1, isDbarCand1, isDCand2, isDbarCand2, candidateType1, candidateType2, hfHelper.yD0(candidate1), hfHelper.yD0(candidate2), candidate1.phi(), candidate2.phi(), - candidate1.pt(), candidate2.pt(), hfHelper.invMassD0ToPiK(candidate1), hfHelper.invMassD0barToKPi(candidate1), - hfHelper.invMassD0ToPiK(candidate2), hfHelper.invMassD0barToKPi(candidate2)); + fillEntry(isDCand1, isDbarCand1, isDCand2, isDbarCand2, candidateType1, candidateType2, HfHelper::yD0(candidate1), HfHelper::yD0(candidate2), candidate1.phi(), candidate2.phi(), + candidate1.pt(), candidate2.pt(), HfHelper::invMassD0ToPiK(candidate1), HfHelper::invMassD0barToKPi(candidate1), + HfHelper::invMassD0ToPiK(candidate2), HfHelper::invMassD0barToKPi(candidate2)); } } // end inner loop (Cand2) } // end outer loop (Cand1) @@ -741,14 +740,14 @@ struct HfCorrelatorDMesonPairs { outputMlD0barCand1.clear(); auto ptCandidate1 = candidate1.pt(); - auto yCandidate1 = hfHelper.yD0(candidate1); + auto yCandidate1 = HfHelper::yD0(candidate1); auto phiCandidate1 = candidate1.phi(); - float const massD0Cand1 = hfHelper.invMassD0ToPiK(candidate1); - float const massD0barCand1 = hfHelper.invMassD0barToKPi(candidate1); + float const massD0Cand1 = HfHelper::invMassD0ToPiK(candidate1); + float const massD0barCand1 = HfHelper::invMassD0barToKPi(candidate1); auto prong0Cand1 = candidate1.template prong0_as(); auto prong1Cand1 = candidate1.template prong1_as(); - if (std::abs(hfHelper.yD0(candidate1)) > yCandMax) { + if (std::abs(HfHelper::yD0(candidate1)) > yCandMax) { continue; } if (ptCandMin >= 0. && candidate1.pt() < ptCandMin) { @@ -811,42 +810,42 @@ struct HfCorrelatorDMesonPairs { if (isDCand1) { if (applyMl) { - registry.fill(HIST("hnDMesonMl"), outputMlD0Cand1[0], outputMlD0Cand1[1], hfHelper.invMassD0ToPiK(candidate1), candidate1.pt(), candidate1.y(MassD0), collision.numContrib(), originRec1, candidateType1); + registry.fill(HIST("hnDMesonMl"), outputMlD0Cand1[0], outputMlD0Cand1[1], HfHelper::invMassD0ToPiK(candidate1), candidate1.pt(), candidate1.y(MassD0), collision.numContrib(), originRec1, candidateType1); } else { - registry.fill(HIST("hnDMeson"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt(), candidate1.y(MassD0), collision.numContrib(), originRec1, candidateType1); + registry.fill(HIST("hnDMeson"), HfHelper::invMassD0ToPiK(candidate1), candidate1.pt(), candidate1.y(MassD0), collision.numContrib(), originRec1, candidateType1); } if (isTrueDCand1) { - registry.fill(HIST("hMass"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt()); - registry.fill(HIST("hPtVsYVsNContribMcRec"), candidate1.pt(), hfHelper.yD0(candidate1), collision.numContrib()); + registry.fill(HIST("hMass"), HfHelper::invMassD0ToPiK(candidate1), candidate1.pt()); + registry.fill(HIST("hPtVsYVsNContribMcRec"), candidate1.pt(), HfHelper::yD0(candidate1), collision.numContrib()); registry.fill(HIST("hNContribMcRec"), collision.numContrib()); if (originRec1 == RecoDecay::Prompt) { - registry.fill(HIST("hMassMcRecPrompt"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt()); - registry.fill(HIST("hPtVsYVsNContribMcRecPrompt"), candidate1.pt(), hfHelper.yD0(candidate1), collision.numContrib()); + registry.fill(HIST("hMassMcRecPrompt"), HfHelper::invMassD0ToPiK(candidate1), candidate1.pt()); + registry.fill(HIST("hPtVsYVsNContribMcRecPrompt"), candidate1.pt(), HfHelper::yD0(candidate1), collision.numContrib()); } else if (originRec1 == RecoDecay::NonPrompt) { - registry.fill(HIST("hMassMcRecNonPrompt"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt()); - registry.fill(HIST("hPtVsYVsNContribMcRecNonPrompt"), candidate1.pt(), hfHelper.yD0(candidate1), collision.numContrib()); + registry.fill(HIST("hMassMcRecNonPrompt"), HfHelper::invMassD0ToPiK(candidate1), candidate1.pt()); + registry.fill(HIST("hPtVsYVsNContribMcRecNonPrompt"), candidate1.pt(), HfHelper::yD0(candidate1), collision.numContrib()); } } else if (isTrueDbarCand1) { - registry.fill(HIST("hMassMcRecReflections"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt()); + registry.fill(HIST("hMassMcRecReflections"), HfHelper::invMassD0ToPiK(candidate1), candidate1.pt()); } } if (isDbarCand1) { if (applyMl) { - registry.fill(HIST("hnDMesonMl"), outputMlD0barCand1[0], outputMlD0barCand1[1], hfHelper.invMassD0barToKPi(candidate1), candidate1.pt(), candidate1.y(MassD0), collision.numContrib(), originRec1, candidateType1); + registry.fill(HIST("hnDMesonMl"), outputMlD0barCand1[0], outputMlD0barCand1[1], HfHelper::invMassD0barToKPi(candidate1), candidate1.pt(), candidate1.y(MassD0), collision.numContrib(), originRec1, candidateType1); } else { - registry.fill(HIST("hnDMeson"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt(), candidate1.y(MassD0), collision.numContrib(), originRec1, candidateType1); + registry.fill(HIST("hnDMeson"), HfHelper::invMassD0barToKPi(candidate1), candidate1.pt(), candidate1.y(MassD0), collision.numContrib(), originRec1, candidateType1); } if (isTrueDbarCand1) { - registry.fill(HIST("hMass"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt()); - registry.fill(HIST("hPtVsYVsNContribMcRec"), candidate1.pt(), hfHelper.yD0(candidate1), collision.numContrib()); + registry.fill(HIST("hMass"), HfHelper::invMassD0barToKPi(candidate1), candidate1.pt()); + registry.fill(HIST("hPtVsYVsNContribMcRec"), candidate1.pt(), HfHelper::yD0(candidate1), collision.numContrib()); registry.fill(HIST("hNContribMcRec"), collision.numContrib()); if (originRec1 == RecoDecay::Prompt) { - registry.fill(HIST("hMassMcRecPrompt"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt()); + registry.fill(HIST("hMassMcRecPrompt"), HfHelper::invMassD0barToKPi(candidate1), candidate1.pt()); } else if (originRec1 == RecoDecay::NonPrompt) { - registry.fill(HIST("hMassMcRecNonPrompt"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt()); + registry.fill(HIST("hMassMcRecNonPrompt"), HfHelper::invMassD0barToKPi(candidate1), candidate1.pt()); } } else if (isTrueDCand1) { - registry.fill(HIST("hMassMcRecReflections"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt()); + registry.fill(HIST("hMassMcRecReflections"), HfHelper::invMassD0barToKPi(candidate1), candidate1.pt()); } } @@ -856,14 +855,14 @@ struct HfCorrelatorDMesonPairs { outputMlD0barCand2.clear(); auto ptCandidate2 = candidate2.pt(); - auto yCandidate2 = hfHelper.yD0(candidate2); + auto yCandidate2 = HfHelper::yD0(candidate2); auto phiCandidate2 = candidate2.phi(); - float const massD0Cand2 = hfHelper.invMassD0ToPiK(candidate2); - float const massD0barCand2 = hfHelper.invMassD0barToKPi(candidate2); + float const massD0Cand2 = HfHelper::invMassD0ToPiK(candidate2); + float const massD0barCand2 = HfHelper::invMassD0barToKPi(candidate2); auto prong0Cand2 = candidate2.template prong0_as(); auto prong1Cand2 = candidate2.template prong1_as(); - if (std::abs(hfHelper.yD0(candidate2)) > yCandMax) { + if (std::abs(HfHelper::yD0(candidate2)) > yCandMax) { continue; } if (ptCandMin >= 0. && candidate2.pt() < ptCandMin) { diff --git a/PWGHF/HFC/TableProducer/correlatorDplusDminus.cxx b/PWGHF/HFC/TableProducer/correlatorDplusDminus.cxx index bf4c1e2b2a3..14eed44af7f 100644 --- a/PWGHF/HFC/TableProducer/correlatorDplusDminus.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDplusDminus.cxx @@ -98,7 +98,6 @@ struct HfCorrelatorDplusDminus { Configurable> binsPt{"binsPt", std::vector{o2::analysis::hf_cuts_dplus_to_pi_k_pi::vecBinsPt}, "pT bin limits for candidate mass plots and efficiency"}; Configurable> efficiencyD{"efficiencyD", std::vector{efficiencyDmesonV}, "Efficiency values for Dplus meson"}; - HfHelper hfHelper; SliceCache cache; Preslice perCol = aod::hf_cand::collisionId; @@ -178,7 +177,7 @@ struct HfCorrelatorDplusDminus { auto selectedDPlusCandidatesGrouped = selectedDPlusCandidates->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); for (const auto& candidate1 : selectedDPlusCandidatesGrouped) { - if (yCandMax >= 0. && std::abs(hfHelper.yDplus(candidate1)) > yCandMax) { + if (yCandMax >= 0. && std::abs(HfHelper::yDplus(candidate1)) > yCandMax) { continue; } if (ptCandMin >= 0. && candidate1.pt() < ptCandMin) { @@ -202,11 +201,11 @@ struct HfCorrelatorDplusDminus { // fill invariant mass plots and generic info from all Dplus/Dminus candidates if (outerParticleSign == 1) { - registry.fill(HIST("hMass"), hfHelper.invMassDplusToPiKPi(candidate1), candidate1.pt(), efficiencyWeight); - registry.fill(HIST("hMassDplus"), hfHelper.invMassDplusToPiKPi(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMass"), HfHelper::invMassDplusToPiKPi(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMassDplus"), HfHelper::invMassDplusToPiKPi(candidate1), candidate1.pt(), efficiencyWeight); } else { - registry.fill(HIST("hMass"), hfHelper.invMassDplusToPiKPi(candidate1), candidate1.pt(), efficiencyWeight); - registry.fill(HIST("hMassDminus"), hfHelper.invMassDplusToPiKPi(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMass"), HfHelper::invMassDplusToPiKPi(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMassDminus"), HfHelper::invMassDplusToPiKPi(candidate1), candidate1.pt(), efficiencyWeight); } registry.fill(HIST("hPtCand"), candidate1.pt()); registry.fill(HIST("hPtProng0"), candidate1.ptProng0()); @@ -214,7 +213,7 @@ struct HfCorrelatorDplusDminus { registry.fill(HIST("hPtProng2"), candidate1.ptProng2()); registry.fill(HIST("hEta"), candidate1.eta()); registry.fill(HIST("hPhi"), candidate1.phi()); - registry.fill(HIST("hY"), hfHelper.yDplus(candidate1)); + registry.fill(HIST("hY"), HfHelper::yDplus(candidate1)); registry.fill(HIST("hSelectionStatus"), candidate1.isSelDplusToPiKPi()); // D-Dbar correlation dedicated section @@ -231,7 +230,7 @@ struct HfCorrelatorDplusDminus { if (innerSecondTrack.sign() != 1) { // keep only Dminus (with second daughter track positive) continue; } - if (yCandMax >= 0. && std::abs(hfHelper.yDplus(candidate2)) > yCandMax) { + if (yCandMax >= 0. && std::abs(HfHelper::yDplus(candidate2)) > yCandMax) { continue; } if (ptCandMin >= 0. && candidate2.pt() < ptCandMin) { @@ -241,8 +240,8 @@ struct HfCorrelatorDplusDminus { candidate2.eta() - candidate1.eta(), candidate1.pt(), candidate2.pt()); - entryDplusDminusRecoInfo(hfHelper.invMassDplusToPiKPi(candidate1), - hfHelper.invMassDplusToPiKPi(candidate2), + entryDplusDminusRecoInfo(HfHelper::invMassDplusToPiKPi(candidate1), + HfHelper::invMassDplusToPiKPi(candidate2), 0); double etaCut = 0.; double ptCut = 0.; @@ -294,7 +293,7 @@ struct HfCorrelatorDplusDminus { if ((candidate1.hfflag() & 1 << aod::hf_cand_3prong::DecayType::DplusToPiKPi) == 0) { continue; } - if (yCandMax >= 0. && std::abs(hfHelper.yDplus(candidate1)) > yCandMax) { + if (yCandMax >= 0. && std::abs(HfHelper::yDplus(candidate1)) > yCandMax) { continue; } if (ptCandMin >= 0. && candidate1.pt() < ptCandMin) { @@ -314,9 +313,9 @@ struct HfCorrelatorDplusDminus { if (std::abs(candidate1.flagMcMatchRec()) == hf_decay::hf_cand_3prong::DecayChannelMain::DplusToPiKPi) { // fill invariant mass plots and per-candidate distributions from Dplus/Dminus signal candidates if (outerParticleSign == 1) { // reco and matched as Dplus - registry.fill(HIST("hMassDplusMCRecSig"), hfHelper.invMassDplusToPiKPi(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMassDplusMCRecSig"), HfHelper::invMassDplusToPiKPi(candidate1), candidate1.pt(), efficiencyWeight); } else { // reco and matched as Dminus - registry.fill(HIST("hMassDminusMCRecSig"), hfHelper.invMassDplusToPiKPi(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMassDminusMCRecSig"), HfHelper::invMassDplusToPiKPi(candidate1), candidate1.pt(), efficiencyWeight); } registry.fill(HIST("hPtCandMCRec"), candidate1.pt()); registry.fill(HIST("hPtProng0MCRec"), candidate1.ptProng0()); @@ -324,14 +323,14 @@ struct HfCorrelatorDplusDminus { registry.fill(HIST("hPtProng2MCRec"), candidate1.ptProng2()); registry.fill(HIST("hEtaMCRec"), candidate1.eta()); registry.fill(HIST("hPhiMCRec"), candidate1.phi()); - registry.fill(HIST("hYMCRec"), hfHelper.yDplus(candidate1)); + registry.fill(HIST("hYMCRec"), HfHelper::yDplus(candidate1)); registry.fill(HIST("hSelectionStatusMCRec"), candidate1.isSelDplusToPiKPi()); } else { // fill invariant mass plots from Dplus/Dminus background candidates if (outerParticleSign == 1) { // reco as Dplus - registry.fill(HIST("hMassDplusMCRecBkg"), hfHelper.invMassDplusToPiKPi(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMassDplusMCRecBkg"), HfHelper::invMassDplusToPiKPi(candidate1), candidate1.pt(), efficiencyWeight); } else { // matched as Dminus - registry.fill(HIST("hMassDminusMCRecBkg"), hfHelper.invMassDplusToPiKPi(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMassDminusMCRecBkg"), HfHelper::invMassDplusToPiKPi(candidate1), candidate1.pt(), efficiencyWeight); } } @@ -349,7 +348,7 @@ struct HfCorrelatorDplusDminus { continue; } flagDminusSignal = std::abs(candidate2.flagMcMatchRec()) == hf_decay::hf_cand_3prong::DecayChannelMain::DplusToPiKPi; // flagDminusSignal 'true' if candidate2 matched to Dminus - if (yCandMax >= 0. && std::abs(hfHelper.yDplus(candidate2)) > yCandMax) { + if (yCandMax >= 0. && std::abs(HfHelper::yDplus(candidate2)) > yCandMax) { continue; } if (ptCandMin >= 0. && candidate2.pt() < ptCandMin) { @@ -367,8 +366,8 @@ struct HfCorrelatorDplusDminus { candidate2.eta() - candidate1.eta(), candidate1.pt(), candidate2.pt()); - entryDplusDminusRecoInfo(hfHelper.invMassDplusToPiKPi(candidate1), - hfHelper.invMassDplusToPiKPi(candidate2), + entryDplusDminusRecoInfo(HfHelper::invMassDplusToPiKPi(candidate1), + HfHelper::invMassDplusToPiKPi(candidate2), pairSignalStatus); double etaCut = 0.; double ptCut = 0.; diff --git a/PWGHF/HFC/TableProducer/correlatorDplusHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorDplusHadrons.cxx index dc655e71a1b..87caae9a901 100644 --- a/PWGHF/HFC/TableProducer/correlatorDplusHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDplusHadrons.cxx @@ -84,7 +84,6 @@ struct HfCorrelatorDplusHadronsDplusSelection { Configurable yCandMax{"yCandMax", 0.8, "max. cand. rapidity"}; Configurable ptCandMin{"ptCandMin", 1., "min. cand. pT"}; - HfHelper hfHelper; SliceCache cache; using SelCollisions = soa::Join; @@ -104,7 +103,7 @@ struct HfCorrelatorDplusHadronsDplusSelection { bool isNosameBunchPileUp = true; if (doSelDplusCollision) { for (const auto& candidate : candidates) { - if (std::abs(hfHelper.yDplus(candidate)) > yCandMax || candidate.pt() < ptCandMin) { + if (std::abs(HfHelper::yDplus(candidate)) > yCandMax || candidate.pt() < ptCandMin) { isDplusFound = false; continue; } @@ -132,7 +131,7 @@ struct HfCorrelatorDplusHadronsDplusSelection { bool isNosameBunchPileUp = true; if (doSelDplusCollision) { for (const auto& candidate : candidates) { - if (std::abs(hfHelper.yDplus(candidate)) >= yCandMax || candidate.pt() <= ptCandMin) { + if (std::abs(HfHelper::yDplus(candidate)) >= yCandMax || candidate.pt() <= ptCandMin) { continue; } isDplusFound = true; @@ -205,7 +204,6 @@ struct HfCorrelatorDplusHadrons { Configurable> binsPtEfficiencyD{"binsPtEfficiencyD", std::vector{o2::analysis::hf_cuts_dplus_to_pi_k_pi::vecBinsPt}, "pT bin limits for efficiency"}; Configurable> efficiencyD{"efficiencyD", {1., 1., 1., 1., 1., 1.}, "efficiency values for D+ meson"}; - HfHelper hfHelper; SliceCache cache; // Event Mixing for the Data Mode @@ -340,7 +338,7 @@ struct HfCorrelatorDplusHadrons { int cntDplus = 0; std::vector outputMl = {-1., -1., -1.}; for (const auto& candidate : candidates) { - if (std::abs(hfHelper.yDplus(candidate)) >= yCandMax || candidate.pt() <= ptCandMin || candidate.pt() >= ptCandMax) { + if (std::abs(HfHelper::yDplus(candidate)) >= yCandMax || candidate.pt() <= ptCandMin || candidate.pt() >= ptCandMax) { continue; } int const effBinD = o2::analysis::findBin(binsPtEfficiencyD, candidate.pt()); @@ -349,22 +347,22 @@ struct HfCorrelatorDplusHadrons { efficiencyWeightD = 1. / efficiencyD->at(effBinD); } // fill invariant mass plots and generic info from all Dplus candidates - registry.fill(HIST("hMassDplus_2D"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), efficiencyWeightD); - registry.fill(HIST("hMassDplusData"), hfHelper.invMassDplusToPiKPi(candidate), efficiencyWeightD); + registry.fill(HIST("hMassDplus_2D"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), efficiencyWeightD); + registry.fill(HIST("hMassDplusData"), HfHelper::invMassDplusToPiKPi(candidate), efficiencyWeightD); registry.fill(HIST("hPtCand"), candidate.pt()); registry.fill(HIST("hPtProng0"), candidate.ptProng0()); registry.fill(HIST("hPtProng1"), candidate.ptProng1()); registry.fill(HIST("hPtProng2"), candidate.ptProng2()); registry.fill(HIST("hEta"), candidate.eta()); registry.fill(HIST("hPhi"), RecoDecay::constrainAngle(candidate.phi(), -o2::constants::math::PIHalf)); - registry.fill(HIST("hY"), hfHelper.yDplus(candidate)); + registry.fill(HIST("hY"), HfHelper::yDplus(candidate)); registry.fill(HIST("hSelectionStatus"), candidate.isSelDplusToPiKPi()); registry.fill(HIST("hDplusBin"), poolBin); for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDplusToPiKPi()[classMl->at(iclass)]; } - entryDplusCandRecoInfo(hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2]); // 0: BkgBDTScore, 1:PromptBDTScore, 2: FDScore - entryDplus(candidate.phi(), candidate.eta(), candidate.pt(), hfHelper.invMassDplusToPiKPi(candidate), poolBin, gCollisionId, timeStamp); + entryDplusCandRecoInfo(HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2]); // 0: BkgBDTScore, 1:PromptBDTScore, 2: FDScore + entryDplus(candidate.phi(), candidate.eta(), candidate.pt(), HfHelper::invMassDplusToPiKPi(candidate), poolBin, gCollisionId, timeStamp); // Dplus-Hadron correlation dedicated section // if the candidate is a Dplus, search for Hadrons and evaluate correlations @@ -383,7 +381,7 @@ struct HfCorrelatorDplusHadrons { track.eta() - candidate.eta(), candidate.pt(), track.pt(), poolBin); - entryDplusHadronRecoInfo(hfHelper.invMassDplusToPiKPi(candidate), false); + entryDplusHadronRecoInfo(HfHelper::invMassDplusToPiKPi(candidate), false); entryDplusHadronGenInfo(false, false, 0); entryDplusHadronMlInfo(outputMl[0], outputMl[1], outputMl[2]); entryTrackRecoInfo(track.dcaXY(), track.dcaZ(), track.tpcNClsCrossedRows()); @@ -431,7 +429,7 @@ struct HfCorrelatorDplusHadrons { bool isDplusSignal = false; for (const auto& candidate : candidates) { // rapidity and pT selections - if (std::abs(hfHelper.yDplus(candidate)) >= yCandMax || candidate.pt() <= ptCandMin || candidate.pt() >= ptCandMax) { + if (std::abs(HfHelper::yDplus(candidate)) >= yCandMax || candidate.pt() <= ptCandMin || candidate.pt() >= ptCandMax) { continue; } // efficiency weight determination @@ -449,7 +447,7 @@ struct HfCorrelatorDplusHadrons { std::vector outputMl = {-1., -1., -1.}; // fill invariant mass plots from Dplus signal and background candidates - registry.fill(HIST("hMassDplusMcRec"), hfHelper.invMassDplusToPiKPi(candidate), efficiencyWeightD); + registry.fill(HIST("hMassDplusMcRec"), HfHelper::invMassDplusToPiKPi(candidate), efficiencyWeightD); registry.fill(HIST("hDplusBin"), poolBin); if (isDplusSignal) { @@ -457,11 +455,11 @@ struct HfCorrelatorDplusHadrons { registry.fill(HIST("hPtProng0MCRec"), candidate.ptProng0()); registry.fill(HIST("hPtProng1MCRec"), candidate.ptProng1()); registry.fill(HIST("hPtProng2MCRec"), candidate.ptProng2()); - registry.fill(HIST("hMassDplusVsPtMcRec"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), efficiencyWeightD); + registry.fill(HIST("hMassDplusVsPtMcRec"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), efficiencyWeightD); registry.fill(HIST("hSelectionStatusMCRec"), candidate.isSelDplusToPiKPi()); registry.fill(HIST("hPtCandMcRecSig"), candidate.pt()); registry.fill(HIST("hEtaMcRecSig"), candidate.eta()); - registry.fill(HIST("hYMCRecSig"), hfHelper.yDplus(candidate)); + registry.fill(HIST("hYMCRecSig"), HfHelper::yDplus(candidate)); registry.fill(HIST("hPhiMcRecSig"), RecoDecay::constrainAngle(candidate.phi(), -PIHalf)); // prompt and non-prompt division @@ -476,14 +474,14 @@ struct HfCorrelatorDplusHadrons { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDplusToPiKPi()[classMl->at(iclass)]; } - registry.fill(HIST("hMassDplusMcRecSig"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), efficiencyWeightD); - entryDplusCandRecoInfo(hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2]); + registry.fill(HIST("hMassDplusMcRecSig"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), efficiencyWeightD); + entryDplusCandRecoInfo(HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2]); entryDplusCandGenInfo(isDplusPrompt); } else { registry.fill(HIST("hPtCandMcRecBkg"), candidate.pt()); registry.fill(HIST("hEtaMcRecBkg"), candidate.eta()); registry.fill(HIST("hPhiMcRecBkg"), RecoDecay::constrainAngle(candidate.phi(), -PIHalf)); - registry.fill(HIST("hMassDplusMcRecBkg"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), efficiencyWeightD); + registry.fill(HIST("hMassDplusMcRecBkg"), HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), efficiencyWeightD); } // Dplus-Hadron correlation dedicated section @@ -505,7 +503,7 @@ struct HfCorrelatorDplusHadrons { track.eta() - candidate.eta(), candidate.pt(), track.pt(), poolBin); - entryDplusHadronRecoInfo(hfHelper.invMassDplusToPiKPi(candidate), isDplusSignal); + entryDplusHadronRecoInfo(HfHelper::invMassDplusToPiKPi(candidate), isDplusSignal); entryDplusHadronMlInfo(outputMl[0], outputMl[1], outputMl[2]); if (track.has_mcParticle()) { auto mcParticle = track.template mcParticle_as(); @@ -635,11 +633,11 @@ struct HfCorrelatorDplusHadrons { int poolBin = corrBinning.getBin(std::make_tuple(c2.posZ(), c2.multFT0M())); for (const auto& [trigDplus, assocParticle] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - if (!assocParticle.isGlobalTrackWoDCA() || std::abs(hfHelper.yDplus(trigDplus)) >= yCandMax) { + if (!assocParticle.isGlobalTrackWoDCA() || std::abs(HfHelper::yDplus(trigDplus)) >= yCandMax) { continue; } entryDplusHadronPair(getDeltaPhi(trigDplus.phi(), assocParticle.phi()), trigDplus.eta() - assocParticle.eta(), trigDplus.pt(), assocParticle.pt(), poolBin); - entryDplusHadronRecoInfo(hfHelper.invMassDplusToPiKPi(trigDplus), 0); + entryDplusHadronRecoInfo(HfHelper::invMassDplusToPiKPi(trigDplus), 0); } } } @@ -652,7 +650,7 @@ struct HfCorrelatorDplusHadrons { { BinningType const corrBinning{{binsZVtx, binsMultiplicityMc}, true}; for (const auto& candidate : candidates) { - if (std::abs(hfHelper.yDplus(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { + if (std::abs(HfHelper::yDplus(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { continue; } // Dplus flag @@ -685,7 +683,7 @@ struct HfCorrelatorDplusHadrons { registry.fill(HIST("hTracksPoolBin"), poolBin); // note that the selections here are not yet applied registry.fill(HIST("hDplusPoolBin"), poolBinDplus); // note that the selections here are not yet applied for (const auto& [candidate, pAssoc] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - if (std::abs(hfHelper.yDplus(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { + if (std::abs(HfHelper::yDplus(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { continue; } if (!pAssoc.isGlobalTrackWoDCA()) { @@ -709,7 +707,7 @@ struct HfCorrelatorDplusHadrons { candidate.pt(), pAssoc.pt(), poolBin); - entryDplusHadronRecoInfo(hfHelper.invMassDplusToPiKPi(candidate), isDplusSignal); + entryDplusHadronRecoInfo(HfHelper::invMassDplusToPiKPi(candidate), isDplusSignal); entryDplusHadronGenInfo(isDplusPrompt, isPhysicalPrimary, trackOrigin); for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDplusToPiKPi()[classMl->at(iclass)]; diff --git a/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx index 7dc4b7ab713..b233a0dbe07 100644 --- a/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx @@ -94,7 +94,6 @@ struct HfCorrelatorDsHadronsSelCollision { Configurable yCandMax{"yCandMax", 0.8, "max. cand. rapidity"}; Configurable ptCandMin{"ptCandMin", 1., "min. cand. pT"}; - HfHelper hfHelper; SliceCache cache; using SelCollisions = soa::Join; @@ -114,7 +113,7 @@ struct HfCorrelatorDsHadronsSelCollision { if (doSelDsCollision) { isDsFound = false; // if candidate table is empty for-loop is not performed for (const auto& candidate : candidates) { - if (std::abs(hfHelper.yDs(candidate)) > yCandMax || candidate.pt() < ptCandMin) { + if (std::abs(HfHelper::yDs(candidate)) > yCandMax || candidate.pt() < ptCandMin) { isDsFound = false; continue; } @@ -143,7 +142,7 @@ struct HfCorrelatorDsHadronsSelCollision { bool isNosameBunchPileUp = true; if (doSelDsCollision) { // to enable only for the MC reco part for (const auto& candidate : candidates) { - if (std::abs(hfHelper.yDs(candidate)) > yCandMax || candidate.pt() < ptCandMin) { + if (std::abs(HfHelper::yDs(candidate)) > yCandMax || candidate.pt() < ptCandMin) { isDsFound = false; continue; } @@ -213,7 +212,6 @@ struct HfCorrelatorDsHadrons { int hfcReducedCollisionIndex = 0; static constexpr std::size_t NDaughtersDs{3u}; - HfHelper hfHelper; SliceCache cache; using SelCollisionsWithDs = soa::Filtered>; // collisionFilter applied @@ -355,8 +353,8 @@ struct HfCorrelatorDsHadrons { template void fillHistoKKPi(const T1& candidate, double efficiencyWeight) { - registry.fill(HIST("hMassDsVsPt"), hfHelper.invMassDsToKKPi(candidate), candidate.pt(), efficiencyWeight); - registry.fill(HIST("hMassDsData"), hfHelper.invMassDsToKKPi(candidate), efficiencyWeight); + registry.fill(HIST("hMassDsVsPt"), HfHelper::invMassDsToKKPi(candidate), candidate.pt(), efficiencyWeight); + registry.fill(HIST("hMassDsData"), HfHelper::invMassDsToKKPi(candidate), efficiencyWeight); registry.fill(HIST("hSelectionStatusDsToKKPi"), candidate.isSelDsToKKPi()); } @@ -366,8 +364,8 @@ struct HfCorrelatorDsHadrons { template void fillHistoPiKK(const T1& candidate, double efficiencyWeight) { - registry.fill(HIST("hMassDsVsPt"), hfHelper.invMassDsToPiKK(candidate), candidate.pt(), efficiencyWeight); - registry.fill(HIST("hMassDsData"), hfHelper.invMassDsToPiKK(candidate), efficiencyWeight); + registry.fill(HIST("hMassDsVsPt"), HfHelper::invMassDsToPiKK(candidate), candidate.pt(), efficiencyWeight); + registry.fill(HIST("hMassDsData"), HfHelper::invMassDsToPiKK(candidate), efficiencyWeight); registry.fill(HIST("hSelectionStatusDsToPiKK"), candidate.isSelDsToPiKK()); } @@ -433,7 +431,7 @@ struct HfCorrelatorDsHadrons { // Ds fill histograms and Ds-Hadron correlation for DsToKKPi for (const auto& candidate : candidates) { - if (std::abs(hfHelper.yDs(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { + if (std::abs(HfHelper::yDs(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { continue; } double efficiencyWeightD = 1.; @@ -449,13 +447,13 @@ struct HfCorrelatorDsHadrons { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDsToKKPi()[classMl->at(iclass)]; } - entryDsCandRecoInfo(hfHelper.invMassDsToKKPi(candidate), candidate.pt() * chargeDs, outputMl[0], outputMl[2], collision.numContrib()); + entryDsCandRecoInfo(HfHelper::invMassDsToKKPi(candidate), candidate.pt() * chargeDs, outputMl[0], outputMl[2], collision.numContrib()); } else if (candidate.isSelDsToPiKK() >= selectionFlagDs) { fillHistoPiKK(candidate, efficiencyWeightD); for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDsToPiKK()[classMl->at(iclass)]; } - entryDsCandRecoInfo(hfHelper.invMassDsToPiKK(candidate), candidate.pt() * chargeDs, outputMl[0], outputMl[2], collision.numContrib()); + entryDsCandRecoInfo(HfHelper::invMassDsToPiKK(candidate), candidate.pt() * chargeDs, outputMl[0], outputMl[2], collision.numContrib()); } if (candidate.isSelDsToKKPi() >= selectionFlagDs && candidate.isSelDsToPiKK() >= selectionFlagDs) { registry.fill(HIST("hCountSelectionStatusDsToKKPiAndToPiKK"), 0.); @@ -480,7 +478,7 @@ struct HfCorrelatorDsHadrons { track.pt() * track.sign(), poolBin, collision.numContrib()); - entryDsHadronRecoInfo(hfHelper.invMassDsToKKPi(candidate), false, false); + entryDsHadronRecoInfo(HfHelper::invMassDsToKKPi(candidate), false, false); // entryDsHadronGenInfo(false, false, 0); entryDsHadronMlInfo(outputMl[0], outputMl[2]); entryTrackRecoInfo(track.dcaXY(), track.dcaZ(), track.tpcNClsCrossedRows()); @@ -491,7 +489,7 @@ struct HfCorrelatorDsHadrons { track.pt() * track.sign(), poolBin, collision.numContrib()); - entryDsHadronRecoInfo(hfHelper.invMassDsToPiKK(candidate), false, false); + entryDsHadronRecoInfo(HfHelper::invMassDsToPiKK(candidate), false, false); // entryDsHadronGenInfo(false, false, 0); entryDsHadronMlInfo(outputMl[0], outputMl[2]); entryTrackRecoInfo(track.dcaXY(), track.dcaZ(), track.tpcNClsCrossedRows()); @@ -524,7 +522,7 @@ struct HfCorrelatorDsHadrons { bool isDsSignal = std::abs(candidate.flagMcMatchRec()) == hf_decay::hf_cand_3prong::DecayChannelMain::DsToPiKK; bool isDecayChan = candidate.flagMcDecayChanRec() == channelsResonant[decayChannel]; - if (std::abs(hfHelper.yDs(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { + if (std::abs(HfHelper::yDs(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { continue; } @@ -546,21 +544,21 @@ struct HfCorrelatorDsHadrons { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDsToKKPi()[classMl->at(iclass)]; } - registry.fill(HIST("hMassDsMcRec"), hfHelper.invMassDsToKKPi(candidate), efficiencyWeightD); - registry.fill(HIST("hMassDsMcRecSig"), hfHelper.invMassDsToKKPi(candidate), candidate.pt(), efficiencyWeightD); - registry.fill(HIST("hMassDsVsPtMcRec"), hfHelper.invMassDsToKKPi(candidate), candidate.pt(), efficiencyWeightD); + registry.fill(HIST("hMassDsMcRec"), HfHelper::invMassDsToKKPi(candidate), efficiencyWeightD); + registry.fill(HIST("hMassDsMcRecSig"), HfHelper::invMassDsToKKPi(candidate), candidate.pt(), efficiencyWeightD); + registry.fill(HIST("hMassDsVsPtMcRec"), HfHelper::invMassDsToKKPi(candidate), candidate.pt(), efficiencyWeightD); registry.fill(HIST("hSelectionStatusDsToKKPiMcRec"), candidate.isSelDsToKKPi()); - entryDsCandRecoInfo(hfHelper.invMassDsToKKPi(candidate), candidate.pt() * chargeDs, outputMl[0], outputMl[2], collision.numContrib()); + entryDsCandRecoInfo(HfHelper::invMassDsToKKPi(candidate), candidate.pt() * chargeDs, outputMl[0], outputMl[2], collision.numContrib()); entryDsCandGenInfo(isDsPrompt); } else if (candidate.isSelDsToPiKK() >= selectionFlagDs) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDsToPiKK()[classMl->at(iclass)]; } - registry.fill(HIST("hMassDsMcRec"), hfHelper.invMassDsToPiKK(candidate), efficiencyWeightD); - registry.fill(HIST("hMassDsMcRecSig"), hfHelper.invMassDsToPiKK(candidate), candidate.pt(), efficiencyWeightD); - registry.fill(HIST("hMassDsVsPtMcRec"), hfHelper.invMassDsToPiKK(candidate), candidate.pt(), efficiencyWeightD); + registry.fill(HIST("hMassDsMcRec"), HfHelper::invMassDsToPiKK(candidate), efficiencyWeightD); + registry.fill(HIST("hMassDsMcRecSig"), HfHelper::invMassDsToPiKK(candidate), candidate.pt(), efficiencyWeightD); + registry.fill(HIST("hMassDsVsPtMcRec"), HfHelper::invMassDsToPiKK(candidate), candidate.pt(), efficiencyWeightD); registry.fill(HIST("hSelectionStatusDsToPiKKMcRec"), candidate.isSelDsToPiKK()); - entryDsCandRecoInfo(hfHelper.invMassDsToPiKK(candidate), candidate.pt() * chargeDs, outputMl[0], outputMl[2], collision.numContrib()); + entryDsCandRecoInfo(HfHelper::invMassDsToPiKK(candidate), candidate.pt() * chargeDs, outputMl[0], outputMl[2], collision.numContrib()); entryDsCandGenInfo(isDsPrompt); } } else { @@ -569,17 +567,17 @@ struct HfCorrelatorDsHadrons { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDsToKKPi()[classMl->at(iclass)]; } - registry.fill(HIST("hMassDsMcRec"), hfHelper.invMassDsToKKPi(candidate), efficiencyWeightD); - registry.fill(HIST("hMassDsMcRecBkg"), hfHelper.invMassDsToKKPi(candidate), candidate.pt(), efficiencyWeightD); - registry.fill(HIST("hMassDsVsPtMcRec"), hfHelper.invMassDsToKKPi(candidate), candidate.pt(), efficiencyWeightD); + registry.fill(HIST("hMassDsMcRec"), HfHelper::invMassDsToKKPi(candidate), efficiencyWeightD); + registry.fill(HIST("hMassDsMcRecBkg"), HfHelper::invMassDsToKKPi(candidate), candidate.pt(), efficiencyWeightD); + registry.fill(HIST("hMassDsVsPtMcRec"), HfHelper::invMassDsToKKPi(candidate), candidate.pt(), efficiencyWeightD); registry.fill(HIST("hSelectionStatusDsToKKPi"), candidate.isSelDsToKKPi()); } else if (candidate.isSelDsToPiKK() >= selectionFlagDs) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDsToPiKK()[classMl->at(iclass)]; } - registry.fill(HIST("hMassDsMcRec"), hfHelper.invMassDsToPiKK(candidate), efficiencyWeightD); - registry.fill(HIST("hMassDsMcRecBkg"), hfHelper.invMassDsToPiKK(candidate), candidate.pt(), efficiencyWeightD); - registry.fill(HIST("hMassDsVsPtMcRec"), hfHelper.invMassDsToPiKK(candidate), candidate.pt(), efficiencyWeightD); + registry.fill(HIST("hMassDsMcRec"), HfHelper::invMassDsToPiKK(candidate), efficiencyWeightD); + registry.fill(HIST("hMassDsMcRecBkg"), HfHelper::invMassDsToPiKK(candidate), candidate.pt(), efficiencyWeightD); + registry.fill(HIST("hMassDsVsPtMcRec"), HfHelper::invMassDsToPiKK(candidate), candidate.pt(), efficiencyWeightD); registry.fill(HIST("hSelectionStatusDsToPiKK"), candidate.isSelDsToPiKK()); } } @@ -603,7 +601,7 @@ struct HfCorrelatorDsHadrons { track.pt() * track.sign(), poolBin, collision.numContrib()); - entryDsHadronRecoInfo(hfHelper.invMassDsToKKPi(candidate), isDsSignal, isDecayChan); + entryDsHadronRecoInfo(HfHelper::invMassDsToKKPi(candidate), isDsSignal, isDecayChan); entryDsHadronMlInfo(outputMl[0], outputMl[2]); if (track.has_mcParticle()) { auto mcParticle = track.template mcParticle_as(); @@ -629,7 +627,7 @@ struct HfCorrelatorDsHadrons { track.pt() * track.sign(), poolBin, collision.numContrib()); - entryDsHadronRecoInfo(hfHelper.invMassDsToPiKK(candidate), isDsSignal, isDecayChan); + entryDsHadronRecoInfo(HfHelper::invMassDsToPiKK(candidate), isDsSignal, isDecayChan); entryDsHadronMlInfo(outputMl[0], outputMl[2]); if (track.has_mcParticle()) { auto mcParticle = track.template mcParticle_as(); @@ -822,13 +820,13 @@ struct HfCorrelatorDsHadrons { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDsToKKPi()[classMl->at(iclass)]; } - candReduced(indexHfcReducedCollision, candidate.phi(), candidate.eta(), candidate.pt() * chargeDs, hfHelper.invMassDsToKKPi(candidate), candidate.prong0Id(), candidate.prong1Id(), candidate.prong2Id()); + candReduced(indexHfcReducedCollision, candidate.phi(), candidate.eta(), candidate.pt() * chargeDs, HfHelper::invMassDsToKKPi(candidate), candidate.prong0Id(), candidate.prong1Id(), candidate.prong2Id()); candSelInfo(indexHfcReducedCollision, outputMl[0], outputMl[2]); } else if (candidate.isSelDsToPiKK() >= selectionFlagDs) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDsToPiKK()[classMl->at(iclass)]; } - candReduced(indexHfcReducedCollision, candidate.phi(), candidate.eta(), candidate.pt() * chargeDs, hfHelper.invMassDsToPiKK(candidate), candidate.prong0Id(), candidate.prong1Id(), candidate.prong2Id()); + candReduced(indexHfcReducedCollision, candidate.phi(), candidate.eta(), candidate.pt() * chargeDs, HfHelper::invMassDsToPiKK(candidate), candidate.prong0Id(), candidate.prong1Id(), candidate.prong2Id()); candSelInfo(indexHfcReducedCollision, outputMl[0], outputMl[2]); } } @@ -886,7 +884,7 @@ struct HfCorrelatorDsHadrons { if ((cand.hfflag() & 1 << aod::hf_cand_3prong::DecayType::DsToKKPi) == 0) { continue; } - if (std::abs(hfHelper.yDs(cand)) > yCandMax || cand.pt() < ptCandMin || cand.pt() > ptCandMax) { + if (std::abs(HfHelper::yDs(cand)) > yCandMax || cand.pt() < ptCandMin || cand.pt() > ptCandMax) { continue; } if (!pAssoc.isGlobalTrackWoDCA()) { @@ -904,7 +902,7 @@ struct HfCorrelatorDsHadrons { pAssoc.pt() * pAssoc.sign(), poolBin, c1.numContrib()); - entryDsHadronRecoInfo(hfHelper.invMassDsToKKPi(cand), false, false); + entryDsHadronRecoInfo(HfHelper::invMassDsToKKPi(cand), false, false); // entryDsHadronGenInfo(false, false, 0); for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = cand.mlProbDsToKKPi()[classMl->at(iclass)]; @@ -919,7 +917,7 @@ struct HfCorrelatorDsHadrons { pAssoc.pt() * pAssoc.sign(), poolBin, c1.numContrib()); - entryDsHadronRecoInfo(hfHelper.invMassDsToPiKK(cand), false, false); + entryDsHadronRecoInfo(HfHelper::invMassDsToPiKK(cand), false, false); // entryDsHadronGenInfo(false, false, 0); for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = cand.mlProbDsToPiKK()[classMl->at(iclass)]; @@ -939,7 +937,7 @@ struct HfCorrelatorDsHadrons { { BinningType const corrBinning{{zPoolBins, multPoolBins}, true}; for (const auto& candidate : candidates) { - if (std::abs(hfHelper.yDs(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { + if (std::abs(HfHelper::yDs(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { continue; } if (std::abs(candidate.flagMcMatchRec()) == hf_decay::hf_cand_3prong::DecayChannelMain::DsToPiKK) { @@ -967,7 +965,7 @@ struct HfCorrelatorDsHadrons { registry.fill(HIST("hTracksPoolBin"), poolBin); // note that the selections here are not yet applied registry.fill(HIST("hDsPoolBin"), poolBinDs); // note that the selections here are not yet applied for (const auto& [candidate, pAssoc] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - if (std::abs(hfHelper.yDs(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { + if (std::abs(HfHelper::yDs(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { continue; } if (!pAssoc.isGlobalTrackWoDCA()) { @@ -996,7 +994,7 @@ struct HfCorrelatorDsHadrons { pAssoc.pt() * pAssoc.sign(), poolBin, c1.numContrib()); - entryDsHadronRecoInfo(hfHelper.invMassDsToKKPi(candidate), isDsSignal, isDecayChan); + entryDsHadronRecoInfo(HfHelper::invMassDsToKKPi(candidate), isDsSignal, isDecayChan); entryDsHadronGenInfo(isDsPrompt, isPhysicalPrimary, trackOrigin); for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDsToKKPi()[classMl->at(iclass)]; @@ -1010,7 +1008,7 @@ struct HfCorrelatorDsHadrons { pAssoc.pt() * pAssoc.sign(), poolBin, c1.numContrib()); - entryDsHadronRecoInfo(hfHelper.invMassDsToPiKK(candidate), isDsSignal, isDecayChan); + entryDsHadronRecoInfo(HfHelper::invMassDsToPiKK(candidate), isDsSignal, isDecayChan); entryDsHadronGenInfo(isDsPrompt, isPhysicalPrimary, trackOrigin); for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDsToPiKK()[classMl->at(iclass)]; diff --git a/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx index d8fef830ce9..62a8ee5bc8d 100644 --- a/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx @@ -94,7 +94,6 @@ struct HfCorrelatorLcHadronsSelection { Configurable centMax{"centMax", 100., "Maximum Centrality"}; Configurable useCentrality{"useCentrality", false, "Flag for centrality dependent analyses"}; - HfHelper hfHelper; SliceCache cache; using SelCollisions = soa::Join; @@ -116,7 +115,7 @@ struct HfCorrelatorLcHadronsSelection { bool isCentInRange = false; if (doSelLcCollision) { for (const auto& candidate : candidates) { - if (std::abs(hfHelper.yLc(candidate)) > yCandMax || candidate.pt() < ptCandMin) { + if (std::abs(HfHelper::yLc(candidate)) > yCandMax || candidate.pt() < ptCandMin) { isLcFound = false; continue; } @@ -152,7 +151,7 @@ struct HfCorrelatorLcHadronsSelection { bool isNosameBunchPileUp = true; if (doSelLcCollision) { for (const auto& candidate : candidates) { - if (std::abs(hfHelper.yLc(candidate)) > yCandMax || candidate.pt() < ptCandMin) { + if (std::abs(HfHelper::yLc(candidate)) > yCandMax || candidate.pt() < ptCandMin) { isLcFound = false; continue; } @@ -242,7 +241,6 @@ struct HfCorrelatorLcHadrons { Configurable eventFractionToAnalyze{"eventFractionToAnalyze", -1, "Fraction of events to analyze (use only for ME offline on very large samples)"}; Configurable useCentrality{"useCentrality", false, "Flag for centrality dependent analyses"}; - HfHelper hfHelper; SliceCache cache; Service pdg; int leadingIndex = 0; @@ -415,7 +413,7 @@ struct HfCorrelatorLcHadrons { std::vector outputMl = {-1., -1., -1.}; for (const auto& candidate : candidates) { - if (std::abs(hfHelper.yLc(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { + if (std::abs(HfHelper::yLc(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { continue; } double efficiencyWeightLc = 1.; @@ -431,31 +429,31 @@ struct HfCorrelatorLcHadrons { registry.fill(HIST("hPtProng2"), candidate.ptProng2()); registry.fill(HIST("hEta"), candidate.eta()); registry.fill(HIST("hPhi"), RecoDecay::constrainAngle(candidate.phi(), -PIHalf)); - registry.fill(HIST("hY"), hfHelper.yLc(candidate)); + registry.fill(HIST("hY"), HfHelper::yLc(candidate)); registry.fill(HIST("hLcBin"), poolBin); if (candidate.isSelLcToPKPi() >= selectionFlagLc) { - registry.fill(HIST("hMassLcVsPtVsCent"), hfHelper.invMassLcToPKPi(candidate), candidate.pt(), cent, efficiencyWeightLc); - registry.fill(HIST("hMassLcData"), hfHelper.invMassLcToPKPi(candidate), efficiencyWeightLc); + registry.fill(HIST("hMassLcVsPtVsCent"), HfHelper::invMassLcToPKPi(candidate), candidate.pt(), cent, efficiencyWeightLc); + registry.fill(HIST("hMassLcData"), HfHelper::invMassLcToPKPi(candidate), efficiencyWeightLc); registry.fill(HIST("hSelectionStatusLcToPKPi"), candidate.isSelLcToPKPi()); for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbLcToPKPi()[classMl->at(iclass)]; } - entryLcCandRecoInfo(hfHelper.invMassLcToPKPi(candidate), candidate.pt() * chargeLc, outputMl[0], outputMl[1]); // 0: BkgBDTScore, 1:PromptBDTScore + entryLcCandRecoInfo(HfHelper::invMassLcToPKPi(candidate), candidate.pt() * chargeLc, outputMl[0], outputMl[1]); // 0: BkgBDTScore, 1:PromptBDTScore if (!skipMixedEventTableFilling) { - entryLc(candidate.phi(), candidate.eta(), candidate.pt() * chargeLc, hfHelper.invMassLcToPKPi(candidate), poolBin, gCollisionId, timeStamp); + entryLc(candidate.phi(), candidate.eta(), candidate.pt() * chargeLc, HfHelper::invMassLcToPKPi(candidate), poolBin, gCollisionId, timeStamp); } } if (candidate.isSelLcToPiKP() >= selectionFlagLc) { - registry.fill(HIST("hMassLcVsPtVsCent"), hfHelper.invMassLcToPiKP(candidate), candidate.pt(), cent, efficiencyWeightLc); - registry.fill(HIST("hMassLcData"), hfHelper.invMassLcToPiKP(candidate), efficiencyWeightLc); + registry.fill(HIST("hMassLcVsPtVsCent"), HfHelper::invMassLcToPiKP(candidate), candidate.pt(), cent, efficiencyWeightLc); + registry.fill(HIST("hMassLcData"), HfHelper::invMassLcToPiKP(candidate), efficiencyWeightLc); registry.fill(HIST("hSelectionStatusLcToPiKP"), candidate.isSelLcToPiKP()); for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbLcToPiKP()[classMl->at(iclass)]; } - entryLcCandRecoInfo(hfHelper.invMassLcToPiKP(candidate), candidate.pt() * chargeLc, outputMl[0], outputMl[1]); // 0: BkgBDTScore, 1:PromptBDTScore + entryLcCandRecoInfo(HfHelper::invMassLcToPiKP(candidate), candidate.pt() * chargeLc, outputMl[0], outputMl[1]); // 0: BkgBDTScore, 1:PromptBDTScore if (!skipMixedEventTableFilling) { - entryLc(candidate.phi(), candidate.eta(), candidate.pt() * chargeLc, hfHelper.invMassLcToPiKP(candidate), poolBin, gCollisionId, timeStamp); + entryLc(candidate.phi(), candidate.eta(), candidate.pt() * chargeLc, HfHelper::invMassLcToPiKP(candidate), poolBin, gCollisionId, timeStamp); } } @@ -491,8 +489,8 @@ struct HfCorrelatorLcHadrons { poolBin, correlationStatus, cent); - entryLcHadronPairY(track.rapidity(MassProton) - hfHelper.yLc(candidate)); // only for proton as of now - entryLcHadronRecoInfo(hfHelper.invMassLcToPKPi(candidate), false); + entryLcHadronPairY(track.rapidity(MassProton) - HfHelper::yLc(candidate)); // only for proton as of now + entryLcHadronRecoInfo(HfHelper::invMassLcToPKPi(candidate), false); entryLcHadronGenInfo(false, false, 0); entryLcHadronMlInfo(outputMl[0], outputMl[1]); entryTrackRecoInfo(track.dcaXY(), track.dcaZ(), track.tpcNClsCrossedRows()); @@ -508,8 +506,8 @@ struct HfCorrelatorLcHadrons { poolBin, correlationStatus, cent); - entryLcHadronPairY(track.rapidity(MassProton) - hfHelper.yLc(candidate)); // only for proton as of now - entryLcHadronRecoInfo(hfHelper.invMassLcToPiKP(candidate), false); + entryLcHadronPairY(track.rapidity(MassProton) - HfHelper::yLc(candidate)); // only for proton as of now + entryLcHadronRecoInfo(HfHelper::invMassLcToPiKP(candidate), false); entryLcHadronGenInfo(false, false, 0); entryLcHadronMlInfo(outputMl[0], outputMl[1]); entryTrackRecoInfo(track.dcaXY(), track.dcaZ(), track.tpcNClsCrossedRows()); @@ -574,7 +572,7 @@ struct HfCorrelatorLcHadrons { int countLc = 1; for (const auto& candidate : candidates) { // check decay channel flag for candidate - if (std::abs(hfHelper.yLc(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { + if (std::abs(HfHelper::yLc(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { continue; } double efficiencyWeightLc = 1.; @@ -595,7 +593,7 @@ struct HfCorrelatorLcHadrons { registry.fill(HIST("hPtCandMcRecSig"), candidate.pt()); registry.fill(HIST("hEtaMcRecSig"), candidate.eta()); registry.fill(HIST("hPhiMcRecSig"), RecoDecay::constrainAngle(candidate.phi(), -PIHalf)); - registry.fill(HIST("hYMcRecSig"), hfHelper.yLc(candidate)); + registry.fill(HIST("hYMcRecSig"), HfHelper::yLc(candidate)); // LcToPKPi and LcToPiKP division if (candidate.isSelLcToPKPi() >= selectionFlagLc) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { @@ -609,11 +607,11 @@ struct HfCorrelatorLcHadrons { registry.fill(HIST("hPtCandMcRecSigNonPrompt"), candidate.pt()); registry.fill(HIST("hPtVsMultiplicityMcRecNonPrompt"), candidate.pt(), multiplicityFT0M); } - registry.fill(HIST("hMassLcMcRec"), hfHelper.invMassLcToPKPi(candidate), efficiencyWeightLc); - registry.fill(HIST("hMassLcMcRecSig"), hfHelper.invMassLcToPKPi(candidate), candidate.pt(), efficiencyWeightLc); - registry.fill(HIST("hMassLcVsPtMcRec"), hfHelper.invMassLcToPKPi(candidate), candidate.pt(), efficiencyWeightLc); + registry.fill(HIST("hMassLcMcRec"), HfHelper::invMassLcToPKPi(candidate), efficiencyWeightLc); + registry.fill(HIST("hMassLcMcRecSig"), HfHelper::invMassLcToPKPi(candidate), candidate.pt(), efficiencyWeightLc); + registry.fill(HIST("hMassLcVsPtMcRec"), HfHelper::invMassLcToPKPi(candidate), candidate.pt(), efficiencyWeightLc); registry.fill(HIST("hSelectionStatusLcToPKPiMcRec"), candidate.isSelLcToPKPi()); - entryLcCandRecoInfo(hfHelper.invMassLcToPKPi(candidate), candidate.pt() * chargeLc, outputMl[0], outputMl[1]); // 0: BkgBDTScore, 1:PromptBDTScore + entryLcCandRecoInfo(HfHelper::invMassLcToPKPi(candidate), candidate.pt() * chargeLc, outputMl[0], outputMl[1]); // 0: BkgBDTScore, 1:PromptBDTScore entryLcCandGenInfo(isLcPrompt); } if (candidate.isSelLcToPiKP() >= selectionFlagLc) { @@ -627,35 +625,35 @@ struct HfCorrelatorLcHadrons { registry.fill(HIST("hPtCandMcRecSigNonPrompt"), candidate.pt()); registry.fill(HIST("hPtVsMultiplicityMcRecNonPrompt"), candidate.pt(), multiplicityFT0M); } - registry.fill(HIST("hMassLcMcRec"), hfHelper.invMassLcToPiKP(candidate), efficiencyWeightLc); - registry.fill(HIST("hMassLcMcRecSig"), hfHelper.invMassLcToPiKP(candidate), candidate.pt(), efficiencyWeightLc); - registry.fill(HIST("hMassLcVsPtMcRec"), hfHelper.invMassLcToPiKP(candidate), candidate.pt(), efficiencyWeightLc); + registry.fill(HIST("hMassLcMcRec"), HfHelper::invMassLcToPiKP(candidate), efficiencyWeightLc); + registry.fill(HIST("hMassLcMcRecSig"), HfHelper::invMassLcToPiKP(candidate), candidate.pt(), efficiencyWeightLc); + registry.fill(HIST("hMassLcVsPtMcRec"), HfHelper::invMassLcToPiKP(candidate), candidate.pt(), efficiencyWeightLc); registry.fill(HIST("hSelectionStatusLcToPiKPMcRec"), candidate.isSelLcToPiKP()); - entryLcCandRecoInfo(hfHelper.invMassLcToPiKP(candidate), candidate.pt() * chargeLc, outputMl[0], outputMl[1]); // 0: BkgBDTScore, 1:PromptBDTScore + entryLcCandRecoInfo(HfHelper::invMassLcToPiKP(candidate), candidate.pt() * chargeLc, outputMl[0], outputMl[1]); // 0: BkgBDTScore, 1:PromptBDTScore entryLcCandGenInfo(isLcPrompt); } } else { registry.fill(HIST("hPtCandMcRecBkg"), candidate.pt()); registry.fill(HIST("hEtaMcRecBkg"), candidate.eta()); registry.fill(HIST("hPhiMcRecBkg"), RecoDecay::constrainAngle(candidate.phi(), -PIHalf)); - registry.fill(HIST("hYMcRecBkg"), hfHelper.yLc(candidate)); + registry.fill(HIST("hYMcRecBkg"), HfHelper::yLc(candidate)); // LcToPKPi and LcToPiKP division if (candidate.isSelLcToPKPi() >= selectionFlagLc) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbLcToPKPi()[classMl->at(iclass)]; } - registry.fill(HIST("hMassLcMcRec"), hfHelper.invMassLcToPKPi(candidate), efficiencyWeightLc); - registry.fill(HIST("hMassLcMcRecBkg"), hfHelper.invMassLcToPKPi(candidate), candidate.pt(), efficiencyWeightLc); - registry.fill(HIST("hMassLcVsPtMcRec"), hfHelper.invMassLcToPKPi(candidate), candidate.pt(), efficiencyWeightLc); + registry.fill(HIST("hMassLcMcRec"), HfHelper::invMassLcToPKPi(candidate), efficiencyWeightLc); + registry.fill(HIST("hMassLcMcRecBkg"), HfHelper::invMassLcToPKPi(candidate), candidate.pt(), efficiencyWeightLc); + registry.fill(HIST("hMassLcVsPtMcRec"), HfHelper::invMassLcToPKPi(candidate), candidate.pt(), efficiencyWeightLc); registry.fill(HIST("hSelectionStatusLcToPKPiMcRec"), candidate.isSelLcToPKPi()); } if (candidate.isSelLcToPiKP() >= selectionFlagLc) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbLcToPiKP()[classMl->at(iclass)]; } - registry.fill(HIST("hMassLcMcRec"), hfHelper.invMassLcToPiKP(candidate), efficiencyWeightLc); - registry.fill(HIST("hMassLcMcRecBkg"), hfHelper.invMassLcToPiKP(candidate), candidate.pt(), efficiencyWeightLc); - registry.fill(HIST("hMassLcVsPtMcRec"), hfHelper.invMassLcToPiKP(candidate), candidate.pt(), efficiencyWeightLc); + registry.fill(HIST("hMassLcMcRec"), HfHelper::invMassLcToPiKP(candidate), efficiencyWeightLc); + registry.fill(HIST("hMassLcMcRecBkg"), HfHelper::invMassLcToPiKP(candidate), candidate.pt(), efficiencyWeightLc); + registry.fill(HIST("hMassLcVsPtMcRec"), HfHelper::invMassLcToPiKP(candidate), candidate.pt(), efficiencyWeightLc); registry.fill(HIST("hSelectionStatusLcToPiKPMcRec"), candidate.isSelLcToPiKP()); } } @@ -755,8 +753,8 @@ struct HfCorrelatorLcHadrons { poolBin, correlationStatus, cent); - entryLcHadronPairY(track.rapidity(MassProton) - hfHelper.yLc(candidate)); // only for proton as of now - entryLcHadronRecoInfo(hfHelper.invMassLcToPKPi(candidate), isLcSignal); + entryLcHadronPairY(track.rapidity(MassProton) - HfHelper::yLc(candidate)); // only for proton as of now + entryLcHadronRecoInfo(HfHelper::invMassLcToPKPi(candidate), isLcSignal); if (fillTrkPID) { entryLcHadronPairTrkPID(track.tpcNSigmaPr(), track.tpcNSigmaKa(), track.tpcNSigmaPi(), track.tofNSigmaPr(), track.tofNSigmaKa(), track.tofNSigmaPi()); } @@ -786,8 +784,8 @@ struct HfCorrelatorLcHadrons { poolBin, correlationStatus, cent); - entryLcHadronPairY(track.rapidity(MassProton) - hfHelper.yLc(candidate)); // only for proton as of now - entryLcHadronRecoInfo(hfHelper.invMassLcToPiKP(candidate), isLcSignal); + entryLcHadronPairY(track.rapidity(MassProton) - HfHelper::yLc(candidate)); // only for proton as of now + entryLcHadronRecoInfo(HfHelper::invMassLcToPiKP(candidate), isLcSignal); if (fillTrkPID) { entryLcHadronPairTrkPID(track.tpcNSigmaPr(), track.tpcNSigmaKa(), track.tpcNSigmaPi(), track.tofNSigmaPr(), track.tofNSigmaKa(), track.tofNSigmaPi()); } @@ -942,7 +940,7 @@ struct HfCorrelatorLcHadrons { for (const auto& [c1, tracks1, c2, tracks2] : pairData) { int poolBin = corrBinning.getBin(std::make_tuple(c2.posZ(), c2.multFT0M())); for (const auto& [trigLc, assocParticle] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - if (!assocParticle.isGlobalTrackWoDCA() || std::abs(hfHelper.yLc(trigLc)) > yCandMax) { + if (!assocParticle.isGlobalTrackWoDCA() || std::abs(HfHelper::yLc(trigLc)) > yCandMax) { continue; } @@ -967,8 +965,8 @@ struct HfCorrelatorLcHadrons { poolBin, correlationStatus, cent); - entryLcHadronPairY(assocParticle.y() - hfHelper.yLc(trigLc)); - entryLcHadronRecoInfo(hfHelper.invMassLcToPKPi(trigLc), false); + entryLcHadronPairY(assocParticle.y() - HfHelper::yLc(trigLc)); + entryLcHadronRecoInfo(HfHelper::invMassLcToPKPi(trigLc), false); entryLcHadronGenInfo(false, false, 0); if (fillTrkPID) { entryLcHadronPairTrkPID(assocParticle.tpcNSigmaPr(), assocParticle.tpcNSigmaKa(), assocParticle.tpcNSigmaPi(), assocParticle.tofNSigmaPr(), assocParticle.tofNSigmaKa(), assocParticle.tofNSigmaPi()); @@ -987,8 +985,8 @@ struct HfCorrelatorLcHadrons { poolBin, correlationStatus, cent); - entryLcHadronPairY(assocParticle.y() - hfHelper.yLc(trigLc)); - entryLcHadronRecoInfo(hfHelper.invMassLcToPiKP(trigLc), false); + entryLcHadronPairY(assocParticle.y() - HfHelper::yLc(trigLc)); + entryLcHadronRecoInfo(HfHelper::invMassLcToPiKP(trigLc), false); entryLcHadronGenInfo(false, false, 0); if (fillTrkPID) { entryLcHadronPairTrkPID(assocParticle.tpcNSigmaPr(), assocParticle.tpcNSigmaKa(), assocParticle.tpcNSigmaPi(), assocParticle.tofNSigmaPr(), assocParticle.tofNSigmaKa(), assocParticle.tofNSigmaPi()); @@ -1011,7 +1009,7 @@ struct HfCorrelatorLcHadrons { { BinningType const corrBinning{{binsZVtx, binsMultiplicityMc}, true}; for (const auto& candidate : candidates) { - if (std::abs(hfHelper.yLc(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { + if (std::abs(HfHelper::yLc(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { continue; } // Lc flag @@ -1056,7 +1054,7 @@ struct HfCorrelatorLcHadrons { registry.fill(HIST("hLcPoolBin"), poolBinLc); float cent = 100.0; // will be updated later for (const auto& [candidate, pAssoc] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - if (std::abs(hfHelper.yLc(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { + if (std::abs(HfHelper::yLc(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) { continue; } if (!pAssoc.isGlobalTrackWoDCA()) { @@ -1090,8 +1088,8 @@ struct HfCorrelatorLcHadrons { poolBin, correlationStatus, cent); - entryLcHadronPairY(pAssoc.y() - hfHelper.yLc(candidate)); - entryLcHadronRecoInfo(hfHelper.invMassLcToPKPi(candidate), isLcSignal); + entryLcHadronPairY(pAssoc.y() - HfHelper::yLc(candidate)); + entryLcHadronRecoInfo(HfHelper::invMassLcToPKPi(candidate), isLcSignal); entryLcHadronGenInfo(isLcPrompt, isPhysicalPrimary, trackOrigin); if (fillTrkPID) { entryLcHadronPairTrkPID(pAssoc.tpcNSigmaPr(), pAssoc.tpcNSigmaKa(), pAssoc.tpcNSigmaPi(), pAssoc.tofNSigmaPr(), pAssoc.tofNSigmaKa(), pAssoc.tofNSigmaPi()); @@ -1110,8 +1108,8 @@ struct HfCorrelatorLcHadrons { poolBin, correlationStatus, cent); - entryLcHadronPairY(pAssoc.y() - hfHelper.yLc(candidate)); - entryLcHadronRecoInfo(hfHelper.invMassLcToPiKP(candidate), isLcSignal); + entryLcHadronPairY(pAssoc.y() - HfHelper::yLc(candidate)); + entryLcHadronRecoInfo(HfHelper::invMassLcToPiKP(candidate), isLcSignal); entryLcHadronGenInfo(isLcPrompt, isPhysicalPrimary, trackOrigin); if (fillTrkPID) { entryLcHadronPairTrkPID(pAssoc.tpcNSigmaPr(), pAssoc.tpcNSigmaKa(), pAssoc.tpcNSigmaPi(), pAssoc.tofNSigmaPr(), pAssoc.tofNSigmaKa(), pAssoc.tofNSigmaPi()); diff --git a/PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx index 61d5147b0b7..e1e12910ccf 100644 --- a/PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx @@ -109,7 +109,6 @@ struct HfCorrelatorLcScHadronsSelection { Configurable cfgMinOccupancy{"cfgMinOccupancy", 0, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; } cfgV0; - HfHelper hfHelper; SliceCache cache; using SelCollisions = soa::Join; @@ -137,13 +136,13 @@ struct HfCorrelatorLcScHadronsSelection { int8_t const chargeCand = candidate.charge(); if (chargeCand == chargeZero) { - yCand = hfHelper.ySc0(candidate); + yCand = HfHelper::ySc0(candidate); } else { - yCand = hfHelper.yScPlusPlus(candidate); + yCand = HfHelper::yScPlusPlus(candidate); } } else { - yCand = hfHelper.yLc(candidate); + yCand = HfHelper::yLc(candidate); } if (std::abs(yCand) > yCandMax || candidate.pt() < ptCandMin) { @@ -374,7 +373,6 @@ struct HfCorrelatorLcScHadrons { Configurable cfgHypMassWindow{"cfgHypMassWindow", 0.5, "single lambda mass selection"}; } cfgV0; - HfHelper hfHelper; SliceCache cache; Service pdg; int8_t chargeCand = 3; @@ -545,13 +543,13 @@ struct HfCorrelatorLcScHadrons { int8_t const chargeCand = candidate.charge(); if (chargeCand == ChargeZero) { - y = hfHelper.ySc0(candidate); + y = HfHelper::ySc0(candidate); } else { - y = hfHelper.yScPlusPlus(candidate); + y = HfHelper::yScPlusPlus(candidate); } } else { - y = hfHelper.yLc(candidate); + y = HfHelper::yLc(candidate); } return y; } @@ -819,12 +817,12 @@ struct HfCorrelatorLcScHadrons { if (selLcPKPi) { const auto& probs = candidateLc.mlProbLcToPKPi(); fillMlOutput(probs, outputMlPKPi); - massCandPKPi = std::abs(hfHelper.invMassScRecoLcToPKPi(candidate, candidateLc) - hfHelper.invMassLcToPKPi(candidateLc)); + massCandPKPi = std::abs(HfHelper::invMassScRecoLcToPKPi(candidate, candidateLc) - HfHelper::invMassLcToPKPi(candidateLc)); } if (selLcPiKP) { const auto& probs = candidateLc.mlProbLcToPiKP(); fillMlOutput(probs, outputMlPiKP); - massCandPiKP = std::abs(hfHelper.invMassScRecoLcToPiKP(candidate, candidateLc) - hfHelper.invMassLcToPiKP(candidateLc)); + massCandPiKP = std::abs(HfHelper::invMassScRecoLcToPiKP(candidate, candidateLc) - HfHelper::invMassLcToPiKP(candidateLc)); } if constexpr (IsMcRec) { // isSignal = @@ -857,12 +855,12 @@ struct HfCorrelatorLcScHadrons { if (selLcPKPi) { const auto& probs = candidate.mlProbLcToPKPi(); fillMlOutput(probs, outputMlPKPi); - massCandPKPi = hfHelper.invMassLcToPKPi(candidate); + massCandPKPi = HfHelper::invMassLcToPKPi(candidate); } if (selLcPiKP) { const auto& probs = candidate.mlProbLcToPiKP(); fillMlOutput(probs, outputMlPiKP); - massCandPiKP = hfHelper.invMassLcToPiKP(candidate); + massCandPiKP = HfHelper::invMassLcToPiKP(candidate); } auto trackPos1 = candidate.template prong0_as(); auto trackPos2 = candidate.template prong2_as(); @@ -1050,12 +1048,12 @@ struct HfCorrelatorLcScHadrons { if (selLcPKPi) { const auto& probs = candidateLc.mlProbLcToPKPi(); fillMlOutput(probs, outputMlPKPi); - massCandPKPi = std::abs(hfHelper.invMassScRecoLcToPKPi(candidate, candidateLc) - hfHelper.invMassLcToPKPi(candidateLc)); + massCandPKPi = std::abs(HfHelper::invMassScRecoLcToPKPi(candidate, candidateLc) - HfHelper::invMassLcToPKPi(candidateLc)); } if (selLcPiKP) { const auto& probs = candidateLc.mlProbLcToPiKP(); fillMlOutput(probs, outputMlPiKP); - massCandPiKP = std::abs(hfHelper.invMassScRecoLcToPiKP(candidate, candidateLc) - hfHelper.invMassLcToPiKP(candidateLc)); + massCandPiKP = std::abs(HfHelper::invMassScRecoLcToPiKP(candidate, candidateLc) - HfHelper::invMassLcToPiKP(candidateLc)); } if constexpr (IsMcRec) { isSignal = @@ -1074,12 +1072,12 @@ struct HfCorrelatorLcScHadrons { if (selLcPKPi) { const auto& probs = candidate.mlProbLcToPKPi(); fillMlOutput(probs, outputMlPKPi); - massCandPKPi = hfHelper.invMassLcToPKPi(candidate); + massCandPKPi = HfHelper::invMassLcToPKPi(candidate); } if (selLcPiKP) { const auto& probs = candidate.mlProbLcToPiKP(); fillMlOutput(probs, outputMlPiKP); - massCandPiKP = hfHelper.invMassLcToPiKP(candidate); + massCandPiKP = HfHelper::invMassLcToPiKP(candidate); } auto trackPos1 = candidate.template prong0_as(); chargeCand = trackPos1.sign(); diff --git a/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx b/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx index d02f69211d2..f418af0e1fb 100644 --- a/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx +++ b/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx @@ -102,7 +102,6 @@ struct HfDerivedDataCreatorCorrelationsReduced { Configurable> binsPtTrig{"binsPtTrig", std::vector{0., 1., 2., 3., 5., 8., 12., 24., 36.}, "pT bin limits for trigger candidates"}; Configurable> binsPtAssoc{"binsPtAssoc", std::vector{0.2, 1., 2., 50.}, "pT bin limits for associated particles"}; - HfHelper hfHelper; HfEventSelection hfEvSel; // event selection and monitoring o2::framework::Service ccdb; SliceCache cache; @@ -198,19 +197,19 @@ struct HfDerivedDataCreatorCorrelationsReduced { double getCandMass(const TCand& candidate) { if constexpr (CandType == CandidateType::DsToKKPi) { - return hfHelper.invMassDsToKKPi(candidate); + return HfHelper::invMassDsToKKPi(candidate); } if constexpr (CandType == CandidateType::DsToPiKK) { - return hfHelper.invMassDsToPiKK(candidate); + return HfHelper::invMassDsToPiKK(candidate); } if constexpr (CandType == CandidateType::DplusToPiKPi) { - return hfHelper.invMassDplusToPiKPi(candidate); + return HfHelper::invMassDplusToPiKPi(candidate); } if constexpr (CandType == CandidateType::D0ToPiK) { - return hfHelper.invMassD0ToPiK(candidate); + return HfHelper::invMassD0ToPiK(candidate); } if constexpr (CandType == CandidateType::D0ToKPi) { - return hfHelper.invMassD0barToKPi(candidate); + return HfHelper::invMassD0barToKPi(candidate); } return -1.; } diff --git a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx index e209a609349..6487d9c562a 100644 --- a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx +++ b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx @@ -159,7 +159,6 @@ struct HfFemtoDreamProducer { FemtoDreamTrackSelection trackCuts; - HfHelper hfHelper; o2::analysis::HfMlResponseLcToPKPi hfMlResponse; o2::analysis::HfMlResponseDplusToPiKPi hfMlResponseDplus; std::vector outputMlDplus; diff --git a/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx b/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx index 611df82cef0..86bbcde2479 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx @@ -118,8 +118,6 @@ struct HfTaskCorrelationD0Hadrons { Configurable isTowardTransverseAway{"isTowardTransverseAway", false, "Divide into three regions: toward, transverse, and away"}; Configurable leadingParticlePtMin{"leadingParticlePtMin", 0., "Min for leading particle pt"}; - HfHelper hfHelper; - enum CandidateStep { kCandidateStepMcGenAll = 0, kCandidateStepMcGenD0ToPiKPi, kCandidateStepMcCandInAcceptance, @@ -860,7 +858,7 @@ struct HfTaskCorrelationD0Hadrons { multiplicity = collision.multFT0M(); if (std::abs(candidate.flagMcMatchRec()) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { hCandidates->Fill(kCandidateStepMcReco, candidate.pt(), multiplicity, candidate.originMcRec()); - if (std::abs(hfHelper.yD0(candidate)) <= yCandMax) { + if (std::abs(HfHelper::yD0(candidate)) <= yCandMax) { hCandidates->Fill(kCandidateStepMcRecoInAcceptance, candidate.pt(), multiplicity, candidate.originMcRec()); if (candidate.originMcRec() == RecoDecay::OriginType::Prompt) { registry.fill(HIST("hPtCandMcRecPrompt"), candidate.pt()); diff --git a/PWGHF/HFC/Tasks/taskCorrelationDplusHadrons.cxx b/PWGHF/HFC/Tasks/taskCorrelationDplusHadrons.cxx index 3a99678e5e3..f374d34a42d 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationDplusHadrons.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationDplusHadrons.cxx @@ -148,7 +148,6 @@ struct HfTaskCorrelationDplusHadrons { Configurable timestampCcdb{"timestampCcdb", -1, "timestamp of the efficiency files used to query in CCDB"}; Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; - HfHelper hfHelper; Service ccdb; std::shared_ptr mEfficiencyPrompt = nullptr; std::shared_ptr mEfficiencyFD = nullptr; @@ -670,7 +669,7 @@ struct HfTaskCorrelationDplusHadrons { multiplicity = collision.multFT0M(); if (std::abs(candidate.flagMcMatchRec()) == hf_decay::hf_cand_3prong::DecayChannelMain::DplusToPiKPi) { hCandidates->Fill(kCandidateStepMcReco, candidate.pt(), multiplicity, candidate.originMcRec()); - if (std::abs(hfHelper.yDplus(candidate)) <= yCandMax) { + if (std::abs(HfHelper::yDplus(candidate)) <= yCandMax) { hCandidates->Fill(kCandidateStepMcRecoInAcceptance, candidate.pt(), multiplicity, candidate.originMcRec()); if (candidate.originMcRec() == RecoDecay::OriginType::Prompt) { registry.fill(HIST("Efficiency/hPtCandMcRecPrompt"), candidate.pt()); diff --git a/PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx b/PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx index 6b74767c2e6..ef43fff45d6 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx @@ -139,7 +139,6 @@ struct HfTaskCorrelationDsHadrons { static constexpr float Epsilon{1.e-8}; - HfHelper hfHelper; SliceCache cache; Service ccdb; @@ -965,7 +964,7 @@ struct HfTaskCorrelationDsHadrons { auto prong0McPart = candidate.template prong0_as().template mcParticle_as(); // DsToKKPi and DsToPiKK division if (((std::abs(prong0McPart.pdgCode()) == kKPlus) && (candidate.isSelDsToKKPi() >= selectionFlagDs)) || ((std::abs(prong0McPart.pdgCode()) == kPiPlus) && (candidate.isSelDsToPiKK() >= selectionFlagDs))) { - if (std::abs(hfHelper.yDs(candidate)) <= yCandMax) { + if (std::abs(HfHelper::yDs(candidate)) <= yCandMax) { if (candidate.originMcRec() == RecoDecay::OriginType::Prompt) { if (useHighDimHistoForEff) { registry.fill(HIST("hPtCandMcRecPrompt"), candidate.pt(), collision.numContrib()); @@ -1047,7 +1046,7 @@ struct HfTaskCorrelationDsHadrons { auto prong0McPart = candidate.template prong0_as().template mcParticle_as(); // DsToKKPi and DsToPiKK division if (((std::abs(prong0McPart.pdgCode()) == kKPlus) && (candidate.isSelDsToKKPi() >= selectionFlagDs)) || ((std::abs(prong0McPart.pdgCode()) == kPiPlus) && (candidate.isSelDsToPiKK() >= selectionFlagDs))) { - if (std::abs(hfHelper.yDs(candidate)) <= yCandMax) { + if (std::abs(HfHelper::yDs(candidate)) <= yCandMax) { if (candidate.originMcRec() == RecoDecay::OriginType::Prompt) { registry.fill(HIST("hPtCandMcRecPrompt"), candidate.pt()); } diff --git a/PWGHF/HFC/Tasks/taskCorrelationLcHadrons.cxx b/PWGHF/HFC/Tasks/taskCorrelationLcHadrons.cxx index c5b59d9bd39..48539d518a1 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationLcHadrons.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationLcHadrons.cxx @@ -162,7 +162,6 @@ struct HfTaskCorrelationLcHadrons { std::shared_ptr mEfficiencyFD = nullptr; std::shared_ptr mEfficiencyAssociated = nullptr; - HfHelper hfHelper; Service ccdb; enum CandidateStep { kCandidateStepMcGenAll = 0, @@ -901,7 +900,7 @@ struct HfTaskCorrelationLcHadrons { multiplicity = collision.multFT0M(); if (std::abs(candidate.flagMcMatchRec()) == hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi) { hCandidates->Fill(kCandidateStepMcReco, candidate.pt(), multiplicity, candidate.originMcRec()); - if (std::abs(hfHelper.yLc(candidate)) <= yCandMax) { + if (std::abs(HfHelper::yLc(candidate)) <= yCandMax) { hCandidates->Fill(kCandidateStepMcRecoInAcceptance, candidate.pt(), multiplicity, candidate.originMcRec()); if (candidate.originMcRec() == RecoDecay::OriginType::Prompt) { registry.fill(HIST("Efficiency/hPtCandMcRecPrompt"), candidate.pt()); diff --git a/PWGHF/HFC/Tasks/taskFlow.cxx b/PWGHF/HFC/Tasks/taskFlow.cxx index 0af4125c446..9ec6414f2d4 100644 --- a/PWGHF/HFC/Tasks/taskFlow.cxx +++ b/PWGHF/HFC/Tasks/taskFlow.cxx @@ -253,7 +253,6 @@ struct HfTaskFlow { TF1* fPtDepDCAxy = nullptr; - HfHelper hfHelper; SliceCache cache; Service pdg; Service ccdb; @@ -899,7 +898,7 @@ struct HfTaskFlow { if (configCandidates.etaCandidateMax >= 0. && std::abs(etaCandidate) > configCandidates.etaCandidateMax) { return false; } - if (configCandidates.yCandRecoMax >= 0. && std::abs(hfHelper.yLc(candidate)) > configCandidates.yCandRecoMax) { + if (configCandidates.yCandRecoMax >= 0. && std::abs(HfHelper::yLc(candidate)) > configCandidates.yCandRecoMax) { return false; } return true; @@ -911,7 +910,7 @@ struct HfTaskFlow { if (configCandidates.etaCandidateMax >= 0. && std::abs(etaCandidate) > configCandidates.etaCandidateMax) { return false; } - if (configCandidates.yCandRecoMax >= 0. && std::abs(hfHelper.yD0(candidate)) > configCandidates.yCandRecoMax) { + if (configCandidates.yCandRecoMax >= 0. && std::abs(HfHelper::yD0(candidate)) > configCandidates.yCandRecoMax) { return false; } return true; @@ -1016,9 +1015,9 @@ struct HfTaskFlow { } fillingHFcontainer = true; if constexpr (std::is_same_v) { // If D0 - invmass = hfHelper.invMassD0ToPiK(track1); + invmass = HfHelper::invMassD0ToPiK(track1); } else { // If Lc - invmass = hfHelper.invMassLcToPKPi(track1); + invmass = HfHelper::invMassLcToPKPi(track1); } } @@ -1216,9 +1215,9 @@ struct HfTaskFlow { } fillingHFcontainer = true; if constexpr (std::is_same_v) { // If D0 - invmass = hfHelper.invMassD0ToPiK(track1); + invmass = HfHelper::invMassD0ToPiK(track1); } else { // If Lc - invmass = hfHelper.invMassLcToPKPi(track1); + invmass = HfHelper::invMassLcToPKPi(track1); } } @@ -1379,9 +1378,9 @@ struct HfTaskFlow { } fillingHFcontainer = true; if constexpr (std::is_same_v) { // If D0 - invmass = hfHelper.invMassD0ToPiK(track1); + invmass = HfHelper::invMassD0ToPiK(track1); } else { // If Lc - invmass = hfHelper.invMassLcToPKPi(track1); + invmass = HfHelper::invMassLcToPKPi(track1); } } diff --git a/PWGHF/HFL/TableProducer/treeCreatorElectronDCA.cxx b/PWGHF/HFL/TableProducer/treeCreatorElectronDCA.cxx index cafd10c8003..beeb37d8689 100644 --- a/PWGHF/HFL/TableProducer/treeCreatorElectronDCA.cxx +++ b/PWGHF/HFL/TableProducer/treeCreatorElectronDCA.cxx @@ -65,7 +65,6 @@ struct HfTreeCreatorElectronDCA { Configurable etaRange{"etaRange", 0.5, "pseudorapidity range"}; Configurable pTMin{"pTMin", 0.5, "min pT"}; - HfHelper hfHelper; Service pdg; using TracksWExt = soa::Join; diff --git a/PWGHF/TableProducer/candidateCreatorB0.cxx b/PWGHF/TableProducer/candidateCreatorB0.cxx index 43eb30d0f78..0387acf0b15 100644 --- a/PWGHF/TableProducer/candidateCreatorB0.cxx +++ b/PWGHF/TableProducer/candidateCreatorB0.cxx @@ -97,7 +97,6 @@ struct HfCandidateCreatorB0 { Configurable ccdbPathGrp{"ccdbPathGrp", "GLO/GRP/GRP", "Path of the grp file (Run 2)"}; Configurable ccdbPathGrpMag{"ccdbPathGrpMag", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object (Run 3)"}; - HfHelper hfHelper; Service ccdb; o2::base::MatLayerCylSet* lut{}; o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; @@ -230,7 +229,7 @@ struct HfCandidateCreatorB0 { auto candsDThisColl = candsD.sliceBy(candsDPerCollision, thisCollId); for (const auto& candD : candsDThisColl) { // start loop over filtered D candidates indices as associated to this collision in candidateCreator3Prong.cxx - hMassDToPiKPi->Fill(hfHelper.invMassDplusToPiKPi(candD), candD.pt()); + hMassDToPiKPi->Fill(HfHelper::invMassDplusToPiKPi(candD), candD.pt()); hPtD->Fill(candD.pt()); hCPAD->Fill(candD.cpa()); diff --git a/PWGHF/TableProducer/candidateCreatorBplus.cxx b/PWGHF/TableProducer/candidateCreatorBplus.cxx index e9d238165a3..20e1536cd7e 100644 --- a/PWGHF/TableProducer/candidateCreatorBplus.cxx +++ b/PWGHF/TableProducer/candidateCreatorBplus.cxx @@ -106,7 +106,6 @@ struct HfCandidateCreatorBplus { Configurable ccdbPathGrp{"ccdbPathGrp", "GLO/GRP/GRP", "Path of the grp file (Run 2)"}; Configurable ccdbPathGrpMag{"ccdbPathGrpMag", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object (Run 3)"}; - HfHelper hfHelper; Service ccdb; o2::base::MatLayerCylSet* lut{}; o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; @@ -224,11 +223,11 @@ struct HfCandidateCreatorBplus { if (!TESTBIT(candD0.hfflag(), aod::hf_cand_2prong::DecayType::D0ToPiK)) { continue; } - if (yCandMax >= 0. && std::abs(hfHelper.yD0(candD0)) > yCandMax) { + if (yCandMax >= 0. && std::abs(HfHelper::yD0(candD0)) > yCandMax) { continue; } - hRapidityD0->Fill(hfHelper.yD0(candD0)); + hRapidityD0->Fill(HfHelper::yD0(candD0)); // track0 <-> pi, track1 <-> K auto prong0 = candD0.prong0_as(); diff --git a/PWGHF/TableProducer/candidateCreatorBs.cxx b/PWGHF/TableProducer/candidateCreatorBs.cxx index d311135c367..e73eaa4215a 100644 --- a/PWGHF/TableProducer/candidateCreatorBs.cxx +++ b/PWGHF/TableProducer/candidateCreatorBs.cxx @@ -98,7 +98,6 @@ struct HfCandidateCreatorBs { o2::vertexing::DCAFitterN<2> df2; // 2-prong vertex fitter o2::vertexing::DCAFitterN<3> df3; // 3-prong vertex fitter - HfHelper hfHelper; Service ccdb; o2::base::MatLayerCylSet* lut{}; o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; @@ -351,7 +350,7 @@ struct HfCandidateCreatorBs { auto errorDecayLengthXY = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, 0.) + getRotatedCovMatrixXX(covMatrixPCA, phi, 0.)); // fill output histograms for Bs candidates - hMassDsToKKPi->Fill(hfHelper.invMassDsToKKPi(candDs), candDs.pt()); + hMassDsToKKPi->Fill(HfHelper::invMassDsToKKPi(candDs), candDs.pt()); hCovSVXX->Fill(covMatrixPCA[0]); hCovPVXX->Fill(covMatrixPV[0]); hMassBsToDsPi->Fill(massDsPi); diff --git a/PWGHF/TableProducer/candidateCreatorLb.cxx b/PWGHF/TableProducer/candidateCreatorLb.cxx index 997e969d7b5..3cc9716241e 100644 --- a/PWGHF/TableProducer/candidateCreatorLb.cxx +++ b/PWGHF/TableProducer/candidateCreatorLb.cxx @@ -79,7 +79,6 @@ struct HfCandidateCreatorLb { o2::vertexing::DCAFitterN<2> df2; // 2-prong vertex fitter o2::vertexing::DCAFitterN<3> df3; // 3-prong vertex fitter (to rebuild Lc vertex) - HfHelper hfHelper; double massPi{0.}; double massLc{0.}; @@ -140,10 +139,10 @@ struct HfCandidateCreatorLb { continue; } if (lcCand.isSelLcToPKPi() >= selectionFlagLc) { - hMassLcToPKPi->Fill(hfHelper.invMassLcToPKPi(lcCand), lcCand.pt()); + hMassLcToPKPi->Fill(HfHelper::invMassLcToPKPi(lcCand), lcCand.pt()); } if (lcCand.isSelLcToPiKP() >= selectionFlagLc) { - hMassLcToPKPi->Fill(hfHelper.invMassLcToPiKP(lcCand), lcCand.pt()); + hMassLcToPKPi->Fill(HfHelper::invMassLcToPiKP(lcCand), lcCand.pt()); } hPtLc->Fill(lcCand.pt()); hCPALc->Fill(lcCand.cpa()); diff --git a/PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx b/PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx index 300d4c6e348..6b3838f8dc3 100644 --- a/PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx +++ b/PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx @@ -98,7 +98,6 @@ struct HfCandidateCreatorSigmac0plusplus { Configurable ccdbPathGrp{"ccdbPathGrp", "GLO/GRP/GRP", "Path of the grp file (Run 2)"}; Configurable ccdbPathGrpMag{"ccdbPathGrpMag", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object (Run 3)"}; - HfHelper hfHelper; /// Cut selection object for soft π-,+ TrackSelection softPiCuts; @@ -209,7 +208,7 @@ struct HfCandidateCreatorSigmac0plusplus { } /// keep only the candidates Λc+ (and charge conj.) within the desired rapidity /// if not selected, skip it and go to the next one - if (yCandLcMax >= 0. && std::abs(hfHelper.yLc(candLc)) > yCandLcMax) { + if (yCandLcMax >= 0. && std::abs(HfHelper::yLc(candLc)) > yCandLcMax) { continue; } @@ -226,10 +225,10 @@ struct HfCandidateCreatorSigmac0plusplus { mPiKPCandLcMax = cutsMassLcMax->get(pTBin, "max piKp mass Lc"); } - if (candLc.isSelLcToPKPi() >= 1 && std::abs(hfHelper.invMassLcToPKPi(candLc) - MassLambdaCPlus) <= mPKPiCandLcMax) { + if (candLc.isSelLcToPKPi() >= 1 && std::abs(HfHelper::invMassLcToPKPi(candLc) - MassLambdaCPlus) <= mPKPiCandLcMax) { statusSpreadMinvPKPiFromPDG = 1; } - if (candLc.isSelLcToPiKP() >= 1 && std::abs(hfHelper.invMassLcToPiKP(candLc) - MassLambdaCPlus) <= mPiKPCandLcMax) { + if (candLc.isSelLcToPiKP() >= 1 && std::abs(HfHelper::invMassLcToPiKP(candLc) - MassLambdaCPlus) <= mPiKPCandLcMax) { statusSpreadMinvPiKPFromPDG = 1; } if (statusSpreadMinvPKPiFromPDG == 0 && statusSpreadMinvPiKPFromPDG == 0) { diff --git a/PWGHF/TableProducer/candidateCreatorSigmac0plusplusCascade.cxx b/PWGHF/TableProducer/candidateCreatorSigmac0plusplusCascade.cxx index fa952bf6b91..017013f5179 100644 --- a/PWGHF/TableProducer/candidateCreatorSigmac0plusplusCascade.cxx +++ b/PWGHF/TableProducer/candidateCreatorSigmac0plusplusCascade.cxx @@ -76,8 +76,6 @@ struct HfCandidateCreatorSigmac0plusplusCascade { Configurable softPiDcaZMax{"softPiDcaZMax", 0.065, "Soft pion max dcaZ (cm)"}; Configurable addQA{"addQA", true, "Switch for the qa PLOTS"}; - HfHelper hfHelper; - using TracksWithPID = soa::Join; /// Filter the candidate Λc+ used for the Σc0,++ creation @@ -228,7 +226,7 @@ struct HfCandidateCreatorSigmac0plusplusCascade { auto ptCand = candidateLc.pt(); auto eta = candidateLc.eta(); auto phi = candidateLc.phi(); - auto invMassLcToK0sP = hfHelper.invMassLcToK0sP(candidateLc); + auto invMassLcToK0sP = HfHelper::invMassLcToK0sP(candidateLc); auto ptProng0 = candidateLc.ptProng0(); auto ptProng1 = candidateLc.ptProng1(); auto impactParameter0 = candidateLc.impactParameter0(); @@ -244,13 +242,13 @@ struct HfCandidateCreatorSigmac0plusplusCascade { auto mLambda = candidateLc.mLambda(); auto mAntiLambda = candidateLc.mAntiLambda(); auto mGamma = candidateLc.mGamma(); - auto ctV0K0Short = hfHelper.ctV0K0s(candidateLc); - auto ctV0Lambda = hfHelper.ctV0Lambda(candidateLc); + auto ctV0K0Short = HfHelper::ctV0K0s(candidateLc); + auto ctV0Lambda = HfHelper::ctV0Lambda(candidateLc); auto cpa = candidateLc.cpa(); auto cpaXY = candidateLc.cpaXY(); auto decayLength = candidateLc.decayLength(); auto decayLengthXY = candidateLc.decayLengthXY(); - auto ctLc = hfHelper.ctLc(candidateLc); + auto ctLc = HfHelper::ctLc(candidateLc); if (addQA) { registry.fill(HIST("lc/hPtCand"), ptCand); registry.fill(HIST("lc/hEtaCand"), eta); diff --git a/PWGHF/TableProducer/candidateCreatorXicc.cxx b/PWGHF/TableProducer/candidateCreatorXicc.cxx index 8879dcb3d55..cde56b878aa 100644 --- a/PWGHF/TableProducer/candidateCreatorXicc.cxx +++ b/PWGHF/TableProducer/candidateCreatorXicc.cxx @@ -81,7 +81,6 @@ struct HfCandidateCreatorXicc { o2::vertexing::DCAFitterN<3> df3; // 3-prong vertex fitter to rebuild the Xic vertex o2::vertexing::DCAFitterN<2> df2; // 2-prong vertex fitter to build the Xicc vertex - HfHelper hfHelper; Filter filterSelectCandidates = (aod::hf_sel_candidate_xic::isSelXicToPKPi >= selectionFlagXic || aod::hf_sel_candidate_xic::isSelXicToPiKP >= selectionFlagXic); @@ -119,10 +118,10 @@ struct HfCandidateCreatorXicc { continue; } if (xicCand.isSelXicToPKPi() >= selectionFlagXic) { - hMassXic->Fill(hfHelper.invMassXicToPKPi(xicCand), xicCand.pt()); + hMassXic->Fill(HfHelper::invMassXicToPKPi(xicCand), xicCand.pt()); } if (xicCand.isSelXicToPiKP() >= selectionFlagXic) { - hMassXic->Fill(hfHelper.invMassXicToPiKP(xicCand), xicCand.pt()); + hMassXic->Fill(HfHelper::invMassXicToPiKP(xicCand), xicCand.pt()); } auto track0 = xicCand.prong0_as(); auto track1 = xicCand.prong1_as(); diff --git a/PWGHF/TableProducer/candidateSelectorB0ToDPi.cxx b/PWGHF/TableProducer/candidateSelectorB0ToDPi.cxx index 962e935fc23..c083d530baf 100644 --- a/PWGHF/TableProducer/candidateSelectorB0ToDPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorB0ToDPi.cxx @@ -101,7 +101,6 @@ struct HfCandidateSelectorB0ToDPi { std::vector outputMl; o2::ccdb::CcdbApi ccdbApi; - HfHelper hfHelper; TrackSelectorPi selectorPion; using TracksPion = soa::Join; @@ -176,7 +175,7 @@ struct HfCandidateSelectorB0ToDPi { } // topological cuts - if (!hfHelper.selectionB0ToDPiTopol(hfCandB0, cuts, binsPt)) { + if (!HfHelper::selectionB0ToDPiTopol(hfCandB0, cuts, binsPt)) { hfSelB0ToDPiCandidate(statusB0); if (applyB0Ml) { hfMlB0ToDPiCandidate(outputMlNotPreselected); @@ -192,7 +191,7 @@ struct HfCandidateSelectorB0ToDPi { if constexpr (WithDmesMl) { std::copy(hfCandD.mlProbDplusToPiKPi().begin(), hfCandD.mlProbDplusToPiKPi().end(), std::back_inserter(mlScoresD)); - if (!hfHelper.selectionDmesMlScoresForB(hfCandD, cutsDmesMl, binsPtDmesMl, mlScoresD)) { + if (!HfHelper::selectionDmesMlScoresForB(hfCandD, cutsDmesMl, binsPtDmesMl, mlScoresD)) { hfSelB0ToDPiCandidate(statusB0); if (applyB0Ml) { hfMlB0ToDPiCandidate(outputMlNotPreselected); @@ -215,7 +214,7 @@ struct HfCandidateSelectorB0ToDPi { } else if (pionPidMethod == PidMethod::TpcAndTof) { pidTrackPi = selectorPion.statusTpcAndTof(trackPi); } - if (!hfHelper.selectionB0ToDPiPid(pidTrackPi, acceptPIDNotApplicable.value)) { + if (!HfHelper::selectionB0ToDPiPid(pidTrackPi, acceptPIDNotApplicable.value)) { // LOGF(info, "B0 candidate selection failed at PID selection"); hfSelB0ToDPiCandidate(statusB0); if (applyB0Ml) { diff --git a/PWGHF/TableProducer/candidateSelectorBplusToD0Pi.cxx b/PWGHF/TableProducer/candidateSelectorBplusToD0Pi.cxx index 9e2fac80961..7b51a915c4c 100644 --- a/PWGHF/TableProducer/candidateSelectorBplusToD0Pi.cxx +++ b/PWGHF/TableProducer/candidateSelectorBplusToD0Pi.cxx @@ -104,7 +104,6 @@ struct HfCandidateSelectorBplusToD0Pi { std::vector outputMl; o2::ccdb::CcdbApi ccdbApi; - HfHelper hfHelper; TrackSelectorPi selectorPion; using TracksPion = soa::Join; @@ -179,7 +178,7 @@ struct HfCandidateSelectorBplusToD0Pi { } // topological cuts - if (!hfHelper.selectionBplusToD0PiTopol(hfCandBp, cuts, binsPt)) { + if (!HfHelper::selectionBplusToD0PiTopol(hfCandBp, cuts, binsPt)) { hfSelBplusToD0PiCandidate(statusBplus); if (applyBplusMl) { hfMlBplusToD0PiCandidate(outputMlNotPreselected); @@ -199,7 +198,7 @@ struct HfCandidateSelectorBplusToD0Pi { std::copy(hfCandD.mlProbD0bar().begin(), hfCandD.mlProbD0bar().end(), std::back_inserter(mlScoresD)); } - if (!hfHelper.selectionDmesMlScoresForB(hfCandD, cutsDmesMl, binsPtDmesMl, mlScoresD)) { + if (!HfHelper::selectionDmesMlScoresForB(hfCandD, cutsDmesMl, binsPtDmesMl, mlScoresD)) { hfSelBplusToD0PiCandidate(statusBplus); if (applyBplusMl) { hfMlBplusToD0PiCandidate(outputMlNotPreselected); @@ -222,7 +221,7 @@ struct HfCandidateSelectorBplusToD0Pi { } else if (pionPidMethod == PidMethod::TpcAndTof) { pidTrackPi = selectorPion.statusTpcAndTof(trackPi); } - if (!hfHelper.selectionBplusToD0PiPid(pidTrackPi, acceptPIDNotApplicable.value)) { + if (!HfHelper::selectionBplusToD0PiPid(pidTrackPi, acceptPIDNotApplicable.value)) { // LOGF(info, "B+ candidate selection failed at PID selection"); hfSelBplusToD0PiCandidate(statusBplus); if (applyBplusMl) { diff --git a/PWGHF/TableProducer/candidateSelectorBsToDsPi.cxx b/PWGHF/TableProducer/candidateSelectorBsToDsPi.cxx index 60cef9d1777..eee6a06b93f 100644 --- a/PWGHF/TableProducer/candidateSelectorBsToDsPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorBsToDsPi.cxx @@ -96,7 +96,6 @@ struct HfCandidateSelectorBsToDsPi { o2::ccdb::CcdbApi ccdbApi; TrackSelectorPi selectorPion; - HfHelper hfHelper; using TracksPidWithSel = soa::Join; @@ -175,7 +174,7 @@ struct HfCandidateSelectorBsToDsPi { } // topological cuts - if (!hfHelper.selectionBsToDsPiTopol(hfCandBs, cuts, binsPt)) { + if (!HfHelper::selectionBsToDsPiTopol(hfCandBs, cuts, binsPt)) { hfSelBsToDsPiCandidate(statusBsToDsPi); if (applyMl) { hfMlBsToDsPiCandidate(outputMl); @@ -199,7 +198,7 @@ struct HfCandidateSelectorBsToDsPi { if (usePid) { auto trackPi = hfCandBs.prong1_as(); int const pidTrackPi = selectorPion.statusTpcAndTof(trackPi); - if (!hfHelper.selectionBsToDsPiPid(pidTrackPi, acceptPIDNotApplicable.value)) { + if (!HfHelper::selectionBsToDsPiPid(pidTrackPi, acceptPIDNotApplicable.value)) { hfSelBsToDsPiCandidate(statusBsToDsPi); if (applyMl) { hfMlBsToDsPiCandidate(outputMl); diff --git a/PWGHF/TableProducer/candidateSelectorCd.cxx b/PWGHF/TableProducer/candidateSelectorCd.cxx index ebf76c0a2af..eb5173c3570 100644 --- a/PWGHF/TableProducer/candidateSelectorCd.cxx +++ b/PWGHF/TableProducer/candidateSelectorCd.cxx @@ -78,8 +78,6 @@ struct HfCandidateSelectorCd { // QA switch Configurable activateQA{"activateQA", false, "Flag to enable QA histogram"}; - HfHelper hfHelper; - TrackSelectorPi selectorPion; TrackSelectorKa selectorKaon; TrackSelectorDe selectorDeuteron; @@ -214,9 +212,9 @@ struct HfCandidateSelectorCd { float massCd{0.f}; if (trackDeuteron.globalIndex() == candidate.prong0Id()) { - massCd = hfHelper.invMassCdToDeKPi(candidate); + massCd = HfHelper::invMassCdToDeKPi(candidate); } else { - massCd = hfHelper.invMassCdToPiKDe(candidate); + massCd = HfHelper::invMassCdToPiKDe(candidate); } // cut on Cd->deKpi, piKde mass values diff --git a/PWGHF/TableProducer/candidateSelectorD0.cxx b/PWGHF/TableProducer/candidateSelectorD0.cxx index ac5d54399ab..8d72e1c2b3a 100644 --- a/PWGHF/TableProducer/candidateSelectorD0.cxx +++ b/PWGHF/TableProducer/candidateSelectorD0.cxx @@ -107,7 +107,6 @@ struct HfCandidateSelectorD0 { o2::ccdb::CcdbApi ccdbApi; TrackSelectorPi selectorPion; TrackSelectorKa selectorKaon; - HfHelper hfHelper; HfTrigger2ProngCuts hfTriggerCuts; using TracksSel = soa::Join; @@ -250,8 +249,8 @@ struct HfCandidateSelectorD0 { massD0 = candidate.kfGeoMassD0(); massD0bar = candidate.kfGeoMassD0bar(); } else { - massD0 = hfHelper.invMassD0ToPiK(candidate); - massD0bar = hfHelper.invMassD0barToKPi(candidate); + massD0 = HfHelper::invMassD0ToPiK(candidate); + massD0bar = HfHelper::invMassD0barToKPi(candidate); } if (trackPion.sign() > 0) { if (std::abs(massD0 - o2::constants::physics::MassD0) > cuts->get(pTBin, "m")) { @@ -281,11 +280,11 @@ struct HfCandidateSelectorD0 { // cut on cos(theta*) if (trackPion.sign() > 0) { - if (std::abs(hfHelper.cosThetaStarD0(candidate)) > cuts->get(pTBin, "cos theta*")) { + if (std::abs(HfHelper::cosThetaStarD0(candidate)) > cuts->get(pTBin, "cos theta*")) { return false; } } else { - if (std::abs(hfHelper.cosThetaStarD0bar(candidate)) > cuts->get(pTBin, "cos theta*")) { + if (std::abs(HfHelper::cosThetaStarD0bar(candidate)) > cuts->get(pTBin, "cos theta*")) { return false; } } @@ -293,11 +292,11 @@ struct HfCandidateSelectorD0 { // in case only sideband candidates have to be stored, additional invariant-mass cut if (keepOnlySidebandCandidates) { if (trackPion.sign() > 0) { - if (std::abs(hfHelper.invMassD0ToPiK(candidate) - o2::constants::physics::MassD0) < distanceFromD0MassForSidebands) { + if (std::abs(HfHelper::invMassD0ToPiK(candidate) - o2::constants::physics::MassD0) < distanceFromD0MassForSidebands) { return false; } } else { - if (std::abs(hfHelper.invMassD0barToKPi(candidate) - o2::constants::physics::MassD0) < distanceFromD0MassForSidebands) { + if (std::abs(HfHelper::invMassD0barToKPi(candidate) - o2::constants::physics::MassD0) < distanceFromD0MassForSidebands) { return false; } } @@ -481,13 +480,13 @@ struct HfCandidateSelectorD0 { registry.fill(HIST("DebugBdt/hBdtScore1VsStatus"), outputMlD0[0], statusD0); registry.fill(HIST("DebugBdt/hBdtScore2VsStatus"), outputMlD0[1], statusD0); registry.fill(HIST("DebugBdt/hBdtScore3VsStatus"), outputMlD0[2], statusD0); - registry.fill(HIST("DebugBdt/hMassDmesonSel"), hfHelper.invMassD0ToPiK(candidate)); + registry.fill(HIST("DebugBdt/hMassDmesonSel"), HfHelper::invMassD0ToPiK(candidate)); } if (isSelectedMlD0bar) { registry.fill(HIST("DebugBdt/hBdtScore1VsStatus"), outputMlD0bar[0], statusD0bar); registry.fill(HIST("DebugBdt/hBdtScore2VsStatus"), outputMlD0bar[1], statusD0bar); registry.fill(HIST("DebugBdt/hBdtScore3VsStatus"), outputMlD0bar[2], statusD0bar); - registry.fill(HIST("DebugBdt/hMassDmesonSel"), hfHelper.invMassD0barToKPi(candidate)); + registry.fill(HIST("DebugBdt/hMassDmesonSel"), HfHelper::invMassD0barToKPi(candidate)); } } } diff --git a/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx b/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx index 902e4ccf707..b66c7ac8540 100644 --- a/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx @@ -101,7 +101,6 @@ struct HfCandidateSelectorDplusToPiKPi { o2::ccdb::CcdbApi ccdbApi; TrackSelectorPi selectorPion; TrackSelectorKa selectorKaon; - HfHelper hfHelper; HfTrigger3ProngCuts hfTriggerCuts; using TracksSel = soa::Join; @@ -169,10 +168,10 @@ struct HfCandidateSelectorDplusToPiKPi { return false; } // invariant-mass cut - if (std::abs(hfHelper.invMassDplusToPiKPi(candidate) - o2::constants::physics::MassDPlus) > cuts->get(pTBin, "deltaM")) { + if (std::abs(HfHelper::invMassDplusToPiKPi(candidate) - o2::constants::physics::MassDPlus) > cuts->get(pTBin, "deltaM")) { return false; } - if (useTriggerMassCut && !isCandidateInMassRange(hfHelper.invMassDplusToPiKPi(candidate), o2::constants::physics::MassDPlus, ptCand, hfTriggerCuts)) { + if (useTriggerMassCut && !isCandidateInMassRange(HfHelper::invMassDplusToPiKPi(candidate), o2::constants::physics::MassDPlus, ptCand, hfTriggerCuts)) { return false; } if (candidate.decayLength() < cuts->get(pTBin, "decay length")) { diff --git a/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx b/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx index b11b4d02db4..bbe41e275fe 100644 --- a/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx @@ -96,7 +96,6 @@ struct HfCandidateSelectorDsToKKPi { // Mass cut for trigger analysis Configurable useTriggerMassCut{"useTriggerMassCut", false, "Flag to enable parametrized pT differential mass cut for triggered data"}; - HfHelper hfHelper; o2::analysis::HfMlResponseDsToKKPi hfMlResponse; std::vector outputMlDsToKKPi; std::vector outputMlDsToPiKK; @@ -194,7 +193,7 @@ struct HfCandidateSelectorDsToKKPi { if (!isSelectedCandidateProngDca(candidate)) { return false; } - if (rejectCandsInDplusToPiKPiRegion && std::abs(hfHelper.invMassDplusToPiKPi(candidate) - o2::constants::physics::MassDPlus) < deltaMRegionDplusToPiKPi) { + if (rejectCandsInDplusToPiKPiRegion && std::abs(HfHelper::invMassDplusToPiKPi(candidate) - o2::constants::physics::MassDPlus) < deltaMRegionDplusToPiKPi) { return false; } return true; @@ -217,16 +216,16 @@ struct HfCandidateSelectorDsToKKPi { if (trackKaon1.pt() < cuts->get(pTBin, "pT K") || trackKaon2.pt() < cuts->get(pTBin, "pT K") || trackPion.pt() < cuts->get(pTBin, "pT Pi")) { return false; } - if (std::abs(hfHelper.invMassDsToKKPi(candidate) - o2::constants::physics::MassDS) > cuts->get(pTBin, "deltaM")) { + if (std::abs(HfHelper::invMassDsToKKPi(candidate) - o2::constants::physics::MassDS) > cuts->get(pTBin, "deltaM")) { return false; } - if (useTriggerMassCut && !isCandidateInMassRange(hfHelper.invMassDsToKKPi(candidate), o2::constants::physics::MassDS, candidate.pt(), hfTriggerCuts)) { + if (useTriggerMassCut && !isCandidateInMassRange(HfHelper::invMassDsToKKPi(candidate), o2::constants::physics::MassDS, candidate.pt(), hfTriggerCuts)) { return false; } - if (hfHelper.deltaMassPhiDsToKKPi(candidate) > cuts->get(pTBin, "deltaM Phi")) { + if (HfHelper::deltaMassPhiDsToKKPi(candidate) > cuts->get(pTBin, "deltaM Phi")) { return false; } - if (hfHelper.absCos3PiKDsToKKPi(candidate) < cuts->get(pTBin, "cos^3 theta_PiK")) { + if (HfHelper::absCos3PiKDsToKKPi(candidate) < cuts->get(pTBin, "cos^3 theta_PiK")) { return false; } return true; @@ -249,16 +248,16 @@ struct HfCandidateSelectorDsToKKPi { if (trackKaon1.pt() < cuts->get(pTBin, "pT K") || trackKaon2.pt() < cuts->get(pTBin, "pT K") || trackPion.pt() < cuts->get(pTBin, "pT Pi")) { return false; } - if (std::abs(hfHelper.invMassDsToPiKK(candidate) - o2::constants::physics::MassDS) > cuts->get(pTBin, "deltaM")) { + if (std::abs(HfHelper::invMassDsToPiKK(candidate) - o2::constants::physics::MassDS) > cuts->get(pTBin, "deltaM")) { return false; } - if (useTriggerMassCut && !isCandidateInMassRange(hfHelper.invMassDsToPiKK(candidate), o2::constants::physics::MassDS, candidate.pt(), hfTriggerCuts)) { + if (useTriggerMassCut && !isCandidateInMassRange(HfHelper::invMassDsToPiKK(candidate), o2::constants::physics::MassDS, candidate.pt(), hfTriggerCuts)) { return false; } - if (hfHelper.deltaMassPhiDsToPiKK(candidate) > cuts->get(pTBin, "deltaM Phi")) { + if (HfHelper::deltaMassPhiDsToPiKK(candidate) > cuts->get(pTBin, "deltaM Phi")) { return false; } - if (hfHelper.absCos3PiKDsToPiKK(candidate) < cuts->get(pTBin, "cos^3 theta_PiK")) { + if (HfHelper::absCos3PiKDsToPiKK(candidate) < cuts->get(pTBin, "cos^3 theta_PiK")) { return false; } return true; diff --git a/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx b/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx index 264f98ec911..83098a40deb 100644 --- a/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx @@ -108,7 +108,6 @@ struct HfCandidateSelectorDstarToD0Pi { Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"}; Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; - HfHelper hfHelper; o2::analysis::HfMlResponseDstarToD0Pi hfMlResponse; std::vector outputMlDstarToD0Pi; o2::ccdb::CcdbApi ccdbApi; diff --git a/PWGHF/TableProducer/candidateSelectorLbToLcPi.cxx b/PWGHF/TableProducer/candidateSelectorLbToLcPi.cxx index ec416564365..3d63ebd0a77 100644 --- a/PWGHF/TableProducer/candidateSelectorLbToLcPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorLbToLcPi.cxx @@ -64,8 +64,6 @@ struct HfCandidateSelectorLbToLcPi { Configurable> cuts{"cuts", {hf_cuts_lb_to_lc_pi::Cuts[0], hf_cuts_lb_to_lc_pi::NBinsPt, hf_cuts_lb_to_lc_pi::NCutVars, hf_cuts_lb_to_lc_pi::labelsPt, hf_cuts_lb_to_lc_pi::labelsCutVar}, "Lb0 candidate selection per pT bin"}; Configurable selectionFlagLc{"selectionFlagLc", 1, "Selection Flag for Lc+"}; - HfHelper hfHelper; - using TracksWExt = soa::Join; bool passesImpactParameterResolution(float pT, float d0Resolution) @@ -91,7 +89,7 @@ struct HfCandidateSelectorLbToLcPi { } // Λb0 mass cut - if (std::abs(hfHelper.invMassLbToLcPi(hfCandLb) - o2::constants::physics::MassLambdaB0) > cuts->get(pTBin, "m")) { + if (std::abs(HfHelper::invMassLbToLcPi(hfCandLb) - o2::constants::physics::MassLambdaB0) > cuts->get(pTBin, "m")) { // LOGF(debug, "Lb topol selection failed at mass diff check"); return false; } @@ -108,10 +106,10 @@ struct HfCandidateSelectorLbToLcPi { float lcMass = 0.; if (hfCandLc.isSelLcToPKPi()) { - lcMass = hfHelper.invMassLcToPKPi(hfCandLc); + lcMass = HfHelper::invMassLcToPKPi(hfCandLc); } if (hfCandLc.isSelLcToPiKP()) { - lcMass = hfHelper.invMassLcToPiKP(hfCandLc); + lcMass = HfHelper::invMassLcToPiKP(hfCandLc); } if (std::abs(lcMass - o2::constants::physics::MassLambdaCPlus) > cuts->get(pTBin, "DeltaMLc")) { return false; diff --git a/PWGHF/TableProducer/candidateSelectorLc.cxx b/PWGHF/TableProducer/candidateSelectorLc.cxx index 566b38c62ca..b372780c1f3 100644 --- a/PWGHF/TableProducer/candidateSelectorLc.cxx +++ b/PWGHF/TableProducer/candidateSelectorLc.cxx @@ -109,7 +109,6 @@ struct HfCandidateSelectorLc { Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"}; Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; - HfHelper hfHelper; o2::analysis::HfMlResponseLcToPKPi hfMlResponseDCA; o2::analysis::HfMlResponseLcToPKPi hfMlResponseKF; std::vector outputMlLcToPKPi; @@ -307,11 +306,11 @@ struct HfCandidateSelectorLc { float massLc{0.f}, massKPi{0.f}; if constexpr (ReconstructionType == aod::hf_cand::VertexerType::DCAFitter) { if (trackProton.globalIndex() == candidate.prong0Id()) { - massLc = hfHelper.invMassLcToPKPi(candidate); - massKPi = hfHelper.invMassKPiPairLcToPKPi(candidate); + massLc = HfHelper::invMassLcToPKPi(candidate); + massKPi = HfHelper::invMassKPiPairLcToPKPi(candidate); } else { - massLc = hfHelper.invMassLcToPiKP(candidate); - massKPi = hfHelper.invMassKPiPairLcToPiKP(candidate); + massLc = HfHelper::invMassLcToPiKP(candidate); + massKPi = HfHelper::invMassKPiPairLcToPiKP(candidate); } } else if constexpr (ReconstructionType == aod::hf_cand::VertexerType::KfParticle) { if (trackProton.globalIndex() == candidate.prong0Id()) { diff --git a/PWGHF/TableProducer/candidateSelectorLcToK0sP.cxx b/PWGHF/TableProducer/candidateSelectorLcToK0sP.cxx index c405b68b846..0720953a7df 100644 --- a/PWGHF/TableProducer/candidateSelectorLcToK0sP.cxx +++ b/PWGHF/TableProducer/candidateSelectorLcToK0sP.cxx @@ -92,7 +92,6 @@ struct HfCandidateSelectorLcToK0sP { Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"}; Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; - HfHelper hfHelper; TrackSelectorPr selectorProtonLowP; TrackSelectorPr selectorProtonHighP; @@ -167,7 +166,7 @@ struct HfCandidateSelectorLcToK0sP { return false; // check that the candidate pT is within the analysis range } - if (std::abs(hfHelper.invMassLcToK0sP(hfCandCascade) - o2::constants::physics::MassLambdaCPlus) > cuts->get(ptBin, "mLc")) { + if (std::abs(HfHelper::invMassLcToK0sP(hfCandCascade) - o2::constants::physics::MassLambdaCPlus) > cuts->get(ptBin, "mLc")) { return false; // mass of the Lambda c } diff --git a/PWGHF/TableProducer/candidateSelectorXicToPKPi.cxx b/PWGHF/TableProducer/candidateSelectorXicToPKPi.cxx index aff5a163b21..cd7d7028925 100644 --- a/PWGHF/TableProducer/candidateSelectorXicToPKPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorXicToPKPi.cxx @@ -98,7 +98,6 @@ struct HfCandidateSelectorXicToPKPi { TrackSelectorPi selectorPion; TrackSelectorKa selectorKaon; TrackSelectorPr selectorProton; - HfHelper hfHelper; using TracksSel = soa::Join; @@ -191,7 +190,7 @@ struct HfCandidateSelectorXicToPKPi { } // candidate ct - if (hfHelper.ctXic(candidate) > cuts->get(pTBin, "ct")) { + if (HfHelper::ctXic(candidate) > cuts->get(pTBin, "ct")) { return false; } @@ -225,11 +224,11 @@ struct HfCandidateSelectorXicToPKPi { } if (trackProton.globalIndex() == candidate.prong0Id()) { - if (std::abs(hfHelper.invMassXicToPKPi(candidate) - o2::constants::physics::MassXiCPlus) > cuts->get(pTBin, "m")) { + if (std::abs(HfHelper::invMassXicToPKPi(candidate) - o2::constants::physics::MassXiCPlus) > cuts->get(pTBin, "m")) { return false; } } else { - if (std::abs(hfHelper.invMassXicToPiKP(candidate) - o2::constants::physics::MassXiCPlus) > cuts->get(pTBin, "m")) { + if (std::abs(HfHelper::invMassXicToPiKP(candidate) - o2::constants::physics::MassXiCPlus) > cuts->get(pTBin, "m")) { return false; } } diff --git a/PWGHF/TableProducer/candidateSelectorXiccToPKPiPi.cxx b/PWGHF/TableProducer/candidateSelectorXiccToPKPiPi.cxx index 032dd658f95..12a5bc3477f 100644 --- a/PWGHF/TableProducer/candidateSelectorXiccToPKPiPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorXiccToPKPiPi.cxx @@ -60,7 +60,6 @@ struct HfCandidateSelectorXiccToPKPiPi { Configurable> binsPt{"binsPt", std::vector{hf_cuts_xicc_to_p_k_pi_pi::vecBinsPt}, "pT bin limits"}; Configurable> cuts{"cuts", {hf_cuts_xicc_to_p_k_pi_pi::Cuts[0], hf_cuts_xicc_to_p_k_pi_pi::NBinsPt, hf_cuts_xicc_to_p_k_pi_pi::NCutVars, hf_cuts_xicc_to_p_k_pi_pi::labelsPt, hf_cuts_xicc_to_p_k_pi_pi::labelsCutVar}, "Xicc candidate selection per pT bin"}; - HfHelper hfHelper; TrackSelectorPi selectorPion; using TracksSel = soa::Join; @@ -93,7 +92,7 @@ struct HfCandidateSelectorXiccToPKPiPi { } // check candidate mass is within a defined mass window - if (std::abs(hfHelper.invMassXiccToXicPi(hfCandXicc) - o2::constants::physics::MassXiCCPlusPlus) > cuts->get(pTBin, "m")) { + if (std::abs(HfHelper::invMassXiccToXicPi(hfCandXicc) - o2::constants::physics::MassXiCCPlusPlus) > cuts->get(pTBin, "m")) { return false; } diff --git a/PWGHF/TableProducer/derivedDataCreatorB0ToDPi.cxx b/PWGHF/TableProducer/derivedDataCreatorB0ToDPi.cxx index 2c4b186991c..5378586cff8 100644 --- a/PWGHF/TableProducer/derivedDataCreatorB0ToDPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorB0ToDPi.cxx @@ -92,7 +92,6 @@ struct HfDerivedDataCreatorB0ToDPi { Configurable downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of background candidates to keep for ML trainings"}; Configurable ptMaxForDownSample{"ptMaxForDownSample", 10., "Maximum pt for the application of the downsampling factor"}; - HfHelper hfHelper; SliceCache cache; static constexpr double Mass{o2::constants::physics::MassB0}; @@ -207,7 +206,7 @@ struct HfDerivedDataCreatorB0ToDPi { candidate.pyProng1(), candidate.pzProng1(), candidate.errorImpactParameter1(), - hfHelper.cosThetaStarB0(candidate), + HfHelper::cosThetaStarB0(candidate), ct); } if (fillCandidateSel) { @@ -311,9 +310,9 @@ struct HfDerivedDataCreatorB0ToDPi { } auto prongCharm = candidate.template prong0_as(); auto prongBachelor = candidate.template prong1_as(); - double const ct = hfHelper.ctB0(candidate); - double const y = hfHelper.yB0(candidate); - float const massB0ToDPi = hfHelper.invMassB0ToDPi(candidate); + double const ct = HfHelper::ctB0(candidate); + double const y = HfHelper::yB0(candidate); + float const massB0ToDPi = HfHelper::invMassB0ToDPi(candidate); float mlScoreB0ToDPi{-1.f}; std::vector mlScoresDplus; std::copy(prongCharm.mlProbDplusToPiKPi().begin(), prongCharm.mlProbDplusToPiKPi().end(), std::back_inserter(mlScoresDplus)); diff --git a/PWGHF/TableProducer/derivedDataCreatorBplusToD0Pi.cxx b/PWGHF/TableProducer/derivedDataCreatorBplusToD0Pi.cxx index c75265a3161..05c34f4c85b 100644 --- a/PWGHF/TableProducer/derivedDataCreatorBplusToD0Pi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorBplusToD0Pi.cxx @@ -93,7 +93,6 @@ struct HfDerivedDataCreatorBplusToD0Pi { Configurable downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of background candidates to keep for ML trainings"}; Configurable ptMaxForDownSample{"ptMaxForDownSample", 10., "Maximum pt for the application of the downsampling factor"}; - HfHelper hfHelper; SliceCache cache; static constexpr double Mass{o2::constants::physics::MassBPlus}; @@ -211,7 +210,7 @@ struct HfDerivedDataCreatorBplusToD0Pi { candidate.pyProng1(), candidate.pzProng1(), candidate.errorImpactParameter1(), - hfHelper.cosThetaStarBplus(candidate), + HfHelper::cosThetaStarBplus(candidate), ct); } if (fillCandidateSel) { @@ -314,9 +313,9 @@ struct HfDerivedDataCreatorBplusToD0Pi { } auto prongCharm = candidate.template prong0_as(); auto prongBachelor = candidate.template prong1_as(); - double const ct = hfHelper.ctBplus(candidate); - double const y = hfHelper.yBplus(candidate); - float const massBplusToD0Pi = hfHelper.invMassBplusToD0Pi(candidate); + double const ct = HfHelper::ctBplus(candidate); + double const y = HfHelper::yBplus(candidate); + float const massBplusToD0Pi = HfHelper::invMassBplusToD0Pi(candidate); float mlScoreBplusToD0Pi{-1.f}; std::vector mlScoresD0; bool const isD0 = prongBachelor.sign() < 0; diff --git a/PWGHF/TableProducer/derivedDataCreatorD0ToKPi.cxx b/PWGHF/TableProducer/derivedDataCreatorD0ToKPi.cxx index ece7eba03c4..6e9a18014a5 100644 --- a/PWGHF/TableProducer/derivedDataCreatorD0ToKPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorD0ToKPi.cxx @@ -87,7 +87,6 @@ struct HfDerivedDataCreatorD0ToKPi { Configurable downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of background candidates to keep for ML trainings"}; Configurable ptMaxForDownSample{"ptMaxForDownSample", 10., "Maximum pt for the application of the downsampling factor"}; - HfHelper hfHelper; SliceCache cache; static constexpr double Mass{o2::constants::physics::MassD0}; @@ -309,8 +308,8 @@ struct HfDerivedDataCreatorD0ToKPi { } } - double const ct = hfHelper.ctD0(candidate); - double const y = hfHelper.yD0(candidate); + double const ct = HfHelper::ctD0(candidate); + double const y = HfHelper::yD0(candidate); float massD0, massD0bar; float topolChi2PerNdf = -999.; if constexpr (ReconstructionType == aod::hf_cand::VertexerType::KfParticle) { @@ -318,8 +317,8 @@ struct HfDerivedDataCreatorD0ToKPi { massD0bar = candidate.kfGeoMassD0bar(); topolChi2PerNdf = candidate.kfTopolChi2OverNdf(); } else { - massD0 = hfHelper.invMassD0ToPiK(candidate); - massD0bar = hfHelper.invMassD0barToKPi(candidate); + massD0 = HfHelper::invMassD0ToPiK(candidate); + massD0bar = HfHelper::invMassD0barToKPi(candidate); } std::vector mlScoresD0, mlScoresD0bar; if constexpr (IsMl) { @@ -327,10 +326,10 @@ struct HfDerivedDataCreatorD0ToKPi { std::copy(candidate.mlProbD0bar().begin(), candidate.mlProbD0bar().end(), std::back_inserter(mlScoresD0bar)); } if (candidate.isSelD0()) { - fillTablesCandidate(candidate, 0, massD0, hfHelper.cosThetaStarD0(candidate), topolChi2PerNdf, ct, y, flagMcRec, origin, mlScoresD0); + fillTablesCandidate(candidate, 0, massD0, HfHelper::cosThetaStarD0(candidate), topolChi2PerNdf, ct, y, flagMcRec, origin, mlScoresD0); } if (candidate.isSelD0bar()) { - fillTablesCandidate(candidate, 1, massD0bar, hfHelper.cosThetaStarD0bar(candidate), topolChi2PerNdf, ct, y, flagMcRec, origin, mlScoresD0bar); + fillTablesCandidate(candidate, 1, massD0bar, HfHelper::cosThetaStarD0bar(candidate), topolChi2PerNdf, ct, y, flagMcRec, origin, mlScoresD0bar); } } } diff --git a/PWGHF/TableProducer/derivedDataCreatorDplusToPiKPi.cxx b/PWGHF/TableProducer/derivedDataCreatorDplusToPiKPi.cxx index be6b8c11d7c..1458dfddcf1 100644 --- a/PWGHF/TableProducer/derivedDataCreatorDplusToPiKPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorDplusToPiKPi.cxx @@ -86,7 +86,6 @@ struct HfDerivedDataCreatorDplusToPiKPi { Configurable downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of background candidates to keep for ML trainings"}; Configurable ptMaxForDownSample{"ptMaxForDownSample", 10., "Maximum pt for the application of the downsampling factor"}; - HfHelper hfHelper; SliceCache cache; static constexpr double Mass{o2::constants::physics::MassDPlus}; @@ -283,9 +282,9 @@ struct HfDerivedDataCreatorDplusToPiKPi { } } } - double const ct = hfHelper.ctDplus(candidate); - double const y = hfHelper.yDplus(candidate); - float const massDplusToPiKPi = hfHelper.invMassDplusToPiKPi(candidate); + double const ct = HfHelper::ctDplus(candidate); + double const y = HfHelper::yDplus(candidate); + float const massDplusToPiKPi = HfHelper::invMassDplusToPiKPi(candidate); std::vector mlScoresDplusToPiKPi; if constexpr (IsMl) { std::copy(candidate.mlProbDplusToPiKPi().begin(), candidate.mlProbDplusToPiKPi().end(), std::back_inserter(mlScoresDplusToPiKPi)); diff --git a/PWGHF/TableProducer/derivedDataCreatorDsToKKPi.cxx b/PWGHF/TableProducer/derivedDataCreatorDsToKKPi.cxx index a9097f4457c..0a5f217e19e 100644 --- a/PWGHF/TableProducer/derivedDataCreatorDsToKKPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorDsToKKPi.cxx @@ -86,7 +86,6 @@ struct HfDerivedDataCreatorDsToKKPi { Configurable downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of background candidates to keep for ML trainings"}; Configurable ptMaxForDownSample{"ptMaxForDownSample", 10., "Maximum pt for the application of the downsampling factor"}; - HfHelper hfHelper; SliceCache cache; static constexpr double Mass{o2::constants::physics::MassDS}; @@ -289,9 +288,9 @@ struct HfDerivedDataCreatorDsToKKPi { } } } - double const ct = hfHelper.ctDs(candidate); - double const y = hfHelper.yDs(candidate); - float const massDsToKKPi = hfHelper.invMassDsToKKPi(candidate); + double const ct = HfHelper::ctDs(candidate); + double const y = HfHelper::yDs(candidate); + float const massDsToKKPi = HfHelper::invMassDsToKKPi(candidate); std::vector mlScoresDsToKKPi; if constexpr (IsMl) { std::copy(candidate.mlProbDsToKKPi().begin(), candidate.mlProbDsToKKPi().end(), std::back_inserter(mlScoresDsToKKPi)); diff --git a/PWGHF/TableProducer/derivedDataCreatorLcToPKPi.cxx b/PWGHF/TableProducer/derivedDataCreatorLcToPKPi.cxx index 691f65a3092..b96ac350953 100644 --- a/PWGHF/TableProducer/derivedDataCreatorLcToPKPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorLcToPKPi.cxx @@ -86,7 +86,6 @@ struct HfDerivedDataCreatorLcToPKPi { Configurable downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of background candidates to keep for ML trainings"}; Configurable ptMaxForDownSample{"ptMaxForDownSample", 10., "Maximum pt for the application of the downsampling factor"}; - HfHelper hfHelper; SliceCache cache; static constexpr double Mass{o2::constants::physics::MassLambdaCPlus}; @@ -289,10 +288,10 @@ struct HfDerivedDataCreatorLcToPKPi { } } } - double const ct = hfHelper.ctLc(candidate); - double const y = hfHelper.yLc(candidate); - float const massLcToPKPi = hfHelper.invMassLcToPKPi(candidate); - float const massLcToPiKP = hfHelper.invMassLcToPiKP(candidate); + double const ct = HfHelper::ctLc(candidate); + double const y = HfHelper::yLc(candidate); + float const massLcToPKPi = HfHelper::invMassLcToPKPi(candidate); + float const massLcToPiKP = HfHelper::invMassLcToPiKP(candidate); std::vector mlScoresLcToPKPi, mlScoresLcToPiKP; if constexpr (IsMl) { std::copy(candidate.mlProbLcToPKPi().begin(), candidate.mlProbLcToPKPi().end(), std::back_inserter(mlScoresLcToPKPi)); diff --git a/PWGHF/TableProducer/derivedDataCreatorXicToXiPiPi.cxx b/PWGHF/TableProducer/derivedDataCreatorXicToXiPiPi.cxx index cd1a5ec4c42..fa52ec0a79f 100644 --- a/PWGHF/TableProducer/derivedDataCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorXicToXiPiPi.cxx @@ -87,7 +87,6 @@ struct HfDerivedDataCreatorXicToXiPiPi { Configurable downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of background candidates to keep for ML trainings"}; Configurable ptMaxForDownSample{"ptMaxForDownSample", 10., "Maximum pt for the application of the downsampling factor"}; - HfHelper hfHelper; SliceCache cache; static constexpr double Mass{o2::constants::physics::MassXiCPlus}; @@ -287,8 +286,8 @@ struct HfDerivedDataCreatorXicToXiPiPi { } } float const massXicToXiPiPi = candidate.invMassXicPlus(); - double const ct = hfHelper.ctXic(candidate); - double const y = hfHelper.yXic(candidate); + double const ct = HfHelper::ctXic(candidate); + double const y = HfHelper::yXic(candidate); std::vector mlScoresXicToXiPiPi; if constexpr (IsMl) { std::copy(candidate.mlProbXicToXiPiPi().begin(), candidate.mlProbXicToXiPiPi().end(), std::back_inserter(mlScoresXicToXiPiPi)); diff --git a/PWGHF/TableProducer/treeCreatorB0ToDPi.cxx b/PWGHF/TableProducer/treeCreatorB0ToDPi.cxx index bfd6b275b3f..af4663a1b41 100644 --- a/PWGHF/TableProducer/treeCreatorB0ToDPi.cxx +++ b/PWGHF/TableProducer/treeCreatorB0ToDPi.cxx @@ -183,8 +183,6 @@ struct HfTreeCreatorB0ToDPi { Configurable downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of background candidates to keep for ML trainings"}; Configurable ptMaxForDownSample{"ptMaxForDownSample", 10., "Maximum pt for the application of the downsampling factor"}; - HfHelper hfHelper; - using SelectedCandidatesMc = soa::Filtered>; using TracksWPid = soa::Join; @@ -233,14 +231,14 @@ struct HfTreeCreatorB0ToDPi { prong1.tpcNSigmaPi(), prong1.tofNSigmaPi(), candidate.isSelB0ToDPi(), - hfHelper.invMassB0ToDPi(candidate), + HfHelper::invMassB0ToDPi(candidate), candidate.pt(), candidate.cpa(), candidate.cpaXY(), candidate.maxNormalisedDeltaIP(), candidate.eta(), candidate.phi(), - hfHelper.yB0(candidate), + HfHelper::yB0(candidate), flagMc, originMc); } else { @@ -280,17 +278,17 @@ struct HfTreeCreatorB0ToDPi { prong1.tpcNSigmaPi(), prong1.tofNSigmaPi(), candidate.isSelB0ToDPi(), - hfHelper.invMassB0ToDPi(candidate), + HfHelper::invMassB0ToDPi(candidate), candidate.pt(), candidate.p(), candidate.cpa(), candidate.cpaXY(), candidate.maxNormalisedDeltaIP(), - hfHelper.ctB0(candidate), + HfHelper::ctB0(candidate), candidate.eta(), candidate.phi(), - hfHelper.yB0(candidate), - hfHelper.eB0(candidate), + HfHelper::yB0(candidate), + HfHelper::eB0(candidate), flagMc, originMc); } diff --git a/PWGHF/TableProducer/treeCreatorBplusToD0Pi.cxx b/PWGHF/TableProducer/treeCreatorBplusToD0Pi.cxx index 4c5beb985c2..9aa6b5f7cab 100644 --- a/PWGHF/TableProducer/treeCreatorBplusToD0Pi.cxx +++ b/PWGHF/TableProducer/treeCreatorBplusToD0Pi.cxx @@ -239,8 +239,6 @@ struct HfTreeCreatorBplusToD0Pi { Configurable downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of background candidates to keep for ML trainings"}; Configurable ptMaxForDownSample{"ptMaxForDownSample", 10., "Maximum pt for the application of the downsampling factor"}; - HfHelper hfHelper; - using SelectedCandidatesMc = soa::Filtered>; using TracksWPid = soa::Join; @@ -281,9 +279,9 @@ struct HfTreeCreatorBplusToD0Pi { auto d0Daughter1 = d0Cand.template prong1_as(); auto invMassD0 = 0.; if (prong1.signed1Pt() > 0) { - invMassD0 = hfHelper.invMassD0barToKPi(d0Cand); + invMassD0 = HfHelper::invMassD0barToKPi(d0Cand); } else if (prong1.signed1Pt() < 0) { - invMassD0 = hfHelper.invMassD0ToPiK(d0Cand); + invMassD0 = HfHelper::invMassD0ToPiK(d0Cand); } if (fillCandidateLiteTable) { rowCandidateLite( @@ -299,14 +297,14 @@ struct HfTreeCreatorBplusToD0Pi { prong1.tpcNSigmaPi(), prong1.tofNSigmaPi(), candidate.isSelBplusToD0Pi(), - hfHelper.invMassBplusToD0Pi(candidate), + HfHelper::invMassBplusToD0Pi(candidate), candidate.pt(), candidate.cpa(), candidate.cpaXY(), candidate.maxNormalisedDeltaIP(), candidate.eta(), candidate.phi(), - hfHelper.yBplus(candidate), + HfHelper::yBplus(candidate), flagMc, originMc); } else { @@ -346,22 +344,22 @@ struct HfTreeCreatorBplusToD0Pi { prong1.tpcNSigmaPi(), prong1.tofNSigmaPi(), candidate.isSelBplusToD0Pi(), - hfHelper.invMassBplusToD0Pi(candidate), + HfHelper::invMassBplusToD0Pi(candidate), candidate.pt(), candidate.p(), candidate.cpa(), candidate.cpaXY(), candidate.maxNormalisedDeltaIP(), - hfHelper.ctBplus(candidate), + HfHelper::ctBplus(candidate), candidate.eta(), candidate.phi(), - hfHelper.yBplus(candidate), - hfHelper.eBplus(candidate), + HfHelper::yBplus(candidate), + HfHelper::eBplus(candidate), flagMc, invMassD0, d0Cand.ptProng0(), d0Cand.ptProng1(), - hfHelper.yD0(d0Cand), + HfHelper::yD0(d0Cand), d0Cand.eta(), d0Cand.cpa(), d0Cand.cpaXY(), diff --git a/PWGHF/TableProducer/treeCreatorBsToDsPi.cxx b/PWGHF/TableProducer/treeCreatorBsToDsPi.cxx index c99fa0752e2..6e30341f584 100644 --- a/PWGHF/TableProducer/treeCreatorBsToDsPi.cxx +++ b/PWGHF/TableProducer/treeCreatorBsToDsPi.cxx @@ -178,8 +178,6 @@ struct HfTreeCreatorBsToDsPi { Configurable downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of background candidates to keep for ML trainings"}; Configurable ptMaxForDownSample{"ptMaxForDownSample", 10., "Maximum pt for the application of the downsampling factor"}; - HfHelper hfHelper; - using SelectedCandidatesMc = soa::Filtered>; using TracksWPid = soa::Join; @@ -226,14 +224,14 @@ struct HfTreeCreatorBsToDsPi { prong1.tpcNSigmaPi(), prong1.tofNSigmaPi(), candidate.isSelBsToDsPi(), - hfHelper.invMassBsToDsPi(candidate), + HfHelper::invMassBsToDsPi(candidate), candidate.pt(), candidate.cpa(), candidate.cpaXY(), candidate.maxNormalisedDeltaIP(), candidate.eta(), candidate.phi(), - hfHelper.yBs(candidate), + HfHelper::yBs(candidate), flagMc); } else { rowCandidateFull( @@ -271,17 +269,17 @@ struct HfTreeCreatorBsToDsPi { prong1.tpcNSigmaPi(), prong1.tofNSigmaPi(), candidate.isSelBsToDsPi(), - hfHelper.invMassBsToDsPi(candidate), + HfHelper::invMassBsToDsPi(candidate), candidate.pt(), candidate.p(), candidate.cpa(), candidate.cpaXY(), candidate.maxNormalisedDeltaIP(), - hfHelper.ctBs(candidate), + HfHelper::ctBs(candidate), candidate.eta(), candidate.phi(), - hfHelper.yBs(candidate), - hfHelper.eBs(candidate), + HfHelper::yBs(candidate), + HfHelper::eBs(candidate), flagMc); } } diff --git a/PWGHF/TableProducer/treeCreatorD0ToKPi.cxx b/PWGHF/TableProducer/treeCreatorD0ToKPi.cxx index dc962e7ed49..17093c0ef64 100644 --- a/PWGHF/TableProducer/treeCreatorD0ToKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorD0ToKPi.cxx @@ -241,8 +241,6 @@ struct HfTreeCreatorD0ToKPi { Configurable ptMaxForDownSample{"ptMaxForDownSample", 10., "Maximum pt for the application of the downsampling factor"}; Configurable fillCorrBkgs{"fillCorrBkgs", false, "Flag to fill derived tables with correlated background candidates"}; - HfHelper hfHelper; - // using TracksWPid = soa::Join; using SelectedCandidatesMc = soa::Filtered>; using SelectedCandidatesMcMl = soa::Filtered>; @@ -329,7 +327,7 @@ struct HfTreeCreatorD0ToKPi { flagMcDecay, origin); } else { - double cosThetaStar = candFlag == 0 ? hfHelper.cosThetaStarD0(candidate) : hfHelper.cosThetaStarD0bar(candidate); + double cosThetaStar = candFlag == 0 ? HfHelper::cosThetaStarD0(candidate) : HfHelper::cosThetaStarD0bar(candidate); rowCandidateFull( candidate.posX(), candidate.posY(), @@ -434,9 +432,9 @@ struct HfTreeCreatorD0ToKPi { continue; } } - double const yD = hfHelper.yD0(candidate); - double const eD = hfHelper.eD0(candidate); - double const ctD = hfHelper.ctD0(candidate); + double const yD = HfHelper::yD0(candidate); + double const eD = HfHelper::eD0(candidate); + double const ctD = HfHelper::ctD0(candidate); float massD0, massD0bar; float topolChi2PerNdf = -999.; if constexpr (ReconstructionType == aod::hf_cand::VertexerType::KfParticle) { @@ -444,8 +442,8 @@ struct HfTreeCreatorD0ToKPi { massD0bar = candidate.kfGeoMassD0bar(); topolChi2PerNdf = candidate.kfTopolChi2OverNdf(); } else { - massD0 = hfHelper.invMassD0ToPiK(candidate); - massD0bar = hfHelper.invMassD0barToKPi(candidate); + massD0 = HfHelper::invMassD0ToPiK(candidate); + massD0bar = HfHelper::invMassD0barToKPi(candidate); } if (candidate.isSelD0()) { fillTable(candidate, 0, massD0, topolChi2PerNdf, ctD, yD, eD, 0, 0, 0); @@ -535,9 +533,9 @@ struct HfTreeCreatorD0ToKPi { continue; } } - double const yD = hfHelper.yD0(candidate); - double const eD = hfHelper.eD0(candidate); - double const ctD = hfHelper.ctD0(candidate); + double const yD = HfHelper::yD0(candidate); + double const eD = HfHelper::eD0(candidate); + double const ctD = HfHelper::ctD0(candidate); float massD0, massD0bar; float topolChi2PerNdf = -999.; if constexpr (ReconstructionType == aod::hf_cand::VertexerType::KfParticle) { @@ -545,8 +543,8 @@ struct HfTreeCreatorD0ToKPi { massD0bar = candidate.kfGeoMassD0bar(); topolChi2PerNdf = candidate.kfTopolChi2OverNdf(); } else { - massD0 = hfHelper.invMassD0ToPiK(candidate); - massD0bar = hfHelper.invMassD0barToKPi(candidate); + massD0 = HfHelper::invMassD0ToPiK(candidate); + massD0bar = HfHelper::invMassD0barToKPi(candidate); } if (candidate.isSelD0()) { fillTable(candidate, 0, massD0, topolChi2PerNdf, ctD, yD, eD, candidate.flagMcMatchRec(), candidate.flagMcDecayChanRec(), candidate.originMcRec()); diff --git a/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx b/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx index f706b1049f1..97978baac1e 100644 --- a/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx @@ -269,8 +269,6 @@ struct HfTreeCreatorDplusToPiKPi { Configurable> classMlIndexes{"classMlIndexes", {0, 2}, "Indexes of ML bkg and non-prompt scores."}; Configurable centEstimator{"centEstimator", 0, "Centrality estimation (None: 0, FT0C: 2, FT0M: 3)"}; - HfHelper hfHelper; - using SelectedCandidatesMc = soa::Filtered>; using MatchedGenCandidatesMc = soa::Filtered>; using SelectedCandidatesMcWithMl = soa::Filtered>; @@ -364,14 +362,14 @@ struct HfTreeCreatorDplusToPiKPi { candidate.tpcTofNSigmaPi2(), candidate.tpcTofNSigmaKa2(), candidate.isSelDplusToPiKPi(), - hfHelper.invMassDplusToPiKPi(candidate), + HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), candidate.cpa(), candidate.cpaXY(), candidate.maxNormalisedDeltaIP(), candidate.eta(), candidate.phi(), - hfHelper.yDplus(candidate), + HfHelper::yDplus(candidate), cent, coll.numContrib(), flagMc, @@ -443,17 +441,17 @@ struct HfTreeCreatorDplusToPiKPi { candidate.tpcTofNSigmaPi2(), candidate.tpcTofNSigmaKa2(), candidate.isSelDplusToPiKPi(), - hfHelper.invMassDplusToPiKPi(candidate), + HfHelper::invMassDplusToPiKPi(candidate), candidate.pt(), candidate.p(), candidate.cpa(), candidate.cpaXY(), candidate.maxNormalisedDeltaIP(), - hfHelper.ctDplus(candidate), + HfHelper::ctDplus(candidate), candidate.eta(), candidate.phi(), - hfHelper.yDplus(candidate), - hfHelper.eDplus(candidate), + HfHelper::yDplus(candidate), + HfHelper::eDplus(candidate), cent, flagMc, originMc, diff --git a/PWGHF/TableProducer/treeCreatorDsToKKPi.cxx b/PWGHF/TableProducer/treeCreatorDsToKKPi.cxx index 4c8fac390e4..90dfa44d771 100644 --- a/PWGHF/TableProducer/treeCreatorDsToKKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorDsToKKPi.cxx @@ -278,8 +278,6 @@ struct HfTreeCreatorDsToKKPi { Configurable downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of background candidates to keep for ML trainings"}; Configurable ptMaxForDownSample{"ptMaxForDownSample", 10., "Maximum pt for the application of the downsampling factor"}; - HfHelper hfHelper; - using CandDsData = soa::Filtered>; using CandDsMcReco = soa::Filtered>; using CandDsMcGen = soa::Filtered>; @@ -336,13 +334,13 @@ struct HfTreeCreatorDsToKKPi { float deltaMassPhiKK = 0; float absCos3PiKDs = 0; if constexpr (MassHypo == 0) { - invMassDs = hfHelper.invMassDsToKKPi(candidate); - deltaMassPhiKK = hfHelper.deltaMassPhiDsToKKPi(candidate); - absCos3PiKDs = hfHelper.absCos3PiKDsToKKPi(candidate); + invMassDs = HfHelper::invMassDsToKKPi(candidate); + deltaMassPhiKK = HfHelper::deltaMassPhiDsToKKPi(candidate); + absCos3PiKDs = HfHelper::absCos3PiKDsToKKPi(candidate); } else if constexpr (MassHypo == 1) { - invMassDs = hfHelper.invMassDsToPiKK(candidate); - deltaMassPhiKK = hfHelper.deltaMassPhiDsToPiKK(candidate); - absCos3PiKDs = hfHelper.absCos3PiKDsToPiKK(candidate); + invMassDs = HfHelper::invMassDsToPiKK(candidate); + deltaMassPhiKK = HfHelper::deltaMassPhiDsToPiKK(candidate); + absCos3PiKDs = HfHelper::absCos3PiKDsToPiKK(candidate); } int8_t flagMc{0}; @@ -358,11 +356,11 @@ struct HfTreeCreatorDsToKKPi { channelMc = candidate.flagMcDecayChanRec(); isSwapped = candidate.isCandidateSwapped(); if (fillDplusMc && candidate.flagMcDecayChanRec() == channelsResonant[Mother::Dplus][decayChannel]) { - eCand = hfHelper.eDplus(candidate); - ctCand = hfHelper.ctDplus(candidate); + eCand = HfHelper::eDplus(candidate); + ctCand = HfHelper::ctDplus(candidate); } else { - eCand = hfHelper.eDs(candidate); - ctCand = hfHelper.ctDs(candidate); + eCand = HfHelper::eDs(candidate); + ctCand = HfHelper::ctDs(candidate); } } diff --git a/PWGHF/TableProducer/treeCreatorLbToLcPi.cxx b/PWGHF/TableProducer/treeCreatorLbToLcPi.cxx index 899d2c2ca28..925a005022c 100644 --- a/PWGHF/TableProducer/treeCreatorLbToLcPi.cxx +++ b/PWGHF/TableProducer/treeCreatorLbToLcPi.cxx @@ -196,7 +196,6 @@ DECLARE_SOA_TABLE(HfCandLbFulls, "AOD", "HFCANDLBFULL", /// Writes the full information in an output TTree struct HfTreeCreatorLbToLcPi { Produces rowCandidateFull; - HfHelper hfHelper; using TracksWPid = soa::Join; @@ -266,10 +265,10 @@ struct HfTreeCreatorLbToLcPi { candLc.nSigTofPr0(), candLc.nSigTofKa1(), candLc.nSigTofPi2(), - hfHelper.invMassLcToPKPi(candLc), - hfHelper.ctLc(candLc), - hfHelper.yLc(candLc), - hfHelper.eLc(candLc), + HfHelper::invMassLcToPKPi(candLc), + HfHelper::ctLc(candLc), + HfHelper::yLc(candLc), + HfHelper::eLc(candLc), candLc.eta(), candLc.xSecondaryVertex(), candLc.ySecondaryVertex(), @@ -303,7 +302,7 @@ struct HfTreeCreatorLbToLcPi { tempConst, tempConst); }; - fillTable(candidate.isSelLbToLcPi(), hfHelper.invMassLbToLcPi(candidate), hfHelper.ctLb(candidate), hfHelper.yLb(candidate)); + fillTable(candidate.isSelLbToLcPi(), HfHelper::invMassLbToLcPi(candidate), HfHelper::ctLb(candidate), HfHelper::yLb(candidate)); } } }; diff --git a/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx b/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx index 4c63d4c7a78..d28e7c5b560 100644 --- a/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx +++ b/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx @@ -243,8 +243,6 @@ struct HfTreeCreatorLcToK0sP { constexpr static float UndefValueFloat = -999.f; - HfHelper hfHelper; - using TracksWPid = soa::Join; using SelectedCandidatesMc = soa::Filtered>; Filter filterSelectCandidates = aod::hf_sel_candidate_lc_to_k0s_p::isSelLcToK0sP >= 1; @@ -308,8 +306,8 @@ struct HfTreeCreatorLcToK0sP { candidate.mAntiLambda(), candidate.mK0Short(), candidate.mGamma(), - hfHelper.ctV0K0s(candidate), - hfHelper.ctV0Lambda(candidate), + HfHelper::ctV0K0s(candidate), + HfHelper::ctV0Lambda(candidate), candidate.dcaV0daughters(), candidate.ptV0Pos(), candidate.ptV0Neg(), @@ -317,15 +315,15 @@ struct HfTreeCreatorLcToK0sP { candidate.dcapostopv(), bach.tpcNSigmaPr(), bach.tofNSigmaPr(), - hfHelper.invMassLcToK0sP(candidate), + HfHelper::invMassLcToK0sP(candidate), candidate.pt(), candidate.cpa(), candidate.cpaXY(), - hfHelper.ctLc(candidate), + HfHelper::ctLc(candidate), candidate.eta(), candidate.phi(), - hfHelper.yLc(candidate), - hfHelper.eLc(candidate), + HfHelper::yLc(candidate), + HfHelper::eLc(candidate), flagMc, originMcRec, mlScoreFirstClass, @@ -374,8 +372,8 @@ struct HfTreeCreatorLcToK0sP { candidate.mAntiLambda(), candidate.mK0Short(), candidate.mGamma(), - hfHelper.ctV0K0s(candidate), - hfHelper.ctV0Lambda(candidate), + HfHelper::ctV0K0s(candidate), + HfHelper::ctV0Lambda(candidate), candidate.dcaV0daughters(), candidate.pxpos(), candidate.pypos(), @@ -389,16 +387,16 @@ struct HfTreeCreatorLcToK0sP { candidate.dcanegtopv(), bach.tpcNSigmaPr(), bach.tofNSigmaPr(), - hfHelper.invMassLcToK0sP(candidate), + HfHelper::invMassLcToK0sP(candidate), candidate.pt(), candidate.p(), candidate.cpa(), candidate.cpaXY(), - hfHelper.ctLc(candidate), + HfHelper::ctLc(candidate), candidate.eta(), candidate.phi(), - hfHelper.yLc(candidate), - hfHelper.eLc(candidate), + HfHelper::yLc(candidate), + HfHelper::eLc(candidate), flagMc, originMcRec, mlScoreFirstClass, diff --git a/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx b/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx index 0d569697787..97264a2336a 100644 --- a/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx @@ -412,8 +412,6 @@ struct HfTreeCreatorLcToPKPi { constexpr static int UndefValueInt = -999; constexpr static float NanoToPico = 1000.f; - HfHelper hfHelper; - using TracksWPid = soa::Join; using Cents = soa::Join; @@ -572,8 +570,8 @@ struct HfTreeCreatorLcToPKPi { template std::pair evaluateInvariantMassesDCAFitter(CandType const& candidate, int candFlag) { - const float invMass = candFlag == 0 ? hfHelper.invMassLcToPKPi(candidate) : hfHelper.invMassLcToPiKP(candidate); - const float invMassKPi = candFlag == 0 ? hfHelper.invMassKPiPairLcToPKPi(candidate) : hfHelper.invMassKPiPairLcToPiKP(candidate); + const float invMass = candFlag == 0 ? HfHelper::invMassLcToPKPi(candidate) : HfHelper::invMassLcToPiKP(candidate); + const float invMassKPi = candFlag == 0 ? HfHelper::invMassKPiPairLcToPKPi(candidate) : HfHelper::invMassKPiPairLcToPiKP(candidate); return std::make_pair(invMass, invMassKPi); } @@ -614,8 +612,8 @@ struct HfTreeCreatorLcToPKPi { void fillLiteTable(CandType const& candidate, aod::HfMlLcToPKPi::iterator const& candidateMlScore, int candFlag) { auto [functionInvMass, functionInvMassKPi] = evaluateInvariantMassesDCAFitter(candidate, candFlag); - const float functionCt = hfHelper.ctLc(candidate); - const float functionY = hfHelper.yLc(candidate); + const float functionCt = HfHelper::ctLc(candidate); + const float functionY = HfHelper::yLc(candidate); int8_t functionFlagMcMatchRec{0}; int8_t functionOriginMcRec{0}; @@ -700,9 +698,9 @@ struct HfTreeCreatorLcToPKPi { void fillFullTable(CandType const& candidate, aod::HfMlLcToPKPi::iterator const& candidateMlScore, int candFlag) { auto [functionInvMass, functionInvMassKPi] = evaluateInvariantMassesDCAFitter(candidate, candFlag); - const float functionCt = hfHelper.ctLc(candidate); - const float functionY = hfHelper.yLc(candidate); - const float functionE = hfHelper.eLc(candidate); + const float functionCt = HfHelper::ctLc(candidate); + const float functionY = HfHelper::yLc(candidate); + const float functionE = HfHelper::eLc(candidate); int8_t functionFlagMcMatchRec{0}; int8_t functionOriginMcRec{0}; diff --git a/PWGHF/TableProducer/treeCreatorSigmacCorrBkg.cxx b/PWGHF/TableProducer/treeCreatorSigmacCorrBkg.cxx index 6b02cd1ae1c..eea4074d3a1 100644 --- a/PWGHF/TableProducer/treeCreatorSigmacCorrBkg.cxx +++ b/PWGHF/TableProducer/treeCreatorSigmacCorrBkg.cxx @@ -88,8 +88,6 @@ struct HfTreeCreatorSigmacCorrBkg { Configurable selectionFlagLc{"selectionFlagLc", 1, "Selection Flag for Lc"}; Configurable yCandRecoMax{"yCandRecoMax", -1, "Maximum Sc candidate rapidity"}; - HfHelper hfHelper; - using RecoLcMc = soa::Join; using RecoScMc = soa::Join; using ParticlesLcSigmac = soa::Join; @@ -100,8 +98,8 @@ struct HfTreeCreatorSigmacCorrBkg { /// void fillTable(RecoScMc::iterator candidateSc, RecoLcMc::iterator candLcDauSc, int motherPdg, int motherDecay = -1) { - const int8_t chargeSc = candidateSc.charge(); // either Σc0 or Σc++ - const float rapidity = chargeSc == 0 ? hfHelper.ySc0(candidateSc) : hfHelper.yScPlusPlus(candidateSc); // NB: since in data we cannot tag Sc(2455) and Sc(2520), then we use only Sc(2455) for y selection on reconstructed signal + const int8_t chargeSc = candidateSc.charge(); // either Σc0 or Σc++ + const float rapidity = chargeSc == 0 ? HfHelper::ySc0(candidateSc) : HfHelper::yScPlusPlus(candidateSc); // NB: since in data we cannot tag Sc(2455) and Sc(2520), then we use only Sc(2455) for y selection on reconstructed signal float massSc = -1.f; float massLc = -1.f; float deltaMass = -1.f; @@ -119,16 +117,16 @@ struct HfTreeCreatorSigmacCorrBkg { } if ((TESTBIT(isCandPKPiPiKP, o2::aod::hf_cand_sigmac::Decays::PKPi)) && std::abs(candLcDauSc.template prong0_as().template mcParticle_as().pdgCode()) == kProton) { - massSc = hfHelper.invMassScRecoLcToPKPi(candidateSc, candLcDauSc); - massLc = hfHelper.invMassLcToPKPi(candLcDauSc); + massSc = HfHelper::invMassScRecoLcToPKPi(candidateSc, candLcDauSc); + massLc = HfHelper::invMassLcToPKPi(candLcDauSc); deltaMass = massSc - massLc; /// fill the tree rowCorrBkgSc(rapidity, candidateSc.pt(), massSc, deltaMass, chargeSc, motherPdg, motherDecay, aod::hf_sigmac_bkg::DecaysLambdac::PKPi, outputMl.at(0), outputMl.at(1)); } if ((TESTBIT(isCandPKPiPiKP, o2::aod::hf_cand_sigmac::Decays::PiKP)) && std::abs(candLcDauSc.template prong0_as().template mcParticle_as().pdgCode()) == kPiPlus) { - massSc = hfHelper.invMassScRecoLcToPiKP(candidateSc, candLcDauSc); - massLc = hfHelper.invMassLcToPiKP(candLcDauSc); + massSc = HfHelper::invMassScRecoLcToPiKP(candidateSc, candLcDauSc); + massLc = HfHelper::invMassLcToPiKP(candLcDauSc); deltaMass = massSc - massLc; /// fill the tree diff --git a/PWGHF/TableProducer/treeCreatorTccToD0D0Pi.cxx b/PWGHF/TableProducer/treeCreatorTccToD0D0Pi.cxx index 1c63cdae324..e57a9c5c7c0 100644 --- a/PWGHF/TableProducer/treeCreatorTccToD0D0Pi.cxx +++ b/PWGHF/TableProducer/treeCreatorTccToD0D0Pi.cxx @@ -258,7 +258,6 @@ struct HfTreeCreatorTccToD0D0Pi { o2::vertexing::DCAFitterN<2> dfD1; // 2-prong vertex fitter (to rebuild D01 vertex) o2::vertexing::DCAFitterN<2> dfD2; // 2-prong vertex fitter (to rebuild D02 vertex) - HfHelper hfHelper; Service ccdb; o2::base::MatLayerCylSet* lut{}; o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; @@ -510,23 +509,23 @@ struct HfTreeCreatorTccToD0D0Pi { if (candidateD1.isSelD0()) { candFlagD1 = (candidateD1.isSelD0bar()) ? 3 : 1; std::copy(candidateD1.mlProbD0().begin(), candidateD1.mlProbD0().end(), std::back_inserter(mlScoresD1)); - massD01 = hfHelper.invMassD0ToPiK(candidateD1); + massD01 = HfHelper::invMassD0ToPiK(candidateD1); } if (candidateD1.isSelD0bar() && !candidateD1.isSelD0()) { candFlagD1 = 2; std::copy(candidateD1.mlProbD0bar().begin(), candidateD1.mlProbD0bar().end(), std::back_inserter(mlScoresD1)); - massD01 = hfHelper.invMassD0barToKPi(candidateD1); + massD01 = HfHelper::invMassD0barToKPi(candidateD1); } if (candidateD2.isSelD0()) { candFlagD2 = (candidateD2.isSelD0bar()) ? 3 : 1; std::copy(candidateD2.mlProbD0().begin(), candidateD2.mlProbD0().end(), std::back_inserter(mlScoresD2)); - massD02 = hfHelper.invMassD0ToPiK(candidateD2); + massD02 = HfHelper::invMassD0ToPiK(candidateD2); } if (candidateD2.isSelD0bar() && !candidateD2.isSelD0()) { candFlagD2 = 2; std::copy(candidateD2.mlProbD0bar().begin(), candidateD2.mlProbD0bar().end(), std::back_inserter(mlScoresD2)); - massD02 = hfHelper.invMassD0barToKPi(candidateD2); + massD02 = HfHelper::invMassD0barToKPi(candidateD2); } // const auto massD0D0Pair = RecoDecay::m(std::array{pVecD1, pVecD2}, std::array{MassD0, MassD0}); @@ -626,8 +625,8 @@ struct HfTreeCreatorTccToD0D0Pi { impactParameterYSoftPi = impactParameterSoftPi.getY(); } // Retrieve properties of the two D0 candidates - float yD1 = hfHelper.yD0(candidateD1); - float yD2 = hfHelper.yD0(candidateD2); + float yD1 = HfHelper::yD0(candidateD1); + float yD2 = HfHelper::yD0(candidateD2); float deltaMassD01 = -999; float deltaMassD02 = -999; diff --git a/PWGHF/TableProducer/treeCreatorXicToPKPi.cxx b/PWGHF/TableProducer/treeCreatorXicToPKPi.cxx index 56e88a3b65e..81543b0e7bf 100644 --- a/PWGHF/TableProducer/treeCreatorXicToPKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorXicToPKPi.cxx @@ -234,8 +234,6 @@ struct HfTreeCreatorXicToPKPi { Configurable downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of background candidates to keep for ML trainings"}; Configurable ptMaxForDownSample{"ptMaxForDownSample", 10., "Maximum pt for the application of the downsampling factor"}; - HfHelper hfHelper; - using CandXicData = soa::Filtered>; using CandXicMcReco = soa::Filtered>; using CandXicMcGen = soa::Filtered>; @@ -287,10 +285,10 @@ struct HfTreeCreatorXicToPKPi { if constexpr (MassHypo == 0) { // Xic->PKPi selStatusPiKP *= -1; - invMassXic = hfHelper.invMassXicToPKPi(candidate); + invMassXic = HfHelper::invMassXicToPKPi(candidate); } else if constexpr (MassHypo == 1) { // Xic->PiKP selStatusPKPi *= -1; - invMassXic = hfHelper.invMassXicToPiKP(candidate); + invMassXic = HfHelper::invMassXicToPiKP(candidate); } if (fillCandidateLiteTable) { rowCandidateLite( @@ -394,11 +392,11 @@ struct HfTreeCreatorXicToPKPi { candidate.p(), candidate.cpa(), candidate.cpaXY(), - hfHelper.ctXic(candidate), + HfHelper::ctXic(candidate), candidate.eta(), candidate.phi(), - hfHelper.yXic(candidate), - hfHelper.eXic(candidate), + HfHelper::yXic(candidate), + HfHelper::eXic(candidate), flagMc, originMc, candSwapped); diff --git a/PWGHF/TableProducer/treeCreatorXiccToPKPiPi.cxx b/PWGHF/TableProducer/treeCreatorXiccToPKPiPi.cxx index 5307d3bfa7b..305ec024513 100644 --- a/PWGHF/TableProducer/treeCreatorXiccToPKPiPi.cxx +++ b/PWGHF/TableProducer/treeCreatorXiccToPKPiPi.cxx @@ -173,8 +173,6 @@ struct HfTreeCreatorXiccToPKPiPi { Produces rowCandidateFullEvents; Produces rowCandidateFullParticles; - HfHelper hfHelper; - using TracksWPid = soa::Join; void init(InitContext const&) @@ -238,10 +236,10 @@ struct HfTreeCreatorXiccToPKPiPi { candidate.errorImpactParameter0(), candidate.errorImpactParameter1(), candidate.impactParameterProduct(), - hfHelper.invMassXicToPKPi(xicCand), - hfHelper.ctXic(xicCand), - hfHelper.yXic(xicCand), - hfHelper.eXic(xicCand), + HfHelper::invMassXicToPKPi(xicCand), + HfHelper::ctXic(xicCand), + HfHelper::yXic(xicCand), + HfHelper::eXic(xicCand), xicCand.eta(), xicCand.cpa(), xicCand.cpaXY(), @@ -269,7 +267,7 @@ struct HfTreeCreatorXiccToPKPiPi { } }; - fillTable(0, candidate.isSelXiccToPKPiPi(), hfHelper.invMassXiccToXicPi(candidate), hfHelper.ctXicc(candidate), hfHelper.yXicc(candidate)); + fillTable(0, candidate.isSelXiccToPKPiPi(), HfHelper::invMassXiccToXicPi(candidate), HfHelper::ctXicc(candidate), HfHelper::yXicc(candidate)); } // Filling particle properties diff --git a/PWGHF/Tasks/taskCharmHadImpactPar.cxx b/PWGHF/Tasks/taskCharmHadImpactPar.cxx index b8da8a09ffa..ca288dfa839 100644 --- a/PWGHF/Tasks/taskCharmHadImpactPar.cxx +++ b/PWGHF/Tasks/taskCharmHadImpactPar.cxx @@ -125,8 +125,6 @@ struct HfTaskCharmHadImpactPar { Configurable occEstimator{"occEstimator", 0, "Occupancy estimation (None: 0, ITS: 1, FT0C: 2)"}; Configurable fillOnlySignal{"fillOnlySignal", false, "Flag to store only matched candidates"}; - HfHelper hfHelper; - using Collisions = soa::Join; using CollisionsCent = soa::Join; using CandDplusData = soa::Filtered>; @@ -181,8 +179,8 @@ struct HfTaskCharmHadImpactPar { } } } - invMass = hfHelper.invMassDplusToPiKPi(candidate); - yCand = hfHelper.yDplus(candidate); + invMass = HfHelper::invMassDplusToPiKPi(candidate); + yCand = HfHelper::yDplus(candidate); if constexpr (WithMl) { for (auto iScore{0u}; iScore < candidate.mlProbDplusToPiKPi().size(); ++iScore) { outputMl[iScore] = candidate.mlProbDplusToPiKPi()[iScore]; @@ -200,8 +198,8 @@ struct HfTaskCharmHadImpactPar { } } } - invMass = hfHelper.invMassD0ToPiK(candidate); - yCand = hfHelper.yD0(candidate); + invMass = HfHelper::invMassD0ToPiK(candidate); + yCand = HfHelper::yD0(candidate); if constexpr (WithMl) { for (auto iScore{0u}; iScore < candidate.mlProbD0().size(); ++iScore) { outputMl[iScore] = candidate.mlProbD0()[iScore]; @@ -212,8 +210,8 @@ struct HfTaskCharmHadImpactPar { } } if (candidate.isSelD0bar()) { - invMass = hfHelper.invMassD0barToKPi(candidate); - yCand = hfHelper.yD0(candidate); + invMass = HfHelper::invMassD0barToKPi(candidate); + yCand = HfHelper::yD0(candidate); if constexpr (WithMl) { for (auto iScore{0u}; iScore < candidate.mlProbD0bar().size(); ++iScore) { outputMl[iScore] = candidate.mlProbD0bar()[iScore]; @@ -239,8 +237,8 @@ struct HfTaskCharmHadImpactPar { std::array phiProngs = {RecoDecay::phi(std::array{candidate.pxProng0(), candidate.pyProng0()}), RecoDecay::phi(std::array{candidate.pxProng1(), candidate.pyProng1()}), 99.}; std::array etaProngs = {RecoDecay::eta(std::array{candidate.pxProng0(), candidate.pyProng0(), candidate.pzProng0()}), RecoDecay::eta(std::array{candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()}), 99.}; if constexpr (Channel == Channel::DplusToKPiPi) { // D+ -> Kpipi - invMass = hfHelper.invMassDplusToPiKPi(candidate); - yCand = hfHelper.yDplus(candidate); + invMass = HfHelper::invMassDplusToPiKPi(candidate); + yCand = HfHelper::yDplus(candidate); ptProngs[2] = candidate.ptProng2(); phiProngs[2] = RecoDecay::phi(candidate.pxProng2(), candidate.pyProng2()); etaProngs[2] = RecoDecay::eta(std::array{candidate.pxProng2(), candidate.pyProng2(), candidate.pzProng2()}); @@ -251,8 +249,8 @@ struct HfTaskCharmHadImpactPar { } } else if constexpr (Channel == Channel::DzeroToKPi) { if (candidate.isSelD0()) { // D0 -> Kpi - invMass = hfHelper.invMassD0ToPiK(candidate); - yCand = hfHelper.yD0(candidate); + invMass = HfHelper::invMassD0ToPiK(candidate); + yCand = HfHelper::yD0(candidate); if constexpr (WithMl) { for (auto iScore{0u}; iScore < candidate.mlProbD0().size(); ++iScore) { outputMl[iScore] = candidate.mlProbD0()[iScore]; @@ -260,8 +258,8 @@ struct HfTaskCharmHadImpactPar { } } if (candidate.isSelD0bar()) { - invMass = hfHelper.invMassD0barToKPi(candidate); - yCand = hfHelper.yD0(candidate); + invMass = HfHelper::invMassD0barToKPi(candidate); + yCand = HfHelper::yD0(candidate); if constexpr (WithMl) { for (auto iScore{0u}; iScore < candidate.mlProbD0bar().size(); ++iScore) { outputMl[iScore] = candidate.mlProbD0bar()[iScore]; diff --git a/PWGHF/Tasks/taskLcCentrality.cxx b/PWGHF/Tasks/taskLcCentrality.cxx index 9baf9bd3bcf..ce3752b40e1 100644 --- a/PWGHF/Tasks/taskLcCentrality.cxx +++ b/PWGHF/Tasks/taskLcCentrality.cxx @@ -59,8 +59,6 @@ struct HfTaskLcCentrality { Configurable yCandMax{"yCandMax", -1., "max. cand. rapidity"}; Configurable> binsPt{"binsPt", std::vector{hf_cuts_lc_to_p_k_pi::vecBinsPt}, "pT bin limits"}; - HfHelper hfHelper; - Filter filterSelectCandidates = (aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLc); HistogramRegistry registry{ @@ -100,14 +98,14 @@ struct HfTaskLcCentrality { if ((candidate.hfflag() & 1 << aod::hf_cand_3prong::DecayType::LcToPKPi) == 0) { continue; } - if (yCandMax >= 0. && std::abs(hfHelper.yLc(candidate)) > yCandMax) { + if (yCandMax >= 0. && std::abs(HfHelper::yLc(candidate)) > yCandMax) { continue; } if (candidate.isSelLcToPKPi() >= selectionFlagLc) { - registry.fill(HIST("hMass"), hfHelper.invMassLcToPKPi(candidate), candidate.pt(), centrality); + registry.fill(HIST("hMass"), HfHelper::invMassLcToPKPi(candidate), candidate.pt(), centrality); } if (candidate.isSelLcToPiKP() >= selectionFlagLc) { - registry.fill(HIST("hMass"), hfHelper.invMassLcToPiKP(candidate), candidate.pt(), centrality); + registry.fill(HIST("hMass"), HfHelper::invMassLcToPiKP(candidate), candidate.pt(), centrality); } registry.fill(HIST("hPtCand"), candidate.pt()); registry.fill(HIST("hPtProng0"), candidate.ptProng0()); @@ -117,7 +115,7 @@ struct HfTaskLcCentrality { registry.fill(HIST("hd0Prong0"), candidate.impactParameter0(), candidate.pt()); registry.fill(HIST("hd0Prong1"), candidate.impactParameter1(), candidate.pt()); registry.fill(HIST("hd0Prong2"), candidate.impactParameter2(), candidate.pt()); - registry.fill(HIST("hCt"), hfHelper.ctLc(candidate), candidate.pt()); + registry.fill(HIST("hCt"), HfHelper::ctLc(candidate), candidate.pt()); registry.fill(HIST("hCPA"), candidate.cpa(), candidate.pt()); registry.fill(HIST("hEta"), candidate.eta(), candidate.pt()); registry.fill(HIST("hSelectionStatus"), candidate.isSelLcToPKPi(), candidate.pt()); @@ -137,8 +135,6 @@ struct HfTaskLcCentralityMc { Configurable yCandMax{"yCandMax", -1., "max. cand. rapidity"}; Configurable> binsPt{"binsPt", std::vector{hf_cuts_lc_to_p_k_pi::vecBinsPt}, "pT bin limits"}; - HfHelper hfHelper; - Filter filterSelectCandidates = (aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLc); HistogramRegistry registry{ @@ -171,7 +167,7 @@ struct HfTaskLcCentralityMc { if ((candidate.hfflag() & 1 << aod::hf_cand_3prong::DecayType::LcToPKPi) == 0) { continue; } - if (yCandMax >= 0. && std::abs(hfHelper.yLc(candidate)) > yCandMax) { + if (yCandMax >= 0. && std::abs(HfHelper::yLc(candidate)) > yCandMax) { continue; } if (std::abs(candidate.flagMcMatchRec()) == hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi) { diff --git a/PWGHF/Tasks/taskMcEfficiency.cxx b/PWGHF/Tasks/taskMcEfficiency.cxx index 7f1c09eef47..5f706c7bede 100644 --- a/PWGHF/Tasks/taskMcEfficiency.cxx +++ b/PWGHF/Tasks/taskMcEfficiency.cxx @@ -70,7 +70,6 @@ struct HfTaskMcEfficiency { Configurable mcAcceptanceEta{"mcAcceptanceEta", 0.8, "MC Acceptance: upper eta limit"}; Service pdg; - HfHelper hfHelper; enum HFStep { kHFStepMC = 0, kHFStepMcInRapidity, // MC mothers in rapidity |y| < 0.5 @@ -258,23 +257,23 @@ struct HfTaskMcEfficiency { /// all candidates if (isHypoMass1TrackStep) { if (pdgCode == Pdg::kLambdaCPlus) { - massHypo1 = hfHelper.invMassLcToPKPi(candidate); + massHypo1 = HfHelper::invMassLcToPKPi(candidate); } else if (pdgCode == Pdg::kXiCPlus) { - massHypo1 = hfHelper.invMassXicToPKPi(candidate); + massHypo1 = HfHelper::invMassXicToPKPi(candidate); } else if (pdgCode == Pdg::kDPlus) { - massHypo1 = hfHelper.invMassDplusToPiKPi(candidate); + massHypo1 = HfHelper::invMassDplusToPiKPi(candidate); } else if (pdgCode == Pdg::kDS) { - massHypo1 = hfHelper.invMassDsToKKPi(candidate); + massHypo1 = HfHelper::invMassDsToKKPi(candidate); } hCandidates->Fill(kHFStepTracked, pt, massHypo1, pdgCode, cpa, collisionMatched, origin); } if (isHypoMass2TrackStep) { if (pdgCode == Pdg::kLambdaCPlus) { - massHypo2 = hfHelper.invMassLcToPiKP(candidate); + massHypo2 = HfHelper::invMassLcToPiKP(candidate); } else if (pdgCode == Pdg::kXiCPlus) { - massHypo2 = hfHelper.invMassXicToPiKP(candidate); + massHypo2 = HfHelper::invMassXicToPiKP(candidate); } else if (pdgCode == Pdg::kDS) { - massHypo2 = hfHelper.invMassDsToPiKK(candidate); + massHypo2 = HfHelper::invMassDsToPiKK(candidate); } hCandidates->Fill(kHFStepTracked, pt, massHypo2, pdgCode, cpa, collisionMatched, origin); } @@ -376,10 +375,10 @@ struct HfTaskMcEfficiency { float const pt = candidate.pt(); bool selected = false; if (pdgCode == Pdg::kD0) { - mass = hfHelper.invMassD0ToPiK(candidate); + mass = HfHelper::invMassD0ToPiK(candidate); selected = candidate.isSelD0() >= selectionFlagD0; } else if (pdgCode == Pdg::kD0Bar) { - mass = hfHelper.invMassD0barToKPi(candidate); + mass = HfHelper::invMassD0barToKPi(candidate); selected = candidate.isSelD0bar() >= selectionFlagD0bar; } LOGP(debug, "Candidate {} has prong {} and prong {} and pT {} and mass {}", candidate.globalIndex(), candidate.prong0Id(), candidate.prong1Id(), candidate.pt(), mass); diff --git a/Tutorials/PWGHF/taskMini.cxx b/Tutorials/PWGHF/taskMini.cxx index 813e9879ce4..65d0f3fc661 100644 --- a/Tutorials/PWGHF/taskMini.cxx +++ b/Tutorials/PWGHF/taskMini.cxx @@ -150,7 +150,6 @@ struct HfTaskMiniCandidateSelectorD0 { Configurable cpaMin{"cpaMin", 0.98, "Min. cosine of pointing angle"}; Configurable massWindow{"massWindow", 0.4, "Half-width of the invariant-mass window"}; - HfHelper hfHelper; TrackSelectorPi selectorPion; TrackSelectorKa selectorKaon; @@ -193,11 +192,11 @@ struct HfTaskMiniCandidateSelectorD0 { { // invariant-mass cut if (trackPion.sign() > 0) { - if (std::abs(hfHelper.invMassD0ToPiK(candidate) - o2::constants::physics::MassD0) > massWindow) { + if (std::abs(HfHelper::invMassD0ToPiK(candidate) - o2::constants::physics::MassD0) > massWindow) { return false; } } else { - if (std::abs(hfHelper.invMassD0barToKPi(candidate) - o2::constants::physics::MassD0) > massWindow) { + if (std::abs(HfHelper::invMassD0barToKPi(candidate) - o2::constants::physics::MassD0) > massWindow) { return false; } } @@ -286,8 +285,6 @@ struct HfTaskMiniD0 { Configurable selectionFlagD0{"selectionFlagD0", 1, "Selection flag for D0"}; Configurable selectionFlagD0bar{"selectionFlagD0bar", 1, "Selection flag for D0 bar"}; - HfHelper hfHelper; - Partition> selectedD0Candidates = aod::hf_selcandidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= selectionFlagD0bar; HistogramRegistry registry{ @@ -308,10 +305,10 @@ struct HfTaskMiniD0 { { for (const auto& candidate : selectedD0Candidates) { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hMass"), hfHelper.invMassD0ToPiK(candidate)); + registry.fill(HIST("hMass"), HfHelper::invMassD0ToPiK(candidate)); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hMass"), hfHelper.invMassD0barToKPi(candidate)); + registry.fill(HIST("hMass"), HfHelper::invMassD0barToKPi(candidate)); } registry.fill(HIST("hPtCand"), candidate.pt()); registry.fill(HIST("hCpaVsPtCand"), candidate.cpa(), candidate.pt()); From 007f607912445486d05dcff1b9dd1d9f62f5b544 Mon Sep 17 00:00:00 2001 From: sofiatomassini <122356048+sofiatomassini@users.noreply.github.com> Date: Fri, 31 Oct 2025 20:23:12 +0100 Subject: [PATCH 978/986] [PWGCF] [Femto3D]modified filter for track sign selection (#13623) --- PWGCF/Femto3D/Tasks/femto3dQA.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGCF/Femto3D/Tasks/femto3dQA.cxx b/PWGCF/Femto3D/Tasks/femto3dQA.cxx index b31f3cd970e..f9f164d9ae3 100644 --- a/PWGCF/Femto3D/Tasks/femto3dQA.cxx +++ b/PWGCF/Femto3D/Tasks/femto3dQA.cxx @@ -90,7 +90,6 @@ struct QAHistograms { std::shared_ptr TPChisto; std::shared_ptr TOFhisto; - Filter signFilter = o2::aod::singletrackselector::sign == _sign; Filter pFilter = o2::aod::singletrackselector::p > _min_P&& o2::aod::singletrackselector::p < _max_P; Filter etaFilter = nabs(o2::aod::singletrackselector::eta) < _eta; @@ -198,7 +197,8 @@ struct QAHistograms { } for (const auto& track : tracks) { - + if (track.sign() != _sign) + continue; if (_removeSameBunchPileup && !track.template singleCollSel_as().isNoSameBunchPileup()) continue; if (_requestGoodZvtxFT0vsPV && !track.template singleCollSel_as().isGoodZvtxFT0vsPV()) From 665f48696f757036275c8ddee32748e6b50ab6a3 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 31 Oct 2025 20:37:59 +0100 Subject: [PATCH 979/986] [PWGEM/Dilepton] restructure EMTrack and EMFwdTrack (#13624) --- PWGEM/Dilepton/Core/Dilepton.h | 54 +++---------- PWGEM/Dilepton/Core/DileptonHadronMPC.h | 85 ++++----------------- PWGEM/Dilepton/Core/PhotonHBT.h | 49 ++---------- PWGEM/Dilepton/Utils/EMFwdTrack.h | 30 +------- PWGEM/Dilepton/Utils/EMTrack.h | 65 ++-------------- PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h | 14 ++-- PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h | 14 ++-- PWGEM/PhotonMeson/Core/TaggingPi0.h | 10 +-- 8 files changed, 57 insertions(+), 264 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 4bdbeda0c97..241ddd7a932 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -818,30 +818,6 @@ struct Dilepton { template bool fillPairInfo(TCollision const& collision, TTrack1 const& t1, TTrack2 const& t2, TCut const& cut, TAllTracks const& tracks) { - if constexpr (ev_id == 1) { - if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - // bool is_found1 = std::find(t2.ambiguousElectronsIds.begin(), t2.ambiguousElectronsIds.end(), t1.globalIndex()) != t2.ambiguousElectronsIds.end(); // this does not work. - // bool is_found2 = std::find(t1.ambiguousElectronsIds.begin(), t1.ambiguousElectronsIds.end(), t2.globalIndex()) != t1.ambiguousElectronsIds.end(); // this does not work. - auto v1ambIds = t1.ambiguousElectronsIds(); - auto v2ambIds = t2.ambiguousElectronsIds(); - - if ((t1.dfId() == t2.dfId()) && std::find(v2ambIds.begin(), v2ambIds.end(), t1.globalIndex()) != v2ambIds.end() && std::find(v1ambIds.begin(), v1ambIds.end(), t2.globalIndex()) != v1ambIds.end()) { - // LOGF(info, "event id = %d: same track is found. t1.globalIndex() = %d, t1.sign() = %d, t1.pt() = %f, t1.eta() = %f, t1.phi() = %f, t2.globalIndex() = %d, t2.sign() = %d, t2.pt() = %f, t2.eta() = %f, t2.phi() = %f, deta = %f, dphi = %f (rad.)", ev_id, t1.globalIndex(), t1.sign(), t1.pt(), t1.eta(), t1.phi(), t2.globalIndex(), t2.sign(), t2.pt(), t2.eta(), t2.phi(), t1.eta() - t2.eta(), t1.phi() - t2.phi()); - return false; // this is protection against pairing 2 identical tracks. This happens, when TTCA is used. TTCA can assign a track to several possible collisions. - } - } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - // bool is_found1 = std::find(t2.ambiguousMuonsIds.begin(), t2.ambiguousMuonsIds.end(), t1.globalIndex()) != t2.ambiguousMuonsIds.end(); // this does not work. - // bool is_found2 = std::find(t1.ambiguousMuonsIds.begin(), t1.ambiguousMuonsIds.end(), t2.globalIndex()) != t1.ambiguousMuonsIds.end(); // this does not work. - auto v1ambIds = t1.ambiguousMuonsIds(); - auto v2ambIds = t2.ambiguousMuonsIds(); - - if ((t1.dfId() == t2.dfId()) && std::find(v2ambIds.begin(), v2ambIds.end(), t1.globalIndex()) != v2ambIds.end() && std::find(v1ambIds.begin(), v1ambIds.end(), t2.globalIndex()) != v1ambIds.end()) { - // LOGF(info, "event id = %d: same track is found. t1.globalIndex() = %d, t1.sign() = %d, t1.pt() = %f, t1.eta() = %f, t1.phi() = %f, t2.globalIndex() = %d, t2.sign() = %d, t2.pt() = %f, t2.eta() = %f, t2.phi() = %f, deta = %f, dphi = %f (rad.)", ev_id, t1.globalIndex(), t1.sign(), t1.pt(), t1.eta(), t1.phi(), t2.globalIndex(), t2.sign(), t2.pt(), t2.eta(), t2.phi(), t1.eta() - t2.eta(), t1.phi() - t2.phi()); - return false; // this is protection against pairing 2 identical tracks. This happens, when TTCA is used. TTCA can assign a track to several possible collisions. - } - } - } - if constexpr (ev_id == 0) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { @@ -878,13 +854,11 @@ struct Dilepton { } float weight = 1.f; - if (cfgApplyWeightTTCA) { - weight = map_weight[std::make_pair(t1.globalIndex(), t2.globalIndex())]; - } - if (ev_id == 1) { - weight = 1.f; + if constexpr (ev_id == 0) { + if (cfgApplyWeightTTCA) { + weight = map_weight[std::make_pair(t1.globalIndex(), t2.globalIndex())]; + } } - // LOGF(info, "ev_id = %d, t1.sign() = %d, t2.sign() = %d, map_weight[std::make_pair(%d, %d)] = %f", ev_id, t1.sign(), t2.sign(), t1.globalIndex(), t2.globalIndex(), weight); ROOT::Math::PtEtaPhiMVector v1(t1.pt(), t1.eta(), t1.phi(), leptonM1); @@ -1079,9 +1053,9 @@ struct Dilepton { used_trackIds_per_col.emplace_back(t1.globalIndex()); if (cfgDoMix) { if (t1.sign() > 0) { - emh_pos->AddTrackToEventPool(key_df_collision, EMTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.trackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.dcaXY(), t1.dcaZ(), possibleIds1, t1.cYY(), t1.cZY(), t1.cZZ())); + emh_pos->AddTrackToEventPool(key_df_collision, EMTrack(t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.dcaXY(), t1.dcaZ(), t1.cYY(), t1.cZY(), t1.cZZ())); } else { - emh_neg->AddTrackToEventPool(key_df_collision, EMTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.trackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.dcaXY(), t1.dcaZ(), possibleIds1, t1.cYY(), t1.cZY(), t1.cZZ())); + emh_neg->AddTrackToEventPool(key_df_collision, EMTrack(t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.dcaXY(), t1.dcaZ(), t1.cYY(), t1.cZY(), t1.cZZ())); } } } @@ -1089,9 +1063,9 @@ struct Dilepton { used_trackIds_per_col.emplace_back(t2.globalIndex()); if (cfgDoMix) { if (t2.sign() > 0) { - emh_pos->AddTrackToEventPool(key_df_collision, EMTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.trackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.dcaXY(), t2.dcaZ(), possibleIds2, t2.cYY(), t2.cZY(), t2.cZZ())); + emh_pos->AddTrackToEventPool(key_df_collision, EMTrack(t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.dcaXY(), t2.dcaZ(), t2.cYY(), t2.cZY(), t2.cZZ())); } else { - emh_neg->AddTrackToEventPool(key_df_collision, EMTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.trackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.dcaXY(), t2.dcaZ(), possibleIds2, t2.cYY(), t2.cZY(), t2.cZZ())); + emh_neg->AddTrackToEventPool(key_df_collision, EMTrack(t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.dcaXY(), t2.dcaZ(), t2.cYY(), t2.cZY(), t2.cZZ())); } } } @@ -1103,11 +1077,9 @@ struct Dilepton { used_trackIds_per_col.emplace_back(t1.globalIndex()); if (cfgDoMix) { if (t1.sign() > 0) { - emh_pos->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.fwdtrackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.fwdDcaX(), t1.fwdDcaY(), possibleIds1, - t1.cXXatDCA(), t1.cXYatDCA(), t1.cYYatDCA())); + emh_pos->AddTrackToEventPool(key_df_collision, EMFwdTrack(t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.fwdDcaX(), t1.fwdDcaY(), t1.cXXatDCA(), t1.cXYatDCA(), t1.cYYatDCA())); } else { - emh_neg->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.fwdtrackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.fwdDcaX(), t1.fwdDcaY(), possibleIds1, - t1.cXXatDCA(), t1.cXYatDCA(), t1.cYYatDCA())); + emh_neg->AddTrackToEventPool(key_df_collision, EMFwdTrack(t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.fwdDcaX(), t1.fwdDcaY(), t1.cXXatDCA(), t1.cXYatDCA(), t1.cYYatDCA())); } } } @@ -1115,11 +1087,9 @@ struct Dilepton { used_trackIds_per_col.emplace_back(t2.globalIndex()); if (cfgDoMix) { if (t2.sign() > 0) { - emh_pos->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.fwdtrackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.fwdDcaX(), t2.fwdDcaY(), possibleIds2, - t2.cXXatDCA(), t2.cXYatDCA(), t2.cYYatDCA())); + emh_pos->AddTrackToEventPool(key_df_collision, EMFwdTrack(t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.fwdDcaX(), t2.fwdDcaY(), t2.cXXatDCA(), t2.cXYatDCA(), t2.cYYatDCA())); } else { - emh_neg->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.fwdtrackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.fwdDcaX(), t2.fwdDcaY(), possibleIds2, - t2.cXXatDCA(), t2.cXYatDCA(), t2.cYYatDCA())); + emh_neg->AddTrackToEventPool(key_df_collision, EMFwdTrack(t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.fwdDcaX(), t2.fwdDcaY(), t2.cXXatDCA(), t2.cXYatDCA(), t2.cYYatDCA())); } } } diff --git a/PWGEM/Dilepton/Core/DileptonHadronMPC.h b/PWGEM/Dilepton/Core/DileptonHadronMPC.h index cc7009f40a6..bbbac707c32 100644 --- a/PWGEM/Dilepton/Core/DileptonHadronMPC.h +++ b/PWGEM/Dilepton/Core/DileptonHadronMPC.h @@ -699,24 +699,6 @@ struct DileptonHadronMPC { template bool fillDilepton(TCollision const& collision, TTrack1 const& t1, TTrack2 const& t2, TCut const& cut, TAllTracks const& tracks) { - if constexpr (ev_id == 1) { - if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - auto v1ambIds = t1.ambiguousElectronsIds(); - auto v2ambIds = t2.ambiguousElectronsIds(); - - if ((t1.dfId() == t2.dfId()) && std::find(v2ambIds.begin(), v2ambIds.end(), t1.globalIndex()) != v2ambIds.end() && std::find(v1ambIds.begin(), v1ambIds.end(), t2.globalIndex()) != v1ambIds.end()) { - return false; // this is protection against pairing 2 identical tracks. This happens, when TTCA is used. TTCA can assign a track to several possible collisions. - } - } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - auto v1ambIds = t1.ambiguousMuonsIds(); - auto v2ambIds = t2.ambiguousMuonsIds(); - - if ((t1.dfId() == t2.dfId()) && std::find(v2ambIds.begin(), v2ambIds.end(), t1.globalIndex()) != v2ambIds.end() && std::find(v1ambIds.begin(), v1ambIds.end(), t2.globalIndex()) != v1ambIds.end()) { - return false; // this is protection against pairing 2 identical tracks. This happens, when TTCA is used. TTCA can assign a track to several possible collisions. - } - } - } - if constexpr (ev_id == 0) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { @@ -753,11 +735,10 @@ struct DileptonHadronMPC { } float weight = 1.f; - if (cfgApplyWeightTTCA) { - weight = map_weight[std::make_pair(t1.globalIndex(), t2.globalIndex())]; - } - if (ev_id == 1) { - weight = 1.f; + if constexpr (ev_id == 0) { + if (cfgApplyWeightTTCA) { + weight = map_weight[std::make_pair(t1.globalIndex(), t2.globalIndex())]; + } } ROOT::Math::PtEtaPhiMVector v1(t1.pt(), t1.eta(), t1.phi(), leptonM1); @@ -788,20 +769,14 @@ struct DileptonHadronMPC { if constexpr (ev_id == 0) { std::pair key_df_collision = std::make_pair(ndf, collision.globalIndex()); - std::vector possibleIds1; - std::vector possibleIds2; - if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - std::copy(t1.ambiguousElectronsIds().begin(), t1.ambiguousElectronsIds().end(), std::back_inserter(possibleIds1)); - std::copy(t2.ambiguousElectronsIds().begin(), t2.ambiguousElectronsIds().end(), std::back_inserter(possibleIds2)); - if (std::find(used_trackIds_per_col.begin(), used_trackIds_per_col.end(), t1.globalIndex()) == used_trackIds_per_col.end()) { used_trackIds_per_col.emplace_back(t1.globalIndex()); if (cfgDoMix) { if (t1.sign() > 0) { - emh_pos->AddTrackToEventPool(key_df_collision, EMTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.trackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.dcaXY(), t1.dcaZ(), possibleIds1, t1.cYY(), t1.cZY(), t1.cZZ())); + emh_pos->AddTrackToEventPool(key_df_collision, EMTrack(t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.dcaXY(), t1.dcaZ(), t1.cYY(), t1.cZY(), t1.cZZ())); } else { - emh_neg->AddTrackToEventPool(key_df_collision, EMTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.trackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.dcaXY(), t1.dcaZ(), possibleIds1, t1.cYY(), t1.cZY(), t1.cZZ())); + emh_neg->AddTrackToEventPool(key_df_collision, EMTrack(t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.dcaXY(), t1.dcaZ(), t1.cYY(), t1.cZY(), t1.cZZ())); } } } @@ -809,25 +784,20 @@ struct DileptonHadronMPC { used_trackIds_per_col.emplace_back(t2.globalIndex()); if (cfgDoMix) { if (t2.sign() > 0) { - emh_pos->AddTrackToEventPool(key_df_collision, EMTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.trackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.dcaXY(), t2.dcaZ(), possibleIds2, t2.cYY(), t2.cZY(), t2.cZZ())); + emh_pos->AddTrackToEventPool(key_df_collision, EMTrack(t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.dcaXY(), t2.dcaZ(), t2.cYY(), t2.cZY(), t2.cZZ())); } else { - emh_neg->AddTrackToEventPool(key_df_collision, EMTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.trackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.dcaXY(), t2.dcaZ(), possibleIds2, t2.cYY(), t2.cZY(), t2.cZZ())); + emh_neg->AddTrackToEventPool(key_df_collision, EMTrack(t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.dcaXY(), t2.dcaZ(), t2.cYY(), t2.cZY(), t2.cZZ())); } } } } else if (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - std::copy(t1.ambiguousMuonsIds().begin(), t1.ambiguousMuonsIds().end(), std::back_inserter(possibleIds1)); - std::copy(t2.ambiguousMuonsIds().begin(), t2.ambiguousMuonsIds().end(), std::back_inserter(possibleIds2)); - if (std::find(used_trackIds_per_col.begin(), used_trackIds_per_col.end(), t1.globalIndex()) == used_trackIds_per_col.end()) { used_trackIds_per_col.emplace_back(t1.globalIndex()); if (cfgDoMix) { if (t1.sign() > 0) { - emh_pos->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.fwdtrackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.fwdDcaX(), t1.fwdDcaY(), possibleIds1, - t1.cXXatDCA(), t1.cXYatDCA(), t1.cYYatDCA())); + emh_pos->AddTrackToEventPool(key_df_collision, EMFwdTrack(t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.fwdDcaX(), t1.fwdDcaY(), t1.cXXatDCA(), t1.cXYatDCA(), t1.cYYatDCA())); } else { - emh_neg->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.fwdtrackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.fwdDcaX(), t1.fwdDcaY(), possibleIds1, - t1.cXXatDCA(), t1.cXYatDCA(), t1.cYYatDCA())); + emh_neg->AddTrackToEventPool(key_df_collision, EMFwdTrack(t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.fwdDcaX(), t1.fwdDcaY(), t1.cXXatDCA(), t1.cXYatDCA(), t1.cYYatDCA())); } } } @@ -835,11 +805,9 @@ struct DileptonHadronMPC { used_trackIds_per_col.emplace_back(t2.globalIndex()); if (cfgDoMix) { if (t2.sign() > 0) { - emh_pos->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.fwdtrackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.fwdDcaX(), t2.fwdDcaY(), possibleIds2, - t2.cXXatDCA(), t2.cXYatDCA(), t2.cYYatDCA())); + emh_pos->AddTrackToEventPool(key_df_collision, EMFwdTrack(t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.fwdDcaX(), t2.fwdDcaY(), t2.cXXatDCA(), t2.cXYatDCA(), t2.cYYatDCA())); } else { - emh_neg->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.fwdtrackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.fwdDcaX(), t2.fwdDcaY(), possibleIds2, - t2.cXXatDCA(), t2.cXYatDCA(), t2.cYYatDCA())); + emh_neg->AddTrackToEventPool(key_df_collision, EMFwdTrack(t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.fwdDcaX(), t2.fwdDcaY(), t2.cXXatDCA(), t2.cXYatDCA(), t2.cYYatDCA())); } } } @@ -852,27 +820,6 @@ struct DileptonHadronMPC { bool fillDileptonHadron(TTrack1 const& t1, TTrack2 const& t2, TCut const& cut, TAllTracks const& tracks, TRefTrack const& t3) { // this function must be called, if dilepton passes the cut. - if constexpr (ev_id == 1) { - if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - // bool is_found1 = std::find(t2.ambiguousElectronsIds.begin(), t2.ambiguousElectronsIds.end(), t1.globalIndex()) != t2.ambiguousElectronsIds.end(); // this does not work. - // bool is_found2 = std::find(t1.ambiguousElectronsIds.begin(), t1.ambiguousElectronsIds.end(), t2.globalIndex()) != t1.ambiguousElectronsIds.end(); // this does not work. - auto v1ambIds = t1.ambiguousElectronsIds(); - auto v2ambIds = t2.ambiguousElectronsIds(); - - if ((t1.dfId() == t2.dfId()) && std::find(v2ambIds.begin(), v2ambIds.end(), t1.globalIndex()) != v2ambIds.end() && std::find(v1ambIds.begin(), v1ambIds.end(), t2.globalIndex()) != v1ambIds.end()) { - return false; // this is protection against pairing 2 identical tracks. This happens, when TTCA is used. TTCA can assign a track to several possible collisions. - } - } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - // bool is_found1 = std::find(t2.ambiguousMuonsIds.begin(), t2.ambiguousMuonsIds.end(), t1.globalIndex()) != t2.ambiguousMuonsIds.end(); // this does not work. - // bool is_found2 = std::find(t1.ambiguousMuonsIds.begin(), t1.ambiguousMuonsIds.end(), t2.globalIndex()) != t1.ambiguousMuonsIds.end(); // this does not work. - auto v1ambIds = t1.ambiguousMuonsIds(); - auto v2ambIds = t2.ambiguousMuonsIds(); - - if ((t1.dfId() == t2.dfId()) && std::find(v2ambIds.begin(), v2ambIds.end(), t1.globalIndex()) != v2ambIds.end() && std::find(v1ambIds.begin(), v1ambIds.end(), t2.globalIndex()) != v1ambIds.end()) { - return false; // this is protection against pairing 2 identical tracks. This happens, when TTCA is used. TTCA can assign a track to several possible collisions. - } - } - } if constexpr (ev_id == 0) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { @@ -1011,12 +958,6 @@ struct DileptonHadronMPC { } // end of if kDielectron } // end of if same event - if constexpr (ev_id == 1) { - if (t1.dfId() == t2.dfId() && t1.globalIndex() == t2.globalIndex()) { - return false; // this never happens. only for protection. - } - } - float weight = 1.f; float deta = t1.eta() - t2.eta(); // t1 is trigger, t2 is associated float dphi = t1.phi() - t2.phi(); // t1 is trigger, t2 is associated @@ -1163,7 +1104,7 @@ struct DileptonHadronMPC { // store ref tracks for mixed event in case of kAzimuthalCorrelation if (cfgDoMix && cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kAzimuthalCorrelation)) { - emh_ref->AddTrackToEventPool(key_df_collision, EMTrack(ndf, track.globalIndex(), collision.globalIndex(), track.trackId(), track.pt(), track.eta(), track.phi(), 0.139)); + emh_ref->AddTrackToEventPool(key_df_collision, EMTrack(track.pt(), track.eta(), track.phi(), 0.139)); } // store ref tracks } } diff --git a/PWGEM/Dilepton/Core/PhotonHBT.h b/PWGEM/Dilepton/Core/PhotonHBT.h index 2646ce7fe7b..dad67122eeb 100644 --- a/PWGEM/Dilepton/Core/PhotonHBT.h +++ b/PWGEM/Dilepton/Core/PhotonHBT.h @@ -827,7 +827,7 @@ struct PhotonHBT { ndiphoton++; if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g1.globalIndex()) == used_photonIds_per_col.end()) { - EMPair g1tmp = EMPair(ndf, g1.globalIndex(), collision.globalIndex(), g1.globalIndex(), g1.pt(), g1.eta(), g1.phi(), 0); + EMPair g1tmp = EMPair(g1.pt(), g1.eta(), g1.phi(), 0); g1tmp.setConversionPointXYZ(g1.vx(), g1.vy(), g1.vz()); g1tmp.setPositiveLegPtEtaPhiM(pos1.pt(), pos1.eta(), pos1.phi(), o2::constants::physics::MassElectron); g1tmp.setNegativeLegPtEtaPhiM(ele1.pt(), ele1.eta(), ele1.phi(), o2::constants::physics::MassElectron); @@ -835,7 +835,7 @@ struct PhotonHBT { used_photonIds_per_col.emplace_back(g1.globalIndex()); } if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g2.globalIndex()) == used_photonIds_per_col.end()) { - EMPair g2tmp = EMPair(ndf, g2.globalIndex(), collision.globalIndex(), g2.globalIndex(), g2.pt(), g2.eta(), g2.phi(), 0); + EMPair g2tmp = EMPair(g2.pt(), g2.eta(), g2.phi(), 0); g2tmp.setConversionPointXYZ(g2.vx(), g2.vy(), g2.vz()); g2tmp.setPositiveLegPtEtaPhiM(pos2.pt(), pos2.eta(), pos2.phi(), o2::constants::physics::MassElectron); g2tmp.setNegativeLegPtEtaPhiM(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron); @@ -945,34 +945,16 @@ struct PhotonHBT { std::pair tuple_tmp_id1 = std::make_pair(pos1.globalIndex(), ele1.globalIndex()); std::pair tuple_tmp_id2 = std::make_pair(pos2.globalIndex(), ele2.globalIndex()); if (std::find(used_dileptonIds_per_col.begin(), used_dileptonIds_per_col.end(), tuple_tmp_id1) == used_dileptonIds_per_col.end()) { - std::vector possibleIds_pos1; - std::vector possibleIds_ele1; - std::copy(pos1.ambiguousElectronsIds().begin(), pos1.ambiguousElectronsIds().end(), std::back_inserter(possibleIds_pos1)); - std::copy(ele1.ambiguousElectronsIds().begin(), ele1.ambiguousElectronsIds().end(), std::back_inserter(possibleIds_ele1)); - - EMPair g1pair = EMPair(ndf, -1, collision.globalIndex(), -1, v1_ee.Pt(), v1_ee.Eta(), v1_ee.Phi(), v1_ee.M()); - g1pair.setGlobalPosId(pos1.globalIndex()); - g1pair.setGlobalNegId(ele1.globalIndex()); + EMPair g1pair = EMPair(v1_ee.Pt(), v1_ee.Eta(), v1_ee.Phi(), v1_ee.M()); g1pair.setPositiveLegPtEtaPhiM(pos1.pt(), pos1.eta(), pos1.phi(), o2::constants::physics::MassElectron); g1pair.setNegativeLegPtEtaPhiM(ele1.pt(), ele1.eta(), ele1.phi(), o2::constants::physics::MassElectron); - g1pair.setAmbPosLegSelfIds(possibleIds_pos1); - g1pair.setAmbNegLegSelfIds(possibleIds_ele1); emh1->AddTrackToEventPool(key_df_collision, g1pair); used_dileptonIds_per_col.emplace_back(tuple_tmp_id1); } if (std::find(used_dileptonIds_per_col.begin(), used_dileptonIds_per_col.end(), tuple_tmp_id2) == used_dileptonIds_per_col.end()) { - std::vector possibleIds_pos2; - std::vector possibleIds_ele2; - std::copy(pos2.ambiguousElectronsIds().begin(), pos2.ambiguousElectronsIds().end(), std::back_inserter(possibleIds_pos2)); - std::copy(ele2.ambiguousElectronsIds().begin(), ele2.ambiguousElectronsIds().end(), std::back_inserter(possibleIds_ele2)); - - EMPair g2pair = EMPair(ndf, -1, collision.globalIndex(), -1, v2_ee.Pt(), v2_ee.Eta(), v2_ee.Phi(), v2_ee.M()); - g2pair.setGlobalPosId(pos2.globalIndex()); - g2pair.setGlobalNegId(ele2.globalIndex()); + EMPair g2pair = EMPair(v2_ee.Pt(), v2_ee.Eta(), v2_ee.Phi(), v2_ee.M()); g2pair.setPositiveLegPtEtaPhiM(pos2.pt(), pos2.eta(), pos2.phi(), o2::constants::physics::MassElectron); g2pair.setNegativeLegPtEtaPhiM(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron); - g2pair.setAmbPosLegSelfIds(possibleIds_pos2); - g2pair.setAmbNegLegSelfIds(possibleIds_ele2); emh1->AddTrackToEventPool(key_df_collision, g2pair); used_dileptonIds_per_col.emplace_back(tuple_tmp_id2); } @@ -1056,7 +1038,7 @@ struct PhotonHBT { ndiphoton++; std::pair tuple_tmp_id2 = std::make_pair(pos2.globalIndex(), ele2.globalIndex()); if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g1.globalIndex()) == used_photonIds_per_col.end()) { - EMPair g1tmp = EMPair(ndf, g1.globalIndex(), collision.globalIndex(), g1.globalIndex(), g1.pt(), g1.eta(), g1.phi(), 0); + EMPair g1tmp = EMPair(g1.pt(), g1.eta(), g1.phi(), 0); g1tmp.setConversionPointXYZ(g1.vx(), g1.vy(), g1.vz()); g1tmp.setPositiveLegPtEtaPhiM(pos1.pt(), pos1.eta(), pos1.phi(), o2::constants::physics::MassElectron); g1tmp.setNegativeLegPtEtaPhiM(ele1.pt(), ele1.eta(), ele1.phi(), o2::constants::physics::MassElectron); @@ -1064,7 +1046,7 @@ struct PhotonHBT { used_photonIds_per_col.emplace_back(g1.globalIndex()); } if (std::find(used_dileptonIds_per_col.begin(), used_dileptonIds_per_col.end(), tuple_tmp_id2) == used_dileptonIds_per_col.end()) { - EMPair g2pair = EMPair(ndf, -1, collision.globalIndex(), -1, v2_ee.Pt(), v2_ee.Eta(), v2_ee.Phi(), v2_ee.M()); + EMPair g2pair = EMPair(v2_ee.Pt(), v2_ee.Eta(), v2_ee.Phi(), v2_ee.M()); g2pair.setPositiveLegPtEtaPhiM(pos2.pt(), pos2.eta(), pos2.phi(), o2::constants::physics::MassElectron); g2pair.setNegativeLegPtEtaPhiM(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron); emh2->AddTrackToEventPool(key_df_collision, g2pair); @@ -1173,27 +1155,11 @@ struct PhotonHBT { for (const auto& g1 : selected_photons1_in_this_event) { for (const auto& g2 : photons1_from_event_pool) { - auto v1amb_pos_Ids = g1.ambiguousPosLegIds(); - auto v1amb_neg_Ids = g1.ambiguousNegLegIds(); - auto v2amb_pos_Ids = g2.ambiguousPosLegIds(); - auto v2amb_neg_Ids = g2.ambiguousNegLegIds(); - - bool is_found_pos1 = std::find(v2amb_pos_Ids.begin(), v2amb_pos_Ids.end(), g1.globalIndexPos()) != v2amb_pos_Ids.end(); - bool is_found_neg1 = std::find(v2amb_neg_Ids.begin(), v2amb_neg_Ids.end(), g1.globalIndexPos()) != v2amb_neg_Ids.end(); - bool is_found_pos2 = std::find(v1amb_pos_Ids.begin(), v1amb_pos_Ids.end(), g2.globalIndexPos()) != v1amb_pos_Ids.end(); - bool is_found_neg2 = std::find(v1amb_neg_Ids.begin(), v1amb_neg_Ids.end(), g2.globalIndexPos()) != v1amb_neg_Ids.end(); - // LOGF(info, "is_found_pos1 = %d, is_found_neg1 = %d, is_found_pos2 = %d, is_found_neg2 = %d", is_found_pos1, is_found_neg1, is_found_pos2, is_found_neg2); - // auto pos1 = g1.getPositiveLeg(); // auto ele1 = g1.getNegativeLeg(); // auto pos2 = g2.getPositiveLeg(); // auto ele2 = g2.getNegativeLeg(); - if ((g1.dfId() == g2.dfId()) && ((is_found_pos1 && is_found_pos2) || (is_found_neg1 && is_found_neg2))) { - // LOGF(info, "event id = %d: same track is found. t1.globalIndex() = %d, t1.sign() = %d, t1.pt() = %f, t1.eta() = %f, t1.phi() = %f, t2.globalIndex() = %d, t2.sign() = %d, t2.pt() = %f, t2.eta() = %f, t2.phi() = %f, deta = %f, dphi = %f (rad.)", ev_id, t1.globalIndex(), t1.sign(), t1.pt(), t1.eta(), t1.phi(), t2.globalIndex(), t2.sign(), t2.pt(), t2.eta(), t2.phi(), t1.eta() - t2.eta(), t1.phi() - t2.phi()); - continue; // this is protection against pairing 2 identical tracks. This happens, when TTCA is used. TTCA can assign a track to several possible collisions. - } - ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), g1.mass()); ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), g2.mass()); @@ -1354,9 +1320,6 @@ struct PhotonHBT { if (!collision.swtalias_bit(o2::aod::pwgem::dilepton::swt::aliasLabels.at(cfg_swt_name.value))) { continue; } - // if (collision.spherocity_ptunweighted() < cfgSpherocityMin || cfgSpherocityMax < collision.spherocity_ptunweighted()) { - // continue; - // } } if (!fEMEventCut.IsSelected(collision)) { continue; diff --git a/PWGEM/Dilepton/Utils/EMFwdTrack.h b/PWGEM/Dilepton/Utils/EMFwdTrack.h index 760441a08bf..3ef4cecfe7d 100644 --- a/PWGEM/Dilepton/Utils/EMFwdTrack.h +++ b/PWGEM/Dilepton/Utils/EMFwdTrack.h @@ -22,12 +22,8 @@ namespace o2::aod::pwgem::dilepton::utils class EMFwdTrack { public: - EMFwdTrack(int dfId, int globalId, int collisionId, int trackId, float pt, float eta, float phi, float mass, int8_t charge, float dcaX, float dcaY, std::vector amb_muon_self_ids, float cXX, float cXY, float cYY) + EMFwdTrack(float pt, float eta, float phi, float mass, int8_t charge, float dcaX, float dcaY, float cXX, float cXY, float cYY) { - fDFId = dfId; - fGlobalId = globalId; - fCollisionId = collisionId; - fTrackId = trackId; fPt = pt; fEta = eta; fPhi = phi; @@ -35,14 +31,6 @@ class EMFwdTrack fCharge = charge; fDCAx = dcaX; fDCAy = dcaY; - fPairDCAXYinSigmaOTF = 0; - - fAmbMuonSelfIds = amb_muon_self_ids; - if (fAmbMuonSelfIds.size() > 0) { - fIsAmbiguous = true; - } else { - fIsAmbiguous = false; - } fCXX = cXX; fCXY = cXY; @@ -51,10 +39,6 @@ class EMFwdTrack ~EMFwdTrack() {} - int dfId() const { return fDFId; } - int globalIndex() const { return fGlobalId; } - int collisionId() const { return fCollisionId; } - int fwdtrackId() const { return fTrackId; } float pt() const { return fPt; } float eta() const { return fEta; } float phi() const { return fPhi; } @@ -67,22 +51,13 @@ class EMFwdTrack float px() const { return fPt * std::cos(fPhi); } float py() const { return fPt * std::sin(fPhi); } float pz() const { return fPt * std::sinh(fEta); } - bool has_ambiguousMuons() const { return fIsAmbiguous; } - std::vector ambiguousMuonsIds() const { return fAmbMuonSelfIds; } float signed1Pt() const { return fCharge * 1.f / fPt; } float cXXatDCA() const { return fCXX; } float cXYatDCA() const { return fCXY; } float cYYatDCA() const { return fCYY; } - float pairDcaXYinSigmaOTF() const { return fPairDCAXYinSigmaOTF; } - void setPairDcaXYinSigmaOTF(float dca) { fPairDCAXYinSigmaOTF = dca; } - protected: - int fDFId; - int fGlobalId; - int fCollisionId; - int fTrackId; float fPt; float fEta; float fPhi; @@ -90,9 +65,6 @@ class EMFwdTrack int8_t fCharge; float fDCAx; float fDCAy; - float fPairDCAXYinSigmaOTF; - bool fIsAmbiguous; - std::vector fAmbMuonSelfIds; float fCXX; float fCXY; float fCYY; diff --git a/PWGEM/Dilepton/Utils/EMTrack.h b/PWGEM/Dilepton/Utils/EMTrack.h index 06bb7bc73f3..9c0a6f0691e 100644 --- a/PWGEM/Dilepton/Utils/EMTrack.h +++ b/PWGEM/Dilepton/Utils/EMTrack.h @@ -24,12 +24,8 @@ namespace o2::aod::pwgem::dilepton::utils class EMTrack { public: - EMTrack(int dfId, int globalId, int collisionId, int trackId, float pt, float eta, float phi, float mass, int8_t charge = 0, float dcaXY = 0.f, float dcaZ = 0.f, std::vector amb_ele_self_ids = {}, float CYY = 0, float CZY = 0, float CZZ = 0) + EMTrack(float pt, float eta, float phi, float mass, int8_t charge = 0, float dcaXY = 0.f, float dcaZ = 0.f, float CYY = 0, float CZY = 0, float CZZ = 0) { - fDFId = dfId; - fGlobalId = globalId; - fCollisionId = collisionId; - fTrackId = trackId; fPt = pt; fEta = eta; fPhi = phi; @@ -40,25 +36,10 @@ class EMTrack fCYY = CYY; fCZY = CZY; fCZZ = CZZ; - - fAmbEleSelfIds = amb_ele_self_ids; - if (fAmbEleSelfIds.size() > 0) { - fIsAmbiguous = true; - } else { - fIsAmbiguous = false; - } } - ~EMTrack() - { - fAmbEleSelfIds.clear(); - fAmbEleSelfIds.shrink_to_fit(); - } + ~EMTrack() {} - int dfId() const { return fDFId; } - int globalIndex() const { return fGlobalId; } - int collisionId() const { return fCollisionId; } - int trackId() const { return fTrackId; } float pt() const { return fPt; } float eta() const { return fEta; } float phi() const { return fPhi; } @@ -75,15 +56,9 @@ class EMTrack float px() const { return fPt * std::cos(fPhi); } float py() const { return fPt * std::sin(fPhi); } float pz() const { return fPt * std::sinh(fEta); } - bool has_ambiguousElectrons() const { return fIsAmbiguous; } - std::vector ambiguousElectronsIds() const { return fAmbEleSelfIds; } float signed1Pt() const { return fCharge * 1.f / fPt; } protected: - int fDFId; - int fGlobalId; - int fCollisionId; - int fTrackId; float fPt; float fEta; float fPhi; @@ -94,19 +69,17 @@ class EMTrack float fCYY; float fCZY; float fCZZ; - bool fIsAmbiguous; - std::vector fAmbEleSelfIds; }; class EMTrackWithCov : public EMTrack { public: - EMTrackWithCov(int dfId, int globalId, int collisionId, int trackId, float pt, float eta, float phi, float mass, int8_t charge = 0, float dcaXY = 0.f, float dcaZ = 0.f, std::vector amb_ele_self_ids = {}, + EMTrackWithCov(float pt, float eta, float phi, float mass, int8_t charge = 0, float dcaXY = 0.f, float dcaZ = 0.f, float X = 0.f, float Y = 0.f, float Z = 0.f, float Alpha = 0.f, float Snp = 0.f, float Tgl = 0.f, float CYY = 0.f, float CZY = 0.f, float CZZ = 0.f, float CSnpY = 0.f, float CSnpZ = 0.f, float CSnpSnp = 0.f, float CTglY = 0.f, float CTglZ = 0.f, float CTglSnp = 0.f, float CTglTgl = 0.f, - float C1PtY = 0.f, float C1PtZ = 0.f, float C1PtSnp = 0.f, float C1PtTgl = 0.f, float C1Pt21Pt2 = 0.f) : EMTrack(dfId, globalId, collisionId, trackId, pt, eta, phi, mass, charge, dcaXY, dcaZ, amb_ele_self_ids) + float C1PtY = 0.f, float C1PtZ = 0.f, float C1PtSnp = 0.f, float C1PtTgl = 0.f, float C1Pt21Pt2 = 0.f) : EMTrack(pt, eta, phi, mass, charge, dcaXY, dcaZ) { fX = X; fY = Y; @@ -177,33 +150,16 @@ class EMTrackWithCov : public EMTrack class EMPair : public EMTrack { public: - EMPair(int dfId, int globalId, int collisionId, int trackId, float pt, float eta, float phi, float mass) : EMTrack(dfId, globalId, collisionId, trackId, pt, eta, phi, mass, 0, 0, 0, std::vector{}, 0, 0, 0) + EMPair(float pt, float eta, float phi, float mass) : EMTrack(pt, eta, phi, mass, 0, 0, 0, 0, 0, 0) { - fGlobalPosId = 0; - fGlobalNegId = 0; fVPos = ROOT::Math::PtEtaPhiMVector(0, 0, 0, 0); fVNeg = ROOT::Math::PtEtaPhiMVector(0, 0, 0, 0); - fAmbPosLegSelfIds.clear(); - fAmbNegLegSelfIds.clear(); - fAmbPosLegSelfIds.shrink_to_fit(); - fAmbNegLegSelfIds.shrink_to_fit(); fVx = 0.f; fVy = 0.f; fVz = 0.f; } - ~EMPair() - { - fAmbPosLegSelfIds.clear(); - fAmbNegLegSelfIds.clear(); - fAmbPosLegSelfIds.shrink_to_fit(); - fAmbNegLegSelfIds.shrink_to_fit(); - } - - void setGlobalPosId(int id) { fGlobalPosId = id; } - void setGlobalNegId(int id) { fGlobalNegId = id; } - int globalIndexPos() const { return fGlobalPosId; } - int globalIndexNeg() const { return fGlobalNegId; } + ~EMPair() {} void setPositiveLegPtEtaPhiM(float pt, float eta, float phi, float m) { @@ -223,11 +179,6 @@ class EMPair : public EMTrack ROOT::Math::PtEtaPhiMVector getPositiveLeg() const { return fVPos; } ROOT::Math::PtEtaPhiMVector getNegativeLeg() const { return fVNeg; } - void setAmbPosLegSelfIds(std::vector selfIds) { fAmbPosLegSelfIds = selfIds; } - void setAmbNegLegSelfIds(std::vector selfIds) { fAmbNegLegSelfIds = selfIds; } - std::vector ambiguousPosLegIds() const { return fAmbPosLegSelfIds; } - std::vector ambiguousNegLegIds() const { return fAmbNegLegSelfIds; } - void setConversionPointXYZ(float x, float y, float z) { fVx = x; @@ -242,12 +193,8 @@ class EMPair : public EMTrack float phi_cp() const { return std::atan2(fVy, fVx); } protected: - int fGlobalPosId; - int fGlobalNegId; ROOT::Math::PtEtaPhiMVector fVPos; ROOT::Math::PtEtaPhiMVector fVNeg; - std::vector fAmbPosLegSelfIds; // for dileptons - std::vector fAmbNegLegSelfIds; // for dileptons // only for photon conversion point float fVx; diff --git a/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h index 8d08a1b6c0c..8a805a4a0a6 100644 --- a/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h +++ b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h @@ -603,17 +603,17 @@ struct DiphotonHadronMPC { if (npair > 0) { std::tuple tuple_tmp_diphoton = std::make_tuple(g1.globalIndex(), g2.globalIndex(), -1); if (std::find(used_diphotonIds_per_col.begin(), used_diphotonIds_per_col.end(), tuple_tmp_diphoton) == used_diphotonIds_per_col.end()) { - emh_diphoton->AddTrackToEventPool(key_df_collision, EMTrack(ndf, -1, collision.globalIndex(), -1, v12.Pt(), v12.Eta(), v12.Phi(), v12.M())); + emh_diphoton->AddTrackToEventPool(key_df_collision, EMTrack(v12.Pt(), v12.Eta(), v12.Phi(), v12.M())); used_diphotonIds_per_col.emplace_back(tuple_tmp_diphoton); } } if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g1.globalIndex()) == used_photonIds_per_col.end()) { - emh1->AddTrackToEventPool(key_df_collision, EMTrack(ndf, g1.globalIndex(), collision.globalIndex(), g1.globalIndex(), g1.pt(), g1.eta(), g1.phi(), 0)); + emh1->AddTrackToEventPool(key_df_collision, EMTrack(g1.pt(), g1.eta(), g1.phi(), 0)); used_photonIds_per_col.emplace_back(g1.globalIndex()); } if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g2.globalIndex()) == used_photonIds_per_col.end()) { - emh1->AddTrackToEventPool(key_df_collision, EMTrack(ndf, g2.globalIndex(), collision.globalIndex(), g2.globalIndex(), g2.pt(), g2.eta(), g2.phi(), 0)); + emh1->AddTrackToEventPool(key_df_collision, EMTrack(g2.pt(), g2.eta(), g2.phi(), 0)); used_photonIds_per_col.emplace_back(g2.globalIndex()); } ndiphoton++; @@ -679,18 +679,18 @@ struct DiphotonHadronMPC { if (npair > 0) { std::tuple tuple_tmp_diphoton = std::make_tuple(g1.globalIndex(), pos2.trackId(), ele2.trackId()); if (std::find(used_diphotonIds_per_col.begin(), used_diphotonIds_per_col.end(), tuple_tmp_diphoton) == used_diphotonIds_per_col.end()) { - emh_diphoton->AddTrackToEventPool(key_df_collision, EMTrack(ndf, -1, collision.globalIndex(), -1, veeg.Pt(), veeg.Eta(), veeg.Phi(), veeg.M())); + emh_diphoton->AddTrackToEventPool(key_df_collision, EMTrack(veeg.Pt(), veeg.Eta(), veeg.Phi(), veeg.M())); used_diphotonIds_per_col.emplace_back(tuple_tmp_diphoton); } } std::pair tuple_tmp_id2 = std::make_pair(pos2.trackId(), ele2.trackId()); if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g1.globalIndex()) == used_photonIds_per_col.end()) { - emh1->AddTrackToEventPool(key_df_collision, EMTrack(ndf, g1.globalIndex(), collision.globalIndex(), -1, g1.pt(), g1.eta(), g1.phi(), 0)); + emh1->AddTrackToEventPool(key_df_collision, EMTrack(g1.pt(), g1.eta(), g1.phi(), 0)); used_photonIds_per_col.emplace_back(g1.globalIndex()); } if (std::find(used_dileptonIds_per_col.begin(), used_dileptonIds_per_col.end(), tuple_tmp_id2) == used_dileptonIds_per_col.end()) { - emh2->AddTrackToEventPool(key_df_collision, EMTrack(ndf, -1, collision.globalIndex(), -1, v_ee.Pt(), v_ee.Eta(), v_ee.Phi(), v_ee.M())); + emh2->AddTrackToEventPool(key_df_collision, EMTrack(v_ee.Pt(), v_ee.Eta(), v_ee.Phi(), v_ee.M())); used_dileptonIds_per_col.emplace_back(tuple_tmp_id2); } ndiphoton++; @@ -711,7 +711,7 @@ struct DiphotonHadronMPC { if (fEMTrackCut.IsSelected(track)) { fRegistry.fill(HIST("Hadron/hs"), track.pt(), track.eta(), track.phi()); fRegistry.fill(HIST("Hadron/hTrackBit"), track.trackBit()); - emh_ref->AddTrackToEventPool(key_df_collision, EMTrack(ndf, track.globalIndex(), collision.globalIndex(), track.globalIndex(), track.pt(), track.eta(), track.phi(), 0.139)); + emh_ref->AddTrackToEventPool(key_df_collision, EMTrack(track.pt(), track.eta(), track.phi(), 0.139)); } } diff --git a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h index 023fafc3a73..b9315dbd898 100644 --- a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h +++ b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h @@ -77,7 +77,7 @@ struct Pi0EtaToGammaGamma { o2::framework::Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; o2::framework::Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; o2::framework::Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; - o2::framework::Configurable ndiff_bc_mix{"ndiff_bc_mix", 198, "difference in global BC required in mixed events"}; + o2::framework::Configurable ndiff_bc_mix{"ndiff_bc_mix", 594, "difference in global BC required in mixed events"}; o2::framework::Configurable cfgQvecEstimator{"cfgQvecEstimator", 0, "FT0M:0, FT0A:1, FT0C:2"}; o2::framework::Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; @@ -649,11 +649,11 @@ struct Pi0EtaToGammaGamma { } if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g1.globalIndex()) == used_photonIds_per_col.end()) { - emh1->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(-1, g1.globalIndex(), collision.globalIndex(), g1.globalIndex(), g1.pt(), g1.eta(), g1.phi(), 0)); + emh1->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(g1.pt(), g1.eta(), g1.phi(), 0)); used_photonIds_per_col.emplace_back(g1.globalIndex()); } if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g2.globalIndex()) == used_photonIds_per_col.end()) { - emh1->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(-1, g2.globalIndex(), collision.globalIndex(), g2.globalIndex(), g2.pt(), g2.eta(), g2.phi(), 0)); + emh1->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(g2.pt(), g2.eta(), g2.phi(), 0)); used_photonIds_per_col.emplace_back(g2.globalIndex()); } ndiphoton++; @@ -700,11 +700,11 @@ struct Pi0EtaToGammaGamma { std::pair tuple_tmp_id2 = std::make_pair(pos2.trackId(), ele2.trackId()); if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g1.globalIndex()) == used_photonIds_per_col.end()) { - emh1->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(-1, g1.globalIndex(), collision.globalIndex(), -1, g1.pt(), g1.eta(), g1.phi(), 0)); + emh1->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(g1.pt(), g1.eta(), g1.phi(), 0)); used_photonIds_per_col.emplace_back(g1.globalIndex()); } if (std::find(used_dileptonIds_per_col.begin(), used_dileptonIds_per_col.end(), tuple_tmp_id2) == used_dileptonIds_per_col.end()) { - emh2->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(-1, -1, collision.globalIndex(), -1, v_ee.Pt(), v_ee.Eta(), v_ee.Phi(), v_ee.M())); + emh2->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(v_ee.Pt(), v_ee.Eta(), v_ee.Phi(), v_ee.M())); used_dileptonIds_per_col.emplace_back(tuple_tmp_id2); } ndiphoton++; @@ -728,11 +728,11 @@ struct Pi0EtaToGammaGamma { fRegistry.fill(HIST("Pair/same/hs"), v12.M(), v12.Pt(), weight); if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g1.globalIndex()) == used_photonIds_per_col.end()) { - emh1->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(-1, g1.globalIndex(), collision.globalIndex(), -1, g1.pt(), g1.eta(), g1.phi(), 0)); + emh1->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(g1.pt(), g1.eta(), g1.phi(), 0)); used_photonIds_per_col.emplace_back(g1.globalIndex()); } if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g2.globalIndex()) == used_photonIds_per_col.end()) { - emh2->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(-1, g2.globalIndex(), collision.globalIndex(), -1, g2.pt(), g2.eta(), g2.phi(), 0)); + emh2->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(g2.pt(), g2.eta(), g2.phi(), 0)); used_photonIds_per_col.emplace_back(g2.globalIndex()); } ndiphoton++; diff --git a/PWGEM/PhotonMeson/Core/TaggingPi0.h b/PWGEM/PhotonMeson/Core/TaggingPi0.h index 855ea2b09bd..462708a5087 100644 --- a/PWGEM/PhotonMeson/Core/TaggingPi0.h +++ b/PWGEM/PhotonMeson/Core/TaggingPi0.h @@ -90,7 +90,7 @@ struct TaggingPi0 { Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; - Configurable ndiff_bc_mix{"ndiff_bc_mix", 198, "difference in global BC required in mixed events"}; + Configurable ndiff_bc_mix{"ndiff_bc_mix", 594, "difference in global BC required in mixed events"}; Configurable cfgQvecEstimator{"cfgQvecEstimator", 0, "FT0M:0, FT0A:1, FT0C:2"}; Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; @@ -574,11 +574,11 @@ struct TaggingPi0 { std::pair tuple_tmp_id2 = std::make_pair(pos2.trackId(), ele2.trackId()); if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g1.globalIndex()) == used_photonIds_per_col.end()) { - emh1->AddTrackToEventPool(key_df_collision, EMTrack(-1, g1.globalIndex(), collision.globalIndex(), -1, g1.pt(), g1.eta(), g1.phi(), 0)); + emh1->AddTrackToEventPool(key_df_collision, EMTrack(g1.pt(), g1.eta(), g1.phi(), 0)); used_photonIds_per_col.emplace_back(g1.globalIndex()); } if (std::find(used_dileptonIds_per_col.begin(), used_dileptonIds_per_col.end(), tuple_tmp_id2) == used_dileptonIds_per_col.end()) { - emh2->AddTrackToEventPool(key_df_collision, EMTrack(-1, -1, collision.globalIndex(), -1, v_ee.Pt(), v_ee.Eta(), v_ee.Phi(), v_ee.M())); + emh2->AddTrackToEventPool(key_df_collision, EMTrack(v_ee.Pt(), v_ee.Eta(), v_ee.Phi(), v_ee.M())); used_dileptonIds_per_col.emplace_back(tuple_tmp_id2); } ndiphoton++; @@ -599,11 +599,11 @@ struct TaggingPi0 { fRegistry.fill(HIST("Pair/same/hMvsPt"), v12.M(), v1.Pt(), weight); if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g1.globalIndex()) == used_photonIds_per_col.end()) { - emh1->AddTrackToEventPool(key_df_collision, EMTrack(-1, g1.globalIndex(), collision.globalIndex(), -1, g1.pt(), g1.eta(), g1.phi(), 0)); + emh1->AddTrackToEventPool(key_df_collision, EMTrack(g1.pt(), g1.eta(), g1.phi(), 0)); used_photonIds_per_col.emplace_back(g1.globalIndex()); } if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g2.globalIndex()) == used_photonIds_per_col.end()) { - emh2->AddTrackToEventPool(key_df_collision, EMTrack(-1, g2.globalIndex(), collision.globalIndex(), -1, g2.pt(), g2.eta(), g2.phi(), 0)); + emh2->AddTrackToEventPool(key_df_collision, EMTrack(g2.pt(), g2.eta(), g2.phi(), 0)); used_photonIds_per_col.emplace_back(g2.globalIndex()); } ndiphoton++; From d3c535e9aff9566d7fbe2ecaf4069d6cef40670a Mon Sep 17 00:00:00 2001 From: ariedel-cern <85537041+ariedel-cern@users.noreply.github.com> Date: Fri, 31 Oct 2025 21:34:17 +0100 Subject: [PATCH 980/986] [PWGCF] Update femto framework (#13622) --- PWGCF/Femto/Core/closePairRejection.h | 83 ++++++---- PWGCF/Femto/Core/dataTypes.h | 5 +- PWGCF/Femto/Core/modes.h | 12 +- PWGCF/Femto/Core/pairBuilder.h | 4 +- PWGCF/Femto/Core/pairHistManager.h | 230 +++++++++++++++----------- PWGCF/Femto/Core/pairProcessHelpers.h | 21 ++- 6 files changed, 210 insertions(+), 145 deletions(-) diff --git a/PWGCF/Femto/Core/closePairRejection.h b/PWGCF/Femto/Core/closePairRejection.h index 214f19f1d8d..c7044ceef88 100644 --- a/PWGCF/Femto/Core/closePairRejection.h +++ b/PWGCF/Femto/Core/closePairRejection.h @@ -63,6 +63,8 @@ struct ConfCpr : o2::framework::ConfigurableGroup { o2::framework::Configurable plotAverage{"plotAverage", true, "Plot average deta dphi distribution"}; o2::framework::Configurable detaMax{"detaMax", 0.01f, "Maximium deta"}; o2::framework::Configurable dphistarMax{"dphistarMax", 0.01f, "Maximum dphistar"}; + o2::framework::Configurable kstarMin{"kstarMin", -1.f, "Minimum kstar of pair for plotting (Set to negative value to turn off the cut)"}; + o2::framework::Configurable kstarMax{"kstarMax", -1.f, "Maximum kstar of pair for plotting (Set to negative value to turn off the cut)"}; o2::framework::ConfigurableAxis binningDeta{"binningDeta", {{250, -0.5, 0.5}}, "deta"}; o2::framework::ConfigurableAxis binningDphistar{"binningDphistar", {{250, -0.5, 0.5}}, "dphi"}; }; @@ -140,19 +142,15 @@ class CloseTrackRejection CloseTrackRejection() = default; ~CloseTrackRejection() = default; + template void init(o2::framework::HistogramRegistry* registry, std::map> const& specs, - bool plotAverage, - bool plotAllRadii, - bool cutOnAverage, - bool cutOnAnyRadius, - float detaMax, - float dphistarMax, + T const& confCpr, int chargeAbsTrack1, int chargeAbsTrack2) { - mDetaMax = detaMax; - mDphistarMax = dphistarMax; + mDetaMax = confCpr.detaMax.value; + mDphistarMax = confCpr.dphistarMax.value; // check the limits if (mDetaMax <= 0 || mDphistarMax <= 0) { @@ -162,14 +160,17 @@ class CloseTrackRejection mChargeAbsTrack1 = std::abs(chargeAbsTrack1); mChargeAbsTrack2 = std::abs(chargeAbsTrack2); - mCutOnAverage = cutOnAverage; - mCutOnAnyRadius = cutOnAnyRadius; + mCutAverage = confCpr.cutAverage.value; + mCutAnyRadius = confCpr.cutAnyRadius.value; + + mKstarMin = confCpr.kstarMin.value; + mKstarMax = confCpr.kstarMax.value; - mPlotAverage = plotAverage; - mPlotAllRadii = plotAllRadii; + mPlotAverage = confCpr.plotAverage.value; + mPlotAllRadii = confCpr.plotAllRadii.value; // check if we need to apply any cut a plot is requested - mIsActivated = mCutOnAverage || mCutOnAnyRadius || mPlotAverage || mPlotAllRadii; + mIsActivated = mCutAverage || mCutAnyRadius || mPlotAverage || mPlotAllRadii; mHistogramRegistry = registry; @@ -210,7 +211,7 @@ class CloseTrackRejection auto phistar1 = utils::dphistar(mMagField, TpcRadii[i], mChargeAbsTrack1 * track1.signedPt(), track1.phi()); auto phistar2 = utils::dphistar(mMagField, TpcRadii[i], mChargeAbsTrack2 * track2.signedPt(), track2.phi()); if (phistar1 && phistar2) { - mDphistar.at(i) = RecoDecay::constrainAngle(phistar1.value() - phistar2.value(), -o2::constants::math::PI); // const angle difference between -pi and pi + mDphistar.at(i) = RecoDecay::constrainAngle(phistar1.value() - phistar2.value(), -o2::constants::math::PI); // constrain angular difference between -pi and pi mDphistarMask.at(i) = true; count++; } @@ -219,11 +220,20 @@ class CloseTrackRejection mAverageDphistar = std::accumulate(mDphistar.begin(), mDphistar.end(), 0.f) / count; // only average values if phistar could be computed } - void fill() + void fill(float kstar) { if (!mIsActivated) { return; } + + if (mKstarMin > 0.f && kstar < mKstarMin) { + return; + } + + if (mKstarMax > 0.f && kstar > mKstarMax) { + return; + } + // fill average hist if (mPlotAverage) { mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kAverage, HistTable)), mDeta, mAverageDphistar); @@ -269,11 +279,11 @@ class CloseTrackRejection bool isCloseAverage = false; bool isCloseAnyRadius = false; - if (mCutOnAverage) { + if (mCutAverage) { isCloseAverage = std::hypot(mAverageDphistar / mDphistarMax, mDeta / mDetaMax) < 1.f; } - if (mCutOnAnyRadius) { + if (mCutAnyRadius) { for (size_t i = 0; i < TpcRadii.size(); i++) { if (isCloseAnyRadius) { break; @@ -293,8 +303,11 @@ class CloseTrackRejection bool mPlotAllRadii = false; bool mPlotAverage = false; - bool mCutOnAverage = false; - bool mCutOnAnyRadius = false; + float mKstarMin = -1.f; + float mKstarMax = -1.f; + + bool mCutAverage = false; + bool mCutAnyRadius = false; bool mIsActivated = false; @@ -321,7 +334,7 @@ class ClosePairRejectionTrackTrack int absChargeTrack1, int absChargeTrack2) { - mCtr.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.cutAverage.value, confCpr.cutAnyRadius.value, confCpr.detaMax.value, confCpr.dphistarMax.value, absChargeTrack1, absChargeTrack2); + mCtr.init(registry, specs, confCpr, absChargeTrack1, absChargeTrack2); } void setMagField(float magField) { mCtr.setMagField(magField); } @@ -331,7 +344,7 @@ class ClosePairRejectionTrackTrack mCtr.compute(track1, track2); } bool isClosePair() const { return mCtr.isClosePair(); } - void fill() { mCtr.fill(); } + void fill(float kstar) { mCtr.fill(kstar); } private: CloseTrackRejection mCtr; @@ -348,8 +361,8 @@ class ClosePairRejectionV0V0 T1 const& confCprPos, T2 const& confCprNeg) { - mCtrPos.init(registry, specsPos, confCprPos.plotAverage.value, confCprPos.plotAllRadii.value, confCprPos.cutAverage.value, confCprPos.cutAnyRadius.value, confCprPos.detaMax.value, confCprPos.dphistarMax.value, 1, 1); - mCtrNeg.init(registry, specsNeg, confCprNeg.plotAverage.value, confCprNeg.plotAllRadii.value, confCprNeg.cutAverage.value, confCprNeg.cutAnyRadius.value, confCprNeg.detaMax.value, confCprNeg.dphistarMax.value, 1, 1); + mCtrPos.init(registry, specsPos, confCprPos, 1, 1); + mCtrNeg.init(registry, specsNeg, confCprNeg, 1, 1); } void setMagField(float magField) @@ -372,10 +385,10 @@ class ClosePairRejectionV0V0 bool isClosePair() const { return mCtrPos.isClosePair() || mCtrNeg.isClosePair(); } - void fill() + void fill(float kstar) { - mCtrPos.fill(); - mCtrNeg.fill(); + mCtrPos.fill(kstar); + mCtrNeg.fill(kstar); } private: @@ -393,7 +406,7 @@ class ClosePairRejectionTrackV0 // can also be used for any particle type that h T const& confCpr, int absChargeTrack) { - mCtr.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.cutAverage.value, confCpr.cutAnyRadius.value, confCpr.detaMax.value, confCpr.dphistarMax.value, absChargeTrack, 1); + mCtr.init(registry, specs, confCpr, absChargeTrack, 1); } void setMagField(float magField) { mCtr.setMagField(magField); } @@ -412,7 +425,7 @@ class ClosePairRejectionTrackV0 // can also be used for any particle type that h bool isClosePair() const { return mCtr.isClosePair(); } - void fill() { mCtr.fill(); } + void fill(float kstar) { mCtr.fill(kstar); } private: CloseTrackRejection mCtr; @@ -430,8 +443,8 @@ class ClosePairRejectionTrackCascade T2 const& confCprV0Daughter, int absChargeTrack) { - mCtrBachelor.init(registry, specsBachelor, confCprBachelor.plotAverage.value, confCprBachelor.plotAllRadii.value, confCprBachelor.cutAverage.value, confCprBachelor.cutAnyRadius.value, confCprBachelor.detaMax.value, confCprBachelor.dphistarMax.value, absChargeTrack, 1); - mCtrV0Daughter.init(registry, specsV0Daughter, confCprV0Daughter.plotAverage.value, confCprV0Daughter.plotAllRadii.value, confCprV0Daughter.cutAverage.value, confCprV0Daughter.cutAnyRadius.value, confCprV0Daughter.detaMax.value, confCprV0Daughter.dphistarMax.value, absChargeTrack, 1); + mCtrBachelor.init(registry, specsBachelor, confCprBachelor, absChargeTrack, 1); + mCtrV0Daughter.init(registry, specsV0Daughter, confCprV0Daughter, absChargeTrack, 1); } void setMagField(float magField) @@ -461,10 +474,10 @@ class ClosePairRejectionTrackCascade return mCtrBachelor.isClosePair() || mCtrBachelor.isClosePair(); } - void fill() + void fill(float kstar) { - mCtrBachelor.fill(); - mCtrV0Daughter.fill(); + mCtrBachelor.fill(kstar); + mCtrV0Daughter.fill(kstar); } private: @@ -482,7 +495,7 @@ class ClosePairRejectionTrackKink T const& confCpr, int absChargeTrack) { - mCtr.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.cutAverage.value, confCpr.cutAnyRadius.value, confCpr.detaMax.value, confCpr.dphistarMax.value, absChargeTrack, 1); + mCtr.init(registry, specs, confCpr, absChargeTrack, 1); } void setMagField(float magField) @@ -498,7 +511,7 @@ class ClosePairRejectionTrackKink } bool isClosePair() const { return mCtr.isClosePair(); } - void fill() { mCtr.fill(); } + void fill(float kstar) { mCtr.fill(kstar); } private: CloseTrackRejection mCtr; diff --git a/PWGCF/Femto/Core/dataTypes.h b/PWGCF/Femto/Core/dataTypes.h index fc1bc15f74d..6a1dd58da37 100644 --- a/PWGCF/Femto/Core/dataTypes.h +++ b/PWGCF/Femto/Core/dataTypes.h @@ -29,7 +29,6 @@ using CollisionTagType = uint64_t; using CollisionMaskType = uint16_t; // datatypes for tracks -using MomentumType = uint8_t; using TrackMaskType = uint64_t; using TrackType = uint16_t; @@ -53,6 +52,10 @@ using CascadeType = uint16_t; // datatype for particles using ParticleType = uint16_t; +// datatypes for different observables +using MomentumType = uint16_t; +using TransverseMassType = uint16_t; + } // namespace femtodatatypes } // namespace o2::aod diff --git a/PWGCF/Femto/Core/modes.h b/PWGCF/Femto/Core/modes.h index 25d27943ca1..6fe0f9a71b3 100644 --- a/PWGCF/Femto/Core/modes.h +++ b/PWGCF/Femto/Core/modes.h @@ -66,9 +66,15 @@ enum class System : uint32_t { }; enum class MomentumType : o2::aod::femtodatatypes::MomentumType { - kPt, // transverse momentum - kPAtPv, // momentum at primary vertex - kPTpc, // momentum at inner wall of tpc + kPt = 0, // transverse momentum + kPAtPv = 1, // momentum at primary vertex + kPTpc = 2, // momentum at inner wall of tpc +}; + +enum class TransverseMassType : o2::aod::femtodatatypes::TransverseMassType { + kAveragePdgMass = 0, + kReducedPdgMass = 1, + kMt4Vector = 2 }; enum class Particle : o2::aod::femtodatatypes::ParticleType { diff --git a/PWGCF/Femto/Core/pairBuilder.h b/PWGCF/Femto/Core/pairBuilder.h index f16fc5a8b4e..9af6fcd0a13 100644 --- a/PWGCF/Femto/Core/pairBuilder.h +++ b/PWGCF/Femto/Core/pairBuilder.h @@ -141,7 +141,7 @@ class PairTrackTrackBuilder } mColHistManager.fill(col); mCprSe.setMagField(col.magField()); - pairprocesshelpers::processSameEvent(trackSlice1, trackTable, col, mTrackHistManager1, mPairHistManagerSe, mCprSe, mRng, mMixIdenticalParticles); + pairprocesshelpers::processSameEvent(trackSlice1, trackTable, col, mTrackHistManager1, mPairHistManagerSe, mCprSe, mPc, mRng, mMixIdenticalParticles); } else { auto trackSlice1 = partition1->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); auto trackSlice2 = partition2->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); @@ -317,7 +317,7 @@ class PairV0V0Builder } mColHistManager.fill(col); mCprSe.setMagField(col.magField()); - pairprocesshelpers::processSameEvent(v0Slice1, trackTable, col, mV0HistManager1, mPairHistManagerSe, mCprSe, mRng, mMixIdenticalParticles); + pairprocesshelpers::processSameEvent(v0Slice1, trackTable, col, mV0HistManager1, mPairHistManagerSe, mCprSe, mPc, mRng, mMixIdenticalParticles); } else { auto v0Slice1 = partition1->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); auto v0Slice2 = partition2->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); diff --git a/PWGCF/Femto/Core/pairHistManager.h b/PWGCF/Femto/Core/pairHistManager.h index 1779255816c..52adbee6a78 100644 --- a/PWGCF/Femto/Core/pairHistManager.h +++ b/PWGCF/Femto/Core/pairHistManager.h @@ -114,6 +114,7 @@ struct ConfPairBinning : o2::framework::ConfigurableGroup { o2::framework::ConfigurableAxis pt2{"pt2", {{100, 0, 6}}, "Pt binning for particle 2"}; o2::framework::ConfigurableAxis mass1{"mass1", {{100, 0, 2}}, "Mass binning for particle 1 (if particle has mass getter)"}; o2::framework::ConfigurableAxis mass2{"mass2", {{100, 0, 2}}, "Mass binning for particle 2 (if particle has mass getter)"}; + o2::framework::Configurable transverseMassType{"transverseMassType", static_cast(modes::TransverseMassType::kAveragePdgMass), "Type of transverse mass (0-> Average Pdg Mass, 1-> Reduced Pdg Mass, 2-> Mt from combined 4 vector)"}; }; struct ConfPairCuts : o2::framework::ConfigurableGroup { @@ -254,6 +255,9 @@ class PairHistManager mPlotKstarVsMass2VsMult = ConfPairBinning.plotKstarVsMass2VsMult.value; mPlotKstarVsMass1VsMass2VsMult = ConfPairBinning.plotKstarVsMass1VsMass2VsMult.value; + // transverse mass type + mMtType = static_cast(ConfPairBinning.transverseMassType.value); + // values for cuts mKstarMin = ConfPairCuts.kstarMin.value; mKstarMax = ConfPairCuts.kstarMax.value; @@ -263,70 +267,7 @@ class PairHistManager mMtMax = ConfPairCuts.mtMax.value; if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { - std::string analysisDir = std::string(prefix) + std::string(AnalysisDir); - if (mPlot1d) { - mHistogramRegistry->add(analysisDir + getHistNameV2(kKstar, HistTable), getHistDesc(kKstar, HistTable), getHistType(kKstar, HistTable), {Specs.at(kKstar)}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kKt, HistTable), getHistDesc(kKt, HistTable), getHistType(kKt, HistTable), {Specs.at(kKt)}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kMt, HistTable), getHistDesc(kMt, HistTable), getHistType(kMt, HistTable), {Specs.at(kMt)}); - } - if (mPlot2d) { - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsPt2, HistTable), getHistDesc(kPt1VsPt2, HistTable), getHistType(kPt1VsPt2, HistTable), {Specs.at(kPt1VsPt2)}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsKstar, HistTable), getHistDesc(kPt1VsKstar, HistTable), getHistType(kPt1VsKstar, HistTable), {Specs.at(kPt1VsKstar)}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt2VsKstar, HistTable), getHistDesc(kPt2VsKstar, HistTable), getHistType(kPt2VsKstar, HistTable), {Specs.at(kPt2VsKstar)}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsKt, HistTable), getHistDesc(kPt1VsKt, HistTable), getHistType(kPt1VsKt, HistTable), {Specs.at(kPt1VsKt)}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt2VsKt, HistTable), getHistDesc(kPt2VsKt, HistTable), getHistType(kPt2VsKt, HistTable), {Specs.at(kPt2VsKt)}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsMt, HistTable), getHistDesc(kPt1VsMt, HistTable), getHistType(kPt1VsMt, HistTable), {Specs.at(kPt1VsMt)}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt2VsMt, HistTable), getHistDesc(kPt2VsMt, HistTable), getHistType(kPt2VsMt, HistTable), {Specs.at(kPt2VsMt)}); - - mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsKt, HistTable), getHistDesc(kKstarVsKt, HistTable), getHistType(kKstarVsKt, HistTable), {Specs.at(kKstarVsKt)}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMt, HistTable), getHistDesc(kKstarVsMt, HistTable), getHistType(kKstarVsMt, HistTable), {Specs.at(kKstarVsMt)}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMult, HistTable), getHistDesc(kKstarVsMult, HistTable), getHistType(kKstarVsMult, HistTable), {Specs.at(kKstarVsMult)}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsCent, HistTable), getHistDesc(kKstarVsCent, HistTable), getHistType(kKstarVsCent, HistTable), {Specs.at(kKstarVsCent)}); - - // special care for mass plots since not all particles have "mass" - if constexpr (modes::hasMass(particleType1)) { - mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMass1, HistTable), getHistDesc(kKstarVsMass1, HistTable), getHistType(kKstarVsMass1, HistTable), {Specs.at(kKstarVsMass1)}); - } - if constexpr (modes::hasMass(particleType2)) { - mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMass2, HistTable), getHistDesc(kKstarVsMass2, HistTable), getHistType(kKstarVsMass2, HistTable), {Specs.at(kKstarVsMass2)}); - } - if constexpr (modes::hasMass(particleType1) && modes::hasMass(particleType2)) { - mHistogramRegistry->add(analysisDir + getHistNameV2(kMass1VsMass2, HistTable), getHistDesc(kMass1VsMass2, HistTable), getHistType(kMass1VsMass2, HistTable), {Specs.at(kMass1VsMass2)}); - } - } - - if (mPlotKstarVsMtVsMult) { - mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMtVsMult, HistTable), getHistDesc(kKstarVsMtVsMult, HistTable), getHistType(kKstarVsMtVsMult, HistTable), {Specs.at(kKstarVsMtVsMult)}); - } - if (mPlotKstarVsMtVsMultVsCent) { - mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMtVsMultVsCent, HistTable), getHistDesc(kKstarVsMtVsMultVsCent, HistTable), getHistType(kKstarVsMtVsMultVsCent, HistTable), {Specs.at(kKstarVsMtVsMultVsCent)}); - } - if (mPlotKstarVsMtVsPt1VsP2VsMult) { - mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMtVsPt1VsPt2VsMult, HistTable), getHistDesc(kKstarVsMtVsPt1VsPt2VsMult, HistTable), getHistType(kKstarVsMtVsPt1VsPt2VsMult, HistTable), {Specs.at(kKstarVsMtVsPt1VsPt2VsMult)}); - } - if (mPlotKstarVsMtVsPt1VsP2VsMultVsCent) { - mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMtVsPt1VsPt2VsMultVsCent, HistTable), getHistDesc(kKstarVsMtVsPt1VsPt2VsMultVsCent, HistTable), getHistType(kKstarVsMtVsPt1VsPt2VsMultVsCent, HistTable), {Specs.at(kKstarVsMtVsPt1VsPt2VsMultVsCent)}); - } - - // again special care for particles with "mass" - if constexpr (modes::hasMass(particleType1)) { - if (mPlotKstarVsMass1VsMult) { - mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMass1VsMult, HistTable), getHistDesc(kKstarVsMass1VsMult, HistTable), getHistType(kKstarVsMass1VsMult, HistTable), {Specs.at(kKstarVsMass1VsMult)}); - } - } - if constexpr (modes::hasMass(particleType2)) { - if (mPlotKstarVsMass2VsMult) { - mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMass2VsMult, HistTable), getHistDesc(kKstarVsMass2VsMult, HistTable), getHistType(kKstarVsMass2VsMult, HistTable), {Specs.at(kKstarVsMass2VsMult)}); - } - } - if constexpr (modes::hasMass(particleType1) && modes::hasMass(particleType2)) { - if (mPlotKstarVsMass1VsMass2) { - mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMass1VsMass2, HistTable), getHistDesc(kKstarVsMass1VsMass2, HistTable), getHistType(kKstarVsMass1VsMass2, HistTable), {Specs.at(kKstarVsMass1VsMass2)}); - } - if (mPlotKstarVsMass1VsMass2VsMult) { - mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMass1VsMass2VsMult, HistTable), getHistDesc(kKstarVsMass1VsMass2VsMult, HistTable), getHistType(kKstarVsMass1VsMass2VsMult, HistTable), {Specs.at(kKstarVsMass1VsMass2VsMult)}); - } - } + initAnalysis(Specs); } // if constexpr (isFlagSet(mode, modes::Mode::kQA)) { @@ -338,7 +279,8 @@ class PairHistManager { mPdgMass1 = o2::analysis::femto::utils::getMass(PdgParticle1); mPdgMass2 = o2::analysis::femto::utils::getMass(PdgParticle2); - mPdgAverageMass = (mPdgMass1 + mPdgMass2) / 2.f; + mAverageMass = (mPdgMass1 + mPdgMass2) / 2.f; + mReducedMass = 2.f * (mPdgMass1 * mPdgMass2) / (mPdgMass1 + mPdgMass2); } void setCharge(int chargeAbsParticle1, int chargeAbsParticle2) { @@ -361,7 +303,7 @@ class PairHistManager mKt = partSum.Pt() / 2.f; // set mT - mMt = std::hypot(mKt, mPdgAverageMass); + computeMt(partSum); // Boost particle to the pair rest frame (Prf) and calculate k* (would be equivalent using particle 2) // make a copy of particle 1 @@ -409,34 +351,110 @@ class PairHistManager void fill() { if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { - if (mPlot1d) { - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstar, HistTable)), mKstar); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kMt, HistTable)), mMt); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKt, HistTable)), mKt); + fillAnalysis(); + } + } + + float getKstar() const { return mKstar; } + + private: + void initAnalysis(std::map> const& Specs) + { + std::string analysisDir = std::string(prefix) + std::string(AnalysisDir); + if (mPlot1d) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstar, HistTable), getHistDesc(kKstar, HistTable), getHistType(kKstar, HistTable), {Specs.at(kKstar)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kKt, HistTable), getHistDesc(kKt, HistTable), getHistType(kKt, HistTable), {Specs.at(kKt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kMt, HistTable), getHistDesc(kMt, HistTable), getHistType(kMt, HistTable), {Specs.at(kMt)}); + } + if (mPlot2d) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsPt2, HistTable), getHistDesc(kPt1VsPt2, HistTable), getHistType(kPt1VsPt2, HistTable), {Specs.at(kPt1VsPt2)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsKstar, HistTable), getHistDesc(kPt1VsKstar, HistTable), getHistType(kPt1VsKstar, HistTable), {Specs.at(kPt1VsKstar)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt2VsKstar, HistTable), getHistDesc(kPt2VsKstar, HistTable), getHistType(kPt2VsKstar, HistTable), {Specs.at(kPt2VsKstar)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsKt, HistTable), getHistDesc(kPt1VsKt, HistTable), getHistType(kPt1VsKt, HistTable), {Specs.at(kPt1VsKt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt2VsKt, HistTable), getHistDesc(kPt2VsKt, HistTable), getHistType(kPt2VsKt, HistTable), {Specs.at(kPt2VsKt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsMt, HistTable), getHistDesc(kPt1VsMt, HistTable), getHistType(kPt1VsMt, HistTable), {Specs.at(kPt1VsMt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt2VsMt, HistTable), getHistDesc(kPt2VsMt, HistTable), getHistType(kPt2VsMt, HistTable), {Specs.at(kPt2VsMt)}); + + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsKt, HistTable), getHistDesc(kKstarVsKt, HistTable), getHistType(kKstarVsKt, HistTable), {Specs.at(kKstarVsKt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMt, HistTable), getHistDesc(kKstarVsMt, HistTable), getHistType(kKstarVsMt, HistTable), {Specs.at(kKstarVsMt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMult, HistTable), getHistDesc(kKstarVsMult, HistTable), getHistType(kKstarVsMult, HistTable), {Specs.at(kKstarVsMult)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsCent, HistTable), getHistDesc(kKstarVsCent, HistTable), getHistType(kKstarVsCent, HistTable), {Specs.at(kKstarVsCent)}); + + // special care for mass plots since not all particles have "mass" + if constexpr (modes::hasMass(particleType1)) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMass1, HistTable), getHistDesc(kKstarVsMass1, HistTable), getHistType(kKstarVsMass1, HistTable), {Specs.at(kKstarVsMass1)}); + } + if constexpr (modes::hasMass(particleType2)) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMass2, HistTable), getHistDesc(kKstarVsMass2, HistTable), getHistType(kKstarVsMass2, HistTable), {Specs.at(kKstarVsMass2)}); + } + if constexpr (modes::hasMass(particleType1) && modes::hasMass(particleType2)) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kMass1VsMass2, HistTable), getHistDesc(kMass1VsMass2, HistTable), getHistType(kMass1VsMass2, HistTable), {Specs.at(kMass1VsMass2)}); + } + } + + if (mPlotKstarVsMtVsMult) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMtVsMult, HistTable), getHistDesc(kKstarVsMtVsMult, HistTable), getHistType(kKstarVsMtVsMult, HistTable), {Specs.at(kKstarVsMtVsMult)}); + } + if (mPlotKstarVsMtVsMultVsCent) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMtVsMultVsCent, HistTable), getHistDesc(kKstarVsMtVsMultVsCent, HistTable), getHistType(kKstarVsMtVsMultVsCent, HistTable), {Specs.at(kKstarVsMtVsMultVsCent)}); + } + if (mPlotKstarVsMtVsPt1VsP2VsMult) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMtVsPt1VsPt2VsMult, HistTable), getHistDesc(kKstarVsMtVsPt1VsPt2VsMult, HistTable), getHistType(kKstarVsMtVsPt1VsPt2VsMult, HistTable), {Specs.at(kKstarVsMtVsPt1VsPt2VsMult)}); + } + if (mPlotKstarVsMtVsPt1VsP2VsMultVsCent) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMtVsPt1VsPt2VsMultVsCent, HistTable), getHistDesc(kKstarVsMtVsPt1VsPt2VsMultVsCent, HistTable), getHistType(kKstarVsMtVsPt1VsPt2VsMultVsCent, HistTable), {Specs.at(kKstarVsMtVsPt1VsPt2VsMultVsCent)}); + } + + // again special care for particles with "mass" + if constexpr (modes::hasMass(particleType1)) { + if (mPlotKstarVsMass1VsMult) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMass1VsMult, HistTable), getHistDesc(kKstarVsMass1VsMult, HistTable), getHistType(kKstarVsMass1VsMult, HistTable), {Specs.at(kKstarVsMass1VsMult)}); + } + } + if constexpr (modes::hasMass(particleType2)) { + if (mPlotKstarVsMass2VsMult) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMass2VsMult, HistTable), getHistDesc(kKstarVsMass2VsMult, HistTable), getHistType(kKstarVsMass2VsMult, HistTable), {Specs.at(kKstarVsMass2VsMult)}); + } + } + if constexpr (modes::hasMass(particleType1) && modes::hasMass(particleType2)) { + if (mPlotKstarVsMass1VsMass2) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMass1VsMass2, HistTable), getHistDesc(kKstarVsMass1VsMass2, HistTable), getHistType(kKstarVsMass1VsMass2, HistTable), {Specs.at(kKstarVsMass1VsMass2)}); + } + if (mPlotKstarVsMass1VsMass2VsMult) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMass1VsMass2VsMult, HistTable), getHistDesc(kKstarVsMass1VsMass2VsMult, HistTable), getHistType(kKstarVsMass1VsMass2VsMult, HistTable), {Specs.at(kKstarVsMass1VsMass2VsMult)}); } - if (mPlot2d) { - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsPt2, HistTable)), mParticle1.Pt(), mParticle2.Pt()); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsKstar, HistTable)), mParticle1.Pt(), mKstar); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsMt, HistTable)), mParticle1.Pt(), mMt); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsKt, HistTable)), mParticle1.Pt(), mKt); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt2VsKstar, HistTable)), mParticle2.Pt(), mKstar); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt2VsMt, HistTable)), mParticle2.Pt(), mMt); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt2VsKt, HistTable)), mParticle2.Pt(), mKt); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsKt, HistTable)), mKstar, mKt); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMt, HistTable)), mKstar, mMt); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMult, HistTable)), mKstar, mMult); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsCent, HistTable)), mKstar, mCent); - - // // special care for mass plots since not all particles have "mass" - if constexpr (modes::hasMass(particleType1)) { - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMass1, HistTable)), mKstar, mMass1); - } - if constexpr (modes::hasMass(particleType2)) { - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMass2, HistTable)), mKstar, mMass2); - } - if constexpr (modes::hasMass(particleType1) && modes::hasMass(particleType2)) { - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kMass1VsMass2, HistTable)), mMass1, mMass2); - } + } + } + + void fillAnalysis() + { + if (mPlot1d) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstar, HistTable)), mKstar); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kMt, HistTable)), mMt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKt, HistTable)), mKt); + } + if (mPlot2d) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsPt2, HistTable)), mParticle1.Pt(), mParticle2.Pt()); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsKstar, HistTable)), mParticle1.Pt(), mKstar); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsMt, HistTable)), mParticle1.Pt(), mMt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsKt, HistTable)), mParticle1.Pt(), mKt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt2VsKstar, HistTable)), mParticle2.Pt(), mKstar); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt2VsMt, HistTable)), mParticle2.Pt(), mMt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt2VsKt, HistTable)), mParticle2.Pt(), mKt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsKt, HistTable)), mKstar, mKt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMt, HistTable)), mKstar, mMt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMult, HistTable)), mKstar, mMult); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsCent, HistTable)), mKstar, mCent); + + // // special care for mass plots since not all particles have "mass" + if constexpr (modes::hasMass(particleType1)) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMass1, HistTable)), mKstar, mMass1); + } + if constexpr (modes::hasMass(particleType2)) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMass2, HistTable)), mKstar, mMass2); + } + if constexpr (modes::hasMass(particleType1) && modes::hasMass(particleType2)) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kMass1VsMass2, HistTable)), mMass1, mMass2); } } @@ -475,15 +493,31 @@ class PairHistManager } } - // if constexpr (isFlagSet(mode, modes::Mode::kQA)) { - // mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsDcaz, HistTable)), track.pt(), track.dcaZ()); - // } + void computeMt(ROOT::Math::PtEtaPhiMVector const& PairMomentum) + { + switch (mMtType) { + case modes::TransverseMassType::kAveragePdgMass: + mMt = std::hypot(PairMomentum.Pt() / 2.f, mAverageMass); + break; + case modes::TransverseMassType::kReducedPdgMass: + mMt = std::hypot(PairMomentum.Pt() / 2.f, mReducedMass); + break; + case modes::TransverseMassType::kMt4Vector: + mMt = PairMomentum.Mt() / 2.f; + break; + default: + mMt = std::hypot(mKt, mAverageMass); + } + } - private: o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; float mPdgMass1 = 0.f; float mPdgMass2 = 0.f; - float mPdgAverageMass = 0.f; + + modes::TransverseMassType mMtType = modes::TransverseMassType::kAveragePdgMass; + float mAverageMass = 0.f; + float mReducedMass = 0.f; + int mAbsCharge1 = 1; int mAbsCharge2 = 1; ROOT::Math::PtEtaPhiMVector mParticle1{}; diff --git a/PWGCF/Femto/Core/pairProcessHelpers.h b/PWGCF/Femto/Core/pairProcessHelpers.h index 6600177257e..a4b69c85a4d 100644 --- a/PWGCF/Femto/Core/pairProcessHelpers.h +++ b/PWGCF/Femto/Core/pairProcessHelpers.h @@ -35,14 +35,16 @@ template + typename T7, + typename T8> void processSameEvent(T1 const& SliceParticle, T2 const& TrackTable, T3 const& Collision, T4& ParticleHistManager, T5& PairHistManager, T6& CprManager, - T7& rng, + T7& PcManager, + T8& rng, bool randomize) { for (auto const& part : SliceParticle) { @@ -50,6 +52,11 @@ void processSameEvent(T1 const& SliceParticle, } std::uniform_real_distribution dist(0.f, 1.f); for (auto const& [p1, p2] : o2::soa::combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(SliceParticle, SliceParticle))) { + // check if pair is clean + if (!PcManager.isCleanPair(p1, p2, TrackTable)) { + continue; + } + // check if pair is close CprManager.setPair(p1, p2, TrackTable); if (CprManager.isClosePair()) { continue; @@ -62,8 +69,10 @@ void processSameEvent(T1 const& SliceParticle, } else { PairHistManager.setPair(p1, p2, Collision); } + // fill deta-dphi histograms with kstar cutoff + CprManager.fill(PairHistManager.getKstar()); + // if pair cuts are configured check them before filling if (PairHistManager.checkPairCuts()) { - CprManager.fill(); PairHistManager.fill(); } } @@ -107,8 +116,8 @@ void processSameEvent(T1 const& SliceParticle1, continue; } PairHistManager.setPair(p1, p2, Collision); + CprManager.fill(PairHistManager.getKstar()); if (PairHistManager.checkPairCuts()) { - CprManager.fill(); PairHistManager.fill(); } } @@ -155,8 +164,8 @@ void processMixedEvent(T1& Collisions, continue; } PairHistManager.setPair(p1, p2, collision1, collision2); + CprManager.fill(PairHistManager.getKstar()); if (PairHistManager.checkPairCuts()) { - CprManager.fill(); PairHistManager.fill(); } } @@ -206,8 +215,8 @@ void processMixedEvent(T1& Collisions, continue; } PairHistManager.setPair(p1, p2, collision1, collision2); + CprManager.fill(PairHistManager.getKstar()); if (PairHistManager.checkPairCuts()) { - CprManager.fill(); PairHistManager.fill(); } } From 342fd8bfc009678e3ea0d5dae1915c7fa7910a5d Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 31 Oct 2025 23:18:52 +0100 Subject: [PATCH 981/986] [PWGEM/Dilepton] add status code in mc particle table (#13625) --- PWGEM/Dilepton/DataModel/dileptonTables.h | 24 +++++++- .../TableProducer/associateMCinfoDilepton.cxx | 2 +- .../Dilepton/Tasks/Converters/CMakeLists.txt | 5 ++ .../Tasks/Converters/mcParticleConverter1.cxx | 61 +++++++++++++++++++ PWGEM/Dilepton/Utils/MCUtilities.h | 5 +- .../TableProducer/associateMCinfoPhoton.cxx | 17 +++--- 6 files changed, 102 insertions(+), 12 deletions(-) create mode 100644 PWGEM/Dilepton/Tasks/Converters/mcParticleConverter1.cxx diff --git a/PWGEM/Dilepton/DataModel/dileptonTables.h b/PWGEM/Dilepton/DataModel/dileptonTables.h index a3bff9027b1..e63969edfda 100644 --- a/PWGEM/Dilepton/DataModel/dileptonTables.h +++ b/PWGEM/Dilepton/DataModel/dileptonTables.h @@ -301,7 +301,7 @@ DECLARE_SOA_DYNAMIC_COLUMN(Y, y, //! Particle rapidity } // namespace emmcparticle // This table contains all MC truth tracks -DECLARE_SOA_TABLE_FULL(EMMCParticles, "EMMCParticles", "AOD", "EMMCPARTICLE", //! MC track information (on disk) +DECLARE_SOA_TABLE_FULL(EMMCParticles_000, "EMMCParticles", "AOD", "EMMCPARTICLE", //! MC track information (on disk) o2::soa::Index<>, emmcparticle::EMMCEventId, mcparticle::PdgCode, mcparticle::Flags, emmcparticle::MothersIds, emmcparticle::DaughtersIds, @@ -312,13 +312,33 @@ DECLARE_SOA_TABLE_FULL(EMMCParticles, "EMMCParticles", "AOD", "EMMCPARTICLE", // emmcparticle::Pt, emmcparticle::Eta, emmcparticle::Phi, - emmcparticle::P, emmcparticle::Y, mcparticle::ProducedByGenerator, mcparticle::FromBackgroundEvent, mcparticle::IsPhysicalPrimary); +DECLARE_SOA_TABLE_VERSIONED(EMMCParticles_001, "AOD", "EMMCPARTICLE", 1, //! MC track information (on disk) + o2::soa::Index<>, emmcparticle::EMMCEventId, + mcparticle::PdgCode, mcparticle::Flags, mcparticle::StatusCode, + emmcparticle::MothersIds, emmcparticle::DaughtersIds, + mcparticle::Px, mcparticle::Py, mcparticle::Pz, mcparticle::E, + mcparticle::Vx, mcparticle::Vy, mcparticle::Vz, + + // dynamic column + emmcparticle::Pt, + emmcparticle::Eta, + emmcparticle::Phi, + emmcparticle::P, + emmcparticle::Y, + mcparticle::ProducedByGenerator, + mcparticle::FromBackgroundEvent, + mcparticle::IsPhysicalPrimary, + mcparticle::GetGenStatusCode, + mcparticle::GetHepMCStatusCode, + mcparticle::GetProcess); + +using EMMCParticles = EMMCParticles_001; using EMMCParticle = EMMCParticles::iterator; namespace emmcgenvectormeson diff --git a/PWGEM/Dilepton/TableProducer/associateMCinfoDilepton.cxx b/PWGEM/Dilepton/TableProducer/associateMCinfoDilepton.cxx index 92078356fd6..1b4044f4bf3 100644 --- a/PWGEM/Dilepton/TableProducer/associateMCinfoDilepton.cxx +++ b/PWGEM/Dilepton/TableProducer/associateMCinfoDilepton.cxx @@ -625,7 +625,7 @@ struct AssociateMCInfoDilepton { } } - emmcparticles(fEventIdx.find(oldLabel)->second, mctrack.pdgCode(), mctrack.flags(), + emmcparticles(fEventIdx.find(oldLabel)->second, mctrack.pdgCode(), mctrack.flags(), mctrack.statusCode(), mothers, daughters, mctrack.px(), mctrack.py(), mctrack.pz(), mctrack.e(), mctrack.vx(), mctrack.vy(), mctrack.vz()); diff --git a/PWGEM/Dilepton/Tasks/Converters/CMakeLists.txt b/PWGEM/Dilepton/Tasks/Converters/CMakeLists.txt index 489839883ec..5653dbd4e83 100644 --- a/PWGEM/Dilepton/Tasks/Converters/CMakeLists.txt +++ b/PWGEM/Dilepton/Tasks/Converters/CMakeLists.txt @@ -50,3 +50,8 @@ o2physics_add_dpl_workflow(muon-converter1 PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(mcparticle-converter1 + SOURCES mcParticleConverter1.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + diff --git a/PWGEM/Dilepton/Tasks/Converters/mcParticleConverter1.cxx b/PWGEM/Dilepton/Tasks/Converters/mcParticleConverter1.cxx new file mode 100644 index 00000000000..5f219f459ca --- /dev/null +++ b/PWGEM/Dilepton/Tasks/Converters/mcParticleConverter1.cxx @@ -0,0 +1,61 @@ +// 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. +// +// ======================== +// +// This code produces emmctable table 001 from 000. +// Please write to: daiki.sekihata@cern.ch + +#include "PWGEM/Dilepton/DataModel/dileptonTables.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +#include + +using namespace o2; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; + +struct mcParticleConverter1 { + Produces mcParticle_001; + + void process(aod::EMMCParticles_000 const& mcParticles) + { + for (const auto& mcParticle : mcParticles) { + // LOGF(info, "mcParticles.emmceventId() = %d, mcParticle.mothersIds().size() = %d, mcParticle.daughtersIds().size() = %d", mcParticle.emmceventId(), mcParticle.mothersIds().size(), mcParticle.daughtersIds().size()); + + std::vector mothersIds; + for (const auto& id : mcParticle.mothersIds()) { + mothersIds.emplace_back(id); + } + + std::vector daughtersIds; + for (const auto& id : mcParticle.daughtersIds()) { + daughtersIds.emplace_back(id); + } + + mcParticle_001( + mcParticle.emmceventId(), mcParticle.pdgCode(), mcParticle.flags(), 0, + mothersIds, daughtersIds, + mcParticle.px(), mcParticle.py(), mcParticle.pz(), mcParticle.e(), + mcParticle.vx(), mcParticle.vy(), mcParticle.vz()); + } // end of mc particle loop + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"mcparticle-converter1"})}; +} diff --git a/PWGEM/Dilepton/Utils/MCUtilities.h b/PWGEM/Dilepton/Utils/MCUtilities.h index ca4c095a628..bce62504aae 100644 --- a/PWGEM/Dilepton/Utils/MCUtilities.h +++ b/PWGEM/Dilepton/Utils/MCUtilities.h @@ -317,7 +317,7 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp auto mp = mcparticles.iteratorAt(motherid1); mothers_id1.emplace_back(motherid1); mothers_pdg1.emplace_back(mp.pdgCode()); - + // LOGF(info, "mp1.globalIndex() = %d, mp1.pdgCode() = %d, mp1.getGenStatusCode() = %d", mp.globalIndex(), mp.pdgCode(), mp.getGenStatusCode()); if (mp.has_mothers()) { motherid1 = mp.mothersIds()[0]; } else { @@ -337,6 +337,7 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp auto mp = mcparticles.iteratorAt(motherid2); mothers_id2.emplace_back(motherid2); mothers_pdg2.emplace_back(mp.pdgCode()); + // LOGF(info, "mp2.globalIndex() = %d, mp2.pdgCode() = %d, mp2.getGenStatusCode() = %d", mp.globalIndex(), mp.pdgCode(), mp.getGenStatusCode()); if (mp.has_mothers()) { motherid2 = mp.mothersIds()[0]; @@ -348,6 +349,8 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp } } + // require correlation between q-qbar. (not q-q) // need statusCode + bool is_direct_from_b1 = IsFromBeauty(p1, mcparticles) > 0 && IsFromCharm(p1, mcparticles) < 0; bool is_direct_from_b2 = IsFromBeauty(p2, mcparticles) > 0 && IsFromCharm(p2, mcparticles) < 0; bool is_prompt_c1 = IsFromBeauty(p1, mcparticles) < 0 && IsFromCharm(p1, mcparticles) > 0; diff --git a/PWGEM/PhotonMeson/TableProducer/associateMCinfoPhoton.cxx b/PWGEM/PhotonMeson/TableProducer/associateMCinfoPhoton.cxx index 2fafc5118e3..885a2e85a38 100644 --- a/PWGEM/PhotonMeson/TableProducer/associateMCinfoPhoton.cxx +++ b/PWGEM/PhotonMeson/TableProducer/associateMCinfoPhoton.cxx @@ -16,16 +16,17 @@ /// \author Daiki Sekihata (daiki.sekihata@cern.ch) /// -#include -#include +#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" +#include "PWGEM/PhotonMeson/Utils/MCUtilities.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" #include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/Track.h" -#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" -#include "PWGEM/PhotonMeson/Utils/MCUtilities.h" + +#include +#include using namespace o2; using namespace o2::framework; @@ -434,7 +435,7 @@ struct AssociateMCInfoPhoton { } } - emmcparticles(fEventIdx.find(oldLabel)->second, mcParticle.pdgCode(), mcParticle.flags(), + emmcparticles(fEventIdx.find(oldLabel)->second, mcParticle.pdgCode(), mcParticle.flags(), mcParticle.statusCode(), mothers, daughters, mcParticle.px(), mcParticle.py(), mcParticle.pz(), mcParticle.e(), mcParticle.vx(), mcParticle.vy(), mcParticle.vz()); From a5a9d0e7f2ef2703d52895929efeb370f27261d6 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sat, 1 Nov 2025 00:25:59 +0100 Subject: [PATCH 982/986] [PWGEM/Dilepton] remove unnecessary lines (#13627) --- PWGEM/Dilepton/Core/Dilepton.h | 9 --------- PWGEM/Dilepton/Core/DileptonHadronMPC.h | 1 - PWGEM/Dilepton/Utils/MCUtilities.h | 2 +- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 241ddd7a932..222a690470a 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -1042,13 +1042,7 @@ struct Dilepton { if constexpr (ev_id == 0) { std::pair key_df_collision = std::make_pair(ndf, collision.globalIndex()); - std::vector possibleIds1; - std::vector possibleIds2; - if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - std::copy(t1.ambiguousElectronsIds().begin(), t1.ambiguousElectronsIds().end(), std::back_inserter(possibleIds1)); - std::copy(t2.ambiguousElectronsIds().begin(), t2.ambiguousElectronsIds().end(), std::back_inserter(possibleIds2)); - if (std::find(used_trackIds_per_col.begin(), used_trackIds_per_col.end(), t1.globalIndex()) == used_trackIds_per_col.end()) { used_trackIds_per_col.emplace_back(t1.globalIndex()); if (cfgDoMix) { @@ -1070,9 +1064,6 @@ struct Dilepton { } } } else if (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - std::copy(t1.ambiguousMuonsIds().begin(), t1.ambiguousMuonsIds().end(), std::back_inserter(possibleIds1)); - std::copy(t2.ambiguousMuonsIds().begin(), t2.ambiguousMuonsIds().end(), std::back_inserter(possibleIds2)); - if (std::find(used_trackIds_per_col.begin(), used_trackIds_per_col.end(), t1.globalIndex()) == used_trackIds_per_col.end()) { used_trackIds_per_col.emplace_back(t1.globalIndex()); if (cfgDoMix) { diff --git a/PWGEM/Dilepton/Core/DileptonHadronMPC.h b/PWGEM/Dilepton/Core/DileptonHadronMPC.h index bbbac707c32..f9759f45910 100644 --- a/PWGEM/Dilepton/Core/DileptonHadronMPC.h +++ b/PWGEM/Dilepton/Core/DileptonHadronMPC.h @@ -1059,7 +1059,6 @@ struct DileptonHadronMPC { auto posTracks_per_coll = posTracks.sliceByCached(perCollision, collision.globalIndex(), cache); auto negTracks_per_coll = negTracks.sliceByCached(perCollision, collision.globalIndex(), cache); - used_trackIds_per_col.reserve(posTracks_per_coll.size() + negTracks_per_coll.size()); int nuls = 0, nlspp = 0, nlsmm = 0; diff --git a/PWGEM/Dilepton/Utils/MCUtilities.h b/PWGEM/Dilepton/Utils/MCUtilities.h index bce62504aae..e581c4a0f56 100644 --- a/PWGEM/Dilepton/Utils/MCUtilities.h +++ b/PWGEM/Dilepton/Utils/MCUtilities.h @@ -513,7 +513,7 @@ int searchMothers(T& p, U& mcParticles, int pdg, bool equal) int quark_id = -1; for (int i : allmothersids) { auto mother = mcParticles.iteratorAt(i); - int mpdg = abs(mother.pdgCode()); + int mpdg = std::abs(mother.pdgCode()); if (mpdg == pdg && mother.pdgCode() == p.pdgCode()) { // found the quark if (quark_id > -1) { // we already found a possible candidate in the list of mothers, so now we have (at least) two // LOG(warning) << "Flavour tracking is ambiguous. Stopping here."; From 4038605247a925d35c0f910f1e1236750ba96747 Mon Sep 17 00:00:00 2001 From: gvolpe79 <39517882+gvolpe79@users.noreply.github.com> Date: Sat, 1 Nov 2025 09:24:47 +0100 Subject: [PATCH 983/986] [DPG] Adding new HMPID tasks (#13225) --- DPG/Tasks/AOTTrack/PID/HMPID/CMakeLists.txt | 15 +- .../AOTTrack/PID/HMPID/analysisHMPID.cxx | 137 -- .../AOTTrack/PID/HMPID/hmpidDeuteron.cxx | 189 ++ DPG/Tasks/AOTTrack/PID/HMPID/hmpidQa.cxx | 1514 +++++++++++++++++ .../AOTTrack/PID/HMPID/hmpidTableProducer.cxx | 135 ++ DPG/Tasks/AOTTrack/PID/HMPID/qaHMPID.cxx | 311 ---- DPG/Tasks/AOTTrack/PID/HMPID/tableHMPID.h | 107 ++ 7 files changed, 1955 insertions(+), 453 deletions(-) delete mode 100644 DPG/Tasks/AOTTrack/PID/HMPID/analysisHMPID.cxx create mode 100644 DPG/Tasks/AOTTrack/PID/HMPID/hmpidDeuteron.cxx create mode 100644 DPG/Tasks/AOTTrack/PID/HMPID/hmpidQa.cxx create mode 100644 DPG/Tasks/AOTTrack/PID/HMPID/hmpidTableProducer.cxx delete mode 100644 DPG/Tasks/AOTTrack/PID/HMPID/qaHMPID.cxx create mode 100644 DPG/Tasks/AOTTrack/PID/HMPID/tableHMPID.h diff --git a/DPG/Tasks/AOTTrack/PID/HMPID/CMakeLists.txt b/DPG/Tasks/AOTTrack/PID/HMPID/CMakeLists.txt index 763c9105528..96bb9ab18c4 100644 --- a/DPG/Tasks/AOTTrack/PID/HMPID/CMakeLists.txt +++ b/DPG/Tasks/AOTTrack/PID/HMPID/CMakeLists.txt @@ -10,12 +10,17 @@ # or submit itself to any jurisdiction. # HMPID -o2physics_add_dpl_workflow(pid-hmpid-qa - SOURCES qaHMPID.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore +o2physics_add_dpl_workflow(hmpid-qa + SOURCES hmpidQa.cxx + PUBLIC_LINK_LIBRARIES O2::HMPIDBase O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(pid-hmpid - SOURCES analysisHMPID.cxx +o2physics_add_dpl_workflow(hmpid-table-producer + SOURCES hmpidTableProducer.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(hmpid-deuteron + SOURCES hmpidDeuteron.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2::ReconstructionDataFormats O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/DPG/Tasks/AOTTrack/PID/HMPID/analysisHMPID.cxx b/DPG/Tasks/AOTTrack/PID/HMPID/analysisHMPID.cxx deleted file mode 100644 index c5a6b9d0597..00000000000 --- a/DPG/Tasks/AOTTrack/PID/HMPID/analysisHMPID.cxx +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -// O2 includes -#include "ReconstructionDataFormats/Track.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/RunningWorkflowInfo.h" -#include "ReconstructionDataFormats/TrackParametrization.h" -#include "Common/DataModel/PIDResponse.h" -#include "Common/Core/PID/PIDTOF.h" -#include "Common/TableProducer/PID/pidTOFBase.h" -#include "ReconstructionDataFormats/PID.h" -#include "Common/Core/trackUtilities.h" -#include "ReconstructionDataFormats/DCA.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/ASoA.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" - -#include - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; - -namespace o2::aod -{ - -namespace variables_table // declaration of columns to create -{ -DECLARE_SOA_COLUMN(ChAngle, chAngle, float); -DECLARE_SOA_COLUMN(Phi, phi, float); -DECLARE_SOA_COLUMN(Eta, eta, float); -DECLARE_SOA_COLUMN(MomentumHMPID, momentumHMPID, float); -DECLARE_SOA_COLUMN(MomentumTrack, momentumTrack, float); -DECLARE_SOA_COLUMN(Xtrack, xtrack, float); -DECLARE_SOA_COLUMN(Ytrack, ytrack, float); -DECLARE_SOA_COLUMN(Xmip, xmip, float); -DECLARE_SOA_COLUMN(Ymip, ymip, float); -DECLARE_SOA_COLUMN(Nphotons, nphotons, float); -DECLARE_SOA_COLUMN(ChargeMIP, chargeMIP, float); -DECLARE_SOA_COLUMN(ClusterSize, clustersize, float); -DECLARE_SOA_COLUMN(Chamber, chamber, float); -DECLARE_SOA_COLUMN(Photons_charge, photons_charge, float[10]); - -DECLARE_SOA_COLUMN(EtaTrack, etatrack, float); -DECLARE_SOA_COLUMN(PhiTrack, phitrack, float); - -DECLARE_SOA_COLUMN(ITSNcluster, itsNcluster, float); -DECLARE_SOA_COLUMN(TPCNcluster, tpcNcluster, float); -DECLARE_SOA_COLUMN(TPCNClsCrossedRows, tpcNClsCrossedRows, float); -DECLARE_SOA_COLUMN(TPCchi2, tpcChi2, float); -DECLARE_SOA_COLUMN(ITSchi2, itsChi2, float); - -DECLARE_SOA_COLUMN(DCAxy, dcaxy, float); -DECLARE_SOA_COLUMN(DCAz, dcaz, float); - -DECLARE_SOA_COLUMN(TPCNSigmaPi, tpcNsigmaPi, float); -DECLARE_SOA_COLUMN(TOFNSigmaPi, tofNsigmaPi, float); -DECLARE_SOA_COLUMN(TPCNSigmaKa, tpcNsigmaKa, float); -DECLARE_SOA_COLUMN(TOFNSigmaKa, tofNsigmaKa, float); -DECLARE_SOA_COLUMN(TPCNSigmaPr, tpcNsigmaPr, float); -DECLARE_SOA_COLUMN(TOFNSigmaPr, tofNsigmaPr, float); -DECLARE_SOA_COLUMN(TPCNSigmaDe, tpcNsigmaDe, float); -DECLARE_SOA_COLUMN(TOFNSigmaDe, tofNsigmaDe, float); - -} // namespace variables_table - -DECLARE_SOA_TABLE(HMPID_analysis, "AOD", "HMPIDANALYSIS", - variables_table::ChAngle, variables_table::Phi, variables_table::Eta, variables_table::MomentumHMPID, - variables_table::MomentumTrack, variables_table::Xtrack, variables_table::Ytrack, variables_table::Xmip, - variables_table::Ymip, variables_table::Nphotons, variables_table::ChargeMIP, variables_table::ClusterSize, - variables_table::Chamber, variables_table::Photons_charge, variables_table::EtaTrack, variables_table::PhiTrack, - variables_table::ITSNcluster, variables_table::TPCNcluster, variables_table::TPCNClsCrossedRows, - variables_table::TPCchi2, variables_table::ITSchi2, variables_table::DCAxy, variables_table::DCAz, - variables_table::TPCNSigmaPi, variables_table::TOFNSigmaPi, variables_table::TPCNSigmaKa, variables_table::TOFNSigmaKa, - variables_table::TPCNSigmaPr, variables_table::TOFNSigmaPr, variables_table::TPCNSigmaDe, variables_table::TOFNSigmaDe); -} // namespace o2::aod - -struct pidHmpidAnalysis { - - Produces HMPID_analysis; - - // using TrackCandidates = soa::Join; - - using CollisionCandidates = o2::soa::Join; - - using TrackCandidates = soa::Join; - - void process(const aod::HMPIDs& hmpids, - TrackCandidates const&, - CollisionCandidates const&) - { - - for (const auto& t : hmpids) { - if (t.track_as().isGlobalTrack() != (uint8_t) true) { - continue; - } - - const auto& track = t.track_as(); - - if (!track.hasITS() || !track.hasTPC() || !track.hasTOF()) { - continue; - } - - float hmpidPhotsCharge2[10]; - - for (int i = 0; i < 10; i++) { - hmpidPhotsCharge2[i] = t.hmpidPhotsCharge()[i]; - } - - /////FILL TABLE - HMPID_analysis(t.hmpidSignal(), t.track_as().phi(), t.track_as().eta(), t.hmpidMom(), - track.p(), t.hmpidXTrack(), t.hmpidYTrack(), t.hmpidXMip(), - t.hmpidYMip(), t.hmpidNPhotons(), t.hmpidQMip(), (t.hmpidClusSize() % 1000000) / 1000, t.hmpidClusSize() / 1000000, - hmpidPhotsCharge2, track.eta(), track.phi(), track.itsNCls(), track.tpcNClsFound(), track.tpcNClsCrossedRows(), - track.tpcChi2NCl(), track.itsChi2NCl(), track.dcaXY(), track.dcaZ(), - track.tpcNSigmaPi(), track.tofNSigmaPi(), track.tpcNSigmaKa(), track.tofNSigmaKa(), - track.tpcNSigmaPr(), track.tofNSigmaPr(), track.tpcNSigmaDe(), track.tofNSigmaDe()); - } - } -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfg) { return WorkflowSpec{adaptAnalysisTask(cfg)}; } diff --git a/DPG/Tasks/AOTTrack/PID/HMPID/hmpidDeuteron.cxx b/DPG/Tasks/AOTTrack/PID/HMPID/hmpidDeuteron.cxx new file mode 100644 index 00000000000..98ea08f7add --- /dev/null +++ b/DPG/Tasks/AOTTrack/PID/HMPID/hmpidDeuteron.cxx @@ -0,0 +1,189 @@ +// 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. + +#include "tableHMPID.h" + +#include +#include + +#include +#include + +using namespace o2; +using namespace o2::framework; + +struct HmpidDeuteron { + HistogramRegistry registryDA{"registryDA", {}, OutputObjHandlingPolicy::AnalysisObject}; + + Configurable nsigmaTPCMin{"nsigmaTPCMin", -3.0, "nsigmaTPCMin"}; + Configurable nsigmaTPCMax{"nsigmaTPCMax", +3.0, "nsigmaTPCMax"}; + Configurable nsigmaTOFMin{"nsigmaTOFMin", -3.0, "nsigmaTOFMin"}; + Configurable nsigmaTOFMax{"nsigmaTOFMax", +3.5, "nsigmaTOFMax"}; + Configurable minReqClusterITS{"minReqClusterITS", 4.0, "min number of clusters required in ITS"}; + Configurable minTPCnClsFound{"minTPCnClsFound", 50.0f, "minTPCnClsFound"}; + Configurable minNCrossedRowsTPC{"minNCrossedRowsTPC", 70.0f, "min number of crossed rows TPC"}; + Configurable maxChi2ITS{"maxChi2ITS", 36.0f, "max chi2 per cluster ITS"}; + Configurable maxChi2TPC{"maxChi2TPC", 4.0f, "max chi2 per cluster TPC"}; + Configurable maxDCAxy{"maxDCAxy", 0.5f, "maxDCAxy"}; + Configurable maxDCAz{"maxDCAz", 0.5f, "maxDCAz"}; + + void init(InitContext const&) + { + // Deuteron Pos + registryDA.add("incomingDe_Pos_8cm", "incomingDe_Pos_8cm", HistType::kTH1F, {{490, 0.1, 5.0, "#it{p} (GeV/#it{c})"}}); + registryDA.add("incomingDe_Pos_4cm", "incomingDe_Pos_4cm", HistType::kTH1F, {{490, 0.1, 5.0, "#it{p} (GeV/#it{c})"}}); + + registryDA.add("De_Pos_deltaR_8cm", "De_Pos_deltaR_8cm", HistType::kTH1F, {{300, 0.0, 30.0, "#Delta R (cm)"}}); + registryDA.add("De_Pos_deltaR_4cm", "De_Pos_deltaR_4cm", HistType::kTH1F, {{300, 0.0, 30.0, "#Delta R (cm)"}}); + + registryDA.add("survivingDe_Pos_8cm", "survivingDe_Pos_8cm", HistType::kTH2F, {{490, 0.1, 5.0, "#it{p} (GeV/#it{c})"}, {300, 0.0, 30.0, "#Delta R (cm)"}}); + registryDA.add("survivingDe_Pos_4cm", "survivingDe_Pos_4cm", HistType::kTH2F, {{490, 0.1, 5.0, "#it{p} (GeV/#it{c})"}, {300, 0.0, 30.0, "#Delta R (cm)"}}); + registryDA.add("De_Pos_Q_8cm", "De_Pos_Q_8cm", HistType::kTH2F, {{490, 0.1, 5.0, "#it{p} (GeV/#it{c})"}, {200, 0.0, 2000.0, "Q (ADC)"}}); + registryDA.add("De_Pos_Q_4cm", "De_Pos_Q_4cm", HistType::kTH2F, {{490, 0.1, 5.0, "#it{p} (GeV/#it{c})"}, {200, 0.0, 2000.0, "Q (ADC)"}}); + registryDA.add("De_Pos_ClsSize_8cm", "De_Pos_ClsSize_8cm", HistType::kTH2F, {{490, 0.1, 5.0, "#it{p} (GeV/#it{c})"}, {20, 0.0, 20., "Cls size"}}); + registryDA.add("De_Pos_ClsSize_4cm", "De_Pos_ClsSize_4cm", HistType::kTH2F, {{490, 0.1, 5.0, "#it{p} (GeV/#it{c})"}, {20, 0.0, 20.0, "Cls size"}}); + registryDA.add("De_Pos_momentum", "De_Pos_momentum", HistType::kTH2F, {{100, 0.0, 5.0, "#it{p}_{vtx} (GeV/#it{c})"}, {100, 0.0, 5.0, "#it{p}_{hmpid} (GeV/#it{c})"}}); + + registryDA.add("nSigmaTPC_vs_momHMPID_noCut_DePos", "nSigmaTPC_vs_momHMPID_noCut_DePos", HistType::kTH2F, {{490, 0.1, 5.0, "#it{p} (GeV/#it{c})"}, {20, -5., 5.0, "n#sigma_TPC"}}); + registryDA.add("nSigmaTOF_vs_momHMPID_noCut_DePos", "nSigmaTOF_vs_momHMPID_noCut_DePos", HistType::kTH2F, {{490, 0.1, 5.0, "#it{p} (GeV/#it{c})"}, {20, -5., 5.0, "n#sigma_TOF"}}); + registryDA.add("nSigmaTPC_vs_momHMPID_Cut_DePos", "nSigmaTPC_vs_momHMPID_Cut_DePos", HistType::kTH2F, {{490, 0.1, 5.0, "#it{p} (GeV/#it{c})"}, {20, -5., 5.0, "n#sigma_TPC"}}); + registryDA.add("nSigmaTOF_vs_momHMPID_Cut_DePos", "nSigmaTOF_vs_momHMPID_Cut_DePos", HistType::kTH2F, {{490, 0.1, 5.0, "#it{p} (GeV/#it{c})"}, {20, -5., 5.0, "n#sigma_TOF"}}); + + // Deuteron Neg + registryDA.add("incomingDe_Neg_8cm", "incomingDe_Neg_8cm", HistType::kTH1F, {{490, 0.1, 5.0, "#it{p} (GeV/#it{c})"}}); + registryDA.add("incomingDe_Neg_4cm", "incomingDe_Neg_4cm", HistType::kTH1F, {{490, 0.1, 5.0, "#it{p} (GeV/#it{c})"}}); + + // plot aggiunti + registryDA.add("De_Neg_deltaR_8cm", "De_Neg_deltaR_8cm", HistType::kTH1F, {{300, 0.0, 30.0, "#Delta R (cm)"}}); + registryDA.add("De_Neg_deltaR_4cm", "De_Neg_deltaR_4cm", HistType::kTH1F, {{300, 0.0, 30.0, "#Delta R (cm)"}}); + + registryDA.add("survivingDe_Neg_8cm", "survivingDe_Neg_8cm", HistType::kTH2F, {{490, 0.1, 5.0, "#it{p} (GeV/#it{c})"}, {300, 0.0, 30.0, "#Delta R (cm)"}}); + registryDA.add("survivingDe_Neg_4cm", "survivingDe_Neg_4cm", HistType::kTH2F, {{490, 0.1, 5.0, "#it{p} (GeV/#it{c})"}, {300, 0.0, 30.0, "#Delta R (cm)"}}); + registryDA.add("De_Neg_Q_8cm", "De_Neg_Q_8cm", HistType::kTH2F, {{490, 0.1, 5.0, "#it{p} (GeV/#it{c})"}, {200, 0.0, 2000.0, "Q (ADC)"}}); + registryDA.add("De_Neg_Q_4cm", "De_Neg_Q_4cm", HistType::kTH2F, {{490, 0.1, 5.0, "#it{p} (GeV/#it{c})"}, {200, 0.0, 2000.0, "Q (ADC)"}}); + registryDA.add("De_Neg_ClsSize_8cm", "De_Neg_ClsSize_8cm", HistType::kTH2F, {{490, 0.1, 5.0, "#it{p} (GeV/#it{c})"}, {20, 0.0, 20.0, "Cls size"}}); + registryDA.add("De_Neg_ClsSize_4cm", "De_Neg_ClsSize_4cm", HistType::kTH2F, {{490, 0.1, 5.0, "#it{p} (GeV/#it{c})"}, {20, 0.0, 20.0, "Cls size"}}); + registryDA.add("De_Neg_momentum", "De_Neg_momentum", HistType::kTH2F, {{100, 0.0, 5.0, "#it{p}_{vtx} (GeV/#it{c})"}, {100, 0.0, 5.0, "#it{p}_{hmpid} (GeV/#it{c})"}}); + + registryDA.add("nSigmaTPC_vs_momHMPID_noCut_DeNeg", "nSigmaTPC_vs_momHMPID_noCut_DeNeg", HistType::kTH2F, {{490, 0.1, 5.0, "#it{p} (GeV/#it{c})"}, {20, -5.0, 5.0, "n#sigma_TPC"}}); + registryDA.add("nSigmaTOF_vs_momHMPID_noCut_DeNeg", "nSigmaTOF_vs_momHMPID_noCut_DeNeg", HistType::kTH2F, {{490, 0.1, 5.0, "#it{p} (GeV/#it{c})"}, {20, -5., 5.0, "n#sigma_TOF"}}); + registryDA.add("nSigmaTPC_vs_momHMPID_Cut_DeNeg", "nSigmaTPC_vs_momHMPID_Cut_DeNeg", HistType::kTH2F, {{490, 0.1, 5.0, "#it{p} (GeV/#it{c})"}, {20, -5., 5.0, "n#sigma_TPC"}}); + registryDA.add("nSigmaTOF_vs_momHMPID_Cut_DeNeg", "nSigmaTOF_vs_momHMPID_Cut_DeNeg", HistType::kTH2F, {{490, 0.1, 5.0, "#it{p} (GeV/#it{c})"}, {20, -5., 5.0, "n#sigma_TOF"}}); + + registryDA.add("hmpidCkovvsMom", "hmpidCkovvsMom", kTH2F, {{500, 0, 10., "#it{p} (GeV/#it{c})"}, {800, 0., 0.8, "#theta_{Ch} (rad)"}}); + } + + void process(aod::HmpidAnalysis const& hmpidTable) + { + for (const auto& hmpid : hmpidTable) { + + // filters on primary tracks + if (hmpid.itsNCluster() < minReqClusterITS) + continue; + if (hmpid.tpcNCluster() < minTPCnClsFound) + continue; + if (hmpid.tpcNClsCrossedRows() < minNCrossedRowsTPC) + continue; + if (hmpid.tpcChi2() > maxChi2TPC) + continue; + if (hmpid.itsChi2() > maxChi2ITS) + continue; + if (TMath::Abs(hmpid.dcaXY()) > maxDCAxy) + continue; + if (TMath::Abs(hmpid.dcaZ()) > maxDCAz) + continue; + + // plots nsigma before cuts + if (hmpid.momentumHmpid() > 0) { + registryDA.fill(HIST("nSigmaTPC_vs_momHMPID_noCut_DePos"), std::fabs(hmpid.momentumHmpid()), hmpid.tpcNSigmaDe()); + registryDA.fill(HIST("nSigmaTOF_vs_momHMPID_noCut_DePos"), std::fabs(hmpid.momentumHmpid()), hmpid.tofNSigmaDe()); + } + + if (hmpid.momentumHmpid() < 0) { + registryDA.fill(HIST("nSigmaTPC_vs_momHMPID_noCut_DeNeg"), std::fabs(hmpid.momentumHmpid()), hmpid.tpcNSigmaDe()); + registryDA.fill(HIST("nSigmaTOF_vs_momHMPID_noCut_DeNeg"), std::fabs(hmpid.momentumHmpid()), hmpid.tofNSigmaDe()); + } + + // deuteron candidate cuts + if (hmpid.tpcNSigmaDe() < nsigmaTPCMin || hmpid.tpcNSigmaDe() > nsigmaTPCMax) + continue; + + if (hmpid.momentumHmpid() > 0) + registryDA.fill(HIST("nSigmaTPC_vs_momHMPID_Cut_DePos"), std::fabs(hmpid.momentumHmpid()), hmpid.tpcNSigmaDe()); + else + registryDA.fill(HIST("nSigmaTPC_vs_momHMPID_Cut_DeNeg"), std::fabs(hmpid.momentumHmpid()), hmpid.tpcNSigmaDe()); + + if (hmpid.tofNSigmaDe() < nsigmaTOFMin || hmpid.tofNSigmaDe() > nsigmaTOFMax) + continue; + + if (hmpid.momentumHmpid() > 0) + registryDA.fill(HIST("nSigmaTOF_vs_momHMPID_Cut_DePos"), std::fabs(hmpid.momentumHmpid()), hmpid.tofNSigmaDe()); + else + registryDA.fill(HIST("nSigmaTOF_vs_momHMPID_Cut_DeNeg"), std::fabs(hmpid.momentumHmpid()), hmpid.tofNSigmaDe()); + + // plot changle vs p + registryDA.fill(HIST("hmpidCkovvsMom"), hmpid.momentumHmpid(), hmpid.chAngle()); + + // absorbers + const float dx = hmpid.xTrack() - hmpid.xMip(); + const float dy = hmpid.yTrack() - hmpid.yMip(); + const float dr = TMath::Sqrt(dx * dx + dy * dy); + + int abs4cm = 2, abs8cm = 4; + bool hmpidAbs8cm = true, hmpidAbs4cm = true; + + if (hmpid.momentumHmpid() > 0) { + registryDA.fill(HIST("De_Pos_momentum"), hmpid.momentumTrack(), std::fabs(hmpid.momentumHmpid())); + + if (hmpidAbs8cm && hmpid.chamber() == abs8cm) { + registryDA.fill(HIST("incomingDe_Pos_8cm"), std::fabs(hmpid.momentumHmpid())); + registryDA.fill(HIST("survivingDe_Pos_8cm"), std::fabs(hmpid.momentumHmpid()), dr); + registryDA.fill(HIST("De_Pos_Q_8cm"), std::fabs(hmpid.momentumHmpid()), hmpid.chargeMip()); + registryDA.fill(HIST("De_Pos_ClsSize_8cm"), std::fabs(hmpid.momentumHmpid()), hmpid.clusterSize()); + registryDA.fill(HIST("De_Pos_deltaR_8cm"), dr); + } + if (hmpidAbs4cm && hmpid.chamber() == abs4cm) { + registryDA.fill(HIST("incomingDe_Pos_4cm"), std::fabs(hmpid.momentumHmpid())); + registryDA.fill(HIST("survivingDe_Pos_4cm"), std::fabs(hmpid.momentumHmpid()), dr); + registryDA.fill(HIST("De_Pos_Q_4cm"), std::fabs(hmpid.momentumHmpid()), hmpid.chargeMip()); + registryDA.fill(HIST("De_Pos_ClsSize_4cm"), std::fabs(hmpid.momentumHmpid()), hmpid.clusterSize()); + registryDA.fill(HIST("De_Pos_deltaR_4cm"), dr); + } + } + + if (hmpid.momentumHmpid() < 0) { + registryDA.fill(HIST("De_Neg_momentum"), hmpid.momentumTrack(), std::fabs(hmpid.momentumHmpid())); + + if (hmpidAbs8cm && hmpid.chamber() == abs8cm) { + registryDA.fill(HIST("incomingDe_Neg_8cm"), std::fabs(hmpid.momentumHmpid())); + registryDA.fill(HIST("survivingDe_Neg_8cm"), std::fabs(hmpid.momentumHmpid()), dr); + registryDA.fill(HIST("De_Neg_Q_8cm"), std::fabs(hmpid.momentumHmpid()), hmpid.chargeMip()); + registryDA.fill(HIST("De_Neg_ClsSize_8cm"), std::fabs(hmpid.momentumHmpid()), hmpid.clusterSize()); + registryDA.fill(HIST("De_Neg_deltaR_8cm"), dr); + } + if (hmpidAbs4cm && hmpid.chamber() == abs4cm) { + registryDA.fill(HIST("incomingDe_Neg_4cm"), std::fabs(hmpid.momentumHmpid())); + registryDA.fill(HIST("survivingDe_Neg_4cm"), std::fabs(hmpid.momentumHmpid()), dr); + registryDA.fill(HIST("De_Neg_Q_4cm"), std::fabs(hmpid.momentumHmpid()), hmpid.chargeMip()); + registryDA.fill(HIST("De_Neg_ClsSize_4cm"), std::fabs(hmpid.momentumHmpid()), hmpid.clusterSize()); + registryDA.fill(HIST("De_Neg_deltaR_4cm"), dr); + } + } + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc), + }; +} diff --git a/DPG/Tasks/AOTTrack/PID/HMPID/hmpidQa.cxx b/DPG/Tasks/AOTTrack/PID/HMPID/hmpidQa.cxx new file mode 100644 index 00000000000..346fd643233 --- /dev/null +++ b/DPG/Tasks/AOTTrack/PID/HMPID/hmpidQa.cxx @@ -0,0 +1,1514 @@ +// 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. + +#include "tableHMPID.h" + +#include "Common/Core/PID/PIDTOF.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/TableProducer/PID/pidTOFBase.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::constants::physics; + +double expectedSignal(double mass, float mom) +{ + // expected theoretical values + + double chAngleTh = -999.; + + const double nMean = 1.288; // radiator mean refraction index + + double cosChAngleTh = (TMath::Sqrt(mass * mass + mom * mom)) / (nMean * mom); + if (cosChAngleTh > 1) + return chAngleTh; + + chAngleTh = TMath::ACos(cosChAngleTh); + + return chAngleTh; +} + +double expectedSigma(int iPart, float mom) +{ + double sigmaRing = 0; + const int nMaxSigmas = 6; + + // fit parameters from sigma extrapolation + double fitSigmaExtraPions[nMaxSigmas] = {42.8961, -49.8723, 26.2311, -6.59093, 0.754578, -0.0286546}; + double fitSigmaExtraKaons[nMaxSigmas] = {76.9786, -103.655, 61.7533, -18.7436, 2.87855, -0.178318}; + double fitSigmaExtraProtons[nMaxSigmas] = {299.466, -383.277, 201.127, -52.2554, 6.67285, -0.334106}; + + // create sigma vs p functions + TF1* sigmaVsMomPions = new TF1("sigmaVsMomPions", "pol5", 0., 6.); + TF1* sigmaVsMomKaons = new TF1("sigmaVsMomKaons", "pol5", 0., 6.); + TF1* sigmaVsMomProtons = new TF1("sigmaVsMomProtons", "pol5", 0., 6.); + + for (int i = 0; i < nMaxSigmas; i++) { + sigmaVsMomPions->SetParameter(i, fitSigmaExtraPions[i]); + sigmaVsMomKaons->SetParameter(i, fitSigmaExtraKaons[i]); + sigmaVsMomProtons->SetParameter(i, fitSigmaExtraProtons[i]); + } + + const int idPions = 0, idKaons = 1, idProtons = 2; + + if (iPart == idPions) { + sigmaRing = gRandom->Gaus(sigmaVsMomPions->Eval(mom) / 1000., 0.1 * sigmaVsMomPions->Eval(mom) / 1000.); + } + if (iPart == idKaons) { + sigmaRing = 0.8 * gRandom->Gaus(sigmaVsMomKaons->Eval(mom) / 1000., 0.15 * sigmaVsMomKaons->Eval(mom) / 1000.); + } + if (iPart == idProtons) { + sigmaRing = 0.6 * gRandom->Gaus(sigmaVsMomProtons->Eval(mom) / 1000., 0.1 * sigmaVsMomProtons->Eval(mom) / 1000.); + } + + delete sigmaVsMomPions; + delete sigmaVsMomKaons; + delete sigmaVsMomProtons; + + return sigmaRing; +} + +void getProbability(float hmpidSignal, float hmpidMomentum, double* probs) +{ + // Calculates probability to be a pion-kaon-proton with the "amplitude" method + // from the given Cerenkov angle and momentum assuming no initial particle composition (class taken by AliROOT) + + int nSpecies = 3; + float angleZeroHeight = 900.; + + if (hmpidSignal <= 0) { + // HMPID does not find anything reasonable for this track, assign 0.33 for all species + for (int iPart = 0; iPart < nSpecies; iPart++) + probs[iPart] = 1.0 / nSpecies; + return; + } + + // assign mass in GeV/c^2 + double mass[] = {o2::constants::physics::MassPionCharged, o2::constants::physics::MassKaonCharged, o2::constants::physics::MassProton}; + + double hTot = 0; // Initialize the total height of the amplitude method + double* h = new double[nSpecies]; // number of charged particles to be considered + + bool desert = kTRUE; // Flag to evaluate if ThetaC is far ("desert") from the given Gaussians + + for (int iPart = 0; iPart < nSpecies; iPart++) { // for each particle + + h[iPart] = 0; // reset the height + double thetaCerTh = expectedSignal(mass[iPart], hmpidMomentum); // theoretical Theta Cherenkov + if (thetaCerTh > angleZeroHeight) + continue; // no light emitted, zero height + double sigmaRing = expectedSigma(iPart, hmpidMomentum); + float maxSigmaRing = 4 * sigmaRing; + + if (sigmaRing == 0) + continue; + + if (TMath::Abs(hmpidSignal - thetaCerTh) < maxSigmaRing) + desert = kFALSE; + h[iPart] = TMath::Gaus(thetaCerTh, hmpidSignal, sigmaRing, kTRUE); + hTot += h[iPart]; // total height of all theoretical heights for normalization + + } // species loop + + for (int iPart = 0; iPart < nSpecies; iPart++) { // species loop to assign probabilities + + if (!desert) + probs[iPart] = h[iPart] / hTot; + else + probs[iPart] = 1.0 / nSpecies; // all theoretical values are far away from experemental one + } + + delete[] h; +} + +struct HmpidQa { + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + Configurable nBinsP{"nBinsP", 1200, "Number of momentum bins"}; + Configurable minP{"minP", -20.f, "Minimum momentum plotted (GeV/c)"}; + Configurable maxP{"maxP", 20.f, "Maximum momentum plotted (GeV/c)"}; + + Configurable nBinsCh{"nBinsCh", 800, "Number of ch angle bins"}; + Configurable minCh{"minCh", 0.f, "Minimum ch angle plotted (rad)"}; + Configurable maxCh{"maxCh", 0.8f, "Maximum ch angle plotted (rad)"}; + + /// filters configurables for primary tracks + Configurable nSigmaTpcMin{"nSigmaTpcMin", -3.0, "nSigmaTpcMin"}; + Configurable nSigmaTpcMax{"nSigmaTpcMax", +3.0, "nSigmaTpcMax"}; + Configurable nSigmaTofMin{"nSigmaTofMin", -3.0, "nSigmaTofMin"}; + Configurable nSigmaTofMax{"nSigmaTofMax", +3.5, "nSigmaTofMax"}; + Configurable minReqClusterIts{"minReqClusterIts", 4.0, "min number of clusters required in ITS"}; + Configurable minTpcNClsFound{"minTpcNClsFound", 50.0f, "minTpcNClsFound"}; + Configurable minNCrossedRowsTpc{"minNCrossedRowsTpc", 70.0f, "min number of crossed rows TPC"}; + Configurable maxChi2Its{"maxChi2Its", 36.0f, "max chi2 per cluster ITS"}; + Configurable maxChi2Tpc{"maxChi2Tpc", 4.0f, "max chi2 per cluster TPC"}; + Configurable maxDCAXY{"maxDCAXY", 0.5f, "maxDCAXY"}; + Configurable maxDCAZ{"maxDCAZ", 0.5f, "maxDCAZ"}; + + // QA filters + Configurable cutDistanceMipTrack{"cutDistanceMipTrack", 3.0f, "cut distance between MIP and track"}; + Configurable cutQmip{"cutQmip", 120.0f, "cut on Q MIP"}; + Configurable cutMinMomGlobalTrack{"cutMinMomGlobalTrack", 1.5f, "minimum momentum of global track"}; + Configurable minProbParticle{"minProbParticle", 0.7f, "minimum particle probability"}; + Configurable maxDistanceForProb{"maxDistanceForProb", 1.5f, "maximum distance for probability calculation"}; + Configurable maxBoxHit{"maxBoxHit", 100.0f, "maximum box hit position"}; + Configurable minBoxHit{"minBoxHit", 40.0f, "minimum box hit position"}; + + // variables for chamber_number and HVs/PCs + const int rich0 = 0, rich1 = 1, rich2 = 2, rich3 = 3, rich4 = 4, rich5 = 5, rich6 = 6; + const int hv0 = 0, hv1 = 1, hv2 = 2, hv3 = 3, hv4 = 4, hv5 = 5; + // total number of chambers and HVs/PCs + static const int nCh = 7, nSec = 6, nPc = 6; + + //////////////////////////////////// + //////////////////////////////////// + // load geometry + o2::hmpid::Param* fParam = o2::hmpid::Param::instanceNoGeo(); + + void init(InitContext const&) + { + AxisSpec momAxis{nBinsP, minP, maxP, "#it{p} (GeV/#it{c})"}; + AxisSpec cherenkAxis{nBinsCh, minCh, maxCh, "#theta_{Ch} (rad)"}; + + histos.add("nPhotons_vs_sin2Ch", "nPhotons_vs_sin2Ch", kTProfile, {{40, 0.0, 0.5}}); + + histos.add("ChAngle_LowPt", "ChAngle_LowPt", kTH1F, {cherenkAxis}); + histos.add("ChAngle_HighPt", "ChAngle_HighPt", kTH1F, {cherenkAxis}); + + histos.add("hmpidSignal", "hmpidSignal", kTH1F, {cherenkAxis}); + + // th2f for spectra + histos.add("pTvsChAngle", "pTvsChAngle", kTH2F, {{500, 0, 10., "#it{p}_{T} (GeV/#it{c})"}, {cherenkAxis}}); + + // charge identification + histos.add("pTvsChAnglePos", "pTvsChAnglePos", kTH2F, {{500, 0, 10., "#it{p}_{T} (GeV/#it{c})"}, {cherenkAxis}}); + histos.add("pTvsChAngleNeg", "pTvsChAngleNeg", kTH2F, {{500, 0, 10., "#it{p}_{T} (GeV/#it{c})"}, {cherenkAxis}}); + + histos.add("hmpidMomvsTrackMom", "hmpidMomvsTrackMom", kTH2F, {{1200, 0, 30, "Track #it{p} (GeV/#it{c})"}, {1200, 0, 30, "HMPID #it{p} (GeV/#it{c})"}}); + histos.add("hmpidCkovvsMom", "hmpidCkovvsMom", kTH2F, {{1000, 0, 10, "#it{p} (GeV/#it{c})"}, cherenkAxis}); + histos.add("TrackMom", "TrackMom", kTH1F, {momAxis}); + histos.add("hmpidMom", "hmpidMom", kTH1F, {momAxis}); + + histos.add("hmpidNPhotons", "hmpidNPhotons", kTH1F, {{50, 2, 50, "Number of photons"}}); + + histos.add("hmpidCkovvsMom_nocut", "hmpidCkovvsMom_nocut", kTH2F, {{1000, 0, 10, "#it{p} (GeV/#it{c})"}, cherenkAxis}); + + histos.add("hmpidPhotsCharge", "hmpidPhotsCharge", kTH1F, {{180, 4, 210}}); + histos.add("hmpidQMip", "hmpidQMip", kTH1F, {{1000, 200, 2200, "Charge (ADC)"}}); + + // information on particle position + histos.add("hmpidXTrack", "hmpidXTrack", kTH1F, {{270, 0, 135, "X track (cm)"}}); + histos.add("hmpidYTrack", "hmpidYTrack", kTH1F, {{270, 0, 135, "Y track (cm)"}}); + histos.add("hmpidXMip", "hmpidXMip", kTH1F, {{270, 0, 135, "X mip (cm)"}}); + histos.add("hmpidYMip", "hmpidYMip", kTH1F, {{270, 0, 135, "X mip (cm)"}}); + histos.add("hmpidXResiduals", "hmpidXResiduals", kTH1F, {{400, -20, 20, "X Residuals (cm)"}}); + histos.add("hmpidYResiduals", "hmpidYResiduals", kTH1F, {{400, -20, 20, "Y Residuals (cm)"}}); + // 2D map for the mip and the track + histos.add("hmpidXYTrack", "hmpidXYTrack", kTH2F, {{270, 0, 135, "X track (cm)"}, {270, 0, 135, "Y track (cm)"}}); + histos.add("hmpidXYMip", "hmpidXYMip", kTH2F, {{270, 0, 135, "X mip (cm)"}, {270, 0, 135, "Y mip (cm)"}}); + + // histos per chamber + for (int iCh = 0; iCh < nCh; iCh++) { + histos.add(Form("hmpidXTrack%i", iCh), Form("hmpidXTrack%i", iCh), kTH1F, {{270, 0, 135, "X track (cm)"}}); + histos.add(Form("hmpidYTrack%i", iCh), Form("hmpidYTrack%i", iCh), kTH1F, {{270, 0, 135, "Y track (cm)"}}); + histos.add(Form("hmpidXMip%i", iCh), Form("hmpidXMip%i", iCh), kTH1F, {{270, 0, 135, "X mip (cm)"}}); + histos.add(Form("hmpidYMip%i", iCh), Form("hmpidYMip%i", iCh), kTH1F, {{270, 0, 135, "X mip (cm)"}}); + histos.add(Form("hmpidXResiduals%i", iCh), Form("hmpidXResiduals%i", iCh), kTH1F, {{400, -20, 20, "X Residuals (cm)"}}); + histos.add(Form("hmpidYResiduals%i", iCh), Form("hmpidYResiduals%i", iCh), kTH1F, {{400, -20, 20, "Y Residuals (cm)"}}); + + // residuals discriminated for charge sign + histos.add(Form("hmpidXResidualsPos%i", iCh), Form("hmpidXResidualsPos%i", iCh), kTH1F, {{400, -20, 20, "X Residuals (cm)"}}); + histos.add(Form("hmpidYResidualsPos%i", iCh), Form("hmpidYResidualsPos%i", iCh), kTH1F, {{400, -20, 20, "Y Residuals (cm)"}}); + + histos.add(Form("hmpidXResidualsNeg%i", iCh), Form("hmpidXResidualsNeg%i", iCh), kTH1F, {{400, -20, 20, "X Residuals (cm)"}}); + histos.add(Form("hmpidYResidualsNeg%i", iCh), Form("hmpidYResidualsNeg%i", iCh), kTH1F, {{400, -20, 20, "Y Residuals (cm)"}}); + + histos.add(Form("hmpidNPhotons%i", iCh), Form("hmpidNPhotons%i", iCh), kTH1F, {{50, 2, 50, "Number of photons"}}); + + histos.add(Form("hmpidQMip%i", iCh), Form("hmpidQMip%i", iCh), kTH1F, {{1000, 200, 2200, "Charge (ADC)"}}); + histos.add(Form("hmpidClusSize%i", iCh), Form("hmpidClusSize%i", iCh), kTH1F, {{15, 0, 15, "MIP Cluster size"}}); + + histos.add(Form("TrackMom%i", iCh), Form("TrackMom%i", iCh), kTH1F, {momAxis}); + histos.add(Form("hmpidMom%i", iCh), Form("hmpidMom%i", iCh), kTH1F, {momAxis}); + + histos.add(Form("hmpidPhotsCharge%i", iCh), Form("hmpidPhotsCharge%i", iCh), kTH1F, {{180, 4, 210}}); + histos.add(Form("hmpidXYMip%i", iCh), Form("hmpidXYMip%i", iCh), kTH2F, {{270, 0, 135, "X mip (cm)"}, {270, 0, 135, "Y mip (cm)"}}); + + histos.add(Form("nPhotons_vs_sin2Ch%i", iCh), Form("N. of Photons vs sin^{2}(#theta_{Ch}) - chamber%i", iCh), kTProfile, {{40, 0.0, 0.5}}); + + // histos per HV sector + for (int iSec = 0; iSec < nSec; iSec++) { + histos.add(Form("hmpidQMip_RICH%i_HV%i", iCh, iSec), Form("hmpidQMip_RICH%i_HV%i", iCh, iSec), kTH1F, {{2000, 200, 2200, "Charge (ADC)"}}); + histos.add(Form("hmpidNPhotons_RICH%i_HV%i", iCh, iSec), Form("hmpidNPhotons_RICH%i_HV%i", iCh, iSec), kTH1F, {{50, 2, 50, "Number of photons"}}); + histos.add(Form("hmpidPhotsCharge_RICH%i_HV%i", iCh, iSec), Form("hmpidPhotsCharge_RICH%i_HV%i", iCh, iSec), kTH1F, {{180, 4, 210}}); + } + + // plot n_ph vs sin2Ch per PC + for (int iPc = 0; iPc < nPc; iPc++) { + histos.add(Form("nPhotons_vs_sin2Ch_RICH%i_PC%i", iCh, iPc), Form("N. of Photons vs sin^{2}(#theta_{Ch}) - chamber%i, photocathode%i", iCh, iPc), kTProfile, {{20, 0.0, 0.4}}); + } + } + } + + void process(aod::HmpidAnalysis const& hmpidtable) + { + // photocathods limits + static float xMinPc[nPc]; + static float yMinPc[nPc]; + static float xMaxPc[nPc]; + static float yMaxPc[nPc]; + + for (int iPc = 0; iPc < nPc; iPc++) { + xMaxPc[iPc] = (fParam->maxPcX(iPc)) - 10.; + yMaxPc[iPc] = (fParam->maxPcY(iPc)) - 10.; + xMinPc[iPc] = (fParam->minPcX(iPc)) + 10.; + yMinPc[iPc] = (fParam->minPcY(iPc)) + 10.; + } + + for (const auto& hmpid : hmpidtable) // loop on tracks contained in the table + { + + // filters on primary tracks + if (hmpid.itsNCluster() < minReqClusterIts) + continue; + if (hmpid.tpcNCluster() < minTpcNClsFound) + continue; + if (hmpid.tpcNClsCrossedRows() < minNCrossedRowsTpc) + continue; + if (hmpid.tpcChi2() > maxChi2Tpc) + continue; + if (hmpid.itsChi2() > maxChi2Its) + continue; + if (TMath::Abs(hmpid.dcaXY()) > maxDCAXY) + continue; + if (TMath::Abs(hmpid.dcaZ()) > maxDCAZ) + continue; + + // evaluate distance mip-track + const float distanceMipToTrack = std::hypot(hmpid.xTrack() - hmpid.xMip(), hmpid.yTrack() - hmpid.yMip()); + + // quality conditions to check + const bool physicalChAngle = (hmpid.chAngle() > 0); + const bool mipChargeCondition = (hmpid.chargeMip() > cutQmip); + const bool distanceCondition = (distanceMipToTrack < cutDistanceMipTrack); + + // fill histograms + histos.fill(HIST("hmpidMomvsTrackMom"), std::fabs(hmpid.momentumTrack()), std::fabs(hmpid.momentumHmpid())); + histos.fill(HIST("TrackMom"), std::fabs(hmpid.momentumTrack())); + histos.fill(HIST("hmpidMom"), std::fabs(hmpid.momentumHmpid())); + + histos.fill(HIST("hmpidSignal"), hmpid.chAngle()); + + if (physicalChAngle && distanceCondition && mipChargeCondition) { + double pT = static_cast(hmpid.momentumTrack() / TMath::CosH(hmpid.etaTrack())); + histos.fill(HIST("pTvsChAngle"), pT, hmpid.chAngle()); + if (hmpid.momentumHmpid() > 0) { + histos.fill(HIST("pTvsChAnglePos"), pT, hmpid.chAngle()); + } + if (hmpid.momentumHmpid() < 0) { + histos.fill(HIST("pTvsChAngleNeg"), pT, hmpid.chAngle()); + } + } + + float sin2changle = 0.; + + if (distanceCondition && mipChargeCondition) { + + histos.fill(HIST("hmpidNPhotons"), hmpid.nPhotons()); + + sin2changle = static_cast(TMath::Power(TMath::Sin(hmpid.chAngle()), 2)); + if (hmpid.xMip() <= maxBoxHit && hmpid.xMip() >= minBoxHit && hmpid.yMip() <= maxBoxHit && hmpid.yMip() >= minBoxHit) { + histos.fill(HIST("nPhotons_vs_sin2Ch"), sin2changle, hmpid.nPhotons()); + } + + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) + histos.fill(HIST("hmpidPhotsCharge"), hmpid.photonsCharge()[i]); + } + } + + if (distanceCondition) { + histos.fill(HIST("hmpidQMip"), hmpid.chargeMip()); + } + + histos.fill(HIST("hmpidXTrack"), hmpid.xTrack()); + histos.fill(HIST("hmpidYTrack"), hmpid.yTrack()); + histos.fill(HIST("hmpidXMip"), hmpid.xMip()); + histos.fill(HIST("hmpidYMip"), hmpid.yMip()); + if (hmpid.momentumTrack() > cutMinMomGlobalTrack) { + histos.fill(HIST("hmpidXResiduals"), hmpid.xMip() - hmpid.xTrack()); + histos.fill(HIST("hmpidYResiduals"), hmpid.yMip() - hmpid.yTrack()); + } + histos.fill(HIST("hmpidXYTrack"), hmpid.xTrack(), hmpid.yTrack()); + histos.fill(HIST("hmpidXYMip"), hmpid.xMip(), hmpid.yMip()); + + ///////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////// + // fill histograms per chamber + if (hmpid.chamber() == rich0) { + histos.fill(HIST("hmpidXTrack0"), hmpid.xTrack()); + histos.fill(HIST("hmpidYTrack0"), hmpid.yTrack()); + histos.fill(HIST("hmpidXMip0"), hmpid.xMip()); + histos.fill(HIST("hmpidYMip0"), hmpid.yMip()); + histos.fill(HIST("hmpidXResiduals0"), hmpid.xMip() - hmpid.xTrack()); + histos.fill(HIST("hmpidYResiduals0"), hmpid.yMip() - hmpid.yTrack()); + + if (hmpid.momentumTrack() > cutMinMomGlobalTrack) { + if (hmpid.momentumHmpid() > 0) { + // fill residual histos for positive charges + histos.fill(HIST("hmpidXResidualsPos0"), hmpid.xMip() - hmpid.xTrack()); + histos.fill(HIST("hmpidYResidualsPos0"), hmpid.yMip() - hmpid.yTrack()); + } + + if (hmpid.momentumHmpid() < 0) { + // fill residual histos for negative charges + histos.fill(HIST("hmpidXResidualsNeg0"), hmpid.xMip() - hmpid.xTrack()); + histos.fill(HIST("hmpidYResidualsNeg0"), hmpid.yMip() - hmpid.yTrack()); + } + } + + if (distanceCondition) { + histos.fill(HIST("hmpidQMip0"), hmpid.chargeMip()); + } + histos.fill(HIST("hmpidClusSize0"), hmpid.clusterSize()); + histos.fill(HIST("TrackMom0"), hmpid.momentumTrack()); + histos.fill(HIST("hmpidMom0"), std::fabs(hmpid.momentumHmpid())); + histos.fill(HIST("hmpidXYMip0"), hmpid.xMip(), hmpid.yMip()); + + if (distanceCondition && mipChargeCondition) { + histos.fill(HIST("hmpidNPhotons0"), hmpid.nPhotons()); + sin2changle = static_cast(TMath::Power(TMath::Sin(hmpid.chAngle()), 2)); + if (hmpid.xMip() <= maxBoxHit && hmpid.xMip() >= minBoxHit && hmpid.yMip() <= maxBoxHit && hmpid.yMip() >= minBoxHit) { + histos.fill(HIST("nPhotons_vs_sin2Ch0"), sin2changle, hmpid.nPhotons()); + } + + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) + histos.fill(HIST("hmpidPhotsCharge0"), hmpid.photonsCharge()[i]); + } + } + + ////////////////////////////////////////////////////////////////// + // plot per HV sector + if (fParam->inHVSector(hmpid.yMip()) == hv0) { + + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH0_HV0"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH0_HV0"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH0_HV0"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv1) { + + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH0_HV1"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH0_HV1"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH0_HV1"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv2) { + + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH0_HV2"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH0_HV2"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH0_HV2"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv3) { + + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH0_HV3"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH0_HV3"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH0_HV3"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv4) { + + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH0_HV4"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH0_HV4"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH0_HV4"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv5) { + + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH0_HV5"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH0_HV5"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH0_HV5"), hmpid.nPhotons()); + } + } + + ////////////////////////////////////////////////////////////////// + // fill plot photocathode + if (distanceCondition && mipChargeCondition && physicalChAngle) // condizione da verificare a priori + { + if (hmpid.xMip() >= xMinPc[0] && hmpid.xMip() <= xMaxPc[0] && hmpid.yMip() >= yMinPc[0] && hmpid.yMip() <= yMaxPc[0]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH0_PC0"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[1] && hmpid.xMip() <= xMaxPc[1] && hmpid.yMip() >= yMinPc[1] && hmpid.yMip() <= yMaxPc[1]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH0_PC1"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[2] && hmpid.xMip() <= xMaxPc[2] && hmpid.yMip() >= yMinPc[2] && hmpid.yMip() <= yMaxPc[2]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH0_PC2"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[3] && hmpid.xMip() <= xMaxPc[3] && hmpid.yMip() >= yMinPc[3] && hmpid.yMip() <= yMaxPc[3]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH0_PC3"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[4] && hmpid.xMip() <= xMaxPc[4] && hmpid.yMip() >= yMinPc[4] && hmpid.yMip() <= yMaxPc[4]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH0_PC4"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[5] && hmpid.xMip() <= xMaxPc[5] && hmpid.yMip() >= yMinPc[5] && hmpid.yMip() <= yMaxPc[5]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH0_PC5"), sin2changle, hmpid.nPhotons()); + } + } + } + + if (hmpid.chamber() == rich1) { + histos.fill(HIST("hmpidXTrack1"), hmpid.xTrack()); + histos.fill(HIST("hmpidYTrack1"), hmpid.yTrack()); + histos.fill(HIST("hmpidXMip1"), hmpid.xMip()); + histos.fill(HIST("hmpidYMip1"), hmpid.yMip()); + histos.fill(HIST("hmpidXResiduals1"), hmpid.xMip() - hmpid.xTrack()); + histos.fill(HIST("hmpidYResiduals1"), hmpid.yMip() - hmpid.yTrack()); + + if (hmpid.momentumTrack() > cutMinMomGlobalTrack) { + if (hmpid.momentumHmpid() > 0) { + // fill residual histos for positive charges + histos.fill(HIST("hmpidXResidualsPos1"), hmpid.xMip() - hmpid.xTrack()); + histos.fill(HIST("hmpidYResidualsPos1"), hmpid.yMip() - hmpid.yTrack()); + } + + if (hmpid.momentumHmpid() < 0) { + // fill residual histos for negative charges + histos.fill(HIST("hmpidXResidualsNeg1"), hmpid.xMip() - hmpid.xTrack()); + histos.fill(HIST("hmpidYResidualsNeg1"), hmpid.yMip() - hmpid.yTrack()); + } + } + + if (distanceCondition) { + histos.fill(HIST("hmpidQMip1"), hmpid.chargeMip()); + } + histos.fill(HIST("hmpidClusSize1"), hmpid.clusterSize()); + histos.fill(HIST("TrackMom1"), hmpid.momentumTrack()); + histos.fill(HIST("hmpidMom1"), std::fabs(hmpid.momentumHmpid())); + histos.fill(HIST("hmpidXYMip1"), hmpid.xMip(), hmpid.yMip()); + + if (distanceCondition && mipChargeCondition) { + histos.fill(HIST("hmpidNPhotons1"), hmpid.nPhotons()); + sin2changle = static_cast(TMath::Power(TMath::Sin(hmpid.chAngle()), 2)); + if (hmpid.xMip() <= maxBoxHit && hmpid.xMip() >= minBoxHit && hmpid.yMip() <= maxBoxHit && hmpid.yMip() >= minBoxHit) { + histos.fill(HIST("nPhotons_vs_sin2Ch1"), sin2changle, hmpid.nPhotons()); + } + + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) + histos.fill(HIST("hmpidPhotsCharge1"), hmpid.photonsCharge()[i]); + } + } + + // plot per HV sector + if (fParam->inHVSector(hmpid.yMip()) == hv0) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH1_HV0"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH1_HV0"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH1_HV0"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv1) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH1_HV1"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH1_HV1"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH1_HV1"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv2) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH1_HV2"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH1_HV2"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH1_HV2"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv3) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH1_HV3"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH1_HV3"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH1_HV3"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv4) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH1_HV4"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH1_HV4"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH1_HV4"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv5) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH1_HV5"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH1_HV5"), hmpid.photonsCharge()[i]); + } // hmpidPhotsCharge_RICH%i_HV%i + } + histos.fill(HIST("hmpidNPhotons_RICH1_HV5"), hmpid.nPhotons()); + } + } + + ////////////////////////////////////////////////////////////////// + // fill plot photocathode + if (distanceCondition && mipChargeCondition && physicalChAngle) // condizione da verificare a priori + { + if (hmpid.xMip() >= xMinPc[0] && hmpid.xMip() <= xMaxPc[0] && hmpid.yMip() >= yMinPc[0] && hmpid.yMip() <= yMaxPc[0]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH1_PC0"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[1] && hmpid.xMip() <= xMaxPc[1] && hmpid.yMip() >= yMinPc[1] && hmpid.yMip() <= yMaxPc[1]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH1_PC1"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[2] && hmpid.xMip() <= xMaxPc[2] && hmpid.yMip() >= yMinPc[2] && hmpid.yMip() <= yMaxPc[2]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH1_PC2"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[3] && hmpid.xMip() <= xMaxPc[3] && hmpid.yMip() >= yMinPc[3] && hmpid.yMip() <= yMaxPc[3]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH1_PC3"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[4] && hmpid.xMip() <= xMaxPc[4] && hmpid.yMip() >= yMinPc[4] && hmpid.yMip() <= yMaxPc[4]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH1_PC4"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[5] && hmpid.xMip() <= xMaxPc[5] && hmpid.yMip() >= yMinPc[5] && hmpid.yMip() <= yMaxPc[5]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH1_PC5"), sin2changle, hmpid.nPhotons()); + } + } + } + + if (hmpid.chamber() == rich2) { + histos.fill(HIST("hmpidXTrack2"), hmpid.xTrack()); + histos.fill(HIST("hmpidYTrack2"), hmpid.yTrack()); + histos.fill(HIST("hmpidXMip2"), hmpid.xMip()); + histos.fill(HIST("hmpidYMip2"), hmpid.yMip()); + histos.fill(HIST("hmpidXResiduals2"), hmpid.xMip() - hmpid.xTrack()); + histos.fill(HIST("hmpidYResiduals2"), hmpid.yMip() - hmpid.yTrack()); + + if (hmpid.momentumTrack() > cutMinMomGlobalTrack) { + if (hmpid.momentumHmpid() > 0) { + // fill residual histos for positive charges + histos.fill(HIST("hmpidXResidualsPos2"), hmpid.xMip() - hmpid.xTrack()); + histos.fill(HIST("hmpidYResidualsPos2"), hmpid.yMip() - hmpid.yTrack()); + } + + if (hmpid.momentumHmpid() < 0) { + // fill residual histos for negative charges + histos.fill(HIST("hmpidXResidualsNeg2"), hmpid.xMip() - hmpid.xTrack()); + histos.fill(HIST("hmpidYResidualsNeg2"), hmpid.yMip() - hmpid.yTrack()); + } + } + + if (distanceCondition) { + histos.fill(HIST("hmpidQMip2"), hmpid.chargeMip()); + } + histos.fill(HIST("hmpidClusSize2"), hmpid.clusterSize()); + histos.fill(HIST("TrackMom2"), hmpid.momentumTrack()); + histos.fill(HIST("hmpidMom2"), std::fabs(hmpid.momentumHmpid())); + histos.fill(HIST("hmpidXYMip2"), hmpid.xMip(), hmpid.yMip()); + + if (distanceCondition && mipChargeCondition) { + histos.fill(HIST("hmpidNPhotons2"), hmpid.nPhotons()); + sin2changle = static_cast(TMath::Power(TMath::Sin(hmpid.chAngle()), 2)); + if (hmpid.xMip() <= maxBoxHit && hmpid.xMip() >= minBoxHit && hmpid.yMip() <= maxBoxHit && hmpid.yMip() >= minBoxHit) { + histos.fill(HIST("nPhotons_vs_sin2Ch2"), sin2changle, hmpid.nPhotons()); + } + + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) + histos.fill(HIST("hmpidPhotsCharge2"), hmpid.photonsCharge()[i]); + } + } + + // plot per HV sector + if (fParam->inHVSector(hmpid.yMip()) == hv0) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH2_HV0"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH2_HV0"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH2_HV0"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv1) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH2_HV1"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH2_HV1"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH2_HV1"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv2) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH2_HV2"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH2_HV2"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH2_HV2"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv3) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH2_HV3"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH2_HV3"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH2_HV3"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv4) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH2_HV4"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH2_HV4"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH2_HV4"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv5) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH2_HV5"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH2_HV5"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH2_HV5"), hmpid.nPhotons()); + } + } + + ////////////////////////////////////////////////////////////////// + // fill plot photocathode + if (distanceCondition && mipChargeCondition && physicalChAngle) // condizione da verificare a priori + { + if (hmpid.xMip() >= xMinPc[0] && hmpid.xMip() <= xMaxPc[0] && hmpid.yMip() >= yMinPc[0] && hmpid.yMip() <= yMaxPc[0]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH2_PC0"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[1] && hmpid.xMip() <= xMaxPc[1] && hmpid.yMip() >= yMinPc[1] && hmpid.yMip() <= yMaxPc[1]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH2_PC1"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[2] && hmpid.xMip() <= xMaxPc[2] && hmpid.yMip() >= yMinPc[2] && hmpid.yMip() <= yMaxPc[2]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH2_PC2"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[3] && hmpid.xMip() <= xMaxPc[3] && hmpid.yMip() >= yMinPc[3] && hmpid.yMip() <= yMaxPc[3]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH2_PC3"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[4] && hmpid.xMip() <= xMaxPc[4] && hmpid.yMip() >= yMinPc[4] && hmpid.yMip() <= yMaxPc[4]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH2_PC4"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[5] && hmpid.xMip() <= xMaxPc[5] && hmpid.yMip() >= yMinPc[5] && hmpid.yMip() <= yMaxPc[5]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH2_PC5"), sin2changle, hmpid.nPhotons()); + } + } + } + + if (hmpid.chamber() == rich3) { + histos.fill(HIST("hmpidXTrack3"), hmpid.xTrack()); + histos.fill(HIST("hmpidYTrack3"), hmpid.yTrack()); + histos.fill(HIST("hmpidXMip3"), hmpid.xMip()); + histos.fill(HIST("hmpidYMip3"), hmpid.yMip()); + histos.fill(HIST("hmpidXResiduals3"), hmpid.xMip() - hmpid.xTrack()); + histos.fill(HIST("hmpidYResiduals3"), hmpid.yMip() - hmpid.yTrack()); + + if (hmpid.momentumTrack() > cutMinMomGlobalTrack) { + if (hmpid.momentumHmpid() > 0) { + // fill residual histos for positive charges + histos.fill(HIST("hmpidXResidualsPos3"), hmpid.xMip() - hmpid.xTrack()); + histos.fill(HIST("hmpidYResidualsPos3"), hmpid.yMip() - hmpid.yTrack()); + } + + if (hmpid.momentumHmpid() < 0) { + // fill residual histos for negative charges + histos.fill(HIST("hmpidXResidualsNeg3"), hmpid.xMip() - hmpid.xTrack()); + histos.fill(HIST("hmpidYResidualsNeg3"), hmpid.yMip() - hmpid.yTrack()); + } + } + + if (distanceCondition) { + histos.fill(HIST("hmpidQMip3"), hmpid.chargeMip()); + } + histos.fill(HIST("hmpidClusSize3"), hmpid.clusterSize()); + histos.fill(HIST("TrackMom3"), hmpid.momentumTrack()); + histos.fill(HIST("hmpidMom3"), std::fabs(hmpid.momentumHmpid())); + histos.fill(HIST("hmpidXYMip3"), hmpid.xMip(), hmpid.yMip()); + + if (distanceCondition && mipChargeCondition) { + histos.fill(HIST("hmpidNPhotons3"), hmpid.nPhotons()); + sin2changle = static_cast(TMath::Power(TMath::Sin(hmpid.chAngle()), 2)); + if (hmpid.xMip() <= maxBoxHit && hmpid.xMip() >= minBoxHit && hmpid.yMip() <= maxBoxHit && hmpid.yMip() >= minBoxHit) { + histos.fill(HIST("nPhotons_vs_sin2Ch3"), sin2changle, hmpid.nPhotons()); + } + + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge3"), hmpid.photonsCharge()[i]); + } + } + } + + // plot per HV sector + if (fParam->inHVSector(hmpid.yMip()) == hv0) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH3_HV0"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH3_HV0"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH3_HV0"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv1) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH3_HV1"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH3_HV1"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH3_HV1"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv2) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH3_HV2"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH3_HV2"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH3_HV2"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv3) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH3_HV3"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH3_HV3"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH3_HV3"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv4) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH3_HV4"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH3_HV4"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH3_HV4"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv5) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH3_HV5"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH3_HV5"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH3_HV5"), hmpid.nPhotons()); + } + } + + ////////////////////////////////////////////////////////////////// + // fill plot photocathode + if (distanceCondition && mipChargeCondition && physicalChAngle) // condizione da verificare a priori + { + if (hmpid.xMip() >= xMinPc[0] && hmpid.xMip() <= xMaxPc[0] && hmpid.yMip() >= yMinPc[0] && hmpid.yMip() <= yMaxPc[0]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH3_PC0"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[1] && hmpid.xMip() <= xMaxPc[1] && hmpid.yMip() >= yMinPc[1] && hmpid.yMip() <= yMaxPc[1]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH3_PC1"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[2] && hmpid.xMip() <= xMaxPc[2] && hmpid.yMip() >= yMinPc[2] && hmpid.yMip() <= yMaxPc[2]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH3_PC2"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[3] && hmpid.xMip() <= xMaxPc[3] && hmpid.yMip() >= yMinPc[3] && hmpid.yMip() <= yMaxPc[3]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH3_PC3"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[4] && hmpid.xMip() <= xMaxPc[4] && hmpid.yMip() >= yMinPc[4] && hmpid.yMip() <= yMaxPc[4]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH3_PC4"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[5] && hmpid.xMip() <= xMaxPc[5] && hmpid.yMip() >= yMinPc[5] && hmpid.yMip() <= yMaxPc[5]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH3_PC5"), sin2changle, hmpid.nPhotons()); + } + } + } + + if (hmpid.chamber() == rich4) { + histos.fill(HIST("hmpidXTrack4"), hmpid.xTrack()); + histos.fill(HIST("hmpidYTrack4"), hmpid.yTrack()); + histos.fill(HIST("hmpidXMip4"), hmpid.xMip()); + histos.fill(HIST("hmpidYMip4"), hmpid.yMip()); + histos.fill(HIST("hmpidXResiduals4"), hmpid.xMip() - hmpid.xTrack()); + histos.fill(HIST("hmpidYResiduals4"), hmpid.yMip() - hmpid.yTrack()); + + if (hmpid.momentumTrack() > cutMinMomGlobalTrack) { + if (hmpid.momentumHmpid() > 0) { + // fill residual histos for positive charges + histos.fill(HIST("hmpidXResidualsPos4"), hmpid.xMip() - hmpid.xTrack()); + histos.fill(HIST("hmpidYResidualsPos4"), hmpid.yMip() - hmpid.yTrack()); + } + + if (hmpid.momentumHmpid() < 0) { + // fill residual histos for negative charges + histos.fill(HIST("hmpidXResidualsNeg4"), hmpid.xMip() - hmpid.xTrack()); + histos.fill(HIST("hmpidYResidualsNeg4"), hmpid.yMip() - hmpid.yTrack()); + } + } + + if (distanceCondition) { + histos.fill(HIST("hmpidQMip4"), hmpid.chargeMip()); + } + histos.fill(HIST("hmpidClusSize4"), hmpid.clusterSize()); + histos.fill(HIST("TrackMom4"), hmpid.momentumTrack()); + histos.fill(HIST("hmpidMom4"), std::fabs(hmpid.momentumHmpid())); + histos.fill(HIST("hmpidXYMip4"), hmpid.xMip(), hmpid.yMip()); + + if (distanceCondition && mipChargeCondition) { + histos.fill(HIST("hmpidNPhotons4"), hmpid.nPhotons()); + sin2changle = static_cast(TMath::Power(TMath::Sin(hmpid.chAngle()), 2)); + if (hmpid.xMip() <= maxBoxHit && hmpid.xMip() >= minBoxHit && hmpid.yMip() <= maxBoxHit && hmpid.yMip() >= minBoxHit) { + histos.fill(HIST("nPhotons_vs_sin2Ch4"), sin2changle, hmpid.nPhotons()); + } + + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) + histos.fill(HIST("hmpidPhotsCharge4"), hmpid.photonsCharge()[i]); + } + } + + // plot per HV sector + if (fParam->inHVSector(hmpid.yMip()) == hv0) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH4_HV0"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH4_HV0"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH4_HV0"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv1) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH4_HV1"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH4_HV1"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH4_HV1"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv2) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH4_HV2"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH4_HV2"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH4_HV2"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv3) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH4_HV3"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH4_HV3"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH4_HV3"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv4) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH4_HV4"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH4_HV4"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH4_HV4"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv5) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH4_HV5"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH4_HV5"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH4_HV5"), hmpid.nPhotons()); + } + } + + ////////////////////////////////////////////////////////////////// + // fill plot photocathode + if (distanceCondition && mipChargeCondition && physicalChAngle) // condizione da verificare a priori + { + if (hmpid.xMip() >= xMinPc[0] && hmpid.xMip() <= xMaxPc[0] && hmpid.yMip() >= yMinPc[0] && hmpid.yMip() <= yMaxPc[0]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH4_PC0"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[1] && hmpid.xMip() <= xMaxPc[1] && hmpid.yMip() >= yMinPc[1] && hmpid.yMip() <= yMaxPc[1]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH4_PC1"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[2] && hmpid.xMip() <= xMaxPc[2] && hmpid.yMip() >= yMinPc[2] && hmpid.yMip() <= yMaxPc[2]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH4_PC2"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[3] && hmpid.xMip() <= xMaxPc[3] && hmpid.yMip() >= yMinPc[3] && hmpid.yMip() <= yMaxPc[3]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH4_PC3"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[4] && hmpid.xMip() <= xMaxPc[4] && hmpid.yMip() >= yMinPc[4] && hmpid.yMip() <= yMaxPc[4]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH4_PC4"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[5] && hmpid.xMip() <= xMaxPc[5] && hmpid.yMip() >= yMinPc[5] && hmpid.yMip() <= yMaxPc[5]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH4_PC5"), sin2changle, hmpid.nPhotons()); + } + } + } + + if (hmpid.chamber() == rich5) { + histos.fill(HIST("hmpidXTrack5"), hmpid.xTrack()); + histos.fill(HIST("hmpidYTrack5"), hmpid.yTrack()); + histos.fill(HIST("hmpidXMip5"), hmpid.xMip()); + histos.fill(HIST("hmpidYMip5"), hmpid.yMip()); + histos.fill(HIST("hmpidXResiduals5"), hmpid.xMip() - hmpid.xTrack()); + histos.fill(HIST("hmpidYResiduals5"), hmpid.yMip() - hmpid.yTrack()); + + if (hmpid.momentumTrack() > cutMinMomGlobalTrack) { + if (hmpid.momentumHmpid() > 0) { + // fill residual histos for positive charges + histos.fill(HIST("hmpidXResidualsPos5"), hmpid.xMip() - hmpid.xTrack()); + histos.fill(HIST("hmpidYResidualsPos5"), hmpid.yMip() - hmpid.yTrack()); + } + + if (hmpid.momentumHmpid() < 0) { + // fill residual histos for negative charges + histos.fill(HIST("hmpidXResidualsNeg5"), hmpid.xMip() - hmpid.xTrack()); + histos.fill(HIST("hmpidYResidualsNeg5"), hmpid.yMip() - hmpid.yTrack()); + } + } + + if (distanceCondition) { + histos.fill(HIST("hmpidQMip5"), hmpid.chargeMip()); + } + histos.fill(HIST("hmpidClusSize5"), hmpid.clusterSize()); + histos.fill(HIST("TrackMom5"), hmpid.momentumTrack()); + histos.fill(HIST("hmpidMom5"), std::fabs(hmpid.momentumHmpid())); + histos.fill(HIST("hmpidXYMip5"), hmpid.xMip(), hmpid.yMip()); + + if (distanceCondition && mipChargeCondition) { + histos.fill(HIST("hmpidNPhotons5"), hmpid.nPhotons()); + sin2changle = static_cast(TMath::Power(TMath::Sin(hmpid.chAngle()), 2)); + if (hmpid.xMip() <= maxBoxHit && hmpid.xMip() >= minBoxHit && hmpid.yMip() <= maxBoxHit && hmpid.yMip() >= minBoxHit) { + histos.fill(HIST("nPhotons_vs_sin2Ch5"), sin2changle, hmpid.nPhotons()); + } + + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) + histos.fill(HIST("hmpidPhotsCharge5"), hmpid.photonsCharge()[i]); + } + } + + // plot per HV sector + if (fParam->inHVSector(hmpid.yMip()) == hv0) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH5_HV0"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH5_HV0"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH5_HV0"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv1) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH5_HV1"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH5_HV1"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH5_HV1"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv2) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH5_HV2"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH5_HV2"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH5_HV2"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv3) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH5_HV3"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH5_HV3"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH5_HV3"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv4) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH5_HV4"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH5_HV4"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH5_HV4"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv5) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH5_HV5"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH5_HV5"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH5_HV5"), hmpid.nPhotons()); + } + } + + ////////////////////////////////////////////////////////////////// + // fill plot photocathode + if (distanceCondition && mipChargeCondition && physicalChAngle) // condizione da verificare a priori + { + if (hmpid.xMip() >= xMinPc[0] && hmpid.xMip() <= xMaxPc[0] && hmpid.yMip() >= yMinPc[0] && hmpid.yMip() <= yMaxPc[0]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH5_PC0"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[1] && hmpid.xMip() <= xMaxPc[1] && hmpid.yMip() >= yMinPc[1] && hmpid.yMip() <= yMaxPc[1]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH5_PC1"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[2] && hmpid.xMip() <= xMaxPc[2] && hmpid.yMip() >= yMinPc[2] && hmpid.yMip() <= yMaxPc[2]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH5_PC2"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[3] && hmpid.xMip() <= xMaxPc[3] && hmpid.yMip() >= yMinPc[3] && hmpid.yMip() <= yMaxPc[3]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH5_PC3"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[4] && hmpid.xMip() <= xMaxPc[4] && hmpid.yMip() >= yMinPc[4] && hmpid.yMip() <= yMaxPc[4]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH5_PC4"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[5] && hmpid.xMip() <= xMaxPc[5] && hmpid.yMip() >= yMinPc[5] && hmpid.yMip() <= yMaxPc[5]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH5_PC5"), sin2changle, hmpid.nPhotons()); + } + } + } + + if (hmpid.chamber() == rich6) { + histos.fill(HIST("hmpidXTrack6"), hmpid.xTrack()); + histos.fill(HIST("hmpidYTrack6"), hmpid.yTrack()); + histos.fill(HIST("hmpidXMip6"), hmpid.xMip()); + histos.fill(HIST("hmpidYMip6"), hmpid.yMip()); + histos.fill(HIST("hmpidXResiduals6"), hmpid.xMip() - hmpid.xTrack()); + histos.fill(HIST("hmpidYResiduals6"), hmpid.yMip() - hmpid.yTrack()); + + if (hmpid.momentumTrack() > cutMinMomGlobalTrack) { + if (hmpid.momentumHmpid() > 0) { + // fill residual histos for positive charges + histos.fill(HIST("hmpidXResidualsPos6"), hmpid.xMip() - hmpid.xTrack()); + histos.fill(HIST("hmpidYResidualsPos6"), hmpid.yMip() - hmpid.yTrack()); + } + + if (hmpid.momentumHmpid() < 0) { + // fill residual histos for negative charges + histos.fill(HIST("hmpidXResidualsNeg6"), hmpid.xMip() - hmpid.xTrack()); + histos.fill(HIST("hmpidYResidualsNeg6"), hmpid.yMip() - hmpid.yTrack()); + } + } + + if (distanceCondition) { + histos.fill(HIST("hmpidQMip6"), hmpid.chargeMip()); + } + histos.fill(HIST("hmpidClusSize6"), hmpid.clusterSize()); + histos.fill(HIST("TrackMom6"), hmpid.momentumTrack()); + histos.fill(HIST("hmpidMom6"), std::fabs(hmpid.momentumHmpid())); + histos.fill(HIST("hmpidXYMip6"), hmpid.xMip(), hmpid.yMip()); + + if (distanceCondition && mipChargeCondition) { + histos.fill(HIST("hmpidNPhotons6"), hmpid.nPhotons()); + sin2changle = static_cast(TMath::Power(TMath::Sin(hmpid.chAngle()), 2)); + if (hmpid.xMip() <= maxBoxHit && hmpid.xMip() >= minBoxHit && hmpid.yMip() <= maxBoxHit && hmpid.yMip() >= minBoxHit) { + histos.fill(HIST("nPhotons_vs_sin2Ch6"), sin2changle, hmpid.nPhotons()); + } + + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) + histos.fill(HIST("hmpidPhotsCharge6"), hmpid.photonsCharge()[i]); + } + } + + // plot per HV sector + if (fParam->inHVSector(hmpid.yMip()) == hv0) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH6_HV0"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH6_HV0"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH6_HV0"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv1) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH6_HV1"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH6_HV1"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH6_HV1"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv2) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH6_HV2"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH6_HV2"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH6_HV2"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv3) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH6_HV3"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH6_HV3"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH6_HV3"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv4) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH6_HV4"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH6_HV4"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH6_HV4"), hmpid.nPhotons()); + } + } + + if (fParam->inHVSector(hmpid.yMip()) == hv5) { + if (distanceCondition) { + histos.fill(HIST("hmpidQMip_RICH6_HV5"), hmpid.chargeMip()); + } + if (distanceCondition && mipChargeCondition && physicalChAngle) { + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + if (hmpid.photonsCharge()[i] > 0) { + histos.fill(HIST("hmpidPhotsCharge_RICH6_HV5"), hmpid.photonsCharge()[i]); + } + } + histos.fill(HIST("hmpidNPhotons_RICH6_HV5"), hmpid.nPhotons()); + } + } + + ////////////////////////////////////////////////////////////////// + // fill plot photocathode + if (distanceCondition && mipChargeCondition && physicalChAngle) // condizione da verificare a priori + { + if (hmpid.xMip() >= xMinPc[0] && hmpid.xMip() <= xMaxPc[0] && hmpid.yMip() >= yMinPc[0] && hmpid.yMip() <= yMaxPc[0]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH6_PC0"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[1] && hmpid.xMip() <= xMaxPc[1] && hmpid.yMip() >= yMinPc[1] && hmpid.yMip() <= yMaxPc[1]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH6_PC1"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[2] && hmpid.xMip() <= xMaxPc[2] && hmpid.yMip() >= yMinPc[2] && hmpid.yMip() <= yMaxPc[2]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH6_PC2"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[3] && hmpid.xMip() <= xMaxPc[3] && hmpid.yMip() >= yMinPc[3] && hmpid.yMip() <= yMaxPc[3]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH6_PC3"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[4] && hmpid.xMip() <= xMaxPc[4] && hmpid.yMip() >= yMinPc[4] && hmpid.yMip() <= yMaxPc[4]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH6_PC4"), sin2changle, hmpid.nPhotons()); + } + + if (hmpid.xMip() >= xMinPc[5] && hmpid.xMip() <= xMaxPc[5] && hmpid.yMip() >= yMinPc[5] && hmpid.yMip() <= yMaxPc[5]) { + histos.fill(HIST("nPhotons_vs_sin2Ch_RICH6_PC5"), sin2changle, hmpid.nPhotons()); + } + } + } + + double probsHMP[3]; + + getProbability(hmpid.chAngle(), std::fabs(hmpid.momentumHmpid()), probsHMP); + + if (distanceMipToTrack > maxDistanceForProb || hmpid.chargeMip() < cutQmip) + continue; + + histos.fill(HIST("hmpidCkovvsMom_nocut"), std::fabs(hmpid.momentumHmpid()), hmpid.chAngle()); + + if (probsHMP[0] < minProbParticle && probsHMP[1] < minProbParticle && probsHMP[2] < minProbParticle) + continue; + // if(hmpid.momentumTrack()<0.75 && hmpid.nPhotons()<7 && hmpid.chAngle()<0.52) continue; + + histos.fill(HIST("hmpidCkovvsMom"), std::fabs(hmpid.momentumHmpid()), hmpid.chAngle()); + + } // close loop on tracks + + } // close process +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfg) { return WorkflowSpec{adaptAnalysisTask(cfg)}; } diff --git a/DPG/Tasks/AOTTrack/PID/HMPID/hmpidTableProducer.cxx b/DPG/Tasks/AOTTrack/PID/HMPID/hmpidTableProducer.cxx new file mode 100644 index 00000000000..88150b6873f --- /dev/null +++ b/DPG/Tasks/AOTTrack/PID/HMPID/hmpidTableProducer.cxx @@ -0,0 +1,135 @@ +// 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. + +#include "tableHMPID.h" + +#include "Common/Core/PID/PIDTOF.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/TableProducer/PID/pidTOFBase.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CcdbApi.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::constants::physics; + +struct HmpidTableProducer { + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + const AxisSpec axisEvtCounter{1, 0, +1, ""}; + + // CCDB configurable + Service ccdb; + struct : ConfigurableGroup { + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "URL of the CCDB repository"}; + } ccdbConfig; + + Produces hmpidAnalysis; + + // using TrackCandidates = soa::Join; + + using CollisionCandidates = o2::soa::Join; + + using TrackCandidates = soa::Join; + + // using CentralityClass = o2::soa::Join; + + void init(o2::framework::InitContext&) + { + // Configure CCDB + ccdb->setURL(ccdbConfig.ccdbUrl); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + + histos.add("eventCounter", "eventCounter", kTH1F, {axisEvtCounter}); + } + + // function to manage ccdb + int mCCDBRunNumber = 0; + void initCCDB(aod::BCsWithTimestamps::iterator const& bc) + { + if (mCCDBRunNumber == bc.runNumber()) { + return; + } + mCCDBRunNumber = bc.runNumber(); + } + + void process(soa::Join::iterator const& col, + const aod::HMPIDs& hmpids, + TrackCandidates const&, + aod::BCsWithTimestamps const&) + { + histos.fill(HIST("eventCounter"), 0.5); + + initCCDB(col.bc_as()); + + for (const auto& t : hmpids) { + + // global tracks associated to hmpid tracks + const auto& globalTrack = t.track_as(); + if (!globalTrack.isGlobalTrack()) + continue; + if (!globalTrack.hasITS() || !globalTrack.hasTPC() || !globalTrack.hasTOF()) + continue; + + // verify accessible collision + if (!globalTrack.has_collision()) { + continue; + } + + float hmpidPhotsCharge2[o2::aod::kDimPhotonsCharge]; + + for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { + hmpidPhotsCharge2[i] = t.hmpidPhotsCharge()[i]; + } + + float centrality = col.centFV0A(); + + /////FILL TABLE + hmpidAnalysis( + t.hmpidSignal(), globalTrack.phi(), globalTrack.eta(), t.hmpidMom(), + globalTrack.p(), t.hmpidXTrack(), t.hmpidYTrack(), t.hmpidXMip(), + t.hmpidYMip(), t.hmpidNPhotons(), t.hmpidQMip(), (t.hmpidClusSize() % 1000000) / 1000, + t.hmpidClusSize() / 1000000, hmpidPhotsCharge2, globalTrack.eta(), globalTrack.phi(), + globalTrack.px(), globalTrack.py(), globalTrack.pz(), globalTrack.itsNCls(), + globalTrack.tpcNClsFound(), globalTrack.tpcNClsCrossedRows(), globalTrack.tpcChi2NCl(), globalTrack.itsChi2NCl(), + globalTrack.dcaXY(), globalTrack.dcaZ(), globalTrack.tpcNSigmaPi(), globalTrack.tofNSigmaPi(), + globalTrack.tpcNSigmaKa(), globalTrack.tofNSigmaKa(), globalTrack.tpcNSigmaPr(), globalTrack.tofNSigmaPr(), + globalTrack.tpcNSigmaDe(), globalTrack.tofNSigmaDe(), centrality); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfg) { return WorkflowSpec{adaptAnalysisTask(cfg)}; } diff --git a/DPG/Tasks/AOTTrack/PID/HMPID/qaHMPID.cxx b/DPG/Tasks/AOTTrack/PID/HMPID/qaHMPID.cxx deleted file mode 100644 index a4e01d6a980..00000000000 --- a/DPG/Tasks/AOTTrack/PID/HMPID/qaHMPID.cxx +++ /dev/null @@ -1,311 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -// O2 includes -#include "ReconstructionDataFormats/Track.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/RunningWorkflowInfo.h" -#include "ReconstructionDataFormats/TrackParametrization.h" -#include "Common/DataModel/PIDResponse.h" -#include "Common/Core/PID/PIDTOF.h" -#include "Common/TableProducer/PID/pidTOFBase.h" -#include "ReconstructionDataFormats/PID.h" -#include "Common/Core/trackUtilities.h" -#include "ReconstructionDataFormats/DCA.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/ASoA.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; - -namespace o2::aod -{ - -namespace variables_table // declaration of columns to create -{ -DECLARE_SOA_COLUMN(ChAngle, chAngle, float); -DECLARE_SOA_COLUMN(Phi, phi, float); -DECLARE_SOA_COLUMN(Eta, eta, float); -DECLARE_SOA_COLUMN(MomHMPID, momMPID, float); -DECLARE_SOA_COLUMN(MomTrackX, momTrackX, float); -DECLARE_SOA_COLUMN(MomTrackY, momTrackY, float); -DECLARE_SOA_COLUMN(MomTrackZ, momTrackZ, float); -DECLARE_SOA_COLUMN(Xtrack, xtrack, float); -DECLARE_SOA_COLUMN(Ytrack, ytrack, float); -DECLARE_SOA_COLUMN(Xmip, xmip, float); -DECLARE_SOA_COLUMN(Ymip, ymip, float); -DECLARE_SOA_COLUMN(Nphotons, nphotons, float); -DECLARE_SOA_COLUMN(ChargeMIP, chargeMIP, float); -DECLARE_SOA_COLUMN(ClusterSize, clustersize, float); -DECLARE_SOA_COLUMN(Chamber, chamber, float); -DECLARE_SOA_COLUMN(Photons_charge, photons_charge, float[10]); - -DECLARE_SOA_COLUMN(EtaTrack, etatrack, float); -DECLARE_SOA_COLUMN(PhiTrack, phitrack, float); - -DECLARE_SOA_COLUMN(ITSNcluster, itsNcluster, float); -DECLARE_SOA_COLUMN(TPCNcluster, tpcNcluster, float); -DECLARE_SOA_COLUMN(TPCNClsCrossedRows, tpcNClsCrossedRows, float); -DECLARE_SOA_COLUMN(TPCchi2, tpcChi2, float); -DECLARE_SOA_COLUMN(ITSchi2, itsChi2, float); - -DECLARE_SOA_COLUMN(DCAxy, dcaxy, float); -DECLARE_SOA_COLUMN(DCAz, dcaz, float); - -} // namespace variables_table - -DECLARE_SOA_TABLE(HMPID_analysis, "AOD", "HMPIDANALYSIS", - variables_table::ChAngle, variables_table::Phi, variables_table::Eta, variables_table::MomHMPID, - variables_table::MomTrackX, variables_table::MomTrackY, variables_table::MomTrackZ, - variables_table::Xtrack, variables_table::Ytrack, variables_table::Xmip, - variables_table::Ymip, variables_table::Nphotons, variables_table::ChargeMIP, variables_table::ClusterSize, - variables_table::Chamber, variables_table::Photons_charge, variables_table::EtaTrack, variables_table::PhiTrack, - variables_table::ITSNcluster, variables_table::TPCNcluster, variables_table::TPCNClsCrossedRows, - variables_table::TPCchi2, variables_table::ITSchi2, variables_table::DCAxy, variables_table::DCAz); -} // namespace o2::aod - -struct pidHmpidQa { - - Produces HMPID_analysis; - - HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - Configurable nBinsP{"nBinsP", 500, "Number of momentum bins"}; - Configurable minP{"minP", 0.01f, "Minimum momentum plotted (GeV/c)"}; - Configurable maxP{"maxP", 10.f, "Maximum momentum plotted (GeV/c)"}; - Configurable maxDCA{"maxDCA", 3.f, "Maximum DCA xy use for the plot (cm)"}; - Configurable maxDistance{"maxDistance", 5.f, "Maximum HMPID distance between the track and the cluster (cm)"}; - Configurable minCharge{"minCharge", 120.f, "Minimum HMPID charge collected in the cluster"}; - - void init(o2::framework::InitContext&) - { - AxisSpec momAxis{nBinsP, minP, maxP}; - - histos.add("hmpidSignal", "hmpidSignal", kTH1F, {{1000, 0, 1}}); - histos.add("hmpidMomvsTrackMom", "hmpidMomvsTrackMom", kTH2F, {{1200, 0, 30, "Track #it{p} (GeV/#it{c})"}, {1200, 0, 30, "HMP #it{p} (GeV/#it{c})"}}); - histos.add("PhivsEta", "PhivsEta", kTH2F, {{550, -0.55, 0.55, "#eta"}, {550, 0, 1.1, "#phi (rad)"}}); - histos.add("hmpidCkovvsMom", "hmpidCkovvsMom", kTH2F, {{500, 0, 10, "#it{p} (GeV/#it{c})"}, {1000, 0, 1, "Cherenkov angle (rad)"}}); - histos.add("hmpidXTrack", "hmpidXTrack", kTH1F, {{280, 0, 140, "X track (cm)"}}); - histos.add("hmpidYTrack", "hmpidYTrack", kTH1F, {{280, 0, 140, "Y track (cm)"}}); - histos.add("hmpidXMip", "hmpidXMip", kTH1F, {{280, 0, 140, "X mip (cm)"}}); - histos.add("hmpidYMip", "hmpidYMip", kTH1F, {{280, 0, 140, "X mip (cm)"}}); - histos.add("hmpidXResiduals", "hmpidXResiduals", kTH1F, {{400, -20, 20, "X Residuals (cm)"}}); - histos.add("hmpidYResiduals", "hmpidYResiduals", kTH1F, {{400, -20, 20, "Y Residuals (cm)"}}); - histos.add("hmpidNPhotons", "hmpidNPhotons", kTH1F, {{50, 0, 50, "Number of photons"}}); - histos.add("hmpidQMip", "hmpidQMip", kTH1F, {{2000, 200, 2200, "Charge (ADCD)"}}); - histos.add("hmpidClusSize", "hmpidClusSize", kTH1F, {{15, 0, 15, "MIP Cluster size"}}); - histos.add("TrackMom", "TrackMom", kTH1F, {{1200, -30, 30, "#it{p} (GeV/#it{c})"}}); - histos.add("hmpidMom", "hmpidMom", kTH1F, {{1200, -30, 30, "#it{p} (GeV/#it{c})"}}); - histos.add("hmpidPhotsCharge", "hmpidPhotsCharge", kTH1F, {{300, 0, 300}}); - for (int iCh = 0; iCh < 7; iCh++) { - histos.add(Form("hmpidXTrack%i", iCh), Form("hmpidXTrack%i", iCh), kTH1F, {{280, 0, 140, "X track (cm)"}}); - histos.add(Form("hmpidYTrack%i", iCh), Form("hmpidYTrack%i", iCh), kTH1F, {{280, 0, 140, "Y track (cm)"}}); - histos.add(Form("hmpidXMip%i", iCh), Form("hmpidXMip%i", iCh), kTH1F, {{280, 0, 140, "X mip (cm)"}}); - histos.add(Form("hmpidYMip%i", iCh), Form("hmpidYMip%i", iCh), kTH1F, {{280, 0, 140, "X mip (cm)"}}); - histos.add(Form("hmpidXResiduals%i", iCh), Form("hmpidXResiduals%i", iCh), kTH1F, {{400, -20, 20, "X Residuals (cm)"}}); - histos.add(Form("hmpidYResiduals%i", iCh), Form("hmpidYResiduals%i", iCh), kTH1F, {{400, -20, 20, "Y Residuals (cm)"}}); - histos.add(Form("hmpidNPhotons%i", iCh), Form("hmpidNPhotons%i", iCh), kTH1F, {{50, 0, 50, "Number of photons"}}); - histos.add(Form("hmpidQMip%i", iCh), Form("hmpidQMip%i", iCh), kTH1F, {{2000, 200, 2200, "Charge (ADCD)"}}); - histos.add(Form("hmpidClusSize%i", iCh), Form("hmpidClusSize%i", iCh), kTH1F, {{15, 0, 15, "MIP Cluster size"}}); - histos.add(Form("TrackMom%i", iCh), Form("TrackMom%i", iCh), kTH1F, {{1200, -30, 30, "#it{p} (GeV/#it{c})"}}); - histos.add(Form("hmpidMom%i", iCh), Form("hmpidMom%i", iCh), kTH1F, {{1200, -30, 30, "#it{p} (GeV/#it{c})"}}); - histos.add(Form("hmpidPhotsCharge%i", iCh), Form("hmpidPhotsCharge%i", iCh), kTH1F, {{300, 0, 300}}); - } - } - - using TrackCandidates = soa::Join; - - void process(const aod::HMPIDs& hmpids, - const TrackCandidates& /*tracks*/, - const aod::Collisions& /*colls*/) - - { - - for (const auto& t : hmpids) { - if (t.track_as().isGlobalTrack() != (uint8_t) true) { - continue; - } - - const auto& track = t.track_as(); - - if (!track.hasITS() || !track.hasTPC() || !track.hasTOF()) { - continue; - } - - float hmpidPhotsCharge2[10]; - - for (int i = 0; i < 10; i++) { - hmpidPhotsCharge2[i] = t.hmpidPhotsCharge()[i]; - } - - HMPID_analysis(t.hmpidSignal(), t.track_as().phi(), t.track_as().eta(), t.hmpidMom(), - track.px(), track.py(), track.pz(), t.hmpidXTrack(), t.hmpidYTrack(), t.hmpidXMip(), - t.hmpidYMip(), t.hmpidNPhotons(), t.hmpidQMip(), (t.hmpidClusSize() % 1000000) / 1000, t.hmpidClusSize() / 1000000, - hmpidPhotsCharge2, track.eta(), track.phi(), track.itsNCls(), track.tpcNClsFound(), track.tpcNClsCrossedRows(), - track.tpcChi2NCl(), track.itsChi2NCl(), track.dcaXY(), track.dcaZ()); - - histos.fill(HIST("hmpidSignal"), t.hmpidSignal()); - histos.fill(HIST("PhivsEta"), t.track_as().eta(), t.track_as().phi()); - histos.fill(HIST("hmpidMomvsTrackMom"), t.track_as().p(), std::abs(t.hmpidMom())); - histos.fill(HIST("hmpidCkovvsMom"), std::abs(t.hmpidMom()), t.hmpidSignal()); - histos.fill(HIST("hmpidXTrack"), t.hmpidXTrack()); - histos.fill(HIST("hmpidYTrack"), t.hmpidYTrack()); - histos.fill(HIST("hmpidXMip"), t.hmpidXMip()); - histos.fill(HIST("hmpidYMip"), t.hmpidYMip()); - if (t.track_as().p() > 1.5) { - histos.fill(HIST("hmpidXResiduals"), t.hmpidXMip() - t.hmpidXTrack()); - histos.fill(HIST("hmpidYResiduals"), t.hmpidYMip() - t.hmpidYTrack()); - } - histos.fill(HIST("hmpidNPhotons"), t.hmpidNPhotons()); - histos.fill(HIST("hmpidQMip"), t.hmpidQMip()); - histos.fill(HIST("hmpidClusSize"), (t.hmpidClusSize() % 1000000) / 1000); - histos.fill(HIST("TrackMom"), t.track_as().p()); - histos.fill(HIST("hmpidMom"), std::abs(t.hmpidMom())); - for (int i = 0; i < 10; i++) { - if (t.hmpidPhotsCharge()[i] > 0) - histos.fill(HIST("hmpidPhotsCharge"), t.hmpidPhotsCharge()[i]); - } - - if (t.hmpidClusSize() / 1000000 == 0) { - histos.fill(HIST("hmpidXTrack0"), t.hmpidXTrack()); - histos.fill(HIST("hmpidYTrack0"), t.hmpidYTrack()); - histos.fill(HIST("hmpidXMip0"), t.hmpidXMip()); - histos.fill(HIST("hmpidYMip0"), t.hmpidYMip()); - histos.fill(HIST("hmpidXResiduals0"), t.hmpidXMip() - t.hmpidXTrack()); - histos.fill(HIST("hmpidYResiduals0"), t.hmpidYMip() - t.hmpidYTrack()); - histos.fill(HIST("hmpidNPhotons0"), t.hmpidNPhotons()); - histos.fill(HIST("hmpidQMip0"), t.hmpidQMip()); - histos.fill(HIST("hmpidClusSize0"), (t.hmpidClusSize() % 1000000) / 1000); - histos.fill(HIST("TrackMom0"), t.track_as().p()); - histos.fill(HIST("hmpidMom0"), std::abs(t.hmpidMom())); - for (int i = 0; i < 10; i++) { - if (t.hmpidPhotsCharge()[i] > 0) - histos.fill(HIST("hmpidPhotsCharge0"), t.hmpidPhotsCharge()[i]); - } - } - - if (t.hmpidClusSize() / 1000000 == 1) { - histos.fill(HIST("hmpidXTrack1"), t.hmpidXTrack()); - histos.fill(HIST("hmpidYTrack1"), t.hmpidYTrack()); - histos.fill(HIST("hmpidXMip1"), t.hmpidXMip()); - histos.fill(HIST("hmpidYMip1"), t.hmpidYMip()); - histos.fill(HIST("hmpidXResiduals1"), t.hmpidXMip() - t.hmpidXTrack()); - histos.fill(HIST("hmpidYResiduals1"), t.hmpidYMip() - t.hmpidYTrack()); - histos.fill(HIST("hmpidNPhotons1"), t.hmpidNPhotons()); - histos.fill(HIST("hmpidQMip1"), t.hmpidQMip()); - histos.fill(HIST("hmpidClusSize1"), (t.hmpidClusSize() % 1000000) / 1000); - histos.fill(HIST("TrackMom1"), t.track_as().p()); - histos.fill(HIST("hmpidMom1"), std::abs(t.hmpidMom())); - for (int i = 0; i < 10; i++) { - if (t.hmpidPhotsCharge()[i] > 0) - histos.fill(HIST("hmpidPhotsCharge1"), t.hmpidPhotsCharge()[i]); - } - } - - if (t.hmpidClusSize() / 1000000 == 2) { - histos.fill(HIST("hmpidXTrack2"), t.hmpidXTrack()); - histos.fill(HIST("hmpidYTrack2"), t.hmpidYTrack()); - histos.fill(HIST("hmpidXMip2"), t.hmpidXMip()); - histos.fill(HIST("hmpidYMip2"), t.hmpidYMip()); - histos.fill(HIST("hmpidXResiduals2"), t.hmpidXMip() - t.hmpidXTrack()); - histos.fill(HIST("hmpidYResiduals2"), t.hmpidYMip() - t.hmpidYTrack()); - histos.fill(HIST("hmpidNPhotons2"), t.hmpidNPhotons()); - histos.fill(HIST("hmpidQMip2"), t.hmpidQMip()); - histos.fill(HIST("hmpidClusSize2"), (t.hmpidClusSize() % 1000000) / 1000); - histos.fill(HIST("TrackMom2"), t.track_as().p()); - histos.fill(HIST("hmpidMom2"), std::abs(t.hmpidMom())); - for (int i = 0; i < 10; i++) { - if (t.hmpidPhotsCharge()[i] > 0) - histos.fill(HIST("hmpidPhotsCharge2"), t.hmpidPhotsCharge()[i]); - } - } - - if (t.hmpidClusSize() / 1000000 == 3) { - histos.fill(HIST("hmpidXTrack3"), t.hmpidXTrack()); - histos.fill(HIST("hmpidYTrack3"), t.hmpidYTrack()); - histos.fill(HIST("hmpidXMip3"), t.hmpidXMip()); - histos.fill(HIST("hmpidYMip3"), t.hmpidYMip()); - histos.fill(HIST("hmpidXResiduals3"), t.hmpidXMip() - t.hmpidXTrack()); - histos.fill(HIST("hmpidYResiduals3"), t.hmpidYMip() - t.hmpidYTrack()); - histos.fill(HIST("hmpidNPhotons3"), t.hmpidNPhotons()); - histos.fill(HIST("hmpidQMip3"), t.hmpidQMip()); - histos.fill(HIST("hmpidClusSize3"), (t.hmpidClusSize() % 1000000) / 1000); - histos.fill(HIST("TrackMom3"), t.track_as().p()); - histos.fill(HIST("hmpidMom3"), std::abs(t.hmpidMom())); - for (int i = 0; i < 10; i++) { - if (t.hmpidPhotsCharge()[i] > 0) - histos.fill(HIST("hmpidPhotsCharge3"), t.hmpidPhotsCharge()[i]); - } - } - - if (t.hmpidClusSize() / 1000000 == 4) { - histos.fill(HIST("hmpidXTrack4"), t.hmpidXTrack()); - histos.fill(HIST("hmpidYTrack4"), t.hmpidYTrack()); - histos.fill(HIST("hmpidXMip4"), t.hmpidXMip()); - histos.fill(HIST("hmpidYMip4"), t.hmpidYMip()); - histos.fill(HIST("hmpidXResiduals4"), t.hmpidXMip() - t.hmpidXTrack()); - histos.fill(HIST("hmpidYResiduals4"), t.hmpidYMip() - t.hmpidYTrack()); - histos.fill(HIST("hmpidNPhotons4"), t.hmpidNPhotons()); - histos.fill(HIST("hmpidQMip4"), t.hmpidQMip()); - histos.fill(HIST("hmpidClusSize4"), (t.hmpidClusSize() % 1000000) / 1000); - histos.fill(HIST("TrackMom4"), t.track_as().p()); - histos.fill(HIST("hmpidMom4"), std::abs(t.hmpidMom())); - for (int i = 0; i < 10; i++) { - if (t.hmpidPhotsCharge()[i] > 0) - histos.fill(HIST("hmpidPhotsCharge4"), t.hmpidPhotsCharge()[i]); - } - } - - if (t.hmpidClusSize() / 1000000 == 5) { - histos.fill(HIST("hmpidXTrack5"), t.hmpidXTrack()); - histos.fill(HIST("hmpidYTrack5"), t.hmpidYTrack()); - histos.fill(HIST("hmpidXMip5"), t.hmpidXMip()); - histos.fill(HIST("hmpidYMip5"), t.hmpidYMip()); - histos.fill(HIST("hmpidXResiduals5"), t.hmpidXMip() - t.hmpidXTrack()); - histos.fill(HIST("hmpidYResiduals5"), t.hmpidYMip() - t.hmpidYTrack()); - histos.fill(HIST("hmpidNPhotons5"), t.hmpidNPhotons()); - histos.fill(HIST("hmpidQMip5"), t.hmpidQMip()); - histos.fill(HIST("hmpidClusSize5"), (t.hmpidClusSize() % 1000000) / 1000); - histos.fill(HIST("TrackMom5"), t.track_as().p()); - histos.fill(HIST("hmpidMom5"), std::abs(t.hmpidMom())); - for (int i = 0; i < 10; i++) { - if (t.hmpidPhotsCharge()[i] > 0) - histos.fill(HIST("hmpidPhotsCharge5"), t.hmpidPhotsCharge()[i]); - } - } - - if (t.hmpidClusSize() / 1000000 == 6) { - histos.fill(HIST("hmpidXTrack6"), t.hmpidXTrack()); - histos.fill(HIST("hmpidYTrack6"), t.hmpidYTrack()); - histos.fill(HIST("hmpidXMip6"), t.hmpidXMip()); - histos.fill(HIST("hmpidYMip6"), t.hmpidYMip()); - histos.fill(HIST("hmpidXResiduals6"), t.hmpidXMip() - t.hmpidXTrack()); - histos.fill(HIST("hmpidYResiduals6"), t.hmpidYMip() - t.hmpidYTrack()); - histos.fill(HIST("hmpidNPhotons6"), t.hmpidNPhotons()); - histos.fill(HIST("hmpidQMip6"), t.hmpidQMip()); - histos.fill(HIST("hmpidClusSize6"), (t.hmpidClusSize() % 1000000) / 1000); - histos.fill(HIST("TrackMom6"), t.track_as().p()); - histos.fill(HIST("hmpidMom6"), std::abs(t.hmpidMom())); - for (int i = 0; i < 10; i++) { - if (t.hmpidPhotsCharge()[i] > 0) - histos.fill(HIST("hmpidPhotsCharge6"), t.hmpidPhotsCharge()[i]); - } - } - } - } -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfg) { return WorkflowSpec{adaptAnalysisTask(cfg)}; } diff --git a/DPG/Tasks/AOTTrack/PID/HMPID/tableHMPID.h b/DPG/Tasks/AOTTrack/PID/HMPID/tableHMPID.h new file mode 100644 index 00000000000..045282d3e0e --- /dev/null +++ b/DPG/Tasks/AOTTrack/PID/HMPID/tableHMPID.h @@ -0,0 +1,107 @@ +// 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. + +#ifndef DPG_TASKS_AOTTRACK_PID_HMPID_TABLEHMPID_H_ +#define DPG_TASKS_AOTTRACK_PID_HMPID_TABLEHMPID_H_ + +#include "Framework/ASoA.h" +#include "Framework/AnalysisDataModel.h" + +namespace o2::aod +{ + +inline constexpr int kDimPhotonsCharge = 10; + +namespace variables_table +{ +DECLARE_SOA_COLUMN(ChAngle, chAngle, float); +DECLARE_SOA_COLUMN(Phi, phi, float); +DECLARE_SOA_COLUMN(Eta, eta, float); +DECLARE_SOA_COLUMN(MomentumHmpid, momentumHmpid, float); +DECLARE_SOA_COLUMN(MomentumTrack, momentumTrack, float); +DECLARE_SOA_COLUMN(XTrack, xTrack, float); +DECLARE_SOA_COLUMN(YTrack, yTrack, float); +DECLARE_SOA_COLUMN(XMip, xMip, float); +DECLARE_SOA_COLUMN(YMip, yMip, float); +DECLARE_SOA_COLUMN(NPhotons, nPhotons, float); +DECLARE_SOA_COLUMN(ChargeMip, chargeMip, float); +DECLARE_SOA_COLUMN(ClusterSize, clusterSize, float); +DECLARE_SOA_COLUMN(Chamber, chamber, float); +DECLARE_SOA_COLUMN(PhotonsCharge, photonsCharge, float[kDimPhotonsCharge]); + +DECLARE_SOA_COLUMN(EtaTrack, etaTrack, float); +DECLARE_SOA_COLUMN(PhiTrack, phiTrack, float); +DECLARE_SOA_COLUMN(Px, px, float); +DECLARE_SOA_COLUMN(Py, py, float); +DECLARE_SOA_COLUMN(Pz, pz, float); + +DECLARE_SOA_COLUMN(ItsNCluster, itsNCluster, float); +DECLARE_SOA_COLUMN(TpcNCluster, tpcNCluster, float); +DECLARE_SOA_COLUMN(TpcNClsCrossedRows, tpcNClsCrossedRows, float); +DECLARE_SOA_COLUMN(TpcChi2, tpcChi2, float); +DECLARE_SOA_COLUMN(ItsChi2, itsChi2, float); + +DECLARE_SOA_COLUMN(DcaXY, dcaXY, float); +DECLARE_SOA_COLUMN(DcaZ, dcaZ, float); + +DECLARE_SOA_COLUMN(TpcNSigmaPi, tpcNSigmaPi, float); +DECLARE_SOA_COLUMN(TofNSigmaPi, tofNSigmaPi, float); +DECLARE_SOA_COLUMN(TpcNSigmaKa, tpcNSigmaKa, float); +DECLARE_SOA_COLUMN(TofNSigmaKa, tofNSigmaKa, float); +DECLARE_SOA_COLUMN(TpcNSigmaPr, tpcNSigmaPr, float); +DECLARE_SOA_COLUMN(TofNSigmaPr, tofNSigmaPr, float); +DECLARE_SOA_COLUMN(TpcNSigmaDe, tpcNSigmaDe, float); +DECLARE_SOA_COLUMN(TofNSigmaDe, tofNSigmaDe, float); + +DECLARE_SOA_COLUMN(Centrality, centrality, float); + +} // namespace variables_table + +DECLARE_SOA_TABLE(HmpidAnalysis, "AOD", "HMPIDANALYSIS", + variables_table::ChAngle, + variables_table::Phi, + variables_table::Eta, + variables_table::MomentumHmpid, + variables_table::MomentumTrack, + variables_table::XTrack, + variables_table::YTrack, + variables_table::XMip, + variables_table::YMip, + variables_table::NPhotons, + variables_table::ChargeMip, + variables_table::ClusterSize, + variables_table::Chamber, + variables_table::PhotonsCharge, + variables_table::EtaTrack, + variables_table::PhiTrack, + variables_table::Px, + variables_table::Py, + variables_table::Pz, + variables_table::ItsNCluster, + variables_table::TpcNCluster, + variables_table::TpcNClsCrossedRows, + variables_table::TpcChi2, + variables_table::ItsChi2, + variables_table::DcaXY, + variables_table::DcaZ, + variables_table::TpcNSigmaPi, + variables_table::TofNSigmaPi, + variables_table::TpcNSigmaKa, + variables_table::TofNSigmaKa, + variables_table::TpcNSigmaPr, + variables_table::TofNSigmaPr, + variables_table::TpcNSigmaDe, + variables_table::TofNSigmaDe, + variables_table::Centrality); + +} // namespace o2::aod + +#endif // DPG_TASKS_AOTTRACK_PID_HMPID_TABLEHMPID_H_ From a1b6d313b59d7be84dc7afe9428e9ed4497ae5f6 Mon Sep 17 00:00:00 2001 From: Francesca Ercolessi Date: Sat, 1 Nov 2025 12:17:24 +0100 Subject: [PATCH 984/986] [PWGLF] Strangeness in jets add centrality in MC (#13628) --- PWGLF/Tasks/Strangeness/strangenessInJets.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/strangenessInJets.cxx b/PWGLF/Tasks/Strangeness/strangenessInJets.cxx index 4ae80aa2d8f..057ed5a2638 100644 --- a/PWGLF/Tasks/Strangeness/strangenessInJets.cxx +++ b/PWGLF/Tasks/Strangeness/strangenessInJets.cxx @@ -24,6 +24,7 @@ #include "PWGJE/DataModel/Jet.h" #include "PWGJE/DataModel/JetReducedData.h" #include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/mcCentrality.h" #include "Common/Core/RecoDecay.h" #include "Common/Core/trackUtilities.h" @@ -74,7 +75,7 @@ using std::array; // Define convenient aliases for joined AOD tables using SelCollisions = soa::Join; -using SimCollisions = soa::Join; +using SimCollisions = soa::Join; using DaughterTracks = soa::Join; @@ -1157,7 +1158,7 @@ struct StrangenessInJets { Preslice perCollisionTrk = o2::aod::track::collisionId; // Generated MC events - void processMCgenerated(aod::McCollisions const& collisions, aod::McParticles const& mcParticles) + void processMCgenerated(soa::Join const& collisions, aod::McParticles const& mcParticles) { // Define per-event particle containers std::vector fjParticles; @@ -1190,7 +1191,7 @@ struct StrangenessInJets { registryMC.fill(HIST("number_of_events_mc_gen"), 2.5); // Multiplicity of generated event - double genMultiplicity = 0.0; + double genMultiplicity = collision.centFT0M(); // MC particles per collision auto mcParticlesPerColl = mcParticles.sliceBy(perMCCollision, collision.globalIndex()); From 8f5d7dcd8c5f520e89fce45b0d53ae56baf0de50 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sat, 1 Nov 2025 21:56:23 +0800 Subject: [PATCH 985/986] [Common] ZDC task for exploring light ions (#13629) Co-authored-by: David Dobrigkeit Chinellato --- Common/DataModel/CMakeLists.txt | 1 + Common/DataModel/ZDCLightIons.h | 97 +++++++ Common/TableProducer/CMakeLists.txt | 5 + Common/TableProducer/zdcTaskLightIons.cxx | 337 ++++++++++++++++++++++ 4 files changed, 440 insertions(+) create mode 100644 Common/DataModel/ZDCLightIons.h create mode 100644 Common/TableProducer/zdcTaskLightIons.cxx diff --git a/Common/DataModel/CMakeLists.txt b/Common/DataModel/CMakeLists.txt index f3a9d1d2259..dc9001e61ff 100644 --- a/Common/DataModel/CMakeLists.txt +++ b/Common/DataModel/CMakeLists.txt @@ -27,5 +27,6 @@ o2physics_add_header_only_library(DataModel MatchMFTFT0.h MftmchMatchingML.h ZDCExtra.h + ZDCLightIons.h EseTable.h FwdTrackReAlignTables.h) diff --git a/Common/DataModel/ZDCLightIons.h b/Common/DataModel/ZDCLightIons.h new file mode 100644 index 00000000000..b2faa13ba9d --- /dev/null +++ b/Common/DataModel/ZDCLightIons.h @@ -0,0 +1,97 @@ +// 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 ZDCLightIons.h +/// \brief ZDC data model for O-O Ne-Ne and p-O collisions +/// \author Chiara Oppedisano + +#ifndef PWGMM_DATAMODEL_ZDCLIGHTIONS_H_ +#define PWGMM_DATAMODEL_ZDCLIGHTIONS_H_ + +#include "Common/DataModel/Centrality.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" + +namespace o2::aod +{ +namespace zdclightions +{ +DECLARE_SOA_COLUMN(ZnaTdc, znaTdc, float); //! TDC ZNA +DECLARE_SOA_COLUMN(ZnaAmpl, znaAmpl, float); //! amplitude ZNA +DECLARE_SOA_COLUMN(ZnaPmc, znaPmc, float); //! ADC PmC ZNA +DECLARE_SOA_COLUMN(ZnaPm1, znaPm1, float); //! ADC PmQ1 ZNA +DECLARE_SOA_COLUMN(ZnaPm2, znaPm2, float); //! ADC PmQ2 ZNA +DECLARE_SOA_COLUMN(ZnaPm3, znaPm3, float); //! ADC PmQ3 ZNA +DECLARE_SOA_COLUMN(ZnaPm4, znaPm4, float); //! ADC PmQ4 ZNA +DECLARE_SOA_COLUMN(ZncTdc, zncTdc, float); //! TDC ZNC +DECLARE_SOA_COLUMN(ZncAmpl, zncAmpl, float); //! amplitude ZNC +DECLARE_SOA_COLUMN(ZncPmc, zncPmc, float); //! ADC PmC ZNC +DECLARE_SOA_COLUMN(ZncPm1, zncPm1, float); //! ADC PmQ1 ZNC +DECLARE_SOA_COLUMN(ZncPm2, zncPm2, float); //! ADC PmQ2 ZNC +DECLARE_SOA_COLUMN(ZncPm3, zncPm3, float); //! ADC PmQ3 ZNC +DECLARE_SOA_COLUMN(ZncPm4, zncPm4, float); //! ADC PmQ4 ZNC +DECLARE_SOA_COLUMN(ZpaTdc, zpaTdc, float); //! TDC ZPA +DECLARE_SOA_COLUMN(ZpaAmpl, zpaAmpl, float); //! amplitude ZPA +DECLARE_SOA_COLUMN(ZpaPmc, zpaPmc, float); //! ADC PmC ZPA +DECLARE_SOA_COLUMN(ZpcTdc, zpcTdc, float); //! TDC ZPC +DECLARE_SOA_COLUMN(ZpcAmpl, zpcAmpl, float); //! amplitude ZPA +DECLARE_SOA_COLUMN(ZpcPmc, zpcPmc, float); //! ADC PmC ZPA +DECLARE_SOA_COLUMN(Zem1Tdc, zem1Tdc, float); //! TDC ZEM1 +DECLARE_SOA_COLUMN(Zem1Ampl, zem1Ampl, float); //! amplitude ZEM1 +DECLARE_SOA_COLUMN(Zem2Tdc, zem2Tdc, float); //! TDC ZEM2 +DECLARE_SOA_COLUMN(Zem2Ampl, zem2Ampl, float); //! amplitude ZEM2 +DECLARE_SOA_COLUMN(MultFt0a, multFt0a, float); //! mult. FIT-A +DECLARE_SOA_COLUMN(MultFt0c, multFt0c, float); //! mult. FIT-C +DECLARE_SOA_COLUMN(MultV0a, multV0a, float); //! mult. V0-A +DECLARE_SOA_COLUMN(VertexZ, vertexZ, float); //! Z vertex +DECLARE_SOA_COLUMN(CentralityFt0c, centralityFt0c, float); //! Centrality +DECLARE_SOA_COLUMN(CentralityFt0a, centralityFt0a, float); //! Centrality +DECLARE_SOA_COLUMN(CentralityFt0m, centralityFt0m, float); //! Centrality +DECLARE_SOA_COLUMN(Timestamp, timestamp, uint64_t); //! Timestamp +DECLARE_SOA_COLUMN(SelectionBits, selectionBits, uint8_t); //! Selection Flags +} // namespace zdclightions + +DECLARE_SOA_TABLE(ZDCLightIons, "AOD", "ZDCTABLELIGHTIONS", + zdclightions::ZnaTdc, + zdclightions::ZnaAmpl, + zdclightions::ZnaPmc, + zdclightions::ZnaPm1, + zdclightions::ZnaPm2, + zdclightions::ZnaPm3, + zdclightions::ZnaPm4, + zdclightions::ZncTdc, + zdclightions::ZncAmpl, + zdclightions::ZncPmc, + zdclightions::ZncPm1, + zdclightions::ZncPm2, + zdclightions::ZncPm3, + zdclightions::ZncPm4, + zdclightions::ZpaTdc, + zdclightions::ZpaAmpl, + zdclightions::ZpcTdc, + zdclightions::ZpcAmpl, + zdclightions::Zem1Tdc, + zdclightions::Zem1Ampl, + zdclightions::Zem2Tdc, + zdclightions::Zem2Ampl, + zdclightions::MultFt0a, + zdclightions::MultFt0c, + zdclightions::MultV0a, + zdclightions::VertexZ, + zdclightions::CentralityFt0c, + zdclightions::CentralityFt0a, + zdclightions::CentralityFt0m, + zdclightions::Timestamp, + zdclightions::SelectionBits); +} // namespace o2::aod + +#endif // COMMON_DATAMODEL_ZDCLIGHTIONS_H_ diff --git a/Common/TableProducer/CMakeLists.txt b/Common/TableProducer/CMakeLists.txt index 5f0d91132a0..2282a06b5e7 100644 --- a/Common/TableProducer/CMakeLists.txt +++ b/Common/TableProducer/CMakeLists.txt @@ -182,3 +182,8 @@ o2physics_add_dpl_workflow(selectionstudytable SOURCES selectionStudyTable.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(zdc-task-light-ions + SOURCES zdcTaskLightIons.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/Common/TableProducer/zdcTaskLightIons.cxx b/Common/TableProducer/zdcTaskLightIons.cxx new file mode 100644 index 00000000000..1cd6cccf3c2 --- /dev/null +++ b/Common/TableProducer/zdcTaskLightIons.cxx @@ -0,0 +1,337 @@ +// 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 zdcTaskLightIons.cxx +/// \brief Task for ZDC in light ions +/// \author chiara.oppedisano@cern.ch + +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/CCDB/TriggerAliases.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/ZDCLightIons.h" + +#include +#include +#include +#include + +#include + +using namespace o2; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::aod::evsel; + +using BCsRun3 = soa::Join; +using ColEvSels = soa::Join; + +struct ZdcTaskLightIons { + + Produces zdcTableLI; + + // Configurable parameters + Configurable nBinsTiming{"nBinsTiming", 200, "n bins for debunching histo"}; + Configurable tdcCut{"tdcCut", true, "Flag for TDC cut"}; + Configurable tdcZNmincut{"tdcZNmincut", -2.5, "Min. ZN TDC cut value"}; + Configurable tdcZNmaxcut{"tdcZNmaxcut", 2.5, "Max. ZN TDC cut value"}; + // + // Event selections + Configurable cfgEvSelVtxZ{"cfgEvSelVtxZ", 10, "Event selection: zVtx"}; + Configurable cfgEvSelSel8{"cfgEvSelSel8", true, "Event selection: sel8"}; + Configurable cfgEvSelsDoOccupancySel{"cfgEvSelsDoOccupancySel", true, "Event selection: do occupancy selection"}; + Configurable cfgEvSelsMaxOccupancy{"cfgEvSelsMaxOccupancy", 10000, "Event selection: set max occupancy"}; + Configurable cfgEvSelsNoSameBunchPileupCut{"cfgEvSelsNoSameBunchPileupCut", true, "Event selection: no same bunch pileup cut"}; + Configurable cfgEvSelsIsGoodZvtxFT0vsPV{"cfgEvSelsIsGoodZvtxFT0vsPV", true, "Event selection: is good ZVTX FT0 vs PV"}; + Configurable cfgEvSelsNoCollInTimeRangeStandard{"cfgEvSelsNoCollInTimeRangeStandard", true, "Event selection: no collision in time range standard"}; + Configurable cfgEvSelsIsVertexITSTPC{"cfgEvSelsIsVertexITSTPC", true, "Event selection: is vertex ITSTPC"}; + Configurable cfgEvSelsIsGoodITSLayersAll{"cfgEvSelsIsGoodITSLayersAll", true, "Event selection: is good ITS layers all"}; + // + HistogramRegistry registry{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + enum SelectionCriteria { + evSel_zvtx, + evSel_sel8, + evSel_occupancy, + evSel_kNoSameBunchPileup, + evSel_kIsGoodZvtxFT0vsPV, + evSel_kNoCollInTimeRangeStandard, + evSel_kNoITSROFrameBorder, + evSel_kIsGoodITSLayersAll, + evSel_allEvents, + nEventSelections + }; + + void init(InitContext const&) + { + registry.add("zdcDebunchHist", "ZN sum vs. diff; ZNA-ZNC (ns); ZNA+ZNC (ns)", {HistType::kTH2D, {{nBinsTiming, -20., 20.}, {nBinsTiming, -20., 20.}}}); + + if (doprocessALICEcoll) { + registry.add("hEventCount", "Number of Event; Cut; #Events Passed Cut", {HistType::kTH1D, {{nEventSelections, 0, nEventSelections}}}); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_allEvents + 1, "All events"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_zvtx + 1, "vtxZ"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_sel8 + 1, "Sel8"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_occupancy + 1, "kOccupancy"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kNoSameBunchPileup + 1, "kNoSameBunchPileup"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodZvtxFT0vsPV + 1, "kIsGoodZvtxFT0vsPV"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kNoCollInTimeRangeStandard + 1, "kNoCollInTimeRangeStandard"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kNoITSROFrameBorder + 1, "kNoITSROFrameBorder"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodITSLayersAll + 1, "kkIsGoodITSLayersAll"); + } + } + + template + uint8_t eventSelected(TCollision collision) + { + uint8_t selectionBits = 0; + bool selected; + + registry.fill(HIST("hEventCount"), evSel_allEvents); + + selected = std::fabs(collision.posZ()) < cfgEvSelVtxZ; + if (selected) { + selectionBits |= (uint8_t)(0x1u << evSel_zvtx); + registry.fill(HIST("hEventCount"), evSel_zvtx); + } + + selected = collision.sel8(); + if (selected) { + selectionBits |= (uint8_t)(0x1u << evSel_sel8); + registry.fill(HIST("hEventCount"), evSel_sel8); + } + + auto occupancy = collision.trackOccupancyInTimeRange(); + selected = occupancy <= cfgEvSelsMaxOccupancy; + if (selected) { + selectionBits |= (uint8_t)(0x1u << evSel_occupancy); + registry.fill(HIST("hEventCount"), evSel_occupancy); + } + + selected = collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup); + if (selected) { + selectionBits |= (uint8_t)(0x1u << evSel_kNoSameBunchPileup); + registry.fill(HIST("hEventCount"), evSel_kNoSameBunchPileup); + } + + selected = collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV); + if (selected) { + selectionBits |= (uint8_t)(0x1u << evSel_kIsGoodZvtxFT0vsPV); + registry.fill(HIST("hEventCount"), evSel_kIsGoodZvtxFT0vsPV); + } + + selected = collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard); + if (selected) { + selectionBits |= (uint8_t)(0x1u << evSel_kNoCollInTimeRangeStandard); + registry.fill(HIST("hEventCount"), evSel_kNoCollInTimeRangeStandard); + } + + selected = collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder); + if (selected) { + selectionBits |= (uint8_t)(0x1u << evSel_kNoITSROFrameBorder); + registry.fill(HIST("hEventCount"), evSel_kNoITSROFrameBorder); + } + + selected = collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll); + if (selected) { + selectionBits |= (uint8_t)(0x1u << evSel_kIsGoodITSLayersAll); + registry.fill(HIST("hEventCount"), evSel_kIsGoodITSLayersAll); + } + + return selectionBits; + } + + void processZDCBC(BCsRun3 const& bcs, aod::Zdcs const& /*zdcs*/) + { + for (const auto& bc : bcs) { + if (bc.has_zdc()) { + + auto tdcZNA = bc.zdc().timeZNA(); + auto tdcZNC = bc.zdc().timeZNC(); + auto tdcZPA = bc.zdc().timeZPA(); + auto tdcZPC = bc.zdc().timeZPC(); + auto tdcZEM1 = bc.zdc().timeZEM1(); + auto tdcZEM2 = bc.zdc().timeZEM2(); + // + double zna = bc.zdc().amplitudeZNA(); + double znc = bc.zdc().amplitudeZNC(); + double zpa = bc.zdc().amplitudeZPA(); + double zpc = bc.zdc().amplitudeZPC(); + double zem1 = bc.zdc().amplitudeZEM1(); + double zem2 = bc.zdc().amplitudeZEM2(); + // + double pmcZNA = bc.zdc().energyCommonZNA(); + double pmcZNC = bc.zdc().energyCommonZNC(); + double pmqZNC[4] = { + 0, + 0, + 0, + 0, + }; + double pmqZNA[4] = { + 0, + 0, + 0, + 0, + }; + const int noofZNsectors = 4; + for (int itow = 0; itow < noofZNsectors; itow++) { + pmqZNA[itow] = (bc.zdc().energySectorZNA())[itow]; + pmqZNC[itow] = (bc.zdc().energySectorZNC())[itow]; + } + + bool isZNChit = false, isZNAhit = false; + if (tdcCut) { // a narrow TDC window is set + if ((tdcZNC >= tdcZNmincut) && (tdcZNC <= tdcZNmaxcut)) { + isZNChit = true; + } + if ((tdcZNA >= tdcZNmincut) && (tdcZNA <= tdcZNmaxcut)) { + isZNAhit = true; + } + } else { // if no window on TDC is set + if (pmcZNC > 0.) { + isZNChit = true; + } + if (pmcZNA > 0.) { + isZNAhit = true; + } + } + if (isZNChit && isZNAhit) { + registry.get(HIST("debunchHist"))->Fill(zna - znc, zna + znc); + } + + zdcTableLI(tdcZNA, zna, pmcZNA, pmqZNA[0], pmqZNA[1], pmqZNA[2], pmqZNA[3], + tdcZNC, znc, pmcZNC, pmqZNC[0], pmqZNC[1], pmqZNC[2], pmqZNC[3], + tdcZPA, zpa, tdcZPC, zpc, tdcZEM1, zem1, tdcZEM2, zem2, + -1, -1, -1, + -1., + -1, -1, -1, + bc.timestamp(), + -1); + } + } + } + /// name, description, function pointer, default value + /// note that it has to be declared after the function, so that the pointer is known + PROCESS_SWITCH(ZdcTaskLightIons, processZDCBC, "Processing ZDC 4 auto-triggered events", true); + + void processALICEcoll(ColEvSels const& cols, BCsRun3 const& /*bcs*/, aod::Zdcs const& /*zdcs*/) + { + // collision-based event selection + for (auto const& collision : cols) { + + const auto& foundBC = collision.foundBC_as(); + uint8_t evSelection = eventSelected(collision); + auto zv = collision.posZ(); + auto centralityFT0C = collision.centFT0C(); + auto centralityFT0A = collision.centFT0A(); + auto centralityFT0M = collision.centFT0M(); + + // FT0 + float multFT0A = 0.; + float multFT0C = 0.; + if (foundBC.has_ft0()) { + for (auto const& amplitude : foundBC.ft0().amplitudeA()) { + multFT0A += amplitude; + } + for (auto const& amplitude : foundBC.ft0().amplitudeC()) { + multFT0C += amplitude; + } + } + // FV0 + float multV0A = 0; + if (foundBC.has_fv0a()) { + for (auto const& amplitude : foundBC.fv0a().amplitude()) { + multV0A += amplitude; + } + } + + if (foundBC.has_zdc()) { + const auto& zdc = foundBC.zdc(); + + auto tdcZNA = zdc.timeZNA(); + auto tdcZNC = zdc.timeZNC(); + auto tdcZPA = zdc.timeZPA(); + auto tdcZPC = zdc.timeZPC(); + auto tdcZEM1 = zdc.timeZEM1(); + auto tdcZEM2 = zdc.timeZEM2(); + // + double zna = zdc.amplitudeZNA(); + double znc = zdc.amplitudeZNC(); + double zpa = zdc.amplitudeZPA(); + double zpc = zdc.amplitudeZPC(); + double zem1 = zdc.amplitudeZEM1(); + double zem2 = zdc.amplitudeZEM2(); + // + double pmcZNA = zdc.energyCommonZNA(); + double pmcZNC = zdc.energyCommonZNC(); + double pmqZNC[4] = { + 0, + 0, + 0, + 0, + }; + double pmqZNA[4] = { + 0, + 0, + 0, + 0, + }; + const int noofZNsectors = 4; + for (int itow = 0; itow < noofZNsectors; itow++) { + pmqZNA[itow] = (zdc.energySectorZNA())[itow]; + pmqZNC[itow] = (zdc.energySectorZNC())[itow]; + } + + bool isZNChit = false, isZNAhit = false; + if (tdcCut) { // a narrow TDC window is set + if ((tdcZNC >= tdcZNmincut) && (tdcZNC <= tdcZNmaxcut)) { + isZNChit = true; + } + if ((tdcZNA >= tdcZNmincut) && (tdcZNA <= tdcZNmaxcut)) { + isZNAhit = true; + } + } else { // if no window on TDC is set + if (pmcZNC > 0.) { + isZNChit = true; + } + if (pmcZNA > 0.) { + isZNAhit = true; + } + } + if (isZNChit && isZNAhit) { + registry.get(HIST("debunchHist"))->Fill(zna - znc, zna + znc); + } + + zdcTableLI(tdcZNA, zna, pmcZNA, pmqZNA[0], pmqZNA[1], pmqZNA[2], pmqZNA[3], + tdcZNC, znc, pmcZNC, pmqZNC[0], pmqZNC[1], pmqZNC[2], pmqZNC[3], + tdcZPA, zpa, tdcZPC, zpc, tdcZEM1, zem1, tdcZEM2, zem2, + multFT0A, multFT0C, multV0A, + zv, + centralityFT0C, centralityFT0A, centralityFT0M, + foundBC.timestamp(), + evSelection); + } + } + } + /// name, description, function pointer, default value + /// note that it has to be declared after the function, so that the pointer is known + PROCESS_SWITCH(ZdcTaskLightIons, processALICEcoll, "Processing ZDC for ALICE collisions", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) // o2-linter: disable=name/file-cpp +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} From 263019c7284d0a9a6ed39e3e1d78754ac128c84e Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Sat, 1 Nov 2025 23:43:17 +0100 Subject: [PATCH 986/986] "Add kT dependent closed-pair rejection cut" --- ...irTaskTrackTrackSpherHarMultKtExtended.cxx | 1911 +++++++---------- 1 file changed, 764 insertions(+), 1147 deletions(-) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx index 35b8c394693..aa57c5b4755 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx @@ -9,1306 +9,923 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx -/// \brief Tasks that reads the track tables used for the pairing and builds pairs of two tracks and compute relative pair-momentum in three dimesnions -/// \remark This file is inherited from ~/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx on 17/06/2024 -/// \author Pritam Chakraborty, WUT Warsaw, pritam.chakraborty@pw.edu.pl - -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniversePairCleaner.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniversePairSHCentMultKt.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseSHContainer.h" +/// \file FemtoUniverseDetaDphiStar.h +/// \brief FemtoUniverseDetaDphiStar - Checks particles for the close pair rejection. +/// \author Laura Serksnyte, TU München, laura.serksnyte@tum.de +/// \author Zuzanna Chochulska, WUT Warsaw & CTU Prague, zchochul@cern.ch +/// \author Pritam Chakraborty, WUT Warsaw, pritam.chakraborty@cern.ch +/// \author Shirajum Monira, WUT Warsaw, shirajum.monira@cern.ch + +#ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEDETADPHISTAR_H_ +#define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEDETADPHISTAR_H_ + +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseAngularContainer.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseContainer.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseFemtoContainer.h" #include "PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h" -#include "PWGCF/FemtoUniverse/Core/femtoUtils.h" #include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" -#include "Common/DataModel/PIDResponse.h" - -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/StepTHn.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/PID.h" -#include "TRandom2.h" +#include "TMath.h" +#include #include #include -using namespace o2; -using namespace o2::analysis::femto_universe; -using namespace o2::framework; -using namespace o2::framework::expressions; -using namespace o2::soa; +namespace o2::analysis +{ +namespace femto_universe +{ -namespace +/// \class FemtoUniverseDetaDphiStar +/// \brief Class to check particles for the close pair rejection. +/// \tparam partOne Type of particle 1 (Track/V0/Cascade/...) +/// \tparam partTwo Type of particle 2 (Track/V0/Cascade/...) +template +class FemtoUniverseDetaDphiStar { -static constexpr int nPart = 2; -static constexpr int nCuts = 5; -static const std::vector partNames{"PartOne", "PartTwo"}; -static const std::vector cutNames{"MaxPt", "PIDthr", "nSigmaTPC", "nSigmaTPCTOF", "MaxP"}; -static const float cutsTable[nPart][nCuts]{ - {4.05f, 1.f, 3.f, 3.f, 100.f}, - {4.05f, 1.f, 3.f, 3.f, 100.f}}; -} // namespace - -struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { - - Service pdg; - - /// Particle selection part - - /// Table for both particles - struct : o2::framework::ConfigurableGroup { - Configurable ConfNsigmaCombined{"ConfNsigmaCombined", 3.0f, "TPC and TOF Pion Sigma (combined) for momentum > ConfTOFPtMin"}; - Configurable ConfNsigmaTPC{"ConfNsigmaTPC", 3.0f, "TPC Pion Sigma for momentum < ConfTOFPtMin"}; - Configurable ConfIsElReject{"ConfIsElReject", false, "Is electron rejection activated"}; - Configurable ConfNsigmaTPCElRejectMin{"ConfNsigmaTPCElRejectMin", 2.0f, "TPC Electron SigmaMin for momentum < ConfTOFPtMin"}; - Configurable ConfNsigmaTPCElRejectMax{"ConfNsigmaTPCElRejectMax", 2.0f, "TPC Electron SigmaMax for momentum < ConfTOFPtMin"}; - Configurable ConfTOFPtMin{"ConfTOFPtMin", 0.5f, "Min. Pt for which TOF is required for PID."}; - Configurable ConfEtaMax{"ConfEtaMax", 0.8f, "Higher limit for |Eta| (the same for both particles)"}; - - Configurable> ConfCutTable{"ConfCutTable", {cutsTable[0], nPart, nCuts, partNames, cutNames}, "Particle selections"}; - Configurable ConfNspecies{"ConfNspecies", 2, "Number of particle spieces with PID info"}; - Configurable ConfIsMC{"ConfIsMC", false, "Enable additional Histogramms in the case of a MonteCarlo Run"}; - Configurable> ConfTrkPIDnSigmaMax{"ConfTrkPIDnSigmaMax", std::vector{4.f, 3.f, 2.f}, "This configurable needs to be the same as the one used in the producer task"}; - Configurable ConfUse3D{"ConfUse3D", false, "Enable three dimensional histogramms (to be used only for analysis with high statistics): k* vs mT vs multiplicity"}; - Configurable ConfPhiBins{"ConfPhiBins", 29, "Number of phi bins in deta dphi"}; - Configurable ConfEtaBins{"ConfEtaBins", 29, "Number of eta bins in deta dphi"}; - Configurable ConfIsCPR{"ConfIsCPR", true, "Close Pair Rejection"}; - Configurable ConfCPRPlotPerRadii{"ConfCPRPlotPerRadii", false, "Plot CPR per radii"}; - Configurable ConfCPRdeltaPhiCutMax{"ConfCPRdeltaPhiCutMax", 0.0, "Delta Phi max cut for Close Pair Rejection"}; - Configurable ConfCPRdeltaPhiCutMin{"ConfCPRdeltaPhiCutMin", 0.0, "Delta Phi min cut for Close Pair Rejection"}; - Configurable ConfCPRdeltaEtaCutMax{"ConfCPRdeltaEtaCutMax", 0.0, "Delta Eta max cut for Close Pair Rejection"}; - Configurable ConfCPRdeltaEtaCutMin{"ConfCPRdeltaEtaCutMin", 0.0, "Delta Eta min cut for Close Pair Rejection"}; - Configurable ConfCPRChosenRadii{"ConfCPRChosenRadii", 0.80, "Delta Eta cut for Close Pair Rejection"}; - Configurable confUseCCImCut{"confUseCCImCut", false, "Fill SH within specific quadrants of qout-qside"}; - Configurable confUse1stand3rd{"confUse1stand3rd", false, "Use first and third quadrants of qout-qside"}; - Configurable confUse2ndand4th{"confUse2ndand4th", false, "Use second and fourth quadrants of qout-qside"}; - } twotracksconfigs; - - using FemtoFullParticles = soa::Join; - // Filters for selecting particles (both p1 and p2) - Filter trackAdditionalfilter = (nabs(aod::femtouniverseparticle::eta) < twotracksconfigs.ConfEtaMax); // example filtering on configurable - using FilteredFemtoFullParticles = soa::Filtered; - // using FilteredFemtoFullParticles = FemtoFullParticles; //if no filtering is applied uncomment this option - using FemtoRecoParticles = soa::Join; - using FilteredFemtoRecoParticles = soa::Filtered; - - SliceCache cache; - Preslice perCol = aod::femtouniverseparticle::fdCollisionId; - - using FemtoTruthParticles = soa::Join; - Preslice perColMCTruth = aod::femtouniverseparticle::fdCollisionId; - - /// Particle 1 - struct : o2::framework::ConfigurableGroup { - Configurable ConfPDGCodePartOne{"ConfPDGCodePartOne", 211, "Particle 1 - PDG code"}; - // Configurable ConfCutPartOne{"ConfCutPartOne", 5542474, "Particle 1 - Selection bit from cutCulator"}; - Configurable ConfPIDPartOne{"ConfPIDPartOne", 2, "Particle 1 - Read from cutCulator"}; // we also need the possibility to specify whether the bit is true/false ->std>>vector>int>> - Configurable ConfPtLowPart1{"ConfPtLowPart1", 0.14, "Lower limit for Pt for the first particle"}; - Configurable ConfPtHighPart1{"ConfPtHighPart1", 1.5, "Higher limit for Pt for the first particle"}; - Configurable ConfChargePart1{"ConfChargePart1", 1, "Particle 1 sign"}; - } trackonefilter; - - /// Partition for particle 1 - Partition partsOne = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && aod::femtouniverseparticle::sign == as(trackonefilter.ConfChargePart1) && aod::femtouniverseparticle::pt < trackonefilter.ConfPtHighPart1 && aod::femtouniverseparticle::pt > trackonefilter.ConfPtLowPart1; - Partition partsOneMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && aod::femtouniverseparticle::sign == as(trackonefilter.ConfChargePart1) && aod::femtouniverseparticle::pt < trackonefilter.ConfPtHighPart1 && aod::femtouniverseparticle::pt > trackonefilter.ConfPtLowPart1; - Partition partsOneMCTruth = aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack); - - // - - /// Histogramming for particle 1 - FemtoUniverseParticleHisto trackHistoPartOne; - - /// Particle 2 - struct : o2::framework::ConfigurableGroup { - Configurable ConfPDGCodePartTwo{"ConfPDGCodePartTwo", 211, "Particle 2 - PDG code"}; - // Configurable ConfCutPartTwo{"ConfCutPartTwo", 5542474, "Particle 2 - Selection bit"}; - Configurable ConfPIDPartTwo{"ConfPIDPartTwo", 2, "Particle 2 - Read from cutCulator"}; // we also need the possibility to specify whether the bit is true/false ->std>>vector> - - Configurable ConfPtLowPart2{"ConfPtLowPart2", 0.14, "Lower limit for Pt for the second particle"}; - Configurable ConfPtHighPart2{"ConfPtHighPart2", 1.5, "Higher limit for Pt for the second particle"}; - Configurable ConfChargePart2{"ConfChargePart2", -1, "Particle 2 sign"}; - } tracktwofilter; - - /// Partition for particle 2 - Partition partsTwo = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == as(tracktwofilter.ConfChargePart2)) && aod::femtouniverseparticle::pt < tracktwofilter.ConfPtHighPart2 && aod::femtouniverseparticle::pt > tracktwofilter.ConfPtLowPart2; - Partition partsTwoMC = aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack) && (aod::femtouniverseparticle::sign == as(tracktwofilter.ConfChargePart2)) && aod::femtouniverseparticle::pt < tracktwofilter.ConfPtHighPart2 && aod::femtouniverseparticle::pt > tracktwofilter.ConfPtLowPart2; - Partition partsTwoMCTruth = aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack); - - /// Histogramming for particle 2 - FemtoUniverseParticleHisto trackHistoPartTwo; - - /// Histogramming for Event - FemtoUniverseEventHisto eventHisto; - - /// The configurables need to be passed to an std::vector - int vPIDPartOne, vPIDPartTwo; - std::vector kNsigma; - - /// Event part - Configurable ConfV0MLow{"ConfV0MLow", 0.0, "Lower limit for V0M multiplicity"}; - Configurable ConfV0MHigh{"ConfV0MHigh", 25000.0, "Upper limit for V0M multiplicity"}; - Configurable ConfTPCOccupancyLow{"ConfTPCOccupancyLow", 0, "Lower limit for TPC occupancy"}; - Configurable ConfTPCOccupancyHigh{"ConfTPCOccupancyHigh", 500, "Higher limit for TPC occupancy"}; - Configurable ConfIntRateLow{"ConfIntRateLow", 0.0, "Lower limit for interaction rate"}; - Configurable ConfIntRateHigh{"ConfIntRateHigh", 10000.0, "Higher limit for interaction rate"}; - Configurable ConfIsCent{"ConfIsCent", true, "Condition to choose centrality of multiplicity for mixing"}; - - Filter collfilterFDtable = (o2::aod::femtouniversecollision::multV0M > ConfV0MLow) && (o2::aod::femtouniversecollision::multV0M < ConfV0MHigh); - Filter collfilterFDExttable = (o2::aod::femtouniversecollision::interactionRate > ConfIntRateLow) && (o2::aod::femtouniversecollision::interactionRate < ConfIntRateHigh) && - (o2::aod::femtouniversecollision::occupancy >= ConfTPCOccupancyLow) && (o2::aod::femtouniversecollision::occupancy < ConfTPCOccupancyHigh); - using FilteredFDCollisions = soa::Filtered>; - using FilteredFDCollision = FilteredFDCollisions::iterator; - // Filter trackAdditionalfilter = (nabs(aod::femtouniverseparticle::eta) < twotracksconfigs.ConfEtaMax); // example filtering on configurable - - /// Particle part - ConfigurableAxis ConfTempFitVarBins{"ConfDTempFitVarBins", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot"}; - ConfigurableAxis ConfTempFitVarpTBins{"ConfTempFitVarpTBins", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot"}; - - /// Correlation part - ConfigurableAxis ConfMultBinsCent{"ConfMultBinsCent", {VARIABLE_WIDTH, 0.0f, 4.0f, 8.0f, 12.0f, 16.0f, 20.0f, 24.0f, 28.0f, 32.0f, 36.0f, 40.0f, 44.0f, 48.0f, 52.0f, 56.0f, 60.0f, 64.0f, 68.0f, 72.0f, 76.0f, 80.0f, 84.0f, 88.0f, 92.0f, 96.0f, 100.0f, 200.0f, 99999.f}, "Mixing bins - centrality"}; // \todo to be obtained from the hash task - ConfigurableAxis ConfMultBinsMult{"ConfMultBinsMult", {VARIABLE_WIDTH, 0.0f, 400.0f, 800.0f, 1200.0f, 1600.0f, 2000.0f, 2500.0f, 3000.0f, 3500.0f, 4000.0f, 4500.0f, 5000.0f, 6000.0f, 7000.0f, 8000.0f, 9000.0f, 10000.0f, 11000.0f, 12000.0f, 13000.0f, 14000.0f, 15000.0f, 16000.0f, 17000.0f, 18000.0f, 99999.f}, "Mixing bins - centrality"}; - ConfigurableAxis ConfMultKstarBins{"ConfMultKstarBins", {VARIABLE_WIDTH, 0.0f, 200.0f}, "Bins for kstar analysis in multiplicity or centrality bins (10 is maximum)"}; - ConfigurableAxis ConfKtKstarBins{"ConfKtKstarBins", {VARIABLE_WIDTH, 0.1f, 0.2f, 0.3f, 0.4f}, "Bins for kstar analysis in kT bins"}; - ConfigurableAxis ConfVtxBins{"ConfVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; - - ConfigurableAxis ConfmTBins3D{"ConfmTBins3D", {VARIABLE_WIDTH, 1.02f, 1.14f, 1.20f, 1.26f, 1.38f, 1.56f, 1.86f, 4.50f}, "mT Binning for the 3Dimensional plot: k* vs multiplicity vs mT (set <> to true in order to use)"}; - ConfigurableAxis ConfmultBins3D{"ConfmultBins3D", {VARIABLE_WIDTH, 0.0f, 20.0f, 30.0f, 40.0f, 99999.0f}, "multiplicity Binning for the 3Dimensional plot: k* vs multiplicity vs mT (set <> to true in order to use)"}; - - ColumnBinningPolicy colBinningCent{{ConfVtxBins, ConfMultBinsCent}, true}; - ColumnBinningPolicy colBinningNtr{{ConfVtxBins, ConfMultBinsMult}, true}; - - ConfigurableAxis ConfkstarBins{"ConfkstarBins", {60, 0.0, 0.3}, "binning kstar"}; - ConfigurableAxis ConfkTBins{"ConfkTBins", {150, 0., 9.}, "binning kT"}; - ConfigurableAxis ConfmTBins{"ConfmTBins", {225, 0., 7.5}, "binning mT"}; - Configurable ConfIsIden{"ConfIsIden", true, "Choosing identical or non-identical pairs"}; - Configurable ConfIsLCMS{"ConfIsLCMS", true, "Choosing LCMS or PRF"}; - Configurable ConfNEventsMix{"ConfNEventsMix", 5, "Number of events for mixing"}; - Configurable ConfLMax{"ConfLMax", 2, "Maximum value of l"}; - Configurable cfgProcessPM{"cfgProcessPM", false, "Process particles of the opposite charge"}; - Configurable cfgProcessPP{"cfgProcessPP", true, "Process particles of the same, positice charge"}; - Configurable cfgProcessMM{"cfgProcessMM", true, "Process particles of the same, positice charge"}; - Configurable cfgProcessMultBins{"cfgProcessMultBins", true, "Process kstar histograms in multiplicity bins (in multiplicity bins)"}; - Configurable cfgProcessKtBins{"cfgProcessKtBins", true, "Process kstar histograms in kT bins (if cfgProcessMultBins is set false, this will not be processed regardless this Configurable state)"}; - Configurable cfgProcessKtMt3DCF{"cfgProcessKtMt3DCF", false, "Process 3D histograms in kT and Mult bins"}; - Configurable ConfIsFillAngqLCMS{"ConfIsFillAngqLCMS", true, "Fill qLCMS vs dEta vs dPhi"}; - Configurable confCPRDistMax{"confCPRDistMax", 0.0, "Max. radial seperation between two closed-pairs"}; - Configurable confCPRFracMax{"confCPRFracMax", 0.0, "Max. allowed fraction bad to all TPC points of radial seperation between two closed-pairs"}; - Configurable confCPRIsAtITS{"confCPRIsAtITS", false, "Close Pair Rejection at ITS or TPC"}; - Configurable confCPRDphiAvgOrDist{"confCPRDphiAvgOrDist", true, "Close Pair Rejection by radial or angular seperation"}; - Configurable confIsCircularCut{"confIsCircularCut", true, "Close Pair Rejection by circular cut"}; - - FemtoUniverseSHContainer sameEventCont; - FemtoUniverseSHContainer mixedEventCont; - - FemtoUniverseSHContainer sameEventContPP; - FemtoUniverseSHContainer mixedEventContPP; - - FemtoUniverseSHContainer sameEventContMM; - FemtoUniverseSHContainer mixedEventContMM; - - FemtoUniverseContainer sameEventCont1D; - - FemtoUniversePairCleaner pairCleaner; - FemtoUniverseDetaDphiStar pairCloseRejection; + public: FemtoUniverseTrackSelection trackCuts; - - PairSHCentMultKt sameEventMultCont; - PairSHCentMultKt mixedEventMultCont; - - PairSHCentMultKt sameEventMultContPP; - PairSHCentMultKt mixedEventMultContPP; - - PairSHCentMultKt sameEventMultContMM; - PairSHCentMultKt mixedEventMultContMM; - - float mass1 = -1; - float mass2 = -1; - - /// Histogram output - HistogramRegistry qaRegistry{"TrackQA", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry resultRegistry{"Correlations", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry resultRegistry1D{"Correlations1D", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry resultRegistryPM{"CorrelationsPM", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry resultRegistryPP{"CorrelationsPP", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry resultRegistryMM{"CorrelationsMM", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry MixQaRegistry{"MixQaRegistry", {}, OutputObjHandlingPolicy::AnalysisObject}; - - HistogramRegistry SameMultRegistryPM{"SameMultRegistryPM", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry MixedMultRegistryPM{"MixedMultRegistryPM", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - - HistogramRegistry SameMultRegistryPP{"SameMultRegistryPP", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry MixedMultRegistryPP{"MixedMultRegistryPP", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - - HistogramRegistry SameMultRegistryMM{"SameMultRegistryMM", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry MixedMultRegistryMM{"MixedMultRegistryMM", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - - TRandom2* randgen; - - // PID for protons - bool IsProtonNSigma(float mom, float nsigmaTPCPr, float nsigmaTOFPr) // previous version from: https://github.com/alisw/AliPhysics/blob/master/PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoMJTrackCut.cxx + /// Destructor + virtual ~FemtoUniverseDetaDphiStar() = default; + /// Initialization of the histograms and setting required values + void init(HistogramRegistry* registry, HistogramRegistry* registryQA, float ldeltaphistarcutmin, float ldeltaphistarcutmax, float ldeltaetacutmin, float ldeltaetacutmax, float lchosenradii, bool lplotForEveryRadii, float lPhiMassMin = 1.014, float lPhiMassMax = 1.026, bool lisSameSignCPR = false) { - //|nsigma_TPC| < 3 for p < 0.5 GeV/c - //|nsigma_combined| < 3 for p > 0.5 - - // using configurables: - // ConfTOFPtMin - momentum value when we start using TOF; set to 1000 if TOF not needed - // ConfNsigmaTPC -> TPC Sigma for momentum < 0.5 - // ConfNsigmaCombined -> TPC and TOF Sigma (combined) for momentum > 0.5 - - if (mom < twotracksconfigs.ConfTOFPtMin) { - if (std::abs(nsigmaTPCPr) < twotracksconfigs.ConfNsigmaTPC) { - return true; - } else { - return false; - } - } else { - if (std::hypot(nsigmaTOFPr, nsigmaTPCPr) < twotracksconfigs.ConfNsigmaCombined) { - return true; - } else { - return false; + chosenRadii = lchosenradii; + cutDeltaPhiStarMax = ldeltaphistarcutmax; + cutDeltaPhiStarMin = ldeltaphistarcutmin; + cutDeltaEtaMax = ldeltaetacutmax; + cutDeltaEtaMin = ldeltaetacutmin; + plotForEveryRadii = lplotForEveryRadii; + mHistogramRegistry = registry; + mHistogramRegistryQA = registryQA; + cutPhiInvMassLow = lPhiMassMin; + cutPhiInvMassHigh = lPhiMassMax; + isSameSignCPR = lisSameSignCPR; + + if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kTrack) { + std::string dirName = static_cast(DirNames[0]); + histdetadpisame[0][0] = mHistogramRegistry->add((dirName + static_cast(HistNamesSame[0][0])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpisame[0][1] = mHistogramRegistry->add((dirName + static_cast(HistNamesSame[1][0])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpimixed[0][0] = mHistogramRegistry->add((dirName + static_cast(HistNamesMixed[0][0])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpimixed[0][1] = mHistogramRegistry->add((dirName + static_cast(HistNamesMixed[1][0])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + + histdetadpiqlcmssame = mHistogramRegistry->add((dirName + static_cast(HistNamesSame[1][7])).c_str(), "; #it{q}_{LCMS}; #Delta #eta; #Delta #phi", kTH3F, {{100, 0.0, 0.5}, {100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpiqlcmsmixed = mHistogramRegistry->add((dirName + static_cast(HistNamesMixed[1][7])).c_str(), "; #it{q}_{LCMS}; #Delta #eta; #Delta #phi", kTH3F, {{100, 0.0, 0.5}, {100, -0.15, 0.15}, {100, -0.15, 0.15}}); + + if (plotForEveryRadii) { + for (int i = 0; i < 9; i++) { + histdetadpiRadii[0][i] = mHistogramRegistryQA->add((dirName + static_cast(HistNamesRadii[0][i])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + } } } - return false; - } - - bool IsKaonNSigma(float mom, float nsigmaTPCK, float nsigmaTOFK) - { - if (mom < 0.3) { // 0.0-0.3 - if (std::abs(nsigmaTPCK) < 3.0) { - return true; - } else { - return false; - } - } else if (mom < 0.45) { // 0.30 - 0.45 - if (std::abs(nsigmaTPCK) < 2.0) { - return true; - } else { - return false; + if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kV0) { + for (int i = 0; i < 2; i++) { + std::string dirName = static_cast(DirNames[1]); + histdetadpisame[i][0] = mHistogramRegistry->add((dirName + static_cast(HistNamesSame[0][i])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpisame[i][1] = mHistogramRegistry->add((dirName + static_cast(HistNamesSame[1][i])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpimixed[i][0] = mHistogramRegistry->add((dirName + static_cast(HistNamesMixed[0][i])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpimixed[i][1] = mHistogramRegistry->add((dirName + static_cast(HistNamesMixed[1][i])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + + if (plotForEveryRadii) { + for (int j = 0; j < 9; j++) { + histdetadpiRadii[i][j] = mHistogramRegistryQA->add((dirName + static_cast(HistNamesRadii[i][j])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + } + } } - } else if (mom < 0.55) { // 0.45-0.55 - if (std::abs(nsigmaTPCK) < 1.0) { - return true; - } else { - return false; + } + if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kV0 && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kV0) { + /// V0-V0 combination + for (int k = 0; k < 2; k++) { + std::string dirName = static_cast(DirNames[2]); + histdetadpisame[k][0] = mHistogramRegistry->add((dirName + static_cast(HistNamesSame[0][k])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpisame[k][1] = mHistogramRegistry->add((dirName + static_cast(HistNamesSame[1][k])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpimixed[k][0] = mHistogramRegistry->add((dirName + static_cast(HistNamesMixed[0][k])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpimixed[k][1] = mHistogramRegistry->add((dirName + static_cast(HistNamesMixed[1][k])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + if (plotForEveryRadii) { + for (int l = 0; l < 9; l++) { + histdetadpiRadii[k][l] = mHistogramRegistryQA->add((dirName + static_cast(HistNamesRadii[k][l])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + } + } } - } else if (mom < 1.5) { // 0.55-1.5 (now we use TPC and TOF) - if ((std::abs(nsigmaTOFK) < 3.0) && (std::abs(nsigmaTPCK) < 3.0)) { - { - return true; + } + if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kCascade && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kCascade) { + /// Cascade-Cascade combination + for (int k = 0; k < 7; k++) { + std::string dirName = static_cast(DirNames[5]); + histdetadpisame[k][0] = mHistogramRegistry->add((dirName + static_cast(HistNamesSame[0][k])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpisame[k][1] = mHistogramRegistry->add((dirName + static_cast(HistNamesSame[1][k])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpimixed[k][0] = mHistogramRegistry->add((dirName + static_cast(HistNamesMixed[0][k])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpimixed[k][1] = mHistogramRegistry->add((dirName + static_cast(HistNamesMixed[1][k])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + if (plotForEveryRadii) { + for (int l = 0; l < 9; l++) { + histdetadpiRadii[k][l] = mHistogramRegistryQA->add((dirName + static_cast(HistNamesRadii[k][l])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + } } - } else { - return false; } - } else if (mom > 1.5) { // 1.5 - - if ((std::abs(nsigmaTOFK) < 2.0) && (std::abs(nsigmaTPCK) < 3.0)) { - return true; - } else { - return false; + } + if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kCascade) { + /// Track-Cascade combination + for (int k = 0; k < 3; k++) { + std::string dirName = static_cast(DirNames[6]); + histdetadpisame[k][0] = mHistogramRegistry->add((dirName + static_cast(HistNamesSame[0][k])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpisame[k][1] = mHistogramRegistry->add((dirName + static_cast(HistNamesSame[1][k])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpimixed[k][0] = mHistogramRegistry->add((dirName + static_cast(HistNamesMixed[0][k])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpimixed[k][1] = mHistogramRegistry->add((dirName + static_cast(HistNamesMixed[1][k])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + if (plotForEveryRadii) { + for (int l = 0; l < 9; l++) { + histdetadpiRadii[k][l] = mHistogramRegistryQA->add((dirName + static_cast(HistNamesRadii[k][l])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + } + } } - } else { - return false; } - } - - bool IsPionNSigma(float mom, float nsigmaTPCPi, float nsigmaTOFPi, float nsigmaTPCElReject) - { - //|nsigma_TPC| < 3 for p < 0.5 GeV/c - //|nsigma_combined| < 3 for p > 0.5 - - // using configurables: - // ConfTOFPtMin - momentum value when we start using TOF; set to 1000 if TOF not needed - // ConfNsigmaTPC -> TPC Sigma for momentum < 0.5 - // ConfNsigmaCombined -> TPC and TOF Pion Sigma (combined) for momentum > 0.5 - if (true) { - if (mom < twotracksconfigs.ConfTOFPtMin) { - if (twotracksconfigs.ConfIsElReject) { - if ((std::abs(nsigmaTPCPi) < twotracksconfigs.ConfNsigmaTPC) && (nsigmaTPCElReject < twotracksconfigs.ConfNsigmaTPCElRejectMin || nsigmaTPCElReject > twotracksconfigs.ConfNsigmaTPCElRejectMax)) { - return true; - } else { - return false; + if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kV0 && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kCascade) { + /// V0-Cascade combination + for (int k = 0; k < 3; k++) { + std::string dirName = static_cast(DirNames[7]); + histdetadpisame[k][0] = mHistogramRegistry->add((dirName + static_cast(HistNamesSame[0][k])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpisame[k][1] = mHistogramRegistry->add((dirName + static_cast(HistNamesSame[1][k])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpimixed[k][0] = mHistogramRegistry->add((dirName + static_cast(HistNamesMixed[0][k])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpimixed[k][1] = mHistogramRegistry->add((dirName + static_cast(HistNamesMixed[1][k])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + if (plotForEveryRadii) { + for (int l = 0; l < 9; l++) { + histdetadpiRadii[k][l] = mHistogramRegistryQA->add((dirName + static_cast(HistNamesRadii[k][l])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); } - } else { - if ((std::abs(nsigmaTPCPi) < twotracksconfigs.ConfNsigmaTPC)) { - return true; - } else { - return false; + } + } + } + if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kPhi) { + for (int i = 0; i < 2; i++) { + std::string dirName = static_cast(DirNames[3]); + histdetadpisame[i][0] = mHistogramRegistry->add((dirName + static_cast(HistNamesSame[0][i])).c_str(), "; #Delta #eta; #Delta #varphi*", kTH2F, {{400, -0.30, 0.30}, {400, -0.30, 0.30}}); + histdetadpisame[i][1] = mHistogramRegistry->add((dirName + static_cast(HistNamesSame[1][i])).c_str(), "; #Delta #eta; #Delta #varphi*", kTH2F, {{400, -0.30, 0.30}, {400, -0.30, 0.30}}); + histdetadpimixed[i][0] = mHistogramRegistry->add((dirName + static_cast(HistNamesMixed[0][i])).c_str(), "; #Delta #eta; #Delta #varphi*", kTH2F, {{400, -0.30, 0.30}, {400, -0.30, 0.30}}); + histdetadpimixed[i][1] = mHistogramRegistry->add((dirName + static_cast(HistNamesMixed[1][i])).c_str(), "; #Delta #eta; #Delta #varphi*", kTH2F, {{400, -0.30, 0.30}, {400, -0.30, 0.30}}); + + if (plotForEveryRadii) { + for (int j = 0; j < 9; j++) { + histdetadpiRadii[i][j] = mHistogramRegistryQA->add((dirName + static_cast(HistNamesRadii[i][j])).c_str(), "; #Delta #eta; #Delta #varphi*", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); } } - } else { - if (std::hypot(nsigmaTOFPi, nsigmaTPCPi) < twotracksconfigs.ConfNsigmaCombined) { - return true; - } else { - return false; + } + } + if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kD0) { + for (int i = 0; i < 2; i++) { + std::string dirName = static_cast(DirNames[4]); + histdetadpisame[i][0] = mHistogramRegistry->add((dirName + static_cast(HistNamesSame[0][i])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpisame[i][1] = mHistogramRegistry->add((dirName + static_cast(HistNamesSame[1][i])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpimixed[i][0] = mHistogramRegistry->add((dirName + static_cast(HistNamesMixed[0][i])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpimixed[i][1] = mHistogramRegistry->add((dirName + static_cast(HistNamesMixed[1][i])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + + if (plotForEveryRadii) { + for (int j = 0; j < 9; j++) { + histdetadpiRadii[i][j] = mHistogramRegistryQA->add((dirName + static_cast(HistNamesRadii[i][j])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + } } } } - return false; } - bool IsParticleNSigma(int8_t particle_number, float mom, float nsigmaTPCPr, float nsigmaTOFPr, float nsigmaTPCPi, float nsigmaTOFPi, float nsigmaTPCK, float nsigmaTOFK, float nsigmaTPCElReject) + template + void init_kT(HistogramRegistry* registry, t1& ktbins, std::vector ldeltaphistarcutmin, std::vector ldeltaphistarcutmax, std::vector ldeltaetacutmin, std::vector ldeltaetacutmax) { - if (particle_number == 1) { - switch (trackonefilter.ConfPDGCodePartOne) { - case 2212: // Proton - case -2212: // Antiproton - return IsProtonNSigma(mom, nsigmaTPCPr, nsigmaTOFPr); - break; - case 211: // Pion+ - case -211: // Pion- - return IsPionNSigma(mom, nsigmaTPCPi, nsigmaTOFPi, nsigmaTPCElReject); - break; - case 321: // Kaon+ - case -321: // Kaon- - return IsKaonNSigma(mom, nsigmaTPCK, nsigmaTOFK); - break; - default: - return false; + mHistogramRegistry = registry; + ktBins = ktbins; + + cutDeltaPhiStarMaxVector = ldeltaphistarcutmax; + cutDeltaPhiStarMinVector = ldeltaphistarcutmin; + cutDeltaEtaMaxVector = ldeltaetacutmax; + cutDeltaEtaMinVector = ldeltaetacutmin; + + if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kTrack) { + std::string dirName = static_cast(DirNames[0]); + for (int j = 0; j < static_cast(ktBins.size() - 1); j++) { + std::string histSuffixkT1 = std::to_string(static_cast(ktBins[j] * 100.0)); + std::string histSuffixkT2 = std::to_string(static_cast(ktBins[j + 1] * 100.0)); + std::string histFolderkT = "kT_" + histSuffixkT1 + "_" + histSuffixkT2 + "/"; + histdetadphisamebeforekT[j] = mHistogramRegistry->add((dirName + histFolderkT + "detadphidetadphiBeforeSame").c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadphimixedbeforekT[j] = mHistogramRegistry->add((dirName + histFolderkT + "detadphidetadphiBeforeMixed").c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadphisameafterkT[j] = mHistogramRegistry->add((dirName + histFolderkT + "detadphidetadphiAfterSame").c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadphimixedafterkT[j] = mHistogramRegistry->add((dirName + histFolderkT + "detadphidetadphiAfterMixed").c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); } - return false; - } else if (particle_number == 2) { - switch (tracktwofilter.ConfPDGCodePartTwo) { - case 2212: // Proton - case -2212: // Antiproton - return IsProtonNSigma(mom, nsigmaTPCPr, nsigmaTOFPr); - break; - case 211: // Pion+ - case -211: // Pion- - return IsPionNSigma(mom, nsigmaTPCPi, nsigmaTOFPi, nsigmaTPCElReject); - break; - case 321: // Kaon+ - case -321: // Kaon- - return IsKaonNSigma(mom, nsigmaTPCK, nsigmaTOFK); - break; - default: - return false; - } - return false; - } else { - LOGF(fatal, "Wrong number of particle chosen! It should be 1 or 2. It is -> %d", particle_number); } - return false; } - void init(InitContext&) + /// Check if pair is close or not + template + bool isClosePair(Part const& part1, Part const& part2, Parts const& particles, float lmagfield, uint8_t ChosenEventType) { - eventHisto.init(&qaRegistry); - trackHistoPartOne.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarBins, twotracksconfigs.ConfIsMC, trackonefilter.ConfPDGCodePartOne, true); - - trackHistoPartTwo.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarBins, twotracksconfigs.ConfIsMC, tracktwofilter.ConfPDGCodePartTwo, true); - - MixQaRegistry.add("MixingQA/hSECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); - MixQaRegistry.add("MixingQA/hMECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); + magfield = lmagfield; - mass1 = pdg->Mass(trackonefilter.ConfPDGCodePartOne); - mass2 = pdg->Mass(tracktwofilter.ConfPDGCodePartTwo); - - if (cfgProcessPM) { - if (!cfgProcessKtMt3DCF) { - sameEventCont.init(&resultRegistryPM, ConfkstarBins, ConfLMax); - mixedEventCont.init(&resultRegistryPM, ConfkstarBins, ConfLMax); - sameEventCont.setPDGCodes(trackonefilter.ConfPDGCodePartOne, tracktwofilter.ConfPDGCodePartTwo); - mixedEventCont.setPDGCodes(trackonefilter.ConfPDGCodePartOne, tracktwofilter.ConfPDGCodePartTwo); - } else { - sameEventMultCont.init(&SameMultRegistryPM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, ConfLMax); - mixedEventMultCont.init(&MixedMultRegistryPM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, ConfLMax); + if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kTrack) { + /// Track-Track combination + // check if provided particles are in agreement with the class instantiation + if (part1.partType() != o2::aod::femtouniverseparticle::ParticleType::kTrack || part2.partType() != o2::aod::femtouniverseparticle::ParticleType::kTrack) { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar instantiation! Please provide kTrack,kTrack candidates."; + return false; } - } - - if (cfgProcessPP) { - if (!cfgProcessKtMt3DCF) { - sameEventContPP.init(&resultRegistryPP, ConfkstarBins, ConfLMax); - mixedEventContPP.init(&resultRegistryPP, ConfkstarBins, ConfLMax); - sameEventContPP.setPDGCodes(trackonefilter.ConfPDGCodePartOne, tracktwofilter.ConfPDGCodePartTwo); - mixedEventContPP.setPDGCodes(trackonefilter.ConfPDGCodePartOne, tracktwofilter.ConfPDGCodePartTwo); + auto deta = part1.eta() - part2.eta(); + auto dphiAvg = averagePhiStar(part1, part2, 0); + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[0][0]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[0][0]->Fill(deta, dphiAvg); } else { - sameEventMultContPP.init(&SameMultRegistryPP, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, ConfLMax); - mixedEventMultContPP.init(&MixedMultRegistryPP, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, ConfLMax); + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; } - sameEventCont1D.init(&resultRegistry1D, ConfkstarBins, ConfMultBinsCent, ConfkTBins, ConfmTBins, ConfmultBins3D, ConfmTBins3D, twotracksconfigs.ConfEtaBins, twotracksconfigs.ConfPhiBins, twotracksconfigs.ConfIsMC, twotracksconfigs.ConfUse3D); - sameEventCont1D.setPDGCodes(trackonefilter.ConfPDGCodePartOne, tracktwofilter.ConfPDGCodePartTwo); - } - if (cfgProcessMM) { - if (!cfgProcessKtMt3DCF) { - sameEventContMM.init(&resultRegistryMM, ConfkstarBins, ConfLMax); - mixedEventContMM.init(&resultRegistryMM, ConfkstarBins, ConfLMax); - sameEventContMM.setPDGCodes(trackonefilter.ConfPDGCodePartOne, tracktwofilter.ConfPDGCodePartTwo); - mixedEventContMM.setPDGCodes(trackonefilter.ConfPDGCodePartOne, tracktwofilter.ConfPDGCodePartTwo); + if (std::pow(dphiAvg, 2) / std::pow(cutDeltaPhiStarMax, 2) + std::pow(deta, 2) / std::pow(cutDeltaEtaMax, 2) < 1.) { + return true; } else { - sameEventMultContMM.init(&SameMultRegistryMM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, ConfLMax); - mixedEventMultContMM.init(&MixedMultRegistryMM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, ConfLMax); + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[0][1]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[0][1]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; + } + return false; } - sameEventCont1D.init(&resultRegistry1D, ConfkstarBins, ConfMultBinsCent, ConfkTBins, ConfmTBins, ConfmultBins3D, ConfmTBins3D, twotracksconfigs.ConfEtaBins, twotracksconfigs.ConfPhiBins, twotracksconfigs.ConfIsMC, twotracksconfigs.ConfUse3D); - sameEventCont1D.setPDGCodes(trackonefilter.ConfPDGCodePartOne, tracktwofilter.ConfPDGCodePartTwo); - } - - pairCleaner.init(&qaRegistry); - if (twotracksconfigs.ConfIsCPR.value) { - pairCloseRejection.init(&resultRegistry, &qaRegistry, twotracksconfigs.ConfCPRdeltaPhiCutMin.value, twotracksconfigs.ConfCPRdeltaPhiCutMax.value, twotracksconfigs.ConfCPRdeltaEtaCutMin.value, twotracksconfigs.ConfCPRdeltaEtaCutMax.value, twotracksconfigs.ConfCPRChosenRadii.value, twotracksconfigs.ConfCPRPlotPerRadii.value); - pairCloseRejection.init_kT(&resultRegistry, ConfKtKstarBins); - } - vPIDPartOne = trackonefilter.ConfPIDPartOne.value; - vPIDPartTwo = tracktwofilter.ConfPIDPartTwo.value; - kNsigma = twotracksconfigs.ConfTrkPIDnSigmaMax.value; - } - - template - void fillCollision(CollisionType col, bool IsCent) - { - if (IsCent) { - MixQaRegistry.fill(HIST("MixingQA/hSECollisionBins"), colBinningCent.getBin({col.posZ(), col.multV0M()})); - } else { - MixQaRegistry.fill(HIST("MixingQA/hSECollisionBins"), colBinningNtr.getBin({col.posZ(), col.multNtr()})); - } - eventHisto.fillQA(col); - } - - /// This function processes the same event and takes care of all the histogramming - /// \todo the trivial loops over the tracks should be factored out since they will be common to all combinations of T-T, T-V0, V0-V0, ... - /// @tparam PartitionType - /// @tparam PartType - /// @tparam isMC: enables Monte Carlo truth specific histograms - /// @param groupPartsOne partition for the first particle passed by the process function - /// @param groupPartsTwo partition for the second particle passed by the process function - /// @param parts femtoUniverseParticles table (in case of Monte Carlo joined with FemtoUniverseMCLabels) - /// @param magFieldTesla magnetic field of the collision - /// @param multCol multiplicity of the collision - template - void doSameEvent(PartitionType groupPartsOne, PartitionType groupPartsTwo, PartType parts, float magFieldTesla, int multCol, int ContType, bool fillQA) - { + } else if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kV0) { + /// Track-V0 combination + // check if provided particles are in agreement with the class instantiation + if (part1.partType() != o2::aod::femtouniverseparticle::ParticleType::kTrack || part2.partType() != o2::aod::femtouniverseparticle::ParticleType::kV0) { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar instantiation! Please provide kTrack,kV0 candidates."; + return false; + } - /// Histogramming same event - if ((ContType == 1 || ContType == 2) && fillQA) { - for (const auto& part : groupPartsOne) { - if (!IsParticleNSigma((int8_t)1, part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(part, o2::track::PID::Electron))) { - continue; + bool pass = false; + for (int i = 0; i < 2; i++) { + auto indexOfDaughter = (ChosenEventType == femto_universe_container::EventType::mixed ? part2.globalIndex() : part2.index()) - 2 + i; + auto daughter = particles.begin() + indexOfDaughter; + auto deta = part1.eta() - daughter.eta(); + auto dphiAvg = averagePhiStar(part1, *daughter, i); + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[i][0]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[i][0]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; } - trackHistoPartOne.fillQA(part); - trackHistoPartOne.fillQAMisIden(part, trackonefilter.ConfPDGCodePartOne); - } - } - if ((ContType == 1 || ContType == 3) && fillQA) { - for (const auto& part : groupPartsTwo) { - if (!IsParticleNSigma((int8_t)2, part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(part, o2::track::PID::Electron))) { - continue; + if (std::pow(dphiAvg, 2) / std::pow(cutDeltaPhiStarMax, 2) + std::pow(deta, 2) / std::pow(cutDeltaEtaMax, 2) < 1.) { + pass = true; + } else { + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[i][1]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[i][1]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; + } } - trackHistoPartTwo.fillQA(part); } - } + return pass; - if (ContType == 1) { + } else if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kV0 && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kV0) { + /// V0-V0 combination + if (part1.partType() != o2::aod::femtouniverseparticle::ParticleType::kV0 || part2.partType() != o2::aod::femtouniverseparticle::ParticleType::kV0) { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar instantiation! Please provide kV0,kV0 candidates."; + return false; + } - /// Now build the combinations for non-identical particle pairs - for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { + bool pass = false; + for (int i = 0; i < 2; i++) { + auto indexOfDaughterpart1 = (ChosenEventType == femto_universe_container::EventType::mixed ? part1.globalIndex() : part1.index()) - 2 + i; + auto indexOfDaughterpart2 = (ChosenEventType == femto_universe_container::EventType::mixed ? part2.globalIndex() : part2.index()) - 2 + i; + auto daughterpart1 = particles.begin() + indexOfDaughterpart1; + auto daughterpart2 = particles.begin() + indexOfDaughterpart2; + auto deta = daughterpart1.eta() - daughterpart2.eta(); + auto dphiAvg = averagePhiStar(*daughterpart1, *daughterpart2, i); + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[i][0]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[i][0]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; + } - if (!IsParticleNSigma((int8_t)1, p1.p(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p1, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p1, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p1, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(p1, o2::track::PID::Electron))) { - continue; + // if (std::pow(dphiAvg, 2) / std::pow(cutDeltaPhiStarMax, 2) + std::pow(deta, 2) / std::pow(cutDeltaEtaMax, 2) < 1.) { + if ((dphiAvg > cutDeltaPhiStarMin) && (dphiAvg < cutDeltaPhiStarMax) && (deta > cutDeltaEtaMin) && (deta < cutDeltaEtaMax)) { + pass = true; + } else { + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[i][1]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[i][1]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; + } } + } + return pass; - if (!IsParticleNSigma((int8_t)2, p2.p(), trackCuts.getNsigmaTPC(p2, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p2, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p2, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p2, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(p2, o2::track::PID::Electron))) { + } else if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kCascade && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kCascade) { + /// Cascade-Cascade combination + if (part1.partType() != o2::aod::femtouniverseparticle::ParticleType::kCascade || part2.partType() != o2::aod::femtouniverseparticle::ParticleType::kCascade) { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar instantiation! Please provide kCascade,kCascade candidates."; + return false; + } + + bool pass = false; + static constexpr int CascChildTable[][2] = {{-1, -1}, {-1, -2}, {-1, -3}, {-2, -2}, {-3, -3}, {-2, -1}, {-3, -1}}; + for (int i = 0; i < 7; i++) { + auto indexOfDaughterpart1 = (ChosenEventType == femto_universe_container::EventType::mixed ? part1.globalIndex() : part1.index()) + CascChildTable[i][0]; + auto indexOfDaughterpart2 = (ChosenEventType == femto_universe_container::EventType::mixed ? part2.globalIndex() : part2.index()) + CascChildTable[i][1]; + auto daughterpart1 = particles.begin() + indexOfDaughterpart1; + auto daughterpart2 = particles.begin() + indexOfDaughterpart2; + if (isSameSignCPR && (daughterpart1.mAntiLambda() != daughterpart2.mAntiLambda())) // mAntiLambda() is used here as sign getter continue; + auto deta = daughterpart1.eta() - daughterpart2.eta(); + auto dphiAvg = averagePhiStar(*daughterpart1, *daughterpart2, i); + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[i][0]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[i][0]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; } - if (twotracksconfigs.ConfIsCPR.value) { - if (confCPRIsAtITS.value) { - if (pairCloseRejection.isClosePairAtITS(p1, p2, magFieldTesla, femto_universe_container::EventType::same)) { - continue; - } + if ((dphiAvg > cutDeltaPhiStarMin) && (dphiAvg < cutDeltaPhiStarMax) && (deta > cutDeltaEtaMin) && (deta < cutDeltaEtaMax)) { + pass = true; + } else { + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[i][1]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[i][1]->Fill(deta, dphiAvg); } else { - if (pairCloseRejection.isClosePairFrac(p1, p2, magFieldTesla, femto_universe_container::EventType::same, confCPRDphiAvgOrDist, confCPRDistMax, confCPRFracMax, confIsCircularCut)) { - continue; - } + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; } } - - // track cleaning - if (!pairCleaner.isCleanPair(p1, p2, parts)) { - continue; - } - float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); - sameEventMultCont.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); } - } else { - for (const auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsOne, groupPartsOne))) { + return pass; - if (!IsParticleNSigma((int8_t)2, p1.p(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p1, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p1, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p1, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(p1, o2::track::PID::Electron))) { - continue; - } + } else if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kCascade) { + /// Track-Cascade combination + if (part1.partType() != o2::aod::femtouniverseparticle::ParticleType::kTrack || part2.partType() != o2::aod::femtouniverseparticle::ParticleType::kCascade) { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar instantiation! Please provide kTrack,kCascade candidates."; + return false; + } - if (!IsParticleNSigma((int8_t)2, p2.p(), trackCuts.getNsigmaTPC(p2, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p2, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p2, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p2, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(p2, o2::track::PID::Electron))) { + bool pass = false; + for (int i = 0; i < 3; i++) { + auto indexOfDaughter = (ChosenEventType == femto_universe_container::EventType::mixed ? part2.globalIndex() : part2.index()) - 3 + i; + auto daughter = particles.begin() + indexOfDaughter; + if (isSameSignCPR && (part1.mAntiLambda() != daughter.mAntiLambda())) // mAntiLambda() is used here as sign getter continue; + auto deta = part1.eta() - daughter.eta(); + auto dphiAvg = averagePhiStar(*part1, *daughter, i); + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[i][0]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[i][0]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; } - float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); - if (twotracksconfigs.ConfIsCPR.value) { - pairCloseRejection.kTdetadphi(p1, p2, femto_universe_container::EventType::same, kT); - if (confCPRIsAtITS.value) { - if (pairCloseRejection.isClosePairAtITS(p1, p2, magFieldTesla, femto_universe_container::EventType::same)) { - continue; - } + if ((dphiAvg > cutDeltaPhiStarMin) && (dphiAvg < cutDeltaPhiStarMax) && (deta > cutDeltaEtaMin) && (deta < cutDeltaEtaMax)) { + pass = true; + } else { + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[i][1]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[i][1]->Fill(deta, dphiAvg); } else { - if (pairCloseRejection.isClosePairFrac(p1, p2, magFieldTesla, femto_universe_container::EventType::same, confCPRDphiAvgOrDist, confCPRDistMax, confCPRFracMax, confIsCircularCut)) { - continue; - } + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; } } + } + return pass; + + } else if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kV0 && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kCascade) { + /// V0-Cascade combination + if (part1.partType() != o2::aod::femtouniverseparticle::ParticleType::kV0 || part2.partType() != o2::aod::femtouniverseparticle::ParticleType::kCascade) { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar instantiation! Please provide kV0,kCascade candidates."; + return false; + } - // track cleaning - if (!pairCleaner.isCleanPair(p1, p2, parts)) { + bool pass = false; + static constexpr int V0CascChildTable[][2] = {{-1, -1}, {-1, -2}, {-1, -3}, {-2, -1}, {-2, -2}, {-2, -3}}; + for (int i = 0; i < 3; i++) { + auto indexOfDaughterV0 = (ChosenEventType == femto_universe_container::EventType::mixed ? part1.globalIndex() : part1.index()) + V0CascChildTable[i][0]; + auto indexOfDaughterCasc = (ChosenEventType == femto_universe_container::EventType::mixed ? part2.globalIndex() : part2.index()) + V0CascChildTable[i][1]; + auto daughterV0 = particles.begin() + indexOfDaughterV0; + auto daughterCasc = particles.begin() + indexOfDaughterCasc; + if (isSameSignCPR && (daughterV0.mAntiLambda() != daughterCasc.mAntiLambda())) // mAntiLambda() is used here as sign getter continue; + auto deta = daughterV0.eta() - daughterCasc.eta(); + auto dphiAvg = averagePhiStar(*daughterV0, *daughterCasc, i); + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[i][0]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[i][0]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; } - double rand; - rand = randgen->Rndm(); - - std::vector f3d; - double kv; - float outsideref = 0.0; - - switch (ContType) { - case 2: { - if (rand > 0.5) { - f3d = FemtoUniverseMath::newpairfunc(p1, mass1, p2, mass2, ConfIsIden); - if (!twotracksconfigs.confUseCCImCut) { - sameEventMultContPP.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); - } else { - if (twotracksconfigs.confUse1stand3rd) { - if ((f3d[1] >= outsideref && f3d[2] >= outsideref) || (f3d[1] < outsideref && f3d[2] < outsideref)) { - sameEventMultContPP.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); - } - } else if (twotracksconfigs.confUse2ndand4th) { - if ((f3d[1] < outsideref && f3d[2] >= outsideref) || (f3d[1] >= outsideref && f3d[2] < outsideref)) { - sameEventMultContPP.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); - } - } - } - if (twotracksconfigs.ConfIsMC) { - float weight = 1.0f; - sameEventCont1D.setPair(p1, p2, multCol, twotracksconfigs.ConfUse3D, weight, ConfIsIden); - } - } else if (rand <= 0.5) { - f3d = FemtoUniverseMath::newpairfunc(p2, mass2, p1, mass1, ConfIsIden); - if (!twotracksconfigs.confUseCCImCut) { - sameEventMultContPP.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); - } else { - if (twotracksconfigs.confUse1stand3rd) { - if ((f3d[1] >= outsideref && f3d[2] >= outsideref) || (f3d[1] < outsideref && f3d[2] < outsideref)) { - sameEventMultContPP.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); - } - } else if (twotracksconfigs.confUse2ndand4th) { - if ((f3d[1] < outsideref && f3d[2] >= outsideref) || (f3d[1] >= outsideref && f3d[2] < outsideref)) { - sameEventMultContPP.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); - } - } - } - if (twotracksconfigs.ConfIsMC) { - float weight = 1.0f; - sameEventCont1D.setPair(p2, p1, multCol, twotracksconfigs.ConfUse3D, weight, ConfIsIden); - } - } - if (ConfIsFillAngqLCMS) { - kv = std::sqrt(f3d[1] * f3d[1] + f3d[2] * f3d[2] + f3d[3] * f3d[3]); - pairCloseRejection.ClosePairqLCMS(p1, p2, magFieldTesla, femto_universe_container::EventType::same, kv); - } - break; - } - - case 3: { - if (rand > 0.5) { - f3d = FemtoUniverseMath::newpairfunc(p1, mass1, p2, mass2, ConfIsIden); - if (!twotracksconfigs.confUseCCImCut) { - sameEventMultContMM.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); - } else { - if (twotracksconfigs.confUse1stand3rd) { - if ((f3d[1] >= outsideref && f3d[2] >= outsideref) || (f3d[1] < outsideref && f3d[2] < outsideref)) { - sameEventMultContMM.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); - } - } else if (twotracksconfigs.confUse2ndand4th) { - if ((f3d[1] < outsideref && f3d[2] >= outsideref) || (f3d[1] >= outsideref && f3d[2] < outsideref)) { - sameEventMultContMM.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); - } - } - } - if (twotracksconfigs.ConfIsMC) { - float weight = 1.0f; - sameEventCont1D.setPair(p1, p2, multCol, twotracksconfigs.ConfUse3D, weight, ConfIsIden); - } - } else if (rand <= 0.5) { - f3d = FemtoUniverseMath::newpairfunc(p2, mass2, p1, mass1, ConfIsIden); - if (!twotracksconfigs.confUseCCImCut) { - sameEventMultContMM.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); - } else { - if (twotracksconfigs.confUse1stand3rd) { - if ((f3d[1] >= outsideref && f3d[2] >= outsideref) || (f3d[1] < outsideref && f3d[2] < outsideref)) { - sameEventMultContMM.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); - } - } else if (twotracksconfigs.confUse2ndand4th) { - if ((f3d[1] < outsideref && f3d[2] >= outsideref) || (f3d[1] >= outsideref && f3d[2] < outsideref)) { - sameEventMultContMM.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); - } - } - } - if (twotracksconfigs.ConfIsMC) { - float weight = 1.0f; - sameEventCont1D.setPair(p2, p1, multCol, twotracksconfigs.ConfUse3D, weight, ConfIsIden); - } - } - if (ConfIsFillAngqLCMS) { - kv = std::sqrt(f3d[1] * f3d[1] + f3d[2] * f3d[2] + f3d[3] * f3d[3]); - pairCloseRejection.ClosePairqLCMS(p1, p2, magFieldTesla, femto_universe_container::EventType::same, kv); - } - break; + if ((dphiAvg > cutDeltaPhiStarMin) && (dphiAvg < cutDeltaPhiStarMax) && (deta > cutDeltaEtaMin) && (deta < cutDeltaEtaMax)) { + pass = true; + } else { + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[i][1]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[i][1]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; } - default: - break; } } - } - } + return pass; - /// process function for to call doSameEvent with Data - /// \param col subscribe to the collision table (Data) - /// \param parts subscribe to the femtoUniverseParticleTable - void processSameEvent(FilteredFDCollision const& col, - FilteredFemtoFullParticles const& parts) - { - fillCollision(col, ConfIsCent); - - auto thegroupPartsOne = partsOne->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); - auto thegroupPartsTwo = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); - - bool fillQA = true; - randgen = new TRandom2(0); - - if (ConfIsCent) { - if (cfgProcessPM) { - doSameEvent(thegroupPartsOne, thegroupPartsTwo, parts, col.magField(), col.multV0M(), 1, fillQA); - } - if (cfgProcessPP) { - doSameEvent(thegroupPartsOne, thegroupPartsOne, parts, col.magField(), col.multV0M(), 2, fillQA); - } - if (cfgProcessMM) { - doSameEvent(thegroupPartsTwo, thegroupPartsTwo, parts, col.magField(), col.multV0M(), 3, fillQA); - } - } else { - if (cfgProcessPM) { - doSameEvent(thegroupPartsOne, thegroupPartsTwo, parts, col.magField(), col.multNtr(), 1, fillQA); - } - if (cfgProcessPP) { - doSameEvent(thegroupPartsOne, thegroupPartsOne, parts, col.magField(), col.multNtr(), 2, fillQA); - } - if (cfgProcessMM) { - doSameEvent(thegroupPartsTwo, thegroupPartsTwo, parts, col.magField(), col.multNtr(), 3, fillQA); + } else if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kD0) { + /// Track-D0 combination + // check if provided particles are in agreement with the class instantiation + if (part1.partType() != o2::aod::femtouniverseparticle::ParticleType::kTrack || part2.partType() != o2::aod::femtouniverseparticle::ParticleType::kD0) { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar instantiation! Please provide kTrack, kD0 candidates."; + return false; } - } - delete randgen; - } - PROCESS_SWITCH(femtoUniversePairTaskTrackTrackSpherHarMultKtExtended, processSameEvent, "Enable processing same event", true); - - /// process function for to call doSameEvent with Monte Carlo - /// \param col subscribe to the collision table (Monte Carlo Reconstructed reconstructed) - /// \param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth - /// \param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table - void processSameEventMC(o2::aod::FdCollision const& col, - FilteredFemtoRecoParticles const& parts, - aod::FdMCParticles const&) - { - fillCollision(col, ConfIsCent); - auto thegroupPartsOne = partsOneMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); - auto thegroupPartsTwo = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); - bool fillQA = true; - randgen = new TRandom2(0); - - if (ConfIsCent) { - if (cfgProcessPM) { - doSameEvent(thegroupPartsOne, thegroupPartsTwo, parts, col.magField(), col.multV0M(), 1, fillQA); - } - if (cfgProcessPP) { - doSameEvent(thegroupPartsOne, thegroupPartsOne, parts, col.magField(), col.multV0M(), 2, fillQA); - } - if (cfgProcessMM) { - doSameEvent(thegroupPartsTwo, thegroupPartsTwo, parts, col.magField(), col.multV0M(), 3, fillQA); - } - } else { - if (cfgProcessPM) { - doSameEvent(thegroupPartsOne, thegroupPartsTwo, parts, col.magField(), col.multNtr(), 1, fillQA); - } - if (cfgProcessPP) { - doSameEvent(thegroupPartsOne, thegroupPartsOne, parts, col.magField(), col.multNtr(), 2, fillQA); - } - if (cfgProcessMM) { - doSameEvent(thegroupPartsTwo, thegroupPartsTwo, parts, col.magField(), col.multNtr(), 3, fillQA); - } - } - delete randgen; - } - PROCESS_SWITCH(femtoUniversePairTaskTrackTrackSpherHarMultKtExtended, processSameEventMC, "Enable processing same event for Monte Carlo", false); - - /// This function processes the same event and takes care of all the histogramming - /// \todo the trivial loops over the tracks should be factored out since they will be common to all combinations of T-T, T-V0, V0-V0, ... - /// @tparam PartitionType - /// @tparam PartType - /// @tparam isMC: enables Monte Carlo truth specific histograms - /// @param groupPartsOne partition for the first particle passed by the process function - /// @param groupPartsTwo partition for the second particle passed by the process function - /// @param parts femtoUniverseParticles table (in case of Monte Carlo joined with FemtoUniverseMCLabels) - /// @param magFieldTesla magnetic field of the collision - /// @param multCol multiplicity of the collision - template - void doSameEventMCTruth(PartitionType groupPartsOne, PartitionType groupPartsTwo, int multCol, int ContType, bool fillQA) - { + bool pass = false; + for (int i = 0; i < 2; i++) { + auto indexOfDaughter = 0; + if (ChosenEventType == femto_universe_container::EventType::mixed) { + indexOfDaughter = part2.globalIndex() - 2 + i; + } else if (ChosenEventType == femto_universe_container::EventType::same) { + indexOfDaughter = part2.index() - 2 + i; + } - randgen = new TRandom2(0); - /// Histogramming same event - if ((cfgProcessPM || cfgProcessPP) && fillQA) { - for (const auto& part : groupPartsOne) { - if (part.partType() == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) { - int pdgCode = static_cast(part.tempFitVar()); - const auto& pdgParticle = pdg->GetParticle(pdgCode); - if (pdgParticle) { - trackHistoPartOne.fillQA(part); - } + auto daughter = particles.begin() + indexOfDaughter; + auto deta = part1.eta() - daughter.eta(); + auto dphiAvg = averagePhiStar(part1, *daughter, i); // auto dphiAvg = calculateDphiStar(part1, *daughter); + dphiAvg = TVector2::Phi_mpi_pi(dphiAvg); + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[i][0]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[i][0]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; } - } - } - if ((cfgProcessPM || cfgProcessMM) && fillQA) { - for (const auto& part : groupPartsTwo) { - if (part.partType() == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) { - int pdgCode = static_cast(part.tempFitVar()); - const auto& pdgParticle = pdg->GetParticle(pdgCode); - if (pdgParticle) { - trackHistoPartTwo.fillQA(part); + if ((dphiAvg > cutDeltaPhiStarMin) && (dphiAvg < cutDeltaPhiStarMax) && (deta > cutDeltaEtaMin) && (deta < cutDeltaEtaMax)) { + pass = true; // pair is close + } else { + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[i][1]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[i][1]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; } } } - } + return pass; + } else if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kPhi) { + /// Track-Phi combination + // check if provided particles are in agreement with the class instantiation + if (part1.partType() != o2::aod::femtouniverseparticle::ParticleType::kTrack || part2.partType() != o2::aod::femtouniverseparticle::ParticleType::kPhi) { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar instantiation! Please provide kTrack,kPhi candidates."; + return false; + } - if (cfgProcessPM) { + bool pass = false; + for (int i = 0; i < 2; i++) { + auto indexOfDaughter = 0; + if (ChosenEventType == femto_universe_container::EventType::mixed) { + indexOfDaughter = part2.globalIndex() - 2 + i; + } else if (ChosenEventType == femto_universe_container::EventType::same) { + indexOfDaughter = part2.index() - 2 + i; + } - /// Now build the combinations for non-identical particle pairs - for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { + auto daughter = particles.begin() + indexOfDaughter; + auto deta = part1.eta() - daughter.eta(); + auto dphiAvg = averagePhiStar(part1, *daughter, i); // calculateDphiStar(part1, *daughter); + dphiAvg = TVector2::Phi_mpi_pi(dphiAvg); + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[i][0]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[i][0]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; + } - int pdgCodePartOne = static_cast(p1.tempFitVar()); - const auto& pdgParticleOne = pdg->GetParticle(pdgCodePartOne); - int pdgCodePartTwo = static_cast(p2.tempFitVar()); - const auto& pdgParticleTwo = pdg->GetParticle(pdgCodePartTwo); - if (pdgParticleOne && pdgParticleTwo && (pdgCodePartOne == trackonefilter.ConfPDGCodePartOne) && (pdgCodePartTwo == tracktwofilter.ConfPDGCodePartTwo)) { - float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); - sameEventMultCont.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); + // REMOVING THE "RING" -- CALCULATING THE INVARIANT MASS + TLorentzVector part1Vec; + TLorentzVector part2Vec; + float mMassOne = o2::constants::physics::MassKPlus; + float mMassTwo = o2::constants::physics::MassKMinus; + part1Vec.SetPtEtaPhiM(part1.pt(), part1.eta(), part1.phi(), mMassOne); + part2Vec.SetPtEtaPhiM(daughter.pt(), daughter.eta(), daughter.phi(), mMassTwo); + TLorentzVector sumVec(part1Vec); + sumVec += part2Vec; + float phiM = sumVec.M(); + if ((phiM > cutPhiInvMassLow) && (phiM < cutPhiInvMassHigh)) { + pass = true; // pair comes from Phi meson decay } - } - } else { - for (const auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsOne, groupPartsOne))) { - - int pdgCodePartOne = static_cast(p1.tempFitVar()); - const auto& pdgParticleOne = pdg->GetParticle(pdgCodePartOne); - int pdgCodePartTwo = static_cast(p2.tempFitVar()); - const auto& pdgParticleTwo = pdg->GetParticle(pdgCodePartTwo); - - float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); - double rand; - rand = randgen->Rndm(); - std::vector f3d; - if (pdgParticleOne && pdgParticleTwo && (pdgCodePartOne == trackonefilter.ConfPDGCodePartOne) && (pdgCodePartTwo == tracktwofilter.ConfPDGCodePartTwo)) { - - switch (ContType) { - case 2: { - if (rand > 0.5) { - sameEventMultContPP.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); - } else if (rand <= 0.5) { - sameEventMultContPP.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); - } - break; - } - - case 3: { - if (rand > 0.5) { - sameEventMultContMM.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); - } else if (rand <= 0.5) { - sameEventMultContMM.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); - } - break; - } - default: - break; + + // APPLYING THE CUTS + if ((dphiAvg > cutDeltaPhiStarMin) && (dphiAvg < cutDeltaPhiStarMax) && (deta > cutDeltaEtaMin) && (deta < cutDeltaEtaMax)) { + pass = true; // pair is close + } else { + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[i][1]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[i][1]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; } } } + return pass; + } else { + LOG(fatal) << "FemtoUniversePairCleaner: Combination of objects not defined - quitting!"; + return false; } - delete randgen; } - /// process function for to call doSameEvent with Monte Carlo - /// \param col subscribe to the collision table (Monte Carlo Reconstructed reconstructed) - /// \param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth - /// \param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table - void processSameEventMCTruth(o2::aod::FdCollision const& col, - FemtoTruthParticles const&) + /// Check if pair is close or not + template + bool isClosePairAtITS(Part const& part1, Part const& part2, float lmagfield, uint8_t ChosenEventType) { - fillCollision(col, ConfIsCent); - - auto thegroupPartsOne = partsOneMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); - auto thegroupPartsTwo = partsTwoMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); - bool fillQA = true; - - int pairType = 0; - if (cfgProcessPM) { - pairType = 1; - } else if (cfgProcessPP) { - pairType = 2; - } else if (cfgProcessMM) { - pairType = 3; - } + magfield = lmagfield; - if (ConfIsCent) { - if (cfgProcessPM) { - doSameEventMCTruth(thegroupPartsOne, thegroupPartsTwo, col.multV0M(), pairType, fillQA); + if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kTrack) { + /// Track-Track combination + // check if provided particles are in agreement with the class instantiation + if (part1.partType() != o2::aod::femtouniverseparticle::ParticleType::kTrack || part2.partType() != o2::aod::femtouniverseparticle::ParticleType::kTrack) { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar instantiation! Please provide kTrack,kTrack candidates."; + return false; } - if (cfgProcessPP) { - doSameEventMCTruth(thegroupPartsOne, thegroupPartsOne, col.multV0M(), pairType, fillQA); + auto deta = part1.eta() - part2.eta(); + auto dphiAvg = part1.phi() - part2.phi(); + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[0][0]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[0][0]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; } - if (cfgProcessMM) { - doSameEventMCTruth(thegroupPartsTwo, thegroupPartsTwo, col.multV0M(), pairType, fillQA); + + if (std::pow(dphiAvg, 2) / std::pow(cutDeltaPhiStarMax, 2) + std::pow(deta, 2) / std::pow(cutDeltaEtaMax, 2) < 1.) { + return true; + } else { + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[0][1]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[0][1]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; + } + return false; } } else { - if (cfgProcessPM) { - doSameEventMCTruth(thegroupPartsOne, thegroupPartsTwo, col.multNtr(), pairType, fillQA); - } - if (cfgProcessPP) { - doSameEventMCTruth(thegroupPartsOne, thegroupPartsOne, col.multNtr(), pairType, fillQA); - } - if (cfgProcessMM) { - doSameEventMCTruth(thegroupPartsTwo, thegroupPartsTwo, col.multNtr(), pairType, fillQA); - } + LOG(fatal) << "FemtoUniversePairCleaner: Combination of objects not defined - quitting!"; + return false; } } - PROCESS_SWITCH(femtoUniversePairTaskTrackTrackSpherHarMultKtExtended, processSameEventMCTruth, "Enable processing same event for MC truth", false); - - /// This function processes the mixed event - /// \todo the trivial loops over the collisions and tracks should be factored out since they will be common to all combinations of T-T, T-V0, V0-V0, ... - /// \tparam PartitionType - /// \tparam PartType - /// \tparam isMC: enables Monte Carlo truth specific histograms - /// \param groupPartsOne partition for the first particle passed by the process function - /// \param groupPartsTwo partition for the second particle passed by the process function - /// \param parts femtoUniverseParticles table (in case of Monte Carlo joined with FemtoUniverseMCLabels) - /// \param magFieldTesla magnetic field of the collision - /// \param multCol multiplicity of the collision - template - void doMixedEvent(PartitionType groupPartsOne, PartitionType groupPartsTwo, float magFieldTesla, int multCol, int ContType) - { - for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { + template + bool isClosePairFrac(Part const& part1, Part const& part2, float lmagfield, uint8_t ChosenEventType, bool IsDphiAvgOrDist, float DistMax, float FracMax, bool CircCut) + { + magfield = lmagfield; - if (!IsParticleNSigma((int8_t)2, p1.p(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p1, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p1, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p1, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(p1, o2::track::PID::Electron))) { - continue; + if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kTrack) { + /// Track-Track combination + // check if provided particles are in agreement with the class instantiation + if (part1.partType() != o2::aod::femtouniverseparticle::ParticleType::kTrack || part2.partType() != o2::aod::femtouniverseparticle::ParticleType::kTrack) { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar instantiation! Please provide kTrack,kTrack candidates."; + return false; } - - if (!IsParticleNSigma((int8_t)2, p2.p(), trackCuts.getNsigmaTPC(p2, o2::track::PID::Proton), trackCuts.getNsigmaTOF(p2, o2::track::PID::Proton), trackCuts.getNsigmaTPC(p2, o2::track::PID::Pion), trackCuts.getNsigmaTOF(p2, o2::track::PID::Pion), trackCuts.getNsigmaTPC(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p2, o2::track::PID::Kaon), trackCuts.getNsigmaTPC(p2, o2::track::PID::Electron))) { - continue; + auto deta = part1.eta() - part2.eta(); + auto dphiAvg = averagePhiStar(part1, part2, 0); + auto distfrac = averagePhiStarFrac(part1, part2, DistMax); + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[0][0]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[0][0]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; } - float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); - if (twotracksconfigs.ConfIsCPR.value) { - pairCloseRejection.kTdetadphi(p1, p2, femto_universe_container::EventType::mixed, kT); - if (confCPRIsAtITS.value) { - if (pairCloseRejection.isClosePairAtITS(p1, p2, magFieldTesla, femto_universe_container::EventType::mixed)) { - continue; - } + if (IsDphiAvgOrDist) { + if (CircCut && (std::pow(dphiAvg, 2) / std::pow(cutDeltaPhiStarMax, 2) + std::pow(deta, 2) / std::pow(cutDeltaEtaMax, 2) < 1.)) { + return true; + } else if (!CircCut && (dphiAvg > cutDeltaPhiStarMin) && (dphiAvg < cutDeltaPhiStarMax) && (deta > cutDeltaEtaMin) && (deta < cutDeltaEtaMax)) { + return true; } else { - if (pairCloseRejection.isClosePairFrac(p1, p2, magFieldTesla, femto_universe_container::EventType::mixed, confCPRDphiAvgOrDist, confCPRDistMax, confCPRFracMax, confIsCircularCut)) { - continue; - } - } - } - - double rand; - rand = randgen->Rndm(); - - std::vector f3d; - double kv; - float outsideref = 0.0; - - switch (ContType) { - case 1: { - if (rand > 0.5) { - mixedEventMultCont.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); - } else { - mixedEventMultCont.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); - } - break; - } - - case 2: { - if (rand > 0.5) { - f3d = FemtoUniverseMath::newpairfunc(p1, mass1, p2, mass2, ConfIsIden); - if (!twotracksconfigs.confUseCCImCut) { - mixedEventMultContPP.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); - } else { - if (twotracksconfigs.confUse1stand3rd) { - if ((f3d[1] >= outsideref && f3d[2] >= outsideref) || (f3d[1] < outsideref && f3d[2] < outsideref)) { - mixedEventMultContPP.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); - } - } else if (twotracksconfigs.confUse2ndand4th) { - if ((f3d[1] < outsideref && f3d[2] >= outsideref) || (f3d[1] >= outsideref && f3d[2] < outsideref)) { - mixedEventMultContPP.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); - } - } - } + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[0][1]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[0][1]->Fill(deta, dphiAvg); } else { - f3d = FemtoUniverseMath::newpairfunc(p2, mass2, p1, mass1, ConfIsIden); - if (!twotracksconfigs.confUseCCImCut) { - mixedEventMultContPP.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); - } else { - if (twotracksconfigs.confUse1stand3rd) { - if ((f3d[1] >= outsideref && f3d[2] >= outsideref) || (f3d[1] < outsideref && f3d[2] < outsideref)) { - mixedEventMultContPP.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); - } - } else if (twotracksconfigs.confUse2ndand4th) { - if ((f3d[1] < outsideref && f3d[2] >= outsideref) || (f3d[1] >= outsideref && f3d[2] < outsideref)) { - mixedEventMultContPP.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); - } - } - } - } - if (ConfIsFillAngqLCMS) { - kv = std::sqrt(f3d[1] * f3d[1] + f3d[2] * f3d[2] + f3d[3] * f3d[3]); - pairCloseRejection.ClosePairqLCMS(p1, p2, magFieldTesla, femto_universe_container::EventType::mixed, kv); + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; } - break; + return false; } - - case 3: { - if (rand > 0.5) { - f3d = FemtoUniverseMath::newpairfunc(p1, mass1, p2, mass2, ConfIsIden); - if (!twotracksconfigs.confUseCCImCut) { - mixedEventMultContMM.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); - } else { - if (twotracksconfigs.confUse1stand3rd) { - if ((f3d[1] >= outsideref && f3d[2] >= outsideref) || (f3d[1] < outsideref && f3d[2] < outsideref)) { - mixedEventMultContMM.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); - } - } else if (twotracksconfigs.confUse2ndand4th) { - if ((f3d[1] < outsideref && f3d[2] >= outsideref) || (f3d[1] >= outsideref && f3d[2] < outsideref)) { - mixedEventMultContMM.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); - } - } - } + } else { + if (((deta > cutDeltaEtaMin) && (deta < cutDeltaEtaMax)) && (distfrac > FracMax)) { + return true; + } else { + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[0][1]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[0][1]->Fill(deta, dphiAvg); } else { - f3d = FemtoUniverseMath::newpairfunc(p2, mass2, p1, mass1, ConfIsIden); - if (!twotracksconfigs.confUseCCImCut) { - mixedEventMultContMM.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); - } else { - if (twotracksconfigs.confUse1stand3rd) { - if ((f3d[1] >= outsideref && f3d[2] >= outsideref) || (f3d[1] < outsideref && f3d[2] < outsideref)) { - mixedEventMultContMM.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); - } - } else if (twotracksconfigs.confUse2ndand4th) { - if ((f3d[1] < outsideref && f3d[2] >= outsideref) || (f3d[1] >= outsideref && f3d[2] < outsideref)) { - mixedEventMultContMM.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); - } - } - } + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; } - if (ConfIsFillAngqLCMS) { - kv = std::sqrt(f3d[1] * f3d[1] + f3d[2] * f3d[2] + f3d[3] * f3d[3]); - pairCloseRejection.ClosePairqLCMS(p1, p2, magFieldTesla, femto_universe_container::EventType::mixed, kv); - } - break; + return false; } - - default: - break; } + + } else { + LOG(fatal) << "FemtoUniversePairCleaner: Combination of objects not defined - quitting!"; + return false; } } - /// process function for to call doMixedEvent with Data - /// @param cols subscribe to the collisions table (Data) - /// @param subscribe to the femtoUniverseParticleTable - void processMixedEventCent(FilteredFDCollisions const& cols, - FilteredFemtoFullParticles const&) + /// Check if pair is close or not + template + bool isClosePairkT(Part const& part1, Part const& part2, uint8_t ChosenEventType, float ktval, bool CircCut) { - randgen = new TRandom2(0); - - for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningCent, ConfNEventsMix, -1, cols, cols)) { + /// Track-Track combination + // check if provided particles are in agreement with the class instantiation + if (part1.partType() != o2::aod::femtouniverseparticle::ParticleType::kTrack || part2.partType() != o2::aod::femtouniverseparticle::ParticleType::kTrack) { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar instantiation! Please provide kTrack,kTrack candidates."; + return false; + } - const int multiplicityCol = collision1.multV0M(); - MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningCent.getBin({collision1.posZ(), multiplicityCol})); + int ktbinval = -1; + if (ktval >= ktBins[0] && ktval < ktBins[1]) { + ktbinval = 0; + } else if (ktval >= ktBins[1] && ktval < ktBins[2]) { + ktbinval = 1; + } else if (ktval >= ktBins[2] && ktval < ktBins[3]) { + ktbinval = 2; + } else if (ktval >= ktBins[3] && ktval < ktBins[4]) { + ktbinval = 3; + } - const auto& magFieldTesla1 = collision1.magField(); - const auto& magFieldTesla2 = collision2.magField(); + auto deta = part1.eta() - part2.eta(); + auto dphiAvg = averagePhiStar(part1, part2, 0); + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadphisamebeforekT[ktbinval]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadphimixedbeforekT[ktbinval]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; + } - if (magFieldTesla1 != magFieldTesla2) { - continue; + if (std::pow(dphiAvg, 2) / std::pow(cutDeltaPhiStarMaxVector[ktbinval], 2) + std::pow(deta, 2) / std::pow(cutDeltaEtaMaxVector[ktbinval], 2) > 1.) { + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadphisameafterkT[ktbinval]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadphimixedafterkT[ktbinval]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; } + } - if (cfgProcessPM) { - auto groupPartsOne = partsOne->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); - auto groupPartsTwo = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); - doMixedEvent(groupPartsOne, groupPartsTwo, magFieldTesla1, multiplicityCol, 1); - } - if (cfgProcessPP) { - auto groupPartsOne = partsOne->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); - auto groupPartsTwo = partsOne->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); - doMixedEvent(groupPartsOne, groupPartsTwo, magFieldTesla1, multiplicityCol, 2); - } - if (cfgProcessMM) { - auto groupPartsOne = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); - auto groupPartsTwo = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); - doMixedEvent(groupPartsOne, groupPartsTwo, magFieldTesla1, multiplicityCol, 3); + if (CircCut && (std::pow(dphiAvg, 2) / std::pow(cutDeltaPhiStarMaxVector[ktbinval], 2) + std::pow(deta, 2) / std::pow(cutDeltaEtaMaxVector[ktbinval], 2) < 1.)) { + return true; + } else if (!CircCut && (dphiAvg > cutDeltaPhiStarMinVector[ktbinval]) && (dphiAvg < cutDeltaPhiStarMaxVector[ktbinval]) && (deta > cutDeltaEtaMinVector[ktbinval]) && (deta < cutDeltaEtaMaxVector[ktbinval])) { + return true; + } else { + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadphisameafterkT[ktbinval]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadphimixedafterkT[ktbinval]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; } + return false; } - delete randgen; } - PROCESS_SWITCH(femtoUniversePairTaskTrackTrackSpherHarMultKtExtended, processMixedEventCent, "Enable processing mixed events for centrality", true); - /// process function for to call doMixedEvent with Data - /// @param cols subscribe to the collisions table (Data) - /// @param parts subscribe to the femtoUniverseParticleTable - void processMixedEventNtr(FilteredFDCollisions const& cols, - FilteredFemtoFullParticles const&) + /// Check if pair is close or not + template + void ClosePairqLCMS(Part const& part1, Part const& part2, float lmagfield, uint8_t ChosenEventType, double qlcms) // add typename Parts and variable parts for adding MClabels { - randgen = new TRandom2(0); - - for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningNtr, ConfNEventsMix, -1, cols, cols)) { - - const int multiplicityCol = collision1.multNtr(); - MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningNtr.getBin({collision1.posZ(), multiplicityCol})); - - const auto& magFieldTesla1 = collision1.magField(); - const auto& magFieldTesla2 = collision2.magField(); - - if (magFieldTesla1 != magFieldTesla2) { - continue; - } - - if (cfgProcessPM) { - auto groupPartsOne = partsOne->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); - auto groupPartsTwo = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); - doMixedEvent(groupPartsOne, groupPartsTwo, magFieldTesla1, multiplicityCol, 1); - } - if (cfgProcessPP) { - auto groupPartsOne = partsOne->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); - auto groupPartsTwo = partsOne->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); - doMixedEvent(groupPartsOne, groupPartsTwo, magFieldTesla1, multiplicityCol, 2); - } - if (cfgProcessMM) { - auto groupPartsOne = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); - auto groupPartsTwo = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); - doMixedEvent(groupPartsOne, groupPartsTwo, magFieldTesla1, multiplicityCol, 3); + magfield = lmagfield; + if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kTrack) { + auto deta = part1.eta() - part2.eta(); + auto dphiAvg = averagePhiStar(part1, part2, 0); + + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpiqlcmssame->Fill(qlcms, deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpiqlcmsmixed->Fill(qlcms, deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; } } - delete randgen; } - PROCESS_SWITCH(femtoUniversePairTaskTrackTrackSpherHarMultKtExtended, processMixedEventNtr, "Enable processing mixed events for centrality", false); - - /// brief process function for to call doMixedEvent with Monte Carlo - /// @param cols subscribe to the collisions table (Monte Carlo Reconstructed reconstructed) - /// @param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth - /// @param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table - void processMixedEventMCCent(o2::aod::FdCollisions const& cols, - soa::Join const&, - o2::aod::FdMCParticles const&) - { - randgen = new TRandom2(0); - for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningCent, ConfNEventsMix, -1, cols, cols)) { - - const int multiplicityCol = collision1.multV0M(); - MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningCent.getBin({collision1.posZ(), multiplicityCol})); - - const auto& magFieldTesla1 = collision1.magField(); - const auto& magFieldTesla2 = collision2.magField(); - - if (magFieldTesla1 != magFieldTesla2) { - continue; - } - /// \todo before mixing we should check whether both collisions contain a pair of particles! - // if (partsOne.size() == 0 || nPart2Evt1 == 0 || nPart1Evt2 == 0 || partsTwo.size() == 0 ) continue; + private: + HistogramRegistry* mHistogramRegistry = nullptr; ///< For main output + HistogramRegistry* mHistogramRegistryQA = nullptr; ///< For QA output + static constexpr std::string_view DirNames[8] = {"kTrack_kTrack/", "kTrack_kV0/", "kV0_kV0/", "kTrack_kPhi/", "kTrack_kD0/", "kCascade_kCascade/", "kTrack_kCascade/", "kV0_kCascade/"}; + + static constexpr std::string_view HistNamesSame[2][8] = {{"detadphidetadphi0BeforeSame_0", "detadphidetadphi0BeforeSame_1", "detadphidetadphi0BeforeSame_2", + "detadphidetadphi0BeforeSame_3", "detadphidetadphi0BeforeSame_4", "detadphidetadphi0BeforeSame_5", + "detadphidetadphi0BeforeSame_6", "detadphidetadphi0BeforeSameqLCMS"}, + {"detadphidetadphi0AfterSame_0", "detadphidetadphi0AfterSame_1", "detadphidetadphi0AfterSame_2", + "detadphidetadphi0AfterSame_3", "detadphidetadphi0AfterSame_4", "detadphidetadphi0AfterSame_5", + "detadphidetadphi0AfterSame_6", "detadphidetadphi0AfterSameqLCMS"}}; + static constexpr std::string_view HistNamesMixed[2][8] = {{"detadphidetadphi0BeforeMixed_0", "detadphidetadphi0BeforeMixed_1", "detadphidetadphi0BeforeMixed_2", + "detadphidetadphi0BeforeMixed_3", "detadphidetadphi0BeforeMixed_4", "detadphidetadphi0BeforeMixed_5", + "detadphidetadphi0BeforeMixed_6", "detadphidetadphi0BeforeMixedqLCMS"}, + {"detadphidetadphi0AfterMixed_0", "detadphidetadphi0AfterMixed_1", "detadphidetadphi0AfterMixed_2", + "detadphidetadphi0AfterMixed_3", "detadphidetadphi0AfterMixed_4", "detadphidetadphi0AfterMixed_5", + "detadphidetadphi0AfterMixed_6", "detadphidetadphi0AfterMixedqLCMS"}}; + + static constexpr std::string_view HistNamesRadii[7][9] = {{"detadphidetadphi0Before_0_0", "detadphidetadphi0Before_0_1", "detadphidetadphi0Before_0_2", + "detadphidetadphi0Before_0_3", "detadphidetadphi0Before_0_4", "detadphidetadphi0Before_0_5", + "detadphidetadphi0Before_0_6", "detadphidetadphi0Before_0_7", "detadphidetadphi0Before_0_8"}, + {"detadphidetadphi0Before_1_0", "detadphidetadphi0Before_1_1", "detadphidetadphi0Before_1_2", + "detadphidetadphi0Before_1_3", "detadphidetadphi0Before_1_4", "detadphidetadphi0Before_1_5", + "detadphidetadphi0Before_1_6", "detadphidetadphi0Before_1_7", "detadphidetadphi0Before_1_8"}, + {"detadphidetadphi0Before_2_0", "detadphidetadphi0Before_2_1", "detadphidetadphi0Before_2_2", + "detadphidetadphi0Before_2_3", "detadphidetadphi0Before_2_4", "detadphidetadphi0Before_2_5", + "detadphidetadphi0Before_2_6", "detadphidetadphi0Before_2_7", "detadphidetadphi0Before_2_8"}, + {"detadphidetadphi0Before_3_0", "detadphidetadphi0Before_3_1", "detadphidetadphi0Before_3_2", + "detadphidetadphi0Before_3_3", "detadphidetadphi0Before_3_4", "detadphidetadphi0Before_3_5", + "detadphidetadphi0Before_3_6", "detadphidetadphi0Before_3_7", "detadphidetadphi0Before_3_8"}, + {"detadphidetadphi0Before_4_0", "detadphidetadphi0Before_4_1", "detadphidetadphi0Before_4_2", + "detadphidetadphi0Before_4_3", "detadphidetadphi0Before_4_4", "detadphidetadphi0Before_4_5", + "detadphidetadphi0Before_4_6", "detadphidetadphi0Before_4_7", "detadphidetadphi0Before_4_8"}, + {"detadphidetadphi0Before_5_0", "detadphidetadphi0Before_5_1", "detadphidetadphi0Before_5_2", + "detadphidetadphi0Before_5_3", "detadphidetadphi0Before_5_4", "detadphidetadphi0Before_5_5", + "detadphidetadphi0Before_5_6", "detadphidetadphi0Before_5_7", "detadphidetadphi0Before_5_8"}, + {"detadphidetadphi0Before_6_0", "detadphidetadphi0Before_6_1", "detadphidetadphi0Before_6_2", + "detadphidetadphi0Before_6_3", "detadphidetadphi0Before_6_4", "detadphidetadphi0Before_6_5", + "detadphidetadphi0Before_6_6", "detadphidetadphi0Before_6_7", "detadphidetadphi0Before_6_8"}}; + + static constexpr o2::aod::femtouniverseparticle::ParticleType kPartOneType = partOne; ///< Type of particle 1 + static constexpr o2::aod::femtouniverseparticle::ParticleType kPartTwoType = partTwo; ///< Type of particle 2 + + static constexpr float TmpRadiiTPC[9] = {85., 105., 125., 145., 165., 185., 205., 225., 245.}; + + static constexpr uint32_t kSignMinusMask = 1; + static constexpr uint32_t kSignPlusMask = 1 << 1; + static constexpr uint32_t kValue0 = 0; + + float chosenRadii; + float cutDeltaPhiStarMax; + float cutDeltaPhiStarMin; + float cutDeltaEtaMax; + float cutDeltaEtaMin; + + std::vector cutDeltaPhiStarMaxVector; + std::vector cutDeltaPhiStarMinVector; + std::vector cutDeltaEtaMaxVector; + std::vector cutDeltaEtaMinVector; + + float magfield; + bool plotForEveryRadii = false; + float cutPhiInvMassLow; + float cutPhiInvMassHigh; + bool isSameSignCPR = false; + std::vector ktBins; + + std::array, 2>, 7> histdetadpisame{}; + std::array, 2>, 7> histdetadpimixed{}; + std::array, 4> histdetadphisamebeforekT{}; + std::array, 4> histdetadphimixedbeforekT{}; + std::array, 4> histdetadphisameafterkT{}; + std::array, 4> histdetadphimixedafterkT{}; + + std::array, 9>, 7> histdetadpiRadii{}; + + std::shared_ptr histdetadpiqlcmssame{}; + std::shared_ptr histdetadpiqlcmsmixed{}; + + /// Calculate phi at all required radii stored in TmpRadiiTPC + /// Magnetic field to be provided in Tesla + template + void phiAtRadiiTPC(const T& part, std::vector& tmpVec) + { - if (cfgProcessPM) { - auto groupPartsOne = partsOneMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); - auto groupPartsTwo = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); - doMixedEvent(groupPartsOne, groupPartsTwo, magFieldTesla1, multiplicityCol, 1); - } - if (cfgProcessPP) { - auto groupPartsOne = partsOneMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); - auto groupPartsTwo = partsOneMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); - doMixedEvent(groupPartsOne, groupPartsTwo, magFieldTesla1, multiplicityCol, 2); - } - if (cfgProcessMM) { - auto groupPartsOne = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); - auto groupPartsTwo = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); - doMixedEvent(groupPartsOne, groupPartsTwo, magFieldTesla1, multiplicityCol, 3); + float phi0 = part.phi(); + // Start: Get the charge from cutcontainer using masks + float charge = 0.; + if ((part.cut() & kSignMinusMask) == kValue0 && (part.cut() & kSignPlusMask) == kValue0) { + charge = 0; + } else if ((part.cut() & kSignPlusMask) == kSignPlusMask) { + charge = 1; + } else if ((part.cut() & kSignMinusMask) == kSignMinusMask) { + charge = -1; + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: Charge bits are set wrong!"; + } + // End: Get the charge from cutcontainer using masks + float pt = part.pt(); + for (size_t i = 0; i < 9; i++) { + double arg = 0.3 * charge * magfield * TmpRadiiTPC[i] * 0.01 / (2. * pt); + if (std::abs(arg) < 1.0) { + tmpVec.push_back(phi0 - std::asin(arg)); + } else { + tmpVec.push_back(999.0); } } - delete randgen; } - PROCESS_SWITCH(femtoUniversePairTaskTrackTrackSpherHarMultKtExtended, processMixedEventMCCent, "Enable processing mixed events MC", false); - - /// brief process function for to call doMixedEvent with Monte Carlo - /// @param cols subscribe to the collisions table (Monte Carlo Reconstructed reconstructed) - /// @param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth - /// @param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table - void processMixedEventMCNtr(o2::aod::FdCollisions const& cols, - soa::Join const&, - o2::aod::FdMCParticles const&) - { - randgen = new TRandom2(0); - - for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningNtr, ConfNEventsMix, -1, cols, cols)) { - - const int multiplicityCol = collision1.multV0M(); - MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningNtr.getBin({collision1.posZ(), multiplicityCol})); - - const auto& magFieldTesla1 = collision1.magField(); - const auto& magFieldTesla2 = collision2.magField(); - if (magFieldTesla1 != magFieldTesla2) { - continue; - } - /// \todo before mixing we should check whether both collisions contain a pair of particles! - // if (partsOne.size() == 0 || nPart2Evt1 == 0 || nPart1Evt2 == 0 || partsTwo.size() == 0 ) continue; - - if (cfgProcessPM) { - auto groupPartsOne = partsOneMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); - auto groupPartsTwo = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); - doMixedEvent(groupPartsOne, groupPartsTwo, magFieldTesla1, multiplicityCol, 1); - } - if (cfgProcessPP) { - auto groupPartsOne = partsOneMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); - auto groupPartsTwo = partsOneMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); - doMixedEvent(groupPartsOne, groupPartsTwo, magFieldTesla1, multiplicityCol, 2); + /// Calculate average phi + template + float averagePhiStar(const T1& part1, const T2& part2, int iHist) + { + std::vector tmpVec1; + std::vector tmpVec2; + phiAtRadiiTPC(part1, tmpVec1); + phiAtRadiiTPC(part2, tmpVec2); + int num = tmpVec1.size(); + float dPhiAvg = 0; + float dphi = 0; + int entries = 0; + for (int i = 0; i < num; i++) { + if (tmpVec1.at(i) != 999 && tmpVec2.at(i) != 999) { + dphi = tmpVec1.at(i) - tmpVec2.at(i); + entries++; + } else { + dphi = 0; } - if (cfgProcessMM) { - auto groupPartsOne = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); - auto groupPartsTwo = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); - doMixedEvent(groupPartsOne, groupPartsTwo, magFieldTesla1, multiplicityCol, 3); + dphi = TVector2::Phi_mpi_pi(dphi); + dPhiAvg += dphi; + if (plotForEveryRadii) { + histdetadpiRadii[iHist][i]->Fill(part1.eta() - part2.eta(), dphi); } } - delete randgen; + return dPhiAvg / static_cast(entries); } - PROCESS_SWITCH(femtoUniversePairTaskTrackTrackSpherHarMultKtExtended, processMixedEventMCNtr, "Enable processing mixed events MC", false); - - /// This function processes the mixed event - /// \todo the trivial loops over the collisions and tracks should be factored out since they will be common to all combinations of T-T, T-V0, V0-V0, ... - /// \tparam PartitionType - /// \tparam PartType - /// \tparam isMC: enables Monte Carlo truth specific histograms - /// \param groupPartsOne partition for the first particle passed by the process function - /// \param groupPartsTwo partition for the second particle passed by the process function - /// \param parts femtoUniverseParticles table (in case of Monte Carlo joined with FemtoUniverseMCLabels) - /// \param magFieldTesla magnetic field of the collision - /// \param multCol multiplicity of the collision - template - void doMixedEventMCTruth(PartitionType groupPartsOne, PartitionType groupPartsTwo, int multCol, int ContType) - { - randgen = new TRandom2(0); - for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { - - int pdgCodePartOne = static_cast(p1.tempFitVar()); - const auto& pdgParticleOne = pdg->GetParticle(pdgCodePartOne); - int pdgCodePartTwo = static_cast(p2.tempFitVar()); - const auto& pdgParticleTwo = pdg->GetParticle(pdgCodePartTwo); - - float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); - double rand; - rand = randgen->Rndm(); - if (pdgParticleOne && pdgParticleTwo && (pdgCodePartOne == trackonefilter.ConfPDGCodePartOne) && (pdgCodePartTwo == tracktwofilter.ConfPDGCodePartTwo)) { - - switch (ContType) { - case 1: { - if (rand > 0.5) { - mixedEventMultCont.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); - } else { - mixedEventMultCont.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); - } - break; - } - - case 2: { - if (rand > 0.5) { - mixedEventMultContPP.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); - } else { - mixedEventMultContPP.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); - } - break; - } - case 3: { - if (rand > 0.5) { - mixedEventMultContMM.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); - } else { - mixedEventMultContMM.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); - } - break; - } - default: - break; - } + /// Calculate average phi + template + float averagePhiStarFrac(const T1& part1, const T2& part2, float maxdist) + { + std::vector tmpVec1; + std::vector tmpVec2; + phiAtRadiiTPC(part1, tmpVec1); + phiAtRadiiTPC(part2, tmpVec2); + int num = tmpVec1.size(); + float dphi = 0; + int entries = 0; + double distance = 0; + int badpoints = 0; + + for (int i = 0; i < num; i++) { + if (tmpVec1.at(i) != 999 && tmpVec2.at(i) != 999) { + dphi = tmpVec1.at(i) - tmpVec2.at(i); + entries++; + } else { + dphi = 0; + } + dphi = TVector2::Phi_mpi_pi(dphi); + distance = 2 * TMath::Sin(TMath::Abs(dphi) * 0.5) * TmpRadiiTPC[i]; + if (distance < maxdist) { + badpoints++; } } - delete randgen; + return badpoints / entries; } - /// process function for to call doMixedEvent with Data - /// @param cols subscribe to the collisions table (Data) - /// @param parts subscribe to the femtoUniverseParticleTable - void processMixedEventNtrMCTruth(o2::aod::FdCollisions const& cols, - FemtoTruthParticles const&) + // Get particle charge from mask + template + float getCharge(const T1& part) { - int pairType = 0; - if (cfgProcessPM) { - pairType = 1; - } else if (cfgProcessPP) { - pairType = 2; - } else if (cfgProcessMM) { - pairType = 3; + float charge = 0; + if ((part.cut() & kSignMinusMask) == kValue0 && (part.cut() & kSignPlusMask) == kValue0) { + charge = 0; + } else if ((part.cut() & kSignPlusMask) == kSignPlusMask) { + charge = 1; + } else if ((part.cut() & kSignMinusMask) == kSignMinusMask) { + charge = -1; + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: Charge bits are set wrong!"; } + return charge; + } - for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningNtr, ConfNEventsMix, -1, cols, cols)) { + // Calculate phi* as in https://github.com/alisw/AliPhysics/blob/master/PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoPairCutRadialDistance.cxx + template + double calculateDphiStar(const T1& part1, const T2& part2) + { + float charge1 = getCharge(part1); + float charge2 = getCharge(part2); - const int multiplicityCol = collision1.multNtr(); - MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningNtr.getBin({collision1.posZ(), multiplicityCol})); + double deltaphiconstFD = 0.3 / 2; + // double deltaphiconstAF = 0.15; + double afsi0b = deltaphiconstFD * magfield * charge1 * chosenRadii / part1.pt(); + double afsi1b = deltaphiconstFD * magfield * charge2 * chosenRadii / part2.pt(); + double dphis = 0.0; - if (cfgProcessPM) { - auto groupPartsOne = partsOneMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); - auto groupPartsTwo = partsTwoMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); - doMixedEventMCTruth(groupPartsOne, groupPartsTwo, multiplicityCol, pairType); - } - if (cfgProcessPP) { - auto groupPartsOne = partsOneMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); - auto groupPartsTwo = partsOneMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); - doMixedEventMCTruth(groupPartsOne, groupPartsTwo, multiplicityCol, pairType); - } - if (cfgProcessMM) { - auto groupPartsOne = partsTwoMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); - auto groupPartsTwo = partsTwoMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); - doMixedEventMCTruth(groupPartsOne, groupPartsTwo, multiplicityCol, pairType); - } + if (std::abs(afsi0b) < 1.0 && std::abs(afsi0b) < 1.0) { + dphis = part2.phi() - part1.phi() + std::asin(afsi1b) - std::asin(afsi0b); } + return dphis; } - PROCESS_SWITCH(femtoUniversePairTaskTrackTrackSpherHarMultKtExtended, processMixedEventNtrMCTruth, "Enable processing MC Truth mixed events for multiplicity", false); }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - WorkflowSpec workflow{ - adaptAnalysisTask(cfgc), - }; - return workflow; -} +} /* namespace femto_universe */ +} /* namespace o2::analysis */ + +#endif // PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEDETADPHISTAR_H_